mirror of
https://github.com/ZDoom/gzdoom-gles.git
synced 2025-03-03 15:21:19 +00:00
Optional override for SetSlot and ClearPlayerClasses
With this, a decade-long struggle can now be ended. # Conflicts: # src/keysections.cpp # wadsrc/static/menudef.txt
This commit is contained in:
parent
7416a1d49b
commit
83eeaac940
4 changed files with 47 additions and 2 deletions
|
@ -551,6 +551,9 @@ int FWeaponSlots::RestoreSlots(FConfigFile *config, const char *section)
|
||||||
//
|
//
|
||||||
//===========================================================================
|
//===========================================================================
|
||||||
|
|
||||||
|
// Strict handling of SetSlot and ClearPlayerClasses in KEYCONF
|
||||||
|
CVAR(Bool,setslotstrict,true,CVAR_ARCHIVE);
|
||||||
|
|
||||||
void FWeaponSlots::PrintSettings()
|
void FWeaponSlots::PrintSettings()
|
||||||
{
|
{
|
||||||
for (int i = 1; i <= NUM_WEAPON_SLOTS; ++i)
|
for (int i = 1; i <= NUM_WEAPON_SLOTS; ++i)
|
||||||
|
@ -596,7 +599,12 @@ CCMD (setslot)
|
||||||
}
|
}
|
||||||
else if (PlayingKeyConf != nullptr)
|
else if (PlayingKeyConf != nullptr)
|
||||||
{
|
{
|
||||||
PlayingKeyConf->ClearSlot(slot);
|
// Only clear the slot first if setslotstrict is true
|
||||||
|
// If not, we'll just add to the slot without clearing it
|
||||||
|
if(setslotstrict)
|
||||||
|
{
|
||||||
|
PlayingKeyConf->ClearSlot(slot);
|
||||||
|
}
|
||||||
for (int i = 2; i < argv.argc(); ++i)
|
for (int i = 2; i < argv.argc(); ++i)
|
||||||
{
|
{
|
||||||
PlayingKeyConf->AddWeapon(slot, argv[i]);
|
PlayingKeyConf->AddWeapon(slot, argv[i]);
|
||||||
|
|
|
@ -249,11 +249,45 @@ void SetupPlayerClasses ()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Strict handling of SetSlot and ClearPlayerClasses in KEYCONF (see a_weapons.cpp)
|
||||||
|
EXTERN_CVAR (Bool, setslotstrict)
|
||||||
|
|
||||||
|
// Specifically hunt for and remove IWAD playerclasses
|
||||||
|
void ClearIWADPlayerClasses (PClassActor *ti)
|
||||||
|
{
|
||||||
|
for(unsigned i=0; i < PlayerClasses.Size(); i++)
|
||||||
|
{
|
||||||
|
if(PlayerClasses[i].Type==ti)
|
||||||
|
{
|
||||||
|
for(unsigned j = i; j < PlayerClasses.Size()-1; j++)
|
||||||
|
{
|
||||||
|
PlayerClasses[j] = PlayerClasses[j+1];
|
||||||
|
}
|
||||||
|
PlayerClasses.Pop();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
CCMD (clearplayerclasses)
|
CCMD (clearplayerclasses)
|
||||||
{
|
{
|
||||||
if (ParsingKeyConf)
|
if (ParsingKeyConf)
|
||||||
{
|
{
|
||||||
PlayerClasses.Clear ();
|
// Only clear the playerclasses first if setslotstrict is true
|
||||||
|
// If not, we'll only remove the IWAD playerclasses
|
||||||
|
if(setslotstrict)
|
||||||
|
PlayerClasses.Clear();
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// I wish I had a better way to pick out IWAD playerclasses
|
||||||
|
// without having to explicitly name them here...
|
||||||
|
ClearIWADPlayerClasses(PClass::FindActor("DoomPlayer"));
|
||||||
|
ClearIWADPlayerClasses(PClass::FindActor("HereticPlayer"));
|
||||||
|
ClearIWADPlayerClasses(PClass::FindActor("StrifePlayer"));
|
||||||
|
ClearIWADPlayerClasses(PClass::FindActor("FighterPlayer"));
|
||||||
|
ClearIWADPlayerClasses(PClass::FindActor("ClericPlayer"));
|
||||||
|
ClearIWADPlayerClasses(PClass::FindActor("MagePlayer"));
|
||||||
|
ClearIWADPlayerClasses(PClass::FindActor("ChexPlayer"));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -2009,6 +2009,8 @@ MISCMNU_INTERSCROLL = "Allow skipping of intermission scrollers";
|
||||||
MISCMNU_QUICKEXIT = "Allow quick exit";
|
MISCMNU_QUICKEXIT = "Allow quick exit";
|
||||||
MISCMNU_NOCHEATS = "Disable classic keyboard cheats";
|
MISCMNU_NOCHEATS = "Disable classic keyboard cheats";
|
||||||
MISCMNU_ALWAYSTALLY = "Show Tally Screen On Level Exit";
|
MISCMNU_ALWAYSTALLY = "Show Tally Screen On Level Exit";
|
||||||
|
MISCMNU_SETSLOTSTRICT = "Strict KEYCONF Weapons/Players";
|
||||||
|
|
||||||
// Automap Options
|
// Automap Options
|
||||||
AUTOMAPMNU_TITLE = "AUTOMAP OPTIONS";
|
AUTOMAPMNU_TITLE = "AUTOMAP OPTIONS";
|
||||||
AUTOMAPMNU_COLORSET = "Map color set";
|
AUTOMAPMNU_COLORSET = "Map color set";
|
||||||
|
|
|
@ -1190,6 +1190,7 @@ OptionMenu "MiscOptions" protected
|
||||||
Slider "$MISCMNU_QUICKSAVECOUNT", "quicksaverotationcount", 1, 20, 1, 0
|
Slider "$MISCMNU_QUICKSAVECOUNT", "quicksaverotationcount", 1, 20, 1, 0
|
||||||
Option "$MISCMNU_DEHLOAD", "dehload", "dehopt"
|
Option "$MISCMNU_DEHLOAD", "dehload", "dehopt"
|
||||||
Option "$MISCMNU_ENABLESCRIPTSCREENSHOTS", "enablescriptscreenshot", "OnOff"
|
Option "$MISCMNU_ENABLESCRIPTSCREENSHOTS", "enablescriptscreenshot", "OnOff"
|
||||||
|
Option "$MISCMNU_SETSLOTSTRICT", "setslotstrict", "YesNo"
|
||||||
Option "$MISCMNU_INTERSCROLL", "nointerscrollabort", "OffOn"
|
Option "$MISCMNU_INTERSCROLL", "nointerscrollabort", "OffOn"
|
||||||
StaticText " "
|
StaticText " "
|
||||||
Option "$MISCMNU_CACHENODES", "gl_cachenodes", "OnOff"
|
Option "$MISCMNU_CACHENODES", "gl_cachenodes", "OnOff"
|
||||||
|
|
Loading…
Reference in a new issue