mirror of
https://github.com/1dot13/source.git
synced 2026-08-05 14:00:23 +02:00
Mercs can now have multiple disabilities at the same time.
The new fSpecialFlagContractDisability tag for diseases adds a disability every time we are infected with the disease, it is used for PTSD. git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@8826 3b4a5df2-a311-0410-b5c6-a8a6f20db521
This commit is contained in:
@@ -70,6 +70,7 @@ enum
|
||||
|
||||
#define DISEASE_PROPERTY_DISGUSTING 0x00000010 // other merc's will be disgusted by anyone with this disease if broken out
|
||||
#define DISEASE_PROPERTY_PTSD_BUNS 0x00000020 // if Buns has this disease, she can change personality
|
||||
#define DISEASE_PROPERTY_ADD_DISABILITY 0x00000040 // whenever we contract this disease, we gain a new disability
|
||||
|
||||
#define CORPSEREMOVALPOINTSPERCORPSE 1.0f // number of corpse removal points required to, you guessed it, remove a corpse
|
||||
#define DISEASE_PER_ROTTINGCORPSE 100.0f // if a corpse is removed by rotting, add this many disease points to the sector
|
||||
|
||||
@@ -328,6 +328,9 @@ BOOLEAN DoesMercHaveDisability( SOLDIERTYPE *pSoldier, UINT8 aVal )
|
||||
|
||||
if ( pSoldier->newdrugs.drugdisability == aVal )
|
||||
return TRUE;
|
||||
|
||||
if ( pSoldier->usDisabilityFlagMask & ( 1 << aVal ) )
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
|
||||
@@ -1130,6 +1130,7 @@ void SOLDIERTYPE::initialize( )
|
||||
this->iLastArmourProtection = 0;
|
||||
this->usQuickItemId = 0;
|
||||
this->ubQuickItemSlot = 0;
|
||||
this->usDisabilityFlagMask = 0;
|
||||
}
|
||||
|
||||
bool SOLDIERTYPE::exists( )
|
||||
@@ -19227,10 +19228,28 @@ void SOLDIERTYPE::Infect( UINT8 aDisease )
|
||||
return;
|
||||
|
||||
// we are getting infected. Raise our disease points, but not over the level of an infection
|
||||
if ( aDisease < NUM_DISEASES && this->sDiseasePoints[aDisease] < Disease[aDisease].sInfectionPtsInitial )
|
||||
if ( aDisease < NUM_DISEASES && this->sDiseasePoints[aDisease] <= Disease[aDisease].sInfectionPtsInitial )
|
||||
{
|
||||
this->sDiseasePoints[aDisease] = min( this->sDiseasePoints[aDisease] + Disease[aDisease].sInfectionPtsInitial, Disease[aDisease].sInfectionPtsInitial );
|
||||
|
||||
// possibly add a new disability
|
||||
if ( Disease[aDisease].usDiseaseProperties & DISEASE_PROPERTY_ADD_DISABILITY )
|
||||
{
|
||||
// take a random disability we don't yet have and give it to us
|
||||
std::vector<UINT8> disabilitieswedonthaveset;
|
||||
for ( UINT8 i = NO_DISABILITY + 1; i < min( 31, NUM_DISABILITIES ); ++i )
|
||||
{
|
||||
if ( !DoesMercHaveDisability( this, i ) )
|
||||
disabilitieswedonthaveset.push_back(i);
|
||||
}
|
||||
|
||||
if ( !disabilitieswedonthaveset.empty() )
|
||||
{
|
||||
UINT8 newdisability = disabilitieswedonthaveset[Random( disabilitieswedonthaveset.size() )];
|
||||
this->AddDisability( newdisability );
|
||||
}
|
||||
}
|
||||
|
||||
if ( this->sDiseasePoints[aDisease] > Disease[aDisease].sInfectionPtsOutbreak )
|
||||
{
|
||||
this->sDiseaseFlag[aDisease] |= SOLDIERDISEASE_OUTBREAK;
|
||||
@@ -19295,6 +19314,11 @@ void SOLDIERTYPE::AnnounceDisease( UINT8 aDisease )
|
||||
gMercProfiles[this->ubProfile].records.usTimesInfected += 1;
|
||||
}
|
||||
|
||||
void SOLDIERTYPE::AddDisability( UINT8 aDisability )
|
||||
{
|
||||
this->usDisabilityFlagMask |= ( 1 << aDisability );
|
||||
}
|
||||
|
||||
// do we have any disease? fDiagnosedOnly: check for wether we know of this infection fHealableOnly: check wether it can be healed
|
||||
BOOLEAN SOLDIERTYPE::HasDisease( BOOLEAN fDiagnosedOnly, BOOLEAN fHealableOnly, BOOLEAN fSymbolOnly )
|
||||
{
|
||||
@@ -19368,7 +19392,8 @@ void SOLDIERTYPE::PrintDiseaseDesc( CHAR16* apStr, BOOLEAN fFullDesc )
|
||||
fShowExactPoints = TRUE;
|
||||
|
||||
CHAR16 atStr[500];
|
||||
swprintf( atStr, L"" );
|
||||
swprintf( atStr, L"\n \n" );
|
||||
wcscat( apStr, atStr );
|
||||
|
||||
for ( int i = 0; i < NUM_DISEASES; ++i )
|
||||
{
|
||||
@@ -19479,6 +19504,12 @@ void SOLDIERTYPE::PrintDiseaseDesc( CHAR16* apStr, BOOLEAN fFullDesc )
|
||||
swprintf( atStr, szDiseaseText[TEXT_DISEASE_PTSD_BUNS_SPECIAL] );
|
||||
wcscat( apStr, atStr );
|
||||
}
|
||||
|
||||
if ( Disease[i].usDiseaseProperties & DISEASE_PROPERTY_ADD_DISABILITY )
|
||||
{
|
||||
swprintf( atStr, szDiseaseText[TEXT_DISEASE_ADD_DISABILITY] );
|
||||
wcscat( apStr, atStr );
|
||||
}
|
||||
}
|
||||
}
|
||||
else if ( fShowExactPoints && this->sDiseasePoints[i] > 0 )
|
||||
@@ -19600,7 +19631,8 @@ void SOLDIERTYPE::PrintSleepDesc( CHAR16* apStr )
|
||||
return;
|
||||
|
||||
CHAR16 atStr[100];
|
||||
swprintf( atStr, L"" );
|
||||
swprintf( atStr, L"\n \n" );
|
||||
wcscat( apStr, atStr );
|
||||
|
||||
swprintf( atStr, gpStrategicString[STR_BREATH_REGEN_SLEEP], this->GetSleepBreathRegeneration( ) );
|
||||
wcscat( apStr, atStr );
|
||||
|
||||
@@ -1579,6 +1579,8 @@ public:
|
||||
|
||||
UINT32 usIndividualMilitiaID; // Flugente: if this is a militia, this is the ID of the militia data
|
||||
|
||||
// Flugente: store disabilities as a flagmask, so we can have multiple ones
|
||||
UINT32 usDisabilityFlagMask;
|
||||
|
||||
#ifdef JA2UB
|
||||
//ja25
|
||||
@@ -1958,6 +1960,7 @@ public:
|
||||
void Infect( UINT8 aDisease );
|
||||
void AddDiseasePoints( UINT8 aDisease, INT32 aVal );
|
||||
void AnnounceDisease( UINT8 aDisease );
|
||||
void AddDisability( UINT8 aDisability );
|
||||
|
||||
// do we have any disease?
|
||||
// fDiagnosedOnly: check for wether we know of this infection
|
||||
|
||||
@@ -83,6 +83,7 @@ diseaseStartElementHandle( void *userData, const XML_Char *name, const XML_Char
|
||||
strcmp( name, "fHideSymbol" ) == 0 ||
|
||||
strcmp( name, "fDisgusting" ) == 0 ||
|
||||
strcmp( name, "fSpecialFlagPTSDBuns" ) == 0 ||
|
||||
strcmp( name, "fSpecialFlagContractDisability" ) == 0 ||
|
||||
strcmp( name, "sEffStatAGI" ) == 0 ||
|
||||
strcmp( name, "sEffStatDEX" ) == 0 ||
|
||||
strcmp( name, "sEffStatSTR" ) == 0 ||
|
||||
@@ -309,6 +310,12 @@ diseaseEndElementHandle( void *userData, const XML_Char *name )
|
||||
if ( atol( pData->szCharData ) )
|
||||
pData->curItem.usDiseaseProperties |= DISEASE_PROPERTY_PTSD_BUNS;
|
||||
}
|
||||
else if ( strcmp( name, "fSpecialFlagContractDisability" ) == 0 )
|
||||
{
|
||||
pData->curElement = ELEMENT;
|
||||
if ( atol( pData->szCharData ) )
|
||||
pData->curItem.usDiseaseProperties |= DISEASE_PROPERTY_ADD_DISABILITY;
|
||||
}
|
||||
else if ( strcmp( name, "sEffStatAGI" ) == 0 )
|
||||
{
|
||||
pData->curElement = ELEMENT;
|
||||
@@ -488,6 +495,7 @@ BOOLEAN WriteDiseaseStats( )
|
||||
FilePrintf( hFile, "\t\t<fHideSymbol>%d</fHideSymbol>\r\n", (Disease[cnt].usDiseaseProperties & DISEASE_PROPERTY_HIDESYMBOL) ? 1 : 0 );
|
||||
FilePrintf( hFile, "\t\t<fDisgusting>%d</fDisgusting>\r\n", (Disease[cnt].usDiseaseProperties & DISEASE_PROPERTY_DISGUSTING) ? 1 : 0 );
|
||||
FilePrintf( hFile, "\t\t<fSpecialFlagPTSDBuns>%d</fSpecialFlagPTSDBuns>\r\n", ( Disease[cnt].usDiseaseProperties & DISEASE_PROPERTY_PTSD_BUNS ) ? 1 : 0 );
|
||||
FilePrintf( hFile, "\t\t<fSpecialFlagContractDisability>%d</fSpecialFlagContractDisability>\r\n", ( Disease[cnt].usDiseaseProperties & DISEASE_PROPERTY_ADD_DISABILITY ) ? 1 : 0 );
|
||||
FilePrintf( hFile, "\t\t<sEffStatAGI>%d</sEffStatAGI>\r\n", Disease[cnt].sEffStat[INFST_AGI] );
|
||||
FilePrintf( hFile, "\t\t<sEffStatDEX>%d</sEffStatDEX>\r\n", Disease[cnt].sEffStat[INFST_DEX] );
|
||||
FilePrintf( hFile, "\t\t<sEffStatSTR>%d</sEffStatSTR>\r\n", Disease[cnt].sEffStat[INFST_STR] );
|
||||
|
||||
Reference in New Issue
Block a user