mirror of
https://github.com/1dot13/source.git
synced 2026-07-29 13:52:17 +02:00
100AP project integration
git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@2402 3b4a5df2-a311-0410-b5c6-a8a6f20db521
This commit is contained in:
@@ -17,6 +17,7 @@ extern BOOLEAN gfTurnBasedAI;
|
||||
#define ACTING_ON_SCHEDULE( p ) ( (p)->aiData.fAIFlags & AI_CHECK_SCHEDULE )
|
||||
|
||||
// the AI should try to have this many APs before climbing a roof, if possible
|
||||
//THIS IS NOT EXTERNALIZED!!! CHECK THIS! GOTTHARD 7/2/08
|
||||
#define AI_AP_CLIMBROOF 15
|
||||
|
||||
#define TEMPORARILY 0
|
||||
@@ -121,12 +122,14 @@ typedef struct
|
||||
{
|
||||
UINT8 ubPossible; // is this attack form possible? T/F
|
||||
UINT8 ubOpponent; // which soldier is the victim?
|
||||
UINT8 ubAimTime; // how many extra APs to spend on aiming
|
||||
UINT8 ubChanceToReallyHit; // chance to hit * chance to get through cover
|
||||
//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
|
||||
INT16 sTarget; // target gridno of this attack
|
||||
INT8 bTargetLevel; // target level of this attack
|
||||
UINT8 ubAPCost; // how many APs the attack will use up
|
||||
INT16 ubAPCost; // how many APs the attack will use up
|
||||
INT8 bWeaponIn; // the inv slot of the weapon in question
|
||||
} ATTACKTYPE;
|
||||
|
||||
@@ -173,8 +176,8 @@ void DecideAlertStatus( SOLDIERTYPE *pSoldier );
|
||||
INT8 DecideAutoBandage( SOLDIERTYPE * pSoldier );
|
||||
UINT16 DetermineMovementMode( SOLDIERTYPE * pSoldier, INT8 bAction );
|
||||
|
||||
INT32 EstimateShotDamage(SOLDIERTYPE *pSoldier, SOLDIERTYPE *pOpponent, UINT8 ubChanceToHit);
|
||||
INT32 EstimateStabDamage(SOLDIERTYPE *pSoldier, SOLDIERTYPE *pOpponent, UINT8 ubChanceToHit, BOOLEAN fBladeAttack);
|
||||
INT32 EstimateShotDamage(SOLDIERTYPE *pSoldier, SOLDIERTYPE *pOpponent, INT16 ubChanceToHit);
|
||||
INT32 EstimateStabDamage(SOLDIERTYPE *pSoldier, SOLDIERTYPE *pOpponent, INT16 ubChanceToHit, BOOLEAN fBladeAttack);
|
||||
INT32 EstimateThrowDamage(SOLDIERTYPE *pSoldier, UINT8 ubItemPos, SOLDIERTYPE *pOpponent, INT16 sGridno);
|
||||
INT16 EstimatePathCostToLocation( SOLDIERTYPE * pSoldier, INT16 sDestGridNo, INT8 bDestLevel, BOOLEAN fAddCostAfterClimbingUp, BOOLEAN * pfClimbingNecessary, INT16 * psClimbGridNo );
|
||||
|
||||
@@ -194,7 +197,7 @@ BOOLEAN InWaterGasOrSmoke( SOLDIERTYPE *pSoldier, INT16 sGridNo );
|
||||
|
||||
void InitAttackType(ATTACKTYPE *pAttack);
|
||||
|
||||
INT16 InternalGoAsFarAsPossibleTowards(SOLDIERTYPE *pSoldier, INT16 sDesGrid, INT8 bReserveAPs, INT8 bAction, INT8 fFlags );
|
||||
INT16 InternalGoAsFarAsPossibleTowards(SOLDIERTYPE *pSoldier, INT16 sDesGrid, INT16 bReserveAPs, INT8 bAction, INT8 fFlags );
|
||||
|
||||
int LegalNPCDestination(SOLDIERTYPE *pSoldier, INT16 sGridno, UINT8 ubPathMode, UINT8 ubWaterOK, UINT8 fFlags);
|
||||
void LoadWeaponIfNeeded(SOLDIERTYPE *pSoldier);
|
||||
@@ -214,7 +217,7 @@ void RTHandleAI( SOLDIERTYPE * pSoldier );
|
||||
UINT16 RunAway( SOLDIERTYPE * pSoldier );
|
||||
INT8 SearchForItems( SOLDIERTYPE * pSoldier, INT8 bReason, UINT16 usItem );
|
||||
UINT8 ShootingStanceChange( SOLDIERTYPE * pSoldier, ATTACKTYPE * pAttack, INT8 bDesiredDirection );
|
||||
UINT8 StanceChange( SOLDIERTYPE * pSoldier, UINT8 ubAttackAPCost );
|
||||
UINT8 StanceChange( SOLDIERTYPE * pSoldier, INT16 ubAttackAPCost );
|
||||
INT16 TrackScent( SOLDIERTYPE * pSoldier );
|
||||
void RefreshAI(SOLDIERTYPE *pSoldier);
|
||||
BOOLEAN InLightAtNight( INT16 sGridNo, INT8 bLevel );
|
||||
@@ -228,3 +231,4 @@ INT16 FindBestCoverNearTheGridNo(SOLDIERTYPE *pSoldier, INT16 sGridNo, UINT8 ubS
|
||||
|
||||
INT8 FindDirectionForClimbing( SOLDIERTYPE *pSoldier, INT16 sGridNo, INT8 bLevel);
|
||||
|
||||
|
||||
|
||||
@@ -54,6 +54,7 @@
|
||||
#include "Campaign Types.h"
|
||||
#include "Queen Command.h"
|
||||
#include "cheats.h"
|
||||
#include "points.h"
|
||||
#endif
|
||||
|
||||
#include "connect.h"
|
||||
@@ -1643,7 +1644,7 @@ void TurnBasedHandleNPCAI(SOLDIERTYPE *pSoldier)
|
||||
{
|
||||
// if he lacks the breath, or APs to get up this turn (life checked above)
|
||||
// OR... (new June 13/96 Ian) he's getting first aid...
|
||||
if ((pSoldier->bBreath < OKBREATH) || (pSoldier->bActionPoints < (AP_GET_UP + AP_ROLL_OVER))
|
||||
if ((pSoldier->bBreath < OKBREATH) || (pSoldier->bActionPoints < (APBPConstants[AP_GET_UP] + APBPConstants[AP_ROLL_OVER]))
|
||||
|| pSoldier->service)
|
||||
{
|
||||
#ifdef RECORDNET
|
||||
@@ -2458,7 +2459,7 @@ INT8 ExecuteAction(SOLDIERTYPE *pSoldier)
|
||||
|
||||
pSoldier->EVENT_InitNewSoldierAnim( AI_PULL_SWITCH, 0 , FALSE );
|
||||
|
||||
DeductPoints( pSoldier, AP_PULL_TRIGGER, 0 );
|
||||
DeductPoints( pSoldier, APBPConstants[AP_PULL_TRIGGER], 0 );
|
||||
|
||||
//gTacticalStatus.fPanicFlags = 0; // turn all flags off
|
||||
gTacticalStatus.ubTheChosenOne = NOBODY;
|
||||
@@ -2470,7 +2471,7 @@ INT8 ExecuteAction(SOLDIERTYPE *pSoldier)
|
||||
//gTacticalStatus.sPanicTriggerGridno = NOWHERE;
|
||||
|
||||
// grab detonator and set off bomb(s)
|
||||
DeductPoints( pSoldier, AP_USE_REMOTE, BP_USE_DETONATOR);// pay for it!
|
||||
DeductPoints( pSoldier, APBPConstants[AP_USE_REMOTE], APBPConstants[BP_USE_DETONATOR]);// pay for it!
|
||||
//SetOffPanicBombs(1000,COMMUNICATE); // BOOOOOOOOOOOOOOOOOOOOM!!!!!
|
||||
SetOffPanicBombs( pSoldier->ubID, 0 );
|
||||
|
||||
@@ -2498,7 +2499,7 @@ INT8 ExecuteAction(SOLDIERTYPE *pSoldier)
|
||||
|
||||
SendNetData(ALL_NODES);
|
||||
*/
|
||||
DeductPoints(pSoldier,AP_RADIO,BP_RADIO);// pay for it!
|
||||
DeductPoints(pSoldier,APBPConstants[AP_RADIO],APBPConstants[BP_RADIO]);// pay for it!
|
||||
RadioSightings(pSoldier,EVERYBODY,pSoldier->bTeam); // about everybody
|
||||
// action completed immediately, cancel it right away
|
||||
|
||||
@@ -2508,7 +2509,7 @@ INT8 ExecuteAction(SOLDIERTYPE *pSoldier)
|
||||
break;
|
||||
|
||||
case AI_ACTION_CREATURE_CALL: // creature calling to others
|
||||
DeductPoints(pSoldier,AP_RADIO,BP_RADIO);// pay for it!
|
||||
DeductPoints(pSoldier,APBPConstants[AP_RADIO],APBPConstants[BP_RADIO]);// pay for it!
|
||||
CreatureCall( pSoldier );
|
||||
//return( FALSE ); // no longer in progress
|
||||
break;
|
||||
|
||||
+23
-23
@@ -145,15 +145,15 @@ BOOLEAN ConsiderProne( SOLDIERTYPE * pSoldier )
|
||||
}
|
||||
}
|
||||
|
||||
UINT8 StanceChange( SOLDIERTYPE * pSoldier, UINT8 ubAttackAPCost )
|
||||
UINT8 StanceChange( SOLDIERTYPE * pSoldier, INT16 ubAttackAPCost )
|
||||
{
|
||||
// consider crouching or going prone
|
||||
|
||||
if (PTR_STANDING)
|
||||
{
|
||||
if (pSoldier->bActionPoints - ubAttackAPCost >= AP_CROUCH)
|
||||
if (pSoldier->bActionPoints - ubAttackAPCost >= APBPConstants[AP_CROUCH])
|
||||
{
|
||||
if ( (pSoldier->bActionPoints - ubAttackAPCost >= AP_CROUCH + AP_PRONE) && IsValidStance( pSoldier, ANIM_PRONE ) && ConsiderProne( pSoldier ) )
|
||||
if ( (pSoldier->bActionPoints - ubAttackAPCost >= APBPConstants[AP_CROUCH] + APBPConstants[AP_PRONE]) && IsValidStance( pSoldier, ANIM_PRONE ) && ConsiderProne( pSoldier ) )
|
||||
{
|
||||
return( ANIM_PRONE );
|
||||
}
|
||||
@@ -165,7 +165,7 @@ UINT8 StanceChange( SOLDIERTYPE * pSoldier, UINT8 ubAttackAPCost )
|
||||
}
|
||||
else if (PTR_CROUCHED)
|
||||
{
|
||||
if ( (pSoldier->bActionPoints - ubAttackAPCost >= AP_PRONE) && IsValidStance( pSoldier, ANIM_PRONE ) && ConsiderProne( pSoldier ) )
|
||||
if ( (pSoldier->bActionPoints - ubAttackAPCost >= APBPConstants[AP_PRONE]) && IsValidStance( pSoldier, ANIM_PRONE ) && ConsiderProne( pSoldier ) )
|
||||
{
|
||||
return( ANIM_PRONE );
|
||||
}
|
||||
@@ -192,7 +192,7 @@ UINT8 ShootingStanceChange( SOLDIERTYPE * pSoldier, ATTACKTYPE * pAttack, INT8 b
|
||||
uiCurrChanceOfDamage = 0;
|
||||
|
||||
bAPsAfterAttack = pSoldier->bActionPoints - MinAPsToAttack( pSoldier, pAttack->sTarget, ADDTURNCOST, 1);
|
||||
if (bAPsAfterAttack < AP_CROUCH)
|
||||
if (bAPsAfterAttack < APBPConstants[AP_CROUCH])
|
||||
{
|
||||
return( 0 );
|
||||
}
|
||||
@@ -220,7 +220,7 @@ UINT8 ShootingStanceChange( SOLDIERTYPE * pSoldier, ATTACKTYPE * pAttack, INT8 b
|
||||
for (bLoop = 0; bLoop < 3; bLoop++)
|
||||
{
|
||||
bStanceDiff = abs( bLoop - bStanceNum );
|
||||
if (bStanceDiff == 2 && bAPsAfterAttack < AP_CROUCH + AP_PRONE)
|
||||
if (bStanceDiff == 2 && bAPsAfterAttack < APBPConstants[AP_CROUCH] + APBPConstants[AP_PRONE])
|
||||
{
|
||||
// can't consider this!
|
||||
continue;
|
||||
@@ -450,7 +450,7 @@ void NewDest(SOLDIERTYPE *pSoldier, UINT16 usGridNo)
|
||||
|
||||
BOOLEAN IsActionAffordable(SOLDIERTYPE *pSoldier)
|
||||
{
|
||||
INT8 bMinPointsNeeded = 0;
|
||||
INT16 bMinPointsNeeded = 0;
|
||||
INT8 bAPForStandUp = 0;
|
||||
INT8 bAPToLookAtWall = ( FindDirectionForClimbing( pSoldier, pSoldier->sGridNo, pSoldier->pathing.bLevel ) == pSoldier->ubDirection ) ? 0 : 1;
|
||||
|
||||
@@ -487,7 +487,7 @@ BOOLEAN IsActionAffordable(SOLDIERTYPE *pSoldier)
|
||||
break;
|
||||
|
||||
case AI_ACTION_PICKUP_ITEM: // grab things lying on the ground
|
||||
bMinPointsNeeded = __max( MinPtsToMove( pSoldier ), AP_PICKUP_ITEM );
|
||||
bMinPointsNeeded = __max( MinPtsToMove( pSoldier ), APBPConstants[AP_PICKUP_ITEM] );
|
||||
break;
|
||||
|
||||
case AI_ACTION_OPEN_OR_CLOSE_DOOR:
|
||||
@@ -497,7 +497,7 @@ BOOLEAN IsActionAffordable(SOLDIERTYPE *pSoldier)
|
||||
break;
|
||||
|
||||
case AI_ACTION_DROP_ITEM:
|
||||
bMinPointsNeeded = AP_PICKUP_ITEM;
|
||||
bMinPointsNeeded = APBPConstants[AP_PICKUP_ITEM];
|
||||
break;
|
||||
|
||||
case AI_ACTION_FIRE_GUN: // shoot at nearby opponent
|
||||
@@ -520,21 +520,21 @@ BOOLEAN IsActionAffordable(SOLDIERTYPE *pSoldier)
|
||||
break;
|
||||
|
||||
case AI_ACTION_PULL_TRIGGER: // activate an adjacent panic trigger
|
||||
bMinPointsNeeded = AP_PULL_TRIGGER;
|
||||
bMinPointsNeeded = APBPConstants[AP_PULL_TRIGGER];
|
||||
break;
|
||||
|
||||
case AI_ACTION_USE_DETONATOR: // grab detonator and set off bomb(s)
|
||||
bMinPointsNeeded = AP_USE_REMOTE;
|
||||
bMinPointsNeeded = APBPConstants[AP_USE_REMOTE];
|
||||
break;
|
||||
|
||||
case AI_ACTION_YELLOW_ALERT: // tell friends opponent(s) heard
|
||||
case AI_ACTION_RED_ALERT: // tell friends opponent(s) seen
|
||||
case AI_ACTION_CREATURE_CALL: // for now
|
||||
bMinPointsNeeded = AP_RADIO;
|
||||
bMinPointsNeeded = APBPConstants[AP_RADIO];
|
||||
break;
|
||||
|
||||
case AI_ACTION_CHANGE_STANCE: // crouch
|
||||
bMinPointsNeeded = AP_CROUCH;
|
||||
bMinPointsNeeded = APBPConstants[AP_CROUCH];
|
||||
break;
|
||||
|
||||
case AI_ACTION_GIVE_AID: // help injured/dying friend
|
||||
@@ -546,12 +546,12 @@ BOOLEAN IsActionAffordable(SOLDIERTYPE *pSoldier)
|
||||
{
|
||||
if( PTR_CROUCHED ) bAPForStandUp = 2;
|
||||
if( PTR_PRONE ) bAPForStandUp = 4;
|
||||
bMinPointsNeeded = AP_CLIMBROOF + bAPForStandUp + bAPToLookAtWall;
|
||||
bMinPointsNeeded = APBPConstants[AP_CLIMBROOF] + bAPForStandUp + bAPToLookAtWall;
|
||||
}
|
||||
else
|
||||
{
|
||||
if( !PTR_CROUCHED ) bAPForStandUp = 2;
|
||||
bMinPointsNeeded = AP_CLIMBOFFROOF + bAPForStandUp + bAPToLookAtWall;
|
||||
bMinPointsNeeded = APBPConstants[AP_CLIMBOFFROOF] + bAPForStandUp + bAPToLookAtWall;
|
||||
}
|
||||
break;
|
||||
|
||||
@@ -1457,15 +1457,15 @@ INT16 EstimatePathCostToLocation( SOLDIERTYPE * pSoldier, INT16 sDestGridNo, INT
|
||||
if (fAddCostAfterClimbingUp)
|
||||
{
|
||||
// add in cost of later climbing up, too
|
||||
sPathCost += AP_CLIMBOFFROOF + AP_CLIMBROOF;
|
||||
sPathCost += APBPConstants[AP_CLIMBOFFROOF] + APBPConstants[AP_CLIMBROOF];
|
||||
// add in an estimate of getting there after climbing down
|
||||
sPathCost += (AP_MOVEMENT_FLAT + WALKCOST) * PythSpacesAway( sClimbGridNo, sDestGridNo );
|
||||
sPathCost += (APBPConstants[AP_MOVEMENT_FLAT] + WALKCOST) * PythSpacesAway( sClimbGridNo, sDestGridNo );
|
||||
}
|
||||
else
|
||||
{
|
||||
sPathCost += AP_CLIMBOFFROOF;
|
||||
sPathCost += APBPConstants[AP_CLIMBOFFROOF];
|
||||
// add in an estimate of getting there after climbing down, *but not on top of roof*
|
||||
sPathCost += (AP_MOVEMENT_FLAT + WALKCOST) * PythSpacesAway( sClimbGridNo, sDestGridNo ) / 2;
|
||||
sPathCost += (APBPConstants[AP_MOVEMENT_FLAT] + WALKCOST) * PythSpacesAway( sClimbGridNo, sDestGridNo ) / 2;
|
||||
}
|
||||
*pfClimbingNecessary = TRUE;
|
||||
*psClimbGridNo = sClimbGridNo;
|
||||
@@ -1500,21 +1500,21 @@ INT16 EstimatePathCostToLocation( SOLDIERTYPE * pSoldier, INT16 sDestGridNo, INT
|
||||
if (pSoldier->pathing.bLevel == 0)
|
||||
{
|
||||
// must climb up
|
||||
sPathCost += AP_CLIMBROOF;
|
||||
sPathCost += APBPConstants[AP_CLIMBROOF];
|
||||
if (fAddCostAfterClimbingUp)
|
||||
{
|
||||
// add to path a rough estimate of how far to go from the climb gridno to the friend
|
||||
// estimate walk cost
|
||||
sPathCost += (AP_MOVEMENT_FLAT + WALKCOST) * PythSpacesAway( sClimbGridNo, sDestGridNo );
|
||||
sPathCost += (APBPConstants[AP_MOVEMENT_FLAT] + WALKCOST) * PythSpacesAway( sClimbGridNo, sDestGridNo );
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// must climb down
|
||||
sPathCost += AP_CLIMBOFFROOF;
|
||||
sPathCost += APBPConstants[AP_CLIMBOFFROOF];
|
||||
// add to path a rough estimate of how far to go from the climb gridno to the friend
|
||||
// estimate walk cost
|
||||
sPathCost += (AP_MOVEMENT_FLAT + WALKCOST) * PythSpacesAway( sClimbGridNo, sDestGridNo );
|
||||
sPathCost += (APBPConstants[AP_MOVEMENT_FLAT] + WALKCOST) * PythSpacesAway( sClimbGridNo, sDestGridNo );
|
||||
}
|
||||
*pfClimbingNecessary = TRUE;
|
||||
*psClimbGridNo = sClimbGridNo;
|
||||
|
||||
+34
-29
@@ -122,10 +122,12 @@ void CalcBestShot(SOLDIERTYPE *pSoldier, ATTACKTYPE *pBestShot, BOOLEAN shootUns
|
||||
INT32 iThreatValue;
|
||||
INT32 iHitRate,iBestHitRate,iPercentBetter;
|
||||
INT32 iEstDamage;
|
||||
UINT8 ubRawAPCost,ubMinAPcost,ubMaxPossibleAimTime,ubAimTime,ubBestAimTime;
|
||||
UINT8 ubChanceToHit,ubChanceToGetThrough,ubChanceToReallyHit,ubBestChanceToHit = 0;
|
||||
UINT8 ubMaxPossibleAimTime;
|
||||
INT16 ubAimTime,ubMinAPcost,ubRawAPCost;
|
||||
UINT8 ubChanceToReallyHit = 0;
|
||||
INT16 ubChanceToHit,ubBestAimTime,ubChanceToGetThrough,ubBestChanceToHit;
|
||||
SOLDIERTYPE *pOpponent;
|
||||
UINT8 ubBurstAPs;
|
||||
INT16 ubBurstAPs;
|
||||
|
||||
DebugMsg (TOPIC_JA2,DBG_LEVEL_3,"CalcBestShot");
|
||||
|
||||
@@ -243,7 +245,7 @@ void CalcBestShot(SOLDIERTYPE *pSoldier, ATTACKTYPE *pBestShot, BOOLEAN shootUns
|
||||
{
|
||||
// raw AP cost calculation included cost of changing target!
|
||||
// Not unless we really needed to change targets!
|
||||
//ubRawAPCost -= AP_CHANGE_TARGET;
|
||||
//ubRawAPCost -= APBPConstants[AP_CHANGE_TARGET];
|
||||
}
|
||||
|
||||
iBestHitRate = 0; // reset best hit rate to minimum
|
||||
@@ -272,13 +274,13 @@ void CalcBestShot(SOLDIERTYPE *pSoldier, ATTACKTYPE *pBestShot, BOOLEAN shootUns
|
||||
// consider the various aiming times
|
||||
if ( !Weapon[pSoldier->usAttackingWeapon].NoSemiAuto )
|
||||
{
|
||||
for (ubAimTime = AP_MIN_AIM_ATTACK; ubAimTime <= ubMaxPossibleAimTime; ubAimTime++)
|
||||
for (ubAimTime = APBPConstants[AP_MIN_AIM_ATTACK]; ubAimTime <= ubMaxPossibleAimTime; ubAimTime++)
|
||||
{
|
||||
//HandleMyMouseCursor(KEYBOARDALSO);
|
||||
|
||||
//NumMessage("ubAimTime = ",ubAimTime);
|
||||
|
||||
ubChanceToHit = (UINT8) AICalcChanceToHitGun(pSoldier,pOpponent->sGridNo,ubAimTime, AIM_SHOT_TORSO);
|
||||
ubChanceToHit = (INT16) AICalcChanceToHitGun(pSoldier,pOpponent->sGridNo,ubAimTime, AIM_SHOT_TORSO);
|
||||
// ExtMen[pOpponent->ubID].haveStats = TRUE;
|
||||
//NumMessage("chance to Hit = ",ubChanceToHit);
|
||||
|
||||
@@ -299,8 +301,8 @@ void CalcBestShot(SOLDIERTYPE *pSoldier, ATTACKTYPE *pBestShot, BOOLEAN shootUns
|
||||
}
|
||||
else
|
||||
{
|
||||
ubAimTime = AP_MIN_AIM_ATTACK;
|
||||
ubChanceToHit = (UINT8) AICalcChanceToHitGun(pSoldier,pOpponent->sGridNo,ubAimTime, AIM_SHOT_TORSO);
|
||||
ubAimTime = APBPConstants[AP_MIN_AIM_ATTACK];
|
||||
ubChanceToHit = (INT16) AICalcChanceToHitGun(pSoldier,pOpponent->sGridNo,ubAimTime, AIM_SHOT_TORSO);
|
||||
Assert( ubRawAPCost > 0);
|
||||
iHitRate = (pSoldier->bActionPoints * ubChanceToHit) / (ubRawAPCost + ubAimTime);
|
||||
|
||||
@@ -461,7 +463,8 @@ void CalcBestThrow(SOLDIERTYPE *pSoldier, ATTACKTYPE *pBestThrow)
|
||||
INT8 bFriendLevel[MAXMERCS], bOpponentLevel[MAXMERCS];
|
||||
INT32 iEstDamage;
|
||||
UINT8 ubFriendCnt = 0,ubOpponentCnt = 0, ubOpponentID[MAXMERCS];
|
||||
UINT8 ubRawAPCost,ubMinAPcost,ubMaxPossibleAimTime;
|
||||
UINT8 ubMaxPossibleAimTime;
|
||||
INT16 ubRawAPCost,ubMinAPcost;
|
||||
UINT8 ubChanceToHit,ubChanceToGetThrough,ubChanceToReallyHit;
|
||||
UINT32 uiPenalty;
|
||||
UINT8 ubSearchRange;
|
||||
@@ -1174,11 +1177,12 @@ void CalcBestStab(SOLDIERTYPE *pSoldier, ATTACKTYPE *pBestStab, BOOLEAN fBladeAt
|
||||
INT32 iAttackValue;
|
||||
INT32 iThreatValue,iHitRate,iBestHitRate,iPercentBetter, iEstDamage;
|
||||
BOOLEAN fSurpriseStab;
|
||||
UINT8 ubRawAPCost,ubMinAPCost,ubMaxPossibleAimTime,ubAimTime,ubBestAimTime = 0;
|
||||
UINT8 ubChanceToHit,ubChanceToReallyHit,ubBestChanceToHit = 0;
|
||||
INT16 ubRawAPCost,ubMinAPCost,ubMaxPossibleAimTime = 0;
|
||||
INT16 ubChanceToReallyHit = 0;
|
||||
INT16 ubAimTime,ubChanceToHit,ubBestAimTime;
|
||||
SOLDIERTYPE *pOpponent;
|
||||
UINT16 usTrueMovementMode;
|
||||
|
||||
INT16 ubBestChanceToHit;
|
||||
InitAttackType(pBestStab); // set all structure fields to defaults
|
||||
|
||||
pSoldier->usAttackingWeapon = pSoldier->inv[HANDPOS].usItem;
|
||||
@@ -1248,8 +1252,8 @@ void CalcBestStab(SOLDIERTYPE *pSoldier, ATTACKTYPE *pBestStab, BOOLEAN fBladeAt
|
||||
//KeepInterfaceGoing();
|
||||
|
||||
// calc next attack's minimum stabbing cost (excludes movement & turning)
|
||||
//ubRawAPCost = MinAPsToShootOrStab(pSoldier,pOpponent->sGridNo, FALSE) - AP_CHANGE_TARGET;
|
||||
ubRawAPCost = MinAPsToAttack(pSoldier,pOpponent->sGridNo, FALSE) - AP_CHANGE_TARGET;
|
||||
//ubRawAPCost = MinAPsToShootOrStab(pSoldier,pOpponent->sGridNo, FALSE) - APBPConstants[AP_CHANGE_TARGET];
|
||||
ubRawAPCost = MinAPsToAttack(pSoldier,pOpponent->sGridNo, FALSE) - APBPConstants[AP_CHANGE_TARGET];
|
||||
//NumMessage("ubRawAPCost to stab this opponent = ",ubRawAPCost);
|
||||
|
||||
|
||||
@@ -1274,7 +1278,7 @@ void CalcBestStab(SOLDIERTYPE *pSoldier, ATTACKTYPE *pBestStab, BOOLEAN fBladeAt
|
||||
//NumMessage("Max Possible Aim Time = ",ubMaxPossibleAimTime);
|
||||
|
||||
// consider the various aiming times
|
||||
for (ubAimTime = AP_MIN_AIM_ATTACK; ubAimTime <= ubMaxPossibleAimTime; ubAimTime++)
|
||||
for (ubAimTime = APBPConstants[AP_MIN_AIM_ATTACK]; ubAimTime <= ubMaxPossibleAimTime; ubAimTime++)
|
||||
{
|
||||
//HandleMyMouseCursor(KEYBOARDALSO);
|
||||
|
||||
@@ -1284,11 +1288,11 @@ void CalcBestStab(SOLDIERTYPE *pSoldier, ATTACKTYPE *pBestStab, BOOLEAN fBladeAt
|
||||
{
|
||||
if (fBladeAttack)
|
||||
{
|
||||
ubChanceToHit = (UINT8) CalcChanceToStab(pSoldier,pOpponent,ubAimTime);
|
||||
ubChanceToHit = (INT16) CalcChanceToStab(pSoldier,pOpponent,ubAimTime);
|
||||
}
|
||||
else
|
||||
{
|
||||
ubChanceToHit = (UINT8) CalcChanceToPunch(pSoldier,pOpponent,ubAimTime);
|
||||
ubChanceToHit = (INT16) CalcChanceToPunch(pSoldier,pOpponent,ubAimTime);
|
||||
}
|
||||
}
|
||||
else
|
||||
@@ -1387,8 +1391,9 @@ void CalcTentacleAttack(SOLDIERTYPE *pSoldier, ATTACKTYPE *pBestStab )
|
||||
INT32 iAttackValue;
|
||||
INT32 iThreatValue,iHitRate,iBestHitRate, iEstDamage;
|
||||
BOOLEAN fSurpriseStab;
|
||||
UINT8 ubRawAPCost,ubMinAPCost,ubMaxPossibleAimTime,ubAimTime,ubBestAimTime = 0;
|
||||
UINT8 ubChanceToHit,ubChanceToReallyHit,ubBestChanceToHit = 0;
|
||||
UINT8 ubMaxPossibleAimTime = 0;
|
||||
INT16 ubBestChanceToHit,ubAimTime,ubMinAPCost,ubChanceToHit,ubBestAimTime,ubRawAPCost;
|
||||
INT16 ubChanceToReallyHit = 0;
|
||||
SOLDIERTYPE *pOpponent;
|
||||
|
||||
|
||||
@@ -1435,8 +1440,8 @@ void CalcTentacleAttack(SOLDIERTYPE *pSoldier, ATTACKTYPE *pBestStab )
|
||||
|
||||
|
||||
// calc next attack's minimum stabbing cost (excludes movement & turning)
|
||||
//ubRawAPCost = MinAPsToShootOrStab(pSoldier,pOpponent->sGridNo, FALSE) - AP_CHANGE_TARGET;
|
||||
ubRawAPCost = MinAPsToAttack(pSoldier,pOpponent->sGridNo, FALSE) - AP_CHANGE_TARGET;
|
||||
//ubRawAPCost = MinAPsToShootOrStab(pSoldier,pOpponent->sGridNo, FALSE) - APBPConstants[AP_CHANGE_TARGET];
|
||||
ubRawAPCost = MinAPsToAttack(pSoldier,pOpponent->sGridNo, FALSE) - APBPConstants[AP_CHANGE_TARGET];
|
||||
//NumMessage("ubRawAPCost to stab this opponent = ",ubRawAPCost);
|
||||
|
||||
// determine if this is a surprise stab (for tentacles, enemy must not see us, no dist limit)
|
||||
@@ -1457,7 +1462,7 @@ void CalcTentacleAttack(SOLDIERTYPE *pSoldier, ATTACKTYPE *pBestStab )
|
||||
//NumMessage("Max Possible Aim Time = ",ubMaxPossibleAimTime);
|
||||
|
||||
// consider the various aiming times
|
||||
for (ubAimTime = AP_MIN_AIM_ATTACK; ubAimTime <= ubMaxPossibleAimTime; ubAimTime++)
|
||||
for (ubAimTime = APBPConstants[AP_MIN_AIM_ATTACK]; ubAimTime <= ubMaxPossibleAimTime; ubAimTime++)
|
||||
{
|
||||
//HandleMyMouseCursor(KEYBOARDALSO);
|
||||
|
||||
@@ -1465,7 +1470,7 @@ void CalcTentacleAttack(SOLDIERTYPE *pSoldier, ATTACKTYPE *pBestStab )
|
||||
|
||||
if (!fSurpriseStab)
|
||||
{
|
||||
ubChanceToHit = (UINT8) CalcChanceToStab(pSoldier,pOpponent,ubAimTime);
|
||||
ubChanceToHit = (INT16) CalcChanceToStab(pSoldier,pOpponent,ubAimTime);
|
||||
}
|
||||
else
|
||||
ubChanceToHit = MAXCHANCETOHIT;
|
||||
@@ -1557,7 +1562,7 @@ UINT8 NumMercsCloseTo( INT16 sGridNo, UINT8 ubMaxDist )
|
||||
return( bNumber );
|
||||
}
|
||||
|
||||
INT32 EstimateShotDamage(SOLDIERTYPE *pSoldier, SOLDIERTYPE *pOpponent, UINT8 ubChanceToHit)
|
||||
INT32 EstimateShotDamage(SOLDIERTYPE *pSoldier, SOLDIERTYPE *pOpponent, INT16 ubChanceToHit)
|
||||
{
|
||||
INT32 iRange,iMaxRange,iPowerLost;
|
||||
INT32 iDamage;
|
||||
@@ -1811,7 +1816,7 @@ INT32 EstimateThrowDamage( SOLDIERTYPE *pSoldier, UINT8 ubItemPos, SOLDIERTYPE *
|
||||
}
|
||||
|
||||
INT32 EstimateStabDamage( SOLDIERTYPE *pSoldier, SOLDIERTYPE *pOpponent,
|
||||
UINT8 ubChanceToHit, BOOLEAN fBladeAttack )
|
||||
INT16 ubChanceToHit, BOOLEAN fBladeAttack )
|
||||
{
|
||||
INT32 iImpact, iFluke, iBonus;
|
||||
|
||||
@@ -2030,7 +2035,7 @@ INT8 CanNPCAttack(SOLDIERTYPE *pSoldier)
|
||||
void CheckIfTossPossible(SOLDIERTYPE *pSoldier, ATTACKTYPE *pBestThrow)
|
||||
{
|
||||
DebugMsg (TOPIC_JA2,DBG_LEVEL_3,"CheckIfTossPossible");
|
||||
UINT8 ubMinAPcost;
|
||||
INT16 ubMinAPcost;
|
||||
|
||||
pSoldier->bWeaponMode = WM_NORMAL;
|
||||
|
||||
@@ -2412,7 +2417,7 @@ INT16 AdvanceToFiringRange( SOLDIERTYPE * pSoldier, INT16 sClosestOpponent )
|
||||
{
|
||||
// see how far we can go down a path and still shoot
|
||||
|
||||
INT8 bAttackCost, bTrueActionPoints;
|
||||
INT16 bAttackCost, bTrueActionPoints;
|
||||
UINT16 usActionData;
|
||||
|
||||
bAttackCost = MinAPsToAttack(pSoldier, sClosestOpponent, ADDTURNCOST);
|
||||
@@ -2429,7 +2434,7 @@ INT16 AdvanceToFiringRange( SOLDIERTYPE * pSoldier, INT16 sClosestOpponent )
|
||||
pSoldier->bActionPoints -= bAttackCost;
|
||||
|
||||
usActionData = GoAsFarAsPossibleTowards( pSoldier, sClosestOpponent, AI_ACTION_SEEK_OPPONENT );
|
||||
|
||||
//POSSIBLE STRUCTURE PROBLEM HERE. GOTTHARD 7/15/08
|
||||
pSoldier->bActionPoints = bTrueActionPoints;
|
||||
|
||||
return( usActionData );
|
||||
@@ -2441,7 +2446,7 @@ INT16 AdvanceToFiringRange( SOLDIERTYPE * pSoldier, INT16 sClosestOpponent )
|
||||
void CheckIfShotPossible(SOLDIERTYPE *pSoldier, ATTACKTYPE *pBestShot, BOOLEAN suppressionFire)
|
||||
{
|
||||
DebugMsg (TOPIC_JA2,DBG_LEVEL_3,"CheckIfShotPossible");
|
||||
UINT8 ubMinAPcost;
|
||||
INT16 ubMinAPcost;
|
||||
pBestShot->ubPossible = FALSE;
|
||||
pBestShot->bWeaponIn = NO_SLOT;
|
||||
|
||||
|
||||
@@ -661,7 +661,7 @@ INT8 CreatureDecideActionRed(SOLDIERTYPE *pSoldier, UINT8 ubUnconsciousOK)
|
||||
////////////////////////////////////////////////////////////////////////////
|
||||
if ( CAN_CALL( pSoldier ) )
|
||||
{
|
||||
if ((pSoldier->bActionPoints >= AP_RADIO) && (gTacticalStatus.Team[pSoldier->bTeam].bMenInSector > 1))
|
||||
if ((pSoldier->bActionPoints >= APBPConstants[AP_RADIO]) && (gTacticalStatus.Team[pSoldier->bTeam].bMenInSector > 1))
|
||||
{
|
||||
if (pSoldier->stats.bLife < pSoldier->bOldLife)
|
||||
{
|
||||
@@ -710,7 +710,7 @@ INT8 CreatureDecideActionRed(SOLDIERTYPE *pSoldier, UINT8 ubUnconsciousOK)
|
||||
// (we never want NPCs to choose to radio if they would have to wait a turn)
|
||||
if ( CAN_CALL( pSoldier ) && (!gTacticalStatus.Team[pSoldier->bTeam].bAwareOfOpposition) )
|
||||
{
|
||||
if ((pSoldier->bActionPoints >= AP_RADIO) && (gTacticalStatus.Team[pSoldier->bTeam].bMenInSector > 1))
|
||||
if ((pSoldier->bActionPoints >= APBPConstants[AP_RADIO]) && (gTacticalStatus.Team[pSoldier->bTeam].bMenInSector > 1))
|
||||
{
|
||||
// if there hasn't been a general sighting call sent yet
|
||||
|
||||
@@ -908,8 +908,8 @@ INT8 CreatureDecideActionBlack( SOLDIERTYPE * pSoldier )
|
||||
{
|
||||
// monster AI - hostile mammals in sense range
|
||||
INT16 sClosestOpponent,sBestCover = NOWHERE;
|
||||
INT16 sClosestDisturbance;
|
||||
UINT8 ubMinAPCost,ubCanMove/*,bInWater*/,bInGas;
|
||||
INT16 sClosestDisturbance,ubMinAPCost;
|
||||
UINT8 ubCanMove/*,bInWater*/,bInGas;
|
||||
INT8 bDirection;
|
||||
UINT8 ubBestAttackAction;
|
||||
INT8 bCanAttack;
|
||||
@@ -937,7 +937,7 @@ INT8 CreatureDecideActionBlack( SOLDIERTYPE * pSoldier )
|
||||
|
||||
if ( CAN_CALL( pSoldier ) )
|
||||
{
|
||||
if ((pSoldier->bActionPoints >= AP_RADIO) && (gTacticalStatus.Team[pSoldier->bTeam].bMenInSector > 1))
|
||||
if ((pSoldier->bActionPoints >= APBPConstants[AP_RADIO]) && (gTacticalStatus.Team[pSoldier->bTeam].bMenInSector > 1))
|
||||
{
|
||||
if (pSoldier->stats.bLife < pSoldier->bOldLife)
|
||||
{
|
||||
@@ -1339,6 +1339,7 @@ INT8 CreatureDecideActionBlack( SOLDIERTYPE * pSoldier )
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
|
||||
pSoldier->aiData.usActionData = BestAttack.sTarget;
|
||||
//POSSIBLE STRUCTURE PROBLEM WITH INT8/INT16. GOTTHARD 7/14/08
|
||||
pSoldier->aiData.bAimTime = BestAttack.ubAimTime;
|
||||
|
||||
if ( ubBestAttackAction == AI_ACTION_FIRE_GUN && BestAttack.ubChanceToReallyHit > 50 )
|
||||
|
||||
+33
-26
@@ -1406,7 +1406,7 @@ INT8 DecideActionYellow(SOLDIERTYPE *pSoldier)
|
||||
|
||||
// if we have the action points remaining to RADIO
|
||||
// (we never want NPCs to choose to radio if they would have to wait a turn)
|
||||
if ( !fCivilian && (pSoldier->bActionPoints >= AP_RADIO) &&
|
||||
if ( !fCivilian && (pSoldier->bActionPoints >= APBPConstants[AP_RADIO]) &&
|
||||
(gTacticalStatus.Team[pSoldier->bTeam].bMenInSector > 1) )
|
||||
{
|
||||
// base chance depends on how much new info we have to radio to the others
|
||||
@@ -1643,7 +1643,7 @@ INT8 DecideActionYellow(SOLDIERTYPE *pSoldier)
|
||||
// if ( CanClimbFromHere ( pSoldier, fUp ) )
|
||||
if ( pSoldier->sGridNo == sNoiseGridNo)
|
||||
{
|
||||
if (IsActionAffordable(pSoldier) && pSoldier->bActionPoints >= ( AP_CLIMBROOF + MinAPsToAttack( pSoldier, sNoiseGridNo, ADDTURNCOST)))
|
||||
if (IsActionAffordable(pSoldier) && pSoldier->bActionPoints >= ( APBPConstants[AP_CLIMBROOF] + MinAPsToAttack( pSoldier, sNoiseGridNo, ADDTURNCOST)))
|
||||
{
|
||||
return( AI_ACTION_CLIMB_ROOF );
|
||||
}
|
||||
@@ -2206,6 +2206,7 @@ if(!is_networked)//hayden
|
||||
RearrangePocket(pSoldier,HANDPOS,BestThrow.bWeaponIn,FOREVER);
|
||||
|
||||
pSoldier->aiData.usActionData = BestThrow.sTarget;
|
||||
//POSSIBLE STRUCTURE CHANGE PROBLEM, NOT CURRENTLY CHANGED. GOTTHARD 7/14/08
|
||||
pSoldier->aiData.bAimTime = BestThrow.ubAimTime;
|
||||
|
||||
return(AI_ACTION_TOSS_PROJECTILE);
|
||||
@@ -2272,6 +2273,7 @@ if(!is_networked)//hayden
|
||||
RearrangePocket(pSoldier,HANDPOS,BestShot.bWeaponIn,FOREVER);
|
||||
|
||||
pSoldier->aiData.usActionData = BestShot.sTarget;
|
||||
//POSSIBLE STRUCTURE CHANGE PROBLEM. GOTTHARD 7/14/08
|
||||
pSoldier->aiData.bAimTime = BestShot.ubAimTime;
|
||||
ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_INTERFACE, New113Message[ MSG113_SNIPER ] );
|
||||
return(AI_ACTION_FIRE_GUN );
|
||||
@@ -2324,7 +2326,7 @@ if(!is_networked)//hayden
|
||||
|
||||
pSoldier->aiData.usActionData = BestShot.sTarget;
|
||||
//pSoldier->aiData.bAimTime = BestShot.ubAimTime;
|
||||
UINT8 ubBurstAPs = 0;
|
||||
INT16 ubBurstAPs = 0;
|
||||
|
||||
pSoldier->bDoAutofire = 0;
|
||||
do
|
||||
@@ -2366,7 +2368,7 @@ if(!is_networked)//hayden
|
||||
}
|
||||
/*
|
||||
// CALL IN AIR STRIKE & RADIO RED ALERT
|
||||
if ( !fCivilian && pSoldier->bTeam != MILITIA_TEAM && gGameOptions.fAirStrikes && airstrikeavailable && (pSoldier->bActionPoints >= AP_RADIO) && !WillAirRaidBeStopped(pSoldier->sSectorX,pSoldier->sSectorY))
|
||||
if ( !fCivilian && pSoldier->bTeam != MILITIA_TEAM && gGameOptions.fAirStrikes && airstrikeavailable && (pSoldier->bActionPoints >= APBPConstants[AP_RADIO]) && !WillAirRaidBeStopped(pSoldier->sSectorX,pSoldier->sSectorY))
|
||||
{
|
||||
|
||||
DebugMsg (TOPIC_JA2,DBG_LEVEL_3,"decideactionred: checking to call in an air strike");
|
||||
@@ -2505,7 +2507,7 @@ if(!is_networked)//hayden
|
||||
|
||||
// if we're a computer merc, and we have the action points remaining to RADIO
|
||||
// (we never want NPCs to choose to radio if they would have to wait a turn)
|
||||
if ( !fCivilian && (pSoldier->bActionPoints >= AP_RADIO) && (gTacticalStatus.Team[pSoldier->bTeam].bMenInSector > 1) )
|
||||
if ( !fCivilian && (pSoldier->bActionPoints >= APBPConstants[AP_RADIO]) && (gTacticalStatus.Team[pSoldier->bTeam].bMenInSector > 1) )
|
||||
{
|
||||
|
||||
DebugMsg (TOPIC_JA2,DBG_LEVEL_3,"decideactionred: checking to radio red alert");
|
||||
@@ -2648,12 +2650,12 @@ if(!is_networked)//hayden
|
||||
DebugMsg (TOPIC_JA2,DBG_LEVEL_3,"decideactionred: stop flanking");
|
||||
if (PythSpacesAway ( pSoldier->sGridNo, tempGridNo ) > MIN_FLANK_DIST_RED * 2 )
|
||||
{
|
||||
pSoldier->aiData.usActionData = InternalGoAsFarAsPossibleTowards(pSoldier,tempGridNo,AP_PRONE,AI_ACTION_SEEK_OPPONENT,0);
|
||||
pSoldier->aiData.usActionData = InternalGoAsFarAsPossibleTowards(pSoldier,tempGridNo,APBPConstants[AP_PRONE],AI_ACTION_SEEK_OPPONENT,0);
|
||||
|
||||
if ( LocationToLocationLineOfSightTest( pSoldier->aiData.usActionData, pSoldier->pathing.bLevel, tempGridNo, pSoldier->pathing.bLevel, TRUE) )
|
||||
{
|
||||
// reserve APs for a possible crouch plus a shot
|
||||
pSoldier->aiData.usActionData = InternalGoAsFarAsPossibleTowards(pSoldier, tempGridNo, (INT8) (MinAPsToAttack( pSoldier, tempGridNo, ADDTURNCOST) + AP_CROUCH), AI_ACTION_SEEK_OPPONENT, FLAG_CAUTIOUS );
|
||||
pSoldier->aiData.usActionData = InternalGoAsFarAsPossibleTowards(pSoldier, tempGridNo, (INT8) (MinAPsToAttack( pSoldier, tempGridNo, ADDTURNCOST) + APBPConstants[AP_CROUCH]), AI_ACTION_SEEK_OPPONENT, FLAG_CAUTIOUS );
|
||||
if ( pSoldier->aiData.usActionData != NOWHERE )
|
||||
{
|
||||
pSoldier->aiData.fAIFlags |= AI_CAUTIOUS;
|
||||
@@ -2678,7 +2680,7 @@ if(!is_networked)//hayden
|
||||
// and have more APs than we want to reserve
|
||||
DebugMsg (TOPIC_JA2,DBG_LEVEL_3,String("decideactionred: can we move? = %d, APs = %d",ubCanMove,pSoldier->bActionPoints));
|
||||
|
||||
if (ubCanMove && pSoldier->bActionPoints > MAX_AP_CARRIED)
|
||||
if (ubCanMove && pSoldier->bActionPoints > APBPConstants[MAX_AP_CARRIED])
|
||||
{
|
||||
if (fCivilian)
|
||||
{
|
||||
@@ -2775,7 +2777,7 @@ if(!is_networked)//hayden
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
|
||||
// try to move towards him
|
||||
pSoldier->aiData.usActionData = InternalGoAsFarAsPossibleTowards(pSoldier,sClosestDisturbance,AP_CROUCH,AI_ACTION_SEEK_OPPONENT,0);
|
||||
pSoldier->aiData.usActionData = InternalGoAsFarAsPossibleTowards(pSoldier,sClosestDisturbance,APBPConstants[AP_CROUCH],AI_ACTION_SEEK_OPPONENT,0);
|
||||
|
||||
if (pSoldier->aiData.usActionData != NOWHERE)
|
||||
{
|
||||
@@ -2817,7 +2819,7 @@ if(!is_networked)//hayden
|
||||
//if ( CanClimbFromHere ( pSoldier, fUp ) )
|
||||
if (pSoldier->sGridNo == sClosestDisturbance)
|
||||
{
|
||||
if (IsActionAffordable(pSoldier) && pSoldier->bActionPoints >= ( AP_CLIMBROOF + MinAPsToAttack( pSoldier, sClosestDisturbance, ADDTURNCOST)))
|
||||
if (IsActionAffordable(pSoldier) && pSoldier->bActionPoints >= ( APBPConstants[AP_CLIMBROOF] + MinAPsToAttack( pSoldier, sClosestDisturbance, ADDTURNCOST)))
|
||||
{
|
||||
return( AI_ACTION_CLIMB_ROOF );
|
||||
}
|
||||
@@ -2877,12 +2879,12 @@ if(!is_networked)//hayden
|
||||
|
||||
if ( pSoldier->aiData.usActionData == NOWHERE || pSoldier->numFlanks >= MAX_FLANKS_RED )
|
||||
{
|
||||
pSoldier->aiData.usActionData = InternalGoAsFarAsPossibleTowards(pSoldier,sClosestDisturbance,AP_CROUCH, AI_ACTION_SEEK_OPPONENT,0);
|
||||
pSoldier->aiData.usActionData = InternalGoAsFarAsPossibleTowards(pSoldier,sClosestDisturbance,APBPConstants[AP_CROUCH], AI_ACTION_SEEK_OPPONENT,0);
|
||||
//pSoldier->numFlanks = 0;
|
||||
if ( PythSpacesAway( pSoldier->aiData.usActionData, sClosestDisturbance ) < 5 || LocationToLocationLineOfSightTest( pSoldier->aiData.usActionData, pSoldier->pathing.bLevel, sClosestDisturbance, pSoldier->pathing.bLevel, TRUE ) )
|
||||
{
|
||||
// reserve APs for a possible crouch plus a shot
|
||||
pSoldier->aiData.usActionData = InternalGoAsFarAsPossibleTowards(pSoldier, sClosestDisturbance, (INT8) (MinAPsToAttack( pSoldier, sClosestDisturbance, ADDTURNCOST) + AP_CROUCH), AI_ACTION_SEEK_OPPONENT, FLAG_CAUTIOUS );
|
||||
pSoldier->aiData.usActionData = InternalGoAsFarAsPossibleTowards(pSoldier, sClosestDisturbance, (INT8) (MinAPsToAttack( pSoldier, sClosestDisturbance, ADDTURNCOST) + APBPConstants[AP_CROUCH]), AI_ACTION_SEEK_OPPONENT, FLAG_CAUTIOUS );
|
||||
if ( pSoldier->aiData.usActionData != NOWHERE )
|
||||
{
|
||||
pSoldier->aiData.fAIFlags |= AI_CAUTIOUS;
|
||||
@@ -2919,7 +2921,7 @@ if(!is_networked)//hayden
|
||||
if ( PythSpacesAway( pSoldier->aiData.usActionData, sClosestDisturbance ) < 5 || LocationToLocationLineOfSightTest( pSoldier->aiData.usActionData, pSoldier->pathing.bLevel, sClosestDisturbance, pSoldier->pathing.bLevel, TRUE ) )
|
||||
{
|
||||
// reserve APs for a possible crouch plus a shot
|
||||
pSoldier->aiData.usActionData = InternalGoAsFarAsPossibleTowards(pSoldier, sClosestDisturbance, (INT8) (MinAPsToAttack( pSoldier, sClosestDisturbance, ADDTURNCOST) + AP_CROUCH), AI_ACTION_SEEK_OPPONENT, FLAG_CAUTIOUS );
|
||||
pSoldier->aiData.usActionData = InternalGoAsFarAsPossibleTowards(pSoldier, sClosestDisturbance, (INT8) (MinAPsToAttack( pSoldier, sClosestDisturbance, ADDTURNCOST) + APBPConstants[AP_CROUCH]), AI_ACTION_SEEK_OPPONENT, FLAG_CAUTIOUS );
|
||||
if ( pSoldier->aiData.usActionData != NOWHERE )
|
||||
{
|
||||
pSoldier->aiData.fAIFlags |= AI_CAUTIOUS;
|
||||
@@ -3016,7 +3018,7 @@ if(!is_networked)//hayden
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
// GO DIRECTLY TOWARDS CLOSEST FRIEND UNDER FIRE OR WHO LAST RADIOED
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
pSoldier->aiData.usActionData = InternalGoAsFarAsPossibleTowards(pSoldier,sClosestFriend,AP_CROUCH, AI_ACTION_SEEK_OPPONENT,0);
|
||||
pSoldier->aiData.usActionData = InternalGoAsFarAsPossibleTowards(pSoldier,sClosestFriend,APBPConstants[AP_CROUCH], AI_ACTION_SEEK_OPPONENT,0);
|
||||
|
||||
if (pSoldier->aiData.usActionData != NOWHERE)
|
||||
{
|
||||
@@ -3041,7 +3043,7 @@ if(!is_networked)//hayden
|
||||
//if ( CanClimbFromHere ( pSoldier, fUp ) )
|
||||
if (pSoldier->sGridNo == sClosestFriend)
|
||||
{
|
||||
if (IsActionAffordable(pSoldier) && pSoldier->bActionPoints >= ( AP_CLIMBROOF + MinAPsToAttack( pSoldier, sClosestFriend, ADDTURNCOST)))
|
||||
if (IsActionAffordable(pSoldier) && pSoldier->bActionPoints >= ( APBPConstants[AP_CLIMBROOF] + MinAPsToAttack( pSoldier, sClosestFriend, ADDTURNCOST)))
|
||||
{
|
||||
return( AI_ACTION_CLIMB_ROOF );
|
||||
}
|
||||
@@ -3106,7 +3108,7 @@ if(!is_networked)//hayden
|
||||
{
|
||||
// either moving significantly closer or into very close range
|
||||
// ensure will we have enough APs for a possible crouch plus a shot
|
||||
if ( InternalGoAsFarAsPossibleTowards( pSoldier, pSoldier->aiData.usActionData, (INT8) (MinAPsToAttack( pSoldier, sClosestOpponent, ADDTURNCOST) + AP_CROUCH), AI_ACTION_TAKE_COVER, 0 ) == pSoldier->aiData.usActionData )
|
||||
if ( InternalGoAsFarAsPossibleTowards( pSoldier, pSoldier->aiData.usActionData, (INT8) (MinAPsToAttack( pSoldier, sClosestOpponent, ADDTURNCOST) + APBPConstants[AP_CROUCH]), AI_ACTION_TAKE_COVER, 0 ) == pSoldier->aiData.usActionData )
|
||||
{
|
||||
return(AI_ACTION_TAKE_COVER);
|
||||
}
|
||||
@@ -3475,8 +3477,8 @@ INT8 DecideActionBlack(SOLDIERTYPE *pSoldier)
|
||||
{
|
||||
INT32 iCoverPercentBetter, iOffense, iDefense, iChance;
|
||||
INT16 sClosestOpponent,sBestCover = NOWHERE;
|
||||
INT16 sClosestDisturbance;
|
||||
UINT8 ubMinAPCost,ubCanMove;
|
||||
INT16 sClosestDisturbance,ubMinAPCost;
|
||||
UINT8 ubCanMove;
|
||||
INT8 bInWater,bInDeepWater,bInGas;
|
||||
INT8 bDirection;
|
||||
UINT8 ubBestAttackAction = AI_ACTION_NONE;
|
||||
@@ -3493,7 +3495,7 @@ INT8 DecideActionBlack(SOLDIERTYPE *pSoldier)
|
||||
UINT8 ubBestStance = 1, ubStanceCost;
|
||||
BOOLEAN fChangeStanceFirst; // before firing
|
||||
BOOLEAN fClimb;
|
||||
UINT8 ubBurstAPs;
|
||||
INT16 ubBurstAPs;
|
||||
UINT8 ubOpponentDir;
|
||||
INT16 sCheckGridNo;
|
||||
|
||||
@@ -4175,13 +4177,14 @@ INT8 DecideActionBlack(SOLDIERTYPE *pSoldier)
|
||||
!(pSoldier->flags.uiStatusFlags & SOLDIER_BOXER) )
|
||||
{
|
||||
// make militia a bit more cautious
|
||||
if ( ( (pSoldier->bTeam == MILITIA_TEAM) && (PreRandom( 20 ) > BestAttack.ubChanceToReallyHit) )
|
||||
|| ( (pSoldier->bTeam != MILITIA_TEAM) && (PreRandom( 40 ) > BestAttack.ubChanceToReallyHit) ) )
|
||||
// 3 (UINT16) CONVERSIONS HERE TO AVOID ERRORS. GOTTHARD 7/15/08
|
||||
if ( ( (pSoldier->bTeam == MILITIA_TEAM) && (PreRandom( 20 ) > (UINT16)BestAttack.ubChanceToReallyHit) )
|
||||
|| ( (pSoldier->bTeam != MILITIA_TEAM) && (PreRandom( 40 ) > (UINT16)BestAttack.ubChanceToReallyHit) ) )
|
||||
{
|
||||
//ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_TESTVERSION, L"AI %d allowing cover check, chance to hit is only %d, at range %d", BestAttack.ubChanceToReallyHit, PythSpacesAway( pSoldier->sGridNo, BestAttack.sTarget ) );
|
||||
// maybe taking cover would be better!
|
||||
fAllowCoverCheck = TRUE;
|
||||
if ( PreRandom( 10 ) > BestAttack.ubChanceToReallyHit )
|
||||
if ( PreRandom( 10 ) > (UINT16)BestAttack.ubChanceToReallyHit )
|
||||
{
|
||||
DebugMsg (TOPIC_JA2,DBG_LEVEL_3,"DecideActionBlack: can't hit so screw the attack");
|
||||
// screw the attack!
|
||||
@@ -4301,13 +4304,14 @@ INT8 DecideActionBlack(SOLDIERTYPE *pSoldier)
|
||||
fChangeStanceFirst = FALSE;
|
||||
|
||||
// default settings
|
||||
pSoldier->aiData.bAimTime = BestAttack.ubAimTime;
|
||||
//POSSIBLE STRUCTURE CHANGE PROBLEM, NOT CURRENTLY CHANGED. GOTTHARD 7/14/08
|
||||
pSoldier->aiData.bAimTime = BestAttack.ubAimTime;
|
||||
pSoldier->bDoBurst = 0;
|
||||
|
||||
if (ubBestAttackAction == AI_ACTION_FIRE_GUN)
|
||||
{
|
||||
// Do we need to change stance? NB We'll have to ready our gun again
|
||||
if ( !TANK( pSoldier ) && ( pSoldier->bActionPoints >= BestAttack.ubAPCost + AP_CROUCH + MinAPsToAttack( pSoldier, BestAttack.sTarget, ADDTURNCOST, 1 ) ) )
|
||||
if ( !TANK( pSoldier ) && ( pSoldier->bActionPoints >= BestAttack.ubAPCost + APBPConstants[AP_CROUCH] + MinAPsToAttack( pSoldier, BestAttack.sTarget, ADDTURNCOST, 1 ) ) )
|
||||
{
|
||||
// since the AI considers shooting chance from standing primarily, if we are not
|
||||
// standing we should always consider a stance change
|
||||
@@ -4758,7 +4762,7 @@ INT8 DecideActionBlack(SOLDIERTYPE *pSoldier)
|
||||
// (we never want NPCs to choose to radio if they would have to wait a turn)
|
||||
// and we're not swimming in deep water, and somebody has called for spotters
|
||||
// and we see the location of at least 2 opponents
|
||||
if ((gTacticalStatus.ubSpottersCalledForBy != NOBODY) && (pSoldier->bActionPoints >= AP_RADIO) &&
|
||||
if ((gTacticalStatus.ubSpottersCalledForBy != NOBODY) && (pSoldier->bActionPoints >= APBPConstants[AP_RADIO]) &&
|
||||
(pSoldier->aiData.bOppCnt > 1) && !fCivilian &&
|
||||
(gTacticalStatus.Team[pSoldier->bTeam].bMenInSector > 1) && !bInDeepWater)
|
||||
{
|
||||
@@ -4891,7 +4895,7 @@ INT8 DecideActionBlack(SOLDIERTYPE *pSoldier)
|
||||
// RADIO RED ALERT: determine %chance to call others and report contact
|
||||
////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
if ( pSoldier->bTeam == MILITIA_TEAM && (pSoldier->bActionPoints >= AP_RADIO) && (gTacticalStatus.Team[pSoldier->bTeam].bMenInSector > 1) )
|
||||
if ( pSoldier->bTeam == MILITIA_TEAM && (pSoldier->bActionPoints >= APBPConstants[AP_RADIO]) && (gTacticalStatus.Team[pSoldier->bTeam].bMenInSector > 1) )
|
||||
{
|
||||
|
||||
// if there hasn't been an initial RED ALERT yet in this sector
|
||||
@@ -5337,3 +5341,6 @@ void DecideAlertStatus( SOLDIERTYPE *pSoldier )
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -43,7 +43,7 @@
|
||||
extern void RenderCoverDebug( void );
|
||||
#endif
|
||||
|
||||
INT8 gubAIPathCosts[19][19];
|
||||
INT16 gubAIPathCosts[19][19];
|
||||
|
||||
// FindBestNearbyCover - "Net" related stuff commented out
|
||||
extern UINT8 gubAICounter;
|
||||
@@ -127,13 +127,13 @@ INT8 CalcWorstCTGTForPosition( SOLDIERTYPE * pSoldier, UINT8 ubOppID, INT16 sOpp
|
||||
switch (bCubeLevel)
|
||||
{
|
||||
case 1:
|
||||
if (iMyAPsLeft < AP_CROUCH + AP_PRONE)
|
||||
if (iMyAPsLeft < APBPConstants[AP_CROUCH] + APBPConstants[AP_PRONE])
|
||||
{
|
||||
continue;
|
||||
}
|
||||
break;
|
||||
case 2:
|
||||
if (iMyAPsLeft < AP_CROUCH)
|
||||
if (iMyAPsLeft < APBPConstants[AP_CROUCH])
|
||||
{
|
||||
continue;
|
||||
}
|
||||
@@ -167,13 +167,13 @@ INT8 CalcAverageCTGTForPosition( SOLDIERTYPE * pSoldier, UINT8 ubOppID, INT16 sO
|
||||
switch (bCubeLevel)
|
||||
{
|
||||
case 1:
|
||||
if (iMyAPsLeft < AP_CROUCH + AP_PRONE)
|
||||
if (iMyAPsLeft < APBPConstants[AP_CROUCH] + APBPConstants[AP_PRONE])
|
||||
{
|
||||
continue;
|
||||
}
|
||||
break;
|
||||
case 2:
|
||||
if (iMyAPsLeft < AP_CROUCH)
|
||||
if (iMyAPsLeft < APBPConstants[AP_CROUCH])
|
||||
{
|
||||
continue;
|
||||
}
|
||||
@@ -429,7 +429,7 @@ INT32 CalcCoverValue(SOLDIERTYPE *pMe, INT16 sMyGridNo, INT32 iMyThreat, INT32 i
|
||||
{
|
||||
// if I CAN'T crouch when I get there, that makes it significantly less
|
||||
// appealing a spot (how much depends on range), so that's a penalty to me
|
||||
if (iMyAPsLeft < AP_CROUCH)
|
||||
if (iMyAPsLeft < APBPConstants[AP_CROUCH])
|
||||
// subtract another 1 % penalty for NOT being able to crouch per tile
|
||||
// the farther away we are, the bigger a difference crouching will make!
|
||||
iMyPosValue -= ((iMyPosValue * (AIM_PENALTY_TARGET_CROUCHED + (iRange / CELL_X_SIZE))) / 100);
|
||||
@@ -1657,7 +1657,7 @@ INT8 SearchForItems( SOLDIERTYPE * pSoldier, INT8 bReason, UINT16 usItem )
|
||||
return AI_ACTION_NONE;
|
||||
}
|
||||
|
||||
if (pSoldier->bActionPoints < AP_PICKUP_ITEM)
|
||||
if (pSoldier->bActionPoints < APBPConstants[AP_PICKUP_ITEM])
|
||||
{
|
||||
return( AI_ACTION_NONE );
|
||||
}
|
||||
@@ -1714,7 +1714,7 @@ INT8 SearchForItems( SOLDIERTYPE * pSoldier, INT8 bReason, UINT16 usItem )
|
||||
|
||||
// set an AP limit too, to our APs less the cost of picking up an item
|
||||
// and less the cost of dropping an item since we might need to do that
|
||||
gubNPCAPBudget = pSoldier->bActionPoints - AP_PICKUP_ITEM;
|
||||
gubNPCAPBudget = pSoldier->bActionPoints - APBPConstants[AP_PICKUP_ITEM];
|
||||
|
||||
// reset the "reachable" flags in the region we're looking at
|
||||
for (sYOffset = -sMaxUp; sYOffset <= sMaxDown; sYOffset++)
|
||||
@@ -1951,7 +1951,7 @@ INT8 SearchForItems( SOLDIERTYPE * pSoldier, INT8 bReason, UINT16 usItem )
|
||||
//if (pSoldier->inv[HANDPOS].exists() == true && PlaceInAnyPocket(pSoldier, &pSoldier->inv[HANDPOS], false) == false)
|
||||
if (FindBetterSpotForItem( pSoldier, HANDPOS ) == FALSE)
|
||||
{
|
||||
if (pSoldier->bActionPoints < AP_PICKUP_ITEM + AP_PICKUP_ITEM)
|
||||
if (pSoldier->bActionPoints < APBPConstants[AP_PICKUP_ITEM] + APBPConstants[AP_PICKUP_ITEM])
|
||||
{
|
||||
return( AI_ACTION_NONE );
|
||||
}
|
||||
@@ -1960,7 +1960,7 @@ INT8 SearchForItems( SOLDIERTYPE * pSoldier, INT8 bReason, UINT16 usItem )
|
||||
// destroy this item!
|
||||
DebugAI( String( "%d decides he must drop %S first so destroys it", pSoldier->ubID, ItemNames[ pSoldier->inv[HANDPOS].usItem ] ) );
|
||||
DeleteObj( &(pSoldier->inv[HANDPOS]) );
|
||||
DeductPoints( pSoldier, AP_PICKUP_ITEM, 0 );
|
||||
DeductPoints( pSoldier, APBPConstants[AP_PICKUP_ITEM], 0 );
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -2848,3 +2848,4 @@ INT8 FindDirectionForClimbing( SOLDIERTYPE *pSoldier, INT16 sGridNo, INT8 bLevel
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -443,7 +443,7 @@ INT8 RandomPointPatrolAI(SOLDIERTYPE *pSoldier)
|
||||
|
||||
|
||||
|
||||
INT16 InternalGoAsFarAsPossibleTowards(SOLDIERTYPE *pSoldier, INT16 sDesGrid, INT8 bReserveAPs, INT8 bAction, INT8 fFlags )
|
||||
INT16 InternalGoAsFarAsPossibleTowards(SOLDIERTYPE *pSoldier, INT16 sDesGrid, INT16 bReserveAPs, INT8 bAction, INT8 fFlags )
|
||||
{
|
||||
#ifdef DEBUGDECISIONS
|
||||
STR16 tempstr;
|
||||
@@ -470,7 +470,7 @@ INT16 InternalGoAsFarAsPossibleTowards(SOLDIERTYPE *pSoldier, INT16 sDesGrid, IN
|
||||
}
|
||||
else
|
||||
{
|
||||
bReserveAPs = MAX_AP_CARRIED;
|
||||
bReserveAPs = APBPConstants[MAX_AP_CARRIED];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -703,15 +703,15 @@ INT16 InternalGoAsFarAsPossibleTowards(SOLDIERTYPE *pSoldier, INT16 sDesGrid, IN
|
||||
// in theory, no NPC should ever be in one of these animations as
|
||||
// things stand (they don't medic anyone), but leave it for robustness
|
||||
case START_AID :
|
||||
case GIVING_AID : sAnimCost = AP_STOP_FIRST_AID;
|
||||
case GIVING_AID : sAnimCost = APBPConstants[AP_STOP_FIRST_AID];
|
||||
break;
|
||||
|
||||
case TWISTOMACH :
|
||||
case COLLAPSED : sAnimCost = AP_GET_UP;
|
||||
case COLLAPSED : sAnimCost = APBPConstants[AP_GET_UP];
|
||||
break;
|
||||
|
||||
case TWISTBACK :
|
||||
case UNCONSCIOUS : sAnimCost = (AP_ROLL_OVER + AP_GET_UP);
|
||||
case UNCONSCIOUS : sAnimCost = (APBPConstants[AP_ROLL_OVER] + APBPConstants[AP_GET_UP]);
|
||||
break;
|
||||
|
||||
default : sAnimCost = 0;
|
||||
@@ -723,7 +723,7 @@ INT16 InternalGoAsFarAsPossibleTowards(SOLDIERTYPE *pSoldier, INT16 sDesGrid, IN
|
||||
|
||||
if (pSoldier->usUIMovementMode == RUNNING)
|
||||
{
|
||||
sAPCost += AP_START_RUN_COST;
|
||||
sAPCost += APBPConstants[AP_START_RUN_COST];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -220,7 +220,7 @@ void PossiblyMakeThisEnemyChosenOne( SOLDIERTYPE * pSoldier )
|
||||
pSoldier->flags.bHasKeys = (pSoldier->flags.bHasKeys << 1) | 1;
|
||||
|
||||
// if he can't get to a spot where he could get at the panic trigger
|
||||
iAPCost = AP_PULL_TRIGGER;
|
||||
iAPCost = APBPConstants[AP_PULL_TRIGGER];
|
||||
if (pSoldier->sGridNo != sPanicTriggerGridNo)
|
||||
{
|
||||
iPathCost = PlotPath( pSoldier, sPanicTriggerGridNo, FALSE, FALSE, FALSE, RUNNING, FALSE, FALSE, 0);
|
||||
@@ -269,7 +269,7 @@ INT8 PanicAI(SOLDIERTYPE *pSoldier, UINT8 ubCanMove)
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
|
||||
// if we have enough APs to activate it now
|
||||
if (pSoldier->bActionPoints >= AP_USE_REMOTE)
|
||||
if (pSoldier->bActionPoints >= APBPConstants[AP_USE_REMOTE])
|
||||
{
|
||||
#ifdef TESTVERSION
|
||||
sprintf(tempstr,"TEST MSG: %s - ACTIVATING his DETONATOR!",pSoldier->name);
|
||||
@@ -344,7 +344,7 @@ INT8 PanicAI(SOLDIERTYPE *pSoldier, UINT8 ubCanMove)
|
||||
////////////////////////////////////////////////////////////////
|
||||
|
||||
// and we have enough APs left to pull the trigger
|
||||
if (pSoldier->bActionPoints >= AP_PULL_TRIGGER)
|
||||
if (pSoldier->bActionPoints >= APBPConstants[AP_PULL_TRIGGER])
|
||||
{
|
||||
// blow up the all the PANIC bombs (or just the journal)
|
||||
pSoldier->aiData.usActionData = sPanicTriggerGridNo;
|
||||
|
||||
+1
-1
@@ -7,7 +7,7 @@
|
||||
|
||||
#define TESTAICONTROL
|
||||
|
||||
extern INT8 gubAIPathCosts[19][19];
|
||||
extern INT16 gubAIPathCosts[19][19];
|
||||
#define AI_PATHCOST_RADIUS 9
|
||||
|
||||
extern BOOLEAN gfDisplayCoverValues;
|
||||
|
||||
Reference in New Issue
Block a user