sequence_player_set_tempo, sequence_player_set_transposition (#224)

* Made Sequence function

* snake case
This commit is contained in:
Blockyyy 2024-07-22 00:56:18 +02:00 committed by GitHub
parent 73e9dd2c40
commit 1ac9ce8e4c
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
7 changed files with 329 additions and 2 deletions

View File

@ -66,7 +66,8 @@ in_files = [
"src/engine/level_script.h",
"src/game/ingame_menu.h",
"src/game/first_person_cam.h",
"src/engine/behavior_script.h"
"src/engine/behavior_script.h",
"src/audio/seqplayer.h"
]
override_allowed_functions = {
@ -81,7 +82,8 @@ override_allowed_functions = {
"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" ],
"src/game/area.h": [ "area_get_warp_node" ],
"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", "close_dialog_box", ]
"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", "close_dialog_box", ],
"src/audio/seqplayer.h": [ "sequence_player_set_tempo", "sequence_player_set_tempo_acc", "sequence_player_set_transposition", "sequence_player_get_tempo", "sequence_player_get_tempo_acc", "sequence_player_get_transposition" ]
}
override_disallowed_functions = {

View File

@ -7523,6 +7523,42 @@ function touch_coin_score_age(fileIndex, courseIndex)
-- ...
end
--- @param player integer
--- @return integer
function sequence_player_get_tempo(player)
-- ...
end
--- @param player integer
--- @return integer
function sequence_player_get_tempo_acc(player)
-- ...
end
--- @param player integer
--- @return integer
function sequence_player_get_transposition(player)
-- ...
end
--- @param player integer
--- @param tempo integer
function sequence_player_set_tempo(player, tempo)
-- ...
end
--- @param player integer
--- @param tempoAcc integer
function sequence_player_set_tempo_acc(player, tempoAcc)
-- ...
end
--- @param player integer
--- @param transposition integer
function sequence_player_set_transposition(player, transposition)
-- ...
end
--- @param index integer
--- @return Animation
function get_mario_vanilla_animation(index)

View File

@ -8391,6 +8391,135 @@
<br />
---
# functions from seqplayer.h
<br />
## [sequence_player_get_tempo](#sequence_player_get_tempo)
### Lua Example
`local integerValue = sequence_player_get_tempo(player)`
### Parameters
| Field | Type |
| ----- | ---- |
| player | `integer` |
### Returns
- `integer`
### C Prototype
`u16 sequence_player_get_tempo(u8 player);`
[:arrow_up_small:](#)
<br />
## [sequence_player_get_tempo_acc](#sequence_player_get_tempo_acc)
### Lua Example
`local integerValue = sequence_player_get_tempo_acc(player)`
### Parameters
| Field | Type |
| ----- | ---- |
| player | `integer` |
### Returns
- `integer`
### C Prototype
`u16 sequence_player_get_tempo_acc(u8 player);`
[:arrow_up_small:](#)
<br />
## [sequence_player_get_transposition](#sequence_player_get_transposition)
### Lua Example
`local integerValue = sequence_player_get_transposition(player)`
### Parameters
| Field | Type |
| ----- | ---- |
| player | `integer` |
### Returns
- `integer`
### C Prototype
`u16 sequence_player_get_transposition(u8 player);`
[:arrow_up_small:](#)
<br />
## [sequence_player_set_tempo](#sequence_player_set_tempo)
### Lua Example
`sequence_player_set_tempo(player, tempo)`
### Parameters
| Field | Type |
| ----- | ---- |
| player | `integer` |
| tempo | `integer` |
### Returns
- None
### C Prototype
`void sequence_player_set_tempo(u8 player, u16 tempo);`
[:arrow_up_small:](#)
<br />
## [sequence_player_set_tempo_acc](#sequence_player_set_tempo_acc)
### Lua Example
`sequence_player_set_tempo_acc(player, tempoAcc)`
### Parameters
| Field | Type |
| ----- | ---- |
| player | `integer` |
| tempoAcc | `integer` |
### Returns
- None
### C Prototype
`void sequence_player_set_tempo_acc(u8 player, u16 tempoAcc);`
[:arrow_up_small:](#)
<br />
## [sequence_player_set_transposition](#sequence_player_set_transposition)
### Lua Example
`sequence_player_set_transposition(player, transposition)`
### Parameters
| Field | Type |
| ----- | ---- |
| player | `integer` |
| transposition | `integer` |
### Returns
- None
### C Prototype
`void sequence_player_set_transposition(u8 player, u16 transposition);`
[:arrow_up_small:](#)
<br />
---
# functions from smlua_anim_utils.h

View File

@ -1577,6 +1577,16 @@
<br />
- seqplayer.h
- [sequence_player_get_tempo](functions-4.md#sequence_player_get_tempo)
- [sequence_player_get_tempo_acc](functions-4.md#sequence_player_get_tempo_acc)
- [sequence_player_get_transposition](functions-4.md#sequence_player_get_transposition)
- [sequence_player_set_tempo](functions-4.md#sequence_player_set_tempo)
- [sequence_player_set_tempo_acc](functions-4.md#sequence_player_set_tempo_acc)
- [sequence_player_set_transposition](functions-4.md#sequence_player_set_transposition)
<br />
- smlua_anim_utils.h
- [get_mario_vanilla_animation](functions-4.md#get_mario_vanilla_animation)
- [smlua_anim_util_get_current_animation_name](functions-4.md#smlua_anim_util_get_current_animation_name)

View File

@ -3039,3 +3039,26 @@ void init_sequence_players(void) {
}
}
void sequence_player_set_tempo(u8 player, u16 tempo) {
gSequencePlayers[player].tempo = tempo;
}
void sequence_player_set_tempo_acc(u8 player, u16 tempoAcc) {
gSequencePlayers[player].tempoAcc = tempoAcc;
}
void sequence_player_set_transposition(u8 player, u16 transposition) {
gSequencePlayers[player].transposition = transposition;
}
u16 sequence_player_get_tempo(u8 player) {
return gSequencePlayers[player].tempo;
}
u16 sequence_player_get_tempo_acc(u8 player) {
return gSequencePlayers[player].tempoAcc;
}
u16 sequence_player_get_transposition(u8 player) {
return gSequencePlayers[player].transposition;
}

View File

@ -15,5 +15,11 @@ 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);
u16 sequence_player_get_tempo(u8 player);
u16 sequence_player_get_tempo_acc(u8 player);
u16 sequence_player_get_transposition(u8 player);
#endif // AUDIO_SEQPLAYER_H

View File

@ -46,6 +46,7 @@
#include "src/game/ingame_menu.h"
#include "src/game/first_person_cam.h"
#include "src/engine/behavior_script.h"
#include "src/audio/seqplayer.h"
////////////
@ -28107,6 +28108,118 @@ int smlua_func_touch_coin_score_age(lua_State* L) {
return 1;
}
/////////////////
// seqplayer.h //
/////////////////
int smlua_func_sequence_player_get_tempo(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", "sequence_player_get_tempo", 1, top);
return 0;
}
u8 player = smlua_to_integer(L, 1);
if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "sequence_player_get_tempo"); return 0; }
lua_pushinteger(L, sequence_player_get_tempo(player));
return 1;
}
int smlua_func_sequence_player_get_tempo_acc(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", "sequence_player_get_tempo_acc", 1, top);
return 0;
}
u8 player = smlua_to_integer(L, 1);
if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "sequence_player_get_tempo_acc"); return 0; }
lua_pushinteger(L, sequence_player_get_tempo_acc(player));
return 1;
}
int smlua_func_sequence_player_get_transposition(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", "sequence_player_get_transposition", 1, top);
return 0;
}
u8 player = smlua_to_integer(L, 1);
if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "sequence_player_get_transposition"); return 0; }
lua_pushinteger(L, sequence_player_get_transposition(player));
return 1;
}
int smlua_func_sequence_player_set_tempo(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", "sequence_player_set_tempo", 2, top);
return 0;
}
u8 player = smlua_to_integer(L, 1);
if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "sequence_player_set_tempo"); return 0; }
u16 tempo = smlua_to_integer(L, 2);
if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 2, "sequence_player_set_tempo"); return 0; }
sequence_player_set_tempo(player, tempo);
return 1;
}
int smlua_func_sequence_player_set_tempo_acc(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", "sequence_player_set_tempo_acc", 2, top);
return 0;
}
u8 player = smlua_to_integer(L, 1);
if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "sequence_player_set_tempo_acc"); return 0; }
u16 tempoAcc = smlua_to_integer(L, 2);
if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 2, "sequence_player_set_tempo_acc"); return 0; }
sequence_player_set_tempo_acc(player, tempoAcc);
return 1;
}
int smlua_func_sequence_player_set_transposition(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", "sequence_player_set_transposition", 2, top);
return 0;
}
u8 player = smlua_to_integer(L, 1);
if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "sequence_player_set_transposition"); return 0; }
u16 transposition = smlua_to_integer(L, 2);
if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 2, "sequence_player_set_transposition"); return 0; }
sequence_player_set_transposition(player, transposition);
return 1;
}
////////////////////////
// smlua_anim_utils.h //
////////////////////////
@ -34397,6 +34510,14 @@ void smlua_bind_functions_autogen(void) {
smlua_bind_function(L, "save_file_set_star_flags", smlua_func_save_file_set_star_flags);
smlua_bind_function(L, "touch_coin_score_age", smlua_func_touch_coin_score_age);
// seqplayer.h
smlua_bind_function(L, "sequence_player_get_tempo", smlua_func_sequence_player_get_tempo);
smlua_bind_function(L, "sequence_player_get_tempo_acc", smlua_func_sequence_player_get_tempo_acc);
smlua_bind_function(L, "sequence_player_get_transposition", smlua_func_sequence_player_get_transposition);
smlua_bind_function(L, "sequence_player_set_tempo", smlua_func_sequence_player_set_tempo);
smlua_bind_function(L, "sequence_player_set_tempo_acc", smlua_func_sequence_player_set_tempo_acc);
smlua_bind_function(L, "sequence_player_set_transposition", smlua_func_sequence_player_set_transposition);
// smlua_anim_utils.h
smlua_bind_function(L, "get_mario_vanilla_animation", smlua_func_get_mario_vanilla_animation);
smlua_bind_function(L, "smlua_anim_util_get_current_animation_name", smlua_func_smlua_anim_util_get_current_animation_name);