Reset player lap when they reset to track

This commit is contained in:
AJ Martinez 2023-10-17 22:18:49 -07:00
parent 5235408b0e
commit f0d0a0f07b
5 changed files with 17 additions and 1 deletions

View file

@ -852,6 +852,8 @@ struct player_t
UINT8 sliptideZipDelay; // How long since the last sliptide? Only boost once you've been straightened out for a bit.
UINT16 sliptideZipBoost; // The actual boost granted from sliptideZip.
UINT8 lastsafelap;
mobj_t *stumbleIndicator;
mobj_t *sliptideZipIndicator;
mobj_t *whip;

View file

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

View file

@ -403,7 +403,12 @@ static void K_MovePlayerToRespawnPoint(player_t *player)
P_SetThingPosition(player->mo);
// We are no longer traveling from death location to 1st waypoint, so use standard timings
player->respawn.fast = false;
// (and reset their lap so they can't cross the finish the wrong way!)
if (player->respawn.fast)
{
player->respawn.fast = false;
player->laps = player->lastsafelap;
}
// At the first valid waypoint, permit extra player control options.
player->respawn.init = false;

View file

@ -329,6 +329,8 @@ static int player_get(lua_State *L)
lua_pushinteger(L, plr->sliptideZipDelay);
else if (fastcmp(field,"sliptideZipBoost"))
lua_pushinteger(L, plr->sliptideZipBoost);
else if (fastcmp(field,"lastsafelap"))
lua_pushinteger(L, plr->lastsafelap);
else if (fastcmp(field,"instaWhipCharge"))
lua_pushinteger(L, plr->instaWhipCharge);
else if (fastcmp(field,"instaWhipCooldown"))
@ -809,6 +811,8 @@ static int player_set(lua_State *L)
plr->sliptideZipDelay = luaL_checkinteger(L, 3);
else if (fastcmp(field,"sliptideZipBoost"))
plr->sliptideZipBoost = luaL_checkinteger(L, 3);
else if (fastcmp(field,"lastsafelap"))
plr->lastsafelap = luaL_checkinteger(L, 3);
else if (fastcmp(field,"instaWhipCharge"))
plr->instaWhipCharge = luaL_checkinteger(L, 3);
else if (fastcmp(field,"instaWhipCooldown"))

View file

@ -539,6 +539,8 @@ static void P_NetArchivePlayers(savebuffer_t *save)
WRITEUINT8(save->p, players[i].sliptideZipDelay);
WRITEUINT16(save->p, players[i].sliptideZipBoost);
WRITEUINT8(save->p, players[i].lastsafelap);
WRITEMEM(save->p, players[i].public_key, PUBKEYLENGTH);
WRITEUINT8(save->p, players[i].instaWhipCharge);
@ -1052,6 +1054,8 @@ static void P_NetUnArchivePlayers(savebuffer_t *save)
players[i].sliptideZipDelay = READUINT8(save->p);
players[i].sliptideZipBoost = READUINT16(save->p);
players[i].lastsafelap = READUINT8(save->p);
READMEM(save->p, players[i].public_key, PUBKEYLENGTH);
players[i].instaWhipCharge = READUINT8(save->p);