diff --git a/source/core/automap.cpp b/source/core/automap.cpp index f0a5e0d2862..68a48764f57 100644 --- a/source/core/automap.cpp +++ b/source/core/automap.cpp @@ -588,7 +588,7 @@ void renderDrawMapView(int cposx, int cposy, int czoom, int cang) for (auto section : sectionsPerSector[i]) { TArray* indices; - auto mesh = sectionGeometry.get(section, 0, { 0.f, 0.f }, &indices); + auto mesh = sectionGeometry.get(§ions[section], 0, { 0.f, 0.f }, &indices); vertices.Resize(mesh->vertices.Size()); for (unsigned j = 0; j < mesh->vertices.Size(); j++) { diff --git a/source/core/rendering/hw_sections.cpp b/source/core/rendering/hw_sections.cpp index 967b08f07ad..e31e732fd8d 100644 --- a/source/core/rendering/hw_sections.cpp +++ b/source/core/rendering/hw_sections.cpp @@ -51,7 +51,7 @@ TMap bugged; TArray sectionLines; TArray
sections; -TArrayView> sectionsPerSector; +TArrayView> sectionsPerSector; TArray splits; struct loopcollect @@ -617,9 +617,9 @@ static void ConstructSections(TArray& builders) auto& builder = builders[i]; count += builder.sections.Size(); - size = sizeof(Section*) * builder.sections.Size(); + size = sizeof(int) * builder.sections.Size(); data = sectionArena.Calloc(size); - 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. + 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. } sections.Resize(count); // this we cannot put into the arena because its size may change. memset(sections.Data(), 0, count * sizeof(*sections.Data())); @@ -634,7 +634,7 @@ static void ConstructSections(TArray& builders) { auto section = §ions[cursection]; auto& srcsect = builder.sections[j]; - sectionsPerSector[i][j] = section; + sectionsPerSector[i][j] = cursection; section->sector = i; section->index = cursection++; diff --git a/source/core/rendering/hw_sections.h b/source/core/rendering/hw_sections.h index b89809d896b..4737baf2610 100644 --- a/source/core/rendering/hw_sections.h +++ b/source/core/rendering/hw_sections.h @@ -50,7 +50,7 @@ struct Section }; extern TArray
sections; -extern TArrayView> sectionsPerSector; +extern TArrayView> sectionsPerSector; void hw_CreateSections(); using Outline = TArray>; diff --git a/source/core/rendering/scene/hw_bunchdrawer.cpp b/source/core/rendering/scene/hw_bunchdrawer.cpp index a4dcad17e03..8557d8c5e19 100644 --- a/source/core/rendering/scene/hw_bunchdrawer.cpp +++ b/source/core/rendering/scene/hw_bunchdrawer.cpp @@ -757,15 +757,15 @@ void BunchDrawer::RenderScene(const int* viewsectors, unsigned sectcount, bool p { for (auto j : sectionsPerSector[viewsectors[i]]) { - sectionstartang[j->index] = 0; - sectionendang[j->index] = int(angrange.asbam()); + sectionstartang[j] = 0; + sectionendang[j] = int(angrange.asbam()); } } for (unsigned i = 0; i < sectcount; i++) { for (auto j : sectionsPerSector[viewsectors[i]]) { - ProcessSection(j->index, portal); + ProcessSection(j, portal); } } while (Bunches.Size() > 0) diff --git a/source/core/sectorgeometry.cpp b/source/core/sectorgeometry.cpp index b1219419f8e..766b5fa5b95 100644 --- a/source/core/sectorgeometry.cpp +++ b/source/core/sectorgeometry.cpp @@ -471,7 +471,7 @@ void SectionGeometry::MarkDirty(sectortype* sector) { for (auto section : sectionsPerSector[sectnum(sector)]) { - section->dirty = sector->dirty; + sections[section].dirty = sector->dirty; } sector->dirty = 0; } diff --git a/source/core/thingdef.h b/source/core/thingdef.h index 746cca577e6..e295a17ec17 100644 --- a/source/core/thingdef.h +++ b/source/core/thingdef.h @@ -148,7 +148,7 @@ enum EDefinitionType #if defined(_MSC_VER) #pragma section(SECTION_GREG,read) -#define MSVC_PSEG __declspec(allocate(SECTION_GREG)) +#define MSVC_PSEG __declspec(allocate(SECTION_GREG)) __declspec(no_sanitize_address) #define GCC_PSEG #else #define MSVC_PSEG diff --git a/source/games/exhumed/src/bullet.cpp b/source/games/exhumed/src/bullet.cpp index 3f74aa28d24..de4c74e66b0 100644 --- a/source/games/exhumed/src/bullet.cpp +++ b/source/games/exhumed/src/bullet.cpp @@ -171,12 +171,7 @@ void IgniteSprite(DExhumedActor* pActor) { pAnimActor->pTarget = pActor; ChangeActorStat(pAnimActor, kStatIgnited); - - int yRepeat = (tileHeight(pAnimActor->spr.picnum) * 32) / nFlameHeight; - if (yRepeat < 1) - yRepeat = 1; - - pAnimActor->spr.yrepeat = (uint8_t)yRepeat; + pAnimActor->spr.yrepeat = (uint8_t)max(1, (tileHeight(pAnimActor->spr.picnum) * 32) / nFlameHeight); } }