- 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
@@ -417,11 +417,7 @@ void GetCreditScreenUserInput()
{
InputAtom Event;
#ifdef USE_HIGHSPEED_GAMELOOP_TIMER
while (DequeueSpecificEvent(&Event, KEY_DOWN|KEY_UP|KEY_REPEAT))
#else
while( DequeueEvent( &Event ) )
#endif
{
if( Event.usEvent == KEY_DOWN )
{
-5
View File
@@ -76,12 +76,7 @@ BOOLEAN MessageBoxHandled()
{
InputAtom DummyEvent;
#ifdef USE_HIGHSPEED_GAMELOOP_TIMER
while (DequeueSpecificEvent(&DummyEvent, KEY_DOWN|KEY_UP|KEY_REPEAT))
#else
while( DequeueEvent( &DummyEvent ) )
#endif
{
if ( DummyEvent.usEvent == KEY_DOWN )
{
-5
View File
@@ -398,12 +398,7 @@ void PopupMenuHandle()
}
//Use keyboard input as well.
#ifdef USE_HIGHSPEED_GAMELOOP_TIMER
while (DequeueSpecificEvent(&InputEvent, KEY_DOWN|KEY_UP|KEY_REPEAT))
#else
while( DequeueEvent( &InputEvent ) )
#endif
{
switch(InputEvent.usEvent)
{
-8
View File
@@ -2658,11 +2658,7 @@ void GetGIOScreenUserInput()
{
InputAtom Event;
#ifdef USE_HIGHSPEED_GAMELOOP_TIMER
while (DequeueSpecificEvent(&Event, KEY_DOWN|KEY_UP|KEY_REPEAT))
#else
while( DequeueEvent( &Event ) )
#endif
{
if( Event.usEvent == KEY_DOWN )
{
@@ -5579,11 +5575,7 @@ void GetGIOScreenUserInput()
{
InputAtom Event;
#ifdef USE_HIGHSPEED_GAMELOOP_TIMER
while (DequeueSpecificEvent(&Event, KEY_DOWN|KEY_UP|KEY_REPEAT))
#else
while( DequeueEvent( &Event ) )
#endif
{
if( Event.usEvent == KEY_DOWN )
{
+3 -14
View File
@@ -38,10 +38,8 @@
#include "InterfaceItemImages.h"
#endif
#ifdef USE_HIGHSPEED_GAMELOOP_TIMER
#include "KeyMap.h"
#include "Timer Control.h"
#endif
#include "KeyMap.h"
#include "Timer Control.h"
#include "Text.h"
#include "connect.h"
@@ -243,8 +241,6 @@ BOOLEAN LoadGameSettings()
gGameSettings.fOptions[TOPTION_QUIET_REPAIRING] = iniReader.ReadBoolean("JA2 Game Settings","TOPTION_QUIET_REPAIRING" , FALSE );
gGameSettings.fOptions[TOPTION_QUIET_DOCTORING] = iniReader.ReadBoolean("JA2 Game Settings","TOPTION_QUIET_DOCTORING" , FALSE );
#ifdef USE_HIGHSPEED_GAMELOOP_TIMER
if (!is_networked)
gGameSettings.fOptions[TOPTION_AUTO_FAST_FORWARD_MODE] = iniReader.ReadBoolean("JA2 Game Settings","TOPTION_AUTO_FAST_FORWARD_MODE" , FALSE );
else
@@ -253,7 +249,6 @@ BOOLEAN LoadGameSettings()
// The "HIGHSPEED_TIMER" property from the ja2.ini is not set, disable the option
if (!IsHiSpeedClockMode())
gGameSettings.fOptions[TOPTION_AUTO_FAST_FORWARD_MODE] = FALSE;
#endif
#ifdef ENABLE_ZOMBIES
gGameSettings.fOptions[TOPTION_ZOMBIES] = iniReader.ReadBoolean("JA2 Game Settings","TOPTION_ZOMBIES" , FALSE );
@@ -421,10 +416,7 @@ BOOLEAN SaveGameSettings()
settings << "TOPTION_QUIET_TRAINING = " << (gGameSettings.fOptions[TOPTION_QUIET_TRAINING] ? "TRUE" : "FALSE" ) << endl;
settings << "TOPTION_QUIET_REPAIRING = " << (gGameSettings.fOptions[TOPTION_QUIET_REPAIRING] ? "TRUE" : "FALSE" ) << endl;
settings << "TOPTION_QUIET_DOCTORING = " << (gGameSettings.fOptions[TOPTION_QUIET_DOCTORING] ? "TRUE" : "FALSE" ) << endl;
#ifdef USE_HIGHSPEED_GAMELOOP_TIMER
settings << "TOPTION_AUTO_FAST_FORWARD_MODE = " << (gGameSettings.fOptions[TOPTION_AUTO_FAST_FORWARD_MODE] ? "TRUE" : "FALSE" ) << endl;
#endif
settings << "TOPTION_SHOW_LAST_ENEMY = " << (gGameSettings.fOptions[TOPTION_SHOW_LAST_ENEMY] ? "TRUE" : "FALSE" ) << endl;
settings << "TOPTION_SHOW_LBE_CONTENT = " << (gGameSettings.fOptions[TOPTION_SHOW_LBE_CONTENT] ? "TRUE" : "FALSE" ) << endl;
@@ -560,9 +552,8 @@ void InitGameSettings()
gGameSettings.fOptions[ TOPTION_QUIET_REPAIRING ] = FALSE;
gGameSettings.fOptions[ TOPTION_QUIET_DOCTORING ] = FALSE;
#ifdef USE_HIGHSPEED_GAMELOOP_TIMER
gGameSettings.fOptions[ TOPTION_AUTO_FAST_FORWARD_MODE ] = FALSE;
#endif
gGameSettings.fOptions[TOPTION_SHOW_LAST_ENEMY] = FALSE;
gGameSettings.fOptions[TOPTION_SHOW_LBE_CONTENT] = TRUE;
@@ -1874,7 +1865,6 @@ void LoadGameExternalOptions()
gGameExternalOptions.fEnableInventoryPoolQ = FALSE;
#endif
#ifdef USE_HIGHSPEED_GAMELOOP_TIMER
////////// CLOCK SETTINGS //////////
// Key to artificially alter the clock so turns run faster
@@ -1885,7 +1875,6 @@ void LoadGameExternalOptions()
gGameExternalOptions.iFastForwardPeriod = (FLOAT)iniReader.ReadDouble("Clock Settings","FAST_FORWARD_PERIOD", 500, 1, 10000);
gGameExternalOptions.fClockSpeedPercent = (FLOAT)iniReader.ReadDouble("Clock Settings","CLOCK_SPEED_PERCENT", 150, 100, 300);
gGameExternalOptions.iNotifyFrequency = iniReader.ReadInteger("Clock Settings","UPDATE_FREQUENCY", 16000, 1000, 20000);
#endif
}
-4
View File
@@ -84,9 +84,7 @@ enum
TOPTION_QUIET_REPAIRING, //Madd: mercs don't say gained experience quote while repairing items
TOPTION_QUIET_DOCTORING, //Madd: mercs don't say gained experience quote while doctoring
#ifdef USE_HIGHSPEED_GAMELOOP_TIMER
TOPTION_AUTO_FAST_FORWARD_MODE, // automatically fast forward through AI turns
#endif
#ifdef ENABLE_ZOMBIES
TOPTION_ZOMBIES, // Flugente Zombies 1.0: allow zombies
@@ -1109,7 +1107,6 @@ typedef struct
INT32 iInitialMercArrivalLocation;
#ifdef USE_HIGHSPEED_GAMELOOP_TIMER
// Keyboard shortcut (as VK) for fastforward key. See Utils/KeyMap
INT32 iFastForwardKey;
// Turn on fast forward whenever ui is disabled.
@@ -1120,7 +1117,6 @@ typedef struct
INT32 iNotifyFrequency;
// Frequency that the screen is updated
FLOAT fClockSpeedPercent;
#endif
// Flugente: Weapon Overheating
BOOLEAN fDisplayOverheatThermometer; // Should a 'thermometer' for guns and replacable barrels be displayed?
-5
View File
@@ -505,12 +505,7 @@ void HandleAimFacialIndexKeyBoardInput()
InputAtom InputEvent;
UINT32 i;
#ifdef USE_HIGHSPEED_GAMELOOP_TIMER
while (DequeueSpecificEvent(&InputEvent, KEY_DOWN|KEY_UP|KEY_REPEAT))
#else
while (DequeueEvent(&InputEvent) == TRUE)
#endif
{//!HandleTextInput( &InputEvent ) &&
if( InputEvent.usEvent == KEY_DOWN )
{
-5
View File
@@ -5028,12 +5028,7 @@ void HandleAimMemberKeyBoardInput()
{
InputAtom InputEvent;
#ifdef USE_HIGHSPEED_GAMELOOP_TIMER
while (DequeueSpecificEvent(&InputEvent, KEY_DOWN|KEY_UP|KEY_REPEAT))
#else
while (DequeueEvent(&InputEvent) == TRUE)
#endif
{//!HandleTextInput( &InputEvent ) &&
if( InputEvent.usEvent == KEY_DOWN )
{
-5
View File
@@ -1088,12 +1088,7 @@ void HandleAimSortKeyBoardInput()
{
InputAtom InputEvent;
#ifdef USE_HIGHSPEED_GAMELOOP_TIMER
while (DequeueSpecificEvent(&InputEvent, KEY_DOWN|KEY_UP|KEY_REPEAT))
#else
while (DequeueEvent(&InputEvent) == TRUE)
#endif
{//!HandleTextInput( &InputEvent ) &&
if( InputEvent.usEvent == KEY_DOWN )
{
+1 -2
View File
@@ -3879,6 +3879,7 @@ void HandleBobbyRGunsKeyBoardInput()
fCtrl = _KeyDown( CTRL );
fAlt = _KeyDown( ALT );
//while (DequeueSpecificEvent(&InputEvent, KEY_DOWN |KEY_REPEAT) == TRUE)
while (DequeueEvent(&InputEvent) == TRUE)
{
if( InputEvent.usEvent == KEY_DOWN )
@@ -4101,12 +4102,10 @@ void HandleBobbyRGunsKeyBoardInput()
break;
}
}
#ifdef USE_HIGHSPEED_GAMELOOP_TIMER
else
{
extern void HandleDefaultEvent(InputAtom *Event);
HandleDefaultEvent(&InputEvent);
}
#endif
}
}
-4
View File
@@ -426,11 +426,7 @@ void GetPlayerKeyBoardInputForBriefingRoomHomePage( void )
GetCursorPos(&MousePos);
ScreenToClient(ghWindow, &MousePos); // In window coords!
#ifdef USE_HIGHSPEED_GAMELOOP_TIMER
while (DequeueSpecificEvent(&InputEvent, KEY_DOWN|KEY_UP|KEY_REPEAT))
#else
while (DequeueEvent(&InputEvent) == TRUE)
#endif
{
// HOOK INTO MOUSE HOOKS
/*
-4
View File
@@ -493,11 +493,7 @@ void GetPlayerKeyBoardInputForBriefingRoomEnterHomePage( void )
GetCursorPos(&MousePos);
ScreenToClient(ghWindow, &MousePos); // In window coords!
#ifdef USE_HIGHSPEED_GAMELOOP_TIMER
while (DequeueSpecificEvent(&InputEvent, KEY_DOWN|KEY_UP|KEY_REPEAT))
#else
while (DequeueEvent(&InputEvent) == TRUE)
#endif
{
// HOOK INTO MOUSE HOOKS
/*
-4
View File
@@ -458,11 +458,7 @@ void GetPlayerKeyBoardInputForIMPBeginScreen( void )
ScreenToClient(ghWindow, &MousePos); // In window coords!
// handle input events
#ifdef USE_HIGHSPEED_GAMELOOP_TIMER
while (DequeueSpecificEvent(&InputEvent, KEY_DOWN|KEY_UP|KEY_REPEAT))
#else
while( DequeueEvent(&InputEvent) )
#endif
{
if( !HandleTextInput( &InputEvent ) && (InputEvent.usEvent == KEY_DOWN || InputEvent.usEvent == KEY_REPEAT) )
{
-4
View File
@@ -266,11 +266,7 @@ void GetPlayerKeyBoardInputForIMPHomePage( void )
GetCursorPos(&MousePos);
ScreenToClient(ghWindow, &MousePos); // In window coords!
#ifdef USE_HIGHSPEED_GAMELOOP_TIMER
while (DequeueSpecificEvent(&InputEvent, KEY_DOWN|KEY_UP|KEY_REPEAT))
#else
while (DequeueEvent(&InputEvent) == TRUE)
#endif
{
if( !HandleTextInput( &InputEvent ) && (InputEvent.usEvent == KEY_DOWN || InputEvent.usEvent == KEY_REPEAT || InputEvent.usEvent == KEY_UP ) )
{
-5
View File
@@ -1315,12 +1315,7 @@ void HandleAimKeyBoardInput()
{
InputAtom InputEvent;
#ifdef USE_HIGHSPEED_GAMELOOP_TIMER
while (DequeueSpecificEvent(&InputEvent, KEY_DOWN|KEY_UP|KEY_REPEAT))
#else
while (DequeueEvent(&InputEvent) == TRUE)
#endif
{//!HandleTextInput( &InputEvent ) &&
if( InputEvent.usEvent == KEY_DOWN )
{
-4
View File
@@ -1257,11 +1257,7 @@ void HandleFloristOrderKeyBoardInput()
{
InputAtom InputEvent;
#ifdef USE_HIGHSPEED_GAMELOOP_TIMER
while (DequeueSpecificEvent(&InputEvent, KEY_DOWN|KEY_UP|KEY_REPEAT))
#else
while (DequeueEvent(&InputEvent) == TRUE)
#endif
{
if( !HandleTextInput( &InputEvent ) && InputEvent.usEvent == KEY_DOWN )
{
Binary file not shown.
-4
View File
@@ -6445,11 +6445,7 @@ void HandlePersonnelKeyboard( void )
GetCursorPos(&MousePos);
ScreenToClient(ghWindow, &MousePos); // In window coords!
#ifdef USE_HIGHSPEED_GAMELOOP_TIMER
while (DequeueSpecificEvent(&InputEvent, KEY_DOWN|KEY_UP|KEY_REPEAT))
#else
while (DequeueEvent(&InputEvent) == TRUE)
#endif
{
if ( (InputEvent.usEvent == KEY_DOWN ) && (InputEvent.usParam >= '0' ) && ( InputEvent.usParam <= '9') )
{
-4
View File
@@ -758,11 +758,7 @@ UINT32 MPChatScreenHandle( )
// Check for esc
bool bHandled;
#ifdef USE_HIGHSPEED_GAMELOOP_TIMER
while (DequeueSpecificEvent(&InputEvent, KEY_DOWN|KEY_UP|KEY_REPEAT))
#else
while (DequeueEvent(&InputEvent) == TRUE)
#endif
{
bHandled = false;
if(InputEvent.usEvent == KEY_DOWN )
-4
View File
@@ -418,11 +418,7 @@ void GetMPCScreenUserInput()
// GetCursorPos(&MousePos);
#ifdef USE_HIGHSPEED_GAMELOOP_TIMER
while (DequeueSpecificEvent(&Event, KEY_DOWN|KEY_UP|KEY_REPEAT))
#else
while( DequeueEvent( &Event ) )
#endif
{
// check if this event is swallowed by text input, otherwise process key
if( Event.usEvent == KEY_DOWN )
-4
View File
@@ -2740,11 +2740,7 @@ void GetMPHScreenUserInput()
// GetCursorPos(&MousePos);
#ifdef USE_HIGHSPEED_GAMELOOP_TIMER
while (DequeueSpecificEvent(&Event, KEY_DOWN|KEY_UP|KEY_REPEAT))
#else
while( DequeueEvent( &Event ) )
#endif
{
// check if this event is swallowed by text input, otherwise process key
if( !HandleTextInput( &Event ) && Event.usEvent == KEY_DOWN )
-4
View File
@@ -665,11 +665,7 @@ void GetMPJScreenUserInput()
{
InputAtom Event;
#ifdef USE_HIGHSPEED_GAMELOOP_TIMER
while (DequeueSpecificEvent(&Event, KEY_DOWN|KEY_UP|KEY_REPEAT))
#else
while( DequeueEvent( &Event ) )
#endif
{
// check if this event is swallowed by text input, otherwise process key
if( !HandleTextInput( &Event ) && Event.usEvent == KEY_DOWN )
-4
View File
@@ -536,11 +536,7 @@ void GetMPSScreenUserInput()
{
InputAtom Event;
#ifdef USE_HIGHSPEED_GAMELOOP_TIMER
while (DequeueSpecificEvent(&Event, KEY_DOWN|KEY_UP|KEY_REPEAT))
#else
while( DequeueEvent( &Event ) )
#endif
{
// check if this event is swallowed by text input, otherwise process key
if( !HandleTextInput( &Event ) && Event.usEvent == KEY_DOWN )
-8
View File
@@ -501,11 +501,7 @@ void HandleMainMenuInput()
InputAtom InputEvent;
// Check for esc
#ifdef USE_HIGHSPEED_GAMELOOP_TIMER
while (DequeueSpecificEvent(&InputEvent, KEY_DOWN|KEY_UP|KEY_REPEAT))
#else
while (DequeueEvent(&InputEvent) == TRUE)
#endif
{
if( InputEvent.usEvent == KEY_UP )
{
@@ -559,11 +555,7 @@ void HandleHelpScreenInput()
InputAtom InputEvent;
// Check for key
#ifdef USE_HIGHSPEED_GAMELOOP_TIMER
while (DequeueSpecificEvent(&InputEvent, KEY_DOWN|KEY_UP|KEY_REPEAT))
#else
while (DequeueEvent(&InputEvent) == TRUE)
#endif
{
switch( InputEvent.usEvent )
{
-4
View File
@@ -1306,11 +1306,7 @@ UINT32 MessageBoxScreenHandle( )
// carter, need key shortcuts for clearing up message boxes
// Check for esc
#ifdef USE_HIGHSPEED_GAMELOOP_TIMER
while (DequeueSpecificEvent(&InputEvent, KEY_DOWN|KEY_UP|KEY_REPEAT))
#else
while (DequeueEvent(&InputEvent) == TRUE)
#endif
{
if( !HandleTextInput( &InputEvent ) && InputEvent.usEvent == KEY_DOWN )
{
Binary file not shown.
-2
View File
@@ -4021,9 +4021,7 @@ BOOLEAN LoadSavedGame( int ubSavedGameID )
ShutdownNPCQuotes();
#ifdef USE_HIGHSPEED_GAMELOOP_TIMER
SetFastForwardMode(FALSE); // FF can sometimes be active if quick-load during AI turn transition
#endif
//very small TODO
//Bugfix = Stop the chopter sound
+33 -68
View File
@@ -111,9 +111,8 @@ BOOLEAN gfCurrentStringInputState;
StringInput *gpCurrentStringDescriptor;
// Thread
#ifdef USE_HIGHSPEED_GAMELOOP_TIMER
static CRITICAL_SECTION gcsInputQueueLock;
#endif
static CRITICAL_SECTION gcsInputQueueLock;
// Local function headers
@@ -282,9 +281,7 @@ BOOLEAN InitializeInputManager(void)
// ghKeyboardHook = SetWindowsHookEx(WH_KEYBOARD, (HOOKPROC) KeyboardHandler, (HINSTANCE) 0, GetCurrentThreadId());
// DbgMessage(TOPIC_INPUT, DBG_LEVEL_2, String("Set keyboard hook returned %d", ghKeyboardHook));
#ifdef USE_HIGHSPEED_GAMELOOP_TIMER
InitializeCriticalSection(&gcsInputQueueLock);
#endif
ghMouseHook = SetWindowsHookEx(WH_MOUSE, (HOOKPROC) MouseHandler, (HINSTANCE) 0, GetCurrentThreadId());
DbgMessage(TOPIC_INPUT, DBG_LEVEL_2, String("Set mouse hook returned %d", ghMouseHook));
@@ -299,10 +296,7 @@ void ShutdownInputManager(void)
// UnhookWindowsHookEx(ghKeyboardHook);
UnhookWindowsHookEx(ghMouseHook);
#ifdef USE_HIGHSPEED_GAMELOOP_TIMER
DeleteCriticalSection(&gcsInputQueueLock);
#endif
}
void QueuePureEvent(UINT16 ubInputEvent, UINT32 usParam, UINT32 uiParam)
@@ -343,11 +337,7 @@ void QueuePureEvent(UINT16 ubInputEvent, UINT32 usParam, UINT32 uiParam)
}
}
#ifdef USE_HIGHSPEED_GAMELOOP_TIMER
void InternalQueueEvent(UINT16 ubInputEvent, UINT32 usParam, UINT32 uiParam)
#else
void QueueEvent(UINT16 ubInputEvent, UINT32 usParam, UINT32 uiParam)
#endif
void InternalQueueEvent(UINT16 ubInputEvent, UINT32 usParam, UINT32 uiParam)
{
UINT32 uiTimer;
UINT16 usKeyState;
@@ -470,45 +460,21 @@ void QueuePureEvent(UINT16 ubInputEvent, UINT32 usParam, UINT32 uiParam)
}
}
#ifdef USE_HIGHSPEED_GAMELOOP_TIMER
void QueueEvent(UINT16 ubInputEvent, UINT32 usParam, UINT32 uiParam)
{
EnterCriticalSection(&gcsInputQueueLock);
__try {
InternalQueueEvent(ubInputEvent, usParam, uiParam);
}__finally {
LeaveCriticalSection(&gcsInputQueueLock);
}
void QueueEvent(UINT16 ubInputEvent, UINT32 usParam, UINT32 uiParam)
{
EnterCriticalSection(&gcsInputQueueLock);
__try {
InternalQueueEvent(ubInputEvent, usParam, uiParam);
}__finally {
LeaveCriticalSection(&gcsInputQueueLock);
}
#endif
}
#ifdef USE_HIGHSPEED_GAMELOOP_TIMER
BOOLEAN DequeueSpecificEvent(InputAtom *Event, UINT32 uiMaskFlags )
{
EnterCriticalSection(&gcsInputQueueLock);
__try
{
// Is there an event to dequeue
if (gusQueueCount > 0)
{
memcpy( Event, &( gEventQueue[gusHeadIndex] ), sizeof( InputAtom ) );
// Check if it has the masks!
if ( ( Event->usEvent & uiMaskFlags ) )
{
return( DequeueEvent( Event) );
}
}
return( FALSE );
}
__finally
{
LeaveCriticalSection(&gcsInputQueueLock);
}
}
#else
BOOLEAN DequeueSpecificEvent(InputAtom *Event, UINT32 uiMaskFlags )
BOOLEAN DequeueSpecificEvent(InputAtom *Event, UINT32 uiMaskFlags )
{
EnterCriticalSection(&gcsInputQueueLock);
__try
{
// Is there an event to dequeue
if (gusQueueCount > 0)
@@ -524,13 +490,13 @@ void QueuePureEvent(UINT16 ubInputEvent, UINT32 usParam, UINT32 uiParam)
return( FALSE );
}
#endif
__finally
{
LeaveCriticalSection(&gcsInputQueueLock);
}
}
#ifdef USE_HIGHSPEED_GAMELOOP_TIMER
BOOLEAN InternalDequeueEvent(InputAtom *Event)
#else
BOOLEAN DequeueEvent(InputAtom *Event)
#endif
BOOLEAN InternalDequeueEvent(InputAtom *Event)
{
HandleSingleClicksAndButtonRepeats( );
@@ -562,20 +528,19 @@ void QueuePureEvent(UINT16 ubInputEvent, UINT32 usParam, UINT32 uiParam)
}
}
#ifdef USE_HIGHSPEED_GAMELOOP_TIMER
BOOLEAN DequeueEvent(InputAtom *Event)
BOOLEAN DequeueEvent(InputAtom *Event)
{
__try
{
__try
{
EnterCriticalSection(&gcsInputQueueLock);
return InternalDequeueEvent(Event);
}
__finally
{
LeaveCriticalSection(&gcsInputQueueLock);
}
EnterCriticalSection(&gcsInputQueueLock);
return InternalDequeueEvent(Event);
}
#endif
__finally
{
LeaveCriticalSection(&gcsInputQueueLock);
}
}
void KeyChange(UINT32 usParam, UINT32 uiParam, UINT8 ufKeyState)
{
+105 -136
View File
@@ -151,13 +151,13 @@ BOOLEAN InitializeStandardGamingPlatform(HINSTANCE hInstance, int sCommandSho
void ShutdownStandardGamingPlatform(void);
void GetRuntimeSettings( );
#ifdef USE_HIGHSPEED_GAMELOOP_TIMER
INT32 FAR PASCAL SyncWindowProcedure(HWND hWindow, UINT16 Message, WPARAM wParam, LPARAM lParam);
void CreateStandardGamingPlatform(HWND hWindow);
void SafeSGPExit(void);
static bool CallGameLoop(bool wait);
static CRITICAL_SECTION gcsGameLoop;
#endif
INT32 FAR PASCAL SyncWindowProcedure(HWND hWindow, UINT16 Message, WPARAM wParam, LPARAM lParam);
void CreateStandardGamingPlatform(HWND hWindow);
void SafeSGPExit(void);
static bool CallGameLoop(bool wait);
static CRITICAL_SECTION gcsGameLoop;
int PASCAL HandledWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR pCommandLine, int sCommandShow);
@@ -216,16 +216,16 @@ BOOLEAN gfIgnoreMessages=FALSE;
// GLOBAL VARIBLE, SET TO DEFAULT BUT CAN BE CHANGED BY THE GAME IF INIT FILE READ
UINT8 gbPixelDepth = PIXEL_DEPTH;
#ifdef USE_HIGHSPEED_GAMELOOP_TIMER
INT32 FAR PASCAL SyncWindowProcedure(HWND hWindow, UINT16 Message, WPARAM wParam, LPARAM lParam)
{
INT32 retval;
EnterCriticalSection(&gcsGameLoop);
retval = WindowProcedure(hWindow, Message, wParam, lParam);
LeaveCriticalSection(&gcsGameLoop);
return retval;
}
#endif
INT32 FAR PASCAL SyncWindowProcedure(HWND hWindow, UINT16 Message, WPARAM wParam, LPARAM lParam)
{
INT32 retval;
EnterCriticalSection(&gcsGameLoop);
retval = WindowProcedure(hWindow, Message, wParam, lParam);
LeaveCriticalSection(&gcsGameLoop);
return retval;
}
bool s_bExportStrings = false;
extern bool g_bUseXML_Strings;// = false;
@@ -536,9 +536,7 @@ INT32 FAR PASCAL WindowProcedure(HWND hWindow, UINT16 Message, WPARAM wParam, LP
case WM_CREATE:
#ifdef USE_HIGHSPEED_GAMELOOP_TIMER
CreateStandardGamingPlatform(hWindow);
#endif
break;
case WM_DESTROY:
@@ -667,11 +665,7 @@ BOOLEAN InitializeStandardGamingPlatform(HINSTANCE hInstance, int sCommandShow)
FontTranslationTable *pFontTable;
// now required by all (even JA2) in order to call ShutdownSGP
#ifdef USE_HIGHSPEED_GAMELOOP_TIMER
atexit(SafeSGPExit);
#else
atexit(SGPExit);
#endif
// First, initialize the registry keys.
InitializeRegistryKeys( "Wizardry8", "Wizardry8key" );
@@ -732,9 +726,8 @@ BOOLEAN InitializeStandardGamingPlatform(HINSTANCE hInstance, int sCommandShow)
return FALSE;
}
#ifdef USE_HIGHSPEED_GAMELOOP_TIMER
InitializeCriticalSection(&gcsGameLoop);
#endif
FastDebugMsg("Initializing Video Manager");
// Initialize DirectDraw (DirectX 2)
@@ -761,13 +754,6 @@ BOOLEAN InitializeStandardGamingPlatform(HINSTANCE hInstance, int sCommandShow)
return FALSE;
}
#ifdef USE_HIGHSPEED_GAMELOOP_TIMER
#else
InitializeJA2Clock();
#endif
//InitializeJA2TimerID();
#ifdef USE_VFS
//vfs::Path exe_dir, exe_file;
//os::getExecutablePath(exe_dir, exe_file);
@@ -915,26 +901,25 @@ BOOLEAN InitializeStandardGamingPlatform(HINSTANCE hInstance, int sCommandShow)
return TRUE;
}
#ifdef USE_HIGHSPEED_GAMELOOP_TIMER
static void TimerActivatedCallback(INT32 timer, PTR state)
static void TimerActivatedCallback(INT32 timer, PTR state)
{
if (gfApplicationActive && gfProgramIsRunning)
{
if (gfApplicationActive && gfProgramIsRunning)
{
if (CallGameLoop(false))
YieldProcessor();
}
if (CallGameLoop(false))
YieldProcessor();
}
}
void CreateStandardGamingPlatform(HWND hWindow)
{
InitializeJA2Clock();
void CreateStandardGamingPlatform(HWND hWindow)
{
InitializeJA2Clock();
if (!IsHiSpeedClockMode())
SetTimer( hWindow, 0, 1, NULL);
else
AddTimerNotifyCallback(TimerActivatedCallback, hWindow);
}
if (!IsHiSpeedClockMode())
SetTimer( hWindow, 0, 1, NULL);
else
AddTimerNotifyCallback(TimerActivatedCallback, hWindow);
}
#endif
void ShutdownStandardGamingPlatform(void)
{
@@ -959,9 +944,7 @@ void ShutdownStandardGamingPlatform(void)
// Shut down the different components of the SGP
//
#ifdef USE_HIGHSPEED_GAMELOOP_TIMER
ClearTimerNotifyCallbacks();
#endif
// TEST
SoundServiceStreams();
@@ -1009,9 +992,7 @@ void ShutdownStandardGamingPlatform(void)
// down the debugging layer
UnRegisterDebugTopic(TOPIC_SGP, "Standard Gaming Platform");
#ifdef USE_HIGHSPEED_GAMELOOP_TIMER
DeleteCriticalSection(&gcsGameLoop);
#endif
ShutdownDebugManager();
@@ -1277,12 +1258,6 @@ int PASCAL HandledWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR pC
FastDebugMsg("Running Game");
#ifdef USE_HIGHSPEED_GAMELOOP_TIMER
#else
// 0verhaul: Use the smallest available timer to make sure all animation updates happen at the speed they're supposed to
SetTimer( ghWindow, uiTimer, 1, NULL);
#endif
// At this point the SGP is set up, which means all I/O, Memory, tools, etc... are available. All we need to do is
// attend to the gaming mechanics themselves
Message.wParam = 0;
@@ -1356,10 +1331,6 @@ int PASCAL HandledWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR pC
}
#endif
#ifdef USE_HIGHSPEED_GAMELOOP_TIMER
#else
KillTimer( ghWindow, uiTimer);
#endif
// This is the normal exit point
FastDebugMsg("Exiting Game");
@@ -1728,29 +1699,28 @@ void GetRuntimeSettings( )
s_CodePage = oProps.getStringProperty(L"Ja2 Settings", L"CODE_PAGE");
#endif // USE_CODE_PAGE
#ifdef USE_HIGHSPEED_GAMELOOP_TIMER
// get timer/clock initialization state
SetHiSpeedClockMode( oProps.getBoolProperty("Ja2 Settings", "HIGHSPEED_TIMER", false) ? TRUE : FALSE );
#endif
// get timer/clock initialization state
SetHiSpeedClockMode( oProps.getBoolProperty("Ja2 Settings", "HIGHSPEED_TIMER", false) ? TRUE : FALSE );
#endif
}
#ifdef USE_HIGHSPEED_GAMELOOP_TIMER
void SafeSGPExit(void)
void SafeSGPExit(void)
{
// SGPExit tends to use resources that are already uninitialized so handle
__try
{
// SGPExit tends to use resources that are already uninitialized so handle
__try
{
SGPExit();
}
__except( EXCEPTION_EXECUTE_HANDLER )
{
// The application is in exit and best effort to clean up
// has failed so just ignore and continue silently
}
SGPExit();
}
#endif
__except( EXCEPTION_EXECUTE_HANDLER )
{
// The application is in exit and best effort to clean up
// has failed so just ignore and continue silently
}
}
void ShutdownWithErrorBox(CHAR8 *pcMessage)
{
@@ -1945,70 +1915,69 @@ static LONG __stdcall SGPExceptionFilter(int exceptionCount, EXCEPTION_POINTERS*
return EXCEPTION_EXECUTE_HANDLER;
}
#ifdef USE_HIGHSPEED_GAMELOOP_TIMER
static void SGPGameLoop()
static void SGPGameLoop()
{
try
{
try
{
GameLoop();
}
catch(sgp::Exception &ex)
{
SGP_ERROR(ex.what());
SHOWEXCEPTION(ex);
}
catch(vfs::Exception &ex)
{
SGP_ERROR(ex.what());
SHOWEXCEPTION(ex);
}
catch(std::exception &ex)
{
sgp::Exception nex(ex.what());
SGP_ERROR(nex.what());
SHOWEXCEPTION(nex);
}
catch(const char* msg)
{
sgp::Exception ex(msg);
SGP_ERROR(ex.what());
SHOWEXCEPTION(ex);
}
GameLoop();
}
catch(sgp::Exception &ex)
{
SGP_ERROR(ex.what());
SHOWEXCEPTION(ex);
}
catch(vfs::Exception &ex)
{
SGP_ERROR(ex.what());
SHOWEXCEPTION(ex);
}
catch(std::exception &ex)
{
sgp::Exception nex(ex.what());
SGP_ERROR(nex.what());
SHOWEXCEPTION(nex);
}
catch(const char* msg)
{
sgp::Exception ex(msg);
SGP_ERROR(ex.what());
SHOWEXCEPTION(ex);
}
}
static bool CallGameLoop(bool wait)
{
static int numUnsuccessfulTries = 0;
if (wait)
{
EnterCriticalSection(&gcsGameLoop);
}
else
{
if ( !TryEnterCriticalSection(&gcsGameLoop) )
return false;
}
static bool CallGameLoop(bool wait)
__try
{
static int numUnsuccessfulTries = 0;
if (wait)
{
EnterCriticalSection(&gcsGameLoop);
}
else
{
if ( !TryEnterCriticalSection(&gcsGameLoop) )
return false;
}
__try
{
__try
{
SGPGameLoop();
numUnsuccessfulTries = 0;
}
__except( SGPExceptionFilter(++numUnsuccessfulTries, GetExceptionInformation()) )
{
}
SGPGameLoop();
numUnsuccessfulTries = 0;
}
__finally
__except( SGPExceptionFilter(++numUnsuccessfulTries, GetExceptionInformation()) )
{
LeaveCriticalSection(&gcsGameLoop);
}
// Give it several attempts to recover from random exceptions and to display error screen
if (numUnsuccessfulTries > 5)
ShutdownWithErrorBox("Unhandled exception. Unable to recover.");
return true;
}
#endif
__finally
{
LeaveCriticalSection(&gcsGameLoop);
}
// Give it several attempts to recover from random exceptions and to display error screen
if (numUnsuccessfulTries > 5)
ShutdownWithErrorBox("Unhandled exception. Unable to recover.");
return true;
}
-4
View File
@@ -933,11 +933,7 @@ void HandleViewerInput()
SECTORINFO *pSector;
InputAtom Event;
#ifdef USE_HIGHSPEED_GAMELOOP_TIMER
while( DequeueSpecificEvent(&Event, KEY_DOWN|KEY_UP) )
#else
while( DequeueEvent( &Event ) )
#endif
{
if( !HandleTextInput( &Event ) && Event.usEvent == KEY_DOWN )
{
-4
View File
@@ -3411,11 +3411,7 @@ DebugMsg (TOPIC_JA2,DBG_LEVEL_3,"Autoresolve3");
InputAtom InputEvent;
BOOLEAN fResetAutoResolve = FALSE;
#ifdef USE_HIGHSPEED_GAMELOOP_TIMER
while( DequeueSpecificEvent(&InputEvent, KEY_DOWN|KEY_UP|KEY_REPEAT) )
#else
while( DequeueEvent( &InputEvent ) )
#endif
{
if( InputEvent.usEvent == KEY_DOWN || InputEvent.usEvent == KEY_REPEAT )
{
-4
View File
@@ -1311,11 +1311,7 @@ void GetUserInput()
GetCursorPos(&MousePos);
ScreenToClient(ghWindow, &MousePos); // In window coords!
#ifdef USE_HIGHSPEED_GAMELOOP_TIMER
while( DequeueSpecificEvent(&Event, KEY_DOWN|KEY_UP|KEY_REPEAT) )
#else
while( DequeueEvent( &Event ) )
#endif
{
if( !HandleTextInput( &Event ) && Event.usEvent == KEY_DOWN )
{
+1 -29
View File
@@ -6825,35 +6825,6 @@ void GetMapKeyboardInput( UINT32 *puiNewEvent )
while( DequeueEvent( &InputEvent ) )
{
#ifdef USE_HIGHSPEED_GAMELOOP_TIMER
#else
GetCursorPos(&MousePos);
ScreenToClient(ghWindow, &MousePos); // In window coords!
// HOOK INTO MOUSE HOOKS
switch(InputEvent.usEvent)
{
case LEFT_BUTTON_DOWN:
MouseSystemHook(LEFT_BUTTON_DOWN, (INT16)MousePos.x, (INT16)MousePos.y,_LeftButtonDown, _RightButtonDown);
break;
case LEFT_BUTTON_UP:
MouseSystemHook(LEFT_BUTTON_UP, (INT16)MousePos.x, (INT16)MousePos.y ,_LeftButtonDown, _RightButtonDown);
break;
case RIGHT_BUTTON_DOWN:
MouseSystemHook(RIGHT_BUTTON_DOWN, (INT16)MousePos.x, (INT16)MousePos.y,_LeftButtonDown, _RightButtonDown);
break;
case RIGHT_BUTTON_UP:
MouseSystemHook(RIGHT_BUTTON_UP, (INT16)MousePos.x, (INT16)MousePos.y,_LeftButtonDown, _RightButtonDown);
break;
case RIGHT_BUTTON_REPEAT:
MouseSystemHook(RIGHT_BUTTON_REPEAT, (INT16)MousePos.x, (INT16)MousePos.y,_LeftButtonDown, _RightButtonDown);
break;
case LEFT_BUTTON_REPEAT:
MouseSystemHook(LEFT_BUTTON_REPEAT, (INT16)MousePos.x, (INT16)MousePos.y,_LeftButtonDown, _RightButtonDown);
break;
}
#endif
if( InputEvent.usEvent == KEY_DOWN )
{
// if game is paused because of player, unpause with any key
@@ -8293,6 +8264,7 @@ void GetMapKeyboardInput( UINT32 *puiNewEvent )
}
else
{
extern void HandleDefaultEvent(InputAtom *Event);
HandleDefaultEvent(&InputEvent);
}
}
-4
View File
@@ -279,11 +279,7 @@ BOOLEAN HandleAutoBandage( )
// Deque all game events
DequeAllGameEvents( TRUE );
#ifdef USE_HIGHSPEED_GAMELOOP_TIMER
while (DequeueSpecificEvent(&InputEvent, KEY_DOWN|KEY_UP|KEY_REPEAT))
#else
while (DequeueEvent(&InputEvent) == TRUE)
#endif
{
if ( InputEvent.usEvent == KEY_UP )
{
-4
View File
@@ -1738,11 +1738,7 @@ void GetShopKeeperInterfaceUserInput()
GetCursorPos(&MousePos);
ScreenToClient(ghWindow, &MousePos); // In window coords!
#ifdef USE_HIGHSPEED_GAMELOOP_TIMER
while (DequeueSpecificEvent(&Event, KEY_DOWN|KEY_UP|KEY_REPEAT))
#else
while( DequeueEvent( &Event ) )
#endif
{
// HOOK INTO MOUSE HOOKS
/* removed warning condition C4060 (jonathanl)
-4
View File
@@ -620,11 +620,7 @@ void RenderSectorExitMenu( )
gsGlobalCursorYOffset = 0;
SetCurrentCursorFromDatabase( CURSOR_NORMAL );
#ifdef USE_HIGHSPEED_GAMELOOP_TIMER
while (DequeueSpecificEvent(&Event, KEY_DOWN|KEY_UP|KEY_REPEAT))
#else
while( DequeueEvent( &Event ) )
#endif
{
if( Event.usEvent == KEY_DOWN )
{
-2
View File
@@ -151,9 +151,7 @@ void HandleTacticalEndTurn( )
// OK, Do a number of things here....
// Every few turns......
#ifdef USE_HIGHSPEED_GAMELOOP_TIMER
SetFastForwardMode(FALSE); // Cancel FF at end of battle
#endif
// Get time elasped
uiTime = GetWorldTotalSeconds( );
-8
View File
@@ -168,9 +168,7 @@ void StartPlayerTeamTurn( BOOLEAN fDoBattleSnd, BOOLEAN fEnteringCombatMode )
// SOLDIERTYPE *pSoldier;
// EV_S_BEGINTURN SBeginTurn;
#ifdef USE_HIGHSPEED_GAMELOOP_TIMER
SetFastForwardMode(FALSE);
#endif
// Start the turn of player charactors
@@ -506,7 +504,6 @@ void BeginTeamTurn( UINT8 ubTeam )
if( !LightningEndOfTurn( ubTeam ) )return;
//end rain
#ifdef USE_HIGHSPEED_GAMELOOP_TIMER
// disable for our turn and enable for other teams
if ( gGameSettings.fOptions[TOPTION_AUTO_FAST_FORWARD_MODE] )
{
@@ -521,7 +518,6 @@ void BeginTeamTurn( UINT8 ubTeam )
SetFastForwardMode( (ubTeam != OUR_TEAM) );
}
}
#endif
while( 1 )
{
@@ -849,9 +845,7 @@ void StartInterrupt( void )
INT32 iSquad, iCounter;
// disable ff mode
#ifdef USE_HIGHSPEED_GAMELOOP_TIMER
SetFastForwardMode(FALSE);
#endif
// build string for display of who gets interrupt
//while( 1 )
@@ -1454,7 +1448,6 @@ void EndInterrupt( BOOLEAN fMarkInterruptOccurred )
}
#ifdef USE_HIGHSPEED_GAMELOOP_TIMER
if ( gGameSettings.fOptions[TOPTION_AUTO_FAST_FORWARD_MODE] )
{
if (is_networked)
@@ -1468,7 +1461,6 @@ void EndInterrupt( BOOLEAN fMarkInterruptOccurred )
SetFastForwardMode( (gTacticalStatus.ubCurrentTeam != OUR_TEAM) );
}
}
#endif
}
-4
View File
@@ -713,11 +713,7 @@ void HandleOverheadUI(void)
ScrollOverheadMap();
#ifdef USE_HIGHSPEED_GAMELOOP_TIMER
while(DequeueSpecificEvent(&InputEvent, KEY_DOWN|KEY_UP|KEY_REPEAT) == TRUE)
#else
while(DequeueEvent(&InputEvent) == TRUE)
#endif
{
if(InputEvent.usEvent == KEY_DOWN || InputEvent.usEvent == KEY_REPEAT)
{
-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
-4
View File
@@ -185,11 +185,7 @@ UINT32 AniEditScreenHandle(void)
}
#ifdef USE_HIGHSPEED_GAMELOOP_TIMER
if (DequeueSpecificEvent(&InputEvent, KEY_DOWN|KEY_UP|KEY_REPEAT))
#else
if (DequeueEvent(&InputEvent) == TRUE)
#endif
{
if ((InputEvent.usEvent == KEY_DOWN)&&(InputEvent.usParam == ESC))
{
-5
View File
@@ -31,11 +31,6 @@
// It seems (and is confirmed), that executables compiled with this zombie option turned on, causes slowdown in tactical.
//#define ENABLE_ZOMBIES
// -----------------------------
// -----------------------------
// WANNE: Enable this define, to build the gameloop with the highspeed timer. To use the highspeed timer, you also have to set the HIGHSPEED_TIMER = TRUE in ja2.ini
#define USE_HIGHSPEED_GAMELOOP_TIMER
// -----------------------------
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
// Map Editor version - you should use the MapEditor configuration instead of messing with these defines (ChrisL)
+14 -18
View File
@@ -148,12 +148,10 @@ BOOLEAN InitializeGame(void)
InitButtonSystem();
InitCursors( );
#ifdef USE_HIGHSPEED_GAMELOOP_TIMER
SetFastForwardPeriod(gGameExternalOptions.iFastForwardPeriod);
SetFastForwardKey(gGameExternalOptions.iFastForwardKey);
SetNotifyFrequencyKey(gGameExternalOptions.iNotifyFrequency);
SetClockSpeedPercent(gGameExternalOptions.fClockSpeedPercent);
#endif
// Init Fonts
if ( !InitializeFonts( ) )
@@ -599,22 +597,20 @@ void NextLoopCheckForEnoughFreeHardDriveSpace()
gubCheckForFreeSpaceOnHardDriveCount = 0;
}
// Called by any game loop after all known events were handled
void HandleDefaultEvent(InputAtom *Event)
{
const int MouseButtonEvents = LEFT_BUTTON_REPEAT|RIGHT_BUTTON_REPEAT|
LEFT_BUTTON_DOWN|LEFT_BUTTON_UP|MIDDLE_BUTTON_UP|X1_BUTTON_UP|X2_BUTTON_UP|
RIGHT_BUTTON_DOWN|RIGHT_BUTTON_UP|MIDDLE_BUTTON_DOWN|X1_BUTTON_DOWN|X2_BUTTON_DOWN|
MOUSE_WHEEL_UP|MOUSE_WHEEL_DOWN;
#ifdef USE_HIGHSPEED_GAMELOOP_TIMER
// Called by any game loop after all known events were handled
void HandleDefaultEvent(InputAtom *Event)
if (Event != NULL && Event->usEvent & MouseButtonEvents)
{
const int MouseButtonEvents = LEFT_BUTTON_REPEAT|RIGHT_BUTTON_REPEAT|
LEFT_BUTTON_DOWN|LEFT_BUTTON_UP|MIDDLE_BUTTON_UP|X1_BUTTON_UP|X2_BUTTON_UP|
RIGHT_BUTTON_DOWN|RIGHT_BUTTON_UP|MIDDLE_BUTTON_DOWN|X1_BUTTON_DOWN|X2_BUTTON_DOWN|
MOUSE_WHEEL_UP|MOUSE_WHEEL_DOWN;
if (Event != NULL && Event->usEvent & MouseButtonEvents)
{
POINT MousePos;
GetCursorPos(&MousePos);
ScreenToClient(ghWindow, &MousePos); // In window coords!
MouseSystemHook(Event->usEvent, (UINT16)MousePos.x ,(UINT16)MousePos.y ,_LeftButtonDown, _RightButtonDown);
}
POINT MousePos;
GetCursorPos(&MousePos);
ScreenToClient(ghWindow, &MousePos); // In window coords!
MouseSystemHook(Event->usEvent, (UINT16)MousePos.x ,(UINT16)MousePos.y ,_LeftButtonDown, _RightButtonDown);
}
#endif
}
-4
View File
@@ -321,11 +321,7 @@ UINT32 ErrorScreenHandle(void)
EndFrameBufferRender( );
// Check for esc
#ifdef USE_HIGHSPEED_GAMELOOP_TIMER
while (DequeueSpecificEvent(&InputEvent, KEY_DOWN|KEY_UP|KEY_REPEAT))
#else
while (DequeueEvent(&InputEvent) == TRUE)
#endif
{
if( InputEvent.usEvent == KEY_DOWN )
{