From fc41a2bd85dc4d405561c322a8b0f9b15f9e3a06 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Wed, 15 Dec 2021 13:08:09 +0100 Subject: [PATCH] - renamed sections2 and sections2PerSector. No more need for a '2'. --- source/core/automap.cpp | 4 +-- source/core/maploader.cpp | 2 +- source/core/rendering/hw_sections.h | 4 +-- source/core/rendering/hw_sections2.cpp | 26 +++++++++---------- .../core/rendering/scene/hw_bunchdrawer.cpp | 14 +++++----- source/core/rendering/scene/hw_flats.cpp | 4 +-- source/core/savegamehelp.cpp | 2 +- source/core/sectorgeometry.cpp | 2 +- source/games/blood/src/db.cpp | 2 +- 9 files changed, 29 insertions(+), 31 deletions(-) diff --git a/source/core/automap.cpp b/source/core/automap.cpp index 7f7915e84..0b876f156 100644 --- a/source/core/automap.cpp +++ b/source/core/automap.cpp @@ -585,7 +585,7 @@ void renderDrawMapView(int cposx, int cposy, int czoom, int cang) PalEntry light = shadeToLight(sector[i].floorshade); setgotpic(picnum); - for (auto sect : sections2PerSector[i]) + for (auto sect : sectionsPerSector[i]) { TArray* indices; auto mesh = sectionGeometry.get(sect, 0, { 0.f, 0.f }, &indices); @@ -601,7 +601,7 @@ void renderDrawMapView(int cposx, int cposy, int czoom, int cang) #ifdef _DEBUG // visualize the triangulator being used. - if (sections2PerSector[i][0]->geomflags & NoEarcut) light.r = light.b = 80; + if (sectionsPerSector[i][0]->geomflags & NoEarcut) light.r = light.b = 80; #endif twod->AddPoly(tileGetTexture(picnum, true), vertices.Data(), vertices.Size(), (unsigned*)indices->Data(), indices->Size(), translation, light, LegacyRenderStyles[STYLE_Translucent], windowxy1.x, windowxy1.y, windowxy2.x + 1, windowxy2.y + 1); diff --git a/source/core/maploader.cpp b/source/core/maploader.cpp index 2df79519b..8730106ad 100644 --- a/source/core/maploader.cpp +++ b/source/core/maploader.cpp @@ -489,7 +489,7 @@ void engineLoadBoard(const char* filename, int flags, vec3_t* pos, int16_t* ang, G_LoadMapHack(filename, md4, sprites); setWallSectors(); hw_CreateSections2(); - sectionGeometry.SetSize(sections2.Size()); + sectionGeometry.SetSize(sections.Size()); wallbackup = wall; diff --git a/source/core/rendering/hw_sections.h b/source/core/rendering/hw_sections.h index 794275d3a..592312008 100644 --- a/source/core/rendering/hw_sections.h +++ b/source/core/rendering/hw_sections.h @@ -50,8 +50,8 @@ struct Section TArrayView loops; }; -extern TArray
sections2; -extern TArrayView> sections2PerSector; +extern TArray
sections; +extern TArrayView> sectionsPerSector; void hw_CreateSections2(); using Outline = TArray>; diff --git a/source/core/rendering/hw_sections2.cpp b/source/core/rendering/hw_sections2.cpp index 15608daa4..41170b47a 100644 --- a/source/core/rendering/hw_sections2.cpp +++ b/source/core/rendering/hw_sections2.cpp @@ -49,8 +49,8 @@ CVAR(Bool, hw_sectiondebug, false, 0) TMap bugged; TArray sectionLines; -TArray
sections2; -TArrayView> sections2PerSector; +TArray
sections; +TArrayView> sectionsPerSector; TArray splits; struct loopcollect @@ -542,9 +542,9 @@ static void ConstructSections(TArray& builders) unsigned count = 0; // allocate as much as possible from the arena here. - size_t size = sizeof(*sections2PerSector.Data()) * numsectors; + size_t size = sizeof(*sectionsPerSector.Data()) * numsectors; auto data = sectionArena.Calloc(size); - sections2PerSector.Set(static_cast(data), numsectors); + sectionsPerSector.Set(static_cast(data), numsectors); for (int i = 0; i < numsectors; i++) { @@ -553,10 +553,10 @@ static void ConstructSections(TArray& builders) size = sizeof(Section*) * builder.sections.Size(); data = sectionArena.Calloc(size); - sections2PerSector[i].Set(static_cast(data), builder.sections.Size()); // although this may need reallocation, it is too small to warrant single allocations for each sector. + sectionsPerSector[i].Set(static_cast(data), builder.sections.Size()); // although this may need reallocation, it is too small to warrant single allocations for each sector. } - sections2.Resize(count); // this we cannot put into the arena because its size may change. - memset(sections2.Data(), 0, count * sizeof(*sections2.Data())); + sections.Resize(count); // this we cannot put into the arena because its size may change. + memset(sections.Data(), 0, count * sizeof(*sections.Data())); // now fill in the data @@ -566,9 +566,9 @@ static void ConstructSections(TArray& builders) auto& builder = builders[i]; for (unsigned j = 0; j < builder.sections.Size(); j++) { - auto section = §ions2[cursection]; + auto section = §ions[cursection]; auto& srcsect = builder.sections[j]; - sections2PerSector[i][j] = section; + sectionsPerSector[i][j] = section; section->sector = i; section->index = cursection++; @@ -604,7 +604,7 @@ static void ConstructSections(TArray& builders) line.partnersection = line.partner == -1 ? -1 : sectionLines[line.partner].section; } sectionLines.ShrinkToFit(); - sections2.ShrinkToFit(); + sections.ShrinkToFit(); } //========================================================================== @@ -617,7 +617,7 @@ void hw_CreateSections2() { bugged.Clear(); sectionArena.FreeAll(); - sections2.Clear(); + sections.Clear(); sectionLines.Clear(); TArray collect; CollectLoops(collect); @@ -632,8 +632,8 @@ void hw_CreateSections2() for (int i = 0; i < numsectors; i++) { //if (sections2PerSector[i][0]->flags == 0 && !bugged.CheckKey(i)) continue; - Printf(PRINT_LOG, "Sector %d, %d walls, %d sections\n", i, sector[i].wallnum, sections2PerSector[i].Size()); - for (auto& section : sections2PerSector[i]) + Printf(PRINT_LOG, "Sector %d, %d walls, %d sections\n", i, sector[i].wallnum, sectionsPerSector[i].Size()); + for (auto& section : sectionsPerSector[i]) { Printf(PRINT_LOG, "\tSection %d, %d loops, flags = %d\n", section->index, section->loops.Size(), section->flags); for (auto& loop : section->loops) diff --git a/source/core/rendering/scene/hw_bunchdrawer.cpp b/source/core/rendering/scene/hw_bunchdrawer.cpp index cfb86748a..8d5f34b2c 100644 --- a/source/core/rendering/scene/hw_bunchdrawer.cpp +++ b/source/core/rendering/scene/hw_bunchdrawer.cpp @@ -88,8 +88,7 @@ void BunchDrawer::Init(HWDrawInfo *_di, Clipper* c, vec2_t& view, binangle a1, b void BunchDrawer::StartScene() { - //unsigned numsections = Sections.Size(); - unsigned numsections = sections2.Size(); + unsigned numsections = sections.Size(); LastBunch = 0; StartTime = I_msTime(); Bunches.Clear(); @@ -566,8 +565,7 @@ void BunchDrawer::ProcessSection(int sectionnum, bool portal) SetupSprite.Clock(); - //int sectnum = Sections[sectionnum].sector; - int sectnum = sections2[sectionnum].sector; + int sectnum = sections[sectionnum].sector; if (!gotsector[sectnum]) { gotsector.Set(sectnum); @@ -605,8 +603,8 @@ void BunchDrawer::ProcessSection(int sectionnum, bool portal) //Todo: process subsectors inbunch = false; - //auto section = &Sections[sectionnum]; - auto section = §ions2[sectionnum]; + + auto section = §ions[sectionnum]; for (unsigned i = 0; i < section->lines.Size(); i++) { auto thisline = §ionLines[section->lines[i]]; @@ -654,7 +652,7 @@ void BunchDrawer::RenderScene(const int* viewsectors, unsigned sectcount, bool p for (unsigned i = 0; i < sectcount; i++) { - for (auto j : sections2PerSector[viewsectors[i]]) + for (auto j : sectionsPerSector[viewsectors[i]]) { sectionstartang[j->index] = 0; sectionendang[j->index] = int(angrange.asbam()); @@ -662,7 +660,7 @@ void BunchDrawer::RenderScene(const int* viewsectors, unsigned sectcount, bool p } for (unsigned i = 0; i < sectcount; i++) { - for (auto j : sections2PerSector[viewsectors[i]]) + for (auto j : sectionsPerSector[viewsectors[i]]) { ProcessSection(j->index, portal); } diff --git a/source/core/rendering/scene/hw_flats.cpp b/source/core/rendering/scene/hw_flats.cpp index ab00a303c..c22b5cfd0 100644 --- a/source/core/rendering/scene/hw_flats.cpp +++ b/source/core/rendering/scene/hw_flats.cpp @@ -100,7 +100,7 @@ void HWFlat::MakeVertices() if (Sprite == nullptr) { TArray* pIndices; - auto mesh = sectionGeometry.get(§ions2[section], plane, geoofs, &pIndices); + auto mesh = sectionGeometry.get(§ions[section], plane, geoofs, &pIndices); auto ret = screen->mVertexData->AllocVertices(pIndices->Size()); auto vp = ret.first; @@ -162,7 +162,7 @@ void HWFlat::DrawFlat(HWDrawInfo *di, FRenderState &state, bool translucent) if (!Sprite) { TArray *indices; - auto mesh = sectionGeometry.get(§ions2[section], plane, geoofs, &indices); + auto mesh = sectionGeometry.get(§ions[section], plane, geoofs, &indices); state.SetNormal(mesh->normal); } else diff --git a/source/core/savegamehelp.cpp b/source/core/savegamehelp.cpp index d05f85519..28523e453 100644 --- a/source/core/savegamehelp.cpp +++ b/source/core/savegamehelp.cpp @@ -725,7 +725,7 @@ void SerializeMap(FSerializer& arc) { setWallSectors(); hw_CreateSections2(); - sectionGeometry.SetSize(sections2.Size()); + sectionGeometry.SetSize(sections.Size()); } } diff --git a/source/core/sectorgeometry.cpp b/source/core/sectorgeometry.cpp index 2f5d8274c..227f86675 100644 --- a/source/core/sectorgeometry.cpp +++ b/source/core/sectorgeometry.cpp @@ -547,7 +547,7 @@ void SectionGeometry::CreatePlaneMesh(Section* section, int plane, const FVector void SectionGeometry::MarkDirty(sectortype* sector) { - for (auto section : sections2PerSector[sectnum(sector)]) + for (auto section : sectionsPerSector[sectnum(sector)]) { section->dirty = sector->dirty; } diff --git a/source/games/blood/src/db.cpp b/source/games/blood/src/db.cpp index dcbf08498..82077f9a3 100644 --- a/source/games/blood/src/db.cpp +++ b/source/games/blood/src/db.cpp @@ -728,7 +728,7 @@ void dbLoadMap(const char* pPath, int* pX, int* pY, int* pZ, short* pAngle, sect setWallSectors(); hw_CreateSections2(); - sectionGeometry.SetSize(sections2.Size()); + sectionGeometry.SetSize(sections.Size()); wallbackup = wall; sectorbackup = sector; }