diff --git a/src/gi.cpp b/src/gi.cpp index 8dea1e577a..85335554cf 100644 --- a/src/gi.cpp +++ b/src/gi.cpp @@ -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") diff --git a/src/gi.h b/src/gi.h index d656e80bfa..5c9dc1ae58 100644 --- a/src/gi.h +++ b/src/gi.h @@ -152,6 +152,7 @@ struct gameinfo_t int statusbarfile = -1; FName statusbarclass; int statusbarclassfile = -1; + FName MessageBoxClass; FName backpacktype; FString intermissionMusic; int intermissionOrder; diff --git a/src/menu/messagebox.cpp b/src/menu/messagebox.cpp index 3684209646..3531cf2f62 100644 --- a/src/menu/messagebox.cpp +++ b/src/menu/messagebox.cpp @@ -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(handler) }; - auto f = dyn_cast(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(handler) }; + VMCall(func, params, countof(params), nullptr, 0); + return (DMenu*)p; + } + return nullptr; } //============================================================================= diff --git a/src/namedef.h b/src/namedef.h index bfbf263622..ad29da9ba7 100644 --- a/src/namedef.h +++ b/src/namedef.h @@ -912,3 +912,4 @@ xx(StaticArray) xx(DynArray) xx(Struct) xx(ReflectType) +xx(MessageBoxMenu) diff --git a/wadsrc/static/mapinfo/chex.txt b/wadsrc/static/mapinfo/chex.txt index 4bff1283ec..fe852542f4 100644 --- a/wadsrc/static/mapinfo/chex.txt +++ b/wadsrc/static/mapinfo/chex.txt @@ -68,6 +68,7 @@ gameinfo statscreen_coop = "CoopStatusScreen" statscreen_dm = "DeathmatchStatusScreen" statscreen_single = "DoomStatusScreen" + messageboxclass = "MessageBoxMenu" } DoomEdNums diff --git a/wadsrc/static/mapinfo/doomcommon.txt b/wadsrc/static/mapinfo/doomcommon.txt index c033ce09c0..82eb14d22f 100644 --- a/wadsrc/static/mapinfo/doomcommon.txt +++ b/wadsrc/static/mapinfo/doomcommon.txt @@ -69,6 +69,7 @@ gameinfo statscreen_coop = "CoopStatusScreen" statscreen_dm = "DeathmatchStatusScreen" statscreen_single = "DoomStatusScreen" + messageboxclass = "MessageBoxMenu" } spawnnums diff --git a/wadsrc/static/mapinfo/heretic.txt b/wadsrc/static/mapinfo/heretic.txt index af0295ef30..73310ad474 100644 --- a/wadsrc/static/mapinfo/heretic.txt +++ b/wadsrc/static/mapinfo/heretic.txt @@ -67,6 +67,7 @@ gameinfo statscreen_coop = "CoopStatusScreen" statscreen_dm = "DeathmatchStatusScreen" statscreen_single = "RavenStatusScreen" + messageboxclass = "MessageBoxMenu" } DoomEdNums diff --git a/wadsrc/static/mapinfo/hexen.txt b/wadsrc/static/mapinfo/hexen.txt index 37afe73362..618fd4be74 100644 --- a/wadsrc/static/mapinfo/hexen.txt +++ b/wadsrc/static/mapinfo/hexen.txt @@ -65,6 +65,7 @@ gameinfo statscreen_coop = "CoopStatusScreen" statscreen_dm = "DeathmatchStatusScreen" statscreen_single = "RavenStatusScreen" + messageboxclass = "MessageBoxMenu" } DoomEdNums diff --git a/wadsrc/static/mapinfo/mindefaults.txt b/wadsrc/static/mapinfo/mindefaults.txt index 8855872811..26ab0d9395 100644 --- a/wadsrc/static/mapinfo/mindefaults.txt +++ b/wadsrc/static/mapinfo/mindefaults.txt @@ -53,6 +53,7 @@ gameinfo statscreen_mapnamefont = "BigFont" statscreen_finishedpatch = "WIF" statscreen_enteringpatch = "WIENTER" + messageboxclass = "MessageBoxMenu" } DoomEdNums diff --git a/wadsrc/static/mapinfo/strife.txt b/wadsrc/static/mapinfo/strife.txt index 419c8c13ff..0b52b213e4 100644 --- a/wadsrc/static/mapinfo/strife.txt +++ b/wadsrc/static/mapinfo/strife.txt @@ -67,6 +67,7 @@ gameinfo statscreen_dm = "DeathmatchStatusScreen" statscreen_single = "RavenStatusScreen" statusbarclass = "StrifeStatusBar" + messageboxclass = "MessageBoxMenu" } DoomEdNums diff --git a/wadsrc/static/zscript/menu/messagebox.txt b/wadsrc/static/zscript/menu/messagebox.txt index 48d9949a39..86796d3011 100644 --- a/wadsrc/static/zscript/menu/messagebox.txt +++ b/wadsrc/static/zscript/menu/messagebox.txt @@ -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;