- added a GenericMenu class, so that all menus can be given a virtual Init method.
Doing this to Menu itself would not work because the different menus require different parameters. This also means that all menus that are routed through menu items must inherit from either ListMenu, OptionMenu or GenericMenu. All other types can only be used internally. This should complete the menu scriptification.
This commit is contained in:
parent
9089beb110
commit
fb52b034b0
3 changed files with 23 additions and 9 deletions
|
|
@ -469,10 +469,15 @@ void M_SetMenu(FName menu, int param)
|
|||
const PClass *menuclass = PClass::FindClass(menu);
|
||||
if (menuclass != nullptr)
|
||||
{
|
||||
if (menuclass->IsDescendantOf(RUNTIME_CLASS(DMenu)))
|
||||
if (menuclass->IsDescendantOf("GenericMenu"))
|
||||
{
|
||||
DMenu *newmenu = (DMenu*)menuclass->CreateNew();
|
||||
newmenu->mParentMenu = CurrentMenu;
|
||||
|
||||
IFVIRTUALPTRNAME(newmenu, "GenericMenu", Init)
|
||||
{
|
||||
VMValue params[3] = { newmenu, CurrentMenu };
|
||||
GlobalVMStack.Call(func, params, 2, nullptr, 0);
|
||||
}
|
||||
M_ActivateMenu(newmenu);
|
||||
return;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue