- moved the backup... methods to DCoreActor.

This commit is contained in:
Christoph Oelckers 2021-12-30 17:10:08 +01:00
parent 6c381d4392
commit c10fb1278a
24 changed files with 103 additions and 103 deletions

View file

@ -42,6 +42,42 @@ public:
return spr.time;
}
void backupx()
{
spr.opos.X = spr.pos.X;
}
void backupy()
{
spr.opos.Y = spr.pos.Y;
}
void backupz()
{
spr.opos.Z = spr.pos.Z;
}
void backupvec2()
{
spr.opos.vec2 = spr.pos.vec2;
}
void backuppos()
{
spr.opos = spr.pos;
}
void backupang()
{
spr.oang = spr.ang;
}
void backuploc()
{
backuppos();
backupang();
}
sectortype* sector() const
{
return spr.sectp;

View file

@ -490,42 +490,6 @@ struct spritetypebase
{
return interpolatedangle(oang, ang, smoothratio, 16);
}
void backupx()
{
opos.X = pos.X;
}
void backupy()
{
opos.Y = pos.Y;
}
void backupz()
{
opos.Z = pos.Z;
}
void backupvec2()
{
opos.vec2 = pos.vec2;
}
void backuppos()
{
opos = pos;
}
void backupang()
{
oang = ang;
}
void backuploc()
{
backuppos();
backupang();
}
};

View file

@ -175,7 +175,7 @@ inline void viewBackupSpriteLoc(DBloodActor* actor)
{
if (!actor->interpolated)
{
actor->spr.backuploc();
actor->backuploc();
actor->interpolated = true;
}
}

View file

@ -404,7 +404,7 @@ void moveplayers(void)
act->spr.pos.X = p->opos.X;
act->spr.pos.Y = p->opos.Y;
act->spr.pos.Z = p->opos.Z + gs.playerheight;
act->spr.backupz();
act->backupz();
act->spr.ang = p->angle.oang.asbuild();
SetActor(act, act->spr.pos);
}
@ -1052,7 +1052,7 @@ void movewaterdrip(DDukeActor *actor, int drip)
else
{
actor->spr.pos.Z = actor->temp_data[0];
actor->spr.backupz();
actor->backupz();
actor->temp_data[1] = 48 + (krand() & 31);
}
}
@ -2903,7 +2903,7 @@ void handle_se14(DDukeActor* actor, bool checkstat, int RPG, int JIBS6)
if (numplayers > 1)
{
a2->spr.backupvec2();
a2->backupvec2();
}
}
}
@ -3067,7 +3067,7 @@ void handle_se30(DDukeActor *actor, int JIBS6)
if (numplayers > 1)
{
a2->spr.backupvec2();
a2->backupvec2();
}
}
}
@ -3847,7 +3847,7 @@ void handle_se17(DDukeActor* actor)
}
if (act1->spr.statnum != STAT_EFFECTOR)
{
act1->spr.backupz();
act1->backupz();
act1->spr.pos.Z += q;
}
@ -3915,7 +3915,7 @@ void handle_se17(DDukeActor* actor)
act3->spr.pos.Y += act2->spr.pos.Y - actor->spr.pos.Y;
act3->spr.pos.Z = act2->sector()->floorz - (sc->floorz - act3->spr.pos.Z);
act3->spr.backupz();
act3->backupz();
ChangeActorSect(act3, act2->sector());
SetActor(act3, act3->spr.pos);
@ -5201,7 +5201,7 @@ void recordoldspritepos()
DukeStatIterator it(statNum);
while (auto ac = it.Next())
{
ac->spr.backuploc();
ac->backuploc();
}
}
}

View file

@ -2126,7 +2126,7 @@ void movetransports_d(void)
act2->spr.pos.Z -= act->spr.pos.Z - Owner->sector()->floorz;
act2->spr.ang = Owner->spr.ang;
act2->spr.backupang();
act2->backupang();
if (act->spr.pal == 0)
{
@ -2152,7 +2152,7 @@ void movetransports_d(void)
act2->spr.pos.Y += (Owner->spr.pos.Y - act->spr.pos.Y);
act2->spr.pos.Z = Owner->spr.pos.Z + 4096;
act2->spr.backupz();
act2->backupz();
ChangeActorSect(act2, Owner->sector());
}
@ -2162,7 +2162,7 @@ void movetransports_d(void)
act2->spr.pos.Y += (Owner->spr.pos.Y - act->spr.pos.Y);
act2->spr.pos.Z = Owner->sector()->ceilingz + ll;
act2->spr.backupz();
act2->backupz();
ChangeActorSect(act2, Owner->sector());
@ -2172,7 +2172,7 @@ void movetransports_d(void)
act2->spr.pos.Y += (Owner->spr.pos.Y - act->spr.pos.Y);
act2->spr.pos.Z = Owner->sector()->floorz - ll;
act2->spr.backupz();
act2->backupz();
ChangeActorSect(act2, Owner->sector());
@ -3709,7 +3709,7 @@ void move_d(DDukeActor *actor, int playernum, int xvel)
{
if ((badguy(actor) && actor->spr.extra <= 0) || (actor->spr.opos.X != actor->spr.pos.X) || (actor->spr.opos.Y != actor->spr.pos.Y))
{
actor->spr.backupvec2();
actor->backupvec2();
SetActor(actor, actor->spr.pos);
}
return;

View file

@ -1822,7 +1822,7 @@ void movetransports_r(void)
act2->spr.pos.Z -= act->spr.pos.Z - Owner->sector()->floorz;
act2->spr.ang = Owner->spr.ang;
act2->spr.backupang();
act2->backupang();
auto beam = spawn(act, TRANSPORTERBEAM);
if (beam) S_PlayActorSound(TELEPORTER, beam);
@ -1845,7 +1845,7 @@ void movetransports_r(void)
act2->spr.pos.Y += (Owner->spr.pos.Y - act->spr.pos.Y);
act2->spr.pos.Z = Owner->spr.pos.Z + 4096;
act2->spr.backupz();
act2->backupz();
ChangeActorSect(act2, Owner->sector());
}
@ -1855,7 +1855,7 @@ void movetransports_r(void)
act2->spr.pos.Y += (Owner->spr.pos.Y - act->spr.pos.Y);
act2->spr.pos.Z = Owner->sector()->ceilingz + ll;
act2->spr.backupz();
act2->backupz();
ChangeActorSect(act2, Owner->sector());
@ -1865,7 +1865,7 @@ void movetransports_r(void)
act2->spr.pos.Y += (Owner->spr.pos.Y - act->spr.pos.Y);
act2->spr.pos.Z = Owner->sector()->floorz - ll;
act2->spr.backupz();
act2->backupz();
ChangeActorSect(act2, Owner->sector());
@ -1877,7 +1877,7 @@ void movetransports_r(void)
act2->spr.pos.Y += (Owner->spr.pos.Y - act->spr.pos.Y);
act2->spr.pos.Z = Owner->sector()->ceilingz + ll2;
act2->spr.backupz();
act2->backupz();
ChangeActorSect(act2, Owner->sector());
@ -1891,7 +1891,7 @@ void movetransports_r(void)
act2->spr.pos.Y += (Owner->spr.pos.Y - act->spr.pos.Y);
act2->spr.pos.Z = Owner->sector()->floorz - ll2;
act2->spr.backupz();
act2->backupz();
ChangeActorSect(act2, Owner->sector());
@ -3756,7 +3756,7 @@ void move_r(DDukeActor *actor, int pnum, int xvel)
{
if ((badguy(actor) && actor->spr.extra <= 0) || (actor->spr.opos.X != actor->spr.pos.X) || (actor->spr.opos.Y != actor->spr.pos.Y))
{
actor->spr.backupvec2();
actor->backupvec2();
SetActor(actor, actor->spr.pos);
}
if (badguy(actor) && actor->spr.extra <= 0)

View file

@ -2248,7 +2248,7 @@ int ParseState::parse(void)
g_ac->spr.pos.X = ps[g_p].bobpos.X = ps[g_p].opos.X = ps[g_p].pos.X;
g_ac->spr.pos.Y = ps[g_p].bobpos.Y = ps[g_p].opos.Y = ps[g_p].pos.Y;
g_ac->spr.pos.Z = ps[g_p].opos.Z = ps[g_p].pos.Z;
g_ac->spr.backuppos();
g_ac->backuppos();
updatesector(ps[g_p].pos.X, ps[g_p].pos.Y, &ps[g_p].cursector);
SetActor(ps[g_p].GetActor(), { ps[g_p].pos.X, ps[g_p].pos.Y, ps[g_p].pos.Z + gs.playerheight });
g_ac->spr.cstat = CSTAT_SPRITE_BLOCK_ALL;

View file

@ -628,7 +628,7 @@ void resetpspritevars(int g)
ps[j].bobpos.X = ps[j].opos.X = ps[j].pos.X = act->spr.pos.X;
ps[j].bobpos.Y = ps[j].opos.Y = ps[j].pos.Y = act->spr.pos.Y;
ps[j].opos.Z = ps[j].pos.Z = act->spr.pos.Z;
act->spr.backuppos();
act->backuppos();
ps[j].angle.oang = ps[j].angle.ang = buildang(act->spr.ang);
updatesector(act->spr.pos.X, act->spr.pos.Y, &ps[j].cursector);

View file

@ -359,7 +359,7 @@ void doanimations(void)
{
if (act->spr.statnum != STAT_EFFECTOR)
{
act->spr.backupz();
act->backupz();
act->spr.pos.Z += v;
act->floorz = dasectp->floorz + v;
}

View file

@ -78,7 +78,7 @@ DDukeActor* EGS(sectortype* whatsectp, int s_x, int s_y, int s_z, int s_pn, int8
act->spr.clipdist = 0;
act->spr.pal = 0;
act->spr.lotag = 0;
act->spr.backuploc();
act->backuploc();
act->ovel.X = 0;
act->ovel.Y = 0;
@ -141,7 +141,7 @@ bool initspriteforspawn(DDukeActor* act, const std::initializer_list<int> &exclu
act->timetosleep = 0;
act->extra = -1;
act->spr.backuppos();
act->backuppos();
act->SetOwner(act);
act->SetHitOwner(act);

View file

@ -91,7 +91,7 @@ DExhumedActor* BuildAnim(DExhumedActor* pActor, int val, int val2, int x, int y,
pActor->spr.xvel = 0;
pActor->spr.yvel = 0;
pActor->spr.zvel = 0;
pActor->spr.backuppos();
pActor->backuppos();
// CHECKME - where is hitag set otherwise?
if (pActor->spr.statnum < 900) {

View file

@ -59,7 +59,7 @@ DExhumedActor* BuildBubble(vec3_t pos, sectortype* pSector)
pActor->spr.hitag = -1;
pActor->spr.extra = -1;
pActor->spr.lotag = runlist_HeadRun() + 1;
pActor->spr.backuppos();
pActor->backuppos();
// GrabTimeSlot(3);

View file

@ -702,7 +702,7 @@ DExhumedActor* BuildBullet(DExhumedActor* pActor, int nType, int nZOffset, int n
pBullet->nRunRec2 = runlist_AddRunRec(NewRun, nBullet, 0xB0000);
pBullet->nDoubleDamage = nDoubleDamage;
pBulletActor->spr.pos.Z += nZOffset;
pBulletActor->spr.backuppos();
pBulletActor->backuppos();
int var_18 = 0;

View file

@ -268,7 +268,7 @@ void GameMove(void)
ExhumedSpriteIterator it;
while (auto ac = it.Next())
{
ac->spr.backuploc();
ac->backuploc();
}
if (currentLevel->gameflags & LEVEL_EX_COUNTDOWN)

View file

@ -124,7 +124,7 @@ void BuildGrenade(int nPlayer)
pActor->spr.hitag = 0;
pActor->spr.lotag = runlist_HeadRun() + 1;
pActor->spr.extra = -1;
pActor->spr.backuppos();
pActor->backuppos();
// GrabTimeSlot(3);

View file

@ -1024,7 +1024,7 @@ int BuildSlide(int nChannel, walltype* pStartWall, walltype* pWall1, walltype* p
pActor->spr.pos.X = pStartWall->pos.X;
pActor->spr.pos.Y = pStartWall->pos.Y;
pActor->spr.pos.Z = pSector->floorz;
pActor->spr.backuppos();
pActor->backuppos();
SlideData[nSlide].nRunC = 0;
@ -1253,7 +1253,7 @@ int BuildTrap(DExhumedActor* pActor, int edx, int ebx, int ecx)
}
}
}
pActor->spr.backuppos();
pActor->backuppos();
return nTrap;
}
@ -1407,7 +1407,7 @@ DExhumedActor* BuildSpark(DExhumedActor* pActor, int nVal)
pSpark->spr.lotag = runlist_HeadRun() + 1;
pSpark->spr.clipdist = 1;
pSpark->spr.hitag = 0;
pSpark->spr.backuppos();
pSpark->backuppos();
// GrabTimeSlot(3);
@ -1602,7 +1602,7 @@ DExhumedActor* BuildEnergyBlock(sectortype* pSector)
pActor->spr.lotag = runlist_HeadRun() + 1;
pActor->spr.hitag = 0;
pActor->spr.owner = runlist_AddRunRec(pActor->spr.lotag - 1, pActor, 0x250000);
pActor->spr.backuppos();
pActor->backuppos();
return pActor;
}
@ -1847,7 +1847,7 @@ DExhumedActor* BuildObject(DExhumedActor* pActor, int nOjectType, int nHitag)
pActor->nIndex2 = -nHitag;
}
}
pActor->spr.backuppos();
pActor->backuppos();
return pActor;
}

View file

@ -463,7 +463,7 @@ void BuildQueenEgg(int nQueen, int nVal)
pActor2->spr.shade = -12;
pActor2->spr.picnum = 1;
pActor2->spr.ang = (RandomSize(9) + (nAngle - 256)) & kAngleMask;
pActor2->spr.backuppos();
pActor2->backuppos();
if (!nVal)
{

View file

@ -223,7 +223,7 @@ void BuildSnake(int nPlayer, int zVal)
pActor->spr.hitag = 0;
pActor->spr.extra = -1;
pActor->spr.lotag = runlist_HeadRun() + 1;
pActor->spr.backuppos();
pActor->backuppos();
SnakeList[nSnake].pSprites[i] = pActor;

View file

@ -515,7 +515,7 @@ void KeepActorOnFloor(DSWActor* actor)
actor->user.Flags &= ~(SPR_SWIMMING);
actor->spr.cstat &= ~(CSTAT_SPRITE_YCENTER);
actor->user.oz = actor->spr.pos.Z = actor->user.loz;
actor->spr.backupz();
actor->backupz();
return;
}
@ -526,7 +526,7 @@ void KeepActorOnFloor(DSWActor* actor)
// are swimming
actor->user.oz = actor->spr.pos.Z = actor->user.loz - Z(depth);
actor->spr.backupz();
actor->backupz();
}
else
{
@ -535,7 +535,7 @@ void KeepActorOnFloor(DSWActor* actor)
{
NewStateGroup(actor, actor->user.ActorActionSet->Swim);
actor->user.oz = actor->spr.pos.Z = actor->user.loz - Z(depth);
actor->spr.backupz();
actor->backupz();
actor->user.Flags |= (SPR_SWIMMING);
actor->spr.cstat |= (CSTAT_SPRITE_YCENTER);
}
@ -544,7 +544,7 @@ void KeepActorOnFloor(DSWActor* actor)
actor->user.Flags &= ~(SPR_SWIMMING);
actor->spr.cstat &= ~(CSTAT_SPRITE_YCENTER);
actor->user.oz = actor->spr.pos.Z = actor->user.loz;
actor->spr.backupz();
actor->backupz();
}
}
@ -559,7 +559,7 @@ void KeepActorOnFloor(DSWActor* actor)
if (actor->user.Flags & (SPR_MOVED))
{
actor->user.oz = actor->spr.pos.Z = actor->user.loz;
actor->spr.backupz();
actor->backupz();
}
else
{
@ -569,7 +569,7 @@ void KeepActorOnFloor(DSWActor* actor)
&ceilz, &ctrash, &florz, &ftrash);
actor->user.oz = actor->spr.pos.Z = florz;
actor->spr.backupz();
actor->backupz();
}
#endif

View file

@ -457,7 +457,7 @@ void EnemyDefaults(DSWActor* actor, ACTOR_ACTION_SETp action, PERSONALITYp perso
{
actor->spr.pos.Z += Z(depth);
actor->user.loz = actor->spr.pos.Z;
actor->spr.backupz();
actor->backupz();
}
if (!action)

View file

@ -1396,7 +1396,7 @@ void DoPlayerWarpTeleporter(PLAYERp pp)
break;
}
ppActor->spr.backuppos();
ppActor->backuppos();
}
void DoPlayerSetWadeDepth(PLAYERp pp)
@ -1451,14 +1451,14 @@ void DoPlayerCrawlHeight(PLAYERp pp)
void UpdatePlayerSpriteAngle(PLAYERp pp)
{
DSWActor* plActor = pp->actor;
plActor->spr.backupang();
plActor->backupang();
plActor->spr.ang = pp->angle.ang.asbuild();
plActor = pp->PlayerUnderActor;
if (!Prediction && plActor)
{
plActor->spr.backupang();
plActor->backupang();
plActor->spr.ang = pp->angle.ang.asbuild();
}
}
@ -6396,7 +6396,7 @@ void MoveSkipSavePos(void)
while (auto actor = it.Next())
{
if (!actor->hasU()) continue;
actor->spr.backuppos();
actor->backuppos();
actor->user.oz = actor->spr.opos.Z;
}
}
@ -6413,7 +6413,7 @@ void MoveSkipSavePos(void)
while (auto actor = it.Next())
{
if (!actor->hasU()) continue;
actor->spr.backuppos();
actor->backuppos();
actor->user.oz = actor->spr.opos.Z;
}
}
@ -6423,7 +6423,7 @@ void MoveSkipSavePos(void)
// back up all sprite angles.
while (auto actor = it.Next())
{
actor->spr.backupang();
actor->backupang();
}
}

View file

@ -849,7 +849,7 @@ void SpawnUser(DSWActor* actor, short id, STATEp state)
actor->user.motion_blur_num = 0;
actor->user.motion_blur_dist = 256;
actor->spr.backuppos();
actor->backuppos();
actor->user.oz = actor->spr.opos.Z;
actor->user.active_range = MIN_ACTIVE_RANGE;
@ -6340,7 +6340,7 @@ Collision move_sprite(DSWActor* actor, int xchange, int ychange, int zchange, in
void MissileWarpUpdatePos(DSWActor* actor, sectortype* sect)
{
actor->spr.backuppos();
actor->backuppos();
actor->user.oz = actor->spr.opos.Z;
ChangeActorSect(actor, sect);
MissileZrange(actor);
@ -6348,7 +6348,7 @@ void MissileWarpUpdatePos(DSWActor* actor, sectortype* sect)
void ActorWarpUpdatePos(DSWActor* actor, sectortype* sect)
{
actor->spr.backuppos();
actor->backuppos();
actor->user.oz = actor->spr.opos.Z;
ChangeActorSect(actor, sect);
DoActorZrange(actor);

View file

@ -840,7 +840,7 @@ void SectorObjectSetupBounds(SECTOR_OBJECTp sop)
itActor->user.RotNum = 0;
itActor->spr.backuppos();
itActor->backuppos();
itActor->user.oz = itActor->spr.opos.Z;
switch (itActor->spr.statnum)

View file

@ -10261,13 +10261,13 @@ void SpawnBigGunFlames(DSWActor* actor, DSWActor* Operator, SECTOR_OBJECTp sop,
{
// move with sector its on
expActor->spr.pos.Z = actor->sector()->floorz - actor->user.pos.Z;
expActor->spr.backupz();
expActor->backupz();
}
else
{
// move with the mid sector
expActor->spr.pos.Z = sop->mid_sector->floorz - actor->user.pos.Z;
expActor->spr.backupz();
expActor->backupz();
}
expActor->user.pos.X = actor->user.pos.X;
@ -10309,7 +10309,7 @@ void SpawnGrenadeSecondaryExp(DSWActor* actor, int ang)
}
SpawnExpZadjust(actor, expActor, Z(50), Z(10));
expActor->spr.backuppos();
expActor->backuppos();
}
int SpawnGrenadeSmallExp(DSWActor* actor)
@ -10417,7 +10417,7 @@ void SpawnExpZadjust(DSWActor* actor, DSWActor* expActor, int upper_zsize, int l
}
}
expActor->spr.backupz();
expActor->backupz();
}
void SpawnMineExp(DSWActor* actor)
@ -10815,7 +10815,7 @@ int DoNapalm(DSWActor* actor)
DoFindGroundPoint(expActor);
MissileWaterAdjust(expActor);
expActor->spr.pos.Z = expActor->user.loz;
expActor->spr.backupz();
expActor->backupz();
if (actor->user.Flags & (SPR_UNDERWATER))
expActor->user.Flags |= SPR_UNDERWATER;
@ -11089,7 +11089,7 @@ bool MissileSetPos(DSWActor* actor, ANIMATORp DoWeapon, int dist)
actor->spr.zvel = oldzvel;
// update for interpolation
actor->spr.backuppos();
actor->backuppos();
return retval;
}
@ -11130,7 +11130,7 @@ bool TestMissileSetPos(DSWActor* actor, ANIMATORp DoWeapon, int dist, int zvel)
actor->spr.zvel = oldzvel;
// update for interpolation
actor->spr.backuppos();
actor->backuppos();
return retval;
}
@ -11274,7 +11274,7 @@ void InitSpellRing(PLAYERp pp)
actorNew->spr.ang = NORM_ANGLE(actorNew->spr.ang + 512);
actorNew->spr.backuppos();
actorNew->backuppos();
if (pp->Flags & (PF_DIVING) || SpriteInUnderwaterArea(actorNew))
actorNew->user.Flags |= (SPR_UNDERWATER);
@ -12678,7 +12678,7 @@ int InitStar(PLAYERp pp)
if (pp->Flags & (PF_DIVING) || SpriteInUnderwaterArea(actorNew))
actorNew->user.Flags |= (SPR_UNDERWATER);
actorNew->spr.backuppos();
actorNew->backuppos();
for (size_t i = 0; i < countof(dang); i++)
{
@ -12715,7 +12715,7 @@ int InitStar(PLAYERp pp)
actorNew2->user.change.Y = MOVEy(actorNew2->spr.xvel, actorNew2->spr.ang);
actorNew2->user.change.Z = zvel;
actorNew2->spr.backuppos();
actorNew2->backuppos();
}
return 0;
@ -16636,7 +16636,7 @@ int HelpMissileLateral(DSWActor* actor, int dist)
actor->spr.xvel = old_xvel;
actor->spr.clipdist = old_clipdist;
actor->spr.backuppos();
actor->backuppos();
return 0;
}
@ -16992,7 +16992,7 @@ bool SpriteWarpToUnderwater(DSWActor* actor)
actor->spr.pos.Z = underActor->sector()->ceilingz + actor->user.ceiling_dist+Z(1);
actor->spr.backuppos();
actor->backuppos();
return true;
}
@ -17067,7 +17067,7 @@ bool SpriteWarpToSurface(DSWActor* actor)
MissileWaterAdjust(actor);
actor->spr.backuppos();
actor->backuppos();
return true;
}