- 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 isanunderoperator(int lotag);
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();
int hitawall(struct player_struct* pl, walltype** hitWall);
int hits(DDukeActor* snum);

View file

@ -3807,7 +3807,7 @@ HORIZONLY:
{
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);
}
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;
sn = wal->nextsector;
if (sn < 0) return;
if (wal->nextsector < 0) return;
darkestwall = 0;
wal = &wall[sector[sn].wallptr];
for (int i = sector[sn].wallnum; i > 0; i--, wal++)
if (wal->shade > darkestwall)
darkestwall = wal->shade;
for (auto& wl : wallsofsector(wal->nextSector()))
if (wl.shade > darkestwall)
darkestwall = wl.shade;
j = krand() & 1;
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:
{
int sect;
int startwall, endwall;
sect = wal->nextWall()->nextsector;
DukeSectIterator it(sect);
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;
if (s->lotag == 6)
{
//for (j = 0; j < 16; j++) RANDOMSCRAP(s, -1); This never spawned anything due to the -1.
act->spriteextra++;
if (act->spriteextra == 25)
{
startwall = s->sector()->wallptr;
endwall = startwall + s->sector()->wallnum;
for (i = startwall; i < endwall; i++)
sector[wall[i].nextsector].lotag = 0;
for(auto& wl : wallsofsector(s->sectnum))
{
if (wl.nextsector >= 0) wl.nextSector()->lotag = 0;
}
s->sector()->lotag = 0;
S_StopSound(act->s->lotag);
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 var_C;
int x;
@ -2809,7 +2806,7 @@ void dofurniture(int wl, int sect, int snum)
var_C = 1;
max_x = max_y = -0x20000;
min_x = min_y = 0x20000;
var_cx = sector[sect].hitag;
var_cx = sectp->hitag;
if (var_cx > 16)
var_cx = 16;
else if (var_cx == 0)
@ -2831,16 +2828,16 @@ void dofurniture(int wl, int sect, int snum)
max_y += var_cx + 1;
min_x -= 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)
var_C = 0;
ins = inside(max_x, min_y, sect);
ins = inside(max_x, min_y, sectnum(sectp));
if (!ins)
var_C = 0;
ins = inside(min_x, min_y, sect);
ins = inside(min_x, min_y, sectnum(sectp));
if (!ins)
var_C = 0;
ins = inside(min_x, max_y, sect);
ins = inside(min_x, max_y, sectnum(sectp));
if (!ins)
var_C = 0;
if (var_C)

View file

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