From 15b8bc959f3992a829aefad225928df6da757da9 Mon Sep 17 00:00:00 2001 From: hendricks266 Date: Sat, 30 Nov 2019 06:10:40 +0000 Subject: [PATCH] SW: Add Equip Pickups weapon auto-switching toggle git-svn-id: https://svn.eduke32.com/eduke32@8339 1a8010ca-5511-0410-912e-c29ae57300e0 # Conflicts: # source/sw/src/swconfig.cpp --- source/sw/src/game.cpp | 1 + source/sw/src/menus.cpp | 5 +++++ source/sw/src/menus.h | 1 + source/sw/src/settings.h | 1 + source/sw/src/sprite.cpp | 30 ++++++++++++++++++++++++++++++ 5 files changed, 38 insertions(+) diff --git a/source/sw/src/game.cpp b/source/sw/src/game.cpp index 5c5a489d9..c32d63e0e 100644 --- a/source/sw/src/game.cpp +++ b/source/sw/src/game.cpp @@ -209,6 +209,7 @@ const GAME_SET gs_defaults = TRUE, // nuke "Track??", // waveform track name FALSE, + TRUE, }; GAME_SET gs; diff --git a/source/sw/src/menus.cpp b/source/sw/src/menus.cpp index 73ca09cb1..6f67282bb 100644 --- a/source/sw/src/menus.cpp +++ b/source/sw/src/menus.cpp @@ -398,6 +398,7 @@ MenuItem options_i[] = {DefButton(btn_voxels, 0, "Voxel Sprites"), OPT_XS, OPT_LINE(10), 1, m_defshade, 0, NULL, NULL, NULL}, {DefButton(btn_stats, 0, "Level Stats"), OPT_XS, OPT_LINE(11), 1, m_defshade, 0, NULL, MNU_StatCheck, NULL}, {DefButton(btn_darts, 0, "Use Darts"), OPT_XS, OPT_LINE(12), 1, m_defshade, 0, NULL, NULL, NULL}, + {DefButton(btn_autoswitch, 0, "Equip Pickups"), OPT_XS, OPT_LINE(13), 1, m_defshade, 0, NULL, NULL, NULL}, {DefNone} }; @@ -1866,6 +1867,7 @@ MNU_InitMenus(void) buttonsettings[btn_flipstereo] = snd_reversestereo; buttonsettings[btn_stats] = hud_stats; buttonsettings[btn_darts] = gs.Darts; + buttonsettings[btn_autoswitch] = gs.WeaponAutoSwitch; slidersettings[sldr_gametype] = gs.NetGameType; slidersettings[sldr_netlevel] = gs.NetLevel; @@ -2925,6 +2927,9 @@ void MNU_DoButton(MenuItem_p item, SWBOOL draw) case btn_darts: gs.Darts = state = buttonsettings[item->button]; break; + case btn_autoswitch: + gs.WeaponAutoSwitch = state = buttonsettings[item->button]; + break; case btn_markers: gs.NetSpawnMarkers = state = buttonsettings[item->button]; break; diff --git a/source/sw/src/menus.h b/source/sw/src/menus.h index f05b5f4fb..bf707d95e 100644 --- a/source/sw/src/menus.h +++ b/source/sw/src/menus.h @@ -213,6 +213,7 @@ typedef enum btn_voxels, btn_stats, btn_playcd, btn_videofs, btn_darts, + btn_autoswitch, btn_max } BTNType; diff --git a/source/sw/src/settings.h b/source/sw/src/settings.h index 579743cf7..4eda4a023 100644 --- a/source/sw/src/settings.h +++ b/source/sw/src/settings.h @@ -47,6 +47,7 @@ typedef struct //SWBOOL PlayCD; // Not implemented and no idea how to support it without the music assets. char WaveformTrackName[MAXWAVEFORMTRACKLENGTH]; SWBOOL Darts; + SWBOOL WeaponAutoSwitch; } GAME_SET, *GAME_SETp; extern const GAME_SET gs_defaults; diff --git a/source/sw/src/sprite.cpp b/source/sw/src/sprite.cpp index a5d6da53a..ae1fda491 100644 --- a/source/sw/src/sprite.cpp +++ b/source/sw/src/sprite.cpp @@ -5969,6 +5969,9 @@ KeyMain: if (TEST(pp->WpnFlags, BIT(WPN_STAR))) break; SET(pp->WpnFlags, BIT(WPN_STAR)); + + if (!gs.WeaponAutoSwitch) + break; if (User[pp->PlayerSprite]->WeaponNum <= WPN_STAR && User[pp->PlayerSprite]->WeaponNum != WPN_SWORD) break; InitWeaponStar(pp); @@ -5994,6 +5997,9 @@ KeyMain: if (TEST(pp->WpnFlags, BIT(WPN_MINE))) break; SET(pp->WpnFlags, BIT(WPN_MINE)); + + if (!gs.WeaponAutoSwitch) + break; if (User[pp->PlayerSprite]->WeaponNum > WPN_MINE && User[pp->PlayerSprite]->WeaponNum != WPN_SWORD) break; InitWeaponMine(pp); @@ -6035,6 +6041,9 @@ KeyMain: ChoosePlayerGetSound(pp); } + if (!gs.WeaponAutoSwitch) + break; + if (User[pp->PlayerSprite]->WeaponNum > WPN_UZI && User[pp->PlayerSprite]->WeaponNum != WPN_SWORD) break; @@ -6074,6 +6083,9 @@ KeyMain: if (TEST(pp->WpnFlags, BIT(WPN_MICRO))) break; SET(pp->WpnFlags, BIT(WPN_MICRO)); + + if (!gs.WeaponAutoSwitch) + break; if (User[pp->PlayerSprite]->WeaponNum > WPN_MICRO && User[pp->PlayerSprite]->WeaponNum != WPN_SWORD) break; InitWeaponMicro(pp); @@ -6142,6 +6154,9 @@ KeyMain: if (TEST(pp->WpnFlags, BIT(WPN_GRENADE))) break; SET(pp->WpnFlags, BIT(WPN_GRENADE)); + + if (!gs.WeaponAutoSwitch) + break; if (User[pp->PlayerSprite]->WeaponNum > WPN_GRENADE && User[pp->PlayerSprite]->WeaponNum != WPN_SWORD) break; InitWeaponGrenade(pp); @@ -6168,6 +6183,9 @@ KeyMain: if (TEST(pp->WpnFlags, BIT(WPN_ROCKET))) break; SET(pp->WpnFlags, BIT(WPN_ROCKET)); + + if (!gs.WeaponAutoSwitch) + break; InitWeaponRocket(pp); break; @@ -6212,6 +6230,9 @@ KeyMain: if (TEST(pp->WpnFlags, BIT(WPN_RAIL))) break; SET(pp->WpnFlags, BIT(WPN_RAIL)); + + if (!gs.WeaponAutoSwitch) + break; if (User[pp->PlayerSprite]->WeaponNum > WPN_RAIL && User[pp->PlayerSprite]->WeaponNum != WPN_SWORD) break; InitWeaponRail(pp); @@ -6251,6 +6272,9 @@ KeyMain: if (TEST(pp->WpnFlags, BIT(WPN_SHOTGUN))) break; SET(pp->WpnFlags, BIT(WPN_SHOTGUN)); + + if (!gs.WeaponAutoSwitch) + break; if (User[pp->PlayerSprite]->WeaponNum > WPN_SHOTGUN && User[pp->PlayerSprite]->WeaponNum != WPN_SWORD) break; InitWeaponShotgun(pp); @@ -6317,6 +6341,9 @@ KeyMain: if (TEST(pp->WpnFlags, BIT(WPN_HOTHEAD))) break; SET(pp->WpnFlags, BIT(WPN_NAPALM) | BIT(WPN_RING) | BIT(WPN_HOTHEAD)); + + if (!gs.WeaponAutoSwitch) + break; if (User[pp->PlayerSprite]->WeaponNum > WPN_HOTHEAD && User[pp->PlayerSprite]->WeaponNum != WPN_SWORD) break; InitWeaponHothead(pp); @@ -6361,6 +6388,9 @@ KeyMain: break; SET(pp->WpnFlags, BIT(WPN_HEART)); + if (!gs.WeaponAutoSwitch) + break; + if (User[pp->PlayerSprite]->WeaponNum > WPN_HEART && User[pp->PlayerSprite]->WeaponNum != WPN_SWORD) break;