Fix some bugs found in testing

This commit is contained in:
MysterD 2023-05-18 17:54:29 -07:00
parent 41a4fcf516
commit b0408a1379
6 changed files with 15 additions and 9 deletions

View file

@ -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" ],

View file

@ -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

View file

@ -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 |

View file

@ -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;

View file

@ -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

View file

@ -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 },