Skip to content

Commit

Permalink
- store indices in sectionsPerSector.
Browse files Browse the repository at this point in the history
  • Loading branch information
coelckers committed Feb 20, 2022
1 parent 009c03f commit a1339f0
Show file tree
Hide file tree
Showing 7 changed files with 12 additions and 17 deletions.
2 changes: 1 addition & 1 deletion source/core/automap.cpp
Expand Up @@ -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++)
{
Expand Down
8 changes: 4 additions & 4 deletions source/core/rendering/hw_sections.cpp
Expand Up @@ -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
Expand Down Expand Up @@ -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()));
Expand All @@ -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++;

Expand Down
2 changes: 1 addition & 1 deletion source/core/rendering/hw_sections.h
Expand Up @@ -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>>;
Expand Down
6 changes: 3 additions & 3 deletions source/core/rendering/scene/hw_bunchdrawer.cpp
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion source/core/sectorgeometry.cpp
Expand Up @@ -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;
}
Expand Down
2 changes: 1 addition & 1 deletion source/core/thingdef.h
Expand Up @@ -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
Expand Down
7 changes: 1 addition & 6 deletions source/games/exhumed/src/bullet.cpp
Expand Up @@ -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);
}
}

Expand Down

0 comments on commit a1339f0

Please sign in to comment.