cleaner fix for headPos bug nametags

This commit is contained in:
Isaac0-dev 2025-01-07 07:55:59 +10:00
parent 3c0e14f9ef
commit 9ddc7311f1
3 changed files with 6 additions and 4 deletions

View file

@ -317,6 +317,7 @@ struct MarioBodyState
/*????*/ Vec3f handFootPos[4];
/*????*/ u32 updateTorsoTime;
/*????*/ Vec3f headPos;
/*????*/ u32 updateHeadPosTime;
/*????*/ u16 shadeR; /// shadow red value
/*????*/ u16 shadeG; /// shadow green value
/*????*/ u16 shadeB; /// shadow blue value

View file

@ -432,7 +432,7 @@ Gfx* geo_mario_tilt_torso(s32 callContext, struct GraphNode* node, Mat4* mtx) {
if (callContext == GEO_CONTEXT_RENDER) {
struct GraphNodeRotation* rotNode = (struct GraphNodeRotation*) node->next;
if (action != ACT_BUTT_SLIDE && action != ACT_HOLD_BUTT_SLIDE && action != ACT_WALKING && action != ACT_RIDING_SHELL_GROUND
if (action != ACT_BUTT_SLIDE && action != ACT_HOLD_BUTT_SLIDE && action != ACT_WALKING && action != ACT_RIDING_SHELL_GROUND
&& !bodyState->allowPartRotation) {
vec3s_copy(bodyState->torsoAngle, gVec3sZero);
}
@ -490,6 +490,7 @@ Gfx* geo_mario_head_rotation(s32 callContext, struct GraphNode* node, Mat4* c) {
get_pos_from_transform_mtx(bodyState->headPos,
*c,
*gCurGraphNodeCamera->matrixPtr);
bodyState->updateHeadPosTime = gGlobalTimer;
}
return NULL;
}

View file

@ -80,12 +80,12 @@ void nametags_render(void) {
continue;
}
if (!djui_hud_world_pos_to_screen_pos(m->marioObj->header.gfx.pos, (Vec3f){})) { continue; }
if (m->marioBodyState->updateHeadPosTime != gGlobalTimer) { continue; }
Vec3f pos;
Vec3f out;
vec3f_copy(pos, m->marioObj->header.gfx.pos);
pos[1] += 200;
vec3f_copy(pos, m->marioBodyState->headPos);
pos[1] += 100;
if (djui_hud_world_pos_to_screen_pos(pos, out) &&
(i != 0 || (i == 0 && m->action != ACT_FIRST_PERSON))) {