mirror of
https://github.com/ZDoom/gzdoom.git
synced 2024-11-10 14:51:40 +00:00
- store extended sector info directly in FLevelLocals.
This is safer than using the first sector's reference.
This commit is contained in:
parent
497c474fee
commit
9a994482b1
3 changed files with 4 additions and 9 deletions
|
@ -432,6 +432,7 @@ public:
|
||||||
|
|
||||||
TArray<vertex_t> vertexes;
|
TArray<vertex_t> vertexes;
|
||||||
TArray<sector_t> sectors;
|
TArray<sector_t> sectors;
|
||||||
|
TArray<extsector_t> extsectors; // container for non-trivial sector information. sector_t must be trivially copyable for *_fakeflat to work as intended.
|
||||||
TArray<line_t*> linebuffer; // contains the line lists for the sectors.
|
TArray<line_t*> linebuffer; // contains the line lists for the sectors.
|
||||||
TArray<subsector_t*> subsectorbuffer; // contains the subsector lists for the sectors.
|
TArray<subsector_t*> subsectorbuffer; // contains the subsector lists for the sectors.
|
||||||
TArray<line_t> lines;
|
TArray<line_t> lines;
|
||||||
|
|
|
@ -1066,6 +1066,7 @@ void MapLoader::LoadSectors (MapData *map, FMissingTextureTracker &missingtex)
|
||||||
|
|
||||||
unsigned numsectors = lumplen / sizeof(mapsector_t);
|
unsigned numsectors = lumplen / sizeof(mapsector_t);
|
||||||
Level->sectors.Alloc(numsectors);
|
Level->sectors.Alloc(numsectors);
|
||||||
|
Level->extsectors.Alloc(numsectors);
|
||||||
auto sectors = &Level->sectors[0];
|
auto sectors = &Level->sectors[0];
|
||||||
memset (sectors, 0, numsectors*sizeof(sector_t));
|
memset (sectors, 0, numsectors*sizeof(sector_t));
|
||||||
|
|
||||||
|
@ -1078,12 +1079,9 @@ void MapLoader::LoadSectors (MapData *map, FMissingTextureTracker &missingtex)
|
||||||
ms = (mapsector_t*)msp.Data();
|
ms = (mapsector_t*)msp.Data();
|
||||||
ss = sectors;
|
ss = sectors;
|
||||||
|
|
||||||
// Extended properties
|
|
||||||
sectors[0].e = new extsector_t[numsectors];
|
|
||||||
|
|
||||||
for (unsigned i = 0; i < numsectors; i++, ss++, ms++)
|
for (unsigned i = 0; i < numsectors; i++, ss++, ms++)
|
||||||
{
|
{
|
||||||
ss->e = §ors[0].e[i];
|
ss->e = &Level->extsectors[i];
|
||||||
ss->Level = Level;
|
ss->Level = Level;
|
||||||
if (!map->HasBehavior) ss->Flags |= SECF_FLOORDROP;
|
if (!map->HasBehavior) ss->Flags |= SECF_FLOORDROP;
|
||||||
ss->SetPlaneTexZ(sector_t::floor, (double)LittleShort(ms->floorheight));
|
ss->SetPlaneTexZ(sector_t::floor, (double)LittleShort(ms->floorheight));
|
||||||
|
|
|
@ -314,11 +314,6 @@ void FLevelLocals::ClearLevelData()
|
||||||
DialogueRoots.Clear();
|
DialogueRoots.Clear();
|
||||||
ClassRoots.Clear();
|
ClassRoots.Clear();
|
||||||
|
|
||||||
// delete allocated data in the level arrays.
|
|
||||||
if (sectors.Size() > 0)
|
|
||||||
{
|
|
||||||
delete[] sectors[0].e;
|
|
||||||
}
|
|
||||||
for (auto &sub : subsectors)
|
for (auto &sub : subsectors)
|
||||||
{
|
{
|
||||||
if (sub.BSP != nullptr) delete sub.BSP;
|
if (sub.BSP != nullptr) delete sub.BSP;
|
||||||
|
@ -335,6 +330,7 @@ void FLevelLocals::ClearLevelData()
|
||||||
canvasTextureInfo.EmptyList();
|
canvasTextureInfo.EmptyList();
|
||||||
sections.Clear();
|
sections.Clear();
|
||||||
segs.Clear();
|
segs.Clear();
|
||||||
|
extsectors.Clear();
|
||||||
sectors.Clear();
|
sectors.Clear();
|
||||||
linebuffer.Clear();
|
linebuffer.Clear();
|
||||||
subsectorbuffer.Clear();
|
subsectorbuffer.Clear();
|
||||||
|
|
Loading…
Reference in a new issue