mirror of
https://github.com/KartKrewDev/RingRacers.git
synced 2025-10-30 08:01:28 +00:00
Correct player angle when respawning from crushing
This commit is contained in:
parent
9042f31dc3
commit
2f6962c103
9 changed files with 50 additions and 29 deletions
|
|
@ -3028,7 +3028,7 @@ static void Got_Respawn(UINT8 **cp, INT32 playernum)
|
|||
if (!P_IsObjectOnGround(players[respawnplayer].mo))
|
||||
return;
|
||||
|
||||
K_DoIngameRespawn(&players[respawnplayer], false);
|
||||
K_DoIngameRespawn(&players[respawnplayer]);
|
||||
demo_extradata[playernum] |= DXD_RESPAWN;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -243,7 +243,7 @@ void G_ReadDemoExtraData(void)
|
|||
if (players[p].mo)
|
||||
{
|
||||
// Is this how this should work..?
|
||||
K_DoIngameRespawn(&players[p], false);
|
||||
K_DoIngameRespawn(&players[p]);
|
||||
}
|
||||
}
|
||||
if (extradata & DXD_SKIN)
|
||||
|
|
|
|||
|
|
@ -2310,7 +2310,7 @@ void G_PlayerReborn(INT32 player, boolean betweenmaps)
|
|||
|
||||
if (leveltime > (starttime + (TICRATE/2)) && !p->spectator)
|
||||
{
|
||||
K_DoIngameRespawn(p, true);
|
||||
K_DoIngameRespawn(p);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -81,16 +81,16 @@ static void K_RespawnAtWaypoint(player_t *player, waypoint_t *waypoint)
|
|||
player->respawn.pointx = waypoint->mobj->x;
|
||||
player->respawn.pointy = waypoint->mobj->y;
|
||||
player->respawn.pointz = waypoint->mobj->z;
|
||||
player->respawn.flip = (waypoint->mobj->flags2 & MF2_OBJECTFLIP) ? true : false; // K_RespawnOffset wants a boolean!
|
||||
player->respawn.flip = (waypoint->mobj->flags2 & MF2_OBJECTFLIP) ? true : false; // K_RespawnOffset wants a boolean!
|
||||
player->respawn.pointz += K_RespawnOffset(player, player->respawn.flip);
|
||||
}
|
||||
|
||||
/*--------------------------------------------------
|
||||
void K_DoIngameRespawn(player_t *player, boolean fromTheDead)
|
||||
void K_DoIngameRespawn(player_t *player)
|
||||
|
||||
See header file for description.
|
||||
--------------------------------------------------*/
|
||||
void K_DoIngameRespawn(player_t *player, boolean fromTheDead)
|
||||
void K_DoIngameRespawn(player_t *player)
|
||||
{
|
||||
if (!player->mo || P_MobjWasRemoved(player->mo))
|
||||
{
|
||||
|
|
@ -117,18 +117,14 @@ void K_DoIngameRespawn(player_t *player, boolean fromTheDead)
|
|||
|
||||
player->kartstuff[k_ringboost] = 0;
|
||||
player->kartstuff[k_driftboost] = 0;
|
||||
player->kartstuff[k_drift] = 0;
|
||||
player->kartstuff[k_driftcharge] = 0;
|
||||
player->kartstuff[k_pogospring] = 0;
|
||||
|
||||
P_ResetPlayer(player);
|
||||
|
||||
// Set up respawn position if invalid
|
||||
if (player->respawn.wp != NULL && leveltime >= starttime)
|
||||
{
|
||||
const UINT32 dist = RESPAWN_DIST + (player->airtime * 48);
|
||||
if (fromTheDead == true)
|
||||
player->respawn.distanceleft = 0;
|
||||
else
|
||||
player->respawn.distanceleft = (dist * mapobjectscale) / FRACUNIT;
|
||||
player->respawn.distanceleft = (dist * mapobjectscale) / FRACUNIT;
|
||||
K_RespawnAtWaypoint(player, player->respawn.wp);
|
||||
}
|
||||
else
|
||||
|
|
@ -236,17 +232,11 @@ void K_DoIngameRespawn(player_t *player, boolean fromTheDead)
|
|||
}
|
||||
|
||||
/*--------------------------------------------------
|
||||
static size_t K_NextRespawnWaypointIndex(waypoint_t *waypoint)
|
||||
size_t K_NextRespawnWaypointIndex(waypoint_t *waypoint)
|
||||
|
||||
Returns the index for the next respawn waypoint.
|
||||
|
||||
Input Arguments:-
|
||||
waypoint - Waypoint to look after.
|
||||
|
||||
Return:-
|
||||
An table index for waypoint_t -> nextwaypoints.
|
||||
See header file for description.
|
||||
--------------------------------------------------*/
|
||||
static size_t K_NextRespawnWaypointIndex(waypoint_t *waypoint)
|
||||
size_t K_NextRespawnWaypointIndex(waypoint_t *waypoint)
|
||||
{
|
||||
size_t i = 0U;
|
||||
size_t newwaypoint = SIZE_MAX;
|
||||
|
|
|
|||
|
|
@ -39,20 +39,34 @@ fixed_t K_RespawnOffset(player_t *player, boolean flip);
|
|||
|
||||
|
||||
/*--------------------------------------------------
|
||||
void K_DoIngameRespawn(player_t *player, boolean fromTheDead);
|
||||
void K_DoIngameRespawn(player_t *player);
|
||||
|
||||
Starts the respawning animation for the specified player,
|
||||
updating their respawn variables in preparation.
|
||||
|
||||
Input Arguments:-
|
||||
player - Player to preform this for.
|
||||
fromTheDead - Doesn't set the distance variable. If respawning from dying, then this should be true.
|
||||
|
||||
Return:-
|
||||
None
|
||||
--------------------------------------------------*/
|
||||
|
||||
void K_DoIngameRespawn(player_t *player, boolean fromTheDead);
|
||||
void K_DoIngameRespawn(player_t *player);
|
||||
|
||||
|
||||
/*--------------------------------------------------
|
||||
size_t K_NextRespawnWaypointIndex(waypoint_t *waypoint);
|
||||
|
||||
Returns the index for the next respawn waypoint.
|
||||
|
||||
Input Arguments:-
|
||||
waypoint - Waypoint to look past.
|
||||
|
||||
Return:-
|
||||
An table index for waypoint_t -> nextwaypoints.
|
||||
--------------------------------------------------*/
|
||||
|
||||
size_t K_NextRespawnWaypointIndex(waypoint_t *waypoint);
|
||||
|
||||
|
||||
/*--------------------------------------------------
|
||||
|
|
|
|||
|
|
@ -11174,7 +11174,7 @@ void A_RemoteDamage(mobj_t *actor)
|
|||
if (locvar2 == 1) // Kill mobj!
|
||||
{
|
||||
if (target->player)
|
||||
K_DoIngameRespawn(target->player, false);
|
||||
K_DoIngameRespawn(target->player);
|
||||
else
|
||||
P_KillMobj(target, source, source, DMG_NORMAL);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1660,7 +1660,7 @@ static boolean P_KillPlayer(player_t *player, UINT8 type)
|
|||
{
|
||||
case DMG_DEATHPIT:
|
||||
// Respawn kill types
|
||||
K_DoIngameRespawn(player, false);
|
||||
K_DoIngameRespawn(player);
|
||||
return false;
|
||||
default:
|
||||
// Everything else REALLY kills
|
||||
|
|
|
|||
19
src/p_mobj.c
19
src/p_mobj.c
|
|
@ -10314,7 +10314,7 @@ void P_MovePlayerToStarpost(INT32 playernum)
|
|||
mobj_t *mobj = p->mo;
|
||||
I_Assert(mobj != NULL);
|
||||
|
||||
K_DoIngameRespawn(p, true);
|
||||
K_DoIngameRespawn(p);
|
||||
|
||||
P_UnsetThingPosition(mobj);
|
||||
mobj->x = p->respawn.pointx;
|
||||
|
|
@ -10338,6 +10338,23 @@ void P_MovePlayerToStarpost(INT32 playernum)
|
|||
|
||||
mobj->z = z;
|
||||
|
||||
// Correct angle
|
||||
if (p->respawn.wp != NULL)
|
||||
{
|
||||
size_t nwp = K_NextRespawnWaypointIndex(p->respawn.wp);
|
||||
waypoint_t *wp;
|
||||
|
||||
if (nwp != SIZE_MAX)
|
||||
{
|
||||
wp = p->respawn.wp->nextwaypoints[nwp];
|
||||
|
||||
mobj->angle = p->drawangle = R_PointToAngle2(
|
||||
mobj->x, mobj->y,
|
||||
wp->mobj->x, wp->mobj->y
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
P_AfterPlayerSpawn(playernum);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1992,7 +1992,7 @@ static void K_HandleLapIncrement(player_t *player)
|
|||
if (leveltime < starttime)
|
||||
{
|
||||
// Will fault the player
|
||||
K_DoIngameRespawn(player, false);
|
||||
K_DoIngameRespawn(player);
|
||||
}
|
||||
else if ((player->starpostnum == numstarposts) || (player->laps == 0))
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue