Skip to content

Commit

Permalink
Remove unused ItemFlags
Browse files Browse the repository at this point in the history
Detonator and Remote Detonator are specified by AttachmentClass
No items in items.xml actually even contained these flags.
  • Loading branch information
Asdow committed Jan 27, 2025
1 parent ebd2e25 commit 6a559e6
Show file tree
Hide file tree
Showing 6 changed files with 11 additions and 29 deletions.
2 changes: 1 addition & 1 deletion Tactical/Arms Dealer Init.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1015,7 +1015,7 @@ UINT32 GetArmsDealerItemTypeFromItemNumber( UINT16 usItem )
return( ARMS_DEALER_MEDICAL );
else if (ItemIsAttachment(usItem))
return( ARMS_DEALER_ATTACHMENTS );
else if (ItemIsDetonator(usItem) || ItemIsRemoteDetonator(usItem) || ItemIsRemoteTrigger(usItem))
else if ( IsAttachmentClass( usItem, (AC_DETONATOR | AC_REMOTEDET) ) || ItemIsRemoteTrigger(usItem))
return( ARMS_DEALER_DETONATORS );
else
return( ARMS_DEALER_MISC );
Expand Down
12 changes: 6 additions & 6 deletions Tactical/Interface Enhanced.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2527,7 +2527,7 @@ void InternalInitEDBTooltipRegion( OBJECTTYPE * gpItemDescObject, UINT32 guiCurr
}

//////////////////// REMOTE DETONATOR
if (ItemIsRemoteDetonator(gpItemDescObject->usItem))
if ( IsAttachmentClass( gpItemDescObject->usItem, AC_REMOTEDET ) )
{
swprintf( pStr, L"%s%s", szUDBGenSecondaryStatsTooltipText[ 15 ], szUDBGenSecondaryStatsExplanationsTooltipText[ 15 ]);
SetRegionFastHelpText( &(gUDBFasthelpRegions[ iFirstDataRegion + cnt ]), pStr );
Expand All @@ -2536,7 +2536,7 @@ void InternalInitEDBTooltipRegion( OBJECTTYPE * gpItemDescObject, UINT32 guiCurr
}

//////////////////// TIMER DETONATOR
if (ItemIsDetonator(gpItemDescObject->usItem))
if ( IsAttachmentClass( gpItemDescObject->usItem, AC_DETONATOR ))
{
swprintf( pStr, L"%s%s", szUDBGenSecondaryStatsTooltipText[ 16 ], szUDBGenSecondaryStatsExplanationsTooltipText[ 16 ]);
SetRegionFastHelpText( &(gUDBFasthelpRegions[ iFirstDataRegion + cnt ]), pStr );
Expand Down Expand Up @@ -6246,16 +6246,16 @@ void DrawSecondaryStats( OBJECTTYPE * gpItemDescObject )
}

//////////////////// REMOTE DETONATOR
if ( (ItemIsRemoteDetonator(gpItemDescObject->usItem) && !fComparisonMode ) ||
( fComparisonMode && ItemIsRemoteDetonator(gpComparedItemDescObject->usItem) ) )
if ( (IsAttachmentClass( gpItemDescObject->usItem, AC_REMOTEDET ) && !fComparisonMode ) ||
( fComparisonMode && IsAttachmentClass( gpComparedItemDescObject->usItem, AC_REMOTEDET )) )
{
BltVideoObjectFromIndex( guiSAVEBUFFER, guiItemInfoSecondaryIcon, 15, gItemDescGenSecondaryRegions[cnt].sLeft+sOffsetX, gItemDescGenSecondaryRegions[cnt].sTop+sOffsetY, VO_BLT_SRCTRANSPARENCY, NULL );
cnt++;
}

//////////////////// TIMER DETONATOR
if ( (ItemIsDetonator(gpItemDescObject->usItem) && !fComparisonMode ) ||
( fComparisonMode && ItemIsDetonator(gpComparedItemDescObject->usItem)) )
if ( (IsAttachmentClass( gpItemDescObject->usItem, AC_DETONATOR ) && !fComparisonMode ) ||
( fComparisonMode && IsAttachmentClass( gpComparedItemDescObject->usItem, AC_DETONATOR )) )
{
BltVideoObjectFromIndex( guiSAVEBUFFER, guiItemInfoSecondaryIcon, 16, gItemDescGenSecondaryRegions[cnt].sLeft+sOffsetX, gItemDescGenSecondaryRegions[cnt].sTop+sOffsetY, VO_BLT_SRCTRANSPARENCY, NULL );
cnt++;
Expand Down
4 changes: 2 additions & 2 deletions Tactical/Item Types.h
Original file line number Diff line number Diff line change
Expand Up @@ -812,8 +812,8 @@ extern OBJECTTYPE gTempObject;
#define ITEM_mortar 0x0400000000000000
#define ITEM_duckbill 0x0800000000000000

#define ITEM_detonator 0x1000000000000000
#define ITEM_remotedetonator 0x2000000000000000
//UNUSED #define ITEM_detonator 0x1000000000000000
//UNUSED #define ITEM_remotedetonator 0x2000000000000000
#define ITEM_hidemuzzleflash 0x4000000000000000
#define ITEM_rocketlauncher 0x8000000000000000

Expand Down
6 changes: 2 additions & 4 deletions Tactical/Items.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12076,7 +12076,7 @@ BOOLEAN IsDetonatorAttached( OBJECTTYPE * pObj )
// return TRUE;

for (attachmentList::iterator iter = (*pObj)[0]->attachments.begin(); iter != (*pObj)[0]->attachments.end(); ++iter) {
if (ItemIsDetonator(iter->usItem) && iter->exists() )
if ( IsAttachmentClass( iter->usItem, AC_DETONATOR ) && iter->exists() )
{
return( TRUE );
}
Expand All @@ -12092,7 +12092,7 @@ BOOLEAN IsRemoteDetonatorAttached( OBJECTTYPE * pObj )
// return TRUE;

for (attachmentList::iterator iter = (*pObj)[0]->attachments.begin(); iter != (*pObj)[0]->attachments.end(); ++iter) {
if (ItemIsRemoteDetonator(iter->usItem) && iter->exists() )
if ( IsAttachmentClass( iter->usItem, AC_REMOTEDET ) && iter->exists() )
{
return( TRUE );
}
Expand Down Expand Up @@ -16081,8 +16081,6 @@ 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
Expand Down
2 changes: 0 additions & 2 deletions Tactical/Items.h
Original file line number Diff line number Diff line change
Expand Up @@ -204,8 +204,6 @@ 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);
Expand Down
14 changes: 0 additions & 14 deletions Utils/XML_Items.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -863,18 +863,6 @@ itemEndElementHandle(void *userData, const XML_Char *name)
if ((BOOLEAN)atol(pData->szCharData))
pData->curItem.usItemFlag |= ITEM_duckbill;
}
else if(strcmp(name, "Detonator") == 0)
{
pData->curElement = ELEMENT;
if ((BOOLEAN)atol(pData->szCharData))
pData->curItem.usItemFlag |= ITEM_detonator;
}
else if(strcmp(name, "RemoteDetonator") == 0)
{
pData->curElement = ELEMENT;
if ((BOOLEAN)atol(pData->szCharData))
pData->curItem.usItemFlag |= ITEM_remotedetonator;
}
else if(strcmp(name, "ThermalOptics") == 0)
{
pData->curElement = ELEMENT;
Expand Down Expand Up @@ -2427,8 +2415,6 @@ BOOLEAN WriteItemStats()
if ( ItemIsGrenadeLauncher( cnt ) ) FilePrintf( hFile, "\t\t<GrenadeLauncher>%d</GrenadeLauncher>\r\n", 1 );
if ( ItemIsMortar( cnt ) ) FilePrintf( hFile, "\t\t<Mortar>%d</Mortar>\r\n", 1 );
if ( ItemIsDuckbill( cnt ) ) FilePrintf( hFile, "\t\t<Duckbill>%d</Duckbill>\r\n", 1 );
if ( ItemIsDetonator( cnt ) ) FilePrintf( hFile, "\t\t<Detonator>%d</Detonator>\r\n", 1 );
if ( ItemIsRemoteDetonator( cnt ) ) FilePrintf( hFile, "\t\t<RemoteDetonator>%d</RemoteDetonator>\r\n", 1 );
if ( ItemHasHiddenMuzzleFlash( cnt ) ) FilePrintf( hFile, "\t\t<HideMuzzleFlash>%d</HideMuzzleFlash>\r\n", 1 );
if ( ItemIsRocketLauncher( cnt ) ) FilePrintf( hFile, "\t\t<RocketLauncher>%d</RocketLauncher>\r\n", 1 );

Expand Down

0 comments on commit 6a559e6

Please sign in to comment.