diff --git a/src/lua_hook.h b/src/lua_hook.h index 17e0e99a0787d43fa12f817018b29acaac723495..66ad9bca358144731d036ddad8835c5e09a14058 100644 --- a/src/lua_hook.h +++ b/src/lua_hook.h @@ -85,6 +85,7 @@ automatically. X (scores),/* emblems/multiplayer list */\ X (title),/* titlescreen */\ X (titlecard),\ + X (escpanel) /* rings/time/score/emblem panel in pause menu */,\ X (intermission),\ X (continue),\ X (playersetup),\ @@ -126,6 +127,10 @@ int LUA_HookCharacterHUD INT32 skinIndex, UINT8 sprite2, UINT8 frame, UINT8 rotation, skincolornum_t color, INT32 ticker, boolean mode ); +int LUA_HookEscapePanel( + int hook, huddrawlist_h drawlist, + int x, int y, int width, int height +); int LUA_HookMobj(mobj_t *, int hook); int LUA_Hook2Mobj(mobj_t *, mobj_t *, int hook); diff --git a/src/lua_hooklib.c b/src/lua_hooklib.c index 54381e4aedc47a64d89190f5582c3c5856634ba6..f805d9dff996c0e7e95fcff44d1e240d72c78331 100644 --- a/src/lua_hooklib.c +++ b/src/lua_hooklib.c @@ -709,6 +709,22 @@ int LUA_HookCharacterHUD return hook.status; } +int LUA_HookEscapePanel(int hook, huddrawlist_h drawlist, int x, int y, int width, int height) +{ + Hook_State hookstate; + if (prepare_hud_hook(&hookstate, false, hook)) + { + LUA_SetHudHook(hook, drawlist); + lua_pushinteger(gL, x); + lua_pushinteger(gL, y); + lua_pushinteger(gL, width); + lua_pushinteger(gL, height); + call_hud_hooks(&hookstate, 1, res_true); + } + return hookstate.status; +} + + /* ========================================================================= SPECIALIZED HOOKS ========================================================================= */ diff --git a/src/m_menu.c b/src/m_menu.c index 50011347550c32622238ef02a6d538be62bbb31f..72eda092f7e94c6aa89f19557622a9aa9b87340b 100644 --- a/src/m_menu.c +++ b/src/m_menu.c @@ -186,6 +186,7 @@ static tic_t keydown = 0; // Lua static huddrawlist_h luahuddrawlist_playersetup; +static huddrawlist_h luahuddrawlist_infoscreen; // // PROTOTYPES @@ -393,6 +394,7 @@ static void M_DrawColorRamp(INT32 x, INT32 y, INT32 w, INT32 h, skincolor_t colo // Handling functions static boolean M_ExitPandorasBox(void); static boolean M_QuitMultiPlayerMenu(void); +static boolean M_QuitPauseMenu(void); static void M_HandleAddons(INT32 choice); static void M_HandleLevelPlatter(INT32 choice); static void M_HandleSoundTest(INT32 choice); @@ -3749,6 +3751,14 @@ void M_StartControlPanel(void) CON_ToggleOff(); // move away console } +static boolean M_QuitPauseMenu(void) +{ + LUA_HUD_DestroyDrawList(luahuddrawlist_infoscreen); + luahuddrawlist_infoscreen = NULL; + + return TRUE; +} + void M_EndModeAttackRun(void) { G_ClearModeAttackRetryFlag(); @@ -4697,8 +4707,29 @@ static void M_DrawPauseMenu(void) emblem_t *emblem_detail[3] = {NULL, NULL, NULL}; char emblem_text[3][20]; INT32 i; + INT16 xbox = 27; + INT16 ybox = 16; + INT16 widthbox = 32; + INT16 heightbox = 6; + + M_DrawTextBox(xbox, ybox, widthbox, heightbox); + + if (!LUA_HUD_IsDrawListValid(luahuddrawlist_infoscreen)) + { + LUA_HUD_DestroyDrawList(luahuddrawlist_infoscreen); + luahuddrawlist_infoscreen = LUA_HUD_CreateDrawList(); + } + LUA_HUD_ClearDrawList(luahuddrawlist_infoscreen); + + boolean esc_override = LUA_HookEscapePanel( + HUD_HOOK(escpanel), + luahuddrawlist_infoscreen, + xbox+5, ybox+5, widthbox*8+6, heightbox*8+6); - M_DrawTextBox(27, 16, 32, 6); + LUA_HUD_DrawList(luahuddrawlist_infoscreen); + + if (esc_override) + goto draw_rest; // Draw any and all emblems at the top. M_DrawMapEmblems(gamemap, 272, 28, true); @@ -4831,7 +4862,10 @@ static void M_DrawPauseMenu(void) } } - M_DrawGenericMenu(); + draw_rest: + { + M_DrawGenericMenu(); + } } static void M_DrawCenteredMenu(void) diff --git a/src/m_menu.h b/src/m_menu.h index 99a5b6de4266be02b1cba0e98a26addac5524548..a791d56f40984c41bfd30c92006d5ad3e767d250 100644 --- a/src/m_menu.h +++ b/src/m_menu.h @@ -523,7 +523,7 @@ void M_FreePlayerSetupColors(void); M_DrawPauseMenu,\ x, y,\ 0,\ - NULL\ + M_QuitPauseMenu\ } #define CENTERMENUSTYLE(id, header, source, prev, y)\