diff --git a/autogen/lua_definitions/functions.lua b/autogen/lua_definitions/functions.lua index 1fa36fd9..8ae4e10c 100644 --- a/autogen/lua_definitions/functions.lua +++ b/autogen/lua_definitions/functions.lua @@ -8359,6 +8359,12 @@ function allocate_mario_action(actFlags) -- ... end +--- @param allow integer +--- @return nil +function camera_allow_toxic_gas_camera(allow) + -- ... +end + --- @param enable boolean --- @return nil function camera_config_enable_analog_cam(enable) diff --git a/docs/lua/functions-5.md b/docs/lua/functions-5.md index 539b170a..c1af7501 100644 --- a/docs/lua/functions-5.md +++ b/docs/lua/functions-5.md @@ -54,6 +54,26 @@
+## [camera_allow_toxic_gas_camera](#camera_allow_toxic_gas_camera) + +### Lua Example +`camera_allow_toxic_gas_camera(allow)` + +### Parameters +| Field | Type | +| ----- | ---- | +| allow | `integer` | + +### Returns +- None + +### C Prototype +`void camera_allow_toxic_gas_camera(u8 allow);` + +[:arrow_up_small:](#) + +
+ ## [camera_config_enable_analog_cam](#camera_config_enable_analog_cam) ### Lua Example diff --git a/docs/lua/functions.md b/docs/lua/functions.md index 186d33d5..a45471db 100644 --- a/docs/lua/functions.md +++ b/docs/lua/functions.md @@ -1560,6 +1560,7 @@ - smlua_misc_utils.h - [add_scroll_target](functions-5.md#add_scroll_target) - [allocate_mario_action](functions-5.md#allocate_mario_action) + - [camera_allow_toxic_gas_camera](functions-5.md#camera_allow_toxic_gas_camera) - [camera_config_enable_analog_cam](functions-5.md#camera_config_enable_analog_cam) - [camera_config_enable_free_cam](functions-5.md#camera_config_enable_free_cam) - [camera_config_enable_mouse_look](functions-5.md#camera_config_enable_mouse_look) diff --git a/src/game/camera.c b/src/game/camera.c index bcdeb8e5..b96fb212 100644 --- a/src/game/camera.c +++ b/src/game/camera.c @@ -42,6 +42,7 @@ u8 gCameraUseCourseSpecificSettings = TRUE; u8 gOverrideFreezeCamera = FALSE; enum RomhackCameraOverride gOverrideRomhackCamera = RCO_ALL; u8 gRomhackCameraAllowCentering = TRUE; +u8 gOverrideAllowToxicGasCamera = FALSE; /** * @file camera.c @@ -2366,10 +2367,12 @@ s16 update_default_camera(struct Camera *c) { } // Make Lakitu fly above the gas - gasHeight = find_poison_gas_level(cPos[0], cPos[2]); - if (gasHeight != gLevelValues.floorLowerLimit) { - if ((gasHeight += 130.f) > c->pos[1]) { - c->pos[1] = gasHeight; + if (gOverrideAllowToxicGasCamera || dynos_level_is_vanilla_level(gCurrLevelNum)) { + gasHeight = find_poison_gas_level(cPos[0], cPos[2]); + if (gasHeight != gLevelValues.floorLowerLimit) { + if ((gasHeight += 130.f) > c->pos[1]) { + c->pos[1] = gasHeight; + } } } diff --git a/src/game/camera.h b/src/game/camera.h index 21ccbb73..07d1fd7f 100644 --- a/src/game/camera.h +++ b/src/game/camera.h @@ -19,6 +19,7 @@ enum RomhackCameraOverride { extern u8 gOverrideFreezeCamera; extern enum RomhackCameraOverride gOverrideRomhackCamera; extern u8 gRomhackCameraAllowCentering; +extern u8 gOverrideAllowToxicGasCamera; /** * @file camera.h diff --git a/src/pc/lua/smlua_functions_autogen.c b/src/pc/lua/smlua_functions_autogen.c index a97eaa5f..ef5c0031 100644 --- a/src/pc/lua/smlua_functions_autogen.c +++ b/src/pc/lua/smlua_functions_autogen.c @@ -27767,6 +27767,23 @@ int smlua_func_allocate_mario_action(lua_State* L) { return 1; } +int smlua_func_camera_allow_toxic_gas_camera(lua_State* L) { + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 1) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "camera_allow_toxic_gas_camera", 1, top); + return 0; + } + + u8 allow = smlua_to_integer(L, 1); + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "camera_allow_toxic_gas_camera"); return 0; } + + camera_allow_toxic_gas_camera(allow); + + return 1; +} + int smlua_func_camera_config_enable_analog_cam(lua_State* L) { if (L == NULL) { return 0; } @@ -32070,6 +32087,7 @@ void smlua_bind_functions_autogen(void) { // smlua_misc_utils.h smlua_bind_function(L, "add_scroll_target", smlua_func_add_scroll_target); smlua_bind_function(L, "allocate_mario_action", smlua_func_allocate_mario_action); + smlua_bind_function(L, "camera_allow_toxic_gas_camera", smlua_func_camera_allow_toxic_gas_camera); smlua_bind_function(L, "camera_config_enable_analog_cam", smlua_func_camera_config_enable_analog_cam); smlua_bind_function(L, "camera_config_enable_free_cam", smlua_func_camera_config_enable_free_cam); smlua_bind_function(L, "camera_config_enable_mouse_look", smlua_func_camera_config_enable_mouse_look); diff --git a/src/pc/lua/utils/smlua_misc_utils.c b/src/pc/lua/utils/smlua_misc_utils.c index 000f129b..9bb2bb00 100644 --- a/src/pc/lua/utils/smlua_misc_utils.c +++ b/src/pc/lua/utils/smlua_misc_utils.c @@ -265,6 +265,10 @@ void camera_romhack_allow_centering(u8 allow) { gRomhackCameraAllowCentering = allow; } +void camera_allow_toxic_gas_camera(u8 allow) { + gOverrideAllowToxicGasCamera = allow; +} + bool camera_config_is_free_cam_enabled(void) { #ifdef BETTERCAMERA return sOverrideEnableCamera.override ? sOverrideEnableCamera.value : configEnableCamera; diff --git a/src/pc/lua/utils/smlua_misc_utils.h b/src/pc/lua/utils/smlua_misc_utils.h index 9d475d42..d59d0d16 100644 --- a/src/pc/lua/utils/smlua_misc_utils.h +++ b/src/pc/lua/utils/smlua_misc_utils.h @@ -48,6 +48,7 @@ void camera_unfreeze(void); bool camera_is_frozen(void); void camera_set_romhack_override(enum RomhackCameraOverride rco); void camera_romhack_allow_centering(u8 allow); +void camera_allow_toxic_gas_camera(u8 allow); bool camera_config_is_free_cam_enabled(void); bool camera_config_is_analog_cam_enabled(void); diff --git a/src/pc/network/network.c b/src/pc/network/network.c index 245caace..751b7f2d 100644 --- a/src/pc/network/network.c +++ b/src/pc/network/network.c @@ -660,6 +660,7 @@ void network_shutdown(bool sendLeaving, bool exiting, bool popup, bool reconnect gOverrideDialogPos = 0; gOverrideDialogColor = 0; gDialogMinWidth = 0; + gOverrideAllowToxicGasCamera = FALSE; struct Controller* cnt = gMarioStates[0].controller; cnt->rawStickX = 0;