mirror of
https://github.com/DrBeef/Raze.git
synced 2024-11-15 17:01:51 +00:00
- made the same changes to hitradius_r
Also had to do some reformatting to get rid of the goto in there.
This commit is contained in:
parent
821f341e03
commit
68d653efe9
1 changed files with 30 additions and 42 deletions
|
@ -218,30 +218,21 @@ void addweapon_r(struct player_struct* p, int weapon)
|
|||
void hitradius_r(DDukeActor* actor, int r, int hp1, int hp2, int hp3, int hp4)
|
||||
{
|
||||
walltype* wal;
|
||||
sectortype* dasectp;
|
||||
int d, q, x1, y1;
|
||||
int sectcnt, sectend, dasect, startwall, endwall, nextsect;
|
||||
int startwall, endwall, nextsect;
|
||||
int p, x;
|
||||
int sect;
|
||||
static const uint8_t statlist[] = { STAT_DEFAULT, STAT_ACTOR, STAT_STANDABLE, STAT_PLAYER, STAT_FALLER, STAT_ZOMBIEACTOR, STAT_MISC };
|
||||
int tempsect[128]; // originally hijacked a global buffer which is bad. Q: How many do we really need? RedNukem says 64.
|
||||
|
||||
auto spri = actor->s;
|
||||
|
||||
if (spri->xrepeat < 11)
|
||||
if (spri->xrepeat >= 11 || !(spri->picnum == RPG || ((isRRRA()) && spri->picnum == RPG2)))
|
||||
{
|
||||
if (spri->picnum == RPG || ((isRRRA()) && spri->picnum == RPG2)) goto SKIPWALLCHECK;
|
||||
}
|
||||
BFSSearch search(numsectors, spri->sectnum);
|
||||
|
||||
tempsect[0] = spri->sectnum;
|
||||
dasect = spri->sectnum;
|
||||
dasectp = spri->sector();
|
||||
sectcnt = 0; sectend = 1;
|
||||
|
||||
do
|
||||
for (unsigned dasect; (dasect = search.GetNext()) != BFSSearch::EOL;)
|
||||
{
|
||||
dasect = tempsect[sectcnt++];
|
||||
dasectp = §or[dasect];
|
||||
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);
|
||||
|
@ -264,9 +255,7 @@ void hitradius_r(DDukeActor* actor, int r, int hp1, int hp2, int hp3, int h
|
|||
nextsect = wal->nextsector;
|
||||
if (nextsect >= 0)
|
||||
{
|
||||
for (dasect = sectend - 1; dasect >= 0; dasect--)
|
||||
if (tempsect[dasect] == nextsect) break;
|
||||
if (dasect < 0) tempsect[sectend++] = nextsect;
|
||||
search.Add(nextsect);
|
||||
}
|
||||
x1 = (((wal->x + wall[wal->point2].x) >> 1) + spri->x) >> 1;
|
||||
y1 = (((wal->y + wall[wal->point2].y) >> 1) + spri->y) >> 1;
|
||||
|
@ -274,9 +263,8 @@ void hitradius_r(DDukeActor* actor, int r, int hp1, int hp2, int hp3, int h
|
|||
if (sect >= 0 && cansee(x1, y1, spri->z, sect, spri->x, spri->y, spri->z, spri->sectnum))
|
||||
fi.checkhitwall(actor, x, wal->x, wal->y, spri->z, spri->picnum);
|
||||
}
|
||||
} while (sectcnt < sectend && sectcnt < (int)countof(tempsect));
|
||||
|
||||
SKIPWALLCHECK:
|
||||
}
|
||||
}
|
||||
|
||||
q = -(24 << 8) + (krand() & ((32 << 8) - 1));
|
||||
|
||||
|
|
Loading…
Reference in a new issue