mirror of
https://github.com/KartKrewDev/RingRacers.git
synced 2025-12-02 14:12:47 +00:00
K_UpdateAllPlayerPositions
Call this whenever we need accurate player positions. In addition to before player think, is now being used for exiting as well as immediately when the player is spawned.
This commit is contained in:
parent
28c2ff9668
commit
9c264b3736
5 changed files with 34 additions and 30 deletions
23
src/k_kart.c
23
src/k_kart.c
|
|
@ -9507,6 +9507,29 @@ void K_KartUpdatePosition(player_t *player)
|
|||
player->position = position;
|
||||
}
|
||||
|
||||
void K_UpdateAllPlayerPositions(void)
|
||||
{
|
||||
INT32 i;
|
||||
|
||||
// First loop: Ensure all players' distance to the finish line are all accurate
|
||||
for (i = 0; i < MAXPLAYERS; i++)
|
||||
{
|
||||
if (playeringame[i] && players[i].mo && !P_MobjWasRemoved(players[i].mo))
|
||||
{
|
||||
K_UpdateDistanceFromFinishLine(&players[i]);
|
||||
}
|
||||
}
|
||||
|
||||
// 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_StripItems
|
||||
//
|
||||
|
|
|
|||
|
|
@ -139,6 +139,7 @@ INT32 K_GetKartDriftSparkValueForStage(player_t *player, UINT8 stage);
|
|||
void K_SpawnDriftBoostExplosion(player_t *player, int stage);
|
||||
void K_SpawnDriftElectricSparks(player_t *player, int color, boolean shockwave);
|
||||
void K_KartUpdatePosition(player_t *player);
|
||||
void K_UpdateAllPlayerPositions(void);
|
||||
SINT8 K_GetTotallyRandomResult(UINT8 useodds);
|
||||
mobj_t *K_CreatePaperItem(fixed_t x, fixed_t y, fixed_t z, angle_t angle, SINT8 flip, UINT8 type, UINT8 amount);
|
||||
void K_DropItems(player_t *player);
|
||||
|
|
|
|||
|
|
@ -11951,6 +11951,8 @@ void P_AfterPlayerSpawn(INT32 playernum)
|
|||
|
||||
if (CheckForReverseGravity)
|
||||
P_CheckGravity(mobj, false);
|
||||
|
||||
K_UpdateAllPlayerPositions();
|
||||
}
|
||||
|
||||
// spawn it at a playerspawn mapthing
|
||||
|
|
|
|||
36
src/p_tick.c
36
src/p_tick.c
|
|
@ -532,10 +532,12 @@ void P_Ticker(boolean run)
|
|||
|
||||
// Increment jointime and quittime even if paused
|
||||
for (i = 0; i < MAXPLAYERS; i++)
|
||||
{
|
||||
if (playeringame[i])
|
||||
{
|
||||
players[i].jointime++;
|
||||
}
|
||||
}
|
||||
|
||||
if (objectplacing)
|
||||
{
|
||||
|
|
@ -602,32 +604,16 @@ void P_Ticker(boolean run)
|
|||
|
||||
ps_playerthink_time = I_GetPreciseTime();
|
||||
|
||||
#define PLAYERCONDITION(i) (playeringame[i] && players[i].mo && !P_MobjWasRemoved(players[i].mo))
|
||||
// First loop: Ensure all players' distance to the finish line are all accurate
|
||||
for (i = 0; i < MAXPLAYERS; i++)
|
||||
{
|
||||
if (!PLAYERCONDITION(i))
|
||||
continue;
|
||||
K_UpdateDistanceFromFinishLine(&players[i]);
|
||||
}
|
||||
|
||||
// Second loop: Ensure all player positions reflect everyone's distances
|
||||
for (i = 0; i < MAXPLAYERS; i++)
|
||||
{
|
||||
if (!PLAYERCONDITION(i))
|
||||
continue;
|
||||
K_KartUpdatePosition(&players[i]);
|
||||
}
|
||||
K_UpdateAllPlayerPositions();
|
||||
|
||||
// OK! Now that we got all of that sorted, players can think!
|
||||
for (i = 0; i < MAXPLAYERS; i++)
|
||||
{
|
||||
if (!PLAYERCONDITION(i))
|
||||
if (!(playeringame[i] && players[i].mo && !P_MobjWasRemoved(players[i].mo)))
|
||||
continue;
|
||||
P_PlayerThink(&players[i]);
|
||||
K_KartPlayerHUDUpdate(&players[i]);
|
||||
}
|
||||
#undef PLAYERCONDITION
|
||||
|
||||
ps_playerthink_time = I_GetPreciseTime() - ps_playerthink_time;
|
||||
}
|
||||
|
|
@ -869,19 +855,11 @@ void P_PreTicker(INT32 frames)
|
|||
|
||||
R_UpdateMobjInterpolators();
|
||||
|
||||
// First loop: Ensure all players' distance to the finish line are all accurate
|
||||
for (i = 0; i < MAXPLAYERS; i++)
|
||||
if (playeringame[i] && players[i].mo && !P_MobjWasRemoved(players[i].mo))
|
||||
K_UpdateDistanceFromFinishLine(&players[i]);
|
||||
|
||||
// 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]);
|
||||
|
||||
// OK! Now that we got all of that sorted, players can think!
|
||||
LUA_HOOK(PreThinkFrame);
|
||||
|
||||
K_UpdateAllPlayerPositions();
|
||||
|
||||
// OK! Now that we got all of that sorted, players can think!
|
||||
for (i = 0; i < MAXPLAYERS; i++)
|
||||
if (playeringame[i] && players[i].mo && !P_MobjWasRemoved(players[i].mo))
|
||||
{
|
||||
|
|
|
|||
|
|
@ -1284,7 +1284,7 @@ void P_DoPlayerExit(player_t *player)
|
|||
|
||||
if ((gametyperules & GTR_CIRCUIT)) // If in Race Mode, allow
|
||||
{
|
||||
K_KartUpdatePosition(player);
|
||||
K_UpdateAllPlayerPositions();
|
||||
|
||||
if (cv_kartvoices.value)
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue