Reset cheatchecks when respawns would decrease lap

This commit is contained in:
AJ Martinez 2024-02-01 23:31:35 -07:00
parent ebbe8203a2
commit 97dcc33f0d
6 changed files with 18 additions and 1 deletions

View file

@ -954,6 +954,7 @@ struct player_t
UINT8 finalfailsafe; // When you can't Ringshooter, force respawn as a last ditch effort!
UINT8 lastsafelap;
UINT8 lastsafecheatcheck;
fixed_t topAccel; // Reduced on straight wall collisions to give players extra recovery time

View file

@ -2112,6 +2112,7 @@ void G_PlayerReborn(INT32 player, boolean betweenmaps)
INT32 checkpointId;
boolean enteredGame;
UINT8 lastsafelap;
UINT8 lastsafecheatcheck;
roundconditions_t roundconditions;
boolean saveroundconditions;
@ -2220,6 +2221,7 @@ void G_PlayerReborn(INT32 player, boolean betweenmaps)
khudfinish = 0;
cheatchecknum = 0;
lastsafelap = 0;
lastsafecheatcheck = 0;
saveroundconditions = false;
tallyactive = false;
@ -2267,6 +2269,7 @@ void G_PlayerReborn(INT32 player, boolean betweenmaps)
saveroundconditions = true;
lastsafelap = players[player].lastsafelap;
lastsafecheatcheck = players[player].lastsafecheatcheck;
tallyactive = players[player].tally.active;
if (tallyactive)
@ -2339,6 +2342,7 @@ void G_PlayerReborn(INT32 player, boolean betweenmaps)
p->steering = steering;
p->angleturn = playerangleturn;
p->lastsafelap = lastsafelap;
p->lastsafecheatcheck = lastsafecheatcheck;
// save player config truth reborn
p->skincolor = skincolor;

View file

@ -9578,6 +9578,7 @@ static waypoint_t *K_GetPlayerNextWaypoint(player_t *player)
{
player->respawn.wp = bestwaypoint;
player->lastsafelap = player->laps;
player->lastsafecheatcheck = player->cheatchecknum;
}
}

View file

@ -317,7 +317,12 @@ void K_DoIngameRespawn(player_t *player)
player->respawn.init = true;
player->respawn.fast = true;
player->respawn.returnspeed = 0;
player->laps = min(player->laps, player->lastsafelap);
if (player->lastsafelap < player->laps)
{
player->laps = player->lastsafelap;
player->cheatchecknum = player->lastsafecheatcheck;
}
player->respawn.airtimer = player->airtime;
player->respawn.truedeath = !!(player->pflags & PF_FAULT);

View file

@ -345,6 +345,8 @@ static int player_get(lua_State *L)
lua_pushinteger(L, plr->finalfailsafe);
else if (fastcmp(field,"lastsafelap"))
lua_pushinteger(L, plr->lastsafelap);
else if (fastcmp(field,"lastsafecheatcheck"))
lua_pushinteger(L, plr->lastsafecheatcheck);
else if (fastcmp(field,"topAccel"))
lua_pushinteger(L, plr->topAccel);
else if (fastcmp(field,"instaWhipCharge"))
@ -869,6 +871,8 @@ static int player_set(lua_State *L)
plr->finalfailsafe = luaL_checkinteger(L, 3);
else if (fastcmp(field,"lastsafelap"))
plr->lastsafelap = luaL_checkinteger(L, 3);
else if (fastcmp(field,"lastsafecheatcheck"))
plr->lastsafecheatcheck = luaL_checkinteger(L, 3);
else if (fastcmp(field,"topAccel"))
plr->topAccel = luaL_checkinteger(L, 3);
else if (fastcmp(field,"instaWhipCharge"))

View file

@ -572,6 +572,7 @@ static void P_NetArchivePlayers(savebuffer_t *save)
WRITEUINT8(save->p, players[i].finalfailsafe);
WRITEUINT8(save->p, players[i].lastsafelap);
WRITEUINT8(save->p, players[i].lastsafecheatcheck);
WRITEFIXED(save->p, players[i].topAccel);
@ -1146,6 +1147,7 @@ static void P_NetUnArchivePlayers(savebuffer_t *save)
players[i].finalfailsafe = READUINT8(save->p);
players[i].lastsafelap = READUINT8(save->p);
players[i].lastsafecheatcheck = READUINT8(save->p);
players[i].topAccel = READFIXED(save->p);