diff --git a/src/k_bot.c b/src/k_bot.c index da2e720ef..0ece1521f 100644 --- a/src/k_bot.c +++ b/src/k_bot.c @@ -181,7 +181,7 @@ void K_UpdateMatchRaceBots(void) wantedbots = 0; } - if (numbosswaypoints > 0) + if (numbosswaypoints > 0 && !waypointcap) { CONS_Alert(CONS_ERROR, "Bots do not work on maps using the legacy checkpoint system.\nPlease consider using waypoints instead if bot support is desired!\n"); } diff --git a/src/k_grandprix.c b/src/k_grandprix.c index 266a4169d..ab6f3198e 100644 --- a/src/k_grandprix.c +++ b/src/k_grandprix.c @@ -204,7 +204,7 @@ void K_InitGrandPrixBots(void) playercount += (numplayers-2) * 3; } - if (numbosswaypoints > 0) + if (numbosswaypoints > 0 && !waypointcap) { CONS_Alert(CONS_ERROR, "Bots do not work on maps using the legacy checkpoint system.\nPlease consider using waypoints instead if bot support is desired!\n"); wantedbots = 0; diff --git a/src/k_kart.c b/src/k_kart.c index 7b68f60fa..919e94714 100644 --- a/src/k_kart.c +++ b/src/k_kart.c @@ -8000,7 +8000,7 @@ void K_KartLegacyUpdatePosition(player_t *player) player->nextcheck = players[i].nextcheck = 0; // This checks every thing on the map, and looks for MT_BOSS3WAYPOINT (the thing we're using for checkpoint wp's, for now) - for (mo = waypointcap; mo != NULL; mo = mo->tracer) + for (mo = boss3cap; mo != NULL; mo = mo->tracer) { pmo = P_AproxDistance(P_AproxDistance( mo->x - player->mo->x, mo->y - player->mo->y), @@ -8068,35 +8068,25 @@ void K_KartLegacyUpdatePosition(player_t *player) void K_UpdateAllPlayerPositions(void) { INT32 i; - if (numbosswaypoints == 0) + // First loop: Ensure all players' distance to the finish line are all accurate + for (i = 0; i < MAXPLAYERS; i++) { - // First loop: Ensure all players' distance to the finish line are all accurate - for (i = 0; i < MAXPLAYERS; i++) + player_t *player = &players[i]; + if (!playeringame[i] || player->spectator || !player->mo || P_MobjWasRemoved(player->mo)) { - player_t *player = &players[i]; - if (!playeringame[i] || player->spectator || !player->mo || P_MobjWasRemoved(player->mo)) - { - continue; - } - - K_UpdatePlayerWaypoints(player); + continue; } - // Second loop: Ensure all player positions reflect everyone's distances - for (i = 0; i < MAXPLAYERS; i++) - { - if (playeringame[i] && players[i].mo && !P_MobjWasRemoved(players[i].mo)) - { - K_KartUpdatePosition(&players[i]); - } - } + K_UpdatePlayerWaypoints(player); } - else + + // Second loop: Ensure all player positions reflect everyone's distances + for (i = 0; i < MAXPLAYERS; i++) { - // Use legacy postion update code from v1 - for (i = 0; i < MAXPLAYERS; i++) + if (playeringame[i] && players[i].mo && !P_MobjWasRemoved(players[i].mo)) { K_KartLegacyUpdatePosition(&players[i]); + K_KartUpdatePosition(&players[i]); } } } diff --git a/src/k_waypoint.c b/src/k_waypoint.c index ad1a9bddf..4e803fb98 100644 --- a/src/k_waypoint.c +++ b/src/k_waypoint.c @@ -2310,7 +2310,10 @@ boolean K_SetupWaypointList(void) if (!waypointcap) { - CONS_Alert(CONS_ERROR, "No waypoints in map.\n"); + if (numbosswaypoints == 0) + { + CONS_Alert(CONS_ERROR, "No waypoints or checkpoints in map.\n"); + } } else { @@ -2327,7 +2330,10 @@ boolean K_SetupWaypointList(void) if (firstwaypoint == NULL) { - CONS_Alert(CONS_ERROR, "No waypoints in map.\n"); + if (numbosswaypoints == 0) + { + CONS_Alert(CONS_ERROR, "No waypoints or checkpoints in map.\n"); + } } else { diff --git a/src/p_mobj.c b/src/p_mobj.c index 6f5930945..9978f49b6 100644 --- a/src/p_mobj.c +++ b/src/p_mobj.c @@ -56,6 +56,7 @@ actioncache_t actioncachehead; static mobj_t *overlaycap = NULL; mobj_t *kitemcap = NULL; // Used for Kart offensive items (the ones that can get removed by sizedown) mobj_t *waypointcap = NULL; +mobj_t *boss3cap = NULL; mobj_t *mobjcache = NULL; @@ -12089,8 +12090,8 @@ static boolean P_SetupSpawnedMapThing(mapthing_t *mthing, mobj_t *mobj, boolean case MT_BOSS3WAYPOINT: mobj->health = mthing->angle; mobj->movecount = mthing->extrainfo; - P_SetTarget(&mobj->tracer, waypointcap); - P_SetTarget(&waypointcap, mobj); + P_SetTarget(&mobj->tracer, boss3cap); + P_SetTarget(&boss3cap, mobj); numbosswaypoints++; break; case MT_SPIKE: diff --git a/src/p_mobj.h b/src/p_mobj.h index 59403bbeb..4845015d7 100644 --- a/src/p_mobj.h +++ b/src/p_mobj.h @@ -500,6 +500,7 @@ extern actioncache_t actioncachehead; extern mobj_t *kitemcap; extern mobj_t *waypointcap; +extern mobj_t *boss3cap; void P_InitCachedActions(void); void P_RunCachedActions(void); diff --git a/src/p_saveg.c b/src/p_saveg.c index 311026c8a..ab02ff096 100644 --- a/src/p_saveg.c +++ b/src/p_saveg.c @@ -1757,7 +1757,7 @@ typedef enum MD2_SPRITEYOFFSET = 1<<21, MD2_FLOORSPRITESLOPE = 1<<22, MD2_DISPOFFSET = 1<<23, - //free = 1<<24, + MD2_BOSS3CAP = 1<<24, MD2_WAYPOINTCAP = 1<<25, MD2_KITEMCAP = 1<<26, MD2_ITNEXT = 1<<27, @@ -2003,6 +2003,8 @@ static void SaveMobjThinker(const thinker_t *th, const UINT8 type) } if (mobj->dispoffset) diff2 |= MD2_DISPOFFSET; + if (mobj == boss3cap) + diff2 |= MD2_WAYPOINTCAP; if (mobj == waypointcap) diff2 |= MD2_WAYPOINTCAP; if (mobj == kitemcap) @@ -3412,6 +3414,9 @@ static thinker_t* LoadMobjThinker(actionf_p1 thinker) P_InitSkyboxPoint(mobj, mobj->spawnpoint); } + if (diff2 & MD2_BOSS3CAP) + P_SetTarget(&boss3cap, mobj); + if (diff2 & MD2_WAYPOINTCAP) P_SetTarget(&waypointcap, mobj); @@ -4060,7 +4065,7 @@ static void P_NetUnArchiveThinkers(void) P_InitThinkers(); // Oh my god don't blast random memory with our reference counts. - waypointcap = kitemcap = NULL; + boss3cap = waypointcap = kitemcap = NULL; for (i = 0; i <= 15; i++) { skyboxcenterpnts[i] = skyboxviewpnts[i] = NULL; diff --git a/src/p_setup.c b/src/p_setup.c index 695ed26b1..49108cfd3 100644 --- a/src/p_setup.c +++ b/src/p_setup.c @@ -7972,16 +7972,17 @@ boolean P_LoadLevel(boolean fromnetsave, boolean reloadinggamestate) // The waypoint data that's in PU_LEVEL needs to be reset back to 0/NULL now since PU_LEVEL was cleared K_ClearWaypoints(); - // Load the waypoints please! + // Load the ccheckpoints and waypoints please! if (gametyperules & GTR_CIRCUIT && gamestate != GS_TITLESCREEN) { - if (numbosswaypoints == 0) - { + if ((K_SetupWaypointList() == false)) { - CONS_Alert(CONS_ERROR, "Waypoints were not able to be setup and legacy checkpoints do not exist! Player positions will not work correctly.\n"); + if (numbosswaypoints == 0) + { + CONS_Alert(CONS_ERROR, "Waypoints were not able to be setup and legacy checkpoints do not exist! Player positions will not work correctly.\n"); + } } - } } #ifdef HWRENDER // not win32 only 19990829 by Kin diff --git a/src/p_spec.c b/src/p_spec.c index 00fa48871..b0cef65ed 100644 --- a/src/p_spec.c +++ b/src/p_spec.c @@ -1901,7 +1901,26 @@ static void K_HandleLapIncrement(player_t *player) nump++; } + 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->starpostflip = player->mo->flags2 & MF2_OBJECTFLIP; // store flipping + 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 = player->starpostflip = 0; + } + player->laps++; K_UpdateAllPlayerPositions(); diff --git a/src/p_tick.c b/src/p_tick.c index 6f8a815d1..d96498ecd 100644 --- a/src/p_tick.c +++ b/src/p_tick.c @@ -197,6 +197,7 @@ void Command_CountMobjs_f(void) void P_InitThinkers(void) { UINT8 i; + boss3cap = NULL; waypointcap = NULL; kitemcap = NULL; for (i = 0; i < NUM_THINKERLISTS; i++)