Expose save star flag (#139)

* added save_file_set_star_flags and save_reload
This commit is contained in:
Emerald Lockdown 2022-08-07 22:53:42 -05:00 committed by GitHub
parent 670acc638e
commit 93bdbf81c3
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 48 additions and 1 deletions

View file

@ -58,7 +58,7 @@ override_allowed_functions = {
"src/audio/external.h": [ " play_", "fade", "current_background" ],
"src/game/rumble_init.c": [ "queue_rumble_", "reset_rumble_timers" ],
"src/pc/djui/djui_popup.h" : [ "create" ],
"src/game/save_file.h": [ "save_file_get_", "save_file_set_flags", "save_file_clear_flags", "save_file_erase", "save_file_reload" ],
"src/game/save_file.h": [ "save_file_get_", "save_file_set_flags", "save_file_clear_flags", "save_file_erase", "save_file_reload", "save_file_set_star_flags" ],
"src/pc/lua/utils/smlua_model_utils.h": [ "smlua_model_util_get_id" ],
"src/game/object_list_processor.h": [ "set_object_respawn_info_bits" ],
"src/game/mario_misc.h": [ "bhv_toad.*", "bhv_unlock_door.*" ],

View file

@ -7271,6 +7271,14 @@ function save_file_set_flags(flags)
-- ...
end
--- @param fileIndex integer
--- @param courseIndex integer
--- @param starFlags integer
--- @return nil
function save_file_set_star_flags(fileIndex, courseIndex, starFlags)
-- ...
end
--- @param audio BassAudio
--- @return nil
function audio_sample_destroy(audio)

View file

@ -5583,6 +5583,28 @@
<br />
## [save_file_set_star_flags](#save_file_set_star_flags)
### Lua Example
`save_file_set_star_flags(fileIndex, courseIndex, starFlags)`
### Parameters
| Field | Type |
| ----- | ---- |
| fileIndex | `integer` |
| courseIndex | `integer` |
| starFlags | `integer` |
### Returns
- None
### C Prototype
`void save_file_set_star_flags(s32 fileIndex, s32 courseIndex, u32 starFlags);`
[:arrow_up_small:](#)
<br />
---
# functions from smlua_audio_utils.h

View file

@ -1350,6 +1350,7 @@
- [save_file_get_total_star_count](functions-4.md#save_file_get_total_star_count)
- [save_file_reload](functions-4.md#save_file_reload)
- [save_file_set_flags](functions-4.md#save_file_set_flags)
- [save_file_set_star_flags](functions-4.md#save_file_set_star_flags)
<br />

View file

@ -16125,6 +16125,21 @@ int smlua_func_save_file_set_flags(lua_State* L) {
return 1;
}
int smlua_func_save_file_set_star_flags(lua_State* L) {
if(!smlua_functions_valid_param_count(L, 3)) { return 0; }
s32 fileIndex = smlua_to_integer(L, 1);
if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1"); return 0; }
s32 courseIndex = smlua_to_integer(L, 2);
if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 2"); return 0; }
u32 starFlags = smlua_to_integer(L, 3);
if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 3"); return 0; }
save_file_set_star_flags(fileIndex, courseIndex, starFlags);
return 1;
}
/////////////////////////
// smlua_audio_utils.h //
/////////////////////////
@ -19287,6 +19302,7 @@ void smlua_bind_functions_autogen(void) {
smlua_bind_function(L, "save_file_get_total_star_count", smlua_func_save_file_get_total_star_count);
smlua_bind_function(L, "save_file_reload", smlua_func_save_file_reload);
smlua_bind_function(L, "save_file_set_flags", smlua_func_save_file_set_flags);
smlua_bind_function(L, "save_file_set_star_flags", smlua_func_save_file_set_star_flags);
// smlua_audio_utils.h
smlua_bind_function(L, "audio_sample_destroy", smlua_func_audio_sample_destroy);