mirror of
https://github.com/1dot13/source.git
synced 2026-07-22 13:40:22 +02:00
- Fix: disease notification should not be visible to the player
- Fix: disease infection happened even though disease feaure was off - Disease Improvement: infection chance by corpse is now affected by age of corpse git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@7486 3b4a5df2-a311-0410-b5c6-a8a6f20db521
This commit is contained in:
@@ -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;
|
||||
|
||||
@@ -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 );
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
@@ -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
|
||||
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user