- Replace spritetypebase oz with opos.Z calls and eliminate spritetypebase opos union.

This commit is contained in:
Mitchell Richters 2021-12-11 17:06:18 +11:00 committed by Christoph Oelckers
parent a79b4b5ffc
commit dd0ff465b0
9 changed files with 20 additions and 25 deletions

View file

@ -380,12 +380,7 @@ struct walltype
struct spritetypebase
{
// todo: get rid of the single variables!
vec3_t pos;
union {
struct { int32_t BLAHBLAHX, BLAHBLAHY, oz; };
vec3_t opos;
};
vec3_t pos, opos;
sectortype* sectp;
@ -423,17 +418,17 @@ struct spritetypebase
int32_t interpolatedx(double const smoothratio, int const scale = 16)
{
return interpolatedvalue(BLAHBLAHX, pos.X, smoothratio, scale);
return interpolatedvalue(opos.X, pos.X, smoothratio, scale);
}
int32_t interpolatedy(double const smoothratio, int const scale = 16)
{
return interpolatedvalue(BLAHBLAHY, pos.Y, smoothratio, scale);
return interpolatedvalue(opos.Y, pos.Y, smoothratio, scale);
}
int32_t interpolatedz(double const smoothratio, int const scale = 16)
{
return interpolatedvalue(oz, pos.Z, smoothratio, scale);
return interpolatedvalue(opos.Z, pos.Z, smoothratio, scale);
}
vec2_t interpolatedvec2(double const smoothratio, int const scale = 16)

View file

@ -53,7 +53,7 @@ void collectTSpritesForPortal(int x, int y, int i, int interpolation)
pTSprite->flags = pSprite->hitag | 0x200;
pTSprite->pos.X = dx + interpolatedvalue(pSprite->opos.X, pSprite->pos.X, interpolation);
pTSprite->pos.Y = dy + interpolatedvalue(pSprite->opos.Y, pSprite->pos.Y, interpolation);
pTSprite->pos.Z = dz + interpolatedvalue(pSprite->oz, pSprite->pos.Z, interpolation);
pTSprite->pos.Z = dz + interpolatedvalue(pSprite->opos.Z, pSprite->pos.Z, interpolation);
pTSprite->ang = pSprite->interpolatedang(interpolation);
int nAnim = 0;

View file

@ -3834,7 +3834,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.oz != actor->spr.pos.Z || (ud.multimode < 2 && ud.player_skill < 2))
if (actor->spr.opos.Z != actor->spr.pos.Z || (ud.multimode < 2 && ud.player_skill < 2))
{
if ((t[0] & 1) || ps[playernum].actorsqu == actor) return;
else daxvel <<= 1;

View file

@ -3876,7 +3876,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.oz != actor->spr.pos.Z || (ud.multimode < 2 && ud.player_skill < 2))
if (actor->spr.opos.Z != actor->spr.pos.Z || (ud.multimode < 2 && ud.player_skill < 2))
{
if ((t[0] & 1) || ps[pnum].actorsqu == actor) return;
else daxvel <<= 1;

View file

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

View file

@ -40,7 +40,7 @@ void GameInterface::WarpToCoords(int x, int y, int z, int ang, int horz)
pSprite->opos.X = pSprite->pos.X = x;
pSprite->opos.Y = pSprite->pos.Y = y;
pSprite->oz = pSprite->pos.Z = z;
pSprite->opos.Z = pSprite->pos.Z = z;
if (ang != INT_MIN)
{

View file

@ -6508,7 +6508,7 @@ void MoveSkipSavePos(void)
u = actor->u();
sp->backuppos();
u->oz = sp->oz;
u->oz = sp->opos.Z;
}
}
}
@ -6528,7 +6528,7 @@ void MoveSkipSavePos(void)
u = actor->u();
sp->backuppos();
u->oz = sp->oz;
u->oz = sp->opos.Z;
}
}
}

View file

@ -876,7 +876,7 @@ USERp SpawnUser(DSWActor* actor, short id, STATEp state)
u->motion_blur_dist = 256;
sp->backuppos();
u->oz = sp->oz;
u->oz = sp->opos.Z;
u->active_range = MIN_ACTIVE_RANGE;
@ -2128,7 +2128,7 @@ void SpriteSetup(void)
}
// set orig z
u->oz = sp->oz = sectp->floorz;
u->oz = sp->opos.Z = sectp->floorz;
}
else
{
@ -2149,7 +2149,7 @@ void SpriteSetup(void)
}
// set orig z
u->oz = sp->oz = sectp->ceilingz;
u->oz = sp->opos.Z = sectp->ceilingz;
}
@ -2333,7 +2333,7 @@ void SpriteSetup(void)
}
// set orig z
u->oz = sp->oz = u->zclip;
u->oz = sp->opos.Z = u->zclip;
}
else
{
@ -2351,7 +2351,7 @@ void SpriteSetup(void)
}
// set orig z
u->oz = sp->oz = u->zclip;
u->oz = sp->opos.Z = u->zclip;
}
change_actor_stat(actor, STAT_SPIKE);
@ -6542,7 +6542,7 @@ void MissileWarpUpdatePos(DSWActor* actor, sectortype* sect)
USERp u = actor->u();
SPRITEp sp = &actor->s();
sp->backuppos();
u->oz = sp->oz;
u->oz = sp->opos.Z;
ChangeActorSect(actor, sect);
MissileZrange(actor);
}
@ -6552,7 +6552,7 @@ void ActorWarpUpdatePos(DSWActor* actor, sectortype* sect)
USERp u = actor->u();
SPRITEp sp = &actor->s();
sp->backuppos();
u->oz = sp->oz;
u->oz = sp->opos.Z;
ChangeActorSect(actor, sect);
DoActorZrange(actor);
}

View file

@ -882,7 +882,7 @@ void SectorObjectSetupBounds(SECTOR_OBJECTp sop)
u->RotNum = 0;
sp->backuppos();
u->oz = sp->oz;
u->oz = sp->opos.Z;
switch (sp->statnum)
{