mirror of
https://github.com/KartKrewDev/RingRacers.git
synced 2025-10-30 08:01:28 +00:00
Merge branch 'fix-splitscreen-gp-tidy' into 'master'
Fix remaining bugs with splitscreen GP GAME OVER Closes #1251 See merge request KartKrew/Kart!2241
This commit is contained in:
commit
5afa8834ed
7 changed files with 46 additions and 12 deletions
30
src/g_game.c
30
src/g_game.c
|
|
@ -3077,7 +3077,7 @@ void G_BeginLevelExit(void)
|
||||||
g_exit.losing = true;
|
g_exit.losing = true;
|
||||||
g_exit.retry = false;
|
g_exit.retry = false;
|
||||||
|
|
||||||
if (!G_GametypeUsesLives() || skipstats != 0)
|
if (!G_GametypeAllowsRetrying() || skipstats != 0)
|
||||||
{
|
{
|
||||||
g_exit.losing = false; // never force a retry
|
g_exit.losing = false; // never force a retry
|
||||||
}
|
}
|
||||||
|
|
@ -3108,11 +3108,11 @@ void G_BeginLevelExit(void)
|
||||||
{
|
{
|
||||||
if (playeringame[i] && !players[i].spectator && !players[i].bot)
|
if (playeringame[i] && !players[i].spectator && !players[i].bot)
|
||||||
{
|
{
|
||||||
if (players[i].lives > 0)
|
if (G_GametypeUsesLives() && players[i].lives <= 0)
|
||||||
{
|
continue;
|
||||||
g_exit.retry = true;
|
|
||||||
break;
|
g_exit.retry = true;
|
||||||
}
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -3445,6 +3445,24 @@ boolean G_GametypeUsesLives(void)
|
||||||
if (modeattacking) // NOT in Record Attack
|
if (modeattacking) // NOT in Record Attack
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
if (grandprixinfo.gp == true) // In Grand Prix
|
||||||
|
return true;
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// G_GametypeAllowsRetrying
|
||||||
|
//
|
||||||
|
// Returns true if retrying is allowed at all.
|
||||||
|
// (Retrying may still not be possible if the player doesn't
|
||||||
|
// have enough lives.)
|
||||||
|
//
|
||||||
|
boolean G_GametypeAllowsRetrying(void)
|
||||||
|
{
|
||||||
|
if (modeattacking) // Attack modes have their own retry system
|
||||||
|
return false;
|
||||||
|
|
||||||
if ((grandprixinfo.gp == true) // In Grand Prix
|
if ((grandprixinfo.gp == true) // In Grand Prix
|
||||||
&& grandprixinfo.eventmode != GPEVENT_BONUS) // NOT in bonus round
|
&& grandprixinfo.eventmode != GPEVENT_BONUS) // NOT in bonus round
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -198,6 +198,7 @@ INT32 G_GetGametypeByName(const char *gametypestr);
|
||||||
INT32 G_GuessGametypeByTOL(UINT32 tol);
|
INT32 G_GuessGametypeByTOL(UINT32 tol);
|
||||||
|
|
||||||
boolean G_GametypeUsesLives(void);
|
boolean G_GametypeUsesLives(void);
|
||||||
|
boolean G_GametypeAllowsRetrying(void);
|
||||||
boolean G_GametypeHasTeams(void);
|
boolean G_GametypeHasTeams(void);
|
||||||
boolean G_GametypeHasSpectators(void);
|
boolean G_GametypeHasSpectators(void);
|
||||||
INT16 G_SometimesGetDifferentEncore(void);
|
INT16 G_SometimesGetDifferentEncore(void);
|
||||||
|
|
|
||||||
|
|
@ -26,6 +26,11 @@ constexpr INT32 kHudFlags = V_HUDTRANS | V_SLIDEIN;
|
||||||
|
|
||||||
tic_t player_timer(const player_t* player)
|
tic_t player_timer(const player_t* player)
|
||||||
{
|
{
|
||||||
|
if (player->realtime == UINT32_MAX)
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
return K_TranslateTimer(player->realtime, 0, nullptr);
|
return K_TranslateTimer(player->realtime, 0, nullptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -855,7 +855,7 @@ void K_FakeBotResults(player_t *bot)
|
||||||
--------------------------------------------------*/
|
--------------------------------------------------*/
|
||||||
void K_PlayerLoseLife(player_t *player)
|
void K_PlayerLoseLife(player_t *player)
|
||||||
{
|
{
|
||||||
if (!G_GametypeUsesLives())
|
if (!G_GametypeUsesLives() || !G_GametypeAllowsRetrying())
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -2916,6 +2916,14 @@ static int lib_gGametypeUsesLives(lua_State *L)
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int lib_gGametypeAllowsRetrying(lua_State *L)
|
||||||
|
{
|
||||||
|
//HUDSAFE
|
||||||
|
INLEVEL
|
||||||
|
lua_pushboolean(L, G_GametypeAllowsRetrying());
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
static int lib_gGametypeHasTeams(lua_State *L)
|
static int lib_gGametypeHasTeams(lua_State *L)
|
||||||
{
|
{
|
||||||
//HUDSAFE
|
//HUDSAFE
|
||||||
|
|
@ -3795,6 +3803,7 @@ static luaL_Reg lib[] = {
|
||||||
{"G_SetCustomExitVars",lib_gSetCustomExitVars},
|
{"G_SetCustomExitVars",lib_gSetCustomExitVars},
|
||||||
{"G_ExitLevel",lib_gExitLevel},
|
{"G_ExitLevel",lib_gExitLevel},
|
||||||
{"G_GametypeUsesLives",lib_gGametypeUsesLives},
|
{"G_GametypeUsesLives",lib_gGametypeUsesLives},
|
||||||
|
{"G_GametypeAllowsRetrying",lib_gGametypeAllowsRetrying},
|
||||||
{"G_GametypeHasTeams",lib_gGametypeHasTeams},
|
{"G_GametypeHasTeams",lib_gGametypeHasTeams},
|
||||||
{"G_GametypeHasSpectators",lib_gGametypeHasSpectators},
|
{"G_GametypeHasSpectators",lib_gGametypeHasSpectators},
|
||||||
{"G_TicsToHours",lib_gTicsToHours},
|
{"G_TicsToHours",lib_gTicsToHours},
|
||||||
|
|
|
||||||
|
|
@ -197,11 +197,11 @@ void M_OpenPauseMenu(void)
|
||||||
{
|
{
|
||||||
retryallowed = true;
|
retryallowed = true;
|
||||||
}
|
}
|
||||||
else if (G_GametypeUsesLives())
|
else if (G_GametypeAllowsRetrying())
|
||||||
{
|
{
|
||||||
for (i = 0; i <= splitscreen; i++)
|
for (i = 0; i <= splitscreen; i++)
|
||||||
{
|
{
|
||||||
if (players[g_localplayers[i]].lives <= 1)
|
if (G_GametypeUsesLives() && players[g_localplayers[i]].lives <= 1)
|
||||||
continue;
|
continue;
|
||||||
retryallowed = true;
|
retryallowed = true;
|
||||||
break;
|
break;
|
||||||
|
|
|
||||||
|
|
@ -684,7 +684,7 @@ void P_EndingMusic(void)
|
||||||
{
|
{
|
||||||
jingle = "RETIRE";
|
jingle = "RETIRE";
|
||||||
|
|
||||||
if (G_GametypeUsesLives() == true)
|
if (G_GametypeAllowsRetrying() == true)
|
||||||
{
|
{
|
||||||
// A retry will be happening
|
// A retry will be happening
|
||||||
nointer = true;
|
nointer = true;
|
||||||
|
|
@ -694,7 +694,7 @@ void P_EndingMusic(void)
|
||||||
{
|
{
|
||||||
jingle = "_lose";
|
jingle = "_lose";
|
||||||
|
|
||||||
if (G_GametypeUsesLives() == true)
|
if (G_GametypeAllowsRetrying() == true)
|
||||||
{
|
{
|
||||||
// A retry will be happening
|
// A retry will be happening
|
||||||
nointer = true;
|
nointer = true;
|
||||||
|
|
@ -1245,7 +1245,7 @@ void P_DoPlayerExit(player_t *player, pflags_t flags)
|
||||||
const boolean losing = K_IsPlayerLosing(player); // HEY!!!! Set it AFTER K_UpdateAllPlayerPositions!!!!
|
const boolean losing = K_IsPlayerLosing(player); // HEY!!!! Set it AFTER K_UpdateAllPlayerPositions!!!!
|
||||||
const boolean specialout = (specialstageinfo.valid == true && losing == true);
|
const boolean specialout = (specialstageinfo.valid == true && losing == true);
|
||||||
|
|
||||||
if (G_GametypeUsesLives() && losing)
|
if (losing)
|
||||||
{
|
{
|
||||||
// Remove a life from the losing player
|
// Remove a life from the losing player
|
||||||
K_PlayerLoseLife(player);
|
K_PlayerLoseLife(player);
|
||||||
|
|
@ -4169,6 +4169,7 @@ void P_PlayerThink(player_t *player)
|
||||||
player->respawn.pointz = player->mo->z;
|
player->respawn.pointz = player->mo->z;
|
||||||
|
|
||||||
player->pflags |= PF_LOSTLIFE|PF_ELIMINATED|PF_NOCONTEST;
|
player->pflags |= PF_LOSTLIFE|PF_ELIMINATED|PF_NOCONTEST;
|
||||||
|
player->realtime = UINT32_MAX;
|
||||||
K_InitPlayerTally(player);
|
K_InitPlayerTally(player);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue