From 2cf5350c0f1139f432dea95aa96fa5dd6ad30b78 Mon Sep 17 00:00:00 2001 From: toaster Date: Wed, 28 Nov 2018 16:33:52 +0000 Subject: [PATCH 1/2] LF_SECTIONRACE now has a secondary function! * Sets the player respawn coords on the finish line, so dying in the short interval between crossing an intermediate finish line and hitting a checkpoint doesn't send you all the way back to the beginning. --- src/g_game.c | 2 +- src/p_spec.c | 22 +++++++++++++++++----- 2 files changed, 18 insertions(+), 6 deletions(-) diff --git a/src/g_game.c b/src/g_game.c index 80fc39509..0f3ec59f7 100644 --- a/src/g_game.c +++ b/src/g_game.c @@ -2997,7 +2997,7 @@ void G_DoReborn(INT32 playernum) // respawn at the start mobj_t *oldmo = NULL; - if (player->starpostnum) // SRB2kart + if (player->starpostnum || ((mapheaderinfo[gamemap - 1]->levelflags & LF_SECTIONRACE) && player->laps)) // SRB2kart starpost = true; // first dissasociate the corpse diff --git a/src/p_spec.c b/src/p_spec.c index 935c7d905..7ac637d46 100644 --- a/src/p_spec.c +++ b/src/p_spec.c @@ -4240,12 +4240,24 @@ DoneSection2: curlap = 0; } - // Reset starposts (checkpoints) info - // SRB2kart 200117 - player->starpostangle = player->starpostnum = 0; - player->starpostx = player->starposty = player->starpostz = 0; - //except the time! player->starposttime = player->realtime; + player->starpostnum = 0; + + if (mapheaderinfo[gamemap - 1]->levelflags & LF_SECTIONRACE) + { + // SRB2Kart 281118 + // Save the player's time and position. + player->starpostx = player->mo->x>>FRACBITS; + player->starposty = player->mo->y>>FRACBITS; + player->starpostz = player->mo->floorz>>FRACBITS; + player->starpostangle = player->mo->angle; //R_PointToAngle2(0, 0, player->mo->momx, player->mo->momy); torn; a momentum-based guess is less likely to be wrong in general, but when it IS wrong, it fucks you over entirely... + } + else + { + // SRB2kart 200117 + // Reset starposts (checkpoints) info + player->starpostangle = player->starpostx = player->starposty = player->starpostz = 0; + } if (P_IsLocalPlayer(player)) { From 7b3e55b43124c0762d6eaa301f6a5875a40918bf Mon Sep 17 00:00:00 2001 From: toaster Date: Wed, 28 Nov 2018 16:45:45 +0000 Subject: [PATCH 2/2] Upper-bound restrict the setting of numlaps for sectionrace levels mid-game --- src/d_netcmd.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/d_netcmd.c b/src/d_netcmd.c index e5d2f0cb2..b8f37cee0 100644 --- a/src/d_netcmd.c +++ b/src/d_netcmd.c @@ -4231,9 +4231,17 @@ static void PointLimit_OnChange(void) static void NumLaps_OnChange(void) { + if (!G_RaceGametype() || (modeattacking || demoplayback)) + return; + + if (server && Playing() + && (netgame || multiplayer) + && (mapheaderinfo[gamemap - 1]->levelflags & LF_SECTIONRACE) + && (cv_numlaps.value > mapheaderinfo[gamemap - 1]->numlaps)) + CV_StealthSetValue(&cv_numlaps, mapheaderinfo[gamemap - 1]->numlaps); + // Just don't be verbose - if (G_RaceGametype() && !(modeattacking || demoplayback)) - CONS_Printf(M_GetText("Number of laps set to %d\n"), cv_numlaps.value); + CONS_Printf(M_GetText("Number of laps set to %d\n"), cv_numlaps.value); } static void NetTimeout_OnChange(void)