mirror of
https://github.com/1dot13/source.git
synced 2026-08-05 14:00:23 +02:00
Convert INVTYPE boolean fields to flagmask (#325)
Rearranged fields from largest to smallest to remove alignment padding
This commit is contained in:
+22
-21
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user