Add tons of new save file / star related functions (#419)

These were needed to port interact_star_or_key to Lua but are also just good to have exposed IMO.
This commit is contained in:
Agent X 2023-06-18 23:04:02 -04:00 committed by GitHub
parent 28d3378b3c
commit 73aa3890fd
11 changed files with 631 additions and 5 deletions

View File

@ -64,10 +64,10 @@ in_files = [
]
override_allowed_functions = {
"src/audio/external.h": [ " play_", "fade", "current_background", "stop_", "sound_banks" ],
"src/audio/external.h": [ " play_", "fade", "current_background", "stop_", "sound_banks", "drop_queued_background_music" ],
"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_reload", "save_file_erase_current_backup_save", "save_file_set_star_flags", "save_file_is_cannon_unlocked" ],
"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" ],
"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

@ -3762,6 +3762,11 @@ function djui_popup_create(message, lines)
-- ...
end
--- @return nil
function drop_queued_background_music()
-- ...
end
--- @param player integer
--- @param targetScale integer
--- @param fadeDuration integer
@ -7841,6 +7846,13 @@ function save_file_clear_flags(flags)
-- ...
end
--- @param fileIndex integer
--- @param forceSave integer
--- @return nil
function save_file_do_save(fileIndex, forceSave)
-- ...
end
--- @return nil
function save_file_erase_current_backup_save()
-- ...
@ -7910,6 +7922,14 @@ function save_file_reload(load_all)
-- ...
end
--- @param fileIndex integer
--- @param courseIndex integer
--- @param coinScore integer
--- @return nil
function save_file_set_course_coin_score(fileIndex, courseIndex, coinScore)
-- ...
end
--- @param flags integer
--- @return nil
function save_file_set_flags(flags)
@ -7924,6 +7944,13 @@ function save_file_set_star_flags(fileIndex, courseIndex, starFlags)
-- ...
end
--- @param fileIndex integer
--- @param courseIndex integer
--- @return nil
function touch_coin_score_age(fileIndex, courseIndex)
-- ...
end
--- @param obj Object
--- @return string
function smlua_anim_util_get_current_animation_name(obj)
@ -8438,6 +8465,11 @@ function get_environment_region(index)
-- ...
end
--- @return boolean
function get_got_file_coin_hi_score()
-- ...
end
--- @param m MarioState
--- @param index integer
--- @return number
@ -8459,6 +8491,16 @@ function get_hand_foot_pos_z(m, index)
-- ...
end
--- @return integer
function get_last_completed_course_num()
-- ...
end
--- @return integer
function get_last_completed_star_num()
-- ...
end
--- @return integer
function get_last_star_or_key()
-- ...
@ -8480,6 +8522,11 @@ function get_os_name()
-- ...
end
--- @return boolean
function get_save_file_modified()
-- ...
end
--- @return integer
function get_skybox()
-- ...
@ -8582,6 +8629,11 @@ function play_transition(transType, time, red, green, blue)
-- ...
end
--- @return boolean
function save_file_get_using_backup_slot()
-- ...
end
--- @param usingBackupSlot boolean
--- @return nil
function save_file_set_using_backup_slot(usingBackupSlot)
@ -8595,6 +8647,24 @@ function set_environment_region(index, value)
-- ...
end
--- @param value boolean
--- @return nil
function set_got_file_coin_hi_score(value)
-- ...
end
--- @param courseNum integer
--- @return nil
function set_last_completed_course_num(courseNum)
-- ...
end
--- @param starNum integer
--- @return nil
function set_last_completed_star_num(starNum)
-- ...
end
--- @param value integer
--- @return nil
function set_last_star_or_key(value)
@ -8638,6 +8708,12 @@ function set_override_skybox(background)
-- ...
end
--- @param value boolean
--- @return nil
function set_save_file_modified(value)
-- ...
end
--- @param speed integer
--- @return nil
function set_ttc_speed_setting(speed)

View File

@ -2495,6 +2495,24 @@
<br />
## [drop_queued_background_music](#drop_queued_background_music)
### Lua Example
`drop_queued_background_music()`
### Parameters
- None
### Returns
- None
### C Prototype
`void drop_queued_background_music(void);`
[:arrow_up_small:](#)
<br />
## [fade_volume_scale](#fade_volume_scale)
### Lua Example

View File

@ -6526,6 +6526,27 @@
<br />
## [save_file_do_save](#save_file_do_save)
### Lua Example
`save_file_do_save(fileIndex, forceSave)`
### Parameters
| Field | Type |
| ----- | ---- |
| fileIndex | `integer` |
| forceSave | `integer` |
### Returns
- None
### C Prototype
`void save_file_do_save(s32 fileIndex, s8 forceSave);`
[:arrow_up_small:](#)
<br />
## [save_file_erase_current_backup_save](#save_file_erase_current_backup_save)
### Lua Example
@ -6746,6 +6767,28 @@
<br />
## [save_file_set_course_coin_score](#save_file_set_course_coin_score)
### Lua Example
`save_file_set_course_coin_score(fileIndex, courseIndex, coinScore)`
### Parameters
| Field | Type |
| ----- | ---- |
| fileIndex | `integer` |
| courseIndex | `integer` |
| coinScore | `integer` |
### Returns
- None
### C Prototype
`void save_file_set_course_coin_score(s32 fileIndex, s32 courseIndex, u8 coinScore);`
[:arrow_up_small:](#)
<br />
## [save_file_set_flags](#save_file_set_flags)
### Lua Example
@ -6788,6 +6831,27 @@
<br />
## [touch_coin_score_age](#touch_coin_score_age)
### Lua Example
`touch_coin_score_age(fileIndex, courseIndex)`
### Parameters
| Field | Type |
| ----- | ---- |
| fileIndex | `integer` |
| courseIndex | `integer` |
### Returns
- None
### C Prototype
`void touch_coin_score_age(s32 fileIndex, s32 courseIndex);`
[:arrow_up_small:](#)
<br />
---
# functions from smlua_anim_utils.h

View File

@ -659,6 +659,24 @@
<br />
## [get_got_file_coin_hi_score](#get_got_file_coin_hi_score)
### Lua Example
`local booleanValue = get_got_file_coin_hi_score()`
### Parameters
- None
### Returns
- `boolean`
### C Prototype
`bool get_got_file_coin_hi_score(void);`
[:arrow_up_small:](#)
<br />
## [get_hand_foot_pos_x](#get_hand_foot_pos_x)
### Lua Example
@ -722,6 +740,42 @@
<br />
## [get_last_completed_course_num](#get_last_completed_course_num)
### Lua Example
`local integerValue = get_last_completed_course_num()`
### Parameters
- None
### Returns
- `integer`
### C Prototype
`u8 get_last_completed_course_num(void);`
[:arrow_up_small:](#)
<br />
## [get_last_completed_star_num](#get_last_completed_star_num)
### Lua Example
`local integerValue = get_last_completed_star_num()`
### Parameters
- None
### Returns
- `integer`
### C Prototype
`u8 get_last_completed_star_num(void);`
[:arrow_up_small:](#)
<br />
## [get_last_star_or_key](#get_last_star_or_key)
### Lua Example
@ -796,6 +850,24 @@
<br />
## [get_save_file_modified](#get_save_file_modified)
### Lua Example
`local booleanValue = get_save_file_modified()`
### Parameters
- None
### Returns
- `boolean`
### C Prototype
`bool get_save_file_modified(void);`
[:arrow_up_small:](#)
<br />
## [get_skybox](#get_skybox)
### Lua Example
@ -1100,6 +1172,24 @@
<br />
## [save_file_get_using_backup_slot](#save_file_get_using_backup_slot)
### Lua Example
`local booleanValue = save_file_get_using_backup_slot()`
### Parameters
- None
### Returns
- `boolean`
### C Prototype
`bool save_file_get_using_backup_slot(void);`
[:arrow_up_small:](#)
<br />
## [save_file_set_using_backup_slot](#save_file_set_using_backup_slot)
### Lua Example
@ -1141,6 +1231,66 @@
<br />
## [set_got_file_coin_hi_score](#set_got_file_coin_hi_score)
### Lua Example
`set_got_file_coin_hi_score(value)`
### Parameters
| Field | Type |
| ----- | ---- |
| value | `boolean` |
### Returns
- None
### C Prototype
`void set_got_file_coin_hi_score(bool value);`
[:arrow_up_small:](#)
<br />
## [set_last_completed_course_num](#set_last_completed_course_num)
### Lua Example
`set_last_completed_course_num(courseNum)`
### Parameters
| Field | Type |
| ----- | ---- |
| courseNum | `integer` |
### Returns
- None
### C Prototype
`void set_last_completed_course_num(u8 courseNum);`
[:arrow_up_small:](#)
<br />
## [set_last_completed_star_num](#set_last_completed_star_num)
### Lua Example
`set_last_completed_star_num(starNum)`
### Parameters
| Field | Type |
| ----- | ---- |
| starNum | `integer` |
### Returns
- None
### C Prototype
`void set_last_completed_star_num(u8 starNum);`
[:arrow_up_small:](#)
<br />
## [set_last_star_or_key](#set_last_star_or_key)
### Lua Example
@ -1282,6 +1432,26 @@
<br />
## [set_save_file_modified](#set_save_file_modified)
### Lua Example
`set_save_file_modified(value)`
### Parameters
| Field | Type |
| ----- | ---- |
| value | `boolean` |
### Returns
- None
### C Prototype
`void set_save_file_modified(bool value);`
[:arrow_up_small:](#)
<br />
## [set_ttc_speed_setting](#set_ttc_speed_setting)
### Lua Example

View File

@ -745,6 +745,7 @@
<br />
- external.h
- [drop_queued_background_music](functions-3.md#drop_queued_background_music)
- [fade_volume_scale](functions-3.md#fade_volume_scale)
- [fadeout_background_music](functions-3.md#fadeout_background_music)
- [get_current_background_music](functions-3.md#get_current_background_music)
@ -1452,6 +1453,7 @@
- save_file.h
- [save_file_clear_flags](functions-4.md#save_file_clear_flags)
- [save_file_do_save](functions-4.md#save_file_do_save)
- [save_file_erase_current_backup_save](functions-4.md#save_file_erase_current_backup_save)
- [save_file_get_cap_pos](functions-4.md#save_file_get_cap_pos)
- [save_file_get_course_coin_score](functions-4.md#save_file_get_course_coin_score)
@ -1463,8 +1465,10 @@
- [save_file_get_total_star_count](functions-4.md#save_file_get_total_star_count)
- [save_file_is_cannon_unlocked](functions-4.md#save_file_is_cannon_unlocked)
- [save_file_reload](functions-4.md#save_file_reload)
- [save_file_set_course_coin_score](functions-4.md#save_file_set_course_coin_score)
- [save_file_set_flags](functions-4.md#save_file_set_flags)
- [save_file_set_star_flags](functions-4.md#save_file_set_star_flags)
- [touch_coin_score_age](functions-4.md#touch_coin_score_age)
<br />
@ -1574,13 +1578,17 @@
- [get_dialog_id](functions-5.md#get_dialog_id)
- [get_envfx](functions-5.md#get_envfx)
- [get_environment_region](functions-5.md#get_environment_region)
- [get_got_file_coin_hi_score](functions-5.md#get_got_file_coin_hi_score)
- [get_hand_foot_pos_x](functions-5.md#get_hand_foot_pos_x)
- [get_hand_foot_pos_y](functions-5.md#get_hand_foot_pos_y)
- [get_hand_foot_pos_z](functions-5.md#get_hand_foot_pos_z)
- [get_last_completed_course_num](functions-5.md#get_last_completed_course_num)
- [get_last_completed_star_num](functions-5.md#get_last_completed_star_num)
- [get_last_star_or_key](functions-5.md#get_last_star_or_key)
- [get_lighting_dir](functions-5.md#get_lighting_dir)
- [get_network_area_timer](functions-5.md#get_network_area_timer)
- [get_os_name](functions-5.md#get_os_name)
- [get_save_file_modified](functions-5.md#get_save_file_modified)
- [get_skybox](functions-5.md#get_skybox)
- [get_temp_s32_pointer](functions-5.md#get_temp_s32_pointer)
- [get_time](functions-5.md#get_time)
@ -1596,8 +1604,12 @@
- [is_transition_playing](functions-5.md#is_transition_playing)
- [movtexqc_register](functions-5.md#movtexqc_register)
- [play_transition](functions-5.md#play_transition)
- [save_file_get_using_backup_slot](functions-5.md#save_file_get_using_backup_slot)
- [save_file_set_using_backup_slot](functions-5.md#save_file_set_using_backup_slot)
- [set_environment_region](functions-5.md#set_environment_region)
- [set_got_file_coin_hi_score](functions-5.md#set_got_file_coin_hi_score)
- [set_last_completed_course_num](functions-5.md#set_last_completed_course_num)
- [set_last_completed_star_num](functions-5.md#set_last_completed_star_num)
- [set_last_star_or_key](functions-5.md#set_last_star_or_key)
- [set_lighting_dir](functions-5.md#set_lighting_dir)
- [set_override_envfx](functions-5.md#set_override_envfx)
@ -1605,6 +1617,7 @@
- [set_override_fov](functions-5.md#set_override_fov)
- [set_override_near](functions-5.md#set_override_near)
- [set_override_skybox](functions-5.md#set_override_skybox)
- [set_save_file_modified](functions-5.md#set_save_file_modified)
- [set_ttc_speed_setting](functions-5.md#set_ttc_speed_setting)
<br />

View File

@ -291,7 +291,7 @@ static void set_coin_score_age(s32 fileIndex, s32 courseIndex, s32 age) {
/**
* Mark a coin score for a save file as the newest out of all save files.
*/
static void touch_coin_score_age(s32 fileIndex, s32 courseIndex) {
void touch_coin_score_age(s32 fileIndex, s32 courseIndex) {
if (INVALID_FILE_INDEX(fileIndex)) { return; }
s32 i;
u32 age;
@ -693,6 +693,10 @@ s32 save_file_get_course_coin_score(s32 fileIndex, s32 courseIndex) {
return gSaveBuffer.files[fileIndex][gSaveFileUsingBackupSlot].courseCoinScores[courseIndex];
}
void save_file_set_course_coin_score(s32 fileIndex, s32 courseIndex, u8 coinScore) {
gSaveBuffer.files[fileIndex][gSaveFileUsingBackupSlot].courseCoinScores[courseIndex] = coinScore;
}
/**
* Return TRUE if the cannon is unlocked in the current course.
*/

View File

@ -129,6 +129,7 @@ extern s8 gMainMenuDataModified;
extern s8 gSaveFileModified;
s8 get_level_course_num(s16 levelNum);
void touch_coin_score_age(s32 fileIndex, s32 courseIndex);
void save_file_do_save(s32 fileIndex, s8 forceSave);
void save_file_erase(s32 fileIndex);
void save_file_erase_current_backup_save(void);
@ -146,6 +147,7 @@ u32 save_file_get_flags(void);
u32 save_file_get_star_flags(s32 fileIndex, s32 courseIndex);
void save_file_set_star_flags(s32 fileIndex, s32 courseIndex, u32 starFlags);
s32 save_file_get_course_coin_score(s32 fileIndex, s32 courseIndex);
void save_file_set_course_coin_score(s32 fileIndex, s32 courseIndex, u8 coinScore);
s32 save_file_is_cannon_unlocked(s32 fileIndex, s32 courseIndex);
void save_file_set_cannon_unlocked(void);
void save_file_set_cap_pos(s16 x, s16 y, s16 z);

View File

@ -12464,6 +12464,21 @@ int smlua_func_djui_popup_create(lua_State* L) {
// external.h //
////////////////
int smlua_func_drop_queued_background_music(UNUSED lua_State* L) {
if (L == NULL) { return 0; }
int top = lua_gettop(L);
if (top != 0) {
LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "drop_queued_background_music", 0, top);
return 0;
}
drop_queued_background_music();
return 1;
}
int smlua_func_fade_volume_scale(lua_State* L) {
if (L == NULL) { return 0; }
@ -26301,6 +26316,25 @@ int smlua_func_save_file_clear_flags(lua_State* L) {
return 1;
}
int smlua_func_save_file_do_save(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", "save_file_do_save", 2, top);
return 0;
}
s32 fileIndex = smlua_to_integer(L, 1);
if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "save_file_do_save"); return 0; }
s8 forceSave = smlua_to_integer(L, 2);
if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 2, "save_file_do_save"); return 0; }
save_file_do_save(fileIndex, forceSave);
return 1;
}
int smlua_func_save_file_erase_current_backup_save(UNUSED lua_State* L) {
if (L == NULL) { return 0; }
@ -26502,6 +26536,27 @@ int smlua_func_save_file_reload(lua_State* L) {
return 1;
}
int smlua_func_save_file_set_course_coin_score(lua_State* L) {
if (L == NULL) { return 0; }
int top = lua_gettop(L);
if (top != 3) {
LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "save_file_set_course_coin_score", 3, top);
return 0;
}
s32 fileIndex = smlua_to_integer(L, 1);
if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "save_file_set_course_coin_score"); return 0; }
s32 courseIndex = smlua_to_integer(L, 2);
if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 2, "save_file_set_course_coin_score"); return 0; }
u8 coinScore = smlua_to_integer(L, 3);
if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 3, "save_file_set_course_coin_score"); return 0; }
save_file_set_course_coin_score(fileIndex, courseIndex, coinScore);
return 1;
}
int smlua_func_save_file_set_flags(lua_State* L) {
if (L == NULL) { return 0; }
@ -26540,6 +26595,25 @@ int smlua_func_save_file_set_star_flags(lua_State* L) {
return 1;
}
int smlua_func_touch_coin_score_age(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", "touch_coin_score_age", 2, top);
return 0;
}
s32 fileIndex = smlua_to_integer(L, 1);
if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "touch_coin_score_age"); return 0; }
s32 courseIndex = smlua_to_integer(L, 2);
if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 2, "touch_coin_score_age"); return 0; }
touch_coin_score_age(fileIndex, courseIndex);
return 1;
}
////////////////////////
// smlua_anim_utils.h //
////////////////////////
@ -28014,6 +28088,21 @@ int smlua_func_get_environment_region(lua_State* L) {
return 1;
}
int smlua_func_get_got_file_coin_hi_score(UNUSED lua_State* L) {
if (L == NULL) { return 0; }
int top = lua_gettop(L);
if (top != 0) {
LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "get_got_file_coin_hi_score", 0, top);
return 0;
}
lua_pushboolean(L, get_got_file_coin_hi_score());
return 1;
}
int smlua_func_get_hand_foot_pos_x(lua_State* L) {
if (L == NULL) { return 0; }
@ -28071,6 +28160,36 @@ int smlua_func_get_hand_foot_pos_z(lua_State* L) {
return 1;
}
int smlua_func_get_last_completed_course_num(UNUSED lua_State* L) {
if (L == NULL) { return 0; }
int top = lua_gettop(L);
if (top != 0) {
LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "get_last_completed_course_num", 0, top);
return 0;
}
lua_pushinteger(L, get_last_completed_course_num());
return 1;
}
int smlua_func_get_last_completed_star_num(UNUSED lua_State* L) {
if (L == NULL) { return 0; }
int top = lua_gettop(L);
if (top != 0) {
LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "get_last_completed_star_num", 0, top);
return 0;
}
lua_pushinteger(L, get_last_completed_star_num());
return 1;
}
int smlua_func_get_last_star_or_key(UNUSED lua_State* L) {
if (L == NULL) { return 0; }
@ -28133,6 +28252,21 @@ int smlua_func_get_os_name(UNUSED lua_State* L) {
return 1;
}
int smlua_func_get_save_file_modified(UNUSED lua_State* L) {
if (L == NULL) { return 0; }
int top = lua_gettop(L);
if (top != 0) {
LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "get_save_file_modified", 0, top);
return 0;
}
lua_pushboolean(L, get_save_file_modified());
return 1;
}
int smlua_func_get_skybox(UNUSED lua_State* L) {
if (L == NULL) { return 0; }
@ -28412,6 +28546,21 @@ int smlua_func_play_transition(lua_State* L) {
return 1;
}
int smlua_func_save_file_get_using_backup_slot(UNUSED lua_State* L) {
if (L == NULL) { return 0; }
int top = lua_gettop(L);
if (top != 0) {
LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "save_file_get_using_backup_slot", 0, top);
return 0;
}
lua_pushboolean(L, save_file_get_using_backup_slot());
return 1;
}
int smlua_func_save_file_set_using_backup_slot(lua_State* L) {
if (L == NULL) { return 0; }
@ -28448,6 +28597,57 @@ int smlua_func_set_environment_region(lua_State* L) {
return 1;
}
int smlua_func_set_got_file_coin_hi_score(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_got_file_coin_hi_score", 1, top);
return 0;
}
bool value = smlua_to_boolean(L, 1);
if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "set_got_file_coin_hi_score"); return 0; }
set_got_file_coin_hi_score(value);
return 1;
}
int smlua_func_set_last_completed_course_num(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_last_completed_course_num", 1, top);
return 0;
}
u8 courseNum = smlua_to_integer(L, 1);
if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "set_last_completed_course_num"); return 0; }
set_last_completed_course_num(courseNum);
return 1;
}
int smlua_func_set_last_completed_star_num(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_last_completed_star_num", 1, top);
return 0;
}
u8 starNum = smlua_to_integer(L, 1);
if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "set_last_completed_star_num"); return 0; }
set_last_completed_star_num(starNum);
return 1;
}
int smlua_func_set_last_star_or_key(lua_State* L) {
if (L == NULL) { return 0; }
@ -28569,6 +28769,23 @@ int smlua_func_set_override_skybox(lua_State* L) {
return 1;
}
int smlua_func_set_save_file_modified(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_save_file_modified", 1, top);
return 0;
}
bool value = smlua_to_boolean(L, 1);
if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "set_save_file_modified"); return 0; }
set_save_file_modified(value);
return 1;
}
int smlua_func_set_ttc_speed_setting(lua_State* L) {
if (L == NULL) { return 0; }
@ -30816,6 +31033,7 @@ void smlua_bind_functions_autogen(void) {
smlua_bind_function(L, "djui_popup_create", smlua_func_djui_popup_create);
// external.h
smlua_bind_function(L, "drop_queued_background_music", smlua_func_drop_queued_background_music);
smlua_bind_function(L, "fade_volume_scale", smlua_func_fade_volume_scale);
smlua_bind_function(L, "fadeout_background_music", smlua_func_fadeout_background_music);
smlua_bind_function(L, "get_current_background_music", smlua_func_get_current_background_music);
@ -31486,6 +31704,7 @@ void smlua_bind_functions_autogen(void) {
// save_file.h
smlua_bind_function(L, "save_file_clear_flags", smlua_func_save_file_clear_flags);
smlua_bind_function(L, "save_file_do_save", smlua_func_save_file_do_save);
smlua_bind_function(L, "save_file_erase_current_backup_save", smlua_func_save_file_erase_current_backup_save);
smlua_bind_function(L, "save_file_get_cap_pos", smlua_func_save_file_get_cap_pos);
smlua_bind_function(L, "save_file_get_course_coin_score", smlua_func_save_file_get_course_coin_score);
@ -31497,8 +31716,10 @@ 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_is_cannon_unlocked", smlua_func_save_file_is_cannon_unlocked);
smlua_bind_function(L, "save_file_reload", smlua_func_save_file_reload);
smlua_bind_function(L, "save_file_set_course_coin_score", smlua_func_save_file_set_course_coin_score);
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_bind_function(L, "touch_coin_score_age", smlua_func_touch_coin_score_age);
// smlua_anim_utils.h
smlua_bind_function(L, "smlua_anim_util_get_current_animation_name", smlua_func_smlua_anim_util_get_current_animation_name);
@ -31595,13 +31816,17 @@ void smlua_bind_functions_autogen(void) {
smlua_bind_function(L, "get_dialog_id", smlua_func_get_dialog_id);
smlua_bind_function(L, "get_envfx", smlua_func_get_envfx);
smlua_bind_function(L, "get_environment_region", smlua_func_get_environment_region);
smlua_bind_function(L, "get_got_file_coin_hi_score", smlua_func_get_got_file_coin_hi_score);
smlua_bind_function(L, "get_hand_foot_pos_x", smlua_func_get_hand_foot_pos_x);
smlua_bind_function(L, "get_hand_foot_pos_y", smlua_func_get_hand_foot_pos_y);
smlua_bind_function(L, "get_hand_foot_pos_z", smlua_func_get_hand_foot_pos_z);
smlua_bind_function(L, "get_last_completed_course_num", smlua_func_get_last_completed_course_num);
smlua_bind_function(L, "get_last_completed_star_num", smlua_func_get_last_completed_star_num);
smlua_bind_function(L, "get_last_star_or_key", smlua_func_get_last_star_or_key);
smlua_bind_function(L, "get_lighting_dir", smlua_func_get_lighting_dir);
smlua_bind_function(L, "get_network_area_timer", smlua_func_get_network_area_timer);
smlua_bind_function(L, "get_os_name", smlua_func_get_os_name);
smlua_bind_function(L, "get_save_file_modified", smlua_func_get_save_file_modified);
smlua_bind_function(L, "get_skybox", smlua_func_get_skybox);
smlua_bind_function(L, "get_temp_s32_pointer", smlua_func_get_temp_s32_pointer);
smlua_bind_function(L, "get_time", smlua_func_get_time);
@ -31617,8 +31842,12 @@ void smlua_bind_functions_autogen(void) {
smlua_bind_function(L, "is_transition_playing", smlua_func_is_transition_playing);
smlua_bind_function(L, "movtexqc_register", smlua_func_movtexqc_register);
smlua_bind_function(L, "play_transition", smlua_func_play_transition);
smlua_bind_function(L, "save_file_get_using_backup_slot", smlua_func_save_file_get_using_backup_slot);
smlua_bind_function(L, "save_file_set_using_backup_slot", smlua_func_save_file_set_using_backup_slot);
smlua_bind_function(L, "set_environment_region", smlua_func_set_environment_region);
smlua_bind_function(L, "set_got_file_coin_hi_score", smlua_func_set_got_file_coin_hi_score);
smlua_bind_function(L, "set_last_completed_course_num", smlua_func_set_last_completed_course_num);
smlua_bind_function(L, "set_last_completed_star_num", smlua_func_set_last_completed_star_num);
smlua_bind_function(L, "set_last_star_or_key", smlua_func_set_last_star_or_key);
smlua_bind_function(L, "set_lighting_dir", smlua_func_set_lighting_dir);
smlua_bind_function(L, "set_override_envfx", smlua_func_set_override_envfx);
@ -31626,6 +31855,7 @@ void smlua_bind_functions_autogen(void) {
smlua_bind_function(L, "set_override_fov", smlua_func_set_override_fov);
smlua_bind_function(L, "set_override_near", smlua_func_set_override_near);
smlua_bind_function(L, "set_override_skybox", smlua_func_set_override_skybox);
smlua_bind_function(L, "set_save_file_modified", smlua_func_set_save_file_modified);
smlua_bind_function(L, "set_ttc_speed_setting", smlua_func_set_ttc_speed_setting);
// smlua_model_utils.h

View File

@ -70,6 +70,42 @@ void set_last_star_or_key(u8 value) {
gLastCollectedStarOrKey = value;
}
extern u8 gLastCompletedCourseNum;
u8 get_last_completed_course_num(void) {
return gLastCompletedCourseNum;
}
void set_last_completed_course_num(u8 courseNum) {
gLastCompletedCourseNum = courseNum;
}
extern u8 gLastCompletedStarNum;
u8 get_last_completed_star_num(void) {
return gLastCompletedStarNum;
}
void set_last_completed_star_num(u8 starNum) {
gLastCompletedStarNum = starNum;
}
extern u8 gGotFileCoinHiScore;
bool get_got_file_coin_hi_score(void) {
return gGotFileCoinHiScore;
}
void set_got_file_coin_hi_score(bool value) {
gGotFileCoinHiScore = value ? TRUE : FALSE;
}
extern s8 gSaveFileModified;
bool get_save_file_modified(void) {
return gSaveFileModified;
}
void set_save_file_modified(bool value) {
gSaveFileModified = value ? TRUE : FALSE;
}
extern s8 gDialogBoxState;
s8 get_dialog_box_state() {
return gDialogBoxState;
@ -420,9 +456,13 @@ s16 get_current_save_file_num(void) {
return gCurrSaveFileNum;
}
extern u8 gSaveFileUsingBackupSlot;
bool save_file_get_using_backup_slot(void) {
return gSaveFileUsingBackupSlot;
}
void save_file_set_using_backup_slot(bool usingBackupSlot) {
extern u8 gSaveFileUsingBackupSlot;
gSaveFileUsingBackupSlot = usingBackupSlot ? 1 : 0;
gSaveFileUsingBackupSlot = usingBackupSlot ? TRUE : FALSE;
}
///

View File

@ -75,6 +75,14 @@ s8 get_dialog_box_state();
s16 get_dialog_id(void);
s32 get_last_star_or_key(void);
void set_last_star_or_key(u8 value);
u8 get_last_completed_course_num(void);
void set_last_completed_course_num(u8 courseNum);
u8 get_last_completed_star_num(void);
void set_last_completed_star_num(u8 starNum);
bool get_got_file_coin_hi_score(void);
void set_got_file_coin_hi_score(bool value);
bool get_save_file_modified(void);
void set_save_file_modified(bool value);
u32 allocate_mario_action(u32 actFlags);
@ -83,6 +91,7 @@ f32 get_hand_foot_pos_y(struct MarioState* m, u8 index);
f32 get_hand_foot_pos_z(struct MarioState* m, u8 index);
s16 get_current_save_file_num(void);
bool save_file_get_using_backup_slot(void);
void save_file_set_using_backup_slot(bool usingBackupSlot);
void movtexqc_register(const char* name, s16 level, s16 area, s16 type);