- updated NCTH targeting optics in Interface.cpp to use the same order and formulas as LOS.cpp. It's easier to read and compare this way.

- added scope effectiveness which defines the maximum magnification bonus a shooter can get using scopes. With the default settings a poor shooter like Juan will not benefit much from scopes while a good shooter will use the full potential. See also:
http://www.ja-galaxy-forum.com/board/ubbthreads.php/topics/330194/Re:_Cth/INI_Settings_for_new_s.html#Post330194
http://www.ja-galaxy-forum.com/board/ubbthreads.php/topics/330236/Re:_Cth/INI_Settings_for_new_s.html#Post330236


git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@6870 3b4a5df2-a311-0410-b5c6-a8a6f20db521
This commit is contained in:
silversurfer
2014-02-02 10:02:13 +00:00
parent 25952e5c50
commit 5d953b550c
6 changed files with 104 additions and 34 deletions
+7 -3
View File
@@ -9032,14 +9032,18 @@ UINT32 AICalcChanceToHitGun(SOLDIERTYPE *pSoldier, INT32 sGridNo, INT16 ubAimTim
// distance to target
FLOAT d2DDistance = (FLOAT) PythSpacesAway( pSoldier->sGridNo, sGridNo ) * (FLOAT) CELL_X_SIZE;
// magnification (1.0 or higher if scope is used)
FLOAT dMagFactor = CalcMagFactor( pSoldier, &(pSoldier->inv[pSoldier->ubAttackingHand]), d2DDistance, sGridNo, (UINT8)ubAimTime );
// basic aperture that is equal for everyone
FLOAT dBasicAperture = CalcBasicAperture( );
// aperture at target distance without magnification
FLOAT dAperture = dBasicAperture * (d2DDistance / gGameCTHConstants.NORMAL_SHOOTING_DISTANCE);
// magnification (1.0 or higher if scope is used)
FLOAT dMagFactor = CalcMagFactor( pSoldier, &(pSoldier->inv[pSoldier->ubAttackingHand]), d2DDistance, sGridNo, (UINT8)ubAimTime );
// Get effective mag factor for this shooter. This represents his ability to use scopes.
FLOAT fEffectiveMagFactor = CalcEffectiveMagFactor( pSoldier, dMagFactor );
// modify aperture with magnification
dAperture = dAperture / dMagFactor;
dAperture = dAperture / fEffectiveMagFactor;
// real aperture for shooter based on CTH calculation
dAperture = dAperture * ( 100 - uiChance ) / 100.0f;