From aa8ea65f925c04588466a0d3a4fcf31a42d7e376 Mon Sep 17 00:00:00 2001 From: vflyson Date: Fri, 17 Feb 2017 18:57:56 -0500 Subject: [PATCH] properly display the ammo count for weapons which don't have a clip --- rwgame/DrawUI.cpp | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/rwgame/DrawUI.cpp b/rwgame/DrawUI.cpp index f9e06cc8..b7e45936 100644 --- a/rwgame/DrawUI.cpp +++ b/rwgame/DrawUI.cpp @@ -184,9 +184,20 @@ void drawPlayerInfo(PlayerController* player, GameWorld* world, if (weapon->fireType != WeaponData::MELEE) { const CharacterState& cs = player->getCharacter()->getCurrentState(); const CharacterWeaponSlot& slotInfo = cs.weapons[cs.currentWeapon]; - ti.text = GameStringUtil::fromString( - std::to_string(slotInfo.bulletsClip) + "-" + - std::to_string(slotInfo.bulletsTotal)); + + bool isProjectile = weapon->fireType == WeaponData::PROJECTILE; + bool isShotgun = weapon->modelID == 176; + bool isSniper = weapon->modelID == 177; + bool noClip = isProjectile || isShotgun || isSniper; + + if (noClip) { + ti.text = GameStringUtil::fromString( + std::to_string(slotInfo.bulletsTotal)); + } else { + ti.text = GameStringUtil::fromString( + std::to_string(slotInfo.bulletsClip) + "-" + + std::to_string(slotInfo.bulletsTotal)); + } ti.baseColour = ui_shadowColour; ti.font = 2;