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
This commit is contained in:
parent
d9e50581ff
commit
f8b5f2a9f6
|
@ -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);
|
||||
|
|
Loading…
Reference in New Issue