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
This commit is contained in:
hendricks266 2019-11-30 06:10:40 +00:00 committed by Christoph Oelckers
parent 8d2159ab70
commit 15b8bc959f
5 changed files with 38 additions and 0 deletions

View file

@ -209,6 +209,7 @@ const GAME_SET gs_defaults =
TRUE, // nuke
"Track??", // waveform track name
FALSE,
TRUE,
};
GAME_SET gs;

View file

@ -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;

View file

@ -213,6 +213,7 @@ typedef enum
btn_voxels, btn_stats, btn_playcd,
btn_videofs,
btn_darts,
btn_autoswitch,
btn_max
} BTNType;

View file

@ -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;

View file

@ -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;