diff --git a/autogen/convert_constants.py b/autogen/convert_constants.py index 7f6681284..629a9a815 100644 --- a/autogen/convert_constants.py +++ b/autogen/convert_constants.py @@ -46,14 +46,16 @@ in_files = [ "src/game/first_person_cam.h", "src/pc/djui/djui_console.h", "src/game/player_palette.h", - "src/pc/network/lag_compensation.h" + "src/pc/network/lag_compensation.h", + "src/pc/djui/djui_panel_menu.h" ] exclude_constants = { "*": [ "^MAXCONTROLLERS$", "^AREA_[^T].*", "^AREA_T[HTO]", "^CONT_ERR.*", "^READ_MASK$", "^SIGN_RANGE$", ], "src/game/obj_behaviors.c": [ "^o$" ], "src/pc/djui/djui_console.h": [ "CONSOLE_MAX_TMP_BUFFER" ], - "src/pc/lua/smlua_hooks.h": [ "MAX_HOOKED_MOD_MENU_ELEMENTS" ] + "src/pc/lua/smlua_hooks.h": [ "MAX_HOOKED_MOD_MENU_ELEMENTS" ], + "src/pc/djui/djui_panel_menu.h": [ "RAINBOW_TEXT_LEN" ] } include_constants = { diff --git a/autogen/convert_functions.py b/autogen/convert_functions.py index f7576d7cc..a4597f02f 100644 --- a/autogen/convert_functions.py +++ b/autogen/convert_functions.py @@ -39,7 +39,7 @@ in_files = [ "src/game/save_file.h", "src/game/sound_init.h", "src/pc/djui/djui_hud_utils.h", - "src/pc/djui/djui_panel_menu.c", + "src/pc/djui/djui_panel_menu.h", "src/pc/network/network_player.h", "src/pc/network/lag_compensation.h", "include/behavior_table.h", @@ -58,7 +58,7 @@ in_files = [ "src/game/object_helpers.c", "src/game/obj_behaviors.c", "src/game/obj_behaviors_2.c", - "src/game/spawn_sound.c", + "src/game/spawn_sound.h", "src/game/object_list_processor.h", "src/game/behavior_actions.h", "src/game/mario_misc.h", @@ -74,11 +74,11 @@ in_files = [ ] override_allowed_functions = { - "src/audio/external.h": [ " play_", "fade", "current_background", "stop_", "sound_banks", "drop_queued_background_music", "sound_get_level_intensity" ], + "src/audio/external.h": [ " play_", "fade", "current_background", "stop_", "sound_banks", "drop_queued_background_music", "set_sound_moving_speed", "background_music_default_volume", "get_sound_pan", "sound_get_level_intensity", "set_audio_muted" ], "src/game/rumble_init.c": [ "queue_rumble_", "reset_rumble_timers" ], - "src/pc/djui/djui_popup.h" : [ "create" ], - "src/pc/djui/djui_language.h" : [ "djui_language_get" ], - "src/pc/djui/djui_panel_menu.c" : [ "djui_menu_get_rainbow_string_color" ], + "src/pc/djui/djui_popup.h": [ "create" ], + "src/pc/djui/djui_language.h": [ "djui_language_get" ], + "src/pc/djui/djui_panel_menu.h": [ "djui_menu_get_rainbow_string_color" ], "src/game/save_file.h": [ "save_file_get_", "save_file_set_flags", "save_file_clear_flags", "save_file_reload", "save_file_erase_current_backup_save", "save_file_set_star_flags", "save_file_is_cannon_unlocked", "touch_coin_score_age", "save_file_set_course_coin_score", "save_file_do_save", "save_file_remove_star_flags", "save_file_erase" ], "src/pc/lua/utils/smlua_model_utils.h": [ "smlua_model_util_get_id" ], "src/game/object_list_processor.h": [ "set_object_respawn_info_bits" ], @@ -114,7 +114,6 @@ override_disallowed_functions = { "src/game/object_helpers.c": [ "spawn_obj", "^bhv_", "abs[fi]", "^bit_shift", "_debug$", "^stub_", "_set_model", "cur_obj_set_direction_table", "cur_obj_progress_direction_table" ], "src/game/obj_behaviors.c": [ "debug_" ], "src/game/obj_behaviors_2.c": [ "wiggler_jumped_on_attack_handler", "huge_goomba_weakly_attacked" ], - "src/game/spawn_sound.c": [ "spawner" ], "src/game/level_info.h": [ "_name_table" ], "src/pc/lua/utils/smlua_obj_utils.h": [ "spawn_object_remember_field" ], "src/game/camera.h": [ "update_camera", "init_camera", "stub_camera", "^reset_camera", "move_point_along_spline" ], diff --git a/autogen/lua_definitions/constants.lua b/autogen/lua_definitions/constants.lua index f5f17c479..b330e9d62 100644 --- a/autogen/lua_definitions/constants.lua +++ b/autogen/lua_definitions/constants.lua @@ -3255,6 +3255,20 @@ RESOLUTION_N64 = 1 --- @type HudUtilsResolution RESOLUTION_COUNT = 2 +--- @class DjuiRainbowColor + +--- @type DjuiRainbowColor +DJUI_RAINBOW_COLOR_RED = 0 + +--- @type DjuiRainbowColor +DJUI_RAINBOW_COLOR_GREEN = 1 + +--- @type DjuiRainbowColor +DJUI_RAINBOW_COLOR_BLUE = 2 + +--- @type DjuiRainbowColor +DJUI_RAINBOW_COLOR_YELLOW = 3 + --- @type integer ENVFX_BUBBLE_START = 10 diff --git a/autogen/lua_definitions/functions.lua b/autogen/lua_definitions/functions.lua index b44d4c528..c886059d1 100644 --- a/autogen/lua_definitions/functions.lua +++ b/autogen/lua_definitions/functions.lua @@ -3944,7 +3944,7 @@ function djui_language_get(section, key) -- ... end ---- @param color integer +--- @param color DjuiRainbowColor --- @return string function djui_menu_get_rainbow_string_color(color) -- ... @@ -3957,6 +3957,7 @@ function djui_popup_create(message, lines) -- ... end +--- Drops any queued background music function drop_queued_background_music() -- ... end @@ -3964,46 +3965,62 @@ end --- @param player integer --- @param targetScale integer --- @param fadeDuration integer +--- Fades the volume of `player` to `targetScale` (0-127) over `fadeDuration` function fade_volume_scale(player, targetScale, fadeDuration) -- ... end ---- @param arg0 integer +--- @param seqId integer --- @param fadeOut integer -function fadeout_background_music(arg0, fadeOut) +--- Fades out background music `seqId` over `fadeOut` +function fadeout_background_music(seqId, fadeOut) -- ... end --- @return integer +--- Gets the current background music function get_current_background_music() -- ... end --- @return integer +--- Gets the current background music's default volume function get_current_background_music_default_volume() -- ... end --- @return integer +--- Gets the current max target volume function get_current_background_music_max_target_volume() -- ... end --- @return integer +--- Gets the current target volume function get_current_background_music_target_volume() -- ... end +--- @param x number +--- @param z number +--- @return number +function get_sound_pan(x, z) + -- ... +end + --- @return integer +--- Checks if the current background music is lowered function is_current_background_music_volume_lowered() -- ... end +--- Plays the star collect fanfare (this function's name was mixed up with the other) function play_course_clear() -- ... end --- @param dialogID integer +--- Plays a dialog sound corresponding to `dialogID` function play_dialog_sound(dialogID) -- ... end @@ -4011,23 +4028,28 @@ end --- @param player integer --- @param seqArgs integer --- @param fadeTimer integer +--- Plays fading in music (`seqArgs`) on `player` over `fadeTimer` function play_music(player, seqArgs, fadeTimer) -- ... end +--- Plays Peach's letter jingle function play_peachs_jingle() -- ... end ---- @param arg0 integer -function play_power_star_jingle(arg0) +--- @param keepBackgroundMusic integer +--- Plays the power star jingle, set `keepBackgroundMusic` to 0 to mute background music +function play_power_star_jingle(keepBackgroundMusic) -- ... end +--- Plays the puzzle jingle function play_puzzle_jingle() -- ... end +--- Plays the race fanfare when a race is started function play_race_fanfare() -- ... end @@ -4036,12 +4058,14 @@ end --- @param bgMusicVolume integer --- @param volume integer --- @param fadeTimer integer +--- Plays fading in secondary music `seqId` at `volume` over `fadeTimer` and sets the current background music's volume to `bgMusicVolume` function play_secondary_music(seqId, bgMusicVolume, volume, fadeTimer) -- ... end --- @param soundBits integer --- @param pos Vec3f +--- Plays a sound (`soundBits`) at `pos` (usually `gGlobalSoundSource` or `m.header.gfx.cameraToObject`) function play_sound(soundBits, pos) -- ... end @@ -4049,20 +4073,24 @@ end --- @param soundBits integer --- @param pos Vec3f --- @param freqScale number +--- Plays a sound (`soundBits`) with `freqScale` at `pos` (usually `gGlobalSoundSource` or `m.header.gfx.cameraToObject`) function play_sound_with_freq_scale(soundBits, pos, freqScale) -- ... end +--- Plays the course clear fanfare (this function's name was mixed up with the other) function play_star_fanfare() -- ... end +--- Plays Toad's jingle function play_toads_jingle() -- ... end --- @param player integer --- @param fadeDuration integer +--- Fades out `player` with `fadeDuration` function seq_player_fade_out(player, fadeDuration) -- ... end @@ -4070,29 +4098,47 @@ end --- @param player integer --- @param fadeDuration integer --- @param percentage integer +--- Fades the volume of `player` to `percentage` over `fadeDuration` function seq_player_lower_volume(player, fadeDuration, percentage) -- ... end --- @param player integer --- @param fadeDuration integer +--- Unfades the volume of `player` over `fadeDuration` function seq_player_unlower_volume(player, fadeDuration) -- ... end --- @param fadeOutTime integer +--- Sets the `fadeOutTime` of audio function set_audio_fadeout(fadeOutTime) -- ... end +--- @param muted integer +--- Sets the muted status of all sequence players +function set_audio_muted(muted) + -- ... +end + +--- @param bank integer +--- @param speed integer +--- Sets the `speed` of moving `bank` +function set_sound_moving_speed(bank, speed) + -- ... +end + --- @param player integer --- @param bankMask integer +--- Enables `bankMask` soundbanks in `player` function sound_banks_disable(player, bankMask) -- ... end --- @param player integer --- @param bankMask integer +--- Disables `bankMask` soundbanks in `player` function sound_banks_enable(player, bankMask) -- ... end @@ -4104,26 +4150,42 @@ function sound_get_level_intensity(distance) end --- @param seqId integer +function sound_reset_background_music_default_volume(seqId) + -- ... +end + +--- @param seqId integer +--- @param volume integer +function sound_set_background_music_default_volume(seqId, volume) + -- ... +end + +--- @param seqId integer +--- Stops background music `seqId` function stop_background_music(seqId) -- ... end --- @param fadeTimer integer +--- Fades out secondary music over `fadeTimer` function stop_secondary_music(fadeTimer) -- ... end --- @param soundBits integer --- @param pos Vec3f +--- Stops a sound (`soundBits`) at `pos` (usually `gGlobalSoundSource` or `m.header.gfx.cameraToObject`) function stop_sound(soundBits, pos) -- ... end --- @param pos Vec3f +--- Stops sounds from `pos` (usually `gGlobalSoundSource` or `m.header.gfx.cameraToObject`) function stop_sounds_from_source(pos) -- ... end +--- Stops sounds in sound banks moving, env, and air function stop_sounds_in_continuous_banks() -- ... end @@ -8406,36 +8468,42 @@ end --- @param player integer --- @return integer +--- Gets the tempo of `player` function sequence_player_get_tempo(player) -- ... end --- @param player integer --- @return integer +--- Gets the tempoAcc (tempo ???) of `player` function sequence_player_get_tempo_acc(player) -- ... end --- @param player integer --- @return integer +--- Gets the transposition (pitch) of `player` function sequence_player_get_transposition(player) -- ... end --- @param player integer --- @param tempo integer +--- Sets the `tempo` of `player`. Resets when another sequence is played function sequence_player_set_tempo(player, tempo) -- ... end --- @param player integer --- @param tempoAcc integer +--- Sets the `tempoAcc` (tempo ???) of `player`. Resets when another sequence is played function sequence_player_set_tempo_acc(player, tempoAcc) -- ... end --- @param player integer --- @param transposition integer +--- Sets the `transposition` (pitch) of `player`. Resets when another sequence is played function sequence_player_set_transposition(player, transposition) -- ... end @@ -10098,65 +10166,79 @@ function smlua_text_utils_secret_star_replace(courseNum, courseName) -- ... end +--- Disables background soundbanks function disable_background_sound() -- ... end +--- Enables background soundbanks function enable_background_sound() -- ... end +--- Fades out cap music function fadeout_cap_music() -- ... end --- @param fadeTimer integer +--- Fades out the level sequence player function fadeout_level_music(fadeTimer) -- ... end --- @param fadeOutTime integer +--- Fades out level, shell, and cap music function fadeout_music(fadeOutTime) -- ... end --- @param a integer +--- Lowers the volume of music by 40% function lower_background_noise(a) -- ... end --- @param seqArgs integer +--- Plays `seqArgs` as cap music function play_cap_music(seqArgs) -- ... end --- @param seqArgs integer +--- Plays and sets the current music to `seqArgs` function play_cutscene_music(seqArgs) -- ... end +--- Plays the infinite stairs music if you're in the endless stairs room and have less than `gLevelValues.infiniteStairsRequirement` stars function play_infinite_stairs_music() -- ... end --- @param soundMenuFlags integer +--- Play menu sounds from `SOUND_MENU_FLAG_*` constants and queues rumble if `SOUND_MENU_FLAG_LETGOMARIOFACE` is one of the flags function play_menu_sounds(soundMenuFlags) -- ... end +--- Plays the painting eject sound effect if it has not already been played function play_painting_eject_sound() -- ... end +--- Plays shell music function play_shell_music() -- ... end --- @param a integer +--- Raises music volume back up to normal levels function raise_background_noise(a) -- ... end +--- Resets if music volume has been lowered function reset_volume() -- ... end @@ -10164,36 +10246,49 @@ end --- @param a integer --- @param seqArgs integer --- @param fadeTimer integer +--- Sets the background music to `seqArgs` on sequence player `a` with a fade in time of `fadeTimer` function set_background_music(a, seqArgs, fadeTimer) -- ... end +--- Stops cap music completely function stop_cap_music() -- ... end +--- Stops shell music completely function stop_shell_music() -- ... end --- @param distance number --- @return integer +--- Unused vanilla function, calculates a volume based on `distance`. If `distance` is less than 500 then 127, if `distance` is greater than 1500 then 0, if `distance` is between 500 and 1500 then it ranges linearly from 60 to 124. What an even more strange and confusing function function calc_dist_to_volume_range_1(distance) -- ... end --- @param distance number --- @return integer +--- Unused vanilla function, calculates a volume based on `distance`. If `distance` is less than 1300 then 127, if `distance` is greater than 2300 then 0, if `distance` is between 1300 and 2300 then it ranges linearly from 60 to 127. What a strange and confusing function function calc_dist_to_volume_range_2(distance) -- ... end --- @param soundMagic integer +--- Create a sound spawner for objects that need a sound play once. (Breakable walls, King Bobomb exploding, etc) +function create_sound_spawner(soundMagic) + -- ... +end + +--- @param soundMagic integer +--- Plays a sound if the current object is visible function cur_obj_play_sound_1(soundMagic) -- ... end --- @param soundMagic integer +--- Plays a sound if the current object is visible and queues rumble for specific sounds function cur_obj_play_sound_2(soundMagic) -- ... end diff --git a/docs/lua/constants.md b/docs/lua/constants.md index 491784ea9..90cb6e76b 100644 --- a/docs/lua/constants.md +++ b/docs/lua/constants.md @@ -17,6 +17,8 @@ - [enum DjuiFontType](#enum-DjuiFontType) - [enum HudUtilsFilter](#enum-HudUtilsFilter) - [enum HudUtilsResolution](#enum-HudUtilsResolution) +- [djui_panel_menu.h](#djui_panel_menuh) + - [enum DjuiRainbowColor](#enum-DjuiRainbowColor) - [envfx_snow.h](#envfx_snowh) - [external.h](#externalh) - [enum DialogSound](#enum-DialogSound) @@ -1132,6 +1134,20 @@
+## [djui_panel_menu.h](#djui_panel_menu.h) + +### [enum DjuiRainbowColor](#DjuiRainbowColor) +| Identifier | Value | +| :--------- | :---- | +| DJUI_RAINBOW_COLOR_RED | 0 | +| DJUI_RAINBOW_COLOR_GREEN | 1 | +| DJUI_RAINBOW_COLOR_BLUE | 2 | +| DJUI_RAINBOW_COLOR_YELLOW | 3 | + +[:arrow_up_small:](#) + +
+ ## [envfx_snow.h](#envfx_snow.h) - ENVFX_BUBBLE_START - ENVFX_FLOWERS diff --git a/docs/lua/functions-3.md b/docs/lua/functions-3.md index 7e69bb97d..d144bac8e 100644 --- a/docs/lua/functions-3.md +++ b/docs/lua/functions-3.md @@ -3361,7 +3361,7 @@ Gets a language `key` from a `section`
--- -# functions from djui_panel_menu.c +# functions from djui_panel_menu.h
@@ -3374,13 +3374,13 @@ Gets a language `key` from a `section` ### Parameters | Field | Type | | ----- | ---- | -| color | `integer` | +| color | [enum DjuiRainbowColor](constants.md#enum-DjuiRainbowColor) | ### Returns - `string` ### C Prototype -`char* djui_menu_get_rainbow_string_color(int color);` +`char* djui_menu_get_rainbow_string_color(enum DjuiRainbowColor color);` [:arrow_up_small:](#) @@ -3424,6 +3424,9 @@ Creates a popup that says `message` and has `lines` ## [drop_queued_background_music](#drop_queued_background_music) +### Description +Drops any queued background music + ### Lua Example `drop_queued_background_music()` @@ -3442,6 +3445,9 @@ Creates a popup that says `message` and has `lines` ## [fade_volume_scale](#fade_volume_scale) +### Description +Fades the volume of `player` to `targetScale` (0-127) over `fadeDuration` + ### Lua Example `fade_volume_scale(player, targetScale, fadeDuration)` @@ -3464,20 +3470,23 @@ Creates a popup that says `message` and has `lines` ## [fadeout_background_music](#fadeout_background_music) +### Description +Fades out background music `seqId` over `fadeOut` + ### Lua Example -`fadeout_background_music(arg0, fadeOut)` +`fadeout_background_music(seqId, fadeOut)` ### Parameters | Field | Type | | ----- | ---- | -| arg0 | `integer` | +| seqId | `integer` | | fadeOut | `integer` | ### Returns - None ### C Prototype -`void fadeout_background_music(u16 arg0, u16 fadeOut);` +`void fadeout_background_music(u16 seqId, u16 fadeOut);` [:arrow_up_small:](#) @@ -3485,6 +3494,9 @@ Creates a popup that says `message` and has `lines` ## [get_current_background_music](#get_current_background_music) +### Description +Gets the current background music + ### Lua Example `local integerValue = get_current_background_music()` @@ -3503,6 +3515,9 @@ Creates a popup that says `message` and has `lines` ## [get_current_background_music_default_volume](#get_current_background_music_default_volume) +### Description +Gets the current background music's default volume + ### Lua Example `local integerValue = get_current_background_music_default_volume()` @@ -3521,6 +3536,9 @@ Creates a popup that says `message` and has `lines` ## [get_current_background_music_max_target_volume](#get_current_background_music_max_target_volume) +### Description +Gets the current max target volume + ### Lua Example `local integerValue = get_current_background_music_max_target_volume()` @@ -3539,6 +3557,9 @@ Creates a popup that says `message` and has `lines` ## [get_current_background_music_target_volume](#get_current_background_music_target_volume) +### Description +Gets the current target volume + ### Lua Example `local integerValue = get_current_background_music_target_volume()` @@ -3555,8 +3576,32 @@ Creates a popup that says `message` and has `lines`
+## [get_sound_pan](#get_sound_pan) + +### Lua Example +`local numberValue = get_sound_pan(x, z)` + +### Parameters +| Field | Type | +| ----- | ---- | +| x | `number` | +| z | `number` | + +### Returns +- `number` + +### C Prototype +`f32 get_sound_pan(f32 x, f32 z);` + +[:arrow_up_small:](#) + +
+ ## [is_current_background_music_volume_lowered](#is_current_background_music_volume_lowered) +### Description +Checks if the current background music is lowered + ### Lua Example `local integerValue = is_current_background_music_volume_lowered()` @@ -3575,6 +3620,9 @@ Creates a popup that says `message` and has `lines` ## [play_course_clear](#play_course_clear) +### Description +Plays the star collect fanfare (this function's name was mixed up with the other) + ### Lua Example `play_course_clear()` @@ -3593,6 +3641,9 @@ Creates a popup that says `message` and has `lines` ## [play_dialog_sound](#play_dialog_sound) +### Description +Plays a dialog sound corresponding to `dialogID` + ### Lua Example `play_dialog_sound(dialogID)` @@ -3613,6 +3664,9 @@ Creates a popup that says `message` and has `lines` ## [play_music](#play_music) +### Description +Plays fading in music (`seqArgs`) on `player` over `fadeTimer` + ### Lua Example `play_music(player, seqArgs, fadeTimer)` @@ -3635,6 +3689,9 @@ Creates a popup that says `message` and has `lines` ## [play_peachs_jingle](#play_peachs_jingle) +### Description +Plays Peach's letter jingle + ### Lua Example `play_peachs_jingle()` @@ -3653,19 +3710,22 @@ Creates a popup that says `message` and has `lines` ## [play_power_star_jingle](#play_power_star_jingle) +### Description +Plays the power star jingle, set `keepBackgroundMusic` to 0 to mute background music + ### Lua Example -`play_power_star_jingle(arg0)` +`play_power_star_jingle(keepBackgroundMusic)` ### Parameters | Field | Type | | ----- | ---- | -| arg0 | `integer` | +| keepBackgroundMusic | `integer` | ### Returns - None ### C Prototype -`void play_power_star_jingle(u8 arg0);` +`void play_power_star_jingle(u8 keepBackgroundMusic);` [:arrow_up_small:](#) @@ -3673,6 +3733,9 @@ Creates a popup that says `message` and has `lines` ## [play_puzzle_jingle](#play_puzzle_jingle) +### Description +Plays the puzzle jingle + ### Lua Example `play_puzzle_jingle()` @@ -3691,6 +3754,9 @@ Creates a popup that says `message` and has `lines` ## [play_race_fanfare](#play_race_fanfare) +### Description +Plays the race fanfare when a race is started + ### Lua Example `play_race_fanfare()` @@ -3709,6 +3775,9 @@ Creates a popup that says `message` and has `lines` ## [play_secondary_music](#play_secondary_music) +### Description +Plays fading in secondary music `seqId` at `volume` over `fadeTimer` and sets the current background music's volume to `bgMusicVolume` + ### Lua Example `play_secondary_music(seqId, bgMusicVolume, volume, fadeTimer)` @@ -3732,6 +3801,9 @@ Creates a popup that says `message` and has `lines` ## [play_sound](#play_sound) +### Description +Plays a sound (`soundBits`) at `pos` (usually `gGlobalSoundSource` or `m.header.gfx.cameraToObject`) + ### Lua Example `play_sound(soundBits, pos)` @@ -3753,6 +3825,9 @@ Creates a popup that says `message` and has `lines` ## [play_sound_with_freq_scale](#play_sound_with_freq_scale) +### Description +Plays a sound (`soundBits`) with `freqScale` at `pos` (usually `gGlobalSoundSource` or `m.header.gfx.cameraToObject`) + ### Lua Example `play_sound_with_freq_scale(soundBits, pos, freqScale)` @@ -3775,6 +3850,9 @@ Creates a popup that says `message` and has `lines` ## [play_star_fanfare](#play_star_fanfare) +### Description +Plays the course clear fanfare (this function's name was mixed up with the other) + ### Lua Example `play_star_fanfare()` @@ -3793,6 +3871,9 @@ Creates a popup that says `message` and has `lines` ## [play_toads_jingle](#play_toads_jingle) +### Description +Plays Toad's jingle + ### Lua Example `play_toads_jingle()` @@ -3811,6 +3892,9 @@ Creates a popup that says `message` and has `lines` ## [seq_player_fade_out](#seq_player_fade_out) +### Description +Fades out `player` with `fadeDuration` + ### Lua Example `seq_player_fade_out(player, fadeDuration)` @@ -3832,6 +3916,9 @@ Creates a popup that says `message` and has `lines` ## [seq_player_lower_volume](#seq_player_lower_volume) +### Description +Fades the volume of `player` to `percentage` over `fadeDuration` + ### Lua Example `seq_player_lower_volume(player, fadeDuration, percentage)` @@ -3854,6 +3941,9 @@ Creates a popup that says `message` and has `lines` ## [seq_player_unlower_volume](#seq_player_unlower_volume) +### Description +Unfades the volume of `player` over `fadeDuration` + ### Lua Example `seq_player_unlower_volume(player, fadeDuration)` @@ -3875,6 +3965,9 @@ Creates a popup that says `message` and has `lines` ## [set_audio_fadeout](#set_audio_fadeout) +### Description +Sets the `fadeOutTime` of audio + ### Lua Example `set_audio_fadeout(fadeOutTime)` @@ -3893,8 +3986,58 @@ Creates a popup that says `message` and has `lines`
+## [set_audio_muted](#set_audio_muted) + +### Description +Sets the muted status of all sequence players + +### Lua Example +`set_audio_muted(muted)` + +### Parameters +| Field | Type | +| ----- | ---- | +| muted | `integer` | + +### Returns +- None + +### C Prototype +`void set_audio_muted(u8 muted);` + +[:arrow_up_small:](#) + +
+ +## [set_sound_moving_speed](#set_sound_moving_speed) + +### Description +Sets the `speed` of moving `bank` + +### Lua Example +`set_sound_moving_speed(bank, speed)` + +### Parameters +| Field | Type | +| ----- | ---- | +| bank | `integer` | +| speed | `integer` | + +### Returns +- None + +### C Prototype +`void set_sound_moving_speed(u8 bank, u8 speed);` + +[:arrow_up_small:](#) + +
+ ## [sound_banks_disable](#sound_banks_disable) +### Description +Enables `bankMask` soundbanks in `player` + ### Lua Example `sound_banks_disable(player, bankMask)` @@ -3916,6 +4059,9 @@ Creates a popup that says `message` and has `lines` ## [sound_banks_enable](#sound_banks_enable) +### Description +Disables `bankMask` soundbanks in `player` + ### Lua Example `sound_banks_enable(player, bankMask)` @@ -3955,8 +4101,52 @@ Creates a popup that says `message` and has `lines`
+## [sound_reset_background_music_default_volume](#sound_reset_background_music_default_volume) + +### Lua Example +`sound_reset_background_music_default_volume(seqId)` + +### Parameters +| Field | Type | +| ----- | ---- | +| seqId | `integer` | + +### Returns +- None + +### C Prototype +`void sound_reset_background_music_default_volume(u8 seqId);` + +[:arrow_up_small:](#) + +
+ +## [sound_set_background_music_default_volume](#sound_set_background_music_default_volume) + +### Lua Example +`sound_set_background_music_default_volume(seqId, volume)` + +### Parameters +| Field | Type | +| ----- | ---- | +| seqId | `integer` | +| volume | `integer` | + +### Returns +- None + +### C Prototype +`void sound_set_background_music_default_volume(u8 seqId, u8 volume);` + +[:arrow_up_small:](#) + +
+ ## [stop_background_music](#stop_background_music) +### Description +Stops background music `seqId` + ### Lua Example `stop_background_music(seqId)` @@ -3977,6 +4167,9 @@ Creates a popup that says `message` and has `lines` ## [stop_secondary_music](#stop_secondary_music) +### Description +Fades out secondary music over `fadeTimer` + ### Lua Example `stop_secondary_music(fadeTimer)` @@ -3997,6 +4190,9 @@ Creates a popup that says `message` and has `lines` ## [stop_sound](#stop_sound) +### Description +Stops a sound (`soundBits`) at `pos` (usually `gGlobalSoundSource` or `m.header.gfx.cameraToObject`) + ### Lua Example `stop_sound(soundBits, pos)` @@ -4018,6 +4214,9 @@ Creates a popup that says `message` and has `lines` ## [stop_sounds_from_source](#stop_sounds_from_source) +### Description +Stops sounds from `pos` (usually `gGlobalSoundSource` or `m.header.gfx.cameraToObject`) + ### Lua Example `stop_sounds_from_source(pos)` @@ -4038,6 +4237,9 @@ Creates a popup that says `message` and has `lines` ## [stop_sounds_in_continuous_banks](#stop_sounds_in_continuous_banks) +### Description +Stops sounds in sound banks moving, env, and air + ### Lua Example `stop_sounds_in_continuous_banks()` @@ -7592,323 +7794,6 @@ Creates a warp node in the current level and area with id `id` that goes to the [:arrow_up_small:](#) -
- ---- -# functions from mario_actions_cutscene.c - -
- - -## [bhv_end_peach_loop](#bhv_end_peach_loop) - -### Lua Example -`bhv_end_peach_loop()` - -### Parameters -- None - -### Returns -- None - -### C Prototype -`void bhv_end_peach_loop(void);` - -[:arrow_up_small:](#) - -
- -## [bhv_end_toad_loop](#bhv_end_toad_loop) - -### Lua Example -`bhv_end_toad_loop()` - -### Parameters -- None - -### Returns -- None - -### C Prototype -`void bhv_end_toad_loop(void);` - -[:arrow_up_small:](#) - -
- -## [common_death_handler](#common_death_handler) - -### Lua Example -`local integerValue = common_death_handler(m, animation, frameToDeathWarp)` - -### Parameters -| Field | Type | -| ----- | ---- | -| m | [MarioState](structs.md#MarioState) | -| animation | `integer` | -| frameToDeathWarp | `integer` | - -### Returns -- `integer` - -### C Prototype -`s32 common_death_handler(struct MarioState *m, s32 animation, s32 frameToDeathWarp);` - -[:arrow_up_small:](#) - -
- -## [cutscene_put_cap_on](#cutscene_put_cap_on) - -### Lua Example -`cutscene_put_cap_on(m)` - -### Parameters -| Field | Type | -| ----- | ---- | -| m | [MarioState](structs.md#MarioState) | - -### Returns -- None - -### C Prototype -`void cutscene_put_cap_on(struct MarioState *m);` - -[:arrow_up_small:](#) - -
- -## [cutscene_take_cap_off](#cutscene_take_cap_off) - -### Lua Example -`cutscene_take_cap_off(m)` - -### Parameters -| Field | Type | -| ----- | ---- | -| m | [MarioState](structs.md#MarioState) | - -### Returns -- None - -### C Prototype -`void cutscene_take_cap_off(struct MarioState *m);` - -[:arrow_up_small:](#) - -
- -## [general_star_dance_handler](#general_star_dance_handler) - -### Lua Example -`general_star_dance_handler(m, isInWater)` - -### Parameters -| Field | Type | -| ----- | ---- | -| m | [MarioState](structs.md#MarioState) | -| isInWater | `integer` | - -### Returns -- None - -### C Prototype -`void general_star_dance_handler(struct MarioState *m, s32 isInWater);` - -[:arrow_up_small:](#) - -
- -## [generate_yellow_sparkles](#generate_yellow_sparkles) - -### Lua Example -`generate_yellow_sparkles(x, y, z, radius)` - -### Parameters -| Field | Type | -| ----- | ---- | -| x | `integer` | -| y | `integer` | -| z | `integer` | -| radius | `number` | - -### Returns -- None - -### C Prototype -`void generate_yellow_sparkles(s16 x, s16 y, s16 z, f32 radius);` - -[:arrow_up_small:](#) - -
- -## [get_credits_str_width](#get_credits_str_width) - -### Lua Example -`local integerValue = get_credits_str_width(str)` - -### Parameters -| Field | Type | -| ----- | ---- | -| str | `Pointer` <`integer`> | - -### Returns -- `integer` - -### C Prototype -`s32 get_credits_str_width(char *str);` - -[:arrow_up_small:](#) - -
- -## [get_star_collection_dialog](#get_star_collection_dialog) - -### Lua Example -`local integerValue = get_star_collection_dialog(m)` - -### Parameters -| Field | Type | -| ----- | ---- | -| m | [MarioState](structs.md#MarioState) | - -### Returns -- `integer` - -### C Prototype -`s32 get_star_collection_dialog(struct MarioState *m);` - -[:arrow_up_small:](#) - -
- -## [handle_save_menu](#handle_save_menu) - -### Lua Example -`handle_save_menu(m)` - -### Parameters -| Field | Type | -| ----- | ---- | -| m | [MarioState](structs.md#MarioState) | - -### Returns -- None - -### C Prototype -`void handle_save_menu(struct MarioState *m);` - -[:arrow_up_small:](#) - -
- -## [launch_mario_until_land](#launch_mario_until_land) - -### Lua Example -`local integerValue = launch_mario_until_land(m, endAction, animation, forwardVel)` - -### Parameters -| Field | Type | -| ----- | ---- | -| m | [MarioState](structs.md#MarioState) | -| endAction | `integer` | -| animation | `integer` | -| forwardVel | `number` | - -### Returns -- `integer` - -### C Prototype -`s32 launch_mario_until_land(struct MarioState *m, s32 endAction, s32 animation, f32 forwardVel);` - -[:arrow_up_small:](#) - -
- -## [mario_execute_cutscene_action](#mario_execute_cutscene_action) - -### Lua Example -`local integerValue = mario_execute_cutscene_action(m)` - -### Parameters -| Field | Type | -| ----- | ---- | -| m | [MarioState](structs.md#MarioState) | - -### Returns -- `integer` - -### C Prototype -`s32 mario_execute_cutscene_action(struct MarioState *m);` - -[:arrow_up_small:](#) - -
- -## [mario_ready_to_speak](#mario_ready_to_speak) - -### Lua Example -`local integerValue = mario_ready_to_speak(m)` - -### Parameters -| Field | Type | -| ----- | ---- | -| m | [MarioState](structs.md#MarioState) | - -### Returns -- `integer` - -### C Prototype -`s32 mario_ready_to_speak(struct MarioState* m);` - -[:arrow_up_small:](#) - -
- -## [should_start_or_continue_dialog](#should_start_or_continue_dialog) - -### Lua Example -`local integerValue = should_start_or_continue_dialog(m, object)` - -### Parameters -| Field | Type | -| ----- | ---- | -| m | [MarioState](structs.md#MarioState) | -| object | [Object](structs.md#Object) | - -### Returns -- `integer` - -### C Prototype -`u8 should_start_or_continue_dialog(struct MarioState* m, struct Object* object);` - -[:arrow_up_small:](#) - -
- -## [stuck_in_ground_handler](#stuck_in_ground_handler) - -### Lua Example -`stuck_in_ground_handler(m, animation, unstuckFrame, target2, target3, endAction)` - -### Parameters -| Field | Type | -| ----- | ---- | -| m | [MarioState](structs.md#MarioState) | -| animation | `integer` | -| unstuckFrame | `integer` | -| target2 | `integer` | -| target3 | `integer` | -| endAction | `integer` | - -### Returns -- None - -### C Prototype -`void stuck_in_ground_handler(struct MarioState *m, s32 animation, s32 unstuckFrame, s32 target2, s32 target3, s32 endAction);` - -[:arrow_up_small:](#) -
--- diff --git a/docs/lua/functions-4.md b/docs/lua/functions-4.md index 67b12ad6f..debb70ba5 100644 --- a/docs/lua/functions-4.md +++ b/docs/lua/functions-4.md @@ -5,6 +5,323 @@ [< prev](functions-3.md) | [1](functions.md) | [2](functions-2.md) | [3](functions-3.md) | 4 | [5](functions-5.md) | [6](functions-6.md) | [next >](functions-5.md)] +--- +# functions from mario_actions_cutscene.c + +
+ + +## [bhv_end_peach_loop](#bhv_end_peach_loop) + +### Lua Example +`bhv_end_peach_loop()` + +### Parameters +- None + +### Returns +- None + +### C Prototype +`void bhv_end_peach_loop(void);` + +[:arrow_up_small:](#) + +
+ +## [bhv_end_toad_loop](#bhv_end_toad_loop) + +### Lua Example +`bhv_end_toad_loop()` + +### Parameters +- None + +### Returns +- None + +### C Prototype +`void bhv_end_toad_loop(void);` + +[:arrow_up_small:](#) + +
+ +## [common_death_handler](#common_death_handler) + +### Lua Example +`local integerValue = common_death_handler(m, animation, frameToDeathWarp)` + +### Parameters +| Field | Type | +| ----- | ---- | +| m | [MarioState](structs.md#MarioState) | +| animation | `integer` | +| frameToDeathWarp | `integer` | + +### Returns +- `integer` + +### C Prototype +`s32 common_death_handler(struct MarioState *m, s32 animation, s32 frameToDeathWarp);` + +[:arrow_up_small:](#) + +
+ +## [cutscene_put_cap_on](#cutscene_put_cap_on) + +### Lua Example +`cutscene_put_cap_on(m)` + +### Parameters +| Field | Type | +| ----- | ---- | +| m | [MarioState](structs.md#MarioState) | + +### Returns +- None + +### C Prototype +`void cutscene_put_cap_on(struct MarioState *m);` + +[:arrow_up_small:](#) + +
+ +## [cutscene_take_cap_off](#cutscene_take_cap_off) + +### Lua Example +`cutscene_take_cap_off(m)` + +### Parameters +| Field | Type | +| ----- | ---- | +| m | [MarioState](structs.md#MarioState) | + +### Returns +- None + +### C Prototype +`void cutscene_take_cap_off(struct MarioState *m);` + +[:arrow_up_small:](#) + +
+ +## [general_star_dance_handler](#general_star_dance_handler) + +### Lua Example +`general_star_dance_handler(m, isInWater)` + +### Parameters +| Field | Type | +| ----- | ---- | +| m | [MarioState](structs.md#MarioState) | +| isInWater | `integer` | + +### Returns +- None + +### C Prototype +`void general_star_dance_handler(struct MarioState *m, s32 isInWater);` + +[:arrow_up_small:](#) + +
+ +## [generate_yellow_sparkles](#generate_yellow_sparkles) + +### Lua Example +`generate_yellow_sparkles(x, y, z, radius)` + +### Parameters +| Field | Type | +| ----- | ---- | +| x | `integer` | +| y | `integer` | +| z | `integer` | +| radius | `number` | + +### Returns +- None + +### C Prototype +`void generate_yellow_sparkles(s16 x, s16 y, s16 z, f32 radius);` + +[:arrow_up_small:](#) + +
+ +## [get_credits_str_width](#get_credits_str_width) + +### Lua Example +`local integerValue = get_credits_str_width(str)` + +### Parameters +| Field | Type | +| ----- | ---- | +| str | `Pointer` <`integer`> | + +### Returns +- `integer` + +### C Prototype +`s32 get_credits_str_width(char *str);` + +[:arrow_up_small:](#) + +
+ +## [get_star_collection_dialog](#get_star_collection_dialog) + +### Lua Example +`local integerValue = get_star_collection_dialog(m)` + +### Parameters +| Field | Type | +| ----- | ---- | +| m | [MarioState](structs.md#MarioState) | + +### Returns +- `integer` + +### C Prototype +`s32 get_star_collection_dialog(struct MarioState *m);` + +[:arrow_up_small:](#) + +
+ +## [handle_save_menu](#handle_save_menu) + +### Lua Example +`handle_save_menu(m)` + +### Parameters +| Field | Type | +| ----- | ---- | +| m | [MarioState](structs.md#MarioState) | + +### Returns +- None + +### C Prototype +`void handle_save_menu(struct MarioState *m);` + +[:arrow_up_small:](#) + +
+ +## [launch_mario_until_land](#launch_mario_until_land) + +### Lua Example +`local integerValue = launch_mario_until_land(m, endAction, animation, forwardVel)` + +### Parameters +| Field | Type | +| ----- | ---- | +| m | [MarioState](structs.md#MarioState) | +| endAction | `integer` | +| animation | `integer` | +| forwardVel | `number` | + +### Returns +- `integer` + +### C Prototype +`s32 launch_mario_until_land(struct MarioState *m, s32 endAction, s32 animation, f32 forwardVel);` + +[:arrow_up_small:](#) + +
+ +## [mario_execute_cutscene_action](#mario_execute_cutscene_action) + +### Lua Example +`local integerValue = mario_execute_cutscene_action(m)` + +### Parameters +| Field | Type | +| ----- | ---- | +| m | [MarioState](structs.md#MarioState) | + +### Returns +- `integer` + +### C Prototype +`s32 mario_execute_cutscene_action(struct MarioState *m);` + +[:arrow_up_small:](#) + +
+ +## [mario_ready_to_speak](#mario_ready_to_speak) + +### Lua Example +`local integerValue = mario_ready_to_speak(m)` + +### Parameters +| Field | Type | +| ----- | ---- | +| m | [MarioState](structs.md#MarioState) | + +### Returns +- `integer` + +### C Prototype +`s32 mario_ready_to_speak(struct MarioState* m);` + +[:arrow_up_small:](#) + +
+ +## [should_start_or_continue_dialog](#should_start_or_continue_dialog) + +### Lua Example +`local integerValue = should_start_or_continue_dialog(m, object)` + +### Parameters +| Field | Type | +| ----- | ---- | +| m | [MarioState](structs.md#MarioState) | +| object | [Object](structs.md#Object) | + +### Returns +- `integer` + +### C Prototype +`u8 should_start_or_continue_dialog(struct MarioState* m, struct Object* object);` + +[:arrow_up_small:](#) + +
+ +## [stuck_in_ground_handler](#stuck_in_ground_handler) + +### Lua Example +`stuck_in_ground_handler(m, animation, unstuckFrame, target2, target3, endAction)` + +### Parameters +| Field | Type | +| ----- | ---- | +| m | [MarioState](structs.md#MarioState) | +| animation | `integer` | +| unstuckFrame | `integer` | +| target2 | `integer` | +| target3 | `integer` | +| endAction | `integer` | + +### Returns +- None + +### C Prototype +`void stuck_in_ground_handler(struct MarioState *m, s32 animation, s32 unstuckFrame, s32 target2, s32 target3, s32 endAction);` + +[:arrow_up_small:](#) + +
+ --- # functions from mario_actions_moving.c diff --git a/docs/lua/functions-5.md b/docs/lua/functions-5.md index 1d74ae551..d6e7fc4d5 100644 --- a/docs/lua/functions-5.md +++ b/docs/lua/functions-5.md @@ -5161,6 +5161,9 @@ Marks the coin score for a specific course as the newest among all save files. A ## [sequence_player_get_tempo](#sequence_player_get_tempo) +### Description +Gets the tempo of `player` + ### Lua Example `local integerValue = sequence_player_get_tempo(player)` @@ -5181,6 +5184,9 @@ Marks the coin score for a specific course as the newest among all save files. A ## [sequence_player_get_tempo_acc](#sequence_player_get_tempo_acc) +### Description +Gets the tempoAcc (tempo ???) of `player` + ### Lua Example `local integerValue = sequence_player_get_tempo_acc(player)` @@ -5201,6 +5207,9 @@ Marks the coin score for a specific course as the newest among all save files. A ## [sequence_player_get_transposition](#sequence_player_get_transposition) +### Description +Gets the transposition (pitch) of `player` + ### Lua Example `local integerValue = sequence_player_get_transposition(player)` @@ -5221,6 +5230,9 @@ Marks the coin score for a specific course as the newest among all save files. A ## [sequence_player_set_tempo](#sequence_player_set_tempo) +### Description +Sets the `tempo` of `player`. Resets when another sequence is played + ### Lua Example `sequence_player_set_tempo(player, tempo)` @@ -5242,6 +5254,9 @@ Marks the coin score for a specific course as the newest among all save files. A ## [sequence_player_set_tempo_acc](#sequence_player_set_tempo_acc) +### Description +Sets the `tempoAcc` (tempo ???) of `player`. Resets when another sequence is played + ### Lua Example `sequence_player_set_tempo_acc(player, tempoAcc)` @@ -5263,6 +5278,9 @@ Marks the coin score for a specific course as the newest among all save files. A ## [sequence_player_set_transposition](#sequence_player_set_transposition) +### Description +Sets the `transposition` (pitch) of `player`. Resets when another sequence is played + ### Lua Example `sequence_player_set_transposition(player, transposition)` diff --git a/docs/lua/functions-6.md b/docs/lua/functions-6.md index f55b9a2ed..ad731a8d4 100644 --- a/docs/lua/functions-6.md +++ b/docs/lua/functions-6.md @@ -2960,6 +2960,9 @@ Replaces the secret star course name of `courseNum` with `courseName` ## [disable_background_sound](#disable_background_sound) +### Description +Disables background soundbanks + ### Lua Example `disable_background_sound()` @@ -2978,6 +2981,9 @@ Replaces the secret star course name of `courseNum` with `courseName` ## [enable_background_sound](#enable_background_sound) +### Description +Enables background soundbanks + ### Lua Example `enable_background_sound()` @@ -2996,6 +3002,9 @@ Replaces the secret star course name of `courseNum` with `courseName` ## [fadeout_cap_music](#fadeout_cap_music) +### Description +Fades out cap music + ### Lua Example `fadeout_cap_music()` @@ -3014,6 +3023,9 @@ Replaces the secret star course name of `courseNum` with `courseName` ## [fadeout_level_music](#fadeout_level_music) +### Description +Fades out the level sequence player + ### Lua Example `fadeout_level_music(fadeTimer)` @@ -3034,6 +3046,9 @@ Replaces the secret star course name of `courseNum` with `courseName` ## [fadeout_music](#fadeout_music) +### Description +Fades out level, shell, and cap music + ### Lua Example `fadeout_music(fadeOutTime)` @@ -3054,6 +3069,9 @@ Replaces the secret star course name of `courseNum` with `courseName` ## [lower_background_noise](#lower_background_noise) +### Description +Lowers the volume of music by 40% + ### Lua Example `lower_background_noise(a)` @@ -3074,6 +3092,9 @@ Replaces the secret star course name of `courseNum` with `courseName` ## [play_cap_music](#play_cap_music) +### Description +Plays `seqArgs` as cap music + ### Lua Example `play_cap_music(seqArgs)` @@ -3094,6 +3115,9 @@ Replaces the secret star course name of `courseNum` with `courseName` ## [play_cutscene_music](#play_cutscene_music) +### Description +Plays and sets the current music to `seqArgs` + ### Lua Example `play_cutscene_music(seqArgs)` @@ -3114,6 +3138,9 @@ Replaces the secret star course name of `courseNum` with `courseName` ## [play_infinite_stairs_music](#play_infinite_stairs_music) +### Description +Plays the infinite stairs music if you're in the endless stairs room and have less than `gLevelValues.infiniteStairsRequirement` stars + ### Lua Example `play_infinite_stairs_music()` @@ -3132,6 +3159,9 @@ Replaces the secret star course name of `courseNum` with `courseName` ## [play_menu_sounds](#play_menu_sounds) +### Description +Play menu sounds from `SOUND_MENU_FLAG_*` constants and queues rumble if `SOUND_MENU_FLAG_LETGOMARIOFACE` is one of the flags + ### Lua Example `play_menu_sounds(soundMenuFlags)` @@ -3152,6 +3182,9 @@ Replaces the secret star course name of `courseNum` with `courseName` ## [play_painting_eject_sound](#play_painting_eject_sound) +### Description +Plays the painting eject sound effect if it has not already been played + ### Lua Example `play_painting_eject_sound()` @@ -3170,6 +3203,9 @@ Replaces the secret star course name of `courseNum` with `courseName` ## [play_shell_music](#play_shell_music) +### Description +Plays shell music + ### Lua Example `play_shell_music()` @@ -3188,6 +3224,9 @@ Replaces the secret star course name of `courseNum` with `courseName` ## [raise_background_noise](#raise_background_noise) +### Description +Raises music volume back up to normal levels + ### Lua Example `raise_background_noise(a)` @@ -3208,6 +3247,9 @@ Replaces the secret star course name of `courseNum` with `courseName` ## [reset_volume](#reset_volume) +### Description +Resets if music volume has been lowered + ### Lua Example `reset_volume()` @@ -3226,6 +3268,9 @@ Replaces the secret star course name of `courseNum` with `courseName` ## [set_background_music](#set_background_music) +### Description +Sets the background music to `seqArgs` on sequence player `a` with a fade in time of `fadeTimer` + ### Lua Example `set_background_music(a, seqArgs, fadeTimer)` @@ -3248,6 +3293,9 @@ Replaces the secret star course name of `courseNum` with `courseName` ## [stop_cap_music](#stop_cap_music) +### Description +Stops cap music completely + ### Lua Example `stop_cap_music()` @@ -3266,6 +3314,9 @@ Replaces the secret star course name of `courseNum` with `courseName` ## [stop_shell_music](#stop_shell_music) +### Description +Stops shell music completely + ### Lua Example `stop_shell_music()` @@ -3283,13 +3334,16 @@ Replaces the secret star course name of `courseNum` with `courseName`
--- -# functions from spawn_sound.c +# functions from spawn_sound.h
## [calc_dist_to_volume_range_1](#calc_dist_to_volume_range_1) +### Description +Unused vanilla function, calculates a volume based on `distance`. If `distance` is less than 500 then 127, if `distance` is greater than 1500 then 0, if `distance` is between 500 and 1500 then it ranges linearly from 60 to 124. What an even more strange and confusing function + ### Lua Example `local integerValue = calc_dist_to_volume_range_1(distance)` @@ -3310,6 +3364,9 @@ Replaces the secret star course name of `courseNum` with `courseName` ## [calc_dist_to_volume_range_2](#calc_dist_to_volume_range_2) +### Description +Unused vanilla function, calculates a volume based on `distance`. If `distance` is less than 1300 then 127, if `distance` is greater than 2300 then 0, if `distance` is between 1300 and 2300 then it ranges linearly from 60 to 127. What a strange and confusing function + ### Lua Example `local integerValue = calc_dist_to_volume_range_2(distance)` @@ -3328,8 +3385,34 @@ Replaces the secret star course name of `courseNum` with `courseName`
+## [create_sound_spawner](#create_sound_spawner) + +### Description +Create a sound spawner for objects that need a sound play once. (Breakable walls, King Bobomb exploding, etc) + +### Lua Example +`create_sound_spawner(soundMagic)` + +### Parameters +| Field | Type | +| ----- | ---- | +| soundMagic | `integer` | + +### Returns +- None + +### C Prototype +`void create_sound_spawner(s32 soundMagic);` + +[:arrow_up_small:](#) + +
+ ## [cur_obj_play_sound_1](#cur_obj_play_sound_1) +### Description +Plays a sound if the current object is visible + ### Lua Example `cur_obj_play_sound_1(soundMagic)` @@ -3350,6 +3433,9 @@ Replaces the secret star course name of `courseNum` with `courseName` ## [cur_obj_play_sound_2](#cur_obj_play_sound_2) +### Description +Plays a sound if the current object is visible and queues rumble for specific sounds + ### Lua Example `cur_obj_play_sound_2(soundMagic)` diff --git a/docs/lua/functions.md b/docs/lua/functions.md index 8582f594a..6a6b19824 100644 --- a/docs/lua/functions.md +++ b/docs/lua/functions.md @@ -781,7 +781,7 @@
-- djui_panel_menu.c +- djui_panel_menu.h - [djui_menu_get_rainbow_string_color](functions-3.md#djui_menu_get_rainbow_string_color)
@@ -799,6 +799,7 @@ - [get_current_background_music_default_volume](functions-3.md#get_current_background_music_default_volume) - [get_current_background_music_max_target_volume](functions-3.md#get_current_background_music_max_target_volume) - [get_current_background_music_target_volume](functions-3.md#get_current_background_music_target_volume) + - [get_sound_pan](functions-3.md#get_sound_pan) - [is_current_background_music_volume_lowered](functions-3.md#is_current_background_music_volume_lowered) - [play_course_clear](functions-3.md#play_course_clear) - [play_dialog_sound](functions-3.md#play_dialog_sound) @@ -816,9 +817,13 @@ - [seq_player_lower_volume](functions-3.md#seq_player_lower_volume) - [seq_player_unlower_volume](functions-3.md#seq_player_unlower_volume) - [set_audio_fadeout](functions-3.md#set_audio_fadeout) + - [set_audio_muted](functions-3.md#set_audio_muted) + - [set_sound_moving_speed](functions-3.md#set_sound_moving_speed) - [sound_banks_disable](functions-3.md#sound_banks_disable) - [sound_banks_enable](functions-3.md#sound_banks_enable) - [sound_get_level_intensity](functions-3.md#sound_get_level_intensity) + - [sound_reset_background_music_default_volume](functions-3.md#sound_reset_background_music_default_volume) + - [sound_set_background_music_default_volume](functions-3.md#sound_set_background_music_default_volume) - [stop_background_music](functions-3.md#stop_background_music) - [stop_secondary_music](functions-3.md#stop_secondary_music) - [stop_sound](functions-3.md#stop_sound) @@ -1033,21 +1038,21 @@
- mario_actions_cutscene.c - - [bhv_end_peach_loop](functions-3.md#bhv_end_peach_loop) - - [bhv_end_toad_loop](functions-3.md#bhv_end_toad_loop) - - [common_death_handler](functions-3.md#common_death_handler) - - [cutscene_put_cap_on](functions-3.md#cutscene_put_cap_on) - - [cutscene_take_cap_off](functions-3.md#cutscene_take_cap_off) - - [general_star_dance_handler](functions-3.md#general_star_dance_handler) - - [generate_yellow_sparkles](functions-3.md#generate_yellow_sparkles) - - [get_credits_str_width](functions-3.md#get_credits_str_width) - - [get_star_collection_dialog](functions-3.md#get_star_collection_dialog) - - [handle_save_menu](functions-3.md#handle_save_menu) - - [launch_mario_until_land](functions-3.md#launch_mario_until_land) - - [mario_execute_cutscene_action](functions-3.md#mario_execute_cutscene_action) - - [mario_ready_to_speak](functions-3.md#mario_ready_to_speak) - - [should_start_or_continue_dialog](functions-3.md#should_start_or_continue_dialog) - - [stuck_in_ground_handler](functions-3.md#stuck_in_ground_handler) + - [bhv_end_peach_loop](functions-4.md#bhv_end_peach_loop) + - [bhv_end_toad_loop](functions-4.md#bhv_end_toad_loop) + - [common_death_handler](functions-4.md#common_death_handler) + - [cutscene_put_cap_on](functions-4.md#cutscene_put_cap_on) + - [cutscene_take_cap_off](functions-4.md#cutscene_take_cap_off) + - [general_star_dance_handler](functions-4.md#general_star_dance_handler) + - [generate_yellow_sparkles](functions-4.md#generate_yellow_sparkles) + - [get_credits_str_width](functions-4.md#get_credits_str_width) + - [get_star_collection_dialog](functions-4.md#get_star_collection_dialog) + - [handle_save_menu](functions-4.md#handle_save_menu) + - [launch_mario_until_land](functions-4.md#launch_mario_until_land) + - [mario_execute_cutscene_action](functions-4.md#mario_execute_cutscene_action) + - [mario_ready_to_speak](functions-4.md#mario_ready_to_speak) + - [should_start_or_continue_dialog](functions-4.md#should_start_or_continue_dialog) + - [stuck_in_ground_handler](functions-4.md#stuck_in_ground_handler)
@@ -1908,9 +1913,10 @@
-- spawn_sound.c +- spawn_sound.h - [calc_dist_to_volume_range_1](functions-6.md#calc_dist_to_volume_range_1) - [calc_dist_to_volume_range_2](functions-6.md#calc_dist_to_volume_range_2) + - [create_sound_spawner](functions-6.md#create_sound_spawner) - [cur_obj_play_sound_1](functions-6.md#cur_obj_play_sound_1) - [cur_obj_play_sound_2](functions-6.md#cur_obj_play_sound_2) - [exec_anim_sound_state](functions-6.md#exec_anim_sound_state) diff --git a/docs/lua/lua.md b/docs/lua/lua.md index 68e08551d..b07e4081f 100644 --- a/docs/lua/lua.md +++ b/docs/lua/lua.md @@ -18,6 +18,7 @@ Save file locations: ## Tips - When developing Lua mods, run the game from a console. Lua errors and logs will appear there, but only if the game is launched with the `--console` launch parameter. +- When a function requests a time parameter, it is almost if not always in frames. - You can use the `print()` command when debugging. Your logs will show up in the console. - You can create a folder within the mods folder containing multiple lua scripts as long as one script is called `main.lua`. Dynos actors can be placed inside this mod folder under `/actors/`.
diff --git a/src/audio/external.c b/src/audio/external.c index 3ddc5c23e..21fda5f01 100644 --- a/src/audio/external.c +++ b/src/audio/external.c @@ -2851,8 +2851,8 @@ void play_star_fanfare(void) { /** * Called from threads: thread5_game_loop */ -void play_power_star_jingle(u8 arg0) { - if (!arg0) { +void play_power_star_jingle(u8 keepBackgroundMusic) { + if (!keepBackgroundMusic) { sBackgroundMusicTargetVolume = 0; } seq_player_play_sequence(SEQ_PLAYER_ENV, SEQ_EVENT_CUTSCENE_STAR_SPAWN, 0); diff --git a/src/audio/external.h b/src/audio/external.h index aafbdbd0b..355b7c523 100644 --- a/src/audio/external.h +++ b/src/audio/external.h @@ -57,49 +57,85 @@ struct SPTask *create_next_audio_frame_task(void); #ifdef VERSION_SH struct SPTask *func_sh_802f5a80(void); #endif +/* |description|Plays a sound (`soundBits`) at `pos` (usually `gGlobalSoundSource` or `m.header.gfx.cameraToObject`)|descriptionEnd| */ void play_sound(s32 soundBits, f32 *pos); +/* |description|Plays a sound (`soundBits`) with `freqScale` at `pos` (usually `gGlobalSoundSource` or `m.header.gfx.cameraToObject`)|descriptionEnd| */ void play_sound_with_freq_scale(s32 soundBits, f32* pos, f32 freqScale); void audio_signal_game_loop_tick(void); +/* |description|Fades out `player` with `fadeDuration`|descriptionEnd| */ void seq_player_fade_out(u8 player, u16 fadeDuration); +/* |description|Fades the volume of `player` to `targetScale` (0-127) over `fadeDuration`|descriptionEnd| */ void fade_volume_scale(u8 player, u8 targetScale, u16 fadeDuration); +/* |description|Fades the volume of `player` to `percentage` over `fadeDuration`|descriptionEnd| */ void seq_player_lower_volume(u8 player, u16 fadeDuration, u8 percentage); +/* |description|Unfades the volume of `player` over `fadeDuration`|descriptionEnd| */ void seq_player_unlower_volume(u8 player, u16 fadeDuration); +/* |description|Sets the muted status of all sequence players|descriptionEnd| */ void set_audio_muted(u8 muted); void sound_init(void); void get_currently_playing_sound(u8 bank, u8 *numPlayingSounds, u8 *numSoundsInBank, u8 *soundId); +/* |description|Stops a sound (`soundBits`) at `pos` (usually `gGlobalSoundSource` or `m.header.gfx.cameraToObject`)|descriptionEnd| */ void stop_sound(u32 soundBits, f32 *pos); +/* |description|Stops sounds from `pos` (usually `gGlobalSoundSource` or `m.header.gfx.cameraToObject`)|descriptionEnd| */ void stop_sounds_from_source(f32 *pos); +/* |description|Stops sounds in sound banks moving, env, and air|descriptionEnd| */ void stop_sounds_in_continuous_banks(void); +/* |description|Enables `bankMask` soundbanks in `player`|descriptionEnd| */ void sound_banks_disable(u8 player, u16 bankMask); +/* |description|Disables `bankMask` soundbanks in `player`|descriptionEnd| */ void sound_banks_enable(u8 player, u16 bankMask); +/* |description|Sets the `speed` of moving `bank`|descriptionEnd| */ void set_sound_moving_speed(u8 bank, u8 speed); +/* |description|Plays a dialog sound corresponding to `dialogID`|descriptionEnd| */ void play_dialog_sound(u8 dialogID); +/* |description|Sets the `volume` of `player`|descriptionEnd| */ void set_sequence_player_volume(s32 player, f32 volume); +/* |description|Plays fading in music (`seqArgs`) on `player` over `fadeTimer`|descriptionEnd| */ void play_music(u8 player, u16 seqArgs, u16 fadeTimer); +/* |description|Stops background music `seqId`|descriptionEnd| */ void stop_background_music(u16 seqId); -void fadeout_background_music(u16 arg0, u16 fadeOut); +/* |description|Fades out background music `seqId` over `fadeOut`|descriptionEnd| */ +void fadeout_background_music(u16 seqId, u16 fadeOut); +/* |description|Drops any queued background music|descriptionEnd| */ void drop_queued_background_music(void); +/* |description|Gets the current background music|descriptionEnd| */ u16 get_current_background_music(void); +/* |description|Gets the current background music's default volume|descriptionEnd| */ u8 get_current_background_music_default_volume(void); +/* |description|Gets the current target volume|descriptionEnd| */ u8 get_current_background_music_target_volume(void); +/* |description|Gets the current max target volume|descriptionEnd| */ u8 get_current_background_music_max_target_volume(void); +/* |description|Checks if the current background music is lowered|descriptionEnd| */ u8 is_current_background_music_volume_lowered(void); +/* |description|Plays fading in secondary music `seqId` at `volume` over `fadeTimer` and sets the current background music's volume to `bgMusicVolume`|descriptionEnd| */ void play_secondary_music(u8 seqId, u8 bgMusicVolume, u8 volume, u16 fadeTimer); +/* |description|Fades out secondary music over `fadeTimer`|descriptionEnd| */ void stop_secondary_music(u16 fadeTimer); +/* |description|Sets the `fadeOutTime` of audio|descriptionEnd| */ void set_audio_fadeout(u16 fadeOutTime); +/* |description|Plays the star collect fanfare (this function's name was mixed up with the other)|descriptionEnd| */ void play_course_clear(void); +/* |description|Plays Peach's letter jingle|descriptionEnd| */ void play_peachs_jingle(void); +/* |description|Plays the puzzle jingle|descriptionEnd| */ void play_puzzle_jingle(void); +/* |description|Plays the course clear fanfare (this function's name was mixed up with the other)|descriptionEnd| */ void play_star_fanfare(void); -void play_power_star_jingle(u8 arg0); +/* |description|Plays the power star jingle, set `keepBackgroundMusic` to 0 to mute background music|descriptionEnd| */ +void play_power_star_jingle(u8 keepBackgroundMusic); +/* |description|Plays the race fanfare when a race is started|descriptionEnd| */ void play_race_fanfare(void); +/* |description|Plays Toad's jingle|descriptionEnd| */ void play_toads_jingle(void); void sound_reset(u8 presetId); void audio_set_sound_mode(u8 arg0); void audio_init(void); // in load.c +/* |description||descriptionEnd| */ void sound_reset_background_music_default_volume(u8 seqId); +/* |description||descriptionEnd| */ void sound_set_background_music_default_volume(u8 seqId, u8 volume); #if defined(VERSION_EU) || defined(VERSION_SH) diff --git a/src/audio/seqplayer.h b/src/audio/seqplayer.h index f7a4b60c5..a6e7e02cd 100644 --- a/src/audio/seqplayer.h +++ b/src/audio/seqplayer.h @@ -15,11 +15,17 @@ void sequence_channel_set_volume(struct SequenceChannel *seqChannel, u8 volume); void process_sequences(s32 iterationsRemaining); void init_sequence_player(u32 player); void init_sequence_players(void); -void sequence_player_set_tempo(u8 player, u16 tempo); -void sequence_player_set_tempo_acc(u8 player, u16 tempoAcc); -void sequence_player_set_transposition(u8 player, u16 transposition); +/* |description|Gets the tempo of `player`|descriptionEnd| */ u16 sequence_player_get_tempo(u8 player); +/* |description|Sets the `tempo` of `player`. Resets when another sequence is played|descriptionEnd| */ +void sequence_player_set_tempo(u8 player, u16 tempo); +/* |description|Gets the tempoAcc (tempo ???) of `player`|descriptionEnd| */ u16 sequence_player_get_tempo_acc(u8 player); +/* |description|Sets the `tempoAcc` (tempo ???) of `player`. Resets when another sequence is played|descriptionEnd| */ +void sequence_player_set_tempo_acc(u8 player, u16 tempoAcc); +/* |description|Gets the transposition (pitch) of `player`|descriptionEnd| */ u16 sequence_player_get_transposition(u8 player); +/* |description|Sets the `transposition` (pitch) of `player`. Resets when another sequence is played|descriptionEnd| */ +void sequence_player_set_transposition(u8 player, u16 transposition); #endif // AUDIO_SEQPLAYER_H diff --git a/src/game/sound_init.h b/src/game/sound_init.h index a03c5d849..cc2f66618 100644 --- a/src/game/sound_init.h +++ b/src/game/sound_init.h @@ -18,23 +18,40 @@ #define SOUND_MENU_MODE_MONO 1 #define SOUND_MENU_MODE_HEADSET 2 +/* |description|Resets if music volume has been lowered|descriptionEnd| */ void reset_volume(void); +/* |description|Raises music volume back up to normal levels|descriptionEnd| */ void raise_background_noise(s32 a); +/* |description|Lowers the volume of music by 40%|descriptionEnd| */ void lower_background_noise(s32 a); +/* |description|Disables background soundbanks|descriptionEnd| */ void disable_background_sound(void); +/* |description|Enables background soundbanks|descriptionEnd| */ void enable_background_sound(void); void set_sound_mode(u16 soundMode); +/* |description|Play menu sounds from `SOUND_MENU_FLAG_*` constants and queues rumble if `SOUND_MENU_FLAG_LETGOMARIOFACE` is one of the flags|descriptionEnd| */ void play_menu_sounds(s16 soundMenuFlags); +/* |description|Plays the painting eject sound effect if it has not already been played|descriptionEnd| */ void play_painting_eject_sound(void); +/* |description|Plays the infinite stairs music if you're in the endless stairs room and have less than `gLevelValues.infiniteStairsRequirement` stars|descriptionEnd| */ void play_infinite_stairs_music(void); +/* |description|Sets the background music to `seqArgs` on sequence player `a` with a fade in time of `fadeTimer`|descriptionEnd| */ void set_background_music(u16 a, u16 seqArgs, s16 fadeTimer); +/* |description|Fades out level, shell, and cap music|descriptionEnd| */ void fadeout_music(s16 fadeOutTime); +/* |description|Fades out the level sequence player|descriptionEnd| */ void fadeout_level_music(s16 fadeTimer); +/* |description|Plays and sets the current music to `seqArgs`|descriptionEnd| */ void play_cutscene_music(u16 seqArgs); +/* |description|Plays shell music|descriptionEnd| */ void play_shell_music(void); +/* |description|Stops shell music completely|descriptionEnd| */ void stop_shell_music(void); +/* |description|Plays `seqArgs` as cap music|descriptionEnd| */ void play_cap_music(u16 seqArgs); +/* |description|Fades out cap music|descriptionEnd| */ void fadeout_cap_music(void); +/* |description|Stops cap music completely|descriptionEnd| */ void stop_cap_music(void); void audio_game_loop_tick(void); void thread4_sound(UNUSED void *arg); diff --git a/src/game/spawn_sound.h b/src/game/spawn_sound.h index b125049a6..64dab86b5 100644 --- a/src/game/spawn_sound.h +++ b/src/game/spawn_sound.h @@ -16,9 +16,32 @@ struct SoundState s32 soundMagic; }; -void cur_obj_play_sound_1(s32 soundMagic); -void cur_obj_play_sound_2(s32 soundMagic); -void create_sound_spawner(s32 soundMagic); void exec_anim_sound_state(struct SoundState *soundStates, u16 maxSoundStates); +/* |description| +Plays a sound if the current object is visible +|descriptionEnd| */ +void cur_obj_play_sound_1(s32 soundMagic); +/* |description| +Plays a sound if the current object is visible and queues rumble for specific sounds +|descriptionEnd| */ +void cur_obj_play_sound_2(s32 soundMagic); +/* |description| +Create a sound spawner for objects that need a sound play once. +(Breakable walls, King Bobomb exploding, etc) +|descriptionEnd| */ +void create_sound_spawner(s32 soundMagic); + +/* |description| +Unused vanilla function, calculates a volume based on `distance`. +If `distance` is less than 500 then 127, if `distance` is greater than 1500 then 0, if `distance` is between 500 and 1500 then it ranges linearly from 60 to 124. +What an even more strange and confusing function +|descriptionEnd| */ +s32 calc_dist_to_volume_range_1(f32 distance); +/* |description| +Unused vanilla function, calculates a volume based on `distance`. +If `distance` is less than 1300 then 127, if `distance` is greater than 2300 then 0, if `distance` is between 1300 and 2300 then it ranges linearly from 60 to 127. +What a strange and confusing function +|descriptionEnd| */ +s32 calc_dist_to_volume_range_2(f32 distance); #endif // SPAWN_SOUND_H diff --git a/src/pc/djui/djui_panel_menu.c b/src/pc/djui/djui_panel_menu.c index 387a6d995..6ff2289a3 100644 --- a/src/pc/djui/djui_panel_menu.c +++ b/src/pc/djui/djui_panel_menu.c @@ -1,6 +1,7 @@ #include "djui.h" #include "djui_panel.h" #include "djui_unicode.h" +#include "djui_panel_menu.h" #include "pc/utils/misc.h" #include "pc/configfile.h" @@ -49,7 +50,7 @@ static void generate_rainbow_text(char* text) { } } -char* djui_menu_get_rainbow_string_color(int color) { +char* djui_menu_get_rainbow_string_color(enum DjuiRainbowColor color) { int i = (color >= 0 && color <= 3) ? color : 0; return configExCoopTheme ? sExCoopRainbowColors[i] : sRainbowColors[i]; } diff --git a/src/pc/djui/djui_panel_menu.h b/src/pc/djui/djui_panel_menu.h index db15f91e4..1ddfd2e24 100644 --- a/src/pc/djui/djui_panel_menu.h +++ b/src/pc/djui/djui_panel_menu.h @@ -1,5 +1,13 @@ #pragma once #include "djui.h" +enum DjuiRainbowColor { + DJUI_RAINBOW_COLOR_RED, + DJUI_RAINBOW_COLOR_GREEN, + DJUI_RAINBOW_COLOR_BLUE, + DJUI_RAINBOW_COLOR_YELLOW +}; + +char* djui_menu_get_rainbow_string_color(enum DjuiRainbowColor color); void djui_panel_menu_back(struct DjuiBase* base); struct DjuiThreePanel* djui_panel_menu_create(char* headerText, bool forcedLeftSide); diff --git a/src/pc/lua/smlua_constants_autogen.c b/src/pc/lua/smlua_constants_autogen.c index 5552b443e..8ed8f5fee 100644 --- a/src/pc/lua/smlua_constants_autogen.c +++ b/src/pc/lua/smlua_constants_autogen.c @@ -1253,6 +1253,10 @@ char gSmluaConstants[] = "" "FONT_CUSTOM_HUD = 4\n" "FONT_RECOLOR_HUD = 5\n" "FONT_COUNT = 6\n" +"DJUI_RAINBOW_COLOR_RED = 0\n" +"DJUI_RAINBOW_COLOR_GREEN = 1\n" +"DJUI_RAINBOW_COLOR_BLUE = 2\n" +"DJUI_RAINBOW_COLOR_YELLOW = 3\n" "ENVFX_MODE_NONE = 0\n" "ENVFX_SNOW_NORMAL = 1\n" "ENVFX_SNOW_WATER = 2\n" diff --git a/src/pc/lua/smlua_functions_autogen.c b/src/pc/lua/smlua_functions_autogen.c index 8b688e936..1384a3e6a 100644 --- a/src/pc/lua/smlua_functions_autogen.c +++ b/src/pc/lua/smlua_functions_autogen.c @@ -21,6 +21,7 @@ #include "src/game/save_file.h" #include "src/game/sound_init.h" #include "src/pc/djui/djui_hud_utils.h" +#include "src/pc/djui/djui_panel_menu.h" #include "src/pc/network/network_player.h" #include "src/pc/network/lag_compensation.h" #include "include/behavior_table.h" @@ -36,6 +37,7 @@ #include "src/pc/lua/utils/smlua_level_utils.h" #include "src/pc/lua/utils/smlua_anim_utils.h" #include "src/pc/lua/utils/smlua_deprecated.h" +#include "src/game/spawn_sound.h" #include "src/game/object_list_processor.h" #include "src/game/behavior_actions.h" #include "src/game/mario_misc.h" @@ -12797,7 +12799,7 @@ int smlua_func_djui_language_get(lua_State* L) { } /////////////////////// - // djui_panel_menu.c // + // djui_panel_menu.h // /////////////////////// int smlua_func_djui_menu_get_rainbow_string_color(lua_State* L) { @@ -12812,7 +12814,6 @@ int smlua_func_djui_menu_get_rainbow_string_color(lua_State* L) { int color = smlua_to_integer(L, 1); if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "djui_menu_get_rainbow_string_color"); return 0; } - extern char* djui_menu_get_rainbow_string_color(int color); lua_pushstring(L, djui_menu_get_rainbow_string_color(color)); return 1; @@ -12890,12 +12891,12 @@ int smlua_func_fadeout_background_music(lua_State* L) { return 0; } - u16 arg0 = smlua_to_integer(L, 1); + u16 seqId = smlua_to_integer(L, 1); if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "fadeout_background_music"); return 0; } u16 fadeOut = smlua_to_integer(L, 2); if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 2, "fadeout_background_music"); return 0; } - fadeout_background_music(arg0, fadeOut); + fadeout_background_music(seqId, fadeOut); return 1; } @@ -12960,6 +12961,25 @@ int smlua_func_get_current_background_music_target_volume(UNUSED lua_State* L) { return 1; } +int smlua_func_get_sound_pan(lua_State* L) { + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 2) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "get_sound_pan", 2, top); + return 0; + } + + f32 x = smlua_to_number(L, 1); + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "get_sound_pan"); return 0; } + f32 z = smlua_to_number(L, 2); + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 2, "get_sound_pan"); return 0; } + + lua_pushnumber(L, get_sound_pan(x, z)); + + return 1; +} + int smlua_func_is_current_background_music_volume_lowered(UNUSED lua_State* L) { if (L == NULL) { return 0; } @@ -13052,10 +13072,10 @@ int smlua_func_play_power_star_jingle(lua_State* L) { return 0; } - u8 arg0 = smlua_to_integer(L, 1); + u8 keepBackgroundMusic = smlua_to_integer(L, 1); if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "play_power_star_jingle"); return 0; } - play_power_star_jingle(arg0); + play_power_star_jingle(keepBackgroundMusic); return 1; } @@ -13275,6 +13295,42 @@ int smlua_func_set_audio_fadeout(lua_State* L) { return 1; } +int smlua_func_set_audio_muted(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", "set_audio_muted", 1, top); + return 0; + } + + u8 muted = smlua_to_integer(L, 1); + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "set_audio_muted"); return 0; } + + set_audio_muted(muted); + + return 1; +} + +int smlua_func_set_sound_moving_speed(lua_State* L) { + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 2) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "set_sound_moving_speed", 2, top); + return 0; + } + + u8 bank = smlua_to_integer(L, 1); + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "set_sound_moving_speed"); return 0; } + u8 speed = smlua_to_integer(L, 2); + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 2, "set_sound_moving_speed"); return 0; } + + set_sound_moving_speed(bank, speed); + + return 1; +} + int smlua_func_sound_banks_disable(lua_State* L) { if (L == NULL) { return 0; } @@ -13330,6 +13386,42 @@ int smlua_func_sound_get_level_intensity(lua_State* L) { return 1; } +int smlua_func_sound_reset_background_music_default_volume(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", "sound_reset_background_music_default_volume", 1, top); + return 0; + } + + u8 seqId = smlua_to_integer(L, 1); + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "sound_reset_background_music_default_volume"); return 0; } + + sound_reset_background_music_default_volume(seqId); + + return 1; +} + +int smlua_func_sound_set_background_music_default_volume(lua_State* L) { + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 2) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "sound_set_background_music_default_volume", 2, top); + return 0; + } + + u8 seqId = smlua_to_integer(L, 1); + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "sound_set_background_music_default_volume"); return 0; } + u8 volume = smlua_to_integer(L, 2); + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 2, "sound_set_background_music_default_volume"); return 0; } + + sound_set_background_music_default_volume(seqId, volume); + + return 1; +} + int smlua_func_stop_background_music(lua_State* L) { if (L == NULL) { return 0; } @@ -33031,7 +33123,7 @@ int smlua_func_stop_shell_music(UNUSED lua_State* L) { } /////////////////// - // spawn_sound.c // + // spawn_sound.h // /////////////////// int smlua_func_calc_dist_to_volume_range_1(lua_State* L) { @@ -33046,7 +33138,6 @@ int smlua_func_calc_dist_to_volume_range_1(lua_State* L) { f32 distance = smlua_to_number(L, 1); if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "calc_dist_to_volume_range_1"); return 0; } - extern s32 calc_dist_to_volume_range_1(f32 distance); lua_pushinteger(L, calc_dist_to_volume_range_1(distance)); return 1; @@ -33064,12 +33155,28 @@ int smlua_func_calc_dist_to_volume_range_2(lua_State* L) { f32 distance = smlua_to_number(L, 1); if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "calc_dist_to_volume_range_2"); return 0; } - extern s32 calc_dist_to_volume_range_2(f32 distance); lua_pushinteger(L, calc_dist_to_volume_range_2(distance)); return 1; } +int smlua_func_create_sound_spawner(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", "create_sound_spawner", 1, top); + return 0; + } + + s32 soundMagic = smlua_to_integer(L, 1); + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "create_sound_spawner"); return 0; } + + create_sound_spawner(soundMagic); + + return 1; +} + int smlua_func_cur_obj_play_sound_1(lua_State* L) { if (L == NULL) { return 0; } @@ -33082,7 +33189,6 @@ int smlua_func_cur_obj_play_sound_1(lua_State* L) { s32 soundMagic = smlua_to_integer(L, 1); if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "cur_obj_play_sound_1"); return 0; } - extern void cur_obj_play_sound_1(s32 soundMagic); cur_obj_play_sound_1(soundMagic); return 1; @@ -33100,7 +33206,6 @@ int smlua_func_cur_obj_play_sound_2(lua_State* L) { s32 soundMagic = smlua_to_integer(L, 1); if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "cur_obj_play_sound_2"); return 0; } - extern void cur_obj_play_sound_2(s32 soundMagic); cur_obj_play_sound_2(soundMagic); return 1; @@ -33120,7 +33225,6 @@ int smlua_func_exec_anim_sound_state(lua_State* L) { u16 maxSoundStates = smlua_to_integer(L, 2); if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 2, "exec_anim_sound_state"); return 0; } - extern void exec_anim_sound_state(struct SoundState *soundStates, u16 maxSoundStates); exec_anim_sound_state(soundStates, maxSoundStates); return 1; @@ -34199,7 +34303,7 @@ void smlua_bind_functions_autogen(void) { // djui_language.h smlua_bind_function(L, "djui_language_get", smlua_func_djui_language_get); - // djui_panel_menu.c + // djui_panel_menu.h smlua_bind_function(L, "djui_menu_get_rainbow_string_color", smlua_func_djui_menu_get_rainbow_string_color); // djui_popup.h @@ -34213,6 +34317,7 @@ void smlua_bind_functions_autogen(void) { smlua_bind_function(L, "get_current_background_music_default_volume", smlua_func_get_current_background_music_default_volume); smlua_bind_function(L, "get_current_background_music_max_target_volume", smlua_func_get_current_background_music_max_target_volume); smlua_bind_function(L, "get_current_background_music_target_volume", smlua_func_get_current_background_music_target_volume); + smlua_bind_function(L, "get_sound_pan", smlua_func_get_sound_pan); smlua_bind_function(L, "is_current_background_music_volume_lowered", smlua_func_is_current_background_music_volume_lowered); smlua_bind_function(L, "play_course_clear", smlua_func_play_course_clear); smlua_bind_function(L, "play_dialog_sound", smlua_func_play_dialog_sound); @@ -34230,9 +34335,13 @@ void smlua_bind_functions_autogen(void) { smlua_bind_function(L, "seq_player_lower_volume", smlua_func_seq_player_lower_volume); smlua_bind_function(L, "seq_player_unlower_volume", smlua_func_seq_player_unlower_volume); smlua_bind_function(L, "set_audio_fadeout", smlua_func_set_audio_fadeout); + smlua_bind_function(L, "set_audio_muted", smlua_func_set_audio_muted); + smlua_bind_function(L, "set_sound_moving_speed", smlua_func_set_sound_moving_speed); smlua_bind_function(L, "sound_banks_disable", smlua_func_sound_banks_disable); smlua_bind_function(L, "sound_banks_enable", smlua_func_sound_banks_enable); smlua_bind_function(L, "sound_get_level_intensity", smlua_func_sound_get_level_intensity); + smlua_bind_function(L, "sound_reset_background_music_default_volume", smlua_func_sound_reset_background_music_default_volume); + smlua_bind_function(L, "sound_set_background_music_default_volume", smlua_func_sound_set_background_music_default_volume); smlua_bind_function(L, "stop_background_music", smlua_func_stop_background_music); smlua_bind_function(L, "stop_secondary_music", smlua_func_stop_secondary_music); smlua_bind_function(L, "stop_sound", smlua_func_stop_sound); @@ -35259,9 +35368,10 @@ void smlua_bind_functions_autogen(void) { smlua_bind_function(L, "stop_cap_music", smlua_func_stop_cap_music); smlua_bind_function(L, "stop_shell_music", smlua_func_stop_shell_music); - // spawn_sound.c + // spawn_sound.h smlua_bind_function(L, "calc_dist_to_volume_range_1", smlua_func_calc_dist_to_volume_range_1); smlua_bind_function(L, "calc_dist_to_volume_range_2", smlua_func_calc_dist_to_volume_range_2); + smlua_bind_function(L, "create_sound_spawner", smlua_func_create_sound_spawner); smlua_bind_function(L, "cur_obj_play_sound_1", smlua_func_cur_obj_play_sound_1); smlua_bind_function(L, "cur_obj_play_sound_2", smlua_func_cur_obj_play_sound_2); smlua_bind_function(L, "exec_anim_sound_state", smlua_func_exec_anim_sound_state);