From ede79db4389a918d5ca2739c17c2bfadf49584c4 Mon Sep 17 00:00:00 2001 From: ceski <56656010+ceski-1@users.noreply.github.com> Date: Tue, 17 Sep 2024 14:11:40 -0700 Subject: [PATCH] Add vanilla `input_weapon9` support --- src/g_game.c | 25 ++++++++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-) diff --git a/src/g_game.c b/src/g_game.c index b1eeae6d..adb21b0b 100644 --- a/src/g_game.c +++ b/src/g_game.c @@ -318,6 +318,29 @@ static int G_NextWeapon(int direction) return weapon_order_table[i].weapon_num; } +static weapontype_t WeaponSSG(void) +{ + const player_t *player = &players[consoleplayer]; + + if (!ALLOW_SSG || !player->weaponowned[wp_supershotgun]) + { + return wp_nochange; + } + + if (!demo_compatibility) + { + return wp_supershotgun; + } + + if (player->pendingweapon != wp_supershotgun + && player->readyweapon != wp_supershotgun) + { + return wp_shotgun; + } + + return wp_nochange; +} + // [FG] toggle demo warp mode void G_EnableWarp(boolean warp) { @@ -780,7 +803,7 @@ void G_BuildTiccmd(ticcmd_t* cmd) M_InputGameActive(input_weapon6) && gamemode != shareware ? wp_plasma : M_InputGameActive(input_weapon7) && gamemode != shareware ? wp_bfg : M_InputGameActive(input_weapon8) ? wp_chainsaw : - M_InputGameActive(input_weapon9) && !demo_compatibility && ALLOW_SSG ? wp_supershotgun : + M_InputGameActive(input_weapon9) ? WeaponSSG() : wp_nochange; // killough 3/22/98: For network and demo consistency with the