- some sp replacements as preparation for replacing most of 'actor->s()'.

This commit is contained in:
Christoph Oelckers 2021-12-24 00:40:33 +01:00
parent ca14c809f9
commit 76809965ad
7 changed files with 37 additions and 41 deletions

View file

@ -62,8 +62,7 @@ void PreCacheOverride(void)
SWStatIterator it(STAT_CEILING_FLOOR_PIC_OVERRIDE);
while (auto actor = it.Next())
{
auto sp = &actor->s();
int j = SP_TAG2(sp);
int j = SP_TAG2(&actor->spr);
if(j >= 0 && j <= MAXTILES)
markTileForPrecache(j, 0);
}

View file

@ -164,9 +164,8 @@ void CopySectorMatch(int match)
itsec.Reset(ssectp);
while (auto itActor = itsec.Next())
{
auto sp = &itActor->s();
// don't move ST1 Copy Tags
if (SP_TAG1(sp) != SECT_COPY_SOURCE)
if (SP_TAG1(&itActor->spr) != SECT_COPY_SOURCE)
{
int sx,sy,dx,dy,src_xoff,src_yoff,trash;
@ -177,12 +176,12 @@ void CopySectorMatch(int match)
SectorMidPoint(dest_sp->sector(), &dx, &dy, &trash);
// get offset
src_xoff = sx - sp->pos.X;
src_yoff = sy - sp->pos.Y;
src_xoff = sx - itActor->spr.pos.X;
src_yoff = sy - itActor->spr.pos.Y;
// move sprite to dest sector
sp->pos.X = dx - src_xoff;
sp->pos.Y = dy - src_yoff;
itActor->spr.pos.X = dx - src_xoff;
itActor->spr.pos.Y = dy - src_yoff;
// change sector
ChangeActorSect(itActor, dsectp);
@ -193,7 +192,7 @@ void CopySectorMatch(int match)
SECTOR_OBJECTp sop;
// find and add sprite to SO
sop = DetectSectorObject(sp->sector());
sop = DetectSectorObject(itActor->spr.sector());
AddSpriteToSectorObject(itActor, sop);
// update sprites postions so they aren't in the

View file

@ -2125,6 +2125,11 @@ inline int ActorZOfTop(DSWActor* actor)
return GetSpriteZOfTop(&actor->spr);
}
inline int ActorZOfBottom(DSWActor* actor)
{
return GetSpriteZOfBottom(&actor->spr);
}
inline int ActorSizeZ(DSWActor* actor)
{
return (tileHeight(actor->spr.picnum) * actor->spr.yrepeat) << 2;

View file

@ -1507,7 +1507,8 @@ int PlayerInitFlashBomb(PLAYERp pp)
unsigned int stat;
int dist, tx, ty, tmin;
short damage;
SPRITEp sp = &pp->Actor()->s(), hp;
auto actor = pp->actor;
SPRITEp sp = &actor->s(), hp;
USERp hu;
PlaySound(DIGI_GASPOP, pp, v3df_dontpan | v3df_doppler);
@ -2022,7 +2023,6 @@ DSWActor* DoFlagRangeTest(DSWActor* actor, int range)
{
SPRITEp wp = &actor->s();
SPRITEp sp;
unsigned int stat;
int dist, tx, ty;
int tmin;
@ -2032,26 +2032,23 @@ DSWActor* DoFlagRangeTest(DSWActor* actor, int range)
SWStatIterator it(StatDamageList[stat]);
while (auto itActor = it.Next())
{
sp = &itActor->s();
DISTANCE(sp->pos.X, sp->pos.Y, wp->pos.X, wp->pos.Y, dist, tx, ty, tmin);
DISTANCE(itActor->spr.pos.X, itActor->spr.pos.Y, wp->pos.X, wp->pos.Y, dist, tx, ty, tmin);
if (dist > range)
continue;
if (actor == itActor)
continue;
if (!TEST(sp->cstat, CSTAT_SPRITE_BLOCK))
if (!TEST(itActor->spr.cstat, CSTAT_SPRITE_BLOCK))
continue;
if (!TEST(sp->extra, SPRX_PLAYER_OR_ENEMY))
if (!TEST(itActor->spr.extra, SPRX_PLAYER_OR_ENEMY))
continue;
if (!FAFcansee(sp->pos.X, sp->pos.Y, sp->pos.Z, sp->sector(), wp->pos.X, wp->pos.Y, wp->pos.Z, wp->sector()))
if (!FAFcansee(itActor->spr.pos.X, itActor->spr.pos.Y, itActor->spr.pos.Z, itActor->spr.sector(), wp->pos.X, wp->pos.Y, wp->pos.Z, wp->sector()))
continue;
dist = FindDistance3D(wp->pos.X - sp->pos.X, wp->pos.Y - sp->pos.Y, wp->pos.Z - sp->pos.Z);
dist = FindDistance3D(wp->pos.X - itActor->spr.pos.X, wp->pos.Y - itActor->spr.pos.Y, wp->pos.Z - itActor->spr.pos.Z);
if (dist > range)
continue;

View file

@ -453,11 +453,10 @@ ACTOR_ACTION_SET LavaActionSet =
int SetupLava(DSWActor* actor)
{
SPRITEp sp = &actor->s();
USERp u;
ANIMATOR DoActorDecide;
if (TEST(sp->cstat, CSTAT_SPRITE_RESTORE))
if (TEST(actor->spr.cstat, CSTAT_SPRITE_RESTORE))
{
u = actor->u();
ASSERT(u);
@ -475,11 +474,11 @@ int SetupLava(DSWActor* actor)
u->Rot = sg_LavaRun;
EnemyDefaults(actor, &LavaActionSet, &LavaPersonality);
sp->xrepeat = sp->yrepeat = 110;
sp->clipdist = (512) >> 2;
actor->spr.xrepeat = actor->spr.yrepeat = 110;
actor->spr.clipdist = (512) >> 2;
SET(u->Flags, SPR_XFLIP_TOGGLE|SPR_ELECTRO_TOLERANT);
u->loz = sp->pos.Z;
u->loz = actor->spr.pos.Z;
return 0;
}

View file

@ -2022,7 +2022,8 @@ bool NearThings(PLAYERp pp)
// This can work with any sprite!
if (near.actor() != nullptr)
{
SPRITEp sp = &near.actor()->s();
auto actor = near.actor();
SPRITEp sp = &actor->s();
// Go through list of cases
if (sp->hitag == PLAYER_SOUNDEVENT_TAG)
@ -2206,15 +2207,15 @@ void BuildNearTagList(NEAR_TAG_INFOp ntip, int size, PLAYERp pp, int z, int dist
int DoPlayerGrabStar(PLAYERp pp)
{
SPRITEp sp = nullptr;
int i;
// MUST check exact z's of each star or it will never work
for (i = 0; i < MAX_STAR_QUEUE; i++)
{
if (StarQueue[i] != nullptr)
auto actor = StarQueue[i];
if (actor != nullptr)
{
sp = &StarQueue[i]->s();
auto sp = &actor->s();
if (FindDistance3D(sp->pos.X - pp->pos.X, sp->pos.Y - pp->pos.Y, sp->pos.Z - pp->pos.Z + Z(12)) < 500)
{

View file

@ -811,10 +811,9 @@ void BossHealthMeter(void)
SWStatIterator it(STAT_ENEMY);
while (auto itActor = it.Next())
{
sp = &itActor->s();
u = itActor->u();
if ((u->ID == SERP_RUN_R0 || u->ID == SUMO_RUN_R0 || u->ID == ZILLA_RUN_R0) && sp->pal != 16)
if ((u->ID == SERP_RUN_R0 || u->ID == SUMO_RUN_R0 || u->ID == ZILLA_RUN_R0) && itActor->spr.pal != 16)
{
if (u->ID == SERP_RUN_R0 && (currentLevel->gameflags & LEVEL_SW_BOSSMETER_SERPENT))
BossSpriteNum[0] = itActor;
@ -833,10 +832,11 @@ void BossHealthMeter(void)
// Only show the meter when you can see the boss
for (int i=0; i<3; i++)
{
if (BossSpriteNum[i] != nullptr && !bosswasseen[i])
auto actor = BossSpriteNum[i];
if (actor != nullptr && !bosswasseen[i])
{
sp = &BossSpriteNum[i]->s();
u = BossSpriteNum[i]->u();
sp = &actor->s();
u = actor->u();
if (cansee(sp->pos.X, sp->pos.Y, GetSpriteZOfTop(sp), sp->sector(), pp->pos.X, pp->pos.Y, pp->pos.Z - Z(40), pp->cursector))
{
@ -871,16 +871,12 @@ void BossHealthMeter(void)
for (int i=0; i<3; i++)
{
if (i == 0 && (!bosswasseen[0] || BossSpriteNum[0] == nullptr))
continue;
if (i == 1 && (!bosswasseen[1] || BossSpriteNum[1] == nullptr))
continue;
if (i == 2 && (!bosswasseen[2] || BossSpriteNum[2] == nullptr))
auto actor = BossSpriteNum[i];
if ((!bosswasseen[i] || actor == nullptr))
continue;
sp = &BossSpriteNum[i]->s();
u = BossSpriteNum[i]->u();
sp = &actor->s();
u = actor->u();
if (u->ID == SERP_RUN_R0 && bosswasseen[0])
{