- use access functions, all done by search & replace.

This commit is contained in:
Christoph Oelckers 2021-11-26 20:55:13 +01:00
parent 6748a39c8f
commit 12f6b05cbe
13 changed files with 110 additions and 107 deletions

View file

@ -494,7 +494,7 @@ int32_t clipmove_(vec3_t * const pos, int * const sectnum, int32_t xvect, int32_
for (int j=startwall; j<endwall; j++, wal++)
{
auto const wal2 = (uwallptr_t)&wall[wal->point2];
auto const wal2 = (uwallptr_t)wal->point2Wall();
if ((wal->x < clipMin.x && wal2->x < clipMin.x) || (wal->x > clipMax.x && wal2->x > clipMax.x) ||
(wal->y < clipMin.y && wal2->y < clipMin.y) || (wal->y > clipMax.y && wal2->y > clipMax.y))
@ -884,8 +884,8 @@ 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 = wall[wal->point2].x-wal->x;
int32_t day = wall[wal->point2].y-wal->y;
int32_t dax = wal->point2Wall()->x-wal->x;
int32_t day = wal->point2Wall()->y-wal->y;
int32_t daz = dax*((vect->x)-wal->x) + day*((vect->y)-wal->y);
int32_t t;
if (daz <= 0)
@ -906,7 +906,7 @@ int pushmove_(vec3_t *const vect, int *const sectnum,
if (j != 0)
{
j = getangle(wall[wal->point2].x-wal->x, wall[wal->point2].y-wal->y);
j = getangle(wal->point2Wall()->x-wal->x, wal->point2Wall()->y-wal->y);
int32_t dx = -bsin(j, -11);
int32_t dy = bcos(j, -11);
int bad2 = 16;
@ -1051,24 +1051,25 @@ void getzrange_(const vec3_t *pos, int16_t sectnum,
SectIterator it(clipsectorlist[i]);
while ((j = it.NextIndex()) >= 0)
{
const int32_t cstat = sprite[j].cstat;
auto spr = &sprite[j];
const int32_t cstat = spr->cstat;
int32_t daz = 0, daz2 = 0;
if (sprite[j].cstat2 & CSTAT2_SPRITE_NOFIND) continue;
if (spr->cstat2 & CSTAT2_SPRITE_NOFIND) continue;
if (cstat&dasprclipmask)
{
int32_t clipyou = 0;
vec2_t v1 = sprite[j].pos.vec2;
vec2_t v1 = spr->pos.vec2;
switch (cstat & CSTAT_SPRITE_ALIGNMENT_MASK)
{
case CSTAT_SPRITE_ALIGNMENT_FACING:
{
int32_t k = walldist+(sprite[j].clipdist<<2)+1;
int32_t k = walldist+(spr->clipdist<<2)+1;
if ((abs(v1.x-pos->x) <= k) && (abs(v1.y-pos->y) <= k))
{
daz = sprite[j].z + spriteheightofs(j, &k, 1);
daz = spr->z + spriteheightofs(j, &k, 1);
daz2 = daz - k;
clipyou = 1;
}
@ -1083,7 +1084,7 @@ void getzrange_(const vec3_t *pos, int16_t sectnum,
if (clipinsideboxline(pos->x,pos->y,v1.x,v1.y,v2.x,v2.y,walldist+1) != 0)
{
int32_t k;
daz = sprite[j].z + spriteheightofs(j, &k, 1);
daz = spr->z + spriteheightofs(j, &k, 1);
daz2 = daz-k;
clipyou = 1;
}
@ -1092,7 +1093,7 @@ void getzrange_(const vec3_t *pos, int16_t sectnum,
case CSTAT_SPRITE_ALIGNMENT_FLOOR:
{
daz = sprite[j].z; daz2 = daz;
daz = spr->z; daz2 = daz;
if ((cstat&64) != 0 && (pos->z > daz) == ((cstat&8)==0))
continue;
@ -1101,8 +1102,8 @@ void getzrange_(const vec3_t *pos, int16_t sectnum,
get_floorspr_points((uspriteptr_t) &sprite[j], pos->x, pos->y, &v1.x, &v2.x, &v3.x, &v4.x,
&v1.y, &v2.y, &v3.y, &v4.y);
vec2_t const da = { MulScale(bcos(sprite[j].ang - 256), walldist + 4, 14),
MulScale(bsin(sprite[j].ang - 256), walldist + 4, 14) };
vec2_t const da = { MulScale(bcos(spr->ang - 256), walldist + 4, 14),
MulScale(bsin(spr->ang - 256), walldist + 4, 14) };
v1.x += da.x; v2.x -= da.y; v3.x -= da.x; v4.x += da.y;
v1.y += da.y; v2.y += da.x; v3.y -= da.y; v4.y -= da.x;
@ -1197,8 +1198,8 @@ static int32_t hitscan_trysector(const vec3_t *sv, usectorptr_t sec, hitdata_t *
if (stat&2)
{
auto const wal = (uwallptr_t)&wall[sec->wallptr];
auto const wal2 = (uwallptr_t)&wall[wal->point2];
auto const wal = (uwallptr_t)sec->firstWall();
auto const wal2 = (uwallptr_t)wal->point2Wall();
int32_t j, dax=wal2->x-wal->x, day=wal2->y-wal->y;
i = ksqrt(compat_maybe_truncate_to_int32(uhypsq(dax,day))); if (i == 0) return 1; //continue;
@ -1306,7 +1307,7 @@ int32_t hitscan_(const vec3_t *sv, int16_t sectnum, int32_t vx, int32_t vy, int3
for (z=startwall; z<endwall; z++)
{
auto const wal = (uwallptr_t)&wall[z];
auto const wal2 = (uwallptr_t)&wall[wal->point2];
auto const wal2 = (uwallptr_t)wal->point2Wall();
int const nextsector = wal->nextsector;

View file

@ -689,7 +689,7 @@ int32_t inside(int32_t x, int32_t y, int sectnum)
if (validSectorIndex(sectnum))
{
uint32_t cnt = 0;
auto wal = (uwallptr_t)&wall[sector[sectnum].wallptr];
auto wal = (uwallptr_t)sector[sectnum].firstWall();
int wallsleft = sector[sectnum].wallnum;
do
@ -697,7 +697,7 @@ int32_t inside(int32_t x, int32_t y, int sectnum)
// Get the x and y components of the [tested point]-->[wall
// point{1,2}] vectors.
vec2_t v1 = { wal->x - x, wal->y - y };
auto const &wal2 = *(uwallptr_t)&wall[wal->point2];
auto const &wal2 = *(uwallptr_t)wal->point2Wall();
vec2_t v2 = { wal2.x - x, wal2.y - y };
// If their signs differ[*], ...
@ -812,7 +812,7 @@ int32_t nextsectorneighborz(int16_t sectnum, int32_t refz, int16_t topbottom, in
int32_t nextz = (direction==1) ? INT32_MAX : INT32_MIN;
int32_t sectortouse = -1;
auto wal = (uwallptr_t)&wall[sector[sectnum].wallptr];
auto wal = (uwallptr_t)sector[sectnum].firstWall();
int32_t i = sector[sectnum].wallnum;
do
@ -862,9 +862,9 @@ int32_t cansee(int32_t x1, int32_t y1, int32_t z1, int16_t sect1, int32_t x2, in
auto const sec = (usectorptr_t)&sector[dasectnum];
uwallptr_t wal;
int cnt;
for (cnt=sec->wallnum,wal=(uwallptr_t)&wall[sec->wallptr]; cnt>0; cnt--,wal++)
for (cnt=sec->wallnum,wal=(uwallptr_t)sec->firstWall(); cnt>0; cnt--,wal++)
{
auto const wal2 = (uwallptr_t)&wall[wal->point2];
auto const wal2 = (uwallptr_t)wal->point2Wall();
const int32_t x31 = wal->x-x1, x34 = wal->x-wal2->x;
const int32_t y31 = wal->y-y1, y34 = wal->y-wal2->y;
@ -942,7 +942,7 @@ void neartag_(int32_t xs, int32_t ys, int32_t zs, int16_t sectnum, int16_t ange,
for (z=startwall,wal=(uwallptr_t)&wall[startwall]; z<=endwall; z++,wal++)
{
auto const wal2 = (uwallptr_t)&wall[wal->point2];
auto const wal2 = (uwallptr_t)wal->point2Wall();
const int32_t nextsector = wal->nextsector;
const int32_t x1=wal->x, y1=wal->y, x2=wal2->x, y2=wal2->y;
@ -1019,15 +1019,16 @@ void dragpoint(int w, int32_t dax, int32_t day)
while (1)
{
sector[wall[w].sector].dirty = 255;
wall[w].x = dax;
wall[w].y = day;
auto wal = &wall[w];
sector[wal->sector].dirty = 255;
wal->x = dax;
wal->y = day;
walbitmap.Set(w);
if (!clockwise) //search points CCW
{
if (wall[w].nextwall >= 0)
w = wall[wall[w].nextwall].point2;
if (wal->nextwall >= 0)
w = wall[wal->nextwall].point2;
else
{
w = tmpstartwall;
@ -1339,8 +1340,8 @@ int32_t getceilzofslopeptr(usectorptr_t sec, int32_t dax, int32_t day)
if (!(sec->ceilingstat&2))
return sec->ceilingz;
auto const wal = (uwallptr_t)&wall[sec->wallptr];
auto const wal2 = (uwallptr_t)&wall[wal->point2];
auto const wal = (uwallptr_t)sec->firstWall();
auto const wal2 = (uwallptr_t)wal->point2Wall();
vec2_t const w = *(vec2_t const *)wal;
vec2_t const d = { wal2->x - w.x, wal2->y - w.y };
@ -1358,8 +1359,8 @@ int32_t getflorzofslopeptr(usectorptr_t sec, int32_t dax, int32_t day)
if (!(sec->floorstat&2))
return sec->floorz;
auto const wal = (uwallptr_t)&wall[sec->wallptr];
auto const wal2 = (uwallptr_t)&wall[wal->point2];
auto const wal = (uwallptr_t)sec->firstWall();
auto const wal2 = (uwallptr_t)wal->point2Wall();
vec2_t const w = *(vec2_t const *)wal;
vec2_t const d = { wal2->x - w.x, wal2->y - w.y };
@ -1379,8 +1380,8 @@ void getzsofslopeptr(usectorptr_t sec, int32_t dax, int32_t day, int32_t *ceilz,
if (((sec->ceilingstat|sec->floorstat)&2) != 2)
return;
auto const wal = (uwallptr_t)&wall[sec->wallptr];
auto const wal2 = (uwallptr_t)&wall[wal->point2];
auto const wal = (uwallptr_t)sec->firstWall();
auto const wal2 = (uwallptr_t)wal->point2Wall();
vec2_t const d = { wal2->x - wal->x, wal2->y - wal->y };
@ -1401,8 +1402,8 @@ void getzsofslopeptr(usectorptr_t sec, int32_t dax, int32_t day, int32_t *ceilz,
void alignceilslope(int16_t dasect, int32_t x, int32_t y, int32_t z)
{
auto const wal = (uwallptr_t)&wall[sector[dasect].wallptr];
const int32_t dax = wall[wal->point2].x-wal->x;
const int32_t day = wall[wal->point2].y-wal->y;
const int32_t dax = wal->point2Wall()->x-wal->x;
const int32_t day = wal->point2Wall()->y-wal->y;
const int32_t i = (y-wal->y)*dax - (x-wal->x)*day;
if (i == 0)
@ -1422,8 +1423,8 @@ void alignceilslope(int16_t dasect, int32_t x, int32_t y, int32_t z)
void alignflorslope(int16_t dasect, int32_t x, int32_t y, int32_t z)
{
auto const wal = (uwallptr_t)&wall[sector[dasect].wallptr];
const int32_t dax = wall[wal->point2].x-wal->x;
const int32_t day = wall[wal->point2].y-wal->y;
const int32_t dax = wal->point2Wall()->x-wal->x;
const int32_t day = wal->point2Wall()->y-wal->y;
const int32_t i = (y-wal->y)*dax - (x-wal->x)*day;
if (i == 0)

View file

@ -999,8 +999,8 @@ static void polymost_internal_nonparallaxed(FVector2 n0, FVector2 n1, float ryp0
if (globalorientation & 64)
{
//relative alignment
vec2_t const xy = { wall[wall[sec->wallptr].point2].x - wall[sec->wallptr].x,
wall[wall[sec->wallptr].point2].y - wall[sec->wallptr].y };
vec2_t const xy = { wall[sec->firstWall()->point2].x - sec->firstWall()->x,
wall[sec->firstWall()->point2].y - sec->firstWall()->y };
float r;
int length = ksqrt(uhypsq(xy.x, xy.y));
@ -1016,8 +1016,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 - wall[sec->wallptr].x)) * fxy.X + ((float)(globalposy - wall[sec->wallptr].y)) * fxy.Y;
ft[1] = ((float)(globalposy - wall[sec->wallptr].y)) * fxy.X - ((float)(globalposx - wall[sec->wallptr].x)) * fxy.Y;
ft[0] = ((float)(globalposx - sec->firstWall()->x)) * fxy.X + ((float)(globalposy - sec->firstWall()->y)) * fxy.Y;
ft[1] = ((float)(globalposy - sec->firstWall()->y)) * fxy.X - ((float)(globalposx - sec->firstWall()->x)) * fxy.Y;
ft[2] = fcosglobalang * fxy.X + fsinglobalang * fxy.Y;
ft[3] = fsinglobalang * fxy.X - fcosglobalang * fxy.Y;
@ -1247,8 +1247,8 @@ static float fgetceilzofslope(usectorptr_t sec, float dax, float day)
if (!(sec->ceilingstat&2))
return float(sec->ceilingz);
auto const wal = (uwallptr_t)&wall[sec->wallptr];
auto const wal2 = (uwallptr_t)&wall[wal->point2];
auto const wal = (uwallptr_t)sec->firstWall();
auto const wal2 = (uwallptr_t)wal->point2Wall();
vec2_t const w = *(vec2_t const *)wal;
vec2_t const d = { wal2->x - w.x, wal2->y - w.y };
@ -1265,8 +1265,8 @@ static float fgetflorzofslope(usectorptr_t sec, float dax, float day)
if (!(sec->floorstat&2))
return float(sec->floorz);
auto const wal = (uwallptr_t)&wall[sec->wallptr];
auto const wal2 = (uwallptr_t)&wall[wal->point2];
auto const wal = (uwallptr_t)sec->firstWall();
auto const wal2 = (uwallptr_t)wal->point2Wall();
vec2_t const w = *(vec2_t const *)wal;
vec2_t const d = { wal2->x - w.x, wal2->y - w.y };
@ -1285,8 +1285,8 @@ static void fgetzsofslope(usectorptr_t sec, float dax, float day, float* ceilz,
if (((sec->ceilingstat|sec->floorstat)&2) != 2)
return;
auto const wal = (uwallptr_t)&wall[sec->wallptr];
auto const wal2 = (uwallptr_t)&wall[wal->point2];
auto const wal = (uwallptr_t)sec->firstWall();
auto const wal2 = (uwallptr_t)wal->point2Wall();
vec2_t const d = { wal2->x - wal->x, wal2->y - wal->y };
@ -1515,7 +1515,7 @@ 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)&wall[wal->point2];
auto const wal2 = (uwallptr_t)wal->point2Wall();
int32_t const nextsectnum = wal->nextsector;
auto const nextsec = nextsectnum>=0 ? (usectorptr_t)&sector[nextsectnum] : NULL;
@ -1949,7 +1949,7 @@ void polymost_scansector(int32_t sectnum)
for (z=startwall,wal=(uwallptr_t)&wall[z]; z<endwall; z++,wal++)
{
auto const wal2 = (uwallptr_t)&wall[wal->point2];
auto const wal2 = (uwallptr_t)wal->point2Wall();
DVector2 const fp1 = { double(wal->x - globalposx), double(wal->y - globalposy) };
DVector2 const fp2 = { double(wal2->x - globalposx), double(wal2->y - globalposy) };
@ -2332,16 +2332,16 @@ void polymost_drawrooms()
static void polymost_drawmaskwallinternal(int32_t wallIndex)
{
auto const wal = (uwallptr_t)&wall[wallIndex];
auto const wal2 = (uwallptr_t)&wall[wal->point2];
auto const wal2 = (uwallptr_t)wal->point2Wall();
if (wal->nextwall == -1) return;
int32_t const sectnum = wall[wal->nextwall].nextsector;
int32_t const sectnum = wal->nextWall()->nextsector;
auto const sec = (usectorptr_t)&sector[sectnum];
// if (wal->nextsector < 0) return;
// Without MASKWALL_BAD_ACCESS fix:
// wal->nextsector is -1, WGR2 SVN Lochwood Hollow (Til' Death L1) (or trueror1.map)
auto const nsec = (usectorptr_t)&sector[wal->nextsector];
auto const nsec = (usectorptr_t)wal->nextSector();
polymost_outputGLDebugMessage(3, "polymost_drawmaskwallinternal(wallIndex:%d)", wallIndex);

View file

@ -167,13 +167,13 @@ static void CalcMapBounds()
y_max_bound = INT_MIN;
for (int i = 0; i < numwalls; i++)
for(auto& wal : walls())
{
// get map min and max coordinates
if (wall[i].x < x_min_bound) x_min_bound = wall[i].x;
if (wall[i].y < y_min_bound) y_min_bound = wall[i].y;
if (wall[i].x > x_max_bound) x_max_bound = wall[i].x;
if (wall[i].y > y_max_bound) y_max_bound = wall[i].y;
if (wal.x < x_min_bound) x_min_bound = wal.x;
if (wal.y < y_min_bound) y_min_bound = wal.y;
if (wal.x > x_max_bound) x_max_bound = wal.x;
if (wal.y > y_max_bound) y_max_bound = wal.y;
}
}
@ -304,7 +304,7 @@ void MarkSectorSeen(int i)
i = wal->nextsector;
if (i < 0) continue;
if (wal->cstat & 0x0071) continue;
if (wall[wal->nextwall].cstat & 0x0071) continue;
if (wal->nextWall()->cstat & 0x0071) continue;
if (sector[i].lotag == 32767) continue;
if (sector[i].ceilingz >= sector[i].floorz) continue;
show2dsector.Set(i);
@ -390,13 +390,13 @@ bool ShowRedLine(int j, int i)
if (automapMode == am_full)
{
if (sector[i].floorz != sector[i].ceilingz)
if (sector[wal->nextsector].floorz != sector[wal->nextsector].ceilingz)
if (((wal->cstat | wall[wal->nextwall].cstat) & (16 + 32)) == 0)
if (sector[i].floorz == sector[wal->nextsector].floorz)
if (wal->nextSector()->floorz != wal->nextSector()->ceilingz)
if (((wal->cstat | wal->nextWall()->cstat) & (16 + 32)) == 0)
if (sector[i].floorz == wal->nextSector()->floorz)
return false;
if (sector[i].floorpicnum != sector[wal->nextsector].floorpicnum)
if (sector[i].floorpicnum != wal->nextSector()->floorpicnum)
return false;
if (sector[i].floorshade != sector[wal->nextsector].floorshade)
if (sector[i].floorshade != wal->nextSector()->floorshade)
return false;
}
return true;
@ -437,7 +437,7 @@ void drawredlines(int cposx, int cposy, int czoom, int cang)
if (s < 0 || s >= numsectors) continue;
if (sector[s].ceilingz == z1 && sector[s].floorz == z2)
if (((wal->cstat | wall[wal->nextwall].cstat) & (16 + 32)) == 0) continue;
if (((wal->cstat | wal->nextWall()->cstat) & (16 + 32)) == 0) continue;
if (ShowRedLine(j, i))
{
@ -446,7 +446,7 @@ void drawredlines(int cposx, int cposy, int czoom, int cang)
int x1 = DMulScale(ox, xvect, -oy, yvect, 16) + (width << 11);
int y1 = DMulScale(oy, xvect, ox, yvect, 16) + (height << 11);
auto wal2 = &wall[wal->point2];
auto wal2 = wal->point2Wall();
ox = wal2->x - cposx;
oy = wal2->y - cposy;
int x2 = DMulScale(ox, xvect, -oy, yvect, 16) + (width << 11);
@ -578,12 +578,13 @@ void renderDrawMapView(int cposx, int cposy, int czoom, int cang)
int s;
while ((s = it.NextIndex()) >= 0)
{
if (sprite[s].cstat & CSTAT_SPRITE_INVISIBLE)
auto spr = &sprite[s];
if (spr->cstat & CSTAT_SPRITE_INVISIBLE)
continue;
if ((sprite[s].cstat & CSTAT_SPRITE_ALIGNMENT_MASK) == CSTAT_SPRITE_ALIGNMENT_FLOOR)
if ((spr->cstat & CSTAT_SPRITE_ALIGNMENT_MASK) == CSTAT_SPRITE_ALIGNMENT_FLOOR)
{
if ((sprite[s].cstat & (CSTAT_SPRITE_ONE_SIDED | CSTAT_SPRITE_YFLIP)) == (CSTAT_SPRITE_ONE_SIDED | CSTAT_SPRITE_YFLIP))
if ((spr->cstat & (CSTAT_SPRITE_ONE_SIDED | CSTAT_SPRITE_YFLIP)) == (CSTAT_SPRITE_ONE_SIDED | CSTAT_SPRITE_YFLIP))
continue; // upside down
floorsprites.Push(s);
}
@ -640,8 +641,8 @@ void renderDrawMapView(int cposx, int cposy, int czoom, int cang)
vertices[j] = { x1 / 4096.f, y1 / 4096.f, j == 1 || j == 2 ? 1.f : 0.f, j == 2 || j == 3 ? 1.f : 0.f };
}
int shade;
if ((sector[spr->sectnum].ceilingstat & CSTAT_SECTOR_SKY)) shade = sector[spr->sectnum].ceilingshade;
else shade = sector[spr->sectnum].floorshade;
if ((spr->sector()->ceilingstat & CSTAT_SECTOR_SKY)) shade = spr->sector()->ceilingshade;
else shade = spr->sector()->floorshade;
shade += spr->shade;
PalEntry color = shadeToLight(shade);
FRenderStyle rs = LegacyRenderStyles[STYLE_Translucent];

View file

@ -157,8 +157,8 @@ void PlanesAtPoint(const sectortype* sec, int dax, int day, float* pceilz, float
if (((sec->ceilingstat | sec->floorstat) & CSTAT_SECTOR_SLOPE) == CSTAT_SECTOR_SLOPE)
{
auto wal = &wall[sec->wallptr];
auto wal2 = &wall[wal->point2];
auto wal = sec->firstWall();
auto wal2 = wal->point2Wall();
float dx = float(wal2->x - wal->x);
float dy = float(wal2->y - wal->y);

View file

@ -255,8 +255,8 @@ inline int I_GetBuildTime()
inline int32_t getangle(walltype* wal)
{
return getangle(
wall[wal->point2].x - wal->x,
wall[wal->point2].y - wal->y);
wal->point2Wall()->x - wal->x,
wal->point2Wall()->y - wal->y);
}
inline TArrayView<sectortype> sectors()

View file

@ -349,11 +349,11 @@ static void ReadSpriteV5(FileReader& fr, spritetype& spr)
spr.hitag = fr.ReadInt16();
spr.extra = fr.ReadInt16();
int sec = spr.sectnum;
if ((sector[sec].ceilingstat & 1) > 0)
spr.pal = sector[sec].ceilingpal;
auto sec = spr.sector();
if ((sec->ceilingstat & 1) > 0)
spr.pal = sec->ceilingpal;
else
spr.pal = sector[sec].floorpal;
spr.pal = sec->floorpal;
spr.blend = 0;
spr.clipdist = 32;

View file

@ -77,12 +77,13 @@ void hw_BuildSections()
numsections = numsectors;
for (int i = 0; i < numwalls; i++)
{
auto& wal = wall[i];
sectionLines[i].startpoint = sectionLines[i].wall = i;
sectionLines[i].endpoint = wall[i].point2;
sectionLines[i].partner = wall[i].nextwall;
sectionLines[i].section = wall[i].sector;
sectionLines[i].partnersection = wall[i].nextsector;
sectionLines[i].point2index = wall[i].point2 - sector[wall[i].sector].wallptr;
sectionLines[i].endpoint = wal.point2;
sectionLines[i].partner = wal.nextwall;
sectionLines[i].section = wal.sector;
sectionLines[i].partnersection = wal.nextsector;
sectionLines[i].point2index = wal.point2 - wal.sectorp()->wallptr;
}
for (unsigned i = 0; i < splits.Size(); i += 3)

View file

@ -145,9 +145,9 @@ void BunchDrawer::DeleteBunch(int index)
bool BunchDrawer::CheckClip(walltype* wal)
{
auto pt2 = &wall[wal->point2];
sectortype* backsector = &sector[wal->nextsector];
sectortype* frontsector = &sector[wall[wal->nextwall].nextsector];
auto pt2 = wal->point2Wall();
sectortype* backsector = wal->nextSector();
sectortype* frontsector = wal->sectorp();
// if one plane is sky on both sides, the line must not clip.
if (frontsector->ceilingstat & backsector->ceilingstat & CSTAT_SECTOR_SKY) return false;

View file

@ -49,7 +49,7 @@
static int GetClosestPointOnWall(spritetype* spr, walltype* wal, vec2_t* const n)
{
auto w = wal->pos;
auto d = wall[wal->point2].pos - w;
auto d = wal->point2Wall()->pos - w;
auto pos = spr->pos;
// avoid the math below for orthogonal walls. Here we allow only sprites that exactly match the line's coordinate and orientation
@ -116,8 +116,8 @@ static int IsOnWall(spritetype* tspr, int height)
for (int i = sect->wallptr; i < sect->wallptr + sect->wallnum; i++)
{
auto wal = &wall[i];
if ((wal->nextsector == -1 || ((sector[wal->nextsector].ceilingz > topz) ||
sector[wal->nextsector].floorz < tspr->z)) && !GetClosestPointOnWall(tspr, wal, &n))
if ((wal->nextsector == -1 || ((wal->nextSector()->ceilingz > topz) ||
wal->nextSector()->floorz < tspr->z)) && !GetClosestPointOnWall(tspr, wal, &n))
{
int const dst = abs(tspr->x - n.x) + abs(tspr->y - n.y);
@ -850,7 +850,7 @@ void HWWall::DoOneSidedTexture(HWDrawInfo* di, walltype* wal, sectortype* fronts
if ((wal->cstat & CSTAT_WALL_1WAY) && backsector)
{
if ((!(wal->cstat & CSTAT_WALL_BOTTOM_SWAP) && (wal->cstat & CSTAT_WALL_1WAY)) ||
((wal->cstat & CSTAT_WALL_BOTTOM_SWAP) && (wall[wal->nextwall].cstat & CSTAT_WALL_ALIGN_BOTTOM)))
((wal->cstat & CSTAT_WALL_BOTTOM_SWAP) && (wal->nextWall()->cstat & CSTAT_WALL_ALIGN_BOTTOM)))
refheight = frontsector->ceilingz;
else
refheight = backsector->floorz;
@ -891,7 +891,7 @@ void HWWall::DoLowerTexture(HWDrawInfo* di, walltype* wal, sectortype* frontsect
{
// get the alignment reference position.
int refheight;
auto refwall = (wal->cstat & CSTAT_WALL_BOTTOM_SWAP) ? &wall[wal->nextwall] : wal;
auto refwall = (wal->cstat & CSTAT_WALL_BOTTOM_SWAP) ? wal->nextWall() : wal;
refheight = (refwall->cstat & CSTAT_WALL_ALIGN_BOTTOM) ? frontsector->ceilingz : backsector->floorz;
shade = refwall->shade;
@ -952,8 +952,8 @@ void HWWall::DoMidTexture(HWDrawInfo* di, walltype* wal,
//==========================================================================
void HWWall::Process(HWDrawInfo* di, walltype* wal, sectortype* frontsector, sectortype* backsector)
{
auto backwall = wal->nextwall >= 0 && wal->nextwall < numwalls ? &wall[wal->nextwall] : nullptr;
auto p2wall = &wall[wal->point2];
auto backwall = wal->twoSided()? wal->nextWall() : nullptr;
auto p2wall = wal->point2Wall();
float fch1;
float ffh1;

View file

@ -55,7 +55,7 @@ static FVector3 CalcNormal(sectortype* sector, int plane)
FVector3 pt[3];
auto wal = &wall[sector->wallptr];
auto wal2 = &wall[wal->point2];
auto wal2 = wal->point2Wall();
pt[0] = { (float)WallStartX(wal), (float)WallStartY(wal), 0 };
pt[1] = { (float)WallEndX(wal), (float)WallEndY(wal), 0 };
@ -115,7 +115,7 @@ public:
myplane = plane;
offset = off;
auto firstwall = &wall[sec->wallptr];
auto firstwall = sec->firstWall();
ix1 = firstwall->x;
iy1 = firstwall->y;
ix2 = wall[firstwall->point2].x;
@ -554,8 +554,8 @@ void SectorGeometry::ValidateSector(unsigned int secnum, int plane, const FVecto
((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_ &&
wall[sec->wallptr].pos == data[secnum].poscompare[0] &&
wall[wall[sec->wallptr].point2].pos == data[secnum].poscompare2[0] &&
sec->firstWall()->pos == data[secnum].poscompare[0] &&
wall[sec->firstWall()->point2].pos == data[secnum].poscompare2[0] &&
!(sec->dirty & 1) && data[secnum].planes[plane].vertices.Size() ) return;
sec->dirty &= ~1;
@ -567,15 +567,15 @@ void SectorGeometry::ValidateSector(unsigned int secnum, int plane, const FVecto
((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_ &&
wall[sec->wallptr].pos == data[secnum].poscompare[1] &&
wall[wall[sec->wallptr].point2].pos == data[secnum].poscompare2[1] &&
sec->firstWall()->pos == data[secnum].poscompare[1] &&
wall[sec->firstWall()->point2].pos == data[secnum].poscompare2[1] &&
!(sec->dirty & 2) && data[secnum].planes[1].vertices.Size()) return;
sec->dirty &= ~2;
}
*compare = *sec;
data[secnum].poscompare[plane] = wall[sec->wallptr].pos;
data[secnum].poscompare2[plane] = wall[wall[sec->wallptr].point2].pos;
data[secnum].poscompare[plane] = sec->firstWall()->pos;
data[secnum].poscompare2[plane] = wall[sec->firstWall()->point2].pos;
if (data[secnum].degenerate || !MakeVertices(secnum, plane, offset))
{
data[secnum].degenerate = true;

View file

@ -1648,16 +1648,16 @@ void ExplodeEnergyBlock(DExhumedActor* pActor)
for(auto& wal : wallsofsector(pSector))
{
if (!wal.twoSided()) continue;
auto nextwall = wal.nextWall();
auto nextwal = wal.nextWall();
if (nextwall->pal >= 4) {
nextwall->pal = 7;
if (nextwal->pal >= 4) {
nextwal->pal = 7;
}
else {
nextwall->pal = 0;
nextwal->pal = 0;
}
nextwall->shade = 50;
nextwal->shade = 50;
}
if (pSector->floorpal >= 4) {

View file

@ -260,7 +260,6 @@ void DoSlidorInterp(DSWActor* actor, INTERP_FUNC interp_func)
}
else
{
auto nextwall = wal->nextWall();
// red wall - move 2 points
interp_func(wal, type);
interp_func(wal->nextWall()->point2Wall(), type);