WIP: Duel infinite laps in circuit

This commit is contained in:
Antonio Martinez 2024-09-02 21:52:46 -07:00
parent d2b2178143
commit 4f1a49c0fb
6 changed files with 18 additions and 4 deletions

View file

@ -868,6 +868,7 @@ extern SINT8 spbplace;
extern boolean rainbowstartavailable;
extern tic_t linecrossed;
extern boolean inDuel;
extern UINT8 extralaps;
extern tic_t bombflashtimer; // Used to avoid causing seizures if multiple mines explode close to you :)
extern boolean legitimateexit;

View file

@ -319,6 +319,7 @@ SINT8 spbplace; // SPB exists, give the person behind better items
boolean rainbowstartavailable; // Boolean, keeps track of if the rainbow start was gotten
tic_t linecrossed; // For Time Attack
boolean inDuel; // Boolean, keeps track of if it is a 1v1
UINT8 extralaps; // Duel extensions!
// Client-sided, unsynched variables (NEVER use in anything that needs to be synced with other players)
tic_t bombflashtimer = 0; // Cooldown before another FlashPal can be intialized by a bomb exploding near a displayplayer. Avoids seizures.

View file

@ -2999,11 +2999,15 @@ static void K_drawKartLaps(void)
if (inDuel)
{
UINT8 flashflag = (leveltime % 2 && abs(stplyr->duelscore >= 2)) ? V_TRANSLUCENT : 0;
UINT32 flashflag = (stplyr->duelscore >= 0) ? V_BLUEMAP : V_REDMAP;
if (leveltime % 2)
if (abs(stplyr->duelscore) >= 2)
flashflag = V_YELLOWMAP;
if (stplyr->duelscore >= 0)
V_DrawCenteredString(BASEVIDWIDTH/2, 5, V_BLUEMAP|flashflag, va("+%d", stplyr->duelscore));
V_DrawCenteredString(BASEVIDWIDTH/2, 5, flashflag, va("+%d", stplyr->duelscore));
else
V_DrawCenteredString(BASEVIDWIDTH/2, 5, V_REDMAP|flashflag, va("%d", stplyr->duelscore));
V_DrawCenteredString(BASEVIDWIDTH/2, 5, flashflag, va("%d", stplyr->duelscore));
}
if (numlaps != 1)

View file

@ -145,6 +145,7 @@ void K_TimerReset(void)
numbulbs = 1;
inDuel = rainbowstartavailable = false;
linecrossed = 0;
extralaps = 0;
timelimitintics = extratimeintics = secretextratime = 0;
g_pointlimit = 0;
}
@ -10684,7 +10685,7 @@ static void K_UpdateDistanceFromFinishLine(player_t *const player)
const mapheader_t *mapheader = mapheaderinfo[gamemap - 1];
if ((mapheader->levelflags & LF_SECTIONRACE) == 0U)
{
const UINT8 numfulllapsleft = ((UINT8)numlaps - player->laps) / mapheader->lapspersection;
const UINT8 numfulllapsleft = ((UINT8)numlaps - player->laps) / mapheader->lapspersection + extralaps;
player->distancetofinish += numfulllapsleft * K_GetCircuitLength();
}
}

View file

@ -6679,6 +6679,7 @@ static void P_NetArchiveMisc(savebuffer_t *save, boolean resending)
WRITESINT8(save->p, spbplace);
WRITEUINT8(save->p, rainbowstartavailable);
WRITEUINT8(save->p, inDuel);
WRITEUINT8(save->p, extralaps);
WRITEUINT32(save->p, introtime);
WRITEUINT32(save->p, starttime);
@ -6884,6 +6885,7 @@ static boolean P_NetUnArchiveMisc(savebuffer_t *save, boolean reloading)
spbplace = READSINT8(save->p);
rainbowstartavailable = (boolean)READUINT8(save->p);
inDuel = (boolean)READUINT8(save->p);
extralaps = (boolean)READUINT8(save->p);
introtime = READUINT32(save->p);
starttime = READUINT32(save->p);

View file

@ -1993,6 +1993,11 @@ static void K_HandleLapIncrement(player_t *player)
boolean specialduelexit = (inDuel && !(mapheaderinfo[gamemap-1]->levelflags & LF_SECTIONRACE));
if (specialduelexit)
{
extralaps += 1;
}
// finished race exit setup
if (player->laps > numlaps && !specialduelexit)
{