From 42e02d2956ecf041ebe80a3263919fa91e85e416 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Tue, 15 Nov 2022 15:44:33 +0100 Subject: [PATCH] - eliminated firstWall as well. --- source/core/gamefuncs.cpp | 6 +++--- source/core/maploader.cpp | 10 +++++----- source/core/maptypes.h | 1 - source/core/postprocessor.cpp | 2 +- source/core/rendering/hw_sections.cpp | 2 +- source/core/sectorgeometry.cpp | 4 ++-- source/games/blood/src/nnexts.cpp | 2 +- source/games/blood/src/prediction.cpp | 2 +- source/games/duke/src/actors_d.cpp | 2 +- source/games/duke/src/actors_r.cpp | 6 +++--- source/games/duke/src/gameexec.cpp | 2 +- source/games/duke/src/sectors.cpp | 4 ++-- source/games/exhumed/src/move.cpp | 2 +- source/games/exhumed/src/object.cpp | 2 +- source/games/exhumed/src/player.cpp | 2 +- source/games/exhumed/src/sound.cpp | 2 +- source/games/exhumed/src/switch.cpp | 2 +- source/games/sw/src/copysect.cpp | 4 ++-- source/games/sw/src/rooms.cpp | 4 ++-- source/games/sw/src/sector.cpp | 2 +- source/games/sw/src/slidor.cpp | 2 +- source/games/sw/src/sprite.cpp | 4 ++-- source/games/sw/src/weapon.cpp | 2 +- 23 files changed, 35 insertions(+), 36 deletions(-) diff --git a/source/core/gamefuncs.cpp b/source/core/gamefuncs.cpp index 125ef9562..0c0cf468e 100644 --- a/source/core/gamefuncs.cpp +++ b/source/core/gamefuncs.cpp @@ -138,7 +138,7 @@ void calcSlope(const sectortype* sec, double xpos, double ypos, double* pceilz, if ((bits & CSTAT_SECTOR_SLOPE) == CSTAT_SECTOR_SLOPE) { - auto wal = sec->firstWall(); + auto wal = sec->walls.Data(); double len = wal->Length(); if (len != 0) { @@ -158,7 +158,7 @@ void calcSlope(const sectortype* sec, double xpos, double ypos, double* pceilz, int getslopeval(sectortype* sect, const DVector3& pos, double basez) { - auto wal = sect->firstWall(); + auto wal = sect->walls.Data(); double i = (pos.XY() - wal->pos).dot(wal->delta().Rotated90CCW()); return i == 0? 0 : int(SLOPEVAL_FACTOR * (pos.Z - basez) * wal->Length() / i); } @@ -713,7 +713,7 @@ double checkWallHit(walltype* wal, EWallFlags flagmask, const DVector3& start, c double checkSectorPlaneHit(sectortype* sec, const DVector3& start, const DVector3& direction, DVector3& result, double maxfactor) { if (sec->walls.Size() < 3) return -1; - auto wal = sec->firstWall(); + auto wal = sec->walls.Data(); double len = wal->Length(); DVector3 pt1, pt2, pt3; diff --git a/source/core/maploader.cpp b/source/core/maploader.cpp index 76cde78fb..76373c49a 100644 --- a/source/core/maploader.cpp +++ b/source/core/maploader.cpp @@ -425,7 +425,7 @@ void fixSectors() for(auto& sect: sector) { // Fix maps which do not set their wall index to the first wall of the sector. Lo Wang In Time's map 11 is such a case. - auto wp = sect.firstWall(); + auto wp = sect.walls.Data(); // Note: we do not have the 'sector' index initialized here, it would not be helpful anyway for this fix. while (wp != wall.Data() && wp[-1].twoSided() && wp[-1].nextWall()->nextWall() == &wp[-1] && wp[-1].nextWall()->nextSector() == §) { @@ -757,8 +757,8 @@ void setWallSectors() auto sect = §or[i]; auto nextsect = §or[i + 1]; - unsigned int sectstart = wallindex(sect->firstWall()); - unsigned int nextsectstart = wallindex(sect->firstWall()); + unsigned int sectstart = wallindex(sect->walls.Data()); + unsigned int nextsectstart = wallindex(sect->walls.Data()); if (sectstart < nextsectstart && sectstart + sect->walls.Size() > nextsectstart) { @@ -784,7 +784,7 @@ void setWallSectors() while (checkstart < checkend && belongs(checkstart, sectstart, checkstart, checkstart)) checkstart++; - sect->walls.Set(sect->firstWall(), checkstart - sectstart); + sect->walls.Set(sect->walls.Data(), checkstart - sectstart); while (checkstart < checkend && belongs(checkend - 1, checkend, nextsectstart + nextsect->walls.Size(), checkstart)) checkend--; @@ -797,7 +797,7 @@ void setWallSectors() { // If there's a gap, assign to the first sector. In this case we may only guess. Printf("Wall range %d - %d referenced by sectors %d and %d\n", sectstart + sect->walls.Size(), nextsectstart - 1, i, i + 1); - sect->walls.Set(sect->firstWall(), nextsectstart - sectstart); + sect->walls.Set(sect->walls.Data(), nextsectstart - sectstart); } } } diff --git a/source/core/maptypes.h b/source/core/maptypes.h index 40fcf2095..1493b74d0 100644 --- a/source/core/maptypes.h +++ b/source/core/maptypes.h @@ -427,7 +427,6 @@ struct sectortype void setfloorslope(int heinum) { floorheinum = heinum; if (heinum) floorstat |= CSTAT_SECTOR_SLOPE; else floorstat &= ~CSTAT_SECTOR_SLOPE; } int getfloorslope() const { return floorstat & CSTAT_SECTOR_SLOPE ? floorheinum : 0; } int getceilingslope() const { return ceilingstat & CSTAT_SECTOR_SLOPE ? ceilingheinum : 0; } - walltype* firstWall() const { return walls.Data(); } Blood::XSECTOR& xs() const { return *_xs; } diff --git a/source/core/postprocessor.cpp b/source/core/postprocessor.cpp index 624babcd6..f296e08ae 100644 --- a/source/core/postprocessor.cpp +++ b/source/core/postprocessor.cpp @@ -125,7 +125,7 @@ DEFINE_ACTION_FUNCTION(DLevelPostProcessor, SplitSector) if (sectornum < sector.Size()) { - unsigned sectstart = wallindex(sector[sectornum].firstWall()); + unsigned sectstart = wallindex(sector[sectornum].walls.Data()); if (firstwall >= sectstart && firstwall < sectstart + sector[sectornum].walls.Size() && secondwall >= sectstart && secondwall < sectstart + sector[sectornum].walls.Size()) diff --git a/source/core/rendering/hw_sections.cpp b/source/core/rendering/hw_sections.cpp index ff2bc52c6..144c7df9c 100644 --- a/source/core/rendering/hw_sections.cpp +++ b/source/core/rendering/hw_sections.cpp @@ -223,7 +223,7 @@ static void CollectLoops(TArray& sectors) int count = 0; for (unsigned i = 0; i < sector.Size(); i++) { - int first = wallindex(sector[i].firstWall()); + int first = wallindex(sector[i].walls.Data()); int last = first + sector[i].walls.Size(); sectors.Reserve(1); sectors.Last().bugged = 0; diff --git a/source/core/sectorgeometry.cpp b/source/core/sectorgeometry.cpp index 208ba950c..3ebb15b56 100644 --- a/source/core/sectorgeometry.cpp +++ b/source/core/sectorgeometry.cpp @@ -63,7 +63,7 @@ static FVector3 CalcNormal(sectortype* sector, int plane) if (plane == 1 && !(sector->ceilingstat & CSTAT_SECTOR_SLOPE)) return { 0.f, -1.f, 0.f }; - auto wal = sector->firstWall(); + auto wal = sector->walls.Data(); auto wal2 = wal->point2Wall(); pt[0] = { (float)wal->pos.X, 0.f, -(float)wal->pos.Y}; @@ -122,7 +122,7 @@ public: myplane = plane; offset = off; - auto firstwall = sec->firstWall(); + auto firstwall = sec->walls.Data(); ix1 = firstwall->pos.X; iy1 = firstwall->pos.Y; ix2 = firstwall->point2Wall()->pos.X; diff --git a/source/games/blood/src/nnexts.cpp b/source/games/blood/src/nnexts.cpp index c4e6606a5..d6bb6ac34 100644 --- a/source/games/blood/src/nnexts.cpp +++ b/source/games/blood/src/nnexts.cpp @@ -2530,7 +2530,7 @@ void usePropertiesChanger(DBloodActor* sourceactor, int objType, sectortype* pSe pWall->allocX(); break; case 2: - pWall->sectorp()->slopewallofs = max(int(pWall - pWall->sectorp()->firstWall()), 0); + pWall->sectorp()->slopewallofs = max(int(pWall - pWall->sectorp()->walls.Data()), 0); break; } } diff --git a/source/games/blood/src/prediction.cpp b/source/games/blood/src/prediction.cpp index fe353ced9..4a93b4775 100644 --- a/source/games/blood/src/prediction.cpp +++ b/source/games/blood/src/prediction.cpp @@ -613,7 +613,7 @@ void fakeActProcessSprites(void) speed = MulScale(speed, pXSector->busy, 16); } if (pSector->floorstat & 64) - angle = (GetWallAngle(pSector->firstWall()) + 512) & 2047; + angle = (GetWallAngle(pSector->walls.Data()) + 512) & 2047; predict.xvel += MulScale(speed, Cos_(angle), 30); predict.yvel += MulScale(speed, Sin_(angle), 30); } diff --git a/source/games/duke/src/actors_d.cpp b/source/games/duke/src/actors_d.cpp index 673be360a..03b4b5aab 100644 --- a/source/games/duke/src/actors_d.cpp +++ b/source/games/duke/src/actors_d.cpp @@ -271,7 +271,7 @@ void hitradius_d(DDukeActor* actor, int r, int hp1, int hp2, int hp3, int h { if ((dasectp->ceilingz- actor->spr.pos.Z) < radius * 16) // what value range is this supposed to be? The check that was here did not multiply correctly { - auto wal = dasectp->firstWall(); + auto wal = dasectp->walls.Data(); double d = (wal->pos - actor->spr.pos.XY()).Sum(); if (d < radius) fi.checkhitceiling(dasectp); diff --git a/source/games/duke/src/actors_r.cpp b/source/games/duke/src/actors_r.cpp index f289eceab..8a80e90e6 100644 --- a/source/games/duke/src/actors_r.cpp +++ b/source/games/duke/src/actors_r.cpp @@ -230,7 +230,7 @@ void hitradius_r(DDukeActor* actor, int r, int hp1, int hp2, int hp3, int h { if ((dasectp->ceilingz- actor->spr.pos.Z) < radius * 16) // what value range is this supposed to be? The check that was here did not multiply correctly { - auto wal = dasectp->firstWall(); + auto wal = dasectp->walls.Data(); double d = (wal->pos - actor->spr.pos.XY()).Sum(); if (d < radius) fi.checkhitceiling(dasectp); @@ -3848,8 +3848,8 @@ void destroyit(DDukeActor *actor) auto destsect = spr->sector(); auto srcsect = it_sect; - auto destwal = destsect->firstWall(); - auto srcwal = srcsect->firstWall(); + auto destwal = destsect->walls.Data(); + auto srcwal = srcsect->walls.Data(); for (unsigned i = 0; i < destsect->walls.Size(); i++, srcwal++, destwal++) { destwal->picnum = srcwal->picnum; diff --git a/source/games/duke/src/gameexec.cpp b/source/games/duke/src/gameexec.cpp index c93019c23..04a95c27b 100644 --- a/source/games/duke/src/gameexec.cpp +++ b/source/games/duke/src/gameexec.cpp @@ -1052,7 +1052,7 @@ void DoSector(bool bSet, int lVar1, int lLabelID, int lVar2, DDukeActor* sActor, switch (lLabelID) { case SECTOR_WALLPTR: - if (!bSet) SetGameVarID(lVar2, wallindex(sectp->firstWall()), sActor, sPlayer); + if (!bSet) SetGameVarID(lVar2, wallindex(sectp->walls.Data()), sActor, sPlayer); break; case SECTOR_WALLNUM: if (!bSet) SetGameVarID(lVar2, sectp->walls.Size(), sActor, sPlayer); diff --git a/source/games/duke/src/sectors.cpp b/source/games/duke/src/sectors.cpp index 374ee1f86..5efaafe42 100644 --- a/source/games/duke/src/sectors.cpp +++ b/source/games/duke/src/sectors.cpp @@ -560,7 +560,7 @@ static void handle_st09(sectortype* sptr, DDukeActor* actor) //find what direction door should open by averaging the // 2 neighboring points of wallfind[0] & wallfind[1]. auto prevwall = wal - 1; - if (prevwall < sptr->firstWall()) prevwall += sptr->walls.Size(); + if (prevwall < sptr->walls.Data()) prevwall += sptr->walls.Size(); if ((wal->pos.X == dax) && (wal->pos.Y == day)) { @@ -1116,7 +1116,7 @@ void operateactivators(int low, int plnum) p->state = !p->state; sect->floorshade = sect->ceilingshade = (int8_t)p->shade2; - wal = sect->firstWall(); + wal = sect->walls.Data(); for (j = sect->walls.Size(); j > 0; j--, wal++) wal->shade = (int8_t)p->shade2; } diff --git a/source/games/exhumed/src/move.cpp b/source/games/exhumed/src/move.cpp index e426231ae..fd87257c9 100644 --- a/source/games/exhumed/src/move.cpp +++ b/source/games/exhumed/src/move.cpp @@ -781,7 +781,7 @@ void MoveSector(sectortype* pSector, DAngle nAngle, DVector2& nVel) double nFloorZ = pSector->floorz; - walltype *pStartWall = pSector->firstWall(); + walltype *pStartWall = pSector->walls.Data(); sectortype* pNextSector = pStartWall->nextSector(); BlockInfo *pBlockInfo = &sBlockInfo[nBlock]; diff --git a/source/games/exhumed/src/object.cpp b/source/games/exhumed/src/object.cpp index 0137ca03d..4a3178fc7 100644 --- a/source/games/exhumed/src/object.cpp +++ b/source/games/exhumed/src/object.cpp @@ -381,7 +381,7 @@ void InitElev() DExhumedActor* BuildWallSprite(sectortype* pSector) { - auto wal = pSector->firstWall(); + auto wal = pSector->walls.Data(); auto pActor = insertActor(pSector, 401); diff --git a/source/games/exhumed/src/player.cpp b/source/games/exhumed/src/player.cpp index c34c0104e..a978b7389 100644 --- a/source/games/exhumed/src/player.cpp +++ b/source/games/exhumed/src/player.cpp @@ -128,7 +128,7 @@ void feebtag(const DVector3& pos, sectortype* pSector, DExhumedActor **nSprite, { *nSprite = nullptr; - auto startwall = pSector->firstWall(); + auto startwall = pSector->walls.Data(); int nWalls = pSector->walls.Size(); diff --git a/source/games/exhumed/src/sound.cpp b/source/games/exhumed/src/sound.cpp index 461eca6e5..e2b412bfa 100644 --- a/source/games/exhumed/src/sound.cpp +++ b/source/games/exhumed/src/sound.cpp @@ -664,7 +664,7 @@ void CheckAmbience(sectortype* sect) if (sect->Sound != -1) { auto pSector2 = sect->pSoundSect; - walltype* pWall = pSector2->firstWall(); + walltype* pWall = pSector2->walls.Data(); if (!soundEngine->IsSourcePlayingSomething(SOURCE_Ambient, &amb, 0)) { DVector3 v = { pWall->pos.X, pWall->pos.Y, pSector2->floorz }; diff --git a/source/games/exhumed/src/switch.cpp b/source/games/exhumed/src/switch.cpp index 6d3a92fdf..6e507be53 100644 --- a/source/games/exhumed/src/switch.cpp +++ b/source/games/exhumed/src/switch.cpp @@ -355,7 +355,7 @@ void AISWStepOn::TouchFloor(RunListEvent* ev) if (var_14 != sRunChannels[nChannel].c) { - auto pWall = pSector->firstWall(); + auto pWall = pSector->walls.Data(); PlayFXAtXYZ(StaticSound[nSwitchSound], DVector3(pWall->pos, pSector->floorz)); assert(sRunChannels[nChannel].c < 8); diff --git a/source/games/sw/src/copysect.cpp b/source/games/sw/src/copysect.cpp index c56e9b7fc..3e5409eb1 100644 --- a/source/games/sw/src/copysect.cpp +++ b/source/games/sw/src/copysect.cpp @@ -51,8 +51,8 @@ void CopySectorWalls(sectortype* dest_sect, sectortype* src_sect) SECTOR_OBJECT* sop; sectortype* *sectp; - auto dwall = dest_sect->firstWall(); - auto swall = src_sect->firstWall(); + auto dwall = dest_sect->walls.Data(); + auto swall = src_sect->walls.Data(); auto firstwall = dwall; // this looks broken. diff --git a/source/games/sw/src/rooms.cpp b/source/games/sw/src/rooms.cpp index 9352ae7a5..103368fe9 100644 --- a/source/games/sw/src/rooms.cpp +++ b/source/games/sw/src/rooms.cpp @@ -109,7 +109,7 @@ void SetWallWarpHitscan(sectortype* sect) if (!sp_warp) return; - auto start_wall = sect->firstWall(); + auto start_wall = sect->walls.Data(); auto wall_num = start_wall; // Travel all the way around loop setting wall bits @@ -130,7 +130,7 @@ void SetWallWarpHitscan(sectortype* sect) void ResetWallWarpHitscan(sectortype* sect) { - auto start_wall = sect->firstWall(); + auto start_wall = sect->walls.Data(); auto wall_num = start_wall; // Travel all the way around loop setting wall bits diff --git a/source/games/sw/src/sector.cpp b/source/games/sw/src/sector.cpp index 1f59bf601..a1f6d4bd0 100644 --- a/source/games/sw/src/sector.cpp +++ b/source/games/sw/src/sector.cpp @@ -96,7 +96,7 @@ SPRING_BOARD SpringBoard[20]; void SetSectorWallBits(sectortype* sect, int bit_mask, bool set_sectwall, bool set_nextwall) { - auto start_wall = sect->firstWall(); + auto start_wall = sect->walls.Data(); auto wall_num = start_wall; do diff --git a/source/games/sw/src/slidor.cpp b/source/games/sw/src/slidor.cpp index 98dd133d3..150ea3f1d 100644 --- a/source/games/sw/src/slidor.cpp +++ b/source/games/sw/src/slidor.cpp @@ -431,7 +431,7 @@ int DoSlidorInstantClose(DSWActor* actor) { double diff; - auto startwall = actor->sector()->firstWall(); + auto startwall = actor->sector()->walls.Data(); auto wal = startwall; do diff --git a/source/games/sw/src/sprite.cpp b/source/games/sw/src/sprite.cpp index 4298e2fa6..d9b02c90b 100644 --- a/source/games/sw/src/sprite.cpp +++ b/source/games/sw/src/sprite.cpp @@ -2706,7 +2706,7 @@ void SpriteSetup(void) break; // move the the next wall - auto start_wall = actor->sector()->firstWall(); + auto start_wall = actor->sector()->walls.Data(); auto wall_num = start_wall; // Travel all the way around loop setting wall bits @@ -2819,7 +2819,7 @@ void SpriteSetup(void) case SECT_ACTOR_BLOCK: { // move the the next wall - auto start_wall = actor->sector()->firstWall(); + auto start_wall = actor->sector()->walls.Data(); auto wall_num = start_wall; // Travel all the way around loop setting wall bits diff --git a/source/games/sw/src/weapon.cpp b/source/games/sw/src/weapon.cpp index ec78dc36e..16140f71a 100644 --- a/source/games/sw/src/weapon.cpp +++ b/source/games/sw/src/weapon.cpp @@ -8319,7 +8319,7 @@ bool SlopeBounce(DSWActor* actor, bool* hit_wall) *hit_wall = false; // get angle of the first wall of the sector - auto wallp = hit_sector->firstWall(); + auto wallp = hit_sector->walls.Data(); DAngle daang = wallp->delta().Angle(); // k is now the slope of the ceiling or floor