- 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; InputAtom Event;
#ifdef USE_HIGHSPEED_GAMELOOP_TIMER
while (DequeueSpecificEvent(&Event, KEY_DOWN|KEY_UP|KEY_REPEAT)) while (DequeueSpecificEvent(&Event, KEY_DOWN|KEY_UP|KEY_REPEAT))
#else
while( DequeueEvent( &Event ) )
#endif
{ {
if( Event.usEvent == KEY_DOWN ) if( Event.usEvent == KEY_DOWN )
{ {
+5
View File
@@ -76,7 +76,12 @@ BOOLEAN MessageBoxHandled()
{ {
InputAtom DummyEvent; InputAtom DummyEvent;
#ifdef USE_HIGHSPEED_GAMELOOP_TIMER
while (DequeueSpecificEvent(&DummyEvent, KEY_DOWN|KEY_UP|KEY_REPEAT)) while (DequeueSpecificEvent(&DummyEvent, KEY_DOWN|KEY_UP|KEY_REPEAT))
#else
while( DequeueEvent( &DummyEvent ) )
#endif
{ {
if ( DummyEvent.usEvent == KEY_DOWN ) if ( DummyEvent.usEvent == KEY_DOWN )
{ {
+6
View File
@@ -397,7 +397,13 @@ void PopupMenuHandle()
return; return;
} }
//Use keyboard input as well. //Use keyboard input as well.
#ifdef USE_HIGHSPEED_GAMELOOP_TIMER
while (DequeueSpecificEvent(&InputEvent, KEY_DOWN|KEY_UP|KEY_REPEAT)) while (DequeueSpecificEvent(&InputEvent, KEY_DOWN|KEY_UP|KEY_REPEAT))
#else
while( DequeueEvent( &InputEvent ) )
#endif
{ {
switch(InputEvent.usEvent) switch(InputEvent.usEvent)
{ {
+8
View File
@@ -2578,7 +2578,11 @@ void GetGIOScreenUserInput()
{ {
InputAtom Event; InputAtom Event;
#ifdef USE_HIGHSPEED_GAMELOOP_TIMER
while (DequeueSpecificEvent(&Event, KEY_DOWN|KEY_UP|KEY_REPEAT)) while (DequeueSpecificEvent(&Event, KEY_DOWN|KEY_UP|KEY_REPEAT))
#else
while( DequeueEvent( &Event ) )
#endif
{ {
if( Event.usEvent == KEY_DOWN ) if( Event.usEvent == KEY_DOWN )
{ {
@@ -5398,7 +5402,11 @@ void GetGIOScreenUserInput()
{ {
InputAtom Event; InputAtom Event;
#ifdef USE_HIGHSPEED_GAMELOOP_TIMER
while (DequeueSpecificEvent(&Event, KEY_DOWN|KEY_UP|KEY_REPEAT)) while (DequeueSpecificEvent(&Event, KEY_DOWN|KEY_UP|KEY_REPEAT))
#else
while( DequeueEvent( &Event ) )
#endif
{ {
if( Event.usEvent == KEY_DOWN ) if( Event.usEvent == KEY_DOWN )
{ {
+15
View File
@@ -38,8 +38,11 @@
#include "InterfaceItemImages.h" #include "InterfaceItemImages.h"
#endif #endif
#ifdef USE_HIGHSPEED_GAMELOOP_TIMER
#include "KeyMap.h" #include "KeyMap.h"
#include "Timer Control.h" #include "Timer Control.h"
#endif
#include "Text.h" #include "Text.h"
#include "connect.h" #include "connect.h"
#include "sgp_logger.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_REPAIRING] = iniReader.ReadBoolean("JA2 Game Settings","TOPTION_QUIET_REPAIRING" , FALSE );
gGameSettings.fOptions[TOPTION_QUIET_DOCTORING] = iniReader.ReadBoolean("JA2 Game Settings","TOPTION_QUIET_DOCTORING" , FALSE ); gGameSettings.fOptions[TOPTION_QUIET_DOCTORING] = iniReader.ReadBoolean("JA2 Game Settings","TOPTION_QUIET_DOCTORING" , FALSE );
#ifdef USE_HIGHSPEED_GAMELOOP_TIMER
if (!is_networked) if (!is_networked)
gGameSettings.fOptions[TOPTION_AUTO_FAST_FORWARD_MODE] = iniReader.ReadBoolean("JA2 Game Settings","TOPTION_AUTO_FAST_FORWARD_MODE" , FALSE ); gGameSettings.fOptions[TOPTION_AUTO_FAST_FORWARD_MODE] = iniReader.ReadBoolean("JA2 Game Settings","TOPTION_AUTO_FAST_FORWARD_MODE" , FALSE );
else else
@@ -248,6 +252,7 @@ BOOLEAN LoadGameSettings()
// The "HIGHSPEED_TIMER" property from the ja2.ini is not set, disable the option // The "HIGHSPEED_TIMER" property from the ja2.ini is not set, disable the option
if (!IsHiSpeedClockMode()) if (!IsHiSpeedClockMode())
gGameSettings.fOptions[TOPTION_AUTO_FAST_FORWARD_MODE] = FALSE; gGameSettings.fOptions[TOPTION_AUTO_FAST_FORWARD_MODE] = FALSE;
#endif
gGameSettings.fOptions[TOPTION_ZOMBIES] = iniReader.ReadBoolean("JA2 Game Settings","TOPTION_ZOMBIES" , FALSE ); 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_TRAINING = " << (gGameSettings.fOptions[TOPTION_QUIET_TRAINING] ? "TRUE" : "FALSE" ) << endl;
settings << "TOPTION_QUIET_REPAIRING = " << (gGameSettings.fOptions[TOPTION_QUIET_REPAIRING] ? "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; 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; 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_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_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; 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_TRAINING ] = FALSE;
gGameSettings.fOptions[ TOPTION_QUIET_REPAIRING ] = FALSE; gGameSettings.fOptions[ TOPTION_QUIET_REPAIRING ] = FALSE;
gGameSettings.fOptions[ TOPTION_QUIET_DOCTORING ] = FALSE; gGameSettings.fOptions[ TOPTION_QUIET_DOCTORING ] = FALSE;
#ifdef USE_HIGHSPEED_GAMELOOP_TIMER
gGameSettings.fOptions[ TOPTION_AUTO_FAST_FORWARD_MODE ] = FALSE; gGameSettings.fOptions[ TOPTION_AUTO_FAST_FORWARD_MODE ] = FALSE;
#endif
gGameSettings.fOptions[ TOPTION_ZOMBIES ] = FALSE; // Flugente Zombies 1.0 gGameSettings.fOptions[ TOPTION_ZOMBIES ] = FALSE; // Flugente Zombies 1.0
@@ -1794,6 +1807,7 @@ void LoadGameExternalOptions()
gGameExternalOptions.fEnableInventoryPoolQ = FALSE; gGameExternalOptions.fEnableInventoryPoolQ = FALSE;
#endif #endif
#ifdef USE_HIGHSPEED_GAMELOOP_TIMER
////////// CLOCK SETTINGS ////////// ////////// CLOCK SETTINGS //////////
// Key to artificially alter the clock so turns run faster // 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.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.fClockSpeedPercent = (FLOAT)iniReader.ReadDouble("Clock Settings","CLOCK_SPEED_PERCENT", 150, 100, 300);
gGameExternalOptions.iNotifyFrequency = iniReader.ReadInteger("Clock Settings","UPDATE_FREQUENCY", 16000, 1000, 20000); 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_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_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 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 TOPTION_AUTO_FAST_FORWARD_MODE, // automatically fast forward through AI turns
#endif
TOPTION_ZOMBIES, // Flugente Zombies 1.0: allow zombies TOPTION_ZOMBIES, // Flugente Zombies 1.0: allow zombies
// arynn: Debug/Cheat // arynn: Debug/Cheat
@@ -1083,6 +1087,7 @@ typedef struct
INT32 iInitialMercArrivalLocation; INT32 iInitialMercArrivalLocation;
#ifdef USE_HIGHSPEED_GAMELOOP_TIMER
// Keyboard shortcut (as VK) for fastforward key. See Utils/KeyMap // Keyboard shortcut (as VK) for fastforward key. See Utils/KeyMap
INT32 iFastForwardKey; INT32 iFastForwardKey;
// Turn on fast forward whenever ui is disabled. // Turn on fast forward whenever ui is disabled.
@@ -1093,6 +1098,7 @@ typedef struct
INT32 iNotifyFrequency; INT32 iNotifyFrequency;
// Frequency that the screen is updated // Frequency that the screen is updated
FLOAT fClockSpeedPercent; FLOAT fClockSpeedPercent;
#endif
// Flugente FTW 1: Weapon Overheating // Flugente FTW 1: Weapon Overheating
BOOLEAN fDisplayOverheatThermometer; // Should a 'thermometer' for guns and replacable barrels be displayed? BOOLEAN fDisplayOverheatThermometer; // Should a 'thermometer' for guns and replacable barrels be displayed?
+9 -9
View File
@@ -15,9 +15,9 @@
#ifdef JA2EDITOR #ifdef JA2EDITOR
#ifdef JA2UB #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 #else
CHAR16 zVersionLabel[256] = { L"Map Editor v1.13.5353 (Development Build)" }; CHAR16 zVersionLabel[256] = { L"Map Editor v1.13.5354 (Development Build)" };
#endif #endif
// ------------------------------ // ------------------------------
@@ -27,11 +27,11 @@
//DEBUG BUILD VERSION //DEBUG BUILD VERSION
#ifdef JA2UB #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) #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 #else
CHAR16 zVersionLabel[256] = { L"Debug: v1.13.5353 (Development Build)" }; CHAR16 zVersionLabel[256] = { L"Debug: v1.13.5354 (Development Build)" };
#endif #endif
#elif defined CRIPPLED_VERSION #elif defined CRIPPLED_VERSION
@@ -46,16 +46,16 @@
//RELEASE BUILD VERSION //RELEASE BUILD VERSION
#ifdef JA2UB #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) #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 #else
CHAR16 zVersionLabel[256] = { L"Release v1.13.5353 (Development Build)" }; CHAR16 zVersionLabel[256] = { L"Release v1.13.5354 (Development Build)" };
#endif #endif
#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" }; CHAR16 zTrackingNumber[16] = { L"Z" };
// SAVE_GAME_VERSION is defined in header, change it there // SAVE_GAME_VERSION is defined in header, change it there
+5
View File
@@ -5020,7 +5020,12 @@ void HandleAimMemberKeyBoardInput()
{ {
InputAtom InputEvent; InputAtom InputEvent;
#ifdef USE_HIGHSPEED_GAMELOOP_TIMER
while (DequeueSpecificEvent(&InputEvent, KEY_DOWN|KEY_UP|KEY_REPEAT)) while (DequeueSpecificEvent(&InputEvent, KEY_DOWN|KEY_UP|KEY_REPEAT))
#else
while (DequeueEvent(&InputEvent) == TRUE)
#endif
{//!HandleTextInput( &InputEvent ) && {//!HandleTextInput( &InputEvent ) &&
if( InputEvent.usEvent == KEY_DOWN ) if( InputEvent.usEvent == KEY_DOWN )
{ {
+2
View File
@@ -4053,10 +4053,12 @@ void HandleBobbyRGunsKeyBoardInput()
break; break;
} }
} }
#ifdef USE_HIGHSPEED_GAMELOOP_TIMER
else else
{ {
extern void HandleDefaultEvent(InputAtom *Event); extern void HandleDefaultEvent(InputAtom *Event);
HandleDefaultEvent(&InputEvent); HandleDefaultEvent(&InputEvent);
} }
#endif
} }
} }
+4
View File
@@ -426,7 +426,11 @@ void GetPlayerKeyBoardInputForBriefingRoomHomePage( void )
GetCursorPos(&MousePos); GetCursorPos(&MousePos);
ScreenToClient(ghWindow, &MousePos); // In window coords! ScreenToClient(ghWindow, &MousePos); // In window coords!
#ifdef USE_HIGHSPEED_GAMELOOP_TIMER
while (DequeueSpecificEvent(&InputEvent, KEY_DOWN|KEY_UP|KEY_REPEAT)) while (DequeueSpecificEvent(&InputEvent, KEY_DOWN|KEY_UP|KEY_REPEAT))
#else
while (DequeueEvent(&InputEvent) == TRUE)
#endif
{ {
// HOOK INTO MOUSE HOOKS // HOOK INTO MOUSE HOOKS
/* /*
+4
View File
@@ -493,7 +493,11 @@ void GetPlayerKeyBoardInputForBriefingRoomEnterHomePage( void )
GetCursorPos(&MousePos); GetCursorPos(&MousePos);
ScreenToClient(ghWindow, &MousePos); // In window coords! ScreenToClient(ghWindow, &MousePos); // In window coords!
#ifdef USE_HIGHSPEED_GAMELOOP_TIMER
while (DequeueSpecificEvent(&InputEvent, KEY_DOWN|KEY_UP|KEY_REPEAT)) while (DequeueSpecificEvent(&InputEvent, KEY_DOWN|KEY_UP|KEY_REPEAT))
#else
while (DequeueEvent(&InputEvent) == TRUE)
#endif
{ {
// HOOK INTO MOUSE HOOKS // HOOK INTO MOUSE HOOKS
/* /*
+4
View File
@@ -455,7 +455,11 @@ void GetPlayerKeyBoardInputForIMPBeginScreen( void )
ScreenToClient(ghWindow, &MousePos); // In window coords! ScreenToClient(ghWindow, &MousePos); // In window coords!
// handle input events // handle input events
#ifdef USE_HIGHSPEED_GAMELOOP_TIMER
while (DequeueSpecificEvent(&InputEvent, KEY_DOWN|KEY_UP|KEY_REPEAT)) 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) ) if( !HandleTextInput( &InputEvent ) && (InputEvent.usEvent == KEY_DOWN || InputEvent.usEvent == KEY_REPEAT) )
{ {
+4
View File
@@ -266,7 +266,11 @@ void GetPlayerKeyBoardInputForIMPHomePage( void )
GetCursorPos(&MousePos); GetCursorPos(&MousePos);
ScreenToClient(ghWindow, &MousePos); // In window coords! ScreenToClient(ghWindow, &MousePos); // In window coords!
#ifdef USE_HIGHSPEED_GAMELOOP_TIMER
while (DequeueSpecificEvent(&InputEvent, KEY_DOWN|KEY_UP|KEY_REPEAT)) 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 ) ) 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; InputAtom InputEvent;
#ifdef USE_HIGHSPEED_GAMELOOP_TIMER
while (DequeueSpecificEvent(&InputEvent, KEY_DOWN|KEY_UP|KEY_REPEAT)) while (DequeueSpecificEvent(&InputEvent, KEY_DOWN|KEY_UP|KEY_REPEAT))
#else
while (DequeueEvent(&InputEvent) == TRUE)
#endif
{ {
if( !HandleTextInput( &InputEvent ) && InputEvent.usEvent == KEY_DOWN ) if( !HandleTextInput( &InputEvent ) && InputEvent.usEvent == KEY_DOWN )
{ {
Binary file not shown.
+4
View File
@@ -6419,7 +6419,11 @@ void HandlePersonnelKeyboard( void )
GetCursorPos(&MousePos); GetCursorPos(&MousePos);
ScreenToClient(ghWindow, &MousePos); // In window coords! ScreenToClient(ghWindow, &MousePos); // In window coords!
#ifdef USE_HIGHSPEED_GAMELOOP_TIMER
while (DequeueSpecificEvent(&InputEvent, KEY_DOWN|KEY_UP|KEY_REPEAT)) 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') ) 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 // carter, need key shortcuts for clearing up message boxes
// Check for esc // Check for esc
bool bHandled; bool bHandled;
#ifdef USE_HIGHSPEED_GAMELOOP_TIMER
while (DequeueSpecificEvent(&InputEvent, KEY_DOWN|KEY_UP|KEY_REPEAT)) while (DequeueSpecificEvent(&InputEvent, KEY_DOWN|KEY_UP|KEY_REPEAT))
#else
while (DequeueEvent(&InputEvent) == TRUE)
#endif
{ {
bHandled = false; bHandled = false;
if(InputEvent.usEvent == KEY_DOWN ) if(InputEvent.usEvent == KEY_DOWN )
+4
View File
@@ -418,7 +418,11 @@ void GetMPCScreenUserInput()
// GetCursorPos(&MousePos); // GetCursorPos(&MousePos);
#ifdef USE_HIGHSPEED_GAMELOOP_TIMER
while (DequeueSpecificEvent(&Event, KEY_DOWN|KEY_UP|KEY_REPEAT)) 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 // check if this event is swallowed by text input, otherwise process key
if( Event.usEvent == KEY_DOWN ) if( Event.usEvent == KEY_DOWN )
+4
View File
@@ -2740,7 +2740,11 @@ void GetMPHScreenUserInput()
// GetCursorPos(&MousePos); // GetCursorPos(&MousePos);
#ifdef USE_HIGHSPEED_GAMELOOP_TIMER
while (DequeueSpecificEvent(&Event, KEY_DOWN|KEY_UP|KEY_REPEAT)) 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 // check if this event is swallowed by text input, otherwise process key
if( !HandleTextInput( &Event ) && Event.usEvent == KEY_DOWN ) if( !HandleTextInput( &Event ) && Event.usEvent == KEY_DOWN )
+4
View File
@@ -665,7 +665,11 @@ void GetMPJScreenUserInput()
{ {
InputAtom Event; InputAtom Event;
#ifdef USE_HIGHSPEED_GAMELOOP_TIMER
while (DequeueSpecificEvent(&Event, KEY_DOWN|KEY_UP|KEY_REPEAT)) 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 // check if this event is swallowed by text input, otherwise process key
if( !HandleTextInput( &Event ) && Event.usEvent == KEY_DOWN ) if( !HandleTextInput( &Event ) && Event.usEvent == KEY_DOWN )
+4
View File
@@ -536,7 +536,11 @@ void GetMPSScreenUserInput()
{ {
InputAtom Event; InputAtom Event;
#ifdef USE_HIGHSPEED_GAMELOOP_TIMER
while (DequeueSpecificEvent(&Event, KEY_DOWN|KEY_UP|KEY_REPEAT)) 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 // check if this event is swallowed by text input, otherwise process key
if( !HandleTextInput( &Event ) && Event.usEvent == KEY_DOWN ) if( !HandleTextInput( &Event ) && Event.usEvent == KEY_DOWN )
+8
View File
@@ -484,7 +484,11 @@ void HandleMainMenuInput()
InputAtom InputEvent; InputAtom InputEvent;
// Check for esc // Check for esc
#ifdef USE_HIGHSPEED_GAMELOOP_TIMER
while (DequeueSpecificEvent(&InputEvent, KEY_DOWN|KEY_UP|KEY_REPEAT)) while (DequeueSpecificEvent(&InputEvent, KEY_DOWN|KEY_UP|KEY_REPEAT))
#else
while (DequeueEvent(&InputEvent) == TRUE)
#endif
{ {
if( InputEvent.usEvent == KEY_UP ) if( InputEvent.usEvent == KEY_UP )
{ {
@@ -533,7 +537,11 @@ void HandleHelpScreenInput()
InputAtom InputEvent; InputAtom InputEvent;
// Check for key // Check for key
#ifdef USE_HIGHSPEED_GAMELOOP_TIMER
while (DequeueSpecificEvent(&InputEvent, KEY_DOWN|KEY_UP|KEY_REPEAT)) while (DequeueSpecificEvent(&InputEvent, KEY_DOWN|KEY_UP|KEY_REPEAT))
#else
while (DequeueEvent(&InputEvent) == TRUE)
#endif
{ {
switch( InputEvent.usEvent ) switch( InputEvent.usEvent )
{ {
+4
View File
@@ -1306,7 +1306,11 @@ UINT32 MessageBoxScreenHandle( )
// carter, need key shortcuts for clearing up message boxes // carter, need key shortcuts for clearing up message boxes
// Check for esc // Check for esc
#ifdef USE_HIGHSPEED_GAMELOOP_TIMER
while (DequeueSpecificEvent(&InputEvent, KEY_DOWN|KEY_UP|KEY_REPEAT)) while (DequeueSpecificEvent(&InputEvent, KEY_DOWN|KEY_UP|KEY_REPEAT))
#else
while (DequeueEvent(&InputEvent) == TRUE)
#endif
{ {
if( !HandleTextInput( &InputEvent ) && InputEvent.usEvent == KEY_DOWN ) if( !HandleTextInput( &InputEvent ) && InputEvent.usEvent == KEY_DOWN )
{ {
Binary file not shown.
+2
View File
@@ -3937,7 +3937,9 @@ BOOLEAN LoadSavedGame( int ubSavedGameID )
ShutdownNPCQuotes(); ShutdownNPCQuotes();
#ifdef USE_HIGHSPEED_GAMELOOP_TIMER
SetFastForwardMode(FALSE); // FF can sometimes be active if quick-load during AI turn transition SetFastForwardMode(FALSE); // FF can sometimes be active if quick-load during AI turn transition
#endif
//very small TODO //very small TODO
//Bugfix = Stop the chopter sound //Bugfix = Stop the chopter sound
+40
View File
@@ -111,7 +111,9 @@ BOOLEAN gfCurrentStringInputState;
StringInput *gpCurrentStringDescriptor; StringInput *gpCurrentStringDescriptor;
// Thread // Thread
#ifdef USE_HIGHSPEED_GAMELOOP_TIMER
static CRITICAL_SECTION gcsInputQueueLock; static CRITICAL_SECTION gcsInputQueueLock;
#endif
// Local function headers // Local function headers
@@ -280,7 +282,9 @@ BOOLEAN InitializeInputManager(void)
// ghKeyboardHook = SetWindowsHookEx(WH_KEYBOARD, (HOOKPROC) KeyboardHandler, (HINSTANCE) 0, GetCurrentThreadId()); // ghKeyboardHook = SetWindowsHookEx(WH_KEYBOARD, (HOOKPROC) KeyboardHandler, (HINSTANCE) 0, GetCurrentThreadId());
// DbgMessage(TOPIC_INPUT, DBG_LEVEL_2, String("Set keyboard hook returned %d", ghKeyboardHook)); // DbgMessage(TOPIC_INPUT, DBG_LEVEL_2, String("Set keyboard hook returned %d", ghKeyboardHook));
#ifdef USE_HIGHSPEED_GAMELOOP_TIMER
InitializeCriticalSection(&gcsInputQueueLock); InitializeCriticalSection(&gcsInputQueueLock);
#endif
ghMouseHook = SetWindowsHookEx(WH_MOUSE, (HOOKPROC) MouseHandler, (HINSTANCE) 0, GetCurrentThreadId()); ghMouseHook = SetWindowsHookEx(WH_MOUSE, (HOOKPROC) MouseHandler, (HINSTANCE) 0, GetCurrentThreadId());
DbgMessage(TOPIC_INPUT, DBG_LEVEL_2, String("Set mouse hook returned %d", ghMouseHook)); 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"); UnRegisterDebugTopic(TOPIC_INPUT, "Input Manager");
// UnhookWindowsHookEx(ghKeyboardHook); // UnhookWindowsHookEx(ghKeyboardHook);
UnhookWindowsHookEx(ghMouseHook); UnhookWindowsHookEx(ghMouseHook);
#ifdef USE_HIGHSPEED_GAMELOOP_TIMER
DeleteCriticalSection(&gcsInputQueueLock); DeleteCriticalSection(&gcsInputQueueLock);
#endif
} }
void QueuePureEvent(UINT16 ubInputEvent, UINT32 usParam, UINT32 uiParam) void QueuePureEvent(UINT16 ubInputEvent, UINT32 usParam, UINT32 uiParam)
@@ -335,7 +343,11 @@ void QueuePureEvent(UINT16 ubInputEvent, UINT32 usParam, UINT32 uiParam)
} }
} }
#ifdef USE_HIGHSPEED_GAMELOOP_TIMER
void InternalQueueEvent(UINT16 ubInputEvent, UINT32 usParam, UINT32 uiParam) void InternalQueueEvent(UINT16 ubInputEvent, UINT32 usParam, UINT32 uiParam)
#else
void QueueEvent(UINT16 ubInputEvent, UINT32 usParam, UINT32 uiParam)
#endif
{ {
UINT32 uiTimer; UINT32 uiTimer;
UINT16 usKeyState; UINT16 usKeyState;
@@ -458,6 +470,7 @@ void InternalQueueEvent(UINT16 ubInputEvent, UINT32 usParam, UINT32 uiParam)
} }
} }
#ifdef USE_HIGHSPEED_GAMELOOP_TIMER
void QueueEvent(UINT16 ubInputEvent, UINT32 usParam, UINT32 uiParam) void QueueEvent(UINT16 ubInputEvent, UINT32 usParam, UINT32 uiParam)
{ {
EnterCriticalSection(&gcsInputQueueLock); EnterCriticalSection(&gcsInputQueueLock);
@@ -467,7 +480,9 @@ void QueueEvent(UINT16 ubInputEvent, UINT32 usParam, UINT32 uiParam)
LeaveCriticalSection(&gcsInputQueueLock); LeaveCriticalSection(&gcsInputQueueLock);
} }
} }
#endif
#ifdef USE_HIGHSPEED_GAMELOOP_TIMER
BOOLEAN DequeueSpecificEvent(InputAtom *Event, UINT32 uiMaskFlags ) BOOLEAN DequeueSpecificEvent(InputAtom *Event, UINT32 uiMaskFlags )
{ {
EnterCriticalSection(&gcsInputQueueLock); EnterCriticalSection(&gcsInputQueueLock);
@@ -492,8 +507,30 @@ BOOLEAN DequeueSpecificEvent(InputAtom *Event, UINT32 uiMaskFlags )
LeaveCriticalSection(&gcsInputQueueLock); LeaveCriticalSection(&gcsInputQueueLock);
} }
} }
#else
BOOLEAN DequeueSpecificEvent(InputAtom *Event, UINT32 uiMaskFlags )
{
// 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 );
}
#endif
#ifdef USE_HIGHSPEED_GAMELOOP_TIMER
BOOLEAN InternalDequeueEvent(InputAtom *Event) BOOLEAN InternalDequeueEvent(InputAtom *Event)
#else
BOOLEAN DequeueEvent(InputAtom *Event)
#endif
{ {
HandleSingleClicksAndButtonRepeats( ); HandleSingleClicksAndButtonRepeats( );
@@ -524,6 +561,8 @@ BOOLEAN InternalDequeueEvent(InputAtom *Event)
return FALSE; return FALSE;
} }
} }
#ifdef USE_HIGHSPEED_GAMELOOP_TIMER
BOOLEAN DequeueEvent(InputAtom *Event) BOOLEAN DequeueEvent(InputAtom *Event)
{ {
__try __try
@@ -536,6 +575,7 @@ BOOLEAN DequeueEvent(InputAtom *Event)
LeaveCriticalSection(&gcsInputQueueLock); LeaveCriticalSection(&gcsInputQueueLock);
} }
} }
#endif
void KeyChange(UINT32 usParam, UINT32 uiParam, UINT8 ufKeyState) void KeyChange(UINT32 usParam, UINT32 uiParam, UINT8 ufKeyState)
{ {
+47 -7
View File
@@ -56,8 +56,8 @@
#define USE_CONSOLE 0 #define USE_CONSOLE 0
#include <iostream> #include <iostream>
#include <excpt.h> #include <excpt.h>
#include "ExceptionHandling.h" #include "ExceptionHandling.h"
#include "dbt.h" #include "dbt.h"
@@ -146,16 +146,18 @@ extern BOOLEAN CheckIfGameCdromIsInCDromDrive();
extern void QueueEvent(UINT16 ubInputEvent, UINT32 usParam, UINT32 uiParam); extern void QueueEvent(UINT16 ubInputEvent, UINT32 usParam, UINT32 uiParam);
// Prototype Declarations // 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); INT32 FAR PASCAL WindowProcedure(HWND hWindow, UINT16 Message, WPARAM wParam, LPARAM lParam);
BOOLEAN InitializeStandardGamingPlatform(HINSTANCE hInstance, int sCommandShow); BOOLEAN InitializeStandardGamingPlatform(HINSTANCE hInstance, int sCommandShow);
void ShutdownStandardGamingPlatform(void); void ShutdownStandardGamingPlatform(void);
void CreateStandardGamingPlatform(HWND hWindow);
void GetRuntimeSettings( ); void GetRuntimeSettings( );
void SafeSGPExit(void);
#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 bool CallGameLoop(bool wait);
static CRITICAL_SECTION gcsGameLoop; static CRITICAL_SECTION gcsGameLoop;
#endif
int PASCAL HandledWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR pCommandLine, int sCommandShow); int PASCAL HandledWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR pCommandLine, int sCommandShow);
@@ -214,6 +216,7 @@ BOOLEAN gfIgnoreMessages=FALSE;
// GLOBAL VARIBLE, SET TO DEFAULT BUT CAN BE CHANGED BY THE GAME IF INIT FILE READ // GLOBAL VARIBLE, SET TO DEFAULT BUT CAN BE CHANGED BY THE GAME IF INIT FILE READ
UINT8 gbPixelDepth = PIXEL_DEPTH; UINT8 gbPixelDepth = PIXEL_DEPTH;
#ifdef USE_HIGHSPEED_GAMELOOP_TIMER
INT32 FAR PASCAL SyncWindowProcedure(HWND hWindow, UINT16 Message, WPARAM wParam, LPARAM lParam) INT32 FAR PASCAL SyncWindowProcedure(HWND hWindow, UINT16 Message, WPARAM wParam, LPARAM lParam)
{ {
INT32 retval; INT32 retval;
@@ -222,6 +225,7 @@ INT32 FAR PASCAL SyncWindowProcedure(HWND hWindow, UINT16 Message, WPARAM wParam
LeaveCriticalSection(&gcsGameLoop); LeaveCriticalSection(&gcsGameLoop);
return retval; return retval;
} }
#endif
bool s_bExportStrings = false; bool s_bExportStrings = false;
extern bool g_bUseXML_Strings;// = false; extern bool g_bUseXML_Strings;// = false;
@@ -531,7 +535,10 @@ INT32 FAR PASCAL WindowProcedure(HWND hWindow, UINT16 Message, WPARAM wParam, LP
break; break;
case WM_CREATE: case WM_CREATE:
#ifdef USE_HIGHSPEED_GAMELOOP_TIMER
CreateStandardGamingPlatform(hWindow); CreateStandardGamingPlatform(hWindow);
#endif
break; break;
case WM_DESTROY: case WM_DESTROY:
@@ -660,7 +667,11 @@ BOOLEAN InitializeStandardGamingPlatform(HINSTANCE hInstance, int sCommandShow)
FontTranslationTable *pFontTable; FontTranslationTable *pFontTable;
// now required by all (even JA2) in order to call ShutdownSGP // now required by all (even JA2) in order to call ShutdownSGP
#ifdef USE_HIGHSPEED_GAMELOOP_TIMER
atexit(SafeSGPExit); atexit(SafeSGPExit);
#else
atexit(SGPExit);
#endif
// First, initialize the registry keys. // First, initialize the registry keys.
InitializeRegistryKeys( "Wizardry8", "Wizardry8key" ); InitializeRegistryKeys( "Wizardry8", "Wizardry8key" );
@@ -721,7 +732,9 @@ BOOLEAN InitializeStandardGamingPlatform(HINSTANCE hInstance, int sCommandShow)
return FALSE; return FALSE;
} }
#ifdef USE_HIGHSPEED_GAMELOOP_TIMER
InitializeCriticalSection(&gcsGameLoop); InitializeCriticalSection(&gcsGameLoop);
#endif
FastDebugMsg("Initializing Video Manager"); FastDebugMsg("Initializing Video Manager");
// Initialize DirectDraw (DirectX 2) // Initialize DirectDraw (DirectX 2)
@@ -748,6 +761,11 @@ BOOLEAN InitializeStandardGamingPlatform(HINSTANCE hInstance, int sCommandShow)
return FALSE; return FALSE;
} }
#ifdef USE_HIGHSPEED_GAMELOOP_TIMER
#else
InitializeJA2Clock();
#endif
//InitializeJA2TimerID(); //InitializeJA2TimerID();
#ifdef USE_VFS #ifdef USE_VFS
@@ -897,6 +915,7 @@ BOOLEAN InitializeStandardGamingPlatform(HINSTANCE hInstance, int sCommandShow)
return TRUE; 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)
@@ -915,6 +934,7 @@ void CreateStandardGamingPlatform(HWND hWindow)
else else
AddTimerNotifyCallback(TimerActivatedCallback, hWindow); AddTimerNotifyCallback(TimerActivatedCallback, hWindow);
} }
#endif
void ShutdownStandardGamingPlatform(void) void ShutdownStandardGamingPlatform(void)
{ {
@@ -938,7 +958,10 @@ void ShutdownStandardGamingPlatform(void)
// //
// Shut down the different components of the SGP // Shut down the different components of the SGP
// //
#ifdef USE_HIGHSPEED_GAMELOOP_TIMER
ClearTimerNotifyCallbacks(); ClearTimerNotifyCallbacks();
#endif
// TEST // TEST
SoundServiceStreams(); SoundServiceStreams();
@@ -986,7 +1009,9 @@ void ShutdownStandardGamingPlatform(void)
// down the debugging layer // down the debugging layer
UnRegisterDebugTopic(TOPIC_SGP, "Standard Gaming Platform"); UnRegisterDebugTopic(TOPIC_SGP, "Standard Gaming Platform");
#ifdef USE_HIGHSPEED_GAMELOOP_TIMER
DeleteCriticalSection(&gcsGameLoop); DeleteCriticalSection(&gcsGameLoop);
#endif
ShutdownDebugManager(); ShutdownDebugManager();
@@ -1252,6 +1277,12 @@ int PASCAL HandledWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR pC
FastDebugMsg("Running Game"); 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 // 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 // attend to the gaming mechanics themselves
Message.wParam = 0; Message.wParam = 0;
@@ -1325,6 +1356,11 @@ int PASCAL HandledWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR pC
} }
#endif #endif
#ifdef USE_HIGHSPEED_GAMELOOP_TIMER
#else
KillTimer( ghWindow, uiTimer);
#endif
// This is the normal exit point // This is the normal exit point
FastDebugMsg("Exiting Game"); FastDebugMsg("Exiting Game");
PostQuitMessage(0); PostQuitMessage(0);
@@ -1685,12 +1721,15 @@ void GetRuntimeSettings( )
s_CodePage = oProps.getStringProperty(L"Ja2 Settings", L"CODE_PAGE"); s_CodePage = oProps.getStringProperty(L"Ja2 Settings", L"CODE_PAGE");
#endif // USE_CODE_PAGE #endif // USE_CODE_PAGE
#ifdef USE_HIGHSPEED_GAMELOOP_TIMER
// get timer/clock initialization state // get timer/clock initialization state
SetHiSpeedClockMode( oProps.getBoolProperty("Ja2 Settings", "HIGHSPEED_TIMER", false) ? TRUE : FALSE ); SetHiSpeedClockMode( oProps.getBoolProperty("Ja2 Settings", "HIGHSPEED_TIMER", false) ? TRUE : FALSE );
#endif #endif
#endif
} }
#ifdef USE_HIGHSPEED_GAMELOOP_TIMER
void SafeSGPExit(void) void SafeSGPExit(void)
{ {
// SGPExit tends to use resources that are already uninitialized so handle // SGPExit tends to use resources that are already uninitialized so handle
@@ -1704,7 +1743,7 @@ void SafeSGPExit(void)
// has failed so just ignore and continue silently // has failed so just ignore and continue silently
} }
} }
#endif
void ShutdownWithErrorBox(CHAR8 *pcMessage) void ShutdownWithErrorBox(CHAR8 *pcMessage)
{ {
@@ -1899,6 +1938,7 @@ static LONG __stdcall SGPExceptionFilter(int exceptionCount, EXCEPTION_POINTERS*
return EXCEPTION_EXECUTE_HANDLER; return EXCEPTION_EXECUTE_HANDLER;
} }
#ifdef USE_HIGHSPEED_GAMELOOP_TIMER
static void SGPGameLoop() static void SGPGameLoop()
{ {
try try
@@ -1964,4 +2004,4 @@ static bool CallGameLoop(bool wait)
return true; return true;
} }
#endif
+5
View File
@@ -932,7 +932,12 @@ void HandleViewerInput()
{ {
SECTORINFO *pSector; SECTORINFO *pSector;
InputAtom Event; InputAtom Event;
#ifdef USE_HIGHSPEED_GAMELOOP_TIMER
while( DequeueSpecificEvent(&Event, KEY_DOWN|KEY_UP) ) while( DequeueSpecificEvent(&Event, KEY_DOWN|KEY_UP) )
#else
while( DequeueEvent( &Event ) )
#endif
{ {
if( !HandleTextInput( &Event ) && Event.usEvent == KEY_DOWN ) if( !HandleTextInput( &Event ) && Event.usEvent == KEY_DOWN )
{ {
+5
View File
@@ -3410,7 +3410,12 @@ DebugMsg (TOPIC_JA2,DBG_LEVEL_3,"Autoresolve3");
InputAtom InputEvent; InputAtom InputEvent;
BOOLEAN fResetAutoResolve = FALSE; BOOLEAN fResetAutoResolve = FALSE;
#ifdef USE_HIGHSPEED_GAMELOOP_TIMER
while( DequeueSpecificEvent(&InputEvent, KEY_DOWN|KEY_UP|KEY_REPEAT) ) while( DequeueSpecificEvent(&InputEvent, KEY_DOWN|KEY_UP|KEY_REPEAT) )
#else
while( DequeueEvent( &InputEvent ) )
#endif
{ {
if( InputEvent.usEvent == KEY_DOWN || InputEvent.usEvent == KEY_REPEAT ) if( InputEvent.usEvent == KEY_DOWN || InputEvent.usEvent == KEY_REPEAT )
{ {
+4
View File
@@ -1311,7 +1311,11 @@ void GetUserInput()
GetCursorPos(&MousePos); GetCursorPos(&MousePos);
ScreenToClient(ghWindow, &MousePos); // In window coords! ScreenToClient(ghWindow, &MousePos); // In window coords!
#ifdef USE_HIGHSPEED_GAMELOOP_TIMER
while( DequeueSpecificEvent(&Event, KEY_DOWN|KEY_UP|KEY_REPEAT) ) while( DequeueSpecificEvent(&Event, KEY_DOWN|KEY_UP|KEY_REPEAT) )
#else
while( DequeueEvent( &Event ) )
#endif
{ {
if( !HandleTextInput( &Event ) && Event.usEvent == KEY_DOWN ) 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 ) void GetMapKeyboardInput( UINT32 *puiNewEvent )
{ {
InputAtom InputEvent; InputAtom InputEvent;
POINT MousePos;
INT8 bSquadNumber; INT8 bSquadNumber;
UINT8 ubGroupId = 0; UINT8 ubGroupId = 0;
BOOLEAN fCtrl, fAlt; BOOLEAN fCtrl, fAlt;
@@ -6822,9 +6823,37 @@ void GetMapKeyboardInput( UINT32 *puiNewEvent )
fCtrl = _KeyDown( CTRL ); fCtrl = _KeyDown( CTRL );
fAlt = _KeyDown( ALT ); fAlt = _KeyDown( ALT );
// while( DequeueEvent( &InputEvent ) ) 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
{ {
#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( InputEvent.usEvent == KEY_DOWN )
{ {
// if game is paused because of player, unpause with any key // if game is paused because of player, unpause with any key
+4
View File
@@ -279,7 +279,11 @@ BOOLEAN HandleAutoBandage( )
// Deque all game events // Deque all game events
DequeAllGameEvents( TRUE ); DequeAllGameEvents( TRUE );
#ifdef USE_HIGHSPEED_GAMELOOP_TIMER
while (DequeueSpecificEvent(&InputEvent, KEY_DOWN|KEY_UP|KEY_REPEAT)) while (DequeueSpecificEvent(&InputEvent, KEY_DOWN|KEY_UP|KEY_REPEAT))
#else
while (DequeueEvent(&InputEvent) == TRUE)
#endif
{ {
if ( InputEvent.usEvent == KEY_UP ) if ( InputEvent.usEvent == KEY_UP )
{ {
+4
View File
@@ -1738,7 +1738,11 @@ void GetShopKeeperInterfaceUserInput()
GetCursorPos(&MousePos); GetCursorPos(&MousePos);
ScreenToClient(ghWindow, &MousePos); // In window coords! ScreenToClient(ghWindow, &MousePos); // In window coords!
#ifdef USE_HIGHSPEED_GAMELOOP_TIMER
while (DequeueSpecificEvent(&Event, KEY_DOWN|KEY_UP|KEY_REPEAT)) while (DequeueSpecificEvent(&Event, KEY_DOWN|KEY_UP|KEY_REPEAT))
#else
while( DequeueEvent( &Event ) )
#endif
{ {
// HOOK INTO MOUSE HOOKS // HOOK INTO MOUSE HOOKS
/* removed warning condition C4060 (jonathanl) /* removed warning condition C4060 (jonathanl)
+4
View File
@@ -620,7 +620,11 @@ void RenderSectorExitMenu( )
gsGlobalCursorYOffset = 0; gsGlobalCursorYOffset = 0;
SetCurrentCursorFromDatabase( CURSOR_NORMAL ); SetCurrentCursorFromDatabase( CURSOR_NORMAL );
#ifdef USE_HIGHSPEED_GAMELOOP_TIMER
while (DequeueSpecificEvent(&Event, KEY_DOWN|KEY_UP|KEY_REPEAT)) while (DequeueSpecificEvent(&Event, KEY_DOWN|KEY_UP|KEY_REPEAT))
#else
while( DequeueEvent( &Event ) )
#endif
{ {
if( Event.usEvent == KEY_DOWN ) if( Event.usEvent == KEY_DOWN )
{ {
+2
View File
@@ -151,7 +151,9 @@ void HandleTacticalEndTurn( )
// OK, Do a number of things here.... // OK, Do a number of things here....
// Every few turns...... // Every few turns......
#ifdef USE_HIGHSPEED_GAMELOOP_TIMER
SetFastForwardMode(FALSE); // Cancel FF at end of battle SetFastForwardMode(FALSE); // Cancel FF at end of battle
#endif
// Get time elasped // Get time elasped
uiTime = GetWorldTotalSeconds( ); uiTime = GetWorldTotalSeconds( );
+9
View File
@@ -167,7 +167,10 @@ void StartPlayerTeamTurn( BOOLEAN fDoBattleSnd, BOOLEAN fEnteringCombatMode )
DebugMsg (TOPIC_JA2INTERRUPT,DBG_LEVEL_3,"StartPlayerTeamTurn"); DebugMsg (TOPIC_JA2INTERRUPT,DBG_LEVEL_3,"StartPlayerTeamTurn");
// SOLDIERTYPE *pSoldier; // SOLDIERTYPE *pSoldier;
// EV_S_BEGINTURN SBeginTurn; // EV_S_BEGINTURN SBeginTurn;
#ifdef USE_HIGHSPEED_GAMELOOP_TIMER
SetFastForwardMode(FALSE); SetFastForwardMode(FALSE);
#endif
// Start the turn of player charactors // Start the turn of player charactors
@@ -496,6 +499,7 @@ void BeginTeamTurn( UINT8 ubTeam )
if( !LightningEndOfTurn( ubTeam ) )return; if( !LightningEndOfTurn( ubTeam ) )return;
//end rain //end rain
#ifdef USE_HIGHSPEED_GAMELOOP_TIMER
// disable for our turn and enable for other teams // disable for our turn and enable for other teams
if ( gGameSettings.fOptions[TOPTION_AUTO_FAST_FORWARD_MODE] ) if ( gGameSettings.fOptions[TOPTION_AUTO_FAST_FORWARD_MODE] )
{ {
@@ -510,6 +514,7 @@ void BeginTeamTurn( UINT8 ubTeam )
SetFastForwardMode( (ubTeam != OUR_TEAM) ); SetFastForwardMode( (ubTeam != OUR_TEAM) );
} }
} }
#endif
while( 1 ) while( 1 )
{ {
@@ -837,7 +842,9 @@ void StartInterrupt( void )
INT32 iSquad, iCounter; INT32 iSquad, iCounter;
// disable ff mode // disable ff mode
#ifdef USE_HIGHSPEED_GAMELOOP_TIMER
SetFastForwardMode(FALSE); SetFastForwardMode(FALSE);
#endif
// build string for display of who gets interrupt // build string for display of who gets interrupt
//while( 1 ) //while( 1 )
@@ -1432,6 +1439,7 @@ void EndInterrupt( BOOLEAN fMarkInterruptOccurred )
} }
#ifdef USE_HIGHSPEED_GAMELOOP_TIMER
if ( gGameSettings.fOptions[TOPTION_AUTO_FAST_FORWARD_MODE] ) if ( gGameSettings.fOptions[TOPTION_AUTO_FAST_FORWARD_MODE] )
{ {
if (is_networked) if (is_networked)
@@ -1445,6 +1453,7 @@ void EndInterrupt( BOOLEAN fMarkInterruptOccurred )
SetFastForwardMode( (gTacticalStatus.ubCurrentTeam != OUR_TEAM) ); SetFastForwardMode( (gTacticalStatus.ubCurrentTeam != OUR_TEAM) );
} }
} }
#endif
} }
+4
View File
@@ -674,7 +674,11 @@ void HandleOverheadUI(void)
ScrollOverheadMap(); ScrollOverheadMap();
#ifdef USE_HIGHSPEED_GAMELOOP_TIMER
while(DequeueSpecificEvent(&InputEvent, KEY_DOWN|KEY_UP|KEY_REPEAT) == TRUE) 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) 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; INT32 cnt, iX, iY, iSubX1, iSubY1, iSubX2, iSubY2, iWindowX, iWindowY, iCount;
FLOAT dX, dY, dStartX, dStartY; FLOAT dX, dY, dStartX, dStartY;
#ifdef USE_HIGHSPEED_GAMELOOP_TIMER
while(DequeueSpecificEvent(&InputEvent, KEY_DOWN|KEY_UP) == TRUE) while(DequeueSpecificEvent(&InputEvent, KEY_DOWN|KEY_UP) == TRUE)
#else
while(DequeueEvent(&InputEvent) == TRUE)
#endif
{ {
if(InputEvent.usParam == ESC) if(InputEvent.usParam == ESC)
{ {
+182
View File
@@ -14,9 +14,13 @@
#include "worlddef.h" #include "worlddef.h"
#include "renderworld.h" #include "renderworld.h"
#include "interface control.h" #include "interface control.h"
#ifdef USE_HIGHSPEED_GAMELOOP_TIMER
#include "keymap.h" #include "keymap.h"
#endif #endif
#endif
#ifndef WIN32_LEAN_AND_MEAN #ifndef WIN32_LEAN_AND_MEAN
#define WIN32_LEAN_AND_MEAN #define WIN32_LEAN_AND_MEAN
#endif #endif
@@ -25,11 +29,13 @@
#include "connect.h" #include "connect.h"
// Base resolution of callback timer // Base resolution of callback timer
#ifdef USE_HIGHSPEED_GAMELOOP_TIMER
static INT32 BASETIMESLICE = 10; static INT32 BASETIMESLICE = 10;
const INT32 FASTFORWARDTIMESLICE = 1000; const INT32 FASTFORWARDTIMESLICE = 1000;
const UINT32 FREQUENCY_CONST = 1000000; const UINT32 FREQUENCY_CONST = 1000000;
static INT32 MIN_NOTIFY_TIME = 16000; static INT32 MIN_NOTIFY_TIME = 16000;
static INT32 UPDATETIMESLICE = 10000; static INT32 UPDATETIMESLICE = 10000;
#endif
INT32 giClockTimer = -1; INT32 giClockTimer = -1;
INT32 giTimerDiag = 0; INT32 giTimerDiag = 0;
@@ -38,6 +44,8 @@ UINT32 guiBaseJA2Clock = 0;
UINT32 guiBaseJA2NoPauseClock = 0; UINT32 guiBaseJA2NoPauseClock = 0;
BOOLEAN gfPauseClock = FALSE; BOOLEAN gfPauseClock = FALSE;
#ifdef USE_HIGHSPEED_GAMELOOP_TIMER
BOOLEAN gfHispeedClockMode = FALSE; BOOLEAN gfHispeedClockMode = FALSE;
const inline UINT32 TIME_US_TO_MS(UINT32 value) { return value / 1000; } const inline UINT32 TIME_US_TO_MS(UINT32 value) { return value / 1000; }
@@ -51,6 +59,7 @@ FLOAT gfClockSpeedPercent = 1.0;
LARGE_INTEGER gliPerfFreq = {0}; LARGE_INTEGER gliPerfFreq = {0};
LARGE_INTEGER gliPerfCount = {0}; LARGE_INTEGER gliPerfCount = {0};
LARGE_INTEGER gliPerfCountNext = {0}; LARGE_INTEGER gliPerfCountNext = {0};
#endif
INT32 giTimerIntervals[ NUMTIMERS ] = INT32 giTimerIntervals[ NUMTIMERS ] =
{ {
@@ -95,6 +104,8 @@ CUSTOMIZABLE_TIMER_CALLBACK gpCustomizableTimerCallback = NULL;
// Clock Callback event ID // Clock Callback event ID
MMRESULT gTimerID; MMRESULT gTimerID;
#ifdef USE_HIGHSPEED_GAMELOOP_TIMER
TIMECAPS gtc; TIMECAPS gtc;
HANDLE ghClockThread; HANDLE ghClockThread;
@@ -105,6 +116,7 @@ HANDLE ghNotifyThread;
DWORD gdwNotifyThreadId; DWORD gdwNotifyThreadId;
HANDLE ghNotifyThreadEvent; HANDLE ghNotifyThreadEvent;
HANDLE ghNotifyThreadShutdownComplete; HANDLE ghNotifyThreadShutdownComplete;
#endif
// GLOBALS FOR CALLBACK // GLOBALS FOR CALLBACK
UINT32 gCNT; UINT32 gCNT;
@@ -129,6 +141,7 @@ extern INT32 giFlashContractBaseTime;
extern UINT32 guiFlashCursorBaseTime; extern UINT32 guiFlashCursorBaseTime;
extern INT32 giPotCharPathBaseTime; extern INT32 giPotCharPathBaseTime;
#ifdef USE_HIGHSPEED_GAMELOOP_TIMER
typedef void (*TIMER_NOTIFY_CALLBACK) ( INT32 timer, PTR state ); typedef void (*TIMER_NOTIFY_CALLBACK) ( INT32 timer, PTR state );
struct TIMER_NOTIFY_ITEM struct TIMER_NOTIFY_ITEM
{ {
@@ -145,12 +158,14 @@ static void BroadcastTimerNotify(INT32 );
static BOOLEAN UpdateTimeCounter( INT32 &counter, INT32 &iTimeLeft ); static BOOLEAN UpdateTimeCounter( INT32 &counter, INT32 &iTimeLeft );
static BOOLEAN UpdateCounter( INT32 counter, INT32 &iTimeLeft); static BOOLEAN UpdateCounter( INT32 counter, INT32 &iTimeLeft);
static void UpdateTimer(); static void UpdateTimer();
#endif
UINT32 InitializeJA2TimerCallback( UINT32 uiDelay, LPTIMECALLBACK TimerProc, UINT32 uiUser ); UINT32 InitializeJA2TimerCallback( UINT32 uiDelay, LPTIMECALLBACK TimerProc, UINT32 uiUser );
// CALLBACKS // CALLBACKS
void CALLBACK FlashItem( UINT uiID, UINT uiMsg, DWORD uiUser, DWORD uiDw1, DWORD uiDw2 ); void CALLBACK FlashItem( UINT uiID, UINT uiMsg, DWORD uiUser, DWORD uiDw1, DWORD uiDw2 );
#ifdef USE_HIGHSPEED_GAMELOOP_TIMER
void CALLBACK TimeProc( UINT uID, UINT uMsg, DWORD dwUser, DWORD dw1, DWORD dw2 ) void CALLBACK TimeProc( UINT uID, UINT uMsg, DWORD dwUser, DWORD dw1, DWORD dw2 )
{ {
static BOOLEAN fInFunction = FALSE; static BOOLEAN fInFunction = FALSE;
@@ -256,7 +271,88 @@ void CALLBACK TimeProc( UINT uID, UINT uMsg, DWORD dwUser, DWORD dw1, DWORD dw2
fInFunction = FALSE; fInFunction = FALSE;
} }
} }
#else
void CALLBACK TimeProc( UINT uID, UINT uMsg, DWORD dwUser, DWORD dw1, DWORD dw2 )
{
static BOOLEAN fInFunction = FALSE;
//SOLDIERTYPE *pSoldier;
if ( !fInFunction )
{
fInFunction = TRUE;
guiBaseJA2NoPauseClock += BASETIMESLICE;
if ( !gfPauseClock )
{
guiBaseJA2Clock += BASETIMESLICE;
for ( gCNT = 0; gCNT < NUMTIMERS; gCNT++ )
{
UPDATECOUNTER( gCNT );
}
// Update some specialized countdown timers...
UPDATETIMECOUNTER( giTimerAirRaidQuote );
UPDATETIMECOUNTER( giTimerAirRaidDiveStarted );
UPDATETIMECOUNTER( giTimerAirRaidUpdate );
UPDATETIMECOUNTER( giTimerTeamTurnUpdate );
if ( gpCustomizableTimerCallback )
{
UPDATETIMECOUNTER( giTimerCustomizable );
}
#ifndef BOUNDS_CHECKER
// If mapscreen...
if( guiTacticalInterfaceFlags & INTERFACE_MAPSCREEN )
{
// IN Mapscreen, loop through player's team.....
for ( gCNT = gTacticalStatus.Team[ gbPlayerNum ].bFirstID; gCNT <= gTacticalStatus.Team[ gbPlayerNum ].bLastID; gCNT++ )
{
gPSOLDIER = MercPtrs[ gCNT ];
UPDATETIMECOUNTER( gPSOLDIER->timeCounters.PortraitFlashCounter );
UPDATETIMECOUNTER( gPSOLDIER->timeCounters.PanelAnimateCounter );
}
}
else
{
// Set update flags for soldiers
////////////////////////////
for ( gCNT = 0; gCNT < guiNumMercSlots; gCNT++ )
{
gPSOLDIER = MercSlots[ gCNT ];
if ( gPSOLDIER != NULL )
{
UPDATETIMECOUNTER( gPSOLDIER->timeCounters.UpdateCounter );
UPDATETIMECOUNTER( gPSOLDIER->timeCounters.DamageCounter );
UPDATETIMECOUNTER( gPSOLDIER->timeCounters.ReloadCounter );
UPDATETIMECOUNTER( gPSOLDIER->timeCounters.FlashSelCounter );
UPDATETIMECOUNTER( gPSOLDIER->timeCounters.BlinkSelCounter );
UPDATETIMECOUNTER( gPSOLDIER->timeCounters.PortraitFlashCounter );
UPDATETIMECOUNTER( gPSOLDIER->timeCounters.AICounter );
UPDATETIMECOUNTER( gPSOLDIER->timeCounters.FadeCounter );
UPDATETIMECOUNTER( gPSOLDIER->timeCounters.NextTileCounter );
UPDATETIMECOUNTER( gPSOLDIER->timeCounters.PanelAnimateCounter );
#ifdef JA2UB
UPDATETIMECOUNTER( gPSOLDIER->GetupFromJA25StartCounter );
#endif
}
}
}
#endif
}
fInFunction = FALSE;
}
}
#endif
#ifdef USE_HIGHSPEED_GAMELOOP_TIMER
static UINT32 MIN_TIMER(UINT32 timer, UINT32 other) static UINT32 MIN_TIMER(UINT32 timer, UINT32 other)
{ {
UINT32 value = TIME_MS_TO_US(timer); UINT32 value = TIME_MS_TO_US(timer);
@@ -332,7 +428,9 @@ DWORD WINAPI JA2NotifyThread( LPVOID lpParam )
SetEvent(ghNotifyThreadShutdownComplete); SetEvent(ghNotifyThreadShutdownComplete);
return 0L; return 0L;
} }
#endif
#ifdef USE_HIGHSPEED_GAMELOOP_TIMER
BOOLEAN InitializeJA2Clock() BOOLEAN InitializeJA2Clock()
{ {
#ifdef CALLBACKTIMER #ifdef CALLBACKTIMER
@@ -395,7 +493,47 @@ BOOLEAN InitializeJA2Clock()
return TRUE; return TRUE;
} }
#else
BOOLEAN InitializeJA2Clock(void)
{
#ifdef CALLBACKTIMER
MMRESULT mmResult;
TIMECAPS tc;
INT32 cnt;
// Init timer delays
for ( cnt = 0; cnt < NUMTIMERS; cnt++ )
{
giTimerCounters[ cnt ] = giTimerIntervals[ cnt ];
}
// First get timer resolutions
mmResult = timeGetDevCaps( &tc, sizeof( tc ) );
if ( mmResult != TIMERR_NOERROR )
{
DebugMsg( TOPIC_JA2, DBG_LEVEL_3, "Could not get timer properties");
}
// Set timer at lowest resolution. Could use middle of lowest/highest, we'll see how this performs first
gTimerID = timeSetEvent( BASETIMESLICE, BASETIMESLICE, TimeProc, (DWORD)0, TIME_PERIODIC );
if ( !gTimerID )
{
DebugMsg( TOPIC_JA2, DBG_LEVEL_3, "Could not create timer callback");
}
#endif
return TRUE;
}
#endif
#ifdef USE_HIGHSPEED_GAMELOOP_TIMER
void ShutdownJA2Clock(void) void ShutdownJA2Clock(void)
{ {
if (IsHiSpeedClockMode()) if (IsHiSpeedClockMode())
@@ -425,8 +563,20 @@ void ShutdownJA2Clock(void)
timeEndPeriod(gtc.wPeriodMin); timeEndPeriod(gtc.wPeriodMin);
} }
#else
void ShutdownJA2Clock(void)
{
// Make sure we kill the timer
#ifdef CALLBACKTIMER
timeKillEvent( gTimerID );
#endif
}
#endif
#ifdef USE_HIGHSPEED_GAMELOOP_TIMER
UINT32 InitializeJA2TimerCallback( UINT32 uiDelay, LPTIMECALLBACK TimerProc, UINT32 uiUser ) UINT32 InitializeJA2TimerCallback( UINT32 uiDelay, LPTIMECALLBACK TimerProc, UINT32 uiUser )
{ {
MMRESULT mmResult; MMRESULT mmResult;
@@ -451,6 +601,34 @@ UINT32 InitializeJA2TimerCallback( UINT32 uiDelay, LPTIMECALLBACK TimerProc, UIN
return ( (UINT32)TimerID ); return ( (UINT32)TimerID );
} }
#else
UINT32 InitializeJA2TimerCallback( UINT32 uiDelay, LPTIMECALLBACK TimerProc, UINT32 uiUser )
{
MMRESULT mmResult;
TIMECAPS tc;
MMRESULT TimerID;
// First get timer resolutions
mmResult = timeGetDevCaps( &tc, sizeof( tc ) );
if ( mmResult != TIMERR_NOERROR )
{
DebugMsg( TOPIC_JA2, DBG_LEVEL_3, "Could not get timer properties");
}
// Set timer at lowest resolution. Could use middle of lowest/highest, we'll see how this performs first
TimerID = timeSetEvent( (UINT)uiDelay, (UINT)uiDelay, TimerProc, (DWORD)uiUser, TIME_PERIODIC );
if ( !TimerID )
{
DebugMsg( TOPIC_JA2, DBG_LEVEL_3, "Could not create timer callback");
}
return ( (UINT32)TimerID );
}
#endif
void RemoveJA2TimerCallback( UINT32 uiTimer ) void RemoveJA2TimerCallback( UINT32 uiTimer )
@@ -550,6 +728,9 @@ void SetTileAnimCounter( INT32 iTime )
{ {
giTimerIntervals[ ANIMATETILES ] = iTime; giTimerIntervals[ ANIMATETILES ] = iTime;
} }
#ifdef USE_HIGHSPEED_GAMELOOP_TIMER
void SetFastForwardPeriod(DOUBLE value) void SetFastForwardPeriod(DOUBLE value)
{ {
giFastForwardPeriod = (UINT32)(value); giFastForwardPeriod = (UINT32)(value);
@@ -784,3 +965,4 @@ void UpdateTimer()
} }
} }
} }
#endif
+50
View File
@@ -54,6 +54,13 @@ enum
NUMTIMERS NUMTIMERS
}; };
#ifdef USE_HIGHSPEED_GAMELOOP_TIMER
#else
// Base resultion of callback timer
#define BASETIMESLICE 10
#endif
// TIMER INTERVALS // TIMER INTERVALS
extern INT32 giTimerIntervals[ NUMTIMERS ]; extern INT32 giTimerIntervals[ NUMTIMERS ];
// TIMER COUNTERS // TIMER COUNTERS
@@ -70,7 +77,10 @@ BOOLEAN InitializeJA2Clock( void );
void ShutdownJA2Clock( void ); void ShutdownJA2Clock( void );
#define GetJA2Clock() guiBaseJA2Clock #define GetJA2Clock() guiBaseJA2Clock
#ifdef USE_HIGHSPEED_GAMELOOP_TIMER
#define GetJA2NoPauseClock() guiBaseJA2NoPauseClock #define GetJA2NoPauseClock() guiBaseJA2NoPauseClock
#endif
UINT32 GetPauseJA2Clock( ); UINT32 GetPauseJA2Clock( );
@@ -82,6 +92,7 @@ void PauseTime( BOOLEAN fPaused );
void SetCustomizableTimerCallbackAndDelay( INT32 iDelay, CUSTOMIZABLE_TIMER_CALLBACK pCallback, BOOLEAN fReplace ); void SetCustomizableTimerCallbackAndDelay( INT32 iDelay, CUSTOMIZABLE_TIMER_CALLBACK pCallback, BOOLEAN fReplace );
void CheckCustomizableTimer( void ); void CheckCustomizableTimer( void );
#ifdef USE_HIGHSPEED_GAMELOOP_TIMER
void SetFastForwardPeriod(DOUBLE value); void SetFastForwardPeriod(DOUBLE value);
void SetFastForwardKey(INT32 key); void SetFastForwardKey(INT32 key);
BOOLEAN IsFastForwardKeyPressed(); BOOLEAN IsFastForwardKeyPressed();
@@ -98,12 +109,14 @@ BOOLEAN IsJA2TimerThread();
BOOLEAN IsHiSpeedClockMode(); BOOLEAN IsHiSpeedClockMode();
void SetHiSpeedClockMode(BOOLEAN enable); void SetHiSpeedClockMode(BOOLEAN enable);
#endif
//Don't modify this value //Don't modify this value
extern UINT32 guiBaseJA2Clock; extern UINT32 guiBaseJA2Clock;
extern UINT32 guiBaseJA2NoPauseClock; extern UINT32 guiBaseJA2NoPauseClock;
extern CUSTOMIZABLE_TIMER_CALLBACK gpCustomizableTimerCallback; extern CUSTOMIZABLE_TIMER_CALLBACK gpCustomizableTimerCallback;
#ifdef USE_HIGHSPEED_GAMELOOP_TIMER
typedef void (*TIMER_NOTIFY_CALLBACK) ( INT32 timer, PTR state ); typedef void (*TIMER_NOTIFY_CALLBACK) ( INT32 timer, PTR state );
void AddTimerNotifyCallback( TIMER_NOTIFY_CALLBACK callback, PTR state ); void AddTimerNotifyCallback( TIMER_NOTIFY_CALLBACK callback, PTR state );
void RemoveTimerNotifyCallback( TIMER_NOTIFY_CALLBACK callback, PTR state ); void RemoveTimerNotifyCallback( TIMER_NOTIFY_CALLBACK callback, PTR state );
@@ -125,6 +138,43 @@ void ZeroTimeCounter(INT32& timer);
#define TIMECOUNTERDONE(c, d) TimeCounterDone(c) #define TIMECOUNTERDONE(c, d) TimeCounterDone(c)
#define SYNCTIMECOUNTER( ) #define SYNCTIMECOUNTER( )
#define ZEROTIMECOUNTER(c) ZeroTimeCounter(c) #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 ); void SetTileAnimCounter( INT32 iTime );
#endif #endif
+4
View File
@@ -103,7 +103,11 @@
#include "vobject.h" #include "vobject.h"
#include "overhead types.h" #include "overhead types.h"
#include "tactical save.h" #include "tactical save.h"
#ifdef USE_HIGHSPEED_GAMELOOP_TIMER
#include "KeyMap.h" #include "KeyMap.h"
#endif
//#include <windows.h> //#include <windows.h>
//#include <windowsx.h> //#include <windowsx.h>
//#include <mmsystem.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 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 Repairing", // Madd: mercs don't say quotes while repairing //TODO.Translate
L"Quiet Doctoring", // Madd: mercs don't say quotes while doctoring //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 L"自动加速敌军回合", // Automatic fast forward through AI turns
#endif
L"Allow Zombies", // TODO.Translate L"Allow Zombies", // TODO.Translate
L"--作弊模式选项--", // TOPTION_CHEAT_MODE_OPTIONS_HEADER, L"--作弊模式选项--", // TOPTION_CHEAT_MODE_OPTIONS_HEADER,
L"强制 Bobby Ray 送货", // force all pending Bobby Ray shipments 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 training.", //TODO.Translate
L"When ON, mercs will not report progress during repairing.", // 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 L"When ON, mercs will not report progress during doctoring.", // TODO.Translate
#ifdef USE_HIGHSPEED_GAMELOOP_TIMER
L"打开时,敌军回合将被大幅加速。", L"打开时,敌军回合将被大幅加速。",
#endif
L"When ON, zombies will span. Be aware!", // allow zombies // TODO.Translate L"When ON, zombies will span. Be aware!", // allow zombies // TODO.Translate
L"(text not rendered)TOPTION_CHEAT_MODE_OPTIONS_HEADER", L"(text not rendered)TOPTION_CHEAT_MODE_OPTIONS_HEADER",
L"强制 Bobby Ray 出货", 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 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 Repairing", // Madd: mercs don't say quotes while repairing //TODO.Translate
L"Quiet Doctoring", // Madd: mercs don't say quotes while doctoring //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 L"Auto Fast Forward AI Turns", // Automatic fast forward through AI turns // TODO.Translate
#endif
L"Allow Zombies", // TODO.Translate L"Allow Zombies", // TODO.Translate
L"--Cheat Mode Options--", // TOPTION_CHEAT_MODE_OPTIONS_HEADER, L"--Cheat Mode Options--", // TOPTION_CHEAT_MODE_OPTIONS_HEADER,
L"Force Bobby Ray shipments", // force all pending Bobby Ray shipments 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 training.", //TODO.Translate
L"When ON, mercs will not report progress during repairing.", // 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 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 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"When ON, zombies will span. Be aware!", // allow zombies // TODO.Translate
L"(text not rendered)TOPTION_CHEAT_MODE_OPTIONS_HEADER", L"(text not rendered)TOPTION_CHEAT_MODE_OPTIONS_HEADER",
L"Force all pending Bobby Ray shipments", 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 Training", // Madd: mercs don't say quotes while training
L"Quiet Repairing", // Madd: mercs don't say quotes while repairing L"Quiet Repairing", // Madd: mercs don't say quotes while repairing
L"Quiet Doctoring", // Madd: mercs don't say quotes while doctoring 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 L"Auto Fast Forward AI Turns", // Automatic fast forward through AI turns
#endif
L"Allow Zombies", // Flugente Zombies 1.0 L"Allow Zombies", // Flugente Zombies 1.0
L"--Cheat Mode Options--", // TOPTION_CHEAT_MODE_OPTIONS_HEADER, L"--Cheat Mode Options--", // TOPTION_CHEAT_MODE_OPTIONS_HEADER,
L"Force Bobby Ray shipments", // force all pending Bobby Ray shipments 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 training.",
L"When ON, mercs will not report progress during repairing.", L"When ON, mercs will not report progress during repairing.",
L"When ON, mercs will not report progress during doctoring.", L"When ON, mercs will not report progress during doctoring.",
#ifdef USE_HIGHSPEED_GAMELOOP_TIMER
L"When ON, AI turns will be much faster.", L"When ON, AI turns will be much faster.",
#endif
L"When ON, zombies will spawn. Be aware!", // allow zombies L"When ON, zombies will spawn. Be aware!", // allow zombies
L"(text not rendered)TOPTION_CHEAT_MODE_OPTIONS_HEADER", L"(text not rendered)TOPTION_CHEAT_MODE_OPTIONS_HEADER",
L"Force all pending Bobby Ray shipments", 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 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 Repairing", // Madd: mercs don't say quotes while repairing //TODO.Translate
L"Quiet Doctoring", // Madd: mercs don't say quotes while doctoring //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 L"Auto Fast Forward AI Turns", // Automatic fast forward through AI turns // TODO.Translate
#endif
L"Allow Zombies", // Flugente Zombies 1.0 L"Allow Zombies", // Flugente Zombies 1.0
L"--Cheat Mode Options--", // TOPTION_CHEAT_MODE_OPTIONS_HEADER, L"--Cheat Mode Options--", // TOPTION_CHEAT_MODE_OPTIONS_HEADER,
L"Forcer envois Bobby Ray", // force all pending Bobby Ray shipments 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 training.",
L"When ON, mercs will not report progress during repairing.", // 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 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 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"When ON, zombies will span. Be aware!", // allow zombies // TODO.Translate
L"(text not rendered)TOPTION_CHEAT_MODE_OPTIONS_HEADER", L"(text not rendered)TOPTION_CHEAT_MODE_OPTIONS_HEADER",
L"Forcer tous les envois en attente de Bobby Ray", 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 Trainieren", // Madd: mercs don't say quotes while training
L"Stummes Reparieren", // Madd: mercs don't say quotes while repairing L"Stummes Reparieren", // Madd: mercs don't say quotes while repairing
L"Stumme Behandlung", // Madd: mercs don't say quotes while doctoring 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 L"Autom. schnelle Gegner-Züge", // Automatic fast forward through AI turns
#endif
L"Allow Zombies", // Flugente Zombies 1.0 L"Allow Zombies", // Flugente Zombies 1.0
L"--Cheat Mode Options--", // TOPTION_CHEAT_MODE_OPTIONS_HEADER, L"--Cheat Mode Options--", // TOPTION_CHEAT_MODE_OPTIONS_HEADER,
L"Erzwinge BR Lieferung", // force all pending Bobby Ray shipments 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"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 repairing.", // TODO.Translate
L"When ON, mercs will not report progress during doctoring.", // 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.", 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"When ON, zombies will span. Be aware!", // allow zombies // TODO.Translate
L"(text not rendered)TOPTION_CHEAT_MODE_OPTIONS_HEADER", L"(text not rendered)TOPTION_CHEAT_MODE_OPTIONS_HEADER",
L"Force all pending Bobby Ray shipments", 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 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 Repairing", // Madd: mercs don't say quotes while repairing //TODO.Translate
L"Quiet Doctoring", // Madd: mercs don't say quotes while doctoring //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 L"Auto Fast Forward AI Turns", // Automatic fast forward through AI turns // TODO.Translate
#endif
L"Allow Zombies", // Flugente Zombies 1.0 L"Allow Zombies", // Flugente Zombies 1.0
L"--Cheat Mode Options--", // TOPTION_CHEAT_MODE_OPTIONS_HEADER, L"--Cheat Mode Options--", // TOPTION_CHEAT_MODE_OPTIONS_HEADER,
L"Force Bobby Ray shipments", // force all pending Bobby Ray shipments 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 training.",
L"When ON, mercs will not report progress during repairing.", // 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 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 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"When ON, zombies will span. Be aware!", // allow zombies // TODO.Translate
L"(text not rendered)TOPTION_CHEAT_MODE_OPTIONS_HEADER", L"(text not rendered)TOPTION_CHEAT_MODE_OPTIONS_HEADER",
L"Force all pending Bobby Ray shipments", 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 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 Repairing", // Madd: mercs don't say quotes while repairing //TODO.Translate
L"Quiet Doctoring", // Madd: mercs don't say quotes while doctoring //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 L"Auto Fast Forward AI Turns", // Automatic fast forward through AI turns // TODO.Translate
#endif
L"Allow Zombies", // Flugente Zombies 1.0 L"Allow Zombies", // Flugente Zombies 1.0
L"--Cheat Mode Options--", // TOPTION_CHEAT_MODE_OPTIONS_HEADER, L"--Cheat Mode Options--", // TOPTION_CHEAT_MODE_OPTIONS_HEADER,
L"Force Bobby Ray shipments", // force all pending Bobby Ray shipments 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 training.",
L"When ON, mercs will not report progress during repairing.", // 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 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 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"When ON, zombies will span. Be aware!", // allow zombies // TODO.Translate
L"(text not rendered)TOPTION_CHEAT_MODE_OPTIONS_HEADER", L"(text not rendered)TOPTION_CHEAT_MODE_OPTIONS_HEADER",
L"WymuŚ wszystkie oczekiwane dostawy od Bobby Ray's.", 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 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 Repairing", // Madd: mercs don't say quotes while repairing //TODO.Translate
L"Quiet Doctoring", // Madd: mercs don't say quotes while doctoring //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 L"Auto Fast Forward AI Turns", // Automatic fast forward through AI turns // TODO.Translate
#endif
L"Allow Zombies", // Flugente Zombies 1.0 L"Allow Zombies", // Flugente Zombies 1.0
L"--Читерские настройки--", // TOPTION_CHEAT_MODE_OPTIONS_HEADER, L"--Читерские настройки--", // TOPTION_CHEAT_MODE_OPTIONS_HEADER,
L"Ускорить доставку Бобби Рэя", // force all pending Bobby Ray shipments 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 training.",
L"When ON, mercs will not report progress during repairing.", // 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 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 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"When ON, zombies will span. Be aware!", // allow zombies // TODO.Translate
L"(text not rendered)TOPTION_CHEAT_MODE_OPTIONS_HEADER", L"(text not rendered)TOPTION_CHEAT_MODE_OPTIONS_HEADER",
L"Выберите этот пункт чтобы груз Бобби Рэя прибыл немедленно.", 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 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 Repairing", // Madd: mercs don't say quotes while repairing //TODO.Translate
L"Quiet Doctoring", // Madd: mercs don't say quotes while doctoring //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 L"Auto Fast Forward AI Turns", // Automatic fast forward through AI turns // TODO.Translate
#endif
L"Allow Zombies", // Flugente Zombies 1.0 L"Allow Zombies", // Flugente Zombies 1.0
L"--Cheat Mode Options--", // TOPTION_CHEAT_MODE_OPTIONS_HEADER, L"--Cheat Mode Options--", // TOPTION_CHEAT_MODE_OPTIONS_HEADER,
L"Force Bobby Ray shipments", // force all pending Bobby Ray shipments 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 training.",
L"When ON, mercs will not report progress during repairing.", // 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 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 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"When ON, zombies will span. Be aware!", // allow zombies // TODO.Translate
L"(text not rendered)TOPTION_CHEAT_MODE_OPTIONS_HEADER", L"(text not rendered)TOPTION_CHEAT_MODE_OPTIONS_HEADER",
L"Force all pending Bobby Ray shipments", 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)) if (DequeueSpecificEvent(&InputEvent, KEY_DOWN|KEY_UP|KEY_REPEAT))
#else
if (DequeueEvent(&InputEvent) == TRUE)
#endif
{ {
if ((InputEvent.usEvent == KEY_DOWN)&&(InputEvent.usParam == ESC)) if ((InputEvent.usEvent == KEY_DOWN)&&(InputEvent.usParam == ESC))
{ {
+5
View File
@@ -3,6 +3,11 @@
#include "Language Defines.h" #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!! // WANNE: Enable those 2 defines, if you want to build UB-Version!!
+4 -1
View File
@@ -148,11 +148,12 @@ BOOLEAN InitializeGame(void)
InitButtonSystem(); InitButtonSystem();
InitCursors( ); InitCursors( );
#ifdef USE_HIGHSPEED_GAMELOOP_TIMER
SetFastForwardPeriod(gGameExternalOptions.iFastForwardPeriod); SetFastForwardPeriod(gGameExternalOptions.iFastForwardPeriod);
SetFastForwardKey(gGameExternalOptions.iFastForwardKey); SetFastForwardKey(gGameExternalOptions.iFastForwardKey);
SetNotifyFrequencyKey(gGameExternalOptions.iNotifyFrequency); SetNotifyFrequencyKey(gGameExternalOptions.iNotifyFrequency);
SetClockSpeedPercent(gGameExternalOptions.fClockSpeedPercent); SetClockSpeedPercent(gGameExternalOptions.fClockSpeedPercent);
#endif
// Init Fonts // Init Fonts
if ( !InitializeFonts( ) ) if ( !InitializeFonts( ) )
@@ -599,6 +600,7 @@ void NextLoopCheckForEnoughFreeHardDriveSpace()
} }
#ifdef USE_HIGHSPEED_GAMELOOP_TIMER
// Called by any game loop after all known events were handled // Called by any game loop after all known events were handled
void HandleDefaultEvent(InputAtom *Event) void HandleDefaultEvent(InputAtom *Event)
{ {
@@ -615,3 +617,4 @@ void HandleDefaultEvent(InputAtom *Event)
MouseSystemHook(Event->usEvent, (UINT16)MousePos.x ,(UINT16)MousePos.y ,_LeftButtonDown, _RightButtonDown); MouseSystemHook(Event->usEvent, (UINT16)MousePos.x ,(UINT16)MousePos.y ,_LeftButtonDown, _RightButtonDown);
} }
} }
#endif
+2
View File
@@ -18,7 +18,9 @@ void HandleShortCutExitState( void );
void SetPendingNewScreen( UINT32 uiNewScreen ); void SetPendingNewScreen( UINT32 uiNewScreen );
#ifdef USE_HIGHSPEED_GAMELOOP_TIMER
struct InputAtom; struct InputAtom;
void HandleDefaultEvent(InputAtom *Event); void HandleDefaultEvent(InputAtom *Event);
#endif
#endif #endif
+4
View File
@@ -321,7 +321,11 @@ UINT32 ErrorScreenHandle(void)
EndFrameBufferRender( ); EndFrameBufferRender( );
// Check for esc // Check for esc
#ifdef USE_HIGHSPEED_GAMELOOP_TIMER
while (DequeueSpecificEvent(&InputEvent, KEY_DOWN|KEY_UP|KEY_REPEAT)) while (DequeueSpecificEvent(&InputEvent, KEY_DOWN|KEY_UP|KEY_REPEAT))
#else
while (DequeueEvent(&InputEvent) == TRUE)
#endif
{ {
if( InputEvent.usEvent == KEY_DOWN ) if( InputEvent.usEvent == KEY_DOWN )
{ {