- Blood: renamed functions and floatified cultThrowSeqCallback3

This commit is contained in:
Christoph Oelckers 2022-09-27 09:28:59 +02:00
parent fd7c47ce2b
commit 3055a1e5a7
3 changed files with 10 additions and 12 deletions

View file

@ -143,7 +143,7 @@ void cultThrowSeqCallback(int, DBloodActor* actor)
evPostActor(pMissile, 120 * (1 + Random(2)), kCmdOn, actor); evPostActor(pMissile, 120 * (1 + Random(2)), kCmdOn, actor);
} }
void sub_68170(int, DBloodActor* actor) void cultThrowSeqCallback2(int, DBloodActor* actor)
{ {
int nMissile = kThingArmedTNTStick; int nMissile = kThingArmedTNTStick;
if (gGameOptions.nDifficulty > 2) if (gGameOptions.nDifficulty > 2)
@ -153,7 +153,7 @@ void sub_68170(int, DBloodActor* actor)
evPostActor(pMissile, 120 * (2 + Random(2)), kCmdOn, actor); evPostActor(pMissile, 120 * (2 + Random(2)), kCmdOn, actor);
} }
void sub_68230(int, DBloodActor* actor) void cultThrowSeqCallback3(int, DBloodActor* actor)
{ {
int nMissile = kThingArmedTNTStick; int nMissile = kThingArmedTNTStick;
if (gGameOptions.nDifficulty > 2) if (gGameOptions.nDifficulty > 2)
@ -162,12 +162,10 @@ void sub_68230(int, DBloodActor* actor)
if (!actor->ValidateTarget(__FUNCTION__)) return; if (!actor->ValidateTarget(__FUNCTION__)) return;
auto target = actor->GetTarget(); auto target = actor->GetTarget();
assert(actor->spr.type >= kDudeBase && actor->spr.type < kDudeMax); assert(actor->spr.type >= kDudeBase && actor->spr.type < kDudeMax);
int dx = target->int_pos().X - actor->int_pos().X; auto dv = target->spr.pos - actor->spr.pos;
int dy = target->int_pos().Y - actor->int_pos().Y; double nDist = dv.XY().Length();
int dz = target->int_pos().Z - actor->int_pos().Z;
int nDist = approxDist(dx, dy); auto* pMissile = actFireThing(actor, 0., 0., dv.Z / 32768 - FixedToFloat(14500), nMissile, nDist * (32. / 64800));
int nDist2 = nDist / 540;
auto pMissile = actFireThing(actor, 0, 0, dz / 128 - 14500, nMissile, (nDist2 << 17) / 120);
pMissile->xspr.Impact = 1; pMissile->xspr.Impact = 1;
} }

View file

@ -57,8 +57,8 @@ static void (*seqClientCallback[])(int, DBloodActor*) = {
TeslaSeqCallback, TeslaSeqCallback,
ShotSeqCallback, ShotSeqCallback,
cultThrowSeqCallback, cultThrowSeqCallback,
sub_68170, cultThrowSeqCallback2,
sub_68230, cultThrowSeqCallback3,
SlashFSeqCallback, SlashFSeqCallback,
ThrowFSeqCallback, ThrowFSeqCallback,
ThrowSSeqCallback, ThrowSSeqCallback,

View file

@ -23,8 +23,8 @@ void TommySeqCallback(int, DBloodActor*);
void TeslaSeqCallback(int, DBloodActor*); void TeslaSeqCallback(int, DBloodActor*);
void ShotSeqCallback(int, DBloodActor*); void ShotSeqCallback(int, DBloodActor*);
void cultThrowSeqCallback(int, DBloodActor*); void cultThrowSeqCallback(int, DBloodActor*);
void sub_68170(int, DBloodActor*); void cultThrowSeqCallback2(int, DBloodActor*);
void sub_68230(int, DBloodActor*); void cultThrowSeqCallback3(int, DBloodActor*);
void SlashFSeqCallback(int, DBloodActor*); void SlashFSeqCallback(int, DBloodActor*);
void ThrowFSeqCallback(int, DBloodActor*); void ThrowFSeqCallback(int, DBloodActor*);
void BlastSSeqCallback(int, DBloodActor*); void BlastSSeqCallback(int, DBloodActor*);