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 TRUE, // nuke
"Track??", // waveform track name "Track??", // waveform track name
FALSE, FALSE,
TRUE,
}; };
GAME_SET gs; 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_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_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_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} {DefNone}
}; };
@ -1866,6 +1867,7 @@ MNU_InitMenus(void)
buttonsettings[btn_flipstereo] = snd_reversestereo; buttonsettings[btn_flipstereo] = snd_reversestereo;
buttonsettings[btn_stats] = hud_stats; buttonsettings[btn_stats] = hud_stats;
buttonsettings[btn_darts] = gs.Darts; buttonsettings[btn_darts] = gs.Darts;
buttonsettings[btn_autoswitch] = gs.WeaponAutoSwitch;
slidersettings[sldr_gametype] = gs.NetGameType; slidersettings[sldr_gametype] = gs.NetGameType;
slidersettings[sldr_netlevel] = gs.NetLevel; slidersettings[sldr_netlevel] = gs.NetLevel;
@ -2925,6 +2927,9 @@ void MNU_DoButton(MenuItem_p item, SWBOOL draw)
case btn_darts: case btn_darts:
gs.Darts = state = buttonsettings[item->button]; gs.Darts = state = buttonsettings[item->button];
break; break;
case btn_autoswitch:
gs.WeaponAutoSwitch = state = buttonsettings[item->button];
break;
case btn_markers: case btn_markers:
gs.NetSpawnMarkers = state = buttonsettings[item->button]; gs.NetSpawnMarkers = state = buttonsettings[item->button];
break; break;

View file

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

View file

@ -47,6 +47,7 @@ typedef struct
//SWBOOL PlayCD; // Not implemented and no idea how to support it without the music assets. //SWBOOL PlayCD; // Not implemented and no idea how to support it without the music assets.
char WaveformTrackName[MAXWAVEFORMTRACKLENGTH]; char WaveformTrackName[MAXWAVEFORMTRACKLENGTH];
SWBOOL Darts; SWBOOL Darts;
SWBOOL WeaponAutoSwitch;
} GAME_SET, *GAME_SETp; } GAME_SET, *GAME_SETp;
extern const GAME_SET gs_defaults; extern const GAME_SET gs_defaults;

View file

@ -5969,6 +5969,9 @@ KeyMain:
if (TEST(pp->WpnFlags, BIT(WPN_STAR))) if (TEST(pp->WpnFlags, BIT(WPN_STAR)))
break; break;
SET(pp->WpnFlags, BIT(WPN_STAR)); SET(pp->WpnFlags, BIT(WPN_STAR));
if (!gs.WeaponAutoSwitch)
break;
if (User[pp->PlayerSprite]->WeaponNum <= WPN_STAR && User[pp->PlayerSprite]->WeaponNum != WPN_SWORD) if (User[pp->PlayerSprite]->WeaponNum <= WPN_STAR && User[pp->PlayerSprite]->WeaponNum != WPN_SWORD)
break; break;
InitWeaponStar(pp); InitWeaponStar(pp);
@ -5994,6 +5997,9 @@ KeyMain:
if (TEST(pp->WpnFlags, BIT(WPN_MINE))) if (TEST(pp->WpnFlags, BIT(WPN_MINE)))
break; break;
SET(pp->WpnFlags, BIT(WPN_MINE)); SET(pp->WpnFlags, BIT(WPN_MINE));
if (!gs.WeaponAutoSwitch)
break;
if (User[pp->PlayerSprite]->WeaponNum > WPN_MINE && User[pp->PlayerSprite]->WeaponNum != WPN_SWORD) if (User[pp->PlayerSprite]->WeaponNum > WPN_MINE && User[pp->PlayerSprite]->WeaponNum != WPN_SWORD)
break; break;
InitWeaponMine(pp); InitWeaponMine(pp);
@ -6035,6 +6041,9 @@ KeyMain:
ChoosePlayerGetSound(pp); ChoosePlayerGetSound(pp);
} }
if (!gs.WeaponAutoSwitch)
break;
if (User[pp->PlayerSprite]->WeaponNum > WPN_UZI && User[pp->PlayerSprite]->WeaponNum != WPN_SWORD) if (User[pp->PlayerSprite]->WeaponNum > WPN_UZI && User[pp->PlayerSprite]->WeaponNum != WPN_SWORD)
break; break;
@ -6074,6 +6083,9 @@ KeyMain:
if (TEST(pp->WpnFlags, BIT(WPN_MICRO))) if (TEST(pp->WpnFlags, BIT(WPN_MICRO)))
break; break;
SET(pp->WpnFlags, BIT(WPN_MICRO)); SET(pp->WpnFlags, BIT(WPN_MICRO));
if (!gs.WeaponAutoSwitch)
break;
if (User[pp->PlayerSprite]->WeaponNum > WPN_MICRO && User[pp->PlayerSprite]->WeaponNum != WPN_SWORD) if (User[pp->PlayerSprite]->WeaponNum > WPN_MICRO && User[pp->PlayerSprite]->WeaponNum != WPN_SWORD)
break; break;
InitWeaponMicro(pp); InitWeaponMicro(pp);
@ -6142,6 +6154,9 @@ KeyMain:
if (TEST(pp->WpnFlags, BIT(WPN_GRENADE))) if (TEST(pp->WpnFlags, BIT(WPN_GRENADE)))
break; break;
SET(pp->WpnFlags, BIT(WPN_GRENADE)); SET(pp->WpnFlags, BIT(WPN_GRENADE));
if (!gs.WeaponAutoSwitch)
break;
if (User[pp->PlayerSprite]->WeaponNum > WPN_GRENADE && User[pp->PlayerSprite]->WeaponNum != WPN_SWORD) if (User[pp->PlayerSprite]->WeaponNum > WPN_GRENADE && User[pp->PlayerSprite]->WeaponNum != WPN_SWORD)
break; break;
InitWeaponGrenade(pp); InitWeaponGrenade(pp);
@ -6168,6 +6183,9 @@ KeyMain:
if (TEST(pp->WpnFlags, BIT(WPN_ROCKET))) if (TEST(pp->WpnFlags, BIT(WPN_ROCKET)))
break; break;
SET(pp->WpnFlags, BIT(WPN_ROCKET)); SET(pp->WpnFlags, BIT(WPN_ROCKET));
if (!gs.WeaponAutoSwitch)
break;
InitWeaponRocket(pp); InitWeaponRocket(pp);
break; break;
@ -6212,6 +6230,9 @@ KeyMain:
if (TEST(pp->WpnFlags, BIT(WPN_RAIL))) if (TEST(pp->WpnFlags, BIT(WPN_RAIL)))
break; break;
SET(pp->WpnFlags, BIT(WPN_RAIL)); SET(pp->WpnFlags, BIT(WPN_RAIL));
if (!gs.WeaponAutoSwitch)
break;
if (User[pp->PlayerSprite]->WeaponNum > WPN_RAIL && User[pp->PlayerSprite]->WeaponNum != WPN_SWORD) if (User[pp->PlayerSprite]->WeaponNum > WPN_RAIL && User[pp->PlayerSprite]->WeaponNum != WPN_SWORD)
break; break;
InitWeaponRail(pp); InitWeaponRail(pp);
@ -6251,6 +6272,9 @@ KeyMain:
if (TEST(pp->WpnFlags, BIT(WPN_SHOTGUN))) if (TEST(pp->WpnFlags, BIT(WPN_SHOTGUN)))
break; break;
SET(pp->WpnFlags, BIT(WPN_SHOTGUN)); SET(pp->WpnFlags, BIT(WPN_SHOTGUN));
if (!gs.WeaponAutoSwitch)
break;
if (User[pp->PlayerSprite]->WeaponNum > WPN_SHOTGUN && User[pp->PlayerSprite]->WeaponNum != WPN_SWORD) if (User[pp->PlayerSprite]->WeaponNum > WPN_SHOTGUN && User[pp->PlayerSprite]->WeaponNum != WPN_SWORD)
break; break;
InitWeaponShotgun(pp); InitWeaponShotgun(pp);
@ -6317,6 +6341,9 @@ KeyMain:
if (TEST(pp->WpnFlags, BIT(WPN_HOTHEAD))) if (TEST(pp->WpnFlags, BIT(WPN_HOTHEAD)))
break; break;
SET(pp->WpnFlags, BIT(WPN_NAPALM) | BIT(WPN_RING) | BIT(WPN_HOTHEAD)); 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) if (User[pp->PlayerSprite]->WeaponNum > WPN_HOTHEAD && User[pp->PlayerSprite]->WeaponNum != WPN_SWORD)
break; break;
InitWeaponHothead(pp); InitWeaponHothead(pp);
@ -6361,6 +6388,9 @@ KeyMain:
break; break;
SET(pp->WpnFlags, BIT(WPN_HEART)); SET(pp->WpnFlags, BIT(WPN_HEART));
if (!gs.WeaponAutoSwitch)
break;
if (User[pp->PlayerSprite]->WeaponNum > WPN_HEART && User[pp->PlayerSprite]->WeaponNum != WPN_SWORD) if (User[pp->PlayerSprite]->WeaponNum > WPN_HEART && User[pp->PlayerSprite]->WeaponNum != WPN_SWORD)
break; break;