From 6c381d4392b7a41cf17aff40c4687ec4d7291c9f Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Thu, 30 Dec 2021 16:58:48 +0100 Subject: [PATCH] - removed sector() method from low level sprite type. --- source/build/src/mdsprite.cpp | 2 +- source/build/src/polymost.cpp | 36 +++++++------- source/core/maptypes.h | 8 --- source/core/rendering/scene/hw_drawinfo.cpp | 10 ++-- source/core/rendering/scene/hw_walls.cpp | 2 +- source/games/blood/src/animatesprite.cpp | 54 ++++++++++----------- source/games/blood/src/blood.cpp | 2 +- source/games/duke/src/_polymost.cpp | 2 +- source/games/duke/src/animatesprites_d.cpp | 12 ++--- source/games/duke/src/animatesprites_r.cpp | 8 +-- source/games/duke/src/premap.cpp | 2 +- source/games/exhumed/src/init.cpp | 2 +- source/games/exhumed/src/sequence.cpp | 2 +- source/games/exhumed/src/view.cpp | 4 +- source/games/sw/src/draw.cpp | 26 +++++----- source/games/sw/src/game.cpp | 2 +- 16 files changed, 83 insertions(+), 91 deletions(-) diff --git a/source/build/src/mdsprite.cpp b/source/build/src/mdsprite.cpp index 937800cbc..76c205f94 100644 --- a/source/build/src/mdsprite.cpp +++ b/source/build/src/mdsprite.cpp @@ -1349,7 +1349,7 @@ static int32_t polymost_md3draw(md3model_t *m, tspritetype* tspr) continue; int palid = TRANSLATION(Translation_Remap + curbasepal, globalpal); - GLInterface.SetFade(tspr->sector()->floorpal); + GLInterface.SetFade(tspr->sectp->floorpal); GLInterface.SetTexture(tex, palid, CLAMP_XY); if (tspr->clipdist & TSPR_FLAGS_MDHACK) diff --git a/source/build/src/polymost.cpp b/source/build/src/polymost.cpp index 82ccf9402..dd92751df 100644 --- a/source/build/src/polymost.cpp +++ b/source/build/src/polymost.cpp @@ -2594,7 +2594,7 @@ void polymost_completeMirror() static inline int32_t polymost_findwall(tspritetype const * const tspr, vec2_t const * const tsiz, int32_t * rd) { int32_t dist = 4; - auto const sect = tspr->sector(); + auto const sect = tspr->sectp; vec2_t n; walltype* closest = nullptr; @@ -2689,10 +2689,10 @@ void polymost_drawsprite(int32_t snum) globalpicnum = tspr->picnum; globalshade = tspr->shade; globalpal = tspr->pal; - globalfloorpal = tspr->sector()->floorpal; + globalfloorpal = tspr->sectp->floorpal; globalorientation = tspr->cstat; - GLInterface.SetVisibility(sectorVisibility(tspr->sector())); + GLInterface.SetVisibility(sectorVisibility(tspr->sectp)); vec2_t off = { 0, 0 }; @@ -2720,7 +2720,7 @@ void polymost_drawsprite(int32_t snum) drawpoly_alpha = actor->sprext.alpha; drawpoly_blend = tspr->blend; - sec = tspr->sector(); + sec = tspr->sectp; while (!(actor->sprext.flags & SPREXT_NOTMD)) { @@ -2861,16 +2861,16 @@ void polymost_drawsprite(int32_t snum) } // Clip sprites to ceilings/floors when no parallaxing and not sloped - if (!(tspr->sector()->ceilingstat & (CSTAT_SECTOR_SKY|CSTAT_SECTOR_SLOPE))) + if (!(tspr->sectp->ceilingstat & (CSTAT_SECTOR_SKY|CSTAT_SECTOR_SLOPE))) { - s0.Y = ((float) (tspr->sector()->ceilingz - globalposz)) * gyxscale * ryp0 + ghoriz; + s0.Y = ((float) (tspr->sectp->ceilingz - globalposz)) * gyxscale * ryp0 + ghoriz; if (pxy[0].Y < s0.Y) pxy[0].Y = pxy[1].Y = s0.Y; } - if (!(tspr->sector()->floorstat & (CSTAT_SECTOR_SKY | CSTAT_SECTOR_SLOPE))) + if (!(tspr->sectp->floorstat & (CSTAT_SECTOR_SKY | CSTAT_SECTOR_SLOPE))) { - s0.Y = ((float) (tspr->sector()->floorz - globalposz)) * gyxscale * ryp0 + ghoriz; + s0.Y = ((float) (tspr->sectp->floorz - globalposz)) * gyxscale * ryp0 + ghoriz; if (pxy[2].Y > s0.Y) pxy[2].Y = pxy[3].Y = s0.Y; } @@ -3013,20 +3013,20 @@ void polymost_drawsprite(int32_t snum) } // Clip sprites to ceilings/floors when no parallaxing - if (!(tspr->sector()->ceilingstat & CSTAT_SECTOR_SKY)) + if (!(tspr->sectp->ceilingstat & CSTAT_SECTOR_SKY)) { - if (tspr->sector()->ceilingz > pos.Z - (float)((tspr->yrepeat * tsiz.Y) << 2)) + if (tspr->sectp->ceilingz > pos.Z - (float)((tspr->yrepeat * tsiz.Y) << 2)) { - sc0 = (float)(tspr->sector()->ceilingz - globalposz) * ryp0 + ghoriz; - sc1 = (float)(tspr->sector()->ceilingz - globalposz) * ryp1 + ghoriz; + sc0 = (float)(tspr->sectp->ceilingz - globalposz) * ryp0 + ghoriz; + sc1 = (float)(tspr->sectp->ceilingz - globalposz) * ryp1 + ghoriz; } } - if (!(tspr->sector()->floorstat & CSTAT_SECTOR_SKY)) + if (!(tspr->sectp->floorstat & CSTAT_SECTOR_SKY)) { - if (tspr->sector()->floorz < pos.Z) + if (tspr->sectp->floorz < pos.Z) { - sf0 = (float)(tspr->sector()->floorz - globalposz) * ryp0 + ghoriz; - sf1 = (float)(tspr->sector()->floorz - globalposz) * ryp1 + ghoriz; + sf0 = (float)(tspr->sectp->floorz - globalposz) * ryp0 + ghoriz; + sf1 = (float)(tspr->sectp->floorz - globalposz) * ryp1 + ghoriz; } } @@ -3052,7 +3052,7 @@ void polymost_drawsprite(int32_t snum) break; case 2: // Floor sprite - GLInterface.SetVisibility(sectorVisibility(tspr->sector()) * (4.f/5.f)); // No idea why this uses a different visibility setting... + GLInterface.SetVisibility(sectorVisibility(tspr->sectp) * (4.f/5.f)); // No idea why this uses a different visibility setting... if ((globalorientation & 64) != 0 && (globalposz > tspriteGetZOfSlope(tspr, globalposx, globalposy)) == (!(globalorientation & 8))) @@ -3939,7 +3939,7 @@ int32_t polymost_voxdraw(voxmodel_t* m, tspritetype* const tspr, bool rotate) GLInterface.SetMatrix(Matrix_Model, mat); GLInterface.SetPalswap(globalpal); - GLInterface.SetFade(tspr->sector()->floorpal); + GLInterface.SetFade(tspr->sectp->floorpal); auto tex = TexMan.GetGameTexture(m->model->GetPaletteTexture()); GLInterface.SetTexture(tex, TRANSLATION(Translation_Remap + curbasepal, globalpal), CLAMP_NOFILTER_XY, true); diff --git a/source/core/maptypes.h b/source/core/maptypes.h index ce6268b42..a9664c4a1 100644 --- a/source/core/maptypes.h +++ b/source/core/maptypes.h @@ -526,9 +526,6 @@ struct spritetypebase backuppos(); backupang(); } - - sectortype* sector() const; - int sectno() const; }; @@ -624,11 +621,6 @@ inline bool validWallIndex(int wallnum) return (unsigned)wallnum < wall.Size(); } -inline sectortype* spritetypebase::sector() const -{ - return sectp; -} - inline sectortype* walltype::nextSector() const { return !validSectorIndex(nextsector)? nullptr : &::sector[nextsector]; diff --git a/source/core/rendering/scene/hw_drawinfo.cpp b/source/core/rendering/scene/hw_drawinfo.cpp index 4dffb49b0..c7e7744c0 100644 --- a/source/core/rendering/scene/hw_drawinfo.cpp +++ b/source/core/rendering/scene/hw_drawinfo.cpp @@ -301,14 +301,14 @@ void HWDrawInfo::DispatchSprites() { HWSprite hwsprite; int num = tiletovox[tilenum]; - if (hwsprite.ProcessVoxel(this, voxmodels[num], tspr, tspr->sector(), voxrotate[num])) + if (hwsprite.ProcessVoxel(this, voxmodels[num], tspr, tspr->sectp, voxrotate[num])) continue; } else if ((tspr->cstat & CSTAT_SPRITE_ALIGNMENT_MASK) == CSTAT_SPRITE_ALIGNMENT_SLAB && tspr->picnum < MAXVOXELS && voxmodels[tilenum]) { HWSprite hwsprite; int num = tilenum; - hwsprite.ProcessVoxel(this, voxmodels[tspr->picnum], tspr, tspr->sector(), voxrotate[num]); + hwsprite.ProcessVoxel(this, voxmodels[tspr->picnum], tspr, tspr->sectp, voxrotate[num]); continue; } } @@ -330,21 +330,21 @@ void HWDrawInfo::DispatchSprites() case CSTAT_SPRITE_ALIGNMENT_FACING: { HWSprite sprite; - sprite.Process(this, tspr, tspr->sector(), false); + sprite.Process(this, tspr, tspr->sectp, false); break; } case CSTAT_SPRITE_ALIGNMENT_WALL: { HWWall wall; - wall.ProcessWallSprite(this, tspr, tspr->sector()); + wall.ProcessWallSprite(this, tspr, tspr->sectp); break; } case CSTAT_SPRITE_ALIGNMENT_FLOOR: { HWFlat flat; - flat.ProcessFlatSprite(this, tspr, tspr->sector()); + flat.ProcessFlatSprite(this, tspr, tspr->sectp); break; } diff --git a/source/core/rendering/scene/hw_walls.cpp b/source/core/rendering/scene/hw_walls.cpp index a6a3c699a..c16d5ef73 100644 --- a/source/core/rendering/scene/hw_walls.cpp +++ b/source/core/rendering/scene/hw_walls.cpp @@ -52,7 +52,7 @@ static walltype* IsOnWall(tspritetype* tspr, int height, DVector2& outpos) { const double maxdistsq = (tspr->ang & 0x1ff)? 3 * 3 : 1; // lower tolerance for perfectly orthogonal sprites - auto sect = tspr->sector(); + auto sect = tspr->sectp; walltype* closest = nullptr; int topz = (tspr->pos.Z - ((height * tspr->yrepeat) << 2)); diff --git a/source/games/blood/src/animatesprite.cpp b/source/games/blood/src/animatesprite.cpp index 8c650e2c3..3bb5701eb 100644 --- a/source/games/blood/src/animatesprite.cpp +++ b/source/games/blood/src/animatesprite.cpp @@ -161,7 +161,7 @@ static tspritetype* viewAddEffect(tspritetype* tsprite, int& spritesortcnt, int int top, bottom; GetSpriteExtents(pTSprite, &top, &bottom); - auto pNSprite2 = viewInsertTSprite(tsprite, spritesortcnt, pTSprite->sector(), 32767, pTSprite); + auto pNSprite2 = viewInsertTSprite(tsprite, spritesortcnt, pTSprite->sectp, 32767, pTSprite); if (!pNSprite2) break; @@ -180,7 +180,7 @@ static tspritetype* viewAddEffect(tspritetype* tsprite, int& spritesortcnt, int case kViewEffectAtom: for (int i = 0; i < 16; i++) { - auto pNSprite = viewInsertTSprite(tsprite, spritesortcnt, pTSprite->sector(), 32767, pTSprite); + auto pNSprite = viewInsertTSprite(tsprite, spritesortcnt, pTSprite->sectp, 32767, pTSprite); if (!pNSprite) break; @@ -206,7 +206,7 @@ static tspritetype* viewAddEffect(tspritetype* tsprite, int& spritesortcnt, int { int top, bottom; GetSpriteExtents(pTSprite, &top, &bottom); - auto pNSprite = viewInsertTSprite(tsprite, spritesortcnt, pTSprite->sector(), 32767, pTSprite); + auto pNSprite = viewInsertTSprite(tsprite, spritesortcnt, pTSprite->sectp, 32767, pTSprite); if (!pNSprite) break; @@ -222,7 +222,7 @@ static tspritetype* viewAddEffect(tspritetype* tsprite, int& spritesortcnt, int } case kViewEffectTesla: { - auto pNSprite = viewInsertTSprite(tsprite, spritesortcnt, pTSprite->sector(), 32767, pTSprite); + auto pNSprite = viewInsertTSprite(tsprite, spritesortcnt, pTSprite->sectp, 32767, pTSprite); if (!pNSprite) break; @@ -236,7 +236,7 @@ static tspritetype* viewAddEffect(tspritetype* tsprite, int& spritesortcnt, int } case kViewEffectShoot: { - auto pNSprite = viewInsertTSprite(tsprite, spritesortcnt, pTSprite->sector(), 32767, pTSprite); + auto pNSprite = viewInsertTSprite(tsprite, spritesortcnt, pTSprite->sectp, 32767, pTSprite); if (!pNSprite) break; @@ -248,7 +248,7 @@ static tspritetype* viewAddEffect(tspritetype* tsprite, int& spritesortcnt, int } case kViewEffectReflectiveBall: { - auto pNSprite = viewInsertTSprite(tsprite, spritesortcnt, pTSprite->sector(), 32767, pTSprite); + auto pNSprite = viewInsertTSprite(tsprite, spritesortcnt, pTSprite->sectp, 32767, pTSprite); if (!pNSprite) break; @@ -261,7 +261,7 @@ static tspritetype* viewAddEffect(tspritetype* tsprite, int& spritesortcnt, int } case kViewEffectPhase: { - auto pNSprite = viewInsertTSprite(tsprite, spritesortcnt, pTSprite->sector(), 32767, pTSprite); + auto pNSprite = viewInsertTSprite(tsprite, spritesortcnt, pTSprite->sectp, 32767, pTSprite); if (!pNSprite) break; @@ -288,7 +288,7 @@ static tspritetype* viewAddEffect(tspritetype* tsprite, int& spritesortcnt, int } for (int i = 0; i < 5 && spritesortcnt < MAXSPRITESONSCREEN; i++) { - auto pSector = pTSprite->sector(); + auto pSector = pTSprite->sectp; auto pNSprite = viewInsertTSprite(tsprite, spritesortcnt, pSector, 32767, NULL); if (!pNSprite) break; @@ -316,7 +316,7 @@ static tspritetype* viewAddEffect(tspritetype* tsprite, int& spritesortcnt, int } case kViewEffectFlame: { - auto pNSprite = viewInsertTSprite(tsprite, spritesortcnt, pTSprite->sector(), 32767, pTSprite); + auto pNSprite = viewInsertTSprite(tsprite, spritesortcnt, pTSprite->sectp, 32767, pTSprite); if (!pNSprite) break; @@ -329,7 +329,7 @@ static tspritetype* viewAddEffect(tspritetype* tsprite, int& spritesortcnt, int } case kViewEffectSmokeHigh: { - auto pNSprite = viewInsertTSprite(tsprite, spritesortcnt, pTSprite->sector(), 32767, pTSprite); + auto pNSprite = viewInsertTSprite(tsprite, spritesortcnt, pTSprite->sectp, 32767, pTSprite); if (!pNSprite) break; @@ -348,7 +348,7 @@ static tspritetype* viewAddEffect(tspritetype* tsprite, int& spritesortcnt, int } case kViewEffectSmokeLow: { - auto pNSprite = viewInsertTSprite(tsprite, spritesortcnt, pTSprite->sector(), 32767, pTSprite); + auto pNSprite = viewInsertTSprite(tsprite, spritesortcnt, pTSprite->sectp, 32767, pTSprite); if (!pNSprite) break; @@ -367,7 +367,7 @@ static tspritetype* viewAddEffect(tspritetype* tsprite, int& spritesortcnt, int } case kViewEffectTorchHigh: { - auto pNSprite = viewInsertTSprite(tsprite, spritesortcnt, pTSprite->sector(), 32767, pTSprite); + auto pNSprite = viewInsertTSprite(tsprite, spritesortcnt, pTSprite->sectp, 32767, pTSprite); if (!pNSprite) break; @@ -381,7 +381,7 @@ static tspritetype* viewAddEffect(tspritetype* tsprite, int& spritesortcnt, int } case kViewEffectTorchLow: { - auto pNSprite = viewInsertTSprite(tsprite, spritesortcnt, pTSprite->sector(), 32767, pTSprite); + auto pNSprite = viewInsertTSprite(tsprite, spritesortcnt, pTSprite->sectp, 32767, pTSprite); if (!pNSprite) break; @@ -397,11 +397,11 @@ static tspritetype* viewAddEffect(tspritetype* tsprite, int& spritesortcnt, int { if (r_shadows) { - auto pNSprite = viewInsertTSprite(tsprite, spritesortcnt, pTSprite->sector(), 32767, pTSprite); + auto pNSprite = viewInsertTSprite(tsprite, spritesortcnt, pTSprite->sectp, 32767, pTSprite); if (!pNSprite) break; - pNSprite->pos.Z = getflorzofslopeptr(pTSprite->sector(), pNSprite->pos.X, pNSprite->pos.Y); + pNSprite->pos.Z = getflorzofslopeptr(pTSprite->sectp, pNSprite->pos.X, pNSprite->pos.Y); pNSprite->shade = 127; pNSprite->cstat |= CSTAT_SPRITE_TRANSLUCENT; pNSprite->xrepeat = pTSprite->xrepeat; @@ -416,7 +416,7 @@ static tspritetype* viewAddEffect(tspritetype* tsprite, int& spritesortcnt, int } case kViewEffectFlareHalo: { - auto pNSprite = viewInsertTSprite(tsprite, spritesortcnt, pTSprite->sector(), 32767, pTSprite); + auto pNSprite = viewInsertTSprite(tsprite, spritesortcnt, pTSprite->sectp, 32767, pTSprite); if (!pNSprite) break; @@ -431,11 +431,11 @@ static tspritetype* viewAddEffect(tspritetype* tsprite, int& spritesortcnt, int } case kViewEffectCeilGlow: { - auto pNSprite = viewInsertTSprite(tsprite, spritesortcnt, pTSprite->sector(), 32767, pTSprite); + auto pNSprite = viewInsertTSprite(tsprite, spritesortcnt, pTSprite->sectp, 32767, pTSprite); if (!pNSprite) break; - sectortype* pSector = pTSprite->sector(); + sectortype* pSector = pTSprite->sectp; pNSprite->pos.X = pTSprite->pos.X; pNSprite->pos.Y = pTSprite->pos.Y; pNSprite->pos.Z = pSector->ceilingz; @@ -450,11 +450,11 @@ static tspritetype* viewAddEffect(tspritetype* tsprite, int& spritesortcnt, int } case kViewEffectFloorGlow: { - auto pNSprite = viewInsertTSprite(tsprite, spritesortcnt, pTSprite->sector(), 32767, pTSprite); + auto pNSprite = viewInsertTSprite(tsprite, spritesortcnt, pTSprite->sectp, 32767, pTSprite); if (!pNSprite) break; - sectortype* pSector = pTSprite->sector(); + sectortype* pSector = pTSprite->sectp; pNSprite->pos.X = pTSprite->pos.X; pNSprite->pos.Y = pTSprite->pos.Y; pNSprite->pos.Z = pSector->floorz; @@ -470,7 +470,7 @@ static tspritetype* viewAddEffect(tspritetype* tsprite, int& spritesortcnt, int } case kViewEffectSpear: { - auto pNSprite = viewInsertTSprite(tsprite, spritesortcnt, pTSprite->sector(), 32767, pTSprite); + auto pNSprite = viewInsertTSprite(tsprite, spritesortcnt, pTSprite->sectp, 32767, pTSprite); if (!pNSprite) break; @@ -490,7 +490,7 @@ static tspritetype* viewAddEffect(tspritetype* tsprite, int& spritesortcnt, int WEAPONICON weaponIcon = gWeaponIcon[pPlayer->curWeapon]; auto& nTile = weaponIcon.nTile; if (nTile < 0) break; - auto pNSprite = viewInsertTSprite(tsprite, spritesortcnt, pTSprite->sector(), 32767, pTSprite); + auto pNSprite = viewInsertTSprite(tsprite, spritesortcnt, pTSprite->sectp, 32767, pTSprite); if (!pNSprite) break; @@ -640,7 +640,7 @@ void viewProcessSprites(tspritetype* tsprite, int& spritesortcnt, int32_t cX, in { int top, bottom; GetSpriteExtents(pTSprite, &top, &bottom); - if (getflorzofslopeptr(pTSprite->sector(), pTSprite->pos.X, pTSprite->pos.Y) > bottom) + if (getflorzofslopeptr(pTSprite->sectp, pTSprite->pos.X, pTSprite->pos.Y) > bottom) nAnim = 1; } break; @@ -710,7 +710,7 @@ void viewProcessSprites(tspritetype* tsprite, int& spritesortcnt, int32_t cX, in } } - sectortype* pSector = pTSprite->sector(); + sectortype* pSector = pTSprite->sectp; XSECTOR const* pXSector = pSector->hasX() ? &pSector->xs() : nullptr; int nShade = pTSprite->shade; @@ -840,7 +840,7 @@ void viewProcessSprites(tspritetype* tsprite, int& spritesortcnt, int32_t cX, in viewAddEffect(tsprite, spritesortcnt, nTSprite, kViewEffectFlareHalo); if (pTSprite->type != kMissileFlareRegular) break; - sectortype* pSector1 = pTSprite->sector(); + sectortype* pSector1 = pTSprite->sectp; int zDiff = (pTSprite->pos.Z - pSector1->ceilingz) >> 8; if ((pSector1->ceilingstat & CSTAT_SECTOR_SKY) == 0 && zDiff < 64) { @@ -923,7 +923,7 @@ void viewProcessSprites(tspritetype* tsprite, int& spritesortcnt, int32_t cX, in } if (pTSprite->ownerActor != gView->actor || gViewPos != VIEWPOS_0) { - if (getflorzofslopeptr(pTSprite->sector(), pTSprite->pos.X, pTSprite->pos.Y) >= cZ) + if (getflorzofslopeptr(pTSprite->sectp, pTSprite->pos.X, pTSprite->pos.Y) >= cZ) { viewAddEffect(tsprite, spritesortcnt, nTSprite, kViewEffectShadow); } @@ -955,7 +955,7 @@ void viewProcessSprites(tspritetype* tsprite, int& spritesortcnt, int32_t cX, in if (pTSprite->type < kThingBase || pTSprite->type >= kThingMax || owneractor->hit.florhit.type == kHitNone) { - if ((pTSprite->flags & kPhysMove) && getflorzofslopeptr(pTSprite->sector(), pTSprite->pos.X, pTSprite->pos.Y) >= cZ) + if ((pTSprite->flags & kPhysMove) && getflorzofslopeptr(pTSprite->sectp, pTSprite->pos.X, pTSprite->pos.Y) >= cZ) viewAddEffect(tsprite, spritesortcnt, nTSprite, kViewEffectShadow); } } diff --git a/source/games/blood/src/blood.cpp b/source/games/blood/src/blood.cpp index 243dc3af1..42a2c6b7e 100644 --- a/source/games/blood/src/blood.cpp +++ b/source/games/blood/src/blood.cpp @@ -155,7 +155,7 @@ TArray SpawnActors(BloodSpawnSpriteDef& sprites) continue; } auto sprt = &sprites.sprites[i]; - auto actor = InsertSprite(sprt->sector(), sprt->statnum); + auto actor = InsertSprite(sprt->sectp, sprt->statnum); spawns[j++] = actor; actor->spr = sprites.sprites[i]; if (sprites.sprext.Size()) actor->sprext = sprites.sprext[i]; diff --git a/source/games/duke/src/_polymost.cpp b/source/games/duke/src/_polymost.cpp index 2abdfc3b2..1789c4455 100644 --- a/source/games/duke/src/_polymost.cpp +++ b/source/games/duke/src/_polymost.cpp @@ -88,7 +88,7 @@ void SE40_Draw(int tag, spritetype *spr, int x, int y, int z, binangle a, fixedh offx = x - floor1->pos.X; offy = y - floor1->pos.Y; - renderDrawRoomsQ16(floor2->pos.X + offx, floor2->pos.Y + offy, z, a.asq16(), h.asq16(), floor2->sector(), false); + renderDrawRoomsQ16(floor2->pos.X + offx, floor2->pos.Y + offy, z, a.asq16(), h.asq16(), floor2->sectp, false); fi.animatesprites(pm_tsprite, pm_spritesortcnt, offx + floor2->pos.X, offy + floor2->pos.Y, a.asbuild(), smoothratio); renderDrawMasks(); diff --git a/source/games/duke/src/animatesprites_d.cpp b/source/games/duke/src/animatesprites_d.cpp index 88778fcbd..f7ddcf302 100644 --- a/source/games/duke/src/animatesprites_d.cpp +++ b/source/games/duke/src/animatesprites_d.cpp @@ -132,7 +132,7 @@ void animatesprites_d(tspritetype* tsprite, int& spritesortcnt, int x, int y, in } if (t->sectp != nullptr) - t->shade = clamp(t->sectp->ceilingstat & CSTAT_SECTOR_SKY ? t->sector()->ceilingshade : t->sectp->floorshade, -127, 127); + t->shade = clamp(t->sectp->ceilingstat & CSTAT_SECTOR_SKY ? t->sectp->ceilingshade : t->sectp->floorshade, -127, 127); } @@ -392,7 +392,7 @@ void animatesprites_d(tspritetype* tsprite, int& spritesortcnt, int x, int y, in else t->cstat &= ~CSTAT_SPRITE_XFLIP; } - if (t->sector()->lotag == 2) k += 1795 - 1405; + if (t->sectp->lotag == 2) k += 1795 - 1405; else if ((h->floorz - h->spr.pos.Z) > (64 << 8)) k += 60; t->picnum += k; @@ -479,7 +479,7 @@ void animatesprites_d(tspritetype* tsprite, int& spritesortcnt, int x, int y, in break; case WATERBUBBLE: - if (t->sector()->floorpicnum == FLOORSLIME) + if (t->sectp->floorpicnum == FLOORSLIME) { t->pal = 7; break; @@ -628,7 +628,7 @@ void animatesprites_d(tspritetype* tsprite, int& spritesortcnt, int x, int y, in { case LASERLINE: if (!OwnerAc) break; - if (t->sector()->lotag == 2) t->pal = 8; + if (t->sectp->lotag == 2) t->pal = 8; t->pos.Z = OwnerAc->spr.pos.Z - (3 << 8); if (gs.lasermode == 2 && ps[screenpeek].heat_on == 0) t->yrepeat = 0; @@ -659,7 +659,7 @@ void animatesprites_d(tspritetype* tsprite, int& spritesortcnt, int x, int y, in case BURNING2: if (!OwnerAc) break; if (OwnerAc->spr.picnum != TREE1 && OwnerAc->spr.picnum != TREE2) - t->pos.Z = t->sector()->floorz; + t->pos.Z = t->sectp->floorz; t->shade = -127; break; case COOLEXPLOSION1: @@ -743,7 +743,7 @@ void animatesprites_d(tspritetype* tsprite, int& spritesortcnt, int x, int y, in } h->dispicnum = t->picnum; - if (t->sector()->floorpicnum == MIRROR) + if (t->sectp->floorpicnum == MIRROR) t->xrepeat = t->yrepeat = 0; } } diff --git a/source/games/duke/src/animatesprites_r.cpp b/source/games/duke/src/animatesprites_r.cpp index 433f22888..ad15c80c7 100644 --- a/source/games/duke/src/animatesprites_r.cpp +++ b/source/games/duke/src/animatesprites_r.cpp @@ -435,7 +435,7 @@ void animatesprites_r(tspritetype* tsprite, int& spritesortcnt, int x, int y, in else t->cstat &= ~CSTAT_SPRITE_XFLIP; } - if (t->sector()->lotag == 2) k += 1795 - 1405; + if (t->sectp->lotag == 2) k += 1795 - 1405; else if ((h->floorz - h->spr.pos.Z) > (64 << 8)) k += 60; t->picnum += k; @@ -609,7 +609,7 @@ void animatesprites_r(tspritetype* tsprite, int& spritesortcnt, int x, int y, in break; case WATERBUBBLE: - if (t->sector()->floorpicnum == FLOORSLIME) + if (t->sectp->floorpicnum == FLOORSLIME) { t->pal = 7; break; @@ -814,7 +814,7 @@ void animatesprites_r(tspritetype* tsprite, int& spritesortcnt, int x, int y, in case FIRE: case BURNING: if (OwnerAc && OwnerAc->spr.picnum != TREE1 && OwnerAc->spr.picnum != TREE2) - t->pos.Z = t->sector()->floorz; + t->pos.Z = t->sectp->floorz; t->shade = -127; break; case WALLLIGHT3: @@ -969,7 +969,7 @@ void animatesprites_r(tspritetype* tsprite, int& spritesortcnt, int x, int y, in } h->dispicnum = t->picnum; - if (t->sector()->floorpicnum == MIRROR) + if (t->sectp->floorpicnum == MIRROR) t->xrepeat = t->yrepeat = 0; } } diff --git a/source/games/duke/src/premap.cpp b/source/games/duke/src/premap.cpp index 127521fc4..7affb9bf4 100644 --- a/source/games/duke/src/premap.cpp +++ b/source/games/duke/src/premap.cpp @@ -942,7 +942,7 @@ static TArray spawnactors(SpawnSpriteDef& sprites) continue; } auto sprt = &sprites.sprites[i]; - auto actor = static_cast(InsertActor(RUNTIME_CLASS(DDukeActor), sprt->sector(), sprt->statnum)); + auto actor = static_cast(InsertActor(RUNTIME_CLASS(DDukeActor), sprt->sectp, sprt->statnum)); spawns[j++] = actor; actor->spr = sprites.sprites[i]; if (sprites.sprext.Size()) actor->sprext = sprites.sprext[i]; diff --git a/source/games/exhumed/src/init.cpp b/source/games/exhumed/src/init.cpp index 06f1fbfff..198df1c7f 100644 --- a/source/games/exhumed/src/init.cpp +++ b/source/games/exhumed/src/init.cpp @@ -73,7 +73,7 @@ static TArray spawnactors(SpawnSpriteDef& sprites) continue; } auto sprt = &sprites.sprites[i]; - auto actor = insertActor(sprt->sector(), sprt->statnum); + auto actor = insertActor(sprt->sectp, sprt->statnum); spawns[j++] = actor; actor->spr = sprites.sprites[i]; if (sprites.sprext.Size()) actor->sprext = sprites.sprext[i]; diff --git a/source/games/exhumed/src/sequence.cpp b/source/games/exhumed/src/sequence.cpp index 7262d289d..e78f323a2 100644 --- a/source/games/exhumed/src/sequence.cpp +++ b/source/games/exhumed/src/sequence.cpp @@ -609,7 +609,7 @@ int seq_PlotSequence(int nSprite, int16_t edx, int16_t nFrame, int16_t ecx) } else { - auto pSector =pTSprite->sector(); + auto pSector =pTSprite->sectp; int nFloorZ = pSector->floorz; if (nFloorZ <= PlayerList[nLocalPlayer].eyelevel + initz) { diff --git a/source/games/exhumed/src/view.cpp b/source/games/exhumed/src/view.cpp index 861bf64db..19154d7e2 100644 --- a/source/games/exhumed/src/view.cpp +++ b/source/games/exhumed/src/view.cpp @@ -103,9 +103,9 @@ static void analyzesprites(tspritetype* tsprite, int& spritesortcnt, int x, int { auto pActor = static_cast(pTSprite->ownerActor); - if (pTSprite->sector() != nullptr) + if (pTSprite->sectp != nullptr) { - sectortype *pTSector = pTSprite->sector(); + sectortype *pTSector = pTSprite->sectp; int nSectShade = (pTSector->ceilingstat & CSTAT_SECTOR_SKY) ? pTSector->ceilingshade : pTSector->floorshade; int nShade = pTSprite->shade + nSectShade + 6; pTSprite->shade = clamp(nShade, -128, 127); diff --git a/source/games/sw/src/draw.cpp b/source/games/sw/src/draw.cpp index a7a98d44e..0a7db6f51 100644 --- a/source/games/sw/src/draw.cpp +++ b/source/games/sw/src/draw.cpp @@ -86,7 +86,7 @@ void SW_InitMultiPsky(void) void ShadeSprite(tspritetype* tsp) { // set shade of sprite - tsp->shade = tsp->sector()->floorshade - 25; + tsp->shade = tsp->sectp->floorshade - 25; if (tsp->shade > -3) tsp->shade = -3; @@ -221,7 +221,7 @@ int DoShadowFindGroundPoint(tspritetype* tspr) save_cstat = tspr->cstat; tspr->cstat &= ~(CSTAT_SPRITE_BLOCK | CSTAT_SPRITE_BLOCK_HITSCAN); - FAFgetzrangepoint(tspr->pos.X, tspr->pos.Y, tspr->pos.Z, tspr->sector(), &hiz, &ceilhit, &loz, &florhit); + FAFgetzrangepoint(tspr->pos.X, tspr->pos.Y, tspr->pos.Z, tspr->sectp, &hiz, &ceilhit, &loz, &florhit); tspr->cstat = save_cstat; switch (florhit.type) @@ -270,7 +270,7 @@ void DoShadows(tspritetype* tsprite, int& spritesortcnt, tspritetype* tsp, int v if (!ownerActor->hasU()) return; - auto sect = tsp->sector(); + auto sect = tsp->sectp; // make sure its the correct sector // DoShadowFindGroundPoint calls FAFgetzrangepoint and this is sensitive updatesector(tsp->pos.X, tsp->pos.Y, §); @@ -555,29 +555,29 @@ DSWActor* ConnectCopySprite(spritetypebase const* tsp) sectortype* newsector; int testz; - if (FAF_ConnectCeiling(tsp->sector())) + if (FAF_ConnectCeiling(tsp->sectp)) { - newsector = tsp->sector(); + newsector = tsp->sectp; testz = GetSpriteZOfTop(tsp) - Z(10); - if (testz < tsp->sector()->ceilingz) + if (testz < tsp->sectp->ceilingz) updatesectorz(tsp->pos.X, tsp->pos.Y, testz, &newsector); - if (newsector != nullptr && newsector != tsp->sector()) + if (newsector != nullptr && newsector != tsp->sectp) { return CopySprite(tsp, newsector); } } - if (FAF_ConnectFloor(tsp->sector())) + if (FAF_ConnectFloor(tsp->sectp)) { - newsector = tsp->sector(); + newsector = tsp->sectp; testz = GetSpriteZOfBottom(tsp) + Z(10); - if (testz > tsp->sector()->floorz) + if (testz > tsp->sectp->floorz) updatesectorz(tsp->pos.X, tsp->pos.Y, testz, &newsector); - if (newsector != nullptr && newsector != tsp->sector()) + if (newsector != nullptr && newsector != tsp->sectp) { return CopySprite(tsp, newsector); } @@ -607,7 +607,7 @@ void analyzesprites(tspritetype* tsprite, int& spritesortcnt, int viewx, int vie { tspritetype* tsp = &tsprite[tSpriteNum]; auto tActor = static_cast(tsp->ownerActor); - auto tsectp = tsp->sector(); + auto tsectp = tsp->sectp; #if 0 // Brighten up the sprite if set somewhere else to do so @@ -807,7 +807,7 @@ void analyzesprites(tspritetype* tsprite, int& spritesortcnt, int viewx, int vie } } - if (OverlapDraw && FAF_ConnectArea(tsp->sector()) && tsp->ownerActor) + if (OverlapDraw && FAF_ConnectArea(tsp->sectp) && tsp->ownerActor) { ConnectCopySprite(tsp); } diff --git a/source/games/sw/src/game.cpp b/source/games/sw/src/game.cpp index 835cc74b4..0a9146b34 100644 --- a/source/games/sw/src/game.cpp +++ b/source/games/sw/src/game.cpp @@ -354,7 +354,7 @@ void spawnactors(SpawnSpriteDef& sprites) continue; } auto sprt = &sprites.sprites[i]; - auto actor = insertActor(sprt->sector(), sprt->statnum); + auto actor = insertActor(sprt->sectp, sprt->statnum); actor->spr = sprites.sprites[i]; if (sprites.sprext.Size()) actor->sprext = sprites.sprext[i]; else actor->sprext = {};