From a87707b36b1dbbc1b8056bf8255b638e6b0df77d Mon Sep 17 00:00:00 2001 From: Flugente Date: Sun, 17 Feb 2019 19:46:53 +0000 Subject: [PATCH] If LOWER_VISION_WHILE_RUNNING in JA2_Options.ini is set to 1 (default 0), vision range is lowered by 25% while running (2: only for player team) git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@8669 3b4a5df2-a311-0410-b5c6-a8a6f20db521 --- GameSettings.cpp | 2 +- GameSettings.h | 1 + Tactical/Soldier Control.cpp | 12 ++++++++++++ 3 files changed, 14 insertions(+), 1 deletion(-) diff --git a/GameSettings.cpp b/GameSettings.cpp index 4688368b..d121b68d 100644 --- a/GameSettings.cpp +++ b/GameSettings.cpp @@ -1246,7 +1246,7 @@ void LoadGameExternalOptions() // Tunnel Vision gGameExternalOptions.gfAllowLimitedVision = iniReader.ReadBoolean("Tactical Vision Settings","ALLOW_TUNNEL_VISION",0); - + gGameExternalOptions.usLowerVisionWhileRunning = iniReader.ReadInteger("Tactical Vision Settings", "LOWER_VISION_WHILE_RUNNING", 0, 0, 2 ); //################# Tactical Tooltip Settings ################# diff --git a/GameSettings.h b/GameSettings.h index 93e74395..33ec0f61 100644 --- a/GameSettings.h +++ b/GameSettings.h @@ -577,6 +577,7 @@ typedef struct INT8 ubBrightnessVisionMod[16]; BOOLEAN gfAllowLimitedVision; + UINT8 usLowerVisionWhileRunning; BOOLEAN gfShiftFUnloadWeapons; BOOLEAN gfShiftFRemoveAttachments; diff --git a/Tactical/Soldier Control.cpp b/Tactical/Soldier Control.cpp index 660c7b9c..ec25cea8 100644 --- a/Tactical/Soldier Control.cpp +++ b/Tactical/Soldier Control.cpp @@ -14808,6 +14808,18 @@ INT16 SOLDIERTYPE::GetSightRangeBonus( ) if ( DoesMercHaveDisability( this, SHORTSIGHTED ) ) bonus -= 10; + if ( (gGameExternalOptions.usLowerVisionWhileRunning == 1) || ( gGameExternalOptions.usLowerVisionWhileRunning == 2 && bTeam == gbPlayerNum ) ) + { + // Flugente: We have to decide depending on the animation we have, otherwise we can cause bugs if we do this after being hit by an explosion etc. + switch ( this->usAnimState ) + { + case RUNNING: + case RUNNING_W_PISTOL: + bonus -= 25; + break; + } + } + return bonus; }