From 60c2a55ec4e9e882c340cce5db6dab70d3301681 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Fri, 26 Feb 2016 11:49:39 +0100 Subject: [PATCH] - added P_GetOffsetPosition calls to all needed functions. --- src/actor.h | 52 +++++++++++++++++++++++++++++++++++++------------- src/portal.cpp | 2 +- src/portal.h | 1 + 3 files changed, 41 insertions(+), 14 deletions(-) diff --git a/src/actor.h b/src/actor.h index b9bc2d268..25caaaede 100644 --- a/src/actor.h +++ b/src/actor.h @@ -886,31 +886,57 @@ public: return ret; } - fixedvec2 Vec2Offset(fixed_t dx, fixed_t dy, bool absolute = false) const + fixedvec2 Vec2Offset(fixed_t dx, fixed_t dy, bool absolute = false) { - fixedvec2 ret = { X() + dx, Y() + dy }; - return ret; + if (absolute) + { + fixedvec2 ret = { X() + dx, Y() + dy }; + return ret; + } + else return P_GetOffsetPosition(this, dx, dy); } - fixedvec2 Vec2Angle(fixed_t length, angle_t angle, bool absolute = false) const + fixedvec2 Vec2Angle(fixed_t length, angle_t angle, bool absolute = false) { - fixedvec2 ret = { X() + FixedMul(length, finecosine[angle >> ANGLETOFINESHIFT]), - Y() + FixedMul(length, finesine[angle >> ANGLETOFINESHIFT]) }; - return ret; + if (absolute) + { + fixedvec2 ret = { X() + FixedMul(length, finecosine[angle >> ANGLETOFINESHIFT]), + Y() + FixedMul(length, finesine[angle >> ANGLETOFINESHIFT]) }; + return ret; + } + else return P_GetOffsetPosition(this, FixedMul(length, finecosine[angle >> ANGLETOFINESHIFT]), FixedMul(length, finesine[angle >> ANGLETOFINESHIFT])); } - fixedvec3 Vec3Offset(fixed_t dx, fixed_t dy, fixed_t dz, bool absolute = false) const + fixedvec3 Vec3Offset(fixed_t dx, fixed_t dy, fixed_t dz, bool absolute = false) { - fixedvec3 ret = { X() + dx, Y() + dy, Z() + dz }; - return ret; + if (absolute) + { + fixedvec3 ret = { X() + dx, Y() + dy, Z() + dz }; + return ret; + } + else + { + fixedvec2 op = P_GetOffsetPosition(this, dx, dy); + fixedvec3 pos = { op.x, op.y, Z() + dz }; + return pos; + } } - fixedvec3 Vec3Angle(fixed_t length, angle_t angle, fixed_t dz, bool absolute = false) const + fixedvec3 Vec3Angle(fixed_t length, angle_t angle, fixed_t dz, bool absolute = false) { - fixedvec3 ret = { X() + FixedMul(length, finecosine[angle >> ANGLETOFINESHIFT]), + if (absolute) + { + fixedvec3 ret = { X() + FixedMul(length, finecosine[angle >> ANGLETOFINESHIFT]), Y() + FixedMul(length, finesine[angle >> ANGLETOFINESHIFT]), Z() + dz }; - return ret; + return ret; + } + else + { + fixedvec2 op = P_GetOffsetPosition(this, FixedMul(length, finecosine[angle >> ANGLETOFINESHIFT]), FixedMul(length, finesine[angle >> ANGLETOFINESHIFT])); + fixedvec3 pos = { op.x, op.y, Z() + dz }; + return pos; + } } void ClearInterpolation(); diff --git a/src/portal.cpp b/src/portal.cpp index e9a2d9156..2a920f74c 100644 --- a/src/portal.cpp +++ b/src/portal.cpp @@ -712,7 +712,7 @@ fixedvec2 P_GetOffsetPosition(AActor *actor, fixed_t dx, fixed_t dy) bool repeat; do { - it.init(actx, acty, dx, dy, PT_ADDLINES); + it.init(actx, acty, dx, dy, PT_ADDLINES|PT_DELTA); intercept_t *in; repeat = false; diff --git a/src/portal.h b/src/portal.h index 8665e192c..ef8cec98a 100644 --- a/src/portal.h +++ b/src/portal.h @@ -198,5 +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_NormalizeVXVY(fixed_t& vx, fixed_t& vy); fixed_t P_PointLineDistance(line_t* line, fixed_t x, fixed_t y); +fixedvec2 P_GetOffsetPosition(AActor *actor, fixed_t dx, fixed_t dy); #endif \ No newline at end of file