mirror of
https://github.com/1dot13/source.git
synced 2026-09-09 14:46:05 +02:00
Merged revision(s) 6826-6828 from branches/ja2_source_official_2014:
- Minor code improvements and cleanup - Fix from r6775 is no longer necessary. - Code improvement: Instead of calling inv.size() repeatedly, just call it once and remember that value git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@6829 3b4a5df2-a311-0410-b5c6-a8a6f20db521
This commit is contained in:
@@ -1585,12 +1585,13 @@ BOOLEAN DisplayMercsInventory(UINT8 ubMercID)
|
|||||||
|
|
||||||
//tais: disable Weaponbox Mouseregions to stop crashing when changing kit selection and hovering over item
|
//tais: disable Weaponbox Mouseregions to stop crashing when changing kit selection and hovering over item
|
||||||
//tooltips for weaponbox
|
//tooltips for weaponbox
|
||||||
for(i=0;i<WEAPONBOX_TOTAL_ITEMS;i++)
|
for(i=0;i<WEAPONBOX_TOTAL_ITEMS; ++i)
|
||||||
{
|
{
|
||||||
MSYS_DisableRegion(&gWeaponboxFasthelpRegion[i]);
|
MSYS_DisableRegion(&gWeaponboxFasthelpRegion[i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
for(i=0; i<gMercProfiles[ubMercID].inv.size(); i++)
|
UINT8 invsize = gMercProfiles[ubMercID].inv.size();
|
||||||
|
for(i=0; i<invsize; ++i)
|
||||||
{
|
{
|
||||||
usItem = gMercProfiles[ubMercID].inv[ i ];
|
usItem = gMercProfiles[ubMercID].inv[ i ];
|
||||||
|
|
||||||
@@ -1665,7 +1666,8 @@ BOOLEAN DisplayMercsInventory(UINT8 ubMercID)
|
|||||||
PosX = WEAPONBOX_X+3; // + 3 ( 1 to take care of the shadow, +2 to get past the weapon box border )
|
PosX = WEAPONBOX_X+3; // + 3 ( 1 to take care of the shadow, +2 to get past the weapon box border )
|
||||||
PosY = WEAPONBOX_Y;
|
PosY = WEAPONBOX_Y;
|
||||||
|
|
||||||
for(i=0; i<gMercProfiles[ubMercID].inv.size(); i++)
|
UINT8 invsize = gMercProfiles[ubMercID].inv.size();
|
||||||
|
for(i=0; i<invsize; ++i)
|
||||||
{
|
{
|
||||||
usItem = gMercProfiles[ubMercID].inv[ i ];
|
usItem = gMercProfiles[ubMercID].inv[ i ];
|
||||||
|
|
||||||
@@ -5930,7 +5932,8 @@ void WeaponKitSelectionUpdate(UINT8 selectedInventory = 0)
|
|||||||
gMercProfiles[gbCurrentSoldier].bMainGunAttractiveness = -1;
|
gMercProfiles[gbCurrentSoldier].bMainGunAttractiveness = -1;
|
||||||
gMercProfiles[gbCurrentSoldier].bArmourAttractiveness = -1;
|
gMercProfiles[gbCurrentSoldier].bArmourAttractiveness = -1;
|
||||||
|
|
||||||
for ( uiLoop = 0; uiLoop < gMercProfiles[gbCurrentSoldier].inv.size(); uiLoop++ )
|
UINT32 invsize = gMercProfiles[ gbCurrentSoldier ].inv.size();
|
||||||
|
for ( uiLoop = 0; uiLoop < invsize; ++uiLoop )
|
||||||
{
|
{
|
||||||
usItem = gMercProfiles[gbCurrentSoldier].inv[ uiLoop ];
|
usItem = gMercProfiles[gbCurrentSoldier].inv[ uiLoop ];
|
||||||
|
|
||||||
@@ -5959,7 +5962,8 @@ void WeaponKitSelectionUpdate(UINT8 selectedInventory = 0)
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
UINT16 tempGearCost = 0;
|
UINT16 tempGearCost = 0;
|
||||||
for ( uiLoop = 0; uiLoop< gMercProfiles[ gbCurrentSoldier ].inv.size(); uiLoop++ )
|
UINT32 invsize = gMercProfiles[ gbCurrentSoldier ].inv.size();
|
||||||
|
for ( uiLoop = 0; uiLoop< invsize; ++uiLoop )
|
||||||
{
|
{
|
||||||
if ( gMercProfiles[ gbCurrentSoldier ].inv[ uiLoop ] != NOTHING )
|
if ( gMercProfiles[ gbCurrentSoldier ].inv[ uiLoop ] != NOTHING )
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -3648,14 +3648,14 @@ UINT8 CheckPlayersInventoryForGunMatchingGivenAmmoID( INT16 sItemID )
|
|||||||
UINT8 ubFirstID = gTacticalStatus.Team[ OUR_TEAM ].bFirstID;
|
UINT8 ubFirstID = gTacticalStatus.Team[ OUR_TEAM ].bFirstID;
|
||||||
UINT8 ubLastID = gTacticalStatus.Team[ OUR_TEAM ].bLastID;
|
UINT8 ubLastID = gTacticalStatus.Team[ OUR_TEAM ].bLastID;
|
||||||
|
|
||||||
|
|
||||||
//loop through all the mercs on the team
|
//loop through all the mercs on the team
|
||||||
for( ubMercCount = ubFirstID; ubMercCount <= ubLastID; ubMercCount++ )
|
for( ubMercCount = ubFirstID; ubMercCount <= ubLastID; ++ubMercCount )
|
||||||
{
|
{
|
||||||
if( Menptr[ ubMercCount ].bActive )
|
if( Menptr[ ubMercCount ].bActive )
|
||||||
{
|
{
|
||||||
//loop through all the pockets on the merc
|
//loop through all the pockets on the merc
|
||||||
for( ubPocketCount=0; ubPocketCount<Menptr[ ubMercCount ].inv.size(); ubPocketCount++)
|
UINT8 invsize = Menptr[ ubMercCount ].inv.size();
|
||||||
|
for( ubPocketCount=0; ubPocketCount<invsize; ++ubPocketCount)
|
||||||
{
|
{
|
||||||
//if there is a weapon here
|
//if there is a weapon here
|
||||||
if( Item[ Menptr[ ubMercCount ].inv[ ubPocketCount ].usItem ].usItemClass == IC_GUN )
|
if( Item[ Menptr[ ubMercCount ].inv[ ubPocketCount ].usItem ].usItemClass == IC_GUN )
|
||||||
@@ -3663,7 +3663,7 @@ UINT8 CheckPlayersInventoryForGunMatchingGivenAmmoID( INT16 sItemID )
|
|||||||
//if the weapon uses the same kind of ammo as the one passed in, return true
|
//if the weapon uses the same kind of ammo as the one passed in, return true
|
||||||
if( Weapon[ Menptr[ ubMercCount ].inv[ ubPocketCount ].usItem ].ubCalibre == Magazine[ Item[ sItemID ].ubClassIndex ].ubCalibre )
|
if( Weapon[ Menptr[ ubMercCount ].inv[ ubPocketCount ].usItem ].ubCalibre == Magazine[ Item[ sItemID ].ubClassIndex ].ubCalibre )
|
||||||
{
|
{
|
||||||
ubItemCount++;
|
++ubItemCount;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1622,7 +1622,8 @@ BOOLEAN DisplayMERCMercsInventory(UINT8 ubMercID)
|
|||||||
MSYS_DisableRegion(&gMercWeaponboxFasthelpRegion[i]);
|
MSYS_DisableRegion(&gMercWeaponboxFasthelpRegion[i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
for(i=0; i<gMercProfiles[ubMercID].inv.size(); i++)
|
UINT8 invsize = gMercProfiles[ ubMercID ].inv.size();
|
||||||
|
for(i=0; i<invsize; ++i)
|
||||||
{
|
{
|
||||||
usItem = gMercProfiles[ubMercID].inv[ i ];
|
usItem = gMercProfiles[ubMercID].inv[ i ];
|
||||||
|
|
||||||
@@ -1807,7 +1808,8 @@ void MercWeaponKitSelectionUpdate(UINT8 selectedInventory)
|
|||||||
gMercProfiles[ubMercID].bMainGunAttractiveness = -1;
|
gMercProfiles[ubMercID].bMainGunAttractiveness = -1;
|
||||||
gMercProfiles[ubMercID].bArmourAttractiveness = -1;
|
gMercProfiles[ubMercID].bArmourAttractiveness = -1;
|
||||||
|
|
||||||
for ( uiLoop = 0; uiLoop < gMercProfiles[ubMercID].inv.size(); uiLoop++ )
|
UINT32 invsize = gMercProfiles[ ubMercID ].inv.size();
|
||||||
|
for ( uiLoop = 0; uiLoop < invsize; ++uiLoop )
|
||||||
{
|
{
|
||||||
usItem = gMercProfiles[ubMercID].inv[ uiLoop ];
|
usItem = gMercProfiles[ubMercID].inv[ uiLoop ];
|
||||||
|
|
||||||
@@ -1838,7 +1840,8 @@ void MercWeaponKitSelectionUpdate(UINT8 selectedInventory)
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
UINT16 tempGearCost = 0;
|
UINT16 tempGearCost = 0;
|
||||||
for ( uiLoop = 0; uiLoop< gMercProfiles[ ubMercID ].inv.size(); uiLoop++ )
|
UINT32 invsize = gMercProfiles[ ubMercID ].inv.size();
|
||||||
|
for ( uiLoop = 0; uiLoop< invsize; ++uiLoop )
|
||||||
{
|
{
|
||||||
if ( gMercProfiles[ ubMercID ].inv[ uiLoop ] != NOTHING )
|
if ( gMercProfiles[ ubMercID ].inv[ uiLoop ] != NOTHING )
|
||||||
{
|
{
|
||||||
|
|||||||
+13
-11
@@ -2528,7 +2528,8 @@ void RenderInventoryForCharacter( INT32 iId, INT32 iSlot )
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
for( ubCounter = 0; ubCounter < pSoldier->inv.size(); ubCounter++ )
|
UINT8 invsize = pSoldier->inv.size();
|
||||||
|
for( ubCounter = 0; ubCounter < invsize; ++ubCounter )
|
||||||
{
|
{
|
||||||
PosX = iScreenWidthOffset + 397 + 3;
|
PosX = iScreenWidthOffset + 397 + 3;
|
||||||
PosY = iScreenHeightOffset + 200 + 8 +( ubItemCount * ( 29 ) );
|
PosY = iScreenHeightOffset + 200 + 8 +( ubItemCount * ( 29 ) );
|
||||||
@@ -2543,7 +2544,7 @@ void RenderInventoryForCharacter( INT32 iId, INT32 iSlot )
|
|||||||
{
|
{
|
||||||
if( uiCurrentInventoryIndex > ubUpToCount )
|
if( uiCurrentInventoryIndex > ubUpToCount )
|
||||||
{
|
{
|
||||||
ubUpToCount++;
|
++ubUpToCount;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -2778,21 +2779,20 @@ void EnableDisableInventoryScrollButtons( void )
|
|||||||
INT32 GetNumberOfInventoryItemsOnCurrentMerc( void )
|
INT32 GetNumberOfInventoryItemsOnCurrentMerc( void )
|
||||||
{
|
{
|
||||||
// in current team mode?..nope...move on
|
// in current team mode?..nope...move on
|
||||||
if (!fCurrentTeamMode) {
|
if (!fCurrentTeamMode)
|
||||||
return( 0 );
|
return( 0 );
|
||||||
}
|
|
||||||
|
|
||||||
SOLDIERTYPE *pSoldier = &Menptr[currentTeamList[currentTeamIndex]];
|
SOLDIERTYPE *pSoldier = &Menptr[currentTeamList[currentTeamIndex]];
|
||||||
|
|
||||||
unsigned ubCount = 0;
|
INT32 ubCount = 0;
|
||||||
for (unsigned ubCounter = 0; ubCounter < pSoldier->inv.size(); ++ubCounter)
|
UINT8 invsize = pSoldier->inv.size();
|
||||||
|
for (UINT8 ubCounter = 0; ubCounter < invsize; ++ubCounter)
|
||||||
{
|
{
|
||||||
if( ( pSoldier->inv[ ubCounter ].exists() == true) ) {
|
if( ( pSoldier->inv[ ubCounter ].exists() == true) )
|
||||||
++ubCount;
|
++ubCount;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return (INT32)ubCount;
|
return ubCount;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CreateDestroyPersonnelInventoryScrollButtons( void )
|
void CreateDestroyPersonnelInventoryScrollButtons( void )
|
||||||
@@ -6225,7 +6225,8 @@ INT32 GetFundsOnMerc( SOLDIERTYPE *pSoldier )
|
|||||||
}
|
}
|
||||||
|
|
||||||
// run through grunts pockets and count all the spare change
|
// run through grunts pockets and count all the spare change
|
||||||
for( iCurrentPocket = 0; iCurrentPocket < pSoldier->inv.size(); iCurrentPocket++ )
|
UINT32 invsize = pSoldier->inv.size();
|
||||||
|
for( iCurrentPocket = 0; iCurrentPocket < invsize; ++iCurrentPocket )
|
||||||
{
|
{
|
||||||
if ( Item[ pSoldier->inv[ iCurrentPocket ] .usItem ].usItemClass == IC_MONEY )
|
if ( Item[ pSoldier->inv[ iCurrentPocket ] .usItem ].usItemClass == IC_MONEY )
|
||||||
{
|
{
|
||||||
@@ -6249,7 +6250,8 @@ BOOLEAN TransferFundsFromMercToBank( SOLDIERTYPE *pSoldier, INT32 iCurrentBalanc
|
|||||||
UINT32 iCurrentPocket = 0;
|
UINT32 iCurrentPocket = 0;
|
||||||
INT32 iAmountLeftToTake = iCurrentBalance;
|
INT32 iAmountLeftToTake = iCurrentBalance;
|
||||||
// run through grunts pockets and count all the spare change
|
// run through grunts pockets and count all the spare change
|
||||||
for( iCurrentPocket = 0; iCurrentPocket < pSoldier->inv.size(); iCurrentPocket++ )
|
UINT32 invsize = pSoldier->inv.size();
|
||||||
|
for( iCurrentPocket = 0; iCurrentPocket < invsize; ++iCurrentPocket )
|
||||||
{
|
{
|
||||||
if ( Item[ pSoldier->inv[ iCurrentPocket ] .usItem ].usItemClass == IC_MONEY )
|
if ( Item[ pSoldier->inv[ iCurrentPocket ] .usItem ].usItemClass == IC_MONEY )
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -3827,7 +3827,8 @@ OBJECTTYPE* FindRepairableItemInLBENODE(SOLDIERTYPE * pSoldier, OBJECTTYPE * pOb
|
|||||||
if(pObj->IsActiveLBE(subObject) == true)
|
if(pObj->IsActiveLBE(subObject) == true)
|
||||||
{
|
{
|
||||||
LBENODE* pLBE = pObj->GetLBEPointer(subObject);
|
LBENODE* pLBE = pObj->GetLBEPointer(subObject);
|
||||||
for(UINT8 lbePocket = 0; lbePocket < pLBE->inv.size(); lbePocket++)
|
UINT8 invsize = pLBE->inv.size();
|
||||||
|
for(UINT8 lbePocket = 0; lbePocket < invsize; ++lbePocket)
|
||||||
{
|
{
|
||||||
for(UINT8 ubItemsInPocket = 0; ubItemsInPocket < pLBE->inv[lbePocket].ubNumberOfObjects; ubItemsInPocket++)
|
for(UINT8 ubItemsInPocket = 0; ubItemsInPocket < pLBE->inv[lbePocket].ubNumberOfObjects; ubItemsInPocket++)
|
||||||
{
|
{
|
||||||
@@ -4035,7 +4036,8 @@ BOOLEAN RepairObject( SOLDIERTYPE * pSoldier, SOLDIERTYPE * pOwner, OBJECTTYPE *
|
|||||||
if(UsingNewInventorySystem() == true && Item[pObj->usItem].usItemClass == IC_LBEGEAR && pObj->IsActiveLBE(ubLoop) == true)
|
if(UsingNewInventorySystem() == true && Item[pObj->usItem].usItemClass == IC_LBEGEAR && pObj->IsActiveLBE(ubLoop) == true)
|
||||||
{
|
{
|
||||||
LBENODE* pLBE = pObj->GetLBEPointer(ubLoop);
|
LBENODE* pLBE = pObj->GetLBEPointer(ubLoop);
|
||||||
for(lbeLoop = 0; lbeLoop < pLBE->inv.size(); lbeLoop++)
|
UINT8 invsize = pLBE->inv.size();
|
||||||
|
for(lbeLoop = 0; lbeLoop < invsize; ++lbeLoop)
|
||||||
{
|
{
|
||||||
if(RepairObject(pSoldier, pOwner, &pLBE->inv[lbeLoop], pubRepairPtsLeft))
|
if(RepairObject(pSoldier, pOwner, &pLBE->inv[lbeLoop], pubRepairPtsLeft))
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -4256,7 +4256,9 @@ BOOLEAN FireAShot( SOLDIERCELL *pAttacker )
|
|||||||
pAttacker->bWeaponSlot = SECONDHANDPOS;
|
pAttacker->bWeaponSlot = SECONDHANDPOS;
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
for( UINT32 i = 0; i < pSoldier->inv.size(); i++ )
|
|
||||||
|
UINT8 invsize = pSoldier->inv.size();
|
||||||
|
for( UINT8 i = 0; i < invsize; ++i )
|
||||||
{
|
{
|
||||||
pItem = &pSoldier->inv[ i ];
|
pItem = &pSoldier->inv[ i ];
|
||||||
|
|
||||||
@@ -4297,7 +4299,8 @@ BOOLEAN FireAShot( SOLDIERCELL *pAttacker )
|
|||||||
|
|
||||||
BOOLEAN AttackerHasKnife( SOLDIERCELL *pAttacker )
|
BOOLEAN AttackerHasKnife( SOLDIERCELL *pAttacker )
|
||||||
{
|
{
|
||||||
for( UINT32 i = 0; i < pAttacker->pSoldier->inv.size(); i++ )
|
UINT8 invsize = pAttacker->pSoldier->inv.size();
|
||||||
|
for( UINT8 i = 0; i < invsize; ++i )
|
||||||
{
|
{
|
||||||
if( Item[ pAttacker->pSoldier->inv[ i ].usItem ].usItemClass == IC_BLADE )
|
if( Item[ pAttacker->pSoldier->inv[ i ].usItem ].usItemClass == IC_BLADE )
|
||||||
{
|
{
|
||||||
@@ -4312,7 +4315,8 @@ BOOLEAN AttackerHasKnife( SOLDIERCELL *pAttacker )
|
|||||||
BOOLEAN TargetHasLoadedGun( SOLDIERTYPE *pSoldier )
|
BOOLEAN TargetHasLoadedGun( SOLDIERTYPE *pSoldier )
|
||||||
{
|
{
|
||||||
OBJECTTYPE *pItem;
|
OBJECTTYPE *pItem;
|
||||||
for( UINT32 i = 0; i < pSoldier->inv.size(); i++ )
|
UINT8 invsize = pSoldier->inv.size();
|
||||||
|
for( UINT8 i = 0; i < invsize; ++i )
|
||||||
{
|
{
|
||||||
pItem = &pSoldier->inv[ i ];
|
pItem = &pSoldier->inv[ i ];
|
||||||
if( Item[ pItem->usItem ].usItemClass == IC_GUN )
|
if( Item[ pItem->usItem ].usItemClass == IC_GUN )
|
||||||
|
|||||||
@@ -341,7 +341,7 @@ void HourlyLarryUpdate()
|
|||||||
BOOLEAN fBar = FALSE;
|
BOOLEAN fBar = FALSE;
|
||||||
OBJECTTYPE* pObj = NULL;
|
OBJECTTYPE* pObj = NULL;
|
||||||
|
|
||||||
for( INT32 cnt = gTacticalStatus.Team[ OUR_TEAM ].bFirstID; cnt <= gTacticalStatus.Team[ OUR_TEAM ].bLastID; ++cnt )
|
for( UINT32 cnt = gTacticalStatus.Team[ OUR_TEAM ].bFirstID; cnt <= gTacticalStatus.Team[ OUR_TEAM ].bLastID; ++cnt )
|
||||||
{
|
{
|
||||||
pSoldier = MercPtrs[ cnt ];
|
pSoldier = MercPtrs[ cnt ];
|
||||||
|
|
||||||
|
|||||||
@@ -4067,14 +4067,15 @@ INT32 SellItem( OBJECTTYPE& object, BOOLEAN fAll, BOOLEAN useModifier )
|
|||||||
{
|
{
|
||||||
//CHRISL: If we're selling an LBE Item, we need to verify if it's an LBENODE, first. If it is, we need to sell
|
//CHRISL: If we're selling an LBE Item, we need to verify if it's an LBENODE, first. If it is, we need to sell
|
||||||
// everything stored in the LBENODE before we sell teh LBE Item itself.
|
// everything stored in the LBENODE before we sell teh LBE Item itself.
|
||||||
for(UINT8 ubLoop = 0; ubLoop < object.ubNumberOfObjects; ubLoop++)
|
for(UINT8 ubLoop = 0; ubLoop < object.ubNumberOfObjects; ++ubLoop)
|
||||||
{
|
{
|
||||||
if(object.IsActiveLBE(ubLoop) == true)
|
if(object.IsActiveLBE(ubLoop) == true)
|
||||||
{
|
{
|
||||||
LBENODE* pLBE = object.GetLBEPointer(ubLoop);
|
LBENODE* pLBE = object.GetLBEPointer(ubLoop);
|
||||||
if(pLBE)
|
if(pLBE)
|
||||||
{
|
{
|
||||||
for(unsigned int x = 0; x < pLBE->inv.size(); x++)
|
UINT8 invsize = pLBE->inv.size();
|
||||||
|
for(UINT8 x = 0; x < invsize; ++x)
|
||||||
{
|
{
|
||||||
if(pLBE->inv[x].exists() == true)
|
if(pLBE->inv[x].exists() == true)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1620,7 +1620,8 @@ void HandleLeavingOfEquipmentInCurrentSector( UINT32 uiMercId )
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for( UINT32 iCounter = 0; iCounter < Menptr[ uiMercId ].inv.size(); iCounter++ )
|
UINT32 invsize = Menptr[ uiMercId ].inv.size();
|
||||||
|
for( UINT32 iCounter = 0; iCounter < invsize; ++iCounter )
|
||||||
{
|
{
|
||||||
// slot found,
|
// slot found,
|
||||||
// check if actual item
|
// check if actual item
|
||||||
@@ -1639,7 +1640,6 @@ void HandleLeavingOfEquipmentInCurrentSector( UINT32 uiMercId )
|
|||||||
}
|
}
|
||||||
|
|
||||||
DropKeysInKeyRing( MercPtrs[ uiMercId ], sGridNo, MercPtrs[ uiMercId ]->pathing.bLevel, 1, FALSE, 0, FALSE );
|
DropKeysInKeyRing( MercPtrs[ uiMercId ], sGridNo, MercPtrs[ uiMercId ]->pathing.bLevel, 1, FALSE, 0, FALSE );
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -1886,7 +1886,8 @@ INT32 SetUpDropItemListForMerc( UINT32 uiMercId )
|
|||||||
return( -1 );
|
return( -1 );
|
||||||
}
|
}
|
||||||
|
|
||||||
for( UINT32 iCounter = 0; iCounter < Menptr[ uiMercId ].inv.size(); iCounter++ )
|
UINT32 invsize = Menptr[ uiMercId ].inv.size();
|
||||||
|
for( UINT32 iCounter = 0; iCounter < invsize; ++iCounter )
|
||||||
{
|
{
|
||||||
// slot found,
|
// slot found,
|
||||||
// check if actual item
|
// check if actual item
|
||||||
|
|||||||
@@ -2183,7 +2183,8 @@ void EnemyCapturesPlayerSoldier( SOLDIERTYPE *pSoldier )
|
|||||||
pSoldier->pathing.bLevel = 0;
|
pSoldier->pathing.bLevel = 0;
|
||||||
|
|
||||||
// OK, drop all items!
|
// OK, drop all items!
|
||||||
for ( i = 0; i < pSoldier->inv.size(); i++ )
|
UINT32 invsize = pSoldier->inv.size();
|
||||||
|
for ( i = 0; i < invsize; ++i )
|
||||||
{
|
{
|
||||||
if( pSoldier->inv[ i ].exists() == true )
|
if( pSoldier->inv[ i ].exists() == true )
|
||||||
{
|
{
|
||||||
@@ -2216,7 +2217,8 @@ void EnemyCapturesPlayerSoldier( SOLDIERTYPE *pSoldier )
|
|||||||
pSoldier->pathing.bLevel = 0;
|
pSoldier->pathing.bLevel = 0;
|
||||||
|
|
||||||
// OK, drop all items!
|
// OK, drop all items!
|
||||||
for ( i = 0; i < pSoldier->inv.size(); i++ )
|
UINT32 invsize = pSoldier->inv.size();
|
||||||
|
for ( i = 0; i < invsize; ++i )
|
||||||
{
|
{
|
||||||
if( pSoldier->inv[ i ].exists() == true )
|
if( pSoldier->inv[ i ].exists() == true )
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -3179,11 +3179,13 @@ void CreateDestroyDisplayNPCInventoryPopup( UINT8 ubAction )
|
|||||||
DrawTextToScreen( gMercProfiles[ gNpcListBox.sCurSelectedItem ].zNickname, QUEST_DBS_NPC_INV_POPUP_X, QUEST_DBS_NPC_INV_POPUP_Y+20, QUEST_DBS_NPC_INV_POPUP_WIDTH, QUEST_DBS_FONT_TITLE, QUEST_DBS_COLOR_SUBTITLE, FONT_MCOLOR_BLACK, FALSE, CENTER_JUSTIFIED );
|
DrawTextToScreen( gMercProfiles[ gNpcListBox.sCurSelectedItem ].zNickname, QUEST_DBS_NPC_INV_POPUP_X, QUEST_DBS_NPC_INV_POPUP_Y+20, QUEST_DBS_NPC_INV_POPUP_WIDTH, QUEST_DBS_FONT_TITLE, QUEST_DBS_COLOR_SUBTITLE, FONT_MCOLOR_BLACK, FALSE, CENTER_JUSTIFIED );
|
||||||
|
|
||||||
usPosY = QUEST_DBS_NPC_INV_POPUP_Y + 40;
|
usPosY = QUEST_DBS_NPC_INV_POPUP_Y + 40;
|
||||||
for( i=0; i<pSoldier->inv.size(); i++)
|
|
||||||
|
UINT16 invsize = pSoldier->inv.size();
|
||||||
|
for( i=0; i<invsize; ++i)
|
||||||
{
|
{
|
||||||
if (pSoldier->inv[i].exists() == false) {
|
if (pSoldier->inv[i].exists() == false)
|
||||||
continue;
|
continue;
|
||||||
}
|
|
||||||
// if ( !LoadItemInfo( pSoldier->inv[ i ].usItem, zItemName, zItemDesc ) )
|
// if ( !LoadItemInfo( pSoldier->inv[ i ].usItem, zItemName, zItemDesc ) )
|
||||||
// Assert(0);
|
// Assert(0);
|
||||||
wcscpy( zItemName, ShortItemNames[ pSoldier->inv[ i ].usItem ] );
|
wcscpy( zItemName, ShortItemNames[ pSoldier->inv[ i ].usItem ] );
|
||||||
@@ -3691,7 +3693,7 @@ void RefreshAllNPCInventory()
|
|||||||
{
|
{
|
||||||
UINT16 usCnt;
|
UINT16 usCnt;
|
||||||
UINT16 usItemCnt;
|
UINT16 usItemCnt;
|
||||||
UINT16 usItem;
|
UINT16 usItem;
|
||||||
|
|
||||||
for ( usCnt=0; usCnt < TOTAL_SOLDIERS; usCnt++ )
|
for ( usCnt=0; usCnt < TOTAL_SOLDIERS; usCnt++ )
|
||||||
{
|
{
|
||||||
@@ -3704,7 +3706,8 @@ void RefreshAllNPCInventory()
|
|||||||
if ( gProfilesRPC[Menptr[ usCnt ].ubProfile].ProfilId == Menptr[ usCnt ].ubProfile || gProfilesNPC[Menptr[ usCnt ].ubProfile].ProfilId == Menptr[ usCnt ].ubProfile || gProfilesVehicle[Menptr[ usCnt ].ubProfile].ProfilId == Menptr[ usCnt ].ubProfile )
|
if ( gProfilesRPC[Menptr[ usCnt ].ubProfile].ProfilId == Menptr[ usCnt ].ubProfile || gProfilesNPC[Menptr[ usCnt ].ubProfile].ProfilId == Menptr[ usCnt ].ubProfile || gProfilesVehicle[Menptr[ usCnt ].ubProfile].ProfilId == Menptr[ usCnt ].ubProfile )
|
||||||
{
|
{
|
||||||
//refresh the mercs inventory
|
//refresh the mercs inventory
|
||||||
for ( usItemCnt = 0; usItemCnt< Menptr[ usCnt ].inv.size(); usItemCnt++ )
|
UINT16 invsize = Menptr[ usCnt ].inv.size();
|
||||||
|
for ( usItemCnt = 0; usItemCnt< invsize; ++usItemCnt )
|
||||||
{
|
{
|
||||||
if ( gMercProfiles[ Menptr[ usCnt ].ubProfile ].inv[ usItemCnt ] != NOTHING )
|
if ( gMercProfiles[ Menptr[ usCnt ].ubProfile ].inv[ usItemCnt ] != NOTHING )
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -797,8 +797,8 @@ BOOLEAN SoldierHasWorseEquipmentThanUsedTo( SOLDIERTYPE *pSoldier )
|
|||||||
INT32 bBestGun = -1;
|
INT32 bBestGun = -1;
|
||||||
INT32 bBestGunIndex = -1;
|
INT32 bBestGunIndex = -1;
|
||||||
|
|
||||||
|
UINT32 invsize = pSoldier->inv.size();
|
||||||
for ( UINT32 cnt = 0; cnt < pSoldier->inv.size(); cnt++ )
|
for ( UINT32 cnt = 0; cnt < invsize; ++cnt )
|
||||||
{
|
{
|
||||||
// Look for best gun/armour
|
// Look for best gun/armour
|
||||||
if ( pSoldier->inv[cnt].exists() == true )
|
if ( pSoldier->inv[cnt].exists() == true )
|
||||||
|
|||||||
@@ -6394,7 +6394,8 @@ UINT8 StealItems(SOLDIERTYPE* pSoldier,SOLDIERTYPE* pOpponent, UINT8* ubIndexRet
|
|||||||
|
|
||||||
//Create a temporary item pool, with index in Opponent's inventory as index
|
//Create a temporary item pool, with index in Opponent's inventory as index
|
||||||
pItemPool=NULL;
|
pItemPool=NULL;
|
||||||
for(i=0 ; i<pOpponent->inv.size(); i++)
|
UINT8 invsize = pOpponent->inv.size();
|
||||||
|
for(i=0 ; i<invsize; ++i)
|
||||||
{
|
{
|
||||||
fStealItem = FALSE;
|
fStealItem = FALSE;
|
||||||
|
|
||||||
|
|||||||
+7
-10
@@ -5698,7 +5698,7 @@ void ResetMultiSelection( )
|
|||||||
// Make them move....
|
// Make them move....
|
||||||
|
|
||||||
cnt = gTacticalStatus.Team[ gbPlayerNum ].bFirstID;
|
cnt = gTacticalStatus.Team[ gbPlayerNum ].bFirstID;
|
||||||
for ( pSoldier = MercPtrs[ cnt ]; cnt <= gTacticalStatus.Team[ gbPlayerNum ].bLastID; cnt++, pSoldier++ )
|
for ( pSoldier = MercPtrs[ cnt ]; cnt <= gTacticalStatus.Team[ gbPlayerNum ].bLastID; ++cnt, pSoldier++ )
|
||||||
{
|
{
|
||||||
if ( pSoldier->bActive && pSoldier->bInSector )
|
if ( pSoldier->bActive && pSoldier->bInSector )
|
||||||
{
|
{
|
||||||
@@ -5749,7 +5749,7 @@ UINT32 UIHandleRubberBandOnTerrain( UI_EVENT *pUIEvent )
|
|||||||
|
|
||||||
// ATE:Check at least for one guy that's in point!
|
// ATE:Check at least for one guy that's in point!
|
||||||
cnt = gTacticalStatus.Team[ gbPlayerNum ].bFirstID;
|
cnt = gTacticalStatus.Team[ gbPlayerNum ].bFirstID;
|
||||||
for ( pSoldier = MercPtrs[ cnt ]; cnt <= gTacticalStatus.Team[ gbPlayerNum ].bLastID; cnt++, pSoldier++ )
|
for ( pSoldier = MercPtrs[ cnt ]; cnt <= gTacticalStatus.Team[ gbPlayerNum ].bLastID; ++cnt, pSoldier++ )
|
||||||
{
|
{
|
||||||
// Check if this guy is OK to control....
|
// Check if this guy is OK to control....
|
||||||
if ( OK_CONTROLLABLE_MERC( pSoldier ) && !( pSoldier->flags.uiStatusFlags & ( SOLDIER_VEHICLE | SOLDIER_PASSENGER | SOLDIER_DRIVER ) ) )
|
if ( OK_CONTROLLABLE_MERC( pSoldier ) && !( pSoldier->flags.uiStatusFlags & ( SOLDIER_VEHICLE | SOLDIER_PASSENGER | SOLDIER_DRIVER ) ) )
|
||||||
@@ -5777,7 +5777,7 @@ UINT32 UIHandleRubberBandOnTerrain( UI_EVENT *pUIEvent )
|
|||||||
|
|
||||||
// ATE: Now loop through our guys and see if any fit!
|
// ATE: Now loop through our guys and see if any fit!
|
||||||
cnt = gTacticalStatus.Team[ gbPlayerNum ].bFirstID;
|
cnt = gTacticalStatus.Team[ gbPlayerNum ].bFirstID;
|
||||||
for ( pSoldier = MercPtrs[ cnt ]; cnt <= gTacticalStatus.Team[ gbPlayerNum ].bLastID; cnt++, pSoldier++ )
|
for ( pSoldier = MercPtrs[ cnt ]; cnt <= gTacticalStatus.Team[ gbPlayerNum ].bLastID; ++cnt, pSoldier++ )
|
||||||
{
|
{
|
||||||
|
|
||||||
// Check if this guy is OK to control....
|
// Check if this guy is OK to control....
|
||||||
@@ -5805,7 +5805,6 @@ UINT32 UIHandleRubberBandOnTerrain( UI_EVENT *pUIEvent )
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
return( GAME_SCREEN );
|
return( GAME_SCREEN );
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -5978,7 +5977,6 @@ BOOLEAN IsValidTalkableNPC( UINT8 ubSoldierID, BOOLEAN fGive , BOOLEAN fAllowMer
|
|||||||
SOLDIERTYPE *pSoldier = MercPtrs[ ubSoldierID ];
|
SOLDIERTYPE *pSoldier = MercPtrs[ ubSoldierID ];
|
||||||
BOOLEAN fValidGuy = FALSE;
|
BOOLEAN fValidGuy = FALSE;
|
||||||
|
|
||||||
|
|
||||||
if ( gusSelectedSoldier != NOBODY )
|
if ( gusSelectedSoldier != NOBODY )
|
||||||
{
|
{
|
||||||
if ( AM_A_ROBOT( MercPtrs[ gusSelectedSoldier ] ) )
|
if ( AM_A_ROBOT( MercPtrs[ gusSelectedSoldier ] ) )
|
||||||
@@ -6009,7 +6007,6 @@ BOOLEAN IsValidTalkableNPC( UINT8 ubSoldierID, BOOLEAN fGive , BOOLEAN fAllowMer
|
|||||||
return( FALSE );
|
return( FALSE );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// IF BAD GUY - CHECK VISIVILITY
|
// IF BAD GUY - CHECK VISIVILITY
|
||||||
if ( pSoldier->bTeam != gbPlayerNum )
|
if ( pSoldier->bTeam != gbPlayerNum )
|
||||||
{
|
{
|
||||||
@@ -6742,13 +6739,13 @@ void SetInterfaceHeightLevel( )
|
|||||||
|
|
||||||
|
|
||||||
// ATE: Use an entry point to determine what height to use....
|
// ATE: Use an entry point to determine what height to use....
|
||||||
if( gMapInformation.sNorthGridNo != -1 )
|
if( gMapInformation.sNorthGridNo != NOWHERE )
|
||||||
sGridNo = gMapInformation.sNorthGridNo;
|
sGridNo = gMapInformation.sNorthGridNo;
|
||||||
else if( gMapInformation.sEastGridNo != -1 )
|
else if( gMapInformation.sEastGridNo != NOWHERE )
|
||||||
sGridNo = gMapInformation.sEastGridNo;
|
sGridNo = gMapInformation.sEastGridNo;
|
||||||
else if( gMapInformation.sSouthGridNo != -1 )
|
else if( gMapInformation.sSouthGridNo != NOWHERE )
|
||||||
sGridNo = gMapInformation.sSouthGridNo;
|
sGridNo = gMapInformation.sSouthGridNo;
|
||||||
else if( gMapInformation.sWestGridNo != -1 )
|
else if( gMapInformation.sWestGridNo != NOWHERE )
|
||||||
sGridNo = gMapInformation.sWestGridNo;
|
sGridNo = gMapInformation.sWestGridNo;
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1633,7 +1633,8 @@ void HandleRenderInvSlots( SOLDIERTYPE *pSoldier, UINT8 fDirtyLevel )
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
for ( UINT32 cnt = 0; cnt < pSoldier->inv.size(); cnt++ )
|
UINT32 invsize = pSoldier->inv.size();
|
||||||
|
for ( UINT32 cnt = 0; cnt < invsize; ++cnt )
|
||||||
{
|
{
|
||||||
if ( fDirtyLevel == DIRTYLEVEL2 )
|
if ( fDirtyLevel == DIRTYLEVEL2 )
|
||||||
{
|
{
|
||||||
@@ -1717,7 +1718,8 @@ std::vector<OBJECTTYPE *> * getSoldierGuns( SOLDIERTYPE *pTeamSoldier )
|
|||||||
std::vector<OBJECTTYPE *> * guns = new std::vector<OBJECTTYPE *>;
|
std::vector<OBJECTTYPE *> * guns = new std::vector<OBJECTTYPE *>;
|
||||||
|
|
||||||
// Search for gun in soldier inventory
|
// Search for gun in soldier inventory
|
||||||
for (bLoop = 0; bLoop < pTeamSoldier->inv.size(); bLoop++)
|
UINT32 invsize = pTeamSoldier->inv.size();
|
||||||
|
for (bLoop = 0; bLoop < invsize; ++bLoop)
|
||||||
{
|
{
|
||||||
if ( (Item[pTeamSoldier->inv[bLoop].usItem].usItemClass & IC_GUN)
|
if ( (Item[pTeamSoldier->inv[bLoop].usItem].usItemClass & IC_GUN)
|
||||||
|| (Item[pTeamSoldier->inv[bLoop].usItem].usItemClass == IC_LAUNCHER) )
|
|| (Item[pTeamSoldier->inv[bLoop].usItem].usItemClass == IC_LAUNCHER) )
|
||||||
@@ -2800,7 +2802,8 @@ BOOLEAN SoldierContainsAnyCompatibleStuff( SOLDIERTYPE *pSoldier, OBJECTTYPE *pT
|
|||||||
|
|
||||||
if( ( Item [ pTestObject->usItem ].usItemClass & IC_GUN ) )
|
if( ( Item [ pTestObject->usItem ].usItemClass & IC_GUN ) )
|
||||||
{
|
{
|
||||||
for ( cnt = 0; cnt < pSoldier->inv.size(); cnt++ )
|
UINT32 invsize = pSoldier->inv.size();
|
||||||
|
for ( cnt = 0; cnt < invsize; ++cnt )
|
||||||
{
|
{
|
||||||
pObject = &(pSoldier->inv[ cnt ]);
|
pObject = &(pSoldier->inv[ cnt ]);
|
||||||
|
|
||||||
@@ -2813,7 +2816,8 @@ BOOLEAN SoldierContainsAnyCompatibleStuff( SOLDIERTYPE *pSoldier, OBJECTTYPE *pT
|
|||||||
|
|
||||||
if( ( Item [ pTestObject->usItem ].usItemClass & IC_AMMO ) )
|
if( ( Item [ pTestObject->usItem ].usItemClass & IC_AMMO ) )
|
||||||
{
|
{
|
||||||
for ( cnt = 0; cnt < pSoldier->inv.size(); cnt++ )
|
UINT32 invsize = pSoldier->inv.size();
|
||||||
|
for ( cnt = 0; cnt < invsize; ++cnt )
|
||||||
{
|
{
|
||||||
pObject = &(pSoldier->inv[ cnt ]);
|
pObject = &(pSoldier->inv[ cnt ]);
|
||||||
|
|
||||||
@@ -2898,7 +2902,8 @@ BOOLEAN HandleCompatibleAmmoUIForMapScreen( SOLDIERTYPE *pSoldier, INT32 bInvPos
|
|||||||
// ATE: If pTest object is NULL, test only for existence of syringes, etc...
|
// ATE: If pTest object is NULL, test only for existence of syringes, etc...
|
||||||
if ( pTestObject == NULL )
|
if ( pTestObject == NULL )
|
||||||
{
|
{
|
||||||
for ( cnt = 0; cnt < pSoldier->inv.size(); cnt++ )
|
UINT32 invsize = pSoldier->inv.size();
|
||||||
|
for ( cnt = 0; cnt < invsize; ++cnt )
|
||||||
{
|
{
|
||||||
pObject = &(pSoldier->inv[ cnt ]);
|
pObject = &(pSoldier->inv[ cnt ]);
|
||||||
|
|
||||||
@@ -2948,7 +2953,8 @@ BOOLEAN HandleCompatibleAmmoUIForMapScreen( SOLDIERTYPE *pSoldier, INT32 bInvPos
|
|||||||
if ( !(Item[ pTestObject->usItem ].hiddenaddon ) )
|
if ( !(Item[ pTestObject->usItem ].hiddenaddon ) )
|
||||||
{
|
{
|
||||||
// First test attachments, which almost any type of item can have....
|
// First test attachments, which almost any type of item can have....
|
||||||
for ( cnt = 0; cnt < pSoldier->inv.size(); cnt++ )
|
UINT32 invsize = pSoldier->inv.size();
|
||||||
|
for ( cnt = 0; cnt < invsize; ++cnt )
|
||||||
{
|
{
|
||||||
pObject = &(pSoldier->inv[ cnt ]);
|
pObject = &(pSoldier->inv[ cnt ]);
|
||||||
|
|
||||||
@@ -2990,7 +2996,8 @@ BOOLEAN HandleCompatibleAmmoUIForMapScreen( SOLDIERTYPE *pSoldier, INT32 bInvPos
|
|||||||
|
|
||||||
if ( ( Item [ pTestObject->usItem ].usItemClass & IC_GUN ) )
|
if ( ( Item [ pTestObject->usItem ].usItemClass & IC_GUN ) )
|
||||||
{
|
{
|
||||||
for ( cnt = 0; cnt < pSoldier->inv.size(); cnt++ )
|
UINT32 invsize = pSoldier->inv.size();
|
||||||
|
for ( cnt = 0; cnt < invsize; ++cnt )
|
||||||
{
|
{
|
||||||
pObject = &(pSoldier->inv[ cnt ]);
|
pObject = &(pSoldier->inv[ cnt ]);
|
||||||
|
|
||||||
@@ -3009,7 +3016,8 @@ BOOLEAN HandleCompatibleAmmoUIForMapScreen( SOLDIERTYPE *pSoldier, INT32 bInvPos
|
|||||||
}
|
}
|
||||||
else if( ( Item [ pTestObject->usItem ].usItemClass & IC_AMMO ) )
|
else if( ( Item [ pTestObject->usItem ].usItemClass & IC_AMMO ) )
|
||||||
{
|
{
|
||||||
for ( cnt = 0; cnt < pSoldier->inv.size(); cnt++ )
|
UINT32 invsize = pSoldier->inv.size();
|
||||||
|
for ( cnt = 0; cnt < invsize; ++cnt )
|
||||||
{
|
{
|
||||||
pObject = &(pSoldier->inv[ cnt ]);
|
pObject = &(pSoldier->inv[ cnt ]);
|
||||||
|
|
||||||
@@ -3166,7 +3174,8 @@ BOOLEAN InternalHandleCompatibleAmmoUI( SOLDIERTYPE *pSoldier, OBJECTTYPE *pTest
|
|||||||
// ATE: If pTest object is NULL, test only for existence of syringes, etc...
|
// ATE: If pTest object is NULL, test only for existence of syringes, etc...
|
||||||
if ( pTestObject == NULL )
|
if ( pTestObject == NULL )
|
||||||
{
|
{
|
||||||
for ( cnt = 0; cnt < pSoldier->inv.size(); cnt++ )
|
UINT32 invsize = pSoldier->inv.size();
|
||||||
|
for ( cnt = 0; cnt < invsize; ++cnt )
|
||||||
{
|
{
|
||||||
pObject = &(pSoldier->inv[ cnt ]);
|
pObject = &(pSoldier->inv[ cnt ]);
|
||||||
|
|
||||||
@@ -3213,7 +3222,8 @@ BOOLEAN InternalHandleCompatibleAmmoUI( SOLDIERTYPE *pSoldier, OBJECTTYPE *pTest
|
|||||||
}
|
}
|
||||||
|
|
||||||
// First test attachments, which almost any type of item can have....
|
// First test attachments, which almost any type of item can have....
|
||||||
for ( cnt = 0; cnt < pSoldier->inv.size(); cnt++ )
|
UINT32 invsize = pSoldier->inv.size();
|
||||||
|
for ( cnt = 0; cnt < invsize; ++cnt )
|
||||||
{
|
{
|
||||||
pObject = &(pSoldier->inv[ cnt ]);
|
pObject = &(pSoldier->inv[ cnt ]);
|
||||||
|
|
||||||
@@ -3253,7 +3263,8 @@ BOOLEAN InternalHandleCompatibleAmmoUI( SOLDIERTYPE *pSoldier, OBJECTTYPE *pTest
|
|||||||
//{
|
//{
|
||||||
if( ( Item [ pTestObject->usItem ].usItemClass & IC_GUN ) )
|
if( ( Item [ pTestObject->usItem ].usItemClass & IC_GUN ) )
|
||||||
{
|
{
|
||||||
for ( cnt = 0; cnt < pSoldier->inv.size(); cnt++ )
|
UINT32 invsize = pSoldier->inv.size();
|
||||||
|
for ( cnt = 0; cnt < invsize; ++cnt )
|
||||||
{
|
{
|
||||||
pObject = &(pSoldier->inv[ cnt ]);
|
pObject = &(pSoldier->inv[ cnt ]);
|
||||||
|
|
||||||
@@ -3273,7 +3284,8 @@ BOOLEAN InternalHandleCompatibleAmmoUI( SOLDIERTYPE *pSoldier, OBJECTTYPE *pTest
|
|||||||
|
|
||||||
else if( ( Item [ pTestObject->usItem ].usItemClass & IC_AMMO ) )
|
else if( ( Item [ pTestObject->usItem ].usItemClass & IC_AMMO ) )
|
||||||
{
|
{
|
||||||
for ( cnt = 0; cnt < pSoldier->inv.size(); cnt++ )
|
UINT32 invsize = pSoldier->inv.size();
|
||||||
|
for ( cnt = 0; cnt < invsize; ++cnt )
|
||||||
{
|
{
|
||||||
pObject = &(pSoldier->inv[ cnt ]);
|
pObject = &(pSoldier->inv[ cnt ]);
|
||||||
|
|
||||||
@@ -3438,11 +3450,11 @@ void HandleNewlyAddedItems( SOLDIERTYPE *pSoldier, BOOLEAN *fDirtyLevel )
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
UINT32 cnt;
|
|
||||||
INT16 sX, sY;
|
INT16 sX, sY;
|
||||||
OBJECTTYPE *pObject;
|
OBJECTTYPE *pObject;
|
||||||
|
|
||||||
for ( cnt = 0; cnt < pSoldier->inv.size(); cnt++ )
|
UINT32 invsize = pSoldier->inv.size();
|
||||||
|
for ( UINT32 cnt = 0; cnt < invsize; ++cnt )
|
||||||
{
|
{
|
||||||
if ( pSoldier->inv.bNewItemCount[ cnt ] == -2 )
|
if ( pSoldier->inv.bNewItemCount[ cnt ] == -2 )
|
||||||
{
|
{
|
||||||
@@ -3468,27 +3480,25 @@ void HandleNewlyAddedItems( SOLDIERTYPE *pSoldier, BOOLEAN *fDirtyLevel )
|
|||||||
INVRenderItem( guiSAVEBUFFER, pSoldier, pObject, sX, sY, gSMInvData[ cnt ].sWidth, gSMInvData[ cnt ].sHeight, DIRTYLEVEL2, NULL, 0, TRUE, us16BPPItemCyclePlacedItemColors[ pSoldier->inv.bNewItemCycleCount[ cnt ] ] );
|
INVRenderItem( guiSAVEBUFFER, pSoldier, pObject, sX, sY, gSMInvData[ cnt ].sWidth, gSMInvData[ cnt ].sHeight, DIRTYLEVEL2, NULL, 0, TRUE, us16BPPItemCyclePlacedItemColors[ pSoldier->inv.bNewItemCycleCount[ cnt ] ] );
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void CheckForAnyNewlyAddedItems( SOLDIERTYPE *pSoldier )
|
void CheckForAnyNewlyAddedItems( SOLDIERTYPE *pSoldier )
|
||||||
{
|
{
|
||||||
// OK, l0ok for any new...
|
// OK, l0ok for any new...
|
||||||
for ( UINT32 cnt = 0; cnt < pSoldier->inv.size(); cnt++ )
|
UINT32 invsize = pSoldier->inv.size();
|
||||||
|
for ( UINT32 cnt = 0; cnt < invsize; ++cnt )
|
||||||
{
|
{
|
||||||
if ( pSoldier->inv.bNewItemCount[ cnt ] == -1 )
|
if ( pSoldier->inv.bNewItemCount[ cnt ] == -1 )
|
||||||
{
|
{
|
||||||
pSoldier->inv.bNewItemCount[ cnt ] = NEW_ITEM_CYCLES - 1;
|
pSoldier->inv.bNewItemCount[ cnt ] = NEW_ITEM_CYCLES - 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void DegradeNewlyAddedItems( )
|
void DegradeNewlyAddedItems( )
|
||||||
{
|
{
|
||||||
UINT32 uiTime;
|
UINT32 uiTime;
|
||||||
UINT32 cnt, cnt2;
|
|
||||||
SOLDIERTYPE *pSoldier;
|
SOLDIERTYPE *pSoldier;
|
||||||
|
|
||||||
// If time done
|
// If time done
|
||||||
@@ -3498,14 +3508,15 @@ void DegradeNewlyAddedItems( )
|
|||||||
{
|
{
|
||||||
guiNewlyPlacedItemTimer = uiTime;
|
guiNewlyPlacedItemTimer = uiTime;
|
||||||
|
|
||||||
for ( cnt2 = 0; cnt2 < gGameOptions.ubSquadSize; cnt2++ )
|
for ( UINT32 cnt2 = 0; cnt2 < gGameOptions.ubSquadSize; ++cnt2 )
|
||||||
{
|
{
|
||||||
// GET SOLDIER
|
// GET SOLDIER
|
||||||
if ( gTeamPanel[ cnt2 ].fOccupied )
|
if ( gTeamPanel[ cnt2 ].fOccupied )
|
||||||
{
|
{
|
||||||
pSoldier = MercPtrs[ gTeamPanel[ cnt2 ].ubID ];
|
pSoldier = MercPtrs[ gTeamPanel[ cnt2 ].ubID ];
|
||||||
|
|
||||||
for ( cnt = 0; cnt < pSoldier->inv.size(); cnt++ )
|
UINT32 invsize = pSoldier->inv.size();
|
||||||
|
for ( UINT32 cnt = 0; cnt < invsize; ++cnt )
|
||||||
{
|
{
|
||||||
if ( pSoldier->inv.bNewItemCount[ cnt ] > 0 )
|
if ( pSoldier->inv.bNewItemCount[ cnt ] > 0 )
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1141,7 +1141,8 @@ void ReevaluateItemHatches( SOLDIERTYPE *pSoldier, BOOLEAN fAllValid )
|
|||||||
if ( ( gpItemPointer != NULL ) && !fAllValid )
|
if ( ( gpItemPointer != NULL ) && !fAllValid )
|
||||||
{
|
{
|
||||||
// check all inventory positions and mark the ones where cursor item won't fit as invalid
|
// check all inventory positions and mark the ones where cursor item won't fit as invalid
|
||||||
for ( cnt = 0; cnt < pSoldier->inv.size(); cnt++ )
|
UINT32 invsize = pSoldier->inv.size();
|
||||||
|
for ( cnt = 0; cnt < invsize; ++cnt )
|
||||||
{
|
{
|
||||||
gbInvalidPlacementSlot[ cnt ] = !CanItemFitInPosition( pSoldier, gpItemPointer, (INT8)cnt, FALSE );
|
gbInvalidPlacementSlot[ cnt ] = !CanItemFitInPosition( pSoldier, gpItemPointer, (INT8)cnt, FALSE );
|
||||||
|
|
||||||
@@ -1165,7 +1166,7 @@ void ReevaluateItemHatches( SOLDIERTYPE *pSoldier, BOOLEAN fAllValid )
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
// mark all inventory positions as valid
|
// mark all inventory positions as valid
|
||||||
for ( cnt = 0; cnt < NUM_INV_SLOTS; cnt++ )
|
for ( cnt = 0; cnt < NUM_INV_SLOTS; ++cnt )
|
||||||
{
|
{
|
||||||
gbInvalidPlacementSlot[ cnt ] = FALSE;
|
gbInvalidPlacementSlot[ cnt ] = FALSE;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -872,8 +872,10 @@ void GenerateRandomEquipment( SOLDIERCREATE_STRUCT *pp, INT8 bSoldierClass, INT8
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
for ( i = 0; i < pp->Inv.size(); i++ )
|
UINT32 invsize = pp->Inv.size();
|
||||||
{ //clear items, but only if they have write status.
|
for( i = 0; i < invsize; ++i )
|
||||||
|
{
|
||||||
|
//clear items, but only if they have write status.
|
||||||
if( !(pp->Inv[ i ].fFlags & OBJECT_NO_OVERWRITE) )
|
if( !(pp->Inv[ i ].fFlags & OBJECT_NO_OVERWRITE) )
|
||||||
{
|
{
|
||||||
DeleteObj(&pp->Inv[ i ]);
|
DeleteObj(&pp->Inv[ i ]);
|
||||||
@@ -1008,9 +1010,11 @@ void ChooseWeaponForSoldierCreateStruct( SOLDIERCREATE_STRUCT *pp, INT8 bWeaponC
|
|||||||
|
|
||||||
// if gun was pre-selected (rcvd negative weapon class) and needs ammo
|
// if gun was pre-selected (rcvd negative weapon class) and needs ammo
|
||||||
if( bWeaponClass < 0 && bAmmoClips )
|
if( bWeaponClass < 0 && bAmmoClips )
|
||||||
{ //Linda has added a specific gun to the merc's inventory, but no ammo. So, we
|
{
|
||||||
|
//Linda has added a specific gun to the merc's inventory, but no ammo. So, we
|
||||||
//will choose ammunition that works with the gun.
|
//will choose ammunition that works with the gun.
|
||||||
for( i = 0; i < pp->Inv.size(); i++ )
|
UINT16 invsize = pp->Inv.size();
|
||||||
|
for( i = 0; i < invsize; ++i )
|
||||||
{
|
{
|
||||||
if( Item[ pp->Inv[ i ].usItem ].usItemClass == IC_GUN && pp->Inv[ i ].exists() == true)
|
if( Item[ pp->Inv[ i ].usItem ].usItemClass == IC_GUN && pp->Inv[ i ].exists() == true)
|
||||||
{
|
{
|
||||||
@@ -2596,7 +2600,8 @@ else
|
|||||||
if ( (SOLDIER_CLASS_ENEMY( bSoldierClass ) || ( gGameExternalOptions.ubMilitiaDropEquipment > 0 && SOLDIER_CLASS_MILITIA( bSoldierClass ) )) && !IsAutoResolveActive() )
|
if ( (SOLDIER_CLASS_ENEMY( bSoldierClass ) || ( gGameExternalOptions.ubMilitiaDropEquipment > 0 && SOLDIER_CLASS_MILITIA( bSoldierClass ) )) && !IsAutoResolveActive() )
|
||||||
{
|
{
|
||||||
// SPECIAL handling for weapons: we'll always drop a weapon type that has never been dropped before
|
// SPECIAL handling for weapons: we'll always drop a weapon type that has never been dropped before
|
||||||
for( i = 0; i < pp->Inv.size(); i++ )
|
UINT32 invsize = pp->Inv.size();
|
||||||
|
for( i = 0; i < invsize; ++i )
|
||||||
{
|
{
|
||||||
usItem = pp->Inv[ i ].usItem;
|
usItem = pp->Inv[ i ].usItem;
|
||||||
//TODO: someday maybe pp->Inv[i].fFlags &= ~ITEM_REPAIRABLE;
|
//TODO: someday maybe pp->Inv[i].fFlags &= ~ITEM_REPAIRABLE;
|
||||||
@@ -2684,7 +2689,8 @@ else
|
|||||||
if( fAmmo )
|
if( fAmmo )
|
||||||
{
|
{
|
||||||
// now drops ALL ammo found, not just the first slot
|
// now drops ALL ammo found, not just the first slot
|
||||||
for( i = 0; i < pp->Inv.size(); i++ )
|
UINT32 invsize = pp->Inv.size();
|
||||||
|
for( i = 0; i < invsize; ++i )
|
||||||
{
|
{
|
||||||
uiItemClass = Item[ pp->Inv[ i ].usItem ].usItemClass;
|
uiItemClass = Item[ pp->Inv[ i ].usItem ].usItemClass;
|
||||||
if( uiItemClass == IC_AMMO )
|
if( uiItemClass == IC_AMMO )
|
||||||
@@ -2702,7 +2708,8 @@ else
|
|||||||
if( fWeapon )
|
if( fWeapon )
|
||||||
{
|
{
|
||||||
ubNumMatches = 0;
|
ubNumMatches = 0;
|
||||||
for( i = 0; i < pp->Inv.size(); i++ )
|
UINT32 invsize = pp->Inv.size();
|
||||||
|
for( i = 0; i < invsize; ++i )
|
||||||
{
|
{
|
||||||
uiItemClass = Item[ pp->Inv[ i ].usItem ].usItemClass;
|
uiItemClass = Item[ pp->Inv[ i ].usItem ].usItemClass;
|
||||||
if( uiItemClass == IC_GUN || uiItemClass == IC_LAUNCHER )
|
if( uiItemClass == IC_GUN || uiItemClass == IC_LAUNCHER )
|
||||||
@@ -2710,12 +2717,12 @@ else
|
|||||||
if( pp->Inv[ i ].fFlags & OBJECT_NO_OVERWRITE )
|
if( pp->Inv[ i ].fFlags & OBJECT_NO_OVERWRITE )
|
||||||
break;
|
break;
|
||||||
else
|
else
|
||||||
ubNumMatches++;
|
++ubNumMatches;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if ( ubNumMatches > 0 )
|
if ( ubNumMatches > 0 )
|
||||||
{
|
{
|
||||||
for( i = 0; i < pp->Inv.size(); i++ )
|
for( i = 0; i < invsize; ++i )
|
||||||
{
|
{
|
||||||
uiItemClass = Item[ pp->Inv[ i ].usItem ].usItemClass;
|
uiItemClass = Item[ pp->Inv[ i ].usItem ].usItemClass;
|
||||||
if( uiItemClass == IC_GUN || uiItemClass == IC_LAUNCHER )
|
if( uiItemClass == IC_GUN || uiItemClass == IC_LAUNCHER )
|
||||||
@@ -2735,7 +2742,8 @@ else
|
|||||||
if( fArmour )
|
if( fArmour )
|
||||||
{
|
{
|
||||||
ubNumMatches = 0;
|
ubNumMatches = 0;
|
||||||
for( i = 0; i < pp->Inv.size(); i++ )
|
UINT32 invsize = pp->Inv.size();
|
||||||
|
for( i = 0; i < invsize; ++i )
|
||||||
{
|
{
|
||||||
uiItemClass = Item[ pp->Inv[ i ].usItem ].usItemClass;
|
uiItemClass = Item[ pp->Inv[ i ].usItem ].usItemClass;
|
||||||
if( uiItemClass == IC_ARMOUR )
|
if( uiItemClass == IC_ARMOUR )
|
||||||
@@ -2743,12 +2751,12 @@ else
|
|||||||
if( pp->Inv[ i ].fFlags & OBJECT_NO_OVERWRITE )
|
if( pp->Inv[ i ].fFlags & OBJECT_NO_OVERWRITE )
|
||||||
break;
|
break;
|
||||||
else
|
else
|
||||||
ubNumMatches++;
|
++ubNumMatches;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if ( ubNumMatches > 0 )
|
if ( ubNumMatches > 0 )
|
||||||
{
|
{
|
||||||
for( i = 0; i < pp->Inv.size(); i++ )
|
for( i = 0; i < invsize; ++i )
|
||||||
{
|
{
|
||||||
uiItemClass = Item[ pp->Inv[ i ].usItem ].usItemClass;
|
uiItemClass = Item[ pp->Inv[ i ].usItem ].usItemClass;
|
||||||
if( uiItemClass == IC_ARMOUR )
|
if( uiItemClass == IC_ARMOUR )
|
||||||
@@ -2767,7 +2775,8 @@ else
|
|||||||
|
|
||||||
if( fKnife)
|
if( fKnife)
|
||||||
{
|
{
|
||||||
for( i = 0; i < pp->Inv.size(); i++ )
|
UINT32 invsize = pp->Inv.size();
|
||||||
|
for( i = 0; i < invsize; ++i )
|
||||||
{
|
{
|
||||||
// drops FIRST knife found
|
// drops FIRST knife found
|
||||||
uiItemClass = Item[ pp->Inv[ i ].usItem ].usItemClass;
|
uiItemClass = Item[ pp->Inv[ i ].usItem ].usItemClass;
|
||||||
@@ -2788,7 +2797,8 @@ else
|
|||||||
if( fGrenades )
|
if( fGrenades )
|
||||||
{
|
{
|
||||||
ubNumMatches = 0;
|
ubNumMatches = 0;
|
||||||
for( i = 0; i < pp->Inv.size(); i++ )
|
UINT32 invsize = pp->Inv.size();
|
||||||
|
for( i = 0; i < invsize; ++i )
|
||||||
{
|
{
|
||||||
uiItemClass = Item[ pp->Inv[ i ].usItem ].usItemClass;
|
uiItemClass = Item[ pp->Inv[ i ].usItem ].usItemClass;
|
||||||
if( uiItemClass == IC_GRENADE )
|
if( uiItemClass == IC_GRENADE )
|
||||||
@@ -2796,12 +2806,12 @@ else
|
|||||||
if( pp->Inv[ i ].fFlags & OBJECT_NO_OVERWRITE )
|
if( pp->Inv[ i ].fFlags & OBJECT_NO_OVERWRITE )
|
||||||
break;
|
break;
|
||||||
else
|
else
|
||||||
ubNumMatches++;
|
++ubNumMatches;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if ( ubNumMatches > 0 )
|
if ( ubNumMatches > 0 )
|
||||||
{
|
{
|
||||||
for( i = 0; i < pp->Inv.size(); i++ )
|
for( i = 0; i < invsize; ++i )
|
||||||
{
|
{
|
||||||
uiItemClass = Item[ pp->Inv[ i ].usItem ].usItemClass;
|
uiItemClass = Item[ pp->Inv[ i ].usItem ].usItemClass;
|
||||||
if( uiItemClass == IC_GRENADE )
|
if( uiItemClass == IC_GRENADE )
|
||||||
@@ -2821,7 +2831,8 @@ else
|
|||||||
if( fKit )
|
if( fKit )
|
||||||
{
|
{
|
||||||
ubNumMatches = 0;
|
ubNumMatches = 0;
|
||||||
for( i = 0; i < pp->Inv.size(); i++ )
|
UINT32 invsize = pp->Inv.size();
|
||||||
|
for( i = 0; i < invsize; ++i )
|
||||||
{
|
{
|
||||||
uiItemClass = Item[ pp->Inv[ i ].usItem ].usItemClass;
|
uiItemClass = Item[ pp->Inv[ i ].usItem ].usItemClass;
|
||||||
if( uiItemClass == IC_MEDKIT || uiItemClass == IC_KIT )
|
if( uiItemClass == IC_MEDKIT || uiItemClass == IC_KIT )
|
||||||
@@ -2834,7 +2845,7 @@ else
|
|||||||
}
|
}
|
||||||
if ( ubNumMatches > 0 )
|
if ( ubNumMatches > 0 )
|
||||||
{
|
{
|
||||||
for( i = 0; i < pp->Inv.size(); i++ )
|
for( i = 0; i < invsize; ++i )
|
||||||
{
|
{
|
||||||
uiItemClass = Item[ pp->Inv[ i ].usItem ].usItemClass;
|
uiItemClass = Item[ pp->Inv[ i ].usItem ].usItemClass;
|
||||||
if( uiItemClass == IC_MEDKIT || uiItemClass == IC_KIT )
|
if( uiItemClass == IC_MEDKIT || uiItemClass == IC_KIT )
|
||||||
@@ -2854,7 +2865,8 @@ else
|
|||||||
if( fFace )
|
if( fFace )
|
||||||
{
|
{
|
||||||
ubNumMatches = 0;
|
ubNumMatches = 0;
|
||||||
for( i = 0; i < pp->Inv.size(); i++ )
|
UINT32 invsize = pp->Inv.size();
|
||||||
|
for( i = 0; i < invsize; ++i )
|
||||||
{
|
{
|
||||||
uiItemClass = Item[ pp->Inv[ i ].usItem ].usItemClass;
|
uiItemClass = Item[ pp->Inv[ i ].usItem ].usItemClass;
|
||||||
if( uiItemClass == IC_FACE )
|
if( uiItemClass == IC_FACE )
|
||||||
@@ -2862,12 +2874,12 @@ else
|
|||||||
if( pp->Inv[ i ].fFlags & OBJECT_NO_OVERWRITE )
|
if( pp->Inv[ i ].fFlags & OBJECT_NO_OVERWRITE )
|
||||||
break;
|
break;
|
||||||
else
|
else
|
||||||
ubNumMatches++;
|
++ubNumMatches;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if ( ubNumMatches > 0 )
|
if ( ubNumMatches > 0 )
|
||||||
{
|
{
|
||||||
for( i = 0; i < pp->Inv.size(); i++ )
|
for( i = 0; i < invsize; ++i )
|
||||||
{
|
{
|
||||||
uiItemClass = Item[ pp->Inv[ i ].usItem ].usItemClass;
|
uiItemClass = Item[ pp->Inv[ i ].usItem ].usItemClass;
|
||||||
if( uiItemClass == IC_FACE )
|
if( uiItemClass == IC_FACE )
|
||||||
@@ -2887,7 +2899,8 @@ else
|
|||||||
if( fMisc )
|
if( fMisc )
|
||||||
{
|
{
|
||||||
ubNumMatches = 0;
|
ubNumMatches = 0;
|
||||||
for( i = 0; i < pp->Inv.size(); i++ )
|
UINT32 invsize = pp->Inv.size();
|
||||||
|
for( i = 0; i < invsize; ++i )
|
||||||
{
|
{
|
||||||
uiItemClass = Item[ pp->Inv[ i ].usItem ].usItemClass;
|
uiItemClass = Item[ pp->Inv[ i ].usItem ].usItemClass;
|
||||||
if( uiItemClass == IC_MISC )
|
if( uiItemClass == IC_MISC )
|
||||||
@@ -2895,12 +2908,12 @@ else
|
|||||||
if( pp->Inv[ i ].fFlags & OBJECT_NO_OVERWRITE )
|
if( pp->Inv[ i ].fFlags & OBJECT_NO_OVERWRITE )
|
||||||
break;
|
break;
|
||||||
else
|
else
|
||||||
ubNumMatches++;
|
++ubNumMatches;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if ( ubNumMatches > 0 )
|
if ( ubNumMatches > 0 )
|
||||||
{
|
{
|
||||||
for( i = 0; i < pp->Inv.size(); i++ )
|
for( i = 0; i < invsize; ++i )
|
||||||
{
|
{
|
||||||
uiItemClass = Item[ pp->Inv[ i ].usItem ].usItemClass;
|
uiItemClass = Item[ pp->Inv[ i ].usItem ].usItemClass;
|
||||||
if( uiItemClass == IC_MISC )
|
if( uiItemClass == IC_MISC )
|
||||||
@@ -2921,8 +2934,9 @@ else
|
|||||||
else if (gGameExternalOptions.ubEnemiesItemDrop == 1)
|
else if (gGameExternalOptions.ubEnemiesItemDrop == 1)
|
||||||
{
|
{
|
||||||
// Loop through the enemy inter
|
// Loop through the enemy inter
|
||||||
for( i = 0; i < pp->Inv.size(); i++ )
|
UINT32 invsize = pp->Inv.size();
|
||||||
{
|
for( i = 0; i < invsize; ++i )
|
||||||
|
{
|
||||||
uiItemClass = Item[ pp->Inv[ i ].usItem ].usItemClass;
|
uiItemClass = Item[ pp->Inv[ i ].usItem ].usItemClass;
|
||||||
|
|
||||||
// We are allowed to change the object and it is not the first (nothing) object
|
// We are allowed to change the object and it is not the first (nothing) object
|
||||||
@@ -2933,7 +2947,7 @@ else
|
|||||||
if( uiItemClass == IC_GUN)
|
if( uiItemClass == IC_GUN)
|
||||||
{
|
{
|
||||||
// Find matching weaponType in the XML
|
// Find matching weaponType in the XML
|
||||||
for (j = 0; j < MAX_DROP_ITEMS; j++)
|
for (j = 0; j < MAX_DROP_ITEMS; ++j)
|
||||||
{
|
{
|
||||||
// We have no more weapon items->exit from loop
|
// We have no more weapon items->exit from loop
|
||||||
if (j > 0 && gEnemyWeaponDrops[j].uiIndex == 0)
|
if (j > 0 && gEnemyWeaponDrops[j].uiIndex == 0)
|
||||||
@@ -2974,7 +2988,7 @@ else
|
|||||||
else if (uiItemClass == IC_AMMO)
|
else if (uiItemClass == IC_AMMO)
|
||||||
{
|
{
|
||||||
// Find matching ammo in the XML
|
// Find matching ammo in the XML
|
||||||
for (j = 0; j < MAX_DROP_ITEMS; j++)
|
for (j = 0; j < MAX_DROP_ITEMS; ++j)
|
||||||
{
|
{
|
||||||
// We have no more ammo items->exit from loop
|
// We have no more ammo items->exit from loop
|
||||||
if (j > 0 && gEnemyAmmoDrops[j].uiIndex == 0)
|
if (j > 0 && gEnemyAmmoDrops[j].uiIndex == 0)
|
||||||
@@ -2986,7 +3000,7 @@ else
|
|||||||
uiRandomValue = Random(100);
|
uiRandomValue = Random(100);
|
||||||
|
|
||||||
if (uiRandomValue == 0)
|
if (uiRandomValue == 0)
|
||||||
uiRandomValue++;
|
++uiRandomValue;
|
||||||
|
|
||||||
// militia
|
// militia
|
||||||
if ( SOLDIER_CLASS_MILITIA( bSoldierClass ) )
|
if ( SOLDIER_CLASS_MILITIA( bSoldierClass ) )
|
||||||
@@ -3047,7 +3061,6 @@ else
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -3068,7 +3081,7 @@ else
|
|||||||
uiRandomValue = Random(100);
|
uiRandomValue = Random(100);
|
||||||
|
|
||||||
if (uiRandomValue == 0)
|
if (uiRandomValue == 0)
|
||||||
uiRandomValue++;
|
++uiRandomValue;
|
||||||
|
|
||||||
// militia
|
// militia
|
||||||
if ( SOLDIER_CLASS_MILITIA( bSoldierClass ) )
|
if ( SOLDIER_CLASS_MILITIA( bSoldierClass ) )
|
||||||
@@ -3251,7 +3264,8 @@ void ReplaceExtendedGuns( SOLDIERCREATE_STRUCT *pp, INT8 bSoldierClass )
|
|||||||
INT8 bWeaponClass;
|
INT8 bWeaponClass;
|
||||||
UINT16 usItem, usNewGun, usAmmo, usNewAmmo;
|
UINT16 usItem, usNewGun, usAmmo, usNewAmmo;
|
||||||
|
|
||||||
for ( uiLoop = 0; uiLoop < pp->Inv.size(); uiLoop++ )
|
UINT32 invsize = pp->Inv.size();
|
||||||
|
for ( uiLoop = 0; uiLoop < invsize; ++uiLoop )
|
||||||
{
|
{
|
||||||
usItem = pp->Inv[ uiLoop ].usItem;
|
usItem = pp->Inv[ uiLoop ].usItem;
|
||||||
|
|
||||||
@@ -3289,7 +3303,8 @@ void ReplaceExtendedGuns( SOLDIERCREATE_STRUCT *pp, INT8 bSoldierClass )
|
|||||||
|
|
||||||
|
|
||||||
// must search through inventory and replace ammo accordingly
|
// must search through inventory and replace ammo accordingly
|
||||||
for ( uiLoop2 = 0; uiLoop2 < pp->Inv.size(); uiLoop2++ )
|
UINT32 invsize = pp->Inv.size();
|
||||||
|
for ( uiLoop2 = 0; uiLoop2 < invsize; ++uiLoop2 )
|
||||||
{
|
{
|
||||||
usAmmo = pp->Inv[ uiLoop2 ].usItem;
|
usAmmo = pp->Inv[ uiLoop2 ].usItem;
|
||||||
if ( (Item[ usAmmo ].usItemClass & IC_AMMO) )
|
if ( (Item[ usAmmo ].usItemClass & IC_AMMO) )
|
||||||
|
|||||||
+26
-13
@@ -80,11 +80,13 @@ bool DestroyLBEIfEmpty(OBJECTTYPE* pObj)
|
|||||||
{
|
{
|
||||||
if (pObj->IsActiveLBE(0) == true) {
|
if (pObj->IsActiveLBE(0) == true) {
|
||||||
LBENODE* pLBE = pObj->GetLBEPointer(0);
|
LBENODE* pLBE = pObj->GetLBEPointer(0);
|
||||||
if (pLBE) {
|
if (pLBE)
|
||||||
for (unsigned int x = 0; x < pLBE->inv.size(); ++x) {
|
{
|
||||||
if (pLBE->inv[x].exists() == true) {
|
UINT16 plbesize = pLBE->inv.size();
|
||||||
|
for (UINT16 x = 0; x < plbesize; ++x)
|
||||||
|
{
|
||||||
|
if (pLBE->inv[x].exists() == true)
|
||||||
return false;
|
return false;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
for (std::list<LBENODE>::iterator iter = LBEArray.begin(); iter != LBEArray.end(); ++iter) {
|
for (std::list<LBENODE>::iterator iter = LBEArray.begin(); iter != LBEArray.end(); ++iter) {
|
||||||
if (iter->uniqueID == pLBE->uniqueID) {
|
if (iter->uniqueID == pLBE->uniqueID) {
|
||||||
@@ -107,38 +109,44 @@ void DestroyLBE(OBJECTTYPE* pObj)
|
|||||||
LBENODE* pLBE = pObj->GetLBEPointer(0);
|
LBENODE* pLBE = pObj->GetLBEPointer(0);
|
||||||
if(pLBE)
|
if(pLBE)
|
||||||
{
|
{
|
||||||
for(unsigned int x = 0; x < pLBE->inv.size(); x++)
|
UINT16 plbesize = pLBE->inv.size();
|
||||||
|
for(UINT16 x = 0; x < plbesize; ++x)
|
||||||
{
|
{
|
||||||
if(pLBE->inv[x].exists() == true)
|
if(pLBE->inv[x].exists() == true)
|
||||||
{
|
{
|
||||||
pLBE->inv[x].initialize();
|
pLBE->inv[x].initialize();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for (std::list<LBENODE>::iterator iter = LBEArray.begin(); iter != LBEArray.end(); ++iter) {
|
for (std::list<LBENODE>::iterator iter = LBEArray.begin(); iter != LBEArray.end(); ++iter)
|
||||||
if (iter->uniqueID == pLBE->uniqueID) {
|
{
|
||||||
|
if (iter->uniqueID == pLBE->uniqueID)
|
||||||
|
{
|
||||||
LBEArray.erase(iter);
|
LBEArray.erase(iter);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
(*pObj)[0]->data.lbe.uniqueID = 0;
|
(*pObj)[0]->data.lbe.uniqueID = 0;
|
||||||
(*pObj)[0]->data.lbe.bLBE = 0;
|
(*pObj)[0]->data.lbe.bLBE = 0;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
void MoveItemsInSlotsToLBE( SOLDIERTYPE *pSoldier, std::vector<INT8>& LBESlots, LBENODE* pLBE, OBJECTTYPE* pObj)
|
void MoveItemsInSlotsToLBE( SOLDIERTYPE *pSoldier, std::vector<INT8>& LBESlots, LBENODE* pLBE, OBJECTTYPE* pObj)
|
||||||
{
|
{
|
||||||
|
UINT16 plbesize = pLBE->inv.size();
|
||||||
for(unsigned int i=0; i<LBESlots.size(); i++) // Go through default pockets one by one
|
UINT16 lbesize = LBESlots.size();
|
||||||
|
for(UINT16 i=0; i<lbesize; ++i) // Go through default pockets one by one
|
||||||
{
|
{
|
||||||
if(pSoldier->inv[LBESlots[i]].exists() == false) // No item in this pocket
|
if(pSoldier->inv[LBESlots[i]].exists() == false) // No item in this pocket
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
// Found an item in a default pocket so get it's ItemSize
|
// Found an item in a default pocket so get it's ItemSize
|
||||||
UINT16 dSize = CalculateItemSize(&pSoldier->inv[LBESlots[i]]);
|
UINT16 dSize = CalculateItemSize(&pSoldier->inv[LBESlots[i]]);
|
||||||
for(unsigned int j=0; j<pLBE->inv.size(); j++) // Search through LBE and see if item fits anywhere
|
for(unsigned int j=0; j<plbesize; ++j) // Search through LBE and see if item fits anywhere
|
||||||
{
|
{
|
||||||
if(pLBE->inv[j].exists() == true) // Item already stored in LBENODE pocket
|
if(pLBE->inv[j].exists() == true) // Item already stored in LBENODE pocket
|
||||||
continue;
|
continue;
|
||||||
@@ -368,15 +376,19 @@ BOOLEAN MoveItemFromLBEItem( SOLDIERTYPE *pSoldier, UINT32 uiHandPos, OBJECTTYPE
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (DestroyLBEIfEmpty(pObj) == false) {
|
|
||||||
|
if (DestroyLBEIfEmpty(pObj) == false)
|
||||||
|
{
|
||||||
//we should have copied all the items from the LBE to the soldier
|
//we should have copied all the items from the LBE to the soldier
|
||||||
//which means the LBE should be empty and destroyed. However, if it's not empty, we need to force place
|
//which means the LBE should be empty and destroyed. However, if it's not empty, we need to force place
|
||||||
//some items so that we can empty the LBE without losing anything.
|
//some items so that we can empty the LBE without losing anything.
|
||||||
for(unsigned int i = 0; i < LBESlots.size(); i++)
|
UINT16 invsize = pSoldier->inv.size();
|
||||||
|
UINT16 lbesize = LBESlots.size();
|
||||||
|
for(UINT16 i = 0; i < lbesize; ++i)
|
||||||
{
|
{
|
||||||
if(pLBE->inv[i].exists() == true)
|
if(pLBE->inv[i].exists() == true)
|
||||||
{
|
{
|
||||||
for(unsigned int j = BIGPOCKSTART; j < pSoldier->inv.size(); j++)
|
for(UINT16 j = BIGPOCKSTART; j < invsize; ++j)
|
||||||
{
|
{
|
||||||
if(pSoldier->inv[j].exists() == false)
|
if(pSoldier->inv[j].exists() == false)
|
||||||
{
|
{
|
||||||
@@ -385,6 +397,7 @@ BOOLEAN MoveItemFromLBEItem( SOLDIERTYPE *pSoldier, UINT32 uiHandPos, OBJECTTYPE
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//Now, check one last time and if we still have an object, drop it to the ground
|
//Now, check one last time and if we still have an object, drop it to the ground
|
||||||
if(pLBE->inv[i].exists() == true)
|
if(pLBE->inv[i].exists() == true)
|
||||||
{
|
{
|
||||||
|
|||||||
+105
-97
@@ -1550,7 +1550,8 @@ INT8 FindBestWeaponIfCurrentIsOutOfRange(SOLDIERTYPE * pSoldier, INT8 bCurrentWe
|
|||||||
INT8 secondBestWeapon = 0;
|
INT8 secondBestWeapon = 0;
|
||||||
//search for weapons that meet the range, then sort by damage.
|
//search for weapons that meet the range, then sort by damage.
|
||||||
//if there are no weapons that meet the range, then use the longest range we can find
|
//if there are no weapons that meet the range, then use the longest range we can find
|
||||||
for (INT8 bLoop = 0; bLoop < (INT8) pSoldier->inv.size(); bLoop++)
|
INT8 invsize = (INT8)pSoldier->inv.size();
|
||||||
|
for (INT8 bLoop = 0; bLoop < invsize; ++bLoop)
|
||||||
{
|
{
|
||||||
//if this is a weapon
|
//if this is a weapon
|
||||||
if (Item[pSoldier->inv[bLoop].usItem].usItemClass & (IC_WEAPON | IC_THROWN) && pSoldier->inv[bLoop].exists() == true)
|
if (Item[pSoldier->inv[bLoop].usItem].usItemClass & (IC_WEAPON | IC_THROWN) && pSoldier->inv[bLoop].exists() == true)
|
||||||
@@ -1618,9 +1619,8 @@ INT8 FindMetalDetectorInHand( SOLDIERTYPE * pSoldier )
|
|||||||
|
|
||||||
INT8 FindLockBomb( SOLDIERTYPE * pSoldier )
|
INT8 FindLockBomb( SOLDIERTYPE * pSoldier )
|
||||||
{
|
{
|
||||||
INT8 bLoop;
|
INT8 invsize = (INT8)pSoldier->inv.size();
|
||||||
|
for (INT8 bLoop = 0; bLoop < invsize; ++bLoop)
|
||||||
for (bLoop = 0; bLoop < (INT8) pSoldier->inv.size(); bLoop++)
|
|
||||||
{
|
{
|
||||||
if (Item[pSoldier->inv[bLoop].usItem].lockbomb && pSoldier->inv[bLoop].exists() == true)
|
if (Item[pSoldier->inv[bLoop].usItem].lockbomb && pSoldier->inv[bLoop].exists() == true)
|
||||||
{
|
{
|
||||||
@@ -1632,9 +1632,8 @@ INT8 FindLockBomb( SOLDIERTYPE * pSoldier )
|
|||||||
|
|
||||||
INT8 FindUsableObj( SOLDIERTYPE * pSoldier, UINT16 usItem )
|
INT8 FindUsableObj( SOLDIERTYPE * pSoldier, UINT16 usItem )
|
||||||
{
|
{
|
||||||
INT8 bLoop;
|
INT8 invsize = (INT8)pSoldier->inv.size();
|
||||||
|
for (INT8 bLoop = 0; bLoop < invsize; ++bLoop)
|
||||||
for (bLoop = 0; bLoop < (INT8) pSoldier->inv.size(); bLoop++)
|
|
||||||
{
|
{
|
||||||
if ( pSoldier->inv[bLoop].usItem == usItem
|
if ( pSoldier->inv[bLoop].usItem == usItem
|
||||||
&& pSoldier->inv[bLoop].exists() == true
|
&& pSoldier->inv[bLoop].exists() == true
|
||||||
@@ -1649,9 +1648,8 @@ INT8 FindUsableObj( SOLDIERTYPE * pSoldier, UINT16 usItem )
|
|||||||
|
|
||||||
INT8 FindObjExcludingSlot( SOLDIERTYPE * pSoldier, UINT16 usItem, INT8 bExcludeSlot )
|
INT8 FindObjExcludingSlot( SOLDIERTYPE * pSoldier, UINT16 usItem, INT8 bExcludeSlot )
|
||||||
{
|
{
|
||||||
INT8 bLoop;
|
INT8 invsize = (INT8)pSoldier->inv.size();
|
||||||
|
for (INT8 bLoop = 0; bLoop < invsize; ++bLoop)
|
||||||
for (bLoop = 0; bLoop < (INT8)pSoldier->inv.size(); bLoop++)
|
|
||||||
{
|
{
|
||||||
if (bLoop == bExcludeSlot)
|
if (bLoop == bExcludeSlot)
|
||||||
{
|
{
|
||||||
@@ -1686,7 +1684,6 @@ INT8 FindObj( SOLDIERTYPE * pSoldier, UINT16 usItem, INT8 bLower, INT8 bUpper )
|
|||||||
|
|
||||||
INT8 FindObjInObjRange( SOLDIERTYPE * pSoldier, UINT16 usItem1, UINT16 usItem2 )
|
INT8 FindObjInObjRange( SOLDIERTYPE * pSoldier, UINT16 usItem1, UINT16 usItem2 )
|
||||||
{
|
{
|
||||||
INT8 bLoop;
|
|
||||||
UINT16 usTemp;
|
UINT16 usTemp;
|
||||||
|
|
||||||
if (usItem1 > usItem2 )
|
if (usItem1 > usItem2 )
|
||||||
@@ -1697,7 +1694,8 @@ INT8 FindObjInObjRange( SOLDIERTYPE * pSoldier, UINT16 usItem1, UINT16 usItem2 )
|
|||||||
usItem1 = usTemp;
|
usItem1 = usTemp;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (bLoop = 0; bLoop < (INT8) pSoldier->inv.size(); bLoop++)
|
INT8 invsize = (INT8)pSoldier->inv.size();
|
||||||
|
for (INT8 bLoop = 0; bLoop < invsize; ++bLoop)
|
||||||
{
|
{
|
||||||
usTemp = pSoldier->inv[bLoop].usItem;
|
usTemp = pSoldier->inv[bLoop].usItem;
|
||||||
if ( usTemp >= usItem1 && usTemp <= usItem2 && pSoldier->inv[bLoop].exists() == true)
|
if ( usTemp >= usItem1 && usTemp <= usItem2 && pSoldier->inv[bLoop].exists() == true)
|
||||||
@@ -1712,9 +1710,8 @@ INT8 FindObjInObjRange( SOLDIERTYPE * pSoldier, UINT16 usItem1, UINT16 usItem2 )
|
|||||||
|
|
||||||
INT8 FindObjClass( SOLDIERTYPE * pSoldier, UINT32 usItemClass )
|
INT8 FindObjClass( SOLDIERTYPE * pSoldier, UINT32 usItemClass )
|
||||||
{
|
{
|
||||||
INT8 bLoop;
|
INT8 invsize = (INT8)pSoldier->inv.size();
|
||||||
|
for (INT8 bLoop = 0; bLoop < invsize; ++bLoop)
|
||||||
for (bLoop = 0; bLoop < (INT8)pSoldier->inv.size(); bLoop++)
|
|
||||||
{
|
{
|
||||||
if (Item[pSoldier->inv[bLoop].usItem].usItemClass & usItemClass && pSoldier->inv[bLoop].exists() == true)
|
if (Item[pSoldier->inv[bLoop].usItem].usItemClass & usItemClass && pSoldier->inv[bLoop].exists() == true)
|
||||||
{
|
{
|
||||||
@@ -1730,13 +1727,13 @@ INT8 FindAIUsableObjClass( SOLDIERTYPE * pSoldier, UINT32 usItemClass )
|
|||||||
// the "unusable by AI" flag set.
|
// the "unusable by AI" flag set.
|
||||||
|
|
||||||
// uses & rather than == so that this function can search for any weapon
|
// uses & rather than == so that this function can search for any weapon
|
||||||
INT8 bLoop;
|
|
||||||
|
|
||||||
// This is for the AI only so:
|
// This is for the AI only so:
|
||||||
|
|
||||||
// Do not consider tank cannons or rocket launchers to be "guns"
|
// Do not consider tank cannons or rocket launchers to be "guns"
|
||||||
|
|
||||||
for (bLoop = 0; bLoop < (INT8) pSoldier->inv.size(); bLoop++)
|
INT8 invsize = (INT8)pSoldier->inv.size();
|
||||||
|
for (INT8 bLoop = 0; bLoop < invsize; ++bLoop)
|
||||||
{
|
{
|
||||||
if (pSoldier->inv[bLoop].exists() == true) {
|
if (pSoldier->inv[bLoop].exists() == true) {
|
||||||
if ( (Item[pSoldier->inv[bLoop].usItem].usItemClass & usItemClass) && !(pSoldier->inv[bLoop].fFlags & OBJECT_AI_UNUSABLE) && (pSoldier->inv[bLoop][0]->data.objectStatus >= USABLE ) )
|
if ( (Item[pSoldier->inv[bLoop].usItem].usItemClass & usItemClass) && !(pSoldier->inv[bLoop].fFlags & OBJECT_AI_UNUSABLE) && (pSoldier->inv[bLoop][0]->data.objectStatus >= USABLE ) )
|
||||||
@@ -1823,9 +1820,8 @@ BOOLEAN GLGrenadeInSlot(SOLDIERTYPE *pSoldier, INT8 bSlot )
|
|||||||
// for grenade launchers
|
// for grenade launchers
|
||||||
INT8 FindGLGrenade( SOLDIERTYPE * pSoldier )
|
INT8 FindGLGrenade( SOLDIERTYPE * pSoldier )
|
||||||
{
|
{
|
||||||
INT8 bLoop;
|
INT8 invsize = (INT8)pSoldier->inv.size();
|
||||||
|
for (INT8 bLoop = 0; bLoop < invsize; ++bLoop)
|
||||||
for (bLoop = 0; bLoop < (INT8)pSoldier->inv.size(); bLoop++)
|
|
||||||
{
|
{
|
||||||
if (GLGrenadeInSlot( pSoldier, bLoop ))
|
if (GLGrenadeInSlot( pSoldier, bLoop ))
|
||||||
{
|
{
|
||||||
@@ -1849,10 +1845,13 @@ INT8 FindThrowableGrenade( SOLDIERTYPE * pSoldier )
|
|||||||
fCheckForFlares = TRUE;
|
fCheckForFlares = TRUE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
INT8 invsize = (INT8)pSoldier->inv.size();
|
||||||
|
|
||||||
if (fCheckForFlares)
|
if (fCheckForFlares)
|
||||||
{
|
{
|
||||||
// Do a priority check for flares first
|
// Do a priority check for flares first
|
||||||
for (bLoop = 0; bLoop < (INT8)pSoldier->inv.size(); bLoop++)
|
for (bLoop = 0; bLoop < invsize; ++bLoop)
|
||||||
{
|
{
|
||||||
if (pSoldier->inv[bLoop].exists() == true) {
|
if (pSoldier->inv[bLoop].exists() == true) {
|
||||||
if ( Item[pSoldier->inv[ bLoop ].usItem].flare )
|
if ( Item[pSoldier->inv[ bLoop ].usItem].flare )
|
||||||
@@ -1863,7 +1862,7 @@ INT8 FindThrowableGrenade( SOLDIERTYPE * pSoldier )
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for (bLoop = 0; bLoop < (INT8)pSoldier->inv.size(); bLoop++)
|
for (bLoop = 0; bLoop < invsize; ++bLoop)
|
||||||
{
|
{
|
||||||
if (pSoldier->inv[bLoop].exists() == true) {
|
if (pSoldier->inv[bLoop].exists() == true) {
|
||||||
if ( (Item[ pSoldier->inv[ bLoop ].usItem ].usItemClass & IC_GRENADE) && // Try this check instead, to avoid tossing RPG rounds !GLGrenadeInSlot( pSoldier, bLoop ) &&
|
if ( (Item[ pSoldier->inv[ bLoop ].usItem ].usItemClass & IC_GRENADE) && // Try this check instead, to avoid tossing RPG rounds !GLGrenadeInSlot( pSoldier, bLoop ) &&
|
||||||
@@ -1933,7 +1932,8 @@ INT8 FindLaunchable( SOLDIERTYPE * pSoldier, UINT16 usWeapon )
|
|||||||
{
|
{
|
||||||
INT8 bLoop;
|
INT8 bLoop;
|
||||||
DebugMsg(TOPIC_JA2, DBG_LEVEL_3, String("FindLaunchable: weapon=%d",usWeapon));
|
DebugMsg(TOPIC_JA2, DBG_LEVEL_3, String("FindLaunchable: weapon=%d",usWeapon));
|
||||||
for (bLoop = 0; bLoop < (INT8)pSoldier->inv.size(); bLoop++)
|
INT8 invsize = (INT8)pSoldier->inv.size();
|
||||||
|
for (bLoop = 0; bLoop < invsize; ++bLoop)
|
||||||
{
|
{
|
||||||
if (pSoldier->inv[bLoop].exists() == true) {
|
if (pSoldier->inv[bLoop].exists() == true) {
|
||||||
if ( ValidLaunchable( pSoldier->inv[ bLoop ].usItem , usWeapon ) )
|
if ( ValidLaunchable( pSoldier->inv[ bLoop ].usItem , usWeapon ) )
|
||||||
@@ -1952,7 +1952,8 @@ INT8 FindNonSmokeLaunchable( SOLDIERTYPE * pSoldier, UINT16 usWeapon )
|
|||||||
{
|
{
|
||||||
INT8 bLoop;
|
INT8 bLoop;
|
||||||
DebugMsg(TOPIC_JA2, DBG_LEVEL_3, String("FindNonSmokeLaunchable: weapon=%d",usWeapon));
|
DebugMsg(TOPIC_JA2, DBG_LEVEL_3, String("FindNonSmokeLaunchable: weapon=%d",usWeapon));
|
||||||
for (bLoop = 0; bLoop < (INT8)pSoldier->inv.size(); bLoop++)
|
INT8 invsize = (INT8)pSoldier->inv.size();
|
||||||
|
for (bLoop = 0; bLoop < invsize; ++bLoop)
|
||||||
{
|
{
|
||||||
if (pSoldier->inv[bLoop].exists() == true) {
|
if (pSoldier->inv[bLoop].exists() == true) {
|
||||||
if ( ValidLaunchable( pSoldier->inv[ bLoop ].usItem , usWeapon ) && Explosive[Item[pSoldier->inv[ bLoop ].usItem].ubClassIndex].ubType != EXPLOSV_SMOKE )
|
if ( ValidLaunchable( pSoldier->inv[ bLoop ].usItem , usWeapon ) && Explosive[Item[pSoldier->inv[ bLoop ].usItem].ubClassIndex].ubType != EXPLOSV_SMOKE )
|
||||||
@@ -2894,7 +2895,8 @@ UINT16 CalculateItemSize( OBJECTTYPE *pObject )
|
|||||||
}
|
}
|
||||||
|
|
||||||
// LBENODE has it's ItemSize adjusted based on what it's storing
|
// LBENODE has it's ItemSize adjusted based on what it's storing
|
||||||
if(pObject->IsActiveLBE(numStacked) == true) {
|
if(pObject->IsActiveLBE(numStacked) == true)
|
||||||
|
{
|
||||||
LBENODE* pLBE = pObject->GetLBEPointer(numStacked);
|
LBENODE* pLBE = pObject->GetLBEPointer(numStacked);
|
||||||
if(pLBE)
|
if(pLBE)
|
||||||
{
|
{
|
||||||
@@ -2905,7 +2907,8 @@ UINT16 CalculateItemSize( OBJECTTYPE *pObject )
|
|||||||
UINT16 pIndex, testSize, maxSize;
|
UINT16 pIndex, testSize, maxSize;
|
||||||
UINT8 pocketCapacity, numberOfSizeIncrements;
|
UINT8 pocketCapacity, numberOfSizeIncrements;
|
||||||
FLOAT currentPocketPercent, currentPocketPartOfTotal;
|
FLOAT currentPocketPercent, currentPocketPartOfTotal;
|
||||||
for(unsigned int x = 0; x < pLBE->inv.size(); x++)
|
UINT16 invsize = pLBE->inv.size();
|
||||||
|
for(UINT16 x = 0; x < invsize; ++x)
|
||||||
{
|
{
|
||||||
if(LoadBearingEquipment[Item[pObject->usItem].ubClassIndex].lbePocketIndex[x] != 0)
|
if(LoadBearingEquipment[Item[pObject->usItem].ubClassIndex].lbePocketIndex[x] != 0)
|
||||||
{
|
{
|
||||||
@@ -2914,7 +2917,7 @@ UINT16 CalculateItemSize( OBJECTTYPE *pObject )
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
//Now, look through each active pocket
|
//Now, look through each active pocket
|
||||||
for(unsigned int x = 0; x < pLBE->inv.size(); x++)
|
for(UINT16 x = 0; x < invsize; ++x)
|
||||||
{
|
{
|
||||||
if(pLBE->inv[x].exists() == true)
|
if(pLBE->inv[x].exists() == true)
|
||||||
{
|
{
|
||||||
@@ -2942,7 +2945,7 @@ UINT16 CalculateItemSize( OBJECTTYPE *pObject )
|
|||||||
newSize = 0;
|
newSize = 0;
|
||||||
maxSize = max(iSize, LoadBearingEquipment[Item[pObject->usItem].ubClassIndex].lbeFilledSize);
|
maxSize = max(iSize, LoadBearingEquipment[Item[pObject->usItem].ubClassIndex].lbeFilledSize);
|
||||||
// Look for the ItemSize of the largest item in this LBENODE
|
// Look for the ItemSize of the largest item in this LBENODE
|
||||||
for(unsigned int x = 0; x < pLBE->inv.size(); ++x)
|
for(UINT16 x = 0; x < invsize; ++x)
|
||||||
{
|
{
|
||||||
if(pLBE->inv[x].exists() == true)
|
if(pLBE->inv[x].exists() == true)
|
||||||
{
|
{
|
||||||
@@ -3074,8 +3077,10 @@ UINT16 OBJECTTYPE::GetWeightOfObjectInStack(unsigned int index)
|
|||||||
if(pItem->usItemClass == IC_LBEGEAR && IsActiveLBE(index) && (UsingNewInventorySystem() == true))
|
if(pItem->usItemClass == IC_LBEGEAR && IsActiveLBE(index) && (UsingNewInventorySystem() == true))
|
||||||
{
|
{
|
||||||
LBENODE* pLBE = GetLBEPointer(index);
|
LBENODE* pLBE = GetLBEPointer(index);
|
||||||
if (pLBE) {
|
if (pLBE)
|
||||||
for ( unsigned int subObjects = 0; subObjects < pLBE->inv.size(); subObjects++)
|
{
|
||||||
|
UINT16 invsize = pLBE->inv.size();
|
||||||
|
for ( UINT16 subObjects = 0; subObjects < pLBE->inv.size(); ++subObjects)
|
||||||
{
|
{
|
||||||
if (pLBE->inv[subObjects].exists() == true)
|
if (pLBE->inv[subObjects].exists() == true)
|
||||||
{
|
{
|
||||||
@@ -3125,7 +3130,8 @@ UINT32 CalculateCarriedWeight( SOLDIERTYPE * pSoldier )
|
|||||||
UINT32 ubStrengthForCarrying;
|
UINT32 ubStrengthForCarrying;
|
||||||
|
|
||||||
//Pulmu: Changes for dynamic ammo weight
|
//Pulmu: Changes for dynamic ammo weight
|
||||||
for( ubLoop = 0; ubLoop < pSoldier->inv.size(); ubLoop++)
|
UINT8 invsize = pSoldier->inv.size();
|
||||||
|
for( ubLoop = 0; ubLoop < invsize; ++ubLoop)
|
||||||
{
|
{
|
||||||
//ADB the weight of the object is already counting stacked objects, attachments, et al
|
//ADB the weight of the object is already counting stacked objects, attachments, et al
|
||||||
uiTotalWeight += CalculateObjectWeight(&pSoldier->inv[ubLoop]);
|
uiTotalWeight += CalculateObjectWeight(&pSoldier->inv[ubLoop]);
|
||||||
@@ -3156,7 +3162,6 @@ UINT32 CalculateCarriedWeight( SOLDIERTYPE * pSoldier )
|
|||||||
uiPercent = (UINT32)(((FLOAT)20 * (FLOAT)gGameExternalOptions.iStrengthToLiftHalfKilo) * uiTotalWeight) / ( ubStrengthForCarrying );
|
uiPercent = (UINT32)(((FLOAT)20 * (FLOAT)gGameExternalOptions.iStrengthToLiftHalfKilo) * uiTotalWeight) / ( ubStrengthForCarrying );
|
||||||
|
|
||||||
return( uiPercent );
|
return( uiPercent );
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void DeleteObj(OBJECTTYPE * pObj )
|
void DeleteObj(OBJECTTYPE * pObj )
|
||||||
@@ -3668,8 +3673,8 @@ INT8 FindAmmo( SOLDIERTYPE * pSoldier, UINT8 ubCalibre, UINT16 ubMagSize, UINT8
|
|||||||
INVTYPE * pItem;
|
INVTYPE * pItem;
|
||||||
|
|
||||||
//CHRISL: Update this to search for the largest appropriate mag if ubMagSize = ANY_MAGSIZE
|
//CHRISL: Update this to search for the largest appropriate mag if ubMagSize = ANY_MAGSIZE
|
||||||
|
INT8 invsize = (INT8)pSoldier->inv.size();
|
||||||
for (bLoop = HANDPOS; bLoop < (INT8)pSoldier->inv.size(); bLoop++)
|
for (bLoop = HANDPOS; bLoop < invsize; ++bLoop)
|
||||||
{
|
{
|
||||||
//CHRISL: If in NIV, in combat and backpack is closed, don't look inside
|
//CHRISL: If in NIV, in combat and backpack is closed, don't look inside
|
||||||
if(UsingNewAttachmentSystem() == true && (gTacticalStatus.uiFlags & INCOMBAT) && IsBackpackSlot(bLoop) == true && pSoldier->flags.ZipperFlag == FALSE)
|
if(UsingNewAttachmentSystem() == true && (gTacticalStatus.uiFlags & INCOMBAT) && IsBackpackSlot(bLoop) == true && pSoldier->flags.ZipperFlag == FALSE)
|
||||||
@@ -8445,7 +8450,8 @@ BOOLEAN RemoveObjectFromSoldierProfile( UINT8 ubProfile, UINT16 usItem )
|
|||||||
return( TRUE );
|
return( TRUE );
|
||||||
}
|
}
|
||||||
MERCPROFILESTRUCT* pProfile = &gMercProfiles[ ubProfile ];
|
MERCPROFILESTRUCT* pProfile = &gMercProfiles[ ubProfile ];
|
||||||
for (unsigned int bLoop = 0; bLoop < pProfile->inv.size(); bLoop++)
|
UINT8 invsize = pProfile->inv.size();
|
||||||
|
for (UINT8 bLoop = 0; bLoop < invsize; ++bLoop)
|
||||||
{
|
{
|
||||||
if ( pProfile->inv[ bLoop ] == usItem )
|
if ( pProfile->inv[ bLoop ] == usItem )
|
||||||
{
|
{
|
||||||
@@ -8495,9 +8501,9 @@ void SetMoneyInSoldierProfile( UINT8 ubProfile, UINT32 uiMoney )
|
|||||||
|
|
||||||
INT8 FindObjectInSoldierProfile( UINT8 ubProfile, UINT16 usItem )
|
INT8 FindObjectInSoldierProfile( UINT8 ubProfile, UINT16 usItem )
|
||||||
{
|
{
|
||||||
|
|
||||||
MERCPROFILESTRUCT* pProfile = &gMercProfiles[ ubProfile ];
|
MERCPROFILESTRUCT* pProfile = &gMercProfiles[ ubProfile ];
|
||||||
for (unsigned int bLoop = 0; bLoop < pProfile->inv.size(); bLoop++)
|
INT8 invsize = (INT8)pProfile->inv.size();
|
||||||
|
for (INT8 bLoop = 0; bLoop < invsize; ++bLoop)
|
||||||
{
|
{
|
||||||
if ( pProfile->bInvNumber[ bLoop ] > 0 )
|
if ( pProfile->bInvNumber[ bLoop ] > 0 )
|
||||||
{
|
{
|
||||||
@@ -8700,7 +8706,6 @@ BOOLEAN DamageItem( OBJECTTYPE * pObject, INT32 iDamage, BOOLEAN fOnGround )
|
|||||||
|
|
||||||
void CheckEquipmentForDamage( SOLDIERTYPE *pSoldier, INT32 iDamage )
|
void CheckEquipmentForDamage( SOLDIERTYPE *pSoldier, INT32 iDamage )
|
||||||
{
|
{
|
||||||
INT8 bSlot;
|
|
||||||
BOOLEAN fBlowsUp;
|
BOOLEAN fBlowsUp;
|
||||||
UINT8 ubNumberOfObjects;
|
UINT8 ubNumberOfObjects;
|
||||||
|
|
||||||
@@ -8709,7 +8714,8 @@ void CheckEquipmentForDamage( SOLDIERTYPE *pSoldier, INT32 iDamage )
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (bSlot = 0; bSlot < (INT8) pSoldier->inv.size(); bSlot++)
|
UINT8 invsize = pSoldier->inv.size();
|
||||||
|
for (UINT8 bSlot = 0; bSlot < invsize; ++bSlot)
|
||||||
{
|
{
|
||||||
if (pSoldier->inv[bSlot].exists() == false) {
|
if (pSoldier->inv[bSlot].exists() == false) {
|
||||||
continue;
|
continue;
|
||||||
@@ -8744,11 +8750,11 @@ void CheckEquipmentForDamage( SOLDIERTYPE *pSoldier, INT32 iDamage )
|
|||||||
void CheckEquipmentForFragileItemDamage( SOLDIERTYPE *pSoldier, INT32 iDamage )
|
void CheckEquipmentForFragileItemDamage( SOLDIERTYPE *pSoldier, INT32 iDamage )
|
||||||
{
|
{
|
||||||
// glass jars etc can be damaged by falling over
|
// glass jars etc can be damaged by falling over
|
||||||
INT8 bSlot;
|
|
||||||
UINT8 ubNumberOfObjects;
|
UINT8 ubNumberOfObjects;
|
||||||
BOOLEAN fPlayedGlassBreak = FALSE;
|
BOOLEAN fPlayedGlassBreak = FALSE;
|
||||||
|
|
||||||
for (bSlot = 0; bSlot < (INT8) pSoldier->inv.size(); bSlot++)
|
UINT8 invsize = pSoldier->inv.size();
|
||||||
|
for (UINT8 bSlot = 0; bSlot < invsize; ++bSlot)
|
||||||
{
|
{
|
||||||
if (pSoldier->inv[bSlot].exists() == false) {
|
if (pSoldier->inv[bSlot].exists() == false) {
|
||||||
continue;
|
continue;
|
||||||
@@ -10912,7 +10918,7 @@ INT16 GetNightVisionRangeBonus( SOLDIERTYPE * pSoldier, UINT8 bLightLevel )
|
|||||||
//ADB and AXP 28.03.2007: CtH bug fix: We also want to check on a firing weapon, "raised" alone is not enough ;)
|
//ADB and AXP 28.03.2007: CtH bug fix: We also want to check on a firing weapon, "raised" alone is not enough ;)
|
||||||
bool usingGunScope = WeaponReady(pSoldier);
|
bool usingGunScope = WeaponReady(pSoldier);
|
||||||
// CHRISL:
|
// CHRISL:
|
||||||
for (int i = BODYPOSSTART; i < BODYPOSFINAL; i++)
|
for (int i = BODYPOSSTART; i < BODYPOSFINAL; ++i )
|
||||||
{
|
{
|
||||||
// More optimization
|
// More optimization
|
||||||
pObj = &( pSoldier->inv[i]);
|
pObj = &( pSoldier->inv[i]);
|
||||||
@@ -11327,17 +11333,16 @@ INT16 GetTotalVisionRangeBonus( SOLDIERTYPE * pSoldier, UINT8 bLightLevel )
|
|||||||
bonus += GetCaveVisionRangeBonus(pSoldier, bLightLevel);
|
bonus += GetCaveVisionRangeBonus(pSoldier, bLightLevel);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else if ( bLightLevel < NORMAL_LIGHTLEVEL_DAY )
|
||||||
|
{
|
||||||
|
bonus += GetBrightLightVisionRangeBonus(pSoldier, bLightLevel);
|
||||||
|
}
|
||||||
|
|
||||||
if ( bLightLevel < NORMAL_LIGHTLEVEL_NIGHT )
|
if ( bLightLevel < NORMAL_LIGHTLEVEL_NIGHT )
|
||||||
{
|
{
|
||||||
bonus += GetDayVisionRangeBonus(pSoldier, bLightLevel);
|
bonus += GetDayVisionRangeBonus(pSoldier, bLightLevel);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( bLightLevel < NORMAL_LIGHTLEVEL_DAY )
|
|
||||||
{
|
|
||||||
bonus += GetBrightLightVisionRangeBonus(pSoldier, bLightLevel);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Flugente: drugs can alter our sight
|
// Flugente: drugs can alter our sight
|
||||||
if ( pSoldier->drugs.bDrugEffect[ DRUG_TYPE_VISION ] )
|
if ( pSoldier->drugs.bDrugEffect[ DRUG_TYPE_VISION ] )
|
||||||
{
|
{
|
||||||
@@ -11918,9 +11923,8 @@ BOOLEAN EXPLOSIVE_GUN ( UINT16 x)
|
|||||||
|
|
||||||
INT8 FindRocketLauncherOrCannon( SOLDIERTYPE * pSoldier )
|
INT8 FindRocketLauncherOrCannon( SOLDIERTYPE * pSoldier )
|
||||||
{
|
{
|
||||||
INT8 bLoop;
|
INT8 invsize = (INT8)pSoldier->inv.size();
|
||||||
|
for ( INT8 bLoop = 0; bLoop < invsize; ++bLoop)
|
||||||
for (bLoop = 0; bLoop < (INT8) pSoldier->inv.size(); bLoop++)
|
|
||||||
{
|
{
|
||||||
if (pSoldier->inv[bLoop].exists() == true) {
|
if (pSoldier->inv[bLoop].exists() == true) {
|
||||||
if (Item[pSoldier->inv[bLoop].usItem].rocketlauncher || Item[pSoldier->inv[bLoop].usItem].cannon )
|
if (Item[pSoldier->inv[bLoop].usItem].rocketlauncher || Item[pSoldier->inv[bLoop].usItem].cannon )
|
||||||
@@ -11934,9 +11938,8 @@ INT8 FindRocketLauncherOrCannon( SOLDIERTYPE * pSoldier )
|
|||||||
|
|
||||||
INT8 FindRocketLauncher( SOLDIERTYPE * pSoldier )
|
INT8 FindRocketLauncher( SOLDIERTYPE * pSoldier )
|
||||||
{
|
{
|
||||||
INT8 bLoop;
|
INT8 invsize = (INT8)pSoldier->inv.size();
|
||||||
|
for ( INT8 bLoop = 0; bLoop < invsize; ++bLoop)
|
||||||
for (bLoop = 0; bLoop < (INT8) pSoldier->inv.size(); bLoop++)
|
|
||||||
{
|
{
|
||||||
if (pSoldier->inv[bLoop].exists() == true) {
|
if (pSoldier->inv[bLoop].exists() == true) {
|
||||||
if (Item[pSoldier->inv[bLoop].usItem].rocketlauncher )
|
if (Item[pSoldier->inv[bLoop].usItem].rocketlauncher )
|
||||||
@@ -11950,9 +11953,8 @@ INT8 FindRocketLauncher( SOLDIERTYPE * pSoldier )
|
|||||||
|
|
||||||
INT8 FindCannon( SOLDIERTYPE * pSoldier )
|
INT8 FindCannon( SOLDIERTYPE * pSoldier )
|
||||||
{
|
{
|
||||||
INT8 bLoop;
|
INT8 invsize = (INT8)pSoldier->inv.size();
|
||||||
|
for ( INT8 bLoop = 0; bLoop < invsize; ++bLoop)
|
||||||
for (bLoop = 0; bLoop < (INT8) pSoldier->inv.size(); bLoop++)
|
|
||||||
{
|
{
|
||||||
if (pSoldier->inv[bLoop].exists() == true) {
|
if (pSoldier->inv[bLoop].exists() == true) {
|
||||||
if ( Item[pSoldier->inv[bLoop].usItem].cannon )
|
if ( Item[pSoldier->inv[bLoop].usItem].cannon )
|
||||||
@@ -11967,11 +11969,12 @@ INT8 FindCannon( SOLDIERTYPE * pSoldier )
|
|||||||
INT8 FindUsableCrowbar( SOLDIERTYPE * pSoldier )
|
INT8 FindUsableCrowbar( SOLDIERTYPE * pSoldier )
|
||||||
{
|
{
|
||||||
//JMich_SkillModifiers: Adding a bonus check, to return the best crowbar, and modifying the return value.
|
//JMich_SkillModifiers: Adding a bonus check, to return the best crowbar, and modifying the return value.
|
||||||
INT8 bLoop, bonus, FoundCrowbar;
|
INT8 bonus, FoundCrowbar;
|
||||||
FoundCrowbar = NO_SLOT;
|
FoundCrowbar = NO_SLOT;
|
||||||
bonus = -101;
|
bonus = -101;
|
||||||
|
|
||||||
for (bLoop = 0; bLoop < (INT8) pSoldier->inv.size(); bLoop++)
|
INT8 invsize = (INT8)pSoldier->inv.size();
|
||||||
|
for ( INT8 bLoop = 0; bLoop < invsize; ++bLoop)
|
||||||
{
|
{
|
||||||
if (pSoldier->inv[bLoop].exists() == true) {
|
if (pSoldier->inv[bLoop].exists() == true) {
|
||||||
if ( Item[pSoldier->inv[bLoop].usItem].crowbar && pSoldier->inv[bLoop][0]->data.objectStatus >= USABLE && Item[pSoldier->inv[bLoop].usItem].CrowbarModifier > bonus)
|
if ( Item[pSoldier->inv[bLoop].usItem].crowbar && pSoldier->inv[bLoop][0]->data.objectStatus >= USABLE && Item[pSoldier->inv[bLoop].usItem].CrowbarModifier > bonus)
|
||||||
@@ -11996,11 +11999,11 @@ OBJECTTYPE* FindAttachedBatteries( OBJECTTYPE * pObj )
|
|||||||
}
|
}
|
||||||
return( 0 );
|
return( 0 );
|
||||||
}
|
}
|
||||||
|
|
||||||
INT8 FindToolkit( SOLDIERTYPE * pSoldier )
|
INT8 FindToolkit( SOLDIERTYPE * pSoldier )
|
||||||
{
|
{
|
||||||
INT8 bLoop;
|
INT8 invsize = (INT8)pSoldier->inv.size();
|
||||||
|
for ( INT8 bLoop = 0; bLoop < invsize; ++bLoop)
|
||||||
for (bLoop = 0; bLoop < (INT8) pSoldier->inv.size(); bLoop++)
|
|
||||||
{
|
{
|
||||||
if (pSoldier->inv[bLoop].exists() == true) {
|
if (pSoldier->inv[bLoop].exists() == true) {
|
||||||
if (Item[pSoldier->inv[bLoop].usItem].toolkit )
|
if (Item[pSoldier->inv[bLoop].usItem].toolkit )
|
||||||
@@ -12011,11 +12014,11 @@ INT8 FindToolkit( SOLDIERTYPE * pSoldier )
|
|||||||
}
|
}
|
||||||
return( NO_SLOT );
|
return( NO_SLOT );
|
||||||
}
|
}
|
||||||
|
|
||||||
INT8 FindMedKit( SOLDIERTYPE * pSoldier )
|
INT8 FindMedKit( SOLDIERTYPE * pSoldier )
|
||||||
{
|
{
|
||||||
INT8 bLoop;
|
INT8 invsize = (INT8)pSoldier->inv.size();
|
||||||
|
for ( INT8 bLoop = 0; bLoop < invsize; ++bLoop)
|
||||||
for (bLoop = 0; bLoop < (INT8) pSoldier->inv.size(); bLoop++)
|
|
||||||
{
|
{
|
||||||
if (pSoldier->inv[bLoop].exists() == true) {
|
if (pSoldier->inv[bLoop].exists() == true) {
|
||||||
if (Item[pSoldier->inv[bLoop].usItem].medicalkit )
|
if (Item[pSoldier->inv[bLoop].usItem].medicalkit )
|
||||||
@@ -12026,11 +12029,11 @@ INT8 FindMedKit( SOLDIERTYPE * pSoldier )
|
|||||||
}
|
}
|
||||||
return( NO_SLOT );
|
return( NO_SLOT );
|
||||||
}
|
}
|
||||||
|
|
||||||
INT8 FindFirstAidKit( SOLDIERTYPE * pSoldier )
|
INT8 FindFirstAidKit( SOLDIERTYPE * pSoldier )
|
||||||
{
|
{
|
||||||
INT8 bLoop;
|
INT8 invsize = (INT8)pSoldier->inv.size();
|
||||||
|
for ( INT8 bLoop = 0; bLoop < invsize; ++bLoop)
|
||||||
for (bLoop = 0; bLoop < (INT8) pSoldier->inv.size(); bLoop++)
|
|
||||||
{
|
{
|
||||||
if (pSoldier->inv[bLoop].exists() == true) {
|
if (pSoldier->inv[bLoop].exists() == true) {
|
||||||
if (Item[pSoldier->inv[bLoop].usItem].firstaidkit )
|
if (Item[pSoldier->inv[bLoop].usItem].firstaidkit )
|
||||||
@@ -12041,11 +12044,11 @@ INT8 FindFirstAidKit( SOLDIERTYPE * pSoldier )
|
|||||||
}
|
}
|
||||||
return( NO_SLOT );
|
return( NO_SLOT );
|
||||||
}
|
}
|
||||||
|
|
||||||
INT8 FindCamoKit( SOLDIERTYPE * pSoldier )
|
INT8 FindCamoKit( SOLDIERTYPE * pSoldier )
|
||||||
{
|
{
|
||||||
INT8 bLoop;
|
INT8 invsize = (INT8)pSoldier->inv.size();
|
||||||
|
for ( INT8 bLoop = 0; bLoop < invsize; ++bLoop)
|
||||||
for (bLoop = 0; bLoop < (INT8) pSoldier->inv.size(); bLoop++)
|
|
||||||
{
|
{
|
||||||
if (pSoldier->inv[bLoop].exists() == true) {
|
if (pSoldier->inv[bLoop].exists() == true) {
|
||||||
if (Item[pSoldier->inv[bLoop].usItem].camouflagekit )
|
if (Item[pSoldier->inv[bLoop].usItem].camouflagekit )
|
||||||
@@ -12056,14 +12059,16 @@ INT8 FindCamoKit( SOLDIERTYPE * pSoldier )
|
|||||||
}
|
}
|
||||||
return( NO_SLOT );
|
return( NO_SLOT );
|
||||||
}
|
}
|
||||||
|
|
||||||
//JMich_SkillModifiers: Adding a function to see if we have an item with disarm bonus
|
//JMich_SkillModifiers: Adding a function to see if we have an item with disarm bonus
|
||||||
INT8 FindDisarmKit( SOLDIERTYPE * pSoldier )
|
INT8 FindDisarmKit( SOLDIERTYPE * pSoldier )
|
||||||
{
|
{
|
||||||
INT8 bLoop, bonus, FoundKit;
|
INT8 bonus, FoundKit;
|
||||||
FoundKit = NO_SLOT;
|
FoundKit = NO_SLOT;
|
||||||
bonus = 0;
|
bonus = 0;
|
||||||
|
|
||||||
for (bLoop = 0; bLoop < (INT8) pSoldier->inv.size(); bLoop++)
|
INT8 invsize = (INT8)pSoldier->inv.size();
|
||||||
|
for ( INT8 bLoop = 0; bLoop < invsize; ++bLoop)
|
||||||
{
|
{
|
||||||
if (pSoldier->inv[bLoop].exists() == true) {
|
if (pSoldier->inv[bLoop].exists() == true) {
|
||||||
if ( ( ( Item[pSoldier->inv[bLoop].usItem].DisarmModifier * pSoldier->inv[bLoop][0]->data.objectStatus ) / 100 ) > bonus )
|
if ( ( ( Item[pSoldier->inv[bLoop].usItem].DisarmModifier * pSoldier->inv[bLoop][0]->data.objectStatus ) / 100 ) > bonus )
|
||||||
@@ -12075,17 +12080,20 @@ INT8 FindDisarmKit( SOLDIERTYPE * pSoldier )
|
|||||||
}
|
}
|
||||||
return( FoundKit );
|
return( FoundKit );
|
||||||
}
|
}
|
||||||
|
|
||||||
INT8 FindLocksmithKit( SOLDIERTYPE * pSoldier )
|
INT8 FindLocksmithKit( SOLDIERTYPE * pSoldier )
|
||||||
{
|
{
|
||||||
//JMich_SkillModifiers: Adding a bonus check, to return the best LocksmithKit, and modifying the return value.
|
//JMich_SkillModifiers: Adding a bonus check, to return the best LocksmithKit, and modifying the return value.
|
||||||
INT8 bLoop, bonus, FoundKit;
|
INT8 bonus, FoundKit;
|
||||||
FoundKit = NO_SLOT;
|
FoundKit = NO_SLOT;
|
||||||
bonus = -101;
|
bonus = -101;
|
||||||
|
|
||||||
for (bLoop = 0; bLoop < (INT8) pSoldier->inv.size(); bLoop++)
|
INT8 invsize = (INT8)pSoldier->inv.size();
|
||||||
|
for ( INT8 bLoop = 0; bLoop < invsize; ++bLoop)
|
||||||
{
|
{
|
||||||
if (pSoldier->inv[bLoop].exists() == true) {
|
if (pSoldier->inv[bLoop].exists() == true)
|
||||||
if (Item[pSoldier->inv[bLoop].usItem].locksmithkit )
|
{
|
||||||
|
if (Item[pSoldier->inv[bLoop].usItem].locksmithkit )
|
||||||
{
|
{
|
||||||
//JMich_SkillModifiers: If the locksmith kit has a bonus, reduce it based on the status, so we use the best bonus.
|
//JMich_SkillModifiers: If the locksmith kit has a bonus, reduce it based on the status, so we use the best bonus.
|
||||||
if (Item[pSoldier->inv[bLoop].usItem].LockPickModifier > 0 )
|
if (Item[pSoldier->inv[bLoop].usItem].LockPickModifier > 0 )
|
||||||
@@ -12094,9 +12102,9 @@ INT8 FindLocksmithKit( SOLDIERTYPE * pSoldier )
|
|||||||
{
|
{
|
||||||
bonus = ( Item[pSoldier->inv[bLoop].usItem].LockPickModifier * pSoldier->inv[bLoop][0]->data.objectStatus / 100 );
|
bonus = ( Item[pSoldier->inv[bLoop].usItem].LockPickModifier * pSoldier->inv[bLoop][0]->data.objectStatus / 100 );
|
||||||
FoundKit = bLoop;
|
FoundKit = bLoop;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
//JMich_SkillModifiers: If on the other hand the locksmith is a shoddy one, keep that penalty regardless of status.
|
//JMich_SkillModifiers: If on the other hand the locksmith is a shoddy one, keep that penalty regardless of status.
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -12104,18 +12112,17 @@ INT8 FindLocksmithKit( SOLDIERTYPE * pSoldier )
|
|||||||
{
|
{
|
||||||
bonus = Item[pSoldier->inv[bLoop].usItem].LockPickModifier;
|
bonus = Item[pSoldier->inv[bLoop].usItem].LockPickModifier;
|
||||||
FoundKit = bLoop;
|
FoundKit = bLoop;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return( FoundKit );
|
return( FoundKit );
|
||||||
}
|
}
|
||||||
|
|
||||||
INT8 FindWalkman( SOLDIERTYPE * pSoldier )
|
INT8 FindWalkman( SOLDIERTYPE * pSoldier )
|
||||||
{
|
{
|
||||||
INT8 bLoop;
|
for (INT8 bLoop = BODYPOSSTART; bLoop < BODYPOSFINAL; bLoop++)
|
||||||
|
|
||||||
for (bLoop = BODYPOSSTART; bLoop < BODYPOSFINAL; bLoop++)
|
|
||||||
{
|
{
|
||||||
if (pSoldier->inv[bLoop].exists() == true) {
|
if (pSoldier->inv[bLoop].exists() == true) {
|
||||||
if (Item[pSoldier->inv[bLoop].usItem].walkman )
|
if (Item[pSoldier->inv[bLoop].usItem].walkman )
|
||||||
@@ -12126,14 +12133,15 @@ INT8 FindWalkman( SOLDIERTYPE * pSoldier )
|
|||||||
}
|
}
|
||||||
return( NO_SLOT );
|
return( NO_SLOT );
|
||||||
}
|
}
|
||||||
|
|
||||||
INT8 FindTrigger( SOLDIERTYPE * pSoldier )
|
INT8 FindTrigger( SOLDIERTYPE * pSoldier )
|
||||||
{
|
{
|
||||||
INT8 bLoop;
|
INT8 invsize = (INT8)pSoldier->inv.size();
|
||||||
|
for ( INT8 bLoop = 0; bLoop < invsize; ++bLoop)
|
||||||
for (bLoop = 0; bLoop < (INT8) pSoldier->inv.size(); bLoop++)
|
|
||||||
{
|
{
|
||||||
if (pSoldier->inv[bLoop].exists() == true) {
|
if (pSoldier->inv[bLoop].exists() == true)
|
||||||
if (Item[pSoldier->inv[bLoop].usItem].remotetrigger )
|
{
|
||||||
|
if (Item[pSoldier->inv[bLoop].usItem].remotetrigger )
|
||||||
{
|
{
|
||||||
return( bLoop );
|
return( bLoop );
|
||||||
}
|
}
|
||||||
@@ -12141,11 +12149,10 @@ INT8 FindTrigger( SOLDIERTYPE * pSoldier )
|
|||||||
}
|
}
|
||||||
return( NO_SLOT );
|
return( NO_SLOT );
|
||||||
}
|
}
|
||||||
|
|
||||||
INT8 FindRemoteControl( SOLDIERTYPE * pSoldier )
|
INT8 FindRemoteControl( SOLDIERTYPE * pSoldier )
|
||||||
{
|
{
|
||||||
INT8 bLoop;
|
for (INT8 bLoop = BODYPOSSTART; bLoop < BODYPOSFINAL; ++bLoop)
|
||||||
|
|
||||||
for (bLoop = BODYPOSSTART; bLoop < BODYPOSFINAL; bLoop++)
|
|
||||||
{
|
{
|
||||||
if (pSoldier->inv[bLoop].exists() == true) {
|
if (pSoldier->inv[bLoop].exists() == true) {
|
||||||
if (Item[pSoldier->inv[bLoop].usItem].robotremotecontrol )
|
if (Item[pSoldier->inv[bLoop].usItem].robotremotecontrol )
|
||||||
@@ -12162,7 +12169,7 @@ UINT16 LowestLaunchableCoolness(UINT16 launcherIndex)
|
|||||||
UINT16 i = 0;
|
UINT16 i = 0;
|
||||||
UINT16 lowestCoolness = 999;
|
UINT16 lowestCoolness = 999;
|
||||||
|
|
||||||
for( i = 0; i < MAXITEMS; i++ )
|
for( i = 0; i < MAXITEMS; ++i )
|
||||||
{
|
{
|
||||||
if ( Item[i].usItemClass == 0 )
|
if ( Item[i].usItemClass == 0 )
|
||||||
break;
|
break;
|
||||||
@@ -12186,7 +12193,7 @@ UINT16 PickARandomLaunchable(UINT16 itemIndex)
|
|||||||
// WANNE: This should fix the hang on the merc positioning screen (fix by Razer)
|
// WANNE: This should fix the hang on the merc positioning screen (fix by Razer)
|
||||||
//while( !usNumMatches )
|
//while( !usNumMatches )
|
||||||
{ //Count the number of valid launchables
|
{ //Count the number of valid launchables
|
||||||
for( i = 0; i < MAXITEMS; i++ )
|
for( i = 0; i < MAXITEMS; ++i )
|
||||||
{
|
{
|
||||||
if ( Item[i].usItemClass == 0 )
|
if ( Item[i].usItemClass == 0 )
|
||||||
break;
|
break;
|
||||||
@@ -12199,7 +12206,7 @@ UINT16 PickARandomLaunchable(UINT16 itemIndex)
|
|||||||
if( usNumMatches )
|
if( usNumMatches )
|
||||||
{
|
{
|
||||||
usRandom = (UINT16)Random( usNumMatches );
|
usRandom = (UINT16)Random( usNumMatches );
|
||||||
for( i = 0; i < MAXITEMS; i++ )
|
for( i = 0; i < MAXITEMS; ++i )
|
||||||
{
|
{
|
||||||
if ( Item[i].usItemClass == 0 )
|
if ( Item[i].usItemClass == 0 )
|
||||||
break;
|
break;
|
||||||
@@ -13437,7 +13444,7 @@ INT16 GetWornStealth( SOLDIERTYPE * pSoldier )
|
|||||||
INT8 bLoop;
|
INT8 bLoop;
|
||||||
INT16 ttl=0;
|
INT16 ttl=0;
|
||||||
|
|
||||||
for (bLoop = HELMETPOS; bLoop <= LEGPOS; bLoop++)
|
for (bLoop = HELMETPOS; bLoop <= LEGPOS; ++bLoop)
|
||||||
{
|
{
|
||||||
if ( pSoldier->inv[bLoop].exists() == true )
|
if ( pSoldier->inv[bLoop].exists() == true )
|
||||||
ttl += GetStealthBonus(&pSoldier->inv[bLoop]);
|
ttl += GetStealthBonus(&pSoldier->inv[bLoop]);
|
||||||
@@ -14049,7 +14056,7 @@ BOOLEAN UseTotalMedicalKitPoints( SOLDIERTYPE * pSoldier, UINT16 usPointsToConsu
|
|||||||
|
|
||||||
// add up kit points of all medkits
|
// add up kit points of all medkits
|
||||||
// CHRISL: Changed to dynamically determine max inventory locations.
|
// CHRISL: Changed to dynamically determine max inventory locations.
|
||||||
for (ubPocket = HANDPOS; ubPocket < NUM_INV_SLOTS; ubPocket++)
|
for (ubPocket = HANDPOS; ubPocket < NUM_INV_SLOTS; ++ubPocket)
|
||||||
{
|
{
|
||||||
if ( IsMedicalKitItem( &( pSoldier->inv[ ubPocket ] ) ) )
|
if ( IsMedicalKitItem( &( pSoldier->inv[ ubPocket ] ) ) )
|
||||||
{
|
{
|
||||||
@@ -15277,7 +15284,8 @@ UINT8 GetInventorySleepModifier( SOLDIERTYPE *pSoldier )
|
|||||||
{
|
{
|
||||||
UINT8 modifier = 0;
|
UINT8 modifier = 0;
|
||||||
|
|
||||||
for ( UINT8 i = 0; i < pSoldier->inv.size(); i++ )
|
UINT8 invsize = pSoldier->inv.size();
|
||||||
|
for ( UINT8 i = 0; i < invsize; ++i )
|
||||||
{
|
{
|
||||||
if( pSoldier->inv[ i ].exists() == true && Item[ pSoldier->inv[i].usItem ].ubSleepModifier > 0 )
|
if( pSoldier->inv[ i ].exists() == true && Item[ pSoldier->inv[i].usItem ].ubSleepModifier > 0 )
|
||||||
{
|
{
|
||||||
|
|||||||
+3
-4
@@ -194,9 +194,8 @@ BOOLEAN KeyExistsInKeyRing( SOLDIERTYPE *pSoldier, UINT8 ubKeyID, UINT8 * pubPos
|
|||||||
|
|
||||||
BOOLEAN KeyExistsInInventory( SOLDIERTYPE *pSoldier, UINT8 ubKeyID )
|
BOOLEAN KeyExistsInInventory( SOLDIERTYPE *pSoldier, UINT8 ubKeyID )
|
||||||
{
|
{
|
||||||
UINT8 ubLoop;
|
UINT8 invsize = pSoldier->inv.size();
|
||||||
|
for (UINT8 ubLoop = 0; ubLoop < invsize; ++ubLoop)
|
||||||
for (ubLoop = 0; ubLoop < pSoldier->inv.size(); ubLoop++)
|
|
||||||
{
|
{
|
||||||
if (Item[pSoldier->inv[ubLoop].usItem].usItemClass == IC_KEY)
|
if (Item[pSoldier->inv[ubLoop].usItem].usItemClass == IC_KEY)
|
||||||
{
|
{
|
||||||
@@ -742,7 +741,7 @@ BOOLEAN AttemptToBlowUpLock( SOLDIERTYPE * pSoldier, DOOR * pDoor )
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Flugente: flat bonus to using door breaching charges
|
// Flugente: flat bonus to using door breaching charges
|
||||||
iResult = SkillCheck( pSoldier, PLANTING_BOMB_CHECK, pSoldier->GetBackgroundValue(BG_BONUS_BREACHINGCHARGE) );
|
iResult = SkillCheck( pSoldier, PLANTING_BOMB_CHECK, (INT8)pSoldier->GetBackgroundValue(BG_BONUS_BREACHINGCHARGE) );
|
||||||
if (iResult >= -20)
|
if (iResult >= -20)
|
||||||
{
|
{
|
||||||
// Do explosive graphic....
|
// Do explosive graphic....
|
||||||
|
|||||||
@@ -271,7 +271,7 @@ void UpdateOldVersionMap()
|
|||||||
{
|
{
|
||||||
gMapInformation.ubMapVersion++;
|
gMapInformation.ubMapVersion++;
|
||||||
//6) Change all doors to FIRSTDOOR
|
//6) Change all doors to FIRSTDOOR
|
||||||
for( i = 0; i < WORLD_MAX; i++ )
|
for( i = 0; i < WORLD_MAX; ++i )
|
||||||
{
|
{
|
||||||
//NOTE: Here are the index values for the various doors
|
//NOTE: Here are the index values for the various doors
|
||||||
//DOOR OPEN CLOSED
|
//DOOR OPEN CLOSED
|
||||||
@@ -348,7 +348,8 @@ void UpdateOldVersionMap()
|
|||||||
//Bug #04) Assign enemy mercs default army color code if applicable
|
//Bug #04) Assign enemy mercs default army color code if applicable
|
||||||
if( curr->pDetailedPlacement )
|
if( curr->pDetailedPlacement )
|
||||||
{
|
{
|
||||||
for( i = 0; i < curr->pDetailedPlacement->Inv.size(); i++ )
|
INT32 invsize = (INT32)curr->pDetailedPlacement->Inv.size();
|
||||||
|
for( i = 0; i < invsize; ++i )
|
||||||
{ //make all items undroppable, even if it is empty. This will allow for
|
{ //make all items undroppable, even if it is empty. This will allow for
|
||||||
//random item generation, while empty, droppable slots are locked as empty
|
//random item generation, while empty, droppable slots are locked as empty
|
||||||
//during random item generation.
|
//during random item generation.
|
||||||
@@ -476,7 +477,7 @@ void UpdateOldVersionMap()
|
|||||||
}
|
}
|
||||||
if( gMapInformation.ubMapVersion < 13 )
|
if( gMapInformation.ubMapVersion < 13 )
|
||||||
{ //replace all merc ammo inventory slots status value with the max ammo that the clip can hold.
|
{ //replace all merc ammo inventory slots status value with the max ammo that the clip can hold.
|
||||||
INT32 i, cnt;
|
INT32 cnt;
|
||||||
OBJECTTYPE *pItem;
|
OBJECTTYPE *pItem;
|
||||||
gMapInformation.ubMapVersion++;
|
gMapInformation.ubMapVersion++;
|
||||||
//Bug 10) Padding on detailed placements is uninitialized. Clear all data starting at
|
//Bug 10) Padding on detailed placements is uninitialized. Clear all data starting at
|
||||||
@@ -486,12 +487,13 @@ void UpdateOldVersionMap()
|
|||||||
{
|
{
|
||||||
if( curr->pDetailedPlacement )
|
if( curr->pDetailedPlacement )
|
||||||
{
|
{
|
||||||
for ( i = 0; i < curr->pDetailedPlacement->Inv.size(); i++ )
|
UINT32 invsize = curr->pDetailedPlacement->Inv.size();
|
||||||
|
for ( UINT32 i = 0; i < invsize; ++i )
|
||||||
{
|
{
|
||||||
pItem = &curr->pDetailedPlacement->Inv[ i ];
|
pItem = &curr->pDetailedPlacement->Inv[ i ];
|
||||||
if( Item[ pItem->usItem ].usItemClass & IC_AMMO )
|
if( Item[ pItem->usItem ].usItemClass & IC_AMMO )
|
||||||
{
|
{
|
||||||
for( cnt = 0; cnt < pItem->ubNumberOfObjects; cnt++ )
|
for( cnt = 0; cnt < pItem->ubNumberOfObjects; ++cnt )
|
||||||
{
|
{
|
||||||
pItem->shots.ubShotsLeft[ cnt ] = Magazine[ Item[ pItem->usItem ].ubClassIndex ].ubMagSize;
|
pItem->shots.ubShotsLeft[ cnt ] = Magazine[ Item[ pItem->usItem ].ubClassIndex ].ubMagSize;
|
||||||
}
|
}
|
||||||
@@ -571,7 +573,8 @@ void UpdateOldVersionMap()
|
|||||||
{
|
{
|
||||||
if( curr->pDetailedPlacement )
|
if( curr->pDetailedPlacement )
|
||||||
{
|
{
|
||||||
for( UINT32 i = 0; i < curr->pDetailedPlacement->Inv.size(); i++ )
|
UINT32 invsize = curr->pDetailedPlacement->Inv.size();
|
||||||
|
for( UINT32 i = 0; i < invsize; ++i )
|
||||||
{
|
{
|
||||||
if( !curr->pDetailedPlacement->Inv[ i ].usItem )
|
if( !curr->pDetailedPlacement->Inv[ i ].usItem )
|
||||||
{
|
{
|
||||||
@@ -645,7 +648,8 @@ void AutoCalculateItemNoOverwriteStatus()
|
|||||||
{
|
{
|
||||||
if( curr->pDetailedPlacement )
|
if( curr->pDetailedPlacement )
|
||||||
{
|
{
|
||||||
for( UINT32 i = 0; i < curr->pDetailedPlacement->Inv.size(); i++ )
|
UINT32 invsize = curr->pDetailedPlacement->Inv.size();
|
||||||
|
for( UINT32 i = 0; i < invsize; ++i )
|
||||||
{
|
{
|
||||||
pItem = &curr->pDetailedPlacement->Inv[ i ];
|
pItem = &curr->pDetailedPlacement->Inv[ i ];
|
||||||
if( pItem->exists() == true )
|
if( pItem->exists() == true )
|
||||||
|
|||||||
+73
-95
@@ -4990,7 +4990,7 @@ BOOLEAN TeamMemberNear(INT8 bTeam, INT32 sGridNo, INT32 iRange)
|
|||||||
UINT8 bLoop;
|
UINT8 bLoop;
|
||||||
SOLDIERTYPE * pSoldier;
|
SOLDIERTYPE * pSoldier;
|
||||||
|
|
||||||
for (bLoop=gTacticalStatus.Team[bTeam].bFirstID, pSoldier=MercPtrs[bLoop]; bLoop <= gTacticalStatus.Team[bTeam].bLastID; bLoop++, pSoldier++)
|
for (bLoop=gTacticalStatus.Team[bTeam].bFirstID, pSoldier=MercPtrs[bLoop]; bLoop <= gTacticalStatus.Team[bTeam].bLastID; ++bLoop, pSoldier++)
|
||||||
{
|
{
|
||||||
if (pSoldier->bActive && pSoldier->bInSector && (pSoldier->stats.bLife >= OKLIFE) && !( pSoldier->flags.uiStatusFlags & SOLDIER_GASSED ) )
|
if (pSoldier->bActive && pSoldier->bInSector && (pSoldier->stats.bLife >= OKLIFE) && !( pSoldier->flags.uiStatusFlags & SOLDIER_GASSED ) )
|
||||||
{
|
{
|
||||||
@@ -5042,52 +5042,47 @@ INT32 FindAdjacentGridEx( SOLDIERTYPE *pSoldier, INT32 sGridNo, UINT8 *pubDirect
|
|||||||
*psAdjustedGridNo = sGridNo;
|
*psAdjustedGridNo = sGridNo;
|
||||||
}
|
}
|
||||||
|
|
||||||
// CHECK IF IT'S THE SAME ONE AS WE'RE ON, IF SO, RETURN THAT!
|
// Flugente: change condition order
|
||||||
if ( pSoldier->sGridNo == sGridNo && !FindStructure( sGridNo, ( STRUCTURE_SWITCH ) ) )
|
// OK, if we are looking for a door, it may be in the same tile as us, so find the direction we
|
||||||
{
|
// have to face to get to the door, not just our initial direction...
|
||||||
// OK, if we are looking for a door, it may be in the same tile as us, so find the direction we
|
// If we are in the same tile as a switch, we can NEVER pull it....
|
||||||
// have to face to get to the door, not just our initial direction...
|
if (pubDirection && fDoor )
|
||||||
// If we are in the same tile as a switch, we can NEVER pull it....
|
{
|
||||||
if( fDoor )
|
// CHECK IF IT'S THE SAME ONE AS WE'RE ON, IF SO, RETURN THAT!
|
||||||
{
|
if ( pSoldier->sGridNo == sGridNo && !FindStructure( sGridNo, ( STRUCTURE_SWITCH ) ) )
|
||||||
// This can only happen if a door was to the south to east of us!
|
{
|
||||||
|
// This can only happen if a door was to the south to east of us!
|
||||||
|
|
||||||
// Do south!
|
// Do south!
|
||||||
//sSpot = NewGridNo( sGridNo, DirectionInc( SOUTH ) );
|
//sSpot = NewGridNo( sGridNo, DirectionInc( SOUTH ) );
|
||||||
|
|
||||||
// ATE: Added: Switch behave EXACTLY like doors
|
// ATE: Added: Switch behave EXACTLY like doors
|
||||||
pDoor = FindStructure( sGridNo, ( STRUCTURE_ANYDOOR ) );
|
pDoor = FindStructure( sGridNo, ( STRUCTURE_ANYDOOR ) );
|
||||||
|
|
||||||
if ( pDoor != NULL )
|
if ( pDoor != NULL )
|
||||||
{
|
{
|
||||||
// Get orinetation
|
// Get orinetation
|
||||||
ubWallOrientation = pDoor->ubWallOrientation;
|
ubWallOrientation = pDoor->ubWallOrientation;
|
||||||
|
|
||||||
if ( ubWallOrientation == OUTSIDE_TOP_LEFT || ubWallOrientation == INSIDE_TOP_LEFT )
|
if ( ubWallOrientation == OUTSIDE_TOP_LEFT || ubWallOrientation == INSIDE_TOP_LEFT )
|
||||||
{
|
{
|
||||||
// To the south!
|
// To the south!
|
||||||
sSpot = NewGridNo( sGridNo, DirectionInc( SOUTH ) );
|
sSpot = NewGridNo( sGridNo, DirectionInc( SOUTH ) );
|
||||||
if (pubDirection)
|
(*pubDirection) = (UINT8)GetDirectionFromGridNo( sSpot, pSoldier );
|
||||||
{
|
}
|
||||||
(*pubDirection) = (UINT8)GetDirectionFromGridNo( sSpot, pSoldier );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if ( ubWallOrientation == OUTSIDE_TOP_RIGHT || ubWallOrientation == INSIDE_TOP_RIGHT )
|
if ( ubWallOrientation == OUTSIDE_TOP_RIGHT || ubWallOrientation == INSIDE_TOP_RIGHT )
|
||||||
{
|
{
|
||||||
// TO the east!
|
// TO the east!
|
||||||
sSpot = NewGridNo( sGridNo, DirectionInc( EAST ) );
|
sSpot = NewGridNo( sGridNo, DirectionInc( EAST ) );
|
||||||
if (pubDirection)
|
(*pubDirection) = (UINT8)GetDirectionFromGridNo( sSpot, pSoldier );
|
||||||
{
|
}
|
||||||
(*pubDirection) = (UINT8)GetDirectionFromGridNo( sSpot, pSoldier );
|
}
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Use soldier's direction
|
// Use soldier's direction
|
||||||
return( sGridNo );
|
return( sGridNo );
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Look for a door!
|
// Look for a door!
|
||||||
if (fDoor)
|
if (fDoor)
|
||||||
@@ -5101,20 +5096,20 @@ INT32 FindAdjacentGridEx( SOLDIERTYPE *pSoldier, INT32 sGridNo, UINT8 *pubDirect
|
|||||||
|
|
||||||
if ( fForceToPerson )
|
if ( fForceToPerson )
|
||||||
{
|
{
|
||||||
if ( FindSoldier( sGridNo, &usSoldierIndex, &uiMercFlags, FIND_SOLDIER_GRIDNO ) )
|
if ( psAdjustedGridNo != NULL )
|
||||||
{
|
{
|
||||||
sGridNo = MercPtrs[ usSoldierIndex ]->sGridNo;
|
if ( FindSoldier( sGridNo, &usSoldierIndex, &uiMercFlags, FIND_SOLDIER_GRIDNO ) )
|
||||||
if ( psAdjustedGridNo != NULL )
|
{
|
||||||
{
|
sGridNo = MercPtrs[ usSoldierIndex ]->sGridNo;
|
||||||
*psAdjustedGridNo = sGridNo;
|
*psAdjustedGridNo = sGridNo;
|
||||||
|
|
||||||
// Use direction to this guy!
|
// Use direction to this guy!
|
||||||
if (pubDirection)
|
if (pubDirection)
|
||||||
{
|
{
|
||||||
(*pubDirection) = (UINT8)GetDirectionFromGridNo( sGridNo, pSoldier );
|
(*pubDirection) = (UINT8)GetDirectionFromGridNo( sGridNo, pSoldier );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -5137,25 +5132,22 @@ INT32 FindAdjacentGridEx( SOLDIERTYPE *pSoldier, INT32 sGridNo, UINT8 *pubDirect
|
|||||||
fCheckGivenGridNo = FALSE;
|
fCheckGivenGridNo = FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if ( fCheckGivenGridNo )
|
if ( fCheckGivenGridNo )
|
||||||
{
|
{
|
||||||
sDistance = PlotPath( pSoldier, sGridNo, NO_COPYROUTE, NO_PLOT, TEMPORARY, (INT16)pSoldier->usUIMovementMode, NOT_STEALTH, FORWARD, pSoldier->bActionPoints );
|
sDistance = PlotPath( pSoldier, sGridNo, NO_COPYROUTE, NO_PLOT, TEMPORARY, (INT16)pSoldier->usUIMovementMode, NOT_STEALTH, FORWARD, pSoldier->bActionPoints );
|
||||||
|
|
||||||
if ( sDistance > 0 )
|
if ( sDistance > 0 )
|
||||||
{
|
{
|
||||||
|
|
||||||
if ( sDistance < sClosest )
|
if ( sDistance < sClosest )
|
||||||
{
|
{
|
||||||
sClosest = sDistance;
|
sClosest = sDistance;
|
||||||
sCloseGridNo = sGridNo;
|
sCloseGridNo = sGridNo;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
for (INT8 cnt = 0; cnt < 4; ++cnt)
|
||||||
for (INT8 cnt = 0; cnt < 4; cnt++)
|
|
||||||
{
|
{
|
||||||
// MOVE OUT TWO DIRECTIONS
|
// MOVE OUT TWO DIRECTIONS
|
||||||
sFourGrids[cnt] = sSpot = NewGridNo( sGridNo, DirectionInc( sDirs[ cnt ] ) );
|
sFourGrids[cnt] = sSpot = NewGridNo( sGridNo, DirectionInc( sDirs[ cnt ] ) );
|
||||||
@@ -5284,12 +5276,13 @@ INT32 FindAdjacentGridEx( SOLDIERTYPE *pSoldier, INT32 sGridNo, UINT8 *pubDirect
|
|||||||
//}
|
//}
|
||||||
if ( TileIsOutOfBounds( sCloseGridNo ) )
|
if ( TileIsOutOfBounds( sCloseGridNo ) )
|
||||||
{
|
{
|
||||||
return( -1 );
|
return( NOWHERE );
|
||||||
}
|
}
|
||||||
|
|
||||||
return( sCloseGridNo );
|
return( sCloseGridNo );
|
||||||
}
|
}
|
||||||
else
|
|
||||||
return( -1 );
|
return( NOWHERE );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -5340,15 +5333,12 @@ INT32 FindNextToAdjacentGridEx( SOLDIERTYPE *pSoldier, INT32 sGridNo, UINT8 *pub
|
|||||||
pDoor = NULL;
|
pDoor = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( fForceToPerson )
|
if ( fForceToPerson && psAdjustedGridNo != NULL )
|
||||||
{
|
{
|
||||||
if ( FindSoldier( sGridNo, &usSoldierIndex, &uiMercFlags, FIND_SOLDIER_GRIDNO ) )
|
if ( FindSoldier( sGridNo, &usSoldierIndex, &uiMercFlags, FIND_SOLDIER_GRIDNO ) )
|
||||||
{
|
{
|
||||||
sGridNo = MercPtrs[ usSoldierIndex ]->sGridNo;
|
sGridNo = MercPtrs[ usSoldierIndex ]->sGridNo;
|
||||||
if ( psAdjustedGridNo != NULL )
|
*psAdjustedGridNo = sGridNo;
|
||||||
{
|
|
||||||
*psAdjustedGridNo = sGridNo;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -5371,7 +5361,6 @@ INT32 FindNextToAdjacentGridEx( SOLDIERTYPE *pSoldier, INT32 sGridNo, UINT8 *pub
|
|||||||
|
|
||||||
if ( sDistance > 0 )
|
if ( sDistance > 0 )
|
||||||
{
|
{
|
||||||
|
|
||||||
if ( sDistance < sClosest )
|
if ( sDistance < sClosest )
|
||||||
{
|
{
|
||||||
sClosest = sDistance;
|
sClosest = sDistance;
|
||||||
@@ -5513,12 +5502,13 @@ INT32 FindNextToAdjacentGridEx( SOLDIERTYPE *pSoldier, INT32 sGridNo, UINT8 *pub
|
|||||||
|
|
||||||
if (TileIsOutOfBounds(sCloseGridNo))
|
if (TileIsOutOfBounds(sCloseGridNo))
|
||||||
{
|
{
|
||||||
return( -1 );
|
return( NOWHERE );
|
||||||
}
|
}
|
||||||
|
|
||||||
return( sCloseGridNo );
|
return( sCloseGridNo );
|
||||||
}
|
}
|
||||||
else
|
|
||||||
return( -1 );
|
return( NOWHERE );
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -5564,7 +5554,7 @@ INT32 FindAdjacentPunchTarget( SOLDIERTYPE * pSoldier, SOLDIERTYPE * pTargetSold
|
|||||||
INT32 sSpot;
|
INT32 sSpot;
|
||||||
UINT8 ubGuyThere;
|
UINT8 ubGuyThere;
|
||||||
|
|
||||||
for ( INT8 cnt = 0; cnt < NUM_WORLD_DIRECTIONS; cnt++ )
|
for ( UINT8 cnt = 0; cnt < NUM_WORLD_DIRECTIONS; ++cnt )
|
||||||
{
|
{
|
||||||
sSpot = NewGridNo( pSoldier->sGridNo, DirectionInc( cnt ) );
|
sSpot = NewGridNo( pSoldier->sGridNo, DirectionInc( cnt ) );
|
||||||
|
|
||||||
@@ -5582,7 +5572,7 @@ INT32 FindAdjacentPunchTarget( SOLDIERTYPE * pSoldier, SOLDIERTYPE * pTargetSold
|
|||||||
// We've got a guy here....
|
// We've got a guy here....
|
||||||
// Who is the one we want......
|
// Who is the one we want......
|
||||||
*psAdjustedTargetGridNo = pTargetSoldier->sGridNo;
|
*psAdjustedTargetGridNo = pTargetSoldier->sGridNo;
|
||||||
*pubDirection = ( UINT8 )cnt;
|
*pubDirection = cnt;
|
||||||
return( sSpot );
|
return( sSpot );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -5605,7 +5595,6 @@ BOOLEAN UIOKMoveDestination( SOLDIERTYPE *pSoldier, INT32 usMapPos )
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if ( !NewOKDestination( pSoldier, usMapPos, FALSE, (INT8) gsInterfaceLevel ) )
|
if ( !NewOKDestination( pSoldier, usMapPos, FALSE, (INT8) gsInterfaceLevel ) )
|
||||||
{
|
{
|
||||||
return( FALSE );
|
return( FALSE );
|
||||||
@@ -5626,8 +5615,7 @@ BOOLEAN UIOKMoveDestination( SOLDIERTYPE *pSoldier, INT32 usMapPos )
|
|||||||
//{
|
//{
|
||||||
// return( FALSE );
|
// return( FALSE );
|
||||||
//}
|
//}
|
||||||
|
|
||||||
|
|
||||||
return( TRUE);
|
return( TRUE);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -5637,7 +5625,7 @@ void HandleTeamServices( UINT8 ubTeamNum )
|
|||||||
INT32 cnt;
|
INT32 cnt;
|
||||||
SOLDIERTYPE *pTeamSoldier, *pTargetSoldier;
|
SOLDIERTYPE *pTeamSoldier, *pTargetSoldier;
|
||||||
UINT32 uiPointsUsed;
|
UINT32 uiPointsUsed;
|
||||||
UINT16 usSoldierIndex, usInHand;
|
UINT16 usSoldierIndex;
|
||||||
UINT16 usKitPts;
|
UINT16 usKitPts;
|
||||||
INT8 bSlot;
|
INT8 bSlot;
|
||||||
BOOLEAN fDone;
|
BOOLEAN fDone;
|
||||||
@@ -5646,7 +5634,7 @@ void HandleTeamServices( UINT8 ubTeamNum )
|
|||||||
cnt = gTacticalStatus.Team[ ubTeamNum ].bFirstID;
|
cnt = gTacticalStatus.Team[ ubTeamNum ].bFirstID;
|
||||||
|
|
||||||
// look for all mercs on the same team,
|
// look for all mercs on the same team,
|
||||||
for ( pTeamSoldier = MercPtrs[ cnt ]; cnt <= gTacticalStatus.Team[ ubTeamNum ].bLastID; cnt++,pTeamSoldier++)
|
for ( pTeamSoldier = MercPtrs[ cnt ]; cnt <= gTacticalStatus.Team[ ubTeamNum ].bLastID; ++cnt, pTeamSoldier++)
|
||||||
{
|
{
|
||||||
if ( pTeamSoldier->stats.bLife >= OKLIFE && pTeamSoldier->bActive && pTeamSoldier->bInSector )
|
if ( pTeamSoldier->stats.bLife >= OKLIFE && pTeamSoldier->bActive && pTeamSoldier->bInSector )
|
||||||
{
|
{
|
||||||
@@ -5654,10 +5642,7 @@ void HandleTeamServices( UINT8 ubTeamNum )
|
|||||||
// Check for different events!
|
// Check for different events!
|
||||||
// FOR DOING AID
|
// FOR DOING AID
|
||||||
if ( pTeamSoldier->usAnimState == GIVING_AID || pTeamSoldier->usAnimState == GIVING_AID_PRN )
|
if ( pTeamSoldier->usAnimState == GIVING_AID || pTeamSoldier->usAnimState == GIVING_AID_PRN )
|
||||||
{
|
{
|
||||||
// Get medkit info
|
|
||||||
usInHand = pTeamSoldier->inv[ HANDPOS ].usItem;
|
|
||||||
|
|
||||||
// Get victim pointer
|
// Get victim pointer
|
||||||
usSoldierIndex = WhoIsThere2( pTeamSoldier->sTargetGridNo, pTeamSoldier->pathing.bLevel );
|
usSoldierIndex = WhoIsThere2( pTeamSoldier->sTargetGridNo, pTeamSoldier->pathing.bLevel );
|
||||||
if ( usSoldierIndex != NOBODY )
|
if ( usSoldierIndex != NOBODY )
|
||||||
@@ -5717,14 +5702,12 @@ void HandleTeamServices( UINT8 ubTeamNum )
|
|||||||
{
|
{
|
||||||
pTeamSoldier->DoMercBattleSound( (INT8)( BATTLE_SOUND_CURSE1 ) );
|
pTeamSoldier->DoMercBattleSound( (INT8)( BATTLE_SOUND_CURSE1 ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -5732,7 +5715,7 @@ void HandlePlayerServices( SOLDIERTYPE *pTeamSoldier )
|
|||||||
{
|
{
|
||||||
SOLDIERTYPE *pTargetSoldier;
|
SOLDIERTYPE *pTargetSoldier;
|
||||||
UINT32 uiPointsUsed;
|
UINT32 uiPointsUsed;
|
||||||
UINT16 usSoldierIndex, usInHand;
|
UINT16 usSoldierIndex;
|
||||||
UINT16 usKitPts;
|
UINT16 usKitPts;
|
||||||
INT8 bSlot;
|
INT8 bSlot;
|
||||||
BOOLEAN fDone = FALSE;
|
BOOLEAN fDone = FALSE;
|
||||||
@@ -5743,9 +5726,6 @@ void HandlePlayerServices( SOLDIERTYPE *pTeamSoldier )
|
|||||||
// FOR DOING AID
|
// FOR DOING AID
|
||||||
if ( pTeamSoldier->usAnimState == GIVING_AID || pTeamSoldier->usAnimState == GIVING_AID_PRN )
|
if ( pTeamSoldier->usAnimState == GIVING_AID || pTeamSoldier->usAnimState == GIVING_AID_PRN )
|
||||||
{
|
{
|
||||||
// Get medkit info
|
|
||||||
usInHand = pTeamSoldier->inv[ HANDPOS ].usItem;
|
|
||||||
|
|
||||||
// Get victim pointer
|
// Get victim pointer
|
||||||
usSoldierIndex = WhoIsThere2( pTeamSoldier->sTargetGridNo, pTeamSoldier->pathing.bLevel );
|
usSoldierIndex = WhoIsThere2( pTeamSoldier->sTargetGridNo, pTeamSoldier->pathing.bLevel );
|
||||||
|
|
||||||
@@ -5853,7 +5833,7 @@ void CommonEnterCombatModeCode( )
|
|||||||
|
|
||||||
// OK, loop thorugh all guys and stop them!
|
// OK, loop thorugh all guys and stop them!
|
||||||
// Loop through all mercs and make go
|
// Loop through all mercs and make go
|
||||||
for ( pSoldier = Menptr, cnt = 0; cnt < TOTAL_SOLDIERS; pSoldier++, cnt++ )
|
for ( pSoldier = Menptr, cnt = 0; cnt < TOTAL_SOLDIERS; pSoldier++, ++cnt )
|
||||||
{
|
{
|
||||||
if ( pSoldier->bActive )
|
if ( pSoldier->bActive )
|
||||||
{
|
{
|
||||||
@@ -5908,7 +5888,7 @@ void CommonEnterCombatModeCode( )
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( !gTacticalStatus.fHasEnteredCombatModeSinceEntering )
|
/*if ( !gTacticalStatus.fHasEnteredCombatModeSinceEntering )
|
||||||
{
|
{
|
||||||
// ATE: reset player's movement mode at the very start of
|
// ATE: reset player's movement mode at the very start of
|
||||||
// combat
|
// combat
|
||||||
@@ -5916,7 +5896,7 @@ void CommonEnterCombatModeCode( )
|
|||||||
//{
|
//{
|
||||||
//pSoldier->usUIMovementMode = RUNNING;
|
//pSoldier->usUIMovementMode = RUNNING;
|
||||||
//}
|
//}
|
||||||
}
|
}*/
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -5940,7 +5920,6 @@ void CommonEnterCombatModeCode( )
|
|||||||
SetMusicMode( MUSIC_TACTICAL_BATTLE );
|
SetMusicMode( MUSIC_TACTICAL_BATTLE );
|
||||||
|
|
||||||
DebugMsg (TOPIC_JA2,DBG_LEVEL_3,"CommonEnterCombatMode done");
|
DebugMsg (TOPIC_JA2,DBG_LEVEL_3,"CommonEnterCombatMode done");
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -5991,7 +5970,7 @@ void EnterCombatMode( UINT8 ubStartingTeam )
|
|||||||
{
|
{
|
||||||
DebugMsg (TOPIC_JA2,DBG_LEVEL_3,"EnterCombatMode continuing... nobody selected");
|
DebugMsg (TOPIC_JA2,DBG_LEVEL_3,"EnterCombatMode continuing... nobody selected");
|
||||||
// OK, look through and find one....
|
// OK, look through and find one....
|
||||||
for ( cnt = gTacticalStatus.Team[ gbPlayerNum ].bFirstID, pTeamSoldier = MercPtrs[ cnt ]; cnt <= gTacticalStatus.Team[ gbPlayerNum ].bLastID; cnt++, pTeamSoldier++ )
|
for ( cnt = gTacticalStatus.Team[ gbPlayerNum ].bFirstID, pTeamSoldier = MercPtrs[ cnt ]; cnt <= gTacticalStatus.Team[ gbPlayerNum ].bLastID; ++cnt, pTeamSoldier++ )
|
||||||
{
|
{
|
||||||
if ( OK_CONTROLLABLE_MERC( pTeamSoldier ) && pTeamSoldier->aiData.bOppCnt > 0 )
|
if ( OK_CONTROLLABLE_MERC( pTeamSoldier ) && pTeamSoldier->aiData.bOppCnt > 0 )
|
||||||
{
|
{
|
||||||
@@ -6021,7 +6000,6 @@ void EnterCombatMode( UINT8 ubStartingTeam )
|
|||||||
}
|
}
|
||||||
|
|
||||||
DebugMsg (TOPIC_JA2,DBG_LEVEL_3,"EnterCombatMode done");
|
DebugMsg (TOPIC_JA2,DBG_LEVEL_3,"EnterCombatMode done");
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -10083,7 +10061,7 @@ INT8 CheckStatusNearbyFriendlies( SOLDIERTYPE *pSoldier )
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Incapacitated or heavily suppressed friends will not be good for our tolerance!
|
// Incapacitated or heavily suppressed friends will not be good for our tolerance!
|
||||||
else if (pLeader != pSoldier && pLeader->bActive && (pLeader->aiData.bShock > pSoldier->aiData.bShock || pLeader->stats.bLife <= OKLIFE) )
|
else if ( (pLeader->aiData.bShock > pSoldier->aiData.bShock || pLeader->stats.bLife <= OKLIFE) )
|
||||||
{
|
{
|
||||||
usEffectiveRangeToLeader = PythSpacesAway( pSoldier->sGridNo, pLeader->sGridNo );
|
usEffectiveRangeToLeader = PythSpacesAway( pSoldier->sGridNo, pLeader->sGridNo );
|
||||||
// If they are no more than 5 tiles away,
|
// If they are no more than 5 tiles away,
|
||||||
|
|||||||
+7
-6
@@ -2611,17 +2611,18 @@ INT16 MinPtsToMove(SOLDIERTYPE *pSoldier)
|
|||||||
|
|
||||||
// WANNE - BMP: FIX: Valid directions are only from 0-7!!
|
// WANNE - BMP: FIX: Valid directions are only from 0-7!!
|
||||||
//for (cnt=0; cnt <= 8; cnt++)
|
//for (cnt=0; cnt <= 8; cnt++)
|
||||||
for (cnt=0; cnt < 8; cnt++)
|
for (cnt=0; cnt < 8; ++cnt)
|
||||||
{
|
{
|
||||||
sGridNo = NewGridNo(pSoldier->sGridNo,DirectionInc(cnt));
|
sGridNo = NewGridNo(pSoldier->sGridNo,DirectionInc(cnt));
|
||||||
if (sGridNo != pSoldier->sGridNo)
|
if (sGridNo != pSoldier->sGridNo)
|
||||||
|
{
|
||||||
|
if ( (sCost=ActionPointCost( pSoldier, sGridNo, cnt , pSoldier->usUIMovementMode ) ) < sLowest )
|
||||||
{
|
{
|
||||||
if ( (sCost=ActionPointCost( pSoldier, sGridNo, cnt , pSoldier->usUIMovementMode ) ) < sLowest )
|
sLowest = sCost;
|
||||||
{
|
|
||||||
sLowest = sCost;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return(sLowest);//dnl ch64 290813 100AP made INT8 return obsolete
|
return(sLowest);//dnl ch64 290813 100AP made INT8 return obsolete
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -990,7 +990,8 @@ BOOLEAN TurnSoldierIntoCorpse( SOLDIERTYPE *pSoldier, BOOLEAN fRemoveMerc, BOOLE
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
// OK, Place what objects this guy was carrying on the ground!
|
// OK, Place what objects this guy was carrying on the ground!
|
||||||
for ( cnt = 0; cnt < pSoldier->inv.size(); ++cnt )
|
UINT32 invsize = pSoldier->inv.size();
|
||||||
|
for ( cnt = 0; cnt < invsize; ++cnt )
|
||||||
{
|
{
|
||||||
pObj = &( pSoldier->inv[ cnt ] );
|
pObj = &( pSoldier->inv[ cnt ] );
|
||||||
|
|
||||||
@@ -2414,7 +2415,6 @@ void ReduceAmmoDroppedByNonPlayerSoldiers( SOLDIERTYPE *pSoldier, INT32 iInvSlot
|
|||||||
Assert( pSoldier );
|
Assert( pSoldier );
|
||||||
Assert( ( iInvSlot >= 0 ) && ( iInvSlot < (INT32)pSoldier->inv.size() ) );
|
Assert( ( iInvSlot >= 0 ) && ( iInvSlot < (INT32)pSoldier->inv.size() ) );
|
||||||
|
|
||||||
|
|
||||||
// if not a player soldier
|
// if not a player soldier
|
||||||
if ( pSoldier->bTeam != gbPlayerNum )
|
if ( pSoldier->bTeam != gbPlayerNum )
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -6374,18 +6374,17 @@ BOOLEAN RemoveRepairItemFromDealersOfferArea( INT16 bSlot )
|
|||||||
|
|
||||||
INT8 GetInvSlotOfUnfullMoneyInMercInventory( SOLDIERTYPE *pSoldier )
|
INT8 GetInvSlotOfUnfullMoneyInMercInventory( SOLDIERTYPE *pSoldier )
|
||||||
{
|
{
|
||||||
UINT8 ubCnt;
|
|
||||||
|
|
||||||
//loop through the soldier's inventory
|
//loop through the soldier's inventory
|
||||||
for( ubCnt=0; ubCnt < pSoldier->inv.size(); ubCnt++)
|
INT8 invsize = (INT8)pSoldier->inv.size();
|
||||||
|
for( INT8 bCnt=0; bCnt < invsize; ++bCnt)
|
||||||
{
|
{
|
||||||
// Look for MONEY only, not Gold or Silver!!! And look for a slot not already full
|
// 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 ][0]->data.money.uiMoneyAmount < MoneySlotLimit( ubCnt ) ) )
|
if( ( pSoldier->inv[ bCnt ].usItem == MONEY ) && ( pSoldier->inv[ bCnt ][0]->data.money.uiMoneyAmount < MoneySlotLimit( bCnt ) ) )
|
||||||
{
|
{
|
||||||
return( ubCnt );
|
return( bCnt );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return( - 1 );
|
return( NO_SLOT );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1070,7 +1070,8 @@ UINT32 SOLDIERTYPE::GetChecksum( )
|
|||||||
uiChecksum *= (this->stats.bExpLevel + 1);
|
uiChecksum *= (this->stats.bExpLevel + 1);
|
||||||
uiChecksum += (this->ubProfile + 1);
|
uiChecksum += (this->ubProfile + 1);
|
||||||
|
|
||||||
for ( uiLoop = 0; uiLoop < this->inv.size(); uiLoop++ )
|
UINT32 invsize = this->inv.size();
|
||||||
|
for ( uiLoop = 0; uiLoop < invsize; ++uiLoop )
|
||||||
{
|
{
|
||||||
uiChecksum += this->inv[ uiLoop ].usItem;
|
uiChecksum += this->inv[ uiLoop ].usItem;
|
||||||
uiChecksum += this->inv[ uiLoop ].ubNumberOfObjects;
|
uiChecksum += this->inv[ uiLoop ].ubNumberOfObjects;
|
||||||
@@ -1221,7 +1222,8 @@ UINT32 MERCPROFILESTRUCT::GetChecksum( )
|
|||||||
// put in some multipliers too!
|
// put in some multipliers too!
|
||||||
uiChecksum *= (this->bExpLevel + 1);
|
uiChecksum *= (this->bExpLevel + 1);
|
||||||
|
|
||||||
for ( uiLoop = 0; uiLoop < this->inv.size(); uiLoop++ )
|
UINT32 invsize = this->inv.size();
|
||||||
|
for ( uiLoop = 0; uiLoop < invsize; ++uiLoop )
|
||||||
{
|
{
|
||||||
uiChecksum += this->inv[ uiLoop ];
|
uiChecksum += this->inv[ uiLoop ];
|
||||||
uiChecksum += this->bInvNumber[ uiLoop ];
|
uiChecksum += this->bInvNumber[ uiLoop ];
|
||||||
@@ -20614,11 +20616,13 @@ UINT8 GetSquadleadersCountInVicinity( SOLDIERTYPE * pSoldier, BOOLEAN fWithHighe
|
|||||||
// check if within distance
|
// check if within distance
|
||||||
// if both have extended ear, the distance is bigger and they don't need to sea each other
|
// if both have extended ear, the distance is bigger and they don't need to sea each other
|
||||||
// note that enemy always get the bonus if within distance, regardless of extended ears
|
// note that enemy always get the bonus if within distance, regardless of extended ears
|
||||||
if (((( HasExtendedEarOn( pSoldier ) && HasExtendedEarOn( MercPtrs[ cnt ] )) || ( pSoldier->bTeam == ENEMY_TEAM ) ) && (PythSpacesAway( pSoldier->sGridNo, MercPtrs[ cnt ]->sGridNo ) <= gSkillTraitValues.usSLRadiusExtendedEar) ) ||
|
// Flugente: moved around arguments for speed reason
|
||||||
|
if ( fDontCheckDistance ||
|
||||||
|
(PythSpacesAway( pSoldier->sGridNo, MercPtrs[ cnt ]->sGridNo ) <= gSkillTraitValues.usSLRadiusNormal) ||
|
||||||
//((SoldierToVirtualSoldierLineOfSightTest( MercPtrs[ cnt ], pSoldier->sGridNo, pSoldier->pathing.bLevel, ANIM_STAND, TRUE, CALC_FROM_ALL_DIRS ) ||
|
//((SoldierToVirtualSoldierLineOfSightTest( MercPtrs[ cnt ], pSoldier->sGridNo, pSoldier->pathing.bLevel, ANIM_STAND, TRUE, CALC_FROM_ALL_DIRS ) ||
|
||||||
//SoldierToVirtualSoldierLineOfSightTest( pSoldier, MercPtrs[ cnt ]->sGridNo, MercPtrs[ cnt ]->pathing.bLevel, ANIM_STAND, TRUE, CALC_FROM_ALL_DIRS ) ) &&
|
//SoldierToVirtualSoldierLineOfSightTest( pSoldier, MercPtrs[ cnt ]->sGridNo, MercPtrs[ cnt ]->pathing.bLevel, ANIM_STAND, TRUE, CALC_FROM_ALL_DIRS ) ) &&
|
||||||
(PythSpacesAway( pSoldier->sGridNo, MercPtrs[ cnt ]->sGridNo ) <= gSkillTraitValues.usSLRadiusNormal) ||
|
( ( pSoldier->bTeam == ENEMY_TEAM || (HasExtendedEarOn( pSoldier ) && HasExtendedEarOn( MercPtrs[ cnt ] ) ) ) && PythSpacesAway( pSoldier->sGridNo, MercPtrs[ cnt ]->sGridNo ) <= gSkillTraitValues.usSLRadiusExtendedEar )
|
||||||
fDontCheckDistance )
|
)
|
||||||
{
|
{
|
||||||
// If checking for higher level SL
|
// If checking for higher level SL
|
||||||
// also count in already aquired level increses from other SLs
|
// also count in already aquired level increses from other SLs
|
||||||
@@ -20631,6 +20635,7 @@ UINT8 GetSquadleadersCountInVicinity( SOLDIERTYPE * pSoldier, BOOLEAN fWithHighe
|
|||||||
{
|
{
|
||||||
ubNumberSL += NUM_SKILL_TRAITS( MercPtrs[ cnt ], SQUADLEADER_NT );
|
ubNumberSL += NUM_SKILL_TRAITS( MercPtrs[ cnt ], SQUADLEADER_NT );
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ubNumberSL >= gSkillTraitValues.ubSLMaxBonuses)
|
if (ubNumberSL >= gSkillTraitValues.ubSLMaxBonuses)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -20640,18 +20645,20 @@ UINT8 GetSquadleadersCountInVicinity( SOLDIERTYPE * pSoldier, BOOLEAN fWithHighe
|
|||||||
// special loop for militia - they can get a bonus from our mercs
|
// special loop for militia - they can get a bonus from our mercs
|
||||||
if ( pSoldier->bTeam == MILITIA_TEAM && ubNumberSL < gSkillTraitValues.ubSLMaxBonuses )
|
if ( pSoldier->bTeam == MILITIA_TEAM && ubNumberSL < gSkillTraitValues.ubSLMaxBonuses )
|
||||||
{
|
{
|
||||||
for ( cnt = gTacticalStatus.Team[ OUR_TEAM ].bFirstID ; cnt <= gTacticalStatus.Team[ OUR_TEAM ].bLastID ; cnt++ )
|
for ( cnt = gTacticalStatus.Team[ OUR_TEAM ].bFirstID ; cnt <= gTacticalStatus.Team[ OUR_TEAM ].bLastID ; ++cnt )
|
||||||
{
|
{
|
||||||
// Get active conscious soldier
|
// Get active conscious soldier
|
||||||
if (MercPtrs[ cnt ] != pSoldier && MercPtrs[ cnt ]->bActive && //MercPtrs[ cnt ]->aiData.bShock < 20 &&
|
if (MercPtrs[ cnt ] != pSoldier && MercPtrs[ cnt ]->bActive && //MercPtrs[ cnt ]->aiData.bShock < 20 &&
|
||||||
MercPtrs[ cnt ]->stats.bLife >= OKLIFE && HAS_SKILL_TRAIT( MercPtrs[ cnt ], SQUADLEADER_NT ))
|
MercPtrs[ cnt ]->stats.bLife >= OKLIFE && HAS_SKILL_TRAIT( MercPtrs[ cnt ], SQUADLEADER_NT ))
|
||||||
{
|
{
|
||||||
// check if within distance
|
// check if within distance
|
||||||
if (((HasExtendedEarOn( MercPtrs[ cnt ] ) && (PythSpacesAway( pSoldier->sGridNo, MercPtrs[ cnt ]->sGridNo ) <= gSkillTraitValues.usSLRadiusExtendedEar) ) ||
|
// Flugente: moved around arguments for speed reason
|
||||||
//((SoldierToVirtualSoldierLineOfSightTest( MercPtrs[ cnt ], pSoldier->sGridNo, pSoldier->pathing.bLevel, ANIM_STAND, TRUE, CALC_FROM_ALL_DIRS ) ||
|
if ( fDontCheckDistance ||
|
||||||
//SoldierToVirtualSoldierLineOfSightTest( pSoldier, MercPtrs[ cnt ]->sGridNo, MercPtrs[ cnt ]->pathing.bLevel, ANIM_STAND, TRUE, CALC_FROM_ALL_DIRS ) ) &&
|
(PythSpacesAway( pSoldier->sGridNo, MercPtrs[ cnt ]->sGridNo ) <= gSkillTraitValues.usSLRadiusNormal) ||
|
||||||
(PythSpacesAway( pSoldier->sGridNo, MercPtrs[ cnt ]->sGridNo ) <= gSkillTraitValues.usSLRadiusNormal)) ||
|
//((SoldierToVirtualSoldierLineOfSightTest( MercPtrs[ cnt ], pSoldier->sGridNo, pSoldier->pathing.bLevel, ANIM_STAND, TRUE, CALC_FROM_ALL_DIRS ) ||
|
||||||
fDontCheckDistance )
|
//SoldierToVirtualSoldierLineOfSightTest( pSoldier, MercPtrs[ cnt ]->sGridNo, MercPtrs[ cnt ]->pathing.bLevel, ANIM_STAND, TRUE, CALC_FROM_ALL_DIRS ) ) &&
|
||||||
|
((HasExtendedEarOn( MercPtrs[ cnt ] ) && PythSpacesAway( pSoldier->sGridNo, MercPtrs[ cnt ]->sGridNo ) <= gSkillTraitValues.usSLRadiusExtendedEar) )
|
||||||
|
)
|
||||||
{
|
{
|
||||||
// If checking for higher level SL
|
// If checking for higher level SL
|
||||||
// also count in already aquired level increses from other SLs
|
// also count in already aquired level increses from other SLs
|
||||||
@@ -20664,6 +20671,7 @@ UINT8 GetSquadleadersCountInVicinity( SOLDIERTYPE * pSoldier, BOOLEAN fWithHighe
|
|||||||
{
|
{
|
||||||
ubNumberSL += NUM_SKILL_TRAITS( MercPtrs[ cnt ], SQUADLEADER_NT );
|
ubNumberSL += NUM_SKILL_TRAITS( MercPtrs[ cnt ], SQUADLEADER_NT );
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ubNumberSL >= gSkillTraitValues.ubSLMaxBonuses)
|
if (ubNumberSL >= gSkillTraitValues.ubSLMaxBonuses)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2549,7 +2549,8 @@ void CreateStaticDetailedPlacementGivenBasicPlacementInfo( SOLDIERCREATE_STRUCT
|
|||||||
memcpy( spp->sPatrolGrid, bp->sPatrolGrid, sizeof( INT32 ) * MAXPATROLGRIDS );
|
memcpy( spp->sPatrolGrid, bp->sPatrolGrid, sizeof( INT32 ) * MAXPATROLGRIDS );
|
||||||
|
|
||||||
//Starts with nothing
|
//Starts with nothing
|
||||||
for( i = 0; i < spp->Inv.size(); i++ )
|
UINT32 invsize = spp->Inv.size();
|
||||||
|
for( i = 0; i < invsize; ++i )
|
||||||
{
|
{
|
||||||
DeleteObj(&spp->Inv[ i ]);
|
DeleteObj(&spp->Inv[ i ]);
|
||||||
spp->Inv[ i ].fFlags |= OBJECT_UNDROPPABLE;
|
spp->Inv[ i ].fFlags |= OBJECT_UNDROPPABLE;
|
||||||
@@ -2628,7 +2629,8 @@ void CreateDetailedPlacementGivenStaticDetailedPlacementAndBasicPlacementInfo(
|
|||||||
|
|
||||||
//This isn't perfect, however, it blindly brings over the items from the static
|
//This isn't perfect, however, it blindly brings over the items from the static
|
||||||
//detailed placement. Due to the order of things, other items would
|
//detailed placement. Due to the order of things, other items would
|
||||||
for( i = 0; i < spp->Inv.size(); i++ )
|
UINT32 invsize = spp->Inv.size();
|
||||||
|
for( i = 0; i < invsize; ++i )
|
||||||
{
|
{
|
||||||
//copy over static items and empty slots that are droppable (signifies a forced empty slot)
|
//copy over static items and empty slots that are droppable (signifies a forced empty slot)
|
||||||
if( spp->Inv[ i ].fFlags & OBJECT_NO_OVERWRITE )
|
if( spp->Inv[ i ].fFlags & OBJECT_NO_OVERWRITE )
|
||||||
@@ -2776,7 +2778,8 @@ void UpdateStaticDetailedPlacementWithProfileInformation( SOLDIERCREATE_STRUCT *
|
|||||||
spp->bBodyType = pProfile->ubBodyType;
|
spp->bBodyType = pProfile->ubBodyType;
|
||||||
|
|
||||||
// Copy over inv if we want to
|
// Copy over inv if we want to
|
||||||
for ( cnt = 0; cnt < pProfile->inv.size(); cnt++ )
|
UINT32 invsize = pProfile->inv.size();
|
||||||
|
for ( cnt = 0; cnt < invsize; ++cnt )
|
||||||
{
|
{
|
||||||
CreateItems( pProfile->inv[ cnt ], pProfile->bInvStatus[ cnt ], pProfile->bInvNumber[ cnt ], &(spp->Inv[ cnt ]) );
|
CreateItems( pProfile->inv[ cnt ], pProfile->bInvStatus[ cnt ], pProfile->bInvNumber[ cnt ], &(spp->Inv[ cnt ]) );
|
||||||
}
|
}
|
||||||
@@ -3531,7 +3534,6 @@ void CopyProfileItems( SOLDIERTYPE *pSoldier, SOLDIERCREATE_STRUCT *pCreateStruc
|
|||||||
BOOLEAN success;
|
BOOLEAN success;
|
||||||
BOOLEAN fRet;
|
BOOLEAN fRet;
|
||||||
|
|
||||||
|
|
||||||
pProfile = &(gMercProfiles[pCreateStruct->ubProfile]);
|
pProfile = &(gMercProfiles[pCreateStruct->ubProfile]);
|
||||||
|
|
||||||
// Copy over inv if we want to
|
// Copy over inv if we want to
|
||||||
@@ -3544,7 +3546,8 @@ void CopyProfileItems( SOLDIERTYPE *pSoldier, SOLDIERCREATE_STRUCT *pCreateStruc
|
|||||||
// CHRISL: Resort profile items to use LBE pockets properly
|
// CHRISL: Resort profile items to use LBE pockets properly
|
||||||
DistributeInitialGear(pProfile);
|
DistributeInitialGear(pProfile);
|
||||||
//place all items that are NOT attachments
|
//place all items that are NOT attachments
|
||||||
for ( cnt = 0; cnt < pProfile->inv.size(); cnt++ )
|
UINT32 invsize = pProfile->inv.size();
|
||||||
|
for ( cnt = 0; cnt < pProfile->inv.size(); ++cnt )
|
||||||
{
|
{
|
||||||
if ( pProfile->inv[ cnt ] == NOTHING || Item[pProfile->inv[cnt]].attachment) {
|
if ( pProfile->inv[ cnt ] == NOTHING || Item[pProfile->inv[cnt]].attachment) {
|
||||||
continue;
|
continue;
|
||||||
@@ -3564,8 +3567,9 @@ void CopyProfileItems( SOLDIERTYPE *pSoldier, SOLDIERCREATE_STRUCT *pCreateStruc
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//done placing all non attachments, now place all attachments on objects!
|
//done placing all non attachments, now place all attachments on objects!
|
||||||
for ( cnt = 0; cnt < pProfile->inv.size(); cnt++ )
|
for ( cnt = 0; cnt < invsize; ++cnt )
|
||||||
{
|
{
|
||||||
if ( pProfile->inv[ cnt ] == NOTHING) {
|
if ( pProfile->inv[ cnt ] == NOTHING) {
|
||||||
continue;
|
continue;
|
||||||
@@ -4647,7 +4651,8 @@ BOOLEAN AssignTraitsToSoldier( SOLDIERTYPE *pSoldier, SOLDIERCREATE_STRUCT *pCre
|
|||||||
BOOLEAN fRadioSetFound = FALSE;
|
BOOLEAN fRadioSetFound = FALSE;
|
||||||
|
|
||||||
// FIRST FIND OUT THE COMPOSITION OF OUR GEAR
|
// FIRST FIND OUT THE COMPOSITION OF OUR GEAR
|
||||||
for (bLoop = 0; bLoop < (INT8) pSoldier->inv.size(); bLoop++)
|
INT8 invsize = (INT8)pSoldier->inv.size();
|
||||||
|
for (bLoop = 0; bLoop < invsize; ++bLoop)
|
||||||
{
|
{
|
||||||
if (pCreateStruct->Inv[bLoop].exists() == true)
|
if (pCreateStruct->Inv[bLoop].exists() == true)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -882,7 +882,8 @@ BOOLEAN LoadMercProfiles(void)
|
|||||||
gMercProfiles[uiLoop].bMainGunAttractiveness = -1;
|
gMercProfiles[uiLoop].bMainGunAttractiveness = -1;
|
||||||
gMercProfiles[uiLoop].bArmourAttractiveness = -1;
|
gMercProfiles[uiLoop].bArmourAttractiveness = -1;
|
||||||
|
|
||||||
for ( uiLoop2 = 0; uiLoop2 < gMercProfiles[uiLoop].inv.size(); uiLoop2++ )
|
UINT32 invsize = gMercProfiles[ uiLoop ].inv.size();
|
||||||
|
for ( uiLoop2 = 0; uiLoop2 < invsize; ++uiLoop2 )
|
||||||
{
|
{
|
||||||
usItem = gMercProfiles[uiLoop].inv[ uiLoop2 ];
|
usItem = gMercProfiles[uiLoop].inv[ uiLoop2 ];
|
||||||
|
|
||||||
@@ -933,7 +934,7 @@ BOOLEAN LoadMercProfiles(void)
|
|||||||
//with old binary file optional gear prices which got ported into MercProfiles.xml
|
//with old binary file optional gear prices which got ported into MercProfiles.xml
|
||||||
gMercProfiles[ uiLoop ].usOptionalGearCost = 0;
|
gMercProfiles[ uiLoop ].usOptionalGearCost = 0;
|
||||||
UINT16 tempGearCost = 0;
|
UINT16 tempGearCost = 0;
|
||||||
for ( uiLoop2 = 0; uiLoop2< gMercProfiles[ uiLoop ].inv.size(); uiLoop2++ )
|
for ( uiLoop2 = 0; uiLoop2< invsize; ++uiLoop2 )
|
||||||
{
|
{
|
||||||
if ( gMercProfiles[ uiLoop ].inv[ uiLoop2 ] != NOTHING )
|
if ( gMercProfiles[ uiLoop ].inv[ uiLoop2 ] != NOTHING )
|
||||||
{
|
{
|
||||||
@@ -1771,15 +1772,17 @@ SOLDIERTYPE *ChangeSoldierTeam( SOLDIERTYPE *pSoldier, UINT8 ubTeam )
|
|||||||
//if(UsingNewInventorySystem() == true)
|
//if(UsingNewInventorySystem() == true)
|
||||||
{
|
{
|
||||||
// Start by direct copy of all BODYPOS items (armor, hands, head and LBE)
|
// Start by direct copy of all BODYPOS items (armor, hands, head and LBE)
|
||||||
for(cnt = 0; cnt < (UINT32)BODYPOSFINAL; cnt++)
|
for(cnt = 0; cnt < (UINT32)BODYPOSFINAL; ++cnt)
|
||||||
{
|
{
|
||||||
pNewSoldier->inv[cnt] = pSoldier->inv[cnt];
|
pNewSoldier->inv[cnt] = pSoldier->inv[cnt];
|
||||||
}
|
}
|
||||||
|
|
||||||
// Next, direct copy of the gunsling and knife pockets
|
// Next, direct copy of the gunsling and knife pockets
|
||||||
pNewSoldier->inv[GUNSLINGPOCKPOS] = pSoldier->inv[GUNSLINGPOCKPOS];
|
pNewSoldier->inv[GUNSLINGPOCKPOS] = pSoldier->inv[GUNSLINGPOCKPOS];
|
||||||
pNewSoldier->inv[KNIFEPOCKPOS] = pSoldier->inv[KNIFEPOCKPOS];
|
pNewSoldier->inv[KNIFEPOCKPOS] = pSoldier->inv[KNIFEPOCKPOS];
|
||||||
// Then, try to autoplace everything else
|
// Then, try to autoplace everything else
|
||||||
for(cnt = BIGPOCKSTART; cnt < pNewSoldier->inv.size(); cnt++ )
|
UINT32 invsize = pNewSoldier->inv.size();
|
||||||
|
for(cnt = BIGPOCKSTART; cnt < invsize; ++cnt )
|
||||||
{
|
{
|
||||||
if(pSoldier->inv[cnt].exists() == true)
|
if(pSoldier->inv[cnt].exists() == true)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -2803,7 +2803,7 @@ BOOLEAN AddDeadSoldierToUnLoadedSector( INT16 sMapX, INT16 sMapY, UINT8 bMapZ, S
|
|||||||
{
|
{
|
||||||
UINT32 uiNumberOfItems;
|
UINT32 uiNumberOfItems;
|
||||||
std::vector<WORLDITEM> pWorldItems;//dnl ch75 271013
|
std::vector<WORLDITEM> pWorldItems;//dnl ch75 271013
|
||||||
UINT i;
|
UINT8 i;
|
||||||
UINT8 bCount=0;
|
UINT8 bCount=0;
|
||||||
UINT16 uiFlagsForWorldItems=0;
|
UINT16 uiFlagsForWorldItems=0;
|
||||||
UINT16 usFlagsForRottingCorpse=0;
|
UINT16 usFlagsForRottingCorpse=0;
|
||||||
@@ -2837,7 +2837,8 @@ BOOLEAN AddDeadSoldierToUnLoadedSector( INT16 sMapX, INT16 sMapY, UINT8 bMapZ, S
|
|||||||
|
|
||||||
//go through and and find out how many items there are
|
//go through and and find out how many items there are
|
||||||
uiNumberOfItems = 0;
|
uiNumberOfItems = 0;
|
||||||
for ( i = 0; i < pSoldier->inv.size(); i++ )
|
UINT8 invsize = pSoldier->inv.size();
|
||||||
|
for ( i = 0; i < invsize; ++i )
|
||||||
{
|
{
|
||||||
if( pSoldier->inv[ i ].exists() == true )
|
if( pSoldier->inv[ i ].exists() == true )
|
||||||
{
|
{
|
||||||
@@ -2855,8 +2856,7 @@ BOOLEAN AddDeadSoldierToUnLoadedSector( INT16 sMapX, INT16 sMapY, UINT8 bMapZ, S
|
|||||||
//if the item can be dropped
|
//if the item can be dropped
|
||||||
if( !( pSoldier->inv[ i ].fFlags & OBJECT_UNDROPPABLE ) || pSoldier->bTeam == gbPlayerNum )
|
if( !( pSoldier->inv[ i ].fFlags & OBJECT_UNDROPPABLE ) || pSoldier->bTeam == gbPlayerNum )
|
||||||
{
|
{
|
||||||
|
++uiNumberOfItems;
|
||||||
uiNumberOfItems++;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -2875,7 +2875,7 @@ BOOLEAN AddDeadSoldierToUnLoadedSector( INT16 sMapX, INT16 sMapY, UINT8 bMapZ, S
|
|||||||
|
|
||||||
//loop through all the soldiers items and add them to the world item array
|
//loop through all the soldiers items and add them to the world item array
|
||||||
bCount = 0;
|
bCount = 0;
|
||||||
for ( i = 0; i < pSoldier->inv.size(); i++ )
|
for ( i = 0; i < invsize; ++i )
|
||||||
{
|
{
|
||||||
if( pSoldier->inv[ i ].exists() == true )
|
if( pSoldier->inv[ i ].exists() == true )
|
||||||
{
|
{
|
||||||
@@ -2897,7 +2897,7 @@ BOOLEAN AddDeadSoldierToUnLoadedSector( INT16 sMapX, INT16 sMapY, UINT8 bMapZ, S
|
|||||||
pSoldier->inv[i][0]->data.objectStatus = max(pSoldier->inv[i][0]->data.objectStatus,1); // never below 1%
|
pSoldier->inv[i][0]->data.objectStatus = max(pSoldier->inv[i][0]->data.objectStatus,1); // never below 1%
|
||||||
}
|
}
|
||||||
pWorldItems[ bCount ].object = pSoldier->inv[i];
|
pWorldItems[ bCount ].object = pSoldier->inv[i];
|
||||||
bCount++;
|
++bCount;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -2907,7 +2907,7 @@ BOOLEAN AddDeadSoldierToUnLoadedSector( INT16 sMapX, INT16 sMapY, UINT8 bMapZ, S
|
|||||||
|
|
||||||
//CHRISL: Now that we've copied the dead soldiers items to pWorldItems, we need to actually remove the items from the dead soldier. Otherwise we have
|
//CHRISL: Now that we've copied the dead soldiers items to pWorldItems, we need to actually remove the items from the dead soldier. Otherwise we have
|
||||||
// actually duplicated the items and there's a chance that these duplicated items will again find their way to sector.
|
// actually duplicated the items and there's a chance that these duplicated items will again find their way to sector.
|
||||||
for ( i = 0; i < pSoldier->inv.size(); i++ )
|
for ( i = 0; i < invsize; ++i )
|
||||||
{
|
{
|
||||||
if( pSoldier->inv[ i ].exists() == true )
|
if( pSoldier->inv[ i ].exists() == true )
|
||||||
{
|
{
|
||||||
@@ -3002,7 +3002,8 @@ UINT32 LBENODEChecksum( LBENODE * pNode )
|
|||||||
uiChecksum *= (pNode->lbeIndex +1);
|
uiChecksum *= (pNode->lbeIndex +1);
|
||||||
uiChecksum += (pNode->ubID +1);
|
uiChecksum += (pNode->ubID +1);
|
||||||
|
|
||||||
for ( uiLoop = 0; uiLoop < pNode->inv.size(); uiLoop++ )
|
UINT32 invsize = pNode->inv.size();
|
||||||
|
for ( uiLoop = 0; uiLoop < invsize; ++uiLoop )
|
||||||
{
|
{
|
||||||
uiChecksum += pNode->inv[ uiLoop ].usItem;
|
uiChecksum += pNode->inv[ uiLoop ].usItem;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2823,7 +2823,8 @@ void GetKeyboardInput( UINT32 *puiNewEvent )
|
|||||||
{
|
{
|
||||||
if(MercPtrs[loop]->bActive && MercPtrs[loop]->bInSector)
|
if(MercPtrs[loop]->bActive && MercPtrs[loop]->bInSector)
|
||||||
{
|
{
|
||||||
for(unsigned int pocket=0; pocket < MercPtrs[loop]->inv.size(); pocket++)
|
UINT32 invsize = MercPtrs[loop]->inv.size();
|
||||||
|
for(UINT32 pocket=0; pocket < invsize; ++pocket)
|
||||||
{
|
{
|
||||||
if(MercPtrs[loop]->inv[pocket].usItem == crateItem)
|
if(MercPtrs[loop]->inv[pocket].usItem == crateItem)
|
||||||
{
|
{
|
||||||
@@ -7348,7 +7349,7 @@ void HandleTBReloadAll( void )
|
|||||||
if (! ( gTacticalStatus.fEnemyInSector ) )
|
if (! ( gTacticalStatus.fEnemyInSector ) )
|
||||||
{
|
{
|
||||||
SOLDIERTYPE *pTeamSoldier;
|
SOLDIERTYPE *pTeamSoldier;
|
||||||
INT8 bLoop;
|
UINT8 bLoop;
|
||||||
UINT16 bullets;
|
UINT16 bullets;
|
||||||
OBJECTTYPE *pGun, *pAmmo, *pAmmoMags;
|
OBJECTTYPE *pGun, *pAmmo, *pAmmoMags;
|
||||||
|
|
||||||
@@ -7357,9 +7358,9 @@ void HandleTBReloadAll( void )
|
|||||||
{
|
{
|
||||||
if ( OK_CONTROLLABLE_MERC( pTeamSoldier ) && pTeamSoldier->bAssignment == CurrentSquad( ) && !AM_A_ROBOT( pTeamSoldier ) )
|
if ( OK_CONTROLLABLE_MERC( pTeamSoldier ) && pTeamSoldier->bAssignment == CurrentSquad( ) && !AM_A_ROBOT( pTeamSoldier ) )
|
||||||
{
|
{
|
||||||
|
|
||||||
// Search for gun in soldier inventory
|
// Search for gun in soldier inventory
|
||||||
for (UINT32 bLoop2 = 0; bLoop2 < pTeamSoldier->inv.size(); bLoop2++)
|
UINT32 invsize = pTeamSoldier->inv.size();
|
||||||
|
for (UINT32 bLoop2 = 0; bLoop2 < invsize; ++bLoop2)
|
||||||
{
|
{
|
||||||
if ( (Item[pTeamSoldier->inv[bLoop2].usItem].usItemClass & IC_GUN) || (Item[pTeamSoldier->inv[bLoop2].usItem].usItemClass == IC_LAUNCHER) )
|
if ( (Item[pTeamSoldier->inv[bLoop2].usItem].usItemClass & IC_GUN) || (Item[pTeamSoldier->inv[bLoop2].usItem].usItemClass == IC_LAUNCHER) )
|
||||||
{
|
{
|
||||||
@@ -7367,9 +7368,8 @@ void HandleTBReloadAll( void )
|
|||||||
//if magazine is not full
|
//if magazine is not full
|
||||||
if ( (*pGun)[0]->data.gun.ubGunShotsLeft < GetMagSize( pGun ) )
|
if ( (*pGun)[0]->data.gun.ubGunShotsLeft < GetMagSize( pGun ) )
|
||||||
{
|
{
|
||||||
|
|
||||||
// Search for ammo in sector
|
// Search for ammo in sector
|
||||||
for ( UINT32 uiLoop = 0; uiLoop < guiNumWorldItems; uiLoop++ )
|
for ( UINT32 uiLoop = 0; uiLoop < guiNumWorldItems; ++uiLoop )
|
||||||
{
|
{
|
||||||
if ( (gWorldItems[ uiLoop ].bVisible == TRUE) && (gWorldItems[ uiLoop ].fExists) && (gWorldItems[ uiLoop ].usFlags & WORLD_ITEM_REACHABLE) && !(gWorldItems[ uiLoop ].usFlags & WORLD_ITEM_ARMED_BOMB) )//item exists, is reachable, is visible and is not trapped
|
if ( (gWorldItems[ uiLoop ].bVisible == TRUE) && (gWorldItems[ uiLoop ].fExists) && (gWorldItems[ uiLoop ].usFlags & WORLD_ITEM_REACHABLE) && !(gWorldItems[ uiLoop ].usFlags & WORLD_ITEM_ARMED_BOMB) )//item exists, is reachable, is visible and is not trapped
|
||||||
{
|
{
|
||||||
@@ -7410,7 +7410,8 @@ void HandleTBReloadAll( void )
|
|||||||
if ( OK_CONTROLLABLE_MERC( pTeamSoldier ) && pTeamSoldier->bAssignment == CurrentSquad( ) && !AM_A_ROBOT( pTeamSoldier ) )
|
if ( OK_CONTROLLABLE_MERC( pTeamSoldier ) && pTeamSoldier->bAssignment == CurrentSquad( ) && !AM_A_ROBOT( pTeamSoldier ) )
|
||||||
{
|
{
|
||||||
// Search for ammo in soldier inventory
|
// Search for ammo in soldier inventory
|
||||||
for (UINT32 bLoop2 = 0; bLoop2 < pTeamSoldier->inv.size(); bLoop2++)
|
UINT32 invsize = pTeamSoldier->inv.size();
|
||||||
|
for (UINT32 bLoop2 = 0; bLoop2 < invsize; ++bLoop2)
|
||||||
{
|
{
|
||||||
if ( Item[pTeamSoldier->inv[bLoop2].usItem].usItemClass & IC_AMMO )
|
if ( Item[pTeamSoldier->inv[bLoop2].usItem].usItemClass & IC_AMMO )
|
||||||
{
|
{
|
||||||
@@ -7421,7 +7422,7 @@ void HandleTBReloadAll( void )
|
|||||||
if ( (*pAmmoMags)[stackMag]->data.ubShotsLeft < Magazine[Item[pAmmoMags->usItem].ubClassIndex].ubMagSize )
|
if ( (*pAmmoMags)[stackMag]->data.ubShotsLeft < Magazine[Item[pAmmoMags->usItem].ubClassIndex].ubMagSize )
|
||||||
{
|
{
|
||||||
// Search for ammo in sector
|
// Search for ammo in sector
|
||||||
for ( UINT32 uiLoop = 0; uiLoop < guiNumWorldItems; uiLoop++ )
|
for ( UINT32 uiLoop = 0; uiLoop < guiNumWorldItems; ++uiLoop )
|
||||||
{
|
{
|
||||||
if ( (gWorldItems[ uiLoop ].bVisible == TRUE) && (gWorldItems[ uiLoop ].fExists) && (gWorldItems[ uiLoop ].usFlags & WORLD_ITEM_REACHABLE) && !(gWorldItems[ uiLoop ].usFlags & WORLD_ITEM_ARMED_BOMB) )//item exists, is reachable, is visible and is not trapped
|
if ( (gWorldItems[ uiLoop ].bVisible == TRUE) && (gWorldItems[ uiLoop ].fExists) && (gWorldItems[ uiLoop ].usFlags & WORLD_ITEM_REACHABLE) && !(gWorldItems[ uiLoop ].usFlags & WORLD_ITEM_ARMED_BOMB) )//item exists, is reachable, is visible and is not trapped
|
||||||
{
|
{
|
||||||
@@ -7442,9 +7443,9 @@ void HandleTBReloadAll( void )
|
|||||||
(*pAmmoMags)[stackMag]->data.ubShotsLeft += bullets;
|
(*pAmmoMags)[stackMag]->data.ubShotsLeft += bullets;
|
||||||
(*pAmmo)[0]->data.ubShotsLeft -= bullets;
|
(*pAmmo)[0]->data.ubShotsLeft -= bullets;
|
||||||
|
|
||||||
fCharacterInfoPanelDirty = TRUE;
|
fCharacterInfoPanelDirty = TRUE;
|
||||||
fInterfacePanelDirty = DIRTYLEVEL2;
|
fInterfacePanelDirty = DIRTYLEVEL2;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((*pAmmo)[0]->data.ubShotsLeft == 0)
|
if ((*pAmmo)[0]->data.ubShotsLeft == 0)
|
||||||
{
|
{
|
||||||
@@ -7458,7 +7459,8 @@ void HandleTBReloadAll( void )
|
|||||||
//MM: if magazines still are partly empty, look through inventory for boxes and crates
|
//MM: if magazines still are partly empty, look through inventory for boxes and crates
|
||||||
if ( (*pAmmoMags)[stackMag]->data.ubShotsLeft < Magazine[Item[pAmmoMags->usItem].ubClassIndex].ubMagSize )
|
if ( (*pAmmoMags)[stackMag]->data.ubShotsLeft < Magazine[Item[pAmmoMags->usItem].ubClassIndex].ubMagSize )
|
||||||
{
|
{
|
||||||
for (UINT32 uiLoop = 0; uiLoop < pTeamSoldier->inv.size(); uiLoop++)
|
UINT32 invsize = pTeamSoldier->inv.size();
|
||||||
|
for (UINT32 uiLoop = 0; uiLoop < invsize; ++uiLoop)
|
||||||
{
|
{
|
||||||
if ( (Item[pTeamSoldier->inv[uiLoop].usItem].usItemClass & IC_AMMO) && Magazine[Item[pTeamSoldier->inv[uiLoop].usItem].ubClassIndex].ubMagType >= AMMO_BOX )
|
if ( (Item[pTeamSoldier->inv[uiLoop].usItem].usItemClass & IC_AMMO) && Magazine[Item[pTeamSoldier->inv[uiLoop].usItem].ubClassIndex].ubMagType >= AMMO_BOX )
|
||||||
{
|
{
|
||||||
@@ -7494,9 +7496,8 @@ void HandleTBReloadAll( void )
|
|||||||
OBJECTTYPE *pGun2 = FindAttachedWeapon(pGun, IC_GUN);
|
OBJECTTYPE *pGun2 = FindAttachedWeapon(pGun, IC_GUN);
|
||||||
if ( (*pGun2)[0]->data.gun.ubGunShotsLeft < GetMagSize( pGun2 ) )
|
if ( (*pGun2)[0]->data.gun.ubGunShotsLeft < GetMagSize( pGun2 ) )
|
||||||
{
|
{
|
||||||
|
|
||||||
// Search for ammo in sector
|
// Search for ammo in sector
|
||||||
for ( UINT32 uiLoop = 0; uiLoop < guiNumWorldItems; uiLoop++ )
|
for ( UINT32 uiLoop = 0; uiLoop < guiNumWorldItems; ++uiLoop )
|
||||||
{
|
{
|
||||||
if ( (gWorldItems[ uiLoop ].bVisible == TRUE) && (gWorldItems[ uiLoop ].fExists) && (gWorldItems[ uiLoop ].usFlags & WORLD_ITEM_REACHABLE) && !(gWorldItems[ uiLoop ].usFlags & WORLD_ITEM_ARMED_BOMB) )//item exists, is reachable, is visible and is not trapped
|
if ( (gWorldItems[ uiLoop ].bVisible == TRUE) && (gWorldItems[ uiLoop ].fExists) && (gWorldItems[ uiLoop ].usFlags & WORLD_ITEM_REACHABLE) && !(gWorldItems[ uiLoop ].usFlags & WORLD_ITEM_ARMED_BOMB) )//item exists, is reachable, is visible and is not trapped
|
||||||
{
|
{
|
||||||
@@ -7535,10 +7536,10 @@ void HandleTBReloadAll( void )
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
SOLDIERTYPE *pTeamSoldier;
|
SOLDIERTYPE *pTeamSoldier;
|
||||||
INT8 bLoop;
|
UINT8 bLoop;
|
||||||
OBJECTTYPE *pGun, *pAmmo;
|
OBJECTTYPE *pGun, *pAmmo;
|
||||||
|
|
||||||
for (bLoop=gTacticalStatus.Team[gbPlayerNum].bFirstID, pTeamSoldier=MercPtrs[bLoop]; bLoop <= gTacticalStatus.Team[gbPlayerNum].bLastID; bLoop++, pTeamSoldier++)
|
for (bLoop=gTacticalStatus.Team[gbPlayerNum].bFirstID, pTeamSoldier=MercPtrs[bLoop]; bLoop <= gTacticalStatus.Team[gbPlayerNum].bLastID; ++bLoop, pTeamSoldier++)
|
||||||
{
|
{
|
||||||
if ( OK_CONTROLLABLE_MERC( pTeamSoldier ) && pTeamSoldier->bAssignment == CurrentSquad( ) && !AM_A_ROBOT( pTeamSoldier ) )
|
if ( OK_CONTROLLABLE_MERC( pTeamSoldier ) && pTeamSoldier->bAssignment == CurrentSquad( ) && !AM_A_ROBOT( pTeamSoldier ) )
|
||||||
{
|
{
|
||||||
@@ -7558,7 +7559,8 @@ void HandleTBReloadAll( void )
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
// Search for gun in soldier inventory
|
// Search for gun in soldier inventory
|
||||||
for (UINT32 bLoop2 = 0; bLoop2 < pTeamSoldier->inv.size(); bLoop2++)
|
UINT32 invsize = pTeamSoldier->inv.size();
|
||||||
|
for (UINT32 bLoop2 = 0; bLoop2 < invsize; ++bLoop2)
|
||||||
{
|
{
|
||||||
if ( (Item[pTeamSoldier->inv[bLoop2].usItem].usItemClass & IC_GUN) || (Item[pTeamSoldier->inv[bLoop2].usItem].usItemClass == IC_LAUNCHER) )
|
if ( (Item[pTeamSoldier->inv[bLoop2].usItem].usItemClass & IC_GUN) || (Item[pTeamSoldier->inv[bLoop2].usItem].usItemClass == IC_LAUNCHER) )
|
||||||
{
|
{
|
||||||
@@ -7566,9 +7568,8 @@ void HandleTBReloadAll( void )
|
|||||||
//if magazine is not full
|
//if magazine is not full
|
||||||
if ( (*pGun)[0]->data.gun.ubGunShotsLeft < GetMagSize( pGun ) )
|
if ( (*pGun)[0]->data.gun.ubGunShotsLeft < GetMagSize( pGun ) )
|
||||||
{
|
{
|
||||||
|
|
||||||
// Search for ammo in soldier inventory
|
// Search for ammo in soldier inventory
|
||||||
for ( UINT32 uiLoop = 0; uiLoop < pTeamSoldier->inv.size(); uiLoop++ )
|
for ( UINT32 uiLoop = 0; uiLoop < invsize; ++uiLoop )
|
||||||
{
|
{
|
||||||
if ( (Item[pTeamSoldier->inv[uiLoop].usItem].usItemClass & IC_AMMO ) ) // the item is ammo
|
if ( (Item[pTeamSoldier->inv[uiLoop].usItem].usItemClass & IC_AMMO ) ) // the item is ammo
|
||||||
{
|
{
|
||||||
@@ -7590,10 +7591,7 @@ void HandleTBReloadAll( void )
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -211,14 +211,16 @@ MercStartingGearEndElementHandle(void *userData, const XML_Char *name)
|
|||||||
pData->curMercStartingGear.PriceModifier = 0;
|
pData->curMercStartingGear.PriceModifier = 0;
|
||||||
pData->curMercStartingGear.AbsolutePrice = -1;
|
pData->curMercStartingGear.AbsolutePrice = -1;
|
||||||
pData->curMercStartingGear.mGearKitName[0] = '\0';
|
pData->curMercStartingGear.mGearKitName[0] = '\0';
|
||||||
for(unsigned int i = 0; i < pData->curMercStartingGear.inv.size(); i++)
|
UINT32 invsize = pData->curMercStartingGear.inv.size();
|
||||||
|
for(UINT32 i = 0; i < invsize; ++i)
|
||||||
{
|
{
|
||||||
pData->curMercStartingGear.inv[i] = 0;
|
pData->curMercStartingGear.inv[i] = 0;
|
||||||
pData->curMercStartingGear.iStatus[i] = 0;
|
pData->curMercStartingGear.iStatus[i] = 0;
|
||||||
pData->curMercStartingGear.iDrop[i] = 0;
|
pData->curMercStartingGear.iDrop[i] = 0;
|
||||||
pData->curMercStartingGear.iNumber[i] = 0;
|
pData->curMercStartingGear.iNumber[i] = 0;
|
||||||
}
|
}
|
||||||
for(unsigned int i = 0; i < pData->curMercStartingGear.lbe.size(); i++)
|
UINT32 lbesize = pData->curMercStartingGear.lbe.size();
|
||||||
|
for(UINT32 i = 0; i < lbesize; ++i)
|
||||||
{
|
{
|
||||||
pData->curMercStartingGear.lbe[i] = 0;
|
pData->curMercStartingGear.lbe[i] = 0;
|
||||||
pData->curMercStartingGear.lStatus[i] = 0;
|
pData->curMercStartingGear.lStatus[i] = 0;
|
||||||
|
|||||||
+172
-192
@@ -813,17 +813,17 @@ void CheckHostileOrSayQuoteList( void )
|
|||||||
|
|
||||||
void HandleSight(SOLDIERTYPE *pSoldier, UINT8 ubSightFlags)
|
void HandleSight(SOLDIERTYPE *pSoldier, UINT8 ubSightFlags)
|
||||||
{
|
{
|
||||||
UINT32 uiLoop;
|
UINT32 uiLoop;
|
||||||
SOLDIERTYPE *pThem;
|
SOLDIERTYPE *pThem;
|
||||||
INT8 bTempNewSituation;
|
INT8 bTempNewSituation;
|
||||||
|
|
||||||
if (!pSoldier->bActive || !pSoldier->bInSector || pSoldier->flags.uiStatusFlags & SOLDIER_DEAD )
|
if (!pSoldier->bActive || !pSoldier->bInSector || pSoldier->flags.uiStatusFlags & SOLDIER_DEAD )
|
||||||
{
|
{
|
||||||
// I DON'T THINK SO!
|
// I DON'T THINK SO!
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
gubSightFlags = ubSightFlags;
|
gubSightFlags = ubSightFlags;
|
||||||
|
|
||||||
if ( gubBestToMakeSightingSize != BEST_SIGHTING_ARRAY_SIZE_ALL_TEAMS_LOOK_FOR_ALL )
|
if ( gubBestToMakeSightingSize != BEST_SIGHTING_ARRAY_SIZE_ALL_TEAMS_LOOK_FOR_ALL )
|
||||||
{
|
{
|
||||||
@@ -841,7 +841,7 @@ void HandleSight(SOLDIERTYPE *pSoldier, UINT8 ubSightFlags)
|
|||||||
InitSightArrays();
|
InitSightArrays();
|
||||||
}
|
}
|
||||||
|
|
||||||
for ( uiLoop = 0; uiLoop < NUM_WATCHED_LOCS; uiLoop++ )
|
for ( uiLoop = 0; uiLoop < NUM_WATCHED_LOCS; ++uiLoop )
|
||||||
{
|
{
|
||||||
gfWatchedLocHasBeenIncremented[ pSoldier->ubID ][ uiLoop ] = FALSE;
|
gfWatchedLocHasBeenIncremented[ pSoldier->ubID ][ uiLoop ] = FALSE;
|
||||||
}
|
}
|
||||||
@@ -855,7 +855,6 @@ void HandleSight(SOLDIERTYPE *pSoldier, UINT8 ubSightFlags)
|
|||||||
// if we've been told to make this soldier look (& others look back at him)
|
// if we've been told to make this soldier look (& others look back at him)
|
||||||
if (ubSightFlags & SIGHT_LOOK)
|
if (ubSightFlags & SIGHT_LOOK)
|
||||||
{
|
{
|
||||||
|
|
||||||
// if this soldier's under our control and well enough to look
|
// if this soldier's under our control and well enough to look
|
||||||
if (pSoldier->stats.bLife >= OKLIFE )
|
if (pSoldier->stats.bLife >= OKLIFE )
|
||||||
{
|
{
|
||||||
@@ -915,13 +914,13 @@ void HandleSight(SOLDIERTYPE *pSoldier, UINT8 ubSightFlags)
|
|||||||
RadioSightings(pSoldier,EVERYBODY, MILITIA_TEAM);
|
RadioSightings(pSoldier,EVERYBODY, MILITIA_TEAM);
|
||||||
#endif*/
|
#endif*/
|
||||||
//ddd{
|
//ddd{
|
||||||
if(gGameExternalOptions.bWeSeeWhatMilitiaSeesAndViceVersa)
|
if(gGameExternalOptions.bWeSeeWhatMilitiaSeesAndViceVersa)
|
||||||
RadioSightings(pSoldier,EVERYBODY, MILITIA_TEAM);
|
RadioSightings(pSoldier,EVERYBODY, MILITIA_TEAM);
|
||||||
|
|
||||||
#ifdef ENABLE_MP_FRIENDLY_PLAYERS_SHARE_SAME_FOV
|
#ifdef ENABLE_MP_FRIENDLY_PLAYERS_SHARE_SAME_FOV
|
||||||
//haydent
|
//haydent
|
||||||
if(is_networked && pSoldier->bSide == 0 && pSoldier->bTeam != OUR_TEAM)
|
if(is_networked && pSoldier->bSide == 0 && pSoldier->bTeam != OUR_TEAM)
|
||||||
RadioSightings(pSoldier,EVERYBODY, OUR_TEAM);
|
RadioSightings(pSoldier,EVERYBODY, OUR_TEAM);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
//ddd}
|
//ddd}
|
||||||
@@ -944,7 +943,6 @@ if(gGameExternalOptions.bWeSeeWhatMilitiaSeesAndViceVersa)
|
|||||||
pSoldier->bNewOppCnt = 0;
|
pSoldier->bNewOppCnt = 0;
|
||||||
pSoldier->pathing.bNeedToLook = FALSE;
|
pSoldier->pathing.bNeedToLook = FALSE;
|
||||||
|
|
||||||
|
|
||||||
// Temporary for opplist synching - disable random order radioing
|
// Temporary for opplist synching - disable random order radioing
|
||||||
#ifndef RECORDOPPLIST
|
#ifndef RECORDOPPLIST
|
||||||
// if this soldier's NOT on our team (MAY be under our control, though!)
|
// if this soldier's NOT on our team (MAY be under our control, though!)
|
||||||
@@ -952,11 +950,10 @@ if(gGameExternalOptions.bWeSeeWhatMilitiaSeesAndViceVersa)
|
|||||||
OurTeamRadiosRandomlyAbout(pSoldier->ubID); // radio about him only
|
OurTeamRadiosRandomlyAbout(pSoldier->ubID); // radio about him only
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
// all non-humans under our control would now radio, if they were allowed
|
// all non-humans under our control would now radio, if they were allowed
|
||||||
// to radio automatically (but they're not). So just nuke new opp cnt
|
// to radio automatically (but they're not). So just nuke new opp cnt
|
||||||
// NEW: under LOCALOPPLIST, humans on other teams now also radio in here
|
// NEW: under LOCALOPPLIST, humans on other teams now also radio in here
|
||||||
for (uiLoop = 0; uiLoop < guiNumMercSlots; uiLoop++)
|
for (uiLoop = 0; uiLoop < guiNumMercSlots; ++uiLoop)
|
||||||
{
|
{
|
||||||
pThem = MercSlots[ uiLoop ];
|
pThem = MercSlots[ uiLoop ];
|
||||||
|
|
||||||
@@ -983,13 +980,12 @@ if(gGameExternalOptions.bWeSeeWhatMilitiaSeesAndViceVersa)
|
|||||||
else if ( gGameOptions.ubDifficultyLevel >= DIF_LEVEL_MEDIUM )
|
else if ( gGameOptions.ubDifficultyLevel >= DIF_LEVEL_MEDIUM )
|
||||||
{
|
{
|
||||||
// don't allow admins to radio
|
// don't allow admins to radio
|
||||||
if ( pThem->bTeam == ENEMY_TEAM && gTacticalStatus.Team[ ENEMY_TEAM ].bAwareOfOpposition && pThem->ubSoldierClass != SOLDIER_CLASS_ADMINISTRATOR )
|
if ( pThem->bTeam == ENEMY_TEAM && gTacticalStatus.Team[ ENEMY_TEAM ].bAwareOfOpposition && pThem->ubSoldierClass != SOLDIER_CLASS_ADMINISTRATOR )
|
||||||
{
|
{
|
||||||
RadioSightings(pThem,EVERYBODY, pThem->bTeam );
|
RadioSightings(pThem,EVERYBODY, pThem->bTeam );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
pThem->bNewOppCnt = 0;
|
pThem->bNewOppCnt = 0;
|
||||||
pThem->pathing.bNeedToLook = FALSE;
|
pThem->pathing.bNeedToLook = FALSE;
|
||||||
}
|
}
|
||||||
@@ -1079,11 +1075,11 @@ INT16 TeamNoLongerSeesMan( UINT8 ubTeam, SOLDIERTYPE *pOpponent, UINT8 ubExclude
|
|||||||
|
|
||||||
bLoop = gTacticalStatus.Team[ubTeam].bFirstID;
|
bLoop = gTacticalStatus.Team[ubTeam].bFirstID;
|
||||||
|
|
||||||
// look for all mercs on the same team, check opplists for this soldier
|
// look for all mercs on the same team, check opplists for this soldier
|
||||||
for (pMate = MercPtrs[bLoop]; bLoop <= gTacticalStatus.Team[ubTeam].bLastID; bLoop++,pMate++)
|
for (pMate = MercPtrs[bLoop]; bLoop <= gTacticalStatus.Team[ubTeam].bLastID; ++bLoop,pMate++)
|
||||||
{
|
{
|
||||||
// if this "teammate" is me, myself, or I (whom we want to exclude)
|
// if this "teammate" is me, myself, or I (whom we want to exclude)
|
||||||
if (bLoop == ubExcludeID)
|
if (bLoop == ubExcludeID)
|
||||||
continue; // skip to next teammate, I KNOW I don't see him...
|
continue; // skip to next teammate, I KNOW I don't see him...
|
||||||
|
|
||||||
// if this merc is not on the same team
|
// if this merc is not on the same team
|
||||||
@@ -1180,29 +1176,30 @@ INT16 MaxNormalDistanceVisible( void )
|
|||||||
|
|
||||||
INT16 SOLDIERTYPE::GetMaxDistanceVisible(INT32 sGridNo, INT8 bLevel, int calcAsType)
|
INT16 SOLDIERTYPE::GetMaxDistanceVisible(INT32 sGridNo, INT8 bLevel, int calcAsType)
|
||||||
{
|
{
|
||||||
if (sGridNo == -1) {
|
if (sGridNo == NOWHERE)
|
||||||
|
{
|
||||||
return MaxNormalDistanceVisible();
|
return MaxNormalDistanceVisible();
|
||||||
}
|
}
|
||||||
if (bLevel == -1) {
|
|
||||||
|
if (bLevel == -1)
|
||||||
|
{
|
||||||
bLevel = this->pathing.bLevel;
|
bLevel = this->pathing.bLevel;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (calcAsType == CALC_FROM_ALL_DIRS) {
|
if (calcAsType == CALC_FROM_ALL_DIRS)
|
||||||
|
{
|
||||||
return DistanceVisible( this, DIRECTION_IRRELEVANT, DIRECTION_IRRELEVANT, sGridNo, bLevel );
|
return DistanceVisible( this, DIRECTION_IRRELEVANT, DIRECTION_IRRELEVANT, sGridNo, bLevel );
|
||||||
}
|
}
|
||||||
else {
|
|
||||||
return DistanceVisible( this, (SoldierHasLimitedVision(this) ? this->pathing.bDesiredDirection : DIRECTION_IRRELEVANT), DIRECTION_IRRELEVANT, sGridNo, bLevel );
|
return DistanceVisible( this, (SoldierHasLimitedVision(this) ? this->pathing.bDesiredDirection : DIRECTION_IRRELEVANT), DIRECTION_IRRELEVANT, sGridNo, bLevel );
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
INT16 DistanceVisible( SOLDIERTYPE *pSoldier, INT8 bFacingDir, INT8 bSubjectDir, INT32 sSubjectGridNo, INT8 bLevel )
|
INT16 DistanceVisible( SOLDIERTYPE *pSoldier, INT8 bFacingDir, INT8 bSubjectDir, INT32 sSubjectGridNo, INT8 bLevel )
|
||||||
{
|
{
|
||||||
INT16 sDistVisible;
|
INT16 sDistVisible;
|
||||||
INT8 bLightLevel;
|
INT8 bLightLevel;
|
||||||
SOLDIERTYPE * pSubject;
|
|
||||||
BOOLEAN sideViewLimit = FALSE;
|
BOOLEAN sideViewLimit = FALSE;
|
||||||
|
SOLDIERTYPE* pSubject = SimpleFindSoldier( sSubjectGridNo, bLevel );
|
||||||
pSubject = SimpleFindSoldier( sSubjectGridNo, bLevel );
|
|
||||||
|
|
||||||
if (pSoldier->flags.uiStatusFlags & SOLDIER_MONSTER)
|
if (pSoldier->flags.uiStatusFlags & SOLDIER_MONSTER)
|
||||||
{
|
{
|
||||||
@@ -1210,6 +1207,7 @@ INT16 DistanceVisible( SOLDIERTYPE *pSoldier, INT8 bFacingDir, INT8 bSubjectDir,
|
|||||||
{
|
{
|
||||||
return( FALSE );
|
return( FALSE );
|
||||||
}
|
}
|
||||||
|
|
||||||
return( DistanceSmellable( pSoldier, pSubject ) );
|
return( DistanceSmellable( pSoldier, pSubject ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1233,7 +1231,6 @@ INT16 DistanceVisible( SOLDIERTYPE *pSoldier, INT8 bFacingDir, INT8 bSubjectDir,
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
||||||
if (pSoldier->sGridNo == sSubjectGridNo)
|
if (pSoldier->sGridNo == sSubjectGridNo)
|
||||||
{
|
{
|
||||||
// looking up or down or two people accidentally in same tile... don't want it to be 0!
|
// looking up or down or two people accidentally in same tile... don't want it to be 0!
|
||||||
@@ -1241,19 +1238,24 @@ INT16 DistanceVisible( SOLDIERTYPE *pSoldier, INT8 bFacingDir, INT8 bSubjectDir,
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
// Flugente: no need to calculate this multiple times
|
||||||
|
BOOLEAN fLimitedVision = SoldierHasLimitedVision(pSoldier);
|
||||||
|
|
||||||
// Lesh: added this
|
// Lesh: added this
|
||||||
if( SoldierHasLimitedVision(pSoldier) )
|
if( fLimitedVision )
|
||||||
{
|
{
|
||||||
bSubjectDir = (INT8) GetDirectionToGridNoFromGridNo( pSoldier->sGridNo, sSubjectGridNo );
|
bSubjectDir = (INT8) GetDirectionToGridNoFromGridNo( pSoldier->sGridNo, sSubjectGridNo );
|
||||||
}
|
}
|
||||||
if (bFacingDir == DIRECTION_IRRELEVANT) {
|
|
||||||
|
if (bFacingDir == DIRECTION_IRRELEVANT)
|
||||||
|
{
|
||||||
bFacingDir = pSoldier->ubDirection;
|
bFacingDir = pSoldier->ubDirection;
|
||||||
}
|
}
|
||||||
|
|
||||||
sDistVisible = gbLookDistance[bFacingDir][bSubjectDir];
|
sDistVisible = gbLookDistance[bFacingDir][bSubjectDir];
|
||||||
|
|
||||||
// Lesh: and this
|
// Lesh: and this
|
||||||
if ( (sDistVisible == 0) && (SoldierHasLimitedVision(pSoldier)) )
|
if ( (sDistVisible == 0) && fLimitedVision )
|
||||||
return(0);
|
return(0);
|
||||||
|
|
||||||
if ( sDistVisible != STRAIGHT )
|
if ( sDistVisible != STRAIGHT )
|
||||||
@@ -1301,7 +1303,7 @@ INT16 DistanceVisible( SOLDIERTYPE *pSoldier, INT8 bFacingDir, INT8 bSubjectDir,
|
|||||||
// valid map references then use the ambient light level instead.
|
// valid map references then use the ambient light level instead.
|
||||||
if ( TileIsOutOfBounds( sSubjectGridNo ) )
|
if ( TileIsOutOfBounds( sSubjectGridNo ) )
|
||||||
{
|
{
|
||||||
DebugMsg(TOPIC_JA2, DBG_LEVEL_3, String("113/UC Warning! Tried to detect the light level when character %ls[%d] looks at a location outside of the valid map (gridno %d). Assigning default %d",
|
DebugMsg(TOPIC_JA2, DBG_LEVEL_3, String("113/UC Warning! Tried to detect the light level when character %ls[%d] looks at a location outside of the valid map (gridno %d). Assigning default %d",
|
||||||
pSoldier->name, pSoldier->ubID, pSoldier->sGridNo, ubAmbientLightLevel));
|
pSoldier->name, pSoldier->ubID, pSoldier->sGridNo, ubAmbientLightLevel));
|
||||||
|
|
||||||
bLightLevel = ubAmbientLightLevel;
|
bLightLevel = ubAmbientLightLevel;
|
||||||
@@ -1329,21 +1331,21 @@ INT16 DistanceVisible( SOLDIERTYPE *pSoldier, INT8 bFacingDir, INT8 bSubjectDir,
|
|||||||
|
|
||||||
// HEADROCK HAM 3.2: Further reduce sightrange for cowering characters.
|
// HEADROCK HAM 3.2: Further reduce sightrange for cowering characters.
|
||||||
// SANDRO - this calls many sub-functions over and over, we should at least skip this for civilians and such
|
// SANDRO - this calls many sub-functions over and over, we should at least skip this for civilians and such
|
||||||
if ((gGameExternalOptions.ubCoweringReducesSightRange == 1 || gGameExternalOptions.ubCoweringReducesSightRange == 2) &&
|
// Flugente: we can check for more conditions before calculating suppression tolerance
|
||||||
IS_MERC_BODY_TYPE(pSoldier) && (pSoldier->bTeam == ENEMY_TEAM || pSoldier->bTeam == MILITIA_TEAM || pSoldier->bTeam == gbPlayerNum) )
|
if ( (gGameExternalOptions.ubCoweringReducesSightRange == 1 || gGameExternalOptions.ubCoweringReducesSightRange == 2) &&
|
||||||
|
IS_MERC_BODY_TYPE(pSoldier) && (pSoldier->bTeam == ENEMY_TEAM || pSoldier->bTeam == MILITIA_TEAM || pSoldier->bTeam == gbPlayerNum) &&
|
||||||
|
gGameExternalOptions.ubMaxSuppressionShock > 0 && sDistVisible > 0 )
|
||||||
{
|
{
|
||||||
INT8 bTolerance = CalcSuppressionTolerance( pSoldier );
|
INT8 bTolerance = CalcSuppressionTolerance( pSoldier );
|
||||||
|
|
||||||
// Make sure character is cowering.
|
// Make sure character is cowering.
|
||||||
if ( pSoldier->aiData.bShock >= bTolerance && gGameExternalOptions.ubMaxSuppressionShock > 0 &&
|
if ( pSoldier->aiData.bShock >= bTolerance )
|
||||||
sDistVisible > 0 )
|
|
||||||
{
|
{
|
||||||
sDistVisible = __max(1,(sDistVisible * (gGameExternalOptions.ubMaxSuppressionShock - pSoldier->aiData.bShock)) / gGameExternalOptions.ubMaxSuppressionShock);
|
sDistVisible = __max(1,(sDistVisible * (gGameExternalOptions.ubMaxSuppressionShock - pSoldier->aiData.bShock)) / gGameExternalOptions.ubMaxSuppressionShock);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// give one step better vision for people with nightops
|
// give one step better vision for people with nightops
|
||||||
// old/new traits check - SANDRO
|
// old/new traits check - SANDRO
|
||||||
if (gGameOptions.fNewTraitSystem)
|
if (gGameOptions.fNewTraitSystem)
|
||||||
@@ -1361,7 +1363,7 @@ INT16 DistanceVisible( SOLDIERTYPE *pSoldier, INT8 bFacingDir, INT8 bSubjectDir,
|
|||||||
{
|
{
|
||||||
sDistVisible += NightBonusScale( UVGOGGLES_BONUS, bLightLevel);
|
sDistVisible += NightBonusScale( UVGOGGLES_BONUS, bLightLevel);
|
||||||
}
|
}
|
||||||
else if ( AM_A_ROBOT( pSoldier ) )
|
else if ( AM_A_ROBOT( pSoldier ) )
|
||||||
{
|
{
|
||||||
sDistVisible += NightBonusScale( NIGHTSIGHTGOGGLES_BONUS, bLightLevel);
|
sDistVisible += NightBonusScale( NIGHTSIGHTGOGGLES_BONUS, bLightLevel);
|
||||||
}
|
}
|
||||||
@@ -1373,8 +1375,9 @@ INT16 DistanceVisible( SOLDIERTYPE *pSoldier, INT8 bFacingDir, INT8 bSubjectDir,
|
|||||||
if ( TANK(pSoldier) && sDistVisible > 0 && pSubject)
|
if ( TANK(pSoldier) && sDistVisible > 0 && pSubject)
|
||||||
{
|
{
|
||||||
sDistVisible = __max( sDistVisible + 5, pSubject->GetMaxDistanceVisible(pSoldier->sGridNo, pSoldier->pathing.bLevel) );
|
sDistVisible = __max( sDistVisible + 5, pSubject->GetMaxDistanceVisible(pSoldier->sGridNo, pSoldier->pathing.bLevel) );
|
||||||
}
|
}
|
||||||
else {
|
else
|
||||||
|
{
|
||||||
sDistVisible = __max( sDistVisible + 5, pSoldier->GetMaxDistanceVisible() );
|
sDistVisible = __max( sDistVisible + 5, pSoldier->GetMaxDistanceVisible() );
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
@@ -1852,24 +1855,25 @@ void HandleManNoLongerSeen( SOLDIERTYPE * pSoldier, SOLDIERTYPE * pOpponent, INT
|
|||||||
|
|
||||||
|
|
||||||
#ifdef ENABLE_MP_FRIENDLY_PLAYERS_SHARE_SAME_FOV
|
#ifdef ENABLE_MP_FRIENDLY_PLAYERS_SHARE_SAME_FOV
|
||||||
//haydent
|
//haydent
|
||||||
if(is_networked && pSoldier->bSide == 0)
|
if(is_networked && pSoldier->bSide == 0)
|
||||||
{
|
{
|
||||||
//stay visible
|
//stay visible
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
if(gGameExternalOptions.bWeSeeWhatMilitiaSeesAndViceVersa)
|
if(gGameExternalOptions.bWeSeeWhatMilitiaSeesAndViceVersa)
|
||||||
{ if ( (pSoldier->bTeam == gbPlayerNum || pSoldier->bTeam == MILITIA_TEAM) && !(pOpponent->bTeam == gbPlayerNum || pOpponent->bTeam == MILITIA_TEAM ) )
|
{
|
||||||
pOpponent->bVisible = 0;
|
if ( (pSoldier->bTeam == gbPlayerNum || pSoldier->bTeam == MILITIA_TEAM) && !(pOpponent->bTeam == gbPlayerNum || pOpponent->bTeam == MILITIA_TEAM ) )
|
||||||
}
|
pOpponent->bVisible = 0;
|
||||||
else
|
}
|
||||||
{
|
else
|
||||||
if ( pSoldier->bTeam == gbPlayerNum && pOpponent->bTeam != gbPlayerNum )
|
{
|
||||||
pOpponent->bVisible = 0;
|
if ( pSoldier->bTeam == gbPlayerNum && pOpponent->bTeam != gbPlayerNum )
|
||||||
}
|
pOpponent->bVisible = 0;
|
||||||
}//haydent
|
}
|
||||||
|
}//haydent
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#ifdef TESTOPPLIST
|
#ifdef TESTOPPLIST
|
||||||
@@ -1910,12 +1914,11 @@ INT16 ManLooksForMan(SOLDIERTYPE *pSoldier, SOLDIERTYPE *pOpponent, UINT8 ubCall
|
|||||||
#endif
|
#endif
|
||||||
return(success);
|
return(success);
|
||||||
}
|
}
|
||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
// if we're somehow looking while inactive, at base, dead or dying
|
// if we're somehow looking while inactive, at base, dead or dying
|
||||||
if (!pSoldier->bActive || !pSoldier->bInSector || (pSoldier->stats.bLife < OKLIFE))
|
if (!pSoldier->bActive || !pSoldier->bInSector || (pSoldier->stats.bLife < OKLIFE))
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
#ifdef BETAVERSION
|
#ifdef BETAVERSION
|
||||||
sprintf(tempstr,"ManLooksForMan: ERROR - %s is looking while inactive/at base/dead/dying. Caller %s",
|
sprintf(tempstr,"ManLooksForMan: ERROR - %s is looking while inactive/at base/dead/dying. Caller %s",
|
||||||
@@ -1934,14 +1937,12 @@ INT16 ManLooksForMan(SOLDIERTYPE *pSoldier, SOLDIERTYPE *pOpponent, UINT8 ubCall
|
|||||||
String("ERROR: ManLooksForMan - WE are inactive/dead etc ID %d(%S)to ID %d",pSoldier->ubID,pSoldier->name,pOpponent->ubID) );
|
String("ERROR: ManLooksForMan - WE are inactive/dead etc ID %d(%S)to ID %d",pSoldier->ubID,pSoldier->name,pOpponent->ubID) );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return(FALSE);
|
return(FALSE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// if we're somehow looking for a guy who is inactive, at base, or already dead
|
||||||
|
if (!pOpponent->bActive || !pOpponent->bInSector || pOpponent->stats.bLife <= 0 || TileIsOutOfBounds(pOpponent->sGridNo))
|
||||||
// if we're somehow looking for a guy who is inactive, at base, or already dead
|
{
|
||||||
if (!pOpponent->bActive || !pOpponent->bInSector || pOpponent->stats.bLife <= 0 || TileIsOutOfBounds(pOpponent->sGridNo))
|
|
||||||
{
|
|
||||||
/*
|
/*
|
||||||
#ifdef BETAVERSION
|
#ifdef BETAVERSION
|
||||||
sprintf(tempstr,"ManLooksForMan: ERROR - %s looks for %s, who is inactive/at base/dead. Caller %s",
|
sprintf(tempstr,"ManLooksForMan: ERROR - %s looks for %s, who is inactive/at base/dead. Caller %s",
|
||||||
@@ -1956,16 +1957,16 @@ INT16 ManLooksForMan(SOLDIERTYPE *pSoldier, SOLDIERTYPE *pOpponent, UINT8 ubCall
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#ifdef TESTOPPLIST
|
#ifdef TESTOPPLIST
|
||||||
DebugMsg( TOPIC_JA2OPPLIST, DBG_LEVEL_3,
|
DebugMsg( TOPIC_JA2OPPLIST, DBG_LEVEL_3,
|
||||||
String("ERROR: ManLooksForMan - TARGET is inactive etc ID %d(%S)to ID %d",pSoldier->ubID,pSoldier->name,pOpponent->ubID) );
|
String("ERROR: ManLooksForMan - TARGET is inactive etc ID %d(%S)to ID %d",pSoldier->ubID,pSoldier->name,pOpponent->ubID) );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return(FALSE);
|
return(FALSE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// if he's looking for a guy who is on the same team
|
// if he's looking for a guy who is on the same team
|
||||||
if (pSoldier->bTeam == pOpponent->bTeam)
|
if (pSoldier->bTeam == pOpponent->bTeam)
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
#ifdef BETAVERSION
|
#ifdef BETAVERSION
|
||||||
@@ -1984,10 +1985,11 @@ INT16 ManLooksForMan(SOLDIERTYPE *pSoldier, SOLDIERTYPE *pOpponent, UINT8 ubCall
|
|||||||
String("ERROR: ManLooksForMan - SAME TEAM ID %d(%S)to ID %d",pSoldier->ubID,pSoldier->name,pOpponent->ubID) );
|
String("ERROR: ManLooksForMan - SAME TEAM ID %d(%S)to ID %d",pSoldier->ubID,pSoldier->name,pOpponent->ubID) );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return(FALSE);
|
return(FALSE);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (pSoldier->stats.bLife < OKLIFE || pSoldier->flags.fMercAsleep == TRUE )
|
// Flugente: we already checked for OKLIFE above..
|
||||||
|
if ( pSoldier->flags.fMercAsleep )
|
||||||
{
|
{
|
||||||
return( FALSE );
|
return( FALSE );
|
||||||
}
|
}
|
||||||
@@ -2039,54 +2041,53 @@ INT16 ManLooksForMan(SOLDIERTYPE *pSoldier, SOLDIERTYPE *pOpponent, UINT8 ubCall
|
|||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
|
|
||||||
pPersOL = &(pSoldier->aiData.bOppList[pOpponent->ubID]);
|
pPersOL = &(pSoldier->aiData.bOppList[pOpponent->ubID]);
|
||||||
pbPublOL = &(gbPublicOpplist[pSoldier->bTeam][pOpponent->ubID]);
|
pbPublOL = &(gbPublicOpplist[pSoldier->bTeam][pOpponent->ubID]);
|
||||||
|
|
||||||
|
// if soldier is known about (SEEN or HEARD within last few turns)
|
||||||
// if soldier is known about (SEEN or HEARD within last few turns)
|
if (*pPersOL || *pbPublOL)
|
||||||
if (*pPersOL || *pbPublOL)
|
|
||||||
{
|
{
|
||||||
bAware = TRUE;
|
bAware = TRUE;
|
||||||
|
|
||||||
// then we look for him full viewing distance in EVERY direction
|
// then we look for him full viewing distance in EVERY direction
|
||||||
|
|
||||||
//ADB the comment above says EVERY direction but the code used to be:
|
//ADB the comment above says EVERY direction but the code used to be:
|
||||||
//sDistVisible = DistanceVisible(pSoldier, (SoldierHasLimitedVision(pSoldier) ? pSoldier->bDesiredDirection : DIRECTION_IRRELEVANT), 0, pOpponent->sGridNo, pOpponent->bLevel, pOpponent );
|
//sDistVisible = DistanceVisible(pSoldier, (SoldierHasLimitedVision(pSoldier) ? pSoldier->bDesiredDirection : DIRECTION_IRRELEVANT), 0, pOpponent->sGridNo, pOpponent->bLevel, pOpponent );
|
||||||
//if the code below says CALC_FROM_ALL_DIRS, then the opponent will NOT be greyed out if a merc sees him and a second merc turns away from him
|
//if the code below says CALC_FROM_ALL_DIRS, then the opponent will NOT be greyed out if a merc sees him and a second merc turns away from him
|
||||||
//calcing from the wanted dir will make the opponent be greyed out, which I think is the intended effect
|
//calcing from the wanted dir will make the opponent be greyed out, which I think is the intended effect
|
||||||
sDistVisible = pSoldier->GetMaxDistanceVisible( pOpponent->sGridNo, pOpponent->pathing.bLevel, CALC_FROM_WANTED_DIR );
|
sDistVisible = pSoldier->GetMaxDistanceVisible( pOpponent->sGridNo, pOpponent->pathing.bLevel, CALC_FROM_WANTED_DIR );
|
||||||
//if (pSoldier->ubID == 0)
|
//if (pSoldier->ubID == 0)
|
||||||
//sprintf(gDebugStr,"ALREADY KNOW: ME %d him %d val %d",pSoldier->ubID,pOpponent->ubID,pSoldier->bOppList[pOpponent->ubID]);
|
//sprintf(gDebugStr,"ALREADY KNOW: ME %d him %d val %d",pSoldier->ubID,pOpponent->ubID,pSoldier->bOppList[pOpponent->ubID]);
|
||||||
}
|
}
|
||||||
else // soldier is not currently known about
|
else // soldier is not currently known about
|
||||||
{
|
{
|
||||||
// distance we "see" then depends on the direction he is located from us
|
// distance we "see" then depends on the direction he is located from us
|
||||||
bDir = atan8(pSoldier->sX,pSoldier->sY,pOpponent->sX,pOpponent->sY);
|
bDir = atan8(pSoldier->sX,pSoldier->sY,pOpponent->sX,pOpponent->sY);
|
||||||
// BIG NOTE: must use desdir instead of direction, since in a projected
|
// BIG NOTE: must use desdir instead of direction, since in a projected
|
||||||
// situation, the direction may still be changing if it's one of the first
|
// situation, the direction may still be changing if it's one of the first
|
||||||
// few animation steps when this guy's turn to do his stepped look comes up
|
// few animation steps when this guy's turn to do his stepped look comes up
|
||||||
sDistVisible = DistanceVisible(pSoldier,pSoldier->pathing.bDesiredDirection,bDir, pOpponent->sGridNo, pOpponent->pathing.bLevel );
|
sDistVisible = DistanceVisible(pSoldier,pSoldier->pathing.bDesiredDirection,bDir, pOpponent->sGridNo, pOpponent->pathing.bLevel );
|
||||||
//if (pSoldier->ubID == 0)
|
//if (pSoldier->ubID == 0)
|
||||||
//sprintf(gDebugStr,"dist visible %d: my dir %d to him %d",sDistVisible,pSoldier->bDesiredDirection,bDir);
|
//sprintf(gDebugStr,"dist visible %d: my dir %d to him %d",sDistVisible,pSoldier->bDesiredDirection,bDir);
|
||||||
}
|
}
|
||||||
|
|
||||||
// calculate how many spaces away soldier is (using Pythagoras' theorem)
|
// calculate how many spaces away soldier is (using Pythagoras' theorem)
|
||||||
sDistAway = PythSpacesAway(pSoldier->sGridNo,pOpponent->sGridNo);
|
sDistAway = PythSpacesAway(pSoldier->sGridNo,pOpponent->sGridNo);
|
||||||
|
|
||||||
#ifdef TESTOPPLIST
|
#ifdef TESTOPPLIST
|
||||||
DebugMsg( TOPIC_JA2OPPLIST, DBG_LEVEL_3, String( "MANLOOKSFORMAN: ID %d(%S) to ID %d: sDistAway %d sDistVisible %d",pSoldier->ubID,pSoldier->name,pOpponent->ubID,sDistAway,sDistVisible) );
|
DebugMsg( TOPIC_JA2OPPLIST, DBG_LEVEL_3, String( "MANLOOKSFORMAN: ID %d(%S) to ID %d: sDistAway %d sDistVisible %d",pSoldier->ubID,pSoldier->name,pOpponent->ubID,sDistAway,sDistVisible) );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// if we see close enough to see the soldier
|
// if we see close enough to see the soldier
|
||||||
if (sDistAway <= sDistVisible)
|
if (sDistAway <= sDistVisible)
|
||||||
{
|
{
|
||||||
// and we can trace a line of sight to his x,y coordinates
|
// and we can trace a line of sight to his x,y coordinates
|
||||||
// must use the REAL opplist value here since we may or may not know of him
|
// must use the REAL opplist value here since we may or may not know of him
|
||||||
if (SoldierToSoldierLineOfSightTest(pSoldier,pOpponent,bAware,sDistVisible))
|
if (SoldierToSoldierLineOfSightTest(pSoldier,pOpponent,bAware,sDistVisible))
|
||||||
{
|
{
|
||||||
ManSeesMan(pSoldier,pOpponent,pOpponent->sGridNo,pOpponent->pathing.bLevel,MANLOOKSFORMAN,ubCaller);
|
ManSeesMan(pSoldier,pOpponent,pOpponent->sGridNo,pOpponent->pathing.bLevel,MANLOOKSFORMAN,ubCaller);
|
||||||
bSuccess = TRUE;
|
bSuccess = TRUE;
|
||||||
}
|
}
|
||||||
#ifdef TESTOPPLIST
|
#ifdef TESTOPPLIST
|
||||||
else
|
else
|
||||||
DebugMsg( TOPIC_JA2OPPLIST, DBG_LEVEL_3, String("FAILED LINEOFSIGHT: ID %d (%S)to ID %d Personally %d, public %d",pSoldier->ubID,pSoldier->name,pOpponent->ubID,*pPersOL,*pbPublOL) );
|
DebugMsg( TOPIC_JA2OPPLIST, DBG_LEVEL_3, String("FAILED LINEOFSIGHT: ID %d (%S)to ID %d Personally %d, public %d",pSoldier->ubID,pSoldier->name,pOpponent->ubID,*pPersOL,*pbPublOL) );
|
||||||
@@ -2100,8 +2101,7 @@ INT16 ManLooksForMan(SOLDIERTYPE *pSoldier, SOLDIERTYPE *pOpponent, UINT8 ubCall
|
|||||||
// (do this even if we don't have LOS, to close doors that *BREAK* LOS)
|
// (do this even if we don't have LOS, to close doors that *BREAK* LOS)
|
||||||
RevealDoorsAlongLOS();
|
RevealDoorsAlongLOS();
|
||||||
*/
|
*/
|
||||||
|
}
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -2116,36 +2116,28 @@ INT16 ManLooksForMan(SOLDIERTYPE *pSoldier, SOLDIERTYPE *pOpponent, UINT8 ubCall
|
|||||||
#endif
|
#endif
|
||||||
*/
|
*/
|
||||||
|
|
||||||
// if soldier seen personally LAST time could not be seen THIS time
|
// if soldier seen personally LAST time could not be seen THIS time
|
||||||
if (!bSuccess && (*pPersOL == SEEN_CURRENTLY))
|
if (!bSuccess && (*pPersOL == SEEN_CURRENTLY))
|
||||||
{
|
|
||||||
HandleManNoLongerSeen( pSoldier, pOpponent, pPersOL, pbPublOL );
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if (!bSuccess)
|
|
||||||
{
|
{
|
||||||
#ifdef TESTOPPLIST
|
HandleManNoLongerSeen( pSoldier, pOpponent, pPersOL, pbPublOL );
|
||||||
DebugMsg( TOPIC_JA2OPPLIST, DBG_LEVEL_3, String("NO LONGER VISIBLE ID %d (%S)to ID %d Personally %d, public %d success: %d",pSoldier->ubID,pSoldier->name,pOpponent->ubID,*pPersOL,*pbPublOL,bSuccess) );
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
// we didn't see the opponent, but since we didn't last time, we should be
|
|
||||||
//if (*pbPublOL)
|
|
||||||
//pOpponent->bVisible = TRUE;
|
|
||||||
}
|
}
|
||||||
#ifdef TESTOPPLIST
|
#ifdef TESTOPPLIST
|
||||||
else
|
else
|
||||||
DebugMsg( TOPIC_JA2OPPLIST, DBG_LEVEL_3, String("COOL. STILL VISIBLE ID %d (%S)to ID %d Personally %d, public %d success: %d",pSoldier->ubID,pSoldier->name,pOpponent->ubID,*pPersOL,*pbPublOL,bSuccess) );
|
{
|
||||||
|
if (!bSuccess)
|
||||||
|
{
|
||||||
|
DebugMsg( TOPIC_JA2OPPLIST, DBG_LEVEL_3, String("NO LONGER VISIBLE ID %d (%S)to ID %d Personally %d, public %d success: %d",pSoldier->ubID,pSoldier->name,pOpponent->ubID,*pPersOL,*pbPublOL,bSuccess) );
|
||||||
|
|
||||||
|
// we didn't see the opponent, but since we didn't last time, we should be
|
||||||
|
//if (*pbPublOL)
|
||||||
|
//pOpponent->bVisible = TRUE;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
DebugMsg( TOPIC_JA2OPPLIST, DBG_LEVEL_3, String("COOL. STILL VISIBLE ID %d (%S)to ID %d Personally %d, public %d success: %d",pSoldier->ubID,pSoldier->name,pOpponent->ubID,*pPersOL,*pbPublOL,bSuccess) );
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
return(bSuccess);
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
return(bSuccess);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -3117,13 +3109,13 @@ void UpdatePublic(UINT8 ubTeam, UINT8 ubID, INT8 bNewOpplist, INT32 sGridNo, INT
|
|||||||
// if team has been told about a guy the team was completely unaware of
|
// if team has been told about a guy the team was completely unaware of
|
||||||
if (ubTeamMustLookAgain)
|
if (ubTeamMustLookAgain)
|
||||||
{
|
{
|
||||||
// then everyone on team who's not aware of guynum must look for him
|
// then everyone on team who's not aware of guynum must look for him
|
||||||
cnt = gTacticalStatus.Team[ubTeam].bFirstID;
|
cnt = gTacticalStatus.Team[ubTeam].bFirstID;
|
||||||
|
|
||||||
for (pSoldier = MercPtrs[cnt]; cnt <= gTacticalStatus.Team[ubTeam].bLastID; cnt++,pSoldier++)
|
for (pSoldier = MercPtrs[cnt]; cnt <= gTacticalStatus.Team[ubTeam].bLastID; ++cnt, pSoldier++)
|
||||||
{
|
{
|
||||||
// if this soldier is active, in this sector, and well enough to look
|
// if this soldier is active, in this sector, and well enough to look
|
||||||
if (pSoldier->bActive && pSoldier->bInSector && (pSoldier->stats.bLife >= OKLIFE) && !( pSoldier->flags.uiStatusFlags & SOLDIER_GASSED ) )
|
if (pSoldier->bActive && pSoldier->bInSector && (pSoldier->stats.bLife >= OKLIFE) && !( pSoldier->flags.uiStatusFlags & SOLDIER_GASSED ) )
|
||||||
{
|
{
|
||||||
// if soldier isn't aware of guynum, give him another chance to see
|
// if soldier isn't aware of guynum, give him another chance to see
|
||||||
if (pSoldier->aiData.bOppList[ubID] == NOT_HEARD_OR_SEEN)
|
if (pSoldier->aiData.bOppList[ubID] == NOT_HEARD_OR_SEEN)
|
||||||
@@ -3152,24 +3144,19 @@ void UpdatePersonal(SOLDIERTYPE *pSoldier, UINT8 ubID, INT8 bNewOpplist, INT32 s
|
|||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
#ifdef RECORDOPPLIST
|
#ifdef RECORDOPPLIST
|
||||||
fprintf(OpplistFile,"UpdatePersonal - for %d about %d to %d (was %d) at g%d\n",
|
fprintf(OpplistFile,"UpdatePersonal - for %d about %d to %d (was %d) at g%d\n", ptr->guynum,guynum,newOpplist,ptr->opplist[guynum],gridno);
|
||||||
ptr->guynum,guynum,newOpplist,ptr->opplist[guynum],gridno);
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
// if new opplist is more up-to-date, or we are just wiping it for some reason
|
||||||
|
if ((gubKnowledgeValue[pSoldier->aiData.bOppList[ubID] - OLDEST_HEARD_VALUE][bNewOpplist - OLDEST_HEARD_VALUE] > 0) || (bNewOpplist == NOT_HEARD_OR_SEEN))
|
||||||
// if new opplist is more up-to-date, or we are just wiping it for some reason
|
|
||||||
if ((gubKnowledgeValue[pSoldier->aiData.bOppList[ubID] - OLDEST_HEARD_VALUE][bNewOpplist - OLDEST_HEARD_VALUE] > 0) ||
|
|
||||||
(bNewOpplist == NOT_HEARD_OR_SEEN))
|
|
||||||
{
|
{
|
||||||
pSoldier->aiData.bOppList[ubID] = bNewOpplist;
|
pSoldier->aiData.bOppList[ubID] = bNewOpplist;
|
||||||
}
|
}
|
||||||
|
|
||||||
// always update the gridno, no matter what
|
// always update the gridno, no matter what
|
||||||
gsLastKnownOppLoc[pSoldier->ubID][ubID] = sGridNo;
|
gsLastKnownOppLoc[pSoldier->ubID][ubID] = sGridNo;
|
||||||
gbLastKnownOppLevel[pSoldier->ubID][ubID] = bLevel;
|
gbLastKnownOppLevel[pSoldier->ubID][ubID] = bLevel;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -3692,12 +3679,12 @@ DebugMsg( TOPIC_JA2OPPLIST, DBG_LEVEL_3,
|
|||||||
// hang a pointer to the start of this guy's opponents in the public opplist
|
// hang a pointer to the start of this guy's opponents in the public opplist
|
||||||
pbPublOL = &(gbPublicOpplist[ubTeamToRadioTo][start]);
|
pbPublOL = &(gbPublicOpplist[ubTeamToRadioTo][start]);
|
||||||
|
|
||||||
pOpponent = MercPtrs[start];
|
pOpponent = MercPtrs[start];
|
||||||
|
|
||||||
// loop through every one of this guy's opponents
|
// loop through every one of this guy's opponents
|
||||||
for (iLoop = start; iLoop < end; iLoop++,pOpponent++,pPersOL++,pbPublOL++)
|
for (iLoop = start; iLoop < end; ++iLoop,pOpponent++,pPersOL++,pbPublOL++)
|
||||||
{
|
{
|
||||||
fContactSeen = FALSE;
|
fContactSeen = FALSE;
|
||||||
|
|
||||||
#ifdef TESTOPPLIST
|
#ifdef TESTOPPLIST
|
||||||
DebugMsg( TOPIC_JA2OPPLIST, DBG_LEVEL_3,
|
DebugMsg( TOPIC_JA2OPPLIST, DBG_LEVEL_3,
|
||||||
@@ -3823,11 +3810,11 @@ DebugMsg( TOPIC_JA2OPPLIST, DBG_LEVEL_3,
|
|||||||
|
|
||||||
// if he has publicly not been seen now, or anytime during this turn
|
// if he has publicly not been seen now, or anytime during this turn
|
||||||
if ((*pbPublOL != SEEN_CURRENTLY) && (*pbPublOL != SEEN_THIS_TURN))
|
if ((*pbPublOL != SEEN_CURRENTLY) && (*pbPublOL != SEEN_THIS_TURN))
|
||||||
{
|
{
|
||||||
// chalk up another "revealed" enemy
|
// chalk up another "revealed" enemy
|
||||||
revealedEnemies++;
|
++revealedEnemies;
|
||||||
fContactSeen = TRUE;
|
fContactSeen = TRUE;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if ( MercPtrs[0]->stats.bLife < 10 )
|
if ( MercPtrs[0]->stats.bLife < 10 )
|
||||||
@@ -5302,9 +5289,9 @@ void DebugSoldierPage4( )
|
|||||||
|
|
||||||
UINT8 MovementNoise( SOLDIERTYPE *pSoldier )
|
UINT8 MovementNoise( SOLDIERTYPE *pSoldier )
|
||||||
{
|
{
|
||||||
INT32 iStealthSkill, iRoll;
|
INT32 iStealthSkill, iRoll;
|
||||||
UINT8 ubMaxVolume, ubVolume, ubBandaged, ubEffLife;
|
UINT8 ubMaxVolume, ubVolume, ubBandaged, ubEffLife;
|
||||||
INT8 bInWater = FALSE;
|
INT8 bInWater = FALSE;
|
||||||
|
|
||||||
if ( pSoldier->bTeam == ENEMY_TEAM )
|
if ( pSoldier->bTeam == ENEMY_TEAM )
|
||||||
{
|
{
|
||||||
@@ -5330,8 +5317,9 @@ UINT8 MovementNoise( SOLDIERTYPE *pSoldier )
|
|||||||
iStealthSkill += 25 * NUM_SKILL_TRAITS( pSoldier, STEALTHY_OT );
|
iStealthSkill += 25 * NUM_SKILL_TRAITS( pSoldier, STEALTHY_OT );
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( GetWornStealth(pSoldier) > 0 )
|
INT16 wornstealth = GetWornStealth(pSoldier);
|
||||||
iStealthSkill += GetWornStealth(pSoldier) / 2;
|
if ( wornstealth > 0 )
|
||||||
|
iStealthSkill += wornstealth / 2;
|
||||||
|
|
||||||
|
|
||||||
//NumMessage("Base Stealth = ",stealthSkill);
|
//NumMessage("Base Stealth = ",stealthSkill);
|
||||||
@@ -5475,16 +5463,15 @@ UINT8 DoorOpeningNoise( SOLDIERTYPE *pSoldier )
|
|||||||
{
|
{
|
||||||
ubDoorNoise = DOOR_NOISE_VOLUME;
|
ubDoorNoise = DOOR_NOISE_VOLUME;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( MovementNoise( pSoldier ) )
|
if ( MovementNoise( pSoldier ) )
|
||||||
{
|
{
|
||||||
// failed any stealth checks
|
// failed any stealth checks
|
||||||
return( ubDoorNoise );
|
return( ubDoorNoise );
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
// succeeded in being stealthy!
|
||||||
// succeeded in being stealthy!
|
return( 0 );
|
||||||
return( 0 );
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void MakeNoise(UINT8 ubNoiseMaker, INT32 sGridNo, INT8 bLevel, UINT8 ubTerrType, UINT8 ubVolume, UINT8 ubNoiseType, STR16 zNoiseMessage )
|
void MakeNoise(UINT8 ubNoiseMaker, INT32 sGridNo, INT8 bLevel, UINT8 ubTerrType, UINT8 ubVolume, UINT8 ubNoiseType, STR16 zNoiseMessage )
|
||||||
@@ -5511,7 +5498,6 @@ void MakeNoise(UINT8 ubNoiseMaker, INT32 sGridNo, INT8 bLevel, UINT8 ubTerrType,
|
|||||||
|
|
||||||
// now call directly
|
// now call directly
|
||||||
OurNoise( SNoise.ubNoiseMaker, SNoise.sGridNo, SNoise.bLevel, SNoise.ubTerrType, SNoise.ubVolume, SNoise.ubNoiseType, SNoise.zNoiseMessage );
|
OurNoise( SNoise.ubNoiseMaker, SNoise.sGridNo, SNoise.bLevel, SNoise.ubTerrType, SNoise.ubVolume, SNoise.ubNoiseType, SNoise.zNoiseMessage );
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -5587,14 +5573,10 @@ void MakeNoise(UINT8 ubNoiseMaker, INT32 sGridNo, INT8 bLevel, UINT8 ubTerrType,
|
|||||||
|
|
||||||
void OurNoise( UINT8 ubNoiseMaker, INT32 sGridNo, INT8 bLevel, UINT8 ubTerrType, UINT8 ubVolume, UINT8 ubNoiseType, STR16 zNoiseMessage )
|
void OurNoise( UINT8 ubNoiseMaker, INT32 sGridNo, INT8 bLevel, UINT8 ubTerrType, UINT8 ubVolume, UINT8 ubNoiseType, STR16 zNoiseMessage )
|
||||||
{
|
{
|
||||||
SOLDIERTYPE *pSoldier;
|
|
||||||
|
|
||||||
|
|
||||||
#ifdef BYPASSNOISE
|
#ifdef BYPASSNOISE
|
||||||
return;
|
return;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
#ifdef BETAVERSION
|
#ifdef BETAVERSION
|
||||||
tempstr = String("OurNoise: ubNoiseType = %s, ubNoiseMaker = %d, ubNoiseMode = %d, sGridNo = %d, ubVolume = %d",
|
tempstr = String("OurNoise: ubNoiseType = %s, ubNoiseMaker = %d, ubNoiseMode = %d, sGridNo = %d, ubVolume = %d",
|
||||||
NoiseTypeStr[ubNoiseType],ubNoiseMaker,ubNoiseMode,sGridNo,ubVolume);
|
NoiseTypeStr[ubNoiseType],ubNoiseMaker,ubNoiseMode,sGridNo,ubVolume);
|
||||||
@@ -5611,14 +5593,11 @@ void OurNoise( UINT8 ubNoiseMaker, INT32 sGridNo, INT8 bLevel, UINT8 ubTerrType,
|
|||||||
|
|
||||||
if ((gTacticalStatus.uiFlags & TURNBASED) && (gTacticalStatus.uiFlags & INCOMBAT) && (ubNoiseMaker < TOTAL_SOLDIERS) && !gfDelayResolvingBestSightingDueToDoor )
|
if ((gTacticalStatus.uiFlags & TURNBASED) && (gTacticalStatus.uiFlags & INCOMBAT) && (ubNoiseMaker < TOTAL_SOLDIERS) && !gfDelayResolvingBestSightingDueToDoor )
|
||||||
{
|
{
|
||||||
pSoldier = MercPtrs[ubNoiseMaker];
|
|
||||||
|
|
||||||
// interrupts are possible, resolve them now (we're in control here)
|
// interrupts are possible, resolve them now (we're in control here)
|
||||||
// (you can't interrupt NOBODY, even if you hear the noise)
|
// (you can't interrupt NOBODY, even if you hear the noise)
|
||||||
|
|
||||||
ResolveInterruptsVs(pSoldier,NOISEINTERRUPT);
|
ResolveInterruptsVs(MercPtrs[ubNoiseMaker],NOISEINTERRUPT);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -6389,11 +6368,12 @@ void HearNoise(SOLDIERTYPE *pSoldier, UINT8 ubNoiseMaker, INT32 sGridNo, INT8 bL
|
|||||||
bSourceSeen = TRUE;
|
bSourceSeen = TRUE;
|
||||||
|
|
||||||
// if this sounds like a door opening/closing (could also be a crate)
|
// if this sounds like a door opening/closing (could also be a crate)
|
||||||
if (ubNoiseType == NOISE_CREAKING)
|
// Flugente: unused check
|
||||||
|
/*if (ubNoiseType == NOISE_CREAKING)
|
||||||
{
|
{
|
||||||
// then look around and update ALL doors that have secretly changed
|
// then look around and update ALL doors that have secretly changed
|
||||||
//LookForDoors(pSoldier,AWARE);
|
//LookForDoors(pSoldier,AWARE);
|
||||||
}
|
}*/
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -4202,7 +4202,7 @@ void DecayBombTimers( void )
|
|||||||
// Flugente: we have to check every inventory for armed bombs and do the countdown for them, too
|
// Flugente: we have to check every inventory for armed bombs and do the countdown for them, too
|
||||||
// Flugente: new stuff: we can now also arm bombs in our inventory, and detonate/defuse those bombs remotely
|
// Flugente: new stuff: we can now also arm bombs in our inventory, and detonate/defuse those bombs remotely
|
||||||
// So we have to look at every item in every inventory in this sector
|
// So we have to look at every item in every inventory in this sector
|
||||||
for (UINT32 cnt = 0; cnt < guiNumMercSlots; cnt++ )
|
for (UINT32 cnt = 0; cnt < guiNumMercSlots; ++cnt )
|
||||||
{
|
{
|
||||||
SOLDIERTYPE* pSoldier = MercSlots[ cnt ];
|
SOLDIERTYPE* pSoldier = MercSlots[ cnt ];
|
||||||
|
|
||||||
@@ -4362,7 +4362,7 @@ void SetOffBombsByFrequency( UINT8 ubID, INT8 bFrequency )
|
|||||||
|
|
||||||
// Flugente: new stuff: we can now also arm bombs in our inventory, and detonate/defuse those bombs remotely
|
// Flugente: new stuff: we can now also arm bombs in our inventory, and detonate/defuse those bombs remotely
|
||||||
// So we have to look at every item in every inventory in this sector
|
// So we have to look at every item in every inventory in this sector
|
||||||
for (UINT32 cnt = 0; cnt < guiNumMercSlots; cnt++ )
|
for (UINT32 cnt = 0; cnt < guiNumMercSlots; ++cnt )
|
||||||
{
|
{
|
||||||
SOLDIERTYPE* pSoldier = MercSlots[ cnt ];
|
SOLDIERTYPE* pSoldier = MercSlots[ cnt ];
|
||||||
|
|
||||||
|
|||||||
+44
-56
@@ -1063,28 +1063,24 @@ void RenderOverheadMap( INT16 sStartPointX_M, INT16 sStartPointY_M, INT16 sStart
|
|||||||
{
|
{
|
||||||
pTile = &( gSmTileDB[ pNode->usIndex ] );
|
pTile = &( gSmTileDB[ pNode->usIndex ] );
|
||||||
|
|
||||||
// Flugente: uninformed hack
|
sX = sTempPosX_S;
|
||||||
//if ( pTile && pTile->vo )
|
sY = sTempPosY_S;
|
||||||
|
|
||||||
|
if( gTileDatabase[ pNode->usIndex ].uiFlags & IGNORE_WORLD_HEIGHT )
|
||||||
{
|
{
|
||||||
sX = sTempPosX_S;
|
sY -= sModifiedHeight;
|
||||||
sY = sTempPosY_S;
|
|
||||||
|
|
||||||
if( gTileDatabase[ pNode->usIndex ].uiFlags & IGNORE_WORLD_HEIGHT )
|
|
||||||
{
|
|
||||||
sY -= sModifiedHeight;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
sY -= sHeight;
|
|
||||||
}
|
|
||||||
|
|
||||||
sY += ( gsRenderHeight / 5 );
|
|
||||||
|
|
||||||
pTile->vo->pShadeCurrent= gSmTileSurf[ pTile->fType ].vo->pShades[pNode->ubShadeLevel];
|
|
||||||
|
|
||||||
// RENDER!
|
|
||||||
Blt8BPPDataTo16BPPBufferTransparent((UINT16*)pDestBuf, uiDestPitchBYTES, pTile->vo, sX, sY, pTile->usSubIndex );
|
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
sY -= sHeight;
|
||||||
|
}
|
||||||
|
|
||||||
|
sY += ( gsRenderHeight / 5 );
|
||||||
|
|
||||||
|
pTile->vo->pShadeCurrent= gSmTileSurf[ pTile->fType ].vo->pShades[pNode->ubShadeLevel];
|
||||||
|
|
||||||
|
// RENDER!
|
||||||
|
Blt8BPPDataTo16BPPBufferTransparent((UINT16*)pDestBuf, uiDestPitchBYTES, pTile->vo, sX, sY, pTile->usSubIndex );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
pNode = pNode->pNext;
|
pNode = pNode->pNext;
|
||||||
@@ -1097,25 +1093,21 @@ void RenderOverheadMap( INT16 sStartPointX_M, INT16 sStartPointY_M, INT16 sStart
|
|||||||
{
|
{
|
||||||
pTile = &( gSmTileDB[ pNode->usIndex ] );
|
pTile = &( gSmTileDB[ pNode->usIndex ] );
|
||||||
|
|
||||||
// Flugente: uninformed hack
|
sX = sTempPosX_S;
|
||||||
//if ( pTile && pTile->vo )
|
sY = sTempPosY_S - sHeight;
|
||||||
{
|
//dnl ch82 081213
|
||||||
sX = sTempPosX_S;
|
sY = sTempPosY_S;
|
||||||
sY = sTempPosY_S - sHeight;
|
if(gTileDatabase[pNode->usIndex].uiFlags & IGNORE_WORLD_HEIGHT)
|
||||||
//dnl ch82 081213
|
sY -= sModifiedHeight;
|
||||||
sY = sTempPosY_S;
|
else
|
||||||
if(gTileDatabase[pNode->usIndex].uiFlags & IGNORE_WORLD_HEIGHT)
|
sY -= sHeight;
|
||||||
sY -= sModifiedHeight;
|
|
||||||
else
|
|
||||||
sY -= sHeight;
|
|
||||||
|
|
||||||
sY += ( gsRenderHeight / 5 );
|
sY += ( gsRenderHeight / 5 );
|
||||||
|
|
||||||
pTile->vo->pShadeCurrent= gSmTileSurf[ pTile->fType ].vo->pShades[pNode->ubShadeLevel];
|
pTile->vo->pShadeCurrent= gSmTileSurf[ pTile->fType ].vo->pShades[pNode->ubShadeLevel];
|
||||||
|
|
||||||
// RENDER!
|
// RENDER!
|
||||||
Blt8BPPDataTo16BPPBufferShadow((UINT16*)pDestBuf, uiDestPitchBYTES, pTile->vo, sX, sY, pTile->usSubIndex );
|
Blt8BPPDataTo16BPPBufferShadow((UINT16*)pDestBuf, uiDestPitchBYTES, pTile->vo, sX, sY, pTile->usSubIndex );
|
||||||
}
|
|
||||||
}
|
}
|
||||||
pNode = pNode->pNext;
|
pNode = pNode->pNext;
|
||||||
}
|
}
|
||||||
@@ -1130,28 +1122,24 @@ void RenderOverheadMap( INT16 sStartPointX_M, INT16 sStartPointY_M, INT16 sStart
|
|||||||
{
|
{
|
||||||
pTile = &( gSmTileDB[ pNode->usIndex ] );
|
pTile = &( gSmTileDB[ pNode->usIndex ] );
|
||||||
|
|
||||||
// Flugente: uninformed hack
|
sX = sTempPosX_S;
|
||||||
//if ( pTile && pTile->vo )
|
sY = sTempPosY_S - (gTileDatabase[ pNode->usIndex ].sOffsetHeight/5);
|
||||||
|
|
||||||
|
if( gTileDatabase[ pNode->usIndex ].uiFlags & IGNORE_WORLD_HEIGHT )
|
||||||
{
|
{
|
||||||
sX = sTempPosX_S;
|
sY -= sModifiedHeight;
|
||||||
sY = sTempPosY_S - (gTileDatabase[ pNode->usIndex ].sOffsetHeight/5);
|
|
||||||
|
|
||||||
if( gTileDatabase[ pNode->usIndex ].uiFlags & IGNORE_WORLD_HEIGHT )
|
|
||||||
{
|
|
||||||
sY -= sModifiedHeight;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
sY -= sHeight;
|
|
||||||
}
|
|
||||||
|
|
||||||
sY += ( gsRenderHeight / 5 );
|
|
||||||
|
|
||||||
pTile->vo->pShadeCurrent= gSmTileSurf[ pTile->fType ].vo->pShades[pNode->ubShadeLevel];
|
|
||||||
|
|
||||||
// RENDER!
|
|
||||||
Blt8BPPDataTo16BPPBufferTransparent((UINT16*)pDestBuf, uiDestPitchBYTES, pTile->vo, sX, sY, pTile->usSubIndex );
|
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
sY -= sHeight;
|
||||||
|
}
|
||||||
|
|
||||||
|
sY += ( gsRenderHeight / 5 );
|
||||||
|
|
||||||
|
pTile->vo->pShadeCurrent= gSmTileSurf[ pTile->fType ].vo->pShades[pNode->ubShadeLevel];
|
||||||
|
|
||||||
|
// RENDER!
|
||||||
|
Blt8BPPDataTo16BPPBufferTransparent((UINT16*)pDestBuf, uiDestPitchBYTES, pTile->vo, sX, sY, pTile->usSubIndex );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
pNode = pNode->pNext;
|
pNode = pNode->pNext;
|
||||||
|
|||||||
Reference in New Issue
Block a user