- eliminated uwallptr_t.

This commit is contained in:
Christoph Oelckers 2021-12-30 11:38:34 +01:00
parent 18fdb7548e
commit 285a5f2fd2
4 changed files with 21 additions and 22 deletions

View file

@ -88,7 +88,6 @@ enum {
#include "maptypes.h"
using uwallptr_t = walltype const *;
using usectorptr_t = sectortype const *;
using tspriteptr_t = tspritetype *;

View file

@ -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)&sector[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; j<endwall; j++, wal++)
{
auto const wal2 = (uwallptr_t)wal->point2Wall();
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)&sector[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;

View file

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

View file

@ -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)&sector[nextsectnum] : NULL;
@ -1712,12 +1712,12 @@ static void polymost_drawalls(int32_t const bunch)
}
if (((ofy0 < fy0) || (ofy1 < fy1)) && (!((sec->floorstat&sector[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]; z<endwall; z++,wal++)
for (z=startwall,wal=&wall[z]; z<endwall; z++,wal++)
{
auto const wal2 = (uwallptr_t)wal->point2Wall();
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)&sector[sectnum];