- code consolidation in invnext and invprev.

This commit is contained in:
Christoph Oelckers 2018-12-01 17:09:43 +01:00
parent 023efc7685
commit e7d309cb96

View file

@ -372,6 +372,14 @@ CCMD (weapprev)
} }
} }
static void DisplayNameTag(const char *tag)
{
if ((displaynametags & 1) && StatusBar && SmallFont)
StatusBar->AttachMessage(Create<DHUDMessageFadeOut>(SmallFont, tag,
1.5f, 0.80f, 0, 0, (EColorRange)*nametagcolor, 2.f, 0.35f), MAKE_ID('S', 'I', 'N', 'V'));
}
CCMD (invnext) CCMD (invnext)
{ {
AInventory *next; AInventory *next;
@ -398,9 +406,7 @@ CCMD (invnext)
who->InvSel = who->Inventory; who->InvSel = who->Inventory;
} }
} }
if ((displaynametags & 1) && StatusBar && SmallFont && who->InvSel) if (who->InvSel) DisplayNameTag(who->InvSel->GetTag());
StatusBar->AttachMessage (Create<DHUDMessageFadeOut> (SmallFont, who->InvSel->GetTag(),
1.5f, 0.80f, 0, 0, (EColorRange)*nametagcolor, 2.f, 0.35f), MAKE_ID('S','I','N','V'));
} }
who->player->inventorytics = 5*TICRATE; who->player->inventorytics = 5*TICRATE;
if (old != who->InvSel) if (old != who->InvSel)
@ -433,9 +439,7 @@ CCMD (invprev)
} }
who->InvSel = item; who->InvSel = item;
} }
if ((displaynametags & 1) && StatusBar && SmallFont && who->InvSel) if (who->InvSel) DisplayNameTag(who->InvSel->GetTag());
StatusBar->AttachMessage (Create<DHUDMessageFadeOut> (SmallFont, who->InvSel->GetTag(),
1.5f, 0.80f, 0, 0, (EColorRange)*nametagcolor, 2.f, 0.35f), MAKE_ID('S','I','N','V'));
} }
who->player->inventorytics = 5*TICRATE; who->player->inventorytics = 5*TICRATE;
if (old != who->InvSel) if (old != who->InvSel)