- allow specifying a custom class for message box display.

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

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);
return (DMenu*)p;
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;
}
//=============================================================================