Improved auto-reload messaging to avoid printing when there's nothing to do.

This commit is contained in:
Martin Haye 2020-08-22 11:15:21 -07:00
parent 91be4d56bf
commit c81de67a6f
2 changed files with 16 additions and 13 deletions

View File

@ -758,8 +758,9 @@ def playerCombatChoose(pl)#0
is '#'
if global->b_godmode
forEach(global=>p_enemyGroups, &(g) forEach(g=>p_enemies, @killEnemy))
return
fin
return
break
wend
if !redisplayMenu; beep(); fin
loop

View File

@ -234,7 +234,7 @@ def _reloadWeapon(pl, pWeapon, echo)#1
// Find matching ammo
ctx = pWeapon; item = first(pl=>p_items, &(p) ammoMatches(p, ctx=>s_ammoKind))
if !item
if echo
if echo and (pWeapon->b_clipCurrent < pWeapon->b_clipSize or !pWeapon->b_clipSize)
displayf3("%s has no ammo to reload %s %s! ", pl=>s_name, hisHerTheir(pl->c_gender), pWeapon=>s_name))
fin
return 1
@ -246,18 +246,20 @@ def _reloadWeapon(pl, pWeapon, echo)#1
else
n = min(item=>w_count, 1) // clipSize=0 implies auto-reloading weapon
fin
pWeapon->b_clipCurrent = pWeapon->b_clipCurrent + n
item=>w_count = item=>w_count - n
if echo
displayf2("%s %sreloads ", pl=>s_name, pWeapon->b_clipCurrent < pWeapon->b_clipSize ?? "partially " :: "")
displayf2("%s %s", hisHerTheir(pl->c_gender), pWeapon=>s_name)
if item=>w_count == 0
displayStr(" and is now out")
if n > 0
pWeapon->b_clipCurrent = pWeapon->b_clipCurrent + n
item=>w_count = item=>w_count - n
if echo
displayf2("%s %sreloads ", pl=>s_name, pWeapon->b_clipCurrent < pWeapon->b_clipSize ?? "partially " :: "")
displayf2("%s %s", hisHerTheir(pl->c_gender), pWeapon=>s_name)
if item=>w_count == 0
displayStr(" and is now out")
fin
displayStr(". ")
fin
if item=>w_count == 0
removeFromList(@pl=>p_items, item)
fin
displayStr(". ")
fin
if item=>w_count == 0
removeFromList(@pl=>p_items, item)
fin
return 1
end