diff --git a/autogen/convert_constants.py b/autogen/convert_constants.py index 40256fbb3..9c7ebfa5c 100644 --- a/autogen/convert_constants.py +++ b/autogen/convert_constants.py @@ -12,6 +12,7 @@ in_files = [ "include/types.h", "include/sm64.h", "src/pc/lua/smlua_hooks.h", + "src/game/area.h", "src/game/camera.h", "include/mario_animation_ids.h", "include/sounds.h", diff --git a/autogen/lua_definitions/constants.lua b/autogen/lua_definitions/constants.lua index b55e00227..6fd180651 100644 --- a/autogen/lua_definitions/constants.lua +++ b/autogen/lua_definitions/constants.lua @@ -336,6 +336,45 @@ COURSE_COUNT = 25 --- @type integer COURSE_MIN = 1 +--- @type integer +INSTANT_WARP_INDEX_START = 0x00 + +--- @type integer +INSTANT_WARP_INDEX_STOP = 0x04 + +--- @type integer +MAX_LOADED_GRAPH_NODES = 0x100 + +--- @type integer +WARP_TRANSITION_FADE_FROM_BOWSER = 0x12 + +--- @type integer +WARP_TRANSITION_FADE_FROM_CIRCLE = 0x0A + +--- @type integer +WARP_TRANSITION_FADE_FROM_COLOR = 0x00 + +--- @type integer +WARP_TRANSITION_FADE_FROM_MARIO = 0x10 + +--- @type integer +WARP_TRANSITION_FADE_FROM_STAR = 0x08 + +--- @type integer +WARP_TRANSITION_FADE_INTO_BOWSER = 0x13 + +--- @type integer +WARP_TRANSITION_FADE_INTO_CIRCLE = 0x0B + +--- @type integer +WARP_TRANSITION_FADE_INTO_COLOR = 0x01 + +--- @type integer +WARP_TRANSITION_FADE_INTO_MARIO = 0x11 + +--- @type integer +WARP_TRANSITION_FADE_INTO_STAR = 0x09 + --- @class BehaviorId --- @type BehaviorId diff --git a/docs/lua/constants.md b/docs/lua/constants.md index 91ec51720..098e0f0b3 100644 --- a/docs/lua/constants.md +++ b/docs/lua/constants.md @@ -1,6 +1,7 @@ ## [:rewind: Lua Reference](lua.md) # Supported Constants +- [area.h](#areah) - [behavior_table.h](#behavior_tableh) - [enum BehaviorId](#enum-BehaviorId) - [camera.h](#camerah) @@ -57,6 +58,25 @@
+## [area.h](#area.h) +- INSTANT_WARP_INDEX_START +- INSTANT_WARP_INDEX_STOP +- MAX_LOADED_GRAPH_NODES +- WARP_TRANSITION_FADE_FROM_BOWSER +- WARP_TRANSITION_FADE_FROM_CIRCLE +- WARP_TRANSITION_FADE_FROM_COLOR +- WARP_TRANSITION_FADE_FROM_MARIO +- WARP_TRANSITION_FADE_FROM_STAR +- WARP_TRANSITION_FADE_INTO_BOWSER +- WARP_TRANSITION_FADE_INTO_CIRCLE +- WARP_TRANSITION_FADE_INTO_COLOR +- WARP_TRANSITION_FADE_INTO_MARIO +- WARP_TRANSITION_FADE_INTO_STAR + +[:arrow_up_small:](#) + +
+ ## [behavior_table.h](#behavior_table.h) ### [enum BehaviorId](#BehaviorId) diff --git a/src/game/camera.c b/src/game/camera.c index f968cf732..9d622068e 100644 --- a/src/game/camera.c +++ b/src/game/camera.c @@ -32,6 +32,7 @@ #include "pc/configfile.h" #include "pc/network/network.h" #include "pc/lua/smlua_hooks.h" +#include "pc/djui/djui.h" #define CBUTTON_MASK (U_CBUTTONS | D_CBUTTONS | L_CBUTTONS | R_CBUTTONS) @@ -3050,7 +3051,7 @@ void update_lakitu(struct Camera *c) { * Gets controller input, checks for cutscenes, handles mode changes, and moves the camera */ void update_camera(struct Camera *c) { - if (gOverrideFreezeCamera) { + if (gOverrideFreezeCamera && !gDjuiInMainMenu) { return; } UNUSED u8 unused[24]; diff --git a/src/pc/controller/controller_sdl2.c b/src/pc/controller/controller_sdl2.c index b8057b4b8..c7eb3febc 100644 --- a/src/pc/controller/controller_sdl2.c +++ b/src/pc/controller/controller_sdl2.c @@ -24,6 +24,7 @@ #include "../fs/fs.h" #include "game/level_update.h" +#include "pc/lua/utils/smlua_misc_utils.h" #include "pc/djui/djui.h" #include "pc/djui/djui_hud_utils.h" @@ -168,12 +169,14 @@ static void controller_sdl_read(OSContPad *pad) { } #ifdef BETTERCAMERA - if (newcam_mouse == 1 && sCurrPlayMode != 2) { - SDL_SetRelativeMouseMode(SDL_TRUE); - ignore_lock = TRUE; - } else { - SDL_SetRelativeMouseMode(SDL_FALSE); - ignore_lock = FALSE; + if (!gDjuiHudLockMouse) { + if (newcam_mouse == 1 && (!is_game_paused() || sCurrPlayMode != 2) && !gDjuiInMainMenu) { + SDL_SetRelativeMouseMode(SDL_TRUE); + ignore_lock = true; + } else { + SDL_SetRelativeMouseMode(SDL_FALSE); + ignore_lock = false; + } } u32 mouse = SDL_GetRelativeMouseState(&mouse_x, &mouse_y); @@ -187,7 +190,7 @@ static void controller_sdl_read(OSContPad *pad) { last_mouse = (mouse_buttons ^ mouse) & mouse; mouse_buttons = mouse; #endif - if (!ignore_lock && sCurrPlayMode != 2) { + if (!ignore_lock && (!is_game_paused() || sCurrPlayMode != 2) && !gDjuiInMainMenu) { SDL_SetRelativeMouseMode(gDjuiHudLockMouse ? SDL_TRUE : SDL_FALSE); #ifndef BETTERCAMERA diff --git a/src/pc/djui/djui_hud_utils.c b/src/pc/djui/djui_hud_utils.c index d9c1efcce..2f9916d82 100644 --- a/src/pc/djui/djui_hud_utils.c +++ b/src/pc/djui/djui_hud_utils.c @@ -22,7 +22,7 @@ static enum HudUtilsResolution sResolution = RESOLUTION_DJUI; static enum DjuiFontType sFont = FONT_NORMAL; f32 gDjuiHudUtilsZ = 0; -u8 gDjuiHudLockMouse = FALSE; +u8 gDjuiHudLockMouse = false; extern ALIGNED8 const u8 texture_hud_char_camera[]; extern ALIGNED8 const u8 texture_hud_char_lakitu[]; diff --git a/src/pc/lua/smlua_constants_autogen.c b/src/pc/lua/smlua_constants_autogen.c index b68a86662..0a3f8ec97 100644 --- a/src/pc/lua/smlua_constants_autogen.c +++ b/src/pc/lua/smlua_constants_autogen.c @@ -307,6 +307,19 @@ char gSmluaConstants[] = "" "COURSE_COUNT = 25\n" "--- @type integer\n" "COURSE_MIN = 1\n" +"MAX_LOADED_GRAPH_NODES = 0x100\n" +"INSTANT_WARP_INDEX_START = 0x00\n" +"INSTANT_WARP_INDEX_STOP = 0x04\n" +"WARP_TRANSITION_FADE_FROM_COLOR = 0x00\n" +"WARP_TRANSITION_FADE_INTO_COLOR = 0x01\n" +"WARP_TRANSITION_FADE_FROM_STAR = 0x08\n" +"WARP_TRANSITION_FADE_INTO_STAR = 0x09\n" +"WARP_TRANSITION_FADE_FROM_CIRCLE = 0x0A\n" +"WARP_TRANSITION_FADE_INTO_CIRCLE = 0x0B\n" +"WARP_TRANSITION_FADE_FROM_MARIO = 0x10\n" +"WARP_TRANSITION_FADE_INTO_MARIO = 0x11\n" +"WARP_TRANSITION_FADE_FROM_BOWSER = 0x12\n" +"WARP_TRANSITION_FADE_INTO_BOWSER = 0x13\n" "id_bhv1Up = 0\n" "id_bhv1upJumpOnApproach = 1\n" "id_bhv1upRunningAway = 2\n" diff --git a/src/pc/network/network.c b/src/pc/network/network.c index 6f83aff23..c765a5b81 100644 --- a/src/pc/network/network.c +++ b/src/pc/network/network.c @@ -11,11 +11,13 @@ #include "pc/configfile.h" #include "pc/cheats.h" #include "pc/djui/djui.h" +#include "pc/djui/djui_hud_utils.h" #include "pc/utils/misc.h" #include "pc/lua/smlua.h" #include "pc/mods/mods.h" #include "pc/crash_handler.h" #include "pc/debuglog.h" +#include "game/camera.h" // Mario 64 specific externs extern s16 sCurrPlayMode; @@ -460,6 +462,8 @@ void network_shutdown(bool sendLeaving, bool exiting) { // reset other stuff extern u8* gOverrideEeprom; gOverrideEeprom = NULL; + gOverrideFreezeCamera = false; + gDjuiHudLockMouse = false; dynos_mod_shutdown(); mods_clear(&gActiveMods); mods_clear(&gRemoteMods);