mirror of
https://github.com/1dot13/source.git
synced 2026-08-05 14:00:23 +02:00
Fix for AI seeking climb point in toxic gas
Fix for civilians trying to climb the roof to seek noise Fix for punching and stabbing Transparent change: Gave names to anonymous structs in OBJECTTYPE git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@1225 3b4a5df2-a311-0410-b5c6-a8a6f20db521
This commit is contained in:
@@ -101,7 +101,7 @@ INT8 OKToAttack(SOLDIERTYPE * pSoldier, int target)
|
||||
return(NOSHOOT_NOLOAD);
|
||||
}
|
||||
}
|
||||
else if (pSoldier->inv[HANDPOS].ubGunShotsLeft == 0 /*SB*/ || !(pSoldier->inv[HANDPOS].ubGunState & GS_CARTRIDGE_IN_CHAMBER))
|
||||
else if (pSoldier->inv[HANDPOS].ItemData.Gun.ubGunShotsLeft == 0 /*SB*/ || !(pSoldier->inv[HANDPOS].ItemData.Gun.ubGunState & GS_CARTRIDGE_IN_CHAMBER))
|
||||
{
|
||||
return(NOSHOOT_NOAMMO);
|
||||
}
|
||||
@@ -1354,7 +1354,7 @@ INT16 FindClosestClimbPointAvailableToAI( SOLDIERTYPE * pSoldier, INT16 sStartGr
|
||||
// since climbing necessary involves going an extra tile, we compare against 1 less than the roam range...
|
||||
// or add 1 to the distance to the climb point
|
||||
|
||||
sGridNo = FindClosestClimbPoint( sStartGridNo, sDesiredGridNo, fClimbUp );
|
||||
sGridNo = FindClosestClimbPoint( pSoldier, sStartGridNo, sDesiredGridNo, fClimbUp );
|
||||
|
||||
|
||||
if ( PythSpacesAway( sRoamingOrigin, sGridNo ) + 1 > sRoamingRange )
|
||||
|
||||
+14
-14
@@ -102,7 +102,7 @@ void LoadWeaponIfNeeded(SOLDIERTYPE *pSoldier)
|
||||
// remove payload from its pocket, and add it as the hand weapon's first attachment
|
||||
|
||||
OBJECTTYPE Temp;
|
||||
CreateItem(pSoldier->inv[bPayloadPocket].usItem,pSoldier->inv[bPayloadPocket].bStatus[0],&Temp);
|
||||
CreateItem(pSoldier->inv[bPayloadPocket].usItem,pSoldier->inv[bPayloadPocket].ItemData.Generic.bStatus[0],&Temp);
|
||||
AttachObject ( pSoldier, &pSoldier->inv[HANDPOS],&Temp,FALSE);
|
||||
|
||||
//pSoldier->inv[HANDPOS].usAttachItem[0] = pSoldier->inv[bPayloadPocket].usItem;
|
||||
@@ -1590,7 +1590,7 @@ INT32 EstimateShotDamage(SOLDIERTYPE *pSoldier, SOLDIERTYPE *pOpponent, UINT8 ub
|
||||
}
|
||||
else
|
||||
{
|
||||
ubAmmoType = pSoldier->inv[pSoldier->ubAttackingHand].ubGunAmmoType;
|
||||
ubAmmoType = pSoldier->inv[pSoldier->ubAttackingHand].ItemData.Gun.ubGunAmmoType;
|
||||
}
|
||||
|
||||
// calculate distance to target, obtain his gun's maximum range rating
|
||||
@@ -1612,7 +1612,7 @@ INT32 EstimateShotDamage(SOLDIERTYPE *pSoldier, SOLDIERTYPE *pOpponent, UINT8 ub
|
||||
if (pOpponent->inv[HELMETPOS].usItem)
|
||||
{
|
||||
iHeadProt += (INT32) Armour[Item[pOpponent->inv[HELMETPOS].usItem].ubClassIndex].ubProtection *
|
||||
(INT32) pOpponent->inv[HELMETPOS].bStatus[0] / 100;
|
||||
(INT32) pOpponent->inv[HELMETPOS].ItemData.Generic.bStatus[0] / 100;
|
||||
}
|
||||
|
||||
// if opponent is wearing a protective vest
|
||||
@@ -1622,7 +1622,7 @@ INT32 EstimateShotDamage(SOLDIERTYPE *pSoldier, SOLDIERTYPE *pOpponent, UINT8 ub
|
||||
if (pOpponent->inv[VESTPOS].usItem)
|
||||
{
|
||||
iTorsoProt += (INT32) Armour[Item[pOpponent->inv[VESTPOS].usItem].ubClassIndex].ubProtection *
|
||||
(INT32) pOpponent->inv[VESTPOS].bStatus[0] / 100;
|
||||
(INT32) pOpponent->inv[VESTPOS].ItemData.Generic.bStatus[0] / 100;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1641,7 +1641,7 @@ INT32 EstimateShotDamage(SOLDIERTYPE *pSoldier, SOLDIERTYPE *pOpponent, UINT8 ub
|
||||
if (pOpponent->inv[LEGPOS].usItem)
|
||||
{
|
||||
iLegProt += (INT32) Armour[Item[pOpponent->inv[LEGPOS].usItem].ubClassIndex].ubProtection *
|
||||
(INT32) pOpponent->inv[LEGPOS].bStatus[0] / 100;
|
||||
(INT32) pOpponent->inv[LEGPOS].ItemData.Generic.bStatus[0] / 100;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1764,7 +1764,7 @@ INT32 EstimateThrowDamage( SOLDIERTYPE *pSoldier, UINT8 ubItemPos, SOLDIERTYPE *
|
||||
if (bSlot == HEAD1POS || bSlot == HEAD2POS)
|
||||
{
|
||||
// take condition of the gas mask into account - it could be leaking
|
||||
iBreathDamage = (iBreathDamage * (100 - pOpponent->inv[bSlot].bStatus[0])) / 100;
|
||||
iBreathDamage = (iBreathDamage * (100 - pOpponent->inv[bSlot].ItemData.Generic.bStatus[0])) / 100;
|
||||
//NumMessage("damage after GAS MASK: ",iBreathDamage);
|
||||
}
|
||||
|
||||
@@ -1803,7 +1803,7 @@ INT32 EstimateThrowDamage( SOLDIERTYPE *pSoldier, UINT8 ubItemPos, SOLDIERTYPE *
|
||||
|
||||
// approximate chance of the grenade going off (Ian's formulas are too funky)
|
||||
// then use that to reduce the expected damage because thing may not blow!
|
||||
iDamage = (iDamage * pSoldier->inv[ubItemPos].bStatus[0]) / 100;
|
||||
iDamage = (iDamage * pSoldier->inv[ubItemPos].ItemData.Generic.bStatus[0]) / 100;
|
||||
|
||||
// if the target gridno is in water, grenade may not blow (guess 50% of time)
|
||||
/*
|
||||
@@ -1895,9 +1895,9 @@ INT8 TryToReload( SOLDIERTYPE * pSoldier )
|
||||
//<SB> manual recharge
|
||||
pObj = &(pSoldier->inv[HANDPOS]);
|
||||
|
||||
if (pObj->ubGunShotsLeft && !(pObj->ubGunState & GS_CARTRIDGE_IN_CHAMBER) )
|
||||
if (pObj->ItemData.Gun.ubGunShotsLeft && !(pObj->ItemData.Gun.ubGunState & GS_CARTRIDGE_IN_CHAMBER) )
|
||||
{
|
||||
pObj->ubGunState |= GS_CARTRIDGE_IN_CHAMBER;
|
||||
pObj->ItemData.Gun.ubGunState |= GS_CARTRIDGE_IN_CHAMBER;
|
||||
|
||||
DeductPoints(pSoldier, Weapon[Item[(pObj)->usItem].ubClassIndex].APsToReloadManually, 0);
|
||||
|
||||
@@ -1908,9 +1908,9 @@ INT8 TryToReload( SOLDIERTYPE * pSoldier )
|
||||
{
|
||||
pObj2 = &(pSoldier->inv[SECONDHANDPOS]);
|
||||
|
||||
if (pObj2->ubGunShotsLeft && !(pObj2->ubGunState & GS_CARTRIDGE_IN_CHAMBER) )
|
||||
if (pObj2->ItemData.Gun.ubGunShotsLeft && !(pObj2->ItemData.Gun.ubGunState & GS_CARTRIDGE_IN_CHAMBER) )
|
||||
{
|
||||
pObj2->ubGunState |= GS_CARTRIDGE_IN_CHAMBER;
|
||||
pObj2->ItemData.Gun.ubGunState |= GS_CARTRIDGE_IN_CHAMBER;
|
||||
PlayJA2Sample( Weapon[ Item[pObj2->usItem].ubClassIndex ].ManualReloadSound, RATE_11025, SoundVolume( HIGHVOLUME, pSoldier->sGridNo ), 1, SoundDir( pSoldier->sGridNo ) );
|
||||
}
|
||||
}
|
||||
@@ -1923,9 +1923,9 @@ INT8 TryToReload( SOLDIERTYPE * pSoldier )
|
||||
{
|
||||
pObj2 = &(pSoldier->inv[SECONDHANDPOS]);
|
||||
|
||||
if (pObj2->ubGunShotsLeft && !(pObj2->ubGunState & GS_CARTRIDGE_IN_CHAMBER) )
|
||||
if (pObj2->ItemData.Gun.ubGunShotsLeft && !(pObj2->ItemData.Gun.ubGunState & GS_CARTRIDGE_IN_CHAMBER) )
|
||||
{
|
||||
pObj2->ubGunState |= GS_CARTRIDGE_IN_CHAMBER;
|
||||
pObj2->ItemData.Gun.ubGunState |= GS_CARTRIDGE_IN_CHAMBER;
|
||||
|
||||
DeductPoints(pSoldier, Weapon[Item[(pObj2)->usItem].ubClassIndex].APsToReloadManually, 0);
|
||||
|
||||
@@ -2470,7 +2470,7 @@ void CheckIfShotPossible(SOLDIERTYPE *pSoldier, ATTACKTYPE *pBestShot, BOOLEAN s
|
||||
}
|
||||
|
||||
if ( (!suppressionFire && ( (IsScoped(pObj) && GunRange(pObj) > MaxDistanceVisible() ) || pSoldier->bOrders == SNIPER ) ) ||
|
||||
(suppressionFire && IsGunAutofireCapable(pSoldier,pBestShot->bWeaponIn ) && GetMagSize(pObj) > 30 && pObj->ubGunShotsLeft > 20 ))
|
||||
(suppressionFire && IsGunAutofireCapable(pSoldier,pBestShot->bWeaponIn ) && GetMagSize(pObj) > 30 && pObj->ItemData.Gun.ubGunShotsLeft > 20 ))
|
||||
{
|
||||
// get the minimum cost to attack with this item
|
||||
DebugMsg (TOPIC_JA2,DBG_LEVEL_3,"CheckIfShotPossible: getting min aps");
|
||||
|
||||
@@ -1117,9 +1117,9 @@ INT8 CreatureDecideActionBlack( SOLDIERTYPE * pSoldier )
|
||||
|
||||
if (bWeaponIn != NO_SLOT)
|
||||
{
|
||||
if (Item[pSoldier->inv[bWeaponIn].usItem].usItemClass == IC_GUN && pSoldier->inv[bWeaponIn].bGunStatus >= USABLE)
|
||||
if (Item[pSoldier->inv[bWeaponIn].usItem].usItemClass == IC_GUN && pSoldier->inv[bWeaponIn].ItemData.Gun.bGunStatus >= USABLE)
|
||||
{
|
||||
if (pSoldier->inv[bWeaponIn].ubGunShotsLeft > 0)
|
||||
if (pSoldier->inv[bWeaponIn].ItemData.Gun.ubGunShotsLeft > 0)
|
||||
{
|
||||
bSpitIn = bWeaponIn;
|
||||
// if it's in another pocket, swap it into his hand temporarily
|
||||
|
||||
+17
-14
@@ -984,7 +984,7 @@ INT8 DecideActionGreen(SOLDIERTYPE *pSoldier)
|
||||
pSoldier->usActionData = FindClosestClimbPoint(pSoldier, fUp );
|
||||
// Added the check here because sniper militia who are locked inside of a building without keys
|
||||
// will still have a >100% chance to want to climb, which means an infinite loop. In fact, any
|
||||
// time a move is desired, there is also probably be a need to check for a path.
|
||||
// time a move is desired, there probably also will be a need to check for a path.
|
||||
if ( pSoldier->usActionData != NOWHERE &&
|
||||
LegalNPCDestination(pSoldier,pSoldier->usActionData,ENSURE_PATH,WATEROK, 0 ))
|
||||
{
|
||||
@@ -1525,8 +1525,11 @@ INT8 DecideActionYellow(SOLDIERTYPE *pSoldier)
|
||||
return AI_ACTION_SEEK_NOISE ;
|
||||
}
|
||||
|
||||
|
||||
if ( !( pSoldier->bTeam == CIV_TEAM && pSoldier->ubProfile != NO_PROFILE && pSoldier->ubProfile != ELDIN ) )
|
||||
// Hmmm, I don't think this check is doing what is intended. But then I see no comment about what is intended.
|
||||
// However, civilians with no profile (and likely no weapons) do not need to be seeking out noises. Most don't
|
||||
// even have the body type for it (can't climb or jump).
|
||||
//if ( !( pSoldier->bTeam == CIV_TEAM && pSoldier->ubProfile != NO_PROFILE && pSoldier->ubProfile != ELDIN ) )
|
||||
if ( pSoldier->bTeam != CIV_TEAM || ( pSoldier->ubProfile != NO_PROFILE && pSoldier->ubProfile != ELDIN ) )
|
||||
{
|
||||
// IF WE ARE MILITIA/CIV IN REALTIME, CLOSE TO NOISE, AND CAN SEE THE SPOT WHERE THE NOISE CAME FROM, FORGET IT
|
||||
if ( fReachable && !fClimb && !gfTurnBasedAI && (pSoldier->bTeam == MILITIA_TEAM || pSoldier->bTeam == CIV_TEAM )&& PythSpacesAway( pSoldier->sGridNo, sNoiseGridNo ) < 5 )
|
||||
@@ -1619,7 +1622,7 @@ INT8 DecideActionYellow(SOLDIERTYPE *pSoldier)
|
||||
}
|
||||
else
|
||||
{
|
||||
pSoldier->usActionData = FindClosestClimbPoint(pSoldier->sGridNo , sNoiseGridNo , fUp );
|
||||
pSoldier->usActionData = FindClosestClimbPoint(pSoldier, pSoldier->sGridNo , sNoiseGridNo , fUp );
|
||||
if ( pSoldier->usActionData != NOWHERE )
|
||||
{
|
||||
return( AI_ACTION_MOVE_TO_CLIMB );
|
||||
@@ -1759,7 +1762,7 @@ INT8 DecideActionYellow(SOLDIERTYPE *pSoldier)
|
||||
}
|
||||
else
|
||||
{
|
||||
pSoldier->usActionData = FindClosestClimbPoint(pSoldier->sGridNo , sClosestFriend , fUp );
|
||||
pSoldier->usActionData = FindClosestClimbPoint(pSoldier, pSoldier->sGridNo , sClosestFriend , fUp );
|
||||
if ( pSoldier->usActionData != NOWHERE )
|
||||
{
|
||||
return( AI_ACTION_MOVE_TO_CLIMB );
|
||||
@@ -2293,7 +2296,7 @@ INT8 DecideActionRed(SOLDIERTYPE *pSoldier, UINT8 ubUnconsciousOK)
|
||||
ubBurstAPs = CalcAPsToAutofire( CalcActionPoints( pSoldier ), &(pSoldier->inv[BestShot.bWeaponIn]), pSoldier->bDoAutofire );
|
||||
}
|
||||
while( pSoldier->bActionPoints >= BestShot.ubAPCost + ubBurstAPs &&
|
||||
pSoldier->inv[ pSoldier->ubAttackingHand ].ubGunShotsLeft >= pSoldier->bDoAutofire &&
|
||||
pSoldier->inv[ pSoldier->ubAttackingHand ].ItemData.Gun.ubGunShotsLeft >= pSoldier->bDoAutofire &&
|
||||
GetAutoPenalty(&pSoldier->inv[ pSoldier->ubAttackingHand ], gAnimControl[ pSoldier->usAnimState ].ubEndHeight == ANIM_PRONE)*pSoldier->bDoAutofire <= 80 );
|
||||
|
||||
|
||||
@@ -2779,7 +2782,7 @@ INT8 DecideActionRed(SOLDIERTYPE *pSoldier, UINT8 ubUnconsciousOK)
|
||||
}
|
||||
else
|
||||
{
|
||||
pSoldier->usActionData = FindClosestClimbPoint(pSoldier->sGridNo , sClosestDisturbance , fUp );
|
||||
pSoldier->usActionData = FindClosestClimbPoint(pSoldier, pSoldier->sGridNo , sClosestDisturbance , fUp );
|
||||
if ( pSoldier->usActionData != NOWHERE )
|
||||
{
|
||||
return( AI_ACTION_MOVE_TO_CLIMB );
|
||||
@@ -2993,7 +2996,7 @@ INT8 DecideActionRed(SOLDIERTYPE *pSoldier, UINT8 ubUnconsciousOK)
|
||||
}
|
||||
else
|
||||
{
|
||||
pSoldier->usActionData = FindClosestClimbPoint(pSoldier->sGridNo , sClosestFriend , fUp );
|
||||
pSoldier->usActionData = FindClosestClimbPoint(pSoldier, pSoldier->sGridNo , sClosestFriend , fUp );
|
||||
if ( pSoldier->usActionData != NOWHERE )
|
||||
{
|
||||
return( AI_ACTION_MOVE_TO_CLIMB );
|
||||
@@ -3796,7 +3799,7 @@ INT8 DecideActionBlack(SOLDIERTYPE *pSoldier)
|
||||
}
|
||||
|
||||
// now it better be a gun, or the guy can't shoot (but has other attack(s))
|
||||
if (Item[pSoldier->inv[HANDPOS].usItem].usItemClass == IC_GUN && pSoldier->inv[HANDPOS].bGunStatus >= USABLE)
|
||||
if (Item[pSoldier->inv[HANDPOS].usItem].usItemClass == IC_GUN && pSoldier->inv[HANDPOS].ItemData.Gun.bGunStatus >= USABLE)
|
||||
{
|
||||
// get the minimum cost to attack the same target with this gun
|
||||
ubMinAPCost = MinAPsToAttack(pSoldier,pSoldier->sLastTarget,ADDTURNCOST);
|
||||
@@ -4319,7 +4322,7 @@ INT8 DecideActionBlack(SOLDIERTYPE *pSoldier)
|
||||
|
||||
if (IsGunBurstCapable( pSoldier, BestAttack.bWeaponIn, FALSE ) &&
|
||||
!(Menptr[BestShot.ubOpponent].bLife < OKLIFE) && // don't burst at downed targets
|
||||
pSoldier->inv[BestAttack.bWeaponIn].ubGunShotsLeft > 1 &&
|
||||
pSoldier->inv[BestAttack.bWeaponIn].ItemData.Gun.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");
|
||||
@@ -4347,7 +4350,7 @@ INT8 DecideActionBlack(SOLDIERTYPE *pSoldier)
|
||||
case ATTACKSLAYONLY:iChance += 30; break;
|
||||
}
|
||||
|
||||
if ( pSoldier->inv[BestAttack.bWeaponIn].ubGunShotsLeft > 50 )
|
||||
if ( pSoldier->inv[BestAttack.bWeaponIn].ItemData.Gun.ubGunShotsLeft > 50 )
|
||||
iChance += 20;
|
||||
|
||||
// increase chance based on proximity and difficulty of enemy
|
||||
@@ -4382,7 +4385,7 @@ INT8 DecideActionBlack(SOLDIERTYPE *pSoldier)
|
||||
|
||||
if (IsGunAutofireCapable( pSoldier, BestAttack.bWeaponIn ) &&
|
||||
!(Menptr[BestShot.ubOpponent].bLife < OKLIFE) && // don't burst at downed targets
|
||||
(( pSoldier->inv[BestAttack.bWeaponIn].ubGunShotsLeft > 1 &&
|
||||
(( pSoldier->inv[BestAttack.bWeaponIn].ItemData.Gun.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");
|
||||
@@ -4393,7 +4396,7 @@ INT8 DecideActionBlack(SOLDIERTYPE *pSoldier)
|
||||
ubBurstAPs = CalcAPsToAutofire( CalcActionPoints( pSoldier ), &(pSoldier->inv[BestAttack.bWeaponIn]), pSoldier->bDoAutofire );
|
||||
}
|
||||
while( pSoldier->bActionPoints >= BestAttack.ubAPCost + ubBurstAPs &&
|
||||
pSoldier->inv[ pSoldier->ubAttackingHand ].ubGunShotsLeft >= pSoldier->bDoAutofire &&
|
||||
pSoldier->inv[ pSoldier->ubAttackingHand ].ItemData.Gun.ubGunShotsLeft >= pSoldier->bDoAutofire &&
|
||||
GetAutoPenalty(&pSoldier->inv[ BestAttack.bWeaponIn ], gAnimControl[ pSoldier->usAnimState ].ubEndHeight == ANIM_PRONE)*pSoldier->bDoAutofire <= 80);
|
||||
|
||||
|
||||
@@ -4425,7 +4428,7 @@ INT8 DecideActionBlack(SOLDIERTYPE *pSoldier)
|
||||
}
|
||||
|
||||
|
||||
if ( pSoldier->inv[BestAttack.bWeaponIn].ubGunShotsLeft > 50 )
|
||||
if ( pSoldier->inv[BestAttack.bWeaponIn].ItemData.Gun.ubGunShotsLeft > 50 )
|
||||
iChance += 30;
|
||||
|
||||
if ( bInGas )
|
||||
|
||||
@@ -1769,16 +1769,16 @@ INT8 SearchForItems( SOLDIERTYPE * pSoldier, INT8 bReason, UINT16 usItem )
|
||||
{
|
||||
pObj = &(gWorldItems[ pItemPool->iItemIndex ].o);
|
||||
pItem = &(Item[pObj->usItem]);
|
||||
if ( pItem->usItemClass == IC_GUN && pObj->bStatus[0] >= MINIMUM_REQUIRED_STATUS )
|
||||
if ( pItem->usItemClass == IC_GUN && pObj->ItemData.Generic.bStatus[0] >= MINIMUM_REQUIRED_STATUS )
|
||||
{
|
||||
// maybe this gun has ammo (adjust for whether it is better than ours!)
|
||||
if ( pObj->bGunAmmoStatus < 0 || pObj->ubGunShotsLeft == 0 || (Item[pObj->usItem].fingerprintid && pObj->ubImprintID != NOBODY && pObj->ubImprintID != pSoldier->ubID) )
|
||||
if ( pObj->ItemData.Gun.bGunAmmoStatus < 0 || pObj->ItemData.Gun.ubGunShotsLeft == 0 || (Item[pObj->usItem].fingerprintid && pObj->ubImprintID != NOBODY && pObj->ubImprintID != pSoldier->ubID) )
|
||||
{
|
||||
iTempValue = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
iTempValue = pObj->ubGunShotsLeft * Weapon[pObj->usItem].ubDeadliness / Weapon[usItem].ubDeadliness;
|
||||
iTempValue = pObj->ItemData.Gun.ubGunShotsLeft * Weapon[pObj->usItem].ubDeadliness / Weapon[usItem].ubDeadliness;
|
||||
}
|
||||
}
|
||||
else if (ValidAmmoType( usItem, pObj->usItem ) )
|
||||
@@ -1802,9 +1802,9 @@ INT8 SearchForItems( SOLDIERTYPE * pSoldier, INT8 bReason, UINT16 usItem )
|
||||
{
|
||||
pObj = &(gWorldItems[ pItemPool->iItemIndex ].o);
|
||||
pItem = &(Item[pObj->usItem]);
|
||||
if (pItem->usItemClass & IC_WEAPON && pObj->bStatus[0] >= MINIMUM_REQUIRED_STATUS )
|
||||
if (pItem->usItemClass & IC_WEAPON && pObj->ItemData.Generic.bStatus[0] >= MINIMUM_REQUIRED_STATUS )
|
||||
{
|
||||
if ( (pItem->usItemClass & IC_GUN) && (pObj->bGunAmmoStatus < 0 || pObj->ubGunShotsLeft == 0 || (( Item[pObj->usItem].fingerprintid ) && pObj->ubImprintID != NOBODY && pObj->ubImprintID != pSoldier->ubID) ) )
|
||||
if ( (pItem->usItemClass & IC_GUN) && (pObj->ItemData.Gun.bGunAmmoStatus < 0 || pObj->ItemData.Gun.ubGunShotsLeft == 0 || (( Item[pObj->usItem].fingerprintid ) && pObj->ubImprintID != NOBODY && pObj->ubImprintID != pSoldier->ubID) ) )
|
||||
{
|
||||
// jammed or out of ammo, skip it!
|
||||
iTempValue = 0;
|
||||
@@ -1842,9 +1842,9 @@ INT8 SearchForItems( SOLDIERTYPE * pSoldier, INT8 bReason, UINT16 usItem )
|
||||
{
|
||||
pObj = &(gWorldItems[ pItemPool->iItemIndex ].o);
|
||||
pItem = &(Item[pObj->usItem]);
|
||||
if ( pItem->usItemClass & IC_WEAPON && pObj->bStatus[0] >= MINIMUM_REQUIRED_STATUS )
|
||||
if ( pItem->usItemClass & IC_WEAPON && pObj->ItemData.Generic.bStatus[0] >= MINIMUM_REQUIRED_STATUS )
|
||||
{
|
||||
if ( (pItem->usItemClass & IC_GUN) && (pObj->bGunAmmoStatus < 0 || pObj->ubGunShotsLeft == 0 || (( Item[pObj->usItem].fingerprintid ) && pObj->ubImprintID != NOBODY && pObj->ubImprintID != pSoldier->ubID) ) )
|
||||
if ( (pItem->usItemClass & IC_GUN) && (pObj->ItemData.Gun.bGunAmmoStatus < 0 || pObj->ItemData.Gun.ubGunShotsLeft == 0 || (( Item[pObj->usItem].fingerprintid ) && pObj->ubImprintID != NOBODY && pObj->ubImprintID != pSoldier->ubID) ) )
|
||||
{
|
||||
// jammed or out of ammo, skip it!
|
||||
iTempValue = 0;
|
||||
@@ -1865,7 +1865,7 @@ INT8 SearchForItems( SOLDIERTYPE * pSoldier, INT8 bReason, UINT16 usItem )
|
||||
iTempValue = 200 + Weapon[pObj->usItem].ubDeadliness;
|
||||
}
|
||||
}
|
||||
else if (pItem->usItemClass == IC_ARMOUR && pObj->bStatus[0] >= MINIMUM_REQUIRED_STATUS )
|
||||
else if (pItem->usItemClass == IC_ARMOUR && pObj->ItemData.Generic.bStatus[0] >= MINIMUM_REQUIRED_STATUS )
|
||||
{
|
||||
switch( Armour[pItem->ubClassIndex].ubArmourClass )
|
||||
{
|
||||
@@ -2623,7 +2623,7 @@ INT16 FindClosestClimbPoint (SOLDIERTYPE *pSoldier, BOOLEAN fClimbUp )
|
||||
if ( FindBuilding ( sGridNo ) != NULL )
|
||||
{
|
||||
// DebugMsg( TOPIC_JA2AI , DBG_LEVEL_3 , String("Building found at %d", sGridNo ));
|
||||
sClimbGridNo = FindClosestClimbPoint( pSoldier->sGridNo, sGridNo, fClimbUp);
|
||||
sClimbGridNo = FindClosestClimbPoint( pSoldier, pSoldier->sGridNo, sGridNo, fClimbUp);
|
||||
// DebugMsg( TOPIC_JA2AI , DBG_LEVEL_3 , String("Closest climb point is %d" , sClimbGridNo ));
|
||||
|
||||
if ( sClimbGridNo != NOWHERE )
|
||||
|
||||
+19
-19
@@ -823,7 +823,7 @@ UINT8 NPCConsiderReceivingItemFromMerc( UINT8 ubNPC, UINT8 ubMerc, OBJECTTYPE *
|
||||
case MONEY:
|
||||
case SILVER:
|
||||
case GOLD:
|
||||
if (pObj->uiMoneyAmount < LARGE_AMOUNT_MONEY)
|
||||
if (pObj->ItemData.Money.uiMoneyAmount < LARGE_AMOUNT_MONEY)
|
||||
{
|
||||
SetFactTrue( FACT_SMALL_AMOUNT_OF_MONEY );
|
||||
}
|
||||
@@ -841,7 +841,7 @@ UINT8 NPCConsiderReceivingItemFromMerc( UINT8 ubNPC, UINT8 ubMerc, OBJECTTYPE *
|
||||
break;
|
||||
}
|
||||
|
||||
if (pObj->bStatus[0] < 50)
|
||||
if (pObj->ItemData.Generic.bStatus[0] < 50)
|
||||
{
|
||||
SetFactTrue( FACT_ITEM_POOR_CONDITION );
|
||||
}
|
||||
@@ -865,14 +865,14 @@ UINT8 NPCConsiderReceivingItemFromMerc( UINT8 ubNPC, UINT8 ubMerc, OBJECTTYPE *
|
||||
case DARREN:
|
||||
if (usItemToConsider == MONEY && pNPCQuoteInfo->sActionData == NPC_ACTION_DARREN_GIVEN_CASH)
|
||||
{
|
||||
if (pObj->uiMoneyAmount < 1000)
|
||||
if (pObj->ItemData.Money.uiMoneyAmount < 1000)
|
||||
{
|
||||
// refuse, bet too low - record 15
|
||||
(*ppResultQuoteInfo) = &pNPCQuoteInfoArray[15];
|
||||
(*pubQuoteNum) = 15;
|
||||
return( (*ppResultQuoteInfo)->ubOpinionRequired );
|
||||
}
|
||||
else if (pObj->uiMoneyAmount > 5000)
|
||||
else if (pObj->ItemData.Money.uiMoneyAmount > 5000)
|
||||
{
|
||||
// refuse, bet too high - record 16
|
||||
(*ppResultQuoteInfo) = &pNPCQuoteInfoArray[16];
|
||||
@@ -896,7 +896,7 @@ UINT8 NPCConsiderReceivingItemFromMerc( UINT8 ubNPC, UINT8 ubMerc, OBJECTTYPE *
|
||||
*/
|
||||
|
||||
// record amount of bet
|
||||
gMercProfiles[ DARREN ].iBalance = pObj->uiMoneyAmount;
|
||||
gMercProfiles[ DARREN ].iBalance = pObj->ItemData.Money.uiMoneyAmount;
|
||||
SetFactFalse( FACT_DARREN_EXPECTING_MONEY );
|
||||
|
||||
// if never fought before, use record 17
|
||||
@@ -943,14 +943,14 @@ UINT8 NPCConsiderReceivingItemFromMerc( UINT8 ubNPC, UINT8 ubMerc, OBJECTTYPE *
|
||||
case ANGEL:
|
||||
if (usItemToConsider == MONEY && pNPCQuoteInfo->sActionData == NPC_ACTION_ANGEL_GIVEN_CASH)
|
||||
{
|
||||
if (pObj->uiMoneyAmount < Item[LEATHER_JACKET_W_KEVLAR].usPrice)
|
||||
if (pObj->ItemData.Money.uiMoneyAmount < Item[LEATHER_JACKET_W_KEVLAR].usPrice)
|
||||
{
|
||||
// refuse, bet too low - record 8
|
||||
(*ppResultQuoteInfo) = &pNPCQuoteInfoArray[8];
|
||||
(*pubQuoteNum) = 8;
|
||||
return( (*ppResultQuoteInfo)->ubOpinionRequired );
|
||||
}
|
||||
else if (pObj->uiMoneyAmount > Item[LEATHER_JACKET_W_KEVLAR].usPrice)
|
||||
else if (pObj->ItemData.Money.uiMoneyAmount > Item[LEATHER_JACKET_W_KEVLAR].usPrice)
|
||||
{
|
||||
// refuse, bet too high - record 9
|
||||
(*ppResultQuoteInfo) = &pNPCQuoteInfoArray[9];
|
||||
@@ -976,13 +976,13 @@ UINT8 NPCConsiderReceivingItemFromMerc( UINT8 ubNPC, UINT8 ubMerc, OBJECTTYPE *
|
||||
(*pubQuoteNum) = 5;
|
||||
return( (*ppResultQuoteInfo)->ubOpinionRequired );
|
||||
}
|
||||
switch( pObj->uiMoneyAmount )
|
||||
switch( pObj->ItemData.Money.uiMoneyAmount )
|
||||
{
|
||||
case 100:
|
||||
case 200: // Carla
|
||||
if ( CheckFact( FACT_CARLA_AVAILABLE, 0 ) )
|
||||
{
|
||||
gMercProfiles[ MADAME ].bNPCData += (INT8) (pObj->uiMoneyAmount / 100);
|
||||
gMercProfiles[ MADAME ].bNPCData += (INT8) (pObj->ItemData.Money.uiMoneyAmount / 100);
|
||||
TriggerNPCRecord( MADAME, 16 );
|
||||
}
|
||||
else
|
||||
@@ -997,7 +997,7 @@ UINT8 NPCConsiderReceivingItemFromMerc( UINT8 ubNPC, UINT8 ubMerc, OBJECTTYPE *
|
||||
case 1000: // Cindy
|
||||
if ( CheckFact( FACT_CINDY_AVAILABLE, 0 ) )
|
||||
{
|
||||
gMercProfiles[ MADAME ].bNPCData += (INT8) (pObj->uiMoneyAmount / 500);
|
||||
gMercProfiles[ MADAME ].bNPCData += (INT8) (pObj->ItemData.Money.uiMoneyAmount / 500);
|
||||
TriggerNPCRecord( MADAME, 17 );
|
||||
}
|
||||
else
|
||||
@@ -1012,7 +1012,7 @@ UINT8 NPCConsiderReceivingItemFromMerc( UINT8 ubNPC, UINT8 ubMerc, OBJECTTYPE *
|
||||
case 600: // Bambi
|
||||
if ( CheckFact( FACT_BAMBI_AVAILABLE, 0 ) )
|
||||
{
|
||||
gMercProfiles[ MADAME ].bNPCData += (INT8) (pObj->uiMoneyAmount / 300);
|
||||
gMercProfiles[ MADAME ].bNPCData += (INT8) (pObj->ItemData.Money.uiMoneyAmount / 300);
|
||||
TriggerNPCRecord( MADAME, 18 );
|
||||
}
|
||||
else
|
||||
@@ -1027,7 +1027,7 @@ UINT8 NPCConsiderReceivingItemFromMerc( UINT8 ubNPC, UINT8 ubMerc, OBJECTTYPE *
|
||||
case 800: // Maria?
|
||||
if ( gubQuest[ QUEST_RESCUE_MARIA ] == QUESTINPROGRESS )
|
||||
{
|
||||
gMercProfiles[ MADAME ].bNPCData += (INT8) (pObj->uiMoneyAmount / 400);
|
||||
gMercProfiles[ MADAME ].bNPCData += (INT8) (pObj->ItemData.Money.uiMoneyAmount / 400);
|
||||
TriggerNPCRecord( MADAME, 19 );
|
||||
break;
|
||||
}
|
||||
@@ -1072,8 +1072,8 @@ UINT8 NPCConsiderReceivingItemFromMerc( UINT8 ubNPC, UINT8 ubMerc, OBJECTTYPE *
|
||||
if ( CheckFact( FACT_VINCE_EXPECTING_MONEY, ubNPC ) == FALSE && gMercProfiles[ ubNPC ].iBalance < 0 && pNPCQuoteInfo->sActionData != NPC_ACTION_DONT_ACCEPT_ITEM )
|
||||
{
|
||||
// increment balance
|
||||
gMercProfiles[ ubNPC ].iBalance += (INT32) pObj->uiMoneyAmount;
|
||||
gMercProfiles[ ubNPC ].uiTotalCostToDate += pObj->uiMoneyAmount;
|
||||
gMercProfiles[ ubNPC ].iBalance += (INT32) pObj->ItemData.Money.uiMoneyAmount;
|
||||
gMercProfiles[ ubNPC ].uiTotalCostToDate += pObj->ItemData.Money.uiMoneyAmount;
|
||||
if ( gMercProfiles[ ubNPC ].iBalance > 0 )
|
||||
{
|
||||
gMercProfiles[ ubNPC ].iBalance = 0;
|
||||
@@ -1096,7 +1096,7 @@ UINT8 NPCConsiderReceivingItemFromMerc( UINT8 ubNPC, UINT8 ubMerc, OBJECTTYPE *
|
||||
else
|
||||
{
|
||||
// handle the player giving NPC some money
|
||||
HandleNPCBeingGivenMoneyByPlayer( ubNPC, pObj->uiMoneyAmount, pubQuoteNum );
|
||||
HandleNPCBeingGivenMoneyByPlayer( ubNPC, pObj->ItemData.Money.uiMoneyAmount, pubQuoteNum );
|
||||
(*ppResultQuoteInfo) = &pNPCQuoteInfoArray[ *pubQuoteNum ];
|
||||
return( (*ppResultQuoteInfo)->ubOpinionRequired );
|
||||
}
|
||||
@@ -1104,7 +1104,7 @@ UINT8 NPCConsiderReceivingItemFromMerc( UINT8 ubNPC, UINT8 ubMerc, OBJECTTYPE *
|
||||
else
|
||||
{
|
||||
// handle the player giving NPC some money
|
||||
HandleNPCBeingGivenMoneyByPlayer( ubNPC, pObj->uiMoneyAmount, pubQuoteNum );
|
||||
HandleNPCBeingGivenMoneyByPlayer( ubNPC, pObj->ItemData.Money.uiMoneyAmount, pubQuoteNum );
|
||||
(*ppResultQuoteInfo) = &pNPCQuoteInfoArray[ *pubQuoteNum ];
|
||||
return( (*ppResultQuoteInfo)->ubOpinionRequired );
|
||||
}
|
||||
@@ -1113,7 +1113,7 @@ UINT8 NPCConsiderReceivingItemFromMerc( UINT8 ubNPC, UINT8 ubMerc, OBJECTTYPE *
|
||||
case KINGPIN:
|
||||
if ( usItemToConsider == MONEY && gubQuest[ QUEST_KINGPIN_MONEY ] == QUESTINPROGRESS )
|
||||
{
|
||||
HandleNPCBeingGivenMoneyByPlayer( ubNPC, pObj->uiMoneyAmount, pubQuoteNum );
|
||||
HandleNPCBeingGivenMoneyByPlayer( ubNPC, pObj->ItemData.Money.uiMoneyAmount, pubQuoteNum );
|
||||
(*ppResultQuoteInfo) = &pNPCQuoteInfoArray[ *pubQuoteNum ];
|
||||
return( (*ppResultQuoteInfo)->ubOpinionRequired );
|
||||
}
|
||||
@@ -1124,8 +1124,8 @@ UINT8 NPCConsiderReceivingItemFromMerc( UINT8 ubNPC, UINT8 ubMerc, OBJECTTYPE *
|
||||
if ( gMercProfiles[ ubNPC ].iBalance < 0 && pNPCQuoteInfo->sActionData != NPC_ACTION_DONT_ACCEPT_ITEM )
|
||||
{
|
||||
// increment balance
|
||||
gMercProfiles[ ubNPC ].iBalance += (INT32) pObj->uiMoneyAmount;
|
||||
gMercProfiles[ ubNPC ].uiTotalCostToDate += pObj->uiMoneyAmount;
|
||||
gMercProfiles[ ubNPC ].iBalance += (INT32) pObj->ItemData.Money.uiMoneyAmount;
|
||||
gMercProfiles[ ubNPC ].uiTotalCostToDate += pObj->ItemData.Money.uiMoneyAmount;
|
||||
if ( gMercProfiles[ ubNPC ].iBalance > 0 )
|
||||
{
|
||||
gMercProfiles[ ubNPC ].iBalance = 0;
|
||||
|
||||
Reference in New Issue
Block a user