- 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:
Wanne
2012-10-25 19:00:12 +00:00
parent 888c76e65c
commit b1596f0c63
56 changed files with 669 additions and 1213 deletions
-4
View File
@@ -101,11 +101,7 @@ UINT32 MapUtilScreenHandle(void)
INT32 cnt, iX, iY, iSubX1, iSubY1, iSubX2, iSubY2, iWindowX, iWindowY, iCount;
FLOAT dX, dY, dStartX, dStartY;
#ifdef USE_HIGHSPEED_GAMELOOP_TIMER
while(DequeueSpecificEvent(&InputEvent, KEY_DOWN|KEY_UP) == TRUE)
#else
while(DequeueEvent(&InputEvent) == TRUE)
#endif
{
if(InputEvent.usParam == ESC)
{
+478 -646
View File
File diff suppressed because it is too large Load Diff
+33 -81
View File
@@ -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
+1 -4
View File
@@ -103,10 +103,7 @@
#include "vobject.h"
#include "overhead types.h"
#include "tactical save.h"
#ifdef USE_HIGHSPEED_GAMELOOP_TIMER
#include "KeyMap.h"
#endif
#include "KeyMap.h"
//#include <windows.h>
//#include <windowsx.h>
-6
View File
@@ -5111,10 +5111,7 @@ STR16 zOptionsToggleText[] =
L"佣兵训练时保持沉默", // Madd: mercs don't say quotes while training
L"佣兵修理时保持沉默", // Madd: mercs don't say quotes while repairing
L"佣兵医疗时保持沉默", // Madd: mercs don't say quotes while doctoring
#ifdef USE_HIGHSPEED_GAMELOOP_TIMER
L"自动加速敌军回合", // Automatic fast forward through AI turns
#endif
#ifdef ENABLE_ZOMBIES
L"僵尸模式",
@@ -5229,10 +5226,7 @@ STR16 zOptionsScreenHelpText[] =
L"打开时,佣兵训练时不会随时汇报进程。",
L"打开时,佣兵修理时不会随时汇报进程。",
L"打开时,佣兵医疗时不会随时汇报进程。",
#ifdef USE_HIGHSPEED_GAMELOOP_TIMER
L"打开时,敌军回合将被大幅加速。",
#endif
#ifdef ENABLE_ZOMBIES
L"打开时,被击毙的敌人将有可能变成僵尸!杀出个黎明!",
-6
View File
@@ -5112,10 +5112,7 @@ STR16 zOptionsToggleText[] =
L"Quiet Training", // Madd: mercs don't say quotes while training // TODO.Translate
L"Quiet Repairing", // Madd: mercs don't say quotes while repairing //TODO.Translate
L"Quiet Doctoring", // Madd: mercs don't say quotes while doctoring //TODO.Translate
#ifdef USE_HIGHSPEED_GAMELOOP_TIMER
L"Auto Fast Forward AI Turns", // Automatic fast forward through AI turns // TODO.Translate
#endif
#ifdef ENABLE_ZOMBIES
L"Allow Zombies", // TODO.Translate
#endif
@@ -5229,10 +5226,7 @@ STR16 zOptionsScreenHelpText[] =
L"When ON, mercs will not report progress during training.", //TODO.Translate
L"When ON, mercs will not report progress during repairing.", // TODO.Translate
L"When ON, mercs will not report progress during doctoring.", // TODO.Translate
#ifdef USE_HIGHSPEED_GAMELOOP_TIMER
L"When ON, AI turns will be much faster.", // TODO.Translate
#endif
#ifdef ENABLE_ZOMBIES
L"When ON, zombies will span. Be aware!", // allow zombies // TODO.Translate
-7
View File
@@ -5110,11 +5110,7 @@ STR16 zOptionsToggleText[] =
L"Quiet Training", // Madd: mercs don't say quotes while training
L"Quiet Repairing", // Madd: mercs don't say quotes while repairing
L"Quiet Doctoring", // Madd: mercs don't say quotes while doctoring
#ifdef USE_HIGHSPEED_GAMELOOP_TIMER
L"Auto Fast Forward AI Turns", // Automatic fast forward through AI turns
#endif
#ifdef ENABLE_ZOMBIES
L"Allow Zombies", // Flugente Zombies 1.0
#endif
@@ -5228,10 +5224,7 @@ STR16 zOptionsScreenHelpText[] =
L"When ON, mercs will not report progress during training.",
L"When ON, mercs will not report progress during repairing.",
L"When ON, mercs will not report progress during doctoring.",
#ifdef USE_HIGHSPEED_GAMELOOP_TIMER
L"When ON, AI turns will be much faster.",
#endif
#ifdef ENABLE_ZOMBIES
L"When ON, zombies will spawn. Be aware!", // allow zombies
-7
View File
@@ -5102,10 +5102,7 @@ STR16 zOptionsToggleText[] =
L"Quiet Training", // Madd: mercs don't say quotes while training // TODO.Translate
L"Quiet Repairing", // Madd: mercs don't say quotes while repairing //TODO.Translate
L"Quiet Doctoring", // Madd: mercs don't say quotes while doctoring //TODO.Translate
#ifdef USE_HIGHSPEED_GAMELOOP_TIMER
L"Auto Fast Forward AI Turns", // Automatic fast forward through AI turns // TODO.Translate
#endif
#ifdef ENABLE_ZOMBIES
L"Allow Zombies", // Flugente Zombies 1.0
#endif
@@ -5219,11 +5216,7 @@ STR16 zOptionsScreenHelpText[] =
L"When ON, mercs will not report progress during training.",
L"When ON, mercs will not report progress during repairing.", // TODO.Translate
L"When ON, mercs will not report progress during doctoring.", // TODO.Translate
#ifdef USE_HIGHSPEED_GAMELOOP_TIMER
L"When ON, AI turns will be much faster.", // TODO.Translate
#endif
#ifdef ENABLE_ZOMBIES
L"When ON, zombies will span. Be aware!", // allow zombies // TODO.Translate
#endif
-6
View File
@@ -4958,10 +4958,7 @@ STR16 zOptionsToggleText[] =
L"Stummes Trainieren", // Madd: mercs don't say quotes while training
L"Stummes Reparieren", // Madd: mercs don't say quotes while repairing
L"Stumme Behandlung", // Madd: mercs don't say quotes while doctoring
#ifdef USE_HIGHSPEED_GAMELOOP_TIMER
L"Autom. schnelle Gegner-Züge", // Automatic fast forward through AI turns
#endif
#ifdef ENABLE_ZOMBIES
L"Zombies erlauben", // Flugente Zombies 1.0
#endif
@@ -5075,10 +5072,7 @@ STR16 zOptionsScreenHelpText[] =
L"Wenn diese Funktion aktiviert ist, werden die Söldner über ihren Fortschritt während des Trainings nicht mehr berichten.",
L"Wenn diese Funktion aktiviert ist, werden die Söldner über ihren Reperaturfortschritt nicht mehr berichten.",
L"Wenn diese Funktion aktiviert ist, werden die Söldner über den ärztlichen Fortschritt nicht mehr berichten.",
#ifdef USE_HIGHSPEED_GAMELOOP_TIMER
L"Wenn diese Funktion aktiviert ist, werden gegnerische Züge schneller durchgeführt.",
#endif
#ifdef ENABLE_ZOMBIES
L"Wenn diese Funktion aktiviert ist, können Tote als Zombies wieder auferstehen. Seien Sie auf der Hut!",
-6
View File
@@ -5096,10 +5096,7 @@ STR16 zOptionsToggleText[] =
L"Quiet Training", // Madd: mercs don't say quotes while training // TODO.Translate
L"Quiet Repairing", // Madd: mercs don't say quotes while repairing //TODO.Translate
L"Quiet Doctoring", // Madd: mercs don't say quotes while doctoring //TODO.Translate
#ifdef USE_HIGHSPEED_GAMELOOP_TIMER
L"Auto Fast Forward AI Turns", // Automatic fast forward through AI turns // TODO.Translate
#endif
#ifdef ENABLE_ZOMBIES
L"Allow Zombies", // Flugente Zombies 1.0
#endif
@@ -5213,10 +5210,7 @@ STR16 zOptionsScreenHelpText[] =
L"When ON, mercs will not report progress during training.",
L"When ON, mercs will not report progress during repairing.", // TODO.Translate
L"When ON, mercs will not report progress during doctoring.", // TODO.Translate
#ifdef USE_HIGHSPEED_GAMELOOP_TIMER
L"When ON, AI turns will be much faster.", // TODO.Translate
#endif
#ifdef ENABLE_ZOMBIES
L"When ON, zombies will span. Be aware!", // allow zombies // TODO.Translate
-6
View File
@@ -5109,10 +5109,7 @@ STR16 zOptionsToggleText[] =
L"Quiet Training", // Madd: mercs don't say quotes while training // TODO.Translate
L"Quiet Repairing", // Madd: mercs don't say quotes while repairing //TODO.Translate
L"Quiet Doctoring", // Madd: mercs don't say quotes while doctoring //TODO.Translate
#ifdef USE_HIGHSPEED_GAMELOOP_TIMER
L"Auto Fast Forward AI Turns", // Automatic fast forward through AI turns // TODO.Translate
#endif
#ifdef ENABLE_ZOMBIES
L"Allow Zombies", // Flugente Zombies 1.0
@@ -5227,10 +5224,7 @@ STR16 zOptionsScreenHelpText[] =
L"When ON, mercs will not report progress during training.",
L"When ON, mercs will not report progress during repairing.", // TODO.Translate
L"When ON, mercs will not report progress during doctoring.", // TODO.Translate
#ifdef USE_HIGHSPEED_GAMELOOP_TIMER
L"When ON, AI turns will be much faster.", // TODO.Translate
#endif
#ifdef ENABLE_ZOMBIES
L"When ON, zombies will span. Be aware!", // allow zombies // TODO.Translate
-6
View File
@@ -5078,10 +5078,7 @@ STR16 zOptionsToggleText[] =
L"Quiet Training", // Madd: mercs don't say quotes while training // TODO.Translate
L"Quiet Repairing", // Madd: mercs don't say quotes while repairing //TODO.Translate
L"Quiet Doctoring", // Madd: mercs don't say quotes while doctoring //TODO.Translate
#ifdef USE_HIGHSPEED_GAMELOOP_TIMER
L"Auto Fast Forward AI Turns", // Automatic fast forward through AI turns // TODO.Translate
#endif
#ifdef ENABLE_ZOMBIES
L"Allow Zombies", // Flugente Zombies 1.0
@@ -5196,10 +5193,7 @@ STR16 zOptionsScreenHelpText[] =
L"When ON, mercs will not report progress during training.",
L"When ON, mercs will not report progress during repairing.", // TODO.Translate
L"When ON, mercs will not report progress during doctoring.", // TODO.Translate
#ifdef USE_HIGHSPEED_GAMELOOP_TIMER
L"When ON, AI turns will be much faster.", // TODO.Translate
#endif
#ifdef ENABLE_ZOMBIES
L"When ON, zombies will span. Be aware!", // allow zombies // TODO.Translate
-6
View File
@@ -5113,10 +5113,7 @@ STR16 zOptionsToggleText[] =
L"Quiet Training", // Madd: mercs don't say quotes while training // TODO.Translate
L"Quiet Repairing", // Madd: mercs don't say quotes while repairing //TODO.Translate
L"Quiet Doctoring", // Madd: mercs don't say quotes while doctoring //TODO.Translate
#ifdef USE_HIGHSPEED_GAMELOOP_TIMER
L"Auto Fast Forward AI Turns", // Automatic fast forward through AI turns // TODO.Translate
#endif
#ifdef ENABLE_ZOMBIES
L"Allow Zombies", // Flugente Zombies 1.0
@@ -5231,10 +5228,7 @@ STR16 zOptionsScreenHelpText[] =
L"When ON, mercs will not report progress during training.",
L"When ON, mercs will not report progress during repairing.", // TODO.Translate
L"When ON, mercs will not report progress during doctoring.", // TODO.Translate
#ifdef USE_HIGHSPEED_GAMELOOP_TIMER
L"When ON, AI turns will be much faster.", // TODO.Translate
#endif
#ifdef ENABLE_ZOMBIES
L"When ON, zombies will span. Be aware!", // allow zombies // TODO.Translate