Add headPos to marioBodyState

This commit is contained in:
MysterD 2022-04-20 18:21:36 -07:00
parent 2347ab61c1
commit 18d7140954
5 changed files with 11 additions and 2 deletions

View file

@ -596,6 +596,7 @@
--- @field public grabPos integer --- @field public grabPos integer
--- @field public handState integer --- @field public handState integer
--- @field public headAngle Vec3s --- @field public headAngle Vec3s
--- @field public headPos Vec3f
--- @field public heldObjLastPosition Vec3f --- @field public heldObjLastPosition Vec3f
--- @field public modelState integer --- @field public modelState integer
--- @field public punchState integer --- @field public punchState integer

View file

@ -879,6 +879,7 @@
| grabPos | `integer` | | | grabPos | `integer` | |
| handState | `integer` | | | handState | `integer` | |
| headAngle | [Vec3s](structs.md#Vec3s) | read-only | | headAngle | [Vec3s](structs.md#Vec3s) | read-only |
| headPos | [Vec3f](structs.md#Vec3f) | read-only |
| heldObjLastPosition | [Vec3f](structs.md#Vec3f) | read-only | | heldObjLastPosition | [Vec3f](structs.md#Vec3f) | read-only |
| modelState | `integer` | | | modelState | `integer` | |
| punchState | `integer` | | | punchState | `integer` | |

View file

@ -281,6 +281,7 @@ struct MarioBodyState
/*????*/ Vec3f torsoPos; /*????*/ Vec3f torsoPos;
/*????*/ Vec3f handFootPos[4]; /*????*/ Vec3f handFootPos[4];
/*????*/ u32 updateTorsoTime; /*????*/ u32 updateTorsoTime;
/*????*/ Vec3f headPos;
//u8 padding[4]; //u8 padding[4];
}; };

View file

@ -522,7 +522,7 @@ Gfx* geo_mario_tilt_torso(s32 callContext, struct GraphNode* node, Mat4* mtx) {
/** /**
* Makes Mario's head rotate with the camera angle when in C-up mode * Makes Mario's head rotate with the camera angle when in C-up mode
*/ */
Gfx* geo_mario_head_rotation(s32 callContext, struct GraphNode* node, UNUSED Mat4* c) { Gfx* geo_mario_head_rotation(s32 callContext, struct GraphNode* node, Mat4* c) {
u8 plrIdx = geo_get_processing_object_index(); u8 plrIdx = geo_get_processing_object_index();
struct MarioBodyState* bodyState = &gBodyStates[plrIdx]; struct MarioBodyState* bodyState = &gBodyStates[plrIdx];
s32 action = bodyState->action; s32 action = bodyState->action;
@ -553,6 +553,11 @@ Gfx* geo_mario_head_rotation(s32 callContext, struct GraphNode* node, UNUSED Mat
vec3s_copy(rotNode->prevRotation, rotNode->rotation); vec3s_copy(rotNode->prevRotation, rotNode->rotation);
rotNode->prevTimestamp = gGlobalTimer; rotNode->prevTimestamp = gGlobalTimer;
} }
// update head position in bodyState
get_pos_from_transform_mtx(bodyState->headPos,
*c,
*gCurGraphNodeCamera->matrixPtr);
} }
return NULL; return NULL;
} }

View file

@ -693,7 +693,7 @@ static struct LuaObjectField sMarioAnimationFields[LUA_MARIO_ANIMATION_FIELD_COU
{ "targetAnim", LVT_COBJECT_P, offsetof(struct MarioAnimation, targetAnim), false, LOT_ANIMATION }, { "targetAnim", LVT_COBJECT_P, offsetof(struct MarioAnimation, targetAnim), false, LOT_ANIMATION },
}; };
#define LUA_MARIO_BODY_STATE_FIELD_COUNT 13 #define LUA_MARIO_BODY_STATE_FIELD_COUNT 14
static struct LuaObjectField sMarioBodyStateFields[LUA_MARIO_BODY_STATE_FIELD_COUNT] = { static struct LuaObjectField sMarioBodyStateFields[LUA_MARIO_BODY_STATE_FIELD_COUNT] = {
{ "action", LVT_U32, offsetof(struct MarioBodyState, action), false, LOT_NONE }, { "action", LVT_U32, offsetof(struct MarioBodyState, action), false, LOT_NONE },
{ "capState", LVT_S8, offsetof(struct MarioBodyState, capState), false, LOT_NONE }, { "capState", LVT_S8, offsetof(struct MarioBodyState, capState), false, LOT_NONE },
@ -702,6 +702,7 @@ static struct LuaObjectField sMarioBodyStateFields[LUA_MARIO_BODY_STATE_FIELD_CO
// { "handFootPos", LOT_???, offsetof(struct MarioBodyState, handFootPos), false, LOT_??? }, <--- UNIMPLEMENTED // { "handFootPos", LOT_???, offsetof(struct MarioBodyState, handFootPos), false, LOT_??? }, <--- UNIMPLEMENTED
{ "handState", LVT_S8, offsetof(struct MarioBodyState, handState), false, LOT_NONE }, { "handState", LVT_S8, offsetof(struct MarioBodyState, handState), false, LOT_NONE },
{ "headAngle", LVT_COBJECT, offsetof(struct MarioBodyState, headAngle), true, LOT_VEC3S }, { "headAngle", LVT_COBJECT, offsetof(struct MarioBodyState, headAngle), true, LOT_VEC3S },
{ "headPos", LVT_COBJECT, offsetof(struct MarioBodyState, headPos), true, LOT_VEC3F },
{ "heldObjLastPosition", LVT_COBJECT, offsetof(struct MarioBodyState, heldObjLastPosition), true, LOT_VEC3F }, { "heldObjLastPosition", LVT_COBJECT, offsetof(struct MarioBodyState, heldObjLastPosition), true, LOT_VEC3F },
{ "modelState", LVT_S16, offsetof(struct MarioBodyState, modelState), false, LOT_NONE }, { "modelState", LVT_S16, offsetof(struct MarioBodyState, modelState), false, LOT_NONE },
{ "punchState", LVT_U8, offsetof(struct MarioBodyState, punchState), false, LOT_NONE }, { "punchState", LVT_U8, offsetof(struct MarioBodyState, punchState), false, LOT_NONE },