From 7d9f868e4c2169a108b9843fa2090971db65c9bb Mon Sep 17 00:00:00 2001 From: Mitchell Richters Date: Mon, 4 Jan 2021 21:40:08 +1100 Subject: [PATCH] - Replace `dmulscale##()` calls with `DMulScale()` from common. * Regex for reference: dmulscale([0-9]+)\((.+)(\)+) --- source/blood/src/actor.cpp | 2 +- source/blood/src/ai.cpp | 10 ++--- source/blood/src/aibat.cpp | 40 ++++++++--------- source/blood/src/aibeast.cpp | 24 +++++----- source/blood/src/aiboneel.cpp | 40 ++++++++--------- source/blood/src/aicaleb.cpp | 24 +++++----- source/blood/src/aigarg.cpp | 48 ++++++++++---------- source/blood/src/aighost.cpp | 48 ++++++++++---------- source/blood/src/aigilbst.cpp | 24 +++++----- source/blood/src/aiunicult.cpp | 10 ++--- source/build/include/pragmas.h | 9 +--- source/build/src/clip.cpp | 12 ++--- source/build/src/engine.cpp | 68 ++++++++++++++--------------- source/build/src/engine_priv.h | 4 +- source/build/src/polymost.cpp | 2 +- source/core/automap.cpp | 32 +++++++------- source/games/duke/src/actors.cpp | 2 +- source/games/duke/src/game_misc.cpp | 36 +++++++-------- source/sw/src/sprite.cpp | 4 +- source/sw/src/weapon.cpp | 4 +- 20 files changed, 218 insertions(+), 225 deletions(-) diff --git a/source/blood/src/actor.cpp b/source/blood/src/actor.cpp index bef8af83e..24b215332 100644 --- a/source/blood/src/actor.cpp +++ b/source/blood/src/actor.cpp @@ -2606,7 +2606,7 @@ int actWallBounceVector(int *x, int *y, int nWall, int a4) { int wx, wy; GetWallNormal(nWall, &wx, &wy); - int t = dmulscale16(*x, wx, *y, wy); + int t = DMulScale(*x, wx, *y, wy, 16); int t2 = mulscale16r(t, a4+0x10000); *x -= mulscale16(wx, t2); *y -= mulscale16(wy, t2); diff --git a/source/blood/src/ai.cpp b/source/blood/src/ai.cpp index 50b4bf4f4..e021ed66a 100644 --- a/source/blood/src/ai.cpp +++ b/source/blood/src/ai.cpp @@ -223,7 +223,7 @@ void aiChooseDirection(spritetype *pSprite, XSPRITE *pXSprite, int a3) int nSin = Sin(pSprite->ang); int dx = xvel[nSprite]; int dy = yvel[nSprite]; - int t1 = dmulscale30(dx, nCos, dy, nSin); + int t1 = DMulScale(dx, nCos, dy, nSin, 30); int vsi = ((t1*15)>>12) / 2; int v8 = 341; if (vc < 0) @@ -297,15 +297,15 @@ void aiMoveDodge(DBloodActor* actor) int nSin = Sin(pSprite->ang); int dx = actor->xvel(); int dy = actor->yvel(); - int t1 = dmulscale30(dx, nCos, dy, nSin); - int t2 = dmulscale30(dx, nSin, -dy, nCos); + int t1 = DMulScale(dx, nCos, dy, nSin, 30); + int t2 = DMulScale(dx, nSin, -dy, nCos, 30); if (pXSprite->dodgeDir > 0) t2 += pDudeInfo->sideSpeed; else t2 -= pDudeInfo->sideSpeed; - actor->xvel() = dmulscale30(t1, nCos, t2, nSin); - actor->yvel() = dmulscale30(t1, nSin, -t2, nCos); + actor->xvel() = DMulScale(t1, nCos, t2, nSin, 30); + actor->yvel() = DMulScale(t1, nSin, -t2, nCos, 30); } } diff --git a/source/blood/src/aibat.cpp b/source/blood/src/aibat.cpp index 590521ba5..641d4c75e 100644 --- a/source/blood/src/aibat.cpp +++ b/source/blood/src/aibat.cpp @@ -227,15 +227,15 @@ static void batMoveDodgeUp(DBloodActor* actor) int nSin = Sin(pSprite->ang); int dx = actor->xvel(); int dy = actor->yvel(); - int t1 = dmulscale30(dx, nCos, dy, nSin); - int t2 = dmulscale30(dx, nSin, -dy, nCos); + int t1 = DMulScale(dx, nCos, dy, nSin, 30); + int t2 = DMulScale(dx, nSin, -dy, nCos, 30); if (pXSprite->dodgeDir > 0) t2 += pDudeInfo->sideSpeed; else t2 -= pDudeInfo->sideSpeed; - actor->xvel() = dmulscale30(t1, nCos, t2, nSin); - actor->yvel() = dmulscale30(t1, nSin, -t2, nCos); + actor->xvel() = DMulScale(t1, nCos, t2, nSin, 30); + actor->yvel() = DMulScale(t1, nSin, -t2, nCos, 30); actor->zvel() = -0x52aaa; } @@ -254,15 +254,15 @@ static void batMoveDodgeDown(DBloodActor* actor) int nSin = Sin(pSprite->ang); int dx = actor->xvel(); int dy = actor->yvel(); - int t1 = dmulscale30(dx, nCos, dy, nSin); - int t2 = dmulscale30(dx, nSin, -dy, nCos); + int t1 = DMulScale(dx, nCos, dy, nSin, 30); + int t2 = DMulScale(dx, nSin, -dy, nCos, 30); if (pXSprite->dodgeDir > 0) t2 += pDudeInfo->sideSpeed; else t2 -= pDudeInfo->sideSpeed; - actor->xvel() = dmulscale30(t1, nCos, t2, nSin); - actor->yvel() = dmulscale30(t1, nSin, -t2, nCos); + actor->xvel() = DMulScale(t1, nCos, t2, nSin, 30); + actor->yvel() = DMulScale(t1, nSin, -t2, nCos, 30); actor->zvel() = 0x44444; } @@ -351,14 +351,14 @@ static void batMoveForward(DBloodActor* actor) int nSin = Sin(pSprite->ang); int vx = actor->xvel(); int vy = actor->yvel(); - int t1 = dmulscale30(vx, nCos, vy, nSin); - int t2 = dmulscale30(vx, nSin, -vy, nCos); + int t1 = DMulScale(vx, nCos, vy, nSin, 30); + int t2 = DMulScale(vx, nSin, -vy, nCos, 30); if (pXSprite->target == -1) t1 += nAccel; else t1 += nAccel>>1; - actor->xvel() = dmulscale30(t1, nCos, t2, nSin); - actor->yvel() = dmulscale30(t1, nSin, -t2, nCos); + actor->xvel() = DMulScale(t1, nCos, t2, nSin, 30); + actor->yvel() = DMulScale(t1, nSin, -t2, nCos, 30); } static void batMoveSwoop(DBloodActor* actor) @@ -385,11 +385,11 @@ static void batMoveSwoop(DBloodActor* actor) int nSin = Sin(pSprite->ang); int vx = actor->xvel(); int vy = actor->yvel(); - int t1 = dmulscale30(vx, nCos, vy, nSin); - int t2 = dmulscale30(vx, nSin, -vy, nCos); + int t1 = DMulScale(vx, nCos, vy, nSin, 30); + int t2 = DMulScale(vx, nSin, -vy, nCos, 30); t1 += nAccel>>1; - actor->xvel() = dmulscale30(t1, nCos, t2, nSin); - actor->yvel() = dmulscale30(t1, nSin, -t2, nCos); + actor->xvel() = DMulScale(t1, nCos, t2, nSin, 30); + actor->yvel() = DMulScale(t1, nSin, -t2, nCos, 30); actor->zvel() = 0x44444; } @@ -417,11 +417,11 @@ static void batMoveFly(DBloodActor* actor) int nSin = Sin(pSprite->ang); int vx = actor->xvel(); int vy = actor->yvel(); - int t1 = dmulscale30(vx, nCos, vy, nSin); - int t2 = dmulscale30(vx, nSin, -vy, nCos); + int t1 = DMulScale(vx, nCos, vy, nSin, 30); + int t2 = DMulScale(vx, nSin, -vy, nCos, 30); t1 += nAccel>>1; - actor->xvel() = dmulscale30(t1, nCos, t2, nSin); - actor->yvel() = dmulscale30(t1, nSin, -t2, nCos); + actor->xvel() = DMulScale(t1, nCos, t2, nSin, 30); + actor->yvel() = DMulScale(t1, nSin, -t2, nCos, 30); actor->zvel() = -0x2d555; } diff --git a/source/blood/src/aibeast.cpp b/source/blood/src/aibeast.cpp index f94d2ec8c..a049eb128 100644 --- a/source/blood/src/aibeast.cpp +++ b/source/blood/src/aibeast.cpp @@ -497,14 +497,14 @@ static void sub_628A0(DBloodActor* actor) int nSin = Sin(pSprite->ang); int vx = actor->xvel(); int vy = actor->yvel(); - int t1 = dmulscale30(vx, nCos, vy, nSin); - int t2 = dmulscale30(vx, nSin, -vy, nCos); + int t1 = DMulScale(vx, nCos, vy, nSin, 30); + int t2 = DMulScale(vx, nSin, -vy, nCos, 30); if (pXSprite->target == -1) t1 += nAccel; else t1 += nAccel>>2; - actor->xvel() = dmulscale30(t1, nCos, t2, nSin); - actor->yvel() = dmulscale30(t1, nSin, -t2, nCos); + actor->xvel() = DMulScale(t1, nCos, t2, nSin, 30); + actor->yvel() = DMulScale(t1, nSin, -t2, nCos, 30); } static void sub_62AE0(DBloodActor* actor) @@ -535,11 +535,11 @@ static void sub_62AE0(DBloodActor* actor) int nSin = Sin(pSprite->ang); int vx = actor->xvel(); int vy = actor->yvel(); - int t1 = dmulscale30(vx, nCos, vy, nSin); - int t2 = dmulscale30(vx, nSin, -vy, nCos); + int t1 = DMulScale(vx, nCos, vy, nSin, 30); + int t2 = DMulScale(vx, nSin, -vy, nCos, 30); t1 += nAccel; - actor->xvel() = dmulscale30(t1, nCos, t2, nSin); - actor->yvel() = dmulscale30(t1, nSin, -t2, nCos); + actor->xvel() = DMulScale(t1, nCos, t2, nSin, 30); + actor->yvel() = DMulScale(t1, nSin, -t2, nCos, 30); actor->zvel() = -dz; } @@ -572,11 +572,11 @@ static void sub_62D7C(DBloodActor* actor) int nSin = Sin(pSprite->ang); int vx = actor->xvel(); int vy = actor->yvel(); - int t1 = dmulscale30(vx, nCos, vy, nSin); - int t2 = dmulscale30(vx, nSin, -vy, nCos); + int t1 = DMulScale(vx, nCos, vy, nSin, 30); + int t2 = DMulScale(vx, nSin, -vy, nCos, 30); t1 += nAccel>>1; - actor->xvel() = dmulscale30(t1, nCos, t2, nSin); - actor->yvel() = dmulscale30(t1, nSin, -t2, nCos); + actor->xvel() = DMulScale(t1, nCos, t2, nSin, 30); + actor->yvel() = DMulScale(t1, nSin, -t2, nCos, 30); actor->zvel() = dz; } diff --git a/source/blood/src/aiboneel.cpp b/source/blood/src/aiboneel.cpp index 6a6d31518..5218d5f9e 100644 --- a/source/blood/src/aiboneel.cpp +++ b/source/blood/src/aiboneel.cpp @@ -240,15 +240,15 @@ static void eelMoveDodgeUp(DBloodActor* actor) int nSin = Sin(pSprite->ang); int dx = actor->xvel(); int dy = actor->yvel(); - int t1 = dmulscale30(dx, nCos, dy, nSin); - int t2 = dmulscale30(dx, nSin, -dy, nCos); + int t1 = DMulScale(dx, nCos, dy, nSin, 30); + int t2 = DMulScale(dx, nSin, -dy, nCos, 30); if (pXSprite->dodgeDir > 0) t2 += pDudeInfo->sideSpeed; else t2 -= pDudeInfo->sideSpeed; - actor->xvel() = dmulscale30(t1, nCos, t2, nSin); - actor->yvel() = dmulscale30(t1, nSin, -t2, nCos); + actor->xvel() = DMulScale(t1, nCos, t2, nSin, 30); + actor->yvel() = DMulScale(t1, nSin, -t2, nCos, 30); actor->zvel() = -0x8000; } @@ -267,15 +267,15 @@ static void eelMoveDodgeDown(DBloodActor* actor) int nSin = Sin(pSprite->ang); int dx = actor->xvel(); int dy = actor->yvel(); - int t1 = dmulscale30(dx, nCos, dy, nSin); - int t2 = dmulscale30(dx, nSin, -dy, nCos); + int t1 = DMulScale(dx, nCos, dy, nSin, 30); + int t2 = DMulScale(dx, nSin, -dy, nCos, 30); if (pXSprite->dodgeDir > 0) t2 += pDudeInfo->sideSpeed; else t2 -= pDudeInfo->sideSpeed; - actor->xvel() = dmulscale30(t1, nCos, t2, nSin); - actor->yvel() = dmulscale30(t1, nSin, -t2, nCos); + actor->xvel() = DMulScale(t1, nCos, t2, nSin, 30); + actor->yvel() = DMulScale(t1, nSin, -t2, nCos, 30); actor->zvel() = 0x44444; } @@ -360,14 +360,14 @@ static void eelMoveForward(DBloodActor* actor) int nSin = Sin(pSprite->ang); int vx = actor->xvel(); int vy = actor->yvel(); - int t1 = dmulscale30(vx, nCos, vy, nSin); - int t2 = dmulscale30(vx, nSin, -vy, nCos); + int t1 = DMulScale(vx, nCos, vy, nSin, 30); + int t2 = DMulScale(vx, nSin, -vy, nCos, 30); if (pXSprite->target == -1) t1 += nAccel; else t1 += nAccel>>1; - actor->xvel() = dmulscale30(t1, nCos, t2, nSin); - actor->yvel() = dmulscale30(t1, nSin, -t2, nCos); + actor->xvel() = DMulScale(t1, nCos, t2, nSin, 30); + actor->yvel() = DMulScale(t1, nSin, -t2, nCos, 30); } static void eelMoveSwoop(DBloodActor* actor) @@ -391,11 +391,11 @@ static void eelMoveSwoop(DBloodActor* actor) int nSin = Sin(pSprite->ang); int vx = actor->xvel(); int vy = actor->yvel(); - int t1 = dmulscale30(vx, nCos, vy, nSin); - int t2 = dmulscale30(vx, nSin, -vy, nCos); + int t1 = DMulScale(vx, nCos, vy, nSin, 30); + int t2 = DMulScale(vx, nSin, -vy, nCos, 30); t1 += nAccel>>1; - actor->xvel() = dmulscale30(t1, nCos, t2, nSin); - actor->yvel() = dmulscale30(t1, nSin, -t2, nCos); + actor->xvel() = DMulScale(t1, nCos, t2, nSin, 30); + actor->yvel() = DMulScale(t1, nSin, -t2, nCos, 30); actor->zvel() = 0x22222; } @@ -420,11 +420,11 @@ static void eelMoveAscend(DBloodActor* actor) int nSin = Sin(pSprite->ang); int vx = actor->xvel(); int vy = actor->yvel(); - int t1 = dmulscale30(vx, nCos, vy, nSin); - int t2 = dmulscale30(vx, nSin, -vy, nCos); + int t1 = DMulScale(vx, nCos, vy, nSin, 30); + int t2 = DMulScale(vx, nSin, -vy, nCos, 30); t1 += nAccel>>1; - actor->xvel() = dmulscale30(t1, nCos, t2, nSin); - actor->yvel() = dmulscale30(t1, nSin, -t2, nCos); + actor->xvel() = DMulScale(t1, nCos, t2, nSin, 30); + actor->yvel() = DMulScale(t1, nSin, -t2, nCos, 30); actor->zvel() = -0x8000; } diff --git a/source/blood/src/aicaleb.cpp b/source/blood/src/aicaleb.cpp index 4f6609533..90379be8b 100644 --- a/source/blood/src/aicaleb.cpp +++ b/source/blood/src/aicaleb.cpp @@ -339,14 +339,14 @@ static void sub_65D04(DBloodActor* actor) int nSin = Sin(pSprite->ang); int vx = xvel[nSprite]; int vy = yvel[nSprite]; - int t1 = dmulscale30(vx, nCos, vy, nSin); - int t2 = dmulscale30(vx, nSin, -vy, nCos); + int t1 = DMulScale(vx, nCos, vy, nSin, 30); + int t2 = DMulScale(vx, nSin, -vy, nCos, 30); if (pXSprite->target == -1) t1 += nAccel; else t1 += nAccel>>2; - xvel[nSprite] = dmulscale30(t1, nCos, t2, nSin); - yvel[nSprite] = dmulscale30(t1, nSin, -t2, nCos); + xvel[nSprite] = DMulScale(t1, nCos, t2, nSin, 30); + yvel[nSprite] = DMulScale(t1, nSin, -t2, nCos, 30); } static void sub_65F44(DBloodActor* actor) @@ -378,11 +378,11 @@ static void sub_65F44(DBloodActor* actor) int nSin = Sin(pSprite->ang); int vx = xvel[nSprite]; int vy = yvel[nSprite]; - int t1 = dmulscale30(vx, nCos, vy, nSin); - int t2 = dmulscale30(vx, nSin, -vy, nCos); + int t1 = DMulScale(vx, nCos, vy, nSin, 30); + int t2 = DMulScale(vx, nSin, -vy, nCos, 30); t1 += nAccel; - xvel[nSprite] = dmulscale30(t1, nCos, t2, nSin); - yvel[nSprite] = dmulscale30(t1, nSin, -t2, nCos); + xvel[nSprite] = DMulScale(t1, nCos, t2, nSin, 30); + yvel[nSprite] = DMulScale(t1, nSin, -t2, nCos, 30); zvel[nSprite] = -dz; } @@ -415,11 +415,11 @@ static void sub_661E0(DBloodActor* actor) int nSin = Sin(pSprite->ang); int vx = xvel[nSprite]; int vy = yvel[nSprite]; - int t1 = dmulscale30(vx, nCos, vy, nSin); - int t2 = dmulscale30(vx, nSin, -vy, nCos); + int t1 = DMulScale(vx, nCos, vy, nSin, 30); + int t2 = DMulScale(vx, nSin, -vy, nCos, 30); t1 += nAccel>>1; - xvel[nSprite] = dmulscale30(t1, nCos, t2, nSin); - yvel[nSprite] = dmulscale30(t1, nSin, -t2, nCos); + xvel[nSprite] = DMulScale(t1, nCos, t2, nSin, 30); + yvel[nSprite] = DMulScale(t1, nSin, -t2, nCos, 30); zvel[nSprite] = dz; } diff --git a/source/blood/src/aigarg.cpp b/source/blood/src/aigarg.cpp index 1d6b9014b..921ec52a2 100644 --- a/source/blood/src/aigarg.cpp +++ b/source/blood/src/aigarg.cpp @@ -311,15 +311,15 @@ static void gargMoveDodgeUp(DBloodActor* actor) int nSin = Sin(pSprite->ang); int dx = actor->xvel(); int dy = actor->yvel(); - int t1 = dmulscale30(dx, nCos, dy, nSin); - int t2 = dmulscale30(dx, nSin, -dy, nCos); + int t1 = DMulScale(dx, nCos, dy, nSin, 30); + int t2 = DMulScale(dx, nSin, -dy, nCos, 30); if (pXSprite->dodgeDir > 0) t2 += pDudeInfo->sideSpeed; else t2 -= pDudeInfo->sideSpeed; - actor->xvel() = dmulscale30(t1, nCos, t2, nSin); - actor->yvel() = dmulscale30(t1, nSin, -t2, nCos); + actor->xvel() = DMulScale(t1, nCos, t2, nSin, 30); + actor->yvel() = DMulScale(t1, nSin, -t2, nCos, 30); actor->zvel() = -0x1d555; } @@ -342,15 +342,15 @@ static void gargMoveDodgeDown(DBloodActor* actor) int nSin = Sin(pSprite->ang); int dx = actor->xvel(); int dy = actor->yvel(); - int t1 = dmulscale30(dx, nCos, dy, nSin); - int t2 = dmulscale30(dx, nSin, -dy, nCos); + int t1 = DMulScale(dx, nCos, dy, nSin, 30); + int t2 = DMulScale(dx, nSin, -dy, nCos, 30); if (pXSprite->dodgeDir > 0) t2 += pDudeInfo->sideSpeed; else t2 -= pDudeInfo->sideSpeed; - actor->xvel() = dmulscale30(t1, nCos, t2, nSin); - actor->yvel() = dmulscale30(t1, nSin, -t2, nCos); + actor->xvel() = DMulScale(t1, nCos, t2, nSin, 30); + actor->yvel() = DMulScale(t1, nSin, -t2, nCos, 30); actor->zvel() = 0x44444; } @@ -581,14 +581,14 @@ static void gargMoveForward(DBloodActor* actor) int nSin = Sin(pSprite->ang); int vx = actor->xvel(); int vy = actor->yvel(); - int t1 = dmulscale30(vx, nCos, vy, nSin); - int t2 = dmulscale30(vx, nSin, -vy, nCos); + int t1 = DMulScale(vx, nCos, vy, nSin, 30); + int t2 = DMulScale(vx, nSin, -vy, nCos, 30); if (pXSprite->target == -1) t1 += nAccel; else t1 += nAccel>>1; - actor->xvel() = dmulscale30(t1, nCos, t2, nSin); - actor->yvel() = dmulscale30(t1, nSin, -t2, nCos); + actor->xvel() = DMulScale(t1, nCos, t2, nSin, 30); + actor->yvel() = DMulScale(t1, nSin, -t2, nCos, 30); } static void gargMoveSlow(DBloodActor* actor) @@ -619,12 +619,12 @@ static void gargMoveSlow(DBloodActor* actor) int nSin = Sin(pSprite->ang); int vx = actor->xvel(); int vy = actor->yvel(); - int t1 = dmulscale30(vx, nCos, vy, nSin); - int t2 = dmulscale30(vx, nSin, -vy, nCos); + int t1 = DMulScale(vx, nCos, vy, nSin, 30); + int t2 = DMulScale(vx, nSin, -vy, nCos, 30); t1 = nAccel>>1; t2 >>= 1; - actor->xvel() = dmulscale30(t1, nCos, t2, nSin); - actor->yvel() = dmulscale30(t1, nSin, -t2, nCos); + actor->xvel() = DMulScale(t1, nCos, t2, nSin, 30); + actor->yvel() = DMulScale(t1, nSin, -t2, nCos, 30); switch (pSprite->type) { case kDudeGargoyleFlesh: actor->zvel() = 0x44444; @@ -663,11 +663,11 @@ static void gargMoveSwoop(DBloodActor* actor) int nSin = Sin(pSprite->ang); int vx = actor->xvel(); int vy = actor->yvel(); - int t1 = dmulscale30(vx, nCos, vy, nSin); - int t2 = dmulscale30(vx, nSin, -vy, nCos); + int t1 = DMulScale(vx, nCos, vy, nSin, 30); + int t2 = DMulScale(vx, nSin, -vy, nCos, 30); t1 += nAccel>>1; - actor->xvel() = dmulscale30(t1, nCos, t2, nSin); - actor->yvel() = dmulscale30(t1, nSin, -t2, nCos); + actor->xvel() = DMulScale(t1, nCos, t2, nSin, 30); + actor->yvel() = DMulScale(t1, nSin, -t2, nCos, 30); switch (pSprite->type) { case kDudeGargoyleFlesh: actor->zvel() = t1; @@ -706,11 +706,11 @@ static void gargMoveFly(DBloodActor* actor) int nSin = Sin(pSprite->ang); int vx = actor->xvel(); int vy = actor->yvel(); - int t1 = dmulscale30(vx, nCos, vy, nSin); - int t2 = dmulscale30(vx, nSin, -vy, nCos); + int t1 = DMulScale(vx, nCos, vy, nSin, 30); + int t2 = DMulScale(vx, nSin, -vy, nCos, 30); t1 += nAccel>>1; - actor->xvel() = dmulscale30(t1, nCos, t2, nSin); - actor->yvel() = dmulscale30(t1, nSin, -t2, nCos); + actor->xvel() = DMulScale(t1, nCos, t2, nSin, 30); + actor->yvel() = DMulScale(t1, nSin, -t2, nCos, 30); switch (pSprite->type) { case kDudeGargoyleFlesh: actor->zvel() = -t1; diff --git a/source/blood/src/aighost.cpp b/source/blood/src/aighost.cpp index b8fe9e7d8..05cb68141 100644 --- a/source/blood/src/aighost.cpp +++ b/source/blood/src/aighost.cpp @@ -287,15 +287,15 @@ static void ghostMoveDodgeUp(DBloodActor* actor) int nSin = Sin(pSprite->ang); int dx = actor->xvel(); int dy = actor->yvel(); - int t1 = dmulscale30(dx, nCos, dy, nSin); - int t2 = dmulscale30(dx, nSin, -dy, nCos); + int t1 = DMulScale(dx, nCos, dy, nSin, 30); + int t2 = DMulScale(dx, nSin, -dy, nCos, 30); if (pXSprite->dodgeDir > 0) t2 += pDudeInfo->sideSpeed; else t2 -= pDudeInfo->sideSpeed; - actor->xvel() = dmulscale30(t1, nCos, t2, nSin); - actor->yvel() = dmulscale30(t1, nSin, -t2, nCos); + actor->xvel() = DMulScale(t1, nCos, t2, nSin, 30); + actor->yvel() = DMulScale(t1, nSin, -t2, nCos, 30); actor->zvel() = -0x1d555; } @@ -319,15 +319,15 @@ static void ghostMoveDodgeDown(DBloodActor* actor) int nSin = Sin(pSprite->ang); int dx = actor->xvel(); int dy = actor->yvel(); - int t1 = dmulscale30(dx, nCos, dy, nSin); - int t2 = dmulscale30(dx, nSin, -dy, nCos); + int t1 = DMulScale(dx, nCos, dy, nSin, 30); + int t2 = DMulScale(dx, nSin, -dy, nCos, 30); if (pXSprite->dodgeDir > 0) t2 += pDudeInfo->sideSpeed; else t2 -= pDudeInfo->sideSpeed; - actor->xvel() = dmulscale30(t1, nCos, t2, nSin); - actor->yvel() = dmulscale30(t1, nSin, -t2, nCos); + actor->xvel() = DMulScale(t1, nCos, t2, nSin, 30); + actor->yvel() = DMulScale(t1, nSin, -t2, nCos, 30); actor->zvel() = 0x44444; } @@ -472,14 +472,14 @@ static void ghostMoveForward(DBloodActor* actor) int nSin = Sin(pSprite->ang); int vx = actor->xvel(); int vy = actor->yvel(); - int t1 = dmulscale30(vx, nCos, vy, nSin); - int t2 = dmulscale30(vx, nSin, -vy, nCos); + int t1 = DMulScale(vx, nCos, vy, nSin, 30); + int t2 = DMulScale(vx, nSin, -vy, nCos, 30); if (pXSprite->target == -1) t1 += nAccel; else t1 += nAccel>>1; - actor->xvel() = dmulscale30(t1, nCos, t2, nSin); - actor->yvel() = dmulscale30(t1, nSin, -t2, nCos); + actor->xvel() = DMulScale(t1, nCos, t2, nSin, 30); + actor->yvel() = DMulScale(t1, nSin, -t2, nCos, 30); } static void ghostMoveSlow(DBloodActor* actor) @@ -510,12 +510,12 @@ static void ghostMoveSlow(DBloodActor* actor) int nSin = Sin(pSprite->ang); int vx = actor->xvel(); int vy = actor->yvel(); - int t1 = dmulscale30(vx, nCos, vy, nSin); - int t2 = dmulscale30(vx, nSin, -vy, nCos); + int t1 = DMulScale(vx, nCos, vy, nSin, 30); + int t2 = DMulScale(vx, nSin, -vy, nCos, 30); t1 = nAccel>>1; t2 >>= 1; - actor->xvel() = dmulscale30(t1, nCos, t2, nSin); - actor->yvel() = dmulscale30(t1, nSin, -t2, nCos); + actor->xvel() = DMulScale(t1, nCos, t2, nSin, 30); + actor->yvel() = DMulScale(t1, nSin, -t2, nCos, 30); switch (pSprite->type) { case kDudePhantasm: actor->zvel() = 0x44444; @@ -551,11 +551,11 @@ static void ghostMoveSwoop(DBloodActor* actor) int nSin = Sin(pSprite->ang); int vx = actor->xvel(); int vy = actor->yvel(); - int t1 = dmulscale30(vx, nCos, vy, nSin); - int t2 = dmulscale30(vx, nSin, -vy, nCos); + int t1 = DMulScale(vx, nCos, vy, nSin, 30); + int t2 = DMulScale(vx, nSin, -vy, nCos, 30); t1 += nAccel>>1; - actor->xvel() = dmulscale30(t1, nCos, t2, nSin); - actor->yvel() = dmulscale30(t1, nSin, -t2, nCos); + actor->xvel() = DMulScale(t1, nCos, t2, nSin, 30); + actor->yvel() = DMulScale(t1, nSin, -t2, nCos, 30); switch (pSprite->type) { case kDudePhantasm: actor->zvel() = t1; @@ -591,11 +591,11 @@ static void ghostMoveFly(DBloodActor* actor) int nSin = Sin(pSprite->ang); int vx = actor->xvel(); int vy = actor->yvel(); - int t1 = dmulscale30(vx, nCos, vy, nSin); - int t2 = dmulscale30(vx, nSin, -vy, nCos); + int t1 = DMulScale(vx, nCos, vy, nSin, 30); + int t2 = DMulScale(vx, nSin, -vy, nCos, 30); t1 += nAccel>>1; - actor->xvel() = dmulscale30(t1, nCos, t2, nSin); - actor->yvel() = dmulscale30(t1, nSin, -t2, nCos); + actor->xvel() = DMulScale(t1, nCos, t2, nSin, 30); + actor->yvel() = DMulScale(t1, nSin, -t2, nCos, 30); switch (pSprite->type) { case kDudePhantasm: actor->zvel() = -t1; diff --git a/source/blood/src/aigilbst.cpp b/source/blood/src/aigilbst.cpp index 6c55ece42..7f3365682 100644 --- a/source/blood/src/aigilbst.cpp +++ b/source/blood/src/aigilbst.cpp @@ -331,14 +331,14 @@ static void sub_6CB00(DBloodActor* actor) int nSin = Sin(pSprite->ang); int vx = actor->xvel(); int vy = actor->yvel(); - int t1 = dmulscale30(vx, nCos, vy, nSin); - int t2 = dmulscale30(vx, nSin, -vy, nCos); + int t1 = DMulScale(vx, nCos, vy, nSin, 30); + int t2 = DMulScale(vx, nSin, -vy, nCos, 30); if (pXSprite->target == -1) t1 += nAccel; else t1 += nAccel>>2; - actor->xvel() = dmulscale30(t1, nCos, t2, nSin); - actor->yvel() = dmulscale30(t1, nSin, -t2, nCos); + actor->xvel() = DMulScale(t1, nCos, t2, nSin, 30); + actor->yvel() = DMulScale(t1, nSin, -t2, nCos, 30); } static void sub_6CD74(DBloodActor* actor) @@ -369,11 +369,11 @@ static void sub_6CD74(DBloodActor* actor) int nSin = Sin(pSprite->ang); int vx = actor->xvel(); int vy = actor->yvel(); - int t1 = dmulscale30(vx, nCos, vy, nSin); - int t2 = dmulscale30(vx, nSin, -vy, nCos); + int t1 = DMulScale(vx, nCos, vy, nSin, 30); + int t2 = DMulScale(vx, nSin, -vy, nCos, 30); t1 += nAccel; - actor->xvel() = dmulscale30(t1, nCos, t2, nSin); - actor->yvel() = dmulscale30(t1, nSin, -t2, nCos); + actor->xvel() = DMulScale(t1, nCos, t2, nSin, 30); + actor->yvel() = DMulScale(t1, nSin, -t2, nCos, 30); actor->zvel() = -dz; } @@ -405,11 +405,11 @@ static void sub_6D03C(DBloodActor* actor) int nSin = Sin(pSprite->ang); int vx = actor->xvel(); int vy = actor->yvel(); - int t1 = dmulscale30(vx, nCos, vy, nSin); - int t2 = dmulscale30(vx, nSin, -vy, nCos); + int t1 = DMulScale(vx, nCos, vy, nSin, 30); + int t2 = DMulScale(vx, nSin, -vy, nCos, 30); t1 += nAccel>>1; - actor->xvel() = dmulscale30(t1, nCos, t2, nSin); - actor->yvel() = dmulscale30(t1, nSin, -t2, nCos); + actor->xvel() = DMulScale(t1, nCos, t2, nSin, 30); + actor->yvel() = DMulScale(t1, nSin, -t2, nCos, 30); actor->zvel() = dz; } diff --git a/source/blood/src/aiunicult.cpp b/source/blood/src/aiunicult.cpp index c9a548459..432d71e8b 100644 --- a/source/blood/src/aiunicult.cpp +++ b/source/blood/src/aiunicult.cpp @@ -1005,14 +1005,14 @@ void aiGenDudeMoveForward(DBloodActor* actor) int nSin = Sin(pSprite->ang); int vx = xvel[pSprite->index]; int vy = yvel[pSprite->index]; - int t1 = dmulscale30(vx, nCos, vy, nSin); - int t2 = dmulscale30(vx, nSin, -vy, nCos); + int t1 = DMulScale(vx, nCos, vy, nSin, 30); + int t2 = DMulScale(vx, nSin, -vy, nCos, 30); if (pXSprite->target == -1) t1 += nAccel; else t1 += nAccel >> 1; - xvel[pSprite->index] = dmulscale30(t1, nCos, t2, nSin); - yvel[pSprite->index] = dmulscale30(t1, nSin, -t2, nCos); + xvel[pSprite->index] = DMulScale(t1, nCos, t2, nSin, 30); + yvel[pSprite->index] = DMulScale(t1, nSin, -t2, nCos, 30); } else { int dang = ((kAng180 + pXSprite->goalAng - pSprite->ang) & 2047) - kAng180; pSprite->ang = ((pSprite->ang + ClipRange(dang, -maxTurn, maxTurn)) & 2047); @@ -1039,7 +1039,7 @@ void aiGenDudeChooseDirection(spritetype* pSprite, XSPRITE* pXSprite, int a3, in // TO-DO: Take in account if sprite is flip-x, so enemy select correct angle int vc = ((a3 + 1024 - pSprite->ang) & 2047) - 1024; - int t1 = dmulscale30(xvel, Cos(pSprite->ang), yvel, Sin(pSprite->ang)); + int t1 = DMulScale(xvel, Cos(pSprite->ang), yvel, Sin(pSprite->ang), 30); int vsi = ((t1 * 15) >> 12) / 2; int v8 = (vc >= 0) ? 341 : -341; if (CanMove(pSprite, pXSprite->target, pSprite->ang + vc, vsi)) diff --git a/source/build/include/pragmas.h b/source/build/include/pragmas.h index 575df272e..769c564c7 100644 --- a/source/build/include/pragmas.h +++ b/source/build/include/pragmas.h @@ -57,14 +57,7 @@ static inline int32_t scale(int32_t eax, int32_t edx, int32_t ecx) #define EDUKE32_SCALER_PRAGMA(a) \ static FORCE_INLINE int32_t mulscale##a(int32_t eax, int32_t edx) { return dw((qw(eax) * edx) >> by(a)); } \ static FORCE_INLINE double fmulscale##a(double eax, double edx) { return (eax * edx) / (double)(qw(1) << a); } \ - static FORCE_INLINE int32_t dmulscale##a(int32_t eax, int32_t edx, int32_t esi, int32_t edi) \ - { \ - return dw(((qw(eax) * edx) + (qw(esi) * edi)) >> by(a)); \ - } \ - static FORCE_INLINE double fdmulscale##a(double eax, double edx, double esi, double edi) \ - { \ - return ((eax * edx) + (esi * edi)) / (double)(qw(1) << a); \ - } \ + EDUKE32_GENERATE_PRAGMAS diff --git a/source/build/src/clip.cpp b/source/build/src/clip.cpp index f323609f4..c69b0b9fd 100644 --- a/source/build/src/clip.cpp +++ b/source/build/src/clip.cpp @@ -186,7 +186,7 @@ int32_t getceilzofslope_old(int32_t sectnum, int32_t dax, int32_t day) i = (ksqrtasm_old(dx*dx+dy*dy)); if (i == 0) return(sector[sectnum].ceilingz); i = divscale15(sector[sectnum].ceilingheinum,i); dx *= i; dy *= i; - return(sector[sectnum].ceilingz+dmulscale23(dx,day-wall[j].y,-dy,dax-wall[j].x)); + return sector[sectnum].ceilingz+DMulScale(dx,day-wall[j].y,-dy,dax-wall[j].x, 23); } int32_t getflorzofslope_old(int32_t sectnum, int32_t dax, int32_t day) @@ -200,7 +200,7 @@ int32_t getflorzofslope_old(int32_t sectnum, int32_t dax, int32_t day) i = (ksqrtasm_old(dx*dx+dy*dy)); if (i == 0) return sector[sectnum].floorz; i = divscale15(sector[sectnum].floorheinum,i); dx *= i; dy *= i; - return(sector[sectnum].floorz+dmulscale23(dx,day-wall[j].y,-dy,dax-wall[j].x)); + return sector[sectnum].floorz+DMulScale(dx,day-wall[j].y,-dy,dax-wall[j].x, 23); } // Returns: should clip? @@ -762,7 +762,7 @@ int32_t clipmove(vec3_t * const pos, int16_t * const sectnum, int32_t xvect, int if (enginecompatibility_mode == ENGINECOMPATIBILITY_19950829) tempint = clipr.x*(move.x>>6)+clipr.y*(move.y>>6); else - tempint = dmulscale6(clipr.x, move.x, clipr.y, move.y); + tempint = DMulScale(clipr.x, move.x, clipr.y, move.y, 6); for (native_t i=cnt+1, j; i<=clipmoveboxtracenum; ++i) { @@ -772,7 +772,7 @@ int32_t clipmove(vec3_t * const pos, int16_t * const sectnum, int32_t xvect, int if (enginecompatibility_mode == ENGINECOMPATIBILITY_19950829) tempint2 = (clipit[j].x2-clipit[j].x1)*(move.x>>6)+(clipit[j].y2-clipit[j].y1)*(move.y>>6); else - tempint2 = dmulscale6(clipit[j].x2-clipit[j].x1, move.x, clipit[j].y2-clipit[j].y1, move.y); + tempint2 = DMulScale(clipit[j].x2-clipit[j].x1, move.x, clipit[j].y2-clipit[j].y1, move.y, 6); if ((tempint ^ tempint2) < 0) { @@ -1244,10 +1244,10 @@ static int32_t hitscan_trysector(const vec3_t *sv, usectorptr_t sec, hitdata_t * i = divscale15(heinum,i); dax *= i; day *= i; - j = (vz<<8)-dmulscale15(dax,vy,-day,vx); + j = (vz<<8)-DMulScale(dax,vy,-day,vx, 15); if (j != 0) { - i = ((z - sv->z)<<8)+dmulscale15(dax,sv->y-wal->y,-day,sv->x-wal->x); + i = ((z - sv->z)<<8)+DMulScale(dax,sv->y-wal->y,-day,sv->x-wal->x, 15); if (((i^j) >= 0) && ((klabs(i)>>1) < klabs(j))) { i = divscale30(i,j); diff --git a/source/build/src/engine.cpp b/source/build/src/engine.cpp index b83e89867..9917edf4e 100644 --- a/source/build/src/engine.cpp +++ b/source/build/src/engine.cpp @@ -242,26 +242,26 @@ int32_t wallfront(int32_t l1, int32_t l2) vec2_t const l2vect = wall[thewall[l2]].pos; vec2_t const l2p2vect = wall[wall[thewall[l2]].point2].pos; vec2_t d = { l1p2vect.x - l1vect.x, l1p2vect.y - l1vect.y }; - int32_t t1 = dmulscale2(l2vect.x-l1vect.x, d.y, -d.x, l2vect.y-l1vect.y); //p1(l2) vs. l1 - int32_t t2 = dmulscale2(l2p2vect.x-l1vect.x, d.y, -d.x, l2p2vect.y-l1vect.y); //p2(l2) vs. l1 + int32_t t1 = DMulScale(l2vect.x-l1vect.x, d.y, -d.x, l2vect.y-l1vect.y, 2); //p1(l2) vs. l1 + int32_t t2 = DMulScale(l2p2vect.x-l1vect.x, d.y, -d.x, l2p2vect.y-l1vect.y, 2); //p2(l2) vs. l1 if (t1 == 0) { if (t2 == 0) return -1; t1 = t2; } if (t2 == 0) t2 = t1; if ((t1^t2) >= 0) //pos vs. l1 - return (dmulscale2(globalposx-l1vect.x, d.y, -d.x, globalposy-l1vect.y) ^ t1) >= 0; + return (DMulScale(globalposx-l1vect.x, d.y, -d.x, globalposy-l1vect.y, 2) ^ t1) >= 0; d.x = l2p2vect.x-l2vect.x; d.y = l2p2vect.y-l2vect.y; - t1 = dmulscale2(l1vect.x-l2vect.x, d.y, -d.x, l1vect.y-l2vect.y); //p1(l1) vs. l2 - t2 = dmulscale2(l1p2vect.x-l2vect.x, d.y, -d.x, l1p2vect.y-l2vect.y); //p2(l1) vs. l2 + t1 = DMulScale(l1vect.x-l2vect.x, d.y, -d.x, l1vect.y-l2vect.y, 2); //p1(l1) vs. l2 + t2 = DMulScale(l1p2vect.x-l2vect.x, d.y, -d.x, l1p2vect.y-l2vect.y, 2); //p2(l1) vs. l2 if (t1 == 0) { if (t2 == 0) return -1; t1 = t2; } if (t2 == 0) t2 = t1; if ((t1^t2) >= 0) //pos vs. l2 - return (dmulscale2(globalposx-l2vect.x,d.y,-d.x,globalposy-l2vect.y) ^ t1) < 0; + return (DMulScale(globalposx-l2vect.x,d.y,-d.x,globalposy-l2vect.y, 2) ^ t1) < 0; return -2; } @@ -1225,12 +1225,12 @@ void renderDrawMasks(void) for (i=numSprites-1; i>=0; --i) { const int32_t xs = tspriteptr[i]->x-globalposx, ys = tspriteptr[i]->y-globalposy; - const int32_t yp = dmulscale6(xs,cosviewingrangeglobalang,ys,sinviewingrangeglobalang); + const int32_t yp = DMulScale(xs,cosviewingrangeglobalang,ys,sinviewingrangeglobalang, 6); const int32_t modelp = polymost_spriteIsModelOrVoxel(tspriteptr[i]); if (yp > (4<<8)) { - const int32_t xp = dmulscale6(ys,cosglobalang,-xs,singlobalang); + const int32_t xp = DMulScale(ys,cosglobalang,-xs,singlobalang, 6); if (mulscale24(labs(xp+yp),xdimen) >= yp) goto killsprite; @@ -1621,10 +1621,10 @@ void renderDrawMapView(int32_t dax, int32_t day, int32_t zoome, int16_t ang) if ((k > j) && (npoints > 0)) { xb1[npoints-1] = l; l = npoints; } //overwrite point2 //wall[k].x wal->x wall[wal->point2].x //wall[k].y wal->y wall[wal->point2].y - if (!dmulscale1(wal->x-wall[k].x,wall[wal->point2].y-wal->y,-(wal->y-wall[k].y),wall[wal->point2].x-wal->x)) continue; + if (!DMulScale(wal->x-wall[k].x,wall[wal->point2].y-wal->y,-(wal->y-wall[k].y),wall[wal->point2].x-wal->x, 1)) continue; ox = wal->x - dax; oy = wal->y - day; - x = dmulscale16(ox,vect.x,-oy,vect.y) + (xdim<<11); - y = dmulscale16(oy,vect2.x,ox,vect2.y) + (ydim<<11); + x = DMulScale(ox,vect.x,-oy,vect.y, 16) + (xdim<<11); + y = DMulScale(oy,vect2.x,ox,vect2.y, 16) + (ydim<<11); i |= getclipmask(x-c1.x,c2.x-x,y-c1.y,c2.y-y); rx1[npoints] = x; ry1[npoints] = y; @@ -1676,11 +1676,11 @@ void renderDrawMapView(int32_t dax, int32_t day, int32_t zoome, int16_t ang) oy = wall[wall[startwall].point2].y - wall[startwall].y; i = nsqrtasm(uhypsq(ox,oy)); if (i == 0) continue; i = 1048576/i; - globalx1 = mulscale10(dmulscale10(ox,bakgvect.x,oy,bakgvect.y),i); - globaly1 = mulscale10(dmulscale10(ox,bakgvect.y,-oy,bakgvect.x),i); + globalx1 = mulscale10(DMulScale(ox,bakgvect.x,oy,bakgvect.y, 10),i); + globaly1 = mulscale10(DMulScale(ox,bakgvect.y,-oy,bakgvect.x, 10),i); ox = (bak.x>>4)-(xdim<<7); oy = (bak.y>>4)-(ydim<<7); - globalposx = dmulscale28(-oy, globalx1, -ox, globaly1); - globalposy = dmulscale28(-ox, globalx1, oy, globaly1); + globalposx = DMulScale(-oy, globalx1, -ox, globaly1, 28); + globalposy = DMulScale(-ox, globalx1, oy, globaly1, 28); globalx2 = -globalx1; globaly2 = -globaly1; @@ -1748,20 +1748,20 @@ void renderDrawMapView(int32_t dax, int32_t day, int32_t zoome, int16_t ang) i = 0; ox = v1.x - dax; oy = v1.y - day; - x = dmulscale16(ox,vect.x,-oy,vect.y) + (xdim<<11); - y = dmulscale16(oy,vect2.x,ox,vect2.y) + (ydim<<11); + x = DMulScale(ox,vect.x,-oy,vect.y, 16) + (xdim<<11); + y = DMulScale(oy,vect2.x,ox,vect2.y, 16) + (ydim<<11); i |= getclipmask(x-c1.x,c2.x-x,y-c1.y,c2.y-y); rx1[0] = x; ry1[0] = y; ox = v2.x - dax; oy = v2.y - day; - x = dmulscale16(ox,vect.x,-oy,vect.y) + (xdim<<11); - y = dmulscale16(oy,vect2.x,ox,vect2.y) + (ydim<<11); + x = DMulScale(ox,vect.x,-oy,vect.y, 16) + (xdim<<11); + y = DMulScale(oy,vect2.x,ox,vect2.y, 16) + (ydim<<11); i |= getclipmask(x-c1.x,c2.x-x,y-c1.y,c2.y-y); rx1[1] = x; ry1[1] = y; ox = v3.x - dax; oy = v3.y - day; - x = dmulscale16(ox,vect.x,-oy,vect.y) + (xdim<<11); - y = dmulscale16(oy,vect2.x,ox,vect2.y) + (ydim<<11); + x = DMulScale(ox,vect.x,-oy,vect.y, 16) + (xdim<<11); + y = DMulScale(oy,vect2.x,ox,vect2.y, 16) + (ydim<<11); i |= getclipmask(x-c1.x,c2.x-x,y-c1.y,c2.y-y); rx1[2] = x; ry1[2] = y; @@ -1790,12 +1790,12 @@ void renderDrawMapView(int32_t dax, int32_t day, int32_t zoome, int16_t ang) //relative alignment stuff ox = v2.x-v1.x; oy = v2.y-v1.y; i = ox*ox+oy*oy; if (i == 0) continue; i = 65536*16384 / i; - globalx1 = mulscale10(dmulscale10(ox,bakgvect.x,oy,bakgvect.y),i); - globaly1 = mulscale10(dmulscale10(ox,bakgvect.y,-oy,bakgvect.x),i); + globalx1 = mulscale10(DMulScale(ox,bakgvect.x,oy,bakgvect.y, 10),i); + globaly1 = mulscale10(DMulScale(ox,bakgvect.y,-oy,bakgvect.x, 10),i); ox = v1.y-v4.y; oy = v4.x-v1.x; i = ox*ox+oy*oy; if (i == 0) continue; i = 65536 * 16384 / i; - globalx2 = mulscale10(dmulscale10(ox,bakgvect.x,oy,bakgvect.y),i); - globaly2 = mulscale10(dmulscale10(ox,bakgvect.y,-oy,bakgvect.x),i); + globalx2 = mulscale10(DMulScale(ox,bakgvect.x,oy,bakgvect.y, 10),i); + globaly2 = mulscale10(DMulScale(ox,bakgvect.y,-oy,bakgvect.x, 10),i); ox = widthBits(globalpicnum); oy = heightBits(globalpicnum); @@ -1807,8 +1807,8 @@ void renderDrawMapView(int32_t dax, int32_t day, int32_t zoome, int16_t ang) } bak.x = (bak.x>>4)-(xdim<<7); bak.y = (bak.y>>4)-(ydim<<7); - globalposx = dmulscale28(-bak.y,globalx1,-bak.x,globaly1); - globalposy = dmulscale28(bak.x,globalx2,-bak.y,globaly2); + globalposx = DMulScale(-bak.y,globalx1,-bak.x,globaly1, 28); + globalposy = DMulScale(bak.x,globalx2,-bak.y,globaly2, 28); if ((spr->cstat&0x4) > 0) globalx1 = -globalx1, globaly1 = -globaly1, globalposx = -globalposx; asm1 = (globaly1<<2); globalx1 <<= 2; globalposx <<= (20+2); @@ -2399,7 +2399,7 @@ void neartag(int32_t xs, int32_t ys, int32_t zs, int16_t sectnum, int16_t ange, { if (good&1) *neartagsector = nextsector; if (good&2) *neartagwall = z; - *neartaghitdist = dmulscale14(intx-xs, bcos(ange), inty-ys, bsin(ange)); + *neartaghitdist = DMulScale(intx-xs, bcos(ange), inty-ys, bsin(ange), 14); hitv.x = intx; hitv.y = inty; hitv.z = intz; } @@ -2431,7 +2431,7 @@ void neartag(int32_t xs, int32_t ys, int32_t zs, int16_t sectnum, int16_t ange, if (try_facespr_intersect(spr, sv, vx, vy, 0, &hitv, 1)) { *neartagsprite = z; - *neartaghitdist = dmulscale14(hitv.x-xs, bcos(ange), hitv.y-ys, bsin(ange)); + *neartaghitdist = DMulScale(hitv.x-xs, bcos(ange), hitv.y-ys, bsin(ange), 14); } } } @@ -2841,8 +2841,8 @@ void rotatepoint(vec2_t const pivot, vec2_t p, int16_t const daang, vec2_t * con int const dasin = bsin(daang); p.x -= pivot.x; p.y -= pivot.y; - p2->x = dmulscale14(p.x, dacos, -p.y, dasin) + pivot.x; - p2->y = dmulscale14(p.y, dacos, p.x, dasin) + pivot.y; + p2->x = DMulScale(p.x, dacos, -p.y, dasin, 14) + pivot.x; + p2->y = DMulScale(p.y, dacos, p.x, dasin, 14) + pivot.y; } void videoSetCorrectedAspect() @@ -3054,7 +3054,7 @@ int32_t getceilzofslopeptr(usectorptr_t sec, int32_t dax, int32_t day) int const i = nsqrtasm(uhypsq(d.x,d.y))<<5; if (i == 0) return sec->ceilingz; - int const j = dmulscale3(d.x, day-w.y, -d.y, dax-w.x); + int const j = DMulScale(d.x, day-w.y, -d.y, dax-w.x, 3); int const shift = enginecompatibility_mode != ENGINECOMPATIBILITY_NONE ? 0 : 1; return sec->ceilingz + (scale(sec->ceilingheinum,j>>shift,i)<floorz; - int const j = dmulscale3(d.x, day-w.y, -d.y, dax-w.x); + int const j = DMulScale(d.x, day-w.y, -d.y, dax-w.x, 3); int const shift = enginecompatibility_mode != ENGINECOMPATIBILITY_NONE ? 0 : 1; return sec->floorz + (scale(sec->floorheinum,j>>shift,i)<y, -d.y,dax-wal->x); + int const j = DMulScale(d.x,day-wal->y, -d.y,dax-wal->x, 3); int const shift = enginecompatibility_mode != ENGINECOMPATIBILITY_NONE ? 0 : 1; if (sec->ceilingstat&2) *ceilz += scale(sec->ceilingheinum,j>>shift,i)<cstat&(64+48))!=(64+16) || (r_voxels && tiletovox[spr->picnum] >= 0 && voxmodels[tiletovox[spr->picnum]]) || - dmulscale6(bcos(spr->ang), -s.x, bsin(spr->ang), -s.y) > 0) + DMulScale(bcos(spr->ang), -s.x, bsin(spr->ang), -s.y, 6) > 0) if (renderAddTsprite(z, sectnum)) break; } diff --git a/source/core/automap.cpp b/source/core/automap.cpp index 65be2c524..269e36f91 100644 --- a/source/core/automap.cpp +++ b/source/core/automap.cpp @@ -435,14 +435,14 @@ void drawredlines(int cposx, int cposy, int czoom, int cang) { int ox = wal->x - cposx; int oy = wal->y - cposy; - int x1 = dmulscale16(ox, xvect, -oy, yvect) + (xdim << 11); - int y1 = dmulscale16(oy, xvect2, ox, yvect2) + (ydim << 11); + int x1 = DMulScale(ox, xvect, -oy, yvect, 16) + (xdim << 11); + int y1 = DMulScale(oy, xvect2, ox, yvect2, 16) + (ydim << 11); auto wal2 = &wall[wal->point2]; ox = wal2->x - cposx; oy = wal2->y - cposy; - int x2 = dmulscale16(ox, xvect, -oy, yvect) + (xdim << 11); - int y2 = dmulscale16(oy, xvect2, ox, yvect2) + (ydim << 11); + int x2 = DMulScale(ox, xvect, -oy, yvect, 16) + (xdim << 11); + int y2 = DMulScale(oy, xvect2, ox, yvect2, 16) + (ydim << 11); drawlinergb(x1, y1, x2, y2, RedLineColor()); } @@ -483,15 +483,15 @@ static void drawwhitelines(int cposx, int cposy, int czoom, int cang) int ox = wal->x - cposx; int oy = wal->y - cposy; - int x1 = dmulscale16(ox, xvect, -oy, yvect) + (xdim << 11); - int y1 = dmulscale16(oy, xvect2, ox, yvect2) + (ydim << 11); + int x1 = DMulScale(ox, xvect, -oy, yvect, 16) + (xdim << 11); + int y1 = DMulScale(oy, xvect2, ox, yvect2, 16) + (ydim << 11); int k = wal->point2; auto wal2 = &wall[k]; ox = wal2->x - cposx; oy = wal2->y - cposy; - int x2 = dmulscale16(ox, xvect, -oy, yvect) + (xdim << 11); - int y2 = dmulscale16(oy, xvect2, ox, yvect2) + (ydim << 11); + int x2 = DMulScale(ox, xvect, -oy, yvect, 16) + (xdim << 11); + int y2 = DMulScale(oy, xvect2, ox, yvect2, 16) + (ydim << 11); drawlinergb(x1, y1, x2, y2, WhiteLineColor()); } @@ -519,20 +519,20 @@ void DrawPlayerArrow(int cposx, int cposy, int cang, int pl_x, int pl_y, int zoo for (int i = 0; i < 12; i += 4) { - int px1 = dmulscale16(arrow[i], pxvect, -arrow[i+1], pyvect); - int py1 = dmulscale16(arrow[i+1], pxvect, arrow[i], pyvect) + (ydim << 11); - int px2 = dmulscale16(arrow[i+2], pxvect, -arrow[i + 3], pyvect); - int py2 = dmulscale16(arrow[i + 3], pxvect, arrow[i+2], pyvect) + (ydim << 11); + int px1 = DMulScale(arrow[i], pxvect, -arrow[i+1], pyvect, 16); + int py1 = DMulScale(arrow[i+1], pxvect, arrow[i], pyvect, 16) + (ydim << 11); + int px2 = DMulScale(arrow[i+2], pxvect, -arrow[i + 3], pyvect, 16); + int py2 = DMulScale(arrow[i + 3], pxvect, arrow[i+2], pyvect, 16) + (ydim << 11); int ox1 = px1 - cposx; int oy1 = py1 - cposx; int ox2 = px2 - cposx; int oy2 = py2 - cposx; - int sx1 = dmulscale16(ox1, xvect, -oy1, yvect) + (xdim << 11); - int sy1 = dmulscale16(oy1, xvect2, ox1, yvect2) + (ydim << 11); - int sx2 = dmulscale16(ox2, xvect, -oy2, yvect) + (xdim << 11); - int sy2 = dmulscale16(oy2, xvect2, ox2, yvect2) + (ydim << 11); + int sx1 = DMulScale(ox1, xvect, -oy1, yvect, 16) + (xdim << 11); + int sy1 = DMulScale(oy1, xvect2, ox1, yvect2, 16) + (ydim << 11); + int sx2 = DMulScale(ox2, xvect, -oy2, yvect, 16) + (xdim << 11); + int sy2 = DMulScale(oy2, xvect2, ox2, yvect2, 16) + (ydim << 11); drawlinergb(sx1, sy1, sx2, sy2, WhiteLineColor()); } diff --git a/source/games/duke/src/actors.cpp b/source/games/duke/src/actors.cpp index 36bafb494..94c7e1eda 100644 --- a/source/games/duke/src/actors.cpp +++ b/source/games/duke/src/actors.cpp @@ -1329,7 +1329,7 @@ void bounce(DDukeActor* actor) } s->zvel = zvect; - s->xvel = ksqrt(dmulscale8(xvect, xvect, yvect, yvect)); + s->xvel = ksqrt(DMulScale(xvect, xvect, yvect, yvect, 8)); s->ang = getangle(xvect, yvect); } diff --git a/source/games/duke/src/game_misc.cpp b/source/games/duke/src/game_misc.cpp index cb926c241..66012392c 100644 --- a/source/games/duke/src/game_misc.cpp +++ b/source/games/duke/src/game_misc.cpp @@ -434,13 +434,13 @@ bool GameInterface::DrawAutomapPlayer(int cposx, int cposy, int czoom, int cang, ox = sprx - cposx; oy = spry - cposy; - x1 = dmulscale16(ox, xvect, -oy, yvect); - y1 = dmulscale16(oy, xvect2, ox, yvect2); + x1 = DMulScale(ox, xvect, -oy, yvect, 16); + y1 = DMulScale(oy, xvect2, ox, yvect2, 16); ox = bcos(spr->ang, -7); oy = bsin(spr->ang, -7); - x2 = dmulscale16(ox, xvect, -oy, yvect); - y2 = dmulscale16(oy, xvect, ox, yvect); + x2 = DMulScale(ox, xvect, -oy, yvect, 16); + y2 = DMulScale(oy, xvect, ox, yvect, 16); x3 = mulscale16(x2, yxaspect); y3 = mulscale16(y2, yxaspect); @@ -474,13 +474,13 @@ bool GameInterface::DrawAutomapPlayer(int cposx, int cposy, int czoom, int cang, ox = x1 - cposx; oy = y1 - cposy; - x1 = dmulscale16(ox, xvect, -oy, yvect); - y1 = dmulscale16(oy, xvect2, ox, yvect2); + x1 = DMulScale(ox, xvect, -oy, yvect, 16); + y1 = DMulScale(oy, xvect2, ox, yvect2, 16); ox = x2 - cposx; oy = y2 - cposy; - x2 = dmulscale16(ox, xvect, -oy, yvect); - y2 = dmulscale16(oy, xvect2, ox, yvect2); + x2 = DMulScale(ox, xvect, -oy, yvect, 16); + y2 = DMulScale(oy, xvect2, ox, yvect2, 16); drawlinergb(x1 + (xdim << 11), y1 + (ydim << 11), x2 + (xdim << 11), y2 + (ydim << 11), col); @@ -505,8 +505,8 @@ bool GameInterface::DrawAutomapPlayer(int cposx, int cposy, int czoom, int cang, dax = ((xspan >> 1) + xoff) * xrepeat; day = ((yspan >> 1) + yoff) * yrepeat; - x1 = sprx + dmulscale16(sinang, dax, cosang, day); - y1 = spry + dmulscale16(sinang, day, -cosang, dax); + x1 = sprx + DMulScale(sinang, dax, cosang, day, 16); + y1 = spry + DMulScale(sinang, day, -cosang, dax, 16); l = xspan * xrepeat; x2 = x1 - mulscale16(sinang, l); y2 = y1 + mulscale16(cosang, l); @@ -520,23 +520,23 @@ bool GameInterface::DrawAutomapPlayer(int cposx, int cposy, int czoom, int cang, ox = x1 - cposx; oy = y1 - cposy; - x1 = dmulscale16(ox, xvect, -oy, yvect); - y1 = dmulscale16(oy, xvect2, ox, yvect2); + x1 = DMulScale(ox, xvect, -oy, yvect, 16); + y1 = DMulScale(oy, xvect2, ox, yvect2, 16); ox = x2 - cposx; oy = y2 - cposy; - x2 = dmulscale16(ox, xvect, -oy, yvect); - y2 = dmulscale16(oy, xvect2, ox, yvect2); + x2 = DMulScale(ox, xvect, -oy, yvect, 16); + y2 = DMulScale(oy, xvect2, ox, yvect2, 16); ox = x3 - cposx; oy = y3 - cposy; - x3 = dmulscale16(ox, xvect, -oy, yvect); - y3 = dmulscale16(oy, xvect2, ox, yvect2); + x3 = DMulScale(ox, xvect, -oy, yvect, 16); + y3 = DMulScale(oy, xvect2, ox, yvect2, 16); ox = x4 - cposx; oy = y4 - cposy; - x4 = dmulscale16(ox, xvect, -oy, yvect); - y4 = dmulscale16(oy, xvect2, ox, yvect2); + x4 = DMulScale(ox, xvect, -oy, yvect, 16); + y4 = DMulScale(oy, xvect2, ox, yvect2, 16); drawlinergb(x1 + (xdim << 11), y1 + (ydim << 11), x2 + (xdim << 11), y2 + (ydim << 11), col); diff --git a/source/sw/src/sprite.cpp b/source/sw/src/sprite.cpp index 01580433e..878bcb8c9 100644 --- a/source/sw/src/sprite.cpp +++ b/source/sw/src/sprite.cpp @@ -4794,8 +4794,8 @@ getzrangepoint(int x, int y, int z, short sectnum, dax = ((xspan >> 1) + xoff) * spr->xrepeat; yspan = tileHeight(tilenum); day = ((yspan >> 1) + yoff) * spr->yrepeat; - x1 = spr->x + dmulscale16(sinang, dax, cosang, day) - x; - y1 = spr->y + dmulscale16(sinang, day, -cosang, dax) - y; + x1 = spr->x + DMulScale(sinang, dax, cosang, day, 16) - x; + y1 = spr->y + DMulScale(sinang, day, -cosang, dax, 16) - y; l = xspan * spr->xrepeat; x2 = x1 - mulscale16(sinang, l); y2 = y1 + mulscale16(cosang, l); diff --git a/source/sw/src/weapon.cpp b/source/sw/src/weapon.cpp index 53b719db9..cd99e0c93 100644 --- a/source/sw/src/weapon.cpp +++ b/source/sw/src/weapon.cpp @@ -8825,8 +8825,8 @@ void WallBounce(short SpriteNum, short ang) dax = -u->xchange; day = -u->ychange; - u->xchange = dmulscale14(day, k, dax, l); - u->ychange = dmulscale14(dax, k, -day, l); + u->xchange = DMulScale(day, k, dax, l, 14); + u->ychange = DMulScale(dax, k, -day, l, 14); old_ang = sp->ang; sp->ang = getangle(u->xchange, u->ychange);