Skip to content

Commit

Permalink
- sector[tspr->sectnum] globally replaced.
Browse files Browse the repository at this point in the history
  • Loading branch information
coelckers committed Dec 4, 2021
1 parent 349b465 commit 1f61098
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 23 deletions.
2 changes: 1 addition & 1 deletion source/build/src/mdsprite.cpp
Expand Up @@ -1361,7 +1361,7 @@ static int32_t polymost_md3draw(md3model_t *m, tspriteptr_t tspr)
continue;

int palid = TRANSLATION(Translation_Remap + curbasepal, globalpal);
GLInterface.SetFade(sector[tspr->sectnum].floorpal);
GLInterface.SetFade(tspr->sector()->floorpal);
GLInterface.SetTexture(tex, palid, CLAMP_XY);

if (tspr->clipdist & TSPR_FLAGS_MDHACK)
Expand Down
32 changes: 16 additions & 16 deletions source/build/src/polymost.cpp
Expand Up @@ -2633,7 +2633,7 @@ void polymost_deletesprite(int num)
static inline int32_t polymost_findwall(tspritetype const * const tspr, vec2_t const * const tsiz, int32_t * rd)
{
int32_t dist = 4, closest = -1;
auto const sect = &sector[tspr->sectnum];
auto const sect = tspr->sector();
vec2_t n;

for (bssize_t i=sect->wallptr; i<sect->wallptr + sect->wallnum; i++)
Expand Down Expand Up @@ -2716,7 +2716,7 @@ void polymost_drawsprite(int32_t snum)
globalpicnum = tspr->picnum;
globalshade = tspr->shade;
globalpal = tspr->pal;
globalfloorpal = sector[tspr->sectnum].floorpal;
globalfloorpal = tspr->sector()->floorpal;
globalorientation = tspr->cstat;

GLInterface.SetVisibility(sectorVisibility(tspr->sectnum));
Expand All @@ -2740,7 +2740,7 @@ void polymost_drawsprite(int32_t snum)
drawpoly_alpha = spriteext[spritenum].alpha;
drawpoly_blend = tspr->blend;

sec = (usectorptr_t)&sector[tspr->sectnum];
sec = (usectorptr_t)tspr->sector();

while (!(spriteext[spritenum].flags & SPREXT_NOTMD))
{
Expand Down Expand Up @@ -2881,16 +2881,16 @@ void polymost_drawsprite(int32_t snum)
}

// Clip sprites to ceilings/floors when no parallaxing and not sloped
if (!(sector[tspr->sectnum].ceilingstat & 3))
if (!(tspr->sector()->ceilingstat & 3))
{
s0.y = ((float) (sector[tspr->sectnum].ceilingz - globalposz)) * gyxscale * ryp0 + ghoriz;
s0.y = ((float) (tspr->sector()->ceilingz - globalposz)) * gyxscale * ryp0 + ghoriz;
if (pxy[0].y < s0.y)
pxy[0].y = pxy[1].y = s0.y;
}

if (!(sector[tspr->sectnum].floorstat & 3))
if (!(tspr->sector()->floorstat & 3))
{
s0.y = ((float) (sector[tspr->sectnum].floorz - globalposz)) * gyxscale * ryp0 + ghoriz;
s0.y = ((float) (tspr->sector()->floorz - globalposz)) * gyxscale * ryp0 + ghoriz;
if (pxy[2].y > s0.y)
pxy[2].y = pxy[3].y = s0.y;
}
Expand Down Expand Up @@ -3054,20 +3054,20 @@ void polymost_drawsprite(int32_t snum)
}

// Clip sprites to ceilings/floors when no parallaxing
if (!(sector[tspr->sectnum].ceilingstat & 1))
if (!(tspr->sector()->ceilingstat & 1))
{
if (sector[tspr->sectnum].ceilingz > pos.z - (float)((tspr->yrepeat * tsiz.y) << 2))
if (tspr->sector()->ceilingz > pos.z - (float)((tspr->yrepeat * tsiz.y) << 2))
{
sc0 = (float)(sector[tspr->sectnum].ceilingz - globalposz) * ryp0 + ghoriz;
sc1 = (float)(sector[tspr->sectnum].ceilingz - globalposz) * ryp1 + ghoriz;
sc0 = (float)(tspr->sector()->ceilingz - globalposz) * ryp0 + ghoriz;
sc1 = (float)(tspr->sector()->ceilingz - globalposz) * ryp1 + ghoriz;
}
}
if (!(sector[tspr->sectnum].floorstat & 1))
if (!(tspr->sector()->floorstat & 1))
{
if (sector[tspr->sectnum].floorz < pos.z)
if (tspr->sector()->floorz < pos.z)
{
sf0 = (float)(sector[tspr->sectnum].floorz - globalposz) * ryp0 + ghoriz;
sf1 = (float)(sector[tspr->sectnum].floorz - globalposz) * ryp1 + ghoriz;
sf0 = (float)(tspr->sector()->floorz - globalposz) * ryp0 + ghoriz;
sf1 = (float)(tspr->sector()->floorz - globalposz) * ryp1 + ghoriz;
}
}

Expand Down Expand Up @@ -3924,7 +3924,7 @@ int32_t polymost_voxdraw(voxmodel_t* m, tspriteptr_t const tspr, bool rotate)
GLInterface.SetMatrix(Matrix_Model, mat);

GLInterface.SetPalswap(globalpal);
GLInterface.SetFade(sector[tspr->sectnum].floorpal);
GLInterface.SetFade(tspr->sector()->floorpal);

auto tex = TexMan.GetGameTexture(m->model->GetPaletteTexture());
GLInterface.SetTexture(tex, TRANSLATION(Translation_Remap + curbasepal, globalpal), CLAMP_NOFILTER_XY, true);
Expand Down
8 changes: 4 additions & 4 deletions source/core/rendering/scene/hw_drawinfo.cpp
Expand Up @@ -309,7 +309,7 @@ void HWDrawInfo::DispatchSprites()
{
HWSprite hwsprite;
int num = tilenum;
hwsprite.ProcessVoxel(this, voxmodels[tspr->picnum], tspr, &sector[tspr->sectnum], voxrotate[num]);
hwsprite.ProcessVoxel(this, voxmodels[tspr->picnum], tspr, tspr->sector(), voxrotate[num]);
continue;
}
}
Expand All @@ -331,21 +331,21 @@ void HWDrawInfo::DispatchSprites()
case CSTAT_SPRITE_ALIGNMENT_FACING:
{
HWSprite sprite;
sprite.Process(this, tspr, &sector[tspr->sectnum], false);
sprite.Process(this, tspr, tspr->sector(), false);
break;
}

case CSTAT_SPRITE_ALIGNMENT_WALL:
{
HWWall wall;
wall.ProcessWallSprite(this, tspr, &sector[tspr->sectnum]);
wall.ProcessWallSprite(this, tspr, tspr->sector());
break;
}

case CSTAT_SPRITE_ALIGNMENT_FLOOR:
{
HWFlat flat;
flat.ProcessFlatSprite(this, tspr, &sector[tspr->sectnum]);
flat.ProcessFlatSprite(this, tspr, tspr->sector());
break;
}

Expand Down
2 changes: 1 addition & 1 deletion source/core/rendering/scene/hw_walls.cpp
Expand Up @@ -109,7 +109,7 @@ static int GetClosestPointOnWall(spritetype* spr, walltype* wal, vec2_t* const n
static int IsOnWall(spritetype* tspr, int height)
{
int dist = 3, closest = -1;
auto sect = &sector[tspr->sectnum];
auto sect = tspr->sector();
vec2_t n;

int topz = (tspr->z - ((height * tspr->yrepeat) << 2));
Expand Down
2 changes: 1 addition & 1 deletion source/games/duke/src/spawn.cpp
Expand Up @@ -1098,7 +1098,7 @@ void lotsofglass(DDukeActor *actor, walltype* wal, int n)
for (j = n - 1; j >= 0; j--)
{
a = sp->ang - 256 + (krand() & 511) + 1024;
EGS(sp->sector(), sp->x, sp->y, sp->z, TILE_GLASSPIECES + (j % 3), -32, 36, 36, a, 32 + (krand() & 63), 1024 - (krand() & 1023), &hittype[j], 5);
EGS(sp->sector(), sp->x, sp->y, sp->z, TILE_GLASSPIECES + (j % 3), -32, 36, 36, a, 32 + (krand() & 63), 1024 - (krand() & 1023), actor, 5);
}
return;
}
Expand Down

0 comments on commit 1f61098

Please sign in to comment.