diff --git a/autogen/convert_functions.py b/autogen/convert_functions.py
index 2273c2b5f..eba7c0193 100644
--- a/autogen/convert_functions.py
+++ b/autogen/convert_functions.py
@@ -58,6 +58,7 @@ in_files = [
"src/game/object_helpers.c",
"src/game/obj_behaviors.c",
"src/game/obj_behaviors_2.c",
+ "src/game/platform_displacement.h",
"src/game/spawn_sound.h",
"src/game/object_list_processor.h",
"src/game/behavior_actions.h",
@@ -80,9 +81,10 @@ override_allowed_functions = {
"src/pc/djui/djui_popup.h": [ "create" ],
"src/pc/djui/djui_language.h": [ "djui_language_get" ],
"src/pc/djui/djui_panel_menu.h": [ "djui_menu_get_rainbow_string_color" ],
- "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", "save_file_remove_star_flags", "save_file_erase" ],
+ "src/game/save_file.h": [ "get_level_", "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", "save_file_remove_star_flags", "save_file_erase" ],
"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/platform_displacement.h": [ "apply_platform_displacement" ],
"src/game/mario_misc.h": [ "bhv_toad.*", "bhv_unlock_door.*", "geo_get_.*_state" ],
"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", "get_instant_warp" ],
"src/game/area.h": [ "area_get_warp_node" ],
diff --git a/autogen/lua_definitions/functions.lua b/autogen/lua_definitions/functions.lua
index 32f93f298..76add6869 100644
--- a/autogen/lua_definitions/functions.lua
+++ b/autogen/lua_definitions/functions.lua
@@ -8734,6 +8734,13 @@ function set_object_respawn_info_bits(obj, bits)
-- ...
end
+--- @param playerIndex integer
+--- @param platform Object
+--- Apply one frame of platform rotation to Mario (player index) or an object (-1) using the given platform
+function apply_platform_displacement(playerIndex, platform)
+ -- ...
+end
+
--- @param a0 integer
--- @param a1 integer
--- Queues rumble data
@@ -8770,6 +8777,20 @@ function reset_rumble_timers_2(m, a0)
-- ...
end
+--- @param courseNum integer
+--- @return integer
+--- Gets the course number's corresponding level number
+function get_level_num_from_course_num(courseNum)
+ -- ...
+end
+
+--- @param levelNum integer
+--- @return integer
+--- Gets the level number's corresponding course number
+function get_level_course_num(levelNum)
+ -- ...
+end
+
--- @param fileIndex integer
--- @param courseIndex integer
--- Marks the coin score for a specific course as the newest among all save files. Adjusts the age of other scores to reflect the update. Useful for leaderboard tracking or displaying recent progress
diff --git a/docs/lua/functions-5.md b/docs/lua/functions-5.md
index 7d8a958ab..daf49e35b 100644
--- a/docs/lua/functions-5.md
+++ b/docs/lua/functions-5.md
@@ -5539,6 +5539,36 @@ Runs an OR operator on the `obj`'s respawn info with `bits` << 8. If `bits` is 0
+---
+# functions from platform_displacement.h
+
+
+
+
+## [apply_platform_displacement](#apply_platform_displacement)
+
+### Description
+Apply one frame of platform rotation to Mario (player index) or an object (-1) using the given platform
+
+### Lua Example
+`apply_platform_displacement(playerIndex, platform)`
+
+### Parameters
+| Field | Type |
+| ----- | ---- |
+| playerIndex | `integer` |
+| platform | [Object](structs.md#Object) |
+
+### Returns
+- None
+
+### C Prototype
+`void apply_platform_displacement(u32 playerIndex, struct Object *platform);`
+
+[:arrow_up_small:](#)
+
+
+
---
# functions from rumble_init.h
@@ -5672,6 +5702,52 @@ Resets rumble timers and sets a field based on `a0`
+## [get_level_num_from_course_num](#get_level_num_from_course_num)
+
+### Description
+Gets the course number's corresponding level number
+
+### Lua Example
+`local integerValue = get_level_num_from_course_num(courseNum)`
+
+### Parameters
+| Field | Type |
+| ----- | ---- |
+| courseNum | `integer` |
+
+### Returns
+- `integer`
+
+### C Prototype
+`s8 get_level_num_from_course_num(s16 courseNum);`
+
+[:arrow_up_small:](#)
+
+
+
+## [get_level_course_num](#get_level_course_num)
+
+### Description
+Gets the level number's corresponding course number
+
+### Lua Example
+`local integerValue = get_level_course_num(levelNum)`
+
+### Parameters
+| Field | Type |
+| ----- | ---- |
+| levelNum | `integer` |
+
+### Returns
+- `integer`
+
+### C Prototype
+`s8 get_level_course_num(s16 levelNum);`
+
+[:arrow_up_small:](#)
+
+
+
## [touch_coin_score_age](#touch_coin_score_age)
### Description
diff --git a/docs/lua/functions.md b/docs/lua/functions.md
index 1fa893c41..f280d73c1 100644
--- a/docs/lua/functions.md
+++ b/docs/lua/functions.md
@@ -1608,6 +1608,11 @@
+- platform_displacement.h
+ - [apply_platform_displacement](functions-5.md#apply_platform_displacement)
+
+
+
- rumble_init.h
- [queue_rumble_data](functions-5.md#queue_rumble_data)
- [queue_rumble_data_object](functions-5.md#queue_rumble_data_object)
@@ -1618,6 +1623,8 @@
- save_file.h
+ - [get_level_num_from_course_num](functions-5.md#get_level_num_from_course_num)
+ - [get_level_course_num](functions-5.md#get_level_course_num)
- [touch_coin_score_age](functions-5.md#touch_coin_score_age)
- [save_file_do_save](functions-5.md#save_file_do_save)
- [save_file_erase](functions-5.md#save_file_erase)
diff --git a/src/game/platform_displacement.h b/src/game/platform_displacement.h
index ab2a01f1a..617741571 100644
--- a/src/game/platform_displacement.h
+++ b/src/game/platform_displacement.h
@@ -8,7 +8,10 @@
void update_mario_platform(void);
void get_mario_pos(struct MarioState* m, f32 *x, f32 *y, f32 *z);
void set_mario_pos(struct MarioState* m, f32 x, f32 y, f32 z);
+
+/* |description|Apply one frame of platform rotation to Mario (player index) or an object (-1) using the given platform|descriptionEnd| */
void apply_platform_displacement(u32 playerIndex, struct Object *platform);
+
void apply_mario_platform_displacement(void);
#ifndef VERSION_JP
void clear_mario_platform(void);
diff --git a/src/game/save_file.h b/src/game/save_file.h
index bd3f9b7f6..fe53d4574 100644
--- a/src/game/save_file.h
+++ b/src/game/save_file.h
@@ -128,7 +128,10 @@ extern struct WarpCheckpoint gWarpCheckpoint;
extern s8 gMainMenuDataModified;
extern s8 gSaveFileModified;
+/* |description|Gets the course number's corresponding level number|descriptionEnd| */
s8 get_level_num_from_course_num(s16 courseNum);
+
+/* |description|Gets the level number's corresponding course number|descriptionEnd| */
s8 get_level_course_num(s16 levelNum);
/* |description|
diff --git a/src/pc/lua/smlua_functions_autogen.c b/src/pc/lua/smlua_functions_autogen.c
index de1092c7c..b97e4a56f 100644
--- a/src/pc/lua/smlua_functions_autogen.c
+++ b/src/pc/lua/smlua_functions_autogen.c
@@ -38,6 +38,7 @@
#include "src/pc/lua/utils/smlua_level_utils.h"
#include "src/pc/lua/utils/smlua_anim_utils.h"
#include "src/pc/lua/utils/smlua_deprecated.h"
+#include "src/game/platform_displacement.h"
#include "src/game/spawn_sound.h"
#include "src/game/object_list_processor.h"
#include "src/game/behavior_actions.h"
@@ -27518,6 +27519,30 @@ int smlua_func_set_object_respawn_info_bits(lua_State* L) {
return 1;
}
+ /////////////////////////////
+ // platform_displacement.h //
+/////////////////////////////
+
+int smlua_func_apply_platform_displacement(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", "apply_platform_displacement", 2, top);
+ return 0;
+ }
+
+ u32 playerIndex = smlua_to_integer(L, 1);
+ if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "apply_platform_displacement"); return 0; }
+ if (lua_isnil(L, 2)) { return 0; }
+ struct Object* platform = (struct Object*)smlua_to_cobject(L, 2, LOT_OBJECT);
+ if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 2, "apply_platform_displacement"); return 0; }
+
+ apply_platform_displacement(playerIndex, platform);
+
+ return 1;
+}
+
///////////////////
// rumble_init.h //
///////////////////
@@ -27627,6 +27652,40 @@ int smlua_func_reset_rumble_timers_2(lua_State* L) {
// save_file.h //
/////////////////
+int smlua_func_get_level_num_from_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", "get_level_num_from_course_num", 1, top);
+ return 0;
+ }
+
+ s16 courseNum = smlua_to_integer(L, 1);
+ if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "get_level_num_from_course_num"); return 0; }
+
+ lua_pushinteger(L, get_level_num_from_course_num(courseNum));
+
+ return 1;
+}
+
+int smlua_func_get_level_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", "get_level_course_num", 1, top);
+ return 0;
+ }
+
+ s16 levelNum = smlua_to_integer(L, 1);
+ if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "get_level_course_num"); return 0; }
+
+ lua_pushinteger(L, get_level_course_num(levelNum));
+
+ return 1;
+}
+
int smlua_func_touch_coin_score_age(lua_State* L) {
if (L == NULL) { return 0; }
@@ -35383,6 +35442,9 @@ void smlua_bind_functions_autogen(void) {
// object_list_processor.h
smlua_bind_function(L, "set_object_respawn_info_bits", smlua_func_set_object_respawn_info_bits);
+ // platform_displacement.h
+ smlua_bind_function(L, "apply_platform_displacement", smlua_func_apply_platform_displacement);
+
// rumble_init.h
smlua_bind_function(L, "queue_rumble_data", smlua_func_queue_rumble_data);
smlua_bind_function(L, "queue_rumble_data_object", smlua_func_queue_rumble_data_object);
@@ -35391,6 +35453,8 @@ 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, "get_level_num_from_course_num", smlua_func_get_level_num_from_course_num);
+ smlua_bind_function(L, "get_level_course_num", smlua_func_get_level_course_num);
smlua_bind_function(L, "touch_coin_score_age", smlua_func_touch_coin_score_age);
smlua_bind_function(L, "save_file_do_save", smlua_func_save_file_do_save);
smlua_bind_function(L, "save_file_erase", smlua_func_save_file_erase);