Show nametags in replays, fix in splitscreen

This commit is contained in:
Sally Coolatta 2020-07-20 16:02:46 -04:00
parent 17b244969b
commit 3190edd666

View file

@ -9863,7 +9863,8 @@ static void K_ObjectTracking(fixed_t *hud_x, fixed_t *hud_y, vertex_t *campos, a
{ {
*hud_y /= 2; *hud_y /= 2;
if (camnum > 1) if ((r_splitscreen == 1 && camnum == 1)
|| (r_splitscreen > 1 && camnum > 1))
{ {
*hud_y += shhalffixed; *hud_y += shhalffixed;
} }
@ -9977,6 +9978,30 @@ static void K_drawKartPlayerCheck(void)
} }
} }
static boolean K_ShowPlayerNametag(player_t *p)
{
if (demo.playback == true && demo.freecam == true)
{
return true;
}
if (stplyr == p)
{
return false;
}
if (G_RaceGametype())
{
if ((p->kartstuff[k_position] < stplyr->kartstuff[k_position]-2)
|| (p->kartstuff[k_position] > stplyr->kartstuff[k_position]+2))
{
return false;
}
}
return true;
}
static void K_drawKartNameTags(void) static void K_drawKartNameTags(void)
{ {
const fixed_t maxdistance = 8192*mapobjectscale; const fixed_t maxdistance = 8192*mapobjectscale;
@ -10022,7 +10047,6 @@ static void K_drawKartNameTags(void)
fixed_t y = -BASEVIDWIDTH * FRACUNIT; fixed_t y = -BASEVIDWIDTH * FRACUNIT;
vertex_t v; vertex_t v;
UINT8 j;
if (!playeringame[i] || ntplayer->spectator) if (!playeringame[i] || ntplayer->spectator)
{ {
@ -10042,18 +10066,24 @@ static void K_drawKartNameTags(void)
continue; continue;
} }
for (j = 0; j <= r_splitscreen; j++) if (!(demo.playback == true && demo.freecam == true))
{ {
if (ntplayer == &players[displayplayers[j]]) UINT8 j;
{
break;
}
}
if (j <= r_splitscreen) for (j = 0; j <= r_splitscreen; j++)
{ {
// Is a player that's being shown on this computer if (ntplayer == &players[displayplayers[j]])
continue; {
break;
}
}
if (j <= r_splitscreen)
{
// This is a player that's being shown on this computer
// (Remove whenever we get splitscreen ABCD indicators)
continue;
}
} }
v.x = ntplayer->mo->x; v.x = ntplayer->mo->x;
@ -10089,10 +10119,9 @@ static void K_drawKartNameTags(void)
V_DrawFixedPatch(x, y, FRACUNIT, V_HUDTRANS, kp_rival[blink], NULL); V_DrawFixedPatch(x, y, FRACUNIT, V_HUDTRANS, kp_rival[blink], NULL);
} }
} }
else if (netgame) else if (netgame || demo.playback)
{ {
if ((ntplayer->kartstuff[k_position] >= stplyr->kartstuff[k_position]-2) if (K_ShowPlayerNametag(ntplayer) == true)
&& (ntplayer->kartstuff[k_position] <= stplyr->kartstuff[k_position]+2))
{ {
INT32 namelen = V_ThinStringWidth(player_names[i], V_6WIDTHSPACE|V_ALLOWLOWERCASE); INT32 namelen = V_ThinStringWidth(player_names[i], V_6WIDTHSPACE|V_ALLOWLOWERCASE);
INT32 clr = K_SkincolorToTextColor(ntplayer->skincolor); INT32 clr = K_SkincolorToTextColor(ntplayer->skincolor);