From 1231f6025d0f5910013bede30c60ae9c6da38c99 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Thu, 3 Feb 2022 00:01:57 +0100 Subject: [PATCH] - handle the last remaining uses of __int_pos that can be done with the function interface. --- source/core/gamefuncs.h | 4 ++-- source/core/maploader.cpp | 2 +- source/core/rendering/scene/hw_flats.cpp | 2 +- source/games/duke/src/animatesprites_d.cpp | 4 ++-- source/games/duke/src/animatesprites_r.cpp | 8 ++++---- source/games/exhumed/src/sequence.cpp | 2 +- source/games/exhumed/src/view.cpp | 4 ++-- source/games/sw/src/draw.cpp | 12 ++++++------ 8 files changed, 19 insertions(+), 19 deletions(-) diff --git a/source/core/gamefuncs.h b/source/core/gamefuncs.h index 78d10241a..e8d35b69e 100644 --- a/source/core/gamefuncs.h +++ b/source/core/gamefuncs.h @@ -324,8 +324,8 @@ inline int32_t tspriteGetZOfSlope(const tspritetype* tspr, int dax, int day) int heinum = tspriteGetSlope(tspr); if (heinum == 0) return tspr->__int_pos.Z; - int const j = DMulScale(bsin(tspr->ang + 1024), day - tspr->__int_pos.Y, -bsin(tspr->ang + 512), dax - tspr->__int_pos.X, 4); - return tspr->__int_pos.Z + MulScale(heinum, j, 18); + int const j = DMulScale(bsin(tspr->ang + 1024), day - tspr->int_pos().Y, -bsin(tspr->ang + 512), dax - tspr->int_pos().X, 4); + return tspr->int_pos().Z + MulScale(heinum, j, 18); } inline int inside(int x, int y, const sectortype* sect) diff --git a/source/core/maploader.cpp b/source/core/maploader.cpp index 874a52d2e..5c7e59ec4 100644 --- a/source/core/maploader.cpp +++ b/source/core/maploader.cpp @@ -259,7 +259,7 @@ static void SetWallPalV5() void validateSprite(spritetype& spri, int sectnum, int index) { - auto pos = spri.__int_pos; + auto pos = spri.int_pos(); bool bugged = false; if ((unsigned)spri.statnum >= MAXSTATUS) { diff --git a/source/core/rendering/scene/hw_flats.cpp b/source/core/rendering/scene/hw_flats.cpp index 061e949fc..7e7c13428 100644 --- a/source/core/rendering/scene/hw_flats.cpp +++ b/source/core/rendering/scene/hw_flats.cpp @@ -424,7 +424,7 @@ void HWFlat::ProcessFlatSprite(HWDrawInfo* di, tspritetype* sprite, sectortype* if (sprite->int_pos().Z > sprite->sectp->floorz) { belowfloor = true; - sprite->__int_pos.Z = sprite->sectp->floorz; + sprite->set_int_z(sprite->sectp->floorz); } z = sprite->int_pos().Z * (1 / -256.f); if (z == di->Viewpoint.Pos.Z) return; // looking right at the edge. diff --git a/source/games/duke/src/animatesprites_d.cpp b/source/games/duke/src/animatesprites_d.cpp index 8d00932ae..4108152bd 100644 --- a/source/games/duke/src/animatesprites_d.cpp +++ b/source/games/duke/src/animatesprites_d.cpp @@ -305,7 +305,7 @@ void animatesprites_d(tspriteArray& tsprites, int x, int y, int a, int smoothrat p = h->spr.yvel; - if (t->pal == 1) t->__int_pos.Z -= (18 << 8); + if (t->pal == 1) t->add_int_z(-(18 << 8)); if (ps[p].over_shoulder_on > 0 && ps[p].newOwner == nullptr) { @@ -428,7 +428,7 @@ void animatesprites_d(tspriteArray& tsprites, int x, int y, int a, int smoothrat if (!h->GetOwner()) continue; - if (t->__int_pos.Z > h->floorz && t->xrepeat < 32) + if (t->int_pos().Z > h->floorz && t->xrepeat < 32) t->set_int_z(h->floorz); break; diff --git a/source/games/duke/src/animatesprites_r.cpp b/source/games/duke/src/animatesprites_r.cpp index 1a5062eac..07758c72a 100644 --- a/source/games/duke/src/animatesprites_r.cpp +++ b/source/games/duke/src/animatesprites_r.cpp @@ -148,7 +148,7 @@ void animatesprites_r(tspriteArray& tsprites, int x, int y, int a, int smoothrat t->add_int_x(-MulScale(MaxSmoothRatio - smoothratio, ps[h->spr.yvel].pos.X - ps[h->spr.yvel].opos.X, 16)); t->add_int_y(-MulScale(MaxSmoothRatio - smoothratio, ps[h->spr.yvel].pos.Y - ps[h->spr.yvel].opos.Y, 16)); t->set_int_z(interpolatedvalue(ps[h->spr.yvel].opos.Z, ps[h->spr.yvel].pos.Z, smoothratio)); - t->__int_pos.Z += PHEIGHT_RR; + t->add_int_z(PHEIGHT_RR); h->spr.xrepeat = 24; h->spr.yrepeat = 17; } @@ -181,7 +181,7 @@ void animatesprites_r(tspriteArray& tsprites, int x, int y, int a, int smoothrat h->spr.xrepeat = 24; h->spr.yrepeat = 17; if (h->spr.extra > 0) - t->__int_pos.Z += (6 << 8); + t->add_int_z(6 << 8); break; case BLOODPOOL: case FOOTPRINTS: @@ -349,7 +349,7 @@ void animatesprites_r(tspriteArray& tsprites, int x, int y, int a, int smoothrat p = h->spr.yvel; - if (t->pal == 1) t->__int_pos.Z -= (18 << 8); + if (t->pal == 1) t->add_int_z(-(18 << 8)); if (ps[p].over_shoulder_on > 0 && ps[p].newOwner == nullptr) { @@ -474,7 +474,7 @@ void animatesprites_r(tspriteArray& tsprites, int x, int y, int a, int smoothrat if (!h->GetOwner()) continue; - if (t->__int_pos.Z > h->floorz && t->xrepeat < 32) + if (t->int_pos().Z > h->floorz && t->xrepeat < 32) t->set_int_z(h->floorz); if (ps[p].OnMotorcycle && p == screenpeek) diff --git a/source/games/exhumed/src/sequence.cpp b/source/games/exhumed/src/sequence.cpp index 1afae44fa..9211449a0 100644 --- a/source/games/exhumed/src/sequence.cpp +++ b/source/games/exhumed/src/sequence.cpp @@ -632,7 +632,7 @@ int seq_PlotSequence(int nSprite, int16_t edx, int16_t nFrame, int16_t ecx) } pTSprite->cstat = CSTAT_SPRITE_ALIGNMENT_FLOOR | CSTAT_SPRITE_TRANSLUCENT; - pTSprite->__int_pos.Z = nFloorZ; + pTSprite->set_int_z(nFloorZ); pTSprite->yrepeat = (uint8_t)edx; pTSprite->xrepeat = (uint8_t)edx; pTSprite->statnum = -3; diff --git a/source/games/exhumed/src/view.cpp b/source/games/exhumed/src/view.cpp index cf74b1823..ffc52b82e 100644 --- a/source/games/exhumed/src/view.cpp +++ b/source/games/exhumed/src/view.cpp @@ -73,7 +73,7 @@ static void analyzesprites(tspriteArray& tsprites, int x, int y, int z, double c if (pTSprite->ownerActor) { // interpolate sprite position - pTSprite->__int_pos = pTSprite->ownerActor->interpolatedvec3(smoothratio); + pTSprite->set_int_pos(pTSprite->ownerActor->interpolatedvec3(smoothratio)); pTSprite->ang = pTSprite->ownerActor->interpolatedang(smoothratio); } } @@ -110,7 +110,7 @@ static void analyzesprites(tspriteArray& tsprites, int x, int y, int z, double c { pTSprite->cstat |= CSTAT_SPRITE_YCENTER; int nTileY = (tileHeight(pTSprite->picnum) * pTSprite->yrepeat) * 2; - pTSprite->__int_pos.Z -= nTileY; + pTSprite->add_int_z(-nTileY); } if (pTSprite->pal == 4 && pTSprite->shade >= numshades) pTSprite->shade = numshades - 1; diff --git a/source/games/sw/src/draw.cpp b/source/games/sw/src/draw.cpp index 9df2deaf0..a5e42c617 100644 --- a/source/games/sw/src/draw.cpp +++ b/source/games/sw/src/draw.cpp @@ -300,7 +300,7 @@ void DoShadows(tspriteArray& tsprites, tspritetype* tsp, int viewz, int camang) } // need to find the ground here - tSpr->__int_pos.Z = loz; + tSpr->set_int_z(loz); // if below or close to sprites z don't bother to draw it if ((viewz - loz) > -Z(8)) @@ -480,7 +480,7 @@ void WarpCopySprite(tspriteArray& tsprites) newTSpr->statnum = 0; auto off = itActor1->int_pos() - newTSpr->int_pos(); - newTSpr->__int_pos = itActor->int_pos() - off; + newTSpr->set_int_pos(itActor->int_pos() - off); newTSpr->sectp = itActor->sector(); } } @@ -624,7 +624,7 @@ void analyzesprites(tspriteArray& tsprites, int viewx, int viewy, int viewz, int { if (tsp->statnum <= STAT_SKIP4_INTERP_END) { - tsp->__int_pos = tActor->interpolatedvec3(smr4, 18); + tsp->set_int_pos(tActor->interpolatedvec3(smr4, 18)); } } @@ -632,7 +632,7 @@ void analyzesprites(tspriteArray& tsprites, int viewx, int viewy, int viewz, int { if (tsp->statnum <= STAT_SKIP2_INTERP_END) { - tsp->__int_pos = tActor->interpolatedvec3(smr2, 17); + tsp->set_int_pos(tActor->interpolatedvec3(smr2, 17)); } } } @@ -642,7 +642,7 @@ void analyzesprites(tspriteArray& tsprites, int viewx, int viewy, int viewz, int { int32_t const floorz = getflorzofslopeptr(tActor->sector(), tActor->int_pos().X, tActor->int_pos().Y); if (tActor->int_pos().Z > floorz) - tsp->__int_pos.Z = floorz; + tsp->set_int_z(floorz); } if (r_shadows && (tActor->user.Flags & SPR_SHADOW)) @@ -790,7 +790,7 @@ void analyzesprites(tspriteArray& tsprites, int viewx, int viewy, int viewz, int int sr = 65536 - int(smoothratio); tsp->add_int_x(-MulScale(pp->pos.X - pp->opos.X, sr, 16)); tsp->add_int_y(-MulScale(pp->pos.Y - pp->opos.Y, sr, 16)); - tsp->__int_pos.Z -= MulScale(pp->pos.Z - pp->opos.Z, sr, 16); + tsp->add_int_z(-MulScale(pp->pos.Z - pp->opos.Z, sr, 16)); tsp->ang -= MulScale(pp->angle.ang.asbuild() - pp->angle.oang.asbuild(), sr, 16); } }