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; vy=velocity;
while(1==1) 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(); $tmp0=_getFrameTime();
print($tmp0);
do do
{ {
x=x+vx; x=x+vx;

View file

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

View file

@ -15,10 +15,11 @@ u32 CClickCount::s_currentTime=0;
bool CClickCount::s_initialised=false; bool CClickCount::s_initialised=false;
bool CClickCount::s_paused=false; bool CClickCount::s_paused=false;
static const int COUNT_DOWN_VAL = 17200;//2150; static const int COUNT_DOWN_VAL = 17200;
static const int COUNTS_PER_FRAME_INTERNAL = 4; static const int COUNTS_PER_FRAME_INTERNAL = 2;
static const int COUNTS_PER_FRAME_EXTERNAL = 4096; static const int COUNTS_PER_FRAME_EXTERNAL = 4096;
/*****************************************************************************/ /*****************************************************************************/
void clockTicker() void clockTicker()
{ {
@ -48,8 +49,8 @@ u32 CClickCount::timeSinceLast()
timeSince=currentTime-m_lastTime; timeSince=currentTime-m_lastTime;
m_lastTime=currentTime; m_lastTime=currentTime;
return((timeSince*COUNTS_PER_FRAME_EXTERNAL)/COUNTS_PER_FRAME_INTERNAL); 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\global.h"
#include "system\gstate.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__ #ifndef __SYSTEM_CLICKCOUNT_H__
#include "system\clickcount.h" #include "system\clickcount.h"
#endif #endif
#ifndef __MEMORY_HEADER__
#include "mem\memory.h"
#endif #endif
@ -28,8 +42,10 @@
static CScene *s_currentScene; static CScene *s_currentScene;
static CScene *s_pendingScene; static CScene *s_pendingScene;
int GameState::s_timeSinceLast; #ifdef USE_CLICK_COUNTER
static CClickCount s_clickCounter; static CClickCount s_clickCounter;
#endif
int GameState::s_framesSinceLast=1;
#ifdef __VERSION_DEBUG__ #ifdef __VERSION_DEBUG__
static int s_baseMemory=0; static int s_baseMemory=0;
@ -145,16 +161,13 @@ CScene * GameState::getPendingScene()
} }
/*****************************************************************************/ /*****************************************************************************/
static int s_timeSpeed = ONE;
void GameState::updateTimer() void GameState::updateTimer()
{ {
s_timeSinceLast = (s_clickCounter.timeSinceLast() * s_timeSpeed) >> 12; #ifdef USE_CLICK_COUNTER
s_framesSinceLast=(s_clickCounter.timeSinceLast()>>12)/4+1;
if (s_timeSinceLast > 4 * 4096) #else
{ s_framesSinceLast=VidGetVblsThisFrame();
s_timeSinceLast = 4 * 4096; #endif
SYSTEM_DBGMSG("updateTimer loosing frames!");
}
} }

View file

@ -20,6 +20,7 @@
/*****************************************************************************/ /*****************************************************************************/
class CScene class CScene
{ {
@ -48,8 +49,7 @@ public:
static void setNextScene( CScene *_nextScene ); static void setNextScene( CScene *_nextScene );
inline static long int getTimeSinceLast() {return s_timeSinceLast;} inline static long int getFramesSinceLast() {return s_framesSinceLast;}
inline static long int getFramesSinceLast() {return (s_timeSinceLast>>12)+1;}
static void setTimeSpeed( int speed ); static void setTimeSpeed( int speed );
@ -67,7 +67,7 @@ private:
GameState(); GameState();
static void updateTimer(); 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 VbFuncType VbFuncList[MaxVBFuncs];
static u32 FrameCounter=0,TickCount=0,TickBuffer[2]; static u32 FrameCounter=0,TickCount=0,TickBuffer[2];
static u32 s_lastFrameCounter=0,s_vblsThisFrame=0;
static sVidScreen Screen[2]; static sVidScreen Screen[2];
static int ScreenXOfs=0,ScreenYOfs=0; static int ScreenXOfs=0,ScreenYOfs=0;
static int ScreenW, ScreenH; static int ScreenW, ScreenH;
@ -194,6 +195,7 @@ sVidScreen *VidGetDispScreen() {return (VidGetScreen());}
sVidScreen *VidGetDrawScreen() {return &Screen[FrameFlipFlag^1];} sVidScreen *VidGetDrawScreen() {return &Screen[FrameFlipFlag^1];}
u32 VidGetFrameCount() {return(FrameCounter);} u32 VidGetFrameCount() {return(FrameCounter);}
u32 VidGetTickCount() {return(TickBuffer[FrameFlipFlag^1]);} u32 VidGetTickCount() {return(TickBuffer[FrameFlipFlag^1]);}
int VidGetVblsThisFrame() {return s_vblsThisFrame;}
void SetScreenImage(u8 *Ptr) {ScreenImage=Ptr;} void SetScreenImage(u8 *Ptr) {ScreenImage=Ptr;}
u8 *GetScreenImage() {return ScreenImage;} u8 *GetScreenImage() {return ScreenImage;}
@ -396,6 +398,10 @@ if(ScreenClipBox==2)
AddPrimToList(f4,0); 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(); sVidScreen *VidGetDrawScreen();
u32 VidGetFrameCount(); u32 VidGetFrameCount();
u32 VidGetTickCount(); u32 VidGetTickCount();
int VidGetVblsThisFrame();
void VidSwapDraw(); void VidSwapDraw();