From a2be5b06c279c6b9ee292a40e30afe2cee938242 Mon Sep 17 00:00:00 2001 From: silversurfer Date: Wed, 10 Sep 2014 12:16:45 +0000 Subject: [PATCH] added new option to CTHConstants.ini: IRON_SIGHTS_MAX_APERTURE_MODIFIER = 3.0 This modifies how fast the aperture grows for iron sights when IRON_SIGHTS_MAX_APERTURE_USE_GRADIENT = TRUE git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@7504 3b4a5df2-a311-0410-b5c6-a8a6f20db521 --- GameSettings.cpp | 1 + GameSettings.h | 1 + Tactical/Interface.cpp | 3 ++- Tactical/LOS.cpp | 3 ++- Tactical/Weapons.cpp | 3 ++- 5 files changed, 8 insertions(+), 3 deletions(-) diff --git a/GameSettings.cpp b/GameSettings.cpp index c008af8f..2bb86d56 100644 --- a/GameSettings.cpp +++ b/GameSettings.cpp @@ -3226,6 +3226,7 @@ void LoadCTHConstants() gGameCTHConstants.LASER_PERFORMANCE_BONUS_SCOPE = iniReader.ReadFloat("General","LASER_PERFORMANCE_BONUS_SCOPE", 0.0f, 0.0f, 50.0f); gGameCTHConstants.DEGREES_MAXIMUM_APERTURE = iniReader.ReadFloat("General", "DEGREES_MAXIMUM_APERTURE", 15.0, 0.0, 22.5); gGameCTHConstants.IRON_SIGHTS_MAX_APERTURE_USE_GRADIENT = iniReader.ReadBoolean("General", "IRON_SIGHTS_MAX_APERTURE_USE_GRADIENT", FALSE); + gGameCTHConstants.IRON_SIGHTS_MAX_APERTURE_MODIFIER = iniReader.ReadFloat("General", "IRON_SIGHTS_MAX_APERTURE_MODIFIER", 3.0f, 2.0f, 5.0f); gGameCTHConstants.RANGE_COEFFICIENT = iniReader.ReadFloat("General", "RANGE_COEFFICIENT", 2.0, 0.001f, 100.0); gGameCTHConstants.GRAVITY_COEFFICIENT = iniReader.ReadFloat("General", "GRAVITY_COEFFICIENT", 1.0, 0.001f, 100.0); gGameCTHConstants.VERTICAL_BIAS = iniReader.ReadFloat("General", "VERTICAL_BIAS", 1.0f, 0.01f, 2.0f); diff --git a/GameSettings.h b/GameSettings.h index 6f700945..7c24d356 100644 --- a/GameSettings.h +++ b/GameSettings.h @@ -1933,6 +1933,7 @@ typedef struct FLOAT LASER_PERFORMANCE_BONUS_SCOPE; // percentage bonus to base aperture size for laser pointers when using scopes FLOAT DEGREES_MAXIMUM_APERTURE; // Maximum possible aperture for a 100% muzzle sway shot. Decrease to make all shots more accurate. BOOLEAN IRON_SIGHTS_MAX_APERTURE_USE_GRADIENT; // Use new curve instead of linear function to get the max aperture at target range for iron sights. + FLOAT IRON_SIGHTS_MAX_APERTURE_MODIFIER; // Modifier that is used to make aperture grow slower/faster when IRON_SIGHTS_MAX_APERTURE_USE_GRADIENT is TRUE. FLOAT RANGE_COEFFICIENT; // Determines maximum range which decides when gravity forces bullets to drop FLOAT GRAVITY_COEFFICIENT; // Changes the way gravity works in the game. Higher values mean bullets don't drop as quickly after reaching max range. FLOAT VERTICAL_BIAS; // This float can be used to reduce the chance of missing too far upwards or downwards (compared to left/right). diff --git a/Tactical/Interface.cpp b/Tactical/Interface.cpp index b4f1c701..2de06bbe 100644 --- a/Tactical/Interface.cpp +++ b/Tactical/Interface.cpp @@ -2560,7 +2560,8 @@ BOOLEAN DrawCTHIndicator() // At 1 tile distance iBasicAperture will be the same as before. That's the common start. if ( gGameCTHConstants.IRON_SIGHTS_MAX_APERTURE_USE_GRADIENT && gCTHDisplay.ScopeMagFactor <= 1.0 && !pSoldier->IsValidAlternativeFireMode( pSoldier->aiData.bAimTime, gCTHDisplay.iTargetGridNo ) ) - iBasicAperture = iBasicAperture * ( 1 / sqrt( d2DDistance / FLOAT(CELL_X_SIZE) ) / 4.0 + 0.75 ); + iBasicAperture = iBasicAperture * ( 1 / sqrt( d2DDistance / FLOAT(CELL_X_SIZE) ) / gGameCTHConstants.IRON_SIGHTS_MAX_APERTURE_MODIFIER + + (gGameCTHConstants.IRON_SIGHTS_MAX_APERTURE_MODIFIER - 1) / gGameCTHConstants.IRON_SIGHTS_MAX_APERTURE_MODIFIER ); // iron sights can get a percentage bonus to make them overall better but only when not shooting from hip if ( gCTHDisplay.ScopeMagFactor <= 1.0 && !pSoldier->IsValidAlternativeFireMode( pSoldier->aiData.bAimTime, gCTHDisplay.iTargetGridNo ) ) diff --git a/Tactical/LOS.cpp b/Tactical/LOS.cpp index 4384df52..3fbaec08 100644 --- a/Tactical/LOS.cpp +++ b/Tactical/LOS.cpp @@ -7820,7 +7820,8 @@ void AdjustTargetCenterPoint( SOLDIERTYPE *pShooter, INT32 iTargetGridNo, FLOAT // At 1 tile distance iBasicAperture will be the same as before. That's the common start. if ( gGameCTHConstants.IRON_SIGHTS_MAX_APERTURE_USE_GRADIENT && gCTHDisplay.ScopeMagFactor <= 1.0 && !pShooter->IsValidAlternativeFireMode( pShooter->aiData.bAimTime, gCTHDisplay.iTargetGridNo ) ) - iBasicAperture = iBasicAperture * ( 1 / sqrt( d2DDistance / FLOAT(CELL_X_SIZE) ) / 4.0 + 0.75 ); + iBasicAperture = iBasicAperture * ( 1 / sqrt( d2DDistance / FLOAT(CELL_X_SIZE) ) / gGameCTHConstants.IRON_SIGHTS_MAX_APERTURE_MODIFIER + + (gGameCTHConstants.IRON_SIGHTS_MAX_APERTURE_MODIFIER - 1) / gGameCTHConstants.IRON_SIGHTS_MAX_APERTURE_MODIFIER ); // iron sights can get a percentage bonus to make them overall better but only when not shooting from hip if ( gCTHDisplay.ScopeMagFactor <= 1.0 && !pShooter->IsValidAlternativeFireMode( pShooter->aiData.bAimTime, gCTHDisplay.iTargetGridNo ) ) diff --git a/Tactical/Weapons.cpp b/Tactical/Weapons.cpp index a2267563..2a010b6b 100644 --- a/Tactical/Weapons.cpp +++ b/Tactical/Weapons.cpp @@ -9110,7 +9110,8 @@ UINT32 AICalcChanceToHitGun(SOLDIERTYPE *pSoldier, INT32 sGridNo, INT16 ubAimTim // At 1 tile distance iBasicAperture will be the same as before. That's the common start. if ( gGameCTHConstants.IRON_SIGHTS_MAX_APERTURE_USE_GRADIENT && dMagFactor <= 1.0 && !pSoldier->IsValidAlternativeFireMode( ubAimTime, sGridNo ) ) - dBasicAperture = dBasicAperture * ( 1 / sqrt( d2DDistance / FLOAT(CELL_X_SIZE) ) / 4.0 + 0.75 ); + dBasicAperture = dBasicAperture * ( 1 / sqrt( d2DDistance / FLOAT(CELL_X_SIZE) ) / gGameCTHConstants.IRON_SIGHTS_MAX_APERTURE_MODIFIER + + (gGameCTHConstants.IRON_SIGHTS_MAX_APERTURE_MODIFIER - 1) / gGameCTHConstants.IRON_SIGHTS_MAX_APERTURE_MODIFIER ); // iron sights can get a percentage bonus to make them overall better but only when not shooting from hip if ( dMagFactor <= 1.0 && !pSoldier->IsValidAlternativeFireMode( ubAimTime, sGridNo ) )