mirror of
https://github.com/DrBeef/Raze.git
synced 2025-01-20 08:00:56 +00:00
- some sp replacements as preparation for replacing most of 'actor->s()'.
This commit is contained in:
parent
ca14c809f9
commit
76809965ad
7 changed files with 37 additions and 41 deletions
|
@ -62,8 +62,7 @@ void PreCacheOverride(void)
|
||||||
SWStatIterator it(STAT_CEILING_FLOOR_PIC_OVERRIDE);
|
SWStatIterator it(STAT_CEILING_FLOOR_PIC_OVERRIDE);
|
||||||
while (auto actor = it.Next())
|
while (auto actor = it.Next())
|
||||||
{
|
{
|
||||||
auto sp = &actor->s();
|
int j = SP_TAG2(&actor->spr);
|
||||||
int j = SP_TAG2(sp);
|
|
||||||
if(j >= 0 && j <= MAXTILES)
|
if(j >= 0 && j <= MAXTILES)
|
||||||
markTileForPrecache(j, 0);
|
markTileForPrecache(j, 0);
|
||||||
}
|
}
|
||||||
|
|
|
@ -164,9 +164,8 @@ void CopySectorMatch(int match)
|
||||||
itsec.Reset(ssectp);
|
itsec.Reset(ssectp);
|
||||||
while (auto itActor = itsec.Next())
|
while (auto itActor = itsec.Next())
|
||||||
{
|
{
|
||||||
auto sp = &itActor->s();
|
|
||||||
// don't move ST1 Copy Tags
|
// 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;
|
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);
|
SectorMidPoint(dest_sp->sector(), &dx, &dy, &trash);
|
||||||
|
|
||||||
// get offset
|
// get offset
|
||||||
src_xoff = sx - sp->pos.X;
|
src_xoff = sx - itActor->spr.pos.X;
|
||||||
src_yoff = sy - sp->pos.Y;
|
src_yoff = sy - itActor->spr.pos.Y;
|
||||||
|
|
||||||
// move sprite to dest sector
|
// move sprite to dest sector
|
||||||
sp->pos.X = dx - src_xoff;
|
itActor->spr.pos.X = dx - src_xoff;
|
||||||
sp->pos.Y = dy - src_yoff;
|
itActor->spr.pos.Y = dy - src_yoff;
|
||||||
|
|
||||||
// change sector
|
// change sector
|
||||||
ChangeActorSect(itActor, dsectp);
|
ChangeActorSect(itActor, dsectp);
|
||||||
|
@ -193,7 +192,7 @@ void CopySectorMatch(int match)
|
||||||
SECTOR_OBJECTp sop;
|
SECTOR_OBJECTp sop;
|
||||||
|
|
||||||
// find and add sprite to SO
|
// find and add sprite to SO
|
||||||
sop = DetectSectorObject(sp->sector());
|
sop = DetectSectorObject(itActor->spr.sector());
|
||||||
AddSpriteToSectorObject(itActor, sop);
|
AddSpriteToSectorObject(itActor, sop);
|
||||||
|
|
||||||
// update sprites postions so they aren't in the
|
// update sprites postions so they aren't in the
|
||||||
|
|
|
@ -2125,6 +2125,11 @@ inline int ActorZOfTop(DSWActor* actor)
|
||||||
return GetSpriteZOfTop(&actor->spr);
|
return GetSpriteZOfTop(&actor->spr);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
inline int ActorZOfBottom(DSWActor* actor)
|
||||||
|
{
|
||||||
|
return GetSpriteZOfBottom(&actor->spr);
|
||||||
|
}
|
||||||
|
|
||||||
inline int ActorSizeZ(DSWActor* actor)
|
inline int ActorSizeZ(DSWActor* actor)
|
||||||
{
|
{
|
||||||
return (tileHeight(actor->spr.picnum) * actor->spr.yrepeat) << 2;
|
return (tileHeight(actor->spr.picnum) * actor->spr.yrepeat) << 2;
|
||||||
|
|
|
@ -1507,7 +1507,8 @@ int PlayerInitFlashBomb(PLAYERp pp)
|
||||||
unsigned int stat;
|
unsigned int stat;
|
||||||
int dist, tx, ty, tmin;
|
int dist, tx, ty, tmin;
|
||||||
short damage;
|
short damage;
|
||||||
SPRITEp sp = &pp->Actor()->s(), hp;
|
auto actor = pp->actor;
|
||||||
|
SPRITEp sp = &actor->s(), hp;
|
||||||
USERp hu;
|
USERp hu;
|
||||||
|
|
||||||
PlaySound(DIGI_GASPOP, pp, v3df_dontpan | v3df_doppler);
|
PlaySound(DIGI_GASPOP, pp, v3df_dontpan | v3df_doppler);
|
||||||
|
@ -2022,7 +2023,6 @@ DSWActor* DoFlagRangeTest(DSWActor* actor, int range)
|
||||||
{
|
{
|
||||||
SPRITEp wp = &actor->s();
|
SPRITEp wp = &actor->s();
|
||||||
|
|
||||||
SPRITEp sp;
|
|
||||||
unsigned int stat;
|
unsigned int stat;
|
||||||
int dist, tx, ty;
|
int dist, tx, ty;
|
||||||
int tmin;
|
int tmin;
|
||||||
|
@ -2032,26 +2032,23 @@ DSWActor* DoFlagRangeTest(DSWActor* actor, int range)
|
||||||
SWStatIterator it(StatDamageList[stat]);
|
SWStatIterator it(StatDamageList[stat]);
|
||||||
while (auto itActor = it.Next())
|
while (auto itActor = it.Next())
|
||||||
{
|
{
|
||||||
sp = &itActor->s();
|
DISTANCE(itActor->spr.pos.X, itActor->spr.pos.Y, wp->pos.X, wp->pos.Y, dist, tx, ty, tmin);
|
||||||
|
|
||||||
|
|
||||||
DISTANCE(sp->pos.X, sp->pos.Y, wp->pos.X, wp->pos.Y, dist, tx, ty, tmin);
|
|
||||||
if (dist > range)
|
if (dist > range)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (actor == itActor)
|
if (actor == itActor)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (!TEST(sp->cstat, CSTAT_SPRITE_BLOCK))
|
if (!TEST(itActor->spr.cstat, CSTAT_SPRITE_BLOCK))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (!TEST(sp->extra, SPRX_PLAYER_OR_ENEMY))
|
if (!TEST(itActor->spr.extra, SPRX_PLAYER_OR_ENEMY))
|
||||||
continue;
|
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;
|
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)
|
if (dist > range)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
|
|
@ -453,11 +453,10 @@ ACTOR_ACTION_SET LavaActionSet =
|
||||||
|
|
||||||
int SetupLava(DSWActor* actor)
|
int SetupLava(DSWActor* actor)
|
||||||
{
|
{
|
||||||
SPRITEp sp = &actor->s();
|
|
||||||
USERp u;
|
USERp u;
|
||||||
ANIMATOR DoActorDecide;
|
ANIMATOR DoActorDecide;
|
||||||
|
|
||||||
if (TEST(sp->cstat, CSTAT_SPRITE_RESTORE))
|
if (TEST(actor->spr.cstat, CSTAT_SPRITE_RESTORE))
|
||||||
{
|
{
|
||||||
u = actor->u();
|
u = actor->u();
|
||||||
ASSERT(u);
|
ASSERT(u);
|
||||||
|
@ -475,11 +474,11 @@ int SetupLava(DSWActor* actor)
|
||||||
u->Rot = sg_LavaRun;
|
u->Rot = sg_LavaRun;
|
||||||
|
|
||||||
EnemyDefaults(actor, &LavaActionSet, &LavaPersonality);
|
EnemyDefaults(actor, &LavaActionSet, &LavaPersonality);
|
||||||
sp->xrepeat = sp->yrepeat = 110;
|
actor->spr.xrepeat = actor->spr.yrepeat = 110;
|
||||||
sp->clipdist = (512) >> 2;
|
actor->spr.clipdist = (512) >> 2;
|
||||||
SET(u->Flags, SPR_XFLIP_TOGGLE|SPR_ELECTRO_TOLERANT);
|
SET(u->Flags, SPR_XFLIP_TOGGLE|SPR_ELECTRO_TOLERANT);
|
||||||
|
|
||||||
u->loz = sp->pos.Z;
|
u->loz = actor->spr.pos.Z;
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -2022,7 +2022,8 @@ bool NearThings(PLAYERp pp)
|
||||||
// This can work with any sprite!
|
// This can work with any sprite!
|
||||||
if (near.actor() != nullptr)
|
if (near.actor() != nullptr)
|
||||||
{
|
{
|
||||||
SPRITEp sp = &near.actor()->s();
|
auto actor = near.actor();
|
||||||
|
SPRITEp sp = &actor->s();
|
||||||
|
|
||||||
// Go through list of cases
|
// Go through list of cases
|
||||||
if (sp->hitag == PLAYER_SOUNDEVENT_TAG)
|
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)
|
int DoPlayerGrabStar(PLAYERp pp)
|
||||||
{
|
{
|
||||||
SPRITEp sp = nullptr;
|
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
// MUST check exact z's of each star or it will never work
|
// MUST check exact z's of each star or it will never work
|
||||||
for (i = 0; i < MAX_STAR_QUEUE; i++)
|
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)
|
if (FindDistance3D(sp->pos.X - pp->pos.X, sp->pos.Y - pp->pos.Y, sp->pos.Z - pp->pos.Z + Z(12)) < 500)
|
||||||
{
|
{
|
||||||
|
|
|
@ -811,10 +811,9 @@ void BossHealthMeter(void)
|
||||||
SWStatIterator it(STAT_ENEMY);
|
SWStatIterator it(STAT_ENEMY);
|
||||||
while (auto itActor = it.Next())
|
while (auto itActor = it.Next())
|
||||||
{
|
{
|
||||||
sp = &itActor->s();
|
|
||||||
u = itActor->u();
|
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))
|
if (u->ID == SERP_RUN_R0 && (currentLevel->gameflags & LEVEL_SW_BOSSMETER_SERPENT))
|
||||||
BossSpriteNum[0] = itActor;
|
BossSpriteNum[0] = itActor;
|
||||||
|
@ -833,10 +832,11 @@ void BossHealthMeter(void)
|
||||||
// Only show the meter when you can see the boss
|
// Only show the meter when you can see the boss
|
||||||
for (int i=0; i<3; i++)
|
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();
|
sp = &actor->s();
|
||||||
u = BossSpriteNum[i]->u();
|
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))
|
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++)
|
for (int i=0; i<3; i++)
|
||||||
{
|
{
|
||||||
|
auto actor = BossSpriteNum[i];
|
||||||
if (i == 0 && (!bosswasseen[0] || BossSpriteNum[0] == nullptr))
|
if ((!bosswasseen[i] || actor == nullptr))
|
||||||
continue;
|
|
||||||
if (i == 1 && (!bosswasseen[1] || BossSpriteNum[1] == nullptr))
|
|
||||||
continue;
|
|
||||||
if (i == 2 && (!bosswasseen[2] || BossSpriteNum[2] == nullptr))
|
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
sp = &BossSpriteNum[i]->s();
|
sp = &actor->s();
|
||||||
u = BossSpriteNum[i]->u();
|
u = actor->u();
|
||||||
|
|
||||||
if (u->ID == SERP_RUN_R0 && bosswasseen[0])
|
if (u->ID == SERP_RUN_R0 && bosswasseen[0])
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue