mirror of
https://github.com/1dot13/source.git
synced 2026-08-12 14:10: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:
@@ -1527,23 +1527,23 @@ void AddObjectToArmsDealerInventory( UINT8 ubArmsDealer, OBJECTTYPE *pObject )
|
||||
AddItemToArmsDealerInventory( ubArmsDealer, pObject->usItem, &SpclItemInfo, 1 );
|
||||
|
||||
// if any GunAmmoItem is specified
|
||||
if( pObject->usGunAmmoItem != NONE)
|
||||
if( pObject->ItemData.Gun.usGunAmmoItem != NONE)
|
||||
{
|
||||
// if it's regular ammo
|
||||
if( Item[ pObject->usGunAmmoItem ].usItemClass == IC_AMMO )
|
||||
if( Item[ pObject->ItemData.Gun.usGunAmmoItem ].usItemClass == IC_AMMO )
|
||||
{
|
||||
// and there are some remaining
|
||||
if ( pObject->ubGunShotsLeft > 0 )
|
||||
if ( pObject->ItemData.Gun.ubGunShotsLeft > 0 )
|
||||
{
|
||||
// add the bullets of its remaining ammo
|
||||
AddAmmoToArmsDealerInventory( ubArmsDealer, pObject->usGunAmmoItem, pObject->ubGunShotsLeft );
|
||||
AddAmmoToArmsDealerInventory( ubArmsDealer, pObject->ItemData.Gun.usGunAmmoItem, pObject->ItemData.Gun.ubGunShotsLeft );
|
||||
}
|
||||
}
|
||||
else // assume it's attached ammo (mortar shells, grenades)
|
||||
{
|
||||
// add the launchable item (can't be imprinted, or have attachments!)
|
||||
SetSpecialItemInfoToDefaults( &SpclItemInfo );
|
||||
SpclItemInfo.bItemCondition = pObject->bGunAmmoStatus;
|
||||
SpclItemInfo.bItemCondition = pObject->ItemData.Gun.bGunAmmoStatus;
|
||||
|
||||
// if the gun it was in was jammed, get rid of the negative status now
|
||||
if ( SpclItemInfo.bItemCondition < 0 )
|
||||
@@ -1551,7 +1551,7 @@ void AddObjectToArmsDealerInventory( UINT8 ubArmsDealer, OBJECTTYPE *pObject )
|
||||
SpclItemInfo.bItemCondition *= -1;
|
||||
}
|
||||
|
||||
AddItemToArmsDealerInventory( ubArmsDealer, pObject->usGunAmmoItem, &SpclItemInfo, 1 );
|
||||
AddItemToArmsDealerInventory( ubArmsDealer, pObject->ItemData.Gun.usGunAmmoItem, &SpclItemInfo, 1 );
|
||||
}
|
||||
}
|
||||
break;
|
||||
@@ -1560,7 +1560,7 @@ void AddObjectToArmsDealerInventory( UINT8 ubArmsDealer, OBJECTTYPE *pObject )
|
||||
// add the contents of each magazine (multiple mags may have vastly different #bullets left)
|
||||
for ( ubCnt = 0; ubCnt < pObject->ubNumberOfObjects; ubCnt++ )
|
||||
{
|
||||
AddAmmoToArmsDealerInventory( ubArmsDealer, pObject->usItem, pObject->ubShotsLeft[ ubCnt ] );
|
||||
AddAmmoToArmsDealerInventory( ubArmsDealer, pObject->usItem, pObject->ItemData.Ammo.ubShotsLeft[ ubCnt ] );
|
||||
}
|
||||
break;
|
||||
|
||||
@@ -1568,7 +1568,7 @@ void AddObjectToArmsDealerInventory( UINT8 ubArmsDealer, OBJECTTYPE *pObject )
|
||||
// add each object seperately (multiple objects may have vastly different statuses, keep any imprintID)
|
||||
for ( ubCnt = 0; ubCnt < pObject->ubNumberOfObjects; ubCnt++ )
|
||||
{
|
||||
SpclItemInfo.bItemCondition = pObject->bStatus[ ubCnt ];
|
||||
SpclItemInfo.bItemCondition = pObject->ItemData.Generic.bStatus[ ubCnt ];
|
||||
AddItemToArmsDealerInventory( ubArmsDealer, pObject->usItem, &SpclItemInfo, 1 );
|
||||
}
|
||||
break;
|
||||
@@ -2080,7 +2080,7 @@ void MakeObjectOutOfDealerItems( UINT16 usItemIndex, SPECIAL_ITEM_INFO *pSpclIte
|
||||
// have to keep track of #bullets in a gun throughout dealer inventory. Without this, players could "reload" guns
|
||||
// they don't have ammo for by selling them to Tony & buying them right back fully loaded! One could repeat this
|
||||
// ad nauseum (empty the gun between visits) as a (really expensive) way to get unlimited special ammo like rockets.
|
||||
pObject->ubGunShotsLeft = 0;
|
||||
pObject->ItemData.Gun.ubGunShotsLeft = 0;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2102,7 +2102,7 @@ void GiveObjectToArmsDealerForRepair( UINT8 ubArmsDealer, OBJECTTYPE *pObject, U
|
||||
Assert( CanDealerRepairItem( ubArmsDealer, pObject->usItem ) );
|
||||
|
||||
// c) Actually damaged, or a rocket rifle (being reset)
|
||||
Assert( ( pObject->bStatus[ 0 ] < 100 ) || ItemIsARocketRifle( pObject->usItem ) );
|
||||
Assert( ( pObject->ItemData.Generic.bStatus[ 0 ] < 100 ) || ItemIsARocketRifle( pObject->usItem ) );
|
||||
|
||||
/* ARM: Can now repair with removeable attachments still attached...
|
||||
// d) Already stripped of all *detachable* attachments
|
||||
@@ -2123,11 +2123,11 @@ void GiveObjectToArmsDealerForRepair( UINT8 ubArmsDealer, OBJECTTYPE *pObject, U
|
||||
if (Item [ pObject->usItem ].usItemClass == IC_GUN )
|
||||
{
|
||||
// if any GunAmmoItem is specified
|
||||
if( pObject->usGunAmmoItem != NONE)
|
||||
if( pObject->ItemData.Gun.usGunAmmoItem != NONE)
|
||||
{
|
||||
// it better be regular ammo, and empty
|
||||
Assert( Item[ pObject->usGunAmmoItem ].usItemClass == IC_AMMO );
|
||||
Assert( pObject->ubGunShotsLeft == 0 );
|
||||
Assert( Item[ pObject->ItemData.Gun.usGunAmmoItem ].usItemClass == IC_AMMO );
|
||||
Assert( pObject->ItemData.Gun.ubGunShotsLeft == 0 );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2250,7 +2250,7 @@ UINT32 CalculateObjectItemRepairTime( UINT8 ubArmsDealer, OBJECTTYPE *pItemObjec
|
||||
UINT32 uiRepairTime;
|
||||
UINT8 ubCnt;
|
||||
|
||||
uiRepairTime = CalculateSimpleItemRepairTime( ubArmsDealer, pItemObject->usItem, pItemObject->bStatus[ 0 ] );
|
||||
uiRepairTime = CalculateSimpleItemRepairTime( ubArmsDealer, pItemObject->usItem, pItemObject->ItemData.Generic.bStatus[ 0 ] );
|
||||
|
||||
// add time to repair any attachments on it
|
||||
for ( ubCnt = 0; ubCnt < MAX_ATTACHMENTS; ubCnt++ )
|
||||
@@ -2334,7 +2334,7 @@ UINT32 CalculateObjectItemRepairCost( UINT8 ubArmsDealer, OBJECTTYPE *pItemObjec
|
||||
UINT32 uiRepairCost;
|
||||
UINT8 ubCnt;
|
||||
|
||||
uiRepairCost = CalculateSimpleItemRepairCost( ubArmsDealer, pItemObject->usItem, pItemObject->bStatus[ 0 ] );
|
||||
uiRepairCost = CalculateSimpleItemRepairCost( ubArmsDealer, pItemObject->usItem, pItemObject->ItemData.Generic.bStatus[ 0 ] );
|
||||
|
||||
// add cost of repairing any attachments on it
|
||||
for ( ubCnt = 0; ubCnt < MAX_ATTACHMENTS; ubCnt++ )
|
||||
@@ -2435,7 +2435,7 @@ void SetSpecialItemInfoFromObject( SPECIAL_ITEM_INFO *pSpclItemInfo, OBJECTTYPE
|
||||
}
|
||||
else
|
||||
{
|
||||
pSpclItemInfo->bItemCondition = pObject->bStatus[ 0 ];
|
||||
pSpclItemInfo->bItemCondition = pObject->ItemData.Generic.bStatus[ 0 ];
|
||||
}
|
||||
|
||||
// only guns currently have imprintID properly initialized...
|
||||
|
||||
@@ -1240,8 +1240,8 @@ int ArmsDealerItemQsortCompare(const void *pArg1, const void *pArg2)
|
||||
usItem1Index = ( ( INVENTORY_IN_SLOT * ) pArg1 ) -> sItemIndex;
|
||||
usItem2Index = ( ( INVENTORY_IN_SLOT * ) pArg2 ) -> sItemIndex;
|
||||
|
||||
ubItem1Quality = ( ( INVENTORY_IN_SLOT * ) pArg1 ) -> ItemObject.bStatus[ 0 ];
|
||||
ubItem2Quality = ( ( INVENTORY_IN_SLOT * ) pArg2 ) -> ItemObject.bStatus[ 0 ];
|
||||
ubItem1Quality = ( ( INVENTORY_IN_SLOT * ) pArg1 ) -> ItemObject.ItemData.Generic.bStatus[ 0 ];
|
||||
ubItem2Quality = ( ( INVENTORY_IN_SLOT * ) pArg2 ) -> ItemObject.ItemData.Generic.bStatus[ 0 ];
|
||||
|
||||
return( CompareItemsForSorting( usItem1Index, usItem2Index, ubItem1Quality, ubItem2Quality ) );
|
||||
}
|
||||
|
||||
@@ -178,12 +178,12 @@ BOOLEAN ApplyDrugs( SOLDIERTYPE *pSoldier, OBJECTTYPE *pObject )
|
||||
if ( ubDrugType == DRUG_TYPE_REGENERATION )
|
||||
{
|
||||
// each use of a regen booster over 1, each day, reduces the effect
|
||||
bRegenPointsGained = REGEN_POINTS_PER_BOOSTER * pObject->bStatus[0] / 100;
|
||||
bRegenPointsGained = REGEN_POINTS_PER_BOOSTER * pObject->ItemData.Generic.bStatus[0] / 100;
|
||||
// are there fractional %s left over?
|
||||
if ( ( pObject->bStatus[0] % (100 / REGEN_POINTS_PER_BOOSTER ) ) != 0 )
|
||||
if ( ( pObject->ItemData.Generic.bStatus[0] % (100 / REGEN_POINTS_PER_BOOSTER ) ) != 0 )
|
||||
{
|
||||
// chance of an extra point
|
||||
if ( PreRandom( 100 / REGEN_POINTS_PER_BOOSTER ) < (UINT32) ( pObject->bStatus[0] % (100 / REGEN_POINTS_PER_BOOSTER ) ) )
|
||||
if ( PreRandom( 100 / REGEN_POINTS_PER_BOOSTER ) < (UINT32) ( pObject->ItemData.Generic.bStatus[0] % (100 / REGEN_POINTS_PER_BOOSTER ) ) )
|
||||
{
|
||||
bRegenPointsGained++;
|
||||
}
|
||||
|
||||
+37
-34
@@ -213,13 +213,16 @@ INT32 HandleItem( SOLDIERTYPE *pSoldier, INT16 sGridNo, INT8 bLevel, UINT16 usHa
|
||||
|
||||
if ( fFromUI )
|
||||
{
|
||||
INT16 sInteractiveGridNo;
|
||||
|
||||
// ATE: Check if we are targeting an interactive tile, and adjust gridno accordingly...
|
||||
pIntNode = GetCurInteractiveTileGridNoAndStructure( &sGridNo, &pStructure );
|
||||
pIntNode = GetCurInteractiveTileGridNoAndStructure( &sInteractiveGridNo, &pStructure );
|
||||
|
||||
if ( pIntNode != NULL && pTargetSoldier == pSoldier )
|
||||
{
|
||||
// Truncate target sioldier
|
||||
// Truncate target soldier and update grid
|
||||
pTargetSoldier = NULL;
|
||||
sGridNo = sInteractiveGridNo;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -502,7 +505,7 @@ INT32 HandleItem( SOLDIERTYPE *pSoldier, INT16 sGridNo, INT8 bLevel, UINT16 usHa
|
||||
pSoldier->bDoAutofire += misfirePenalty;
|
||||
sAPCost = CalcTotalAPsToAttack( pSoldier, sTargetGridNo, TRUE, 0 );
|
||||
}
|
||||
while(EnoughPoints( pSoldier, sAPCost, 0, FALSE ) && roll < ((pSoldier->inv[ pSoldier->ubAttackingHand ].ubGunShotsLeft >= pSoldier->bDoAutofire)?chanceToMisfire:chanceToMisfireDry));
|
||||
while(EnoughPoints( pSoldier, sAPCost, 0, FALSE ) && roll < ((pSoldier->inv[ pSoldier->ubAttackingHand ].ItemData.Gun.ubGunShotsLeft >= pSoldier->bDoAutofire)?chanceToMisfire:chanceToMisfireDry));
|
||||
//note that we could misfire more bullets than we have rounds
|
||||
//this represents the soldier running out of ammo and not noticing
|
||||
//the max that can be lost this way is 1AP
|
||||
@@ -510,17 +513,17 @@ INT32 HandleItem( SOLDIERTYPE *pSoldier, INT16 sGridNo, INT8 bLevel, UINT16 usHa
|
||||
pSoldier->bDoAutofire -= misfirePenalty;
|
||||
sAPCost = CalcTotalAPsToAttack( pSoldier, sTargetGridNo, TRUE, 0 );
|
||||
|
||||
if((__min(pSoldier->bDoAutofire,pSoldier->inv[ pSoldier->ubAttackingHand ].ubGunShotsLeft) - startAuto) > 0 && pSoldier->bTeam == OUR_TEAM)
|
||||
if((__min(pSoldier->bDoAutofire,pSoldier->inv[ pSoldier->ubAttackingHand ].ItemData.Gun.ubGunShotsLeft) - startAuto) > 0 && pSoldier->bTeam == OUR_TEAM)
|
||||
{
|
||||
// More than 1 round
|
||||
if (__min(pSoldier->bDoAutofire,pSoldier->inv[ pSoldier->ubAttackingHand ].ubGunShotsLeft) - startAuto > 1)
|
||||
if (__min(pSoldier->bDoAutofire,pSoldier->inv[ pSoldier->ubAttackingHand ].ItemData.Gun.ubGunShotsLeft) - startAuto > 1)
|
||||
{
|
||||
ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_INTERFACE, gzLateLocalizedString[ 62 ], pSoldier->name, __min(pSoldier->bDoAutofire,pSoldier->inv[ pSoldier->ubAttackingHand ].ubGunShotsLeft) - startAuto );
|
||||
ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_INTERFACE, gzLateLocalizedString[ 62 ], pSoldier->name, __min(pSoldier->bDoAutofire,pSoldier->inv[ pSoldier->ubAttackingHand ].ItemData.Gun.ubGunShotsLeft) - startAuto );
|
||||
}
|
||||
// 1 round
|
||||
else
|
||||
{
|
||||
ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_INTERFACE, gzLateLocalizedString[ 63 ], pSoldier->name, __min(pSoldier->bDoAutofire,pSoldier->inv[ pSoldier->ubAttackingHand ].ubGunShotsLeft) - startAuto );
|
||||
ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_INTERFACE, gzLateLocalizedString[ 63 ], pSoldier->name, __min(pSoldier->bDoAutofire,pSoldier->inv[ pSoldier->ubAttackingHand ].ItemData.Gun.ubGunShotsLeft) - startAuto );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1421,7 +1424,7 @@ void HandleSoldierDropBomb( SOLDIERTYPE *pSoldier, INT16 sGridNo )
|
||||
StatChange( pSoldier, EXPLODEAMT, 25, FALSE );
|
||||
|
||||
pSoldier->inv[ HANDPOS ].bTrap = __min( 10, ( EffectiveExplosive( pSoldier ) / 20) + (EffectiveExpLevel( pSoldier ) / 3) );
|
||||
pSoldier->inv[ HANDPOS ].ubBombOwner = pSoldier->ubID + 2;
|
||||
pSoldier->inv[ HANDPOS ].ItemData.Trigger.ubBombOwner = pSoldier->ubID + 2;
|
||||
|
||||
// we now know there is something nasty here
|
||||
gpWorldLevelData[ sGridNo ].uiFlags |= MAPELEMENT_PLAYER_MINE_PRESENT;
|
||||
@@ -1753,7 +1756,7 @@ void SoldierGetItemFromWorld( SOLDIERTYPE *pSoldier, INT32 iItemIndex, INT16 sGr
|
||||
if (Object.usItem == SWITCH)
|
||||
{
|
||||
// ask about activating the switch!
|
||||
bTempFrequency = Object.bFrequency;
|
||||
bTempFrequency = Object.ItemData.Trigger.BombTrigger.bFrequency;
|
||||
gpTempSoldier = pSoldier;
|
||||
DoMessageBox( MSG_BOX_BASIC_STYLE, TacticalStr[ ACTIVATE_SWITCH_PROMPT ] , GAME_SCREEN, ( UINT8 )MSG_BOX_FLAG_YESNO, SwitchMessageBoxCallBack, NULL );
|
||||
pItemPool = pItemPool->pNext;
|
||||
@@ -1846,7 +1849,7 @@ void SoldierGetItemFromWorld( SOLDIERTYPE *pSoldier, INT32 iItemIndex, INT16 sGr
|
||||
if (Object.usItem == SWITCH)
|
||||
{
|
||||
// handle switch
|
||||
bTempFrequency = Object.bFrequency;
|
||||
bTempFrequency = Object.ItemData.Trigger.BombTrigger.bFrequency;
|
||||
gpTempSoldier = pSoldier;
|
||||
DoMessageBox( MSG_BOX_BASIC_STYLE, TacticalStr[ ACTIVATE_SWITCH_PROMPT ], GAME_SCREEN, ( UINT8 )MSG_BOX_FLAG_YESNO, SwitchMessageBoxCallBack, NULL );
|
||||
}
|
||||
@@ -2274,22 +2277,22 @@ OBJECTTYPE* InternalAddItemToPool( INT16 *psGridNo, OBJECTTYPE *pObject, INT8 bV
|
||||
// and they are pressure-triggered unless there is a switch structure there
|
||||
if (FindStructure( *psGridNo, STRUCTURE_SWITCH ) != NULL)
|
||||
{
|
||||
pObject->bDetonatorType = BOMB_SWITCH;
|
||||
pObject->ItemData.Trigger.bDetonatorType = BOMB_SWITCH;
|
||||
}
|
||||
else
|
||||
{
|
||||
pObject->bDetonatorType = BOMB_PRESSURE;
|
||||
pObject->ItemData.Trigger.bDetonatorType = BOMB_PRESSURE;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// else they are manually controlled
|
||||
pObject->bDetonatorType = BOMB_SWITCH;
|
||||
pObject->ItemData.Trigger.bDetonatorType = BOMB_SWITCH;
|
||||
}
|
||||
}
|
||||
else if ( pObject->usItem == ACTION_ITEM )
|
||||
{
|
||||
switch( pObject->bActionValue )
|
||||
switch( pObject->ItemData.Trigger.bActionValue )
|
||||
{
|
||||
case ACTION_ITEM_SMALL_PIT:
|
||||
case ACTION_ITEM_LARGE_PIT:
|
||||
@@ -4068,7 +4071,7 @@ void SoldierGiveItemFromAnimation( SOLDIERTYPE *pSoldier )
|
||||
// are we giving money to an NPC, to whom we owe money?
|
||||
if (pTSoldier->ubProfile != NO_PROFILE && gMercProfiles[pTSoldier->ubProfile].iBalance < 0)
|
||||
{
|
||||
gMercProfiles[pTSoldier->ubProfile].iBalance += TempObject.uiMoneyAmount;
|
||||
gMercProfiles[pTSoldier->ubProfile].iBalance += TempObject.ItemData.Money.uiMoneyAmount;
|
||||
if (gMercProfiles[pTSoldier->ubProfile].iBalance >= 0)
|
||||
{
|
||||
// don't let the player accumulate credit (?)
|
||||
@@ -4276,7 +4279,7 @@ void BombMessageBoxCallBack( UINT8 ubExitValue )
|
||||
// HACK IMMINENT!
|
||||
// value of 1 is stored in maps for SIDE of bomb owner... when we want to use IDs!
|
||||
// so we add 2 to all owner IDs passed through here and subtract 2 later
|
||||
gpTempSoldier->inv[HANDPOS].ubBombOwner = gpTempSoldier->ubID + 2;
|
||||
gpTempSoldier->inv[HANDPOS].ItemData.Trigger.ubBombOwner = gpTempSoldier->ubID + 2;
|
||||
AddItemToPool( gsTempGridno, &(gpTempSoldier->inv[HANDPOS]), 1, gpTempSoldier->bLevel, WORLD_ITEM_ARMED_BOMB, 0 );
|
||||
DeleteObj( &(gpTempSoldier->inv[HANDPOS]) );
|
||||
}
|
||||
@@ -4300,17 +4303,17 @@ BOOLEAN HandItemWorks( SOLDIERTYPE *pSoldier, INT8 bSlot )
|
||||
if ( (Item[ pObj->usItem ].damageable ) && (!Item[pObj->usItem].mine ) && (Item[ pObj->usItem ].usItemClass != IC_MEDKIT) && !Item[pObj->usItem].gascan )
|
||||
{
|
||||
// if it's still usable, check whether it breaks
|
||||
if ( pObj->bStatus[0] >= USABLE)
|
||||
if ( pObj->ItemData.Generic.bStatus[0] >= USABLE)
|
||||
{
|
||||
// if a dice roll is greater than the item's status
|
||||
if ( (Random(80) + 20) >= (UINT32) (pObj->bStatus[0] + 50) )
|
||||
if ( (Random(80) + 20) >= (UINT32) (pObj->ItemData.Generic.bStatus[0] + 50) )
|
||||
{
|
||||
fItemJustBroke = TRUE;
|
||||
fItemWorks = FALSE;
|
||||
|
||||
// item breaks, and becomes unusable... so its status is reduced
|
||||
// to somewhere between 1 and the 1 less than USABLE
|
||||
pObj->bStatus[0] = (INT8) ( 1 + Random( USABLE - 1 ) );
|
||||
pObj->ItemData.Generic.bStatus[0] = (INT8) ( 1 + Random( USABLE - 1 ) );
|
||||
}
|
||||
}
|
||||
else // it's already unusable
|
||||
@@ -4333,8 +4336,8 @@ BOOLEAN HandItemWorks( SOLDIERTYPE *pSoldier, INT8 bSlot )
|
||||
{
|
||||
// are we using two guns at once?
|
||||
if ( Item[ pSoldier->inv[SECONDHANDPOS].usItem ].usItemClass == IC_GUN &&
|
||||
pSoldier->inv[SECONDHANDPOS].bGunStatus >= USABLE &&
|
||||
pSoldier->inv[SECONDHANDPOS].ubGunShotsLeft > 0)
|
||||
pSoldier->inv[SECONDHANDPOS].ItemData.Gun.bGunStatus >= USABLE &&
|
||||
pSoldier->inv[SECONDHANDPOS].ItemData.Gun.ubGunShotsLeft > 0)
|
||||
{
|
||||
// check the second gun for breakage, and if IT breaks, return false
|
||||
return( HandItemWorks( pSoldier, SECONDHANDPOS ) );
|
||||
@@ -4508,9 +4511,9 @@ void BoobyTrapMessageBoxCallBack( UINT8 ubExitValue )
|
||||
// NB owner grossness... bombs 'owned' by the enemy are stored with side value 1 in
|
||||
// the map. So if we want to detect a bomb placed by the player, owner is > 1, and
|
||||
// owner - 2 gives the ID of the character who planted it
|
||||
if ( Object.ubBombOwner > 1 && ( (INT32)Object.ubBombOwner - 2 >= gTacticalStatus.Team[ OUR_TEAM ].bFirstID && Object.ubBombOwner - 2 <= gTacticalStatus.Team[ OUR_TEAM ].bLastID ) )
|
||||
if ( Object.ItemData.Trigger.ubBombOwner > 1 && ( (INT32)Object.ItemData.Trigger.ubBombOwner - 2 >= gTacticalStatus.Team[ OUR_TEAM ].bFirstID && Object.ItemData.Trigger.ubBombOwner - 2 <= gTacticalStatus.Team[ OUR_TEAM ].bLastID ) )
|
||||
{
|
||||
if ( Object.ubBombOwner - 2 == gpBoobyTrapSoldier->ubID )
|
||||
if ( Object.ItemData.Trigger.ubBombOwner - 2 == gpBoobyTrapSoldier->ubID )
|
||||
{
|
||||
// my own boobytrap!
|
||||
iCheckResult = SkillCheck( gpBoobyTrapSoldier, DISARM_TRAP_CHECK, 40 );
|
||||
@@ -4529,9 +4532,9 @@ void BoobyTrapMessageBoxCallBack( UINT8 ubExitValue )
|
||||
if (iCheckResult >= 0)
|
||||
{
|
||||
|
||||
if ( Object.ubBombOwner > 1 && ( (INT32)Object.ubBombOwner - 2 >= gTacticalStatus.Team[ OUR_TEAM ].bFirstID && Object.ubBombOwner - 2 <= gTacticalStatus.Team[ OUR_TEAM ].bLastID ) )
|
||||
if ( Object.ItemData.Trigger.ubBombOwner > 1 && ( (INT32)Object.ItemData.Trigger.ubBombOwner - 2 >= gTacticalStatus.Team[ OUR_TEAM ].bFirstID && Object.ItemData.Trigger.ubBombOwner - 2 <= gTacticalStatus.Team[ OUR_TEAM ].bLastID ) )
|
||||
{
|
||||
if ( Object.ubBombOwner - 2 == gpBoobyTrapSoldier->ubID )
|
||||
if ( Object.ItemData.Trigger.ubBombOwner - 2 == gpBoobyTrapSoldier->ubID )
|
||||
{
|
||||
// disarmed my own boobytrap!
|
||||
StatChange( gpBoobyTrapSoldier, EXPLODEAMT, (UINT16) (2 * gbTrapDifficulty), FALSE );
|
||||
@@ -4558,7 +4561,7 @@ void BoobyTrapMessageBoxCallBack( UINT8 ubExitValue )
|
||||
// give the player a remote trigger instead
|
||||
CreateItem( REMOTEBOMBTRIGGER, (INT8) (1 + Random( 9 )), &Object );
|
||||
}
|
||||
else if (Object.usItem == ACTION_ITEM && Object.bActionValue != ACTION_ITEM_BLOW_UP )
|
||||
else if (Object.usItem == ACTION_ITEM && Object.ItemData.Trigger.bActionValue != ACTION_ITEM_BLOW_UP )
|
||||
{
|
||||
// give the player a detonator instead
|
||||
CreateItem( DETONATOR, (INT8) (1 + Random( 9 )), &Object );
|
||||
@@ -4566,7 +4569,7 @@ void BoobyTrapMessageBoxCallBack( UINT8 ubExitValue )
|
||||
else
|
||||
{
|
||||
// switch action item to the real item type
|
||||
CreateItem( Object.usBombItem, Object.bBombStatus, &Object );
|
||||
CreateItem( Object.ItemData.Trigger.usBombItem, Object.ItemData.Trigger.bBombStatus, &Object );
|
||||
}
|
||||
|
||||
// remove any blue flag graphic
|
||||
@@ -4662,7 +4665,7 @@ void BoobyTrapInMapScreenMessageBoxCallBack( UINT8 ubExitValue )
|
||||
// give the player a remote trigger instead
|
||||
CreateItem( REMOTEBOMBTRIGGER, (INT8) (1 + Random( 9 )), &Object );
|
||||
}
|
||||
else if (Object.usItem == ACTION_ITEM && Object.bActionValue != ACTION_ITEM_BLOW_UP )
|
||||
else if (Object.usItem == ACTION_ITEM && Object.ItemData.Trigger.bActionValue != ACTION_ITEM_BLOW_UP )
|
||||
{
|
||||
// give the player a detonator instead
|
||||
CreateItem( DETONATOR, (INT8) (1 + Random( 9 )), &Object );
|
||||
@@ -4670,7 +4673,7 @@ void BoobyTrapInMapScreenMessageBoxCallBack( UINT8 ubExitValue )
|
||||
else
|
||||
{
|
||||
// switch action item to the real item type
|
||||
CreateItem( Object.usBombItem, Object.bBombStatus, &Object );
|
||||
CreateItem( Object.ItemData.Trigger.usBombItem, Object.ItemData.Trigger.bBombStatus, &Object );
|
||||
}
|
||||
}
|
||||
else
|
||||
@@ -4824,7 +4827,7 @@ BOOLEAN NearbyGroundSeemsWrong( SOLDIERTYPE * pSoldier, INT16 sGridNo, BOOLEAN f
|
||||
if (gWorldBombs[uiWorldBombIndex].fExists && gWorldItems[ gWorldBombs[uiWorldBombIndex].iItemIndex ].sGridNo == sNextGridNo)
|
||||
{
|
||||
pObj = &( gWorldItems[ gWorldBombs[uiWorldBombIndex].iItemIndex ].o );
|
||||
if ( pObj->bDetonatorType == BOMB_PRESSURE && !(pObj->fFlags & OBJECT_KNOWN_TO_BE_TRAPPED) && (!(pObj->fFlags & OBJECT_DISABLED_BOMB)) )
|
||||
if ( pObj->ItemData.Trigger.bDetonatorType == BOMB_PRESSURE && !(pObj->fFlags & OBJECT_KNOWN_TO_BE_TRAPPED) && (!(pObj->fFlags & OBJECT_DISABLED_BOMB)) )
|
||||
{
|
||||
if ( fMining && pObj->bTrap <= 10 )
|
||||
{
|
||||
@@ -5047,18 +5050,18 @@ void CheckForPickedOwnership( void )
|
||||
{
|
||||
if ( gWorldItems[ pItemPool->iItemIndex ].o.usItem == OWNERSHIP )
|
||||
{
|
||||
if ( gWorldItems[ pItemPool->iItemIndex ].o.ubOwnerProfile != NO_PROFILE )
|
||||
if ( gWorldItems[ pItemPool->iItemIndex ].o.ItemData.Owner.ubOwnerProfile != NO_PROFILE )
|
||||
{
|
||||
ubProfile = gWorldItems[ pItemPool->iItemIndex ].o.ubOwnerProfile;
|
||||
ubProfile = gWorldItems[ pItemPool->iItemIndex ].o.ItemData.Owner.ubOwnerProfile;
|
||||
pSoldier = FindSoldierByProfileID( ubProfile, FALSE );
|
||||
if ( pSoldier )
|
||||
{
|
||||
TestPotentialOwner( pSoldier );
|
||||
}
|
||||
}
|
||||
if ( gWorldItems[ pItemPool->iItemIndex ].o.ubOwnerCivGroup != NON_CIV_GROUP )
|
||||
if ( gWorldItems[ pItemPool->iItemIndex ].o.ItemData.Owner.ubOwnerCivGroup != NON_CIV_GROUP )
|
||||
{
|
||||
ubCivGroup = gWorldItems[ pItemPool->iItemIndex ].o.ubOwnerCivGroup;
|
||||
ubCivGroup = gWorldItems[ pItemPool->iItemIndex ].o.ItemData.Owner.ubOwnerCivGroup;
|
||||
if ( ubCivGroup == HICKS_CIV_GROUP && CheckFact( FACT_HICKS_MARRIED_PLAYER_MERC, 0 ) )
|
||||
{
|
||||
// skip because hicks appeased
|
||||
|
||||
@@ -2371,7 +2371,7 @@ void HandleNPCDoAction( UINT8 ubTargetNPC, UINT16 usActionCode, UINT8 ubQuoteNum
|
||||
if (pSoldier)
|
||||
{
|
||||
CreateItem( MONEY, 1, &Object );
|
||||
Object.uiMoneyAmount = 10000;
|
||||
Object.ItemData.Money.uiMoneyAmount = 10000;
|
||||
AddItemToPoolAndGetIndex( sGridNo, &Object, -1, pSoldier->bLevel, 0, 0, &iWorldItem );
|
||||
|
||||
// shouldn't have any current action but make sure everything
|
||||
@@ -3110,7 +3110,7 @@ void HandleNPCDoAction( UINT8 ubTargetNPC, UINT16 usActionCode, UINT8 ubQuoteNum
|
||||
if (bMoneySlot != NO_SLOT && bEmptySlot != NO_SLOT)
|
||||
{
|
||||
CreateMoney( gMercProfiles[ ubTargetNPC ].iBalance * 2, &(pSoldier->inv[ bEmptySlot ] ) );
|
||||
pSoldier->inv[ bMoneySlot ].uiMoneyAmount -= gMercProfiles[ ubTargetNPC ].iBalance * 2;
|
||||
pSoldier->inv[ bMoneySlot ].ItemData.Money.uiMoneyAmount -= gMercProfiles[ ubTargetNPC ].iBalance * 2;
|
||||
if (bMoneySlot < bEmptySlot)
|
||||
{
|
||||
// move main stash to later in inventory!
|
||||
|
||||
@@ -610,7 +610,7 @@ void GenerateProsString( STR16 zItemPros, OBJECTTYPE * pObject, UINT32 uiPixLimi
|
||||
ubWeight = Item[ usItem ].ubWeight;
|
||||
if (Item[ usItem ].usItemClass == IC_GUN)
|
||||
{
|
||||
ubWeight += Item[ pObject->usGunAmmoItem ].ubWeight;
|
||||
ubWeight += Item[ pObject->ItemData.Gun.usGunAmmoItem ].ubWeight;
|
||||
}
|
||||
|
||||
if (Weapon[usItem].bAccuracy >= EXCEPTIONAL_ACCURACY )
|
||||
@@ -753,7 +753,7 @@ void GenerateConsString( STR16 zItemCons, OBJECTTYPE * pObject, UINT32 uiPixLimi
|
||||
ubWeight = Item[ usItem ].ubWeight;
|
||||
if (Item[ usItem ].usItemClass == IC_GUN)
|
||||
{
|
||||
ubWeight += Item[ pObject->usGunAmmoItem ].ubWeight;
|
||||
ubWeight += Item[ pObject->ItemData.Gun.usGunAmmoItem ].ubWeight;
|
||||
}
|
||||
|
||||
if (ubWeight >= BAD_WEIGHT)
|
||||
@@ -1079,7 +1079,7 @@ void HandleRenderInvSlots( SOLDIERTYPE *pSoldier, UINT8 fDirtyLevel )
|
||||
if ( fDirtyLevel == DIRTYLEVEL2 )
|
||||
{
|
||||
# if defined( _DEBUG ) /* Sergeant_Kolja, to be removed later again */
|
||||
if( pSoldier->inv[ cnt ].ubGunAmmoType >= MAXITEMS )
|
||||
if( pSoldier->inv[ cnt ].ItemData.Gun.ubGunAmmoType >= MAXITEMS )
|
||||
{
|
||||
DebugMsg(TOPIC_JA2, DBG_LEVEL_1, String("pObject (%s) corrupted! GetHelpTextForItem() can crash.", (pSoldier->inv[ cnt ].usItem<MAXITEMS) ? Item[pSoldier->inv[ cnt ].usItem].szItemName : "???" ));
|
||||
ScreenMsg( MSG_FONT_RED, MSG_DEBUG, L"pObject (%S) corrupted! GetHelpTextForItem() can crash.", (pSoldier->inv[ cnt ].usItem<MAXITEMS) ? Item[pSoldier->inv[ cnt ].usItem].szItemName : "???" );
|
||||
@@ -2082,7 +2082,7 @@ void INVRenderItem( UINT32 uiBuffer, SOLDIERTYPE * pSoldier, OBJECTTYPE *pObjec
|
||||
sNewY = sY + sHeight - 10;
|
||||
sNewX = sX + 1;
|
||||
|
||||
SetFontForeground ( AmmoTypes[pObject->ubGunAmmoType].fontColour );
|
||||
SetFontForeground ( AmmoTypes[pObject->ItemData.Gun.ubGunAmmoType].fontColour );
|
||||
//switch (pObject->ubGunAmmoType)
|
||||
//{
|
||||
// case AMMO_AP:
|
||||
@@ -2108,7 +2108,7 @@ void INVRenderItem( UINT32 uiBuffer, SOLDIERTYPE * pSoldier, OBJECTTYPE *pObjec
|
||||
//}
|
||||
|
||||
|
||||
swprintf( pStr, L"%d", pObject->ubGunShotsLeft );
|
||||
swprintf( pStr, L"%d", pObject->ItemData.Gun.ubGunShotsLeft );
|
||||
if ( uiBuffer == guiSAVEBUFFER )
|
||||
{
|
||||
RestoreExternBackgroundRect( sNewX, sNewY, 20, 15 );
|
||||
@@ -2119,7 +2119,7 @@ void INVRenderItem( UINT32 uiBuffer, SOLDIERTYPE * pSoldier, OBJECTTYPE *pObjec
|
||||
SetFontForeground( FONT_MCOLOR_DKGRAY );
|
||||
|
||||
// Display 'JAMMED' if we are jammed
|
||||
if ( pObject->bGunAmmoStatus < 0 )
|
||||
if ( pObject->ItemData.Gun.bGunAmmoStatus < 0 )
|
||||
{
|
||||
SetFontForeground( FONT_MCOLOR_RED );
|
||||
|
||||
@@ -2436,14 +2436,14 @@ BOOLEAN InternalInitItemDescriptionBox( OBJECTTYPE *pObject, INT16 sX, INT16 sY,
|
||||
// if( guiCurrentScreen != MAP_SCREEN )
|
||||
//if( guiCurrentItemDescriptionScreen != MAP_SCREEN )
|
||||
if ( GetMagSize(gpItemDescObject) <= 99 )
|
||||
swprintf( pStr, L"%d/%d", gpItemDescObject->ubGunShotsLeft, GetMagSize(gpItemDescObject));
|
||||
swprintf( pStr, L"%d/%d", gpItemDescObject->ItemData.Gun.ubGunShotsLeft, GetMagSize(gpItemDescObject));
|
||||
else
|
||||
swprintf( pStr, L"%d", gpItemDescObject->ubGunShotsLeft );
|
||||
swprintf( pStr, L"%d", gpItemDescObject->ItemData.Gun.ubGunShotsLeft );
|
||||
|
||||
FilenameForBPP("INTERFACE\\infobox.sti", ubString);
|
||||
sForeColour = ITEMDESC_AMMO_FORE;
|
||||
|
||||
giItemDescAmmoButtonImages = LoadButtonImage(ubString,AmmoTypes[pObject->ubGunAmmoType].grayed,AmmoTypes[pObject->ubGunAmmoType].offNormal,-1,AmmoTypes[pObject->ubGunAmmoType].onNormal,-1 );
|
||||
giItemDescAmmoButtonImages = LoadButtonImage(ubString,AmmoTypes[pObject->ItemData.Gun.ubGunAmmoType].grayed,AmmoTypes[pObject->ItemData.Gun.ubGunAmmoType].offNormal,-1,AmmoTypes[pObject->ItemData.Gun.ubGunAmmoType].onNormal,-1 );
|
||||
|
||||
//switch( pObject->ubGunAmmoType )
|
||||
//{
|
||||
@@ -2630,8 +2630,8 @@ BOOLEAN InternalInitItemDescriptionBox( OBJECTTYPE *pObject, INT16 sX, INT16 sY,
|
||||
else
|
||||
{
|
||||
memset( &gRemoveMoney, 0, sizeof( REMOVE_MONEY ) );
|
||||
gRemoveMoney.uiTotalAmount = gpItemDescObject->uiMoneyAmount;
|
||||
gRemoveMoney.uiMoneyRemaining = gpItemDescObject->uiMoneyAmount;
|
||||
gRemoveMoney.uiTotalAmount = gpItemDescObject->ItemData.Money.uiMoneyAmount;
|
||||
gRemoveMoney.uiMoneyRemaining = gpItemDescObject->ItemData.Money.uiMoneyAmount;
|
||||
gRemoveMoney.uiMoneyRemoving = 0;
|
||||
|
||||
// Load graphic
|
||||
@@ -3281,12 +3281,12 @@ void RenderItemDescriptionBox( )
|
||||
if( Item[gpItemDescObject->usItem].usItemClass == IC_AMMO && gpItemDescObject->ubNumberOfObjects > 1 && gubItemDescStatusIndex < gpItemDescObject->ubNumberOfObjects)
|
||||
{
|
||||
//Get weight of one item in stack.
|
||||
UINT8 ubShotsLeftFirst = gpItemDescObject->ubShotsLeft[0];
|
||||
UINT8 ubShotsLeftFirst = gpItemDescObject->ItemData.Ammo.ubShotsLeft[0];
|
||||
UINT8 ubNumberOfObjects = gpItemDescObject->ubNumberOfObjects;
|
||||
gpItemDescObject->ubNumberOfObjects = 1;
|
||||
gpItemDescObject->ubShotsLeft[0] = gpItemDescObject->ubShotsLeft[gubItemDescStatusIndex];
|
||||
gpItemDescObject->ItemData.Ammo.ubShotsLeft[0] = gpItemDescObject->ItemData.Ammo.ubShotsLeft[gubItemDescStatusIndex];
|
||||
fWeight = (float)(CalculateObjectWeight( gpItemDescObject )) / 10;
|
||||
gpItemDescObject->ubShotsLeft[0] = ubShotsLeftFirst;
|
||||
gpItemDescObject->ItemData.Ammo.ubShotsLeft[0] = ubShotsLeftFirst;
|
||||
gpItemDescObject->ubNumberOfObjects = ubNumberOfObjects;
|
||||
}
|
||||
//Item does not exist
|
||||
@@ -3349,7 +3349,7 @@ void RenderItemDescriptionBox( )
|
||||
SetFontForeground( 5 );
|
||||
//Status
|
||||
// This is gross, but to get the % to work out right...
|
||||
swprintf( pStr, L"%2d%%", gpItemDescObject->bStatus[ gubItemDescStatusIndex ] );
|
||||
swprintf( pStr, L"%2d%%", gpItemDescObject->ItemData.Generic.bStatus[ gubItemDescStatusIndex ] );
|
||||
FindFontRightCoordinates( (INT16)(gMapWeaponStats[ 1 ].sX + gsInvDescX + gMapWeaponStats[ 1 ].sValDx + 6), (INT16)(gMapWeaponStats[ 1 ].sY + gsInvDescY ), ITEM_STATS_WIDTH ,ITEM_STATS_HEIGHT ,pStr, BLOCKFONT2, &usX, &usY);
|
||||
wcscat( pStr, L"%%" );
|
||||
mprintf( usX, usY, pStr );
|
||||
@@ -3521,7 +3521,7 @@ void RenderItemDescriptionBox( )
|
||||
{
|
||||
SetFontForeground( FONT_FCOLOR_WHITE );
|
||||
SetFontShadow( DEFAULT_SHADOW );
|
||||
swprintf( pStr, L"%ld", gpItemDescObject->uiMoneyAmount );
|
||||
swprintf( pStr, L"%ld", gpItemDescObject->ItemData.Money.uiMoneyAmount );
|
||||
InsertCommasForDollarFigure( pStr );
|
||||
InsertDollarSignInToString( pStr );
|
||||
uiStringLength=StringPixLength(pStr, ITEMDESC_FONT );
|
||||
@@ -3554,7 +3554,7 @@ void RenderItemDescriptionBox( )
|
||||
if ( Item[ gpItemDescObject->usItem ].usItemClass & IC_AMMO )
|
||||
{
|
||||
// Ammo
|
||||
swprintf( pStr, L"%d/%d", gpItemDescObject->ubShotsLeft[gubItemDescStatusIndex], Magazine[ Item[ gpItemDescObject->usItem ].ubClassIndex ].ubMagSize ); //Pulmu: Correct # of rounds for stacked ammo.
|
||||
swprintf( pStr, L"%d/%d", gpItemDescObject->ItemData.Ammo.ubShotsLeft[gubItemDescStatusIndex], Magazine[ Item[ gpItemDescObject->usItem ].ubClassIndex ].ubMagSize ); //Pulmu: Correct # of rounds for stacked ammo.
|
||||
uiStringLength=StringPixLength(pStr, ITEMDESC_FONT );
|
||||
// sStrX = gMapWeaponStats[ 0 ].sX + gsInvDescX + gMapWeaponStats[ 0 ].sValDx + ( uiRightLength - uiStringLength );
|
||||
FindFontRightCoordinates( (INT16)(gMapWeaponStats[ 2 ].sX + gsInvDescX + gMapWeaponStats[ 2 ].sValDx+6), (INT16)(gMapWeaponStats[ 2 ].sY + gsInvDescY ), ITEM_STATS_WIDTH ,ITEM_STATS_HEIGHT ,pStr, BLOCKFONT2, &sStrX, &usY);
|
||||
@@ -3563,7 +3563,7 @@ void RenderItemDescriptionBox( )
|
||||
else
|
||||
{
|
||||
//Status
|
||||
swprintf( pStr, L"%2d%%", gpItemDescObject->bStatus[ gubItemDescStatusIndex ] );
|
||||
swprintf( pStr, L"%2d%%", gpItemDescObject->ItemData.Generic.bStatus[ gubItemDescStatusIndex ] );
|
||||
uiStringLength=StringPixLength(pStr, ITEMDESC_FONT );
|
||||
// sStrX = gMapWeaponStats[ 1 ].sX + gsInvDescX + gMapWeaponStats[ 1 ].sValDx + ( uiRightLength - uiStringLength );
|
||||
FindFontRightCoordinates( (INT16)(gMapWeaponStats[ 1 ].sX + gsInvDescX + gMapWeaponStats[ 1 ].sValDx + 6), (INT16)(gMapWeaponStats[ 1 ].sY + gsInvDescY ), ITEM_STATS_WIDTH ,ITEM_STATS_HEIGHT ,pStr, BLOCKFONT2, &sStrX, &usY);
|
||||
@@ -3590,12 +3590,12 @@ void RenderItemDescriptionBox( )
|
||||
|
||||
|
||||
SetFontForeground( 5 );
|
||||
GetShortSectorString( ( INT16 ) SECTORX( KeyTable[ gpItemDescObject->ubKeyID ].usSectorFound ), ( INT16 ) SECTORY( KeyTable[ gpItemDescObject->ubKeyID ].usSectorFound ), sTempString );
|
||||
GetShortSectorString( ( INT16 ) SECTORX( KeyTable[ gpItemDescObject->ItemData.Key.ubKeyID ].usSectorFound ), ( INT16 ) SECTORY( KeyTable[ gpItemDescObject->ItemData.Key.ubKeyID ].usSectorFound ), sTempString );
|
||||
swprintf( pStr, L"%s", sTempString );
|
||||
FindFontRightCoordinates( (INT16)(gMapWeaponStats[ 4 ].sX + gsInvDescX ), (INT16)(gMapWeaponStats[ 4 ].sY + gsInvDescY ), 110 ,ITEM_STATS_HEIGHT ,pStr, BLOCKFONT2, &usX, &usY);
|
||||
mprintf( usX, usY, pStr );
|
||||
|
||||
swprintf( pStr, L"%d", KeyTable[ gpItemDescObject->ubKeyID ].usDateFound );
|
||||
swprintf( pStr, L"%d", KeyTable[ gpItemDescObject->ItemData.Key.ubKeyID ].usDateFound );
|
||||
FindFontRightCoordinates( (INT16)(gMapWeaponStats[ 4 ].sX + gsInvDescX ), (INT16)(gMapWeaponStats[ 4 ].sY + gsInvDescY + GetFontHeight( BLOCKFONT ) + 2 ), 110 ,ITEM_STATS_HEIGHT ,pStr, BLOCKFONT2, &usX, &usY);
|
||||
mprintf( usX, usY, pStr );
|
||||
}
|
||||
@@ -3775,12 +3775,12 @@ void RenderItemDescriptionBox( )
|
||||
if( Item[gpItemDescObject->usItem].usItemClass == IC_AMMO && gpItemDescObject->ubNumberOfObjects > 1 && gubItemDescStatusIndex < gpItemDescObject->ubNumberOfObjects)
|
||||
{
|
||||
//Get weight of one ammo clip in stack.
|
||||
UINT8 ubShotsLeftFirst = gpItemDescObject->ubShotsLeft[0];
|
||||
UINT8 ubShotsLeftFirst = gpItemDescObject->ItemData.Ammo.ubShotsLeft[0];
|
||||
UINT8 ubNumberOfObjects = gpItemDescObject->ubNumberOfObjects;
|
||||
gpItemDescObject->ubNumberOfObjects = 1;
|
||||
gpItemDescObject->ubShotsLeft[0] = gpItemDescObject->ubShotsLeft[gubItemDescStatusIndex];
|
||||
gpItemDescObject->ItemData.Ammo.ubShotsLeft[0] = gpItemDescObject->ItemData.Ammo.ubShotsLeft[gubItemDescStatusIndex];
|
||||
fWeight = (float)(CalculateObjectWeight( gpItemDescObject )) / 10;
|
||||
gpItemDescObject->ubShotsLeft[0] = ubShotsLeftFirst;
|
||||
gpItemDescObject->ItemData.Ammo.ubShotsLeft[0] = ubShotsLeftFirst;
|
||||
gpItemDescObject->ubNumberOfObjects = ubNumberOfObjects;
|
||||
}
|
||||
//Item does not exist
|
||||
@@ -3850,7 +3850,7 @@ void RenderItemDescriptionBox( )
|
||||
}
|
||||
|
||||
//Status
|
||||
swprintf( pStr, L"%2d%%", gpItemDescObject->bGunStatus );
|
||||
swprintf( pStr, L"%2d%%", gpItemDescObject->ItemData.Gun.bGunStatus );
|
||||
FindFontRightCoordinates( (INT16)(gWeaponStats[ 1 ].sX + gsInvDescX + gWeaponStats[ 1 ].sValDx), (INT16)(gWeaponStats[ 1 ].sY + gsInvDescY ), ITEM_STATS_WIDTH ,ITEM_STATS_HEIGHT ,pStr, BLOCKFONT2, &usX, &usY);
|
||||
wcscat( pStr, L"%%" );
|
||||
mprintf( usX, usY, pStr );
|
||||
@@ -4018,7 +4018,7 @@ void RenderItemDescriptionBox( )
|
||||
{
|
||||
SetFontForeground( FONT_FCOLOR_WHITE );
|
||||
SetFontShadow( DEFAULT_SHADOW );
|
||||
swprintf( pStr, L"%ld", gpItemDescObject->uiMoneyAmount );
|
||||
swprintf( pStr, L"%ld", gpItemDescObject->ItemData.Money.uiMoneyAmount );
|
||||
InsertCommasForDollarFigure( pStr );
|
||||
InsertDollarSignInToString( pStr );
|
||||
|
||||
@@ -4054,14 +4054,14 @@ void RenderItemDescriptionBox( )
|
||||
{
|
||||
// Ammo - print amount
|
||||
//Status
|
||||
swprintf( pStr, L"%d/%d", gpItemDescObject->ubShotsLeft[gubItemDescStatusIndex], Magazine[ Item[ gpItemDescObject->usItem ].ubClassIndex ].ubMagSize ); //Pulmu: Correct # of rounds for stacked ammo
|
||||
swprintf( pStr, L"%d/%d", gpItemDescObject->ItemData.Ammo.ubShotsLeft[gubItemDescStatusIndex], Magazine[ Item[ gpItemDescObject->usItem ].ubClassIndex ].ubMagSize ); //Pulmu: Correct # of rounds for stacked ammo
|
||||
FindFontRightCoordinates( (INT16)(gWeaponStats[ 2 ].sX + gsInvDescX + gWeaponStats[ 2 ].sValDx), (INT16)(gWeaponStats[ 2 ].sY + gsInvDescY ), ITEM_STATS_WIDTH ,ITEM_STATS_HEIGHT ,pStr, BLOCKFONT2, &usX, &usY);
|
||||
mprintf( usX, usY, pStr );
|
||||
}
|
||||
else
|
||||
{
|
||||
//Status
|
||||
swprintf( pStr, L"%2d%%", gpItemDescObject->bStatus[ gubItemDescStatusIndex ] );
|
||||
swprintf( pStr, L"%2d%%", gpItemDescObject->ItemData.Generic.bStatus[ gubItemDescStatusIndex ] );
|
||||
FindFontRightCoordinates( (INT16)(gWeaponStats[ 1 ].sX + gsInvDescX + gWeaponStats[ 1 ].sValDx), (INT16)(gWeaponStats[ 1 ].sY + gsInvDescY ), ITEM_STATS_WIDTH ,ITEM_STATS_HEIGHT ,pStr, BLOCKFONT2, &usX, &usY);
|
||||
wcscat( pStr, L"%%" );
|
||||
mprintf( usX, usY, pStr );
|
||||
@@ -4079,12 +4079,12 @@ void RenderItemDescriptionBox( )
|
||||
|
||||
|
||||
SetFontForeground( 5 );
|
||||
GetShortSectorString( ( INT16 ) SECTORX( KeyTable[ gpItemDescObject->ubKeyID ].usSectorFound ), ( INT16 ) SECTORY( KeyTable[ gpItemDescObject->ubKeyID ].usSectorFound ), sTempString );
|
||||
GetShortSectorString( ( INT16 ) SECTORX( KeyTable[ gpItemDescObject->ItemData.Key.ubKeyID ].usSectorFound ), ( INT16 ) SECTORY( KeyTable[ gpItemDescObject->ItemData.Key.ubKeyID ].usSectorFound ), sTempString );
|
||||
swprintf( pStr, L"%s", sTempString );
|
||||
FindFontRightCoordinates( (INT16)(gWeaponStats[ 4 ].sX + gsInvDescX ), (INT16)(gWeaponStats[ 4 ].sY + gsInvDescY ), 110 ,ITEM_STATS_HEIGHT ,pStr, BLOCKFONT2, &usX, &usY);
|
||||
mprintf( usX, usY, pStr );
|
||||
|
||||
swprintf( pStr, L"%d", KeyTable[ gpItemDescObject->ubKeyID ].usDateFound );
|
||||
swprintf( pStr, L"%d", KeyTable[ gpItemDescObject->ItemData.Key.ubKeyID ].usDateFound );
|
||||
FindFontRightCoordinates( (INT16)(gWeaponStats[ 4 ].sX + gsInvDescX ), (INT16)(gWeaponStats[ 4 ].sY + gsInvDescY + GetFontHeight( BLOCKFONT ) + 2 ), 110 ,ITEM_STATS_HEIGHT ,pStr, BLOCKFONT2, &usX, &usY);
|
||||
mprintf( usX, usY, pStr );
|
||||
}
|
||||
@@ -5673,7 +5673,7 @@ void RenderKeyRingPopup( BOOLEAN fFullRender )
|
||||
memset( &pObject, 0, sizeof( OBJECTTYPE ) );
|
||||
|
||||
pObject.usItem = KEY_1;
|
||||
pObject.bStatus[ 0 ] = 100;
|
||||
pObject.ItemData.Generic.bStatus[ 0 ] = 100;
|
||||
|
||||
// TAKE A LOOK AT THE VIDEO OBJECT SIZE ( ONE OF TWO SIZES ) AND CENTER!
|
||||
GetVideoObject( &hVObject, guiItemPopupBoxes );
|
||||
@@ -6517,7 +6517,7 @@ void SetupPickupPage( INT8 bPage )
|
||||
pObject = (gfStealing)? &gpOpponent->inv[pTempItemPool->iItemIndex]
|
||||
:&(gWorldItems[ pTempItemPool->iItemIndex ].o );
|
||||
|
||||
sValue = pObject->bStatus[ 0 ];
|
||||
sValue = pObject->ItemData.Generic.bStatus[ 0 ];
|
||||
|
||||
// Adjust for ammo, other thingys..
|
||||
if( Item[ pObject->usItem ].usItemClass & IC_AMMO || Item[ pObject->usItem ].usItemClass & IC_KEY )
|
||||
@@ -6789,7 +6789,7 @@ void RenderItemPickupMenu( )
|
||||
if ( Item[ pObject->usItem ].usItemClass == IC_MONEY )
|
||||
{
|
||||
CHAR16 pStr2[20];
|
||||
swprintf( pStr2, L"%ld", pObject->uiMoneyAmount );
|
||||
swprintf( pStr2, L"%ld", pObject->ItemData.Money.uiMoneyAmount );
|
||||
InsertCommasForDollarFigure( pStr2 );
|
||||
InsertDollarSignInToString( pStr2 );
|
||||
|
||||
@@ -7337,22 +7337,22 @@ void RemoveMoney()
|
||||
InvSlot.bSlotIdInOtherLocation = -1;
|
||||
|
||||
//Remove the money from the money in the pocket
|
||||
gpItemDescObject->uiMoneyAmount = gRemoveMoney.uiMoneyRemaining;
|
||||
gpItemDescObject->ItemData.Money.uiMoneyAmount = gRemoveMoney.uiMoneyRemaining;
|
||||
|
||||
//Create an item to get the money that is being removed
|
||||
CreateItem( MONEY, 0, &InvSlot.ItemObject );
|
||||
|
||||
//Set the amount thast is being removed
|
||||
InvSlot.ItemObject.uiMoneyAmount = gRemoveMoney.uiMoneyRemoving;
|
||||
InvSlot.ItemObject.ItemData.Money.uiMoneyAmount = gRemoveMoney.uiMoneyRemoving;
|
||||
InvSlot.ubIdOfMercWhoOwnsTheItem = gpItemDescSoldier->ubProfile;
|
||||
|
||||
//if we are removing money from the players account
|
||||
if( gfAddingMoneyToMercFromPlayersAccount )
|
||||
{
|
||||
gpItemDescObject->uiMoneyAmount = gRemoveMoney.uiMoneyRemoving;
|
||||
gpItemDescObject->ItemData.Money.uiMoneyAmount = gRemoveMoney.uiMoneyRemoving;
|
||||
|
||||
//take the money from the player
|
||||
AddTransactionToPlayersBook ( TRANSFER_FUNDS_TO_MERC, gpSMCurrentMerc->ubProfile, GetWorldTotalMin() , -(INT32)( gpItemDescObject->uiMoneyAmount ) );
|
||||
AddTransactionToPlayersBook ( TRANSFER_FUNDS_TO_MERC, gpSMCurrentMerc->ubProfile, GetWorldTotalMin() , -(INT32)( gpItemDescObject->ItemData.Money.uiMoneyAmount ) );
|
||||
}
|
||||
|
||||
memcpy( &gMoveingItem, &InvSlot, sizeof( INVENTORY_IN_SLOT ) );
|
||||
@@ -7378,13 +7378,13 @@ void RemoveMoney()
|
||||
//if we are removing money from the players account
|
||||
if( gfAddingMoneyToMercFromPlayersAccount )
|
||||
{
|
||||
gpItemDescObject->uiMoneyAmount = gRemoveMoney.uiMoneyRemoving;
|
||||
gpItemDescObject->ItemData.Money.uiMoneyAmount = gRemoveMoney.uiMoneyRemoving;
|
||||
|
||||
//take the money from the player
|
||||
AddTransactionToPlayersBook ( TRANSFER_FUNDS_TO_MERC, gpSMCurrentMerc->ubProfile, GetWorldTotalMin() , -(INT32)( gpItemDescObject->uiMoneyAmount ) );
|
||||
AddTransactionToPlayersBook ( TRANSFER_FUNDS_TO_MERC, gpSMCurrentMerc->ubProfile, GetWorldTotalMin() , -(INT32)( gpItemDescObject->ItemData.Money.uiMoneyAmount ) );
|
||||
}
|
||||
else
|
||||
gpItemDescObject->uiMoneyAmount = gRemoveMoney.uiMoneyRemaining;
|
||||
gpItemDescObject->ItemData.Money.uiMoneyAmount = gRemoveMoney.uiMoneyRemaining;
|
||||
|
||||
|
||||
|
||||
@@ -7438,7 +7438,7 @@ void GetHelpTextForItem( STR16 pzStr, OBJECTTYPE *pObject, SOLDIERTYPE *pSoldier
|
||||
Remove when fixed!
|
||||
*/
|
||||
# if defined( _DEBUG )
|
||||
if ( (pObject->ubGunAmmoType >= MAXITEMS)
|
||||
if ( (pObject->ItemData.Gun.ubGunAmmoType >= MAXITEMS)
|
||||
)
|
||||
{
|
||||
DebugMsg(TOPIC_JA2, DBG_LEVEL_1, String( "corrupted pObject (%s) found in GetHelpTextForItem()", (usItem<MAXITEMS) ? Item[usItem].szItemName : "???" ));
|
||||
@@ -7453,13 +7453,13 @@ void GetHelpTextForItem( STR16 pzStr, OBJECTTYPE *pObject, SOLDIERTYPE *pSoldier
|
||||
{
|
||||
// Retrieve the status of the items
|
||||
// Find the minimum status value - not just the first one
|
||||
INT16 sValue = pObject->bStatus[ 0 ];
|
||||
INT16 sValue = pObject->ItemData.Generic.bStatus[ 0 ];
|
||||
|
||||
for(INT16 i = 1; i < pObject->ubNumberOfObjects; i++)
|
||||
{
|
||||
if(pObject->bStatus[ i ] < sValue)
|
||||
if(pObject->ItemData.Generic.bStatus[ i ] < sValue)
|
||||
{
|
||||
sValue = pObject->bStatus[ i ];
|
||||
sValue = pObject->ItemData.Generic.bStatus[ i ];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7485,7 +7485,7 @@ void GetHelpTextForItem( STR16 pzStr, OBJECTTYPE *pObject, SOLDIERTYPE *pSoldier
|
||||
case MONEY:
|
||||
//Money
|
||||
{
|
||||
swprintf( pStr, L"%ld", pObject->uiMoneyAmount );
|
||||
swprintf( pStr, L"%ld", pObject->ItemData.Money.uiMoneyAmount );
|
||||
InsertCommasForDollarFigure( pStr );
|
||||
InsertDollarSignInToString( pStr );
|
||||
}
|
||||
@@ -7496,7 +7496,7 @@ void GetHelpTextForItem( STR16 pzStr, OBJECTTYPE *pObject, SOLDIERTYPE *pSoldier
|
||||
//if ( Item[ usItem ].usItemClass == IC_MONEY )
|
||||
{
|
||||
CHAR16 pStr2[20];
|
||||
swprintf( pStr2, L"%ld", pObject->uiMoneyAmount );
|
||||
swprintf( pStr2, L"%ld", pObject->ItemData.Money.uiMoneyAmount );
|
||||
InsertCommasForDollarFigure( pStr2 );
|
||||
InsertDollarSignInToString( pStr2 );
|
||||
|
||||
@@ -7633,7 +7633,7 @@ void GetHelpTextForItem( STR16 pzStr, OBJECTTYPE *pObject, SOLDIERTYPE *pSoldier
|
||||
// The next is for ammunition which gets the measurement 'rnds'
|
||||
swprintf( pStr, L"%s [%d rnds]\n%s %1.1f %s",
|
||||
ItemNames[ usItem ], //Item long name
|
||||
pObject->ubShotsLeft[0], //Shots left
|
||||
pObject->ItemData.Ammo.ubShotsLeft[0], //Shots left
|
||||
gWeaponStatsDesc[ 12 ], //Weight String
|
||||
fWeight, //Weight
|
||||
GetWeightUnitString() //Weight units
|
||||
|
||||
@@ -5661,7 +5661,7 @@ void KeyRingSlotInvClickCallback( MOUSE_REGION * pRegion, INT32 iReason )
|
||||
//usOldItemIndex = gpSMCurrentMerc->inv[ uiHandPos ].usItem;
|
||||
//usNewItemIndex = gpItemPointer->usItem;
|
||||
|
||||
if ( gpItemPopupSoldier->pKeyRing[ uiKeyRing ].ubKeyID == INVALID_KEY_NUMBER || gpItemPopupSoldier->pKeyRing[ uiKeyRing ].ubKeyID == gpItemPointer->ubKeyID)
|
||||
if ( gpItemPopupSoldier->pKeyRing[ uiKeyRing ].ubKeyID == INVALID_KEY_NUMBER || gpItemPopupSoldier->pKeyRing[ uiKeyRing ].ubKeyID == gpItemPointer->ItemData.Key.ubKeyID)
|
||||
{
|
||||
// Try to place here
|
||||
if ( ( iNumberOfKeysTaken = AddKeysToSlot( gpItemPopupSoldier, ( INT8 )uiKeyRing, gpItemPointer ) ) )
|
||||
@@ -5904,7 +5904,7 @@ void SMInvMoneyButtonCallback( MOUSE_REGION * pRegion, INT32 iReason )
|
||||
guiPendingOverrideEvent = A_CHANGE_TO_MOVE;
|
||||
HandleTacticalUI( );
|
||||
|
||||
swprintf( zMoney, L"%d", gpItemPointer->uiMoneyAmount );
|
||||
swprintf( zMoney, L"%d", gpItemPointer->ItemData.Money.uiMoneyAmount );
|
||||
|
||||
InsertCommasForDollarFigure( zMoney );
|
||||
InsertDollarSignInToString( zMoney );
|
||||
@@ -5949,7 +5949,7 @@ void ConfirmationToDepositMoneyToPlayersAccount( UINT8 ubExitValue )
|
||||
if ( ubExitValue == MSG_BOX_RETURN_YES )
|
||||
{
|
||||
//add the money to the players account
|
||||
AddTransactionToPlayersBook( MERC_DEPOSITED_MONEY_TO_PLAYER_ACCOUNT, gpSMCurrentMerc->ubProfile, GetWorldTotalMin(), gpItemPointer->uiMoneyAmount );
|
||||
AddTransactionToPlayersBook( MERC_DEPOSITED_MONEY_TO_PLAYER_ACCOUNT, gpSMCurrentMerc->ubProfile, GetWorldTotalMin(), gpItemPointer->ItemData.Money.uiMoneyAmount );
|
||||
|
||||
// dirty shopkeeper
|
||||
gubSkiDirtyLevel = SKI_DIRTY_LEVEL2;
|
||||
|
||||
@@ -364,7 +364,7 @@ void DrawItemUIBarEx( OBJECTTYPE *pObject, UINT8 ubStatus, INT16 sXPos, INT16 sY
|
||||
}
|
||||
else
|
||||
{
|
||||
sValue = pObject->bStatus[ ubStatus ];
|
||||
sValue = pObject->ItemData.Generic.bStatus[ ubStatus ];
|
||||
}
|
||||
|
||||
// Adjust for ammo, other thingys..
|
||||
@@ -375,7 +375,7 @@ void DrawItemUIBarEx( OBJECTTYPE *pObject, UINT8 ubStatus, INT16 sXPos, INT16 sY
|
||||
|
||||
if ( sValue < 0 )
|
||||
{
|
||||
sValue = pObject->ubShotsLeft[0] * 100 / Magazine[ Item[ pObject->usItem ].ubClassIndex ].ubMagSize;
|
||||
sValue = pObject->ItemData.Ammo.ubShotsLeft[0] * 100 / Magazine[ Item[ pObject->usItem ].ubClassIndex ].ubMagSize;
|
||||
DebugMsg ( TOPIC_JA2, DBG_LEVEL_3, String("Ammo status: shots left %d * 100 / Mag Size %d = value %d",pObject->ubShotsLeft[0],Magazine[ Item[ pObject->usItem ].ubClassIndex ].ubMagSize,sValue ));
|
||||
}
|
||||
if ( sValue > 100 )
|
||||
|
||||
@@ -553,7 +553,7 @@ void GenerateRandomEquipment( SOLDIERCREATE_STRUCT *pp, INT8 bSoldierClass, INT8
|
||||
{
|
||||
fLAW = FALSE;
|
||||
}
|
||||
pItem->ubGunState |= GS_CARTRIDGE_IN_CHAMBER;
|
||||
pItem->ItemData.Gun.ubGunState |= GS_CARTRIDGE_IN_CHAMBER;
|
||||
break;
|
||||
case IC_AMMO:
|
||||
bAmmoClips = 0;
|
||||
@@ -563,7 +563,7 @@ void GenerateRandomEquipment( SOLDIERCREATE_STRUCT *pp, INT8 bSoldierClass, INT8
|
||||
bKnifeClass = 0;
|
||||
break;
|
||||
case IC_LAUNCHER:
|
||||
pItem->ubGunState |= GS_CARTRIDGE_IN_CHAMBER;
|
||||
pItem->ItemData.Gun.ubGunState |= GS_CARTRIDGE_IN_CHAMBER;
|
||||
fGrenadeLauncher = FALSE;
|
||||
if (fMortar || fRPG)
|
||||
{
|
||||
@@ -660,8 +660,8 @@ void ChooseWeaponForSoldierCreateStruct( SOLDIERCREATE_STRUCT *pp, INT8 bWeaponC
|
||||
usGunIndex = pp->Inv[ i ].usItem;
|
||||
ubChanceStandardAmmo = 100 - (bWeaponClass * -9); // weapon class is negative!
|
||||
usAmmoIndex = RandomMagazine( usGunIndex, ubChanceStandardAmmo );
|
||||
pp->Inv[ i ].ubGunAmmoType = Magazine[Item[usAmmoIndex].ubClassIndex].ubAmmoType;
|
||||
pp->Inv[ i ].usGunAmmoItem = usAmmoIndex;
|
||||
pp->Inv[ i ].ItemData.Gun.ubGunAmmoType = Magazine[Item[usAmmoIndex].ubClassIndex].ubAmmoType;
|
||||
pp->Inv[ i ].ItemData.Gun.usGunAmmoItem = usAmmoIndex;
|
||||
|
||||
if ( Item[usGunIndex].fingerprintid )
|
||||
{
|
||||
@@ -903,7 +903,7 @@ void ChooseWeaponForSoldierCreateStruct( SOLDIERCREATE_STRUCT *pp, INT8 bWeaponC
|
||||
|
||||
DebugMsg (TOPIC_JA2,DBG_LEVEL_3,String("ChooseWeaponForSoldierCreateStruct: Set bullets"));
|
||||
//set bullets = to magsize including any attachments (c-mag adapters, etc)
|
||||
pp->Inv[ HANDPOS ].ubGunShotsLeft = GetMagSize(&pp->Inv[ HANDPOS ]);
|
||||
pp->Inv[ HANDPOS ].ItemData.Gun.ubGunShotsLeft = GetMagSize(&pp->Inv[ HANDPOS ]);
|
||||
|
||||
DebugMsg (TOPIC_JA2,DBG_LEVEL_3,String("ChooseWeaponForSoldierCreateStruct: choose ammo"));
|
||||
if( bAmmoClips )
|
||||
@@ -929,8 +929,8 @@ void ChooseWeaponForSoldierCreateStruct( SOLDIERCREATE_STRUCT *pp, INT8 bWeaponC
|
||||
//}
|
||||
|
||||
usAmmoIndex = RandomMagazine( &pp->Inv[HANDPOS], ubChanceStandardAmmo );
|
||||
pp->Inv[ HANDPOS ].ubGunAmmoType = Magazine[Item[usAmmoIndex].ubClassIndex].ubAmmoType;
|
||||
pp->Inv[ HANDPOS ].usGunAmmoItem = usAmmoIndex;
|
||||
pp->Inv[ HANDPOS ].ItemData.Gun.ubGunAmmoType = Magazine[Item[usAmmoIndex].ubClassIndex].ubAmmoType;
|
||||
pp->Inv[ HANDPOS ].ItemData.Gun.usGunAmmoItem = usAmmoIndex;
|
||||
}
|
||||
|
||||
//Ammo
|
||||
@@ -2845,7 +2845,7 @@ void ReplaceExtendedGuns( SOLDIERCREATE_STRUCT *pp, INT8 bSoldierClass )
|
||||
{
|
||||
// have to replace! but first (ugh) must store backup (b/c of attachments)
|
||||
CopyObj( &(pp->Inv[ uiLoop ]), &OldObj );
|
||||
CreateItem( usNewGun, OldObj.bGunStatus, &(pp->Inv[ uiLoop ]) );
|
||||
CreateItem( usNewGun, OldObj.ItemData.Gun.bGunStatus, &(pp->Inv[ uiLoop ]) );
|
||||
pp->Inv[ uiLoop ].fFlags = OldObj.fFlags;
|
||||
|
||||
// copy any valid attachments; for others, just drop them...
|
||||
|
||||
+22
-22
@@ -84,21 +84,21 @@ typedef struct
|
||||
INT8 bGunAmmoStatus; // only for "attached ammo" - grenades, mortar shells
|
||||
UINT8 ubGunState; // SB manual recharge
|
||||
UINT8 ubGunUnused[MAX_OBJECTS_PER_SLOT - 6];
|
||||
};
|
||||
} Gun;
|
||||
struct
|
||||
{
|
||||
UINT8 ubShotsLeft[MAX_OBJECTS_PER_SLOT];
|
||||
};
|
||||
} Ammo;
|
||||
struct
|
||||
{
|
||||
INT8 bStatus[MAX_OBJECTS_PER_SLOT];
|
||||
};
|
||||
} Generic;
|
||||
struct
|
||||
{
|
||||
INT8 bMoneyStatus;
|
||||
UINT32 uiMoneyAmount;
|
||||
UINT8 ubMoneyUnused[MAX_OBJECTS_PER_SLOT - 5];
|
||||
};
|
||||
} Money;
|
||||
struct
|
||||
{ // this is used by placed bombs, switches, and the action item
|
||||
INT8 bBombStatus; // % status
|
||||
@@ -106,42 +106,42 @@ typedef struct
|
||||
UINT16 usBombItem; // the usItem of the bomb.
|
||||
union
|
||||
{
|
||||
struct
|
||||
{
|
||||
//struct
|
||||
//{
|
||||
INT8 bDelay; // >=0 values used only
|
||||
};
|
||||
struct
|
||||
{
|
||||
//};
|
||||
//struct
|
||||
//{
|
||||
INT8 bFrequency; // >=0 values used only
|
||||
};
|
||||
};
|
||||
//};
|
||||
} BombTrigger;
|
||||
UINT8 ubBombOwner; // side which placed the bomb
|
||||
UINT8 bActionValue;// this is used by the ACTION_ITEM fake item
|
||||
union
|
||||
{
|
||||
struct
|
||||
{
|
||||
//struct
|
||||
//{
|
||||
UINT8 ubTolerance; // tolerance value for panic triggers
|
||||
};
|
||||
struct
|
||||
{
|
||||
//};
|
||||
//struct
|
||||
//{
|
||||
UINT8 ubLocationID; // location value for remote non-bomb (special!) triggers
|
||||
};
|
||||
};
|
||||
};
|
||||
//};
|
||||
} Area;
|
||||
} Trigger;
|
||||
struct
|
||||
{
|
||||
INT8 bKeyStatus[ 6 ];
|
||||
UINT8 ubKeyID;
|
||||
UINT8 ubKeyUnused[1];
|
||||
};
|
||||
} Key;
|
||||
struct
|
||||
{
|
||||
UINT8 ubOwnerProfile;
|
||||
UINT8 ubOwnerCivGroup;
|
||||
UINT8 ubOwnershipUnused[6];
|
||||
};
|
||||
};
|
||||
} Owner;
|
||||
} ItemData;
|
||||
// attached objects
|
||||
UINT16 usAttachItem[MAX_ATTACHMENTS];
|
||||
INT8 bAttachStatus[MAX_ATTACHMENTS];
|
||||
|
||||
+252
-260
File diff suppressed because it is too large
Load Diff
@@ -60,6 +60,7 @@ extern UINT16 DefaultMagazine( UINT16 usItem );
|
||||
UINT16 RandomMagazine( UINT16 usItem, UINT8 ubPercentStandard );
|
||||
UINT16 RandomMagazine( OBJECTTYPE * pGun, UINT8 ubPercentStandard );
|
||||
extern BOOLEAN ReloadGun( SOLDIERTYPE * pSoldier, OBJECTTYPE * pGun, OBJECTTYPE * pAmmo );
|
||||
extern BOOLEAN UnloadGun( SOLDIERTYPE * pSoldier, OBJECTTYPE * pGun);
|
||||
|
||||
UINT8 ItemSlotLimit( UINT16 usItem, INT8 bSlot );
|
||||
|
||||
|
||||
+1
-1
@@ -199,7 +199,7 @@ BOOLEAN KeyExistsInInventory( SOLDIERTYPE *pSoldier, UINT8 ubKeyID )
|
||||
{
|
||||
if (Item[pSoldier->inv[ubLoop].usItem].usItemClass == IC_KEY)
|
||||
{
|
||||
if ( (pSoldier->inv[ubLoop].ubKeyID == ubKeyID) || (ubKeyID == ANYKEY) )
|
||||
if ( (pSoldier->inv[ubLoop].ItemData.Key.ubKeyID == ubKeyID) || (ubKeyID == ANYKEY) )
|
||||
{
|
||||
// there's the key we want!
|
||||
return( TRUE );
|
||||
|
||||
+19
-19
@@ -1998,7 +1998,7 @@ BOOLEAN BulletHitMerc( BULLET * pBullet, STRUCTURE * pStructure, BOOLEAN fIntend
|
||||
}
|
||||
else
|
||||
{
|
||||
ubAmmoType = pFirer->inv[pFirer->ubAttackingHand].ubGunAmmoType;
|
||||
ubAmmoType = pFirer->inv[pFirer->ubAttackingHand].ItemData.Gun.ubGunAmmoType;
|
||||
}
|
||||
|
||||
// at least partly compensate for "near miss" increases for this guy, after all, the bullet
|
||||
@@ -2119,12 +2119,12 @@ BOOLEAN BulletHitMerc( BULLET * pBullet, STRUCTURE * pStructure, BOOLEAN fIntend
|
||||
// lucky bastard was facing away!
|
||||
}
|
||||
// else if ( ( (pTarget->inv[HEAD1POS].usItem == NIGHTGOGGLES) || (pTarget->inv[HEAD1POS].usItem == SUNGOGGLES) || (pTarget->inv[HEAD1POS].usItem == GASMASK) ) && ( PreRandom( 100 ) < (UINT32) (pTarget->inv[HEAD1POS].bStatus[ 0 ]) ) )
|
||||
else if ( ( (pTarget->inv[HEAD1POS].usItem != NONE) ) && ( PreRandom( 100 ) < (UINT32) (pTarget->inv[HEAD1POS].bStatus[ 0 ]) ) )
|
||||
else if ( ( (pTarget->inv[HEAD1POS].usItem != NONE) ) && ( PreRandom( 100 ) < (UINT32) (pTarget->inv[HEAD1POS].ItemData.Generic.bStatus[ 0 ]) ) )
|
||||
{
|
||||
// lucky bastard was wearing protective stuff
|
||||
bHeadSlot = HEAD1POS;
|
||||
}
|
||||
else if ( ( (pTarget->inv[HEAD2POS].usItem != NONE) ) && ( PreRandom( 100 ) < (UINT32) (pTarget->inv[HEAD2POS].bStatus[ 0 ]) ) )
|
||||
else if ( ( (pTarget->inv[HEAD2POS].usItem != NONE) ) && ( PreRandom( 100 ) < (UINT32) (pTarget->inv[HEAD2POS].ItemData.Generic.bStatus[ 0 ]) ) )
|
||||
{
|
||||
// lucky bastard was wearing protective stuff
|
||||
bHeadSlot = HEAD2POS;
|
||||
@@ -2204,10 +2204,10 @@ BOOLEAN BulletHitMerc( BULLET * pBullet, STRUCTURE * pStructure, BOOLEAN fIntend
|
||||
{
|
||||
if (bHeadSlot != NO_SLOT)
|
||||
{
|
||||
pTarget->inv[ bHeadSlot ].bStatus[ 0 ] -= (INT8) ( (iImpact / 2) + Random( (iImpact / 2) ) );
|
||||
if ( pTarget->inv[ bHeadSlot ].bStatus[ 0 ] <= USABLE )
|
||||
pTarget->inv[ bHeadSlot ].ItemData.Generic.bStatus[ 0 ] -= (INT8) ( (iImpact / 2) + Random( (iImpact / 2) ) );
|
||||
if ( pTarget->inv[ bHeadSlot ].ItemData.Generic.bStatus[ 0 ] <= USABLE )
|
||||
{
|
||||
if ( pTarget->inv[ bHeadSlot ].bStatus[ 0 ] <= 0 )
|
||||
if ( pTarget->inv[ bHeadSlot ].ItemData.Generic.bStatus[ 0 ] <= 0 )
|
||||
{
|
||||
DeleteObj( &(pTarget->inv[ bHeadSlot ]) );
|
||||
DirtyMercPanelInterface( pTarget, DIRTYLEVEL2 );
|
||||
@@ -2222,11 +2222,11 @@ BOOLEAN BulletHitMerc( BULLET * pBullet, STRUCTURE * pStructure, BOOLEAN fIntend
|
||||
bHeadSlot = HEAD1POS + (INT8) Random( 2 );
|
||||
if ( pTarget->inv[ bHeadSlot ].usItem != NOTHING )
|
||||
{
|
||||
pTarget->inv[ bHeadSlot ].bStatus[ 0 ] -= (INT8) ( Random( iImpact / 2 ) );
|
||||
if ( pTarget->inv[ bHeadSlot ].bStatus[ 0 ] < 0 )
|
||||
pTarget->inv[ bHeadSlot ].ItemData.Generic.bStatus[ 0 ] -= (INT8) ( Random( iImpact / 2 ) );
|
||||
if ( pTarget->inv[ bHeadSlot ].ItemData.Generic.bStatus[ 0 ] < 0 )
|
||||
{
|
||||
// just break it...
|
||||
pTarget->inv[ bHeadSlot ].bStatus[ 0 ] = 1;
|
||||
pTarget->inv[ bHeadSlot ].ItemData.Generic.bStatus[ 0 ] = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -2465,7 +2465,7 @@ INT32 HandleBulletStructureInteraction( BULLET * pBullet, STRUCTURE * pStructure
|
||||
//else if ( pBullet->usFlags & BULLET_FLAG_SMALL_MISSILE )
|
||||
//{
|
||||
// stops if using HE ammo
|
||||
else if ( AmmoTypes[pBullet->pFirer->inv[ pBullet->pFirer->ubAttackingHand ].ubGunAmmoType].highExplosive && !AmmoTypes[pBullet->pFirer->inv[ pBullet->pFirer->ubAttackingHand ].ubGunAmmoType].antiTank )
|
||||
else if ( AmmoTypes[pBullet->pFirer->inv[ pBullet->pFirer->ubAttackingHand ].ItemData.Gun.ubGunAmmoType].highExplosive && !AmmoTypes[pBullet->pFirer->inv[ pBullet->pFirer->ubAttackingHand ].ItemData.Gun.ubGunAmmoType].antiTank )
|
||||
{
|
||||
*pfHit = TRUE;
|
||||
return( 0 );
|
||||
@@ -2481,7 +2481,7 @@ INT32 HandleBulletStructureInteraction( BULLET * pBullet, STRUCTURE * pStructure
|
||||
pDoor = FindDoorInfoAtGridNo( pBullet->sGridNo );
|
||||
|
||||
// Does it have a lock?
|
||||
INT16 lockBustingPower = AmmoTypes[pBullet->pFirer->inv[ pBullet->pFirer->ubAttackingHand ].ubGunAmmoType].lockBustingPower;
|
||||
INT16 lockBustingPower = AmmoTypes[pBullet->pFirer->inv[ pBullet->pFirer->ubAttackingHand ].ItemData.Gun.ubGunAmmoType].lockBustingPower;
|
||||
|
||||
// WANNE: bugfix: No door returned, so the game crashes!
|
||||
if (pDoor)
|
||||
@@ -2545,7 +2545,7 @@ INT32 HandleBulletStructureInteraction( BULLET * pBullet, STRUCTURE * pStructure
|
||||
iImpactReduction = gubMaterialArmour[ pStructure->pDBStructureRef->pDBStructure->ubArmour ];
|
||||
iImpactReduction = StructureResistanceIncreasedByRange( iImpactReduction, pBullet->iRange, pBullet->iLoop );
|
||||
|
||||
iImpactReduction = (INT32) (iImpactReduction * AmmoTypes[pBullet->pFirer->inv[ pBullet->pFirer->ubAttackingHand ].ubGunAmmoType].structureImpactReductionMultiplier / max(1,AmmoTypes[pBullet->pFirer->inv[ pBullet->pFirer->ubAttackingHand ].ubGunAmmoType].structureImpactReductionDivisor));
|
||||
iImpactReduction = (INT32) (iImpactReduction * AmmoTypes[pBullet->pFirer->inv[ pBullet->pFirer->ubAttackingHand ].ItemData.Gun.ubGunAmmoType].structureImpactReductionMultiplier / max(1,AmmoTypes[pBullet->pFirer->inv[ pBullet->pFirer->ubAttackingHand ].ItemData.Gun.ubGunAmmoType].structureImpactReductionDivisor));
|
||||
|
||||
//switch (pBullet->pFirer->inv[ pBullet->pFirer->ubAttackingHand ].ubGunAmmoType)
|
||||
//{
|
||||
@@ -2599,7 +2599,7 @@ INT32 CTGTHandleBulletStructureInteraction( BULLET * pBullet, STRUCTURE * pStruc
|
||||
//else if ( pBullet->usFlags & BULLET_FLAG_SMALL_MISSILE )
|
||||
//{
|
||||
// stops if using HE ammo
|
||||
else if ( AmmoTypes[pBullet->pFirer->inv[ pBullet->pFirer->ubAttackingHand ].ubGunAmmoType].highExplosive && !AmmoTypes[pBullet->pFirer->inv[ pBullet->pFirer->ubAttackingHand ].ubGunAmmoType].antiTank )
|
||||
else if ( AmmoTypes[pBullet->pFirer->inv[ pBullet->pFirer->ubAttackingHand ].ItemData.Gun.ubGunAmmoType].highExplosive && !AmmoTypes[pBullet->pFirer->inv[ pBullet->pFirer->ubAttackingHand ].ItemData.Gun.ubGunAmmoType].antiTank )
|
||||
{
|
||||
return( pBullet->iImpact );
|
||||
}
|
||||
@@ -2626,7 +2626,7 @@ INT32 CTGTHandleBulletStructureInteraction( BULLET * pBullet, STRUCTURE * pStruc
|
||||
iImpactReduction = gubMaterialArmour[ pStructure->pDBStructureRef->pDBStructure->ubArmour ] * pStructure->pDBStructureRef->pDBStructure->ubDensity / 100;
|
||||
iImpactReduction = StructureResistanceIncreasedByRange( iImpactReduction, pBullet->iRange, pBullet->iLoop );
|
||||
|
||||
iImpactReduction = (INT32)(iImpactReduction * AmmoTypes[pBullet->pFirer->inv[ pBullet->pFirer->ubAttackingHand ].ubGunAmmoType].structureImpactReductionMultiplier / max(1,AmmoTypes[pBullet->pFirer->inv[ pBullet->pFirer->ubAttackingHand ].ubGunAmmoType].structureImpactReductionDivisor));
|
||||
iImpactReduction = (INT32)(iImpactReduction * AmmoTypes[pBullet->pFirer->inv[ pBullet->pFirer->ubAttackingHand ].ItemData.Gun.ubGunAmmoType].structureImpactReductionMultiplier / max(1,AmmoTypes[pBullet->pFirer->inv[ pBullet->pFirer->ubAttackingHand ].ItemData.Gun.ubGunAmmoType].structureImpactReductionDivisor));
|
||||
|
||||
//switch (pBullet->pFirer->inv[ pBullet->pFirer->ubAttackingHand ].ubGunAmmoType)
|
||||
//{
|
||||
@@ -3608,7 +3608,7 @@ INT8 FireBulletGivenTarget( SOLDIERTYPE * pFirer, FLOAT dEndX, FLOAT dEndY, FLOA
|
||||
usBulletFlags |= BULLET_FLAG_FLAME;
|
||||
ubSpreadIndex = 2;
|
||||
}
|
||||
else if ( AmmoTypes[ pFirer->inv[pFirer->ubAttackingHand].ubGunAmmoType ].tracerEffect && (pFirer->bDoBurst || gGameSettings.fOptions[ TOPTION_TRACERS_FOR_SINGLE_FIRE ]) )
|
||||
else if ( AmmoTypes[ pFirer->inv[pFirer->ubAttackingHand].ItemData.Gun.ubGunAmmoType ].tracerEffect && (pFirer->bDoBurst || gGameSettings.fOptions[ TOPTION_TRACERS_FOR_SINGLE_FIRE ]) )
|
||||
{
|
||||
//usBulletFlags |= BULLET_FLAG_TRACER;
|
||||
fTracer = TRUE;
|
||||
@@ -3622,7 +3622,7 @@ INT8 FireBulletGivenTarget( SOLDIERTYPE * pFirer, FLOAT dEndX, FLOAT dEndY, FLOA
|
||||
// shotgun pellets fire 9 bullets doing 1/4 damage each
|
||||
if (!fFake)
|
||||
{
|
||||
ubShots = AmmoTypes[pFirer->inv[pFirer->ubAttackingHand].ubGunAmmoType].numberOfBullets;
|
||||
ubShots = AmmoTypes[pFirer->inv[pFirer->ubAttackingHand].ItemData.Gun.ubGunAmmoType].numberOfBullets;
|
||||
// but you can't really aim the damn things very well!
|
||||
if (sHitBy > 0)
|
||||
{
|
||||
@@ -3640,7 +3640,7 @@ INT8 FireBulletGivenTarget( SOLDIERTYPE * pFirer, FLOAT dEndX, FLOAT dEndY, FLOA
|
||||
|
||||
}
|
||||
// ubImpact = AMMO_DAMAGE_ADJUSTMENT_BUCKSHOT( ubImpact );
|
||||
ubImpact = (UINT8) (ubImpact * AmmoTypes[pFirer->inv[pFirer->ubAttackingHand].ubGunAmmoType].multipleBulletDamageMultiplier / max(1,AmmoTypes[pFirer->inv[pFirer->ubAttackingHand].ubGunAmmoType].multipleBulletDamageDivisor) );
|
||||
ubImpact = (UINT8) (ubImpact * AmmoTypes[pFirer->inv[pFirer->ubAttackingHand].ItemData.Gun.ubGunAmmoType].multipleBulletDamageMultiplier / max(1,AmmoTypes[pFirer->inv[pFirer->ubAttackingHand].ItemData.Gun.ubGunAmmoType].multipleBulletDamageDivisor) );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3727,7 +3727,7 @@ INT8 FireBulletGivenTarget( SOLDIERTYPE * pFirer, FLOAT dEndX, FLOAT dEndY, FLOA
|
||||
|
||||
if ( pBullet->usFlags & BULLET_FLAG_KNIFE )
|
||||
{
|
||||
pBullet->ubItemStatus = pFirer->inv[pFirer->ubAttackingHand].bStatus[0];
|
||||
pBullet->ubItemStatus = pFirer->inv[pFirer->ubAttackingHand].ItemData.Generic.bStatus[0];
|
||||
}
|
||||
|
||||
// apply increments for first move
|
||||
@@ -3787,7 +3787,7 @@ INT8 ChanceToGetThrough( SOLDIERTYPE * pFirer, FLOAT dEndX, FLOAT dEndY, FLOAT d
|
||||
// if shotgun, shotgun would have to be in main hand
|
||||
if ( pFirer->inv[ HANDPOS ].usItem == pFirer->usAttackingWeapon )
|
||||
{
|
||||
if ( AmmoTypes[pFirer->inv[ HANDPOS ].ubGunAmmoType].numberOfBullets > 1 )
|
||||
if ( AmmoTypes[pFirer->inv[ HANDPOS ].ItemData.Gun.ubGunAmmoType].numberOfBullets > 1 )
|
||||
{
|
||||
fBuckShot = TRUE;
|
||||
}
|
||||
|
||||
@@ -138,7 +138,7 @@ INT8 HireMerc( MERC_HIRE_STRUCT *pHireMerc)
|
||||
memset( &Object, 0, sizeof( OBJECTTYPE ) );
|
||||
Object.usItem = LETTER;
|
||||
Object.ubNumberOfObjects = 1;
|
||||
Object.bStatus[0] = 100;
|
||||
Object.ItemData.Generic.bStatus[0] = 100;
|
||||
// Give it
|
||||
fReturn = AutoPlaceObject( MercPtrs[iNewIndex], &Object, FALSE );
|
||||
Assert( fReturn );
|
||||
|
||||
@@ -222,6 +222,11 @@ void PrepareMilitiaForTactical( BOOLEAN fPrepareAll)
|
||||
if ( gWorldSectorX ==0 && gWorldSectorY == 0 )
|
||||
return;
|
||||
|
||||
for (int i=0; i<TOTAL_SOLDIERS; i++)
|
||||
{
|
||||
Assert( !MercPtrs[i]->bActive || !MercPtrs[i]->bInSector || MercPtrs[i]->sGridNo != NOWHERE);
|
||||
}
|
||||
|
||||
pSector = &SectorInfo[ SECTOR( gWorldSectorX, gWorldSectorY ) ];
|
||||
ubGreen = pSector->ubNumberOfCivsAtLevel[ GREEN_MILITIA ];
|
||||
ubRegs = pSector->ubNumberOfCivsAtLevel[ REGULAR_MILITIA ];
|
||||
@@ -248,8 +253,8 @@ void PrepareMilitiaForTactical( BOOLEAN fPrepareAll)
|
||||
ubElites -= gpAttackDirs[ x ][2];
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
//else
|
||||
//{
|
||||
#endif
|
||||
AddSoldierInitListMilitiaOnEdge( gpAttackDirs[ x ][ 3 ], gpAttackDirs[ x ][0], gpAttackDirs[ x ][1], gpAttackDirs[ x ][2] );
|
||||
}
|
||||
@@ -269,6 +274,11 @@ void PrepareMilitiaForTactical( BOOLEAN fPrepareAll)
|
||||
//// MercPtrs[ i ]->bAttitude = AGGRESSIVE;
|
||||
// }
|
||||
// }
|
||||
|
||||
for (int i=0; i<TOTAL_SOLDIERS; i++)
|
||||
{
|
||||
Assert( !MercPtrs[i]->bActive || !MercPtrs[i]->bInSector || MercPtrs[i]->sGridNo != NOWHERE);
|
||||
}
|
||||
}
|
||||
|
||||
void HandleMilitiaPromotions( void )
|
||||
|
||||
+6
-6
@@ -1626,7 +1626,7 @@ BOOLEAN EnoughAmmo( SOLDIERTYPE *pSoldier, BOOLEAN fDisplay, INT8 bInvPos )
|
||||
}
|
||||
else if (Item[ pSoldier->inv[ bInvPos ].usItem ].usItemClass == IC_GUN)
|
||||
{
|
||||
if ( pSoldier->inv[ bInvPos ].ubGunShotsLeft == 0 )
|
||||
if ( pSoldier->inv[ bInvPos ].ItemData.Gun.ubGunShotsLeft == 0 )
|
||||
{
|
||||
if ( fDisplay )
|
||||
{
|
||||
@@ -1638,7 +1638,7 @@ BOOLEAN EnoughAmmo( SOLDIERTYPE *pSoldier, BOOLEAN fDisplay, INT8 bInvPos )
|
||||
//<SB> manual recharge
|
||||
if( pSoldier->bTeam == OUR_TEAM )
|
||||
{
|
||||
if ( !( pSoldier->inv[ bInvPos ].ubGunState & GS_CARTRIDGE_IN_CHAMBER ) )
|
||||
if ( !( pSoldier->inv[ bInvPos ].ItemData.Gun.ubGunState & GS_CARTRIDGE_IN_CHAMBER ) )
|
||||
{
|
||||
return( FALSE );
|
||||
}
|
||||
@@ -1677,11 +1677,11 @@ void DeductAmmo( SOLDIERTYPE *pSoldier, INT8 bInvPos )
|
||||
if ( pSoldier->usAttackingWeapon == pObj->usItem)
|
||||
{
|
||||
// OK, let's see, don't overrun...
|
||||
if ( pObj->ubGunShotsLeft != 0 )
|
||||
if ( pObj->ItemData.Gun.ubGunShotsLeft != 0 )
|
||||
{
|
||||
pObj->ubGunShotsLeft--;
|
||||
pObj->ItemData.Gun.ubGunShotsLeft--;
|
||||
//Pulmu: Update weight after firing gun to account for bullets fired
|
||||
if( gGameExternalOptions.fAmmoDynamicWeight == TRUE && pObj->ubGunShotsLeft > 0)
|
||||
if( gGameExternalOptions.fAmmoDynamicWeight == TRUE && pObj->ItemData.Gun.ubGunShotsLeft > 0)
|
||||
{
|
||||
pSoldier->inv[HANDPOS].ubWeight = CalculateObjectWeight( &(pSoldier->inv[HANDPOS]));
|
||||
}
|
||||
@@ -1823,7 +1823,7 @@ INT8 GetAPsToAutoReload( SOLDIERTYPE * pSoldier )
|
||||
pObj = &(pSoldier->inv[HANDPOS]);
|
||||
|
||||
//<SB> manual recharge
|
||||
if (pObj->ubGunShotsLeft && !(pObj->ubGunState & GS_CARTRIDGE_IN_CHAMBER) )
|
||||
if (pObj->ItemData.Gun.ubGunShotsLeft && !(pObj->ItemData.Gun.ubGunState & GS_CARTRIDGE_IN_CHAMBER) )
|
||||
{
|
||||
return Weapon[Item[(pObj)->usItem].ubClassIndex].APsToReloadManually;
|
||||
}
|
||||
|
||||
@@ -939,8 +939,8 @@ BOOLEAN TurnSoldierIntoCorpse( SOLDIERTYPE *pSoldier, BOOLEAN fRemoveMerc, BOOLE
|
||||
|
||||
if ( Item[pObj->usItem].damageable && Item[pObj->usItem].usItemClass != IC_THROWING_KNIFE ) // Madd: drop crappier items from enemies on higher difficulty levels - note the quick fix for throwing knives
|
||||
{
|
||||
pObj->bStatus[0] -= (gGameOptions.ubDifficultyLevel - 1) * Random(20);
|
||||
pObj->bStatus[0] = min(max(pObj->bStatus[0],1),100); // never below 1% or above 100%
|
||||
pObj->ItemData.Generic.bStatus[0] -= (gGameOptions.ubDifficultyLevel - 1) * Random(20);
|
||||
pObj->ItemData.Generic.bStatus[0] = min(max(pObj->ItemData.Generic.bStatus[0],1),100); // never below 1% or above 100%
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -2287,7 +2287,7 @@ void SelectPlayersOfferSlotsRegionCallBack(MOUSE_REGION * pRegion, INT32 iReason
|
||||
{
|
||||
//Since money is always evaluated
|
||||
PlayersOfferArea[ ubSelectedInvSlot ].uiFlags |= ARMS_INV_PLAYERS_ITEM_HAS_VALUE;
|
||||
PlayersOfferArea[ ubSelectedInvSlot ].uiItemPrice = PlayersOfferArea[ ubSelectedInvSlot ].ItemObject.bMoneyStatus;
|
||||
PlayersOfferArea[ ubSelectedInvSlot ].uiItemPrice = PlayersOfferArea[ ubSelectedInvSlot ].ItemObject.ItemData.Money.bMoneyStatus;
|
||||
}
|
||||
}
|
||||
else // slot is empty
|
||||
@@ -2759,7 +2759,7 @@ UINT32 DisplayInvSlot( UINT8 ubSlotNum, UINT16 usItemIndex, UINT16 usPosX, UINT1
|
||||
}
|
||||
|
||||
// Display 'JAMMED' if it's jammed
|
||||
if ( pItemObject->bGunAmmoStatus < 0 )
|
||||
if ( pItemObject->ItemData.Gun.bGunAmmoStatus < 0 )
|
||||
{
|
||||
swprintf( zTemp, TacticalStr[ JAMMED_ITEM_STR ] );
|
||||
VarFindFontCenterCoordinates( usPosX, usPosY, SKI_INV_SLOT_WIDTH, SKI_INV_HEIGHT, TINYFONT1, &sCenX, &sCenY, zTemp );
|
||||
@@ -3002,7 +3002,7 @@ BOOLEAN RepairIsDone(UINT16 usItemIndex, UINT8 ubElement)
|
||||
if ( CanDealerRepairItem( gbSelectedArmsDealerID, RepairItem.ItemObject.usItem ) )
|
||||
{
|
||||
// make its condition 100%
|
||||
RepairItem.ItemObject.bStatus[ 0 ] = 100;
|
||||
RepairItem.ItemObject.ItemData.Generic.bStatus[ 0 ] = 100;
|
||||
}
|
||||
|
||||
// max condition of all permanent attachments on it
|
||||
@@ -3096,25 +3096,25 @@ UINT32 CalcShopKeeperItemPrice( BOOLEAN fDealerSelling, BOOLEAN fUnitPriceOnly,
|
||||
case IC_GUN:
|
||||
// add value of the gun
|
||||
uiUnitPrice += (UINT32)( CalcValueOfItemToDealer( gbSelectedArmsDealerID, usItemID, fDealerSelling ) *
|
||||
ItemConditionModifier(usItemID, pItemObject->bGunStatus) *
|
||||
ItemConditionModifier(usItemID, pItemObject->ItemData.Gun.bGunStatus) *
|
||||
dModifier );
|
||||
|
||||
// if any ammo is loaded
|
||||
if( pItemObject->usGunAmmoItem != NONE)
|
||||
if( pItemObject->ItemData.Gun.usGunAmmoItem != NONE)
|
||||
{
|
||||
// if it's regular ammo
|
||||
if( Item[ pItemObject->usGunAmmoItem ].usItemClass == IC_AMMO )
|
||||
if( Item[ pItemObject->ItemData.Gun.usGunAmmoItem ].usItemClass == IC_AMMO )
|
||||
{
|
||||
// add value of its remaining ammo
|
||||
uiUnitPrice += (UINT32)( CalcValueOfItemToDealer( gbSelectedArmsDealerID, pItemObject->usGunAmmoItem, fDealerSelling ) *
|
||||
ItemConditionModifier(pItemObject->usGunAmmoItem, pItemObject->ubGunShotsLeft) *
|
||||
uiUnitPrice += (UINT32)( CalcValueOfItemToDealer( gbSelectedArmsDealerID, pItemObject->ItemData.Gun.usGunAmmoItem, fDealerSelling ) *
|
||||
ItemConditionModifier(pItemObject->ItemData.Gun.usGunAmmoItem, pItemObject->ItemData.Gun.ubGunShotsLeft) *
|
||||
dModifier );
|
||||
}
|
||||
else // assume it's attached ammo (mortar shells, grenades)
|
||||
{
|
||||
// add its value (uses normal status 0-100)
|
||||
uiUnitPrice += (UINT32)( CalcValueOfItemToDealer( gbSelectedArmsDealerID, pItemObject->usGunAmmoItem, fDealerSelling ) *
|
||||
ItemConditionModifier(pItemObject->usGunAmmoItem, pItemObject->bGunAmmoStatus) *
|
||||
uiUnitPrice += (UINT32)( CalcValueOfItemToDealer( gbSelectedArmsDealerID, pItemObject->ItemData.Gun.usGunAmmoItem, fDealerSelling ) *
|
||||
ItemConditionModifier(pItemObject->ItemData.Gun.usGunAmmoItem, pItemObject->ItemData.Gun.bGunAmmoStatus) *
|
||||
dModifier );
|
||||
}
|
||||
}
|
||||
@@ -3145,7 +3145,7 @@ UINT32 CalcShopKeeperItemPrice( BOOLEAN fDealerSelling, BOOLEAN fUnitPriceOnly,
|
||||
{
|
||||
// for bullets, ItemConditionModifier will convert the #ShotsLeft into a percentage
|
||||
uiUnitPrice += (UINT32)( CalcValueOfItemToDealer( gbSelectedArmsDealerID, usItemID, fDealerSelling ) *
|
||||
ItemConditionModifier(usItemID, pItemObject->ubShotsLeft[ubCnt]) *
|
||||
ItemConditionModifier(usItemID, pItemObject->ItemData.Ammo.ubShotsLeft[ubCnt]) *
|
||||
dModifier );
|
||||
|
||||
if ( fUnitPriceOnly )
|
||||
@@ -3176,7 +3176,7 @@ UINT32 CalcShopKeeperItemPrice( BOOLEAN fDealerSelling, BOOLEAN fUnitPriceOnly,
|
||||
{
|
||||
// for bullets, ItemConditionModifier will convert the #ShotsLeft into a percentage
|
||||
uiUnitPrice += (UINT32)( CalcValueOfItemToDealer( gbSelectedArmsDealerID, usItemID, fDealerSelling ) *
|
||||
ItemConditionModifier(usItemID, pItemObject->bStatus[ ubCnt ]) *
|
||||
ItemConditionModifier(usItemID, pItemObject->ItemData.Generic.bStatus[ ubCnt ]) *
|
||||
dModifier );
|
||||
|
||||
if ( fUnitPriceOnly )
|
||||
@@ -3525,7 +3525,7 @@ INT8 AddItemToPlayersOfferArea( UINT8 ubProfileID, INVENTORY_IN_SLOT* pInvSlot,
|
||||
{
|
||||
//Since money is always evaluated
|
||||
PlayersOfferArea[ bCnt ].uiFlags |= ARMS_INV_PLAYERS_ITEM_HAS_VALUE;
|
||||
PlayersOfferArea[ bCnt ].uiItemPrice = PlayersOfferArea[ bCnt ].ItemObject.uiMoneyAmount;
|
||||
PlayersOfferArea[ bCnt ].uiItemPrice = PlayersOfferArea[ bCnt ].ItemObject.ItemData.Money.uiMoneyAmount;
|
||||
}
|
||||
gubSkiDirtyLevel = SKI_DIRTY_LEVEL2;
|
||||
|
||||
@@ -3596,8 +3596,8 @@ void DisplayPlayersOfferArea()
|
||||
sSoldierID = GetSoldierIDFromMercID( PlayersOfferArea[ sCnt ].ubIdOfMercWhoOwnsTheItem );
|
||||
Assert(sSoldierID != -1);
|
||||
|
||||
PlayersOfferArea[ sCnt ].ItemObject.uiMoneyAmount = Menptr[ sSoldierID ].inv[ PlayersOfferArea[ sCnt ].bSlotIdInOtherLocation ].uiMoneyAmount;
|
||||
PlayersOfferArea[ sCnt ].uiItemPrice = PlayersOfferArea[ sCnt ].ItemObject.uiMoneyAmount;
|
||||
PlayersOfferArea[ sCnt ].ItemObject.ItemData.Money.uiMoneyAmount = Menptr[ sSoldierID ].inv[ PlayersOfferArea[ sCnt ].bSlotIdInOtherLocation ].ItemData.Money.uiMoneyAmount;
|
||||
PlayersOfferArea[ sCnt ].uiItemPrice = PlayersOfferArea[ sCnt ].ItemObject.ItemData.Money.uiMoneyAmount;
|
||||
}
|
||||
}
|
||||
else // not money
|
||||
@@ -3734,7 +3734,7 @@ UINT32 CalculateTotalPlayersValue()
|
||||
{
|
||||
//Calculate a price for the item
|
||||
if( Item[ PlayersOfferArea[ ubCnt ].sItemIndex ].usItemClass == IC_MONEY )
|
||||
uiTotal += PlayersOfferArea[ ubCnt ].ItemObject.uiMoneyAmount;
|
||||
uiTotal += PlayersOfferArea[ ubCnt ].ItemObject.ItemData.Money.uiMoneyAmount;
|
||||
else
|
||||
uiTotal += PlayersOfferArea[ ubCnt ].uiItemPrice;
|
||||
}
|
||||
@@ -4058,7 +4058,7 @@ void MovePlayerOfferedItemsOfValueToArmsDealersInventory()
|
||||
if( Item[ PlayersOfferArea[ uiCnt ].sItemIndex ].usItemClass == IC_MONEY )
|
||||
{
|
||||
//add the money to the dealers 'cash'
|
||||
gArmsDealerStatus[ gbSelectedArmsDealerID ].uiArmsDealersCash += PlayersOfferArea[ uiCnt ].ItemObject.uiMoneyAmount;
|
||||
gArmsDealerStatus[ gbSelectedArmsDealerID ].uiArmsDealersCash += PlayersOfferArea[ uiCnt ].ItemObject.ItemData.Money.uiMoneyAmount;
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -4457,7 +4457,7 @@ INT8 AddInventoryToSkiLocation( INVENTORY_IN_SLOT *pInv, UINT8 ubSpotLocation, U
|
||||
{
|
||||
//Since money is always evaluated
|
||||
PlayersOfferArea[ ubSpotLocation ].uiFlags |= ARMS_INV_PLAYERS_ITEM_HAS_VALUE;
|
||||
PlayersOfferArea[ ubSpotLocation ].uiItemPrice = PlayersOfferArea[ ubSpotLocation ].ItemObject.uiMoneyAmount;
|
||||
PlayersOfferArea[ ubSpotLocation ].uiItemPrice = PlayersOfferArea[ ubSpotLocation ].ItemObject.ItemData.Money.uiMoneyAmount;
|
||||
}
|
||||
|
||||
SetSkiRegionHelpText( &PlayersOfferArea[ ubSpotLocation ], &gPlayersOfferSlotsMouseRegions[ ubSpotLocation ], PLAYERS_OFFER_AREA );
|
||||
@@ -5759,7 +5759,7 @@ UINT32 CalculateHowMuchMoneyIsInPlayersOfferArea( )
|
||||
{
|
||||
if( Item[ PlayersOfferArea[ ubCnt ].sItemIndex ].usItemClass == IC_MONEY )
|
||||
{
|
||||
uiTotalMoneyValue += PlayersOfferArea[ ubCnt ].ItemObject.uiMoneyAmount;
|
||||
uiTotalMoneyValue += PlayersOfferArea[ ubCnt ].ItemObject.ItemData.Money.uiMoneyAmount;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -5832,7 +5832,7 @@ INT8 GetInvSlotOfUnfullMoneyInMercInventory( SOLDIERTYPE *pSoldier )
|
||||
for( ubCnt=0; ubCnt < NUM_INV_SLOTS; ubCnt++)
|
||||
{
|
||||
// Look for MONEY only, not Gold or Silver!!! And look for a slot not already full
|
||||
if( ( pSoldier->inv[ ubCnt ].usItem == MONEY ) && ( pSoldier->inv[ ubCnt ].uiMoneyAmount < MoneySlotLimit( ubCnt ) ) )
|
||||
if( ( pSoldier->inv[ ubCnt ].usItem == MONEY ) && ( pSoldier->inv[ ubCnt ].ItemData.Money.uiMoneyAmount < MoneySlotLimit( ubCnt ) ) )
|
||||
{
|
||||
return( ubCnt );
|
||||
}
|
||||
@@ -5934,7 +5934,7 @@ void EvaluateItemAddedToPlayersOfferArea( INT8 bSlotID, BOOLEAN fFirstOne )
|
||||
|
||||
|
||||
//if the item is damaged, or is a rocket rifle (which always "need repairing" even at 100%, to reset imprinting)
|
||||
if( ( PlayersOfferArea[ bSlotID ].ItemObject.bStatus[ 0 ] < 100 ) || fRocketRifleWasEvaluated )
|
||||
if( ( PlayersOfferArea[ bSlotID ].ItemObject.ItemData.Generic.bStatus[ 0 ] < 100 ) || fRocketRifleWasEvaluated )
|
||||
{
|
||||
INT8 bSlotAddedTo;
|
||||
|
||||
@@ -5960,7 +5960,7 @@ void EvaluateItemAddedToPlayersOfferArea( INT8 bSlotID, BOOLEAN fFirstOne )
|
||||
// check if the item is really badly damaged
|
||||
if( Item[ ArmsDealerOfferArea[ bSlotAddedTo ].sItemIndex ].usItemClass != IC_AMMO )
|
||||
{
|
||||
if( ArmsDealerOfferArea[ bSlotAddedTo ].ItemObject.bStatus[ 0 ] < REALLY_BADLY_DAMAGED_THRESHOLD )
|
||||
if( ArmsDealerOfferArea[ bSlotAddedTo ].ItemObject.ItemData.Generic.bStatus[ 0 ] < REALLY_BADLY_DAMAGED_THRESHOLD )
|
||||
{
|
||||
uiEvalResult = EVAL_RESULT_OK_BUT_REALLY_DAMAGED;
|
||||
}
|
||||
@@ -6676,8 +6676,8 @@ void SplitComplexObjectIntoSubObjects( OBJECTTYPE *pComplexObject )
|
||||
// Exception: don't do this with rocket launchers, their "shots left" are fake and this screws 'em up!
|
||||
if ( !Item[pComplexObject->usItem].singleshotrocketlauncher ) // Madd rpg - still do this
|
||||
{
|
||||
pNextObj->ubGunShotsLeft = 0;
|
||||
pNextObj->usGunAmmoItem = NONE;
|
||||
pNextObj->ItemData.Gun.ubGunShotsLeft = 0;
|
||||
pNextObj->ItemData.Gun.usGunAmmoItem = NONE;
|
||||
}
|
||||
|
||||
/* gunAmmoStatus is currently not being used that way, it's strictly used as a jammed/unjammed, and so should never be 0
|
||||
@@ -6713,18 +6713,18 @@ void SplitComplexObjectIntoSubObjects( OBJECTTYPE *pComplexObject )
|
||||
if ( Item [ pComplexObject->usItem ].usItemClass == IC_GUN )
|
||||
{
|
||||
// and it has ammo/payload
|
||||
if ( pComplexObject->usGunAmmoItem != NONE )
|
||||
if ( pComplexObject->ItemData.Gun.usGunAmmoItem != NONE )
|
||||
{
|
||||
// if it's bullets
|
||||
if ( Item[ pComplexObject->usGunAmmoItem ].usItemClass == IC_AMMO )
|
||||
if ( Item[ pComplexObject->ItemData.Gun.usGunAmmoItem ].usItemClass == IC_AMMO )
|
||||
{
|
||||
// and there are some left
|
||||
if ( pComplexObject->ubGunShotsLeft > 0 )
|
||||
if ( pComplexObject->ItemData.Gun.ubGunShotsLeft > 0 )
|
||||
{
|
||||
// make the bullets into another subobject
|
||||
CreateItem( pComplexObject->usGunAmmoItem, 100, pNextObj );
|
||||
CreateItem( pComplexObject->ItemData.Gun.usGunAmmoItem, 100, pNextObj );
|
||||
// set how many are left
|
||||
pNextObj->bStatus[ 0 ] = pComplexObject->ubGunShotsLeft;
|
||||
pNextObj->ItemData.Generic.bStatus[ 0 ] = pComplexObject->ItemData.Gun.ubGunShotsLeft;
|
||||
|
||||
pNextObj = &gSubObject[ ++ubNextFreeSlot ];
|
||||
}
|
||||
@@ -6733,12 +6733,12 @@ void SplitComplexObjectIntoSubObjects( OBJECTTYPE *pComplexObject )
|
||||
else // non-ammo payload
|
||||
{
|
||||
// make the payload into another subobject
|
||||
CreateItem( pComplexObject->usGunAmmoItem, pComplexObject->bGunAmmoStatus, pNextObj );
|
||||
CreateItem( pComplexObject->ItemData.Gun.usGunAmmoItem, pComplexObject->ItemData.Gun.bGunAmmoStatus, pNextObj );
|
||||
|
||||
// if the gun was jammed, fix up the payload's status
|
||||
if ( pNextObj->bStatus[ 0 ] < 0 )
|
||||
if ( pNextObj->ItemData.Generic.bStatus[ 0 ] < 0 )
|
||||
{
|
||||
pNextObj->bStatus[ 0 ] *= -1;
|
||||
pNextObj->ItemData.Generic.bStatus[ 0 ] *= -1;
|
||||
}
|
||||
|
||||
pNextObj = &gSubObject[ ++ubNextFreeSlot ];
|
||||
@@ -6777,7 +6777,7 @@ void SplitComplexObjectIntoSubObjects( OBJECTTYPE *pComplexObject )
|
||||
// make each item in the stack into a separate subobject
|
||||
for( ubCnt = 0; ubCnt < pComplexObject->ubNumberOfObjects; ubCnt++ )
|
||||
{
|
||||
CreateItem( pComplexObject->usItem, pComplexObject->bStatus[ ubCnt ], pNextObj );
|
||||
CreateItem( pComplexObject->usItem, pComplexObject->ItemData.Generic.bStatus[ ubCnt ], pNextObj );
|
||||
|
||||
// advance to next available subobject
|
||||
pNextObj = &gSubObject[ ++ubNextFreeSlot ];
|
||||
@@ -6807,7 +6807,7 @@ void CountSubObjectsInObject( OBJECTTYPE *pComplexObject, UINT8 *pubTotalSubObje
|
||||
|
||||
// is it in need of fixing, and also repairable by this dealer?
|
||||
// A jammed gun with a 100% status is NOT repairable - shouldn't ever happen
|
||||
if ( ( gSubObject[ ubSubObject ].bStatus[ 0 ] != 100 ) &&
|
||||
if ( ( gSubObject[ ubSubObject ].ItemData.Generic.bStatus[ 0 ] != 100 ) &&
|
||||
CanDealerRepairItem( gbSelectedArmsDealerID, gSubObject[ ubSubObject ].usItem ) )
|
||||
|
||||
{
|
||||
@@ -7040,7 +7040,7 @@ BOOLEAN SKITryToAddInvToMercsInventory( INVENTORY_IN_SLOT *pInv, SOLDIERTYPE *pS
|
||||
PlaceObject( pSoldier, bMoneyInvPos, &( pInv->ItemObject ) );
|
||||
|
||||
// if the money is all gone
|
||||
if ( pInv->ItemObject.uiMoneyAmount == 0 )
|
||||
if ( pInv->ItemObject.ItemData.Money.uiMoneyAmount == 0 )
|
||||
{
|
||||
// we've been succesful!
|
||||
return(TRUE);
|
||||
@@ -7635,7 +7635,7 @@ UINT32 EvaluateInvSlot( INVENTORY_IN_SLOT *pInvSlot )
|
||||
// check if the item is really badly damaged
|
||||
if( Item[ pInvSlot->sItemIndex ].usItemClass != IC_AMMO )
|
||||
{
|
||||
if( pInvSlot->ItemObject.bStatus[ 0 ] < REALLY_BADLY_DAMAGED_THRESHOLD )
|
||||
if( pInvSlot->ItemObject.ItemData.Generic.bStatus[ 0 ] < REALLY_BADLY_DAMAGED_THRESHOLD )
|
||||
{
|
||||
uiEvalResult = EVAL_RESULT_OK_BUT_REALLY_DAMAGED;
|
||||
}
|
||||
|
||||
@@ -258,7 +258,7 @@ INT32 SkillCheck( SOLDIERTYPE * pSoldier, INT8 bReason, INT8 bChanceMod )
|
||||
// this should never happen, but might as well check...
|
||||
iSkill = 0;
|
||||
}
|
||||
iSkill = iSkill * pSoldier->inv[bSlot].bStatus[0] / 100;
|
||||
iSkill = iSkill * pSoldier->inv[bSlot].ItemData.Generic.bStatus[0] / 100;
|
||||
break;
|
||||
case ATTACHING_DETONATOR_CHECK:
|
||||
case ATTACHING_REMOTE_DETONATOR_CHECK:
|
||||
|
||||
@@ -1156,8 +1156,8 @@ BOOLEAN InternalAddSoldierToSector( UINT8 ubID, BOOLEAN fCalculateDirection, BOO
|
||||
{
|
||||
if( pSoldier->sInsertionGridNo == NOWHERE )
|
||||
{ //Add the soldier to the respective entrypoint. This is an error condition.
|
||||
|
||||
|
||||
// So treat it like an error already then!
|
||||
Assert(0);
|
||||
}
|
||||
if( pSoldier->uiStatusFlags & SOLDIER_VEHICLE )
|
||||
{
|
||||
|
||||
@@ -3749,7 +3749,7 @@ BOOLEAN CheckForImproperFireGunEnd( SOLDIERTYPE *pSoldier )
|
||||
}
|
||||
|
||||
// Check single hand for jammed status, ( or ammo is out.. )
|
||||
if ( pSoldier->inv[ HANDPOS ].bGunAmmoStatus < 0 || pSoldier->inv[ HANDPOS ].ubGunShotsLeft == 0 )
|
||||
if ( pSoldier->inv[ HANDPOS ].ItemData.Gun.bGunAmmoStatus < 0 || pSoldier->inv[ HANDPOS ].ItemData.Gun.ubGunShotsLeft == 0 )
|
||||
{
|
||||
// If we have 2 pistols, donot go back!
|
||||
if ( Item[ pSoldier->inv[ SECONDHANDPOS ].usItem ].usItemClass != IC_GUN )
|
||||
|
||||
@@ -3283,7 +3283,7 @@ void SetSoldierGridNo( SOLDIERTYPE *pSoldier, INT16 sNewGridNo, BOOLEAN fForceRe
|
||||
BOOLEAN fSetGassed = TRUE;
|
||||
|
||||
// If we have a functioning gas mask...
|
||||
if ( FindGasMask ( pSoldier ) != NO_SLOT && pSoldier->inv[ HEAD1POS ].bStatus[ 0 ] >= GASMASK_MIN_STATUS )
|
||||
if ( FindGasMask ( pSoldier ) != NO_SLOT && pSoldier->inv[ HEAD1POS ].ItemData.Generic.bStatus[ 0 ] >= GASMASK_MIN_STATUS )
|
||||
{
|
||||
fSetGassed = FALSE;
|
||||
}
|
||||
@@ -4092,7 +4092,7 @@ void EVENT_SoldierGotHit( SOLDIERTYPE *pSoldier, UINT16 usWeaponIndex, INT16 sDa
|
||||
}
|
||||
// callahan update end
|
||||
|
||||
else if ( Item[ usWeaponIndex ].usItemClass & ( IC_GUN | IC_THROWING_KNIFE ) && AmmoTypes[MercPtrs[ubAttackerID]->inv[MercPtrs[ubAttackerID]->ubAttackingHand ].ubGunAmmoType].explosionSize <= 1)
|
||||
else if ( Item[ usWeaponIndex ].usItemClass & ( IC_GUN | IC_THROWING_KNIFE ) && AmmoTypes[MercPtrs[ubAttackerID]->inv[MercPtrs[ubAttackerID]->ubAttackingHand ].ItemData.Gun.ubGunAmmoType].explosionSize <= 1)
|
||||
{
|
||||
if ( ubSpecial == FIRE_WEAPON_SLEEP_DART_SPECIAL )
|
||||
{
|
||||
@@ -4151,7 +4151,7 @@ void EVENT_SoldierGotHit( SOLDIERTYPE *pSoldier, UINT16 usWeaponIndex, INT16 sDa
|
||||
}
|
||||
// marke added one 'or' for explosive ammo. variation of: AmmoTypes[pSoldier->inv[pSoldier->ubAttackingHand ].ubGunAmmoType].explosionSize > 1
|
||||
// extracting attacker´s ammo type
|
||||
else if ( Item[ usWeaponIndex ].usItemClass & IC_EXPLOSV || AmmoTypes[MercPtrs[ubAttackerID]->inv[MercPtrs[ubAttackerID]->ubAttackingHand ].ubGunAmmoType].explosionSize > 1)
|
||||
else if ( Item[ usWeaponIndex ].usItemClass & IC_EXPLOSV || AmmoTypes[MercPtrs[ubAttackerID]->inv[MercPtrs[ubAttackerID]->ubAttackingHand ].ItemData.Gun.ubGunAmmoType].explosionSize > 1)
|
||||
{
|
||||
INT8 bDeafValue;
|
||||
|
||||
@@ -11736,8 +11736,8 @@ BOOLEAN IsValidSecondHandShot( SOLDIERTYPE *pSoldier )
|
||||
!pSoldier->bDoBurst &&
|
||||
!Item[pSoldier->inv[ HANDPOS ].usItem].grenadelauncher &&
|
||||
Item[ pSoldier->inv[HANDPOS].usItem ].usItemClass == IC_GUN &&
|
||||
pSoldier->inv[SECONDHANDPOS].bGunStatus >= USABLE &&
|
||||
pSoldier->inv[SECONDHANDPOS].ubGunShotsLeft > 0 )
|
||||
pSoldier->inv[SECONDHANDPOS].ItemData.Gun.bGunStatus >= USABLE &&
|
||||
pSoldier->inv[SECONDHANDPOS].ItemData.Gun.ubGunShotsLeft > 0 )
|
||||
{
|
||||
return( TRUE );
|
||||
}
|
||||
@@ -11753,7 +11753,7 @@ BOOLEAN IsValidSecondHandShotForReloadingPurposes( SOLDIERTYPE *pSoldier )
|
||||
!pSoldier->bDoBurst &&
|
||||
!Item[pSoldier->inv[ HANDPOS ].usItem].grenadelauncher &&
|
||||
Item[ pSoldier->inv[HANDPOS].usItem ].usItemClass == IC_GUN &&
|
||||
pSoldier->inv[SECONDHANDPOS].bGunStatus >= USABLE //&&
|
||||
pSoldier->inv[SECONDHANDPOS].ItemData.Gun.bGunStatus >= USABLE //&&
|
||||
// pSoldier->inv[SECONDHANDPOS].ubGunShotsLeft > 0 &&
|
||||
// gAnimControl[ pSoldier->usAnimState ].ubEndHeight != ANIM_PRONE )
|
||||
)
|
||||
|
||||
@@ -354,7 +354,7 @@ SOLDIERTYPE* TacticalCreateSoldier( SOLDIERCREATE_STRUCT *pCreateStruct, UINT8 *
|
||||
}
|
||||
}
|
||||
|
||||
// Copy the items over for thew soldier, only if we have a valid profile id!
|
||||
// Copy the items over for the soldier, only if we have a valid profile id!
|
||||
if ( pCreateStruct->ubProfile != NO_PROFILE )
|
||||
CopyProfileItems( &Soldier, pCreateStruct );
|
||||
|
||||
@@ -2712,12 +2712,12 @@ void CopyProfileItems( SOLDIERTYPE *pSoldier, SOLDIERCREATE_STRUCT *pCreateStruc
|
||||
if ( uiMoneyLeft > uiMoneyLimitInSlot )
|
||||
{
|
||||
// fill pocket with money
|
||||
pSoldier->inv[ bSlot ].uiMoneyAmount = uiMoneyLimitInSlot;
|
||||
pSoldier->inv[ bSlot ].ItemData.Money.uiMoneyAmount = uiMoneyLimitInSlot;
|
||||
uiMoneyLeft -= uiMoneyLimitInSlot;
|
||||
}
|
||||
else
|
||||
{
|
||||
pSoldier->inv[ bSlot ].uiMoneyAmount = uiMoneyLeft;
|
||||
pSoldier->inv[ bSlot ].ItemData.Money.uiMoneyAmount = uiMoneyLeft;
|
||||
// done!
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -541,19 +541,21 @@ BOOLEAN AddPlacementToWorld( SOLDIERINITNODE *curr, GROUP *pGroup = NULL )
|
||||
if (curr->pBasicPlacement->bBodyType == TANK_NW ||
|
||||
curr->pBasicPlacement->bBodyType == TANK_NE)
|
||||
{
|
||||
while (1)
|
||||
ROTTING_CORPSE *pCorpse;
|
||||
//while (1)
|
||||
do
|
||||
{
|
||||
ROTTING_CORPSE *pCorpse = GetCorpseAtGridNo( curr->pBasicPlacement->usStartingGridNo, 0); // I assume we don't find tanks on the roof
|
||||
pCorpse = GetCorpseAtGridNo( curr->pBasicPlacement->usStartingGridNo, 0); // I assume we don't find tanks on the roof
|
||||
if (pCorpse)
|
||||
{
|
||||
// Assume this is a dead tank and have the replacement tank haul it away
|
||||
RemoveCorpse( pCorpse->iID);
|
||||
}
|
||||
else
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
//else
|
||||
//{
|
||||
//break;
|
||||
//}
|
||||
} while (pCorpse);
|
||||
}
|
||||
|
||||
DebugMsg(TOPIC_JA2,DBG_LEVEL_3,String("AddPlacementToWorld: decide on placement"));
|
||||
|
||||
@@ -611,7 +611,7 @@ void MakeRemainingTerroristsTougher( void )
|
||||
|
||||
DeleteObj( &Object );
|
||||
Object.usItem = usNewItem;
|
||||
Object.bStatus[ 0 ] = 100;
|
||||
Object.ItemData.Generic.bStatus[ 0 ] = 100;
|
||||
|
||||
for ( ubLoop = 0; ubLoop < NUM_TERRORISTS; ubLoop++ )
|
||||
{
|
||||
@@ -745,7 +745,7 @@ void MakeRemainingAssassinsTougher( void )
|
||||
|
||||
DeleteObj( &Object );
|
||||
Object.usItem = usNewItem;
|
||||
Object.bStatus[ 0 ] = 100;
|
||||
Object.ItemData.Generic.bStatus[ 0 ] = 100;
|
||||
|
||||
for ( ubLoop = 0; ubLoop < NUM_ASSASSINS; ubLoop++ )
|
||||
{
|
||||
|
||||
@@ -144,7 +144,7 @@ void PickBurstLocations( SOLDIERTYPE *pSoldier )
|
||||
pSoldier->bDoAutofire++;
|
||||
sAPCosts = CalcTotalAPsToAttack( pSoldier, gsBurstLocations[0].sGridNo, TRUE, 0);
|
||||
}
|
||||
while(EnoughPoints( pSoldier, sAPCosts, 0, FALSE ) && pSoldier->inv[ pSoldier->ubAttackingHand ].ubGunShotsLeft >= pSoldier->bDoAutofire && gbNumBurstLocations >= pSoldier->bDoAutofire);
|
||||
while(EnoughPoints( pSoldier, sAPCosts, 0, FALSE ) && pSoldier->inv[ pSoldier->ubAttackingHand ].ItemData.Gun.ubGunShotsLeft >= pSoldier->bDoAutofire && gbNumBurstLocations >= pSoldier->bDoAutofire);
|
||||
pSoldier->bDoAutofire--;
|
||||
|
||||
ubShotsPerBurst = __min(pSoldier->bDoAutofire,MAX_BURST_SPREAD_TARGETS);
|
||||
|
||||
@@ -2742,10 +2742,10 @@ BOOLEAN AddDeadSoldierToUnLoadedSector( INT16 sMapX, INT16 sMapY, UINT8 bMapZ, S
|
||||
|
||||
if ( Item[pSoldier->inv[i].usItem].damageable ) // Madd: drop crappier items on higher difficulty levels
|
||||
{
|
||||
pSoldier->inv[i].bStatus[0] -= (gGameOptions.ubDifficultyLevel - 1) * Random(20);
|
||||
pSoldier->inv[i].bStatus[0] = max(pSoldier->inv[i].bStatus[0],1); // never below 1%
|
||||
pSoldier->inv[i].ItemData.Generic.bStatus[0] -= (gGameOptions.ubDifficultyLevel - 1) * Random(20);
|
||||
pSoldier->inv[i].ItemData.Generic.bStatus[0] = max(pSoldier->inv[i].ItemData.Generic.bStatus[0],1); // never below 1%
|
||||
}
|
||||
memcpy( &(pWorldItems[ bCount ].o), &pSoldier->inv[i], sizeof( OBJECTTYPE ) );
|
||||
pWorldItems[ bCount ].o = pSoldier->inv[i];
|
||||
bCount++;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2587,13 +2587,13 @@ void GetKeyboardInput( UINT32 *puiNewEvent )
|
||||
if (( Item[ gWorldItems[ uiLoop ].o.usItem ].usItemClass == IC_GUN ) && (gGameExternalOptions.gfShiftFUnloadWeapons == TRUE) )//item is a gun and unloading is allowed
|
||||
{
|
||||
//Remove magazine
|
||||
if ( (gWorldItems[ uiLoop ].o.usGunAmmoItem != NONE) && (gWorldItems[ uiLoop ].o.ubGunShotsLeft > 0) )
|
||||
if ( (gWorldItems[ uiLoop ].o.ItemData.Gun.usGunAmmoItem != NONE) && (gWorldItems[ uiLoop ].o.ItemData.Gun.ubGunShotsLeft > 0) )
|
||||
{
|
||||
OBJECTTYPE newObj; //Create object
|
||||
CreateItem(gWorldItems[ uiLoop ].o.usGunAmmoItem, 100, &newObj);
|
||||
newObj.ubShotsLeft[0] = gWorldItems[ uiLoop ].o.ubGunShotsLeft;
|
||||
gWorldItems[ uiLoop ].o.ubGunShotsLeft = 0;
|
||||
gWorldItems[ uiLoop ].o.usGunAmmoItem = NONE;
|
||||
CreateItem(gWorldItems[ uiLoop ].o.ItemData.Gun.usGunAmmoItem, 100, &newObj);
|
||||
newObj.ItemData.Ammo.ubShotsLeft[0] = gWorldItems[ uiLoop ].o.ItemData.Gun.ubGunShotsLeft;
|
||||
gWorldItems[ uiLoop ].o.ItemData.Gun.ubGunShotsLeft = 0;
|
||||
gWorldItems[ uiLoop ].o.ItemData.Gun.usGunAmmoItem = NONE;
|
||||
|
||||
// put it on the ground
|
||||
AddItemToPool( gWorldItems[ uiLoop ].sGridNo, &newObj, 1, gWorldItems[ uiLoop ].ubLevel, 0 , -1 );
|
||||
@@ -3103,10 +3103,10 @@ void GetKeyboardInput( UINT32 *puiNewEvent )
|
||||
tempStatus = pObj->bAttachStatus[bSlot3];
|
||||
// Replace helmet attachment with face slot
|
||||
pObj->usAttachItem[bSlot3] = pTeamSoldier->inv[bSlot1].usItem;
|
||||
pObj->bAttachStatus[bSlot3] = pTeamSoldier->inv[bSlot1].bStatus[0];
|
||||
pObj->bAttachStatus[bSlot3] = pTeamSoldier->inv[bSlot1].ItemData.Generic.bStatus[0];
|
||||
// Replace face slot with helmet attachment from temp
|
||||
pTeamSoldier->inv[bSlot1].usItem = tempItem;
|
||||
pTeamSoldier->inv[bSlot1].bStatus[0] = tempStatus;
|
||||
pTeamSoldier->inv[bSlot1].ItemData.Generic.bStatus[0] = tempStatus;
|
||||
}
|
||||
else if ( bSlot2 != ITEM_NOT_FOUND )
|
||||
{
|
||||
@@ -3146,10 +3146,10 @@ void GetKeyboardInput( UINT32 *puiNewEvent )
|
||||
tempStatus = pObj->bAttachStatus[bSlot3];
|
||||
// Replace helmet attachment with face slot
|
||||
pObj->usAttachItem[bSlot3] = pTeamSoldier->inv[bSlot1].usItem;
|
||||
pObj->bAttachStatus[bSlot3] = pTeamSoldier->inv[bSlot1].bStatus[0];
|
||||
pObj->bAttachStatus[bSlot3] = pTeamSoldier->inv[bSlot1].ItemData.Generic.bStatus[0];
|
||||
// Replace face slot with helmet attachment from temp
|
||||
pTeamSoldier->inv[bSlot1].usItem = tempItem;
|
||||
pTeamSoldier->inv[bSlot1].bStatus[0] = tempStatus;
|
||||
pTeamSoldier->inv[bSlot1].ItemData.Generic.bStatus[0] = tempStatus;
|
||||
}
|
||||
else if ( bSlot2 != ITEM_NOT_FOUND )
|
||||
{
|
||||
@@ -3302,7 +3302,7 @@ void GetKeyboardInput( UINT32 *puiNewEvent )
|
||||
{
|
||||
pGun = &(pTeamSoldier->inv[bLoop2]);
|
||||
//if magazine is not full
|
||||
if ( pGun->ubGunShotsLeft < GetMagSize( pGun ) )
|
||||
if ( pGun->ItemData.Gun.ubGunShotsLeft < GetMagSize( pGun ) )
|
||||
{
|
||||
|
||||
// Search for ammo in sector
|
||||
@@ -3317,12 +3317,12 @@ void GetKeyboardInput( UINT32 *puiNewEvent )
|
||||
if ( CompatibleAmmoForGun( pAmmo, pGun ) ) // can use the ammo with this gun
|
||||
{
|
||||
// same ammo type in gun and magazine
|
||||
if ( Magazine[Item[pGun->usGunAmmoItem].ubClassIndex].ubAmmoType == Magazine[Item[pAmmo->usItem].ubClassIndex].ubAmmoType )
|
||||
if ( Magazine[Item[pGun->ItemData.Gun.usGunAmmoItem].ubClassIndex].ubAmmoType == Magazine[Item[pAmmo->usItem].ubClassIndex].ubAmmoType )
|
||||
{
|
||||
ReloadGun( pTeamSoldier, pGun, pAmmo );
|
||||
}
|
||||
|
||||
if (pAmmo->ubShotsLeft[0] == 0)
|
||||
if (pAmmo->ItemData.Ammo.ubShotsLeft[0] == 0)
|
||||
{
|
||||
RemoveItemFromPool( gWorldItems[ uiLoop ].sGridNo, uiLoop, gWorldItems[ uiLoop ].ubLevel );
|
||||
}
|
||||
@@ -3353,7 +3353,7 @@ void GetKeyboardInput( UINT32 *puiNewEvent )
|
||||
pGun = &(pTeamSoldier->inv[HANDPOS]);
|
||||
|
||||
//magazine is not full
|
||||
if ( pGun->ubGunShotsLeft < GetMagSize( pGun ) )
|
||||
if ( pGun->ItemData.Gun.ubGunShotsLeft < GetMagSize( pGun ) )
|
||||
{
|
||||
AutoReload( pTeamSoldier );
|
||||
}
|
||||
@@ -3367,7 +3367,7 @@ void GetKeyboardInput( UINT32 *puiNewEvent )
|
||||
{
|
||||
pGun = &(pTeamSoldier->inv[bLoop2]);
|
||||
//if magazine is not full
|
||||
if ( pGun->ubGunShotsLeft < GetMagSize( pGun ) )
|
||||
if ( pGun->ItemData.Gun.ubGunShotsLeft < GetMagSize( pGun ) )
|
||||
{
|
||||
|
||||
// Search for ammo in soldier inventory
|
||||
@@ -3380,7 +3380,7 @@ void GetKeyboardInput( UINT32 *puiNewEvent )
|
||||
if ( CompatibleAmmoForGun( pAmmo, pGun ) ) // can use the ammo with this gun
|
||||
{
|
||||
// same ammo type in gun and magazine
|
||||
if ( Magazine[Item[pGun->usGunAmmoItem].ubClassIndex].ubAmmoType == Magazine[Item[pAmmo->usItem].ubClassIndex].ubAmmoType )
|
||||
if ( Magazine[Item[pGun->ItemData.Gun.usGunAmmoItem].ubClassIndex].ubAmmoType == Magazine[Item[pAmmo->usItem].ubClassIndex].ubAmmoType )
|
||||
{
|
||||
ReloadGun( pTeamSoldier, pGun, pAmmo );
|
||||
|
||||
@@ -4689,7 +4689,7 @@ void GrenadeTest1()
|
||||
{
|
||||
OBJECTTYPE Object;
|
||||
Object.usItem = MUSTARD_GRENADE;
|
||||
Object.bStatus[ 0 ] = 100;
|
||||
Object.ItemData.Generic.bStatus[ 0 ] = 100;
|
||||
Object.ubNumberOfObjects = 1;
|
||||
CreatePhysicalObject( &Object, 60, (FLOAT)(sX * CELL_X_SIZE), (FLOAT)(sY * CELL_Y_SIZE ), 256, -20, 20, 158, NOBODY, THROW_ARM_ITEM, 0, FALSE );
|
||||
}
|
||||
@@ -4703,7 +4703,7 @@ void GrenadeTest2()
|
||||
{
|
||||
OBJECTTYPE Object;
|
||||
Object.usItem = HAND_GRENADE;
|
||||
Object.bStatus[ 0 ] = 100;
|
||||
Object.ItemData.Generic.bStatus[ 0 ] = 100;
|
||||
Object.ubNumberOfObjects = 1;
|
||||
CreatePhysicalObject( &Object, 60, (FLOAT)(sX * CELL_X_SIZE), (FLOAT)(sY * CELL_Y_SIZE ), 256, 0, -30, 158, NOBODY, THROW_ARM_ITEM, 0, FALSE );
|
||||
}
|
||||
@@ -4717,7 +4717,7 @@ void GrenadeTest3()
|
||||
{
|
||||
OBJECTTYPE Object;
|
||||
Object.usItem = HAND_GRENADE;
|
||||
Object.bStatus[ 0 ] = 100;
|
||||
Object.ItemData.Generic.bStatus[ 0 ] = 100;
|
||||
Object.ubNumberOfObjects = 1;
|
||||
CreatePhysicalObject( &Object, 60, (FLOAT)(sX * CELL_X_SIZE), (FLOAT)(sY * CELL_Y_SIZE ), 256, -10, 10, 158, NOBODY, THROW_ARM_ITEM, 0, FALSE );
|
||||
}
|
||||
|
||||
@@ -381,13 +381,13 @@ UINT8 HandleActivatedTargetCursor( SOLDIERTYPE *pSoldier, UINT16 usMapPos, BOOLE
|
||||
pSoldier->bDoAutofire++;
|
||||
sAPCosts = CalcTotalAPsToAttack( pSoldier, usMapPos, TRUE, 0);
|
||||
}
|
||||
while(EnoughPoints( pSoldier, sAPCosts, 0, FALSE ) && sAPCosts == sCurAPCosts && pSoldier->inv[ pSoldier->ubAttackingHand ].ubGunShotsLeft >= pSoldier->bDoAutofire);
|
||||
while(EnoughPoints( pSoldier, sAPCosts, 0, FALSE ) && sAPCosts == sCurAPCosts && pSoldier->inv[ pSoldier->ubAttackingHand ].ItemData.Gun.ubGunShotsLeft >= pSoldier->bDoAutofire);
|
||||
pSoldier->bDoAutofire--;
|
||||
}
|
||||
|
||||
gfUIAutofireBulletCount = TRUE;
|
||||
gsBulletCount = pSoldier->bDoAutofire;
|
||||
gsTotalBulletCount = pSoldier->inv[ pSoldier->ubAttackingHand ].ubGunShotsLeft;
|
||||
gsTotalBulletCount = pSoldier->inv[ pSoldier->ubAttackingHand ].ItemData.Gun.ubGunShotsLeft;
|
||||
|
||||
if(pSoldier->autofireLastStep) //set the orange tint on the numbers if we at the last step
|
||||
gTintBulletCounts = TRUE;
|
||||
@@ -536,7 +536,7 @@ UINT8 HandleActivatedTargetCursor( SOLDIERTYPE *pSoldier, UINT16 usMapPos, BOOLE
|
||||
pSoldier->bDoAutofire++;
|
||||
sAPCosts = CalcTotalAPsToAttack( pSoldier, gsBurstLocations[0].sGridNo, TRUE, 0);
|
||||
}
|
||||
while(EnoughPoints( pSoldier, sAPCosts, 0, FALSE ) && pSoldier->inv[ pSoldier->ubAttackingHand ].ubGunShotsLeft >= pSoldier->bDoAutofire && gbNumBurstLocations >= pSoldier->bDoAutofire);
|
||||
while(EnoughPoints( pSoldier, sAPCosts, 0, FALSE ) && pSoldier->inv[ pSoldier->ubAttackingHand ].ItemData.Gun.ubGunShotsLeft >= pSoldier->bDoAutofire && gbNumBurstLocations >= pSoldier->bDoAutofire);
|
||||
pSoldier->bDoAutofire--;
|
||||
|
||||
gsCurrentActionPoints = CalcTotalAPsToAttack( pSoldier, gsBurstLocations[0].sGridNo, TRUE, 0 );
|
||||
@@ -2065,11 +2065,11 @@ void HandleRightClickAdjustCursor( SOLDIERTYPE *pSoldier, INT16 usMapPos )
|
||||
}
|
||||
|
||||
|
||||
if(pSoldier->inv[ pSoldier->ubAttackingHand ].ubGunShotsLeft > pSoldier->bDoAutofire )
|
||||
if(pSoldier->inv[ pSoldier->ubAttackingHand ].ItemData.Gun.ubGunShotsLeft > pSoldier->bDoAutofire )
|
||||
{
|
||||
//Calculate how many bullets we need to fire to add at least one more AP
|
||||
sAPCosts = sCurAPCosts = CalcTotalAPsToAttack( pSoldier, usMapPos, TRUE, 0);
|
||||
while(EnoughPoints( pSoldier, sAPCosts, 0, FALSE ) && sAPCosts <= sCurAPCosts && pSoldier->inv[ pSoldier->ubAttackingHand ].ubGunShotsLeft > pSoldier->bDoAutofire) //Increment the bullet count until we run out of APs or we spend the whole AP
|
||||
while(EnoughPoints( pSoldier, sAPCosts, 0, FALSE ) && sAPCosts <= sCurAPCosts && pSoldier->inv[ pSoldier->ubAttackingHand ].ItemData.Gun.ubGunShotsLeft > pSoldier->bDoAutofire) //Increment the bullet count until we run out of APs or we spend the whole AP
|
||||
{
|
||||
pSoldier->bDoAutofire++;
|
||||
sAPCosts = CalcTotalAPsToAttack( pSoldier, usMapPos, TRUE, 0);
|
||||
@@ -2084,7 +2084,7 @@ void HandleRightClickAdjustCursor( SOLDIERTYPE *pSoldier, INT16 usMapPos )
|
||||
pSoldier->bDoAutofire++;
|
||||
sAPCosts = CalcTotalAPsToAttack( pSoldier, usMapPos, TRUE, 0);
|
||||
}
|
||||
while(EnoughPoints( pSoldier, sAPCosts, 0, FALSE ) && sAPCosts == sCurAPCosts && pSoldier->inv[ pSoldier->ubAttackingHand ].ubGunShotsLeft >= pSoldier->bDoAutofire);
|
||||
while(EnoughPoints( pSoldier, sAPCosts, 0, FALSE ) && sAPCosts == sCurAPCosts && pSoldier->inv[ pSoldier->ubAttackingHand ].ItemData.Gun.ubGunShotsLeft >= pSoldier->bDoAutofire);
|
||||
pSoldier->bDoAutofire--;
|
||||
|
||||
sAPCosts = CalcTotalAPsToAttack( pSoldier, usMapPos, TRUE, 0);
|
||||
|
||||
+43
-43
@@ -961,7 +961,7 @@ INT32 EffectiveArmour( OBJECTTYPE * pObj )
|
||||
return( 0 );
|
||||
}
|
||||
iValue = Armour[ Item[pObj->usItem].ubClassIndex ].ubProtection;
|
||||
iValue = iValue * pObj->bStatus[0] * Armour[ Item[pObj->usItem].ubClassIndex ].ubCoverage / 10000;
|
||||
iValue = iValue * pObj->ItemData.Generic.bStatus[0] * Armour[ Item[pObj->usItem].ubClassIndex ].ubCoverage / 10000;
|
||||
|
||||
// bPlate = FindAttachment( pObj, CERAMIC_PLATES );
|
||||
bPlate = FindFirstArmourAttachment( pObj );
|
||||
@@ -1057,7 +1057,7 @@ INT32 ExplosiveEffectiveArmour( OBJECTTYPE * pObj )
|
||||
return( 0 );
|
||||
}
|
||||
iValue = Armour[ Item[pObj->usItem].ubClassIndex ].ubProtection;
|
||||
iValue = iValue * pObj->bStatus[0] * Armour[ Item[pObj->usItem].ubClassIndex ].ubCoverage / 10000;
|
||||
iValue = iValue * pObj->ItemData.Generic.bStatus[0] * Armour[ Item[pObj->usItem].ubClassIndex ].ubCoverage / 10000;
|
||||
if ( Item[pObj->usItem].flakjacket )
|
||||
{
|
||||
// increase value for flak jackets!
|
||||
@@ -1156,13 +1156,13 @@ BOOLEAN CheckForGunJam( SOLDIERTYPE * pSoldier )
|
||||
if ( Item[pSoldier->usAttackingWeapon].usItemClass == IC_GUN && !EXPLOSIVE_GUN( pSoldier->usAttackingWeapon ) )
|
||||
{
|
||||
pObj = &(pSoldier->inv[pSoldier->ubAttackingHand]);
|
||||
if (pObj->bGunAmmoStatus > 0)
|
||||
if (pObj->ItemData.Gun.bGunAmmoStatus > 0)
|
||||
{
|
||||
// gun might jam, figure out the chance
|
||||
//iChance = (80 - pObj->bGunStatus);
|
||||
|
||||
//rain
|
||||
iChance = (80 - pObj->bGunStatus) + gGameExternalOptions.ubWeaponReliabilityReductionPerRainIntensity * gbCurrentRainIntensity;
|
||||
iChance = (80 - pObj->ItemData.Gun.bGunStatus) + gGameExternalOptions.ubWeaponReliabilityReductionPerRainIntensity * gbCurrentRainIntensity;
|
||||
//end rain
|
||||
|
||||
|
||||
@@ -1198,7 +1198,7 @@ BOOLEAN CheckForGunJam( SOLDIERTYPE * pSoldier )
|
||||
gfNextFireJam = FALSE;
|
||||
|
||||
// jam! negate the gun ammo status.
|
||||
pObj->bGunAmmoStatus *= -1;
|
||||
pObj->ItemData.Gun.bGunAmmoStatus *= -1;
|
||||
|
||||
// Deduct AMMO!
|
||||
DeductAmmo( pSoldier, pSoldier->ubAttackingHand );
|
||||
@@ -1207,14 +1207,14 @@ BOOLEAN CheckForGunJam( SOLDIERTYPE * pSoldier )
|
||||
return( TRUE );
|
||||
}
|
||||
}
|
||||
else if (pObj->bGunAmmoStatus < 0)
|
||||
else if (pObj->ItemData.Gun.bGunAmmoStatus < 0)
|
||||
{
|
||||
// try to unjam gun
|
||||
iResult = SkillCheck( pSoldier, UNJAM_GUN_CHECK, (INT8) ((Item[pObj->usItem].bReliability + Item[pObj->usGunAmmoItem].bReliability)* 4) );
|
||||
iResult = SkillCheck( pSoldier, UNJAM_GUN_CHECK, (INT8) ((Item[pObj->usItem].bReliability + Item[pObj->ItemData.Gun.usGunAmmoItem].bReliability)* 4) );
|
||||
if (iResult > 0)
|
||||
{
|
||||
// yay! unjammed the gun
|
||||
pObj->bGunAmmoStatus *= -1;
|
||||
pObj->ItemData.Gun.bGunAmmoStatus *= -1;
|
||||
|
||||
// MECHANICAL/DEXTERITY GAIN: Unjammed a gun
|
||||
StatChange( pSoldier, MECHANAMT, 5, FALSE );
|
||||
@@ -1581,7 +1581,7 @@ BOOLEAN UseGun( SOLDIERTYPE *pSoldier , INT16 sTargetGridNo )
|
||||
else
|
||||
{
|
||||
// ONLY DEDUCT FOR THE FIRST HAND when doing two-pistol attacks
|
||||
if ( IsValidSecondHandShot( pSoldier ) && pSoldier->inv[ HANDPOS ].bGunStatus >= USABLE && pSoldier->inv[HANDPOS].bGunAmmoStatus > 0 )
|
||||
if ( IsValidSecondHandShot( pSoldier ) && pSoldier->inv[ HANDPOS ].ItemData.Gun.bGunStatus >= USABLE && pSoldier->inv[HANDPOS].ItemData.Gun.bGunAmmoStatus > 0 )
|
||||
{
|
||||
// only deduct APs when the main gun fires
|
||||
if ( pSoldier->ubAttackingHand == HANDPOS )
|
||||
@@ -1746,7 +1746,7 @@ BOOLEAN UseGun( SOLDIERTYPE *pSoldier , INT16 sTargetGridNo )
|
||||
DeductAmmo( pSoldier, pSoldier->ubAttackingHand );
|
||||
|
||||
// ATE: Check if we should say quote...
|
||||
if ( pSoldier->inv[ pSoldier->ubAttackingHand ].ubGunShotsLeft == 0 && !Item[pSoldier->usAttackingWeapon].rocketlauncher )
|
||||
if ( pSoldier->inv[ pSoldier->ubAttackingHand ].ItemData.Gun.ubGunShotsLeft == 0 && !Item[pSoldier->usAttackingWeapon].rocketlauncher )
|
||||
{
|
||||
if ( pSoldier->bTeam == gbPlayerNum )
|
||||
{
|
||||
@@ -1777,7 +1777,7 @@ BOOLEAN UseGun( SOLDIERTYPE *pSoldier , INT16 sTargetGridNo )
|
||||
// add base pts for taking a shot, whether it hits or misses
|
||||
usExpGain += 3;
|
||||
|
||||
if ( IsValidSecondHandShot( pSoldier ) && pSoldier->inv[ HANDPOS ].bGunStatus >= USABLE && pSoldier->inv[HANDPOS].bGunAmmoStatus > 0 )
|
||||
if ( IsValidSecondHandShot( pSoldier ) && pSoldier->inv[ HANDPOS ].ItemData.Gun.bGunStatus >= USABLE && pSoldier->inv[HANDPOS].ItemData.Gun.bGunAmmoStatus > 0 )
|
||||
{
|
||||
// reduce exp gain for two pistol shooting since both shots give xp
|
||||
usExpGain = (usExpGain * 2) / 3;
|
||||
@@ -1808,7 +1808,7 @@ BOOLEAN UseGun( SOLDIERTYPE *pSoldier , INT16 sTargetGridNo )
|
||||
|
||||
DebugMsg(TOPIC_JA2,DBG_LEVEL_3,String("UseGun: Muzzle flash = %d",pSoldier->fMuzzleFlash));
|
||||
|
||||
if ( AmmoTypes[pSoldier->inv[ pSoldier->ubAttackingHand ].ubGunAmmoType].numberOfBullets > 1 )
|
||||
if ( AmmoTypes[pSoldier->inv[ pSoldier->ubAttackingHand ].ItemData.Gun.ubGunAmmoType].numberOfBullets > 1 )
|
||||
fBuckshot = TRUE;
|
||||
|
||||
//switch ( pSoldier->inv[ pSoldier->ubAttackingHand ].ubGunAmmoType )
|
||||
@@ -1875,7 +1875,7 @@ BOOLEAN UseGun( SOLDIERTYPE *pSoldier , INT16 sTargetGridNo )
|
||||
{
|
||||
if ( Item[usItemNum].singleshotrocketlauncher )
|
||||
{
|
||||
CreateItem( Item[usItemNum].discardedlauncheritem , pSoldier->inv[ HANDPOS ].bStatus[ 0 ],&(pSoldier->inv[ HANDPOS ] ) );
|
||||
CreateItem( Item[usItemNum].discardedlauncheritem , pSoldier->inv[ HANDPOS ].ItemData.Generic.bStatus[ 0 ],&(pSoldier->inv[ HANDPOS ] ) );
|
||||
DirtyMercPanelInterface( pSoldier, DIRTYLEVEL2 );
|
||||
IgniteExplosion( pSoldier->ubID, (INT16)CenterX( pSoldier->sGridNo ), (INT16)CenterY( pSoldier->sGridNo ), 0, pSoldier->sGridNo, C1, pSoldier->bLevel );
|
||||
}
|
||||
@@ -1883,8 +1883,8 @@ BOOLEAN UseGun( SOLDIERTYPE *pSoldier , INT16 sTargetGridNo )
|
||||
{
|
||||
DebugMsg( TOPIC_JA2, DBG_LEVEL_3, String("StructureHit: RPG7 item: %d, Ammo: %d",pSoldier->inv[HANDPOS].usItem , pSoldier->inv[HANDPOS].usGunAmmoItem ) );
|
||||
|
||||
IgniteExplosion( pSoldier->ubID, (INT16)CenterX( pSoldier->sGridNo ), (INT16)CenterY( pSoldier->sGridNo ), 0, pSoldier->sGridNo, pSoldier->inv[pSoldier->ubAttackingHand ].usGunAmmoItem, pSoldier->bLevel );
|
||||
pSoldier->inv[pSoldier->ubAttackingHand ].usGunAmmoItem = NONE;
|
||||
IgniteExplosion( pSoldier->ubID, (INT16)CenterX( pSoldier->sGridNo ), (INT16)CenterY( pSoldier->sGridNo ), 0, pSoldier->sGridNo, pSoldier->inv[pSoldier->ubAttackingHand ].ItemData.Gun.usGunAmmoItem, pSoldier->bLevel );
|
||||
pSoldier->inv[pSoldier->ubAttackingHand ].ItemData.Gun.usGunAmmoItem = NONE;
|
||||
}
|
||||
// Reduce again for attack end 'cause it has been incremented for a normal attack
|
||||
//
|
||||
@@ -1912,7 +1912,7 @@ BOOLEAN UseGun( SOLDIERTYPE *pSoldier , INT16 sTargetGridNo )
|
||||
{
|
||||
if ( Item[usItemNum].singleshotrocketlauncher )
|
||||
{
|
||||
CreateItem( Item[usItemNum].discardedlauncheritem, pSoldier->inv[ HANDPOS ].bStatus[ 0 ], &(pSoldier->inv[ HANDPOS ] ) );
|
||||
CreateItem( Item[usItemNum].discardedlauncheritem, pSoldier->inv[ HANDPOS ].ItemData.Generic.bStatus[ 0 ], &(pSoldier->inv[ HANDPOS ] ) );
|
||||
DirtyMercPanelInterface( pSoldier, DIRTYLEVEL2 );
|
||||
}
|
||||
|
||||
@@ -1964,14 +1964,14 @@ BOOLEAN UseGun( SOLDIERTYPE *pSoldier , INT16 sTargetGridNo )
|
||||
if ( Item[usItemNum].usItemClass == IC_GUN )
|
||||
{
|
||||
OBJECTTYPE *pGun = &(pSoldier->inv[pSoldier->ubAttackingHand]);
|
||||
ammoReliability = Item[pGun->usGunAmmoItem].bReliability;
|
||||
ammoReliability = Item[pGun->ItemData.Gun.usGunAmmoItem].bReliability;
|
||||
}
|
||||
|
||||
uiDepreciateTest = BASIC_DEPRECIATE_CHANCE + 3 * (Item[ usItemNum ].bReliability + ammoReliability);
|
||||
|
||||
if ( !PreRandom( uiDepreciateTest ) && ( pSoldier->inv[ pSoldier->ubAttackingHand ].bStatus[0] > 1) )
|
||||
if ( !PreRandom( uiDepreciateTest ) && ( pSoldier->inv[ pSoldier->ubAttackingHand ].ItemData.Generic.bStatus[0] > 1) )
|
||||
{
|
||||
pSoldier->inv[ pSoldier->ubAttackingHand ].bStatus[ 0 ]--;
|
||||
pSoldier->inv[ pSoldier->ubAttackingHand ].ItemData.Generic.bStatus[ 0 ]--;
|
||||
}
|
||||
|
||||
// reduce monster smell (gunpowder smell)
|
||||
@@ -1982,7 +1982,7 @@ BOOLEAN UseGun( SOLDIERTYPE *pSoldier , INT16 sTargetGridNo )
|
||||
|
||||
//<SB> manual recharge
|
||||
if (Weapon[Item[usItemNum].ubClassIndex].APsToReloadManually > 0)
|
||||
pSoldier->inv[ pSoldier->ubAttackingHand ].ubGunState &= ~GS_CARTRIDGE_IN_CHAMBER;
|
||||
pSoldier->inv[ pSoldier->ubAttackingHand ].ItemData.Gun.ubGunState &= ~GS_CARTRIDGE_IN_CHAMBER;
|
||||
//<SB>
|
||||
DebugMsg(TOPIC_JA2,DBG_LEVEL_3,String("UseGun: done"));
|
||||
return( TRUE );
|
||||
@@ -2046,7 +2046,7 @@ BOOLEAN UseBlade( SOLDIERTYPE *pSoldier , INT16 sTargetGridNo )
|
||||
iImpact = HTHImpact( pSoldier, pTargetSoldier, (iHitChance - iDiceRoll), TRUE );
|
||||
|
||||
// modify this by the knife's condition (if it's dull, not much good)
|
||||
iImpact = ( iImpact * WEAPON_STATUS_MOD(pSoldier->inv[pSoldier->ubAttackingHand].bStatus[0]) ) / 100;
|
||||
iImpact = ( iImpact * WEAPON_STATUS_MOD(pSoldier->inv[pSoldier->ubAttackingHand].ItemData.Generic.bStatus[0]) ) / 100;
|
||||
|
||||
// modify by hit location
|
||||
AdjustImpactByHitLocation( iImpact, pSoldier->bAimShotLocation, &iImpact, &iImpactForCrits );
|
||||
@@ -2063,17 +2063,17 @@ BOOLEAN UseBlade( SOLDIERTYPE *pSoldier , INT16 sTargetGridNo )
|
||||
iImpact = 1;
|
||||
}
|
||||
|
||||
if ( pSoldier->inv[ pSoldier->ubAttackingHand ].bStatus[ 0 ] > USABLE )
|
||||
if ( pSoldier->inv[ pSoldier->ubAttackingHand ].ItemData.Generic.bStatus[ 0 ] > USABLE )
|
||||
{
|
||||
bMaxDrop = (iImpact / 20);
|
||||
|
||||
// the duller they get, the slower they get any worse...
|
||||
bMaxDrop = __min( bMaxDrop, pSoldier->inv[ pSoldier->ubAttackingHand ].bStatus[ 0 ] / 10 );
|
||||
bMaxDrop = __min( bMaxDrop, pSoldier->inv[ pSoldier->ubAttackingHand ].ItemData.Generic.bStatus[ 0 ] / 10 );
|
||||
|
||||
// as long as its still > USABLE, it drops another point 1/2 the time
|
||||
bMaxDrop = __max( bMaxDrop, 2 );
|
||||
|
||||
pSoldier->inv[ pSoldier->ubAttackingHand ].bStatus[ 0 ] -= (INT8) Random( bMaxDrop ); // 0 to (maxDrop - 1)
|
||||
pSoldier->inv[ pSoldier->ubAttackingHand ].ItemData.Generic.bStatus[ 0 ] -= (INT8) Random( bMaxDrop ); // 0 to (maxDrop - 1)
|
||||
}
|
||||
|
||||
// Send event for getting hit
|
||||
@@ -2775,7 +2775,7 @@ BOOLEAN DoSpecialEffectAmmoMiss( UINT8 ubAttackerID, INT16 sGridNo, INT16 sXPos,
|
||||
UINT8 ubAmmoType;
|
||||
UINT16 usItem;
|
||||
|
||||
ubAmmoType = MercPtrs[ ubAttackerID ]->inv[ MercPtrs[ ubAttackerID ]->ubAttackingHand ].ubGunAmmoType;
|
||||
ubAmmoType = MercPtrs[ ubAttackerID ]->inv[ MercPtrs[ ubAttackerID ]->ubAttackingHand ].ItemData.Gun.ubGunAmmoType;
|
||||
usItem = MercPtrs[ ubAttackerID ]->inv[ MercPtrs[ ubAttackerID ]->ubAttackingHand ].usItem;
|
||||
|
||||
memset( &AniParams, 0, sizeof( ANITILE_PARAMS ) );
|
||||
@@ -2938,14 +2938,14 @@ void WeaponHit( UINT16 usSoldierID, UINT16 usWeaponIndex, INT16 sDamage, INT16 s
|
||||
MakeNoise( ubAttackerID, pTargetSoldier->sGridNo, pTargetSoldier->bLevel, gpWorldLevelData[pTargetSoldier->sGridNo].ubTerrainID, Weapon[ usWeaponIndex ].ubHitVolume, NOISE_BULLET_IMPACT );
|
||||
|
||||
// CALLAHAN START BUGFIX
|
||||
if ( EXPLOSIVE_GUN( usWeaponIndex ) || AmmoTypes[pSoldier->inv[pSoldier->ubAttackingHand ].ubGunAmmoType].explosionSize > 1)
|
||||
if ( EXPLOSIVE_GUN( usWeaponIndex ) || AmmoTypes[pSoldier->inv[pSoldier->ubAttackingHand ].ItemData.Gun.ubGunAmmoType].explosionSize > 1)
|
||||
// CALLAHAN END BUGFIX
|
||||
{
|
||||
// Reduce attacker count!
|
||||
//TODO: Madd --- I don't think this code will ever get called for the HE ammo -- the EXPLOSIVE_GUN check filters out regular guns
|
||||
// marke test mag ammo type: pSoldier->inv[pSoldier->ubAttackingHand ].ubGunAmmoType
|
||||
// 2cond 'or' added
|
||||
if ( Item[usWeaponIndex].rocketlauncher || AmmoTypes[pSoldier->inv[pSoldier->ubAttackingHand ].ubGunAmmoType].explosionSize > 1 )
|
||||
if ( Item[usWeaponIndex].rocketlauncher || AmmoTypes[pSoldier->inv[pSoldier->ubAttackingHand ].ItemData.Gun.ubGunAmmoType].explosionSize > 1 )
|
||||
{
|
||||
if ( Item[usWeaponIndex].singleshotrocketlauncher )
|
||||
{
|
||||
@@ -2956,13 +2956,13 @@ void WeaponHit( UINT16 usSoldierID, UINT16 usWeaponIndex, INT16 sDamage, INT16 s
|
||||
{
|
||||
DebugMsg( TOPIC_JA2, DBG_LEVEL_3, String("WeaponHit: RPG7 item: %d, Ammo: %d",pSoldier->inv[HANDPOS].usItem , pSoldier->inv[HANDPOS].usGunAmmoItem ) );
|
||||
|
||||
IgniteExplosion( ubAttackerID, sXPos, sYPos, 0, (INT16) (GETWORLDINDEXFROMWORLDCOORDS( sYPos, sXPos )), pSoldier->inv[pSoldier->ubAttackingHand ].usGunAmmoItem, pTargetSoldier->bLevel );
|
||||
pSoldier->inv[pSoldier->ubAttackingHand ].usGunAmmoItem = NONE;
|
||||
IgniteExplosion( ubAttackerID, sXPos, sYPos, 0, (INT16) (GETWORLDINDEXFROMWORLDCOORDS( sYPos, sXPos )), pSoldier->inv[pSoldier->ubAttackingHand ].ItemData.Gun.usGunAmmoItem, pTargetSoldier->bLevel );
|
||||
pSoldier->inv[pSoldier->ubAttackingHand ].ItemData.Gun.usGunAmmoItem = NONE;
|
||||
}
|
||||
else if ( AmmoTypes[pSoldier->inv[pSoldier->ubAttackingHand ].ubGunAmmoType].explosionSize > 1)
|
||||
else if ( AmmoTypes[pSoldier->inv[pSoldier->ubAttackingHand ].ItemData.Gun.ubGunAmmoType].explosionSize > 1)
|
||||
{
|
||||
// re-routed the Highexplosive value to define exposion type
|
||||
IgniteExplosion( ubAttackerID, sXPos, sYPos, 0, (INT16) (GETWORLDINDEXFROMWORLDCOORDS( sYPos, sXPos )), AmmoTypes[pSoldier->inv[pSoldier->ubAttackingHand ].ubGunAmmoType].highExplosive , pTargetSoldier->bLevel );
|
||||
IgniteExplosion( ubAttackerID, sXPos, sYPos, 0, (INT16) (GETWORLDINDEXFROMWORLDCOORDS( sYPos, sXPos )), AmmoTypes[pSoldier->inv[pSoldier->ubAttackingHand ].ItemData.Gun.ubGunAmmoType].highExplosive , pTargetSoldier->bLevel );
|
||||
// pSoldier->inv[pSoldier->ubAttackingHand ].usGunAmmoItem = NONE;
|
||||
}
|
||||
}
|
||||
@@ -3064,7 +3064,7 @@ void StructureHit( INT32 iBullet, UINT16 usWeaponIndex, INT8 bWeaponStatus, UINT
|
||||
// Get attacker
|
||||
pSoldier = MercPtrs[ ubAttackerID ];
|
||||
// marke added one 'or' to get this working with HE ammo
|
||||
if ( Item[usWeaponIndex].rocketlauncher || AmmoTypes[pSoldier->inv[pSoldier->ubAttackingHand ].ubGunAmmoType].explosionSize > 1)
|
||||
if ( Item[usWeaponIndex].rocketlauncher || AmmoTypes[pSoldier->inv[pSoldier->ubAttackingHand ].ItemData.Gun.ubGunAmmoType].explosionSize > 1)
|
||||
{
|
||||
// Reduce attacker count!
|
||||
DebugMsg( TOPIC_JA2, DBG_LEVEL_3, String("@@@@@@@ Freeing up attacker - end of LAW fire") );
|
||||
@@ -3077,13 +3077,13 @@ void StructureHit( INT32 iBullet, UINT16 usWeaponIndex, INT8 bWeaponStatus, UINT
|
||||
else if ( !Item[usWeaponIndex].singleshotrocketlauncher && Item[usWeaponIndex].rocketlauncher)
|
||||
{
|
||||
DebugMsg( TOPIC_JA2, DBG_LEVEL_3, String("StructureHit: RPG7 item: %d, Ammo: %d",pAttacker->inv[HANDPOS].usItem , pAttacker->inv[HANDPOS].usGunAmmoItem ) );
|
||||
IgniteExplosion( ubAttackerID, (INT16)CenterX( sGridNo ), (INT16)CenterY( sGridNo ), 0, sGridNo, pAttacker->inv[pAttacker->ubAttackingHand ].usGunAmmoItem , (INT8)( sZPos >= WALL_HEIGHT ) );
|
||||
pAttacker->inv[pAttacker->ubAttackingHand ].usGunAmmoItem = NONE;
|
||||
IgniteExplosion( ubAttackerID, (INT16)CenterX( sGridNo ), (INT16)CenterY( sGridNo ), 0, sGridNo, pAttacker->inv[pAttacker->ubAttackingHand ].ItemData.Gun.usGunAmmoItem , (INT8)( sZPos >= WALL_HEIGHT ) );
|
||||
pAttacker->inv[pAttacker->ubAttackingHand ].ItemData.Gun.usGunAmmoItem = NONE;
|
||||
}
|
||||
else if ( AmmoTypes[pSoldier->inv[pSoldier->ubAttackingHand ].ubGunAmmoType].explosionSize > 1)
|
||||
else if ( AmmoTypes[pSoldier->inv[pSoldier->ubAttackingHand ].ItemData.Gun.ubGunAmmoType].explosionSize > 1)
|
||||
{
|
||||
// re-routed the Highexplosive value to define exposion type
|
||||
IgniteExplosion( ubAttackerID, (INT16)CenterX( sGridNo ), (INT16)CenterY( sGridNo ), 0, sGridNo, AmmoTypes[pSoldier->inv[pSoldier->ubAttackingHand ].ubGunAmmoType].highExplosive , (INT8)( sZPos >= WALL_HEIGHT ) );
|
||||
IgniteExplosion( ubAttackerID, (INT16)CenterX( sGridNo ), (INT16)CenterY( sGridNo ), 0, sGridNo, AmmoTypes[pSoldier->inv[pSoldier->ubAttackingHand ].ItemData.Gun.ubGunAmmoType].highExplosive , (INT8)( sZPos >= WALL_HEIGHT ) );
|
||||
// pSoldier->inv[pSoldier->ubAttackingHand ].usGunAmmoItem = NONE;
|
||||
}
|
||||
|
||||
@@ -3492,7 +3492,7 @@ UINT32 CalcChanceToHitGun(SOLDIERTYPE *pSoldier, UINT16 sGridNo, UINT8 ubAimTime
|
||||
usInHand = pSoldier->usAttackingWeapon;
|
||||
|
||||
// DETERMINE BASE CHANCE OF HITTING
|
||||
iGunCondition = WEAPON_STATUS_MOD( pInHand->bGunStatus );
|
||||
iGunCondition = WEAPON_STATUS_MOD( pInHand->ItemData.Gun.bGunStatus );
|
||||
|
||||
if (Item[usInHand].rocketlauncher )
|
||||
{
|
||||
@@ -4309,8 +4309,8 @@ INT32 TotalArmourProtection( SOLDIERTYPE *pFirer, SOLDIERTYPE * pTarget, UINT8 u
|
||||
// if the plate didn't stop the bullet...
|
||||
if ( iImpact > iTotalProtection )
|
||||
{
|
||||
iTotalProtection += ArmourProtection( pTarget, Item[pArmour->usItem].ubClassIndex, &(pArmour->bStatus[0]), iImpact, ubAmmoType, &plateHit );
|
||||
if ( pArmour->bStatus[ 0 ] < USABLE )
|
||||
iTotalProtection += ArmourProtection( pTarget, Item[pArmour->usItem].ubClassIndex, &(pArmour->ItemData.Generic.bStatus[0]), iImpact, ubAmmoType, &plateHit );
|
||||
if ( pArmour->ItemData.Generic.bStatus[ 0 ] < USABLE )
|
||||
{
|
||||
//Madd: put any attachments that someone might have added to the armour in the merc's inventory
|
||||
for (int bLoop = 0; bLoop < MAX_ATTACHMENTS; bLoop++)
|
||||
@@ -4348,7 +4348,7 @@ INT32 BulletImpact( SOLDIERTYPE *pFirer, SOLDIERTYPE * pTarget, UINT8 ubHitLocat
|
||||
}
|
||||
else
|
||||
{
|
||||
ubAmmoType = pFirer->inv[pFirer->ubAttackingHand].ubGunAmmoType;
|
||||
ubAmmoType = pFirer->inv[pFirer->ubAttackingHand].ItemData.Gun.ubGunAmmoType;
|
||||
}
|
||||
|
||||
if ( TANK( pTarget ) )
|
||||
@@ -5198,7 +5198,7 @@ void ReloadWeapon( SOLDIERTYPE *pSoldier, UINT8 ubHandPos )
|
||||
|
||||
if ( pSoldier->inv[ ubHandPos ].usItem != NOTHING )
|
||||
{
|
||||
pSoldier->inv[ ubHandPos ].ubGunShotsLeft = GetMagSize(&pSoldier->inv[ ubHandPos ]);
|
||||
pSoldier->inv[ ubHandPos ].ItemData.Gun.ubGunShotsLeft = GetMagSize(&pSoldier->inv[ ubHandPos ]);
|
||||
// Dirty Bars
|
||||
DirtyMercPanelInterface( pSoldier, DIRTYLEVEL1 );
|
||||
}
|
||||
@@ -5536,7 +5536,7 @@ UINT32 CalcThrownChanceToHit(SOLDIERTYPE *pSoldier, INT16 sGridNo, UINT8 ubAimTi
|
||||
// if iChance exists, but it's a mechanical item being used
|
||||
if ((iChance > 0) && (Item[ usHandItem ].usItemClass == IC_LAUNCHER ))
|
||||
// reduce iChance to hit DIRECTLY by the item's working condition
|
||||
iChance = (iChance * WEAPON_STATUS_MOD(pSoldier->inv[HANDPOS].bStatus[0])) / 100;
|
||||
iChance = (iChance * WEAPON_STATUS_MOD(pSoldier->inv[HANDPOS].ItemData.Generic.bStatus[0])) / 100;
|
||||
|
||||
// MAKE SURE CHANCE TO HIT IS WITHIN DEFINED LIMITS
|
||||
if (iChance < MINCHANCETOHIT)
|
||||
@@ -5659,7 +5659,7 @@ BOOLEAN WillExplosiveWeaponFail( SOLDIERTYPE *pSoldier, OBJECTTYPE *pObj )
|
||||
{
|
||||
if ( pSoldier->bTeam == gbPlayerNum || pSoldier->bVisible == 1 )
|
||||
{
|
||||
if ( (INT8)(PreRandom( 40 ) + PreRandom( 40 ) ) > pObj->bStatus[0] )
|
||||
if ( (INT8)(PreRandom( 40 ) + PreRandom( 40 ) ) > pObj->ItemData.Generic.bStatus[0] )
|
||||
{
|
||||
// Do second dice roll
|
||||
if ( PreRandom( 2 ) == 1 )
|
||||
|
||||
@@ -162,12 +162,12 @@ void FindPanicBombsAndTriggers( void )
|
||||
if (gWorldBombs[ uiBombIndex ].fExists)
|
||||
{
|
||||
pObj = &(gWorldItems[ gWorldBombs[ uiBombIndex ].iItemIndex ].o);
|
||||
if (pObj->bFrequency == PANIC_FREQUENCY || pObj->bFrequency == PANIC_FREQUENCY_2 || pObj->bFrequency == PANIC_FREQUENCY_3 )
|
||||
if (pObj->ItemData.Trigger.BombTrigger.bFrequency == PANIC_FREQUENCY || pObj->ItemData.Trigger.BombTrigger.bFrequency == PANIC_FREQUENCY_2 || pObj->ItemData.Trigger.BombTrigger.bFrequency == PANIC_FREQUENCY_3 )
|
||||
{
|
||||
if (pObj->usItem == SWITCH)
|
||||
{
|
||||
sGridNo = gWorldItems[ gWorldBombs[ uiBombIndex ].iItemIndex ].sGridNo;
|
||||
switch( pObj->bFrequency )
|
||||
switch( pObj->ItemData.Trigger.BombTrigger.bFrequency )
|
||||
{
|
||||
case PANIC_FREQUENCY:
|
||||
bPanicIndex = 0;
|
||||
@@ -205,7 +205,7 @@ void FindPanicBombsAndTriggers( void )
|
||||
}
|
||||
|
||||
gTacticalStatus.sPanicTriggerGridNo[ bPanicIndex ] = sGridNo;
|
||||
gTacticalStatus.ubPanicTolerance[ bPanicIndex ] = pObj->ubTolerance;
|
||||
gTacticalStatus.ubPanicTolerance[ bPanicIndex ] = pObj->ItemData.Trigger.Area.ubTolerance;
|
||||
if (pObj->fFlags & OBJECT_ALARM_TRIGGER)
|
||||
{
|
||||
gTacticalStatus.bPanicTriggerIsAlarm[ bPanicIndex ] = TRUE;
|
||||
@@ -466,11 +466,11 @@ void LoadWorldItemsFromMap( INT8 **hBuffer )
|
||||
}
|
||||
if( dummyItem.o.usItem == ACTION_ITEM && gfLoadPitsWithoutArming )
|
||||
{ //if we are loading a pit, they are typically loaded without being armed.
|
||||
if( dummyItem.o.bActionValue == ACTION_ITEM_SMALL_PIT || dummyItem.o.bActionValue == ACTION_ITEM_LARGE_PIT )
|
||||
if( dummyItem.o.ItemData.Trigger.bActionValue == ACTION_ITEM_SMALL_PIT || dummyItem.o.ItemData.Trigger.bActionValue == ACTION_ITEM_LARGE_PIT )
|
||||
{
|
||||
dummyItem.usFlags &= ~WORLD_ITEM_ARMED_BOMB;
|
||||
dummyItem.bVisible = BURIED;
|
||||
dummyItem.o.bDetonatorType = 0;
|
||||
dummyItem.o.ItemData.Trigger.bDetonatorType = 0;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -519,11 +519,11 @@ void DeleteWorldItemsBelongingToTerroristsWhoAreNotThere( void )
|
||||
if ( gWorldItems[ uiLoop ].fExists && gWorldItems[ uiLoop ].o.usItem == OWNERSHIP )
|
||||
{
|
||||
// if owner is a terrorist
|
||||
if ( IsProfileATerrorist( gWorldItems[ uiLoop ].o.ubOwnerProfile ) )
|
||||
if ( IsProfileATerrorist( gWorldItems[ uiLoop ].o.ItemData.Owner.ubOwnerProfile ) )
|
||||
{
|
||||
// and they were not set in the current sector
|
||||
if ( gMercProfiles[ gWorldItems[ uiLoop ].o.ubOwnerProfile ].sSectorX != gWorldSectorX ||
|
||||
gMercProfiles[ gWorldItems[ uiLoop ].o.ubOwnerProfile ].sSectorY != gWorldSectorY )
|
||||
if ( gMercProfiles[ gWorldItems[ uiLoop ].o.ItemData.Owner.ubOwnerProfile ].sSectorX != gWorldSectorX ||
|
||||
gMercProfiles[ gWorldItems[ uiLoop ].o.ItemData.Owner.ubOwnerProfile ].sSectorY != gWorldSectorY )
|
||||
{
|
||||
// then all items in this location should be deleted
|
||||
sGridNo = gWorldItems[ uiLoop ].sGridNo;
|
||||
@@ -563,7 +563,7 @@ void DeleteWorldItemsBelongingToQueenIfThere( void )
|
||||
if ( gWorldItems[ uiLoop ].fExists && gWorldItems[ uiLoop ].o.usItem == OWNERSHIP )
|
||||
{
|
||||
// if owner is the Queen
|
||||
if ( gWorldItems[ uiLoop ].o.ubOwnerProfile == QUEEN )
|
||||
if ( gWorldItems[ uiLoop ].o.ItemData.Owner.ubOwnerProfile == QUEEN )
|
||||
{
|
||||
// then all items in this location should be deleted
|
||||
sGridNo = gWorldItems[ uiLoop ].sGridNo;
|
||||
|
||||
@@ -142,7 +142,7 @@ void HandleBulletSpecialFlags( INT32 iBulletIndex )
|
||||
else if ( pBullet->usFlags & ( BULLET_FLAG_KNIFE ) )
|
||||
{
|
||||
strcpy( AniParams.zCachedFile, "TILECACHE\\KNIFING.STI" );
|
||||
pBullet->ubItemStatus = pBullet->pFirer->inv[ HANDPOS ].bStatus[0];
|
||||
pBullet->ubItemStatus = pBullet->pFirer->inv[ HANDPOS ].ItemData.Generic.bStatus[0];
|
||||
}
|
||||
|
||||
// Get direction to use for this guy....
|
||||
|
||||
@@ -4392,36 +4392,36 @@ void WriteQuantityAndAttachments( OBJECTTYPE *pObject, INT32 yp )
|
||||
CHAR16 str[50];
|
||||
CHAR16 temp[5];
|
||||
UINT8 i;
|
||||
swprintf( str, L"Clips: %d (%d", pObject->ubNumberOfObjects, pObject->bStatus[0] );
|
||||
swprintf( str, L"Clips: %d (%d", pObject->ubNumberOfObjects, pObject->ItemData.Generic.bStatus[0] );
|
||||
for( i = 1; i < pObject->ubNumberOfObjects; i++ )
|
||||
{
|
||||
swprintf( temp, L", %d", pObject->bStatus[0] );
|
||||
swprintf( temp, L", %d", pObject->ItemData.Generic.bStatus[0] );
|
||||
wcscat( str, temp );
|
||||
}
|
||||
wcscat( str, L")" );
|
||||
gprintf( 320, yp, str );
|
||||
}
|
||||
else
|
||||
gprintf( 320, yp, L"%d rounds", pObject->bStatus[0] );
|
||||
gprintf( 320, yp, L"%d rounds", pObject->ItemData.Generic.bStatus[0] );
|
||||
return;
|
||||
}
|
||||
if( pObject->ubNumberOfObjects > 1 && fAttachments )
|
||||
{ //everything
|
||||
gprintf( 320, yp, L"%d%% Qty: %d %s",
|
||||
pObject->bStatus[0], pObject->ubNumberOfObjects, szAttach );
|
||||
pObject->ItemData.Generic.bStatus[0], pObject->ubNumberOfObjects, szAttach );
|
||||
}
|
||||
else if( pObject->ubNumberOfObjects > 1 )
|
||||
{ //condition and quantity
|
||||
gprintf( 320, yp, L"%d%% Qty: %d ",
|
||||
pObject->bStatus[0], pObject->ubNumberOfObjects );
|
||||
pObject->ItemData.Generic.bStatus[0], pObject->ubNumberOfObjects );
|
||||
}
|
||||
else if( fAttachments )
|
||||
{ //condition and attachments
|
||||
gprintf( 320, yp, L"%d%% %s", pObject->bStatus[0], szAttach );
|
||||
gprintf( 320, yp, L"%d%% %s", pObject->ItemData.Generic.bStatus[0], szAttach );
|
||||
}
|
||||
else
|
||||
{ //condition
|
||||
gprintf( 320, yp, L"%d%%", pObject->bStatus[0] );
|
||||
gprintf( 320, yp, L"%d%%", pObject->ItemData.Generic.bStatus[0] );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user