diff --git a/autogen/convert_functions.py b/autogen/convert_functions.py
index 1c48070d..f4e65acc 100644
--- a/autogen/convert_functions.py
+++ b/autogen/convert_functions.py
@@ -74,7 +74,7 @@ override_allowed_functions = {
"src/game/object_list_processor.h": [ "set_object_respawn_info_bits" ],
"src/game/mario_misc.h": [ "bhv_toad.*", "bhv_unlock_door.*" ],
"src/pc/utils/misc.h": [ "update_all_mario_stars" ],
- "src/game/level_update.h": [ "level_trigger_warp", "get_painting_warp_node", "initiate_painting_warp", "warp_special" ],
+ "src/game/level_update.h": [ "level_trigger_warp", "get_painting_warp_node", "initiate_painting_warp", "warp_special", "lvl_set_current_level" ],
"src/game/area.h": [ "area_get_warp_node" ],
"src/engine/level_script.h": [ "area_create_warp_node" ],
"src/game/ingame_menu.h": [ "set_min_dialog_width", "set_dialog_override_pos", "reset_dialog_override_pos", "set_dialog_override_color", "reset_dialog_override_color" ]
diff --git a/autogen/lua_definitions/constants.lua b/autogen/lua_definitions/constants.lua
index 00214a6a..d12523bc 100644
--- a/autogen/lua_definitions/constants.lua
+++ b/autogen/lua_definitions/constants.lua
@@ -3982,6 +3982,30 @@ TIMER_CONTROL_START = 1
--- @type integer
TIMER_CONTROL_STOP = 2
+--- @type integer
+WARP_NODE_CREDITS_END = 0xFA
+
+--- @type integer
+WARP_NODE_CREDITS_MIN = 0xF8
+
+--- @type integer
+WARP_NODE_CREDITS_NEXT = 0xF9
+
+--- @type integer
+WARP_NODE_CREDITS_START = 0xF8
+
+--- @type integer
+WARP_NODE_DEATH = 0xF1
+
+--- @type integer
+WARP_NODE_F0 = 0xF0
+
+--- @type integer
+WARP_NODE_F2 = 0xF2
+
+--- @type integer
+WARP_NODE_WARP_FLOOR = 0xF3
+
--- @type integer
WARP_OP_CREDITS_END = 0x15
diff --git a/autogen/lua_definitions/functions.lua b/autogen/lua_definitions/functions.lua
index 5407cf87..8cd9a064 100644
--- a/autogen/lua_definitions/functions.lua
+++ b/autogen/lua_definitions/functions.lua
@@ -4197,6 +4197,13 @@ function level_trigger_warp(m, warpOp)
-- ...
end
+--- @param arg0 integer
+--- @param levelNum integer
+--- @return integer
+function lvl_set_current_level(arg0, levelNum)
+ -- ...
+end
+
--- @param arg integer
--- @return nil
function warp_special(arg)
diff --git a/docs/lua/constants.md b/docs/lua/constants.md
index f7d32d5a..3703660c 100644
--- a/docs/lua/constants.md
+++ b/docs/lua/constants.md
@@ -1392,6 +1392,14 @@
- TIMER_CONTROL_SHOW
- TIMER_CONTROL_START
- TIMER_CONTROL_STOP
+- WARP_NODE_CREDITS_END
+- WARP_NODE_CREDITS_MIN
+- WARP_NODE_CREDITS_NEXT
+- WARP_NODE_CREDITS_START
+- WARP_NODE_DEATH
+- WARP_NODE_F0
+- WARP_NODE_F2
+- WARP_NODE_WARP_FLOOR
- WARP_OP_CREDITS_END
- WARP_OP_CREDITS_NEXT
- WARP_OP_CREDITS_START
diff --git a/docs/lua/functions-3.md b/docs/lua/functions-3.md
index ca629aa0..abadd06a 100644
--- a/docs/lua/functions-3.md
+++ b/docs/lua/functions-3.md
@@ -3858,6 +3858,27 @@
+## [lvl_set_current_level](#lvl_set_current_level)
+
+### Lua Example
+`local integerValue = lvl_set_current_level(arg0, levelNum)`
+
+### Parameters
+| Field | Type |
+| ----- | ---- |
+| arg0 | `integer` |
+| levelNum | `integer` |
+
+### Returns
+- `integer`
+
+### C Prototype
+`s32 lvl_set_current_level(UNUSED s16 arg0, s32 levelNum);`
+
+[:arrow_up_small:](#)
+
+
+
## [warp_special](#warp_special)
### Lua Example
@@ -8580,182 +8601,6 @@
[:arrow_up_small:](#)
-
-
----
-# functions from network_player.h
-
-
-
-
-## [get_network_player_from_area](#get_network_player_from_area)
-
-### Lua Example
-`local NetworkPlayerValue = get_network_player_from_area(courseNum, actNum, levelNum, areaIndex)`
-
-### Parameters
-| Field | Type |
-| ----- | ---- |
-| courseNum | `integer` |
-| actNum | `integer` |
-| levelNum | `integer` |
-| areaIndex | `integer` |
-
-### Returns
-[NetworkPlayer](structs.md#NetworkPlayer)
-
-### C Prototype
-`struct NetworkPlayer* get_network_player_from_area(s16 courseNum, s16 actNum, s16 levelNum, s16 areaIndex);`
-
-[:arrow_up_small:](#)
-
-
-
-## [get_network_player_from_level](#get_network_player_from_level)
-
-### Lua Example
-`local NetworkPlayerValue = get_network_player_from_level(courseNum, actNum, levelNum)`
-
-### Parameters
-| Field | Type |
-| ----- | ---- |
-| courseNum | `integer` |
-| actNum | `integer` |
-| levelNum | `integer` |
-
-### Returns
-[NetworkPlayer](structs.md#NetworkPlayer)
-
-### C Prototype
-`struct NetworkPlayer* get_network_player_from_level(s16 courseNum, s16 actNum, s16 levelNum);`
-
-[:arrow_up_small:](#)
-
-
-
-## [get_network_player_smallest_global](#get_network_player_smallest_global)
-
-### Lua Example
-`local NetworkPlayerValue = get_network_player_smallest_global()`
-
-### Parameters
-- None
-
-### Returns
-[NetworkPlayer](structs.md#NetworkPlayer)
-
-### C Prototype
-`struct NetworkPlayer* get_network_player_smallest_global(void);`
-
-[:arrow_up_small:](#)
-
-
-
-## [network_player_color_to_palette](#network_player_color_to_palette)
-
-### Lua Example
-`network_player_color_to_palette(np, part, color)`
-
-### Parameters
-| Field | Type |
-| ----- | ---- |
-| np | [NetworkPlayer](structs.md#NetworkPlayer) |
-| part | [enum PlayerParts](constants.md#enum-PlayerParts) |
-| color | `Color` |
-
-### Returns
-- None
-
-### C Prototype
-`void network_player_color_to_palette(struct NetworkPlayer *np, enum PlayerParts part, Color color);`
-
-[:arrow_up_small:](#)
-
-
-
-## [network_player_connected_count](#network_player_connected_count)
-
-### Lua Example
-`local integerValue = network_player_connected_count()`
-
-### Parameters
-- None
-
-### Returns
-- `integer`
-
-### C Prototype
-`u8 network_player_connected_count(void);`
-
-[:arrow_up_small:](#)
-
-
-
-## [network_player_from_global_index](#network_player_from_global_index)
-
-### Lua Example
-`local NetworkPlayerValue = network_player_from_global_index(globalIndex)`
-
-### Parameters
-| Field | Type |
-| ----- | ---- |
-| globalIndex | `integer` |
-
-### Returns
-[NetworkPlayer](structs.md#NetworkPlayer)
-
-### C Prototype
-`struct NetworkPlayer* network_player_from_global_index(u8 globalIndex);`
-
-[:arrow_up_small:](#)
-
-
-
-## [network_player_palette_to_color](#network_player_palette_to_color)
-
-### Lua Example
-`network_player_palette_to_color(np, part, out)`
-
-### Parameters
-| Field | Type |
-| ----- | ---- |
-| np | [NetworkPlayer](structs.md#NetworkPlayer) |
-| part | [enum PlayerParts](constants.md#enum-PlayerParts) |
-| out | `Color` |
-
-### Returns
-- None
-
-### C Prototype
-`void network_player_palette_to_color(struct NetworkPlayer *np, enum PlayerParts part, Color out);`
-
-[:arrow_up_small:](#)
-
-
-
-## [network_player_set_description](#network_player_set_description)
-
-### Lua Example
-`network_player_set_description(np, description, r, g, b, a)`
-
-### Parameters
-| Field | Type |
-| ----- | ---- |
-| np | [NetworkPlayer](structs.md#NetworkPlayer) |
-| description | `string` |
-| r | `integer` |
-| g | `integer` |
-| b | `integer` |
-| a | `integer` |
-
-### Returns
-- None
-
-### C Prototype
-`void network_player_set_description(struct NetworkPlayer* np, const char* description, u8 r, u8 g, u8 b, u8 a);`
-
-[:arrow_up_small:](#)
-
---
diff --git a/docs/lua/functions-4.md b/docs/lua/functions-4.md
index 42d9a405..277e72e5 100644
--- a/docs/lua/functions-4.md
+++ b/docs/lua/functions-4.md
@@ -5,6 +5,182 @@
[< prev](functions-3.md) | [1](functions.md) | [2](functions-2.md) | [3](functions-3.md) | 4 | [5](functions-5.md) | [next >](functions-5.md)]
+---
+# functions from network_player.h
+
+
+
+
+## [get_network_player_from_area](#get_network_player_from_area)
+
+### Lua Example
+`local NetworkPlayerValue = get_network_player_from_area(courseNum, actNum, levelNum, areaIndex)`
+
+### Parameters
+| Field | Type |
+| ----- | ---- |
+| courseNum | `integer` |
+| actNum | `integer` |
+| levelNum | `integer` |
+| areaIndex | `integer` |
+
+### Returns
+[NetworkPlayer](structs.md#NetworkPlayer)
+
+### C Prototype
+`struct NetworkPlayer* get_network_player_from_area(s16 courseNum, s16 actNum, s16 levelNum, s16 areaIndex);`
+
+[:arrow_up_small:](#)
+
+
+
+## [get_network_player_from_level](#get_network_player_from_level)
+
+### Lua Example
+`local NetworkPlayerValue = get_network_player_from_level(courseNum, actNum, levelNum)`
+
+### Parameters
+| Field | Type |
+| ----- | ---- |
+| courseNum | `integer` |
+| actNum | `integer` |
+| levelNum | `integer` |
+
+### Returns
+[NetworkPlayer](structs.md#NetworkPlayer)
+
+### C Prototype
+`struct NetworkPlayer* get_network_player_from_level(s16 courseNum, s16 actNum, s16 levelNum);`
+
+[:arrow_up_small:](#)
+
+
+
+## [get_network_player_smallest_global](#get_network_player_smallest_global)
+
+### Lua Example
+`local NetworkPlayerValue = get_network_player_smallest_global()`
+
+### Parameters
+- None
+
+### Returns
+[NetworkPlayer](structs.md#NetworkPlayer)
+
+### C Prototype
+`struct NetworkPlayer* get_network_player_smallest_global(void);`
+
+[:arrow_up_small:](#)
+
+
+
+## [network_player_color_to_palette](#network_player_color_to_palette)
+
+### Lua Example
+`network_player_color_to_palette(np, part, color)`
+
+### Parameters
+| Field | Type |
+| ----- | ---- |
+| np | [NetworkPlayer](structs.md#NetworkPlayer) |
+| part | [enum PlayerParts](constants.md#enum-PlayerParts) |
+| color | `Color` |
+
+### Returns
+- None
+
+### C Prototype
+`void network_player_color_to_palette(struct NetworkPlayer *np, enum PlayerParts part, Color color);`
+
+[:arrow_up_small:](#)
+
+
+
+## [network_player_connected_count](#network_player_connected_count)
+
+### Lua Example
+`local integerValue = network_player_connected_count()`
+
+### Parameters
+- None
+
+### Returns
+- `integer`
+
+### C Prototype
+`u8 network_player_connected_count(void);`
+
+[:arrow_up_small:](#)
+
+
+
+## [network_player_from_global_index](#network_player_from_global_index)
+
+### Lua Example
+`local NetworkPlayerValue = network_player_from_global_index(globalIndex)`
+
+### Parameters
+| Field | Type |
+| ----- | ---- |
+| globalIndex | `integer` |
+
+### Returns
+[NetworkPlayer](structs.md#NetworkPlayer)
+
+### C Prototype
+`struct NetworkPlayer* network_player_from_global_index(u8 globalIndex);`
+
+[:arrow_up_small:](#)
+
+
+
+## [network_player_palette_to_color](#network_player_palette_to_color)
+
+### Lua Example
+`network_player_palette_to_color(np, part, out)`
+
+### Parameters
+| Field | Type |
+| ----- | ---- |
+| np | [NetworkPlayer](structs.md#NetworkPlayer) |
+| part | [enum PlayerParts](constants.md#enum-PlayerParts) |
+| out | `Color` |
+
+### Returns
+- None
+
+### C Prototype
+`void network_player_palette_to_color(struct NetworkPlayer *np, enum PlayerParts part, Color out);`
+
+[:arrow_up_small:](#)
+
+
+
+## [network_player_set_description](#network_player_set_description)
+
+### Lua Example
+`network_player_set_description(np, description, r, g, b, a)`
+
+### Parameters
+| Field | Type |
+| ----- | ---- |
+| np | [NetworkPlayer](structs.md#NetworkPlayer) |
+| description | `string` |
+| r | `integer` |
+| g | `integer` |
+| b | `integer` |
+| a | `integer` |
+
+### Returns
+- None
+
+### C Prototype
+`void network_player_set_description(struct NetworkPlayer* np, const char* description, u8 r, u8 g, u8 b, u8 a);`
+
+[:arrow_up_small:](#)
+
+
+
---
# functions from network_utils.h
diff --git a/docs/lua/functions.md b/docs/lua/functions.md
index 5c98a999..52500196 100644
--- a/docs/lua/functions.md
+++ b/docs/lua/functions.md
@@ -839,6 +839,7 @@
- [get_painting_warp_node](functions-3.md#get_painting_warp_node)
- [initiate_painting_warp](functions-3.md#initiate_painting_warp)
- [level_trigger_warp](functions-3.md#level_trigger_warp)
+ - [lvl_set_current_level](functions-3.md#lvl_set_current_level)
- [warp_special](functions-3.md#warp_special)
@@ -1117,14 +1118,14 @@
- network_player.h
- - [get_network_player_from_area](functions-3.md#get_network_player_from_area)
- - [get_network_player_from_level](functions-3.md#get_network_player_from_level)
- - [get_network_player_smallest_global](functions-3.md#get_network_player_smallest_global)
- - [network_player_color_to_palette](functions-3.md#network_player_color_to_palette)
- - [network_player_connected_count](functions-3.md#network_player_connected_count)
- - [network_player_from_global_index](functions-3.md#network_player_from_global_index)
- - [network_player_palette_to_color](functions-3.md#network_player_palette_to_color)
- - [network_player_set_description](functions-3.md#network_player_set_description)
+ - [get_network_player_from_area](functions-4.md#get_network_player_from_area)
+ - [get_network_player_from_level](functions-4.md#get_network_player_from_level)
+ - [get_network_player_smallest_global](functions-4.md#get_network_player_smallest_global)
+ - [network_player_color_to_palette](functions-4.md#network_player_color_to_palette)
+ - [network_player_connected_count](functions-4.md#network_player_connected_count)
+ - [network_player_from_global_index](functions-4.md#network_player_from_global_index)
+ - [network_player_palette_to_color](functions-4.md#network_player_palette_to_color)
+ - [network_player_set_description](functions-4.md#network_player_set_description)
diff --git a/src/game/camera.c b/src/game/camera.c
index 73df3b1a..537c31cb 100644
--- a/src/game/camera.c
+++ b/src/game/camera.c
@@ -7162,15 +7162,13 @@ void find_mario_floor_and_ceil(struct PlayerGeometry *pg) {
s16 tempCheckingSurfaceCollisionsForCamera = gCheckingSurfaceCollisionsForCamera;
gCheckingSurfaceCollisionsForCamera = TRUE;
- if (find_floor(sMarioCamState->pos[0], sMarioCamState->pos[1] + 10.f,
- sMarioCamState->pos[2], &surf) != gLevelValues.floorLowerLimit) {
+ if (find_floor(sMarioCamState->pos[0], sMarioCamState->pos[1] + 10.f, sMarioCamState->pos[2], &surf) != gLevelValues.floorLowerLimit && surf != NULL) {
pg->currFloorType = surf->type;
} else {
pg->currFloorType = 0;
}
- if (find_ceil(sMarioCamState->pos[0], sMarioCamState->pos[1] - 10.f,
- sMarioCamState->pos[2], &surf) != gLevelValues.cellHeightLimit) {
+ if (find_ceil(sMarioCamState->pos[0], sMarioCamState->pos[1] - 10.f, sMarioCamState->pos[2], &surf) != gLevelValues.cellHeightLimit && surf != NULL) {
pg->currCeilType = surf->type;
} else {
pg->currCeilType = 0;
diff --git a/src/game/level_update.c b/src/game/level_update.c
index 07560348..ce8a7448 100644
--- a/src/game/level_update.c
+++ b/src/game/level_update.c
@@ -47,15 +47,6 @@
#include "engine/level_script.h"
-#define WARP_NODE_F0 0xF0
-#define WARP_NODE_DEATH 0xF1
-#define WARP_NODE_F2 0xF2
-#define WARP_NODE_WARP_FLOOR 0xF3
-#define WARP_NODE_CREDITS_START 0xF8
-#define WARP_NODE_CREDITS_NEXT 0xF9
-#define WARP_NODE_CREDITS_END 0xFA
-#define WARP_NODE_CREDITS_MIN 0xF8
-
#define MENU_LEVEL_MIN 0
#define MENU_LEVEL_MAX 16
diff --git a/src/game/level_update.h b/src/game/level_update.h
index f9c2b0eb..514af0e1 100644
--- a/src/game/level_update.h
+++ b/src/game/level_update.h
@@ -58,6 +58,15 @@
#define MARIO_SPAWN_LAUNCH_DEATH 0x25
#define MARIO_SPAWN_UNKNOWN_27 0x27
+#define WARP_NODE_F0 0xF0
+#define WARP_NODE_DEATH 0xF1
+#define WARP_NODE_F2 0xF2
+#define WARP_NODE_WARP_FLOOR 0xF3
+#define WARP_NODE_CREDITS_START 0xF8
+#define WARP_NODE_CREDITS_NEXT 0xF9
+#define WARP_NODE_CREDITS_END 0xFA
+#define WARP_NODE_CREDITS_MIN 0xF8
+
#define WARP_TYPE_NOT_WARPING 0
#define WARP_TYPE_CHANGE_LEVEL 1
#define WARP_TYPE_CHANGE_AREA 2
@@ -162,6 +171,7 @@ void initiate_painting_warp(s16 paintingIndex);
s16 level_trigger_warp(struct MarioState *m, s32 warpOp);
void level_set_transition(s16 length, void (*updateFunction)(s16 *));
void warp_special(s32 arg);
+void initiate_warp(s16 destLevel, s16 destArea, s16 destWarpNode, s32 arg3);
s32 lvl_init_or_update(s16 initOrUpdate, UNUSED s32 unused);
s32 lvl_init_from_save_file(UNUSED s16 arg0, s32 levelNum);
diff --git a/src/pc/lua/smlua_constants_autogen.c b/src/pc/lua/smlua_constants_autogen.c
index 581f83be..ec7c0e0c 100644
--- a/src/pc/lua/smlua_constants_autogen.c
+++ b/src/pc/lua/smlua_constants_autogen.c
@@ -1,6 +1,8 @@
char gSmluaConstants[] = ""
"math.randomseed(get_time())\n"
+"\n"
"_CObjectPool = {}\n"
+"\n"
"_CObject = {\n"
" __index = function (t,k)\n"
" return _get_field(t['_lot'], t['_pointer'], k, t)\n"
@@ -15,10 +17,12 @@ char gSmluaConstants[] = ""
" return a['_pointer'] == b['_pointer'] and a['_lot'] == b['_lot'] and a['_pointer'] ~= nil and a['_lot'] ~= nil\n"
" end\n"
"}\n"
+"\n"
"function _NewCObject(lot, pointer)\n"
" if _CObjectPool[lot] == nil then\n"
" _CObjectPool[lot] = {}\n"
" end\n"
+"\n"
" if _CObjectPool[lot][pointer] == nil then\n"
" local obj = {}\n"
" rawset(obj, '_pointer', pointer)\n"
@@ -27,9 +31,12 @@ char gSmluaConstants[] = ""
" _CObjectPool[lot][pointer] = obj\n"
" return obj\n"
" end\n"
+"\n"
" return _CObjectPool[lot][pointer]\n"
"end\n"
+"\n"
"local _CPointerPool = {}\n"
+"\n"
"_CPointer = {\n"
" __index = function (t,k)\n"
" return nil\n"
@@ -43,10 +50,12 @@ char gSmluaConstants[] = ""
" return a['_pointer'] == b['_pointer'] and a['_pointer'] ~= nil and a['_lvt'] ~= nil\n"
" end\n"
"}\n"
+"\n"
"function _NewCPointer(lvt, pointer)\n"
" if _CPointerPool[lvt] == nil then\n"
" _CPointerPool[lvt] = {}\n"
" end\n"
+"\n"
" if _CPointerPool[lvt][pointer] == nil then\n"
" local obj = {}\n"
" rawset(obj, '_pointer', pointer)\n"
@@ -55,8 +64,10 @@ char gSmluaConstants[] = ""
" _CPointerPool[lvt][pointer] = obj\n"
" return obj\n"
" end\n"
+"\n"
" return _CPointerPool[lvt][pointer]\n"
"end\n"
+"\n"
"_SyncTable = {\n"
" __index = function (t,k)\n"
" local _table = rawget(t, '_table')\n"
@@ -68,6 +79,7 @@ char gSmluaConstants[] = ""
" _set_sync_table_field(t, k, v)\n"
" end\n"
"}\n"
+"\n"
"_ReadOnlyTable = {\n"
" __index = function (t,k)\n"
" local _table = rawget(t, '_table')\n"
@@ -76,6 +88,7 @@ char gSmluaConstants[] = ""
" __newindex = function (t,k,v)\n"
" end\n"
"}\n"
+"\n"
"--- @param dest Vec3f\n"
"--- @param src Vec3f\n"
"--- @return Vec3f\n"
@@ -85,6 +98,7 @@ char gSmluaConstants[] = ""
" dest.z = src.z\n"
" return dest\n"
"end\n"
+"\n"
"--- @param dest Vec3f\n"
"--- @param x number\n"
"--- @param y number\n"
@@ -96,6 +110,7 @@ char gSmluaConstants[] = ""
" dest.z = z\n"
" return dest\n"
"end\n"
+"\n"
"--- @param dest Vec3f\n"
"--- @param a Vec3f\n"
"--- @return Vec3f\n"
@@ -105,6 +120,7 @@ char gSmluaConstants[] = ""
" dest.z = dest.z + a.z\n"
" return dest\n"
"end\n"
+"\n"
"--- @param dest Vec3f\n"
"--- @param a Vec3f\n"
"--- @param b Vec3f\n"
@@ -115,6 +131,7 @@ char gSmluaConstants[] = ""
" dest.z = a.z + b.z\n"
" return dest\n"
"end\n"
+"\n"
"--- @param dest Vec3f\n"
"--- @param a number\n"
"--- @return Vec3f\n"
@@ -124,6 +141,7 @@ char gSmluaConstants[] = ""
" dest.z = dest.z * a\n"
" return dest\n"
"end\n"
+"\n"
"--- @param dest Vec3f\n"
"--- @return Vec3f\n"
"function vec3f_normalize(dest)\n"
@@ -131,23 +149,28 @@ char gSmluaConstants[] = ""
" if divisor == 0 then\n"
" return dest\n"
" end\n"
+"\n"
" local invsqrt = 1.0 / divisor\n"
" dest.x = dest.x * invsqrt\n"
" dest.y = dest.y * invsqrt\n"
" dest.z = dest.z * invsqrt\n"
+"\n"
" return dest\n"
"end\n"
+"\n"
"--- @param a Vec3f\n"
"--- @return number\n"
"function vec3f_length(a)\n"
" return math.sqrt(a.x * a.x + a.y * a.y + a.z * a.z)\n"
"end\n"
+"\n"
"--- @param a Vec3f\n"
"--- @param b Vec3f\n"
"--- @return number\n"
"function vec3f_dot(a, b)\n"
" return a.x * b.x + a.y * b.y + a.z * b.z\n"
"end\n"
+"\n"
"--- @param vec Vec3f\n"
"--- @param onto Vec3f\n"
"--- @return Vec3f\n"
@@ -159,6 +182,7 @@ char gSmluaConstants[] = ""
" vec3f_mul(out, numerator / denominator)\n"
" return out\n"
"end\n"
+"\n"
"--- @param v1 Vec3f\n"
"--- @param v2 Vec3f\n"
"--- @return number\n"
@@ -168,6 +192,7 @@ char gSmluaConstants[] = ""
" dz = v1.z - v2.z\n"
" return math.sqrt(dx * dx + dy * dy + dz * dz)\n"
"end\n"
+"\n"
"--- @param dest Vec3s\n"
"--- @param src Vec3s\n"
"--- @return Vec3s\n"
@@ -177,6 +202,7 @@ char gSmluaConstants[] = ""
" dest.z = src.z\n"
" return dest\n"
"end\n"
+"\n"
"--- @param dest Vec3s\n"
"--- @param x number\n"
"--- @param y number\n"
@@ -188,6 +214,7 @@ char gSmluaConstants[] = ""
" dest.z = z\n"
" return dest\n"
"end\n"
+"\n"
"--- @param dest Vec3s\n"
"--- @param a Vec3s\n"
"--- @return Vec3s\n"
@@ -197,6 +224,7 @@ char gSmluaConstants[] = ""
" dest.z = dest.z + a.z\n"
" return dest\n"
"end\n"
+"\n"
"--- @param dest Vec3s\n"
"--- @param a Vec3s\n"
"--- @param b Vec3s\n"
@@ -207,6 +235,7 @@ char gSmluaConstants[] = ""
" dest.z = a.z + b.z\n"
" return dest\n"
"end\n"
+"\n"
"--- @param dest Vec3s\n"
"--- @param a number\n"
"--- @return Vec3s\n"
@@ -216,6 +245,7 @@ char gSmluaConstants[] = ""
" dest.z = dest.z * a\n"
" return dest\n"
"end\n"
+"\n"
"--- @param v1 Vec3s\n"
"--- @param v2 Vec3s\n"
"--- @return number\n"
@@ -225,6 +255,7 @@ char gSmluaConstants[] = ""
" dz = v1.z - v2.z\n"
" return math.sqrt(dx * dx + dy * dy + dz * dz)\n"
"end\n"
+"\n"
"--- @param current number\n"
"--- @param target number\n"
"--- @param inc number\n"
@@ -244,6 +275,7 @@ char gSmluaConstants[] = ""
" end\n"
" return current;\n"
"end\n"
+"\n"
"--- @param current number\n"
"--- @param target number\n"
"--- @param inc number\n"
@@ -261,6 +293,7 @@ char gSmluaConstants[] = ""
" current = target\n"
" end\n"
" end\n"
+"\n"
" -- keep within 32 bits\n"
" if current > 2147483647 then\n"
" current = -2147483648 + (current - 2147483647)\n"
@@ -269,6 +302,7 @@ char gSmluaConstants[] = ""
" end\n"
" return current;\n"
"end\n"
+"\n"
"--- @param bank number\n"
"--- @param soundID number\n"
"--- @param priority number\n"
@@ -278,9 +312,11 @@ char gSmluaConstants[] = ""
" if flags == nil then flags = 0 end\n"
" return (bank << 28) | (soundID << 16) | (priority << 8) | flags | SOUND_STATUS_WAITING\n"
"end\n"
+"\n"
"-------------\n"
"-- courses --\n"
"-------------\n"
+"\n"
"--- @type integer\n"
"COURSE_NONE = 0\n"
"--- @type integer\n"
@@ -1551,6 +1587,14 @@ char gSmluaConstants[] = ""
"MARIO_SPAWN_LAUNCH_STAR_COLLECT = 0x24\n"
"MARIO_SPAWN_LAUNCH_DEATH = 0x25\n"
"MARIO_SPAWN_UNKNOWN_27 = 0x27\n"
+"WARP_NODE_F0 = 0xF0\n"
+"WARP_NODE_DEATH = 0xF1\n"
+"WARP_NODE_F2 = 0xF2\n"
+"WARP_NODE_WARP_FLOOR = 0xF3\n"
+"WARP_NODE_CREDITS_START = 0xF8\n"
+"WARP_NODE_CREDITS_NEXT = 0xF9\n"
+"WARP_NODE_CREDITS_END = 0xFA\n"
+"WARP_NODE_CREDITS_MIN = 0xF8\n"
"WARP_TYPE_NOT_WARPING = 0\n"
"WARP_TYPE_CHANGE_LEVEL = 1\n"
"WARP_TYPE_CHANGE_AREA = 2\n"
diff --git a/src/pc/lua/smlua_functions_autogen.c b/src/pc/lua/smlua_functions_autogen.c
index 897cab66..26d2881a 100644
--- a/src/pc/lua/smlua_functions_autogen.c
+++ b/src/pc/lua/smlua_functions_autogen.c
@@ -13723,6 +13723,25 @@ int smlua_func_level_trigger_warp(lua_State* L) {
return 1;
}
+int smlua_func_lvl_set_current_level(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", "lvl_set_current_level", 2, top);
+ return 0;
+ }
+
+ s16 arg0 = smlua_to_integer(L, 1);
+ if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "lvl_set_current_level"); return 0; }
+ s32 levelNum = smlua_to_integer(L, 2);
+ if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 2, "lvl_set_current_level"); return 0; }
+
+ lua_pushinteger(L, lvl_set_current_level(arg0, levelNum));
+
+ return 1;
+}
+
int smlua_func_warp_special(lua_State* L) {
if (L == NULL) { return 0; }
@@ -31793,6 +31812,7 @@ void smlua_bind_functions_autogen(void) {
smlua_bind_function(L, "get_painting_warp_node", smlua_func_get_painting_warp_node);
smlua_bind_function(L, "initiate_painting_warp", smlua_func_initiate_painting_warp);
smlua_bind_function(L, "level_trigger_warp", smlua_func_level_trigger_warp);
+ smlua_bind_function(L, "lvl_set_current_level", smlua_func_lvl_set_current_level);
smlua_bind_function(L, "warp_special", smlua_func_warp_special);
// mario.h