- store indices in sectionsPerSector.

This commit is contained in:
Christoph Oelckers 2022-02-20 13:14:39 +01:00
parent 009c03f430
commit a1339f014c
7 changed files with 12 additions and 17 deletions

View file

@ -588,7 +588,7 @@ void renderDrawMapView(int cposx, int cposy, int czoom, int cang)
for (auto section : sectionsPerSector[i]) for (auto section : sectionsPerSector[i])
{ {
TArray<int>* indices; TArray<int>* indices;
auto mesh = sectionGeometry.get(section, 0, { 0.f, 0.f }, &indices); auto mesh = sectionGeometry.get(&sections[section], 0, { 0.f, 0.f }, &indices);
vertices.Resize(mesh->vertices.Size()); vertices.Resize(mesh->vertices.Size());
for (unsigned j = 0; j < mesh->vertices.Size(); j++) for (unsigned j = 0; j < mesh->vertices.Size(); j++)
{ {

View file

@ -51,7 +51,7 @@ TMap<int, bool> bugged;
TArray<SectionLine> sectionLines; TArray<SectionLine> sectionLines;
TArray<Section> sections; TArray<Section> sections;
TArrayView<TArrayView<Section*>> sectionsPerSector; TArrayView<TArrayView<int>> sectionsPerSector;
TArray<int> splits; TArray<int> splits;
struct loopcollect struct loopcollect
@ -617,9 +617,9 @@ static void ConstructSections(TArray<sectionbuildsector>& builders)
auto& builder = builders[i]; auto& builder = builders[i];
count += builder.sections.Size(); count += builder.sections.Size();
size = sizeof(Section*) * builder.sections.Size(); size = sizeof(int) * builder.sections.Size();
data = sectionArena.Calloc(size); data = sectionArena.Calloc(size);
sectionsPerSector[i].Set(static_cast<Section** >(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<int* >(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. sections.Resize(count); // this we cannot put into the arena because its size may change.
memset(sections.Data(), 0, count * sizeof(*sections.Data())); memset(sections.Data(), 0, count * sizeof(*sections.Data()));
@ -634,7 +634,7 @@ static void ConstructSections(TArray<sectionbuildsector>& builders)
{ {
auto section = &sections[cursection]; auto section = &sections[cursection];
auto& srcsect = builder.sections[j]; auto& srcsect = builder.sections[j];
sectionsPerSector[i][j] = section; sectionsPerSector[i][j] = cursection;
section->sector = i; section->sector = i;
section->index = cursection++; section->index = cursection++;

View file

@ -50,7 +50,7 @@ struct Section
}; };
extern TArray<Section> sections; extern TArray<Section> sections;
extern TArrayView<TArrayView<Section*>> sectionsPerSector; extern TArrayView<TArrayView<int>> sectionsPerSector;
void hw_CreateSections(); void hw_CreateSections();
using Outline = TArray<TArray<vec2_t>>; using Outline = TArray<TArray<vec2_t>>;

View file

@ -757,15 +757,15 @@ void BunchDrawer::RenderScene(const int* viewsectors, unsigned sectcount, bool p
{ {
for (auto j : sectionsPerSector[viewsectors[i]]) for (auto j : sectionsPerSector[viewsectors[i]])
{ {
sectionstartang[j->index] = 0; sectionstartang[j] = 0;
sectionendang[j->index] = int(angrange.asbam()); sectionendang[j] = int(angrange.asbam());
} }
} }
for (unsigned i = 0; i < sectcount; i++) for (unsigned i = 0; i < sectcount; i++)
{ {
for (auto j : sectionsPerSector[viewsectors[i]]) for (auto j : sectionsPerSector[viewsectors[i]])
{ {
ProcessSection(j->index, portal); ProcessSection(j, portal);
} }
} }
while (Bunches.Size() > 0) while (Bunches.Size() > 0)

View file

@ -471,7 +471,7 @@ void SectionGeometry::MarkDirty(sectortype* sector)
{ {
for (auto section : sectionsPerSector[sectnum(sector)]) for (auto section : sectionsPerSector[sectnum(sector)])
{ {
section->dirty = sector->dirty; sections[section].dirty = sector->dirty;
} }
sector->dirty = 0; sector->dirty = 0;
} }

View file

@ -148,7 +148,7 @@ enum EDefinitionType
#if defined(_MSC_VER) #if defined(_MSC_VER)
#pragma section(SECTION_GREG,read) #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 #define GCC_PSEG
#else #else
#define MSVC_PSEG #define MSVC_PSEG

View file

@ -171,12 +171,7 @@ void IgniteSprite(DExhumedActor* pActor)
{ {
pAnimActor->pTarget = pActor; pAnimActor->pTarget = pActor;
ChangeActorStat(pAnimActor, kStatIgnited); ChangeActorStat(pAnimActor, kStatIgnited);
pAnimActor->spr.yrepeat = (uint8_t)max(1, (tileHeight(pAnimActor->spr.picnum) * 32) / nFlameHeight);
int yRepeat = (tileHeight(pAnimActor->spr.picnum) * 32) / nFlameHeight;
if (yRepeat < 1)
yRepeat = 1;
pAnimActor->spr.yrepeat = (uint8_t)yRepeat;
} }
} }