From d64d09c1adc4b261589c534286cbfcb4cda4c840 Mon Sep 17 00:00:00 2001 From: Nathan Fulton Date: Sat, 29 Apr 2017 22:55:30 -0400 Subject: [PATCH] Update hudbar for art2432 --- game/InputUI.cpp | 26 ++++++++++++++------------ 1 file changed, 14 insertions(+), 12 deletions(-) diff --git a/game/InputUI.cpp b/game/InputUI.cpp index 2b3ddf7..4313585 100644 --- a/game/InputUI.cpp +++ b/game/InputUI.cpp @@ -576,7 +576,7 @@ void CreditsControl::OnPaint(DibBitmap *pbm) if (m_fDrawCreditSymbol) pfnt->DrawText(pbm, "ABC", m_rc.left, m_rc.top, cx, -1); else - pfnt->DrawText(pbm, "JBC", m_rc.left, m_rc.top, cx, -1); + pfnt->DrawText(pbm, "LBC", m_rc.left, m_rc.top, cx, -1); // Draw credits @@ -672,18 +672,18 @@ void PowerControl::OnPaint(DibBitmap *pbm) int x = m_rc.left + cxLeftSide; int cxMeter = pfnt->GetTextExtent("E"); int cxPip = pfnt->GetTextExtent("I"); + const char *pszTick = "I"; - Color clr; if (m_nSupply < m_nDemand) { - clr = GetColor(kiclrRed); + cxPip = pfnt->GetTextExtent("K"); + pszTick = "K"; } else { // Dip into the yellow if building a structure might cause demand // to become less than supply. - - if (m_nSupply - m_nDemand <= m_nDemandMax) - clr = GetColor(kiclrYellow); - else - clr = GetColor(kiclrGreen); + if (m_nSupply - m_nDemand <= m_nDemandMax) { + cxPip = pfnt->GetTextExtent("J"); + pszTick = "J"; + } } // UNDONE: handle > 400 units of power @@ -692,11 +692,13 @@ void PowerControl::OnPaint(DibBitmap *pbm) if (cSupplyPips > kcPowerMeterPips) cSupplyPips = kcPowerMeterPips; - byte bclr = clr & 0xff; - dword dwClr = MAKEDWORD(bclr); + for (int i = 0; i < cSupplyPips; i++, x += cxPip) { + char szTick[2]; + strncpyz(szTick, pszTick, 2); - for (int i = 0; i < cSupplyPips; i++, x += cxPip) - pfnt->DrawText(pbm, "I", x, m_rc.top, 1, &dwClr); + // HACK: Power ticks need to overlap by two pixels + pfnt->DrawText(pbm, szTick, x - i*2, m_rc.top, 1); + } // Draw demand indicator