- the final walls

What is left now of wall[] and wallnum() needs to remain.
This commit is contained in:
Christoph Oelckers 2021-11-18 00:42:52 +01:00
parent a26dc25e97
commit 27af8a52e9
5 changed files with 25 additions and 32 deletions

View file

@ -154,7 +154,7 @@ int getanimationgoal(int animtype, int animindex);
bool isanearoperator(int lotag); bool isanearoperator(int lotag);
bool isanunderoperator(int lotag); bool isanunderoperator(int lotag);
int setanimation(int animsect, int animtype, int animindex, int thegoal, int thevel); int setanimation(int animsect, int animtype, int animindex, int thegoal, int thevel);
void dofurniture(int wallNum, int sectnum, int playerNum); void dofurniture(walltype* wallNum, sectortype* sectnum, int playerNum);
void dotorch(); void dotorch();
int hitawall(struct player_struct* pl, walltype** hitWall); int hitawall(struct player_struct* pl, walltype** hitWall);
int hits(DDukeActor* snum); int hits(DDukeActor* snum);

View file

@ -3807,7 +3807,7 @@ HORIZONLY:
{ {
if (wal->lotag < 44) if (wal->lotag < 44)
{ {
dofurniture(clip.index, p->cursectnum, snum); dofurniture(clip.wall(), p->cursector(), snum);
pushmove(&p->pos, &p->cursectnum, 172L, (4L << 8), (4L << 8), CLIPMASK0); pushmove(&p->pos, &p->cursectnum, 172L, (4L << 8), (4L << 8), CLIPMASK0);
} }
else else

View file

@ -855,14 +855,12 @@ void checkhitwall_d(DDukeActor* spr, walltype* wal, int x, int y, int z, int atw
if (!wal->lotag) return; if (!wal->lotag) return;
sn = wal->nextsector; if (wal->nextsector < 0) return;
if (sn < 0) return;
darkestwall = 0; darkestwall = 0;
wal = &wall[sector[sn].wallptr]; for (auto& wl : wallsofsector(wal->nextSector()))
for (int i = sector[sn].wallnum; i > 0; i--, wal++) if (wl.shade > darkestwall)
if (wal->shade > darkestwall) darkestwall = wl.shade;
darkestwall = wal->shade;
j = krand() & 1; j = krand() & 1;
DukeStatIterator it(STAT_EFFECTOR); DukeStatIterator it(STAT_EFFECTOR);

View file

@ -1079,7 +1079,6 @@ void checkhitwall_r(DDukeActor* spr, walltype* wal, int x, int y, int z, int atw
case RRTILE3643 + 3: case RRTILE3643 + 3:
{ {
int sect; int sect;
int startwall, endwall;
sect = wal->nextWall()->nextsector; sect = wal->nextWall()->nextsector;
DukeSectIterator it(sect); DukeSectIterator it(sect);
while (auto act = it.Next()) while (auto act = it.Next())
@ -1087,14 +1086,13 @@ void checkhitwall_r(DDukeActor* spr, walltype* wal, int x, int y, int z, int atw
s = act->s; s = act->s;
if (s->lotag == 6) if (s->lotag == 6)
{ {
//for (j = 0; j < 16; j++) RANDOMSCRAP(s, -1); This never spawned anything due to the -1.
act->spriteextra++; act->spriteextra++;
if (act->spriteextra == 25) if (act->spriteextra == 25)
{ {
startwall = s->sector()->wallptr; for(auto& wl : wallsofsector(s->sectnum))
endwall = startwall + s->sector()->wallnum; {
for (i = startwall; i < endwall; i++) if (wl.nextsector >= 0) wl.nextSector()->lotag = 0;
sector[wall[i].nextsector].lotag = 0; }
s->sector()->lotag = 0; s->sector()->lotag = 0;
S_StopSound(act->s->lotag); S_StopSound(act->s->lotag);
S_PlayActorSound(400, act); S_PlayActorSound(400, act);
@ -2792,9 +2790,8 @@ void checksectors_r(int snum)
// //
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
void dofurniture(int wl, int sect, int snum) void dofurniture(walltype* wlwal, sectortype* sectp, int snum)
{ {
auto wlwal = &wall[wl];
int nextsect = wlwal->nextsector; int nextsect = wlwal->nextsector;
int var_C; int var_C;
int x; int x;
@ -2809,7 +2806,7 @@ void dofurniture(int wl, int sect, int snum)
var_C = 1; var_C = 1;
max_x = max_y = -0x20000; max_x = max_y = -0x20000;
min_x = min_y = 0x20000; min_x = min_y = 0x20000;
var_cx = sector[sect].hitag; var_cx = sectp->hitag;
if (var_cx > 16) if (var_cx > 16)
var_cx = 16; var_cx = 16;
else if (var_cx == 0) else if (var_cx == 0)
@ -2831,16 +2828,16 @@ void dofurniture(int wl, int sect, int snum)
max_y += var_cx + 1; max_y += var_cx + 1;
min_x -= var_cx + 1; min_x -= var_cx + 1;
min_y -= var_cx + 1; min_y -= var_cx + 1;
ins = inside(max_x, max_y, sect); ins = inside(max_x, max_y, sectnum(sectp));
if (!ins) if (!ins)
var_C = 0; var_C = 0;
ins = inside(max_x, min_y, sect); ins = inside(max_x, min_y, sectnum(sectp));
if (!ins) if (!ins)
var_C = 0; var_C = 0;
ins = inside(min_x, min_y, sect); ins = inside(min_x, min_y, sectnum(sectp));
if (!ins) if (!ins)
var_C = 0; var_C = 0;
ins = inside(min_x, max_y, sect); ins = inside(min_x, max_y, sectnum(sectp));
if (!ins) if (!ins)
var_C = 0; var_C = 0;
if (var_C) if (var_C)

View file

@ -742,20 +742,18 @@ void spawneffector(DDukeActor* actor)
if (sp->ang == 512) if (sp->ang == 512)
{ {
startwall = sectp->wallptr; for (auto& wl : wallsofsector(sectp))
endwall = startwall + sectp->wallnum;
for (int j = startwall; j < endwall; j++)
{ {
int x = wall[j].nextsector; if (wl.nextsector >= 0)
if (x >= 0) {
if (!(sector[x].ceilingstat & 1)) auto nsec = wl.nextSector();
if (!(nsec->ceilingstat & 1))
{ {
sectp->ceilingpicnum = sectp->ceilingpicnum = nsec->ceilingpicnum;
sector[x].ceilingpicnum; sectp->ceilingshade = nsec->ceilingshade;
sectp->ceilingshade = break; //Leave early
sector[x].ceilingshade;
break; //Leave earily
} }
}
} }
} }
} }