- eliminated most int_upos calls.

This commit is contained in:
Christoph Oelckers 2022-08-21 10:40:45 +02:00
parent df2f68efc1
commit 31dfd1af7a
6 changed files with 22 additions and 26 deletions

View file

@ -456,7 +456,7 @@ int DoFireFly(DSWActor* actor)
actor->user.WaitTics = (actor->user.WaitTics + (ACTORMOVETICS << 1)) & 2047;
actor->set_int_z(actor->user.int_upos().Z + MulScale(Z(32), bsin(actor->user.WaitTics), 14));
actor->spr.pos.Z = actor->user.pos.Z + 32 * DAngle::fromBuild(actor->user.WaitTics).Sin();
return 0;
}

View file

@ -404,11 +404,10 @@ int DoSkullJump(DSWActor* actor)
int DoSkullBob(DSWActor* actor)
{
// actor does a sine wave about actor->user.sz - this is the z mid point
const int SKULL_BOB_AMT = (Z(16));
const int SKULL_BOB_AMT = 16;
actor->user.Counter = (actor->user.Counter + (ACTORMOVETICS << 3) + (ACTORMOVETICS << 1)) & 2047;
actor->set_int_z(actor->user.int_upos().Z + MulScale(SKULL_BOB_AMT, bsin(actor->user.Counter), 14) +
MulScale((SKULL_BOB_AMT / 2), bsin(actor->user.Counter), 14));
actor->spr.pos.Z = actor->user.pos.Z + SKULL_BOB_AMT * 1.5 * DAngle::fromBuild(actor->user.Counter).Sin();
return 0;
}
@ -781,11 +780,10 @@ int DoBettyJump(DSWActor* actor)
int DoBettyBob(DSWActor* actor)
{
// actor does a sine wave about actor->user.sz - this is the z mid point
const int BETTY_BOB_AMT = (Z(16));
const int BETTY_BOB_AMT = 16;
actor->user.Counter = (actor->user.Counter + (ACTORMOVETICS << 3) + (ACTORMOVETICS << 1)) & 2047;
actor->set_int_z(actor->user.int_upos().Z + MulScale(BETTY_BOB_AMT, bsin(actor->user.Counter), 14) +
MulScale((BETTY_BOB_AMT / 2), bsin(actor->user.Counter), 14));
actor->spr.pos.Z = actor->user.pos.Z + BETTY_BOB_AMT * 1.5 * DAngle::fromBuild(actor->user.Counter).Sin();
return 0;
}

View file

@ -281,7 +281,7 @@ int DoSpike(DSWActor* actor)
if (actor->user.z_tgt == actor->spr.pos.Z)
{
// change target
actor->user.z_tgt = actor->user.int_upos().Z * zinttoworld;
actor->user.z_tgt = actor->user.pos.Z;
actor->user.vel_rate = -actor->user.vel_rate;
SetSpikeInactive(actor);
@ -382,7 +382,7 @@ int DoSpikeAuto(DSWActor* actor)
if (actor->user.z_tgt == actor->spr.pos.Z)
{
// change target
actor->user.z_tgt = actor->user.int_upos().Z * zinttoworld;
actor->user.z_tgt = actor->user.pos.Z;
actor->user.vel_rate = -actor->user.vel_rate;
actor->user.Tics = actor->user.WaitTics;

View file

@ -2051,7 +2051,7 @@ void SpriteSetup(void)
// start in the on position
sectp->add_int_floorz(amt);
actor->user.z_tgt = actor->user.int_upos().Z * zinttoworld;
actor->user.z_tgt = actor->user.pos.Z;
MoveSpritesWithSector(actor->sector(), amt, false); // floor
}
@ -2072,7 +2072,7 @@ void SpriteSetup(void)
// starting in the on position
sectp->add_int_ceilingz(amt);
actor->user.z_tgt = actor->user.int_upos().Z * zinttoworld;
actor->user.z_tgt = actor->user.pos.Z;
MoveSpritesWithSector(actor->sector(), amt, true); // ceiling
}
@ -4612,7 +4612,7 @@ int move_actor(DSWActor* actor, int xchange, int ychange, int zchange)
{
// For COOLG & HORNETS
// set to actual z before you move
actor->set_int_z(actor->user.int_upos().Z);
actor->spr.pos.Z = actor->user.pos.Z;
}
// save off x,y values

View file

@ -1689,13 +1689,13 @@ PlayerPart:
}
}
actor->set_int_xy(sop->int_pmid().X - actor->user.int_upos().X, sop->int_pmid().Y - actor->user.int_upos().Y);
actor->spr.pos.XY() = sop->pmid.XY() - actor->user.pos.XY();
// sprites z update
if ((sop->flags & SOBJ_SPRITE_OBJ))
{
// Sprite Objects follow zmid
actor->set_int_z(sop->int_pmid().Z - actor->user.int_upos().Z);
actor->spr.pos.Z = sop->pmid.Z - actor->user.pos.Z;
}
else
{
@ -1703,12 +1703,12 @@ PlayerPart:
if (actor->user.Flags & (SPR_ON_SO_SECTOR))
{
// move with sector its on
actor->set_int_z(actor->sector()->int_floorz() - actor->user.int_upos().Z);
actor->spr.pos.Z = actor->sector()->floorz - actor->user.pos.Z;
}
else
{
// move with the mid sector
actor->set_int_z(sop->mid_sector->int_floorz() - actor->user.int_upos().Z);
actor->spr.pos.Z = sop->mid_sector->floorz - actor->user.pos.Z;
}
}
@ -3496,7 +3496,7 @@ int ActorFollowTrack(DSWActor* actor, short locktics)
if (actor->user.Flags & (SPR_CLIMBING))
{
if (int_ActorZOfTop(actor) + (int_ActorSizeZ(actor) >> 2) < actor->user.int_upos().Z)
if (ActorZOfTop(actor) + (ActorSizeZ(actor) * 0.25) < actor->user.pos.Z)
{
actor->user.Flags &= ~(SPR_CLIMBING);

View file

@ -8633,9 +8633,8 @@ int DoMineStuck(DSWActor* actor)
actor->user.WaitTics = SEC(1)/2;
}
vec3_t pos = { attachActor->int_pos().X, attachActor->int_pos().Y, attachActor->int_pos().Z - actor->user.int_upos().Z };
SetActorZ(actor, &pos);
actor->set_int_z(attachActor->int_pos().Z - (int_ActorSizeZ(attachActor) >> 1));
SetActorZ(actor, attachActor->spr.pos.plusZ(-actor->user.pos.Z));
actor->spr.pos.Z = attachActor->spr.pos.Z - (ActorSizeZ(attachActor) * 0.5);
}
// not activated yet
@ -9046,8 +9045,7 @@ int DoEMPBurst(DSWActor* actor)
DSWActor* attachActor = actor->user.attachActor;
if (attachActor != nullptr)
{
vec3_t pos = { attachActor->int_pos().X, attachActor->int_pos().Y, attachActor->int_pos().Z - actor->user.int_upos().Z };
SetActorZ(actor, &pos);
SetActorZ(actor, attachActor->spr.pos.plusZ(-actor->user.pos.Z));
actor->set_int_ang(NORM_ANGLE(attachActor->int_ang() + 1024));
}
@ -11286,12 +11284,12 @@ int DoSerpRing(DSWActor* actor)
return 0;
}
int z = actor->int_pos().Z + actor->spr.zvel;
if (z > own->int_pos().Z - actor->user.int_upos().Z)
z = own->int_pos().Z - actor->user.int_upos().Z;
double zz = actor->int_pos().Z + actor->spr.zvel * zinttoworld;
if (zz > own->spr.pos.Z - actor->user.pos.Z)
zz = own->spr.pos.Z - actor->user.pos.Z;
// move the center with the player
actor->spr.pos = DVector3(own->spr.pos.XY(), z * zinttoworld);
actor->spr.pos = DVector3(own->spr.pos.XY(), zz);
// go out until its time to come back in