mirror of
https://github.com/KartKrewDev/RingRacers.git
synced 2025-10-30 08:01:28 +00:00
Merge branch 'oop-starttime' into 'master'
"starttime" order of operations See merge request KartKrew/Kart!374
This commit is contained in:
commit
cd57c0fefc
6 changed files with 85 additions and 41 deletions
|
|
@ -246,11 +246,11 @@ INT32 gameovertics = 15*TICRATE;
|
||||||
UINT8 ammoremovaltics = 2*TICRATE;
|
UINT8 ammoremovaltics = 2*TICRATE;
|
||||||
|
|
||||||
// SRB2kart
|
// SRB2kart
|
||||||
tic_t introtime = 0;
|
tic_t introtime = 3;
|
||||||
tic_t starttime = 0;
|
tic_t starttime = 3;
|
||||||
|
|
||||||
const tic_t bulbtime = TICRATE/2;
|
const tic_t bulbtime = TICRATE/2;
|
||||||
UINT8 numbulbs = 0;
|
UINT8 numbulbs = 1;
|
||||||
|
|
||||||
tic_t raceexittime = 5*TICRATE + (2*TICRATE/3);
|
tic_t raceexittime = 5*TICRATE + (2*TICRATE/3);
|
||||||
tic_t battleexittime = 8*TICRATE;
|
tic_t battleexittime = 8*TICRATE;
|
||||||
|
|
|
||||||
57
src/k_kart.c
57
src/k_kart.c
|
|
@ -43,6 +43,63 @@
|
||||||
// indirectitemcooldown is timer before anyone's allowed another Shrink/SPB
|
// indirectitemcooldown is timer before anyone's allowed another Shrink/SPB
|
||||||
// mapreset is set when enough players fill an empty server
|
// mapreset is set when enough players fill an empty server
|
||||||
|
|
||||||
|
void K_TimerReset(void)
|
||||||
|
{
|
||||||
|
starttime = introtime = 3;
|
||||||
|
numbulbs = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
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 K_GetPlayerDontDrawFlag(player_t *player)
|
||||||
{
|
{
|
||||||
UINT16 flag = 0;
|
UINT16 flag = 0;
|
||||||
|
|
|
||||||
|
|
@ -17,6 +17,8 @@ angle_t K_ReflectAngle(angle_t angle, angle_t against, fixed_t maxspeed, fixed_t
|
||||||
|
|
||||||
void K_RegisterKartStuff(void);
|
void K_RegisterKartStuff(void);
|
||||||
|
|
||||||
|
void K_TimerReset(void);
|
||||||
|
void K_TimerInit(void);
|
||||||
UINT16 K_GetPlayerDontDrawFlag(player_t *player);
|
UINT16 K_GetPlayerDontDrawFlag(player_t *player);
|
||||||
boolean K_IsPlayerLosing(player_t *player);
|
boolean K_IsPlayerLosing(player_t *player);
|
||||||
fixed_t K_GetKartGameSpeedScalar(SINT8 value);
|
fixed_t K_GetKartGameSpeedScalar(SINT8 value);
|
||||||
|
|
|
||||||
|
|
@ -4180,6 +4180,7 @@ static void P_NetArchiveMisc(void)
|
||||||
|
|
||||||
WRITEUINT32(save_p, introtime);
|
WRITEUINT32(save_p, introtime);
|
||||||
WRITEUINT32(save_p, starttime);
|
WRITEUINT32(save_p, starttime);
|
||||||
|
WRITEUINT8(save_p, numbulbs);
|
||||||
|
|
||||||
// Is it paused?
|
// Is it paused?
|
||||||
if (paused)
|
if (paused)
|
||||||
|
|
@ -4314,6 +4315,7 @@ static inline boolean P_NetUnArchiveMisc(void)
|
||||||
|
|
||||||
introtime = READUINT32(save_p);
|
introtime = READUINT32(save_p);
|
||||||
starttime = READUINT32(save_p);
|
starttime = READUINT32(save_p);
|
||||||
|
numbulbs = READUINT8(save_p);
|
||||||
|
|
||||||
// Is it paused?
|
// Is it paused?
|
||||||
if (READUINT8(save_p) == 0x2f)
|
if (READUINT8(save_p) == 0x2f)
|
||||||
|
|
|
||||||
|
|
@ -3427,29 +3427,6 @@ static void P_InitLevelSettings(void)
|
||||||
players[i].follower = NULL;
|
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
|
// SRB2Kart: map load variables
|
||||||
if (grandprixinfo.gp == true)
|
if (grandprixinfo.gp == true)
|
||||||
{
|
{
|
||||||
|
|
@ -4149,21 +4126,6 @@ boolean P_LoadLevel(boolean fromnetsave)
|
||||||
lastmaploaded = gamemap; // HAS to be set after saving!!
|
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.gp == true)
|
||||||
{
|
{
|
||||||
if (grandprixinfo.initalize == true)
|
if (grandprixinfo.initalize == true)
|
||||||
|
|
@ -4183,6 +4145,20 @@ boolean P_LoadLevel(boolean fromnetsave)
|
||||||
K_UpdateMatchRaceBots();
|
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();
|
||||||
|
}
|
||||||
|
|
||||||
|
K_TimerReset();
|
||||||
|
|
||||||
// No render mode, stop here.
|
// No render mode, stop here.
|
||||||
if (rendermode == render_none)
|
if (rendermode == render_none)
|
||||||
return true;
|
return true;
|
||||||
|
|
|
||||||
|
|
@ -705,6 +705,13 @@ void P_Ticker(boolean run)
|
||||||
if (demo.playback)
|
if (demo.playback)
|
||||||
G_StoreRewindInfo();
|
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();
|
// Z_CheckMemCleanup();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue