From f602cf38066b80ca212f39177e56c1131c2de480 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Wed, 22 Dec 2021 23:14:16 +0100 Subject: [PATCH] - deal with s() in shared code. clip.cpp was left alone, except for the actual call. --- source/build/src/clip.cpp | 2 +- source/build/src/engine.cpp | 8 +++----- source/build/src/mdsprite.cpp | 5 ++--- source/build/src/polymost.cpp | 17 ++++++++--------- source/core/actorlist.cpp | 3 --- source/core/automap.cpp | 9 ++++----- source/core/gamefuncs.cpp | 10 +++++----- source/core/rendering/scene/hw_bunchdrawer.cpp | 16 +++++++--------- 8 files changed, 30 insertions(+), 40 deletions(-) diff --git a/source/build/src/clip.cpp b/source/build/src/clip.cpp index 105cd09d5..94d554321 100644 --- a/source/build/src/clip.cpp +++ b/source/build/src/clip.cpp @@ -591,7 +591,7 @@ CollisionBase clipmove_(vec3_t * const pos, int * const sectnum, int32_t xvect, TSectIterator it(dasect); while (auto actor = it.Next()) { - auto const spr = &actor->s(); + auto const spr = &actor->spr; const int32_t cstat = spr->cstat; if ((cstat&dasprclipmask) == 0) diff --git a/source/build/src/engine.cpp b/source/build/src/engine.cpp index 5ef7a3ff4..2f8124262 100644 --- a/source/build/src/engine.cpp +++ b/source/build/src/engine.cpp @@ -592,14 +592,12 @@ void neartag(const vec3_t& sv, sectortype* sect, int ange, HitInfoBase& result, TSectIterator it(dasect); while (auto actor = it.Next()) { - auto const spr = &actor->s(); - - if (spr->cstat2 & CSTAT2_SPRITE_NOFIND) + if (actor->spr.cstat2 & CSTAT2_SPRITE_NOFIND) continue; - if (((tagsearch&1) && spr->lotag) || ((tagsearch&2) && spr->hitag)) + if (((tagsearch&1) && actor->spr.lotag) || ((tagsearch&2) && actor->spr.hitag)) { - if (try_facespr_intersect(spr, sv, vx, vy, 0, &hitv, 1)) + if (try_facespr_intersect(&actor->spr, sv, vx, vy, 0, &hitv, 1)) { result.hitActor = actor; result.hitpos.X = DMulScale(hitv.X-sv.X, bcos(ange), hitv.Y-sv.Y, bsin(ange), 14); diff --git a/source/build/src/mdsprite.cpp b/source/build/src/mdsprite.cpp index 6344ea623..1664f0960 100644 --- a/source/build/src/mdsprite.cpp +++ b/source/build/src/mdsprite.cpp @@ -1137,8 +1137,7 @@ static int32_t polymost_md3draw(md3model_t *m, tspriteptr_t tspr) // int32_t texunits = GL_TEXTURE0; auto ownerActor = tspr->ownerActor; - const spritetype* const spr = &ownerActor->s(); - const uint8_t lpal = spr->pal; + const uint8_t lpal = ownerActor->spr.pal; const int32_t sizyrep = tileHeight(tspr->picnum) * tspr->yrepeat; updateanimation((md2model_t *)m, tspr, lpal); @@ -1169,7 +1168,7 @@ static int32_t polymost_md3draw(md3model_t *m, tspriteptr_t tspr) // Parkar: Moved up to be able to use k0 for the y-flipping code k0 = (float)tspr->pos.Z+ownerActor->sprext.position_offset.Z; - f = ((globalorientation & 8) && (spr->cstat & CSTAT_SPRITE_ALIGNMENT_MASK) != CSTAT_SPRITE_ALIGNMENT_FACING) ? -4.f : 4.f; + f = ((globalorientation & 8) && (ownerActor->spr.cstat & CSTAT_SPRITE_ALIGNMENT_MASK) != CSTAT_SPRITE_ALIGNMENT_FACING) ? -4.f : 4.f; k0 -= (tspr->yoffset*tspr->yrepeat)*f; if ((globalorientation&128) && !((globalorientation & CSTAT_SPRITE_ALIGNMENT_MASK) == CSTAT_SPRITE_ALIGNMENT_FLOOR)) k0 += (float)(sizyrep<<1); diff --git a/source/build/src/polymost.cpp b/source/build/src/polymost.cpp index 3512044a7..0b7de9d9b 100644 --- a/source/build/src/polymost.cpp +++ b/source/build/src/polymost.cpp @@ -1876,20 +1876,19 @@ void polymost_scansector(int32_t sectnum) TSectIterator it(sectnum); while (auto act = it.Next()) { - auto spr = &act->s(); - if ((spr->cstat & CSTAT_SPRITE_INVISIBLE) || spr->xrepeat == 0 || spr->yrepeat == 0) + if ((act->spr.cstat & CSTAT_SPRITE_INVISIBLE) || act->spr.xrepeat == 0 || act->spr.yrepeat == 0) continue; - vec2_t const s = { spr->pos.X-globalposx, spr->pos.Y-globalposy }; + vec2_t const s = { act->spr.pos.X-globalposx, act->spr.pos.Y-globalposy }; - if ((spr->cstat & CSTAT_SPRITE_ALIGNMENT_MASK) || - (hw_models && tile2model[spr->picnum].modelid>=0) || + if ((act->spr.cstat & CSTAT_SPRITE_ALIGNMENT_MASK) || + (hw_models && tile2model[act->spr.picnum].modelid>=0) || ((s.X * gcosang) + (s.Y * gsinang) > 0)) { - if ((spr->cstat&(CSTAT_SPRITE_ONE_SIDE | CSTAT_SPRITE_ALIGNMENT_MASK))!=(CSTAT_SPRITE_ONE_SIDE | CSTAT_SPRITE_ALIGNMENT_WALL) || - (r_voxels && tiletovox[spr->picnum] >= 0 && voxmodels[tiletovox[spr->picnum]]) || - (r_voxels && gi->Voxelize(spr->picnum) > -1) || - DMulScale(bcos(spr->ang), -s.X, bsin(spr->ang), -s.Y, 6) > 0) + if ((act->spr.cstat&(CSTAT_SPRITE_ONE_SIDE | CSTAT_SPRITE_ALIGNMENT_MASK))!=(CSTAT_SPRITE_ONE_SIDE | CSTAT_SPRITE_ALIGNMENT_WALL) || + (r_voxels && tiletovox[act->spr.picnum] >= 0 && voxmodels[tiletovox[act->spr.picnum]]) || + (r_voxels && gi->Voxelize(act->spr.picnum) > -1) || + DMulScale(bcos(act->spr.ang), -s.X, bsin(act->spr.ang), -s.Y, 6) > 0) if (!renderAddTsprite(pm_tsprite, pm_spritesortcnt, act)) break; } diff --git a/source/core/actorlist.cpp b/source/core/actorlist.cpp index 0d49fb403..693b2a5ea 100644 --- a/source/core/actorlist.cpp +++ b/source/core/actorlist.cpp @@ -349,9 +349,6 @@ DCoreActor* InsertActor(PClass* type, sectortype* sector, int stat, bool tail) auto actor = static_cast(type->CreateNew()); GC::WriteBarrier(actor); - spritetype* pSprite = &actor->s(); - pSprite->clear(); - InsertActorStat(actor, stat, tail); InsertActorSect(actor, sector, tail); diff --git a/source/core/automap.cpp b/source/core/automap.cpp index 894de2799..5959df19f 100644 --- a/source/core/automap.cpp +++ b/source/core/automap.cpp @@ -565,15 +565,14 @@ void renderDrawMapView(int cposx, int cposy, int czoom, int cang) TSectIterator it(sect); while (auto act = it.Next()) { - auto spr = &act->s(); - if (spr->cstat & CSTAT_SPRITE_INVISIBLE) + if (act->spr.cstat & CSTAT_SPRITE_INVISIBLE) continue; - if (spr->cstat & CSTAT_SPRITE_ALIGNMENT_FLOOR) // floor and slope sprites + if (act->spr.cstat & CSTAT_SPRITE_ALIGNMENT_FLOOR) // floor and slope sprites { - if ((spr->cstat & (CSTAT_SPRITE_ONE_SIDE | CSTAT_SPRITE_YFLIP)) == (CSTAT_SPRITE_ONE_SIDE | CSTAT_SPRITE_YFLIP)) + if ((act->spr.cstat & (CSTAT_SPRITE_ONE_SIDE | CSTAT_SPRITE_YFLIP)) == (CSTAT_SPRITE_ONE_SIDE | CSTAT_SPRITE_YFLIP)) continue; // upside down - floorsprites.Push(spr); + floorsprites.Push(&act->spr); } } diff --git a/source/core/gamefuncs.cpp b/source/core/gamefuncs.cpp index 236c85a03..3d134faf5 100644 --- a/source/core/gamefuncs.cpp +++ b/source/core/gamefuncs.cpp @@ -88,14 +88,14 @@ bool calcChaseCamPos(int* px, int* py, int* pz, spritetype* pspr, sectortype** p else { // If you hit a sprite that's not a wall sprite - try again. - spritetype* hspr = &hitinfo.hitActor->s(); + auto hit = hitinfo.hitActor; - if (!(hspr->cstat & CSTAT_SPRITE_ALIGNMENT_WALL)) + if (!(hit->spr.cstat & CSTAT_SPRITE_ALIGNMENT_WALL)) { - bakcstat = hspr->cstat; - hspr->cstat &= ~(CSTAT_SPRITE_BLOCK | CSTAT_SPRITE_BLOCK_HITSCAN); + bakcstat = hit->spr.cstat; + hit->spr.cstat &= ~(CSTAT_SPRITE_BLOCK | CSTAT_SPRITE_BLOCK_HITSCAN); calcChaseCamPos(px, py, pz, pspr, psect, ang, horiz, smoothratio); - hspr->cstat = bakcstat; + hit->spr.cstat = bakcstat; return false; } else diff --git a/source/core/rendering/scene/hw_bunchdrawer.cpp b/source/core/rendering/scene/hw_bunchdrawer.cpp index e172f0911..6e9ccb915 100644 --- a/source/core/rendering/scene/hw_bunchdrawer.cpp +++ b/source/core/rendering/scene/hw_bunchdrawer.cpp @@ -602,20 +602,18 @@ void BunchDrawer::ProcessSection(int sectionnum, bool portal) CoreSectIterator it(sectnum); while (auto actor = it.Next()) { - auto const spr = &actor->s(); - - if ((spr->cstat & CSTAT_SPRITE_INVISIBLE) || spr->xrepeat == 0 || spr->yrepeat == 0) // skip invisible sprites + if ((actor->spr.cstat & CSTAT_SPRITE_INVISIBLE) || actor->spr.xrepeat == 0 || actor->spr.yrepeat == 0) // skip invisible sprites continue; - int sx = spr->pos.X - iview.X, sy = spr->pos.Y - int(iview.Y); + int sx = actor->spr.pos.X - iview.X, sy = actor->spr.pos.Y - int(iview.Y); // this checks if the sprite is it behind the camera, which will not work if the pitch is high enough to necessitate a FOV of more than 180°. - //if ((spr->cstat & CSTAT_SPRITE_ALIGNMENT_MASK) || (hw_models && tile2model[spr->picnum].modelid >= 0) || ((sx * gcosang) + (sy * gsinang) > 0)) + //if ((actor->spr.cstat & CSTAT_SPRITE_ALIGNMENT_MASK) || (hw_models && tile2model[actor->spr.picnum].modelid >= 0) || ((sx * gcosang) + (sy * gsinang) > 0)) { - if ((spr->cstat & (CSTAT_SPRITE_ONE_SIDE | CSTAT_SPRITE_ALIGNMENT_MASK)) != (CSTAT_SPRITE_ONE_SIDE | CSTAT_SPRITE_ALIGNMENT_WALL) || - (r_voxels && tiletovox[spr->picnum] >= 0 && voxmodels[tiletovox[spr->picnum]]) || - (r_voxels && gi->Voxelize(spr->picnum) > -1) || - DMulScale(bcos(spr->ang), -sx, bsin(spr->ang), -sy, 6) > 0) + if ((actor->spr.cstat & (CSTAT_SPRITE_ONE_SIDE | CSTAT_SPRITE_ALIGNMENT_MASK)) != (CSTAT_SPRITE_ONE_SIDE | CSTAT_SPRITE_ALIGNMENT_WALL) || + (r_voxels && tiletovox[actor->spr.picnum] >= 0 && voxmodels[tiletovox[actor->spr.picnum]]) || + (r_voxels && gi->Voxelize(actor->spr.picnum) > -1) || + DMulScale(bcos(actor->spr.ang), -sx, bsin(actor->spr.ang), -sy, 6) > 0) if (!renderAddTsprite(di->tsprite, di->spritesortcnt, actor)) break; }