From 977131eb8c30d662518d3d5d8ed443e93874f47b Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Tue, 13 Sep 2022 22:49:32 +0200 Subject: [PATCH] - eliminated all set_int_z calls in Duke. --- source/games/duke/src/actors.cpp | 2 +- source/games/duke/src/spawn.cpp | 4 ++-- source/games/duke/src/spawn_d.cpp | 15 ++++++--------- source/games/duke/src/spawn_r.cpp | 10 +++++----- 4 files changed, 14 insertions(+), 17 deletions(-) diff --git a/source/games/duke/src/actors.cpp b/source/games/duke/src/actors.cpp index a87c5e9ce..459daae61 100644 --- a/source/games/duke/src/actors.cpp +++ b/source/games/duke/src/actors.cpp @@ -1043,7 +1043,7 @@ void movewaterdrip(DDukeActor *actor, int drip) } else { - actor->set_int_z(actor->temp_data[0]); + actor->spr.pos.Z = actor->temp_pos.Z; actor->backupz(); actor->temp_data[1] = 48 + (krand() & 31); } diff --git a/source/games/duke/src/spawn.cpp b/source/games/duke/src/spawn.cpp index 0c9f24ba8..4878c39a4 100644 --- a/source/games/duke/src/spawn.cpp +++ b/source/games/duke/src/spawn.cpp @@ -378,7 +378,7 @@ void initfootprint(DDukeActor* actj, DDukeActor* act) act->spr.angle = actj->spr.angle; } - act->set_int_z(sect->int_floorz()); + act->spr.pos.Z = sect->floorz; if (sect->lotag != 1 && sect->lotag != 2) act->spr.xrepeat = act->spr.yrepeat = 32; @@ -506,7 +506,7 @@ void initwaterdrip(DDukeActor* actj, DDukeActor* actor) else if (!actj) { actor->spr.pos.Z += 4; - actor->temp_data[0] = actor->int_pos().Z; + actor->temp_pos.Z = actor->spr.pos.Z; if (!isRR()) actor->temp_data[1] = krand() & 127; } actor->spr.xrepeat = 24; diff --git a/source/games/duke/src/spawn_d.cpp b/source/games/duke/src/spawn_d.cpp index cec659aa6..cb940b6ea 100644 --- a/source/games/duke/src/spawn_d.cpp +++ b/source/games/duke/src/spawn_d.cpp @@ -157,11 +157,11 @@ DDukeActor* spawninit_d(DDukeActor* actj, DDukeActor* act, TArray* { if (actj->sector()->lotag == 2) { - act->set_int_z(getceilzofslopeptr(act->sector(), act->int_pos().X, act->int_pos().Y) + (16 << 8)); + act->spr.pos.Z = getceilzofslopeptrf(act->sector(), act->spr.pos) + 16; act->spr.cstat |= CSTAT_SPRITE_YFLIP; } else if (actj->sector()->lotag == 1) - act->set_int_z(getflorzofslopeptr(act->sector(), act->int_pos().X, act->int_pos().Y)); + act->spr.pos.Z = getflorzofslopeptrf(act->sector(), act->spr.pos); } if (sectp->floorpicnum == FLOORSLIME || @@ -294,10 +294,7 @@ DDukeActor* spawninit_d(DDukeActor* actj, DDukeActor* act, TArray* act->spr.cstat |= CSTAT_SPRITE_ALIGNMENT_FLOOR; if (act->spr.picnum == LAVAPOOL) // Twentieth Anniversary World Tour { - int fz = getflorzofslopeptr(act->sector(), act->int_pos().X, act->int_pos().Y); - if (fz != act->int_pos().Z) - act->set_int_z(fz); - act->spr.pos.Z -= 0.78125; + act->spr.pos.Z = getflorzofslopeptrf(act->sector(), act->spr.pos) - 0.78125; } [[fallthrough]]; @@ -637,9 +634,9 @@ DDukeActor* spawninit_d(DDukeActor* actj, DDukeActor* act, TArray* if (actj) { - int x = getflorzofslopeptr(act->sector(), act->int_pos().X, act->int_pos().Y); - if (act->int_pos().Z > x - (12 << 8)) - act->set_int_z(x - (12 << 8)); + double x = getflorzofslopeptrf(act->sector(), act->spr.pos); + if (act->spr.pos.Z > x - 12) + act->spr.pos.Z = x - 12; } if (act->spr.picnum == ONFIRE) diff --git a/source/games/duke/src/spawn_r.cpp b/source/games/duke/src/spawn_r.cpp index 6bffda2b1..20d599cc6 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->set_int_z(getceilzofslopeptr(act->sector(), act->int_pos().X, act->int_pos().Y) + (16 << 8)); + act->spr.pos.Z = getceilzofslopeptrf(act->sector(), act->spr.pos) + 16; act->spr.cstat |= CSTAT_SPRITE_YFLIP; } else if (actj->sector()->lotag == 1) - act->set_int_z(getflorzofslopeptr(act->sector(), act->int_pos().X, act->int_pos().Y)); + act->spr.pos.Z = getceilzofslopeptrf(act->sector(), act->spr.pos); } if (sectp->floorpicnum == FLOORSLIME || @@ -649,9 +649,9 @@ DDukeActor* spawninit_r(DDukeActor* actj, DDukeActor* act, TArray* if (actj) { - int x = getflorzofslopeptr(act->sector(), act->int_pos().X, act->int_pos().Y); - if (act->int_pos().Z > x - (12 << 8)) - act->set_int_z(x - (12 << 8)); + double x = getflorzofslopeptrf(act->sector(), act->spr.pos); + if (act->spr.pos.Z > x - 12) + act->spr.pos.Z = x - 12; } ChangeActorStat(act, STAT_MISC);