mirror of
https://github.com/rwengine/openrw.git
synced 2024-09-15 15:02:34 +02:00
properly display the ammo count for weapons which don't have a clip
This commit is contained in:
parent
9fc38c5d51
commit
aa8ea65f92
@ -184,9 +184,20 @@ void drawPlayerInfo(PlayerController* player, GameWorld* world,
|
|||||||
if (weapon->fireType != WeaponData::MELEE) {
|
if (weapon->fireType != WeaponData::MELEE) {
|
||||||
const CharacterState& cs = player->getCharacter()->getCurrentState();
|
const CharacterState& cs = player->getCharacter()->getCurrentState();
|
||||||
const CharacterWeaponSlot& slotInfo = cs.weapons[cs.currentWeapon];
|
const CharacterWeaponSlot& slotInfo = cs.weapons[cs.currentWeapon];
|
||||||
ti.text = GameStringUtil::fromString(
|
|
||||||
std::to_string(slotInfo.bulletsClip) + "-" +
|
bool isProjectile = weapon->fireType == WeaponData::PROJECTILE;
|
||||||
std::to_string(slotInfo.bulletsTotal));
|
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.baseColour = ui_shadowColour;
|
||||||
ti.font = 2;
|
ti.font = 2;
|
||||||
|
Loading…
Reference in New Issue
Block a user