diff --git a/source/games/duke/src/actors.cpp b/source/games/duke/src/actors.cpp index ea458d810..4a3b66355 100644 --- a/source/games/duke/src/actors.cpp +++ b/source/games/duke/src/actors.cpp @@ -932,7 +932,7 @@ void detonate(DDukeActor *actor, int explosion) } } - actor->spr.pos.Z -= (32 << 8); + actor->add_int_z(-(32 << 8)); if ((actor->temp_data[3] == 1 && actor->spr.xrepeat) || actor->spr.lotag == -99) { diff --git a/source/games/duke/src/player.cpp b/source/games/duke/src/player.cpp index c08eea8b9..c38b341ed 100644 --- a/source/games/duke/src/player.cpp +++ b/source/games/duke/src/player.cpp @@ -559,7 +559,7 @@ void playerisdead(int snum, int psectlotag, int fz, int cz) { SetPlayerPal(p, PalEntry(63, 63, 0, 0)); p->pos.Z -= (16 << 8); - actor->spr.pos.Z -= (16 << 8); + actor->add_int_z(-(16 << 8)); } #if 0 if (ud.recstat == 1 && ud.multimode < 2) diff --git a/source/games/duke/src/player_w.cpp b/source/games/duke/src/player_w.cpp index 707ffa972..4c1f0f23f 100644 --- a/source/games/duke/src/player_w.cpp +++ b/source/games/duke/src/player_w.cpp @@ -128,7 +128,7 @@ void DoSpawn(struct player_struct *p, int snum) j->spr.ang += 1024; j->spr.ang &= 2047; j->spr.xvel += 32; - j->spr.pos.Z += (3<<8); + j->add_int_z(3<<8); ssp(j,CLIPMASK0); } @@ -361,7 +361,7 @@ void operateweapon_ww(int snum, ESyncBits actions) if (k == 15) { j->spr.yvel = 3; - j->spr.pos.Z += (8 << 8); + j->add_int_z(8 << 8); } k = hits(p->GetActor()); diff --git a/source/games/duke/src/sectors_d.cpp b/source/games/duke/src/sectors_d.cpp index 916443e19..027b8d9bb 100644 --- a/source/games/duke/src/sectors_d.cpp +++ b/source/games/duke/src/sectors_d.cpp @@ -199,7 +199,7 @@ void operaterespawns_d(int low) auto star = spawn(act, TRANSPORTERSTAR); if (star) { - star->spr.pos.Z -= (32 << 8); + star->add_int_z(-(32 << 8)); act->spr.extra = 66 - 12; // Just a way to killit } @@ -1221,7 +1221,7 @@ void checkhitsprite_d(DDukeActor* targ, DDukeActor* proj) if (targ->spr.cstat & CSTAT_SPRITE_BLOCK) { S_PlayActorSound(GLASS_BREAKING, targ); - targ->spr.pos.Z += 16 << 8; + targ->add_int_z(16 << 8); targ->spr.cstat = 0; lotsofglass(targ, nullptr, 5); } @@ -1288,7 +1288,7 @@ void checkhitsprite_d(DDukeActor* targ, DDukeActor* proj) } { auto spawned = spawn(targ, STEAM); - if (spawned) spawned->spr.pos.Z = targ->sector()->floorz - (32 << 8); + if (spawned) spawned->set_int_z(targ->sector()->floorz - (32 << 8)); } break; @@ -1374,7 +1374,7 @@ void checkhitsprite_d(DDukeActor* targ, DDukeActor* proj) { if (proj->spr.pal == 6) spawned->spr.pal = 6; - spawned->spr.pos.Z += (4 << 8); + spawned->add_int_z(4 << 8); spawned->spr.xvel = 16; spawned->spr.xrepeat = spawned->spr.yrepeat = 24; spawned->spr.ang += 32 - (krand() & 63); @@ -1398,7 +1398,7 @@ void checkhitsprite_d(DDukeActor* targ, DDukeActor* proj) targ->spr.ang = (proj->spr.ang + 1024) & 2047; targ->spr.xvel = -(proj->spr.extra << 2); auto sp = targ->sector(); - pushmove(&targ->spr.pos, &sp, 128L, (4 << 8), (4 << 8), CLIPMASK0); + pushmove(targ, &sp, 128L, (4 << 8), (4 << 8), CLIPMASK0); if (sp != targ->sector() && sp != nullptr) ChangeActorSect(targ, sp); } diff --git a/source/games/duke/src/sectors_r.cpp b/source/games/duke/src/sectors_r.cpp index 85ec558c2..d6bc1a68c 100644 --- a/source/games/duke/src/sectors_r.cpp +++ b/source/games/duke/src/sectors_r.cpp @@ -313,7 +313,7 @@ void operaterespawns_r(int low) if (badguypic(act->spr.hitag) && ud.monsters_off) break; auto star = spawn(act, TRANSPORTERSTAR); - if (star) star->spr.pos.Z -= (32 << 8); + if (star) star->add_int_z(-(32 << 8)); act->spr.extra = 66 - 12; // Just a way to killit break; @@ -2284,7 +2284,7 @@ void checkhitsprite_r(DDukeActor* targ, DDukeActor* proj) } { auto spawned = spawn(targ, STEAM); - if (spawned) spawned->spr.pos.Z = targ->sector()->floorz - (32 << 8); + if (spawned) spawned->set_int_z(targ->sector()->floorz - (32 << 8)); } break; @@ -2330,7 +2330,7 @@ void checkhitsprite_r(DDukeActor* targ, DDukeActor* proj) { if (proj->spr.pal == 6) spawned->spr.pal = 6; - spawned->spr.pos.Z += (4 << 8); + spawned->add_int_z(4 << 8); spawned->spr.xvel = 16; spawned->spr.xrepeat = spawned->spr.yrepeat = 24; spawned->spr.ang += 32 - (krand() & 63); diff --git a/source/games/duke/src/spawn.cpp b/source/games/duke/src/spawn.cpp index cf43477e5..b376d430d 100644 --- a/source/games/duke/src/spawn.cpp +++ b/source/games/duke/src/spawn.cpp @@ -317,7 +317,7 @@ void spawntransporter(DDukeActor *actj, DDukeActor* act, bool beam) act->spr.xrepeat = 48; act->spr.yrepeat = 64; if (actj->spr.statnum == 10 || badguy(actj)) - act->spr.pos.Z -= (32 << 8); + act->add_int_z(-(32 << 8)); } } diff --git a/source/games/duke/src/spawn_r.cpp b/source/games/duke/src/spawn_r.cpp index 4630fe091..961516385 100644 --- a/source/games/duke/src/spawn_r.cpp +++ b/source/games/duke/src/spawn_r.cpp @@ -212,11 +212,11 @@ DDukeActor* spawninit_r(DDukeActor* actj, DDukeActor* act, TArray* { if (actj->sector()->lotag == 2) { - act->spr.pos.Z = getceilzofslopeptr(act->sector(), act->spr.pos.X, act->spr.pos.Y) + (16 << 8); + act->set_int_z(getceilzofslopeptr(act->sector(), act->spr.pos.X, act->spr.pos.Y) + (16 << 8)); act->spr.cstat |= CSTAT_SPRITE_YFLIP; } else if (actj->sector()->lotag == 1) - act->spr.pos.Z = getflorzofslopeptr(act->sector(), act->spr.pos.X, act->spr.pos.Y); + act->set_int_z(getflorzofslopeptr(act->sector(), act->spr.pos.X, act->spr.pos.Y)); } if (sectp->floorpicnum == FLOORSLIME || @@ -284,7 +284,7 @@ DDukeActor* spawninit_r(DDukeActor* actj, DDukeActor* act, TArray* case TONGUE: if (actj) act->spr.ang = actj->spr.ang; - act->spr.pos.Z -= PHEIGHT_RR; + act->add_int_z(-PHEIGHT_RR); act->spr.zvel = 256 - (krand() & 511); act->spr.xvel = 64 - (krand() & 127); ChangeActorStat(act, 4); @@ -324,7 +324,7 @@ DDukeActor* spawninit_r(DDukeActor* actj, DDukeActor* act, TArray* case BLOOD: act->spr.xrepeat = act->spr.yrepeat = 4; - act->spr.pos.Z -= (26 << 8); + act->add_int_z(-(26 << 8)); ChangeActorStat(act, STAT_MISC); break; case BLOODPOOL: @@ -353,7 +353,7 @@ DDukeActor* spawninit_r(DDukeActor* actj, DDukeActor* act, TArray* act->spr.cstat |= CSTAT_SPRITE_ALIGNMENT_WALL; act->spr.xrepeat = 7 + (krand() & 7); act->spr.yrepeat = 7 + (krand() & 7); - act->spr.pos.Z -= (16 << 8); + act->add_int_z(-(16 << 8)); if (actj && actj->spr.pal == 6) act->spr.pal = 6; insertspriteq(act); @@ -554,7 +554,7 @@ DDukeActor* spawninit_r(DDukeActor* actj, DDukeActor* act, TArray* if (act->spr.picnum == RESPAWNMARKERRED) { act->spr.xrepeat = act->spr.yrepeat = 8; - if (actj) act->spr.pos.Z = actj->floorz; + if (actj) act->set_int_z(actj->floorz); } else { @@ -651,7 +651,7 @@ DDukeActor* spawninit_r(DDukeActor* actj, DDukeActor* act, TArray* { int x = getflorzofslopeptr(act->sector(), act->spr.pos.X, act->spr.pos.Y); if (act->spr.pos.Z > x - (12 << 8)) - act->spr.pos.Z = x - (12 << 8); + act->set_int_z(x - (12 << 8)); } ChangeActorStat(act, STAT_MISC); @@ -684,7 +684,7 @@ DDukeActor* spawninit_r(DDukeActor* actj, DDukeActor* act, TArray* } case WATERBUBBLE: if (actj && actj->spr.picnum == APLAYER) - act->spr.pos.Z -= (16 << 8); + act->add_int_z(-(16 << 8)); if (act->spr.picnum == WATERBUBBLE) { if (actj) @@ -905,9 +905,7 @@ DDukeActor* spawninit_r(DDukeActor* actj, DDukeActor* act, TArray* act->spr.yrepeat = 64; act->spr.cstat = CSTAT_SPRITE_TRANSLUCENT; act->spr.cstat |= CSTAT_SPRITE_TRANS_FLIP; - act->spr.pos.X += (krand() & 2047) - 1024; - act->spr.pos.Y += (krand() & 2047) - 1024; - act->spr.pos.Z += (krand() & 2047) - 1024; + act->add_int_pos({ (krand() & 2047) - 1024, (krand() & 2047) - 1024, (krand() & 2047) - 1024 }); break; case MAMA: if (act->spr.pal == 30) @@ -1157,7 +1155,7 @@ DDukeActor* spawninit_r(DDukeActor* actj, DDukeActor* act, TArray* act->spr.lotag = 0; if (act->spr.picnum != BOWLINGBALLSPRITE) { - act->spr.pos.Z -= (32 << 8); + act->add_int_z(-(32 << 8)); act->spr.zvel = -(4 << 8); } else