- Made the "Highspeed timer game loop (FF-MOD by tazpn)" optional, so we can decide if we like to build an executable with/without the highspeed timer

o See: builddefines.h: #define USE_HIGHSPEED_GAMELOOP_TIMER
o Gamers reported on the Bears Pit, that an executable compiled WITH the highspeed timer enabled makes the game unplayable slow in mapscreen mode when doing certain actions (repair, ...). That is the reason, why I made the compilation of the highspeed timer optional. Currently it is disabled.

git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@5355 3b4a5df2-a311-0410-b5c6-a8a6f20db521
This commit is contained in:
Wanne
2012-06-25 15:06:04 +00:00
parent f4d47f38e2
commit e8027d6663
55 changed files with 1277 additions and 687 deletions
+4
View File
@@ -417,7 +417,11 @@ 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,7 +76,12 @@ 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 )
{
+6
View File
@@ -397,7 +397,13 @@ void PopupMenuHandle()
return;
}
//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
@@ -2578,7 +2578,11 @@ 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 )
{
@@ -5398,7 +5402,11 @@ 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 )
{
+17 -2
View File
@@ -38,8 +38,11 @@
#include "InterfaceItemImages.h"
#endif
#include "KeyMap.h"
#include "Timer Control.h"
#ifdef USE_HIGHSPEED_GAMELOOP_TIMER
#include "KeyMap.h"
#include "Timer Control.h"
#endif
#include "Text.h"
#include "connect.h"
#include "sgp_logger.h"
@@ -240,6 +243,7 @@ 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
@@ -248,6 +252,7 @@ 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
gGameSettings.fOptions[TOPTION_ZOMBIES] = iniReader.ReadBoolean("JA2 Game Settings","TOPTION_ZOMBIES" , FALSE );
@@ -407,7 +412,11 @@ 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_ZOMBIES = " << (gGameSettings.fOptions[TOPTION_ZOMBIES] ? "TRUE" : "FALSE" ) << endl;
settings << "TOPTION_CHEAT_MODE_OPTIONS_HEADER = " << (gGameSettings.fOptions[TOPTION_CHEAT_MODE_OPTIONS_HEADER] ? "TRUE" : "FALSE" ) << endl;
settings << "TOPTION_FORCE_BOBBY_RAY_SHIPMENTS = " << (gGameSettings.fOptions[TOPTION_FORCE_BOBBY_RAY_SHIPMENTS] ? "TRUE" : "FALSE" ) << endl;
@@ -535,7 +544,11 @@ void InitGameSettings()
gGameSettings.fOptions[ TOPTION_QUIET_TRAINING ] = FALSE;
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_ZOMBIES ] = FALSE; // Flugente Zombies 1.0
@@ -1794,6 +1807,7 @@ void LoadGameExternalOptions()
gGameExternalOptions.fEnableInventoryPoolQ = FALSE;
#endif
#ifdef USE_HIGHSPEED_GAMELOOP_TIMER
////////// CLOCK SETTINGS //////////
// Key to artificially alter the clock so turns run faster
@@ -1804,6 +1818,7 @@ 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
}
+6
View File
@@ -90,7 +90,11 @@ enum
TOPTION_QUIET_TRAINING, //Madd: mercs don't say gained experience quote while training
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
TOPTION_ZOMBIES, // Flugente Zombies 1.0: allow zombies
// arynn: Debug/Cheat
@@ -1083,6 +1087,7 @@ 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.
@@ -1093,6 +1098,7 @@ typedef struct
INT32 iNotifyFrequency;
// Frequency that the screen is updated
FLOAT fClockSpeedPercent;
#endif
// Flugente FTW 1: Weapon Overheating
BOOLEAN fDisplayOverheatThermometer; // Should a 'thermometer' for guns and replacable barrels be displayed?
+9 -9
View File
@@ -15,9 +15,9 @@
#ifdef JA2EDITOR
#ifdef JA2UB
CHAR16 zVersionLabel[256] = { L"Unfinished Business - Map Editor v1.13.5353 (Development Build)" };
CHAR16 zVersionLabel[256] = { L"Unfinished Business - Map Editor v1.13.5354 (Development Build)" };
#else
CHAR16 zVersionLabel[256] = { L"Map Editor v1.13.5353 (Development Build)" };
CHAR16 zVersionLabel[256] = { L"Map Editor v1.13.5354 (Development Build)" };
#endif
// ------------------------------
@@ -27,11 +27,11 @@
//DEBUG BUILD VERSION
#ifdef JA2UB
CHAR16 zVersionLabel[256] = { L"Debug: Unfinished Business - v1.13.5353 (Development Build)" };
CHAR16 zVersionLabel[256] = { L"Debug: Unfinished Business - v1.13.5354 (Development Build)" };
#elif defined (JA113DEMO) || defined (JA113NODEMO)
CHAR16 zVersionLabel[256] = { L"Debug: JA2 Demo - v1.13.5353 (Development Build)" };
CHAR16 zVersionLabel[256] = { L"Debug: JA2 Demo - v1.13.5354 (Development Build)" };
#else
CHAR16 zVersionLabel[256] = { L"Debug: v1.13.5353 (Development Build)" };
CHAR16 zVersionLabel[256] = { L"Debug: v1.13.5354 (Development Build)" };
#endif
#elif defined CRIPPLED_VERSION
@@ -46,16 +46,16 @@
//RELEASE BUILD VERSION
#ifdef JA2UB
CHAR16 zVersionLabel[256] = { L"Release Unfinished Business - v1.13.5353 (Development Build)" };
CHAR16 zVersionLabel[256] = { L"Release Unfinished Business - v1.13.5354 (Development Build)" };
#elif defined (JA113DEMO) || defined (JA113NODEMO)
CHAR16 zVersionLabel[256] = { L"Release JA2 Demo - v1.13.5353 (Development Build)" };
CHAR16 zVersionLabel[256] = { L"Release JA2 Demo - v1.13.5354 (Development Build)" };
#else
CHAR16 zVersionLabel[256] = { L"Release v1.13.5353 (Development Build)" };
CHAR16 zVersionLabel[256] = { L"Release v1.13.5354 (Development Build)" };
#endif
#endif
CHAR8 czVersionNumber[16] = { "Build 19.06.12" }; //YY.MM.DD
CHAR8 czVersionNumber[16] = { "Build 25.06.12" }; //YY.MM.DD
CHAR16 zTrackingNumber[16] = { L"Z" };
// SAVE_GAME_VERSION is defined in header, change it there
+5
View File
@@ -5020,7 +5020,12 @@ 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 )
{
+2
View File
@@ -4053,10 +4053,12 @@ void HandleBobbyRGunsKeyBoardInput()
break;
}
}
#ifdef USE_HIGHSPEED_GAMELOOP_TIMER
else
{
extern void HandleDefaultEvent(InputAtom *Event);
HandleDefaultEvent(&InputEvent);
}
#endif
}
}
+4
View File
@@ -426,7 +426,11 @@ 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,7 +493,11 @@ 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
@@ -455,7 +455,11 @@ 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,7 +266,11 @@ 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 ) )
{
+4
View File
@@ -1257,7 +1257,11 @@ 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
@@ -6419,7 +6419,11 @@ 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') )
{
+5
View File
@@ -757,7 +757,12 @@ UINT32 MPChatScreenHandle( )
// carter, need key shortcuts for clearing up message boxes
// 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,7 +418,11 @@ 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,7 +2740,11 @@ 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,7 +665,11 @@ 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,7 +536,11 @@ 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
@@ -484,7 +484,11 @@ 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 )
{
@@ -533,7 +537,11 @@ 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,7 +1306,11 @@ 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
@@ -3937,7 +3937,9 @@ 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
+70 -30
View File
@@ -111,7 +111,9 @@ BOOLEAN gfCurrentStringInputState;
StringInput *gpCurrentStringDescriptor;
// Thread
static CRITICAL_SECTION gcsInputQueueLock;
#ifdef USE_HIGHSPEED_GAMELOOP_TIMER
static CRITICAL_SECTION gcsInputQueueLock;
#endif
// Local function headers
@@ -280,7 +282,9 @@ 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));
@@ -294,7 +298,11 @@ void ShutdownInputManager(void)
UnRegisterDebugTopic(TOPIC_INPUT, "Input Manager");
// UnhookWindowsHookEx(ghKeyboardHook);
UnhookWindowsHookEx(ghMouseHook);
#ifdef USE_HIGHSPEED_GAMELOOP_TIMER
DeleteCriticalSection(&gcsInputQueueLock);
#endif
}
void QueuePureEvent(UINT16 ubInputEvent, UINT32 usParam, UINT32 uiParam)
@@ -335,7 +343,11 @@ void QueuePureEvent(UINT16 ubInputEvent, UINT32 usParam, UINT32 uiParam)
}
}
void InternalQueueEvent(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
{
UINT32 uiTimer;
UINT16 usKeyState;
@@ -458,20 +470,45 @@ void InternalQueueEvent(UINT16 ubInputEvent, UINT32 usParam, UINT32 uiParam)
}
}
void QueueEvent(UINT16 ubInputEvent, UINT32 usParam, UINT32 uiParam)
{
EnterCriticalSection(&gcsInputQueueLock);
__try {
InternalQueueEvent(ubInputEvent, usParam, uiParam);
}__finally {
LeaveCriticalSection(&gcsInputQueueLock);
#ifdef USE_HIGHSPEED_GAMELOOP_TIMER
void QueueEvent(UINT16 ubInputEvent, UINT32 usParam, UINT32 uiParam)
{
EnterCriticalSection(&gcsInputQueueLock);
__try {
InternalQueueEvent(ubInputEvent, usParam, uiParam);
}__finally {
LeaveCriticalSection(&gcsInputQueueLock);
}
}
}
#endif
BOOLEAN DequeueSpecificEvent(InputAtom *Event, UINT32 uiMaskFlags )
{
EnterCriticalSection(&gcsInputQueueLock);
__try
#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 )
{
// Is there an event to dequeue
if (gusQueueCount > 0)
@@ -487,13 +524,13 @@ BOOLEAN DequeueSpecificEvent(InputAtom *Event, UINT32 uiMaskFlags )
return( FALSE );
}
__finally
{
LeaveCriticalSection(&gcsInputQueueLock);
}
}
#endif
BOOLEAN InternalDequeueEvent(InputAtom *Event)
#ifdef USE_HIGHSPEED_GAMELOOP_TIMER
BOOLEAN InternalDequeueEvent(InputAtom *Event)
#else
BOOLEAN DequeueEvent(InputAtom *Event)
#endif
{
HandleSingleClicksAndButtonRepeats( );
@@ -524,18 +561,21 @@ BOOLEAN InternalDequeueEvent(InputAtom *Event)
return FALSE;
}
}
BOOLEAN DequeueEvent(InputAtom *Event)
{
__try
#ifdef USE_HIGHSPEED_GAMELOOP_TIMER
BOOLEAN DequeueEvent(InputAtom *Event)
{
EnterCriticalSection(&gcsInputQueueLock);
return InternalDequeueEvent(Event);
__try
{
EnterCriticalSection(&gcsInputQueueLock);
return InternalDequeueEvent(Event);
}
__finally
{
LeaveCriticalSection(&gcsInputQueueLock);
}
}
__finally
{
LeaveCriticalSection(&gcsInputQueueLock);
}
}
#endif
void KeyChange(UINT32 usParam, UINT32 uiParam, UINT8 ufKeyState)
{
+137 -97
View File
@@ -56,8 +56,8 @@
#define USE_CONSOLE 0
#include <iostream>
#include <excpt.h>
#include "ExceptionHandling.h"
#include "dbt.h"
@@ -146,16 +146,18 @@ extern BOOLEAN CheckIfGameCdromIsInCDromDrive();
extern void QueueEvent(UINT16 ubInputEvent, UINT32 usParam, UINT32 uiParam);
// Prototype Declarations
INT32 FAR PASCAL SyncWindowProcedure(HWND hWindow, UINT16 Message, WPARAM wParam, LPARAM lParam);
INT32 FAR PASCAL WindowProcedure(HWND hWindow, UINT16 Message, WPARAM wParam, LPARAM lParam);
BOOLEAN InitializeStandardGamingPlatform(HINSTANCE hInstance, int sCommandShow);
void ShutdownStandardGamingPlatform(void);
void CreateStandardGamingPlatform(HWND hWindow);
void GetRuntimeSettings( );
void SafeSGPExit(void);
static bool CallGameLoop(bool wait);
static CRITICAL_SECTION gcsGameLoop;
#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
int PASCAL HandledWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR pCommandLine, int sCommandShow);
@@ -214,14 +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;
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;
}
#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
bool s_bExportStrings = false;
extern bool g_bUseXML_Strings;// = false;
@@ -531,7 +535,10 @@ INT32 FAR PASCAL WindowProcedure(HWND hWindow, UINT16 Message, WPARAM wParam, LP
break;
case WM_CREATE:
#ifdef USE_HIGHSPEED_GAMELOOP_TIMER
CreateStandardGamingPlatform(hWindow);
#endif
break;
case WM_DESTROY:
@@ -660,7 +667,11 @@ 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" );
@@ -721,7 +732,9 @@ BOOLEAN InitializeStandardGamingPlatform(HINSTANCE hInstance, int sCommandShow)
return FALSE;
}
#ifdef USE_HIGHSPEED_GAMELOOP_TIMER
InitializeCriticalSection(&gcsGameLoop);
#endif
FastDebugMsg("Initializing Video Manager");
// Initialize DirectDraw (DirectX 2)
@@ -748,6 +761,11 @@ BOOLEAN InitializeStandardGamingPlatform(HINSTANCE hInstance, int sCommandShow)
return FALSE;
}
#ifdef USE_HIGHSPEED_GAMELOOP_TIMER
#else
InitializeJA2Clock();
#endif
//InitializeJA2TimerID();
#ifdef USE_VFS
@@ -897,24 +915,26 @@ BOOLEAN InitializeStandardGamingPlatform(HINSTANCE hInstance, int sCommandShow)
return TRUE;
}
static void TimerActivatedCallback(INT32 timer, PTR state)
{
if (gfApplicationActive && gfProgramIsRunning)
#ifdef USE_HIGHSPEED_GAMELOOP_TIMER
static void TimerActivatedCallback(INT32 timer, PTR state)
{
if (CallGameLoop(false))
YieldProcessor();
if (gfApplicationActive && gfProgramIsRunning)
{
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)
{
@@ -938,7 +958,10 @@ void ShutdownStandardGamingPlatform(void)
//
// Shut down the different components of the SGP
//
#ifdef USE_HIGHSPEED_GAMELOOP_TIMER
ClearTimerNotifyCallbacks();
#endif
// TEST
SoundServiceStreams();
@@ -986,7 +1009,9 @@ void ShutdownStandardGamingPlatform(void)
// down the debugging layer
UnRegisterDebugTopic(TOPIC_SGP, "Standard Gaming Platform");
#ifdef USE_HIGHSPEED_GAMELOOP_TIMER
DeleteCriticalSection(&gcsGameLoop);
#endif
ShutdownDebugManager();
@@ -1252,6 +1277,12 @@ 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;
@@ -1325,6 +1356,11 @@ 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");
PostQuitMessage(0);
@@ -1685,26 +1721,29 @@ 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
#endif
}
void SafeSGPExit(void)
{
// SGPExit tends to use resources that are already uninitialized so handle
__try
#ifdef USE_HIGHSPEED_GAMELOOP_TIMER
void SafeSGPExit(void)
{
SGPExit();
// 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
}
}
__except( EXCEPTION_EXECUTE_HANDLER )
{
// The application is in exit and best effort to clean up
// has failed so just ignore and continue silently
}
}
#endif
void ShutdownWithErrorBox(CHAR8 *pcMessage)
{
@@ -1899,69 +1938,70 @@ static LONG __stdcall SGPExceptionFilter(int exceptionCount, EXCEPTION_POINTERS*
return EXCEPTION_EXECUTE_HANDLER;
}
static void SGPGameLoop()
{
try
#ifdef USE_HIGHSPEED_GAMELOOP_TIMER
static void SGPGameLoop()
{
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;
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);
}
}
__try
static bool CallGameLoop(bool wait)
{
static int numUnsuccessfulTries = 0;
if (wait)
{
EnterCriticalSection(&gcsGameLoop);
}
else
{
if ( !TryEnterCriticalSection(&gcsGameLoop) )
return false;
}
__try
{
SGPGameLoop();
numUnsuccessfulTries = 0;
__try
{
SGPGameLoop();
numUnsuccessfulTries = 0;
}
__except( SGPExceptionFilter(++numUnsuccessfulTries, GetExceptionInformation()) )
{
}
}
__except( SGPExceptionFilter(++numUnsuccessfulTries, GetExceptionInformation()) )
__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;
}
__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;
}
#endif
+5
View File
@@ -932,7 +932,12 @@ 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 )
{
+5
View File
@@ -3410,7 +3410,12 @@ 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,7 +1311,11 @@ 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 )
{
+31 -2
View File
@@ -6811,6 +6811,7 @@ void InitializeWorldSize(INT16 sSectorX, INT16 sSectorY , INT8 bSectorZ)
void GetMapKeyboardInput( UINT32 *puiNewEvent )
{
InputAtom InputEvent;
POINT MousePos;
INT8 bSquadNumber;
UINT8 ubGroupId = 0;
BOOLEAN fCtrl, fAlt;
@@ -6822,9 +6823,37 @@ void GetMapKeyboardInput( UINT32 *puiNewEvent )
fCtrl = _KeyDown( CTRL );
fAlt = _KeyDown( ALT );
// while( DequeueEvent( &InputEvent ) )
while( DequeueSpecificEvent( &InputEvent, KEY_DOWN|KEY_UP|KEY_REPEAT ) ) // doesn't work for some reason -- MM: fixed? it works better for me like this
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
+4
View File
@@ -279,7 +279,11 @@ 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,7 +1738,11 @@ 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,7 +620,11 @@ 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,7 +151,9 @@ 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( );
+9
View File
@@ -167,7 +167,10 @@ void StartPlayerTeamTurn( BOOLEAN fDoBattleSnd, BOOLEAN fEnteringCombatMode )
DebugMsg (TOPIC_JA2INTERRUPT,DBG_LEVEL_3,"StartPlayerTeamTurn");
// SOLDIERTYPE *pSoldier;
// EV_S_BEGINTURN SBeginTurn;
#ifdef USE_HIGHSPEED_GAMELOOP_TIMER
SetFastForwardMode(FALSE);
#endif
// Start the turn of player charactors
@@ -496,6 +499,7 @@ 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] )
{
@@ -510,6 +514,7 @@ void BeginTeamTurn( UINT8 ubTeam )
SetFastForwardMode( (ubTeam != OUR_TEAM) );
}
}
#endif
while( 1 )
{
@@ -837,7 +842,9 @@ 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 )
@@ -1432,6 +1439,7 @@ void EndInterrupt( BOOLEAN fMarkInterruptOccurred )
}
#ifdef USE_HIGHSPEED_GAMELOOP_TIMER
if ( gGameSettings.fOptions[TOPTION_AUTO_FAST_FORWARD_MODE] )
{
if (is_networked)
@@ -1445,6 +1453,7 @@ void EndInterrupt( BOOLEAN fMarkInterruptOccurred )
SetFastForwardMode( (gTacticalStatus.ubCurrentTeam != OUR_TEAM) );
}
}
#endif
}
+4
View File
@@ -674,7 +674,11 @@ 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,7 +101,11 @@ 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)
{
+679 -497
View File
File diff suppressed because it is too large Load Diff
+82 -32
View File
@@ -54,6 +54,13 @@ 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
@@ -70,7 +77,10 @@ BOOLEAN InitializeJA2Clock( void );
void ShutdownJA2Clock( void );
#define GetJA2Clock() guiBaseJA2Clock
#define GetJA2NoPauseClock() guiBaseJA2NoPauseClock
#ifdef USE_HIGHSPEED_GAMELOOP_TIMER
#define GetJA2NoPauseClock() guiBaseJA2NoPauseClock
#endif
UINT32 GetPauseJA2Clock( );
@@ -82,49 +92,89 @@ void PauseTime( BOOLEAN fPaused );
void SetCustomizableTimerCallbackAndDelay( INT32 iDelay, CUSTOMIZABLE_TIMER_CALLBACK pCallback, BOOLEAN fReplace );
void CheckCustomizableTimer( void );
void SetFastForwardPeriod(DOUBLE value);
void SetFastForwardKey(INT32 key);
BOOLEAN IsFastForwardKeyPressed();
void SetFastForwardMode(BOOLEAN enable);
BOOLEAN IsFastForwardMode();
INT32 GetFastForwardLoopCount();
void SetFastForwardLoopCount(INT32 value);
#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 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);
BOOLEAN IsHiSpeedClockMode();
void SetHiSpeedClockMode(BOOLEAN enable);
#endif
//Don't modify this value
extern UINT32 guiBaseJA2Clock;
extern UINT32 guiBaseJA2NoPauseClock;
extern CUSTOMIZABLE_TIMER_CALLBACK gpCustomizableTimerCallback;
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();
#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();
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)
#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
void SetTileAnimCounter( INT32 iTime );
#endif
+5 -1
View File
@@ -103,7 +103,11 @@
#include "vobject.h"
#include "overhead types.h"
#include "tactical save.h"
#include "KeyMap.h"
#ifdef USE_HIGHSPEED_GAMELOOP_TIMER
#include "KeyMap.h"
#endif
//#include <windows.h>
//#include <windowsx.h>
//#include <mmsystem.h>
+8
View File
@@ -5110,7 +5110,11 @@ 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"自动加速敌军回合", // Automatic fast forward through AI turns
#endif
L"Allow Zombies", // TODO.Translate
L"--作弊模式选项--", // TOPTION_CHEAT_MODE_OPTIONS_HEADER,
L"强制 Bobby Ray 送货", // force all pending Bobby Ray shipments
@@ -5219,7 +5223,11 @@ 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"打开时,敌军回合将被大幅加速。",
#endif
L"When ON, zombies will span. Be aware!", // allow zombies // TODO.Translate
L"(text not rendered)TOPTION_CHEAT_MODE_OPTIONS_HEADER",
L"强制 Bobby Ray 出货",
+8
View File
@@ -5109,7 +5109,11 @@ 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
L"Allow Zombies", // TODO.Translate
L"--Cheat Mode Options--", // TOPTION_CHEAT_MODE_OPTIONS_HEADER,
L"Force Bobby Ray shipments", // force all pending Bobby Ray shipments
@@ -5218,7 +5222,11 @@ 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
L"When ON, zombies will span. Be aware!", // allow zombies // TODO.Translate
L"(text not rendered)TOPTION_CHEAT_MODE_OPTIONS_HEADER",
L"Force all pending Bobby Ray shipments",
+8
View File
@@ -5108,7 +5108,11 @@ 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
L"Allow Zombies", // Flugente Zombies 1.0
L"--Cheat Mode Options--", // TOPTION_CHEAT_MODE_OPTIONS_HEADER,
L"Force Bobby Ray shipments", // force all pending Bobby Ray shipments
@@ -5217,7 +5221,11 @@ 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
L"When ON, zombies will spawn. Be aware!", // allow zombies
L"(text not rendered)TOPTION_CHEAT_MODE_OPTIONS_HEADER",
L"Force all pending Bobby Ray shipments",
+8
View File
@@ -5099,7 +5099,11 @@ 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
L"Allow Zombies", // Flugente Zombies 1.0
L"--Cheat Mode Options--", // TOPTION_CHEAT_MODE_OPTIONS_HEADER,
L"Forcer envois Bobby Ray", // force all pending Bobby Ray shipments
@@ -5208,7 +5212,11 @@ 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
L"When ON, zombies will span. Be aware!", // allow zombies // TODO.Translate
L"(text not rendered)TOPTION_CHEAT_MODE_OPTIONS_HEADER",
L"Forcer tous les envois en attente de Bobby Ray",
+8
View File
@@ -4957,7 +4957,11 @@ 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
L"Allow Zombies", // Flugente Zombies 1.0
L"--Cheat Mode Options--", // TOPTION_CHEAT_MODE_OPTIONS_HEADER,
L"Erzwinge BR Lieferung", // force all pending Bobby Ray shipments
@@ -5066,7 +5070,11 @@ STR16 zOptionsScreenHelpText[] =
L"Wenn diese Funktion aktiviert ist, werden die Söldner über ihren Fortschritt während des Trainings nicht mehr berichten.",
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"Wenn diese Funktion aktiviert ist, werden gegnerische Züge schneller durchgeführt.",
#endif
L"When ON, zombies will span. Be aware!", // allow zombies // TODO.Translate
L"(text not rendered)TOPTION_CHEAT_MODE_OPTIONS_HEADER",
L"Force all pending Bobby Ray shipments",
+8
View File
@@ -5094,7 +5094,11 @@ 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
L"Allow Zombies", // Flugente Zombies 1.0
L"--Cheat Mode Options--", // TOPTION_CHEAT_MODE_OPTIONS_HEADER,
L"Force Bobby Ray shipments", // force all pending Bobby Ray shipments
@@ -5203,7 +5207,11 @@ 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
L"When ON, zombies will span. Be aware!", // allow zombies // TODO.Translate
L"(text not rendered)TOPTION_CHEAT_MODE_OPTIONS_HEADER",
L"Force all pending Bobby Ray shipments",
+8
View File
@@ -5106,7 +5106,11 @@ 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
L"Allow Zombies", // Flugente Zombies 1.0
L"--Cheat Mode Options--", // TOPTION_CHEAT_MODE_OPTIONS_HEADER,
L"Force Bobby Ray shipments", // force all pending Bobby Ray shipments
@@ -5215,7 +5219,11 @@ 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
L"When ON, zombies will span. Be aware!", // allow zombies // TODO.Translate
L"(text not rendered)TOPTION_CHEAT_MODE_OPTIONS_HEADER",
L"WymuŚ wszystkie oczekiwane dostawy od Bobby Ray's.",
+8
View File
@@ -5089,7 +5089,11 @@ 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
L"Allow Zombies", // Flugente Zombies 1.0
L"--Читерские настройки--", // TOPTION_CHEAT_MODE_OPTIONS_HEADER,
L"Ускорить доставку Бобби Рэя", // force all pending Bobby Ray shipments
@@ -5198,7 +5202,11 @@ 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
L"When ON, zombies will span. Be aware!", // allow zombies // TODO.Translate
L"(text not rendered)TOPTION_CHEAT_MODE_OPTIONS_HEADER",
L"Выберите этот пункт чтобы груз Бобби Рэя прибыл немедленно.",
+8
View File
@@ -5110,7 +5110,11 @@ 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
L"Allow Zombies", // Flugente Zombies 1.0
L"--Cheat Mode Options--", // TOPTION_CHEAT_MODE_OPTIONS_HEADER,
L"Force Bobby Ray shipments", // force all pending Bobby Ray shipments
@@ -5219,7 +5223,11 @@ 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
L"When ON, zombies will span. Be aware!", // allow zombies // TODO.Translate
L"(text not rendered)TOPTION_CHEAT_MODE_OPTIONS_HEADER",
L"Force all pending Bobby Ray shipments",
+4
View File
@@ -185,7 +185,11 @@ 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
@@ -3,6 +3,11 @@
#include "Language Defines.h"
// 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
// CAUTION: A lot of games reported, when the exe is compiled with the highspeed timer on, the game runs very slowly in strategy map screen when doing repair, ..
// This is the reason, why I made a compilation define, where we can turn on/off the highspeed timer.
//#define USE_HIGHSPEED_GAMELOOP_TIMER
// -----------------------------
// *****************************
// WANNE: Enable those 2 defines, if you want to build UB-Version!!
+18 -15
View File
@@ -148,11 +148,12 @@ 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,19 +600,21 @@ void NextLoopCheckForEnoughFreeHardDriveSpace()
}
// 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;
if (Event != NULL && Event->usEvent & MouseButtonEvents)
#ifdef USE_HIGHSPEED_GAMELOOP_TIMER
// Called by any game loop after all known events were handled
void HandleDefaultEvent(InputAtom *Event)
{
POINT MousePos;
GetCursorPos(&MousePos);
ScreenToClient(ghWindow, &MousePos); // In window coords!
MouseSystemHook(Event->usEvent, (UINT16)MousePos.x ,(UINT16)MousePos.y ,_LeftButtonDown, _RightButtonDown);
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);
}
}
}
#endif
+4 -2
View File
@@ -18,7 +18,9 @@ void HandleShortCutExitState( void );
void SetPendingNewScreen( UINT32 uiNewScreen );
struct InputAtom;
void HandleDefaultEvent(InputAtom *Event);
#ifdef USE_HIGHSPEED_GAMELOOP_TIMER
struct InputAtom;
void HandleDefaultEvent(InputAtom *Event);
#endif
#endif
+4
View File
@@ -321,7 +321,11 @@ 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 )
{