Skip to content

Commit

Permalink
Fixed buildstate dispenser icon showing the SG
Browse files Browse the repository at this point in the history
Added support for per-level SG icons
  • Loading branch information
AdamWillden committed Nov 1, 2020
1 parent 5b5a9bb commit 8a3953c
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 2 deletions.
2 changes: 1 addition & 1 deletion cl_dll/ff/ff_hud_buildstate_dispenser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ void CHudBuildStateDispenser::VidInit()
tempString = L"DISPENSER";

SetHeaderText(tempString);
SetHeaderIconChar("S");
SetHeaderIconChar("Y");

m_qbDispenserHealth->SetLabelText("#FF_ITEM_HEALTH");
m_qbDispenserHealth->SetIconChar(":");
Expand Down
18 changes: 17 additions & 1 deletion cl_dll/ff/ff_hud_buildstate_sentry.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ void CHudBuildStateSentry::VidInit()
tempString = L"SENTRY";

SetHeaderText(tempString);
SetHeaderIconChar("R");
SetHeaderIconChar("Z");

m_qbSentryHealth->SetLabelText("#FF_ITEM_HEALTH");
m_qbSentryHealth->SetIconChar(":");
Expand Down Expand Up @@ -206,6 +206,8 @@ void CHudBuildStateSentry::OnTick()
SetVisible(false);
m_qbSentryHealth->SetVisible(false);
m_qbSentryLevel->SetVisible(false);
// reset to level 1 icon
SetHeaderIconChar("A");
}
else if(bBuilt && !m_bBuilt)
//show quantity bars
Expand Down Expand Up @@ -247,6 +249,20 @@ void CHudBuildStateSentry::MsgFunc_SentryMsg(bf_read &msg)
int iMaxHealth = (int) msg.ReadByte();
int iLevel = (int) msg.ReadByte();

// set icon according to SG level
switch(iLevel)
{
case 2: // level 2
SetHeaderIconChar("B");
break;
case 3: // level 3
SetHeaderIconChar("C");
break;
default: // level 1 or unknown level
SetHeaderIconChar("A");
break;
}

m_qbSentryLevel->SetAmount(iLevel);
m_qbSentryHealth->SetAmount((int)((float)iHealth/100 * iMaxHealth));
m_qbSentryHealth->SetAmountMax(iMaxHealth);
Expand Down

0 comments on commit 8a3953c

Please sign in to comment.