- moved opos and oang to DCoreActor.

This commit is contained in:
Christoph Oelckers 2021-12-30 18:21:02 +01:00
parent 2bb7cecf27
commit 552668418a
13 changed files with 49 additions and 52 deletions

View file

@ -20,6 +20,9 @@ public:
spriteext_t sprext;
spritesmooth_t spsmooth;
vec3_t opos;
int16_t oang;
DCoreActor() = default;
virtual ~DCoreActor() = default;
DCoreActor(const DCoreActor& other) = delete; // we also do not want to allow copies.
@ -44,17 +47,17 @@ public:
int32_t interpolatedx(double const smoothratio, int const scale = 16)
{
return interpolatedvalue(spr.opos.X, spr.pos.X, smoothratio, scale);
return interpolatedvalue(opos.X, spr.pos.X, smoothratio, scale);
}
int32_t interpolatedy(double const smoothratio, int const scale = 16)
{
return interpolatedvalue(spr.opos.Y, spr.pos.Y, smoothratio, scale);
return interpolatedvalue(opos.Y, spr.pos.Y, smoothratio, scale);
}
int32_t interpolatedz(double const smoothratio, int const scale = 16)
{
return interpolatedvalue(spr.opos.Z, spr.pos.Z, smoothratio, scale);
return interpolatedvalue(opos.Z, spr.pos.Z, smoothratio, scale);
}
vec2_t interpolatedvec2(double const smoothratio, int const scale = 16)
@ -78,37 +81,37 @@ public:
int16_t interpolatedang(double const smoothratio)
{
return interpolatedangle(spr.oang, spr.ang, smoothratio, 16);
return interpolatedangle(oang, spr.ang, smoothratio, 16);
}
void backupx()
{
spr.opos.X = spr.pos.X;
opos.X = spr.pos.X;
}
void backupy()
{
spr.opos.Y = spr.pos.Y;
opos.Y = spr.pos.Y;
}
void backupz()
{
spr.opos.Z = spr.pos.Z;
opos.Z = spr.pos.Z;
}
void backupvec2()
{
spr.opos.vec2 = spr.pos.vec2;
opos.vec2 = spr.pos.vec2;
}
void backuppos()
{
spr.opos = spr.pos;
opos = spr.pos;
}
void backupang()
{
spr.oang = spr.ang;
oang = spr.ang;
}
void backuploc()

View file

@ -416,7 +416,7 @@ struct walltype
struct spritetypebase
{
vec3_t pos, opos;
vec3_t pos;
sectortype* sectp;
@ -424,7 +424,6 @@ struct spritetypebase
int16_t picnum;
int16_t statnum;
int16_t ang;
int16_t oang;
int16_t xvel;
int16_t yvel;
union { int16_t zvel, inittype; }; // inittype, type and flags are for Blood.
@ -452,9 +451,6 @@ struct spritetype : public spritetypebase
{
int16_t owner;
int16_t detail;
int16_t wall; // wall and wdist are for Polymost only.
int8_t wdist;
};
//=============================================================================
@ -471,7 +467,6 @@ struct tspritetype : public spritetypebase
void copyfrom(spritetype* spr)
{
pos = spr->pos;
opos = spr->opos;
cstat = spr->cstat;
picnum = spr->picnum;
shade = spr->shade;
@ -485,7 +480,6 @@ struct tspritetype : public spritetypebase
sectp = spr->sectp;
statnum = spr->statnum;
ang = spr->ang;
oang = spr->oang;
xvel = spr->xvel;
yvel = spr->yvel;
zvel = spr->zvel;

View file

@ -50,9 +50,9 @@ void collectTSpritesForPortal(int x, int y, int i, int interpolation)
pTSprite->statnum = kStatDecoration;
pTSprite->ownerActor = actor;
pTSprite->flags = actor->spr.hitag | 0x200;
pTSprite->pos.X = dx + interpolatedvalue(actor->spr.opos.X, actor->spr.pos.X, interpolation);
pTSprite->pos.Y = dy + interpolatedvalue(actor->spr.opos.Y, actor->spr.pos.Y, interpolation);
pTSprite->pos.Z = dz + interpolatedvalue(actor->spr.opos.Z, actor->spr.pos.Z, interpolation);
pTSprite->pos.X = dx + interpolatedvalue(actor->opos.X, actor->spr.pos.X, interpolation);
pTSprite->pos.Y = dy + interpolatedvalue(actor->opos.Y, actor->spr.pos.Y, interpolation);
pTSprite->pos.Z = dz + interpolatedvalue(actor->opos.Z, actor->spr.pos.Z, interpolation);
pTSprite->ang = actor->interpolatedang(interpolation);
int nAnim = 0;

View file

@ -789,7 +789,7 @@ void movecrane(DDukeActor *actor, int crane)
{
SetActor(Owner, actor->spr.pos);
Owner->spr.opos = actor->spr.pos;
Owner->opos = actor->spr.pos;
actor->spr.zvel = 0;
}

View file

@ -1960,7 +1960,7 @@ void movetransports_d(void)
ps[p].opos.Z = ps[p].pos.Z;
auto pa = ps[p].GetActor();
pa->spr.opos = ps[p].pos;
pa->opos = ps[p].pos;
ChangeActorSect(act2, Owner->sector());
ps[p].setCursector(Owner->sector());
@ -3707,7 +3707,7 @@ void move_d(DDukeActor *actor, int playernum, int xvel)
if (actor->temp_data[1] == 0 || a == 0)
{
if ((badguy(actor) && actor->spr.extra <= 0) || (actor->spr.opos.X != actor->spr.pos.X) || (actor->spr.opos.Y != actor->spr.pos.Y))
if ((badguy(actor) && actor->spr.extra <= 0) || (actor->opos.X != actor->spr.pos.X) || (actor->opos.Y != actor->spr.pos.Y))
{
actor->backupvec2();
SetActor(actor, actor->spr.pos);
@ -3814,7 +3814,7 @@ void move_d(DDukeActor *actor, int playernum, int xvel)
}
else if (actor->spr.picnum != DRONE && actor->spr.picnum != SHARK && actor->spr.picnum != COMMANDER)
{
if (actor->spr.opos.Z != actor->spr.pos.Z || (ud.multimode < 2 && ud.player_skill < 2))
if (actor->opos.Z != actor->spr.pos.Z || (ud.multimode < 2 && ud.player_skill < 2))
{
if ((actor->temp_data[0] & 1) || ps[playernum].actorsqu == actor) return;
else daxvel <<= 1;

View file

@ -3754,7 +3754,7 @@ void move_r(DDukeActor *actor, int pnum, int xvel)
if (actor->temp_data[1] == 0 || a == 0)
{
if ((badguy(actor) && actor->spr.extra <= 0) || (actor->spr.opos.X != actor->spr.pos.X) || (actor->spr.opos.Y != actor->spr.pos.Y))
if ((badguy(actor) && actor->spr.extra <= 0) || (actor->opos.X != actor->spr.pos.X) || (actor->opos.Y != actor->spr.pos.Y))
{
actor->backupvec2();
SetActor(actor, actor->spr.pos);
@ -3867,7 +3867,7 @@ void move_r(DDukeActor *actor, int pnum, int xvel)
(!isRRRA() && actor->spr.picnum != DRONE && actor->spr.picnum != SHARK && actor->spr.picnum != UFO1_RR
&& actor->spr.picnum != UFO2 && actor->spr.picnum != UFO3 && actor->spr.picnum != UFO4 && actor->spr.picnum != UFO5))
{
if (actor->spr.opos.Z != actor->spr.pos.Z || (ud.multimode < 2 && ud.player_skill < 2))
if (actor->opos.Z != actor->spr.pos.Z || (ud.multimode < 2 && ud.player_skill < 2))
{
if ((actor->temp_data[0] & 1) || ps[pnum].actorsqu == actor) return;
else daxvel <<= 1;

View file

@ -1329,16 +1329,16 @@ void DoActor(bool bSet, int lVar1, int lLabelID, int lVar2, DDukeActor* sActor,
else SetGameVarID(lVar2, act->ovel.Y, sActor, sPlayer);
break;
case ACTOR_HTBPOSX:
if (bSet) act->spr.opos.X = lValue;
else SetGameVarID(lVar2, act->spr.opos.X, sActor, sPlayer);
if (bSet) act->opos.X = lValue;
else SetGameVarID(lVar2, act->opos.X, sActor, sPlayer);
break;
case ACTOR_HTBPOSY:
if (bSet) act->spr.opos.Y = lValue;
else SetGameVarID(lVar2, act->spr.opos.Y, sActor, sPlayer);
if (bSet) act->opos.Y = lValue;
else SetGameVarID(lVar2, act->opos.Y, sActor, sPlayer);
break;
case ACTOR_HTBPOSZ:
if (bSet) act->spr.opos.Z = lValue;
else SetGameVarID(lVar2, act->spr.opos.Z, sActor, sPlayer);
if (bSet) act->opos.Z = lValue;
else SetGameVarID(lVar2, act->opos.Z, sActor, sPlayer);
break;
case ACTOR_HTG_T0:
if (bSet) act->temp_data[0] = lValue;

View file

@ -37,7 +37,7 @@ void GameInterface::WarpToCoords(int x, int y, int z, int ang, int horz)
{
Player *nPlayer = &PlayerList[nLocalPlayer];
nPlayer->pActor->spr.opos = nPlayer->pActor->spr.pos = { x, y, z };
nPlayer->pActor->opos = nPlayer->pActor->spr.pos = { x, y, z };
if (ang != INT_MIN)
{

View file

@ -298,7 +298,7 @@ void SpawnMidSplash(DSWActor* actor)
actorNew->spr.shade = -12;
actorNew->spr.xrepeat = 70-RandomRange(20);
actorNew->spr.yrepeat = 70-RandomRange(20);
actorNew->spr.opos = actor->spr.opos;
actorNew->opos = actor->opos;
actorNew->spr.cstat |= (CSTAT_SPRITE_YCENTER);
actorNew->spr.cstat &= ~(CSTAT_SPRITE_BLOCK | CSTAT_SPRITE_BLOCK_HITSCAN);
@ -321,7 +321,7 @@ void SpawnFloorSplash(DSWActor* actor)
actorNew->spr.shade = -12;
actorNew->spr.xrepeat = 70-RandomRange(20);
actorNew->spr.yrepeat = 70-RandomRange(20);
actorNew->spr.opos = actor->spr.opos;
actorNew->opos = actor->opos;
actorNew->spr.cstat |= (CSTAT_SPRITE_YCENTER);
actorNew->spr.cstat &= ~(CSTAT_SPRITE_BLOCK | CSTAT_SPRITE_BLOCK_HITSCAN);
@ -523,7 +523,7 @@ int DoBloodSpray(DSWActor* actor)
actorNew->spr.shade = -12;
actorNew->spr.xrepeat = 40-RandomRange(30);
actorNew->spr.yrepeat = 40-RandomRange(30);
actorNew->spr.opos = actor->spr.opos;
actorNew->opos = actor->opos;
actorNew->spr.cstat |= (CSTAT_SPRITE_YCENTER);
actorNew->spr.cstat &= ~(CSTAT_SPRITE_BLOCK | CSTAT_SPRITE_BLOCK_HITSCAN);
@ -726,7 +726,7 @@ int DoPhosphorus(DSWActor* actor)
actorNew->spr.shade = -40;
actorNew->spr.xrepeat = 12 + RandomRange(10);
actorNew->spr.yrepeat = 12 + RandomRange(10);
actorNew->spr.opos = actor->spr.opos;
actorNew->opos = actor->opos;
actorNew->spr.cstat |= (CSTAT_SPRITE_YCENTER);
actorNew->spr.cstat &= ~(CSTAT_SPRITE_BLOCK | CSTAT_SPRITE_BLOCK_HITSCAN);
@ -948,7 +948,7 @@ int DoChemBomb(DSWActor* actor)
actorNew->spr.shade = -40;
actorNew->spr.xrepeat = 40;
actorNew->spr.yrepeat = 40;
actorNew->spr.opos = actor->spr.opos;
actorNew->opos = actor->opos;
// !Frank - dont do translucent
actorNew->spr.cstat |= (CSTAT_SPRITE_YCENTER);
// actorNew->spr.cstat |= (CSTAT_SPRITE_YCENTER|CSTAT_SPRITE_TRANSLUCENT);

View file

@ -6397,7 +6397,7 @@ void MoveSkipSavePos(void)
{
if (!actor->hasU()) continue;
actor->backuppos();
actor->user.oz = actor->spr.opos.Z;
actor->user.oz = actor->opos.Z;
}
}
}
@ -6414,7 +6414,7 @@ void MoveSkipSavePos(void)
{
if (!actor->hasU()) continue;
actor->backuppos();
actor->user.oz = actor->spr.opos.Z;
actor->user.oz = actor->opos.Z;
}
}
}

View file

@ -846,7 +846,7 @@ void SpawnUser(DSWActor* actor, short id, STATEp state)
actor->user.motion_blur_dist = 256;
actor->backuppos();
actor->user.oz = actor->spr.opos.Z;
actor->user.oz = actor->opos.Z;
actor->user.active_range = MIN_ACTIVE_RANGE;
@ -2057,7 +2057,7 @@ void SpriteSetup(void)
}
// set orig z
actor->user.oz = actor->spr.opos.Z = sectp->floorz;
actor->user.oz = actor->opos.Z = sectp->floorz;
}
else
{
@ -2077,7 +2077,7 @@ void SpriteSetup(void)
}
// set orig z
actor->user.oz = actor->spr.opos.Z = sectp->ceilingz;
actor->user.oz = actor->opos.Z = sectp->ceilingz;
}
@ -2259,7 +2259,7 @@ void SpriteSetup(void)
}
// set orig z
actor->user.oz = actor->spr.opos.Z = actor->user.zclip;
actor->user.oz = actor->opos.Z = actor->user.zclip;
}
else
{
@ -2277,7 +2277,7 @@ void SpriteSetup(void)
}
// set orig z
actor->user.oz = actor->spr.opos.Z = actor->user.zclip;
actor->user.oz = actor->opos.Z = actor->user.zclip;
}
change_actor_stat(actor, STAT_SPIKE);
@ -6337,7 +6337,7 @@ Collision move_sprite(DSWActor* actor, int xchange, int ychange, int zchange, in
void MissileWarpUpdatePos(DSWActor* actor, sectortype* sect)
{
actor->backuppos();
actor->user.oz = actor->spr.opos.Z;
actor->user.oz = actor->opos.Z;
ChangeActorSect(actor, sect);
MissileZrange(actor);
}
@ -6345,7 +6345,7 @@ void MissileWarpUpdatePos(DSWActor* actor, sectortype* sect)
void ActorWarpUpdatePos(DSWActor* actor, sectortype* sect)
{
actor->backuppos();
actor->user.oz = actor->spr.opos.Z;
actor->user.oz = actor->opos.Z;
ChangeActorSect(actor, sect);
DoActorZrange(actor);
}

View file

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

View file

@ -8398,7 +8398,7 @@ int DoGrenade(DSWActor* actor)
actorNew->spr.shade = -40;
actorNew->spr.xrepeat = 40;
actorNew->spr.yrepeat = 40;
actorNew->spr.opos = actor->spr.opos;
actorNew->opos = actor->opos;
actorNew->spr.cstat |= (CSTAT_SPRITE_YCENTER);
actorNew->spr.cstat &= ~(CSTAT_SPRITE_BLOCK|CSTAT_SPRITE_BLOCK_HITSCAN);
@ -9247,7 +9247,7 @@ int DoRail(DSWActor* actor)
actorNew->spr.shade = -40;
actorNew->spr.xrepeat = 10;
actorNew->spr.yrepeat = 10;
actorNew->spr.opos = actor->spr.opos;
actorNew->opos = actor->opos;
actorNew->spr.cstat |= (CSTAT_SPRITE_YCENTER);
actorNew->spr.cstat &= ~(CSTAT_SPRITE_BLOCK|CSTAT_SPRITE_BLOCK_HITSCAN);
@ -9340,7 +9340,7 @@ int DoRocket(DSWActor* actor)
actorNew->spr.shade = -40;
actorNew->spr.xrepeat = 40;
actorNew->spr.yrepeat = 40;
actorNew->spr.opos = actor->spr.opos;
actorNew->opos = actor->opos;
actorNew->spr.cstat |= (CSTAT_SPRITE_YCENTER);
actorNew->spr.cstat &= ~(CSTAT_SPRITE_BLOCK|CSTAT_SPRITE_BLOCK_HITSCAN);
@ -9429,7 +9429,7 @@ int DoMicro(DSWActor* actor)
actorNew->spr.shade = -40;
actorNew->spr.xrepeat = 20;
actorNew->spr.yrepeat = 20;
actorNew->spr.opos = actor->spr.opos;
actorNew->opos = actor->opos;
actorNew->spr.zvel = actor->spr.zvel;
actorNew->spr.cstat |= (CSTAT_SPRITE_YCENTER);
actorNew->spr.cstat &= ~(CSTAT_SPRITE_BLOCK|CSTAT_SPRITE_BLOCK_HITSCAN);