- 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])
{
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());
for (unsigned j = 0; j < mesh->vertices.Size(); j++)
{

View file

@ -51,7 +51,7 @@ TMap<int, bool> bugged;
TArray<SectionLine> sectionLines;
TArray<Section> sections;
TArrayView<TArrayView<Section*>> sectionsPerSector;
TArrayView<TArrayView<int>> sectionsPerSector;
TArray<int> splits;
struct loopcollect
@ -617,9 +617,9 @@ static void ConstructSections(TArray<sectionbuildsector>& 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<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.
memset(sections.Data(), 0, count * sizeof(*sections.Data()));
@ -634,7 +634,7 @@ static void ConstructSections(TArray<sectionbuildsector>& builders)
{
auto section = &sections[cursection];
auto& srcsect = builder.sections[j];
sectionsPerSector[i][j] = section;
sectionsPerSector[i][j] = cursection;
section->sector = i;
section->index = cursection++;

View file

@ -50,7 +50,7 @@ struct Section
};
extern TArray<Section> sections;
extern TArrayView<TArrayView<Section*>> sectionsPerSector;
extern TArrayView<TArrayView<int>> sectionsPerSector;
void hw_CreateSections();
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]])
{
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)

View file

@ -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;
}

View file

@ -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

View file

@ -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);
}
}