mirror of
https://git.do.srb2.org/KartKrew/Kart-Public.git
synced 2025-02-21 03:11:24 +00:00
Map reset timer
This commit is contained in:
parent
75f339f6c1
commit
a4299ce069
6 changed files with 36 additions and 15 deletions
|
@ -453,6 +453,7 @@ extern tic_t wantedcalcdelay;
|
|||
extern tic_t indirectitemcooldown;
|
||||
extern tic_t spbincoming;
|
||||
extern UINT8 spbplayer;
|
||||
extern tic_t mapreset;
|
||||
|
||||
extern boolean legitimateexit;
|
||||
extern boolean comebackshowninfo;
|
||||
|
|
|
@ -256,14 +256,15 @@ INT16 votelevels[4][2]; // Levels that were rolled by the host
|
|||
SINT8 votes[MAXPLAYERS]; // Each player's vote
|
||||
SINT8 pickedvote; // What vote the host rolls
|
||||
|
||||
// Server-sided variables
|
||||
// Server-sided, synched variables
|
||||
SINT8 battlewanted[4]; // WANTED players in battle, worth x2 points
|
||||
tic_t wantedcalcdelay; // Time before it recalculates WANTED
|
||||
tic_t indirectitemcooldown; // Cooldown before any more Shrink, SPB, or any other item that works indirectly is awarded
|
||||
tic_t spbincoming; // Timer before SPB hits, can switch targets at this point
|
||||
UINT8 spbplayer; // Player num that used the last SPB
|
||||
tic_t mapreset; // Map reset delay when enough players have joined an empty game
|
||||
|
||||
// Client-sided variables (NEVER use in anything that needs to be synced with other players)
|
||||
// Client-sided, unsynched variables (NEVER use in anything that needs to be synced with other players)
|
||||
boolean legitimateexit; // Did this client actually finish the match?
|
||||
boolean comebackshowninfo; // Have you already seen the "ATTACK OR PROTECT" message?
|
||||
tic_t curlap; // Current lap time
|
||||
|
|
23
src/k_kart.c
23
src/k_kart.c
|
@ -30,6 +30,7 @@
|
|||
// indirectitemcooldown is timer before anyone's allowed another Shrink/SPB
|
||||
// spbincoming is the timer before k_deathsentence is cast on the player in 1st
|
||||
// spbplayer is the last player who fired a SPB
|
||||
// mapreset is set when enough players fill an empty server
|
||||
|
||||
|
||||
//{ SRB2kart Color Code
|
||||
|
@ -4058,7 +4059,7 @@ void K_CheckSpectateStatus(void)
|
|||
{
|
||||
UINT8 respawnlist[MAXPLAYERS];
|
||||
UINT8 i, no = 0;
|
||||
UINT8 numingame = 0, numjoiners = 0;
|
||||
UINT8 numingame = 0;
|
||||
|
||||
for (i = 0; i < MAXPLAYERS; i++)
|
||||
{
|
||||
|
@ -4069,6 +4070,8 @@ void K_CheckSpectateStatus(void)
|
|||
{
|
||||
numingame++;
|
||||
if (gamestate != GS_LEVEL)
|
||||
continue;
|
||||
if (numingame < 2)
|
||||
continue;
|
||||
if (G_RaceGametype() && players[i].laps > 0)
|
||||
return;
|
||||
|
@ -4080,21 +4083,15 @@ void K_CheckSpectateStatus(void)
|
|||
respawnlist[no++] = i;
|
||||
}
|
||||
|
||||
numjoiners = no; // Move the map change stuff up here when it gets a delay, and remove this redundant numjoiners var
|
||||
// Reset the match if you're in an empty server
|
||||
if (gamestate == GS_LEVEL && (numingame < 2 && numingame+no >= 2))
|
||||
{
|
||||
CONS_Printf("Here comes a new challenger! Resetting map in 10 seconds...\n");
|
||||
mapreset = 10*TICRATE; // Even though only the server uses this for game logic, set for everyone for HUD in the future
|
||||
}
|
||||
|
||||
while (no)
|
||||
P_SpectatorJoinGame(&players[respawnlist[--no]]);
|
||||
|
||||
if (!server)
|
||||
return;
|
||||
|
||||
// Reset the match if you're in an empty server, TODO: put it on a short 5-10 second timer, so you have a chance to roam.
|
||||
if (gamestate == GS_LEVEL && (numingame < 2 && numingame+numjoiners >= 2))
|
||||
{
|
||||
CONS_Printf("Here comes a new challenger! Resetting map...\n");
|
||||
D_MapChange(gamemap, gametype, ultimatemode, true, 0, false, false);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
//}
|
||||
|
|
|
@ -3267,6 +3267,7 @@ static void P_NetArchiveMisc(void)
|
|||
WRITEUINT32(save_p, indirectitemcooldown);
|
||||
WRITEUINT32(save_p, spbincoming);
|
||||
WRITEUINT8(save_p, spbplayer);
|
||||
WRITEUINT32(save_p, mapreset);
|
||||
|
||||
// Is it paused?
|
||||
if (paused)
|
||||
|
@ -3371,6 +3372,7 @@ static inline boolean P_NetUnArchiveMisc(void)
|
|||
indirectitemcooldown = READUINT32(save_p);
|
||||
spbincoming = READUINT32(save_p);
|
||||
spbplayer = READUINT8(save_p);
|
||||
mapreset = READUINT32(save_p);
|
||||
|
||||
// Is it paused?
|
||||
if (READUINT8(save_p) == 0x2f)
|
||||
|
|
|
@ -3017,6 +3017,7 @@ boolean P_SetupLevel(boolean skipprecip)
|
|||
indirectitemcooldown = 0;
|
||||
spbincoming = 0;
|
||||
spbplayer = 0;
|
||||
mapreset = 0;
|
||||
|
||||
// clear special respawning que
|
||||
iquehead = iquetail = 0;
|
||||
|
|
19
src/p_tick.c
19
src/p_tick.c
|
@ -677,6 +677,25 @@ void P_Ticker(boolean run)
|
|||
if (countdown2)
|
||||
countdown2--;
|
||||
|
||||
if (mapreset && --mapreset <= 0)
|
||||
{
|
||||
mapreset = 0;
|
||||
if (server)
|
||||
{
|
||||
UINT8 numingame = 0;
|
||||
for (i = 0; i < MAXPLAYERS; i++) // Make sure there's still actually enough...
|
||||
{
|
||||
if (!playeringame[i] || players[i].spectator)
|
||||
continue;
|
||||
if (++numingame >= 2)
|
||||
{
|
||||
D_MapChange(gamemap, gametype, ultimatemode, true, 0, false, false);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (spbincoming && --spbincoming <= 0)
|
||||
{
|
||||
UINT8 best = 0;
|
||||
|
|
Loading…
Reference in a new issue