- user.pos wrapping.

This commit is contained in:
Christoph Oelckers 2022-08-21 08:23:20 +02:00
parent bc853d3a00
commit f43a8d4fce
14 changed files with 110 additions and 107 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.pos.Z + MulScale(Z(32), bsin(actor->user.WaitTics), 14));
actor->set_int_z(actor->user.int_upos().Z + MulScale(Z(32), bsin(actor->user.WaitTics), 14));
return 0;
}

View file

@ -615,7 +615,7 @@ int DoCoolgMatchPlayerZ(DSWActor* actor)
// actor does a sine wave about sz - this is the z mid point
zdiff = (int_ActorZOfMiddle(actor->user.targetActor)) - actor->user.pos.Z;
zdiff = (int_ActorZOfMiddle(actor->user.targetActor)) - actor->user.int_upos().Z;
// check z diff of the player and the sprite
zdist = Z(20 + RandomRange(100)); // put a random amount
@ -642,7 +642,7 @@ int DoCoolgMatchPlayerZ(DSWActor* actor)
else
bound = loz - actor->user.int_floor_dist() - COOLG_BOB_AMT;
if (actor->user.pos.Z > bound)
if (actor->user.int_upos().Z > bound)
{
actor->user.pos.Z = bound;
}
@ -653,16 +653,16 @@ int DoCoolgMatchPlayerZ(DSWActor* actor)
else
bound = hiz + actor->user.int_ceiling_dist() + COOLG_BOB_AMT;
if (actor->user.pos.Z < bound)
if (actor->user.int_upos().Z < bound)
{
actor->user.pos.Z = bound;
}
actor->user.pos.Z = min(actor->user.pos.Z, loz - actor->user.int_floor_dist());
actor->user.pos.Z = max(actor->user.pos.Z, hiz + actor->user.int_ceiling_dist());
actor->user.pos.Z = min(actor->user.int_upos().Z, loz - actor->user.int_floor_dist());
actor->user.pos.Z = max(actor->user.int_upos().Z, hiz + actor->user.int_ceiling_dist());
actor->user.Counter = (actor->user.Counter + (ACTORMOVETICS<<3)) & 2047;
actor->set_int_z(actor->user.pos.Z + MulScale(COOLG_BOB_AMT, bsin(actor->user.Counter), 14));
actor->set_int_z(actor->user.int_upos().Z + MulScale(COOLG_BOB_AMT, bsin(actor->user.Counter), 14));
bound = actor->user.int_hiz() + actor->user.int_ceiling_dist() + COOLG_BOB_AMT;
if (actor->int_pos().Z < bound)
@ -693,7 +693,7 @@ int InitCoolgCircle(DSWActor* actor)
// z velocity
actor->user.jump_speed = 400 + RANDOM_P2(256);
if (abs(actor->user.pos.Z - actor->user.int_hiz()) < abs(actor->user.pos.Z - actor->user.int_loz()))
if (abs(actor->user.int_upos().Z - actor->user.int_hiz()) < abs(actor->user.int_upos().Z - actor->user.int_loz()))
actor->user.jump_speed = -actor->user.jump_speed;
actor->user.WaitTics = (RandomRange(3)+1) * 120;
@ -722,7 +722,7 @@ int DoCoolgCircle(DSWActor* actor)
actor->user.pos.Z -= actor->user.jump_speed * ACTORMOVETICS;
bound = actor->user.int_hiz() + actor->user.int_ceiling_dist() + COOLG_BOB_AMT;
if (actor->user.pos.Z < bound)
if (actor->user.int_upos().Z < bound)
{
// bumped something
actor->user.pos.Z = bound;

View file

@ -436,7 +436,7 @@ int DoEelMatchPlayerZ(DSWActor* actor)
// actor does a sine wave about actor->user.sz - this is the z mid point
zdiff = (ActorZOfBottom(actor->user.targetActor) - Z(8)) - actor->user.pos.Z;
zdiff = (ActorZOfBottom(actor->user.targetActor) - Z(8)) - actor->user.int_upos().Z;
// check z diff of the player and the sprite
zdist = Z(20 + RandomRange(64)); // put a random amount
@ -464,14 +464,14 @@ int DoEelMatchPlayerZ(DSWActor* actor)
{
DISTANCE(actor->int_pos().X, actor->int_pos().Y, actor->user.lowActor->int_pos().X, actor->user.lowActor->int_pos().Y, dist, a, b, c);
if (dist <= 300)
bound = actor->user.pos.Z;
bound = actor->user.int_upos().Z;
else
bound = loz - actor->user.int_floor_dist();
}
else
bound = loz - actor->user.int_floor_dist() - EEL_BOB_AMT;
if (actor->user.pos.Z > bound)
if (actor->user.int_upos().Z > bound)
{
actor->user.pos.Z = bound;
}
@ -481,23 +481,23 @@ int DoEelMatchPlayerZ(DSWActor* actor)
{
DISTANCE(actor->int_pos().X, actor->int_pos().Y, actor->user.highActor->int_pos().X, actor->user.highActor->int_pos().Y, dist, a, b, c);
if (dist <= 300)
bound = actor->user.pos.Z;
bound = actor->user.int_upos().Z;
else
bound = hiz + actor->user.int_ceiling_dist();
}
else
bound = hiz + actor->user.int_ceiling_dist() + EEL_BOB_AMT;
if (actor->user.pos.Z < bound)
if (actor->user.int_upos().Z < bound)
{
actor->user.pos.Z = bound;
}
actor->user.pos.Z = min(actor->user.pos.Z, loz - actor->user.int_floor_dist());
actor->user.pos.Z = max(actor->user.pos.Z, hiz + actor->user.int_ceiling_dist());
actor->user.pos.Z = min(actor->user.int_upos().Z, loz - actor->user.int_floor_dist());
actor->user.pos.Z = max(actor->user.int_upos().Z, hiz + actor->user.int_ceiling_dist());
actor->user.Counter = (actor->user.Counter + (ACTORMOVETICS << 3) + (ACTORMOVETICS << 1)) & 2047;
actor->set_int_z(actor->user.pos.Z + MulScale(EEL_BOB_AMT, bsin(actor->user.Counter), 14));
actor->set_int_z(actor->user.int_upos().Z + MulScale(EEL_BOB_AMT, bsin(actor->user.Counter), 14));
bound = actor->user.int_hiz() + actor->user.int_ceiling_dist() + EEL_BOB_AMT;
if (actor->int_pos().Z < bound)

View file

@ -937,6 +937,7 @@ struct USER
int int_ceiling_dist() const { return ceiling_dist * zworldtoint; }
int int_floor_dist() const { return floor_dist * zworldtoint; }
int int_zclip() const { return zclip * zworldtoint; }
const vec3_t int_upos() const { return pos; }
//
// Variables that can be used by actors and Player
@ -968,6 +969,13 @@ struct USER
TObjPtr<DSWActor*> flagOwnerActor;
TObjPtr<DSWActor*> WpnGoalActor;
// Some actors hijack this - the second name is supposed to be a marker for these cases
union
{
vec3_t pos;
vec3_t notreallypos;
};
double hiz, loz;
double oz; // serialized copy of sprite.oz
double z_tgt;
@ -1060,7 +1068,6 @@ struct USER
int16_t wait_active_check; // for enemy checking of player
int16_t inactive_time; // length of time actor has been unaware of his tgt
vec3_t pos;
int16_t sang;
uint8_t spal; // save off default palette number
@ -2211,7 +2218,7 @@ struct ANIM
return animactor->spr.int_pos().Z;
case ANIM_Userz:
if (animactor == nullptr) return 0;
return animactor->user.pos.Z;
return animactor->user.int_upos().Z;
case ANIM_SUdepth:
return sector[animindex].depth_fixed;
default:

View file

@ -345,7 +345,7 @@ int DoHornetMatchPlayerZ(DSWActor* actor)
// actor does a sine wave about actor->user.sz - this is the z mid point
zdiff = (int_ActorZOfMiddle(actor->user.targetActor)) - actor->user.pos.Z;
zdiff = (int_ActorZOfMiddle(actor->user.targetActor)) - actor->user.int_upos().Z;
// check z diff of the player and the sprite
zdist = Z(20 + RandomRange(200)); // put a random amount
@ -373,7 +373,7 @@ int DoHornetMatchPlayerZ(DSWActor* actor)
else
bound = loz - actor->user.int_floor_dist() - HORNET_BOB_AMT;
if (actor->user.pos.Z > bound)
if (actor->user.int_upos().Z > bound)
{
actor->user.pos.Z = bound;
}
@ -384,16 +384,16 @@ int DoHornetMatchPlayerZ(DSWActor* actor)
else
bound = hiz + actor->user.int_ceiling_dist() + HORNET_BOB_AMT;
if (actor->user.pos.Z < bound)
if (actor->user.int_upos().Z < bound)
{
actor->user.pos.Z = bound;
}
actor->user.pos.Z = min(actor->user.pos.Z, loz - actor->user.int_floor_dist());
actor->user.pos.Z = max(actor->user.pos.Z, hiz + actor->user.int_ceiling_dist());
actor->user.pos.Z = min(actor->user.int_upos().Z, loz - actor->user.int_floor_dist());
actor->user.pos.Z = max(actor->user.int_upos().Z, hiz + actor->user.int_ceiling_dist());
actor->user.Counter = (actor->user.Counter + (ACTORMOVETICS << 3) + (ACTORMOVETICS << 1)) & 2047;
actor->set_int_z(actor->user.pos.Z + MulScale(HORNET_BOB_AMT, bsin(actor->user.Counter), 14));
actor->set_int_z(actor->user.int_upos().Z + MulScale(HORNET_BOB_AMT, bsin(actor->user.Counter), 14));
bound = actor->user.int_hiz() + actor->user.int_ceiling_dist() + HORNET_BOB_AMT;
if (actor->int_pos().Z < bound)
@ -424,7 +424,7 @@ int InitHornetCircle(DSWActor* actor)
// z velocity
actor->user.jump_speed = 200 + RANDOM_P2(128);
if (labs(actor->user.pos.Z - actor->user.int_hiz()) < abs(actor->user.pos.Z - actor->user.int_loz()))
if (labs(actor->user.int_upos().Z - actor->user.int_hiz()) < abs(actor->user.int_upos().Z - actor->user.int_loz()))
actor->user.jump_speed = -actor->user.jump_speed;
actor->user.WaitTics = (RandomRange(3)+1) * 60;
@ -464,7 +464,7 @@ int DoHornetCircle(DSWActor* actor)
actor->user.pos.Z -= actor->user.jump_speed * ACTORMOVETICS;
bound = actor->user.int_hiz() + actor->user.int_ceiling_dist() + HORNET_BOB_AMT;
if (actor->user.pos.Z < bound)
if (actor->user.int_upos().Z < bound)
{
// bumped something
actor->user.pos.Z = bound;

View file

@ -259,10 +259,10 @@ STATE s_BloodSprayDrip[] =
int DoWallBloodDrip(DSWActor* actor)
{
// sy & sz are the ceiling and floor of the sector you are sliding down
if (actor->user.pos.Z != actor->user.pos.Y)
if (actor->user.notreallypos.Z != actor->user.notreallypos.Y)
{
// if you are between the ceiling and floor fall fast
if (actor->int_pos().Z > actor->user.pos.Y && actor->int_pos().Z < actor->user.pos.Z)
if (actor->int_pos().Z > actor->user.notreallypos.Y && actor->int_pos().Z < actor->user.notreallypos.Z)
{
actor->spr.zvel += 300;
actor->add_int_z(actor->spr.zvel);
@ -453,9 +453,9 @@ int DoBloodSpray(DSWActor* actor)
{
// sy & sz are the ceiling and floor of the sector you are sliding down
if (bldActor->tempwall->twoSided())
getzsofslopeptr(bldActor->tempwall->nextSector(), actor->int_pos().X, actor->int_pos().Y, &actor->user.pos.Y, &actor->user.pos.Z);
getzsofslopeptr(bldActor->tempwall->nextSector(), actor->int_pos().X, actor->int_pos().Y, &actor->user.notreallypos.Y, &actor->user.notreallypos.Z);
else
actor->user.pos.Y = actor->user.pos.Z; // ceiling and floor are equal - white wall
actor->user.notreallypos.Y = actor->user.notreallypos.Z; // ceiling and floor are equal - white wall
}
actor->spr.cstat &= ~(CSTAT_SPRITE_INVISIBLE);

View file

@ -3185,26 +3185,26 @@ void DoPlayerClimb(PLAYER* pp)
// sprite
const int IADJ_AMT = 8;
auto pos = plActor->int_pos();
if (pos.X != plActor->user.pos.X)
if (pos.X != plActor->user.int_upos().X)
{
if (pos.X < plActor->user.pos.X)
if (pos.X < plActor->user.int_upos().X)
pos.X += IADJ_AMT;
else if (pos.X > plActor->user.pos.X)
else if (pos.X > plActor->user.int_upos().X)
pos.X -= IADJ_AMT;
if (labs(pos.X - plActor->user.pos.X) <= IADJ_AMT)
pos.X = plActor->user.pos.X;
if (labs(pos.X - plActor->user.int_upos().X) <= IADJ_AMT)
pos.X = plActor->user.int_upos().X;
}
if (pos.Y != plActor->user.pos.Y)
if (pos.Y != plActor->user.int_upos().Y)
{
if (pos.Y < plActor->user.pos.Y)
if (pos.Y < plActor->user.int_upos().Y)
pos.Y += IADJ_AMT;
else if (pos.Y > plActor->user.pos.Y)
else if (pos.Y > plActor->user.int_upos().Y)
pos.Y -= IADJ_AMT;
if (labs(pos.Y - plActor->user.pos.Y) <= IADJ_AMT)
pos.Y = plActor->user.pos.Y;
if (labs(pos.Y - plActor->user.int_upos().Y) <= IADJ_AMT)
pos.Y = plActor->user.int_upos().Y;
}
plActor->set_int_pos(pos);
}
@ -4024,7 +4024,7 @@ void DoPlayerWarpToUnderwater(PLAYER* pp)
plActor->user.pos.XY() = over_act->int_pos().XY() - pp->int_ppos().XY();
// update to the new x y position
pp->set_int_ppos_XY(under_act->int_pos().XY() - plActor->user.pos.XY());
pp->set_int_ppos_XY(under_act->int_pos().XY() - plActor->user.int_upos().XY());
auto over = over_act->sector();
auto under = under_act->sector();
@ -4090,7 +4090,7 @@ void DoPlayerWarpToSurface(PLAYER* pp)
plActor->user.pos.XY() = under_act->int_pos().XY() - pp->int_ppos().XY();
// update to the new x y position
pp->set_int_ppos_XY(over_act->int_pos().XY() - plActor->user.pos.XY());
pp->set_int_ppos_XY(over_act->int_pos().XY() - plActor->user.int_upos().XY());
auto over = over_act->sector();
auto under = under_act->sector();

View file

@ -407,7 +407,7 @@ int DoSkullBob(DSWActor* actor)
const int SKULL_BOB_AMT = (Z(16));
actor->user.Counter = (actor->user.Counter + (ACTORMOVETICS << 3) + (ACTORMOVETICS << 1)) & 2047;
actor->set_int_z(actor->user.pos.Z + MulScale(SKULL_BOB_AMT, bsin(actor->user.Counter), 14) +
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));
return 0;
@ -784,7 +784,7 @@ int DoBettyBob(DSWActor* actor)
const int BETTY_BOB_AMT = (Z(16));
actor->user.Counter = (actor->user.Counter + (ACTORMOVETICS << 3) + (ACTORMOVETICS << 1)) & 2047;
actor->set_int_z(actor->user.pos.Z + MulScale(BETTY_BOB_AMT, bsin(actor->user.Counter), 14) +
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));
return 0;

View file

@ -52,16 +52,16 @@ void ReverseSpike(DSWActor* actor)
if (actor->user.z_tgt == actor->user.oz)
{
if (actor->spr.pos.Z == actor->user.oz)
actor->user.z_tgt = actor->user.pos.Z * zinttoworld;
else if (actor->user.pos.Z == actor->user.int_oz())
actor->user.z_tgt = actor->user.int_upos().Z * zinttoworld;
else if (actor->user.int_upos().Z == actor->user.int_oz())
actor->user.z_tgt = actor->spr.pos.Z;
}
else if (actor->user.int_z_tgt() == actor->user.pos.Z)
else if (actor->user.int_z_tgt() == actor->user.int_upos().Z)
{
if (actor->spr.pos.Z == actor->user.oz)
actor->user.z_tgt = actor->spr.pos.Z;
else if (actor->user.pos.Z == actor->user.int_oz())
actor->user.z_tgt = actor->user.pos.Z * zinttoworld;
else if (actor->user.int_upos().Z == actor->user.int_oz())
actor->user.z_tgt = actor->user.int_upos().Z * zinttoworld;
}
actor->user.vel_rate = -actor->user.vel_rate;
@ -106,7 +106,7 @@ void SetSpikeActive(DSWActor* actor)
VatorSwitch(SP_TAG2(actor), true);
else
// moving to the OFF position
if (actor->user.int_z_tgt() == actor->user.pos.Z)
if (actor->user.int_z_tgt() == actor->user.int_upos().Z)
VatorSwitch(SP_TAG2(actor), false);
}
@ -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.pos.Z * zinttoworld;
actor->user.z_tgt = actor->user.int_upos().Z * zinttoworld;
actor->user.vel_rate = -actor->user.vel_rate;
SetSpikeInactive(actor);
@ -291,7 +291,7 @@ int DoSpike(DSWActor* actor)
}
else
// in the OFF position
if (actor->user.int_z_tgt() == actor->user.pos.Z)
if (actor->user.int_z_tgt() == actor->user.int_upos().Z)
{
short match = SP_TAG2(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.pos.Z * zinttoworld;
actor->user.z_tgt = actor->user.int_upos().Z * zinttoworld;
actor->user.vel_rate = -actor->user.vel_rate;
actor->user.Tics = actor->user.WaitTics;
@ -391,7 +391,7 @@ int DoSpikeAuto(DSWActor* actor)
}
else
// in the DOWN position
if (actor->user.int_z_tgt() == actor->user.pos.Z)
if (actor->user.int_z_tgt() == actor->user.int_upos().Z)
{
// change target
actor->user.jump_speed = actor->user.vel_tgt;

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.pos.Z * zinttoworld;
actor->user.z_tgt = actor->user.int_upos().Z * zinttoworld;
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.pos.Z * zinttoworld;
actor->user.z_tgt = actor->user.int_upos().Z * zinttoworld;
MoveSpritesWithSector(actor->sector(), amt, true); // ceiling
}
@ -2256,7 +2256,7 @@ void SpriteSetup(void)
{
// start in the on position
actor->user.zclip = actor->spr.pos.Z;
actor->user.z_tgt = actor->user.pos.Z * zinttoworld;
actor->user.z_tgt = actor->user.int_upos().Z * zinttoworld;
SpikeAlign(actor);
}
@ -2275,7 +2275,7 @@ void SpriteSetup(void)
{
// starting in the on position
actor->user.zclip = actor->spr.pos.Z;
actor->user.z_tgt = actor->user.pos.Z * zinttoworld;
actor->user.z_tgt = actor->user.int_upos().Z * zinttoworld;
SpikeAlign(actor);
}
@ -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.pos.Z);
actor->set_int_z(actor->user.int_upos().Z);
}
// save off x,y values

View file

@ -1690,13 +1690,13 @@ PlayerPart:
}
}
actor->set_int_xy(sop->int_pmid().X - actor->user.pos.X, sop->int_pmid().Y - actor->user.pos.Y);
actor->set_int_xy(sop->int_pmid().X - actor->user.int_upos().X, sop->int_pmid().Y - actor->user.int_upos().Y);
// sprites z update
if ((sop->flags & SOBJ_SPRITE_OBJ))
{
// Sprite Objects follow zmid
actor->set_int_z(sop->int_pmid().Z - actor->user.pos.Z);
actor->set_int_z(sop->int_pmid().Z - actor->user.int_upos().Z);
}
else
{
@ -1704,12 +1704,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.pos.Z);
actor->set_int_z(actor->sector()->int_floorz() - actor->user.int_upos().Z);
}
else
{
// move with the mid sector
actor->set_int_z(sop->mid_sector->int_floorz() - actor->user.pos.Z);
actor->set_int_z(sop->mid_sector->int_floorz() - actor->user.int_upos().Z);
}
}
@ -2130,7 +2130,7 @@ void CallbackSOsink(ANIM* ap, void *data)
continue;
// move sprite WAY down in water
ndx = AnimSet(ANIM_Userz, 0, actor, -actor->user.pos.Z - ActorSizeZ(actor) - Z(100), ap->vel>>8);
ndx = AnimSet(ANIM_Userz, 0, actor, -actor->user.int_upos().Z - ActorSizeZ(actor) - Z(100), ap->vel>>8);
AnimSetVelAdj(ndx, ap->vel_adj);
}
@ -3347,8 +3347,8 @@ bool ActorTrackDecide(TRACK_POINT* tpoint, DSWActor* actor)
bos_z = ActorZOfBottom(actor);
if (bos_z > actor->user.int_loz())
{
actor->user.pos.Y = (bos_z - actor->int_pos().Z);
actor->add_int_z(-actor->user.pos.Y);
actor->user.notreallypos.Y = (bos_z - actor->int_pos().Z);
actor->add_int_z(-actor->user.notreallypos.Y);
}
//
@ -3497,7 +3497,7 @@ int ActorFollowTrack(DSWActor* actor, short locktics)
if (actor->user.Flags & (SPR_CLIMBING))
{
if (ActorZOfTop(actor) + (ActorSizeZ(actor) >> 2) < actor->user.pos.Z)
if (ActorZOfTop(actor) + (ActorSizeZ(actor) >> 2) < actor->user.int_upos().Z)
{
actor->user.Flags &= ~(SPR_CLIMBING);
@ -3507,7 +3507,7 @@ int ActorFollowTrack(DSWActor* actor, short locktics)
ActorLeaveTrack(actor);
actor->spr.cstat &= ~(CSTAT_SPRITE_YCENTER);
actor->add_int_z(actor->user.pos.Y);
actor->add_int_z(actor->user.notreallypos.Y);
DoActorSetSpeed(actor, SLOW_SPEED);
actor->user.ActorActionFunc = NinjaJumpActionFunc;

View file

@ -57,16 +57,16 @@ void ReverseVator(DSWActor* actor)
if (actor->user.z_tgt == actor->user.oz)
{
if (actor->spr.pos.Z == actor->user.oz)
actor->user.z_tgt = actor->user.pos.Z * zinttoworld;
else if (actor->user.pos.Z == actor->user.int_oz())
actor->user.z_tgt = actor->user.int_upos().Z * zinttoworld;
else if (actor->user.int_upos().Z == actor->user.int_oz())
actor->user.z_tgt = actor->spr.pos.Z;
}
else if (actor->user.int_z_tgt() == actor->user.pos.Z)
else if (actor->user.int_z_tgt() == actor->user.int_upos().Z)
{
if (actor->spr.pos.Z == actor->user.oz)
actor->user.z_tgt = actor->spr.pos.Z;
else if (actor->user.pos.Z == actor->user.int_oz())
actor->user.z_tgt = actor->user.pos.Z * zinttoworld;
else if (actor->user.int_upos().Z == actor->user.int_oz())
actor->user.z_tgt = actor->user.int_upos().Z * zinttoworld;
}
actor->user.vel_rate = -actor->user.vel_rate;
@ -111,7 +111,7 @@ void SetVatorActive(DSWActor* actor)
VatorSwitch(SP_TAG2(actor), true);
else
// moving to the OFF position
if (actor->user.int_z_tgt() == actor->user.pos.Z)
if (actor->user.int_z_tgt() == actor->user.int_upos().Z)
VatorSwitch(SP_TAG2(actor), false);
}
@ -395,7 +395,7 @@ int DoVator(DSWActor* actor)
if (actor->user.int_z_tgt() == actor->int_pos().Z)
{
// change target
actor->user.z_tgt = actor->user.pos.Z * zinttoworld;
actor->user.z_tgt = actor->user.int_upos().Z * zinttoworld;
actor->user.vel_rate = -actor->user.vel_rate;
SetVatorInactive(actor);
@ -406,7 +406,7 @@ int DoVator(DSWActor* actor)
}
else
// in the OFF position
if (actor->user.int_z_tgt() == actor->user.pos.Z)
if (actor->user.int_z_tgt() == actor->user.int_upos().Z)
{
short match = SP_TAG2(actor);
@ -548,7 +548,7 @@ int DoVatorAuto(DSWActor* actor)
if (actor->user.z_tgt == actor->spr.pos.Z)
{
// change target
actor->user.z_tgt = actor->user.pos.Z * zinttoworld;
actor->user.z_tgt = actor->user.int_upos().Z * zinttoworld;
actor->user.vel_rate = -actor->user.vel_rate;
actor->user.Tics = actor->user.WaitTics;
@ -557,7 +557,7 @@ int DoVatorAuto(DSWActor* actor)
}
else
// in the DOWN position
if (actor->user.int_z_tgt() == actor->user.pos.Z)
if (actor->user.int_z_tgt() == actor->user.int_upos().Z)
{
// change target
actor->user.jump_speed = actor->user.vel_tgt;

View file

@ -3725,8 +3725,8 @@ AutoShrap:
case Vomit1:
shrap_bounce = false;
actor->spr.pos.Z -= 4;
shrap_xsize = actor->user.pos.X = 12 + (RANDOM_P2(32<<8)>>8);
shrap_ysize = actor->user.pos.Y = 12 + (RANDOM_P2(32<<8)>>8);
shrap_xsize = actor->user.notreallypos.X = 12 + (RANDOM_P2(32<<8)>>8);
shrap_ysize = actor->user.notreallypos.Y = 12 + (RANDOM_P2(32<<8)>>8);
actor->user.Counter = (RANDOM_P2(2048<<5)>>5);
nx = bcos(actor->int_ang(), -6);
@ -3740,8 +3740,8 @@ AutoShrap:
case EMP:
shrap_bounce = false;
actor->spr.pos.Z -= 4;
shrap_xsize = actor->user.pos.X = 5 + (RANDOM_P2(4<<8)>>8);
shrap_ysize = actor->user.pos.Y = 5 + (RANDOM_P2(4<<8)>>8);
shrap_xsize = actor->user.notreallypos.X = 5 + (RANDOM_P2(4<<8)>>8);
shrap_ysize = actor->user.notreallypos.Y = 5 + (RANDOM_P2(4<<8)>>8);
break;
}
@ -3794,8 +3794,8 @@ void DoShrapMove(DSWActor* actor)
int DoVomit(DSWActor* actor)
{
actor->user.Counter = NORM_ANGLE(actor->user.Counter + (30*MISSILEMOVETICS));
actor->spr.xrepeat = actor->user.pos.X + MulScale(12, bcos(actor->user.Counter), 14);
actor->spr.yrepeat = actor->user.pos.Y + MulScale(12, bsin(actor->user.Counter), 14);
actor->spr.xrepeat = actor->user.notreallypos.X + MulScale(12, bcos(actor->user.Counter), 14);
actor->spr.yrepeat = actor->user.notreallypos.Y + MulScale(12, bsin(actor->user.Counter), 14);
if (actor->user.Flags & (SPR_JUMPING))
{
DoJump(actor);
@ -3815,8 +3815,8 @@ int DoVomit(DSWActor* actor)
MissileWaterAdjust(actor);
actor->spr.pos.Z = actor->user.loz;
actor->user.WaitTics = 60;
actor->user.pos.X = actor->spr.xrepeat;
actor->user.pos.Y = actor->spr.yrepeat;
actor->user.notreallypos.X = actor->spr.xrepeat;
actor->user.notreallypos.Y = actor->spr.yrepeat;
return 0;
}
@ -8627,7 +8627,7 @@ 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.pos.Z };
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 - (ActorSizeZ(attachActor) >> 1));
}
@ -9040,7 +9040,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.pos.Z };
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_ang(NORM_ANGLE(attachActor->int_ang() + 1024));
}
@ -10262,19 +10262,17 @@ void SpawnBigGunFlames(DSWActor* actor, DSWActor* Operator, SECTOR_OBJECT* sop,
if (actor->user.Flags & (SPR_ON_SO_SECTOR))
{
// move with sector its on
expActor->set_int_z(actor->sector()->int_floorz() - actor->user.pos.Z);
expActor->set_int_z(actor->sector()->int_floorz() - actor->user.int_upos().Z);
expActor->backupz();
}
else
{
// move with the mid sector
expActor->set_int_z(sop->mid_sector->int_floorz() - actor->user.pos.Z);
expActor->set_int_z(sop->mid_sector->int_floorz() - actor->user.int_upos().Z);
expActor->backupz();
}
expActor->user.pos.X = actor->user.pos.X;
expActor->user.pos.Y = actor->user.pos.Y;
expActor->user.pos.Z = actor->user.pos.Z;
expActor->user.pos = actor->user.int_upos();
}
void SpawnGrenadeSecondaryExp(DSWActor* actor, int ang)
@ -11284,8 +11282,8 @@ int DoSerpRing(DSWActor* actor)
}
int z = actor->int_pos().Z + actor->spr.zvel;
if (z > own->int_pos().Z - actor->user.pos.Z)
z = own->int_pos().Z - actor->user.pos.Z;
if (z > own->int_pos().Z - actor->user.int_upos().Z)
z = own->int_pos().Z - actor->user.int_upos().Z;
// move the center with the player
actor->spr.pos = DVector3(own->spr.pos.XY(), z * zinttoworld);
@ -17085,8 +17083,8 @@ DSWActor* SpawnBubble(DSWActor* actor)
actorNew->spr.xrepeat = 8 + (RANDOM_P2(8 << 8) >> 8);
actorNew->spr.yrepeat = actorNew->spr.xrepeat;
actorNew->user.pos.X = actorNew->spr.xrepeat;
actorNew->user.pos.Y = actorNew->spr.yrepeat;
actorNew->user.notreallypos.X = actorNew->spr.xrepeat;
actorNew->user.notreallypos.Y = actorNew->spr.yrepeat;
actorNew->user.ceiling_dist = (1);
actorNew->user.floor_dist = (1);
actorNew->spr.shade = actor->sector()->floorshade - 10;
@ -17177,17 +17175,17 @@ int DoBubble(DSWActor* actor)
if (actor->spr.zvel > 768)
actor->spr.zvel = 768;
actor->user.pos.X += 1;
actor->user.pos.Y += 1;
actor->user.notreallypos.X += 1;
actor->user.notreallypos.Y += 1;
if (actor->user.pos.X > 32)
if (actor->user.notreallypos.X > 32)
{
actor->user.pos.X = 32;
actor->user.pos.Y = 32;
actor->user.notreallypos.X = 32;
actor->user.notreallypos.Y = 32;
}
actor->spr.xrepeat = actor->user.pos.X + (RANDOM_P2(8 << 8) >> 8) - 4;
actor->spr.yrepeat = actor->user.pos.Y + (RANDOM_P2(8 << 8) >> 8) - 4;
actor->spr.xrepeat = actor->user.notreallypos.X + (RANDOM_P2(8 << 8) >> 8) - 4;
actor->spr.yrepeat = actor->user.notreallypos.Y + (RANDOM_P2(8 << 8) >> 8) - 4;
if (actor->spr.pos.Z < actor->sector()->ceilingz)
{

View file

@ -168,8 +168,6 @@ inline int CloseRangeDist(DSWActor* a1, DSWActor* a2, int fudge)
extern short target_ang;
bool SpriteOverlap(short, short);
DSWActor* SpawnShotgunSparks(PLAYER* pp, sectortype* hit_sect, walltype* hit_wall, int hit_x, int hit_y, int hit_z, short hit_ang);
int DoActorBeginSlide(DSWActor* actor, int ang, int vel, int dec);
int GetOverlapSector(int x, int y, sectortype** over, sectortype** under);