diff --git a/autogen/lua_definitions/manual.lua b/autogen/lua_definitions/manual.lua index ed27d15c..41142265 100644 --- a/autogen/lua_definitions/manual.lua +++ b/autogen/lua_definitions/manual.lua @@ -147,7 +147,7 @@ end --- @param name string The text to show on the button --- @param func fun(index:integer) The function that is called when the button is pressed ---- Hooks a DJUI button into the mod menu. If you want to unpause the game when the button is pressed, return `true` from `func` to do so +--- Hooks a DJUI button into the mod menu function hook_mod_menu_button(name, func) -- ... end diff --git a/src/game/ingame_menu.c b/src/game/ingame_menu.c index 4eda892c..92205393 100644 --- a/src/game/ingame_menu.c +++ b/src/game/ingame_menu.c @@ -28,6 +28,7 @@ #include "hardcoded.h" #include "pc/network/network.h" #include "pc/djui/djui.h" +#include "pc/djui/djui_panel.h" #include "pc/djui/djui_panel_pause.h" #include "pc/utils/misc.h" #include "data/dynos_mgr_builtin_externs.h" @@ -139,7 +140,6 @@ s8 gLastDialogResponse = 0; u8 gMenuHoldKeyIndex = 0; u8 gMenuHoldKeyTimer = 0; s32 gDialogResponse = 0; -bool gForceUnpause = false; #if defined(VERSION_JP) || defined(VERSION_SH) || defined(VERSION_EU) #ifdef VERSION_EU @@ -3104,19 +3104,16 @@ s16 render_pause_courses_and_castle(void) { } #ifdef VERSION_EU - if (gPlayer1Controller->buttonPressed & (A_BUTTON | Z_TRIG | START_BUTTON) - || gForceUnpause) + if (gPlayer1Controller->buttonPressed & (A_BUTTON | Z_TRIG | START_BUTTON)) #else if (gPlayer1Controller->buttonPressed & A_BUTTON - || gPlayer1Controller->buttonPressed & START_BUTTON - || gForceUnpause) + || gPlayer1Controller->buttonPressed & START_BUTTON) #endif { level_set_transition(0, NULL); play_sound(SOUND_MENU_PAUSE_2, gGlobalSoundSource); gDialogBoxState = DIALOG_STATE_OPENING; gMenuMode = -1; - gForceUnpause = false; if (gDialogLineNum == 2 || gDialogLineNum == 3) { num = gDialogLineNum; @@ -3142,19 +3139,16 @@ s16 render_pause_courses_and_castle(void) { } #ifdef VERSION_EU - if (gPlayer1Controller->buttonPressed & (A_BUTTON | Z_TRIG | START_BUTTON) - || gForceUnpause) + if (gPlayer1Controller->buttonPressed & (A_BUTTON | Z_TRIG | START_BUTTON)) #else if (gPlayer1Controller->buttonPressed & A_BUTTON - || gPlayer1Controller->buttonPressed & START_BUTTON - || gForceUnpause) + || gPlayer1Controller->buttonPressed & START_BUTTON) #endif { level_set_transition(0, NULL); play_sound(SOUND_MENU_PAUSE_2, gGlobalSoundSource); gMenuMode = -1; gDialogBoxState = DIALOG_STATE_OPENING; - gForceUnpause = false; return 1; } diff --git a/src/game/ingame_menu.h b/src/game/ingame_menu.h index 7ef5e78d..b4a55a78 100644 --- a/src/game/ingame_menu.h +++ b/src/game/ingame_menu.h @@ -129,7 +129,6 @@ extern u8 gDialogTextColorR; extern u8 gDialogTextColorG; extern u8 gDialogTextColorB; extern u8 gDialogTextColorA; -extern bool gForceUnpause; void create_dl_identity_matrix(void); void create_dl_translation_matrix(s8 pushOp, f32 x, f32 y, f32 z); diff --git a/src/pc/lua/smlua_hooks.c b/src/pc/lua/smlua_hooks.c index 03f59d30..fadece5d 100644 --- a/src/pc/lua/smlua_hooks.c +++ b/src/pc/lua/smlua_hooks.c @@ -2248,18 +2248,6 @@ void smlua_call_mod_menu_element_hook(struct LuaHookedModMenuElement* hooked, in LOG_LUA("Failed to call the mod menu element callback: %s", hooked->name); return; } - - // output the return value - bool returnValue = false; - if (lua_type(L, -1) == LUA_TBOOLEAN) { - returnValue = smlua_to_boolean(L, -1); - } - lua_pop(L, 1); - - if (!gSmLuaConvertSuccess || !returnValue || hooked->element != MOD_MENU_ELEMENT_BUTTON) { return; } - - gForceUnpause = true; - djui_panel_shutdown(); }