- Duke: use wall utilities in bounce and queball

This commit is contained in:
Christoph Oelckers 2021-11-15 22:53:16 +01:00
parent 58a091067f
commit 312bf5bf95
2 changed files with 10 additions and 9 deletions

View file

@ -139,6 +139,9 @@ struct walltype
sectortype* nextSector() const;
walltype* nextWall() const;
walltype* point2Wall() const;
vec2_t delta() const { return point2Wall()->pos - pos; }
int deltax() const { return point2Wall()->x - x; }
int deltay() const { return point2Wall()->y - y; }
bool twoSided() const { return nextsector >= 0; }
#if 0

View file

@ -1299,10 +1299,10 @@ void bounce(DDukeActor* actor)
auto sectp = s->sector();
int k = sectp->wallptr;
int l = wall[k].point2;
int daang = getangle(wall[l].x - wall[k].x, wall[l].y - wall[k].y);
auto delta = sectp->firstWall()->delta();
int daang = getangle(delta.x, delta.y);
int k, l;
if (s->z < (actor->floorz + actor->ceilingz) >> 1)
k = sectp->ceilingheinum;
else
@ -1513,12 +1513,10 @@ bool queball(DDukeActor *actor, int pocket, int queball, int stripeball)
if (j == kHitWall)
{
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;
}
auto delta = coll.wall()->delta();
int k = getangle(delta.x, delta.y);
s->ang = ((k << 1) - s->ang) & 2047;
}
else if (j == kHitSprite)
{
fi.checkhitsprite(actor, coll.actor);