From 3055a1e5a70c33804f8a3ae382647d1fbf4dd217 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Tue, 27 Sep 2022 09:28:59 +0200 Subject: [PATCH] - Blood: renamed functions and floatified cultThrowSeqCallback3 --- source/games/blood/src/aicult.cpp | 14 ++++++-------- source/games/blood/src/seq.cpp | 4 ++-- source/games/blood/src/seqcb.h | 4 ++-- 3 files changed, 10 insertions(+), 12 deletions(-) diff --git a/source/games/blood/src/aicult.cpp b/source/games/blood/src/aicult.cpp index 4ebd47fa2..a2a6846d6 100644 --- a/source/games/blood/src/aicult.cpp +++ b/source/games/blood/src/aicult.cpp @@ -143,7 +143,7 @@ void cultThrowSeqCallback(int, DBloodActor* actor) evPostActor(pMissile, 120 * (1 + Random(2)), kCmdOn, actor); } -void sub_68170(int, DBloodActor* actor) +void cultThrowSeqCallback2(int, DBloodActor* actor) { int nMissile = kThingArmedTNTStick; if (gGameOptions.nDifficulty > 2) @@ -153,7 +153,7 @@ void sub_68170(int, DBloodActor* actor) evPostActor(pMissile, 120 * (2 + Random(2)), kCmdOn, actor); } -void sub_68230(int, DBloodActor* actor) +void cultThrowSeqCallback3(int, DBloodActor* actor) { int nMissile = kThingArmedTNTStick; if (gGameOptions.nDifficulty > 2) @@ -162,12 +162,10 @@ void sub_68230(int, DBloodActor* actor) if (!actor->ValidateTarget(__FUNCTION__)) return; auto target = actor->GetTarget(); assert(actor->spr.type >= kDudeBase && actor->spr.type < kDudeMax); - int dx = target->int_pos().X - actor->int_pos().X; - int dy = target->int_pos().Y - actor->int_pos().Y; - int dz = target->int_pos().Z - actor->int_pos().Z; - int nDist = approxDist(dx, dy); - int nDist2 = nDist / 540; - auto pMissile = actFireThing(actor, 0, 0, dz / 128 - 14500, nMissile, (nDist2 << 17) / 120); + auto dv = target->spr.pos - actor->spr.pos; + double nDist = dv.XY().Length(); + + auto* pMissile = actFireThing(actor, 0., 0., dv.Z / 32768 - FixedToFloat(14500), nMissile, nDist * (32. / 64800)); pMissile->xspr.Impact = 1; } diff --git a/source/games/blood/src/seq.cpp b/source/games/blood/src/seq.cpp index ea07c459c..780f523cb 100644 --- a/source/games/blood/src/seq.cpp +++ b/source/games/blood/src/seq.cpp @@ -57,8 +57,8 @@ static void (*seqClientCallback[])(int, DBloodActor*) = { TeslaSeqCallback, ShotSeqCallback, cultThrowSeqCallback, - sub_68170, - sub_68230, + cultThrowSeqCallback2, + cultThrowSeqCallback3, SlashFSeqCallback, ThrowFSeqCallback, ThrowSSeqCallback, diff --git a/source/games/blood/src/seqcb.h b/source/games/blood/src/seqcb.h index a96d9204e..bfe91f463 100644 --- a/source/games/blood/src/seqcb.h +++ b/source/games/blood/src/seqcb.h @@ -23,8 +23,8 @@ void TommySeqCallback(int, DBloodActor*); void TeslaSeqCallback(int, DBloodActor*); void ShotSeqCallback(int, DBloodActor*); void cultThrowSeqCallback(int, DBloodActor*); -void sub_68170(int, DBloodActor*); -void sub_68230(int, DBloodActor*); +void cultThrowSeqCallback2(int, DBloodActor*); +void cultThrowSeqCallback3(int, DBloodActor*); void SlashFSeqCallback(int, DBloodActor*); void ThrowFSeqCallback(int, DBloodActor*); void BlastSSeqCallback(int, DBloodActor*);