- deal with s() in shared code.

clip.cpp was left alone, except for the actual call.
This commit is contained in:
Christoph Oelckers 2021-12-22 23:14:16 +01:00
parent 1f57322d56
commit f602cf3806
8 changed files with 30 additions and 40 deletions

View file

@ -591,7 +591,7 @@ CollisionBase clipmove_(vec3_t * const pos, int * const sectnum, int32_t xvect,
TSectIterator<DCoreActor> 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)

View file

@ -592,14 +592,12 @@ void neartag(const vec3_t& sv, sectortype* sect, int ange, HitInfoBase& result,
TSectIterator<DCoreActor> 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);

View file

@ -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);

View file

@ -1876,20 +1876,19 @@ void polymost_scansector(int32_t sectnum)
TSectIterator<DCoreActor> 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;
}

View file

@ -349,9 +349,6 @@ DCoreActor* InsertActor(PClass* type, sectortype* sector, int stat, bool tail)
auto actor = static_cast<DCoreActor*>(type->CreateNew());
GC::WriteBarrier(actor);
spritetype* pSprite = &actor->s();
pSprite->clear();
InsertActorStat(actor, stat, tail);
InsertActorSect(actor, sector, tail);

View file

@ -565,15 +565,14 @@ void renderDrawMapView(int cposx, int cposy, int czoom, int cang)
TSectIterator<DCoreActor> 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);
}
}

View file

@ -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

View file

@ -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;
}