From c26ab9fc36258388857c742731afcb064dcaa2b0 Mon Sep 17 00:00:00 2001 From: Mitchell Richters Date: Tue, 28 Jul 2020 20:01:59 +1000 Subject: [PATCH] - left-align health and armor values. Proportionally space ammo sprite depending on length of ammo string (15px * format.Len()). --- source/games/duke/src/sbar_d.cpp | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-) diff --git a/source/games/duke/src/sbar_d.cpp b/source/games/duke/src/sbar_d.cpp index f0cde54f3..fdc1dd657 100644 --- a/source/games/duke/src/sbar_d.cpp +++ b/source/games/duke/src/sbar_d.cpp @@ -134,7 +134,7 @@ public: int intens = clamp(255 - 4 * s, 0, 255); auto pe = PalEntry(255, intens, intens, intens); format.Format("%d", p->last_extra); - SBar_DrawString(this, &numberFont, format, 60, -numberFont.mFont->GetHeight() + 4.5, DI_TEXT_ALIGN_RIGHT, CR_UNTRANSLATED, 1, 0, 0, 1, 1); + SBar_DrawString(this, &numberFont, format, 25, -numberFont.mFont->GetHeight() + 4.5, DI_TEXT_ALIGN_LEFT, CR_UNTRANSLATED, 1, 0, 0, 1, 1); } // @@ -145,20 +145,11 @@ public: DrawGraphic(imgArmor, 67.375, -1.5, DI_ITEM_LEFT_BOTTOM, 1., -1, -1, armorScale, armorScale); format.Format("%d", GetMoraleOrShield(p, snum)); - SBar_DrawString(this, &numberFont, format, 120, -numberFont.mFont->GetHeight() + 4.5, DI_TEXT_ALIGN_RIGHT, CR_UNTRANSLATED, 1, 0, 0, 1, 1); + SBar_DrawString(this, &numberFont, format, 85, -numberFont.mFont->GetHeight() + 4.5, DI_TEXT_ALIGN_LEFT, CR_UNTRANSLATED, 1, 0, 0, 1, 1); // // Weapon // - - int wicon = ammo_sprites[p->curr_weapon]; - if (wicon > 0) - { - auto imgWeap = tileGetTexture(wicon); - auto weapScale = imgScale / imgWeap->GetDisplayHeight(); - DrawGraphic(imgWeap, -40.625, -1.5, DI_ITEM_RIGHT_BOTTOM, 1, -1, -1, weapScale, weapScale); - } - int weapon = p->curr_weapon; if (weapon == HANDREMOTE_WEAPON) weapon = HANDBOMB_WEAPON; @@ -168,6 +159,14 @@ public: SBar_DrawString(this, &numberFont, format, -3, -numberFont.mFont->GetHeight() + 4.5, DI_TEXT_ALIGN_RIGHT, CR_UNTRANSLATED, 1, 0, 0, 1, 1); } + int wicon = ammo_sprites[p->curr_weapon]; + if (wicon > 0) + { + auto imgWeap = tileGetTexture(wicon); + auto weapScale = imgScale / imgWeap->GetDisplayHeight(); + DrawGraphic(imgWeap, -(15. * format.Len()), -1.5, DI_ITEM_RIGHT_BOTTOM, 1, -1, -1, weapScale, weapScale); + } + // // Selected inventory item //