mirror of
https://github.com/coop-deluxe/sm64coopdx.git
synced 2026-01-06 15:02:35 +00:00
fix cobject arrays: implement setting fields
This commit is contained in:
parent
d121050be9
commit
22f63c9e05
15 changed files with 229 additions and 183 deletions
|
|
@ -853,9 +853,9 @@ def build_call(function):
|
|||
lfunc = 'lua_pushstring'
|
||||
elif translate_type_to_lot(ftype) == 'LOT_POINTER':
|
||||
lvt = translate_type_to_lvt(ftype)
|
||||
return ' smlua_push_pointer(L, %s, (void*)%s);\n' % (lvt, ccall)
|
||||
return ' smlua_push_pointer(L, %s, (void*)%s, NULL);\n' % (lvt, ccall)
|
||||
elif '???' not in flot and flot != 'LOT_NONE':
|
||||
return ' smlua_push_object(L, %s, %s);\n' % (flot, ccall)
|
||||
return ' smlua_push_object(L, %s, %s, NULL);\n' % (flot, ccall)
|
||||
|
||||
return ' %s(L, %s);\n' % (lfunc, ccall)
|
||||
|
||||
|
|
|
|||
|
|
@ -424,6 +424,7 @@ def build_vec_types():
|
|||
for type_name in VEC_TYPES.keys():
|
||||
s += ' [LOT_%s] = { LOT_%s, s%sFields, LUA_%s_FIELD_COUNT },\n' % (type_name.upper(), type_name.upper(), type_name, type_name.upper())
|
||||
|
||||
s += ' [LOT_ARRAY] = { LOT_ARRAY, NULL, 0 },\n'
|
||||
s += ' [LOT_POINTER] = { LOT_POINTER, NULL, 0 },\n'
|
||||
s += '};\n\n'
|
||||
|
||||
|
|
@ -574,6 +575,7 @@ def build_lot_enum():
|
|||
for type_name in VEC_TYPES.keys():
|
||||
s += ' LOT_%s,\n' % (type_name.upper())
|
||||
|
||||
s += ' LOT_ARRAY,\n'
|
||||
s += ' LOT_POINTER,\n'
|
||||
s += ' LOT_MAX,\n'
|
||||
s += '};\n\n'
|
||||
|
|
|
|||
|
|
@ -998,7 +998,7 @@ static s32 bhv_cmd_call_native_ext(void) {
|
|||
gCurBhvCommand += 2;
|
||||
return BHV_PROC_CONTINUE;
|
||||
}
|
||||
|
||||
|
||||
// Get our mod.
|
||||
if (modIndex >= gActiveMods.entryCount) {
|
||||
LOG_LUA("Failed to call lua function, could not find mod");
|
||||
|
|
@ -1011,7 +1011,7 @@ static s32 bhv_cmd_call_native_ext(void) {
|
|||
lua_rawgeti(gLuaState, LUA_REGISTRYINDEX, funcRef);
|
||||
|
||||
// Push object
|
||||
smlua_push_object(gLuaState, LOT_OBJECT, gCurrentObject);
|
||||
smlua_push_object(gLuaState, LOT_OBJECT, gCurrentObject, NULL);
|
||||
|
||||
// Call the callback
|
||||
if (0 != smlua_call_hook(gLuaState, 1, 0, 0, mod)) {
|
||||
|
|
@ -1051,7 +1051,7 @@ static s32 bhv_cmd_spawn_child_ext(void) {
|
|||
gCurBhvCommand += 3;
|
||||
return BHV_PROC_CONTINUE;
|
||||
}
|
||||
|
||||
|
||||
BehaviorScript *childBhvScript = (BehaviorScript *)get_behavior_from_id(behId);
|
||||
if (childBhvScript == NULL) {
|
||||
LOG_LUA("Failed to spawn custom child, could not get behavior '%s' from the id %u.", behStr, behId);
|
||||
|
|
@ -1098,7 +1098,7 @@ static s32 bhv_cmd_spawn_child_with_param_ext(void) {
|
|||
gCurBhvCommand += 3;
|
||||
return BHV_PROC_CONTINUE;
|
||||
}
|
||||
|
||||
|
||||
BehaviorScript *childBhvScript = (BehaviorScript *)get_behavior_from_id(behId);
|
||||
if (childBhvScript == NULL) {
|
||||
LOG_LUA("Failed to spawn custom child with params, could not get behavior '%s' from the id %u.", behStr, behId);
|
||||
|
|
@ -1145,7 +1145,7 @@ static s32 bhv_cmd_spawn_obj_ext(void) {
|
|||
gCurBhvCommand += 3;
|
||||
return BHV_PROC_CONTINUE;
|
||||
}
|
||||
|
||||
|
||||
BehaviorScript *objBhvScript = (BehaviorScript *)get_behavior_from_id(behId);
|
||||
if (objBhvScript == NULL) {
|
||||
LOG_LUA("Failed to spawn custom object, could not get behavior '%s' from the id %u.", behStr, behId);
|
||||
|
|
@ -1167,9 +1167,9 @@ static s32 bhv_cmd_spawn_obj_ext(void) {
|
|||
// Usage: LOAD_ANIMATIONS_EXT(field, anims)
|
||||
static s32 bhv_cmd_load_animations_ext(void) {
|
||||
//u8 field = BHV_CMD_GET_2ND_U8(0);
|
||||
|
||||
|
||||
LOG_ERROR("LOAD_ANIMATIONS_EXT is not yet supported! Skipping behavior command.\n");
|
||||
|
||||
|
||||
//BehaviorScript *behavior = (BehaviorScript *)gCurrentObject->behavior;
|
||||
|
||||
//const char *animStr = dynos_behavior_get_token(behavior, BHV_CMD_GET_U32(1));
|
||||
|
|
@ -1186,7 +1186,7 @@ static s32 bhv_cmd_load_collision_data_ext(void) {
|
|||
BehaviorScript *behavior = (BehaviorScript *)gCurrentObject->behavior;
|
||||
|
||||
const char *collisionDataStr = dynos_behavior_get_token(behavior, BHV_CMD_GET_U32(1));
|
||||
|
||||
|
||||
Collision *collisionData = dynos_collision_get(collisionDataStr);
|
||||
if (collisionData == NULL) {
|
||||
LOG_ERROR("Failed to load custom collision, could not get collision from name '%s'", collisionDataStr);
|
||||
|
|
@ -1466,7 +1466,7 @@ f32 position_based_random_float_position(void) {
|
|||
|
||||
f32 draw_distance_scalar(void) {
|
||||
if (!gBehaviorValues.InfiniteRenderDistance) { return 1.0f; }
|
||||
|
||||
|
||||
switch (configDrawDistance) {
|
||||
case 0: return 0.5f;
|
||||
case 1: return 1.0f;
|
||||
|
|
|
|||
|
|
@ -893,7 +893,7 @@ Gfx *geo_process_lua_function(s32 callContext, struct GraphNode *node, UNUSED Ma
|
|||
|
||||
// Push the callback, the graph node and the current matrix stack index
|
||||
lua_rawgeti(L, LUA_REGISTRYINDEX, funcRef);
|
||||
smlua_push_object(L, LOT_GRAPHNODE, node);
|
||||
smlua_push_object(L, LOT_GRAPHNODE, node, NULL);
|
||||
lua_pushinteger(L, gMatStackIndex);
|
||||
|
||||
// Call the callback
|
||||
|
|
|
|||
|
|
@ -330,24 +330,24 @@ struct LuaObjectField* smlua_get_custom_field(lua_State* L, u32 lot, int keyInde
|
|||
|
||||
static bool smlua_push_field(lua_State* L, u8* p, struct LuaObjectField *data) {
|
||||
switch (data->valueType) {
|
||||
case LVT_BOOL: lua_pushboolean(L, *(u8* )p); break;
|
||||
case LVT_U8: lua_pushinteger(L, *(u8* )p); break;
|
||||
case LVT_U16: lua_pushinteger(L, *(u16*)p); break;
|
||||
case LVT_U32: lua_pushinteger(L, *(u32*)p); break;
|
||||
case LVT_S8: lua_pushinteger(L, *(s8* )p); break;
|
||||
case LVT_S16: lua_pushinteger(L, *(s16*)p); break;
|
||||
case LVT_S32: lua_pushinteger(L, *(s32*)p); break;
|
||||
case LVT_F32: lua_pushnumber( L, *(f32*)p); break;
|
||||
case LVT_U64: lua_pushinteger(L, *(u64*)p); break;
|
||||
case LVT_COBJECT: smlua_push_object(L, data->lot, p); break;
|
||||
case LVT_COBJECT_P: smlua_push_object(L, data->lot, *(u8**)p); break;
|
||||
case LVT_STRING: lua_pushstring(L, (char*)p); break;
|
||||
case LVT_STRING_P: lua_pushstring(L, *(char**)p); break;
|
||||
case LVT_BEHAVIORSCRIPT: lua_pushinteger(L, *(s32*)p); break;
|
||||
case LVT_OBJECTANIMPOINTER: lua_pushinteger(L, *(s32*)p); break;
|
||||
case LVT_COLLISION: lua_pushinteger(L, *(s32*)p); break;
|
||||
case LVT_LEVELSCRIPT: lua_pushinteger(L, *(s32*)p); break;
|
||||
case LVT_TRAJECTORY: lua_pushinteger(L, *(s16*)p); break;
|
||||
case LVT_BOOL: lua_pushboolean(L, *(u8* )p); break;
|
||||
case LVT_U8: lua_pushinteger(L, *(u8* )p); break;
|
||||
case LVT_U16: lua_pushinteger(L, *(u16*)p); break;
|
||||
case LVT_U32: lua_pushinteger(L, *(u32*)p); break;
|
||||
case LVT_S8: lua_pushinteger(L, *(s8* )p); break;
|
||||
case LVT_S16: lua_pushinteger(L, *(s16*)p); break;
|
||||
case LVT_S32: lua_pushinteger(L, *(s32*)p); break;
|
||||
case LVT_F32: lua_pushnumber( L, *(f32*)p); break;
|
||||
case LVT_U64: lua_pushinteger(L, *(u64*)p); break;
|
||||
case LVT_COBJECT: smlua_push_object(L, data->lot, p, NULL); break;
|
||||
case LVT_COBJECT_P: smlua_push_object(L, data->lot, *(u8**)p, NULL); break;
|
||||
case LVT_STRING: lua_pushstring(L, (char*)p); break;
|
||||
case LVT_STRING_P: lua_pushstring(L, *(char**)p); break;
|
||||
case LVT_BEHAVIORSCRIPT: lua_pushinteger(L, *(s32*)p); break;
|
||||
case LVT_OBJECTANIMPOINTER: lua_pushinteger(L, *(s32*)p); break;
|
||||
case LVT_COLLISION: lua_pushinteger(L, *(s32*)p); break;
|
||||
case LVT_LEVELSCRIPT: lua_pushinteger(L, *(s32*)p); break;
|
||||
case LVT_TRAJECTORY: lua_pushinteger(L, *(s16*)p); break;
|
||||
|
||||
// pointers
|
||||
case LVT_BOOL_P:
|
||||
|
|
@ -364,7 +364,7 @@ static bool smlua_push_field(lua_State* L, u8* p, struct LuaObjectField *data) {
|
|||
case LVT_COLLISION_P:
|
||||
case LVT_LEVELSCRIPT_P:
|
||||
case LVT_TRAJECTORY_P:
|
||||
smlua_push_pointer(L, data->valueType, *(u8**)p);
|
||||
smlua_push_pointer(L, data->valueType, *(u8**)p, NULL);
|
||||
break;
|
||||
|
||||
default:
|
||||
|
|
@ -426,6 +426,40 @@ static int smlua__get_field(lua_State* L) {
|
|||
enum LuaObjectType lot = cobj->lot;
|
||||
u64 pointer = (u64)(intptr_t) cobj->pointer;
|
||||
|
||||
if (cobj->freed) {
|
||||
LOG_LUA_LINE("_get_field on freed object");
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (lot == LOT_ARRAY) {
|
||||
u32 key = lua_tointeger(L, 2);
|
||||
if (!key) {
|
||||
LOG_LUA_LINE("Tried to get a non-integer field of cobject array");
|
||||
return 0;
|
||||
}
|
||||
|
||||
struct LuaObjectField* data = cobj->info;
|
||||
if (!data) {
|
||||
LOG_LUA_LINE("Tried to get a non-integer field of cobject array");
|
||||
return 0;
|
||||
}
|
||||
|
||||
key--; // Lua is +1 indexed
|
||||
if (key >= data->count) {
|
||||
LOG_LUA_LINE("Key is out of bounds for array: key '%u'", key);
|
||||
return 0;
|
||||
}
|
||||
|
||||
u8* p = ((u8*)(intptr_t)pointer) + (key * data->size);
|
||||
if (smlua_push_field(L, p, data)) {
|
||||
LOG_LUA_LINE("_get_field on unimplemented type '%d', key '%u'", data->valueType, key);
|
||||
return 0;
|
||||
}
|
||||
|
||||
LUA_STACK_CHECK_END();
|
||||
return 1;
|
||||
}
|
||||
|
||||
const char *key = lua_tostring(L, 2);
|
||||
if (!key) {
|
||||
LOG_LUA_LINE("Tried to get a non-string field of cobject");
|
||||
|
|
@ -444,11 +478,6 @@ static int smlua__get_field(lua_State* L) {
|
|||
}
|
||||
}
|
||||
|
||||
if (cobj->freed) {
|
||||
LOG_LUA_LINE("_get_field on freed object");
|
||||
return 0;
|
||||
}
|
||||
|
||||
struct LuaObjectField* data = smlua_get_object_field(lot, key);
|
||||
if (data == NULL) {
|
||||
data = smlua_get_custom_field(L, lot, 2);
|
||||
|
|
@ -465,14 +494,10 @@ static int smlua__get_field(lua_State* L) {
|
|||
return 0;
|
||||
}
|
||||
} else {
|
||||
lua_newtable(L);
|
||||
for (u16 i = 0; i < data->count; i++) {
|
||||
lua_pushinteger(L, i + 1);
|
||||
if (smlua_push_field(L, p + (i * data->size), data)) {
|
||||
LOG_LUA_LINE("_get_field on unimplemented type '%d', key '%s'", data->valueType, key);
|
||||
return 0;
|
||||
}
|
||||
lua_settable(L, -3);
|
||||
smlua_push_object(L, LOT_ARRAY, p, data);
|
||||
if (!gSmLuaConvertSuccess) {
|
||||
LOG_LUA_LINE("_set_field failed to retrieve value type '%d', key '%s'", data->valueType, key);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -487,14 +512,43 @@ static int smlua__set_field(lua_State* L) {
|
|||
enum LuaObjectType lot = cobj->lot;
|
||||
u64 pointer = (u64)(intptr_t) cobj->pointer;
|
||||
|
||||
const char *key = lua_tostring(L, 2);
|
||||
if (!key) {
|
||||
LOG_LUA_LINE("Tried to set a non-string field of cobject");
|
||||
if (cobj->freed) {
|
||||
LOG_LUA_LINE("_set_field on freed object");
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (cobj->freed) {
|
||||
LOG_LUA_LINE("_set_field on freed object");
|
||||
if (lot == LOT_ARRAY) {
|
||||
u32 key = lua_tointeger(L, 2);
|
||||
if (!key) {
|
||||
LOG_LUA_LINE("Tried to get a non-integer field of cobject array");
|
||||
return 0;
|
||||
}
|
||||
|
||||
struct LuaObjectField* data = cobj->info;
|
||||
if (!data) {
|
||||
LOG_LUA_LINE("Tried to get a non-integer field of cobject array");
|
||||
return 0;
|
||||
}
|
||||
|
||||
key--; // Lua is +1 indexed
|
||||
if (key >= data->count) {
|
||||
LOG_LUA_LINE("Key is out of bounds for array: key '%u'", key);
|
||||
return 0;
|
||||
}
|
||||
|
||||
u8* p = ((u8*)(intptr_t)pointer) + (key * data->size);
|
||||
if (smlua_set_field(L, p, data)) {
|
||||
LOG_LUA_LINE("_set_field on unimplemented type '%d', key '%u'", data->valueType, key);
|
||||
return 0;
|
||||
}
|
||||
|
||||
LUA_STACK_CHECK_END();
|
||||
return 1;
|
||||
}
|
||||
|
||||
const char *key = lua_tostring(L, 2);
|
||||
if (!key) {
|
||||
LOG_LUA_LINE("Tried to set a non-string field of cobject");
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
@ -514,29 +568,13 @@ static int smlua__set_field(lua_State* L) {
|
|||
}
|
||||
|
||||
u8* p = ((u8*)(intptr_t)pointer) + data->valueOffset;
|
||||
if (data->count == 1) {
|
||||
if (smlua_set_field(L, p, data)) {
|
||||
LOG_LUA_LINE("_set_field on unimplemented type '%d', key '%s'", data->valueType, key);
|
||||
return 0;
|
||||
}
|
||||
if (!gSmLuaConvertSuccess) {
|
||||
LOG_LUA_LINE("_set_field failed to retrieve value type '%d', key '%s'", data->valueType, key);
|
||||
return 0;
|
||||
}
|
||||
} else {
|
||||
lua_newtable(L);
|
||||
for (u16 i = 0; i < data->count; i++) {
|
||||
lua_pushinteger(L, i + 1);
|
||||
if (smlua_set_field(L, p + (i * data->size), data)) {
|
||||
LOG_LUA_LINE("_set_field on unimplemented type '%d', key '%s'", data->valueType, key);
|
||||
return 0;
|
||||
}
|
||||
if (!gSmLuaConvertSuccess) {
|
||||
LOG_LUA_LINE("_set_field failed to retrieve value type '%d', key '%s'", data->valueType, key);
|
||||
return 0;
|
||||
}
|
||||
lua_settable(L, -3);
|
||||
}
|
||||
if (smlua_set_field(L, p, data)) {
|
||||
LOG_LUA_LINE("_set_field on unimplemented type '%d', key '%s'", data->valueType, key);
|
||||
return 0;
|
||||
}
|
||||
if (!gSmLuaConvertSuccess) {
|
||||
LOG_LUA_LINE("_set_field failed to retrieve value type '%d', key '%s'", data->valueType, key);
|
||||
return 0;
|
||||
}
|
||||
|
||||
LUA_STACK_CHECK_END();
|
||||
|
|
@ -612,7 +650,7 @@ void smlua_cobject_init_globals(void) {
|
|||
int t = lua_gettop(gLuaState); \
|
||||
for (s32 i = 0; i < iterator; i++) { \
|
||||
lua_pushinteger(L, i); \
|
||||
smlua_push_object(L, lot, &ptr[i]); \
|
||||
smlua_push_object(L, lot, &ptr[i], NULL); \
|
||||
lua_settable(L, t); \
|
||||
} \
|
||||
lua_setglobal(L, #ptr); \
|
||||
|
|
@ -620,13 +658,13 @@ void smlua_cobject_init_globals(void) {
|
|||
|
||||
#define EXPOSE_GLOBAL(lot, ptr) \
|
||||
{ \
|
||||
smlua_push_object(L, lot, &ptr); \
|
||||
smlua_push_object(L, lot, &ptr, NULL); \
|
||||
lua_setglobal(L, #ptr); \
|
||||
} \
|
||||
|
||||
#define EXPOSE_GLOBAL_WITH_NAME(lot, ptr, name) \
|
||||
{ \
|
||||
smlua_push_object(L, lot, &ptr); \
|
||||
smlua_push_object(L, lot, &ptr, NULL); \
|
||||
lua_setglobal(L, name); \
|
||||
} \
|
||||
|
||||
|
|
@ -641,7 +679,7 @@ void smlua_cobject_init_globals(void) {
|
|||
int t = lua_gettop(gLuaState);
|
||||
for (s32 i = 0; i < gActiveMods.entryCount; i++) {
|
||||
lua_pushinteger(L, i);
|
||||
smlua_push_object(L, LOT_MOD, gActiveMods.entries[i]);
|
||||
smlua_push_object(L, LOT_MOD, gActiveMods.entries[i], NULL);
|
||||
lua_settable(L, t);
|
||||
}
|
||||
lua_setglobal(L, "gActiveMods");
|
||||
|
|
|
|||
|
|
@ -59,12 +59,14 @@ typedef struct {
|
|||
void *pointer;
|
||||
u16 lot;
|
||||
bool freed;
|
||||
void *info;
|
||||
} CObject;
|
||||
|
||||
typedef struct {
|
||||
void *pointer;
|
||||
u16 lvt;
|
||||
bool freed;
|
||||
void *info;
|
||||
} CPointer;
|
||||
|
||||
extern int gSmLuaCObjects;
|
||||
|
|
|
|||
|
|
@ -121,6 +121,7 @@ struct LuaObjectTable sLuaObjectTable[LOT_MAX] = {
|
|||
[LOT_VEC4S] = { LOT_VEC4S, sVec4sFields, LUA_VEC4S_FIELD_COUNT },
|
||||
[LOT_MAT4] = { LOT_MAT4, sMat4Fields, LUA_MAT4_FIELD_COUNT },
|
||||
[LOT_COLOR] = { LOT_COLOR, sColorFields, LUA_COLOR_FIELD_COUNT },
|
||||
[LOT_ARRAY] = { LOT_ARRAY, NULL, 0 },
|
||||
[LOT_POINTER] = { LOT_POINTER, NULL, 0 },
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -12,6 +12,7 @@ enum LuaObjectType {
|
|||
LOT_VEC4S,
|
||||
LOT_MAT4,
|
||||
LOT_COLOR,
|
||||
LOT_ARRAY,
|
||||
LOT_POINTER,
|
||||
LOT_MAX,
|
||||
};
|
||||
|
|
|
|||
|
|
@ -4322,7 +4322,7 @@ char gSmluaConstants[] = ""
|
|||
"COOP_OBJ_FLAG_INITIALIZED = (1 << 3)\n"
|
||||
"SM64COOPDX_VERSION = 'v1.2.1'\n"
|
||||
"VERSION_TEXT = 'v'\n"
|
||||
"VERSION_NUMBER = 38\n"
|
||||
"VERSION_NUMBER = 39\n"
|
||||
"MINOR_VERSION_NUMBER = 1\n"
|
||||
"MAX_VERSION_LENGTH = 32\n"
|
||||
;
|
||||
|
|
@ -308,7 +308,7 @@ int smlua_func_get_texture_info(lua_State* L) {
|
|||
lua_newtable(L);
|
||||
|
||||
lua_pushstring(L, "texture");
|
||||
smlua_push_pointer(L, LVT_U8_P, texInfo.texture);
|
||||
smlua_push_pointer(L, LVT_U8_P, texInfo.texture, NULL);
|
||||
lua_settable(L, -3);
|
||||
|
||||
lua_pushstring(L, "bitSize");
|
||||
|
|
@ -942,7 +942,7 @@ int smlua_func_collision_find_surface_on_ray(lua_State* L) {
|
|||
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; }
|
||||
|
||||
smlua_push_object(L, LOT_RAYINTERSECTIONINFO, collision_find_surface_on_ray(startX, startY, startZ, dirX, dirY, dirZ, precision));
|
||||
smlua_push_object(L, LOT_RAYINTERSECTIONINFO, collision_find_surface_on_ray(startX, startY, startZ, dirX, dirY, dirZ, precision), NULL);
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
|
@ -1005,7 +1005,7 @@ int smlua_func_cast_graph_node(lua_State* L) {
|
|||
return 0;
|
||||
}
|
||||
|
||||
smlua_push_object(L, lot, graphNode);
|
||||
smlua_push_object(L, lot, graphNode, NULL);
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -203,7 +203,7 @@ int smlua_func_area_get_warp_node(lua_State* L) {
|
|||
u8 id = smlua_to_integer(L, 1);
|
||||
if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "area_get_warp_node"); return 0; }
|
||||
|
||||
smlua_push_object(L, LOT_OBJECTWARPNODE, area_get_warp_node(id));
|
||||
smlua_push_object(L, LOT_OBJECTWARPNODE, area_get_warp_node(id), NULL);
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
|
@ -220,7 +220,7 @@ int smlua_func_area_get_warp_node_from_params(lua_State* L) {
|
|||
struct Object* o = (struct Object*)smlua_to_cobject(L, 1, LOT_OBJECT);
|
||||
if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "area_get_warp_node_from_params"); return 0; }
|
||||
|
||||
smlua_push_object(L, LOT_OBJECTWARPNODE, area_get_warp_node_from_params(o));
|
||||
smlua_push_object(L, LOT_OBJECTWARPNODE, area_get_warp_node_from_params(o), NULL);
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
|
@ -9432,7 +9432,7 @@ int smlua_func_spawn_default_star(lua_State* L) {
|
|||
f32 z = smlua_to_number(L, 3);
|
||||
if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 3, "spawn_default_star"); return 0; }
|
||||
|
||||
smlua_push_object(L, LOT_OBJECT, spawn_default_star(x, y, z));
|
||||
smlua_push_object(L, LOT_OBJECT, spawn_default_star(x, y, z), NULL);
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
|
@ -9489,7 +9489,7 @@ int smlua_func_spawn_no_exit_star(lua_State* L) {
|
|||
f32 z = smlua_to_number(L, 3);
|
||||
if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 3, "spawn_no_exit_star"); return 0; }
|
||||
|
||||
smlua_push_object(L, LOT_OBJECT, spawn_no_exit_star(x, y, z));
|
||||
smlua_push_object(L, LOT_OBJECT, spawn_no_exit_star(x, y, z), NULL);
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
|
@ -9510,7 +9510,7 @@ int smlua_func_spawn_red_coin_cutscene_star(lua_State* L) {
|
|||
f32 z = smlua_to_number(L, 3);
|
||||
if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 3, "spawn_red_coin_cutscene_star"); return 0; }
|
||||
|
||||
smlua_push_object(L, LOT_OBJECT, spawn_red_coin_cutscene_star(x, y, z));
|
||||
smlua_push_object(L, LOT_OBJECT, spawn_red_coin_cutscene_star(x, y, z), NULL);
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
|
@ -9781,7 +9781,7 @@ int smlua_func_get_behavior_from_id(lua_State* L) {
|
|||
int id = smlua_to_integer(L, 1);
|
||||
if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "get_behavior_from_id"); return 0; }
|
||||
|
||||
smlua_push_pointer(L, LVT_BEHAVIORSCRIPT_P, (void*)get_behavior_from_id(id));
|
||||
smlua_push_pointer(L, LVT_BEHAVIORSCRIPT_P, (void*)get_behavior_from_id(id), NULL);
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
|
@ -11892,7 +11892,7 @@ int smlua_func_get_character(lua_State* L) {
|
|||
struct MarioState* m = (struct MarioState*)smlua_to_cobject(L, 1, LOT_MARIOSTATE);
|
||||
if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "get_character"); return 0; }
|
||||
|
||||
smlua_push_object(L, LOT_CHARACTER, get_character(m));
|
||||
smlua_push_object(L, LOT_CHARACTER, get_character(m), NULL);
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
|
@ -12065,7 +12065,7 @@ int smlua_func_djui_hud_get_color(UNUSED lua_State* L) {
|
|||
}
|
||||
|
||||
|
||||
smlua_push_object(L, LOT_DJUICOLOR, djui_hud_get_color());
|
||||
smlua_push_object(L, LOT_DJUICOLOR, djui_hud_get_color(), NULL);
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
|
@ -12200,7 +12200,7 @@ int smlua_func_djui_hud_get_rotation(UNUSED lua_State* L) {
|
|||
}
|
||||
|
||||
|
||||
smlua_push_object(L, LOT_HUDUTILSROTATION, djui_hud_get_rotation());
|
||||
smlua_push_object(L, LOT_HUDUTILSROTATION, djui_hud_get_rotation(), NULL);
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
|
@ -14345,7 +14345,7 @@ int smlua_func_mario_get_collided_object(lua_State* L) {
|
|||
u32 interactType = smlua_to_integer(L, 2);
|
||||
if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 2, "mario_get_collided_object"); return 0; }
|
||||
|
||||
smlua_push_object(L, LOT_OBJECT, mario_get_collided_object(m, interactType));
|
||||
smlua_push_object(L, LOT_OBJECT, mario_get_collided_object(m, interactType), NULL);
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
|
@ -14546,7 +14546,7 @@ int smlua_func_lag_compensation_get_local_state(lua_State* L) {
|
|||
struct NetworkPlayer* otherNp = (struct NetworkPlayer*)smlua_to_cobject(L, 1, LOT_NETWORKPLAYER);
|
||||
if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "lag_compensation_get_local_state"); return 0; }
|
||||
|
||||
smlua_push_object(L, LOT_MARIOSTATE, lag_compensation_get_local_state(otherNp));
|
||||
smlua_push_object(L, LOT_MARIOSTATE, lag_compensation_get_local_state(otherNp), NULL);
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
|
@ -14662,7 +14662,7 @@ int smlua_func_get_level_name_sm64(lua_State* L) {
|
|||
s16 charCase = smlua_to_integer(L, 4);
|
||||
if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 4, "get_level_name_sm64"); return 0; }
|
||||
|
||||
smlua_push_pointer(L, LVT_U8_P, (void*)get_level_name_sm64(courseNum, levelNum, areaIndex, charCase));
|
||||
smlua_push_pointer(L, LVT_U8_P, (void*)get_level_name_sm64(courseNum, levelNum, areaIndex, charCase), NULL);
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
|
@ -14723,7 +14723,7 @@ int smlua_func_get_star_name_sm64(lua_State* L) {
|
|||
s16 charCase = smlua_to_integer(L, 3);
|
||||
if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 3, "get_star_name_sm64"); return 0; }
|
||||
|
||||
smlua_push_pointer(L, LVT_U8_P, (void*)get_star_name_sm64(courseNum, starNum, charCase));
|
||||
smlua_push_pointer(L, LVT_U8_P, (void*)get_star_name_sm64(courseNum, starNum, charCase), NULL);
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
|
@ -14754,7 +14754,7 @@ int smlua_func_area_create_warp_node(lua_State* L) {
|
|||
struct Object* o = (struct Object*)smlua_to_cobject(L, 6, LOT_OBJECT);
|
||||
if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 6, "area_create_warp_node"); return 0; }
|
||||
|
||||
smlua_push_object(L, LOT_OBJECTWARPNODE, area_create_warp_node(id, destLevel, destArea, destNode, checkpoint, o));
|
||||
smlua_push_object(L, LOT_OBJECTWARPNODE, area_create_warp_node(id, destLevel, destArea, destNode, checkpoint, o), NULL);
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
|
@ -14794,7 +14794,7 @@ int smlua_func_get_instant_warp(lua_State* L) {
|
|||
u8 index = smlua_to_integer(L, 1);
|
||||
if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "get_instant_warp"); return 0; }
|
||||
|
||||
smlua_push_object(L, LOT_INSTANTWARP, get_instant_warp(index));
|
||||
smlua_push_object(L, LOT_INSTANTWARP, get_instant_warp(index), NULL);
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
|
@ -14809,7 +14809,7 @@ int smlua_func_get_painting_warp_node(UNUSED lua_State* L) {
|
|||
}
|
||||
|
||||
|
||||
smlua_push_object(L, LOT_WARPNODE, get_painting_warp_node());
|
||||
smlua_push_object(L, LOT_WARPNODE, get_painting_warp_node(), NULL);
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
|
@ -15557,7 +15557,7 @@ int smlua_func_resolve_and_return_wall_collisions(lua_State* L) {
|
|||
f32 radius = smlua_to_number(L, 3);
|
||||
if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 3, "resolve_and_return_wall_collisions"); return 0; }
|
||||
|
||||
smlua_push_object(L, LOT_SURFACE, resolve_and_return_wall_collisions(pos, offset, radius));
|
||||
smlua_push_object(L, LOT_SURFACE, resolve_and_return_wall_collisions(pos, offset, radius), NULL);
|
||||
|
||||
smlua_push_vec3f(pos, 1);
|
||||
|
||||
|
|
@ -18037,7 +18037,7 @@ int smlua_func_geo_get_body_state(UNUSED lua_State* L) {
|
|||
}
|
||||
|
||||
|
||||
smlua_push_object(L, LOT_MARIOBODYSTATE, geo_get_body_state());
|
||||
smlua_push_object(L, LOT_MARIOBODYSTATE, geo_get_body_state(), NULL);
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
|
@ -18052,7 +18052,7 @@ int smlua_func_geo_get_mario_state(UNUSED lua_State* L) {
|
|||
}
|
||||
|
||||
|
||||
smlua_push_object(L, LOT_MARIOSTATE, geo_get_mario_state());
|
||||
smlua_push_object(L, LOT_MARIOSTATE, geo_get_mario_state(), NULL);
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
|
@ -19858,7 +19858,7 @@ int smlua_func_get_network_player_from_area(lua_State* L) {
|
|||
s16 areaIndex = smlua_to_integer(L, 4);
|
||||
if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 4, "get_network_player_from_area"); return 0; }
|
||||
|
||||
smlua_push_object(L, LOT_NETWORKPLAYER, get_network_player_from_area(courseNum, actNum, levelNum, areaIndex));
|
||||
smlua_push_object(L, LOT_NETWORKPLAYER, get_network_player_from_area(courseNum, actNum, levelNum, areaIndex), NULL);
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
|
@ -19879,7 +19879,7 @@ int smlua_func_get_network_player_from_level(lua_State* L) {
|
|||
s16 levelNum = smlua_to_integer(L, 3);
|
||||
if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 3, "get_network_player_from_level"); return 0; }
|
||||
|
||||
smlua_push_object(L, LOT_NETWORKPLAYER, get_network_player_from_level(courseNum, actNum, levelNum));
|
||||
smlua_push_object(L, LOT_NETWORKPLAYER, get_network_player_from_level(courseNum, actNum, levelNum), NULL);
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
|
@ -19894,7 +19894,7 @@ int smlua_func_get_network_player_smallest_global(UNUSED lua_State* L) {
|
|||
}
|
||||
|
||||
|
||||
smlua_push_object(L, LOT_NETWORKPLAYER, get_network_player_smallest_global());
|
||||
smlua_push_object(L, LOT_NETWORKPLAYER, get_network_player_smallest_global(), NULL);
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
|
@ -19926,7 +19926,7 @@ int smlua_func_network_player_from_global_index(lua_State* L) {
|
|||
u8 globalIndex = smlua_to_integer(L, 1);
|
||||
if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "network_player_from_global_index"); return 0; }
|
||||
|
||||
smlua_push_object(L, LOT_NETWORKPLAYER, network_player_from_global_index(globalIndex));
|
||||
smlua_push_object(L, LOT_NETWORKPLAYER, network_player_from_global_index(globalIndex), NULL);
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
|
@ -20508,7 +20508,7 @@ int smlua_func_nearest_interacting_mario_state_to_object(lua_State* L) {
|
|||
if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "nearest_interacting_mario_state_to_object"); return 0; }
|
||||
|
||||
extern struct MarioState *nearest_interacting_mario_state_to_object(struct Object *obj);
|
||||
smlua_push_object(L, LOT_MARIOSTATE, nearest_interacting_mario_state_to_object(obj));
|
||||
smlua_push_object(L, LOT_MARIOSTATE, nearest_interacting_mario_state_to_object(obj), NULL);
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
|
@ -20526,7 +20526,7 @@ int smlua_func_nearest_interacting_player_to_object(lua_State* L) {
|
|||
if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "nearest_interacting_player_to_object"); return 0; }
|
||||
|
||||
extern struct Object *nearest_interacting_player_to_object(struct Object *obj);
|
||||
smlua_push_object(L, LOT_OBJECT, nearest_interacting_player_to_object(obj));
|
||||
smlua_push_object(L, LOT_OBJECT, nearest_interacting_player_to_object(obj), NULL);
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
|
@ -20544,7 +20544,7 @@ int smlua_func_nearest_mario_state_to_object(lua_State* L) {
|
|||
if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "nearest_mario_state_to_object"); return 0; }
|
||||
|
||||
extern struct MarioState* nearest_mario_state_to_object(struct Object *obj);
|
||||
smlua_push_object(L, LOT_MARIOSTATE, nearest_mario_state_to_object(obj));
|
||||
smlua_push_object(L, LOT_MARIOSTATE, nearest_mario_state_to_object(obj), NULL);
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
|
@ -20562,7 +20562,7 @@ int smlua_func_nearest_player_to_object(lua_State* L) {
|
|||
if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "nearest_player_to_object"); return 0; }
|
||||
|
||||
extern struct Object* nearest_player_to_object(struct Object *obj);
|
||||
smlua_push_object(L, LOT_OBJECT, nearest_player_to_object(obj));
|
||||
smlua_push_object(L, LOT_OBJECT, nearest_player_to_object(obj), NULL);
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
|
@ -20580,7 +20580,7 @@ int smlua_func_nearest_possible_mario_state_to_object(lua_State* L) {
|
|||
if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "nearest_possible_mario_state_to_object"); return 0; }
|
||||
|
||||
extern struct MarioState* nearest_possible_mario_state_to_object(struct Object *obj);
|
||||
smlua_push_object(L, LOT_MARIOSTATE, nearest_possible_mario_state_to_object(obj));
|
||||
smlua_push_object(L, LOT_MARIOSTATE, nearest_possible_mario_state_to_object(obj), NULL);
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
|
@ -21722,7 +21722,7 @@ int smlua_func_obj_spit_fire(lua_State* L) {
|
|||
if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 8, "obj_spit_fire"); return 0; }
|
||||
|
||||
extern struct Object* obj_spit_fire(s16 relativePosX, s16 relativePosY, s16 relativePosZ, f32 scale, s32 model, f32 startSpeed, f32 endSpeed, s16 movePitch);
|
||||
smlua_push_object(L, LOT_OBJECT, obj_spit_fire(relativePosX, relativePosY, relativePosZ, scale, model, startSpeed, endSpeed, movePitch));
|
||||
smlua_push_object(L, LOT_OBJECT, obj_spit_fire(relativePosX, relativePosY, relativePosZ, scale, model, startSpeed, endSpeed, movePitch), NULL);
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
|
@ -22784,7 +22784,7 @@ int smlua_func_cur_obj_find_nearby_held_actor(lua_State* L) {
|
|||
if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 2, "cur_obj_find_nearby_held_actor"); return 0; }
|
||||
|
||||
extern struct Object *cur_obj_find_nearby_held_actor(const BehaviorScript *behavior, f32 maxDist);
|
||||
smlua_push_object(L, LOT_OBJECT, cur_obj_find_nearby_held_actor(behavior, maxDist));
|
||||
smlua_push_object(L, LOT_OBJECT, cur_obj_find_nearby_held_actor(behavior, maxDist), NULL);
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
|
@ -22804,7 +22804,7 @@ int smlua_func_cur_obj_find_nearest_object_with_behavior(lua_State* L) {
|
|||
if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 2, "cur_obj_find_nearest_object_with_behavior"); return 0; }
|
||||
|
||||
extern struct Object *cur_obj_find_nearest_object_with_behavior(const BehaviorScript *behavior, f32 *dist);
|
||||
smlua_push_object(L, LOT_OBJECT, cur_obj_find_nearest_object_with_behavior(behavior, dist));
|
||||
smlua_push_object(L, LOT_OBJECT, cur_obj_find_nearest_object_with_behavior(behavior, dist), NULL);
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
|
@ -22820,7 +22820,7 @@ int smlua_func_cur_obj_find_nearest_pole(UNUSED lua_State* L) {
|
|||
|
||||
|
||||
extern struct Object* cur_obj_find_nearest_pole(void);
|
||||
smlua_push_object(L, LOT_OBJECT, cur_obj_find_nearest_pole());
|
||||
smlua_push_object(L, LOT_OBJECT, cur_obj_find_nearest_pole(), NULL);
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
|
@ -23460,7 +23460,7 @@ int smlua_func_cur_obj_nearest_object_with_behavior(lua_State* L) {
|
|||
if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "cur_obj_nearest_object_with_behavior"); return 0; }
|
||||
|
||||
extern struct Object *cur_obj_nearest_object_with_behavior(const BehaviorScript *behavior);
|
||||
smlua_push_object(L, LOT_OBJECT, cur_obj_nearest_object_with_behavior(behavior));
|
||||
smlua_push_object(L, LOT_OBJECT, cur_obj_nearest_object_with_behavior(behavior), NULL);
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
|
@ -24308,7 +24308,7 @@ int smlua_func_cur_obj_update_floor_height_and_get_floor(UNUSED lua_State* L) {
|
|||
|
||||
|
||||
extern struct Surface *cur_obj_update_floor_height_and_get_floor(void);
|
||||
smlua_push_object(L, LOT_SURFACE, cur_obj_update_floor_height_and_get_floor());
|
||||
smlua_push_object(L, LOT_SURFACE, cur_obj_update_floor_height_and_get_floor(), NULL);
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
|
@ -24502,7 +24502,7 @@ int smlua_func_find_object_with_behavior(lua_State* L) {
|
|||
if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "find_object_with_behavior"); return 0; }
|
||||
|
||||
extern struct Object *find_object_with_behavior(const BehaviorScript *behavior);
|
||||
smlua_push_object(L, LOT_OBJECT, find_object_with_behavior(behavior));
|
||||
smlua_push_object(L, LOT_OBJECT, find_object_with_behavior(behavior), NULL);
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
|
@ -24518,7 +24518,7 @@ int smlua_func_find_unimportant_object(UNUSED lua_State* L) {
|
|||
|
||||
|
||||
extern struct Object *find_unimportant_object(void);
|
||||
smlua_push_object(L, LOT_OBJECT, find_unimportant_object());
|
||||
smlua_push_object(L, LOT_OBJECT, find_unimportant_object(), NULL);
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
|
@ -26380,7 +26380,7 @@ int smlua_func_spawn_star_with_no_lvl_exit(lua_State* L) {
|
|||
if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 2, "spawn_star_with_no_lvl_exit"); return 0; }
|
||||
|
||||
extern struct Object *spawn_star_with_no_lvl_exit(s32 sp20, s32 sp24);
|
||||
smlua_push_object(L, LOT_OBJECT, spawn_star_with_no_lvl_exit(sp20, sp24));
|
||||
smlua_push_object(L, LOT_OBJECT, spawn_star_with_no_lvl_exit(sp20, sp24), NULL);
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
|
@ -26400,7 +26400,7 @@ int smlua_func_spawn_water_droplet(lua_State* L) {
|
|||
if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 2, "spawn_water_droplet"); return 0; }
|
||||
|
||||
extern struct Object *spawn_water_droplet(struct Object *parent, struct WaterDropletParams *params);
|
||||
smlua_push_object(L, LOT_OBJECT, spawn_water_droplet(parent, params));
|
||||
smlua_push_object(L, LOT_OBJECT, spawn_water_droplet(parent, params), NULL);
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
|
@ -27046,7 +27046,7 @@ int smlua_func_get_mario_vanilla_animation(lua_State* L) {
|
|||
u16 index = smlua_to_integer(L, 1);
|
||||
if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "get_mario_vanilla_animation"); return 0; }
|
||||
|
||||
smlua_push_object(L, LOT_ANIMATION, get_mario_vanilla_animation(index));
|
||||
smlua_push_object(L, LOT_ANIMATION, get_mario_vanilla_animation(index), NULL);
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
|
@ -27120,7 +27120,7 @@ int smlua_func_audio_sample_load(lua_State* L) {
|
|||
const char* filename = smlua_to_string(L, 1);
|
||||
if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "audio_sample_load"); return 0; }
|
||||
|
||||
smlua_push_object(L, LOT_MODAUDIO, audio_sample_load(filename));
|
||||
smlua_push_object(L, LOT_MODAUDIO, audio_sample_load(filename), NULL);
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
|
@ -27264,7 +27264,7 @@ int smlua_func_audio_stream_load(lua_State* L) {
|
|||
const char* filename = smlua_to_string(L, 1);
|
||||
if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "audio_stream_load"); return 0; }
|
||||
|
||||
smlua_push_object(L, LOT_MODAUDIO, audio_stream_load(filename));
|
||||
smlua_push_object(L, LOT_MODAUDIO, audio_stream_load(filename), NULL);
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
|
@ -27942,7 +27942,7 @@ int smlua_func_collision_find_ceil(lua_State* L) {
|
|||
f32 z = smlua_to_number(L, 3);
|
||||
if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 3, "collision_find_ceil"); return 0; }
|
||||
|
||||
smlua_push_object(L, LOT_SURFACE, collision_find_ceil(x, y, z));
|
||||
smlua_push_object(L, LOT_SURFACE, collision_find_ceil(x, y, z), NULL);
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
|
@ -27963,7 +27963,7 @@ int smlua_func_collision_find_floor(lua_State* L) {
|
|||
f32 z = smlua_to_number(L, 3);
|
||||
if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 3, "collision_find_floor"); return 0; }
|
||||
|
||||
smlua_push_object(L, LOT_SURFACE, collision_find_floor(x, y, z));
|
||||
smlua_push_object(L, LOT_SURFACE, collision_find_floor(x, y, z), NULL);
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
|
@ -27978,7 +27978,7 @@ int smlua_func_collision_get_temp_wall_collision_data(UNUSED lua_State* L) {
|
|||
}
|
||||
|
||||
|
||||
smlua_push_object(L, LOT_WALLCOLLISIONDATA, collision_get_temp_wall_collision_data());
|
||||
smlua_push_object(L, LOT_WALLCOLLISIONDATA, collision_get_temp_wall_collision_data(), NULL);
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
|
@ -27997,7 +27997,7 @@ int smlua_func_get_surface_from_wcd_index(lua_State* L) {
|
|||
s8 index = smlua_to_integer(L, 2);
|
||||
if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 2, "get_surface_from_wcd_index"); return 0; }
|
||||
|
||||
smlua_push_object(L, LOT_SURFACE, get_surface_from_wcd_index(wcd, index));
|
||||
smlua_push_object(L, LOT_SURFACE, get_surface_from_wcd_index(wcd, index), NULL);
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
|
@ -28012,7 +28012,7 @@ int smlua_func_get_water_surface_pseudo_floor(UNUSED lua_State* L) {
|
|||
}
|
||||
|
||||
|
||||
smlua_push_object(L, LOT_SURFACE, get_water_surface_pseudo_floor());
|
||||
smlua_push_object(L, LOT_SURFACE, get_water_surface_pseudo_floor(), NULL);
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
|
@ -28046,7 +28046,7 @@ int smlua_func_smlua_collision_util_get(lua_State* L) {
|
|||
const char* name = smlua_to_string(L, 1);
|
||||
if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "smlua_collision_util_get"); return 0; }
|
||||
|
||||
smlua_push_pointer(L, LVT_COLLISION_P, (void*)smlua_collision_util_get(name));
|
||||
smlua_push_pointer(L, LVT_COLLISION_P, (void*)smlua_collision_util_get(name), NULL);
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
|
@ -28061,7 +28061,7 @@ int smlua_func_smlua_collision_util_get_current_terrain_collision(UNUSED lua_Sta
|
|||
}
|
||||
|
||||
|
||||
smlua_push_pointer(L, LVT_COLLISION_P, (void*)smlua_collision_util_get_current_terrain_collision());
|
||||
smlua_push_pointer(L, LVT_COLLISION_P, (void*)smlua_collision_util_get_current_terrain_collision(), NULL);
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
|
@ -28080,7 +28080,7 @@ int smlua_func_smlua_collision_util_get_level_collision(lua_State* L) {
|
|||
u16 area = smlua_to_integer(L, 2);
|
||||
if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 2, "smlua_collision_util_get_level_collision"); return 0; }
|
||||
|
||||
smlua_push_pointer(L, LVT_COLLISION_P, (void*)smlua_collision_util_get_level_collision(level, area));
|
||||
smlua_push_pointer(L, LVT_COLLISION_P, (void*)smlua_collision_util_get_level_collision(level, area), NULL);
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
|
@ -28631,7 +28631,7 @@ int smlua_func_smlua_level_util_get_info(lua_State* L) {
|
|||
s16 levelNum = smlua_to_integer(L, 1);
|
||||
if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "smlua_level_util_get_info"); return 0; }
|
||||
|
||||
smlua_push_object(L, LOT_CUSTOMLEVELINFO, smlua_level_util_get_info(levelNum));
|
||||
smlua_push_object(L, LOT_CUSTOMLEVELINFO, smlua_level_util_get_info(levelNum), NULL);
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
|
@ -28648,7 +28648,7 @@ int smlua_func_smlua_level_util_get_info_from_course_num(lua_State* L) {
|
|||
u8 courseNum = smlua_to_integer(L, 1);
|
||||
if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "smlua_level_util_get_info_from_course_num"); return 0; }
|
||||
|
||||
smlua_push_object(L, LOT_CUSTOMLEVELINFO, smlua_level_util_get_info_from_course_num(courseNum));
|
||||
smlua_push_object(L, LOT_CUSTOMLEVELINFO, smlua_level_util_get_info_from_course_num(courseNum), NULL);
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
|
@ -28665,7 +28665,7 @@ int smlua_func_smlua_level_util_get_info_from_short_name(lua_State* L) {
|
|||
const char* shortName = smlua_to_string(L, 1);
|
||||
if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "smlua_level_util_get_info_from_short_name"); return 0; }
|
||||
|
||||
smlua_push_object(L, LOT_CUSTOMLEVELINFO, smlua_level_util_get_info_from_short_name(shortName));
|
||||
smlua_push_object(L, LOT_CUSTOMLEVELINFO, smlua_level_util_get_info_from_short_name(shortName), NULL);
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
|
@ -29129,7 +29129,7 @@ int smlua_func_djui_menu_get_theme(UNUSED lua_State* L) {
|
|||
}
|
||||
|
||||
|
||||
smlua_push_object(L, LOT_DJUITHEME, djui_menu_get_theme());
|
||||
smlua_push_object(L, LOT_DJUITHEME, djui_menu_get_theme(), NULL);
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
|
@ -29227,7 +29227,7 @@ int smlua_func_get_date_and_time(UNUSED lua_State* L) {
|
|||
}
|
||||
|
||||
|
||||
smlua_push_object(L, LOT_DATETIME, get_date_and_time());
|
||||
smlua_push_object(L, LOT_DATETIME, get_date_and_time(), NULL);
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
|
@ -30200,7 +30200,7 @@ int smlua_func_get_temp_object_hitbox(UNUSED lua_State* L) {
|
|||
}
|
||||
|
||||
|
||||
smlua_push_object(L, LOT_OBJECTHITBOX, get_temp_object_hitbox());
|
||||
smlua_push_object(L, LOT_OBJECTHITBOX, get_temp_object_hitbox(), NULL);
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
|
@ -30217,7 +30217,7 @@ int smlua_func_get_trajectory(lua_State* L) {
|
|||
const char* name = smlua_to_string(L, 1);
|
||||
if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "get_trajectory"); return 0; }
|
||||
|
||||
smlua_push_pointer(L, LVT_TRAJECTORY_P, (void*)get_trajectory(name));
|
||||
smlua_push_pointer(L, LVT_TRAJECTORY_P, (void*)get_trajectory(name), NULL);
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
|
@ -30301,7 +30301,7 @@ int smlua_func_obj_get_collided_object(lua_State* L) {
|
|||
s16 index = smlua_to_integer(L, 2);
|
||||
if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 2, "obj_get_collided_object"); return 0; }
|
||||
|
||||
smlua_push_object(L, LOT_OBJECT, obj_get_collided_object(o, index));
|
||||
smlua_push_object(L, LOT_OBJECT, obj_get_collided_object(o, index), NULL);
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
|
@ -30396,7 +30396,7 @@ int smlua_func_obj_get_first(lua_State* L) {
|
|||
int objList = smlua_to_integer(L, 1);
|
||||
if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "obj_get_first"); return 0; }
|
||||
|
||||
smlua_push_object(L, LOT_OBJECT, obj_get_first(objList));
|
||||
smlua_push_object(L, LOT_OBJECT, obj_get_first(objList), NULL);
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
|
@ -30413,7 +30413,7 @@ int smlua_func_obj_get_first_with_behavior_id(lua_State* L) {
|
|||
int behaviorId = smlua_to_integer(L, 1);
|
||||
if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "obj_get_first_with_behavior_id"); return 0; }
|
||||
|
||||
smlua_push_object(L, LOT_OBJECT, obj_get_first_with_behavior_id(behaviorId));
|
||||
smlua_push_object(L, LOT_OBJECT, obj_get_first_with_behavior_id(behaviorId), NULL);
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
|
@ -30434,7 +30434,7 @@ int smlua_func_obj_get_first_with_behavior_id_and_field_f32(lua_State* L) {
|
|||
f32 value = smlua_to_number(L, 3);
|
||||
if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 3, "obj_get_first_with_behavior_id_and_field_f32"); return 0; }
|
||||
|
||||
smlua_push_object(L, LOT_OBJECT, obj_get_first_with_behavior_id_and_field_f32(behaviorId, fieldIndex, value));
|
||||
smlua_push_object(L, LOT_OBJECT, obj_get_first_with_behavior_id_and_field_f32(behaviorId, fieldIndex, value), NULL);
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
|
@ -30455,7 +30455,7 @@ int smlua_func_obj_get_first_with_behavior_id_and_field_s32(lua_State* L) {
|
|||
s32 value = smlua_to_integer(L, 3);
|
||||
if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 3, "obj_get_first_with_behavior_id_and_field_s32"); return 0; }
|
||||
|
||||
smlua_push_object(L, LOT_OBJECT, obj_get_first_with_behavior_id_and_field_s32(behaviorId, fieldIndex, value));
|
||||
smlua_push_object(L, LOT_OBJECT, obj_get_first_with_behavior_id_and_field_s32(behaviorId, fieldIndex, value), NULL);
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
|
@ -30474,7 +30474,7 @@ int smlua_func_obj_get_nearest_object_with_behavior_id(lua_State* L) {
|
|||
int behaviorId = smlua_to_integer(L, 2);
|
||||
if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 2, "obj_get_nearest_object_with_behavior_id"); return 0; }
|
||||
|
||||
smlua_push_object(L, LOT_OBJECT, obj_get_nearest_object_with_behavior_id(o, behaviorId));
|
||||
smlua_push_object(L, LOT_OBJECT, obj_get_nearest_object_with_behavior_id(o, behaviorId), NULL);
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
|
@ -30491,7 +30491,7 @@ int smlua_func_obj_get_next(lua_State* L) {
|
|||
struct Object* o = (struct Object*)smlua_to_cobject(L, 1, LOT_OBJECT);
|
||||
if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "obj_get_next"); return 0; }
|
||||
|
||||
smlua_push_object(L, LOT_OBJECT, obj_get_next(o));
|
||||
smlua_push_object(L, LOT_OBJECT, obj_get_next(o), NULL);
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
|
@ -30508,7 +30508,7 @@ int smlua_func_obj_get_next_with_same_behavior_id(lua_State* L) {
|
|||
struct Object* o = (struct Object*)smlua_to_cobject(L, 1, LOT_OBJECT);
|
||||
if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "obj_get_next_with_same_behavior_id"); return 0; }
|
||||
|
||||
smlua_push_object(L, LOT_OBJECT, obj_get_next_with_same_behavior_id(o));
|
||||
smlua_push_object(L, LOT_OBJECT, obj_get_next_with_same_behavior_id(o), NULL);
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
|
@ -30529,7 +30529,7 @@ int smlua_func_obj_get_next_with_same_behavior_id_and_field_f32(lua_State* L) {
|
|||
f32 value = smlua_to_number(L, 3);
|
||||
if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 3, "obj_get_next_with_same_behavior_id_and_field_f32"); return 0; }
|
||||
|
||||
smlua_push_object(L, LOT_OBJECT, obj_get_next_with_same_behavior_id_and_field_f32(o, fieldIndex, value));
|
||||
smlua_push_object(L, LOT_OBJECT, obj_get_next_with_same_behavior_id_and_field_f32(o, fieldIndex, value), NULL);
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
|
@ -30550,7 +30550,7 @@ int smlua_func_obj_get_next_with_same_behavior_id_and_field_s32(lua_State* L) {
|
|||
s32 value = smlua_to_integer(L, 3);
|
||||
if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 3, "obj_get_next_with_same_behavior_id_and_field_s32"); return 0; }
|
||||
|
||||
smlua_push_object(L, LOT_OBJECT, obj_get_next_with_same_behavior_id_and_field_s32(o, fieldIndex, value));
|
||||
smlua_push_object(L, LOT_OBJECT, obj_get_next_with_same_behavior_id_and_field_s32(o, fieldIndex, value), NULL);
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
|
@ -30567,7 +30567,7 @@ int smlua_func_obj_get_temp_spawn_particles_info(lua_State* L) {
|
|||
int modelId = smlua_to_integer(L, 1);
|
||||
if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "obj_get_temp_spawn_particles_info"); return 0; }
|
||||
|
||||
smlua_push_object(L, LOT_SPAWNPARTICLESINFO, obj_get_temp_spawn_particles_info(modelId));
|
||||
smlua_push_object(L, LOT_SPAWNPARTICLESINFO, obj_get_temp_spawn_particles_info(modelId), NULL);
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
|
@ -30963,7 +30963,7 @@ int smlua_func_spawn_non_sync_object(lua_State* L) {
|
|||
LuaFunction objSetupFunction = smlua_to_lua_function(L, 6);
|
||||
if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 6, "spawn_non_sync_object"); return 0; }
|
||||
|
||||
smlua_push_object(L, LOT_OBJECT, spawn_non_sync_object(behaviorId, modelId, x, y, z, objSetupFunction));
|
||||
smlua_push_object(L, LOT_OBJECT, spawn_non_sync_object(behaviorId, modelId, x, y, z, objSetupFunction), NULL);
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
|
@ -30990,7 +30990,7 @@ int smlua_func_spawn_sync_object(lua_State* L) {
|
|||
LuaFunction objSetupFunction = smlua_to_lua_function(L, 6);
|
||||
if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 6, "spawn_sync_object"); return 0; }
|
||||
|
||||
smlua_push_object(L, LOT_OBJECT, spawn_sync_object(behaviorId, modelId, x, y, z, objSetupFunction));
|
||||
smlua_push_object(L, LOT_OBJECT, spawn_sync_object(behaviorId, modelId, x, y, z, objSetupFunction), NULL);
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
|
@ -31965,7 +31965,7 @@ int smlua_func_obj_get_surface_from_index(lua_State* L) {
|
|||
u32 index = smlua_to_integer(L, 2);
|
||||
if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 2, "obj_get_surface_from_index"); return 0; }
|
||||
|
||||
smlua_push_object(L, LOT_SURFACE, obj_get_surface_from_index(o, index));
|
||||
smlua_push_object(L, LOT_SURFACE, obj_get_surface_from_index(o, index), NULL);
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -346,7 +346,7 @@ void smlua_call_event_hooks_interact_params(enum LuaHookedEventType hookType, st
|
|||
lua_remove(L, -2);
|
||||
|
||||
// push object
|
||||
smlua_push_object(L, LOT_OBJECT, obj);
|
||||
smlua_push_object(L, LOT_OBJECT, obj, NULL);
|
||||
|
||||
// push interact type
|
||||
lua_pushinteger(L, interactType);
|
||||
|
|
@ -379,7 +379,7 @@ void smlua_call_event_hooks_interact_params_ret_bool(enum LuaHookedEventType hoo
|
|||
lua_remove(L, -2);
|
||||
|
||||
// push object
|
||||
smlua_push_object(L, LOT_OBJECT, obj);
|
||||
smlua_push_object(L, LOT_OBJECT, obj, NULL);
|
||||
|
||||
// push interact type
|
||||
lua_pushinteger(L, interactType);
|
||||
|
|
@ -413,7 +413,7 @@ void smlua_call_event_hooks_interact_params_no_ret(enum LuaHookedEventType hookT
|
|||
lua_remove(L, -2);
|
||||
|
||||
// push object
|
||||
smlua_push_object(L, LOT_OBJECT, obj);
|
||||
smlua_push_object(L, LOT_OBJECT, obj, NULL);
|
||||
|
||||
// push interact type
|
||||
lua_pushinteger(L, interactType);
|
||||
|
|
@ -435,7 +435,7 @@ void smlua_call_event_hooks_object_param(enum LuaHookedEventType hookType, struc
|
|||
lua_rawgeti(L, LUA_REGISTRYINDEX, hook->reference[i]);
|
||||
|
||||
// push object
|
||||
smlua_push_object(L, LOT_OBJECT, obj);
|
||||
smlua_push_object(L, LOT_OBJECT, obj, NULL);
|
||||
|
||||
// call the callback
|
||||
if (0 != smlua_call_hook(L, 1, 0, 0, hook->mod[i])) {
|
||||
|
|
@ -454,7 +454,7 @@ void smlua_call_event_hooks_object_model_param(enum LuaHookedEventType hookType,
|
|||
lua_rawgeti(L, LUA_REGISTRYINDEX, hook->reference[i]);
|
||||
|
||||
// push params
|
||||
smlua_push_object(L, LOT_OBJECT, obj);
|
||||
smlua_push_object(L, LOT_OBJECT, obj, NULL);
|
||||
lua_pushinteger(L, modelID);
|
||||
|
||||
// call the callback
|
||||
|
|
@ -552,7 +552,7 @@ void smlua_call_event_hooks_set_camera_mode_params(enum LuaHookedEventType hookT
|
|||
lua_rawgeti(L, LUA_REGISTRYINDEX, hook->reference[i]);
|
||||
|
||||
// push params
|
||||
smlua_push_object(L, LOT_CAMERA, c);
|
||||
smlua_push_object(L, LOT_CAMERA, c, NULL);
|
||||
lua_pushinteger(L, mode);
|
||||
lua_pushinteger(L, frames);
|
||||
|
||||
|
|
@ -1037,7 +1037,7 @@ void smlua_call_event_hooks_graph_node_object_and_int_param(enum LuaHookedEventT
|
|||
lua_rawgeti(L, LUA_REGISTRYINDEX, hook->reference[i]);
|
||||
|
||||
// push graph node object
|
||||
smlua_push_object(L, LOT_GRAPHNODEOBJECT, node);
|
||||
smlua_push_object(L, LOT_GRAPHNODEOBJECT, node, NULL);
|
||||
|
||||
// push param
|
||||
lua_pushinteger(L, param);
|
||||
|
|
@ -1059,7 +1059,7 @@ void smlua_call_event_hooks_graph_node_and_int_param(enum LuaHookedEventType hoo
|
|||
lua_rawgeti(L, LUA_REGISTRYINDEX, hook->reference[i]);
|
||||
|
||||
// push graph node
|
||||
smlua_push_object(L, LOT_GRAPHNODE, node);
|
||||
smlua_push_object(L, LOT_GRAPHNODE, node, NULL);
|
||||
|
||||
// push mat index
|
||||
lua_pushinteger(L, matIndex);
|
||||
|
|
@ -1576,7 +1576,7 @@ bool smlua_call_behavior_hook(const BehaviorScript** behavior, struct Object* ob
|
|||
lua_rawgeti(L, LUA_REGISTRYINDEX, reference);
|
||||
|
||||
// push object
|
||||
smlua_push_object(L, LOT_OBJECT, object);
|
||||
smlua_push_object(L, LOT_OBJECT, object, NULL);
|
||||
|
||||
// call the callback
|
||||
if (0 != smlua_call_hook(L, 1, 0, 0, hooked->mod)) {
|
||||
|
|
|
|||
|
|
@ -348,7 +348,7 @@ bool packet_read_lnt(struct Packet* p, struct LSTNetworkType* lnt) {
|
|||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
void smlua_push_object(lua_State* L, u16 lot, void* p) {
|
||||
void smlua_push_object(lua_State* L, u16 lot, void* p, void *extraInfo) {
|
||||
if (p == NULL) {
|
||||
lua_pushnil(L);
|
||||
return;
|
||||
|
|
@ -369,6 +369,7 @@ void smlua_push_object(lua_State* L, u16 lot, void* p) {
|
|||
cobject->pointer = p;
|
||||
cobject->lot = lot;
|
||||
cobject->freed = false;
|
||||
cobject->info = extraInfo;
|
||||
lua_rawgeti(L, LUA_REGISTRYINDEX, gSmLuaCObjectMetatable);
|
||||
lua_setmetatable(L, -2);
|
||||
lua_pushinteger(L, key);
|
||||
|
|
@ -379,7 +380,7 @@ void smlua_push_object(lua_State* L, u16 lot, void* p) {
|
|||
LUA_STACK_CHECK_END();
|
||||
}
|
||||
|
||||
void smlua_push_pointer(lua_State* L, u16 lvt, void* p) {
|
||||
void smlua_push_pointer(lua_State* L, u16 lvt, void* p, void *extraInfo) {
|
||||
if (p == NULL) {
|
||||
lua_pushnil(L);
|
||||
return;
|
||||
|
|
@ -400,6 +401,7 @@ void smlua_push_pointer(lua_State* L, u16 lvt, void* p) {
|
|||
cpointer->pointer = p;
|
||||
cpointer->lvt = lvt;
|
||||
cpointer->freed = false;
|
||||
cpointer->info = extraInfo;
|
||||
lua_rawgeti(L, LUA_REGISTRYINDEX, gSmLuaCPointerMetatable);
|
||||
lua_setmetatable(L, -2);
|
||||
lua_pushinteger(L, key);
|
||||
|
|
|
|||
|
|
@ -28,8 +28,8 @@ struct LSTNetworkType smlua_to_lnt(lua_State* L, int index);
|
|||
bool packet_write_lnt(struct Packet* p, struct LSTNetworkType* lnt);
|
||||
bool packet_read_lnt(struct Packet* p, struct LSTNetworkType* lnt);
|
||||
|
||||
void smlua_push_object(lua_State* L, u16 lot, void* p);
|
||||
void smlua_push_pointer(lua_State* L, u16 lvt, void* p);
|
||||
void smlua_push_object(lua_State* L, u16 lot, void* p, void *extraInfo);
|
||||
void smlua_push_pointer(lua_State* L, u16 lvt, void* p, void *extraInfo);
|
||||
void smlua_push_integer_field(int index, const char* name, lua_Integer val);
|
||||
void smlua_push_number_field(int index, const char* name, lua_Number val);
|
||||
void smlua_push_string_field(int index, const char* name, const char* val);
|
||||
|
|
|
|||
|
|
@ -13,7 +13,7 @@
|
|||
static struct Object* spawn_object_internal(enum BehaviorId behaviorId, enum ModelExtendedId modelId, f32 x, f32 y, f32 z, LuaFunction objSetupFunction, bool doSync) {
|
||||
// prevent spawning objects on mod init, this can cause issues if --server is specificed
|
||||
if (gLuaLoadingMod != NULL) { return NULL; }
|
||||
|
||||
|
||||
if (doSync) {
|
||||
// prevent spawning objects before area is synchronized
|
||||
if (gNetworkPlayerLocal == NULL || !gNetworkPlayerLocal->currAreaSyncValid) { return NULL; }
|
||||
|
|
@ -56,7 +56,7 @@ static struct Object* spawn_object_internal(enum BehaviorId behaviorId, enum Mod
|
|||
if (objSetupFunction != 0) {
|
||||
lua_State* L = gLuaState;
|
||||
lua_rawgeti(L, LUA_REGISTRYINDEX, objSetupFunction);
|
||||
smlua_push_object(L, LOT_OBJECT, obj);
|
||||
smlua_push_object(L, LOT_OBJECT, obj, NULL);
|
||||
if (0 != smlua_pcall(L, 1, 0, 0)) {
|
||||
LOG_LUA("Failed to call the object setup callback: %u", objSetupFunction);
|
||||
}
|
||||
|
|
@ -174,7 +174,7 @@ struct Object *obj_get_nearest_object_with_behavior_id(struct Object *o, enum Be
|
|||
const BehaviorScript *behavior = get_behavior_from_id(behaviorId);
|
||||
behavior = smlua_override_behavior(behavior);
|
||||
struct Object *closestObj = NULL;
|
||||
|
||||
|
||||
if (behavior) {
|
||||
enum ObjectList objList = get_object_list_from_behavior(behavior);
|
||||
for (struct Object *obj = obj_get_first(objList); obj != NULL; obj = obj_get_next(obj)) {
|
||||
|
|
@ -194,14 +194,14 @@ s32 obj_count_objects_with_behavior_id(enum BehaviorId behaviorId) {
|
|||
const BehaviorScript *behavior = get_behavior_from_id(behaviorId);
|
||||
behavior = smlua_override_behavior(behavior);
|
||||
s32 count = 0;
|
||||
|
||||
|
||||
if (behavior) {
|
||||
enum ObjectList objList = get_object_list_from_behavior(behavior);
|
||||
for (struct Object *obj = obj_get_first(objList); obj != NULL; obj = obj_get_next(obj)) {
|
||||
if (obj->behavior == behavior) { count++; }
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return count;
|
||||
}
|
||||
|
||||
|
|
@ -337,7 +337,7 @@ struct ObjectHitbox* get_temp_object_hitbox(void) {
|
|||
|
||||
bool obj_is_attackable(struct Object *o) {
|
||||
if (o == NULL) { return FALSE; }
|
||||
|
||||
|
||||
return ((o->oInteractType & INTERACT_KOOPA) != 0 ||
|
||||
(o->oInteractType & INTERACT_BOUNCE_TOP) != 0 ||
|
||||
(o->oInteractType & INTERACT_BOUNCE_TOP2) != 0 ||
|
||||
|
|
@ -346,7 +346,7 @@ bool obj_is_attackable(struct Object *o) {
|
|||
|
||||
bool obj_is_breakable_object(struct Object *o) {
|
||||
if (o == NULL) { return FALSE; }
|
||||
|
||||
|
||||
return (obj_has_behavior_id(o, id_bhvBreakableBox) == 1 ||
|
||||
obj_has_behavior_id(o, id_bhvBreakableBoxSmall) == 1 ||
|
||||
obj_has_behavior_id(o, id_bhvHiddenObject) == 1 ||
|
||||
|
|
@ -355,31 +355,31 @@ bool obj_is_breakable_object(struct Object *o) {
|
|||
|
||||
bool obj_is_bully(struct Object *o) {
|
||||
if (o == NULL) { return FALSE; }
|
||||
|
||||
|
||||
return (o->oInteractType & INTERACT_BULLY) != 0;
|
||||
}
|
||||
|
||||
bool obj_is_coin(struct Object *o) {
|
||||
if (o == NULL) { return FALSE; }
|
||||
|
||||
|
||||
return (o->oInteractType & INTERACT_COIN) != 0;
|
||||
}
|
||||
|
||||
bool obj_is_exclamation_box(struct Object *o) {
|
||||
if (o == NULL) { return FALSE; }
|
||||
|
||||
|
||||
return obj_has_behavior_id(o, id_bhvExclamationBox) == 1 && o->oAction == 2;
|
||||
}
|
||||
|
||||
bool obj_is_grabbable(struct Object *o) {
|
||||
if (o == NULL) { return FALSE; }
|
||||
|
||||
|
||||
return (o->oInteractType & INTERACT_GRABBABLE) != 0 && (o->oInteractionSubtype & INT_SUBTYPE_NOT_GRABBABLE) == 0;
|
||||
}
|
||||
|
||||
bool obj_is_mushroom_1up(struct Object *o) {
|
||||
if (o == NULL) { return FALSE; }
|
||||
|
||||
|
||||
return (o->header.gfx.node.flags & GRAPH_RENDER_INVISIBLE) == 0 && (
|
||||
obj_has_behavior_id(o, id_bhv1Up) == 1 ||
|
||||
obj_has_behavior_id(o, id_bhv1upJumpOnApproach) == 1 ||
|
||||
|
|
@ -395,24 +395,24 @@ bool obj_is_mushroom_1up(struct Object *o) {
|
|||
|
||||
bool obj_is_secret(struct Object *o) {
|
||||
if (o == NULL) { return FALSE; }
|
||||
|
||||
|
||||
return obj_has_behavior_id(o, id_bhvHiddenStarTrigger) == 1;
|
||||
}
|
||||
|
||||
bool obj_is_valid_for_interaction(struct Object *o) {
|
||||
if (o == NULL) { return FALSE; }
|
||||
|
||||
|
||||
return o->activeFlags != ACTIVE_FLAG_DEACTIVATED && o->oIntangibleTimer == 0 && (o->oInteractStatus & INT_STATUS_INTERACTED) == 0;
|
||||
}
|
||||
|
||||
bool obj_check_hitbox_overlap(struct Object *o1, struct Object *o2) {
|
||||
if (o1 == NULL || o2 == NULL) { return FALSE; }
|
||||
|
||||
|
||||
f32 o1H = max(o1->hitboxHeight, o1->hurtboxHeight);
|
||||
f32 o1R = max(o1->hitboxRadius, o1->hurtboxRadius);
|
||||
f32 o2H = max(o2->hitboxHeight, o2->hurtboxHeight);
|
||||
f32 o2R = max(o2->hitboxRadius, o2->hurtboxRadius);
|
||||
|
||||
|
||||
f32 r2 = sqr(o1R + o2R);
|
||||
f32 d2 = sqr(o1->oPosX - o2->oPosX) + sqr(o1->oPosZ - o2->oPosZ);
|
||||
if (d2 > r2) return FALSE;
|
||||
|
|
@ -427,10 +427,10 @@ bool obj_check_hitbox_overlap(struct Object *o1, struct Object *o2) {
|
|||
|
||||
bool obj_check_overlap_with_hitbox_params(struct Object *o, f32 x, f32 y, f32 z, f32 h, f32 r, f32 d) {
|
||||
if (o == NULL) { return FALSE; }
|
||||
|
||||
|
||||
f32 oH = max(o->hitboxHeight, o->hurtboxHeight);
|
||||
f32 oR = max(o->hitboxRadius, o->hurtboxRadius);
|
||||
|
||||
|
||||
f32 r2 = sqr(oR + r);
|
||||
f32 d2 = sqr(o->oPosX - x) + sqr(o->oPosZ - z);
|
||||
if (d2 > r2) return FALSE;
|
||||
|
|
@ -445,7 +445,7 @@ bool obj_check_overlap_with_hitbox_params(struct Object *o, f32 x, f32 y, f32 z,
|
|||
|
||||
void obj_set_vel(struct Object *o, f32 vx, f32 vy, f32 vz) {
|
||||
if (o == NULL) { return; }
|
||||
|
||||
|
||||
o->oVelX = vx;
|
||||
o->oVelY = vy;
|
||||
o->oVelZ = vz;
|
||||
|
|
@ -453,7 +453,7 @@ void obj_set_vel(struct Object *o, f32 vx, f32 vy, f32 vz) {
|
|||
|
||||
void obj_move_xyz(struct Object *o, f32 dx, f32 dy, f32 dz) {
|
||||
if (o == NULL) { return; }
|
||||
|
||||
|
||||
o->oPosX += dx;
|
||||
o->oPosY += dy;
|
||||
o->oPosZ += dz;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue