diff --git a/source/blood/src/actor.cpp b/source/blood/src/actor.cpp index 14c1f62dc..3cbdcefe7 100644 --- a/source/blood/src/actor.cpp +++ b/source/blood/src/actor.cpp @@ -2627,8 +2627,8 @@ int actFloorBounceVector(int *x, int *y, int *z, int nSector, int a5) int angle = getangle(pWall2->x-pWall->x, pWall2->y-pWall->y)+512; int t2 = sector[nSector].floorheinum<<4; int t3 = approxDist(-0x10000, t2); - int t4 = divscale16(-0x10000, t3); - int t5 = divscale16(t2, t3); + int t4 = DivScale(-0x10000, t3, 16); + int t5 = DivScale(t2, t3, 16); int t6 = MulScale(t5, Cos(angle), 30); int t7 = MulScale(t5, Sin(angle), 30); int t8 = TMulScale(*x, t6, *y, t7, *z, t4, 16); @@ -4488,7 +4488,7 @@ int MoveThing(spritetype *pSprite) } if (nVel > 0) { - int t = divscale16(nVelClipped, nVel); + int t = DivScale(nVelClipped, nVel, 16); xvel[nSprite] -= MulScale(t, xvel[nSprite], 16); yvel[nSprite] -= MulScale(t, yvel[nSprite], 16); } @@ -5743,7 +5743,7 @@ void actProcessSprites(void) int dy = (y - pSprite2->y)>>4; int dz = (z - pSprite2->z)>>8; int nDist = dx*dx+dy*dy+dz*dz+0x40000; - int t = divscale16(pXSprite->data2, nDist); + int t = DivScale(pXSprite->data2, nDist, 16); gPlayer[p].flickerEffect += t; } diff --git a/source/blood/src/gameutil.cpp b/source/blood/src/gameutil.cpp index 9360f34bc..b01238f5c 100644 --- a/source/blood/src/gameutil.cpp +++ b/source/blood/src/gameutil.cpp @@ -332,8 +332,8 @@ void GetWallNormal(int nWall, int *pX, int *pY) int nLength = ksqrt(dX*dX+dY*dY); if (nLength <= 0) nLength = 1; - *pX = divscale16(dX, nLength); - *pY = divscale16(dY, nLength); + *pX = DivScale(dX, nLength, 16); + *pY = DivScale(dY, nLength, 16); } bool IntersectRay(int wx, int wy, int wdx, int wdy, int x1, int y1, int z1, int x2, int y2, int z2, int *ix, int *iy, int *iz) @@ -362,7 +362,7 @@ bool IntersectRay(int wx, int wy, int wdx, int wdy, int x1, int y1, int z1, int if (check2 > 0 || check2 <= side) return 0; } - int nScale = divscale16(check2, side); + int nScale = DivScale(check2, side, 16); *ix = x1 + MulScale(dX, nScale, 16); *iy = y1 + MulScale(dY, nScale, 16); *iz = z1 + MulScale(dZ, nScale, 16); diff --git a/source/blood/src/nnexts.cpp b/source/blood/src/nnexts.cpp index 4cdf85f44..3fe6386d2 100644 --- a/source/blood/src/nnexts.cpp +++ b/source/blood/src/nnexts.cpp @@ -1220,7 +1220,7 @@ void debrisMove(int listIndex) { } if (nVel > 0) { - int t = divscale16(nVelClipped, nVel); + int t = DivScale(nVelClipped, nVel, 16); xvel[nSprite] -= MulScale(t, xvel[nSprite], 16); yvel[nSprite] -= MulScale(t, yvel[nSprite], 16); } diff --git a/source/blood/src/player.cpp b/source/blood/src/player.cpp index 15d6a92af..25ff32369 100644 --- a/source/blood/src/player.cpp +++ b/source/blood/src/player.cpp @@ -1399,7 +1399,7 @@ void ProcessInput(PLAYER *pPlayer) { int speed = 0x10000; if (pXSprite->height > 0) - speed -= divscale16(pXSprite->height, 256); + speed -= DivScale(pXSprite->height, 256, 16); int x = Cos(pSprite->ang); int y = Sin(pSprite->ang); if (pInput->fvel) diff --git a/source/blood/src/prediction.cpp b/source/blood/src/prediction.cpp index 18d6e972c..0ef5f6232 100644 --- a/source/blood/src/prediction.cpp +++ b/source/blood/src/prediction.cpp @@ -139,7 +139,7 @@ static void fakeProcessInput(PLAYER *pPlayer, InputPacket *pInput) { int speed = 0x10000; if (predict.at6a > 0) - speed -= divscale16(predict.at6a, 0x100); + speed -= DivScale(predict.at6a, 0x100, 16); int x = Cos(predict.at30.asbuild()); int y = Sin(predict.at30.asbuild()); if (pInput->fvel) diff --git a/source/blood/src/triggers.cpp b/source/blood/src/triggers.cpp index e6257b971..882b29fba 100644 --- a/source/blood/src/triggers.cpp +++ b/source/blood/src/triggers.cpp @@ -506,7 +506,7 @@ void OperateSprite(int nSprite, XSPRITE *pXSprite, EVENT event) int dy = (pSprite->y - pPlayerSprite->y)>>4; int dz = (pSprite->z - pPlayerSprite->z)>>8; int nDist = dx*dx+dy*dy+dz*dz+0x40000; - gPlayer[p].quakeEffect = divscale16(pXSprite->data1, nDist); + gPlayer[p].quakeEffect = DivScale(pXSprite->data1, nDist, 16); } break; case kThingTNTBarrel: diff --git a/source/blood/src/view.cpp b/source/blood/src/view.cpp index 2f67f3f6c..316c15eb4 100644 --- a/source/blood/src/view.cpp +++ b/source/blood/src/view.cpp @@ -227,11 +227,11 @@ void CalcOtherPosition(spritetype *pSprite, int *pX, int *pY, int *pZ, int *vsec int nDist; if (klabs(vX) > klabs(vY)) { - nDist = ClipHigh(divscale16(dX,vX), othercameradist); + nDist = ClipHigh(DivScale(dX,vX, 16), othercameradist); } else { - nDist = ClipHigh(divscale16(dY,vY), othercameradist); + nDist = ClipHigh(DivScale(dY,vY, 16), othercameradist); } othercameradist = nDist; } @@ -274,11 +274,11 @@ void CalcPosition(spritetype *pSprite, int *pX, int *pY, int *pZ, int *vsectnum, int nDist; if (klabs(vX) > klabs(vY)) { - nDist = ClipHigh(divscale16(dX,vX), cameradist); + nDist = ClipHigh(DivScale(dX,vX, 16), cameradist); } else { - nDist = ClipHigh(divscale16(dY,vY), cameradist); + nDist = ClipHigh(DivScale(dY,vY, 16), cameradist); } cameradist = nDist; } diff --git a/source/blood/src/weapon.cpp b/source/blood/src/weapon.cpp index 73d50acd0..05159cdf3 100644 --- a/source/blood/src/weapon.cpp +++ b/source/blood/src/weapon.cpp @@ -1818,7 +1818,7 @@ int processSprayCan(PLAYER *pPlayer) return 1; case 7: { - pPlayer->throwPower = ClipHigh(divscale16(gFrameClock-pPlayer->throwTime,240), 65536); + pPlayer->throwPower = ClipHigh(DivScale(gFrameClock-pPlayer->throwTime,240, 16), 65536); if (!(pPlayer->input.actions & SB_FIRE)) { if (!pPlayer->fuseTime) @@ -1856,7 +1856,7 @@ char processTNT(PLAYER *pPlayer) return 1; case 6: { - pPlayer->throwPower = ClipHigh(divscale16(gFrameClock-pPlayer->throwTime,240), 65536); + pPlayer->throwPower = ClipHigh(DivScale(gFrameClock-pPlayer->throwTime,240, 16), 65536); if (!(pPlayer->input.actions & SB_FIRE)) { if (!pPlayer->fuseTime) @@ -1875,7 +1875,7 @@ char processProxy(PLAYER *pPlayer) switch (pPlayer->weaponState) { case 9: - pPlayer->throwPower = ClipHigh(divscale16(gFrameClock-pPlayer->throwTime,240), 65536); + pPlayer->throwPower = ClipHigh(DivScale(gFrameClock-pPlayer->throwTime,240, 16), 65536); pPlayer->weaponTimer = 0; if (!(pPlayer->input.actions & SB_FIRE)) { @@ -1892,7 +1892,7 @@ char processRemote(PLAYER *pPlayer) switch (pPlayer->weaponState) { case 13: - pPlayer->throwPower = ClipHigh(divscale16(gFrameClock-pPlayer->throwTime,240), 65536); + pPlayer->throwPower = ClipHigh(DivScale(gFrameClock-pPlayer->throwTime,240, 16), 65536); if (!(pPlayer->input.actions & SB_FIRE)) { pPlayer->weaponState = 11; diff --git a/source/build/include/pragmas.h b/source/build/include/pragmas.h index c37614816..965cc1bda 100644 --- a/source/build/include/pragmas.h +++ b/source/build/include/pragmas.h @@ -10,17 +10,6 @@ #ifndef pragmas_h_ #define pragmas_h_ - -#define EDUKE32_GENERATE_PRAGMAS \ - EDUKE32_SCALER_PRAGMA(1) EDUKE32_SCALER_PRAGMA(2) EDUKE32_SCALER_PRAGMA(3) EDUKE32_SCALER_PRAGMA(4) \ - EDUKE32_SCALER_PRAGMA(5) EDUKE32_SCALER_PRAGMA(6) EDUKE32_SCALER_PRAGMA(7) EDUKE32_SCALER_PRAGMA(8) \ - EDUKE32_SCALER_PRAGMA(9) EDUKE32_SCALER_PRAGMA(10) EDUKE32_SCALER_PRAGMA(11) EDUKE32_SCALER_PRAGMA(12) \ - EDUKE32_SCALER_PRAGMA(13) EDUKE32_SCALER_PRAGMA(14) EDUKE32_SCALER_PRAGMA(15) EDUKE32_SCALER_PRAGMA(16) \ - EDUKE32_SCALER_PRAGMA(17) EDUKE32_SCALER_PRAGMA(18) EDUKE32_SCALER_PRAGMA(19) EDUKE32_SCALER_PRAGMA(20) \ - EDUKE32_SCALER_PRAGMA(21) EDUKE32_SCALER_PRAGMA(22) EDUKE32_SCALER_PRAGMA(23) EDUKE32_SCALER_PRAGMA(24) \ - EDUKE32_SCALER_PRAGMA(25) EDUKE32_SCALER_PRAGMA(26) EDUKE32_SCALER_PRAGMA(27) EDUKE32_SCALER_PRAGMA(28) \ - EDUKE32_SCALER_PRAGMA(29) EDUKE32_SCALER_PRAGMA(30) EDUKE32_SCALER_PRAGMA(31) EDUKE32_SCALER_PRAGMA(32) - extern int32_t reciptable[2048]; // break the C version of divscale out from the others @@ -36,12 +25,6 @@ extern int32_t reciptable[2048]; static inline int32_t divscale(int32_t eax, int32_t ebx, int32_t ecx) { return (int64_t(eax) << ecx) / ebx; } static inline double fdivscale(double eax, double ebx, int32_t ecx) { return (eax * (double)(qw(1) << ecx)) / ebx; } -#define EDUKE32_SCALER_PRAGMA(a) \ - static FORCE_INLINE int32_t divscale##a(int32_t eax, int32_t ebx) { return divscale(eax, ebx, a); } \ - static FORCE_INLINE double fdivscale##a(double eax, double ebx) { return fdivscale(eax, ebx, a); } -EDUKE32_GENERATE_PRAGMAS -#undef EDUKE32_SCALER_PRAGMA - static inline int32_t scale(int32_t eax, int32_t edx, int32_t ecx) { return int64_t(eax) * edx / ecx; diff --git a/source/build/src/clip.cpp b/source/build/src/clip.cpp index f5c8ed9b9..8dfec49d4 100644 --- a/source/build/src/clip.cpp +++ b/source/build/src/clip.cpp @@ -184,7 +184,7 @@ int32_t getceilzofslope_old(int32_t sectnum, int32_t dax, int32_t day) dx = wall[wall[j].point2].x-wall[j].x; dy = wall[wall[j].point2].y-wall[j].y; i = (ksqrtasm_old(dx*dx+dy*dy)); if (i == 0) return(sector[sectnum].ceilingz); - i = divscale15(sector[sectnum].ceilingheinum,i); + i = DivScale(sector[sectnum].ceilingheinum,i, 15); dx *= i; dy *= i; return sector[sectnum].ceilingz+DMulScale(dx,day-wall[j].y,-dy,dax-wall[j].x, 23); } @@ -198,7 +198,7 @@ int32_t getflorzofslope_old(int32_t sectnum, int32_t dax, int32_t day) dx = wall[wall[j].point2].x-wall[j].x; dy = wall[wall[j].point2].y-wall[j].y; i = (ksqrtasm_old(dx*dx+dy*dy)); if (i == 0) return sector[sectnum].floorz; - i = divscale15(sector[sectnum].floorheinum,i); + i = DivScale(sector[sectnum].floorheinum,i, 15); dx *= i; dy *= i; return sector[sectnum].floorz+DMulScale(dx,day-wall[j].y,-dy,dax-wall[j].x, 23); } @@ -920,7 +920,7 @@ int pushmove(vec3_t *const vect, int16_t *const sectnum, else { daz2 = dax*dax+day*day; - if (daz >= daz2) t = (1<<30); else t = divscale30(daz, daz2); + if (daz >= daz2) t = (1<<30); else t = DivScale(daz, daz2, 30); } dax = wal->x + MulScale(dax, t, 30); day = wal->y + MulScale(day, t, 30); @@ -1241,7 +1241,7 @@ static int32_t hitscan_trysector(const vec3_t *sv, usectorptr_t sec, hitdata_t * int32_t j, dax=wal2->x-wal->x, day=wal2->y-wal->y; i = nsqrtasm(compat_maybe_truncate_to_int32(uhypsq(dax,day))); if (i == 0) return 1; //continue; - i = divscale15(heinum,i); + i = DivScale(heinum,i, 15); dax *= i; day *= i; j = (vz<<8)-DMulScale(dax,vy,-day,vx, 15); @@ -1250,7 +1250,7 @@ static int32_t hitscan_trysector(const vec3_t *sv, usectorptr_t sec, hitdata_t * 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); + i = DivScale(i,j, 30); x1 = sv->x + MulScale(vx,i, 30); y1 = sv->y + MulScale(vy,i, 30); z1 = sv->z + MulScale(vz,i, 30); @@ -1262,7 +1262,7 @@ static int32_t hitscan_trysector(const vec3_t *sv, usectorptr_t sec, hitdata_t * z1 = z; i = z1-sv->z; if ((klabs(i)>>1) < vz*how) { - i = divscale30(i,vz); + i = DivScale(i,vz, 30); x1 = sv->x + MulScale(vx,i, 30); y1 = sv->y + MulScale(vy,i, 30); } @@ -1477,7 +1477,7 @@ int32_t hitscan(const vec3_t *sv, int16_t sectnum, int32_t vx, int32_t vy, int32 { // daz-intz > 0 && daz-intz < k int32_t xtex = MulScale(ucoefup16, tileWidth(tilenum), 16); - int32_t vcoefup16 = 65536-divscale16(daz-intz, k); + int32_t vcoefup16 = 65536-DivScale(daz-intz, k, 16); int32_t ytex = MulScale(vcoefup16, tileHeight(tilenum), 16); auto texel = (tilePtr(tilenum) + tileHeight(tilenum)*xtex + ytex); diff --git a/source/build/src/engine.cpp b/source/build/src/engine.cpp index 3580701ff..61387d6a4 100644 --- a/source/build/src/engine.cpp +++ b/source/build/src/engine.cpp @@ -390,7 +390,7 @@ static int32_t engineLoadTables(void) initksqrt(); for (i=0; i<2048; i++) - reciptable[i] = divscale30(2048, i+2048); + reciptable[i] = DivScale(2048, i+2048, 30); for (i=0; i<=512; i++) sintable[i] = bsinf(i); @@ -726,12 +726,12 @@ int32_t rintersect_old(int32_t x1, int32_t y1, int32_t z1, else if (bot < 0 && (topt > 0 || topu > 0 || topu <= bot)) return -1; - int32_t t = divscale16(topt, bot); + int32_t t = DivScale(topt, bot, 16); *intx = x1 + MulScale(vx, t, 16); *inty = y1 + MulScale(vy, t, 16); *intz = z1 + MulScale(vz, t, 16); - t = divscale16(topu, bot); + t = DivScale(topu, bot, 16); return t; } @@ -1012,7 +1012,7 @@ int32_t renderDrawRoomsQ16(int32_t daposx, int32_t daposy, int32_t daposz, // xdimenscale is scale(xdimen,yxaspect,320); // normalization by viewingrange so that center-of-aim doesn't depend on it - qglobalhoriz = MulScale(dahoriz, divscale16(xdimenscale, viewingrange), 16)+IntToFixed(ydimen>>1); + qglobalhoriz = MulScale(dahoriz, DivScale(xdimenscale, viewingrange, 16), 16)+IntToFixed(ydimen>>1); globalcursectnum = dacursectnum; @@ -1590,7 +1590,7 @@ void renderDrawMapView(int32_t dax, int32_t day, int32_t zoome, int16_t ang) int32_t const oyxaspect = yxaspect, oviewingrange = viewingrange; - renderSetAspect(65536, divscale16((320*5)/8, 200)); + renderSetAspect(65536, DivScale((320*5)/8, 200, 16)); memset(gotsector, 0, sizeof(gotsector)); @@ -1599,7 +1599,7 @@ void renderDrawMapView(int32_t dax, int32_t day, int32_t zoome, int16_t ang) zoome <<= 8; - vec2_t const bakgvect = { divscale28(-bcos(ang), zoome), divscale28(-bsin(ang), zoome) }; + vec2_t const bakgvect = { DivScale(-bcos(ang), zoome, 28), DivScale(-bsin(ang), zoome, 28) }; vec2_t const vect = { MulScale(-bsin(ang), zoome, 8), MulScale(-bcos(ang), zoome, 8) }; vec2_t const vect2 = { MulScale(vect.x, yxaspect, 16), MulScale(vect.y, yxaspect, 16) }; @@ -2309,7 +2309,7 @@ int32_t cansee(int32_t x1, int32_t y1, int32_t z1, int16_t sect1, int32_t x2, in if (nexts < 0 || wal->cstat&32) return 0; - t = divscale24(t,bot); + t = DivScale(t,bot, 24); x = x1 + MulScale(x21,t, 24); y = y1 + MulScale(y21,t, 24); z = z1 + MulScale(z21,t, 24); @@ -2856,7 +2856,7 @@ void videoSetCorrectedAspect() x = xdim; y = ydim; - vr = divscale16(x*3, y*4); + vr = DivScale(x*3, y*4, 16); renderSetAspect(vr, yx); } @@ -2872,7 +2872,7 @@ void videoSetViewableArea(int32_t x1, int32_t y1, int32_t x2, int32_t y2) windowxy2.y = y2; xdimen = (x2-x1)+1; halfxdimen = (xdimen>>1); - xdimenrecip = divscale32(1L,xdimen); + xdimenrecip = DivScale(1L,xdimen, 32); ydimen = (y2-y1)+1; fxdimen = (float) xdimen; @@ -2890,13 +2890,13 @@ void renderSetAspect(int32_t daxrange, int32_t daaspect) { if (daxrange == 65536) daxrange--; // This doesn't work correctly with 65536. All other values are fine. No idea where this is evaluated wrong. viewingrange = daxrange; - viewingrangerecip = divscale32(1,daxrange); + viewingrangerecip = DivScale(1,daxrange, 32); #ifdef USE_OPENGL fviewingrange = (float) daxrange; #endif yxaspect = daaspect; - xyaspect = divscale32(1,yxaspect); + xyaspect = DivScale(1,yxaspect, 32); xdimenscale = scale(xdimen,yxaspect,320); xdimscale = scale(320,xyaspect,xdimen); } diff --git a/source/build/src/polymost.cpp b/source/build/src/polymost.cpp index 28ade05a6..35a992686 100644 --- a/source/build/src/polymost.cpp +++ b/source/build/src/polymost.cpp @@ -2433,7 +2433,7 @@ void polymost_drawrooms() ghalfy = (float)(ydimen>>1); grhalfxdown10 = 1.f/(ghalfx*1024.f); ghoriz = FixedToFloat(qglobalhoriz); - ghorizcorrect = FixedToFloat(divscale16(xdimenscale, viewingrange)); + ghorizcorrect = FixedToFloat(DivScale(xdimenscale, viewingrange, 16)); //global cos/sin height angle if (r_yshearing) @@ -2813,7 +2813,7 @@ void polymost_prepareMirror(int32_t dax, int32_t day, int32_t daz, fixed_t daang set_globalpos(dax, day, daz); set_globalang(daang); - qglobalhoriz = MulScale(dahoriz, divscale16(xdimenscale, viewingrange), 16)+IntToFixed(ydimen>>1); + qglobalhoriz = MulScale(dahoriz, DivScale(xdimenscale, viewingrange, 16), 16)+IntToFixed(ydimen>>1); gyxscale = ((float)xdimenscale)*(1.0f/131072.f); gxyaspect = ((double)xyaspect*fviewingrange)*(5.0/(65536.0*262144.0)); gviewxrange = fviewingrange * fxdimen * (1.f/(32768.f*1024.f)); @@ -2825,7 +2825,7 @@ void polymost_prepareMirror(int32_t dax, int32_t day, int32_t daz, fixed_t daang ghalfy = (float)(ydimen>>1); grhalfxdown10 = 1.f/(ghalfx*1024.f); ghoriz = FixedToFloat(qglobalhoriz); - ghorizcorrect = FixedToFloat(divscale16(xdimenscale, viewingrange)); + ghorizcorrect = FixedToFloat(DivScale(xdimenscale, viewingrange, 16)); resizeglcheck(); if (r_yshearing) { diff --git a/source/core/automap.cpp b/source/core/automap.cpp index 6e28f3cc1..24a61a62d 100644 --- a/source/core/automap.cpp +++ b/source/core/automap.cpp @@ -562,7 +562,7 @@ void DrawOverheadMap(int pl_x, int pl_y, int pl_angle, double const smoothratio) renderDrawMapView(x, y, gZoom, follow_a); } int32_t tmpydim = (xdim * 5) / 8; - renderSetAspect(65536, divscale16(tmpydim * 320, xdim * 200)); + renderSetAspect(65536, DivScale(tmpydim * 320, xdim * 200, 16)); drawredlines(x, y, gZoom, follow_a); drawwhitelines(x, y, gZoom, follow_a); diff --git a/source/exhumed/src/view.cpp b/source/exhumed/src/view.cpp index e85280a3c..bc0b0c76b 100644 --- a/source/exhumed/src/view.cpp +++ b/source/exhumed/src/view.cpp @@ -381,7 +381,7 @@ void DrawView(double smoothRatio, bool sceneonly) } - renderSetAspect(viewingRange, divscale16(ydim * 8, xdim * 5)); + renderSetAspect(viewingRange, DivScale(ydim * 8, xdim * 5, 16)); if (nFreeze) { diff --git a/source/games/duke/src/actors.cpp b/source/games/duke/src/actors.cpp index 163b8c1e4..98bc88bc3 100644 --- a/source/games/duke/src/actors.cpp +++ b/source/games/duke/src/actors.cpp @@ -1322,7 +1322,7 @@ void bounce(DDukeActor* actor) l = dax * dax + day * day + daz * daz; if ((abs(k) >> 14) < l) { - k = divscale17(k, l); + k = DivScale(k, l, 17); xvect -= MulScale(dax, k, 16); yvect -= MulScale(day, k, 16); zvect -= MulScale(daz, k, 16); diff --git a/source/games/duke/src/player.cpp b/source/games/duke/src/player.cpp index e2b89f750..abdacf73a 100644 --- a/source/games/duke/src/player.cpp +++ b/source/games/duke/src/player.cpp @@ -1114,8 +1114,8 @@ bool view(struct player_struct* pp, int* vx, int* vy, int* vz, short* vsectnum, if (abs(nx) > abs(ny)) hx -= (nx >> 5); else hy -= (ny >> 5); } - if (abs(nx) > abs(ny)) i = divscale16(hx, nx); - else i = divscale16(hy, ny); + if (abs(nx) > abs(ny)) i = DivScale(hx, nx, 16); + else i = DivScale(hy, ny, 16); if (i < cameradist) cameradist = i; } *vx = (*vx) + MulScale(nx, cameradist, 16); diff --git a/source/games/duke/src/render.cpp b/source/games/duke/src/render.cpp index daa024c6b..a977e8071 100644 --- a/source/games/duke/src/render.cpp +++ b/source/games/duke/src/render.cpp @@ -529,7 +529,7 @@ void displayrooms(int snum, double smoothratio) else { // Fixme: This should get the aspect ratio from the backend, not the current viewport size. - int i = divscale22(1, isRR() ? 64 : p->GetActor()->s.yrepeat + 28); + int i = DivScale(1, isRR() ? 64 : p->GetActor()->s.yrepeat + 28, 22); int viewingaspect = !isRRRA() || !p->DrugMode ? xs_CRoundToInt(double(i) * tan(r_fov * (pi::pi() / 360.))) : getdrugmode(p, i); renderSetAspect(MulScale(viewingaspect, viewingrange, 16), yxaspect); diff --git a/source/games/duke/src/sounds.cpp b/source/games/duke/src/sounds.cpp index dc3f2df53..a21b1ad40 100644 --- a/source/games/duke/src/sounds.cpp +++ b/source/games/duke/src/sounds.cpp @@ -287,7 +287,7 @@ static int GetPositionInfo(DDukeActor* actor, int soundNum, int sectNum, orgsndist = sndist = int(16 * (sndorg - campos).Length()); if ((userflags & (SF_GLOBAL | SF_DTAG)) != SF_GLOBAL && sp->picnum == MUSICANDSFX && sp->lotag < 999 && (sector[sp->sectnum].lotag & 0xff) < ST_9_SLIDING_ST_DOOR) - sndist = divscale14(sndist, sp->hitag + 1); + sndist = DivScale(sndist, sp->hitag + 1, 14); } sndist += dist_adjust; diff --git a/source/sw/src/draw.cpp b/source/sw/src/draw.cpp index 07e7677c1..bcca8bcb0 100644 --- a/source/sw/src/draw.cpp +++ b/source/sw/src/draw.cpp @@ -1771,7 +1771,7 @@ drawscreen(PLAYERp pp, double smoothratio) renderDrawMasks(); - renderSetAspect(viewingRange, divscale16(ydim * 8, xdim * 5)); + renderSetAspect(viewingRange, DivScale(ydim * 8, xdim * 5, 16)); if (!ScreenSavePic) UpdatePanel(smoothratio); #define SLIME 2305 diff --git a/source/sw/src/quake.cpp b/source/sw/src/quake.cpp index 40e8d3b6c..d15e03687 100644 --- a/source/sw/src/quake.cpp +++ b/source/sw/src/quake.cpp @@ -240,7 +240,7 @@ void QuakeViewChange(PLAYERp pp, int *z_diff, int *x_diff, int *y_diff, short *a { // scale values from epicenter dist_diff = radius - save_dist; - scale_value = divscale16(dist_diff, radius); + scale_value = DivScale(dist_diff, radius, 16); *z_diff = MulScale(*z_diff, scale_value, 16); *ang_diff = MulScale(*ang_diff, scale_value, 16); diff --git a/source/sw/src/weapon.cpp b/source/sw/src/weapon.cpp index 1c9831802..1f49a0d6f 100644 --- a/source/sw/src/weapon.cpp +++ b/source/sw/src/weapon.cpp @@ -8901,7 +8901,7 @@ bool SlopeBounce(short SpriteNum, bool *hit_wall) // make sure divscale doesn't overflow if ((klabs(k)>>14) < l) { - k = divscale17(k, l); + k = DivScale(k, l, 17); u->xchange -= MulScale(dax, k, 16); u->ychange -= MulScale(day, k, 16); u->zchange -= MulScale(daz, k, 12);