- allow specifying a custom class for message box display.

This commit is contained in:
Christoph Oelckers 2017-04-14 23:28:54 +02:00
parent ca1981c52f
commit edebea4f8d
11 changed files with 19 additions and 6 deletions

View file

@ -371,6 +371,7 @@ void FMapInfoParser::ParseGameInfo()
GAMEINFOKEY_STRING_STAMPED(statusbarclass, "statusbarclass", statusbarclassfile)
GAMEINFOKEY_MUSIC(intermissionMusic, intermissionOrder, "intermissionMusic")
GAMEINFOKEY_STRING(CursorPic, "CursorPic")
GAMEINFOKEY_STRING(MessageBoxClass, "MessageBoxClass")
GAMEINFOKEY_BOOL(noloopfinalemusic, "noloopfinalemusic")
GAMEINFOKEY_BOOL(drawreadthis, "drawreadthis")
GAMEINFOKEY_BOOL(swapmenu, "swapmenu")

View file

@ -152,6 +152,7 @@ struct gameinfo_t
int statusbarfile = -1;
FName statusbarclass;
int statusbarclassfile = -1;
FName MessageBoxClass;
FName backpacktype;
FString intermissionMusic;
int intermissionOrder;

View file

@ -66,14 +66,18 @@ DEFINE_ACTION_FUNCTION(DMessageBoxMenu, CallHandler)
DMenu *CreateMessageBoxMenu(DMenu *parent, const char *message, int messagemode, bool playsound, FName action = NAME_None, hfunc handler = nullptr)
{
auto c = PClass::FindClass("MessageBoxMenu");
auto c = PClass::FindClass(gameinfo.MessageBoxClass);
if (!c->IsDescendantOf(NAME_MessageBoxMenu)) c = PClass::FindClass(NAME_MessageBoxMenu);
auto p = c->CreateNew();
FString namestr = message;
VMValue params[] = { p, parent, &namestr, messagemode, playsound, action.GetIndex(), reinterpret_cast<void*>(handler) };
auto f = dyn_cast<PFunction>(c->FindSymbol("Init", false));
VMCall(f->Variants[0].Implementation, params, countof(params), nullptr, 0);
IFVIRTUALPTRNAME(p, NAME_MessageBoxMenu, Init)
{
VMValue params[] = { p, parent, &namestr, messagemode, playsound, action.GetIndex(), reinterpret_cast<void*>(handler) };
VMCall(func, params, countof(params), nullptr, 0);
return (DMenu*)p;
}
return nullptr;
}
//=============================================================================

View file

@ -912,3 +912,4 @@ xx(StaticArray)
xx(DynArray)
xx(Struct)
xx(ReflectType)
xx(MessageBoxMenu)

View file

@ -68,6 +68,7 @@ gameinfo
statscreen_coop = "CoopStatusScreen"
statscreen_dm = "DeathmatchStatusScreen"
statscreen_single = "DoomStatusScreen"
messageboxclass = "MessageBoxMenu"
}
DoomEdNums

View file

@ -69,6 +69,7 @@ gameinfo
statscreen_coop = "CoopStatusScreen"
statscreen_dm = "DeathmatchStatusScreen"
statscreen_single = "DoomStatusScreen"
messageboxclass = "MessageBoxMenu"
}
spawnnums

View file

@ -67,6 +67,7 @@ gameinfo
statscreen_coop = "CoopStatusScreen"
statscreen_dm = "DeathmatchStatusScreen"
statscreen_single = "RavenStatusScreen"
messageboxclass = "MessageBoxMenu"
}
DoomEdNums

View file

@ -65,6 +65,7 @@ gameinfo
statscreen_coop = "CoopStatusScreen"
statscreen_dm = "DeathmatchStatusScreen"
statscreen_single = "RavenStatusScreen"
messageboxclass = "MessageBoxMenu"
}
DoomEdNums

View file

@ -53,6 +53,7 @@ gameinfo
statscreen_mapnamefont = "BigFont"
statscreen_finishedpatch = "WIF"
statscreen_enteringpatch = "WIENTER"
messageboxclass = "MessageBoxMenu"
}
DoomEdNums

View file

@ -67,6 +67,7 @@ gameinfo
statscreen_dm = "DeathmatchStatusScreen"
statscreen_single = "RavenStatusScreen"
statusbarclass = "StrifeStatusBar"
messageboxclass = "MessageBoxMenu"
}
DoomEdNums

View file

@ -50,7 +50,7 @@ class MessageBoxMenu : Menu
//
//=============================================================================
void Init(Menu parent, String message, int messagemode, bool playsound = false, Name cmd = 'None', voidptr native_handler = null)
virtual void Init(Menu parent, String message, int messagemode, bool playsound = false, Name cmd = 'None', voidptr native_handler = null)
{
Super.Init(parent);
mAction = cmd;