1
0
mirror of https://github.com/rwengine/openrw.git synced 2024-11-22 02:12:45 +01:00

properly display the ammo count for weapons which don't have a clip

This commit is contained in:
vflyson 2017-02-17 18:57:56 -05:00 committed by Daniel Evans
parent 9fc38c5d51
commit aa8ea65f92

View File

@ -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;