- added P_GetOffsetPosition calls to all needed functions.

This commit is contained in:
Christoph Oelckers 2016-02-26 11:49:39 +01:00
parent d46e109a5b
commit 60c2a55ec4
3 changed files with 41 additions and 14 deletions

View file

@ -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();

View file

@ -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;

View file

@ -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