mirror of
https://github.com/DrBeef/Raze.git
synced 2025-01-19 07:31:03 +00:00
- wrapped all reading wallptr references.
This commit is contained in:
parent
0b75f19da5
commit
34333302f9
6 changed files with 17 additions and 16 deletions
|
@ -421,7 +421,7 @@ void fixSectors()
|
|||
{
|
||||
for(auto& sect: sector)
|
||||
{
|
||||
// Fix maps which do not set their wallptr to the first wall of the sector. Lo Wang In Time's map 11 is such a case.
|
||||
// Fix maps which do not set their wall index to the first wall of the sector. Lo Wang In Time's map 11 is such a case.
|
||||
auto wp = sect.firstWall();
|
||||
// Note: we do not have the 'sector' index initialized here, it would not be helpful anyway for this fix.
|
||||
while (wp != wall.Data() && wp[-1].twoSided() && wp[-1].nextWall()->nextWall() == &wp[-1] && wp[-1].nextWall()->nextSector() == §)
|
||||
|
@ -755,11 +755,11 @@ void setWallSectors()
|
|||
auto sect = §or[i];
|
||||
auto nextsect = §or[i + 1];
|
||||
|
||||
if (sect->wallptr < nextsect->wallptr && sect->wallptr + sect->wall_count() > nextsect->wallptr)
|
||||
if (sect->wall_index() < nextsect->wall_index() && sect->wall_index() + sect->wall_count() > nextsect->wall_index())
|
||||
{
|
||||
// We have overlapping wall ranges for two sectors. Do some analysis to see where these walls belong
|
||||
int checkstart = nextsect->wallptr;
|
||||
int checkend = sect->wallptr + sect->wall_count();
|
||||
int checkstart = nextsect->wall_index();
|
||||
int checkend = sect->wall_index() + sect->wall_count();
|
||||
|
||||
// for now assign the walls to the first sector. Final decisions are made below.
|
||||
nextsect->wallnum -= checkend - checkstart;
|
||||
|
@ -776,22 +776,22 @@ void setWallSectors()
|
|||
}
|
||||
return refok && point2ok;
|
||||
};
|
||||
while (checkstart < checkend && belongs(checkstart, sect->wallptr, checkstart, checkstart))
|
||||
while (checkstart < checkend && belongs(checkstart, sect->wall_index(), checkstart, checkstart))
|
||||
checkstart++;
|
||||
|
||||
sect->wallnum = checkstart - sect->wallptr;
|
||||
sect->wallnum = checkstart - sect->wall_index();
|
||||
|
||||
while (checkstart < checkend && belongs(checkend - 1, checkend, nextsect->wallptr + nextsect->wall_count(), checkstart))
|
||||
while (checkstart < checkend && belongs(checkend - 1, checkend, nextsect->wall_index() + nextsect->wall_count(), checkstart))
|
||||
checkend--;
|
||||
|
||||
nextsect->wallnum += nextsect->wallptr - checkend;
|
||||
nextsect->wallnum += nextsect->wall_index() - checkend;
|
||||
nextsect->wallptr = checkend;
|
||||
|
||||
if (nextsect->wallptr > sect->wallptr + sect->wall_count())
|
||||
if (nextsect->wall_index() > sect->wall_index() + sect->wall_count())
|
||||
{
|
||||
// If there's a gap, assign to the first sector. In this case we may only guess.
|
||||
Printf("Wall range %d - %d referenced by sectors %d and %d\n", sect->wallptr + sect->wall_count(), nextsect->wallptr - 1, i, i + 1);
|
||||
sect->wallnum = nextsect->wallptr - sect->wallptr;
|
||||
Printf("Wall range %d - %d referenced by sectors %d and %d\n", sect->wall_index() + sect->wall_count(), nextsect->wall_index() - 1, i, i + 1);
|
||||
sect->wallnum = nextsect->wall_index() - sect->wall_index();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -350,6 +350,7 @@ struct sectortype
|
|||
int getceilingslope() const { return ceilingstat & CSTAT_SECTOR_SLOPE ? ceilingheinum : 0; }
|
||||
walltype* firstWall() const;
|
||||
walltype* lastWall() const;
|
||||
int wall_index() const { return wallptr; }
|
||||
int wall_count() const { return wallnum; }
|
||||
|
||||
|
||||
|
|
|
@ -124,8 +124,8 @@ DEFINE_ACTION_FUNCTION(DLevelPostProcessor, SplitSector)
|
|||
|
||||
if (sectornum < sector.Size())
|
||||
{
|
||||
if (firstwall >= sector[sectornum].wallptr && firstwall < sector[sectornum].wallptr + sector[sectornum].wall_count() &&
|
||||
secondwall >= sector[sectornum].wallptr && secondwall < sector[sectornum].wallptr + sector[sectornum].wall_count())
|
||||
if (firstwall >= sector[sectornum].wall_index() && firstwall < sector[sectornum].wall_index() + sector[sectornum].wall_count() &&
|
||||
secondwall >= sector[sectornum].wall_index() && secondwall < sector[sectornum].wall_index() + sector[sectornum].wall_count())
|
||||
|
||||
hw_SetSplitSector(sectornum, firstwall, secondwall);
|
||||
}
|
||||
|
|
|
@ -223,7 +223,7 @@ static void CollectLoops(TArray<loopcollect>& sectors)
|
|||
int count = 0;
|
||||
for (unsigned i = 0; i < sector.Size(); i++)
|
||||
{
|
||||
int first = sector[i].wallptr;
|
||||
int first = sector[i].wall_index();
|
||||
int last = first + sector[i].wall_count();
|
||||
sectors.Reserve(1);
|
||||
sectors.Last().bugged = 0;
|
||||
|
|
|
@ -1052,7 +1052,7 @@ void DoSector(bool bSet, int lVar1, int lLabelID, int lVar2, DDukeActor* sActor,
|
|||
switch (lLabelID)
|
||||
{
|
||||
case SECTOR_WALLPTR:
|
||||
if (!bSet) SetGameVarID(lVar2, sectp->wallptr, sActor, sPlayer);
|
||||
if (!bSet) SetGameVarID(lVar2, sectp->wall_index(), sActor, sPlayer);
|
||||
break;
|
||||
case SECTOR_WALLNUM:
|
||||
if (!bSet) SetGameVarID(lVar2, sectp->wall_count(), sActor, sPlayer);
|
||||
|
|
|
@ -128,7 +128,7 @@ void feebtag(const DVector3& pos, sectortype* pSector, DExhumedActor **nSprite,
|
|||
{
|
||||
*nSprite = nullptr;
|
||||
|
||||
int startwall = pSector->wallptr;
|
||||
int startwall = pSector->wall_index();
|
||||
|
||||
int nWalls = pSector->wall_count();
|
||||
|
||||
|
|
Loading…
Reference in a new issue