59. Brief: //dnl ch59

- Fix problem AI cannot fire when mercs are on roof, AI calculate chance to hit from all stances.
Details:
- Sometimes AI not fire when target is on roof, happens in situation when previous target was on ground because bLevel was not update.
- Instead to calculate ChanceToHit only from STANDING from now AI calculate chance for all stances, so AI should be more eager to attack.


git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@6311 3b4a5df2-a311-0410-b5c6-a8a6f20db521
This commit is contained in:
Kriplo
2013-08-24 20:17:16 +00:00
parent 1adc9c542c
commit 123b46f2c8
3 changed files with 26 additions and 13 deletions
+6 -2
View File
@@ -8644,16 +8644,20 @@ UINT32 CalcChanceToHitGun(SOLDIERTYPE *pSoldier, INT32 sGridNo, INT16 ubAimTime,
return (iChance);*/
}
UINT32 AICalcChanceToHitGun(SOLDIERTYPE *pSoldier, INT32 sGridNo, INT16 ubAimTime, UINT8 ubAimPos )
UINT32 AICalcChanceToHitGun(SOLDIERTYPE *pSoldier, INT32 sGridNo, INT16 ubAimTime, UINT8 ubAimPos, INT8 bTargetLevel, UINT16 usAnimState)//dnl ch59 180813
{
INT8 bTrueLevel;//dnl ch59 180813 if target is above ground CalcChanceToHitGun will return 0 because pSoldier->bTargetLevel contains some old values from previous target which was on ground level
UINT16 usTrueState;
UINT32 uiChance;
// same as CCTHG but fakes the attacker always standing
usTrueState = pSoldier->usAnimState;
pSoldier->usAnimState = STANDING;
bTrueLevel = pSoldier->bTargetLevel;
pSoldier->bTargetLevel = bTargetLevel;
pSoldier->usAnimState = usAnimState;
uiChance = CalcChanceToHitGun( pSoldier, sGridNo, ubAimTime, ubAimPos );
pSoldier->usAnimState = usTrueState;
pSoldier->bTargetLevel = bTrueLevel;
if(UsingNewCTHSystem() == true)
{
////////////////////////////////////////////////////////////////////////////////////