From 2e86f6c0ef29c073a120e145a227d58780ee929a Mon Sep 17 00:00:00 2001 From: Flugente Date: Wed, 15 Aug 2018 19:20:08 +0000 Subject: [PATCH] 'Disease->Diagnose' assignment also checks for contaminated items and marks them permanently git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@8595 3b4a5df2-a311-0410-b5c6-a8a6f20db521 --- Strategic/Assignments.cpp | 28 ++++++++++++++++++++++++++++ Tactical/Interface Items.cpp | 20 ++++++++++++++++++++ Tactical/Item Types.h | 1 + Utils/Text.h | 1 + Utils/_ChineseText.cpp | 1 + Utils/_DutchText.cpp | 1 + Utils/_EnglishText.cpp | 1 + Utils/_FrenchText.cpp | 1 + Utils/_GermanText.cpp | 1 + Utils/_ItalianText.cpp | 1 + Utils/_PolishText.cpp | 1 + Utils/_RussianText.cpp | 1 + 12 files changed, 58 insertions(+) diff --git a/Strategic/Assignments.cpp b/Strategic/Assignments.cpp index 381b640b..4df0893c 100644 --- a/Strategic/Assignments.cpp +++ b/Strategic/Assignments.cpp @@ -6240,6 +6240,34 @@ void HandleDiseaseDiagnosis() } } } + + // loop over the inventory and check for contaminated items + BOOLEAN contaminationfound = FALSE; + INT8 invsize = (INT8)pTeamSoldier->inv.size(); // remember inventorysize, so we don't call size() repeatedly + + for ( INT8 bLoop = 0; bLoop < invsize; ++bLoop ) // ... for all items in our inventory ... + { + if ( pTeamSoldier->inv[bLoop].exists() ) + { + OBJECTTYPE * pObj = &( pTeamSoldier->inv[bLoop] ); // ... get pointer for this item ... + + if ( pObj != NULL ) // ... if pointer is not obviously useless ... + { + for ( INT16 i = 0; i < pObj->ubNumberOfObjects; ++i ) // ... there might be multiple items here (item stack), so for each one ... + { + if ( ( *pObj )[i]->data.sObjectFlag & INFECTED && !( ( *pObj )[i]->data.sObjectFlag & INFECTION_DIAGNOSED ) && Chance( skill ) ) + { + ( *pObj )[i]->data.sObjectFlag |= INFECTION_DIAGNOSED; + + contaminationfound = TRUE; + } + } + } + } + } + + if ( contaminationfound ) + ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_TESTVERSION, szDiseaseText[TEXT_DISEASE_CONTAMINATION_FOUND], pTeamSoldier->GetName() ); } } diff --git a/Tactical/Interface Items.cpp b/Tactical/Interface Items.cpp index 7feabc46..a90caa67 100644 --- a/Tactical/Interface Items.cpp +++ b/Tactical/Interface Items.cpp @@ -4051,6 +4051,26 @@ void INVRenderItem( UINT32 uiBuffer, SOLDIERTYPE * pSoldier, OBJECTTYPE *pObjec gprintfinvalidate( sNewX, sNewY, pStr ); } + // Flugente: if this object is contaminated and we know that, show it + if ( gGameExternalOptions.fDisease && gGameExternalOptions.fDiseaseContaminatesItems && + ( *pObject )[0]->data.sObjectFlag & INFECTED && ( *pObject )[0]->data.sObjectFlag & INFECTION_DIAGNOSED ) + { + if ( !guiASSIGNMENTICONS ) + { + VOBJECT_DESC VObjectDesc; + VObjectDesc.fCreateFlags = VOBJECT_CREATE_FROMFILE; + FilenameForBPP( "INTERFACE\\AssignmentIcons.sti", VObjectDesc.ImageFile ); + AddVideoObject( &VObjectDesc, &guiASSIGNMENTICONS ); + } + + sNewX = sX + 5; // rather arbitrary + sNewY = sY; + + BltVideoObjectFromIndex( guiSAVEBUFFER, guiASSIGNMENTICONS, 28, sNewX, sNewY, VO_BLT_TRANSSHADOW, NULL ); + + RestoreExternBackgroundRect( sNewX, sNewY, 15, 15 ); + } + if ( gGameExternalOptions.fScopeModes && gGameExternalOptions.fDisplayScopeModes && pSoldier && pObject == &(pSoldier->inv[HANDPOS] ) && Item[pSoldier->inv[HANDPOS].usItem].usItemClass == IC_GUN ) { diff --git a/Tactical/Item Types.h b/Tactical/Item Types.h index f33a8143..43b01218 100644 --- a/Tactical/Item Types.h +++ b/Tactical/Item Types.h @@ -824,6 +824,7 @@ extern OBJECTTYPE gTempObject; #define INFECTED 0x0000001000000000 // // this item is infected with disease 0, getting damaged by this will infect you #define DELAYED_GRENADE_EXPLOSION 0x0000002000000000 // // grenade will blow up on next turn +#define INFECTION_DIAGNOSED 0x0000004000000000 // // the player knows that this item is infected // Flugente TODO 2012-09-17: next time we break savegame compatibility, extend the flagmasks from UINT32 to UINT64. I didn't do it this time (see double-used flag above), as we try to minimise those breaks. But it is needed. // ---------------------------------------------------------------- diff --git a/Utils/Text.h b/Utils/Text.h index dd41cef4..e1b2691f 100644 --- a/Utils/Text.h +++ b/Utils/Text.h @@ -2967,6 +2967,7 @@ enum TEXT_DISEASE_UNDIAGNOSED, TEXT_DISEASE_PTSD_BUNS_SPECIAL, + TEXT_DISEASE_CONTAMINATION_FOUND, }; enum diff --git a/Utils/_ChineseText.cpp b/Utils/_ChineseText.cpp index c161bca6..878c5876 100644 --- a/Utils/_ChineseText.cpp +++ b/Utils/_ChineseText.cpp @@ -11008,6 +11008,7 @@ STR16 szDiseaseText[] = L"\n\n%s (未诊断的) - %d / %d\n", //L"\n\n%s (undiagnosed) - %d / %d\n", L"High amount of distress can cause a personality split\n", // TODO.Translate + L"Contaminated items found in %s' inventory.", }; STR16 szSpyText[] = diff --git a/Utils/_DutchText.cpp b/Utils/_DutchText.cpp index b3f38266..0e1e5908 100644 --- a/Utils/_DutchText.cpp +++ b/Utils/_DutchText.cpp @@ -11026,6 +11026,7 @@ STR16 szDiseaseText[] = L"\n\n%s (undiagnosed) - %d / %d\n", // TODO.Translate L"High amount of distress can cause a personality split\n", // TODO.Translate + L"Contaminated items found in %s' inventory.", }; STR16 szSpyText[] = diff --git a/Utils/_EnglishText.cpp b/Utils/_EnglishText.cpp index e91c5da7..b77feb42 100644 --- a/Utils/_EnglishText.cpp +++ b/Utils/_EnglishText.cpp @@ -11010,6 +11010,7 @@ STR16 szDiseaseText[] = L"\n\n%s (undiagnosed) - %d / %d\n", L"High amount of distress can cause a personality split\n", + L"Contaminated items found in %s' inventory.", }; STR16 szSpyText[] = diff --git a/Utils/_FrenchText.cpp b/Utils/_FrenchText.cpp index edcb0427..e6280026 100644 --- a/Utils/_FrenchText.cpp +++ b/Utils/_FrenchText.cpp @@ -11008,6 +11008,7 @@ STR16 szDiseaseText[] = L"\n\n%s (undiagnosed) - %d / %d\n", // TODO.Translate L"High amount of distress can cause a personality split\n", // TODO.Translate + L"Contaminated items found in %s' inventory.", }; STR16 szSpyText[] = diff --git a/Utils/_GermanText.cpp b/Utils/_GermanText.cpp index 12395fce..c0c92f01 100644 --- a/Utils/_GermanText.cpp +++ b/Utils/_GermanText.cpp @@ -10838,6 +10838,7 @@ STR16 szDiseaseText[] = L"\n\n%s (undiagnosed) - %d / %d\n", // TODO.Translate L"High amount of distress can cause a personality split\n", // TODO.Translate + L"Contaminated items found in %s' inventory.", }; STR16 szSpyText[] = diff --git a/Utils/_ItalianText.cpp b/Utils/_ItalianText.cpp index a138f072..4e38e9cb 100644 --- a/Utils/_ItalianText.cpp +++ b/Utils/_ItalianText.cpp @@ -11017,6 +11017,7 @@ STR16 szDiseaseText[] = L"\n\n%s (undiagnosed) - %d / %d\n", // TODO.Translate L"High amount of distress can cause a personality split\n", // TODO.Translate + L"Contaminated items found in %s' inventory.", }; STR16 szSpyText[] = diff --git a/Utils/_PolishText.cpp b/Utils/_PolishText.cpp index 735274f9..97eb74fc 100644 --- a/Utils/_PolishText.cpp +++ b/Utils/_PolishText.cpp @@ -11030,6 +11030,7 @@ STR16 szDiseaseText[] = L"\n\n%s (undiagnosed) - %d / %d\n", // TODO.Translate L"High amount of distress can cause a personality split\n", // TODO.Translate + L"Contaminated items found in %s' inventory.", }; STR16 szSpyText[] = diff --git a/Utils/_RussianText.cpp b/Utils/_RussianText.cpp index 28dd57a8..9b9e2f75 100644 --- a/Utils/_RussianText.cpp +++ b/Utils/_RussianText.cpp @@ -11010,6 +11010,7 @@ STR16 szDiseaseText[] = L"\n\n%s (недиагностирована) - %d / %d\n", L"High amount of distress can cause a personality split\n", // TODO.Translate + L"Contaminated items found in %s' inventory.", }; STR16 szSpyText[] =