Merge pull request '[ENHANCEMENT] Add last minute, last five seconds, and overtime alarms' (#143) from timelimit_alarms into blankart-dev

Reviewed-on: https://codeberg.org/NepDisk/blankart/pulls/143
This commit is contained in:
minenice55 2025-09-30 04:23:56 +02:00
commit 641f6ae865
4 changed files with 1082 additions and 1004 deletions

View file

@ -843,6 +843,7 @@ _(requst)
_(syfail) _(syfail)
_(itfree) _(itfree)
_(dbgsal) _(dbgsal)
_(bhurry) // mine: wasn't here already?
// Chaining Sound // Chaining Sound
_(bstchn) _(bstchn)

View file

@ -1567,6 +1567,8 @@ void K_drawKartTimestamp(tic_t drawtime, INT32 TX, INT32 TY, INT16 emblemmap, UI
tic_t worktime; tic_t worktime;
boolean dontdraw = false; boolean dontdraw = false;
boolean overtime = false;
UINT8 *textcolor = 0;
boolean emblemenabled = K_EmblemsEnabled(); boolean emblemenabled = K_EmblemsEnabled();
INT32 splitflags = 0; INT32 splitflags = 0;
@ -1583,13 +1585,15 @@ void K_drawKartTimestamp(tic_t drawtime, INT32 TX, INT32 TY, INT16 emblemmap, UI
; ;
else if (timelimitintics > 0 && (gametyperules & GTR_TIMELIMIT)) // TODO else if (timelimitintics > 0 && (gametyperules & GTR_TIMELIMIT)) // TODO
{ {
if (drawtime >= (timelimitintics - 5*TICRATE) && ((drawtime*4)/TICRATE) % 2 == 0)
{
dontdraw = true;
}
if (drawtime >= timelimitintics) if (drawtime >= timelimitintics)
{ {
if (((drawtime-timelimitintics)/TICRATE) & 1) overtime = true;
{ // drawtime = 0;
dontdraw = true;
}
drawtime = 0;
} }
else else
{ {
@ -1614,6 +1618,30 @@ void K_drawKartTimestamp(tic_t drawtime, INT32 TX, INT32 TY, INT16 emblemmap, UI
V_DrawKartString(TX, TY+3, splitflags, va("--'--\"--")); V_DrawKartString(TX, TY+3, splitflags, va("--'--\"--"));
else if (dontdraw) // overtime flash else if (dontdraw) // overtime flash
; ;
else if (overtime)
{
if (((drawtime*2)/TICRATE) % 2 == 0)
{
textcolor = R_GetTranslationColormap(TC_RAINBOW, SKINCOLOR_YELLOW, GTC_CACHE);
}
else
{
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!")
);
}
else if (worktime < 100) // 99:99:99 only else if (worktime < 100) // 99:99:99 only
{ {
// zero minute // zero minute

View file

@ -1042,6 +1042,13 @@ void P_CheckTimeLimit(void)
spectators++; spectators++;
} }
#ifdef TESTOVERTIMEINFREEPLAY
if (timelimitintics > 0 && (gametyperules & GTR_TIMELIMIT) && startedInFreePlay)
{
return;
}
#endif
if ((D_NumPlayers() - spectators) > 1) if ((D_NumPlayers() - spectators) > 1)
{ {
// Play the starpost sfx after the first second of overtime. // Play the starpost sfx after the first second of overtime.

View file

@ -821,6 +821,48 @@ 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 // Change timing of start music based on gametyperules
{ {
tic_t startingtime = (gametyperules & GTR_NOCOUNTDOWN) ? introtime : starttime; tic_t startingtime = (gametyperules & GTR_NOCOUNTDOWN) ? introtime : starttime;