Brief: //dnl ch69

- Add alternative fix for CalcBestShot which should remove existing APs problems maybe even create AI deadlier then ever ;-)
Details:
- Existing CalcBestShot simply became inadequate and buggier for so many add ons to game, so compiling with dnlCALCBESTSHOT is alternative option which calculate all turning, stance and raising gun cost for different stances and all available scopes, and after all hoping fix incorrect APs calculation as well, hitrate formula is adapt to 100AP system, also try to optimize a bit to get less AICalcChanceToHitGun calls and to use with different stance decisions.
- From ch58 aiming for burst and autofire was disabled as was causing invalid action handle due to incorrect APs calculation so from now aiming AI also use aiming before bursting.


git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@6403 3b4a5df2-a311-0410-b5c6-a8a6f20db521
This commit is contained in:
Kriplo
2013-09-15 15:59:51 +00:00
parent 2e4a12173a
commit d24b54cb5a
7 changed files with 291 additions and 89 deletions
+24 -19
View File
@@ -126,25 +126,32 @@ typedef struct
} THREATTYPE;
// define for bAimTime for bursting
#define BURSTING 20
#define AUTOFIRING 21
//#define BURSTING 20
//#define AUTOFIRING 21
typedef struct
//dnl ch69 140913
#define dnlCALCBESTSHOT// old CalcBestShot simply became inadequate and buggier for so many add ons to game, so this one is alternative option which calculate all turning, stance and raising gun cost for different stances and all available scopes
class ATTACKTYPE
{
UINT8 ubPossible; // is this attack form possible? T/F
UINT8 ubOpponent; // which soldier is the victim?
//CHANGED STRUCTURE VALUE BY GOTTHARD 7/14/07
INT16 ubAimTime; // how many extra APs to spend on aiming
INT16 ubChanceToReallyHit; // chance to hit * chance to get through cover
//END STRUCTURE CHANGE BY GOTTHARD 7/14/07
INT32 iAttackValue; // relative worthiness of this type of attack
INT32 sTarget; // target gridno of this attack
INT8 bTargetLevel; // target level of this attack
UINT8 ubFriendlyFireChance; // highest chance to hit someone of our guys //dnl ch61 180813
INT16 ubAPCost; // how many APs the attack will use up
INT8 bWeaponIn; // the inv slot of the weapon in question
INT8 bScopeMode; // SANDRO: added for scope mode and alternative weapon holding
} ATTACKTYPE;
public:
UINT8 ubPossible; // is this attack form possible
UINT8 ubOpponent; // which soldier is the victim
//CHANGED STRUCTURE VALUE BY GOTTHARD 7/14/07
INT16 ubAimTime; // how many extra APs to spend on aiming
INT16 ubChanceToReallyHit; // chance to hit * chance to get through cover
//END STRUCTURE CHANGE BY GOTTHARD 7/14/07
INT16 ubAPCost; // how many APs the attack will use up
INT32 iAttackValue; // relative worthiness of this type of attack
INT32 sTarget; // target gridno of this attack
INT8 bTargetLevel; // target level of this attack
INT8 bWeaponIn; // the inv slot of the weapon in question
INT8 bScopeMode; // SANDRO: added for scope mode and alternative weapon holding
UINT8 ubStance; // recommended stance for attack
UINT8 ubFriendlyFireChance; // highest chance to hit someone of our guys //dnl ch61 180813
ATTACKTYPE(void){ InitAttackType(this); }
void InitAttackType(ATTACKTYPE *pAttack);
};
//dnl ch61 180813
#define MAXUNDERFIRE 100
@@ -239,8 +246,6 @@ BOOLEAN InGas( SOLDIERTYPE *pSoldier, INT32 sGridNo );
BOOLEAN InGasOrSmoke( SOLDIERTYPE *pSoldier, INT32 sGridNo );
BOOLEAN InWaterGasOrSmoke( SOLDIERTYPE *pSoldier, INT32 sGridNo );
void InitAttackType(ATTACKTYPE *pAttack);
INT32 InternalGoAsFarAsPossibleTowards(SOLDIERTYPE *pSoldier, INT32 sDesGrid, INT16 bReserveAPs, INT8 bAction, INT8 fFlags );
int LegalNPCDestination(SOLDIERTYPE *pSoldier, INT32 sGridno, UINT8 ubPathMode, UINT8 ubWaterOK, UINT8 fFlags);