'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
This commit is contained in:
Flugente
2018-08-15 19:20:08 +00:00
parent 7246b671f8
commit 2e86f6c0ef
12 changed files with 58 additions and 0 deletions
+28
View File
@@ -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() );
}
}
+20
View File
@@ -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 )
{
+1
View File
@@ -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.
// ----------------------------------------------------------------
+1
View File
@@ -2967,6 +2967,7 @@ enum
TEXT_DISEASE_UNDIAGNOSED,
TEXT_DISEASE_PTSD_BUNS_SPECIAL,
TEXT_DISEASE_CONTAMINATION_FOUND,
};
enum
+1
View File
@@ -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[] =
+1
View File
@@ -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[] =
+1
View File
@@ -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[] =
+1
View File
@@ -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[] =
+1
View File
@@ -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[] =
+1
View File
@@ -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[] =
+1
View File
@@ -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[] =
+1
View File
@@ -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[] =