- always use the float version of keepaway

Does not work yet - movement is significantly different that the int version
This commit is contained in:
Christoph Oelckers 2022-10-25 15:53:57 +02:00
parent 66e6d166d6
commit fe56d2345d
3 changed files with 12 additions and 9 deletions

View file

@ -162,10 +162,6 @@ CollisionBase clipmove_(vec3_t * const pos, int * const sectnum, int32_t xvect,
fgoal = NearestPointOnLine(fgoal.X, fgoal.Y, fvec.X, fvec.Y, fvec.X + clipdelta.X, fvec.Y + clipdelta.Y, false);
goal.X = int(fgoal.X * worldtoint);
goal.Y = int(fgoal.Y * worldtoint);
vec2_t const clipr = { clip.clipobjects[hitwall].x2() - clip.clipobjects[hitwall].x1(), clip.clipobjects[hitwall].y2() - clip.clipobjects[hitwall].y1()};
int32_t tempint;
tempint = DMulScale(clipr.X, move.X, clipr.Y, move.Y, 6);
@ -189,9 +185,15 @@ CollisionBase clipmove_(vec3_t * const pos, int * const sectnum, int32_t xvect,
}
}
keepaway(clip, &goal.X, &goal.Y, hitwall);
xvect = (goal.X-vec.X)<<14;
yvect = (goal.Y-vec.Y)<<14;
keepaway(clip, fgoal, clip.clipobjects[hitwall]);
goal.X = int(fgoal.X * worldtoint);
goal.Y = int(fgoal.Y * worldtoint);
//keepaway(clip, &goal.X, &goal.Y, hitwall);
//xvect = (goal.X-vec.X)<<14;
//yvect = (goal.Y-vec.Y)<<14;
xvect = FloatToFixed<4>(fgoal.X - fvec.X) << 14;
yvect = FloatToFixed<4>(fgoal.Y - fvec.Y) << 14;
if (cnt == clipmoveboxtracenum)
clipReturn = clip.clipobjects[hitwall].obj;

View file

@ -1672,7 +1672,7 @@ int FindBestSector(const DVector3& pos)
//==========================================================================
#if 0
static inline void keepaway(MoveClipper& clip, DVector2& pos, ClipObject& clipo)
void keepaway(MoveClipper& clip, DVector2& pos, ClipObject& clipo)
{
// later, once we are using floats throughout we should be able to do this
auto start = clipo.line.start, normal = clipo.line.delta().Rotated90CCW().Unit();
@ -1683,7 +1683,7 @@ static inline void keepaway(MoveClipper& clip, DVector2& pos, ClipObject& clipo)
}
}
#else
static inline void keepaway(MoveClipper& clip, DVector2& pos, ClipObject& clipo)
void keepaway(MoveClipper& clip, DVector2& pos, ClipObject& clipo)
{
// for now this has to be retained...
auto start = clipo.line.start, normal = clipo.line.delta().Rotated90CCW();

View file

@ -317,6 +317,7 @@ void collectClipObjects(MoveClipper& clip, int spritemask);
int FindBestSector(const DVector3& pos);
int FindSectorInSearchList(const DVector3& pos, BFSSectorSearch& search);
void PushAway(MoveClipper &clip, DVector2& pos, sectortype* sect);
void keepaway(MoveClipper& clip, DVector2& pos, ClipObject& clipo);
int FindBestSector(const DVector3& pos);