mirror of
https://github.com/ZDoom/gzdoom.git
synced 2024-11-10 23:01:50 +00:00
Optional override for SetSlot and ClearPlayerClasses
With this, a decade-long struggle can now be ended. # Conflicts: # wadsrc/static/language.csv
This commit is contained in:
parent
fdd17403e5
commit
001df17daa
3 changed files with 46 additions and 3 deletions
|
@ -544,6 +544,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()
|
||||
{
|
||||
for (int i = 1; i <= NUM_WEAPON_SLOTS; ++i)
|
||||
|
@ -589,7 +592,12 @@ CCMD (setslot)
|
|||
}
|
||||
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)
|
||||
{
|
||||
PlayingKeyConf->AddWeapon(slot, argv[i]);
|
||||
|
|
|
@ -223,11 +223,45 @@ void D_LoadWadSettings ()
|
|||
ParsingKeyConf = false;
|
||||
}
|
||||
|
||||
// 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)
|
||||
{
|
||||
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"));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1198,6 +1198,7 @@ OptionMenu "MiscOptions" protected
|
|||
Option "$MISCMNU_QUICKSAVEROTATION", "quicksaverotation", "OnOff"
|
||||
Slider "$MISCMNU_QUICKSAVECOUNT", "quicksaverotationcount", 1, 20, 1, 0
|
||||
Option "$MISCMNU_DEHLOAD", "dehload", "dehopt"
|
||||
Option "$MISCMNU_SETSLOTSTRICT", "setslotstrict", "YesNo"
|
||||
Option "$MISCMNU_ENABLESCRIPTSCREENSHOTS", "enablescriptscreenshot", "OnOff"
|
||||
Option "$MISCMNU_INTERSCROLL", "nointerscrollabort", "OffOn"
|
||||
StaticText " "
|
||||
|
|
Loading…
Reference in a new issue