Add save file flag functions to lua api (#41)
This commit is contained in:
parent
acd14c2718
commit
65df754b09
|
@ -29,6 +29,7 @@ in_files = [
|
|||
"src/engine/graph_node.h",
|
||||
"levels/level_defines.h",
|
||||
"src/game/obj_behaviors.c",
|
||||
"src/game/save_file.h",
|
||||
]
|
||||
|
||||
exclude_constants = {
|
||||
|
|
|
@ -52,7 +52,7 @@ override_allowed_functions = {
|
|||
"src/game/camera.h": [ "set_.*camera_.*shake", "set_camera_mode" ],
|
||||
"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_" ],
|
||||
"src/game/save_file.h": [ "save_file_get_", "save_file_set_flags", "save_file_clear_flags" ],
|
||||
"src/pc/lua/utils/smlua_model_utils.h": [ "smlua_model_util_get_id" ],
|
||||
}
|
||||
|
||||
|
|
|
@ -4208,6 +4208,104 @@ Y_BUTTON = CONT_Y
|
|||
--- @type integer
|
||||
Z_TRIG = CONT_G
|
||||
|
||||
--- @type integer
|
||||
EEPROM_SIZE = 0x200
|
||||
|
||||
--- @type integer
|
||||
NUM_SAVE_FILES = 4
|
||||
|
||||
--- @type integer
|
||||
SAVE_FLAG_CAP_ON_GROUND = (1 << 16)
|
||||
|
||||
--- @type integer
|
||||
SAVE_FLAG_CAP_ON_KLEPTO = (1 << 17)
|
||||
|
||||
--- @type integer
|
||||
SAVE_FLAG_CAP_ON_MR_BLIZZARD = (1 << 19)
|
||||
|
||||
--- @type integer
|
||||
SAVE_FLAG_CAP_ON_UKIKI = (1 << 18)
|
||||
|
||||
--- @type integer
|
||||
SAVE_FLAG_COLLECTED_MIPS_STAR_1 = (1 << 27)
|
||||
|
||||
--- @type integer
|
||||
SAVE_FLAG_COLLECTED_MIPS_STAR_2 = (1 << 28)
|
||||
|
||||
--- @type integer
|
||||
SAVE_FLAG_COLLECTED_TOAD_STAR_1 = (1 << 24)
|
||||
|
||||
--- @type integer
|
||||
SAVE_FLAG_COLLECTED_TOAD_STAR_2 = (1 << 25)
|
||||
|
||||
--- @type integer
|
||||
SAVE_FLAG_COLLECTED_TOAD_STAR_3 = (1 << 26)
|
||||
|
||||
--- @type integer
|
||||
SAVE_FLAG_DDD_MOVED_BACK = (1 << 8)
|
||||
|
||||
--- @type integer
|
||||
SAVE_FLAG_FILE_EXISTS = (1 << 0)
|
||||
|
||||
--- @type integer
|
||||
SAVE_FLAG_HAVE_KEY_1 = (1 << 4)
|
||||
|
||||
--- @type integer
|
||||
SAVE_FLAG_HAVE_KEY_2 = (1 << 5)
|
||||
|
||||
--- @type integer
|
||||
SAVE_FLAG_HAVE_METAL_CAP = (1 << 2)
|
||||
|
||||
--- @type integer
|
||||
SAVE_FLAG_HAVE_VANISH_CAP = (1 << 3)
|
||||
|
||||
--- @type integer
|
||||
SAVE_FLAG_HAVE_WING_CAP = (1 << 1)
|
||||
|
||||
--- @type integer
|
||||
SAVE_FLAG_MOAT_DRAINED = (1 << 9)
|
||||
|
||||
--- @type integer
|
||||
SAVE_FLAG_UNLOCKED_50_STAR_DOOR = (1 << 20)
|
||||
|
||||
--- @type integer
|
||||
SAVE_FLAG_UNLOCKED_BASEMENT_DOOR = (1 << 6)
|
||||
|
||||
--- @type integer
|
||||
SAVE_FLAG_UNLOCKED_BITDW_DOOR = (1 << 14)
|
||||
|
||||
--- @type integer
|
||||
SAVE_FLAG_UNLOCKED_BITFS_DOOR = (1 << 15)
|
||||
|
||||
--- @type integer
|
||||
SAVE_FLAG_UNLOCKED_CCM_DOOR = (1 << 12)
|
||||
|
||||
--- @type integer
|
||||
SAVE_FLAG_UNLOCKED_JRB_DOOR = (1 << 13)
|
||||
|
||||
--- @type integer
|
||||
SAVE_FLAG_UNLOCKED_PSS_DOOR = (1 << 10)
|
||||
|
||||
--- @type integer
|
||||
SAVE_FLAG_UNLOCKED_UPSTAIRS_DOOR = (1 << 7)
|
||||
|
||||
--- @type integer
|
||||
SAVE_FLAG_UNLOCKED_WF_DOOR = (1 << 11)
|
||||
|
||||
--- @class SaveFileIndex
|
||||
|
||||
--- @type SaveFileIndex
|
||||
SAVE_FILE_A = 0
|
||||
|
||||
--- @type SaveFileIndex
|
||||
SAVE_FILE_B = 1
|
||||
|
||||
--- @type SaveFileIndex
|
||||
SAVE_FILE_C = 2
|
||||
|
||||
--- @type SaveFileIndex
|
||||
SAVE_FILE_D = 3
|
||||
|
||||
--- @type integer
|
||||
ACT_AIR_HIT_WALL = 0x000008A7
|
||||
|
||||
|
|
|
@ -3427,6 +3427,12 @@ function reset_rumble_timers_2(m, a0)
|
|||
-- ...
|
||||
end
|
||||
|
||||
--- @param flags integer
|
||||
--- @return nil
|
||||
function save_file_clear_flags(flags)
|
||||
-- ...
|
||||
end
|
||||
|
||||
--- @param capPos Vec3s
|
||||
--- @return integer
|
||||
function save_file_get_cap_pos(capPos)
|
||||
|
@ -3478,6 +3484,12 @@ function save_file_get_total_star_count(fileIndex, minCourse, maxCourse)
|
|||
-- ...
|
||||
end
|
||||
|
||||
--- @param flags integer
|
||||
--- @return nil
|
||||
function save_file_set_flags(flags)
|
||||
-- ...
|
||||
end
|
||||
|
||||
--- @param startX number
|
||||
--- @param startY number
|
||||
--- @param startZ number
|
||||
|
|
|
@ -31,6 +31,8 @@
|
|||
- [object_list_processor.h](#object_list_processorh)
|
||||
- [enum ObjectList](#enum-ObjectList)
|
||||
- [os_cont.h](#os_conth)
|
||||
- [save_file.h](#save_fileh)
|
||||
- [enum SaveFileIndex](#enum-SaveFileIndex)
|
||||
- [sm64.h](#sm64h)
|
||||
- [smlua_hooks.h](#smlua_hooksh)
|
||||
- [enum LuaHookedEventType](#enum-LuaHookedEventType)
|
||||
|
@ -1495,6 +1497,48 @@
|
|||
|
||||
<br />
|
||||
|
||||
## [save_file.h](#save_file.h)
|
||||
- EEPROM_SIZE
|
||||
- NUM_SAVE_FILES
|
||||
- SAVE_FLAG_CAP_ON_GROUND
|
||||
- SAVE_FLAG_CAP_ON_KLEPTO
|
||||
- SAVE_FLAG_CAP_ON_MR_BLIZZARD
|
||||
- SAVE_FLAG_CAP_ON_UKIKI
|
||||
- SAVE_FLAG_COLLECTED_MIPS_STAR_1
|
||||
- SAVE_FLAG_COLLECTED_MIPS_STAR_2
|
||||
- SAVE_FLAG_COLLECTED_TOAD_STAR_1
|
||||
- SAVE_FLAG_COLLECTED_TOAD_STAR_2
|
||||
- SAVE_FLAG_COLLECTED_TOAD_STAR_3
|
||||
- SAVE_FLAG_DDD_MOVED_BACK
|
||||
- SAVE_FLAG_FILE_EXISTS
|
||||
- SAVE_FLAG_HAVE_KEY_1
|
||||
- SAVE_FLAG_HAVE_KEY_2
|
||||
- SAVE_FLAG_HAVE_METAL_CAP
|
||||
- SAVE_FLAG_HAVE_VANISH_CAP
|
||||
- SAVE_FLAG_HAVE_WING_CAP
|
||||
- SAVE_FLAG_MOAT_DRAINED
|
||||
- SAVE_FLAG_UNLOCKED_50_STAR_DOOR
|
||||
- SAVE_FLAG_UNLOCKED_BASEMENT_DOOR
|
||||
- SAVE_FLAG_UNLOCKED_BITDW_DOOR
|
||||
- SAVE_FLAG_UNLOCKED_BITFS_DOOR
|
||||
- SAVE_FLAG_UNLOCKED_CCM_DOOR
|
||||
- SAVE_FLAG_UNLOCKED_JRB_DOOR
|
||||
- SAVE_FLAG_UNLOCKED_PSS_DOOR
|
||||
- SAVE_FLAG_UNLOCKED_UPSTAIRS_DOOR
|
||||
- SAVE_FLAG_UNLOCKED_WF_DOOR
|
||||
|
||||
### [enum SaveFileIndex](#SaveFileIndex)
|
||||
| Identifier | Value |
|
||||
| :--------- | :---- |
|
||||
| SAVE_FILE_A | 0 |
|
||||
| SAVE_FILE_B | 1 |
|
||||
| SAVE_FILE_C | 2 |
|
||||
| SAVE_FILE_D | 3 |
|
||||
|
||||
[:arrow_up_small:](#)
|
||||
|
||||
<br />
|
||||
|
||||
## [sm64.h](#sm64.h)
|
||||
- ACT_AIR_HIT_WALL
|
||||
- ACT_AIR_THROW
|
||||
|
|
|
@ -619,6 +619,7 @@
|
|||
<br />
|
||||
|
||||
- save_file.h
|
||||
- [save_file_clear_flags](#save_file_clear_flags)
|
||||
- [save_file_get_cap_pos](#save_file_get_cap_pos)
|
||||
- [save_file_get_course_coin_score](#save_file_get_course_coin_score)
|
||||
- [save_file_get_course_star_count](#save_file_get_course_star_count)
|
||||
|
@ -627,6 +628,7 @@
|
|||
- [save_file_get_sound_mode](#save_file_get_sound_mode)
|
||||
- [save_file_get_star_flags](#save_file_get_star_flags)
|
||||
- [save_file_get_total_star_count](#save_file_get_total_star_count)
|
||||
- [save_file_set_flags](#save_file_set_flags)
|
||||
|
||||
<br />
|
||||
|
||||
|
@ -11464,6 +11466,26 @@ The `reliable` field will ensure that the packet arrives, but should be used spa
|
|||
<br />
|
||||
|
||||
|
||||
## [save_file_clear_flags](#save_file_clear_flags)
|
||||
|
||||
### Lua Example
|
||||
`save_file_clear_flags(flags)`
|
||||
|
||||
### Parameters
|
||||
| Field | Type |
|
||||
| ----- | ---- |
|
||||
| flags | `integer` |
|
||||
|
||||
### Returns
|
||||
- None
|
||||
|
||||
### C Prototype
|
||||
`void save_file_clear_flags(u32 flags);`
|
||||
|
||||
[:arrow_up_small:](#)
|
||||
|
||||
<br />
|
||||
|
||||
## [save_file_get_cap_pos](#save_file_get_cap_pos)
|
||||
|
||||
### Lua Example
|
||||
|
@ -11625,6 +11647,26 @@ The `reliable` field will ensure that the packet arrives, but should be used spa
|
|||
|
||||
<br />
|
||||
|
||||
## [save_file_set_flags](#save_file_set_flags)
|
||||
|
||||
### Lua Example
|
||||
`save_file_set_flags(flags)`
|
||||
|
||||
### Parameters
|
||||
| Field | Type |
|
||||
| ----- | ---- |
|
||||
| flags | `integer` |
|
||||
|
||||
### Returns
|
||||
- None
|
||||
|
||||
### C Prototype
|
||||
`void save_file_set_flags(u32 flags);`
|
||||
|
||||
[:arrow_up_small:](#)
|
||||
|
||||
<br />
|
||||
|
||||
---
|
||||
# functions from smlua_collision_utils.h
|
||||
|
||||
|
|
|
@ -1546,6 +1546,38 @@ char gSmluaConstants[] = ""
|
|||
"L_CBUTTONS = CONT_C\n"
|
||||
"R_CBUTTONS = CONT_F\n"
|
||||
"D_CBUTTONS = CONT_D\n"
|
||||
"EEPROM_SIZE = 0x200\n"
|
||||
"NUM_SAVE_FILES = 4\n"
|
||||
"SAVE_FILE_A = 0\n"
|
||||
"SAVE_FILE_B = 1\n"
|
||||
"SAVE_FILE_C = 2\n"
|
||||
"SAVE_FILE_D = 3\n"
|
||||
"SAVE_FLAG_FILE_EXISTS = (1 << 0)\n"
|
||||
"SAVE_FLAG_HAVE_WING_CAP = (1 << 1)\n"
|
||||
"SAVE_FLAG_HAVE_METAL_CAP = (1 << 2)\n"
|
||||
"SAVE_FLAG_HAVE_VANISH_CAP = (1 << 3)\n"
|
||||
"SAVE_FLAG_HAVE_KEY_1 = (1 << 4)\n"
|
||||
"SAVE_FLAG_HAVE_KEY_2 = (1 << 5)\n"
|
||||
"SAVE_FLAG_UNLOCKED_BASEMENT_DOOR = (1 << 6)\n"
|
||||
"SAVE_FLAG_UNLOCKED_UPSTAIRS_DOOR = (1 << 7)\n"
|
||||
"SAVE_FLAG_DDD_MOVED_BACK = (1 << 8)\n"
|
||||
"SAVE_FLAG_MOAT_DRAINED = (1 << 9)\n"
|
||||
"SAVE_FLAG_UNLOCKED_PSS_DOOR = (1 << 10)\n"
|
||||
"SAVE_FLAG_UNLOCKED_WF_DOOR = (1 << 11)\n"
|
||||
"SAVE_FLAG_UNLOCKED_CCM_DOOR = (1 << 12)\n"
|
||||
"SAVE_FLAG_UNLOCKED_JRB_DOOR = (1 << 13)\n"
|
||||
"SAVE_FLAG_UNLOCKED_BITDW_DOOR = (1 << 14)\n"
|
||||
"SAVE_FLAG_UNLOCKED_BITFS_DOOR = (1 << 15)\n"
|
||||
"SAVE_FLAG_CAP_ON_GROUND = (1 << 16)\n"
|
||||
"SAVE_FLAG_CAP_ON_KLEPTO = (1 << 17)\n"
|
||||
"SAVE_FLAG_CAP_ON_UKIKI = (1 << 18)\n"
|
||||
"SAVE_FLAG_CAP_ON_MR_BLIZZARD = (1 << 19)\n"
|
||||
"SAVE_FLAG_UNLOCKED_50_STAR_DOOR = (1 << 20)\n"
|
||||
"SAVE_FLAG_COLLECTED_TOAD_STAR_1 = (1 << 24)\n"
|
||||
"SAVE_FLAG_COLLECTED_TOAD_STAR_2 = (1 << 25)\n"
|
||||
"SAVE_FLAG_COLLECTED_TOAD_STAR_3 = (1 << 26)\n"
|
||||
"SAVE_FLAG_COLLECTED_MIPS_STAR_1 = (1 << 27)\n"
|
||||
"SAVE_FLAG_COLLECTED_MIPS_STAR_2 = (1 << 28)\n"
|
||||
"LAYER_FORCE = 0\n"
|
||||
"LAYER_OPAQUE = 1\n"
|
||||
"LAYER_OPAQUE_DECAL = 2\n"
|
||||
|
|
|
@ -7293,6 +7293,17 @@ int smlua_func_reset_rumble_timers_2(lua_State* L) {
|
|||
// save_file.h //
|
||||
/////////////////
|
||||
|
||||
int smlua_func_save_file_clear_flags(lua_State* L) {
|
||||
if(!smlua_functions_valid_param_count(L, 1)) { return 0; }
|
||||
|
||||
u32 flags = smlua_to_integer(L, 1);
|
||||
if (!gSmLuaConvertSuccess) { return 0; }
|
||||
|
||||
save_file_clear_flags(flags);
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
int smlua_func_save_file_get_cap_pos(lua_State* L) {
|
||||
if(!smlua_functions_valid_param_count(L, 1)) { return 0; }
|
||||
|
||||
|
@ -7397,6 +7408,17 @@ int smlua_func_save_file_get_total_star_count(lua_State* L) {
|
|||
return 1;
|
||||
}
|
||||
|
||||
int smlua_func_save_file_set_flags(lua_State* L) {
|
||||
if(!smlua_functions_valid_param_count(L, 1)) { return 0; }
|
||||
|
||||
u32 flags = smlua_to_integer(L, 1);
|
||||
if (!gSmLuaConvertSuccess) { return 0; }
|
||||
|
||||
save_file_set_flags(flags);
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
/////////////////////////////
|
||||
// smlua_collision_utils.h //
|
||||
/////////////////////////////
|
||||
|
@ -8843,6 +8865,7 @@ void smlua_bind_functions_autogen(void) {
|
|||
smlua_bind_function(L, "reset_rumble_timers_2", smlua_func_reset_rumble_timers_2);
|
||||
|
||||
// save_file.h
|
||||
smlua_bind_function(L, "save_file_clear_flags", smlua_func_save_file_clear_flags);
|
||||
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);
|
||||
smlua_bind_function(L, "save_file_get_course_star_count", smlua_func_save_file_get_course_star_count);
|
||||
|
@ -8851,6 +8874,7 @@ void smlua_bind_functions_autogen(void) {
|
|||
smlua_bind_function(L, "save_file_get_sound_mode", smlua_func_save_file_get_sound_mode);
|
||||
smlua_bind_function(L, "save_file_get_star_flags", smlua_func_save_file_get_star_flags);
|
||||
smlua_bind_function(L, "save_file_get_total_star_count", smlua_func_save_file_get_total_star_count);
|
||||
smlua_bind_function(L, "save_file_set_flags", smlua_func_save_file_set_flags);
|
||||
|
||||
// smlua_collision_utils.h
|
||||
smlua_bind_function(L, "collision_find_surface_on_ray", smlua_func_collision_find_surface_on_ray);
|
||||
|
|
Loading…
Reference in New Issue