From 285a5f2fd2a2edd4d5053ba0c8e58d4d581f027a Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Thu, 30 Dec 2021 11:38:34 +0100 Subject: [PATCH] - eliminated uwallptr_t. --- source/build/include/build.h | 1 - source/build/src/clip.cpp | 16 ++++++++-------- source/build/src/engine.cpp | 8 ++++---- source/build/src/polymost.cpp | 18 +++++++++--------- 4 files changed, 21 insertions(+), 22 deletions(-) diff --git a/source/build/include/build.h b/source/build/include/build.h index 78d9cadef..32a65f6a7 100644 --- a/source/build/include/build.h +++ b/source/build/include/build.h @@ -88,7 +88,6 @@ enum { #include "maptypes.h" -using uwallptr_t = walltype const *; using usectorptr_t = sectortype const *; using tspriteptr_t = tspritetype *; diff --git a/source/build/src/clip.cpp b/source/build/src/clip.cpp index b9e2a7477..3e8296226 100644 --- a/source/build/src/clip.cpp +++ b/source/build/src/clip.cpp @@ -110,8 +110,8 @@ int clipinsidebox(vec2_t *vect, int wallnum, int walldist) { int const r = walldist << 1; - auto const wal1 = (uwallptr_t)&wall[wallnum]; - auto const wal2 = (uwallptr_t)wal1->point2Wall(); + auto const wal1 = &wall[wallnum]; + auto const wal2 = wal1->point2Wall(); vec2_t const v1 = { wal1->pos.X + walldist - vect->X, wal1->pos.Y + walldist - vect->Y }; vec2_t v2 = { wal2->pos.X + walldist - vect->X, wal2->pos.Y + walldist - vect->Y }; @@ -501,11 +501,11 @@ CollisionBase clipmove_(vec3_t * const pos, int * const sectnum, int32_t xvect, auto const sec = (usectorptr_t)§or[dasect]; int const startwall = sec->wallptr; int const endwall = startwall + sec->wallnum; - auto wal = (uwallptr_t)&wall[startwall]; + auto wal = &wall[startwall]; for (int j=startwall; jpoint2Wall(); + auto const wal2 = wal->point2Wall(); if ((wal->pos.X < clipMin.X && wal2->pos.X < clipMin.X) || (wal->pos.X > clipMax.X && wal2->pos.X > clipMax.X) || (wal->pos.Y < clipMin.Y && wal2->pos.Y < clipMin.Y) || (wal->pos.Y > clipMax.Y && wal2->pos.Y > clipMax.Y)) @@ -942,7 +942,7 @@ int pushmove_(vec3_t *const vect, int *const sectnum, do { - uwallptr_t wal; + const walltype* wal; int32_t startwall, endwall; auto sec = (usectorptr_t)§or[clipsectorlist[clipsectcnt]]; @@ -953,7 +953,7 @@ int pushmove_(vec3_t *const vect, int *const sectnum, int i; - for (i=startwall, wal=(uwallptr_t)&wall[startwall]; i!=endwall; i+=dir, wal+=dir) + for (i=startwall, wal=&wall[startwall]; i!=endwall; i+=dir, wal+=dir) if (clipinsidebox(&vect->vec2, i, walldist-4) == 1) { int j = 0; @@ -1281,8 +1281,8 @@ static int32_t hitscan_trysector(const vec3_t *sv, sectortype* sec, HitInfoBase if (stat&2) { - auto const wal = (uwallptr_t)sec->firstWall(); - auto const wal2 = (uwallptr_t)wal->point2Wall(); + auto const wal = sec->firstWall(); + auto const wal2 = wal->point2Wall(); int32_t j, dax=wal2->pos.X-wal->pos.X, day=wal2->pos.Y-wal->pos.Y; i = ksqrt(compat_maybe_truncate_to_int32(uhypsq(dax,day))); if (i == 0) return 1; //continue; diff --git a/source/build/src/engine.cpp b/source/build/src/engine.cpp index 76c74bdff..38907ae54 100644 --- a/source/build/src/engine.cpp +++ b/source/build/src/engine.cpp @@ -480,11 +480,11 @@ int cansee(int x1, int y1, int z1, sectortype* sect1, int x2, int y2, int z2, se while (auto sec = search.GetNext()) { - uwallptr_t wal; + const walltype* wal; int cnt; - for (cnt=sec->wallnum,wal=(uwallptr_t)sec->firstWall(); cnt>0; cnt--,wal++) + for (cnt=sec->wallnum,wal=sec->firstWall(); cnt>0; cnt--,wal++) { - auto const wal2 = (uwallptr_t)wal->point2Wall(); + auto const wal2 = wal->point2Wall(); const int32_t x31 = wal->pos.X-x1, x34 = wal->pos.X-wal2->pos.X; const int32_t y31 = wal->pos.Y-y1, y34 = wal->pos.Y-wal2->pos.Y; @@ -551,7 +551,7 @@ void neartag(const vec3_t& sv, sectortype* sect, int ange, HitInfoBase& result, for (auto& w : wallsofsector(dasect)) { auto wal = &w; - auto const wal2 = (uwallptr_t)wal->point2Wall(); + auto const wal2 = wal->point2Wall(); const auto nextsect = wal->nextSector(); const int32_t x1 = wal->pos.X, y1 = wal->pos.Y, x2 = wal2->pos.X, y2 = wal2->pos.Y; diff --git a/source/build/src/polymost.cpp b/source/build/src/polymost.cpp index ed997f9b2..f3864d6cf 100644 --- a/source/build/src/polymost.cpp +++ b/source/build/src/polymost.cpp @@ -1477,8 +1477,8 @@ static void polymost_drawalls(int32_t const bunch) { int32_t const wallnum = thewall[z]; - auto const wal = (uwallptr_t)&wall[wallnum]; - auto const wal2 = (uwallptr_t)wal->point2Wall(); + auto const wal = &wall[wallnum]; + auto const wal2 = wal->point2Wall(); int32_t const nextsectnum = wal->nextsector; auto const nextsec = nextsectnum>=0 ? (usectorptr_t)§or[nextsectnum] : NULL; @@ -1712,12 +1712,12 @@ static void polymost_drawalls(int32_t const bunch) } if (((ofy0 < fy0) || (ofy1 < fy1)) && (!((sec->floorstat§or[nextsectnum].floorstat) & CSTAT_SECTOR_SKY))) { - uwallptr_t nwal; + const walltype* nwal; if (!(wal->cstat & CSTAT_WALL_BOTTOM_SWAP)) nwal = wal; else { - nwal = (uwallptr_t)&wall[wal->nextwall]; + nwal = &wall[wal->nextwall]; otex.u += (float)(nwal->xpan_ - wal->xpan_) * otex.d; xtex.u += (float)(nwal->xpan_ - wal->xpan_) * xtex.d; ytex.u += (float)(nwal->xpan_ - wal->xpan_) * ytex.d; @@ -1905,12 +1905,12 @@ void polymost_scansector(int32_t sectnum) DVector2 p2 = { 0, 0 }; - uwallptr_t wal; + const walltype* wal; int z; - for (z=startwall,wal=(uwallptr_t)&wall[z]; zpoint2Wall(); + auto const wal2 = wal->point2Wall(); DVector2 const fp1 = { double(wal->pos.X - globalposx), double(wal->pos.Y - globalposy) }; DVector2 const fp2 = { double(wal2->pos.X - globalposx), double(wal2->pos.Y - globalposy) }; @@ -2292,8 +2292,8 @@ void polymost_drawrooms() static void polymost_drawmaskwallinternal(int32_t wallIndex) { - auto const wal = (uwallptr_t)&wall[wallIndex]; - auto const wal2 = (uwallptr_t)wal->point2Wall(); + auto const wal = &wall[wallIndex]; + auto const wal2 = wal->point2Wall(); if (wal->nextwall == -1) return; int32_t const sectnum = wal->nextWall()->nextsector; auto const sec = (usectorptr_t)§or[sectnum];