From 868aa7f07adb48c18efcc44bc99c53f85ac07caa Mon Sep 17 00:00:00 2001 From: Mitchell Richters Date: Mon, 4 Jan 2021 22:57:26 +1100 Subject: [PATCH] - Replace `mulscale()` calls with `MulScale()` from common. --- source/blood/src/actor.cpp | 54 ++++++++++++++--------------- source/blood/src/aicerber.cpp | 8 ++--- source/blood/src/aigarg.cpp | 4 +-- source/blood/src/aighost.cpp | 4 +-- source/blood/src/aitchern.cpp | 8 ++--- source/blood/src/aiunicult.cpp | 4 +-- source/blood/src/common_game.h | 10 +++--- source/blood/src/nnexts.cpp | 10 +++--- source/blood/src/prediction.cpp | 4 +-- source/blood/src/view.cpp | 6 ++-- source/blood/src/weapon.cpp | 6 ++-- source/build/include/pragmas.h | 3 -- source/build/src/engine.cpp | 4 +-- source/exhumed/src/map.cpp | 2 +- source/games/duke/src/actors_d.cpp | 4 +-- source/games/duke/src/actors_r.cpp | 4 +-- source/games/duke/src/game_misc.cpp | 2 +- source/games/duke/src/gameexec.cpp | 4 +-- source/games/duke/src/player.cpp | 2 +- source/games/duke/src/player_d.cpp | 16 ++++----- source/games/duke/src/player_r.cpp | 24 ++++++------- source/games/duke/src/player_w.cpp | 2 +- source/sw/src/player.cpp | 4 +-- 23 files changed, 93 insertions(+), 96 deletions(-) diff --git a/source/blood/src/actor.cpp b/source/blood/src/actor.cpp index 3cbdcefe7..b4a68a46a 100644 --- a/source/blood/src/actor.cpp +++ b/source/blood/src/actor.cpp @@ -3953,7 +3953,7 @@ void actKickObject(spritetype *pSprite1, spritetype *pSprite2) int nSpeed = ClipLow(approxDist(xvel[nSprite1], yvel[nSprite1])*2, 0xaaaaa); xvel[nSprite2] = MulScale(nSpeed, Cos(pSprite1->ang+Random2(85)), 30); yvel[nSprite2] = MulScale(nSpeed, Sin(pSprite1->ang+Random2(85)), 30); - zvel[nSprite2] = mulscale(nSpeed, -0x2000, 14); + zvel[nSprite2] = MulScale(nSpeed, -0x2000, 14); pSprite2->flags = 7; } @@ -4020,15 +4020,15 @@ void ProcessTouchObjects(spritetype *pSprite, int nXSprite) pSprite2->flags |= 4; // Inlined ? - xvel[pSprite2->index] += mulscale(4, pSprite2->x-sprite[nSprite].x, 2); - yvel[pSprite2->index] += mulscale(4, pSprite2->y-sprite[nSprite].y, 2); + xvel[pSprite2->index] += MulScale(4, pSprite2->x-sprite[nSprite].x, 2); + yvel[pSprite2->index] += MulScale(4, pSprite2->y-sprite[nSprite].y, 2); } else { pSprite2->flags |= 5; - xvel[pSprite2->index] += mulscale(4, pSprite2->x-sprite[nSprite].x, 2); - yvel[pSprite2->index] += mulscale(4, pSprite2->y-sprite[nSprite].y, 2); + xvel[pSprite2->index] += MulScale(4, pSprite2->x-sprite[nSprite].x, 2); + yvel[pSprite2->index] += MulScale(4, pSprite2->y-sprite[nSprite].y, 2); #ifdef NOONE_EXTENSIONS // add size shroom abilities @@ -4407,7 +4407,7 @@ int MoveThing(spritetype *pSprite) pSprite->flags |= 4; int vax = actFloorBounceVector((int*)&xvel[nSprite], (int*)&yvel[nSprite], (int*)&v20, pSprite->sectnum, pThingInfo->elastic); - int nDamage = mulscale(vax, vax, 30)-pThingInfo->dmgResist; + int nDamage = MulScale(vax, vax, 30)-pThingInfo->dmgResist; if (nDamage > 0) actDamageSprite(nSprite, pSprite, DAMAGE_TYPE_0, nDamage); zvel[nSprite] = v20; @@ -4481,8 +4481,8 @@ int MoveThing(spritetype *pSprite) int nHitSprite = floorHit & 0x3fff; if ((sprite[nHitSprite].cstat & 0x30) == 0) { - xvel[nSprite] += mulscale(4, pSprite->x - sprite[nHitSprite].x, 2); - yvel[nSprite] += mulscale(4, pSprite->y - sprite[nHitSprite].y, 2); + xvel[nSprite] += MulScale(4, pSprite->x - sprite[nHitSprite].x, 2); + yvel[nSprite] += MulScale(4, pSprite->y - sprite[nHitSprite].y, 2); v8 = gSpriteHit[nXSprite].hit; } } @@ -4934,7 +4934,7 @@ void MoveDude(spritetype *pSprite) if (v30 > 0) { int vax = actFloorBounceVector((int*)&xvel[nSprite], (int*)&yvel[nSprite], (int*)&v30, pSprite->sectnum, 0); - int nDamage = mulscale(vax, vax, 30); + int nDamage = MulScale(vax, vax, 30); if (pPlayer) { pPlayer->fallScream = 0; @@ -5013,8 +5013,8 @@ void MoveDude(spritetype *pSprite) int nHitSprite = floorHit & 0x3fff; if ((sprite[nHitSprite].cstat & 0x30) == 0) { - xvel[nSprite] += mulscale(4, pSprite->x - sprite[nHitSprite].x, 2); - yvel[nSprite] += mulscale(4, pSprite->y - sprite[nHitSprite].y, 2); + xvel[nSprite] += MulScale(4, pSprite->x - sprite[nHitSprite].x, 2); + yvel[nSprite] += MulScale(4, pSprite->y - sprite[nHitSprite].y, 2); return; } } @@ -6262,7 +6262,7 @@ spritetype * actFireThing(spritetype *pSprite, int a2, int a3, int a4, int thing pThing->ang = pSprite->ang; xvel[pThing->index] = MulScale(a6, Cos(pThing->ang), 30); yvel[pThing->index] = MulScale(a6, Sin(pThing->ang), 30); - zvel[pThing->index] = mulscale(a6, a4, 14); + zvel[pThing->index] = MulScale(a6, a4, 14); xvel[pThing->index] += xvel[pSprite->index]/2; yvel[pThing->index] += yvel[pSprite->index]/2; zvel[pThing->index] += zvel[pSprite->index]/2; @@ -6309,9 +6309,9 @@ spritetype* actFireMissile(spritetype *pSprite, int a2, int a3, int a4, int a5, pMissile->yrepeat = pMissileInfo->yrepeat; pMissile->picnum = pMissileInfo->picnum; pMissile->ang = (pSprite->ang+pMissileInfo->angleOfs)&2047; - xvel[nMissile] = mulscale(pMissileInfo->velocity, a4, 14); - yvel[nMissile] = mulscale(pMissileInfo->velocity, a5, 14); - zvel[nMissile] = mulscale(pMissileInfo->velocity, a6, 14); + xvel[nMissile] = MulScale(pMissileInfo->velocity, a4, 14); + yvel[nMissile] = MulScale(pMissileInfo->velocity, a5, 14); + zvel[nMissile] = MulScale(pMissileInfo->velocity, a6, 14); pMissile->owner = pSprite->index; pMissile->cstat |= 1; int nXSprite = pMissile->extra; @@ -6525,9 +6525,9 @@ void actFireVector(spritetype *pShooter, int a2, int a3, int a4, int a5, int a6, } } } - int x = gHitInfo.hitx-mulscale(a4, 16, 14); - int y = gHitInfo.hity-mulscale(a5, 16, 14); - int z = gHitInfo.hitz-mulscale(a6, 256, 14); + int x = gHitInfo.hitx-MulScale(a4, 16, 14); + int y = gHitInfo.hity-MulScale(a5, 16, 14); + int z = gHitInfo.hitz-MulScale(a6, 256, 14); short nSector = gHitInfo.hitsect; unsigned char nSurf = kSurfNone; if (nRange == 0 || approxDist(gHitInfo.hitx-pShooter->x, gHitInfo.hity-pShooter->y) < nRange) @@ -6559,9 +6559,9 @@ void actFireVector(spritetype *pShooter, int a2, int a3, int a4, int a5, int a6, nSurf = surfType[wall[nWall].picnum]; if (actCanSplatWall(nWall)) { - int x = gHitInfo.hitx-mulscale(a4, 16, 14); - int y = gHitInfo.hity-mulscale(a5, 16, 14); - int z = gHitInfo.hitz-mulscale(a6, 256, 14); + int x = gHitInfo.hitx-MulScale(a4, 16, 14); + int y = gHitInfo.hity-MulScale(a5, 16, 14); + int z = gHitInfo.hitz-MulScale(a6, 256, 14); int nSurf = surfType[wall[nWall].picnum]; assert(nSurf < kSurfMax); if (pVectorData->surfHit[nSurf].fx1 >= 0) @@ -6596,9 +6596,9 @@ void actFireVector(spritetype *pShooter, int a2, int a3, int a4, int a5, int a6, nSurf = surfType[sprite[nSprite].picnum]; assert(nSprite >= 0 && nSprite < kMaxSprites); spritetype *pSprite = &sprite[nSprite]; - x -= mulscale(a4, 112, 14); - y -= mulscale(a5, 112, 14); - z -= mulscale(a6, 112<<4, 14); + x -= MulScale(a4, 112, 14); + y -= MulScale(a5, 112, 14); + z -= MulScale(a6, 112<<4, 14); int shift = 4; if (vectorType == VECTOR_TYPE_0 && !IsPlayerSprite(pSprite)) shift = 3; @@ -6671,9 +6671,9 @@ void actFireVector(spritetype *pShooter, int a2, int a3, int a4, int a5, int a6, int nSector = gHitInfo.hitsect; if (actCanSplatWall(nWall)) { - int x = gHitInfo.hitx - mulscale(a4, 16, 14); - int y = gHitInfo.hity - mulscale(a5, 16, 14); - int z = gHitInfo.hitz - mulscale(a6, 16<<4, 14); + int x = gHitInfo.hitx - MulScale(a4, 16, 14); + int y = gHitInfo.hity - MulScale(a5, 16, 14); + int z = gHitInfo.hitz - MulScale(a6, 16<<4, 14); int nSurf = surfType[wall[nWall].picnum]; const VECTORDATA *pVectorData = &gVectorData[19]; FX_ID t2 = pVectorData->surfHit[nSurf].fx2; diff --git a/source/blood/src/aicerber.cpp b/source/blood/src/aicerber.cpp index 4d2b697d4..94f897e93 100644 --- a/source/blood/src/aicerber.cpp +++ b/source/blood/src/aicerber.cpp @@ -123,8 +123,8 @@ void cerberusBurnSeqCallback(int, DBloodActor* actor) } int tx = x+MulScale(Cos(pSprite->ang), nDist, 30); int ty = y+MulScale(Sin(pSprite->ang), nDist, 30); - int tz = z+mulscale(actor->dudeSlope, nDist, 10); - int tsr = mulscale(9460, nDist, 10); + int tz = z+MulScale(actor->dudeSlope, nDist, 10); + int tsr = MulScale(9460, nDist, 10); int top, bottom; GetSpriteExtents(pSprite2, &top, &bottom); if (tz-tsr > bottom || tz+tsr < top) @@ -208,8 +208,8 @@ void cerberusBurnSeqCallback2(int, DBloodActor* actor) } int tx = x+MulScale(Cos(pSprite->ang), nDist, 30); int ty = y+MulScale(Sin(pSprite->ang), nDist, 30); - int tz = z+mulscale(actor->dudeSlope, nDist, 10); - int tsr = mulscale(9460, nDist, 10); + int tz = z+MulScale(actor->dudeSlope, nDist, 10); + int tsr = MulScale(9460, nDist, 10); int top, bottom; GetSpriteExtents(pSprite2, &top, &bottom); if (tz-tsr > bottom || tz+tsr < top) diff --git a/source/blood/src/aigarg.cpp b/source/blood/src/aigarg.cpp index a05b20453..805ad18cf 100644 --- a/source/blood/src/aigarg.cpp +++ b/source/blood/src/aigarg.cpp @@ -147,8 +147,8 @@ void BlastSSeqCallback(int, DBloodActor* actor) } int tx = x+MulScale(Cos(pSprite->ang), nDist, 30); int ty = y+MulScale(Sin(pSprite->ang), nDist, 30); - int tz = z+mulscale(actor->dudeSlope, nDist, 10); - int tsr = mulscale(9460, nDist, 10); + int tz = z+MulScale(actor->dudeSlope, nDist, 10); + int tsr = MulScale(9460, nDist, 10); int top, bottom; GetSpriteExtents(pSprite2, &top, &bottom); if (tz-tsr > bottom || tz+tsr < top) diff --git a/source/blood/src/aighost.cpp b/source/blood/src/aighost.cpp index 9c8706b6b..8c0ed90b1 100644 --- a/source/blood/src/aighost.cpp +++ b/source/blood/src/aighost.cpp @@ -130,8 +130,8 @@ void ghostBlastSeqCallback(int, DBloodActor* actor) } int tx = x+MulScale(Cos(pSprite->ang), nDist, 30); int ty = y+MulScale(Sin(pSprite->ang), nDist, 30); - int tz = z+mulscale(actor->dudeSlope, nDist, 10); - int tsr = mulscale(9460, nDist, 10); + int tz = z+MulScale(actor->dudeSlope, nDist, 10); + int tsr = MulScale(9460, nDist, 10); int top, bottom; GetSpriteExtents(pSprite2, &top, &bottom); if (tz-tsr > bottom || tz+tsr < top) diff --git a/source/blood/src/aitchern.cpp b/source/blood/src/aitchern.cpp index afc5a796d..bcbb0c5b3 100644 --- a/source/blood/src/aitchern.cpp +++ b/source/blood/src/aitchern.cpp @@ -105,8 +105,8 @@ void sub_71BD4(int, DBloodActor* actor) } int tx = x+MulScale(Cos(pSprite->ang), nDist, 30); int ty = y+MulScale(Sin(pSprite->ang), nDist, 30); - int tz = z+mulscale(actor->dudeSlope, nDist, 10); - int tsr = mulscale(9460, nDist, 10); + int tz = z+MulScale(actor->dudeSlope, nDist, 10); + int tsr = MulScale(9460, nDist, 10); int top, bottom; GetSpriteExtents(pSprite2, &top, &bottom); if (tz-tsr > bottom || tz+tsr < top) @@ -184,8 +184,8 @@ void sub_720AC(int, DBloodActor* actor) } int tx = x+MulScale(Cos(pSprite->ang), nDist, 30); int ty = y+MulScale(Sin(pSprite->ang), nDist, 30); - int tz = z+mulscale(actor->dudeSlope, nDist, 10); - int tsr = mulscale(9460, nDist, 10); + int tz = z+MulScale(actor->dudeSlope, nDist, 10); + int tsr = MulScale(9460, nDist, 10); int top, bottom; GetSpriteExtents(pSprite2, &top, &bottom); if (tz-tsr > bottom || tz+tsr < top) diff --git a/source/blood/src/aiunicult.cpp b/source/blood/src/aiunicult.cpp index d0e708149..de9148e86 100644 --- a/source/blood/src/aiunicult.cpp +++ b/source/blood/src/aiunicult.cpp @@ -1025,8 +1025,8 @@ void aiGenDudeMoveForward(DBloodActor* actor) int cos = Cos(pSprite->ang); int frontSpeed = gGenDudeExtra[pSprite->index].moveSpeed; - xvel[pSprite->index] += mulscale(cos, frontSpeed, 30); - yvel[pSprite->index] += mulscale(sin, frontSpeed, 30); + xvel[pSprite->index] += MulScale(cos, frontSpeed, 30); + yvel[pSprite->index] += MulScale(sin, frontSpeed, 30); } } diff --git a/source/blood/src/common_game.h b/source/blood/src/common_game.h index 63df0f1cf..fd1b4f675 100644 --- a/source/blood/src/common_game.h +++ b/source/blood/src/common_game.h @@ -565,27 +565,27 @@ inline char Chance(int a1) inline unsigned int Random(int a1) { - return mulscale(wrand(), a1, 15); + return MulScale(wrand(), a1, 15); } inline int Random2(int a1) { - return mulscale(wrand(), a1, 14)-a1; + return MulScale(wrand(), a1, 14)-a1; } inline int Random3(int a1) { - return mulscale(wrand()+wrand(), a1, 15) - a1; + return MulScale(wrand()+wrand(), a1, 15) - a1; } inline unsigned int QRandom(int a1) { - return mulscale(qrand(), a1, 15); + return MulScale(qrand(), a1, 15); } inline int QRandom2(int a1) { - return mulscale(qrand(), a1, 14)-a1; + return MulScale(qrand(), a1, 14)-a1; } template diff --git a/source/blood/src/nnexts.cpp b/source/blood/src/nnexts.cpp index 3fe6386d2..49fbf46cd 100644 --- a/source/blood/src/nnexts.cpp +++ b/source/blood/src/nnexts.cpp @@ -1213,8 +1213,8 @@ void debrisMove(int listIndex) { int nHitSprite = floorHit & 0x3fff; if ((sprite[nHitSprite].cstat & 0x30) == 0) { - xvel[nSprite] += mulscale(4, pSprite->x - sprite[nHitSprite].x, 2); - yvel[nSprite] += mulscale(4, pSprite->y - sprite[nHitSprite].y, 2); + xvel[nSprite] += MulScale(4, pSprite->x - sprite[nHitSprite].x, 2); + yvel[nSprite] += MulScale(4, pSprite->y - sprite[nHitSprite].y, 2); moveHit = gSpriteHit[nXSprite].hit; } } @@ -4341,9 +4341,9 @@ void useUniMissileGen(int, int nXSprite) { if (pXSprite->data2 > 0) { int velocity = pXSprite->data2 << 12; - xvel[pMissile->index] = mulscale(velocity, dx, 14); - yvel[pMissile->index] = mulscale(velocity, dy, 14); - zvel[pMissile->index] = mulscale(velocity, dz, 14); + xvel[pMissile->index] = MulScale(velocity, dx, 14); + yvel[pMissile->index] = MulScale(velocity, dy, 14); + zvel[pMissile->index] = MulScale(velocity, dz, 14); } diff --git a/source/blood/src/prediction.cpp b/source/blood/src/prediction.cpp index 0ef5f6232..d52b94322 100644 --- a/source/blood/src/prediction.cpp +++ b/source/blood/src/prediction.cpp @@ -550,8 +550,8 @@ static void fakeMoveDude(spritetype *pSprite) int nHitSprite = floorHit & 0x3fff; if ((sprite[nHitSprite].cstat & 0x30) == 0) { - predict.at5c += mulscale(4, predict.at50 - sprite[nHitSprite].x, 2); - predict.at60 += mulscale(4, predict.at54 - sprite[nHitSprite].y, 2); + predict.at5c += MulScale(4, predict.at50 - sprite[nHitSprite].x, 2); + predict.at60 += MulScale(4, predict.at54 - sprite[nHitSprite].y, 2); return; } } diff --git a/source/blood/src/view.cpp b/source/blood/src/view.cpp index 316c15eb4..f87860701 100644 --- a/source/blood/src/view.cpp +++ b/source/blood/src/view.cpp @@ -204,7 +204,7 @@ void CalcOtherPosition(spritetype *pSprite, int *pX, int *pY, int *pZ, int *vsec { int vX = MulScale(-Cos(nAng), 1280, 30); int vY = MulScale(-Sin(nAng), 1280, 30); - int vZ = FixedToInt(mulscale(zm, 1280, 3))-(16<<8); + int vZ = FixedToInt(MulScale(zm, 1280, 3))-(16<<8); int bakCstat = pSprite->cstat; pSprite->cstat &= ~256; assert(*vsectnum >= 0 && *vsectnum < kMaxSectors); @@ -250,7 +250,7 @@ void CalcPosition(spritetype *pSprite, int *pX, int *pY, int *pZ, int *vsectnum, { int vX = MulScale(-Cos(nAng), 1280, 30); int vY = MulScale(-Sin(nAng), 1280, 30); - int vZ = FixedToInt(mulscale(zm, 1280, 3))-(16<<8); + int vZ = FixedToInt(MulScale(zm, 1280, 3))-(16<<8); int bakCstat = pSprite->cstat; pSprite->cstat &= ~256; assert(*vsectnum >= 0 && *vsectnum < kMaxSectors); @@ -959,7 +959,7 @@ bool GameInterface::DrawAutomapPlayer(int x, int y, int z, int a, double const s GetZRange(pSprite, &ceilZ, &ceilHit, &floorZ, &floorHit, (pSprite->clipdist << 2) + 16, CLIPMASK0, PARALLAXCLIP_CEILING | PARALLAXCLIP_FLOOR); int nTop, nBottom; GetSpriteExtents(pSprite, &nTop, &nBottom); - int nScale = mulscale((pSprite->yrepeat + ((floorZ - nBottom) >> 8)) * z, yxaspect, 16); + int nScale = MulScale((pSprite->yrepeat + ((floorZ - nBottom) >> 8)) * z, yxaspect, 16); nScale = ClipRange(nScale, 8000, 65536 << 1); // Players on automap double x = xdim / 2. + x1 / double(1 << 12); diff --git a/source/blood/src/weapon.cpp b/source/blood/src/weapon.cpp index 05159cdf3..27109b58a 100644 --- a/source/blood/src/weapon.cpp +++ b/source/blood/src/weapon.cpp @@ -381,8 +381,8 @@ void UpdateAimVector(PLAYER * pPlayer) } int lx = x + MulScale(Cos(pPSprite->ang), nDist, 30); int ly = y + MulScale(Sin(pPSprite->ang), nDist, 30); - int lz = z + mulscale(pPlayer->slope, nDist, 10); - int zRange = mulscale(9460, nDist, 10); + int lz = z + MulScale(pPlayer->slope, nDist, 10); + int zRange = MulScale(9460, nDist, 10); int top, bottom; GetSpriteExtents(pSprite, &top, &bottom); if (lz-zRange>bottom || lz+zRangeang), nDist, 30); int ly = y + MulScale(Sin(pPSprite->ang), nDist, 30); - int lz = z + mulscale(pPlayer->slope, nDist, 10); + int lz = z + MulScale(pPlayer->slope, nDist, 10); int zRange = MulScale(9460, nDist, 10); int top, bottom; GetSpriteExtents(pSprite, &top, &bottom); diff --git a/source/build/include/pragmas.h b/source/build/include/pragmas.h index adecaf4a8..23d711731 100644 --- a/source/build/include/pragmas.h +++ b/source/build/include/pragmas.h @@ -36,9 +36,6 @@ static inline constexpr int ksgn(int32_t a) { return (a > 0) - (a < 0); } inline int sgn(int32_t a) { return (a > 0) - (a < 0); } -static inline int32_t mulscale(int32_t eax, int32_t edx, int32_t ecx) { return dw((qw(eax) * edx) >> by(ecx)); } -static inline double fmulscale(double eax, double edx, int32_t ecx) { return (eax * edx) / (double)(qw(1) << ecx); } - static inline int32_t krecipasm(int32_t i) { // Ken did this diff --git a/source/build/src/engine.cpp b/source/build/src/engine.cpp index 61387d6a4..b2ab56401 100644 --- a/source/build/src/engine.cpp +++ b/source/build/src/engine.cpp @@ -1802,8 +1802,8 @@ void renderDrawMapView(int32_t dax, int32_t day, int32_t zoome, int16_t ang) if ((1 << ox) != xspan) { ox++; - globalx1 = mulscale(globalx1,xspan,ox); - globaly1 = mulscale(globaly1,xspan,ox); + globalx1 = MulScale(globalx1,xspan,ox); + globaly1 = MulScale(globaly1,xspan,ox); } bak.x = (bak.x>>4)-(xdim<<7); bak.y = (bak.y>>4)-(ydim<<7); diff --git a/source/exhumed/src/map.cpp b/source/exhumed/src/map.cpp index 3486b1bb1..8d61d0e5d 100644 --- a/source/exhumed/src/map.cpp +++ b/source/exhumed/src/map.cpp @@ -91,7 +91,7 @@ bool GameInterface::DrawAutomapPlayer(int x, int y, int z, int a, double const s getzrange_old(pSprite->x, pSprite->y, pSprite->z, pSprite->sectnum, &ceilZ, &ceilHit, &floorZ, &floorHit, (pSprite->clipdist << 2) + 16, CLIPMASK0); int nTop, nBottom; GetSpriteExtents(pSprite, &nTop, &nBottom); - int nScale = mulscale((pSprite->yrepeat + ((floorZ - nBottom) >> 8)) * z, yxaspect, 16); + int nScale = MulScale((pSprite->yrepeat + ((floorZ - nBottom) >> 8)) * z, yxaspect, 16); nScale = clamp(nScale, 8000, 65536 << 1); // Players on automap double x = xdim / 2. + x1 / double(1 << 12); diff --git a/source/games/duke/src/actors_d.cpp b/source/games/duke/src/actors_d.cpp index 0058e3e38..9b34e6181 100644 --- a/source/games/duke/src/actors_d.cpp +++ b/source/games/duke/src/actors_d.cpp @@ -3951,8 +3951,8 @@ void move_d(DDukeActor *actor, int playernum, int xvel) } else { - ps[playernum].posxv = mulscale(ps[playernum].posxv, gs.playerfriction - 0x2000, 16); - ps[playernum].posyv = mulscale(ps[playernum].posyv, gs.playerfriction - 0x2000, 16); + ps[playernum].posxv = MulScale(ps[playernum].posxv, gs.playerfriction - 0x2000, 16); + ps[playernum].posyv = MulScale(ps[playernum].posyv, gs.playerfriction - 0x2000, 16); } } else if (spr->picnum != DRONE && spr->picnum != SHARK && spr->picnum != COMMANDER) diff --git a/source/games/duke/src/actors_r.cpp b/source/games/duke/src/actors_r.cpp index e560c43fa..ba1fab547 100644 --- a/source/games/duke/src/actors_r.cpp +++ b/source/games/duke/src/actors_r.cpp @@ -3916,8 +3916,8 @@ void move_r(DDukeActor *actor, int pnum, int xvel) } else { - ps[pnum].posxv = mulscale(ps[pnum].posxv, gs.playerfriction - 0x2000, 16); - ps[pnum].posyv = mulscale(ps[pnum].posyv, gs.playerfriction - 0x2000, 16); + ps[pnum].posxv = MulScale(ps[pnum].posxv, gs.playerfriction - 0x2000, 16); + ps[pnum].posyv = MulScale(ps[pnum].posyv, gs.playerfriction - 0x2000, 16); } } else if ((isRRRA() && spr->picnum != DRONE && spr->picnum != SHARK && spr->picnum != UFO1_RRRA) || diff --git a/source/games/duke/src/game_misc.cpp b/source/games/duke/src/game_misc.cpp index 77025289d..a7649ad86 100644 --- a/source/games/duke/src/game_misc.cpp +++ b/source/games/duke/src/game_misc.cpp @@ -572,7 +572,7 @@ bool GameInterface::DrawAutomapPlayer(int cposx, int cposy, int czoom, int cang, i = TILE_APLAYERTOP; j = klabs(pp.truefz - pp.posz) >> 8; - j = mulscale(czoom * (pspr->yrepeat + j), yxaspect, 16); + j = MulScale(czoom * (pspr->yrepeat + j), yxaspect, 16); if (j < 22000) j = 22000; else if (j > (65536 << 1)) j = (65536 << 1); diff --git a/source/games/duke/src/gameexec.cpp b/source/games/duke/src/gameexec.cpp index 5f56e39d1..b88b5f376 100644 --- a/source/games/duke/src/gameexec.cpp +++ b/source/games/duke/src/gameexec.cpp @@ -3161,7 +3161,7 @@ int ParseState::parse(void) int i; insptr++; i = *(insptr++); // ID of def - SetGameVarID(i, mulscale(rand(), *insptr, 15), g_ac, g_p); + SetGameVarID(i, MulScale(rand(), *insptr, 15), g_ac, g_p); insptr++; break; } @@ -3252,7 +3252,7 @@ int ParseState::parse(void) i = *(insptr++); // ID of def l1 = GetGameVarID(i, g_ac, g_p); // not used for this command l2 = GetGameVarID(*insptr, g_ac, g_p); - lResult = mulscale(rand(), l2, 15); + lResult = MulScale(rand(), l2, 15); SetGameVarID(i, lResult, g_ac, g_p); insptr++; break; diff --git a/source/games/duke/src/player.cpp b/source/games/duke/src/player.cpp index abdacf73a..aa42efa53 100644 --- a/source/games/duke/src/player.cpp +++ b/source/games/duke/src/player.cpp @@ -332,7 +332,7 @@ DDukeActor* aim(DDukeActor* actor, int aang) if ((dy1 * xv) <= (dx1 * yv)) if ((dy2 * xv) >= (dx2 * yv)) { - sdist = mulscale(dx3, xv, 14) + mulscale(dy3, yv, 14); + sdist = MulScale(dx3, xv, 14) + MulScale(dy3, yv, 14); if (sdist > 512 && sdist < smax) { if (s->picnum == TILE_APLAYER) diff --git a/source/games/duke/src/player_d.cpp b/source/games/duke/src/player_d.cpp index a441d036f..8f054dabd 100644 --- a/source/games/duke/src/player_d.cpp +++ b/source/games/duke/src/player_d.cpp @@ -885,7 +885,7 @@ static void shootlaser(DDukeActor* actor, int p, int sx, int sy, int sz, int sa) int lLifetimeVar = GetGameVar("STICKYBOMB_LIFETIME_VAR", NAM_GRENADE_LIFETIME_VAR, nullptr, p); // set timer. blows up when at zero.... bomb->s.extra = lLifetime - + mulscale(krand(), lLifetimeVar, 14) + + MulScale(krand(), lLifetimeVar, 14) - lLifetimeVar; } } @@ -2210,7 +2210,7 @@ static void operateweapon(int snum, ESyncBits actions, int psect) if (isNam()) { - spawned->s.extra = mulscale(krand(), NAM_GRENADE_LIFETIME_VAR, 14); + spawned->s.extra = MulScale(krand(), NAM_GRENADE_LIFETIME_VAR, 14); } if (k == 15) @@ -2999,20 +2999,20 @@ void processinput_d(int snum) else check = ((aplWeaponWorksLike[p->curr_weapon][snum] == KNEE_WEAPON && p->kickback_pic > 10 && p->on_ground) || (p->on_ground && (actions & SB_CROUCH))); if (check) { - p->posxv = mulscale(p->posxv, gs.playerfriction - 0x2000, 16); - p->posyv = mulscale(p->posyv, gs.playerfriction - 0x2000, 16); + p->posxv = MulScale(p->posxv, gs.playerfriction - 0x2000, 16); + p->posyv = MulScale(p->posyv, gs.playerfriction - 0x2000, 16); } else { if (psectlotag == 2) { - p->posxv = mulscale(p->posxv, gs.playerfriction - 0x1400, 16); - p->posyv = mulscale(p->posyv, gs.playerfriction - 0x1400, 16); + p->posxv = MulScale(p->posxv, gs.playerfriction - 0x1400, 16); + p->posyv = MulScale(p->posyv, gs.playerfriction - 0x1400, 16); } else { - p->posxv = mulscale(p->posxv, gs.playerfriction, 16); - p->posyv = mulscale(p->posyv, gs.playerfriction, 16); + p->posxv = MulScale(p->posxv, gs.playerfriction, 16); + p->posyv = MulScale(p->posyv, gs.playerfriction, 16); } } diff --git a/source/games/duke/src/player_r.cpp b/source/games/duke/src/player_r.cpp index b167ef746..faef5d2c4 100644 --- a/source/games/duke/src/player_r.cpp +++ b/source/games/duke/src/player_r.cpp @@ -3717,20 +3717,20 @@ void processinput_r(int snum) if (!isRRRA() && ((p->curr_weapon == KNEE_WEAPON && p->kickback_pic > 10 && p->on_ground) || (p->on_ground && (actions & SB_CROUCH)))) { - p->posxv = mulscale(p->posxv, gs.playerfriction - 0x2000, 16); - p->posyv = mulscale(p->posyv, gs.playerfriction - 0x2000, 16); + p->posxv = MulScale(p->posxv, gs.playerfriction - 0x2000, 16); + p->posyv = MulScale(p->posyv, gs.playerfriction - 0x2000, 16); } else { if (psectlotag == 2) { - p->posxv = mulscale(p->posxv, gs.playerfriction - 0x1400, 16); - p->posyv = mulscale(p->posyv, gs.playerfriction - 0x1400, 16); + p->posxv = MulScale(p->posxv, gs.playerfriction - 0x1400, 16); + p->posyv = MulScale(p->posyv, gs.playerfriction - 0x1400, 16); } else { - p->posxv = mulscale(p->posxv, gs.playerfriction, 16); - p->posyv = mulscale(p->posyv, gs.playerfriction, 16); + p->posxv = MulScale(p->posxv, gs.playerfriction, 16); + p->posyv = MulScale(p->posyv, gs.playerfriction, 16); } } @@ -3751,8 +3751,8 @@ void processinput_r(int snum) p->boot_amount--; else { - p->posxv = mulscale(p->posxv, gs.playerfriction, 16); - p->posyv = mulscale(p->posyv, gs.playerfriction, 16); + p->posxv = MulScale(p->posxv, gs.playerfriction, 16); + p->posyv = MulScale(p->posyv, gs.playerfriction, 16); } } else @@ -3763,8 +3763,8 @@ void processinput_r(int snum) { if (p->on_ground) { - p->posxv = mulscale(p->posxv, gs.playerfriction - 0x1800, 16); - p->posyv = mulscale(p->posyv, gs.playerfriction - 0x1800, 16); + p->posxv = MulScale(p->posxv, gs.playerfriction - 0x1800, 16); + p->posyv = MulScale(p->posyv, gs.playerfriction - 0x1800, 16); } } else @@ -3772,8 +3772,8 @@ void processinput_r(int snum) p->boot_amount--; else { - p->posxv = mulscale(p->posxv, gs.playerfriction - 0x1800, 16); - p->posyv = mulscale(p->posyv, gs.playerfriction - 0x1800, 16); + p->posxv = MulScale(p->posxv, gs.playerfriction - 0x1800, 16); + p->posyv = MulScale(p->posyv, gs.playerfriction - 0x1800, 16); } } diff --git a/source/games/duke/src/player_w.cpp b/source/games/duke/src/player_w.cpp index 6db299b2f..52947b3af 100644 --- a/source/games/duke/src/player_w.cpp +++ b/source/games/duke/src/player_w.cpp @@ -352,7 +352,7 @@ void operateweapon_ww(int snum, ESyncBits actions, int psect) int lGrenadeLifetimeVar = GetGameVar("GRENADE_LIFETIME_VAR", NAM_GRENADE_LIFETIME_VAR, nullptr, snum); // set timer. blows up when at zero.... j->s.extra = lGrenadeLifetime - + mulscale(krand(), lGrenadeLifetimeVar, 14) + + MulScale(krand(), lGrenadeLifetimeVar, 14) - lGrenadeLifetimeVar; } diff --git a/source/sw/src/player.cpp b/source/sw/src/player.cpp index f65d5f85d..30a1d3927 100644 --- a/source/sw/src/player.cpp +++ b/source/sw/src/player.cpp @@ -1660,8 +1660,8 @@ void SlipSlope(PLAYERp pp) ang = NORM_ANGLE(ang + 512); - pp->xvect += mulscale(bcos(ang), sector[pp->cursectnum].floorheinum, sectu->speed); - pp->yvect += mulscale(bsin(ang), sector[pp->cursectnum].floorheinum, sectu->speed); + pp->xvect += MulScale(bcos(ang), sector[pp->cursectnum].floorheinum, sectu->speed); + pp->yvect += MulScale(bsin(ang), sector[pp->cursectnum].floorheinum, sectu->speed); } void