More splits

This commit is contained in:
Antonio Martinez 2025-08-06 22:09:06 -04:00
parent a11acfaf0e
commit 024ae0f8ab
4 changed files with 57 additions and 22 deletions

View file

@ -356,6 +356,7 @@ typedef enum
khud_splittimer,
khud_splitskin,
khud_splitcolor,
khud_splitlast,
NUMKARTHUD
} karthudtype_t;

View file

@ -2258,8 +2258,6 @@ void G_SetDemoCheckpointTiming(player_t *player, tic_t time, UINT8 checkpoint)
UINT32 *splits = (UINT32 *)demosplits_p;
splits[checkpoint] = time;
CONS_Printf("%d / %d\n", checkpoint, time);
demoghost *g;
tic_t lowest = INT32_MAX;
UINT32 lowestskin = ((skin_t*)player->mo->skin) - skins;
@ -2273,25 +2271,36 @@ void G_SetDemoCheckpointTiming(player_t *player, tic_t time, UINT8 checkpoint)
lowestcolor = g->mo->color;
}
CONS_Printf("->%d\n", g->splits[checkpoint]);
}
if (lowest != INT32_MAX)
{
player->karthud[khud_splittimer] = 1;
player->karthud[khud_splittimer] = 3*TICRATE;
player->karthud[khud_splitskin] = lowestskin;
player->karthud[khud_splitcolor] = lowestcolor;
player->karthud[khud_splittime] = (INT32)time - (INT32)lowest;
if (lowest < time)
{
player->karthud[khud_splittime] = time - lowest;
player->karthud[khud_splitwin] = false;
player->karthud[khud_splitwin] = -2; // behind and losing
}
else
{
player->karthud[khud_splittime] = lowest - time;
player->karthud[khud_splitwin] = true;
player->karthud[khud_splitwin] = 2; // ahead and gaining
}
INT32 last = player->karthud[khud_splitlast];
INT32 now = player->karthud[khud_splittime];
if (checkpoint != 0)
{
if (player->karthud[khud_splitwin] > 0 && now > last)
player->karthud[khud_splitwin] = 1; // ahead but losing
else if (player->karthud[khud_splitwin] < 0 && now < last)
player->karthud[khud_splitwin] = -1; // behind but gaining
}
player->karthud[khud_splitlast] = player->karthud[khud_splittime];
}
}

View file

@ -7764,41 +7764,68 @@ void K_drawKartHUD(void)
boolean debug_alwaysdraw = false;
if (stplyr->karthud[khud_splittimer] || debug_alwaysdraw)
if (
(
!stplyr->karthud[khud_lapanimation] &&
stplyr->karthud[khud_splittimer] &&
(stplyr->karthud[khud_splittimer] > TICRATE/3 || stplyr->karthud[khud_splittimer]%2 || cv_reducevfx.value)
)
|| debug_alwaysdraw
)
{
tic_t split = stplyr->karthud[khud_splittime];
UINT32 skin = stplyr->karthud[khud_splitskin];
UINT32 color = stplyr->karthud[khud_splitcolor];
boolean ahead = stplyr->karthud[khud_splitwin];
INT32 split = stplyr->karthud[khud_splittime];
INT32 skin = stplyr->karthud[khud_splitskin];
INT32 color = stplyr->karthud[khud_splitcolor];
INT32 ahead = stplyr->karthud[khud_splitwin];
// debug
if (!stplyr->karthud[khud_splittimer])
{
ahead = !!((leveltime/17)%2);
ahead = ((leveltime/17)%5) - 2;
split = leveltime;
skin = stplyr->skin;
color = stplyr->skincolor;
}
split = std::abs(split);
UINT8 *skincolor = R_GetTranslationColormap(skin, static_cast<skincolornum_t>(color), GTC_CACHE);
UINT8 textcolor = ahead ? SKINCOLOR_SAPPHIRE : SKINCOLOR_KETCHUP;
UINT8 textcolor = SKINCOLOR_WHITE;
switch (ahead)
{
case 2:
textcolor = SKINCOLOR_SAPPHIRE; // leading and gaining
break;
case 1:
textcolor = SKINCOLOR_PIGEON; // leading and losing
break;
case -1:
textcolor = SKINCOLOR_RUBY; // trailing and gaining
break;
case -2:
textcolor = SKINCOLOR_CRIMSON; // trailing and losing
break;
}
Draw row = Draw(BASEVIDWIDTH/2, BASEVIDHEIGHT/4).align(Draw::Align::kCenter)
.font(Draw::Font::kThinTimer).flags(V_30TRANS);
std::string arrow = (ahead == 1 || ahead == -2) ? "(" : ")";
// vibes offset
row.x(-32).colormap(skincolor).patch(R_CanShowSkinInDemo(skin) ? faceprefix[skin][FACE_MINIMAP] : kp_unknownminimap);
row.x(-35).colormap(skincolor).patch(R_CanShowSkinInDemo(skin) ? faceprefix[skin][FACE_MINIMAP] : kp_unknownminimap);
Draw::TextElement text = Draw::TextElement(
std::string(ahead ? "-" : "+") + "{:02}'{:02}\"{:02}",
std::string(ahead >= 0 ? "-" : "+") + " " + "{:02}'{:02}\"{:02} " + arrow,
G_TicsToMinutes(split, true),
G_TicsToSeconds(split),
G_TicsToCentiseconds(split)
);
// vibes offset TWO
row.colormap(textcolor).colorize(textcolor).x(8).text(text);
row.colormap(textcolor).colorize(textcolor).x(15).text(text);
}
}
else

View file

@ -9044,11 +9044,9 @@ void K_KartPlayerHUDUpdate(player_t *player)
if (player->karthud[khud_trickcool])
player->karthud[khud_trickcool]--;
if (player->karthud[khud_splittimer])
if (player->karthud[khud_splittimer] && !player->karthud[khud_lapanimation])
{
player->karthud[khud_splittimer]++;
if (player->karthud[khud_splittimer] > 2*TICRATE)
player->karthud[khud_splittimer] = 0;
player->karthud[khud_splittimer]--;
}
if (player->positiondelay)