mirror of
https://github.com/1dot13/source.git
synced 2026-08-05 14:00:23 +02:00
Increment watched location when soldier hears enemy and can possibly see noise location.
Suppression: - when calculating suppression effectiveness for shotgun, modify damage for pellets. - set attacker spot as watched location - alert enemy soldier if he is under fire Red AI: - no Main Red AI for civilians - set watched location to closest position where enemy can appear - snipers and soldiers with scoped guns should decide watch more often Improved Red AI watch code: - crouch if not crouched - raise weapon if not raised - turn to watched location - possibly go prone, if soldier has LOS to watched location git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@8789 3b4a5df2-a311-0410-b5c6-a8a6f20db521
This commit is contained in:
+38
-16
@@ -8342,6 +8342,8 @@ INT8 CalcSuppressionTolerance( SOLDIERTYPE * pSoldier )
|
||||
return( bTolerance );
|
||||
}
|
||||
|
||||
extern void IncrementWatchedLoc(UINT8 ubID, INT32 sGridNo, INT8 bLevel);
|
||||
|
||||
void HandleSuppressionFire( UINT8 ubTargetedMerc, UINT8 ubCausedAttacker )
|
||||
{
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
@@ -8357,16 +8359,14 @@ void HandleSuppressionFire( UINT8 ubTargetedMerc, UINT8 ubCausedAttacker )
|
||||
// The most important result of this function is AP loss.
|
||||
|
||||
//INT8 SUPPRESSION_AP_LIMIT = gGameExternalOptions.iMinAPLimitFromSuppression;
|
||||
|
||||
INT8 bTolerance;
|
||||
INT32 sClosestOpponent, sClosestOppLoc;
|
||||
UINT8 ubPointsLost, ubNewStance;
|
||||
UINT32 uiLoop;
|
||||
UINT8 ubLoop2;
|
||||
// Flag to determine if the target is cowering (if allowed)
|
||||
BOOLEAN fCower=FALSE;
|
||||
SOLDIERTYPE * pSoldier;
|
||||
// External options
|
||||
INT8 bTolerance;
|
||||
INT32 sClosestOpponent, sClosestOppLoc;
|
||||
UINT8 ubPointsLost, ubNewStance;
|
||||
UINT32 uiLoop;
|
||||
UINT8 ubLoop2;
|
||||
BOOLEAN fCower=FALSE;
|
||||
SOLDIERTYPE *pSoldier;
|
||||
SOLDIERTYPE *pAttacker = NULL;
|
||||
|
||||
// JA2_OPTIONS.INI
|
||||
INT8 MAXIMUM_SUPPRESSION_SHOCK = gGameExternalOptions.ubMaxSuppressionShock;
|
||||
@@ -8380,10 +8380,19 @@ void HandleSuppressionFire( UINT8 ubTargetedMerc, UINT8 ubCausedAttacker )
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// SANDRO - modify suppression effectiveness based on weapon caliber (i.e. damage)
|
||||
INT16 sFinalSuppressionEffectiveness = gGameExternalOptions.sSuppressionEffectiveness;
|
||||
pSoldier = MercPtrs[ubCausedAttacker];
|
||||
if ( Item[ pSoldier->inv[pSoldier->ubAttackingHand].usItem ].usItemClass == IC_GUN )
|
||||
pAttacker = MercPtrs[ubCausedAttacker];
|
||||
if (pAttacker && pAttacker->inv[pAttacker->ubAttackingHand].exists() && Item[pAttacker->inv[pAttacker->ubAttackingHand].usItem].usItemClass == IC_GUN)
|
||||
{
|
||||
UINT8 ubDamage = GetBasicDamage(&pSoldier->inv[pSoldier->ubAttackingHand]);
|
||||
OBJECTTYPE *pWeapon = &pAttacker->inv[pAttacker->ubAttackingHand];
|
||||
UINT8 ubDamage = GetBasicDamage(pWeapon);
|
||||
UINT8 ubAmmoType = (*pWeapon)[0]->data.gun.ubGunAmmoType;
|
||||
UINT8 ubBullets = AmmoTypes[ubAmmoType].numberOfBullets;
|
||||
|
||||
// sevenfm: for shotgun, modify damage for pellets
|
||||
if (ubBullets > 1)
|
||||
{
|
||||
ubDamage = ubDamage * AmmoTypes[ubAmmoType].multipleBulletDamageMultiplier / max(1, AmmoTypes[ubAmmoType].multipleBulletDamageDivisor);
|
||||
}
|
||||
|
||||
// +1% per point above 20 impact
|
||||
if ( ubDamage > 20 )
|
||||
@@ -8410,8 +8419,8 @@ void HandleSuppressionFire( UINT8 ubTargetedMerc, UINT8 ubCausedAttacker )
|
||||
}
|
||||
|
||||
// add a small bonus to effectiveness based on weapon loudness
|
||||
UINT8 ubGunVolume = Weapon[ pSoldier->inv[pSoldier->ubAttackingHand].usItem ].ubAttackVolume;
|
||||
ubGunVolume = __max( 1, ( ubGunVolume * GetPercentNoiseVolume( pSoldier->GetUsedWeapon( &pSoldier->inv[pSoldier->ubAttackingHand] ) ) ) / 100 );
|
||||
UINT8 ubGunVolume = Weapon[pAttacker->inv[pAttacker->ubAttackingHand].usItem].ubAttackVolume;
|
||||
ubGunVolume = __max(1, (ubGunVolume * GetPercentNoiseVolume(pAttacker->GetUsedWeapon(&pAttacker->inv[pAttacker->ubAttackingHand]))) / 100);
|
||||
if ( ubGunVolume >= 50 )
|
||||
{
|
||||
if ( ubGunVolume < 70 ) // up to 5%
|
||||
@@ -8423,7 +8432,7 @@ void HandleSuppressionFire( UINT8 ubTargetedMerc, UINT8 ubCausedAttacker )
|
||||
}
|
||||
}
|
||||
|
||||
// remember effectiveness at this point before modyfing it depending on target's team
|
||||
// remember effectiveness at this point before modifying it depending on target's team
|
||||
INT16 sFinalShooterDependentEffectiveness = sFinalSuppressionEffectiveness;
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
@@ -8448,6 +8457,19 @@ void HandleSuppressionFire( UINT8 ubTargetedMerc, UINT8 ubCausedAttacker )
|
||||
DebugMsg(TOPIC_JA2,DBG_LEVEL_3,String("HandleSuppressionFire: soldier id = %d, life = %d, suppression points = %d",pSoldier->ubID,pSoldier->stats.bLife, pSoldier->ubSuppressionPoints));
|
||||
DebugMsg(TOPIC_JA2,DBG_LEVEL_3,String("HandleSuppressionFire: calc suppression tolerance"));
|
||||
|
||||
// sevenfm: set attack spot as watched location
|
||||
if (pAttacker && pSoldier->bTeam == ENEMY_TEAM && !TileIsOutOfBounds(pAttacker->sGridNo))
|
||||
{
|
||||
IncrementWatchedLoc(pSoldier->ubID, pAttacker->sGridNo, pAttacker->pathing.bLevel);
|
||||
}
|
||||
|
||||
// sevenfm: alert enemy team
|
||||
if (pSoldier->bTeam == ENEMY_TEAM)
|
||||
{
|
||||
pSoldier->aiData.bAlertStatus = max(pSoldier->aiData.bAlertStatus, STATUS_RED);
|
||||
//CheckForChangingOrders(pSoldier);
|
||||
}
|
||||
|
||||
// Calculate the character's tolerance to suppression. Helps reduce the severity of the penalties inflicted
|
||||
// during this function.
|
||||
bTolerance = CalcSuppressionTolerance( pSoldier );
|
||||
|
||||
Reference in New Issue
Block a user