mirror of
https://github.com/KartKrewDev/RingRacers.git
synced 2026-04-22 02:00:11 +00:00
Do starttime calculation on second tick instead
Attempts to fix replays & adding bots.
This commit is contained in:
parent
e49d4a4cee
commit
10319386c2
4 changed files with 71 additions and 38 deletions
51
src/k_kart.c
51
src/k_kart.c
|
|
@ -43,6 +43,57 @@
|
|||
// indirectitemcooldown is timer before anyone's allowed another Shrink/SPB
|
||||
// mapreset is set when enough players fill an empty server
|
||||
|
||||
void K_TimerInit(void)
|
||||
{
|
||||
UINT8 i;
|
||||
UINT8 numPlayers = 0;
|
||||
|
||||
for (i = 0; i < MAXPLAYERS; i++)
|
||||
{
|
||||
if (!playeringame[i])
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
if (players[i].spectator == true)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
numPlayers++;
|
||||
}
|
||||
|
||||
if (numPlayers >= 2)
|
||||
{
|
||||
rainbowstartavailable = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
rainbowstartavailable = false;
|
||||
}
|
||||
|
||||
if (numPlayers <= 2)
|
||||
{
|
||||
introtime = 0; // No intro in Record Attack / 1v1
|
||||
}
|
||||
else
|
||||
{
|
||||
introtime = (108) + 5; // 108 for rotation, + 5 for white fade
|
||||
}
|
||||
|
||||
numbulbs = 5;
|
||||
|
||||
if (numPlayers > 2)
|
||||
{
|
||||
numbulbs += (numPlayers-2);
|
||||
}
|
||||
|
||||
starttime = (introtime + (3*TICRATE)) + ((2*TICRATE) + (numbulbs * bulbtime)); // Start countdown time, + buffer time
|
||||
|
||||
// NOW you can try to spawn in the Battle capsules, if there's not enough players for a match
|
||||
K_SpawnBattleCapsules();
|
||||
}
|
||||
|
||||
UINT16 K_GetPlayerDontDrawFlag(player_t *player)
|
||||
{
|
||||
UINT16 flag = 0;
|
||||
|
|
|
|||
|
|
@ -17,6 +17,7 @@ angle_t K_ReflectAngle(angle_t angle, angle_t against, fixed_t maxspeed, fixed_t
|
|||
|
||||
void K_RegisterKartStuff(void);
|
||||
|
||||
void K_TimerInit(void);
|
||||
UINT16 K_GetPlayerDontDrawFlag(player_t *player);
|
||||
boolean K_IsPlayerLosing(player_t *player);
|
||||
fixed_t K_GetKartGameSpeedScalar(SINT8 value);
|
||||
|
|
|
|||
|
|
@ -3427,29 +3427,6 @@ static void P_InitLevelSettings(void)
|
|||
players[i].follower = NULL;
|
||||
}
|
||||
|
||||
rainbowstartavailable = false;
|
||||
|
||||
if (p >= 2)
|
||||
rainbowstartavailable = true;
|
||||
|
||||
if (p <= 2)
|
||||
{
|
||||
introtime = 0; // No intro in Record Attack / 1v1
|
||||
}
|
||||
else
|
||||
{
|
||||
introtime = (108) + 5; // 108 for rotation, + 5 for white fade
|
||||
}
|
||||
|
||||
numbulbs = 5;
|
||||
|
||||
if (p > 2)
|
||||
{
|
||||
numbulbs += (p-2);
|
||||
}
|
||||
|
||||
starttime = (introtime + (3*TICRATE)) + ((2*TICRATE) + (numbulbs * bulbtime)); // Start countdown time, + buffer time
|
||||
|
||||
// SRB2Kart: map load variables
|
||||
if (grandprixinfo.gp == true)
|
||||
{
|
||||
|
|
@ -4149,21 +4126,6 @@ boolean P_LoadLevel(boolean fromnetsave)
|
|||
lastmaploaded = gamemap; // HAS to be set after saving!!
|
||||
}
|
||||
|
||||
if (!fromnetsave) // uglier hack
|
||||
{ // to make a newly loaded level start on the second frame.
|
||||
INT32 buf = gametic % TICQUEUE;
|
||||
for (i = 0; i < MAXPLAYERS; i++)
|
||||
{
|
||||
if (playeringame[i])
|
||||
G_CopyTiccmd(&players[i].cmd, &netcmds[buf][i], 1);
|
||||
}
|
||||
P_PreTicker(2);
|
||||
LUAh_MapLoad();
|
||||
}
|
||||
|
||||
// NOW you can try to spawn in the Battle capsules, if there's not enough players for a match
|
||||
K_SpawnBattleCapsules();
|
||||
|
||||
if (grandprixinfo.gp == true)
|
||||
{
|
||||
if (grandprixinfo.initalize == true)
|
||||
|
|
@ -4183,6 +4145,18 @@ boolean P_LoadLevel(boolean fromnetsave)
|
|||
K_UpdateMatchRaceBots();
|
||||
}
|
||||
|
||||
if (!fromnetsave) // uglier hack
|
||||
{ // to make a newly loaded level start on the second frame.
|
||||
INT32 buf = gametic % TICQUEUE;
|
||||
for (i = 0; i < MAXPLAYERS; i++)
|
||||
{
|
||||
if (playeringame[i])
|
||||
G_CopyTiccmd(&players[i].cmd, &netcmds[buf][i], 1);
|
||||
}
|
||||
P_PreTicker(2);
|
||||
LUAh_MapLoad();
|
||||
}
|
||||
|
||||
// No render mode, stop here.
|
||||
if (rendermode == render_none)
|
||||
return true;
|
||||
|
|
|
|||
|
|
@ -705,6 +705,13 @@ void P_Ticker(boolean run)
|
|||
if (demo.playback)
|
||||
G_StoreRewindInfo();
|
||||
|
||||
if (leveltime == 2)
|
||||
{
|
||||
// The values needed to set this properly are not correct at map load,
|
||||
// so we have to do it at the second tick instead...
|
||||
K_TimerInit();
|
||||
}
|
||||
|
||||
// Z_CheckMemCleanup();
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue