* Prettier record attack screen!

* Uses the in-game timer element to draw its times.
	* This includes showing them time emblems-to-get!
	* good night sweet prince
* Make the emblem time use the same ' and " as the normal time.
This commit is contained in:
toaster 2018-08-29 21:37:47 +01:00
parent c1fd658e4b
commit 22be81ef02
3 changed files with 77 additions and 42 deletions

View file

@ -5160,78 +5160,90 @@ static void K_drawKartItem(void)
V_DrawScaledPatch(ITEM_X+17, ITEM_Y+13, V_HUDTRANS|splitflags, kp_eggnum[min(3, G_TicsToSeconds(stplyr->kartstuff[k_eggmanexplode]))]); V_DrawScaledPatch(ITEM_X+17, ITEM_Y+13, V_HUDTRANS|splitflags, kp_eggnum[min(3, G_TicsToSeconds(stplyr->kartstuff[k_eggmanexplode]))]);
} }
static void K_drawKartTimestamp(void) void K_drawKartTimestamp(tic_t drawtime, INT32 TX, INT32 TY, INT16 emblemmap, boolean playing)
{ {
// TIME_X = BASEVIDWIDTH-124; // 196 // TIME_X = BASEVIDWIDTH-124; // 196
// TIME_Y = 6; // 6 // TIME_Y = 6; // 6
INT32 TIME_XB, splitflags = V_HUDTRANS|K_calcSplitFlags(V_SNAPTOTOP|V_SNAPTORIGHT); tic_t worktime;
tic_t drawtime = stplyr->realtime;
if (cv_timelimit.value && timelimitintics > 0) INT32 splitflags = 0;
if (playing)
{ {
if (drawtime >= timelimitintics) splitflags = V_HUDTRANS|K_calcSplitFlags(V_SNAPTOTOP|V_SNAPTORIGHT);
drawtime = 0; if (cv_timelimit.value && timelimitintics > 0)
else {
drawtime = timelimitintics - drawtime; if (drawtime >= timelimitintics)
drawtime = 0;
else
drawtime = timelimitintics - drawtime;
}
} }
V_DrawScaledPatch(TIME_X, TIME_Y, splitflags, kp_timestickerwide); V_DrawScaledPatch(TX, TY, splitflags, kp_timestickerwide);
TIME_XB = TIME_X+33; TX += 33;
if (drawtime/(60*TICRATE) < 100) // 99:99:99 only worktime = drawtime/(60*TICRATE);
if (!playing && !drawtime)
V_DrawKartString(TX, TY+3, splitflags, va("--'--\"--"));
else if (worktime < 100) // 99:99:99 only
{ {
// zero minute // zero minute
if (drawtime/(60*TICRATE) < 10) if (worktime < 10)
{ {
V_DrawKartString(TIME_XB, TIME_Y+3, splitflags, va("0")); V_DrawKartString(TX, TY+3, splitflags, va("0"));
// minutes time 0 __ __ // minutes time 0 __ __
V_DrawKartString(TIME_XB+12, TIME_Y+3, splitflags, va("%d", drawtime/(60*TICRATE))); V_DrawKartString(TX+12, TY+3, splitflags, va("%d", worktime));
} }
// minutes time 0 __ __ // minutes time 0 __ __
else else
V_DrawKartString(TIME_XB, TIME_Y+3, splitflags, va("%d", drawtime/(60*TICRATE))); V_DrawKartString(TX, TY+3, splitflags, va("%d", worktime));
// apostrophe location _'__ __ // apostrophe location _'__ __
V_DrawKartString(TIME_XB+24, TIME_Y+3, splitflags, va("'")); V_DrawKartString(TX+24, TY+3, splitflags, va("'"));
worktime = (drawtime/TICRATE % 60);
// zero second _ 0_ __ // zero second _ 0_ __
if ((drawtime/TICRATE % 60) < 10) if (worktime < 10)
{ {
V_DrawKartString(TIME_XB+36, TIME_Y+3, splitflags, va("0")); V_DrawKartString(TX+36, TY+3, splitflags, va("0"));
// seconds time _ _0 __ // seconds time _ _0 __
V_DrawKartString(TIME_XB+48, TIME_Y+3, splitflags, va("%d", drawtime/TICRATE % 60)); V_DrawKartString(TX+48, TY+3, splitflags, va("%d", worktime));
} }
// zero second _ 00 __ // zero second _ 00 __
else else
V_DrawKartString(TIME_XB+36, TIME_Y+3, splitflags, va("%d", drawtime/TICRATE % 60)); V_DrawKartString(TX+36, TY+3, splitflags, va("%d", worktime));
// quotation mark location _ __"__ // quotation mark location _ __"__
V_DrawKartString(TIME_XB+60, TIME_Y+3, splitflags, va("\"")); V_DrawKartString(TX+60, TY+3, splitflags, va("\""));
worktime = G_TicsToCentiseconds(drawtime);
// zero tick _ __ 0_ // zero tick _ __ 0_
if (G_TicsToCentiseconds(drawtime) < 10) if (worktime < 10)
{ {
V_DrawKartString(TIME_XB+72, TIME_Y+3, splitflags, va("0")); V_DrawKartString(TX+72, TY+3, splitflags, va("0"));
// tics _ __ _0 // tics _ __ _0
V_DrawKartString(TIME_XB+84, TIME_Y+3, splitflags, va("%d", G_TicsToCentiseconds(drawtime))); V_DrawKartString(TX+84, TY+3, splitflags, va("%d", worktime));
} }
// zero tick _ __ 00 // zero tick _ __ 00
if (G_TicsToCentiseconds(drawtime) >= 10) else
V_DrawKartString(TIME_XB+72, TIME_Y+3, splitflags, va("%d", G_TicsToCentiseconds(drawtime))); V_DrawKartString(TX+72, TY+3, splitflags, va("%d", worktime));
} }
else if ((drawtime/TICRATE) & 1) else if ((drawtime/TICRATE) & 1)
V_DrawKartString(TIME_XB, TIME_Y+3, splitflags, va("99'59\"99")); V_DrawKartString(TX, TY+3, splitflags, va("99'59\"99"));
if (modeattacking) // emblem time! if (emblemmap && (modeattacking || !playing)) // emblem time!
{ {
INT32 workx = TIME_XB + 96, worky = TIME_Y+18; INT32 workx = TX + 96, worky = TY+18;
SINT8 curemb = 0; SINT8 curemb = 0;
patch_t *emblempic[3] = {NULL, NULL, NULL}; patch_t *emblempic[3] = {NULL, NULL, NULL};
UINT8 *emblemcol[3] = {NULL, NULL, NULL}; UINT8 *emblemcol[3] = {NULL, NULL, NULL};
emblem_t *emblem = M_GetLevelEmblems(gamemap); emblem_t *emblem = M_GetLevelEmblems(emblemmap);
while (emblem) while (emblem)
{ {
char targettext[9]; char targettext[9];
@ -5252,22 +5264,25 @@ static void K_drawKartTimestamp(void)
goto bademblem; goto bademblem;
} }
snprintf(targettext, 9, "%i:%02i.%02i", snprintf(targettext, 9, "%i'%02i\"%02i",
G_TicsToMinutes(timetoreach, false), G_TicsToMinutes(timetoreach, false),
G_TicsToSeconds(timetoreach), G_TicsToSeconds(timetoreach),
G_TicsToCentiseconds(timetoreach)); G_TicsToCentiseconds(timetoreach));
if (stplyr->realtime > timetoreach) if (playing)
{ {
splitflags = (splitflags &~ V_HUDTRANS)|V_HUDTRANSHALF; if (stplyr->realtime > timetoreach)
if (canplaysound)
{ {
S_StartSound(NULL, sfx_s3k72); //sfx_s26d); -- you STOLE fizzy lifting drinks splitflags = (splitflags &~ V_HUDTRANS)|V_HUDTRANSHALF;
canplaysound = false; if (canplaysound)
{
S_StartSound(NULL, sfx_s3k72); //sfx_s26d); -- you STOLE fizzy lifting drinks
canplaysound = false;
}
} }
else if (!canplaysound)
canplaysound = true;
} }
else if (!canplaysound)
canplaysound = true;
targettext[8] = 0; targettext[8] = 0;
} }
@ -5277,7 +5292,7 @@ static void K_drawKartTimestamp(void)
} }
V_DrawRightAlignedString(workx, worky, splitflags, targettext); V_DrawRightAlignedString(workx, worky, splitflags, targettext);
workx -= 69; // i SWEAR i wasn't aiming for this workx -= 72; //69; -- good night sweet prince
V_DrawSmallScaledPatch(workx + 4, worky, splitflags, W_CachePatchName("NEEDIT", PU_CACHE)); V_DrawSmallScaledPatch(workx + 4, worky, splitflags, W_CachePatchName("NEEDIT", PU_CACHE));
break; break;
@ -5286,6 +5301,8 @@ static void K_drawKartTimestamp(void)
emblem = M_GetLevelEmblems(-1); emblem = M_GetLevelEmblems(-1);
} }
if (playing)
splitflags = (splitflags &~ V_HUDTRANSHALF)|V_HUDTRANS;
while (curemb--) while (curemb--)
{ {
workx -= 16; workx -= 16;
@ -6469,7 +6486,7 @@ void K_drawKartHUD(void)
if (!splitscreen) if (!splitscreen)
{ {
// Draw the timestamp // Draw the timestamp
K_drawKartTimestamp(); K_drawKartTimestamp(stplyr->realtime, TIME_X, TIME_Y, gamemap, true);
if (!modeattacking) if (!modeattacking)
{ {

View file

@ -61,6 +61,7 @@ void K_LoadKartHUDGraphics(void);
fixed_t K_FindCheckX(fixed_t px, fixed_t py, angle_t ang, fixed_t mx, fixed_t my); fixed_t K_FindCheckX(fixed_t px, fixed_t py, angle_t ang, fixed_t mx, fixed_t my);
void K_drawKartHUD(void); void K_drawKartHUD(void);
void K_drawKartFreePlay(UINT32 flashtime); void K_drawKartFreePlay(UINT32 flashtime);
void K_drawKartTimestamp(tic_t drawtime, INT32 TX, INT32 TY, INT16 emblemmap, boolean playing);
void K_LoadIconGraphics(char *facestr, INT32 skinnum); void K_LoadIconGraphics(char *facestr, INT32 skinnum);
void K_ReloadSkinIconGraphics(void); void K_ReloadSkinIconGraphics(void);

View file

@ -5705,7 +5705,6 @@ void M_DrawTimeAttackMenu(void)
INT32 i, x, y, cursory = 0; INT32 i, x, y, cursory = 0;
UINT16 dispstatus; UINT16 dispstatus;
patch_t *PictureOfUrFace; patch_t *PictureOfUrFace;
char beststr[40];
//S_ChangeMusicInternal("racent", true); // Eww, but needed for when user hits escape during demo playback //S_ChangeMusicInternal("racent", true); // Eww, but needed for when user hits escape during demo playback
@ -5786,6 +5785,24 @@ void M_DrawTimeAttackMenu(void)
// Level record list // Level record list
if (cv_nextmap.value) if (cv_nextmap.value)
{ {
INT32 dupadjust = (vid.width/vid.dupx);
tic_t lap = 0, time = 0;
if (mainrecords[cv_nextmap.value-1])
{
lap = mainrecords[cv_nextmap.value-1]->lap;
time = mainrecords[cv_nextmap.value-1]->time;
}
V_DrawFill((BASEVIDWIDTH - dupadjust)>>1, 78, dupadjust, 36, 239);
V_DrawRightAlignedString(149, 80, highlightflags, "BEST LAP:");
K_drawKartTimestamp(lap, 19, 86, 0, false);
V_DrawRightAlignedString(292, 80, highlightflags, "BEST TIME:");
K_drawKartTimestamp(time, 162, 86, cv_nextmap.value, false);
}
/*{
char beststr[40];
emblem_t *em; emblem_t *em;
if (!mainrecords[cv_nextmap.value-1] || !mainrecords[cv_nextmap.value-1]->time) if (!mainrecords[cv_nextmap.value-1] || !mainrecords[cv_nextmap.value-1]->time)
@ -5828,7 +5845,7 @@ void M_DrawTimeAttackMenu(void)
skipThisOne: skipThisOne:
em = M_GetLevelEmblems(-1); em = M_GetLevelEmblems(-1);
} }
} }*/
// ALWAYS DRAW player name, level name, skin and color even when not on this menu! // ALWAYS DRAW player name, level name, skin and color even when not on this menu!
if (currentMenu != &SP_TimeAttackDef) if (currentMenu != &SP_TimeAttackDef)