From 3898e2fa4c4ba315f9c415f6dc286aeefffa2921 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Sun, 11 Sep 2022 21:01:38 +0200 Subject: [PATCH] - floatified handle_se06 (both variants) --- source/games/duke/src/actors_d.cpp | 14 +++++++------- source/games/duke/src/actors_r.cpp | 16 ++++++++-------- 2 files changed, 15 insertions(+), 15 deletions(-) diff --git a/source/games/duke/src/actors_d.cpp b/source/games/duke/src/actors_d.cpp index 99f57879e..33544a673 100644 --- a/source/games/duke/src/actors_d.cpp +++ b/source/games/duke/src/actors_d.cpp @@ -3162,18 +3162,18 @@ void handle_se06_d(DDukeActor* actor) { actor->temp_data[4]--; if (actor->temp_data[4] >= (k - (k >> 3))) - actor->add_int_xvel(-(k >> 5)); + actor->vel.X -= (k >> 5) / 16.; if (actor->temp_data[4] > ((k >> 1) - 1) && actor->temp_data[4] < (k - (k >> 3))) actor->vel.X = 0; if (actor->temp_data[4] < (k >> 1)) - actor->add_int_xvel( (k >> 5)); + actor->vel.X += (k >> 5) / 16.; if (actor->temp_data[4] < ((k >> 1) - (k >> 3))) { actor->temp_data[4] = 0; - actor->set_int_xvel(k); + actor->vel.X = k / 16.; } } - else actor->set_int_xvel(k); + else actor->vel.X = k / 16.; DukeStatIterator it(STAT_EFFECTOR); while (auto act2 = it.Next()) @@ -3183,9 +3183,9 @@ void handle_se06_d(DDukeActor* actor) act2->vel.X = actor->vel.X; //if( actor->temp_data[4] == 1 ) { - if (act2->temp_data[5] == 0) - act2->temp_data[5] = dist(act2, actor); - int x = Sgn(dist(act2, actor) - act2->temp_data[5]); + if (act2->temp_pos.X == 0) + act2->temp_pos.X = (act2->spr.pos - actor->spr.pos).LengthSquared(); + int x = Sgn((act2->spr.pos - actor->spr.pos).LengthSquared() - act2->temp_pos.X); if (act2->spr.extra) x = -x; actor->vel.X += x / 16.; diff --git a/source/games/duke/src/actors_r.cpp b/source/games/duke/src/actors_r.cpp index 919241be6..b31617dcf 100644 --- a/source/games/duke/src/actors_r.cpp +++ b/source/games/duke/src/actors_r.cpp @@ -3137,15 +3137,15 @@ void handle_se06_r(DDukeActor *actor) { actor->temp_data[4]--; if (actor->temp_data[4] >= (k - (k >> 3))) - actor->add_int_xvel(-(k >> 5)); + actor->vel.X -= (k >> 5) / 16.; if (actor->temp_data[4] > ((k >> 1) - 1) && actor->temp_data[4] < (k - (k >> 3))) actor->vel.X = 0; if (actor->temp_data[4] < (k >> 1)) - actor->add_int_xvel( (k >> 5)); + actor->vel.X += (k >> 5) / 16.; if (actor->temp_data[4] < ((k >> 1) - (k >> 3))) { actor->temp_data[4] = 0; - actor->set_int_xvel(k); + actor->vel.X = k / 16.; if ((!isRRRA() || lastlevel) && hulkspawn) { hulkspawn--; @@ -3157,7 +3157,7 @@ void handle_se06_r(DDukeActor *actor) } if (!hulkspawn) { - ns = EGS(actor->sector(), actor->int_pos().X, actor->int_pos().Y, actor->sector()->int_ceilingz() + 119428, 3677, -8, 16, 16, 0, 0, 0, actor, 5); + ns = CreateActor(actor->sector(), DVector3(actor->spr.pos.XY(), actor->sector()->ceilingz + 466.5), 3677, -8, 16, 16, 0, 0, 0, actor, 5); if (ns) { ns->spr.cstat = CSTAT_SPRITE_TRANS_FLIP | CSTAT_SPRITE_TRANSLUCENT; @@ -3180,7 +3180,7 @@ void handle_se06_r(DDukeActor *actor) } else { - actor->set_int_xvel(k); + actor->vel.X = k / 16.; DukeSectIterator it(actor->sector()); while (auto a2 = it.Next()) { @@ -3223,9 +3223,9 @@ void handle_se06_r(DDukeActor *actor) act2->vel.X = actor->vel.X; //if( actor->temp_data[4] == 1 ) { - if (act2->temp_data[5] == 0) - act2->temp_data[5] = dist(act2, actor); - int x = Sgn(dist(act2, actor) - act2->temp_data[5]); + if (act2->temp_pos.X == 0) + act2->temp_pos.X = (act2->spr.pos - actor->spr.pos).LengthSquared(); + int x = Sgn((act2->spr.pos - actor->spr.pos).LengthSquared() - act2->temp_pos.X); if (act2->spr.extra) x = -x; actor->vel.X += x / 16.; }