Add gLakituState to Lua

This commit is contained in:
MysterD 2022-03-25 23:58:10 -07:00
parent b38af4b798
commit 2dfb28ddc7
6 changed files with 13 additions and 62 deletions

View File

@ -77,7 +77,7 @@ override_disallowed_functions = {
"src/game/obj_behaviors_2.c": [ "wiggler_jumped_on_attack_handler", "huge_goomba_weakly_attacked" ],
"src/game/spawn_sound.c": [ "spawner" ],
"src/pc/lua/utils/smlua_obj_utils.h": [ "spawn_object_remember_field" ],
"src/game/camera.h": [ "update_camera", "init_camera", "stub_camera", "^reset_camera" ],
"src/game/camera.h": [ "update_camera", "init_camera", "stub_camera", "^reset_camera", "move_point_along_spline" ],
}
lua_function_params = {

View File

@ -248,15 +248,6 @@ function move_mario_head_c_up(c)
-- ...
end
--- @param p Vec3f
--- @param spline[] CutsceneSplinePoint
--- @param splineSegment Pointer_integer
--- @param progress Pointer_number
--- @return integer
function move_point_along_spline(p, spline[], splineSegment, progress)
-- ...
end
--- @param newPos Vec3f
--- @param newFoc Vec3f
--- @param curPos Vec3f

View File

@ -47,7 +47,6 @@
- [is_range_behind_surface](#is_range_behind_surface)
- [is_within_100_units_of_mario](#is_within_100_units_of_mario)
- [move_mario_head_c_up](#move_mario_head_c_up)
- [move_point_along_spline](#move_point_along_spline)
- [next_lakitu_state](#next_lakitu_state)
- [obj_rotate_towards_point](#obj_rotate_towards_point)
- [object_pos_to_vec3f](#object_pos_to_vec3f)
@ -1599,29 +1598,6 @@ The `reliable` field will ensure that the packet arrives, but should be used spa
<br />
## [move_point_along_spline](#move_point_along_spline)
### Lua Example
`local integerValue = move_point_along_spline(p, spline[], splineSegment, progress)`
### Parameters
| Field | Type |
| ----- | ---- |
| p | [Vec3f](structs.md#Vec3f) |
| spline[] | [CutsceneSplinePoint](structs.md#CutsceneSplinePoint) |
| splineSegment | `Pointer` <`integer`> |
| progress | `Pointer` <`number`> |
### Returns
- `integer`
### C Prototype
`s32 move_point_along_spline(Vec3f p, struct CutsceneSplinePoint spline[], s16 *splineSegment, f32 *progress);`
[:arrow_up_small:](#)
<br />
## [next_lakitu_state](#next_lakitu_state)
### Lua Example

View File

@ -51,6 +51,13 @@ The `gGlobalObjectCollisionData` table contains references to object collision d
<br />
## [gLakituState](#gLakituState)
`gLakituState`'s fields are listed in [LakituState](structs.md#LakituState).
[:arrow_up_small:](#)
<br />
## [gGlobalSyncTable](#gGlobalSyncTable)
The `gGlobalSyncTable` is a table used for networking. Any field set inside of this table is automatically synchronized with all other clients. Do not use this table for player-specific variables, keep those in [gPlayerSyncTable](#gPlayerSyncTable). Player-specific variable will desynchronize within this table since it doesn't automatically translate `playerIndex`.

View File

@ -485,6 +485,11 @@ void smlua_cobject_init_globals(void) {
lua_setglobal(L, "gGlobalObjectCollisionData");
}
{
smlua_push_object(L, LOT_LAKITUSTATE, &gLakituState);
lua_setglobal(L, "gLakituState");
}
}
void smlua_cobject_init_per_file_globals(char* path) {

View File

@ -740,33 +740,6 @@ int smlua_func_move_mario_head_c_up(lua_State* L) {
return 1;
}
int smlua_func_move_point_along_spline(lua_State* L) {
if(!smlua_functions_valid_param_count(L, 4)) { return 0; }
f32* p = smlua_get_vec3f_from_buffer();
p[0] = smlua_get_number_field(1, "x");
if (!gSmLuaConvertSuccess) { return 0; }
p[1] = smlua_get_number_field(1, "y");
if (!gSmLuaConvertSuccess) { return 0; }
p[2] = smlua_get_number_field(1, "z");
if (!gSmLuaConvertSuccess) { return 0; }
struct CutsceneSplinePoint spline[] = (struct CutsceneSplinePoint)smlua_to_cobject(L, 2, LOT_CUTSCENESPLINEPOINT);
if (!gSmLuaConvertSuccess) { return 0; }
s16 * splineSegment = (s16 *)smlua_to_cpointer(L, 3, LVT_S16_P);
if (!gSmLuaConvertSuccess) { return 0; }
f32 * progress = (f32 *)smlua_to_cpointer(L, 4, LVT_F32_P);
if (!gSmLuaConvertSuccess) { return 0; }
lua_pushinteger(L, move_point_along_spline(p, spline[], splineSegment, progress));
smlua_push_number_field(1, "x", p[0]);
smlua_push_number_field(1, "y", p[1]);
smlua_push_number_field(1, "z", p[2]);
return 1;
}
int smlua_func_next_lakitu_state(lua_State* L) {
if(!smlua_functions_valid_param_count(L, 7)) { return 0; }
@ -9980,7 +9953,6 @@ void smlua_bind_functions_autogen(void) {
smlua_bind_function(L, "is_range_behind_surface", smlua_func_is_range_behind_surface);
smlua_bind_function(L, "is_within_100_units_of_mario", smlua_func_is_within_100_units_of_mario);
smlua_bind_function(L, "move_mario_head_c_up", smlua_func_move_mario_head_c_up);
smlua_bind_function(L, "move_point_along_spline", smlua_func_move_point_along_spline);
smlua_bind_function(L, "next_lakitu_state", smlua_func_next_lakitu_state);
smlua_bind_function(L, "obj_rotate_towards_point", smlua_func_obj_rotate_towards_point);
smlua_bind_function(L, "object_pos_to_vec3f", smlua_func_object_pos_to_vec3f);