- allow using the default menu settings classes when none is specified in MENUDEFS.

This commit is contained in:
Christoph Oelckers 2017-02-16 17:45:04 +01:00
parent 59db1a882f
commit 4d99b58f96
3 changed files with 13 additions and 3 deletions

View file

@ -544,7 +544,7 @@ void FullGC()
void Barrier(DObject *pointing, DObject *pointed)
{
assert(pointed->GetClass() < (void*)0x1000000000000000);
assert(pointed->GetClass() != nullptr);
assert(pointing == NULL || (pointing->IsBlack() && !pointing->IsDead()));
assert(pointed->IsWhite() && !pointed->IsDead());
assert(State != GCS_Finalize && State != GCS_Pause);

View file

@ -94,6 +94,8 @@ float BackbuttonAlpha;
static bool MenuEnabled = true;
void M_InitVideoModes();
extern PClass *DefaultListMenuClass;
extern PClass *DefaultOptionMenuClass;
#define KEY_REPEAT_DELAY (TICRATE*5/12)
@ -623,7 +625,9 @@ void M_SetMenu(FName menu, int param)
}
else
{
const PClass *cls = ld->mClass == nullptr? RUNTIME_CLASS(DListMenu) : ld->mClass;
PClass *cls = ld->mClass;
if (cls == nullptr) cls = DefaultListMenuClass;
if (cls == nullptr) cls = PClass::FindClass("ListMenu");
DListMenu *newmenu = (DListMenu *)cls->CreateNew();
newmenu->Init(DMenu::CurrentMenu, ld);
@ -633,7 +637,9 @@ void M_SetMenu(FName menu, int param)
else if ((*desc)->IsKindOf(RUNTIME_CLASS(DOptionMenuDescriptor)))
{
DOptionMenuDescriptor *ld = static_cast<DOptionMenuDescriptor*>(*desc);
const PClass *cls = ld->mClass == nullptr? PClass::FindClass("OptionMenu") : ld->mClass;
PClass *cls = ld->mClass;
if (cls == nullptr) cls = DefaultOptionMenuClass;
if (cls == nullptr) cls = PClass::FindClass("OptionMenu");
DMenu *newmenu = (DMenu*)cls->CreateNew();
IFVIRTUALPTRNAME(newmenu, "OptionMenu", Init)

View file

@ -62,6 +62,8 @@ static DOptionMenuDescriptor *DefaultOptionMenuSettings; // contains common sett
FOptionMenuSettings OptionSettings;
FOptionMap OptionValues;
bool mustPrintErrors;
PClass *DefaultListMenuClass;
PClass *DefaultOptionMenuClass;
void I_BuildALDeviceList(FOptionValues *opt);
@ -948,7 +950,9 @@ void M_ParseMenuDefs()
}
}
}
DefaultListMenuClass = DefaultListMenuSettings->GetClass();
DefaultListMenuSettings = nullptr;
DefaultOptionMenuClass = DefaultOptionMenuSettings->GetClass();
DefaultOptionMenuSettings = nullptr;
}