- Duke: sector[] handled in one more premap loop.

This commit is contained in:
Christoph Oelckers 2021-11-07 00:26:48 +01:00
parent 5eed73f7af
commit c8c8ca05d3
3 changed files with 22 additions and 20 deletions

View file

@ -2007,7 +2007,7 @@ int ConCompiler::parsecommand()
{ {
int lLabelID; int lLabelID;
// syntax getsector[<var>].x <VAR> // syntax getsector[<var>].x <VAR>
// gets the value of sector[<var>].xxx into <VAR> // gets the value of sector [<var>].xxx into <VAR>
// now get name of .xxx // now get name of .xxx
while ((*textptr != '[')) while ((*textptr != '['))
@ -2592,7 +2592,7 @@ int ConCompiler::parsecommand()
{ {
int lLabelID; int lLabelID;
// syntax getsector[<var>].x <VAR> // syntax getsector[<var>].x <VAR>
// gets the value of sector[<var>].xxx into <VAR> // gets the value of sector [<var>].xxx into <VAR>
// now get name of .xxx // now get name of .xxx
while ((*textptr != '[')) while ((*textptr != '['))

View file

@ -1987,7 +1987,7 @@ int ParseState::parse(void)
break; break;
case concmd_larrybird: case concmd_larrybird:
insptr++; insptr++;
ps[g_p].pos.z = sector[ps[g_p].GetActor()->s->sectnum].ceilingz; ps[g_p].pos.z = ps[g_p].GetActor()->getSector()->ceilingz;
ps[g_p].GetActor()->s->z = ps[g_p].pos.z; ps[g_p].GetActor()->s->z = ps[g_p].pos.z;
break; break;
case concmd_destroyit: case concmd_destroyit:

View file

@ -692,38 +692,39 @@ void prelevel_common(int g)
for (i = 0; i < numsectors; i++) for (i = 0; i < numsectors; i++)
{ {
sector[i].extra = 256; auto sectp = &sector[i];
sectp->extra = 256;
switch (sector[i].lotag) switch (sectp->lotag)
{ {
case 20: case 20:
case 22: case 22:
if (sector[i].floorz > sector[i].ceilingz) if (sectp->floorz > sectp->ceilingz)
sector[i].lotag |= 32768; sectp->lotag |= 32768;
continue; continue;
} }
if (sector[i].ceilingstat & 1) if (sectp->ceilingstat & 1)
{ {
//setupbackdrop(sector[i].ceilingpicnum); //setupbackdrop(sectp->ceilingpicnum);
if (sector[i].ceilingpicnum == TILE_CLOUDYSKIES && numclouds < 127) if (sectp->ceilingpicnum == TILE_CLOUDYSKIES && numclouds < 127)
clouds[numclouds++] = i; clouds[numclouds++] = i;
if (ps[0].one_parallax_sectnum == -1) if (ps[0].one_parallax_sectnum == -1)
ps[0].one_parallax_sectnum = i; ps[0].one_parallax_sectnum = i;
} }
if (sector[i].lotag == 32767) //Found a secret room if (sectp->lotag == 32767) //Found a secret room
{ {
ps[0].max_secret_rooms++; ps[0].max_secret_rooms++;
continue; continue;
} }
if (sector[i].lotag == -1) if (sectp->lotag == -1)
{ {
ps[0].exitx = wall[sector[i].wallptr].x; ps[0].exitx = wall[sectp->wallptr].x;
ps[0].exity = wall[sector[i].wallptr].y; ps[0].exity = wall[sectp->wallptr].y;
continue; continue;
} }
} }
@ -886,7 +887,8 @@ static void SpawnPortals()
// There is one map where a sector neighboring a portal is not marked as part of the portal itself. // There is one map where a sector neighboring a portal is not marked as part of the portal itself.
for (int i = 0; i < numsectors; i++) for (int i = 0; i < numsectors; i++)
{ {
if (sector[i].floorpicnum == FOF && sector[i].portalflags != PORTAL_SECTOR_FLOOR) auto sectp = &sector[i];
if (sectp->floorpicnum == FOF && sectp->portalflags != PORTAL_SECTOR_FLOOR)
{ {
for (auto& pt : allPortals) for (auto& pt : allPortals)
{ {
@ -896,8 +898,8 @@ static void SpawnPortals()
{ {
if (findwallbetweensectors(i, t) >= 0) if (findwallbetweensectors(i, t) >= 0)
{ {
sector[i].portalflags = PORTAL_SECTOR_FLOOR; sectp->portalflags = PORTAL_SECTOR_FLOOR;
sector[i].portalnum = uint8_t(1 ^ (&pt - allPortals.Data())); sectp->portalnum = uint8_t(1 ^ (&pt - allPortals.Data()));
pt.targets.Push(i); pt.targets.Push(i);
goto nexti; goto nexti;
} }
@ -905,7 +907,7 @@ static void SpawnPortals()
} }
} }
} }
else if (sector[i].ceilingpicnum == FOF && sector[i].portalflags != PORTAL_SECTOR_CEILING) else if (sectp->ceilingpicnum == FOF && sectp->portalflags != PORTAL_SECTOR_CEILING)
{ {
for (auto& pt : allPortals) for (auto& pt : allPortals)
{ {
@ -915,8 +917,8 @@ static void SpawnPortals()
{ {
if (findwallbetweensectors(i, t) >= 0) if (findwallbetweensectors(i, t) >= 0)
{ {
sector[i].portalflags = PORTAL_SECTOR_CEILING; sectp->portalflags = PORTAL_SECTOR_CEILING;
sector[i].portalnum = uint8_t(1 ^ (&pt - allPortals.Data())); sectp->portalnum = uint8_t(1 ^ (&pt - allPortals.Data()));
pt.targets.Push(i); pt.targets.Push(i);
goto nexti; goto nexti;
} }