mirror of
https://github.com/ZDoom/Raze.git
synced 2025-02-17 09:11:25 +00:00
- Exhumed: Fix clip calculation setup.
* Since game maintains its own clip capacities, we need to use them instead of the generic handler for the games that do not. * Clean up the game-side code in `CheckClip()` to use `min()`. * Repair issue with pistol clip calculation that was using modulo when it shouldn't. A full weapon with 300 will divide into 6 with no remainder, therefore nothing in the clip. * Fixes #906.
This commit is contained in:
parent
892dde030f
commit
42d791e7c2
2 changed files with 7 additions and 11 deletions
|
@ -321,17 +321,13 @@ Collision CheckCloseRange(int nPlayer, DVector3& pos, sectortype* *ppSector)
|
||||||
|
|
||||||
void CheckClip(int nPlayer)
|
void CheckClip(int nPlayer)
|
||||||
{
|
{
|
||||||
if (PlayerList[nPlayer].nPlayerClip <= 0)
|
const auto pPlayer = &PlayerList[nPlayer];
|
||||||
{
|
|
||||||
PlayerList[nPlayer].nPlayerClip = PlayerList[nPlayer].nAmmo[kWeaponM60];
|
|
||||||
|
|
||||||
if (PlayerList[nPlayer].nPlayerClip > 100) {
|
if (pPlayer->nPlayerClip <= 0)
|
||||||
PlayerList[nPlayer].nPlayerClip = 100;
|
pPlayer->nPlayerClip = min(pPlayer->nAmmo[kWeaponM60], (int16_t)100);
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Reset pistol's clip amount.
|
if (pPlayer->nPistolClip <= 0)
|
||||||
PlayerList[nPlayer].nPistolClip = PlayerList[nPlayer].nAmmo[kWeaponPistol] % 6;
|
pPlayer->nPistolClip = min(pPlayer->nAmmo[kWeaponPistol], (int16_t)6);
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
|
|
|
@ -320,12 +320,12 @@ class ExhumedStatusBar : RazeStatusBar
|
||||||
{
|
{
|
||||||
if (weapon == kWeaponPistol && cl_showmagamt)
|
if (weapon == kWeaponPistol && cl_showmagamt)
|
||||||
{
|
{
|
||||||
int clip = CalcMagazineAmount(ammo, 6, Exhumed.GetPistolClip() == 0);
|
int clip = Exhumed.GetPistolClip();
|
||||||
format = String.Format("%d/%d", clip, ammo - clip);
|
format = String.Format("%d/%d", clip, ammo - clip);
|
||||||
}
|
}
|
||||||
else if (weapon == kWeaponM60 && cl_showmagamt)
|
else if (weapon == kWeaponM60 && cl_showmagamt)
|
||||||
{
|
{
|
||||||
int clip = CalcMagazineAmount(ammo, 100, Exhumed.GetPlayerClip() == 0);
|
int clip = Exhumed.GetPlayerClip();
|
||||||
format = String.Format("%d/%d", clip, ammo - clip);
|
format = String.Format("%d/%d", clip, ammo - clip);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
Loading…
Reference in a new issue