Fix object sloperoll issues
This commit is contained in:
parent
440ccb67a6
commit
ad95233529
4 changed files with 33 additions and 4 deletions
|
|
@ -3884,8 +3884,8 @@ static angle_t P_GetCameraPitchRollAngle(mobj_t *mobj, player_t *viewPlayer)
|
|||
}
|
||||
else
|
||||
{
|
||||
// Regular Mobjs don't air tilt.
|
||||
viewingAngle = mobj->angle;
|
||||
// For regular objects, use the camera; just not the *player's* camera.
|
||||
viewingAngle = R_PointToAngleFloat(mobj->x, mobj->y);
|
||||
}
|
||||
|
||||
pitchMul = -FINESINE(viewingAngle >> ANGLETOFINESHIFT);
|
||||
|
|
|
|||
|
|
@ -14,6 +14,7 @@
|
|||
/// See tables.c, too.
|
||||
|
||||
#include <algorithm>
|
||||
#include <cmath>
|
||||
|
||||
#include "doomdef.h"
|
||||
#include "g_game.h"
|
||||
|
|
@ -51,6 +52,9 @@ extern consvar_t cv_debugrender_freezebsp;
|
|||
// Fineangles in the SCREENWIDTH wide window.
|
||||
#define FIELDOFVIEW 2048
|
||||
|
||||
// Double-precision Pi value
|
||||
#define DOUBLE_PI 3.141592653589793
|
||||
|
||||
// increment every time a check is made
|
||||
size_t validcount = 1;
|
||||
|
||||
|
|
@ -387,6 +391,29 @@ angle_t R_PointToAngle2(fixed_t pviewx, fixed_t pviewy, fixed_t x, fixed_t y)
|
|||
0;
|
||||
}
|
||||
|
||||
#define ANGLE_180_DOUBLE (static_cast<double>(ANGLE_180))
|
||||
#define ANGLE_360_DOUBLE (ANGLE_180_DOUBLE * 2)
|
||||
|
||||
// For absolute accuracy. Please don't use this outside of renderers.
|
||||
angle_t R_PointToAngleFloat2(fixed_t x1, fixed_t y1, fixed_t x2, fixed_t y2)
|
||||
{
|
||||
double deltax = FixedToDouble(x2 - x1);
|
||||
double deltay = FixedToDouble(y2 - y1);
|
||||
|
||||
// Converted to degrees
|
||||
double _arctan = (atan2(deltay, deltax) * ANGLE_180_DOUBLE) / DOUBLE_PI;
|
||||
|
||||
while (_arctan < 0)
|
||||
{
|
||||
_arctan += ANGLE_360_DOUBLE;
|
||||
}
|
||||
|
||||
return static_cast<angle_t>(_arctan);
|
||||
}
|
||||
|
||||
#undef ANGLE_180_DOUBLE
|
||||
#undef ANGLE_360_DOUBLE
|
||||
|
||||
//
|
||||
// R_ScaleFromGlobalAngle
|
||||
// Returns the texture mapping scale for the current line (horizontal span)
|
||||
|
|
|
|||
|
|
@ -83,9 +83,11 @@ FUNCINLINE static ATTRINLINE INT32 R_PointOnSideFast(fixed_t x, fixed_t y, const
|
|||
|
||||
INT32 R_PointOnSegSide(fixed_t x, fixed_t y, const seg_t *line);
|
||||
#define R_PointToAngle(x, y) R_PointToAngle2(viewx, viewy, x, y)
|
||||
#define R_PointToAngleFloat(x, y) (R_PointToAngleFloat2(viewx, viewy, x, y))
|
||||
angle_t R_PointToAnglePlayer(player_t *player, fixed_t x, fixed_t y);
|
||||
angle_t R_PointToAngle64(INT64 x, INT64 y);
|
||||
angle_t R_PointToAngle2(fixed_t px2, fixed_t py2, fixed_t px1, fixed_t py1);
|
||||
angle_t R_PointToAngleFloat2(fixed_t x1, fixed_t y1, fixed_t x2, fixed_t y2);
|
||||
#define R_PointToDist(x, y) R_PointToDist2(viewx, viewy, x, y)
|
||||
#define R_PointToDist2(px2, py2, px1, py1) FixedHypot((px1) - (px2), (py1) - (py2))
|
||||
|
||||
|
|
|
|||
|
|
@ -38,8 +38,8 @@ angle_t R_GetPitchRollAngle(mobj_t *mobj, player_t *viewPlayer, interpmobjstate_
|
|||
}
|
||||
else
|
||||
{
|
||||
// Regular Mobjs don't air tilt.
|
||||
viewingAngle = mobj->angle;
|
||||
// For regular objects, use the camera; just not the *player's* camera.
|
||||
viewingAngle = R_PointToAngleFloat(mobj->x, mobj->y);
|
||||
}
|
||||
|
||||
pitchMul = -FINESINE(viewingAngle >> ANGLETOFINESHIFT);
|
||||
|
|
|
|||
Loading…
Reference in a new issue