mirror of
https://github.com/ZDoom/qzdoom.git
synced 2024-11-24 13:01:47 +00:00
- fixed a float/fixed mixup in R_PointOnSideSlow.
This commit is contained in:
parent
9412ce45d6
commit
8f5ac9b73f
5 changed files with 15 additions and 12 deletions
|
@ -1333,7 +1333,7 @@ CCMD(clearnodecache)
|
|||
//
|
||||
//==========================================================================
|
||||
|
||||
subsector_t *P_PointInSubsector (fixed_t x, fixed_t y)
|
||||
subsector_t *P_PointInSubsector (double x, double y)
|
||||
{
|
||||
node_t *node;
|
||||
int side;
|
||||
|
|
|
@ -1791,12 +1791,14 @@ static AActor *RoughBlockCheck (AActor *mo, int index, void *param)
|
|||
//
|
||||
//==========================================================================
|
||||
|
||||
static int R_PointOnSideSlow(double x, double y, node_t *node)
|
||||
static int R_PointOnSideSlow(double xx, double yy, node_t *node)
|
||||
{
|
||||
// [RH] This might have been faster than two multiplies and an
|
||||
// add on a 386/486, but it certainly isn't on anything newer than that.
|
||||
fixed_t dx;
|
||||
fixed_t dy;
|
||||
fixed_t x = FloatToFixed(xx);
|
||||
fixed_t y = FloatToFixed(yy);
|
||||
double left;
|
||||
double right;
|
||||
|
||||
|
@ -1815,8 +1817,8 @@ static int R_PointOnSideSlow(double x, double y, node_t *node)
|
|||
return node->dx > 0;
|
||||
}
|
||||
|
||||
dx = (FloatToFixed(x) - node->x);
|
||||
dy = (FloatToFixed(y) - node->y);
|
||||
dx = (x - node->x);
|
||||
dy = (y - node->y);
|
||||
|
||||
// Try to quickly decide by looking at sign bits.
|
||||
if ((node->dy ^ node->dx ^ dx ^ dy) & 0x80000000)
|
||||
|
|
11
src/r_defs.h
11
src/r_defs.h
|
@ -1574,20 +1574,17 @@ struct visstyle_t
|
|||
// not the same as R_PointInSubsector
|
||||
//
|
||||
//----------------------------------------------------------------------------------
|
||||
subsector_t *P_PointInSubsector(fixed_t x, fixed_t y);
|
||||
inline sector_t *P_PointInSector(fixed_t x, fixed_t y)
|
||||
{
|
||||
return P_PointInSubsector(x, y)->sector;
|
||||
}
|
||||
subsector_t *P_PointInSubsector(double x, double y);
|
||||
sector_t *P_PointInSector(fixed_t x, fixed_t y) = delete;
|
||||
|
||||
inline sector_t *P_PointInSector(const DVector2 &pos)
|
||||
{
|
||||
return P_PointInSubsector(FLOAT2FIXED(pos.X), FLOAT2FIXED(pos.Y))->sector;
|
||||
return P_PointInSubsector(pos.X, pos.Y)->sector;
|
||||
}
|
||||
|
||||
inline sector_t *P_PointInSector(double X, double Y)
|
||||
{
|
||||
return P_PointInSubsector(FLOAT2FIXED(X), FLOAT2FIXED(Y))->sector;
|
||||
return P_PointInSubsector(X, Y)->sector;
|
||||
}
|
||||
|
||||
inline DVector3 AActor::PosRelative(int portalgroup) const
|
||||
|
|
|
@ -55,6 +55,10 @@ inline int R_PointOnSide (fixed_t x, fixed_t y, const node_t *node)
|
|||
{
|
||||
return DMulScale32 (y-node->y, node->dx, node->x-x, node->dy) > 0;
|
||||
}
|
||||
inline int R_PointOnSide(double x, double y, const node_t *node)
|
||||
{
|
||||
return DMulScale32(FLOAT2FIXED(y) - node->y, node->dx, node->x - FLOAT2FIXED(x), node->dy) > 0;
|
||||
}
|
||||
inline int R_PointOnSide(const DVector2 &pos, const node_t *node)
|
||||
{
|
||||
return DMulScale32(FLOAT2FIXED(pos.Y) - node->y, node->dx, node->x - FLOAT2FIXED(pos.X), node->dy) > 0;
|
||||
|
|
|
@ -763,7 +763,7 @@ static void CalcSectorSoundOrg(const sector_t *sec, int channum, fixed_t *x, fix
|
|||
if (!(i_compatflags & COMPATF_SECTORSOUNDS))
|
||||
{
|
||||
// Are we inside the sector? If yes, the closest point is the one we're on.
|
||||
if (P_PointInSector(*x, *y) == sec)
|
||||
if (P_PointInSector(FIXED2DBL(*x), FIXED2DBL(*y)) == sec)
|
||||
{
|
||||
FVector3 p = players[consoleplayer].camera->SoundPos();
|
||||
*x = FLOAT2FIXED(p.X);
|
||||
|
|
Loading…
Reference in a new issue