From 12d45fcfa20ad3ef210c39407c97f209c6a14222 Mon Sep 17 00:00:00 2001 From: Flugente Date: Tue, 4 Mar 2014 22:20:32 +0000 Subject: [PATCH] Merged revision(s) 7024 from branches/ja2_source_official_2014: - If a merc repairs up to a threshold below 100, display a slightly different message - Due to radio operator jamming, AI red alert can fail (intentional part of the trait). In that case, forbid the soldier from using radio again this turn, as this would be a fruitless waste of APs. git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@7025 3b4a5df2-a311-0410-b5c6-a8a6f20db521 --- Strategic/Assignments.cpp | 16 ++++++++++++++-- Tactical/Soldier Control.cpp | 4 ++-- Tactical/Soldier Control.h | 6 +++--- TacticalAI/AIMain.cpp | 2 ++ TacticalAI/DecideAction.cpp | 19 ++++++++++--------- Utils/Text.h | 3 +++ Utils/_ChineseText.cpp | 3 +++ Utils/_DutchText.cpp | 5 ++++- Utils/_EnglishText.cpp | 3 +++ Utils/_FrenchText.cpp | 3 +++ Utils/_GermanText.cpp | 3 +++ Utils/_ItalianText.cpp | 3 +++ Utils/_PolishText.cpp | 3 +++ Utils/_RussianText.cpp | 3 +++ Utils/_TaiwaneseText.cpp | 3 +++ 15 files changed, 62 insertions(+), 17 deletions(-) diff --git a/Strategic/Assignments.cpp b/Strategic/Assignments.cpp index 90d17377a..9e56b8b44 100644 --- a/Strategic/Assignments.cpp +++ b/Strategic/Assignments.cpp @@ -4531,7 +4531,6 @@ BOOLEAN RepairObject( SOLDIERTYPE * pSoldier, SOLDIERTYPE * pOwner, OBJECTTYPE * UINT8 ubLoop, ubItemsInPocket, lbeLoop, ubBeforeRepair; // added by SANDRO BOOLEAN fSomethingWasRepaired = FALSE; - ubItemsInPocket = pObj->ubNumberOfObjects; for ( ubLoop = 0; ubLoop < ubItemsInPocket; ubLoop++ ) @@ -4595,12 +4594,25 @@ BOOLEAN RepairObject( SOLDIERTYPE * pSoldier, SOLDIERTYPE * pOwner, OBJECTTYPE * ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_INTERFACE, gzLateLocalizedString[ 35 ], pSoldier->GetName(), pOwner->GetName(), ItemNames[ pObj->usItem ] ); } } + // Flugente: if we repaired as much as possible, but the threshold is below 100, display a slightly different message + else if ( (*pObj)[ubLoop]->data.objectStatus == threshold ) + { + // report it as fixed + if ( pSoldier == pOwner ) + { + ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_INTERFACE, Message[ STR_REPAIRED_PARTIAL ], pSoldier->GetName(), ItemNames[ pObj->usItem ] ); + } + else + { + ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_INTERFACE, Message[ STR_REPAIRED_PARTIAL_FOR_OWNER ], pSoldier->GetName(), pOwner->GetName(), ItemNames[ pObj->usItem ] ); + } + } + if ( *pubRepairPtsLeft == 0 ) { // we're out of points! return true; } - } // now check for attachments after diff --git a/Tactical/Soldier Control.cpp b/Tactical/Soldier Control.cpp index 2034777ca..560624913 100644 --- a/Tactical/Soldier Control.cpp +++ b/Tactical/Soldier Control.cpp @@ -17068,8 +17068,8 @@ INT16 SOLDIERTYPE::GetInterruptModifier( UINT8 usDistance ) void SOLDIERTYPE::SoldierPropertyUpkeep() { - // these flags are only used for the first turn, and thus always removed - this->bSoldierFlagMask &= ~(SOLDIER_AIRDROP_TURN|SOLDIER_ASSAULT_BONUS); + // these effects last only one turn + this->bSoldierFlagMask &= ~(SOLDIER_AIRDROP_TURN|SOLDIER_ASSAULT_BONUS|SOLDIER_RAISED_REDALERT); if ( HasBackgroundFlag( BACKGROUND_EXP_UNDERGROUND ) && this->bSectorZ ) ++bExtraExpLevel; diff --git a/Tactical/Soldier Control.h b/Tactical/Soldier Control.h index b441e733a..fa584f463 100644 --- a/Tactical/Soldier Control.h +++ b/Tactical/Soldier Control.h @@ -379,12 +379,12 @@ enum #define SOLDIER_RADIO_OPERATOR_JAMMING 0x00100000 //1048576 // radio operator is jamming frequencies #define SOLDIER_RADIO_OPERATOR_SCANNING 0x00200000 //2097152 // radio operator is scanning for jammers -#define SOLDIER_AIRDROP 0x00400000 //4194304 // soldier is entering the sector via airdrop from a helicopter. Sligthly different from SOLDIER_AIRDROP_TURN +#define SOLDIER_AIRDROP 0x00400000 //4194304 // soldier is entering the sector via airdrop from a helicopter. Slightly different from SOLDIER_AIRDROP_TURN #define SOLDIER_FRESHWOUND 0x00800000 //8388608 // campaign stats: soldier was wounded in this battle #define SOLDIER_BATTLE_PARTICIPATION 0x01000000 //16777216 // campaign stats: soldier took part in this battle -/*#define PLAYER_NET_2_LVL_3 0x02000000 //33554432 -#define PLAYER_NET_3_LVL_3 0x04000000 //67108864 +#define SOLDIER_RAISED_REDALERT 0x02000000 //33554432 // this (AI) soldier has raised red alert. Don't allow him to do so again this turn - either it already worked, or the signal is blocked +/*#define PLAYER_NET_3_LVL_3 0x04000000 //67108864 #define PLAYER_NET_4_LVL_3 0x08000000 //134217728 #define PLAYER_NET_1_LVL_4 0x10000000 //268435456 diff --git a/TacticalAI/AIMain.cpp b/TacticalAI/AIMain.cpp index d7c806e7f..4e678332d 100644 --- a/TacticalAI/AIMain.cpp +++ b/TacticalAI/AIMain.cpp @@ -2053,6 +2053,8 @@ INT8 ExecuteAction(SOLDIERTYPE *pSoldier) if (!(pSoldier->flags.uiStatusFlags & SOLDIER_PC) && ( !(gTacticalStatus.Team[pSoldier->bTeam].bAwareOfOpposition) || ( ( gTacticalStatus.fPanicFlags & PANIC_TRIGGERS_HERE ) && gTacticalStatus.ubTheChosenOne == NOBODY ) ) ) { HandleInitialRedAlert(pSoldier->bTeam, TRUE); + + pSoldier->bSoldierFlagMask |= SOLDIER_RAISED_REDALERT; } // SANDRO - ENEMY TAUNTS diff --git a/TacticalAI/DecideAction.cpp b/TacticalAI/DecideAction.cpp index 9f1b29320..7208fdab5 100644 --- a/TacticalAI/DecideAction.cpp +++ b/TacticalAI/DecideAction.cpp @@ -885,19 +885,19 @@ INT8 DecideActionGreen(SOLDIERTYPE *pSoldier) } //ddd{ - if(gGameExternalOptions.bNewTacticalAIBehavior && pSoldier->bTeam == ENEMY_TEAM ) + if( !(pSoldier->bSoldierFlagMask & SOLDIER_RAISED_REDALERT) && gGameExternalOptions.bNewTacticalAIBehavior && pSoldier->bTeam == ENEMY_TEAM ) { if ( !(gTacticalStatus.uiFlags & TURNBASED) && (gTacticalStatus.uiFlags & INCOMBAT) ) { - INT32 cnt; ROTTING_CORPSE * pCorpse; - for ( cnt = 0; cnt < giNumRottingCorpse; cnt++ ) + for ( cnt = 0; cnt < giNumRottingCorpse; ++cnt ) { pCorpse = &(gRottingCorpse[ cnt ] ); if ( pCorpse->fActivated && pCorpse->def.ubAIWarningValue > 0 ) + { if ( PythSpacesAway( pSoldier->sGridNo, pCorpse->def.sGridNo ) <= 5 )// (smaxvid ?) { //, .? @@ -911,6 +911,7 @@ INT8 DecideActionGreen(SOLDIERTYPE *pSoldier) return( AI_ACTION_RED_ALERT ); } } + } } } @@ -1564,7 +1565,7 @@ INT8 DecideActionYellow(SOLDIERTYPE *pSoldier) } } } - else if ( !gTacticalStatus.Team[pSoldier->bTeam].bAwareOfOpposition ) + else if ( !(pSoldier->bSoldierFlagMask & SOLDIER_RAISED_REDALERT) && !gTacticalStatus.Team[pSoldier->bTeam].bAwareOfOpposition ) { // raise alarm! return( AI_ACTION_RED_ALERT ); @@ -2632,7 +2633,7 @@ INT8 DecideActionRed(SOLDIERTYPE *pSoldier, UINT8 ubUnconsciousOK) } } // frequencies are clear, lets call for help - else + else if ( !(pSoldier->bSoldierFlagMask & SOLDIER_RAISED_REDALERT) ) { // raise alarm! return( AI_ACTION_RED_ALERT ); @@ -2950,7 +2951,7 @@ INT8 DecideActionRed(SOLDIERTYPE *pSoldier, UINT8 ubUnconsciousOK) // if we're a computer merc, and we have the action points remaining to RADIO // (we never want NPCs to choose to radio if they would have to wait a turn) - if ( !fCivilian && (pSoldier->bActionPoints >= APBPConstants[AP_RADIO]) && (gTacticalStatus.Team[pSoldier->bTeam].bMenInSector > 1) ) + if ( !(pSoldier->bSoldierFlagMask & SOLDIER_RAISED_REDALERT) && !fCivilian && (pSoldier->bActionPoints >= APBPConstants[AP_RADIO]) && (gTacticalStatus.Team[pSoldier->bTeam].bMenInSector > 1) ) { DebugMsg (TOPIC_JA2,DBG_LEVEL_3,"decideactionred: checking to radio red alert"); @@ -4446,7 +4447,7 @@ INT16 ubMinAPCost; } } // frequencies are clear, lets call for help - else + else if ( !(pSoldier->bSoldierFlagMask & SOLDIER_RAISED_REDALERT) ) { // raise alarm! return( AI_ACTION_RED_ALERT ); @@ -5829,7 +5830,7 @@ L_NEWAIM: // (we never want NPCs to choose to radio if they would have to wait a turn) // and we're not swimming in deep water, and somebody has called for spotters // and we see the location of at least 2 opponents - if ((gTacticalStatus.ubSpottersCalledForBy != NOBODY) && (pSoldier->bActionPoints >= APBPConstants[AP_RADIO]) && + if ( !(pSoldier->bSoldierFlagMask & SOLDIER_RAISED_REDALERT) && (gTacticalStatus.ubSpottersCalledForBy != NOBODY) && (pSoldier->bActionPoints >= APBPConstants[AP_RADIO]) && (pSoldier->aiData.bOppCnt > 1) && !fCivilian && (gTacticalStatus.Team[pSoldier->bTeam].bMenInSector > 1) && !bInDeepWater) { @@ -5968,7 +5969,7 @@ L_NEWAIM: // RADIO RED ALERT: determine %chance to call others and report contact //////////////////////////////////////////////////////////////////////////// - if ( pSoldier->bTeam == MILITIA_TEAM && (pSoldier->bActionPoints >= APBPConstants[AP_RADIO]) && (gTacticalStatus.Team[pSoldier->bTeam].bMenInSector > 1) ) + if ( !(pSoldier->bSoldierFlagMask & SOLDIER_RAISED_REDALERT) && pSoldier->bTeam == MILITIA_TEAM && (pSoldier->bActionPoints >= APBPConstants[AP_RADIO]) && (gTacticalStatus.Team[pSoldier->bTeam].bMenInSector > 1) ) { // if there hasn't been an initial RED ALERT yet in this sector diff --git a/Utils/Text.h b/Utils/Text.h index 8fa9ab334..f1d8498b6 100644 --- a/Utils/Text.h +++ b/Utils/Text.h @@ -569,6 +569,9 @@ enum STR_NO_SPACE_FOR_POCKET, + STR_REPAIRED_PARTIAL, + STR_REPAIRED_PARTIAL_FOR_OWNER, + TEXT_NUM_STR_MESSAGE, }; diff --git a/Utils/_ChineseText.cpp b/Utils/_ChineseText.cpp index 7082d1543..c876841d7 100644 --- a/Utils/_ChineseText.cpp +++ b/Utils/_ChineseText.cpp @@ -1761,6 +1761,9 @@ CHAR16 Message[][STRING_LENGTH] = L"你不能把%s添加到这个附件槽。", L"%s不能被添加到任何附件槽。", L"这个口袋装不下了", //L"There's not enough space for this pocket.", + + L"%s has repaired the %s as much as possible.", // TODO.Translate + L"%s has repaired %s's %s as much as possible.", }; diff --git a/Utils/_DutchText.cpp b/Utils/_DutchText.cpp index 6ee7fa47e..31786c350 100644 --- a/Utils/_DutchText.cpp +++ b/Utils/_DutchText.cpp @@ -1757,7 +1757,10 @@ CHAR16 Message[][STRING_LENGTH] = L"You cannot attach %s to this slot.", L"The %s will not fit in any open slots.", - L"There's not enough space for this pocket.", //TODO:Translate + L"There's not enough space for this pocket.", //TODO.Translate + + L"%s has repaired the %s as much as possible.", // TODO.Translate + L"%s has repaired %s's %s as much as possible.", }; diff --git a/Utils/_EnglishText.cpp b/Utils/_EnglishText.cpp index db62cec0e..e47c6db61 100644 --- a/Utils/_EnglishText.cpp +++ b/Utils/_EnglishText.cpp @@ -1762,6 +1762,9 @@ CHAR16 Message[][STRING_LENGTH] = L"You cannot attach %s to this slot.", L"The %s will not fit in any open slots.", L"There's not enough space for this pocket.", + + L"%s has repaired the %s as much as possible.", + L"%s has repaired %s's %s as much as possible.", }; diff --git a/Utils/_FrenchText.cpp b/Utils/_FrenchText.cpp index aacee0123..e29bd7b6d 100644 --- a/Utils/_FrenchText.cpp +++ b/Utils/_FrenchText.cpp @@ -1765,6 +1765,9 @@ CHAR16 Message[][STRING_LENGTH] = L"Vous ne pouvez pas attacher %s à cet emplacement.", L"%s n'ira dans aucun emplacement de libre.", L"Pas assez de place pour cette poche.", + + L"%s has repaired the %s as much as possible.", // TODO.Translate + L"%s has repaired %s's %s as much as possible.", }; diff --git a/Utils/_GermanText.cpp b/Utils/_GermanText.cpp index 3005ec514..97bc5d71f 100644 --- a/Utils/_GermanText.cpp +++ b/Utils/_GermanText.cpp @@ -1776,6 +1776,9 @@ CHAR16 Message[][STRING_LENGTH] = L"Sie können %s nicht an dieser Einbaustelle anbringen.", L"%s passt in keine freie Einbaustelle.", L"Für diese Tasche ist nicht mehr genug Platz.", + + L"%s has repaired the %s as much as possible.", // TODO.Translate + L"%s has repaired %s's %s as much as possible.", }; CHAR16 pTownNames[MAX_TOWNS][MAX_TOWN_NAME_LENGHT] = diff --git a/Utils/_ItalianText.cpp b/Utils/_ItalianText.cpp index 7f540c01e..ebd7364cd 100644 --- a/Utils/_ItalianText.cpp +++ b/Utils/_ItalianText.cpp @@ -1754,6 +1754,9 @@ CHAR16 Message[][STRING_LENGTH] = L"You cannot attach %s to this slot.", L"The %s will not fit in any open slots.", L"There's not enough space for this pocket.", //TODO:Translate + + L"%s has repaired the %s as much as possible.", // TODO.Translate + L"%s has repaired %s's %s as much as possible.", }; diff --git a/Utils/_PolishText.cpp b/Utils/_PolishText.cpp index 9050ad9e4..dbbfa9cb9 100644 --- a/Utils/_PolishText.cpp +++ b/Utils/_PolishText.cpp @@ -1770,6 +1770,9 @@ CHAR16 Message[][STRING_LENGTH] = L"Niemożesz przydzielić %s do tego slotu.", L"The %s will not fit in any open slots.", L"There's not enough space for this pocket.", //TODO:Translate + + L"%s has repaired the %s as much as possible.", // TODO.Translate + L"%s has repaired %s's %s as much as possible.", }; diff --git a/Utils/_RussianText.cpp b/Utils/_RussianText.cpp index 7531743a1..2fdb4ba5d 100644 --- a/Utils/_RussianText.cpp +++ b/Utils/_RussianText.cpp @@ -1762,6 +1762,9 @@ CHAR16 Message[][STRING_LENGTH] = L"Нельзя установить навеску %s на это место.", L"The %s will not fit in any open slots.", L"There's not enough space for this pocket.", //TODO:Translate + + L"%s has repaired the %s as much as possible.", // TODO.Translate + L"%s has repaired %s's %s as much as possible.", }; diff --git a/Utils/_TaiwaneseText.cpp b/Utils/_TaiwaneseText.cpp index 4ff02876c..b163f61de 100644 --- a/Utils/_TaiwaneseText.cpp +++ b/Utils/_TaiwaneseText.cpp @@ -1762,6 +1762,9 @@ CHAR16 Message[][STRING_LENGTH] = L"You cannot attach %s to this slot.", L"The %s will not fit in any open slots.", L"There's not enough space for this pocket.", //TODO:Translate + + L"%s has repaired the %s as much as possible.", // TODO.Translate + L"%s has repaired %s's %s as much as possible.", };