mirror of
https://github.com/1dot13/source.git
synced 2026-07-22 13:40:22 +02:00
-fixed guns being chosen from too high a level in "Normal Guns" mode
-fixed AI not firing guns when able - this should reduce the amount of running back and forth and also the running up to your guys and crouching git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@332 3b4a5df2-a311-0410-b5c6-a8a6f20db521
This commit is contained in:
+2
-2
@@ -23,12 +23,12 @@ INT16 zVersionLabel[256] = { L"Beta v. 0.98" };
|
||||
#else
|
||||
|
||||
//RELEASE BUILD VERSION
|
||||
INT16 zVersionLabel[256] = { L"Release v1.13.328" };
|
||||
INT16 zVersionLabel[256] = { L"Release v1.13.332" };
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
INT8 czVersionNumber[16] = { "Build 06.07.02" };
|
||||
INT8 czVersionNumber[16] = { "Build 06.07.06" };
|
||||
INT16 zTrackingNumber[16] = { L"Z" };
|
||||
|
||||
|
||||
|
||||
@@ -2627,13 +2627,42 @@ UINT16 SelectStandardArmyGun( UINT8 uiGunLevel )
|
||||
if (!ItemIsLegal(usGunIndex)) //Madd: check for tons of guns
|
||||
usGunIndex = -1;
|
||||
|
||||
//Check to avoid an endless loop looking for "normal" guns
|
||||
if (usGunIndex == -1)
|
||||
{
|
||||
//Madd: there better be something from the original JA2 guns here somewhere (biggunlist=0) or else this will probably cause an endless loop
|
||||
if ( uiGunLevel < ARMY_GUN_LEVELS )
|
||||
uiGunLevel++;
|
||||
else
|
||||
uiGunLevel--;
|
||||
//Madd: there better be something from the original JA2 guns here somewhere (biggunlist=0)!
|
||||
int numTries = 0;
|
||||
//Try 5 more times...
|
||||
while (numTries < 5 && usGunIndex == -1)
|
||||
{
|
||||
uiChoice = Random(pGunChoiceTable[ uiGunLevel ].ubChoices);
|
||||
usGunIndex = pGunChoiceTable[ uiGunLevel ].bItemNo[ uiChoice ];
|
||||
|
||||
if (!ItemIsLegal(usGunIndex)) //Madd: check for tons of guns
|
||||
usGunIndex = -1;
|
||||
|
||||
numTries++;
|
||||
}
|
||||
|
||||
if (usGunIndex == -1) //We still haven't found one! Start just looping through the guns then
|
||||
{
|
||||
for (int i=0;i<pGunChoiceTable[uiGunLevel].ubChoices;i++)
|
||||
{
|
||||
usGunIndex = pGunChoiceTable[ uiGunLevel ].bItemNo[ i ];
|
||||
|
||||
if (!ItemIsLegal(usGunIndex))
|
||||
usGunIndex = -1;
|
||||
else
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if ( usGunIndex == -1 )
|
||||
{
|
||||
//Still nothing? Then he gets a glock
|
||||
usGunIndex = GLOCK_17;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
+12
-2
@@ -129,6 +129,8 @@ void CalcBestShot(SOLDIERTYPE *pSoldier, ATTACKTYPE *pBestShot, BOOLEAN shootUns
|
||||
SOLDIERTYPE *pOpponent;
|
||||
UINT8 ubBurstAPs;
|
||||
|
||||
DebugMsg (TOPIC_JA2,DBG_LEVEL_3,"CalcBestShot");
|
||||
|
||||
ubBestChanceToHit = ubBestAimTime = ubChanceToHit = 0;
|
||||
|
||||
pSoldier->usAttackingWeapon = pSoldier->inv[HANDPOS].usItem;
|
||||
@@ -155,9 +157,17 @@ void CalcBestShot(SOLDIERTYPE *pSoldier, ATTACKTYPE *pBestShot, BOOLEAN shootUns
|
||||
continue; // next merc
|
||||
|
||||
// if this opponent is not currently in sight (ignore known but unseen!)
|
||||
if ((pSoldier->bOppList[pOpponent->ubID] != SEEN_CURRENTLY && !shootUnseen) ||
|
||||
(shootUnseen && gbPublicOpplist[pSoldier->bTeam][pOpponent->ubID] != SEEN_CURRENTLY) )
|
||||
if ((pSoldier->bOppList[pOpponent->ubID] != SEEN_CURRENTLY && !shootUnseen)) //guys we can't see
|
||||
{
|
||||
DebugMsg (TOPIC_JA2,DBG_LEVEL_3,String("CalcBestShot: soldier = %d, target = %d, skip guys we can't see, shootUnseen = %d, personal opplist = %d",pSoldier->ubID, pOpponent->ubID, shootUnseen, pSoldier->bOppList[pOpponent->ubID]));
|
||||
continue; // next opponent
|
||||
}
|
||||
if ((pSoldier->bOppList[pOpponent->ubID] != SEEN_CURRENTLY && gbPublicOpplist[pSoldier->bTeam][pOpponent->ubID] != SEEN_CURRENTLY)) // guys nobody sees
|
||||
{
|
||||
DebugMsg (TOPIC_JA2,DBG_LEVEL_3,String("CalcBestShot: soldier = %d, target = %d, skip guys nobody sees, shootUnseen = %d, public opplist = %d",pSoldier->ubID, pOpponent->ubID, shootUnseen,gbPublicOpplist[pSoldier->bTeam][pOpponent->ubID]));
|
||||
continue; // next opponent
|
||||
}
|
||||
|
||||
|
||||
// Special stuff for Carmen the bounty hunter
|
||||
if (pSoldier->bAttitude == ATTACKSLAYONLY && pOpponent->ubProfile != SLAY)
|
||||
|
||||
@@ -4026,19 +4026,23 @@ bCanAttack = FALSE;
|
||||
{
|
||||
case AI_ACTION_FIRE_GUN:
|
||||
memcpy(&BestAttack,&BestShot,sizeof(BestAttack));
|
||||
DebugMsg (TOPIC_JA2,DBG_LEVEL_3,"DecideActionBlack: best attack = firing a gun");
|
||||
break;
|
||||
|
||||
case AI_ACTION_TOSS_PROJECTILE:
|
||||
memcpy(&BestAttack,&BestThrow,sizeof(BestAttack));
|
||||
DebugMsg (TOPIC_JA2,DBG_LEVEL_3,"DecideActionBlack: best attack = tossing a grenade");
|
||||
break;
|
||||
|
||||
case AI_ACTION_THROW_KNIFE:
|
||||
case AI_ACTION_KNIFE_MOVE:
|
||||
DebugMsg (TOPIC_JA2,DBG_LEVEL_3,"DecideActionBlack: best attack = stab with a knife");
|
||||
memcpy(&BestAttack,&BestStab,sizeof(BestAttack));
|
||||
break;
|
||||
|
||||
default:
|
||||
// set to empty
|
||||
DebugMsg (TOPIC_JA2,DBG_LEVEL_3,"DecideActionBlack: best attack = no good attack");
|
||||
memset( &BestAttack, 0, sizeof( BestAttack ) );
|
||||
break;
|
||||
}
|
||||
@@ -4060,6 +4064,7 @@ bCanAttack = FALSE;
|
||||
fAllowCoverCheck = TRUE;
|
||||
if ( PreRandom( 10 ) > BestAttack.ubChanceToReallyHit )
|
||||
{
|
||||
DebugMsg (TOPIC_JA2,DBG_LEVEL_3,"DecideActionBlack: can't hit so screw the attack");
|
||||
// screw the attack!
|
||||
ubBestAttackAction = AI_ACTION_NONE;
|
||||
}
|
||||
@@ -4090,6 +4095,7 @@ bCanAttack = FALSE;
|
||||
sBestCover = NOWHERE;
|
||||
#endif
|
||||
|
||||
DebugMsg (TOPIC_JA2,DBG_LEVEL_3,"DecideActionBlack: DECIDE BETWEEN ATTACKING AND DEFENDING (TAKING COVER)");
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
// IF NECESSARY, DECIDE BETWEEN ATTACKING AND DEFENDING (TAKING COVER)
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
@@ -4155,15 +4161,19 @@ bCanAttack = FALSE;
|
||||
DebugAI( tempstr );
|
||||
#endif
|
||||
|
||||
DebugMsg (TOPIC_JA2,DBG_LEVEL_3,"DecideActionBlack: if his defensive instincts win out, forget all about the attack");
|
||||
// if his defensive instincts win out, forget all about the attack
|
||||
if (iDefense > iOffense)
|
||||
ubBestAttackAction = AI_ACTION_NONE;
|
||||
}
|
||||
|
||||
|
||||
DebugMsg (TOPIC_JA2,DBG_LEVEL_3,String("DecideActionBlack: is attack still desirable? ubBestAttackAction = %d",ubBestAttackAction));
|
||||
|
||||
// if attack is still desirable (meaning it's also preferred to taking cover)
|
||||
if (ubBestAttackAction != AI_ACTION_NONE)
|
||||
{
|
||||
DebugMsg (TOPIC_JA2,DBG_LEVEL_3,"DecideActionBlack: attack is still desirable (meaning it's also preferred to taking cover)");
|
||||
// if we wanted to be REALLY mean, we could look at chance to hit and decide whether
|
||||
// to shoot at the head...
|
||||
|
||||
@@ -4254,6 +4264,7 @@ bCanAttack = FALSE;
|
||||
pSoldier->inv[BestAttack.bWeaponIn].ubGunShotsLeft > 1 &&
|
||||
(pSoldier->bTeam != gbPlayerNum || pSoldier->bRTPCombat == RTP_COMBAT_AGGRESSIVE) )
|
||||
{
|
||||
DebugMsg (TOPIC_JA2,DBG_LEVEL_3,"DecideActionBlack: ENOUGH APs TO BURST, RANDOM CHANCE OF DOING SO");
|
||||
|
||||
ubBurstAPs = CalcAPsToBurst( CalcActionPoints( pSoldier ), &(pSoldier->inv[BestAttack.bWeaponIn]) );
|
||||
|
||||
@@ -4316,6 +4327,7 @@ bCanAttack = FALSE;
|
||||
(( pSoldier->inv[BestAttack.bWeaponIn].ubGunShotsLeft > 1 &&
|
||||
BestAttack.ubAimTime != BURSTING ) || Weapon[pSoldier->inv[BestAttack.bWeaponIn].usItem].NoSemiAuto) )
|
||||
{
|
||||
DebugMsg (TOPIC_JA2,DBG_LEVEL_3,"DecideActionBlack: ENOUGH APs TO AUTOFIRE, RANDOM CHANCE OF DOING SO");
|
||||
pSoldier->bDoAutofire = 0;
|
||||
do
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user