diff --git a/autogen/lua_definitions/functions.lua b/autogen/lua_definitions/functions.lua index b4660b067..a73b177dc 100644 --- a/autogen/lua_definitions/functions.lua +++ b/autogen/lua_definitions/functions.lua @@ -6060,41 +6060,48 @@ function vec3s_to_vec3f(dest, a) -- ... end +--- Updates every Mario state's star count with the save file total star count function update_all_mario_stars() -- ... end --- @return boolean +--- Clears the mod's data from mod storage function mod_storage_clear() -- ... end --- @param key string --- @return boolean +--- Checks if a `key` is in mod storage function mod_storage_exists(key) -- ... end --- @param key string --- @return string +--- Loads a string `value` from a `key` in mod storage function mod_storage_load(key) -- ... end --- @param key string --- @return boolean +--- Loads a bool `value` from a `key` in mod storage function mod_storage_load_bool(key) -- ... end --- @param key string --- @return number +--- Loads a float `value` from a `key` in mod storage function mod_storage_load_number(key) -- ... end --- @param key string --- @return boolean +--- Removes a `key` from mod storage function mod_storage_remove(key) -- ... end @@ -6102,6 +6109,7 @@ end --- @param key string --- @param value string --- @return boolean +--- Saves a `key` corresponding to a string `value` to mod storage function mod_storage_save(key, value) -- ... end @@ -6109,6 +6117,7 @@ end --- @param key string --- @param value boolean --- @return boolean +--- Saves a `key` corresponding to a bool `value` to mod storage function mod_storage_save_bool(key, value) -- ... end @@ -6116,6 +6125,7 @@ end --- @param key string --- @param value number --- @return boolean +--- Saves a `key` corresponding to a float `value` to mod storage function mod_storage_save_number(key, value) -- ... end @@ -10130,6 +10140,7 @@ function load_area_terrain(index, data, surfaceRooms, macroObjects) -- ... end +--- Loads the object's collision data into dynamic collision. You must run this every frame in your object's behavior loop for it to have collision function load_object_collision_model() -- ... end @@ -10137,6 +10148,7 @@ end --- @param o Object --- @param index integer --- @return Surface +--- Gets a surface corresponding to `index` from the surface pool buffer function obj_get_surface_from_index(o, index) -- ... end diff --git a/docs/lua/functions-4.md b/docs/lua/functions-4.md index cea75fe83..05932fc20 100644 --- a/docs/lua/functions-4.md +++ b/docs/lua/functions-4.md @@ -1864,6 +1864,9 @@ Converts a 3D signed-integer vector `a` (vec3s) into a 3D floating-point vector ## [update_all_mario_stars](#update_all_mario_stars) +### Description +Updates every Mario state's star count with the save file total star count + ### Lua Example `update_all_mario_stars()` @@ -1888,6 +1891,9 @@ Converts a 3D signed-integer vector `a` (vec3s) into a 3D floating-point vector ## [mod_storage_clear](#mod_storage_clear) +### Description +Clears the mod's data from mod storage + ### Lua Example `local booleanValue = mod_storage_clear()` @@ -1906,6 +1912,9 @@ Converts a 3D signed-integer vector `a` (vec3s) into a 3D floating-point vector ## [mod_storage_exists](#mod_storage_exists) +### Description +Checks if a `key` is in mod storage + ### Lua Example `local booleanValue = mod_storage_exists(key)` @@ -1926,6 +1935,9 @@ Converts a 3D signed-integer vector `a` (vec3s) into a 3D floating-point vector ## [mod_storage_load](#mod_storage_load) +### Description +Loads a string `value` from a `key` in mod storage + ### Lua Example `local stringValue = mod_storage_load(key)` @@ -1946,6 +1958,9 @@ Converts a 3D signed-integer vector `a` (vec3s) into a 3D floating-point vector ## [mod_storage_load_bool](#mod_storage_load_bool) +### Description +Loads a bool `value` from a `key` in mod storage + ### Lua Example `local booleanValue = mod_storage_load_bool(key)` @@ -1966,6 +1981,9 @@ Converts a 3D signed-integer vector `a` (vec3s) into a 3D floating-point vector ## [mod_storage_load_number](#mod_storage_load_number) +### Description +Loads a float `value` from a `key` in mod storage + ### Lua Example `local numberValue = mod_storage_load_number(key)` @@ -1986,6 +2004,9 @@ Converts a 3D signed-integer vector `a` (vec3s) into a 3D floating-point vector ## [mod_storage_remove](#mod_storage_remove) +### Description +Removes a `key` from mod storage + ### Lua Example `local booleanValue = mod_storage_remove(key)` @@ -2006,6 +2027,9 @@ Converts a 3D signed-integer vector `a` (vec3s) into a 3D floating-point vector ## [mod_storage_save](#mod_storage_save) +### Description +Saves a `key` corresponding to a string `value` to mod storage + ### Lua Example `local booleanValue = mod_storage_save(key, value)` @@ -2027,6 +2051,9 @@ Converts a 3D signed-integer vector `a` (vec3s) into a 3D floating-point vector ## [mod_storage_save_bool](#mod_storage_save_bool) +### Description +Saves a `key` corresponding to a bool `value` to mod storage + ### Lua Example `local booleanValue = mod_storage_save_bool(key, value)` @@ -2048,6 +2075,9 @@ Converts a 3D signed-integer vector `a` (vec3s) into a 3D floating-point vector ## [mod_storage_save_number](#mod_storage_save_number) +### Description +Saves a `key` corresponding to a float `value` to mod storage + ### Lua Example `local booleanValue = mod_storage_save_number(key, value)` diff --git a/docs/lua/functions-6.md b/docs/lua/functions-6.md index 543a44fab..3cfaeed12 100644 --- a/docs/lua/functions-6.md +++ b/docs/lua/functions-6.md @@ -3552,6 +3552,9 @@ Replaces the secret star course name of `courseNum` with `courseName` ## [load_object_collision_model](#load_object_collision_model) +### Description +Loads the object's collision data into dynamic collision. You must run this every frame in your object's behavior loop for it to have collision + ### Lua Example `load_object_collision_model()` @@ -3570,6 +3573,9 @@ Replaces the secret star course name of `courseNum` with `courseName` ## [obj_get_surface_from_index](#obj_get_surface_from_index) +### Description +Gets a surface corresponding to `index` from the surface pool buffer + ### Lua Example `local SurfaceValue = obj_get_surface_from_index(o, index)` diff --git a/src/engine/surface_load.h b/src/engine/surface_load.h index a4a9461f3..c3753f47e 100644 --- a/src/engine/surface_load.h +++ b/src/engine/surface_load.h @@ -33,8 +33,14 @@ u32 get_area_terrain_size(s16 *data); void load_area_terrain(s16 index, s16 *data, s8 *surfaceRooms, s16 *macroObjects); void clear_dynamic_surfaces(void); +/* |description| +Loads the object's collision data into dynamic collision. +You must run this every frame in your object's behavior loop for it to have collision +|descriptionEnd| */ void load_object_collision_model(void); +/* |description|Gets a surface corresponding to `index` from the surface pool buffer|descriptionEnd| */ struct Surface *obj_get_surface_from_index(struct Object *o, u32 index); +/* |description||descriptionEnd| */ bool surface_has_force(s16 surfaceType); #endif // SURFACE_LOAD_H diff --git a/src/pc/mods/mod_storage.h b/src/pc/mods/mod_storage.h index 96e42d96b..53ccf092a 100644 --- a/src/pc/mods/mod_storage.h +++ b/src/pc/mods/mod_storage.h @@ -12,16 +12,25 @@ extern "C" { #define SAVE_DIRECTORY "sav" #define SAVE_EXTENSION ".sav" +/* |description|Saves a `key` corresponding to a string `value` to mod storage|descriptionEnd| */ bool mod_storage_save(const char* key, const char* value); +/* |description|Saves a `key` corresponding to a float `value` to mod storage|descriptionEnd| */ bool mod_storage_save_number(const char* key, f32 value); +/* |description|Saves a `key` corresponding to a bool `value` to mod storage|descriptionEnd| */ bool mod_storage_save_bool(const char* key, bool value); +/* |description|Loads a string `value` from a `key` in mod storage|descriptionEnd| */ const char *mod_storage_load(const char* key); +/* |description|Loads a float `value` from a `key` in mod storage|descriptionEnd| */ f32 mod_storage_load_number(const char* key); +/* |description|Loads a bool `value` from a `key` in mod storage|descriptionEnd| */ bool mod_storage_load_bool(const char* key); +/* |description|Checks if a `key` is in mod storage|descriptionEnd| */ bool mod_storage_exists(const char* key); +/* |description|Removes a `key` from mod storage|descriptionEnd| */ bool mod_storage_remove(const char* key); +/* |description|Clears the mod's data from mod storage|descriptionEnd| */ bool mod_storage_clear(void); #ifdef __cplusplus diff --git a/src/pc/utils/misc.h b/src/pc/utils/misc.h index 26f7e706e..165333576 100644 --- a/src/pc/utils/misc.h +++ b/src/pc/utils/misc.h @@ -6,6 +6,7 @@ #include "PR/gbi.h" float smoothstep(float edge0, float edge1, float x); +/* |description|Updates every Mario state's star count with the save file total star count|descriptionEnd| */ void update_all_mario_stars(void); f32 clock_elapsed(void);