Added the ability to set surface collisions on custom behaviors

This commit is contained in:
MysterD 2022-03-09 22:58:45 -08:00
parent 9388aa8885
commit 4638ff6f22
21 changed files with 813 additions and 83 deletions

View File

@ -2,7 +2,7 @@ import os
usf_types = ['u8', 'u16', 'u32', 'u64', 's8', 's16', 's32', 's64', 'f32']
vec3_types = ['Vec3s', 'Vec3f']
typedef_pointers = ['BehaviorScript', 'ObjectAnimPointer']
typedef_pointers = ['BehaviorScript', 'ObjectAnimPointer', 'Collision']
exclude_structs = [
'SPTask',

View File

@ -37,10 +37,12 @@ in_files = [
"include/behavior_table.h",
"src/pc/lua/smlua_obj_utils.h",
"src/pc/lua/smlua_misc_utils.h",
'src/pc/lua/smlua_collision_utils.h',
"src/game/object_helpers.c",
"src/game/obj_behaviors.c",
"src/game/obj_behaviors_2.c",
"src/game/spawn_sound.c",
"src/engine/surface_load.h",
]
override_allowed_functions = {

View File

@ -17,6 +17,7 @@ in_files = [
'src/game/mario_step.h',
'src/pc/lua/smlua_anim_utils.h',
'src/pc/lua/smlua_misc_utils.h',
'src/pc/lua/smlua_collision_utils.h',
'src/game/spawn_sound.h',
]
@ -204,7 +205,7 @@ def get_struct_field_info(struct, field):
lvt = translate_type_to_lvt(ftype)
lot = translate_type_to_lot(ftype)
fimmutable = str(lvt == 'LVT_COBJECT' or 'const ' in ftype).lower()
if lvt.startswith('LVT_') and lvt.endswith('_P') and 'OBJECT' not in lvt:
if lvt.startswith('LVT_') and lvt.endswith('_P') and 'OBJECT' not in lvt and 'COLLISION' not in lvt:
fimmutable = 'true'
if sid in override_field_immutable:

View File

@ -0,0 +1,36 @@
-- name: Custom Box with collisions
-- description: Press DPAD+down to spawn a box
function bhv_custom_box_init(obj)
obj.oFlags = OBJ_FLAG_UPDATE_GFX_POS_AND_ANGLE
obj.collisionData = gGlobalObjectCollisionData.breakable_box_seg8_collision_08012D70
obj.oCollisionDistance = 500
end
function bhv_custom_box_loop(obj)
load_object_collision_model()
end
-- hook the behavior
id_bhvCustomBox = hook_behavior(nil, OBJ_LIST_SURFACE, true, bhv_custom_box_init, bhv_custom_box_loop)
------------------------
function mario_update_local(m)
if (m.controller.buttonPressed & D_JPAD) ~= 0 then
-- spawn breakable box
spawn_non_sync_object(
id_bhvCustomBox,
E_MODEL_BREAKABLE_BOX,
m.pos.x, m.pos.y, m.pos.z,
nil)
end
end
function mario_update(m)
if m.playerIndex == 0 then
mario_update_local(m)
end
end
hook_event(HOOK_MARIO_UPDATE, mario_update)

View File

@ -617,8 +617,12 @@
<br />
- smlua_misc_utils.h
- smlua_collision_utils.h
- [collision_find_surface_on_ray](#collision_find_surface_on_ray)
<br />
- smlua_misc_utils.h
- [get_network_area_timer](#get_network_area_timer)
<br />
@ -680,6 +684,15 @@
<br />
- surface_load.h
- [alloc_surface_pools](#alloc_surface_pools)
- [clear_dynamic_surfaces](#clear_dynamic_surfaces)
- [get_area_terrain_size](#get_area_terrain_size)
- [load_area_terrain](#load_area_terrain)
- [load_object_collision_model](#load_object_collision_model)
<br />
- thread6.c
- [queue_rumble_data](#queue_rumble_data)
- [queue_rumble_data_mario](#queue_rumble_data_mario)
@ -11394,7 +11407,7 @@ The `reliable` field will ensure that the packet arrives, but should be used spa
<br />
---
# functions from smlua_misc_utils.h
# functions from smlua_collision_utils.h
<br />
@ -11424,6 +11437,12 @@ The `reliable` field will ensure that the packet arrives, but should be used spa
<br />
---
# functions from smlua_misc_utils.h
<br />
## [get_network_area_timer](#get_network_area_timer)
### Lua Example
@ -12297,6 +12316,109 @@ The `reliable` field will ensure that the packet arrives, but should be used spa
<br />
---
# functions from surface_load.h
<br />
## [alloc_surface_pools](#alloc_surface_pools)
### Lua Example
`alloc_surface_pools()`
### Parameters
- None
### Returns
- None
### C Prototype
`void alloc_surface_pools(void);`
[:arrow_up_small:](#)
<br />
## [clear_dynamic_surfaces](#clear_dynamic_surfaces)
### Lua Example
`clear_dynamic_surfaces()`
### Parameters
- None
### Returns
- None
### C Prototype
`void clear_dynamic_surfaces(void);`
[:arrow_up_small:](#)
<br />
## [get_area_terrain_size](#get_area_terrain_size)
### Lua Example
`local integerValue = get_area_terrain_size(data)`
### Parameters
| Field | Type |
| ----- | ---- |
| data | `Pointer` <`integer`> |
### Returns
- `integer`
### C Prototype
`u32 get_area_terrain_size(s16 *data);`
[:arrow_up_small:](#)
<br />
## [load_area_terrain](#load_area_terrain)
### Lua Example
`load_area_terrain(index, data, surfaceRooms, macroObjects)`
### Parameters
| Field | Type |
| ----- | ---- |
| index | `integer` |
| data | `Pointer` <`integer`> |
| surfaceRooms | `Pointer` <`integer`> |
| macroObjects | `Pointer` <`integer`> |
### Returns
- None
### C Prototype
`void load_area_terrain(s16 index, s16 *data, s8 *surfaceRooms, s16 *macroObjects);`
[:arrow_up_small:](#)
<br />
## [load_object_collision_model](#load_object_collision_model)
### Lua Example
`load_object_collision_model()`
### Parameters
- None
### Returns
- None
### C Prototype
`void load_object_collision_model(void);`
[:arrow_up_small:](#)
<br />
---
# functions from thread6.c

View File

@ -44,6 +44,13 @@ The `gObjectAnimations` table contains references to object animations. Listed i
<br />
## [gGlobalObjectCollisionData](#gGlobalObjectCollisionData)
The `gGlobalObjectCollisionData` table contains references to object collision data. Listed in [GlobalObjectCollisionData](structs.md#GlobalObjectCollisionData).
[: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

@ -52,3 +52,4 @@ All of this is a holdover from when there were only two players. It was a reason
- [Custom Ball Behavior](examples/behavior-ball.lua)
- [Replace Goomba Behavior](examples/behavior-replace-goomba.lua)
- [Add to Goomba Behavior](examples/behavior-add-to-goomba.lua)
- [Behavior with Surface Collisions](examples/behavior-surface-collisions.lua)

View File

@ -17,6 +17,7 @@
- [CutsceneVariable](#CutsceneVariable)
- [FloorGeometry](#FloorGeometry)
- [GlobalObjectAnimations](#GlobalObjectAnimations)
- [GlobalObjectCollisionData](#GlobalObjectCollisionData)
- [GlobalTextures](#GlobalTextures)
- [GraphNode](#GraphNode)
- [GraphNodeObject](#GraphNodeObject)
@ -419,6 +420,114 @@
<br />
## [GlobalObjectCollisionData](#GlobalObjectCollisionData)
| Field | Type | Access |
| ----- | ---- | ------ |
| bbh_seg7_collision_coffin | `Pointer` <`Collision`> | |
| bbh_seg7_collision_haunted_bookshelf | `Pointer` <`Collision`> | |
| bbh_seg7_collision_merry_go_round | `Pointer` <`Collision`> | |
| bbh_seg7_collision_mesh_elevator | `Pointer` <`Collision`> | |
| bbh_seg7_collision_staircase_step | `Pointer` <`Collision`> | |
| bbh_seg7_collision_tilt_floor_platform | `Pointer` <`Collision`> | |
| bitdw_seg7_collision_moving_pyramid | `Pointer` <`Collision`> | |
| bitfs_seg7_collision_inverted_pyramid | `Pointer` <`Collision`> | |
| bitfs_seg7_collision_sinking_cage_platform | `Pointer` <`Collision`> | |
| bitfs_seg7_collision_sinking_platform | `Pointer` <`Collision`> | |
| bitfs_seg7_collision_squishable_platform | `Pointer` <`Collision`> | |
| blue_coin_switch_seg8_collision_08000E98 | `Pointer` <`Collision`> | |
| bob_seg7_collision_chain_chomp_gate | `Pointer` <`Collision`> | |
| bowser_2_seg7_collision_tilting_platform | `Pointer` <`Collision`> | |
| breakable_box_seg8_collision_08012D70 | `Pointer` <`Collision`> | |
| cannon_lid_seg8_collision_08004950 | `Pointer` <`Collision`> | |
| capswitch_collision_050033D0 | `Pointer` <`Collision`> | |
| capswitch_collision_05003448 | `Pointer` <`Collision`> | |
| castle_grounds_seg7_collision_cannon_grill | `Pointer` <`Collision`> | |
| castle_grounds_seg7_collision_moat_grills | `Pointer` <`Collision`> | |
| checkerboard_platform_seg8_collision_0800D710 | `Pointer` <`Collision`> | |
| ddd_seg7_collision_bowser_sub_door | `Pointer` <`Collision`> | |
| ddd_seg7_collision_submarine | `Pointer` <`Collision`> | |
| door_seg3_collision_0301CE78 | `Pointer` <`Collision`> | |
| dorrie_seg6_collision_0600F644 | `Pointer` <`Collision`> | |
| exclamation_box_outline_seg8_collision_08025F78 | `Pointer` <`Collision`> | |
| hmc_seg7_collision_controllable_platform | `Pointer` <`Collision`> | |
| hmc_seg7_collision_controllable_platform_sub | `Pointer` <`Collision`> | |
| hmc_seg7_collision_elevator | `Pointer` <`Collision`> | |
| inside_castle_seg7_collision_floor_trap | `Pointer` <`Collision`> | |
| inside_castle_seg7_collision_star_door | `Pointer` <`Collision`> | |
| inside_castle_seg7_collision_water_level_pillar | `Pointer` <`Collision`> | |
| jrb_seg7_collision_floating_box | `Pointer` <`Collision`> | |
| jrb_seg7_collision_floating_platform | `Pointer` <`Collision`> | |
| jrb_seg7_collision_in_sunken_ship | `Pointer` <`Collision`> | |
| jrb_seg7_collision_in_sunken_ship_2 | `Pointer` <`Collision`> | |
| jrb_seg7_collision_in_sunken_ship_3 | `Pointer` <`Collision`> | |
| jrb_seg7_collision_pillar_base | `Pointer` <`Collision`> | |
| jrb_seg7_collision_rock_solid | `Pointer` <`Collision`> | |
| lll_hexagonal_mesh_seg3_collision_0301CECC | `Pointer` <`Collision`> | |
| lll_seg7_collision_drawbridge | `Pointer` <`Collision`> | |
| lll_seg7_collision_falling_wall | `Pointer` <`Collision`> | |
| lll_seg7_collision_floating_block | `Pointer` <`Collision`> | |
| lll_seg7_collision_hexagonal_platform | `Pointer` <`Collision`> | |
| lll_seg7_collision_inverted_pyramid | `Pointer` <`Collision`> | |
| lll_seg7_collision_octagonal_moving_platform | `Pointer` <`Collision`> | |
| lll_seg7_collision_pitoune | `Pointer` <`Collision`> | |
| lll_seg7_collision_puzzle_piece | `Pointer` <`Collision`> | |
| lll_seg7_collision_rotating_fire_bars | `Pointer` <`Collision`> | |
| lll_seg7_collision_rotating_platform | `Pointer` <`Collision`> | |
| lll_seg7_collision_sinking_pyramids | `Pointer` <`Collision`> | |
| lll_seg7_collision_slow_tilting_platform | `Pointer` <`Collision`> | |
| lll_seg7_collision_wood_piece | `Pointer` <`Collision`> | |
| metal_box_seg8_collision_08024C28 | `Pointer` <`Collision`> | |
| penguin_seg5_collision_05008B88 | `Pointer` <`Collision`> | |
| poundable_pole_collision_06002490 | `Pointer` <`Collision`> | |
| purple_switch_seg8_collision_0800C7A8 | `Pointer` <`Collision`> | |
| rr_seg7_collision_donut_platform | `Pointer` <`Collision`> | |
| rr_seg7_collision_elevator_platform | `Pointer` <`Collision`> | |
| rr_seg7_collision_pendulum | `Pointer` <`Collision`> | |
| rr_seg7_collision_rotating_platform_with_fire | `Pointer` <`Collision`> | |
| sl_seg7_collision_pound_explodes | `Pointer` <`Collision`> | |
| sl_seg7_collision_sliding_snow_mound | `Pointer` <`Collision`> | |
| springboard_collision_05001A28 | `Pointer` <`Collision`> | |
| ssl_seg7_collision_0702808C | `Pointer` <`Collision`> | |
| ssl_seg7_collision_grindel | `Pointer` <`Collision`> | |
| ssl_seg7_collision_pyramid_elevator | `Pointer` <`Collision`> | |
| ssl_seg7_collision_pyramid_top | `Pointer` <`Collision`> | |
| ssl_seg7_collision_spindel | `Pointer` <`Collision`> | |
| ssl_seg7_collision_tox_box | `Pointer` <`Collision`> | |
| thi_seg7_collision_top_trap | `Pointer` <`Collision`> | |
| thwomp_seg5_collision_0500B7D0 | `Pointer` <`Collision`> | |
| thwomp_seg5_collision_0500B92C | `Pointer` <`Collision`> | |
| ttc_seg7_collision_clock_main_rotation | `Pointer` <`Collision`> | |
| ttc_seg7_collision_clock_pendulum | `Pointer` <`Collision`> | |
| ttc_seg7_collision_clock_platform | `Pointer` <`Collision`> | |
| ttc_seg7_collision_rotating_clock_platform2 | `Pointer` <`Collision`> | |
| ttc_seg7_collision_sliding_surface | `Pointer` <`Collision`> | |
| ttm_seg7_collision_pitoune_2 | `Pointer` <`Collision`> | |
| ttm_seg7_collision_podium_warp | `Pointer` <`Collision`> | |
| ttm_seg7_collision_ukiki_cage | `Pointer` <`Collision`> | |
| warp_pipe_seg3_collision_03009AC8 | `Pointer` <`Collision`> | |
| wdw_seg7_collision_arrow_lift | `Pointer` <`Collision`> | |
| wdw_seg7_collision_express_elevator_platform | `Pointer` <`Collision`> | |
| wdw_seg7_collision_rect_floating_platform | `Pointer` <`Collision`> | |
| wdw_seg7_collision_square_floating_platform | `Pointer` <`Collision`> | |
| wf_seg7_collision_breakable_wall | `Pointer` <`Collision`> | |
| wf_seg7_collision_breakable_wall_2 | `Pointer` <`Collision`> | |
| wf_seg7_collision_bullet_bill_cannon | `Pointer` <`Collision`> | |
| wf_seg7_collision_clocklike_rotation | `Pointer` <`Collision`> | |
| wf_seg7_collision_kickable_board | `Pointer` <`Collision`> | |
| wf_seg7_collision_large_bomp | `Pointer` <`Collision`> | |
| wf_seg7_collision_platform | `Pointer` <`Collision`> | |
| wf_seg7_collision_sliding_brick_platform | `Pointer` <`Collision`> | |
| wf_seg7_collision_small_bomp | `Pointer` <`Collision`> | |
| wf_seg7_collision_tower | `Pointer` <`Collision`> | |
| wf_seg7_collision_tower_door | `Pointer` <`Collision`> | |
| whomp_seg6_collision_06020A0C | `Pointer` <`Collision`> | |
| wooden_signpost_seg3_collision_0302DD80 | `Pointer` <`Collision`> | |
[:arrow_up_small:](#)
<br />
## [GlobalTextures](#GlobalTextures)
| Field | Type | Access |
@ -747,6 +856,7 @@
| bhvDelayTimer | `integer` | |
| bhvStackIndex | `integer` | |
| collidedObjInteractTypes | `integer` | |
| collisionData | `Pointer` <`Collision`> | |
| coopFlags | `integer` | read-only |
| curBhvCommand | `Pointer` <`BehaviorScript`> | read-only |
| globalPlayerIndex | `integer` | |

View File

@ -220,7 +220,7 @@ struct Object
/*0x20C*/ const BehaviorScript *behavior;
/*0x210*/ u32 heldByPlayerIndex;
/*0x214*/ struct Object *platform;
/*0x218*/ void *collisionData;
/*0x218*/ Collision *collisionData;
/*0x21C*/ Mat4 transform;
/*0x25C*/ void *respawnInfo;
/*?????*/ u8 coopFlags;

View File

@ -222,9 +222,6 @@ function bhv_ball_init(obj)
obj.hitboxRadius = 100
obj.hitboxHeight = 100
-- area timer
table.insert(gInitializeBalls, obj)
-- custom values
obj.oNetworkTime = 0
obj.oHitTime = 0

View File

@ -776,7 +776,7 @@ static s32 bhv_cmd_set_int_random_from_table(void) {
static s32 bhv_cmd_load_collision_data(void) {
u32 *collisionData = segmented_to_virtual(BHV_CMD_GET_VPTR(1));
gCurrentObject->collisionData = collisionData;
gCurrentObject->collisionData = (Collision*)collisionData;
gCurBhvCommand += 2;
return BHV_PROC_CONTINUE;

View File

@ -58,6 +58,7 @@ struct GlobalObjectAnimations {
ObjectAnimPointer* wiggler_seg5_anims_0500EC8C;
ObjectAnimPointer* yoshi_seg5_anims_05024100;
};
extern struct GlobalObjectAnimations gGlobalObjectAnimations;
#endif

View File

@ -8,6 +8,7 @@
#include "pc/djui/djui_hud_utils.h"
#include "pc/lua/smlua.h"
#include "pc/lua/smlua_anim_utils.h"
#include "pc/lua/smlua_collision_utils.h"
#include "pc/mod_list.h"
#define LUA_VEC3S_FIELD_COUNT 3
@ -304,6 +305,7 @@ static int smlua__get_field(lua_State* L) {
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;
// pointers
case LVT_U8_P:
@ -315,6 +317,7 @@ static int smlua__get_field(lua_State* L) {
case LVT_F32_P:
case LVT_BEHAVIORSCRIPT_P:
case LVT_OBJECTANIMPOINTER_P:
case LVT_COLLISION_P:
smlua_push_pointer(L, data->valueType, *(u8**)p);
break;
@ -403,6 +406,7 @@ static int smlua__set_field(lua_State* L) {
case LVT_F32_P:
case LVT_BEHAVIORSCRIPT_P:
case LVT_OBJECTANIMPOINTER_P:
case LVT_COLLISION_P:
valuePointer = smlua_to_cpointer(L, 4, data->valueType);
if (gSmLuaConvertSuccess) {
*(u8**)p = valuePointer;
@ -474,6 +478,11 @@ void smlua_cobject_init_globals(void) {
lua_setglobal(L, "gObjectAnimations");
}
{
smlua_push_object(L, LOT_GLOBALOBJECTCOLLISIONDATA, &gGlobalObjectCollisionData);
lua_setglobal(L, "gGlobalObjectCollisionData");
}
}
void smlua_cobject_init_per_file_globals(char* path) {

View File

@ -25,6 +25,8 @@ enum LuaValueType {
LVT_BEHAVIORSCRIPT_P,
LVT_OBJECTANIMPOINTER,
LVT_OBJECTANIMPOINTER_P,
LVT_COLLISION,
LVT_COLLISION_P,
LVT_LUAFUNCTION,
LVT_POINTER,
LVT_MAX,

View File

@ -12,6 +12,7 @@
#include "src/game/mario_step.h"
#include "src/pc/lua/smlua_anim_utils.h"
#include "src/pc/lua/smlua_misc_utils.h"
#include "src/pc/lua/smlua_collision_utils.h"
#include "src/game/spawn_sound.h"
#include "include/object_fields.h"
@ -307,6 +308,109 @@ static struct LuaObjectField sGlobalObjectAnimationsFields[LUA_GLOBAL_OBJECT_ANI
{ "yoshi_seg5_anims_05024100", LVT_OBJECTANIMPOINTER_P, offsetof(struct GlobalObjectAnimations, yoshi_seg5_anims_05024100), true, LOT_POINTER },
};
#define LUA_GLOBAL_OBJECT_COLLISION_DATA_FIELD_COUNT 99
static struct LuaObjectField sGlobalObjectCollisionDataFields[LUA_GLOBAL_OBJECT_COLLISION_DATA_FIELD_COUNT] = {
{ "bbh_seg7_collision_coffin", LVT_COLLISION_P, offsetof(struct GlobalObjectCollisionData, bbh_seg7_collision_coffin), false, LOT_POINTER },
{ "bbh_seg7_collision_haunted_bookshelf", LVT_COLLISION_P, offsetof(struct GlobalObjectCollisionData, bbh_seg7_collision_haunted_bookshelf), false, LOT_POINTER },
{ "bbh_seg7_collision_merry_go_round", LVT_COLLISION_P, offsetof(struct GlobalObjectCollisionData, bbh_seg7_collision_merry_go_round), false, LOT_POINTER },
{ "bbh_seg7_collision_mesh_elevator", LVT_COLLISION_P, offsetof(struct GlobalObjectCollisionData, bbh_seg7_collision_mesh_elevator), false, LOT_POINTER },
{ "bbh_seg7_collision_staircase_step", LVT_COLLISION_P, offsetof(struct GlobalObjectCollisionData, bbh_seg7_collision_staircase_step), false, LOT_POINTER },
{ "bbh_seg7_collision_tilt_floor_platform", LVT_COLLISION_P, offsetof(struct GlobalObjectCollisionData, bbh_seg7_collision_tilt_floor_platform), false, LOT_POINTER },
{ "bitdw_seg7_collision_moving_pyramid", LVT_COLLISION_P, offsetof(struct GlobalObjectCollisionData, bitdw_seg7_collision_moving_pyramid), false, LOT_POINTER },
{ "bitfs_seg7_collision_inverted_pyramid", LVT_COLLISION_P, offsetof(struct GlobalObjectCollisionData, bitfs_seg7_collision_inverted_pyramid), false, LOT_POINTER },
{ "bitfs_seg7_collision_sinking_cage_platform", LVT_COLLISION_P, offsetof(struct GlobalObjectCollisionData, bitfs_seg7_collision_sinking_cage_platform), false, LOT_POINTER },
{ "bitfs_seg7_collision_sinking_platform", LVT_COLLISION_P, offsetof(struct GlobalObjectCollisionData, bitfs_seg7_collision_sinking_platform), false, LOT_POINTER },
{ "bitfs_seg7_collision_squishable_platform", LVT_COLLISION_P, offsetof(struct GlobalObjectCollisionData, bitfs_seg7_collision_squishable_platform), false, LOT_POINTER },
{ "blue_coin_switch_seg8_collision_08000E98", LVT_COLLISION_P, offsetof(struct GlobalObjectCollisionData, blue_coin_switch_seg8_collision_08000E98), false, LOT_POINTER },
{ "bob_seg7_collision_chain_chomp_gate", LVT_COLLISION_P, offsetof(struct GlobalObjectCollisionData, bob_seg7_collision_chain_chomp_gate), false, LOT_POINTER },
{ "bowser_2_seg7_collision_tilting_platform", LVT_COLLISION_P, offsetof(struct GlobalObjectCollisionData, bowser_2_seg7_collision_tilting_platform), false, LOT_POINTER },
{ "breakable_box_seg8_collision_08012D70", LVT_COLLISION_P, offsetof(struct GlobalObjectCollisionData, breakable_box_seg8_collision_08012D70), false, LOT_POINTER },
{ "cannon_lid_seg8_collision_08004950", LVT_COLLISION_P, offsetof(struct GlobalObjectCollisionData, cannon_lid_seg8_collision_08004950), false, LOT_POINTER },
{ "capswitch_collision_050033D0", LVT_COLLISION_P, offsetof(struct GlobalObjectCollisionData, capswitch_collision_050033D0), false, LOT_POINTER },
{ "capswitch_collision_05003448", LVT_COLLISION_P, offsetof(struct GlobalObjectCollisionData, capswitch_collision_05003448), false, LOT_POINTER },
{ "castle_grounds_seg7_collision_cannon_grill", LVT_COLLISION_P, offsetof(struct GlobalObjectCollisionData, castle_grounds_seg7_collision_cannon_grill), false, LOT_POINTER },
{ "castle_grounds_seg7_collision_moat_grills", LVT_COLLISION_P, offsetof(struct GlobalObjectCollisionData, castle_grounds_seg7_collision_moat_grills), false, LOT_POINTER },
{ "checkerboard_platform_seg8_collision_0800D710", LVT_COLLISION_P, offsetof(struct GlobalObjectCollisionData, checkerboard_platform_seg8_collision_0800D710), false, LOT_POINTER },
{ "ddd_seg7_collision_bowser_sub_door", LVT_COLLISION_P, offsetof(struct GlobalObjectCollisionData, ddd_seg7_collision_bowser_sub_door), false, LOT_POINTER },
{ "ddd_seg7_collision_submarine", LVT_COLLISION_P, offsetof(struct GlobalObjectCollisionData, ddd_seg7_collision_submarine), false, LOT_POINTER },
{ "door_seg3_collision_0301CE78", LVT_COLLISION_P, offsetof(struct GlobalObjectCollisionData, door_seg3_collision_0301CE78), false, LOT_POINTER },
{ "dorrie_seg6_collision_0600F644", LVT_COLLISION_P, offsetof(struct GlobalObjectCollisionData, dorrie_seg6_collision_0600F644), false, LOT_POINTER },
{ "exclamation_box_outline_seg8_collision_08025F78", LVT_COLLISION_P, offsetof(struct GlobalObjectCollisionData, exclamation_box_outline_seg8_collision_08025F78), false, LOT_POINTER },
{ "hmc_seg7_collision_controllable_platform", LVT_COLLISION_P, offsetof(struct GlobalObjectCollisionData, hmc_seg7_collision_controllable_platform), false, LOT_POINTER },
{ "hmc_seg7_collision_controllable_platform_sub", LVT_COLLISION_P, offsetof(struct GlobalObjectCollisionData, hmc_seg7_collision_controllable_platform_sub), false, LOT_POINTER },
{ "hmc_seg7_collision_elevator", LVT_COLLISION_P, offsetof(struct GlobalObjectCollisionData, hmc_seg7_collision_elevator), false, LOT_POINTER },
{ "inside_castle_seg7_collision_floor_trap", LVT_COLLISION_P, offsetof(struct GlobalObjectCollisionData, inside_castle_seg7_collision_floor_trap), false, LOT_POINTER },
{ "inside_castle_seg7_collision_star_door", LVT_COLLISION_P, offsetof(struct GlobalObjectCollisionData, inside_castle_seg7_collision_star_door), false, LOT_POINTER },
{ "inside_castle_seg7_collision_water_level_pillar", LVT_COLLISION_P, offsetof(struct GlobalObjectCollisionData, inside_castle_seg7_collision_water_level_pillar), false, LOT_POINTER },
{ "jrb_seg7_collision_floating_box", LVT_COLLISION_P, offsetof(struct GlobalObjectCollisionData, jrb_seg7_collision_floating_box), false, LOT_POINTER },
{ "jrb_seg7_collision_floating_platform", LVT_COLLISION_P, offsetof(struct GlobalObjectCollisionData, jrb_seg7_collision_floating_platform), false, LOT_POINTER },
{ "jrb_seg7_collision_in_sunken_ship", LVT_COLLISION_P, offsetof(struct GlobalObjectCollisionData, jrb_seg7_collision_in_sunken_ship), false, LOT_POINTER },
{ "jrb_seg7_collision_in_sunken_ship_2", LVT_COLLISION_P, offsetof(struct GlobalObjectCollisionData, jrb_seg7_collision_in_sunken_ship_2), false, LOT_POINTER },
{ "jrb_seg7_collision_in_sunken_ship_3", LVT_COLLISION_P, offsetof(struct GlobalObjectCollisionData, jrb_seg7_collision_in_sunken_ship_3), false, LOT_POINTER },
{ "jrb_seg7_collision_pillar_base", LVT_COLLISION_P, offsetof(struct GlobalObjectCollisionData, jrb_seg7_collision_pillar_base), false, LOT_POINTER },
{ "jrb_seg7_collision_rock_solid", LVT_COLLISION_P, offsetof(struct GlobalObjectCollisionData, jrb_seg7_collision_rock_solid), false, LOT_POINTER },
{ "lll_hexagonal_mesh_seg3_collision_0301CECC", LVT_COLLISION_P, offsetof(struct GlobalObjectCollisionData, lll_hexagonal_mesh_seg3_collision_0301CECC), false, LOT_POINTER },
{ "lll_seg7_collision_drawbridge", LVT_COLLISION_P, offsetof(struct GlobalObjectCollisionData, lll_seg7_collision_drawbridge), false, LOT_POINTER },
{ "lll_seg7_collision_falling_wall", LVT_COLLISION_P, offsetof(struct GlobalObjectCollisionData, lll_seg7_collision_falling_wall), false, LOT_POINTER },
{ "lll_seg7_collision_floating_block", LVT_COLLISION_P, offsetof(struct GlobalObjectCollisionData, lll_seg7_collision_floating_block), false, LOT_POINTER },
{ "lll_seg7_collision_hexagonal_platform", LVT_COLLISION_P, offsetof(struct GlobalObjectCollisionData, lll_seg7_collision_hexagonal_platform), false, LOT_POINTER },
{ "lll_seg7_collision_inverted_pyramid", LVT_COLLISION_P, offsetof(struct GlobalObjectCollisionData, lll_seg7_collision_inverted_pyramid), false, LOT_POINTER },
{ "lll_seg7_collision_octagonal_moving_platform", LVT_COLLISION_P, offsetof(struct GlobalObjectCollisionData, lll_seg7_collision_octagonal_moving_platform), false, LOT_POINTER },
{ "lll_seg7_collision_pitoune", LVT_COLLISION_P, offsetof(struct GlobalObjectCollisionData, lll_seg7_collision_pitoune), false, LOT_POINTER },
{ "lll_seg7_collision_puzzle_piece", LVT_COLLISION_P, offsetof(struct GlobalObjectCollisionData, lll_seg7_collision_puzzle_piece), false, LOT_POINTER },
{ "lll_seg7_collision_rotating_fire_bars", LVT_COLLISION_P, offsetof(struct GlobalObjectCollisionData, lll_seg7_collision_rotating_fire_bars), false, LOT_POINTER },
{ "lll_seg7_collision_rotating_platform", LVT_COLLISION_P, offsetof(struct GlobalObjectCollisionData, lll_seg7_collision_rotating_platform), false, LOT_POINTER },
{ "lll_seg7_collision_sinking_pyramids", LVT_COLLISION_P, offsetof(struct GlobalObjectCollisionData, lll_seg7_collision_sinking_pyramids), false, LOT_POINTER },
{ "lll_seg7_collision_slow_tilting_platform", LVT_COLLISION_P, offsetof(struct GlobalObjectCollisionData, lll_seg7_collision_slow_tilting_platform), false, LOT_POINTER },
{ "lll_seg7_collision_wood_piece", LVT_COLLISION_P, offsetof(struct GlobalObjectCollisionData, lll_seg7_collision_wood_piece), false, LOT_POINTER },
{ "metal_box_seg8_collision_08024C28", LVT_COLLISION_P, offsetof(struct GlobalObjectCollisionData, metal_box_seg8_collision_08024C28), false, LOT_POINTER },
{ "penguin_seg5_collision_05008B88", LVT_COLLISION_P, offsetof(struct GlobalObjectCollisionData, penguin_seg5_collision_05008B88), false, LOT_POINTER },
{ "poundable_pole_collision_06002490", LVT_COLLISION_P, offsetof(struct GlobalObjectCollisionData, poundable_pole_collision_06002490), false, LOT_POINTER },
{ "purple_switch_seg8_collision_0800C7A8", LVT_COLLISION_P, offsetof(struct GlobalObjectCollisionData, purple_switch_seg8_collision_0800C7A8), false, LOT_POINTER },
{ "rr_seg7_collision_donut_platform", LVT_COLLISION_P, offsetof(struct GlobalObjectCollisionData, rr_seg7_collision_donut_platform), false, LOT_POINTER },
{ "rr_seg7_collision_elevator_platform", LVT_COLLISION_P, offsetof(struct GlobalObjectCollisionData, rr_seg7_collision_elevator_platform), false, LOT_POINTER },
{ "rr_seg7_collision_pendulum", LVT_COLLISION_P, offsetof(struct GlobalObjectCollisionData, rr_seg7_collision_pendulum), false, LOT_POINTER },
{ "rr_seg7_collision_rotating_platform_with_fire", LVT_COLLISION_P, offsetof(struct GlobalObjectCollisionData, rr_seg7_collision_rotating_platform_with_fire), false, LOT_POINTER },
{ "sl_seg7_collision_pound_explodes", LVT_COLLISION_P, offsetof(struct GlobalObjectCollisionData, sl_seg7_collision_pound_explodes), false, LOT_POINTER },
{ "sl_seg7_collision_sliding_snow_mound", LVT_COLLISION_P, offsetof(struct GlobalObjectCollisionData, sl_seg7_collision_sliding_snow_mound), false, LOT_POINTER },
{ "springboard_collision_05001A28", LVT_COLLISION_P, offsetof(struct GlobalObjectCollisionData, springboard_collision_05001A28), false, LOT_POINTER },
{ "ssl_seg7_collision_0702808C", LVT_COLLISION_P, offsetof(struct GlobalObjectCollisionData, ssl_seg7_collision_0702808C), false, LOT_POINTER },
{ "ssl_seg7_collision_grindel", LVT_COLLISION_P, offsetof(struct GlobalObjectCollisionData, ssl_seg7_collision_grindel), false, LOT_POINTER },
{ "ssl_seg7_collision_pyramid_elevator", LVT_COLLISION_P, offsetof(struct GlobalObjectCollisionData, ssl_seg7_collision_pyramid_elevator), false, LOT_POINTER },
{ "ssl_seg7_collision_pyramid_top", LVT_COLLISION_P, offsetof(struct GlobalObjectCollisionData, ssl_seg7_collision_pyramid_top), false, LOT_POINTER },
{ "ssl_seg7_collision_spindel", LVT_COLLISION_P, offsetof(struct GlobalObjectCollisionData, ssl_seg7_collision_spindel), false, LOT_POINTER },
{ "ssl_seg7_collision_tox_box", LVT_COLLISION_P, offsetof(struct GlobalObjectCollisionData, ssl_seg7_collision_tox_box), false, LOT_POINTER },
{ "thi_seg7_collision_top_trap", LVT_COLLISION_P, offsetof(struct GlobalObjectCollisionData, thi_seg7_collision_top_trap), false, LOT_POINTER },
{ "thwomp_seg5_collision_0500B7D0", LVT_COLLISION_P, offsetof(struct GlobalObjectCollisionData, thwomp_seg5_collision_0500B7D0), false, LOT_POINTER },
{ "thwomp_seg5_collision_0500B92C", LVT_COLLISION_P, offsetof(struct GlobalObjectCollisionData, thwomp_seg5_collision_0500B92C), false, LOT_POINTER },
{ "ttc_seg7_collision_clock_main_rotation", LVT_COLLISION_P, offsetof(struct GlobalObjectCollisionData, ttc_seg7_collision_clock_main_rotation), false, LOT_POINTER },
{ "ttc_seg7_collision_clock_pendulum", LVT_COLLISION_P, offsetof(struct GlobalObjectCollisionData, ttc_seg7_collision_clock_pendulum), false, LOT_POINTER },
{ "ttc_seg7_collision_clock_platform", LVT_COLLISION_P, offsetof(struct GlobalObjectCollisionData, ttc_seg7_collision_clock_platform), false, LOT_POINTER },
{ "ttc_seg7_collision_rotating_clock_platform2", LVT_COLLISION_P, offsetof(struct GlobalObjectCollisionData, ttc_seg7_collision_rotating_clock_platform2), false, LOT_POINTER },
{ "ttc_seg7_collision_sliding_surface", LVT_COLLISION_P, offsetof(struct GlobalObjectCollisionData, ttc_seg7_collision_sliding_surface), false, LOT_POINTER },
{ "ttm_seg7_collision_pitoune_2", LVT_COLLISION_P, offsetof(struct GlobalObjectCollisionData, ttm_seg7_collision_pitoune_2), false, LOT_POINTER },
{ "ttm_seg7_collision_podium_warp", LVT_COLLISION_P, offsetof(struct GlobalObjectCollisionData, ttm_seg7_collision_podium_warp), false, LOT_POINTER },
{ "ttm_seg7_collision_ukiki_cage", LVT_COLLISION_P, offsetof(struct GlobalObjectCollisionData, ttm_seg7_collision_ukiki_cage), false, LOT_POINTER },
{ "warp_pipe_seg3_collision_03009AC8", LVT_COLLISION_P, offsetof(struct GlobalObjectCollisionData, warp_pipe_seg3_collision_03009AC8), false, LOT_POINTER },
{ "wdw_seg7_collision_arrow_lift", LVT_COLLISION_P, offsetof(struct GlobalObjectCollisionData, wdw_seg7_collision_arrow_lift), false, LOT_POINTER },
{ "wdw_seg7_collision_express_elevator_platform", LVT_COLLISION_P, offsetof(struct GlobalObjectCollisionData, wdw_seg7_collision_express_elevator_platform), false, LOT_POINTER },
{ "wdw_seg7_collision_rect_floating_platform", LVT_COLLISION_P, offsetof(struct GlobalObjectCollisionData, wdw_seg7_collision_rect_floating_platform), false, LOT_POINTER },
{ "wdw_seg7_collision_square_floating_platform", LVT_COLLISION_P, offsetof(struct GlobalObjectCollisionData, wdw_seg7_collision_square_floating_platform), false, LOT_POINTER },
{ "wf_seg7_collision_breakable_wall", LVT_COLLISION_P, offsetof(struct GlobalObjectCollisionData, wf_seg7_collision_breakable_wall), false, LOT_POINTER },
{ "wf_seg7_collision_breakable_wall_2", LVT_COLLISION_P, offsetof(struct GlobalObjectCollisionData, wf_seg7_collision_breakable_wall_2), false, LOT_POINTER },
{ "wf_seg7_collision_bullet_bill_cannon", LVT_COLLISION_P, offsetof(struct GlobalObjectCollisionData, wf_seg7_collision_bullet_bill_cannon), false, LOT_POINTER },
{ "wf_seg7_collision_clocklike_rotation", LVT_COLLISION_P, offsetof(struct GlobalObjectCollisionData, wf_seg7_collision_clocklike_rotation), false, LOT_POINTER },
{ "wf_seg7_collision_kickable_board", LVT_COLLISION_P, offsetof(struct GlobalObjectCollisionData, wf_seg7_collision_kickable_board), false, LOT_POINTER },
{ "wf_seg7_collision_large_bomp", LVT_COLLISION_P, offsetof(struct GlobalObjectCollisionData, wf_seg7_collision_large_bomp), false, LOT_POINTER },
{ "wf_seg7_collision_platform", LVT_COLLISION_P, offsetof(struct GlobalObjectCollisionData, wf_seg7_collision_platform), false, LOT_POINTER },
{ "wf_seg7_collision_sliding_brick_platform", LVT_COLLISION_P, offsetof(struct GlobalObjectCollisionData, wf_seg7_collision_sliding_brick_platform), false, LOT_POINTER },
{ "wf_seg7_collision_small_bomp", LVT_COLLISION_P, offsetof(struct GlobalObjectCollisionData, wf_seg7_collision_small_bomp), false, LOT_POINTER },
{ "wf_seg7_collision_tower", LVT_COLLISION_P, offsetof(struct GlobalObjectCollisionData, wf_seg7_collision_tower), false, LOT_POINTER },
{ "wf_seg7_collision_tower_door", LVT_COLLISION_P, offsetof(struct GlobalObjectCollisionData, wf_seg7_collision_tower_door), false, LOT_POINTER },
{ "whomp_seg6_collision_06020A0C", LVT_COLLISION_P, offsetof(struct GlobalObjectCollisionData, whomp_seg6_collision_06020A0C), false, LOT_POINTER },
{ "wooden_signpost_seg3_collision_0302DD80", LVT_COLLISION_P, offsetof(struct GlobalObjectCollisionData, wooden_signpost_seg3_collision_0302DD80), false, LOT_POINTER },
};
#define LUA_GLOBAL_TEXTURES_FIELD_COUNT 7
static struct LuaObjectField sGlobalTexturesFields[LUA_GLOBAL_TEXTURES_FIELD_COUNT] = {
{ "arrow_down", LVT_COBJECT, offsetof(struct GlobalTextures, arrow_down), true, LOT_TEXTUREINFO },
@ -571,7 +675,7 @@ static struct LuaObjectField sNetworkPlayerFields[LUA_NETWORK_PLAYER_FIELD_COUNT
{ "type", LVT_U8, offsetof(struct NetworkPlayer, type), true, LOT_NONE },
};
#define LUA_OBJECT_FIELD_COUNT 749
#define LUA_OBJECT_FIELD_COUNT 750
static struct LuaObjectField sObjectFields[LUA_OBJECT_FIELD_COUNT] = {
{ "activeFlags", LVT_S16, offsetof(struct Object, activeFlags), false, LOT_NONE },
{ "areaTimer", LVT_U32, offsetof(struct Object, areaTimer), false, LOT_NONE },
@ -584,7 +688,7 @@ static struct LuaObjectField sObjectFields[LUA_OBJECT_FIELD_COUNT] = {
{ "bhvStackIndex", LVT_U32, offsetof(struct Object, bhvStackIndex), false, LOT_NONE },
{ "collidedObjInteractTypes", LVT_U32, offsetof(struct Object, collidedObjInteractTypes), false, LOT_NONE },
// { "collidedObjs", LOT_???, offsetof(struct Object, collidedObjs), false, LOT_??? }, <--- UNIMPLEMENTED
// { "collisionData", LVT_???, offsetof(struct Object, collisionData), false, LOT_??? }, <--- UNIMPLEMENTED
{ "collisionData", LVT_COLLISION_P, offsetof(struct Object, collisionData), false, LOT_POINTER },
{ "coopFlags", LVT_U8, offsetof(struct Object, coopFlags), true, LOT_NONE },
{ "curBhvCommand", LVT_BEHAVIORSCRIPT_P, offsetof(struct Object, curBhvCommand), true, LOT_POINTER },
{ "globalPlayerIndex", LVT_U8, offsetof(struct Object, globalPlayerIndex), false, LOT_NONE },
@ -1569,59 +1673,60 @@ static struct LuaObjectField sstruct802A1230Fields[LUA_STRUCT802_A1230_FIELD_COU
};
struct LuaObjectTable sLuaObjectAutogenTable[LOT_AUTOGEN_MAX - LOT_AUTOGEN_MIN] = {
{ LOT_ANIMINFO, sAnimInfoFields, LUA_ANIM_INFO_FIELD_COUNT },
{ LOT_ANIMATION, sAnimationFields, LUA_ANIMATION_FIELD_COUNT },
{ LOT_AREA, sAreaFields, LUA_AREA_FIELD_COUNT },
{ LOT_BULLYCOLLISIONDATA, sBullyCollisionDataFields, LUA_BULLY_COLLISION_DATA_FIELD_COUNT },
{ LOT_CAMERA, sCameraFields, LUA_CAMERA_FIELD_COUNT },
{ LOT_CAMERAFOVSTATUS, sCameraFOVStatusFields, LUA_CAMERA_FOVSTATUS_FIELD_COUNT },
{ LOT_CAMERASTOREDINFO, sCameraStoredInfoFields, LUA_CAMERA_STORED_INFO_FIELD_COUNT },
{ LOT_CAMERATRIGGER, sCameraTriggerFields, LUA_CAMERA_TRIGGER_FIELD_COUNT },
{ LOT_CHAINSEGMENT, sChainSegmentFields, LUA_CHAIN_SEGMENT_FIELD_COUNT },
{ LOT_CHARACTER, sCharacterFields, LUA_CHARACTER_FIELD_COUNT },
{ LOT_CONTROLLER, sControllerFields, LUA_CONTROLLER_FIELD_COUNT },
{ LOT_CUTSCENE, sCutsceneFields, LUA_CUTSCENE_FIELD_COUNT },
{ LOT_CUTSCENESPLINEPOINT, sCutsceneSplinePointFields, LUA_CUTSCENE_SPLINE_POINT_FIELD_COUNT },
{ LOT_CUTSCENEVARIABLE, sCutsceneVariableFields, LUA_CUTSCENE_VARIABLE_FIELD_COUNT },
{ LOT_FLOORGEOMETRY, sFloorGeometryFields, LUA_FLOOR_GEOMETRY_FIELD_COUNT },
{ LOT_GLOBALOBJECTANIMATIONS, sGlobalObjectAnimationsFields, LUA_GLOBAL_OBJECT_ANIMATIONS_FIELD_COUNT },
{ LOT_GLOBALTEXTURES, sGlobalTexturesFields, LUA_GLOBAL_TEXTURES_FIELD_COUNT },
{ LOT_GRAPHNODE, sGraphNodeFields, LUA_GRAPH_NODE_FIELD_COUNT },
{ LOT_GRAPHNODEOBJECT, sGraphNodeObjectFields, LUA_GRAPH_NODE_OBJECT_FIELD_COUNT },
{ LOT_GRAPHNODE_802A45E4, sGraphNode_802A45E4Fields, LUA_GRAPH_NODE_802_A45_E4_FIELD_COUNT },
{ LOT_HANDHELDSHAKEPOINT, sHandheldShakePointFields, LUA_HANDHELD_SHAKE_POINT_FIELD_COUNT },
{ LOT_INSTANTWARP, sInstantWarpFields, LUA_INSTANT_WARP_FIELD_COUNT },
{ LOT_LAKITUSTATE, sLakituStateFields, LUA_LAKITU_STATE_FIELD_COUNT },
{ LOT_LINEARTRANSITIONPOINT, sLinearTransitionPointFields, LUA_LINEAR_TRANSITION_POINT_FIELD_COUNT },
{ LOT_MARIOANIMATION, sMarioAnimationFields, LUA_MARIO_ANIMATION_FIELD_COUNT },
{ LOT_MARIOBODYSTATE, sMarioBodyStateFields, LUA_MARIO_BODY_STATE_FIELD_COUNT },
{ LOT_MARIOSTATE, sMarioStateFields, LUA_MARIO_STATE_FIELD_COUNT },
{ LOT_MODETRANSITIONINFO, sModeTransitionInfoFields, LUA_MODE_TRANSITION_INFO_FIELD_COUNT },
{ LOT_NETWORKPLAYER, sNetworkPlayerFields, LUA_NETWORK_PLAYER_FIELD_COUNT },
{ LOT_OBJECT, sObjectFields, LUA_OBJECT_FIELD_COUNT },
{ LOT_OBJECTHITBOX, sObjectHitboxFields, LUA_OBJECT_HITBOX_FIELD_COUNT },
{ LOT_OBJECTNODE, sObjectNodeFields, LUA_OBJECT_NODE_FIELD_COUNT },
{ LOT_OBJECTWARPNODE, sObjectWarpNodeFields, LUA_OBJECT_WARP_NODE_FIELD_COUNT },
{ LOT_OFFSETSIZEPAIR, sOffsetSizePairFields, LUA_OFFSET_SIZE_PAIR_FIELD_COUNT },
{ LOT_PARALLELTRACKINGPOINT, sParallelTrackingPointFields, LUA_PARALLEL_TRACKING_POINT_FIELD_COUNT },
{ LOT_PLAYERCAMERASTATE, sPlayerCameraStateFields, LUA_PLAYER_CAMERA_STATE_FIELD_COUNT },
{ LOT_PLAYERGEOMETRY, sPlayerGeometryFields, LUA_PLAYER_GEOMETRY_FIELD_COUNT },
{ LOT_RAYINTERSECTIONINFO, sRayIntersectionInfoFields, LUA_RAY_INTERSECTION_INFO_FIELD_COUNT },
{ LOT_SOUNDSTATE, sSoundStateFields, LUA_SOUND_STATE_FIELD_COUNT },
{ LOT_SPAWNINFO, sSpawnInfoFields, LUA_SPAWN_INFO_FIELD_COUNT },
{ LOT_SPAWNPARTICLESINFO, sSpawnParticlesInfoFields, LUA_SPAWN_PARTICLES_INFO_FIELD_COUNT },
{ LOT_STRUCT802A272C, sStruct802A272CFields, LUA_STRUCT802_A272_C_FIELD_COUNT },
{ LOT_SURFACE, sSurfaceFields, LUA_SURFACE_FIELD_COUNT },
{ LOT_TEXTUREINFO, sTextureInfoFields, LUA_TEXTURE_INFO_FIELD_COUNT },
{ LOT_TRANSITIONINFO, sTransitionInfoFields, LUA_TRANSITION_INFO_FIELD_COUNT },
{ LOT_WALLCOLLISIONDATA, sWallCollisionDataFields, LUA_WALL_COLLISION_DATA_FIELD_COUNT },
{ LOT_WARPNODE, sWarpNodeFields, LUA_WARP_NODE_FIELD_COUNT },
{ LOT_WARPTRANSITION, sWarpTransitionFields, LUA_WARP_TRANSITION_FIELD_COUNT },
{ LOT_WARPTRANSITIONDATA, sWarpTransitionDataFields, LUA_WARP_TRANSITION_DATA_FIELD_COUNT },
{ LOT_WATERDROPLETPARAMS, sWaterDropletParamsFields, LUA_WATER_DROPLET_PARAMS_FIELD_COUNT },
{ LOT_WAYPOINT, sWaypointFields, LUA_WAYPOINT_FIELD_COUNT },
{ LOT_WHIRLPOOL, sWhirlpoolFields, LUA_WHIRLPOOL_FIELD_COUNT },
{ LOT_STRUCT802A1230, sstruct802A1230Fields, LUA_STRUCT802_A1230_FIELD_COUNT },
{ LOT_ANIMINFO, sAnimInfoFields, LUA_ANIM_INFO_FIELD_COUNT },
{ LOT_ANIMATION, sAnimationFields, LUA_ANIMATION_FIELD_COUNT },
{ LOT_AREA, sAreaFields, LUA_AREA_FIELD_COUNT },
{ LOT_BULLYCOLLISIONDATA, sBullyCollisionDataFields, LUA_BULLY_COLLISION_DATA_FIELD_COUNT },
{ LOT_CAMERA, sCameraFields, LUA_CAMERA_FIELD_COUNT },
{ LOT_CAMERAFOVSTATUS, sCameraFOVStatusFields, LUA_CAMERA_FOVSTATUS_FIELD_COUNT },
{ LOT_CAMERASTOREDINFO, sCameraStoredInfoFields, LUA_CAMERA_STORED_INFO_FIELD_COUNT },
{ LOT_CAMERATRIGGER, sCameraTriggerFields, LUA_CAMERA_TRIGGER_FIELD_COUNT },
{ LOT_CHAINSEGMENT, sChainSegmentFields, LUA_CHAIN_SEGMENT_FIELD_COUNT },
{ LOT_CHARACTER, sCharacterFields, LUA_CHARACTER_FIELD_COUNT },
{ LOT_CONTROLLER, sControllerFields, LUA_CONTROLLER_FIELD_COUNT },
{ LOT_CUTSCENE, sCutsceneFields, LUA_CUTSCENE_FIELD_COUNT },
{ LOT_CUTSCENESPLINEPOINT, sCutsceneSplinePointFields, LUA_CUTSCENE_SPLINE_POINT_FIELD_COUNT },
{ LOT_CUTSCENEVARIABLE, sCutsceneVariableFields, LUA_CUTSCENE_VARIABLE_FIELD_COUNT },
{ LOT_FLOORGEOMETRY, sFloorGeometryFields, LUA_FLOOR_GEOMETRY_FIELD_COUNT },
{ LOT_GLOBALOBJECTANIMATIONS, sGlobalObjectAnimationsFields, LUA_GLOBAL_OBJECT_ANIMATIONS_FIELD_COUNT },
{ LOT_GLOBALOBJECTCOLLISIONDATA, sGlobalObjectCollisionDataFields, LUA_GLOBAL_OBJECT_COLLISION_DATA_FIELD_COUNT },
{ LOT_GLOBALTEXTURES, sGlobalTexturesFields, LUA_GLOBAL_TEXTURES_FIELD_COUNT },
{ LOT_GRAPHNODE, sGraphNodeFields, LUA_GRAPH_NODE_FIELD_COUNT },
{ LOT_GRAPHNODEOBJECT, sGraphNodeObjectFields, LUA_GRAPH_NODE_OBJECT_FIELD_COUNT },
{ LOT_GRAPHNODE_802A45E4, sGraphNode_802A45E4Fields, LUA_GRAPH_NODE_802_A45_E4_FIELD_COUNT },
{ LOT_HANDHELDSHAKEPOINT, sHandheldShakePointFields, LUA_HANDHELD_SHAKE_POINT_FIELD_COUNT },
{ LOT_INSTANTWARP, sInstantWarpFields, LUA_INSTANT_WARP_FIELD_COUNT },
{ LOT_LAKITUSTATE, sLakituStateFields, LUA_LAKITU_STATE_FIELD_COUNT },
{ LOT_LINEARTRANSITIONPOINT, sLinearTransitionPointFields, LUA_LINEAR_TRANSITION_POINT_FIELD_COUNT },
{ LOT_MARIOANIMATION, sMarioAnimationFields, LUA_MARIO_ANIMATION_FIELD_COUNT },
{ LOT_MARIOBODYSTATE, sMarioBodyStateFields, LUA_MARIO_BODY_STATE_FIELD_COUNT },
{ LOT_MARIOSTATE, sMarioStateFields, LUA_MARIO_STATE_FIELD_COUNT },
{ LOT_MODETRANSITIONINFO, sModeTransitionInfoFields, LUA_MODE_TRANSITION_INFO_FIELD_COUNT },
{ LOT_NETWORKPLAYER, sNetworkPlayerFields, LUA_NETWORK_PLAYER_FIELD_COUNT },
{ LOT_OBJECT, sObjectFields, LUA_OBJECT_FIELD_COUNT },
{ LOT_OBJECTHITBOX, sObjectHitboxFields, LUA_OBJECT_HITBOX_FIELD_COUNT },
{ LOT_OBJECTNODE, sObjectNodeFields, LUA_OBJECT_NODE_FIELD_COUNT },
{ LOT_OBJECTWARPNODE, sObjectWarpNodeFields, LUA_OBJECT_WARP_NODE_FIELD_COUNT },
{ LOT_OFFSETSIZEPAIR, sOffsetSizePairFields, LUA_OFFSET_SIZE_PAIR_FIELD_COUNT },
{ LOT_PARALLELTRACKINGPOINT, sParallelTrackingPointFields, LUA_PARALLEL_TRACKING_POINT_FIELD_COUNT },
{ LOT_PLAYERCAMERASTATE, sPlayerCameraStateFields, LUA_PLAYER_CAMERA_STATE_FIELD_COUNT },
{ LOT_PLAYERGEOMETRY, sPlayerGeometryFields, LUA_PLAYER_GEOMETRY_FIELD_COUNT },
{ LOT_RAYINTERSECTIONINFO, sRayIntersectionInfoFields, LUA_RAY_INTERSECTION_INFO_FIELD_COUNT },
{ LOT_SOUNDSTATE, sSoundStateFields, LUA_SOUND_STATE_FIELD_COUNT },
{ LOT_SPAWNINFO, sSpawnInfoFields, LUA_SPAWN_INFO_FIELD_COUNT },
{ LOT_SPAWNPARTICLESINFO, sSpawnParticlesInfoFields, LUA_SPAWN_PARTICLES_INFO_FIELD_COUNT },
{ LOT_STRUCT802A272C, sStruct802A272CFields, LUA_STRUCT802_A272_C_FIELD_COUNT },
{ LOT_SURFACE, sSurfaceFields, LUA_SURFACE_FIELD_COUNT },
{ LOT_TEXTUREINFO, sTextureInfoFields, LUA_TEXTURE_INFO_FIELD_COUNT },
{ LOT_TRANSITIONINFO, sTransitionInfoFields, LUA_TRANSITION_INFO_FIELD_COUNT },
{ LOT_WALLCOLLISIONDATA, sWallCollisionDataFields, LUA_WALL_COLLISION_DATA_FIELD_COUNT },
{ LOT_WARPNODE, sWarpNodeFields, LUA_WARP_NODE_FIELD_COUNT },
{ LOT_WARPTRANSITION, sWarpTransitionFields, LUA_WARP_TRANSITION_FIELD_COUNT },
{ LOT_WARPTRANSITIONDATA, sWarpTransitionDataFields, LUA_WARP_TRANSITION_DATA_FIELD_COUNT },
{ LOT_WATERDROPLETPARAMS, sWaterDropletParamsFields, LUA_WATER_DROPLET_PARAMS_FIELD_COUNT },
{ LOT_WAYPOINT, sWaypointFields, LUA_WAYPOINT_FIELD_COUNT },
{ LOT_WHIRLPOOL, sWhirlpoolFields, LUA_WHIRLPOOL_FIELD_COUNT },
{ LOT_STRUCT802A1230, sstruct802A1230Fields, LUA_STRUCT802_A1230_FIELD_COUNT },
};
struct LuaObjectField* smlua_get_object_field_autogen(u16 lot, const char* key) {

View File

@ -21,6 +21,7 @@ enum LuaObjectAutogenType {
LOT_CUTSCENEVARIABLE,
LOT_FLOORGEOMETRY,
LOT_GLOBALOBJECTANIMATIONS,
LOT_GLOBALOBJECTCOLLISIONDATA,
LOT_GLOBALTEXTURES,
LOT_GRAPHNODE,
LOT_GRAPHNODEOBJECT,

View File

@ -0,0 +1,162 @@
#include "types.h"
#include "src/engine/surface_collision.h"
#include "smlua.h"
#include "smlua_collision_utils.h"
#include "pc/debuglog.h"
// actors
#include "actors/common0.h"
#include "actors/common1.h"
#include "actors/custom0.h"
#include "actors/group1.h"
#include "actors/group2.h"
#include "actors/group3.h"
#include "actors/group4.h"
#include "actors/group5.h"
#include "actors/group6.h"
#include "actors/group7.h"
#include "actors/group8.h"
#include "actors/group9.h"
#include "actors/group10.h"
#include "actors/group11.h"
#include "actors/group12.h"
#include "actors/group13.h"
#include "actors/group14.h"
#include "actors/group15.h"
#include "actors/group16.h"
#include "actors/group17.h"
#include "actors/zcustom0.h"
// levels
#include "levels/bbh/header.h"
#include "levels/castle_inside/header.h"
#include "levels/hmc/header.h"
#include "levels/ssl/header.h"
#include "levels/bob/header.h"
#include "levels/sl/header.h"
#include "levels/wdw/header.h"
#include "levels/jrb/header.h"
#include "levels/thi/header.h"
#include "levels/ttc/header.h"
#include "levels/rr/header.h"
#include "levels/castle_grounds/header.h"
#include "levels/bitdw/header.h"
#include "levels/lll/header.h"
#include "levels/sa/header.h"
#include "levels/bitfs/header.h"
#include "levels/ddd/header.h"
#include "levels/wf/header.h"
#include "levels/bowser_2/header.h"
#include "levels/ttm/header.h"
struct GlobalObjectCollisionData gGlobalObjectCollisionData = {
.bbh_seg7_collision_coffin = (Collision*) bbh_seg7_collision_coffin,
.bbh_seg7_collision_haunted_bookshelf = (Collision*) bbh_seg7_collision_haunted_bookshelf,
.bbh_seg7_collision_merry_go_round = (Collision*) bbh_seg7_collision_merry_go_round,
.bbh_seg7_collision_mesh_elevator = (Collision*) bbh_seg7_collision_mesh_elevator,
.bbh_seg7_collision_staircase_step = (Collision*) bbh_seg7_collision_staircase_step,
.bbh_seg7_collision_tilt_floor_platform = (Collision*) bbh_seg7_collision_tilt_floor_platform,
.bitdw_seg7_collision_moving_pyramid = (Collision*) bitdw_seg7_collision_moving_pyramid,
.bitfs_seg7_collision_inverted_pyramid = (Collision*) bitfs_seg7_collision_inverted_pyramid,
.bitfs_seg7_collision_sinking_cage_platform = (Collision*) bitfs_seg7_collision_sinking_cage_platform,
.bitfs_seg7_collision_sinking_platform = (Collision*) bitfs_seg7_collision_sinking_platform,
.bitfs_seg7_collision_squishable_platform = (Collision*) bitfs_seg7_collision_squishable_platform,
.blue_coin_switch_seg8_collision_08000E98 = (Collision*) blue_coin_switch_seg8_collision_08000E98,
.bob_seg7_collision_chain_chomp_gate = (Collision*) bob_seg7_collision_chain_chomp_gate,
.bowser_2_seg7_collision_tilting_platform = (Collision*) bowser_2_seg7_collision_tilting_platform,
.breakable_box_seg8_collision_08012D70 = (Collision*) breakable_box_seg8_collision_08012D70,
.cannon_lid_seg8_collision_08004950 = (Collision*) cannon_lid_seg8_collision_08004950,
.capswitch_collision_050033D0 = (Collision*) capswitch_collision_050033D0,
.capswitch_collision_05003448 = (Collision*) capswitch_collision_05003448,
.castle_grounds_seg7_collision_cannon_grill = (Collision*) castle_grounds_seg7_collision_cannon_grill,
.castle_grounds_seg7_collision_moat_grills = (Collision*) castle_grounds_seg7_collision_moat_grills,
.checkerboard_platform_seg8_collision_0800D710 = (Collision*) checkerboard_platform_seg8_collision_0800D710,
.ddd_seg7_collision_bowser_sub_door = (Collision*) ddd_seg7_collision_bowser_sub_door,
.ddd_seg7_collision_submarine = (Collision*) ddd_seg7_collision_submarine,
.door_seg3_collision_0301CE78 = (Collision*) door_seg3_collision_0301CE78,
.dorrie_seg6_collision_0600F644 = (Collision*) dorrie_seg6_collision_0600F644,
.exclamation_box_outline_seg8_collision_08025F78 = (Collision*) exclamation_box_outline_seg8_collision_08025F78,
.hmc_seg7_collision_controllable_platform = (Collision*) hmc_seg7_collision_controllable_platform,
.hmc_seg7_collision_controllable_platform_sub = (Collision*) hmc_seg7_collision_controllable_platform_sub,
.hmc_seg7_collision_elevator = (Collision*) hmc_seg7_collision_elevator,
.inside_castle_seg7_collision_floor_trap = (Collision*) inside_castle_seg7_collision_floor_trap,
.inside_castle_seg7_collision_star_door = (Collision*) inside_castle_seg7_collision_star_door,
.inside_castle_seg7_collision_water_level_pillar = (Collision*) inside_castle_seg7_collision_water_level_pillar,
.jrb_seg7_collision_floating_box = (Collision*) jrb_seg7_collision_floating_box,
.jrb_seg7_collision_floating_platform = (Collision*) jrb_seg7_collision_floating_platform,
.jrb_seg7_collision_in_sunken_ship_2 = (Collision*) jrb_seg7_collision_in_sunken_ship_2,
.jrb_seg7_collision_in_sunken_ship_3 = (Collision*) jrb_seg7_collision_in_sunken_ship_3,
.jrb_seg7_collision_in_sunken_ship = (Collision*) jrb_seg7_collision_in_sunken_ship,
.jrb_seg7_collision_pillar_base = (Collision*) jrb_seg7_collision_pillar_base,
.jrb_seg7_collision_rock_solid = (Collision*) jrb_seg7_collision_rock_solid,
.lll_hexagonal_mesh_seg3_collision_0301CECC = (Collision*) lll_hexagonal_mesh_seg3_collision_0301CECC,
.lll_seg7_collision_drawbridge = (Collision*) lll_seg7_collision_drawbridge,
.lll_seg7_collision_falling_wall = (Collision*) lll_seg7_collision_falling_wall,
.lll_seg7_collision_floating_block = (Collision*) lll_seg7_collision_floating_block,
.lll_seg7_collision_hexagonal_platform = (Collision*) lll_seg7_collision_hexagonal_platform,
.lll_seg7_collision_inverted_pyramid = (Collision*) lll_seg7_collision_inverted_pyramid,
.lll_seg7_collision_octagonal_moving_platform = (Collision*) lll_seg7_collision_octagonal_moving_platform,
.lll_seg7_collision_pitoune = (Collision*) lll_seg7_collision_pitoune,
.lll_seg7_collision_puzzle_piece = (Collision*) lll_seg7_collision_puzzle_piece,
.lll_seg7_collision_rotating_fire_bars = (Collision*) lll_seg7_collision_rotating_fire_bars,
.lll_seg7_collision_rotating_platform = (Collision*) lll_seg7_collision_rotating_platform,
.lll_seg7_collision_sinking_pyramids = (Collision*) lll_seg7_collision_sinking_pyramids,
.lll_seg7_collision_slow_tilting_platform = (Collision*) lll_seg7_collision_slow_tilting_platform,
.lll_seg7_collision_wood_piece = (Collision*) lll_seg7_collision_wood_piece,
.metal_box_seg8_collision_08024C28 = (Collision*) metal_box_seg8_collision_08024C28,
.penguin_seg5_collision_05008B88 = (Collision*) penguin_seg5_collision_05008B88,
.poundable_pole_collision_06002490 = (Collision*) poundable_pole_collision_06002490,
.purple_switch_seg8_collision_0800C7A8 = (Collision*) purple_switch_seg8_collision_0800C7A8,
.rr_seg7_collision_donut_platform = (Collision*) rr_seg7_collision_donut_platform,
.rr_seg7_collision_elevator_platform = (Collision*) rr_seg7_collision_elevator_platform,
.rr_seg7_collision_pendulum = (Collision*) rr_seg7_collision_pendulum,
.rr_seg7_collision_rotating_platform_with_fire = (Collision*) rr_seg7_collision_rotating_platform_with_fire,
.sl_seg7_collision_pound_explodes = (Collision*) sl_seg7_collision_pound_explodes,
.sl_seg7_collision_sliding_snow_mound = (Collision*) sl_seg7_collision_sliding_snow_mound,
.springboard_collision_05001A28 = (Collision*) springboard_collision_05001A28,
.ssl_seg7_collision_0702808C = (Collision*) ssl_seg7_collision_0702808C,
.ssl_seg7_collision_grindel = (Collision*) ssl_seg7_collision_grindel,
.ssl_seg7_collision_pyramid_elevator = (Collision*) ssl_seg7_collision_pyramid_elevator,
.ssl_seg7_collision_pyramid_top = (Collision*) ssl_seg7_collision_pyramid_top,
.ssl_seg7_collision_spindel = (Collision*) ssl_seg7_collision_spindel,
.ssl_seg7_collision_tox_box = (Collision*) ssl_seg7_collision_tox_box,
.thi_seg7_collision_top_trap = (Collision*) thi_seg7_collision_top_trap,
.thwomp_seg5_collision_0500B7D0 = (Collision*) thwomp_seg5_collision_0500B7D0,
.thwomp_seg5_collision_0500B92C = (Collision*) thwomp_seg5_collision_0500B92C,
.ttc_seg7_collision_clock_main_rotation = (Collision*) ttc_seg7_collision_clock_main_rotation,
.ttc_seg7_collision_clock_pendulum = (Collision*) ttc_seg7_collision_clock_pendulum,
.ttc_seg7_collision_clock_platform = (Collision*) ttc_seg7_collision_clock_platform,
.ttc_seg7_collision_rotating_clock_platform2 = (Collision*) ttc_seg7_collision_rotating_clock_platform2,
.ttc_seg7_collision_sliding_surface = (Collision*) ttc_seg7_collision_sliding_surface,
.ttm_seg7_collision_pitoune_2 = (Collision*) ttm_seg7_collision_pitoune_2,
.ttm_seg7_collision_podium_warp = (Collision*) ttm_seg7_collision_podium_warp,
.ttm_seg7_collision_ukiki_cage = (Collision*) ttm_seg7_collision_ukiki_cage,
.warp_pipe_seg3_collision_03009AC8 = (Collision*) warp_pipe_seg3_collision_03009AC8,
.wdw_seg7_collision_arrow_lift = (Collision*) wdw_seg7_collision_arrow_lift,
.wdw_seg7_collision_express_elevator_platform = (Collision*) wdw_seg7_collision_express_elevator_platform,
.wdw_seg7_collision_rect_floating_platform = (Collision*) wdw_seg7_collision_rect_floating_platform,
.wdw_seg7_collision_square_floating_platform = (Collision*) wdw_seg7_collision_square_floating_platform,
.wf_seg7_collision_breakable_wall_2 = (Collision*) wf_seg7_collision_breakable_wall_2,
.wf_seg7_collision_breakable_wall = (Collision*) wf_seg7_collision_breakable_wall,
.wf_seg7_collision_bullet_bill_cannon = (Collision*) wf_seg7_collision_bullet_bill_cannon,
.wf_seg7_collision_clocklike_rotation = (Collision*) wf_seg7_collision_clocklike_rotation,
.wf_seg7_collision_kickable_board = (Collision*) wf_seg7_collision_kickable_board,
.wf_seg7_collision_large_bomp = (Collision*) wf_seg7_collision_large_bomp,
.wf_seg7_collision_platform = (Collision*) wf_seg7_collision_platform,
.wf_seg7_collision_sliding_brick_platform = (Collision*) wf_seg7_collision_sliding_brick_platform,
.wf_seg7_collision_small_bomp = (Collision*) wf_seg7_collision_small_bomp,
.wf_seg7_collision_tower = (Collision*) wf_seg7_collision_tower,
.wf_seg7_collision_tower_door = (Collision*) wf_seg7_collision_tower_door,
.whomp_seg6_collision_06020A0C = (Collision*) whomp_seg6_collision_06020A0C,
.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 endX, f32 endY, f32 endZ) {
static struct RayIntersectionInfo info = { 0 };
Vec3f orig = { startX, startY, startZ };
Vec3f end = { endX, endY, endZ };
find_surface_on_ray(orig, end, &info.surface, info.hitPos);
return &info;
}

View File

@ -0,0 +1,115 @@
#ifndef SMLUA_COLLISION_UTILS_H
#define SMLUA_COLLISION_UTILS_H
struct RayIntersectionInfo {
struct Surface* surface;
Vec3f hitPos;
};
struct GlobalObjectCollisionData {
Collision* bbh_seg7_collision_coffin;
Collision* bbh_seg7_collision_haunted_bookshelf;
Collision* bbh_seg7_collision_merry_go_round;
Collision* bbh_seg7_collision_mesh_elevator;
Collision* bbh_seg7_collision_staircase_step;
Collision* bbh_seg7_collision_tilt_floor_platform;
Collision* bitdw_seg7_collision_moving_pyramid;
Collision* bitfs_seg7_collision_inverted_pyramid;
Collision* bitfs_seg7_collision_sinking_cage_platform;
Collision* bitfs_seg7_collision_sinking_platform;
Collision* bitfs_seg7_collision_squishable_platform;
Collision* blue_coin_switch_seg8_collision_08000E98;
Collision* bob_seg7_collision_chain_chomp_gate;
Collision* bowser_2_seg7_collision_tilting_platform;
Collision* breakable_box_seg8_collision_08012D70;
Collision* cannon_lid_seg8_collision_08004950;
Collision* capswitch_collision_050033D0;
Collision* capswitch_collision_05003448;
Collision* castle_grounds_seg7_collision_cannon_grill;
Collision* castle_grounds_seg7_collision_moat_grills;
Collision* checkerboard_platform_seg8_collision_0800D710;
Collision* ddd_seg7_collision_bowser_sub_door;
Collision* ddd_seg7_collision_submarine;
Collision* door_seg3_collision_0301CE78;
Collision* dorrie_seg6_collision_0600F644;
Collision* exclamation_box_outline_seg8_collision_08025F78;
Collision* hmc_seg7_collision_controllable_platform;
Collision* hmc_seg7_collision_controllable_platform_sub;
Collision* hmc_seg7_collision_elevator;
Collision* inside_castle_seg7_collision_floor_trap;
Collision* inside_castle_seg7_collision_star_door;
Collision* inside_castle_seg7_collision_water_level_pillar;
Collision* jrb_seg7_collision_floating_box;
Collision* jrb_seg7_collision_floating_platform;
Collision* jrb_seg7_collision_in_sunken_ship;
Collision* jrb_seg7_collision_in_sunken_ship_2;
Collision* jrb_seg7_collision_in_sunken_ship_3;
Collision* jrb_seg7_collision_pillar_base;
Collision* jrb_seg7_collision_rock_solid;
Collision* lll_hexagonal_mesh_seg3_collision_0301CECC;
Collision* lll_seg7_collision_drawbridge;
Collision* lll_seg7_collision_falling_wall;
Collision* lll_seg7_collision_floating_block;
Collision* lll_seg7_collision_hexagonal_platform;
Collision* lll_seg7_collision_inverted_pyramid;
Collision* lll_seg7_collision_octagonal_moving_platform;
Collision* lll_seg7_collision_pitoune;
Collision* lll_seg7_collision_puzzle_piece;
Collision* lll_seg7_collision_rotating_fire_bars;
Collision* lll_seg7_collision_rotating_platform;
Collision* lll_seg7_collision_sinking_pyramids;
Collision* lll_seg7_collision_slow_tilting_platform;
Collision* lll_seg7_collision_wood_piece;
Collision* metal_box_seg8_collision_08024C28;
Collision* penguin_seg5_collision_05008B88;
Collision* poundable_pole_collision_06002490;
Collision* purple_switch_seg8_collision_0800C7A8;
Collision* rr_seg7_collision_donut_platform;
Collision* rr_seg7_collision_elevator_platform;
Collision* rr_seg7_collision_pendulum;
Collision* rr_seg7_collision_rotating_platform_with_fire;
Collision* sl_seg7_collision_pound_explodes;
Collision* sl_seg7_collision_sliding_snow_mound;
Collision* springboard_collision_05001A28;
Collision* ssl_seg7_collision_0702808C;
Collision* ssl_seg7_collision_grindel;
Collision* ssl_seg7_collision_pyramid_elevator;
Collision* ssl_seg7_collision_pyramid_top;
Collision* ssl_seg7_collision_spindel;
Collision* ssl_seg7_collision_tox_box;
Collision* thi_seg7_collision_top_trap;
Collision* thwomp_seg5_collision_0500B7D0;
Collision* thwomp_seg5_collision_0500B92C;
Collision* ttc_seg7_collision_clock_main_rotation;
Collision* ttc_seg7_collision_clock_pendulum;
Collision* ttc_seg7_collision_clock_platform;
Collision* ttc_seg7_collision_rotating_clock_platform2;
Collision* ttc_seg7_collision_sliding_surface;
Collision* ttm_seg7_collision_pitoune_2;
Collision* ttm_seg7_collision_podium_warp;
Collision* ttm_seg7_collision_ukiki_cage;
Collision* warp_pipe_seg3_collision_03009AC8;
Collision* wdw_seg7_collision_arrow_lift;
Collision* wdw_seg7_collision_express_elevator_platform;
Collision* wdw_seg7_collision_rect_floating_platform;
Collision* wdw_seg7_collision_square_floating_platform;
Collision* wf_seg7_collision_breakable_wall;
Collision* wf_seg7_collision_breakable_wall_2;
Collision* wf_seg7_collision_bullet_bill_cannon;
Collision* wf_seg7_collision_clocklike_rotation;
Collision* wf_seg7_collision_kickable_board;
Collision* wf_seg7_collision_large_bomp;
Collision* wf_seg7_collision_platform;
Collision* wf_seg7_collision_sliding_brick_platform;
Collision* wf_seg7_collision_small_bomp;
Collision* wf_seg7_collision_tower;
Collision* wf_seg7_collision_tower_door;
Collision* whomp_seg6_collision_06020A0C;
Collision* wooden_signpost_seg3_collision_0302DD80;
};
extern struct GlobalObjectCollisionData gGlobalObjectCollisionData;
struct RayIntersectionInfo* collision_find_surface_on_ray(f32 startX, f32 startY, f32 startZ, f32 endX, f32 endY, f32 endZ);
#endif

View File

@ -21,6 +21,8 @@
#include "include/behavior_table.h"
#include "src/pc/lua/smlua_obj_utils.h"
#include "src/pc/lua/smlua_misc_utils.h"
#include "src/pc/lua/smlua_collision_utils.h"
#include "src/engine/surface_load.h"
//////////////////////
@ -7264,9 +7266,9 @@ int smlua_func_save_file_get_total_star_count(lua_State* L) {
return 1;
}
////////////////////////
// smlua_misc_utils.h //
////////////////////////
/////////////////////////////
// smlua_collision_utils.h //
/////////////////////////////
int smlua_func_collision_find_surface_on_ray(lua_State* L) {
if(!smlua_functions_valid_param_count(L, 6)) { return 0; }
@ -7289,6 +7291,10 @@ int smlua_func_collision_find_surface_on_ray(lua_State* L) {
return 1;
}
////////////////////////
// smlua_misc_utils.h //
////////////////////////
int smlua_func_get_network_area_timer(UNUSED lua_State* L) {
if(!smlua_functions_valid_param_count(L, 0)) { return 0; }
@ -7916,6 +7922,65 @@ int smlua_func_find_water_level(lua_State* L) {
return 1;
}
////////////////////
// surface_load.h //
////////////////////
int smlua_func_alloc_surface_pools(UNUSED lua_State* L) {
if(!smlua_functions_valid_param_count(L, 0)) { return 0; }
alloc_surface_pools();
return 1;
}
int smlua_func_clear_dynamic_surfaces(UNUSED lua_State* L) {
if(!smlua_functions_valid_param_count(L, 0)) { return 0; }
clear_dynamic_surfaces();
return 1;
}
int smlua_func_get_area_terrain_size(lua_State* L) {
if(!smlua_functions_valid_param_count(L, 1)) { return 0; }
s16 * data = (s16 *)smlua_to_cpointer(L, 1, LVT_S16_P);
if (!gSmLuaConvertSuccess) { return 0; }
lua_pushinteger(L, get_area_terrain_size(data));
return 1;
}
int smlua_func_load_area_terrain(lua_State* L) {
if(!smlua_functions_valid_param_count(L, 4)) { return 0; }
s16 index = smlua_to_integer(L, 1);
if (!gSmLuaConvertSuccess) { return 0; }
s16 * data = (s16 *)smlua_to_cpointer(L, 2, LVT_S16_P);
if (!gSmLuaConvertSuccess) { return 0; }
s8 * surfaceRooms = (s8 *)smlua_to_cpointer(L, 3, LVT_S8_P);
if (!gSmLuaConvertSuccess) { return 0; }
s16 * macroObjects = (s16 *)smlua_to_cpointer(L, 4, LVT_S16_P);
if (!gSmLuaConvertSuccess) { return 0; }
load_area_terrain(index, data, surfaceRooms, macroObjects);
return 1;
}
int smlua_func_load_object_collision_model(UNUSED lua_State* L) {
if(!smlua_functions_valid_param_count(L, 0)) { return 0; }
load_object_collision_model();
return 1;
}
///////////////
// thread6.c //
///////////////
@ -8548,8 +8613,10 @@ void smlua_bind_functions_autogen(void) {
smlua_bind_function(L, "save_file_get_star_flags", smlua_func_save_file_get_star_flags);
smlua_bind_function(L, "save_file_get_total_star_count", smlua_func_save_file_get_total_star_count);
// smlua_misc_utils.h
// smlua_collision_utils.h
smlua_bind_function(L, "collision_find_surface_on_ray", smlua_func_collision_find_surface_on_ray);
// smlua_misc_utils.h
smlua_bind_function(L, "get_network_area_timer", smlua_func_get_network_area_timer);
// smlua_obj_utils.h
@ -8605,6 +8672,13 @@ void smlua_bind_functions_autogen(void) {
smlua_bind_function(L, "find_wall_collisions", smlua_func_find_wall_collisions);
smlua_bind_function(L, "find_water_level", smlua_func_find_water_level);
// surface_load.h
smlua_bind_function(L, "alloc_surface_pools", smlua_func_alloc_surface_pools);
smlua_bind_function(L, "clear_dynamic_surfaces", smlua_func_clear_dynamic_surfaces);
smlua_bind_function(L, "get_area_terrain_size", smlua_func_get_area_terrain_size);
smlua_bind_function(L, "load_area_terrain", smlua_func_load_area_terrain);
smlua_bind_function(L, "load_object_collision_model", smlua_func_load_object_collision_model);
// thread6.c
smlua_bind_function(L, "queue_rumble_data", smlua_func_queue_rumble_data);
smlua_bind_function(L, "queue_rumble_data_mario", smlua_func_queue_rumble_data_mario);

View File

@ -2,17 +2,8 @@
#include "smlua.h"
#include "smlua_misc_utils.h"
#include "src/engine/surface_collision.h"
#include "pc/debuglog.h"
struct RayIntersectionInfo* collision_find_surface_on_ray(f32 startX, f32 startY, f32 startZ, f32 endX, f32 endY, f32 endZ) {
static struct RayIntersectionInfo info = { 0 };
Vec3f orig = { startX, startY, startZ };
Vec3f end = { endX, endY, endZ };
find_surface_on_ray(orig, end, &info.surface, info.hitPos);
return &info;
}
u32 get_network_area_timer(void) {
return gNetworkAreaTimer;
}

View File

@ -1,12 +1,6 @@
#ifndef SMLUA_MISC_UTILS_H
#define SMLUA_MISC_UTILS_H
struct RayIntersectionInfo {
struct Surface* surface;
Vec3f hitPos;
};
struct RayIntersectionInfo* collision_find_surface_on_ray(f32 startX, f32 startY, f32 startZ, f32 endX, f32 endY, f32 endZ);
u32 get_network_area_timer(void);
#endif