From 2a19745137b528b4398c33fd6ceb6b452a3e3f47 Mon Sep 17 00:00:00 2001
From: jayden <46307433+kermeow@users.noreply.github.com>
Date: Mon, 23 Dec 2024 00:15:04 +0000
Subject: [PATCH] Expose types of GraphNode to Lua (#580)
* expose graph_node.h
* cast_graph_node lua function
* document cast_graph_node
* graph node immutables
---
autogen/convert_functions.py | 28 +++
autogen/convert_structs.py | 11 +-
autogen/lua_definitions/manual.lua | 12 +-
autogen/lua_definitions/structs.lua | 117 +++++++++
docs/lua/functions.md | 28 +++
docs/lua/structs.md | 293 ++++++++++++++++++++++
src/pc/lua/smlua_cobject_autogen.c | 361 +++++++++++++++++++++-------
src/pc/lua/smlua_cobject_autogen.h | 22 ++
src/pc/lua/smlua_functions.c | 64 +++++
9 files changed, 850 insertions(+), 86 deletions(-)
diff --git a/autogen/convert_functions.py b/autogen/convert_functions.py
index 4b3f70adc..9f2f3ee52 100644
--- a/autogen/convert_functions.py
+++ b/autogen/convert_functions.py
@@ -322,6 +322,7 @@ manual_index_documentation = """
- [log_to_console](#log_to_console)
- [add_scroll_target](#add_scroll_target)
- [collision_find_surface_on_ray](#collision_find_surface_on_ray)
+ - [cast_graph_node](#cast_graph_node)
@@ -809,6 +810,33 @@ N/A
+## [cast_graph_node](#cast_graph_node)
+
+Returns the specific GraphNode(...) the node is part of. Basically the reverse of `.node` or `.fnNode`.
+
+### Lua Example
+```lua
+local marioGfx = gMarioStates[0].marioObj.header.gfx -- GraphNodeObject
+local node = marioGfx.node -- GraphNode
+
+print(marioGfx == cast_graph_node(node)) -- true
+```
+
+### Parameters
+| Field | Type |
+| ----- | ---- |
+| node | [GraphNode](structs.md#GraphNode) |
+
+### Returns
+- GraphNode(...)
+
+### C Prototype
+N/A
+
+[:arrow_up_small:](#)
+
+
+
"""
############################################################################
diff --git a/autogen/convert_structs.py b/autogen/convert_structs.py
index 05bef7ae1..34a27599d 100644
--- a/autogen/convert_structs.py
+++ b/autogen/convert_structs.py
@@ -29,7 +29,8 @@ in_files = [
"src/game/paintings.h",
"src/pc/djui/djui_types.h",
"src/game/first_person_cam.h",
- "src/game/player_palette.h"
+ "src/game/player_palette.h",
+ "src/engine/graph_node.h"
]
out_filename_c = 'src/pc/lua/smlua_cobject_autogen.c'
@@ -112,7 +113,13 @@ override_field_immutable = {
"SpawnInfo": [ "syncID", "next", "unk18" ],
"CustomLevelInfo": [ "next" ],
"GraphNode": [ "children", "next", "parent", "prev", "type" ],
- "GraphNodeObject": [ "angle", "animInfo", "cameraToObject", "node", "pos", "prevAngle", "prevPos", "prevScale", "prevScaleTimestamp", "prevShadowPos", "prevShadowPosTimestamp", "prevThrowMatrix", "prevThrowMatrixTimestamp", "prevTimestamp", "scale", "shadowPos", "sharedChild", "skipInterpolationTimestamp", "throwMatrixPrev", "unk4C", ],
+ "GraphNodeBackground": [ "prevCameraTimestamp", "unused" ],
+ "GraphNodeCamera": [ "matrixPtrPrev", "prevTimestamp" ],
+ "GraphNodeHeldObject": [ "prevShadowPosTimestamp" ],
+ "GraphNodeObject": [ "angle", "animInfo", "cameraToObject", "node", "pos", "prevAngle", "prevPos", "prevScale", "prevScaleTimestamp", "prevShadowPos", "prevShadowPosTimestamp", "prevThrowMatrix", "prevThrowMatrixTimestamp", "prevTimestamp", "scale", "shadowPos", "sharedChild", "skipInterpolationTimestamp", "throwMatrixPrev", "unk4C", ],
+ "GraphNodeObjectParent": [ "sharedChild" ],
+ "GraphNodePerspective": [ "unused" ],
+ "GraphNodeSwitchCase": [ "*" ],
"ObjectWarpNode": [ "next "],
"Animation": [ "length" ],
"AnimationTable": [ "count" ],
diff --git a/autogen/lua_definitions/manual.lua b/autogen/lua_definitions/manual.lua
index 4c8063063..b8ccd9e33 100644
--- a/autogen/lua_definitions/manual.lua
+++ b/autogen/lua_definitions/manual.lua
@@ -129,8 +129,8 @@ function hook_event(hookEventType, func)
end
--- @class ActionTable
- --- @field every_frame fun(m:MarioState):integer?
- --- @field gravity fun(m:MarioState):integer?
+--- @field every_frame fun(m:MarioState):integer?
+--- @field gravity fun(m:MarioState):integer?
--- @param actionId integer The action to replace
--- @param funcOrFuncTable fun(m:MarioState):integer? | ActionTable The new behavior of the action
@@ -412,3 +412,11 @@ end
function get_exclamation_box_contents()
-- ...
end
+
+---@param node GraphNode | FnGraphNode
+---@return GraphNode | GraphNodeAnimatedPart | GraphNodeBackground | GraphNodeBillboard | GraphNodeCamera | GraphNodeCullingRadius | GraphNodeDisplayList | GraphNodeGenerated | GraphNodeHeldObject | GraphNodeLevelOfDetail | GraphNodeMasterList | GraphNodeObject | GraphNodeObjectParent | GraphNodeOrthoProjection | GraphNodePerspective | GraphNodeRotation | GraphNodeScale | GraphNodeShadow | GraphNodeStart | GraphNodeSwitchCase | GraphNodeTranslation | GraphNodeTranslationRotation
+--- Returns the specific GraphNode(...) the node is part of.
+--- Basically the reverse of `.node` or `.fnNode`.
+function cast_graph_node(node)
+ -- ...
+end
diff --git a/autogen/lua_definitions/structs.lua b/autogen/lua_definitions/structs.lua
index 5f82614f3..c287b7b25 100644
--- a/autogen/lua_definitions/structs.lua
+++ b/autogen/lua_definitions/structs.lua
@@ -584,6 +584,12 @@
--- @field public second integer
--- @field public year integer
+--- @class DisplayListNode
+--- @field public next DisplayListNode
+--- @field public transform Pointer_Mtx
+--- @field public transformPrev Pointer_Mtx
+--- @field public usingCamSpace integer
+
--- @class DjuiColor
--- @field public a integer
--- @field public b integer
@@ -638,6 +644,9 @@
--- @field public normalZ number
--- @field public originOffset number
+--- @class FnGraphNode
+--- @field public node GraphNode
+
--- @class GlobalObjectAnimations
--- @field public amp_seg8_anims_08004034 Pointer_ObjectAnimPointer
--- @field public birds_seg5_anims_050009E8 Pointer_ObjectAnimPointer
@@ -824,6 +833,61 @@
--- @field public prev GraphNode
--- @field public type integer
+--- @class GraphNodeAnimatedPart
+--- @field public node GraphNode
+--- @field public translation Vec3s
+
+--- @class GraphNodeBackground
+--- @field public background integer
+--- @field public fnNode FnGraphNode
+--- @field public prevCameraFocus Vec3f
+--- @field public prevCameraPos Vec3f
+--- @field public prevCameraTimestamp integer
+--- @field public unused integer
+
+--- @class GraphNodeBillboard
+--- @field public node GraphNode
+--- @field public translation Vec3s
+
+--- @class GraphNodeCamera
+--- @field public fnNode FnGraphNode
+--- @field public focus Vec3f
+--- @field public matrixPtr Pointer_Mat4
+--- @field public matrixPtrPrev Pointer_Mat4
+--- @field public pos Vec3f
+--- @field public prevFocus Vec3f
+--- @field public prevPos Vec3f
+--- @field public prevTimestamp integer
+--- @field public roll integer
+--- @field public rollScreen integer
+
+--- @class GraphNodeCullingRadius
+--- @field public cullingRadius integer
+--- @field public node GraphNode
+
+--- @class GraphNodeDisplayList
+--- @field public node GraphNode
+
+--- @class GraphNodeGenerated
+--- @field public fnNode FnGraphNode
+--- @field public parameter integer
+
+--- @class GraphNodeHeldObject
+--- @field public fnNode FnGraphNode
+--- @field public objNode Object
+--- @field public playerIndex integer
+--- @field public prevShadowPos Vec3f
+--- @field public prevShadowPosTimestamp integer
+--- @field public translation Vec3s
+
+--- @class GraphNodeLevelOfDetail
+--- @field public maxDistance integer
+--- @field public minDistance integer
+--- @field public node GraphNode
+
+--- @class GraphNodeMasterList
+--- @field public node GraphNode
+
--- @class GraphNodeObject
--- @field public activeAreaIndex integer
--- @field public angle Vec3s
@@ -853,6 +917,58 @@
--- @field public throwMatrixPrev Pointer_Mat4
--- @field public unk4C SpawnInfo
+--- @class GraphNodeObjectParent
+--- @field public node GraphNode
+--- @field public sharedChild GraphNode
+
+--- @class GraphNodeOrthoProjection
+--- @field public node GraphNode
+--- @field public scale number
+
+--- @class GraphNodePerspective
+--- @field public far integer
+--- @field public fnNode FnGraphNode
+--- @field public fov number
+--- @field public near integer
+--- @field public prevFov number
+--- @field public prevTimestamp number
+--- @field public unused integer
+
+--- @class GraphNodeRotation
+--- @field public node GraphNode
+--- @field public prevRotation Vec3s
+--- @field public prevTimestamp integer
+--- @field public rotation Vec3s
+
+--- @class GraphNodeScale
+--- @field public node GraphNode
+--- @field public prevScale number
+--- @field public scale number
+
+--- @class GraphNodeShadow
+--- @field public node GraphNode
+--- @field public shadowScale integer
+--- @field public shadowSolidity integer
+--- @field public shadowType integer
+
+--- @class GraphNodeStart
+--- @field public node GraphNode
+
+--- @class GraphNodeSwitchCase
+--- @field public fnNode FnGraphNode
+--- @field public numCases integer
+--- @field public selectedCase integer
+--- @field public unused integer
+
+--- @class GraphNodeTranslation
+--- @field public node GraphNode
+--- @field public translation Vec3s
+
+--- @class GraphNodeTranslationRotation
+--- @field public node GraphNode
+--- @field public rotation Vec3s
+--- @field public translation Vec3s
+
--- @class GraphNode_802A45E4
--- @field public unk18 integer
--- @field public unk1A integer
@@ -2247,6 +2363,7 @@
--- @class Pointer_integer
--- @class Pointer_Trajectory
--- @class Pointer_LevelScript
+--- @class Pointer_Mtx
--- @class Pointer_ObjectAnimPointer
--- @class Pointer_Collision
--- @class Pointer_Mat4
diff --git a/docs/lua/functions.md b/docs/lua/functions.md
index 86ac4836f..af2d59b73 100644
--- a/docs/lua/functions.md
+++ b/docs/lua/functions.md
@@ -26,6 +26,7 @@
- [log_to_console](#log_to_console)
- [add_scroll_target](#add_scroll_target)
- [collision_find_surface_on_ray](#collision_find_surface_on_ray)
+ - [cast_graph_node](#cast_graph_node)
@@ -2424,6 +2425,33 @@ N/A
+## [cast_graph_node](#cast_graph_node)
+
+Returns the specific GraphNode(...) the node is part of. Basically the reverse of `.node` or `.fnNode`.
+
+### Lua Example
+```lua
+local marioGfx = gMarioStates[0].marioObj.header.gfx -- GraphNodeObject
+local node = marioGfx.node -- GraphNode
+
+print(marioGfx == cast_graph_node(node)) -- true
+```
+
+### Parameters
+| Field | Type |
+| ----- | ---- |
+| node | [GraphNode](structs.md#GraphNode) |
+
+### Returns
+- GraphNode(...)
+
+### C Prototype
+N/A
+
+[:arrow_up_small:](#)
+
+
+
---
# functions from area.h
diff --git a/docs/lua/structs.md b/docs/lua/structs.md
index 8ac66b187..7bfdbdf21 100644
--- a/docs/lua/structs.md
+++ b/docs/lua/structs.md
@@ -23,6 +23,7 @@
- [CutsceneSplinePoint](#CutsceneSplinePoint)
- [CutsceneVariable](#CutsceneVariable)
- [DateTime](#DateTime)
+- [DisplayListNode](#DisplayListNode)
- [DjuiColor](#DjuiColor)
- [DjuiInteractableTheme](#DjuiInteractableTheme)
- [DjuiPanelTheme](#DjuiPanelTheme)
@@ -31,11 +32,33 @@
- [ExclamationBoxContent](#ExclamationBoxContent)
- [FirstPersonCamera](#FirstPersonCamera)
- [FloorGeometry](#FloorGeometry)
+- [FnGraphNode](#FnGraphNode)
- [GlobalObjectAnimations](#GlobalObjectAnimations)
- [GlobalObjectCollisionData](#GlobalObjectCollisionData)
- [GlobalTextures](#GlobalTextures)
- [GraphNode](#GraphNode)
+- [GraphNodeAnimatedPart](#GraphNodeAnimatedPart)
+- [GraphNodeBackground](#GraphNodeBackground)
+- [GraphNodeBillboard](#GraphNodeBillboard)
+- [GraphNodeCamera](#GraphNodeCamera)
+- [GraphNodeCullingRadius](#GraphNodeCullingRadius)
+- [GraphNodeDisplayList](#GraphNodeDisplayList)
+- [GraphNodeGenerated](#GraphNodeGenerated)
+- [GraphNodeHeldObject](#GraphNodeHeldObject)
+- [GraphNodeLevelOfDetail](#GraphNodeLevelOfDetail)
+- [GraphNodeMasterList](#GraphNodeMasterList)
- [GraphNodeObject](#GraphNodeObject)
+- [GraphNodeObjectParent](#GraphNodeObjectParent)
+- [GraphNodeOrthoProjection](#GraphNodeOrthoProjection)
+- [GraphNodePerspective](#GraphNodePerspective)
+- [GraphNodeRoot](#GraphNodeRoot)
+- [GraphNodeRotation](#GraphNodeRotation)
+- [GraphNodeScale](#GraphNodeScale)
+- [GraphNodeShadow](#GraphNodeShadow)
+- [GraphNodeStart](#GraphNodeStart)
+- [GraphNodeSwitchCase](#GraphNodeSwitchCase)
+- [GraphNodeTranslation](#GraphNodeTranslation)
+- [GraphNodeTranslationRotation](#GraphNodeTranslationRotation)
- [GraphNode_802A45E4](#GraphNode_802A45E4)
- [HandheldShakePoint](#HandheldShakePoint)
- [HudUtilsRotation](#HudUtilsRotation)
@@ -836,6 +859,19 @@
+## [DisplayListNode](#DisplayListNode)
+
+| Field | Type | Access |
+| ----- | ---- | ------ |
+| next | [DisplayListNode](structs.md#DisplayListNode) | |
+| transform | `Pointer` <`Mtx`> | |
+| transformPrev | `Pointer` <`Mtx`> | |
+| usingCamSpace | `integer` | |
+
+[:arrow_up_small:](#)
+
+
+
## [DjuiColor](#DjuiColor)
| Field | Type | Access |
@@ -946,6 +982,16 @@
+## [FnGraphNode](#FnGraphNode)
+
+| Field | Type | Access |
+| ----- | ---- | ------ |
+| node | [GraphNode](structs.md#GraphNode) | read-only |
+
+[:arrow_up_small:](#)
+
+
+
## [GlobalObjectAnimations](#GlobalObjectAnimations)
| Field | Type | Access |
@@ -1160,6 +1206,131 @@
+## [GraphNodeAnimatedPart](#GraphNodeAnimatedPart)
+
+| Field | Type | Access |
+| ----- | ---- | ------ |
+| node | [GraphNode](structs.md#GraphNode) | read-only |
+| translation | [Vec3s](structs.md#Vec3s) | read-only |
+
+[:arrow_up_small:](#)
+
+
+
+## [GraphNodeBackground](#GraphNodeBackground)
+
+| Field | Type | Access |
+| ----- | ---- | ------ |
+| background | `integer` | |
+| fnNode | [FnGraphNode](structs.md#FnGraphNode) | read-only |
+| prevCameraFocus | [Vec3f](structs.md#Vec3f) | read-only |
+| prevCameraPos | [Vec3f](structs.md#Vec3f) | read-only |
+| prevCameraTimestamp | `integer` | read-only |
+| unused | `integer` | read-only |
+
+[:arrow_up_small:](#)
+
+
+
+## [GraphNodeBillboard](#GraphNodeBillboard)
+
+| Field | Type | Access |
+| ----- | ---- | ------ |
+| node | [GraphNode](structs.md#GraphNode) | read-only |
+| translation | [Vec3s](structs.md#Vec3s) | read-only |
+
+[:arrow_up_small:](#)
+
+
+
+## [GraphNodeCamera](#GraphNodeCamera)
+
+| Field | Type | Access |
+| ----- | ---- | ------ |
+| fnNode | [FnGraphNode](structs.md#FnGraphNode) | read-only |
+| focus | [Vec3f](structs.md#Vec3f) | read-only |
+| matrixPtr | `Pointer` <`Mat4`> | |
+| matrixPtrPrev | `Pointer` <`Mat4`> | read-only |
+| pos | [Vec3f](structs.md#Vec3f) | read-only |
+| prevFocus | [Vec3f](structs.md#Vec3f) | read-only |
+| prevPos | [Vec3f](structs.md#Vec3f) | read-only |
+| prevTimestamp | `integer` | read-only |
+| roll | `integer` | |
+| rollScreen | `integer` | |
+
+[:arrow_up_small:](#)
+
+
+
+## [GraphNodeCullingRadius](#GraphNodeCullingRadius)
+
+| Field | Type | Access |
+| ----- | ---- | ------ |
+| cullingRadius | `integer` | |
+| node | [GraphNode](structs.md#GraphNode) | read-only |
+
+[:arrow_up_small:](#)
+
+
+
+## [GraphNodeDisplayList](#GraphNodeDisplayList)
+
+| Field | Type | Access |
+| ----- | ---- | ------ |
+| node | [GraphNode](structs.md#GraphNode) | read-only |
+
+[:arrow_up_small:](#)
+
+
+
+## [GraphNodeGenerated](#GraphNodeGenerated)
+
+| Field | Type | Access |
+| ----- | ---- | ------ |
+| fnNode | [FnGraphNode](structs.md#FnGraphNode) | read-only |
+| parameter | `integer` | |
+
+[:arrow_up_small:](#)
+
+
+
+## [GraphNodeHeldObject](#GraphNodeHeldObject)
+
+| Field | Type | Access |
+| ----- | ---- | ------ |
+| fnNode | [FnGraphNode](structs.md#FnGraphNode) | read-only |
+| objNode | [Object](structs.md#Object) | |
+| playerIndex | `integer` | |
+| prevShadowPos | [Vec3f](structs.md#Vec3f) | read-only |
+| prevShadowPosTimestamp | `integer` | read-only |
+| translation | [Vec3s](structs.md#Vec3s) | read-only |
+
+[:arrow_up_small:](#)
+
+
+
+## [GraphNodeLevelOfDetail](#GraphNodeLevelOfDetail)
+
+| Field | Type | Access |
+| ----- | ---- | ------ |
+| maxDistance | `integer` | |
+| minDistance | `integer` | |
+| node | [GraphNode](structs.md#GraphNode) | read-only |
+
+[:arrow_up_small:](#)
+
+
+
+## [GraphNodeMasterList](#GraphNodeMasterList)
+
+| Field | Type | Access |
+| ----- | ---- | ------ |
+| node | [GraphNode](structs.md#GraphNode) | read-only |
+
+[:arrow_up_small:](#)
+
+
+
## [GraphNodeObject](#GraphNodeObject)
| Field | Type | Access |
@@ -1196,6 +1367,128 @@
+## [GraphNodeObjectParent](#GraphNodeObjectParent)
+
+| Field | Type | Access |
+| ----- | ---- | ------ |
+| node | [GraphNode](structs.md#GraphNode) | read-only |
+| sharedChild | [GraphNode](structs.md#GraphNode) | read-only |
+
+[:arrow_up_small:](#)
+
+
+
+## [GraphNodeOrthoProjection](#GraphNodeOrthoProjection)
+
+| Field | Type | Access |
+| ----- | ---- | ------ |
+| node | [GraphNode](structs.md#GraphNode) | read-only |
+| scale | `number` | |
+
+[:arrow_up_small:](#)
+
+
+
+## [GraphNodePerspective](#GraphNodePerspective)
+
+| Field | Type | Access |
+| ----- | ---- | ------ |
+| far | `integer` | |
+| fnNode | [FnGraphNode](structs.md#FnGraphNode) | read-only |
+| fov | `number` | |
+| near | `integer` | |
+| prevFov | `number` | |
+| prevTimestamp | `number` | |
+| unused | `integer` | read-only |
+
+[:arrow_up_small:](#)
+
+
+
+## [GraphNodeRotation](#GraphNodeRotation)
+
+| Field | Type | Access |
+| ----- | ---- | ------ |
+| node | [GraphNode](structs.md#GraphNode) | read-only |
+| prevRotation | [Vec3s](structs.md#Vec3s) | read-only |
+| prevTimestamp | `integer` | |
+| rotation | [Vec3s](structs.md#Vec3s) | read-only |
+
+[:arrow_up_small:](#)
+
+
+
+## [GraphNodeScale](#GraphNodeScale)
+
+| Field | Type | Access |
+| ----- | ---- | ------ |
+| node | [GraphNode](structs.md#GraphNode) | read-only |
+| prevScale | `number` | |
+| scale | `number` | |
+
+[:arrow_up_small:](#)
+
+
+
+## [GraphNodeShadow](#GraphNodeShadow)
+
+| Field | Type | Access |
+| ----- | ---- | ------ |
+| node | [GraphNode](structs.md#GraphNode) | read-only |
+| shadowScale | `integer` | |
+| shadowSolidity | `integer` | |
+| shadowType | `integer` | |
+
+[:arrow_up_small:](#)
+
+
+
+## [GraphNodeStart](#GraphNodeStart)
+
+| Field | Type | Access |
+| ----- | ---- | ------ |
+| node | [GraphNode](structs.md#GraphNode) | read-only |
+
+[:arrow_up_small:](#)
+
+
+
+## [GraphNodeSwitchCase](#GraphNodeSwitchCase)
+
+| Field | Type | Access |
+| ----- | ---- | ------ |
+| fnNode | [FnGraphNode](structs.md#FnGraphNode) | read-only |
+| numCases | `integer` | read-only |
+| selectedCase | `integer` | read-only |
+| unused | `integer` | read-only |
+
+[:arrow_up_small:](#)
+
+
+
+## [GraphNodeTranslation](#GraphNodeTranslation)
+
+| Field | Type | Access |
+| ----- | ---- | ------ |
+| node | [GraphNode](structs.md#GraphNode) | read-only |
+| translation | [Vec3s](structs.md#Vec3s) | read-only |
+
+[:arrow_up_small:](#)
+
+
+
+## [GraphNodeTranslationRotation](#GraphNodeTranslationRotation)
+
+| Field | Type | Access |
+| ----- | ---- | ------ |
+| node | [GraphNode](structs.md#GraphNode) | read-only |
+| rotation | [Vec3s](structs.md#Vec3s) | read-only |
+| translation | [Vec3s](structs.md#Vec3s) | read-only |
+
+[:arrow_up_small:](#)
+
+
+
## [GraphNode_802A45E4](#GraphNode_802A45E4)
| Field | Type | Access |
diff --git a/src/pc/lua/smlua_cobject_autogen.c b/src/pc/lua/smlua_cobject_autogen.c
index e9699654e..f0d22bb61 100644
--- a/src/pc/lua/smlua_cobject_autogen.c
+++ b/src/pc/lua/smlua_cobject_autogen.c
@@ -25,6 +25,7 @@
#include "src/pc/djui/djui_types.h"
#include "src/game/first_person_cam.h"
#include "src/game/player_palette.h"
+#include "src/engine/graph_node.h"
#include "include/object_fields.h"
@@ -670,6 +671,15 @@ static struct LuaObjectField sDateTimeFields[LUA_DATE_TIME_FIELD_COUNT] = {
{ "year", LVT_S32, offsetof(struct DateTime, year), false, LOT_NONE },
};
+#define LUA_DISPLAY_LIST_NODE_FIELD_COUNT 4
+static struct LuaObjectField sDisplayListNodeFields[LUA_DISPLAY_LIST_NODE_FIELD_COUNT] = {
+// { "displayList", LVT_???, offsetof(struct DisplayListNode, displayList), false, LOT_??? }, <--- UNIMPLEMENTED
+ { "next", LVT_COBJECT_P, offsetof(struct DisplayListNode, next), false, LOT_DISPLAYLISTNODE },
+ { "transform", LVT_COBJECT_P, offsetof(struct DisplayListNode, transform), false, LOT_POINTER },
+ { "transformPrev", LVT_COBJECT_P, offsetof(struct DisplayListNode, transformPrev), false, LOT_POINTER },
+ { "usingCamSpace", LVT_U8, offsetof(struct DisplayListNode, usingCamSpace), false, LOT_NONE },
+};
+
#define LUA_DJUI_COLOR_FIELD_COUNT 4
static struct LuaObjectField sDjuiColorFields[LUA_DJUI_COLOR_FIELD_COUNT] = {
{ "a", LVT_U8, offsetof(struct DjuiColor, a), false, LOT_NONE },
@@ -741,6 +751,12 @@ static struct LuaObjectField sFloorGeometryFields[LUA_FLOOR_GEOMETRY_FIELD_COUNT
// { "unused", LOT_???, offsetof(struct FloorGeometry, unused), false, LOT_??? }, <--- UNIMPLEMENTED
};
+#define LUA_FN_GRAPH_NODE_FIELD_COUNT 1
+static struct LuaObjectField sFnGraphNodeFields[LUA_FN_GRAPH_NODE_FIELD_COUNT] = {
+// { "func", LVT_???, offsetof(struct FnGraphNode, func), false, LOT_??? }, <--- UNIMPLEMENTED
+ { "node", LVT_COBJECT, offsetof(struct FnGraphNode, node), true, LOT_GRAPHNODE },
+};
+
#define LUA_GLOBAL_OBJECT_ANIMATIONS_FIELD_COUNT 56
static struct LuaObjectField sGlobalObjectAnimationsFields[LUA_GLOBAL_OBJECT_ANIMATIONS_FIELD_COUNT] = {
{ "amp_seg8_anims_08004034", LVT_OBJECTANIMPOINTER_P, offsetof(struct GlobalObjectAnimations, amp_seg8_anims_08004034), true, LOT_POINTER },
@@ -936,6 +952,88 @@ static struct LuaObjectField sGraphNodeFields[LUA_GRAPH_NODE_FIELD_COUNT] = {
{ "type", LVT_S16, offsetof(struct GraphNode, type), true, LOT_NONE },
};
+#define LUA_GRAPH_NODE_ANIMATED_PART_FIELD_COUNT 2
+static struct LuaObjectField sGraphNodeAnimatedPartFields[LUA_GRAPH_NODE_ANIMATED_PART_FIELD_COUNT] = {
+// { "displayList", LVT_???, offsetof(struct GraphNodeAnimatedPart, displayList), false, LOT_??? }, <--- UNIMPLEMENTED
+ { "node", LVT_COBJECT, offsetof(struct GraphNodeAnimatedPart, node), true, LOT_GRAPHNODE },
+ { "translation", LVT_COBJECT, offsetof(struct GraphNodeAnimatedPart, translation), true, LOT_VEC3S },
+};
+
+#define LUA_GRAPH_NODE_BACKGROUND_FIELD_COUNT 6
+static struct LuaObjectField sGraphNodeBackgroundFields[LUA_GRAPH_NODE_BACKGROUND_FIELD_COUNT] = {
+ { "background", LVT_S32, offsetof(struct GraphNodeBackground, background), false, LOT_NONE },
+ { "fnNode", LVT_COBJECT, offsetof(struct GraphNodeBackground, fnNode), true, LOT_FNGRAPHNODE },
+ { "prevCameraFocus", LVT_COBJECT, offsetof(struct GraphNodeBackground, prevCameraFocus), true, LOT_VEC3F },
+ { "prevCameraPos", LVT_COBJECT, offsetof(struct GraphNodeBackground, prevCameraPos), true, LOT_VEC3F },
+ { "prevCameraTimestamp", LVT_U32, offsetof(struct GraphNodeBackground, prevCameraTimestamp), true, LOT_NONE },
+ { "unused", LVT_S32, offsetof(struct GraphNodeBackground, unused), true, LOT_NONE },
+};
+
+#define LUA_GRAPH_NODE_BILLBOARD_FIELD_COUNT 2
+static struct LuaObjectField sGraphNodeBillboardFields[LUA_GRAPH_NODE_BILLBOARD_FIELD_COUNT] = {
+// { "displayList", LVT_???, offsetof(struct GraphNodeBillboard, displayList), false, LOT_??? }, <--- UNIMPLEMENTED
+ { "node", LVT_COBJECT, offsetof(struct GraphNodeBillboard, node), true, LOT_GRAPHNODE },
+ { "translation", LVT_COBJECT, offsetof(struct GraphNodeBillboard, translation), true, LOT_VEC3S },
+};
+
+#define LUA_GRAPH_NODE_CAMERA_FIELD_COUNT 10
+static struct LuaObjectField sGraphNodeCameraFields[LUA_GRAPH_NODE_CAMERA_FIELD_COUNT] = {
+// { "config", LOT_???, offsetof(struct GraphNodeCamera, config), false, LOT_??? }, <--- UNIMPLEMENTED
+ { "fnNode", LVT_COBJECT, offsetof(struct GraphNodeCamera, fnNode), true, LOT_FNGRAPHNODE },
+ { "focus", LVT_COBJECT, offsetof(struct GraphNodeCamera, focus), true, LOT_VEC3F },
+ { "matrixPtr", LVT_COBJECT_P, offsetof(struct GraphNodeCamera, matrixPtr), false, LOT_POINTER },
+ { "matrixPtrPrev", LVT_COBJECT_P, offsetof(struct GraphNodeCamera, matrixPtrPrev), true, LOT_POINTER },
+ { "pos", LVT_COBJECT, offsetof(struct GraphNodeCamera, pos), true, LOT_VEC3F },
+ { "prevFocus", LVT_COBJECT, offsetof(struct GraphNodeCamera, prevFocus), true, LOT_VEC3F },
+ { "prevPos", LVT_COBJECT, offsetof(struct GraphNodeCamera, prevPos), true, LOT_VEC3F },
+ { "prevTimestamp", LVT_U32, offsetof(struct GraphNodeCamera, prevTimestamp), true, LOT_NONE },
+ { "roll", LVT_S16, offsetof(struct GraphNodeCamera, roll), false, LOT_NONE },
+ { "rollScreen", LVT_S16, offsetof(struct GraphNodeCamera, rollScreen), false, LOT_NONE },
+};
+
+#define LUA_GRAPH_NODE_CULLING_RADIUS_FIELD_COUNT 2
+static struct LuaObjectField sGraphNodeCullingRadiusFields[LUA_GRAPH_NODE_CULLING_RADIUS_FIELD_COUNT] = {
+ { "cullingRadius", LVT_S16, offsetof(struct GraphNodeCullingRadius, cullingRadius), false, LOT_NONE },
+ { "node", LVT_COBJECT, offsetof(struct GraphNodeCullingRadius, node), true, LOT_GRAPHNODE },
+// { "pad1E", LOT_???, offsetof(struct GraphNodeCullingRadius, pad1E), false, LOT_??? }, <--- UNIMPLEMENTED
+};
+
+#define LUA_GRAPH_NODE_DISPLAY_LIST_FIELD_COUNT 1
+static struct LuaObjectField sGraphNodeDisplayListFields[LUA_GRAPH_NODE_DISPLAY_LIST_FIELD_COUNT] = {
+// { "displayList", LVT_???, offsetof(struct GraphNodeDisplayList, displayList), false, LOT_??? }, <--- UNIMPLEMENTED
+ { "node", LVT_COBJECT, offsetof(struct GraphNodeDisplayList, node), true, LOT_GRAPHNODE },
+};
+
+#define LUA_GRAPH_NODE_GENERATED_FIELD_COUNT 2
+static struct LuaObjectField sGraphNodeGeneratedFields[LUA_GRAPH_NODE_GENERATED_FIELD_COUNT] = {
+ { "fnNode", LVT_COBJECT, offsetof(struct GraphNodeGenerated, fnNode), true, LOT_FNGRAPHNODE },
+ { "parameter", LVT_U32, offsetof(struct GraphNodeGenerated, parameter), false, LOT_NONE },
+};
+
+#define LUA_GRAPH_NODE_HELD_OBJECT_FIELD_COUNT 6
+static struct LuaObjectField sGraphNodeHeldObjectFields[LUA_GRAPH_NODE_HELD_OBJECT_FIELD_COUNT] = {
+ { "fnNode", LVT_COBJECT, offsetof(struct GraphNodeHeldObject, fnNode), true, LOT_FNGRAPHNODE },
+ { "objNode", LVT_COBJECT_P, offsetof(struct GraphNodeHeldObject, objNode), false, LOT_OBJECT },
+ { "playerIndex", LVT_S32, offsetof(struct GraphNodeHeldObject, playerIndex), false, LOT_NONE },
+ { "prevShadowPos", LVT_COBJECT, offsetof(struct GraphNodeHeldObject, prevShadowPos), true, LOT_VEC3F },
+ { "prevShadowPosTimestamp", LVT_U32, offsetof(struct GraphNodeHeldObject, prevShadowPosTimestamp), true, LOT_NONE },
+ { "translation", LVT_COBJECT, offsetof(struct GraphNodeHeldObject, translation), true, LOT_VEC3S },
+};
+
+#define LUA_GRAPH_NODE_LEVEL_OF_DETAIL_FIELD_COUNT 3
+static struct LuaObjectField sGraphNodeLevelOfDetailFields[LUA_GRAPH_NODE_LEVEL_OF_DETAIL_FIELD_COUNT] = {
+ { "maxDistance", LVT_S16, offsetof(struct GraphNodeLevelOfDetail, maxDistance), false, LOT_NONE },
+ { "minDistance", LVT_S16, offsetof(struct GraphNodeLevelOfDetail, minDistance), false, LOT_NONE },
+ { "node", LVT_COBJECT, offsetof(struct GraphNodeLevelOfDetail, node), true, LOT_GRAPHNODE },
+};
+
+#define LUA_GRAPH_NODE_MASTER_LIST_FIELD_COUNT 1
+static struct LuaObjectField sGraphNodeMasterListFields[LUA_GRAPH_NODE_MASTER_LIST_FIELD_COUNT] = {
+// { "listHeads", LOT_???, offsetof(struct GraphNodeMasterList, listHeads), false, LOT_??? }, <--- UNIMPLEMENTED
+// { "listTails", LOT_???, offsetof(struct GraphNodeMasterList, listTails), false, LOT_??? }, <--- UNIMPLEMENTED
+ { "node", LVT_COBJECT, offsetof(struct GraphNodeMasterList, node), true, LOT_GRAPHNODE },
+};
+
#define LUA_GRAPH_NODE_OBJECT_FIELD_COUNT 27
static struct LuaObjectField sGraphNodeObjectFields[LUA_GRAPH_NODE_OBJECT_FIELD_COUNT] = {
{ "activeAreaIndex", LVT_S8, offsetof(struct GraphNodeObject, activeAreaIndex), false, LOT_NONE },
@@ -967,6 +1065,83 @@ static struct LuaObjectField sGraphNodeObjectFields[LUA_GRAPH_NODE_OBJECT_FIELD_
{ "unk4C", LVT_COBJECT_P, offsetof(struct GraphNodeObject, unk4C), true, LOT_SPAWNINFO },
};
+#define LUA_GRAPH_NODE_OBJECT_PARENT_FIELD_COUNT 2
+static struct LuaObjectField sGraphNodeObjectParentFields[LUA_GRAPH_NODE_OBJECT_PARENT_FIELD_COUNT] = {
+ { "node", LVT_COBJECT, offsetof(struct GraphNodeObjectParent, node), true, LOT_GRAPHNODE },
+ { "sharedChild", LVT_COBJECT_P, offsetof(struct GraphNodeObjectParent, sharedChild), true, LOT_GRAPHNODE },
+};
+
+#define LUA_GRAPH_NODE_ORTHO_PROJECTION_FIELD_COUNT 2
+static struct LuaObjectField sGraphNodeOrthoProjectionFields[LUA_GRAPH_NODE_ORTHO_PROJECTION_FIELD_COUNT] = {
+ { "node", LVT_COBJECT, offsetof(struct GraphNodeOrthoProjection, node), true, LOT_GRAPHNODE },
+ { "scale", LVT_F32, offsetof(struct GraphNodeOrthoProjection, scale), false, LOT_NONE },
+};
+
+#define LUA_GRAPH_NODE_PERSPECTIVE_FIELD_COUNT 7
+static struct LuaObjectField sGraphNodePerspectiveFields[LUA_GRAPH_NODE_PERSPECTIVE_FIELD_COUNT] = {
+ { "far", LVT_S16, offsetof(struct GraphNodePerspective, far), false, LOT_NONE },
+ { "fnNode", LVT_COBJECT, offsetof(struct GraphNodePerspective, fnNode), true, LOT_FNGRAPHNODE },
+ { "fov", LVT_F32, offsetof(struct GraphNodePerspective, fov), false, LOT_NONE },
+ { "near", LVT_S16, offsetof(struct GraphNodePerspective, near), false, LOT_NONE },
+ { "prevFov", LVT_F32, offsetof(struct GraphNodePerspective, prevFov), false, LOT_NONE },
+ { "prevTimestamp", LVT_F32, offsetof(struct GraphNodePerspective, prevTimestamp), false, LOT_NONE },
+ { "unused", LVT_S32, offsetof(struct GraphNodePerspective, unused), true, LOT_NONE },
+};
+
+#define LUA_GRAPH_NODE_ROTATION_FIELD_COUNT 4
+static struct LuaObjectField sGraphNodeRotationFields[LUA_GRAPH_NODE_ROTATION_FIELD_COUNT] = {
+// { "displayList", LVT_???, offsetof(struct GraphNodeRotation, displayList), false, LOT_??? }, <--- UNIMPLEMENTED
+ { "node", LVT_COBJECT, offsetof(struct GraphNodeRotation, node), true, LOT_GRAPHNODE },
+ { "prevRotation", LVT_COBJECT, offsetof(struct GraphNodeRotation, prevRotation), true, LOT_VEC3S },
+ { "prevTimestamp", LVT_U32, offsetof(struct GraphNodeRotation, prevTimestamp), false, LOT_NONE },
+ { "rotation", LVT_COBJECT, offsetof(struct GraphNodeRotation, rotation), true, LOT_VEC3S },
+};
+
+#define LUA_GRAPH_NODE_SCALE_FIELD_COUNT 3
+static struct LuaObjectField sGraphNodeScaleFields[LUA_GRAPH_NODE_SCALE_FIELD_COUNT] = {
+// { "displayList", LVT_???, offsetof(struct GraphNodeScale, displayList), false, LOT_??? }, <--- UNIMPLEMENTED
+ { "node", LVT_COBJECT, offsetof(struct GraphNodeScale, node), true, LOT_GRAPHNODE },
+ { "prevScale", LVT_F32, offsetof(struct GraphNodeScale, prevScale), false, LOT_NONE },
+ { "scale", LVT_F32, offsetof(struct GraphNodeScale, scale), false, LOT_NONE },
+};
+
+#define LUA_GRAPH_NODE_SHADOW_FIELD_COUNT 4
+static struct LuaObjectField sGraphNodeShadowFields[LUA_GRAPH_NODE_SHADOW_FIELD_COUNT] = {
+ { "node", LVT_COBJECT, offsetof(struct GraphNodeShadow, node), true, LOT_GRAPHNODE },
+ { "shadowScale", LVT_S16, offsetof(struct GraphNodeShadow, shadowScale), false, LOT_NONE },
+ { "shadowSolidity", LVT_U8, offsetof(struct GraphNodeShadow, shadowSolidity), false, LOT_NONE },
+ { "shadowType", LVT_U8, offsetof(struct GraphNodeShadow, shadowType), false, LOT_NONE },
+};
+
+#define LUA_GRAPH_NODE_START_FIELD_COUNT 1
+static struct LuaObjectField sGraphNodeStartFields[LUA_GRAPH_NODE_START_FIELD_COUNT] = {
+ { "node", LVT_COBJECT, offsetof(struct GraphNodeStart, node), true, LOT_GRAPHNODE },
+};
+
+#define LUA_GRAPH_NODE_SWITCH_CASE_FIELD_COUNT 4
+static struct LuaObjectField sGraphNodeSwitchCaseFields[LUA_GRAPH_NODE_SWITCH_CASE_FIELD_COUNT] = {
+ { "fnNode", LVT_COBJECT, offsetof(struct GraphNodeSwitchCase, fnNode), true, LOT_FNGRAPHNODE },
+ { "numCases", LVT_S16, offsetof(struct GraphNodeSwitchCase, numCases), true, LOT_NONE },
+ { "selectedCase", LVT_S16, offsetof(struct GraphNodeSwitchCase, selectedCase), true, LOT_NONE },
+ { "unused", LVT_S32, offsetof(struct GraphNodeSwitchCase, unused), true, LOT_NONE },
+};
+
+#define LUA_GRAPH_NODE_TRANSLATION_FIELD_COUNT 2
+static struct LuaObjectField sGraphNodeTranslationFields[LUA_GRAPH_NODE_TRANSLATION_FIELD_COUNT] = {
+// { "displayList", LVT_???, offsetof(struct GraphNodeTranslation, displayList), false, LOT_??? }, <--- UNIMPLEMENTED
+ { "node", LVT_COBJECT, offsetof(struct GraphNodeTranslation, node), true, LOT_GRAPHNODE },
+// { "pad1E", LOT_???, offsetof(struct GraphNodeTranslation, pad1E), false, LOT_??? }, <--- UNIMPLEMENTED
+ { "translation", LVT_COBJECT, offsetof(struct GraphNodeTranslation, translation), true, LOT_VEC3S },
+};
+
+#define LUA_GRAPH_NODE_TRANSLATION_ROTATION_FIELD_COUNT 3
+static struct LuaObjectField sGraphNodeTranslationRotationFields[LUA_GRAPH_NODE_TRANSLATION_ROTATION_FIELD_COUNT] = {
+// { "displayList", LVT_???, offsetof(struct GraphNodeTranslationRotation, displayList), false, LOT_??? }, <--- UNIMPLEMENTED
+ { "node", LVT_COBJECT, offsetof(struct GraphNodeTranslationRotation, node), true, LOT_GRAPHNODE },
+ { "rotation", LVT_COBJECT, offsetof(struct GraphNodeTranslationRotation, rotation), true, LOT_VEC3S },
+ { "translation", LVT_COBJECT, offsetof(struct GraphNodeTranslationRotation, translation), true, LOT_VEC3S },
+};
+
#define LUA_GRAPH_NODE_802_A45_E4_FIELD_COUNT 6
static struct LuaObjectField sGraphNode_802A45E4Fields[LUA_GRAPH_NODE_802_A45_E4_FIELD_COUNT] = {
// { "0x00]", LOT_???, offsetof(struct GraphNode_802A45E4, 0x00]), false, LOT_??? }, <--- UNIMPLEMENTED
@@ -2481,88 +2656,110 @@ 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_ANIMATIONTABLE, sAnimationTableFields, LUA_ANIMATION_TABLE_FIELD_COUNT },
- { LOT_AREA, sAreaFields, LUA_AREA_FIELD_COUNT },
- { LOT_BEHAVIORDIALOGS, sBehaviorDialogsFields, LUA_BEHAVIOR_DIALOGS_FIELD_COUNT },
- { LOT_BEHAVIORTRAJECTORIES, sBehaviorTrajectoriesFields, LUA_BEHAVIOR_TRAJECTORIES_FIELD_COUNT },
- { LOT_BEHAVIORVALUES, sBehaviorValuesFields, LUA_BEHAVIOR_VALUES_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_CAMERAOVERRIDE, sCameraOverrideFields, LUA_CAMERA_OVERRIDE_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_CUSTOMLEVELINFO, sCustomLevelInfoFields, LUA_CUSTOM_LEVEL_INFO_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_DATETIME, sDateTimeFields, LUA_DATE_TIME_FIELD_COUNT },
- { LOT_DJUICOLOR, sDjuiColorFields, LUA_DJUI_COLOR_FIELD_COUNT },
- { LOT_DJUIINTERACTABLETHEME, sDjuiInteractableThemeFields, LUA_DJUI_INTERACTABLE_THEME_FIELD_COUNT },
- { LOT_DJUIPANELTHEME, sDjuiPanelThemeFields, LUA_DJUI_PANEL_THEME_FIELD_COUNT },
- { LOT_DJUITHEME, sDjuiThemeFields, LUA_DJUI_THEME_FIELD_COUNT },
- { LOT_DJUITHREEPANELTHEME, sDjuiThreePanelThemeFields, LUA_DJUI_THREE_PANEL_THEME_FIELD_COUNT },
- { LOT_EXCLAMATIONBOXCONTENT, sExclamationBoxContentFields, LUA_EXCLAMATION_BOX_CONTENT_FIELD_COUNT },
- { LOT_FIRSTPERSONCAMERA, sFirstPersonCameraFields, LUA_FIRST_PERSON_CAMERA_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_HUDUTILSROTATION, sHudUtilsRotationFields, LUA_HUD_UTILS_ROTATION_FIELD_COUNT },
- { LOT_INSTANTWARP, sInstantWarpFields, LUA_INSTANT_WARP_FIELD_COUNT },
- { LOT_LAKITUSTATE, sLakituStateFields, LUA_LAKITU_STATE_FIELD_COUNT },
- { LOT_LEVELVALUES, sLevelValuesFields, LUA_LEVEL_VALUES_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_MOD, sModFields, LUA_MOD_FIELD_COUNT },
- { LOT_MODAUDIO, sModAudioFields, LUA_MOD_AUDIO_FIELD_COUNT },
- { LOT_MODAUDIOSAMPLECOPIES, sModAudioSampleCopiesFields, LUA_MOD_AUDIO_SAMPLE_COPIES_FIELD_COUNT },
- { LOT_MODFILE, sModFileFields, LUA_MOD_FILE_FIELD_COUNT },
- { LOT_MODETRANSITIONINFO, sModeTransitionInfoFields, LUA_MODE_TRANSITION_INFO_FIELD_COUNT },
- { LOT_NAMETAGSSETTINGS, sNametagsSettingsFields, LUA_NAMETAGS_SETTINGS_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_PAINTING, sPaintingFields, LUA_PAINTING_FIELD_COUNT },
- { LOT_PAINTINGMESHVERTEX, sPaintingMeshVertexFields, LUA_PAINTING_MESH_VERTEX_FIELD_COUNT },
- { LOT_PAINTINGVALUES, sPaintingValuesFields, LUA_PAINTING_VALUES_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_PLAYERPALETTE, sPlayerPaletteFields, LUA_PLAYER_PALETTE_FIELD_COUNT },
- { LOT_RAYINTERSECTIONINFO, sRayIntersectionInfoFields, LUA_RAY_INTERSECTION_INFO_FIELD_COUNT },
- { LOT_SERVERSETTINGS, sServerSettingsFields, LUA_SERVER_SETTINGS_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_STARPOSITIONS, sStarPositionsFields, LUA_STAR_POSITIONS_FIELD_COUNT },
- { LOT_STARSNEEDEDFORDIALOG, sStarsNeededForDialogFields, LUA_STARS_NEEDED_FOR_DIALOG_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_ANIMATIONTABLE, sAnimationTableFields, LUA_ANIMATION_TABLE_FIELD_COUNT },
+ { LOT_AREA, sAreaFields, LUA_AREA_FIELD_COUNT },
+ { LOT_BEHAVIORDIALOGS, sBehaviorDialogsFields, LUA_BEHAVIOR_DIALOGS_FIELD_COUNT },
+ { LOT_BEHAVIORTRAJECTORIES, sBehaviorTrajectoriesFields, LUA_BEHAVIOR_TRAJECTORIES_FIELD_COUNT },
+ { LOT_BEHAVIORVALUES, sBehaviorValuesFields, LUA_BEHAVIOR_VALUES_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_CAMERAOVERRIDE, sCameraOverrideFields, LUA_CAMERA_OVERRIDE_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_CUSTOMLEVELINFO, sCustomLevelInfoFields, LUA_CUSTOM_LEVEL_INFO_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_DATETIME, sDateTimeFields, LUA_DATE_TIME_FIELD_COUNT },
+ { LOT_DISPLAYLISTNODE, sDisplayListNodeFields, LUA_DISPLAY_LIST_NODE_FIELD_COUNT },
+ { LOT_DJUICOLOR, sDjuiColorFields, LUA_DJUI_COLOR_FIELD_COUNT },
+ { LOT_DJUIINTERACTABLETHEME, sDjuiInteractableThemeFields, LUA_DJUI_INTERACTABLE_THEME_FIELD_COUNT },
+ { LOT_DJUIPANELTHEME, sDjuiPanelThemeFields, LUA_DJUI_PANEL_THEME_FIELD_COUNT },
+ { LOT_DJUITHEME, sDjuiThemeFields, LUA_DJUI_THEME_FIELD_COUNT },
+ { LOT_DJUITHREEPANELTHEME, sDjuiThreePanelThemeFields, LUA_DJUI_THREE_PANEL_THEME_FIELD_COUNT },
+ { LOT_EXCLAMATIONBOXCONTENT, sExclamationBoxContentFields, LUA_EXCLAMATION_BOX_CONTENT_FIELD_COUNT },
+ { LOT_FIRSTPERSONCAMERA, sFirstPersonCameraFields, LUA_FIRST_PERSON_CAMERA_FIELD_COUNT },
+ { LOT_FLOORGEOMETRY, sFloorGeometryFields, LUA_FLOOR_GEOMETRY_FIELD_COUNT },
+ { LOT_FNGRAPHNODE, sFnGraphNodeFields, LUA_FN_GRAPH_NODE_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_GRAPHNODEANIMATEDPART, sGraphNodeAnimatedPartFields, LUA_GRAPH_NODE_ANIMATED_PART_FIELD_COUNT },
+ { LOT_GRAPHNODEBACKGROUND, sGraphNodeBackgroundFields, LUA_GRAPH_NODE_BACKGROUND_FIELD_COUNT },
+ { LOT_GRAPHNODEBILLBOARD, sGraphNodeBillboardFields, LUA_GRAPH_NODE_BILLBOARD_FIELD_COUNT },
+ { LOT_GRAPHNODECAMERA, sGraphNodeCameraFields, LUA_GRAPH_NODE_CAMERA_FIELD_COUNT },
+ { LOT_GRAPHNODECULLINGRADIUS, sGraphNodeCullingRadiusFields, LUA_GRAPH_NODE_CULLING_RADIUS_FIELD_COUNT },
+ { LOT_GRAPHNODEDISPLAYLIST, sGraphNodeDisplayListFields, LUA_GRAPH_NODE_DISPLAY_LIST_FIELD_COUNT },
+ { LOT_GRAPHNODEGENERATED, sGraphNodeGeneratedFields, LUA_GRAPH_NODE_GENERATED_FIELD_COUNT },
+ { LOT_GRAPHNODEHELDOBJECT, sGraphNodeHeldObjectFields, LUA_GRAPH_NODE_HELD_OBJECT_FIELD_COUNT },
+ { LOT_GRAPHNODELEVELOFDETAIL, sGraphNodeLevelOfDetailFields, LUA_GRAPH_NODE_LEVEL_OF_DETAIL_FIELD_COUNT },
+ { LOT_GRAPHNODEMASTERLIST, sGraphNodeMasterListFields, LUA_GRAPH_NODE_MASTER_LIST_FIELD_COUNT },
+ { LOT_GRAPHNODEOBJECT, sGraphNodeObjectFields, LUA_GRAPH_NODE_OBJECT_FIELD_COUNT },
+ { LOT_GRAPHNODEOBJECTPARENT, sGraphNodeObjectParentFields, LUA_GRAPH_NODE_OBJECT_PARENT_FIELD_COUNT },
+ { LOT_GRAPHNODEORTHOPROJECTION, sGraphNodeOrthoProjectionFields, LUA_GRAPH_NODE_ORTHO_PROJECTION_FIELD_COUNT },
+ { LOT_GRAPHNODEPERSPECTIVE, sGraphNodePerspectiveFields, LUA_GRAPH_NODE_PERSPECTIVE_FIELD_COUNT },
+ { LOT_GRAPHNODEROTATION, sGraphNodeRotationFields, LUA_GRAPH_NODE_ROTATION_FIELD_COUNT },
+ { LOT_GRAPHNODESCALE, sGraphNodeScaleFields, LUA_GRAPH_NODE_SCALE_FIELD_COUNT },
+ { LOT_GRAPHNODESHADOW, sGraphNodeShadowFields, LUA_GRAPH_NODE_SHADOW_FIELD_COUNT },
+ { LOT_GRAPHNODESTART, sGraphNodeStartFields, LUA_GRAPH_NODE_START_FIELD_COUNT },
+ { LOT_GRAPHNODESWITCHCASE, sGraphNodeSwitchCaseFields, LUA_GRAPH_NODE_SWITCH_CASE_FIELD_COUNT },
+ { LOT_GRAPHNODETRANSLATION, sGraphNodeTranslationFields, LUA_GRAPH_NODE_TRANSLATION_FIELD_COUNT },
+ { LOT_GRAPHNODETRANSLATIONROTATION, sGraphNodeTranslationRotationFields, LUA_GRAPH_NODE_TRANSLATION_ROTATION_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_HUDUTILSROTATION, sHudUtilsRotationFields, LUA_HUD_UTILS_ROTATION_FIELD_COUNT },
+ { LOT_INSTANTWARP, sInstantWarpFields, LUA_INSTANT_WARP_FIELD_COUNT },
+ { LOT_LAKITUSTATE, sLakituStateFields, LUA_LAKITU_STATE_FIELD_COUNT },
+ { LOT_LEVELVALUES, sLevelValuesFields, LUA_LEVEL_VALUES_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_MOD, sModFields, LUA_MOD_FIELD_COUNT },
+ { LOT_MODAUDIO, sModAudioFields, LUA_MOD_AUDIO_FIELD_COUNT },
+ { LOT_MODAUDIOSAMPLECOPIES, sModAudioSampleCopiesFields, LUA_MOD_AUDIO_SAMPLE_COPIES_FIELD_COUNT },
+ { LOT_MODFILE, sModFileFields, LUA_MOD_FILE_FIELD_COUNT },
+ { LOT_MODETRANSITIONINFO, sModeTransitionInfoFields, LUA_MODE_TRANSITION_INFO_FIELD_COUNT },
+ { LOT_NAMETAGSSETTINGS, sNametagsSettingsFields, LUA_NAMETAGS_SETTINGS_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_PAINTING, sPaintingFields, LUA_PAINTING_FIELD_COUNT },
+ { LOT_PAINTINGMESHVERTEX, sPaintingMeshVertexFields, LUA_PAINTING_MESH_VERTEX_FIELD_COUNT },
+ { LOT_PAINTINGVALUES, sPaintingValuesFields, LUA_PAINTING_VALUES_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_PLAYERPALETTE, sPlayerPaletteFields, LUA_PLAYER_PALETTE_FIELD_COUNT },
+ { LOT_RAYINTERSECTIONINFO, sRayIntersectionInfoFields, LUA_RAY_INTERSECTION_INFO_FIELD_COUNT },
+ { LOT_SERVERSETTINGS, sServerSettingsFields, LUA_SERVER_SETTINGS_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_STARPOSITIONS, sStarPositionsFields, LUA_STAR_POSITIONS_FIELD_COUNT },
+ { LOT_STARSNEEDEDFORDIALOG, sStarsNeededForDialogFields, LUA_STARS_NEEDED_FOR_DIALOG_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) {
diff --git a/src/pc/lua/smlua_cobject_autogen.h b/src/pc/lua/smlua_cobject_autogen.h
index b3fbbc238..d21796b0c 100644
--- a/src/pc/lua/smlua_cobject_autogen.h
+++ b/src/pc/lua/smlua_cobject_autogen.h
@@ -26,6 +26,7 @@ enum LuaObjectAutogenType {
LOT_CUTSCENESPLINEPOINT,
LOT_CUTSCENEVARIABLE,
LOT_DATETIME,
+ LOT_DISPLAYLISTNODE,
LOT_DJUICOLOR,
LOT_DJUIINTERACTABLETHEME,
LOT_DJUIPANELTHEME,
@@ -34,11 +35,32 @@ enum LuaObjectAutogenType {
LOT_EXCLAMATIONBOXCONTENT,
LOT_FIRSTPERSONCAMERA,
LOT_FLOORGEOMETRY,
+ LOT_FNGRAPHNODE,
LOT_GLOBALOBJECTANIMATIONS,
LOT_GLOBALOBJECTCOLLISIONDATA,
LOT_GLOBALTEXTURES,
LOT_GRAPHNODE,
+ LOT_GRAPHNODEANIMATEDPART,
+ LOT_GRAPHNODEBACKGROUND,
+ LOT_GRAPHNODEBILLBOARD,
+ LOT_GRAPHNODECAMERA,
+ LOT_GRAPHNODECULLINGRADIUS,
+ LOT_GRAPHNODEDISPLAYLIST,
+ LOT_GRAPHNODEGENERATED,
+ LOT_GRAPHNODEHELDOBJECT,
+ LOT_GRAPHNODELEVELOFDETAIL,
+ LOT_GRAPHNODEMASTERLIST,
LOT_GRAPHNODEOBJECT,
+ LOT_GRAPHNODEOBJECTPARENT,
+ LOT_GRAPHNODEORTHOPROJECTION,
+ LOT_GRAPHNODEPERSPECTIVE,
+ LOT_GRAPHNODEROTATION,
+ LOT_GRAPHNODESCALE,
+ LOT_GRAPHNODESHADOW,
+ LOT_GRAPHNODESTART,
+ LOT_GRAPHNODESWITCHCASE,
+ LOT_GRAPHNODETRANSLATION,
+ LOT_GRAPHNODETRANSLATIONROTATION,
LOT_GRAPHNODE_802A45E4,
LOT_HANDHELDSHAKEPOINT,
LOT_HUDUTILSROTATION,
diff --git a/src/pc/lua/smlua_functions.c b/src/pc/lua/smlua_functions.c
index 4e4fbf410..0db48a484 100644
--- a/src/pc/lua/smlua_functions.c
+++ b/src/pc/lua/smlua_functions.c
@@ -946,6 +946,69 @@ int smlua_func_collision_find_surface_on_ray(lua_State* L) {
return 1;
}
+ ////////////////
+ // graph node //
+////////////////
+
+typedef struct { s16 type; u16 lot; } GraphNodeLot;
+static GraphNodeLot graphNodeLots[23] = {
+ { GRAPH_NODE_TYPE_ANIMATED_PART, LOT_GRAPHNODEANIMATEDPART },
+ { GRAPH_NODE_TYPE_BACKGROUND, LOT_GRAPHNODEBACKGROUND },
+ { GRAPH_NODE_TYPE_BILLBOARD, LOT_GRAPHNODEBILLBOARD },
+ { GRAPH_NODE_TYPE_CAMERA, LOT_GRAPHNODECAMERA },
+ { GRAPH_NODE_TYPE_CULLING_RADIUS, LOT_GRAPHNODECULLINGRADIUS },
+ { GRAPH_NODE_TYPE_DISPLAY_LIST, LOT_GRAPHNODEDISPLAYLIST },
+ { GRAPH_NODE_TYPE_FUNCTIONAL, LOT_FNGRAPHNODE },
+ { GRAPH_NODE_TYPE_GENERATED_LIST, LOT_GRAPHNODEGENERATED },
+ { GRAPH_NODE_TYPE_HELD_OBJ, LOT_GRAPHNODEHELDOBJECT },
+ { GRAPH_NODE_TYPE_LEVEL_OF_DETAIL, LOT_GRAPHNODELEVELOFDETAIL },
+ { GRAPH_NODE_TYPE_MASTER_LIST, LOT_GRAPHNODEMASTERLIST },
+ { GRAPH_NODE_TYPE_OBJECT, LOT_GRAPHNODEOBJECT },
+ { GRAPH_NODE_TYPE_OBJECT_PARENT, LOT_GRAPHNODEOBJECTPARENT },
+ { GRAPH_NODE_TYPE_ORTHO_PROJECTION, LOT_GRAPHNODEORTHOPROJECTION },
+ { GRAPH_NODE_TYPE_PERSPECTIVE, LOT_GRAPHNODEPERSPECTIVE },
+ { GRAPH_NODE_TYPE_ROOT, LOT_GRAPHNODE },
+ { GRAPH_NODE_TYPE_ROTATION, LOT_GRAPHNODEROTATION },
+ { GRAPH_NODE_TYPE_SCALE, LOT_GRAPHNODESCALE },
+ { GRAPH_NODE_TYPE_SHADOW, LOT_GRAPHNODESHADOW },
+ { GRAPH_NODE_TYPE_START, LOT_GRAPHNODESTART },
+ { GRAPH_NODE_TYPE_SWITCH_CASE, LOT_GRAPHNODESWITCHCASE },
+ { GRAPH_NODE_TYPE_TRANSLATION, LOT_GRAPHNODETRANSLATION },
+ { GRAPH_NODE_TYPE_TRANSLATION_ROTATION, LOT_GRAPHNODETRANSLATIONROTATION },
+};
+
+int smlua_func_cast_graph_node(lua_State* L) {
+ if (!smlua_functions_valid_param_count(L, 1)) { return 0; }
+
+ struct GraphNode* graphNode;
+
+ if (smlua_is_cobject(L, 1, LOT_GRAPHNODE)) {
+ graphNode = (struct GraphNode*)smlua_to_cobject(L, 1, LOT_GRAPHNODE);
+ if (!gSmLuaConvertSuccess) { LOG_LUA("cast_graph_node: Failed to convert parameter 1"); return 0; }
+ } else if (smlua_is_cobject(L, 1, LOT_FNGRAPHNODE)) {
+ graphNode = (struct GraphNode*)smlua_to_cobject(L, 1, LOT_FNGRAPHNODE);
+ if (!gSmLuaConvertSuccess) { LOG_LUA("cast_graph_node: Failed to convert parameter 1"); return 0; }
+ } else {
+ LOG_LUA("cast_graph_node: Failed to convert parameter 1");
+ return 0;
+ }
+
+ u16 lot = 0;
+ for (u8 i = 0; i != 23; i++) {
+ if (graphNode->type != graphNodeLots[i].type) continue;
+ lot = graphNodeLots[i].lot;
+ break;
+ }
+ if (lot == 0) {
+ LOG_LUA("cast_graph_node: Invalid GraphNode type");
+ return 0;
+ }
+
+ smlua_push_object(L, lot, graphNode);
+
+ return 1;
+}
+
//////////
// bind //
//////////
@@ -975,4 +1038,5 @@ void smlua_bind_functions(void) {
smlua_bind_function(L, "log_to_console", smlua_func_log_to_console);
smlua_bind_function(L, "add_scroll_target", smlua_func_add_scroll_target);
smlua_bind_function(L, "collision_find_surface_on_ray", smlua_func_collision_find_surface_on_ray);
+ smlua_bind_function(L, "cast_graph_node", smlua_func_cast_graph_node);
}