Fix: opening options during Meanwhile leaves the game inoperable

git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@9148 3b4a5df2-a311-0410-b5c6-a8a6f20db521
This commit is contained in:
Flugente
2021-07-31 14:21:27 +00:00
parent 58379b84cd
commit af12b8210c
+145 -128
View File
@@ -4044,70 +4044,78 @@ void GetKeyboardInput( UINT32 *puiNewEvent )
break; break;
case 'n': case 'n':
if( fAlt ) if ( !AreInMeanwhile() )
{ {
static UINT16 gQuoteNum = 0; if ( fAlt )
{
static UINT16 gQuoteNum = 0;
if ( INFORMATION_CHEAT_LEVEL( ) ) if ( INFORMATION_CHEAT_LEVEL() )
{
if( gfUIFullTargetFound )
{ {
TacticalCharacterDialogue( MercPtrs[ gusUIFullTargetID ], gQuoteNum ); if ( gfUIFullTargetFound )
gQuoteNum++; {
TacticalCharacterDialogue( MercPtrs[gusUIFullTargetID], gQuoteNum );
gQuoteNum++;
}
} }
} }
} else if ( fCtrl )
else if( fCtrl ) {
{
#if 0 #if 0
if ( INFORMATION_CHEAT_LEVEL( ) ) if ( INFORMATION_CHEAT_LEVEL() )
{
if( gfUIShowCurIntTile ^= TRUE )
{ {
ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_TESTVERSION, L"Turning Enhanced mouse detection ON." ); if ( gfUIShowCurIntTile ^= TRUE )
gubIntTileCheckFlags = INTILE_CHECK_FULL; {
ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_TESTVERSION, L"Turning Enhanced mouse detection ON." );
gubIntTileCheckFlags = INTILE_CHECK_FULL;
}
else
{
ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_TESTVERSION, L"Turning Enhanced mouse detection OFF." );
gubIntTileCheckFlags = INTILE_CHECK_SELECTIVE;
}
} }
else
{
ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_TESTVERSION, L"Turning Enhanced mouse detection OFF." );
gubIntTileCheckFlags = INTILE_CHECK_SELECTIVE;
}
}
#endif #endif
}
else
{
if ( !CycleSoldierFindStack( usMapPos ) )// Are we over a merc stack?
CycleIntTileFindStack( usMapPos ); // If not, now check if we are over a struct stack
}
} }
else
if( !CycleSoldierFindStack( usMapPos ) )// Are we over a merc stack?
CycleIntTileFindStack( usMapPos ); // If not, now check if we are over a struct stack
break; break;
case 'o': case 'o':
if( fAlt ) if ( !AreInMeanwhile() )
{ {
if ( CHEATER_CHEAT_LEVEL( ) ) if ( fAlt )
{ {
gStrategicStatus.usPlayerKills += NumEnemiesInAnySector( gWorldSectorX, gWorldSectorY, gbWorldSectorZ ); if ( CHEATER_CHEAT_LEVEL() )
ObliterateSector();
}
}
else if(fCtrl)
{
if ( CHEATER_CHEAT_LEVEL( ) )
{
CreatePlayerControlledMonster();
}
}
else
{
// nothing in hand and the Options Screen button for whichever panel we're in must be enabled
if ( ( gpItemPointer == NULL ) && !gfDisableTacticalPanelButtons &&
( ( gsCurInterfacePanel != SM_PANEL ) || ( ButtonList[ iSMPanelButtons[ OPTIONS_BUTTON ] ]->uiFlags & BUTTON_ENABLED ) ) )
{
if( !fDisableMapInterfaceDueToBattle )
{ {
// go to Options screen gStrategicStatus.usPlayerKills += NumEnemiesInAnySector( gWorldSectorX, gWorldSectorY, gbWorldSectorZ );
guiPreviousOptionScreen = GAME_SCREEN; ObliterateSector();
LeaveTacticalScreen( OPTIONS_SCREEN ); }
}
else if ( fCtrl )
{
if ( CHEATER_CHEAT_LEVEL() )
{
CreatePlayerControlledMonster();
}
}
else
{
// nothing in hand and the Options Screen button for whichever panel we're in must be enabled
if ( ( gpItemPointer == NULL ) && !gfDisableTacticalPanelButtons &&
( ( gsCurInterfacePanel != SM_PANEL ) || ( ButtonList[iSMPanelButtons[OPTIONS_BUTTON]]->uiFlags & BUTTON_ENABLED ) ) )
{
if ( !fDisableMapInterfaceDueToBattle )
{
// go to Options screen
guiPreviousOptionScreen = GAME_SCREEN;
LeaveTacticalScreen( OPTIONS_SCREEN );
}
} }
} }
} }
@@ -4206,88 +4214,94 @@ void GetKeyboardInput( UINT32 *puiNewEvent )
case 's': case 's':
if( fCtrl ) if ( !AreInMeanwhile() )
{ {
if ( fAlt ) if ( fCtrl )
RemoveCharacterFromSquads(MercPtrs[gusSelectedSoldier]);
else if( !fDisableMapInterfaceDueToBattle && !( gTacticalStatus.uiFlags & ENGAGED_IN_CONV ) && !is_networked)
{ {
// WANNE: Do not allow saving via the save screen when it is not our turn, if ( fAlt )
// because there is an explit when you close the save window without saving, you can move your merc even it is not your turn
// IF UI HAS LOCKED, ONLY ALLOW EXIT!
if ( gfDisableRegionActive || gfUserTurnRegionActive )
{ {
continue; RemoveCharacterFromSquads( MercPtrs[gusSelectedSoldier] );
} }
else if ( !fDisableMapInterfaceDueToBattle && !( gTacticalStatus.uiFlags & ENGAGED_IN_CONV ) && !is_networked )
//if the game CAN be saved
if( CanGameBeSaved() )
{ {
gfSaveGame = TRUE; // WANNE: Do not allow saving via the save screen when it is not our turn,
gfCameDirectlyFromGame = TRUE; // because there is an explit when you close the save window without saving, you can move your merc even it is not your turn
// IF UI HAS LOCKED, ONLY ALLOW EXIT!
guiPreviousOptionScreen = GAME_SCREEN; if ( gfDisableRegionActive || gfUserTurnRegionActive )
LeaveTacticalScreen( SAVE_LOAD_SCREEN );
}
else
{
//Display a message saying the player cant save now
switch( gGameOptions.ubIronManMode )
{ {
case 2: continue;
DoMapMessageBox( MSG_BOX_BASIC_STYLE, zNewTacticalMessages[ TCTL_MSG__SOFT_IRON_MAN_CANT_SAVE_NOW ], GAME_SCREEN, ( UINT8 )MSG_BOX_FLAG_OK, NULL );
break;
case 3:
CHAR16 zTemp[320];
swprintf( zTemp, zNewTacticalMessages[ TCTL_MSG__EXTREME_IRON_MAN_CANT_SAVE_NOW ], gGameExternalOptions.ubExtremeIronManSavingHour);
DoMapMessageBox( MSG_BOX_BASIC_STYLE, zTemp, GAME_SCREEN, ( UINT8 )MSG_BOX_FLAG_OK, NULL );
break;
default:
DoMessageBox( MSG_BOX_BASIC_STYLE, zNewTacticalMessages[ TCTL_MSG__IRON_MAN_CANT_SAVE_NOW ], GAME_SCREEN, ( UINT8 )MSG_BOX_FLAG_OK, NULL, NULL);
break;
} }
}
}
}
else
if( fAlt )
{
if( !fDisableMapInterfaceDueToBattle && !( gTacticalStatus.uiFlags & ENGAGED_IN_CONV )&& !is_networked )
{
//if the game CAN be saved //if the game CAN be saved
if( CanGameBeSaved() ) if ( CanGameBeSaved() )
{ {
gfSaveGame = TRUE;
gfCameDirectlyFromGame = TRUE;
guiPreviousOptionScreen = GAME_SCREEN; guiPreviousOptionScreen = GAME_SCREEN;
//guiPreviousOptionScreen = guiCurrentScreen; LeaveTacticalScreen( SAVE_LOAD_SCREEN );
DoQuickSave();
} }
else else
{ {
//Display a message saying the player cant save now //Display a message saying the player cant save now
switch( gGameOptions.ubIronManMode ) switch ( gGameOptions.ubIronManMode )
{ {
case 2: case 2:
DoMapMessageBox( MSG_BOX_BASIC_STYLE, zNewTacticalMessages[ TCTL_MSG__SOFT_IRON_MAN_CANT_SAVE_NOW ], GAME_SCREEN, MSG_BOX_FLAG_OK, NULL ); DoMapMessageBox( MSG_BOX_BASIC_STYLE, zNewTacticalMessages[TCTL_MSG__SOFT_IRON_MAN_CANT_SAVE_NOW], GAME_SCREEN, (UINT8)MSG_BOX_FLAG_OK, NULL );
break; break;
case 3: case 3:
CHAR16 zTemp[320]; CHAR16 zTemp[320];
swprintf( zTemp, zNewTacticalMessages[ TCTL_MSG__EXTREME_IRON_MAN_CANT_SAVE_NOW ], gGameExternalOptions.ubExtremeIronManSavingHour); swprintf( zTemp, zNewTacticalMessages[TCTL_MSG__EXTREME_IRON_MAN_CANT_SAVE_NOW], gGameExternalOptions.ubExtremeIronManSavingHour );
DoMapMessageBox( MSG_BOX_BASIC_STYLE, zTemp, GAME_SCREEN, MSG_BOX_FLAG_OK, NULL ); DoMapMessageBox( MSG_BOX_BASIC_STYLE, zTemp, GAME_SCREEN, (UINT8)MSG_BOX_FLAG_OK, NULL );
break; break;
default: default:
DoMessageBox( MSG_BOX_BASIC_STYLE, zNewTacticalMessages[ TCTL_MSG__IRON_MAN_CANT_SAVE_NOW ], GAME_SCREEN, MSG_BOX_FLAG_OK, NULL, NULL ); DoMessageBox( MSG_BOX_BASIC_STYLE, zNewTacticalMessages[TCTL_MSG__IRON_MAN_CANT_SAVE_NOW], GAME_SCREEN, (UINT8)MSG_BOX_FLAG_OK, NULL, NULL );
break; break;
} }
} }
} }
} }
else if( gusSelectedSoldier != NOBODY ) else
{ {
gfPlotNewMovement = TRUE; if ( fAlt )
HandleStanceChangeFromUIKeys( ANIM_STAND ); {
if ( !fDisableMapInterfaceDueToBattle && !( gTacticalStatus.uiFlags & ENGAGED_IN_CONV ) && !is_networked )
{
//if the game CAN be saved
if ( CanGameBeSaved() )
{
guiPreviousOptionScreen = GAME_SCREEN;
//guiPreviousOptionScreen = guiCurrentScreen;
DoQuickSave();
}
else
{
//Display a message saying the player cant save now
switch ( gGameOptions.ubIronManMode )
{
case 2:
DoMapMessageBox( MSG_BOX_BASIC_STYLE, zNewTacticalMessages[TCTL_MSG__SOFT_IRON_MAN_CANT_SAVE_NOW], GAME_SCREEN, MSG_BOX_FLAG_OK, NULL );
break;
case 3:
CHAR16 zTemp[320];
swprintf( zTemp, zNewTacticalMessages[TCTL_MSG__EXTREME_IRON_MAN_CANT_SAVE_NOW], gGameExternalOptions.ubExtremeIronManSavingHour );
DoMapMessageBox( MSG_BOX_BASIC_STYLE, zTemp, GAME_SCREEN, MSG_BOX_FLAG_OK, NULL );
break;
default:
DoMessageBox( MSG_BOX_BASIC_STYLE, zNewTacticalMessages[TCTL_MSG__IRON_MAN_CANT_SAVE_NOW], GAME_SCREEN, MSG_BOX_FLAG_OK, NULL, NULL );
break;
}
}
}
}
else if ( gusSelectedSoldier != NOBODY )
{
gfPlotNewMovement = TRUE;
HandleStanceChangeFromUIKeys( ANIM_STAND );
}
} }
break; }
break;
case 't': case 't':
@@ -4552,33 +4566,36 @@ void GetKeyboardInput( UINT32 *puiNewEvent )
break; break;
case 'y': case 'y':
if( fAlt ) if ( !AreInMeanwhile() )
{ {
OBJECTTYPE Object; if ( fAlt )
SOLDIERTYPE *pSoldier;
if ( CHEATER_CHEAT_LEVEL( ) )
{ {
QuickCreateProfileMerc( CIV_TEAM, MARIA ); //Ira OBJECTTYPE Object;
SOLDIERTYPE *pSoldier;
// Recruit! if ( CHEATER_CHEAT_LEVEL() )
RecruitEPC( MARIA ); {
QuickCreateProfileMerc( CIV_TEAM, MARIA ); //Ira
//Heinz: 28.02.09 BUGFIX: giving G41 to Maria only in cheat mode
// Create object and set
CreateItem( G41, 100, &Object );
pSoldier = FindSoldierByProfileID( MARIA, FALSE ); // Recruit!
RecruitEPC( MARIA );
AutoPlaceObject( pSoldier, &Object, FALSE ); //Heinz: 28.02.09 BUGFIX: giving G41 to Maria only in cheat mode
// Create object and set
CreateItem( G41, 100, &Object );
pSoldier = FindSoldierByProfileID( MARIA, FALSE );
AutoPlaceObject( pSoldier, &Object, FALSE );
}
} }
} else
else
{
// used for opening chatbox in networked game
if ( INFORMATION_CHEAT_LEVEL( ) )
{ {
*puiNewEvent = I_LOSDEBUG; // used for opening chatbox in networked game
if ( INFORMATION_CHEAT_LEVEL() )
{
*puiNewEvent = I_LOSDEBUG;
}
} }
} }
break; break;