- eliminated usectorptr_t.

This commit is contained in:
Christoph Oelckers 2021-12-30 11:45:58 +01:00
parent 285a5f2fd2
commit 44d2cc1951
4 changed files with 28 additions and 30 deletions

View file

@ -88,7 +88,6 @@ enum {
#include "maptypes.h"
using usectorptr_t = sectortype const *;
using tspriteptr_t = tspritetype *;
@ -322,16 +321,15 @@ inline sectortype* safenextsectorneighborzptr(sectortype* sectp, int refz, int t
return sect == nullptr ? sectp : sect;
}
int32_t getceilzofslopeptr(usectorptr_t sec, int32_t dax, int32_t day) ATTRIBUTE((nonnull(1)));
int32_t getflorzofslopeptr(usectorptr_t sec, int32_t dax, int32_t day) ATTRIBUTE((nonnull(1)));
void getzsofslopeptr(usectorptr_t sec, int32_t dax, int32_t day,
int32_t *ceilz, int32_t *florz) ATTRIBUTE((nonnull(1,4,5)));
int getceilzofslopeptr(const sectortype* sec, int dax, int day) ATTRIBUTE((nonnull(1)));
int getflorzofslopeptr(const sectortype* sec, int dax, int day) ATTRIBUTE((nonnull(1)));
void getzsofslopeptr(const sectortype* sec, int dax, int day, int *ceilz, int *florz) ATTRIBUTE((nonnull(1,4,5)));
inline void getcorrectzsofslope(int sectnum, int32_t dax, int32_t day, int32_t *ceilz, int32_t *florz)
{
vec2_t closest = { dax, day };
getsectordist(closest, sectnum, &closest);
getzsofslopeptr((usectorptr_t)&sector[sectnum], closest.X, closest.Y, ceilz, florz);
getzsofslopeptr(&sector[sectnum], closest.X, closest.Y, ceilz, florz);
}
void alignceilslope(sectortype* dasect, int32_t x, int32_t y, int32_t z);

View file

@ -229,7 +229,7 @@ static int cliptestsector(int const dasect, int const nextsect, int32_t const fl
{
assert(validSectorIndex(dasect) && validSectorIndex(nextsect));
auto const sec2 = (usectorptr_t)&sector[nextsect];
auto const sec2 = &sector[nextsect];
switch (enginecompatibility_mode)
{
@ -260,7 +260,7 @@ static int cliptestsector(int const dasect, int const nextsect, int32_t const fl
if (daz2 <= dacz2)
return 1;
auto const sec = (usectorptr_t)&sector[dasect];
auto const sec = &sector[dasect];
int32_t daz = sec->floorz;
int32_t dacz = sec->ceilingz;
@ -498,7 +498,7 @@ CollisionBase clipmove_(vec3_t * const pos, int * const sectnum, int32_t xvect,
////////// Walls //////////
auto const sec = (usectorptr_t)&sector[dasect];
auto const sec = &sector[dasect];
int const startwall = sec->wallptr;
int const endwall = startwall + sec->wallnum;
auto wal = &wall[startwall];
@ -945,7 +945,7 @@ int pushmove_(vec3_t *const vect, int *const sectnum,
const walltype* wal;
int32_t startwall, endwall;
auto sec = (usectorptr_t)&sector[clipsectorlist[clipsectcnt]];
auto sec = &sector[clipsectorlist[clipsectcnt]];
if (dir > 0)
startwall = sec->wallptr, endwall = startwall + sec->wallnum;
else
@ -1060,7 +1060,7 @@ void getzrange(const vec3_t& pos, sectortype* sect, int32_t* ceilz, CollisionBas
{
////////// Walls //////////
auto const startsec = (usectorptr_t)&sector[clipsectorlist[clipsectcnt]];
auto const startsec = &sector[clipsectorlist[clipsectcnt]];
for(auto&wal : wallsofsector(startsec))
{

View file

@ -981,12 +981,12 @@ skip: ;
static int32_t global_cf_z;
static float global_cf_xpanning, global_cf_ypanning, global_cf_heinum;
static int32_t global_cf_shade, global_cf_pal, global_cf_fogpal;
static float (*global_getzofslope_func)(usectorptr_t, float, float);
static float (*global_getzofslope_func)(const sectortype*, float, float);
static void polymost_internal_nonparallaxed(FVector2 n0, FVector2 n1, float ryp0, float ryp1, float x0, float x1,
float y0, float y1, int32_t sectnum, bool have_floor)
{
auto const sec = (usectorptr_t)&sector[sectnum];
auto const sec = &sector[sectnum];
// comments from floor code:
//(singlobalang/-16384*(sx-ghalfx) + 0*(sy-ghoriz) + (cosviewingrangeglobalang/16384)*ghalfx)*d + globalposx = u*16
@ -1124,7 +1124,7 @@ static void polymost_internal_nonparallaxed(FVector2 n0, FVector2 n1, float ryp0
py[0] = y0;
py[1] = y1;
py[2] = double(global_getzofslope_func((usectorptr_t)sec, oxy.X, oxy.Y) - globalposz) * oy2 + ghoriz;
py[2] = double(global_getzofslope_func(sec, oxy.X, oxy.Y) - globalposz) * oy2 + ghoriz;
FVector3 oxyz[2] = { { (float)(py[1] - py[2]), (float)(py[2] - py[0]), (float)(py[0] - py[1]) },
{ (float)(px[2] - px[1]), (float)(px[0] - px[2]), (float)(px[1] - px[0]) } };
@ -1244,21 +1244,21 @@ static inline int polymost_getclosestpointonwall(vec2_t const * const pos, int32
return 0;
}
static float fgetceilzofslope(usectorptr_t sec, float dax, float day)
static float fgetceilzofslope(const sectortype* sec, float dax, float day)
{
float z;
calcSlope(sec, dax, day, &z, nullptr);
return z;
}
static float fgetflorzofslope(usectorptr_t sec, float dax, float day)
static float fgetflorzofslope(const sectortype* sec, float dax, float day)
{
float z;
calcSlope(sec, dax, day, nullptr, &z);
return z;
}
static void fgetzsofslope(usectorptr_t sec, float dax, float day, float* ceilz, float *florz)
static void fgetzsofslope(const sectortype* sec, float dax, float day, float* ceilz, float *florz)
{
calcSlope(sec, dax, day, ceilz, florz);
}
@ -1467,7 +1467,7 @@ static void polymost_drawalls(int32_t const bunch)
drawpoly_blend = 0;
int32_t const sectnum = thesector[bunchfirst[bunch]];
auto const sec = (usectorptr_t)&sector[sectnum];
auto const sec = &sector[sectnum];
float const fglobalang = FixedToFloat(qglobalang);
polymost_outputGLDebugMessage(3, "polymost_drawalls(bunch:%d)", bunch);
@ -1480,7 +1480,7 @@ static void polymost_drawalls(int32_t const bunch)
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;
auto const nextsec = nextsectnum>=0 ? &sector[nextsectnum] : NULL;
//Offset&Rotate 3D coordinates to screen 3D space
FVector2 walpos = { (float)(wal->pos.X-globalposx), (float)(wal->pos.Y-globalposy) };
@ -1536,10 +1536,10 @@ static void polymost_drawalls(int32_t const bunch)
float cz, fz;
fgetzsofslope((usectorptr_t)sec,n0.X,n0.Y,&cz,&fz);
fgetzsofslope(sec,n0.X,n0.Y,&cz,&fz);
float const cy0 = (cz-globalposz)*ryp0 + ghoriz, fy0 = (fz-globalposz)*ryp0 + ghoriz;
fgetzsofslope((usectorptr_t)sec,n1.X,n1.Y,&cz,&fz);
fgetzsofslope(sec,n1.X,n1.Y,&cz,&fz);
float const cy1 = (cz-globalposz)*ryp1 + ghoriz, fy1 = (fz-globalposz)*ryp1 + ghoriz;
xtex2.d = (ryp0 - ryp1)*gxyaspect / (x0 - x1);
@ -1676,10 +1676,10 @@ static void polymost_drawalls(int32_t const bunch)
if (nextsectnum >= 0)
{
fgetzsofslope((usectorptr_t)&sector[nextsectnum],n0.X,n0.Y,&cz,&fz);
fgetzsofslope(&sector[nextsectnum],n0.X,n0.Y,&cz,&fz);
float const ocy0 = (cz-globalposz)*ryp0 + ghoriz;
float const ofy0 = (fz-globalposz)*ryp0 + ghoriz;
fgetzsofslope((usectorptr_t)&sector[nextsectnum],n1.X,n1.Y,&cz,&fz);
fgetzsofslope(&sector[nextsectnum],n1.X,n1.Y,&cz,&fz);
float const ocy1 = (cz-globalposz)*ryp1 + ghoriz;
float const ofy1 = (fz-globalposz)*ryp1 + ghoriz;
@ -2296,9 +2296,9 @@ static void polymost_drawmaskwallinternal(int32_t 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];
auto const sec = &sector[sectnum];
auto const nsec = (usectorptr_t)wal->nextSector();
auto const nsec = wal->nextSector();
polymost_outputGLDebugMessage(3, "polymost_drawmaskwallinternal(wallIndex:%d)", wallIndex);
@ -2655,7 +2655,7 @@ void polymost_drawsprite(int32_t snum)
if (bad_tspr(tspr))
return;
usectorptr_t sec;
const sectortype* sec;
auto actor = tspr->ownerActor;
@ -2696,7 +2696,7 @@ void polymost_drawsprite(int32_t snum)
drawpoly_alpha = actor->sprext.alpha;
drawpoly_blend = tspr->blend;
sec = (usectorptr_t)tspr->sector();
sec = tspr->sector();
while (!(actor->sprext.flags & SPREXT_NOTMD))
{

View file

@ -196,21 +196,21 @@ void PlanesAtPoint(const sectortype* sec, float dax, float day, float* pceilz, f
//
//==========================================================================
int32_t getceilzofslopeptr(usectorptr_t sec, int32_t dax, int32_t day)
int getceilzofslopeptr(const sectortype* sec, int dax, int day)
{
float z;
calcSlope(sec, dax, day, &z, nullptr);
return int(z);
}
int32_t getflorzofslopeptr(usectorptr_t sec, int32_t dax, int32_t day)
int getflorzofslopeptr(const sectortype* sec, int dax, int day)
{
float z;
calcSlope(sec, dax, day, nullptr, &z);
return int(z);
}
void getzsofslopeptr(usectorptr_t sec, int32_t dax, int32_t day, int32_t* ceilz, int32_t* florz)
void getzsofslopeptr(const sectortype* sec, int dax, int day, int* ceilz, int* florz)
{
float c, f;
calcSlope(sec, dax, day, &c, &f);