Add P_ResetPitchRoll

This commit is contained in:
James R 2023-08-27 04:14:00 -07:00
parent 2f331a4d10
commit eabef184f1
4 changed files with 16 additions and 8 deletions

View file

@ -3918,7 +3918,7 @@ void K_StumblePlayer(player_t *player)
P_SetPlayerMobjState(player->mo, S_KART_SPINOUT);
// Reset slope.
player->mo->pitch = player->mo->roll = 0;
P_ResetPitchRoll(player->mo);
}
boolean K_CheckStumble(player_t *player, angle_t oldPitch, angle_t oldRoll, boolean fromAir)
@ -4260,7 +4260,7 @@ static void K_HandleTumbleBounce(player_t *player)
player->tumbleHeight = 10;
player->pflags |= PF_TUMBLELASTBOUNCE;
player->mo->rollangle = 0; // p_user.c will stop rotating the player automatically
player->mo->pitch = player->mo->roll = 0; // Prevent Kodachrome Void infinite
P_ResetPitchRoll(player->mo); // Prevent Kodachrome Void infinite
}
}
@ -6162,8 +6162,7 @@ void K_DoPogoSpring(mobj_t *mo, fixed_t vertispeed, UINT8 sound)
mo->momz = FixedDiv(mo->momz, FixedSqrt(3*FRACUNIT));
}
mo->pitch = 0;
mo->roll = 0;
P_ResetPitchRoll(mo);
if (sound)
{

View file

@ -569,6 +569,7 @@ void P_ExplodeMissile(mobj_t *mo);
void P_CheckGravity(mobj_t *mo, boolean affect);
void P_SetPitchRollFromSlope(mobj_t *mo, pslope_t *slope);
void P_SetPitchRoll(mobj_t *mo, angle_t pitch, angle_t yaw);
void P_ResetPitchRoll(mobj_t *mo);
fixed_t P_ScaleFromMap(fixed_t n, fixed_t scale);
fixed_t P_GetMobjHead(const mobj_t *);
fixed_t P_GetMobjFeet(const mobj_t *);

View file

@ -1333,7 +1333,7 @@ void P_SetPitchRollFromSlope(mobj_t *mo, pslope_t *slope)
}
else
{
mo->pitch = mo->roll = 0;
P_ResetPitchRoll(mo);
}
}
@ -1348,6 +1348,15 @@ void P_SetPitchRoll(mobj_t *mo, angle_t pitch, angle_t yaw)
mo->pitch = FixedMul(pitch, FINECOSINE (yaw));
}
//
// P_ResetPitchRoll
//
void P_ResetPitchRoll(mobj_t *mo)
{
mo->pitch = 0;
mo->roll = 0;
}
#define STOPSPEED (FRACUNIT)
//
@ -7191,7 +7200,7 @@ static boolean P_MobjRegularThink(mobj_t *mobj)
}
case MT_FLOATINGITEM:
{
mobj->pitch = mobj->roll = 0;
P_ResetPitchRoll(mobj);
if (mobj->flags & MF_NOCLIPTHING)
{
if (P_CheckDeathPitCollide(mobj))

View file

@ -488,8 +488,7 @@ void P_ResetPlayer(player_t *player)
if (player->mo != NULL && P_MobjWasRemoved(player->mo) == false)
{
player->mo->pitch = 0;
player->mo->roll = 0;
P_ResetPitchRoll(player->mo);
}
}