Update p.exiting and exitcountdown to match Kart (closes #142)
exitcountdown is now manually set and G_BeginLevelExit doesn't touch it g_exit now has an "already finished" flag to avoid relying on these
This commit is contained in:
parent
2c75e46855
commit
4eaf109786
5 changed files with 52 additions and 49 deletions
|
|
@ -636,6 +636,7 @@ struct exitcondition_t
|
|||
{
|
||||
boolean losing;
|
||||
boolean retry;
|
||||
boolean hasfinished;
|
||||
};
|
||||
|
||||
// For racing
|
||||
|
|
|
|||
10
src/g_game.c
10
src/g_game.c
|
|
@ -3244,6 +3244,10 @@ void G_AddPlayer(INT32 playernum, INT32 console)
|
|||
|
||||
void G_BeginLevelExit(void)
|
||||
{
|
||||
if (g_exit.hasfinished)
|
||||
return; // the round has already finished!
|
||||
|
||||
g_exit.hasfinished = true;
|
||||
g_exit.losing = true;
|
||||
g_exit.retry = false;
|
||||
|
||||
|
|
@ -3285,13 +3289,7 @@ void G_BeginLevelExit(void)
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
exitcountdown = raceexittime+1;
|
||||
|
||||
if (g_exit.losing)
|
||||
{
|
||||
if (!g_exit.retry)
|
||||
{
|
||||
ACS_RunGameOverScript();
|
||||
|
|
|
|||
|
|
@ -5396,10 +5396,11 @@ static void P_NetArchiveMisc(savebuffer_t *save, boolean resending)
|
|||
|
||||
WRITEUINT32(save->p, racecountdown);
|
||||
WRITEUINT32(save->p, exitcountdown);
|
||||
|
||||
|
||||
// exitcondition_t
|
||||
WRITEUINT8(save->p, g_exit.losing);
|
||||
WRITEUINT8(save->p, g_exit.retry);
|
||||
WRITEUINT8(save->p, g_exit.hasfinished);
|
||||
|
||||
WRITEFIXED(save->p, gravity);
|
||||
WRITEFIXED(save->p, mapobjectscale);
|
||||
|
|
@ -5789,7 +5790,8 @@ FUNCINLINE static ATTRINLINE boolean P_NetUnArchiveMisc(savebuffer_t *save, bool
|
|||
// exitcondition_t
|
||||
g_exit.losing = READUINT8(save->p);
|
||||
g_exit.retry = READUINT8(save->p);
|
||||
|
||||
g_exit.hasfinished = READUINT8(save->p);
|
||||
|
||||
gravity = READFIXED(save->p);
|
||||
mapobjectscale = READFIXED(save->p);
|
||||
|
||||
|
|
|
|||
|
|
@ -8106,8 +8106,7 @@ static void P_InitLevelSettings(boolean reloadinggamestate)
|
|||
racecountdown = exitcountdown = exitfadestarted = 0;
|
||||
curlap = bestlap = 0; // SRB2Kart
|
||||
|
||||
g_exit.losing = false;
|
||||
g_exit.retry = false;
|
||||
g_exit.losing = g_exit.retry = g_exit.hasfinished = false;
|
||||
|
||||
// SRB2Kart: map load variables
|
||||
if (grandprixinfo.gp == true)
|
||||
|
|
|
|||
81
src/p_user.c
81
src/p_user.c
|
|
@ -1282,23 +1282,22 @@ void P_DoPlayerExit(player_t *player, pflags_t flags)
|
|||
|
||||
if (P_IsLocalPlayer(player) && (!player->spectator && !demo.playback))
|
||||
legitimateexit = true;
|
||||
|
||||
|
||||
if (player->griefstrikes > 0)
|
||||
player->griefstrikes--; // Remove a strike for finishing a race normally
|
||||
|
||||
player->exiting = 1;
|
||||
|
||||
if (!player->spectator && (gametyperules & GTR_CIRCUIT)) // Special Race-like handling
|
||||
{
|
||||
K_UpdateAllPlayerPositions();
|
||||
}
|
||||
|
||||
|
||||
losing = K_IsPlayerLosing(player); // HEY!!!! Set it AFTER K_UpdateAllPlayerPositions!!!!
|
||||
|
||||
if (!player->spectator)
|
||||
{
|
||||
if ((gametyperules & GTR_CIRCUIT)) // If in Race Mode, allow
|
||||
{
|
||||
player->exiting = raceexittime+2;
|
||||
if (cv_kartvoices.value)
|
||||
{
|
||||
const INT32 sfx_id = (losing ? sfx_klose : sfx_kwin);
|
||||
|
|
@ -1309,21 +1308,22 @@ void P_DoPlayerExit(player_t *player, pflags_t flags)
|
|||
if (!K_CanChangeRules() || cv_inttime.value > 0)
|
||||
P_EndingMusic(player);
|
||||
|
||||
if (P_CheckRacers() && !exitcountdown)
|
||||
if (P_CheckRacers())
|
||||
{
|
||||
player->exiting = raceexittime+1;
|
||||
G_BeginLevelExit();
|
||||
}
|
||||
}
|
||||
else if ((gametyperules & GTR_BUMPERS)) // Battle Mode exiting
|
||||
{
|
||||
if (!exitcountdown)
|
||||
exitcountdown = battleexittime+1;
|
||||
player->exiting = battleexittime+1;
|
||||
G_BeginLevelExit();
|
||||
P_EndingMusic(player);
|
||||
}
|
||||
else // Accidental death safeguard???
|
||||
{
|
||||
if (!exitcountdown)
|
||||
G_BeginLevelExit();
|
||||
player->exiting = raceexittime+2;
|
||||
G_BeginLevelExit();
|
||||
}
|
||||
|
||||
if (grandprixinfo.gp == true)
|
||||
|
|
@ -3603,7 +3603,10 @@ void P_DoTimeOver(player_t *player)
|
|||
P_EndingMusic(player);
|
||||
|
||||
if (!exitcountdown)
|
||||
{
|
||||
G_BeginLevelExit();
|
||||
exitcountdown = 5*TICRATE;
|
||||
}
|
||||
}
|
||||
|
||||
// SRB2Kart: These are useful functions, but we aren't using them yet.
|
||||
|
|
@ -3940,6 +3943,36 @@ void P_PlayerThink(player_t *player)
|
|||
player->kickstartaccel = ACCEL_KICKSTART+1;
|
||||
}
|
||||
|
||||
// MKWii-styled icon spinouts: do a full 360 rotation before stopping.
|
||||
if (P_PlayerInPain(player))
|
||||
{
|
||||
if (player->spinoutrot < MAXSPINROT)
|
||||
{
|
||||
if ((player->spinoutrot + SPINOUTROTSPEED) >= MAXSPINROT)
|
||||
{
|
||||
player->spinoutrot = (player->spinoutrot + SPINOUTROTSPEED) % MAXSPINROT;
|
||||
}
|
||||
else
|
||||
{
|
||||
player->spinoutrot += SPINOUTROTSPEED;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if ((player->spinoutrot) && (player->spinoutrot < MAXSPINROT))
|
||||
{
|
||||
if ((player->spinoutrot + SPINOUTROTSPEED) >= MAXSPINROT)
|
||||
{
|
||||
player->spinoutrot = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
player->spinoutrot += SPINOUTROTSPEED;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef PARANOIA
|
||||
if (player->playerstate == PST_REBORN)
|
||||
I_Error("player %s is in PST_REBORN\n", sizeu1(playeri));
|
||||
|
|
@ -3989,36 +4022,6 @@ void P_PlayerThink(player_t *player)
|
|||
}
|
||||
}
|
||||
|
||||
// MKWii-styled icon spinouts: do a full 360 rotation before stopping.
|
||||
if (P_PlayerInPain(player))
|
||||
{
|
||||
if (player->spinoutrot < MAXSPINROT)
|
||||
{
|
||||
if ((player->spinoutrot + SPINOUTROTSPEED) >= MAXSPINROT)
|
||||
{
|
||||
player->spinoutrot = (player->spinoutrot + SPINOUTROTSPEED) % MAXSPINROT;
|
||||
}
|
||||
else
|
||||
{
|
||||
player->spinoutrot += SPINOUTROTSPEED;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if ((player->spinoutrot) && (player->spinoutrot < MAXSPINROT))
|
||||
{
|
||||
if ((player->spinoutrot + SPINOUTROTSPEED) >= MAXSPINROT)
|
||||
{
|
||||
player->spinoutrot = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
player->spinoutrot += SPINOUTROTSPEED;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// If it is set, start subtracting
|
||||
// Don't allow it to go back to 0
|
||||
if (player->exiting > 1 && (player->exiting < raceexittime+2 || !(gametyperules & GTR_CIRCUIT))) // SRB2kart - "&& player->exiting > 1"
|
||||
|
|
|
|||
Loading…
Reference in a new issue