mirror of
https://github.com/1dot13/source.git
synced 2026-08-05 14:00:23 +02:00
Fixes (by Sevenfm):
- put back AIM_VISIBILITY calculation in function "CalcNewChanceToHitGun" - fixed possible NULL pointer condition Added an indicator to the NCTH cursor to show aiming penalty for moving target. git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@8294 3b4a5df2-a311-0410-b5c6-a8a6f20db521
This commit is contained in:
+11
-1
@@ -5317,7 +5317,7 @@ UINT32 CalcNewChanceToHitGun(SOLDIERTYPE *pSoldier, INT32 sGridNo, INT16 ubAimTi
|
||||
if (iSightRange == 0) { // didn't do a bodypart-based test or can't see specific body part aimed at
|
||||
iSightRange = SoldierTo3DLocationLineOfSightTest( pSoldier, sGridNo, pSoldier->bTargetLevel, pSoldier->bTargetCubeLevel, TRUE, NO_DISTANCE_LIMIT, false );
|
||||
}
|
||||
if (iSightRange == 0) { // Can't see the target but we still need to know what the sight range would be if we could so we can deal with cover penalties
|
||||
if (ubTargetID != NOBODY && iSightRange == 0) { // Can't see the target but we still need to know what the sight range would be if we could so we can deal with cover penalties
|
||||
iSightRange = SoldierToSoldierLineOfSightTest( pSoldier, MercPtrs[ubTargetID], TRUE, NO_DISTANCE_LIMIT, pSoldier->bAimShotLocation, false, true );
|
||||
fCantSeeTarget = true;
|
||||
}
|
||||
@@ -5519,6 +5519,16 @@ UINT32 CalcNewChanceToHitGun(SOLDIERTYPE *pSoldier, INT32 sGridNo, INT16 ubAimTi
|
||||
// get aimbonus from target
|
||||
fAimModifier += CalcNewChanceToHitAimTargetBonus(pSoldier, pTarget, sGridNo, iRange, ubAimPos, fCantSeeTarget);
|
||||
|
||||
// apply a penalty if target cannot clearly be seen
|
||||
// if target is clearly visible iSightRange == iRange otherwise it is higher
|
||||
if (iRange > 0 && iSightRange > iRange && !fCantSeeTarget)
|
||||
{
|
||||
FLOAT fTempPenalty = (FLOAT)((FLOAT)iSightRange / (FLOAT)iRange);
|
||||
fTempPenalty = (FLOAT)(100 / fTempPenalty);
|
||||
fAimModifier += ((100-fTempPenalty) * gGameCTHConstants.AIM_VISIBILITY)/100;
|
||||
fAimModifier = __max( gGameCTHConstants.AIM_TARGET_INVISIBLE, fAimModifier );
|
||||
}
|
||||
|
||||
// factor in scopes under their range
|
||||
if ( !pSoldier->IsValidAlternativeFireMode( ubAimTime, sGridNo ) )
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user