fix nametags and collisions with mirror mario

This commit is contained in:
Isaac0-dev 2025-01-19 13:46:28 +10:00
parent 884c39950f
commit 75b71e9b4d
6 changed files with 9 additions and 2 deletions

View file

@ -328,6 +328,7 @@ struct MarioBodyState
/*????*/ f32 lightingDirY;
/*????*/ f32 lightingDirZ;
/*????*/ u8 allowPartRotation;
/*????*/ bool mirrorMario; // some of these fields are updated for Mirror Mario too
// u8 padding[4];
};

View file

@ -1273,6 +1273,7 @@ static u8 resolve_player_collision(struct MarioState* m, struct MarioState* m2)
f32 radius = m->marioObj->hitboxRadius * 2.0f;
if (!m->marioBodyState || !m2->marioBodyState) { return FALSE; }
if (m->marioBodyState->mirrorMario || m2->marioBodyState->mirrorMario) { return FALSE; }
f32* localTorso = m->marioBodyState->torsoPos;
f32* remoteTorso = m2->marioBodyState->torsoPos;

View file

@ -424,6 +424,7 @@ Gfx* geo_mario_tilt_torso(s32 callContext, struct GraphNode* node, Mat4* mtx) {
u8 plrIdx = geo_get_processing_object_index();
struct MarioBodyState* bodyState = &gBodyStates[plrIdx];
s32 action = bodyState->action;
bodyState->mirrorMario = gCurGraphNodeObject == &gMirrorMario[plrIdx];
u8 charIndex = gNetworkPlayers[plrIdx].overrideModelIndex;
if (charIndex >= CT_MAX) { charIndex = 0; }
@ -458,6 +459,7 @@ Gfx* geo_mario_head_rotation(s32 callContext, struct GraphNode* node, Mat4* c) {
u8 plrIdx = geo_get_processing_object_index();
struct MarioBodyState* bodyState = &gBodyStates[plrIdx];
s32 action = bodyState->action;
bodyState->mirrorMario = gCurGraphNodeObject == &gMirrorMario[plrIdx];
bool marioActive = gMarioObjects[plrIdx] != NULL && gMarioObjects[plrIdx]->activeFlags != ACTIVE_FLAG_DEACTIVATED;
@ -805,6 +807,7 @@ Gfx* geo_mario_set_player_colors(s32 callContext, struct GraphNode* node, UNUSED
gNetworkPlayerColors[index] = color;
struct MarioBodyState* bodyState = &gBodyStates[index];
bodyState->mirrorMario = gCurGraphNodeObject == &gMirrorMario[index];
if (callContext == GEO_CONTEXT_RENDER) {
gfx = geo_mario_create_player_colors_dl(index, NULL, NULL);

View file

@ -26,6 +26,8 @@ int detect_player_hitbox_overlap(struct MarioState* local, struct MarioState* re
if (!local || !remote) { return FALSE; }
if (local->marioObj == NULL || local->marioObj->oIntangibleTimer != 0) { return FALSE; }
if (remote->marioObj == NULL || remote->marioObj->oIntangibleTimer != 0) { return FALSE; }
if (local->marioBodyState->mirrorMario) { return FALSE; }
if (remote->marioBodyState->mirrorMario) { return FALSE; }
struct Object* a = local->marioObj;
f32* aTorso = local->marioBodyState->torsoPos;

View file

@ -277,7 +277,7 @@ void bhv_mario_update(void) {
// sanity check torsoPos, it isn't updated off-screen otherwise
extern u32 gGlobalTimer;
if (gMarioState->marioBodyState && gMarioState->marioBodyState->updateTorsoTime != (gGlobalTimer - 1)) {
if (gMarioState->marioBodyState && !gMarioState->marioBodyState->mirrorMario && gMarioState->marioBodyState->updateTorsoTime != (gGlobalTimer - 1)) {
vec3f_copy(gMarioState->marioBodyState->torsoPos, gMarioState->pos);
}

View file

@ -80,7 +80,7 @@ void nametags_render(void) {
continue;
}
if (m->marioBodyState->updateHeadPosTime != gGlobalTimer) { continue; }
if (m->marioBodyState->mirrorMario || m->marioBodyState->updateHeadPosTime != gGlobalTimer) { continue; }
Vec3f pos;
Vec3f out;