diff --git a/source/games/blood/src/aiboneel.cpp b/source/games/blood/src/aiboneel.cpp index dfbb33453..b67183693 100644 --- a/source/games/blood/src/aiboneel.cpp +++ b/source/games/blood/src/aiboneel.cpp @@ -77,14 +77,14 @@ void eelBiteSeqCallback(int, DBloodActor* actor) } auto target = actor->GetTarget(); - int dx = bcos(actor->int_ang()); - int dy = bsin(actor->int_ang()); assert(actor->spr.type >= kDudeBase && actor->spr.type < kDudeMax); DUDEINFO* pDudeInfo = getDudeInfo(actor->spr.type); DUDEINFO* pDudeInfoT = getDudeInfo(target->spr.type); - int height = (actor->spr.yrepeat * pDudeInfo->eyeHeight) << 2; - int height2 = (target->spr.yrepeat * pDudeInfoT->eyeHeight) << 2; - actFireVector(actor, 0, 0, dx, dy, height2 - height, kVectorBoneelBite); + double height = (actor->spr.yrepeat * pDudeInfo->eyeHeight) * REPEAT_SCALE; + double height2 = (target->spr.yrepeat * pDudeInfoT->eyeHeight) * REPEAT_SCALE; + DVector3 vect(actor->spr.angle.ToVector() * 1024, height2 - height); + + actFireVector(actor, 0., 0., vect, kVectorBoneelBite); } static void eelThinkTarget(DBloodActor* actor) diff --git a/source/games/blood/src/aicaleb.cpp b/source/games/blood/src/aicaleb.cpp index 050613a72..5d9dc444e 100644 --- a/source/games/blood/src/aicaleb.cpp +++ b/source/games/blood/src/aicaleb.cpp @@ -59,18 +59,17 @@ AISTATE tinycaleb139698 = { kAiStateOther, 8, -1, 120, NULL, aiMoveTurn, NULL, & void SeqAttackCallback(int, DBloodActor* actor) { - int dx = bcos(actor->int_ang()); - int dy = bsin(actor->int_ang()); - int dz = actor->dudeSlope; - dx += Random2(1500); - dy += Random2(1500); - dz += Random2(1500); + DVector3 vect(actor->spr.angle.ToVector(), actor->dudeSlope / 16384.); + vect.X += Random2F(1500, 4); + vect.Y += Random2F(1500, 4); + vect.Z += Random2F(1500, 8); + for (int i = 0; i < 2; i++) { - int r1 = Random3(500); - int r2 = Random3(1000); - int r3 = Random3(1000); - actFireVector(actor, 0, 0, dx + r3, dy + r2, dz + r1, kVectorShell); + double r1 = Random3F(500, 4); + double r2 = Random3F(1000, 4); + double r3 = Random3F(1000, 8); + actFireVector(actor, 0, 0, vect + DVector3(r1, r2, r3), kVectorShell); } if (Chance(0x8000)) sfxPlay3DSound(actor, 10000 + Random(5), -1, 0); diff --git a/source/games/blood/src/common_game.h b/source/games/blood/src/common_game.h index b40db615a..f7a9c4d1e 100644 --- a/source/games/blood/src/common_game.h +++ b/source/games/blood/src/common_game.h @@ -585,6 +585,12 @@ inline int Random3(int a1) return MulScale(wrand() + wrand(), a1, 15) - a1; } +inline double Random3F(int a1, int scale = 16) +{ + return FixedToFloat(Random3(a1), scale); +} + + inline unsigned int QRandom(int a1) { return MulScale(qrand(), a1, 15);