From f8b5f2a9f6f0ca7e7eff195580ae8116da321d1f Mon Sep 17 00:00:00 2001 From: Isaac0-dev <62234577+Isaac0-dev@users.noreply.github.com> Date: Tue, 28 May 2024 17:51:32 +1000 Subject: [PATCH] some nametags improvements (#50) - crouching now hides your nametag entirely - nametag transparency is now based on player opacity - nametags are no longer rendered while the player does not have a valid area sync --- src/pc/nametags.c | 22 +++++++++++++++------- 1 file changed, 15 insertions(+), 7 deletions(-) diff --git a/src/pc/nametags.c b/src/pc/nametags.c index a53979380..ac12be8d8 100644 --- a/src/pc/nametags.c +++ b/src/pc/nametags.c @@ -28,7 +28,7 @@ void name_without_hex(char* input) { input[j++] = input[i]; // it just works } } - + input[j] = '\0'; } @@ -63,6 +63,18 @@ void nametags_render(void) { struct MarioState* m = &gMarioStates[i]; if (!is_player_active(m)) { continue; } struct NetworkPlayer* np = &gNetworkPlayers[i]; + if (!np->currAreaSyncValid) { continue; } + + switch (m->action) { + case ACT_START_CROUCHING: + case ACT_CROUCHING: + case ACT_STOP_CROUCHING: + case ACT_START_CRAWLING: + case ACT_CRAWLING: + case ACT_STOP_CRAWLING: + continue; + } + Vec3f pos; Vec3f out; vec3f_copy(pos, m->marioObj->header.gfx.pos); @@ -88,12 +100,8 @@ void nametags_render(void) { np->palette.parts[CAP][2] }; f32 measure = djui_hud_measure_text(name) * scale * 0.5f; - f32 alpha = m->action == ACT_START_CROUCHING || - m->action == ACT_CROUCHING || - m->action == ACT_STOP_CROUCHING || - m->action == ACT_START_CRAWLING || - m->action == ACT_CRAWLING || - m->action == ACT_STOP_CRAWLING ? 100 : 255; + + f32 alpha = (np->fadeOpacity / 32) * 255; struct StateExtras* e = &sStateExtras[i]; djui_hud_print_outlined_text_interpolated(name, e->prevPos[0] - measure, e->prevPos[1], e->prevScale, out[0] - measure, out[1], scale, color[0], color[1], color[2], alpha, 0.25);