Turn collision_find_surface_on_ray into an smlua function
This commit is contained in:
parent
dd966a42d4
commit
56b96a97e2
|
@ -82,40 +82,41 @@ override_allowed_functions = {
|
|||
}
|
||||
|
||||
override_disallowed_functions = {
|
||||
"src/audio/external.h": [ " func_" ],
|
||||
"src/engine/math_util.h": [ "atan2s", "atan2f", "vec3s_sub" ],
|
||||
"src/engine/surface_load.h": [ "alloc_surface_poools" ],
|
||||
"src/engine/surface_collision.h": [ " debug_", "f32_find_wall_collision" ],
|
||||
"src/game/mario_actions_airborne.c": [ "^[us]32 act_.*" ],
|
||||
"src/game/mario_actions_automatic.c": [ "^[us]32 act_.*" ],
|
||||
"src/game/mario_actions_cutscene.c": [ "^[us]32 act_.*", " geo_", "spawn_obj", "print_displaying_credits_entry" ],
|
||||
"src/game/mario_actions_moving.c": [ "^[us]32 act_.*" ],
|
||||
"src/game/mario_actions_object.c": [ "^[us]32 act_.*" ],
|
||||
"src/game/mario_actions_stationary.c": [ "^[us]32 act_.*" ],
|
||||
"src/game/mario_actions_submerged.c": [ "^[us]32 act_.*" ],
|
||||
"src/game/mario_step.h": [ " stub_mario_step", "transfer_bully_speed" ],
|
||||
"src/game/mario.h": [ " init_mario" ],
|
||||
"src/pc/djui/djui_console.h": [ " djui_console_create", "djui_console_message_create" ],
|
||||
"src/pc/djui/djui_chat_message.h": [ "create_from" ],
|
||||
"src/game/interaction.h": [ "process_interaction", "_handle_" ],
|
||||
"src/game/sound_init.h": [ "_loop_", "thread4_", "set_sound_mode" ],
|
||||
"src/pc/network/network_utils.h": [ "network_get_player_text_color[^_]" ],
|
||||
"src/pc/network/network_player.h": [ "_init", "_connected[^_]", "_shutdown", "_disconnected", "_update", "construct_player_popup" ],
|
||||
"src/game/object_helpers.c": [ "spawn_obj", "^bhv_", "abs[fi]", "^bit_shift", "_debug$", "^stub_", "_set_model", "cur_obj_set_direction_table", "cur_obj_progress_direction_table" ],
|
||||
"src/game/obj_behaviors.c": [ "debug_" ],
|
||||
"src/game/obj_behaviors_2.c": [ "wiggler_jumped_on_attack_handler", "huge_goomba_weakly_attacked" ],
|
||||
"src/game/spawn_sound.c": [ "spawner" ],
|
||||
"src/game/level_info.h": [ "_name_table" ],
|
||||
"src/pc/lua/utils/smlua_obj_utils.h": [ "spawn_object_remember_field" ],
|
||||
"src/game/camera.h": [ "update_camera", "init_camera", "stub_camera", "^reset_camera", "move_point_along_spline" ],
|
||||
"src/game/behavior_actions.h": [ "bhv_dust_smoke_loop", "bhv_init_room" ],
|
||||
"src/pc/lua/utils/smlua_audio_utils.h": [ "smlua_audio_utils_override", "audio_custom_shutdown", "smlua_audio_custom_init", "smlua_audio_custom_deinit", "audio_sample_destroy_pending_copies", "audio_custom_update_volume" ],
|
||||
"src/pc/djui/djui_hud_utils.h": [ "djui_hud_render_texture", "djui_hud_render_texture_raw", "djui_hud_render_texture_tile", "djui_hud_render_texture_tile_raw" ],
|
||||
"src/pc/lua/utils/smlua_level_utils.h": [ "smlua_level_util_reset" ],
|
||||
"src/pc/lua/utils/smlua_text_utils.h": [ "smlua_text_utils_init", "smlua_text_utils_shutdown", "smlua_text_utils_reset_all" ],
|
||||
"src/pc/lua/utils/smlua_anim_utils.h": [ "smlua_anim_util_reset", "smlua_anim_util_register_animation" ],
|
||||
"src/pc/network/lag_compensation.h": [ "lag_compensation_clear", "lag_compensation_store" ],
|
||||
"src/game/first_person_cam.h": [ "first_person_update" ]
|
||||
"src/audio/external.h": [ " func_" ],
|
||||
"src/engine/math_util.h": [ "atan2s", "atan2f", "vec3s_sub" ],
|
||||
"src/engine/surface_load.h": [ "alloc_surface_poools" ],
|
||||
"src/engine/surface_collision.h": [ " debug_", "f32_find_wall_collision" ],
|
||||
"src/game/mario_actions_airborne.c": [ "^[us]32 act_.*" ],
|
||||
"src/game/mario_actions_automatic.c": [ "^[us]32 act_.*" ],
|
||||
"src/game/mario_actions_cutscene.c": [ "^[us]32 act_.*", " geo_", "spawn_obj", "print_displaying_credits_entry" ],
|
||||
"src/game/mario_actions_moving.c": [ "^[us]32 act_.*" ],
|
||||
"src/game/mario_actions_object.c": [ "^[us]32 act_.*" ],
|
||||
"src/game/mario_actions_stationary.c": [ "^[us]32 act_.*" ],
|
||||
"src/game/mario_actions_submerged.c": [ "^[us]32 act_.*" ],
|
||||
"src/game/mario_step.h": [ " stub_mario_step", "transfer_bully_speed" ],
|
||||
"src/game/mario.h": [ " init_mario" ],
|
||||
"src/pc/djui/djui_console.h": [ " djui_console_create", "djui_console_message_create" ],
|
||||
"src/pc/djui/djui_chat_message.h": [ "create_from" ],
|
||||
"src/game/interaction.h": [ "process_interaction", "_handle_" ],
|
||||
"src/game/sound_init.h": [ "_loop_", "thread4_", "set_sound_mode" ],
|
||||
"src/pc/network/network_utils.h": [ "network_get_player_text_color[^_]" ],
|
||||
"src/pc/network/network_player.h": [ "_init", "_connected[^_]", "_shutdown", "_disconnected", "_update", "construct_player_popup" ],
|
||||
"src/game/object_helpers.c": [ "spawn_obj", "^bhv_", "abs[fi]", "^bit_shift", "_debug$", "^stub_", "_set_model", "cur_obj_set_direction_table", "cur_obj_progress_direction_table" ],
|
||||
"src/game/obj_behaviors.c": [ "debug_" ],
|
||||
"src/game/obj_behaviors_2.c": [ "wiggler_jumped_on_attack_handler", "huge_goomba_weakly_attacked" ],
|
||||
"src/game/spawn_sound.c": [ "spawner" ],
|
||||
"src/game/level_info.h": [ "_name_table" ],
|
||||
"src/pc/lua/utils/smlua_obj_utils.h": [ "spawn_object_remember_field" ],
|
||||
"src/game/camera.h": [ "update_camera", "init_camera", "stub_camera", "^reset_camera", "move_point_along_spline" ],
|
||||
"src/game/behavior_actions.h": [ "bhv_dust_smoke_loop", "bhv_init_room" ],
|
||||
"src/pc/lua/utils/smlua_audio_utils.h": [ "smlua_audio_utils_override", "audio_custom_shutdown", "smlua_audio_custom_init", "smlua_audio_custom_deinit", "audio_sample_destroy_pending_copies", "audio_custom_update_volume" ],
|
||||
"src/pc/djui/djui_hud_utils.h": [ "djui_hud_render_texture", "djui_hud_render_texture_raw", "djui_hud_render_texture_tile", "djui_hud_render_texture_tile_raw" ],
|
||||
"src/pc/lua/utils/smlua_level_utils.h": [ "smlua_level_util_reset" ],
|
||||
"src/pc/lua/utils/smlua_text_utils.h": [ "smlua_text_utils_init", "smlua_text_utils_shutdown", "smlua_text_utils_reset_all" ],
|
||||
"src/pc/lua/utils/smlua_anim_utils.h": [ "smlua_anim_util_reset", "smlua_anim_util_register_animation" ],
|
||||
"src/pc/network/lag_compensation.h": [ "lag_compensation_clear", "lag_compensation_store" ],
|
||||
"src/game/first_person_cam.h": [ "first_person_update" ],
|
||||
"src/pc/lua/utils/smlua_collision_utils.h": [ "collision_find_surface_on_ray" ]
|
||||
}
|
||||
|
||||
override_hide_functions = {
|
||||
|
@ -308,6 +309,8 @@ manual_index_documentation = """
|
|||
- [smlua_anim_util_register_animation](#smlua_anim_util_register_animation)
|
||||
- [level_script_parse](#level_script_parse)
|
||||
- [log_to_console](#log_to_console)
|
||||
- [add_scroll_target](#add_scroll_target)
|
||||
- [collision_find_surface_on_ray](#collision_find_surface_on_ray)
|
||||
|
||||
<br />
|
||||
|
||||
|
@ -652,7 +655,7 @@ Logs a message to the in-game console.
|
|||
| Field | Type |
|
||||
| ----- | ---- |
|
||||
| message | `string` |
|
||||
| level | `ConsoleMessageLevel` |
|
||||
| level (optional) | `ConsoleMessageLevel` |
|
||||
|
||||
### Returns
|
||||
- None
|
||||
|
@ -664,6 +667,57 @@ Logs a message to the in-game console.
|
|||
|
||||
<br />
|
||||
|
||||
## [add_scroll_target](#add_scroll_target)
|
||||
|
||||
Registers a vertex buffer to be used for a scrolling texture. Should be used with `RM_Scroll_Texture` or `editor_Scroll_Texture`
|
||||
|
||||
### Lua Example
|
||||
`add_scroll_target(0, "arena_rainbow_dl_StarRoad_mesh_layer_5_vtx_0")`
|
||||
|
||||
### Parameters
|
||||
| Field | Type |
|
||||
| ----- | ---- |
|
||||
| index | `integer` |
|
||||
| name | `string` |
|
||||
|
||||
### Returns
|
||||
- None
|
||||
|
||||
### C Prototype
|
||||
`void dynos_add_scroll_target(u32 index, const char *name, u32 offset, u32 size);`
|
||||
|
||||
[:arrow_up_small:](#)
|
||||
|
||||
<br />
|
||||
|
||||
## [collision_find_surface_on_ray](#collision_find_surface_on_ray)
|
||||
|
||||
Shoots a raycast from `startX`, `startY`, and `startZ` in the direction of `dirX`, `dirY`, and `dirZ`.
|
||||
|
||||
### Lua Example
|
||||
`collision_find_surface_on_ray(0, 0, 0, 50, 100, 50)`
|
||||
|
||||
### Parameters
|
||||
| Field | Type |
|
||||
| ----- | ---- |
|
||||
| startX | `number` |
|
||||
| startY | `number` |
|
||||
| startZ | `number` |
|
||||
| dirX | `number` |
|
||||
| dirY | `number` |
|
||||
| dirZ | `number` |
|
||||
| precision (optional) | `number` |
|
||||
|
||||
### Returns
|
||||
- [RayIntersectionInfo](structs.md#RayIntersectionInfo)
|
||||
|
||||
### C Prototype
|
||||
`struct RayIntersectionInfo* collision_find_surface_on_ray(f32 startX, f32 startY, f32 startZ, f32 dirX, f32 dirY, f32 dirZ, f32 precision);`
|
||||
|
||||
[:arrow_up_small:](#)
|
||||
|
||||
<br />
|
||||
|
||||
"""
|
||||
|
||||
############################################################################
|
||||
|
|
|
@ -7610,29 +7610,6 @@ function collision_find_floor(x, y, z)
|
|||
-- ...
|
||||
end
|
||||
|
||||
--- @param startX number
|
||||
--- @param startY number
|
||||
--- @param startZ number
|
||||
--- @param dirX number
|
||||
--- @param dirY number
|
||||
--- @param dirZ number
|
||||
--- @return RayIntersectionInfo
|
||||
function collision_find_surface_on_ray(startX, startY, startZ, dirX, dirY, dirZ)
|
||||
-- ...
|
||||
end
|
||||
|
||||
--- @param startX number
|
||||
--- @param startY number
|
||||
--- @param startZ number
|
||||
--- @param dirX number
|
||||
--- @param dirY number
|
||||
--- @param dirZ number
|
||||
--- @param precision number
|
||||
--- @return RayIntersectionInfo
|
||||
function collision_find_surface_on_ray_precision(startX, startY, startZ, dirX, dirY, dirZ, precision)
|
||||
-- ...
|
||||
end
|
||||
|
||||
--- @return WallCollisionData
|
||||
function collision_get_temp_wall_collision_data()
|
||||
-- ...
|
||||
|
|
|
@ -368,9 +368,22 @@ function log_to_console(message, level)
|
|||
-- ...
|
||||
end
|
||||
|
||||
--- @param index integer The index of the scroll target, should match up with the behavior param of RM_Scroll_Texture or editor_Scroll_Texture
|
||||
--- @param index integer The index of the scroll target, should match up with the behavior param of `RM_Scroll_Texture` or `editor_Scroll_Texture`
|
||||
--- @param name string The name of the vertex buffer that should be used while scrolling the texture
|
||||
--- Registers a vertex buffer to be used for a scrolling texture. Should be used with RM_Scroll_Texture or editor_Scroll_Texture
|
||||
--- Registers a vertex buffer to be used for a scrolling texture. Should be used with `RM_Scroll_Texture` or `editor_Scroll_Texture`
|
||||
function add_scroll_target(index, name)
|
||||
-- ...
|
||||
end
|
||||
|
||||
--- @param startX number Start position X
|
||||
--- @param startY number Start position Y
|
||||
--- @param startZ number Start position Z
|
||||
--- @param dirX number Direction X
|
||||
--- @param dirY number Direction Y
|
||||
--- @param dirZ number Direction Z
|
||||
--- @param precision? number Optional; How precise the raycast should be. The default value is 3.0, the higher the number, the more precise.
|
||||
--- @return RayIntersectionInfo
|
||||
--- Shoots a raycast from `startX`, `startY`, and `startZ` in the direction of `dirX`, `dirY`, and `dirZ`
|
||||
function collision_find_surface_on_ray(startX, startY, startZ, dirX, dirY, dirZ, precision)
|
||||
-- ...
|
||||
end
|
|
@ -450,57 +450,6 @@
|
|||
|
||||
<br />
|
||||
|
||||
## [collision_find_surface_on_ray](#collision_find_surface_on_ray)
|
||||
|
||||
### Lua Example
|
||||
`local RayIntersectionInfoValue = collision_find_surface_on_ray(startX, startY, startZ, dirX, dirY, dirZ)`
|
||||
|
||||
### Parameters
|
||||
| Field | Type |
|
||||
| ----- | ---- |
|
||||
| startX | `number` |
|
||||
| startY | `number` |
|
||||
| startZ | `number` |
|
||||
| dirX | `number` |
|
||||
| dirY | `number` |
|
||||
| dirZ | `number` |
|
||||
|
||||
### Returns
|
||||
[RayIntersectionInfo](structs.md#RayIntersectionInfo)
|
||||
|
||||
### C Prototype
|
||||
`struct RayIntersectionInfo* collision_find_surface_on_ray(f32 startX, f32 startY, f32 startZ, f32 dirX, f32 dirY, f32 dirZ);`
|
||||
|
||||
[:arrow_up_small:](#)
|
||||
|
||||
<br />
|
||||
|
||||
## [collision_find_surface_on_ray_precision](#collision_find_surface_on_ray_precision)
|
||||
|
||||
### Lua Example
|
||||
`local RayIntersectionInfoValue = collision_find_surface_on_ray_precision(startX, startY, startZ, dirX, dirY, dirZ, precision)`
|
||||
|
||||
### Parameters
|
||||
| Field | Type |
|
||||
| ----- | ---- |
|
||||
| startX | `number` |
|
||||
| startY | `number` |
|
||||
| startZ | `number` |
|
||||
| dirX | `number` |
|
||||
| dirY | `number` |
|
||||
| dirZ | `number` |
|
||||
| precision | `number` |
|
||||
|
||||
### Returns
|
||||
[RayIntersectionInfo](structs.md#RayIntersectionInfo)
|
||||
|
||||
### C Prototype
|
||||
`struct RayIntersectionInfo* collision_find_surface_on_ray_precision(f32 startX, f32 startY, f32 startZ, f32 dirX, f32 dirY, f32 dirZ, f32 precision);`
|
||||
|
||||
[:arrow_up_small:](#)
|
||||
|
||||
<br />
|
||||
|
||||
## [collision_get_temp_wall_collision_data](#collision_get_temp_wall_collision_data)
|
||||
|
||||
### Lua Example
|
||||
|
|
|
@ -24,6 +24,8 @@
|
|||
- [smlua_anim_util_register_animation](#smlua_anim_util_register_animation)
|
||||
- [level_script_parse](#level_script_parse)
|
||||
- [log_to_console](#log_to_console)
|
||||
- [add_scroll_target](#add_scroll_target)
|
||||
- [collision_find_surface_on_ray](#collision_find_surface_on_ray)
|
||||
|
||||
<br />
|
||||
|
||||
|
@ -1595,8 +1597,6 @@
|
|||
- smlua_collision_utils.h
|
||||
- [collision_find_ceil](functions-5.md#collision_find_ceil)
|
||||
- [collision_find_floor](functions-5.md#collision_find_floor)
|
||||
- [collision_find_surface_on_ray](functions-5.md#collision_find_surface_on_ray)
|
||||
- [collision_find_surface_on_ray_precision](functions-5.md#collision_find_surface_on_ray_precision)
|
||||
- [collision_get_temp_wall_collision_data](functions-5.md#collision_get_temp_wall_collision_data)
|
||||
- [get_water_surface_pseudo_floor](functions-5.md#get_water_surface_pseudo_floor)
|
||||
- [smlua_collision_util_get](functions-5.md#smlua_collision_util_get)
|
||||
|
@ -2202,7 +2202,7 @@ Logs a message to the in-game console.
|
|||
| Field | Type |
|
||||
| ----- | ---- |
|
||||
| message | `string` |
|
||||
| level | `ConsoleMessageLevel` |
|
||||
| level (optional) | `ConsoleMessageLevel` |
|
||||
|
||||
### Returns
|
||||
- None
|
||||
|
@ -2214,6 +2214,57 @@ Logs a message to the in-game console.
|
|||
|
||||
<br />
|
||||
|
||||
## [add_scroll_target](#add_scroll_target)
|
||||
|
||||
Registers a vertex buffer to be used for a scrolling texture. Should be used with `RM_Scroll_Texture` or `editor_Scroll_Texture`
|
||||
|
||||
### Lua Example
|
||||
`add_scroll_target(0, "arena_rainbow_dl_StarRoad_mesh_layer_5_vtx_0")`
|
||||
|
||||
### Parameters
|
||||
| Field | Type |
|
||||
| ----- | ---- |
|
||||
| index | `integer` |
|
||||
| name | `string` |
|
||||
|
||||
### Returns
|
||||
- None
|
||||
|
||||
### C Prototype
|
||||
`void dynos_add_scroll_target(u32 index, const char *name, u32 offset, u32 size);`
|
||||
|
||||
[:arrow_up_small:](#)
|
||||
|
||||
<br />
|
||||
|
||||
## [collision_find_surface_on_ray](#collision_find_surface_on_ray)
|
||||
|
||||
Shoots a raycast from `startX`, `startY`, and `startZ` in the direction of `dirX`, `dirY`, and `dirZ`.
|
||||
|
||||
### Lua Example
|
||||
`collision_find_surface_on_ray(0, 0, 0, 50, 100, 50)`
|
||||
|
||||
### Parameters
|
||||
| Field | Type |
|
||||
| ----- | ---- |
|
||||
| startX | `number` |
|
||||
| startY | `number` |
|
||||
| startZ | `number` |
|
||||
| dirX | `number` |
|
||||
| dirY | `number` |
|
||||
| dirZ | `number` |
|
||||
| precision (optional) | `number` |
|
||||
|
||||
### Returns
|
||||
- [RayIntersectionInfo](structs.md#RayIntersectionInfo)
|
||||
|
||||
### C Prototype
|
||||
`struct RayIntersectionInfo* collision_find_surface_on_ray(f32 startX, f32 startY, f32 startZ, f32 dirX, f32 dirY, f32 dirZ, f32 precision);`
|
||||
|
||||
[:arrow_up_small:](#)
|
||||
|
||||
<br />
|
||||
|
||||
|
||||
---
|
||||
# functions from area.h
|
||||
|
|
|
@ -14,6 +14,7 @@
|
|||
#include "include/level_misc_macros.h"
|
||||
#include "include/macro_presets.h"
|
||||
#include "utils/smlua_anim_utils.h"
|
||||
#include "utils/smlua_collision_utils.h"
|
||||
|
||||
bool smlua_functions_valid_param_count(lua_State* L, int expected) {
|
||||
int top = lua_gettop(L);
|
||||
|
@ -41,7 +42,7 @@ int smlua_func_sins(lua_State* L) {
|
|||
if (!smlua_functions_valid_param_count(L, 1)) { return 0; }
|
||||
|
||||
s16 x = smlua_to_number(L, 1);
|
||||
if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1"); return 0; }
|
||||
if (!gSmLuaConvertSuccess) { LOG_LUA("sins: Failed to convert parameter 1"); return 0; }
|
||||
|
||||
lua_pushnumber(L, sins(x));
|
||||
return 1;
|
||||
|
@ -51,7 +52,7 @@ int smlua_func_coss(lua_State* L) {
|
|||
if (!smlua_functions_valid_param_count(L, 1)) { return 0; }
|
||||
|
||||
s16 x = smlua_to_number(L, 1);
|
||||
if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1"); return 0; }
|
||||
if (!gSmLuaConvertSuccess) { LOG_LUA("coss: Failed to convert parameter 1"); return 0; }
|
||||
|
||||
lua_pushnumber(L, coss(x));
|
||||
return 1;
|
||||
|
@ -61,9 +62,9 @@ int smlua_func_atan2s(lua_State* L) {
|
|||
if (!smlua_functions_valid_param_count(L, 2)) { return 0; }
|
||||
|
||||
f32 y = smlua_to_number(L, 1);
|
||||
if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1"); return 0; }
|
||||
if (!gSmLuaConvertSuccess) { LOG_LUA("atan2s: Failed to convert parameter 1"); return 0; }
|
||||
f32 x = smlua_to_number(L, 2);
|
||||
if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 2"); return 0; }
|
||||
if (!gSmLuaConvertSuccess) { LOG_LUA("atan2s: Failed to convert parameter 2"); return 0; }
|
||||
|
||||
lua_pushinteger(L, atan2s(y, x));
|
||||
return 1;
|
||||
|
@ -71,7 +72,7 @@ int smlua_func_atan2s(lua_State* L) {
|
|||
|
||||
int smlua_func_init_mario_after_warp(lua_State* L) {
|
||||
if (network_player_connected_count() >= 2) {
|
||||
LOG_LUA_LINE("This function can only be used in single-player");
|
||||
LOG_LUA_LINE("init_mario_after_warp can only be used in single-player");
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -87,13 +88,13 @@ int smlua_func_initiate_warp(lua_State* L) {
|
|||
if(!smlua_functions_valid_param_count(L, 4)) { return 0; }
|
||||
|
||||
s16 destLevel = smlua_to_number(L, 1);
|
||||
if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1"); return 0; }
|
||||
if (!gSmLuaConvertSuccess) { LOG_LUA("initiate_warp: Failed to convert parameter 1"); return 0; }
|
||||
s16 destArea = smlua_to_number(L, 2);
|
||||
if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 2"); return 0; }
|
||||
if (!gSmLuaConvertSuccess) { LOG_LUA("initiate_warp: Failed to convert parameter 2"); return 0; }
|
||||
s16 destWarpNode = smlua_to_number(L, 3);
|
||||
if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 3"); return 0; }
|
||||
if (!gSmLuaConvertSuccess) { LOG_LUA("initiate_warp: Failed to convert parameter 3"); return 0; }
|
||||
s32 arg3 = smlua_to_number(L, 4);
|
||||
if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 4"); return 0; }
|
||||
if (!gSmLuaConvertSuccess) { LOG_LUA("initiate_warp: Failed to convert parameter 4"); return 0; }
|
||||
|
||||
extern void initiate_warp(s16 destLevel, s16 destArea, s16 destWarpNode, s32 arg3);
|
||||
initiate_warp(destLevel, destArea, destWarpNode, arg3);
|
||||
|
@ -103,7 +104,7 @@ int smlua_func_initiate_warp(lua_State* L) {
|
|||
|
||||
int smlua_func_reset_level(lua_State* L) {
|
||||
if (network_player_connected_count() >= 2) {
|
||||
LOG_LUA_LINE("This function can only be used in single-player");
|
||||
LOG_LUA_LINE("reset_level() can only be used in single-player");
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -118,10 +119,10 @@ int smlua_func_network_init_object(lua_State* L) {
|
|||
if (!smlua_functions_valid_param_count(L, 3)) { return 0; }
|
||||
|
||||
struct Object* obj = smlua_to_cobject(L, 1, LOT_OBJECT);
|
||||
if (!gSmLuaConvertSuccess || obj == NULL) { LOG_LUA("Failed to convert parameter 1"); return 0; }
|
||||
if (!gSmLuaConvertSuccess || obj == NULL) { LOG_LUA("network_init_object: Failed to convert parameter 1"); return 0; }
|
||||
|
||||
bool standardSync = smlua_to_boolean(L, 2);
|
||||
if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 2"); return 0; }
|
||||
if (!gSmLuaConvertSuccess) { LOG_LUA("network_init_object: Failed to convert parameter 2"); return 0; }
|
||||
|
||||
if (lua_type(L, 3) != LUA_TNIL && lua_type(L, 3) != LUA_TTABLE) {
|
||||
LOG_LUA_LINE("network_init_object() called with an invalid type for param 3: %u", lua_type(L, 3));
|
||||
|
@ -130,7 +131,7 @@ int smlua_func_network_init_object(lua_State* L) {
|
|||
|
||||
struct SyncObject* so = sync_object_init(obj, standardSync ? 4000.0f : SYNC_DISTANCE_ONLY_EVENTS);
|
||||
if (so == NULL) {
|
||||
LOG_LUA_LINE("Failed to allocate sync object.");
|
||||
LOG_LUA_LINE("network_init_object: Failed to allocate sync object.");
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -182,14 +183,14 @@ int smlua_func_network_send_object(lua_State* L) {
|
|||
if (!smlua_functions_valid_param_count(L, 2)) { return 0; }
|
||||
|
||||
struct Object* obj = smlua_to_cobject(L, 1, LOT_OBJECT);
|
||||
if (!gSmLuaConvertSuccess || obj == NULL) { LOG_LUA("Failed to convert parameter 1"); return 0; }
|
||||
if (!gSmLuaConvertSuccess || obj == NULL) { LOG_LUA("network_send_object: Failed to convert parameter 1"); return 0; }
|
||||
|
||||
bool reliable = smlua_to_boolean(L, 2);
|
||||
if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 2"); return 0; }
|
||||
if (!gSmLuaConvertSuccess) { LOG_LUA("network_send_object: Failed to convert parameter 2"); return 0; }
|
||||
|
||||
struct SyncObject* so = sync_object_get(obj->oSyncID);
|
||||
if (!so || so->o != obj) {
|
||||
LOG_LUA_LINE("Failed to retrieve sync object.");
|
||||
LOG_LUA_LINE("network_send_object: Failed to retrieve sync object.");
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -263,7 +264,7 @@ int smlua_func_djui_hud_render_texture(lua_State* L) {
|
|||
|
||||
if (smlua_is_cobject(L, 1, LOT_TEXTUREINFO)) {
|
||||
texInfo = (struct TextureInfo*)smlua_to_cobject(L, 1, LOT_TEXTUREINFO);
|
||||
if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1"); return 0; }
|
||||
if (!gSmLuaConvertSuccess) { LOG_LUA("djui_hud_render_texture: Failed to convert parameter 1"); return 0; }
|
||||
} else {
|
||||
int top = lua_gettop(L);
|
||||
lua_pushvalue(L, 1);
|
||||
|
@ -272,31 +273,31 @@ int smlua_func_djui_hud_render_texture(lua_State* L) {
|
|||
lua_gettable(L, top+1);
|
||||
tmpTexInfo.texture = smlua_to_cpointer(L, lua_gettop(L), LVT_U8_P);
|
||||
lua_pop(L, 1);
|
||||
if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1's 'texture' field"); return 0; }
|
||||
if (!gSmLuaConvertSuccess) { LOG_LUA("djui_hud_render_texture: Failed to convert parameter 1's 'texture' field"); return 0; }
|
||||
|
||||
tmpTexInfo.bitSize = smlua_get_integer_field(top+1, "bitSize");
|
||||
if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1's 'bitSize' field"); return 0; }
|
||||
if (!gSmLuaConvertSuccess) { LOG_LUA("djui_hud_render_texture: Failed to convert parameter 1's 'bitSize' field"); return 0; }
|
||||
|
||||
tmpTexInfo.width = smlua_get_integer_field(top+1, "width");
|
||||
if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1's 'width' field"); return 0; }
|
||||
if (!gSmLuaConvertSuccess) { LOG_LUA("djui_hud_render_texture: Failed to convert parameter 1's 'width' field"); return 0; }
|
||||
|
||||
tmpTexInfo.height = smlua_get_integer_field(top+1, "height");
|
||||
if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1's 'height' field"); return 0; }
|
||||
if (!gSmLuaConvertSuccess) { LOG_LUA("djui_hud_render_texture: Failed to convert parameter 1's 'height' field"); return 0; }
|
||||
|
||||
tmpTexInfo.name = smlua_get_string_field(top+1, "name");
|
||||
if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1's 'name' field"); return 0; }
|
||||
if (!gSmLuaConvertSuccess) { LOG_LUA("djui_hud_render_texture: Failed to convert parameter 1's 'name' field"); return 0; }
|
||||
|
||||
lua_settop(L, top);
|
||||
}
|
||||
|
||||
f32 x = smlua_to_number(L, 2);
|
||||
if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 2"); return 0; }
|
||||
if (!gSmLuaConvertSuccess) { LOG_LUA("djui_hud_render_texture: Failed to convert parameter 2"); return 0; }
|
||||
f32 y = smlua_to_number(L, 3);
|
||||
if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 3"); return 0; }
|
||||
if (!gSmLuaConvertSuccess) { LOG_LUA("djui_hud_render_texture: Failed to convert parameter 3"); return 0; }
|
||||
f32 scaleW = smlua_to_number(L, 4);
|
||||
if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 4"); return 0; }
|
||||
if (!gSmLuaConvertSuccess) { LOG_LUA("djui_hud_render_texture: Failed to convert parameter 4"); return 0; }
|
||||
f32 scaleH = smlua_to_number(L, 5);
|
||||
if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 5"); return 0; }
|
||||
if (!gSmLuaConvertSuccess) { LOG_LUA("djui_hud_render_texture: Failed to convert parameter 5"); return 0; }
|
||||
|
||||
djui_hud_render_texture_raw(texInfo->texture, texInfo->bitSize, texInfo->width, texInfo->height, x, y, scaleW, scaleH);
|
||||
|
||||
|
@ -311,7 +312,7 @@ int smlua_func_djui_hud_render_texture_tile(lua_State* L) {
|
|||
|
||||
if (smlua_is_cobject(L, 1, LOT_TEXTUREINFO)) {
|
||||
texInfo = (struct TextureInfo*)smlua_to_cobject(L, 1, LOT_TEXTUREINFO);
|
||||
if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1"); return 0; }
|
||||
if (!gSmLuaConvertSuccess) { LOG_LUA("djui_hud_render_texture_tile: Failed to convert parameter 1"); return 0; }
|
||||
} else {
|
||||
int top = lua_gettop(L);
|
||||
lua_pushvalue(L, 1);
|
||||
|
@ -320,39 +321,39 @@ int smlua_func_djui_hud_render_texture_tile(lua_State* L) {
|
|||
lua_gettable(L, top+1);
|
||||
tmpTexInfo.texture = smlua_to_cpointer(L, lua_gettop(L), LVT_U8_P);
|
||||
lua_pop(L, 1);
|
||||
if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1's 'texture' field"); return 0; }
|
||||
if (!gSmLuaConvertSuccess) { LOG_LUA("djui_hud_render_texture_tile: Failed to convert parameter 1's 'texture' field"); return 0; }
|
||||
|
||||
tmpTexInfo.bitSize = smlua_get_integer_field(top+1, "bitSize");
|
||||
if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1's 'bitSize' field"); return 0; }
|
||||
if (!gSmLuaConvertSuccess) { LOG_LUA("djui_hud_render_texture_tile: Failed to convert parameter 1's 'bitSize' field"); return 0; }
|
||||
|
||||
tmpTexInfo.width = smlua_get_integer_field(top+1, "width");
|
||||
if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1's 'width' field"); return 0; }
|
||||
if (!gSmLuaConvertSuccess) { LOG_LUA("djui_hud_render_texture_tile: Failed to convert parameter 1's 'width' field"); return 0; }
|
||||
|
||||
tmpTexInfo.height = smlua_get_integer_field(top+1, "height");
|
||||
if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1's 'height' field"); return 0; }
|
||||
if (!gSmLuaConvertSuccess) { LOG_LUA("djui_hud_render_texture_tile: Failed to convert parameter 1's 'height' field"); return 0; }
|
||||
|
||||
tmpTexInfo.name = smlua_get_string_field(top+1, "name");
|
||||
if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1's 'name' field"); return 0; }
|
||||
if (!gSmLuaConvertSuccess) { LOG_LUA("djui_hud_render_texture_tile: Failed to convert parameter 1's 'name' field"); return 0; }
|
||||
|
||||
lua_settop(L, top);
|
||||
}
|
||||
|
||||
f32 x = smlua_to_number(L, 2);
|
||||
if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 2"); return 0; }
|
||||
if (!gSmLuaConvertSuccess) { LOG_LUA("djui_hud_render_texture_tile: Failed to convert parameter 2"); return 0; }
|
||||
f32 y = smlua_to_number(L, 3);
|
||||
if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 3"); return 0; }
|
||||
if (!gSmLuaConvertSuccess) { LOG_LUA("djui_hud_render_texture_tile: Failed to convert parameter 3"); return 0; }
|
||||
f32 scaleW = smlua_to_number(L, 4);
|
||||
if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 4"); return 0; }
|
||||
if (!gSmLuaConvertSuccess) { LOG_LUA("djui_hud_render_texture_tile: Failed to convert parameter 4"); return 0; }
|
||||
f32 scaleH = smlua_to_number(L, 5);
|
||||
if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 5"); return 0; }
|
||||
if (!gSmLuaConvertSuccess) { LOG_LUA("djui_hud_render_texture_tile: Failed to convert parameter 5"); return 0; }
|
||||
f32 tileX = smlua_to_number(L, 6);
|
||||
if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 6"); return 0; }
|
||||
if (!gSmLuaConvertSuccess) { LOG_LUA("djui_hud_render_texture_tile: Failed to convert parameter 6"); return 0; }
|
||||
f32 tileY = smlua_to_number(L, 7);
|
||||
if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 7"); return 0; }
|
||||
if (!gSmLuaConvertSuccess) { LOG_LUA("djui_hud_render_texture_tile: Failed to convert parameter 7"); return 0; }
|
||||
f32 tileW = smlua_to_number(L, 8);
|
||||
if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 8"); return 0; }
|
||||
if (!gSmLuaConvertSuccess) { LOG_LUA("djui_hud_render_texture_tile: Failed to convert parameter 8"); return 0; }
|
||||
f32 tileH = smlua_to_number(L, 9);
|
||||
if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 9"); return 0; }
|
||||
if (!gSmLuaConvertSuccess) { LOG_LUA("djui_hud_render_texture_tile: Failed to convert parameter 9"); return 0; }
|
||||
|
||||
djui_hud_render_texture_tile_raw(texInfo->texture, texInfo->bitSize, texInfo->width, texInfo->height, x, y, scaleW, scaleH, tileX, tileY, tileW, tileH);
|
||||
|
||||
|
@ -367,7 +368,7 @@ int smlua_func_djui_hud_render_texture_interpolated(lua_State* L) {
|
|||
|
||||
if (smlua_is_cobject(L, 1, LOT_TEXTUREINFO)) {
|
||||
texInfo = (struct TextureInfo*)smlua_to_cobject(L, 1, LOT_TEXTUREINFO);
|
||||
if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1"); return 0; }
|
||||
if (!gSmLuaConvertSuccess) { LOG_LUA("djui_hud_render_texture_interpolated: Failed to convert parameter 1"); return 0; }
|
||||
} else {
|
||||
int top = lua_gettop(L);
|
||||
lua_pushvalue(L, 1);
|
||||
|
@ -376,39 +377,39 @@ int smlua_func_djui_hud_render_texture_interpolated(lua_State* L) {
|
|||
lua_gettable(L, top+1);
|
||||
tmpTexInfo.texture = smlua_to_cpointer(L, lua_gettop(L), LVT_U8_P);
|
||||
lua_pop(L, 1);
|
||||
if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1's 'texture' field"); return 0; }
|
||||
if (!gSmLuaConvertSuccess) { LOG_LUA("djui_hud_render_texture_interpolated: Failed to convert parameter 1's 'texture' field"); return 0; }
|
||||
|
||||
tmpTexInfo.bitSize = smlua_get_integer_field(top+1, "bitSize");
|
||||
if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1's 'bitSize' field"); return 0; }
|
||||
if (!gSmLuaConvertSuccess) { LOG_LUA("djui_hud_render_texture_interpolated: Failed to convert parameter 1's 'bitSize' field"); return 0; }
|
||||
|
||||
tmpTexInfo.width = smlua_get_integer_field(top+1, "width");
|
||||
if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1's 'width' field"); return 0; }
|
||||
if (!gSmLuaConvertSuccess) { LOG_LUA("djui_hud_render_texture_interpolated: Failed to convert parameter 1's 'width' field"); return 0; }
|
||||
|
||||
tmpTexInfo.height = smlua_get_integer_field(top+1, "height");
|
||||
if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1's 'height' field"); return 0; }
|
||||
if (!gSmLuaConvertSuccess) { LOG_LUA("djui_hud_render_texture_interpolated: Failed to convert parameter 1's 'height' field"); return 0; }
|
||||
|
||||
tmpTexInfo.name = smlua_get_string_field(top+1, "name");
|
||||
if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1's 'name' field"); return 0; }
|
||||
if (!gSmLuaConvertSuccess) { LOG_LUA("djui_hud_render_texture_interpolated: Failed to convert parameter 1's 'name' field"); return 0; }
|
||||
|
||||
lua_settop(L, top);
|
||||
}
|
||||
|
||||
f32 prevX = smlua_to_number(L, 2);
|
||||
if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 2"); return 0; }
|
||||
if (!gSmLuaConvertSuccess) { LOG_LUA("djui_hud_render_texture_interpolated: Failed to convert parameter 2"); return 0; }
|
||||
f32 prevY = smlua_to_number(L, 3);
|
||||
if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 3"); return 0; }
|
||||
if (!gSmLuaConvertSuccess) { LOG_LUA("djui_hud_render_texture_interpolated: Failed to convert parameter 3"); return 0; }
|
||||
f32 prevScaleW = smlua_to_number(L, 4);
|
||||
if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 4"); return 0; }
|
||||
if (!gSmLuaConvertSuccess) { LOG_LUA("djui_hud_render_texture_interpolated: Failed to convert parameter 4"); return 0; }
|
||||
f32 prevScaleH = smlua_to_number(L, 5);
|
||||
if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 5"); return 0; }
|
||||
if (!gSmLuaConvertSuccess) { LOG_LUA("djui_hud_render_texture_interpolated: Failed to convert parameter 5"); return 0; }
|
||||
f32 x = smlua_to_number(L, 6);
|
||||
if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 6"); return 0; }
|
||||
if (!gSmLuaConvertSuccess) { LOG_LUA("djui_hud_render_texture_interpolated: Failed to convert parameter 6"); return 0; }
|
||||
f32 y = smlua_to_number(L, 7);
|
||||
if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 7"); return 0; }
|
||||
if (!gSmLuaConvertSuccess) { LOG_LUA("djui_hud_render_texture_interpolated: Failed to convert parameter 7"); return 0; }
|
||||
f32 scaleW = smlua_to_number(L, 8);
|
||||
if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 8"); return 0; }
|
||||
if (!gSmLuaConvertSuccess) { LOG_LUA("djui_hud_render_texture_interpolated: Failed to convert parameter 8"); return 0; }
|
||||
f32 scaleH = smlua_to_number(L, 9);
|
||||
if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 9"); return 0; }
|
||||
if (!gSmLuaConvertSuccess) { LOG_LUA("djui_hud_render_texture_interpolated: Failed to convert parameter 9"); return 0; }
|
||||
|
||||
djui_hud_render_texture_interpolated(texInfo, prevX, prevY, prevScaleW, prevScaleH, x, y, scaleW, scaleH);
|
||||
|
||||
|
@ -423,7 +424,7 @@ int smlua_func_djui_hud_render_texture_tile_interpolated(lua_State* L) {
|
|||
|
||||
if (smlua_is_cobject(L, 1, LOT_TEXTUREINFO)) {
|
||||
texInfo = (struct TextureInfo*)smlua_to_cobject(L, 1, LOT_TEXTUREINFO);
|
||||
if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1"); return 0; }
|
||||
if (!gSmLuaConvertSuccess) { LOG_LUA("djui_hud_render_texture_tile_interpolated: Failed to convert parameter 1"); return 0; }
|
||||
} else {
|
||||
int top = lua_gettop(L);
|
||||
lua_pushvalue(L, 1);
|
||||
|
@ -432,47 +433,47 @@ int smlua_func_djui_hud_render_texture_tile_interpolated(lua_State* L) {
|
|||
lua_gettable(L, top+1);
|
||||
tmpTexInfo.texture = smlua_to_cpointer(L, lua_gettop(L), LVT_U8_P);
|
||||
lua_pop(L, 1);
|
||||
if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1's 'texture' field"); return 0; }
|
||||
if (!gSmLuaConvertSuccess) { LOG_LUA("djui_hud_render_texture_tile_interpolated: Failed to convert parameter 1's 'texture' field"); return 0; }
|
||||
|
||||
tmpTexInfo.bitSize = smlua_get_integer_field(top+1, "bitSize");
|
||||
if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1's 'bitSize' field"); return 0; }
|
||||
if (!gSmLuaConvertSuccess) { LOG_LUA("djui_hud_render_texture_tile_interpolated: Failed to convert parameter 1's 'bitSize' field"); return 0; }
|
||||
|
||||
tmpTexInfo.width = smlua_get_integer_field(top+1, "width");
|
||||
if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1's 'width' field"); return 0; }
|
||||
if (!gSmLuaConvertSuccess) { LOG_LUA("djui_hud_render_texture_tile_interpolated: Failed to convert parameter 1's 'width' field"); return 0; }
|
||||
|
||||
tmpTexInfo.height = smlua_get_integer_field(top+1, "height");
|
||||
if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1's 'height' field"); return 0; }
|
||||
if (!gSmLuaConvertSuccess) { LOG_LUA("djui_hud_render_texture_tile_interpolated: Failed to convert parameter 1's 'height' field"); return 0; }
|
||||
|
||||
tmpTexInfo.name = smlua_get_string_field(top+1, "name");
|
||||
if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1's 'name' field"); return 0; }
|
||||
if (!gSmLuaConvertSuccess) { LOG_LUA("djui_hud_render_texture_tile_interpolated: Failed to convert parameter 1's 'name' field"); return 0; }
|
||||
|
||||
lua_settop(L, top);
|
||||
}
|
||||
|
||||
f32 prevX = smlua_to_number(L, 2);
|
||||
if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 2"); return 0; }
|
||||
if (!gSmLuaConvertSuccess) { LOG_LUA("djui_hud_render_texture_tile_interpolated: Failed to convert parameter 2"); return 0; }
|
||||
f32 prevY = smlua_to_number(L, 3);
|
||||
if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 3"); return 0; }
|
||||
if (!gSmLuaConvertSuccess) { LOG_LUA("djui_hud_render_texture_tile_interpolated: Failed to convert parameter 3"); return 0; }
|
||||
f32 prevScaleW = smlua_to_number(L, 4);
|
||||
if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 4"); return 0; }
|
||||
if (!gSmLuaConvertSuccess) { LOG_LUA("djui_hud_render_texture_tile_interpolated: Failed to convert parameter 4"); return 0; }
|
||||
f32 prevScaleH = smlua_to_number(L, 5);
|
||||
if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 5"); return 0; }
|
||||
if (!gSmLuaConvertSuccess) { LOG_LUA("djui_hud_render_texture_tile_interpolated: Failed to convert parameter 5"); return 0; }
|
||||
f32 x = smlua_to_number(L, 6);
|
||||
if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 6"); return 0; }
|
||||
if (!gSmLuaConvertSuccess) { LOG_LUA("djui_hud_render_texture_tile_interpolated: Failed to convert parameter 6"); return 0; }
|
||||
f32 y = smlua_to_number(L, 7);
|
||||
if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 7"); return 0; }
|
||||
if (!gSmLuaConvertSuccess) { LOG_LUA("djui_hud_render_texture_tile_interpolated: Failed to convert parameter 7"); return 0; }
|
||||
f32 scaleW = smlua_to_number(L, 8);
|
||||
if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 8"); return 0; }
|
||||
if (!gSmLuaConvertSuccess) { LOG_LUA("djui_hud_render_texture_tile_interpolated: Failed to convert parameter 8"); return 0; }
|
||||
f32 scaleH = smlua_to_number(L, 9);
|
||||
if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 9"); return 0; }
|
||||
if (!gSmLuaConvertSuccess) { LOG_LUA("djui_hud_render_texture_tile_interpolated: Failed to convert parameter 9"); return 0; }
|
||||
f32 tileX = smlua_to_number(L, 10);
|
||||
if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 10"); return 0; }
|
||||
if (!gSmLuaConvertSuccess) { LOG_LUA("djui_hud_render_texture_tile_interpolated: Failed to convert parameter 10"); return 0; }
|
||||
f32 tileY = smlua_to_number(L, 11);
|
||||
if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 11"); return 0; }
|
||||
if (!gSmLuaConvertSuccess) { LOG_LUA("djui_hud_render_texture_tile_interpolated: Failed to convert parameter 11"); return 0; }
|
||||
f32 tileW = smlua_to_number(L, 12);
|
||||
if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 12"); return 0; }
|
||||
if (!gSmLuaConvertSuccess) { LOG_LUA("djui_hud_render_texture_tile_interpolated: Failed to convert parameter 12"); return 0; }
|
||||
f32 tileH = smlua_to_number(L, 13);
|
||||
if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 13"); return 0; }
|
||||
if (!gSmLuaConvertSuccess) { LOG_LUA("djui_hud_render_texture_tile_interpolated: Failed to convert parameter 13"); return 0; }
|
||||
|
||||
djui_hud_render_texture_tile_interpolated(texInfo, prevX, prevY, prevScaleW, prevScaleH, x, y, scaleW, scaleH, tileX, tileY, tileW, tileH);
|
||||
|
||||
|
@ -489,7 +490,7 @@ int smlua_func_texture_override_set(lua_State* L) {
|
|||
|
||||
if (smlua_is_cobject(L, 2, LOT_TEXTUREINFO)) {
|
||||
overrideTexInfo = (struct TextureInfo*)smlua_to_cobject(L, 2, LOT_TEXTUREINFO);
|
||||
if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 2"); return 0; }
|
||||
if (!gSmLuaConvertSuccess) { LOG_LUA("texture_override_set: Failed to convert parameter 2"); return 0; }
|
||||
} else {
|
||||
int top = lua_gettop(L);
|
||||
lua_pushvalue(L, 2);
|
||||
|
@ -498,19 +499,19 @@ int smlua_func_texture_override_set(lua_State* L) {
|
|||
lua_gettable(L, top+1);
|
||||
tmpOverrideTexInfo.texture = smlua_to_cpointer(L, lua_gettop(L), LVT_U8_P);
|
||||
lua_pop(L, 1);
|
||||
if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 2's 'texture' field"); return 0; }
|
||||
if (!gSmLuaConvertSuccess) { LOG_LUA("texture_override_set: Failed to convert parameter 2's 'texture' field"); return 0; }
|
||||
|
||||
tmpOverrideTexInfo.bitSize = smlua_get_integer_field(top+1, "bitSize");
|
||||
if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 2's 'bitSize' field"); return 0; }
|
||||
if (!gSmLuaConvertSuccess) { LOG_LUA("texture_override_set: Failed to convert parameter 2's 'bitSize' field"); return 0; }
|
||||
|
||||
tmpOverrideTexInfo.width = smlua_get_integer_field(top+1, "width");
|
||||
if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 2's 'width' field"); return 0; }
|
||||
if (!gSmLuaConvertSuccess) { LOG_LUA("texture_override_set: Failed to convert parameter 2's 'width' field"); return 0; }
|
||||
|
||||
tmpOverrideTexInfo.height = smlua_get_integer_field(top+1, "height");
|
||||
if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 2's 'height' field"); return 0; }
|
||||
if (!gSmLuaConvertSuccess) { LOG_LUA("texture_override_set: Failed to convert parameter 2's 'height' field"); return 0; }
|
||||
|
||||
tmpOverrideTexInfo.name = smlua_get_string_field(top+1, "name");
|
||||
if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 2's 'name' field"); return 0; }
|
||||
if (!gSmLuaConvertSuccess) { LOG_LUA("texture_override_set: Failed to convert parameter 2's 'name' field"); return 0; }
|
||||
|
||||
lua_settop(L, top);
|
||||
}
|
||||
|
@ -524,7 +525,7 @@ int smlua_func_texture_override_reset(lua_State* L) {
|
|||
if (!smlua_functions_valid_param_count(L, 1)) { return 0; }
|
||||
|
||||
const char* textureName = smlua_to_string(L, 1);
|
||||
if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1"); return 0; }
|
||||
if (!gSmLuaConvertSuccess) { LOG_LUA("texture_override_reset: Failed to convert parameter 1"); return 0; }
|
||||
|
||||
dynos_texture_override_reset(textureName);
|
||||
|
||||
|
@ -760,30 +761,30 @@ int smlua_func_smlua_anim_util_register_animation(lua_State* L) {
|
|||
if (!smlua_functions_valid_param_count(L, 8)) { return 0; }
|
||||
|
||||
const char *name = smlua_to_string(L, 1);
|
||||
if (!gSmLuaConvertSuccess) { LOG_LUA("%s: Failed to convert parameter '%s'", "smlua_anim_util_register_animation", "name"); return 0; }
|
||||
if (!gSmLuaConvertSuccess) { LOG_LUA("smlua_anim_util_register_animation: Failed to convert parameter 'name'"); return 0; }
|
||||
|
||||
s16 flags = smlua_to_integer(L, 2);
|
||||
if (!gSmLuaConvertSuccess) { LOG_LUA("%s: Failed to convert parameter '%s'", "smlua_anim_util_register_animation", "flags"); return 0; }
|
||||
if (!gSmLuaConvertSuccess) { LOG_LUA("smlua_anim_util_register_animation: Failed to convert parameter 'flags'"); return 0; }
|
||||
|
||||
s16 animYTransDivisor = smlua_to_integer(L, 3);
|
||||
if (!gSmLuaConvertSuccess) { LOG_LUA("%s: Failed to convert parameter '%s'", "smlua_anim_util_register_animation", "animYTransDivisor"); return 0; }
|
||||
if (!gSmLuaConvertSuccess) { LOG_LUA("smlua_anim_util_register_animation: Failed to convert parameter 'animYTransDivisor'"); return 0; }
|
||||
|
||||
s16 startFrame = smlua_to_integer(L, 4);
|
||||
if (!gSmLuaConvertSuccess) { LOG_LUA("%s: Failed to convert parameter '%s'", "smlua_anim_util_register_animation", "startFrame"); return 0; }
|
||||
if (!gSmLuaConvertSuccess) { LOG_LUA("smlua_anim_util_register_animation: Failed to convert parameter 'startFrame'"); return 0; }
|
||||
|
||||
s16 loopStart = smlua_to_integer(L, 5);
|
||||
if (!gSmLuaConvertSuccess) { LOG_LUA("%s: Failed to convert parameter '%s'", "smlua_anim_util_register_animation", "loopStart"); return 0; }
|
||||
if (!gSmLuaConvertSuccess) { LOG_LUA("smlua_anim_util_register_animation: Failed to convert parameter 'loopStart'"); return 0; }
|
||||
|
||||
s16 loopEnd = smlua_to_integer(L, 6);
|
||||
if (!gSmLuaConvertSuccess) { LOG_LUA("%s: Failed to convert parameter '%s'", "smlua_anim_util_register_animation", "loopEnd"); return 0; }
|
||||
if (!gSmLuaConvertSuccess) { LOG_LUA("smlua_anim_util_register_animation: Failed to convert parameter 'loopEnd'"); return 0; }
|
||||
|
||||
u32 valuesLength = 0;
|
||||
u16 *values = (u16 *) smlua_to_u16_list(L, 7, &valuesLength);
|
||||
if (!values) { LOG_LUA("%s: Failed to convert parameter '%s'", "smlua_anim_util_register_animation", "values"); return 0; }
|
||||
if (!values) { LOG_LUA("smlua_anim_util_register_animation: Failed to convert parameter 'values'"); return 0; }
|
||||
|
||||
u32 indexLength = 0;
|
||||
u16 *index = (u16 *) smlua_to_u16_list(L, 8, &indexLength);
|
||||
if (!index) { LOG_LUA("%s: Failed to convert parameter '%s'", "smlua_anim_util_register_animation", "index"); free(values); return 0; }
|
||||
if (!index) { LOG_LUA("smlua_anim_util_register_animation: Failed to convert parameter 'index'"); free(values); return 0; }
|
||||
|
||||
smlua_anim_util_register_animation(name, flags, animYTransDivisor, startFrame, loopStart, loopEnd, values, valuesLength, index, indexLength);
|
||||
|
||||
|
@ -800,12 +801,12 @@ int smlua_func_log_to_console(lua_State* L) {
|
|||
int paramCount = lua_gettop(L);
|
||||
|
||||
const char* message = smlua_to_string(L, 1);
|
||||
if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1"); return 0; }
|
||||
if (!gSmLuaConvertSuccess) { LOG_LUA("log_to_console: Failed to convert parameter 1 for function"); return 0; }
|
||||
|
||||
enum ConsoleMessageLevel level = CONSOLE_MESSAGE_INFO;
|
||||
if (paramCount >= 2) {
|
||||
level = smlua_to_integer(L, 2);
|
||||
if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 2"); return 0; }
|
||||
if (!gSmLuaConvertSuccess) { LOG_LUA("log_to_console: Failed to convert parameter 2 for function"); return 0; }
|
||||
}
|
||||
|
||||
djui_console_message_create(message, level);
|
||||
|
@ -818,15 +819,14 @@ int smlua_func_log_to_console(lua_State* L) {
|
|||
////////////////////
|
||||
|
||||
int smlua_func_add_scroll_target(lua_State* L) {
|
||||
|
||||
// add_scroll_target used to require offset and size of the vertex buffer to be used
|
||||
if (!smlua_functions_valid_param_range(L, 2, 4)) { return 0; }
|
||||
int paramCount = lua_gettop(L);
|
||||
|
||||
u32 index = smlua_to_integer(L, 1);
|
||||
if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "add_scroll_target"); return 0; }
|
||||
if (!gSmLuaConvertSuccess) { LOG_LUA("add_scroll_target: Failed to convert parameter 1 for function"); return 0; }
|
||||
const char* name = smlua_to_string(L, 2);
|
||||
if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 2, "add_scroll_target"); return 0; }
|
||||
if (!gSmLuaConvertSuccess) { LOG_LUA("add_scroll_target: Failed to convert parameter 2 for function"); return 0; }
|
||||
|
||||
// If the offset and size parameters are provided, use them, although they aren't required.
|
||||
u32 offset = 0;
|
||||
|
@ -844,6 +844,34 @@ int smlua_func_add_scroll_target(lua_State* L) {
|
|||
return 1;
|
||||
}
|
||||
|
||||
/////////////
|
||||
// raycast //
|
||||
/////////////
|
||||
|
||||
int smlua_func_collision_find_surface_on_ray(lua_State* L) {
|
||||
if (!smlua_functions_valid_param_range(L, 6, 7)) { return 0; }
|
||||
int paramCount = lua_gettop(L);
|
||||
|
||||
f32 startX = smlua_to_number(L, 1);
|
||||
if (!gSmLuaConvertSuccess) { LOG_LUA("collision_find_surface_on_ray: Failed to convert parameter 1"); return 0; }
|
||||
f32 startY = smlua_to_number(L, 2);
|
||||
if (!gSmLuaConvertSuccess) { LOG_LUA("collision_find_surface_on_ray: Failed to convert parameter 2"); return 0; }
|
||||
f32 startZ = smlua_to_number(L, 3);
|
||||
if (!gSmLuaConvertSuccess) { LOG_LUA("collision_find_surface_on_ray: Failed to convert parameter 3"); return 0; }
|
||||
f32 dirX = smlua_to_number(L, 4);
|
||||
if (!gSmLuaConvertSuccess) { LOG_LUA("collision_find_surface_on_ray: Failed to convert parameter 4"); return 0; }
|
||||
f32 dirY = smlua_to_number(L, 5);
|
||||
if (!gSmLuaConvertSuccess) { LOG_LUA("collision_find_surface_on_ray: Failed to convert parameter 5"); return 0; }
|
||||
f32 dirZ = smlua_to_number(L, 6);
|
||||
if (!gSmLuaConvertSuccess) { LOG_LUA("collision_find_surface_on_ray: Failed to convert parameter 6"); return 0; }
|
||||
f32 precision = paramCount == 7 ? smlua_to_number(L, 7) : 3.0f;
|
||||
if (!gSmLuaConvertSuccess) { LOG_LUA("collision_find_surface_on_ray: Failed to convert parameter 7"); return 0; }
|
||||
|
||||
collision_find_surface_on_ray(startX, startY, startZ, dirX, dirY, dirZ, precision);
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
//////////
|
||||
// bind //
|
||||
//////////
|
||||
|
@ -873,4 +901,5 @@ void smlua_bind_functions(void) {
|
|||
smlua_bind_function(L, "smlua_anim_util_register_animation", smlua_func_smlua_anim_util_register_animation);
|
||||
smlua_bind_function(L, "log_to_console", smlua_func_log_to_console);
|
||||
smlua_bind_function(L, "add_scroll_target", smlua_func_add_scroll_target);
|
||||
smlua_bind_function(L, "collision_find_surface_on_ray", smlua_func_collision_find_surface_on_ray);
|
||||
}
|
||||
|
|
|
@ -28383,62 +28383,6 @@ int smlua_func_collision_find_floor(lua_State* L) {
|
|||
return 1;
|
||||
}
|
||||
|
||||
int smlua_func_collision_find_surface_on_ray(lua_State* L) {
|
||||
if (L == NULL) { return 0; }
|
||||
|
||||
int top = lua_gettop(L);
|
||||
if (top != 6) {
|
||||
LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "collision_find_surface_on_ray", 6, top);
|
||||
return 0;
|
||||
}
|
||||
|
||||
f32 startX = smlua_to_number(L, 1);
|
||||
if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "collision_find_surface_on_ray"); return 0; }
|
||||
f32 startY = smlua_to_number(L, 2);
|
||||
if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 2, "collision_find_surface_on_ray"); return 0; }
|
||||
f32 startZ = smlua_to_number(L, 3);
|
||||
if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 3, "collision_find_surface_on_ray"); return 0; }
|
||||
f32 dirX = smlua_to_number(L, 4);
|
||||
if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 4, "collision_find_surface_on_ray"); return 0; }
|
||||
f32 dirY = smlua_to_number(L, 5);
|
||||
if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 5, "collision_find_surface_on_ray"); return 0; }
|
||||
f32 dirZ = smlua_to_number(L, 6);
|
||||
if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 6, "collision_find_surface_on_ray"); return 0; }
|
||||
|
||||
smlua_push_object(L, LOT_RAYINTERSECTIONINFO, collision_find_surface_on_ray(startX, startY, startZ, dirX, dirY, dirZ));
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
int smlua_func_collision_find_surface_on_ray_precision(lua_State* L) {
|
||||
if (L == NULL) { return 0; }
|
||||
|
||||
int top = lua_gettop(L);
|
||||
if (top != 7) {
|
||||
LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "collision_find_surface_on_ray_precision", 7, top);
|
||||
return 0;
|
||||
}
|
||||
|
||||
f32 startX = smlua_to_number(L, 1);
|
||||
if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "collision_find_surface_on_ray_precision"); return 0; }
|
||||
f32 startY = smlua_to_number(L, 2);
|
||||
if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 2, "collision_find_surface_on_ray_precision"); return 0; }
|
||||
f32 startZ = smlua_to_number(L, 3);
|
||||
if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 3, "collision_find_surface_on_ray_precision"); return 0; }
|
||||
f32 dirX = smlua_to_number(L, 4);
|
||||
if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 4, "collision_find_surface_on_ray_precision"); return 0; }
|
||||
f32 dirY = smlua_to_number(L, 5);
|
||||
if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 5, "collision_find_surface_on_ray_precision"); return 0; }
|
||||
f32 dirZ = smlua_to_number(L, 6);
|
||||
if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 6, "collision_find_surface_on_ray_precision"); return 0; }
|
||||
f32 precision = smlua_to_number(L, 7);
|
||||
if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 7, "collision_find_surface_on_ray_precision"); return 0; }
|
||||
|
||||
smlua_push_object(L, LOT_RAYINTERSECTIONINFO, collision_find_surface_on_ray_precision(startX, startY, startZ, dirX, dirY, dirZ, precision));
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
int smlua_func_collision_get_temp_wall_collision_data(UNUSED lua_State* L) {
|
||||
if (L == NULL) { return 0; }
|
||||
|
||||
|
@ -34190,8 +34134,6 @@ void smlua_bind_functions_autogen(void) {
|
|||
// smlua_collision_utils.h
|
||||
smlua_bind_function(L, "collision_find_ceil", smlua_func_collision_find_ceil);
|
||||
smlua_bind_function(L, "collision_find_floor", smlua_func_collision_find_floor);
|
||||
smlua_bind_function(L, "collision_find_surface_on_ray", smlua_func_collision_find_surface_on_ray);
|
||||
smlua_bind_function(L, "collision_find_surface_on_ray_precision", smlua_func_collision_find_surface_on_ray_precision);
|
||||
smlua_bind_function(L, "collision_get_temp_wall_collision_data", smlua_func_collision_get_temp_wall_collision_data);
|
||||
smlua_bind_function(L, "get_water_surface_pseudo_floor", smlua_func_get_water_surface_pseudo_floor);
|
||||
smlua_bind_function(L, "smlua_collision_util_get", smlua_func_smlua_collision_util_get);
|
||||
|
|
|
@ -157,15 +157,7 @@ struct GlobalObjectCollisionData gGlobalObjectCollisionData = {
|
|||
.wooden_signpost_seg3_collision_0302DD80 = (Collision*) wooden_signpost_seg3_collision_0302DD80,
|
||||
};
|
||||
|
||||
struct RayIntersectionInfo* collision_find_surface_on_ray(f32 startX, f32 startY, f32 startZ, f32 dirX, f32 dirY, f32 dirZ) {
|
||||
static struct RayIntersectionInfo info = { 0 };
|
||||
Vec3f orig = { startX, startY, startZ };
|
||||
Vec3f dir = { dirX, dirY, dirZ };
|
||||
find_surface_on_ray(orig, dir, &info.surface, info.hitPos, 3.0f);
|
||||
return &info;
|
||||
}
|
||||
|
||||
struct RayIntersectionInfo* collision_find_surface_on_ray_precision(f32 startX, f32 startY, f32 startZ, f32 dirX, f32 dirY, f32 dirZ, f32 precision) {
|
||||
struct RayIntersectionInfo* collision_find_surface_on_ray(f32 startX, f32 startY, f32 startZ, f32 dirX, f32 dirY, f32 dirZ, f32 precision) {
|
||||
static struct RayIntersectionInfo info = { 0 };
|
||||
Vec3f orig = { startX, startY, startZ };
|
||||
Vec3f dir = { dirX, dirY, dirZ };
|
||||
|
|
|
@ -114,8 +114,7 @@ struct GlobalObjectCollisionData {
|
|||
|
||||
extern struct GlobalObjectCollisionData gGlobalObjectCollisionData;
|
||||
|
||||
struct RayIntersectionInfo* collision_find_surface_on_ray(f32 startX, f32 startY, f32 startZ, f32 dirX, f32 dirY, f32 dirZ);
|
||||
struct RayIntersectionInfo* collision_find_surface_on_ray_precision(f32 startX, f32 startY, f32 startZ, f32 dirX, f32 dirY, f32 dirZ, f32 precision);
|
||||
struct RayIntersectionInfo* collision_find_surface_on_ray(f32 startX, f32 startY, f32 startZ, f32 dirX, f32 dirY, f32 dirZ, f32 precision);
|
||||
struct Surface* collision_find_floor(f32 x, f32 y, f32 z);
|
||||
struct Surface* collision_find_ceil(f32 x, f32 y, f32 z);
|
||||
|
||||
|
|
Loading…
Reference in New Issue