diff --git a/Tactical/Disease.cpp b/Tactical/Disease.cpp index 775d5946..8510c56c 100644 --- a/Tactical/Disease.cpp +++ b/Tactical/Disease.cpp @@ -390,6 +390,9 @@ void HandleDisease() // chance gets modified by aModifier (contextual modifier) void HandlePossibleInfection( SOLDIERTYPE *pSoldier, SOLDIERTYPE* pOtherSoldier, UINT8 aInfectionType, FLOAT aModifier, BOOLEAN fStrategicOnly ) { + if ( !gGameExternalOptions.fDisease ) + return; + // only for living mercs with a profile with a valid infection method if ( !pSoldier || pSoldier->flags.uiStatusFlags & SOLDIER_VEHICLE || pSoldier->ubProfile == NO_PROFILE || aInfectionType >= INFECTION_TYPE_MAX ) return; diff --git a/Tactical/Handle Items.cpp b/Tactical/Handle Items.cpp index 60f81956..2bb7ebd2 100644 --- a/Tactical/Handle Items.cpp +++ b/Tactical/Handle Items.cpp @@ -5250,10 +5250,9 @@ void CorpseMessageBoxCallBack( UINT8 ubExitValue ) // we might get a disease from this... // if the corpse is already rotting, chance of infection is greatly increased - FLOAT modifier = 1.0f; ROTTING_CORPSE *pCorpse = GetCorpseAtGridNo( nextGridNoinSight, level ); - if ( pCorpse->def.ubType == ROTTING_STAGE2 ) - modifier = 5.0f; + + FLOAT modifier = GetCorpseRotFactor( pCorpse ); HandlePossibleInfection( gpTempSoldier, NULL, INFECTION_TYPE_CONTACT_CORPSE, modifier ); } diff --git a/Tactical/Rotting Corpses.cpp b/Tactical/Rotting Corpses.cpp index 1dea8be4..b6dcad3d 100644 --- a/Tactical/Rotting Corpses.cpp +++ b/Tactical/Rotting Corpses.cpp @@ -3105,3 +3105,15 @@ BOOLEAN CorpseOkToDress( ROTTING_CORPSE* pCorpse ) return FALSE; } + +// Flugente: how rotten is this corpse? values from 0 to 1, 1 as soon as it is rotting +FLOAT GetCorpseRotFactor( ROTTING_CORPSE* pCorpse ) +{ + if ( !pCorpse ) + return 0.0f; + + if ( pCorpse->def.ubType == ROTTING_STAGE2 ) + return 1.0f; + + return (GetWorldTotalMin( ) - pCorpse->def.uiTimeOfDeath) / DELAY_UNTIL_ROTTING; +} \ No newline at end of file diff --git a/Tactical/Rotting Corpses.h b/Tactical/Rotting Corpses.h index 542adcc4..ba35fa43 100644 --- a/Tactical/Rotting Corpses.h +++ b/Tactical/Rotting Corpses.h @@ -236,4 +236,7 @@ UINT8 GetNearestRottingCorpseAIWarning( INT32 sGridNo ); // Flugente: can we take the clothes of this corpse? BOOLEAN CorpseOkToDress( ROTTING_CORPSE* pCorpse ); +// Flugente: how rotten is this corpse? values from 0 to 1, 1 as soon as it is rotting +FLOAT GetCorpseRotFactor( ROTTING_CORPSE* pCorpse ); + #endif \ No newline at end of file diff --git a/Tactical/Soldier Control.cpp b/Tactical/Soldier Control.cpp index 681e9928..0b8890d5 100644 --- a/Tactical/Soldier Control.cpp +++ b/Tactical/Soldier Control.cpp @@ -18668,6 +18668,9 @@ void SOLDIERTYPE::DeleteBoxingFlag( ) // Flugente: disease void SOLDIERTYPE::Infect( UINT8 aDisease ) { + if ( !gGameExternalOptions.fDisease ) + 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 ) { @@ -18692,13 +18695,15 @@ void SOLDIERTYPE::Infect( UINT8 aDisease ) } // remove later on, for testing only - if ( 1 ) - ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_INTERFACE, L"%s was infected with %s", gMercProfiles[this->ubProfile].zNickname, Disease[aDisease].szName ); + //ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_INTERFACE, L"%s was infected with %s", gMercProfiles[this->ubProfile].zNickname, Disease[aDisease].szName ); } } void SOLDIERTYPE::AddDiseasePoints( UINT8 aDisease, INT32 aVal ) { + if ( !gGameExternalOptions.fDisease ) + return; + if ( aDisease < NUM_DISEASES ) { this->sDiseasePoints[aDisease] = min( Disease[aDisease].sInfectionPtsFull, max( this->sDiseasePoints[aDisease] + aVal, -Disease[aDisease].sInfectionPtsOutbreak ) ); @@ -18740,6 +18745,9 @@ void SOLDIERTYPE::AnnounceDisease( UINT8 aDisease ) // 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 ) { + if ( !gGameExternalOptions.fDisease ) + return FALSE; + for ( int i = 0; i < NUM_DISEASES; ++i ) { // disease is relevant if we are infected and are not looking for symbols only while the disease has no symbol @@ -18774,6 +18782,9 @@ FLOAT SOLDIERTYPE::GetDiseaseMagnitude( UINT8 aDisease ) void SOLDIERTYPE::PrintDiseaseDesc( CHAR16* apStr, BOOLEAN fFullDesc ) { + if ( !gGameExternalOptions.fDisease ) + return; + // only for living mercs with a profile with a valid infection method if ( this->flags.uiStatusFlags & SOLDIER_VEHICLE || this->ubProfile == NO_PROFILE ) return;