mirror of
https://github.com/1dot13/source.git
synced 2026-08-12 14:10:23 +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:
@@ -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;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user