- floatified user.pos.

Special care needed to be taken for two cases where it did not store a coordinate.
This commit is contained in:
Christoph Oelckers 2022-08-21 09:25:15 +02:00
parent f43a8d4fce
commit f53a61693b
11 changed files with 103 additions and 100 deletions

View file

@ -505,7 +505,7 @@ void CoolgCommon(DSWActor* actor)
actor->user.floor_dist = (16); actor->user.floor_dist = (16);
actor->user.ceiling_dist = (20); actor->user.ceiling_dist = (20);
actor->user.pos.Z = actor->int_pos().Z; actor->user.pos.Z = actor->spr.pos.Z;
actor->spr.xrepeat = 42; actor->spr.xrepeat = 42;
actor->spr.yrepeat = 42; actor->spr.yrepeat = 42;
@ -623,9 +623,9 @@ int DoCoolgMatchPlayerZ(DSWActor* actor)
if (labs(zdiff) > zdist) if (labs(zdiff) > zdist)
{ {
if (zdiff > 0) if (zdiff > 0)
actor->user.pos.Z += 170 * ACTORMOVETICS; actor->user.pos.Z += 170 * ACTORMOVETICS * zmaptoworld;
else else
actor->user.pos.Z -= 170 * ACTORMOVETICS; actor->user.pos.Z -= 170 * ACTORMOVETICS * zmaptoworld;
} }
// save off lo and hi z // save off lo and hi z
@ -644,7 +644,7 @@ int DoCoolgMatchPlayerZ(DSWActor* actor)
if (actor->user.int_upos().Z > bound) if (actor->user.int_upos().Z > bound)
{ {
actor->user.pos.Z = bound; actor->user.pos.Z = bound * zinttoworld;
} }
// upper bound // upper bound
@ -655,11 +655,11 @@ int DoCoolgMatchPlayerZ(DSWActor* actor)
if (actor->user.int_upos().Z < bound) if (actor->user.int_upos().Z < bound)
{ {
actor->user.pos.Z = bound; actor->user.pos.Z = bound * zinttoworld;
} }
actor->user.pos.Z = min(actor->user.int_upos().Z, loz - actor->user.int_floor_dist()); actor->user.pos.Z = min(actor->user.int_upos().Z, loz - actor->user.int_floor_dist()) * zinttoworld;
actor->user.pos.Z = max(actor->user.int_upos().Z, hiz + actor->user.int_ceiling_dist()); actor->user.pos.Z = max(actor->user.int_upos().Z, hiz + actor->user.int_ceiling_dist()) * zinttoworld;
actor->user.Counter = (actor->user.Counter + (ACTORMOVETICS<<3)) & 2047; actor->user.Counter = (actor->user.Counter + (ACTORMOVETICS<<3)) & 2047;
actor->set_int_z(actor->user.int_upos().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));
@ -668,7 +668,8 @@ int DoCoolgMatchPlayerZ(DSWActor* actor)
if (actor->int_pos().Z < bound) if (actor->int_pos().Z < bound)
{ {
// bumped something // bumped something
actor->set_int_z(actor->user.pos.Z = bound + COOLG_BOB_AMT); actor->set_int_z(bound + COOLG_BOB_AMT);
actor->user.pos.Z = actor->spr.pos.Z;
} }
return 0; return 0;
@ -719,13 +720,13 @@ int DoCoolgCircle(DSWActor* actor)
} }
// move in the z direction // move in the z direction
actor->user.pos.Z -= actor->user.jump_speed * ACTORMOVETICS; actor->user.pos.Z -= actor->user.jump_speed * ACTORMOVETICS * zinttoworld;
bound = actor->user.int_hiz() + actor->user.int_ceiling_dist() + COOLG_BOB_AMT; bound = actor->user.int_hiz() + actor->user.int_ceiling_dist() + COOLG_BOB_AMT;
if (actor->user.int_upos().Z < bound) if (actor->user.int_upos().Z < bound)
{ {
// bumped something // bumped something
actor->user.pos.Z = bound; actor->user.pos.Z = bound * zinttoworld;
InitActorReposition(actor); InitActorReposition(actor);
return 0; return 0;
} }

View file

@ -444,9 +444,9 @@ int DoEelMatchPlayerZ(DSWActor* actor)
{ {
if (zdiff > 0) if (zdiff > 0)
// manipulate the z midpoint // manipulate the z midpoint
actor->user.pos.Z += 160 * ACTORMOVETICS; actor->user.pos.Z += 160 * ACTORMOVETICS * zmaptoworld;
else else
actor->user.pos.Z -= 160 * ACTORMOVETICS; actor->user.pos.Z -= 160 * ACTORMOVETICS * zmaptoworld;
} }
const int EEL_BOB_AMT = (Z(4)); const int EEL_BOB_AMT = (Z(4));
@ -473,7 +473,7 @@ int DoEelMatchPlayerZ(DSWActor* actor)
if (actor->user.int_upos().Z > bound) if (actor->user.int_upos().Z > bound)
{ {
actor->user.pos.Z = bound; actor->user.pos.Z = bound * zinttoworld;
} }
// upper bound // upper bound
@ -490,11 +490,11 @@ int DoEelMatchPlayerZ(DSWActor* actor)
if (actor->user.int_upos().Z < bound) if (actor->user.int_upos().Z < bound)
{ {
actor->user.pos.Z = bound; actor->user.pos.Z = bound * zinttoworld;
} }
actor->user.pos.Z = min(actor->user.int_upos().Z, loz - actor->user.int_floor_dist()); actor->user.pos.Z = min(actor->user.int_upos().Z, loz - actor->user.int_floor_dist()) * zinttoworld;
actor->user.pos.Z = max(actor->user.int_upos().Z, hiz + actor->user.int_ceiling_dist()); actor->user.pos.Z = max(actor->user.int_upos().Z, hiz + actor->user.int_ceiling_dist()) * zinttoworld;
actor->user.Counter = (actor->user.Counter + (ACTORMOVETICS << 3) + (ACTORMOVETICS << 1)) & 2047; actor->user.Counter = (actor->user.Counter + (ACTORMOVETICS << 3) + (ACTORMOVETICS << 1)) & 2047;
actor->set_int_z(actor->user.int_upos().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));
@ -503,7 +503,8 @@ int DoEelMatchPlayerZ(DSWActor* actor)
if (actor->int_pos().Z < bound) if (actor->int_pos().Z < bound)
{ {
// bumped something // bumped something
actor->set_int_z(actor->user.pos.Z = bound + EEL_BOB_AMT); actor->set_int_z(bound + EEL_BOB_AMT);
actor->user.pos.Z = actor->spr.pos.Z;
} }
return 0; return 0;

View file

@ -937,7 +937,7 @@ struct USER
int int_ceiling_dist() const { return ceiling_dist * zworldtoint; } int int_ceiling_dist() const { return ceiling_dist * zworldtoint; }
int int_floor_dist() const { return floor_dist * zworldtoint; } int int_floor_dist() const { return floor_dist * zworldtoint; }
int int_zclip() const { return zclip * zworldtoint; } int int_zclip() const { return zclip * zworldtoint; }
const vec3_t int_upos() const { return pos; } const vec3_t int_upos() const { return { int(pos.X * worldtoint), int(pos.Y * worldtoint),int(pos.Z * zworldtoint) }; }
// //
// Variables that can be used by actors and Player // Variables that can be used by actors and Player
@ -969,13 +969,7 @@ struct USER
TObjPtr<DSWActor*> flagOwnerActor; TObjPtr<DSWActor*> flagOwnerActor;
TObjPtr<DSWActor*> WpnGoalActor; TObjPtr<DSWActor*> WpnGoalActor;
// Some actors hijack this - the second name is supposed to be a marker for these cases DVector3 pos;
union
{
vec3_t pos;
vec3_t notreallypos;
};
double hiz, loz; double hiz, loz;
double oz; // serialized copy of sprite.oz double oz; // serialized copy of sprite.oz
double z_tgt; double z_tgt;
@ -2242,7 +2236,7 @@ struct ANIM
break; break;
case ANIM_Userz: case ANIM_Userz:
if (animactor == nullptr) return; if (animactor == nullptr) return;
animactor->user.pos.Z = value; animactor->user.pos.Z = value * inttoworld;
break; break;
case ANIM_SUdepth: case ANIM_SUdepth:
sector[animindex].depth_fixed = value; sector[animindex].depth_fixed = value;

View file

@ -312,7 +312,7 @@ int SetupHornet(DSWActor* actor)
actor->user.floor_dist = (16); actor->user.floor_dist = (16);
actor->user.ceiling_dist = (16); actor->user.ceiling_dist = (16);
actor->user.pos.Z = actor->int_pos().Z; actor->user.pos.Z = actor->spr.pos.Z;
actor->spr.xrepeat = 37; actor->spr.xrepeat = 37;
actor->spr.yrepeat = 32; actor->spr.yrepeat = 32;
@ -354,9 +354,9 @@ int DoHornetMatchPlayerZ(DSWActor* actor)
if (zdiff > 0) if (zdiff > 0)
// manipulate the z midpoint // manipulate the z midpoint
//actor->user.sz += 256 * ACTORMOVETICS; //actor->user.sz += 256 * ACTORMOVETICS;
actor->user.pos.Z += 1024 * ACTORMOVETICS; actor->user.pos.Z += 1024 * ACTORMOVETICS * zmaptoworld;
else else
actor->user.pos.Z -= 256 * ACTORMOVETICS; actor->user.pos.Z -= 256 * ACTORMOVETICS * zmaptoworld;
} }
// save off lo and hi z // save off lo and hi z
@ -375,7 +375,7 @@ int DoHornetMatchPlayerZ(DSWActor* actor)
if (actor->user.int_upos().Z > bound) if (actor->user.int_upos().Z > bound)
{ {
actor->user.pos.Z = bound; actor->user.pos.Z = bound * zinttoworld;
} }
// upper bound // upper bound
@ -386,11 +386,11 @@ int DoHornetMatchPlayerZ(DSWActor* actor)
if (actor->user.int_upos().Z < bound) if (actor->user.int_upos().Z < bound)
{ {
actor->user.pos.Z = bound; actor->user.pos.Z = bound * zinttoworld;
} }
actor->user.pos.Z = min(actor->user.int_upos().Z, loz - actor->user.int_floor_dist()); actor->user.pos.Z = min(actor->user.int_upos().Z, loz - actor->user.int_floor_dist()) * zinttoworld;
actor->user.pos.Z = max(actor->user.int_upos().Z, hiz + actor->user.int_ceiling_dist()); actor->user.pos.Z = max(actor->user.int_upos().Z, hiz + actor->user.int_ceiling_dist()) * zinttoworld;
actor->user.Counter = (actor->user.Counter + (ACTORMOVETICS << 3) + (ACTORMOVETICS << 1)) & 2047; actor->user.Counter = (actor->user.Counter + (ACTORMOVETICS << 3) + (ACTORMOVETICS << 1)) & 2047;
actor->set_int_z(actor->user.int_upos().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));
@ -399,7 +399,8 @@ int DoHornetMatchPlayerZ(DSWActor* actor)
if (actor->int_pos().Z < bound) if (actor->int_pos().Z < bound)
{ {
// bumped something // bumped something
actor->set_int_z(actor->user.pos.Z = bound + HORNET_BOB_AMT); actor->set_int_z(bound + HORNET_BOB_AMT);
actor->user.pos.Z = actor->spr.pos.Z;
} }
return 0; return 0;
@ -461,13 +462,13 @@ int DoHornetCircle(DSWActor* actor)
} }
// move in the z direction // move in the z direction
actor->user.pos.Z -= actor->user.jump_speed * ACTORMOVETICS; actor->user.pos.Z -= actor->user.jump_speed * ACTORMOVETICS * zinttoworld;
bound = actor->user.int_hiz() + actor->user.int_ceiling_dist() + HORNET_BOB_AMT; bound = actor->user.int_hiz() + actor->user.int_ceiling_dist() + HORNET_BOB_AMT;
if (actor->user.int_upos().Z < bound) if (actor->user.int_upos().Z < bound)
{ {
// bumped something // bumped something
actor->user.pos.Z = bound; actor->user.pos.Z = bound * zinttoworld;
InitActorReposition(actor); InitActorReposition(actor);
return 0; return 0;
} }

View file

@ -259,10 +259,10 @@ STATE s_BloodSprayDrip[] =
int DoWallBloodDrip(DSWActor* actor) int DoWallBloodDrip(DSWActor* actor)
{ {
// sy & sz are the ceiling and floor of the sector you are sliding down // sy & sz are the ceiling and floor of the sector you are sliding down
if (actor->user.notreallypos.Z != actor->user.notreallypos.Y) if (actor->user.pos.Z != actor->user.pos.Y)
{ {
// if you are between the ceiling and floor fall fast // if you are between the ceiling and floor fall fast
if (actor->int_pos().Z > actor->user.notreallypos.Y && actor->int_pos().Z < actor->user.notreallypos.Z) if (actor->spr.pos.Z > actor->user.pos.Y && actor->spr.pos.Z < actor->user.pos.Z)
{ {
actor->spr.zvel += 300; actor->spr.zvel += 300;
actor->add_int_z(actor->spr.zvel); 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 // sy & sz are the ceiling and floor of the sector you are sliding down
if (bldActor->tempwall->twoSided()) if (bldActor->tempwall->twoSided())
getzsofslopeptr(bldActor->tempwall->nextSector(), actor->int_pos().X, actor->int_pos().Y, &actor->user.notreallypos.Y, &actor->user.notreallypos.Z); getzsofslopeptr(bldActor->tempwall->nextSector(), actor->spr.pos.X, actor->spr.pos.Y, &actor->user.pos.Y, &actor->user.pos.Z);
else else
actor->user.notreallypos.Y = actor->user.notreallypos.Z; // ceiling and floor are equal - white wall actor->user.pos.Y = actor->user.pos.Z; // ceiling and floor are equal - white wall
} }
actor->spr.cstat &= ~(CSTAT_SPRITE_INVISIBLE); actor->spr.cstat &= ~(CSTAT_SPRITE_INVISIBLE);
@ -2143,7 +2143,7 @@ int DoFlag(DSWActor* actor)
// attach weapon to sprite // attach weapon to sprite
actor->spr.cstat &= ~(CSTAT_SPRITE_BLOCK | CSTAT_SPRITE_BLOCK_HITSCAN); actor->spr.cstat &= ~(CSTAT_SPRITE_BLOCK | CSTAT_SPRITE_BLOCK_HITSCAN);
SetAttach(hitActor, actor); SetAttach(hitActor, actor);
actor->user.pos.Z = hitActor->int_pos().Z - (ActorSizeZ(hitActor) >> 1); actor->user.pos.Z = hitActor->spr.pos.Z - (ActorSizeZ(hitActor) >> 1) * zinttoworld;
} }
} }

View file

@ -4021,10 +4021,10 @@ void DoPlayerWarpToUnderwater(PLAYER* pp)
PRODUCTION_ASSERT(Found == true); PRODUCTION_ASSERT(Found == true);
// get the offset from the sprite // get the offset from the sprite
plActor->user.pos.XY() = over_act->int_pos().XY() - pp->int_ppos().XY(); plActor->user.pos.XY() = over_act->spr.pos.XY() - pp->pos.XY();
// update to the new x y position // update to the new x y position
pp->set_int_ppos_XY(under_act->int_pos().XY() - plActor->user.int_upos().XY()); pp->pos.XY() = under_act->spr.pos.XY() - plActor->user.pos.XY();
auto over = over_act->sector(); auto over = over_act->sector();
auto under = under_act->sector(); auto under = under_act->sector();
@ -4087,10 +4087,10 @@ void DoPlayerWarpToSurface(PLAYER* pp)
PRODUCTION_ASSERT(Found == true); PRODUCTION_ASSERT(Found == true);
// get the offset from the under sprite // get the offset from the under sprite
plActor->user.pos.XY() = under_act->int_pos().XY() - pp->int_ppos().XY(); plActor->user.pos.XY() = under_act->spr.pos.XY() - pp->pos.XY();
// update to the new x y position // update to the new x y position
pp->set_int_ppos_XY(over_act->int_pos().XY() - plActor->user.int_upos().XY()); pp->pos.XY() = over_act->spr.pos.XY() - plActor->user.pos.XY();
auto over = over_act->sector(); auto over = over_act->sector();
auto under = under_act->sector(); auto under = under_act->sector();

View file

@ -243,7 +243,7 @@ int SetupSkull(DSWActor* actor)
else else
{ {
actor->user.Counter = RANDOM_P2(2048); actor->user.Counter = RANDOM_P2(2048);
actor->user.pos.Z = actor->int_pos().Z; actor->user.pos.Z = actor->spr.pos.Z;
} }
@ -628,7 +628,7 @@ int SetupBetty(DSWActor* actor)
else else
{ {
actor->user.Counter = RANDOM_P2(2048); actor->user.Counter = RANDOM_P2(2048);
actor->user.pos.Z = actor->int_pos().Z; actor->user.pos.Z = actor->spr.pos.Z;
} }

View file

@ -2042,7 +2042,7 @@ void SpriteSetup(void)
if (floor_vator) if (floor_vator)
{ {
// start off // start off
actor->user.pos.Z = sectp->int_floorz(); actor->user.pos.Z = sectp->floorz;
actor->user.z_tgt = actor->spr.pos.Z; actor->user.z_tgt = actor->spr.pos.Z;
if (start_on) if (start_on)
{ {
@ -2063,7 +2063,7 @@ void SpriteSetup(void)
else else
{ {
// start off // start off
actor->user.pos.Z = sectp->int_ceilingz(); actor->user.pos.Z = sectp->ceilingz;
actor->user.z_tgt = actor->spr.pos.Z; actor->user.z_tgt = actor->spr.pos.Z;
if (start_on) if (start_on)
{ {
@ -2250,13 +2250,13 @@ void SpriteSetup(void)
actor->user.zclip = florz * zinttoworld; actor->user.zclip = florz * zinttoworld;
// start off // start off
actor->user.pos.Z = actor->user.int_zclip(); actor->user.pos.Z = actor->user.zclip;
actor->user.z_tgt = actor->spr.pos.Z; actor->user.z_tgt = actor->spr.pos.Z;
if (start_on) if (start_on)
{ {
// start in the on position // start in the on position
actor->user.zclip = actor->spr.pos.Z; actor->user.zclip = actor->spr.pos.Z;
actor->user.z_tgt = actor->user.int_upos().Z * zinttoworld; actor->user.z_tgt = actor->user.pos.Z;
SpikeAlign(actor); SpikeAlign(actor);
} }
@ -2269,13 +2269,13 @@ void SpriteSetup(void)
actor->user.zclip = ceilz * zinttoworld; actor->user.zclip = ceilz * zinttoworld;
// start off // start off
actor->user.pos.Z = actor->user.int_zclip(); actor->user.pos.Z = actor->user.zclip;
actor->user.z_tgt = actor->spr.pos.Z; actor->user.z_tgt = actor->spr.pos.Z;
if (start_on) if (start_on)
{ {
// starting in the on position // starting in the on position
actor->user.zclip = actor->spr.pos.Z; actor->user.zclip = actor->spr.pos.Z;
actor->user.z_tgt = actor->user.int_upos().Z * zinttoworld; actor->user.z_tgt = actor->user.pos.Z;
SpikeAlign(actor); SpikeAlign(actor);
} }
@ -5836,7 +5836,7 @@ KeyMain:
actorNew->spr.cstat &= ~(CSTAT_SPRITE_BLOCK|CSTAT_SPRITE_BLOCK_HITSCAN); actorNew->spr.cstat &= ~(CSTAT_SPRITE_BLOCK|CSTAT_SPRITE_BLOCK_HITSCAN);
actorNew->spr.cstat |= (CSTAT_SPRITE_ALIGNMENT_WALL); actorNew->spr.cstat |= (CSTAT_SPRITE_ALIGNMENT_WALL);
SetAttach(pp->actor, actorNew); SetAttach(pp->actor, actorNew);
actorNew->user.pos.Z = int_ActorZOfMiddle(pp->actor); // Set mid way up who it hit actorNew->user.pos.Z = ActorZOfMiddle(pp->actor); // Set mid way up who it hit
actorNew->user.spal = actorNew->spr.pal = actor->spr.pal; // Set the palette of the flag actorNew->user.spal = actorNew->spr.pal = actor->spr.pal; // Set the palette of the flag
SetOwner(pp->actor, actorNew); // Player now owns the flag SetOwner(pp->actor, actorNew); // Player now owns the flag

View file

@ -870,9 +870,8 @@ void SectorObjectSetupBounds(SECTOR_OBJECT* sop)
} }
itActor->user.pos.X = sop->int_pmid().X - itActor->int_pos().X; itActor->user.pos.XY() = sop->pmid.XY() - itActor->spr.pos.XY();
itActor->user.pos.Y = sop->int_pmid().Y - itActor->int_pos().Y; itActor->user.pos.Z = sop->mid_sector->floorz - itActor->spr.pos.Z;
itActor->user.pos.Z = sop->mid_sector->int_floorz() - itActor->int_pos().Z;
itActor->user.Flags |= (SPR_SO_ATTACHED); itActor->user.Flags |= (SPR_SO_ATTACHED);
@ -903,7 +902,7 @@ void SectorObjectSetupBounds(SECTOR_OBJECT* sop)
if (sop->sectp[j] == itActor->sector()) if (sop->sectp[j] == itActor->sector())
{ {
itActor->user.Flags |= (SPR_ON_SO_SECTOR); itActor->user.Flags |= (SPR_ON_SO_SECTOR);
itActor->user.pos.Z = itActor->sector()->int_floorz() - itActor->int_pos().Z; itActor->user.pos.Z = itActor->sector()->floorz - itActor->spr.pos.Z;
break; break;
} }
} }
@ -937,7 +936,7 @@ cont:
for (i = 0; sop->so_actors[i] != nullptr; i++) for (i = 0; sop->so_actors[i] != nullptr; i++)
{ {
auto actor = sop->so_actors[i]; auto actor = sop->so_actors[i];
actor->user.pos.Z = sop->int_pmid().Z - actor->int_pos().Z; actor->user.pos.Z = sop->pmid.Z - actor->spr.pos.Z;
} }
} }
} }
@ -3288,7 +3287,7 @@ bool ActorTrackDecide(TRACK_POINT* tpoint, DSWActor* actor)
if (actor->user.ActorActionSet->Jump) if (actor->user.ActorActionSet->Jump)
{ {
int bos_z,nx,ny; int nx,ny;
HitInfo near; HitInfo near;
// //
@ -3333,9 +3332,9 @@ bool ActorTrackDecide(TRACK_POINT* tpoint, DSWActor* actor)
// destination z for climbing // destination z for climbing
if (wal->twoSided()) if (wal->twoSided())
actor->user.pos.Z = wal->nextSector()->int_floorz(); actor->user.pos.Z = wal->nextSector()->floorz;
else else
actor->user.pos.Z = wal->sectorp()->int_ceilingz(); // don't crash on bad setups. actor->user.pos.Z = wal->sectorp()->ceilingz; // don't crash on bad setups.
DoActorZrange(actor); DoActorZrange(actor);
@ -3344,11 +3343,11 @@ bool ActorTrackDecide(TRACK_POINT* tpoint, DSWActor* actor)
// //
actor->spr.cstat |= (CSTAT_SPRITE_YCENTER); actor->spr.cstat |= (CSTAT_SPRITE_YCENTER);
bos_z = ActorZOfBottom(actor); double bos_z = ActorZOfBottom(actor) * zinttoworld;
if (bos_z > actor->user.int_loz()) if (bos_z > actor->user.loz)
{ {
actor->user.notreallypos.Y = (bos_z - actor->int_pos().Z); actor->user.pos.Y = (bos_z - actor->spr.pos.Z);
actor->add_int_z(-actor->user.notreallypos.Y); actor->spr.pos.Z -= actor->user.pos.Y;
} }
// //
@ -3507,7 +3506,7 @@ int ActorFollowTrack(DSWActor* actor, short locktics)
ActorLeaveTrack(actor); ActorLeaveTrack(actor);
actor->spr.cstat &= ~(CSTAT_SPRITE_YCENTER); actor->spr.cstat &= ~(CSTAT_SPRITE_YCENTER);
actor->add_int_z(actor->user.notreallypos.Y); actor->spr.pos.Z += actor->user.pos.Y;
DoActorSetSpeed(actor, SLOW_SPEED); DoActorSetSpeed(actor, SLOW_SPEED);
actor->user.ActorActionFunc = NinjaJumpActionFunc; actor->user.ActorActionFunc = NinjaJumpActionFunc;

View file

@ -142,8 +142,8 @@ int DoWallMove(DSWActor* actor)
if (SOsprite) if (SOsprite)
{ {
// move the sprite offset from center // move the sprite offset from center
actor->user.pos.X -= nx; actor->user.pos.X -= nx * inttoworld;
actor->user.pos.Y -= ny; actor->user.pos.Y -= ny * inttoworld;
} }
else else
{ {

View file

@ -3725,8 +3725,10 @@ AutoShrap:
case Vomit1: case Vomit1:
shrap_bounce = false; shrap_bounce = false;
actor->spr.pos.Z -= 4; actor->spr.pos.Z -= 4;
shrap_xsize = actor->user.notreallypos.X = 12 + (RANDOM_P2(32<<8)>>8); shrap_xsize = 12 + (RANDOM_P2(32<<8)>>8);
shrap_ysize = actor->user.notreallypos.Y = 12 + (RANDOM_P2(32<<8)>>8); shrap_ysize = 12 + (RANDOM_P2(32<<8)>>8);
actor->user.pos.X = shrap_xsize; // notreallypos
actor->user.pos.Y = shrap_ysize;
actor->user.Counter = (RANDOM_P2(2048<<5)>>5); actor->user.Counter = (RANDOM_P2(2048<<5)>>5);
nx = bcos(actor->int_ang(), -6); nx = bcos(actor->int_ang(), -6);
@ -3740,8 +3742,10 @@ AutoShrap:
case EMP: case EMP:
shrap_bounce = false; shrap_bounce = false;
actor->spr.pos.Z -= 4; actor->spr.pos.Z -= 4;
shrap_xsize = actor->user.notreallypos.X = 5 + (RANDOM_P2(4<<8)>>8); shrap_xsize = 5 + (RANDOM_P2(4<<8)>>8);
shrap_ysize = actor->user.notreallypos.Y = 5 + (RANDOM_P2(4<<8)>>8); shrap_ysize = 5 + (RANDOM_P2(4<<8)>>8);
actor->user.pos.X = shrap_xsize; // notreallypos
actor->user.pos.Y = shrap_ysize;
break; break;
} }
@ -3794,8 +3798,9 @@ void DoShrapMove(DSWActor* actor)
int DoVomit(DSWActor* actor) int DoVomit(DSWActor* actor)
{ {
actor->user.Counter = NORM_ANGLE(actor->user.Counter + (30*MISSILEMOVETICS)); actor->user.Counter = NORM_ANGLE(actor->user.Counter + (30*MISSILEMOVETICS));
actor->spr.xrepeat = actor->user.notreallypos.X + MulScale(12, bcos(actor->user.Counter), 14); // notreallypos
actor->spr.yrepeat = actor->user.notreallypos.Y + MulScale(12, bsin(actor->user.Counter), 14); actor->spr.xrepeat = int(actor->user.pos.X) + MulScale(12, bcos(actor->user.Counter), 14);
actor->spr.yrepeat = int(actor->user.pos.Y) + MulScale(12, bsin(actor->user.Counter), 14);
if (actor->user.Flags & (SPR_JUMPING)) if (actor->user.Flags & (SPR_JUMPING))
{ {
DoJump(actor); DoJump(actor);
@ -3815,8 +3820,9 @@ int DoVomit(DSWActor* actor)
MissileWaterAdjust(actor); MissileWaterAdjust(actor);
actor->spr.pos.Z = actor->user.loz; actor->spr.pos.Z = actor->user.loz;
actor->user.WaitTics = 60; actor->user.WaitTics = 60;
actor->user.notreallypos.X = actor->spr.xrepeat; // notreallypos
actor->user.notreallypos.Y = actor->spr.yrepeat; actor->user.pos.X = actor->spr.xrepeat;
actor->user.pos.Y = actor->spr.yrepeat;
return 0; return 0;
} }
@ -8826,7 +8832,7 @@ int DoMine(DSWActor* actor)
// attach weapon to sprite // attach weapon to sprite
SetAttach(hitActor, actor); SetAttach(hitActor, actor);
actor->user.pos.Z = hitActor->int_pos().Z - actor->int_pos().Z; actor->user.pos.Z = hitActor->spr.pos.Z - actor->spr.pos.Z;
auto own = GetOwner(actor); auto own = GetOwner(actor);
if (own && own->hasU()) if (own && own->hasU())
@ -10210,9 +10216,8 @@ void AddSpriteToSectorObject(DSWActor* actor, SECTOR_OBJECT* sop)
actor->user.Flags |= (SPR_ON_SO_SECTOR|SPR_SO_ATTACHED); actor->user.Flags |= (SPR_ON_SO_SECTOR|SPR_SO_ATTACHED);
actor->user.pos.X = sop->int_pmid().X - actor->int_pos().X; actor->user.pos.XY() = sop->pmid.XY() - actor->spr.pos.XY();
actor->user.pos.Y = sop->int_pmid().Y - actor->int_pos().Y; actor->user.pos.Z = sop->mid_sector->floorz - actor->spr.pos.Z;
actor->user.pos.Z = sop->mid_sector->int_floorz() - actor->int_pos().Z;
actor->user.sang = actor->int_ang(); actor->user.sang = actor->int_ang();
} }
@ -10262,17 +10267,17 @@ void SpawnBigGunFlames(DSWActor* actor, DSWActor* Operator, SECTOR_OBJECT* sop,
if (actor->user.Flags & (SPR_ON_SO_SECTOR)) if (actor->user.Flags & (SPR_ON_SO_SECTOR))
{ {
// move with sector its on // move with sector its on
expActor->set_int_z(actor->sector()->int_floorz() - actor->user.int_upos().Z); expActor->spr.pos.Z = actor->sector()->floorz - actor->user.pos.Z;
expActor->backupz(); expActor->backupz();
} }
else else
{ {
// move with the mid sector // move with the mid sector
expActor->set_int_z(sop->mid_sector->int_floorz() - actor->user.int_upos().Z); expActor->spr.pos.Z = sop->mid_sector->floorz - actor->user.pos.Z;
expActor->backupz(); expActor->backupz();
} }
expActor->user.pos = actor->user.int_upos(); expActor->user.pos = actor->user.pos;
} }
void SpawnGrenadeSecondaryExp(DSWActor* actor, int ang) void SpawnGrenadeSecondaryExp(DSWActor* actor, int ang)
@ -11244,12 +11249,12 @@ void InitSpellRing(PLAYER* pp)
actorNew->spr.yrepeat = 32; actorNew->spr.yrepeat = 32;
actorNew->spr.zvel = 0; actorNew->spr.zvel = 0;
actorNew->user.pos.Z = Z(20); actorNew->user.pos.Z = 20;
actorNew->user.Dist = RING_INNER_DIST; actorNew->user.Dist = RING_INNER_DIST;
actorNew->user.Counter = max_missiles; actorNew->user.Counter = max_missiles;
actorNew->user.Counter2 = 0; actorNew->user.Counter2 = 0;
actorNew->user.ceiling_dist = (10); actorNew->user.ceiling_dist = 10;
actorNew->user.floor_dist = (10); actorNew->user.floor_dist = 10;
// put it out there // put it out there
actorNew->add_int_pos({ MulScale(actorNew->user.Dist, bcos(actorNew->int_ang()), 14), MulScale(actorNew->user.Dist, bsin(actorNew->int_ang()), 14), actorNew->add_int_pos({ MulScale(actorNew->user.Dist, bcos(actorNew->int_ang()), 14), MulScale(actorNew->user.Dist, bsin(actorNew->int_ang()), 14),
@ -11521,7 +11526,7 @@ int InitSerpRing(DSWActor* actor)
actorNew->spr.pal = 0; actorNew->spr.pal = 0;
actorNew->set_int_z(ActorZOfTop(actor) - Z(20)); actorNew->set_int_z(ActorZOfTop(actor) - Z(20));
actorNew->user.pos.Z = Z(50); actorNew->user.pos.Z = 50;
// ang around the serp is now slide_ang // ang around the serp is now slide_ang
actorNew->user.slide_ang = actorNew->int_ang(); actorNew->user.slide_ang = actorNew->int_ang();
@ -12261,7 +12266,7 @@ int InitSumoSkull(DSWActor* actor)
actorNew->user.Attrib = &SkullAttrib; actorNew->user.Attrib = &SkullAttrib;
DoActorSetSpeed(actor, NORM_SPEED); DoActorSetSpeed(actor, NORM_SPEED);
actorNew->user.Counter = RANDOM_P2(2048); actorNew->user.Counter = RANDOM_P2(2048);
actorNew->user.pos.Z = actorNew->int_pos().Z; actorNew->user.pos.Z = actorNew->spr.pos.Z;
actorNew->user.Health = 100; actorNew->user.Health = 100;
// defaults do change the statnum // defaults do change the statnum
@ -17083,10 +17088,11 @@ DSWActor* SpawnBubble(DSWActor* actor)
actorNew->spr.xrepeat = 8 + (RANDOM_P2(8 << 8) >> 8); actorNew->spr.xrepeat = 8 + (RANDOM_P2(8 << 8) >> 8);
actorNew->spr.yrepeat = actorNew->spr.xrepeat; actorNew->spr.yrepeat = actorNew->spr.xrepeat;
actorNew->user.notreallypos.X = actorNew->spr.xrepeat; // notreallypos
actorNew->user.notreallypos.Y = actorNew->spr.yrepeat; actorNew->user.pos.X = actorNew->spr.xrepeat;
actorNew->user.ceiling_dist = (1); actorNew->user.pos.Y = actorNew->spr.yrepeat;
actorNew->user.floor_dist = (1); actorNew->user.ceiling_dist = 1;
actorNew->user.floor_dist = 1;
actorNew->spr.shade = actor->sector()->floorshade - 10; actorNew->spr.shade = actor->sector()->floorshade - 10;
actorNew->user.WaitTics = 120 * 120; actorNew->user.WaitTics = 120 * 120;
actorNew->spr.zvel = 512; actorNew->spr.zvel = 512;
@ -17175,17 +17181,18 @@ int DoBubble(DSWActor* actor)
if (actor->spr.zvel > 768) if (actor->spr.zvel > 768)
actor->spr.zvel = 768; actor->spr.zvel = 768;
actor->user.notreallypos.X += 1; // notreallypos
actor->user.notreallypos.Y += 1; actor->user.pos.X += 1;
actor->user.pos.Y += 1;
if (actor->user.notreallypos.X > 32) if (actor->user.pos.X > 32)
{ {
actor->user.notreallypos.X = 32; actor->user.pos.X = 32;
actor->user.notreallypos.Y = 32; actor->user.pos.Y = 32;
} }
actor->spr.xrepeat = actor->user.notreallypos.X + (RANDOM_P2(8 << 8) >> 8) - 4; actor->spr.xrepeat = int(actor->user.pos.X) + (RANDOM_P2(8 << 8) >> 8) - 4;
actor->spr.yrepeat = actor->user.notreallypos.Y + (RANDOM_P2(8 << 8) >> 8) - 4; actor->spr.yrepeat = int(actor->user.pos.Y) + (RANDOM_P2(8 << 8) >> 8) - 4;
if (actor->spr.pos.Z < actor->sector()->ceilingz) if (actor->spr.pos.Z < actor->sector()->ceilingz)
{ {