mirror of
https://github.com/KartKrewDev/RingRacers.git
synced 2025-10-30 08:01:28 +00:00
Merge branch 'fix-respawn-cheat' into 'master'
Fix lap cheat prevention failing when player dies Closes #1119 See merge request KartKrew/Kart!2079
This commit is contained in:
commit
f932bccb6c
1 changed files with 29 additions and 0 deletions
29
src/g_game.c
29
src/g_game.c
|
|
@ -2138,6 +2138,7 @@ void G_PlayerReborn(INT32 player, boolean betweenmaps)
|
||||||
boolean enteredGame;
|
boolean enteredGame;
|
||||||
UINT8 lastsafelap;
|
UINT8 lastsafelap;
|
||||||
UINT8 lastsafecheatcheck;
|
UINT8 lastsafecheatcheck;
|
||||||
|
UINT16 bigwaypointgap;
|
||||||
|
|
||||||
roundconditions_t roundconditions;
|
roundconditions_t roundconditions;
|
||||||
boolean saveroundconditions;
|
boolean saveroundconditions;
|
||||||
|
|
@ -2209,6 +2210,31 @@ void G_PlayerReborn(INT32 player, boolean betweenmaps)
|
||||||
// SRB2kart
|
// SRB2kart
|
||||||
memcpy(&itemRoulette, &players[player].itemRoulette, sizeof (itemRoulette));
|
memcpy(&itemRoulette, &players[player].itemRoulette, sizeof (itemRoulette));
|
||||||
memcpy(&respawn, &players[player].respawn, sizeof (respawn));
|
memcpy(&respawn, &players[player].respawn, sizeof (respawn));
|
||||||
|
|
||||||
|
// Here's the exact scenario:
|
||||||
|
// - Respawn with Ring Shooter (or lightsnake in general)
|
||||||
|
// - Spectate, re-enter the game
|
||||||
|
// - Now respawn.pointxyz is set to where the player
|
||||||
|
// spectated
|
||||||
|
// - K_DoIngameRespawn will be called after
|
||||||
|
// G_PlayerReborn (in P_MovePlayerToCheatcheck)
|
||||||
|
// - If the respawn state is not reset here, then the
|
||||||
|
// call to K_DoIngameRespawn will do nothing, and
|
||||||
|
// respawn.pointxyz will stay the same
|
||||||
|
// - This is bad, because when K_RespawnChecker runs, it
|
||||||
|
// clears the init state once the player reaches
|
||||||
|
// respawn.pointxyz
|
||||||
|
// - This is because it assumes respawn.pointxyz is where
|
||||||
|
// the respawn waypoint is located
|
||||||
|
// - In other words, the init state will reset before
|
||||||
|
// lightsnake reaches the respawn waypoint
|
||||||
|
// - This is bad because lap cheat prevention relies on
|
||||||
|
// the init state being cleared after reaching the
|
||||||
|
// respawn waypoint (because moving to the respawn
|
||||||
|
// waypoint could cross a finish line the wrong way and
|
||||||
|
// lose a lap)
|
||||||
|
respawn.state = RESPAWNST_NONE;
|
||||||
|
|
||||||
memcpy(&public_key, &players[player].public_key, sizeof(public_key));
|
memcpy(&public_key, &players[player].public_key, sizeof(public_key));
|
||||||
|
|
||||||
if (betweenmaps || leveltime < introtime)
|
if (betweenmaps || leveltime < introtime)
|
||||||
|
|
@ -2246,6 +2272,7 @@ void G_PlayerReborn(INT32 player, boolean betweenmaps)
|
||||||
cheatchecknum = 0;
|
cheatchecknum = 0;
|
||||||
lastsafelap = 0;
|
lastsafelap = 0;
|
||||||
lastsafecheatcheck = 0;
|
lastsafecheatcheck = 0;
|
||||||
|
bigwaypointgap = 0;
|
||||||
|
|
||||||
saveroundconditions = false;
|
saveroundconditions = false;
|
||||||
tallyactive = false;
|
tallyactive = false;
|
||||||
|
|
@ -2293,6 +2320,7 @@ void G_PlayerReborn(INT32 player, boolean betweenmaps)
|
||||||
|
|
||||||
lastsafelap = players[player].lastsafelap;
|
lastsafelap = players[player].lastsafelap;
|
||||||
lastsafecheatcheck = players[player].lastsafecheatcheck;
|
lastsafecheatcheck = players[player].lastsafecheatcheck;
|
||||||
|
bigwaypointgap = players[player].bigwaypointgap;
|
||||||
|
|
||||||
tallyactive = players[player].tally.active;
|
tallyactive = players[player].tally.active;
|
||||||
if (tallyactive)
|
if (tallyactive)
|
||||||
|
|
@ -2366,6 +2394,7 @@ void G_PlayerReborn(INT32 player, boolean betweenmaps)
|
||||||
p->angleturn = playerangleturn;
|
p->angleturn = playerangleturn;
|
||||||
p->lastsafelap = lastsafelap;
|
p->lastsafelap = lastsafelap;
|
||||||
p->lastsafecheatcheck = lastsafecheatcheck;
|
p->lastsafecheatcheck = lastsafecheatcheck;
|
||||||
|
p->bigwaypointgap = bigwaypointgap;
|
||||||
|
|
||||||
// save player config truth reborn
|
// save player config truth reborn
|
||||||
p->skincolor = skincolor;
|
p->skincolor = skincolor;
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue