Repair and interpolate overtime/jitters
This commit is contained in:
parent
d9b8eab1ea
commit
92f17189b0
4 changed files with 75 additions and 87 deletions
76
src/k_hud.c
76
src/k_hud.c
|
|
@ -1612,9 +1612,9 @@ void K_drawKartTimestamp(tic_t drawtime, INT32 TX, INT32 TY, INT16 emblemmap, UI
|
|||
// TIME_Y = 6; // 6
|
||||
|
||||
tic_t worktime;
|
||||
INT32 jitter = 0;
|
||||
boolean overtime = false;
|
||||
UINT8 *textcolor = 0;
|
||||
fixed_t jitter = 0;
|
||||
boolean overtime = false, fastjitter = false, countdown = false;
|
||||
UINT8 *textcolor = NULL;
|
||||
|
||||
INT32 splitflags = 0;
|
||||
if (!mode)
|
||||
|
|
@ -1623,37 +1623,26 @@ void K_drawKartTimestamp(tic_t drawtime, INT32 TX, INT32 TY, INT16 emblemmap, UI
|
|||
|
||||
if (timelimitintics > 0)
|
||||
{
|
||||
/*
|
||||
if (drawtime >= (timelimitintics - 5*TICRATE) && ((drawtime*4)/TICRATE) % 2 == 0)
|
||||
{
|
||||
dontdraw = true;
|
||||
}
|
||||
*/
|
||||
if (drawtime >= timelimitintics)
|
||||
{
|
||||
overtime = true;
|
||||
jitter = 2;
|
||||
if (drawtime & 2)
|
||||
jitter = -jitter;
|
||||
drawtime = 0;
|
||||
jitter = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
drawtime = timelimitintics - drawtime;
|
||||
countdown = true;
|
||||
if (secretextratime)
|
||||
;
|
||||
else if (extratimeintics)
|
||||
{
|
||||
jitter = 2;
|
||||
if (leveltime & 1)
|
||||
jitter = -jitter;
|
||||
fastjitter = true;
|
||||
}
|
||||
else if (drawtime <= 5*TICRATE)
|
||||
{
|
||||
jitter = ((drawtime <= 3*TICRATE) && (((drawtime-1) % TICRATE) >= TICRATE-2))
|
||||
? 3 : 1;
|
||||
if (drawtime & 2)
|
||||
jitter = -jitter;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1673,11 +1662,22 @@ void K_drawKartTimestamp(tic_t drawtime, INT32 TX, INT32 TY, INT16 emblemmap, UI
|
|||
|
||||
if (drawtime != UINT32_MAX && worktime >= 100)
|
||||
{
|
||||
jitter = (drawtime & 1 ? 1 : -1);
|
||||
jitter = 1;
|
||||
fastjitter = true;
|
||||
worktime = 99;
|
||||
drawtime = (100*(60*TICRATE))-1;
|
||||
}
|
||||
|
||||
if (fastjitter)
|
||||
{
|
||||
jitter *= R_GetTimeFrac(RTF_LEVEL) * (leveltime & 1 ? 1 : -1);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (drawtime & 2) jitter = -jitter;
|
||||
jitter *= !!(drawtime & 1) != countdown ? FRACUNIT - R_GetTimeFrac(RTF_LEVEL) : R_GetTimeFrac(RTF_LEVEL);
|
||||
}
|
||||
|
||||
if (mode && drawtime == UINT32_MAX)
|
||||
V_DrawKartString(TX, TY+3, splitflags, va("--'--\"--"));
|
||||
else if (overtime)
|
||||
|
|
@ -1691,24 +1691,28 @@ void K_drawKartTimestamp(tic_t drawtime, INT32 TX, INT32 TY, INT16 emblemmap, UI
|
|||
textcolor = R_GetTranslationColormap(TC_RAINBOW, SKINCOLOR_ORANGE, GTC_CACHE);
|
||||
}
|
||||
|
||||
V_DrawStringScaledEx(
|
||||
(TIME_X + 33) << FRACBITS,
|
||||
(TIME_Y + 3) << FRACBITS,
|
||||
FRACUNIT,
|
||||
FRACUNIT,
|
||||
FRACUNIT,
|
||||
FRACUNIT,
|
||||
splitflags,
|
||||
textcolor,
|
||||
KART_FONT,
|
||||
va("OVERTIME!")
|
||||
);
|
||||
const char *overtimestr = "OVERTIME";
|
||||
for (UINT8 i = 0; i < strlen(overtimestr); i++)
|
||||
{
|
||||
V_DrawStringScaledEx(
|
||||
(TIME_X + 33 + 12*i + (i == 6 ? -4 : i == 7 ? -1 : 0)) << FRACBITS,
|
||||
((TIME_Y + 3) << FRACBITS) + (i & 1 ? jitter : -jitter),
|
||||
FRACUNIT,
|
||||
FRACUNIT,
|
||||
FRACUNIT,
|
||||
FRACUNIT,
|
||||
splitflags,
|
||||
textcolor,
|
||||
KART_FONT,
|
||||
va("%c", overtimestr[i])
|
||||
);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// minutes time 00 __ __
|
||||
V_DrawKartString(TX, TY+3+jitter, splitflags, va("%d", worktime/10));
|
||||
V_DrawKartString(TX+12, TY+3-jitter, splitflags, va("%d", worktime%10));
|
||||
V_DrawKartStringAtFixed(TX<<FRACBITS, ((TY+3)<<FRACBITS)+jitter, splitflags, va("%d", worktime/10));
|
||||
V_DrawKartStringAtFixed((TX+12)<<FRACBITS, ((TY+3)<<FRACBITS)-jitter, splitflags, va("%d", worktime%10));
|
||||
|
||||
// apostrophe location _'__ __
|
||||
V_DrawKartString(TX+24, TY+3, splitflags, va("'"));
|
||||
|
|
@ -1716,8 +1720,8 @@ void K_drawKartTimestamp(tic_t drawtime, INT32 TX, INT32 TY, INT16 emblemmap, UI
|
|||
worktime = (drawtime/TICRATE % 60);
|
||||
|
||||
// seconds time _ 00 __
|
||||
V_DrawKartString(TX+36, TY+3+jitter, splitflags, va("%d", worktime/10));
|
||||
V_DrawKartString(TX+48, TY+3-jitter, splitflags, va("%d", worktime%10));
|
||||
V_DrawKartStringAtFixed((TX+36)<<FRACBITS, ((TY+3)<<FRACBITS)+jitter, splitflags, va("%d", worktime/10));
|
||||
V_DrawKartStringAtFixed((TX+48)<<FRACBITS, ((TY+3)<<FRACBITS)-jitter, splitflags, va("%d", worktime%10));
|
||||
|
||||
// quotation mark location _ __"__
|
||||
V_DrawKartString(TX+60, TY+3, splitflags, va("\""));
|
||||
|
|
@ -1725,8 +1729,8 @@ void K_drawKartTimestamp(tic_t drawtime, INT32 TX, INT32 TY, INT16 emblemmap, UI
|
|||
worktime = G_TicsToCentiseconds(drawtime);
|
||||
|
||||
// tics _ __ 00
|
||||
V_DrawKartString(TX+72, TY+3+jitter, splitflags, va("%d", worktime/10));
|
||||
V_DrawKartString(TX+84, TY+3-jitter, splitflags, va("%d", worktime%10));
|
||||
V_DrawKartStringAtFixed((TX+72)<<FRACBITS, ((TY+3)<<FRACBITS)+jitter, splitflags, va("%d", worktime/10));
|
||||
V_DrawKartStringAtFixed((TX+84)<<FRACBITS, ((TY+3)<<FRACBITS)-jitter, splitflags, va("%d", worktime%10));
|
||||
}
|
||||
|
||||
if ((modeattacking || (mode == 1)) && G_EmblemsEnabled()) // emblem time!
|
||||
|
|
|
|||
|
|
@ -1014,7 +1014,8 @@ void P_CheckTimeLimit(void)
|
|||
return;
|
||||
}
|
||||
|
||||
if (leveltime < (timelimitintics + starttime))
|
||||
INT32 timeleft = timelimitintics + starttime - leveltime;
|
||||
if (timeleft > 0)
|
||||
{
|
||||
if (secretextratime)
|
||||
{
|
||||
|
|
@ -1043,11 +1044,22 @@ void P_CheckTimeLimit(void)
|
|||
}
|
||||
else
|
||||
{
|
||||
if (timelimitintics + starttime - leveltime <= 3*TICRATE)
|
||||
if (timelimitintics > 60*TICRATE && !itembreaker)
|
||||
{
|
||||
if (((timelimitintics + starttime - leveltime) % TICRATE) == 0)
|
||||
S_StartSound(NULL, sfx_s3ka7);
|
||||
}
|
||||
if (timeleft == 60*TICRATE)
|
||||
S_StartSound(NULL, sfx_cdfm67); // guys it's a bell it's just like splatoon guys
|
||||
if (timeleft == 59*TICRATE)
|
||||
S_StartSound(NULL, sfx_bhurry); // hurry up :))))
|
||||
}
|
||||
|
||||
// last five second countdown
|
||||
if (timeleft % TICRATE == 0)
|
||||
{
|
||||
if (timeleft <= 5*TICRATE)
|
||||
S_StartSound(NULL, sfx_kc35); // 5, 4
|
||||
if (timeleft <= 3*TICRATE)
|
||||
S_StartSound(NULL, sfx_kc3d); // 3, 2, 1
|
||||
}
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
|
@ -1055,7 +1067,7 @@ void P_CheckTimeLimit(void)
|
|||
if (gameaction == ga_completed)
|
||||
return;
|
||||
|
||||
if ((grandprixinfo.gp == false) && (cv_overtime.value))
|
||||
if (!itembreaker && !grandprixinfo.gp && cv_overtime.value)
|
||||
{
|
||||
INT32 playerarray[MAXPLAYERS];
|
||||
INT32 tempplayer = 0;
|
||||
|
|
@ -1074,7 +1086,7 @@ void P_CheckTimeLimit(void)
|
|||
#ifdef TESTOVERTIMEINFREEPLAY
|
||||
if (timelimitintics > 0 && (gametyperules & GTR_TIMELIMIT) && startedInFreePlay)
|
||||
{
|
||||
return;
|
||||
goto overtimesound;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
|
@ -1116,18 +1128,30 @@ void P_CheckTimeLimit(void)
|
|||
|
||||
//End the round if the top players aren't tied.
|
||||
if (players[playerarray[0]].roundscore == players[playerarray[1]].roundscore)
|
||||
return;
|
||||
goto overtimesound;
|
||||
}
|
||||
else
|
||||
{
|
||||
//In team match and CTF, determining a tie is much simpler. =P
|
||||
if (redscore == bluescore)
|
||||
return;
|
||||
goto overtimesound;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
P_DoAllPlayersExit(0, false);
|
||||
return;
|
||||
|
||||
overtimesound:
|
||||
if (timeleft == 0)
|
||||
{
|
||||
S_StartSound(NULL, sfx_s3k50); // overtime warning
|
||||
S_StartSound(NULL, sfx_s3k9d);
|
||||
}
|
||||
if (timeleft == -2*TICRATE)
|
||||
S_StartSoundAtVolume(NULL, sfx_s3k50, 128);
|
||||
if (timeleft == -4*TICRATE)
|
||||
S_StartSoundAtVolume(NULL, sfx_s3k50, 96);
|
||||
}
|
||||
|
||||
/** Checks if a player's score is over the pointlimit and the round should end.
|
||||
|
|
|
|||
42
src/p_tick.c
42
src/p_tick.c
|
|
@ -840,48 +840,6 @@ void P_Ticker(boolean run)
|
|||
}
|
||||
}
|
||||
|
||||
if (timelimitintics > 0)
|
||||
{
|
||||
// last minute
|
||||
if (timelimitintics > 60*TICRATE && leveltime == timelimitintics - 60*TICRATE + starttime)
|
||||
{
|
||||
S_StartSound(NULL, sfx_cdfm67); // guys it's a bell it's just like splatoon guys
|
||||
}
|
||||
if (timelimitintics > 60*TICRATE && leveltime == timelimitintics - 59*TICRATE + starttime)
|
||||
{
|
||||
S_StartSound(NULL, sfx_bhurry); // hurry up :))))
|
||||
}
|
||||
|
||||
// overtime
|
||||
if (gameaction != ga_completed && leveltime == timelimitintics + 1 + starttime)
|
||||
{
|
||||
S_StartSound(NULL, sfx_s3k50); // overtime warning
|
||||
S_StartSound(NULL, sfx_s3k9d);
|
||||
}
|
||||
if (gameaction != ga_completed && leveltime == timelimitintics + 2*TICRATE + starttime)
|
||||
{
|
||||
S_StartSoundAtVolume(NULL, sfx_s3k50, 128);
|
||||
}
|
||||
if (gameaction != ga_completed && leveltime == timelimitintics + 4*TICRATE + starttime)
|
||||
{
|
||||
S_StartSoundAtVolume(NULL, sfx_s3k50, 96);
|
||||
}
|
||||
|
||||
// last five second countdown
|
||||
if (leveltime == timelimitintics - 5 * TICRATE + starttime ||
|
||||
leveltime == timelimitintics - 4 * TICRATE + starttime)
|
||||
{
|
||||
S_StartSound(NULL, sfx_kc35); // 5, 4
|
||||
}
|
||||
if (leveltime == timelimitintics - TICRATE + starttime ||
|
||||
leveltime == timelimitintics - 2 * TICRATE + starttime ||
|
||||
leveltime == timelimitintics - 3 * TICRATE + starttime)
|
||||
{
|
||||
S_StartSound(NULL, sfx_kc35);
|
||||
S_StartSound(NULL, sfx_kc3d); // 3, 2, 1
|
||||
}
|
||||
}
|
||||
|
||||
// Change timing of start music based on gametyperules
|
||||
{
|
||||
tic_t startingtime = (gametyperules & GTR_NOCOUNTDOWN) ? introtime : starttime;
|
||||
|
|
|
|||
|
|
@ -305,6 +305,8 @@ char * V_ScaledWordWrap(
|
|||
V__DrawDupxString (x,y,FRACUNIT,option,HU_FONT,string)
|
||||
#define V_DrawKartString( x,y,option,string ) \
|
||||
V__DrawDupxString (x,y,FRACUNIT,option,KART_FONT,string)
|
||||
#define V_DrawKartStringAtFixed( x,y,option,string ) \
|
||||
V__DrawOneScaleString (x,y,FRACUNIT,option,KART_FONT,string)
|
||||
void V_DrawCenteredString(INT32 x, INT32 y, INT32 option, const char *string);
|
||||
void V_DrawRightAlignedString(INT32 x, INT32 y, INT32 option, const char *string);
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue