diff --git a/source/games/sw/src/actor.cpp b/source/games/sw/src/actor.cpp index 265f8d1a1..9d2e495ed 100644 --- a/source/games/sw/src/actor.cpp +++ b/source/games/sw/src/actor.cpp @@ -304,7 +304,7 @@ void DoDebrisCurrent(DSWActor* actor) move_sprite(actor, nx, ny, 0, actor->user.ceiling_dist, actor->user.floor_dist, 0, ACTORMOVETICS); } - actor->spr.pos.Z = actor->user.loz; + actor->set_int_z(actor->user.loz); } int DoActorSectorDamage(DSWActor* actor) @@ -429,12 +429,12 @@ int DoActorDebris(DSWActor* actor) if (actor->sector()->hasU() && FixedToInt(actor->sector()->depth_fixed) > 10) // JBF: added null check { actor->user.WaitTics = (actor->user.WaitTics + (ACTORMOVETICS << 3)) & 1023; - actor->spr.pos.Z = actor->user.loz - MulScale(Z(2), bsin(actor->user.WaitTics), 14); + actor->set_int_z(actor->user.loz - MulScale(Z(2), bsin(actor->user.WaitTics), 14)); } } else { - actor->spr.pos.Z = actor->user.loz; + actor->set_int_z(actor->user.loz); } return 0; @@ -456,7 +456,7 @@ int DoFireFly(DSWActor* actor) actor->user.WaitTics = (actor->user.WaitTics + (ACTORMOVETICS << 1)) & 2047; - actor->spr.pos.Z = actor->user.pos.Z + MulScale(Z(32), bsin(actor->user.WaitTics), 14); + actor->set_int_z(actor->user.pos.Z + MulScale(Z(32), bsin(actor->user.WaitTics), 14)); return 0; } @@ -514,7 +514,7 @@ void KeepActorOnFloor(DSWActor* actor) // was swimming but have now stopped actor->user.Flags &= ~(SPR_SWIMMING); actor->spr.cstat &= ~(CSTAT_SPRITE_YCENTER); - actor->spr.pos.Z = actor->user.oz = actor->user.loz; + actor->set_int_z(actor->user.oz = actor->user.loz); actor->backupz(); return; } @@ -525,7 +525,7 @@ void KeepActorOnFloor(DSWActor* actor) } // are swimming - actor->spr.pos.Z = actor->user.oz = actor->user.loz - Z(depth); + actor->set_int_z(actor->user.oz = actor->user.loz - Z(depth)); actor->backupz(); } else @@ -534,7 +534,7 @@ void KeepActorOnFloor(DSWActor* actor) if (actor->user.Rot == actor->user.ActorActionSet->Run || actor->user.Rot == actor->user.ActorActionSet->Swim) { NewStateGroup(actor, actor->user.ActorActionSet->Swim); - actor->spr.pos.Z = actor->user.oz = actor->user.loz - Z(depth); + actor->set_int_z(actor->user.oz = actor->user.loz - Z(depth)); actor->backupz(); actor->user.Flags |= (SPR_SWIMMING); actor->spr.cstat |= (CSTAT_SPRITE_YCENTER); @@ -543,7 +543,7 @@ void KeepActorOnFloor(DSWActor* actor) { actor->user.Flags &= ~(SPR_SWIMMING); actor->spr.cstat &= ~(CSTAT_SPRITE_YCENTER); - actor->spr.pos.Z = actor->user.oz = actor->user.loz; + actor->set_int_z(actor->user.oz = actor->user.loz); actor->backupz(); } } @@ -558,7 +558,7 @@ void KeepActorOnFloor(DSWActor* actor) #if 1 if (actor->user.Flags & (SPR_MOVED)) { - actor->spr.pos.Z = actor->user.oz = actor->user.loz; + actor->set_int_z(actor->user.oz = actor->user.loz); actor->backupz(); } else @@ -568,7 +568,7 @@ void KeepActorOnFloor(DSWActor* actor) FAFgetzrangepoint(actor->spr.pos.X, actor->spr.pos.Y, actor->spr.pos.Z, actor->sector(), &ceilz, &ctrash, &florz, &ftrash); - actor->spr.pos.Z = actor->user.oz = florz; + actor->set_int_z(actor->user.oz = florz); actor->backupz(); } #endif @@ -667,7 +667,7 @@ int DoActorJump(DSWActor* actor) if (actor->spr.pos.Z < minh) { // put player at the ceiling - actor->spr.pos.Z = minh; + actor->set_int_z(minh); // reverse your speed to falling actor->user.jump_speed = -actor->user.jump_speed; @@ -728,7 +728,7 @@ int DoActorFall(DSWActor* actor) int DoActorStopFall(DSWActor* actor) { - actor->spr.pos.Z = actor->user.loz; + actor->set_int_z(actor->user.loz); actor->user.Flags &= ~(SPR_FALLING | SPR_JUMPING); actor->spr.cstat &= ~(CSTAT_SPRITE_YFLIP); @@ -833,7 +833,7 @@ int DoJump(DSWActor* actor) if (actor->spr.pos.Z < minh) { // put player at the ceiling - actor->spr.pos.Z = minh; + actor->set_int_z(minh); // reverse your speed to falling actor->user.jump_speed = -actor->user.jump_speed; @@ -869,7 +869,7 @@ int DoFall(DSWActor* actor) // Stick like glue when you hit the ground if (actor->spr.pos.Z > actor->user.loz - actor->user.floor_dist) { - actor->spr.pos.Z = actor->user.loz - actor->user.floor_dist; + actor->set_int_z(actor->user.loz - actor->user.floor_dist); actor->user.Flags &= ~(SPR_FALLING); } diff --git a/source/games/sw/src/coolg.cpp b/source/games/sw/src/coolg.cpp index 82aca4eb2..2335d991d 100644 --- a/source/games/sw/src/coolg.cpp +++ b/source/games/sw/src/coolg.cpp @@ -662,13 +662,13 @@ int DoCoolgMatchPlayerZ(DSWActor* actor) actor->user.pos.Z = max(actor->user.pos.Z, hiz + actor->user.ceiling_dist); actor->user.Counter = (actor->user.Counter + (ACTORMOVETICS<<3)) & 2047; - actor->spr.pos.Z = actor->user.pos.Z + MulScale(COOLG_BOB_AMT, bsin(actor->user.Counter), 14); + actor->set_int_z(actor->user.pos.Z + MulScale(COOLG_BOB_AMT, bsin(actor->user.Counter), 14)); bound = actor->user.hiz + actor->user.ceiling_dist + COOLG_BOB_AMT; if (actor->spr.pos.Z < bound) { // bumped something - actor->spr.pos.Z = actor->user.pos.Z = bound + COOLG_BOB_AMT; + actor->set_int_z(actor->user.pos.Z = bound + COOLG_BOB_AMT); } return 0; diff --git a/source/games/sw/src/eel.cpp b/source/games/sw/src/eel.cpp index 9dd52c1d8..cb0cdb3f3 100644 --- a/source/games/sw/src/eel.cpp +++ b/source/games/sw/src/eel.cpp @@ -497,13 +497,13 @@ int DoEelMatchPlayerZ(DSWActor* actor) actor->user.pos.Z = max(actor->user.pos.Z, hiz + actor->user.ceiling_dist); actor->user.Counter = (actor->user.Counter + (ACTORMOVETICS << 3) + (ACTORMOVETICS << 1)) & 2047; - actor->spr.pos.Z = actor->user.pos.Z + MulScale(EEL_BOB_AMT, bsin(actor->user.Counter), 14); + actor->set_int_z(actor->user.pos.Z + MulScale(EEL_BOB_AMT, bsin(actor->user.Counter), 14)); bound = actor->user.hiz + actor->user.ceiling_dist + EEL_BOB_AMT; if (actor->spr.pos.Z < bound) { // bumped something - actor->spr.pos.Z = actor->user.pos.Z = bound + EEL_BOB_AMT; + actor->set_int_z(actor->user.pos.Z = bound + EEL_BOB_AMT); } return 0; diff --git a/source/games/sw/src/hornet.cpp b/source/games/sw/src/hornet.cpp index 1219c3da6..7ba5a4b0b 100644 --- a/source/games/sw/src/hornet.cpp +++ b/source/games/sw/src/hornet.cpp @@ -393,13 +393,13 @@ int DoHornetMatchPlayerZ(DSWActor* actor) actor->user.pos.Z = max(actor->user.pos.Z, hiz + actor->user.ceiling_dist); actor->user.Counter = (actor->user.Counter + (ACTORMOVETICS << 3) + (ACTORMOVETICS << 1)) & 2047; - actor->spr.pos.Z = actor->user.pos.Z + MulScale(HORNET_BOB_AMT, bsin(actor->user.Counter), 14); + actor->set_int_z(actor->user.pos.Z + MulScale(HORNET_BOB_AMT, bsin(actor->user.Counter), 14)); bound = actor->user.hiz + actor->user.ceiling_dist + HORNET_BOB_AMT; if (actor->spr.pos.Z < bound) { // bumped something - actor->spr.pos.Z = actor->user.pos.Z = bound + HORNET_BOB_AMT; + actor->set_int_z(actor->user.pos.Z = bound + HORNET_BOB_AMT); } return 0; diff --git a/source/games/sw/src/jweapon.cpp b/source/games/sw/src/jweapon.cpp index a016d803b..9b4fcfb1d 100644 --- a/source/games/sw/src/jweapon.cpp +++ b/source/games/sw/src/jweapon.cpp @@ -281,7 +281,7 @@ int DoWallBloodDrip(DSWActor* actor) if (actor->spr.pos.Z >= actor->user.loz) { - actor->spr.pos.Z = actor->user.loz; + actor->set_int_z(actor->user.loz); SpawnFloorSplash(actor); KillActor(actor); return 0; @@ -363,7 +363,7 @@ int DoBloodSpray(DSWActor* actor) // pretend like we hit a sector if (actor->spr.pos.Z >= fz) { - actor->spr.pos.Z = fz; + actor->set_int_z(fz); SpawnFloorSplash(actor); KillActor(actor); return true; @@ -1215,10 +1215,7 @@ int SpawnRadiationCloud(DSWActor* actor) int DoRadiationCloud(DSWActor* actor) { - actor->spr.pos.Z -= actor->spr.zvel; - - actor->spr.pos.X += actor->user.change.X; - actor->spr.pos.Y += actor->user.change.Y; + actor->add_int_pos({ actor->user.change.X, actor->user.change.Y, -actor->spr.zvel }); if (actor->user.ID) { @@ -2073,7 +2070,7 @@ int DoCarryFlagNoDet(DSWActor* actor) vec3_t pos = { attached->spr.pos.X, attached->spr.pos.Y, ActorZOfMiddle(attached) }; SetActorZ(actor, &pos); actor->spr.ang = NORM_ANGLE(attached->spr.ang + 1536); - actor->spr.pos.Z = attached->spr.pos.Z - (ActorSizeZ(attached) >> 1); + actor->set_int_z(attached->spr.pos.Z - (ActorSizeZ(attached) >> 1)); } if (!attached->hasU() || attached->user.Health <= 0) diff --git a/source/games/sw/src/skull.cpp b/source/games/sw/src/skull.cpp index 26f8b19f0..2f6afbe26 100644 --- a/source/games/sw/src/skull.cpp +++ b/source/games/sw/src/skull.cpp @@ -234,7 +234,7 @@ int SetupSkull(DSWActor* actor) if (ActorZOfBottom(actor) > actor->user.loz - Z(16)) { - actor->spr.pos.Z = actor->user.loz + Z(tileTopOffset(actor->spr.picnum)); + actor->set_int_z(actor->user.loz + Z(tileTopOffset(actor->spr.picnum))); actor->user.loz = actor->spr.pos.Z; // leave 8 pixels above the ground @@ -375,7 +375,7 @@ int DoSkullJump(DSWActor* actor) if ((actor->spr.pos.Z > actor->user.loz - Z(36))) { - actor->spr.pos.Z = actor->user.loz - Z(36); + actor->set_int_z(actor->user.loz - Z(36)); UpdateSinglePlayKills(actor); DoSkullBeginDeath(actor); return 0; @@ -407,8 +407,8 @@ int DoSkullBob(DSWActor* actor) const int SKULL_BOB_AMT = (Z(16)); actor->user.Counter = (actor->user.Counter + (ACTORMOVETICS << 3) + (ACTORMOVETICS << 1)) & 2047; - actor->spr.pos.Z = actor->user.pos.Z + MulScale(SKULL_BOB_AMT, bsin(actor->user.Counter), 14) + - MulScale((SKULL_BOB_AMT / 2), bsin(actor->user.Counter), 14); + actor->set_int_z(actor->user.pos.Z + MulScale(SKULL_BOB_AMT, bsin(actor->user.Counter), 14) + + MulScale((SKULL_BOB_AMT / 2), bsin(actor->user.Counter), 14)); return 0; } @@ -619,7 +619,7 @@ int SetupBetty(DSWActor* actor) if (ActorZOfBottom(actor) > actor->user.loz - Z(16)) { - actor->spr.pos.Z = actor->user.loz + Z(tileTopOffset(actor->spr.picnum)); + actor->set_int_z(actor->user.loz + Z(tileTopOffset(actor->spr.picnum))); actor->user.loz = actor->spr.pos.Z; // leave 8 pixels above the ground @@ -753,7 +753,7 @@ int DoBettyJump(DSWActor* actor) if ((actor->spr.pos.Z > actor->user.loz - Z(36))) { - actor->spr.pos.Z = actor->user.loz - Z(36); + actor->set_int_z(actor->user.loz - Z(36)); UpdateSinglePlayKills(actor); DoBettyBeginDeath(actor); return 0; @@ -784,8 +784,8 @@ int DoBettyBob(DSWActor* actor) const int BETTY_BOB_AMT = (Z(16)); actor->user.Counter = (actor->user.Counter + (ACTORMOVETICS << 3) + (ACTORMOVETICS << 1)) & 2047; - actor->spr.pos.Z = actor->user.pos.Z + MulScale(BETTY_BOB_AMT, bsin(actor->user.Counter), 14) + - MulScale((BETTY_BOB_AMT / 2), bsin(actor->user.Counter), 14); + actor->set_int_z(actor->user.pos.Z + MulScale(BETTY_BOB_AMT, bsin(actor->user.Counter), 14) + + MulScale((BETTY_BOB_AMT / 2), bsin(actor->user.Counter), 14)); return 0; } diff --git a/source/games/sw/src/spike.cpp b/source/games/sw/src/spike.cpp index 055e4936d..53f7cf8d1 100644 --- a/source/games/sw/src/spike.cpp +++ b/source/games/sw/src/spike.cpp @@ -259,7 +259,7 @@ void MoveSpritesWithSpike(sectortype* sect) continue; getzsofslopeptr(sect, actor->spr.pos.X, actor->spr.pos.Y, &cz, &fz); - actor->spr.pos.Z = fz; + actor->set_int_z(fz); } } diff --git a/source/games/sw/src/sprite.cpp b/source/games/sw/src/sprite.cpp index 8fb042256..06eed101a 100644 --- a/source/games/sw/src/sprite.cpp +++ b/source/games/sw/src/sprite.cpp @@ -1448,8 +1448,7 @@ void PreMapCombineFloors(void) SWSectIterator it2(dasect); while (auto jActor = it2.Next()) { - jActor->spr.pos.X += dx; - jActor->spr.pos.Y += dy; + jActor->add_int_pos({ dx, dy, 0 }); } for (auto& wal : wallsofsector(dasect)) @@ -2491,8 +2490,7 @@ void SpriteSetup(void) actorNew->spr.ang = NORM_ANGLE(actor->spr.ang + 1024); actorNew->spr.picnum = actor->spr.picnum; - actorNew->spr.pos.X += MOVEx(256+128, actor->spr.ang); - actorNew->spr.pos.Y += MOVEy(256+128, actor->spr.ang); + actorNew->add_int_pos({ MOVEx(256 + 128, actor->spr.ang), MOVEy(256 + 128, actor->spr.ang), 0 }); break; } @@ -4612,7 +4610,7 @@ int move_actor(DSWActor* actor, int xchange, int ychange, int zchange) { // For COOLG & HORNETS // set to actual z before you move - actor->spr.pos.Z = actor->user.pos.Z; + actor->set_int_z(actor->user.pos.Z); } // save off x,y values @@ -4688,7 +4686,7 @@ int move_actor(DSWActor* actor, int xchange, int ychange, int zchange) int DoStayOnFloor(DSWActor* actor) { - actor->spr.pos.Z = actor->sector()->floorz; + actor->set_int_z(actor->sector()->floorz); return 0; } @@ -4700,20 +4698,22 @@ int DoGrating(DSWActor* actor) // reduce to 0 to 3 value dir = actor->spr.ang >> 9; + int x = 0, y = 0; if ((dir & 1) == 0) { if (dir == 0) - actor->spr.pos.X += 2 * GRATE_FACTOR; + x = 2 * GRATE_FACTOR; else - actor->spr.pos.X -= 2 * GRATE_FACTOR; + x = -2 * GRATE_FACTOR; } else { if (dir == 1) - actor->spr.pos.Y += 2 * GRATE_FACTOR; + y= 2 * GRATE_FACTOR; else - actor->spr.pos.Y -= 2 * GRATE_FACTOR; + y= -2 * GRATE_FACTOR; } + actor->add_int_pos({ x, y, 0 }); actor->spr.hitag -= GRATE_FACTOR; @@ -6283,7 +6283,7 @@ Collision move_sprite(DSWActor* actor, int xchange, int ychange, int zchange, in { if (actor->user.Flags & (SPR_CLIMBING)) { - actor->spr.pos.Z = clippos.Z; + actor->set_int_z(clippos.Z); return retval; } @@ -6292,7 +6292,7 @@ Collision move_sprite(DSWActor* actor, int xchange, int ychange, int zchange, in } else { - actor->spr.pos.Z = clippos.Z; + actor->set_int_z(clippos.Z); } // extra processing for Stacks and warping @@ -6467,19 +6467,19 @@ Collision move_missile(DSWActor* actor, int xchange, int ychange, int zchange, i if (clippos.Z - zh <= actor->user.hiz + ceildist) { // normal code - actor->spr.pos.Z = actor->user.hiz + zh + ceildist; + actor->set_int_z(actor->user.hiz + zh + ceildist); if (retval.type == kHitNone) retval.setSector(dasect); } else if (clippos.Z - zh > actor->user.loz - flordist) { - actor->spr.pos.Z = actor->user.loz + zh - flordist; + actor->set_int_z(actor->user.loz + zh - flordist); if (retval.type == kHitNone) retval.setSector(dasect); } else { - actor->spr.pos.Z = clippos.Z; + actor->set_int_z(clippos.Z); } if (FAF_ConnectArea(actor->sector())) @@ -6561,8 +6561,7 @@ Collision move_ground_missile(DSWActor* actor, int xchange, int ychange, int cei actor->user.z_tgt = 0; } - actor->spr.pos.X += xchange/2; - actor->spr.pos.Y += ychange/2; + actor->add_int_pos({ xchange / 2, ychange / 2, 0 }); updatesector(actor->spr.pos.X, actor->spr.pos.Y, &dasect); @@ -6599,7 +6598,7 @@ Collision move_ground_missile(DSWActor* actor, int xchange, int ychange, int cei int new_loz,new_hiz; getzsofslopeptr(dasect, actor->spr.pos.X, actor->spr.pos.Y, &new_hiz, &new_loz); - actor->spr.pos.Z = new_loz; + actor->set_int_z(new_loz); ChangeActorSect(actor, dasect); } @@ -6607,7 +6606,7 @@ Collision move_ground_missile(DSWActor* actor, int xchange, int ychange, int cei actor->user.hi_sectp = actor->user.lo_sectp = actor->sector(); actor->user.highActor = nullptr; actor->user.lowActor = nullptr; - actor->spr.pos.Z = actor->user.loz - Z(8); + actor->set_int_z(actor->user.loz - Z(8)); if (labs(actor->user.hiz - actor->user.loz) < Z(12)) {