From 1617938d4f07ad377014c332d507f7b1cc9ca547 Mon Sep 17 00:00:00 2001 From: Mitchell Richters <mjr4077au@gmail.com> Date: Fri, 28 Aug 2020 09:57:40 +1000 Subject: [PATCH] - Duke: When using `cl_showmagamt 1`, increase pistol maximum by 4 so that when you have full ammunition, you have a full clip. * On the fence about this. Lower makes the game harder, and higher could mean the difference between life and death. I do think that if we're showing amounts in the magazine, full ammo should constitute a full magazine. I think the max of 200 is an oversight from the original devs as all other games have proper defaults that reflect the magazine or cylinder capacity. --- source/games/duke/src/constants.h | 1 + source/games/duke/src/player_d.cpp | 21 +++++++++++++++++++++ 2 files changed, 22 insertions(+) diff --git a/source/games/duke/src/constants.h b/source/games/duke/src/constants.h index 26c96e051..208b73653 100644 --- a/source/games/duke/src/constants.h +++ b/source/games/duke/src/constants.h @@ -409,6 +409,7 @@ enum miscConstants MAXGEOSECTORS = 64, CRACK_TIME = 777, + PISTOL_MAXDEFAULT = 200, DUKE3D_NO_WIDESCREEN_PINNING = 1 << 0, }; diff --git a/source/games/duke/src/player_d.cpp b/source/games/duke/src/player_d.cpp index 1c1b617f7..4c6596f1a 100644 --- a/source/games/duke/src/player_d.cpp +++ b/source/games/duke/src/player_d.cpp @@ -2521,6 +2521,27 @@ static void processweapon(int snum, ESyncBits sb_snum, int psect) auto s = &sprite[pi]; int shrunk = (s->yrepeat < 32); + // Set maximum for pistol slightly higher if playing with `cl_showmagamount 1`. + if (!cl_showmagamt) + { + if (p->ammo_amount[PISTOL_WEAPON] > PISTOL_MAXDEFAULT) + p->ammo_amount[PISTOL_WEAPON] = PISTOL_MAXDEFAULT; + + if (max_ammo_amount[PISTOL_WEAPON] != PISTOL_MAXDEFAULT) + max_ammo_amount[PISTOL_WEAPON] = PISTOL_MAXDEFAULT; + } + else + { + short pistolAddition = 4; + short pistolNewMaximum = PISTOL_MAXDEFAULT + pistolAddition; + + if (p->ammo_amount[PISTOL_WEAPON] == PISTOL_MAXDEFAULT && max_ammo_amount[PISTOL_WEAPON] == PISTOL_MAXDEFAULT) + p->ammo_amount[PISTOL_WEAPON] += pistolAddition; + + if (max_ammo_amount[PISTOL_WEAPON] != pistolNewMaximum) + max_ammo_amount[PISTOL_WEAPON] = pistolNewMaximum; + } + if (isNamWW2GI() && (sb_snum & SKB_HOLSTER)) // 'Holster Weapon { if (isWW2GI())