mirror of
https://git.do.srb2.org/KartKrew/Kart-Public.git
synced 2024-11-17 02:01:15 +00:00
Double-check legitimacy on match completion
This commit is contained in:
parent
e27a60847e
commit
37a74cbd94
3 changed files with 22 additions and 5 deletions
|
@ -445,6 +445,7 @@ extern boolean franticitems;
|
||||||
extern boolean mirrormode;
|
extern boolean mirrormode;
|
||||||
extern boolean comeback;
|
extern boolean comeback;
|
||||||
extern tic_t curlap, bestlap;
|
extern tic_t curlap, bestlap;
|
||||||
|
extern boolean legitimateexit;
|
||||||
|
|
||||||
extern tic_t hidetime;
|
extern tic_t hidetime;
|
||||||
|
|
||||||
|
|
11
src/g_game.c
11
src/g_game.c
|
@ -244,6 +244,8 @@ UINT8 gamespeed; // Game's current speed (or difficulty, or cc, or etc); 0-2 for
|
||||||
boolean mirrormode; // Mirror Mode currently enabled?
|
boolean mirrormode; // Mirror Mode currently enabled?
|
||||||
boolean franticitems; // Frantic items currently enabled?
|
boolean franticitems; // Frantic items currently enabled?
|
||||||
boolean comeback; // Battle Mode's karma comeback is on/off
|
boolean comeback; // Battle Mode's karma comeback is on/off
|
||||||
|
|
||||||
|
boolean legitimateexit; // Did this client actually finish the match? Calculated locally
|
||||||
tic_t curlap; // Current lap time, calculated locally
|
tic_t curlap; // Current lap time, calculated locally
|
||||||
tic_t bestlap; // Best lap time, locally
|
tic_t bestlap; // Best lap time, locally
|
||||||
|
|
||||||
|
@ -2264,7 +2266,9 @@ static inline void G_PlayerFinishLevel(INT32 player)
|
||||||
V_SetPaletteLump(GetPalette()); // Reset the palette
|
V_SetPaletteLump(GetPalette()); // Reset the palette
|
||||||
|
|
||||||
// SRB2kart: Increment the "matches played" counter.
|
// SRB2kart: Increment the "matches played" counter.
|
||||||
if (player == consoleplayer && ((!modifiedgame || savemoddata) && !demoplayback)) // SRB2kart: Yes, let stuff unlock stuff in MP
|
if (player == consoleplayer)
|
||||||
|
{
|
||||||
|
if (legitimateexit && ((!modifiedgame || savemoddata) && !demoplayback))
|
||||||
{
|
{
|
||||||
matchesplayed++;
|
matchesplayed++;
|
||||||
if (M_UpdateUnlockablesAndExtraEmblems())
|
if (M_UpdateUnlockablesAndExtraEmblems())
|
||||||
|
@ -2273,6 +2277,9 @@ static inline void G_PlayerFinishLevel(INT32 player)
|
||||||
G_SaveGameData(); // only save if unlocked something
|
G_SaveGameData(); // only save if unlocked something
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
legitimateexit = false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
|
@ -3892,6 +3899,8 @@ void G_InitNew(UINT8 pultmode, const char *mapname, boolean resetplayer, boolean
|
||||||
if (netgame || multiplayer) // Nice try, haxor.
|
if (netgame || multiplayer) // Nice try, haxor.
|
||||||
ultimatemode = false;
|
ultimatemode = false;
|
||||||
|
|
||||||
|
legitimateexit = false; // SRB2Kart
|
||||||
|
|
||||||
if (!demoplayback && !netgame) // Netgame sets random seed elsewhere, demo playback sets seed just before us!
|
if (!demoplayback && !netgame) // Netgame sets random seed elsewhere, demo playback sets seed just before us!
|
||||||
P_SetRandSeed(M_RandomizedSeed()); // Use a more "Random" random seed
|
P_SetRandSeed(M_RandomizedSeed()); // Use a more "Random" random seed
|
||||||
|
|
||||||
|
|
|
@ -1645,6 +1645,13 @@ void P_DoPlayerExit(player_t *player)
|
||||||
if (player->exiting)
|
if (player->exiting)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
if ((player == &players[consoleplayer]
|
||||||
|
|| (splitscreen && player == &players[secondarydisplayplayer])
|
||||||
|
|| (splitscreen > 1 && player == &players[thirddisplayplayer])
|
||||||
|
|| (splitscreen > 2 && player == &players[fourthdisplayplayer]))
|
||||||
|
&& (!player->spectator && ((!modifiedgame || savemoddata) && !demoplayback)))
|
||||||
|
legitimateexit = true;
|
||||||
|
|
||||||
if (gametype == GT_RACE || gametype == GT_COMPETITION) // If in Race Mode, allow
|
if (gametype == GT_RACE || gametype == GT_COMPETITION) // If in Race Mode, allow
|
||||||
{
|
{
|
||||||
// SRB2kart 120217
|
// SRB2kart 120217
|
||||||
|
|
Loading…
Reference in a new issue