From f44736a5b6586c5df55e0dd8285cc5803f20d2b7 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Thu, 27 Jan 2022 17:41:10 +0100 Subject: [PATCH] -use an access function for reading wall positions so that we have a non-modifiable value wherever this is possible. --- source/build/src/clip.cpp | 34 ++++---- source/build/src/engine.cpp | 14 ++-- source/build/src/polymost.cpp | 68 +++++++-------- source/core/automap.cpp | 24 +++--- source/core/gamefuncs.cpp | 8 +- source/core/gamefuncs.h | 36 ++++---- source/core/interpolate.cpp | 8 +- source/core/maploader.cpp | 16 ++-- source/core/maptypes.h | 16 ++-- source/core/menu/usermap.cpp | 16 ++-- source/core/rendering/hw_sections.cpp | 10 +-- source/core/rendering/hw_sections.h | 4 +- source/core/rendering/hw_vertexmap.cpp | 2 +- .../core/rendering/scene/hw_bunchdrawer.cpp | 10 +-- source/core/rendering/scene/hw_drawinfo.cpp | 16 ++-- source/core/rendering/scene/hw_portal.cpp | 20 ++--- source/core/rendering/scene/hw_walls.cpp | 12 +-- source/core/savegamehelp.cpp | 4 +- source/core/sectorgeometry.cpp | 24 +++--- source/games/blood/src/_polymost.cpp | 20 ++--- source/games/blood/src/actor.cpp | 2 +- source/games/blood/src/db.cpp | 4 +- source/games/blood/src/gameutil.cpp | 14 ++-- source/games/blood/src/gib.cpp | 10 +-- source/games/blood/src/nnexts.cpp | 4 +- source/games/blood/src/triggers.cpp | 16 ++-- source/games/duke/src/_polymost.cpp | 2 +- source/games/duke/src/actors.cpp | 4 +- source/games/duke/src/actors_d.cpp | 14 ++-- source/games/duke/src/actors_lava.cpp | 68 +++++++-------- source/games/duke/src/actors_r.cpp | 14 ++-- source/games/duke/src/gameexec.cpp | 4 +- source/games/duke/src/premap.cpp | 4 +- source/games/duke/src/sectors.cpp | 44 +++++----- source/games/duke/src/sectors_d.cpp | 4 +- source/games/duke/src/sectors_r.cpp | 36 ++++---- source/games/duke/src/spawn.cpp | 22 ++--- source/games/exhumed/src/init.cpp | 10 +-- source/games/exhumed/src/move.cpp | 10 +-- source/games/exhumed/src/object.cpp | 84 +++++++++---------- source/games/exhumed/src/sound.cpp | 4 +- source/games/exhumed/src/switch.cpp | 4 +- source/games/sw/src/_polymost.cpp | 8 +- source/games/sw/src/break.cpp | 4 +- source/games/sw/src/interpso.cpp | 4 +- source/games/sw/src/jsector.cpp | 12 +-- source/games/sw/src/player.cpp | 4 +- source/games/sw/src/sector.cpp | 16 ++-- source/games/sw/src/slidor.cpp | 56 ++++++------- source/games/sw/src/sprite.cpp | 6 +- source/games/sw/src/track.cpp | 12 +-- source/games/sw/src/wallmove.cpp | 2 +- source/games/sw/src/weapon.cpp | 4 +- 53 files changed, 435 insertions(+), 433 deletions(-) diff --git a/source/build/src/clip.cpp b/source/build/src/clip.cpp index da4d601f9..6cfadbc5e 100644 --- a/source/build/src/clip.cpp +++ b/source/build/src/clip.cpp @@ -118,8 +118,8 @@ int clipinsidebox(vec2_t *vect, int wallnum, int walldist) auto const wal1 = &wall[wallnum]; auto const wal2 = wal1->point2Wall(); - vec2_t const v1 = { wal1->wall_int_pos.X + walldist - vect->X, wal1->wall_int_pos.Y + walldist - vect->Y }; - vec2_t v2 = { wal2->wall_int_pos.X + walldist - vect->X, wal2->wall_int_pos.Y + walldist - vect->Y }; + vec2_t const v1 = { wal1->wall_int_pos().X + walldist - vect->X, wal1->wall_int_pos().Y + walldist - vect->Y }; + vec2_t v2 = { wal2->wall_int_pos().X + walldist - vect->X, wal2->wall_int_pos().Y + walldist - vect->Y }; if (((v1.X < 0) && (v2.X < 0)) || ((v1.Y < 0) && (v2.Y < 0)) || ((v1.X >= r) && (v2.X >= r)) || ((v1.Y >= r) && (v2.Y >= r))) return 0; @@ -512,12 +512,12 @@ CollisionBase clipmove_(vec3_t * const pos, int * const sectnum, int32_t xvect, { auto const wal2 = wal->point2Wall(); - if ((wal->wall_int_pos.X < clipMin.X && wal2->wall_int_pos.X < clipMin.X) || (wal->wall_int_pos.X > clipMax.X && wal2->wall_int_pos.X > clipMax.X) || - (wal->wall_int_pos.Y < clipMin.Y && wal2->wall_int_pos.Y < clipMin.Y) || (wal->wall_int_pos.Y > clipMax.Y && wal2->wall_int_pos.Y > clipMax.Y)) + if ((wal->wall_int_pos().X < clipMin.X && wal2->wall_int_pos().X < clipMin.X) || (wal->wall_int_pos().X > clipMax.X && wal2->wall_int_pos().X > clipMax.X) || + (wal->wall_int_pos().Y < clipMin.Y && wal2->wall_int_pos().Y < clipMin.Y) || (wal->wall_int_pos().Y > clipMax.Y && wal2->wall_int_pos().Y > clipMax.Y)) continue; - vec2_t p1 = wal->wall_int_pos; - vec2_t p2 = wal2->wall_int_pos; + vec2_t p1 = wal->wall_int_pos(); + vec2_t p2 = wal2->wall_int_pos(); vec2_t d = { p2.X-p1.X, p2.Y-p1.Y }; if (d.X * (pos->Y-p1.Y) < (pos->X-p1.X) * d.Y) @@ -974,9 +974,9 @@ int pushmove_(vec3_t *const vect, int *const sectnum, else { //Find closest point on wall (dax, day) to (vect->x, vect->y) - int32_t dax = wal->point2Wall()->wall_int_pos.X-wal->wall_int_pos.X; - int32_t day = wal->point2Wall()->wall_int_pos.Y-wal->wall_int_pos.Y; - int32_t daz = dax*((vect->X)-wal->wall_int_pos.X) + day*((vect->Y)-wal->wall_int_pos.Y); + int32_t dax = wal->point2Wall()->wall_int_pos().X-wal->wall_int_pos().X; + int32_t day = wal->point2Wall()->wall_int_pos().Y-wal->wall_int_pos().Y; + int32_t daz = dax*((vect->X)-wal->wall_int_pos().X) + day*((vect->Y)-wal->wall_int_pos().Y); int32_t t; if (daz <= 0) t = 0; @@ -985,8 +985,8 @@ int pushmove_(vec3_t *const vect, int *const sectnum, daz2 = dax*dax+day*day; if (daz >= daz2) t = (1<<30); else t = DivScale(daz, daz2, 30); } - dax = wal->wall_int_pos.X + MulScale(dax, t, 30); - day = wal->wall_int_pos.Y + MulScale(day, t, 30); + dax = wal->wall_int_pos().X + MulScale(dax, t, 30); + day = wal->wall_int_pos().Y + MulScale(day, t, 30); closest = { dax, day }; } @@ -996,7 +996,7 @@ int pushmove_(vec3_t *const vect, int *const sectnum, if (j != 0) { - j = getangle(wal->point2Wall()->wall_int_pos.X-wal->wall_int_pos.X, wal->point2Wall()->wall_int_pos.Y-wal->wall_int_pos.Y); + j = getangle(wal->point2Wall()->wall_int_pos().X-wal->wall_int_pos().X, wal->point2Wall()->wall_int_pos().Y-wal->wall_int_pos().Y); int32_t dx = -bsin(j, -11); int32_t dy = bcos(j, -11); int bad2 = 16; @@ -1073,8 +1073,8 @@ void getzrange(const vec3_t& pos, sectortype* sect, int32_t* ceilz, CollisionBas if (wal.twoSided()) { auto nextsect = wal.nextSector(); - vec2_t const v1 = wal.wall_int_pos; - vec2_t const v2 = wal.point2Wall()->wall_int_pos; + vec2_t const v1 = wal.wall_int_pos(); + vec2_t const v2 = wal.point2Wall()->wall_int_pos(); if ((v1.X < xmin && (v2.X < xmin)) || (v1.X > xmax && v2.X > xmax) || (v1.Y < ymin && (v2.Y < ymin)) || (v1.Y > ymax && v2.Y > ymax)) @@ -1289,7 +1289,7 @@ static int32_t hitscan_trysector(const vec3_t *sv, sectortype* sec, HitInfoBase { auto const wal = sec->firstWall(); auto const wal2 = wal->point2Wall(); - int32_t j, dax=wal2->wall_int_pos.X-wal->wall_int_pos.X, day=wal2->wall_int_pos.Y-wal->wall_int_pos.Y; + int32_t j, dax=wal2->wall_int_pos().X-wal->wall_int_pos().X, day=wal2->wall_int_pos().Y-wal->wall_int_pos().Y; i = ksqrt(compat_maybe_truncate_to_int32(uhypsq(dax,day))); if (i == 0) return 1; //continue; i = DivScale(heinum,i, 15); @@ -1298,7 +1298,7 @@ static int32_t hitscan_trysector(const vec3_t *sv, sectortype* sec, HitInfoBase j = (vz<<8)-DMulScale(dax,vy,-day,vx, 15); if (j != 0) { - i = ((z - sv->Z)<<8)+DMulScale(dax,sv->Y-wal->wall_int_pos.Y,-day,sv->X-wal->wall_int_pos.X, 15); + i = ((z - sv->Z)<<8)+DMulScale(dax,sv->Y-wal->wall_int_pos().Y,-day,sv->X-wal->wall_int_pos().X, 15); if (((i^j) >= 0) && ((abs(i)>>1) < abs(j))) { i = DivScale(i,j, 30); @@ -1370,7 +1370,7 @@ int hitscan(const vec3_t& start, const sectortype* startsect, const vec3_t& dire auto const nextsect = wal->nextSector(); - x1 = wal->wall_int_pos.X; y1 = wal->wall_int_pos.Y; x2 = wal2->wall_int_pos.X; y2 = wal2->wall_int_pos.Y; + x1 = wal->wall_int_pos().X; y1 = wal->wall_int_pos().Y; x2 = wal2->wall_int_pos().X; y2 = wal2->wall_int_pos().Y; if (compat_maybe_truncate_to_int32((coord_t)(x1-sv->X)*(y2-sv->Y)) < compat_maybe_truncate_to_int32((coord_t)(x2-sv->X)*(y1-sv->Y))) continue; diff --git a/source/build/src/engine.cpp b/source/build/src/engine.cpp index 8026a67ae..88af7355f 100644 --- a/source/build/src/engine.cpp +++ b/source/build/src/engine.cpp @@ -53,8 +53,8 @@ static int16_t radarang[1280]; // adapted from build.c static void getclosestpointonwall_internal(vec2_t const p, int32_t const dawall, vec2_t *const closest) { - vec2_t const w = wall[dawall].wall_int_pos; - vec2_t const w2 = wall[dawall].point2Wall()->wall_int_pos; + vec2_t const w = wall[dawall].wall_int_pos(); + vec2_t const w2 = wall[dawall].point2Wall()->wall_int_pos(); vec2_t const d = { w2.X - w.X, w2.Y - w.Y }; int64_t i = d.X * ((int64_t)p.X - w.X) + d.Y * ((int64_t)p.Y - w.Y); @@ -298,8 +298,8 @@ int32_t inside(int32_t x, int32_t y, const sectortype* sect) vec2_t xy = { x, y }; for(auto& wal : wallsofsector(sect)) { - vec2_t v1 = wal.wall_int_pos - xy; - vec2_t v2 = wal.point2Wall()->wall_int_pos - xy; + vec2_t v1 = wal.wall_int_pos() - xy; + vec2_t v2 = wal.point2Wall()->wall_int_pos() - xy; // If their signs differ[*], ... // @@ -415,8 +415,8 @@ int cansee(int x1, int y1, int z1, sectortype* sect1, int x2, int y2, int z2, se for (cnt=sec->wallnum,wal=sec->firstWall(); cnt>0; cnt--,wal++) { auto const wal2 = wal->point2Wall(); - const int32_t x31 = wal->wall_int_pos.X-x1, x34 = wal->wall_int_pos.X-wal2->wall_int_pos.X; - const int32_t y31 = wal->wall_int_pos.Y-y1, y34 = wal->wall_int_pos.Y-wal2->wall_int_pos.Y; + const int32_t x31 = wal->wall_int_pos().X-x1, x34 = wal->wall_int_pos().X-wal2->wall_int_pos().X; + const int32_t y31 = wal->wall_int_pos().Y-y1, y34 = wal->wall_int_pos().Y-wal2->wall_int_pos().Y; int32_t x, y, z, t, bot; int32_t cfz[2]; @@ -484,7 +484,7 @@ void neartag(const vec3_t& sv, sectortype* sect, int ange, HitInfoBase& result, auto const wal2 = wal->point2Wall(); const auto nextsect = wal->nextSector(); - const int32_t x1 = wal->wall_int_pos.X, y1 = wal->wall_int_pos.Y, x2 = wal2->wall_int_pos.X, y2 = wal2->wall_int_pos.Y; + const int32_t x1 = wal->wall_int_pos().X, y1 = wal->wall_int_pos().Y, x2 = wal2->wall_int_pos().X, y2 = wal2->wall_int_pos().Y; int32_t intx, inty, intz, good = 0; if (wal->twoSided()) diff --git a/source/build/src/polymost.cpp b/source/build/src/polymost.cpp index f0f6c94ce..9342e1b1b 100644 --- a/source/build/src/polymost.cpp +++ b/source/build/src/polymost.cpp @@ -1043,8 +1043,8 @@ static void polymost_internal_nonparallaxed(FVector2 n0, FVector2 n1, float ryp0 FVector2 const fxy = { xy.X*r, xy.Y*r }; - ft[0] = ((float)(globalposx - sec->firstWall()->wall_int_pos.X)) * fxy.X + ((float)(globalposy - sec->firstWall()->wall_int_pos.Y)) * fxy.Y; - ft[1] = ((float)(globalposy - sec->firstWall()->wall_int_pos.Y)) * fxy.X - ((float)(globalposx - sec->firstWall()->wall_int_pos.X)) * fxy.Y; + ft[0] = ((float)(globalposx - sec->firstWall()->wall_int_pos().X)) * fxy.X + ((float)(globalposy - sec->firstWall()->wall_int_pos().Y)) * fxy.Y; + ft[1] = ((float)(globalposy - sec->firstWall()->wall_int_pos().Y)) * fxy.X - ((float)(globalposx - sec->firstWall()->wall_int_pos().X)) * fxy.Y; ft[2] = fcosglobalang * fxy.X + fsinglobalang * fxy.Y; ft[3] = fsinglobalang * fxy.X - fcosglobalang * fxy.Y; @@ -1243,8 +1243,8 @@ static inline int32_t testvisiblemost(float const x0, float const x1) static inline int polymost_getclosestpointonwall(vec2_t const * const pos, int32_t dawall, vec2_t * const n) { - vec2_t const w = { wall[dawall].wall_int_pos.X, wall[dawall].wall_int_pos.Y }; - vec2_t const d = { POINT2(dawall).wall_int_pos.X - w.X, POINT2(dawall).wall_int_pos.Y - w.Y }; + vec2_t const w = { wall[dawall].wall_int_pos().X, wall[dawall].wall_int_pos().Y }; + vec2_t const d = { POINT2(dawall).wall_int_pos().X - w.X, POINT2(dawall).wall_int_pos().Y - w.Y }; int64_t i = d.X * ((int64_t)pos->X - w.X) + d.Y * ((int64_t)pos->Y - w.Y); if (d.X == 0 && d.Y == 0) @@ -1511,13 +1511,13 @@ static void polymost_drawalls(int32_t const bunch) auto const nextsec = nextsectnum>=0 ? §or[nextsectnum] : NULL; //Offset&Rotate 3D coordinates to screen 3D space - FVector2 walpos = { (float)(wal->wall_int_pos.X-globalposx), (float)(wal->wall_int_pos.Y-globalposy) }; + FVector2 walpos = { (float)(wal->wall_int_pos().X-globalposx), (float)(wal->wall_int_pos().Y-globalposy) }; FVector2 p0 = { walpos.Y * gcosang - walpos.X * gsinang, walpos.X * gcosang2 + walpos.Y * gsinang2 }; FVector2 const op0 = p0; - walpos = { (float)(wal2->wall_int_pos.X - globalposx), - (float)(wal2->wall_int_pos.Y - globalposy) }; + walpos = { (float)(wal2->wall_int_pos().X - globalposx), + (float)(wal2->wall_int_pos().Y - globalposy) }; FVector2 p1 = { walpos.Y * gcosang - walpos.X * gsinang, walpos.X * gcosang2 + walpos.Y * gsinang2 }; @@ -1531,26 +1531,26 @@ static void polymost_drawalls(int32_t const bunch) if (p1.Y < SCISDIST) continue; t0 = (SCISDIST-p0.Y)/(p1.Y-p0.Y); p0 = { (p1.X-p0.X)*t0+p0.X, SCISDIST }; - n0 = { (wal2->wall_int_pos.X-wal->wall_int_pos.X)*t0+wal->wall_int_pos.X, - (wal2->wall_int_pos.Y-wal->wall_int_pos.Y)*t0+wal->wall_int_pos.Y }; + n0 = { (wal2->wall_int_pos().X-wal->wall_int_pos().X)*t0+wal->wall_int_pos().X, + (wal2->wall_int_pos().Y-wal->wall_int_pos().Y)*t0+wal->wall_int_pos().Y }; } else { t0 = 0.f; - n0 = { (float)wal->wall_int_pos.X, (float)wal->wall_int_pos.Y }; + n0 = { (float)wal->wall_int_pos().X, (float)wal->wall_int_pos().Y }; } if (p1.Y < SCISDIST) { t1 = (SCISDIST-op0.Y)/(p1.Y-op0.Y); p1 = { (p1.X-op0.X)*t1+op0.X, SCISDIST }; - n1 = { (wal2->wall_int_pos.X-wal->wall_int_pos.X)*t1+wal->wall_int_pos.X, - (wal2->wall_int_pos.Y-wal->wall_int_pos.Y)*t1+wal->wall_int_pos.Y }; + n1 = { (wal2->wall_int_pos().X-wal->wall_int_pos().X)*t1+wal->wall_int_pos().X, + (wal2->wall_int_pos().Y-wal->wall_int_pos().Y)*t1+wal->wall_int_pos().Y }; } else { t1 = 1.f; - n1 = { (float)wal2->wall_int_pos.X, (float)wal2->wall_int_pos.Y }; + n1 = { (float)wal2->wall_int_pos().X, (float)wal2->wall_int_pos().Y }; } float ryp0 = 1.f/p0.Y, ryp1 = 1.f/p1.Y; @@ -1828,10 +1828,10 @@ static void polymost_drawalls(int32_t const bunch) // int32_t wallfront(int32_t l1, int32_t l2) { - vec2_t const l1vect = wall[thewall[l1]].wall_int_pos; - vec2_t const l1p2vect = wall[thewall[l1]].point2Wall()->wall_int_pos; - vec2_t const l2vect = wall[thewall[l2]].wall_int_pos; - vec2_t const l2p2vect = wall[thewall[l2]].point2Wall()->wall_int_pos; + vec2_t const l1vect = wall[thewall[l1]].wall_int_pos(); + vec2_t const l1p2vect = wall[thewall[l1]].point2Wall()->wall_int_pos(); + vec2_t const l2vect = wall[thewall[l2]].wall_int_pos(); + vec2_t const l2p2vect = wall[thewall[l2]].point2Wall()->wall_int_pos(); vec2_t d = { l1p2vect.X - l1vect.X, l1p2vect.Y - l1vect.Y }; int32_t t1 = DMulScale(l2vect.X - l1vect.X, d.Y, -d.X, l2vect.Y - l1vect.Y, 2); //p1(l2) vs. l1 int32_t t2 = DMulScale(l2p2vect.X - l1vect.X, d.Y, -d.X, l2p2vect.Y - l1vect.Y, 2); //p2(l2) vs. l1 @@ -1935,8 +1935,8 @@ void polymost_scansector(int32_t sectnum) { auto const wal2 = wal->point2Wall(); - DVector2 const fp1 = { double(wal->wall_int_pos.X - globalposx), double(wal->wall_int_pos.Y - globalposy) }; - DVector2 const fp2 = { double(wal2->wall_int_pos.X - globalposx), double(wal2->wall_int_pos.Y - globalposy) }; + DVector2 const fp1 = { double(wal->wall_int_pos().X - globalposx), double(wal->wall_int_pos().Y - globalposy) }; + DVector2 const fp2 = { double(wal2->wall_int_pos().X - globalposx), double(wal2->wall_int_pos().Y - globalposy) }; int const nextsectnum = wal->nextsector; //Scan close sectors @@ -2337,10 +2337,10 @@ static void polymost_drawmaskwallinternal(int32_t wallIndex) globalshade = (int32_t)wal->shade; globalfloorpal = globalpal = (int32_t)((uint8_t)wal->pal); - FVector2 s0 = { (float)(wal->wall_int_pos.X-globalposx), (float)(wal->wall_int_pos.Y-globalposy) }; + FVector2 s0 = { (float)(wal->wall_int_pos().X-globalposx), (float)(wal->wall_int_pos().Y-globalposy) }; FVector2 p0 = { s0.Y*gcosang - s0.X*gsinang, s0.X*gcosang2 + s0.Y*gsinang2 }; - FVector2 s1 = { (float)(wal2->wall_int_pos.X-globalposx), (float)(wal2->wall_int_pos.Y-globalposy) }; + FVector2 s1 = { (float)(wal2->wall_int_pos().X-globalposx), (float)(wal2->wall_int_pos().Y-globalposy) }; FVector2 p1 = { s1.Y*gcosang - s1.X*gsinang, s1.X*gcosang2 + s1.Y*gsinang2 }; if ((p0.Y < SCISDIST) && (p1.Y < SCISDIST)) return; @@ -2364,13 +2364,13 @@ static void polymost_drawmaskwallinternal(int32_t wallIndex) p1 = { (p1.X - op0.X) * t1 + op0.X, SCISDIST }; } - int32_t m0 = (int32_t)((wal2->wall_int_pos.X - wal->wall_int_pos.X) * t0 + wal->wall_int_pos.X); - int32_t m1 = (int32_t)((wal2->wall_int_pos.Y - wal->wall_int_pos.Y) * t0 + wal->wall_int_pos.Y); + int32_t m0 = (int32_t)((wal2->wall_int_pos().X - wal->wall_int_pos().X) * t0 + wal->wall_int_pos().X); + int32_t m1 = (int32_t)((wal2->wall_int_pos().Y - wal->wall_int_pos().Y) * t0 + wal->wall_int_pos().Y); int32_t cz[4], fz[4]; getzsofslopeptr(sec, m0, m1, &cz[0], &fz[0]); getzsofslopeptr(wal->nextSector(), m0, m1, &cz[1], &fz[1]); - m0 = (int32_t)((wal2->wall_int_pos.X - wal->wall_int_pos.X) * t1 + wal->wall_int_pos.X); - m1 = (int32_t)((wal2->wall_int_pos.Y - wal->wall_int_pos.Y) * t1 + wal->wall_int_pos.Y); + m0 = (int32_t)((wal2->wall_int_pos().X - wal->wall_int_pos().X) * t1 + wal->wall_int_pos().X); + m1 = (int32_t)((wal2->wall_int_pos().Y - wal->wall_int_pos().Y) * t1 + wal->wall_int_pos().Y); getzsofslopeptr(sec, m0, m1, &cz[2], &fz[2]); getzsofslopeptr(wal->nextSector(), m0, m1, &cz[3], &fz[3]); @@ -2911,12 +2911,12 @@ void polymost_drawsprite(int32_t snum) { vec2_t v = { /*Blrintf(vf.x)*/(int)vf.X, /*Blrintf(vf.y)*/(int)vf.Y }; - if (walldist <= 2 || ((pos.X - v.X) + (pos.X + v.X)) == (wall[w].wall_int_pos.X + POINT2(w).wall_int_pos.X) || - ((pos.Y - v.Y) + (pos.Y + v.Y)) == (wall[w].wall_int_pos.Y + POINT2(w).wall_int_pos.Y) || - polymost_lintersect(pos.X - v.X, pos.Y - v.Y, pos.X + v.X, pos.Y + v.Y, wall[w].wall_int_pos.X, wall[w].wall_int_pos.Y, - POINT2(w).wall_int_pos.X, POINT2(w).wall_int_pos.Y)) + if (walldist <= 2 || ((pos.X - v.X) + (pos.X + v.X)) == (wall[w].wall_int_pos().X + POINT2(w).wall_int_pos().X) || + ((pos.Y - v.Y) + (pos.Y + v.Y)) == (wall[w].wall_int_pos().Y + POINT2(w).wall_int_pos().Y) || + polymost_lintersect(pos.X - v.X, pos.Y - v.Y, pos.X + v.X, pos.Y + v.Y, wall[w].wall_int_pos().X, wall[w].wall_int_pos().Y, + POINT2(w).wall_int_pos().X, POINT2(w).wall_int_pos().Y)) { - int32_t const ang = getangle(wall[w].wall_int_pos.X - POINT2(w).wall_int_pos.X, wall[w].wall_int_pos.Y - POINT2(w).wall_int_pos.Y); + int32_t const ang = getangle(wall[w].wall_int_pos().X - POINT2(w).wall_int_pos().X, wall[w].wall_int_pos().Y - POINT2(w).wall_int_pos().Y); float const foffs = TSPR_OFFSET(tspr); DVector2 const offs = { -bsinf(ang, -6) * foffs, bcosf(ang, -6) * foffs }; @@ -3281,8 +3281,8 @@ static_assert((int)RS_YFLIP == (int)HUDFLAG_FLIPPED); void renderPrepareMirror(int32_t dax, int32_t day, int32_t daz, fixed_t daang, fixed_t dahoriz, int16_t dawall, int32_t* tposx, int32_t* tposy, fixed_t* tang) { - const int32_t x = wall[dawall].wall_int_pos.X, dx = wall[dawall].point2Wall()->wall_int_pos.X - x; - const int32_t y = wall[dawall].wall_int_pos.Y, dy = wall[dawall].point2Wall()->wall_int_pos.Y - y; + const int32_t x = wall[dawall].wall_int_pos().X, dx = wall[dawall].point2Wall()->wall_int_pos().X - x; + const int32_t y = wall[dawall].wall_int_pos().Y, dy = wall[dawall].point2Wall()->wall_int_pos().Y - y; const int32_t j = dx * dx + dy * dy; if (j == 0) @@ -3658,8 +3658,8 @@ void renderDrawMasks(void) maskwallcnt--; - FVector2 dot = { (float)wall[w].wall_int_pos.X, (float)wall[w].wall_int_pos.Y }; - FVector2 dot2 = { (float)wall[w].point2Wall()->wall_int_pos.X, (float)wall[w].point2Wall()->wall_int_pos.Y }; + FVector2 dot = { (float)wall[w].wall_int_pos().X, (float)wall[w].wall_int_pos().Y }; + FVector2 dot2 = { (float)wall[w].point2Wall()->wall_int_pos().X, (float)wall[w].point2Wall()->wall_int_pos().Y }; FVector2 middle = { (dot.X + dot2.X) * .5f, (dot.Y + dot2.Y) * .5f }; _equation maskeq = equation(dot.X, dot.Y, dot2.X, dot2.Y); diff --git a/source/core/automap.cpp b/source/core/automap.cpp index d6975cb67..f0a5e0d28 100644 --- a/source/core/automap.cpp +++ b/source/core/automap.cpp @@ -170,10 +170,10 @@ static void CalcMapBounds() for(auto& wal : wall) { // get map min and max coordinates - if (wal.wall_int_pos.X < x_min_bound) x_min_bound = wal.wall_int_pos.X; - if (wal.wall_int_pos.Y < y_min_bound) y_min_bound = wal.wall_int_pos.Y; - if (wal.wall_int_pos.X > x_max_bound) x_max_bound = wal.wall_int_pos.X; - if (wal.wall_int_pos.Y > y_max_bound) y_max_bound = wal.wall_int_pos.Y; + if (wal.wall_int_pos().X < x_min_bound) x_min_bound = wal.wall_int_pos().X; + if (wal.wall_int_pos().Y < y_min_bound) y_min_bound = wal.wall_int_pos().Y; + if (wal.wall_int_pos().X > x_max_bound) x_max_bound = wal.wall_int_pos().X; + if (wal.wall_int_pos().Y > y_max_bound) y_max_bound = wal.wall_int_pos().Y; } } @@ -434,14 +434,14 @@ void drawredlines(int cposx, int cposy, int czoom, int cang) if (ShowRedLine(wallnum(&wal), i)) { - int ox = wal.wall_int_pos.X - cposx; - int oy = wal.wall_int_pos.Y - cposy; + int ox = wal.wall_int_pos().X - cposx; + int oy = wal.wall_int_pos().Y - cposy; int x1 = DMulScale(ox, xvect, -oy, yvect, 16) + (width << 11); int y1 = DMulScale(oy, xvect, ox, yvect, 16) + (height << 11); auto wal2 = wal.point2Wall(); - ox = wal2->wall_int_pos.X - cposx; - oy = wal2->wall_int_pos.Y - cposy; + ox = wal2->wall_int_pos().X - cposx; + oy = wal2->wall_int_pos().Y - cposy; int x2 = DMulScale(ox, xvect, -oy, yvect, 16) + (width << 11); int y2 = DMulScale(oy, xvect, ox, yvect, 16) + (height << 11); @@ -476,15 +476,15 @@ static void drawwhitelines(int cposx, int cposy, int czoom, int cang) if (isSWALL() && !gFullMap && !show2dwall[wallnum(&wal)]) continue; - int ox = wal.wall_int_pos.X - cposx; - int oy = wal.wall_int_pos.Y - cposy; + int ox = wal.wall_int_pos().X - cposx; + int oy = wal.wall_int_pos().Y - cposy; int x1 = DMulScale(ox, xvect, -oy, yvect, 16) + (width << 11); int y1 = DMulScale(oy, xvect, ox, yvect, 16) + (height << 11); int k = wal.point2; auto wal2 = &wall[k]; - ox = wal2->wall_int_pos.X - cposx; - oy = wal2->wall_int_pos.Y - cposy; + ox = wal2->wall_int_pos().X - cposx; + oy = wal2->wall_int_pos().Y - cposy; int x2 = DMulScale(ox, xvect, -oy, yvect, 16) + (width << 11); int y2 = DMulScale(oy, xvect, ox, yvect, 16) + (height << 11); diff --git a/source/core/gamefuncs.cpp b/source/core/gamefuncs.cpp index f482a6c81..43120f4c9 100644 --- a/source/core/gamefuncs.cpp +++ b/source/core/gamefuncs.cpp @@ -67,8 +67,8 @@ bool calcChaseCamPos(int* px, int* py, int* pz, DCoreActor* act, sectortype** ps { // Push you a little bit off the wall *psect = hitinfo.hitSector; - daang = bvectangbam(hitinfo.hitWall->point2Wall()->wall_int_pos.X - hitinfo.hitWall->wall_int_pos.X, - hitinfo.hitWall->point2Wall()->wall_int_pos.Y - hitinfo.hitWall->wall_int_pos.Y); + daang = bvectangbam(hitinfo.hitWall->point2Wall()->wall_int_pos().X - hitinfo.hitWall->wall_int_pos().X, + hitinfo.hitWall->point2Wall()->wall_int_pos().Y - hitinfo.hitWall->wall_int_pos().Y); newdist = nx * daang.bsin() + ny * -daang.bcos(); if (abs(nx) > abs(ny)) @@ -170,7 +170,7 @@ void calcSlope(const sectortype* sec, float xpos, float ypos, float* pceilz, flo int len = wal->Length(); if (len != 0) { - float fac = (wal->deltax() * (float(ypos - wal->wall_int_pos.Y)) - wal->deltay() * (float(xpos - wal->wall_int_pos.X))) * (1.f / 256.f) / len; + float fac = (wal->deltax() * (float(ypos - wal->wall_int_pos().Y)) - wal->deltay() * (float(xpos - wal->wall_int_pos().X))) * (1.f / 256.f) / len; if (pceilz && sec->ceilingstat & CSTAT_SECTOR_SLOPE) *pceilz += (sec->ceilingheinum * fac); if (pflorz && sec->floorstat & CSTAT_SECTOR_SLOPE) *pflorz += (sec->floorheinum * fac); } @@ -228,7 +228,7 @@ int getslopeval(sectortype* sect, int x, int y, int z, int basez) { auto wal = sect->firstWall(); auto delta = wal->delta(); - int i = (y - wal->wall_int_pos.Y) * delta.X - (x - wal->wall_int_pos.X) * delta.Y; + int i = (y - wal->wall_int_pos().Y) * delta.X - (x - wal->wall_int_pos().X) * delta.Y; return i == 0? 0 : Scale((z - basez) << 8, wal->Length(), i); } diff --git a/source/core/gamefuncs.h b/source/core/gamefuncs.h index d1f6da0f9..ec6d03e94 100644 --- a/source/core/gamefuncs.h +++ b/source/core/gamefuncs.h @@ -185,32 +185,32 @@ inline double RenderY(int y) inline double WallStartX(int wallnum) { - return wall[wallnum].wall_int_pos.X * (1 / 16.); + return wall[wallnum].wall_int_pos().X * (1 / 16.); } inline double WallStartY(int wallnum) { - return wall[wallnum].wall_int_pos.Y * (1 / -16.); + return wall[wallnum].wall_int_pos().Y * (1 / -16.); } inline double WallEndX(int wallnum) { - return wall[wallnum].point2Wall()->wall_int_pos.X * (1 / 16.); + return wall[wallnum].point2Wall()->wall_int_pos().X * (1 / 16.); } inline double WallEndY(int wallnum) { - return wall[wallnum].point2Wall()->wall_int_pos.Y * (1 / -16.); + return wall[wallnum].point2Wall()->wall_int_pos().Y * (1 / -16.); } inline double WallStartX(const walltype* wallnum) { - return wallnum->wall_int_pos.X * (1 / 16.); + return wallnum->wall_int_pos().X * (1 / 16.); } inline double WallStartY(const walltype* wallnum) { - return wallnum->wall_int_pos.Y * (1 / -16.); + return wallnum->wall_int_pos().Y * (1 / -16.); } inline DVector2 WallStart(const walltype* wallnum) @@ -220,12 +220,12 @@ inline DVector2 WallStart(const walltype* wallnum) inline double WallEndX(const walltype* wallnum) { - return wallnum->point2Wall()->wall_int_pos.X * (1 / 16.); + return wallnum->point2Wall()->wall_int_pos().X * (1 / 16.); } inline double WallEndY(const walltype* wallnum) { - return wallnum->point2Wall()->wall_int_pos.Y * (1 / -16.); + return wallnum->point2Wall()->wall_int_pos().Y * (1 / -16.); } inline DVector2 WallEnd(const walltype* wallnum) @@ -308,8 +308,8 @@ inline int I_GetBuildTime() inline int32_t getangle(walltype* wal) { return getangle( - wal->point2Wall()->wall_int_pos.X - wal->wall_int_pos.X, - wal->point2Wall()->wall_int_pos.Y - wal->wall_int_pos.Y); + wal->point2Wall()->wall_int_pos().X - wal->wall_int_pos().X, + wal->point2Wall()->wall_int_pos().Y - wal->wall_int_pos().Y); } inline TArrayView wallsofsector(const sectortype* sec) @@ -342,10 +342,10 @@ inline double SquareDist(double lx1, double ly1, double lx2, double ly2) inline DVector2 NearestPointLine(double px, double py, const walltype* wal) { - double lx1 = wal->wall_int_pos.X; - double ly1 = wal->wall_int_pos.Y; - double lx2 = wal->point2Wall()->wall_int_pos.X; - double ly2 = wal->point2Wall()->wall_int_pos.Y; + double lx1 = wal->wall_int_pos().X; + double ly1 = wal->wall_int_pos().Y; + double lx2 = wal->point2Wall()->wall_int_pos().X; + double ly2 = wal->point2Wall()->wall_int_pos().Y; double wall_length = SquareDist(lx1, ly1, lx2, ly2); @@ -359,10 +359,10 @@ inline DVector2 NearestPointLine(double px, double py, const walltype* wal) inline double SquareDistToWall(double px, double py, const walltype* wal, DVector2* point = nullptr) { - double lx1 = wal->wall_int_pos.X; - double ly1 = wal->wall_int_pos.Y; - double lx2 = wal->point2Wall()->wall_int_pos.X; - double ly2 = wal->point2Wall()->wall_int_pos.Y; + double lx1 = wal->wall_int_pos().X; + double ly1 = wal->wall_int_pos().Y; + double lx2 = wal->point2Wall()->wall_int_pos().X; + double ly2 = wal->point2Wall()->wall_int_pos().Y; double wall_length = SquareDist(lx1, ly1, lx2, ly2); diff --git a/source/core/interpolate.cpp b/source/core/interpolate.cpp index 0f4e87fb2..cf81c2228 100644 --- a/source/core/interpolate.cpp +++ b/source/core/interpolate.cpp @@ -50,8 +50,8 @@ double Get(int index, DCoreActor* actor, int type) case Interp_Sect_CeilingPanX: return sector[index].ceilingxpan_; case Interp_Sect_CeilingPanY: return sector[index].ceilingypan_; - case Interp_Wall_X: return wall[index].wall_int_pos.X; - case Interp_Wall_Y: return wall[index].wall_int_pos.Y; + case Interp_Wall_X: return wall[index].wall_int_pos().X; + case Interp_Wall_Y: return wall[index].wall_int_pos().Y; case Interp_Wall_PanX: return wall[index].xpan_; case Interp_Wall_PanY: return wall[index].ypan_; @@ -74,8 +74,8 @@ void Set(int index, DCoreActor* actor, int type, double val) case Interp_Sect_CeilingPanX: sector[index].ceilingxpan_ = float(val); break; case Interp_Sect_CeilingPanY: sector[index].ceilingypan_ = float(val); break; - case Interp_Wall_X: old = wall[index].wall_int_pos.X; wall[index].wall_int_pos.X = xs_CRoundToInt(val); if (wall[index].wall_int_pos.X != old) wall[index].moved(); break; - case Interp_Wall_Y: old = wall[index].wall_int_pos.Y; wall[index].wall_int_pos.Y = xs_CRoundToInt(val); if (wall[index].wall_int_pos.Y != old) wall[index].moved(); break; + case Interp_Wall_X: old = wall[index].wall_int_pos().X; wall[index].__wall_int_pos.X = xs_CRoundToInt(val); if (wall[index].wall_int_pos().X != old) wall[index].moved(); break; + case Interp_Wall_Y: old = wall[index].wall_int_pos().Y; wall[index].__wall_int_pos.Y = xs_CRoundToInt(val); if (wall[index].wall_int_pos().Y != old) wall[index].moved(); break; case Interp_Wall_PanX: wall[index].xpan_ = float(val); break; case Interp_Wall_PanY: wall[index].ypan_ = float(val); break; diff --git a/source/core/maploader.cpp b/source/core/maploader.cpp index 53fb21e5c..ccc931b09 100644 --- a/source/core/maploader.cpp +++ b/source/core/maploader.cpp @@ -178,8 +178,8 @@ static void ReadSectorV5(FileReader& fr, sectortype& sect) static void ReadWallV7(FileReader& fr, walltype& wall) { - wall.wall_int_pos.X = fr.ReadInt32(); - wall.wall_int_pos.Y = fr.ReadInt32(); + wall.__wall_int_pos.X = fr.ReadInt32(); + wall.__wall_int_pos.Y = fr.ReadInt32(); wall.point2 = fr.ReadInt16(); wall.nextwall = fr.ReadInt16(); wall.nextsector = fr.ReadInt16(); @@ -199,8 +199,8 @@ static void ReadWallV7(FileReader& fr, walltype& wall) static void ReadWallV6(FileReader& fr, walltype& wall) { - wall.wall_int_pos.X = fr.ReadInt32(); - wall.wall_int_pos.Y = fr.ReadInt32(); + wall.__wall_int_pos.X = fr.ReadInt32(); + wall.__wall_int_pos.Y = fr.ReadInt32(); wall.point2 = fr.ReadInt16(); wall.nextsector = fr.ReadInt16(); wall.nextwall = fr.ReadInt16(); @@ -220,8 +220,8 @@ static void ReadWallV6(FileReader& fr, walltype& wall) static void ReadWallV5(FileReader& fr, walltype& wall) { - wall.wall_int_pos.X = fr.ReadInt32(); - wall.wall_int_pos.Y = fr.ReadInt32(); + wall.__wall_int_pos.X = fr.ReadInt32(); + wall.__wall_int_pos.Y = fr.ReadInt32(); wall.point2 = fr.ReadInt16(); wall.picnum = fr.ReadInt16(); wall.overpicnum = fr.ReadInt16(); @@ -649,8 +649,8 @@ static void P_LoadBloodMapWalls(uint8_t* data, size_t len, TArray& lwa // only copy what we need to draw the map preview. auto pWall = &lwalls[i]; - pWall->wall_int_pos.X = LittleLong(load.x); - pWall->wall_int_pos.Y = LittleLong(load.y); + pWall->__wall_int_pos.X = LittleLong(load.x); + pWall->__wall_int_pos.Y = LittleLong(load.y); pWall->point2 = LittleShort(load.point2); pWall->nextwall = LittleShort(load.nextwall); pWall->nextsector = LittleShort(load.nextsector); diff --git a/source/core/maptypes.h b/source/core/maptypes.h index 7f57bec09..e865117ad 100644 --- a/source/core/maptypes.h +++ b/source/core/maptypes.h @@ -358,7 +358,9 @@ struct sectortype struct walltype { - vec2_t wall_int_pos; + vec2_t __wall_int_pos; + + const vec2_t wall_int_pos() const { return __wall_int_pos; } int32_t point2; int32_t nextwall; @@ -404,10 +406,10 @@ struct walltype walltype* nextWall() const; walltype* lastWall(bool fast = true) const; walltype* point2Wall() const; - vec2_t delta() const { return point2Wall()->wall_int_pos - wall_int_pos; } - vec2_t center() const { return(point2Wall()->wall_int_pos + wall_int_pos) / 2; } - int deltax() const { return point2Wall()->wall_int_pos.X - wall_int_pos.X; } - int deltay() const { return point2Wall()->wall_int_pos.Y - wall_int_pos.Y; } + vec2_t delta() const { return point2Wall()->wall_int_pos() - wall_int_pos(); } + vec2_t center() const { return(point2Wall()->wall_int_pos() + wall_int_pos()) / 2; } + int deltax() const { return point2Wall()->wall_int_pos().X - wall_int_pos().X; } + int deltay() const { return point2Wall()->wall_int_pos().Y - wall_int_pos().Y; } bool twoSided() const { return nextsector >= 0; } int Length(); void calcLength(); // this is deliberately not inlined and stored in a file where it can't be found at compile time. @@ -549,8 +551,8 @@ inline void walltype::moved() inline void walltype::move(int newx, int newy) { - wall_int_pos.X = newx; - wall_int_pos.Y = newy; + __wall_int_pos.X = newx; + __wall_int_pos.Y = newy; lengthflags = 3; sectorp()->dirty = EDirty::AllDirty; } diff --git a/source/core/menu/usermap.cpp b/source/core/menu/usermap.cpp index d3d2620ea..decd50ab7 100644 --- a/source/core/menu/usermap.cpp +++ b/source/core/menu/usermap.cpp @@ -219,10 +219,10 @@ DEFINE_ACTION_FUNCTION(_UserMapMenu, DrawPreview) int minx = INT_MAX, miny = INT_MAX, maxx = INT_MIN, maxy = INT_MIN; for (auto& wal : entry->walls) { - if (wal.wall_int_pos.X < minx) minx = wal.wall_int_pos.X; - if (wal.wall_int_pos.X > maxx) maxx = wal.wall_int_pos.X; - if (wal.wall_int_pos.Y < miny) miny = wal.wall_int_pos.Y; - if (wal.wall_int_pos.Y > maxy) maxy = wal.wall_int_pos.Y; + if (wal.wall_int_pos().X < minx) minx = wal.wall_int_pos().X; + if (wal.wall_int_pos().X > maxx) maxx = wal.wall_int_pos().X; + if (wal.wall_int_pos().Y < miny) miny = wal.wall_int_pos().Y; + if (wal.wall_int_pos().Y > maxy) maxy = wal.wall_int_pos().Y; } float scalex = float(width) / (maxx - minx); float scaley = float(height) / (maxy - miny); @@ -238,16 +238,16 @@ DEFINE_ACTION_FUNCTION(_UserMapMenu, DrawPreview) { if (wal.nextwall < 0) continue; auto point2 = &entry->walls[wal.point2]; - twod->AddLine(dcenterx + (wal.wall_int_pos.X - centerx) * scale, dcentery + (wal.wall_int_pos.Y - centery) * scale, - dcenterx + (point2->wall_int_pos.X - centerx) * scale, dcentery + (point2->wall_int_pos.Y - centery) * scale, + twod->AddLine(dcenterx + (wal.wall_int_pos().X - centerx) * scale, dcentery + (wal.wall_int_pos().Y - centery) * scale, + dcenterx + (point2->wall_int_pos().X - centerx) * scale, dcentery + (point2->wall_int_pos().Y - centery) * scale, -1, -1, INT_MAX, INT_MAX, 0xff808080); } for (auto& wal : entry->walls) { if (wal.nextwall >= 0) continue; auto point2 = &entry->walls[wal.point2]; - twod->AddLine(dcenterx + (wal.wall_int_pos.X - centerx) * scale, dcentery + (wal.wall_int_pos.Y - centery) * scale, - dcenterx + (point2->wall_int_pos.X - centerx) * scale, dcentery + (point2->wall_int_pos.Y - centery) * scale, + twod->AddLine(dcenterx + (wal.wall_int_pos().X - centerx) * scale, dcentery + (wal.wall_int_pos().Y - centery) * scale, + dcenterx + (point2->wall_int_pos().X - centerx) * scale, dcentery + (point2->wall_int_pos().Y - centery) * scale, -1, -1, INT_MAX, INT_MAX, 0xffffffff); } return 0; diff --git a/source/core/rendering/hw_sections.cpp b/source/core/rendering/hw_sections.cpp index 0d3ba35df..2d0673e47 100644 --- a/source/core/rendering/hw_sections.cpp +++ b/source/core/rendering/hw_sections.cpp @@ -190,7 +190,7 @@ int GetWindingOrder(TArray& poly) int i = 0; for (auto& index : poly) { - points[i++] = wall[index].wall_int_pos; + points[i++] = wall[index].wall_int_pos(); } StripLoop(points); if (points.Size() == 0) return 1; // Sector has no dimension. We must accept this as valid here. @@ -246,7 +246,7 @@ static void CollectLoops(TArray& sectors) { // quick check for the only known cause of this in proper maps: // RRRA E1L3 and SW $yamato have a wall duplicate where the duplicate's index is the original's + 1. These can just be deleted here and be ignored. - if (ww > 1 && wall[ww-1].wall_int_pos.X == wall[ww-2].wall_int_pos.X && wall[ww-1].wall_int_pos.Y == wall[ww-2].wall_int_pos.Y && wall[ww-1].point2 == wall[ww-2].point2 && wall[ww - 1].point2 == ww) + if (ww > 1 && wall[ww-1].wall_int_pos().X == wall[ww-2].wall_int_pos().X && wall[ww-1].wall_int_pos().Y == wall[ww-2].wall_int_pos().Y && wall[ww-1].point2 == wall[ww-2].point2 && wall[ww - 1].point2 == ww) { thisloop.Clear(); break; @@ -297,7 +297,7 @@ static void CollectLoops(TArray& sectors) static int insideLoop(int vertex, TArray& loop) { - auto pt = wall[vertex].wall_int_pos; + auto pt = wall[vertex].wall_int_pos(); for (int i = 0; i < 2; i++) { // to reliably detect walls where vertices lie directly on outer walls, we must test the wall's center as well. @@ -307,8 +307,8 @@ static int insideLoop(int vertex, TArray& loop) for (unsigned ii = 0; ii < loop.Size() - 1; ii++) { auto& wal = wall[loop[ii]]; - auto& pt1 = wal.wall_int_pos; - auto& pt2 = wal.point2Wall()->wall_int_pos; + const auto pt1 = wal.wall_int_pos(); + const auto pt2 = wal.point2Wall()->wall_int_pos(); if ((pt1.Y >pt.Y) != (pt2.Y > pt.Y)) // skip if both are on the same side. { diff --git a/source/core/rendering/hw_sections.h b/source/core/rendering/hw_sections.h index aec760d16..b89809d89 100644 --- a/source/core/rendering/hw_sections.h +++ b/source/core/rendering/hw_sections.h @@ -19,8 +19,8 @@ struct SectionLine int wall; int partner; - vec2_t v1() const { return ::wall[startpoint].wall_int_pos; } - vec2_t v2() const { return ::wall[endpoint].wall_int_pos; } + vec2_t v1() const { return ::wall[startpoint].wall_int_pos(); } + vec2_t v2() const { return ::wall[endpoint].wall_int_pos(); } walltype* wallp() const { return &::wall[wall]; } SectionLine* partnerLine() const; diff --git a/source/core/rendering/hw_vertexmap.cpp b/source/core/rendering/hw_vertexmap.cpp index 4004cc0d7..ee72e004f 100644 --- a/source/core/rendering/hw_vertexmap.cpp +++ b/source/core/rendering/hw_vertexmap.cpp @@ -162,7 +162,7 @@ void vertex_t::RecalcVertexHeights() { float heights[2]; - auto point = wall[masterwall].wall_int_pos; + auto point = wall[masterwall].wall_int_pos(); PlanesAtPoint(§or[sect], point.X, point.Y, &heights[0], &heights[1]); for(auto height : heights) { diff --git a/source/core/rendering/scene/hw_bunchdrawer.cpp b/source/core/rendering/scene/hw_bunchdrawer.cpp index 7126f51c2..4b7ab7f1d 100644 --- a/source/core/rendering/scene/hw_bunchdrawer.cpp +++ b/source/core/rendering/scene/hw_bunchdrawer.cpp @@ -72,7 +72,7 @@ void BunchDrawer::Init(HWDrawInfo *_di, Clipper* c, vec2_t& view, binangle a1, b for (auto& w : wall) { // Precalculate the clip angles to avoid doing this repeatedly during level traversal. - auto vv = w.wall_int_pos - view; + auto vv = w.wall_int_pos() - view; w.clipangle = bvectangbam(vv.X, vv.Y); } memset(sectionstartang.Data(), -1, sectionstartang.Size() * sizeof(sectionstartang[0])); @@ -168,11 +168,11 @@ bool BunchDrawer::CheckClip(walltype* wal, float* topclip, float* bottomclip) // Mirrors and horizons always block the view //if (linedef->special==Line_Mirror || linedef->special==Line_Horizon) return true; - PlanesAtPoint(frontsector, wal->wall_int_pos.X, wal->wall_int_pos.Y, &fs_ceilingheight1, &fs_floorheight1); - PlanesAtPoint(frontsector, pt2->wall_int_pos.X, pt2->wall_int_pos.Y, &fs_ceilingheight2, &fs_floorheight2); + PlanesAtPoint(frontsector, wal->wall_int_pos().X, wal->wall_int_pos().Y, &fs_ceilingheight1, &fs_floorheight1); + PlanesAtPoint(frontsector, pt2->wall_int_pos().X, pt2->wall_int_pos().Y, &fs_ceilingheight2, &fs_floorheight2); - PlanesAtPoint(backsector, wal->wall_int_pos.X, wal->wall_int_pos.Y, &bs_ceilingheight1, &bs_floorheight1); - PlanesAtPoint(backsector, pt2->wall_int_pos.X, pt2->wall_int_pos.Y, &bs_ceilingheight2, &bs_floorheight2); + PlanesAtPoint(backsector, wal->wall_int_pos().X, wal->wall_int_pos().Y, &bs_ceilingheight1, &bs_floorheight1); + PlanesAtPoint(backsector, pt2->wall_int_pos().X, pt2->wall_int_pos().Y, &bs_ceilingheight2, &bs_floorheight2); *bottomclip = max(min(bs_floorheight1, bs_floorheight2), min(fs_floorheight1, fs_floorheight2)); diff --git a/source/core/rendering/scene/hw_drawinfo.cpp b/source/core/rendering/scene/hw_drawinfo.cpp index 681e7b7ca..6cca0dfa0 100644 --- a/source/core/rendering/scene/hw_drawinfo.cpp +++ b/source/core/rendering/scene/hw_drawinfo.cpp @@ -415,8 +415,8 @@ void HWDrawInfo::CreateScene(bool portal) for (auto w = 0; w < sect->wallnum; w++) { auto wal = sect->firstWall() + w; - wal->wall_int_pos.X += eff.geox[i]; - wal->wall_int_pos.Y += eff.geoy[i]; + wal->__wall_int_pos.X += eff.geox[i]; + wal->__wall_int_pos.Y += eff.geoy[i]; } sect->dirty = EDirty::AllDirty; if (eff.geosector[i] == drawsectp) drawsectp = eff.geosectorwarp[i]; @@ -434,8 +434,8 @@ void HWDrawInfo::CreateScene(bool portal) for (auto w = 0; w < sect->wallnum; w++) { auto wal = sect->firstWall() + w; - wal->wall_int_pos.X -= eff.geox[i]; - wal->wall_int_pos.Y -= eff.geoy[i]; + wal->__wall_int_pos.X -= eff.geox[i]; + wal->__wall_int_pos.Y -= eff.geoy[i]; } } @@ -447,8 +447,8 @@ void HWDrawInfo::CreateScene(bool portal) for (auto w = 0; w < sect->wallnum; w++) { auto wal = sect->firstWall() + w; - wal->wall_int_pos.X += eff.geox2[i]; - wal->wall_int_pos.Y += eff.geoy2[i]; + wal->__wall_int_pos.X += eff.geox2[i]; + wal->__wall_int_pos.Y += eff.geoy2[i]; } sect->dirty = EDirty::AllDirty; if (eff.geosector[i] == orgdrawsectp) drawsectp = eff.geosectorwarp2[i]; @@ -465,8 +465,8 @@ void HWDrawInfo::CreateScene(bool portal) for (auto w = 0; w < sect->wallnum; w++) { auto wal = sect->firstWall() + w; - wal->wall_int_pos.X -= eff.geox2[i]; - wal->wall_int_pos.Y -= eff.geoy2[i]; + wal->__wall_int_pos.X -= eff.geox2[i]; + wal->__wall_int_pos.Y -= eff.geoy2[i]; } } ingeo = false; diff --git a/source/core/rendering/scene/hw_portal.cpp b/source/core/rendering/scene/hw_portal.cpp index 579053b61..67a35d887 100644 --- a/source/core/rendering/scene/hw_portal.cpp +++ b/source/core/rendering/scene/hw_portal.cpp @@ -524,10 +524,10 @@ bool HWMirrorPortal::Setup(HWDrawInfo *di, FRenderState &rstate, Clipper *clippe di->mClipPortal = this; - int x = line->wall_int_pos.X; - int y = line->wall_int_pos.Y; - int dx = line->point2Wall()->wall_int_pos.X - x; - int dy = line->point2Wall()->wall_int_pos.Y - y; + int x = line->wall_int_pos().X; + int y = line->wall_int_pos().Y; + int dx = line->point2Wall()->wall_int_pos().X - x; + int dy = line->point2Wall()->wall_int_pos().Y - y; // this can overflow so use 64 bit math. const int64_t j = int64_t(dx) * dx + int64_t(dy) * dy; @@ -565,8 +565,8 @@ bool HWMirrorPortal::Setup(HWDrawInfo *di, FRenderState &rstate, Clipper *clippe ClearClipper(di, clipper); - auto startan = bvectangbam(line->wall_int_pos.X - newx, line->wall_int_pos.Y - newy); - auto endan = bvectangbam(line->point2Wall()->wall_int_pos.X - newx, line->point2Wall()->wall_int_pos.Y - newy); + auto startan = bvectangbam(line->wall_int_pos().X - newx, line->wall_int_pos().Y - newy); + auto endan = bvectangbam(line->point2Wall()->wall_int_pos().X - newx, line->point2Wall()->wall_int_pos().Y - newy); clipper->RestrictVisibleRange(endan, startan); // we check the line from the backside so angles are reversed. return true; } @@ -635,8 +635,8 @@ bool HWLineToLinePortal::Setup(HWDrawInfo *di, FRenderState &rstate, Clipper *cl ClearClipper(di, clipper); - auto startan = bvectangbam(origin->wall_int_pos.X - origx, origin->wall_int_pos.Y - origy); - auto endan = bvectangbam(origin->point2Wall()->wall_int_pos.X - origx, origin->point2Wall()->wall_int_pos.Y - origy); + auto startan = bvectangbam(origin->wall_int_pos().X - origx, origin->wall_int_pos().Y - origy); + auto endan = bvectangbam(origin->point2Wall()->wall_int_pos().X - origx, origin->point2Wall()->wall_int_pos().Y - origy); clipper->RestrictVisibleRange(startan, endan); return true; } @@ -687,8 +687,8 @@ bool HWLineToSpritePortal::Setup(HWDrawInfo* di, FRenderState& rstate, Clipper* ClearClipper(di, clipper); - auto startan = bvectangbam(origin->wall_int_pos.X - origx, origin->wall_int_pos.Y - origy); - auto endan = bvectangbam(origin->point2Wall()->wall_int_pos.X - origx, origin->point2Wall()->wall_int_pos.Y - origy); + auto startan = bvectangbam(origin->wall_int_pos().X - origx, origin->wall_int_pos().Y - origy); + auto endan = bvectangbam(origin->point2Wall()->wall_int_pos().X - origx, origin->point2Wall()->wall_int_pos().Y - origy); clipper->RestrictVisibleRange(startan, endan); return true; } diff --git a/source/core/rendering/scene/hw_walls.cpp b/source/core/rendering/scene/hw_walls.cpp index ffac95063..ab5c0da6b 100644 --- a/source/core/rendering/scene/hw_walls.cpp +++ b/source/core/rendering/scene/hw_walls.cpp @@ -71,7 +71,7 @@ static walltype* IsOnWall(tspritetype* tspr, int height, DVector2& outpos) // In Wanton Destruction's airplane level there's such a sprite assigned to the wrong sector. if (d.X == 0) { - double newdist = fabs(tspr->pos.X - wal.wall_int_pos.X); + double newdist = fabs(tspr->pos.X - wal.wall_int_pos().X); if (newdist < maxorthdist) { maxorthdist = newdist; @@ -80,7 +80,7 @@ static walltype* IsOnWall(tspritetype* tspr, int height, DVector2& outpos) } else if (d.Y == 0) { - double newdist = fabs(tspr->pos.Y - wal.wall_int_pos.Y); + double newdist = fabs(tspr->pos.Y - wal.wall_int_pos().Y); if (newdist < maxorthdist) { maxorthdist = newdist; @@ -914,8 +914,8 @@ void HWWall::Process(HWDrawInfo* di, walltype* wal, sectortype* frontsector, sec FVector2 v1(WallStartX(wal), WallStartY(wal)); FVector2 v2(WallEndX(wal), WallEndY(wal)); - PlanesAtPoint(frontsector, wal->wall_int_pos.X, wal->wall_int_pos.Y, &fch1, &ffh1); - PlanesAtPoint(frontsector, p2wall->wall_int_pos.X, p2wall->wall_int_pos.Y, &fch2, &ffh2); + PlanesAtPoint(frontsector, wal->wall_int_pos().X, wal->wall_int_pos().Y, &fch1, &ffh1); + PlanesAtPoint(frontsector, p2wall->wall_int_pos().X, p2wall->wall_int_pos().Y, &fch2, &ffh2); #ifdef _DEBUG @@ -1008,8 +1008,8 @@ void HWWall::Process(HWDrawInfo* di, walltype* wal, sectortype* frontsector, sec float bfh2; float bch1; float bch2; - PlanesAtPoint(backsector, wal->wall_int_pos.X, wal->wall_int_pos.Y, &bch1, &bfh1); - PlanesAtPoint(backsector, p2wall->wall_int_pos.X, p2wall->wall_int_pos.Y, &bch2, &bfh2); + PlanesAtPoint(backsector, wal->wall_int_pos().X, wal->wall_int_pos().Y, &bch1, &bfh1); + PlanesAtPoint(backsector, p2wall->wall_int_pos().X, p2wall->wall_int_pos().Y, &bch2, &bfh2); SkyTop(di, wal, frontsector, backsector, v1, v2, fch1, fch2); SkyBottom(di, wal, frontsector, backsector, v1, v2, ffh1, ffh2); diff --git a/source/core/savegamehelp.cpp b/source/core/savegamehelp.cpp index 5edb9896e..6ec1c7c25 100644 --- a/source/core/savegamehelp.cpp +++ b/source/core/savegamehelp.cpp @@ -606,8 +606,8 @@ FSerializer &Serialize(FSerializer &arc, const char *key, walltype &c, walltype { if (arc.BeginObject(key)) { - arc("x", c.wall_int_pos.X, def->wall_int_pos.X) - ("y", c.wall_int_pos.Y, def->wall_int_pos.Y) + arc("x", c.__wall_int_pos.X, def->__wall_int_pos.X) + ("y", c.__wall_int_pos.Y, def->__wall_int_pos.Y) ("point2", c.point2, def->point2) ("nextwall", c.nextwall, def->nextwall) ("nextsector", c.nextsector, def->nextsector) diff --git a/source/core/sectorgeometry.cpp b/source/core/sectorgeometry.cpp index 942388d98..87369dcc8 100644 --- a/source/core/sectorgeometry.cpp +++ b/source/core/sectorgeometry.cpp @@ -63,8 +63,8 @@ static FVector3 CalcNormal(sectortype* sector, int plane) pt[0] = { (float)WallStartX(wal), 0.f, (float)WallStartY(wal)}; pt[1] = { (float)WallStartX(wal2), 0.f, (float)WallStartY(wal2)}; - PlanesAtPoint(sector, wal->wall_int_pos.X, wal->wall_int_pos.Y, plane ? &pt[0].Z : nullptr, plane? nullptr : &pt[0].Y); - PlanesAtPoint(sector, wal2->wall_int_pos.X, wal2->wall_int_pos.Y, plane ? &pt[1].Z : nullptr, plane ? nullptr : &pt[1].Y); + PlanesAtPoint(sector, wal->wall_int_pos().X, wal->wall_int_pos().Y, plane ? &pt[0].Z : nullptr, plane? nullptr : &pt[0].Y); + PlanesAtPoint(sector, wal2->wall_int_pos().X, wal2->wall_int_pos().Y, plane ? &pt[1].Z : nullptr, plane ? nullptr : &pt[1].Y); if (pt[0].X == pt[1].X) { @@ -118,10 +118,10 @@ public: offset = off; auto firstwall = sec->firstWall(); - ix1 = firstwall->wall_int_pos.X; - iy1 = firstwall->wall_int_pos.Y; - ix2 = firstwall->point2Wall()->wall_int_pos.X; - iy2 = firstwall->point2Wall()->wall_int_pos.Y; + ix1 = firstwall->wall_int_pos().X; + iy1 = firstwall->wall_int_pos().Y; + ix2 = firstwall->point2Wall()->wall_int_pos().X; + iy2 = firstwall->point2Wall()->wall_int_pos().Y; if (plane == 0) { @@ -363,8 +363,8 @@ bool SectionGeometry::ValidateSection(Section* section, int plane) ((sec->floorstat ^ compare->floorstat) & (CSTAT_SECTOR_ALIGN | CSTAT_SECTOR_YFLIP | CSTAT_SECTOR_XFLIP | CSTAT_SECTOR_TEXHALF | CSTAT_SECTOR_SWAPXY)) == 0 && sec->floorxpan_ == compare->floorxpan_ && sec->floorypan_ == compare->floorypan_ && - sec->firstWall()->wall_int_pos == sdata.poscompare[0] && - sec->firstWall()->point2Wall()->wall_int_pos == sdata.poscompare2[0] && + sec->firstWall()->wall_int_pos() == sdata.poscompare[0] && + sec->firstWall()->point2Wall()->wall_int_pos() == sdata.poscompare2[0] && !(section->dirty & EDirty::FloorDirty) && sdata.planes[plane].vertices.Size() ) return true; section->dirty &= ~EDirty::FloorDirty; @@ -376,15 +376,15 @@ bool SectionGeometry::ValidateSection(Section* section, int plane) ((sec->ceilingstat ^ compare->ceilingstat) & (CSTAT_SECTOR_ALIGN | CSTAT_SECTOR_YFLIP | CSTAT_SECTOR_XFLIP | CSTAT_SECTOR_TEXHALF | CSTAT_SECTOR_SWAPXY)) == 0 && sec->ceilingxpan_ == compare->ceilingxpan_ && sec->ceilingypan_ == compare->ceilingypan_ && - sec->firstWall()->wall_int_pos == sdata.poscompare[1] && - sec->firstWall()->point2Wall()->wall_int_pos == sdata.poscompare2[1] && + sec->firstWall()->wall_int_pos() == sdata.poscompare[1] && + sec->firstWall()->point2Wall()->wall_int_pos() == sdata.poscompare2[1] && !(section->dirty & EDirty::CeilingDirty) && sdata.planes[1].vertices.Size()) return true; section->dirty &= ~EDirty::CeilingDirty; } compare->copy(sec); - sdata.poscompare[plane] = sec->firstWall()->wall_int_pos; - sdata.poscompare2[plane] = sec->firstWall()->point2Wall()->wall_int_pos; + sdata.poscompare[plane] = sec->firstWall()->wall_int_pos(); + sdata.poscompare2[plane] = sec->firstWall()->point2Wall()->wall_int_pos(); return false; } diff --git a/source/games/blood/src/_polymost.cpp b/source/games/blood/src/_polymost.cpp index c64f6dd58..176ae15f0 100644 --- a/source/games/blood/src/_polymost.cpp +++ b/source/games/blood/src/_polymost.cpp @@ -220,21 +220,21 @@ void DrawMirrors(int x, int y, int z, fixed_t a, fixed_t horiz, int smooth, int pWall->nextsector = mirrorsector; wallarr[mirrorwall[0]].nextwall = nWall; wallarr[mirrorwall[0]].nextsector = nSector; - wallarr[mirrorwall[0]].wall_int_pos.X = pWall->point2Wall()->wall_int_pos.X; - wallarr[mirrorwall[0]].wall_int_pos.Y = pWall->point2Wall()->wall_int_pos.Y; - wallarr[mirrorwall[1]].wall_int_pos.X = pWall->wall_int_pos.X; - wallarr[mirrorwall[1]].wall_int_pos.Y = pWall->wall_int_pos.Y; - wallarr[mirrorwall[2]].wall_int_pos.X = wallarr[mirrorwall[1]].wall_int_pos.X + (wallarr[mirrorwall[1]].wall_int_pos.X - wallarr[mirrorwall[0]].wall_int_pos.X) * 16; - wallarr[mirrorwall[2]].wall_int_pos.Y = wallarr[mirrorwall[1]].wall_int_pos.Y + (wallarr[mirrorwall[1]].wall_int_pos.Y - wallarr[mirrorwall[0]].wall_int_pos.Y) * 16; - wallarr[mirrorwall[3]].wall_int_pos.X = wallarr[mirrorwall[0]].wall_int_pos.X + (wallarr[mirrorwall[0]].wall_int_pos.X - wallarr[mirrorwall[1]].wall_int_pos.X) * 16; - wallarr[mirrorwall[3]].wall_int_pos.Y = wallarr[mirrorwall[0]].wall_int_pos.Y + (wallarr[mirrorwall[0]].wall_int_pos.Y - wallarr[mirrorwall[1]].wall_int_pos.Y) * 16; + wallarr[mirrorwall[0]].__wall_int_pos.X = pWall->point2Wall()->wall_int_pos().X; + wallarr[mirrorwall[0]].__wall_int_pos.Y = pWall->point2Wall()->wall_int_pos().Y; + wallarr[mirrorwall[1]].__wall_int_pos.X = pWall->wall_int_pos().X; + wallarr[mirrorwall[1]].__wall_int_pos.Y = pWall->wall_int_pos().Y; + wallarr[mirrorwall[2]].__wall_int_pos.X = wallarr[mirrorwall[1]].wall_int_pos().X + (wallarr[mirrorwall[1]].wall_int_pos().X - wallarr[mirrorwall[0]].wall_int_pos().X) * 16; + wallarr[mirrorwall[2]].__wall_int_pos.Y = wallarr[mirrorwall[1]].wall_int_pos().Y + (wallarr[mirrorwall[1]].wall_int_pos().Y - wallarr[mirrorwall[0]].wall_int_pos().Y) * 16; + wallarr[mirrorwall[3]].__wall_int_pos.X = wallarr[mirrorwall[0]].wall_int_pos().X + (wallarr[mirrorwall[0]].wall_int_pos().X - wallarr[mirrorwall[1]].wall_int_pos().X) * 16; + wallarr[mirrorwall[3]].__wall_int_pos.Y = wallarr[mirrorwall[0]].wall_int_pos().Y + (wallarr[mirrorwall[0]].wall_int_pos().Y - wallarr[mirrorwall[1]].wall_int_pos().Y) * 16; sector.Data()[mirrorsector].setfloorz(sector[nSector].floorz, true); sector.Data()[mirrorsector].setceilingz(sector[nSector].ceilingz, true); int cx, cy, ca; if (pWall->type == kWallStack) { - cx = x - (wall[pWall->hitag].wall_int_pos.X - pWall->point2Wall()->wall_int_pos.X); - cy = y - (wall[pWall->hitag].wall_int_pos.Y - pWall->point2Wall()->wall_int_pos.Y); + cx = x - (wall[pWall->hitag].wall_int_pos().X - pWall->point2Wall()->wall_int_pos().X); + cy = y - (wall[pWall->hitag].wall_int_pos().Y - pWall->point2Wall()->wall_int_pos().Y); ca = a; } else diff --git a/source/games/blood/src/actor.cpp b/source/games/blood/src/actor.cpp index d28c2c955..3ad29a7e0 100644 --- a/source/games/blood/src/actor.cpp +++ b/source/games/blood/src/actor.cpp @@ -2616,7 +2616,7 @@ int actFloorBounceVector(int* x, int* y, int* z, sectortype* pSector, int a5) } walltype* pWall = pSector->firstWall(); walltype* pWall2 = pWall->point2Wall(); - int angle = getangle(pWall2->wall_int_pos.X - pWall->wall_int_pos.X, pWall2->wall_int_pos.Y - pWall->wall_int_pos.Y) + 512; + int angle = getangle(pWall2->wall_int_pos().X - pWall->wall_int_pos().X, pWall2->wall_int_pos().Y - pWall->wall_int_pos().Y) + 512; int t2 = pSector->floorheinum << 4; int t3 = approxDist(-0x10000, t2); int t4 = DivScale(-0x10000, t3, 16); diff --git a/source/games/blood/src/db.cpp b/source/games/blood/src/db.cpp index ffabeac15..b114476ac 100644 --- a/source/games/blood/src/db.cpp +++ b/source/games/blood/src/db.cpp @@ -392,8 +392,8 @@ void dbLoadMap(const char* pPath, int* pX, int* pY, int* pZ, short* pAngle, int* { dbCrypt((char*)&load, sizeof(walltypedisk), (gMapRev * sizeof(sectortypedisk)) | 0x7474614d); } - pWall->wall_int_pos.X = LittleLong(load.x); - pWall->wall_int_pos.Y = LittleLong(load.y); + pWall->__wall_int_pos.X = LittleLong(load.x); + pWall->__wall_int_pos.Y = LittleLong(load.y); pWall->point2 = LittleShort(load.point2); pWall->nextwall = LittleShort(load.nextwall); pWall->nextsector = LittleShort(load.nextsector); diff --git a/source/games/blood/src/gameutil.cpp b/source/games/blood/src/gameutil.cpp index 9cba799da..16dfda780 100644 --- a/source/games/blood/src/gameutil.cpp +++ b/source/games/blood/src/gameutil.cpp @@ -177,10 +177,10 @@ bool CheckProximityPoint(int nX1, int nY1, int nZ1, int nX2, int nY2, int nZ2, i bool CheckProximityWall(walltype* pWall, int x, int y, int nDist) { - int x1 = pWall->wall_int_pos.X; - int y1 = pWall->wall_int_pos.Y; - int x2 = pWall->point2Wall()->wall_int_pos.X; - int y2 = pWall->point2Wall()->wall_int_pos.Y; + int x1 = pWall->wall_int_pos().X; + int y1 = pWall->wall_int_pos().Y; + int x2 = pWall->point2Wall()->wall_int_pos().X; + int y2 = pWall->point2Wall()->wall_int_pos().Y; nDist <<= 4; if (x1 < x2) { @@ -539,12 +539,12 @@ int VectorScan(DBloodActor* actor, int nOffset, int nZOffset, int dx, int dy, in nOfs = (nOfs * pWall->yrepeat) / 8; nOfs += int((nSizY * pWall->ypan_) / 256); - int nLength = approxDist(pWall->wall_int_pos.X - pWall->point2Wall()->wall_int_pos.X, pWall->wall_int_pos.Y - pWall->point2Wall()->wall_int_pos.Y); + int nLength = approxDist(pWall->wall_int_pos().X - pWall->point2Wall()->wall_int_pos().X, pWall->wall_int_pos().Y - pWall->point2Wall()->wall_int_pos().Y); int nHOffset; if (pWall->cstat & CSTAT_WALL_XFLIP) - nHOffset = approxDist(gHitInfo.hitpos.X - pWall->point2Wall()->wall_int_pos.X, gHitInfo.hitpos.Y - pWall->point2Wall()->wall_int_pos.Y); + nHOffset = approxDist(gHitInfo.hitpos.X - pWall->point2Wall()->wall_int_pos().X, gHitInfo.hitpos.Y - pWall->point2Wall()->wall_int_pos().Y); else - nHOffset = approxDist(gHitInfo.hitpos.X - pWall->wall_int_pos.X, gHitInfo.hitpos.Y - pWall->wall_int_pos.Y); + nHOffset = approxDist(gHitInfo.hitpos.X - pWall->wall_int_pos().X, gHitInfo.hitpos.Y - pWall->wall_int_pos().Y); nHOffset = pWall->xpan() + ((nHOffset * pWall->xrepeat) << 3) / nLength; nHOffset %= nSizX; diff --git a/source/games/blood/src/gib.cpp b/source/games/blood/src/gib.cpp index 13987cf10..b42564d4b 100644 --- a/source/games/blood/src/gib.cpp +++ b/source/games/blood/src/gib.cpp @@ -457,7 +457,7 @@ void GibFX(walltype* pWall, GIBFX* pGFX, int a3, int a4, int a5, int a6, CGibVel int r1 = Random(a6); int r2 = Random(a5); int r3 = Random(a4); - auto pGib = gFX.fxSpawnActor(pGFX->fxId, pSector, pWall->wall_int_pos.X + r3, pWall->wall_int_pos.Y + r2, a3 + r1, 0); + auto pGib = gFX.fxSpawnActor(pGFX->fxId, pSector, pWall->wall_int_pos().X + r3, pWall->wall_int_pos().Y + r2, a3 + r1, 0); if (pGib) { if (pGFX->at1 < 0) @@ -490,8 +490,8 @@ void GibWall(walltype* pWall, GIBTYPE nGibType, CGibVelocity* pVel) assert(nGibType >= 0 && nGibType < kGibMax); int cx, cy, cz, wx, wy, wz; - cx = (pWall->wall_int_pos.X + pWall->point2Wall()->wall_int_pos.X) >> 1; - cy = (pWall->wall_int_pos.Y + pWall->point2Wall()->wall_int_pos.Y) >> 1; + cx = (pWall->wall_int_pos().X + pWall->point2Wall()->wall_int_pos().X) >> 1; + cy = (pWall->wall_int_pos().Y + pWall->point2Wall()->wall_int_pos().Y) >> 1; auto pSector = pWall->sectorp(); int32_t ceilZ, floorZ; getzsofslopeptr(pSector, cx, cy, &ceilZ, &floorZ); @@ -501,8 +501,8 @@ void GibWall(walltype* pWall, GIBTYPE nGibType, CGibVelocity* pVel) ceilZ = ClipLow(ceilZ, ceilZ2); floorZ = ClipHigh(floorZ, floorZ2); wz = floorZ - ceilZ; - wx = pWall->point2Wall()->wall_int_pos.X - pWall->wall_int_pos.X; - wy = pWall->point2Wall()->wall_int_pos.Y - pWall->wall_int_pos.Y; + wx = pWall->point2Wall()->wall_int_pos().X - pWall->wall_int_pos().X; + wy = pWall->point2Wall()->wall_int_pos().Y - pWall->wall_int_pos().Y; cz = (ceilZ + floorZ) >> 1; GIBLIST* pGib = &gibList[nGibType]; diff --git a/source/games/blood/src/nnexts.cpp b/source/games/blood/src/nnexts.cpp index 54939e960..57ff01ee0 100644 --- a/source/games/blood/src/nnexts.cpp +++ b/source/games/blood/src/nnexts.cpp @@ -3479,8 +3479,8 @@ void useSeqSpawnerGen(DBloodActor* sourceactor, int objType, sectortype* pSector if (sourceactor->xspr.data4 > 0) { int cx, cy, cz; - cx = (pWall->wall_int_pos.X + pWall->point2Wall()->wall_int_pos.X) >> 1; - cy = (pWall->wall_int_pos.Y + pWall->point2Wall()->wall_int_pos.Y) >> 1; + cx = (pWall->wall_int_pos().X + pWall->point2Wall()->wall_int_pos().X) >> 1; + cy = (pWall->wall_int_pos().Y + pWall->point2Wall()->wall_int_pos().Y) >> 1; auto pMySector = pWall->sectorp(); int32_t ceilZ, floorZ; getzsofslopeptr(pSector, cx, cy, &ceilZ, &floorZ); diff --git a/source/games/blood/src/triggers.cpp b/source/games/blood/src/triggers.cpp index 6136d0dba..cdae92be5 100644 --- a/source/games/blood/src/triggers.cpp +++ b/source/games/blood/src/triggers.cpp @@ -2096,8 +2096,8 @@ void AlignSlopes(void) { auto pNextSector = pWall->nextSector(); - int x = (pWall->wall_int_pos.X + pWall2->wall_int_pos.X) / 2; - int y = (pWall->wall_int_pos.Y + pWall2->wall_int_pos.Y) / 2; + int x = (pWall->wall_int_pos().X + pWall2->wall_int_pos().X) / 2; + int y = (pWall->wall_int_pos().Y + pWall2->wall_int_pos().Y) / 2; viewInterpolateSector(§); alignflorslope(§, x, y, getflorzofslopeptr(pNextSector, x, y)); alignceilslope(§, x, y, getceilzofslopeptr(pNextSector, x, y)); @@ -2172,8 +2172,8 @@ void trInit(TArray& actors) gBusy.Clear(); for (auto& wal : wall) { - wal.baseWall.X = wal.wall_int_pos.X; - wal.baseWall.Y = wal.wall_int_pos.Y; + wal.baseWall.X = wal.wall_int_pos().X; + wal.baseWall.Y = wal.wall_int_pos().Y; } for (auto actor : actors) { @@ -2224,8 +2224,8 @@ void trInit(TArray& actors) TranslateSector(pSector, 0, -65536, marker0->spr.pos.X, marker0->spr.pos.Y, marker0->spr.pos.X, marker0->spr.pos.Y, marker0->spr.ang, marker1->spr.pos.X, marker1->spr.pos.Y, marker1->spr.ang, pSector->type == kSectorSlide); for (auto& wal : wallsofsector(pSector)) { - wal.baseWall.X = wal.wall_int_pos.X; - wal.baseWall.Y = wal.wall_int_pos.Y; + wal.baseWall.X = wal.wall_int_pos().X; + wal.baseWall.Y = wal.wall_int_pos().Y; } BloodSectIterator it(pSector); while (auto actor = it.Next()) @@ -2243,8 +2243,8 @@ void trInit(TArray& actors) TranslateSector(pSector, 0, -65536, marker0->spr.pos.X, marker0->spr.pos.Y, marker0->spr.pos.X, marker0->spr.pos.Y, 0, marker0->spr.pos.X, marker0->spr.pos.Y, marker0->spr.ang, pSector->type == kSectorRotate); for (auto& wal : wallsofsector(pSector)) { - wal.baseWall.X = wal.wall_int_pos.X; - wal.baseWall.Y = wal.wall_int_pos.Y; + wal.baseWall.X = wal.wall_int_pos().X; + wal.baseWall.Y = wal.wall_int_pos().Y; } BloodSectIterator it(pSector); while (auto actor = it.Next()) diff --git a/source/games/duke/src/_polymost.cpp b/source/games/duke/src/_polymost.cpp index 13b5c32af..49fd7c23f 100644 --- a/source/games/duke/src/_polymost.cpp +++ b/source/games/duke/src/_polymost.cpp @@ -164,7 +164,7 @@ void renderMirror(int cposx, int cposy, int cposz, binangle cang, fixedhoriz cho int dst = 0x7fffffff, i = 0; for (int k = 0; k < mirrorcnt; k++) { - int j = abs(mirrorwall[k]->wall_int_pos.X - cposx) + abs(mirrorwall[k]->wall_int_pos.Y - cposy); + int j = abs(mirrorwall[k]->wall_int_pos().X - cposx) + abs(mirrorwall[k]->wall_int_pos().Y - cposy); if (j < dst) dst = j, i = k; } diff --git a/source/games/duke/src/actors.cpp b/source/games/duke/src/actors.cpp index d30c83a9d..56790d9c5 100644 --- a/source/games/duke/src/actors.cpp +++ b/source/games/duke/src/actors.cpp @@ -4189,8 +4189,8 @@ void handle_se20(DDukeActor* actor) } auto& wal = actor->temp_walls; - dragpoint(wal[0], wal[0]->wall_int_pos.X + x, wal[0]->wall_int_pos.Y + l); - dragpoint(wal[1], wal[1]->wall_int_pos.X + x, wal[1]->wall_int_pos.Y + l); + dragpoint(wal[0], wal[0]->wall_int_pos().X + x, wal[0]->wall_int_pos().Y + l); + dragpoint(wal[1], wal[1]->wall_int_pos().X + x, wal[1]->wall_int_pos().Y + l); for (int p = connecthead; p >= 0; p = connectpoint2[p]) if (ps[p].cursector == actor->sector() && ps[p].on_ground) diff --git a/source/games/duke/src/actors_d.cpp b/source/games/duke/src/actors_d.cpp index 7a67311c6..9eed86053 100644 --- a/source/games/duke/src/actors_d.cpp +++ b/source/games/duke/src/actors_d.cpp @@ -270,13 +270,13 @@ void hitradius_d(DDukeActor* actor, int r, int hp1, int hp2, int hp3, int h if (((dasectp->ceilingz - actor->spr.pos.Z) >> 8) < r) { auto wal = dasectp->firstWall(); - int d = abs(wal->wall_int_pos.X - actor->spr.pos.X) + abs(wal->wall_int_pos.Y - actor->spr.pos.Y); + int d = abs(wal->wall_int_pos().X - actor->spr.pos.X) + abs(wal->wall_int_pos().Y - actor->spr.pos.Y); if (d < r) fi.checkhitceiling(dasectp); else { auto thirdpoint = wal->point2Wall()->point2Wall(); - d = abs(thirdpoint->wall_int_pos.X - actor->spr.pos.X) + abs(thirdpoint->wall_int_pos.Y - actor->spr.pos.Y); + d = abs(thirdpoint->wall_int_pos().X - actor->spr.pos.X) + abs(thirdpoint->wall_int_pos().Y - actor->spr.pos.Y); if (d < r) fi.checkhitceiling(dasectp); } @@ -284,18 +284,18 @@ void hitradius_d(DDukeActor* actor, int r, int hp1, int hp2, int hp3, int h for (auto& wal : wallsofsector(dasectp)) { - if ((abs(wal.wall_int_pos.X - actor->spr.pos.X) + abs(wal.wall_int_pos.Y - actor->spr.pos.Y)) < r) + if ((abs(wal.wall_int_pos().X - actor->spr.pos.X) + abs(wal.wall_int_pos().Y - actor->spr.pos.Y)) < r) { if (wal.twoSided()) { search.Add(wal.nextSector()); } - int x1 = (((wal.wall_int_pos.X + wal.point2Wall()->wall_int_pos.X) >> 1) + actor->spr.pos.X) >> 1; - int y1 = (((wal.wall_int_pos.Y + wal.point2Wall()->wall_int_pos.Y) >> 1) + actor->spr.pos.Y) >> 1; + int x1 = (((wal.wall_int_pos().X + wal.point2Wall()->wall_int_pos().X) >> 1) + actor->spr.pos.X) >> 1; + int y1 = (((wal.wall_int_pos().Y + wal.point2Wall()->wall_int_pos().Y) >> 1) + actor->spr.pos.Y) >> 1; sectortype* sect = wal.sectorp(); updatesector(x1, y1, §); if (sect && cansee(x1, y1, actor->spr.pos.Z, sect, actor->spr.pos.X, actor->spr.pos.Y, actor->spr.pos.Z, actor->sector())) - fi.checkhitwall(actor, &wal, wal.wall_int_pos.X, wal.wall_int_pos.Y, actor->spr.pos.Z, actor->spr.picnum); + fi.checkhitwall(actor, &wal, wal.wall_int_pos().X, wal.wall_int_pos().Y, actor->spr.pos.Z, actor->spr.picnum); } } } @@ -3502,7 +3502,7 @@ void moveeffectors_d(void) //STATNUM 3 auto sc = act->sector(); if (sc->wallnum != 4) continue; auto wal = sc->firstWall() + 2; - alignflorslope(act->sector(), wal->wall_int_pos.X, wal->wall_int_pos.Y, wal->nextSector()->floorz); + alignflorslope(act->sector(), wal->wall_int_pos().X, wal->wall_int_pos().Y, wal->nextSector()->floorz); } } diff --git a/source/games/duke/src/actors_lava.cpp b/source/games/duke/src/actors_lava.cpp index 8e75134d6..aef18da1b 100644 --- a/source/games/duke/src/actors_lava.cpp +++ b/source/games/duke/src/actors_lava.cpp @@ -287,8 +287,8 @@ void dojaildoor(void) { for (auto& wal : wallsofsector(sectp)) { - int x = wal.wall_int_pos.X; - int y = wal.wall_int_pos.Y; + int x = wal.wall_int_pos().X; + int y = wal.wall_int_pos().Y; switch (jaildoordir[i]) { case 10: @@ -339,24 +339,24 @@ void dojaildoor(void) switch (jaildoordir[i]) { default: // make case of bad parameters well defined. - x = wal.wall_int_pos.X; - y = wal.wall_int_pos.Y; + x = wal.wall_int_pos().X; + y = wal.wall_int_pos().Y; break; case 10: - x = wal.wall_int_pos.X; - y = wal.wall_int_pos.Y + speed; + x = wal.wall_int_pos().X; + y = wal.wall_int_pos().Y + speed; break; case 20: - x = wal.wall_int_pos.X - speed; - y = wal.wall_int_pos.Y; + x = wal.wall_int_pos().X - speed; + y = wal.wall_int_pos().Y; break; case 30: - x = wal.wall_int_pos.X; - y = wal.wall_int_pos.Y - speed; + x = wal.wall_int_pos().X; + y = wal.wall_int_pos().Y - speed; break; case 40: - x = wal.wall_int_pos.X + speed; - y = wal.wall_int_pos.Y; + x = wal.wall_int_pos().X + speed; + y = wal.wall_int_pos().Y; break; } dragpoint(&wal, x, y); @@ -421,24 +421,24 @@ void moveminecart(void) switch (minecartdir[i]) { default: // make case of bad parameters well defined. - x = wal.wall_int_pos.X; - y = wal.wall_int_pos.Y; + x = wal.wall_int_pos().X; + y = wal.wall_int_pos().Y; break; case 10: - x = wal.wall_int_pos.X; - y = wal.wall_int_pos.Y + speed; + x = wal.wall_int_pos().X; + y = wal.wall_int_pos().Y + speed; break; case 20: - x = wal.wall_int_pos.X - speed; - y = wal.wall_int_pos.Y; + x = wal.wall_int_pos().X - speed; + y = wal.wall_int_pos().Y; break; case 30: - x = wal.wall_int_pos.X; - y = wal.wall_int_pos.Y - speed; + x = wal.wall_int_pos().X; + y = wal.wall_int_pos().Y - speed; break; case 40: - x = wal.wall_int_pos.X + speed; - y = wal.wall_int_pos.Y; + x = wal.wall_int_pos().X + speed; + y = wal.wall_int_pos().Y; break; } dragpoint(&wal, x, y); @@ -475,24 +475,24 @@ void moveminecart(void) switch (minecartdir[i]) { default: // make case of bad parameters well defined. - x = wal.wall_int_pos.X; - y = wal.wall_int_pos.Y; + x = wal.wall_int_pos().X; + y = wal.wall_int_pos().Y; break; case 10: - x = wal.wall_int_pos.X; - y = wal.wall_int_pos.Y + speed; + x = wal.wall_int_pos().X; + y = wal.wall_int_pos().Y + speed; break; case 20: - x = wal.wall_int_pos.X - speed; - y = wal.wall_int_pos.Y; + x = wal.wall_int_pos().X - speed; + y = wal.wall_int_pos().Y; break; case 30: - x = wal.wall_int_pos.X; - y = wal.wall_int_pos.Y - speed; + x = wal.wall_int_pos().X; + y = wal.wall_int_pos().Y - speed; break; case 40: - x = wal.wall_int_pos.X + speed; - y = wal.wall_int_pos.Y; + x = wal.wall_int_pos().X + speed; + y = wal.wall_int_pos().Y; break; } dragpoint(&wal, x, y); @@ -504,8 +504,8 @@ void moveminecart(void) min_x = min_y = 0x20000; for (auto& wal : wallsofsector(csect)) { - x = wal.wall_int_pos.X; - y = wal.wall_int_pos.Y; + x = wal.wall_int_pos().X; + y = wal.wall_int_pos().Y; if (x > max_x) max_x = x; if (y > max_y) diff --git a/source/games/duke/src/actors_r.cpp b/source/games/duke/src/actors_r.cpp index c0c938687..b34556c05 100644 --- a/source/games/duke/src/actors_r.cpp +++ b/source/games/duke/src/actors_r.cpp @@ -228,13 +228,13 @@ void hitradius_r(DDukeActor* actor, int r, int hp1, int hp2, int hp3, int h if (((dasectp->ceilingz - actor->spr.pos.Z) >> 8) < r) { auto wal = dasectp->firstWall(); - int d = abs(wal->wall_int_pos.X - actor->spr.pos.X) + abs(wal->wall_int_pos.Y - actor->spr.pos.Y); + int d = abs(wal->wall_int_pos().X - actor->spr.pos.X) + abs(wal->wall_int_pos().Y - actor->spr.pos.Y); if (d < r) fi.checkhitceiling(dasectp); else { auto thirdpoint = wal->point2Wall()->point2Wall(); - d = abs(thirdpoint->wall_int_pos.X - actor->spr.pos.X) + abs(thirdpoint->wall_int_pos.Y - actor->spr.pos.Y); + d = abs(thirdpoint->wall_int_pos().X - actor->spr.pos.X) + abs(thirdpoint->wall_int_pos().Y - actor->spr.pos.Y); if (d < r) fi.checkhitceiling(dasectp); } @@ -242,18 +242,18 @@ void hitradius_r(DDukeActor* actor, int r, int hp1, int hp2, int hp3, int h for (auto& wal : wallsofsector(dasectp)) { - if ((abs(wal.wall_int_pos.X - actor->spr.pos.X) + abs(wal.wall_int_pos.Y - actor->spr.pos.Y)) < r) + if ((abs(wal.wall_int_pos().X - actor->spr.pos.X) + abs(wal.wall_int_pos().Y - actor->spr.pos.Y)) < r) { if (wal.twoSided()) { search.Add(wal.nextSector()); } - int x1 = (((wal.wall_int_pos.X + wal.point2Wall()->wall_int_pos.X) >> 1) + actor->spr.pos.X) >> 1; - int y1 = (((wal.wall_int_pos.Y + wal.point2Wall()->wall_int_pos.Y) >> 1) + actor->spr.pos.Y) >> 1; + int x1 = (((wal.wall_int_pos().X + wal.point2Wall()->wall_int_pos().X) >> 1) + actor->spr.pos.X) >> 1; + int y1 = (((wal.wall_int_pos().Y + wal.point2Wall()->wall_int_pos().Y) >> 1) + actor->spr.pos.Y) >> 1; auto sect = wal.sectorp(); updatesector(x1, y1, §); if (sect != nullptr && cansee(x1, y1, actor->spr.pos.Z, sect, actor->spr.pos.X, actor->spr.pos.Y, actor->spr.pos.Z, actor->sector())) - fi.checkhitwall(actor, &wal, wal.wall_int_pos.X, wal.wall_int_pos.Y, actor->spr.pos.Z, actor->spr.picnum); + fi.checkhitwall(actor, &wal, wal.wall_int_pos().X, wal.wall_int_pos().Y, actor->spr.pos.Z, actor->spr.picnum); } } } @@ -3456,7 +3456,7 @@ void moveeffectors_r(void) //STATNUM 3 auto sc = act->sector(); if (sc->wallnum != 4) continue; auto wal = sc->firstWall() + 2; - alignflorslope(act->sector(), wal->wall_int_pos.X, wal->wall_int_pos.Y, wal->nextSector()->floorz); + alignflorslope(act->sector(), wal->wall_int_pos().X, wal->wall_int_pos().Y, wal->nextSector()->floorz); } } diff --git a/source/games/duke/src/gameexec.cpp b/source/games/duke/src/gameexec.cpp index e86a8e1f5..d589830c3 100644 --- a/source/games/duke/src/gameexec.cpp +++ b/source/games/duke/src/gameexec.cpp @@ -964,10 +964,10 @@ void DoWall(bool bSet, int lVar1, int lLabelID, int lVar2, DDukeActor* sActor, i switch (lLabelID) { case WALL_X: - if (!bSet) SetGameVarID(lVar2, wallp->wall_int_pos.X, sActor, sPlayer); + if (!bSet) SetGameVarID(lVar2, wallp->wall_int_pos().X, sActor, sPlayer); break; case WALL_Y: - if (bSet) SetGameVarID(lVar2, wallp->wall_int_pos.Y, sActor, sPlayer); + if (bSet) SetGameVarID(lVar2, wallp->wall_int_pos().Y, sActor, sPlayer); break; case WALL_POINT2: if (!bSet) SetGameVarID(lVar2, wallp->point2, sActor, sPlayer); diff --git a/source/games/duke/src/premap.cpp b/source/games/duke/src/premap.cpp index 6e3a3f2d6..12bdb0cd3 100644 --- a/source/games/duke/src/premap.cpp +++ b/source/games/duke/src/premap.cpp @@ -715,8 +715,8 @@ void prelevel_common(int g) if (sectp->lotag == -1) { - ps[0].exit.X = sectp->firstWall()->wall_int_pos.X; - ps[0].exit.Y = sectp->firstWall()->wall_int_pos.Y; + ps[0].exit.X = sectp->firstWall()->wall_int_pos().X; + ps[0].exit.Y = sectp->firstWall()->wall_int_pos().Y; continue; } } diff --git a/source/games/duke/src/sectors.cpp b/source/games/duke/src/sectors.cpp index 774043848..8a6c6e917 100644 --- a/source/games/duke/src/sectors.cpp +++ b/source/games/duke/src/sectors.cpp @@ -288,10 +288,10 @@ int* animateptr(int type, int index, bool write) return sector[index].ceilingzptr(!write); case anim_vertexx: if (write) wall[index].moved(); - return &wall[index].wall_int_pos.X; + return &wall[index].__wall_int_pos.X; case anim_vertexy: if (write) wall[index].moved(); - return &wall[index].wall_int_pos.Y; + return &wall[index].__wall_int_pos.Y; default: assert(false); return &scratch; @@ -506,8 +506,8 @@ static void handle_st09(sectortype* sptr, DDukeActor* actor) dax = 0L, day = 0L; for (auto& wal : wallsofsector(sptr)) { - dax += wal.wall_int_pos.X; - day += wal.wall_int_pos.Y; + dax += wal.wall_int_pos().X; + day += wal.wall_int_pos().Y; } dax /= sptr->wallnum; day /= sptr->wallnum; @@ -517,7 +517,7 @@ static void handle_st09(sectortype* sptr, DDukeActor* actor) wallfind[0] = nullptr; wallfind[1] = nullptr; for (auto& wal : wallsofsector(sptr)) - if ((wal.wall_int_pos.X == dax) || (wal.wall_int_pos.Y == day)) + if ((wal.wall_int_pos().X == dax) || (wal.wall_int_pos().Y == day)) { if (wallfind[0] == nullptr) wallfind[0] = &wal; @@ -533,33 +533,33 @@ static void handle_st09(sectortype* sptr, DDukeActor* actor) auto prevwall = wal - 1; if (prevwall < sptr->firstWall()) prevwall += sptr->wallnum; - if ((wal->wall_int_pos.X == dax) && (wal->wall_int_pos.Y == day)) + if ((wal->wall_int_pos().X == dax) && (wal->wall_int_pos().Y == day)) { - dax2 = ((prevwall->wall_int_pos.X + wal->point2Wall()->wall_int_pos.X) >> 1) - wal->wall_int_pos.X; - day2 = ((prevwall->wall_int_pos.Y + wal->point2Wall()->wall_int_pos.Y) >> 1) - wal->wall_int_pos.Y; + dax2 = ((prevwall->wall_int_pos().X + wal->point2Wall()->wall_int_pos().X) >> 1) - wal->wall_int_pos().X; + day2 = ((prevwall->wall_int_pos().Y + wal->point2Wall()->wall_int_pos().Y) >> 1) - wal->wall_int_pos().Y; if (dax2 != 0) { - dax2 = wal->point2Wall()->point2Wall()->wall_int_pos.X; - dax2 -= wal->point2Wall()->wall_int_pos.X; - setanimation(sptr, anim_vertexx, wal, wal->wall_int_pos.X + dax2, sp); - setanimation(sptr, anim_vertexx, prevwall, prevwall->wall_int_pos.X + dax2, sp); - setanimation(sptr, anim_vertexx, wal->point2Wall(), wal->point2Wall()->wall_int_pos.X + dax2, sp); + dax2 = wal->point2Wall()->point2Wall()->wall_int_pos().X; + dax2 -= wal->point2Wall()->wall_int_pos().X; + setanimation(sptr, anim_vertexx, wal, wal->wall_int_pos().X + dax2, sp); + setanimation(sptr, anim_vertexx, prevwall, prevwall->wall_int_pos().X + dax2, sp); + setanimation(sptr, anim_vertexx, wal->point2Wall(), wal->point2Wall()->wall_int_pos().X + dax2, sp); callsound(sptr, actor); } else if (day2 != 0) { - day2 = wal->point2Wall()->point2Wall()->wall_int_pos.Y; - day2 -= wal->point2Wall()->wall_int_pos.Y; - setanimation(sptr, anim_vertexy, wal, wal->wall_int_pos.Y + day2, sp); - setanimation(sptr, anim_vertexy, prevwall, prevwall->wall_int_pos.Y + day2, sp); - setanimation(sptr, anim_vertexy, wal->point2Wall(), wal->point2Wall()->wall_int_pos.Y + day2, sp); + day2 = wal->point2Wall()->point2Wall()->wall_int_pos().Y; + day2 -= wal->point2Wall()->wall_int_pos().Y; + setanimation(sptr, anim_vertexy, wal, wal->wall_int_pos().Y + day2, sp); + setanimation(sptr, anim_vertexy, prevwall, prevwall->wall_int_pos().Y + day2, sp); + setanimation(sptr, anim_vertexy, wal->point2Wall(), wal->point2Wall()->wall_int_pos().Y + day2, sp); callsound(sptr, actor); } } else { - dax2 = ((prevwall->wall_int_pos.X + wal->point2Wall()->wall_int_pos.X) >> 1) - wal->wall_int_pos.X; - day2 = ((prevwall->wall_int_pos.Y + wal->point2Wall()->wall_int_pos.Y) >> 1) - wal->wall_int_pos.Y; + dax2 = ((prevwall->wall_int_pos().X + wal->point2Wall()->wall_int_pos().X) >> 1) - wal->wall_int_pos().X; + day2 = ((prevwall->wall_int_pos().Y + wal->point2Wall()->wall_int_pos().Y) >> 1) - wal->wall_int_pos().Y; if (dax2 != 0) { setanimation(sptr, anim_vertexx, wal, dax, sp); @@ -974,8 +974,8 @@ void operatesectors(sectortype* sptr, DDukeActor *actor) if (!isRR()) break; for (auto& wal : wallsofsector(sptr)) { - setanimation(sptr, anim_vertexx, &wal, wal.wall_int_pos.X + 1024, 4); - if (wal.twoSided()) setanimation(sptr, anim_vertexx, wal.nextWall(), wal.nextWall()->wall_int_pos.X + 1024, 4); + setanimation(sptr, anim_vertexx, &wal, wal.wall_int_pos().X + 1024, 4); + if (wal.twoSided()) setanimation(sptr, anim_vertexx, wal.nextWall(), wal.nextWall()->wall_int_pos().X + 1024, 4); } break; diff --git a/source/games/duke/src/sectors_d.cpp b/source/games/duke/src/sectors_d.cpp index e42ad7761..916443e19 100644 --- a/source/games/duke/src/sectors_d.cpp +++ b/source/games/duke/src/sectors_d.cpp @@ -250,8 +250,8 @@ bool checkhitswitch_d(int snum, walltype* wwal, DDukeActor *act) lotag = wwal->lotag; if (lotag == 0) return 0; hitag = wwal->hitag; - sx = wwal->wall_int_pos.X; - sy = wwal->wall_int_pos.Y; + sx = wwal->wall_int_pos().X; + sy = wwal->wall_int_pos().Y; picnum = wwal->picnum; switchpal = wwal->pal; } diff --git a/source/games/duke/src/sectors_r.cpp b/source/games/duke/src/sectors_r.cpp index d17069196..8f6ba8191 100644 --- a/source/games/duke/src/sectors_r.cpp +++ b/source/games/duke/src/sectors_r.cpp @@ -369,8 +369,8 @@ bool checkhitswitch_r(int snum, walltype* wwal, DDukeActor* act) lotag = wwal->lotag; if (lotag == 0) return 0; hitag = wwal->hitag; - sx = wwal->wall_int_pos.X; - sy = wwal->wall_int_pos.Y; + sx = wwal->wall_int_pos().X; + sy = wwal->wall_int_pos().Y; picnum = wwal->picnum; switchpal = wwal->pal; } @@ -946,8 +946,8 @@ static void lotsofpopcorn(DDukeActor *actor, walltype* wal, int n) j = n + 1; - int x1 = wal->wall_int_pos.X; - int y1 = wal->wall_int_pos.Y; + int x1 = wal->wall_int_pos().X; + int y1 = wal->wall_int_pos().Y; auto delta = wal->delta(); @@ -2778,8 +2778,8 @@ void dofurniture(walltype* wlwal, sectortype* sectp, int snum) var_cx = 4; for(auto& wal : wallsofsector(nextsect)) { - x = wal.wall_int_pos.X; - y = wal.wall_int_pos.Y; + x = wal.wall_int_pos().X; + y = wal.wall_int_pos().Y; if (x > max_x) max_x = x; if (y > max_y) @@ -2828,24 +2828,24 @@ void dofurniture(walltype* wlwal, sectortype* sectp, int snum) S_PlayActorSound(389, ps[snum].GetActor()); for(auto& wal : wallsofsector(nextsect)) { - x = wal.wall_int_pos.X; - y = wal.wall_int_pos.Y; + x = wal.wall_int_pos().X; + y = wal.wall_int_pos().Y; switch (wlwal->lotag) { case 42: - y = wal.wall_int_pos.Y + var_cx; + y = wal.wall_int_pos().Y + var_cx; dragpoint(&wal, x, y); break; case 41: - x = wal.wall_int_pos.X - var_cx; + x = wal.wall_int_pos().X - var_cx; dragpoint(&wal, x, y); break; case 40: - y = wal.wall_int_pos.Y - var_cx; + y = wal.wall_int_pos().Y - var_cx; dragpoint(&wal, x, y); break; case 43: - x = wal.wall_int_pos.X + var_cx; + x = wal.wall_int_pos().X + var_cx; dragpoint(&wal, x, y); break; } @@ -2855,24 +2855,24 @@ void dofurniture(walltype* wlwal, sectortype* sectp, int snum) { for(auto& wal : wallsofsector(nextsect)) { - x = wal.wall_int_pos.X; - y = wal.wall_int_pos.Y; + x = wal.wall_int_pos().X; + y = wal.wall_int_pos().Y; switch (wlwal->lotag) { case 42: - y = wal.wall_int_pos.Y - (var_cx - 2); + y = wal.wall_int_pos().Y - (var_cx - 2); dragpoint(&wal, x, y); break; case 41: - x = wal.wall_int_pos.X + (var_cx - 2); + x = wal.wall_int_pos().X + (var_cx - 2); dragpoint(&wal, x, y); break; case 40: - y = wal.wall_int_pos.Y + (var_cx - 2); + y = wal.wall_int_pos().Y + (var_cx - 2); dragpoint(&wal, x, y); break; case 43: - x = wal.wall_int_pos.X - (var_cx - 2); + x = wal.wall_int_pos().X - (var_cx - 2); dragpoint(&wal, x, y); break; } diff --git a/source/games/duke/src/spawn.cpp b/source/games/duke/src/spawn.cpp index 8a7a6adf2..105939d6a 100644 --- a/source/games/duke/src/spawn.cpp +++ b/source/games/duke/src/spawn.cpp @@ -784,7 +784,7 @@ void spawneffector(DDukeActor* actor, TArray* actors) for (auto& wal : wallsofsector(sectp)) { - d = FindDistance2D(actor->spr.pos.vec2 - wal.wall_int_pos); + d = FindDistance2D(actor->spr.pos.vec2 - wal.wall_int_pos()); if (d < q) { q = d; @@ -798,7 +798,7 @@ void spawneffector(DDukeActor* actor, TArray* actors) for (auto& wal : wallsofsector(sectp)) { - d = FindDistance2D(actor->spr.pos.vec2 - wal.wall_int_pos); + d = FindDistance2D(actor->spr.pos.vec2 - wal.wall_int_pos()); if (d < q && &wal != actor->temp_walls[0]) { q = d; @@ -958,12 +958,12 @@ void spawneffector(DDukeActor* actor, TArray* actors) actor->temp_data[1] = tempwallptr; for (auto& wal : wallsofsector(sectp)) { - msx[tempwallptr] = wal.wall_int_pos.X - actor->spr.pos.X; - msy[tempwallptr] = wal.wall_int_pos.Y - actor->spr.pos.Y; + msx[tempwallptr] = wal.wall_int_pos().X - actor->spr.pos.X; + msy[tempwallptr] = wal.wall_int_pos().Y - actor->spr.pos.Y; tempwallptr++; if (tempwallptr > 2047) { - I_Error("Too many moving sectors at (%d,%d).\n", wal.wall_int_pos.X, wal.wall_int_pos.Y); + I_Error("Too many moving sectors at (%d,%d).\n", wal.wall_int_pos().X, wal.wall_int_pos().Y); } } if (actor->spr.lotag == SE_30_TWO_WAY_TRAIN || actor->spr.lotag == SE_6_SUBWAY || actor->spr.lotag == SE_14_SUBWAY_CAR || actor->spr.lotag == SE_5_BOSS) @@ -1098,8 +1098,8 @@ void lotsofglass(DDukeActor *actor, walltype* wal, int n) return; } - int x1 = wal->wall_int_pos.X; - int y1 = wal->wall_int_pos.Y; + int x1 = wal->wall_int_pos().X; + int y1 = wal->wall_int_pos().Y; auto delta = wal->delta() / (n + 1); x1 -= Sgn(delta.Y); @@ -1153,8 +1153,8 @@ void ceilingglass(DDukeActor* actor, sectortype* sectp, int n) for (auto& wal : wallsofsector(sectp)) { - int x1 = wal.wall_int_pos.X; - int y1 = wal.wall_int_pos.Y; + int x1 = wal.wall_int_pos().X; + int y1 = wal.wall_int_pos().Y; auto delta = wal.delta() / (n + 1); @@ -1192,8 +1192,8 @@ void lotsofcolourglass(DDukeActor* actor, walltype* wal, int n) return; } - int x1 = wal->wall_int_pos.X; - int y1 = wal->wall_int_pos.Y; + int x1 = wal->wall_int_pos().X; + int y1 = wal->wall_int_pos().Y; auto delta = wal->delta() / (n + 1); diff --git a/source/games/exhumed/src/init.cpp b/source/games/exhumed/src/init.cpp index 7eb2452ed..52875da0c 100644 --- a/source/games/exhumed/src/init.cpp +++ b/source/games/exhumed/src/init.cpp @@ -215,15 +215,15 @@ void SnapSectors(sectortype* pSectorA, sectortype* pSectorB, int b) int bestx = 0x7FFFFFF; int besty = bestx; - int x = wal1.wall_int_pos.X; - int y = wal1.wall_int_pos.Y; + int x = wal1.wall_int_pos().X; + int y = wal1.wall_int_pos().Y; walltype* bestwall = nullptr; for(auto& wal2 : wallsofsector(pSectorB)) { - int thisx = x - wal2.wall_int_pos.X; - int thisy = y - wal2.wall_int_pos.Y; + int thisx = x - wal2.wall_int_pos().X; + int thisy = y - wal2.wall_int_pos().Y; int thisdist = abs(thisx) + abs(thisy); int bestdist = abs(bestx) + abs(besty); @@ -235,7 +235,7 @@ void SnapSectors(sectortype* pSectorA, sectortype* pSectorB, int b) } } - dragpoint(bestwall, bestwall->wall_int_pos.X + bestx, bestwall->wall_int_pos.Y + besty); + dragpoint(bestwall, bestwall->wall_int_pos().X + bestx, bestwall->wall_int_pos().Y + besty); } if (b) { diff --git a/source/games/exhumed/src/move.cpp b/source/games/exhumed/src/move.cpp index b46e860c4..b66d3914a 100644 --- a/source/games/exhumed/src/move.cpp +++ b/source/games/exhumed/src/move.cpp @@ -806,8 +806,8 @@ void CreatePushBlock(sectortype* pSector) for (auto& wal : wallsofsector(pSector)) { - xSum += wal.wall_int_pos.X; - ySum += wal.wall_int_pos.Y; + xSum += wal.wall_int_pos().X; + ySum += wal.wall_int_pos().Y; } int xAvg = xSum / pSector->wallnum; @@ -829,8 +829,8 @@ void CreatePushBlock(sectortype* pSector) for (auto& wal : wallsofsector(pSector)) { - uint32_t xDiff = abs(xAvg - wal.wall_int_pos.X); - uint32_t yDiff = abs(yAvg - wal.wall_int_pos.Y); + uint32_t xDiff = abs(xAvg - wal.wall_int_pos().X); + uint32_t yDiff = abs(yAvg - wal.wall_int_pos().Y); uint32_t sqrtNum = xDiff * xDiff + yDiff * yDiff; @@ -1036,7 +1036,7 @@ void MoveSector(sectortype* pSector, int nAngle, int *nXVel, int *nYVel) for(auto& wal : wallsofsector(pSector)) { - dragpoint(&wal, xvect + wal.wall_int_pos.X, yvect + wal.wall_int_pos.Y); + dragpoint(&wal, xvect + wal.wall_int_pos().X, yvect + wal.wall_int_pos().Y); } pBlockInfo->x += xvect; diff --git a/source/games/exhumed/src/object.cpp b/source/games/exhumed/src/object.cpp index eb52c5622..a2511b489 100644 --- a/source/games/exhumed/src/object.cpp +++ b/source/games/exhumed/src/object.cpp @@ -411,20 +411,20 @@ DExhumedActor* FindWallSprites(sectortype* pSector) for (auto& wal : wallsofsector(pSector)) { - if (wal.wall_int_pos.X < var_24) { - var_24 = wal.wall_int_pos.X; + if (wal.wall_int_pos().X < var_24) { + var_24 = wal.wall_int_pos().X; } - if (esi < wal.wall_int_pos.X) { - esi = wal.wall_int_pos.X; + if (esi < wal.wall_int_pos().X) { + esi = wal.wall_int_pos().X; } - if (ecx > wal.wall_int_pos.Y) { - ecx = wal.wall_int_pos.Y; + if (ecx > wal.wall_int_pos().Y) { + ecx = wal.wall_int_pos().Y; } - if (edi < wal.wall_int_pos.Y) { - edi = wal.wall_int_pos.Y; + if (edi < wal.wall_int_pos().Y) { + edi = wal.wall_int_pos().Y; } } @@ -986,23 +986,23 @@ int BuildSlide(int nChannel, walltype* pStartWall, walltype* pWall1, walltype* p SlideData[nSlide].pWall2 = pWall2; SlideData[nSlide].pWall3 = pWall3; - SlideData[nSlide].x1 = pStartWall->wall_int_pos.X; - SlideData[nSlide].y1 = pStartWall->wall_int_pos.Y; + SlideData[nSlide].x1 = pStartWall->wall_int_pos().X; + SlideData[nSlide].y1 = pStartWall->wall_int_pos().Y; - SlideData[nSlide].x2 = pWall2->wall_int_pos.X; - SlideData[nSlide].y2 = pWall2->wall_int_pos.Y; + SlideData[nSlide].x2 = pWall2->wall_int_pos().X; + SlideData[nSlide].y2 = pWall2->wall_int_pos().Y; - SlideData[nSlide].x3 = pWall1->wall_int_pos.X; - SlideData[nSlide].y3 = pWall1->wall_int_pos.Y; + SlideData[nSlide].x3 = pWall1->wall_int_pos().X; + SlideData[nSlide].y3 = pWall1->wall_int_pos().Y; - SlideData[nSlide].x4 = pWall3->wall_int_pos.X; - SlideData[nSlide].y4 = pWall3->wall_int_pos.Y; + SlideData[nSlide].x4 = pWall3->wall_int_pos().X; + SlideData[nSlide].y4 = pWall3->wall_int_pos().Y; - SlideData[nSlide].x5 = p2ndLastWall->wall_int_pos.X; - SlideData[nSlide].y5 = p2ndLastWall->wall_int_pos.Y; + SlideData[nSlide].x5 = p2ndLastWall->wall_int_pos().X; + SlideData[nSlide].y5 = p2ndLastWall->wall_int_pos().Y; - SlideData[nSlide].x6 = pWall4->wall_int_pos.X; - SlideData[nSlide].y6 = pWall4->wall_int_pos.Y; + SlideData[nSlide].x6 = pWall4->wall_int_pos().X; + SlideData[nSlide].y6 = pWall4->wall_int_pos().Y; StartInterpolation(pStartWall, Interp_Wall_X); StartInterpolation(pStartWall, Interp_Wall_Y); @@ -1021,8 +1021,8 @@ int BuildSlide(int nChannel, walltype* pStartWall, walltype* pWall1, walltype* p SlideData[nSlide].pActor = pActor; pActor->spr.cstat = CSTAT_SPRITE_INVISIBLE; - pActor->spr.pos.X = pStartWall->wall_int_pos.X; - pActor->spr.pos.Y = pStartWall->wall_int_pos.Y; + pActor->spr.pos.X = pStartWall->wall_int_pos().X; + pActor->spr.pos.Y = pStartWall->wall_int_pos().Y; pActor->spr.pos.Z = pSector->floorz; pActor->backuppos(); @@ -1074,8 +1074,8 @@ void AISlide::Tick(RunListEvent* ev) if (cx == 1) { auto pWall = SlideData[nSlide].pWall1; - int x = pWall->wall_int_pos.X; - int y = pWall->wall_int_pos.Y; + int x = pWall->wall_int_pos().X; + int y = pWall->wall_int_pos().Y; int nSeekA = LongSeek(&x, SlideData[nSlide].x5, 20, 20); int var_34 = nSeekA; @@ -1098,15 +1098,15 @@ void AISlide::Tick(RunListEvent* ev) pWall = SlideData[nSlide].pStartWall; - y = pWall->wall_int_pos.Y + var_24; - x = pWall->wall_int_pos.X + var_20; + y = pWall->wall_int_pos().Y + var_24; + x = pWall->wall_int_pos().X + var_20; dragpoint(SlideData[nSlide].pStartWall, x, y); pWall = SlideData[nSlide].pWall3; - x = pWall->wall_int_pos.X; - y = pWall->wall_int_pos.Y; + x = pWall->wall_int_pos().X; + y = pWall->wall_int_pos().Y; int nSeekC = LongSeek(&x, SlideData[nSlide].x6, 20, 20); int var_30 = nSeekC; @@ -1124,16 +1124,16 @@ void AISlide::Tick(RunListEvent* ev) pWall = SlideData[nSlide].pWall2; - x = pWall->wall_int_pos.X + var_20; - y = pWall->wall_int_pos.Y + var_24; + x = pWall->wall_int_pos().X + var_20; + y = pWall->wall_int_pos().Y + var_24; dragpoint(SlideData[nSlide].pWall2, x, y); } else if (cx == 0) // right branch { auto pWall = SlideData[nSlide].pStartWall; - int x = pWall->wall_int_pos.X; - int y = pWall->wall_int_pos.Y; + int x = pWall->wall_int_pos().X; + int y = pWall->wall_int_pos().Y; int nSeekA = LongSeek(&x, SlideData[nSlide].x1, 20, 20); int edi = nSeekA; @@ -1151,15 +1151,15 @@ void AISlide::Tick(RunListEvent* ev) pWall = SlideData[nSlide].pWall1; - y = pWall->wall_int_pos.Y + var_28; - x = pWall->wall_int_pos.X + var_1C; + y = pWall->wall_int_pos().Y + var_28; + x = pWall->wall_int_pos().X + var_1C; dragpoint(SlideData[nSlide].pWall1, x, y); pWall = SlideData[nSlide].pWall2; - x = pWall->wall_int_pos.X; - y = pWall->wall_int_pos.Y; + x = pWall->wall_int_pos().X; + y = pWall->wall_int_pos().Y; int nSeekC = LongSeek(&x, SlideData[nSlide].x2, 20, 20); edi = nSeekC; @@ -1177,8 +1177,8 @@ void AISlide::Tick(RunListEvent* ev) pWall = SlideData[nSlide].pWall3; - y = pWall->wall_int_pos.Y + var_28; - x = pWall->wall_int_pos.X + var_1C; + y = pWall->wall_int_pos().Y + var_28; + x = pWall->wall_int_pos().X + var_1C; dragpoint(SlideData[nSlide].pWall3, x, y); } @@ -1565,8 +1565,8 @@ DExhumedActor* BuildEnergyBlock(sectortype* pSector) for(auto& wal : wallsofsector(pSector)) { - x += wal.wall_int_pos.X; - y += wal.wall_int_pos.Y; + x += wal.wall_int_pos().X; + y += wal.wall_int_pos().Y; wal.picnum = kClockSymbol16; wal.pal = 0; @@ -2510,8 +2510,8 @@ void PostProcess() if (§ != §j && sectj.Speed && !(sect.Flag & kSectLava)) { - int xVal = abs(sect.firstWall()->wall_int_pos.X - sectj.firstWall()->wall_int_pos.X); - int yVal = abs(sect.firstWall()->wall_int_pos.Y - sectj.firstWall()->wall_int_pos.Y); + int xVal = abs(sect.firstWall()->wall_int_pos().X - sectj.firstWall()->wall_int_pos().X); + int yVal = abs(sect.firstWall()->wall_int_pos().Y - sectj.firstWall()->wall_int_pos().Y); if (xVal < 15000 && yVal < 15000 && (xVal + yVal < var_20)) { diff --git a/source/games/exhumed/src/sound.cpp b/source/games/exhumed/src/sound.cpp index 0398d71ea..ffbd7a519 100644 --- a/source/games/exhumed/src/sound.cpp +++ b/source/games/exhumed/src/sound.cpp @@ -675,7 +675,7 @@ void CheckAmbience(sectortype* sect) walltype* pWall = pSector2->firstWall(); if (!soundEngine->IsSourcePlayingSomething(SOURCE_Ambient, &amb, 0)) { - vec3_t v = { pWall->wall_int_pos.X, pWall->wall_int_pos.Y, pSector2->floorz }; + vec3_t v = { pWall->wall_int_pos().X, pWall->wall_int_pos().Y, pSector2->floorz }; amb = GetSoundPos(&v); soundEngine->StartSound(SOURCE_Ambient, &amb, nullptr, CHAN_BODY, CHANF_TRANSIENT, sect->Sound + 1, 1.f, ATTN_NORM); return; @@ -690,7 +690,7 @@ void CheckAmbience(sectortype* sect) } else { - vec3_t v = { pWall->wall_int_pos.X, pWall->wall_int_pos.Y, pSector2->floorz }; + vec3_t v = { pWall->wall_int_pos().X, pWall->wall_int_pos().Y, pSector2->floorz }; amb = GetSoundPos(&v); } return 1; diff --git a/source/games/exhumed/src/switch.cpp b/source/games/exhumed/src/switch.cpp index 60d360877..f6287430a 100644 --- a/source/games/exhumed/src/switch.cpp +++ b/source/games/exhumed/src/switch.cpp @@ -290,7 +290,7 @@ void AISWStepOn::TouchFloor(RunListEvent* ev) if (var_14 != sRunChannels[nChannel].c) { auto pWall = pSector->firstWall(); - PlayFXAtXYZ(StaticSound[nSwitchSound], pWall->wall_int_pos.X, pWall->wall_int_pos.Y, pSector->floorz); + PlayFXAtXYZ(StaticSound[nSwitchSound], pWall->wall_int_pos().X, pWall->wall_int_pos().Y, pSector->floorz); assert(sRunChannels[nChannel].c < 8); @@ -510,7 +510,7 @@ void AISWPressWall::Use(RunListEvent* ev) auto pWall = SwitchData[nSwitch].pWall; auto pSector = SwitchData[nSwitch].pSector; - PlayFXAtXYZ(StaticSound[nSwitchSound], pWall->wall_int_pos.X, pWall->wall_int_pos.Y, 0, CHANF_LISTENERZ); + PlayFXAtXYZ(StaticSound[nSwitchSound], pWall->wall_int_pos().X, pWall->wall_int_pos().Y, 0, CHANF_LISTENERZ); } END_PS_NS diff --git a/source/games/sw/src/_polymost.cpp b/source/games/sw/src/_polymost.cpp index 70953a4de..59e72cc5e 100644 --- a/source/games/sw/src/_polymost.cpp +++ b/source/games/sw/src/_polymost.cpp @@ -205,8 +205,8 @@ void JS_DrawMirrors(PLAYER* pp, int tx, int ty, int tz, fixed_t tpq16ang, fixed if (bIsWallMirror) { - j = abs(mirror[cnt].mirrorWall->wall_int_pos.X - tx); - j += abs(mirror[cnt].mirrorWall->wall_int_pos.Y - ty); + j = abs(mirror[cnt].mirrorWall->wall_int_pos().X - tx); + j += abs(mirror[cnt].mirrorWall->wall_int_pos().Y - ty); if (j < dist) dist = j; } @@ -233,8 +233,8 @@ void JS_DrawMirrors(PLAYER* pp, int tx, int ty, int tz, fixed_t tpq16ang, fixed auto wal = mirror[cnt].mirrorWall; // Get wall midpoint for offset in mirror view - midx = (wal->wall_int_pos.X + wal->point2Wall()->wall_int_pos.X) / 2; - midy = (wal->wall_int_pos.Y + wal->point2Wall()->wall_int_pos.Y) / 2; + midx = (wal->wall_int_pos().X + wal->point2Wall()->wall_int_pos().X) / 2; + midy = (wal->wall_int_pos().Y + wal->point2Wall()->wall_int_pos().Y) / 2; // Finish finding offsets tdx = abs(midx - tx); diff --git a/source/games/sw/src/break.cpp b/source/games/sw/src/break.cpp index f9d9175e3..a648d0591 100644 --- a/source/games/sw/src/break.cpp +++ b/source/games/sw/src/break.cpp @@ -735,8 +735,8 @@ int WallBreakPosition(walltype* wp, sectortype** sectp, int *x, int *y, int *z, ASSERT(*sectp); // midpoint of wall - *x = (wp->wall_int_pos.X + wp->wall_int_pos.X) >> 1; - *y = (wp->wall_int_pos.Y + wp->wall_int_pos.Y) >> 1; + *x = (wp->wall_int_pos().X + wp->wall_int_pos().X) >> 1; + *y = (wp->wall_int_pos().Y + wp->wall_int_pos().Y) >> 1; if (!wp->twoSided()) { diff --git a/source/games/sw/src/interpso.cpp b/source/games/sw/src/interpso.cpp index 0c78e63c0..6e25d57f3 100644 --- a/source/games/sw/src/interpso.cpp +++ b/source/games/sw/src/interpso.cpp @@ -97,10 +97,10 @@ static int &getvalue(so_interp::interp_data& element, bool write) { case soi_wallx: if (write) wall[index].moved(); - return wall[index].wall_int_pos.X; + return wall[index].__wall_int_pos.X; case soi_wally: if (write) wall[index].moved(); - return wall[index].wall_int_pos.Y; + return wall[index].__wall_int_pos.Y; case soi_ceil: return *sector[index].ceilingzptr(!write); case soi_floor: diff --git a/source/games/sw/src/jsector.cpp b/source/games/sw/src/jsector.cpp index 479f8f34a..395fe4744 100644 --- a/source/games/sw/src/jsector.cpp +++ b/source/games/sw/src/jsector.cpp @@ -334,7 +334,7 @@ void JS_InitMirrors(void) if (!Found_Cam) { Printf("Cound not find the camera view sprite for match %d\n", wal.hitag); - Printf("Map Coordinates: x = %d, y = %d\n", wal.wall_int_pos.X, wal.wall_int_pos.Y); + Printf("Map Coordinates: x = %d, y = %d\n", wal.wall_int_pos().X, wal.wall_int_pos().Y); break; } @@ -363,7 +363,7 @@ void JS_InitMirrors(void) { Printf("Did not find drawtotile for camera number %d\n", mirrorcnt); Printf("wall(%d).hitag == %d\n", wallnum(&wal), wal.hitag); - Printf("Map Coordinates: x = %d, y = %d\n", wal.wall_int_pos.X, wal.wall_int_pos.Y); + Printf("Map Coordinates: x = %d, y = %d\n", wal.wall_int_pos().X, wal.wall_int_pos().Y); RESET_BOOL1(mirror[mirrorcnt].cameraActor); } } @@ -512,8 +512,8 @@ void JS_DrawCameras(PLAYER* pp, int tx, int ty, int tz, double smoothratio) if (bIsWallMirror) { - j = abs(mirror[cnt].mirrorWall->wall_int_pos.X - tx); - j += abs(mirror[cnt].mirrorWall->wall_int_pos.Y - ty); + j = abs(mirror[cnt].mirrorWall->wall_int_pos().X - tx); + j += abs(mirror[cnt].mirrorWall->wall_int_pos().Y - ty); if (j < dist) dist = j; } @@ -538,8 +538,8 @@ void JS_DrawCameras(PLAYER* pp, int tx, int ty, int tz, double smoothratio) auto wal = mirror[cnt].mirrorWall; // Get wall midpoint for offset in mirror view - midx = (wal->wall_int_pos.X + wal->point2Wall()->wall_int_pos.X) / 2; - midy = (wal->wall_int_pos.Y + wal->point2Wall()->wall_int_pos.Y) / 2; + midx = (wal->wall_int_pos().X + wal->point2Wall()->wall_int_pos().X) / 2; + midy = (wal->wall_int_pos().Y + wal->point2Wall()->wall_int_pos().Y) / 2; // Finish finding offsets tdx = abs(midx - tx); diff --git a/source/games/sw/src/player.cpp b/source/games/sw/src/player.cpp index 07cccff0b..7b00ca1b3 100644 --- a/source/games/sw/src/player.cpp +++ b/source/games/sw/src/player.cpp @@ -2573,8 +2573,8 @@ void DoPlayerMoveVehicle(PLAYER* pp) { if (wal.extra && (wal.extra & (WALLFX_LOOP_OUTER|WALLFX_LOOP_OUTER_SECONDARY)) == WALLFX_LOOP_OUTER) { - x[count] = wal.wall_int_pos.X; - y[count] = wal.wall_int_pos.Y; + x[count] = wal.wall_int_pos().X; + y[count] = wal.wall_int_pos().Y; ox[count] = sop->pmid.X - sop->xorig[wallcount]; oy[count] = sop->pmid.Y - sop->yorig[wallcount]; diff --git a/source/games/sw/src/sector.cpp b/source/games/sw/src/sector.cpp index c5bfc997a..d9444ee3d 100644 --- a/source/games/sw/src/sector.cpp +++ b/source/games/sw/src/sector.cpp @@ -124,7 +124,7 @@ void WallSetupDontMove(void) { for(auto& wal : wall) { - if (wal.wall_int_pos.X < jActor->spr.pos.X && wal.wall_int_pos.X > iActor->spr.pos.X && wal.wall_int_pos.Y < jActor->spr.pos.Y && wal.wall_int_pos.Y > iActor->spr.pos.Y) + if (wal.wall_int_pos().X < jActor->spr.pos.X && wal.wall_int_pos().X > iActor->spr.pos.X && wal.wall_int_pos().Y < jActor->spr.pos.Y && wal.wall_int_pos().Y > iActor->spr.pos.Y) { wal.extra |= WALLFX_DONT_MOVE; } @@ -299,9 +299,9 @@ void WallSetup(void) wall_num->extra |= WALLFX_DONT_STICK; if (!sw->type) - sw->orig_xy = wall_num->wall_int_pos.Y - (sw->range >> 2); + sw->orig_xy = wall_num->wall_int_pos().Y - (sw->range >> 2); else - sw->orig_xy = wall_num->wall_int_pos.X - (sw->range >> 2); + sw->orig_xy = wall_num->wall_int_pos().X - (sw->range >> 2); sw->sintable_ndx = cnt * (2048 / num_points); } @@ -592,8 +592,8 @@ void SectorMidPoint(sectortype* sectp, int *xmid, int *ymid, int *zmid) for(auto& wal : wallsofsector(sectp)) { - xsum += wal.wall_int_pos.X; - ysum += wal.wall_int_pos.Y; + xsum += wal.wall_int_pos().X; + ysum += wal.wall_int_pos().Y; } *xmid = xsum / (sectp->wallnum); @@ -2381,7 +2381,7 @@ void DoSineWaveFloor(void) wal = sect->firstWall() + 2; //Pass (Sector, x, y, z) - alignflorslope(sect,wal->wall_int_pos.X,wal->wall_int_pos.Y, wal->nextSector()->floorz); + alignflorslope(sect,wal->wall_int_pos().X,wal->wall_int_pos().Y, wal->nextSector()->floorz); } } } @@ -2406,12 +2406,12 @@ void DoSineWaveWall(void) if (!sw->type) { New = sw->orig_xy + MulScale(sw->range, bsin(sw->sintable_ndx), 14); - dragpoint(wal, wal->wall_int_pos.X, New); + dragpoint(wal, wal->wall_int_pos().X, New); } else { New = sw->orig_xy + MulScale(sw->range, bsin(sw->sintable_ndx), 14); - dragpoint(wal, New, wal->wall_int_pos.Y); + dragpoint(wal, New, wal->wall_int_pos().Y); } } } diff --git a/source/games/sw/src/slidor.cpp b/source/games/sw/src/slidor.cpp index 061863468..6215b4a38 100644 --- a/source/games/sw/src/slidor.cpp +++ b/source/games/sw/src/slidor.cpp @@ -274,17 +274,17 @@ int DoSlidorMoveWalls(DSWActor* actor, int amt) if (!wal->twoSided()) { // white wall - move 4 points - wal->move(wal->wall_int_pos.X - amt, wal->wall_int_pos.Y); - pwal->move(pwal->wall_int_pos.X - amt, pwal->wall_int_pos.Y); - wal->point2Wall()->move(wal->point2Wall()->wall_int_pos.X - amt, wal->point2Wall()->wall_int_pos.Y); + wal->move(wal->wall_int_pos().X - amt, wal->wall_int_pos().Y); + pwal->move(pwal->wall_int_pos().X - amt, pwal->wall_int_pos().Y); + wal->point2Wall()->move(wal->point2Wall()->wall_int_pos().X - amt, wal->point2Wall()->wall_int_pos().Y); auto pwal2 = wal->point2Wall()->point2Wall(); - pwal2->move(pwal2->wall_int_pos.X - amt, pwal2->wall_int_pos.Y); + pwal2->move(pwal2->wall_int_pos().X - amt, pwal2->wall_int_pos().Y); } else { // red wall - move 2 points - dragpoint(wal, wal->wall_int_pos.X - amt, wal->wall_int_pos.Y); - dragpoint(wal->point2Wall(), wal->point2Wall()->wall_int_pos.X - amt, wal->point2Wall()->wall_int_pos.Y); + dragpoint(wal, wal->wall_int_pos().X - amt, wal->wall_int_pos().Y); + dragpoint(wal->point2Wall(), wal->point2Wall()->wall_int_pos().X - amt, wal->point2Wall()->wall_int_pos().Y); } break; @@ -299,17 +299,17 @@ int DoSlidorMoveWalls(DSWActor* actor, int amt) if (!wal->twoSided()) { // white wall - move 4 points - wal->move(wal->wall_int_pos.X + amt, wal->wall_int_pos.Y); - pwal->move(pwal->wall_int_pos.X + amt, pwal->wall_int_pos.Y); - wal->point2Wall()->move(wal->point2Wall()->wall_int_pos.X + amt, wal->point2Wall()->wall_int_pos.Y); + wal->move(wal->wall_int_pos().X + amt, wal->wall_int_pos().Y); + pwal->move(pwal->wall_int_pos().X + amt, pwal->wall_int_pos().Y); + wal->point2Wall()->move(wal->point2Wall()->wall_int_pos().X + amt, wal->point2Wall()->wall_int_pos().Y); auto pwal2 = wal->point2Wall()->point2Wall(); - pwal2->move(pwal2->wall_int_pos.X + amt, pwal2->wall_int_pos.Y); + pwal2->move(pwal2->wall_int_pos().X + amt, pwal2->wall_int_pos().Y); } else { // red wall - move 2 points - dragpoint(wal, wal->wall_int_pos.X + amt, wal->wall_int_pos.Y); - dragpoint(wal->point2Wall(), wal->point2Wall()->wall_int_pos.X + amt, wal->point2Wall()->wall_int_pos.Y); + dragpoint(wal, wal->wall_int_pos().X + amt, wal->wall_int_pos().Y); + dragpoint(wal->point2Wall(), wal->point2Wall()->wall_int_pos().X + amt, wal->point2Wall()->wall_int_pos().Y); } break; @@ -323,16 +323,16 @@ int DoSlidorMoveWalls(DSWActor* actor, int amt) if (!wal->twoSided()) { - wal->move(wal->wall_int_pos.X, wal->wall_int_pos.Y - amt); - pwal->move(pwal->wall_int_pos.X, pwal->wall_int_pos.Y - amt); - wal->point2Wall()->move(wal->point2Wall()->wall_int_pos.X, wal->point2Wall()->wall_int_pos.Y - amt); + wal->move(wal->wall_int_pos().X, wal->wall_int_pos().Y - amt); + pwal->move(pwal->wall_int_pos().X, pwal->wall_int_pos().Y - amt); + wal->point2Wall()->move(wal->point2Wall()->wall_int_pos().X, wal->point2Wall()->wall_int_pos().Y - amt); auto pwal2 = wal->point2Wall()->point2Wall(); - pwal2->move(pwal2->wall_int_pos.X, pwal2->wall_int_pos.Y - amt); + pwal2->move(pwal2->wall_int_pos().X, pwal2->wall_int_pos().Y - amt); } else { - dragpoint(wal, wal->wall_int_pos.X, wal->wall_int_pos.Y - amt); - dragpoint(wal->point2Wall(), wal->point2Wall()->wall_int_pos.X, wal->point2Wall()->wall_int_pos.Y - amt); + dragpoint(wal, wal->wall_int_pos().X, wal->wall_int_pos().Y - amt); + dragpoint(wal->point2Wall(), wal->point2Wall()->wall_int_pos().X, wal->point2Wall()->wall_int_pos().Y - amt); } break; @@ -346,16 +346,16 @@ int DoSlidorMoveWalls(DSWActor* actor, int amt) if (!wal->twoSided()) { - wal->move(wal->wall_int_pos.X, wal->wall_int_pos.Y + amt); - pwal->move(pwal->wall_int_pos.X, pwal->wall_int_pos.Y + amt); - wal->point2Wall()->move(wal->point2Wall()->wall_int_pos.X, wal->point2Wall()->wall_int_pos.Y + amt); + wal->move(wal->wall_int_pos().X, wal->wall_int_pos().Y + amt); + pwal->move(pwal->wall_int_pos().X, pwal->wall_int_pos().Y + amt); + wal->point2Wall()->move(wal->point2Wall()->wall_int_pos().X, wal->point2Wall()->wall_int_pos().Y + amt); auto pwal2 = wal->point2Wall()->point2Wall(); - pwal2->move(pwal2->wall_int_pos.X, pwal2->wall_int_pos.Y + amt); + pwal2->move(pwal2->wall_int_pos().X, pwal2->wall_int_pos().Y + amt); } else { - dragpoint(wal, wal->wall_int_pos.X, wal->wall_int_pos.Y + amt); - dragpoint(wal->point2Wall(), wal->point2Wall()->wall_int_pos.X, wal->point2Wall()->wall_int_pos.Y + amt); + dragpoint(wal, wal->wall_int_pos().X, wal->wall_int_pos().Y + amt); + dragpoint(wal->point2Wall(), wal->point2Wall()->wall_int_pos().X, wal->point2Wall()->wall_int_pos().Y + amt); } @@ -382,22 +382,22 @@ int DoSlidorInstantClose(DSWActor* actor) switch (wal->lotag) { case TAG_WALL_SLIDOR_LEFT: - diff = wal->wall_int_pos.X - actor->spr.pos.X; + diff = wal->wall_int_pos().X - actor->spr.pos.X; DoSlidorMoveWalls(actor, diff); break; case TAG_WALL_SLIDOR_RIGHT: - diff = wal->wall_int_pos.X - actor->spr.pos.X; + diff = wal->wall_int_pos().X - actor->spr.pos.X; DoSlidorMoveWalls(actor, -diff); break; case TAG_WALL_SLIDOR_UP: - diff = wal->wall_int_pos.Y - actor->spr.pos.Y; + diff = wal->wall_int_pos().Y - actor->spr.pos.Y; DoSlidorMoveWalls(actor, diff); break; case TAG_WALL_SLIDOR_DOWN: - diff = wal->wall_int_pos.Y - actor->spr.pos.Y; + diff = wal->wall_int_pos().Y - actor->spr.pos.Y; DoSlidorMoveWalls(actor, -diff); break; } diff --git a/source/games/sw/src/sprite.cpp b/source/games/sw/src/sprite.cpp index ec6567659..711ee7b4f 100644 --- a/source/games/sw/src/sprite.cpp +++ b/source/games/sw/src/sprite.cpp @@ -1454,7 +1454,7 @@ void PreMapCombineFloors(void) for (auto& wal : wallsofsector(dasect)) { - wal.move(wal.wall_int_pos.X + dx, wal.wall_int_pos.Y + dy); + wal.move(wal.wall_int_pos().X + dx, wal.wall_int_pos().Y + dy); if (wal.twoSided()) search.Add(wal.nextSector()); @@ -2125,8 +2125,8 @@ void SpriteSetup(void) wallcount = 0; for(auto& wal : wallsofsector(actor->sector())) { - actor->user.rotator->origX[wallcount] = wal.wall_int_pos.X; - actor->user.rotator->origY[wallcount] = wal.wall_int_pos.Y; + actor->user.rotator->origX[wallcount] = wal.wall_int_pos().X; + actor->user.rotator->origY[wallcount] = wal.wall_int_pos().Y; wallcount++; } diff --git a/source/games/sw/src/track.cpp b/source/games/sw/src/track.cpp index 58b05ea1a..8ee397d6a 100644 --- a/source/games/sw/src/track.cpp +++ b/source/games/sw/src/track.cpp @@ -754,7 +754,7 @@ void SectorObjectSetupBounds(SECTOR_OBJECT* sop) for(auto& wal : wallsofsector(sect)) { // all walls have to be in bounds to be in sector object - if (!(wal.wall_int_pos.X > xlow && wal.wall_int_pos.X < xhigh && wal.wall_int_pos.Y > ylow && wal.wall_int_pos.Y < yhigh)) + if (!(wal.wall_int_pos().X > xlow && wal.wall_int_pos().X < xhigh && wal.wall_int_pos().Y > ylow && wal.wall_int_pos().Y < yhigh)) { SectorInBounds = false; break; @@ -1400,8 +1400,8 @@ void PlaceSectorObjectsOnTracks(void) // move all walls in sectors for (auto& wal : wallsofsector(sop->sectp[j])) { - sop->xorig[sop->num_walls] = sop->pmid.X - wal.wall_int_pos.X; - sop->yorig[sop->num_walls] = sop->pmid.Y - wal.wall_int_pos.Y; + sop->xorig[sop->num_walls] = sop->pmid.X - wal.wall_int_pos().X; + sop->yorig[sop->num_walls] = sop->pmid.Y - wal.wall_int_pos().Y; sop->num_walls++; } } @@ -1623,11 +1623,11 @@ void MovePoints(SECTOR_OBJECT* sop, short delta_ang, int nx, int ny) if (wal.extra && (wal.extra & WALLFX_LOOP_OUTER)) { - dragpoint(&wal, wal.wall_int_pos.X + nx, wal.wall_int_pos.Y + ny); + dragpoint(&wal, wal.wall_int_pos().X + nx, wal.wall_int_pos().Y + ny); } else { - wal.move(wal.wall_int_pos.X + nx, wal.wall_int_pos.Y + ny); + wal.move(wal.wall_int_pos().X + nx, wal.wall_int_pos().Y + ny); } rot_ang = delta_ang; @@ -1641,7 +1641,7 @@ void MovePoints(SECTOR_OBJECT* sop, short delta_ang, int nx, int ny) if ((wal.extra & WALLFX_LOOP_SPIN_4X)) rot_ang = NORM_ANGLE(rot_ang * 4); - rotatepoint(sop->pmid.vec2, wal.wall_int_pos, rot_ang, &rxy); + rotatepoint(sop->pmid.vec2, wal.wall_int_pos(), rot_ang, &rxy); if (wal.extra && (wal.extra & WALLFX_LOOP_OUTER)) { diff --git a/source/games/sw/src/wallmove.cpp b/source/games/sw/src/wallmove.cpp index 9dd650d17..a8acdc2ef 100644 --- a/source/games/sw/src/wallmove.cpp +++ b/source/games/sw/src/wallmove.cpp @@ -100,7 +100,7 @@ int DoWallMove(DSWActor* actor) for(auto& wal : wall) { - if (wal.wall_int_pos.X == actor->spr.pos.X && wal.wall_int_pos.Y == actor->spr.pos.Y) + if (wal.wall_int_pos().X == actor->spr.pos.X && wal.wall_int_pos().Y == actor->spr.pos.Y) { found = true; diff --git a/source/games/sw/src/weapon.cpp b/source/games/sw/src/weapon.cpp index ccaca1aca..92b9a9fdc 100644 --- a/source/games/sw/src/weapon.cpp +++ b/source/games/sw/src/weapon.cpp @@ -7166,8 +7166,8 @@ void TraverseBreakableWalls(sectortype* start_sect, int x, int y, int z, short a if (wal.lotag == TAG_WALL_BREAK) { // find midpoint - xmid = (wal.wall_int_pos.X + wal.point2Wall()->wall_int_pos.X) >> 1; - ymid = (wal.wall_int_pos.Y + wal.point2Wall()->wall_int_pos.Y) >> 1; + xmid = (wal.wall_int_pos().X + wal.point2Wall()->wall_int_pos().X) >> 1; + ymid = (wal.wall_int_pos().Y + wal.point2Wall()->wall_int_pos().Y) >> 1; // don't need to go further if wall is too far out