diff --git a/autogen/convert_structs.py b/autogen/convert_structs.py index e4a22c65..a633aa09 100644 --- a/autogen/convert_structs.py +++ b/autogen/convert_structs.py @@ -102,7 +102,7 @@ override_field_immutable = { "SpawnInfo": [ "syncID", "next", "unk18" ], "CustomLevelInfo": [ "next" ], "GraphNode": [ "children", "next", "parent", "prev", "type" ], - "GraphNodeObject": [ "activeAreaIndex", "angle", "animInfo", "areaIndex", "cameraToObject", "node", "pos", "prevAngle", "prevPos", "prevScale", "prevScaleTimestamp", "prevShadowPos", "prevShadowPosTimestamp", "prevThrowMatrix", "prevThrowMatrixTimestamp", "prevTimestamp", "scale", "shadowPos", "sharedChild", "skipInterpolationTimestamp", "throwMatrix", "throwMatrixPrev", "unk4C", ], + "GraphNodeObject": [ "angle", "animInfo", "cameraToObject", "node", "pos", "prevAngle", "prevPos", "prevScale", "prevScaleTimestamp", "prevShadowPos", "prevShadowPosTimestamp", "prevThrowMatrix", "prevThrowMatrixTimestamp", "prevTimestamp", "scale", "shadowPos", "sharedChild", "skipInterpolationTimestamp", "throwMatrix", "throwMatrixPrev", "unk4C", ], "ObjectWarpNode": [ "next "], "Animation": [ "length" ], "AnimationTable": [ "count" ], diff --git a/autogen/lua_definitions/structs.lua b/autogen/lua_definitions/structs.lua index ebf14903..8ef6f82d 100644 --- a/autogen/lua_definitions/structs.lua +++ b/autogen/lua_definitions/structs.lua @@ -17,12 +17,14 @@ --- @field public animYTransDivisor integer --- @field public flags integer --- @field public index Pointer_integer +--- @field public indexLength integer --- @field public length integer --- @field public loopEnd integer --- @field public loopStart integer --- @field public startFrame integer --- @field public unusedBoneCount integer --- @field public values Pointer_integer +--- @field public valuesLength integer --- @class AnimationTable --- @field public count integer diff --git a/docs/lua/structs.md b/docs/lua/structs.md index 1aff3a86..79ab774b 100644 --- a/docs/lua/structs.md +++ b/docs/lua/structs.md @@ -108,12 +108,14 @@ | animYTransDivisor | `integer` | | | flags | `integer` | | | index | `Pointer` <`integer`> | | +| indexLength | `integer` | | | length | `integer` | read-only | | loopEnd | `integer` | | | loopStart | `integer` | | | startFrame | `integer` | | | unusedBoneCount | `integer` | | | values | `Pointer` <`integer`> | | +| valuesLength | `integer` | | [:arrow_up_small:](#) @@ -826,10 +828,10 @@ | Field | Type | Access | | ----- | ---- | ------ | -| activeAreaIndex | `integer` | read-only | +| activeAreaIndex | `integer` | | | angle | [Vec3s](structs.md#Vec3s) | read-only | | animInfo | [AnimInfo](structs.md#AnimInfo) | read-only | -| areaIndex | `integer` | read-only | +| areaIndex | `integer` | | | cameraToObject | [Vec3f](structs.md#Vec3f) | read-only | | disableAutomaticShadowPos | `boolean` | | | node | [GraphNode](structs.md#GraphNode) | read-only | diff --git a/src/engine/graph_node.c b/src/engine/graph_node.c index eb2c9221..1cc9dce9 100644 --- a/src/engine/graph_node.c +++ b/src/engine/graph_node.c @@ -840,7 +840,7 @@ s16 retrieve_animation_value(struct Animation *animation, s32 frame, u16 **attri if ((offset + 1) >= animation->indexLength) { return 0; } // validate frame - if (frame < 0) { return 0; } + if (frame < 0) { frame = 0; } // retrieve animation index s32 index = 0; diff --git a/src/engine/level_script.c b/src/engine/level_script.c index fe9a14ac..1f24f0e2 100644 --- a/src/engine/level_script.c +++ b/src/engine/level_script.c @@ -377,9 +377,9 @@ static void level_reset_globals(void) { gAreas[i].unk04 = NULL; } - // clear mariostate spawninfo pointers + // reset mariostate spawninfo pointers for (int i = 0; i < MAX_PLAYERS; i++) { - gMarioStates[i].spawnInfo = NULL; + gMarioStates[i].spawnInfo = &gPlayerSpawnInfos[i]; } // free models stored in dynos diff --git a/src/pc/lua/smlua_cobject_autogen.c b/src/pc/lua/smlua_cobject_autogen.c index 8966c05c..7bfd0763 100644 --- a/src/pc/lua/smlua_cobject_autogen.c +++ b/src/pc/lua/smlua_cobject_autogen.c @@ -38,17 +38,19 @@ static struct LuaObjectField sAnimInfoFields[LUA_ANIM_INFO_FIELD_COUNT] = { { "prevAnimPtr", LVT_COBJECT_P, offsetof(struct AnimInfo, prevAnimPtr), false, LOT_ANIMATION }, }; -#define LUA_ANIMATION_FIELD_COUNT 9 +#define LUA_ANIMATION_FIELD_COUNT 11 static struct LuaObjectField sAnimationFields[LUA_ANIMATION_FIELD_COUNT] = { { "animYTransDivisor", LVT_S16, offsetof(struct Animation, animYTransDivisor), false, LOT_NONE }, { "flags", LVT_S16, offsetof(struct Animation, flags), false, LOT_NONE }, { "index", LVT_U16_P, offsetof(struct Animation, index), false, LOT_POINTER }, + { "indexLength", LVT_U32, offsetof(struct Animation, indexLength), false, LOT_NONE }, { "length", LVT_U32, offsetof(struct Animation, length), true, LOT_NONE }, { "loopEnd", LVT_S16, offsetof(struct Animation, loopEnd), false, LOT_NONE }, { "loopStart", LVT_S16, offsetof(struct Animation, loopStart), false, LOT_NONE }, { "startFrame", LVT_S16, offsetof(struct Animation, startFrame), false, LOT_NONE }, { "unusedBoneCount", LVT_S16, offsetof(struct Animation, unusedBoneCount), false, LOT_NONE }, { "values", LVT_S16_P, offsetof(struct Animation, values), false, LOT_POINTER }, + { "valuesLength", LVT_U32, offsetof(struct Animation, valuesLength), false, LOT_NONE }, }; #define LUA_ANIMATION_TABLE_FIELD_COUNT 1 @@ -644,10 +646,10 @@ static struct LuaObjectField sGraphNodeFields[LUA_GRAPH_NODE_FIELD_COUNT] = { #define LUA_GRAPH_NODE_OBJECT_FIELD_COUNT 26 static struct LuaObjectField sGraphNodeObjectFields[LUA_GRAPH_NODE_OBJECT_FIELD_COUNT] = { - { "activeAreaIndex", LVT_S8, offsetof(struct GraphNodeObject, activeAreaIndex), true, LOT_NONE }, + { "activeAreaIndex", LVT_S8, offsetof(struct GraphNodeObject, activeAreaIndex), false, LOT_NONE }, { "angle", LVT_COBJECT, offsetof(struct GraphNodeObject, angle), true, LOT_VEC3S }, { "animInfo", LVT_COBJECT, offsetof(struct GraphNodeObject, animInfo), true, LOT_ANIMINFO }, - { "areaIndex", LVT_S8, offsetof(struct GraphNodeObject, areaIndex), true, LOT_NONE }, + { "areaIndex", LVT_S8, offsetof(struct GraphNodeObject, areaIndex), false, LOT_NONE }, { "cameraToObject", LVT_COBJECT, offsetof(struct GraphNodeObject, cameraToObject), true, LOT_VEC3F }, { "disableAutomaticShadowPos", LVT_BOOL, offsetof(struct GraphNodeObject, disableAutomaticShadowPos), false, LOT_NONE }, { "node", LVT_COBJECT, offsetof(struct GraphNodeObject, node), true, LOT_GRAPHNODE },