mirror of
https://github.com/DrBeef/Raze.git
synced 2024-11-15 17:01:51 +00:00
- Duke/RR: redo the supremely ugly code to access the third point in hitradius*
This commit is contained in:
parent
da7de8f1d8
commit
63985ce6be
2 changed files with 8 additions and 6 deletions
|
@ -359,13 +359,14 @@ void hitradius_d(DDukeActor* actor, int r, int hp1, int hp2, int hp3, int h
|
|||
auto dasectp = §or[dasect];
|
||||
if (((dasectp->ceilingz - spri->z) >> 8) < r)
|
||||
{
|
||||
d = abs(wall[dasectp->wallptr].x - spri->x) + abs(wall[dasectp->wallptr].y - spri->y);
|
||||
auto wal = dasectp->firstWall();
|
||||
d = abs(wal->x - spri->x) + abs(wal->y - spri->y);
|
||||
if (d < r)
|
||||
fi.checkhitceiling(dasect);
|
||||
else
|
||||
{
|
||||
// ouch...
|
||||
d = abs(wall[wall[wall[dasectp->wallptr].point2].point2].x - spri->x) + abs(wall[wall[wall[dasectp->wallptr].point2].point2].y - spri->y);
|
||||
auto thirdpoint = wal->point2Wall()->point2Wall();
|
||||
d = abs(thirdpoint->x - spri->x) + abs(thirdpoint->y - spri->y);
|
||||
if (d < r)
|
||||
fi.checkhitceiling(dasect);
|
||||
}
|
||||
|
|
|
@ -235,13 +235,14 @@ void hitradius_r(DDukeActor* actor, int r, int hp1, int hp2, int hp3, int h
|
|||
auto dasectp = §or[dasect];
|
||||
if (((dasectp->ceilingz - spri->z) >> 8) < r)
|
||||
{
|
||||
d = abs(wall[dasectp->wallptr].x - spri->x) + abs(wall[dasectp->wallptr].y - spri->y);
|
||||
auto wal = dasectp->firstWall();
|
||||
d = abs(wal->x - spri->x) + abs(wal->y - spri->y);
|
||||
if (d < r)
|
||||
fi.checkhitceiling(dasect);
|
||||
else
|
||||
{
|
||||
// ouch...
|
||||
d = abs(wall[wall[wall[dasectp->wallptr].point2].point2].x - spri->x) + abs(wall[wall[wall[dasectp->wallptr].point2].point2].y - spri->y);
|
||||
auto thirdpoint = wal->point2Wall()->point2Wall();
|
||||
d = abs(thirdpoint->x - spri->x) + abs(thirdpoint->y - spri->y);
|
||||
if (d < r)
|
||||
fi.checkhitceiling(dasect);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue