- changed parameter of P_GetOffsetPosition to a simple coordinate so that it can be used for other things than actors.

This commit is contained in:
Christoph Oelckers 2016-02-29 16:29:51 +01:00
parent 38c1b8588c
commit 07771bd56e
3 changed files with 8 additions and 8 deletions

View file

@ -893,7 +893,7 @@ public:
fixedvec2 ret = { X() + dx, Y() + dy }; fixedvec2 ret = { X() + dx, Y() + dy };
return ret; return ret;
} }
else return P_GetOffsetPosition(this, dx, dy); else return P_GetOffsetPosition(X(), Y(), dx, dy);
} }
@ -905,7 +905,7 @@ public:
Y() + FixedMul(length, finesine[angle >> ANGLETOFINESHIFT]) }; Y() + FixedMul(length, finesine[angle >> ANGLETOFINESHIFT]) };
return ret; return ret;
} }
else return P_GetOffsetPosition(this, FixedMul(length, finecosine[angle >> ANGLETOFINESHIFT]), FixedMul(length, finesine[angle >> ANGLETOFINESHIFT])); else return P_GetOffsetPosition(X(), Y(), FixedMul(length, finecosine[angle >> ANGLETOFINESHIFT]), FixedMul(length, finesine[angle >> ANGLETOFINESHIFT]));
} }
fixedvec3 Vec3Offset(fixed_t dx, fixed_t dy, fixed_t dz, bool absolute = false) fixedvec3 Vec3Offset(fixed_t dx, fixed_t dy, fixed_t dz, bool absolute = false)
@ -917,7 +917,7 @@ public:
} }
else else
{ {
fixedvec2 op = P_GetOffsetPosition(this, dx, dy); fixedvec2 op = P_GetOffsetPosition(X(), Y(), dx, dy);
fixedvec3 pos = { op.x, op.y, Z() + dz }; fixedvec3 pos = { op.x, op.y, Z() + dz };
return pos; return pos;
} }
@ -933,7 +933,7 @@ public:
} }
else else
{ {
fixedvec2 op = P_GetOffsetPosition(this, FixedMul(length, finecosine[angle >> ANGLETOFINESHIFT]), FixedMul(length, finesine[angle >> ANGLETOFINESHIFT])); fixedvec2 op = P_GetOffsetPosition(X(), Y(), FixedMul(length, finecosine[angle >> ANGLETOFINESHIFT]), FixedMul(length, finesine[angle >> ANGLETOFINESHIFT]));
fixedvec3 pos = { op.x, op.y, Z() + dz }; fixedvec3 pos = { op.x, op.y, Z() + dz };
return pos; return pos;
} }

View file

@ -701,12 +701,12 @@ void P_NormalizeVXVY(fixed_t& vx, fixed_t& vy)
// //
//============================================================================ //============================================================================
fixedvec2 P_GetOffsetPosition(AActor *actor, fixed_t dx, fixed_t dy) fixedvec2 P_GetOffsetPosition(fixed_t x, fixed_t y, fixed_t dx, fixed_t dy)
{ {
fixedvec2 dest = { actor->X() + dx, actor->Y() + dy }; fixedvec2 dest = { x + dx, y + dy };
if (PortalBlockmap.containsLines) if (PortalBlockmap.containsLines)
{ {
fixed_t actx = actor->X(), acty = actor->Y(); fixed_t actx = x, acty = y;
// Try some easily discoverable early-out first. If we know that the trace cannot possibly find a portal, this saves us from calling the traverser completely for vast parts of the map. // Try some easily discoverable early-out first. If we know that the trace cannot possibly find a portal, this saves us from calling the traverser completely for vast parts of the map.
if (dx < 128 * FRACUNIT && dy < 128 * FRACUNIT) if (dx < 128 * FRACUNIT && dy < 128 * FRACUNIT)
{ {

View file

@ -198,6 +198,6 @@ void P_TranslatePortalAngle(line_t* src, line_t* dst, angle_t& angle);
void P_TranslatePortalZ(line_t* src, line_t* dst, fixed_t& z); void P_TranslatePortalZ(line_t* src, line_t* dst, fixed_t& z);
void P_NormalizeVXVY(fixed_t& vx, fixed_t& vy); void P_NormalizeVXVY(fixed_t& vx, fixed_t& vy);
fixed_t P_PointLineDistance(line_t* line, fixed_t x, fixed_t y); fixed_t P_PointLineDistance(line_t* line, fixed_t x, fixed_t y);
fixedvec2 P_GetOffsetPosition(AActor *actor, fixed_t dx, fixed_t dy); fixedvec2 P_GetOffsetPosition(fixed_t x, fixed_t y, fixed_t dx, fixed_t dy);
#endif #endif