From b9b58fe790c940b6c52b84ada39a4f61eadb4d08 Mon Sep 17 00:00:00 2001 From: Wanne Date: Thu, 5 Dec 2013 08:08:20 +0000 Subject: [PATCH] Ctrl + D in turnbased - skip player interrupts for that turn (by Sevenfm) - This only works for singleplayer - This only works for Old interrupt system git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@6682 3b4a5df2-a311-0410-b5c6-a8a6f20db521 --- SaveLoadGame.cpp | 4 ++++ Tactical/Overhead.cpp | 4 ++++ Tactical/Overhead.h | 3 ++- Tactical/TeamTurns.cpp | 6 ++++++ Tactical/Turn Based Input.cpp | 10 ++++++++-- 5 files changed, 24 insertions(+), 3 deletions(-) diff --git a/SaveLoadGame.cpp b/SaveLoadGame.cpp index ac90fe398..a72cc78b0 100644 --- a/SaveLoadGame.cpp +++ b/SaveLoadGame.cpp @@ -7202,7 +7202,10 @@ BOOLEAN LoadTacticalStatusFromSavedGame( HWFILE hFile ) { numBytesRead = ReadFieldByField(hFile, &gTacticalStatus.ubLastRequesterSurgeryTargetID, sizeof(gTacticalStatus.ubLastRequesterSurgeryTargetID), sizeof(UINT8), numBytesRead); if ( guiCurrentSaveGameVersion >= IMPROVED_INTERRUPT_SYSTEM ) + { numBytesRead = ReadFieldByField(hFile, &gTacticalStatus.ubInterruptPending, sizeof(gTacticalStatus.ubInterruptPending), sizeof(UINT8), numBytesRead); + numBytesRead = ReadFieldByField(hFile, &gTacticalStatus.ubDisablePlayerInterrupts, sizeof(gTacticalStatus.ubDisablePlayerInterrupts), sizeof(BOOLEAN), numBytesRead); + } while( (numBytesRead%4) != 0 ) // This is to make sure the total read is of DWORD length numBytesRead = ReadFieldByField(hFile, &filler, sizeof(filler), sizeof(UINT8), numBytesRead); } @@ -7210,6 +7213,7 @@ BOOLEAN LoadTacticalStatusFromSavedGame( HWFILE hFile ) { numBytesRead++; //&gTacticalStatus.ubLastRequesterSurgeryTargetID added with BUGFIX_NPC_DATA_FOR_BIG_MAPS numBytesRead++; //&gTacticalStatus.ubInterruptPending added with IMPROVED_INTERRUPT_SYSTEM + numBytesRead++; //&gTacticalStatus.ubDisablePlayerInterrupts while( (numBytesRead%4) != 0 ) // This is to make sure the total read is of DWORD length numBytesRead++; } diff --git a/Tactical/Overhead.cpp b/Tactical/Overhead.cpp index 95478d421..6db9ed900 100644 --- a/Tactical/Overhead.cpp +++ b/Tactical/Overhead.cpp @@ -5842,6 +5842,8 @@ void CommonEnterCombatModeCode( ) gTacticalStatus.ubInterruptPending = DISABLED_INTERRUPT; + gTacticalStatus.ubDisablePlayerInterrupts = FALSE; + // ATE: If we have an item pointer end it! CancelItemPointer( ); @@ -6037,6 +6039,8 @@ void ExitCombatMode( ) ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_INTERFACE, pMessageStrings[ MSG_FTM_EXIT_COMBAT ] );// ary-05/05/2009 : add forced turn mode + gTacticalStatus.ubDisablePlayerInterrupts = FALSE; + // OK, we have exited combat mode..... // Reset some flags for no aps to move, etc diff --git a/Tactical/Overhead.h b/Tactical/Overhead.h index 9e91bfb40..79dc8657f 100644 --- a/Tactical/Overhead.h +++ b/Tactical/Overhead.h @@ -161,7 +161,8 @@ struct TacticalStatusType // SANDRO - added these UINT8 ubLastRequesterSurgeryTargetID; UINT8 ubInterruptPending; - + // sevenfm: Ctrl+D disable interrupts + BOOLEAN ubDisablePlayerInterrupts; // PADDING GONE!!!!! }; diff --git a/Tactical/TeamTurns.cpp b/Tactical/TeamTurns.cpp index cbab6d2a5..0d3b27b22 100644 --- a/Tactical/TeamTurns.cpp +++ b/Tactical/TeamTurns.cpp @@ -168,6 +168,8 @@ void StartPlayerTeamTurn( BOOLEAN fDoBattleSnd, BOOLEAN fEnteringCombatMode ) SetFastForwardMode(FALSE); + gTacticalStatus.ubDisablePlayerInterrupts = FALSE; + // Start the turn of player charactors // @@ -2005,6 +2007,10 @@ BOOLEAN InterruptDuel( SOLDIERTYPE * pSoldier, SOLDIERTYPE * pOpponent) DebugMsg (TOPIC_JA2INTERRUPT,DBG_LEVEL_3,"InterruptDuel"); BOOLEAN fResult = FALSE; + // sevenfm: if Ctrl+D pressed - skip all player interrupts for this turn + if( !is_networked && !gGameOptions.fImprovedInterruptSystem && pSoldier->bTeam == OUR_TEAM && gTacticalStatus.ubDisablePlayerInterrupts ) + return FALSE; + // if opponent can't currently see us and we can see them if ( pSoldier->aiData.bOppList[ pOpponent->ubID ] == SEEN_CURRENTLY && pOpponent->aiData.bOppList[pSoldier->ubID] != SEEN_CURRENTLY ) { diff --git a/Tactical/Turn Based Input.cpp b/Tactical/Turn Based Input.cpp index 22519e678..789e46217 100644 --- a/Tactical/Turn Based Input.cpp +++ b/Tactical/Turn Based Input.cpp @@ -1669,6 +1669,8 @@ void GetKeyboardInput( UINT32 *puiNewEvent ) { if ( !( gTacticalStatus.uiFlags & ENGAGED_IN_CONV ) ) { + gTacticalStatus.ubDisablePlayerInterrupts = FALSE; + gfSaveGame = FALSE; gfCameDirectlyFromGame = TRUE; @@ -3137,12 +3139,16 @@ void GetKeyboardInput( UINT32 *puiNewEvent ) } } } - } - else //End turn only if in combat and it is the player's turn + } else + { + //End turn only if in combat and it is the player's turn + if ( fCtrl ) + gTacticalStatus.ubDisablePlayerInterrupts = TRUE; *puiNewEvent = I_ENDTURN; } } } + } #ifdef JA2TESTVERSION else if( fCtrl ) AdvanceToNextDay();