- Exhumed: some cleanup.

This commit is contained in:
Christoph Oelckers 2021-11-21 09:42:43 +01:00
parent 61d5680950
commit 2d1f5fc576
4 changed files with 33 additions and 38 deletions

View file

@ -494,7 +494,6 @@ void prelevel_r(int g)
}
case 42:
{
int ii;
sectortype* childsectnum = nullptr;
dist = 0;
speed = 0;

View file

@ -780,38 +780,37 @@ void LoadObjects()
InitWallFace();
InitSectFlag();
for (int nSector = 0; nSector < numsectors; nSector++)
for (auto& sect : sectors())
{
auto sectp = &sector[nSector];
int hitag = sectp->hitag;
int lotag = sectp->lotag;
int hitag = sect.hitag;
int lotag = sect.lotag;
sectp->hitag = 0;
sectp->lotag = 0;
sectp->extra = -1;
sect.hitag = 0;
sect.lotag = 0;
sect.extra = -1;
if (hitag || lotag)
{
sectp->lotag = runlist_HeadRun() + 1;
sectp->hitag = lotag;
sect.lotag = runlist_HeadRun() + 1;
sect.hitag = lotag;
runlist_ProcessSectorTag(nSector, lotag, hitag);
runlist_ProcessSectorTag(sectnum(&sect), lotag, hitag);
}
}
for (int nWall = 0; nWall < numwalls; nWall++)
for (auto& wal : walls())
{
wall[nWall].extra = -1;
wal.extra = -1;
int lotag = wall[nWall].lotag;
int hitag = wall[nWall].hitag;
int lotag = wal.lotag;
int hitag = wal.hitag;
wall[nWall].lotag = 0;
wal.lotag = 0;
if (hitag || lotag)
{
wall[nWall].lotag = runlist_HeadRun() + 1;
runlist_ProcessWallTag(nWall, lotag, hitag);
wal.lotag = runlist_HeadRun() + 1;
runlist_ProcessWallTag(wallnum(&wal), lotag, hitag);
}
}

View file

@ -1583,42 +1583,38 @@ void DoFinale()
DExhumedActor* BuildEnergyBlock(int nSector)
{
int startwall = sector[nSector].wallptr;
int nWalls = sector[nSector].wallnum;
int x = 0;
int y = 0;
auto pSector = &sector[nSector];
for (int i = 0; i < nWalls; i++)
for(auto& wal : wallsofsector(pSector))
{
x += wall[startwall + i].x;
y += wall[startwall + i].y;
x += wal.x;
y += wal.y;
wall[startwall + i].picnum = kClockSymbol16;
wall[startwall + i].pal = 0;
wall[startwall + i].shade = 50;
wal.picnum = kClockSymbol16;
wal.pal = 0;
wal.shade = 50;
}
int xAvg = x / nWalls;
int yAvg = y / nWalls;
int xAvg = x / pSector->wallnum;
int yAvg = y / pSector->wallnum;
auto pActor = insertActor(nSector, 406);
auto spr = &pActor->s();
int nextsector = wall[startwall].nextsector;
spr->x = xAvg;
spr->x = xAvg;
spr->y = yAvg;
sector[nSector].extra = (int16_t)EnergyBlocks.Push(pActor);
// GrabTimeSlot(3);
spr->z = sector[nextsector].floorz;
spr->z = pSector->firstWall()->nextSector()->floorz;
// CHECKME - name of this variable?
int nRepeat = (spr->z - sector[nSector].floorz) >> 8;
int nRepeat = (spr->z - pSector->floorz) >> 8;
if (nRepeat > 255) {
nRepeat = 255;
}

View file

@ -1517,6 +1517,7 @@ void runlist_ProcessSectorTag(int nSector, int nLotag, int nHitag)
void runlist_ProcessWallTag(int nWall, int nLotag, int nHitag)
{
auto& wal = wall[nWall];
int nChannel = runlist_AllocChannel(nHitag % 1000);
assert(nChannel >= 0 && nChannel < kMaxChannels);
@ -1536,7 +1537,7 @@ void runlist_ProcessWallTag(int nWall, int nLotag, int nHitag)
case 1:
{
int nWallFace = BuildWallFace(nChannel, nWall, 2, wall[nWall].picnum, wall[nWall].picnum + 1);
int nWallFace = BuildWallFace(nChannel, nWall, 2, wal.picnum, wal.picnum + 1);
runlist_AddRunRec(sRunChannels[nChannel].a, nWallFace, 0x70000);
auto nSwitch = BuildSwPressWall(nChannel, BuildLink(2, nEffectTag, 0), nWall);
@ -1554,7 +1555,7 @@ void runlist_ProcessWallTag(int nWall, int nLotag, int nHitag)
case 7: // Regular switch
{
int nWallFace = BuildWallFace(nChannel, nWall, 2, wall[nWall].picnum, wall[nWall].picnum + 1);
int nWallFace = BuildWallFace(nChannel, nWall, 2, wal.picnum, wal.picnum + 1);
runlist_AddRunRec(sRunChannels[nChannel].a, nWallFace, 0x70000);
auto nSwitch = BuildSwPressWall(nChannel, BuildLink(1, 1), nWall);
@ -1564,7 +1565,7 @@ void runlist_ProcessWallTag(int nWall, int nLotag, int nHitag)
case 8: // Reverse switch
{
int nWallFace = BuildWallFace(nChannel, nWall, 2, wall[nWall].picnum, wall[nWall].picnum + 1);
int nWallFace = BuildWallFace(nChannel, nWall, 2, wal.picnum, wal.picnum + 1);
runlist_AddRunRec(sRunChannels[nChannel].a, nWallFace, 0x70000);
auto nSwitch = BuildSwPressWall(nChannel, BuildLink(2, -1, 0), nWall);