- 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 + 512) & 2047])) >> 14) * TICSPERFRAME) << 11,
(((s->xvel * (sintable[s->ang & 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 = coll.index;
{
j &= kHitIndexMask;
int k = getangle( int k = getangle(
wall[wall[j].point2].x - wall[j].x, wall[wall[j].point2].x - wall[j].x,
wall[wall[j].point2].y - wall[j].y); wall[wall[j].point2].y - wall[j].y);
s->ang = ((k << 1) - s->ang) & 2047; s->ang = ((k << 1) - s->ang) & 2047;
} }
else if ((j & kHitTypeMask) == kHitSprite) else if (j == kHitSprite)
{ {
j &= kHitIndexMask; fi.checkhitsprite(actor->GetIndex(), coll.actor->GetIndex());
fi.checkhitsprite(actor->GetIndex(), j);
} }
}
s->xvel--; s->xvel--;
if (s->xvel < 0) s->xvel = 0; if (s->xvel < 0) s->xvel = 0;
if (s->picnum == stripeball) if (s->picnum == stripeball)
@ -1540,7 +1538,7 @@ bool queball(DDukeActor *actor, int pocket, int queball, int stripeball)
else else
{ {
int x; int x;
int p = findplayer(&actor->s, &x); int p = findplayer(actor, &x);
if (x < 1596) 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); 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) inline void ms(short i)
{ {
ms(&hittype[i]); ms(&hittype[i]);