diff --git a/source/games/duke/src/sbar_r.cpp b/source/games/duke/src/sbar_r.cpp index e7f322bd9..949493bb7 100644 --- a/source/games/duke/src/sbar_r.cpp +++ b/source/games/duke/src/sbar_r.cpp @@ -141,10 +141,29 @@ public: int weapon = p->curr_weapon; if (weapon == HANDREMOTE_WEAPON) weapon = DYNAMITE_WEAPON; - int wicon = ammo_sprites[p->curr_weapon]; + int wicon = ammo_sprites[weapon]; if (wicon > 0) { - format.Format("%d", p->ammo_amount[weapon]); + int ammo = p->ammo_amount[weapon]; + bool reloadableWeapon = weapon == PISTOL_WEAPON || weapon == SHOTGUN_WEAPON; + if (!reloadableWeapon || (reloadableWeapon && !cl_showmagamt)) + { + format.Format("%d", ammo); + } + else + { + short clip; + switch (weapon) + { + case PISTOL_WEAPON: + clip = CalcMagazineAmount(ammo, 6, p->kickback_pic >= 1); + break; + case SHOTGUN_WEAPON: + clip = CalcMagazineAmount(ammo, 2, p->kickback_pic >= 4); + break; + } + format.Format("%d/%d", clip, ammo - clip); + } img = tileGetTexture(wicon); imgScale = baseScale / img->GetDisplayHeight(); auto imgX = 22.5; @@ -155,7 +174,7 @@ public: imgX += (imgX * 0.755) * (strlen - 1); } - if (p->curr_weapon != KNEE_WEAPON && p->curr_weapon != SLINGBLADE_WEAPON && (!althud_flashing || gameclock & 32 || p->ammo_amount[weapon] > (max_ammo_amount[weapon] / 10))) + if (weapon != KNEE_WEAPON && weapon != SLINGBLADE_WEAPON && (!althud_flashing || gameclock & 32 || ammo > (max_ammo_amount[weapon] / 10))) { SBar_DrawString(this, &numberFont, format, -1, -numberFont.mFont->GetHeight() * scale + 4, DI_TEXT_ALIGN_RIGHT, CR_UNTRANSLATED, 1, 0, 0, scale, scale); }