This commit is contained in:
Paul 2000-12-20 22:46:12 +00:00
parent b56cd688ae
commit a9a9af96f5
8 changed files with 54 additions and 23 deletions

View File

@ -37,10 +37,20 @@ vx=velocity;
vy=velocity;
while(1==1)
{
_drawSprite(0,x,y,100);
// readout for fps :)
$tmp0=_getFrameTime();
//print($tmp0);
$tmp5=50;
do{
_drawSprite(4,$tmp5,50,10);
$tmp5=$tmp5+15;
$tmp0=$tmp0-1;
}while($tmp0>0);
_drawSprite(0,x,y,100);
$tmp0=_getFrameTime();
print($tmp0);
do
{
x=x+vx;

View File

@ -117,7 +117,7 @@ CAnimTex *ThisTex=AnimTexList;
RECT Rect;
int Count,CountComp;
int H,W;
int Time = GameState::getTimeSinceLast();
int Time = GameState::getFramesSinceLast();
while (ThisTex)
{
@ -141,7 +141,7 @@ int Time = GameState::getTimeSinceLast();
Rect.h=CountComp;
LoadImage(&Rect,ThisTex->TexData);
}
ThisTex->Count+=(ThisTex->Speed * Time)>> 12;
ThisTex->Count+=(ThisTex->Speed * Time);
ThisTex->Count%=(ThisTex->Rect.h<<2);
ThisTex=ThisTex->NextTex;
}

View File

@ -563,7 +563,7 @@ CBubicle *CBubicleFactory::spawnParticle(BubicleEmitterData *_init)
}
}
SYSTEM_DBGMSG("Out of CBubicles!");
// SYSTEM_DBGMSG("Out of CBubicles!");
return NULL;
}

View File

@ -15,10 +15,11 @@ u32 CClickCount::s_currentTime=0;
bool CClickCount::s_initialised=false;
bool CClickCount::s_paused=false;
static const int COUNT_DOWN_VAL = 17200;//2150;
static const int COUNTS_PER_FRAME_INTERNAL = 4;
static const int COUNT_DOWN_VAL = 17200;
static const int COUNTS_PER_FRAME_INTERNAL = 2;
static const int COUNTS_PER_FRAME_EXTERNAL = 4096;
/*****************************************************************************/
void clockTicker()
{
@ -48,8 +49,8 @@ u32 CClickCount::timeSinceLast()
timeSince=currentTime-m_lastTime;
m_lastTime=currentTime;
return((timeSince*COUNTS_PER_FRAME_EXTERNAL)/COUNTS_PER_FRAME_INTERNAL);
return(currentTime*4096);
}
/*****************************************************************************/

View File

@ -15,12 +15,26 @@
#include "system\global.h"
#include "system\gstate.h"
#ifndef __MEMORY_HEADER__
#include "mem\memory.h"
#endif
#ifndef __VID_HEADER_
#include "system\vid.h"
#endif
/*****************************************************************************/
// Use click counter or vbl counter
#define USE_CLICK_COUNTER
#ifdef USE_CLICK_COUNTER
#ifndef __SYSTEM_CLICKCOUNT_H__
#include "system\clickcount.h"
#endif
#ifndef __MEMORY_HEADER__
#include "mem\memory.h"
#endif
@ -28,8 +42,10 @@
static CScene *s_currentScene;
static CScene *s_pendingScene;
int GameState::s_timeSinceLast;
#ifdef USE_CLICK_COUNTER
static CClickCount s_clickCounter;
#endif
int GameState::s_framesSinceLast=1;
#ifdef __VERSION_DEBUG__
static int s_baseMemory=0;
@ -145,16 +161,13 @@ CScene * GameState::getPendingScene()
}
/*****************************************************************************/
static int s_timeSpeed = ONE;
void GameState::updateTimer()
{
s_timeSinceLast = (s_clickCounter.timeSinceLast() * s_timeSpeed) >> 12;
if (s_timeSinceLast > 4 * 4096)
{
s_timeSinceLast = 4 * 4096;
SYSTEM_DBGMSG("updateTimer loosing frames!");
}
#ifdef USE_CLICK_COUNTER
s_framesSinceLast=(s_clickCounter.timeSinceLast()>>12)/4+1;
#else
s_framesSinceLast=VidGetVblsThisFrame();
#endif
}

View File

@ -20,6 +20,7 @@
/*****************************************************************************/
class CScene
{
@ -48,8 +49,7 @@ public:
static void setNextScene( CScene *_nextScene );
inline static long int getTimeSinceLast() {return s_timeSinceLast;}
inline static long int getFramesSinceLast() {return (s_timeSinceLast>>12)+1;}
inline static long int getFramesSinceLast() {return s_framesSinceLast;}
static void setTimeSpeed( int speed );
@ -67,7 +67,7 @@ private:
GameState();
static void updateTimer();
static int s_timeSinceLast;
static int s_framesSinceLast;
};

View File

@ -19,6 +19,7 @@ static void (*VbFunc)(void);
static VbFuncType VbFuncList[MaxVBFuncs];
static u32 FrameCounter=0,TickCount=0,TickBuffer[2];
static u32 s_lastFrameCounter=0,s_vblsThisFrame=0;
static sVidScreen Screen[2];
static int ScreenXOfs=0,ScreenYOfs=0;
static int ScreenW, ScreenH;
@ -194,6 +195,7 @@ sVidScreen *VidGetDispScreen() {return (VidGetScreen());}
sVidScreen *VidGetDrawScreen() {return &Screen[FrameFlipFlag^1];}
u32 VidGetFrameCount() {return(FrameCounter);}
u32 VidGetTickCount() {return(TickBuffer[FrameFlipFlag^1]);}
int VidGetVblsThisFrame() {return s_vblsThisFrame;}
void SetScreenImage(u8 *Ptr) {ScreenImage=Ptr;}
u8 *GetScreenImage() {return ScreenImage;}
@ -396,6 +398,10 @@ if(ScreenClipBox==2)
AddPrimToList(f4,0);
}
// How many frames since we last flipped the display?
int fc=FrameCounter;
s_vblsThisFrame=fc-s_lastFrameCounter;
s_lastFrameCounter=fc;
}

View File

@ -42,6 +42,7 @@ sVidScreen *VidGetDispScreen();
sVidScreen *VidGetDrawScreen();
u32 VidGetFrameCount();
u32 VidGetTickCount();
int VidGetVblsThisFrame();
void VidSwapDraw();