mirror of
https://git.do.srb2.org/STJr/SRB2.git
synced 2024-11-25 13:51:43 +00:00
P_ReverseQuantiseMomentumToSlope is now a function. (I was thinking about a macro, but couldn't get it down.)
Also, the teetering angle on slopes is now FRACUNIT/2 because there's literally no way to stand still on a slope that steep unless it doesn't have physics.
This commit is contained in:
parent
9e87f6d85d
commit
2c676eea43
4 changed files with 17 additions and 17 deletions
|
@ -2377,10 +2377,7 @@ static boolean P_ZMovement(mobj_t *mo)
|
|||
if ((mo->eflags & MFE_VERTICALFLIP) ? tmceilingslope : tmfloorslope) {
|
||||
mo->standingslope = (mo->eflags & MFE_VERTICALFLIP) ? tmceilingslope : tmfloorslope;
|
||||
|
||||
// Reverse quantizing might could use its own function later
|
||||
mo->standingslope->zangle = ANGLE_MAX-mo->standingslope->zangle;
|
||||
P_QuantizeMomentumToSlope(&mom, mo->standingslope);
|
||||
mo->standingslope->zangle = ANGLE_MAX-mo->standingslope->zangle;
|
||||
P_ReverseQuantizeMomentumToSlope(&mom, mo->standingslope);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
|
|
@ -767,6 +767,17 @@ void P_QuantizeMomentumToSlope(vector3_t *momentum, pslope_t *slope)
|
|||
FV3_Rotate(momentum, &axis, slope->zangle >> ANGLETOFINESHIFT);
|
||||
}
|
||||
|
||||
//
|
||||
// P_ReverseQuantizeMomentumToSlope
|
||||
//
|
||||
// When given a vector, rotates and aligns it to a flat surface (from being relative to a given slope)
|
||||
void P_ReverseQuantizeMomentumToSlope(vector3_t *momentum, pslope_t *slope)
|
||||
{
|
||||
slope->zangle = InvAngle(slope->zangle);
|
||||
P_QuantizeMomentumToSlope(momentum, slope);
|
||||
slope->zangle = InvAngle(slope->zangle);
|
||||
}
|
||||
|
||||
//
|
||||
// P_SlopeLaunch
|
||||
//
|
||||
|
@ -810,12 +821,7 @@ void P_HandleSlopeLanding(mobj_t *thing, pslope_t *slope)
|
|||
mom.y = thing->momy;
|
||||
mom.z = thing->momz*2;
|
||||
|
||||
//CONS_Printf("Landing on slope\n");
|
||||
|
||||
// Reverse quantizing might could use its own function later
|
||||
slope->zangle = ANGLE_MAX-slope->zangle;
|
||||
P_QuantizeMomentumToSlope(&mom, slope);
|
||||
slope->zangle = ANGLE_MAX-slope->zangle;
|
||||
P_ReverseQuantizeMomentumToSlope(&mom, slope);
|
||||
|
||||
if (P_MobjFlip(thing)*mom.z < 0) { // falling, land on slope
|
||||
thing->momx = mom.x;
|
||||
|
|
|
@ -35,6 +35,7 @@ fixed_t P_GetZAt(pslope_t *slope, fixed_t x, fixed_t y);
|
|||
|
||||
// Lots of physics-based bullshit
|
||||
void P_QuantizeMomentumToSlope(vector3_t *momentum, pslope_t *slope);
|
||||
void P_ReverseQuantizeMomentumToSlope(vector3_t *momentum, pslope_t *slope);
|
||||
void P_SlopeLaunch(mobj_t *mo);
|
||||
void P_HandleSlopeLanding(mobj_t *thing, pslope_t *slope);
|
||||
void P_ButteredSlope(mobj_t *mo);
|
||||
|
|
10
src/p_user.c
10
src/p_user.c
|
@ -1851,12 +1851,8 @@ static void P_CheckBouncySectors(player_t *player)
|
|||
momentum.y = player->mo->momy;
|
||||
momentum.z = player->mo->momz*2;
|
||||
|
||||
if (slope) {
|
||||
// Reverse quantizing might could use its own function later
|
||||
slope->zangle = ANGLE_MAX-slope->zangle;
|
||||
P_QuantizeMomentumToSlope(&momentum, slope);
|
||||
slope->zangle = ANGLE_MAX-slope->zangle;
|
||||
}
|
||||
if (slope)
|
||||
P_ReverseQuantizeMomentumToSlope(&momentum, slope);
|
||||
|
||||
newmom = momentum.z = -FixedMul(momentum.z,linedist)/2;
|
||||
#else
|
||||
|
@ -2856,7 +2852,7 @@ static void P_DoTeeter(player_t *player)
|
|||
fixed_t topheight, bottomheight; // for 3d floor usage
|
||||
const fixed_t tiptop = FixedMul(MAXSTEPMOVE, player->mo->scale); // Distance you have to be above the ground in order to teeter.
|
||||
|
||||
#define maxzdelta 3<<(FRACBITS-2) // 3/4 on the fixed scale
|
||||
#define maxzdelta 1<<(FRACBITS-1) // 1/2 on the fixed scale
|
||||
if (player->mo->standingslope && player->mo->standingslope->zdelta >= maxzdelta) // Always teeter if the slope is too steep.
|
||||
teeter = true;
|
||||
#undef maxzdelta
|
||||
|
|
Loading…
Reference in a new issue