Make custom pause menus easier to integrate

This commit is contained in:
Agent X 2025-11-15 10:33:49 -05:00
parent 89c8650091
commit 6af4e39c25
11 changed files with 1280 additions and 1108 deletions

View file

@ -93,7 +93,7 @@ override_allowed_functions = {
"src/game/object_list_processor.h": [ "set_object_respawn_info_bits" ],
"src/game/platform_displacement.h": [ "apply_platform_displacement" ],
"src/game/mario_misc.h": [ "bhv_toad.*", "bhv_unlock_door.*", "geo_get_.*_state" ],
"src/game/level_update.h": [ "level_trigger_warp", "get_painting_warp_node", "initiate_painting_warp", "warp_special", "lvl_set_current_level", "level_control_timer_running", "fade_into_special_warp", "get_instant_warp" ],
"src/game/level_update.h": [ "level_trigger_warp", "get_painting_warp_node", "initiate_painting_warp", "warp_special", "lvl_set_current_level", "level_control_timer_running", "pressed_pause", "fade_into_special_warp", "get_instant_warp", "game_pause", "game_unpause" ],
"src/game/area.h": [ "get_mario_spawn_type", "area_get_warp_node", "area_get_any_warp_node", "play_transition" ],
"src/engine/level_script.h": [ "area_create_warp_node" ],
"src/game/ingame_menu.h": [ "set_min_dialog_width", "set_dialog_override_pos", "reset_dialog_override_pos", "set_dialog_override_color", "reset_dialog_override_color", "set_menu_mode", "create_dialog_box", "create_dialog_box_with_var", "create_dialog_inverted_box", "create_dialog_box_with_response", "reset_dialog_render_state", "set_dialog_box_state", "handle_special_dialog_text" ],

View file

@ -4993,6 +4993,12 @@ function level_control_timer_running()
-- ...
end
--- @return integer
--- Checks if the start button has been pressed as well as some other conditions for opening the pause menu depending on if pause anywhere is enabled
function pressed_pause()
-- ...
end
--- @param arg integer
--- @param color integer
--- Fades into a special warp with `arg` and using `color`
@ -5041,6 +5047,16 @@ function lvl_set_current_level(param, levelNum)
-- ...
end
--- Pauses the game
function game_pause()
-- ...
end
--- Unpauses the game
function game_unpause()
-- ...
end
--- @return boolean
--- Gets whether the lighting engine has been enabled or not. It becomes enabled once a light is added or the ambient color is set
function le_is_enabled()

View file

@ -6607,6 +6607,27 @@ Returns if the level timer is running
<br />
## [pressed_pause](#pressed_pause)
### Description
Checks if the start button has been pressed as well as some other conditions for opening the pause menu depending on if pause anywhere is enabled
### Lua Example
`local integerValue = pressed_pause()`
### Parameters
- None
### Returns
- `integer`
### C Prototype
`u32 pressed_pause(void);`
[:arrow_up_small:](#)
<br />
## [fade_into_special_warp](#fade_into_special_warp)
### Description
@ -6769,556 +6790,43 @@ Sets the level number and handles the act select screen. `param` is used for ove
<br />
---
# functions from lighting_engine.h
<br />
## [le_is_enabled](#le_is_enabled)
## [game_pause](#game_pause)
### Description
Gets whether the lighting engine has been enabled or not. It becomes enabled once a light is added or the ambient color is set
Pauses the game
### Lua Example
`local booleanValue = le_is_enabled()`
`game_pause()`
### Parameters
- None
### Returns
- `boolean`
### C Prototype
`bool le_is_enabled(void);`
[:arrow_up_small:](#)
<br />
## [le_set_mode](#le_set_mode)
### Description
Sets the lighting engine mode to `mode`
### Lua Example
`le_set_mode(mode)`
### Parameters
| Field | Type |
| ----- | ---- |
| mode | [enum LEMode](constants.md#enum-LEMode) |
### Returns
- None
### C Prototype
`void le_set_mode(enum LEMode mode);`
`void game_pause(void);`
[:arrow_up_small:](#)
<br />
## [le_get_mode](#le_get_mode)
## [game_unpause](#game_unpause)
### Description
Gets the lighting engine mode
Unpauses the game
### Lua Example
`local enumValue = le_get_mode()`
`game_unpause()`
### Parameters
- None
### Returns
[enum LEMode](constants.md#enum-LEMode)
### C Prototype
`enum LEMode le_get_mode(void);`
[:arrow_up_small:](#)
<br />
## [le_set_tone_mapping](#le_set_tone_mapping)
### Description
Sets the lighting engine's tone mapping mode to `toneMapping`
### Lua Example
`le_set_tone_mapping(toneMapping)`
### Parameters
| Field | Type |
| ----- | ---- |
| toneMapping | [enum LEToneMapping](constants.md#enum-LEToneMapping) |
### Returns
- None
### C Prototype
`void le_set_tone_mapping(enum LEToneMapping toneMapping);`
[:arrow_up_small:](#)
<br />
## [le_get_ambient_color](#le_get_ambient_color)
### Description
Outputs the lighting engine's ambient color to `out`
### Lua Example
`le_get_ambient_color(out)`
### Parameters
| Field | Type |
| ----- | ---- |
| out | [Color](structs.md#Color) |
### Returns
- None
### C Prototype
`void le_get_ambient_color(OUT Color out);`
[:arrow_up_small:](#)
<br />
## [le_set_ambient_color](#le_set_ambient_color)
### Description
Sets the lighting engine ambient color
### Lua Example
`le_set_ambient_color(r, g, b)`
### Parameters
| Field | Type |
| ----- | ---- |
| r | `integer` |
| g | `integer` |
| b | `integer` |
### Returns
- None
### C Prototype
`void le_set_ambient_color(u8 r, u8 g, u8 b);`
[:arrow_up_small:](#)
<br />
## [le_calculate_lighting_color](#le_calculate_lighting_color)
### Description
Calculates the lighting with `lightIntensityScalar` at a position and outputs the color in `out`
### Lua Example
`le_calculate_lighting_color(pos, out, lightIntensityScalar)`
### Parameters
| Field | Type |
| ----- | ---- |
| pos | [Vec3f](structs.md#Vec3f) |
| out | [Color](structs.md#Color) |
| lightIntensityScalar | `number` |
### Returns
- None
### C Prototype
`void le_calculate_lighting_color(Vec3f pos, OUT Color out, f32 lightIntensityScalar);`
[:arrow_up_small:](#)
<br />
## [le_calculate_lighting_color_with_normal](#le_calculate_lighting_color_with_normal)
### Description
Calculates the lighting with `lightIntensityScalar` at a position and with a normal and outputs the color in `out`
### Lua Example
`le_calculate_lighting_color_with_normal(pos, normal, out, lightIntensityScalar)`
### Parameters
| Field | Type |
| ----- | ---- |
| pos | [Vec3f](structs.md#Vec3f) |
| normal | [Vec3f](structs.md#Vec3f) |
| out | [Color](structs.md#Color) |
| lightIntensityScalar | `number` |
### Returns
- None
### C Prototype
`void le_calculate_lighting_color_with_normal(Vec3f pos, Vec3f normal, OUT Color out, f32 lightIntensityScalar);`
[:arrow_up_small:](#)
<br />
## [le_calculate_lighting_dir](#le_calculate_lighting_dir)
### Description
Calculates the lighting direction from a position and outputs the result in `out`
### Lua Example
`le_calculate_lighting_dir(pos, out)`
### Parameters
| Field | Type |
| ----- | ---- |
| pos | [Vec3f](structs.md#Vec3f) |
| out | [Vec3f](structs.md#Vec3f) |
### Returns
- None
### C Prototype
`void le_calculate_lighting_dir(Vec3f pos, OUT Vec3f out);`
[:arrow_up_small:](#)
<br />
## [le_add_light](#le_add_light)
### Description
Adds a lighting engine point light at `x`, `y`, `z` with color `r`, `g`, `b` and `radius` with `intensity`
### Lua Example
`local integerValue = le_add_light(x, y, z, r, g, b, radius, intensity)`
### Parameters
| Field | Type |
| ----- | ---- |
| x | `number` |
| y | `number` |
| z | `number` |
| r | `integer` |
| g | `integer` |
| b | `integer` |
| radius | `number` |
| intensity | `number` |
### Returns
- `integer`
### C Prototype
`s16 le_add_light(f32 x, f32 y, f32 z, u8 r, u8 g, u8 b, f32 radius, f32 intensity);`
[:arrow_up_small:](#)
<br />
## [le_remove_light](#le_remove_light)
### Description
Removes a lighting engine point light corresponding to `id`
### Lua Example
`le_remove_light(id)`
### Parameters
| Field | Type |
| ----- | ---- |
| id | `integer` |
### Returns
- None
### C Prototype
`void le_remove_light(s16 id);`
[:arrow_up_small:](#)
<br />
## [le_get_light_count](#le_get_light_count)
### Description
Gets the total number of lights currently loaded in the lighting engine
### Lua Example
`local integerValue = le_get_light_count()`
### Parameters
- None
### Returns
- `integer`
### C Prototype
`s16 le_get_light_count(void);`
[:arrow_up_small:](#)
<br />
## [le_light_exists](#le_light_exists)
### Description
Checks if a lighting engine point light corresponding to `id` exists
### Lua Example
`local booleanValue = le_light_exists(id)`
### Parameters
| Field | Type |
| ----- | ---- |
| id | `integer` |
### Returns
- `boolean`
### C Prototype
`bool le_light_exists(s16 id);`
[:arrow_up_small:](#)
<br />
## [le_get_light_pos](#le_get_light_pos)
### Description
Outputs a lighting engine point light's position to `out`
### Lua Example
`le_get_light_pos(id, out)`
### Parameters
| Field | Type |
| ----- | ---- |
| id | `integer` |
| out | [Vec3f](structs.md#Vec3f) |
### Returns
- None
### C Prototype
`void le_get_light_pos(s16 id, OUT Vec3f out);`
[:arrow_up_small:](#)
<br />
## [le_set_light_pos](#le_set_light_pos)
### Description
Sets a lighting engine point light's position to `x`, `y`, `z`
### Lua Example
`le_set_light_pos(id, x, y, z)`
### Parameters
| Field | Type |
| ----- | ---- |
| id | `integer` |
| x | `number` |
| y | `number` |
| z | `number` |
### Returns
- None
### C Prototype
`void le_set_light_pos(s16 id, f32 x, f32 y, f32 z);`
[:arrow_up_small:](#)
<br />
## [le_get_light_color](#le_get_light_color)
### Description
Outputs a lighting engine point light's color to `out`
### Lua Example
`le_get_light_color(id, out)`
### Parameters
| Field | Type |
| ----- | ---- |
| id | `integer` |
| out | [Color](structs.md#Color) |
### Returns
- None
### C Prototype
`void le_get_light_color(s16 id, OUT Color out);`
[:arrow_up_small:](#)
<br />
## [le_set_light_color](#le_set_light_color)
### Description
Sets a lighting engine point light's color to `r`, `g`, `b`
### Lua Example
`le_set_light_color(id, r, g, b)`
### Parameters
| Field | Type |
| ----- | ---- |
| id | `integer` |
| r | `integer` |
| g | `integer` |
| b | `integer` |
### Returns
- None
### C Prototype
`void le_set_light_color(s16 id, u8 r, u8 g, u8 b);`
[:arrow_up_small:](#)
<br />
## [le_get_light_radius](#le_get_light_radius)
### Description
Gets a lighting engine point light's `radius`
### Lua Example
`local numberValue = le_get_light_radius(id)`
### Parameters
| Field | Type |
| ----- | ---- |
| id | `integer` |
### Returns
- `number`
### C Prototype
`f32 le_get_light_radius(s16 id);`
[:arrow_up_small:](#)
<br />
## [le_set_light_radius](#le_set_light_radius)
### Description
Sets a lighting engine point light's `radius`
### Lua Example
`le_set_light_radius(id, radius)`
### Parameters
| Field | Type |
| ----- | ---- |
| id | `integer` |
| radius | `number` |
### Returns
- None
### C Prototype
`void le_set_light_radius(s16 id, f32 radius);`
[:arrow_up_small:](#)
<br />
## [le_get_light_intensity](#le_get_light_intensity)
### Description
Gets a lighting engine point light's `intensity`
### Lua Example
`local numberValue = le_get_light_intensity(id)`
### Parameters
| Field | Type |
| ----- | ---- |
| id | `integer` |
### Returns
- `number`
### C Prototype
`f32 le_get_light_intensity(s16 id);`
[:arrow_up_small:](#)
<br />
## [le_set_light_intensity](#le_set_light_intensity)
### Description
Sets a lighting engine point light's `intensity`
### Lua Example
`le_set_light_intensity(id, intensity)`
### Parameters
| Field | Type |
| ----- | ---- |
| id | `integer` |
| intensity | `number` |
### Returns
- None
### C Prototype
`void le_set_light_intensity(s16 id, f32 intensity);`
[:arrow_up_small:](#)
<br />
## [le_get_light_use_surface_normals](#le_get_light_use_surface_normals)
### Description
Gets whether a lighting engine point light will use a surface's normals to determine its brightness with `useSurfaceNormals`
### Lua Example
`local booleanValue = le_get_light_use_surface_normals(id)`
### Parameters
| Field | Type |
| ----- | ---- |
| id | `integer` |
### Returns
- `boolean`
### C Prototype
`bool le_get_light_use_surface_normals(s16 id);`
[:arrow_up_small:](#)
<br />
## [le_set_light_use_surface_normals](#le_set_light_use_surface_normals)
### Description
Sets whether a lighting engine point light will use a surface's normals to determine its brightness with `useSurfaceNormals`
### Lua Example
`le_set_light_use_surface_normals(id, useSurfaceNormals)`
### Parameters
| Field | Type |
| ----- | ---- |
| id | `integer` |
| useSurfaceNormals | `boolean` |
### Returns
- None
### C Prototype
`void le_set_light_use_surface_normals(s16 id, bool useSurfaceNormals);`
`void game_unpause(void);`
[:arrow_up_small:](#)

File diff suppressed because it is too large Load diff

View file

@ -5,6 +5,545 @@
[< prev](functions-4.md) | [1](functions.md) | [2](functions-2.md) | [3](functions-3.md) | [4](functions-4.md) | 5 | [6](functions-6.md) | [7](functions-7.md) | [next >](functions-6.md)]
---
# functions from math_util_vec3s.inl
<br />
## [vec3s_zero](#vec3s_zero)
### Description
Sets the components of the 3D short integer vector `v` to 0
### Lua Example
`local Vec3sValue = vec3s_zero(v)`
### Parameters
| Field | Type |
| ----- | ---- |
| v | [Vec3s](structs.md#Vec3s) |
### Returns
[Vec3s](structs.md#Vec3s)
### C Prototype
`Vec3sp vec3s_zero(OUT Vec3s v);`
[:arrow_up_small:](#)
<br />
## [vec3s_copy](#vec3s_copy)
### Description
Copies the contents of a 3D short integer vector (`src`) into another 3D short integer vector (`dest`)
### Lua Example
`local Vec3sValue = vec3s_copy(dest, src)`
### Parameters
| Field | Type |
| ----- | ---- |
| dest | [Vec3s](structs.md#Vec3s) |
| src | [Vec3s](structs.md#Vec3s) |
### Returns
[Vec3s](structs.md#Vec3s)
### C Prototype
`Vec3sp vec3s_copy(OUT Vec3s dest, Vec3s src);`
[:arrow_up_small:](#)
<br />
## [vec3s_set](#vec3s_set)
### Description
Sets the values of the 3D short integer vector `dest` to the given x, y, and z values
### Lua Example
`local Vec3sValue = vec3s_set(dest, x, y, z)`
### Parameters
| Field | Type |
| ----- | ---- |
| dest | [Vec3s](structs.md#Vec3s) |
| x | `integer` |
| y | `integer` |
| z | `integer` |
### Returns
[Vec3s](structs.md#Vec3s)
### C Prototype
`Vec3sp vec3s_set(OUT Vec3s dest, s16 x, s16 y, s16 z);`
[:arrow_up_small:](#)
<br />
## [vec3s_add](#vec3s_add)
### Description
Adds the components of the 3D short integer vector `a` to `dest`
### Lua Example
`local Vec3sValue = vec3s_add(dest, a)`
### Parameters
| Field | Type |
| ----- | ---- |
| dest | [Vec3s](structs.md#Vec3s) |
| a | [Vec3s](structs.md#Vec3s) |
### Returns
[Vec3s](structs.md#Vec3s)
### C Prototype
`Vec3sp vec3s_add(OUT Vec3s dest, Vec3s a);`
[:arrow_up_small:](#)
<br />
## [vec3s_sum](#vec3s_sum)
### Description
Adds the components of two 3D short integer vectors `a` and `b` and stores the result in `dest`
### Lua Example
`local Vec3sValue = vec3s_sum(dest, a, b)`
### Parameters
| Field | Type |
| ----- | ---- |
| dest | [Vec3s](structs.md#Vec3s) |
| a | [Vec3s](structs.md#Vec3s) |
| b | [Vec3s](structs.md#Vec3s) |
### Returns
[Vec3s](structs.md#Vec3s)
### C Prototype
`Vec3sp vec3s_sum(OUT Vec3s dest, Vec3s a, Vec3s b);`
[:arrow_up_small:](#)
<br />
## [vec3s_sub](#vec3s_sub)
### Description
Subtracts the components of the 3D short integer vector `a` from `dest`
### Lua Example
`local Vec3sValue = vec3s_sub(dest, a)`
### Parameters
| Field | Type |
| ----- | ---- |
| dest | [Vec3s](structs.md#Vec3s) |
| a | [Vec3s](structs.md#Vec3s) |
### Returns
[Vec3s](structs.md#Vec3s)
### C Prototype
`Vec3sp vec3s_sub(OUT Vec3s dest, Vec3s a);`
[:arrow_up_small:](#)
<br />
## [vec3s_dif](#vec3s_dif)
### Description
Subtracts the components of the 3D short integer vector `b` from the components of `a` and stores the result in `dest`
### Lua Example
`local Vec3sValue = vec3s_dif(dest, a, b)`
### Parameters
| Field | Type |
| ----- | ---- |
| dest | [Vec3s](structs.md#Vec3s) |
| a | [Vec3s](structs.md#Vec3s) |
| b | [Vec3s](structs.md#Vec3s) |
### Returns
[Vec3s](structs.md#Vec3s)
### C Prototype
`Vec3sp vec3s_dif(OUT Vec3s dest, Vec3s a, Vec3s b);`
[:arrow_up_small:](#)
<br />
## [vec3s_mul](#vec3s_mul)
### Description
Multiplies each component of the 3D short integer vector `dest` by the scalar value `a`
### Lua Example
`local Vec3sValue = vec3s_mul(dest, a)`
### Parameters
| Field | Type |
| ----- | ---- |
| dest | [Vec3s](structs.md#Vec3s) |
| a | `number` |
### Returns
[Vec3s](structs.md#Vec3s)
### C Prototype
`Vec3sp vec3s_mul(OUT Vec3s dest, f32 a);`
[:arrow_up_small:](#)
<br />
## [vec3s_mult](#vec3s_mult)
### Description
Multiplies the components of the 3D short integer vector `dest` with the components of `a`
### Lua Example
`local Vec3sValue = vec3s_mult(dest, a)`
### Parameters
| Field | Type |
| ----- | ---- |
| dest | [Vec3s](structs.md#Vec3s) |
| a | [Vec3s](structs.md#Vec3s) |
### Returns
[Vec3s](structs.md#Vec3s)
### C Prototype
`Vec3sp vec3s_mult(OUT Vec3s dest, Vec3s a);`
[:arrow_up_small:](#)
<br />
## [vec3s_prod](#vec3s_prod)
### Description
Multiplies the components of two 3D short integer vectors `a` and `b` and stores the result in `dest`
### Lua Example
`local Vec3sValue = vec3s_prod(dest, a, b)`
### Parameters
| Field | Type |
| ----- | ---- |
| dest | [Vec3s](structs.md#Vec3s) |
| a | [Vec3s](structs.md#Vec3s) |
| b | [Vec3s](structs.md#Vec3s) |
### Returns
[Vec3s](structs.md#Vec3s)
### C Prototype
`Vec3sp vec3s_prod(OUT Vec3s dest, Vec3s a, Vec3s b);`
[:arrow_up_small:](#)
<br />
## [vec3s_div](#vec3s_div)
### Description
Divides each component of the 3D short integer vector `dest` by the scalar value `a`
### Lua Example
`local Vec3sValue = vec3s_div(dest, a)`
### Parameters
| Field | Type |
| ----- | ---- |
| dest | [Vec3s](structs.md#Vec3s) |
| a | `number` |
### Returns
[Vec3s](structs.md#Vec3s)
### C Prototype
`Vec3sp vec3s_div(OUT Vec3s dest, f32 a);`
[:arrow_up_small:](#)
<br />
## [vec3s_length](#vec3s_length)
### Description
Calculates the length (magnitude) of the 3D short integer vector `a`
### Lua Example
`local numberValue = vec3s_length(a)`
### Parameters
| Field | Type |
| ----- | ---- |
| a | [Vec3s](structs.md#Vec3s) |
### Returns
- `number`
### C Prototype
`f32 vec3s_length(Vec3s a);`
[:arrow_up_small:](#)
<br />
## [vec3s_normalize](#vec3s_normalize)
### Description
Normalizes the 3D short integer vector `v` so that its length (magnitude) becomes 1, while retaining its direction
### Lua Example
`local Vec3sValue = vec3s_normalize(v)`
### Parameters
| Field | Type |
| ----- | ---- |
| v | [Vec3s](structs.md#Vec3s) |
### Returns
[Vec3s](structs.md#Vec3s)
### C Prototype
`Vec3sp vec3s_normalize(OUT Vec3s v);`
[:arrow_up_small:](#)
<br />
## [vec3s_set_magnitude](#vec3s_set_magnitude)
### Description
Sets the length (magnitude) of 3D short integer vector `v`, while retaining its direction
### Lua Example
`local Vec3sValue = vec3s_set_magnitude(v, mag)`
### Parameters
| Field | Type |
| ----- | ---- |
| v | [Vec3s](structs.md#Vec3s) |
| mag | `number` |
### Returns
[Vec3s](structs.md#Vec3s)
### C Prototype
`Vec3sp vec3s_set_magnitude(OUT Vec3s v, f32 mag);`
[:arrow_up_small:](#)
<br />
## [vec3s_dot](#vec3s_dot)
### Description
Computes the dot product of the two 3D short integer vectors `a` and `b`
### Lua Example
`local numberValue = vec3s_dot(a, b)`
### Parameters
| Field | Type |
| ----- | ---- |
| a | [Vec3s](structs.md#Vec3s) |
| b | [Vec3s](structs.md#Vec3s) |
### Returns
- `number`
### C Prototype
`f32 vec3s_dot(Vec3s a, Vec3s b);`
[:arrow_up_small:](#)
<br />
## [vec3s_cross](#vec3s_cross)
### Description
Computes the cross product of two 3D short integer vectors `a` and `b` and stores the result in `dest`
### Lua Example
`local Vec3sValue = vec3s_cross(dest, a, b)`
### Parameters
| Field | Type |
| ----- | ---- |
| dest | [Vec3s](structs.md#Vec3s) |
| a | [Vec3s](structs.md#Vec3s) |
| b | [Vec3s](structs.md#Vec3s) |
### Returns
[Vec3s](structs.md#Vec3s)
### C Prototype
`Vec3sp vec3s_cross(OUT Vec3s dest, Vec3s a, Vec3s b);`
[:arrow_up_small:](#)
<br />
## [vec3s_combine](#vec3s_combine)
### Description
Takes two 3D short integer vectors `vecA` and `vecB`, multiplies them by `sclA` and `sclB` respectively, adds the scaled vectors together and stores the result in `dest`
### Lua Example
`local Vec3sValue = vec3s_combine(dest, vecA, vecB, sclA, sclB)`
### Parameters
| Field | Type |
| ----- | ---- |
| dest | [Vec3s](structs.md#Vec3s) |
| vecA | [Vec3s](structs.md#Vec3s) |
| vecB | [Vec3s](structs.md#Vec3s) |
| sclA | `number` |
| sclB | `number` |
### Returns
[Vec3s](structs.md#Vec3s)
### C Prototype
`Vec3sp vec3s_combine(OUT Vec3s dest, Vec3s vecA, Vec3s vecB, f32 sclA, f32 sclB);`
[:arrow_up_small:](#)
<br />
## [vec3s_dist](#vec3s_dist)
### Description
Calculates the distance between two 3D short integer vectors `v1` and `v2`
### Lua Example
`local numberValue = vec3s_dist(v1, v2)`
### Parameters
| Field | Type |
| ----- | ---- |
| v1 | [Vec3s](structs.md#Vec3s) |
| v2 | [Vec3s](structs.md#Vec3s) |
### Returns
- `number`
### C Prototype
`f32 vec3s_dist(Vec3s v1, Vec3s v2);`
[:arrow_up_small:](#)
<br />
## [vec3s_hdist](#vec3s_hdist)
### Description
Calculates the horizontal distance between two 3D short integer vectors `v1` and `v2`, as if their y component was 0
### Lua Example
`local numberValue = vec3s_hdist(v1, v2)`
### Parameters
| Field | Type |
| ----- | ---- |
| v1 | [Vec3s](structs.md#Vec3s) |
| v2 | [Vec3s](structs.md#Vec3s) |
### Returns
- `number`
### C Prototype
`f32 vec3s_hdist(Vec3s v1, Vec3s v2);`
[:arrow_up_small:](#)
<br />
## [vec3s_is_zero](#vec3s_is_zero)
### Description
Returns `true` if all components of the 3D short integer vector `v` are zero
### Lua Example
`local booleanValue = vec3s_is_zero(v)`
### Parameters
| Field | Type |
| ----- | ---- |
| v | [Vec3s](structs.md#Vec3s) |
### Returns
- `boolean`
### C Prototype
`bool vec3s_is_zero(Vec3s v);`
[:arrow_up_small:](#)
<br />
## [vec3s_to_vec3f](#vec3s_to_vec3f)
### Description
Converts a 3D short integer vector `a` into a 3D floating-point vector and stores the result in `dest`
### Lua Example
`local Vec3fValue = vec3s_to_vec3f(dest, a)`
### Parameters
| Field | Type |
| ----- | ---- |
| dest | [Vec3f](structs.md#Vec3f) |
| a | [Vec3s](structs.md#Vec3s) |
### Returns
[Vec3f](structs.md#Vec3f)
### C Prototype
`Vec3fp vec3s_to_vec3f(OUT Vec3f dest, Vec3s a);`
[:arrow_up_small:](#)
<br />
## [vec3s_to_vec3i](#vec3s_to_vec3i)
### Description
Converts a 3D short integer vector `a` into a 3D integer vector and stores the result in `dest`
### Lua Example
`local Vec3iValue = vec3s_to_vec3i(dest, a)`
### Parameters
| Field | Type |
| ----- | ---- |
| dest | [Vec3i](structs.md#Vec3i) |
| a | [Vec3s](structs.md#Vec3s) |
### Returns
[Vec3i](structs.md#Vec3i)
### C Prototype
`Vec3ip vec3s_to_vec3i(OUT Vec3i dest, Vec3s a);`
[:arrow_up_small:](#)
<br />
---
# functions from misc.h

View file

@ -957,6 +957,7 @@
- level_update.h
- [level_control_timer_running](functions-3.md#level_control_timer_running)
- [pressed_pause](functions-3.md#pressed_pause)
- [fade_into_special_warp](functions-3.md#fade_into_special_warp)
- [get_instant_warp](functions-3.md#get_instant_warp)
- [get_painting_warp_node](functions-3.md#get_painting_warp_node)
@ -964,33 +965,35 @@
- [level_trigger_warp](functions-3.md#level_trigger_warp)
- [warp_special](functions-3.md#warp_special)
- [lvl_set_current_level](functions-3.md#lvl_set_current_level)
- [game_pause](functions-3.md#game_pause)
- [game_unpause](functions-3.md#game_unpause)
<br />
- lighting_engine.h
- [le_is_enabled](functions-3.md#le_is_enabled)
- [le_set_mode](functions-3.md#le_set_mode)
- [le_get_mode](functions-3.md#le_get_mode)
- [le_set_tone_mapping](functions-3.md#le_set_tone_mapping)
- [le_get_ambient_color](functions-3.md#le_get_ambient_color)
- [le_set_ambient_color](functions-3.md#le_set_ambient_color)
- [le_calculate_lighting_color](functions-3.md#le_calculate_lighting_color)
- [le_calculate_lighting_color_with_normal](functions-3.md#le_calculate_lighting_color_with_normal)
- [le_calculate_lighting_dir](functions-3.md#le_calculate_lighting_dir)
- [le_add_light](functions-3.md#le_add_light)
- [le_remove_light](functions-3.md#le_remove_light)
- [le_get_light_count](functions-3.md#le_get_light_count)
- [le_light_exists](functions-3.md#le_light_exists)
- [le_get_light_pos](functions-3.md#le_get_light_pos)
- [le_set_light_pos](functions-3.md#le_set_light_pos)
- [le_get_light_color](functions-3.md#le_get_light_color)
- [le_set_light_color](functions-3.md#le_set_light_color)
- [le_get_light_radius](functions-3.md#le_get_light_radius)
- [le_set_light_radius](functions-3.md#le_set_light_radius)
- [le_get_light_intensity](functions-3.md#le_get_light_intensity)
- [le_set_light_intensity](functions-3.md#le_set_light_intensity)
- [le_get_light_use_surface_normals](functions-3.md#le_get_light_use_surface_normals)
- [le_set_light_use_surface_normals](functions-3.md#le_set_light_use_surface_normals)
- [le_is_enabled](functions-4.md#le_is_enabled)
- [le_set_mode](functions-4.md#le_set_mode)
- [le_get_mode](functions-4.md#le_get_mode)
- [le_set_tone_mapping](functions-4.md#le_set_tone_mapping)
- [le_get_ambient_color](functions-4.md#le_get_ambient_color)
- [le_set_ambient_color](functions-4.md#le_set_ambient_color)
- [le_calculate_lighting_color](functions-4.md#le_calculate_lighting_color)
- [le_calculate_lighting_color_with_normal](functions-4.md#le_calculate_lighting_color_with_normal)
- [le_calculate_lighting_dir](functions-4.md#le_calculate_lighting_dir)
- [le_add_light](functions-4.md#le_add_light)
- [le_remove_light](functions-4.md#le_remove_light)
- [le_get_light_count](functions-4.md#le_get_light_count)
- [le_light_exists](functions-4.md#le_light_exists)
- [le_get_light_pos](functions-4.md#le_get_light_pos)
- [le_set_light_pos](functions-4.md#le_set_light_pos)
- [le_get_light_color](functions-4.md#le_get_light_color)
- [le_set_light_color](functions-4.md#le_set_light_color)
- [le_get_light_radius](functions-4.md#le_get_light_radius)
- [le_set_light_radius](functions-4.md#le_set_light_radius)
- [le_get_light_intensity](functions-4.md#le_get_light_intensity)
- [le_set_light_intensity](functions-4.md#le_set_light_intensity)
- [le_get_light_use_surface_normals](functions-4.md#le_get_light_use_surface_normals)
- [le_set_light_use_surface_normals](functions-4.md#le_set_light_use_surface_normals)
<br />
@ -1310,28 +1313,28 @@
<br />
- math_util_vec3s.inl
- [vec3s_zero](functions-4.md#vec3s_zero)
- [vec3s_copy](functions-4.md#vec3s_copy)
- [vec3s_set](functions-4.md#vec3s_set)
- [vec3s_add](functions-4.md#vec3s_add)
- [vec3s_sum](functions-4.md#vec3s_sum)
- [vec3s_sub](functions-4.md#vec3s_sub)
- [vec3s_dif](functions-4.md#vec3s_dif)
- [vec3s_mul](functions-4.md#vec3s_mul)
- [vec3s_mult](functions-4.md#vec3s_mult)
- [vec3s_prod](functions-4.md#vec3s_prod)
- [vec3s_div](functions-4.md#vec3s_div)
- [vec3s_length](functions-4.md#vec3s_length)
- [vec3s_normalize](functions-4.md#vec3s_normalize)
- [vec3s_set_magnitude](functions-4.md#vec3s_set_magnitude)
- [vec3s_dot](functions-4.md#vec3s_dot)
- [vec3s_cross](functions-4.md#vec3s_cross)
- [vec3s_combine](functions-4.md#vec3s_combine)
- [vec3s_dist](functions-4.md#vec3s_dist)
- [vec3s_hdist](functions-4.md#vec3s_hdist)
- [vec3s_is_zero](functions-4.md#vec3s_is_zero)
- [vec3s_to_vec3f](functions-4.md#vec3s_to_vec3f)
- [vec3s_to_vec3i](functions-4.md#vec3s_to_vec3i)
- [vec3s_zero](functions-5.md#vec3s_zero)
- [vec3s_copy](functions-5.md#vec3s_copy)
- [vec3s_set](functions-5.md#vec3s_set)
- [vec3s_add](functions-5.md#vec3s_add)
- [vec3s_sum](functions-5.md#vec3s_sum)
- [vec3s_sub](functions-5.md#vec3s_sub)
- [vec3s_dif](functions-5.md#vec3s_dif)
- [vec3s_mul](functions-5.md#vec3s_mul)
- [vec3s_mult](functions-5.md#vec3s_mult)
- [vec3s_prod](functions-5.md#vec3s_prod)
- [vec3s_div](functions-5.md#vec3s_div)
- [vec3s_length](functions-5.md#vec3s_length)
- [vec3s_normalize](functions-5.md#vec3s_normalize)
- [vec3s_set_magnitude](functions-5.md#vec3s_set_magnitude)
- [vec3s_dot](functions-5.md#vec3s_dot)
- [vec3s_cross](functions-5.md#vec3s_cross)
- [vec3s_combine](functions-5.md#vec3s_combine)
- [vec3s_dist](functions-5.md#vec3s_dist)
- [vec3s_hdist](functions-5.md#vec3s_hdist)
- [vec3s_is_zero](functions-5.md#vec3s_is_zero)
- [vec3s_to_vec3f](functions-5.md#vec3s_to_vec3f)
- [vec3s_to_vec3i](functions-5.md#vec3s_to_vec3i)
<br />

View file

@ -141,6 +141,8 @@ u8 gMenuHoldKeyIndex = 0;
u8 gMenuHoldKeyTimer = 0;
s32 gDialogResponse = 0;
static bool sPauseMenuHidden = false;
#if defined(VERSION_JP) || defined(VERSION_SH) || defined(VERSION_EU)
#ifdef VERSION_EU
#define CHCACHE_BUFLEN (8 * 8) // EU only converts 8x8
@ -2029,6 +2031,14 @@ void set_menu_mode(s16 mode) {
}
}
bool get_pause_menu_hidden(void) {
return sPauseMenuHidden;
}
void set_pause_menu_hidden(bool hidden) {
sPauseMenuHidden = hidden;
}
void reset_cutscene_msg_fade(void) {
gCutsceneMsgFade = 0;
}
@ -2975,7 +2985,7 @@ s16 render_pause_courses_and_castle(void) {
}
break;
case DIALOG_STATE_VERTICAL:
if (!gDjuiPanelPauseCreated) {
if (!gDjuiPanelPauseCreated && !sPauseMenuHidden) {
shade_screen();
render_pause_my_score_coins();
render_pause_red_coins();
@ -3016,7 +3026,7 @@ s16 render_pause_courses_and_castle(void) {
}
break;
case DIALOG_STATE_HORIZONTAL:
if (!gDjuiPanelPauseCreated) {
if (!gDjuiPanelPauseCreated && !sPauseMenuHidden) {
shade_screen();
print_hud_pause_colorful_str();

View file

@ -111,6 +111,7 @@ enum DialogSpecialChars {
DIALOG_CHAR_TERMINATOR = 0xFF
};
extern s8 gDialogBoxState;
extern s32 gDialogResponse;
extern u16 gDialogColorFadeTimer;
extern s8 gLastDialogLineNum;
@ -133,6 +134,8 @@ extern u8 gDialogTextColorG;
extern u8 gDialogTextColorB;
extern u8 gDialogTextColorA;
extern s16 gMenuMode;
void create_dl_identity_matrix(void);
void create_dl_translation_matrix(s8 pushOp, f32 x, f32 y, f32 z);
void create_dl_rotation_matrix(s8 pushOp, f32 a, f32 x, f32 y, f32 z);
@ -173,6 +176,10 @@ void reset_dialog_render_state(void);
Sets the in-game menu state. 0-1 is the courses box with the castle secret stars and 2-3 is the course completion screen.
|descriptionEnd| */
void set_menu_mode(s16 mode);
/* |description|Gets if the pause menu elements are hidden, useful for creating custom pause menus|descriptionEnd| */
bool get_pause_menu_hidden(void);
/* |description|Sets if the pause menu elements are hidden, useful for creating custom pause menus|descriptionEnd| */
void set_pause_menu_hidden(bool hidden);
void reset_cutscene_msg_fade(void);
void dl_rgba16_begin_cutscene_msg_fade(void);
void dl_rgba16_stop_cutscene_msg_fade(void);

View file

@ -2033,3 +2033,21 @@ void lvl_skip_credits(void) {
gMarioStates[0].health = 0x880;
play_transition(0x09, 0x14, 0x00, 0x00, 0x00);
}
void game_pause(void) {
if (gMenuMode != -1) { return; }
lower_background_noise(1);
cancel_rumble();
gCameraMovementFlags |= CAM_MOVE_PAUSE_SCREEN;
set_play_mode(PLAY_MODE_PAUSED);
}
void game_unpause(void) {
if (gMenuMode == -1) { return; }
level_set_transition(0, NULL);
gMenuMode = -1;
gDialogBoxState = 0;
gPauseScreenMode = 1;
}

View file

@ -178,6 +178,8 @@ enum HUDDisplayFlag {
/* |description|Returns if the level timer is running|descriptionEnd| */
u8 level_control_timer_running(void);
u16 level_control_timer(s32 timerOp);
/* |description|Checks if the start button has been pressed as well as some other conditions for opening the pause menu depending on if pause anywhere is enabled|descriptionEnd|*/
u32 pressed_pause(void);
/* |description|Fades into a special warp with `arg` and using `color`|descriptionEnd| */
void fade_into_special_warp(u32 arg, u32 color);
void load_level_init_text(u32 arg);
@ -215,4 +217,9 @@ void lvl_skip_credits(void);
void update_menu_level(void);
void stop_demo(UNUSED struct DjuiBase* caller);
/* |description|Pauses the game|descriptionEnd| */
void game_pause(void);
/* |description|Unpauses the game|descriptionEnd| */
void game_unpause(void);
#endif // LEVEL_UPDATE_H

View file

@ -15468,6 +15468,21 @@ int smlua_func_level_control_timer_running(UNUSED lua_State* L) {
return 1;
}
int smlua_func_pressed_pause(UNUSED lua_State* L) {
if (L == NULL) { return 0; }
int top = lua_gettop(L);
if (top != 0) {
LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "pressed_pause", 0, top);
return 0;
}
lua_pushinteger(L, pressed_pause());
return 1;
}
int smlua_func_fade_into_special_warp(lua_State* L) {
if (L == NULL) { return 0; }
@ -15591,6 +15606,36 @@ int smlua_func_lvl_set_current_level(lua_State* L) {
return 1;
}
int smlua_func_game_pause(UNUSED lua_State* L) {
if (L == NULL) { return 0; }
int top = lua_gettop(L);
if (top != 0) {
LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "game_pause", 0, top);
return 0;
}
game_pause();
return 1;
}
int smlua_func_game_unpause(UNUSED lua_State* L) {
if (L == NULL) { return 0; }
int top = lua_gettop(L);
if (top != 0) {
LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "game_unpause", 0, top);
return 0;
}
game_unpause();
return 1;
}
///////////////////////
// lighting_engine.h //
///////////////////////
@ -37684,6 +37729,7 @@ void smlua_bind_functions_autogen(void) {
// level_update.h
smlua_bind_function(L, "level_control_timer_running", smlua_func_level_control_timer_running);
smlua_bind_function(L, "pressed_pause", smlua_func_pressed_pause);
smlua_bind_function(L, "fade_into_special_warp", smlua_func_fade_into_special_warp);
smlua_bind_function(L, "get_instant_warp", smlua_func_get_instant_warp);
smlua_bind_function(L, "get_painting_warp_node", smlua_func_get_painting_warp_node);
@ -37691,6 +37737,8 @@ void smlua_bind_functions_autogen(void) {
smlua_bind_function(L, "level_trigger_warp", smlua_func_level_trigger_warp);
smlua_bind_function(L, "warp_special", smlua_func_warp_special);
smlua_bind_function(L, "lvl_set_current_level", smlua_func_lvl_set_current_level);
smlua_bind_function(L, "game_pause", smlua_func_game_pause);
smlua_bind_function(L, "game_unpause", smlua_func_game_unpause);
// lighting_engine.h
smlua_bind_function(L, "le_is_enabled", smlua_func_le_is_enabled);