From 49a119e6b94e869d32fddf8e5ca2621864a980e9 Mon Sep 17 00:00:00 2001 From: Asdow <20314541+Asdow@users.noreply.github.com> Date: Thu, 22 Aug 2024 08:48:29 +0300 Subject: [PATCH] Convert INVTYPE boolean fields to flagmask (#325) Rearranged fields from largest to smallest to remove alignment padding --- Editor/EditorItems.cpp | 4 +- Laptop/BobbyRGuns.cpp | 22 +- Laptop/IMP Confirm.cpp | 10 +- Laptop/IMP Gear.cpp | 2 +- Strategic/ASD.cpp | 4 +- Strategic/Assignments.cpp | 22 +- Strategic/Auto Resolve.cpp | 4 +- Strategic/Hourly Update.cpp | 2 +- .../Map Screen Interface Map Inventory.cpp | 6 +- Strategic/Rebel Command.cpp | 12 +- Strategic/Strategic Event Handler.cpp | 2 +- Strategic/Strategic Movement.cpp | 2 +- Strategic/Strategic Transport Groups.cpp | 24 +- Strategic/mapscreen.cpp | 12 +- Tactical/Animation Control.cpp | 10 +- Tactical/Arms Dealer Init.cpp | 69 +-- Tactical/ArmsDealerInvInit.cpp | 8 +- Tactical/DisplayCover.cpp | 6 +- Tactical/Drugs And Alcohol.cpp | 2 +- Tactical/Faces.cpp | 6 +- Tactical/Food.cpp | 26 +- Tactical/Handle Items.cpp | 67 ++- Tactical/Handle UI.cpp | 19 +- Tactical/Interface Enhanced.cpp | 284 ++++++------ Tactical/Interface Items.cpp | 86 ++-- Tactical/Interface Panels.cpp | 17 +- Tactical/Interface.cpp | 8 +- Tactical/Inventory Choosing.cpp | 14 +- Tactical/Item Types.cpp | 2 +- Tactical/Item Types.h | 437 ++++++++---------- Tactical/Items.cpp | 392 +++++++++------- Tactical/Items.h | 78 +++- Tactical/LOS.cpp | 32 +- Tactical/LogicalBodyTypes/Filter.cpp | 4 +- Tactical/Overhead.cpp | 8 +- Tactical/Points.cpp | 36 +- Tactical/RandomMerc.cpp | 9 +- Tactical/Rotting Corpses.cpp | 4 +- Tactical/ShopKeeper Interface.cpp | 15 +- Tactical/Soldier Ani.cpp | 14 +- Tactical/Soldier Control.cpp | 165 ++++--- Tactical/Soldier Create.cpp | 43 +- Tactical/Soldier Profile.cpp | 2 +- Tactical/SoldierTooltips.cpp | 4 +- Tactical/Tactical Save.cpp | 2 +- Tactical/Turn Based Input.cpp | 8 +- Tactical/UI Cursors.cpp | 10 +- Tactical/Weapons.cpp | 108 ++--- Tactical/World Items.cpp | 4 +- TacticalAI/AIMain.cpp | 37 +- TacticalAI/AIUtils.cpp | 2 +- TacticalAI/Attacks.cpp | 69 +-- TacticalAI/DecideAction.cpp | 31 +- TacticalAI/FindLocations.cpp | 6 +- TacticalAI/NPC.cpp | 2 +- TacticalAI/PanicButtons.cpp | 1 + TileEngine/Explosion Control.cpp | 38 +- TileEngine/physics.cpp | 26 +- Utils/XML_Items.cpp | 410 ++++++++-------- 59 files changed, 1425 insertions(+), 1324 deletions(-) diff --git a/Editor/EditorItems.cpp b/Editor/EditorItems.cpp index b6c96847d..7c0b3364d 100644 --- a/Editor/EditorItems.cpp +++ b/Editor/EditorItems.cpp @@ -152,7 +152,7 @@ void EntryInitEditorItemsInfo() item = &Item[i]; //if( Item[i].fFlags & ITEM_NOT_EDITOR ) // continue; - if(item->notineditor) + if(ItemIsNotInEditor(i)) continue; if( i == SWITCH || i == ACTION_ITEM ) { @@ -331,7 +331,7 @@ void InitEditorItemsInfo(UINT32 uiItemType) continue; } item = &Item[usCounter]; - if(item->notineditor) + if(ItemIsNotInEditor(usCounter)) { usCounter++; continue; diff --git a/Laptop/BobbyRGuns.cpp b/Laptop/BobbyRGuns.cpp index 01136a576..d336e4361 100644 --- a/Laptop/BobbyRGuns.cpp +++ b/Laptop/BobbyRGuns.cpp @@ -1765,11 +1765,11 @@ BOOLEAN DisplayItemInfo(UINT32 uiItemClass, INT32 iFilter, INT32 iSubFilter) { if ( iSubFilter > -1 ) // Madd: new BR filters { - if (Item[usItemIndex].attachment && Item[usItemIndex].attachmentclass & iSubFilter ) + if (ItemIsAttachment(usItemIndex) && Item[usItemIndex].attachmentclass & iSubFilter ) bAddItem = TRUE; - else if (iSubFilter == BR_MISC_FILTER_OTHER_ATTACHMENTS && !(Item[usItemIndex].attachmentclass & BR_MISC_FILTER_STD_ATTACHMENTS) && Item[usItemIndex].attachment) + else if (iSubFilter == BR_MISC_FILTER_OTHER_ATTACHMENTS && !(Item[usItemIndex].attachmentclass & BR_MISC_FILTER_STD_ATTACHMENTS) && ItemIsAttachment(usItemIndex)) bAddItem = TRUE; - else if (iSubFilter == BR_MISC_FILTER_NO_ATTACHMENTS && !Item[usItemIndex].attachment) + else if (iSubFilter == BR_MISC_FILTER_NO_ATTACHMENTS && !ItemIsAttachment(usItemIndex)) bAddItem = TRUE; } else @@ -2653,11 +2653,11 @@ void SetFirstLastPagesForNew( UINT32 uiClassMask, INT32 iFilter, INT32 iSubFilte { if (iSubFilter > -1 ) { - if (Item[usItemIndex].attachment && Item[usItemIndex].attachmentclass & iSubFilter) + if (ItemIsAttachment(usItemIndex) && Item[usItemIndex].attachmentclass & iSubFilter) bCntNumItems = TRUE; - else if (iSubFilter == BR_MISC_FILTER_OTHER_ATTACHMENTS && !(Item[usItemIndex].attachmentclass & BR_MISC_FILTER_STD_ATTACHMENTS) && Item[usItemIndex].attachment) + else if (iSubFilter == BR_MISC_FILTER_OTHER_ATTACHMENTS && !(Item[usItemIndex].attachmentclass & BR_MISC_FILTER_STD_ATTACHMENTS) && ItemIsAttachment(usItemIndex)) bCntNumItems = TRUE; - else if (iSubFilter == BR_MISC_FILTER_NO_ATTACHMENTS && !Item[usItemIndex].attachment ) + else if (iSubFilter == BR_MISC_FILTER_NO_ATTACHMENTS && !ItemIsAttachment(usItemIndex)) bCntNumItems = TRUE; } else @@ -3641,11 +3641,11 @@ void CalcFirstIndexForPage( STORE_INVENTORY *pInv, UINT32 uiItemClass ) { if (guiCurrentMiscSubFilterMode > -1) // Madd: new BR filter options { - if (Item[usItemIndex].attachment && Item[usItemIndex].attachmentclass & guiCurrentMiscSubFilterMode) + if (ItemIsAttachment(usItemIndex) && Item[usItemIndex].attachmentclass & guiCurrentMiscSubFilterMode) bCntItem = TRUE; - else if (guiCurrentMiscSubFilterMode == BR_MISC_FILTER_OTHER_ATTACHMENTS && !(Item[usItemIndex].attachmentclass & BR_MISC_FILTER_STD_ATTACHMENTS) && Item[usItemIndex].attachment) + else if (guiCurrentMiscSubFilterMode == BR_MISC_FILTER_OTHER_ATTACHMENTS && !(Item[usItemIndex].attachmentclass & BR_MISC_FILTER_STD_ATTACHMENTS) && ItemIsAttachment(usItemIndex)) bCntItem = TRUE; - else if (guiCurrentMiscSubFilterMode == BR_MISC_FILTER_NO_ATTACHMENTS && !Item[usItemIndex].attachment) + else if (guiCurrentMiscSubFilterMode == BR_MISC_FILTER_NO_ATTACHMENTS && !ItemIsAttachment(usItemIndex)) bCntItem = TRUE; } else @@ -4181,7 +4181,7 @@ void GetHelpTextForItemInLaptop( STR16 pzStr, UINT16 usItemNumber ) for (it = range.first; it != range.second; it++) { UINT16 attachmentId = it->second.attachmentIndex; - if (!Item[attachmentId].hiddenaddon && !Item[attachmentId].hiddenattachment && ItemIsLegal(attachmentId, TRUE)) + if (!ItemIsHiddenAddon(attachmentId) && !ItemIsHiddenAttachment(attachmentId) && ItemIsLegal(attachmentId, TRUE)) { fAttachmentsFound = TRUE; if (DecorateAppendString(attachStr3, ATTACHMENTS_STRBUF_SIZE, Item[attachmentId].szItemName) == FALSE) @@ -4194,7 +4194,7 @@ void GetHelpTextForItemInLaptop( STR16 pzStr, UINT16 usItemNumber ) for (UINT32 itemId = 1; itemId < gMAXITEMS_READ; itemId++) { // If the attachment is not hidden and attachable to the gun (usItemNumber) - if (!Item[itemId].hiddenaddon && !Item[itemId].hiddenattachment && + if (!ItemIsHiddenAddon(itemId) && !ItemIsHiddenAttachment(itemId) && ItemIsLegal(itemId, TRUE) && IsAttachmentPointAvailable(Item[usItemNumber].uiIndex, itemId)) { fAttachmentsFound = TRUE; diff --git a/Laptop/IMP Confirm.cpp b/Laptop/IMP Confirm.cpp index fd74d9f2d..b5a0ac1a9 100644 --- a/Laptop/IMP Confirm.cpp +++ b/Laptop/IMP Confirm.cpp @@ -526,7 +526,7 @@ void DistributeInitialGear(MERCPROFILESTRUCT *pProfile) if(iOrder[i]!=-1) { // skip if this item is an attachment - if(Item[tInv[iOrder[i]].inv].attachment) + if(ItemIsAttachment(tInv[iOrder[i]].inv)) continue; iSet = FALSE; number = tInv[iOrder[i]].iNumber; @@ -1103,7 +1103,7 @@ INT32 SpecificFreePocket(MERCPROFILESTRUCT *pProfile, UINT16 usItem, UINT8 ubHow return HELMETPOS; if ( pProfile->inv[VESTPOS] == NONE && Armour[Item[usItem].ubClassIndex].ubArmourClass == ARMOURCLASS_VEST ) return VESTPOS; - if ( pProfile->inv[LEGPOS] == NONE && Armour[Item[usItem].ubClassIndex].ubArmourClass == ARMOURCLASS_LEGGINGS && !(Item[usItem].attachment)) + if ( pProfile->inv[LEGPOS] == NONE && Armour[Item[usItem].ubClassIndex].ubArmourClass == ARMOURCLASS_LEGGINGS && !ItemIsAttachment(usItem) ) return LEGPOS; break; case IC_BLADE: @@ -1132,7 +1132,7 @@ INT32 SpecificFreePocket(MERCPROFILESTRUCT *pProfile, UINT16 usItem, UINT8 ubHow case IC_GUN: if ( pProfile->inv[HANDPOS] == NONE ) return HANDPOS; - if ( pProfile->inv[SECONDHANDPOS] == NONE && !(Item[pProfile->inv[HANDPOS]].twohanded)) + if ( pProfile->inv[SECONDHANDPOS] == NONE && !(ItemIsTwoHanded(pProfile->inv[HANDPOS]))) return SECONDHANDPOS; if((UsingNewInventorySystem() == true)) if ( pProfile->inv[GUNSLINGPOCKPOS] == NONE && pProfile->inv[BPACKPOCKPOS] == NONE && LBEPocketType[1].ItemCapacityPerSize[Item[usItem].ItemSize]!=0) @@ -1681,7 +1681,7 @@ void GiveIMPRandomItems( MERCPROFILESTRUCT *pProfile, UINT8 typeIndex ) // give ammo for guns Assert( usItem < gMAXITEMS_READ ); - if ( Item[usItem].usItemClass == IC_GUN && !Item[usItem].rocketlauncher ) + if ( Item[usItem].usItemClass == IC_GUN && !ItemIsRocketLauncher(usItem) ) { usItem = DefaultMagazine(usItem); DebugMsg (TOPIC_JA2,DBG_LEVEL_3,String("GiveIMPRandomItems: give ammo typeIndex = %d, usItem = %d ",typeIndex, usItem )); @@ -1726,7 +1726,7 @@ void GiveIMPItems( MERCPROFILESTRUCT *pProfile, INT8 abilityValue, UINT8 typeInd MakeProfileInvItemAnySlot(pProfile,usItem,100,1); // give ammo for guns - if ( Item[usItem].usItemClass == IC_GUN && !Item[usItem].rocketlauncher ) + if ( Item[usItem].usItemClass == IC_GUN && !ItemIsRocketLauncher(usItem) ) { usItem = DefaultMagazine(usItem); DebugMsg (TOPIC_JA2,DBG_LEVEL_3,String("GiveIMPItems: give ammo typeIndex = %d, usItem = %d",typeIndex, usItem )); diff --git a/Laptop/IMP Gear.cpp b/Laptop/IMP Gear.cpp index e8da0ada3..0d84fb2f5 100644 --- a/Laptop/IMP Gear.cpp +++ b/Laptop/IMP Gear.cpp @@ -1285,7 +1285,7 @@ void DistributePossibleItemsToVectors(void) { gIMPPossibleItems[HANDPOS].push_back(std::make_pair(usItem, Item[usItem].szItemName)); - if (Item[usItem].twohanded) { + if (ItemIsTwoHanded(usItem)) { gIMPPossibleItems[GUNSLINGPOCKPOS].push_back(std::make_pair(usItem, Item[usItem].szItemName)); } else { diff --git a/Strategic/ASD.cpp b/Strategic/ASD.cpp index 8c23a6787..41bad7199 100644 --- a/Strategic/ASD.cpp +++ b/Strategic/ASD.cpp @@ -1198,7 +1198,7 @@ void EnemyHeliMANPADSCheck( INT16 id ) if ( pObj ) { // abort if this is a launcher without ammo - if ( Item[pObj->usItem].rocketlauncher && !Item[pObj->usItem].singleshotrocketlauncher ) + if (ItemIsRocketLauncher(pObj->usItem) && !ItemIsSingleShotRocketLauncher(pObj->usItem)) { OBJECTTYPE* pAttachment = FindAttachmentByClass( pObj, IC_GRENADE ); if ( !pAttachment->exists( ) ) @@ -1227,7 +1227,7 @@ void EnemyHeliMANPADSCheck( INT16 id ) MapScreenMessage( FONT_MCOLOR_LTRED, MSG_INTERFACE, szEnemyHeliText[7], pSoldier->GetName( ), Item[pObj->usItem].szItemName, pStrSectorName ); // 'fire' (remove shot) - if ( Item[pObj->usItem].singleshotrocketlauncher ) + if (ItemIsSingleShotRocketLauncher(pObj->usItem)) { CreateItem( Item[pObj->usItem].discardedlauncheritem, (*pObj)[0]->data.objectStatus, pObj ); diff --git a/Strategic/Assignments.cpp b/Strategic/Assignments.cpp index 1a1da072d..eea73652f 100644 --- a/Strategic/Assignments.cpp +++ b/Strategic/Assignments.cpp @@ -3349,7 +3349,7 @@ UINT8 CalculateRepairPointsForRepairman(SOLDIERTYPE *pSoldier, UINT16 *pusMaxPts } // can't repair at all without a toolkit - if (!Item[pSoldier->inv[HANDPOS].usItem].toolkit ) + if (!ItemIsToolkit(pSoldier->inv[HANDPOS].usItem)) { *pusMaxPts = 0; return(0); @@ -4063,7 +4063,7 @@ UINT16 ToolKitPoints(SOLDIERTYPE *pSoldier) // CHRISL: Changed to dynamically determine max inventory locations. for (int ubPocket=HANDPOS; ubPocket < NUM_INV_SLOTS; ++ubPocket) { - if( Item[pSoldier->inv[ ubPocket ].usItem].toolkit ) + if(ItemIsToolkit(pSoldier->inv[ ubPocket ].usItem)) { usKitpts += TotalPoints( &( pSoldier->inv[ ubPocket ] ) ); } @@ -5138,7 +5138,7 @@ void DoActualRepair( SOLDIERTYPE * pSoldier, UINT16 usItem, INT16 * pbStatus, IN // repairs on electronic items take twice as long if the guy doesn't have the skill // Technician/Electronic traits - repairing electronic items - SANDRO - if ( Item[ usItem ].electronic ) + if (ItemIsElectronic(usItem)) { if (gGameOptions.fNewTraitSystem) { @@ -5745,7 +5745,7 @@ void HandleRepairBySoldier( SOLDIERTYPE *pSoldier ) BOOLEAN IsItemRepairable(SOLDIERTYPE* pSoldier, UINT16 usItem, INT16 bStatus, INT16 bThreshold ) { // check to see if item can/needs to be repaired - if ( ( bStatus < 100) && ( Item[ usItem ].repairable ) ) + if ( ( bStatus < 100) && ItemIsRepairable(usItem) ) { if ( gGameExternalOptions.fAdvRepairSystem ) { @@ -10459,7 +10459,7 @@ BOOLEAN MakeSureToolKitIsInHand( SOLDIERTYPE *pSoldier ) INT8 bPocket = 0, bonus = -101, bToolkitPocket = NO_SLOT; // if there isn't a toolkit in his hand - if( Item[pSoldier->inv[ HANDPOS].usItem].toolkit ) + if(ItemIsToolkit(pSoldier->inv[ HANDPOS].usItem)) { bonus = Item[pSoldier->inv[ HANDPOS].usItem].RepairModifier; bToolkitPocket = HANDPOS; @@ -10469,7 +10469,7 @@ BOOLEAN MakeSureToolKitIsInHand( SOLDIERTYPE *pSoldier ) // CHRISL: Changed to dynamically determine max inventory locations. for (bPocket = SECONDHANDPOS; bPocket < NUM_INV_SLOTS; ++bPocket) { - if( Item[pSoldier->inv[ bPocket ].usItem].toolkit && Item[pSoldier->inv[ bPocket ].usItem].RepairModifier > bonus) + if(ItemIsToolkit(pSoldier->inv[ bPocket ].usItem) && Item[pSoldier->inv[ bPocket ].usItem].RepairModifier > bonus) { bonus = Item[pSoldier->inv[ bPocket ].usItem].RepairModifier; bToolkitPocket = bPocket; @@ -10503,7 +10503,7 @@ BOOLEAN MakeSureMedKitIsInHand( SOLDIERTYPE *pSoldier , bool bAllow1stAidKit) fTeamPanelDirty = TRUE; // if there is a MEDICAL BAG in his hand, we're set - if ( Item[pSoldier->inv[ HANDPOS ].usItem].medicalkit ) + if (ItemIsMedicalKit(pSoldier->inv[ HANDPOS ].usItem)) { return(TRUE); } @@ -10511,7 +10511,7 @@ BOOLEAN MakeSureMedKitIsInHand( SOLDIERTYPE *pSoldier , bool bAllow1stAidKit) // run through rest of inventory looking 1st for MEDICAL BAGS, swap the first one into hand if found for (bPocket = SECONDHANDPOS; bPocket < NUM_INV_SLOTS; ++bPocket) { - if ( Item[pSoldier->inv[ bPocket ].usItem].medicalkit ) + if (ItemIsMedicalKit(pSoldier->inv[ bPocket ].usItem)) { medkit_found = true; can_swap = true; @@ -10579,7 +10579,7 @@ BOOLEAN MakeSureMedKitIsInHand( SOLDIERTYPE *pSoldier , bool bAllow1stAidKit) return FALSE; // we didn't find a medical bag, so settle for a FIRST AID KIT - if ( Item[pSoldier->inv[ HANDPOS ].usItem].firstaidkit ) + if (ItemIsFirstAidKit(pSoldier->inv[ HANDPOS ].usItem)) { return(TRUE); } @@ -10588,10 +10588,10 @@ BOOLEAN MakeSureMedKitIsInHand( SOLDIERTYPE *pSoldier , bool bAllow1stAidKit) // CHRISL: Changed to dynamically determine max inventory locations. for (bPocket = SECONDHANDPOS; bPocket < NUM_INV_SLOTS; ++bPocket) { - if ( Item[pSoldier->inv[ bPocket ].usItem].firstaidkit ) + if (ItemIsFirstAidKit(pSoldier->inv[ bPocket ].usItem)) { // CHRISL: This needs to start with the first "non-big" pocket. - if( ( Item[ pSoldier -> inv[ HANDPOS ].usItem ].twohanded ) && ( bPocket >= SMALLPOCKSTART ) ) + if( (ItemIsTwoHanded(pSoldier->inv[HANDPOS].usItem) && (bPocket >= SMALLPOCKSTART))) { // first move from hand to second hand SwapObjs( pSoldier, HANDPOS, SECONDHANDPOS, TRUE ); diff --git a/Strategic/Auto Resolve.cpp b/Strategic/Auto Resolve.cpp index 2029541ee..3820ddf4f 100644 --- a/Strategic/Auto Resolve.cpp +++ b/Strategic/Auto Resolve.cpp @@ -4257,7 +4257,7 @@ BOOLEAN FireTankCannon( SOLDIERCELL *pAttacker ) { pItem = &pSoldier->inv[i]; - if ( Item[pItem->usItem].cannon ) + if (ItemIsCannon(pItem->usItem)) { PlayAutoResolveSample( Weapon[pItem->usItem].sSound, RATE_11025, 50, 1, MIDDLEPAN ); @@ -4291,7 +4291,7 @@ BOOLEAN FireAntiTankWeapon( SOLDIERCELL *pAttacker ) { pItem = &pSoldier->inv[i]; - if ( Item[pItem->usItem].usItemClass == IC_LAUNCHER || Item[pItem->usItem].cannon ) + if ( Item[pItem->usItem].usItemClass == IC_LAUNCHER || ItemIsCannon(pItem->usItem)) { pAttacker->bWeaponSlot = (INT8)i; if ( gpAR->fUnlimitedAmmo ) diff --git a/Strategic/Hourly Update.cpp b/Strategic/Hourly Update.cpp index 4cd628c26..f6e3386ee 100644 --- a/Strategic/Hourly Update.cpp +++ b/Strategic/Hourly Update.cpp @@ -627,7 +627,7 @@ void HourlySmokerUpdate( ) INT8 invsize = (INT8)pSoldier->inv.size( ); // remember inventorysize, so we don't call size() repeatedly for ( INT8 bLoop = 0; bLoop < invsize; ++bLoop ) // ... for all items in our inventory ... { - if ( pSoldier->inv[bLoop].exists( ) && Item[pSoldier->inv[bLoop].usItem].cigarette ) + if ( pSoldier->inv[bLoop].exists( ) && ItemIsCigarette(pSoldier->inv[bLoop].usItem) ) { pObj = &(pSoldier->inv[bLoop]); diff --git a/Strategic/Map Screen Interface Map Inventory.cpp b/Strategic/Map Screen Interface Map Inventory.cpp index 826e4c7be..9f2b21a4d 100644 --- a/Strategic/Map Screen Interface Map Inventory.cpp +++ b/Strategic/Map Screen Interface Map Inventory.cpp @@ -1481,7 +1481,7 @@ void MapInvenPoolSlots(MOUSE_REGION * pRegion, INT32 iReason ) } else { - if ( _KeyDown(SHIFT) && gpItemPointer == NULL && Item[twItem->object.usItem].usItemClass == IC_GUN && (twItem->object)[0]->data.gun.ubGunShotsLeft && !(Item[twItem->object.usItem].singleshotrocketlauncher)) + if ( _KeyDown(SHIFT) && gpItemPointer == NULL && Item[twItem->object.usItem].usItemClass == IC_GUN && (twItem->object)[0]->data.gun.ubGunShotsLeft && !ItemIsSingleShotRocketLauncher(twItem->object.usItem)) { EmptyWeaponMagazine( &twItem->object, &gItemPointer ); InternalMAPBeginItemPointer( MercPtrs[gCharactersList[bSelectedInfoChar].usSolID] ); @@ -6009,7 +6009,7 @@ void HandleItemCooldownFunctions( OBJECTTYPE* itemStack, INT32 deltaSeconds, BOO //original code by flugente, renamed variables to fit here, removed "min (OVERHEATING_MAX_TEMPERATURE, newValue)" for dirt to allow to go beyond maximum and deduct later the same amount if neccessary. // ... if we use overheating and item is a gun, a launcher or a barrel ... - if ( gGameExternalOptions.fWeaponOverheating && ( Item[itemStack->usItem].usItemClass & (IC_GUN|IC_LAUNCHER) || Item[itemStack->usItem].barrel == TRUE ) ) + if ( gGameExternalOptions.fWeaponOverheating && ( Item[itemStack->usItem].usItemClass & (IC_GUN|IC_LAUNCHER) || ItemIsBarrel(itemStack->usItem) ) ) { for(INT16 i = 0; i < itemStack->ubNumberOfObjects; ++i) // ... there might be multiple items here (item stack), so for each one ... { @@ -6017,7 +6017,7 @@ void HandleItemCooldownFunctions( OBJECTTYPE* itemStack, INT32 deltaSeconds, BOO FLOAT cooldownfactor = GetItemCooldownFactor(itemStack); // ... get item cooldown factor provided of attachments ... - if ( Item[itemStack->usItem].barrel == TRUE ) // ... a barrel lying around cools down a bit faster ... + if (ItemIsBarrel(itemStack->usItem)) // ... a barrel lying around cools down a bit faster ... cooldownfactor *= gGameExternalOptions.iCooldownModificatorLonelyBarrel; FLOAT newguntemperature = max(0.0f, guntemperature - tickspassed * cooldownfactor ); // ... calculate new temperature ... diff --git a/Strategic/Rebel Command.cpp b/Strategic/Rebel Command.cpp index 84f6f69f1..2f8a05c26 100644 --- a/Strategic/Rebel Command.cpp +++ b/Strategic/Rebel Command.cpp @@ -4417,16 +4417,16 @@ void SetupInfo() // (Item[i].usItemClass & IC_AMMO) && (Magazine[ Item[i].ubClassIndex ].ubMagType == AMMO_BOX or AMMO_CRATE?) for (UINT16 i = 0; i < MAXITEMS; ++i) { - if (Item[i].gascan) ItemIdCache::gasCans.push_back(i); - else if (Item[i].firstaidkit) ItemIdCache::firstAidKits.push_back(i); - else if (Item[i].medicalkit) ItemIdCache::medKits.push_back(i); - else if (Item[i].toolkit) ItemIdCache::toolKits.push_back(i); + if (ItemIsGascan(i)) ItemIdCache::gasCans.push_back(i); + else if (ItemIsFirstAidKit(i)) ItemIdCache::firstAidKits.push_back(i); + else if (ItemIsMedicalKit(i)) ItemIdCache::medKits.push_back(i); + else if (ItemIsToolkit(i)) ItemIdCache::toolKits.push_back(i); else if (Item[i].usItemClass & IC_AMMO) { if (Magazine[Item[i].ubClassIndex].ubMagType == AMMO_BOX) { - if ((gGameOptions.fGunNut || !Item[i].biggunlist) - && (gGameOptions.ubGameStyle == STYLE_SCIFI || !Item[i].scifi)) + if ((gGameOptions.fGunNut || !ItemIsOnlyInTonsOfGuns(i)) + && (gGameOptions.ubGameStyle == STYLE_SCIFI || !ItemIsOnlyInScifi(i))) { // coolness runs from 1-10, so apply offset const UINT8 coolness = min(max(1, Item[i].ubCoolness), 10); diff --git a/Strategic/Strategic Event Handler.cpp b/Strategic/Strategic Event Handler.cpp index 4358c0a14..37147e6b5 100644 --- a/Strategic/Strategic Event Handler.cpp +++ b/Strategic/Strategic Event Handler.cpp @@ -1334,7 +1334,7 @@ void CheckForMissingHospitalSupplies( void ) } } #endif//obsoleteCode - if ( Item[pObj->usItem].firstaidkit || Item[pObj->usItem].medicalkit || pObj->usItem == REGEN_BOOSTER || pObj->usItem == ADRENALINE_BOOSTER ) + if (ItemIsFirstAidKit(pObj->usItem) || ItemIsMedicalKit(pObj->usItem) || pObj->usItem == REGEN_BOOSTER || pObj->usItem == ADRENALINE_BOOSTER ) { for (StackedObjects::iterator iter = pObj->objectStack.begin(); iter != pObj->objectStack.end(); ++iter) { if ( iter->data.objectStatus > 60 ) diff --git a/Strategic/Strategic Movement.cpp b/Strategic/Strategic Movement.cpp index e8969d4f0..e1c243843 100644 --- a/Strategic/Strategic Movement.cpp +++ b/Strategic/Strategic Movement.cpp @@ -5137,7 +5137,7 @@ void AddFuelToVehicle( SOLDIERTYPE *pSoldier, SOLDIERTYPE *pVehicle ) OBJECTTYPE *pItem; INT16 sFuelNeeded, sFuelAvailable, sFuelAdded; pItem = &pSoldier->inv[ HANDPOS ]; - if( !Item[pItem->usItem].gascan ) + if( !ItemIsGascan(pItem->usItem)) { #ifdef JA2BETAVERSION CHAR16 str[ 100 ]; diff --git a/Strategic/Strategic Transport Groups.cpp b/Strategic/Strategic Transport Groups.cpp index f8e19dab2..16916e3fc 100644 --- a/Strategic/Strategic Transport Groups.cpp +++ b/Strategic/Strategic Transport Groups.cpp @@ -500,18 +500,18 @@ void UpdateTransportGroupInventory() if (!ItemIsLegal(i, TRUE)) continue; if ((Item[i].usItemClass & IC_AMMO) == 0 && (Item[i].iTransportGroupMaxProgress == 0 || Item[i].iTransportGroupMinProgress > progress || progress > Item[i].iTransportGroupMaxProgress)) continue; - if (Item[i].medical) + if (ItemIsMedical(i)) { - if (Item[i].firstaidkit) itemMap[MEDICAL_FIRSTAIDKITS].push_back(i); - else if (Item[i].medicalkit) itemMap[MEDICAL_MEDKITS].push_back(i); + if (ItemIsFirstAidKit(i)) itemMap[MEDICAL_FIRSTAIDKITS].push_back(i); + else if (ItemIsMedicalKit(i)) itemMap[MEDICAL_MEDKITS].push_back(i); else itemMap[MEDICAL_OTHER].push_back(i); } - else if (Item[i].gascan) itemMap[GAS_CANS].push_back(i); - else if (Item[i].toolkit) itemMap[TOOL_KITS].push_back(i); + else if (ItemIsGascan(i)) itemMap[GAS_CANS].push_back(i); + else if (ItemIsToolkit(i)) itemMap[TOOL_KITS].push_back(i); else if (HasItemFlag(i, RADIO_SET)) itemMap[RADIOS].push_back(i); else if (Item[i].usItemClass & IC_GRENADE) { - if (Item[i].glgrenade == 0 + if (!ItemIsGLgrenade(i) && Item[i].attachmentclass != AC_GRENADE // not for a grenade launcher && Item[i].attachmentclass != AC_ROCKET) // not for a rocket launcher itemMap[GRENADE_THROWN].push_back(i); @@ -523,7 +523,7 @@ void UpdateTransportGroupInventory() itemMap[BACKPACKS].push_back(i); } } - else if (Item[i].camouflagekit) itemMap[CAMO_KITS].push_back(i); + else if (ItemIsCamoKit(i)) itemMap[CAMO_KITS].push_back(i); else if (Item[i].usItemClass & IC_MISC) { switch (Item[i].attachmentclass) @@ -555,11 +555,11 @@ void UpdateTransportGroupInventory() { itemMap[GUNS].push_back(i); } - else if (Item[i].grenadelauncher) + else if (ItemIsGrenadeLauncher(i)) { itemMap[GRENADELAUNCHERS].push_back(i); } - else if (Item[i].rocketlauncher) + else if (ItemIsRocketLauncher(i)) { itemMap[ROCKETLAUNCHERS].push_back(i); } @@ -713,7 +713,7 @@ void UpdateTransportGroupInventory() case ROCKETLAUNCHERS: { - addItemToInventory(pSoldier, id, Item[id].singleshotrocketlauncher ? 3 : 1); + addItemToInventory(pSoldier, id, ItemIsSingleShotRocketLauncher(id) ? 3 : 1); const UINT16 launchableId = PickARandomLaunchable(id); if (launchableId == 0) continue; // no launchable matches, skip @@ -773,7 +773,7 @@ void UpdateTransportGroupInventory() for (int i = 0; i < pSoldier->inv.size(); ++i) { OBJECTTYPE* item = &pSoldier->inv[i]; - if (item->exists() && Item[item->usItem].defaultundroppable == FALSE) + if (item->exists() && ItemIsUndroppableByDefault(item->usItem) == FALSE) { item->fFlags &= ~OBJECT_UNDROPPABLE; } @@ -861,7 +861,7 @@ void UpdateTransportGroupInventory() for (int i = 0; i < pSoldier->inv.size(); ++i) { OBJECTTYPE* item = &pSoldier->inv[i]; - if (item->exists() && Item[item->usItem].defaultundroppable == FALSE) + if (item->exists() && ItemIsUndroppableByDefault(item->usItem) == FALSE) { item->fFlags &= ~OBJECT_UNDROPPABLE; } diff --git a/Strategic/mapscreen.cpp b/Strategic/mapscreen.cpp index 655d6b50e..bdf899830 100644 --- a/Strategic/mapscreen.cpp +++ b/Strategic/mapscreen.cpp @@ -9797,12 +9797,12 @@ void BltCharInvPanel() UINT32 fontColour = FONT_MCOLOR_RED; // robot targeting bonus - if (Item[pSoldier->inv[ROBOT_TARGETING_SLOT].usItem].fProvidesRobotLaserBonus) + if (ItemProvidesRobotLaserBonus(pSoldier->inv[ROBOT_TARGETING_SLOT].usItem)) { swprintf(text, szRobotText[ROBOT_TEXT_LASER]); fontColour = FONT_MCOLOR_LTGREEN; } - else if (Item[pSoldier->inv[ROBOT_TARGETING_SLOT].usItem].fProvidesRobotNightVision) + else if (ItemProvidesRobotNightvision(pSoldier->inv[ROBOT_TARGETING_SLOT].usItem)) { swprintf(text, szRobotText[ROBOT_TEXT_NIGHT_VISION]); fontColour = FONT_MCOLOR_LTGREEN; @@ -9825,7 +9825,7 @@ void BltCharInvPanel() swprintf(text, szRobotText[ROBOT_TEXT_STAT_BONUSES]); fontColour = FONT_MCOLOR_LTGREEN; } - else if (Item[pSoldier->inv[ROBOT_CHASSIS_SLOT].usItem].fProvidesRobotCamo) + else if (ItemProvidesRobotCamo(pSoldier->inv[ROBOT_CHASSIS_SLOT].usItem)) { swprintf(text, szRobotText[ROBOT_TEXT_CAMO]); fontColour = FONT_MCOLOR_LTGREEN; @@ -9858,12 +9858,12 @@ void BltCharInvPanel() swprintf(text, L"%s", szRobotText[ROBOT_TEXT_RADIO]); fontColour = FONT_MCOLOR_LTGREEN; } - else if (Item[pSoldier->inv[ROBOT_UTILITY_SLOT].usItem].metaldetector == 1) + else if (ItemIsMetalDetector(pSoldier->inv[ROBOT_UTILITY_SLOT].usItem)) { swprintf(text, L"%s", szRobotText[ROBOT_TEXT_METAL_DETECTOR]); fontColour = FONT_MCOLOR_LTGREEN; } - else if (Item[pSoldier->inv[ROBOT_UTILITY_SLOT].usItem].xray == 1) + else if (ItemHasXRay(pSoldier->inv[ROBOT_UTILITY_SLOT].usItem)) { swprintf(text, L"%s", szRobotText[ROBOT_TEXT_XRAY]); fontColour = FONT_MCOLOR_LTGREEN; @@ -10442,7 +10442,7 @@ void MAPInvClickCallback( MOUSE_REGION *pRegion, INT32 iReason ) { if ( !InItemDescriptionBox( ) ) { - if ( _KeyDown(SHIFT) && gpItemPointer == NULL && Item[pSoldier->inv[ uiHandPos ].usItem].usItemClass == IC_GUN && (pSoldier->inv[ uiHandPos ])[uiHandPos]->data.gun.ubGunShotsLeft > 0 && !(Item[pSoldier->inv[ uiHandPos ].usItem].singleshotrocketlauncher) ) + if ( _KeyDown(SHIFT) && gpItemPointer == NULL && Item[pSoldier->inv[ uiHandPos ].usItem].usItemClass == IC_GUN && (pSoldier->inv[ uiHandPos ])[uiHandPos]->data.gun.ubGunShotsLeft > 0 && !ItemIsSingleShotRocketLauncher(pSoldier->inv[ uiHandPos ].usItem) ) { EmptyWeaponMagazine( &(pSoldier->inv[ uiHandPos ]), &gItemPointer, uiHandPos ); InternalMAPBeginItemPointer( pSoldier ); diff --git a/Tactical/Animation Control.cpp b/Tactical/Animation Control.cpp index d24eb88df..fb2d9275b 100644 --- a/Tactical/Animation Control.cpp +++ b/Tactical/Animation Control.cpp @@ -4297,10 +4297,10 @@ UINT16 DetermineSoldierAnimationSurface( SOLDIERTYPE *pSoldier, UINT16 usAnimSta // ADJUST BASED ON ITEM IN HAND.... usItem = pSoldier->inv[ HANDPOS ].usItem; - if ( ( Item[ usItem ].usItemClass == IC_GUN || Item[ usItem ].usItemClass == IC_LAUNCHER ) && !Item[usItem].rocketlauncher) + if ( ( Item[ usItem ].usItemClass == IC_GUN || Item[ usItem ].usItemClass == IC_LAUNCHER ) && !ItemIsRocketLauncher(usItem) ) { // if ( (Item[ usItem ].fFlags & ITEM_TWO_HANDED) ) - if ( (Item[ usItem ].twohanded ) ) + if (ItemIsTwoHanded(usItem)) { ubWaterHandIndex = 0; } @@ -4321,7 +4321,7 @@ UINT16 DetermineSoldierAnimationSurface( SOLDIERTYPE *pSoldier, UINT16 usAnimSta // ADJUST BASED ON ITEM IN HAND.... usItem = pSoldier->inv[ HANDPOS ].usItem; - if ( !(Item[ usItem ].usItemClass == IC_GUN ) && !(Item[ usItem ].usItemClass == IC_LAUNCHER ) || Item[usItem].rocketlauncher ) + if ( !(Item[ usItem ].usItemClass == IC_GUN ) && !(Item[ usItem ].usItemClass == IC_LAUNCHER ) || ItemIsRocketLauncher(usItem) ) { if ( usAnimState == STANDING ) { @@ -4342,10 +4342,10 @@ UINT16 DetermineSoldierAnimationSurface( SOLDIERTYPE *pSoldier, UINT16 usAnimSta else { // CHECK FOR HANDGUN - if ( ( Item[ usItem ].usItemClass == IC_GUN || Item[ usItem ].usItemClass == IC_LAUNCHER ) && !Item[usItem].rocketlauncher ) + if ( ( Item[ usItem ].usItemClass == IC_GUN || Item[ usItem ].usItemClass == IC_LAUNCHER ) && !ItemIsRocketLauncher(usItem) ) { // if ( !(Item[ usItem ].fFlags & ITEM_TWO_HANDED) ) - if ( !(Item[ usItem ].twohanded ) ) + if ( !ItemIsTwoHanded(usItem) ) { // SANDRO - new anim for running with pistol by PasHancock if ( usAnimState == RUNNING ) diff --git a/Tactical/Arms Dealer Init.cpp b/Tactical/Arms Dealer Init.cpp index b7573fce4..59b64a9ac 100644 --- a/Tactical/Arms Dealer Init.cpp +++ b/Tactical/Arms Dealer Init.cpp @@ -71,7 +71,6 @@ void GuaranteeAtLeastXItemsOfIndex( UINT8 ubArmsDealer, UINT16 usItemIndex, UIN void GuaranteeAtMostNumOfItemsForItem( UINT8 ubArmsDealer, INT16 sItemIndex, UINT8 ubAtMostNumItems ); void ArmsDealerGetsFreshStock( UINT8 ubArmsDealer, UINT16 usItemIndex, UINT8 ubNumItems ); -BOOLEAN ItemContainsLiquid( UINT16 usItemIndex ); UINT8 DetermineDealerItemCondition( UINT8 ubArmsDealer, UINT16 usItemIndex ); BOOLEAN DoesItemAppearInDealerInventoryList( UINT8 ubArmsDealer, UINT16 usItemIndex, BOOLEAN fPurchaseFromPlayer ); @@ -85,8 +84,6 @@ BOOLEAN CanThisItemBeSoldToSimulatedCustomer( UINT8 ubArmsDealerID, UINT16 usIte void GuaranteeMinimumAlcohol( UINT8 ubArmsDealer ); -BOOLEAN ItemIsARocketRifle( INT16 sItemIndex ); - BOOLEAN GetArmsDealerShopHours( UINT8 ubArmsDealer, UINT32 *puiOpeningTime, UINT32 *puiClosingTime ); ARMS_DEALER_STATUS& ARMS_DEALER_STATUS::operator=(const OLD_ARMS_DEALER_STATUS_101& status) @@ -961,7 +958,7 @@ UINT32 GetArmsDealerItemTypeFromItemNumber( UINT16 usItem ) return( ARMS_DEALER_HANDGUNCLASS ); break; case RIFLECLASS: - if ( ItemIsARocketRifle( usItem ) ) + if (ItemHasFingerPrintID( usItem ) ) return( ARMS_DEALER_ROCKET_RIFLE ); else return( ARMS_DEALER_RIFLECLASS ); @@ -1010,15 +1007,15 @@ UINT32 GetArmsDealerItemTypeFromItemNumber( UINT16 usItem ) { if ( Item [usItem].alcohol > 0.0f ) return( ARMS_DEALER_ALCOHOL ); - else if ( Item [usItem].electronic ) + else if (ItemIsElectronic(usItem)) return( ARMS_DEALER_ELECTRONICS ); - else if ( Item [usItem].hardware ) + else if (ItemIsHardware(usItem)) return( ARMS_DEALER_HARDWARE ); - else if ( Item [usItem].medical ) + else if (ItemIsMedical(usItem)) return( ARMS_DEALER_MEDICAL ); - else if ( Item [usItem].attachment ) + else if (ItemIsAttachment(usItem)) return( ARMS_DEALER_ATTACHMENTS ); - else if ( Item [usItem].detonator || Item [usItem].remotedetonator || Item [usItem].remotetrigger ) + else if (ItemIsDetonator(usItem) || ItemIsRemoteDetonator(usItem) || ItemIsRemoteTrigger(usItem)) return( ARMS_DEALER_DETONATORS ); else return( ARMS_DEALER_MISC ); @@ -1076,7 +1073,7 @@ UINT32 GetArmsDealerItemTypeFromItemNumber( UINT16 usItem ) return( ARMS_DEALER_AMMO ); break; case IC_FACE: - if (Item[usItem].electronic ) + if (ItemIsElectronic(usItem)) return ARMS_DEALER_ELECTRONICS; else return ARMS_DEALER_FACE; @@ -1278,8 +1275,7 @@ BOOLEAN CanDealerRepairItem( UINT8 ubArmsDealer, UINT16 usItemIndex ) // uiFlags = Item[ usItemIndex ].fFlags; // can't repair anything that's not repairable! -// if ( !( uiFlags & ITEM_REPAIRABLE ) ) - if ( !( Item[ usItemIndex ].repairable ) ) + if ( !ItemIsRepairable(usItemIndex) ) { return(FALSE); } @@ -1297,8 +1293,7 @@ BOOLEAN CanDealerRepairItem( UINT8 ubArmsDealer, UINT16 usItemIndex ) case ARMS_DEALER_PERKO: #endif // repairs ANYTHING non-electronic -// if ( !( uiFlags & ITEM_ELECTRONIC ) ) - if ( !( Item[ usItemIndex ].electronic ) ) + if ( !ItemIsElectronic(usItemIndex) ) { return(TRUE); } @@ -1306,8 +1301,7 @@ BOOLEAN CanDealerRepairItem( UINT8 ubArmsDealer, UINT16 usItemIndex ) case ARMS_DEALER_FREDO: // repairs ONLY electronics -// if ( uiFlags & ITEM_ELECTRONIC ) - if ( Item[ usItemIndex ].electronic ) + if (ItemIsElectronic(usItemIndex)) { return(TRUE); } @@ -1318,7 +1312,7 @@ BOOLEAN CanDealerRepairItem( UINT8 ubArmsDealer, UINT16 usItemIndex ) // Flugente: if we set this guy to be a repairguy, and this item is NOT electronic, well, we can if ( armsDealerInfo[ubArmsDealer].ubTypeOfArmsDealer == ARMS_DEALER_REPAIRS ) { - if ( !( Item[ usItemIndex ].electronic ) ) + if ( !ItemIsElectronic(usItemIndex) ) return(TRUE); else return(FALSE); @@ -1369,7 +1363,7 @@ UINT8 DetermineDealerItemCondition( UINT8 ubArmsDealer, UINT16 usItemIndex ) // if it's a damagable item, and not a liquid (those are always sold full) // if ( ( Item[ usItemIndex ].fFlags & ITEM_DAMAGEABLE ) && !ItemContainsLiquid( usItemIndex ) ) - if ( ( Item[ usItemIndex ].damageable ) && !ItemContainsLiquid( usItemIndex ) ) + if (ItemIsDamageable(usItemIndex) && !ItemContainsLiquid(usItemIndex)) { // if he ONLY has used items, or 50% of the time if he carries both used & new items if ( ( armsDealerInfo[ ubArmsDealer ].uiFlags & ARMS_DEALER_ONLY_USED_ITEMS ) || @@ -1383,25 +1377,6 @@ UINT8 DetermineDealerItemCondition( UINT8 ubArmsDealer, UINT16 usItemIndex ) return( ubCondition); } -BOOLEAN ItemContainsLiquid( UINT16 usItemIndex ) -{ - return Item[usItemIndex].containsliquid; - - //switch ( usItemIndex ) - //{ - // case CANTEEN: - // case BEER: - // case ALCOHOL: - // case JAR_HUMAN_BLOOD: - // case JAR_CREATURE_BLOOD: - // case JAR_QUEEN_CREATURE_BLOOD: - // case JAR_ELIXIR: - // case GAS_CAN: - // return( TRUE ); - //} - - //return( FALSE ); -} bool ItemIsSpecial(DEALER_SPECIAL_ITEM& item) { @@ -1839,7 +1814,7 @@ void MakeObjectOutOfDealerItems( DEALER_SPECIAL_ITEM *pSpclItemInfo, OBJECTTYPE // they don't have ammo for by selling them to Tony & buying them right back fully loaded! One could repeat this // ad nauseum (empty the gun between visits) as a (really expensive) way to get unlimited special ammo like rockets. //CHRISL: If we're working with a SingleShotRocketLauncher, we need ubGunShotsLeft to equal 1 - if(Item[pObject->usItem].singleshotrocketlauncher == TRUE) + if(ItemIsSingleShotRocketLauncher(pObject->usItem)) (*pObject)[subObject]->data.gun.ubGunShotsLeft = 1; else (*pObject)[subObject]->data.gun.ubGunShotsLeft = 0; @@ -1863,7 +1838,7 @@ void GiveObjectToArmsDealerForRepair( UINT8 ubArmsDealer, OBJECTTYPE *pObject, U Assert( CanDealerRepairItem( ubArmsDealer, pObject->usItem ) ); // c) Actually damaged, or a rocket rifle (being reset) - Assert( ( (*pObject)[0]->data.objectStatus < 100 ) || ItemIsARocketRifle( pObject->usItem ) ); + Assert( ( (*pObject)[0]->data.objectStatus < 100 ) || ItemHasFingerPrintID( pObject->usItem ) ); /* ARM: Can now repair with removeable attachments still attached... // d) Already stripped of all *detachable* attachments @@ -1898,7 +1873,7 @@ void GiveItemToArmsDealerforRepair( UINT8 ubArmsDealer, OBJECTTYPE* pObject, UIN Assert( DoesDealerDoRepairs( ubArmsDealer ) ); Assert( (*pObject)[0]->data.objectStatus > 0 ); - Assert( ( (*pObject)[0]->data.objectStatus < 100 ) || ItemIsARocketRifle( pObject->usItem ) ); + Assert( ( (*pObject)[0]->data.objectStatus < 100 ) || ItemHasFingerPrintID( pObject->usItem ) ); // figure out the earliest the repairman will be free to start repairing this item uiTimeWhenFreeToStartIt = WhenWillRepairmanBeAllDoneRepairing( ubArmsDealer ); @@ -1995,8 +1970,7 @@ UINT32 CalculateSimpleItemRepairTime( UINT8 ubArmsDealer, UINT16 usItemIndex, IN // repairs on electronic items take twice as long if the guy doesn't have the skill // for dealers, this means anyone but Fredo the Electronics guy takes twice as long (but doesn't charge double) // (Mind you, current he's the ONLY one who CAN repair Electronics at all! Oh well.) -// if( ( Item[ usItemIndex ].fFlags & ITEM_ELECTRONIC ) && ( ubArmsDealer != ARMS_DEALER_FREDO ) ) - if( ( Item[ usItemIndex ].electronic ) && ( ubArmsDealer != ARMS_DEALER_FREDO ) ) + if( ItemIsElectronic(usItemIndex) && ( ubArmsDealer != ARMS_DEALER_FREDO ) ) { uiTimeToRepair *= 2; } @@ -2065,7 +2039,7 @@ UINT32 CalculateSimpleItemRepairCost( UINT8 ubArmsDealer, UINT16 usItemIndex, IN } */ - if ( ItemIsARocketRifle( usItemIndex ) ) + if (ItemHasFingerPrintID( usItemIndex ) ) { // resetting imprinting for a rocket rifle costs something extra even if rifle is at 100% uiRepairCost += 100; @@ -2167,7 +2141,7 @@ UINT16 CalcValueOfItemToDealer( UINT8 ubArmsDealer, UINT16 usItemIndex, BOOLEAN // the rest of this function applies only to the "general" dealers ( Jake, Keith, and Franz ) // Micky & Gabby specialize in creature parts & such, the others don't buy these at all (exception: jars) - if ( ( !Item[usItemIndex].jar ) && + if ( ( !ItemIsJar(usItemIndex)) && ( DoesItemAppearInDealerInventoryList( ARMS_DEALER_MICKY, usItemIndex, TRUE ) || DoesItemAppearInDealerInventoryList( ARMS_DEALER_GABBY, usItemIndex, TRUE ) ) ) { @@ -2214,7 +2188,7 @@ UINT16 CalcValueOfItemToDealer( UINT8 ubArmsDealer, UINT16 usItemIndex, BOOLEAN { // exception: Gas (Jake's) // if ( usItemIndex != GAS_CAN ) - if ( !Item[usItemIndex].gascan ) + if ( !ItemIsGascan(usItemIndex)) { // they pay only 1/3 of true value! usValueToThisDealer /= 3; @@ -2244,11 +2218,6 @@ void GuaranteeMinimumAlcohol( UINT8 ubArmsDealer ) GuaranteeAtLeastXItemsOfIndex( ubArmsDealer, ALCOHOL, ( UINT8 ) ( GetDealersMaxItemAmount( ubArmsDealer, ALCOHOL ) / 3 ) ); } -BOOLEAN ItemIsARocketRifle( INT16 sItemIndex ) -{ - return( Item[sItemIndex].fingerprintid ); -} - BOOLEAN GetArmsDealerShopHours( UINT8 ubArmsDealer, UINT32 *puiOpeningTime, UINT32 *puiClosingTime ) { SOLDIERTYPE *pSoldier; diff --git a/Tactical/ArmsDealerInvInit.cpp b/Tactical/ArmsDealerInvInit.cpp index 951f556a6..c8376592b 100644 --- a/Tactical/ArmsDealerInvInit.cpp +++ b/Tactical/ArmsDealerInvInit.cpp @@ -944,8 +944,7 @@ UINT8 GetCurrentSuitabilityForItem( INT8 bArmsDealer, UINT16 usItemIndex, BOOLEA } // items normally not sold at shops are unsuitable -// if ( Item[ usItemIndex ].fFlags & ITEM_NOT_BUYABLE ) - if ( Item[ usItemIndex ].notbuyable ) + if (ItemIsNotBuyable(usItemIndex)) { return(ITEM_SUITABILITY_NONE); } @@ -971,7 +970,7 @@ UINT8 GetCurrentSuitabilityForItem( INT8 bArmsDealer, UINT16 usItemIndex, BOOLEA // case JAR: // case JAR_ELIXIR: // case JAR_CREATURE_BLOOD: - if ( Item[usItemIndex].medical || Item[usItemIndex].canteen || Item[usItemIndex].medicalkit || Item[usItemIndex].locksmithkit || Item[usItemIndex].toolkit || Item[usItemIndex].crowbar || Item[usItemIndex].jar ) + if (ItemIsMedical(usItemIndex) || ItemIsCanteen(usItemIndex) || ItemIsMedicalKit(usItemIndex) || ItemIsLocksmithKit(usItemIndex) || ItemIsToolkit(usItemIndex) || ItemIsCrowbar(usItemIndex) || ItemIsJar(usItemIndex) ) return(ITEM_SUITABILITY_ALWAYS); //} @@ -1455,8 +1454,7 @@ UINT8 GetDealerItemCategoryNumber( UINT16 usItemIndex ) BOOLEAN CanDealerItemBeSoldUsed( UINT16 usItemIndex ) { -// if ( !( Item[ usItemIndex ].fFlags & ITEM_DAMAGEABLE ) ) - if ( !( Item[ usItemIndex ].damageable ) ) + if ( !ItemIsDamageable(usItemIndex) ) return(FALSE); // certain items, although they're damagable, shouldn't be sold in a used condition diff --git a/Tactical/DisplayCover.cpp b/Tactical/DisplayCover.cpp index f89863a9c..b4324511a 100644 --- a/Tactical/DisplayCover.cpp +++ b/Tactical/DisplayCover.cpp @@ -1274,7 +1274,7 @@ void DetermineMineDisplayInTile( INT32 sGridNo, INT8 bLevel, INT8& bOverlayType, { case MINES_DRAW_PLAYERTEAM_NETWORKS: { - if ( Item[pObj->usItem].tripwire == 1 ) + if (ItemIsTripwire(pObj->usItem)) { // if we're already marked as MINE_BOMB, switch to MINE_BOMB_AND_WIRE if ( bOverlayType == MINE_BOMB ) @@ -1314,7 +1314,7 @@ void DetermineMineDisplayInTile( INT32 sGridNo, INT8 bLevel, INT8& bOverlayType, case MINES_DRAW_NETWORKCOLOURING: { - if ( Item[pObj->usItem].tripwire == 1 ) + if (ItemIsTripwire(pObj->usItem)) { // determine if wire is of the network we're searching for // determine this tripwire's flag @@ -1342,7 +1342,7 @@ void DetermineMineDisplayInTile( INT32 sGridNo, INT8 bLevel, INT8& bOverlayType, case MINES_DRAW_NET_C: case MINES_DRAW_NET_D: { - if ( Item[pObj->usItem].tripwire == 1 ) + if (ItemIsTripwire(pObj->usItem)) { UINT32 specificnet = 0; switch ( gubDrawMode ) diff --git a/Tactical/Drugs And Alcohol.cpp b/Tactical/Drugs And Alcohol.cpp index cec2974ce..0c7c281c6 100644 --- a/Tactical/Drugs And Alcohol.cpp +++ b/Tactical/Drugs And Alcohol.cpp @@ -205,7 +205,7 @@ BOOLEAN ApplyDrugs_New( SOLDIERTYPE *pSoldier, UINT16 usItem, UINT16 uStatusUsed gMercProfiles[pSoldier->ubProfile].ubNumTimesDrugUseInLifetime++; } - if ( Item[usItem].cigarette ) + if (ItemIsCigarette(usItem)) { ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_INTERFACE, pMessageStrings[MSG_MERC_TOOK_CIGARETTE], pSoldier->GetName( ), ShortItemNames[usItem] ); } diff --git a/Tactical/Faces.cpp b/Tactical/Faces.cpp index 4759b4ac3..6eaa12e89 100644 --- a/Tactical/Faces.cpp +++ b/Tactical/Faces.cpp @@ -1950,7 +1950,7 @@ void HandleRenderFaceAdjustments( FACETYPE *pFace, BOOLEAN fDisplayBuffer, BOOLE // check first face slot if (uiFaceItemOne != NONE) { - if (Item[uiFaceItemOne].gasmask) + if (ItemIsGasmask(uiFaceItemOne)) uiFaceItemOne = 1; else if (Item[uiFaceItemOne].nightvisionrangebonus > 0) uiFaceItemOne = 2; @@ -1965,7 +1965,7 @@ void HandleRenderFaceAdjustments( FACETYPE *pFace, BOOLEAN fDisplayBuffer, BOOLE // check second face slot if (uiFaceItemTwo != NONE) { - if (Item[uiFaceItemTwo].gasmask) + if (ItemIsGasmask(uiFaceItemTwo)) uiFaceItemTwo = 21; else if (Item[uiFaceItemTwo].nightvisionrangebonus > 0) uiFaceItemTwo = 42; @@ -2250,7 +2250,7 @@ void HandleRenderFaceAdjustments( FACETYPE *pFace, BOOLEAN fDisplayBuffer, BOOLE sIconIndex_Assignment = 0; fDoIcon_Assignment = TRUE; // Show repair points if merc has a toolkit in his hand. Otherwise show cleaning points. - if (Item[pSoldier->inv[HANDPOS].usItem].toolkit) + if (ItemIsToolkit(pSoldier->inv[HANDPOS].usItem)) sPtsAvailable = CalculateRepairPointsForRepairman(MercPtrs[pFace->ubSoldierID], &usMaximumPts, FALSE); else sPtsAvailable = CalculateCleaningPointsForRepairman(MercPtrs[pFace->ubSoldierID], &usMaximumPts); diff --git a/Tactical/Food.cpp b/Tactical/Food.cpp index 0b656d491..872a4958a 100644 --- a/Tactical/Food.cpp +++ b/Tactical/Food.cpp @@ -174,7 +174,7 @@ BOOLEAN ApplyFood( SOLDIERTYPE *pSoldier, OBJECTTYPE *pObject, UINT16 usPointsTo return( FALSE); // workaround: canteens with 1% status are treated as 'empty'. They cannot be consumed, but refilled - if ( Item[pObject->usItem].canteen == TRUE && (*pObject)[0]->data.objectStatus == 1 ) + if (ItemIsCanteen(pObject->usItem) && (*pObject)[0]->data.objectStatus == 1 ) return( FALSE); // do we eat or drink this stuff? @@ -693,7 +693,7 @@ void EatFromInventory( SOLDIERTYPE *pSoldier, BOOLEAN fcanteensonly ) // if fcanteensonly is TRUE, omit everything that is not a canteen if ( fcanteensonly ) { - if ( Item[pObj->usItem].canteen == FALSE ) + if ( !ItemIsCanteen(pObj->usItem)) continue; } else @@ -707,7 +707,7 @@ void EatFromInventory( SOLDIERTYPE *pSoldier, BOOLEAN fcanteensonly ) if ( foodcondition < FOOD_BAD_THRESHOLD ) continue; - if ( Item[pObj->usItem].canteen == TRUE ) + if (ItemIsCanteen(pObj->usItem)) continue; } @@ -741,7 +741,7 @@ void EatFromInventory( SOLDIERTYPE *pSoldier, BOOLEAN fcanteensonly ) // if fcanteensonly is TRUE, omit everything that is not a canteen if ( fcanteensonly ) { - if ( Item[pObj->usItem].canteen == FALSE ) + if (!ItemIsCanteen(pObj->usItem)) continue; } @@ -846,7 +846,7 @@ void SectorFillCanteens( void ) for ( INT8 bLoop = 0; bLoop < invsize; ++bLoop) // ... for all items in our inventory ... { // ... if Item exists and is canteen (that can have drink points) ... - if (pSoldier->inv[bLoop].exists() == true && Item[pSoldier->inv[bLoop].usItem].canteen && Food[Item[pSoldier->inv[bLoop].usItem].foodtype].bDrinkPoints > 0) + if (pSoldier->inv[bLoop].exists() == true && ItemIsCanteen(pSoldier->inv[bLoop].usItem) && Food[Item[pSoldier->inv[bLoop].usItem].foodtype].bDrinkPoints > 0) { OBJECTTYPE* pObj = &(pSoldier->inv[bLoop]); // ... get pointer for this item ... @@ -878,7 +878,7 @@ void SectorFillCanteens( void ) if( gWorldItems[ uiCount ].fExists ) // ... if item exists ... { // ... if Item exists and is a canteen (only those are refillable) ... - if ( Item[gWorldItems[ uiCount ].object.usItem].canteen && Food[Item[gWorldItems[ uiCount ].object.usItem].foodtype].bDrinkPoints > 0) + if (ItemIsCanteen(gWorldItems[ uiCount ].object.usItem) && Food[Item[gWorldItems[ uiCount ].object.usItem].foodtype].bDrinkPoints > 0) { OBJECTTYPE* pObj = &(gWorldItems[ uiCount ].object); // ... get pointer for this item ... @@ -920,7 +920,7 @@ void SectorFillCanteens( void ) for ( INT8 bLoop = 0; bLoop < invsize; ++bLoop) // ... for all items in our inventory ... { // ... if Item exists and is canteen and is NOT a water drum... - if (pSoldier->inv[bLoop].exists() == true && Item[pSoldier->inv[bLoop].usItem].canteen && (Food[Item[pSoldier->inv[bLoop].usItem].foodtype].bDrinkPoints > 0) && !HasItemFlag(pSoldier->inv[bLoop].usItem, (WATER_DRUM))) + if (pSoldier->inv[bLoop].exists() == true && ItemIsCanteen(pSoldier->inv[bLoop].usItem) && (Food[Item[pSoldier->inv[bLoop].usItem].foodtype].bDrinkPoints > 0) && !HasItemFlag(pSoldier->inv[bLoop].usItem, (WATER_DRUM))) { OBJECTTYPE* pObj = &(pSoldier->inv[bLoop]); // ... get pointer for this item ... @@ -973,7 +973,7 @@ void SectorFillCanteens( void ) if( gWorldItems[ uiCount ].fExists ) // ... if item exists ... { // ... if Item exists and is a canteen (only those are refillable) ... - if ( Item[gWorldItems[ uiCount ].object.usItem].canteen ) + if (ItemIsCanteen(gWorldItems[ uiCount ].object.usItem)) { OBJECTTYPE* pObj = &(gWorldItems[ uiCount ].object); // ... get pointer for this item ... @@ -1031,7 +1031,7 @@ OBJECTTYPE* GetUsableWaterDrumInSector( void ) if( gWorldItems[ uiCount ].fExists ) // ... if item exists ... { // ... if Item exists and is a canteen (only those are refillable) ... - if ( Item[gWorldItems[ uiCount ].object.usItem].canteen ) + if (ItemIsCanteen(gWorldItems[ uiCount ].object.usItem)) { OBJECTTYPE* pObj = &(gWorldItems[ uiCount ].object); // ... get pointer for this item ... @@ -1077,7 +1077,7 @@ void SoldierAutoFillCanteens(SOLDIERTYPE *pSoldier) for ( INT8 bLoop = 0; bLoop < invsize; ++bLoop) // ... for all items in our inventory ... { // ... if Item exists and is canteen (that can have drink points) ... - if (pSoldier->inv[bLoop].exists() == true && Item[pSoldier->inv[bLoop].usItem].canteen && Food[Item[pSoldier->inv[bLoop].usItem].foodtype].bDrinkPoints > 0) + if (pSoldier->inv[bLoop].exists() == true && ItemIsCanteen(pSoldier->inv[bLoop].usItem) && Food[Item[pSoldier->inv[bLoop].usItem].foodtype].bDrinkPoints > 0) { OBJECTTYPE* pObj = &(pSoldier->inv[bLoop]); // ... get pointer for this item ... @@ -1118,7 +1118,7 @@ BOOLEAN HasFoodInInventory( SOLDIERTYPE *pSoldier, BOOLEAN fCheckFood, BOOLEAN f if ( fCheckDrink && Food[Item[pSoldier->inv[bLoop].usItem].foodtype].bDrinkPoints ) { - if ( Item[pSoldier->inv[bLoop].usItem].canteen ) + if (ItemIsCanteen(pSoldier->inv[bLoop].usItem)) { // empty canteens retain 1% status, so check ether something is in them if ( pSoldier->inv[bLoop][0]->data.objectStatus > 1 ) @@ -1170,7 +1170,7 @@ void DrinkFromWaterTap( SOLDIERTYPE* pSoldier ) for (INT8 bLoop = 0; bLoop < invsize; ++bLoop) // ... for all items in our inventory ... { // ... if Item exists and is canteen (that can have drink points) ... - if (pSoldier->inv[bLoop].exists() == true && Item[pSoldier->inv[bLoop].usItem].canteen && Food[Item[pSoldier->inv[bLoop].usItem].foodtype].bDrinkPoints > 0) + if (pSoldier->inv[bLoop].exists() == true && ItemIsCanteen(pSoldier->inv[bLoop].usItem) && Food[Item[pSoldier->inv[bLoop].usItem].foodtype].bDrinkPoints > 0) { OBJECTTYPE* pObj = &(pSoldier->inv[bLoop]); // ... get pointer for this item ... @@ -1197,4 +1197,4 @@ void DrinkFromWaterTap( SOLDIERTYPE* pSoldier ) } ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_INTERFACE, szInteractiveActionText[8], pSoldier->GetName( ) ); -} \ No newline at end of file +} diff --git a/Tactical/Handle Items.cpp b/Tactical/Handle Items.cpp index 7e9c6476d..b7d9414b1 100644 --- a/Tactical/Handle Items.cpp +++ b/Tactical/Handle Items.cpp @@ -319,7 +319,7 @@ INT32 HandleItem( SOLDIERTYPE *pSoldier, INT32 sGridNo, INT8 bLevel, UINT16 usHa pSoldier->ubProfile != NO_PROFILE && pTargetSoldier && Item[usHandItem].usItemClass != IC_MEDKIT && - !Item[usHandItem].gascan && + !ItemIsGascan(usHandItem) && !ItemCanBeAppliedToOthers(usHandItem) && !HasItemFlag(usHandItem, EMPTY_BLOOD_BAG) && !HasItemFlag( usHandItem, MEDICAL_SPLINT ) ) @@ -473,8 +473,8 @@ INT32 HandleItem( SOLDIERTYPE *pSoldier, INT32 sGridNo, INT8 bLevel, UINT16 usHa if ( Item[ usHandItem ].usItemClass == IC_GUN || Item[ usHandItem ].usItemClass == IC_THROWING_KNIFE ) { // WEAPONS - DebugMsg(TOPIC_JA2,DBG_LEVEL_3,String("HandleItem: checking for fingerprintID, item id = %d,id required = %d, imprint id = %d, soldier id = %d",usHandItem,Item[usHandItem].fingerprintid,pSoldier->inv[ pSoldier->ubAttackingHand ][0]->data.ubImprintID,pSoldier->ubProfile)); - if ( Item[usHandItem].fingerprintid ) + DebugMsg(TOPIC_JA2,DBG_LEVEL_3,String("HandleItem: checking for fingerprintID, item id = %d,id required = %d, imprint id = %d, soldier id = %d",usHandItem, ItemHasFingerPrintID(usHandItem), pSoldier->inv[ pSoldier->ubAttackingHand ][0]->data.ubImprintID,pSoldier->ubProfile)); + if (ItemHasFingerPrintID(usHandItem)) { // check imprint ID // NB not-imprinted value is NO_PROFILE @@ -807,7 +807,7 @@ INT32 HandleItem( SOLDIERTYPE *pSoldier, INT32 sGridNo, INT8 bLevel, UINT16 usHa } // ATE: Here to make cursor go back to move after LAW shot... - if ( fFromUI && Item[usHandItem].singleshotrocketlauncher) + if ( fFromUI && ItemIsSingleShotRocketLauncher(usHandItem) ) { guiPendingOverrideEvent = A_CHANGE_TO_MOVE; } @@ -969,7 +969,7 @@ INT32 HandleItem( SOLDIERTYPE *pSoldier, INT32 sGridNo, INT8 bLevel, UINT16 usHa BOOLEAN fCorpse = FALSE; if(pCorpse != NULL) fCorpse = IsValidDecapitationCorpse( pCorpse ); - if ( Item[usHandItem].wirecutters && pTargetSoldier == NULL && !pCorpse ) // Madd: quick fix to allow wirecutter/knives + if (ItemIsWirecutters(usHandItem) && pTargetSoldier == NULL && !pCorpse ) // Madd: quick fix to allow wirecutter/knives { // See if we can get there to stab sActionGridNo = FindAdjacentGridEx( pSoldier, sGridNo, &ubDirection, &sAdjustedGridNo, TRUE, FALSE ); @@ -1025,7 +1025,7 @@ INT32 HandleItem( SOLDIERTYPE *pSoldier, INT32 sGridNo, INT8 bLevel, UINT16 usHa } } - if ( Item[usHandItem].toolkit ) + if (ItemIsToolkit(usHandItem)) { UINT8 ubMercID; BOOLEAN fVehicle = FALSE; @@ -1098,7 +1098,7 @@ INT32 HandleItem( SOLDIERTYPE *pSoldier, INT32 sGridNo, INT8 bLevel, UINT16 usHa } } - if ( Item[usHandItem].gascan ) + if (ItemIsGascan(usHandItem)) { UINT8 ubMercID; INT32 sVehicleGridNo=-1; @@ -1170,7 +1170,7 @@ INT32 HandleItem( SOLDIERTYPE *pSoldier, INT32 sGridNo, INT8 bLevel, UINT16 usHa } - if ( Item[usHandItem].jar ) + if (ItemIsJar(usHandItem)) { sActionGridNo = FindAdjacentGridEx( pSoldier, sGridNo, &ubDirection, &sAdjustedGridNo, TRUE, FALSE ); @@ -1614,7 +1614,7 @@ INT32 HandleItem( SOLDIERTYPE *pSoldier, INT32 sGridNo, INT8 bLevel, UINT16 usHa } } - if ( Item[usHandItem].canandstring ) + if (ItemIsCanAndString(usHandItem)) { STRUCTURE *pStructure; LEVELNODE *pIntTile; @@ -1686,7 +1686,7 @@ INT32 HandleItem( SOLDIERTYPE *pSoldier, INT32 sGridNo, INT8 bLevel, UINT16 usHa if ( EnoughPoints( pSoldier, sAPCost, 0, fFromUI ) ) { DeductPoints( pSoldier, sAPCost, 0 ); - if ( Item[usHandItem].xray ) + if (ItemHasXRay(usHandItem)) { PlayJA2Sample( USE_X_RAY_MACHINE, RATE_11025, SoundVolume( HIGHVOLUME, pSoldier->sGridNo ), 1, SoundDir( pSoldier->sGridNo ) ); @@ -1867,7 +1867,7 @@ INT32 HandleItem( SOLDIERTYPE *pSoldier, INT32 sGridNo, INT8 bLevel, UINT16 usHa sAPCost = MinAPsToAttack( pSoldier, sTargetGridNo, TRUE, pSoldier->aiData.bAimTime, 0 ); // Check if these is room to place mortar! - if ( Item[usHandItem].mortar ) + if (ItemIsMortar(usHandItem)) { ubDirection = (UINT8)GetDirectionFromGridNo( sTargetGridNo, pSoldier ); @@ -1881,7 +1881,7 @@ INT32 HandleItem( SOLDIERTYPE *pSoldier, INT32 sGridNo, INT8 bLevel, UINT16 usHa //pSoldier->flags.fDontChargeAPsForStanceChange = TRUE;//dnl ch72 270913 no reason why not charge for stance change } - else if ( Item[usHandItem].grenadelauncher )//usHandItem == GLAUNCHER || usHandItem == UNDER_GLAUNCHER ) + else if (ItemIsGrenadeLauncher(usHandItem))//usHandItem == GLAUNCHER || usHandItem == UNDER_GLAUNCHER ) { GetAPChargeForShootOrStabWRTGunRaises( pSoldier, sTargetGridNo, TRUE, &fAddingTurningCost, &fAddingRaiseGunCost, pSoldier->aiData.bAimTime ); usTurningCost = CalculateTurningCost(pSoldier, usHandItem, fAddingTurningCost); @@ -1960,7 +1960,7 @@ INT32 HandleItem( SOLDIERTYPE *pSoldier, INT32 sGridNo, INT8 bLevel, UINT16 usHa if ( Item[ usHandItem ].ubCursor == INVALIDCURS ) { // Found detonator... - if ( HasAttachmentOfClass( &(pSoldier->inv[pSoldier->ubAttackingHand]), (AC_DETONATOR | AC_REMOTEDET | AC_DEFUSE) ) || Item[usHandItem].tripwire ) + if ( HasAttachmentOfClass( &(pSoldier->inv[pSoldier->ubAttackingHand]), (AC_DETONATOR | AC_REMOTEDET | AC_DEFUSE) ) || ItemIsTripwire(usHandItem)) { StartBombMessageBox( pSoldier, sGridNo ); @@ -1980,7 +1980,7 @@ INT32 HandleItem( SOLDIERTYPE *pSoldier, INT32 sGridNo, INT8 bLevel, UINT16 usHa void HandleSoldierDropBomb( SOLDIERTYPE *pSoldier, INT32 sGridNo ) { // Does this have detonator that needs info? - if ( HasAttachmentOfClass( &(pSoldier->inv[ HANDPOS ] ), (AC_DETONATOR | AC_REMOTEDET | AC_DEFUSE) ) || Item[ (&(pSoldier->inv[ HANDPOS ] ))->usItem ].tripwire == 1) + if ( HasAttachmentOfClass( &(pSoldier->inv[ HANDPOS ] ), (AC_DETONATOR | AC_REMOTEDET | AC_DEFUSE) ) || ItemIsTripwire((&(pSoldier->inv[ HANDPOS ] ))->usItem) ) { StartBombMessageBox( pSoldier, sGridNo ); } @@ -2003,7 +2003,7 @@ void HandleSoldierDropBomb( SOLDIERTYPE *pSoldier, INT32 sGridNo ) if ( iResult >= 0 ) { // Less explosives gain for placing tripwire - if ( Item[ pSoldier->inv[ HANDPOS ].usItem ].tripwire ) + if (ItemIsTripwire(pSoldier->inv[ HANDPOS ].usItem)) StatChange( pSoldier, EXPLODEAMT, 1, FALSE ); else if ( HasItemFlag( (pSoldier->inv[HANDPOS]).usItem, BEARTRAP ) ) StatChange( pSoldier, MECHANAMT, 10, FALSE ); @@ -2027,7 +2027,7 @@ void HandleSoldierDropBomb( SOLDIERTYPE *pSoldier, INT32 sGridNo ) pSoldier->inv[ HANDPOS ][0]->data.bTrap++; // anv: additional tile properties - modify trap level depending on its placement - if(gGameExternalOptions.fAdditionalTileProperties && Item[ pSoldier->inv[ HANDPOS ].usItem ].tripwire != 1 ) + if(gGameExternalOptions.fAdditionalTileProperties && !ItemIsTripwire(pSoldier->inv[ HANDPOS ].usItem)) { ADDITIONAL_TILE_PROPERTIES_VALUES zAllTileValues = GetAllAdditonalTilePropertiesForGrid( sGridNo, pSoldier->pathing.bLevel ); pSoldier->inv[ HANDPOS ][0]->data.bTrap += zAllTileValues.bTrapBonus; @@ -2072,7 +2072,7 @@ void HandleSoldierDropBomb( SOLDIERTYPE *pSoldier, INT32 sGridNo ) StatChange( pSoldier, EXPLODEAMT, 10, FROM_FAILURE ); // oops! How badly did we screw up? - if ( iResult < -20 && Item[ pSoldier->inv[ HANDPOS ].usItem ].tripwire != 1 ) + if ( iResult < -20 && !ItemIsTripwire(pSoldier->inv[ HANDPOS ].usItem) ) { // OOPS! ... BOOM! IgniteExplosion( NOBODY, pSoldier->sX, pSoldier->sY, (INT16) (gpWorldLevelData[pSoldier->sGridNo].sHeight), pSoldier->sGridNo, pSoldier->inv[ HANDPOS ].usItem, pSoldier->pathing.bLevel, pSoldier->ubDirection, &pSoldier->inv[ HANDPOS ] ); @@ -2576,7 +2576,7 @@ void SoldierGetItemFromWorld( SOLDIERTYPE *pSoldier, INT32 iItemIndex, INT32 sGr if ( ItemExistsAtLocation( sGridNo, iItemIndex, pSoldier->pathing.bLevel ) ) { // Flugente: if item is tripwireactivated and is a planted bomb, call the defuse dialogue. We obviously know about the items' existence already... - if ( gWorldItems[ iItemIndex ].object.exists() && gWorldItems[ iItemIndex ].object.fFlags & OBJECT_ARMED_BOMB && Item[gWorldItems[ iItemIndex ].object.usItem].tripwireactivation == 1 ) + if ( gWorldItems[ iItemIndex ].object.exists() && gWorldItems[ iItemIndex ].object.fFlags & OBJECT_ARMED_BOMB && ItemHasTripwireActivation(gWorldItems[ iItemIndex ].object.usItem) ) { gpBoobyTrapItemPool = GetItemPoolForIndex( sGridNo, iItemIndex, pSoldier->pathing.bLevel ); gpBoobyTrapSoldier = pSoldier; @@ -2998,8 +2998,7 @@ OBJECTTYPE* InternalAddItemToPool( INT32 *psGridNo, OBJECTTYPE *pObject, INT8 bV if ( TERRAIN_IS_WATER( bTerrainID) ) { - // if ( Item[ pObject->usItem ].fFlags & ITEM_SINKS ) - if ( Item[ pObject->usItem ].sinks ) + if (ItemSinks(pObject->usItem)) { return( NULL ); } @@ -3340,7 +3339,7 @@ BOOLEAN MarblesExistAtLocation( INT32 sGridNo, UINT8 ubLevel, INT32 * piItemInde pItemPoolTemp = pItemPool; while( pItemPoolTemp != NULL ) { - if ( Item[gWorldItems[ pItemPoolTemp->iItemIndex ].object.usItem].marbles ) + if (ItemIsMarbles(gWorldItems[ pItemPoolTemp->iItemIndex ].object.usItem)) { if ( piItemIndex ) { @@ -5154,7 +5153,7 @@ void StartBombMessageBox( SOLDIERTYPE * pSoldier, INT32 sGridNo ) gpTempSoldier = pSoldier; gsTempGridNo = sGridNo; - if (Item[ pSoldier->inv[HANDPOS].usItem].remotetrigger ) + if (ItemIsRemoteTrigger(pSoldier->inv[HANDPOS].usItem)) { wcscpy( gzUserDefinedButton[0], L"1" ); wcscpy( gzUserDefinedButton[1], L"2" ); @@ -5249,7 +5248,7 @@ void StartBombMessageBox( SOLDIERTYPE * pSoldier, INT32 sGridNo ) { DoMessageBox( MSG_BOX_BASIC_SMALL_BUTTONS, TacticalStr[ CHOOSE_REMOTE_FREQUENCY_STR ], GAME_SCREEN, MSG_BOX_FLAG_FOUR_NUMBERED_BUTTONS, BombMessageBoxCallBack, NULL ); } - else if ( Item[ (&(pSoldier->inv[HANDPOS]))->usItem ].tripwire == 1 ) + else if (ItemIsTripwire((&(pSoldier->inv[HANDPOS]))->usItem)) { wcscpy( gzUserDefinedButton[0], L"1-A" ); wcscpy( gzUserDefinedButton[1], L"1-B" ); @@ -5573,10 +5572,10 @@ void BombMessageBoxCallBack( UINT8 ubExitValue ) if (gpTempSoldier) { // sevenfm: remember last tripwire network settings - if(Item[ gpTempSoldier->inv[HANDPOS].usItem ].tripwire ) + if(ItemIsTripwire(gpTempSoldier->inv[HANDPOS].usItem)) gubLastTripwire = ubExitValue; - if (Item[ gpTempSoldier->inv[HANDPOS].usItem ].remotetrigger ) + if (ItemIsRemoteTrigger(gpTempSoldier->inv[HANDPOS].usItem)) { // Flugente: jamming can prevent bomb activation if ( !gSkillTraitValues.fVOJammingBlocksRemoteBombs || !SectorJammed() ) @@ -5602,7 +5601,7 @@ void BombMessageBoxCallBack( UINT8 ubExitValue ) if ( iResult >= 0 ) { // Less explosives gain for placing tripwire - if ( Item[ gpTempSoldier->inv[ HANDPOS ].usItem ].tripwire == 1 ) + if (ItemIsTripwire(gpTempSoldier->inv[ HANDPOS ].usItem)) StatChange( gpTempSoldier, EXPLODEAMT, 5, FALSE ); else if ( HasItemFlag( (gpTempSoldier->inv[HANDPOS]).usItem, BEARTRAP ) ) StatChange( gpTempSoldier, MECHANAMT, 10, FALSE ); @@ -5643,7 +5642,7 @@ void BombMessageBoxCallBack( UINT8 ubExitValue ) else { // we can't blow up tripwire, no matter how bad we fail - if ( Item[ gpTempSoldier->inv[ HANDPOS ].usItem ].tripwire != 1 ) + if ( !ItemIsTripwire(gpTempSoldier->inv[ HANDPOS ].usItem)) { // OOPS! ... BOOM! IgniteExplosion( NOBODY, gpTempSoldier->sX, gpTempSoldier->sY, (INT16) (gpWorldLevelData[gpTempSoldier->sGridNo].sHeight), gpTempSoldier->sGridNo, gpTempSoldier->inv[ HANDPOS ].usItem, gpTempSoldier->pathing.bLevel, gpTempSoldier->ubDirection, &gpTempSoldier->inv[ HANDPOS ] ); @@ -5699,7 +5698,7 @@ void BombMessageBoxCallBack( UINT8 ubExitValue ) gTempObject[0]->data.ubDirection = gpTempSoldier->ubDirection; // Flugente: direction of bomb is direction of soldier // Flugente: tripwire was called through a messagebox, but has to be buried nevertheless - if ( Item[ (&gTempObject)->usItem ].tripwire == 1 ) + if (ItemIsTripwire((&gTempObject)->usItem)) { AddItemToPool( gsTempGridNo, &gTempObject, BURIED, gpTempSoldier->pathing.bLevel, WORLD_ITEM_ARMED_BOMB, 0 ); // sevenfm: set flag only if planting tripwire @@ -5839,7 +5838,7 @@ BOOLEAN HandItemWorks( SOLDIERTYPE *pSoldier, INT8 bSlot ) // shape to be usable, and doesn't break during use. // Exception: land mines. You can bury them broken, they just won't blow! // if ( (Item[ pObj->usItem ].fFlags & ITEM_DAMAGEABLE) && (pObj->usItem != MINE) && (Item[ pObj->usItem ].usItemClass != IC_MEDKIT) && pObj->usItem != GAS_CAN ) - if ( Item[pObj->usItem].damageable && !Item[pObj->usItem].mine && (Item[pObj->usItem].usItemClass != IC_MEDKIT) && !Item[pObj->usItem].gascan && !IsStructureConstructItem( pObj->usItem, pSoldier->sGridNo, NULL ) ) + if (ItemIsDamageable(pObj->usItem) && !ItemIsMine(pObj->usItem) && (Item[pObj->usItem].usItemClass != IC_MEDKIT) && !ItemIsGascan(pObj->usItem) && !IsStructureConstructItem( pObj->usItem, pSoldier->sGridNo, NULL ) ) { // if it's still usable, check whether it breaks if ( (*pObj)[0]->data.objectStatus >= USABLE) @@ -6103,7 +6102,7 @@ void BoobyTrapMessageBoxCallBack( UINT8 ubExitValue ) CreateItem(gTempObject[0]->data.misc.usBombItem, gTempObject[0]->data.misc.bBombStatus, &TempObject); // also spawn attached guns/explosives - if (gTempObject.usItem != ACTION_ITEM && (Item[gTempObject.usItem].tripwire || Item[gTempObject.usItem].usItemClass & IC_EXPLOSV)) + if (gTempObject.usItem != ACTION_ITEM && (ItemIsTripwire(gTempObject.usItem) || Item[gTempObject.usItem].usItemClass & IC_EXPLOSV)) { // search for attached items OBJECTTYPE* pAttItem = NULL; @@ -6990,7 +6989,7 @@ INT32 FindNearestAvailableGridNoForItem( INT32 sSweetGridNo, INT8 ubRadius ) BOOLEAN CanPlayerUseRocketRifle( SOLDIERTYPE *pSoldier, BOOLEAN fDisplay ) { - if ( Item[pSoldier->inv[ pSoldier->ubAttackingHand ].usItem].fingerprintid ) + if (ItemHasFingerPrintID(pSoldier->inv[ pSoldier->ubAttackingHand ].usItem)) { // check imprint ID // NB not-imprinted value is NO_PROFILE @@ -7042,7 +7041,7 @@ UINT8 StealItems(SOLDIERTYPE* pSoldier,SOLDIERTYPE* pOpponent, UINT8* ubIndexRet fStealItem = FALSE; pObject=&pOpponent->inv[i]; - if ((pObject->exists() == true) && !(Item[pObject->usItem].defaultundroppable )) // CHECK! Undroppable items cannot be stolen - SANDRO + if ((pObject->exists() == true) && !ItemIsUndroppableByDefault(pObject->usItem)) // CHECK! Undroppable items cannot be stolen - SANDRO { // Is the enemy collapsed if ( pOpponent->stats.bLife < OKLIFE || pOpponent->bCollapsed ) @@ -9855,7 +9854,7 @@ void ReadEquipmentTable( SOLDIERTYPE* pSoldier, std::string name ) } } // if we want to equip a two-handed item in our first hand, also drop whatever we have in the second hand - else if ( node.slot == HANDPOS && Item[node.item].twohanded && pSoldier->inv[SECONDHANDPOS].exists( ) ) + else if ( node.slot == HANDPOS && ItemIsTwoHanded(node.item) && pSoldier->inv[SECONDHANDPOS].exists( ) ) { AutoPlaceObjectInInventoryStash( &pSoldier->inv[SECONDHANDPOS], pSoldier->sGridNo, pSoldier->pathing.bLevel ); DeleteObj( &pSoldier->inv[SECONDHANDPOS] ); @@ -10268,7 +10267,7 @@ void ReadEquipmentTable( SOLDIERTYPE* pSoldier, std::string name ) } // if there is water in this sector, refill canteens - if ( refillwaterfromsector && Item[(pSoldier->inv[slot]).usItem].canteen && Food[Item[(pSoldier->inv[slot]).usItem].foodtype].bDrinkPoints > 0 ) + if ( refillwaterfromsector && ItemIsCanteen(pSoldier->inv[slot].usItem) && Food[Item[(pSoldier->inv[slot]).usItem].foodtype].bDrinkPoints > 0 ) { OBJECTTYPE* pObj = &(pSoldier->inv[slot]); diff --git a/Tactical/Handle UI.cpp b/Tactical/Handle UI.cpp index e42433812..75733b2b2 100644 --- a/Tactical/Handle UI.cpp +++ b/Tactical/Handle UI.cpp @@ -2988,11 +2988,12 @@ UINT32 UIHandleCAMercShoot( UI_EVENT *pUIEvent ) if ( pTSoldier != NULL ) { // If this is one of our own guys.....pop up requiester... + UINT16 usItem = pSoldier->inv[HANDPOS].usItem; if ( ( pTSoldier->bTeam == gbPlayerNum || pTSoldier->bTeam == MILITIA_TEAM ) - && Item[ pSoldier->inv[ HANDPOS ].usItem ].usItemClass != IC_MEDKIT - && !Item[pSoldier->inv[ HANDPOS ].usItem].gascan - && !Item[pSoldier->inv[HANDPOS].usItem].toolkit - && !ItemCanBeAppliedToOthers( pSoldier->inv[ HANDPOS ].usItem ) + && Item[ usItem ].usItemClass != IC_MEDKIT + && !ItemIsGascan(usItem) + && !ItemIsToolkit(usItem) + && !ItemCanBeAppliedToOthers( usItem ) && gTacticalStatus.ubLastRequesterTargetID != pTSoldier->ubProfile && ( pTSoldier->ubID != pSoldier->ubID ) ) { @@ -3010,7 +3011,7 @@ UINT32 UIHandleCAMercShoot( UI_EVENT *pUIEvent ) } //////////////////////////////////////////////////////////////////////////////////////////////// // SANDRO - Should we ask if we really want to do the surgery? - else if (Item[ pSoldier->inv[ HANDPOS ].usItem ].medicalkit && (NUM_SKILL_TRAITS( pSoldier, DOCTOR_NT ) >= gSkillTraitValues.ubDONumberTraitsNeededForSurgery) + else if (ItemIsMedicalKit(usItem) && (NUM_SKILL_TRAITS( pSoldier, DOCTOR_NT ) >= gSkillTraitValues.ubDONumberTraitsNeededForSurgery) && (pTSoldier->bTeam == OUR_TEAM || pTSoldier->bTeam == MILITIA_TEAM) && (IS_MERC_BODY_TYPE( pTSoldier ) || IS_CIV_BODY_TYPE( pTSoldier )) && gGameOptions.fNewTraitSystem && pTSoldier->iHealableInjury >= 100 @@ -3894,7 +3895,7 @@ void UIHandleSoldierStanceChange( UINT8 ubSoldierID, INT8 bNewStance ) gGameExternalOptions.ubAllowAlternativeWeaponHolding && pSoldier->inv[HANDPOS].exists() && Weapon[pSoldier->inv[HANDPOS].usItem].HeavyGun && - Item[pSoldier->inv[HANDPOS].usItem].twohanded && + ItemIsTwoHanded(pSoldier->inv[HANDPOS].usItem) && bNewStance == ANIM_STAND) { ChangeScopeMode(pSoldier, NOWHERE); @@ -3937,7 +3938,7 @@ void UIHandleSoldierStanceChange( UINT8 ubSoldierID, INT8 bNewStance ) gGameExternalOptions.ubAllowAlternativeWeaponHolding && pSoldier->inv[HANDPOS].exists() && Weapon[pSoldier->inv[HANDPOS].usItem].HeavyGun && - Item[pSoldier->inv[HANDPOS].usItem].twohanded && + ItemIsTwoHanded(pSoldier->inv[HANDPOS].usItem) && bNewStance == ANIM_STAND) { ChangeScopeMode(pSoldier, NOWHERE); @@ -4628,7 +4629,7 @@ INT8 DrawUIMovementPath( SOLDIERTYPE *pSoldier, INT32 usMapPos, UINT32 uiFlags ) } else if ( uiFlags == MOVEUI_TARGET_BOMB ) { - if(Item[pSoldier->inv[HANDPOS].usItem].mine == 1) + if(ItemIsMine(pSoldier->inv[HANDPOS].usItem)) sAPCost += GetAPsToPlantMine( pSoldier ); else sAPCost += GetAPsToDropBomb( pSoldier ); @@ -5014,7 +5015,7 @@ BOOLEAN UIMouseOnValidAttackLocation( SOLDIERTYPE *pSoldier ) } // SANDRO - doctor with medical bag trying to do the surgery - if ((NUM_SKILL_TRAITS( pSoldier, DOCTOR_NT ) >= gSkillTraitValues.ubDONumberTraitsNeededForSurgery) && Item[pSoldier->inv[ HANDPOS ].usItem].medicalkit && gGameOptions.fNewTraitSystem + if ((NUM_SKILL_TRAITS( pSoldier, DOCTOR_NT ) >= gSkillTraitValues.ubDONumberTraitsNeededForSurgery) && ItemIsMedicalKit(pSoldier->inv[ HANDPOS ].usItem) && gGameOptions.fNewTraitSystem && (pTSoldier->stats.bLife != pTSoldier->stats.bLifeMax) && (pTSoldier->iHealableInjury >= 100)) { // should come a question first if you really want to do the surgery diff --git a/Tactical/Interface Enhanced.cpp b/Tactical/Interface Enhanced.cpp index 91f052d33..c6eee82ca 100644 --- a/Tactical/Interface Enhanced.cpp +++ b/Tactical/Interface Enhanced.cpp @@ -1555,7 +1555,7 @@ void InternalInitEDBTooltipRegion( OBJECTTYPE * gpItemDescObject, UINT32 guiCurr } /////////////////// DAMAGE - if ( Item[ gpItemDescObject->usItem ].usItemClass & (IC_GUN|IC_BLADE|IC_PUNCH|IC_THROWING_KNIFE) && !Item[ gpItemDescObject->usItem ].singleshotrocketlauncher ) + if ( Item[ gpItemDescObject->usItem ].usItemClass & (IC_GUN|IC_BLADE|IC_PUNCH|IC_THROWING_KNIFE) && !ItemIsSingleShotRocketLauncher(gpItemDescObject->usItem) ) { ubRegionOffset = 1; MSYS_EnableRegion( &gUDBFasthelpRegions[ iFirstDataRegion + ubRegionOffset ] ); @@ -1698,7 +1698,7 @@ void InternalInitEDBTooltipRegion( OBJECTTYPE * gpItemDescObject, UINT32 guiCurr } /////////////////// AP TO DRAW - if ( Item[ gpItemDescObject->usItem ].usItemClass & (IC_GUN|IC_LAUNCHER|IC_PUNCH) && !Item[ gpItemDescObject->usItem].rocketlauncher ) + if ( Item[ gpItemDescObject->usItem ].usItemClass & (IC_GUN|IC_LAUNCHER|IC_PUNCH) && !ItemIsRocketLauncher(gpItemDescObject->usItem) ) { MSYS_EnableRegion( &gUDBFasthelpRegions[ iFirstDataRegion + 13 ] ); } @@ -1709,25 +1709,25 @@ void InternalInitEDBTooltipRegion( OBJECTTYPE * gpItemDescObject, UINT32 guiCurr } /////////////////// AP TO BURST - if ( Item[gpItemDescObject->usItem].usItemClass & (IC_GUN|IC_LAUNCHER) && !Item[gpItemDescObject->usItem].rocketlauncher ) + if ( Item[gpItemDescObject->usItem].usItemClass & (IC_GUN|IC_LAUNCHER) && !ItemIsRocketLauncher(gpItemDescObject->usItem) ) { MSYS_EnableRegion( &gUDBFasthelpRegions[ iFirstDataRegion + 15 ] ); } /////////////////// AP TO AUTOFIRE - if ( Item[gpItemDescObject->usItem].usItemClass == IC_GUN && !Item[gpItemDescObject->usItem].rocketlauncher ) + if ( Item[gpItemDescObject->usItem].usItemClass == IC_GUN && !ItemIsRocketLauncher(gpItemDescObject->usItem) ) { MSYS_EnableRegion( &gUDBFasthelpRegions[ iFirstDataRegion + 16 ] ); } /////////////////// AP TO RELOAD - if ( Item[ gpItemDescObject->usItem ].usItemClass & (IC_GUN|IC_LAUNCHER) && !Item[ gpItemDescObject->usItem ].singleshotrocketlauncher ) + if ( Item[ gpItemDescObject->usItem ].usItemClass & (IC_GUN|IC_LAUNCHER) && !ItemIsSingleShotRocketLauncher(gpItemDescObject->usItem) ) { MSYS_EnableRegion( &gUDBFasthelpRegions[ iFirstDataRegion + 17 ] ); } /////////////////// AP TO RELOAD MANUALLY - if ( Item[ gpItemDescObject->usItem ].usItemClass & (IC_GUN|IC_LAUNCHER) && !Item[ gpItemDescObject->usItem ].singleshotrocketlauncher && Weapon[gpItemDescObject->usItem].APsToReloadManually > 0 ) + if ( Item[ gpItemDescObject->usItem ].usItemClass & (IC_GUN|IC_LAUNCHER) && !ItemIsSingleShotRocketLauncher(gpItemDescObject->usItem) && Weapon[gpItemDescObject->usItem].APsToReloadManually > 0 ) { MSYS_EnableRegion( &gUDBFasthelpRegions[ iFirstDataRegion + 18 ] ); } @@ -1735,7 +1735,7 @@ void InternalInitEDBTooltipRegion( OBJECTTYPE * gpItemDescObject, UINT32 guiCurr /////////////////// RECOIL X/Y if( UsingNewCTHSystem() == true ) { - if ( Item[ gpItemDescObject->usItem ].usItemClass == IC_GUN && !Item[ gpItemDescObject->usItem].rocketlauncher && (GetAutofireShotsPerFiveAPs(gpItemDescObject) > 0 || GetShotsPerBurst(gpItemDescObject)> 0 ) ) + if ( Item[ gpItemDescObject->usItem ].usItemClass == IC_GUN && !ItemIsRocketLauncher(gpItemDescObject->usItem) && (GetAutofireShotsPerFiveAPs(gpItemDescObject) > 0 || GetShotsPerBurst(gpItemDescObject)> 0 ) ) { // HEADROCK HAM 5: One value to rule them all. // MSYS_EnableRegion( &gUDBFasthelpRegions[ iFirstDataRegion + 18 ] ); @@ -1751,7 +1751,7 @@ void InternalInitEDBTooltipRegion( OBJECTTYPE * gpItemDescObject, UINT32 guiCurr } /////////////////// BULLETS PER 5 AP - if ( Item[ gpItemDescObject->usItem ].usItemClass == IC_GUN && !Item[ gpItemDescObject->usItem].rocketlauncher && GetAutofireShotsPerFiveAPs(gpItemDescObject) > 0 ) + if ( Item[ gpItemDescObject->usItem ].usItemClass == IC_GUN && !ItemIsRocketLauncher(gpItemDescObject->usItem) && GetAutofireShotsPerFiveAPs(gpItemDescObject) > 0 ) { MSYS_EnableRegion( &gUDBFasthelpRegions[ iFirstDataRegion + 21 ] ); } @@ -2333,7 +2333,7 @@ void InternalInitEDBTooltipRegion( OBJECTTYPE * gpItemDescObject, UINT32 guiCurr if (Item[ gpItemDescObject->usItem ].usItemClass & IC_ARMOUR) { //////////////////// EXPLOSIVE RESISTANCE - if (Item[ gpItemDescObject->usItem ].flakjacket) + if (ItemIsFlakJacket(gpItemDescObject->usItem)) { swprintf( pStr, L"%s%s", szUDBGenSecondaryStatsTooltipText[ 5 ], szUDBGenSecondaryStatsExplanationsTooltipText[ 5 ]); SetRegionFastHelpText( &(gUDBFasthelpRegions[ iFirstDataRegion + cnt ]), pStr ); @@ -2432,7 +2432,7 @@ void InternalInitEDBTooltipRegion( OBJECTTYPE * gpItemDescObject, UINT32 guiCurr if (Item[ gpItemDescObject->usItem ].usItemClass & IC_EXPLOSV) { ////////////////// LOCK BOMB - if (Item[ gpItemDescObject->usItem ].lockbomb) + if (ItemIsLockBomb(gpItemDescObject->usItem)) { swprintf( pStr, L"%s%s", szUDBGenSecondaryStatsTooltipText[ 25 ], szUDBGenSecondaryStatsExplanationsTooltipText[ 25 ]); SetRegionFastHelpText( &(gUDBFasthelpRegions[ iFirstDataRegion + cnt ]), pStr ); @@ -2445,7 +2445,7 @@ void InternalInitEDBTooltipRegion( OBJECTTYPE * gpItemDescObject, UINT32 guiCurr // Draw stats that can be had by any item. //////////////////// WATERPROOF - if (!Item[ gpItemDescObject->usItem ].waterdamages) + if (!ItemIsDamagedByWater(gpItemDescObject->usItem)) { swprintf( pStr, L"%s%s", szUDBGenSecondaryStatsTooltipText[ 6 ], szUDBGenSecondaryStatsExplanationsTooltipText[ 6 ]); SetRegionFastHelpText( &(gUDBFasthelpRegions[ iFirstDataRegion + cnt ]), pStr ); @@ -2454,7 +2454,7 @@ void InternalInitEDBTooltipRegion( OBJECTTYPE * gpItemDescObject, UINT32 guiCurr } //////////////////// ELECTRONIC - if (Item[ gpItemDescObject->usItem ].electronic) + if (ItemIsElectronic(gpItemDescObject->usItem)) { swprintf( pStr, L"%s%s", szUDBGenSecondaryStatsTooltipText[ 7 ], szUDBGenSecondaryStatsExplanationsTooltipText[ 7 ]); SetRegionFastHelpText( &(gUDBFasthelpRegions[ iFirstDataRegion + cnt ]), pStr ); @@ -2463,7 +2463,7 @@ void InternalInitEDBTooltipRegion( OBJECTTYPE * gpItemDescObject, UINT32 guiCurr } //////////////////// GAS MASK - if (Item[ gpItemDescObject->usItem ].gasmask) + if (ItemIsGasmask(gpItemDescObject->usItem)) { swprintf( pStr, L"%s%s", szUDBGenSecondaryStatsTooltipText[ 8 ], szUDBGenSecondaryStatsExplanationsTooltipText[ 8 ]); SetRegionFastHelpText( &(gUDBFasthelpRegions[ iFirstDataRegion + cnt ]), pStr ); @@ -2472,7 +2472,7 @@ void InternalInitEDBTooltipRegion( OBJECTTYPE * gpItemDescObject, UINT32 guiCurr } //////////////////// NEEDS BATTERIES - if (Item[ gpItemDescObject->usItem ].needsbatteries) + if (ItemNeedsBatteries(gpItemDescObject->usItem)) { swprintf( pStr, L"%s%s", szUDBGenSecondaryStatsTooltipText[ 9 ], szUDBGenSecondaryStatsExplanationsTooltipText[ 9 ]); SetRegionFastHelpText( &(gUDBFasthelpRegions[ iFirstDataRegion + cnt ]), pStr ); @@ -2481,7 +2481,7 @@ void InternalInitEDBTooltipRegion( OBJECTTYPE * gpItemDescObject, UINT32 guiCurr } //////////////////// LOCKSMITH'S KIT - if (Item[ gpItemDescObject->usItem ].locksmithkit) + if (ItemIsLocksmithKit(gpItemDescObject->usItem)) { swprintf( pStr, L"%s%s%d", szUDBGenSecondaryStatsTooltipText[ 10 ], szUDBGenSecondaryStatsExplanationsTooltipText[ 10 ], (Item[ gpItemDescObject->usItem ].LockPickModifier > 0 ? ( Item[ gpItemDescObject->usItem ].LockPickModifier * (*gpItemDescObject)[0]->data.objectStatus / 100 ) : Item[ gpItemDescObject->usItem ].LockPickModifier ) ); @@ -2491,7 +2491,7 @@ void InternalInitEDBTooltipRegion( OBJECTTYPE * gpItemDescObject, UINT32 guiCurr } //////////////////// WIRE CUTTERS - if (Item[ gpItemDescObject->usItem ].wirecutters) + if (ItemIsWirecutters(gpItemDescObject->usItem)) { swprintf( pStr, L"%s%s", szUDBGenSecondaryStatsTooltipText[ 11 ], szUDBGenSecondaryStatsExplanationsTooltipText[ 11 ]); SetRegionFastHelpText( &(gUDBFasthelpRegions[ iFirstDataRegion + cnt ]), pStr ); @@ -2500,7 +2500,7 @@ void InternalInitEDBTooltipRegion( OBJECTTYPE * gpItemDescObject, UINT32 guiCurr } //////////////////// CROWBAR - if (Item[ gpItemDescObject->usItem ].crowbar) + if (ItemIsCrowbar(gpItemDescObject->usItem)) { swprintf( pStr, L"%s%s%d", szUDBGenSecondaryStatsTooltipText[ 12 ], szUDBGenSecondaryStatsExplanationsTooltipText[ 12 ], Item[ gpItemDescObject->usItem ].CrowbarModifier ); SetRegionFastHelpText( &(gUDBFasthelpRegions[ iFirstDataRegion + cnt ]), pStr ); @@ -2509,7 +2509,7 @@ void InternalInitEDBTooltipRegion( OBJECTTYPE * gpItemDescObject, UINT32 guiCurr } //////////////////// METAL DETECTOR - if (Item[ gpItemDescObject->usItem ].metaldetector) + if (ItemIsMetalDetector(gpItemDescObject->usItem)) { swprintf( pStr, L"%s%s", szUDBGenSecondaryStatsTooltipText[ 13 ], szUDBGenSecondaryStatsExplanationsTooltipText[ 13 ]); SetRegionFastHelpText( &(gUDBFasthelpRegions[ iFirstDataRegion + cnt ]), pStr ); @@ -2518,7 +2518,7 @@ void InternalInitEDBTooltipRegion( OBJECTTYPE * gpItemDescObject, UINT32 guiCurr } //////////////////// REMOTE TRIGGER - if (Item[ gpItemDescObject->usItem ].remotetrigger) + if (ItemIsRemoteTrigger(gpItemDescObject->usItem)) { swprintf( pStr, L"%s%s", szUDBGenSecondaryStatsTooltipText[ 14 ], szUDBGenSecondaryStatsExplanationsTooltipText[ 14 ]); SetRegionFastHelpText( &(gUDBFasthelpRegions[ iFirstDataRegion + cnt ]), pStr ); @@ -2527,7 +2527,7 @@ void InternalInitEDBTooltipRegion( OBJECTTYPE * gpItemDescObject, UINT32 guiCurr } //////////////////// REMOTE DETONATOR - if (Item[ gpItemDescObject->usItem ].remotedetonator) + if (ItemIsRemoteDetonator(gpItemDescObject->usItem)) { swprintf( pStr, L"%s%s", szUDBGenSecondaryStatsTooltipText[ 15 ], szUDBGenSecondaryStatsExplanationsTooltipText[ 15 ]); SetRegionFastHelpText( &(gUDBFasthelpRegions[ iFirstDataRegion + cnt ]), pStr ); @@ -2536,7 +2536,7 @@ void InternalInitEDBTooltipRegion( OBJECTTYPE * gpItemDescObject, UINT32 guiCurr } //////////////////// TIMER DETONATOR - if (Item[ gpItemDescObject->usItem ].detonator) + if (ItemIsDetonator(gpItemDescObject->usItem)) { swprintf( pStr, L"%s%s", szUDBGenSecondaryStatsTooltipText[ 16 ], szUDBGenSecondaryStatsExplanationsTooltipText[ 16 ]); SetRegionFastHelpText( &(gUDBFasthelpRegions[ iFirstDataRegion + cnt ]), pStr ); @@ -2545,7 +2545,7 @@ void InternalInitEDBTooltipRegion( OBJECTTYPE * gpItemDescObject, UINT32 guiCurr } //////////////////// GAS CAN - if (Item[ gpItemDescObject->usItem ].gascan) + if (ItemIsGascan(gpItemDescObject->usItem)) { swprintf( pStr, L"%s%s", szUDBGenSecondaryStatsTooltipText[ 17 ], szUDBGenSecondaryStatsExplanationsTooltipText[ 17 ]); SetRegionFastHelpText( &(gUDBFasthelpRegions[ iFirstDataRegion + cnt ]), pStr ); @@ -2554,7 +2554,7 @@ void InternalInitEDBTooltipRegion( OBJECTTYPE * gpItemDescObject, UINT32 guiCurr } //////////////////// TOOLKIT - if (Item[ gpItemDescObject->usItem ].toolkit) + if (ItemIsToolkit(gpItemDescObject->usItem)) { swprintf( pStr, L"%s%s%d", szUDBGenSecondaryStatsTooltipText[ 18 ], szUDBGenSecondaryStatsExplanationsTooltipText[ 18 ], Item[ gpItemDescObject->usItem ].RepairModifier ); SetRegionFastHelpText( &(gUDBFasthelpRegions[ iFirstDataRegion + cnt ]), pStr ); @@ -2563,7 +2563,7 @@ void InternalInitEDBTooltipRegion( OBJECTTYPE * gpItemDescObject, UINT32 guiCurr } //////////////////// THERMAL OPTICS - if (Item[ gpItemDescObject->usItem ].thermaloptics) + if (ItemIsThermalOptics(gpItemDescObject->usItem)) { swprintf( pStr, L"%s%s", szUDBGenSecondaryStatsTooltipText[ 19 ], szUDBGenSecondaryStatsExplanationsTooltipText[ 19 ]); SetRegionFastHelpText( &(gUDBFasthelpRegions[ iFirstDataRegion + cnt ]), pStr ); @@ -2572,7 +2572,7 @@ void InternalInitEDBTooltipRegion( OBJECTTYPE * gpItemDescObject, UINT32 guiCurr } //////////////////// X-RAY DEVICE - if (Item[ gpItemDescObject->usItem ].xray) + if (ItemHasXRay(gpItemDescObject->usItem)) { swprintf( pStr, L"%s%s", szUDBGenSecondaryStatsTooltipText[ 20 ], szUDBGenSecondaryStatsExplanationsTooltipText[ 20 ]); SetRegionFastHelpText( &(gUDBFasthelpRegions[ iFirstDataRegion + cnt ]), pStr ); @@ -2581,7 +2581,7 @@ void InternalInitEDBTooltipRegion( OBJECTTYPE * gpItemDescObject, UINT32 guiCurr } //////////////////// CANTEEN - if (Item[ gpItemDescObject->usItem ].canteen) + if (ItemIsCanteen(gpItemDescObject->usItem)) { swprintf( pStr, L"%s%s", szUDBGenSecondaryStatsTooltipText[ 21 ], szUDBGenSecondaryStatsExplanationsTooltipText[ 21 ]); SetRegionFastHelpText( &(gUDBFasthelpRegions[ iFirstDataRegion + cnt ]), pStr ); @@ -2599,7 +2599,7 @@ void InternalInitEDBTooltipRegion( OBJECTTYPE * gpItemDescObject, UINT32 guiCurr } //////////////////// FIRST-AID KIT - if (Item[ gpItemDescObject->usItem ].firstaidkit) + if (ItemIsFirstAidKit(gpItemDescObject->usItem)) { swprintf( pStr, L"%s%s", szUDBGenSecondaryStatsTooltipText[ 23 ], szUDBGenSecondaryStatsExplanationsTooltipText[ 23 ]); SetRegionFastHelpText( &(gUDBFasthelpRegions[ iFirstDataRegion + cnt ]), pStr ); @@ -2608,7 +2608,7 @@ void InternalInitEDBTooltipRegion( OBJECTTYPE * gpItemDescObject, UINT32 guiCurr } //////////////////// MEDICAL KIT - if (Item[ gpItemDescObject->usItem ].medicalkit) + if (ItemIsMedicalKit(gpItemDescObject->usItem)) { swprintf( pStr, L"%s%s", szUDBGenSecondaryStatsTooltipText[ 24 ], szUDBGenSecondaryStatsExplanationsTooltipText[ 24 ]); SetRegionFastHelpText( &(gUDBFasthelpRegions[ iFirstDataRegion + cnt ]), pStr ); @@ -2681,7 +2681,7 @@ void InternalInitEDBTooltipRegion( OBJECTTYPE * gpItemDescObject, UINT32 guiCurr } //////////////////// NOT DAMAGEABLE - if ( Item[gpItemDescObject->usItem].damageable == 0 ) + if (!ItemIsDamageable(gpItemDescObject->usItem)) { swprintf( pStr, L"%s%s", szUDBGenSecondaryStatsTooltipText[ 32 ], szUDBGenSecondaryStatsExplanationsTooltipText[ 32 ]); SetRegionFastHelpText( &(gUDBFasthelpRegions[ iFirstDataRegion + cnt ]), pStr ); @@ -2690,7 +2690,7 @@ void InternalInitEDBTooltipRegion( OBJECTTYPE * gpItemDescObject, UINT32 guiCurr } //////////////////// METAL - if ( Item[gpItemDescObject->usItem].metal > 0 ) + if (ItemIsMetal(gpItemDescObject->usItem)) { swprintf( pStr, L"%s%s", szUDBGenSecondaryStatsTooltipText[ 33 ], szUDBGenSecondaryStatsExplanationsTooltipText[ 33 ]); SetRegionFastHelpText( &(gUDBFasthelpRegions[ iFirstDataRegion + cnt ]), pStr ); @@ -2699,7 +2699,7 @@ void InternalInitEDBTooltipRegion( OBJECTTYPE * gpItemDescObject, UINT32 guiCurr } //////////////////// SINKS - if ( Item[gpItemDescObject->usItem].sinks > 0 ) + if (ItemSinks(gpItemDescObject->usItem)) { swprintf( pStr, L"%s%s", szUDBGenSecondaryStatsTooltipText[ 34 ], szUDBGenSecondaryStatsExplanationsTooltipText[ 34 ]); SetRegionFastHelpText( &(gUDBFasthelpRegions[ iFirstDataRegion + cnt ]), pStr ); @@ -2708,7 +2708,7 @@ void InternalInitEDBTooltipRegion( OBJECTTYPE * gpItemDescObject, UINT32 guiCurr } //////////////////// TWO HANDED - if ( Item[gpItemDescObject->usItem].twohanded > 0 ) + if (ItemIsTwoHanded(gpItemDescObject->usItem)) { swprintf( pStr, L"%s%s", szUDBGenSecondaryStatsTooltipText[ 35 ], szUDBGenSecondaryStatsExplanationsTooltipText[ 35 ]); SetRegionFastHelpText( &(gUDBFasthelpRegions[ iFirstDataRegion + cnt ]), pStr ); @@ -2717,7 +2717,7 @@ void InternalInitEDBTooltipRegion( OBJECTTYPE * gpItemDescObject, UINT32 guiCurr } //////////////////// BLOCKS IRON SIGHTS - if ( Item[gpItemDescObject->usItem].blockironsight > 0 ) + if (ItemBlocksIronsight(gpItemDescObject->usItem)) { swprintf( pStr, L"%s%s", szUDBGenSecondaryStatsTooltipText[ 36 ], szUDBGenSecondaryStatsExplanationsTooltipText[ 36 ]); SetRegionFastHelpText( &(gUDBFasthelpRegions[ iFirstDataRegion + cnt ]), pStr ); @@ -4070,7 +4070,7 @@ void InternalInitEDBTooltipRegion( OBJECTTYPE * gpItemDescObject, UINT32 guiCurr } cnt++; } - else if ( Item[gpItemDescObject->usItem].barrel == TRUE ) // for barrel items + else if (ItemIsBarrel(gpItemDescObject->usItem)) // for barrel items { if (!fDrawGenIndexes) fDrawGenIndexes = ++cnt; // new index line here? ///////////////////// COOLDOWN FACTOR @@ -4366,8 +4366,8 @@ void DrawWeaponStats( OBJECTTYPE * gpItemDescObject ) } //////////////////// DAMAGE - if ( ( Item[ gpItemDescObject->usItem ].usItemClass & (IC_GUN|IC_PUNCH|IC_BLADE|IC_THROWING_KNIFE) && !Item[ gpItemDescObject->usItem ].singleshotrocketlauncher ) || - ( fComparisonMode && Item[ gpComparedItemDescObject->usItem ].usItemClass & (IC_GUN|IC_PUNCH|IC_BLADE|IC_THROWING_KNIFE) && !Item[ gpComparedItemDescObject->usItem ].singleshotrocketlauncher ) ) + if ( ( Item[ gpItemDescObject->usItem ].usItemClass & (IC_GUN|IC_PUNCH|IC_BLADE|IC_THROWING_KNIFE) && !ItemIsSingleShotRocketLauncher(gpItemDescObject->usItem) ) || + ( fComparisonMode && Item[ gpComparedItemDescObject->usItem ].usItemClass & (IC_GUN|IC_PUNCH|IC_BLADE|IC_THROWING_KNIFE) && !ItemIsSingleShotRocketLauncher(gpComparedItemDescObject->usItem) ) ) { ubNumLine = 1; BltVideoObjectFromIndex( guiSAVEBUFFER, guiItemInfoWeaponIcon, 5, gItemDescGenRegions[ubNumLine][0].sLeft+sOffsetX, gItemDescGenRegions[ubNumLine][0].sTop+sOffsetY, VO_BLT_SRCTRANSPARENCY, NULL ); @@ -4525,8 +4525,8 @@ void DrawWeaponStats( OBJECTTYPE * gpItemDescObject ) ubNumLine = 11; } - if ( !Item[gpItemDescObject->usItem].repairable || - ( fComparisonMode && !Item[gpComparedItemDescObject->usItem].repairable ) ) + if ( !ItemIsRepairable(gpItemDescObject->usItem) || + ( fComparisonMode && !ItemIsRepairable(gpComparedItemDescObject->usItem) ) ) { BltVideoObjectFromIndex( guiSAVEBUFFER, guiItemInfoWeaponIcon, 35, gItemDescGenRegions[ubNumLine][0].sLeft + sOffsetX, gItemDescGenRegions[ubNumLine][0].sTop + sOffsetY, VO_BLT_SRCTRANSPARENCY, NULL ); } @@ -4542,16 +4542,16 @@ void DrawWeaponStats( OBJECTTYPE * gpItemDescObject ) } //////////////////// DRAW COST - if ( ( Item[ gpItemDescObject->usItem ].usItemClass & (IC_GUN|IC_LAUNCHER) && !Item[ gpItemDescObject->usItem].rocketlauncher ) || - ( fComparisonMode && Item[ gpComparedItemDescObject->usItem ].usItemClass & (IC_GUN|IC_LAUNCHER) && !Item[ gpComparedItemDescObject->usItem].rocketlauncher ) ) + if ( ( Item[ gpItemDescObject->usItem ].usItemClass & (IC_GUN|IC_LAUNCHER) && !ItemIsRocketLauncher(gpItemDescObject->usItem) ) || + ( fComparisonMode && Item[ gpComparedItemDescObject->usItem ].usItemClass & (IC_GUN|IC_LAUNCHER) && !ItemIsRocketLauncher(gpComparedItemDescObject->usItem) ) ) { ubNumLine = 13; BltVideoObjectFromIndex( guiSAVEBUFFER, guiItemInfoWeaponIcon, 1, gItemDescGenRegions[ubNumLine][0].sLeft+sOffsetX, gItemDescGenRegions[ubNumLine][0].sTop+sOffsetY, VO_BLT_SRCTRANSPARENCY, NULL ); } //////////////////// SINGLE SHOT COST - GUN - if ( ( Item[gpItemDescObject->usItem].usItemClass == IC_GUN && !Item[gpItemDescObject->usItem].rocketlauncher && !fComparisonMode ) || - ( fComparisonMode && Item[gpComparedItemDescObject->usItem].usItemClass == IC_GUN && !Item[gpComparedItemDescObject->usItem].rocketlauncher ) ) + if ( ( Item[gpItemDescObject->usItem].usItemClass == IC_GUN && !ItemIsRocketLauncher(gpItemDescObject->usItem) && !fComparisonMode ) || + ( fComparisonMode && Item[gpComparedItemDescObject->usItem].usItemClass == IC_GUN && !ItemIsRocketLauncher(gpComparedItemDescObject->usItem) ) ) { ubNumLine = 14; // "NO SINGLE-SHOT" ICON @@ -4565,8 +4565,8 @@ void DrawWeaponStats( OBJECTTYPE * gpItemDescObject ) } /////////////////// SINGLE SHOT COST - ROCKET - if ( ( Item[gpItemDescObject->usItem].usItemClass & (IC_GUN|IC_LAUNCHER) && Item[gpItemDescObject->usItem].rocketlauncher && !fComparisonMode ) || - ( fComparisonMode && Item[gpComparedItemDescObject->usItem].usItemClass & (IC_GUN|IC_LAUNCHER) && Item[gpComparedItemDescObject->usItem].rocketlauncher ) ) + if ( ( Item[gpItemDescObject->usItem].usItemClass & (IC_GUN|IC_LAUNCHER) && ItemIsRocketLauncher(gpItemDescObject->usItem) && !fComparisonMode ) || + ( fComparisonMode && Item[gpComparedItemDescObject->usItem].usItemClass & (IC_GUN|IC_LAUNCHER) && ItemIsRocketLauncher(gpComparedItemDescObject->usItem) ) ) { ubNumLine = 14; // SINGLE ROCKET-LAUNCH AP ICON @@ -4574,9 +4574,9 @@ void DrawWeaponStats( OBJECTTYPE * gpItemDescObject ) } /////////////////// SINGLE SHOT COST - GRENADE LAUNCHER - if ( ( Item[gpItemDescObject->usItem].usItemClass == IC_LAUNCHER && !Item[gpItemDescObject->usItem].rocketlauncher + if ( ( Item[gpItemDescObject->usItem].usItemClass == IC_LAUNCHER && !ItemIsRocketLauncher(gpItemDescObject->usItem) && !Weapon[gpItemDescObject->usItem].NoSemiAuto && !fComparisonMode ) || - ( fComparisonMode && Item[gpComparedItemDescObject->usItem].usItemClass == IC_LAUNCHER && !Item[gpComparedItemDescObject->usItem].rocketlauncher + ( fComparisonMode && Item[gpComparedItemDescObject->usItem].usItemClass == IC_LAUNCHER && !ItemIsRocketLauncher(gpComparedItemDescObject->usItem) && !Weapon[gpComparedItemDescObject->usItem].NoSemiAuto ) ) { ubNumLine = 14; @@ -4608,8 +4608,8 @@ void DrawWeaponStats( OBJECTTYPE * gpItemDescObject ) } /////////////////// BURST COST - GUN - if ( ( Item[gpItemDescObject->usItem].usItemClass == IC_GUN && !Item[gpItemDescObject->usItem].rocketlauncher ) || - ( fComparisonMode && Item[gpComparedItemDescObject->usItem].usItemClass == IC_GUN && !Item[gpComparedItemDescObject->usItem].rocketlauncher ) ) + if ( ( Item[gpItemDescObject->usItem].usItemClass == IC_GUN && !ItemIsRocketLauncher(gpItemDescObject->usItem) ) || + ( fComparisonMode && Item[gpComparedItemDescObject->usItem].usItemClass == IC_GUN && !ItemIsRocketLauncher(gpComparedItemDescObject->usItem) ) ) { ubNumLine = 15; // "NO BURST" ICON @@ -4625,9 +4625,9 @@ void DrawWeaponStats( OBJECTTYPE * gpItemDescObject ) } } ////////////////// BURST COST - GRENADE LAUNCHER - else if ( ( Item[gpItemDescObject->usItem].usItemClass == IC_LAUNCHER && !Item[gpItemDescObject->usItem].rocketlauncher + else if ( ( Item[gpItemDescObject->usItem].usItemClass == IC_LAUNCHER && !ItemIsRocketLauncher(gpItemDescObject->usItem) && GetShotsPerBurst(gpItemDescObject)> 0 ) || - ( fComparisonMode && Item[gpItemDescObject->usItem].usItemClass == IC_LAUNCHER && !Item[gpItemDescObject->usItem].rocketlauncher + ( fComparisonMode && Item[gpItemDescObject->usItem].usItemClass == IC_LAUNCHER && !ItemIsRocketLauncher(gpItemDescObject->usItem) && GetShotsPerBurst(gpItemDescObject)> 0 ) ) { ubNumLine = 15; @@ -4635,8 +4635,8 @@ void DrawWeaponStats( OBJECTTYPE * gpItemDescObject ) } ////////////////// AUTOFIRE COST - if ( ( Item[gpItemDescObject->usItem].usItemClass == IC_GUN && !Item[gpItemDescObject->usItem].rocketlauncher ) || - ( fComparisonMode && Item[gpComparedItemDescObject->usItem].usItemClass == IC_GUN && !Item[gpComparedItemDescObject->usItem].rocketlauncher ) ) + if ( ( Item[gpItemDescObject->usItem].usItemClass == IC_GUN && !ItemIsRocketLauncher(gpItemDescObject->usItem) ) || + ( fComparisonMode && Item[gpComparedItemDescObject->usItem].usItemClass == IC_GUN && !ItemIsRocketLauncher(gpComparedItemDescObject->usItem) ) ) { ubNumLine = 16; // "NO-AUTO" ICON @@ -4654,17 +4654,17 @@ void DrawWeaponStats( OBJECTTYPE * gpItemDescObject ) ////////////////// RELOAD COST - if ( ( Item[ gpItemDescObject->usItem ].usItemClass & (IC_GUN|IC_LAUNCHER) && !Item[ gpItemDescObject->usItem ].singleshotrocketlauncher ) || - ( fComparisonMode && Item[ gpComparedItemDescObject->usItem ].usItemClass & (IC_GUN|IC_LAUNCHER) && !Item[ gpComparedItemDescObject->usItem ].singleshotrocketlauncher ) ) + if ( ( Item[ gpItemDescObject->usItem ].usItemClass & (IC_GUN|IC_LAUNCHER) && !ItemIsSingleShotRocketLauncher(gpItemDescObject->usItem) ) || + ( fComparisonMode && Item[ gpComparedItemDescObject->usItem ].usItemClass & (IC_GUN|IC_LAUNCHER) && !ItemIsSingleShotRocketLauncher(gpComparedItemDescObject->usItem) ) ) { ubNumLine = 17; BltVideoObjectFromIndex( guiSAVEBUFFER, guiItemInfoWeaponIcon, 2, gItemDescGenRegions[ubNumLine][0].sLeft+sOffsetX, gItemDescGenRegions[ubNumLine][0].sTop+sOffsetY, VO_BLT_SRCTRANSPARENCY, NULL ); } ////////////////// MANUAL RELOAD COST - if ( ( Item[ gpItemDescObject->usItem ].usItemClass & (IC_GUN|IC_LAUNCHER) && !Item[ gpItemDescObject->usItem ].singleshotrocketlauncher + if ( ( Item[ gpItemDescObject->usItem ].usItemClass & (IC_GUN|IC_LAUNCHER) && !ItemIsSingleShotRocketLauncher(gpItemDescObject->usItem) && Weapon[gpItemDescObject->usItem].APsToReloadManually > 0 ) || - ( fComparisonMode && Item[ gpComparedItemDescObject->usItem ].usItemClass & (IC_GUN|IC_LAUNCHER) && !Item[ gpComparedItemDescObject->usItem ].singleshotrocketlauncher + ( fComparisonMode && Item[ gpComparedItemDescObject->usItem ].usItemClass & (IC_GUN|IC_LAUNCHER) && !ItemIsSingleShotRocketLauncher(gpComparedItemDescObject->usItem) && Weapon[gpComparedItemDescObject->usItem].APsToReloadManually > 0 ) ) { ubNumLine = 18; @@ -4675,9 +4675,9 @@ void DrawWeaponStats( OBJECTTYPE * gpItemDescObject ) if( UsingNewCTHSystem() == true ) { ubNumLine = 20; - if ( ( Item[ gpItemDescObject->usItem ].usItemClass == IC_GUN && !Item[ gpItemDescObject->usItem].rocketlauncher + if ( ( Item[ gpItemDescObject->usItem ].usItemClass == IC_GUN && !ItemIsRocketLauncher(gpItemDescObject->usItem) && ( GetShotsPerBurst(gpItemDescObject)> 0 || GetAutofireShotsPerFiveAPs(gpItemDescObject) > 0 ) ) || - ( fComparisonMode && Item[ gpComparedItemDescObject->usItem ].usItemClass == IC_GUN && !Item[ gpComparedItemDescObject->usItem].rocketlauncher + ( fComparisonMode && Item[ gpComparedItemDescObject->usItem ].usItemClass == IC_GUN && !ItemIsRocketLauncher(gpComparedItemDescObject->usItem) && ( GetShotsPerBurst(gpComparedItemDescObject)> 0 || GetAutofireShotsPerFiveAPs(gpComparedItemDescObject) > 0 ) ) ) { // HEADROCK HAM 5: One value to rule them all! Line 19 left empty intentionally. @@ -4702,9 +4702,9 @@ void DrawWeaponStats( OBJECTTYPE * gpItemDescObject ) } ///////////////// AUTOFIRE SHOTS PER 5 AP ICON - if ( ( Item[ gpItemDescObject->usItem ].usItemClass == IC_GUN && !Item[ gpItemDescObject->usItem].rocketlauncher + if ( ( Item[ gpItemDescObject->usItem ].usItemClass == IC_GUN && !ItemIsRocketLauncher(gpItemDescObject->usItem) && GetAutofireShotsPerFiveAPs(gpItemDescObject) > 0 ) || - ( fComparisonMode && Item[ gpComparedItemDescObject->usItem ].usItemClass == IC_GUN && !Item[ gpComparedItemDescObject->usItem].rocketlauncher + ( fComparisonMode && Item[ gpComparedItemDescObject->usItem ].usItemClass == IC_GUN && !ItemIsRocketLauncher(gpComparedItemDescObject->usItem) && GetAutofireShotsPerFiveAPs(gpComparedItemDescObject) > 0 ) ) { ubNumLine = 21; @@ -4946,8 +4946,8 @@ void DrawExplosiveStats( OBJECTTYPE * gpItemDescObject ) } ////////////////// REPAIR EASE - if ( ( !Item[gpItemDescObject->usItem].repairable && !fComparisonMode ) || - ( fComparisonMode && !Item[ gpComparedItemDescObject->usItem ].repairable ) ) + if ( ( !ItemIsRepairable(gpItemDescObject->usItem) && !fComparisonMode ) || + ( fComparisonMode && !ItemIsRepairable(gpComparedItemDescObject->usItem) ) ) { BltVideoObjectFromIndex( guiSAVEBUFFER, guiItemInfoWeaponIcon, 35, gItemDescGenRegions[11][0].sLeft + sOffsetX, gItemDescGenRegions[11][0].sTop + sOffsetY, VO_BLT_SRCTRANSPARENCY, NULL ); } @@ -5036,8 +5036,8 @@ void DrawArmorStats( OBJECTTYPE * gpItemDescObject ) } ////////////////// REPAIR EASE - if ( ( !Item[gpItemDescObject->usItem].repairable && !fComparisonMode ) || - ( fComparisonMode && !Item[gpComparedItemDescObject->usItem].repairable ) ) + if ( ( !ItemIsRepairable(gpItemDescObject->usItem) && !fComparisonMode ) || + ( fComparisonMode && !ItemIsRepairable(gpComparedItemDescObject->usItem) ) ) { BltVideoObjectFromIndex( guiSAVEBUFFER, guiItemInfoWeaponIcon, 35, gItemDescGenRegions[3][0].sLeft + sOffsetX, gItemDescGenRegions[3][0].sTop + sOffsetY, VO_BLT_SRCTRANSPARENCY, NULL ); } @@ -5782,8 +5782,8 @@ void DrawAdvancedStats( OBJECTTYPE * gpItemDescObject ) cnt++; } - if( ( Item[gpItemDescObject->usItem].barrel == TRUE ) || // for barrel items - ( fComparisonMode && Item[gpComparedItemDescObject->usItem].barrel == TRUE ) ) + if( (ItemIsBarrel(gpItemDescObject->usItem)) || // for barrel items + ( fComparisonMode && ItemIsBarrel(gpComparedItemDescObject->usItem) ) ) { if ( !fDrawGenIndexes ) fDrawGenIndexes = ++cnt; // new index line here? @@ -5988,8 +5988,8 @@ void DrawMiscStats( OBJECTTYPE * gpItemDescObject ) // not for weapons. They have this one their primary page if ( !(Item[ gpItemDescObject->usItem ].usItemClass & IC_WEAPON || Item[ gpItemDescObject->usItem ].usItemClass & IC_PUNCH) ) { - if ( !Item[gpItemDescObject->usItem].repairable && !fComparisonMode || - ( fComparisonMode && !Item[gpComparedItemDescObject->usItem].repairable ) ) + if ( !ItemIsRepairable(gpItemDescObject->usItem) && !fComparisonMode || + ( fComparisonMode && !ItemIsRepairable(gpComparedItemDescObject->usItem) ) ) { BltVideoObjectFromIndex( guiSAVEBUFFER, guiItemInfoWeaponIcon, 35, gItemDescGenRegions[0][0].sLeft + sOffsetX, gItemDescGenRegions[0][0].sTop + sOffsetY, VO_BLT_SRCTRANSPARENCY, NULL ); } @@ -6076,8 +6076,8 @@ void DrawSecondaryStats( OBJECTTYPE * gpItemDescObject ) if (Item[ gpItemDescObject->usItem ].usItemClass & (IC_ARMOUR)) { ////////////////// FLAK JACKET - if ( ( Item[ gpItemDescObject->usItem ].flakjacket && !fComparisonMode ) || - ( fComparisonMode && Item[ gpComparedItemDescObject->usItem ].flakjacket )) + if ( (ItemIsFlakJacket(gpItemDescObject->usItem) && !fComparisonMode ) || + ( fComparisonMode && ItemIsFlakJacket(gpComparedItemDescObject->usItem) )) { BltVideoObjectFromIndex( guiSAVEBUFFER, guiItemInfoSecondaryIcon, 5, gItemDescGenSecondaryRegions[cnt].sLeft+sOffsetX, gItemDescGenSecondaryRegions[cnt].sTop+sOffsetY, VO_BLT_SRCTRANSPARENCY, NULL ); cnt++; @@ -6162,8 +6162,8 @@ void DrawSecondaryStats( OBJECTTYPE * gpItemDescObject ) if (Item[ gpItemDescObject->usItem ].usItemClass & (IC_EXPLOSV)) { ////////////////// LOCK BOMB - if ( ( Item[ gpItemDescObject->usItem ].lockbomb && !fComparisonMode ) || - ( fComparisonMode && Item[ gpComparedItemDescObject->usItem ].lockbomb ) ) + if (( ItemIsLockBomb(gpItemDescObject->usItem) && !fComparisonMode ) || + ( fComparisonMode && ItemIsLockBomb(gpComparedItemDescObject->usItem) )) { BltVideoObjectFromIndex( guiSAVEBUFFER, guiItemInfoSecondaryIcon, 25, gItemDescGenSecondaryRegions[cnt].sLeft+sOffsetX, gItemDescGenSecondaryRegions[cnt].sTop+sOffsetY, VO_BLT_SRCTRANSPARENCY, NULL ); cnt++; @@ -6174,128 +6174,128 @@ void DrawSecondaryStats( OBJECTTYPE * gpItemDescObject ) // Draw stats that can be had by any item. //////////////////// WATERPROOF - if ( ( !Item[ gpItemDescObject->usItem ].waterdamages && !fComparisonMode ) || - ( fComparisonMode && !Item[ gpComparedItemDescObject->usItem ].waterdamages ) ) + if ( ( !ItemIsDamagedByWater(gpItemDescObject->usItem) && !fComparisonMode ) || + ( fComparisonMode && !ItemIsDamagedByWater(gpComparedItemDescObject->usItem) ) ) { BltVideoObjectFromIndex( guiSAVEBUFFER, guiItemInfoSecondaryIcon, 6, gItemDescGenSecondaryRegions[cnt].sLeft+sOffsetX, gItemDescGenSecondaryRegions[cnt].sTop+sOffsetY, VO_BLT_SRCTRANSPARENCY, NULL ); cnt++; } //////////////////// ELECTRONIC - if ( ( Item[ gpItemDescObject->usItem ].electronic && !fComparisonMode ) || - ( fComparisonMode && Item[ gpComparedItemDescObject->usItem ].electronic ) ) + if ( (ItemIsElectronic(gpItemDescObject->usItem) && !fComparisonMode ) || + ( fComparisonMode && ItemIsElectronic(gpComparedItemDescObject->usItem)) ) { BltVideoObjectFromIndex( guiSAVEBUFFER, guiItemInfoSecondaryIcon, 7, gItemDescGenSecondaryRegions[cnt].sLeft+sOffsetX, gItemDescGenSecondaryRegions[cnt].sTop+sOffsetY, VO_BLT_SRCTRANSPARENCY, NULL ); cnt++; } //////////////////// GAS MASK - if ( ( Item[ gpItemDescObject->usItem ].gasmask && !fComparisonMode ) || - ( fComparisonMode && Item[ gpComparedItemDescObject->usItem ].gasmask ) ) + if ( (ItemIsGasmask(gpItemDescObject->usItem) && !fComparisonMode ) || + ( fComparisonMode && ItemIsGasmask(gpComparedItemDescObject->usItem) ) ) { BltVideoObjectFromIndex( guiSAVEBUFFER, guiItemInfoSecondaryIcon, 8, gItemDescGenSecondaryRegions[cnt].sLeft+sOffsetX, gItemDescGenSecondaryRegions[cnt].sTop+sOffsetY, VO_BLT_SRCTRANSPARENCY, NULL ); cnt++; } //////////////////// NEEDS BATTERIES - if ( ( Item[ gpItemDescObject->usItem ].needsbatteries && !fComparisonMode ) || - ( fComparisonMode && Item[ gpComparedItemDescObject->usItem ].needsbatteries ) ) + if ( (ItemNeedsBatteries(gpItemDescObject->usItem) && !fComparisonMode ) || + ( fComparisonMode && ItemNeedsBatteries(gpComparedItemDescObject->usItem) ) ) { BltVideoObjectFromIndex( guiSAVEBUFFER, guiItemInfoSecondaryIcon, 9, gItemDescGenSecondaryRegions[cnt].sLeft+sOffsetX, gItemDescGenSecondaryRegions[cnt].sTop+sOffsetY, VO_BLT_SRCTRANSPARENCY, NULL ); cnt++; } //////////////////// LOCKSMITH'S KIT - if ( ( Item[ gpItemDescObject->usItem ].locksmithkit && !fComparisonMode ) || - ( fComparisonMode && Item[ gpComparedItemDescObject->usItem ].locksmithkit ) ) + if ( (ItemIsLocksmithKit(gpItemDescObject->usItem) && !fComparisonMode ) || + ( fComparisonMode && ItemIsLocksmithKit(gpComparedItemDescObject->usItem)) ) { BltVideoObjectFromIndex( guiSAVEBUFFER, guiItemInfoSecondaryIcon, 10, gItemDescGenSecondaryRegions[cnt].sLeft+sOffsetX, gItemDescGenSecondaryRegions[cnt].sTop+sOffsetY, VO_BLT_SRCTRANSPARENCY, NULL ); cnt++; } //////////////////// WIRE CUTTERS - if ( ( Item[ gpItemDescObject->usItem ].wirecutters && !fComparisonMode ) || - ( fComparisonMode && Item[ gpComparedItemDescObject->usItem ].wirecutters ) ) + if ( (ItemIsWirecutters(gpItemDescObject->usItem) && !fComparisonMode ) || + ( fComparisonMode && ItemIsWirecutters(gpComparedItemDescObject->usItem) ) ) { BltVideoObjectFromIndex( guiSAVEBUFFER, guiItemInfoSecondaryIcon, 11, gItemDescGenSecondaryRegions[cnt].sLeft+sOffsetX, gItemDescGenSecondaryRegions[cnt].sTop+sOffsetY, VO_BLT_SRCTRANSPARENCY, NULL ); cnt++; } //////////////////// CROWBAR - if ( ( Item[ gpItemDescObject->usItem ].crowbar && !fComparisonMode ) || - ( fComparisonMode && Item[ gpComparedItemDescObject->usItem ].crowbar ) ) + if ( (ItemIsCrowbar(gpItemDescObject->usItem) && !fComparisonMode ) || + ( fComparisonMode && ItemIsCrowbar(gpComparedItemDescObject->usItem) ) ) { BltVideoObjectFromIndex( guiSAVEBUFFER, guiItemInfoSecondaryIcon, 12, gItemDescGenSecondaryRegions[cnt].sLeft+sOffsetX, gItemDescGenSecondaryRegions[cnt].sTop+sOffsetY, VO_BLT_SRCTRANSPARENCY, NULL ); cnt++; } //////////////////// CROWBAR - if ( ( Item[ gpItemDescObject->usItem ].metaldetector && !fComparisonMode ) || - ( fComparisonMode && Item[ gpComparedItemDescObject->usItem ].metaldetector ) ) + if ( (ItemIsMetalDetector(gpItemDescObject->usItem) && !fComparisonMode ) || + ( fComparisonMode && ItemIsMetalDetector(gpComparedItemDescObject->usItem)) ) { BltVideoObjectFromIndex( guiSAVEBUFFER, guiItemInfoSecondaryIcon, 13, gItemDescGenSecondaryRegions[cnt].sLeft+sOffsetX, gItemDescGenSecondaryRegions[cnt].sTop+sOffsetY, VO_BLT_SRCTRANSPARENCY, NULL ); cnt++; } //////////////////// REMOTE TRIGGER - if ( ( Item[ gpItemDescObject->usItem ].remotetrigger && !fComparisonMode ) || - ( fComparisonMode && Item[ gpComparedItemDescObject->usItem ].remotetrigger ) ) + if ( (ItemIsRemoteTrigger(gpItemDescObject->usItem) && !fComparisonMode ) || + ( fComparisonMode && ItemIsRemoteTrigger(gpComparedItemDescObject->usItem) ) ) { BltVideoObjectFromIndex( guiSAVEBUFFER, guiItemInfoSecondaryIcon, 14, gItemDescGenSecondaryRegions[cnt].sLeft+sOffsetX, gItemDescGenSecondaryRegions[cnt].sTop+sOffsetY, VO_BLT_SRCTRANSPARENCY, NULL ); cnt++; } //////////////////// REMOTE DETONATOR - if ( ( Item[ gpItemDescObject->usItem ].remotedetonator && !fComparisonMode ) || - ( fComparisonMode && Item[ gpComparedItemDescObject->usItem ].remotedetonator ) ) + if ( (ItemIsRemoteDetonator(gpItemDescObject->usItem) && !fComparisonMode ) || + ( fComparisonMode && ItemIsRemoteDetonator(gpComparedItemDescObject->usItem) ) ) { BltVideoObjectFromIndex( guiSAVEBUFFER, guiItemInfoSecondaryIcon, 15, gItemDescGenSecondaryRegions[cnt].sLeft+sOffsetX, gItemDescGenSecondaryRegions[cnt].sTop+sOffsetY, VO_BLT_SRCTRANSPARENCY, NULL ); cnt++; } //////////////////// TIMER DETONATOR - if ( ( Item[ gpItemDescObject->usItem ].detonator && !fComparisonMode ) || - ( fComparisonMode && Item[ gpComparedItemDescObject->usItem ].detonator ) ) + if ( (ItemIsDetonator(gpItemDescObject->usItem) && !fComparisonMode ) || + ( fComparisonMode && ItemIsDetonator(gpComparedItemDescObject->usItem)) ) { BltVideoObjectFromIndex( guiSAVEBUFFER, guiItemInfoSecondaryIcon, 16, gItemDescGenSecondaryRegions[cnt].sLeft+sOffsetX, gItemDescGenSecondaryRegions[cnt].sTop+sOffsetY, VO_BLT_SRCTRANSPARENCY, NULL ); cnt++; } //////////////////// GAS CAN - if ( ( Item[ gpItemDescObject->usItem ].gascan && !fComparisonMode ) || - ( fComparisonMode && Item[ gpComparedItemDescObject->usItem ].gascan ) ) + if ( (ItemIsGascan(gpItemDescObject->usItem) && !fComparisonMode ) || + ( fComparisonMode && ItemIsGascan(gpComparedItemDescObject->usItem) ) ) { BltVideoObjectFromIndex( guiSAVEBUFFER, guiItemInfoSecondaryIcon, 17, gItemDescGenSecondaryRegions[cnt].sLeft+sOffsetX, gItemDescGenSecondaryRegions[cnt].sTop+sOffsetY, VO_BLT_SRCTRANSPARENCY, NULL ); cnt++; } //////////////////// TOOLKIT - if ( ( Item[ gpItemDescObject->usItem ].toolkit && !fComparisonMode ) || - ( fComparisonMode && Item[ gpComparedItemDescObject->usItem ].toolkit ) ) + if ( (ItemIsToolkit(gpItemDescObject->usItem) && !fComparisonMode ) || + ( fComparisonMode && ItemIsToolkit(gpComparedItemDescObject->usItem) ) ) { BltVideoObjectFromIndex( guiSAVEBUFFER, guiItemInfoSecondaryIcon, 18, gItemDescGenSecondaryRegions[cnt].sLeft+sOffsetX, gItemDescGenSecondaryRegions[cnt].sTop+sOffsetY, VO_BLT_SRCTRANSPARENCY, NULL ); cnt++; } //////////////////// THERMAL OPTICS - if ( ( Item[ gpItemDescObject->usItem ].thermaloptics && !fComparisonMode ) || - ( fComparisonMode && Item[ gpComparedItemDescObject->usItem ].thermaloptics ) ) + if ( (ItemIsThermalOptics(gpItemDescObject->usItem) && !fComparisonMode ) || + ( fComparisonMode && ItemIsThermalOptics(gpComparedItemDescObject->usItem) ) ) { BltVideoObjectFromIndex( guiSAVEBUFFER, guiItemInfoSecondaryIcon, 19, gItemDescGenSecondaryRegions[cnt].sLeft+sOffsetX, gItemDescGenSecondaryRegions[cnt].sTop+sOffsetY, VO_BLT_SRCTRANSPARENCY, NULL ); cnt++; } //////////////////// X-RAY DEVICE - if ( ( Item[ gpItemDescObject->usItem ].xray && !fComparisonMode ) || - ( fComparisonMode && Item[ gpComparedItemDescObject->usItem ].xray ) ) + if ( (ItemHasXRay(gpItemDescObject->usItem) && !fComparisonMode ) || + ( fComparisonMode && ItemHasXRay(gpComparedItemDescObject->usItem) ) ) { BltVideoObjectFromIndex( guiSAVEBUFFER, guiItemInfoSecondaryIcon, 20, gItemDescGenSecondaryRegions[cnt].sLeft+sOffsetX, gItemDescGenSecondaryRegions[cnt].sTop+sOffsetY, VO_BLT_SRCTRANSPARENCY, NULL ); cnt++; } //////////////////// CANTEEN - if ( ( Item[ gpItemDescObject->usItem ].canteen && !fComparisonMode ) || - ( fComparisonMode && Item[ gpComparedItemDescObject->usItem ].canteen ) ) + if ( (ItemIsCanteen(gpItemDescObject->usItem) && !fComparisonMode ) || + ( fComparisonMode && ItemIsCanteen(gpComparedItemDescObject->usItem) ) ) { BltVideoObjectFromIndex( guiSAVEBUFFER, guiItemInfoSecondaryIcon, 21, gItemDescGenSecondaryRegions[cnt].sLeft+sOffsetX, gItemDescGenSecondaryRegions[cnt].sTop+sOffsetY, VO_BLT_SRCTRANSPARENCY, NULL ); cnt++; @@ -6310,16 +6310,16 @@ void DrawSecondaryStats( OBJECTTYPE * gpItemDescObject ) } //////////////////// FIRST-AID KIT - if ( ( Item[ gpItemDescObject->usItem ].firstaidkit && !fComparisonMode ) || - ( fComparisonMode && Item[ gpComparedItemDescObject->usItem ].firstaidkit ) ) + if ( (ItemIsFirstAidKit(gpItemDescObject->usItem) && !fComparisonMode ) || + ( fComparisonMode && ItemIsFirstAidKit(gpComparedItemDescObject->usItem)) ) { BltVideoObjectFromIndex( guiSAVEBUFFER, guiItemInfoSecondaryIcon, 23, gItemDescGenSecondaryRegions[cnt].sLeft+sOffsetX, gItemDescGenSecondaryRegions[cnt].sTop+sOffsetY, VO_BLT_SRCTRANSPARENCY, NULL ); cnt++; } //////////////////// MEDICAL KIT - if ( ( Item[ gpItemDescObject->usItem ].medicalkit && !fComparisonMode ) || - ( fComparisonMode && Item[ gpComparedItemDescObject->usItem ].medicalkit ) ) + if ( (ItemIsMedicalKit(gpItemDescObject->usItem) && !fComparisonMode ) || + ( fComparisonMode && ItemIsMedicalKit(gpComparedItemDescObject->usItem) ) ) { BltVideoObjectFromIndex( guiSAVEBUFFER, guiItemInfoSecondaryIcon, 24, gItemDescGenSecondaryRegions[cnt].sLeft+sOffsetX, gItemDescGenSecondaryRegions[cnt].sTop+sOffsetY, VO_BLT_SRCTRANSPARENCY, NULL ); cnt++; @@ -6389,40 +6389,40 @@ void DrawSecondaryStats( OBJECTTYPE * gpItemDescObject ) } //////////////////// NOT DAMAGEABLE - if ( ( Item[gpItemDescObject->usItem].damageable == 0 && !fComparisonMode ) || - ( fComparisonMode && Item[gpComparedItemDescObject->usItem].damageable == 0 ) ) + if ( (!ItemIsDamageable(gpItemDescObject->usItem) && !fComparisonMode ) || + ( fComparisonMode && !ItemIsDamageable(gpComparedItemDescObject->usItem) ) ) { BltVideoObjectFromIndex( guiSAVEBUFFER, guiItemInfoSecondaryIcon, 31, gItemDescGenSecondaryRegions[cnt].sLeft+sOffsetX, gItemDescGenSecondaryRegions[cnt].sTop+sOffsetY, VO_BLT_SRCTRANSPARENCY, NULL ); cnt++; } //////////////////// METAL - if ( ( Item[gpItemDescObject->usItem].metal > 0 && !fComparisonMode ) || - ( fComparisonMode && Item[gpComparedItemDescObject->usItem].metal > 0 ) ) + if ( (ItemIsMetal(gpItemDescObject->usItem) && !fComparisonMode ) || + ( fComparisonMode && ItemIsMetal(gpComparedItemDescObject->usItem) ) ) { BltVideoObjectFromIndex( guiSAVEBUFFER, guiItemInfoSecondaryIcon, 32, gItemDescGenSecondaryRegions[cnt].sLeft+sOffsetX, gItemDescGenSecondaryRegions[cnt].sTop+sOffsetY, VO_BLT_SRCTRANSPARENCY, NULL ); cnt++; } //////////////////// SINKS - if ( ( Item[gpItemDescObject->usItem].sinks > 0 && !fComparisonMode ) || - ( fComparisonMode && Item[gpComparedItemDescObject->usItem].sinks > 0 ) ) + if ( (ItemSinks(gpItemDescObject->usItem) && !fComparisonMode ) || + ( fComparisonMode && ItemSinks(gpComparedItemDescObject->usItem) ) ) { BltVideoObjectFromIndex( guiSAVEBUFFER, guiItemInfoSecondaryIcon, 33, gItemDescGenSecondaryRegions[cnt].sLeft+sOffsetX, gItemDescGenSecondaryRegions[cnt].sTop+sOffsetY, VO_BLT_SRCTRANSPARENCY, NULL ); cnt++; } //////////////////// TWO HANDED - if ( ( Item[gpItemDescObject->usItem].twohanded > 0 && !fComparisonMode ) || - ( fComparisonMode && Item[gpComparedItemDescObject->usItem].twohanded > 0 ) ) + if ( (ItemIsTwoHanded(gpItemDescObject->usItem) && !fComparisonMode ) || + ( fComparisonMode && ItemIsTwoHanded(gpComparedItemDescObject->usItem) ) ) { BltVideoObjectFromIndex( guiSAVEBUFFER, guiItemInfoSecondaryIcon, 34, gItemDescGenSecondaryRegions[cnt].sLeft+sOffsetX, gItemDescGenSecondaryRegions[cnt].sTop+sOffsetY, VO_BLT_SRCTRANSPARENCY, NULL ); cnt++; } //////////////////// BLOCKS IRON SIGHTS - if ( ( Item[gpItemDescObject->usItem].blockironsight > 0 && !fComparisonMode ) || - ( fComparisonMode && Item[gpComparedItemDescObject->usItem].blockironsight > 0 ) ) + if ( (ItemBlocksIronsight(gpItemDescObject->usItem) && !fComparisonMode ) || + ( fComparisonMode && ItemBlocksIronsight(gpComparedItemDescObject->usItem) ) ) { BltVideoObjectFromIndex( guiSAVEBUFFER, guiItemInfoSecondaryIcon, 35, gItemDescGenSecondaryRegions[cnt].sLeft+sOffsetX, gItemDescGenSecondaryRegions[cnt].sTop+sOffsetY, VO_BLT_SRCTRANSPARENCY, NULL ); cnt++; @@ -6822,7 +6822,7 @@ void DrawWeaponValues( OBJECTTYPE * gpItemDescObject ) // ShotsPer4Turns -> ubAttackAPs, used later for all shot AP values // silversurfer: Knuckle Dusters count as bare hand attacks and use the AP_PUNCH constant. - if ( Item[gpItemDescObject->usItem].brassknuckles ) + if (ItemIsBrassKnuckles(gpItemDescObject->usItem)) { ubAttackAPs = APBPConstants[AP_PUNCH]; ubBasicAttackAPs = APBPConstants[AP_PUNCH]; @@ -7002,7 +7002,7 @@ void DrawWeaponValues( OBJECTTYPE * gpItemDescObject ) DrawPropertyValueInColour( iFinalAccuracyValue, ubNumLine, 3, fComparisonMode, FALSE, TRUE, ITEMDESC_FONTPOSITIVE ); } /////////////// DAMAGE - if ( Item[ gpItemDescObject->usItem ].usItemClass & (IC_GUN|IC_PUNCH|IC_BLADE|IC_THROWING_KNIFE) && !Item[ gpItemDescObject->usItem ].singleshotrocketlauncher ) + if ( Item[ gpItemDescObject->usItem ].usItemClass & (IC_GUN|IC_PUNCH|IC_BLADE|IC_THROWING_KNIFE) && !ItemIsSingleShotRocketLauncher(gpItemDescObject->usItem) ) { // Set line to draw into ubNumLine = 1; @@ -7060,7 +7060,7 @@ void DrawWeaponValues( OBJECTTYPE * gpItemDescObject ) DrawPropertyValueInColour( iComparedFinalDamageValue - iFinalDamageValue, ubNumLine, 3, fComparisonMode, FALSE, TRUE ); } } - else if( fComparisonMode && Item[ gpComparedItemDescObject->usItem ].usItemClass & (IC_GUN|IC_PUNCH|IC_BLADE|IC_THROWING_KNIFE) && !Item[ gpComparedItemDescObject->usItem ].singleshotrocketlauncher ) + else if( fComparisonMode && Item[ gpComparedItemDescObject->usItem ].usItemClass & (IC_GUN|IC_PUNCH|IC_BLADE|IC_THROWING_KNIFE) && !ItemIsSingleShotRocketLauncher(gpComparedItemDescObject->usItem) ) { // Set line to draw into ubNumLine = 1; @@ -7840,7 +7840,7 @@ void DrawWeaponValues( OBJECTTYPE * gpItemDescObject ) } // Does gun have flash suppression? - BOOLEAN iFlashValue = Item[ gpItemDescObject->usItem ].hidemuzzleflash; + BOOLEAN iFlashValue = ItemHasHiddenMuzzleFlash(gpItemDescObject->usItem); if( !fComparisonMode ) { @@ -7864,7 +7864,7 @@ void DrawWeaponValues( OBJECTTYPE * gpItemDescObject ) } else if( IsFlashSuppressorAlt( gpComparedItemDescObject ) == TRUE ) { - BOOLEAN iComparedFlashValue = Item[ gpComparedItemDescObject->usItem ].hidemuzzleflash; + BOOLEAN iComparedFlashValue = ItemHasHiddenMuzzleFlash(gpComparedItemDescObject->usItem); if ( iFlashValue ) { if (iComparedFlashValue) @@ -7921,7 +7921,7 @@ void DrawWeaponValues( OBJECTTYPE * gpItemDescObject ) else ubNumLine = 8; // Does gun have flash suppression? - BOOLEAN iFlashValue = Item[ gpComparedItemDescObject->usItem ].hidemuzzleflash; + BOOLEAN iFlashValue = ItemHasHiddenMuzzleFlash(gpComparedItemDescObject->usItem); if ( iFlashValue ) { // Print base value @@ -8077,7 +8077,7 @@ void DrawWeaponValues( OBJECTTYPE * gpItemDescObject ) } ///////////////////// DRAW AP - if ( Item[ gpItemDescObject->usItem ].usItemClass & (IC_GUN|IC_LAUNCHER) && !Item[ gpItemDescObject->usItem].rocketlauncher ) + if ( Item[ gpItemDescObject->usItem ].usItemClass & (IC_GUN|IC_LAUNCHER) && !ItemIsRocketLauncher(gpItemDescObject->usItem) ) { // Set line to draw into ubNumLine = 13; @@ -8137,7 +8137,7 @@ void DrawWeaponValues( OBJECTTYPE * gpItemDescObject ) DrawPropertyValueInColour( iComparedFinalDrawAPCost - iFinalDrawAPCost, ubNumLine, 3, fComparisonMode, FALSE, FALSE ); } } - else if( fComparisonMode && Item[ gpComparedItemDescObject->usItem ].usItemClass & (IC_GUN|IC_LAUNCHER) && !Item[ gpComparedItemDescObject->usItem].rocketlauncher ) + else if( fComparisonMode && Item[ gpComparedItemDescObject->usItem ].usItemClass & (IC_GUN|IC_LAUNCHER) && !ItemIsRocketLauncher(gpComparedItemDescObject->usItem) ) { ubNumLine = 13; // Get final Draw Cost @@ -8376,7 +8376,7 @@ void DrawWeaponValues( OBJECTTYPE * gpItemDescObject ) } ///////////////////// RELOAD AP - if ( Item[ gpItemDescObject->usItem ].usItemClass & (IC_GUN|IC_LAUNCHER) && !Item[ gpItemDescObject->usItem ].singleshotrocketlauncher ) + if ( Item[ gpItemDescObject->usItem ].usItemClass & (IC_GUN|IC_LAUNCHER) && !ItemIsSingleShotRocketLauncher(gpItemDescObject->usItem) ) { // Set line to draw into ubNumLine = 17; @@ -8423,7 +8423,7 @@ void DrawWeaponValues( OBJECTTYPE * gpItemDescObject ) // Print final value DrawPropertyValueInColour( iFinalReloadAPCost, ubNumLine, 3, fComparisonMode, FALSE, FALSE, FONT_MCOLOR_WHITE ); } - else if( Item[ gpComparedItemDescObject->usItem ].usItemClass & (IC_GUN|IC_LAUNCHER) && !Item[ gpComparedItemDescObject->usItem ].singleshotrocketlauncher ) + else if( Item[ gpComparedItemDescObject->usItem ].usItemClass & (IC_GUN|IC_LAUNCHER) && !ItemIsSingleShotRocketLauncher(gpComparedItemDescObject->usItem) ) { // Get final Reload Cost INT16 iComparedFinalReloadAPCost = GetAPsToReload( gpComparedItemDescObject ); @@ -8471,7 +8471,7 @@ void DrawWeaponValues( OBJECTTYPE * gpItemDescObject ) DrawPropertyTextInColour( L"-", ubNumLine, 3, ITEMDESC_FONTPOSITIVE ); } } - else if( fComparisonMode && ( Item[ gpComparedItemDescObject->usItem ].usItemClass & (IC_GUN|IC_LAUNCHER) && !Item[ gpComparedItemDescObject->usItem ].singleshotrocketlauncher ) ) + else if( fComparisonMode && ( Item[ gpComparedItemDescObject->usItem ].usItemClass & (IC_GUN|IC_LAUNCHER) && !ItemIsSingleShotRocketLauncher(gpComparedItemDescObject->usItem) ) ) { ubNumLine = 17; // Get final Reload Cost @@ -8515,7 +8515,7 @@ void DrawWeaponValues( OBJECTTYPE * gpItemDescObject ) } ///////////////////// MANUAL RELOAD AP - if ( Item[ gpItemDescObject->usItem ].usItemClass & (IC_GUN|IC_LAUNCHER) && !Item[ gpItemDescObject->usItem ].singleshotrocketlauncher + if ( Item[ gpItemDescObject->usItem ].usItemClass & (IC_GUN|IC_LAUNCHER) && !ItemIsSingleShotRocketLauncher(gpItemDescObject->usItem) && Weapon[gpItemDescObject->usItem].APsToReloadManually > 0 ) { // Set line to draw into @@ -8555,7 +8555,7 @@ void DrawWeaponValues( OBJECTTYPE * gpItemDescObject ) // Print final value DrawPropertyValueInColour( iFinalManualReloadAPCost, ubNumLine, 3, fComparisonMode, FALSE, FALSE, FONT_MCOLOR_WHITE ); } - else if( Item[ gpComparedItemDescObject->usItem ].usItemClass & (IC_GUN|IC_LAUNCHER) && !Item[ gpComparedItemDescObject->usItem ].singleshotrocketlauncher + else if( Item[ gpComparedItemDescObject->usItem ].usItemClass & (IC_GUN|IC_LAUNCHER) && !ItemIsSingleShotRocketLauncher(gpComparedItemDescObject->usItem) && Weapon[gpComparedItemDescObject->usItem].APsToReloadManually > 0 ) { // Get final Manual Reload Cost @@ -8597,7 +8597,7 @@ void DrawWeaponValues( OBJECTTYPE * gpItemDescObject ) DrawPropertyTextInColour( L"-", ubNumLine, 3, ITEMDESC_FONTPOSITIVE ); } } - else if( fComparisonMode && ( Item[ gpComparedItemDescObject->usItem ].usItemClass & (IC_GUN|IC_LAUNCHER) && !Item[ gpComparedItemDescObject->usItem ].singleshotrocketlauncher + else if( fComparisonMode && ( Item[ gpComparedItemDescObject->usItem ].usItemClass & (IC_GUN|IC_LAUNCHER) && !ItemIsSingleShotRocketLauncher(gpComparedItemDescObject->usItem) && Weapon[gpComparedItemDescObject->usItem].APsToReloadManually > 0 ) ) { ubNumLine = 18; @@ -8637,7 +8637,7 @@ void DrawWeaponValues( OBJECTTYPE * gpItemDescObject ) ///////////////////// RECOIL X/Y if ( UsingNewCTHSystem() == true ) { - if ( Item[ gpItemDescObject->usItem ].usItemClass == IC_GUN && !Item[ gpItemDescObject->usItem].rocketlauncher + if ( Item[ gpItemDescObject->usItem ].usItemClass == IC_GUN && !ItemIsRocketLauncher(gpItemDescObject->usItem) && GetShotsPerBurst(gpItemDescObject)> 0 || GetAutofireShotsPerFiveAPs(gpItemDescObject) ) { // HEADROCK HAM 5: One value to rule them all. @@ -8677,7 +8677,7 @@ void DrawWeaponValues( OBJECTTYPE * gpItemDescObject ) // Print final value DrawPropertyValueInColourFloat( dFinalRecoil, ubNumLine, 3, fComparisonMode, FALSE, FALSE, FONT_MCOLOR_WHITE, 1.0f ); } - else if( Item[ gpComparedItemDescObject->usItem ].usItemClass == IC_GUN && !Item[ gpComparedItemDescObject->usItem].rocketlauncher + else if( Item[ gpComparedItemDescObject->usItem ].usItemClass == IC_GUN && !ItemIsRocketLauncher(gpComparedItemDescObject->usItem) && GetShotsPerBurst(gpComparedItemDescObject)> 0 || GetAutofireShotsPerFiveAPs(gpComparedItemDescObject) ) { FLOAT iComparedFinalRecoilX = 0; @@ -8775,7 +8775,7 @@ void DrawWeaponValues( OBJECTTYPE * gpItemDescObject ) SetFontForeground( 6 ); */ } - else if( fComparisonMode && ( Item[ gpComparedItemDescObject->usItem ].usItemClass == IC_GUN && !Item[ gpComparedItemDescObject->usItem].rocketlauncher + else if( fComparisonMode && ( Item[ gpComparedItemDescObject->usItem ].usItemClass == IC_GUN && !ItemIsRocketLauncher(gpComparedItemDescObject->usItem) && GetShotsPerBurst(gpComparedItemDescObject)> 0 || GetAutofireShotsPerFiveAPs(gpComparedItemDescObject) ) ) { @@ -8848,7 +8848,7 @@ void DrawWeaponValues( OBJECTTYPE * gpItemDescObject ) // Print final value DrawPropertyValueInColour( iFinalBurstValue, ubNumLine, 3, fComparisonMode, FALSE, FALSE, FONT_MCOLOR_WHITE ); } - else if( Item[ gpComparedItemDescObject->usItem ].usItemClass & (IC_GUN|IC_LAUNCHER) && !Item[ gpComparedItemDescObject->usItem ].singleshotrocketlauncher ) + else if( Item[ gpComparedItemDescObject->usItem ].usItemClass & (IC_GUN|IC_LAUNCHER) && !ItemIsSingleShotRocketLauncher(gpComparedItemDescObject->usItem) ) { // Get base Burst Penalty value INT16 iComparedBurstValue = Weapon[gpComparedItemDescObject->usItem].ubBurstPenalty * (gGameExternalOptions.bAimedBurstEnabled?gGameExternalOptions.uAimedBurstPenalty:1); @@ -8961,7 +8961,7 @@ void DrawWeaponValues( OBJECTTYPE * gpItemDescObject ) } /////////////////// AUTOFIRE BULLETS PER 5 AP - if ( Item[ gpItemDescObject->usItem ].usItemClass == IC_GUN && !Item[ gpItemDescObject->usItem].rocketlauncher + if ( Item[ gpItemDescObject->usItem ].usItemClass == IC_GUN && !ItemIsRocketLauncher(gpItemDescObject->usItem) && GetAutofireShotsPerFiveAPs(gpItemDescObject) > 0 ) { // Set line to draw into @@ -8982,7 +8982,7 @@ void DrawWeaponValues( OBJECTTYPE * gpItemDescObject ) // Print final value DrawPropertyValueInColour( iFinalB5AP, ubNumLine, 3, fComparisonMode, FALSE, TRUE, FONT_MCOLOR_WHITE ); } - else if ( Item[ gpComparedItemDescObject->usItem ].usItemClass == IC_GUN && !Item[ gpComparedItemDescObject->usItem].rocketlauncher + else if ( Item[ gpComparedItemDescObject->usItem ].usItemClass == IC_GUN && !ItemIsRocketLauncher(gpComparedItemDescObject->usItem) && GetAutofireShotsPerFiveAPs(gpComparedItemDescObject) > 0 ) { // Get final B/5AP @@ -9003,7 +9003,7 @@ void DrawWeaponValues( OBJECTTYPE * gpItemDescObject ) DrawPropertyTextInColour( L"-", ubNumLine, 3, ITEMDESC_FONTNEGATIVE ); } } - else if( fComparisonMode && ( Item[ gpComparedItemDescObject->usItem ].usItemClass == IC_GUN && !Item[ gpComparedItemDescObject->usItem].rocketlauncher + else if( fComparisonMode && ( Item[ gpComparedItemDescObject->usItem ].usItemClass == IC_GUN && !ItemIsRocketLauncher(gpComparedItemDescObject->usItem) && GetAutofireShotsPerFiveAPs(gpComparedItemDescObject) > 0 ) ) { ubNumLine = 21; @@ -9054,7 +9054,7 @@ void DrawWeaponValues( OBJECTTYPE * gpItemDescObject ) // Print final value DrawPropertyValueInColour( iFinalAutoValue, ubNumLine, 3, fComparisonMode, FALSE, FALSE, FONT_MCOLOR_WHITE ); } - else if ( Item[ gpComparedItemDescObject->usItem ].usItemClass == IC_GUN && !Item[ gpComparedItemDescObject->usItem].rocketlauncher + else if ( Item[ gpComparedItemDescObject->usItem ].usItemClass == IC_GUN && !ItemIsRocketLauncher(gpComparedItemDescObject->usItem) && GetAutofireShotsPerFiveAPs(gpComparedItemDescObject) > 0 ) { // Get base Auto Penalty value @@ -13805,8 +13805,8 @@ void DrawAdvancedValues( OBJECTTYPE *gpItemDescObject ) cnt++; } - else if ( ( Item[gpItemDescObject->usItem].barrel == TRUE ) || // display for barrel items - ( fComparisonMode && Item[gpComparedItemDescObject->usItem].barrel == TRUE ) ) + else if ( (ItemIsBarrel(gpItemDescObject->usItem)) || // display for barrel items + ( fComparisonMode && ItemIsBarrel(gpComparedItemDescObject->usItem) ) ) { if (!fDrawGenIndexes) fDrawGenIndexes = ++cnt; // insert Indexes here? ///////////////////// COOLDOWN FACTOR diff --git a/Tactical/Interface Items.cpp b/Tactical/Interface Items.cpp index 2a897d889..18f635db6 100644 --- a/Tactical/Interface Items.cpp +++ b/Tactical/Interface Items.cpp @@ -168,7 +168,7 @@ INT16 ITEMDESC_DONE_Y; #define DOTDOTDOT L"..." #define COMMA_AND_SPACE L", " -#define ITEM_PROS_AND_CONS( usItem ) ( ( Item[ usItem ].usItemClass & IC_GUN && !Item[ usItem ].rocketlauncher ) ) +#define ITEM_PROS_AND_CONS( usItem ) ( ( Item[ usItem ].usItemClass & IC_GUN && !ItemIsRocketLauncher(usItem) ) ) #define ITEMDESC_ITEM_STATUS_WIDTH 2 #define ITEMDESC_ITEM_WIDTH 117 @@ -2666,7 +2666,7 @@ void INVRenderINVPanelItem( SOLDIERTYPE *pSoldier, INT16 sPocket, UINT8 fDirtyLe } // IF it's the second hand and this hand cannot contain anything, remove the second hand position graphic - if (sPocket == SECONDHANDPOS && Item[pSoldier->inv[HANDPOS].usItem].twohanded ) + if (sPocket == SECONDHANDPOS && ItemIsTwoHanded(pSoldier->inv[HANDPOS].usItem)) { // CHRISL: Change coords for STI that covers 2nd hand location when carrying a 2handed weapon if( guiCurrentItemDescriptionScreen != MAP_SCREEN ) @@ -2710,7 +2710,7 @@ void INVRenderINVPanelItem( SOLDIERTYPE *pSoldier, INT16 sPocket, UINT8 fDirtyLe fHatchItOut = TRUE; } // CHRISL: Don't hatch second hand position if we're holding a two handed item - else if ( sPocket == SECONDHANDPOS && Item[pSoldier->inv[HANDPOS].usItem].twohanded ) + else if ( sPocket == SECONDHANDPOS && ItemIsTwoHanded(pSoldier->inv[HANDPOS].usItem) ) { fHatchItOut = FALSE; } @@ -2832,8 +2832,8 @@ BOOLEAN CompatibleItemForApplyingOnMerc(OBJECTTYPE *pTestObject) //Shadooow: rewritten to use new item flags and check canteen not empty - if (((HasItemFlag(usItem, CAMO_REMOVAL) && gGameExternalOptions.fCamoRemoving) || Item[usItem].camouflagekit || usItem == JAR_ELIXIR || - Item[usItem].clothestype || Item[usItem].drugtype || Item[usItem].foodtype) && (!Item[usItem].canteen || (*pTestObject)[0]->data.objectStatus > 1)) + if (((HasItemFlag(usItem, CAMO_REMOVAL) && gGameExternalOptions.fCamoRemoving) || ItemIsCamoKit(usItem) || usItem == JAR_ELIXIR || + Item[usItem].clothestype || Item[usItem].drugtype || Item[usItem].foodtype) && (!ItemIsCanteen(usItem) || (*pTestObject)[0]->data.objectStatus > 1)) { return( TRUE ); } @@ -3010,14 +3010,14 @@ BOOLEAN HandleCompatibleAmmoUIForMapScreen( SOLDIERTYPE *pSoldier, INT32 bInvPos UINT32 invsize = pSoldier->inv.size(); // First test attachments, which almost any type of item can have.... - if ( !(Item[ pTestObject->usItem ].hiddenaddon ) ) + if ( !(ItemIsHiddenAddon(pTestObject->usItem)) ) { for ( cnt = 0; cnt < invsize; ++cnt ) { pObject = &(pSoldier->inv[ cnt ]); - if (pObject == pTestObject || Item[pObject->usItem].hiddenaddon || (!Item[pObject->usItem].attachment && - !Item[pObject->usItem].attachmentclass && !Item[pObject->usItem].nasAttachmentClass && !Item[pTestObject->usItem].attachment && + if (pObject == pTestObject || ItemIsHiddenAddon(pObject->usItem) || (!ItemIsAttachment(pObject->usItem) && + !Item[pObject->usItem].attachmentclass && !Item[pObject->usItem].nasAttachmentClass && !ItemIsAttachment(pTestObject->usItem) && !Item[pTestObject->usItem].attachmentclass && !Item[pTestObject->usItem].nasAttachmentClass)) { // don't consider for UI purposes @@ -3116,14 +3116,14 @@ BOOLEAN HandleCompatibleAmmoUIForMapInventory(SOLDIERTYPE *pSoldier, INT32 bInvP } // First test attachments, which almost any type of item can have.... - if (!(Item[pTestObject->usItem].hiddenaddon)) + if (!(ItemIsHiddenAddon(pTestObject->usItem))) { for (cnt = 0; cnt < MAP_INVENTORY_POOL_SLOT_COUNT; ++cnt) { pObject = &(pInventoryPoolList[iStartSlotNumber + cnt].object); - if (pObject == pTestObject || Item[pObject->usItem].hiddenaddon || (!Item[pObject->usItem].attachment && - !Item[pObject->usItem].attachmentclass && !Item[pObject->usItem].nasAttachmentClass && !Item[pTestObject->usItem].attachment && + if (pObject == pTestObject || ItemIsHiddenAddon(pObject->usItem) || (!ItemIsAttachment(pObject->usItem) && + !Item[pObject->usItem].attachmentclass && !Item[pObject->usItem].nasAttachmentClass && !ItemIsAttachment(pTestObject->usItem) && !Item[pTestObject->usItem].attachmentclass && !Item[pTestObject->usItem].nasAttachmentClass)) { // don't consider for UI purposes @@ -3270,14 +3270,14 @@ BOOLEAN InternalHandleCompatibleAmmoUI( SOLDIERTYPE *pSoldier, OBJECTTYPE *pTest UINT32 invsize = pSoldier->inv.size(); // First test attachments, which almost any type of item can have.... - if (!(Item[pTestObject->usItem].hiddenaddon)) + if (!(ItemIsHiddenAddon(pTestObject->usItem))) { for (cnt = 0; cnt < invsize; ++cnt) { pObject = &(pSoldier->inv[cnt]); - if (pObject == pTestObject || Item[pObject->usItem].hiddenaddon || (!Item[pObject->usItem].attachment && - !Item[pObject->usItem].attachmentclass && !Item[pObject->usItem].nasAttachmentClass && !Item[pTestObject->usItem].attachment && + if (pObject == pTestObject || ItemIsHiddenAddon(pObject->usItem) || (!ItemIsAttachment(pObject->usItem) && + !Item[pObject->usItem].attachmentclass && !Item[pObject->usItem].nasAttachmentClass && !ItemIsAttachment(pTestObject->usItem) && !Item[pTestObject->usItem].attachmentclass && !Item[pTestObject->usItem].nasAttachmentClass)) { // don't consider for UI purposes @@ -3302,7 +3302,7 @@ BOOLEAN InternalHandleCompatibleAmmoUI( SOLDIERTYPE *pSoldier, OBJECTTYPE *pTest } } //if the test object is hidden addon or attachment, it won't be ammunition or gun so skip this - if (!Item[pTestObject->usItem].hiddenaddon && !Item[pTestObject->usItem].attachment) + if (!ItemIsHiddenAddon(pTestObject->usItem) && !ItemIsAttachment(pTestObject->usItem)) { if( ( Item [ pTestObject->usItem ].usItemClass & IC_GUN ) ) { @@ -3816,7 +3816,7 @@ void INVRenderItem( UINT32 uiBuffer, SOLDIERTYPE * pSoldier, OBJECTTYPE *pObjec } } - if ( pItem->usItemClass == IC_GUN && !Item[pObject->usItem].rocketlauncher ) + if ( pItem->usItemClass == IC_GUN && !ItemIsRocketLauncher(pObject->usItem) ) { sNewY = sY + sHeight - 10; sNewX = sX + 1; @@ -3872,7 +3872,7 @@ void INVRenderItem( UINT32 uiBuffer, SOLDIERTYPE * pSoldier, OBJECTTYPE *pObjec } } - if ( pItemShown->usItemClass == IC_GUN && !Item[pObjShown->usItem].rocketlauncher ) + if ( pItemShown->usItemClass == IC_GUN && !ItemIsRocketLauncher(pObjShown->usItem) ) { SetRGBFontForeground( AmmoTypes[( *pObjShown )[iter]->data.gun.ubGunAmmoType].red, AmmoTypes[( *pObjShown )[iter]->data.gun.ubGunAmmoType].green, @@ -3950,7 +3950,7 @@ void INVRenderItem( UINT32 uiBuffer, SOLDIERTYPE * pSoldier, OBJECTTYPE *pObjec } // Flugente: overheating - if ( gGameExternalOptions.fWeaponOverheating && ( pItem->usItemClass & (IC_GUN | IC_LAUNCHER) || Item[pObject->usItem].barrel ) ) + if ( gGameExternalOptions.fWeaponOverheating && ( pItem->usItemClass & (IC_GUN | IC_LAUNCHER) || ItemIsBarrel(pObject->usItem)) ) { OBJECTTYPE* pObjShown = pObject; @@ -4201,7 +4201,7 @@ void INVRenderItem( UINT32 uiBuffer, SOLDIERTYPE * pSoldier, OBJECTTYPE *pObjec } if ( ( ( pSoldier->bWeaponMode == WM_ATTACHED_GL || pSoldier->bWeaponMode == WM_ATTACHED_GL_BURST || pSoldier->bWeaponMode == WM_ATTACHED_GL_AUTO ) || - ( Item[pSoldier->inv[HANDPOS].usItem].usItemClass & IC_LAUNCHER && !Item[pSoldier->inv[HANDPOS].usItem].rocketlauncher ) ) && + ( Item[pSoldier->inv[HANDPOS].usItem].usItemClass & IC_LAUNCHER && !ItemIsRocketLauncher(pSoldier->inv[HANDPOS].usItem)) ) && pSoldier->usGLDelayMode ) { wcscat( pStr, New113Message[MSG113_FIREMODE_GL_DELAYED] ); @@ -4231,7 +4231,7 @@ void INVRenderItem( UINT32 uiBuffer, SOLDIERTYPE * pSoldier, OBJECTTYPE *pObjec if ( pSoldier && pObject == &(pSoldier->inv[SECONDHANDPOS] ) && (pSoldier->bWeaponMode == WM_BURST || pSoldier->bWeaponMode == WM_AUTOFIRE) && Item[pSoldier->inv[HANDPOS].usItem].usItemClass & IC_GUN && - !(Item[ pSoldier->inv[HANDPOS ].usItem ].twohanded ) && + !ItemIsTwoHanded(pSoldier->inv[HANDPOS].usItem) && pSoldier->IsValidSecondHandBurst() ) { sNewY = sY + 13; // rather arbitrary @@ -4565,7 +4565,7 @@ void MAPINVRenderItem( UINT32 uiBuffer, SOLDIERTYPE * pSoldier, OBJECTTYPE *pOb } //////////////////// GUN DATA ////////////////// - if ( pItem->usItemClass & IC_GUN && !Item[pObject->usItem].rocketlauncher ) + if ( pItem->usItemClass & IC_GUN && !ItemIsRocketLauncher(pObject->usItem) ) { //////////////// AMMO REMAINING @@ -4804,7 +4804,7 @@ void MAPINVRenderItem( UINT32 uiBuffer, SOLDIERTYPE * pSoldier, OBJECTTYPE *pOb } iCurAsterisk = ATTACHMENT_GENERAL; - if (Item[iter->usItem].grenadelauncher ) + if (ItemIsGrenadeLauncher(iter->usItem)) { //iCurAsterisk = ATTACHMENT_GL; uiNumAttachmentsGL++; @@ -5233,7 +5233,7 @@ BOOLEAN InternalInitItemDescriptionBox( OBJECTTYPE *pObject, INT16 sX, INT16 sY, } // Add ammo eject button for GUN type objects. - if ( (Item[ pObject->usItem ].usItemClass & IC_GUN) && !Item[pObject->usItem].rocketlauncher ) + if ( (Item[ pObject->usItem ].usItemClass & IC_GUN) && !ItemIsRocketLauncher(pObject->usItem) ) { if ( GetMagSize(gpItemDescObject) <= 99 ) { @@ -5610,7 +5610,7 @@ BOOLEAN InternalInitItemDescriptionBox( OBJECTTYPE *pObject, INT16 sX, INT16 sY, } // if ( !(Item[ pObject->usItem ].fFlags & ITEM_HIDDEN_ADDON) && ( ValidAttachment( gpItemPointer->usItem, pObject->usItem ) || ValidLaunchable( gpItemPointer->usItem, pObject->usItem ) || ValidMerge( gpItemPointer->usItem, pObject->usItem ) ) ) - if ( !(Item[ pObject->usItem ].hiddenaddon ) && ( ValidAttachment( gpItemPointer->usItem, pObject ) || ValidLaunchable( gpItemPointer->usItem, pObject->usItem ) || ValidMerge( gpItemPointer->usItem, pObject->usItem ) ) ) + if ( !(ItemIsHiddenAddon(pObject->usItem)) && ( ValidAttachment( gpItemPointer->usItem, pObject ) || ValidLaunchable( gpItemPointer->usItem, pObject->usItem ) || ValidMerge( gpItemPointer->usItem, pObject->usItem ) ) ) { SetUpFastHelpListRegions( gItemDescHelpText.iXPosition, @@ -5750,7 +5750,7 @@ void UpdateAttachmentTooltips(OBJECTTYPE *pObject, UINT8 ubStatusIndex) if (Item[usLoop].nasAttachmentClass & AttachmentSlots[usLoopSlotID].nasAttachmentClass && IsAttachmentPointAvailable(point, usLoop, TRUE)) { usAttachment = usLoop; - if (!Item[usAttachment].hiddenaddon && !Item[usAttachment].hiddenattachment && ItemIsLegal(usAttachment)) + if (!ItemIsHiddenAddon(usAttachment) && !ItemIsHiddenAttachment(usAttachment) && ItemIsLegal(usAttachment)) { if (std::find(attachList.begin(), attachList.end(), usAttachment) == attachList.end()) { @@ -5786,7 +5786,7 @@ void UpdateAttachmentTooltips(OBJECTTYPE *pObject, UINT8 ubStatusIndex) } } - if (usAttachment > 0 && !Item[usAttachment].hiddenaddon && !Item[usAttachment].hiddenattachment && ItemIsLegal(usAttachment)) + if (usAttachment > 0 && !ItemIsHiddenAddon(usAttachment) && !ItemIsHiddenAttachment(usAttachment) && ItemIsLegal(usAttachment)) { if (std::find(attachList.begin(), attachList.end(), usAttachment) == attachList.end()) { @@ -5822,7 +5822,7 @@ void UpdateAttachmentTooltips(OBJECTTYPE *pObject, UINT8 ubStatusIndex) } } - if (usAttachment > 0 && !Item[usAttachment].hiddenaddon && !Item[usAttachment].hiddenattachment && ItemIsLegal(usAttachment)) + if (usAttachment > 0 && !ItemIsHiddenAddon(usAttachment) && !ItemIsHiddenAttachment(usAttachment) && ItemIsLegal(usAttachment)) { if (std::find(attachList.begin(), attachList.end(), usAttachment) == attachList.end()) { @@ -5895,7 +5895,7 @@ void UpdateAttachmentTooltips(OBJECTTYPE *pObject, UINT8 ubStatusIndex) for(UINT16 loop = 0; loop < attachList.size(); loop++){ usAttachment = attachList[loop]; // If the attachment is not hidden - if (usAttachment > 0 && !Item[ usAttachment ].hiddenaddon && !Item[ usAttachment ].hiddenattachment) + if (usAttachment > 0 && !ItemIsHiddenAddon(usAttachment) && !ItemIsHiddenAttachment(usAttachment)) { if (wcslen( attachStr3 ) + wcslen(Item[usAttachment].szItemName) > 3600) { @@ -7021,8 +7021,7 @@ void RenderItemDescriptionBox( ) //WarmSteel - This hatches out attachment slots one by one, instead of all of em. for(cnt = 0; cnt < (INT32)(*gpItemDescObject)[gubItemDescStatusIndex]->attachments.size(); cnt++) { - //if ( ( Item[ gpItemPointer->usItem ].fFlags & ITEM_HIDDEN_ADDON ) || - if ( ( Item[ gpItemPointer->usItem ].hiddenaddon ) || + if (ItemIsHiddenAddon(gpItemPointer->usItem) || ( !ValidItemAttachmentSlot( gpItemDescObject, gpItemPointer->usItem, FALSE, FALSE, gubItemDescStatusIndex, cnt, FALSE, NULL, usAttachmentSlotIndexVector) && !ValidMerge( gpItemPointer->usItem, gpItemDescObject->usItem ) ) ) @@ -7038,8 +7037,7 @@ void RenderItemDescriptionBox( ) } else { for(cnt = 0; cnt < OLD_MAX_ATTACHMENTS_101; cnt++) { - //if ( ( Item[ gpItemPointer->usItem ].fFlags & ITEM_HIDDEN_ADDON ) || - if ( ( Item[ gpItemPointer->usItem ].hiddenaddon ) || + if (ItemIsHiddenAddon(gpItemPointer->usItem) || ( !ValidItemAttachment( gpItemDescObject, gpItemPointer->usItem, FALSE, FALSE, gubItemDescStatusIndex, usAttachmentSlotIndexVector) && !ValidMerge( gpItemPointer->usItem, gpItemDescObject->usItem ) && !ValidLaunchable( gpItemPointer->usItem, gpItemDescObject->usItem ) ) ) @@ -7071,7 +7069,7 @@ void RenderItemDescriptionBox( ) DrawItemUIBarEx( gpItemDescObject, (UINT8)(DRAW_ITEM_STATUS_ATTACHMENT1 + cnt), sCenX, sCenY, ITEM_BAR_WIDTH, ITEM_BAR_HEIGHT, Get16BPPColor( STATUS_BAR ), Get16BPPColor( STATUS_BAR_SHADOW ), TRUE , guiSAVEBUFFER, gubItemDescStatusIndex ); // Flugente: overheating - if ( gGameExternalOptions.fWeaponOverheating && ( Item[ (iter)->usItem ].usItemClass & (IC_GUN|IC_LAUNCHER) || Item[ (iter)->usItem ].barrel == TRUE) ) // Flugente + if ( gGameExternalOptions.fWeaponOverheating && ( Item[ (iter)->usItem ].usItemClass & (IC_GUN|IC_LAUNCHER) || ItemIsBarrel((iter)->usItem)) ) // Flugente { FLOAT overheatjampercentage = GetGunOverheatDisplayPercentage( &(*iter)); @@ -7219,7 +7217,7 @@ void RenderItemDescriptionBox( ) SetFontForeground( FONT_BLACK ); SetFontShadow( ITEMDESC_FONTSHADOW2 ); // Caliber - if ( (Item[gpItemDescObject->usItem].fingerprintid ) && (*gpItemDescObject)[gubItemDescStatusIndex]->data.ubImprintID < NO_PROFILE ) + if ( ItemHasFingerPrintID(gpItemDescObject->usItem) && (*gpItemDescObject)[gubItemDescStatusIndex]->data.ubImprintID < NO_PROFILE ) { // Fingerprint ID swprintf( pStr, L"%s %s (%s)", AmmoCaliber[ Weapon[ gpItemDescObject->usItem ].ubCalibre ], WeaponType[ Weapon[ gpItemDescObject->usItem ].ubWeaponType ], gMercProfiles[ (*gpItemDescObject)[gubItemDescStatusIndex]->data.ubImprintID ].zNickname ); @@ -7284,7 +7282,7 @@ void RenderItemDescriptionBox( ) } // Flugente: display temperature string - if ( gGameExternalOptions.fWeaponOverheating && ( Item[ gpItemDescObject->usItem ].usItemClass == IC_GUN || Item[gpItemDescObject->usItem].usItemClass == IC_LAUNCHER || Item[gpItemDescObject->usItem].barrel == TRUE ) ) + if ( gGameExternalOptions.fWeaponOverheating && ( Item[ gpItemDescObject->usItem ].usItemClass == IC_GUN || Item[gpItemDescObject->usItem].usItemClass == IC_LAUNCHER || ItemIsBarrel(gpItemDescObject->usItem) ) ) { // UDB system displays a string with colored condition text. int regionindex = 8; @@ -7612,7 +7610,7 @@ void RenderItemDescriptionBox( ) FindFontRightCoordinates( gODBItemDescRegions[2][7].sLeft, gODBItemDescRegions[2][7].sTop, gODBItemDescRegions[2][7].sRight - gODBItemDescRegions[2][7].sLeft, gODBItemDescRegions[2][7].sBottom - gODBItemDescRegions[2][7].sTop ,pStr, BLOCKFONT2, &usX, &usY); mprintf( usX, usY, pStr ); } - if ( Item[ gpItemDescObject->usItem ].usItemClass & (IC_GUN|IC_PUNCH|IC_BLADE|IC_THROWING_KNIFE) && !Item[ gpItemDescObject->usItem ].singleshotrocketlauncher ) + if ( Item[ gpItemDescObject->usItem ].usItemClass & (IC_GUN|IC_PUNCH|IC_BLADE|IC_THROWING_KNIFE) && !ItemIsSingleShotRocketLauncher(gpItemDescObject->usItem) ) { // DAMAGE SetFontForeground( 6 ); @@ -8365,7 +8363,7 @@ void DeleteItemDescriptionBox( ) } if (Item[gpItemDescObject->usItem].usItemClass == IC_LAUNCHER && ValidLaunchable(newIter->usItem, gpItemDescObject->usItem) || - Item[gpItemDescObject->usItem].cannon) + ItemIsCannon(gpItemDescObject->usItem)) { //lalien: changed to charge AP's for reloading a GL/RL ubAPCost = GetAPsToReload(gpItemDescObject); @@ -10712,7 +10710,7 @@ void ItemPopupRegionCallback( MOUSE_REGION * pRegion, INT32 iReason ) } else { - if ( _KeyDown(SHIFT) && gpItemPointer == NULL && Item[gpItemPopupObject->usItem].usItemClass == IC_GUN && (*gpItemPopupObject)[uiItemPos]->data.gun.ubGunShotsLeft > 0 && !(Item[gpItemPopupObject->usItem].singleshotrocketlauncher) ) + if ( _KeyDown(SHIFT) && gpItemPointer == NULL && Item[gpItemPopupObject->usItem].usItemClass == IC_GUN && (*gpItemPopupObject)[uiItemPos]->data.gun.ubGunShotsLeft > 0 && !ItemIsSingleShotRocketLauncher(gpItemPopupObject->usItem) ) { EmptyWeaponMagazine( gpItemPopupObject, &gItemPointer, uiItemPos ); InternalMAPBeginItemPointer( gpItemPopupSoldier ); @@ -10723,7 +10721,7 @@ void ItemPopupRegionCallback( MOUSE_REGION * pRegion, INT32 iReason ) } else { - if ( _KeyDown(SHIFT) && gpItemPointer == NULL && Item[gpItemPopupObject->usItem].usItemClass == IC_GUN && (*gpItemPopupObject)[uiItemPos]->data.gun.ubGunShotsLeft > 0 && !(Item[gpItemPopupObject->usItem].singleshotrocketlauncher) && !( guiTacticalInterfaceFlags & INTERFACE_SHOPKEEP_INTERFACE ) ) + if ( _KeyDown(SHIFT) && gpItemPointer == NULL && Item[gpItemPopupObject->usItem].usItemClass == IC_GUN && (*gpItemPopupObject)[uiItemPos]->data.gun.ubGunShotsLeft > 0 && !ItemIsSingleShotRocketLauncher(gpItemPopupObject->usItem) && !( guiTacticalInterfaceFlags & INTERFACE_SHOPKEEP_INTERFACE ) ) { EmptyWeaponMagazine( gpItemPopupObject, &gItemPointer, uiItemPos ); gpItemPointer = &gItemPointer; @@ -12629,7 +12627,7 @@ void GetHelpTextForItem( STR16 pzStr, OBJECTTYPE *pObject, SOLDIERTYPE *pSoldier // Fingerprint ID (Soldier Name) - if ( ( Item[pObject->usItem].fingerprintid ) && (*pObject)[subObject]->data.ubImprintID < NO_PROFILE ) + if ( ItemHasFingerPrintID(pObject->usItem) && (*pObject)[subObject]->data.ubImprintID < NO_PROFILE ) { CHAR16 pStr2[20]; swprintf( pStr2, L" [%s]", gMercProfiles[ (*pObject)[subObject]->data.ubImprintID ].zNickname ); @@ -13816,7 +13814,7 @@ void BombInventoryMessageBoxCallBack( UINT8 ubExitValue ) if (gpItemDescSoldier) { // no planting tripwire in our inventory... - if ( Item[ gpItemDescObject->usItem ].tripwire == 1 ) + if (ItemIsTripwire(gpItemDescObject->usItem)) return; INT32 iResult; @@ -13965,14 +13963,14 @@ void BombInventoryDisArmMessageBoxCallBack( UINT8 ubExitValue ) if ( (*gpItemDescObject)[0]->data.misc.ubBombOwner > 1 && ( (INT32)(*gpItemDescObject)[0]->data.misc.ubBombOwner - 2 >= gTacticalStatus.Team[ OUR_TEAM ].bFirstID && (*gpItemDescObject)[0]->data.misc.ubBombOwner - 2 <= gTacticalStatus.Team[ OUR_TEAM ].bLastID ) ) { // Flugente: get a tripwire-related bonus if we have a wire cutter in our hands - if ( ( (&gpItemDescSoldier->inv[HANDPOS])->exists() && Item[ gpItemDescSoldier->inv[HANDPOS].usItem ].wirecutters == 1 ) || ( (&gpItemDescSoldier->inv[SECONDHANDPOS])->exists() && Item[ gpItemDescSoldier->inv[SECONDHANDPOS].usItem ].wirecutters == 1 ) ) + if ( ( (&gpItemDescSoldier->inv[HANDPOS])->exists() && ItemIsWirecutters(gpItemDescSoldier->inv[HANDPOS].usItem) ) || ( (&gpItemDescSoldier->inv[SECONDHANDPOS])->exists() && ItemIsWirecutters(gpItemDescSoldier->inv[SECONDHANDPOS].usItem) ) ) { // + 10 if item gets activated by tripwire - if ( Item[gpItemDescObject->usItem].tripwireactivation == 1 ) + if (ItemHasTripwireActivation(gpItemDescObject->usItem)) diff += 10; // + 10 if item is tripwire - if ( Item[gpItemDescObject->usItem].tripwire == 1 ) + if (ItemIsTripwire(gpItemDescObject->usItem)) diff += 10; } diff --git a/Tactical/Interface Panels.cpp b/Tactical/Interface Panels.cpp index 4bbbeebda..13d9d2cb7 100644 --- a/Tactical/Interface Panels.cpp +++ b/Tactical/Interface Panels.cpp @@ -3373,7 +3373,7 @@ BOOLEAN HandleNailsVestFetish( SOLDIERTYPE *pSoldier, UINT32 uiHandPos, UINT16 u else { // Do we have nothing or the leather vest or kevlar leather vest? - if ( Item[usReplaceItem].leatherjacket || + if (ItemIsLeatherJacket(usReplaceItem) || usReplaceItem == COMPOUND18 || usReplaceItem == JAR_QUEEN_CREATURE_BLOOD ) { @@ -4044,7 +4044,7 @@ void SMInvClickCallback( MOUSE_REGION * pRegion, INT32 iReason ) { if ( !InItemDescriptionBox( ) ) { - if ( _KeyDown(SHIFT) && gpItemPointer == NULL && Item[gpSMCurrentMerc->inv[ uiHandPos ].usItem].usItemClass == IC_GUN && (gpSMCurrentMerc->inv[ uiHandPos ])[uiHandPos]->data.gun.ubGunShotsLeft > 0 && !(Item[gpSMCurrentMerc->inv[ uiHandPos ].usItem].singleshotrocketlauncher) && !( guiTacticalInterfaceFlags & INTERFACE_SHOPKEEP_INTERFACE ) ) + if ( _KeyDown(SHIFT) && gpItemPointer == NULL && Item[gpSMCurrentMerc->inv[ uiHandPos ].usItem].usItemClass == IC_GUN && (gpSMCurrentMerc->inv[ uiHandPos ])[uiHandPos]->data.gun.ubGunShotsLeft > 0 && !ItemIsSingleShotRocketLauncher(gpSMCurrentMerc->inv[ uiHandPos ].usItem) && !( guiTacticalInterfaceFlags & INTERFACE_SHOPKEEP_INTERFACE ) ) { EmptyWeaponMagazine( &(gpSMCurrentMerc->inv[ uiHandPos ]), &gItemPointer, uiHandPos ); gpItemPointer = &gItemPointer; @@ -7096,22 +7096,23 @@ void CheckForAndAddMercToTeamPanel( SOLDIERTYPE *pSoldier ) void CleanUpStack( OBJECTTYPE * pObj, OBJECTTYPE * pCursorObj ) { INT16 bMaxPoints; + UINT16 usItem = pObj->usItem; - if ( !(Item[pObj->usItem].usItemClass & IC_AMMO || Item[pObj->usItem].usItemClass & IC_KIT || Item[pObj->usItem].usItemClass & IC_MEDKIT || Item[pObj->usItem].canteen || Item[pObj->usItem].gascan || Item[pObj->usItem].alcohol > 0.0f) ) + if ( !(Item[usItem].usItemClass & IC_AMMO || Item[usItem].usItemClass & IC_KIT || Item[usItem].usItemClass & IC_MEDKIT || ItemIsCanteen(usItem) || ItemIsGascan(usItem) || Item[usItem].alcohol > 0.0f) ) { return; } - if ( Item[ pObj->usItem ].usItemClass & IC_AMMO ) + if ( Item[ usItem ].usItemClass & IC_AMMO ) { - bMaxPoints = Magazine[ Item[ pObj->usItem ].ubClassIndex ].ubMagSize; + bMaxPoints = Magazine[ Item[ usItem ].ubClassIndex ].ubMagSize; } else { bMaxPoints = 100; } - if ( pCursorObj && pCursorObj->usItem == pObj->usItem ) + if ( pCursorObj && pCursorObj->usItem == usItem ) { DistributeStatus(pCursorObj, pObj, bMaxPoints); } @@ -7120,13 +7121,13 @@ void CleanUpStack( OBJECTTYPE * pObj, OBJECTTYPE * pCursorObj ) // Flugente: one of the items on the stack might not be full. Make sure it is the first one, so the player can see what is missing at a glance if ( pObj->ubNumberOfObjects > 1 ) { - if ( Item[pObj->usItem].usItemClass & IC_AMMO ) + if ( Item[usItem].usItemClass & IC_AMMO ) { UINT16 shots_first = (*pObj)[0]->data.ubShotsLeft; (*pObj)[0]->data.ubShotsLeft = (*pObj)[pObj->ubNumberOfObjects - 1]->data.ubShotsLeft; (*pObj)[pObj->ubNumberOfObjects - 1]->data.ubShotsLeft = shots_first; } - else if ( Item[pObj->usItem].usItemClass & IC_MAPFILTER_KIT ) + else if ( Item[usItem].usItemClass & IC_MAPFILTER_KIT ) { INT16 status_first = (*pObj)[0]->data.objectStatus; (*pObj)[0]->data.objectStatus = (*pObj)[pObj->ubNumberOfObjects - 1]->data.objectStatus; diff --git a/Tactical/Interface.cpp b/Tactical/Interface.cpp index 5ab367503..cfa3098ed 100644 --- a/Tactical/Interface.cpp +++ b/Tactical/Interface.cpp @@ -978,12 +978,12 @@ void PopupMovementMenu( UI_EVENT *pUIEvent ) } else { - if ( Item[pSoldier->inv[ HANDPOS ].usItem].toolkit ) + if (ItemIsToolkit(pSoldier->inv[ HANDPOS ].usItem)) { uiActionImages = TOOLKITACTIONC_IMAGES; swprintf( zActionString, TacticalStr[ NOT_APPLICABLE_POPUPTEXT ] ); } - else if ( Item[pSoldier->inv[ HANDPOS ].usItem].wirecutters ) + else if (ItemIsWirecutters(pSoldier->inv[ HANDPOS ].usItem)) { uiActionImages = WIRECUTACTIONC_IMAGES; swprintf( zActionString, TacticalStr[ NOT_APPLICABLE_POPUPTEXT ] ); @@ -6043,7 +6043,7 @@ void GetEnemyInfoString( SOLDIERTYPE* pSelectedSoldier, SOLDIERTYPE* pTargetSold } else { // show general name - if( Item[pTargetSoldier->inv[HEAD1POS].usItem].gasmask ) + if(ItemIsGasmask(pTargetSoldier->inv[HEAD1POS].usItem)) wcscat( NameStr, TacticalStr[ GENERAL_INFO_MASK ] ); else if( Item[pTargetSoldier->inv[HEAD1POS].usItem].nightvisionrangebonus || Item[pTargetSoldier->inv[HEAD1POS].usItem].cavevisionrangebonus ) wcscat( NameStr, TacticalStr[ GENERAL_INFO_NVG ] ); @@ -6059,7 +6059,7 @@ void GetEnemyInfoString( SOLDIERTYPE* pSelectedSoldier, SOLDIERTYPE* pTargetSold } else { // show general name - if( Item[pTargetSoldier->inv[HEAD1POS].usItem].gasmask ) + if(ItemIsGasmask(pTargetSoldier->inv[HEAD1POS].usItem)) wcscat( NameStr, TacticalStr[ GENERAL_INFO_MASK ] ); else if( Item[pTargetSoldier->inv[HEAD1POS].usItem].nightvisionrangebonus || Item[pTargetSoldier->inv[HEAD1POS].usItem].cavevisionrangebonus ) wcscat( NameStr, TacticalStr[ GENERAL_INFO_NVG ] ); diff --git a/Tactical/Inventory Choosing.cpp b/Tactical/Inventory Choosing.cpp index cbac1179a..72bfa7969 100644 --- a/Tactical/Inventory Choosing.cpp +++ b/Tactical/Inventory Choosing.cpp @@ -738,7 +738,7 @@ void GenerateRandomEquipment( SOLDIERCREATE_STRUCT *pp, INT8 bSoldierClass, INT8 switch( Item[ pItem->usItem ].usItemClass ) { case IC_GUN: - if ( !Item[pItem->usItem].rocketlauncher ) + if ( !ItemIsRocketLauncher(pItem->usItem) ) { bWeaponClass *= -1; } @@ -873,7 +873,7 @@ void ChooseWeaponForSoldierCreateStruct( SOLDIERCREATE_STRUCT *pp, INT8 bWeaponC pp->Inv[ i ][0]->data.gun.ubGunAmmoType = Magazine[Item[usAmmoIndex].ubClassIndex].ubAmmoType; pp->Inv[ i ][0]->data.gun.usGunAmmoItem = usAmmoIndex; - if ( Item[usGunIndex].fingerprintid ) + if (ItemHasFingerPrintID(usGunIndex)) { pp->Inv[ i ][0]->data.ubImprintID = (NO_PROFILE + 1); } @@ -951,7 +951,7 @@ void ChooseWeaponForSoldierCreateStruct( SOLDIERCREATE_STRUCT *pp, INT8 bWeaponC pp->Inv[ HANDPOS ].fFlags |= OBJECT_UNDROPPABLE; // Rocket Rifles must come pre-imprinted, in case carrier gets killed without getting a shot off - if ( Item[usGunIndex].fingerprintid ) + if (ItemHasFingerPrintID(usGunIndex)) { pp->Inv[ HANDPOS ][0]->data.ubImprintID = (NO_PROFILE + 1); } @@ -3144,7 +3144,7 @@ void ReplaceExtendedGuns( SOLDIERCREATE_STRUCT *pp, INT8 bSoldierClass ) { usItem = pp->Inv[ uiLoop ].usItem; - if ( ( Item[ usItem ].usItemClass & IC_GUN ) && ExtendedGunListGun( usItem ) ) + if ( ( Item[ usItem ].usItemClass & IC_GUN ) && ItemIsOnlyInTonsOfGuns( usItem ) ) { if ( bSoldierClass == SOLDIER_CLASS_NONE ) { @@ -3528,7 +3528,7 @@ UINT32 ItemFitness( OBJECTTYPE* pObj, UINT8 idx ) } else if ( Item[ pObj->usItem ].usItemClass & IC_FACE ) { - if ( Item[ pObj->usItem ].gasmask ) + if (ItemIsGasmask(pObj->usItem)) value = (*pObj)[idx]->data.objectStatus; else if ( Item[ pObj->usItem ].hearingrangebonus ) { @@ -4186,7 +4186,7 @@ void TakeMilitiaEquipmentfromSector( INT16 sMapX, INT16 sMapY, INT8 sMapZ, SOLDI else if ( Item[pWorldItem[ uiCount ].object.usItem].usItemClass & IC_FACE && (!si[SI_SIGHT].done || !si[SI_FACE2].done || !si[SI_FACE_SPARESIGHT].done || !si[SI_GASMASK].done) ) { // gasmasks are reserved for a special slot and will only be worn if we do not have 2 face items. items that increase our vision (NVGs adn sungooggles) get to slot 1, everything else in 2 - if ( Item[ pWorldItem[ uiCount ].object.usItem ].gasmask ) + if (ItemIsGasmask(pWorldItem[ uiCount ].object.usItem)) EvaluateObjForItem( pWorldItem, pObj, uiCount, &si[SI_GASMASK] ); else if ( Item[ pWorldItem[ uiCount ].object.usItem ].nightvisionrangebonus > 0 ) { @@ -4265,7 +4265,7 @@ void TakeMilitiaEquipmentfromSector( INT16 sMapX, INT16 sMapY, INT8 sMapZ, SOLDI if ( fnd == launcherhelpmap.end() ) { LauncherHelpStruct tmp; - tmp.fNeedsAmmo = !Item[pWorldItem[ uiCount ].object.usItem].singleshotrocketlauncher; + tmp.fNeedsAmmo = !ItemIsSingleShotRocketLauncher(pWorldItem[ uiCount ].object.usItem); launcherhelpmap[ pWorldItem[ uiCount ].object.usItem ] = tmp; } } diff --git a/Tactical/Item Types.cpp b/Tactical/Item Types.cpp index e8a7c8483..b80888d0e 100644 --- a/Tactical/Item Types.cpp +++ b/Tactical/Item Types.cpp @@ -1595,7 +1595,7 @@ OBJECTTYPE& OBJECTTYPE::operator=(const OLD_OBJECTTYPE_101& src) } else if ( EXPLOSIVE_GUN( this->usItem ) ) { - if ( Item[this->usItem].singleshotrocketlauncher ) + if (ItemIsSingleShotRocketLauncher(this->usItem)) { (*this)[0]->data.gun.ubGunShotsLeft = 1; } diff --git a/Tactical/Item Types.h b/Tactical/Item Types.h index 3d82e35e7..78f1f5d53 100644 --- a/Tactical/Item Types.h +++ b/Tactical/Item Types.h @@ -779,6 +779,98 @@ extern OBJECTTYPE gTempObject; // extended flagmask to UINT64 #define EMPTY_BLOOD_BAG 0x0000000100000000 // this item is a empty blood bag #define MEDICAL_SPLINT 0x0000000200000000 // this item is a medical splint that can be applied to some diseases +#define ITEM_damageable 0x0000000400000000 +#define ITEM_repairable 0x0000000800000000 + +#define ITEM_waterdamages 0x0000001000000000 +#define ITEM_metal 0x0000002000000000 +#define ITEM_sinks 0x0000004000000000 +#define ITEM_showstatus 0x0000008000000000 + +#define ITEM_hiddenaddon 0x0000010000000000 +#define ITEM_twohanded 0x0000020000000000 +#define ITEM_notbuyable 0x0000040000000000 +#define ITEM_attachment 0x0000080000000000 + +#define ITEM_hiddenattachment 0x0000100000000000 +#define ITEM_biggunlist 0x0000200000000000 +#define ITEM_notineditor 0x0000400000000000 +#define ITEM_defaultundroppable 0x0000800000000000 + +#define ITEM_unaerodynamic 0x0001000000000000 +#define ITEM_electronic 0x0002000000000000 +#define ITEM_cannon 0x0004000000000000 +#define ITEM_rocketrifle 0x0008000000000000 + +#define ITEM_fingerprintid 0x0010000000000000 +#define ITEM_metaldetector 0x0020000000000000 +#define ITEM_gasmask 0x0040000000000000 +#define ITEM_lockbomb 0x0080000000000000 + +#define ITEM_flare 0x0100000000000000 +#define ITEM_grenadelauncher 0x0200000000000000 +#define ITEM_mortar 0x0400000000000000 +#define ITEM_duckbill 0x0800000000000000 + +#define ITEM_detonator 0x1000000000000000 +#define ITEM_remotedetonator 0x2000000000000000 +#define ITEM_hidemuzzleflash 0x4000000000000000 +#define ITEM_rocketlauncher 0x8000000000000000 + +// New UINT64 Item Flag => usItemFlag2 +#define ITEM_singleshotrocketlauncher 0x00000001 +#define ITEM_brassknuckles 0x00000002 +#define ITEM_crowbar 0x00000004 +#define ITEM_glgrenade 0x00000008 + +#define ITEM_flakjacket 0x00000010 +#define ITEM_leatherjacket 0x00000020 +#define ITEM_batteries 0x00000040 +#define ITEM_needsbatteries 0x00000080 + +#define ITEM_xray 0x00000100 +#define ITEM_wirecutters 0x00000200 +#define ITEM_toolkit 0x00000400 +#define ITEM_firstaidkit 0x00000800 + +#define ITEM_medicalkit 0x00001000 +#define ITEM_canteen 0x00002000 +#define ITEM_jar 0x00004000 +#define ITEM_canandstring 0x00008000 + +#define ITEM_marbles 0x00010000 +#define ITEM_walkman 0x00020000 +#define ITEM_remotetrigger 0x00040000 +#define ITEM_robotremotecontrol 0x00080000 + +#define ITEM_camouflagekit 0x00100000 +#define ITEM_locksmithkit 0x00200000 +#define ITEM_mine 0x00400000 +#define ITEM_antitankmine 0x00800000 + +#define ITEM_hardware 0x01000000 +#define ITEM_medical 0x02000000 +#define ITEM_gascan 0x04000000 +#define ITEM_containsliquid 0x08000000 + +#define ITEM_rock 0x10000000 +#define ITEM_thermaloptics 0x20000000 +#define ITEM_scifi 0x40000000 +#define ITEM_newinv 0x80000000 + +#define ITEM_DiseaseSystemExclusive 0x0000000100000000 // kitty: item exclusively available with disease feature +#define ITEM_barrel 0x0000000200000000 // item can be used on some guns as an exchange barrel +#define ITEM_tripwireactivation 0x0000000400000000 // item (mine) can be activated by nearby tripwire +#define ITEM_tripwire 0x0000000800000000 // item is tripwire + +#define ITEM_directional 0x0000001000000000 // item is a directional mine/bomb (actual direction is set upon planting) +#define ITEM_blockironsight 0x0000002000000000 // if a gun or any attachment have this property, the iron sight won't be usable (if there is at least one other usable sight) +#define ITEM_fAllowClimbing 0x0000004000000000 // JMich: BackpackClimb does item allow climbing while wearing it +#define ITEM_cigarette 0x0000008000000000 // Flugente: this item can be smoked + +#define ITEM_fProvidesRobotCamo 0x0000010000000000 // rftr: robot attachments +#define ITEM_fProvidesRobotNightVision 0x0000020000000000 // rftr: robot attachments +#define ITEM_fProvidesRobotLaserBonus 0x0000040000000000 // rftr: robot attachments // ---------------------------------------------------------------- @@ -947,70 +1039,73 @@ extern OBJECTTYPE gTempObject; // autofiretohitbonus, // bursttohitbonus - typedef struct { - UINT32 usItemClass; - UINT64 nasAttachmentClass; //CHRISL: Identify the class of attachment - UINT64 nasLayoutClass; -//Madd: Common Attachment Framework: attach items based on matching connection points rather than using the old long attachmentinfo method - UINT64 ulAvailableAttachmentPoint; - UINT64 ulAttachmentPoint; - UINT8 ubAttachToPointAPCost; // cost to attach to any matching point - UINT16 ubClassIndex; - UINT8 ubCursor; - INT8 bSoundType; - UINT8 ubGraphicType; - UINT16 ubGraphicNum; - UINT16 ubWeight; //2 units per kilogram; roughly 1 unit per pound - UINT8 ubPerPocket; - UINT16 ItemSize; - UINT16 usPrice; - UINT8 ubCoolness; - INT8 bReliability; - INT8 bRepairEase; - UINT16 fFlags; - - UINT32 uiIndex; // added + CHAR16 szItemDesc[400]; + CHAR16 szBRDesc[400]; CHAR16 szItemName[80]; //+1 for the null terminator //added - - BOOLEAN damageable; - BOOLEAN repairable; - BOOLEAN waterdamages; - BOOLEAN metal; - BOOLEAN sinks; - BOOLEAN showstatus; - BOOLEAN hiddenaddon; - BOOLEAN twohanded; - BOOLEAN notbuyable; - BOOLEAN attachment; - BOOLEAN hiddenattachment; - BOOLEAN biggunlist; - BOOLEAN notineditor; - BOOLEAN defaultundroppable; - BOOLEAN unaerodynamic; - BOOLEAN electronic; - UINT8 inseparable; //Madd:Normally, an inseparable attachment can never be removed. - //But now we will make it so that these items can be replaced, but still not removed directly. - //0 = removeable (as before) - //1 = inseparable (as before) - //2 = inseparable, but replaceable - CHAR16 szLongItemName[80]; - CHAR16 szItemDesc[400]; CHAR16 szBRName[80]; - CHAR16 szBRDesc[400]; + UINT16 defaultattachments[MAX_DEFAULT_ATTACHMENTS]; //Need more default attachments, chose an array to do so. (no vector / list just to keep this all plain data) + + UINT64 nasAttachmentClass; //CHRISL: Identify the class of attachment + UINT64 nasLayoutClass; + UINT64 ulAvailableAttachmentPoint; + UINT64 ulAttachmentPoint; + UINT64 usItemFlag; // bitflags to store various item properties (better than introducing 64 BOOLEAN values). If I only had thought of this earlier.... + UINT64 usItemFlag2; // bitflags to store various item properties + + UINT32 uiIndex; + UINT32 usItemClass; + UINT32 attachmentclass; // attachmentclass used + UINT32 drugtype; // this flagmask determines what different components are used in a drug, which results in different effects + UINT32 foodtype; + UINT32 usActionItemFlag; // Flugente: a flag that is necessary for transforming action items to objects with new abilities (for now, tripwire networks and directional explosives) + UINT32 clothestype; // Flugente: clothes type that 'links' to an entry in Clothes.xml + + //zilpin: pellet spread patterns externalized in XML + INT32 spreadPattern; + + FLOAT alcohol; + // HEADROCK HAM 4: New modifiers that do not require a stance array, since they affect the gun objectively, not + // subjectively. + FLOAT RecoilModifierX; + FLOAT RecoilModifierY; + FLOAT scopemagfactor; + FLOAT projectionfactor; + FLOAT usOverheatingCooldownFactor; // every turn/5 seconds, a gun's temperature is lowered by this amount + FLOAT overheatTemperatureModificator; // percentage modifier of heat a shot generates (read from attachments) + FLOAT overheatCooldownModificator; // percentage modifier of cooldown amount (read from attachments, applies to guns & barrels) + FLOAT overheatJamThresholdModificator; // percentage modifier of a gun's jam threshold (read from attachments) + FLOAT overheatDamageThresholdModificator; // percentage modifier of a gun's damage threshold (read from attachments) + FLOAT dirtIncreaseFactor; // Flugente: advanced repair/dirt system. One shot causes this much dirt on a gun + FLOAT fRobotDamageReductionModifier; // rftr: robot attachments + + // HEADROCK HAM 4: New variable arrays for the New CTH system. + INT16 flatbasemodifier[3]; + INT16 percentbasemodifier[3]; + INT16 flataimmodifier[3]; + INT16 percentaimmodifier[3]; + INT16 percentcapmodifier[3]; + INT16 percenthandlingmodifier[3]; + INT16 percentdropcompensationmodifier[3]; + INT16 maxcounterforcemodifier[3]; + INT16 counterforceaccuracymodifier[3]; + INT16 targettrackingmodifier[3]; + INT16 aimlevelsmodifier[3]; - //TODO: quest items, boosters, money + //Madd: Common Attachment Framework: attach items based on matching connection points rather than using the old long attachmentinfo method + UINT16 ubClassIndex; + UINT16 ubGraphicNum; + UINT16 ubWeight; //2 units per kilogram; roughly 1 unit per pound + UINT16 ItemSize; + UINT16 usPrice; + UINT16 discardedlauncheritem; + UINT16 randomitem; // Flugente: a link to RandomItemsClass.xml. Out of such an item, a random object is created, depending on the entries in the xml + UINT16 usBuddyItem; // Flugente: item is connected to another item. Type of connection depends on item specifics + UINT16 usRiotShieldStrength; // Flugente: riot shields. strength of shield + UINT16 usRiotShieldGraphic; // Flugente: riot shields. graphic of shield (when deployed in tactical, taken from Tilecache/riotshield.sti) - // special item/attachment functions: - BOOLEAN cannon; - BOOLEAN rocketrifle; - BOOLEAN fingerprintid; - BOOLEAN metaldetector; - BOOLEAN gasmask; - BOOLEAN lockbomb; - BOOLEAN flare; INT16 percentnoisereduction; INT16 bipod; INT16 tohitbonus; @@ -1021,57 +1116,16 @@ typedef struct INT16 minrangeforaimbonus; INT16 percentapreduction; INT16 percentstatusdrainreduction; - BOOLEAN grenadelauncher; - BOOLEAN mortar; - BOOLEAN duckbill; - BOOLEAN detonator; - BOOLEAN remotedetonator; - BOOLEAN hidemuzzleflash; - BOOLEAN rocketlauncher; - BOOLEAN singleshotrocketlauncher; - UINT16 discardedlauncheritem; - BOOLEAN brassknuckles; - //*** ddd UINT16 bloodieditem; - INT16 bloodieditem; - BOOLEAN crowbar; - BOOLEAN glgrenade; - BOOLEAN flakjacket; + INT16 bloodieditem; INT16 hearingrangebonus; - INT16 visionrangebonus; - INT16 nightvisionrangebonus; - INT16 dayvisionrangebonus; - INT16 cavevisionrangebonus; - INT16 brightlightvisionrangebonus; - INT16 itemsizebonus; - BOOLEAN leatherjacket; - BOOLEAN batteries; - BOOLEAN needsbatteries; - BOOLEAN xray; - BOOLEAN wirecutters; - BOOLEAN toolkit; - BOOLEAN firstaidkit; - BOOLEAN medicalkit; - BOOLEAN canteen; - BOOLEAN jar; - BOOLEAN canandstring; - BOOLEAN marbles; - BOOLEAN walkman; - BOOLEAN remotetrigger; - BOOLEAN robotremotecontrol; - BOOLEAN camouflagekit; - BOOLEAN locksmithkit; - BOOLEAN mine; - BOOLEAN antitankmine; - FLOAT alcohol; - BOOLEAN hardware; - BOOLEAN medical; - BOOLEAN gascan; - BOOLEAN containsliquid; - BOOLEAN rock; - + INT16 visionrangebonus; + INT16 nightvisionrangebonus; + INT16 dayvisionrangebonus; + INT16 cavevisionrangebonus; + INT16 brightlightvisionrangebonus; + INT16 itemsizebonus; INT16 damagebonus; INT16 meleedamagebonus; - INT16 magsizebonus; INT16 percentautofireapreduction; INT16 autofiretohitbonus; @@ -1081,147 +1135,56 @@ typedef struct INT16 bursttohitbonus; INT16 percentreadytimeapreduction; INT16 bulletspeedbonus; - BOOLEAN thermaloptics; - UINT8 percenttunnelvision; INT16 percentreloadtimeapreduction; INT16 percentburstfireapreduction; - INT16 camobonus; INT16 stealthbonus; INT16 urbanCamobonus; INT16 desertCamobonus; INT16 snowCamobonus; - - BOOLEAN scifi; // item only available in scifi mode - BOOLEAN newinv; // item only available in new inventory mode - UINT8 ubAttachmentSystem; //Item availability per attachment system: 0 = both, 1 = OAS, 2 = NAS - - UINT16 defaultattachments[MAX_DEFAULT_ATTACHMENTS]; //Need more default attachments, chose an array to do so. (no vector / list just to keep this all plain data) - - //zilpin: pellet spread patterns externalized in XML - INT32 spreadPattern; - - // HEADROCK HAM 4: New variable arrays for the New CTH system. - INT16 flatbasemodifier[3]; - INT16 percentbasemodifier[3]; - INT16 flataimmodifier[3]; - INT16 percentaimmodifier[3]; - INT16 percentcapmodifier[3]; - INT16 percenthandlingmodifier[3]; - INT16 percentdropcompensationmodifier[3]; - INT16 maxcounterforcemodifier[3]; - INT16 counterforceaccuracymodifier[3]; - INT16 targettrackingmodifier[3]; - INT16 aimlevelsmodifier[3]; - // HEADROCK HAM 4: New modifiers that do not require a stance array, since they affect the gun objectively, not - // subjectively. - FLOAT RecoilModifierX; - FLOAT RecoilModifierY; INT16 PercentRecoilModifier; INT16 percentaccuracymodifier; - FLOAT scopemagfactor; - FLOAT projectionfactor; - BOOLEAN speeddot; - - // Flugente - BOOLEAN barrel; // item can be used on some guns as an exchange barrel - FLOAT usOverheatingCooldownFactor; // every turn/5 seconds, a gun's temperature is lowered by this amount - FLOAT overheatTemperatureModificator; // percentage modifier of heat a shot generates (read from attachments) - FLOAT overheatCooldownModificator; // percentage modifier of cooldown amount (read from attachments, applies to guns & barrels) - FLOAT overheatJamThresholdModificator; // percentage modifier of a gun's jam threshold (read from attachments) - FLOAT overheatDamageThresholdModificator; // percentage modifier of a gun's damage threshold (read from attachments) - - UINT32 attachmentclass; // attachmentclass used - - BOOLEAN tripwireactivation; // item (mine) can be activated by nearby tripwire - BOOLEAN tripwire; // item is tripwire - BOOLEAN directional; // item is a directional mine/bomb (actual direction is set upon planting) - - UINT32 drugtype; // this flagmask determines what different components are used in a drug, which results in different effects - - BOOLEAN blockironsight; // if a gun or any attachment have this property, the iron sight won't be usable (if there is at least one other usable sight) - - UINT64 usItemFlag; // bitflags to store various item properties (better than introducing 32 BOOLEAN values). If I only had thought of this earlier.... - - // Flugente: food type - UINT32 foodtype; - - //JMich_SkillModifiers: Adding new skill modifiers - INT8 LockPickModifier; - UINT8 CrowbarModifier; - UINT8 DisarmModifier; - INT8 RepairModifier; - - // Flugente: a modifier to hacking - UINT8 usHackingModifier; - - // Flugente: a modifier for burial effectiveness - UINT8 usBurialModifier; - - // Flugente: advanced repair/dirt system - UINT8 usDamageChance; // chance that damage to the status will also damage the repair threshold - FLOAT dirtIncreaseFactor; // one shot causes this much dirt on a gun - - // Flugente: a flag that is necessary for transforming action items to objects with new abilities (for now, tripwire networks and directional explosives) - UINT32 usActionItemFlag; - - // Flugente: clothes type that 'links' to an entry in Clothes.xml - UINT32 clothestype; - - // Flugente: a link to RandomItemsClass.xml. Out of such an item, a random object is created, depending on the entries in the xml - UINT16 randomitem; - INT8 randomitemcoolnessmodificator; // alters the allowed maximum coolness a random item can have - - // Flugente: range of a flashlight (an item with usFlashLightRange > 0 is deemed a flashlight) - UINT8 usFlashLightRange; - - // Flugente: determine wether the AI should pick this item for its choices only at certain times - UINT8 usItemChoiceTimeSetting; - - // Flugente: item is connected to another item. Type of connection depends on item specifics - UINT16 usBuddyItem; - - // silversurfer: item provides breath regeneration bonus while resting - UINT8 ubSleepModifier; - - // Flugente: spotting effectiveness - INT16 usSpotting; - - //JMich.BackpackClimb - INT16 sBackpackWeightModifier; //modifier to weight calculation to climb. - BOOLEAN fAllowClimbing; //does item allow climbing while wearing it - - BOOLEAN cigarette; // Flugente: this item can be smoked - UINT8 usPortionSize; // Flugente: for consumables: how much of this item is consumed at once - - // Flugente: riot shields - UINT16 usRiotShieldStrength; // strength of shield - UINT16 usRiotShieldGraphic; // graphic of shield (when deployed in tactical, taken from Tilecache/riotshield.sti) - - // Flugente: fire resistance - INT16 sFireResistance; - - // Flugente: a modifier for administration effectiveness - UINT8 usAdministrationModifier; - - // rftr: robot attachments - FLOAT fRobotDamageReductionModifier; - INT8 bRobotStrBonus; - INT8 bRobotAgiBonus; - INT8 bRobotDexBonus; - INT8 bRobotTargetingSkillGrant; - INT8 bRobotChassisSkillGrant; - INT8 bRobotUtilitySkillGrant; - BOOLEAN fProvidesRobotCamo; - BOOLEAN fProvidesRobotNightVision; - BOOLEAN fProvidesRobotLaserBonus; - - // kitty: item exclusively available with disease feature - BOOLEAN DiseaseSystemExclusive; - - // rftr: the progress bounds that allow a transport group to drop an item - INT8 iTransportGroupMinProgress; - INT8 iTransportGroupMaxProgress; + INT16 usSpotting; // Flugente: spotting effectiveness + INT16 sBackpackWeightModifier; // JMich: BackpackClimb modifier to weight calculation to climb. + INT16 sFireResistance; + + UINT8 ubAttachToPointAPCost; // cost to attach to any matching point + UINT8 ubCursor; + UINT8 ubGraphicType; + UINT8 ubPerPocket; + UINT8 ubCoolness; + UINT8 percenttunnelvision; + UINT8 ubAttachmentSystem; //Item availability per attachment system: 0 = both, 1 = OAS, 2 = NAS + UINT8 CrowbarModifier; + UINT8 DisarmModifier; + UINT8 usHackingModifier; + UINT8 usBurialModifier; // Flugente: a modifier for burial effectiveness + UINT8 usDamageChance; // Flugente: advanced repair/dirt system. Chance that damage to the status will also damage the repair threshold + UINT8 usFlashLightRange; // Flugente: range of a flashlight (an item with usFlashLightRange > 0 is deemed a flashlight) + UINT8 usItemChoiceTimeSetting; // Flugente: determine wether the AI should pick this item for its choices only at certain times + UINT8 ubSleepModifier; // silversurfer: item provides breath regeneration bonus while resting + UINT8 usPortionSize; // Flugente: for consumables: how much of this item is consumed at once + UINT8 usAdministrationModifier; // Flugente: a modifier for administration effectiveness + UINT8 inseparable; //Madd:Normally, an inseparable attachment can never be removed. + //But now we will make it so that these items can be replaced, but still not removed directly. + //0 = removeable (as before) + //1 = inseparable (as before) + //2 = inseparable, but replaceable + + INT8 bSoundType; + INT8 bReliability; + INT8 bRepairEase; + INT8 LockPickModifier; + INT8 RepairModifier; + INT8 randomitemcoolnessmodificator; // Flugente: a link to RandomItemsClass.xml. alters the allowed maximum coolness a random item can have + INT8 bRobotStrBonus; // rftr: robot attachments + INT8 bRobotAgiBonus; // rftr: robot attachments + INT8 bRobotDexBonus; // rftr: robot attachments + INT8 bRobotTargetingSkillGrant; // rftr: robot attachments + INT8 bRobotChassisSkillGrant; // rftr: robot attachments + INT8 bRobotUtilitySkillGrant; // rftr: robot attachments + INT8 iTransportGroupMinProgress; // rftr: the progress bounds that allow a transport group to drop an item + INT8 iTransportGroupMaxProgress; // rftr: the progress bounds that allow a transport group to drop an item } INVTYPE; diff --git a/Tactical/Items.cpp b/Tactical/Items.cpp index 6e154a04c..10ac46522 100644 --- a/Tactical/Items.cpp +++ b/Tactical/Items.cpp @@ -1281,7 +1281,7 @@ BOOLEAN ItemIsLegal( UINT16 usItemIndex, BOOLEAN fIgnoreCoolness ) // kitty: no disease items if the disease system is off // whether the item is exclusive is defined by tag - if (!gGameExternalOptions.fDisease && Item[usItemIndex].DiseaseSystemExclusive) + if (!gGameExternalOptions.fDisease && ItemIsOnlyInDisease(usItemIndex)) { return FALSE; } @@ -1293,14 +1293,14 @@ BOOLEAN ItemIsLegal( UINT16 usItemIndex, BOOLEAN fIgnoreCoolness ) //if( (Item[ usItemIndex ].usItemClass == IC_GUN) || (Item[ usItemIndex ].usItemClass == IC_AMMO )) //Madd: restriction removed { // and the item is only available with the extended guns - if( Item[usItemIndex].biggunlist ) + if(ItemIsOnlyInTonsOfGuns(usItemIndex)) { return(FALSE); } } } - if ( gGameOptions.ubGameStyle != STYLE_SCIFI && Item[usItemIndex].scifi ) + if ( gGameOptions.ubGameStyle != STYLE_SCIFI && ItemIsOnlyInScifi(usItemIndex) ) { return FALSE; } @@ -1313,7 +1313,7 @@ BOOLEAN ItemIsLegal( UINT16 usItemIndex, BOOLEAN fIgnoreCoolness ) } else { - if(Item[usItemIndex].usItemClass == IC_LBEGEAR || Item[usItemIndex].newinv) + if(Item[usItemIndex].usItemClass == IC_LBEGEAR || ItemIsOnlyInNIV(usItemIndex)) return FALSE; } @@ -1325,18 +1325,11 @@ BOOLEAN ItemIsLegal( UINT16 usItemIndex, BOOLEAN fIgnoreCoolness ) return(TRUE); } -// also used for ammo -BOOLEAN ExtendedGunListGun( UINT16 usGun ) -{ -// return( (Item[ usGun ].fFlags & ITEM_BIGGUNLIST) != 0 ); - return( (Item[ usGun ].biggunlist ) != 0 ); -} - UINT16 StandardGunListReplacement( UINT16 usGun ) { UINT8 ubLoop; - if ( ExtendedGunListGun( usGun ) ) + if (ItemIsOnlyInTonsOfGuns( usGun ) ) { ubLoop = 0; while ( ReplacementGuns[ ubLoop ][ 0 ] != 0 ) @@ -1386,7 +1379,7 @@ BOOLEAN WeaponInHand( SOLDIERTYPE * pSoldier ) { if ( Item[pSoldier->inv[HANDPOS].usItem].usItemClass & (IC_WEAPON | IC_THROWN) && pSoldier->inv[HANDPOS].exists() == true) { - if (Item[pSoldier->inv[HANDPOS].usItem].fingerprintid ) + if (ItemHasFingerPrintID(pSoldier->inv[HANDPOS].usItem)) { if (pSoldier->inv[HANDPOS][0]->data.ubImprintID != NO_PROFILE) { @@ -1637,18 +1630,18 @@ INT8 FindBestWeaponIfCurrentIsOutOfRange(SOLDIERTYPE * pSoldier, INT8 bCurrentWe INT8 FindMetalDetectorInHand( SOLDIERTYPE * pSoldier ) { - if ( (&(pSoldier->inv[HANDPOS] ))->exists() && Item[pSoldier->inv[HANDPOS].usItem].metaldetector ) + if ( (&(pSoldier->inv[HANDPOS] ))->exists() && ItemIsMetalDetector(pSoldier->inv[HANDPOS].usItem)) { return( HANDPOS ); } - if ( (&(pSoldier->inv[SECONDHANDPOS] ))->exists() && Item[pSoldier->inv[SECONDHANDPOS].usItem].metaldetector ) + if ( (&(pSoldier->inv[SECONDHANDPOS] ))->exists() && ItemIsMetalDetector(pSoldier->inv[SECONDHANDPOS].usItem)) { return( SECONDHANDPOS ); } // rftr: a metal detector can be installed into the robot - if ( pSoldier && AM_A_ROBOT(pSoldier) && (&(pSoldier->inv[ROBOT_UTILITY_SLOT]))->exists() && Item[pSoldier->inv[ROBOT_UTILITY_SLOT].usItem].metaldetector ) + if ( pSoldier && AM_A_ROBOT(pSoldier) && (&(pSoldier->inv[ROBOT_UTILITY_SLOT]))->exists() && ItemIsMetalDetector(pSoldier->inv[ROBOT_UTILITY_SLOT].usItem)) { return( ROBOT_UTILITY_SLOT ); } @@ -1661,7 +1654,7 @@ INT8 FindLockBomb( SOLDIERTYPE * pSoldier ) INT8 invsize = (INT8)pSoldier->inv.size(); for (INT8 bLoop = 0; bLoop < invsize; ++bLoop) { - if (Item[pSoldier->inv[bLoop].usItem].lockbomb && pSoldier->inv[bLoop].exists() == true) + if (ItemIsLockBomb(pSoldier->inv[bLoop].usItem) && pSoldier->inv[bLoop].exists() == true) { return( bLoop ); } @@ -1842,7 +1835,7 @@ INT8 FindEmptySlotWithin( SOLDIERTYPE * pSoldier, INT8 bLower, INT8 bUpper ) continue; if (pSoldier->inv[bLoop].exists() == false) { - if (bLoop == SECONDHANDPOS && Item[pSoldier->inv[HANDPOS].usItem].twohanded ) + if (bLoop == SECONDHANDPOS && ItemIsTwoHanded(pSoldier->inv[HANDPOS].usItem) ) { continue; } @@ -1858,7 +1851,7 @@ INT8 FindEmptySlotWithin( SOLDIERTYPE * pSoldier, INT8 bLower, INT8 bUpper ) BOOLEAN GLGrenadeInSlot(SOLDIERTYPE *pSoldier, INT8 bSlot ) { if (pSoldier->inv[bSlot].exists() == true) { - if (Item[pSoldier->inv[bSlot].usItem].glgrenade) + if (ItemIsGLgrenade(pSoldier->inv[bSlot].usItem)) return TRUE; } //switch (pSoldier->inv[bSlot].usItem) @@ -1922,12 +1915,12 @@ INT8 FindThrowableGrenade(SOLDIERTYPE * pSoldier, UINT8 ubGrenadeType, UINT8 ubM if ((Item[usItem].usItemClass & IC_GRENADE) && Item[usItem].ubCursor == TOSSCURS && GetLauncherFromLaunchable(usItem) == NOTHING && - (!Item[usItem].flare || NightLight()) && + (!ItemIsFlare(usItem) || NightLight()) && ubDamage >= ubMinDamage && (ubGrenadeType == EXPLOSV_ANY_TYPE || ubType == ubGrenadeType)) { // return if flare grenade has priority - if (fCheckForFlares && Item[usItem].flare) + if (fCheckForFlares && ItemIsFlare(usItem)) { return bLoop; } @@ -2175,7 +2168,7 @@ BOOLEAN ItemHasAttachments( OBJECTTYPE * pObj, SOLDIERTYPE * pSoldier, UINT8 ite { for(attachmentList::iterator att = (*pObj)[iter]->attachments.begin(); att != (*pObj)[iter]->attachments.end(); ++att) { - if ( att->usItem != 0 && !Item[att->usItem].hiddenattachment ) + if ( att->usItem != 0 && !ItemIsHiddenAttachment(att->usItem) ) { attachmentHidden = FALSE; break; @@ -2191,7 +2184,7 @@ BOOLEAN ItemHasAttachments( OBJECTTYPE * pObj, SOLDIERTYPE * pSoldier, UINT8 ite { for(attachmentList::iterator att = (*pObj)[iter]->attachments.begin(); att != (*pObj)[iter]->attachments.end(); ++att) { - if ( att->usItem != 0 && !Item[att->usItem].hiddenattachment ) + if ( att->usItem != 0 && !ItemIsHiddenAttachment(att->usItem) ) { attachmentHidden = FALSE; break; @@ -2260,7 +2253,7 @@ BOOLEAN ValidAttachment( UINT16 usAttachment, UINT16 usItem, UINT8 * pubAPCost ) } //Madd: all guns can be attached to tripwires - if ( Item[usItem].tripwire && Item[usAttachment].usItemClass & IC_GUN ) + if (ItemIsTripwire(usItem) && Item[usAttachment].usItemClass & IC_GUN ) return TRUE; //Madd: Common Attachment Framework @@ -2298,8 +2291,8 @@ BOOLEAN ValidAttachment( UINT16 usAttachment, OBJECTTYPE * pObj, UINT8 * pubAPCo return FALSE; // shadooow: efficiency check, we are passing all kinds of items into this function that are not necessary attachments at all - if (!Item[usAttachment].attachment && !Item[usAttachment].attachmentclass && !Item[usAttachment].nasAttachmentClass && - !Item[usAttachment].hiddenaddon && !((Item[usAttachment].usItemClass & IC_GUN) && Item[pObj->usItem].tripwire)) + if (!ItemIsAttachment(usAttachment) && !Item[usAttachment].attachmentclass && !Item[usAttachment].nasAttachmentClass && + !ItemIsHiddenAddon(usAttachment) && !((Item[usAttachment].usItemClass & IC_GUN) && ItemIsTripwire(pObj->usItem))) return FALSE; if( UsingNewAttachmentSystem() ) @@ -2451,7 +2444,7 @@ BOOLEAN ValidItemAttachmentSlot( OBJECTTYPE * pObj, UINT16 usAttachment, BOOLEAN { //Search for incompatible attachments //Madd: check for gun on tripwire first - if ( Item[pObj->usItem].tripwire && Item[usAttachment].usItemClass & IC_GUN && FindAttachmentByClass( pObj, IC_GUN, subObject ) != 0 ) + if (ItemIsTripwire(pObj->usItem) && Item[usAttachment].usItemClass & IC_GUN && FindAttachmentByClass( pObj, IC_GUN, subObject ) != 0 ) { fSimilarItems = TRUE; OBJECTTYPE * tmpObj = FindAttachmentByClass( pObj, IC_GUN, subObject ); @@ -2517,7 +2510,7 @@ BOOLEAN ValidItemAttachmentSlot( OBJECTTYPE * pObj, UINT16 usAttachment, BOOLEAN //Search for any valid attachments in this slot //CHRISL: Valid attachments are determined by the old "ValidItemAttachment" function and comparing the attachment class of the item and slot //Madd: gun on tripwire always allowed - if((AttachmentSlots[ubSlotIndex].nasAttachmentClass & Item[usAttachment].nasAttachmentClass || (Item[usAttachment].usItemClass & IC_GUN && Item[pObj->usItem].tripwire)) && + if((AttachmentSlots[ubSlotIndex].nasAttachmentClass & Item[usAttachment].nasAttachmentClass || (Item[usAttachment].usItemClass & IC_GUN && ItemIsTripwire(pObj->usItem))) && (ValidItemAttachment(pObj,usAttachment,fAttemptingAttachment,fDisplayMessage,subObject,usAttachmentSlotIndexVector) || ValidLaunchable(usAttachment, GetAttachedGrenadeLauncher(pObj)) || ValidLaunchable(usAttachment, pObj->usItem))) @@ -2553,7 +2546,7 @@ BOOLEAN ValidItemAttachmentSlot( OBJECTTYPE * pObj, UINT16 usAttachment, BOOLEAN //Search for any valid attachments in this slot //CHRISL: Valid attachments are determined by the old "ValidItemAttachment" function and comparing the attachment class of the item and slot //Madd: gun on tripwire always allowed - if((AttachmentSlots[ubSlotIndex].nasAttachmentClass & Item[usAttachment].nasAttachmentClass || (Item[usAttachment].usItemClass & IC_GUN && Item[pObj->usItem].tripwire)) && + if((AttachmentSlots[ubSlotIndex].nasAttachmentClass & Item[usAttachment].nasAttachmentClass || (Item[usAttachment].usItemClass & IC_GUN && ItemIsTripwire(pObj->usItem))) && (ValidItemAttachment(pObj,usAttachment,FALSE,FALSE,subObject,usAttachmentSlotIndexVector) || ValidLaunchable(usAttachment, GetAttachedGrenadeLauncher(pObj)) || ValidLaunchable(usAttachment, pObj->usItem))) @@ -2620,7 +2613,7 @@ BOOLEAN ValidItemAttachment( OBJECTTYPE * pObj, UINT16 usAttachment, BOOLEAN fAt UINT16 usSimilarItem = NOTHING; //Madd: check for gun on tripwire first - if ( Item[pObj->usItem].tripwire && Item[usAttachment].usItemClass & IC_GUN && FindAttachmentByClass( pObj, IC_GUN, subObject ) != 0 ) + if (ItemIsTripwire(pObj->usItem) && Item[usAttachment].usItemClass & IC_GUN && FindAttachmentByClass( pObj, IC_GUN, subObject ) != 0 ) { fSimilarItems = TRUE; OBJECTTYPE * tmpObj = FindAttachmentByClass( pObj, IC_GUN, subObject ); @@ -2717,17 +2710,6 @@ BOOLEAN CompatibleFaceItem( UINT16 usItem1, UINT16 usItem2 ) } -//Determines if this item is a two handed item. -BOOLEAN TwoHandedItem( UINT16 usItem ) -{ -// if (Item[usItem].fFlags & ITEM_TWO_HANDED) - if (Item[usItem].twohanded ) - { - return( TRUE ); - } - return FALSE; -} - BOOLEAN ValidLaunchable( UINT16 usLaunchable, UINT16 usItem ) { // shadooow: efficiency check, we are passing all kinds of items into this function that are not neccessary attachments at all @@ -3149,7 +3131,7 @@ UINT16 OBJECTTYPE::GetWeightOfObjectInStack(unsigned int index) weight += Item[ (*this)[index]->data.gun.usGunAmmoItem ].ubWeight; } } - else if ( gGameExternalOptions.fAmmoDynamicWeight && ( pItem->camouflagekit || pItem->canteen || pItem->drugtype || pItem->foodtype || usItem == JAR_ELIXIR ) ) + else if ( gGameExternalOptions.fAmmoDynamicWeight && (ItemIsCamoKit(pItem->uiIndex) || ItemIsCanteen(pItem->uiIndex) || pItem->drugtype || pItem->foodtype || usItem == JAR_ELIXIR ) ) { weight *= (FLOAT)( ( *this )[index] )->data.objectStatus / 100.0f; } @@ -3407,7 +3389,7 @@ BOOLEAN ReloadGun( SOLDIERTYPE * pSoldier, OBJECTTYPE * pGun, OBJECTTYPE * pAmmo } } - if ( Item[ pGun->usItem ].usItemClass == IC_LAUNCHER || Item[pGun->usItem].cannon ) + if ( Item[ pGun->usItem ].usItemClass == IC_LAUNCHER || ItemIsCannon(pGun->usItem)) { DebugMsg( TOPIC_JA2, DBG_LEVEL_3, String("ReloadGun: Loading launcher - new ammo type = %d, weight = %d", pAmmo->usItem, CalculateObjectWeight(pAmmo) ) ); (*pGun)[subObject]->data.gun.usGunAmmoItem = pAmmo->usItem; @@ -3838,7 +3820,7 @@ INT8 FindAmmoToReload( SOLDIERTYPE * pSoldier, INT8 bWeaponIn, INT8 bExcludeSlot return bWeaponIn; // } - if ( Item[pObj->usItem].usItemClass == IC_GUN && !Item[pObj->usItem].cannon ) + if ( Item[pObj->usItem].usItemClass == IC_GUN && !ItemIsCannon(pObj->usItem) ) { //MM: make reload use crates/boxes if not in combat... if ( (gTacticalStatus.uiFlags & TURNBASED) && (gTacticalStatus.uiFlags & INCOMBAT) ) @@ -4149,7 +4131,7 @@ BOOLEAN OBJECTTYPE::AttachObjectOAS( SOLDIERTYPE * pSoldier, OBJECTTYPE * pAttac return FALSE; } //CHRISL: If we're adding a loaded UGL, then we have to make sure there are actually 2 open attachment slots instead of 1 - if(Item[pAttachment->usItem].grenadelauncher && (*pAttachment)[0]->attachments.size() > 0) { + if(ItemIsGrenadeLauncher(pAttachment->usItem) && (*pAttachment)[0]->attachments.size() > 0) { if ((*this)[subObject]->attachments.size() >= (OLD_MAX_ATTACHMENTS_101-1)) return FALSE; } @@ -4181,7 +4163,7 @@ BOOLEAN OBJECTTYPE::AttachObjectOAS( SOLDIERTYPE * pSoldier, OBJECTTYPE * pAttac // find an attachment position... // second half of this 'if' is for attaching GL grenades to a gun w/attached GL - if ( fValidLaunchable || (Item[pAttachment->usItem].glgrenade && FindAttachmentByClass(this, IC_LAUNCHER, subObject) != 0 ) ) + if ( fValidLaunchable || (ItemIsGLgrenade(pAttachment->usItem) && FindAttachmentByClass(this, IC_LAUNCHER, subObject) != 0 ) ) { canOnlyAttach1 = true; // try replacing if possible @@ -4216,7 +4198,7 @@ BOOLEAN OBJECTTYPE::AttachObjectOAS( SOLDIERTYPE * pSoldier, OBJECTTYPE * pAttac return( FALSE ); } } - else if ( Item[this->usItem].tripwire && Item[pAttachment->usItem].usItemClass & IC_GUN ) // Madd: gun on tripwire + else if (ItemIsTripwire(this->usItem) && Item[pAttachment->usItem].usItemClass & IC_GUN ) // Madd: gun on tripwire { iCheckResult = SkillCheck( pSoldier, ATTACHING_DETONATOR_CHECK, 0 ); if (iCheckResult < 0) @@ -4238,7 +4220,7 @@ BOOLEAN OBJECTTYPE::AttachObjectOAS( SOLDIERTYPE * pSoldier, OBJECTTYPE * pAttac if ( ValidItemAttachment( this, pAttachment->usItem, TRUE, TRUE, subObject ) && playSound ) // not launchable { // attachment sounds - if ( Item[ this->usItem ].usItemClass & IC_WEAPON || Item[this->usItem].tripwire ) //Madd: attaching items to tripwire makes gun attach sound + if ( Item[ this->usItem ].usItemClass & IC_WEAPON || ItemIsTripwire(this->usItem) ) //Madd: attaching items to tripwire makes gun attach sound { PlayJA2Sample( ATTACH_TO_GUN, RATE_11025, SoundVolume( MIDVOLUME, pSoldier->sGridNo ), 1, SoundDir( pSoldier->sGridNo ) ); } @@ -4272,7 +4254,7 @@ BOOLEAN OBJECTTYPE::AttachObjectOAS( SOLDIERTYPE * pSoldier, OBJECTTYPE * pAttac //if (pAttachmentPosition) { if(pAttachmentPosition || (pAttachmentPosition == NULL && (*this)[subObject]->attachments.size() < OLD_MAX_ATTACHMENTS_101)){ //we know we are replacing this attachment - if ( Item[ this->usItem ].usItemClass == IC_LAUNCHER || Item[this->usItem].cannon ) + if ( Item[ this->usItem ].usItemClass == IC_LAUNCHER || ItemIsCannon(this->usItem) ) { if ( fValidLaunchable ) { @@ -4283,7 +4265,7 @@ BOOLEAN OBJECTTYPE::AttachObjectOAS( SOLDIERTYPE * pSoldier, OBJECTTYPE * pAttac } //unfortunately must come before possible attachment swap - if (Item[pAttachment->usItem].grenadelauncher ) + if (ItemIsGrenadeLauncher(pAttachment->usItem)) { // transfer any attachments from the grenade launcher to the gun (*this)[subObject]->attachments.splice((*this)[subObject]->attachments.begin(), (*pAttachment)[0]->attachments, @@ -4847,7 +4829,7 @@ BOOLEAN OBJECTTYPE::AttachObjectNAS( SOLDIERTYPE * pSoldier, OBJECTTYPE * pAttac return( FALSE ); } } - else if ( Item[this->usItem].tripwire && Item[pAttachment->usItem].usItemClass & IC_GUN ) // Madd: gun on tripwire + else if (ItemIsTripwire(this->usItem) && Item[pAttachment->usItem].usItemClass & IC_GUN ) // Madd: gun on tripwire { iCheckResult = SkillCheck( pSoldier, ATTACHING_DETONATOR_CHECK, 0 ); if (iCheckResult < 0) @@ -4869,7 +4851,7 @@ BOOLEAN OBJECTTYPE::AttachObjectNAS( SOLDIERTYPE * pSoldier, OBJECTTYPE * pAttac if (fValidItemAttachment && playSound ) // not launchable { // attachment sounds - if ( Item[ this->usItem ].usItemClass & IC_WEAPON || Item[this->usItem].tripwire ) //Madd: attaching items to tripwire makes gun attach sound + if ( Item[ this->usItem ].usItemClass & IC_WEAPON || ItemIsTripwire(this->usItem) ) //Madd: attaching items to tripwire makes gun attach sound { PlayJA2Sample( ATTACH_TO_GUN, RATE_11025, SoundVolume( MIDVOLUME, pSoldier->sGridNo ), 1, SoundDir( pSoldier->sGridNo ) ); } @@ -4903,7 +4885,7 @@ BOOLEAN OBJECTTYPE::AttachObjectNAS( SOLDIERTYPE * pSoldier, OBJECTTYPE * pAttac // the AP costs for reloading GL/RL will be taken from weapons.xml ( wrong place!!! the AP's are deducted in DeleteItemDescriptionBox() ) //we know we are replacing this attachment - if ( Item[ this->usItem ].usItemClass == IC_LAUNCHER || Item[this->usItem].cannon ) + if ( Item[ this->usItem ].usItemClass == IC_LAUNCHER || ItemIsCannon(this->usItem) ) { if ( fValidLaunchable ) { @@ -5404,7 +5386,7 @@ BOOLEAN OBJECTTYPE::AttachObjectNAS( SOLDIERTYPE * pSoldier, OBJECTTYPE * pAttac case TEMPERATURE: { // check if this can work - if ( Item[ this->usItem ].usItemClass == IC_GUN && Item[pAttachment->usItem].barrel == TRUE ) + if ( Item[ this->usItem ].usItemClass == IC_GUN && ItemIsBarrel(pAttachment->usItem) ) { FLOAT guntemperature = (*this)[subObject]->data.bTemperature; FLOAT barreltemperature = (*pAttachment)[0]->data.bTemperature; @@ -5425,7 +5407,7 @@ BOOLEAN OBJECTTYPE::AttachObjectNAS( SOLDIERTYPE * pSoldier, OBJECTTYPE * pAttac case TRIPWIRE_ROLL: { // check if this can work - if ( Item[ this->usItem ].tripwire && Item[pAttachment->usItem].tripwire && HasItemFlag( this->usItem, TRIPWIREROLL ) ) + if (ItemIsTripwire(this->usItem) && ItemIsTripwire(pAttachment->usItem) && HasItemFlag( this->usItem, TRIPWIREROLL ) ) { if ( (*this)[subObject]->data.objectStatus < 100 ) (*this)[subObject]->data.objectStatus++; @@ -5722,7 +5704,7 @@ std::vector GetItemSlots(OBJECTTYPE* pObj, UINT8 subObject, BOOLEAN fAtt { fItemLayout = Item[pObj->usItem].nasLayoutClass; fIsLBE = (Item[pObj->usItem].usItemClass == IC_LBEGEAR); - if ( Item[pObj->usItem].grenadelauncher || Item[pObj->usItem].rocketlauncher ) + if (ItemIsGrenadeLauncher(pObj->usItem) || ItemIsRocketLauncher(pObj->usItem) ) magSize = GetMagSize( pObj ); //We don't need to do anything if the item gets no slots @@ -5787,7 +5769,7 @@ std::vector GetItemSlots(OBJECTTYPE* pObj, UINT8 subObject, BOOLEAN fAtt //Madd: Only record these extra slots if the item has its attachment flag set! for(attachmentList::iterator iter = (*pObj)[subObject]->attachments.begin(); iter != (*pObj)[subObject]->attachments.end(); ++iter) { - if(iter->exists() && Item[iter->usItem].attachment && !(*iter)[0]->attachments.empty() ) + if(iter->exists() && ItemIsAttachment(iter->usItem) && !(*iter)[0]->attachments.empty() ) { OBJECTTYPE* pAttachment = &(*iter); tempSlots = GetItemSlots(pAttachment,0,TRUE); @@ -6246,10 +6228,10 @@ BOOLEAN CanItemFitInRobot(SOLDIERTYPE* pSoldier, OBJECTTYPE* pObj, INT8 bPos, BO (Magazine[Item[pObj->usItem].ubClassIndex].ubCalibre == Weapon[pSoldier->inv[HANDPOS].usItem].ubCalibre); case ROBOT_TARGETING_SLOT: - if (Item[pObj->usItem].fProvidesRobotLaserBonus) + if (ItemProvidesRobotLaserBonus(pObj->usItem)) return(TRUE); - if (Item[pObj->usItem].fProvidesRobotNightVision) + if (ItemProvidesRobotNightvision(pObj->usItem)) return(TRUE); if (Item[pObj->usItem].bRobotTargetingSkillGrant > 0) @@ -6261,7 +6243,7 @@ BOOLEAN CanItemFitInRobot(SOLDIERTYPE* pSoldier, OBJECTTYPE* pObj, INT8 bPos, BO if (Item[pObj->usItem].bRobotStrBonus > 0 || Item[pObj->usItem].bRobotAgiBonus > 0 || Item[pObj->usItem].bRobotDexBonus > 0) return(TRUE); - if (Item[pObj->usItem].fProvidesRobotCamo) + if (ItemProvidesRobotCamo(pObj->usItem)) return(TRUE); if (Item[pObj->usItem].fRobotDamageReductionModifier > 0.0f && Item[pObj->usItem].fRobotDamageReductionModifier < 1.0f) @@ -6279,10 +6261,10 @@ BOOLEAN CanItemFitInRobot(SOLDIERTYPE* pSoldier, OBJECTTYPE* pObj, INT8 bPos, BO if (HasItemFlag( pObj->usItem, RADIO_SET )) return(TRUE); - if (Item[pObj->usItem].metaldetector == 1) + if (ItemIsMetalDetector(pObj->usItem)) return(TRUE); - if (Item[pObj->usItem].xray == 1) + if (ItemHasXRay(pObj->usItem)) return(TRUE); if (Item[pObj->usItem].bRobotUtilitySkillGrant > 0) @@ -6326,13 +6308,13 @@ BOOLEAN CanItemFitInPosition( SOLDIERTYPE *pSoldier, OBJECTTYPE *pObj, INT8 bPos && pSoldier->HasDiseaseWithFlag( DISEASE_PROPERTY_LIMITED_USE_ARMS ) ) return FALSE; - if (Item[pSoldier->inv[HANDPOS].usItem].twohanded ) + if (ItemIsTwoHanded(pSoldier->inv[HANDPOS].usItem)) { return( FALSE ); } break; case HANDPOS: - if (Item[ pObj->usItem ].twohanded ) + if (ItemIsTwoHanded(pObj->usItem)) { // Flugente: disease can stop us from using our arms normally if ( gGameExternalOptions.fDisease @@ -6669,7 +6651,7 @@ BOOLEAN PlaceObject( SOLDIERTYPE * pSoldier, INT8 bPos, OBJECTTYPE * pObj ) OBJECTTYPE * pInSlot; BOOLEAN fObjectWasRobotRemote = FALSE; - if ( Item[pObj->usItem].robotremotecontrol ) + if (ItemIsRobotRemote(pObj->usItem)) { fObjectWasRobotRemote = TRUE; } @@ -6799,7 +6781,7 @@ BOOLEAN PlaceObject( SOLDIERTYPE * pSoldier, INT8 bPos, OBJECTTYPE * pObj ) pSoldier->bDoBurst = TRUE; pSoldier->bDoAutofire = TRUE; } - if ( Item[pObj->usItem].twohanded && Weapon[pObj->usItem].HeavyGun && gGameExternalOptions.ubAllowAlternativeWeaponHolding == 3 ) + if (ItemIsTwoHanded(pObj->usItem) && Weapon[pObj->usItem].HeavyGun && gGameExternalOptions.ubAllowAlternativeWeaponHolding == 3 ) pSoldier->bScopeMode = USE_ALT_WEAPON_HOLD; else pSoldier->bScopeMode = USE_BEST_SCOPE; @@ -6820,7 +6802,7 @@ BOOLEAN PlaceObject( SOLDIERTYPE * pSoldier, INT8 bPos, OBJECTTYPE * pObj ) if (pObj->exists() == false) { // dropped everything - if (bPos == HANDPOS && Item[pInSlot->usItem].twohanded ) + if (bPos == HANDPOS && ItemIsTwoHanded(pInSlot->usItem)) { // We just performed a successful drop of a two-handed object into the // main hand @@ -7016,7 +6998,7 @@ BOOLEAN PlaceObject( SOLDIERTYPE * pSoldier, INT8 bPos, OBJECTTYPE * pObj ) pInSlot->AddObjectsToStack( *pObj, ALL_OBJECTS, pSoldier, bPos ); } - else if ( (Item[pObj->usItem].twohanded ) && (bPos == HANDPOS) ) + else if (ItemIsTwoHanded(pObj->usItem) && (bPos == HANDPOS) ) { if (pSoldier->inv[SECONDHANDPOS].exists() == true) { // both pockets have something in them, so we can't swap @@ -7110,7 +7092,7 @@ bool TryToPlaceInSlot(SOLDIERTYPE* pSoldier, OBJECTTYPE* pObj, bool fNewItem, in } if (bSlot == SECONDHANDPOS) { - if (pSoldier->inv[HANDPOS].exists() == true && Item[pSoldier->inv[ HANDPOS ].usItem].twohanded) { + if (pSoldier->inv[HANDPOS].exists() == true && ItemIsTwoHanded(pSoldier->inv[ HANDPOS ].usItem)) { return false; } } @@ -7447,7 +7429,7 @@ BOOLEAN AutoPlaceObject( SOLDIERTYPE * pSoldier, OBJECTTYPE * pObj, BOOLEAN fNew return( TRUE ); } } - else if ( !(Item[pSoldier->inv[HANDPOS].usItem].twohanded ) && pSoldier->inv[SECONDHANDPOS].exists() == false) + else if ( !ItemIsTwoHanded(pSoldier->inv[HANDPOS].usItem) && pSoldier->inv[SECONDHANDPOS].exists() == false) { // put the one-handed weapon in the guy's 2nd hand... if( PlaceObject( pSoldier, SECONDHANDPOS, pObj, fNewItem ) ) @@ -7507,7 +7489,7 @@ BOOLEAN AutoPlaceObject( SOLDIERTYPE * pSoldier, OBJECTTYPE * pObj, BOOLEAN fNew This is only an issue during merc hiring when leggings will often be placed after leg protectors. However, this isn't as big an issue at this point because of the redesigns in the profile item sorting functions.*/ - if(Item[pSoldier->inv[LEGPOS].usItem].attachment) + if(ItemIsAttachment(pSoldier->inv[LEGPOS].usItem)) { SwapObjs(pSoldier, LEGPOS, pObj, TRUE); pSoldier->inv[LEGPOS].AttachObject(pSoldier, pObj, FALSE); @@ -7832,17 +7814,17 @@ UINT16 UseKitPoints( OBJECTTYPE * pObj, UINT16 usPoints, SOLDIERTYPE *pSoldier ) (*pObj)[bLoop]->data.objectStatus -= (INT8)(usPoints * (max( 0, (100 - Item[pObj->usItem].percentstatusdrainreduction) ) )/100); // Flugente: campaign stats - if ( Item[pObj->usItem].foodtype || Item[pObj->usItem].canteen) + if ( Item[pObj->usItem].foodtype || ItemIsCanteen(pObj->usItem)) gCampaignStats.AddConsumption(CAMPAIGN_CONSUMED_FOOD, (FLOAT)(usOriginalPoints * Item[pObj->usItem].ubWeight / 100.0) ); - else if ( Item[pObj->usItem].medical || Item[pObj->usItem].drugtype) + else if (ItemIsMedical(pObj->usItem) || Item[pObj->usItem].drugtype) gCampaignStats.AddConsumption(CAMPAIGN_CONSUMED_MEDICAL, (FLOAT)(usOriginalPoints * Item[pObj->usItem].ubWeight / 100.0) ); - else if ( Item[pObj->usItem].toolkit || HasItemFlag(pObj->usItem, CLEANING_KIT) ) + else if (ItemIsToolkit(pObj->usItem) || HasItemFlag(pObj->usItem, CLEANING_KIT) ) gCampaignStats.AddConsumption(CAMPAIGN_CONSUMED_REPAIR, (FLOAT)(usOriginalPoints * Item[pObj->usItem].ubWeight / 100.0) ); return( usOriginalPoints ); } // Flugente: we no longer destroy canteens upon emtptying them - as we can now refill them - else if ( Item[pObj->usItem].canteen == TRUE ) + else if (ItemIsCanteen(pObj->usItem) == TRUE ) { // consume this kit totally usPoints -= (((*pObj)[bLoop]->data.objectStatus - 1) / ((max( 0, (100 - Item[pObj->usItem].percentstatusdrainreduction))) /100)); @@ -7879,11 +7861,11 @@ UINT16 UseKitPoints( OBJECTTYPE * pObj, UINT16 usPoints, SOLDIERTYPE *pSoldier ) } // Flugente: campaign stats - if ( Item[pObj->usItem].foodtype || Item[pObj->usItem].canteen) + if ( Item[pObj->usItem].foodtype || ItemIsCanteen(pObj->usItem)) gCampaignStats.AddConsumption(CAMPAIGN_CONSUMED_FOOD, (FLOAT)((usOriginalPoints - usPoints) * Item[pObj->usItem].ubWeight / 100.0) ); - else if ( Item[pObj->usItem].medical || Item[pObj->usItem].drugtype) + else if (ItemIsMedical(pObj->usItem) || Item[pObj->usItem].drugtype) gCampaignStats.AddConsumption(CAMPAIGN_CONSUMED_MEDICAL, (FLOAT)((usOriginalPoints - usPoints) * Item[pObj->usItem].ubWeight / 100.0) ); - else if ( Item[pObj->usItem].toolkit || HasItemFlag(pObj->usItem, CLEANING_KIT) ) + else if (ItemIsToolkit(pObj->usItem) || HasItemFlag(pObj->usItem, CLEANING_KIT) ) gCampaignStats.AddConsumption(CAMPAIGN_CONSUMED_REPAIR, (FLOAT)((usOriginalPoints - usPoints) * Item[pObj->usItem].ubWeight / 100.0) ); // check if pocket/hand emptied..update inventory, then update panel @@ -8245,7 +8227,7 @@ BOOLEAN CreateGun( UINT16 usItem, INT16 bStatus, OBJECTTYPE * pObj ) } else if ( EXPLOSIVE_GUN( usItem ) ) { - if ( Item[usItem].singleshotrocketlauncher ) + if (ItemIsSingleShotRocketLauncher(usItem)) { pStackedObject->data.gun.ubGunShotsLeft = 1; } @@ -8392,8 +8374,7 @@ BOOLEAN CreateItem( UINT16 usItem, INT16 bStatus, OBJECTTYPE * pObj ) } if (fRet) { -// if (Item[ usItem ].fFlags & ITEM_DEFAULT_UNDROPPABLE) - if (Item[ usItem ].defaultundroppable ) + if (ItemIsUndroppableByDefault(usItem)) { (*pObj).fFlags |= OBJECT_UNDROPPABLE; } @@ -8471,7 +8452,7 @@ BOOLEAN ArmBomb( OBJECTTYPE * pObj, INT8 bSetting ) { fRemote = TRUE; } - else if ( Item[pObj->usItem].mine || pObj->usItem == TRIP_FLARE || pObj->usItem == TRIP_KLAXON || pObj->usItem == ACTION_ITEM ) + else if (ItemIsMine(pObj->usItem) || pObj->usItem == TRIP_FLARE || pObj->usItem == TRIP_KLAXON || pObj->usItem == ACTION_ITEM ) { fPressure = TRUE; } @@ -8529,7 +8510,7 @@ BOOLEAN ArmBomb( OBJECTTYPE * pObj, INT8 bSetting ) // tripwires UINT32 ubWireNetworkFlag = 0; - if ( Item[pObj->usItem].tripwire == 1 && bSetting > 0 && bSetting < 17 ) // checks for safety + if (ItemIsTripwire(pObj->usItem) && bSetting > 0 && bSetting < 17 ) // checks for safety { // we are placing it, so it's ours ubWireNetworkFlag |= TRIPWIRE_NETWORK_OWNER_PLAYER; @@ -8710,7 +8691,7 @@ BOOLEAN OBJECTTYPE::RemoveAttachment( OBJECTTYPE * pAttachment, OBJECTTYPE * pNe pSoldier->bDoBurst = TRUE; pSoldier->bDoAutofire = 1; } - if ( Item[pSoldier->inv[ HANDPOS ].usItem].twohanded && Weapon[pSoldier->inv[ HANDPOS ].usItem].HeavyGun && gGameExternalOptions.ubAllowAlternativeWeaponHolding == 3 ) + if (ItemIsTwoHanded(pSoldier->inv[ HANDPOS ].usItem) && Weapon[pSoldier->inv[ HANDPOS ].usItem].HeavyGun && gGameExternalOptions.ubAllowAlternativeWeaponHolding == 3 ) pSoldier->bScopeMode = USE_ALT_WEAPON_HOLD; else pSoldier->bScopeMode = USE_BEST_SCOPE; @@ -8772,7 +8753,7 @@ BOOLEAN OBJECTTYPE::RemoveAttachment( OBJECTTYPE * pAttachment, OBJECTTYPE * pNe *pNewObj = removedAttachment; } - if (pNewObj->exists() && Item[pNewObj->usItem].grenadelauncher )//UNDER_GLAUNCHER) + if (pNewObj->exists() && ItemIsGrenadeLauncher(pNewObj->usItem))//UNDER_GLAUNCHER) { // look for any grenade; if it exists, we must make it an // attachment of the grenade launcher @@ -9019,7 +9000,7 @@ INT8 CheckItemForDamage( UINT16 usItem, INT32 iMaxDamage ) } // metal items are tough and will be damaged less // if (Item[usItem].fFlags & ITEM_METAL) - if (Item[usItem].metal ) + if (ItemIsMetal(usItem)) { iMaxDamage /= 2; } @@ -9110,7 +9091,7 @@ BOOLEAN DamageItem( OBJECTTYPE * pObject, INT32 iDamage, BOOLEAN fOnGround, INT3 INT8 bLoop; INT16 bDamage; - if ( pObject->exists() && (Item[pObject->usItem].damageable || Item[ pObject->usItem ].usItemClass == IC_AMMO) ) + if ( pObject->exists() && (ItemIsDamageable(pObject->usItem) || Item[ pObject->usItem ].usItemClass == IC_AMMO) ) { for (bLoop = 0; bLoop < pObject->ubNumberOfObjects; bLoop++) @@ -9365,7 +9346,7 @@ BOOLEAN DamageItemOnGround( OBJECTTYPE * pObject, INT32 sGridNo, INT8 bLevel, IN INT8 IsMedicalKitItem( OBJECTTYPE *pObject ) { // check item id against current medical kits - if ( Item[pObject->usItem].medicalkit && pObject->exists() == true) + if (ItemIsMedicalKit(pObject->usItem) && pObject->exists() == true) return 1; //switch( pObject->usItem ) @@ -9402,7 +9383,7 @@ void SwapHandItems( SOLDIERTYPE * pSoldier ) } // if we somehow had an item in our second hand (which shouldn't be possible to begin with), drop it to inventory if twohanded - if ( TwoHandedItem( pSoldier->inv[SECONDHANDPOS].usItem ) ) + if ( ItemIsTwoHanded( pSoldier->inv[SECONDHANDPOS].usItem ) ) { // must move the item in the main hand elsewhere in the inventory fOk = AutoPlaceObject( pSoldier, &( pSoldier->inv[SECONDHANDPOS] ), FALSE, SECONDHANDPOS ); @@ -9425,7 +9406,7 @@ void SwapHandItems( SOLDIERTYPE * pSoldier ) } else { - if (TwoHandedItem( pSoldier->inv[SECONDHANDPOS].usItem ) ) + if (ItemIsTwoHanded( pSoldier->inv[SECONDHANDPOS].usItem ) ) { // must move the item in the main hand elsewhere in the inventory fOk = AutoPlaceObject( pSoldier, &(pSoldier->inv[HANDPOS]), FALSE, HANDPOS ); @@ -9490,8 +9471,7 @@ void WaterDamage( SOLDIERTYPE *pSoldier ) continue; } // if there's an item here that can get water damaged... -// if (pSoldier->inv[ bLoop ].usItem && Item[pSoldier->inv[ bLoop ].usItem].fFlags & ITEM_WATER_DAMAGES) - if (pSoldier->inv[ bLoop ].usItem && Item[pSoldier->inv[ bLoop ].usItem].waterdamages ) + if (pSoldier->inv[ bLoop ].usItem && ItemIsDamagedByWater(pSoldier->inv[bLoop].usItem) ) { // roll the 'ol 100-sided dice uiRoll = PreRandom(100); @@ -9715,7 +9695,7 @@ BOOLEAN ApplyCamo( SOLDIERTYPE * pSoldier, UINT16 usItem, UINT16& usrPointsToUse return( TRUE ); } - else if ( !Item[usItem].camouflagekit ) + else if ( !ItemIsCamoKit(usItem)) { return( FALSE ); } @@ -9962,7 +9942,7 @@ BOOLEAN ApplyCamo( SOLDIERTYPE * pSoldier, UINT16 usItem, UINT16& usrPointsToUse BOOLEAN ApplyCanteen( SOLDIERTYPE * pSoldier, UINT16 usItem, UINT16 usPointsToUse ) { - if ( !Item[usItem].canteen ) + if ( !ItemIsCanteen(usItem)) { return(FALSE); } @@ -10155,7 +10135,7 @@ void ActivateXRayDevice( SOLDIERTYPE * pSoldier ) SOLDIERTYPE * pSoldier2; UINT32 uiSlot; - if ( Item[pSoldier->inv[ HANDPOS ].usItem].needsbatteries && pSoldier->inv[ HANDPOS ].exists() == true && !AM_A_ROBOT(pSoldier) ) + if (ItemNeedsBatteries(pSoldier->inv[ HANDPOS ].usItem) && pSoldier->inv[ HANDPOS ].exists() == true && !AM_A_ROBOT(pSoldier) ) { // check for batteries OBJECTTYPE* pBatteries = FindAttachedBatteries( &(pSoldier->inv[HANDPOS]) ); @@ -10561,7 +10541,7 @@ INT16 GetRangeBonus( OBJECTTYPE * pObj ) bonus += Item[(*pObj)[0]->data.gun.usGunAmmoItem].rangebonus; for (attachmentList::iterator iter = (*pObj)[0]->attachments.begin(); iter != (*pObj)[0]->attachments.end(); ++iter) { - if ( !Item[iter->usItem].duckbill || ( Item[iter->usItem].duckbill && (*pObj)[0]->data.gun.ubGunAmmoType == AMMO_BUCKSHOT ) && iter->exists()) + if ( !ItemIsDuckbill(iter->usItem) || (ItemIsDuckbill(iter->usItem) && (*pObj)[0]->data.gun.ubGunAmmoType == AMMO_BUCKSHOT ) && iter->exists()) bonus += BonusReduce( Item[iter->usItem].rangebonus, (*iter)[0]->data.objectStatus ); } } @@ -11354,7 +11334,7 @@ INT16 GetNightVisionRangeBonus( SOLDIERTYPE * pSoldier, UINT8 bLightLevel ) UINT16 usItem; INVTYPE *pItem; - if (AM_A_ROBOT(pSoldier) && Item[pSoldier->inv[ROBOT_TARGETING_SLOT].usItem].fProvidesRobotNightVision) + if (AM_A_ROBOT(pSoldier) && ItemProvidesRobotNightvision(pSoldier->inv[ROBOT_TARGETING_SLOT].usItem)) { return bonus += BonusReduceMore( NightBonusScale( Item[pSoldier->inv[ROBOT_TARGETING_SLOT].usItem].nightvisionrangebonus, bLightLevel ), @@ -11459,7 +11439,7 @@ INT16 GetCaveVisionRangeBonus( SOLDIERTYPE * pSoldier, UINT8 bLightLevel ) UINT16 usItem; INVTYPE *pItem; - if (AM_A_ROBOT(pSoldier) && Item[pSoldier->inv[ROBOT_TARGETING_SLOT].usItem].fProvidesRobotNightVision) + if (AM_A_ROBOT(pSoldier) && ItemProvidesRobotNightvision(pSoldier->inv[ROBOT_TARGETING_SLOT].usItem)) { return bonus += BonusReduceMore( NightBonusScale( Item[pSoldier->inv[ROBOT_TARGETING_SLOT].usItem].cavevisionrangebonus, bLightLevel ), @@ -11973,7 +11953,7 @@ BOOLEAN HasThermalOptics( SOLDIERTYPE * pSoldier ) if (!IsWeapon(pSoldier->inv[i].usItem) || (IsWeapon(pSoldier->inv[i].usItem) && usingGunScope == true) ) { - if (Item[pSoldier->inv[i].usItem].thermaloptics) + if (ItemIsThermalOptics(pSoldier->inv[i].usItem)) { return TRUE; } @@ -11987,7 +11967,7 @@ BOOLEAN HasThermalOptics( SOLDIERTYPE * pSoldier ) OBJECTTYPE* pObj = &pSoldier->inv[HANDPOS]; if (pObj->exists() == true) { for (attachmentList::iterator iter = (*pObj)[0]->attachments.begin(); iter != (*pObj)[0]->attachments.end(); ++iter) { - if ( Item[iter->usItem].thermaloptics && iter->exists() ) + if (ItemIsThermalOptics(iter->usItem) && iter->exists() ) return TRUE; } } @@ -12040,11 +12020,11 @@ INT16 GetHearingRangeBonus( SOLDIERTYPE * pSoldier ) BOOLEAN IsDuckbill( OBJECTTYPE * pObj ) { if (pObj->exists() == true) { - if (Item[pObj->usItem].duckbill || Item[(*pObj)[0]->data.gun.usGunAmmoItem].duckbill ) + if (ItemIsDuckbill(pObj->usItem) || ItemIsDuckbill((*pObj)[0]->data.gun.usGunAmmoItem)) return TRUE; for (attachmentList::iterator iter = (*pObj)[0]->attachments.begin(); iter != (*pObj)[0]->attachments.end(); ++iter) { - if (Item[iter->usItem].duckbill && iter->exists() ) + if (ItemIsDuckbill(iter->usItem) && iter->exists() ) { return( TRUE ); } @@ -12078,7 +12058,7 @@ INT8 FindGasMask( SOLDIERTYPE * pSoldier ) for (bLoop = 0; bLoop < NUM_INV_SLOTS; bLoop++)//dnl ch40 041009 { if (pSoldier->inv[bLoop].exists() == true) { - if ( Item[pSoldier->inv[bLoop].usItem].gasmask ) + if (ItemIsGasmask(pSoldier->inv[bLoop].usItem)) { return( bLoop ); } @@ -12095,7 +12075,7 @@ BOOLEAN IsDetonatorAttached( OBJECTTYPE * pObj ) // return TRUE; for (attachmentList::iterator iter = (*pObj)[0]->attachments.begin(); iter != (*pObj)[0]->attachments.end(); ++iter) { - if (Item[iter->usItem].detonator && iter->exists() ) + if (ItemIsDetonator(iter->usItem) && iter->exists() ) { return( TRUE ); } @@ -12111,7 +12091,7 @@ BOOLEAN IsRemoteDetonatorAttached( OBJECTTYPE * pObj ) // return TRUE; for (attachmentList::iterator iter = (*pObj)[0]->attachments.begin(); iter != (*pObj)[0]->attachments.end(); ++iter) { - if (Item[iter->usItem].remotedetonator && iter->exists() ) + if (ItemIsRemoteDetonator(iter->usItem) && iter->exists() ) { return( TRUE ); } @@ -12127,17 +12107,17 @@ BOOLEAN IsFlashSuppressor( OBJECTTYPE * pObj, SOLDIERTYPE * pSoldier ) if (Item[pObj->usItem].usItemClass == IC_GUN && AmmoTypes[(*pObj)[0]->data.gun.ubGunAmmoType].tracerEffect && pSoldier->bDoBurst ) return FALSE; - if (Item[pObj->usItem].hidemuzzleflash ) + if (ItemHasHiddenMuzzleFlash(pObj->usItem)) return TRUE; - if ( Item[(*pObj)[0]->data.gun.usGunAmmoItem].hidemuzzleflash ) + if (ItemHasHiddenMuzzleFlash((*pObj)[0]->data.gun.usGunAmmoItem)) return TRUE; attachmentList::iterator iter = (*pObj)[0]->attachments.begin(); attachmentList::iterator iterend = (*pObj)[0]->attachments.end(); for (; iter != iterend; ++iter) { - if (iter->exists() && Item[iter->usItem].hidemuzzleflash ) + if (iter->exists() && ItemHasHiddenMuzzleFlash(iter->usItem)) { return( TRUE ); } @@ -12150,12 +12130,12 @@ BOOLEAN IsGrenadeLauncherAttached( OBJECTTYPE * pObj, UINT8 subObject ) { if (pObj->exists() == true) { - if (Item[pObj->usItem].grenadelauncher ) + if (ItemIsGrenadeLauncher(pObj->usItem)) return TRUE; for (attachmentList::iterator iter = (*pObj)[subObject]->attachments.begin(); iter != (*pObj)[subObject]->attachments.end(); ++iter) { - if (iter->exists() && (Item[iter->usItem].grenadelauncher || IsAttachmentClass( iter->usItem, AC_RIFLEGRENADE ) ) ) + if (iter->exists() && (ItemIsGrenadeLauncher(iter->usItem) || IsAttachmentClass( iter->usItem, AC_RIFLEGRENADE ) ) ) { return TRUE; } @@ -12180,12 +12160,12 @@ OBJECTTYPE* FindAttachment_GrenadeLauncher( OBJECTTYPE * pObj ) } } - if (Item[pObj->usItem].grenadelauncher ) + if (ItemIsGrenadeLauncher(pObj->usItem)) return pObj; for (attachmentList::iterator iter = (*pObj)[0]->attachments.begin(); iter != (*pObj)[0]->attachments.end(); ++iter) { - if (iter->exists() && Item[iter->usItem].grenadelauncher ) + if (iter->exists() && ItemIsGrenadeLauncher(iter->usItem)) { return( &(*iter) ); } @@ -12210,12 +12190,12 @@ INT16 GetGrenadeLauncherStatus( OBJECTTYPE * pObj ) } } - if (Item[pObj->usItem].grenadelauncher ) + if (ItemIsGrenadeLauncher(pObj->usItem)) return (*pObj)[0]->data.objectStatus; for (attachmentList::iterator iter = (*pObj)[0]->attachments.begin(); iter != (*pObj)[0]->attachments.end(); ++iter) { - if (iter->exists() && Item[iter->usItem].grenadelauncher ) + if (iter->exists() && ItemIsGrenadeLauncher(iter->usItem)) { return( (*iter)[0]->data.objectStatus ); } @@ -12240,12 +12220,12 @@ UINT16 GetAttachedGrenadeLauncher( OBJECTTYPE * pObj ) } } - if (Item[pObj->usItem].grenadelauncher ) + if (ItemIsGrenadeLauncher(pObj->usItem)) return pObj->usItem; for (attachmentList::iterator iter = (*pObj)[0]->attachments.begin(); iter != (*pObj)[0]->attachments.end(); ++iter) { - if (iter->exists() && Item[iter->usItem].grenadelauncher ) + if (iter->exists() && ItemIsGrenadeLauncher(iter->usItem)) { return( (UINT16) Item[iter->usItem].uiIndex ); } @@ -12322,7 +12302,7 @@ BOOLEAN EXPLOSIVE_GUN ( UINT16 x) { //DebugMsg(TOPIC_JA2,DBG_LEVEL_3,String("EXPLOSIVE_GUN x = %d",x)); - if ( Item[x].rocketlauncher || Item[x].cannon ) + if (ItemIsRocketLauncher(x) || ItemIsCannon(x) ) return TRUE; else return FALSE; @@ -12334,7 +12314,7 @@ INT8 FindRocketLauncherOrCannon( SOLDIERTYPE * pSoldier ) for ( INT8 bLoop = 0; bLoop < invsize; ++bLoop) { if (pSoldier->inv[bLoop].exists() == true) { - if (Item[pSoldier->inv[bLoop].usItem].rocketlauncher || Item[pSoldier->inv[bLoop].usItem].cannon ) + if (ItemIsRocketLauncher(pSoldier->inv[bLoop].usItem) || ItemIsCannon(pSoldier->inv[bLoop].usItem) ) { return( bLoop ); } @@ -12349,7 +12329,7 @@ INT8 FindCannon( SOLDIERTYPE * pSoldier ) for ( INT8 bLoop = 0; bLoop < invsize; ++bLoop) { if (pSoldier->inv[bLoop].exists() == true) { - if ( Item[pSoldier->inv[bLoop].usItem].cannon ) + if (ItemIsCannon(pSoldier->inv[bLoop].usItem)) { return( bLoop ); } @@ -12369,7 +12349,7 @@ INT8 FindUsableCrowbar( SOLDIERTYPE * pSoldier ) for ( INT8 bLoop = 0; bLoop < invsize; ++bLoop) { 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 (ItemIsCrowbar(pSoldier->inv[bLoop].usItem) && pSoldier->inv[bLoop][0]->data.objectStatus >= USABLE && Item[pSoldier->inv[bLoop].usItem].CrowbarModifier > bonus) { bonus = Item[pSoldier->inv[bLoop].usItem].CrowbarModifier; FoundCrowbar = bLoop; @@ -12383,7 +12363,7 @@ OBJECTTYPE* FindAttachedBatteries( OBJECTTYPE * pObj ) { if (pObj->exists() == true) { for (attachmentList::iterator iter = (*pObj)[0]->attachments.begin(); iter != (*pObj)[0]->attachments.end(); ++iter) { - if (Item[iter->usItem].batteries && iter->exists()) + if (ItemIsBatteries(iter->usItem) && iter->exists()) { return( &(*iter) ); } @@ -12398,7 +12378,7 @@ INT8 FindToolkit( SOLDIERTYPE * pSoldier ) for ( INT8 bLoop = 0; bLoop < invsize; ++bLoop) { if (pSoldier->inv[bLoop].exists() == true) { - if (Item[pSoldier->inv[bLoop].usItem].toolkit ) + if (ItemIsToolkit(pSoldier->inv[bLoop].usItem)) { return( bLoop ); } @@ -12413,7 +12393,7 @@ INT8 FindMedKit( SOLDIERTYPE * pSoldier ) for ( INT8 bLoop = 0; bLoop < invsize; ++bLoop) { if (pSoldier->inv[bLoop].exists() == true) { - if (Item[pSoldier->inv[bLoop].usItem].medicalkit ) + if (ItemIsMedicalKit(pSoldier->inv[bLoop].usItem)) { return( bLoop ); } @@ -12428,7 +12408,7 @@ INT8 FindFirstAidKit( SOLDIERTYPE * pSoldier ) for ( INT8 bLoop = 0; bLoop < invsize; ++bLoop) { if (pSoldier->inv[bLoop].exists() == true) { - if (Item[pSoldier->inv[bLoop].usItem].firstaidkit ) + if (ItemIsFirstAidKit(pSoldier->inv[bLoop].usItem)) { return( bLoop ); } @@ -12443,7 +12423,7 @@ INT8 FindCamoKit( SOLDIERTYPE * pSoldier ) for ( INT8 bLoop = 0; bLoop < invsize; ++bLoop) { if (pSoldier->inv[bLoop].exists() == true) { - if (Item[pSoldier->inv[bLoop].usItem].camouflagekit ) + if (ItemIsCamoKit(pSoldier->inv[bLoop].usItem)) { return( bLoop ); } @@ -12485,7 +12465,7 @@ INT8 FindLocksmithKit( SOLDIERTYPE * pSoldier ) { if (pSoldier->inv[bLoop].exists() == true) { - if (Item[pSoldier->inv[bLoop].usItem].locksmithkit ) + if (ItemIsLocksmithKit(pSoldier->inv[bLoop].usItem)) { //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 ) @@ -12517,7 +12497,7 @@ INT8 FindWalkman(SOLDIERTYPE * pSoldier) // sevenfm: walkman only works from head slot for (INT8 bLoop = HEAD1POS; bLoop <= HEAD2POS; bLoop++) { - if (pSoldier->inv[bLoop].exists() && Item[pSoldier->inv[bLoop].usItem].walkman) + if (pSoldier->inv[bLoop].exists() && ItemIsWalkman(pSoldier->inv[bLoop].usItem)) { return(bLoop); } @@ -12532,7 +12512,7 @@ INT8 FindTrigger( SOLDIERTYPE * pSoldier ) { if (pSoldier->inv[bLoop].exists() == true) { - if (Item[pSoldier->inv[bLoop].usItem].remotetrigger ) + if (ItemIsRemoteTrigger(pSoldier->inv[bLoop].usItem)) { return( bLoop ); } @@ -12546,7 +12526,7 @@ INT8 FindRemoteControl( SOLDIERTYPE * pSoldier ) for (INT8 bLoop = BODYPOSSTART; bLoop < BODYPOSFINAL; ++bLoop) { if (pSoldier->inv[bLoop].exists() == true) { - if (Item[pSoldier->inv[bLoop].usItem].robotremotecontrol ) + if (ItemIsRobotRemote(pSoldier->inv[bLoop].usItem)) { return( bLoop ); } @@ -12615,7 +12595,7 @@ INT16 GetCamoBonus( OBJECTTYPE * pObj ) bonus = (Item[pObj->usItem].camobonus);// * (WEAPON_STATUS_MOD((*pObj)[0]->data.objectStatus) / 100)) ; for (attachmentList::iterator iter = (*pObj)[0]->attachments.begin(); iter != (*pObj)[0]->attachments.end(); ++iter) { - if (!Item[iter->usItem].camouflagekit && iter->exists()) + if (!ItemIsCamoKit(iter->usItem) && iter->exists()) bonus += (INT16) (Item[iter->usItem].camobonus);// * (WEAPON_STATUS_MOD((*iter)[0]->data.objectStatus) / 100)); } } @@ -12628,7 +12608,7 @@ INT16 GetUrbanCamoBonus( OBJECTTYPE * pObj ) bonus = (Item[pObj->usItem].urbanCamobonus);// * (WEAPON_STATUS_MOD((*pObj)[0]->data.objectStatus) / 100)) ; for (attachmentList::iterator iter = (*pObj)[0]->attachments.begin(); iter != (*pObj)[0]->attachments.end(); ++iter) { - if (!Item[iter->usItem].camouflagekit && iter->exists()) + if (!ItemIsCamoKit(iter->usItem) && iter->exists()) bonus += (INT16) (Item[iter->usItem].urbanCamobonus);// * (WEAPON_STATUS_MOD((*iter)[0]->data.objectStatus) / 100)); } } @@ -12641,7 +12621,7 @@ INT16 GetDesertCamoBonus( OBJECTTYPE * pObj ) bonus = (Item[pObj->usItem].desertCamobonus);// * (WEAPON_STATUS_MOD((*pObj)[0]->data.objectStatus) / 100)) ; for (attachmentList::iterator iter = (*pObj)[0]->attachments.begin(); iter != (*pObj)[0]->attachments.end(); ++iter) { - if (!Item[iter->usItem].camouflagekit && iter->exists()) + if (!ItemIsCamoKit(iter->usItem) && iter->exists()) bonus += (INT16) (Item[iter->usItem].desertCamobonus);// * (WEAPON_STATUS_MOD((*iter)[0]->data.objectStatus) / 100)); } } @@ -12654,7 +12634,7 @@ INT16 GetSnowCamoBonus( OBJECTTYPE * pObj ) bonus = (Item[pObj->usItem].snowCamobonus);// * (WEAPON_STATUS_MOD((*pObj)[0]->data.objectStatus) / 100)) ; for (attachmentList::iterator iter = (*pObj)[0]->attachments.begin(); iter != (*pObj)[0]->attachments.end(); ++iter) { - if (!Item[iter->usItem].camouflagekit && iter->exists()) + if (!ItemIsCamoKit(iter->usItem) && iter->exists()) bonus += (INT16) (Item[iter->usItem].snowCamobonus);// * (WEAPON_STATUS_MOD((*iter)[0]->data.objectStatus) / 100)); } } @@ -12667,7 +12647,7 @@ INT16 GetWornCamo( SOLDIERTYPE * pSoldier ) if (AM_A_ROBOT(pSoldier)) { - if (Item[pSoldier->inv[ROBOT_CHASSIS_SLOT].usItem].fProvidesRobotCamo) + if (ItemProvidesRobotCamo(pSoldier->inv[ROBOT_CHASSIS_SLOT].usItem)) { ttl += GetCamoBonus(&pSoldier->inv[ROBOT_CHASSIS_SLOT]); } @@ -12726,7 +12706,7 @@ INT16 GetWornUrbanCamo( SOLDIERTYPE * pSoldier ) if (AM_A_ROBOT(pSoldier)) { - if (Item[pSoldier->inv[ROBOT_CHASSIS_SLOT].usItem].fProvidesRobotCamo) + if (ItemProvidesRobotCamo(pSoldier->inv[ROBOT_CHASSIS_SLOT].usItem)) { ttl += GetUrbanCamoBonus(&pSoldier->inv[ROBOT_CHASSIS_SLOT]); } @@ -12785,7 +12765,7 @@ INT16 GetWornDesertCamo( SOLDIERTYPE * pSoldier ) if (AM_A_ROBOT(pSoldier)) { - if (Item[pSoldier->inv[ROBOT_CHASSIS_SLOT].usItem].fProvidesRobotCamo) + if (ItemProvidesRobotCamo(pSoldier->inv[ROBOT_CHASSIS_SLOT].usItem)) { ttl += GetDesertCamoBonus(&pSoldier->inv[ROBOT_CHASSIS_SLOT]); } @@ -12843,7 +12823,7 @@ INT16 GetWornSnowCamo( SOLDIERTYPE * pSoldier ) if (AM_A_ROBOT(pSoldier)) { - if (Item[pSoldier->inv[ROBOT_CHASSIS_SLOT].usItem].fProvidesRobotCamo) + if (ItemProvidesRobotCamo(pSoldier->inv[ROBOT_CHASSIS_SLOT].usItem)) { ttl += GetSnowCamoBonus(&pSoldier->inv[ROBOT_CHASSIS_SLOT]); } @@ -13439,7 +13419,7 @@ UINT8 AllowedAimingLevelsNCTH( SOLDIERTYPE *pSoldier, INT32 sGridNo ) // Read from item aimLevels = Weapon[pSoldier->inv[pSoldier->ubAttackingHand].usItem].ubAimLevels; - fTwoHanded = Item[pSoldier->inv[pSoldier->ubAttackingHand].usItem].twohanded; + fTwoHanded = ItemIsTwoHanded(pSoldier->inv[pSoldier->ubAttackingHand].usItem); weaponRange = ( Weapon[pSoldier->inv[pSoldier->ubAttackingHand].usItem].usRange * GetPercentRangeBonus(&pSoldier->inv[pSoldier->ubAttackingHand]) ) / 10000; weaponRange += GetRangeBonus(&pSoldier->inv[pSoldier->ubAttackingHand]); weaponType = Weapon[pSoldier->inv[pSoldier->ubAttackingHand].usItem].ubWeaponType; @@ -13569,7 +13549,7 @@ UINT8 AllowedAimingLevels(SOLDIERTYPE * pSoldier, INT32 sGridNo) BOOLEAN fTwoHanded, fUsingBipod; // Read weapon data - fTwoHanded = Item[pSoldier->inv[pSoldier->ubAttackingHand].usItem].twohanded; + fTwoHanded = ItemIsTwoHanded(pSoldier->inv[pSoldier->ubAttackingHand].usItem); UINT16 usRange = GetModifiedGunRange(pSoldier->inv[pSoldier->ubAttackingHand].usItem); @@ -13861,7 +13841,7 @@ UINT8 GetAllowedAimingLevelsForItem( SOLDIERTYPE *pSoldier, OBJECTTYPE *pObj, UI aimLevels = 0; // Read weapon data - fTwoHanded = Item[pObj->usItem].twohanded; + fTwoHanded = ItemIsTwoHanded(pObj->usItem); weaponRange = ( Weapon[Item[pObj->usItem].ubClassIndex].usRange * GetPercentRangeBonus(pObj) ) / 10000; weaponRange += GetRangeBonus(pObj); weaponType = Weapon[Item[pObj->usItem].ubClassIndex].ubWeaponType; @@ -14224,15 +14204,15 @@ BOOLEAN IsFlashSuppressorAlt( OBJECTTYPE * pObj ) if ( AmmoTypes[(*pObj)[0]->data.gun.ubGunAmmoType].tracerEffect ) return FALSE; - if ( Item[pObj->usItem].hidemuzzleflash ) + if (ItemHasHiddenMuzzleFlash(pObj->usItem)) return TRUE; - if ( Item[(*pObj)[0]->data.gun.usGunAmmoItem].hidemuzzleflash ) + if (ItemHasHiddenMuzzleFlash((*pObj)[0]->data.gun.usGunAmmoItem)) return TRUE; for (attachmentList::iterator iter = (*pObj)[0]->attachments.begin(); iter != (*pObj)[0]->attachments.end(); ++iter) { - if ( iter->exists( ) && Item[iter->usItem].hidemuzzleflash ) + if ( iter->exists( ) && ItemHasHiddenMuzzleFlash(iter->usItem)) { return( TRUE ); } @@ -14530,12 +14510,12 @@ BOOLEAN HasExtendedEarOn( SOLDIERTYPE * pSoldier ) { // optimistically assume, that anything electronic with hearing range bonus serves as extended ear as well if ( pSoldier->inv[HEAD1POS].exists() && (pSoldier->inv[HEAD1POS].usItem == EXTENDEDEAR || - (Item[pSoldier->inv[HEAD1POS].usItem].hearingrangebonus > 0 && Item[pSoldier->inv[HEAD1POS].usItem].electronic)) ) + (Item[pSoldier->inv[HEAD1POS].usItem].hearingrangebonus > 0 && ItemIsElectronic(pSoldier->inv[HEAD1POS].usItem))) ) { return( TRUE ); } else if ( pSoldier->inv[HEAD2POS].exists() && (pSoldier->inv[HEAD2POS].usItem == EXTENDEDEAR || - (Item[pSoldier->inv[HEAD2POS].usItem].hearingrangebonus > 0 && Item[pSoldier->inv[HEAD2POS].usItem].electronic)) ) + (Item[pSoldier->inv[HEAD2POS].usItem].hearingrangebonus > 0 && ItemIsElectronic(pSoldier->inv[HEAD2POS].usItem))) ) { return( TRUE ); } @@ -14654,19 +14634,19 @@ void GetScopeLists( SOLDIERTYPE * pSoldier, OBJECTTYPE * pObj, std::mapinv[HANDPOS].usItem].usItemClass & IC_GUN && !Item[pSoldier->inv[HANDPOS].usItem].twohanded) - && (Item[pSoldier->inv[SECONDHANDPOS].usItem].usItemClass & IC_GUN && !Item[pSoldier->inv[SECONDHANDPOS].usItem].twohanded) ) + if( (Item[pSoldier->inv[HANDPOS].usItem].usItemClass & IC_GUN && !ItemIsTwoHanded(pSoldier->inv[HANDPOS].usItem)) + && (Item[pSoldier->inv[SECONDHANDPOS].usItem].usItemClass & IC_GUN && !ItemIsTwoHanded(pSoldier->inv[SECONDHANDPOS].usItem)) ) bDualWielding = TRUE; // certain attachments prohibit the use of an iron sight once they are installed (flip-up built-in sights) - BOOLEAN noironsight = ( Item[pObj->usItem].blockironsight == TRUE ); + BOOLEAN noironsight = ItemBlocksIronsight(pObj->usItem); attachmentList::iterator iterend = (*pObj)[0]->attachments.end(); for (attachmentList::iterator iter = (*pObj)[0]->attachments.begin(); iter != iterend; ++iter) { if ( iter->exists() ) { - if ( Item[iter->usItem].blockironsight == TRUE ) + if (ItemBlocksIronsight(iter->usItem)) noironsight = TRUE; if ( IsAttachmentClass(iter->usItem, AC_SCOPE|AC_SIGHT|AC_IRONSIGHT ) ) @@ -15210,7 +15190,7 @@ bool IsAttachmentPointAvailable( OBJECTTYPE * pObject, UINT8 subObject, UINT32 a { if (pObject) { - if ( Item[pObject->usItem].ulAvailableAttachmentPoint > 0 && (Item[attachmentID].attachment || Item[attachmentID].usItemClass & (IC_GRENADE | IC_BOMB) ) && Item[attachmentID].ulAttachmentPoint & GetAvailableAttachmentPoint( pObject, subObject ) ) + if ( Item[pObject->usItem].ulAvailableAttachmentPoint > 0 && (ItemIsAttachment(attachmentID) || Item[attachmentID].usItemClass & (IC_GRENADE | IC_BOMB) ) && Item[attachmentID].ulAttachmentPoint & GetAvailableAttachmentPoint( pObject, subObject ) ) return true; } @@ -15220,7 +15200,7 @@ bool IsAttachmentPointAvailable( OBJECTTYPE * pObject, UINT8 subObject, UINT32 a //Madd: Common Attachment Framework - if we already know the point bool IsAttachmentPointAvailable( UINT64 point, UINT32 attachmentID, BOOLEAN onlyCheckAttachments ) { - if ( point > 0 && (!onlyCheckAttachments || (Item[attachmentID].attachment || Item[attachmentID].usItemClass & (IC_GRENADE | IC_BOMB) )) && Item[attachmentID].ulAttachmentPoint & point ) + if ( point > 0 && (!onlyCheckAttachments || (ItemIsAttachment(attachmentID) || Item[attachmentID].usItemClass & (IC_GRENADE | IC_BOMB) )) && Item[attachmentID].ulAttachmentPoint & point ) return true; return false; @@ -15229,7 +15209,7 @@ bool IsAttachmentPointAvailable( UINT64 point, UINT32 attachmentID, BOOLEAN only //Madd: Common Attachment Framework, doesn't look at attachments bool IsAttachmentPointAvailable( UINT32 itemID, UINT32 attachmentID ) { - if ( Item[itemID].ulAvailableAttachmentPoint > 0 && (Item[attachmentID].attachment || Item[attachmentID].usItemClass & (IC_GRENADE | IC_BOMB) ) && Item[attachmentID].ulAttachmentPoint & Item[itemID].ulAvailableAttachmentPoint ) + if ( Item[itemID].ulAvailableAttachmentPoint > 0 && (ItemIsAttachment(attachmentID) || Item[attachmentID].usItemClass & (IC_GRENADE | IC_BOMB) ) && Item[attachmentID].ulAttachmentPoint & Item[itemID].ulAvailableAttachmentPoint ) return true; return false; @@ -15244,7 +15224,7 @@ UINT64 GetAvailableAttachmentPoint (OBJECTTYPE * pObject, UINT8 subObject) point = Item[pObject->usItem].ulAvailableAttachmentPoint; for (attachmentList::iterator iter = (*pObject)[subObject]->attachments.begin(); iter != (*pObject)[subObject]->attachments.end(); ++iter) { - if(iter->exists() && Item[iter->usItem].ulAvailableAttachmentPoint && Item[iter->usItem].attachment ) + if(iter->exists() && Item[iter->usItem].ulAvailableAttachmentPoint && ItemIsAttachment(iter->usItem) ) point |= Item[iter->usItem].ulAvailableAttachmentPoint; } } @@ -15274,6 +15254,11 @@ BOOLEAN HasItemFlag( UINT16 usItem, UINT64 aFlag ) return( (Item[usItem].usItemFlag & aFlag) != 0 ); } +BOOLEAN HasItemFlag2(UINT16 usItem, UINT64 aFlag) +{ + return((Item[usItem].usItemFlag2 & aFlag) != 0); +} + // Flugente: get first item number that has this flag. Use with caution, as we search in all items BOOLEAN GetFirstItemWithFlag( UINT16* pusItem, UINT64 aFlag ) { @@ -15439,7 +15424,7 @@ INT8 GetNumberAltFireAimLevels( SOLDIERTYPE * pSoldier, INT32 iGridNo ) UINT16 usInHand = pSoldier->inv[ HANDPOS ].usItem; // If we are in water and having a pistol, don't allow alternative fire at all - if ( !Item[usInHand].twohanded && pSoldier->MercInWater() ) + if ( !ItemIsTwoHanded(usInHand) && pSoldier->MercInWater() ) { return -1; } @@ -15456,7 +15441,7 @@ INT8 GetNumberAltFireAimLevels( SOLDIERTYPE * pSoldier, INT32 iGridNo ) // with this mode, we always switch aaiming type manually return ubStandardAimLvls; } - else if ( Weapon[usInHand].HeavyGun && Item[usInHand].twohanded) + else if ( Weapon[usInHand].HeavyGun && ItemIsTwoHanded(usInHand)) { // if this gun is flagged as too heavy to shoulder, return the same as standard aim levels return ubStandardAimLvls; @@ -15718,7 +15703,7 @@ BOOL AddToRandomListFromItem( UINT16 usItem ) if ( Item[usItem].ubCoolness <= rditemmaxcoolness ) { // if item is food, not drug or canteen, and food system is off, don't add this - if ( !UsingFoodSystem() && Item[usItem].foodtype > 0 && Item[usItem].drugtype == 0 && Item[usItem].canteen == 0 ) + if ( !UsingFoodSystem() && Item[usItem].foodtype > 0 && Item[usItem].drugtype == 0 && !ItemIsCanteen(usItem)) ; else randomitemarray[itemcnt++] = usItem; @@ -15767,13 +15752,13 @@ BOOLEAN ItemCanBeAppliedToOthers( UINT16 usItem ) if ( Item[ usItem ].drugtype ) return TRUE; - if ( Item[ usItem ].gasmask ) + if (ItemIsGasmask(usItem)) return TRUE; - if ( Item[ usItem ].canteen ) + if (ItemIsCanteen(usItem)) return TRUE; - if ( Item[ usItem ].camouflagekit ) + if (ItemIsCamoKit(usItem)) return TRUE; if ( Item[ usItem ].clothestype ) @@ -15796,7 +15781,7 @@ INT32 GetPercentRangeBonus( OBJECTTYPE * pObj ) bonus = ( bonus * ( 100 + Item[(*pObj)[0]->data.gun.usGunAmmoItem].percentrangebonus ) ) / 100; for (attachmentList::iterator iter = (*pObj)[0]->attachments.begin(); iter != (*pObj)[0]->attachments.end(); ++iter) { - if ( !Item[iter->usItem].duckbill || ( Item[iter->usItem].duckbill && (*pObj)[0]->data.gun.ubGunAmmoType == AMMO_BUCKSHOT )) + if ( !ItemIsDuckbill(iter->usItem) || (ItemIsDuckbill(iter->usItem) && (*pObj)[0]->data.gun.ubGunAmmoType == AMMO_BUCKSHOT )) bonus = ( bonus * ( 100 + BonusReduce( Item[iter->usItem].percentrangebonus, (*iter)[0]->data.objectStatus ) ) ) / 100; } } @@ -15880,7 +15865,7 @@ FLOAT GetAttackAPTraitMultiplier( SOLDIERTYPE *pSoldier, OBJECTTYPE *pObj, UINT8 { fMultiplier = (100 - gSkillTraitValues.ubMEBladesAPsReduction * NUM_SKILL_TRAITS( pSoldier, MELEE_NT ) ) / 100.0f; } - else if( Item[ pObj->usItem ].usItemClass == IC_PUNCH && Item[pObj->usItem].brassknuckles ) + else if( Item[ pObj->usItem ].usItemClass == IC_PUNCH && ItemIsBrassKnuckles(pObj->usItem) ) { fMultiplier = (100 - gSkillTraitValues.ubMAPunchAPsReduction * NUM_SKILL_TRAITS( pSoldier, MARTIAL_ARTS_NT ) ) / 100.0f; } @@ -15889,17 +15874,17 @@ FLOAT GetAttackAPTraitMultiplier( SOLDIERTYPE *pSoldier, OBJECTTYPE *pObj, UINT8 fMultiplier = (100 - gSkillTraitValues.ubTHBladesAPsReduction * NUM_SKILL_TRAITS( pSoldier, THROWING_NT ) ) / 100.0f; } // grenade launchers - else if( (Item[ pObj->usItem ].usItemClass == IC_LAUNCHER || Item[ pObj->usItem ].grenadelauncher) && !(Item[ pObj->usItem ].rocketlauncher) && !(Item[ pObj->usItem ].mortar) ) + else if( (Item[ pObj->usItem ].usItemClass == IC_LAUNCHER || ItemIsGrenadeLauncher(pObj->usItem)) && !(ItemIsRocketLauncher(pObj->usItem)) && !ItemIsMortar(pObj->usItem) ) { fMultiplier = (100 - gSkillTraitValues.ubHWGrenadeLaunchersAPsReduction * NUM_SKILL_TRAITS( pSoldier, HEAVY_WEAPONS_NT ) ) / 100.0f; } // rocket launchers - else if( (Item[ pObj->usItem ].rocketlauncher || Item[ pObj->usItem ].singleshotrocketlauncher) && !(Item[ pObj->usItem ].mortar) ) + else if( (ItemIsRocketLauncher(pObj->usItem) || ItemIsSingleShotRocketLauncher(pObj->usItem)) && !ItemIsMortar(pObj->usItem) ) { fMultiplier = (100 - gSkillTraitValues.ubHWRocketLaunchersAPsReduction * NUM_SKILL_TRAITS( pSoldier, HEAVY_WEAPONS_NT ) ) / 100.0f; } // mortar - else if( Item[ pObj->usItem ].mortar ) + else if(ItemIsMortar(pObj->usItem)) { fMultiplier = (100 - gSkillTraitValues.ubHWMortarAPsReduction * NUM_SKILL_TRAITS( pSoldier, HEAVY_WEAPONS_NT ) + pSoldier->GetBackgroundValue(BG_ARTILLERY) ) / 100.0f; } @@ -16064,3 +16049,82 @@ BOOLEAN FindAttachmentRange(UINT16 usAttachment, UINT32* pStartIndex, UINT32* pE return result; } + +//////////////////////////////////// +// Item flagmask utility functions +// Just to improve readability +//////////////////////////////////// +// usItemFlag +BOOLEAN ItemIsDamageable(UINT16 usItem) { return HasItemFlag(usItem, ITEM_damageable); } +BOOLEAN ItemIsRepairable(UINT16 usItem) { return HasItemFlag(usItem, ITEM_repairable); } +BOOLEAN ItemIsDamagedByWater(UINT16 usItem) { return HasItemFlag(usItem, ITEM_waterdamages); } +BOOLEAN ItemIsMetal(UINT16 usItem) { return HasItemFlag(usItem, ITEM_metal); } +BOOLEAN ItemSinks(UINT16 usItem) { return HasItemFlag(usItem, ITEM_sinks); } +BOOLEAN ItemIsTwoHanded(UINT16 usItem) { return HasItemFlag(usItem, ITEM_twohanded); } +BOOLEAN ItemIsHiddenAddon(UINT16 usItem) { return HasItemFlag(usItem, ITEM_hiddenaddon); } +BOOLEAN ItemIsNotBuyable(UINT16 usItem) { return HasItemFlag(usItem, ITEM_notbuyable); } +BOOLEAN ItemIsAttachment(UINT16 usItem) { return HasItemFlag(usItem, ITEM_attachment); } +BOOLEAN ItemIsHiddenAttachment(UINT16 usItem) { return HasItemFlag(usItem, ITEM_hiddenattachment); } +BOOLEAN ItemIsOnlyInTonsOfGuns(UINT16 usItem) { return HasItemFlag(usItem, ITEM_biggunlist); } +BOOLEAN ItemIsNotInEditor(UINT16 usItem) { return HasItemFlag(usItem, ITEM_notineditor); } +BOOLEAN ItemIsUndroppableByDefault(UINT16 usItem) { return HasItemFlag(usItem, ITEM_defaultundroppable); } +BOOLEAN ItemIsUnaerodynamic(UINT16 usItem) { return HasItemFlag(usItem, ITEM_unaerodynamic); } +BOOLEAN ItemIsElectronic(UINT16 usItem) { return HasItemFlag(usItem, ITEM_electronic); } +BOOLEAN ItemIsCannon(UINT16 usItem) { return HasItemFlag(usItem, ITEM_cannon); } +BOOLEAN ItemIsRocketRifle(UINT16 usItem) { return HasItemFlag(usItem, ITEM_rocketrifle); } +BOOLEAN ItemHasFingerPrintID(UINT16 usItem) { return HasItemFlag(usItem, ITEM_fingerprintid); } +BOOLEAN ItemIsMetalDetector(UINT16 usItem) { return HasItemFlag(usItem, ITEM_metaldetector); } +BOOLEAN ItemIsGasmask(UINT16 usItem) { return HasItemFlag(usItem, ITEM_gasmask); } +BOOLEAN ItemIsLockBomb(UINT16 usItem) { return HasItemFlag(usItem, ITEM_lockbomb); } +BOOLEAN ItemIsFlare(UINT16 usItem) { return HasItemFlag(usItem, ITEM_flare); } +BOOLEAN ItemIsGrenadeLauncher(UINT16 usItem) { return HasItemFlag(usItem, ITEM_grenadelauncher); } +BOOLEAN ItemIsMortar(UINT16 usItem) { return HasItemFlag(usItem, ITEM_mortar); } +BOOLEAN ItemIsDuckbill(UINT16 usItem) { return HasItemFlag(usItem, ITEM_duckbill); } +BOOLEAN ItemIsDetonator(UINT16 usItem) { return HasItemFlag(usItem, ITEM_detonator); } +BOOLEAN ItemIsRemoteDetonator(UINT16 usItem) { return HasItemFlag(usItem, ITEM_remotedetonator); } +BOOLEAN ItemHasHiddenMuzzleFlash(UINT16 usItem) { return HasItemFlag(usItem, ITEM_hidemuzzleflash); } +BOOLEAN ItemIsRocketLauncher(UINT16 usItem) { return HasItemFlag(usItem, ITEM_rocketlauncher); } +// usItemFlag2 +BOOLEAN ItemIsSingleShotRocketLauncher(UINT16 usItem) { return HasItemFlag2(usItem, ITEM_singleshotrocketlauncher); } +BOOLEAN ItemIsBrassKnuckles(UINT16 usItem) { return HasItemFlag2(usItem, ITEM_brassknuckles); } +BOOLEAN ItemIsCrowbar(UINT16 usItem) { return HasItemFlag2(usItem, ITEM_crowbar); } +BOOLEAN ItemIsGLgrenade(UINT16 usItem) { return HasItemFlag2(usItem, ITEM_glgrenade); } +BOOLEAN ItemIsFlakJacket(UINT16 usItem) { return HasItemFlag2(usItem, ITEM_flakjacket); } +BOOLEAN ItemIsLeatherJacket(UINT16 usItem) { return HasItemFlag2(usItem, ITEM_leatherjacket); } +BOOLEAN ItemIsBatteries(UINT16 usItem) { return HasItemFlag2(usItem, ITEM_batteries); } +BOOLEAN ItemNeedsBatteries(UINT16 usItem) { return HasItemFlag2(usItem, ITEM_needsbatteries); } +BOOLEAN ItemHasXRay(UINT16 usItem) { return HasItemFlag2(usItem, ITEM_xray); } +BOOLEAN ItemIsWirecutters(UINT16 usItem) { return HasItemFlag2(usItem, ITEM_wirecutters); } +BOOLEAN ItemIsToolkit(UINT16 usItem) { return HasItemFlag2(usItem, ITEM_toolkit); } +BOOLEAN ItemIsFirstAidKit(UINT16 usItem) { return HasItemFlag2(usItem, ITEM_firstaidkit); } +BOOLEAN ItemIsMedicalKit(UINT16 usItem) { return HasItemFlag2(usItem, ITEM_medicalkit); } +BOOLEAN ItemIsCanteen(UINT16 usItem) { return HasItemFlag2(usItem, ITEM_canteen); } +BOOLEAN ItemIsJar(UINT16 usItem) { return HasItemFlag2(usItem, ITEM_jar); } +BOOLEAN ItemIsCanAndString(UINT16 usItem) { return HasItemFlag2(usItem, ITEM_canandstring); } +BOOLEAN ItemIsMarbles(UINT16 usItem) { return HasItemFlag2(usItem, ITEM_marbles); } +BOOLEAN ItemIsWalkman(UINT16 usItem) { return HasItemFlag2(usItem, ITEM_walkman); } +BOOLEAN ItemIsRemoteTrigger(UINT16 usItem) { return HasItemFlag2(usItem, ITEM_remotetrigger); } +BOOLEAN ItemIsRobotRemote(UINT16 usItem) { return HasItemFlag2(usItem, ITEM_robotremotecontrol); } +BOOLEAN ItemIsCamoKit(UINT16 usItem) { return HasItemFlag2(usItem, ITEM_camouflagekit); } +BOOLEAN ItemIsLocksmithKit(UINT16 usItem) { return HasItemFlag2(usItem, ITEM_locksmithkit); } +BOOLEAN ItemIsMine(UINT16 usItem) { return HasItemFlag2(usItem, ITEM_mine); } +BOOLEAN ItemIsATMine(UINT16 usItem) { return HasItemFlag2(usItem, ITEM_antitankmine); } +BOOLEAN ItemIsHardware(UINT16 usItem) { return HasItemFlag2(usItem, ITEM_hardware); } +BOOLEAN ItemIsMedical(UINT16 usItem) { return HasItemFlag2(usItem, ITEM_medical); } +BOOLEAN ItemIsGascan(UINT16 usItem) { return HasItemFlag2(usItem, ITEM_gascan); } +BOOLEAN ItemContainsLiquid(UINT16 usItem) { return HasItemFlag2(usItem, ITEM_containsliquid); } +BOOLEAN ItemIsRock(UINT16 usItem) { return HasItemFlag2(usItem, ITEM_rock); } +BOOLEAN ItemIsThermalOptics(UINT16 usItem) { return HasItemFlag2(usItem, ITEM_thermaloptics); } +BOOLEAN ItemIsOnlyInScifi(UINT16 usItem) { return HasItemFlag2(usItem, ITEM_scifi); } +BOOLEAN ItemIsOnlyInNIV(UINT16 usItem) { return HasItemFlag2(usItem, ITEM_newinv); } +BOOLEAN ItemIsBarrel(UINT16 usItem) { return HasItemFlag2(usItem, ITEM_barrel); } +BOOLEAN ItemHasTripwireActivation(UINT16 usItem) { return HasItemFlag2(usItem, ITEM_tripwireactivation); } +BOOLEAN ItemIsTripwire(UINT16 usItem) { return HasItemFlag2(usItem, ITEM_tripwire); } +BOOLEAN ItemIsDirectional(UINT16 usItem) { return HasItemFlag2(usItem, ITEM_directional); } +BOOLEAN ItemBlocksIronsight(UINT16 usItem) { return HasItemFlag2(usItem, ITEM_blockironsight); } +BOOLEAN ItemAllowsClimbing(UINT16 usItem) { return HasItemFlag2(usItem, ITEM_fAllowClimbing); } +BOOLEAN ItemIsCigarette(UINT16 usItem) { return HasItemFlag2(usItem, ITEM_cigarette); } +BOOLEAN ItemIsOnlyInDisease(UINT16 usItem) { return HasItemFlag2(usItem, ITEM_DiseaseSystemExclusive); } +BOOLEAN ItemProvidesRobotCamo(UINT16 usItem) { return HasItemFlag2(usItem, ITEM_fProvidesRobotCamo); } +BOOLEAN ItemProvidesRobotNightvision(UINT16 usItem) { return HasItemFlag2(usItem, ITEM_fProvidesRobotNightVision); } +BOOLEAN ItemProvidesRobotLaserBonus(UINT16 usItem) { return HasItemFlag2(usItem, ITEM_fProvidesRobotLaserBonus); } diff --git a/Tactical/Items.h b/Tactical/Items.h index ce23180f5..6aa26659e 100644 --- a/Tactical/Items.h +++ b/Tactical/Items.h @@ -179,8 +179,78 @@ BOOLEAN ValidAttachmentClass( UINT16 usAttachment, UINT16 usItem ); //Determines if it is possible to equip this weapon with this ammo. BOOLEAN ValidAmmoType( UINT16 usItem, UINT16 usAmmoType ); -//Determines if this item is a two handed item. -BOOLEAN TwoHandedItem( UINT16 usItem ); +BOOLEAN ItemIsDamageable(UINT16 usItem); +BOOLEAN ItemIsRepairable(UINT16 usItem); +BOOLEAN ItemIsDamagedByWater(UINT16 usItem); +BOOLEAN ItemIsMetal(UINT16 usItem); +BOOLEAN ItemSinks(UINT16 usItem); +BOOLEAN ItemIsTwoHanded(UINT16 usItem); +BOOLEAN ItemIsHiddenAddon(UINT16 usItem); +BOOLEAN ItemIsNotBuyable(UINT16 usItem); +BOOLEAN ItemIsAttachment(UINT16 usItem); +BOOLEAN ItemIsHiddenAttachment(UINT16 usItem); +BOOLEAN ItemIsOnlyInTonsOfGuns(UINT16 usItem); +BOOLEAN ItemIsNotInEditor(UINT16 usItem); +BOOLEAN ItemIsUndroppableByDefault(UINT16 usItem); +BOOLEAN ItemIsUnaerodynamic(UINT16 usItem); +BOOLEAN ItemIsElectronic(UINT16 usItem); +BOOLEAN ItemIsCannon(UINT16 usItem); +BOOLEAN ItemIsRocketRifle(UINT16 usItem); +BOOLEAN ItemHasFingerPrintID(UINT16 usItem); +BOOLEAN ItemIsMetalDetector(UINT16 usItem); +BOOLEAN ItemIsGasmask(UINT16 usItem); +BOOLEAN ItemIsLockBomb(UINT16 usItem); +BOOLEAN ItemIsFlare(UINT16 usItem); +BOOLEAN ItemIsGrenadeLauncher(UINT16 usItem); +BOOLEAN ItemIsMortar(UINT16 usItem); +BOOLEAN ItemIsDuckbill(UINT16 usItem); +BOOLEAN ItemIsDetonator(UINT16 usItem); +BOOLEAN ItemIsRemoteDetonator(UINT16 usItem); +BOOLEAN ItemHasHiddenMuzzleFlash(UINT16 usItem); +BOOLEAN ItemIsRocketLauncher(UINT16 usItem); +BOOLEAN ItemIsSingleShotRocketLauncher(UINT16 usItem); +BOOLEAN ItemIsBrassKnuckles(UINT16 usItem); +BOOLEAN ItemIsCrowbar(UINT16 usItem); +BOOLEAN ItemIsGLgrenade(UINT16 usItem); +BOOLEAN ItemIsFlakJacket(UINT16 usItem); +BOOLEAN ItemIsLeatherJacket(UINT16 usItem); +BOOLEAN ItemIsBatteries(UINT16 usItem); +BOOLEAN ItemNeedsBatteries(UINT16 usItem); +BOOLEAN ItemHasXRay(UINT16 usItem); +BOOLEAN ItemIsWirecutters(UINT16 usItem); +BOOLEAN ItemIsToolkit(UINT16 usItem); +BOOLEAN ItemIsFirstAidKit(UINT16 usItem); +BOOLEAN ItemIsMedicalKit(UINT16 usItem); +BOOLEAN ItemIsCanteen(UINT16 usItem); +BOOLEAN ItemIsJar(UINT16 usItem); +BOOLEAN ItemIsCanAndString(UINT16 usItem); +BOOLEAN ItemIsMarbles(UINT16 usItem); +BOOLEAN ItemIsWalkman(UINT16 usItem); +BOOLEAN ItemIsRemoteTrigger(UINT16 usItem); +BOOLEAN ItemIsRobotRemote(UINT16 usItem); +BOOLEAN ItemIsCamoKit(UINT16 usItem); +BOOLEAN ItemIsLocksmithKit(UINT16 usItem); +BOOLEAN ItemIsMine(UINT16 usItem); +BOOLEAN ItemIsATMine(UINT16 usItem); +BOOLEAN ItemIsHardware(UINT16 usItem); +BOOLEAN ItemIsMedical(UINT16 usItem); +BOOLEAN ItemIsGascan(UINT16 usItem); +BOOLEAN ItemContainsLiquid(UINT16 usItem); +BOOLEAN ItemIsRock(UINT16 usItem); +BOOLEAN ItemIsThermalOptics(UINT16 usItem); +BOOLEAN ItemIsOnlyInScifi(UINT16 usItem); +BOOLEAN ItemIsOnlyInNIV(UINT16 usItem); +BOOLEAN ItemIsBarrel(UINT16 usItem); +BOOLEAN ItemHasTripwireActivation(UINT16 usItem); +BOOLEAN ItemIsTripwire(UINT16 usItem); +BOOLEAN ItemIsDirectional(UINT16 usItem); +BOOLEAN ItemBlocksIronsight(UINT16 usItem); +BOOLEAN ItemAllowsClimbing(UINT16 usItem); +BOOLEAN ItemIsCigarette(UINT16 usItem); +BOOLEAN ItemIsOnlyInDisease(UINT16 usItem); +BOOLEAN ItemProvidesRobotCamo(UINT16 usItem); +BOOLEAN ItemProvidesRobotNightvision(UINT16 usItem); +BOOLEAN ItemProvidesRobotLaserBonus(UINT16 usItem); //Existing functions without header def's, added them here, just incase I'll need to call //them from the editor. @@ -222,7 +292,6 @@ UINT8 ConvertObjectTypeMoneyValueToProfileMoneyValue( UINT32 uiMoneyAmount ); BOOLEAN CheckForChainReaction( UINT16 usItem, INT16 bStatus, INT16 bDamage, BOOLEAN fOnGround ); BOOLEAN ItemIsLegal( UINT16 usItemIndex, BOOLEAN fIgnoreCoolness = FALSE ); -BOOLEAN ExtendedGunListGun( UINT16 usGun ); UINT16 StandardGunListReplacement( UINT16 usGun ); UINT16 FindReplacementMagazine( UINT8 ubCalibre, UINT16 ubMagSize, UINT8 ubAmmoType); UINT16 FindReplacementMagazineIfNecessary( UINT16 usOldGun, UINT16 usOldAmmo, UINT16 usNewGun ); @@ -497,7 +566,8 @@ UINT64 GetAvailableAttachmentPoint ( OBJECTTYPE * pObject, UINT8 subObject ); void CheckBombSpecifics( OBJECTTYPE * pObj, INT8* detonatortype, INT8* setting, INT8* defusefrequency ); // Flugente: check for specific flags -BOOLEAN HasItemFlag( UINT16 usItem, UINT64 aFlag ); +BOOLEAN HasItemFlag(UINT16 usItem, UINT64 aFlag); +BOOLEAN HasItemFlag2(UINT16 usItem, UINT64 aFlag); // Flugente: get first item number that has this flag. Use with caution, as we search in all items BOOLEAN GetFirstItemWithFlag( UINT16* pusItem, UINT64 aFlag ); diff --git a/Tactical/LOS.cpp b/Tactical/LOS.cpp index ac2605a37..6d674b550 100644 --- a/Tactical/LOS.cpp +++ b/Tactical/LOS.cpp @@ -4840,15 +4840,15 @@ INT8 FireBulletGivenTargetNCTH( SOLDIERTYPE * pFirer, FLOAT dEndX, FLOAT dEndY, { usBulletFlags |= BULLET_FLAG_KNIFE; } - else if ( Item[usHandItem].rocketlauncher ) + else if (ItemIsRocketLauncher(usHandItem)) { usBulletFlags |= BULLET_FLAG_MISSILE; } - else if ( Item[usHandItem].cannon ) + else if (ItemIsCannon(usHandItem)) { usBulletFlags |= BULLET_FLAG_TANK_CANNON; } - else if ( Item[usHandItem].rocketrifle ) + else if (ItemIsRocketRifle(usHandItem)) { usBulletFlags |= BULLET_FLAG_SMALL_MISSILE; } @@ -5237,7 +5237,7 @@ INT8 FireBulletGivenTargetNCTH( SOLDIERTYPE * pFirer, FLOAT dEndX, FLOAT dEndY, if( !fFake && ( pFirer->ubProfile != NO_PROFILE ) && ( pFirer->bTeam == gbPlayerNum ) ) { // another shot fired - if ( Item[usHandItem].usItemClass == IC_LAUNCHER || Item[usHandItem].grenadelauncher || Item[usHandItem].rocketlauncher || Item[usHandItem].singleshotrocketlauncher || Item[usHandItem].mortar) + if ( Item[usHandItem].usItemClass == IC_LAUNCHER || ItemIsGrenadeLauncher(usHandItem) || ItemIsRocketLauncher(usHandItem) || ItemIsSingleShotRocketLauncher(usHandItem) || ItemIsMortar(usHandItem)) gMercProfiles[ pFirer->ubProfile ].records.usMissilesLaunched++; else if ( Item[usHandItem].usItemClass == IC_THROWING_KNIFE ) gMercProfiles[ pFirer->ubProfile ].records.usKnivesThrown++; @@ -5335,15 +5335,15 @@ INT8 FireBulletGivenTarget( SOLDIERTYPE * pFirer, FLOAT dEndX, FLOAT dEndY, FLOA { usBulletFlags |= BULLET_FLAG_KNIFE; } - else if ( Item[usHandItem].rocketlauncher ) + else if (ItemIsRocketLauncher(usHandItem)) { usBulletFlags |= BULLET_FLAG_MISSILE; } - else if ( Item[usHandItem].cannon ) + else if (ItemIsCannon(usHandItem)) { usBulletFlags |= BULLET_FLAG_TANK_CANNON; } - else if ( Item[usHandItem].rocketrifle ) + else if (ItemIsRocketRifle(usHandItem)) { usBulletFlags |= BULLET_FLAG_SMALL_MISSILE; } @@ -5753,7 +5753,7 @@ INT8 FireBulletGivenTarget( SOLDIERTYPE * pFirer, FLOAT dEndX, FLOAT dEndY, FLOA if( !fFake && ( pFirer->ubProfile != NO_PROFILE ) && ( pFirer->bTeam == gbPlayerNum ) ) { // another shot fired - if ( Item[usHandItem].usItemClass == IC_LAUNCHER || Item[usHandItem].grenadelauncher || Item[usHandItem].rocketlauncher || Item[usHandItem].singleshotrocketlauncher || Item[usHandItem].mortar) + if ( Item[usHandItem].usItemClass == IC_LAUNCHER || ItemIsGrenadeLauncher(usHandItem) || ItemIsRocketLauncher(usHandItem) || ItemIsSingleShotRocketLauncher(usHandItem) || ItemIsMortar(usHandItem)) gMercProfiles[ pFirer->ubProfile ].records.usMissilesLaunched++; else if ( Item[usHandItem].usItemClass == IC_THROWING_KNIFE ) gMercProfiles[ pFirer->ubProfile ].records.usKnivesThrown++; @@ -6007,15 +6007,15 @@ INT8 FireBulletGivenTargetTrapOnly( SOLDIERTYPE* pThrower, OBJECTTYPE* pObj, INT { usBulletFlags |= BULLET_FLAG_KNIFE; } - else if ( Item[usItem].rocketlauncher ) + else if (ItemIsRocketLauncher(usItem)) { usBulletFlags |= BULLET_FLAG_MISSILE; } - else if ( Item[usItem].cannon ) + else if (ItemIsCannon(usItem)) { usBulletFlags |= BULLET_FLAG_TANK_CANNON; } - else if ( Item[usItem].rocketrifle ) + else if (ItemIsRocketRifle(usItem)) { usBulletFlags |= BULLET_FLAG_SMALL_MISSILE; } @@ -6594,15 +6594,15 @@ INT8 FireBulletGivenTarget_NoObjectNoSoldier( UINT16 usItem, UINT8 ammotype, UIN { usBulletFlags |= BULLET_FLAG_KNIFE; } - else if ( Item[usItem].rocketlauncher ) + else if (ItemIsRocketLauncher(usItem)) { usBulletFlags |= BULLET_FLAG_MISSILE; } - else if ( Item[usItem].cannon ) + else if (ItemIsCannon(usItem)) { usBulletFlags |= BULLET_FLAG_TANK_CANNON; } - else if ( Item[usItem].rocketrifle ) + else if (ItemIsRocketRifle(usItem)) { usBulletFlags |= BULLET_FLAG_SMALL_MISSILE; } @@ -6923,7 +6923,7 @@ INT8 ChanceToGetThrough(SOLDIERTYPE * pFirer, FLOAT dEndX, FLOAT dEndY, FLOAT dE // sevenfm: check that weapon exists! if (pObjHand->exists() && pObjHand->usItem == pFirer->usAttackingWeapon && - (Item[pFirer->usAttackingWeapon].usItemClass == IC_GUN || Item[pFirer->usAttackingWeapon].usItemClass == IC_THROWING_KNIFE || Item[pFirer->usAttackingWeapon].rocketlauncher)) + (Item[pFirer->usAttackingWeapon].usItemClass == IC_GUN || Item[pFirer->usAttackingWeapon].usItemClass == IC_THROWING_KNIFE || ItemIsRocketLauncher(pFirer->usAttackingWeapon))) { BOOLEAN fBuckShot = FALSE; @@ -8643,7 +8643,7 @@ void AdjustTargetCenterPoint( SOLDIERTYPE *pShooter, INT32 iTargetGridNo, FLOAT //INT32 iLaserRange = GetBestLaserRange(&(pShooter->inv[pSoldier->ubAttackingHand])); INT16 sLaserRange = GetBestLaserRange(pWeapon); - if (AM_A_ROBOT(pShooter) && Item[pShooter->inv[ROBOT_TARGETING_SLOT].usItem].fProvidesRobotLaserBonus) + if (AM_A_ROBOT(pShooter) && ItemProvidesRobotLaserBonus(pShooter->inv[ROBOT_TARGETING_SLOT].usItem)) { sLaserRange = max(sLaserRange, GetBestLaserRange(&pShooter->inv[ROBOT_TARGETING_SLOT])); } diff --git a/Tactical/LogicalBodyTypes/Filter.cpp b/Tactical/LogicalBodyTypes/Filter.cpp index 648105bfc..d0a60a9e6 100644 --- a/Tactical/LogicalBodyTypes/Filter.cpp +++ b/Tactical/LogicalBodyTypes/Filter.cpp @@ -214,10 +214,10 @@ bool Filter::Match(SOLDIERTYPE* pSoldier) { cmp_val = Weapon[pSoldier->inv[HANDPOS].usItem].ubCalibre; break; case REQ_WEAPON_TWOHANDED: - cmp_val = TwoHandedItem(pSoldier->inv[HANDPOS].usItem); + cmp_val = ItemIsTwoHanded(pSoldier->inv[HANDPOS].usItem); break; case REQ_LEFT_WEAPON_TWOHANDED: - cmp_val = TwoHandedItem(pSoldier->inv[SECONDHANDPOS].usItem); + cmp_val = ItemIsTwoHanded(pSoldier->inv[SECONDHANDPOS].usItem); break; case REQ_VEST_AMOR_PROTECTION: cmp_val = Armour[Item[pSoldier->inv[VESTPOS].usItem].ubClassIndex].ubProtection; diff --git a/Tactical/Overhead.cpp b/Tactical/Overhead.cpp index 3052c2bb1..9ea833546 100644 --- a/Tactical/Overhead.cpp +++ b/Tactical/Overhead.cpp @@ -7287,7 +7287,7 @@ void RemoveCapturedEnemiesFromSectorInfo( INT16 sMapX, INT16 sMapY, INT8 bMapZ ) // Check if it's supposed to be dropped if ( !((*pObj).fFlags & OBJECT_UNDROPPABLE) || pTeamSoldier->bTeam == gbPlayerNum ) { - if ( !(Item[pObj->usItem].defaultundroppable) ) + if ( !ItemIsUndroppableByDefault(pObj->usItem) ) { //ReduceAmmoDroppedByNonPlayerSoldiers( pTeamSoldier, cnt ); @@ -7301,7 +7301,7 @@ void RemoveCapturedEnemiesFromSectorInfo( INT16 sMapX, INT16 sMapY, INT8 bMapZ ) //add a flag to the item so when all enemies are killed, we can run through and reveal all the enemies items usItemFlags |= WORLD_ITEM_DROPPED_FROM_ENEMY; - if ( Item[pObj->usItem].damageable && Item[pObj->usItem].usItemClass != IC_THROWING_KNIFE ) // Madd: drop crappier items from enemies on higher difficulty levels - note the quick fix for throwing knives + if (ItemIsDamageable(pObj->usItem) && Item[pObj->usItem].usItemClass != IC_THROWING_KNIFE ) // Madd: drop crappier items from enemies on higher difficulty levels - note the quick fix for throwing knives { // silversurfer: externalized this //(*pObj)[0]->data.objectStatus -= (gGameOptions.ubDifficultyLevel - 1) * Random( 20 ); @@ -9320,7 +9320,7 @@ BOOLEAN ProcessImplicationsOfPCAttack( SOLDIERTYPE * pSoldier, SOLDIERTYPE ** pp if ( gTacticalStatus.bBoxingState == BOXING ) { // should have a check for "in boxing ring", no? - if ( ( pSoldier->usAttackingWeapon != NOTHING && !Item[pSoldier->usAttackingWeapon].brassknuckles ) || !( pSoldier->flags.uiStatusFlags & SOLDIER_BOXER ) || pSoldier->IsRiotShieldEquipped() ) + if ( ( pSoldier->usAttackingWeapon != NOTHING && !ItemIsBrassKnuckles(pSoldier->usAttackingWeapon)) || !( pSoldier->flags.uiStatusFlags & SOLDIER_BOXER ) || pSoldier->IsRiotShieldEquipped() ) { // someone's cheating! if ( (Item[ pSoldier->usAttackingWeapon ].usItemClass == IC_BLADE || Item[ pSoldier->usAttackingWeapon ].usItemClass == IC_PUNCH) && (pTarget->flags.uiStatusFlags & SOLDIER_BOXER) ) @@ -9921,7 +9921,7 @@ SOLDIERTYPE *InternalReduceAttackBusyCount( ) pSoldier->bDoAutofire = 1; pSoldier->bDoBurst = TRUE; } - if ( Item[pSoldier->inv[ HANDPOS ].usItem].twohanded && Weapon[pSoldier->inv[ HANDPOS ].usItem].HeavyGun && gGameExternalOptions.ubAllowAlternativeWeaponHolding == 3 ) + if (ItemIsTwoHanded(pSoldier->inv[ HANDPOS ].usItem) && Weapon[pSoldier->inv[ HANDPOS ].usItem].HeavyGun && gGameExternalOptions.ubAllowAlternativeWeaponHolding == 3 ) pSoldier->bScopeMode = USE_ALT_WEAPON_HOLD; else pSoldier->bScopeMode = USE_BEST_SCOPE; diff --git a/Tactical/Points.cpp b/Tactical/Points.cpp index 81597a60d..ee07e3f06 100644 --- a/Tactical/Points.cpp +++ b/Tactical/Points.cpp @@ -2375,9 +2375,9 @@ INT16 MinAPsToShootOrStab(SOLDIERTYPE *pSoldier, INT32 sGridNo, INT16 bAimTime, // Do we need to stand up? bAPCost += GetAPsToChangeStance( pSoldier, ANIM_STAND ); } - else if(Item[usItem].rocketlauncher || Item[usItem].grenadelauncher || Item[usItem].mortar)//dnl ch72 260913 move this here from bottom, need to change as rocketlaucher could be fired from crouch too + else if(ItemIsRocketLauncher(usItem) || ItemIsGrenadeLauncher(usItem) || ItemIsMortar(usItem))//dnl ch72 260913 move this here from bottom, need to change as rocketlaucher could be fired from crouch too { - if(gAnimControl[pSoldier->usAnimState].ubEndHeight == ANIM_PRONE || Item[usItem].mortar && gAnimControl[pSoldier->usAnimState].ubEndHeight == ANIM_STAND) + if(gAnimControl[pSoldier->usAnimState].ubEndHeight == ANIM_PRONE || ItemIsMortar(usItem) && gAnimControl[pSoldier->usAnimState].ubEndHeight == ANIM_STAND) bAPCost += GetAPsToChangeStance(pSoldier, ANIM_CROUCH); else bAPCost += GetAPsToChangeStance(pSoldier, gAnimControl[pSoldier->usAnimState].ubEndHeight); @@ -2393,9 +2393,9 @@ INT16 MinAPsToShootOrStab(SOLDIERTYPE *pSoldier, INT32 sGridNo, INT16 bAimTime, if (!TileIsOutOfBounds(sGridNo)) { { - if(Item[usItem].rocketlauncher || Item[usItem].grenadelauncher || Item[usItem].mortar)//dnl ch72 260913 + if(ItemIsRocketLauncher(usItem) || ItemIsGrenadeLauncher(usItem) || ItemIsMortar(usItem))//dnl ch72 260913 { - if(gAnimControl[pSoldier->usAnimState].ubEndHeight == ANIM_PRONE || Item[usItem].mortar && gAnimControl[pSoldier->usAnimState].ubEndHeight == ANIM_STAND) + if(gAnimControl[pSoldier->usAnimState].ubEndHeight == ANIM_PRONE || ItemIsMortar(usItem) && gAnimControl[pSoldier->usAnimState].ubEndHeight == ANIM_STAND) usTurningCost = CalculateTurningCost(pSoldier, usItem, fAddingTurningCost, ANIM_CROUCH); else usTurningCost = CalculateTurningCost(pSoldier, usItem, fAddingTurningCost); @@ -2429,7 +2429,7 @@ INT16 MinAPsToShootOrStab(SOLDIERTYPE *pSoldier, INT32 sGridNo, INT16 bAimTime, // if attacking a new target (or if the specific target is uncertain) // Added check if the weapon is throwing knife/melee weapons - otherwise it would add APs for change target on cursor but not actually deduct them afterwards - SANDRO - if ( ubForceRaiseGunCost == TRUE || (( sGridNo != pSoldier->sLastTarget ) && !Item[usUBItem].rocketlauncher && ( Item[ usUBItem ].usItemClass != IC_THROWING_KNIFE )/* && ( Item[ usUBItem ].usItemClass != IC_PUNCH ) && ( Item[ usUBItem ].usItemClass != IC_BLADE )*/ ) )//dnl ch69 140913 //dnl ch73 290913 + if ( ubForceRaiseGunCost == TRUE || (( sGridNo != pSoldier->sLastTarget ) && !ItemIsRocketLauncher(usUBItem) && ( Item[ usUBItem ].usItemClass != IC_THROWING_KNIFE )/* && ( Item[ usUBItem ].usItemClass != IC_PUNCH ) && ( Item[ usUBItem ].usItemClass != IC_BLADE )*/ ) )//dnl ch69 140913 //dnl ch73 290913 { if ( pSoldier->IsValidAlternativeFireMode( bAimTime, sGridNo ) ) bAPCost += (APBPConstants[AP_CHANGE_TARGET] / 2); @@ -2635,13 +2635,13 @@ BOOLEAN EnoughAmmo( SOLDIERTYPE *pSoldier, BOOLEAN fDisplay, INT8 bInvPos ) OBJECTTYPE* pObjUsed = pSoldier->GetUsedWeapon( &(pSoldier->inv[bInvPos]) ); UINT16 usItemUsed = pSoldier->GetUsedWeaponNumber( &(pSoldier->inv[bInvPos]) ); - if ( Item[usItemUsed].singleshotrocketlauncher ) + if (ItemIsSingleShotRocketLauncher(usItemUsed)) { // hack... they turn empty afterwards anyways return( TRUE ); } - if (Item[ usItemUsed ].usItemClass == IC_LAUNCHER || Item[usItemUsed].cannon ) + if (Item[ usItemUsed ].usItemClass == IC_LAUNCHER || ItemIsCannon(usItemUsed)) { if ( FindAttachmentByClass( pObjUsed, IC_GRENADE ) != 0 ) { @@ -2661,7 +2661,7 @@ BOOLEAN EnoughAmmo( SOLDIERTYPE *pSoldier, BOOLEAN fDisplay, INT8 bInvPos ) } // WANNE: If there is a tank, it always have ammo to shoot, no check! - if (Item[usItemUsed].cannon) + if (ItemIsCannon(usItemUsed)) { return ( TRUE ); } @@ -2715,13 +2715,13 @@ void DeductAmmo( SOLDIERTYPE *pSoldier, OBJECTTYPE* pObj ) { // tanks never run out of MG ammo! // unlimited cannon ammo is handled in AI - if ( (ARMED_VEHICLE( pSoldier ) || ENEMYROBOT( pSoldier )) && !Item[pObj->usItem].cannon ) + if ( (ARMED_VEHICLE( pSoldier ) || ENEMYROBOT( pSoldier )) && !ItemIsCannon(pObj->usItem) ) return; - if ( Item[pObj->usItem].cannon ) + if (ItemIsCannon(pObj->usItem)) { } - else if ( Item[ pObj->usItem ].usItemClass == IC_GUN && !Item[pObj->usItem].cannon && pSoldier->bWeaponMode != WM_ATTACHED_GL && pSoldier->bWeaponMode != WM_ATTACHED_GL_BURST && pSoldier->bWeaponMode != WM_ATTACHED_GL_AUTO ) + else if ( Item[ pObj->usItem ].usItemClass == IC_GUN && !ItemIsCannon(pObj->usItem) && pSoldier->bWeaponMode != WM_ATTACHED_GL && pSoldier->bWeaponMode != WM_ATTACHED_GL_BURST && pSoldier->bWeaponMode != WM_ATTACHED_GL_AUTO ) { // Flugente: check for underbarrel weapons and use that object if necessary OBJECTTYPE* pObjUsed = pSoldier->GetUsedWeapon( pObj ); @@ -2754,7 +2754,7 @@ void DeductAmmo( SOLDIERTYPE *pSoldier, OBJECTTYPE* pObj ) gCampaignStats.AddConsumption(CAMPAIGN_CONSUMED_AMMO, (FLOAT)(Item[(*pObjUsed)[0]->data.gun.usGunAmmoItem].ubWeight) / (FLOAT)(Magazine[ Item[ (*pObjUsed)[0]->data.gun.usGunAmmoItem ].ubClassIndex ].ubMagSize ) ); } } - else if ( Item[ pObj->usItem ].usItemClass == IC_LAUNCHER || Item[pObj->usItem].cannon || pSoldier->bWeaponMode == WM_ATTACHED_GL || pSoldier->bWeaponMode == WM_ATTACHED_GL_BURST || pSoldier->bWeaponMode == WM_ATTACHED_GL_AUTO ) + else if ( Item[ pObj->usItem ].usItemClass == IC_LAUNCHER || ItemIsCannon(pObj->usItem) || pSoldier->bWeaponMode == WM_ATTACHED_GL || pSoldier->bWeaponMode == WM_ATTACHED_GL_BURST || pSoldier->bWeaponMode == WM_ATTACHED_GL_AUTO ) { OBJECTTYPE* pAttachment = FindAttachmentByClass( pObj, IC_GRENADE ); if ( !pAttachment->exists() ) @@ -3325,7 +3325,7 @@ INT16 GetAPsToReadyWeapon( SOLDIERTYPE *pSoldier, UINT16 usAnimState ) // If we are told to go to the alt weapon holding mode if ( gAnimControl[ usAnimState ].uiFlags & ( ANIM_ALT_WEAPON_HOLDING ) || (pSoldier->bScopeMode == USE_ALT_WEAPON_HOLD && usAnimState == INVALID_ANIMATION) )//dnl ch71 180913 { - if ( Item[ usItem ].twohanded ) + if (ItemIsTwoHanded(usItem)) { // Raising only to hip, either charge no APs or a portion of them ubReadyAPs = ((ubReadyAPs * gGameExternalOptions.ubToAltWeaponHoldReadyAPsPerc) + 99) / 100 ; // round up for rifles @@ -3339,7 +3339,7 @@ INT16 GetAPsToReadyWeapon( SOLDIERTYPE *pSoldier, UINT16 usAnimState ) // If we are told to go from alternative to standard weapon holding else if ( gAnimControl[ pSoldier->usAnimState ].uiFlags & ( ANIM_ALT_WEAPON_HOLDING ) ) { - if ( Item[ usItem ].twohanded ) + if (ItemIsTwoHanded(usItem)) { ubReadyAPs = ubReadyAPs * gGameExternalOptions.ubFromAltWeaponHoldReadyAPsPerc / 100; // round down for rifles } @@ -3703,7 +3703,7 @@ UINT16 GetTotalAPsToDropBomb( SOLDIERTYPE *pSoldier, INT32 sGridNo ) if ( sAPs > 0 ) { - if(Item[pSoldier->inv[HANDPOS].usItem].mine == 1) + if(ItemIsMine(pSoldier->inv[HANDPOS].usItem)) sAPs += GetAPsToPlantMine( pSoldier ); // changed by SANDRO else sAPs += GetAPsToDropBomb( pSoldier ); // changed by SANDRO @@ -4154,7 +4154,7 @@ INT32 GetBPCostPer10APsForGunHolding( SOLDIERTYPE * pSoldier, BOOLEAN fEstimate // Alternative weapon holding? if (( gAnimControl[ pSoldier->usAnimState ].uiFlags & ANIM_ALT_WEAPON_HOLDING ) || (fEstimate && pSoldier->bScopeMode == USE_ALT_WEAPON_HOLD) ) { - if ( Item[pSoldier->inv[pSoldier->ubAttackingHand].usItem].twohanded ) // firing from hip is not nearly ?n effort + if (ItemIsTwoHanded(pSoldier->inv[pSoldier->ubAttackingHand].usItem)) // firing from hip is not nearly ?n effort dModifier += 80; // only 20% cost if on hip else // holding pistol in one hand is worse in this case dModifier -= 25; // increased cost by 25% @@ -4265,7 +4265,7 @@ INT32 GetBPCostForRecoilkick( SOLDIERTYPE * pSoldier ) iKickPower = iKickPower * (100 - sWeaponWeight) / 100; // If one-handed gun, reduce it a bit, since the whole thing is somewhat different. - if ( !Item[pSoldier->inv[pSoldier->ubAttackingHand].usItem].twohanded ) + if ( !ItemIsTwoHanded(pSoldier->inv[pSoldier->ubAttackingHand].usItem) ) iKickPower = iKickPower * 3 / 4; // -25% // ::: overview ::: @@ -4310,7 +4310,7 @@ INT32 GetBPCostForRecoilkick( SOLDIERTYPE * pSoldier ) // Alternative weapon holding? if ( gAnimControl[ pSoldier->usAnimState ].uiFlags & ANIM_ALT_WEAPON_HOLDING ) { - if ( Item[pSoldier->inv[pSoldier->ubAttackingHand].usItem].twohanded ) // firing from hip makes the kicking rather diminishing + if (ItemIsTwoHanded(pSoldier->inv[pSoldier->ubAttackingHand].usItem)) // firing from hip makes the kicking rather diminishing dModifier += 80; // only 20% of the regular kick power else // holding pistol in one hand is worse in this case dModifier -= 33; // plus 33% power diff --git a/Tactical/RandomMerc.cpp b/Tactical/RandomMerc.cpp index bbb323f0d..0e0a24133 100644 --- a/Tactical/RandomMerc.cpp +++ b/Tactical/RandomMerc.cpp @@ -460,7 +460,7 @@ INVTYPE* GearGetRandomFaceItem(INT8 min_coolness = -1, INT8 max_coolness = -1, U if (HasItemFlag((*it)->uiIndex, SCUBA_MASK)) continue; - if (item_type == FACEITEM_GAS_MASK && (*it)->gasmask < 1) continue; + if (item_type == FACEITEM_GAS_MASK && !ItemIsGasmask((*it)->uiIndex)) continue; if (item_type == FACEITEM_SPECTACLES && (*it)->brightlightvisionrangebonus < 1) continue; if (item_type == FACEITEM_NVG && (*it)->nightvisionrangebonus < 1) continue; if (item_type == FACEITEM_HEADSET && (*it)->hearingrangebonus < 1) continue; @@ -643,7 +643,8 @@ std::vector GearFindAttachmentsForWeapon(INVTYPE* weapon, BOOL attach_ { INVTYPE* item = *it; - if (item->attachment < 1) + //if (item->attachment < 1) + if (!ItemIsAttachment(item->uiIndex)) continue; if (!ValidAttachment(item->uiIndex, weapon->uiIndex)) @@ -680,7 +681,7 @@ std::vector GearFindItemsForRole(std::vector* roles, std::vecto INVTYPE* item = *it; INT8 chance = 0; - if (item->glgrenade > 0) + if (ItemIsGLgrenade(item->uiIndex)) continue; if (item->attachmentclass == AC_GRENADE || item->attachmentclass == AC_ROCKET) @@ -1061,4 +1062,4 @@ void RandomizeMerc(UINT8 profile_id, MERCPROFILESTRUCT* merc, BOOL random_gear_k merc->usOptionalGearCost = kit_cost; } } -} \ No newline at end of file +} diff --git a/Tactical/Rotting Corpses.cpp b/Tactical/Rotting Corpses.cpp index 2293bfa69..5083ecc9a 100644 --- a/Tactical/Rotting Corpses.cpp +++ b/Tactical/Rotting Corpses.cpp @@ -1014,7 +1014,7 @@ BOOLEAN TurnSoldierIntoCorpse( SOLDIERTYPE *pSoldier, BOOLEAN fRemoveMerc, BOOLE { // and make sure that it really is a droppable item type // if ( !(Item[ pObj->usItem ].fFlags & ITEM_DEFAULT_UNDROPPABLE) ) - if ( !(Item[ pObj->usItem ].defaultundroppable ) ) + if ( !ItemIsUndroppableByDefault(pObj->usItem) ) { ReduceAmmoDroppedByNonPlayerSoldiers( pSoldier, cnt ); //if this soldier was an enemy @@ -1027,7 +1027,7 @@ BOOLEAN TurnSoldierIntoCorpse( SOLDIERTYPE *pSoldier, BOOLEAN fRemoveMerc, BOOLE //add a flag to the item so when all enemies are killed, we can run through and reveal all the enemies items usItemFlags |= WORLD_ITEM_DROPPED_FROM_ENEMY; - if ( Item[pObj->usItem].damageable && Item[pObj->usItem].usItemClass != IC_THROWING_KNIFE ) // Madd: drop crappier items from enemies on higher difficulty levels - note the quick fix for throwing knives + if (ItemIsDamageable(pObj->usItem) && Item[pObj->usItem].usItemClass != IC_THROWING_KNIFE ) // Madd: drop crappier items from enemies on higher difficulty levels - note the quick fix for throwing knives { // silversurfer: externalized this //(*pObj)[0]->data.objectStatus -= (gGameOptions.ubDifficultyLevel - 1) * Random(20); diff --git a/Tactical/ShopKeeper Interface.cpp b/Tactical/ShopKeeper Interface.cpp index 505ce3774..b58d61bbb 100644 --- a/Tactical/ShopKeeper Interface.cpp +++ b/Tactical/ShopKeeper Interface.cpp @@ -607,8 +607,6 @@ void EnableAllDealersOfferSlots( void ); void HatchOutInvSlot( UINT16 usPosX, UINT16 usPosY ); -extern BOOLEAN ItemIsARocketRifle( INT16 sItemIndex ); - #ifdef JA2TESTVERSION BOOLEAN gfTestDisplayDealerCash = FALSE; void DisplayAllDealersCash(); @@ -3392,8 +3390,7 @@ FLOAT ItemConditionModifier(UINT16 usItemIndex, INT16 bStatus) // an item at 100% is worth full price... -// if ( Item[ usItemIndex ].fFlags & ITEM_REPAIRABLE ) - if ( Item[ usItemIndex ].repairable ) + if (ItemIsRepairable(usItemIndex)) { // a REPAIRABLE item at 0% is still worth 50% of its full price, not 0% dConditionModifier = 0.5f + ( bStatus / (FLOAT)200 ); @@ -5007,8 +5004,7 @@ BOOLEAN IsGunOrAmmoOfSameTypeSelected( OBJECTTYPE *pItemObject ) } //if the highlighted object is an attachment -// if( Item[ pItemObject->usItem ].fFlags & ITEM_ATTACHMENT ) - if( Item[ pItemObject->usItem ].attachment ) + if(ItemIsAttachment(pItemObject->usItem)) { if( ValidAttachment( pItemObject->usItem, gpHighLightedItemObject ) ) return( TRUE ); @@ -5646,7 +5642,7 @@ void EvaluateItemAddedToPlayersOfferArea( INT8 bSlotID, BOOLEAN fFirstOne ) } //if the item is a rocket rifle - if( ItemIsARocketRifle( PlayersOfferArea[ bSlotID ].sItemIndex ) ) + if(ItemHasFingerPrintID( PlayersOfferArea[ bSlotID ].sItemIndex ) ) { fRocketRifleWasEvaluated = TRUE; } @@ -5716,8 +5712,7 @@ void EvaluateItemAddedToPlayersOfferArea( INT8 bSlotID, BOOLEAN fFirstOne ) if( armsDealerInfo[ gbSelectedArmsDealerID ].ubTypeOfArmsDealer == ARMS_DEALER_REPAIRS ) { // only otherwise repairable items count as actual rejections -// if ( Item[ PlayersOfferArea[ bSlotID ].sItemIndex ].fFlags & ITEM_REPAIRABLE ) - if ( Item[ PlayersOfferArea[ bSlotID ].sItemIndex ].repairable ) + if (ItemIsRepairable(PlayersOfferArea[bSlotID].sItemIndex)) { uiEvalResult = EVAL_RESULT_DONT_HANDLE; } @@ -6356,7 +6351,7 @@ void SplitComplexObjectIntoSubObjects( OBJECTTYPE *pComplexObject ) // strip off any loaded ammo/payload // Exception: don't do this with rocket launchers, their "shots left" are fake and this screws 'em up! - if ( !Item[usItem].singleshotrocketlauncher ) // Madd rpg - still do this + if ( !ItemIsSingleShotRocketLauncher(usItem)) // Madd rpg - still do this { pData->data.gun.usGunAmmoItem = NONE; pData->data.gun.ubGunShotsLeft = 0; diff --git a/Tactical/Soldier Ani.cpp b/Tactical/Soldier Ani.cpp index eda237d26..662bc460b 100644 --- a/Tactical/Soldier Ani.cpp +++ b/Tactical/Soldier Ani.cpp @@ -375,8 +375,8 @@ BOOLEAN AdjustToNextAnimationFrame( SOLDIERTYPE *pSoldier ) { // sevenfm: breaking window with crowbar code if (pSoldier->inv[HANDPOS].exists() && - (Item[pSoldier->inv[HANDPOS].usItem].crowbar && Item[pSoldier->inv[HANDPOS].usItem].usItemClass & (IC_PUNCH) || - Item[pSoldier->inv[HANDPOS].usItem].usItemClass & IC_GUN && Item[pSoldier->inv[HANDPOS].usItem].twohanded && Item[pSoldier->inv[HANDPOS].usItem].metal)) + (ItemIsCrowbar(pSoldier->inv[HANDPOS].usItem) && Item[pSoldier->inv[HANDPOS].usItem].usItemClass & (IC_PUNCH) || + Item[pSoldier->inv[HANDPOS].usItem].usItemClass & IC_GUN && ItemIsTwoHanded(pSoldier->inv[HANDPOS].usItem) && ItemIsMetal(pSoldier->inv[HANDPOS].usItem))) { INT32 sWindowGridNo = pSoldier->sTargetGridNo; if (pSoldier->ubDirection == NORTH || pSoldier->ubDirection == WEST) @@ -1135,10 +1135,10 @@ BOOLEAN AdjustToNextAnimationFrame( SOLDIERTYPE *pSoldier ) UINT16 usItem = pSoldier->pTempObject->usItem; UINT16 usBuddyItem = Item[usItem].usBuddyItem; if (pSoldier->pThrowParams->ubActionCode == THROW_ARM_ITEM && - (Item[usItem].flare || + (ItemIsFlare(usItem) || Explosive[Item[usItem].ubClassIndex].ubType == EXPLOSV_FLARE || Explosive[Item[usItem].ubClassIndex].ubType == EXPLOSV_BURNABLEGAS || - usBuddyItem && (Item[usBuddyItem].usItemClass & IC_EXPLOSV) && (Item[usBuddyItem].flare || Explosive[Item[usBuddyItem].ubClassIndex].ubType == EXPLOSV_FLARE))) + usBuddyItem && (Item[usBuddyItem].usItemClass & IC_EXPLOSV) && (ItemIsFlare(usBuddyItem) || Explosive[Item[usBuddyItem].ubClassIndex].ubType == EXPLOSV_FLARE))) { if ((pSoldier->iMuzFlash = LightSpriteCreate("L-R03.LHT", 0)) != -1) { @@ -1805,7 +1805,7 @@ BOOLEAN AdjustToNextAnimationFrame( SOLDIERTYPE *pSoldier ) if ( Item[ usItem ].usItemClass == IC_GUN ) { // if ( (Item[ usItem ].fFlags & ITEM_TWO_HANDED) ) - if ( (Item[ usItem ].twohanded ) ) + if (ItemIsTwoHanded(usItem)) { // Set to rifle ubRandomHandIndex = RANDOM_ANIM_RIFLEINHAND; @@ -2714,7 +2714,7 @@ BOOLEAN AdjustToNextAnimationFrame( SOLDIERTYPE *pSoldier ) case BIGBUY_STRECH: case FEM_KICKSN: case FEM_WIPE: - if ( pSoldier->inv[ HANDPOS ].exists() == true && Item[ pSoldier->inv[ HANDPOS ].usItem ].usItemClass == IC_GUN && Item[ pSoldier->inv[ HANDPOS ].usItem ].twohanded ) + if ( pSoldier->inv[ HANDPOS ].exists() == true && Item[ pSoldier->inv[ HANDPOS ].usItem ].usItemClass == IC_GUN && ItemIsTwoHanded(pSoldier->inv[ HANDPOS ].usItem) ) { pSoldier->EVENT_InitNewSoldierAnim( RAISE_RIFLE, 0 , FALSE ); return( TRUE ); @@ -4457,7 +4457,7 @@ void CheckForAndHandleSoldierIncompacitated( SOLDIERTYPE *pSoldier ) // SANDRO - if Martial Artist took someone down, always fall back if possible (for the fun) if ( pSoldier->ubAttackerID != NOBODY && gGameOptions.fNewTraitSystem ) { - if ( HAS_SKILL_TRAIT( MercPtrs[ pSoldier->ubAttackerID ], MARTIAL_ARTS_NT ) && (!MercPtrs[ pSoldier->ubAttackerID ]->usAttackingWeapon || Item[MercPtrs[ pSoldier->ubAttackerID ]->inv[HANDPOS].usItem].brassknuckles ) ) + if ( HAS_SKILL_TRAIT( MercPtrs[ pSoldier->ubAttackerID ], MARTIAL_ARTS_NT ) && (!MercPtrs[ pSoldier->ubAttackerID ]->usAttackingWeapon || ItemIsBrassKnuckles(MercPtrs[ pSoldier->ubAttackerID ]->inv[HANDPOS].usItem)) ) { fAlwaysFallBack = TRUE; } diff --git a/Tactical/Soldier Control.cpp b/Tactical/Soldier Control.cpp index 7ff397021..b80c9585d 100644 --- a/Tactical/Soldier Control.cpp +++ b/Tactical/Soldier Control.cpp @@ -3017,7 +3017,7 @@ BOOLEAN SOLDIERTYPE::EVENT_InitNewSoldierAnim( UINT16 usNewState, UINT16 usStart } else { - if (Item[usItem].flare || + if (ItemIsFlare(usItem) || Explosive[Item[usItem].ubClassIndex].ubType == EXPLOSV_SIGNAL_SMOKE || Explosive[Item[usItem].ubClassIndex].ubType == EXPLOSV_FLARE) { @@ -3159,7 +3159,7 @@ BOOLEAN SOLDIERTYPE::EVENT_InitNewSoldierAnim( UINT16 usNewState, UINT16 usStart // Going from shoulder stance to hip stance else if ( usNewState == READY_ALTERNATIVE_STAND && (gAnimControl[this->usAnimState].uiFlags & (ANIM_FIREREADY | ANIM_FIRE)) ) { - if ( Item[this->inv[HANDPOS].usItem].twohanded ) + if (ItemIsTwoHanded(this->inv[HANDPOS].usItem)) usStartingAniCode = 1; else usStartingAniCode = 2; @@ -3278,7 +3278,7 @@ BOOLEAN SOLDIERTYPE::EVENT_InitNewSoldierAnim( UINT16 usNewState, UINT16 usStart // 1) We have a rifle in hand... //usItem = this->inv[ HANDPOS ].usItem; - if ( this->inv[HANDPOS].exists( ) == true && (Item[usItem].twohanded) && !Item[usItem].rocketlauncher ) + if ( this->inv[HANDPOS].exists( ) == true && ItemIsTwoHanded(usItem) && !ItemIsRocketLauncher(usItem) ) { // Switch on height! switch ( gAnimControl[this->usAnimState].ubEndHeight ) @@ -3301,7 +3301,7 @@ BOOLEAN SOLDIERTYPE::EVENT_InitNewSoldierAnim( UINT16 usNewState, UINT16 usStart // 1) We have a rifle in hand... //usItem = this->inv[ HANDPOS ].usItem; - if ( this->inv[HANDPOS].exists( ) == true && (Item[usItem].twohanded) && !Item[usItem].rocketlauncher ) + if ( this->inv[HANDPOS].exists( ) == true && ItemIsTwoHanded(usItem) && !ItemIsRocketLauncher(usItem) ) { // Switch on height! switch ( gAnimControl[this->usAnimState].ubEndHeight ) @@ -3429,10 +3429,10 @@ BOOLEAN SOLDIERTYPE::EVENT_InitNewSoldierAnim( UINT16 usNewState, UINT16 usStart if ( this->inv[HANDPOS].exists( ) == true ) { - if ( Item[usItem].usItemClass == IC_GUN && !Item[usItem].rocketlauncher ) + if ( Item[usItem].usItemClass == IC_GUN && !ItemIsRocketLauncher(usItem) ) { // if ( (Item[ usItem ].fFlags & ITEM_TWO_HANDED) ) - if ( (Item[usItem].twohanded) ) + if (ItemIsTwoHanded(usItem)) { usNewState = BIGMERC_CROUCH_TRANS_INTO; } @@ -3449,10 +3449,10 @@ BOOLEAN SOLDIERTYPE::EVENT_InitNewSoldierAnim( UINT16 usNewState, UINT16 usStart if ( this->inv[HANDPOS].exists( ) == true ) { - if ( Item[usItem].usItemClass == IC_GUN && !Item[usItem].rocketlauncher ) + if ( Item[usItem].usItemClass == IC_GUN && !ItemIsRocketLauncher(usItem) ) { // if ( (Item[ usItem ].fFlags & ITEM_TWO_HANDED) ) - if ( (Item[usItem].twohanded) ) + if (ItemIsTwoHanded(usItem)) { usNewState = BIGMERC_CROUCH_TRANS_OUTOF; } @@ -3477,7 +3477,7 @@ BOOLEAN SOLDIERTYPE::EVENT_InitNewSoldierAnim( UINT16 usNewState, UINT16 usStart if ( ((gAnimControl[this->usAnimState].uiFlags & ANIM_FIREREADY) || (gAnimControl[this->usAnimState].uiFlags & ANIM_FIRE)) && gGameExternalOptions.fAllowWalkingWithWeaponRaised ) { - if ( this->inv[HANDPOS].exists( ) == true && Item[usItem].usItemClass == IC_GUN && !Item[usItem].rocketlauncher ) + if ( this->inv[HANDPOS].exists( ) == true && Item[usItem].usItemClass == IC_GUN && !ItemIsRocketLauncher(usItem) ) { if ( gAnimControl[this->usAnimState].ubEndHeight == ANIM_STAND ) { @@ -3524,7 +3524,7 @@ BOOLEAN SOLDIERTYPE::EVENT_InitNewSoldierAnim( UINT16 usNewState, UINT16 usStart { if ( gAnimControl[this->usAnimState].ubEndHeight == ANIM_CROUCH ) { - if ( this->inv[HANDPOS].exists( ) == true && Item[usItem].usItemClass == IC_GUN && Item[usItem].twohanded && !Item[usItem].rocketlauncher ) + if ( this->inv[HANDPOS].exists( ) == true && Item[usItem].usItemClass == IC_GUN && ItemIsTwoHanded(usItem) && !ItemIsRocketLauncher(usItem) ) usNewState = SWAT_BACKWARDS; else usNewState = SWAT_BACKWARDS_NOTHING; @@ -3595,7 +3595,7 @@ BOOLEAN SOLDIERTYPE::EVENT_InitNewSoldierAnim( UINT16 usNewState, UINT16 usStart // SANDRO - check if we are gonna move with weapon raised else if ( gGameExternalOptions.fAllowWalkingWithWeaponRaised && ( (gAnimControl[this->usAnimState].uiFlags & ANIM_FIREREADY) || (gAnimControl[this->usAnimState].uiFlags & ANIM_FIRE) ) ) { - if ( this->inv[HANDPOS].exists( ) == true && Item[usItem].usItemClass == IC_GUN && !Item[usItem].rocketlauncher ) + if ( this->inv[HANDPOS].exists( ) == true && Item[usItem].usItemClass == IC_GUN && !ItemIsRocketLauncher(usItem) ) { if ( usNewState == WALKING ) { @@ -3618,7 +3618,7 @@ BOOLEAN SOLDIERTYPE::EVENT_InitNewSoldierAnim( UINT16 usNewState, UINT16 usStart { usNewState = CROUCHEDMOVE_DUAL_READY; } - else if ( !Item[this->inv[HANDPOS].usItem].twohanded ) + else if (!ItemIsTwoHanded(this->inv[HANDPOS].usItem)) { usNewState = CROUCHEDMOVE_PISTOL_READY; } @@ -3991,7 +3991,7 @@ BOOLEAN SOLDIERTYPE::EVENT_InitNewSoldierAnim( UINT16 usNewState, UINT16 usStart case PLANT_BOMB: - if ( Item[this->inv[HANDPOS].usItem].mine == 1 ) // bury a mine + if (ItemIsMine(this->inv[HANDPOS].usItem)) // bury a mine DeductPoints( this, GetAPsToPlantMine( this ), APBPConstants[BP_BURY_MINE] ); // changed by SANDRO else DeductPoints( this, GetAPsToDropBomb( this ), APBPConstants[BP_DROP_BOMB] ); // changed by SANDRO @@ -4960,9 +4960,9 @@ void SOLDIERTYPE::EVENT_FireSoldierWeapon( INT32 sTargetGridNo ) usItem = GetAttachedGrenadeLauncher( &this->inv[HANDPOS] ); else usItem = this->inv[HANDPOS].usItem; - if ( Item[usItem].rocketlauncher || Item[usItem].grenadelauncher || Item[usItem].mortar ) + if (ItemIsRocketLauncher(usItem) || ItemIsGrenadeLauncher(usItem) || ItemIsMortar(usItem) ) { - if ( gAnimControl[this->usAnimState].ubEndHeight == ANIM_PRONE || Item[usItem].mortar && gAnimControl[this->usAnimState].ubEndHeight == ANIM_STAND ) + if ( gAnimControl[this->usAnimState].ubEndHeight == ANIM_PRONE || ItemIsMortar(usItem) && gAnimControl[this->usAnimState].ubEndHeight == ANIM_STAND ) SendChangeSoldierStanceEvent( this, ANIM_CROUCH ); fDoFireRightAway = TRUE; } @@ -5118,7 +5118,7 @@ UINT16 SelectFireAnimation( SOLDIERTYPE *pSoldier, UINT8 ubHeight ) } // Check for rocket laucncher.... - if ( Item[pSoldier->inv[HANDPOS].usItem].rocketlauncher ) + if (ItemIsRocketLauncher(pSoldier->inv[HANDPOS].usItem)) { //***ddd if shoot crouched if ( ubHeight == ANIM_STAND ) @@ -5128,14 +5128,14 @@ UINT16 SelectFireAnimation( SOLDIERTYPE *pSoldier, UINT8 ubHeight ) } // Check for mortar.... - if ( Item[pSoldier->inv[HANDPOS].usItem].mortar ) + if (ItemIsMortar(pSoldier->inv[HANDPOS].usItem)) { DebugMsg( TOPIC_JA2, DBG_LEVEL_3, "SelectFireAnimation: shoot_mortar" ); return(SHOOT_MORTAR); } // Check for tank cannon - if ( Item[pSoldier->inv[HANDPOS].usItem].cannon ) + if (ItemIsCannon(pSoldier->inv[HANDPOS].usItem)) { return(TANK_SHOOT); } @@ -5447,7 +5447,7 @@ BOOLEAN SOLDIERTYPE::InternalSoldierReadyWeapon( UINT8 sFacingDir, BOOLEAN fEndR } //dnl ch72 270913 ugly but fast fix for not charging turning APs as there is no fire ready animation for mortars and rocket launchers UINT16 usItem = this->inv[HANDPOS].usItem; - if ( Item[usItem].rocketlauncher || Item[usItem].mortar ) + if (ItemIsRocketLauncher(usItem) || ItemIsMortar(usItem) ) usForceAnimState = this->usAnimState; EVENT_InternalSetSoldierDesiredDirection( this, sFacingDir, FALSE, usAnimState ); usForceAnimState = INVALID_ANIMATION; @@ -5535,12 +5535,12 @@ UINT16 PickSoldierReadyAnimation( SOLDIERTYPE *pSoldier, BOOLEAN fEndReady, BOOL } // Check if we have a gun..... - if ( Item[pSoldier->inv[HANDPOS].usItem].usItemClass != IC_GUN && !Item[pSoldier->inv[HANDPOS].usItem].grenadelauncher ) + if ( Item[pSoldier->inv[HANDPOS].usItem].usItemClass != IC_GUN && !ItemIsGrenadeLauncher(pSoldier->inv[HANDPOS].usItem) ) { return(INVALID_ANIMATION); } - if ( Item[pSoldier->inv[HANDPOS].usItem].rocketlauncher ) + if (ItemIsRocketLauncher(pSoldier->inv[HANDPOS].usItem)) { return(INVALID_ANIMATION); } @@ -5621,7 +5621,7 @@ UINT16 PickSoldierReadyAnimation( SOLDIERTYPE *pSoldier, BOOLEAN fEndReady, BOOL // this is a specific situation when we have a gun in standard holding (shouldered rifle/two-hand pistol) and was told to go to alternative holding else if ( (gAnimControl[pSoldier->usAnimState].uiFlags & (ANIM_FIREREADY | ANIM_FIRE)) && !(gAnimControl[pSoldier->usAnimState].uiFlags & (ANIM_ALT_WEAPON_HOLDING)) && fAltWeaponHolding && gGameExternalOptions.ubAllowAlternativeWeaponHolding == 3 && pSoldier->bScopeMode == -1 && gAnimControl[pSoldier->usAnimState].ubEndHeight == ANIM_STAND - && ((!Item[pSoldier->inv[HANDPOS].usItem].twohanded && !pSoldier->IsValidSecondHandShot( ) && !pSoldier->MercInWater( )) || Item[pSoldier->inv[HANDPOS].usItem].twohanded) ) + && ((!ItemIsTwoHanded(pSoldier->inv[HANDPOS].usItem) && !pSoldier->IsValidSecondHandShot( ) && !pSoldier->MercInWater( )) || ItemIsTwoHanded(pSoldier->inv[HANDPOS].usItem)) ) { return(READY_ALTERNATIVE_STAND); } @@ -5641,7 +5641,7 @@ UINT16 PickSoldierReadyAnimation( SOLDIERTYPE *pSoldier, BOOLEAN fEndReady, BOOL { if ( gGameExternalOptions.ubAllowAlternativeWeaponHolding ) { - if ( fAltWeaponHolding || (Weapon[pSoldier->inv[pSoldier->ubAttackingHand].usItem].HeavyGun && Item[pSoldier->inv[HANDPOS].usItem].twohanded) ) + if ( fAltWeaponHolding || (Weapon[pSoldier->inv[pSoldier->ubAttackingHand].usItem].HeavyGun && ItemIsTwoHanded(pSoldier->inv[HANDPOS].usItem)) ) { return(READY_ALTERNATIVE_STAND); } @@ -5877,7 +5877,7 @@ void SOLDIERTYPE::EVENT_SoldierGotHit( UINT16 usWeaponIndex, INT16 sDamage, INT1 { if ( ubAttackerID != NOBODY ) { - if ( !(MercPtrs[ubAttackerID]->inv[HANDPOS].exists( )) || Item[MercPtrs[ubAttackerID]->inv[HANDPOS].usItem].brassknuckles ) + if ( !(MercPtrs[ubAttackerID]->inv[HANDPOS].exists( )) || ItemIsBrassKnuckles(MercPtrs[ubAttackerID]->inv[HANDPOS].usItem) ) { // with enhanced CCS, make the lost breath harder to regenerate, which makes CQC more usable if ( gGameExternalOptions.fEnhancedCloseCombatSystem ) @@ -5944,7 +5944,7 @@ void SOLDIERTYPE::EVENT_SoldierGotHit( UINT16 usWeaponIndex, INT16 sDamage, INT1 if ( HasItemFlag( usWeaponIndex, TASER ) ) { // tasers need batteries, because I say so - if ( Item[usWeaponIndex].needsbatteries ) + if (ItemNeedsBatteries(usWeaponIndex)) { // check for batteries OBJECTTYPE* pBatteries = FindAttachedBatteries( &(MercPtrs[ubAttackerID]->inv[HANDPOS]) ); @@ -9734,7 +9734,7 @@ BOOLEAN SOLDIERTYPE::CanClimbWithCurrentBackpack() // only apply backpack climbing limitations to player mercs if (UsingNewInventorySystem() == true && this->inv[BPACKPOCKPOS].exists() == true && this->bTeam == OUR_TEAM && ((gGameExternalOptions.sBackpackWeightToClimb == -1) || (INT16)this->inv[BPACKPOCKPOS].GetWeightOfObjectInStack() + Item[this->inv[BPACKPOCKPOS].usItem].sBackpackWeightModifier > gGameExternalOptions.sBackpackWeightToClimb) - && ((gGameExternalOptions.fUseGlobalBackpackSettings == TRUE) || (Item[this->inv[BPACKPOCKPOS].usItem].fAllowClimbing == FALSE))) + && ((gGameExternalOptions.fUseGlobalBackpackSettings == TRUE) || !ItemAllowsClimbing(this->inv[BPACKPOCKPOS].usItem))) return FALSE; return TRUE; @@ -10439,7 +10439,7 @@ UINT8 SOLDIERTYPE::SoldierTakeDamage( INT8 bHeight, INT16 sLifeDeduct, INT16 sBr && this->HasDiseaseWithFlag( DISEASE_PROPERTY_LIMITED_USE_ARMS ) ) { // drop item in main hand if twohanded - if ( this->inv[HANDPOS].exists() == true && TwoHandedItem( this->inv[HANDPOS].usItem ) ) + if ( this->inv[HANDPOS].exists() == true && ItemIsTwoHanded( this->inv[HANDPOS].usItem ) ) dropiteminmainhand = true; // we can only use one hand, so drop items in second hand @@ -12763,9 +12763,9 @@ void SOLDIERTYPE::EVENT_SoldierBeginPunchAttack( INT32 sGridNo, UINT8 ubDirectio //Ja25 No meanwhiles #ifdef JA2UB - if ( fMartialArtist && !Item[usItem].crowbar && this->ubBodyType == REGMALE ) + if ( fMartialArtist && !ItemIsCrowbar(usItem) && this->ubBodyType == REGMALE ) #else - if ( fMartialArtist && !AreInMeanwhile( ) && !Item[usItem].crowbar && this->ubBodyType == REGMALE && !IsZombie( ) + if ( fMartialArtist && !AreInMeanwhile( ) && !ItemIsCrowbar(usItem) && this->ubBodyType == REGMALE && !IsZombie( ) && !( gGameExternalOptions.fDiseaseSevereLimitations && this->HasDiseaseWithFlag( DISEASE_PROPERTY_LIMITED_USE_LEGS )) ) // SANDRO - added check for body type #endif { @@ -12871,7 +12871,7 @@ void SOLDIERTYPE::EVENT_SoldierBeginPunchAttack( INT32 sGridNo, UINT8 ubDirectio case ANIM_STAND: case ANIM_CROUCH: - if ( !Item[usItem].crowbar ) + if ( !ItemIsCrowbar(usItem) ) { BOOLEAN fCannotKick = (ubDirection & 1); // SANDRO - we will determine here what type of punch we are gonna use @@ -13095,7 +13095,7 @@ void SOLDIERTYPE::EVENT_SoldierBeginDropBomb( ) void SOLDIERTYPE::EVENT_SoldierDefuseTripwire( INT32 sGridNo, INT32 sItem ) { // Flugente: if item is tripwireactivated and is a planted bomb, call the defuse dialogue. We obviously know about the item's existence already... - if ( gWorldItems[sItem].object.exists( ) && gWorldItems[sItem].object.fFlags & OBJECT_ARMED_BOMB && Item[gWorldItems[sItem].object.usItem].tripwire == 1 ) + if ( gWorldItems[sItem].object.exists( ) && gWorldItems[sItem].object.fFlags & OBJECT_ARMED_BOMB && ItemIsTripwire(gWorldItems[sItem].object.usItem) ) { // Increment the number of people busy doing stuff because of an attack switch ( gAnimControl[this->usAnimState].ubHeight ) @@ -13148,7 +13148,7 @@ void SOLDIERTYPE::EVENT_SoldierBeginFirstAid( INT32 sGridNo, UINT8 ubDirection ) //SANDRO - hack! Find out if we are a doctor with medical bag trying to make a surgery this->fDoingSurgery = FALSE; - if ( (NUM_SKILL_TRAITS( this, DOCTOR_NT ) >= gSkillTraitValues.ubDONumberTraitsNeededForSurgery) && Item[this->inv[HANDPOS].usItem].medicalkit && gGameOptions.fNewTraitSystem ) + if ( (NUM_SKILL_TRAITS( this, DOCTOR_NT ) >= gSkillTraitValues.ubDONumberTraitsNeededForSurgery) && ItemIsMedicalKit(this->inv[HANDPOS].usItem) && gGameOptions.fNewTraitSystem ) { if ( ((pTSoldier->bTeam == OUR_TEAM) || (pTSoldier->bTeam == MILITIA_TEAM)) && (IS_MERC_BODY_TYPE( pTSoldier ) || IS_CIV_BODY_TYPE( pTSoldier )) @@ -13320,7 +13320,7 @@ UINT32 SOLDIERTYPE::SoldierDressWound( SOLDIERTYPE *pVictim, INT16 sKitPts, INT1 // Flugente: AI medics are allowed to perform surgery without first aid kits, and can do this on themselves if ( pVictim->iHealableInjury > 0 && this->fDoingSurgery && (this->ubID != pVictim->ubID || (gGameExternalOptions.fEnemyMedicsHealSelf && this->bTeam == ENEMY_TEAM)) && gGameOptions.fNewTraitSystem && (NUM_SKILL_TRAITS( this, DOCTOR_NT ) >= gSkillTraitValues.ubDONumberTraitsNeededForSurgery) - && (Item[this->inv[HANDPOS].usItem].medicalkit || this->bTeam == ENEMY_TEAM) ) + && (ItemIsMedicalKit(this->inv[HANDPOS].usItem) || this->bTeam == ENEMY_TEAM) ) { fOnSurgery = TRUE; } @@ -13359,7 +13359,7 @@ UINT32 SOLDIERTYPE::SoldierDressWound( SOLDIERTYPE *pVictim, INT16 sKitPts, INT1 return(0); // using the GOOD medic stuff - if ( Item[this->inv[HANDPOS].usItem].medicalkit && !(fOnSurgery) ) // added check + if (ItemIsMedicalKit(this->inv[HANDPOS].usItem) && !(fOnSurgery) ) // added check { uiPossible += (uiPossible / 2); // add extra 50 % } @@ -13417,7 +13417,7 @@ UINT32 SOLDIERTYPE::SoldierDressWound( SOLDIERTYPE *pVictim, INT16 sKitPts, INT1 } // now make sure we HAVE that much - if ( Item[this->inv[HANDPOS].usItem].medicalkit ) + if (ItemIsMedicalKit(this->inv[HANDPOS].usItem)) { if ( fOnSurgery ) uiMedcost = (uiActual * gSkillTraitValues.usDOSurgeryMedBagConsumption) / 100; // surgery drains the kit a lot @@ -13665,7 +13665,7 @@ UINT32 SOLDIERTYPE::SoldierDressWound( SOLDIERTYPE *pVictim, INT16 sKitPts, INT1 // usedAPs equals (actionPts) * (%of possible points actually used) uiUsedAPs = (uiActual * uiAvailAPs) / uiPossible; - if ( Item[this->inv[HANDPOS].usItem].medicalkit && !(fOnSurgery) ) // using the GOOD medic stuff + if (ItemIsMedicalKit(this->inv[HANDPOS].usItem) && !(fOnSurgery) ) // using the GOOD medic stuff { uiUsedAPs = (uiUsedAPs * 2) / 3; // reverse 50% bonus by taking 2/3rds } @@ -14071,7 +14071,7 @@ void SOLDIERTYPE::ReLoadSoldierAnimationDueToHandItemChange( UINT16 usOldItem, U this->bWeaponMode = WM_ATTACHED_GL; } - if ( Item[usNewItem].twohanded && Weapon[usNewItem].HeavyGun && gGameExternalOptions.ubAllowAlternativeWeaponHolding == 3 ) + if (ItemIsTwoHanded(usNewItem) && Weapon[usNewItem].HeavyGun && gGameExternalOptions.ubAllowAlternativeWeaponHolding == 3 ) this->bScopeMode = USE_ALT_WEAPON_HOLD; else this->bScopeMode = USE_BEST_SCOPE; @@ -14094,8 +14094,7 @@ void SOLDIERTYPE::ReLoadSoldierAnimationDueToHandItemChange( UINT16 usOldItem, U { if ( Item[usOldItem].usItemClass == IC_GUN ) { - // if ( (Item[ usOldItem ].fFlags & ITEM_TWO_HANDED) && usOldItem != ROCKET_LAUNCHER ) - if ( (Item[usOldItem].twohanded) && !Item[usOldItem].rocketlauncher ) + if (ItemIsTwoHanded(usOldItem) && !ItemIsRocketLauncher(usOldItem)) { fOldRifle = TRUE; } @@ -14106,8 +14105,7 @@ void SOLDIERTYPE::ReLoadSoldierAnimationDueToHandItemChange( UINT16 usOldItem, U { if ( Item[usNewItem].usItemClass == IC_GUN ) { - // if ( (Item[ usNewItem ].fFlags & ITEM_TWO_HANDED) && usNewItem != ROCKET_LAUNCHER ) - if ( (Item[usNewItem].twohanded) && !Item[usNewItem].rocketlauncher ) + if (ItemIsTwoHanded(usNewItem) && !ItemIsRocketLauncher(usNewItem)) { fNewRifle = TRUE; } @@ -14632,7 +14630,7 @@ BOOLEAN SOLDIERTYPE::SoldierCarriesTwoHandedWeapon( void ) usItem = this->inv[HANDPOS].usItem; - if ( this->inv[HANDPOS].exists( ) == true && (Item[usItem].twohanded) ) + if ( this->inv[HANDPOS].exists( ) == true && ItemIsTwoHanded(usItem) ) { return(TRUE); } @@ -15529,7 +15527,7 @@ BOOLEAN SOLDIERTYPE::LooksLikeACivilian( void ) { // if that item is a gun, explosives, military armour or facewear, we're screwed if ( (Item[this->inv[bLoop].usItem].usItemClass & (IC_WEAPON | IC_GRENADE | IC_BOMB)) || - ((Item[this->inv[bLoop].usItem].usItemClass & (IC_ARMOUR)) && !Item[this->inv[bLoop].usItem].leatherjacket && Armour[Item[this->inv[bLoop].usItem].ubClassIndex].ubProtection > 10) || + ((Item[this->inv[bLoop].usItem].usItemClass & (IC_ARMOUR)) && !ItemIsLeatherJacket(this->inv[bLoop].usItem) && Armour[Item[this->inv[bLoop].usItem].ubClassIndex].ubProtection > 10) || (Item[this->inv[bLoop].usItem].nightvisionrangebonus > 0 || Item[this->inv[bLoop].usItem].hearingrangebonus > 0) ) { @@ -15551,7 +15549,7 @@ BOOLEAN SOLDIERTYPE::LooksLikeACivilian( void ) { // if that item is a gun, explosives, military armour or facewear, we're screwed if ( (Item[this->inv[bLoop].usItem].usItemClass & (IC_WEAPON | IC_GRENADE | IC_BOMB)) || - ((Item[this->inv[bLoop].usItem].usItemClass & (IC_ARMOUR)) && !Item[this->inv[bLoop].usItem].leatherjacket && Armour[Item[this->inv[bLoop].usItem].ubClassIndex].ubProtection > 10) || + ((Item[this->inv[bLoop].usItem].usItemClass & (IC_ARMOUR)) && !ItemIsLeatherJacket(this->inv[bLoop].usItem) && Armour[Item[this->inv[bLoop].usItem].ubClassIndex].ubProtection > 10) || (Item[this->inv[bLoop].usItem].nightvisionrangebonus > 0 || Item[this->inv[bLoop].usItem].hearingrangebonus > 0) ) { @@ -16848,7 +16846,7 @@ void SOLDIERTYPE::DropSectorEquipment( ) if ( pObj->exists( ) ) { // Check if it's supposed to be dropped - if ( !((*pObj).fFlags & OBJECT_UNDROPPABLE) && !(Item[pObj->usItem].defaultundroppable) && (*pObj)[0]->data.sObjectFlag & TAKEN_BY_MILITIA ) + if ( !((*pObj).fFlags & OBJECT_UNDROPPABLE) && !ItemIsUndroppableByDefault(pObj->usItem) && (*pObj)[0]->data.sObjectFlag & TAKEN_BY_MILITIA ) { (*pObj)[0]->data.sObjectFlag &= ~TAKEN_BY_MILITIA; @@ -16874,7 +16872,7 @@ void SOLDIERTYPE::DropSectorEquipment( ) if ( pObj->exists( ) ) { // Check if it's supposed to be dropped - if ( !((*pObj).fFlags & OBJECT_UNDROPPABLE) && !(Item[pObj->usItem].defaultundroppable) && (*pObj)[0]->data.sObjectFlag & TAKEN_BY_MILITIA ) + if ( !((*pObj).fFlags & OBJECT_UNDROPPABLE) && !ItemIsUndroppableByDefault(pObj->usItem) && (*pObj)[0]->data.sObjectFlag & TAKEN_BY_MILITIA ) { (*pObj)[0]->data.sObjectFlag &= ~TAKEN_BY_MILITIA; @@ -16944,12 +16942,13 @@ void SOLDIERTYPE::TakeNewBombFromInventory( UINT16 usItem ) // take tripwire-activated item only if used item is tripwire activated for ( i = 0; i < invsize; i++ ) { + UINT16 usItem = this->inv[i].usItem; if ( this->inv[i].exists( ) == true && - Item[this->inv[i].usItem].usItemClass == IC_BOMB && - Item[this->inv[i].usItem].ubCursor == BOMBCURS && - !Item[this->inv[i].usItem].tripwire && - ((Item[this->inv[i].usItem].tripwireactivation && Item[usItem].tripwireactivation) || - (!Item[this->inv[i].usItem].tripwireactivation && !Item[usItem].tripwireactivation)) ) + Item[usItem].usItemClass == IC_BOMB && + Item[usItem].ubCursor == BOMBCURS && + !ItemIsTripwire(usItem) && + ((ItemHasTripwireActivation(usItem) && ItemHasTripwireActivation(usItem)) || + (!ItemHasTripwireActivation(usItem) && !ItemHasTripwireActivation(usItem))) ) { this->inv[i].MoveThisObjectTo( this->inv[HANDPOS], 1, this ); return; @@ -17072,7 +17071,7 @@ void SOLDIERTYPE::SwitchWeapons( BOOLEAN fKnife, BOOLEAN fSideArm ) else handCanMove = (CanItemFitInPosition( this, &this->inv[HANDPOS], handobjstorageslot, FALSE ) || (this->inv[HANDPOS].exists( ) == false && this->inv[SECONDHANDPOS].exists( ) == false)); - if ( Item[this->inv[retrieveslot].usItem].twohanded && this->inv[SECONDHANDPOS].exists( ) == true ) + if ( ItemIsTwoHanded(this->inv[retrieveslot].usItem) && this->inv[SECONDHANDPOS].exists( ) == true ) searchitemCanMove = FALSE; else searchitemCanMove = (CanItemFitInPosition( this, &this->inv[retrieveslot], HANDPOS, FALSE ) || this->inv[retrieveslot].exists( ) == false); @@ -17171,7 +17170,7 @@ INT8 SOLDIERTYPE::GetTraitCTHModifier( UINT16 usItem, INT16 ubAimTime, UINT8 ubT { // Bonus for heavy weapons moved here from above to get instant CtH bonus and not marksmanship bonus, // which is supressed by weapon condition - if ( Item[usItem].rocketlauncher || Item[usItem].singleshotrocketlauncher ) + if (ItemIsRocketLauncher(usItem) || ItemIsSingleShotRocketLauncher(usItem)) { modifier += gSkillTraitValues.bCtHModifierRocketLaunchers; // -25% for untrained mercs !!! @@ -17867,7 +17866,7 @@ void SOLDIERTYPE::SoldierPropertyUpkeep( ) if ( this->usSkillCooldown[SOLDIER_COOLDOWN_DRUGUSER_COMBAT] ) this->usSkillCooldown[SOLDIER_COOLDOWN_DRUGUSER_COMBAT]--; - if (AM_A_ROBOT(this) && Item[this->inv[ROBOT_UTILITY_SLOT].usItem].xray == 1) + if (AM_A_ROBOT(this) && ItemHasXRay(this->inv[ROBOT_UTILITY_SLOT].usItem)) { if (this->usSkillCooldown[SOLDIER_COOLDOWN_ROBOT_XRAY]) this->usSkillCooldown[SOLDIER_COOLDOWN_ROBOT_XRAY]--; @@ -18555,7 +18554,7 @@ BOOLEAN SOLDIERTYPE::HasMortar( ) INT8 invsize = (INT8)inv.size( ); // remember inventorysize, so we don't call size() repeatedly for ( INT8 bLoop = 0; bLoop < invsize; ++bLoop ) { - if ( inv[bLoop].exists( ) == true && Item[inv[bLoop].usItem].mortar ) + if ( inv[bLoop].exists( ) == true && ItemIsMortar(inv[bLoop].usItem) ) { return TRUE; } @@ -18571,7 +18570,7 @@ BOOLEAN SOLDIERTYPE::GetSlotOfSignalShellIfMortar( UINT8* pbLoop ) INT8 invsize = (INT8)inv.size( ); // remember inventorysize, so we don't call size() repeatedly for ( INT8 bLoop = 0; bLoop < invsize; ++bLoop ) { - if ( inv[bLoop].exists( ) == true && Item[inv[bLoop].usItem].mortar ) + if ( inv[bLoop].exists( ) == true && ItemIsMortar(inv[bLoop].usItem) ) { mortaritem = inv[bLoop].usItem; break; @@ -18590,7 +18589,7 @@ BOOLEAN SOLDIERTYPE::GetSlotOfSignalShellIfMortar( UINT8* pbLoop ) return TRUE; } - if ( Item[inv[bLoop].usItem].mortar ) + if (ItemIsMortar(inv[bLoop].usItem)) { OBJECTTYPE* pAttObj = FindAttachmentByClass( &(inv[bLoop]), IC_BOMB ); @@ -18878,7 +18877,7 @@ BOOLEAN SOLDIERTYPE::OrderArtilleryStrike( UINT32 usSectorNr, INT32 sTargetGridN for ( INT8 bLoop = 0; (bLoop < invsize) && (mortaritemcnt < maxFiringMortarsAmount); ++bLoop ) { - if ( pSoldier->inv[bLoop].exists( ) == true && Item[pSoldier->inv[bLoop].usItem].mortar ) + if ( pSoldier->inv[bLoop].exists( ) == true && ItemIsMortar(pSoldier->inv[bLoop].usItem)) { // if not already in list, remember this mortar bool alreadyInList = false; @@ -18923,7 +18922,7 @@ BOOLEAN SOLDIERTYPE::OrderArtilleryStrike( UINT32 usSectorNr, INT32 sTargetGridN { if ( pSoldier->inv[bLoop].exists( ) == true ) { - if ( Item[pSoldier->inv[bLoop].usItem].mortar ) + if (ItemIsMortar(pSoldier->inv[bLoop].usItem)) { OBJECTTYPE* pAttObj = FindAttachmentByClass( &(pSoldier->inv[bLoop]), IC_BOMB ); @@ -22429,7 +22428,7 @@ void SOLDIERTYPE::EVENT_SoldierBeginAttachCan( INT32 sGridNo, UINT8 ubDirection // OK, find door, attach to door, do animation...., remove item.... // First make sure we still have item in hand.... - if ( !Item[this->inv[HANDPOS].usItem].canandstring ) + if ( !ItemIsCanAndString(this->inv[HANDPOS].usItem)) { return; } @@ -22741,7 +22740,7 @@ void SOLDIERTYPE::EVENT_SoldierApplyItemToPerson( INT32 sGridNo, UINT8 ubDirecti if ( success ) { - if ( Item[usItem].gasmask ) + if (ItemIsGasmask(usItem)) { // put this item into a (at best empty) faceslot if no gasmask is been worn INT8 bSlot = FindGasMask( pSoldier ); @@ -23362,11 +23361,11 @@ BOOLEAN SOLDIERTYPE::PlayerSoldierStartTalking( UINT8 ubTargetID, BOOLEAN fValid BOOLEAN SOLDIERTYPE::IsValidSecondHandShot( void ) { if ( Item[this->inv[SECONDHANDPOS].usItem].usItemClass == IC_GUN && - !(Item[this->inv[SECONDHANDPOS].usItem].twohanded) && + !ItemIsTwoHanded(this->inv[SECONDHANDPOS].usItem) && (!this->bDoBurst || this->IsValidSecondHandBurst( )) && - !Item[this->inv[HANDPOS].usItem].grenadelauncher && + !ItemIsGrenadeLauncher(this->inv[HANDPOS].usItem) && Item[this->inv[HANDPOS].usItem].usItemClass == IC_GUN && - !(Item[this->inv[HANDPOS].usItem].twohanded) && + !ItemIsTwoHanded(this->inv[HANDPOS].usItem) && this->inv[SECONDHANDPOS][0]->data.gun.bGunStatus >= USABLE && this->inv[SECONDHANDPOS][0]->data.gun.ubGunShotsLeft > 0 ) { @@ -23380,11 +23379,11 @@ BOOLEAN SOLDIERTYPE::IsValidSecondHandBurst( void ) { // SANDRO - a function to determine if we can autofire with both weapons if ( Item[this->inv[SECONDHANDPOS].usItem].usItemClass == IC_GUN && - !(Item[this->inv[SECONDHANDPOS].usItem].twohanded) && - !Item[this->inv[HANDPOS].usItem].grenadelauncher && + !ItemIsTwoHanded(this->inv[SECONDHANDPOS].usItem) && + !ItemIsGrenadeLauncher(this->inv[HANDPOS].usItem) && this->bDoBurst && Item[this->inv[HANDPOS].usItem].usItemClass == IC_GUN && - !(Item[this->inv[HANDPOS].usItem].twohanded) && + !ItemIsTwoHanded(this->inv[HANDPOS].usItem) && this->inv[SECONDHANDPOS][0]->data.gun.bGunStatus >= USABLE && this->inv[SECONDHANDPOS][0]->data.gun.ubGunShotsLeft > 0 ) { @@ -23416,7 +23415,7 @@ BOOLEAN SOLDIERTYPE::IsValidSecondHandShotForReloadingPurposes( void ) // about ammo taken out! if ( Item[this->inv[SECONDHANDPOS].usItem].usItemClass == IC_GUN && //!this->bDoBurst && - !Item[this->inv[HANDPOS].usItem].grenadelauncher && + !ItemIsGrenadeLauncher(this->inv[HANDPOS].usItem) && Item[this->inv[HANDPOS].usItem].usItemClass == IC_GUN && this->inv[SECONDHANDPOS][0]->data.gun.bGunStatus >= USABLE //&& // this->inv[SECONDHANDPOS][0]->data.gun.ubGunShotsLeft > 0 && @@ -23452,7 +23451,7 @@ BOOLEAN SOLDIERTYPE::IsValidShotFromHip( INT16 bAimTime, INT32 iTrgGridNo ) return(FALSE); } // must be two handed for this - if ( !Item[this->inv[HANDPOS].usItem].twohanded ) + if ( !ItemIsTwoHanded(this->inv[HANDPOS].usItem) ) { return(FALSE); } @@ -23509,7 +23508,7 @@ BOOLEAN SOLDIERTYPE::IsValidPistolFastShot( INT16 bAimTime, INT32 iTrgGridNo ) return(FALSE); } // must be one handed for this - if ( Item[this->inv[HANDPOS].usItem].twohanded ) + if (ItemIsTwoHanded(this->inv[HANDPOS].usItem)) { return(FALSE); } @@ -24178,8 +24177,8 @@ void SOLDIERTYPE::BreakWindow(void) { if (this->inv[HANDPOS].exists() && this->inv[HANDPOS][0]->data.objectStatus >= USABLE && - (Item[this->inv[HANDPOS].usItem].crowbar && Item[this->inv[HANDPOS].usItem].usItemClass & (IC_PUNCH) || - Item[this->inv[HANDPOS].usItem].usItemClass & IC_GUN && Item[this->inv[HANDPOS].usItem].twohanded && Item[this->inv[HANDPOS].usItem].metal)) + (ItemIsCrowbar(this->inv[HANDPOS].usItem) && Item[this->inv[HANDPOS].usItem].usItemClass & (IC_PUNCH) || + Item[this->inv[HANDPOS].usItem].usItemClass & IC_GUN && ItemIsTwoHanded(this->inv[HANDPOS].usItem) && ItemIsMetal(this->inv[HANDPOS].usItem) )) { this->usAttackingWeapon = this->inv[HANDPOS].usItem; this->aiData.bAction = AI_ACTION_KNIFE_STAB; @@ -24203,8 +24202,8 @@ BOOLEAN SOLDIERTYPE::CanBreakWindow(void) IS_MERC_BODY_TYPE(this) && this->inv[HANDPOS].exists() && this->inv[HANDPOS][0]->data.objectStatus >= USABLE && - (Item[this->inv[HANDPOS].usItem].crowbar && Item[this->inv[HANDPOS].usItem].usItemClass & (IC_PUNCH) || - Item[this->inv[HANDPOS].usItem].usItemClass & IC_GUN && Item[this->inv[HANDPOS].usItem].twohanded && Item[this->inv[HANDPOS].usItem].metal)) + (ItemIsCrowbar(this->inv[HANDPOS].usItem) && Item[this->inv[HANDPOS].usItem].usItemClass & (IC_PUNCH) || + Item[this->inv[HANDPOS].usItem].usItemClass & IC_GUN && ItemIsTwoHanded(this->inv[HANDPOS].usItem) && ItemIsMetal(this->inv[HANDPOS].usItem) )) { //INT32 sWindowGridNo = this->sTargetGridNo; INT32 sWindowGridNo = this->sGridNo; @@ -25063,7 +25062,7 @@ BOOLEAN AIDecideHipOrShoulderStance( SOLDIERTYPE * pSoldier, INT32 iGridNo ) UINT16 usInHand = pSoldier->usAttackingWeapon; // not 2-handed or not standing - if ( gAnimControl[pSoldier->usAnimState].ubEndHeight != ANIM_STAND || !Item[pSoldier->inv[HANDPOS].usItem].twohanded ) + if ( gAnimControl[pSoldier->usAnimState].ubEndHeight != ANIM_STAND || !ItemIsTwoHanded(pSoldier->inv[HANDPOS].usItem) ) { return FALSE; } @@ -25596,7 +25595,7 @@ UINT32 VirtualSoldierDressWound( SOLDIERTYPE *pSoldier, SOLDIERTYPE *pVictim, OB if ( !uiPossible ) return 0; - if ( Item[pSoldier->inv[0].usItem].medicalkit && !(fOnSurgery) ) // using the GOOD medic stuff + if (ItemIsMedicalKit(pSoldier->inv[0].usItem) && !(fOnSurgery) ) // using the GOOD medic stuff uiPossible += (uiPossible / 2); // add extra 50 % // Doctor trait improves basic bandaging ability @@ -25632,7 +25631,7 @@ UINT32 VirtualSoldierDressWound( SOLDIERTYPE *pSoldier, SOLDIERTYPE *pVictim, OB uiActual = uiDeficiency; // reduce actual not to waste anything // now make sure we HAVE that much - if ( Item[pKit->usItem].medicalkit ) + if (ItemIsMedicalKit(pKit->usItem)) { if ( fOnSurgery ) uiMedcost = (uiActual * gSkillTraitValues.usDOSurgeryMedBagConsumption) / 100; // surgery drains the kit a lot @@ -25851,7 +25850,7 @@ UINT32 VirtualSoldierDressWound( SOLDIERTYPE *pSoldier, SOLDIERTYPE *pVictim, OB // usedAPs equals (actionPts) * (%of possible points actually used) uiUsedAPs = (uiActual * uiAvailAPs) / uiPossible; - if ( Item[pSoldier->inv[0].usItem].medicalkit && !(fOnSurgery) ) // using the GOOD medic stuff + if (ItemIsMedicalKit(pSoldier->inv[0].usItem) && !(fOnSurgery) ) // using the GOOD medic stuff uiUsedAPs = (uiUsedAPs * 2) / 3; // reverse 50% bonus by taking 2/3rds // surgery is harder so cost more BPs @@ -25983,7 +25982,7 @@ BOOLEAN ApplyConsumable(SOLDIERTYPE* pSoldier, OBJECTTYPE *pObj, BOOLEAN fForce, // how much of this item do we use up UINT16 statusused = min(portionsize, (*pObj)[0]->data.objectStatus); - if (!statusused || (statusused == 1 && Item[pObj->usItem].canteen)) + if (!statusused || (statusused == 1 && ItemIsCanteen(pObj->usItem))) return FALSE; INT16 apcost = 0; @@ -26000,12 +25999,12 @@ BOOLEAN ApplyConsumable(SOLDIERTYPE* pSoldier, OBJECTTYPE *pObj, BOOLEAN fForce, apcost = max( apcost, (APBPConstants[AP_CAMOFLAGE] / 2) ); } - if ( Item[pObj->usItem].camouflagekit ) + if (ItemIsCamoKit(pObj->usItem)) { apcost = max( apcost, APBPConstants[AP_CAMOFLAGE] ); } - if ( Item[pObj->usItem].canteen ) + if (ItemIsCanteen(pObj->usItem)) { apcost = max( apcost, APBPConstants[AP_DRINK] ); } @@ -26052,7 +26051,7 @@ BOOLEAN ApplyConsumable(SOLDIERTYPE* pSoldier, OBJECTTYPE *pObj, BOOLEAN fForce, } // some mercs will refuse to smoke - if ( Item[pObj->usItem].cigarette && pSoldier->GetBackgroundValue( BG_SMOKERTYPE ) == 2 ) + if (ItemIsCigarette(pObj->usItem) && pSoldier->GetBackgroundValue( BG_SMOKERTYPE ) == 2 ) { // merc gets slightly pissed by the player even suggesting this TacticalCharacterDialogue( pSoldier, QUOTE_REFUSE_TO_SMOKE ); @@ -26108,7 +26107,7 @@ BOOLEAN ApplyConsumable(SOLDIERTYPE* pSoldier, OBJECTTYPE *pObj, BOOLEAN fForce, fSuccess = TRUE; // no sound on consuming cigarettes, as that is very annoying - if ( !Item[pObj->usItem].cigarette ) + if ( !ItemIsCigarette(pObj->usItem) ) { fDoSound = TRUE; } diff --git a/Tactical/Soldier Create.cpp b/Tactical/Soldier Create.cpp index b5769d55a..445fcfc6c 100644 --- a/Tactical/Soldier Create.cpp +++ b/Tactical/Soldier Create.cpp @@ -4163,7 +4163,7 @@ void CopyProfileItems( SOLDIERTYPE *pSoldier, SOLDIERCREATE_STRUCT *pCreateStruc 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 || ItemIsAttachment(pProfile->inv[cnt]) ) { continue; } fRet = CreateItems( pProfile->inv[ cnt ], pProfile->bInvStatus[ cnt ], pProfile->bInvNumber[ cnt ], &gTempObject ); @@ -4188,7 +4188,7 @@ void CopyProfileItems( SOLDIERTYPE *pSoldier, SOLDIERCREATE_STRUCT *pCreateStruc if ( pProfile->inv[ cnt ] == NOTHING) { continue; } - if (!Item[pProfile->inv[cnt]].attachment) { + if (!ItemIsAttachment(pProfile->inv[cnt])) { continue; } fRet = CreateItems( pProfile->inv[ cnt ], pProfile->bInvStatus[ cnt ], pProfile->bInvNumber[ cnt ], &gTempObject ); @@ -4293,7 +4293,7 @@ void CopyProfileItems( SOLDIERTYPE *pSoldier, SOLDIERCREATE_STRUCT *pCreateStruc if(fRet) { pSoldier->inv[cnt] = gTempObject; - if ( Item[gTempObject.usItem].fingerprintid ) + if (ItemHasFingerPrintID(gTempObject.usItem)) { for (int x = 0; x < pProfile->bInvNumber[ cnt ]; ++x) { gTempObject[x]->data.ubImprintID = pSoldier->ubProfile; @@ -5090,7 +5090,7 @@ BOOLEAN AssignTraitsToSoldier( SOLDIERTYPE *pSoldier, SOLDIERCREATE_STRUCT *pCre } } // Chance to gain second weapon - if ( Chance( iChance / 4 ) && !Item[pCreateStruct->Inv[HANDPOS].usItem].twohanded ) // 1/4 of chance + if ( Chance( iChance / 4 ) && !ItemIsTwoHanded(pCreateStruct->Inv[HANDPOS].usItem) ) // 1/4 of chance { (pCreateStruct->Inv[SECONDHANDPOS]) = (pCreateStruct->Inv[HANDPOS]); @@ -5178,7 +5178,7 @@ BOOLEAN AssignTraitsToSoldier( SOLDIERTYPE *pSoldier, SOLDIERCREATE_STRUCT *pCre BTraitAssigned = TRUE; // elites can have third skill trait - if ( Chance( iChance / 3 ) && !Item[pCreateStruct->Inv[HANDPOS].usItem].twohanded && + if ( Chance( iChance / 3 ) && !ItemIsTwoHanded(pCreateStruct->Inv[HANDPOS].usItem) && (ubSolClass == SOLDIER_CLASS_ELITE || ubSolClass == SOLDIER_CLASS_ELITE_MILITIA) ) { pSoldier->stats.ubSkillTraits[2] = AMBIDEXTROUS_NT; @@ -5188,7 +5188,7 @@ BOOLEAN AssignTraitsToSoldier( SOLDIERTYPE *pSoldier, SOLDIERCREATE_STRUCT *pCre } // Chance to gain second weapon and ambidextrous trait - else if ( Chance( iChance / 2 ) && !Item[pCreateStruct->Inv[HANDPOS].usItem].twohanded && !BTraitAssigned ) // 1/2 of chance + else if ( Chance( iChance / 2 ) && !ItemIsTwoHanded(pCreateStruct->Inv[HANDPOS].usItem) && !BTraitAssigned ) // 1/2 of chance { if ( pCreateStruct->bTeam == MILITIA_TEAM && gGameExternalOptions.fMilitiaUseSectorInventory && gGameExternalOptions.fMilitiaUseSectorInventory_Gun ) ; @@ -5206,7 +5206,7 @@ BOOLEAN AssignTraitsToSoldier( SOLDIERTYPE *pSoldier, SOLDIERCREATE_STRUCT *pCre BTraitAssigned = TRUE; // elites can have third skill trait - if ( Chance( iChance / 3 ) && !Item[pCreateStruct->Inv[HANDPOS].usItem].twohanded && + if ( Chance( iChance / 3 ) && !ItemIsTwoHanded(pCreateStruct->Inv[HANDPOS].usItem) && (ubSolClass == SOLDIER_CLASS_ELITE || ubSolClass == SOLDIER_CLASS_ELITE_MILITIA) ) { pSoldier->stats.ubSkillTraits[2] = AMBIDEXTROUS_NT; @@ -5222,7 +5222,7 @@ BOOLEAN AssignTraitsToSoldier( SOLDIERTYPE *pSoldier, SOLDIERCREATE_STRUCT *pCre pSoldier->stats.ubSkillTraits[0] = AMBIDEXT_OT; ATraitAssigned = TRUE; // Ambidextrous trait gives us second weapon automatically - if ( !Item[pCreateStruct->Inv[HANDPOS].usItem].twohanded ) + if ( !ItemIsTwoHanded(pCreateStruct->Inv[HANDPOS].usItem) ) { (pCreateStruct->Inv[SECONDHANDPOS]) = (pCreateStruct->Inv[HANDPOS]); } @@ -5232,7 +5232,7 @@ BOOLEAN AssignTraitsToSoldier( SOLDIERTYPE *pSoldier, SOLDIERCREATE_STRUCT *pCre pSoldier->stats.ubSkillTraits[1] = AMBIDEXT_OT; BTraitAssigned = TRUE; // Ambidextrous trait gives us second weapon automatically - if ( !Item[pCreateStruct->Inv[HANDPOS].usItem].twohanded ) + if ( !ItemIsTwoHanded(pCreateStruct->Inv[HANDPOS].usItem) ) { (pCreateStruct->Inv[SECONDHANDPOS]) = (pCreateStruct->Inv[HANDPOS]); } @@ -5267,28 +5267,29 @@ BOOLEAN AssignTraitsToSoldier( SOLDIERTYPE *pSoldier, SOLDIERCREATE_STRUCT *pCre { if ( pCreateStruct->Inv[bLoop].exists( ) == true ) { - if ( Item[pCreateStruct->Inv[bLoop].usItem].mortar ) + UINT16 usItem = pCreateStruct->Inv[bLoop].usItem; + if (ItemIsMortar(usItem)) foundMortar = TRUE; - else if ( Item[pCreateStruct->Inv[bLoop].usItem].rocketlauncher ) + else if (ItemIsRocketLauncher(usItem)) foundRocketlauncher = TRUE; - else if ( Item[pCreateStruct->Inv[bLoop].usItem].grenadelauncher ) + else if (ItemIsGrenadeLauncher(usItem)) foundGrenadelauncher = TRUE; - else if ( Item[pCreateStruct->Inv[bLoop].usItem].usItemClass == IC_BLADE ) + else if ( Item[usItem].usItemClass == IC_BLADE ) foundKnife = TRUE; - else if ( Item[pCreateStruct->Inv[bLoop].usItem].usItemClass == IC_THROWING_KNIFE ) + else if ( Item[usItem].usItemClass == IC_THROWING_KNIFE ) foundThrowing = TRUE; - else if ( Item[pCreateStruct->Inv[bLoop].usItem].usItemClass == IC_GRENADE ) + else if ( Item[usItem].usItemClass == IC_GRENADE ) foundGrenades = TRUE; - else if ( Item[pCreateStruct->Inv[bLoop].usItem].brassknuckles ) + else if (ItemIsBrassKnuckles(usItem)) foundHtH = TRUE; - else if ( Item[pCreateStruct->Inv[bLoop].usItem].usItemClass == 128 && // 128 is an identifier of blunt melee weapons - Item[pCreateStruct->Inv[bLoop].usItem].uiIndex != 0 ) + else if ( Item[usItem].usItemClass == 128 && // 128 is an identifier of blunt melee weapons + Item[usItem].uiIndex != 0 ) foundMelee = TRUE; - else if ( HasItemFlag( pCreateStruct->Inv[bLoop].usItem, RADIO_SET ) ) + else if ( HasItemFlag( usItem, RADIO_SET ) ) fRadioSetFound = TRUE; - else if ( Item[pCreateStruct->Inv[bLoop].usItem].firstaidkit ) + else if (ItemIsFirstAidKit(usItem)) fFirstAidKitFound = TRUE; - else if ( Item[pCreateStruct->Inv[bLoop].usItem].medicalkit ) + else if (ItemIsMedicalKit(usItem)) { // Flugente: for enemy medic purposes, med kits also count as first aid kits fFirstAidKitFound = TRUE; diff --git a/Tactical/Soldier Profile.cpp b/Tactical/Soldier Profile.cpp index 37052fb0a..ee38c12c6 100644 --- a/Tactical/Soldier Profile.cpp +++ b/Tactical/Soldier Profile.cpp @@ -1845,7 +1845,7 @@ BOOLEAN RecruitRPC( UINT8 ubCharNum ) if ( bSlot != NO_SLOT ) { // if ( Item[ pNewSoldier->inv[ bSlot ].usItem ].fFlags & ITEM_TWO_HANDED ) - if ( Item[ pNewSoldier->inv[ bSlot ].usItem ].twohanded ) + if (ItemIsTwoHanded(pNewSoldier->inv[ bSlot ].usItem)) { if ( bSlot != SECONDHANDPOS && pNewSoldier->inv[ SECONDHANDPOS ].exists() == true ) { diff --git a/Tactical/SoldierTooltips.cpp b/Tactical/SoldierTooltips.cpp index b1b08ccf2..731bb6360 100644 --- a/Tactical/SoldierTooltips.cpp +++ b/Tactical/SoldierTooltips.cpp @@ -598,7 +598,7 @@ void SoldierTooltip( SOLDIERTYPE* pSoldier ) break; } - if ( Item[ pSoldier->inv[ BigSlot ].usItem ].rocketlauncher ) + if (ItemIsRocketLauncher(pSoldier->inv[ BigSlot ].usItem)) iCarriedRL = pSoldier->inv[ BigSlot ].usItem; // remember that enemy is carrying a rocket launcher when check for rocket ammo is made later on if ( ( Item[ pSoldier->inv[ BigSlot ].usItem ].usItemClass == IC_LAUNCHER ) || @@ -712,7 +712,7 @@ void DisplayWeaponInfo( SOLDIERTYPE* pSoldier, CHAR16* pStrInfo, UINT8 ubSlot, U if ( ubTooltipDetailLevel == DL_Basic || ubTooltipDetailLevel == DL_Full ) // Madd: also hidden attachments should be hidden at the full level as well... unless the mercs have x-ray vision to see that rod&spring inside the gun!! :p { // display only externally-visible weapon attachments - if ( Item[iter->usItem].hiddenattachment ) + if (ItemIsHiddenAttachment(iter->usItem)) fDisplayAttachment = FALSE; else fDisplayAttachment = TRUE; diff --git a/Tactical/Tactical Save.cpp b/Tactical/Tactical Save.cpp index e1b843ab5..7352422f9 100644 --- a/Tactical/Tactical Save.cpp +++ b/Tactical/Tactical Save.cpp @@ -2678,7 +2678,7 @@ BOOLEAN AddDeadSoldierToUnLoadedSector( INT16 sMapX, INT16 sMapY, UINT8 bMapZ, S pWorldItems[ bCount ].bVisible = TRUE; pWorldItems[ bCount ].bRenderZHeightAboveLevel = 0; - if ( Item[pSoldier->inv[i].usItem].damageable ) // Madd: drop crappier items on higher difficulty levels + if (ItemIsDamageable(pSoldier->inv[i].usItem)) // Madd: drop crappier items on higher difficulty levels { // silversurfer: externalized this //pSoldier->inv[i][0]->data.objectStatus -= (gGameOptions.ubDifficultyLevel - 1) * Random(20); diff --git a/Tactical/Turn Based Input.cpp b/Tactical/Turn Based Input.cpp index 4cb81bccd..13f5666f2 100644 --- a/Tactical/Turn Based Input.cpp +++ b/Tactical/Turn Based Input.cpp @@ -8969,7 +8969,7 @@ void HandleTacticalTakeInvItem( INT32 iType ) for(UINT8 i = GUNSLINGPOCKPOS; i < NUM_INV_SLOTS; ++i) { if ( pSoldier->inv[i].exists() && - !Item[ pSoldier->inv[i].usItem ].twohanded && + !ItemIsTwoHanded(pSoldier->inv[i].usItem) && ( iType > 0 ? ( pSoldier->inv[i].usItem == iType ) : ( InvItemType( pSoldier->inv[i].usItem ) == iType ) ) ) { ubItemSlot = i; @@ -9019,7 +9019,7 @@ INT32 InvItemType( UINT16 usItem ) { if( usItem == XRAY_DEVICE ) return INV_ITEM_TYPE_XRAY; - if( Item[ usItem ].firstaidkit ) + if(ItemIsFirstAidKit(usItem)) return INV_ITEM_TYPE_FIRSTAID; if( Item[ usItem ].usItemClass == IC_BLADE ) return INV_ITEM_TYPE_MELEE; @@ -9033,9 +9033,9 @@ INT32 InvItemType( UINT16 usItem ) return INV_ITEM_TYPE_BINOCULARS; if( HasItemFlag( usItem, TASER ) ) return INV_ITEM_TYPE_TASER; - if( Item[ usItem ].usItemClass == IC_GUN && !Item[ usItem ].twohanded && Weapon[Item[ usItem ].ubClassIndex].ubWeaponType <= GUN_SMG ) + if( Item[ usItem ].usItemClass == IC_GUN && !ItemIsTwoHanded(usItem) && Weapon[Item[ usItem ].ubClassIndex].ubWeaponType <= GUN_SMG ) return INV_ITEM_TYPE_SIDEARM; - if( Item[ usItem ].usItemClass == IC_MISC && Item[ usItem ].metaldetector ) + if( Item[ usItem ].usItemClass == IC_MISC && ItemIsMetalDetector(usItem) ) return INV_ITEM_TYPE_METALDETECTOR; return INV_ITEM_TYPE_UNKNOWN; diff --git a/Tactical/UI Cursors.cpp b/Tactical/UI Cursors.cpp index 241eb810a..142aff022 100644 --- a/Tactical/UI Cursors.cpp +++ b/Tactical/UI Cursors.cpp @@ -180,7 +180,7 @@ UINT8 GetProperItemCursor( UINT8 ubSoldierID, UINT16 ubItemIndex, INT32 usMapPos //Madd: quick hack to make wirecutter cursor appear when using a knife that can cut through wire // sevenfm: check that not using bayonet attached to the gun //if ( Item[ubItemIndex].wirecutters && IsCuttableWireFenceAtGridNo( sTargetGridNo ) && pSoldier->pathing.bLevel == 0 ) - if ( Item[ubItemIndex].wirecutters && + if (ItemIsWirecutters(ubItemIndex) && IsCuttableWireFenceAtGridNo( sTargetGridNo ) && pSoldier->pathing.bLevel == 0 && pSoldier->bWeaponMode != WM_ATTACHED_BAYONET) @@ -1281,7 +1281,7 @@ UINT8 HandleNonActivatedTargetCursor( SOLDIERTYPE *pSoldier, INT32 usMapPos , BO //CHRISL: We need to only check the second hand if the weapon in the second hand is onehanded // Check for enough ammo... - if ( !EnoughAmmo( pSoldier, FALSE, HANDPOS ) || (pSoldier->IsValidSecondHandShotForReloadingPurposes( ) && !Item[pSoldier->inv[SECONDHANDPOS].usItem].twohanded && !EnoughAmmo( pSoldier, FALSE, SECONDHANDPOS) ) ) + if ( !EnoughAmmo( pSoldier, FALSE, HANDPOS ) || (pSoldier->IsValidSecondHandShotForReloadingPurposes( ) && !ItemIsTwoHanded(pSoldier->inv[SECONDHANDPOS].usItem) && !EnoughAmmo( pSoldier, FALSE, SECONDHANDPOS) ) ) { // Check if ANY ammo exists..... if ( FindAmmoToReload( pSoldier, HANDPOS, NO_SLOT ) == NO_SLOT ) @@ -2937,14 +2937,14 @@ UINT8 GetActionModeCursor( SOLDIERTYPE *pSoldier ) return( TRAJECTORYCURS ); } - if ( pSoldier->bWeaponMode == WM_ATTACHED_GL_BURST || ( pSoldier->bWeaponMode == WM_BURST && Item[pSoldier->inv[HANDPOS].usItem].grenadelauncher ) ) + if ( pSoldier->bWeaponMode == WM_ATTACHED_GL_BURST || ( pSoldier->bWeaponMode == WM_BURST && ItemIsGrenadeLauncher(pSoldier->inv[HANDPOS].usItem) ) ) { if ( gGameSettings.fOptions [ TOPTION_GL_BURST_CURSOR ] ) return( TARGETCURS ); else return ( TRAJECTORYCURS ); } - else if ( pSoldier->bWeaponMode == WM_ATTACHED_GL_AUTO || ( pSoldier->bWeaponMode == WM_AUTOFIRE && Item[pSoldier->inv[HANDPOS].usItem].grenadelauncher ) ) + else if ( pSoldier->bWeaponMode == WM_ATTACHED_GL_AUTO || ( pSoldier->bWeaponMode == WM_AUTOFIRE && ItemIsGrenadeLauncher(pSoldier->inv[HANDPOS].usItem) ) ) { if ( gGameSettings.fOptions [ TOPTION_GL_BURST_CURSOR ] ) return( TARGETCURS ); @@ -2976,7 +2976,7 @@ UINT8 GetActionModeCursor( SOLDIERTYPE *pSoldier ) // Flugente: cursor for constructing/deconstructing // at the moment the gridno is not required in these functions, thus 1 suffices - if (!Item[usInHand].wirecutters && (IsStructureConstructItem(usInHand, 1, pSoldier) || IsStructureDeconstructItem(usInHand, 1, pSoldier))) + if (!ItemIsWirecutters(usInHand) && (IsStructureConstructItem(usInHand, 1, pSoldier) || IsStructureDeconstructItem(usInHand, 1, pSoldier))) { ubCursor = FORTICURS; } diff --git a/Tactical/Weapons.cpp b/Tactical/Weapons.cpp index 4aea8f816..9649faa01 100644 --- a/Tactical/Weapons.cpp +++ b/Tactical/Weapons.cpp @@ -1210,7 +1210,7 @@ INT32 ExplosiveEffectiveArmour( OBJECTTYPE * pObj ) } iValue = Armour[ Item[pObj->usItem].ubClassIndex ].ubProtection; iValue = iValue * (*pObj)[0]->data.objectStatus * Armour[ Item[pObj->usItem].ubClassIndex ].ubCoverage / 10000; - if ( Item[pObj->usItem].flakjacket ) + if (ItemIsFlakJacket(pObj->usItem)) { // increase value for flak jackets! iValue *= 3; @@ -1654,7 +1654,7 @@ BOOLEAN FireWeapon( SOLDIERTYPE *pSoldier , INT32 sTargetGridNo ) break; case IC_LAUNCHER: - if ( Item[pSoldier->usAttackingWeapon].rocketlauncher ){ + if (ItemIsRocketLauncher(pSoldier->usAttackingWeapon)){ UseGunWrapper( pSoldier, sTargetGridNo ); } else { // ATE: PAtch up - bookkeeping for spreading done out of whak @@ -2563,7 +2563,7 @@ BOOLEAN UseGunNCTH( SOLDIERTYPE *pSoldier , INT32 sTargetGridNo ) { for (attachmentList::iterator iter = (*pObjAttHand)[0]->attachments.begin(); iter != (*pObjAttHand)[0]->attachments.end(); ++iter) { - if (Item[iter->usItem].hidemuzzleflash ) + if (ItemHasHiddenMuzzleFlash(iter->usItem)) { OBJECTTYPE* pA= &(*iter); if ( (*pA)[0]->data.objectStatus >=USABLE) @@ -2704,7 +2704,7 @@ BOOLEAN UseGunNCTH( SOLDIERTYPE *pSoldier , INT32 sTargetGridNo ) // ATE: Check if we should say quote... if ( (*pObjHand)[0]->data.gun.ubGunShotsLeft == 0 && - !Item[usUBItem].rocketlauncher && + !ItemIsRocketLauncher(usUBItem) && pSoldier->bTeam == gbPlayerNum && (Chance(gGameExternalOptions.iChanceSayAnnoyingPhrase) || GetMagSize(pObjHand) > 4)) { @@ -2719,14 +2719,14 @@ BOOLEAN UseGunNCTH( SOLDIERTYPE *pSoldier , INT32 sTargetGridNo ) // Deduct knife from inv! (not here, later?) } - if ( Item[usUBItem].rocketlauncher ) + if (ItemIsRocketLauncher(usUBItem)) { if ( WillExplosiveWeaponFail( pSoldier, pObjHand ) ) { INT16 sX, sY; ConvertGridNoToCenterCellXY(pSoldier->sGridNo, &sX, &sY); - if ( Item[usUBItem].singleshotrocketlauncher ) + if ( ItemIsSingleShotRocketLauncher(usUBItem) ) { CreateItem( Item[usItemNum].discardedlauncheritem , (*pObjHand)[0]->data.objectStatus, pObjHand ); @@ -2889,7 +2889,7 @@ BOOLEAN UseGunNCTH( SOLDIERTYPE *pSoldier , INT32 sTargetGridNo ) if (IS_MERC_BODY_TYPE(pSoldier) && pSoldier->bVisible == TRUE && Item[usUBItem].usItemClass == IC_GUN && - !Item[usUBItem].rocketlauncher && + !ItemIsRocketLauncher(usUBItem) && strlen(AmmoTypes[Magazine[Item[(*pObjAttHand)[0]->data.gun.usGunAmmoItem].ubClassIndex].ubAmmoType].shotAnimation) > 0) { ANITILE_PARAMS AniParams; @@ -2943,9 +2943,9 @@ BOOLEAN UseGunNCTH( SOLDIERTYPE *pSoldier , INT32 sTargetGridNo ) } DirtyMercPanelInterface( pSoldier, DIRTYLEVEL2 ); } - else if ( Item[usUBItem].rocketlauncher ) + else if (ItemIsRocketLauncher(usUBItem)) { - if ( Item[usUBItem].singleshotrocketlauncher ) + if ( ItemIsSingleShotRocketLauncher(usUBItem) ) { CreateItem( Item[usUBItem].discardedlauncheritem, (*pObjHand)[0]->data.objectStatus, pObjHand ); @@ -3349,7 +3349,7 @@ BOOLEAN UseGun( SOLDIERTYPE *pSoldier , INT32 sTargetGridNo ) { for (attachmentList::iterator iter = (*pObjUsed)[0]->attachments.begin(); iter != (*pObjUsed)[0]->attachments.end(); ++iter) { - if (Item[iter->usItem].hidemuzzleflash ) + if (ItemHasHiddenMuzzleFlash(iter->usItem)) { OBJECTTYPE* pA= &(*iter); if ( (*pA)[0]->data.objectStatus >=USABLE) @@ -3527,7 +3527,7 @@ BOOLEAN UseGun( SOLDIERTYPE *pSoldier , INT32 sTargetGridNo ) // ATE: Check if we should say quote... if ( (*pObjUsed)[0]->data.gun.ubGunShotsLeft == 0 && - !Item[usUBItem].rocketlauncher && + !ItemIsRocketLauncher(usUBItem) && pSoldier->bTeam == gbPlayerNum && (Chance(gGameExternalOptions.iChanceSayAnnoyingPhrase) || GetMagSize(pObjUsed) > 4)) { @@ -3648,14 +3648,14 @@ BOOLEAN UseGun( SOLDIERTYPE *pSoldier , INT32 sTargetGridNo ) } } - if ( Item[usUBItem].rocketlauncher ) + if (ItemIsRocketLauncher(usUBItem)) { if ( WillExplosiveWeaponFail( pSoldier, pObjUsed ) ) { INT16 sX, sY; ConvertGridNoToCenterCellXY(pSoldier->sGridNo, &sX, &sY); - if ( Item[usUBItem].singleshotrocketlauncher ) + if ( ItemIsSingleShotRocketLauncher(usUBItem) ) { CreateItem( Item[usUBItem].discardedlauncheritem , (*pObjUsed)[0]->data.objectStatus, pObjUsed ); @@ -3708,7 +3708,7 @@ BOOLEAN UseGun( SOLDIERTYPE *pSoldier , INT32 sTargetGridNo ) if (IS_MERC_BODY_TYPE(pSoldier) && pSoldier->bVisible == TRUE && Item[usUBItem].usItemClass == IC_GUN && - !Item[usUBItem].rocketlauncher && + !ItemIsRocketLauncher(usUBItem) && strlen(AmmoTypes[Magazine[Item[(*pObjAttHand)[0]->data.gun.usGunAmmoItem].ubClassIndex].ubAmmoType].shotAnimation) > 0) { ANITILE_PARAMS AniParams; @@ -3761,9 +3761,9 @@ BOOLEAN UseGun( SOLDIERTYPE *pSoldier , INT32 sTargetGridNo ) } DirtyMercPanelInterface( pSoldier, DIRTYLEVEL2 ); } - else if ( Item[usUBItem].rocketlauncher ) + else if (ItemIsRocketLauncher(usUBItem)) { - if ( Item[usUBItem].singleshotrocketlauncher ) + if ( ItemIsSingleShotRocketLauncher(usUBItem) ) { CreateItem( Item[usUBItem].discardedlauncheritem, (*pObjUsed)[0]->data.objectStatus, pObjUsed ); @@ -4424,7 +4424,7 @@ BOOLEAN UseHandToHand( SOLDIERTYPE *pSoldier, INT32 sTargetGridNo, BOOLEAN fStea } } // if twohanded item, place the secondhand item if any to temp space - if (pSoldier->inv[SECONDHANDPOS].exists() == true && Item[pTargetSoldier->inv[HANDPOS].usItem].twohanded) + if (pSoldier->inv[SECONDHANDPOS].exists() == true && ItemIsTwoHanded(pTargetSoldier->inv[HANDPOS].usItem)) { if( pSoldier->bTeam != gbPlayerNum ) // for enemies, ignore rules and place it anywhere { @@ -5266,8 +5266,8 @@ BOOLEAN UseLauncher( SOLDIERTYPE *pSoldier, INT32 sTargetGridNo ) ///////////////////////////////////////////////////////////////////////////////////// // SANDRO - new mercs' records - if ( Item[ usItemNum ].usItemClass == IC_LAUNCHER || Item[usItemNum].grenadelauncher || - Item[usItemNum].rocketlauncher || Item[usItemNum].singleshotrocketlauncher || Item[usItemNum].mortar ) + if ( Item[ usItemNum ].usItemClass == IC_LAUNCHER || ItemIsGrenadeLauncher(usItemNum) || + ItemIsRocketLauncher(usItemNum) || ItemIsSingleShotRocketLauncher(usItemNum) || ItemIsMortar(usItemNum) ) { gMercProfiles[ pSoldier->ubProfile ].records.usMissilesLaunched++; } @@ -5519,9 +5519,9 @@ void WeaponHit( UINT16 usSoldierID, UINT16 usWeaponIndex, INT16 sDamage, INT16 s //TODO: Madd --- I don't think this code will ever get called for the HE ammo -- the EXPLOSIVE_GUN check filters out regular guns // marke test mag ammo type: pSoldier->inv[pSoldier->ubAttackingHand ][0]->data.gun.ubGunAmmoType // 2cond 'or' added - if ( Item[usWeaponIndex].rocketlauncher || AmmoTypes[ubAmmoType].explosionSize > 1 ) + if (ItemIsRocketLauncher(usWeaponIndex) || AmmoTypes[ubAmmoType].explosionSize > 1 ) { - if ( Item[usWeaponIndex].singleshotrocketlauncher ) + if (ItemIsSingleShotRocketLauncher(usWeaponIndex)) { if ( Item[usWeaponIndex].usBuddyItem != 0 && Item[Item[usWeaponIndex].usBuddyItem].usItemClass & IC_EXPLOSV ) { @@ -5533,7 +5533,7 @@ void WeaponHit( UINT16 usSoldierID, UINT16 usWeaponIndex, INT16 sDamage, INT16 s } } // changed rpg type to work only with two flags matching - else if ( pSoldier && !Item[usWeaponIndex].singleshotrocketlauncher && Item[usWeaponIndex].rocketlauncher) + else if ( pSoldier && !ItemIsSingleShotRocketLauncher(usWeaponIndex) && ItemIsRocketLauncher(usWeaponIndex)) //we shouldn't be able to have an underbarrel firing mode in this step, so we keep the original code :JMich { DebugMsg( TOPIC_JA2, DBG_LEVEL_3, String("WeaponHit: RPG7 item: %d, Ammo: %d",pSoldier->inv[HANDPOS].usItem , pSoldier->inv[HANDPOS][0]->data.gun.usGunAmmoItem ) ); @@ -5683,7 +5683,7 @@ void StructureHit( INT32 iBullet, UINT16 usWeaponIndex, INT16 bWeaponStatus, UIN usDirection = (UINT8)GetDirectionToGridNoFromGridNo( pSoldier->sGridNo, sGridNo ); // marke added one 'or' to get this working with HE ammo - if ( Item[usWeaponIndex].rocketlauncher || (pObj && AmmoTypes[ (*pObj)[0]->data.gun.ubGunAmmoType].explosionSize > 1 )) + if (ItemIsRocketLauncher(usWeaponIndex) || (pObj && AmmoTypes[ (*pObj)[0]->data.gun.ubGunAmmoType].explosionSize > 1 )) { // Reduce attacker count! DebugMsg( TOPIC_JA2, DBG_LEVEL_3, String("@@@@@@@ Freeing up attacker - end of LAW fire") ); @@ -5694,7 +5694,7 @@ void StructureHit( INT32 iBullet, UINT16 usWeaponIndex, INT16 bWeaponStatus, UIN INT16 sX, sY; ConvertGridNoToCenterCellXY(sGridNo, &sX, &sY); - if ( Item[usWeaponIndex].singleshotrocketlauncher ) + if (ItemIsSingleShotRocketLauncher(usWeaponIndex)) { if ( Item[usWeaponIndex].usBuddyItem != 0 && Item[Item[usWeaponIndex].usBuddyItem].usItemClass & IC_EXPLOSV ) { @@ -5706,7 +5706,7 @@ void StructureHit( INT32 iBullet, UINT16 usWeaponIndex, INT16 bWeaponStatus, UIN } } // changed too to use 2 flag to determine - else if ( ubAttackerID != NOBODY && !Item[usWeaponIndex].singleshotrocketlauncher && Item[usWeaponIndex].rocketlauncher) + else if ( ubAttackerID != NOBODY && !ItemIsSingleShotRocketLauncher(usWeaponIndex) && ItemIsRocketLauncher(usWeaponIndex) ) //there shouldn't be a way to enter here with an UnderBarrel weapon, so retaining original code :JMich { DebugMsg( TOPIC_JA2, DBG_LEVEL_3, String("StructureHit: RPG7 item: %d, Ammo: %d",pAttacker->inv[HANDPOS].usItem , pAttacker->inv[HANDPOS][0]->data.gun.usGunAmmoItem ) ); @@ -5737,7 +5737,7 @@ void StructureHit( INT32 iBullet, UINT16 usWeaponIndex, INT16 bWeaponStatus, UIN return; } - if ( Item[usWeaponIndex].cannon ) + if (ItemIsCannon(usWeaponIndex)) { // Reduce attacker count! //DebugMsg( TOPIC_JA2, DBG_LEVEL_3, String("@@@@@@@ Freeing up attacker - end of TANK fire") ); @@ -6763,7 +6763,7 @@ UINT32 CalcChanceToHitGun(SOLDIERTYPE *pSoldier, INT32 sGridNo, INT16 ubAimTime, ///////////////////////////////////////////////////////////////////////////////////// // Determine iMarksmanship and Base CTH - if (Item[usItemUsed].rocketlauncher ){ + if (ItemIsRocketLauncher(usItemUsed)){ // use the same calculation as for mechanical thrown weapons iMarksmanship = ( EffectiveDexterity( pSoldier, FALSE ) + EffectiveMarksmanship( pSoldier ) + EffectiveWisdom( pSoldier ) + (10 * EffectiveExpLevel( pSoldier ) )) / 4; // heavy weapons trait helps out @@ -7164,7 +7164,7 @@ UINT32 CalcChanceToHitGun(SOLDIERTYPE *pSoldier, INT32 sGridNo, INT16 ubAimTime, ///////////////////////////////////////////////////////////////////////////////////// // Modify for using one hand - if ( !(Item[ usInHand ].twohanded ) ) + if ( !ItemIsTwoHanded(usInHand) ) //check for 2weapon, retaining original code :JMich { if (pSoldier->inv[SECONDHANDPOS].exists() == false) @@ -7496,7 +7496,7 @@ UINT32 CalcChanceToHitGun(SOLDIERTYPE *pSoldier, INT32 sGridNo, INT16 ubAimTime, // Equipment Modifiers iChance += GetGearToHitBonus ( pSoldier ); - if (AM_A_ROBOT(pSoldier) && Item[pSoldier->inv[ROBOT_TARGETING_SLOT].usItem].fProvidesRobotLaserBonus) + if (AM_A_ROBOT(pSoldier) && ItemProvidesRobotLaserBonus(pSoldier->inv[ROBOT_TARGETING_SLOT].usItem)) { iChance += GetToHitBonus(&(pSoldier->inv[ROBOT_TARGETING_SLOT]), iRange, bLightLevel, FALSE); } @@ -7995,7 +7995,7 @@ INT32 TotalArmourProtection( SOLDIERTYPE * pTarget, UINT8 ubHitLocation, INT32 i { INT32 protection = ArmourProtection( pTarget, Item[iter->usItem].ubClassIndex, &((*iter)[0]->data.objectStatus), iImpact, ubAmmoType, &plateHit ); - if ( fConsiderFlak && Item[iter->usItem].flakjacket ) + if ( fConsiderFlak && ItemIsFlakJacket(iter->usItem) ) { // increase value for flak jackets! protection *= 3; @@ -8028,7 +8028,7 @@ INT32 TotalArmourProtection( SOLDIERTYPE * pTarget, UINT8 ubHitLocation, INT32 i // bullet got through jacket; apply ceramic plate armour INT32 protection = ArmourProtection( pTarget, Item[iter->usItem].ubClassIndex, &((*iter)[0]->data.objectStatus), iImpact, ubAmmoType, &plateHit ); - if ( fConsiderFlak && Item[iter->usItem].flakjacket ) + if ( fConsiderFlak && ItemIsFlakJacket(iter->usItem) ) { // increase value for flak jackets! protection *= 3; @@ -8057,7 +8057,7 @@ INT32 TotalArmourProtection( SOLDIERTYPE * pTarget, UINT8 ubHitLocation, INT32 i { INT32 protection = ArmourProtection( pTarget, Item[pArmour->usItem].ubClassIndex, &((*pArmour)[0]->data.objectStatus), iImpact, ubAmmoType, &plateHit ); - if ( fConsiderFlak && Item[pArmour->usItem].flakjacket ) + if ( fConsiderFlak && ItemIsFlakJacket(pArmour->usItem) ) { // increase value for flak jackets! protection *= 3; @@ -8860,7 +8860,7 @@ INT32 HTHImpact( SOLDIERTYPE * pSoldier, SOLDIERTYPE * pTarget, INT32 iHitBy, BO { if ( gGameOptions.fNewTraitSystem ) { - if (!pSoldier->usAttackingWeapon || Item[pSoldier->inv[HANDPOS].usItem].brassknuckles) + if (!pSoldier->usAttackingWeapon || ItemIsBrassKnuckles(pSoldier->inv[HANDPOS].usItem)) { if ( gGameExternalOptions.fEnhancedCloseCombatSystem ) { @@ -9372,7 +9372,7 @@ UINT32 CalcChanceHTH( SOLDIERTYPE * pAttacker,SOLDIERTYPE *pDefender, INT16 ubAi iAttRating += gSkillTraitValues.ubMABonusCtHBareHands * NUM_SKILL_TRAITS( pAttacker, MARTIAL_ARTS_NT ); } // brass knuckles - bonus for Martial Arts (but a little lesser) - else if (Item[pAttacker->inv[HANDPOS].usItem].brassknuckles && HAS_SKILL_TRAIT( pAttacker, MARTIAL_ARTS_NT )) + else if (ItemIsBrassKnuckles(pAttacker->inv[HANDPOS].usItem) && HAS_SKILL_TRAIT( pAttacker, MARTIAL_ARTS_NT )) { iAttRating += gSkillTraitValues.ubMABonusCtHBrassKnuckles * NUM_SKILL_TRAITS( pAttacker, MARTIAL_ARTS_NT ); } @@ -9586,7 +9586,7 @@ UINT32 CalcChanceHTH( SOLDIERTYPE * pAttacker,SOLDIERTYPE *pDefender, INT16 ubAi { iDefRating += gSkillTraitValues.bModifierDodgeHtHChance; // Make HtH dodging a little more problematic for untrained mercs - if ( !pAttacker->usAttackingWeapon || Item[pAttacker->inv[HANDPOS].usItem].brassknuckles ) + if ( !pAttacker->usAttackingWeapon || ItemIsBrassKnuckles(pAttacker->inv[HANDPOS].usItem) ) { if (HAS_SKILL_TRAIT( pDefender, MARTIAL_ARTS_NT )) { @@ -9599,7 +9599,7 @@ UINT32 CalcChanceHTH( SOLDIERTYPE * pAttacker,SOLDIERTYPE *pDefender, INT16 ubAi { iDefRating += ( gSkillTraitValues.ubMAOnTopCTDHtHBareHanded * NUM_SKILL_TRAITS( pDefender, MARTIAL_ARTS_NT ) ); } - else if ( Item[pDefender->inv[HANDPOS].usItem].brassknuckles ) + else if (ItemIsBrassKnuckles(pDefender->inv[HANDPOS].usItem)) { iDefRating += ( gSkillTraitValues.ubMAOnTopCTDHtHBrassKnuckles * NUM_SKILL_TRAITS( pDefender, MARTIAL_ARTS_NT ) ); } @@ -9869,17 +9869,17 @@ BOOLEAN IsGunWeaponModeCapable( OBJECTTYPE* pObject, WeaponMode bWpnMode, SOLDIE case WM_AUTOFIRE: //return ((IsGunAutofireCapable(pSoldier, ubHandPos) || Weapon[ pSoldier->inv[ ubHandPos ].usItem ].NoSemiAuto )&& !Item[pSoldier->inv[ubHandPos].usItem].grenadelauncher ); - return ((IsGunAutofireCapable(pObject) || Weapon[ pObject->usItem ].NoSemiAuto )&& !Item[pObject->usItem].grenadelauncher ); + return ((IsGunAutofireCapable(pObject) || Weapon[ pObject->usItem ].NoSemiAuto )&& !ItemIsGrenadeLauncher(pObject->usItem)); case WM_ATTACHED_GL: // return (FindAttachment( &(pSoldier->inv[ubHandPos]), UNDER_GLAUNCHER ) != 0 && FindLaunchableAttachment( &(pSoldier->inv[ubHandPos]), UNDER_GLAUNCHER ) != 0 ); //return (!Item[pSoldier->inv[ubHandPos].usItem].grenadelauncher && IsGrenadeLauncherAttached( &(pSoldier->inv[ubHandPos]) ) && FindLaunchableAttachment( &(pSoldier->inv[ubHandPos]), GetAttachedGrenadeLauncher( &(pSoldier->inv[ubHandPos]) )) != 0 ); - return ( (!Item[pObject->usItem].grenadelauncher && !IsAttachmentClass(pObject->usItem, AC_RIFLEGRENADE) ) && IsGrenadeLauncherAttached( pObject ) && FindLaunchableAttachment( pObject, GetAttachedGrenadeLauncher( pObject )) != 0 ); + return ( (!ItemIsGrenadeLauncher(pObject->usItem) && !IsAttachmentClass(pObject->usItem, AC_RIFLEGRENADE) ) && IsGrenadeLauncherAttached( pObject ) && FindLaunchableAttachment( pObject, GetAttachedGrenadeLauncher( pObject )) != 0 ); case WM_ATTACHED_GL_BURST: //return (!Item[pSoldier->inv[ubHandPos].usItem].grenadelauncher && IsGrenadeLauncherAttached( &(pSoldier->inv[ubHandPos]) ) && Weapon[GetAttachedGrenadeLauncher(&pSoldier->inv[ubHandPos])].ubShotsPerBurst > 0 && FindLaunchableAttachment( &(pSoldier->inv[ubHandPos]), GetAttachedGrenadeLauncher( &(pSoldier->inv[ubHandPos]))) != 0 ); - return ( (!Item[pObject->usItem].grenadelauncher && !HasAttachmentOfClass( pObject, AC_RIFLEGRENADE ) ) && IsGrenadeLauncherAttached( pObject ) && Weapon[GetAttachedGrenadeLauncher(pObject)].ubShotsPerBurst > 0 && FindLaunchableAttachment( pObject, GetAttachedGrenadeLauncher( pObject)) != 0 ); + return ( (!ItemIsGrenadeLauncher(pObject->usItem) && !HasAttachmentOfClass( pObject, AC_RIFLEGRENADE ) ) && IsGrenadeLauncherAttached( pObject ) && Weapon[GetAttachedGrenadeLauncher(pObject)].ubShotsPerBurst > 0 && FindLaunchableAttachment( pObject, GetAttachedGrenadeLauncher( pObject)) != 0 ); case WM_ATTACHED_GL_AUTO: return FALSE; @@ -9997,7 +9997,7 @@ void HandleTacticalEffectsOfEquipmentChange( SOLDIERTYPE *pSoldier, UINT32 uiInv pSoldier->bDoBurst = TRUE; pSoldier->bDoAutofire = 1; } - if ( Item[ pSoldier->inv[ HANDPOS ].usItem ].twohanded && Weapon[ pSoldier->inv[ HANDPOS ].usItem ].HeavyGun && gGameExternalOptions.ubAllowAlternativeWeaponHolding == 3 ) + if (ItemIsTwoHanded(pSoldier->inv[ HANDPOS ].usItem) && Weapon[ pSoldier->inv[ HANDPOS ].usItem ].HeavyGun && gGameExternalOptions.ubAllowAlternativeWeaponHolding == 3 ) pSoldier->bScopeMode = USE_ALT_WEAPON_HOLD; else pSoldier->bScopeMode = USE_BEST_SCOPE; @@ -10038,7 +10038,7 @@ void HandleTacticalEffectsOfEquipmentChange( SOLDIERTYPE *pSoldier, UINT32 uiInv pSoldier->bDoAutofire = 1; pSoldier->bDoBurst = TRUE; } - if ( Item[ pSoldier->inv[ HANDPOS ].usItem ].twohanded && Weapon[ pSoldier->inv[ HANDPOS ].usItem ].HeavyGun && gGameExternalOptions.ubAllowAlternativeWeaponHolding == 3 ) + if (ItemIsTwoHanded(pSoldier->inv[ HANDPOS ].usItem) && Weapon[ pSoldier->inv[ HANDPOS ].usItem ].HeavyGun && gGameExternalOptions.ubAllowAlternativeWeaponHolding == 3 ) pSoldier->bScopeMode = USE_ALT_WEAPON_HOLD; else pSoldier->bScopeMode = USE_BEST_SCOPE; @@ -10156,7 +10156,7 @@ INT32 CalcMaxTossRange( SOLDIERTYPE * pSoldier, UINT16 usItem, BOOLEAN fArmed, O else itemWeight=Item[usItem].ubWeight; - if ( Item[ usItem ].unaerodynamic ) + if (ItemIsUnaerodynamic(usItem)) { DebugMsg (TOPIC_JA2,DBG_LEVEL_3,"calcmaxtossrange: not aerodynamic"); iRange = 1; @@ -10180,7 +10180,7 @@ INT32 CalcMaxTossRange( SOLDIERTYPE * pSoldier, UINT16 usItem, BOOLEAN fArmed, O } // sevenfm: for grenades and aerodynamic items - apply modifier - if ( ! Item[ usItem ].unaerodynamic ) + if ( !ItemIsUnaerodynamic(usItem)) iRange = (INT32)( iRange * gItemSettings.fRangeModifierGrenade ); // adjust for thrower's remaining breath (lose up to 1/2 of range) @@ -10310,7 +10310,7 @@ UINT32 CalcThrownChanceToHit(SOLDIERTYPE *pSoldier, INT32 sGridNo, INT16 ubAimTi // SANDRO - old/new traits if (gGameOptions.fNewTraitSystem) { - if (Item[usHandItem].mortar) + if (ItemIsMortar(usHandItem)) { if (HAS_SKILL_TRAIT(pSoldier, HEAVY_WEAPONS_NT)) iChance += gSkillTraitValues.sCtHModifierMortar * max(0, 100 - gSkillTraitValues.ubHWMortarCtHPenaltyReduction * NUM_SKILL_TRAITS(pSoldier, HEAVY_WEAPONS_NT)) / 100; @@ -10330,7 +10330,7 @@ UINT32 CalcThrownChanceToHit(SOLDIERTYPE *pSoldier, INT32 sGridNo, INT16 ubAimTi // This feature is available only if not having new traits on - SANDRO // Also.. this was moved here before the Heavy Weapons bonus // HEADROCK HAM 3.2: External divisor for CTH with mortars, now that they are more prevalent in the battlefield. - if (Item[usHandItem].mortar) + if (ItemIsMortar(usHandItem)) { iChance = iChance / gGameExternalOptions.ubMortarCTHDivisor; } @@ -10436,7 +10436,7 @@ UINT32 CalcThrownChanceToHit(SOLDIERTYPE *pSoldier, INT32 sGridNo, INT16 ubAimTi // ADJUST FOR RANGE - if ( Item[usHandItem].mortar && iRange < MIN_MORTAR_RANGE) + if (ItemIsMortar(usHandItem) && iRange < MIN_MORTAR_RANGE) { return(0); } @@ -10552,7 +10552,7 @@ void ChangeWeaponMode( SOLDIERTYPE * pSoldier ) // Flugente: if we are in a GL fire mode, switch between impact/delayed mode if (((pSoldier->bWeaponMode == WM_ATTACHED_GL || pSoldier->bWeaponMode == WM_ATTACHED_GL_BURST || pSoldier->bWeaponMode == WM_ATTACHED_GL_AUTO) || - (Item[pSoldier->inv[HANDPOS].usItem].usItemClass & IC_LAUNCHER && !Item[pSoldier->inv[HANDPOS].usItem].rocketlauncher)) && + (Item[pSoldier->inv[HANDPOS].usItem].usItemClass & IC_LAUNCHER && !ItemIsRocketLauncher(pSoldier->inv[HANDPOS].usItem))) && !pSoldier->usGLDelayMode && !gGameExternalOptions.fDelayedGrenadeExplosion) { @@ -10646,7 +10646,7 @@ void ChangeScopeMode( SOLDIERTYPE * pSoldier, INT32 iTrgGridNo ) INT8 bOldAimTime = pSoldier->aiData.bShownAimTime; // SANDRO - if the gun is flagged as HeavyGun, then we can only fire it from hip, thus no scopes to use at all, not even iron sights - if ( Item[pSoldier->inv[HANDPOS].usItem].twohanded && Weapon[pSoldier->inv[HANDPOS].usItem].HeavyGun && gGameExternalOptions.ubAllowAlternativeWeaponHolding == 3 ) + if (ItemIsTwoHanded(pSoldier->inv[HANDPOS].usItem) && Weapon[pSoldier->inv[HANDPOS].usItem].HeavyGun && gGameExternalOptions.ubAllowAlternativeWeaponHolding == 3 ) { pSoldier->bScopeMode = USE_ALT_WEAPON_HOLD; } @@ -10667,7 +10667,7 @@ void ChangeScopeMode( SOLDIERTYPE * pSoldier, INT32 iTrgGridNo ) while( ObjList[pSoldier->bScopeMode] == NULL && pSoldier->bScopeMode != USE_ALT_WEAPON_HOLD); //USE_BEST_SCOPE); // If this mode is not allowed, or we are not standing, or holding something weird, skip it - if ( pSoldier->bScopeMode == USE_ALT_WEAPON_HOLD && ( gGameExternalOptions.ubAllowAlternativeWeaponHolding != 3 || gAnimControl[ pSoldier->usAnimState ].ubEndHeight != ANIM_STAND || AM_A_ROBOT(pSoldier) || Item[pSoldier->inv[HANDPOS].usItem].rocketlauncher || Item[pSoldier->inv[HANDPOS].usItem].singleshotrocketlauncher ) ) + if ( pSoldier->bScopeMode == USE_ALT_WEAPON_HOLD && ( gGameExternalOptions.ubAllowAlternativeWeaponHolding != 3 || gAnimControl[ pSoldier->usAnimState ].ubEndHeight != ANIM_STAND || AM_A_ROBOT(pSoldier) || ItemIsRocketLauncher(pSoldier->inv[HANDPOS].usItem) || ItemIsSingleShotRocketLauncher(pSoldier->inv[HANDPOS].usItem)) ) pSoldier->bScopeMode = USE_BEST_SCOPE; } // changing scope mode can change number of aiming levels, we should reset the aiming variable here @@ -11228,7 +11228,7 @@ void CalcMagFactorSimple( SOLDIERTYPE *pSoldier, FLOAT d2DDistance, INT16 bAimTi iHighestMagFactor = 1.0; } - if (AM_A_ROBOT(pSoldier) && Item[pSoldier->inv[ROBOT_TARGETING_SLOT].usItem].fProvidesRobotLaserBonus) + if (AM_A_ROBOT(pSoldier) && ItemProvidesRobotLaserBonus(pSoldier->inv[ROBOT_TARGETING_SLOT].usItem)) { gCTHDisplay.iBestLaserRange = max(gCTHDisplay.iBestLaserRange, GetBestLaserRange(&pSoldier->inv[ROBOT_TARGETING_SLOT])); } @@ -11514,7 +11514,7 @@ FLOAT CalcNewChanceToHitBaseWeaponBonus(SOLDIERTYPE *pSoldier, INT32 sGridNo, IN } // FIRING 1-HANDED WEAPONS - if ( !(Item[ usInHand ].twohanded ) ) //JMich todo: underbarrel + if ( !ItemIsTwoHanded(usInHand) ) //JMich todo: underbarrel { if (pSoldier->inv[SECONDHANDPOS].exists() != false) { @@ -11553,7 +11553,7 @@ FLOAT CalcNewChanceToHitBaseWeaponBonus(SOLDIERTYPE *pSoldier, INT32 sGridNo, IN } // HEAVY WEAPON in OLD trait system - if (Item[usInHand].rocketlauncher && !(gGameOptions.fNewTraitSystem) ) + if (ItemIsRocketLauncher(usInHand) && !(gGameOptions.fNewTraitSystem) ) { // Penalty for shooting heavy weapons (launchers). Heavy Weapons skill halves this, once per skill level. FLOAT fTempPenalty = (gGameCTHConstants.BASE_HEAVY_WEAPON * fGunBaseDifficulty) - fGunBaseDifficulty; @@ -11883,7 +11883,7 @@ FLOAT CalcNewChanceToHitAimWeaponBonus(SOLDIERTYPE *pSoldier, INT32 sGridNo, INT } // FIRING 1-HANDED WEAPONS - if ( !(Item[ usInHand ].twohanded ) ) //JMich Todo: fix for UnderBarrel firing + if ( !ItemIsTwoHanded(usInHand) ) //JMich Todo: fix for UnderBarrel firing { if (pSoldier->inv[SECONDHANDPOS].exists() != false) { @@ -11922,7 +11922,7 @@ FLOAT CalcNewChanceToHitAimWeaponBonus(SOLDIERTYPE *pSoldier, INT32 sGridNo, INT } // HEAVY WEAPON in OLD trait system - if (Item[usInHand].rocketlauncher && !(gGameOptions.fNewTraitSystem) ) + if (ItemIsRocketLauncher(usInHand) && !(gGameOptions.fNewTraitSystem) ) { // Penalty for shooting heavy weapons (launchers). Heavy Weapons skill halves this, once per skill level. FLOAT fTempPenalty = (gGameCTHConstants.AIM_HEAVY_WEAPON * fGunAimDifficulty) - fGunAimDifficulty; diff --git a/Tactical/World Items.cpp b/Tactical/World Items.cpp index 218b0c154..d6eb1c8f1 100644 --- a/Tactical/World Items.cpp +++ b/Tactical/World Items.cpp @@ -457,7 +457,7 @@ INT32 FindWorldItemForTripwireInGridNo( INT32 sGridNo, INT8 bLevel, BOOLEAN fKno { pObj = &( gWorldItems[ gWorldBombs[ uiBombIndex ].iItemIndex ].object ); - if ( pObj && Item[pObj->usItem].tripwire ) + if ( pObj && ItemIsTripwire(pObj->usItem) ) { if ( !fKnown ) return( gWorldBombs[ uiBombIndex ].iItemIndex ); @@ -867,7 +867,7 @@ void LoadWorldItemsFromMap( INT8 **hBuffer, float dMajorMapVersion, int ubMinorM } } - else if ( dummyItem.bVisible == HIDDEN_ITEM && dummyItem.object[0]->data.bTrap > 0 && ( Item[dummyItem.object.usItem].mine || dummyItem.object.usItem == TRIP_FLARE || dummyItem.object.usItem == TRIP_KLAXON) ) + else if ( dummyItem.bVisible == HIDDEN_ITEM && dummyItem.object[0]->data.bTrap > 0 && (ItemIsMine(dummyItem.object.usItem) || dummyItem.object.usItem == TRIP_FLARE || dummyItem.object.usItem == TRIP_KLAXON) ) { ArmBomb( &dummyItem.object, BOMB_PRESSURE ); dummyItem.usFlags |= WORLD_ITEM_ARMED_BOMB; diff --git a/TacticalAI/AIMain.cpp b/TacticalAI/AIMain.cpp index 00bf2902d..ce032d072 100644 --- a/TacticalAI/AIMain.cpp +++ b/TacticalAI/AIMain.cpp @@ -1888,7 +1888,7 @@ UINT32 GetTankCannonIndex() { for ( UINT32 i = 0; i < gMAXITEMS_READ; ++i ) { - if (Item[i].cannon) + if (ItemIsCannon(i)) { return Item[i].uiIndex; } @@ -2239,23 +2239,24 @@ INT8 ExecuteAction(SOLDIERTYPE *pSoldier) // fall through case AI_ACTION_FIRE_GUN: // shoot at nearby opponent - case AI_ACTION_THROW_KNIFE: // throw knife at nearby opponent - // randomly decide whether to say civ quote - - if (Item[pSoldier->inv[HANDPOS].usItem].usItemClass == IC_GUN ) - PossiblyStartEnemyTaunt( pSoldier, TAUNT_FIRE_GUN, pSoldier->ubOppNum ); - else if (Item[pSoldier->inv[HANDPOS].usItem].grenadelauncher || Item[pSoldier->inv[HANDPOS].usItem].mortar || Item[pSoldier->inv[HANDPOS].usItem].rocketlauncher ) - PossiblyStartEnemyTaunt( pSoldier, TAUNT_FIRE_LAUNCHER, pSoldier->ubOppNum ); - else if (pSoldier->aiData.bAction == AI_ACTION_TOSS_PROJECTILE && Item[pSoldier->inv[HANDPOS].usItem].usItemClass == IC_THROWN && !Item[pSoldier->inv[HANDPOS].usItem].flare ) - PossiblyStartEnemyTaunt( pSoldier, TAUNT_THROW_KNIFE, pSoldier->ubOppNum ); - else if (pSoldier->aiData.bAction == AI_ACTION_KNIFE_MOVE ) - { - if (Item[pSoldier->inv[HANDPOS].usItem].usItemClass == IC_BLADE ) - PossiblyStartEnemyTaunt( pSoldier, TAUNT_CHARGE_BLADE ); - else if (Item[pSoldier->inv[HANDPOS].usItem].usItemClass == IC_PUNCH ) - PossiblyStartEnemyTaunt( pSoldier, TAUNT_CHARGE_HTH ); - } - + case AI_ACTION_THROW_KNIFE: // throw knife at nearby opponent + // randomly decide whether to say civ quote + { + UINT16 usItem = pSoldier->inv[HANDPOS].usItem; + if (Item[usItem].usItemClass == IC_GUN) + PossiblyStartEnemyTaunt(pSoldier, TAUNT_FIRE_GUN, pSoldier->ubOppNum); + else if (ItemIsGrenadeLauncher(usItem) || ItemIsMortar(usItem) || ItemIsRocketLauncher(usItem)) + PossiblyStartEnemyTaunt(pSoldier, TAUNT_FIRE_LAUNCHER, pSoldier->ubOppNum); + else if (pSoldier->aiData.bAction == AI_ACTION_TOSS_PROJECTILE && Item[usItem].usItemClass == IC_THROWN && !ItemIsFlare(usItem)) + PossiblyStartEnemyTaunt(pSoldier, TAUNT_THROW_KNIFE, pSoldier->ubOppNum); + else if (pSoldier->aiData.bAction == AI_ACTION_KNIFE_MOVE) + { + if (Item[usItem].usItemClass == IC_BLADE) + PossiblyStartEnemyTaunt(pSoldier, TAUNT_CHARGE_BLADE); + else if (Item[usItem].usItemClass == IC_PUNCH) + PossiblyStartEnemyTaunt(pSoldier, TAUNT_CHARGE_HTH); + } + } // CC, ATE here - I put in some TEMP randomness... if (!is_networked) { diff --git a/TacticalAI/AIUtils.cpp b/TacticalAI/AIUtils.cpp index 8b42fb29b..b6b5bf434 100644 --- a/TacticalAI/AIUtils.cpp +++ b/TacticalAI/AIUtils.cpp @@ -102,7 +102,7 @@ INT8 OKToAttack(SOLDIERTYPE * pSoldier, int target) if ( Item[pSoldier->inv[HANDPOS].usItem].usItemClass == IC_GUN) { - if ( Item[pSoldier->inv[HANDPOS].usItem].cannon ) + if (ItemIsCannon(pSoldier->inv[HANDPOS].usItem)) { // look for another tank shell ELSEWHERE IN INVENTORY if ( FindLaunchable( pSoldier, pSoldier->inv[HANDPOS].usItem ) == NO_SLOT ) diff --git a/TacticalAI/Attacks.cpp b/TacticalAI/Attacks.cpp index b3e9f1837..cfea4a61e 100644 --- a/TacticalAI/Attacks.cpp +++ b/TacticalAI/Attacks.cpp @@ -63,7 +63,7 @@ void LoadWeaponIfNeeded(SOLDIERTYPE *pSoldier) usInHand = GetAttachedGrenadeLauncher(&pSoldier->inv[HANDPOS]); // if he's got a MORTAR in his hand, make sure he has a MORTARSHELL avail. - if (Item[usInHand].mortar ) + if (ItemIsMortar(usInHand)) { // bPayloadPocket = FindObj( pSoldier, MORTAR_SHELL ); bPayloadPocket = FindLaunchable( pSoldier, usInHand ); @@ -76,7 +76,7 @@ void LoadWeaponIfNeeded(SOLDIERTYPE *pSoldier) } } // if he's got a GL in his hand, make sure he has some type of GRENADE avail. - else if (Item[usInHand].grenadelauncher ) + else if (ItemIsGrenadeLauncher(usInHand)) { bPayloadPocket = FindGLGrenade( pSoldier ); if (bPayloadPocket == NO_SLOT || FindNonSmokeLaunchableAttachment( &pSoldier->inv[HANDPOS],usInHand ) != 0 ) @@ -88,7 +88,7 @@ void LoadWeaponIfNeeded(SOLDIERTYPE *pSoldier) } } // if he's got a RPG7 in his hand, make sure he has some type of RPG avail. - else if (Item[usInHand].rocketlauncher && !Item[usInHand].singleshotrocketlauncher ) + else if (ItemIsRocketLauncher(usInHand) && !ItemIsSingleShotRocketLauncher(usInHand)) { bPayloadPocket = FindLaunchable (pSoldier, usInHand ); if (bPayloadPocket == NO_SLOT) @@ -96,7 +96,7 @@ void LoadWeaponIfNeeded(SOLDIERTYPE *pSoldier) return; // no grenades, can't fire } } - else if (Item[usInHand].cannon ) + else if (ItemIsCannon(usInHand)) { bPayloadPocket = FindLaunchable( pSoldier, usInHand ); if (bPayloadPocket == NO_SLOT) @@ -444,7 +444,7 @@ void CalcBestShot(SOLDIERTYPE *pSoldier, ATTACKTYPE *pBestShot) // sevenfm: take into account direction when checking stance // sevenfm: shoot heavy guns in standing stance only when using hip fire if (pSoldier->InternalIsValidStance(AIDirection(pSoldier->sGridNo, sTarget), ubStance) && - (pSoldier->bScopeMode == USE_ALT_WEAPON_HOLD || !Weapon[pSoldier->usAttackingWeapon].HeavyGun || !Item[pSoldier->usAttackingWeapon].twohanded || !gGameExternalOptions.ubAllowAlternativeWeaponHolding)) + (pSoldier->bScopeMode == USE_ALT_WEAPON_HOLD || !Weapon[pSoldier->usAttackingWeapon].HeavyGun || !ItemIsTwoHanded(pSoldier->usAttackingWeapon) || !gGameExternalOptions.ubAllowAlternativeWeaponHolding)) { sStanceAPcost = GetAPsToChangeStance(pSoldier, ubStance); if(sStanceAPcost) @@ -887,7 +887,7 @@ void CalcBestThrow(SOLDIERTYPE *pSoldier, ATTACKTYPE *pBestThrow) } // if he's got a MORTAR in his hand, make sure he has a MORTARSHELL avail. - if (Item[usInHand].mortar ) + if (ItemIsMortar(usInHand)) { DebugMsg (TOPIC_JA2,DBG_LEVEL_3,"calcbestthrow: buddy's got a mortar"); bPayloadPocket = FindNonSmokeLaunchable(pSoldier, usInHand); @@ -911,7 +911,7 @@ void CalcBestThrow(SOLDIERTYPE *pSoldier, ATTACKTYPE *pBestThrow) fMortar = TRUE; } // if he's got a GL in his hand, make sure he has some type of GRENADE avail. - else if (Item[usInHand].grenadelauncher ) + else if (ItemIsGrenadeLauncher(usInHand)) { // use up pocket 2 first, they get left as drop items DebugMsg (TOPIC_JA2,DBG_LEVEL_3,"calcbestthrow: buddy's got a GL"); @@ -943,7 +943,7 @@ void CalcBestThrow(SOLDIERTYPE *pSoldier, ATTACKTYPE *pBestThrow) } fGrenadeLauncher = TRUE; } - else if ( Item[usInHand].rocketlauncher ) + else if (ItemIsRocketLauncher(usInHand)) { DebugMsg (TOPIC_JA2,DBG_LEVEL_3,"calcbestthrow: buddy's got a rocket launcher"); @@ -952,7 +952,7 @@ void CalcBestThrow(SOLDIERTYPE *pSoldier, ATTACKTYPE *pBestThrow) // put in hand bPayloadPocket = HANDPOS;//dnl ch63 240813 - if (Item[usInHand].singleshotrocketlauncher) + if (ItemIsSingleShotRocketLauncher(usInHand)) { // sevenfm: for single shot rocket launchers, use buddy item instead if (Item[usInHand].usBuddyItem && Item[Item[usInHand].usBuddyItem].usItemClass & IC_EXPLOSV) @@ -983,7 +983,7 @@ void CalcBestThrow(SOLDIERTYPE *pSoldier, ATTACKTYPE *pBestThrow) } fRocketLauncher = TRUE; } - else if (Item[usInHand].cannon ) + else if (ItemIsCannon(usInHand)) { DebugMsg (TOPIC_JA2,DBG_LEVEL_3,"calcbestthrow: buddy's got a tank"); bPayloadPocket = FindNonSmokeLaunchable(pSoldier, usInHand); @@ -1008,7 +1008,7 @@ void CalcBestThrow(SOLDIERTYPE *pSoldier, ATTACKTYPE *pBestThrow) usGrenade = pSoldier->inv[bPayloadPocket].usItem; ubSafetyMargin = (UINT8)(1 + max(Explosive[Item[usGrenade].ubClassIndex].ubRadius, min((UINT8)TACTICAL_RANGE / 4, Explosive[Item[usGrenade].ubClassIndex].ubFragRange / CELL_X_SIZE))); - if ( Item[usGrenade].flare ) + if (ItemIsFlare(usGrenade)) { // JA2Gold: light isn't as nasty as explosives ubSafetyMargin /= 2; @@ -1032,7 +1032,7 @@ void CalcBestThrow(SOLDIERTYPE *pSoldier, ATTACKTYPE *pBestThrow) // use flares only at night if (usGrenade != NOTHING && - Item[usGrenade].flare && + ItemIsFlare(usGrenade) && !NightLight()) { return; @@ -1121,7 +1121,7 @@ void CalcBestThrow(SOLDIERTYPE *pSoldier, ATTACKTYPE *pBestThrow) // limit explosives type when attacking zombies if (usGrenade != NOTHING && - !Item[usGrenade].flare && + !ItemIsFlare(usGrenade) && Explosive[Item[usGrenade].ubClassIndex].ubType != EXPLOSV_NORMAL && Explosive[Item[usGrenade].ubClassIndex].ubType != EXPLOSV_CREATUREGAS && Explosive[Item[usGrenade].ubClassIndex].ubType != EXPLOSV_BURNABLEGAS && @@ -1143,7 +1143,7 @@ void CalcBestThrow(SOLDIERTYPE *pSoldier, ATTACKTYPE *pBestThrow) // limit explosives type when attacking robots, vehicles and tanks if (usGrenade != NOTHING && - !Item[usGrenade].flare && + !ItemIsFlare(usGrenade) && Explosive[Item[usGrenade].ubClassIndex].ubType != EXPLOSV_NORMAL && Explosive[Item[usGrenade].ubClassIndex].ubType != EXPLOSV_CREATUREGAS && Explosive[Item[usGrenade].ubClassIndex].ubType != EXPLOSV_BURNABLEGAS && @@ -1161,7 +1161,7 @@ void CalcBestThrow(SOLDIERTYPE *pSoldier, ATTACKTYPE *pBestThrow) // limit explosives type when attacking collapsed enemies if (usGrenade != NOTHING && - !Item[usGrenade].flare && + !ItemIsFlare(usGrenade) && Explosive[Item[usGrenade].ubClassIndex].ubType != EXPLOSV_NORMAL && Explosive[Item[usGrenade].ubClassIndex].ubType != EXPLOSV_CREATUREGAS && Explosive[Item[usGrenade].ubClassIndex].ubType != EXPLOSV_BURNABLEGAS && @@ -1173,7 +1173,7 @@ void CalcBestThrow(SOLDIERTYPE *pSoldier, ATTACKTYPE *pBestThrow) // don't use flare if soldier is in light if (usGrenade != NOTHING && - Item[usGrenade].flare && + ItemIsFlare(usGrenade) && InLightAtNight(pOpponent->sGridNo, pOpponent->pathing.bLevel)) { continue; @@ -1181,13 +1181,13 @@ void CalcBestThrow(SOLDIERTYPE *pSoldier, ATTACKTYPE *pBestThrow) // don't use flares against opponents on roof if (usGrenade != NOTHING && - Item[usGrenade].flare && + ItemIsFlare(usGrenade) && pOpponent->pathing.bLevel > 0) { continue; } - if (Item[usInHand].mortar) + if (ItemIsMortar(usInHand)) { // active KNOWN opponent, remember where he is so that we DO blow him up! if (bPersonalKnowledge == SEEN_CURRENTLY || @@ -1209,7 +1209,7 @@ void CalcBestThrow(SOLDIERTYPE *pSoldier, ATTACKTYPE *pBestThrow) continue; // next soldier } } - else if (Item[usInHand].rocketlauncher) + else if (ItemIsRocketLauncher(usInHand)) { if (bPersonalKnowledge == SEEN_CURRENTLY || bPublicKnowledge == SEEN_CURRENTLY) { @@ -1231,7 +1231,7 @@ void CalcBestThrow(SOLDIERTYPE *pSoldier, ATTACKTYPE *pBestThrow) continue; } } - else if( Item[usInHand].grenadelauncher ) + else if(ItemIsGrenadeLauncher(usInHand)) { if (bPersonalKnowledge == SEEN_CURRENTLY || bPublicKnowledge == SEEN_CURRENTLY) { @@ -1262,7 +1262,7 @@ void CalcBestThrow(SOLDIERTYPE *pSoldier, ATTACKTYPE *pBestThrow) else if ((bKnowledge == SEEN_THIS_TURN || bKnowledge == SEEN_LAST_TURN || bKnowledge == HEARD_THIS_TURN || bKnowledge == HEARD_LAST_TURN) && !TileIsOutOfBounds(KnownLocation(pSoldier, pOpponent->ubID)) && CloseEnoughForGrenadeToss(pOpponent->sGridNo, KnownLocation(pSoldier, pOpponent->ubID)) && - (usGrenade != NOTHING && Item[usGrenade].flare || pSoldier->aiData.bUnderFire || pSoldier->aiData.bShock)) + (usGrenade != NOTHING && ItemIsFlare(usGrenade) || pSoldier->aiData.bUnderFire || pSoldier->aiData.bShock)) { sOpponentTile[ubOpponentCnt] = KnownLocation(pSoldier, pOpponent->ubID); bOpponentLevel[ubOpponentCnt] = KnownLevel(pSoldier, pOpponent->ubID); @@ -1299,7 +1299,7 @@ void CalcBestThrow(SOLDIERTYPE *pSoldier, ATTACKTYPE *pBestThrow) // don't spare non lethal grenades if (usGrenade != NOTHING && - (Item[usGrenade].flare || + (ItemIsFlare(usGrenade) || Explosive[Item[usGrenade].ubClassIndex].ubType == EXPLOSV_STUN || Explosive[Item[usGrenade].ubClassIndex].ubType == EXPLOSV_SMOKE || Explosive[Item[usGrenade].ubClassIndex].ubType == EXPLOSV_TEARGAS || @@ -1328,7 +1328,7 @@ void CalcBestThrow(SOLDIERTYPE *pSoldier, ATTACKTYPE *pBestThrow) // militia always try to spare grenades unless under attack or using flares if (pSoldier->bTeam == MILITIA_TEAM && !pSoldier->aiData.bUnderFire && - !Item[usGrenade].flare && + !ItemIsFlare(usGrenade) && !fRocketLauncher) { fSpare = TRUE; @@ -1563,7 +1563,7 @@ void CalcBestThrow(SOLDIERTYPE *pSoldier, ATTACKTYPE *pBestThrow) ubChanceToGetThrough = 100 - (UINT8) uiPenalty; } } - else if (Item[usInHand].mortar && + else if (ItemIsMortar(usInHand) && usGrenade != NOTHING && Explosive[Item[usGrenade].ubClassIndex].ubType == EXPLOSV_NORMAL && bOpponentLevel[ubLoop] == 0 && @@ -1589,7 +1589,7 @@ void CalcBestThrow(SOLDIERTYPE *pSoldier, ATTACKTYPE *pBestThrow) // this is try to minimize enemies wasting their (few) mortar shells or LAWs // they won't use them on less than 2 targets as long as half life left - if ((Item[usInHand].mortar || Item[usInHand].rocketlauncher) && (ubOppsInRange < 2) && + if ((ItemIsMortar(usInHand) || ItemIsRocketLauncher(usInHand)) && (ubOppsInRange < 2) && (!gGameExternalOptions.fEnemyTanksDontSpareShells || !ARMED_VEHICLE(pSoldier)) && !gGameExternalOptions.fEnemiesDontSpareLaunchables) { @@ -1597,7 +1597,7 @@ void CalcBestThrow(SOLDIERTYPE *pSoldier, ATTACKTYPE *pBestThrow) } // limit RPG use, unless can hit several enemies, shooting at tank or opponent is in a room - if (Item[usInHand].rocketlauncher && + if (ItemIsRocketLauncher(usInHand) && ubOppsInRange < 2 && !ARMED_VEHICLE(MercPtrs[ubOpponentID[ubLoop]]) && (!InARoom(sOpponentTile[ubLoop], NULL) || pSoldier->bTeam != ENEMY_TEAM)) @@ -1687,7 +1687,7 @@ void CalcBestThrow(SOLDIERTYPE *pSoldier, ATTACKTYPE *pBestThrow) // this is try to minimize enemies wasting their (limited) toss attacks: UINT8 ubMinChanceToReallyHit; - if( usGrenade != NOTHING && Item[usGrenade].flare ) + if( usGrenade != NOTHING && ItemIsFlare(usGrenade) ) { ubMinChanceToReallyHit = 30; } @@ -2305,11 +2305,12 @@ INT32 EstimateThrowDamage( SOLDIERTYPE *pSoldier, UINT8 ubItemPos, SOLDIERTYPE * // ubExplosiveIndex = Item[ C1 ].ubClassIndex; // break; //default: - if ( Item[pSoldier->inv[ ubItemPos ].usItem].singleshotrocketlauncher ) + UINT16 usItem = pSoldier->inv[ubItemPos].usItem; + if (ItemIsSingleShotRocketLauncher(usItem)) ubExplosiveIndex = Item[ C1 ].ubClassIndex; - else if ( Item[pSoldier->inv[ ubItemPos ].usItem].rocketlauncher || Item[pSoldier->inv[ ubItemPos ].usItem].grenadelauncher || Item[pSoldier->inv[ ubItemPos ].usItem].mortar ) + else if (ItemIsRocketLauncher(usItem) || ItemIsGrenadeLauncher(usItem) || ItemIsMortar(usItem) ) { - OBJECTTYPE* pAttachment = FindLaunchableAttachment(&pSoldier->inv[ ubItemPos ],pSoldier->inv[ ubItemPos ].usItem ) ; + OBJECTTYPE* pAttachment = FindLaunchableAttachment(&pSoldier->inv[ ubItemPos ],usItem ) ; if ( pAttachment->exists() ) ubExplosiveIndex = Item[pAttachment->usItem].ubClassIndex; else @@ -2331,7 +2332,7 @@ INT32 EstimateThrowDamage( SOLDIERTYPE *pSoldier, UINT8 ubItemPos, SOLDIERTYPE * // break; //} // JA2Gold: added - if ( Item[pSoldier->inv[ubItemPos].usItem].flare ) + if (ItemIsFlare(pSoldier->inv[ubItemPos].usItem)) { return( 5 * ( LightTrueLevel( pOpponent->sGridNo, pOpponent->pathing.bLevel ) - NORMAL_LIGHTLEVEL_DAY ) ); } @@ -2496,7 +2497,7 @@ INT32 EstimateStabDamage( SOLDIERTYPE *pSoldier, SOLDIERTYPE *pOpponent, INT16 u { if (gGameOptions.fNewTraitSystem) { - if (!pSoldier->usAttackingWeapon || Item[usItem].brassknuckles) + if (!pSoldier->usAttackingWeapon || ItemIsBrassKnuckles(usItem)) { // add bonus for martial arts if (HAS_SKILL_TRAIT(pSoldier, MARTIAL_ARTS_NT)) @@ -2765,13 +2766,13 @@ INT8 CanNPCAttack(SOLDIERTYPE *pSoldier) RearrangePocket( pSoldier, HANDPOS, bWeaponIn, FOREVER ); // look for another weapon if this one is 1-handed // if ( (Item[ pSoldier->inv[ HANDPOS ].usItem ].usItemClass == IC_GUN) && !(Item[ pSoldier->inv[ HANDPOS ].usItem ].fFlags & ITEM_TWO_HANDED ) ) - if ( (Item[ pSoldier->inv[ HANDPOS ].usItem ].usItemClass == IC_GUN) && !(Item[ pSoldier->inv[ HANDPOS ].usItem ].twohanded ) ) + if ( (Item[ pSoldier->inv[ HANDPOS ].usItem ].usItemClass == IC_GUN) && !ItemIsTwoHanded(pSoldier->inv[ HANDPOS ].usItem) ) { // look for another pistol/SMG if available // CHRISL: Change final parameter to use dynamic pocket definition bWeaponIn = FindAIUsableObjClassWithin( pSoldier, IC_WEAPON, BIGPOCKSTART, NUM_INV_SLOTS ); // if (bWeaponIn != NO_SLOT && (Item[ pSoldier->inv[ bWeaponIn ].usItem ].usItemClass == IC_GUN) && !(Item[ pSoldier->inv[ bWeaponIn ].usItem ].fFlags & ITEM_TWO_HANDED ) ) - if (bWeaponIn != NO_SLOT && (Item[ pSoldier->inv[ bWeaponIn ].usItem ].usItemClass == IC_GUN) && !(Item[ pSoldier->inv[ bWeaponIn ].usItem ].twohanded ) ) + if (bWeaponIn != NO_SLOT && (Item[ pSoldier->inv[ bWeaponIn ].usItem ].usItemClass == IC_GUN) && !ItemIsTwoHanded(pSoldier->inv[ bWeaponIn ].usItem) ) { DebugMsg (TOPIC_JA2,DBG_LEVEL_3,"cannpcattack: swapping weapon into holster"); RearrangePocket( pSoldier, SECONDHANDPOS, bWeaponIn, FOREVER ); diff --git a/TacticalAI/DecideAction.cpp b/TacticalAI/DecideAction.cpp index e4a1e0ad7..af862c890 100644 --- a/TacticalAI/DecideAction.cpp +++ b/TacticalAI/DecideAction.cpp @@ -2735,15 +2735,16 @@ INT8 DecideActionRed(SOLDIERTYPE *pSoldier) if (BestThrow.ubPossible) { // sevenfm: allow using mortars, grenade launchers, flares and grenades in RED state - if (Item[pSoldier->inv[BestThrow.bWeaponIn].usItem].mortar || - //Item[pSoldier->inv[ BestThrow.bWeaponIn ].usItem].cannon || - Item[pSoldier->inv[BestThrow.bWeaponIn].usItem].rocketlauncher || - Item[pSoldier->inv[BestThrow.bWeaponIn].usItem].grenadelauncher || - Item[pSoldier->inv[BestThrow.bWeaponIn].usItem].flare || - Item[pSoldier->inv[BestThrow.bWeaponIn].usItem].usItemClass & IC_GRENADE) + UINT16 usItem = pSoldier->inv[BestThrow.bWeaponIn].usItem; + if (ItemIsMortar(usItem) || + //Item[usItem].cannon || + ItemIsRocketLauncher(usItem) || + ItemIsGrenadeLauncher(usItem) || + ItemIsFlare(usItem) || + Item[usItem].usItemClass & IC_GRENADE) { // if firing mortar make sure we have room - if (Item[pSoldier->inv[BestThrow.bWeaponIn].usItem].mortar) + if (ItemIsMortar(usItem)) { DebugAI(AI_MSG_INFO, pSoldier, String("using mortar, check room to deploy")); ubOpponentDir = AIDirection(pSoldier->sGridNo, BestThrow.sTarget); @@ -5503,7 +5504,7 @@ INT16 ubMinAPCost; if (BestThrow.ubPossible) { DebugMsg (TOPIC_JA2,DBG_LEVEL_3,"good throw possible"); - if ( Item[pSoldier->inv[ BestThrow.bWeaponIn ].usItem].mortar ) + if (ItemIsMortar(pSoldier->inv[ BestThrow.bWeaponIn ].usItem)) { ubOpponentDir = AIDirection(pSoldier->sGridNo, BestThrow.sTarget); @@ -6323,7 +6324,7 @@ INT16 ubMinAPCost; } // SANDRO: more likely to burst when firing from hip - if ( BestAttack.bScopeMode == USE_ALT_WEAPON_HOLD && Item[pSoldier->inv[BestAttack.bWeaponIn].usItem].twohanded ) + if ( BestAttack.bScopeMode == USE_ALT_WEAPON_HOLD && ItemIsTwoHanded(pSoldier->inv[BestAttack.bWeaponIn].usItem) ) iChance += 40; // CHRISL: Changed from a simple flag to two externalized values for more modder control over AI suppression @@ -6440,7 +6441,7 @@ INT16 ubMinAPCost; } // SANDRO: more likely to burst when firing from hip - if ( BestAttack.bScopeMode == USE_ALT_WEAPON_HOLD && Item[pSoldier->inv[BestAttack.bWeaponIn].usItem].twohanded ) + if ( BestAttack.bScopeMode == USE_ALT_WEAPON_HOLD && ItemIsTwoHanded(pSoldier->inv[BestAttack.bWeaponIn].usItem) ) iChance += 40; // CHRISL: Changed from a simple flag to two externalized values for more modder control over AI suppression @@ -8403,10 +8404,10 @@ INT8 ArmedVehicleDecideActionRed( SOLDIERTYPE *pSoldier) if ( BestThrow.ubPossible ) { // if firing mortar make sure we have room - //if ( Item[pSoldier->inv[ BestThrow.bWeaponIn ].usItem].mortar ) //comm by ddd - if ( Item[pSoldier->inv[BestThrow.bWeaponIn].usItem].mortar - || Item[pSoldier->inv[BestThrow.bWeaponIn].usItem].grenadelauncher - || Item[pSoldier->inv[BestThrow.bWeaponIn].usItem].flare ) + UINT16 usItem = pSoldier->inv[BestThrow.bWeaponIn].usItem; + if (ItemIsMortar(usItem) + || ItemIsGrenadeLauncher(usItem) + || ItemIsFlare(usItem) ) { ubOpponentDir = GetDirectionFromGridNo( BestThrow.sTarget, pSoldier ); @@ -9799,7 +9800,7 @@ INT8 ArmedVehicleDecideActionBlack( SOLDIERTYPE *pSoldier ) if ( BestThrow.ubPossible ) { DebugMsg( TOPIC_JA2, DBG_LEVEL_3, "good throw possible" ); - if ( Item[pSoldier->inv[BestThrow.bWeaponIn].usItem].mortar ) + if (ItemIsMortar(pSoldier->inv[BestThrow.bWeaponIn].usItem)) { ubOpponentDir = (UINT8)GetDirectionFromGridNo( BestThrow.sTarget, pSoldier ); diff --git a/TacticalAI/FindLocations.cpp b/TacticalAI/FindLocations.cpp index 37fcd9846..3c9ab556f 100644 --- a/TacticalAI/FindLocations.cpp +++ b/TacticalAI/FindLocations.cpp @@ -1987,7 +1987,7 @@ INT8 SearchForItems( SOLDIERTYPE * pSoldier, INT8 bReason, UINT16 usItem ) if ( pItem->usItemClass == IC_GUN && (*pObj)[0]->data.objectStatus >= MINIMUM_REQUIRED_STATUS ) { // maybe this gun has ammo (adjust for whether it is better than ours!) - if ( (*pObj)[0]->data.gun.bGunAmmoStatus < 0 || (*pObj)[0]->data.gun.ubGunShotsLeft == 0 || (Item[pObj->usItem].fingerprintid && (*pObj)[0]->data.ubImprintID != NOBODY && (*pObj)[0]->data.ubImprintID != pSoldier->ubID) ) + if ( (*pObj)[0]->data.gun.bGunAmmoStatus < 0 || (*pObj)[0]->data.gun.ubGunShotsLeft == 0 || (ItemHasFingerPrintID(pObj->usItem) && (*pObj)[0]->data.ubImprintID != NOBODY && (*pObj)[0]->data.ubImprintID != pSoldier->ubID) ) { iTempValue = 0; } @@ -2028,7 +2028,7 @@ INT8 SearchForItems( SOLDIERTYPE * pSoldier, INT8 bReason, UINT16 usItem ) if (pItem->usItemClass & IC_WEAPON && (*pObj)[0]->data.objectStatus >= MINIMUM_REQUIRED_STATUS ) { DebugAI(AI_MSG_INFO, pSoldier, String("weapon has good status")); - if ( (pItem->usItemClass & IC_GUN) && ((*pObj)[0]->data.gun.bGunAmmoStatus < 0 || (*pObj)[0]->data.gun.ubGunShotsLeft == 0 || (( Item[pObj->usItem].fingerprintid ) && (*pObj)[0]->data.ubImprintID != NOBODY && (*pObj)[0]->data.ubImprintID != pSoldier->ubID) ) ) + if ( (pItem->usItemClass & IC_GUN) && ((*pObj)[0]->data.gun.bGunAmmoStatus < 0 || (*pObj)[0]->data.gun.ubGunShotsLeft == 0 || (ItemHasFingerPrintID(pObj->usItem) && (*pObj)[0]->data.ubImprintID != NOBODY && (*pObj)[0]->data.ubImprintID != pSoldier->ubID) ) ) { // jammed or out of ammo, skip it! DebugAI(AI_MSG_INFO, pSoldier, String("jammed or out of ammo, skip it!")); @@ -2079,7 +2079,7 @@ INT8 SearchForItems( SOLDIERTYPE * pSoldier, INT8 bReason, UINT16 usItem ) if ( pItem->usItemClass & IC_WEAPON && (*pObj)[0]->data.objectStatus >= MINIMUM_REQUIRED_STATUS ) { DebugAI(AI_MSG_INFO, pSoldier, String("gun has good status")); - if ( (pItem->usItemClass & IC_GUN) && ((*pObj)[0]->data.gun.bGunAmmoStatus < 0 || (*pObj)[0]->data.gun.ubGunShotsLeft == 0 || (( Item[pObj->usItem].fingerprintid ) && (*pObj)[0]->data.ubImprintID != NOBODY && (*pObj)[0]->data.ubImprintID != pSoldier->ubID) ) ) + if ( (pItem->usItemClass & IC_GUN) && ((*pObj)[0]->data.gun.bGunAmmoStatus < 0 || (*pObj)[0]->data.gun.ubGunShotsLeft == 0 || (ItemHasFingerPrintID(pObj->usItem) && (*pObj)[0]->data.ubImprintID != NOBODY && (*pObj)[0]->data.ubImprintID != pSoldier->ubID) ) ) { // jammed or out of ammo, skip it! DebugAI(AI_MSG_INFO, pSoldier, String("jammed or out of ammo, skip it!")); diff --git a/TacticalAI/NPC.cpp b/TacticalAI/NPC.cpp index 55606e27d..84702a013 100644 --- a/TacticalAI/NPC.cpp +++ b/TacticalAI/NPC.cpp @@ -1149,7 +1149,7 @@ UINT8 NPCConsiderReceivingItemFromMerc( UINT8 ubNPC, UINT8 ubMerc, OBJECTTYPE * ubLastQuoteRecord = NUM_NPC_QUOTE_RECORDS - 1; usItemToConsider = pObj->usItem; - if ( Item[ usItemToConsider ].usItemClass == IC_GUN && !Item[usItemToConsider].rocketlauncher ) + if ( Item[ usItemToConsider ].usItemClass == IC_GUN && !ItemIsRocketLauncher(usItemToConsider) ) { UINT8 ubWeaponClass; diff --git a/TacticalAI/PanicButtons.cpp b/TacticalAI/PanicButtons.cpp index b673c8d47..03c54f3f0 100644 --- a/TacticalAI/PanicButtons.cpp +++ b/TacticalAI/PanicButtons.cpp @@ -10,6 +10,7 @@ #include "Queen Command.h" + void MakeClosestEnemyChosenOne() { UINT32 cnt; diff --git a/TileEngine/Explosion Control.cpp b/TileEngine/Explosion Control.cpp index fac8bc3e5..d1281de3a 100644 --- a/TileEngine/Explosion Control.cpp +++ b/TileEngine/Explosion Control.cpp @@ -1614,7 +1614,7 @@ BOOLEAN DamageSoldierFromBlast( UINT8 ubPerson, UINT8 ubOwner, INT32 sBombGridNo // Demolitions damage bonus with bombs and mines if ( HAS_SKILL_TRAIT( MercPtrs[ ubOwner ], DEMOLITIONS_NT ) && Explosive[Item[usItem].ubClassIndex].ubType == EXPLOSV_NORMAL && Item[usItem].usItemClass == IC_BOMB && - (!Item[usItem].attachment || Item[usItem].mine )) + (!ItemIsAttachment(usItem) || ItemIsMine(usItem))) { sNewWoundAmt = (INT16)(sNewWoundAmt * (100 + gSkillTraitValues.ubDEDamageOfBombsAndMines) / 100.0f + 0.5f); } @@ -1627,9 +1627,9 @@ BOOLEAN DamageSoldierFromBlast( UINT8 ubPerson, UINT8 ubOwner, INT32 sBombGridNo // Heavy Weapons trait bonus damage with rocket, grenade launchers and mortar else if ( HAS_SKILL_TRAIT( MercPtrs[ ubOwner ], HEAVY_WEAPONS_NT ) && Explosive[Item[usItem].ubClassIndex].ubType == EXPLOSV_NORMAL && - ((Item[usItem].usItemClass == IC_BOMB && Item[usItem].attachment && !Item[usItem].mine ) || // mortar shells - (Item[usItem].usItemClass == IC_GRENADE && (Item[usItem].glgrenade || Item[usItem].electronic) ) || // rockets for rocketlaunchers (I haven't found any other way) - (Item[usItem].usItemClass == IC_LAUNCHER ) || Item[usItem].rocketlauncher || Item[usItem].singleshotrocketlauncher ) ) + ((Item[usItem].usItemClass == IC_BOMB && ItemIsAttachment(usItem) && !ItemIsMine(usItem) ) || // mortar shells + (Item[usItem].usItemClass == IC_GRENADE && (ItemIsGLgrenade(usItem) || ItemIsElectronic(usItem)) ) || // rockets for rocketlaunchers (I haven't found any other way) + (Item[usItem].usItemClass == IC_LAUNCHER ) || ItemIsRocketLauncher(usItem) || ItemIsSingleShotRocketLauncher(usItem) ) ) { sNewWoundAmt = (INT16)(sNewWoundAmt * (100 + gSkillTraitValues.ubHWDamageBonusPercentForHW * NUM_SKILL_TRAITS( MercPtrs[ ubOwner ], HEAVY_WEAPONS_NT )) / 100.0f + 0.5f); // +15% } @@ -1640,7 +1640,7 @@ BOOLEAN DamageSoldierFromBlast( UINT8 ubPerson, UINT8 ubOwner, INT32 sBombGridNo { sNewWoundAmt = (INT16)(sNewWoundAmt * (100 - gSkillTraitValues.bTanksDamageResistanceModifier) / 100); // another half of this for ordinary grenades - if ( (( Item[usItem].usItemClass == IC_GRENADE ) || Item[usItem].glgrenade ) && !Item[usItem].electronic ) + if ( (( Item[usItem].usItemClass == IC_GRENADE ) || ItemIsGLgrenade(usItem) ) && !ItemIsElectronic(usItem)) sNewWoundAmt = (INT16)(sNewWoundAmt * (100 - (gSkillTraitValues.bTanksDamageResistanceModifier / 2)) / 100); } @@ -3858,10 +3858,10 @@ BOOLEAN ActivateSurroundingTripwire( UINT8 ubID, INT32 sGridNo, INT8 bLevel, UIN usBombItem = (*pObj)[0]->data.misc.usBombItem; // if item can be activated by tripwire, detonate it - if ( Item[usBombItem].tripwireactivation == 1 ) + if (ItemHasTripwireActivation(usBombItem)) { // tripwire just gets activated - if ( Item[usBombItem].tripwire == 1 ) + if (ItemIsTripwire(usBombItem)) { // this is important - we have to check wether the wire has already been activated if ( ( (*pObj)[0]->data.sObjectFlag & TRIPWIRE_ACTIVATED ) == 0 ) @@ -4029,7 +4029,7 @@ void HandleExplosionQueue( void ) CallAvailableEnemiesTo( sGridNo ); //RemoveItemFromPool( sGridNo, gWorldBombs[ uiWorldBombIndex ].iItemIndex, 0 ); } - else if ( (*pObj)[0]->data.misc.usBombItem == TRIP_FLARE || Item[pObj->usItem].flare) + else if ( (*pObj)[0]->data.misc.usBombItem == TRIP_FLARE || ItemIsFlare(pObj->usItem)) { // sevenfm: changed pObj->usItem to Item[pObj->usItem].ubClassIndex as it should be correct explosives index // NewLightEffect( sGridNo, (UINT8)Explosive[pObj->usItem].ubDuration, (UINT8)Explosive[pObj->usItem].ubStartRadius ); @@ -4128,7 +4128,7 @@ void HandleExplosionQueue( void ) } // Flugente: handle tripwire gun traps here... // tripwire gets called and activated in ActivateSurroundingTripwire - else if ( Item[pObj->usItem].tripwire == 1 ) + else if (ItemIsTripwire(pObj->usItem)) { OBJECTTYPE newtripwireObject; CreateItem( pObj->usItem, (*pObj)[0]->data.objectStatus, &newtripwireObject ); @@ -4189,7 +4189,7 @@ void HandleExplosionQueue( void ) // Flugente: handle tripwire gun traps here... // tripwire gets called and activated in ActivateSurroundingTripwire // now for action item tripwire - else if ( pObj->usItem == ACTION_ITEM && (*pObj)[0]->data.misc.bActionValue == ACTION_ITEM_BLOW_UP && Item[(*pObj)[0]->data.misc.usBombItem].tripwire == 1 ) + else if ( pObj->usItem == ACTION_ITEM && (*pObj)[0]->data.misc.bActionValue == ACTION_ITEM_BLOW_UP && ItemIsTripwire((*pObj)[0]->data.misc.usBombItem) ) { OBJECTTYPE newtripwireObject; CreateItem( (*pObj)[0]->data.misc.usBombItem, (*pObj)[0]->data.objectStatus, &newtripwireObject ); @@ -4910,7 +4910,7 @@ BOOLEAN SetOffBombsInGridNo( UINT8 ubID, INT32 sGridNo, BOOLEAN fAllBombs, INT8 if (fAllBombs || (*pObj)[0]->data.misc.bDetonatorType == BOMB_PRESSURE) { // Flugente: if this is a anti-tank mine, only detonate it if the person triggering it is (in) a vehicle, or if we detonate everything unconditional - if ( !fAllBombs && ubID != NOBODY && Item[pObj->usItem].antitankmine ) + if ( !fAllBombs && ubID != NOBODY && ItemIsATMine(pObj->usItem)) { // if this is not a vehicle, not a robot and not a tank, don't activate if ( !(MercPtrs[ubID]->flags.uiStatusFlags & SOLDIER_VEHICLE) && !AM_A_ROBOT( MercPtrs[ubID] ) && !ARMED_VEHICLE( MercPtrs[ubID] ) && !ENEMYROBOT( MercPtrs[ubID] ) ) @@ -4942,7 +4942,7 @@ BOOLEAN SetOffBombsInGridNo( UINT8 ubID, INT32 sGridNo, BOOLEAN fAllBombs, INT8 SetOffBombsByFrequency( ubID, (*pObj)[0]->data.misc.bFrequency ); } // Flugente: a tripwire activates all other tripwires in connection, and detonates all bombs in connection that are tripwire-activated - else if ( Item[pObj->usItem].tripwire == 1 || (pObj->usItem == ACTION_ITEM && (*pObj)[0]->data.misc.bActionValue == ACTION_ITEM_BLOW_UP && Item[(*pObj)[0]->data.misc.usBombItem].tripwire == 1 ) ) + else if (ItemIsTripwire(pObj->usItem) || (pObj->usItem == ACTION_ITEM && (*pObj)[0]->data.misc.bActionValue == ACTION_ITEM_BLOW_UP && ItemIsTripwire((*pObj)[0]->data.misc.usBombItem) ) ) { gubPersonToSetOffExplosions = ubID; @@ -5449,7 +5449,7 @@ void FireFragments( UINT8 ubOwner, INT16 sX, INT16 sY, INT16 sZ, UINT16 usItem, FLOAT dRandomZ = 0; // if explosive is directional, calculation of frags is different - if ( Item[usItem].directional == TRUE ) + if (ItemIsDirectional(usItem)) { // Flugente: if item is a directional explosive, determine in what direction the frags should fly INT16 degree = (45 + ubDirection * 45) % 360; // modulo 360 to prevent nonsense from nonsensical input @@ -5891,7 +5891,7 @@ void HandleBuddyExplosions(UINT8 ubOwner, INT16 sX, INT16 sY, INT16 sZ, INT32 sG // Flugente: Items can have secondary explosions if ( Item[usItem].usBuddyItem ) { - if ( Item[Item[usItem].usBuddyItem].flare ) + if (ItemIsFlare(Item[usItem].usBuddyItem)) { if( !sZ || !FindBuilding(sGridNo) ) { @@ -5929,10 +5929,10 @@ BOOLEAN HandleAttachedExplosions(UINT8 ubOwner, INT16 sX, INT16 sY, INT16 sZ, IN if ( iter->exists() && Item[iter->usItem].usItemClass & (IC_GRENADE|IC_BOMB) ) { // no need for binder if both item and attachment are tripwire-activated - if( ( Item[pObj->usItem].tripwireactivation && Item[iter->usItem].tripwireactivation ) || + if( (ItemHasTripwireActivation(pObj->usItem) && ItemHasTripwireActivation(iter->usItem)) || ( binderFound && detonator && Explosive[Item[iter->usItem].ubClassIndex].ubVolatility > 0 ) ) { - if(Item[iter->usItem].directional && ubDirection == DIRECTION_IRRELEVANT) + if(ItemIsDirectional(iter->usItem) && ubDirection == DIRECTION_IRRELEVANT) direction=Random(8); else direction=ubDirection; @@ -5953,7 +5953,7 @@ BOOLEAN HandleAttachedExplosions(UINT8 ubOwner, INT16 sX, INT16 sY, INT16 sZ, IN } if ( binderFound && detonator && gGameExternalOptions.bAllowSpecialExplosiveAttachments && iter->exists() && Item[iter->usItem].usItemClass & IC_MISC ) { - if(Item[iter->usItem].gascan) + if(ItemIsGascan(iter->usItem)) { IgniteExplosion( ubOwner, sX, sY, sZ, sGridNo, GAS_EXPLOSION, bLevel, DIRECTION_IRRELEVANT , NULL ); fAttFound = TRUE; @@ -5963,7 +5963,7 @@ BOOLEAN HandleAttachedExplosions(UINT8 ubOwner, INT16 sX, INT16 sY, INT16 sZ, IN IgniteExplosion( ubOwner, sX, sY, sZ, sGridNo, MOLOTOV_EXPLOSION, bLevel, DIRECTION_IRRELEVANT , NULL ); fAttFound = TRUE; } - if(Item[iter->usItem].marbles) + if(ItemIsMarbles(iter->usItem)) { IgniteExplosion( ubOwner, sX, sY, sZ, sGridNo, FRAG_EXPLOSION, bLevel, DIRECTION_IRRELEVANT , NULL ); fAttFound = TRUE; @@ -6017,7 +6017,7 @@ UINT16 CalcTotalVolatility(OBJECTTYPE * pObj) if ( iter->exists() && Item[iter->usItem].usItemClass & (IC_GRENADE|IC_BOMB) ) { // no need for binder if both item and attachment are tripwire-activated - if( ( Item[usItem].tripwireactivation && Item[iter->usItem].tripwireactivation ) || + if( (ItemHasTripwireActivation(usItem) && ItemHasTripwireActivation(iter->usItem)) || ( binderFound && detonator && Explosive[Item[iter->usItem].ubClassIndex].ubVolatility > 0 ) ) { totalVolatility += Explosive[Item[iter->usItem].ubClassIndex].ubVolatility; diff --git a/TileEngine/physics.cpp b/TileEngine/physics.cpp index 68c55586c..138e4b097 100644 --- a/TileEngine/physics.cpp +++ b/TileEngine/physics.cpp @@ -531,8 +531,7 @@ BOOLEAN PhysicsUpdateLife( REAL_OBJECT *pObject, real DeltaTime ) else { // If we are in water, and we are a sinkable item... - // if ( !pObject->fInWater || !( Item[ pObject->Obj.usItem ].fFlags & ITEM_SINKS ) ) - if ( !pObject->fInWater || !( Item[ pObject->Obj.usItem ].sinks ) ) + if ( !pObject->fInWater || !ItemSinks(pObject->Obj.usItem) ) { if ( pObject->fDropItem ) { @@ -562,7 +561,7 @@ BOOLEAN PhysicsUpdateLife( REAL_OBJECT *pObject, real DeltaTime ) } // Make impact noise.... - if ( Item[pObject->Obj.usItem].rock ) + if (ItemIsRock(pObject->Obj.usItem)) { MakeNoise( pObject->ubOwner, pObject->sGridNo, 0, gpWorldLevelData[ pObject->sGridNo ].ubTerrainID, (UINT8) (9 + PreRandom( 9 ) ), NOISE_ROCK_IMPACT ); } @@ -1013,10 +1012,11 @@ BOOLEAN PhysicsCheckForCollisions( REAL_OBJECT *pObject, INT32 *piCollisionID ) if ( iCollisionCode == COLLISION_WINDOW_NORTHWEST || iCollisionCode == COLLISION_WINDOW_NORTHEAST || iCollisionCode == COLLISION_WINDOW_SOUTHWEST || iCollisionCode == COLLISION_WINDOW_SOUTHEAST ) { // sevenfm: added requirements for object to break window - if (Item[pObject->Obj.usItem].ubWeight >= 4 && - Item[pObject->Obj.usItem].sinks && - !Item[pObject->Obj.usItem].unaerodynamic && - (Item[pObject->Obj.usItem].metal || Item[pObject->Obj.usItem].rock)) + UINT16 usItem = pObject->Obj.usItem; + if (Item[usItem].ubWeight >= 4 && + ItemSinks(usItem) && + !ItemIsUnaerodynamic(usItem) && + (ItemIsMetal(usItem) || ItemIsRock(usItem))) { if (!pObject->fTestObject) { @@ -1927,7 +1927,7 @@ void CalculateLaunchItemBasicParams( SOLDIERTYPE *pSoldier, OBJECTTYPE *pItem, I DebugMsg(TOPIC_JA2,DBG_LEVEL_3,String("physics.cpp line 1741")); - if ( fArmed && ( Item[usLauncher].mortar || Item[pItem->usItem].mortar ) ) + if ( fArmed && (ItemIsMortar(usLauncher) || ItemIsMortar(pItem->usItem)) ) { // Start at 0.... sStartZ = ( pSoldier->pathing.bLevel * 256 ); @@ -1937,7 +1937,7 @@ void CalculateLaunchItemBasicParams( SOLDIERTYPE *pSoldier, OBJECTTYPE *pItem, I } DebugMsg(TOPIC_JA2,DBG_LEVEL_3,String("physics.cpp line 1750")); - if ( fArmed && ( Item[usLauncher].grenadelauncher || Item[pItem->usItem].grenadelauncher ) ) + if ( fArmed && (ItemIsGrenadeLauncher(usLauncher) || ItemIsGrenadeLauncher(pItem->usItem)) ) { // OK, look at target level and decide angle to use... if ( ubLevel == 1 ) @@ -2327,7 +2327,7 @@ void CalculateLaunchItemParamsForThrow( SOLDIERTYPE *pSoldier, INT32 sGridNo, UI } // set the max miss radius - if ( Item[usItemNum].mortar ) + if (ItemIsMortar(usItemNum)) { bMaxRadius = gItemSettings.usMissMaxRadiusMortar; } @@ -2413,7 +2413,7 @@ void CalculateLaunchItemParamsForThrow( SOLDIERTYPE *pSoldier, INT32 sGridNo, UI DebugMsg(TOPIC_JA2,DBG_LEVEL_3,String("physics.cpp line 2103")); - if ( fArmed && Item[usLauncher].mortar ) + if ( fArmed && ItemIsMortar(usLauncher)) { // Start at 0.... sStartZ = ( pSoldier->pathing.bLevel * 256 ) + 50; @@ -2665,7 +2665,7 @@ void HandleArmedObjectImpact( REAL_OBJECT *pObject ) { fCheckForDuds = TRUE; - if (CanDelayGrenadeExplosion(pObj->usItem) && (Item[pObj->usItem].ubCursor == TOSSCURS || Item[pObj->usItem].glgrenade)) + if (CanDelayGrenadeExplosion(pObj->usItem) && (Item[pObj->usItem].ubCursor == TOSSCURS || ItemIsGLgrenade(pObj->usItem))) { fCanDelayExplosion = TRUE; } @@ -2780,7 +2780,7 @@ void HandleArmedObjectImpact( REAL_OBJECT *pObject ) if ( fDoImpact ) { - if ( Item[pObject->Obj.usItem].flare ) + if (ItemIsFlare(pObject->Obj.usItem)) { //if the light object will be created OFF the ground if( pObject->Position.z > 0 && FindBuilding(pObject->sGridNo) ) diff --git a/Utils/XML_Items.cpp b/Utils/XML_Items.cpp index 76652ae4c..412a96faa 100644 --- a/Utils/XML_Items.cpp +++ b/Utils/XML_Items.cpp @@ -561,90 +561,101 @@ itemEndElementHandle(void *userData, const XML_Char *name) pData->curElement = ELEMENT; pData->curItem.bRepairEase = (INT8) atol(pData->szCharData); } - //else if(strcmp(name, "fFlags") == 0) - //{ - // pData->curElement = ELEMENT; - // pData->curItem.fFlags = (BOOLEAN) atol(pData->szCharData); - //} else if(strcmp(name, "Damageable") == 0) { pData->curElement = ELEMENT; - pData->curItem.damageable = (BOOLEAN) atol(pData->szCharData); + if ((BOOLEAN)atol(pData->szCharData)) + pData->curItem.usItemFlag |= ITEM_damageable; } else if(strcmp(name, "Repairable") == 0) { pData->curElement = ELEMENT; - pData->curItem.repairable = (BOOLEAN) atol(pData->szCharData); + if ((BOOLEAN)atol(pData->szCharData)) + pData->curItem.usItemFlag |= ITEM_repairable; } else if(strcmp(name, "WaterDamages") == 0) { pData->curElement = ELEMENT; - pData->curItem.waterdamages = (BOOLEAN) atol(pData->szCharData); + if ((BOOLEAN)atol(pData->szCharData)) + pData->curItem.usItemFlag |= ITEM_waterdamages; } else if(strcmp(name, "Metal") == 0) { pData->curElement = ELEMENT; - pData->curItem.metal = (BOOLEAN) atol(pData->szCharData); + if ((BOOLEAN)atol(pData->szCharData)) + pData->curItem.usItemFlag |= ITEM_metal; } else if(strcmp(name, "Sinks") == 0) { pData->curElement = ELEMENT; - pData->curItem.sinks = (BOOLEAN) atol(pData->szCharData); + if ((BOOLEAN)atol(pData->szCharData)) + pData->curItem.usItemFlag |= ITEM_sinks; } else if(strcmp(name, "ShowStatus") == 0) { pData->curElement = ELEMENT; - pData->curItem.showstatus = (BOOLEAN) atol(pData->szCharData); + if ((BOOLEAN)atol(pData->szCharData)) + pData->curItem.usItemFlag |= ITEM_showstatus; } else if(strcmp(name, "HiddenAddon") == 0) { pData->curElement = ELEMENT; - pData->curItem.hiddenaddon = (BOOLEAN) atol(pData->szCharData); + if ((BOOLEAN)atol(pData->szCharData)) + pData->curItem.usItemFlag |= ITEM_hiddenaddon; } else if(strcmp(name, "TwoHanded") == 0) { pData->curElement = ELEMENT; - pData->curItem.twohanded = (BOOLEAN) atol(pData->szCharData); + if ((BOOLEAN)atol(pData->szCharData)) + pData->curItem.usItemFlag |= ITEM_twohanded; } else if(strcmp(name, "NotBuyable") == 0) { pData->curElement = ELEMENT; - pData->curItem.notbuyable = (BOOLEAN) atol(pData->szCharData); + if ((BOOLEAN)atol(pData->szCharData)) + pData->curItem.usItemFlag |= ITEM_notbuyable; } else if(strcmp(name, "Attachment") == 0) { pData->curElement = ELEMENT; - pData->curItem.attachment = (BOOLEAN) atol(pData->szCharData); + if ((BOOLEAN)atol(pData->szCharData)) + pData->curItem.usItemFlag |= ITEM_attachment; } else if(strcmp(name, "HiddenAttachment") == 0) { pData->curElement = ELEMENT; - pData->curItem.hiddenattachment = (BOOLEAN) atol(pData->szCharData); + if ((BOOLEAN)atol(pData->szCharData)) + pData->curItem.usItemFlag |= ITEM_hiddenattachment; } else if(strcmp(name, "BigGunList") == 0) { pData->curElement = ELEMENT; - pData->curItem.biggunlist = (BOOLEAN) atol(pData->szCharData); + if ((BOOLEAN)atol(pData->szCharData)) + pData->curItem.usItemFlag |= ITEM_biggunlist; } else if(strcmp(name, "NotInEditor") == 0) { pData->curElement = ELEMENT; - pData->curItem.notineditor = (BOOLEAN) atol(pData->szCharData); + if ((BOOLEAN)atol(pData->szCharData)) + pData->curItem.usItemFlag |= ITEM_notineditor; } else if(strcmp(name, "DefaultUndroppable") == 0) { pData->curElement = ELEMENT; - pData->curItem.defaultundroppable = (BOOLEAN) atol(pData->szCharData); + if ((BOOLEAN)atol(pData->szCharData)) + pData->curItem.usItemFlag |= ITEM_defaultundroppable; } else if(strcmp(name, "Unaerodynamic") == 0) { pData->curElement = ELEMENT; - pData->curItem.unaerodynamic = (BOOLEAN) atol(pData->szCharData); + if ((BOOLEAN)atol(pData->szCharData)) + pData->curItem.usItemFlag |= ITEM_unaerodynamic; } else if(strcmp(name, "Electronic") == 0) { pData->curElement = ELEMENT; - pData->curItem.electronic = (BOOLEAN) atol(pData->szCharData); + if ((BOOLEAN)atol(pData->szCharData)) + pData->curItem.usItemFlag |= ITEM_electronic; } else if(strcmp(name, "Inseparable") == 0) { @@ -699,7 +710,8 @@ itemEndElementHandle(void *userData, const XML_Char *name) else if(strcmp(name, "GasMask") == 0) { pData->curElement = ELEMENT; - pData->curItem.gasmask = (BOOLEAN) atol(pData->szCharData); + if ((BOOLEAN)atol(pData->szCharData)) + pData->curItem.usItemFlag |= ITEM_gasmask; } else if(strcmp(name, "Bipod") == 0) { @@ -802,47 +814,56 @@ itemEndElementHandle(void *userData, const XML_Char *name) else if(strcmp(name, "GrenadeLauncher") == 0) { pData->curElement = ELEMENT; - pData->curItem.grenadelauncher = (BOOLEAN) atol(pData->szCharData); + if ((BOOLEAN)atol(pData->szCharData)) + pData->curItem.usItemFlag |= ITEM_grenadelauncher; } else if(strcmp(name, "LockBomb") == 0) { pData->curElement = ELEMENT; - pData->curItem.lockbomb = (BOOLEAN) atol(pData->szCharData); + if ((BOOLEAN)atol(pData->szCharData)) + pData->curItem.usItemFlag |= ITEM_lockbomb; } else if(strcmp(name, "Flare") == 0) { pData->curElement = ELEMENT; - pData->curItem.flare = (BOOLEAN) atol(pData->szCharData); + if ((BOOLEAN)atol(pData->szCharData)) + pData->curItem.usItemFlag |= ITEM_flare; } else if(strcmp(name, "Duckbill") == 0) { pData->curElement = ELEMENT; - pData->curItem.duckbill = (BOOLEAN) atol(pData->szCharData); + if ((BOOLEAN)atol(pData->szCharData)) + pData->curItem.usItemFlag |= ITEM_duckbill; } else if(strcmp(name, "Detonator") == 0) { pData->curElement = ELEMENT; - pData->curItem.detonator = (BOOLEAN) atol(pData->szCharData); + if ((BOOLEAN)atol(pData->szCharData)) + pData->curItem.usItemFlag |= ITEM_detonator; } else if(strcmp(name, "RemoteDetonator") == 0) { pData->curElement = ELEMENT; - pData->curItem.remotedetonator = (BOOLEAN) atol(pData->szCharData); + if ((BOOLEAN)atol(pData->szCharData)) + pData->curItem.usItemFlag |= ITEM_remotedetonator; } else if(strcmp(name, "ThermalOptics") == 0) { pData->curElement = ELEMENT; - pData->curItem.thermaloptics = (BOOLEAN) atol(pData->szCharData); + if ((BOOLEAN)atol(pData->szCharData)) + pData->curItem.usItemFlag2 |= ITEM_thermaloptics; } else if(strcmp(name, "SciFi") == 0) { pData->curElement = ELEMENT; - pData->curItem.scifi = (BOOLEAN) atol(pData->szCharData); + if ((BOOLEAN)atol(pData->szCharData)) + pData->curItem.usItemFlag2 |= ITEM_scifi; } else if(strcmp(name, "NewInv") == 0) { pData->curElement = ELEMENT; - pData->curItem.newinv = (BOOLEAN) atol(pData->szCharData); + if ((BOOLEAN)atol(pData->szCharData)) + pData->curItem.usItemFlag2 |= ITEM_newinv; } else if(strcmp(name, "AttachmentSystem") == 0) { @@ -852,17 +873,20 @@ itemEndElementHandle(void *userData, const XML_Char *name) else if(strcmp(name, "HideMuzzleFlash") == 0) { pData->curElement = ELEMENT; - pData->curItem.hidemuzzleflash = (BOOLEAN) atol(pData->szCharData); + if ((BOOLEAN)atol(pData->szCharData)) + pData->curItem.usItemFlag |= ITEM_hidemuzzleflash; } else if(strcmp(name, "Cannon") == 0) { pData->curElement = ELEMENT; - pData->curItem.cannon = (BOOLEAN) atol(pData->szCharData); + if ((BOOLEAN)atol(pData->szCharData)) + pData->curItem.usItemFlag |= ITEM_cannon; } else if(strcmp(name, "RocketRifle") == 0) { pData->curElement = ELEMENT; - pData->curItem.rocketrifle = (BOOLEAN) atol(pData->szCharData); + if ((BOOLEAN)atol(pData->szCharData)) + pData->curItem.usItemFlag |= ITEM_rocketrifle; } else if(strcmp(name, "Alcohol") == 0) { @@ -874,12 +898,14 @@ itemEndElementHandle(void *userData, const XML_Char *name) else if(strcmp(name, "Hardware") == 0) { pData->curElement = ELEMENT; - pData->curItem.hardware = (BOOLEAN) atol(pData->szCharData); + if ((BOOLEAN)atol(pData->szCharData)) + pData->curItem.usItemFlag2 |= ITEM_hardware; } else if(strcmp(name, "Medical") == 0) { pData->curElement = ELEMENT; - pData->curItem.medical = (BOOLEAN) atol(pData->szCharData); + if ((BOOLEAN)atol(pData->szCharData)) + pData->curItem.usItemFlag2 |= ITEM_medical; } else if(strcmp(name, "DamageBonus") == 0) { @@ -894,28 +920,26 @@ itemEndElementHandle(void *userData, const XML_Char *name) else if(strcmp(name, "Mortar") == 0) { pData->curElement = ELEMENT; - pData->curItem.mortar = (BOOLEAN) atol(pData->szCharData); + if ((BOOLEAN)atol(pData->szCharData)) + pData->curItem.usItemFlag |= ITEM_mortar; } else if(strcmp(name, "RocketLauncher") == 0) { pData->curElement = ELEMENT; - pData->curItem.rocketlauncher = (BOOLEAN) atol(pData->szCharData); + if ((BOOLEAN)atol(pData->szCharData)) + pData->curItem.usItemFlag |= ITEM_rocketlauncher; } else if(strcmp(name, "SingleShotRocketLauncher") == 0) { pData->curElement = ELEMENT; - pData->curItem.singleshotrocketlauncher = (BOOLEAN) atol(pData->szCharData); + if ((BOOLEAN)atol(pData->szCharData)) + pData->curItem.usItemFlag2 |= ITEM_singleshotrocketlauncher; } else if(strcmp(name, "DiscardedLauncherItem") == 0) { pData->curElement = ELEMENT; pData->curItem.discardedlauncheritem = (UINT16) atol(pData->szCharData); } - else if(strcmp(name, "SingleShotRocketLauncher") == 0) - { - pData->curElement = ELEMENT; - pData->curItem.singleshotrocketlauncher = (BOOLEAN) atol(pData->szCharData); - } else if(strcmp(name, "BloodiedItem") == 0) { pData->curElement = ELEMENT; @@ -934,22 +958,26 @@ itemEndElementHandle(void *userData, const XML_Char *name) else if(strcmp(name, "BrassKnuckles") == 0) { pData->curElement = ELEMENT; - pData->curItem.brassknuckles = (BOOLEAN) atol(pData->szCharData); + if ((BOOLEAN)atol(pData->szCharData)) + pData->curItem.usItemFlag2 |= ITEM_brassknuckles; } else if(strcmp(name, "Crowbar") == 0) { pData->curElement = ELEMENT; - pData->curItem.crowbar = (BOOLEAN) atol(pData->szCharData); + if ((BOOLEAN)atol(pData->szCharData)) + pData->curItem.usItemFlag2 |= ITEM_crowbar; } else if(strcmp(name, "GLGrenade") == 0) { pData->curElement = ELEMENT; - pData->curItem.glgrenade = (BOOLEAN) atol(pData->szCharData); + if ((BOOLEAN)atol(pData->szCharData)) + pData->curItem.usItemFlag2 |= ITEM_glgrenade; } else if(strcmp(name, "FlakJacket") == 0) { pData->curElement = ELEMENT; - pData->curItem.flakjacket = (BOOLEAN) atol(pData->szCharData); + if ((BOOLEAN)atol(pData->szCharData)) + pData->curItem.usItemFlag2 |= ITEM_flakjacket; } else if(strcmp(name, "HearingRangeBonus") == 0) { @@ -989,117 +1017,140 @@ itemEndElementHandle(void *userData, const XML_Char *name) else if(strcmp(name, "LeatherJacket") == 0) { pData->curElement = ELEMENT; - pData->curItem.leatherjacket = (BOOLEAN) atol(pData->szCharData); + if ((BOOLEAN)atol(pData->szCharData)) + pData->curItem.usItemFlag2 |= ITEM_leatherjacket; } else if(strcmp(name, "NeedsBatteries") == 0) { pData->curElement = ELEMENT; - pData->curItem.needsbatteries = (BOOLEAN) atol(pData->szCharData); + if ((BOOLEAN)atol(pData->szCharData)) + pData->curItem.usItemFlag2 |= ITEM_needsbatteries; } else if(strcmp(name, "Batteries") == 0) { pData->curElement = ELEMENT; - pData->curItem.batteries = (BOOLEAN) atol(pData->szCharData); + if ((BOOLEAN)atol(pData->szCharData)) + pData->curItem.usItemFlag2 |= ITEM_batteries; } else if(strcmp(name, "XRay") == 0) { pData->curElement = ELEMENT; - pData->curItem.xray = (BOOLEAN) atol(pData->szCharData); + if ((BOOLEAN)atol(pData->szCharData)) + pData->curItem.usItemFlag2 |= ITEM_xray; } else if(strcmp(name, "WireCutters") == 0) { pData->curElement = ELEMENT; - pData->curItem.wirecutters = (BOOLEAN) atol(pData->szCharData); + if ((BOOLEAN)atol(pData->szCharData)) + pData->curItem.usItemFlag2 |= ITEM_wirecutters; } else if(strcmp(name, "Toolkit") == 0) { pData->curElement = ELEMENT; - pData->curItem.toolkit = (BOOLEAN) atol(pData->szCharData); + if ((BOOLEAN)atol(pData->szCharData)) + pData->curItem.usItemFlag2 |= ITEM_toolkit; } else if(strcmp(name, "Canteen") == 0) { pData->curElement = ELEMENT; - pData->curItem.canteen = (BOOLEAN) atol(pData->szCharData); + if ((BOOLEAN)atol(pData->szCharData)) + pData->curItem.usItemFlag2 |= ITEM_canteen; } else if(strcmp(name, "Marbles") == 0) { pData->curElement = ELEMENT; - pData->curItem.marbles = (BOOLEAN) atol(pData->szCharData); + if ((BOOLEAN)atol(pData->szCharData)) + pData->curItem.usItemFlag2 |= ITEM_marbles; } else if(strcmp(name, "Walkman") == 0) { pData->curElement = ELEMENT; - pData->curItem.walkman = (BOOLEAN) atol(pData->szCharData); + if ((BOOLEAN)atol(pData->szCharData)) + pData->curItem.usItemFlag2 |= ITEM_walkman; } else if(strcmp(name, "RemoteTrigger") == 0) { pData->curElement = ELEMENT; - pData->curItem.remotetrigger = (BOOLEAN) atol(pData->szCharData); + if ((BOOLEAN)atol(pData->szCharData)) + pData->curItem.usItemFlag2 |= ITEM_remotetrigger; } else if(strcmp(name, "RobotRemoteControl") == 0) { pData->curElement = ELEMENT; - pData->curItem.robotremotecontrol = (BOOLEAN) atol(pData->szCharData); + if ((BOOLEAN)atol(pData->szCharData)) + pData->curItem.usItemFlag2 |= ITEM_robotremotecontrol; } else if(strcmp(name, "CamouflageKit") == 0) { pData->curElement = ELEMENT; - pData->curItem.camouflagekit = (BOOLEAN) atol(pData->szCharData); + if ((BOOLEAN)atol(pData->szCharData)) + pData->curItem.usItemFlag2 |= ITEM_camouflagekit; } else if(strcmp(name, "LocksmithKit") == 0) { pData->curElement = ELEMENT; - pData->curItem.locksmithkit = (BOOLEAN) atol(pData->szCharData); + if ((BOOLEAN)atol(pData->szCharData)) + pData->curItem.usItemFlag2 |= ITEM_locksmithkit; } else if(strcmp(name, "Mine") == 0) { pData->curElement = ELEMENT; - pData->curItem.mine = (BOOLEAN) atol(pData->szCharData); + if ((BOOLEAN)atol(pData->szCharData)) + pData->curItem.usItemFlag2 |= ITEM_mine; } else if ( strcmp( name, "antitankmine" ) == 0 ) { pData->curElement = ELEMENT; - pData->curItem.antitankmine = (BOOLEAN)atol( pData->szCharData ); + if ((BOOLEAN)atol(pData->szCharData)) + pData->curItem.usItemFlag2 |= ITEM_antitankmine; } else if(strcmp(name, "GasCan") == 0) { pData->curElement = ELEMENT; - pData->curItem.gascan = (BOOLEAN) atol(pData->szCharData); + if ((BOOLEAN)atol(pData->szCharData)) + pData->curItem.usItemFlag2 |= ITEM_gascan; } else if(strcmp(name, "CanAndString") == 0) { pData->curElement = ELEMENT; - pData->curItem.canandstring = (BOOLEAN) atol(pData->szCharData); + if ((BOOLEAN)atol(pData->szCharData)) + pData->curItem.usItemFlag2 |= ITEM_canandstring; } else if(strcmp(name, "ContainsLiquid") == 0) { pData->curElement = ELEMENT; - pData->curItem.containsliquid = (BOOLEAN) atol(pData->szCharData); + if ((BOOLEAN)atol(pData->szCharData)) + pData->curItem.usItemFlag2 |= ITEM_containsliquid; } else if(strcmp(name, "FingerPrintID") == 0) { pData->curElement = ELEMENT; - pData->curItem.fingerprintid = (BOOLEAN) atol(pData->szCharData); + if ((BOOLEAN)atol(pData->szCharData)) + pData->curItem.usItemFlag |= ITEM_fingerprintid; } else if(strcmp(name, "Rock") == 0) { pData->curElement = ELEMENT; - pData->curItem.rock = (BOOLEAN) atol(pData->szCharData); + if ((BOOLEAN)atol(pData->szCharData)) + pData->curItem.usItemFlag2 |= ITEM_rock; } else if(strcmp(name, "MedicalKit") == 0) { pData->curElement = ELEMENT; - pData->curItem.medicalkit = (BOOLEAN) atol(pData->szCharData); + if ((BOOLEAN)atol(pData->szCharData)) + pData->curItem.usItemFlag2 |= ITEM_medicalkit; } else if(strcmp(name, "FirstAidKit") == 0) { pData->curElement = ELEMENT; - pData->curItem.firstaidkit = (BOOLEAN) atol(pData->szCharData); + if ((BOOLEAN)atol(pData->szCharData)) + pData->curItem.usItemFlag2 |= ITEM_firstaidkit; } else if(strcmp(name, "MetalDetector") == 0) { pData->curElement = ELEMENT; - pData->curItem.metaldetector = (BOOLEAN) atol(pData->szCharData); + if ((BOOLEAN)atol(pData->szCharData)) + pData->curItem.usItemFlag |= ITEM_metaldetector; } if(strcmp(name, "PercentTunnelVision") == 0) //Madd: had to scrap the "else" due to a compiler limit { @@ -1109,7 +1160,8 @@ itemEndElementHandle(void *userData, const XML_Char *name) if(strcmp(name, "Jar") == 0) { pData->curElement = ELEMENT; - pData->curItem.jar = (BOOLEAN) atol(pData->szCharData); + if ((BOOLEAN)atol(pData->szCharData)) + pData->curItem.usItemFlag2 |= ITEM_jar; } if(strcmp(name, "BestLaserRange") == 0) { @@ -1228,7 +1280,8 @@ itemEndElementHandle(void *userData, const XML_Char *name) else if(strcmp(name, "barrel") == 0) { pData->curElement = ELEMENT; - pData->curItem.barrel = (BOOLEAN) atol(pData->szCharData); + if ((BOOLEAN)atol(pData->szCharData)) + pData->curItem.usItemFlag2 |= ITEM_barrel; } else if(strcmp(name, "usOverheatingCooldownFactor") == 0) { @@ -1263,17 +1316,20 @@ itemEndElementHandle(void *userData, const XML_Char *name) else if(strcmp(name, "TripWireActivation") == 0) { pData->curElement = ELEMENT; - pData->curItem.tripwireactivation = (BOOLEAN) atol(pData->szCharData); + if ((BOOLEAN)atol(pData->szCharData)) + pData->curItem.usItemFlag2 |= ITEM_tripwireactivation; } else if(strcmp(name, "TripWire") == 0) { pData->curElement = ELEMENT; - pData->curItem.tripwire = (BOOLEAN) atol(pData->szCharData); + if ((BOOLEAN)atol(pData->szCharData)) + pData->curItem.usItemFlag2 |= ITEM_tripwire; } else if(strcmp(name, "Directional") == 0) { pData->curElement = ELEMENT; - pData->curItem.directional = (BOOLEAN) atol(pData->szCharData); + if ((BOOLEAN)atol(pData->szCharData)) + pData->curItem.usItemFlag2 |= ITEM_directional; } else if(strcmp(name, "DrugType") == 0) { @@ -1283,7 +1339,8 @@ itemEndElementHandle(void *userData, const XML_Char *name) else if(strcmp(name, "BlockIronSight") == 0) { pData->curElement = ELEMENT; - pData->curItem.blockironsight = (BOOLEAN) atol(pData->szCharData); + if ((BOOLEAN)atol(pData->szCharData)) + pData->curItem.usItemFlag2 |= ITEM_blockironsight; } else if(strcmp(name, "ItemFlag") == 0) { @@ -1394,12 +1451,14 @@ itemEndElementHandle(void *userData, const XML_Char *name) else if (strcmp(name, "fAllowClimbing") == 0) { pData->curElement = ELEMENT; - pData->curItem.fAllowClimbing = (BOOLEAN)atol(pData->szCharData); + if ((BOOLEAN)atol(pData->szCharData)) + pData->curItem.usItemFlag2 |= ITEM_fAllowClimbing; } else if ( strcmp( name, "cigarette" ) == 0 ) { pData->curElement = ELEMENT; - pData->curItem.cigarette = (BOOLEAN)atol( pData->szCharData ); + if ((BOOLEAN)atol(pData->szCharData)) + pData->curItem.usItemFlag2 |= ITEM_cigarette; } else if ( strcmp( name, "usPortionSize" ) == 0 ) { @@ -1502,22 +1561,26 @@ itemEndElementHandle(void *userData, const XML_Char *name) else if (strcmp(name, "ProvidesRobotCamo") == 0) { pData->curElement = ELEMENT; - pData->curItem.fProvidesRobotCamo = (BOOLEAN)atol(pData->szCharData); + if ((BOOLEAN)atol(pData->szCharData)) + pData->curItem.usItemFlag2 |= ITEM_fProvidesRobotCamo; } else if (strcmp(name, "ProvidesRobotNightVision") == 0) { pData->curElement = ELEMENT; - pData->curItem.fProvidesRobotNightVision = (BOOLEAN)atol(pData->szCharData); + if ((BOOLEAN)atol(pData->szCharData)) + pData->curItem.usItemFlag2 |= ITEM_fProvidesRobotNightVision; } else if (strcmp(name, "ProvidesRobotLaserBonus") == 0) { pData->curElement = ELEMENT; - pData->curItem.fProvidesRobotLaserBonus = (BOOLEAN)atol(pData->szCharData); + if ((BOOLEAN)atol(pData->szCharData)) + pData->curItem.usItemFlag2 |= ITEM_fProvidesRobotLaserBonus; } else if (strcmp(name, "DiseaseSystemExclusive") == 0) { pData->curElement = ELEMENT; - pData->curItem.DiseaseSystemExclusive = (BOOLEAN)atol(pData->szCharData); + if ((BOOLEAN)atol(pData->szCharData)) + pData->curItem.usItemFlag2 |= ITEM_DiseaseSystemExclusive; } else if (strcmp(name, "TransportGroupMinProgress") == 0) { @@ -1907,12 +1970,6 @@ BOOLEAN WriteItemStats() } FilePrintf(hFile,"\r\n"); - - - - - - FilePrintf(hFile,"\t\t%d\r\n", Item[cnt].usItemClass); FilePrintf(hFile,"\t\t%d\r\n", Item[cnt].nasAttachmentClass); FilePrintf(hFile,"\t\t%d\r\n", Item[cnt].nasLayoutClass); @@ -1929,41 +1986,27 @@ BOOLEAN WriteItemStats() FilePrintf(hFile,"\t\t%d\r\n", Item[cnt].bReliability); FilePrintf(hFile,"\t\t%d\r\n", Item[cnt].bRepairEase); - //FilePrintf(hFile,"\t\t%d\r\n", Item[cnt].fFlags & ITEM_DAMAGEABLE ? TRUE : FALSE); - //FilePrintf(hFile,"\t\t%d\r\n", Item[cnt].fFlags & ITEM_REPAIRABLE ? TRUE : FALSE ); - //FilePrintf(hFile,"\t\t%d\r\n", Item[cnt].fFlags & ITEM_WATER_DAMAGES ? TRUE : FALSE ); - //FilePrintf(hFile,"\t\t%d\r\n", Item[cnt].fFlags & ITEM_METAL ? TRUE : FALSE ); - //FilePrintf(hFile,"\t\t%d\r\n", Item[cnt].fFlags & ITEM_SINKS ? TRUE : FALSE ); - //FilePrintf(hFile,"\t\t%d\r\n", Item[cnt].fFlags & ITEM_SHOW_STATUS ? TRUE : FALSE ); - //FilePrintf(hFile,"\t\t%d\r\n", Item[cnt].fFlags & ITEM_HIDDEN_ADDON ? TRUE : FALSE ); - //FilePrintf(hFile,"\t\t%d\r\n", Item[cnt].fFlags & ITEM_TWO_HANDED ? TRUE : FALSE ); - //FilePrintf(hFile,"\t\t%d\r\n", Item[cnt].fFlags & ITEM_NOT_BUYABLE ? TRUE : FALSE ); - //FilePrintf(hFile,"\t\t%d\r\n", Item[cnt].fFlags & ITEM_ATTACHMENT ? TRUE : FALSE ); - //FilePrintf(hFile,"\t\t%d\r\n", Item[cnt].fFlags & ITEM_BIGGUNLIST ? TRUE : FALSE ); - //FilePrintf(hFile,"\t\t%d\r\n", Item[cnt].fFlags & ITEM_NOT_EDITOR ? TRUE : FALSE ); - //FilePrintf(hFile,"\t\t%d\r\n", Item[cnt].fFlags & ITEM_DEFAULT_UNDROPPABLE ? TRUE : FALSE ); - //FilePrintf(hFile,"\t\t%d\r\n", Item[cnt].fFlags & ITEM_UNAERODYNAMIC ? TRUE : FALSE ); - //FilePrintf(hFile,"\t\t%d\r\n", Item[cnt].fFlags & ITEM_ELECTRONIC ? TRUE : FALSE ); - //FilePrintf(hFile,"\t\t%d\r\n", Item[cnt].fFlags & ITEM_INSEPARABLE ? TRUE : FALSE ); - - FilePrintf(hFile,"\t\t%d\r\n", Item[cnt].damageable ); - FilePrintf(hFile,"\t\t%d\r\n", Item[cnt].repairable ); - FilePrintf(hFile,"\t\t%d\r\n", Item[cnt].waterdamages ); - FilePrintf(hFile,"\t\t%d\r\n", Item[cnt].metal ); - FilePrintf(hFile,"\t\t%d\r\n", Item[cnt].sinks ); - FilePrintf(hFile,"\t\t%d\r\n", Item[cnt].showstatus ); - FilePrintf(hFile,"\t\t%d\r\n", Item[cnt].hiddenaddon ); - FilePrintf(hFile,"\t\t%d\r\n", Item[cnt].twohanded ); - FilePrintf(hFile,"\t\t%d\r\n", Item[cnt].notbuyable ); - FilePrintf(hFile,"\t\t%d\r\n", Item[cnt].attachment ); - FilePrintf(hFile,"\t\t%d\r\n", Item[cnt].biggunlist ); - FilePrintf(hFile,"\t\t%d\r\n", Item[cnt].scifi ); - FilePrintf(hFile,"\t\t%d\r\n", Item[cnt].newinv ); + if (ItemIsDamageable(cnt)) FilePrintf(hFile, "\t\t%d\r\n", 1); + if (ItemIsRepairable(cnt)) FilePrintf(hFile, "\t\t%d\r\n", 1); + if (ItemIsDamagedByWater(cnt)) FilePrintf(hFile, "\t\t%d\r\n", 1); + if (ItemIsMetal(cnt)) FilePrintf(hFile, "\t\t%d\r\n", 1); + if (ItemSinks(cnt)) FilePrintf(hFile, "\t\t%d\r\n", 1); + if (HasItemFlag2(cnt, ITEM_showstatus)) FilePrintf(hFile, "\t\t%d\r\n", 1); + if (ItemIsHiddenAddon(cnt)) FilePrintf(hFile, "\t\t%d\r\n", 1); + if (ItemIsTwoHanded(cnt)) FilePrintf(hFile, "\t\t%d\r\n", 1); + if (ItemIsNotBuyable(cnt)) FilePrintf(hFile, "\t\t%d\r\n", 1); + if (ItemIsAttachment(cnt)) FilePrintf(hFile, "\t\t%d\r\n", 1); + if (ItemIsHiddenAttachment(cnt)) FilePrintf(hFile, "\t\t%d\r\n", 1); + if (ItemIsOnlyInTonsOfGuns(cnt)) FilePrintf(hFile, "\t\t%d\r\n", 1); + if (ItemIsOnlyInScifi(cnt)) FilePrintf(hFile, "\t\t%d\r\n", 1); + if (ItemIsOnlyInNIV(cnt)) FilePrintf(hFile, "\t\t%d\r\n", 1); + if (ItemIsNotInEditor(cnt)) FilePrintf(hFile, "\t\t%d\r\n", 1); + if (ItemIsUndroppableByDefault(cnt)) FilePrintf(hFile, "\t\t%d\r\n", 1); + if (ItemIsUnaerodynamic(cnt)) FilePrintf(hFile, "\t\t%d\r\n", 1); + if (ItemIsElectronic(cnt)) FilePrintf(hFile, "\t\t%d\r\n", 1); + if (ItemHasHiddenMuzzleFlash(cnt)) FilePrintf(hFile, "\t\t%d\r\n", 1); + FilePrintf(hFile,"\t\t%d\r\n", Item[cnt].ubAttachmentSystem ); - FilePrintf(hFile,"\t\t%d\r\n", Item[cnt].notineditor ); - FilePrintf(hFile,"\t\t%d\r\n", Item[cnt].defaultundroppable ); - FilePrintf(hFile,"\t\t%d\r\n", Item[cnt].unaerodynamic ); - FilePrintf(hFile,"\t\t%d\r\n", Item[cnt].electronic ); FilePrintf(hFile,"\t\t%d\r\n", Item[cnt].inseparable ); FilePrintf(hFile,"\t\t%d\r\n", StoreInventory[cnt][0] ); @@ -1971,7 +2014,6 @@ BOOLEAN WriteItemStats() FilePrintf(hFile,"\t\t%d\r\n", WeaponROF[cnt]); FilePrintf(hFile,"\t\t%d\r\n", Item[cnt].percentnoisereduction ); - FilePrintf(hFile,"\t\t%d\r\n", Item[cnt].hidemuzzleflash ); FilePrintf(hFile,"\t\t%d\r\n", Item[cnt].bipod ); FilePrintf(hFile,"\t\t%d\r\n", Item[cnt].rangebonus ); FilePrintf(hFile,"\t\t%d\r\n", Item[cnt].rangebonus ); @@ -1997,17 +2039,19 @@ BOOLEAN WriteItemStats() FilePrintf(hFile,"\t\t%d\r\n", Item[cnt].damagebonus ); FilePrintf(hFile,"\t\t%d\r\n", Item[cnt].meleedamagebonus ); - FilePrintf(hFile,"\t\t%d\r\n", Item[cnt].grenadelauncher ); - FilePrintf(hFile,"\t\t%d\r\n", Item[cnt].duckbill ); - FilePrintf(hFile,"\t\t%d\r\n", Item[cnt].glgrenade ); - FilePrintf(hFile,"\t\t%d\r\n", Item[cnt].mine ); - FilePrintf(hFile,"\t\t%d\r\n", Item[cnt].antitankmine ); - FilePrintf(hFile,"\t\t%d\r\n", Item[cnt].mortar ); - FilePrintf(hFile,"\t\t%d\r\n", Item[cnt].rocketlauncher ); - FilePrintf(hFile,"\t\t%d\r\n", Item[cnt].singleshotrocketlauncher ); FilePrintf(hFile,"\t\t%d\r\n", Item[cnt].discardedlauncheritem ); - FilePrintf(hFile,"\t\t%d\r\n", Item[cnt].rocketrifle); - FilePrintf(hFile,"\t\t%d\r\n", Item[cnt].cannon); + + if (ItemIsMortar(cnt)) FilePrintf(hFile, "\t\t%d\r\n", 1); + if (ItemIsRocketLauncher(cnt)) FilePrintf(hFile, "\t\t%d\r\n", 1); + if (ItemIsSingleShotRocketLauncher(cnt)) FilePrintf(hFile, "\t\t%d\r\n", 1); + if (ItemIsGrenadeLauncher(cnt)) FilePrintf(hFile, "\t\t%d\r\n", 1); + if (ItemIsDuckbill(cnt)) FilePrintf(hFile, "\t\t%d\r\n", 1); + if (ItemIsGLgrenade(cnt)) FilePrintf(hFile, "\t\t%d\r\n", 1); + if (ItemIsMine(cnt)) FilePrintf(hFile, "\t\t%d\r\n", 1); + if (ItemIsATMine(cnt)) FilePrintf(hFile, "\t\t%d\r\n", 1); + if (ItemIsRocketRifle(cnt)) FilePrintf(hFile, "\t\t%d\r\n", 1); + if (ItemHasFingerPrintID(cnt)) FilePrintf(hFile, "\t\t%d\r\n", 1); + if (ItemIsCannon(cnt)) FilePrintf(hFile, "\t\t%d\r\n", 1); for(UINT8 cnt2 = 0; cnt2 < MAX_DEFAULT_ATTACHMENTS; cnt2++){ if(Item[cnt].defaultattachments[cnt2] != 0){ @@ -2015,29 +2059,30 @@ BOOLEAN WriteItemStats() } } - FilePrintf(hFile,"\t\t%d\r\n", Item[cnt].brassknuckles ); - FilePrintf(hFile,"\t\t%d\r\n", Item[cnt].crowbar ); - FilePrintf(hFile,"\t\t%d\r\n", Item[cnt].bloodieditem ); - FilePrintf(hFile,"\t\t%d\r\n", Item[cnt].rock ); + if (ItemIsBrassKnuckles(cnt)) FilePrintf(hFile, "\t\t%d\r\n", 1); + if (ItemIsCrowbar(cnt)) FilePrintf(hFile, "\t\t%d\r\n", 1); + if (ItemIsRock(cnt)) FilePrintf(hFile, "\t\t%d\r\n", 1); + FilePrintf(hFile,"\t\t%d\r\n", Item[cnt].bloodieditem ); FilePrintf(hFile,"\t\t%d\r\n", Item[cnt].camobonus ); FilePrintf(hFile,"\t\t%d\r\n", Item[cnt].urbanCamobonus ); FilePrintf(hFile,"\t\t%d\r\n", Item[cnt].desertCamobonus ); FilePrintf(hFile,"\t\t%d\r\n", Item[cnt].snowCamobonus ); FilePrintf(hFile,"\t\t%d\r\n", Item[cnt].stealthbonus ); - FilePrintf(hFile,"\t\t%d\r\n", Item[cnt].flakjacket ); - FilePrintf(hFile,"\t\t%d\r\n", Item[cnt].leatherjacket ); - FilePrintf(hFile,"\t\t%d\r\n", Item[cnt].detonator ); - FilePrintf(hFile,"\t\t%d\r\n", Item[cnt].remotedetonator ); - FilePrintf(hFile,"\t\t%d\r\n", Item[cnt].remotetrigger ); - FilePrintf(hFile,"\t\t%d\r\n", Item[cnt].lockbomb ); - FilePrintf(hFile,"\t\t%d\r\n", Item[cnt].flare ); + if (ItemIsFlakJacket(cnt)) FilePrintf(hFile, "\t\t%d\r\n", 1); + if (ItemIsLeatherJacket(cnt)) FilePrintf(hFile, "\t\t%d\r\n", 1); + if (ItemIsDetonator(cnt)) FilePrintf(hFile, "\t\t%d\r\n", 1); + if (ItemIsRemoteDetonator(cnt)) FilePrintf(hFile, "\t\t%d\r\n", 1); + if (ItemIsRemoteTrigger(cnt)) FilePrintf(hFile, "\t\t%d\r\n", 1); + if (ItemIsLockBomb(cnt)) FilePrintf(hFile, "\t\t%d\r\n", 1); + if (ItemIsFlare(cnt)) FilePrintf(hFile, "\t\t%d\r\n", 1); + if (ItemIsRobotRemote(cnt)) FilePrintf(hFile, "\t\t%d\r\n", 1); + if (ItemIsWalkman(cnt)) FilePrintf(hFile, "\t\t%d\r\n", 1); + if (ItemIsThermalOptics(cnt)) FilePrintf(hFile, "\t\t%d\r\n", 1); + if (ItemIsGasmask(cnt)) FilePrintf(hFile, "\t\t%d\r\n", 1); - FilePrintf(hFile,"\t\t%d\r\n", Item[cnt].robotremotecontrol ); - FilePrintf(hFile,"\t\t%d\r\n", Item[cnt].walkman ); FilePrintf(hFile,"\t\t%d\r\n", Item[cnt].hearingrangebonus ); - FilePrintf(hFile,"\t\t%d\r\n", Item[cnt].visionrangebonus ); FilePrintf(hFile,"\t\t%d\r\n", Item[cnt].nightvisionrangebonus ); FilePrintf(hFile,"\t\t%d\r\n", Item[cnt].dayvisionrangebonus ); @@ -2045,30 +2090,26 @@ BOOLEAN WriteItemStats() FilePrintf(hFile,"\t\t%d\r\n", Item[cnt].brightlightvisionrangebonus ); FilePrintf(hFile,"\t\t%d\r\n", Item[cnt].itemsizebonus ); FilePrintf(hFile,"\t\t%d\r\n", Item[cnt].percenttunnelvision ); - FilePrintf(hFile,"\t\t%d\r\n", Item[cnt].thermaloptics ); - FilePrintf(hFile,"\t\t%d\r\n", Item[cnt].gasmask ); - - FilePrintf(hFile,"\t\t%3.2f\r\n", Item[cnt].alcohol ); - FilePrintf(hFile,"\t\t%d\r\n", Item[cnt].hardware ); - FilePrintf(hFile,"\t\t%d\r\n", Item[cnt].medical ); - FilePrintf(hFile,"\t\t%d\r\n", Item[cnt].camouflagekit ); - FilePrintf(hFile,"\t\t%d\r\n", Item[cnt].locksmithkit ); - FilePrintf(hFile,"\t\t%d\r\n", Item[cnt].toolkit ); - FilePrintf(hFile,"\t\t%d\r\n", Item[cnt].firstaidkit ); - FilePrintf(hFile,"\t\t%d\r\n", Item[cnt].medicalkit ); - FilePrintf(hFile,"\t\t%d\r\n", Item[cnt].wirecutters ); - FilePrintf(hFile,"\t\t%d\r\n", Item[cnt].canteen ); - FilePrintf(hFile,"\t\t%d\r\n", Item[cnt].gascan ); - FilePrintf(hFile,"\t\t%d\r\n", Item[cnt].marbles ); - FilePrintf(hFile,"\t\t%d\r\n", Item[cnt].canandstring ); - FilePrintf(hFile,"\t\t%d\r\n", Item[cnt].jar ); - FilePrintf(hFile,"\t\t%d\r\n", Item[cnt].xray ); - FilePrintf(hFile,"\t\t%d\r\n", Item[cnt].batteries ); - FilePrintf(hFile,"\t\t%d\r\n", Item[cnt].needsbatteries ); - FilePrintf(hFile,"\t\t%d\r\n", Item[cnt].containsliquid ); - FilePrintf(hFile,"\t\t%d\r\n", Item[cnt].metaldetector ); - FilePrintf(hFile,"\t\t%d\r\n", Item[cnt].fingerprintid ); + + if (ItemIsHardware(cnt)) FilePrintf(hFile, "\t\t%d\r\n", 1); + if (ItemIsMedical(cnt)) FilePrintf(hFile, "\t\t%d\r\n", 1); + if (ItemIsCamoKit(cnt)) FilePrintf(hFile, "\t\t%d\r\n", 1); + if (ItemIsLocksmithKit(cnt)) FilePrintf(hFile, "\t\t%d\r\n", 1); + if (ItemIsToolkit(cnt)) FilePrintf(hFile, "\t\t%d\r\n", 1); + if (ItemIsFirstAidKit(cnt)) FilePrintf(hFile, "\t\t%d\r\n", 1); + if (ItemIsMedicalKit(cnt)) FilePrintf(hFile, "\t\t%d\r\n", 1); + if (ItemIsWirecutters(cnt)) FilePrintf(hFile, "\t\t%d\r\n", 1); + if (ItemIsCanteen(cnt)) FilePrintf(hFile, "\t\t%d\r\n", 1); + if (ItemIsGascan(cnt)) FilePrintf(hFile, "\t\t%d\r\n", 1); + if (ItemIsMarbles(cnt)) FilePrintf(hFile, "\t\t%d\r\n", 1); + if (ItemIsCanAndString(cnt)) FilePrintf(hFile, "\t\t%d\r\n", 1); + if (ItemIsJar(cnt)) FilePrintf(hFile, "\t\t%d\r\n", 1); + if (ItemHasXRay(cnt)) FilePrintf(hFile, "\t\t%d\r\n", 1); + if (ItemIsBatteries(cnt)) FilePrintf(hFile, "\t\t%d\r\n", 1); + if (ItemNeedsBatteries(cnt)) FilePrintf(hFile, "\t\t%d\r\n", 1); + if (ItemContainsLiquid(cnt)) FilePrintf(hFile, "\t\t%d\r\n", 1); + if (ItemIsMetalDetector(cnt)) FilePrintf(hFile, "\t\t%d\r\n", 1); // HEADROCK HAM 4: Print out new values FilePrintf(hFile,"\t\t%d\r\n", Item[cnt].scopemagfactor ); @@ -2119,7 +2160,7 @@ BOOLEAN WriteItemStats() FilePrintf(hFile,"\t\t\r\n"); // Flugente FTW 1.2 - FilePrintf(hFile,"\t\t%d\r\n", Item[cnt].barrel ); + if (ItemIsBarrel(cnt)) FilePrintf(hFile, "\t\t%d\r\n", 1); FilePrintf(hFile,"\t\t%4.2f\r\n", Item[cnt].usOverheatingCooldownFactor ); FilePrintf(hFile,"\t\t%4.2f\r\n", Item[cnt].overheatTemperatureModificator ); FilePrintf(hFile,"\t\t%4.2f\r\n", Item[cnt].overheatCooldownModificator ); @@ -2128,16 +2169,13 @@ BOOLEAN WriteItemStats() FilePrintf(hFile,"\t\t%4.2f\r\n", Item[cnt].attachmentclass ); - FilePrintf(hFile,"\t\t%d\r\n", Item[cnt].tripwireactivation ); - FilePrintf(hFile,"\t\t%d\r\n", Item[cnt].tripwire ); - FilePrintf(hFile,"\t\t%d\r\n", Item[cnt].directional ); + if (ItemHasTripwireActivation(cnt)) FilePrintf(hFile, "\t\t%d\r\n", 1); + if (ItemIsTripwire(cnt)) FilePrintf(hFile, "\t\t%d\r\n", 1); + if (ItemIsDirectional(cnt)) FilePrintf(hFile, "\t\t%d\r\n", 1); + if (ItemBlocksIronsight(cnt)) FilePrintf(hFile, "\t\t%d\r\n", 1); - FilePrintf(hFile,"\t\t%d\r\n", Item[cnt].drugtype ); - - FilePrintf(hFile,"\t\t%d\r\n", Item[cnt].blockironsight ); - FilePrintf(hFile,"\t\t%d\r\n", Item[cnt].usItemFlag ); - + FilePrintf(hFile,"\t\t%d\r\n", Item[cnt].drugtype ); FilePrintf(hFile,"\t\t%d\r\n", Item[cnt].foodtype ); //JMich_SkillModifiers: Adding the values here as well @@ -2161,10 +2199,10 @@ BOOLEAN WriteItemStats() FilePrintf(hFile,"\t\t%d\r\n", Item[cnt].ubSleepModifier ); FilePrintf(hFile,"\t\t%d\r\n", Item[cnt].usSpotting ); FilePrintf(hFile,"\t\t%d\r\n", Item[cnt].sBackpackWeightModifier); - FilePrintf(hFile,"\t\t%d\r\n", Item[cnt].fAllowClimbing); - FilePrintf(hFile,"\t\t%d\r\n", Item[cnt].cigarette ); FilePrintf(hFile,"\t\t%d\r\n", Item[cnt].usPortionSize ); + if (ItemAllowsClimbing(cnt)) FilePrintf(hFile, "\t\t%d\r\n", 1); + if (ItemIsCigarette(cnt)) FilePrintf(hFile, "\t\t%d\r\n", 1); if ( HasItemFlag( cnt, DISEASEPROTECTION_1 ) ) FilePrintf( hFile, "\t\t%d\r\n", 1 ); if ( HasItemFlag( cnt, DISEASEPROTECTION_2 ) ) FilePrintf( hFile, "\t\t%d\r\n", 1 ); if ( HasItemFlag( cnt, BLOOD_BAG) ) FilePrintf( hFile, "\t\t%d\r\n", 1 ); @@ -2182,11 +2220,11 @@ BOOLEAN WriteItemStats() FilePrintf(hFile,"\t\t%d\r\n", Item[cnt].bRobotTargetingSkillGrant ); FilePrintf(hFile,"\t\t%d\r\n", Item[cnt].bRobotChassisSkillGrant ); FilePrintf(hFile,"\t\t%d\r\n", Item[cnt].bRobotUtilitySkillGrant ); - FilePrintf(hFile,"\t\t%d\r\n", Item[cnt].fProvidesRobotCamo ); - FilePrintf(hFile,"\t\t%d\r\n", Item[cnt].fProvidesRobotNightVision ); - FilePrintf(hFile,"\t\t%d\r\n", Item[cnt].fProvidesRobotLaserBonus ); - FilePrintf(hFile, "\t\t%d\r\n", Item[cnt].DiseaseSystemExclusive); + if (ItemProvidesRobotCamo(cnt)) FilePrintf(hFile, "\t\t%d\r\n", 1); + if (ItemProvidesRobotNightvision(cnt)) FilePrintf(hFile, "\t\t%d\r\n", 1); + if (ItemProvidesRobotLaserBonus(cnt)) FilePrintf(hFile, "\t\t%d\r\n", 1); + if (ItemIsOnlyInDisease(cnt)) FilePrintf(hFile, "\t\t%d\r\n", 1); FilePrintf(hFile,"\t\r\n"); }