From 3ec1767791809d775736970d2accaf0407932086 Mon Sep 17 00:00:00 2001 From: Mitch Richters Date: Sat, 30 Oct 2021 17:22:17 +1100 Subject: [PATCH] - Blood: Replace `SinScale16()` with `bsin()` from backend. --- source/games/blood/src/actor.cpp | 2 +- source/games/blood/src/ai.cpp | 2 +- source/games/blood/src/aibat.cpp | 2 +- source/games/blood/src/aibeast.cpp | 4 ++-- source/games/blood/src/aiboneel.cpp | 2 +- source/games/blood/src/aicaleb.cpp | 2 +- source/games/blood/src/aicerber.cpp | 10 +++++----- source/games/blood/src/aicult.cpp | 6 +++--- source/games/blood/src/aigarg.cpp | 6 +++--- source/games/blood/src/aighost.cpp | 6 +++--- source/games/blood/src/aigilbst.cpp | 2 +- source/games/blood/src/aihound.cpp | 4 ++-- source/games/blood/src/airat.cpp | 2 +- source/games/blood/src/aispid.cpp | 4 ++-- source/games/blood/src/aitchern.cpp | 8 ++++---- source/games/blood/src/aiunicult.cpp | 18 +++++++++--------- source/games/blood/src/aizomba.cpp | 2 +- source/games/blood/src/aizombf.cpp | 6 +++--- source/games/blood/src/misc.h | 5 ----- source/games/blood/src/nnexts.cpp | 6 +++--- source/games/blood/src/player.cpp | 8 ++++---- source/games/blood/src/triggers.cpp | 6 +++--- source/games/blood/src/weapon.cpp | 12 ++++++------ 23 files changed, 60 insertions(+), 65 deletions(-) diff --git a/source/games/blood/src/actor.cpp b/source/games/blood/src/actor.cpp index d405fbc7e..1e1978612 100644 --- a/source/games/blood/src/actor.cpp +++ b/source/games/blood/src/actor.cpp @@ -6133,7 +6133,7 @@ static void actCheckTraps() x += (dx / 2) >> 12; y += (dy / 2) >> 12; } - dy = SinScale16(pSprite->ang); + dy = bsin(pSprite->ang); dx = CosScale16(pSprite->ang); gVectorData[kVectorTchernobogBurn].maxDist = pXSprite->data1 << 9; actFireVector(actor, 0, 0, dx, dy, Random2(0x8888), kVectorTchernobogBurn); diff --git a/source/games/blood/src/ai.cpp b/source/games/blood/src/ai.cpp index cb21df8e6..5bad8572a 100644 --- a/source/games/blood/src/ai.cpp +++ b/source/games/blood/src/ai.cpp @@ -138,7 +138,7 @@ bool CanMove(DBloodActor* actor, DBloodActor* target, int nAngle, int nRange) int x = pSprite->x; int y = pSprite->y; int z = pSprite->z; - HitScan(pSprite, z, CosScale16(nAngle), SinScale16(nAngle), 0, CLIPMASK0, nRange); + HitScan(pSprite, z, CosScale16(nAngle), bsin(nAngle), 0, CLIPMASK0, nRange); int nDist = approxDist(x - gHitInfo.hitx, y - gHitInfo.hity); if (nDist - (pSprite->clipdist << 2) < nRange) { diff --git a/source/games/blood/src/aibat.cpp b/source/games/blood/src/aibat.cpp index aa450b15c..ebb61d6a8 100644 --- a/source/games/blood/src/aibat.cpp +++ b/source/games/blood/src/aibat.cpp @@ -69,7 +69,7 @@ void batBiteSeqCallback(int, DBloodActor* actor) if (!actor->ValidateTarget(__FUNCTION__)) return; spritetype* pTarget = &actor->GetTarget()->s(); int dx = CosScale16(pSprite->ang); - int dy = SinScale16(pSprite->ang); + int dy = bsin(pSprite->ang); assert(pSprite->type >= kDudeBase && pSprite->type < kDudeMax); DUDEINFO* pDudeInfo = getDudeInfo(pSprite->type); DUDEINFO* pDudeInfoT = getDudeInfo(pTarget->type); diff --git a/source/games/blood/src/aibeast.cpp b/source/games/blood/src/aibeast.cpp index 3c09c1dbf..a8150af3f 100644 --- a/source/games/blood/src/aibeast.cpp +++ b/source/games/blood/src/aibeast.cpp @@ -70,7 +70,7 @@ void SlashSeqCallback(int, DBloodActor* actor) if (!actor->ValidateTarget(__FUNCTION__)) return; spritetype* pTarget = &actor->GetTarget()->s(); int dx = CosScale16(pSprite->ang); - int dy = SinScale16(pSprite->ang); + int dy = bsin(pSprite->ang); // Correct ? int dz = pSprite->z - pTarget->z; dx += Random3(4000 - 700 * gGameOptions.nDifficulty); @@ -87,7 +87,7 @@ void StompSeqCallback(int, DBloodActor* actor1) XSPRITE* pXSprite = &actor1->x(); spritetype* pSprite = &actor1->s(); int dx = CosScale16(pSprite->ang); - int dy = SinScale16(pSprite->ang); + int dy = bsin(pSprite->ang); int x = pSprite->x; int y = pSprite->y; int z = pSprite->z; diff --git a/source/games/blood/src/aiboneel.cpp b/source/games/blood/src/aiboneel.cpp index a2debbd8b..0b83485ce 100644 --- a/source/games/blood/src/aiboneel.cpp +++ b/source/games/blood/src/aiboneel.cpp @@ -81,7 +81,7 @@ void eelBiteSeqCallback(int, DBloodActor* actor) spritetype* pTarget = &actor->GetTarget()->s(); int dx = CosScale16(pSprite->ang); - int dy = SinScale16(pSprite->ang); + int dy = bsin(pSprite->ang); assert(pSprite->type >= kDudeBase && pSprite->type < kDudeMax); DUDEINFO* pDudeInfo = getDudeInfo(pSprite->type); DUDEINFO* pDudeInfoT = getDudeInfo(pTarget->type); diff --git a/source/games/blood/src/aicaleb.cpp b/source/games/blood/src/aicaleb.cpp index 83a7eed10..cc0fcbd45 100644 --- a/source/games/blood/src/aicaleb.cpp +++ b/source/games/blood/src/aicaleb.cpp @@ -62,7 +62,7 @@ void SeqAttackCallback(int, DBloodActor* actor) { spritetype* pSprite = &actor->s(); int dx = CosScale16(pSprite->ang); - int dy = SinScale16(pSprite->ang); + int dy = bsin(pSprite->ang); int dz = actor->dudeSlope; dx += Random2(1500); dy += Random2(1500); diff --git a/source/games/blood/src/aicerber.cpp b/source/games/blood/src/aicerber.cpp index d130f985f..9ef0bc644 100644 --- a/source/games/blood/src/aicerber.cpp +++ b/source/games/blood/src/aicerber.cpp @@ -61,7 +61,7 @@ void cerberusBiteSeqCallback(int, DBloodActor* actor) XSPRITE* pXSprite = &actor->x(); spritetype* pSprite = &actor->s(); int dx = CosScale16(pSprite->ang); - int dy = SinScale16(pSprite->ang); + int dy = bsin(pSprite->ang); ///assert(pSprite->type >= kDudeBase && pSprite->type < kDudeMax); if (!(pSprite->type >= kDudeBase && pSprite->type < kDudeMax)) { Printf(PRINT_HIGH, "pSprite->type >= kDudeBase && pSprite->type < kDudeMax"); @@ -89,7 +89,7 @@ void cerberusBurnSeqCallback(int, DBloodActor* actor) TARGETTRACK tt1 = { 0x10000, 0x10000, 0x100, 0x55, 0x1aaaaa }; Aim aim; aim.dx = CosScale16(pSprite->ang); - aim.dy = SinScale16(pSprite->ang); + aim.dy = bsin(pSprite->ang); aim.dz = actor->dudeSlope; int nClosest = 0x7fffffff; BloodStatIterator it(kStatDude); @@ -134,7 +134,7 @@ void cerberusBurnSeqCallback(int, DBloodActor* actor) { nClosest = nDist2; aim.dx = CosScale16(nAngle); - aim.dy = SinScale16(nAngle); + aim.dy = bsin(nAngle); aim.dz = DivScale(tz, nDist, 10); } else @@ -168,7 +168,7 @@ void cerberusBurnSeqCallback2(int, DBloodActor* actor) Aim aim; int ax, ay, az; aim.dx = ax = CosScale16(pSprite->ang); - aim.dy = ay = SinScale16(pSprite->ang); + aim.dy = ay = bsin(pSprite->ang); aim.dz = actor->dudeSlope; az = 0; int nClosest = 0x7fffffff; @@ -216,7 +216,7 @@ void cerberusBurnSeqCallback2(int, DBloodActor* actor) { nClosest = nDist2; aim.dx = CosScale16(nAngle); - aim.dy = SinScale16(nAngle); + aim.dy = bsin(nAngle); aim.dz = DivScale(tz, nDist, 10); } else diff --git a/source/games/blood/src/aicult.cpp b/source/games/blood/src/aicult.cpp index ca936925e..cc1f2bfba 100644 --- a/source/games/blood/src/aicult.cpp +++ b/source/games/blood/src/aicult.cpp @@ -78,7 +78,7 @@ void TommySeqCallback(int, DBloodActor* actor) XSPRITE* pXSprite = &actor->x(); spritetype* pSprite = &actor->s(); int dx = CosScale16(pSprite->ang); - int dy = SinScale16(pSprite->ang); + int dy = bsin(pSprite->ang); int dz = actor->dudeSlope; dx += Random3((5 - gGameOptions.nDifficulty) * 1000); dy += Random3((5 - gGameOptions.nDifficulty) * 1000); @@ -94,7 +94,7 @@ void TeslaSeqCallback(int, DBloodActor* actor) if (Chance(dword_138BB0[gGameOptions.nDifficulty])) { int dx = CosScale16(pSprite->ang); - int dy = SinScale16(pSprite->ang); + int dy = bsin(pSprite->ang); int dz = actor->dudeSlope; dx += Random3((5 - gGameOptions.nDifficulty) * 1000); dy += Random3((5 - gGameOptions.nDifficulty) * 1000); @@ -109,7 +109,7 @@ void ShotSeqCallback(int, DBloodActor* actor) XSPRITE* pXSprite = &actor->x(); spritetype* pSprite = &actor->s(); int dx = CosScale16(pSprite->ang); - int dy = SinScale16(pSprite->ang); + int dy = bsin(pSprite->ang); int dz = actor->dudeSlope; dx += Random2((5 - gGameOptions.nDifficulty) * 1000 - 500); dy += Random2((5 - gGameOptions.nDifficulty) * 1000 - 500); diff --git a/source/games/blood/src/aigarg.cpp b/source/games/blood/src/aigarg.cpp index 17719adc7..1de46f765 100644 --- a/source/games/blood/src/aigarg.cpp +++ b/source/games/blood/src/aigarg.cpp @@ -89,7 +89,7 @@ void SlashFSeqCallback(int, DBloodActor* actor) int height2 = (pTarget->yrepeat * pDudeInfoT->eyeHeight) << 2; int dz = height - height2; int dx = CosScale16(pSprite->ang); - int dy = SinScale16(pSprite->ang); + int dy = bsin(pSprite->ang); actFireVector(actor, 0, 0, dx, dy, dz, kVectorGargSlash); int r1 = Random(50); int r2 = Random(50); @@ -122,7 +122,7 @@ void BlastSSeqCallback(int, DBloodActor* actor) TARGETTRACK tt = { 0x10000, 0x10000, 0x100, 0x55, 0x1aaaaa }; Aim aim; aim.dx = CosScale16(pSprite->ang); - aim.dy = SinScale16(pSprite->ang); + aim.dy = bsin(pSprite->ang); aim.dz = actor->dudeSlope; int nClosest = 0x7fffffff; BloodStatIterator it(kStatDude); @@ -167,7 +167,7 @@ void BlastSSeqCallback(int, DBloodActor* actor) { nClosest = nDist2; aim.dx = CosScale16(nAngle); - aim.dy = SinScale16(nAngle); + aim.dy = bsin(nAngle); aim.dz = DivScale(tz, nDist, 10); if (tz > -0x333) aim.dz = DivScale(tz, nDist, 10); diff --git a/source/games/blood/src/aighost.cpp b/source/games/blood/src/aighost.cpp index 65ba703da..7f0f66d11 100644 --- a/source/games/blood/src/aighost.cpp +++ b/source/games/blood/src/aighost.cpp @@ -73,7 +73,7 @@ void ghostSlashSeqCallback(int, DBloodActor* actor) int height2 = (pTarget->yrepeat * pDudeInfoT->eyeHeight) << 2; int dz = height - height2; int dx = CosScale16(pSprite->ang); - int dy = SinScale16(pSprite->ang); + int dy = bsin(pSprite->ang); sfxPlay3DSound(actor, 1406, 0, 0); actFireVector(actor, 0, 0, dx, dy, dz, kVectorGhost); int r1 = Random(50); @@ -105,7 +105,7 @@ void ghostBlastSeqCallback(int, DBloodActor* actor) TARGETTRACK tt = { 0x10000, 0x10000, 0x100, 0x55, 0x1aaaaa }; Aim aim; aim.dx = CosScale16(pSprite->ang); - aim.dy = SinScale16(pSprite->ang); + aim.dy = bsin(pSprite->ang); aim.dz = actor->dudeSlope; int nClosest = 0x7fffffff; BloodStatIterator it(kStatDude); @@ -150,7 +150,7 @@ void ghostBlastSeqCallback(int, DBloodActor* actor) { nClosest = nDist2; aim.dx = CosScale16(nAngle); - aim.dy = SinScale16(nAngle); + aim.dy = bsin(nAngle); aim.dz = DivScale(tz, nDist, 10); if (tz > -0x333) aim.dz = DivScale(tz, nDist, 10); diff --git a/source/games/blood/src/aigilbst.cpp b/source/games/blood/src/aigilbst.cpp index f3e54c4a1..1c3b8f0be 100644 --- a/source/games/blood/src/aigilbst.cpp +++ b/source/games/blood/src/aigilbst.cpp @@ -65,7 +65,7 @@ void GillBiteSeqCallback(int, DBloodActor* actor) if (!actor->ValidateTarget(__FUNCTION__)) return; spritetype* pTarget = &actor->GetTarget()->s(); int dx = CosScale16(pSprite->ang); - int dy = SinScale16(pSprite->ang); + int dy = bsin(pSprite->ang); int dz = pSprite->z - pTarget->z; dx += Random3(2000); dy += Random3(2000); diff --git a/source/games/blood/src/aihound.cpp b/source/games/blood/src/aihound.cpp index 3d78a2b86..9cccdea37 100644 --- a/source/games/blood/src/aihound.cpp +++ b/source/games/blood/src/aihound.cpp @@ -48,7 +48,7 @@ void houndBiteSeqCallback(int, DBloodActor* actor) XSPRITE* pXSprite = &actor->x(); spritetype* pSprite = &actor->s(); int dx = CosScale16(pSprite->ang); - int dy = SinScale16(pSprite->ang); + int dy = bsin(pSprite->ang); ///assert(pSprite->type >= kDudeBase && pSprite->type < kDudeMax); if (!(pSprite->type >= kDudeBase && pSprite->type < kDudeMax)) { Printf(PRINT_HIGH, "pSprite->type >= kDudeBase && pSprite->type < kDudeMax"); @@ -69,7 +69,7 @@ void houndBiteSeqCallback(int, DBloodActor* actor) void houndBurnSeqCallback(int, DBloodActor* actor) { spritetype* pSprite = &actor->s(); - actFireMissile(actor, 0, 0, CosScale16(pSprite->ang), SinScale16(pSprite->ang), 0, kMissileFlameHound); + actFireMissile(actor, 0, 0, CosScale16(pSprite->ang), bsin(pSprite->ang), 0, kMissileFlameHound); } static void houndThinkSearch(DBloodActor* actor) diff --git a/source/games/blood/src/airat.cpp b/source/games/blood/src/airat.cpp index 3e3bc72e1..e6bbefa5a 100644 --- a/source/games/blood/src/airat.cpp +++ b/source/games/blood/src/airat.cpp @@ -47,7 +47,7 @@ void ratBiteSeqCallback(int, DBloodActor* actor) XSPRITE* pXSprite = &actor->x(); spritetype* pSprite = &actor->s(); int dx = CosScale16(pSprite->ang); - int dy = SinScale16(pSprite->ang); + int dy = bsin(pSprite->ang); assert(pSprite->type >= kDudeBase && pSprite->type < kDudeMax); if (!actor->ValidateTarget(__FUNCTION__)) return; spritetype* pTarget = &actor->GetTarget()->s(); diff --git a/source/games/blood/src/aispid.cpp b/source/games/blood/src/aispid.cpp index f7416c408..74df53bb5 100644 --- a/source/games/blood/src/aispid.cpp +++ b/source/games/blood/src/aispid.cpp @@ -66,7 +66,7 @@ void SpidBiteSeqCallback(int, DBloodActor* actor) XSPRITE* pXSprite = &actor->x(); spritetype* pSprite = &actor->s(); int dx = CosScale16(pSprite->ang); - int dy = SinScale16(pSprite->ang); + int dy = bsin(pSprite->ang); dx += Random2(2000); dy += Random2(2000); int dz = Random2(2000); @@ -118,7 +118,7 @@ void SpidJumpSeqCallback(int, DBloodActor* actor) XSPRITE* pXSprite = &actor->x(); spritetype* pSprite = &actor->s(); int dx = CosScale16(pSprite->ang); - int dy = SinScale16(pSprite->ang); + int dy = bsin(pSprite->ang); dx += Random2(200); dy += Random2(200); int dz = Random2(200); diff --git a/source/games/blood/src/aitchern.cpp b/source/games/blood/src/aitchern.cpp index 8bd0f30e9..9174b595f 100644 --- a/source/games/blood/src/aitchern.cpp +++ b/source/games/blood/src/aitchern.cpp @@ -75,7 +75,7 @@ void sub_71BD4(int, DBloodActor* actor) TARGETTRACK tt = { 0x10000, 0x10000, 0x100, 0x55, 0x100000 }; Aim aim; aim.dx = CosScale16(pSprite->ang); - aim.dy = SinScale16(pSprite->ang); + aim.dy = bsin(pSprite->ang); aim.dz = actor->dudeSlope; int nClosest = 0x7fffffff; BloodStatIterator it(kStatDude); @@ -120,7 +120,7 @@ void sub_71BD4(int, DBloodActor* actor) { nClosest = nDist2; aim.dx = CosScale16(nAngle); - aim.dy = SinScale16(nAngle); + aim.dy = bsin(nAngle); aim.dz = DivScale(tz, nDist, 10); } else @@ -142,7 +142,7 @@ void sub_720AC(int, DBloodActor* actor) int height = pSprite->yrepeat * pDudeInfo->eyeHeight; int ax, ay, az; ax = CosScale16(pSprite->ang); - ay = SinScale16(pSprite->ang); + ay = bsin(pSprite->ang); int x = pSprite->x; int y = pSprite->y; int z = height; @@ -195,7 +195,7 @@ void sub_720AC(int, DBloodActor* actor) { nClosest = nDist2; aim.dx = CosScale16(nAngle); - aim.dy = SinScale16(nAngle); + aim.dy = bsin(nAngle); aim.dz = DivScale(tz, nDist, 10); } else diff --git a/source/games/blood/src/aiunicult.cpp b/source/games/blood/src/aiunicult.cpp index df85c17fd..b34d5cce8 100644 --- a/source/games/blood/src/aiunicult.cpp +++ b/source/games/blood/src/aiunicult.cpp @@ -151,7 +151,7 @@ static bool genDudeAdjustSlope(DBloodActor* actor, int dist, int weaponType, int for (int i = -8191; i < 8192; i += by) { - HitScan(pSprite, pSprite->z, CosScale16(pSprite->ang), SinScale16(pSprite->ang), i, clipMask, dist); + HitScan(pSprite, pSprite->z, CosScale16(pSprite->ang), bsin(pSprite->ang), i, clipMask, dist); if (!fStart && actor->GetTarget() == gHitInfo.hitactor) fStart = i; else if (fStart && actor->GetTarget() != gHitInfo.hitactor) { @@ -214,7 +214,7 @@ void punchCallback(int, DBloodActor* actor) nZOffset2 = getDudeInfo(pTarget->type)->eyeHeight * pTarget->yrepeat << 2; int dx = CosScale16(pSprite->ang); - int dy = SinScale16(pSprite->ang); + int dy = bsin(pSprite->ang); int dz = nZOffset1 - nZOffset2; if (!playGenDudeSound(actor, kGenDudeSndAttackMelee)) @@ -247,7 +247,7 @@ void genDudeAttack1(int, DBloodActor* actor) if (pExtra->weaponType == kGenDudeWeaponHitscan) { - dx = CosScale16(pSprite->ang); dy = SinScale16(pSprite->ang); dz = actor->dudeSlope; + dx = CosScale16(pSprite->ang); dy = bsin(pSprite->ang); dz = actor->dudeSlope; // dispersal modifiers here in case if non-melee enemy if (!dudeIsMelee(actor)) { @@ -285,7 +285,7 @@ void genDudeAttack1(int, DBloodActor* actor) } else if (pExtra->weaponType == kGenDudeWeaponMissile) { - dx = CosScale16(pSprite->ang); dy = SinScale16(pSprite->ang); dz = actor->dudeSlope; + dx = CosScale16(pSprite->ang); dy = bsin(pSprite->ang); dz = actor->dudeSlope; // dispersal modifiers here dx += Random3(dispersion); dy += Random3(dispersion); dz += Random3(dispersion >> 1); @@ -778,9 +778,9 @@ static void unicultThinkChase(DBloodActor* actor) { int objDist = -1; int targetDist = -1; int hit = -1; if (weaponType == kGenDudeWeaponHitscan) - hit = HitScan(pSprite, pSprite->z, CosScale16(pSprite->ang), SinScale16(pSprite->ang), actor->dudeSlope, CLIPMASK1, dist); + hit = HitScan(pSprite, pSprite->z, CosScale16(pSprite->ang), bsin(pSprite->ang), actor->dudeSlope, CLIPMASK1, dist); else if (weaponType == kGenDudeWeaponMissile) - hit = HitScan(pSprite, pSprite->z, CosScale16(pSprite->ang), SinScale16(pSprite->ang), actor->dudeSlope, CLIPMASK0, dist); + hit = HitScan(pSprite, pSprite->z, CosScale16(pSprite->ang), bsin(pSprite->ang), actor->dudeSlope, CLIPMASK0, dist); if (hit >= 0) { @@ -902,7 +902,7 @@ static void unicultThinkChase(DBloodActor* actor) else if (weaponType == kGenDudeWeaponHitscan && hscn) { if (genDudeAdjustSlope(actor, dist, weaponType)) break; - VectorScan(pSprite, 0, 0, CosScale16(pSprite->ang), SinScale16(pSprite->ang), actor->dudeSlope, dist, 1); + VectorScan(pSprite, 0, 0, CosScale16(pSprite->ang), bsin(pSprite->ang), actor->dudeSlope, dist, 1); if (actor == gHitInfo.hitactor) break; bool immune = nnExtIsImmune(pHSprite, gVectorData[curWeapon].dmgType); @@ -962,7 +962,7 @@ static void unicultThinkChase(DBloodActor* actor) if (hit == 4 && weaponType == kGenDudeWeaponHitscan && hscn) { bool masked = (pHWall->cstat & CSTAT_WALL_MASKED); - if (masked) VectorScan(pSprite, 0, 0, CosScale16(pSprite->ang), SinScale16(pSprite->ang), actor->dudeSlope, dist, 1); + if (masked) VectorScan(pSprite, 0, 0, CosScale16(pSprite->ang), bsin(pSprite->ang), actor->dudeSlope, dist, 1); //viewSetSystemMessage("WALL VHIT: %d", gHitInfo.hitwall); if ((actor != gHitInfo.hitactor) && (pHWall->type != kWallGib || !masked || pXHWall == NULL || !pXHWall->triggerVector || pXHWall->locked)) @@ -1875,7 +1875,7 @@ void dudeLeechOperate(DBloodActor* actor, const EVENT& event) int angBak = pSprite->ang; pSprite->ang = getangle(x - pSprite->x, y - pSprite->y); int dx = CosScale16(pSprite->ang); - int dy = SinScale16(pSprite->ang); + int dy = bsin(pSprite->ang); int tz = pTarget->z - (pTarget->yrepeat * pDudeInfo->aimHeight) * 4; int dz = DivScale(tz - top - 256, nDist, 10); int nMissileType = kMissileLifeLeechAltNormal + (pXSprite->data3 ? 1 : 0); diff --git a/source/games/blood/src/aizomba.cpp b/source/games/blood/src/aizomba.cpp index 84bc81042..1f35038f6 100644 --- a/source/games/blood/src/aizomba.cpp +++ b/source/games/blood/src/aizomba.cpp @@ -74,7 +74,7 @@ void HackSeqCallback(int, DBloodActor* actor) int height2 = (pTarget->yrepeat * pDudeInfoT->eyeHeight) << 2; int dz = height - height2; int dx = CosScale16(nAngle); - int dy = SinScale16(nAngle); + int dy = bsin(nAngle); sfxPlay3DSound(pSprite, 1101, 1, 0); actFireVector(actor, 0, 0, dx, dy, dz, kVectorAxe); } diff --git a/source/games/blood/src/aizombf.cpp b/source/games/blood/src/aizombf.cpp index 2dcf412d8..634c50b35 100644 --- a/source/games/blood/src/aizombf.cpp +++ b/source/games/blood/src/aizombf.cpp @@ -58,7 +58,7 @@ void zombfHackSeqCallback(int, DBloodActor* actor) int height = (pDudeInfo->eyeHeight * pSprite->yrepeat); DUDEINFO* pDudeInfoT = getDudeInfo(pTarget->type); int height2 = (pDudeInfoT->eyeHeight * pTarget->yrepeat); - actFireVector(actor, 0, 0, CosScale16(pSprite->ang), SinScale16(pSprite->ang), height - height2, kVectorCleaver); + actFireVector(actor, 0, 0, CosScale16(pSprite->ang), bsin(pSprite->ang), height - height2, kVectorCleaver); } void PukeSeqCallback(int, DBloodActor* actor) @@ -75,7 +75,7 @@ void PukeSeqCallback(int, DBloodActor* actor) int ty = pXSprite->targetY - pSprite->y; int nAngle = getangle(tx, ty); int dx = CosScale16(nAngle); - int dy = SinScale16(nAngle); + int dy = bsin(nAngle); sfxPlay3DSound(pSprite, 1203, 1, 0); actFireMissile(actor, 0, -(height - height2), dx, dy, 0, kMissilePukeGreen); } @@ -83,7 +83,7 @@ void PukeSeqCallback(int, DBloodActor* actor) void ThrowSeqCallback(int, DBloodActor* actor) { spritetype* pSprite = &actor->s(); - actFireMissile(actor, 0, -getDudeInfo(pSprite->type)->eyeHeight, CosScale16(pSprite->ang), SinScale16(pSprite->ang), 0, kMissileButcherKnife); + actFireMissile(actor, 0, -getDudeInfo(pSprite->type)->eyeHeight, CosScale16(pSprite->ang), bsin(pSprite->ang), 0, kMissileButcherKnife); } static void zombfThinkSearch(DBloodActor* actor) diff --git a/source/games/blood/src/misc.h b/source/games/blood/src/misc.h index f889ce817..11269bb69 100644 --- a/source/games/blood/src/misc.h +++ b/source/games/blood/src/misc.h @@ -83,11 +83,6 @@ inline int Cos(int ang) return costable[ang & 2047]; } -inline int SinScale16(int ang) -{ - return FixedToInt(costable[(ang - 512) & 2047]); -} - inline int CosScale16(int ang) { return FixedToInt(costable[ang & 2047]); diff --git a/source/games/blood/src/nnexts.cpp b/source/games/blood/src/nnexts.cpp index 0d22ce855..02923fa6b 100644 --- a/source/games/blood/src/nnexts.cpp +++ b/source/games/blood/src/nnexts.cpp @@ -3982,7 +3982,7 @@ bool condCheckSprite(XSPRITE* pXCond, int cmpOp, bool PUSH) { if ((pPlayer = getPlayerById(pSpr->type)) != NULL) var = HitScan(pSpr, pPlayer->zWeapon, pPlayer->aim.dx, pPlayer->aim.dy, pPlayer->aim.dz, arg1, arg3 << 1); else if (IsDudeSprite(pSpr)) - var = HitScan(pSpr, pSpr->z, CosScale16(pSpr->ang), SinScale16(pSpr->ang), (!xspriRangeIsFine(pSpr->extra)) ? 0 : spractor->dudeSlope, arg1, arg3 << 1); + var = HitScan(pSpr, pSpr->z, CosScale16(pSpr->ang), bsin(pSpr->ang), (!xspriRangeIsFine(pSpr->extra)) ? 0 : spractor->dudeSlope, arg1, arg3 << 1); else if ((var2 & CSTAT_SPRITE_ALIGNMENT_MASK) == CSTAT_SPRITE_ALIGNMENT_FLOOR) { var3 = (var2 & 0x0008) ? 0x10000 << 1 : -(0x10000 << 1); @@ -3990,7 +3990,7 @@ bool condCheckSprite(XSPRITE* pXCond, int cmpOp, bool PUSH) { } else { - var = HitScan(pSpr, pSpr->z, CosScale16(pSpr->ang), SinScale16(pSpr->ang), 0, arg1, arg3 << 1); + var = HitScan(pSpr, pSpr->z, CosScale16(pSpr->ang), bsin(pSpr->ang), 0, arg1, arg3 << 1); } @@ -5533,7 +5533,7 @@ void useUniMissileGen(XSPRITE* pXSource, spritetype* pSprite) { else dz = -0x4000; } else { dx = CosScale16(pSprite->ang); - dy = SinScale16(pSprite->ang); + dy = bsin(pSprite->ang); dz = pXSource->data3 << 6; // add slope controlling if (dz > 0x10000) dz = 0x10000; else if (dz < -0x10000) dz = -0x10000; diff --git a/source/games/blood/src/player.cpp b/source/games/blood/src/player.cpp index 2e652d890..0df85dfc2 100644 --- a/source/games/blood/src/player.cpp +++ b/source/games/blood/src/player.cpp @@ -1246,7 +1246,7 @@ int ActionScan(PLAYER *pPlayer, int *a2, int *a3) *a3 = 0; spritetype *pSprite = pPlayer->pSprite; int x = CosScale16(pSprite->ang); - int y = SinScale16(pSprite->ang); + int y = bsin(pSprite->ang); int z = pPlayer->slope; int hit = HitScan(pSprite, pPlayer->zView, x, y, z, 0x10000040, 128); int hitDist = approxDist(pSprite->x-gHitInfo.hitx, pSprite->y-gHitInfo.hity)>>4; @@ -1580,7 +1580,7 @@ void ProcessInput(PLAYER *pPlayer) pSprite2->ang = (pPlayer->pSprite->ang+1024)&2047; int nSprite = pPlayer->pSprite->index; int x = CosScale16(pPlayer->pSprite->ang); - int y = SinScale16(pPlayer->pSprite->ang); + int y = bsin(pPlayer->pSprite->ang); xvel[pSprite2->index] = xvel[nSprite] + MulScale(0x155555, x, 14); yvel[pSprite2->index] = yvel[nSprite] + MulScale(0x155555, y, 14); zvel[pSprite2->index] = zvel[nSprite]; @@ -2123,9 +2123,9 @@ void voodooTarget(PLAYER *pPlayer) for (int i = 0; i < 4; i++) { int ang1 = (pPlayer->voodooVar1+pPlayer->vodooVar2)&2047; - actFireVector(actor, 0, dz, CosScale16(ang1), SinScale16(ang1), v4, kVectorVoodoo10); + actFireVector(actor, 0, dz, CosScale16(ang1), bsin(ang1), v4, kVectorVoodoo10); int ang2 = (pPlayer->voodooVar1+2048-pPlayer->vodooVar2)&2047; - actFireVector(actor, 0, dz, CosScale16(ang2), SinScale16(ang2), v4, kVectorVoodoo10); + actFireVector(actor, 0, dz, CosScale16(ang2), bsin(ang2), v4, kVectorVoodoo10); } pPlayer->voodooTargets = ClipLow(pPlayer->voodooTargets-1, 0); } diff --git a/source/games/blood/src/triggers.cpp b/source/games/blood/src/triggers.cpp index 43323631f..ab7773681 100644 --- a/source/games/blood/src/triggers.cpp +++ b/source/games/blood/src/triggers.cpp @@ -249,7 +249,7 @@ void LifeLeechOperate(spritetype *pSprite, XSPRITE *pXSprite, EVENT event) int angBak = pSprite->ang; pSprite->ang = getangle(x-pSprite->x, y-pSprite->y); int dx = CosScale16(pSprite->ang); - int dy = SinScale16(pSprite->ang); + int dy = bsin(pSprite->ang); int tz = pTarget->z - (pTarget->yrepeat * pDudeInfo->aimHeight) * 4; int dz = DivScale(tz - top - 256, nDist, 10); int nMissileType = kMissileLifeLeechAltNormal + (pXSprite->data3 ? 1 : 0); @@ -2258,7 +2258,7 @@ void FireballTrapSeqCallback(int, DBloodActor* actor) if (pSprite->cstat&32) actFireMissile(actor, 0, 0, 0, 0, (pSprite->cstat&8) ? 0x4000 : -0x4000, kMissileFireball); else - actFireMissile(actor, 0, 0, CosScale16(pSprite->ang), SinScale16(pSprite->ang), 0, kMissileFireball); + actFireMissile(actor, 0, 0, CosScale16(pSprite->ang), bsin(pSprite->ang), 0, kMissileFireball); } @@ -2275,7 +2275,7 @@ void MGunFireSeqCallback(int, DBloodActor* actor) evPostActor(&bloodActors[pXSprite->reference], 1, kCmdOff); } int dx = CosScale16(pSprite->ang)+Random2(1000); - int dy = SinScale16(pSprite->ang)+Random2(1000); + int dy = bsin(pSprite->ang)+Random2(1000); int dz = Random2(1000); actFireVector(actor, 0, 0, dx, dy, dz, kVectorBullet); sfxPlay3DSound(pSprite, 359, -1, 0); diff --git a/source/games/blood/src/weapon.cpp b/source/games/blood/src/weapon.cpp index 64c2d955e..bd5871c24 100644 --- a/source/games/blood/src/weapon.cpp +++ b/source/games/blood/src/weapon.cpp @@ -354,7 +354,7 @@ void UpdateAimVector(PLAYER * pPlayer) int z = pPlayer->zWeapon; Aim aim; aim.dx = CosScale16(pPSprite->ang); - aim.dy = SinScale16(pPSprite->ang); + aim.dy = bsin(pPSprite->ang); aim.dz = pPlayer->slope; WEAPONTRACK *pWeaponTrack = &gWeaponTrack[pPlayer->curWeapon]; int nTarget = -1; @@ -416,7 +416,7 @@ void UpdateAimVector(PLAYER * pPlayer) { nClosest = nDist2; aim.dx = CosScale16(angle); - aim.dy = SinScale16(angle); + aim.dy = bsin(angle); aim.dz = DivScale(dzCenter, nDist, 10); nTarget = nSprite; } @@ -465,7 +465,7 @@ void UpdateAimVector(PLAYER * pPlayer) { nClosest = nDist2; aim.dx = CosScale16(angle); - aim.dy = SinScale16(angle); + aim.dy = bsin(angle); aim.dz = DivScale(dz, nDist, 10); nTarget = nSprite; } @@ -1296,7 +1296,7 @@ void FireSpread(int nTrigger, PLAYER *pPlayer) Aim *aim = &pPlayer->aim; int angle = (getangle(aim->dx, aim->dy)+((112*(nTrigger-1))/14-56))&2047; int dx = CosScale16(angle); - int dy = SinScale16(angle); + int dy = bsin(angle); sfxPlay3DSound(pPlayer->pSprite, 431, -1, 0); int r1, r2, r3; r1 = Random3(300); @@ -1318,7 +1318,7 @@ void AltFireSpread(int nTrigger, PLAYER *pPlayer) Aim *aim = &pPlayer->aim; int angle = (getangle(aim->dx, aim->dy)+((112*(nTrigger-1))/14-56))&2047; int dx = CosScale16(angle); - int dy = SinScale16(angle); + int dy = bsin(angle); sfxPlay3DSound(pPlayer->pSprite, 431, -1, 0); int r1, r2, r3; r1 = Random3(300); @@ -1348,7 +1348,7 @@ void AltFireSpread2(int nTrigger, PLAYER *pPlayer) Aim *aim = &pPlayer->aim; int angle = (getangle(aim->dx, aim->dy)+((112*(nTrigger-1))/14-56))&2047; int dx = CosScale16(angle); - int dy = SinScale16(angle); + int dy = bsin(angle); sfxPlay3DSound(pPlayer->pSprite, 431, -1, 0); if (powerupCheck(pPlayer, kPwUpTwoGuns) && checkAmmo2(pPlayer, 3, 2)) {