From 8de2a8601e9f73a83b8d00e7d3053380a606292f Mon Sep 17 00:00:00 2001 From: Flugente Date: Fri, 29 Sep 2017 19:48:32 +0000 Subject: [PATCH] New: if REDUCED_INSTANT_DEATH is TRUE, damage from guns/knives that would normally instantly kill non-comatose player-controlled mercs is lowered so that they instead fall into a coma (and can be saved by other mercs) (by sevenfm) git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@8485 3b4a5df2-a311-0410-b5c6-a8a6f20db521 --- GameSettings.cpp | 3 +++ GameSettings.h | 1 + Tactical/Soldier Control.cpp | 13 ++++++++++++- 3 files changed, 16 insertions(+), 1 deletion(-) diff --git a/GameSettings.cpp b/GameSettings.cpp index 7d0463819..c0b458877 100644 --- a/GameSettings.cpp +++ b/GameSettings.cpp @@ -1423,6 +1423,9 @@ void LoadGameExternalOptions() gGameExternalOptions.fNoEnemyAutoReadyWeapon = iniReader.ReadInteger("Tactical Gameplay Settings", "NO_ENEMY_AUTOMATIC_WEAPON_READYING", 1, 0, 2); + // Flugente/sevenfm: player-controlled mercs won't die instantly from most damage, instead they fall into a coma + gGameExternalOptions.fReducedInstantDeath = iniReader.ReadBoolean("Tactical Gameplay Settings", "REDUCED_INSTANT_DEATH", FALSE); + // enable schedules and decision making for any named npc regardless of their team gGameExternalOptions.fAllNamedNpcsDecideAction = iniReader.ReadBoolean("Tactical Gameplay Settings", "ALL_NAMED_NPCS_DECIDE_ACTION", FALSE); diff --git a/GameSettings.h b/GameSettings.h index f880e4208..86f12c624 100644 --- a/GameSettings.h +++ b/GameSettings.h @@ -363,6 +363,7 @@ typedef struct BOOLEAN fAllowInstantInterruptsOnSight; BOOLEAN fNoEnemyAutoReadyWeapon; + BOOLEAN fReducedInstantDeath; BOOLEAN fAllNamedNpcsDecideAction; UINT16 usAwardSpecialExpForQuests; diff --git a/Tactical/Soldier Control.cpp b/Tactical/Soldier Control.cpp index 344388039..0307497c9 100644 --- a/Tactical/Soldier Control.cpp +++ b/Tactical/Soldier Control.cpp @@ -6046,7 +6046,18 @@ void SOLDIERTYPE::EVENT_SoldierGotHit( UINT16 usWeaponIndex, INT16 sDamage, INT1 return; } - // DEDUCT LIFE + // sevenfm: player mercs should not die instantly + if (gGameExternalOptions.fReducedInstantDeath && + this->flags.uiStatusFlags & SOLDIER_PC && + this->stats.bLife >= OKLIFE && + ubSpecial != FIRE_WEAPON_HEAD_EXPLODE_SPECIAL && + ubSpecial != FIRE_WEAPON_CHEST_EXPLODE_SPECIAL && + Item[usWeaponIndex].usItemClass & (IC_GUN | IC_THROWING_KNIFE | IC_BLADE)) + { + sDamage = __min(sDamage, this->stats.bLife - OKLIFE + 1 + sDamage / 10); + } + + // DEDUCT LIFE ubCombinedLoss = this->SoldierTakeDamage( ANIM_CROUCH, sDamage, sBreathLoss, ubReason, this->ubAttackerID, NOWHERE, FALSE, TRUE ); // ATE: OK, Let's check our ASSIGNMENT state,