mirror of
https://github.com/1dot13/source.git
synced 2026-08-26 14:30:26 +02:00
- Removed the "USE_HIGHSPEED_GAMELOOP_TIMER" define. Now highspeed timer and new way of dequeuing events are always enabled when building an executable
o This makes the code more easy to maintain o Highspeed timer seems to run fine (after months of tests) git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@5643 3b4a5df2-a311-0410-b5c6-a8a6f20db521
This commit is contained in:
+33
-81
@@ -54,13 +54,6 @@ enum
|
||||
NUMTIMERS
|
||||
};
|
||||
|
||||
#ifdef USE_HIGHSPEED_GAMELOOP_TIMER
|
||||
#else
|
||||
// Base resultion of callback timer
|
||||
#define BASETIMESLICE 10
|
||||
#endif
|
||||
|
||||
|
||||
// TIMER INTERVALS
|
||||
extern INT32 giTimerIntervals[ NUMTIMERS ];
|
||||
// TIMER COUNTERS
|
||||
@@ -78,9 +71,8 @@ void ShutdownJA2Clock( void );
|
||||
|
||||
#define GetJA2Clock() guiBaseJA2Clock
|
||||
|
||||
#ifdef USE_HIGHSPEED_GAMELOOP_TIMER
|
||||
#define GetJA2NoPauseClock() guiBaseJA2NoPauseClock
|
||||
#endif
|
||||
#define GetJA2NoPauseClock() guiBaseJA2NoPauseClock
|
||||
|
||||
|
||||
UINT32 GetPauseJA2Clock( );
|
||||
|
||||
@@ -92,89 +84,49 @@ void PauseTime( BOOLEAN fPaused );
|
||||
void SetCustomizableTimerCallbackAndDelay( INT32 iDelay, CUSTOMIZABLE_TIMER_CALLBACK pCallback, BOOLEAN fReplace );
|
||||
void CheckCustomizableTimer( void );
|
||||
|
||||
#ifdef USE_HIGHSPEED_GAMELOOP_TIMER
|
||||
void SetFastForwardPeriod(DOUBLE value);
|
||||
void SetFastForwardKey(INT32 key);
|
||||
BOOLEAN IsFastForwardKeyPressed();
|
||||
void SetFastForwardMode(BOOLEAN enable);
|
||||
BOOLEAN IsFastForwardMode();
|
||||
INT32 GetFastForwardLoopCount();
|
||||
void SetFastForwardLoopCount(INT32 value);
|
||||
void SetFastForwardPeriod(DOUBLE value);
|
||||
void SetFastForwardKey(INT32 key);
|
||||
BOOLEAN IsFastForwardKeyPressed();
|
||||
void SetFastForwardMode(BOOLEAN enable);
|
||||
BOOLEAN IsFastForwardMode();
|
||||
INT32 GetFastForwardLoopCount();
|
||||
void SetFastForwardLoopCount(INT32 value);
|
||||
|
||||
void SetNotifyFrequencyKey(INT32 value);
|
||||
void SetClockSpeedPercent(FLOAT value);
|
||||
void SetNotifyFrequencyKey(INT32 value);
|
||||
void SetClockSpeedPercent(FLOAT value);
|
||||
|
||||
BOOLEAN IsTimerActive();
|
||||
BOOLEAN IsJA2TimerThread();
|
||||
BOOLEAN IsTimerActive();
|
||||
BOOLEAN IsJA2TimerThread();
|
||||
|
||||
BOOLEAN IsHiSpeedClockMode();
|
||||
void SetHiSpeedClockMode(BOOLEAN enable);
|
||||
#endif
|
||||
BOOLEAN IsHiSpeedClockMode();
|
||||
void SetHiSpeedClockMode(BOOLEAN enable);
|
||||
|
||||
//Don't modify this value
|
||||
extern UINT32 guiBaseJA2Clock;
|
||||
extern UINT32 guiBaseJA2NoPauseClock;
|
||||
extern CUSTOMIZABLE_TIMER_CALLBACK gpCustomizableTimerCallback;
|
||||
|
||||
#ifdef USE_HIGHSPEED_GAMELOOP_TIMER
|
||||
typedef void (*TIMER_NOTIFY_CALLBACK) ( INT32 timer, PTR state );
|
||||
void AddTimerNotifyCallback( TIMER_NOTIFY_CALLBACK callback, PTR state );
|
||||
void RemoveTimerNotifyCallback( TIMER_NOTIFY_CALLBACK callback, PTR state );
|
||||
void ClearTimerNotifyCallbacks();
|
||||
typedef void (*TIMER_NOTIFY_CALLBACK) ( INT32 timer, PTR state );
|
||||
void AddTimerNotifyCallback( TIMER_NOTIFY_CALLBACK callback, PTR state );
|
||||
void RemoveTimerNotifyCallback( TIMER_NOTIFY_CALLBACK callback, PTR state );
|
||||
void ClearTimerNotifyCallbacks();
|
||||
|
||||
BOOLEAN UpdateCounter(INT32 iTimer);
|
||||
void ResetCounter(INT32 iTimer);
|
||||
BOOLEAN CounterDone(INT32 iTimer);
|
||||
void ResetTimerCounter(INT32 &timer, INT32 value);
|
||||
BOOLEAN TimeCounterDone(INT32 timer);
|
||||
void ZeroTimeCounter(INT32& timer);
|
||||
BOOLEAN UpdateCounter(INT32 iTimer);
|
||||
void ResetCounter(INT32 iTimer);
|
||||
BOOLEAN CounterDone(INT32 iTimer);
|
||||
void ResetTimerCounter(INT32 &timer, INT32 value);
|
||||
BOOLEAN TimeCounterDone(INT32 timer);
|
||||
void ZeroTimeCounter(INT32& timer);
|
||||
|
||||
|
||||
#define UPDATECOUNTER( c ) UpdateCounter(c)
|
||||
#define RESETCOUNTER( c ) ResetCounter(c)
|
||||
#define COUNTERDONE( c ) CounterDone(c)
|
||||
#define UPDATETIMECOUNTER( c ) UpdateTimeCounter(c)
|
||||
#define RESETTIMECOUNTER( c, d ) ResetTimerCounter(c, d)
|
||||
#define TIMECOUNTERDONE(c, d) TimeCounterDone(c)
|
||||
#define SYNCTIMECOUNTER( )
|
||||
#define ZEROTIMECOUNTER(c) ZeroTimeCounter(c)
|
||||
#else
|
||||
|
||||
// MACROS
|
||||
// CHeck if new counter < 0 | set to 0 | Decrement
|
||||
|
||||
#ifdef CALLBACKTIMER
|
||||
|
||||
#define UPDATECOUNTER( c ) ( ( giTimerCounters[ c ] - BASETIMESLICE ) < 0 ) ? ( giTimerCounters[ c ] = 0 ) : ( giTimerCounters[ c ] -= BASETIMESLICE )
|
||||
#define RESETCOUNTER( c ) ( giTimerCounters[ c ] = giTimerIntervals[ c ] )
|
||||
#define COUNTERDONE( c ) ( giTimerCounters[ c ] == 0 ) ? TRUE : FALSE
|
||||
|
||||
#define UPDATETIMECOUNTER( c ) ( ( c - BASETIMESLICE ) < 0 ) ? ( c = 0 ) : ( c -= BASETIMESLICE )
|
||||
#define RESETTIMECOUNTER( c, d ) ( c = d )
|
||||
|
||||
#ifdef BOUNDS_CHECKER
|
||||
#define TIMECOUNTERDONE( c, d ) ( TRUE )
|
||||
#else
|
||||
#define TIMECOUNTERDONE( c, d ) ( c == 0 ) ? TRUE : FALSE
|
||||
#endif
|
||||
|
||||
#define SYNCTIMECOUNTER( )
|
||||
#define ZEROTIMECOUNTER( c ) ( c = 0 )
|
||||
|
||||
#else
|
||||
|
||||
#define UPDATECOUNTER( c )
|
||||
#define RESETCOUNTER( c ) ( giTimerCounters[ c ] = giClockTimer )
|
||||
#define COUNTERDONE( c ) ( ( ( giClockTimer = GetJA2Clock() ) - giTimerCounters[ c ] ) > giTimerIntervals[ c ] ) ? TRUE : FALSE
|
||||
|
||||
#define UPDATETIMECOUNTER( c )
|
||||
#define RESETTIMECOUNTER( c, d ) ( c = giClockTimer )
|
||||
#define TIMECOUNTERDONE( c, d ) ( giClockTimer - c > d ) ? TRUE : FALSE
|
||||
#define SYNCTIMECOUNTER( ) ( giClockTimer = GetJA2Clock() )
|
||||
|
||||
#endif
|
||||
|
||||
#endif
|
||||
#define UPDATECOUNTER( c ) UpdateCounter(c)
|
||||
#define RESETCOUNTER( c ) ResetCounter(c)
|
||||
#define COUNTERDONE( c ) CounterDone(c)
|
||||
#define UPDATETIMECOUNTER( c ) UpdateTimeCounter(c)
|
||||
#define RESETTIMECOUNTER( c, d ) ResetTimerCounter(c, d)
|
||||
#define TIMECOUNTERDONE(c, d) TimeCounterDone(c)
|
||||
#define SYNCTIMECOUNTER( )
|
||||
#define ZEROTIMECOUNTER(c) ZeroTimeCounter(c)
|
||||
|
||||
void SetTileAnimCounter( INT32 iTime );
|
||||
#endif
|
||||
Reference in New Issue
Block a user