- added a higher level interface tp clipmove that unmangles its return.

This commit is contained in:
Christoph Oelckers 2020-10-21 22:43:23 +02:00
parent 3d16d9f44a
commit d0e12586ba
2 changed files with 15 additions and 11 deletions

View File

@ -1507,27 +1507,25 @@ bool queball(DDukeActor *actor, int pocket, int queball, int stripeball)
}
}
int j = clipmove(&s->x, &s->y, &s->z, &s->sectnum,
Collision coll;
int j = clipmove_ex(&s->x, &s->y, &s->z, &s->sectnum,
(((s->xvel * (sintable[(s->ang + 512) & 2047])) >> 14) * TICSPERFRAME) << 11,
(((s->xvel * (sintable[s->ang & 2047])) >> 14) * TICSPERFRAME) << 11,
24L, (4 << 8), (4 << 8), CLIPMASK1);
24L, (4 << 8), (4 << 8), CLIPMASK1, coll);
if (j & kHitTypeMask)
if (j == kHitWall)
{
if ((j & kHitTypeMask) == kHitWall)
{
j &= kHitIndexMask;
j = coll.index;
int k = getangle(
wall[wall[j].point2].x - wall[j].x,
wall[wall[j].point2].y - wall[j].y);
s->ang = ((k << 1) - s->ang) & 2047;
}
else if ((j & kHitTypeMask) == kHitSprite)
else if (j == kHitSprite)
{
j &= kHitIndexMask;
fi.checkhitsprite(actor->GetIndex(), j);
fi.checkhitsprite(actor->GetIndex(), coll.actor->GetIndex());
}
}
s->xvel--;
if (s->xvel < 0) s->xvel = 0;
if (s->picnum == stripeball)
@ -1540,7 +1538,7 @@ bool queball(DDukeActor *actor, int pocket, int queball, int stripeball)
else
{
int x;
int p = findplayer(&actor->s, &x);
int p = findplayer(actor, &x);
if (x < 1596)
{

View File

@ -235,6 +235,12 @@ inline int movesprite_ex(DDukeActor* actor, int xchange, int ychange, int zchang
return f(actor, xchange, ychange, zchange, cliptype, result);
}
inline int clipmove_ex(int* x, int* y, int* z, short* sect, int xv, int yv, int wal, int ceil, int flor, int ct, Collision& result)
{
int res = clipmove(x, y, z, sect, xv, yv, wal, ceil, flor, ct);
return result.setFromEngine(res);
}
inline void ms(short i)
{
ms(&hittype[i]);