- Replace mulscale##() calls with MulScale() from common.

* Regex for reference: mulscale([0-9]+)\((.+)(\)+)
This commit is contained in:
Mitchell Richters 2021-01-04 22:36:54 +11:00
parent 8cf2588bad
commit 2396179dfc
74 changed files with 781 additions and 794 deletions

View file

@ -2464,7 +2464,7 @@ void actInitDudes()
for (int i = 0; i < kDudeMax - kDudeBase; i++)
for (int j = 0; j < 7; j++)
dudeInfo[i].at70[j] = mulscale8(DudeDifficulty[gGameOptions.nDifficulty], dudeInfo[i].startDamage[j]);
dudeInfo[i].at70[j] = MulScale(DudeDifficulty[gGameOptions.nDifficulty], dudeInfo[i].startDamage[j], 8);
it.Reset(kStatDude);
while (auto act = it.Next())
@ -2589,9 +2589,9 @@ void ConcussSprite(int a1, spritetype *pSprite, int x, int y, int z, int a6)
assert(mass > 0);
int t = scale(a6, size, mass);
dx = mulscale16(t, dx);
dy = mulscale16(t, dy);
dz = mulscale16(t, dz);
dx = MulScale(t, dx, 16);
dy = MulScale(t, dy, 16);
dz = MulScale(t, dz, 16);
int nSprite = pSprite->index;
assert(nSprite >= 0 && nSprite < kMaxSprites);
xvel[nSprite] += dx;
@ -2608,8 +2608,8 @@ int actWallBounceVector(int *x, int *y, int nWall, int a4)
GetWallNormal(nWall, &wx, &wy);
int t = DMulScale(*x, wx, *y, wy, 16);
int t2 = mulscale16r(t, a4+0x10000);
*x -= mulscale16(wx, t2);
*y -= mulscale16(wy, t2);
*x -= MulScale(wx, t2, 16);
*y -= MulScale(wy, t2, 16);
return mulscale16r(t, 0x10000-a4);
}
@ -2618,7 +2618,7 @@ int actFloorBounceVector(int *x, int *y, int *z, int nSector, int a5)
int t = 0x10000-a5;
if (sector[nSector].floorheinum == 0)
{
int t2 = mulscale16(*z, t);
int t2 = MulScale(*z, t, 16);
*z = -(*z-t2);
return t2;
}
@ -2629,13 +2629,13 @@ int actFloorBounceVector(int *x, int *y, int *z, int nSector, int a5)
int t3 = approxDist(-0x10000, t2);
int t4 = divscale16(-0x10000, t3);
int t5 = divscale16(t2, t3);
int t6 = mulscale30(t5, Cos(angle));
int t7 = mulscale30(t5, Sin(angle));
int t6 = MulScale(t5, Cos(angle), 30);
int t7 = MulScale(t5, Sin(angle), 30);
int t8 = TMulScale(*x, t6, *y, t7, *z, t4, 16);
int t9 = mulscale16(t8, 0x10000+a5);
*x -= mulscale16(t6, t9);
*y -= mulscale16(t7, t9);
*z -= mulscale16(t4, t9);
int t9 = MulScale(t8, 0x10000+a5, 16);
*x -= MulScale(t6, t9, 16);
*y -= MulScale(t7, t9, 16);
*z -= MulScale(t4, t9, 16);
return mulscale16r(t8, t);
}
@ -3491,7 +3491,7 @@ int actDamageSprite(int nSource, spritetype *pSprite, DAMAGE_TYPE damageType, in
if (!nDamageFactor) return 0;
else if (nDamageFactor != 256)
damage = mulscale8(damage, nDamageFactor);
damage = MulScale(damage, nDamageFactor, 8);
if (!IsPlayerSprite(pSprite)) {
@ -3515,7 +3515,7 @@ int actDamageSprite(int nSource, spritetype *pSprite, DAMAGE_TYPE damageType, in
if (!nDamageFactor) return 0;
else if (nDamageFactor != 256)
damage = mulscale8(damage, nDamageFactor);
damage = MulScale(damage, nDamageFactor, 8);
pXSprite->health = ClipLow(pXSprite->health - damage, 0);
if (pXSprite->health <= 0) {
@ -3951,8 +3951,8 @@ void actKickObject(spritetype *pSprite1, spritetype *pSprite2)
int nSprite1 = pSprite1->index;
int nSprite2 = pSprite2->index;
int nSpeed = ClipLow(approxDist(xvel[nSprite1], yvel[nSprite1])*2, 0xaaaaa);
xvel[nSprite2] = mulscale30(nSpeed, Cos(pSprite1->ang+Random2(85)));
yvel[nSprite2] = mulscale30(nSpeed, Sin(pSprite1->ang+Random2(85)));
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);
pSprite2->flags = 7;
}
@ -4310,14 +4310,14 @@ void actAirDrag(spritetype *pSprite, int a2)
{
int vcx = pXSector->windVel<<12;
if (!pXSector->windAlways && pXSector->busy)
vcx = mulscale16(vcx, pXSector->busy);
vbp = mulscale30(vcx, Cos(pXSector->windAng));
v4 = mulscale30(vcx, Sin(pXSector->windAng));
vcx = MulScale(vcx, pXSector->busy, 16);
vbp = MulScale(vcx, Cos(pXSector->windAng), 30);
v4 = MulScale(vcx, Sin(pXSector->windAng), 30);
}
}
xvel[pSprite->index] += mulscale16(vbp-xvel[pSprite->index], a2);
yvel[pSprite->index] += mulscale16(v4-yvel[pSprite->index], a2);
zvel[pSprite->index] -= mulscale16(zvel[pSprite->index], a2);
xvel[pSprite->index] += MulScale(vbp-xvel[pSprite->index], a2, 16);
yvel[pSprite->index] += MulScale(v4-yvel[pSprite->index], a2, 16);
zvel[pSprite->index] -= MulScale(zvel[pSprite->index], a2, 16);
}
int MoveThing(spritetype *pSprite)
@ -4453,9 +4453,9 @@ int MoveThing(spritetype *pSprite)
pSprite->z += ClipLow(ceilZ-top, 0);
if (zvel[nSprite] < 0)
{
xvel[nSprite] = mulscale16(xvel[nSprite], 0xc000);
yvel[nSprite] = mulscale16(yvel[nSprite], 0xc000);
zvel[nSprite] = mulscale16(-zvel[nSprite], 0x4000);
xvel[nSprite] = MulScale(xvel[nSprite], 0xc000, 16);
yvel[nSprite] = MulScale(yvel[nSprite], 0xc000, 16);
zvel[nSprite] = MulScale(-zvel[nSprite], 0x4000, 16);
switch (pSprite->type) {
case kThingZombieHead:
if (klabs(zvel[nSprite]) > 0x80000) {
@ -4489,8 +4489,8 @@ int MoveThing(spritetype *pSprite)
if (nVel > 0)
{
int t = divscale16(nVelClipped, nVel);
xvel[nSprite] -= mulscale16(t, xvel[nSprite]);
yvel[nSprite] -= mulscale16(t, yvel[nSprite]);
xvel[nSprite] -= MulScale(t, xvel[nSprite], 16);
yvel[nSprite] -= MulScale(t, yvel[nSprite], 16);
}
}
if (xvel[nSprite] || yvel[nSprite])
@ -4999,7 +4999,7 @@ void MoveDude(spritetype *pSprite)
pSprite->z += ClipLow(ceilZ-top, 0);
if (zvel[nSprite] <= 0 && (pSprite->flags&4))
zvel[nSprite] = mulscale16(-zvel[nSprite], 0x2000);
zvel[nSprite] = MulScale(-zvel[nSprite], 0x2000, 16);
}
else
gSpriteHit[nXSprite].ceilhit = 0;
@ -5154,8 +5154,8 @@ int MoveMissile(spritetype *pSprite)
if (vdi >= 0 && vdi != 3)
{
int nAngle = getangle(xvel[nSprite], yvel[nSprite]);
x -= mulscale30(Cos(nAngle), 16);
y -= mulscale30(Sin(nAngle), 16);
x -= MulScale(Cos(nAngle), 16, 30);
y -= MulScale(Sin(nAngle), 16, 30);
int nVel = approxDist(xvel[nSprite], yvel[nSprite]);
vz -= scale(0x100, zvel[nSprite], nVel);
updatesector(x, y, &nSector);
@ -5537,12 +5537,12 @@ void actProcessSprites(void)
{
speed = pXSector->panVel << 9;
if (!pXSector->panAlways && pXSector->busy)
speed = mulscale16(speed, pXSector->busy);
speed = MulScale(speed, pXSector->busy, 16);
}
if (sector[nSector].floorstat&64)
angle = (angle+GetWallAngle(sector[nSector].wallptr)+512)&2047;
int dx = mulscale30(speed, Cos(angle));
int dy = mulscale30(speed, Sin(angle));
int dx = MulScale(speed, Cos(angle), 30);
int dy = MulScale(speed, Sin(angle), 30);
xvel[nSprite] += dx;
yvel[nSprite] += dy;
}
@ -5819,8 +5819,8 @@ void actProcessSprites(void)
int y = pSprite->y;
int z = pSprite->z;
int t = (pXSprite->data1<<23)/120;
int dx = mulscale30(t, Cos(pSprite->ang));
int dy = mulscale30(t, Sin(pSprite->ang));
int dx = MulScale(t, Cos(pSprite->ang), 30);
int dy = MulScale(t, Sin(pSprite->ang), 30);
for (int i = 0; i < 2; i++)
{
spritetype *pFX = gFX.fxSpawn(FX_32, pSprite->sectnum, x, y, z, 0);
@ -5977,12 +5977,12 @@ void actProcessSprites(void)
{
speed = pXSector->panVel << 9;
if (!pXSector->panAlways && pXSector->busy)
speed = mulscale16(speed, pXSector->busy);
speed = MulScale(speed, pXSector->busy, 16);
}
if (sector[nSector].floorstat&64)
angle = (angle+GetWallAngle(sector[nSector].wallptr)+512)&2047;
int dx = mulscale30(speed, Cos(angle));
int dy = mulscale30(speed, Sin(angle));
int dx = MulScale(speed, Cos(angle), 30);
int dy = MulScale(speed, Sin(angle), 30);
xvel[nSprite] += dx;
yvel[nSprite] += dy;
}
@ -6247,21 +6247,21 @@ spritetype * actSpawnThing(int nSector, int x, int y, int z, int nThingType)
spritetype * actFireThing(spritetype *pSprite, int a2, int a3, int a4, int thingType, int a6)
{
assert(thingType >= kThingBase && thingType < kThingMax);
int x = pSprite->x+mulscale30(a2, Cos(pSprite->ang+512));
int y = pSprite->y+mulscale30(a2, Sin(pSprite->ang+512));
int x = pSprite->x+MulScale(a2, Cos(pSprite->ang+512), 30);
int y = pSprite->y+MulScale(a2, Sin(pSprite->ang+512), 30);
int z = pSprite->z+a3;
x += mulscale28(pSprite->clipdist, Cos(pSprite->ang));
y += mulscale28(pSprite->clipdist, Sin(pSprite->ang));
x += MulScale(pSprite->clipdist, Cos(pSprite->ang), 28);
y += MulScale(pSprite->clipdist, Sin(pSprite->ang), 28);
if (HitScan(pSprite, z, x-pSprite->x, y-pSprite->y, 0, CLIPMASK0, pSprite->clipdist) != -1)
{
x = gHitInfo.hitx-mulscale28(pSprite->clipdist<<1, Cos(pSprite->ang));
y = gHitInfo.hity-mulscale28(pSprite->clipdist<<1, Sin(pSprite->ang));
x = gHitInfo.hitx-MulScale(pSprite->clipdist<<1, Cos(pSprite->ang), 28);
y = gHitInfo.hity-MulScale(pSprite->clipdist<<1, Sin(pSprite->ang), 28);
}
spritetype *pThing = actSpawnThing(pSprite->sectnum, x, y, z, thingType);
pThing->owner = pSprite->index;
pThing->ang = pSprite->ang;
xvel[pThing->index] = mulscale30(a6, Cos(pThing->ang));
yvel[pThing->index] = mulscale30(a6, Sin(pThing->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);
xvel[pThing->index] += xvel[pSprite->index]/2;
yvel[pThing->index] += yvel[pSprite->index]/2;
@ -6276,25 +6276,25 @@ spritetype* actFireMissile(spritetype *pSprite, int a2, int a3, int a4, int a5,
char v4 = 0;
int nSprite = pSprite->index;
const MissileType *pMissileInfo = &missileInfo[nType-kMissileBase];
int x = pSprite->x+mulscale30(a2, Cos(pSprite->ang+512));
int y = pSprite->y+mulscale30(a2, Sin(pSprite->ang+512));
int x = pSprite->x+MulScale(a2, Cos(pSprite->ang+512), 30);
int y = pSprite->y+MulScale(a2, Sin(pSprite->ang+512), 30);
int z = pSprite->z+a3;
int clipdist = pMissileInfo->clipDist+pSprite->clipdist;
x += mulscale28(clipdist, Cos(pSprite->ang));
y += mulscale28(clipdist, Sin(pSprite->ang));
x += MulScale(clipdist, Cos(pSprite->ang), 28);
y += MulScale(clipdist, Sin(pSprite->ang), 28);
int hit = HitScan(pSprite, z, x-pSprite->x, y-pSprite->y, 0, CLIPMASK0, clipdist);
if (hit != -1)
{
if (hit == 3 || hit == 0)
{
v4 = 1;
x = gHitInfo.hitx-mulscale30(Cos(pSprite->ang), 16);
y = gHitInfo.hity-mulscale30(Sin(pSprite->ang), 16);
x = gHitInfo.hitx-MulScale(Cos(pSprite->ang), 16, 30);
y = gHitInfo.hity-MulScale(Sin(pSprite->ang), 16, 30);
}
else
{
x = gHitInfo.hitx-mulscale28(pMissileInfo->clipDist<<1, Cos(pSprite->ang));
y = gHitInfo.hity-mulscale28(pMissileInfo->clipDist<<1, Sin(pSprite->ang));
x = gHitInfo.hitx-MulScale(pMissileInfo->clipDist<<1, Cos(pSprite->ang), 28);
y = gHitInfo.hity-MulScale(pMissileInfo->clipDist<<1, Sin(pSprite->ang), 28);
}
}
spritetype *pMissile = actSpawnSprite(pSprite->sectnum, x, y, z, 5, 1);
@ -6463,7 +6463,7 @@ bool actCheckRespawn(spritetype *pSprite)
if (nRespawnTime > 0)
{
if (pXSprite->respawnPending == 1)
nRespawnTime = mulscale16(nRespawnTime, 0xa000);
nRespawnTime = MulScale(nRespawnTime, 0xa000, 16);
pSprite->owner = pSprite->statnum;
actPostSprite(pSprite->index, kStatRespawn);
pSprite->flags |= kHitagRespawn;
@ -6616,9 +6616,9 @@ void actFireVector(spritetype *pShooter, int a2, int a3, int a4, int a5, int a6,
if (t > 0 && pVectorData->impulse)
{
int t2 = divscale(pVectorData->impulse, t, 8);
xvel[nSprite] += mulscale16(a4, t2);
yvel[nSprite] += mulscale16(a5, t2);
zvel[nSprite] += mulscale16(a6, t2);
xvel[nSprite] += MulScale(a4, t2, 16);
yvel[nSprite] += MulScale(a5, t2, 16);
zvel[nSprite] += MulScale(a6, t2, 16);
}
if (pVectorData->burnTime)
{
@ -6646,9 +6646,9 @@ void actFireVector(spritetype *pShooter, int a2, int a3, int a4, int a5, int a6,
if (t > 0 && pVectorData->impulse)
{
int t2 = divscale(pVectorData->impulse, t, 8);
xvel[nSprite] += mulscale16(a4, t2);
yvel[nSprite] += mulscale16(a5, t2);
zvel[nSprite] += mulscale16(a6, t2);
xvel[nSprite] += MulScale(a4, t2, 16);
yvel[nSprite] += MulScale(a5, t2, 16);
zvel[nSprite] += MulScale(a6, t2, 16);
}
if (pVectorData->burnTime)
{
@ -6703,9 +6703,9 @@ void actFireVector(spritetype *pShooter, int a2, int a3, int a4, int a5, int a6,
int nIndex = debrisGetIndex(pSprite->index);
if (nIndex != -1 && (xsprite[pSprite->extra].physAttr & kPhysDebrisVector)) {
int impulse = divscale(pVectorData->impulse, ClipLow(gSpriteMass[pSprite->extra].mass, 10), 6);
xvel[nSprite] += mulscale16(a4, impulse);
yvel[nSprite] += mulscale16(a5, impulse);
zvel[nSprite] += mulscale16(a6, impulse);
xvel[nSprite] += MulScale(a4, impulse, 16);
yvel[nSprite] += MulScale(a5, impulse, 16);
zvel[nSprite] += MulScale(a6, impulse, 16);
if (pVectorData->burnTime != 0) {
if (!xsprite[nXSprite].burnTime) evPost(nSprite, 3, 0, kCallbackFXFlameLick);
@ -6953,7 +6953,7 @@ void SerializeActor(FSerializer& arc)
{
for (int i = 0; i < kDudeMax - kDudeBase; i++)
for (int j = 0; j < 7; j++)
dudeInfo[i].at70[j] = mulscale8(DudeDifficulty[gGameOptions.nDifficulty], dudeInfo[i].startDamage[j]);
dudeInfo[i].at70[j] = MulScale(DudeDifficulty[gGameOptions.nDifficulty], dudeInfo[i].startDamage[j], 8);
}
}
}

View file

@ -116,8 +116,8 @@ bool CanMove(spritetype *pSprite, int a2, int nAngle, int nRange)
return false;
return true;
}
x += mulscale30(nRange, Cos(nAngle));
y += mulscale30(nRange, Sin(nAngle));
x += MulScale(nRange, Cos(nAngle), 30);
y += MulScale(nRange, Sin(nAngle), 30);
int nSector = pSprite->sectnum;
assert(nSector >= 0 && nSector < kMaxSectors);
if (!FindSector(x, y, z, &nSector))
@ -267,8 +267,8 @@ void aiMoveForward(DBloodActor* actor)
pSprite->ang = (pSprite->ang+ClipRange(nAng, -nTurnRange, nTurnRange))&2047;
if (klabs(nAng) > 341)
return;
actor->xvel() += mulscale30(pDudeInfo->frontSpeed, Cos(pSprite->ang));
actor->yvel() += mulscale30(pDudeInfo->frontSpeed, Sin(pSprite->ang));
actor->xvel() += MulScale(pDudeInfo->frontSpeed, Cos(pSprite->ang), 30);
actor->yvel() += MulScale(pDudeInfo->frontSpeed, Sin(pSprite->ang), 30);
}
void aiMoveTurn(DBloodActor* actor)

View file

@ -470,8 +470,8 @@ static void beastMoveForward(DBloodActor* actor)
int nDist = approxDist(dx, dy);
if (nDist <= 0x400 && Random(64) < 32)
return;
actor->xvel() += mulscale30(pDudeInfo->frontSpeed, Cos(pSprite->ang));
actor->yvel() += mulscale30(pDudeInfo->frontSpeed, Sin(pSprite->ang));
actor->xvel() += MulScale(pDudeInfo->frontSpeed, Cos(pSprite->ang), 30);
actor->yvel() += MulScale(pDudeInfo->frontSpeed, Sin(pSprite->ang), 30);
}
static void sub_628A0(DBloodActor* actor)

View file

@ -121,8 +121,8 @@ void cerberusBurnSeqCallback(int, DBloodActor* actor)
y2 += (yvel[nSprite2]*t)>>12;
z2 += (zvel[nSprite2]*t)>>8;
}
int tx = x+mulscale30(Cos(pSprite->ang), nDist);
int ty = y+mulscale30(Sin(pSprite->ang), nDist);
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 top, bottom;
@ -206,8 +206,8 @@ void cerberusBurnSeqCallback2(int, DBloodActor* actor)
y2 += (yvel[nSprite2]*t)>>12;
z2 += (zvel[nSprite2]*t)>>8;
}
int tx = x+mulscale30(Cos(pSprite->ang), nDist);
int ty = y+mulscale30(Sin(pSprite->ang), nDist);
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 top, bottom;

View file

@ -145,8 +145,8 @@ void BlastSSeqCallback(int, DBloodActor* actor)
y2 += (yvel[nSprite2]*t)>>12;
z2 += (zvel[nSprite2]*t)>>8;
}
int tx = x+mulscale30(Cos(pSprite->ang), nDist);
int ty = y+mulscale30(Sin(pSprite->ang), nDist);
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 top, bottom;

View file

@ -128,8 +128,8 @@ void ghostBlastSeqCallback(int, DBloodActor* actor)
y2 += (yvel[nSprite2]*t)>>12;
z2 += (zvel[nSprite2]*t)>>8;
}
int tx = x+mulscale30(Cos(pSprite->ang), nDist);
int ty = y+mulscale30(Sin(pSprite->ang), nDist);
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 top, bottom;

View file

@ -103,8 +103,8 @@ void sub_71BD4(int, DBloodActor* actor)
y2 += (yvel[nSprite2]*t)>>12;
z2 += (zvel[nSprite2]*t)>>8;
}
int tx = x+mulscale30(Cos(pSprite->ang), nDist);
int ty = y+mulscale30(Sin(pSprite->ang), nDist);
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 top, bottom;
@ -182,8 +182,8 @@ void sub_720AC(int, DBloodActor* actor)
y2 += (yvel[nSprite2]*t)>>12;
z2 += (zvel[nSprite2]*t)>>8;
}
int tx = x+mulscale30(Cos(pSprite->ang), nDist);
int ty = y+mulscale30(Sin(pSprite->ang), nDist);
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 top, bottom;

View file

@ -1462,7 +1462,7 @@ void scaleDamage(XSPRITE* pXSprite) {
// finally, scale dmg for difficulty
for (int i = 0; i < kDmgMax; i++)
curScale[i] = mulscale8(DudeDifficulty[gGameOptions.nDifficulty], ClipLow(curScale[i], 1));
curScale[i] = MulScale(DudeDifficulty[gGameOptions.nDifficulty], ClipLow(curScale[i], 1), 8);
//short* dc = curScale;
//if (pXSprite->rxID == 788)

View file

@ -139,8 +139,8 @@ static tspritetype *viewAddEffect(int nTSprite, VIEW_EFFECT nViewEffect)
int nRand2 = dword_172CE0[i][1];
int nRand3 = dword_172CE0[i][2];
ang += nRand3;
int x = mulscale30(512, Cos(ang));
int y = mulscale30(512, Sin(ang));
int x = MulScale(512, Cos(ang), 30);
int y = MulScale(512, Sin(ang), 30);
int z = 0;
RotateYZ(&x, &y, &z, nRand1);
RotateXZ(&x, &y, &z, nRand2);
@ -226,9 +226,9 @@ static tspritetype *viewAddEffect(int nTSprite, VIEW_EFFECT nViewEffect)
int nSector = pTSprite->sectnum;
auto pNSprite = viewInsertTSprite<tspritetype>(nSector, 32767, NULL);
int nLen = 128+(i<<7);
int x = mulscale30(nLen, Cos(nAng));
int x = MulScale(nLen, Cos(nAng), 30);
pNSprite->x = pTSprite->x + x;
int y = mulscale30(nLen, Sin(nAng));
int y = MulScale(nLen, Sin(nAng), 30);
pNSprite->y = pTSprite->y + y;
pNSprite->z = pTSprite->z;
assert(nSector >= 0 && nSector < kMaxSectors);
@ -410,8 +410,8 @@ static tspritetype *viewAddEffect(int nTSprite, VIEW_EFFECT nViewEffect)
const int lifeLeech = 9;
if (pPlayer->curWeapon == lifeLeech)
{
pNSprite->x -= mulscale30(128, Cos(pNSprite->ang));
pNSprite->y -= mulscale30(128, Sin(pNSprite->ang));
pNSprite->x -= MulScale(128, Cos(pNSprite->ang), 30);
pNSprite->y -= MulScale(128, Sin(pNSprite->ang), 30);
}
}
break;
@ -435,7 +435,7 @@ static void viewApplyDefaultPal(tspritetype *pTSprite, sectortype const *pSector
void viewProcessSprites(int32_t cX, int32_t cY, int32_t cZ, int32_t cA, int32_t smoothratio)
{
// shift before interpolating to increase precision.
int myclock = (gFrameClock<<3) + mulscale16(4<<3, smoothratio);
int myclock = (gFrameClock<<3) + MulScale(4<<3, smoothratio, 16);
assert(spritesortcnt <= maxspritesonscreen);
gCameraAng = cA;
int nViewSprites = spritesortcnt;
@ -468,7 +468,7 @@ void viewProcessSprites(int32_t cX, int32_t cY, int32_t cZ, int32_t cA, int32_t
pTSprite->x = interpolate(pPrevLoc->x, pTSprite->x, iInterpolate);
pTSprite->y = interpolate(pPrevLoc->y, pTSprite->y, iInterpolate);
pTSprite->z = interpolate(pPrevLoc->z, pTSprite->z, iInterpolate);
pTSprite->ang = pPrevLoc->ang+mulscale16(((pTSprite->ang-pPrevLoc->ang+1024)&2047)-1024, iInterpolate);
pTSprite->ang = pPrevLoc->ang+MulScale(((pTSprite->ang-pPrevLoc->ang+1024)&2047)-1024, iInterpolate, 16);
}
int nAnim = 0;
switch (picanm[nTile].extra & 7) {
@ -792,8 +792,8 @@ void viewProcessSprites(int32_t cX, int32_t cY, int32_t cZ, int32_t cA, int32_t
auto pNTSprite = viewAddEffect(nTSprite, VIEW_EFFECT_14);
if (pNTSprite) {
POSTURE *pPosture = &pPlayer->pPosture[pPlayer->lifeMode][pPlayer->posture];
pNTSprite->x += mulscale28(pPosture->zOffset, Cos(pTSprite->ang));
pNTSprite->y += mulscale28(pPosture->zOffset, Sin(pTSprite->ang));
pNTSprite->x += MulScale(pPosture->zOffset, Cos(pTSprite->ang), 28);
pNTSprite->y += MulScale(pPosture->zOffset, Sin(pTSprite->ang), 28);
pNTSprite->z = pPlayer->pSprite->z-pPosture->xOffset;
}
}

View file

@ -65,7 +65,7 @@ void ambProcess(void)
dy >>= 4;
dz >>= 8;
int nDist = ksqrt(dx*dx+dy*dy+dz*dz);
int vs = mulscale16(pXSprite->data4, pXSprite->busy);
int vs = MulScale(pXSprite->data4, pXSprite->busy, 16);
ambChannels[pSprite->owner].distance += ClipRange(scale(nDist, pXSprite->data1, pXSprite->data2, vs, 0), 0, vs);
}
}

View file

@ -40,8 +40,8 @@ void fxFlameLick(int nSprite) // 0
{
int nDist = (pSprite->xrepeat*(tileWidth(pSprite->picnum)/2))>>3;
int nAngle = Random(2048);
int dx = mulscale30(nDist, Cos(nAngle));
int dy = mulscale30(nDist, Sin(nAngle));
int dx = MulScale(nDist, Cos(nAngle), 30);
int dy = MulScale(nDist, Sin(nAngle), 30);
int x = pSprite->x + dx;
int y = pSprite->y + dy;
int z = bottom-Random(bottom-top);
@ -190,8 +190,8 @@ void fxDynPuff(int nSprite) // 8
if (zvel[nSprite])
{
int nDist = (pSprite->xrepeat*(tileWidth(pSprite->picnum)/2))>>2;
int x = pSprite->x + mulscale30(nDist, Cos(pSprite->ang-512));
int y = pSprite->y + mulscale30(nDist, Sin(pSprite->ang-512));
int x = pSprite->x + MulScale(nDist, Cos(pSprite->ang-512), 30);
int y = pSprite->y + MulScale(nDist, Sin(pSprite->ang-512), 30);
int z = pSprite->z;
spritetype *pFX = gFX.fxSpawn(FX_7, pSprite->sectnum, x, y, z, 0);
if (pFX)
@ -220,13 +220,13 @@ void Respawn(int nSprite) // 9
switch (pXSprite->respawnPending) {
case 1: {
int nTime = mulscale16(actGetRespawnTime(pSprite), 0x4000);
int nTime = MulScale(actGetRespawnTime(pSprite), 0x4000, 16);
pXSprite->respawnPending = 2;
evPost(nSprite, 3, nTime, kCallbackRespawn);
break;
}
case 2: {
int nTime = mulscale16(actGetRespawnTime(pSprite), 0x2000);
int nTime = MulScale(actGetRespawnTime(pSprite), 0x2000, 16);
pXSprite->respawnPending = 3;
evPost(nSprite, 3, nTime, kCallbackRespawn);
break;
@ -296,8 +296,8 @@ void PlayerBubble(int nSprite) // 10
{
int nDist = (pSprite->xrepeat*(tileWidth(pSprite->picnum)/2))>>2;
int nAngle = Random(2048);
int x = pSprite->x + mulscale30(nDist, Cos(nAngle));
int y = pSprite->y + mulscale30(nDist, Sin(nAngle));
int x = pSprite->x + MulScale(nDist, Cos(nAngle), 30);
int y = pSprite->y + MulScale(nDist, Sin(nAngle), 30);
int z = bottom-Random(bottom-top);
spritetype *pFX = gFX.fxSpawn((FX_ID)(FX_23+Random(3)), pSprite->sectnum, x, y, z, 0);
if (pFX)
@ -320,8 +320,8 @@ void EnemyBubble(int nSprite) // 11
{
int nDist = (pSprite->xrepeat*(tileWidth(pSprite->picnum)/2))>>2;
int nAngle = Random(2048);
int x = pSprite->x + mulscale30(nDist, Cos(nAngle));
int y = pSprite->y + mulscale30(nDist, Sin(nAngle));
int x = pSprite->x + MulScale(nDist, Cos(nAngle), 30);
int y = pSprite->y + MulScale(nDist, Sin(nAngle), 30);
int z = bottom-Random(bottom-top);
spritetype *pFX = gFX.fxSpawn((FX_ID)(FX_23+Random(3)), pSprite->sectnum, x, y, z, 0);
if (pFX)
@ -381,8 +381,8 @@ void fxBloodBits(int nSprite) // 14
pSprite->z += floorZ-bottom;
int nAngle = Random(2048);
int nDist = Random(16)<<4;
int x = pSprite->x+mulscale28(nDist, Cos(nAngle));
int y = pSprite->y+mulscale28(nDist, Sin(nAngle));
int x = pSprite->x+MulScale(nDist, Cos(nAngle), 28);
int y = pSprite->y+MulScale(nDist, Sin(nAngle), 28);
gFX.fxSpawn(FX_48, pSprite->sectnum, x, y, pSprite->z, 0);
if (pSprite->ang == 1024)
{
@ -528,8 +528,8 @@ void fxPodBloodSplat(int nSprite) // 19
pSprite->z += floorZ-bottom;
int nAngle = Random(2048);
int nDist = Random(16)<<4;
int x = pSprite->x+mulscale28(nDist, Cos(nAngle));
int y = pSprite->y+mulscale28(nDist, Sin(nAngle));
int x = pSprite->x+MulScale(nDist, Cos(nAngle), 28);
int y = pSprite->y+MulScale(nDist, Sin(nAngle), 28);
if (pSprite->ang == 1024)
{
int nChannel = 28+(pSprite->index&2);

View file

@ -50,7 +50,7 @@ void CChoke::animateChoke(int x, int y, int smoothratio)
{
if (!qav)
return;
int myclock = gFrameClock + mulscale16(4, smoothratio);
int myclock = gFrameClock + MulScale(4, smoothratio, 16);
qav->x = x;
qav->y = y;
int vd = myclock - time;

View file

@ -530,7 +530,7 @@ inline int ClipRange(int a, int b, int c)
inline int interpolate(int a, int b, int c)
{
return a+mulscale16(b-a,c);
return a+MulScale(b-a,c, 16);
}
inline double finterpolate(double a, double b, double c)
@ -540,12 +540,12 @@ inline double finterpolate(double a, double b, double c)
inline int interpolateang(int a, int b, int c)
{
return a+mulscale16(((b-a+1024)&2047)-1024, c);
return a+MulScale(((b-a+1024)&2047)-1024, c, 16);
}
inline fixed_t interpolateangfix16(fixed_t a, fixed_t b, int c)
{
return a+mulscale16(((b-a+0x4000000)&0x7ffffff)-0x4000000, c);
return a+MulScale(((b-a+0x4000000)&0x7ffffff)-0x4000000, c, 16);
}
inline binangle interpolateangbin(uint32_t a, uint32_t b, double c)

View file

@ -309,10 +309,10 @@ void sub_746D4(spritetype *pSprite, int a2)
void fxSpawnEjectingBrass(spritetype *pSprite, int z, int a3, int a4)
{
int x = pSprite->x+mulscale28(pSprite->clipdist-4, Cos(pSprite->ang));
int y = pSprite->y+mulscale28(pSprite->clipdist-4, Sin(pSprite->ang));
x += mulscale30(a3, Cos(pSprite->ang+512));
y += mulscale30(a3, Sin(pSprite->ang+512));
int x = pSprite->x+MulScale(pSprite->clipdist-4, Cos(pSprite->ang), 28);
int y = pSprite->y+MulScale(pSprite->clipdist-4, Sin(pSprite->ang), 28);
x += MulScale(a3, Cos(pSprite->ang+512), 30);
y += MulScale(a3, Sin(pSprite->ang+512), 30);
spritetype *pBrass = gFX.fxSpawn((FX_ID)(FX_37+Random(3)), pSprite->sectnum, x, y, z, 0);
if (pBrass)
{
@ -320,18 +320,18 @@ void fxSpawnEjectingBrass(spritetype *pSprite, int z, int a3, int a4)
pBrass->ang = Random(2047);
int nDist = (a4<<18)/120+Random2(((a4/4)<<18)/120);
int nAngle = pSprite->ang+Random2(56)+512;
xvel[pBrass->index] = mulscale30(nDist, Cos(nAngle));
yvel[pBrass->index] = mulscale30(nDist, Sin(nAngle));
xvel[pBrass->index] = MulScale(nDist, Cos(nAngle), 30);
yvel[pBrass->index] = MulScale(nDist, Sin(nAngle), 30);
zvel[pBrass->index] = zvel[pSprite->index]-(0x20000+(Random2(40)<<18)/120);
}
}
void fxSpawnEjectingShell(spritetype *pSprite, int z, int a3, int a4)
{
int x = pSprite->x+mulscale28(pSprite->clipdist-4, Cos(pSprite->ang));
int y = pSprite->y+mulscale28(pSprite->clipdist-4, Sin(pSprite->ang));
x += mulscale30(a3, Cos(pSprite->ang+512));
y += mulscale30(a3, Sin(pSprite->ang+512));
int x = pSprite->x+MulScale(pSprite->clipdist-4, Cos(pSprite->ang), 28);
int y = pSprite->y+MulScale(pSprite->clipdist-4, Sin(pSprite->ang), 28);
x += MulScale(a3, Cos(pSprite->ang+512), 30);
y += MulScale(a3, Sin(pSprite->ang+512), 30);
spritetype *pShell = gFX.fxSpawn((FX_ID)(FX_40+Random(3)), pSprite->sectnum, x, y, z, 0);
if (pShell)
{
@ -339,8 +339,8 @@ void fxSpawnEjectingShell(spritetype *pSprite, int z, int a3, int a4)
pShell->ang = Random(2047);
int nDist = (a4<<18)/120+Random2(((a4/4)<<18)/120);
int nAngle = pSprite->ang+Random2(56)+512;
xvel[pShell->index] = mulscale30(nDist, Cos(nAngle));
yvel[pShell->index] = mulscale30(nDist, Sin(nAngle));
xvel[pShell->index] = MulScale(nDist, Cos(nAngle), 30);
yvel[pShell->index] = MulScale(nDist, Sin(nAngle), 30);
zvel[pShell->index] = zvel[pSprite->index]-(0x20000+(Random2(20)<<18)/120);
}
}

View file

@ -363,9 +363,9 @@ bool IntersectRay(int wx, int wy, int wdx, int wdy, int x1, int y1, int z1, int
return 0;
}
int nScale = divscale16(check2, side);
*ix = x1 + mulscale16(dX, nScale);
*iy = y1 + mulscale16(dY, nScale);
*iz = z1 + mulscale16(dZ, nScale);
*ix = x1 + MulScale(dX, nScale, 16);
*iy = y1 + MulScale(dY, nScale, 16);
*iz = z1 + MulScale(dZ, nScale, 16);
return 1;
}
@ -383,8 +383,8 @@ int HitScan(spritetype *pSprite, int z, int dx, int dy, int dz, unsigned int nMa
pSprite->cstat &= ~256;
if (nRange)
{
hitscangoal.x = x + mulscale30(nRange << 4, Cos(pSprite->ang));
hitscangoal.y = y + mulscale30(nRange << 4, Sin(pSprite->ang));
hitscangoal.x = x + MulScale(nRange << 4, Cos(pSprite->ang), 30);
hitscangoal.y = y + MulScale(nRange << 4, Sin(pSprite->ang), 30);
}
else
{
@ -428,16 +428,16 @@ int VectorScan(spritetype *pSprite, int nOffset, int nZOffset, int dx, int dy, i
gHitInfo.hitsect = -1;
gHitInfo.hitwall = -1;
gHitInfo.hitsprite = -1;
int x1 = pSprite->x+mulscale30(nOffset, Cos(pSprite->ang+512));
int y1 = pSprite->y+mulscale30(nOffset, Sin(pSprite->ang+512));
int x1 = pSprite->x+MulScale(nOffset, Cos(pSprite->ang+512), 30);
int y1 = pSprite->y+MulScale(nOffset, Sin(pSprite->ang+512), 30);
int z1 = pSprite->z+nZOffset;
int bakCstat = pSprite->cstat;
pSprite->cstat &= ~256;
int nSector = pSprite->sectnum;
if (nRange)
{
hitscangoal.x = x1+mulscale30(nRange<<4, Cos(pSprite->ang));
hitscangoal.y = y1+mulscale30(nRange<<4, Sin(pSprite->ang));
hitscangoal.x = x1+MulScale(nRange<<4, Cos(pSprite->ang), 30);
hitscangoal.y = y1+MulScale(nRange<<4, Sin(pSprite->ang), 30);
}
else
{

View file

@ -303,8 +303,8 @@ void GibFX(spritetype *pSprite, GIBFX *pGFX, CGibPosition *pPos, CGibVelocity *p
if (!pPos && (pSprite->cstat&48) == 0)
{
int nAngle = Random(2048);
gPos.x = pSprite->x+mulscale30(pSprite->clipdist<<2, Cos(nAngle));
gPos.y = pSprite->y+mulscale30(pSprite->clipdist<<2, Sin(nAngle));
gPos.x = pSprite->x+MulScale(pSprite->clipdist<<2, Cos(nAngle), 30);
gPos.y = pSprite->y+MulScale(pSprite->clipdist<<2, Sin(nAngle), 30);
gPos.z = bottom-Random(bottom-top);
}
spritetype *pFX = gFX.fxSpawn(pGFX->fxId, nSector, gPos.x, gPos.y, gPos.z, 0);
@ -368,8 +368,8 @@ void GibThing(spritetype *pSprite, GIBTHING *pGThing, CGibPosition *pPos, CGibVe
if (!pPos)
{
int nAngle = Random(2048);
x = pSprite->x+mulscale30(pSprite->clipdist<<2, Cos(nAngle));
y = pSprite->y+mulscale30(pSprite->clipdist<<2, Sin(nAngle));
x = pSprite->x+MulScale(pSprite->clipdist<<2, Cos(nAngle), 30);
y = pSprite->y+MulScale(pSprite->clipdist<<2, Sin(nAngle), 30);
z = bottom-Random(bottom-top);
}
else

View file

@ -244,7 +244,7 @@ void sub_557C4(int x, int y, int interpolation)
pTSprite->x = dx+interpolate(pLocation->x, pSprite->x, interpolation);
pTSprite->y = dy+interpolate(pLocation->y, pSprite->y, interpolation);
pTSprite->z = dz+interpolate(pLocation->z, pSprite->z, interpolation);
pTSprite->ang = pLocation->ang+mulscale16(((pSprite->ang-pLocation->ang+1024)&2047)-1024,interpolation);
pTSprite->ang = pLocation->ang+MulScale(((pSprite->ang-pLocation->ang+1024)&2047)-1024,interpolation, 16);
spritesortcnt++;
}
}

View file

@ -873,12 +873,12 @@ void nnExtProcessSuperSprites() {
{
speed = pXSector->panVel << 9;
if (!pXSector->panAlways && pXSector->busy)
speed = mulscale16(speed, pXSector->busy);
speed = MulScale(speed, pXSector->busy, 16);
}
if (sector[pDebris->sectnum].floorstat & 64)
angle = (angle + GetWallAngle(sector[pDebris->sectnum].wallptr) + 512) & 2047;
int dx = mulscale30(speed, Cos(angle));
int dy = mulscale30(speed, Sin(angle));
int dx = MulScale(speed, Cos(angle), 30);
int dy = MulScale(speed, Sin(angle), 30);
xvel[pDebris->index] += dx;
yvel[pDebris->index] += dy;
}
@ -1048,9 +1048,9 @@ void debrisConcuss(int nOwner, int listIndex, int x, int y, int z, int dmg) {
if (gSpriteMass[pSprite->extra].mass > 0) {
int t = scale(dmg, size, gSpriteMass[pSprite->extra].mass);
xvel[pSprite->index] += mulscale16(t, dx);
yvel[pSprite->index] += mulscale16(t, dy);
zvel[pSprite->index] += mulscale16(t, dz);
xvel[pSprite->index] += MulScale(t, dx, 16);
yvel[pSprite->index] += MulScale(t, dy, 16);
zvel[pSprite->index] += MulScale(t, dz, 16);
}
@ -1194,9 +1194,9 @@ void debrisMove(int listIndex) {
pSprite->z += ClipLow(ceilZ - top, 0);
if (zvel[nSprite] < 0)
{
xvel[nSprite] = mulscale16(xvel[nSprite], 0xc000);
yvel[nSprite] = mulscale16(yvel[nSprite], 0xc000);
zvel[nSprite] = mulscale16(-zvel[nSprite], 0x4000);
xvel[nSprite] = MulScale(xvel[nSprite], 0xc000, 16);
yvel[nSprite] = MulScale(yvel[nSprite], 0xc000, 16);
zvel[nSprite] = MulScale(-zvel[nSprite], 0x4000, 16);
}
} else {
@ -1221,8 +1221,8 @@ void debrisMove(int listIndex) {
if (nVel > 0)
{
int t = divscale16(nVelClipped, nVel);
xvel[nSprite] -= mulscale16(t, xvel[nSprite]);
yvel[nSprite] -= mulscale16(t, yvel[nSprite]);
xvel[nSprite] -= MulScale(t, xvel[nSprite], 16);
yvel[nSprite] -= MulScale(t, yvel[nSprite], 16);
}
}
@ -4846,7 +4846,7 @@ void playerQavSceneDraw(PLAYER* pPlayer, int a2, double a3, double a4, int a5, i
if (pQavScene->qavResrc != NULL) {
QAV* pQAV = pQavScene->qavResrc;
int v4 = (pPlayer->weaponTimer == 0) ? ((gFrameClock + mulscale16(4, smoothratio)) % pQAV->duration) : pQAV->duration - pPlayer->weaponTimer;
int v4 = (pPlayer->weaponTimer == 0) ? ((gFrameClock + MulScale(4, smoothratio, 16)) % pQAV->duration) : pQAV->duration - pPlayer->weaponTimer;
int flags = 2; int nInv = powerupCheck(pPlayer, kPwUpShadowCloak);
if (nInv >= 120 * 8 || (nInv != 0 && (gFrameClock & 32))) {

View file

@ -586,7 +586,7 @@ void playerSetRace(PLAYER *pPlayer, int nLifeMode)
pPlayer->pSprite->clipdist = pDudeInfo->clipdist;
for (int i = 0; i < 7; i++)
pDudeInfo->at70[i] = mulscale8(Handicap[gSkill], pDudeInfo->startDamage[i]);
pDudeInfo->at70[i] = MulScale(Handicap[gSkill], pDudeInfo->startDamage[i], 8);
}
void playerSetGodMode(PLAYER *pPlayer, bool bGodMode)
@ -1239,9 +1239,9 @@ int ActionScan(PLAYER *pPlayer, int *a2, int *a3)
if (nMass)
{
int t2 = divscale(0xccccc, nMass, 8);
xvel[*a2] += mulscale16(x, t2);
yvel[*a2] += mulscale16(y, t2);
zvel[*a2] += mulscale16(z, t2);
xvel[*a2] += MulScale(x, t2, 16);
yvel[*a2] += MulScale(y, t2, 16);
zvel[*a2] += MulScale(z, t2, 16);
}
if (pXSprite->Push && !pXSprite->state && !pXSprite->isTriggered)
trTriggerSprite(*a2, pXSprite, kCmdSpritePush);
@ -1345,7 +1345,7 @@ void ProcessInput(PLAYER *pPlayer)
}
pPlayer->deathTime += 4;
if (!bSeqStat)
pPlayer->horizon.addadjustment(FixedToFloat(mulscale16(0x8000-(Cos(ClipHigh(pPlayer->deathTime<<3, 1024))>>15), gi->playerHorizMax()) - pPlayer->horizon.horiz.asq16()));
pPlayer->horizon.addadjustment(FixedToFloat(MulScale(0x8000-(Cos(ClipHigh(pPlayer->deathTime<<3, 1024))>>15), gi->playerHorizMax(), 16) - pPlayer->horizon.horiz.asq16()));
if (pPlayer->curWeapon)
pInput->setNewWeapon(pPlayer->curWeapon);
if (pInput->actions & SB_OPEN)
@ -1381,18 +1381,18 @@ void ProcessInput(PLAYER *pPlayer)
{
int forward = pInput->fvel;
if (forward > 0)
forward = mulscale8(pPosture->frontAccel, forward);
forward = MulScale(pPosture->frontAccel, forward, 8);
else
forward = mulscale8(pPosture->backAccel, forward);
xvel[nSprite] += mulscale30(forward, x);
yvel[nSprite] += mulscale30(forward, y);
forward = MulScale(pPosture->backAccel, forward, 8);
xvel[nSprite] += MulScale(forward, x, 30);
yvel[nSprite] += MulScale(forward, y, 30);
}
if (pInput->svel)
{
int strafe = pInput->svel;
strafe = mulscale8(pPosture->sideAccel, strafe);
xvel[nSprite] += mulscale30(strafe, y);
yvel[nSprite] -= mulscale30(strafe, x);
strafe = MulScale(pPosture->sideAccel, strafe, 8);
xvel[nSprite] += MulScale(strafe, y, 30);
yvel[nSprite] -= MulScale(strafe, x, 30);
}
}
else if (pXSprite->height < 256)
@ -1406,22 +1406,22 @@ void ProcessInput(PLAYER *pPlayer)
{
int forward = pInput->fvel;
if (forward > 0)
forward = mulscale8(pPosture->frontAccel, forward);
forward = MulScale(pPosture->frontAccel, forward, 8);
else
forward = mulscale8(pPosture->backAccel, forward);
forward = MulScale(pPosture->backAccel, forward, 8);
if (pXSprite->height)
forward = mulscale16(forward, speed);
xvel[nSprite] += mulscale30(forward, x);
yvel[nSprite] += mulscale30(forward, y);
forward = MulScale(forward, speed, 16);
xvel[nSprite] += MulScale(forward, x, 30);
yvel[nSprite] += MulScale(forward, y, 30);
}
if (pInput->svel)
{
int strafe = pInput->svel;
strafe = mulscale8(pPosture->sideAccel, strafe);
strafe = MulScale(pPosture->sideAccel, strafe, 8);
if (pXSprite->height)
strafe = mulscale16(strafe, speed);
xvel[nSprite] += mulscale30(strafe, y);
yvel[nSprite] -= mulscale30(strafe, x);
strafe = MulScale(strafe, speed, 16);
xvel[nSprite] += MulScale(strafe, y, 30);
yvel[nSprite] -= MulScale(strafe, x, 30);
}
}
@ -1544,8 +1544,8 @@ void ProcessInput(PLAYER *pPlayer)
int nSprite = pPlayer->pSprite->index;
int x = CosScale16(pPlayer->pSprite->ang);
int y = SinScale16(pPlayer->pSprite->ang);
xvel[pSprite2->index] = xvel[nSprite] + mulscale14(0x155555, x);
yvel[pSprite2->index] = yvel[nSprite] + mulscale14(0x155555, y);
xvel[pSprite2->index] = xvel[nSprite] + MulScale(0x155555, x, 14);
yvel[pSprite2->index] = yvel[nSprite] + MulScale(0x155555, y, 14);
zvel[pSprite2->index] = zvel[nSprite];
pPlayer->hand = 0;
}
@ -1648,16 +1648,16 @@ void playerProcess(PLAYER *pPlayer)
pPlayer->zViewVel = interpolate(pPlayer->zViewVel, zvel[nSprite], 0x7000);
int dz = pPlayer->pSprite->z-pPosture->eyeAboveZ-pPlayer->zView;
if (dz > 0)
pPlayer->zViewVel += mulscale16(dz<<8, 0xa000);
pPlayer->zViewVel += MulScale(dz<<8, 0xa000, 16);
else
pPlayer->zViewVel += mulscale16(dz<<8, 0x1800);
pPlayer->zViewVel += MulScale(dz<<8, 0x1800, 16);
pPlayer->zView += pPlayer->zViewVel>>8;
pPlayer->zWeaponVel = interpolate(pPlayer->zWeaponVel, zvel[nSprite], 0x5000);
dz = pPlayer->pSprite->z-pPosture->weaponAboveZ-pPlayer->zWeapon;
if (dz > 0)
pPlayer->zWeaponVel += mulscale16(dz<<8, 0x8000);
pPlayer->zWeaponVel += MulScale(dz<<8, 0x8000, 16);
else
pPlayer->zWeaponVel += mulscale16(dz<<8, 0xc00);
pPlayer->zWeaponVel += MulScale(dz<<8, 0xc00, 16);
pPlayer->zWeapon += pPlayer->zWeaponVel>>8;
pPlayer->bobPhase = ClipLow(pPlayer->bobPhase-4, 0);
nSpeed >>= FRACBITS;
@ -1665,10 +1665,10 @@ void playerProcess(PLAYER *pPlayer)
{
pPlayer->bobAmp = (pPlayer->bobAmp+17)&2047;
pPlayer->swayAmp = (pPlayer->swayAmp+17)&2047;
pPlayer->bobHeight = mulscale30(pPosture->bobV*10, Sin(pPlayer->bobAmp*2));
pPlayer->bobWidth = mulscale30(pPosture->bobH*pPlayer->bobPhase, Sin(pPlayer->bobAmp-256));
pPlayer->swayHeight = mulscale30(pPosture->swayV*pPlayer->bobPhase, Sin(pPlayer->swayAmp*2));
pPlayer->swayWidth = mulscale30(pPosture->swayH*pPlayer->bobPhase, Sin(pPlayer->swayAmp-0x155));
pPlayer->bobHeight = MulScale(pPosture->bobV*10, Sin(pPlayer->bobAmp*2), 30);
pPlayer->bobWidth = MulScale(pPosture->bobH*pPlayer->bobPhase, Sin(pPlayer->bobAmp-256), 30);
pPlayer->swayHeight = MulScale(pPosture->swayV*pPlayer->bobPhase, Sin(pPlayer->swayAmp*2), 30);
pPlayer->swayWidth = MulScale(pPosture->swayH*pPlayer->bobPhase, Sin(pPlayer->swayAmp-0x155), 30);
}
else
{
@ -1688,10 +1688,10 @@ void playerProcess(PLAYER *pPlayer)
pPlayer->bobPhase = ClipHigh(pPlayer->bobPhase+nSpeed, 30);
}
}
pPlayer->bobHeight = mulscale30(pPosture->bobV*pPlayer->bobPhase, Sin(pPlayer->bobAmp*2));
pPlayer->bobWidth = mulscale30(pPosture->bobH*pPlayer->bobPhase, Sin(pPlayer->bobAmp-256));
pPlayer->swayHeight = mulscale30(pPosture->swayV*pPlayer->bobPhase, Sin(pPlayer->swayAmp*2));
pPlayer->swayWidth = mulscale30(pPosture->swayH*pPlayer->bobPhase, Sin(pPlayer->swayAmp-0x155));
pPlayer->bobHeight = MulScale(pPosture->bobV*pPlayer->bobPhase, Sin(pPlayer->bobAmp*2), 30);
pPlayer->bobWidth = MulScale(pPosture->bobH*pPlayer->bobPhase, Sin(pPlayer->bobAmp-256), 30);
pPlayer->swayHeight = MulScale(pPosture->swayV*pPlayer->bobPhase, Sin(pPlayer->swayAmp*2), 30);
pPlayer->swayWidth = MulScale(pPosture->swayH*pPlayer->bobPhase, Sin(pPlayer->swayAmp-0x155), 30);
}
pPlayer->flickerEffect = 0;
pPlayer->quakeEffect = ClipLow(pPlayer->quakeEffect-4, 0);

View file

@ -121,18 +121,18 @@ static void fakeProcessInput(PLAYER *pPlayer, InputPacket *pInput)
{
int forward = pInput->fvel;
if (forward > 0)
forward = mulscale8(pPosture->frontAccel, forward);
forward = MulScale(pPosture->frontAccel, forward, 8);
else
forward = mulscale8(pPosture->backAccel, forward);
predict.at5c += mulscale30(forward, x);
predict.at60 += mulscale30(forward, y);
forward = MulScale(pPosture->backAccel, forward, 8);
predict.at5c += MulScale(forward, x, 30);
predict.at60 += MulScale(forward, y, 30);
}
if (pInput->svel)
{
int strafe = pInput->svel;
strafe = mulscale8(pPosture->sideAccel, strafe);
predict.at5c += mulscale30(strafe, y);
predict.at60 -= mulscale30(strafe, x);
strafe = MulScale(pPosture->sideAccel, strafe, 8);
predict.at5c += MulScale(strafe, y, 30);
predict.at60 -= MulScale(strafe, x, 30);
}
}
else if (predict.at6a < 0x100)
@ -146,22 +146,22 @@ static void fakeProcessInput(PLAYER *pPlayer, InputPacket *pInput)
{
int forward = pInput->fvel;
if (forward > 0)
forward = mulscale8(pPosture->frontAccel, forward);
forward = MulScale(pPosture->frontAccel, forward, 8);
else
forward = mulscale8(pPosture->backAccel, forward);
forward = MulScale(pPosture->backAccel, forward, 8);
if (predict.at6a)
forward = mulscale16(forward, speed);
predict.at5c += mulscale30(forward, x);
predict.at60 += mulscale30(forward, y);
forward = MulScale(forward, speed, 16);
predict.at5c += MulScale(forward, x, 30);
predict.at60 += MulScale(forward, y, 30);
}
if (pInput->svel)
{
int strafe = pInput->svel;
strafe = mulscale8(pPosture->sideAccel, strafe);
strafe = MulScale(pPosture->sideAccel, strafe, 8);
if (predict.at6a)
strafe = mulscale16(strafe, speed);
predict.at5c += mulscale30(strafe, y);
predict.at60 -= mulscale30(strafe, x);
strafe = MulScale(strafe, speed, 16);
predict.at5c += MulScale(strafe, y, 30);
predict.at60 -= MulScale(strafe, x, 30);
}
}
if (pInput->avel)
@ -244,8 +244,8 @@ static void fakeProcessInput(PLAYER *pPlayer, InputPacket *pInput)
if (va && (sector[nSector].floorstat&2) != 0)
{
int z1 = getflorzofslope(nSector, predict.at50, predict.at54);
int x2 = predict.at50+mulscale30(64, Cos(predict.at30.asbuild()));
int y2 = predict.at54+mulscale30(64, Sin(predict.at30.asbuild()));
int x2 = predict.at50+MulScale(64, Cos(predict.at30.asbuild()), 30);
int y2 = predict.at54+MulScale(64, Sin(predict.at30.asbuild()), 30);
short nSector2 = nSector;
updatesector(x2, y2, &nSector2);
if (nSector2 == nSector)
@ -293,17 +293,17 @@ void fakePlayerProcess(PLAYER *pPlayer, InputPacket *pInput)
predict.at3c = interpolate(predict.at3c, predict.at64, 0x7000);
int dz = predict.at58-pPosture->eyeAboveZ-predict.at38;
if (dz > 0)
predict.at3c += mulscale16(dz<<8, 0xa000);
predict.at3c += MulScale(dz<<8, 0xa000, 16);
else
predict.at3c += mulscale16(dz<<8, 0x1800);
predict.at3c += MulScale(dz<<8, 0x1800, 16);
predict.at38 += predict.at3c>>8;
predict.at44 = interpolate(predict.at44, predict.at64, 0x5000);
dz = predict.at58-pPosture->weaponAboveZ-predict.at40;
if (dz > 0)
predict.at44 += mulscale16(dz<<8, 0x8000);
predict.at44 += MulScale(dz<<8, 0x8000, 16);
else
predict.at44 += mulscale16(dz<<8, 0xc00);
predict.at44 += MulScale(dz<<8, 0xc00, 16);
predict.at40 += predict.at44>>8;
predict.at34 = predict.at40 - predict.at38 - (12<<8);
@ -315,10 +315,10 @@ void fakePlayerProcess(PLAYER *pPlayer, InputPacket *pInput)
{
predict.Kills = (predict.Kills+17)&2047;
predict.at14 = (predict.at14+17)&2047;
predict.at8 = mulscale30(10*pPosture->bobV,Sin(predict.Kills*2));
predict.atc = mulscale30(predict.bobPhase*pPosture->bobH,Sin(predict.Kills-256));
predict.at18 = mulscale30(predict.bobPhase*pPosture->swayV,Sin(predict.at14*2));
predict.at1c = mulscale30(predict.bobPhase*pPosture->swayH,Sin(predict.at14-0x155));
predict.at8 = MulScale(10*pPosture->bobV,Sin(predict.Kills*2), 30);
predict.atc = MulScale(predict.bobPhase*pPosture->bobH,Sin(predict.Kills-256), 30);
predict.at18 = MulScale(predict.bobPhase*pPosture->swayV,Sin(predict.at14*2), 30);
predict.at1c = MulScale(predict.bobPhase*pPosture->swayH,Sin(predict.at14-0x155), 30);
}
else
{
@ -337,10 +337,10 @@ void fakePlayerProcess(PLAYER *pPlayer, InputPacket *pInput)
predict.bobPhase = ClipHigh(predict.bobPhase + nSpeed, 30);
}
}
predict.at8 = mulscale30(predict.bobPhase*pPosture->bobV,Sin(predict.Kills*2));
predict.atc = mulscale30(predict.bobPhase*pPosture->bobH,Sin(predict.Kills-256));
predict.at18 = mulscale30(predict.bobPhase*pPosture->swayV,Sin(predict.at14*2));
predict.at1c = mulscale30(predict.bobPhase*pPosture->swayH,Sin(predict.at14-0x155));
predict.at8 = MulScale(predict.bobPhase*pPosture->bobV,Sin(predict.Kills*2), 30);
predict.atc = MulScale(predict.bobPhase*pPosture->bobH,Sin(predict.Kills-256), 30);
predict.at18 = MulScale(predict.bobPhase*pPosture->swayV,Sin(predict.at14*2), 30);
predict.at1c = MulScale(predict.bobPhase*pPosture->swayH,Sin(predict.at14-0x155), 30);
}
if (!pXSprite->health)
return;
@ -535,7 +535,7 @@ static void fakeMoveDude(spritetype *pSprite)
predict.at75.ceilhit = ceilHit;
predict.at58 += ClipLow(ceilZ-top, 0);
if (predict.at64 <= 0 && (predict.at73&4))
predict.at64 = mulscale16(-predict.at64, 0x2000);
predict.at64 = MulScale(-predict.at64, 0x2000, 16);
}
else
predict.at75.ceilhit = 0;
@ -586,14 +586,14 @@ static void fakeActAirDrag(spritetype *, int num)
{
int vel = pXSector->windVel<<12;
if (!pXSector->windAlways && pXSector->busy)
vel = mulscale16(vel, pXSector->busy);
xvec = mulscale30(vel, Cos(pXSector->windAng));
yvec = mulscale30(vel, Sin(pXSector->windAng));
vel = MulScale(vel, pXSector->busy, 16);
xvec = MulScale(vel, Cos(pXSector->windAng), 30);
yvec = MulScale(vel, Sin(pXSector->windAng), 30);
}
}
predict.at5c += mulscale16(xvec-predict.at5c, num);
predict.at60 += mulscale16(yvec-predict.at60, num);
predict.at64 -= mulscale16(predict.at64, num);
predict.at5c += MulScale(xvec-predict.at5c, num, 16);
predict.at60 += MulScale(yvec-predict.at60, num, 16);
predict.at64 -= MulScale(predict.at64, num, 16);
}
void fakeActProcessSprites(void)
@ -626,12 +626,12 @@ void fakeActProcessSprites(void)
{
speed = pXSector->panVel << 9;
if (!pXSector->panAlways && pXSector->busy)
speed = mulscale16(speed, pXSector->busy);
speed = MulScale(speed, pXSector->busy, 16);
}
if (sector[nSector].floorstat&64)
angle = (GetWallAngle(sector[nSector].wallptr)+512)&2047;
predict.at5c += mulscale30(speed,Cos(angle));
predict.at60 += mulscale30(speed,Sin(angle));
predict.at5c += MulScale(speed,Cos(angle), 30);
predict.at60 += MulScale(speed,Sin(angle), 30);
}
}
if (pXSector && pXSector->Underwater)

View file

@ -196,7 +196,7 @@ private:
void TileHGauge(int nTile, double x, double y, int nMult, int nDiv, int nStat = 0, int nScale = 65536)
{
int w = tileWidth(nTile);
int bx = scale(mulscale16(w, nScale), nMult, nDiv) + x;
int bx = scale(MulScale(w, nScale, 16), nMult, nDiv) + x;
double scale = double(bx - x) / w;
double sc = nScale / 65536.;
DrawGraphic(tileGetTexture(nTile, true), x, y, DI_ITEM_LEFT_TOP, 1., -1, -1, scale*sc, sc, 0xffffffff, 0, 0);

View file

@ -86,7 +86,7 @@ int GetWaveValue(int a, int b, int c)
case 4:
return ((255-(b>>3))*c)>>8;
case 5:
return (c+mulscale30(c,Sin(b)))>>1;
return (c+MulScale(c,Sin(b), 30))>>1;
case 6:
return flicker1[b>>5]*c;
case 7:
@ -100,7 +100,7 @@ int GetWaveValue(int a, int b, int c)
case 11:
if (b*4 > 2048)
return 0;
return (c-mulscale30(c, Cos(b*4)))>>1;
return (c-MulScale(c, Cos(b*4), 30))>>1;
}
return 0;
}
@ -162,7 +162,7 @@ void DoSectorLighting(void)
int t2 = pXSector->amplitude;
if (!pXSector->shadeAlways && pXSector->busy)
{
t2 = mulscale16(t2, pXSector->busy);
t2 = MulScale(t2, pXSector->busy, 16);
}
int v4 = GetWaveValue(t1, pXSector->phase*8+pXSector->freq*gFrameClock, t2);
if (pXSector->shadeFloor)
@ -271,7 +271,7 @@ void DoSectorPanning(void)
int angle = pXSector->panAngle+1024;
int speed = pXSector->panVel<<10;
if (!pXSector->panAlways && (pXSector->busy&0xffff))
speed = mulscale16(speed, pXSector->busy);
speed = MulScale(speed, pXSector->busy, 16);
if (pXSector->panFloor) // Floor
{
@ -279,9 +279,9 @@ void DoSectorPanning(void)
if (pSector->floorstat & 64)
angle -= 512;
int xBits = tileWidth(nTile) >> int((pSector->floorstat & 8) != 0);
int px = mulscale30(speed << 2, Cos(angle)) / xBits;
int px = MulScale(speed << 2, Cos(angle), 30) / xBits;
int yBits = tileHeight(nTile) >> int((pSector->floorstat & 8) != 0);
int py = mulscale30(speed << 2, Sin(angle)) / yBits;
int py = MulScale(speed << 2, Sin(angle), 30) / yBits;
pSector->addfloorxpan(px * (1. / 256));
pSector->addfloorypan(-py * (1. / 256));
}
@ -291,9 +291,9 @@ void DoSectorPanning(void)
if (pSector->ceilingstat & 64)
angle -= 512;
int xBits = tileWidth(nTile) >> int((pSector->ceilingstat & 8) != 0);
int px = mulscale30(speed << 2, Cos(angle)) / xBits;
int px = MulScale(speed << 2, Cos(angle), 30) / xBits;
int yBits = tileHeight(nTile) >> int((pSector->ceilingstat & 8) != 0);
int py = mulscale30(speed << 2, Sin(angle)) / yBits;
int py = MulScale(speed << 2, Sin(angle), 30) / yBits;
pSector->addceilingxpan(px * (1. / 256));
pSector->addceilingypan(-py * (1. / 256));
}
@ -311,8 +311,8 @@ void DoSectorPanning(void)
int psy = pXWall->panYVel<<10;
if (!pXWall->panAlways && (pXWall->busy & 0xffff))
{
psx = mulscale16(psx, pXWall->busy);
psy = mulscale16(psy, pXWall->busy);
psx = MulScale(psx, pXWall->busy, 16);
psy = MulScale(psy, pXWall->busy, 16);
}
int nTile = wall[nWall].picnum;
int px = (psx << 2) / tileWidth(nTile);

View file

@ -286,12 +286,12 @@ void UpdateSprite(int nXSprite, SEQFRAME* pFrame)
int scale = xsprite[nXSprite].scale; // SEQ size scaling
if (pFrame->xrepeat) {
if (scale) pSprite->xrepeat = ClipRange(mulscale8(pFrame->xrepeat, scale), 0, 255);
if (scale) pSprite->xrepeat = ClipRange(MulScale(pFrame->xrepeat, scale, 8), 0, 255);
else pSprite->xrepeat = pFrame->xrepeat;
}
if (pFrame->yrepeat) {
if (scale) pSprite->yrepeat = ClipRange(mulscale8(pFrame->yrepeat, scale), 0, 255);
if (scale) pSprite->yrepeat = ClipRange(MulScale(pFrame->yrepeat, scale, 8), 0, 255);
else pSprite->yrepeat = pFrame->yrepeat;
}

View file

@ -959,7 +959,7 @@ void ZTranslateSector(int nSector, XSECTOR *pXSector, int a3, int a4)
if (dz != 0)
{
int oldZ = pSector->floorz;
baseFloor[nSector] = pSector->floorz = pXSector->offFloorZ + mulscale16(dz, GetWaveValue(a3, a4));
baseFloor[nSector] = pSector->floorz = pXSector->offFloorZ + MulScale(dz, GetWaveValue(a3, a4), 16);
velFloor[nSector] += (pSector->floorz-oldZ)<<8;
int nSprite;
SectIterator it(nSector);
@ -988,7 +988,7 @@ void ZTranslateSector(int nSector, XSECTOR *pXSector, int a3, int a4)
if (dz != 0)
{
int oldZ = pSector->ceilingz;
baseCeil[nSector] = pSector->ceilingz = pXSector->offCeilZ + mulscale16(dz, GetWaveValue(a3, a4));
baseCeil[nSector] = pSector->ceilingz = pXSector->offCeilZ + MulScale(dz, GetWaveValue(a3, a4), 16);
velCeil[nSector] += (pSector->ceilingz-oldZ)<<8;
int nSprite;
SectIterator it(nSector);
@ -1071,11 +1071,11 @@ int VCrushBusy(unsigned int nSector, unsigned int a2)
int dz1 = pXSector->onCeilZ - pXSector->offCeilZ;
int vc = pXSector->offCeilZ;
if (dz1 != 0)
vc += mulscale16(dz1, GetWaveValue(a2, nWave));
vc += MulScale(dz1, GetWaveValue(a2, nWave), 16);
int dz2 = pXSector->onFloorZ - pXSector->offFloorZ;
int v10 = pXSector->offFloorZ;
if (dz2 != 0)
v10 += mulscale16(dz2, GetWaveValue(a2, nWave));
v10 += MulScale(dz2, GetWaveValue(a2, nWave), 16);
int v18;
if (GetHighestSprite(nSector, 6, &v18) >= 0 && vc >= v18)
return 1;
@ -1118,7 +1118,7 @@ int VSpriteBusy(unsigned int nSector, unsigned int a2)
if (pSprite->cstat&8192)
{
viewBackupSpriteLoc(nSprite, pSprite);
pSprite->z = baseSprite[nSprite].z+mulscale16(dz1, GetWaveValue(a2, nWave));
pSprite->z = baseSprite[nSprite].z+MulScale(dz1, GetWaveValue(a2, nWave), 16);
}
}
}
@ -1133,7 +1133,7 @@ int VSpriteBusy(unsigned int nSector, unsigned int a2)
if (pSprite->cstat&16384)
{
viewBackupSpriteLoc(nSprite, pSprite);
pSprite->z = baseSprite[nSprite].z+mulscale16(dz2, GetWaveValue(a2, nWave));
pSprite->z = baseSprite[nSprite].z+MulScale(dz2, GetWaveValue(a2, nWave), 16);
}
}
}
@ -1885,8 +1885,8 @@ void ProcessMotion(void)
else if (pXSector->busy == 0)
continue;
else
pXSector->bobTheta += mulscale16(pXSector->bobSpeed, pXSector->busy);
int vdi = mulscale30(Sin(pXSector->bobTheta), pXSector->bobZRange<<8);
pXSector->bobTheta += MulScale(pXSector->bobSpeed, pXSector->busy, 16);
int vdi = MulScale(Sin(pXSector->bobTheta), pXSector->bobZRange<<8, 30);
int nSprite;
SectIterator it(nSector);
while ((nSprite = it.NextIndex()) >= 0)

View file

@ -190,9 +190,9 @@ void viewInit(void)
for (int i = 0; i < 16; i++)
{
dword_172CE0[i][0] = mulscale16(wrand(), 2048);
dword_172CE0[i][1] = mulscale16(wrand(), 2048);
dword_172CE0[i][2] = mulscale16(wrand(), 2048);
dword_172CE0[i][0] = MulScale(wrand(), 2048, 16);
dword_172CE0[i][1] = MulScale(wrand(), 2048, 16);
dword_172CE0[i][2] = MulScale(wrand(), 2048, 16);
}
}
@ -202,8 +202,8 @@ int othercameraclock, cameraclock;
void CalcOtherPosition(spritetype *pSprite, int *pX, int *pY, int *pZ, int *vsectnum, int nAng, fixed_t zm, int smoothratio)
{
int vX = mulscale30(-Cos(nAng), 1280);
int vY = mulscale30(-Sin(nAng), 1280);
int vX = MulScale(-Cos(nAng), 1280, 30);
int vY = MulScale(-Sin(nAng), 1280, 30);
int vZ = FixedToInt(mulscale(zm, 1280, 3))-(16<<8);
int bakCstat = pSprite->cstat;
pSprite->cstat &= ~256;
@ -235,10 +235,10 @@ void CalcOtherPosition(spritetype *pSprite, int *pX, int *pY, int *pZ, int *vsec
}
othercameradist = nDist;
}
*pX += mulscale16(vX, othercameradist);
*pY += mulscale16(vY, othercameradist);
*pZ += mulscale16(vZ, othercameradist);
int myclock = gFrameClock + mulscale16(4, smoothratio);
*pX += MulScale(vX, othercameradist, 16);
*pY += MulScale(vY, othercameradist, 16);
*pZ += MulScale(vZ, othercameradist, 16);
int myclock = gFrameClock + MulScale(4, smoothratio, 16);
othercameradist = ClipHigh(othercameradist+((myclock-othercameraclock)<<10), 65536);
othercameraclock = myclock;
assert(*vsectnum >= 0 && *vsectnum < kMaxSectors);
@ -248,8 +248,8 @@ void CalcOtherPosition(spritetype *pSprite, int *pX, int *pY, int *pZ, int *vsec
void CalcPosition(spritetype *pSprite, int *pX, int *pY, int *pZ, int *vsectnum, int nAng, fixed_t zm, int smoothratio)
{
int vX = mulscale30(-Cos(nAng), 1280);
int vY = mulscale30(-Sin(nAng), 1280);
int vX = MulScale(-Cos(nAng), 1280, 30);
int vY = MulScale(-Sin(nAng), 1280, 30);
int vZ = FixedToInt(mulscale(zm, 1280, 3))-(16<<8);
int bakCstat = pSprite->cstat;
pSprite->cstat &= ~256;
@ -282,10 +282,10 @@ void CalcPosition(spritetype *pSprite, int *pX, int *pY, int *pZ, int *vsectnum,
}
cameradist = nDist;
}
*pX += mulscale16(vX, cameradist);
*pY += mulscale16(vY, cameradist);
*pZ += mulscale16(vZ, cameradist);
int myclock = gFrameClock + mulscale16(4, smoothratio);
*pX += MulScale(vX, cameradist, 16);
*pY += MulScale(vY, cameradist, 16);
*pZ += MulScale(vZ, cameradist, 16);
int myclock = gFrameClock + MulScale(4, smoothratio, 16);
cameradist = ClipHigh(cameradist+((myclock-cameraclock)<<10), 65536);
cameraclock = myclock;
assert(*vsectnum >= 0 && *vsectnum < kMaxSectors);
@ -413,17 +413,17 @@ void viewUpdateDelirium(void)
if (powerCount < 512)
{
int powerScale = IntToFixed(powerCount) / 512;
tilt1 = mulscale16(tilt1, powerScale);
tilt2 = mulscale16(tilt2, powerScale);
pitch = mulscale16(pitch, powerScale);
tilt1 = MulScale(tilt1, powerScale, 16);
tilt2 = MulScale(tilt2, powerScale, 16);
pitch = MulScale(pitch, powerScale, 16);
}
int sin2 = costable[(2*timer-512)&2047] / 2;
int sin3 = costable[(3*timer-512)&2047] / 2;
gScreenTilt = mulscale30(sin2+sin3,tilt1);
gScreenTilt = MulScale(sin2+sin3,tilt1, 30);
int sin4 = costable[(4*timer-512)&2047] / 2;
deliriumTurn = mulscale30(sin3+sin4,tilt2);
deliriumTurn = MulScale(sin3+sin4,tilt2, 30);
int sin5 = costable[(5*timer-512)&2047] / 2;
deliriumPitch = mulscale30(sin4+sin5,pitch);
deliriumPitch = MulScale(sin4+sin5,pitch, 30);
return;
}
gScreenTilt = ((gScreenTilt+1024)&2047)-1024;
@ -620,13 +620,13 @@ void viewDrawScreen(bool sceneonly)
cZ += shakeZ;
v4c += shakeBobX;
v48 += shakeBobY;
cH += buildhoriz(mulscale30(0x40000000 - Cos(gView->tiltEffect << 2), 30));
cH += buildhoriz(MulScale(0x40000000 - Cos(gView->tiltEffect << 2), 30, 30));
if (gViewPos == 0)
{
if (cl_viewhbob)
{
cX -= mulscale30(v74, Sin(cA.asbuild())) >> 4;
cY += mulscale30(v74, Cos(cA.asbuild())) >> 4;
cX -= MulScale(v74, Sin(cA.asbuild()), 30) >> 4;
cY += MulScale(v74, Cos(cA.asbuild()), 30) >> 4;
}
if (cl_viewvbob)
{
@ -634,7 +634,7 @@ void viewDrawScreen(bool sceneonly)
}
cZ += xs_CRoundToInt(cH.asq16() / 6553.6);
cameradist = -1;
cameraclock = gFrameClock +mulscale16(4, (int)gInterpolate);
cameraclock = gFrameClock +MulScale(4, (int)gInterpolate, 16);
}
else
{
@ -670,7 +670,7 @@ void viewDrawScreen(bool sceneonly)
tmp--;
}
PLAYER* pOther = &gPlayer[i];
//othercameraclock = gFrameClock + mulscale16(4, (int)gInterpolate);;
//othercameraclock = gFrameClock + MulScale(4, (int)gInterpolate, 16);;
if (!tileData(4079))
{
TileFiles.tileCreate(4079, 128, 128);
@ -747,7 +747,7 @@ void viewDrawScreen(bool sceneonly)
}
else
{
othercameraclock = gFrameClock + mulscale16(4, (int)gInterpolate);
othercameraclock = gFrameClock + MulScale(4, (int)gInterpolate, 16);
}
if (!bDelirium)
@ -941,8 +941,8 @@ bool GameInterface::DrawAutomapPlayer(int x, int y, int z, int a, double const s
// [MR]: Confirm that this is correct as math doesn't match the variable names.
int nCos = z * -bsin(a);
int nSin = z * -bcos(a);
int nCos2 = mulscale16(nCos, yxaspect);
int nSin2 = mulscale16(nSin, yxaspect);
int nCos2 = MulScale(nCos, yxaspect, 16);
int nSin2 = MulScale(nSin, yxaspect, 16);
int nPSprite = gView->pSprite->index;
for (int i = connecthead; i >= 0; i = connectpoint2[i])

View file

@ -268,7 +268,7 @@ void WeaponDraw(PLAYER *pPlayer, int shade, double xpos, double ypos, int palnum
// Double shotgun fix from BloodGDX.
if (/*!IsOriginalDemo() &&*/ (pPlayer->weaponState == -1 || (pPlayer->curWeapon == 3 && pPlayer->weaponState == 7)) && isOriginalQAV())
duration = pQAV->duration - 1;
else duration = (gFrameClock + mulscale16(4, smoothratio)) % pQAV->duration;
else duration = (gFrameClock + MulScale(4, smoothratio, 16)) % pQAV->duration;
}
else duration = pQAV->duration - pPlayer->weaponTimer;
@ -379,8 +379,8 @@ void UpdateAimVector(PLAYER * pPlayer)
y2 += (yvel[nSprite]*t)>>12;
z2 += (zvel[nSprite]*t)>>8;
}
int lx = x + mulscale30(Cos(pPSprite->ang), nDist);
int ly = y + mulscale30(Sin(pPSprite->ang), nDist);
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 top, bottom;
@ -431,10 +431,10 @@ void UpdateAimVector(PLAYER * pPlayer)
int nDist = approxDist(dx, dy);
if (nDist == 0 || nDist > 51200)
continue;
int lx = x + mulscale30(Cos(pPSprite->ang), nDist);
int ly = y + mulscale30(Sin(pPSprite->ang), nDist);
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 = mulscale10(9460, nDist);
int zRange = MulScale(9460, nDist, 10);
int top, bottom;
GetSpriteExtents(pSprite, &top, &bottom);
if (lz-zRange>bottom || lz+zRange<top)
@ -1027,7 +1027,7 @@ void FireSpray(int, PLAYER *pPlayer)
void ThrowCan(int, PLAYER *pPlayer)
{
sfxKill3DSound(pPlayer->pSprite, -1, 441);
int nSpeed = mulscale16(pPlayer->throwPower, 0x177777)+0x66666;
int nSpeed = MulScale(pPlayer->throwPower, 0x177777, 16)+0x66666;
sfxPlay3DSound(pPlayer->pSprite, 455, 1, 0);
spritetype *pSprite = playerFireThing(pPlayer, 0, -9460, kThingArmedSpray, nSpeed);
if (pSprite)
@ -1067,7 +1067,7 @@ void ExplodeCan(int, PLAYER *pPlayer)
void ThrowBundle(int, PLAYER *pPlayer)
{
sfxKill3DSound(pPlayer->pSprite, 16, -1);
int nSpeed = mulscale16(pPlayer->throwPower, 0x177777)+0x66666;
int nSpeed = MulScale(pPlayer->throwPower, 0x177777, 16)+0x66666;
sfxPlay3DSound(pPlayer->pSprite, 455, 1, 0);
spritetype *pSprite = playerFireThing(pPlayer, 0, -9460, kThingArmedTNTBundle, nSpeed);
int nXSprite = pSprite->extra;
@ -1101,7 +1101,7 @@ void ExplodeBundle(int, PLAYER *pPlayer)
void ThrowProx(int, PLAYER *pPlayer)
{
int nSpeed = mulscale16(pPlayer->throwPower, 0x177777)+0x66666;
int nSpeed = MulScale(pPlayer->throwPower, 0x177777, 16)+0x66666;
sfxPlay3DSound(pPlayer->pSprite, 455, 1, 0);
spritetype *pSprite = playerFireThing(pPlayer, 0, -9460, kThingArmedProxBomb, nSpeed);
evPost(pSprite->index, 3, 240, kCmdOn);
@ -1118,7 +1118,7 @@ void DropProx(int, PLAYER *pPlayer)
void ThrowRemote(int, PLAYER *pPlayer)
{
int nSpeed = mulscale16(pPlayer->throwPower, 0x177777)+0x66666;
int nSpeed = MulScale(pPlayer->throwPower, 0x177777, 16)+0x66666;
sfxPlay3DSound(pPlayer->pSprite, 455, 1, 0);
spritetype *pSprite = playerFireThing(pPlayer, 0, -9460, kThingArmedRemoteBomb, nSpeed);
int nXSprite = pSprite->extra;
@ -1612,7 +1612,7 @@ void FireNapalm2(int nTrigger, PLAYER *pPlayer)
void AltFireNapalm(int nTrigger, PLAYER *pPlayer)
{
UNREFERENCED_PARAMETER(nTrigger);
int nSpeed = mulscale16(0x8000, 0x177777)+0x66666;
int nSpeed = MulScale(0x8000, 0x177777, 16)+0x66666;
spritetype *pMissile = playerFireThing(pPlayer, 0, -4730, kThingNapalmBall, nSpeed);
if (pMissile)
{

View file

@ -50,19 +50,6 @@ static inline int32_t scale(int32_t eax, int32_t edx, int32_t ecx)
}
//
// Generic C
//
#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)); } \
EDUKE32_GENERATE_PRAGMAS
#undef EDUKE32_SCALER_PRAGMA
#define klabs(x) abs(x)
static inline constexpr int ksgn(int32_t a) { return (a > 0) - (a < 0); }

View file

@ -649,8 +649,8 @@ int32_t clipmove(vec3_t * const pos, int16_t * const sectnum, int32_t xvect, int
if (clipinsideboxline(cent.x, cent.y, p1.x, p1.y, p2.x, p2.y, rad) != 0)
{
vec2_t v = { mulscale14(bcos(spr->ang + 256), walldist),
mulscale14(bsin(spr->ang + 256), walldist) };
vec2_t v = { MulScale(bcos(spr->ang + 256), walldist, 14),
MulScale(bsin(spr->ang + 256), walldist, 14) };
if ((p1.x-pos->x) * (p2.y-pos->y) >= (p2.x-pos->x) * (p1.y-pos->y)) // Front
addclipline(p1.x+v.x, p1.y+v.y, p2.x+v.y, p2.y-v.x, (int16_t)j+49152, false);
@ -685,8 +685,8 @@ int32_t clipmove(vec3_t * const pos, int16_t * const sectnum, int32_t xvect, int
get_floorspr_points((uspriteptr_t) spr, 0, 0, &rxi[0], &rxi[1], &rxi[2], &rxi[3],
&ryi[0], &ryi[1], &ryi[2], &ryi[3]);
vec2_t v = { mulscale14(bcos(spr->ang - 256), walldist),
mulscale14(bsin(spr->ang - 256), walldist) };
vec2_t v = { MulScale(bcos(spr->ang - 256), walldist, 14),
MulScale(bsin(spr->ang - 256), walldist, 14) };
if ((rxi[0]-pos->x) * (ryi[1]-pos->y) < (rxi[1]-pos->x) * (ryi[0]-pos->y))
{
@ -755,7 +755,7 @@ int32_t clipmove(vec3_t * const pos, int16_t * const sectnum, int32_t xvect, int
int32_t const i = (enginecompatibility_mode == ENGINECOMPATIBILITY_19950829 || (klabs(templl2)>>11) < templl) ?
divscale64(templl2, templl, 20) : 0;
goal = { mulscale20(clipr.x, i)+vec.x, mulscale20(clipr.y, i)+vec.y };
goal = { MulScale(clipr.x, i, 20)+vec.x, MulScale(clipr.y, i, 20)+vec.y };
}
int32_t tempint;
@ -922,8 +922,8 @@ int pushmove(vec3_t *const vect, int16_t *const sectnum,
daz2 = dax*dax+day*day;
if (daz >= daz2) t = (1<<30); else t = divscale30(daz, daz2);
}
dax = wal->x + mulscale30(dax, t);
day = wal->y + mulscale30(day, t);
dax = wal->x + MulScale(dax, t, 30);
day = wal->y + MulScale(day, t, 30);
closest = { dax, day };
}
@ -1140,8 +1140,8 @@ void getzrange(const vec3_t *pos, int16_t sectnum,
get_floorspr_points((uspriteptr_t) &sprite[j], pos->x, pos->y, &v1.x, &v2.x, &v3.x, &v4.x,
&v1.y, &v2.y, &v3.y, &v4.y);
vec2_t const da = { mulscale14(bcos(sprite[j].ang - 256), walldist + 4),
mulscale14(bsin(sprite[j].ang - 256), walldist + 4) };
vec2_t const da = { MulScale(bcos(sprite[j].ang - 256), walldist + 4, 14),
MulScale(bsin(sprite[j].ang - 256), walldist + 4, 14) };
v1.x += da.x; v2.x -= da.y; v3.x -= da.x; v4.x += da.y;
v1.y += da.y; v2.y += da.x; v3.y -= da.y; v4.y -= da.x;
@ -1200,7 +1200,7 @@ int32_t try_facespr_intersect(uspriteptr_t const spr, vec3_t const in,
siz = tileWidth(spr->picnum) * spr->xrepeat;
if (dist > mulscale7(siz, siz)) return 0;
if (dist > MulScale(siz, siz, 7)) return 0;
newpos.vec2 = { in.x + scale(vx, topt, bot), in.y + scale(vy, topt, bot) };
@ -1251,9 +1251,9 @@ static int32_t hitscan_trysector(const vec3_t *sv, usectorptr_t sec, hitdata_t *
if (((i^j) >= 0) && ((klabs(i)>>1) < klabs(j)))
{
i = divscale30(i,j);
x1 = sv->x + mulscale30(vx,i);
y1 = sv->y + mulscale30(vy,i);
z1 = sv->z + mulscale30(vz,i);
x1 = sv->x + MulScale(vx,i, 30);
y1 = sv->y + MulScale(vy,i, 30);
z1 = sv->z + MulScale(vz,i, 30);
}
}
}
@ -1263,8 +1263,8 @@ static int32_t hitscan_trysector(const vec3_t *sv, usectorptr_t sec, hitdata_t *
if ((klabs(i)>>1) < vz*how)
{
i = divscale30(i,vz);
x1 = sv->x + mulscale30(vx,i);
y1 = sv->y + mulscale30(vy,i);
x1 = sv->x + MulScale(vx,i, 30);
y1 = sv->y + MulScale(vy,i, 30);
}
}
@ -1476,9 +1476,9 @@ int32_t hitscan(const vec3_t *sv, int16_t sectnum, int32_t vx, int32_t vy, int32
if (tileLoad(tilenum))
{
// daz-intz > 0 && daz-intz < k
int32_t xtex = mulscale16(ucoefup16, tileWidth(tilenum));
int32_t xtex = MulScale(ucoefup16, tileWidth(tilenum), 16);
int32_t vcoefup16 = 65536-divscale16(daz-intz, k);
int32_t ytex = mulscale16(vcoefup16, tileHeight(tilenum));
int32_t ytex = MulScale(vcoefup16, tileHeight(tilenum), 16);
auto texel = (tilePtr(tilenum) + tileHeight(tilenum)*xtex + ytex);
if (*texel == TRANSPARENT_INDEX)

View file

@ -663,9 +663,9 @@ int32_t lintersect(const int32_t originX, const int32_t originY, const int32_t o
}
t = (t << 24) / rayLengthSquared;
*intersectionX = originX + mulscale24(ray.x, t);
*intersectionY = originY + mulscale24(ray.y, t);
*intersectionZ = originZ + mulscale24(destZ-originZ, t);
*intersectionX = originX + MulScale(ray.x, t, 24);
*intersectionY = originY + MulScale(ray.y, t, 24);
*intersectionZ = originZ + MulScale(destZ-originZ, t, 24);
return 1;
}
@ -692,9 +692,9 @@ int32_t lintersect(const int32_t originX, const int32_t originY, const int32_t o
int64_t t = (int64_t(originDiffCrossLineVec) << 24) / rayCrossLineVec;
// For sake of completeness/readability, alternative to the above approach for an early out & avoidance of an extra division:
*intersectionX = originX + mulscale24(ray.x, t);
*intersectionY = originY + mulscale24(ray.y, t);
*intersectionZ = originZ + mulscale24(destZ-originZ, t);
*intersectionX = originX + MulScale(ray.x, t, 24);
*intersectionY = originY + MulScale(ray.y, t, 24);
*intersectionZ = originZ + MulScale(destZ-originZ, t, 24);
return 1;
}
@ -727,9 +727,9 @@ int32_t rintersect_old(int32_t x1, int32_t y1, int32_t z1,
return -1;
int32_t t = divscale16(topt, bot);
*intx = x1 + mulscale16(vx, t);
*inty = y1 + mulscale16(vy, t);
*intz = z1 + mulscale16(vz, t);
*intx = x1 + MulScale(vx, t, 16);
*inty = y1 + MulScale(vy, t, 16);
*intz = z1 + MulScale(vz, t, 16);
t = divscale16(topu, bot);
@ -990,8 +990,8 @@ void set_globalang(fixed_t const ang)
cosglobalang = (int)fcosang;
singlobalang = (int)fsinang;
cosviewingrangeglobalang = mulscale16(cosglobalang,viewingrange);
sinviewingrangeglobalang = mulscale16(singlobalang,viewingrange);
cosviewingrangeglobalang = MulScale(cosglobalang,viewingrange, 16);
sinviewingrangeglobalang = MulScale(singlobalang,viewingrange, 16);
}
//
@ -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 = mulscale16(dahoriz, divscale16(xdimenscale, viewingrange))+IntToFixed(ydimen>>1);
qglobalhoriz = MulScale(dahoriz, divscale16(xdimenscale, viewingrange), 16)+IntToFixed(ydimen>>1);
globalcursectnum = dacursectnum;
@ -1232,7 +1232,7 @@ void renderDrawMasks(void)
{
const int32_t xp = DMulScale(ys,cosglobalang,-xs,singlobalang, 6);
if (mulscale24(labs(xp+yp),xdimen) >= yp)
if (MulScale(labs(xp+yp),xdimen, 24) >= yp)
goto killsprite;
spritesxyz[i].x = scale(xp+yp,xdimen<<7,yp);
@ -1568,8 +1568,8 @@ static void renderFillPolygon(int32_t npoints)
xb1[z] = 0;
FVector2 xtex, ytex, otex;
int x1 = mulscale16(globalx1, xyaspect);
int y2 = mulscale16(globaly2, xyaspect);
int x1 = MulScale(globalx1, xyaspect, 16);
int y2 = MulScale(globaly2, xyaspect, 16);
xtex.X = ((float)asm1) * (1.f / 4294967296.f);
xtex.Y = ((float)asm2) * (1.f / 4294967296.f);
ytex.X = ((float)x1) * (1.f / 4294967296.f);
@ -1600,8 +1600,8 @@ 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 vect = { mulscale8(-bsin(ang), zoome), mulscale8(-bcos(ang), zoome) };
vec2_t const vect2 = { mulscale16(vect.x, yxaspect), mulscale16(vect.y, yxaspect) };
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) };
int32_t sortnum = 0;
@ -1633,7 +1633,7 @@ void renderDrawMapView(int32_t dax, int32_t day, int32_t zoome, int16_t ang)
}
if (npoints > 0) xb1[npoints-1] = l; //overwrite point2
vec2_t bak = { rx1[0], mulscale16(ry1[0]-(ydim<<11),xyaspect)+(ydim<<11) };
vec2_t bak = { rx1[0], MulScale(ry1[0]-(ydim<<11),xyaspect, 16)+(ydim<<11) };
//Collect floor sprites to draw
@ -1676,8 +1676,8 @@ 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(DMulScale(ox,bakgvect.x,oy,bakgvect.y, 10),i);
globaly1 = mulscale10(DMulScale(ox,bakgvect.y,-oy,bakgvect.x, 10),i);
globalx1 = MulScale(DMulScale(ox,bakgvect.x,oy,bakgvect.y, 10),i, 10);
globaly1 = MulScale(DMulScale(ox,bakgvect.y,-oy,bakgvect.x, 10),i, 10);
ox = (bak.x>>4)-(xdim<<7); oy = (bak.y>>4)-(ydim<<7);
globalposx = DMulScale(-oy, globalx1, -ox, globaly1, 28);
globalposy = DMulScale(-ox, globalx1, oy, globaly1, 28);
@ -1686,9 +1686,9 @@ void renderDrawMapView(int32_t dax, int32_t day, int32_t zoome, int16_t ang)
int32_t const daslope = sector[s].floorheinum;
i = nsqrtasm(daslope*daslope+16777216);
set_globalpos(globalposx, mulscale12(globalposy,i), globalposz);
globalx2 = mulscale12(globalx2,i);
globaly2 = mulscale12(globaly2,i);
set_globalpos(globalposx, MulScale(globalposy,i, 12), globalposz);
globalx2 = MulScale(globalx2,i, 12);
globaly2 = MulScale(globaly2,i, 12);
}
int globalxshift = (8 - widthBits(globalpicnum));
@ -1771,7 +1771,7 @@ void renderDrawMapView(int32_t dax, int32_t day, int32_t zoome, int16_t ang)
rx1[3] = x; ry1[3] = y;
vec2_t bak = { rx1[0], mulscale16(ry1[0] - (ydim << 11), xyaspect) + (ydim << 11) };
vec2_t bak = { rx1[0], MulScale(ry1[0] - (ydim << 11), xyaspect, 16) + (ydim << 11) };
globalpicnum = spr->picnum;
@ -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(DMulScale(ox,bakgvect.x,oy,bakgvect.y, 10),i);
globaly1 = mulscale10(DMulScale(ox,bakgvect.y,-oy,bakgvect.x, 10),i);
globalx1 = MulScale(DMulScale(ox,bakgvect.x,oy,bakgvect.y, 10),i, 10);
globaly1 = MulScale(DMulScale(ox,bakgvect.y,-oy,bakgvect.x, 10),i, 10);
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(DMulScale(ox,bakgvect.x,oy,bakgvect.y, 10),i);
globaly2 = mulscale10(DMulScale(ox,bakgvect.y,-oy,bakgvect.x, 10),i);
globalx2 = MulScale(DMulScale(ox,bakgvect.x,oy,bakgvect.y, 10),i, 10);
globaly2 = MulScale(DMulScale(ox,bakgvect.y,-oy,bakgvect.x, 10),i, 10);
ox = widthBits(globalpicnum);
oy = heightBits(globalpicnum);
@ -2310,9 +2310,9 @@ int32_t cansee(int32_t x1, int32_t y1, int32_t z1, int16_t sect1, int32_t x2, in
return 0;
t = divscale24(t,bot);
x = x1 + mulscale24(x21,t);
y = y1 + mulscale24(y21,t);
z = z1 + mulscale24(z21,t);
x = x1 + MulScale(x21,t, 24);
y = y1 + MulScale(y21,t, 24);
z = z1 + MulScale(z21,t, 24);
getzsofslope(dasectnum, x,y, &cfz[0],&cfz[1]);
@ -2350,8 +2350,8 @@ void neartag(int32_t xs, int32_t ys, int32_t zs, int16_t sectnum, int16_t ange,
{
int16_t tempshortcnt, tempshortnum;
const int32_t vx = mulscale14(bcos(ange), neartagrange);
const int32_t vy = mulscale14(bsin(ange), neartagrange);
const int32_t vx = MulScale(bcos(ange), neartagrange, 14);
const int32_t vy = MulScale(bsin(ange), neartagrange, 14);
vec3_t hitv = { xs+vx, ys+vy, 0 };
const vec3_t sv = { xs, ys, zs };

View file

@ -202,11 +202,11 @@ static inline void get_wallspr_points(T const * const spr, int32_t *x1, int32_t
l = tileWidth(tilenum);
k = (l>>1)+xoff;
*x1 -= mulscale16(dax,k);
*x2 = *x1 + mulscale16(dax,l);
*x1 -= MulScale(dax,k, 16);
*x2 = *x1 + MulScale(dax,l, 16);
*y1 -= mulscale16(day,k);
*y2 = *y1 + mulscale16(day,l);
*y1 -= MulScale(day,k, 16);
*y2 = *y1 + MulScale(day,l, 16);
}
// x1, y1: in/out
@ -233,13 +233,13 @@ static inline void get_floorspr_points(T const * const spr, int32_t px, int32_t
vec2_t const center = { ((span.x >> 1) + adjofs.x) * repeat.x, ((span.y >> 1) + adjofs.y) * repeat.y };
vec2_t const rspan = { span.x * repeat.x, span.y * repeat.y };
vec2_t const ofs = { -mulscale16(cosang, rspan.y), -mulscale16(sinang, rspan.y) };
vec2_t const ofs = { -MulScale(cosang, rspan.y, 16), -MulScale(sinang, rspan.y, 16) };
*x1 += DMulScale(sinang, center.x, cosang, center.y, 16) - px;
*y1 += DMulScale(sinang, center.y, -cosang, center.x, 16) - py;
*x2 = *x1 - mulscale16(sinang, rspan.x);
*y2 = *y1 + mulscale16(cosang, rspan.x);
*x2 = *x1 - MulScale(sinang, rspan.x, 16);
*y2 = *y1 + MulScale(cosang, rspan.x, 16);
*x3 = *x2 + ofs.x, *x4 = *x1 + ofs.x;
*y3 = *y2 + ofs.y, *y4 = *y1 + ofs.y;

View file

@ -253,7 +253,7 @@ static void polymost_updaterotmat(void)
};
multiplyMatrix4f(matrix, tiltmatrix);
renderSetViewMatrix(matrix);
renderSetVisibility(mulscale16(g_visibility, mulscale16(xdimenscale, viewingrangerecip)) * fviewingrange * (1.f / (65536.f * 65536.f)) / r_ambientlight);
renderSetVisibility(MulScale(g_visibility, MulScale(xdimenscale, viewingrangerecip, 16), 16) * fviewingrange * (1.f / (65536.f * 65536.f)) / r_ambientlight);
}
const vec2_16_t tileSize(size_t index)
@ -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 = mulscale16(dahoriz, divscale16(xdimenscale, viewingrange))+IntToFixed(ydimen>>1);
qglobalhoriz = MulScale(dahoriz, divscale16(xdimenscale, viewingrange), 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));

View file

@ -236,11 +236,11 @@ void AutomapControl()
if (buttonMap.ButtonDown(gamefunc_AM_PanDown))
panvert -= keymove;
int momx = mulscale9(panvert, bcos(follow_a));
int momy = mulscale9(panvert, bsin(follow_a));
int momx = MulScale(panvert, bcos(follow_a), 9);
int momy = MulScale(panvert, bsin(follow_a), 9);
momx += mulscale9(panhorz, bsin(follow_a));
momy += mulscale9(panhorz, -bcos(follow_a));
momx += MulScale(panhorz, bsin(follow_a), 9);
momy += MulScale(panhorz, -bcos(follow_a), 9);
follow_x += int(momx * j);
follow_y += int(momy * j);
@ -408,8 +408,8 @@ void drawredlines(int cposx, int cposy, int czoom, int cang)
{
int xvect = -bsin(cang) * czoom;
int yvect = -bcos(cang) * czoom;
int xvect2 = mulscale16(xvect, yxaspect);
int yvect2 = mulscale16(yvect, yxaspect);
int xvect2 = MulScale(xvect, yxaspect, 16);
int yvect2 = MulScale(yvect, yxaspect, 16);
for (int i = 0; i < numsectors; i++)
{
@ -460,8 +460,8 @@ static void drawwhitelines(int cposx, int cposy, int czoom, int cang)
{
int xvect = -bsin(cang) * czoom;
int yvect = -bcos(cang) * czoom;
int xvect2 = mulscale16(xvect, yxaspect);
int yvect2 = mulscale16(yvect, yxaspect);
int xvect2 = MulScale(xvect, yxaspect, 16);
int yvect2 = MulScale(yvect, yxaspect, 16);
for (int i = numsectors - 1; i >= 0; i--)
{
@ -510,8 +510,8 @@ void DrawPlayerArrow(int cposx, int cposy, int cang, int pl_x, int pl_y, int zoo
int xvect = -bsin(cang) * zoom;
int yvect = -bcos(cang) * zoom;
int xvect2 = mulscale16(xvect, yxaspect);
int yvect2 = mulscale16(yvect, yxaspect);
int xvect2 = MulScale(xvect, yxaspect, 16);
int yvect2 = MulScale(yvect, yxaspect, 16);
int pxvect = -bsin(pl_angle);
int pyvect = -bcos(pl_angle);

View file

@ -74,8 +74,8 @@ bool GameInterface::DrawAutomapPlayer(int x, int y, int z, int a, double const s
// [MR]: Confirm that this is correct as math doesn't match the variable names.
int nCos = z * -bsin(a);
int nSin = z * -bcos(a);
int nCos2 = mulscale16(nCos, yxaspect);
int nSin2 = mulscale16(nSin, yxaspect);
int nCos2 = MulScale(nCos, yxaspect, 16);
int nSin2 = MulScale(nSin, yxaspect, 16);
for (int i = connecthead; i >= 0; i = connectpoint2[i])
{

View file

@ -189,7 +189,7 @@ void ResetView()
static inline int interpolate16(int a, int b, int smooth)
{
return a + mulscale16(b - a, smooth);
return a + MulScale(b - a, smooth, 16);
}
static TextOverlay subtitleOverlay;
@ -345,7 +345,7 @@ void DrawView(double smoothRatio, bool sceneonly)
videoSetCorrectedAspect();
renderSetAspect(mulscale16(vr, viewingrange), yxaspect);
renderSetAspect(MulScale(vr, viewingrange, 16), yxaspect);
if (HavePLURemap())
{

View file

@ -48,7 +48,7 @@ extern Loc oldLocs[MAXSPRITES];
static inline int angle_interpolate16(int a, int b, int smooth)
{
return a + mulscale16(((b+1024-a)&2047)-1024, smooth);
return a + MulScale(((b+1024-a)&2047)-1024, smooth, 16);
}
END_PS_NS

View file

@ -228,8 +228,8 @@ int ssp(DDukeActor* const actor, unsigned int cliptype) //The set sprite functio
Collision c;
return movesprite_ex(actor,
mulscale14(actor->s.xvel, bcos(actor->s.ang)),
mulscale14(actor->s.xvel, bsin(actor->s.ang)), actor->s.zvel,
MulScale(actor->s.xvel, bcos(actor->s.ang), 14),
MulScale(actor->s.xvel, bsin(actor->s.ang), 14), actor->s.zvel,
cliptype, c) == kHitNone;
}
@ -287,8 +287,8 @@ void ms(DDukeActor* const actor)
int tx, ty;
auto s = &actor->s;
s->x += mulscale14(s->xvel, bcos(s->ang));
s->y += mulscale14(s->xvel, bsin(s->ang));
s->x += MulScale(s->xvel, bcos(s->ang), 14);
s->y += MulScale(s->xvel, bsin(s->ang), 14);
int j = actor->temp_data[1];
int k = actor->temp_data[2];
@ -1299,8 +1299,8 @@ void movecanwithsomething(DDukeActor* actor)
void bounce(DDukeActor* actor)
{
auto s = &actor->s;
int xvect = mulscale10(s->xvel, bcos(s->ang));
int yvect = mulscale10(s->xvel, bsin(s->ang));
int xvect = MulScale(s->xvel, bcos(s->ang), 10);
int yvect = MulScale(s->xvel, bsin(s->ang), 10);
int zvect = s->zvel;
int hitsect = s->sectnum;
@ -1314,8 +1314,8 @@ void bounce(DDukeActor* actor)
else
k = sector[hitsect].floorheinum;
int dax = mulscale14(k, bsin(daang));
int day = mulscale14(k, -bcos(daang));
int dax = MulScale(k, bsin(daang), 14);
int day = MulScale(k, -bcos(daang), 14);
int daz = 4096;
k = xvect * dax + yvect * day + zvect * daz;
@ -1323,9 +1323,9 @@ void bounce(DDukeActor* actor)
if ((abs(k) >> 14) < l)
{
k = divscale17(k, l);
xvect -= mulscale16(dax, k);
yvect -= mulscale16(day, k);
zvect -= mulscale16(daz, k);
xvect -= MulScale(dax, k, 16);
yvect -= MulScale(day, k, 16);
zvect -= MulScale(daz, k, 16);
}
s->zvel = zvect;
@ -1368,8 +1368,8 @@ void movetongue(DDukeActor *actor, int tongue, int jaw)
for (int k = 0; k < actor->temp_data[0]; k++)
{
auto q = EGS(s->sectnum,
s->x + mulscale9(k, bcos(s->ang)),
s->y + mulscale9(k, bsin(s->ang)),
s->x + MulScale(k, bcos(s->ang), 9),
s->y + MulScale(k, bsin(s->ang), 9),
s->z + ((k * ksgn(s->zvel)) * abs(s->zvel / 12)), tongue, -40 + (k << 1),
8, 8, 0, 0, 0, actor, 5);
if (q)
@ -1380,8 +1380,8 @@ void movetongue(DDukeActor *actor, int tongue, int jaw)
}
int k = actor->temp_data[0]; // do not depend on the above loop counter.
auto spawned = EGS(s->sectnum,
s->x + mulscale9(k, bcos(s->ang)),
s->y + mulscale9(k, bsin(s->ang)),
s->x + MulScale(k, bcos(s->ang), 9),
s->y + MulScale(k, bsin(s->ang), 9),
s->z + ((k * ksgn(s->zvel)) * abs(s->zvel / 12)), jaw, -40,
32, 32, 0, 0, 0, actor, 5);
if (spawned)
@ -1510,8 +1510,8 @@ bool queball(DDukeActor *actor, int pocket, int queball, int stripeball)
Collision coll;
int j = clipmove_ex(&s->x, &s->y, &s->z, &s->sectnum,
(mulscale14(s->xvel, bcos(s->ang)) * TICSPERFRAME) << 11,
(mulscale14(s->xvel, bsin(s->ang)) * TICSPERFRAME) << 11,
(MulScale(s->xvel, bcos(s->ang), 14) * TICSPERFRAME) << 11,
(MulScale(s->xvel, bsin(s->ang), 14) * TICSPERFRAME) << 11,
24L, (4 << 8), (4 << 8), CLIPMASK1, coll);
if (j == kHitWall)
@ -2297,8 +2297,8 @@ bool jibs(DDukeActor *actor, int JIBS6, bool timeout, bool callsetsprite, bool f
else s->zvel += gs.gravity - 50;
}
s->x += mulscale14(s->xvel, bcos(s->ang));
s->y += mulscale14(s->xvel, bsin(s->ang));
s->x += MulScale(s->xvel, bcos(s->ang), 14);
s->y += MulScale(s->xvel, bsin(s->ang), 14);
s->z += s->zvel;
if (floorcheck && s->z >= sector[s->sectnum].floorz)
@ -2580,8 +2580,8 @@ void scrap(DDukeActor* actor, int SCRAP1, int SCRAP6)
}
}
if (s->zvel < 4096) s->zvel += gs.gravity - 50;
s->x += mulscale14(s->xvel, bcos(s->ang));
s->y += mulscale14(s->xvel, bsin(s->ang));
s->x += MulScale(s->xvel, bcos(s->ang), 14);
s->y += MulScale(s->xvel, bsin(s->ang), 14);
s->z += s->zvel;
}
else
@ -2918,8 +2918,8 @@ void handle_se14(DDukeActor* actor, bool checkstat, int RPG, int JIBS6)
}
}
int m = mulscale14(s->xvel, bcos(s->ang));
x = mulscale14(s->xvel, bsin(s->ang));
int m = MulScale(s->xvel, bcos(s->ang), 14);
x = MulScale(s->xvel, bsin(s->ang), 14);
for (int p = connecthead; p >= 0; p = connectpoint2[p])
{
@ -3094,8 +3094,8 @@ void handle_se30(DDukeActor *actor, int JIBS6)
if (s->xvel)
{
int l = mulscale14(s->xvel, bcos(s->ang));
int x = mulscale14(s->xvel, bsin(s->ang));
int l = MulScale(s->xvel, bcos(s->ang), 14);
int x = MulScale(s->xvel, bsin(s->ang), 14);
if ((sc->floorz - sc->ceilingz) < (108 << 8))
if (ud.clipping == 0)
@ -3263,8 +3263,8 @@ void handle_se02(DDukeActor *actor)
else sc->floorheinum += (sgn(t[5] - sc->floorheinum) << 4);
}
int m = mulscale14(s->xvel, bcos(s->ang));
int x = mulscale14(s->xvel, bsin(s->ang));
int m = MulScale(s->xvel, bcos(s->ang), 14);
int x = MulScale(s->xvel, bsin(s->ang), 14);
for (int p = connecthead; p >= 0; p = connectpoint2[p])
@ -4296,8 +4296,8 @@ void handle_se20(DDukeActor* actor)
if (s->xvel) //Moving
{
int x = mulscale14(s->xvel, bcos(s->ang));
int l = mulscale14(s->xvel, bsin(s->ang));
int x = MulScale(s->xvel, bcos(s->ang), 14);
int l = MulScale(s->xvel, bsin(s->ang), 14);
t[3] += s->xvel;
@ -4423,8 +4423,8 @@ void handle_se26(DDukeActor* actor)
int x, l;
s->xvel = 32;
l = mulscale14(s->xvel, bcos(s->ang));
x = mulscale14(s->xvel, bsin(s->ang));
l = MulScale(s->xvel, bcos(s->ang), 14);
x = MulScale(s->xvel, bsin(s->ang), 14);
s->shade++;
if (s->shade > 7)
@ -4543,8 +4543,8 @@ void handle_se24(DDukeActor *actor, int16_t *list1, int16_t *list2, int TRIPBOMB
if (t[4]) return;
int x = mulscale18(actor->s.yvel, bcos(actor->s.ang));
int l = mulscale18(actor->s.yvel, bsin(actor->s.ang));
int x = MulScale(actor->s.yvel, bcos(actor->s.ang), 18);
int l = MulScale(actor->s.yvel, bsin(actor->s.ang), 18);
DukeSectIterator it(actor->s.sectnum);
while (auto a2 = it.Next())

View file

@ -1792,8 +1792,8 @@ static void weaponcommon_d(DDukeActor* proj)
Collision coll;
movesprite_ex(proj,
mulscale14(k, bcos(s->ang)),
mulscale14(k, bsin(s->ang)), ll, CLIPMASK1, coll);
MulScale(k, bcos(s->ang), 14),
MulScale(k, bsin(s->ang), 14), ll, CLIPMASK1, coll);
if (s->picnum == RPG && proj->temp_actor != nullptr)
if (FindDistance2D(s->x - proj->temp_actor->s.x, s->y - proj->temp_actor->s.y) < 256)
@ -1827,8 +1827,8 @@ static void weaponcommon_d(DDukeActor* proj)
for (k = -3; k < 2; k++)
{
auto spawned = EGS(s->sectnum,
s->x + mulscale9(k, bcos(s->ang)),
s->y + mulscale9(k, bsin(s->ang)),
s->x + MulScale(k, bcos(s->ang), 9),
s->y + MulScale(k, bsin(s->ang), 9),
s->z + ((k * ksgn(s->zvel)) * abs(s->zvel / 24)), FIRELASER, -40 + (k << 2),
s->xrepeat, s->yrepeat, 0, 0, 0, proj->GetOwner(), 5);
@ -2754,8 +2754,8 @@ static void flamethrowerflame(DDukeActor *actor)
}
Collision coll;
movesprite_ex(actor, mulscale14(xvel, bcos(s->ang)),
mulscale14(xvel, bsin(s->ang)), s->zvel, CLIPMASK1, coll);
movesprite_ex(actor, MulScale(xvel, bcos(s->ang), 14),
MulScale(xvel, bsin(s->ang), 14), s->zvel, CLIPMASK1, coll);
if (s->sectnum < 0)
{
@ -2878,8 +2878,8 @@ static void heavyhbomb(DDukeActor *actor)
Collision coll;
movesprite_ex(actor,
mulscale14(s->xvel, bcos(s->ang)),
mulscale14(s->xvel, bsin(s->ang)),
MulScale(s->xvel, bcos(s->ang), 14),
MulScale(s->xvel, bsin(s->ang), 14),
s->zvel, CLIPMASK0, coll);
if (sector[s->sectnum].lotag == 1 && s->zvel == 0)
@ -3729,7 +3729,7 @@ void moveeffectors_d(void) //STATNUM 3
case SE_29_WAVES:
act->s.hitag += 64;
l = mulscale12(act->s.yvel, bsin(act->s.hitag));
l = MulScale(act->s.yvel, bsin(act->s.hitag), 12);
sc->floorz = act->s.z + l;
break;
case SE_31_FLOOR_RISE_FALL: // True Drop Floor
@ -3972,8 +3972,8 @@ void move_d(DDukeActor *actor, int playernum, int xvel)
Collision coll;
actor->movflag = movesprite_ex(actor,
mulscale14(daxvel, bcos(angdif)),
mulscale14(daxvel, bsin(angdif)), spr->zvel, CLIPMASK0, coll);
MulScale(daxvel, bcos(angdif), 14),
MulScale(daxvel, bsin(angdif), 14), spr->zvel, CLIPMASK0, coll);
}
if (a)

View file

@ -1278,7 +1278,7 @@ static bool weaponhitwall(DDukeActor *proj, int wal, const vec3_t& oldpos)
j->s.yrepeat = 8;
j->s.cstat = 16;
j->s.ang = (j->s.ang + 512) & 2047;
j->s.clipdist = mulscale7(s->xrepeat, tileWidth(s->picnum));
j->s.clipdist = MulScale(s->xrepeat, tileWidth(s->picnum), 7);
}
deletesprite(proj);
return true;
@ -1410,8 +1410,8 @@ static void weaponcommon_r(DDukeActor *proj)
Collision coll;
movesprite_ex(proj,
mulscale14(k, bcos(s->ang)),
mulscale14(k, bsin(s->ang)), ll, CLIPMASK1, coll);
MulScale(k, bcos(s->ang), 14),
MulScale(k, bsin(s->ang), 14), ll, CLIPMASK1, coll);
if ((s->picnum == RPG || (isRRRA() && isIn(s->picnum, RPG2, RRTILE1790))) && proj->temp_actor != nullptr)
if (FindDistance2D(s->x - proj->temp_actor->s.x, s->y - proj->temp_actor->s.y) < 256)
@ -1444,8 +1444,8 @@ static void weaponcommon_r(DDukeActor *proj)
for (k = -3; k < 2; k++)
{
auto x = EGS(s->sectnum,
s->x + mulscale9(k, bcos(s->ang)),
s->y + mulscale9(k, bsin(s->ang)),
s->x + MulScale(k, bcos(s->ang), 9),
s->y + MulScale(k, bsin(s->ang), 9),
s->z + ((k * ksgn(s->zvel)) * abs(s->zvel / 24)), FIRELASER, -40 + (k << 2),
s->xrepeat, s->yrepeat, 0, 0, 0, proj->GetOwner(), 5);
@ -1915,8 +1915,8 @@ void movetransports_r(void)
changespritesect(act2, Owner->s.sectnum);
movesprite_ex(act2, mulscale14(spr2->xvel, bcos(spr2->ang)),
mulscale14(spr2->xvel, bsin(spr2->ang)), 0, CLIPMASK1, coll);
movesprite_ex(act2, MulScale(spr2->xvel, bcos(spr2->ang), 14),
MulScale(spr2->xvel, bsin(spr2->ang), 14), 0, CLIPMASK1, coll);
break;
case 161:
@ -1931,8 +1931,8 @@ void movetransports_r(void)
changespritesect(act2, Owner->s.sectnum);
movesprite_ex(act2, mulscale14(spr2->xvel, bcos(spr2->ang)),
mulscale14(spr2->xvel, bsin(spr2->ang)), 0, CLIPMASK1, coll);
movesprite_ex(act2, MulScale(spr2->xvel, bcos(spr2->ang), 14),
MulScale(spr2->xvel, bsin(spr2->ang), 14), 0, CLIPMASK1, coll);
break;
}
@ -2071,13 +2071,13 @@ static void rrra_specialstats()
{
s->xrepeat <<= 1;
s->yrepeat <<= 1;
s->clipdist = mulscale7(s->xrepeat, tileWidth(s->picnum));
s->clipdist = MulScale(s->xrepeat, tileWidth(s->picnum), 7);
}
else if (enemysizecheat == 2)
{
s->xrepeat >>= 1;
s->yrepeat >>= 1;
s->clipdist = mulscale7(s->xrepeat, tileHeight(s->picnum));
s->clipdist = MulScale(s->xrepeat, tileHeight(s->picnum), 7);
}
break;
}
@ -2142,8 +2142,8 @@ static void rrra_specialstats()
S_PlaySound(183);
s->extra--;
int j = movesprite_ex(act,
mulscale14(s->hitag, bcos(s->ang)),
mulscale14(s->hitag, bsin(s->ang)),
MulScale(s->hitag, bcos(s->ang), 14),
MulScale(s->hitag, bsin(s->ang), 14),
s->hitag << 1, CLIPMASK0, coll);
if (j > 0)
{
@ -2582,8 +2582,8 @@ static void heavyhbomb(DDukeActor *actor)
Collision coll;
movesprite_ex(actor,
mulscale14(s->xvel, bcos(s->ang)),
mulscale14(s->xvel, bsin(s->ang)),
MulScale(s->xvel, bcos(s->ang), 14),
MulScale(s->xvel, bsin(s->ang), 14),
s->zvel, CLIPMASK0, coll);
if (sector[s->sectnum].lotag == 1 && s->zvel == 0)
@ -2776,8 +2776,8 @@ static int henstand(DDukeActor *actor)
makeitfall(actor);
Collision coll;
movesprite_ex(actor,
mulscale14(bcos(s->ang), s->xvel),
mulscale14(bsin(s->ang), s->xvel),
MulScale(bcos(s->ang), s->xvel, 14),
MulScale(bsin(s->ang), s->xvel, 14),
s->zvel, CLIPMASK0, coll);
if (coll.type)
{
@ -2894,8 +2894,8 @@ void moveactors_r(void)
if (sector[sect].lotag == 903)
makeitfall(act);
movesprite_ex(act,
mulscale14(s->xvel, bcos(s->ang)),
mulscale14(s->xvel, bsin(s->ang)),
MulScale(s->xvel, bcos(s->ang), 14),
MulScale(s->xvel, bsin(s->ang), 14),
s->zvel,CLIPMASK0, coll);
switch (sector[sect].lotag)
{
@ -2935,8 +2935,8 @@ void moveactors_r(void)
}
makeitfall(act);
movesprite_ex(act,
mulscale14(s->xvel, bcos(s->ang)),
mulscale14(s->xvel, bsin(s->ang)),
MulScale(s->xvel, bcos(s->ang), 14),
MulScale(s->xvel, bsin(s->ang), 14),
s->zvel,CLIPMASK0, coll);
if (coll.type > kHitSector)
{
@ -2966,8 +2966,8 @@ void moveactors_r(void)
}
makeitfall(act);
movesprite_ex(act,
mulscale14(s->xvel, bcos(s->ang)),
mulscale14(s->xvel, bsin(s->ang)),
MulScale(s->xvel, bcos(s->ang), 14),
MulScale(s->xvel, bsin(s->ang), 14),
s->zvel,CLIPMASK0, coll);
if (s->z >= sector[sect].floorz - (8<<8))
{
@ -3065,8 +3065,8 @@ void moveactors_r(void)
if (s->xvel)
{
movesprite_ex(act,
mulscale14(s->xvel, bcos(s->ang)),
mulscale14(s->xvel, bsin(s->ang)),
MulScale(s->xvel, bcos(s->ang), 14),
MulScale(s->xvel, bsin(s->ang), 14),
s->zvel,CLIPMASK0, coll);
s->xvel--;
}
@ -3611,7 +3611,7 @@ void moveeffectors_r(void) //STATNUM 3
case SE_29_WAVES:
act->s.hitag += 64;
l = mulscale12(act->s.yvel, bsin(act->s.hitag));
l = MulScale(act->s.yvel, bsin(act->s.hitag), 12);
sc->floorz = act->s.z + l;
break;
@ -3964,8 +3964,8 @@ void move_r(DDukeActor *actor, int pnum, int xvel)
Collision coll;
actor->movflag = movesprite_ex(actor,
mulscale14(daxvel, bcos(angdif)),
mulscale14(daxvel, bsin(angdif)), spr->zvel, CLIPMASK0, coll);
MulScale(daxvel, bcos(angdif), 14),
MulScale(daxvel, bsin(angdif), 14), spr->zvel, CLIPMASK0, coll);
}
if (a)

View file

@ -175,16 +175,16 @@ void animatesprites_d(int x, int y, int a, int smoothratio)
if (t->statnum == 99) continue;
if (s->statnum != STAT_ACTOR && s->picnum == APLAYER && ps[s->yvel].newOwner == nullptr && h->GetOwner())
{
t->x -= mulscale16(MaxSmoothRatio - smoothratio, ps[s->yvel].posx - ps[s->yvel].oposx);
t->y -= mulscale16(MaxSmoothRatio - smoothratio, ps[s->yvel].posy - ps[s->yvel].oposy);
t->z = ps[s->yvel].oposz + mulscale16(smoothratio, ps[s->yvel].posz - ps[s->yvel].oposz);
t->x -= MulScale(MaxSmoothRatio - smoothratio, ps[s->yvel].posx - ps[s->yvel].oposx, 16);
t->y -= MulScale(MaxSmoothRatio - smoothratio, ps[s->yvel].posy - ps[s->yvel].oposy, 16);
t->z = ps[s->yvel].oposz + MulScale(smoothratio, ps[s->yvel].posz - ps[s->yvel].oposz, 16);
t->z += (40 << 8);
}
else if (s->picnum != CRANEPOLE)
{
t->x -= mulscale16(MaxSmoothRatio - smoothratio, s->x - h->bposx);
t->y -= mulscale16(MaxSmoothRatio - smoothratio, s->y - h->bposy);
t->z -= mulscale16(MaxSmoothRatio - smoothratio, s->z - h->bposz);
t->x -= MulScale(MaxSmoothRatio - smoothratio, s->x - h->bposx, 16);
t->y -= MulScale(MaxSmoothRatio - smoothratio, s->y - h->bposy, 16);
t->z -= MulScale(MaxSmoothRatio - smoothratio, s->z - h->bposz, 16);
}
sect = s->sectnum;
@ -330,10 +330,10 @@ void animatesprites_d(int x, int y, int a, int smoothratio)
t->cstat |= 2;
if (screenpeek == myconnectindex && numplayers >= 2)
{
t->x = omyx + mulscale16((int)(myx - omyx), smoothratio);
t->y = omyy + mulscale16((int)(myy - omyy), smoothratio);
t->z = omyz + mulscale16((int)(myz - omyz), smoothratio) + (40 << 8);
t->ang = myang.asbuild() + mulscale16((((myang.asbuild() + 1024 - myang.asbuild()) & 2047) - 1024), smoothratio);
t->x = omyx + MulScale((int)(myx - omyx), smoothratio, 16);
t->y = omyy + MulScale((int)(myy - omyy), smoothratio, 16);
t->z = omyz + MulScale((int)(myz - omyz), smoothratio, 16) + (40 << 8);
t->ang = myang.asbuild() + MulScale((((myang.asbuild() + 1024 - myang.asbuild()) & 2047) - 1024), smoothratio, 16);
t->sectnum = mycursectnum;
}
}

View file

@ -161,18 +161,18 @@ void animatesprites_r(int x, int y, int a, int smoothratio)
if (t->statnum == 99) continue;
if (s->statnum != STAT_ACTOR && s->picnum == APLAYER && ps[s->yvel].newOwner == nullptr && h->GetOwner())
{
t->x -= mulscale16(MaxSmoothRatio - smoothratio, ps[s->yvel].posx - ps[s->yvel].oposx);
t->y -= mulscale16(MaxSmoothRatio - smoothratio, ps[s->yvel].posy - ps[s->yvel].oposy);
t->z = ps[s->yvel].oposz + mulscale16(smoothratio, ps[s->yvel].posz - ps[s->yvel].oposz);
t->x -= MulScale(MaxSmoothRatio - smoothratio, ps[s->yvel].posx - ps[s->yvel].oposx, 16);
t->y -= MulScale(MaxSmoothRatio - smoothratio, ps[s->yvel].posy - ps[s->yvel].oposy, 16);
t->z = ps[s->yvel].oposz + MulScale(smoothratio, ps[s->yvel].posz - ps[s->yvel].oposz, 16);
t->z += (40 << 8);
s->xrepeat = 24;
s->yrepeat = 17;
}
else if (s->picnum != CRANEPOLE)
{
t->x -= mulscale16(MaxSmoothRatio - smoothratio, s->x - h->bposx);
t->y -= mulscale16(MaxSmoothRatio - smoothratio, s->y - h->bposy);
t->z -= mulscale16(MaxSmoothRatio - smoothratio, s->z - h->bposz);
t->x -= MulScale(MaxSmoothRatio - smoothratio, s->x - h->bposx, 16);
t->y -= MulScale(MaxSmoothRatio - smoothratio, s->y - h->bposy, 16);
t->z -= MulScale(MaxSmoothRatio - smoothratio, s->z - h->bposz, 16);
}
sect = s->sectnum;
@ -376,10 +376,10 @@ void animatesprites_r(int x, int y, int a, int smoothratio)
t->cstat |= 2;
if (screenpeek == myconnectindex && numplayers >= 2)
{
t->x = omyx + mulscale16((int)(myx - omyx), smoothratio);
t->y = omyy + mulscale16((int)(myy - omyy), smoothratio);
t->z = omyz + mulscale16((int)(myz - omyz), smoothratio) + (40 << 8);
t->ang = omyang.asbuild() + mulscale16((((myang.asbuild() + 1024 - omyang.asbuild()) & 2047) - 1024), smoothratio);
t->x = omyx + MulScale((int)(myx - omyx), smoothratio, 16);
t->y = omyy + MulScale((int)(myy - omyy), smoothratio, 16);
t->z = omyz + MulScale((int)(myz - omyz), smoothratio, 16) + (40 << 8);
t->ang = omyang.asbuild() + MulScale((((myang.asbuild() + 1024 - omyang.asbuild()) & 2047) - 1024), smoothratio, 16);
t->sectnum = mycursectnum;
}
}

View file

@ -266,15 +266,15 @@ void drawoverlays(double smoothratio)
{
if (screenpeek == myconnectindex && numplayers > 1)
{
cposx = omyx + mulscale16(myx - omyx, smoothratio);
cposy = omyy + mulscale16(myy - omyy, smoothratio);
cang = !SyncInput() ? myang.asbuild() : omyang.asbuild() + mulscale16(((myang.asbuild() + 1024 - omyang.asbuild()) & 2047) - 1024, smoothratio);
cposx = omyx + MulScale(myx - omyx, smoothratio, 16);
cposy = omyy + MulScale(myy - omyy, smoothratio, 16);
cang = !SyncInput() ? myang.asbuild() : omyang.asbuild() + MulScale(((myang.asbuild() + 1024 - omyang.asbuild()) & 2047) - 1024, smoothratio, 16);
}
else
{
cposx = pp->oposx + mulscale16(pp->posx - pp->oposx, smoothratio);
cposy = pp->oposy + mulscale16(pp->posy - pp->oposy, smoothratio);
cang = !SyncInput() ? pp->angle.ang.asbuild() : pp->angle.oang.asbuild() + mulscale16(((pp->angle.ang.asbuild() + 1024 - pp->angle.oang.asbuild()) & 2047) - 1024, smoothratio);
cposx = pp->oposx + MulScale(pp->posx - pp->oposx, smoothratio, 16);
cposy = pp->oposy + MulScale(pp->posy - pp->oposy, smoothratio, 16);
cang = !SyncInput() ? pp->angle.ang.asbuild() : pp->angle.oang.asbuild() + MulScale(((pp->angle.ang.asbuild() + 1024 - pp->angle.oang.asbuild()) & 2047) - 1024, smoothratio, 16);
}
}
else
@ -406,8 +406,8 @@ bool GameInterface::DrawAutomapPlayer(int cposx, int cposy, int czoom, int cang,
xvect = -bsin(cang) * czoom;
yvect = -bcos(cang) * czoom;
xvect2 = mulscale16(xvect, yxaspect);
yvect2 = mulscale16(yvect, yxaspect);
xvect2 = MulScale(xvect, yxaspect, 16);
yvect2 = MulScale(yvect, yxaspect, 16);
//Draw sprites
auto pactor = ps[screenpeek].GetActor();
@ -442,8 +442,8 @@ bool GameInterface::DrawAutomapPlayer(int cposx, int cposy, int czoom, int cang,
x2 = DMulScale(ox, xvect, -oy, yvect, 16);
y2 = DMulScale(oy, xvect, ox, yvect, 16);
x3 = mulscale16(x2, yxaspect);
y3 = mulscale16(y2, yxaspect);
x3 = MulScale(x2, yxaspect, 16);
y3 = MulScale(y2, yxaspect, 16);
drawlinergb(x1 - x2 + (xdim << 11), y1 - y3 + (ydim << 11),
x1 + x2 + (xdim << 11), y1 + y3 + (ydim << 11), col);
@ -467,10 +467,10 @@ bool GameInterface::DrawAutomapPlayer(int cposx, int cposy, int czoom, int cang,
day = -bcos(k) * l;
l = tileWidth(tilenum);
k = (l >> 1) + xoff;
x1 -= mulscale16(dax, k);
x2 = x1 + mulscale16(dax, l);
y1 -= mulscale16(day, k);
y2 = y1 + mulscale16(day, l);
x1 -= MulScale(dax, k, 16);
x2 = x1 + MulScale(dax, l, 16);
y1 -= MulScale(day, k, 16);
y2 = y1 + MulScale(day, l, 16);
ox = x1 - cposx;
oy = y1 - cposy;
@ -508,13 +508,13 @@ bool GameInterface::DrawAutomapPlayer(int cposx, int cposy, int czoom, int cang,
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);
x2 = x1 - MulScale(sinang, l, 16);
y2 = y1 + MulScale(cosang, l, 16);
l = yspan * yrepeat;
k = -mulscale16(cosang, l);
k = -MulScale(cosang, l, 16);
x3 = x2 + k;
x4 = x1 + k;
k = -mulscale16(sinang, l);
k = -MulScale(sinang, l, 16);
y3 = y2 + k;
y4 = y1 + k;

View file

@ -853,8 +853,8 @@ void GameInterface::GetInput(InputPacket* packet, ControlInfo* const hidInput)
if (packet)
{
*packet = loc;
packet->fvel = mulscale9(loc.fvel, p->angle.ang.bcos()) + mulscale9(loc.svel, p->angle.ang.bsin()) + p->fric.x;
packet->svel = mulscale9(loc.fvel, p->angle.ang.bsin()) - mulscale9(loc.svel, p->angle.ang.bcos()) + p->fric.y;
packet->fvel = MulScale(loc.fvel, p->angle.ang.bcos(), 9) + MulScale(loc.svel, p->angle.ang.bsin(), 9) + p->fric.x;
packet->svel = MulScale(loc.fvel, p->angle.ang.bsin(), 9) - MulScale(loc.svel, p->angle.ang.bcos(), 9) + p->fric.y;
loc = {};
}
}

View file

@ -1106,8 +1106,8 @@ bool view(struct player_struct* pp, int* vx, int* vy, int* vz, short* vsectnum,
wall[wall[hitwall].point2].y - wall[hitwall].y);
i = nx * bsin(daang) + ny * -bcos(daang);
if (abs(nx) > abs(ny)) hx -= mulscale28(nx, i);
else hy -= mulscale28(ny, i);
if (abs(nx) > abs(ny)) hx -= MulScale(nx, i, 28);
else hy -= MulScale(ny, i, 28);
}
else if (!hitsprt)
{
@ -1118,9 +1118,9 @@ bool view(struct player_struct* pp, int* vx, int* vy, int* vz, short* vsectnum,
else i = divscale16(hy, ny);
if (i < cameradist) cameradist = i;
}
*vx = (*vx) + mulscale16(nx, cameradist);
*vy = (*vy) + mulscale16(ny, cameradist);
*vz = (*vz) + mulscale16(nz, cameradist);
*vx = (*vx) + MulScale(nx, cameradist, 16);
*vy = (*vy) + MulScale(ny, cameradist, 16);
*vz = (*vz) + MulScale(nz, cameradist, 16);
int myclock = ud.levelclock + int(TICSPERFRAME/65536. * smoothratio);
if (cameraclock == INT_MIN) cameraclock = myclock; // third person view was just started.

View file

@ -112,7 +112,7 @@ static void shootfireball(DDukeActor *actor, int p, int sx, int sy, int sz, int
}
else
{
zvel = -mulscale16(ps[p].horizon.sum().asq16(), 98);
zvel = -MulScale(ps[p].horizon.sum().asq16(), 98, 16);
sx += bcos(sa + 348) / 448;
sy += bsin(sa + 348) / 448;
sz += (3 << 8);
@ -181,7 +181,7 @@ static void shootflamethrowerflame(DDukeActor* actor, int p, int sx, int sy, int
}
else
{
zvel = -mulscale16(ps[p].horizon.sum().asq16(), 81);
zvel = -MulScale(ps[p].horizon.sum().asq16(), 81, 16);
if (ps[p].GetActor()->s.xvel != 0)
vel = (int)((((512 - (1024
- abs(abs(getangle(sx - ps[p].oposx, sy - ps[p].oposy) - sa) - 1024)))
@ -595,7 +595,7 @@ static void shootstuff(DDukeActor* actor, int p, int sx, int sy, int sz, int sa,
sa = getangle(aimed->s.x - sx, aimed->s.y - sy);
}
else
zvel = -mulscale16(ps[p].horizon.sum().asq16(), 98);
zvel = -MulScale(ps[p].horizon.sum().asq16(), 98, 16);
}
else
{
@ -693,7 +693,7 @@ static void shootrpg(DDukeActor *actor, int p, int sx, int sy, int sz, int sa, i
if (aimed->s.picnum != RECON)
sa = getangle(aimed->s.x - sx, aimed->s.y - sy);
}
else zvel = -mulscale16(ps[p].horizon.sum().asq16(), 81);
else zvel = -MulScale(ps[p].horizon.sum().asq16(), 81, 16);
if (atwith == RPG)
S_PlayActorSound(RPG_SHOOT, actor);
@ -1149,7 +1149,7 @@ void shoot_d(DDukeActor* actor, int atwith)
zvel = ((aimed->s.z - sz - dal - (4 << 8)) * 768) / (ldist(ps[p].GetActor(), aimed));
sa = getangle(aimed->s.x - sx, aimed->s.y - sy);
}
else zvel = -mulscale16(ps[p].horizon.sum().asq16(), 98);
else zvel = -MulScale(ps[p].horizon.sum().asq16(), 98, 16);
}
else if (s->statnum != 3)
{
@ -2194,12 +2194,12 @@ static void operateweapon(int snum, ESyncBits actions, int psect)
if (p->on_ground && (actions & SB_CROUCH))
{
k = 15;
i = mulscale16(p->horizon.sum().asq16(), 20);
i = MulScale(p->horizon.sum().asq16(), 20, 16);
}
else
{
k = 140;
i = -512 - mulscale16(p->horizon.sum().asq16(), 20);
i = -512 - MulScale(p->horizon.sum().asq16(), 20, 16);
}
auto spawned = EGS(p->cursectnum,
@ -3022,9 +3022,9 @@ void processinput_d(int snum)
if (shrunk)
{
p->posxv =
mulscale16(p->posxv, gs.playerfriction - (gs.playerfriction >> 1) + (gs.playerfriction >> 2));
MulScale(p->posxv, gs.playerfriction - (gs.playerfriction >> 1) + (gs.playerfriction >> 2), 16);
p->posyv =
mulscale16(p->posyv, gs.playerfriction - (gs.playerfriction >> 1) + (gs.playerfriction >> 2));
MulScale(p->posyv, gs.playerfriction - (gs.playerfriction >> 1) + (gs.playerfriction >> 2), 16);
}
}

View file

@ -521,7 +521,7 @@ static void shootstuff(DDukeActor* actor, int p, int sx, int sy, int sz, int sa,
}
else
{
zvel = -mulscale16(ps[p].horizon.sum().asq16(), 98);
zvel = -MulScale(ps[p].horizon.sum().asq16(), 98, 16);
}
}
else
@ -635,7 +635,7 @@ static void shootrpg(DDukeActor* actor, int p, int sx, int sy, int sz, int sa, i
if (aimed->s.picnum != RECON)
sa = getangle(aimed->s.x - sx, aimed->s.y - sy);
}
else zvel = -mulscale16(ps[p].horizon.sum().asq16(), 81);
else zvel = -MulScale(ps[p].horizon.sum().asq16(), 81, 16);
if (atwith == RPG)
S_PlayActorSound(RPG_SHOOT, actor);
else if (isRRRA())
@ -789,7 +789,7 @@ static void shootwhip(DDukeActor* actor, int p, int sx, int sy, int sz, int sa,
sa = getangle(aimed->s.x - sx, aimed->s.y - sy);
}
else
zvel = -mulscale16(ps[p].horizon.sum().asq16(), 98);
zvel = -MulScale(ps[p].horizon.sum().asq16(), 98, 16);
}
else
{
@ -1817,7 +1817,7 @@ static void onMotorcycle(int snum, ESyncBits &actions)
{
rng = krand() & 1;
velAdjustment = rng == 0 ? -10 : 10;
currSpeed = mulscale7(currSpeed, p->moto_on_oil ? 10 : 5);
currSpeed = MulScale(currSpeed, p->moto_on_oil ? 10 : 5, 7);
p->posxv += currSpeed * bcos(velAdjustment * -51 + p->angle.ang.asbuild(), 4);
p->posyv += currSpeed * bsin(velAdjustment * -51 + p->angle.ang.asbuild(), 4);
}
@ -2749,12 +2749,12 @@ static void operateweapon(int snum, ESyncBits actions, int psect)
if (p->on_ground && (actions & SB_CROUCH) && !p->OnMotorcycle)
{
k = 15;
i = -mulscale16(p->horizon.sum().asq16(), 20);
i = -MulScale(p->horizon.sum().asq16(), 20, 16);
}
else
{
k = 140;
i = -512 - -mulscale16(p->horizon.sum().asq16(), 20);
i = -512 - -MulScale(p->horizon.sum().asq16(), 20, 16);
}
auto spawned = EGS(p->cursectnum,
@ -3159,12 +3159,12 @@ static void operateweapon(int snum, ESyncBits actions, int psect)
if (p->on_ground && (actions & SB_CROUCH) && !p->OnMotorcycle)
{
k = 15;
i = mulscale16(p->horizon.sum().asq16(), 20);
i = MulScale(p->horizon.sum().asq16(), 20, 16);
}
else
{
k = 32;
i = -512 - mulscale16(p->horizon.sum().asq16(), 20);
i = -512 - MulScale(p->horizon.sum().asq16(), 20, 16);
}
EGS(p->cursectnum,
@ -3783,9 +3783,9 @@ void processinput_r(int snum)
if (shrunk)
{
p->posxv =
mulscale16(p->posxv, gs.playerfriction - (gs.playerfriction >> 1) + (gs.playerfriction >> 2));
MulScale(p->posxv, gs.playerfriction - (gs.playerfriction >> 1) + (gs.playerfriction >> 2), 16);
p->posyv =
mulscale16(p->posyv, gs.playerfriction - (gs.playerfriction >> 1) + (gs.playerfriction >> 2));
MulScale(p->posyv, gs.playerfriction - (gs.playerfriction >> 1) + (gs.playerfriction >> 2), 16);
}
}

View file

@ -333,12 +333,12 @@ void operateweapon_ww(int snum, ESyncBits actions, int psect)
if (p->on_ground && (actions & SB_CROUCH))
{
k = 15;
i = mulscale16(p->horizon.sum().asq16(), 20);
i = MulScale(p->horizon.sum().asq16(), 20, 16);
}
else
{
k = 140;
i = -512 - mulscale16(p->horizon.sum().asq16(), 20);
i = -512 - MulScale(p->horizon.sum().asq16(), 20, 16);
}
auto j = EGS(p->cursectnum,

View file

@ -156,9 +156,9 @@ void fakedomovethings(void)
{
k = getflorzofslope(psect,x,y);
if (psect == tempsect)
myhorizoff += mulscale16(j-k,160);
myhorizoff += MulScale(j-k,160, 16);
else if (klabs(getflorzofslope(tempsect,x,y)-k) <= (4<<8))
myhorizoff += mulscale16(j-k,160);
myhorizoff += MulScale(j-k,160, 16);
}
}
if (myhorizoff > 0) myhorizoff -= ((myhorizoff>>3)+1);
@ -421,20 +421,20 @@ void fakedomovethings(void)
if( ( p->curr_weapon == KNEE_WEAPON && p->kickback_pic > 10 && myonground ) || ( myonground && (sb_snum&2) && !(p->OnMotorcycle || p->OnBoat)) )
{
myxvel = mulscale16(myxvel,gs.playerfriction-0x2000);
myyvel = mulscale16(myyvel,gs.playerfriction-0x2000);
myxvel = MulScale(myxvel,gs.playerfriction-0x2000, 16);
myyvel = MulScale(myyvel,gs.playerfriction-0x2000, 16);
}
else
{
if(psectlotag == 2)
{
myxvel = mulscale16(myxvel,gs.playerfriction-0x1400);
myyvel = mulscale16(myyvel,gs.playerfriction-0x1400);
myxvel = MulScale(myxvel,gs.playerfriction-0x1400, 16);
myyvel = MulScale(myyvel,gs.playerfriction-0x1400, 16);
}
else
{
myxvel = mulscale16(myxvel,gs.playerfriction);
myyvel = mulscale16(myyvel,gs.playerfriction);
myxvel = MulScale(myxvel,gs.playerfriction, 16);
myyvel = MulScale(myyvel,gs.playerfriction, 16);
}
}
@ -444,9 +444,9 @@ void fakedomovethings(void)
if( shrunk )
{
myxvel =
mulscale16(myxvel,(gs.playerfriction)-(gs.playerfriction>>1)+(gs.playerfriction>>2));
MulScale(myxvel,(gs.playerfriction)-(gs.playerfriction>>1)+(gs.playerfriction>>2), 16);
myyvel =
mulscale16(myyvel,(gs.playerfriction)-(gs.playerfriction>>1)+(gs.playerfriction>>2));
MulScale(myyvel,(gs.playerfriction)-(gs.playerfriction>>1)+(gs.playerfriction>>2), 16);
}
}

View file

@ -531,7 +531,7 @@ void displayrooms(int snum, double smoothratio)
// 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 viewingaspect = !isRRRA() || !p->DrugMode ? xs_CRoundToInt(double(i) * tan(r_fov * (pi::pi() / 360.))) : getdrugmode(p, i);
renderSetAspect(mulscale16(viewingaspect, viewingrange), yxaspect);
renderSetAspect(MulScale(viewingaspect, viewingrange, 16), yxaspect);
// The camera texture must be rendered with the base palette, so this is the only place where the current global palette can be set.
// The setting here will be carried over to the rendering of the weapon sprites, but other 2D content will always default to the main palette.

View file

@ -824,7 +824,7 @@ int spawn_r(int j, int pn)
sp->xrepeat = 22;
sp->yrepeat = 20;
}
sp->clipdist = mulscale7(sp->xrepeat,tileWidth(sp->picnum));
sp->clipdist = MulScale(sp->xrepeat,tileWidth(sp->picnum), 7);
break;
case HULKHANG:
case HULKHANGDEAD:
@ -833,14 +833,14 @@ int spawn_r(int j, int pn)
case HULKSTAYPUT:
sp->xrepeat = 32;
sp->yrepeat = 32;
sp->clipdist = mulscale7(sp->xrepeat,tileWidth(sp->picnum));
sp->clipdist = MulScale(sp->xrepeat,tileWidth(sp->picnum), 7);
break;
case COOTPLAY:
case COOT:
case COOTSTAYPUT:
sp->xrepeat = 24;
sp->yrepeat = 18;
sp->clipdist = mulscale7(sp->xrepeat,tileWidth(sp->picnum));
sp->clipdist = MulScale(sp->xrepeat,tileWidth(sp->picnum), 7);
sp->clipdist <<= 2;
break;
case DRONE:
@ -857,12 +857,12 @@ int spawn_r(int j, int pn)
case BUBBASTAND:
sp->xrepeat = 25;
sp->yrepeat = 21;
sp->clipdist = mulscale7(sp->xrepeat,tileWidth(sp->picnum));
sp->clipdist = MulScale(sp->xrepeat,tileWidth(sp->picnum), 7);
break;
case COW:
sp->xrepeat = 32;
sp->yrepeat = 32;
sp->clipdist = mulscale7(sp->xrepeat,tileWidth(sp->picnum));
sp->clipdist = MulScale(sp->xrepeat,tileWidth(sp->picnum), 7);
break;
case HEN:
case HENSTAYPUT:
@ -871,7 +871,7 @@ int spawn_r(int j, int pn)
{
sp->xrepeat = 42;
sp->yrepeat = 30;
sp->clipdist = mulscale7(sp->xrepeat,tileWidth(sp->picnum));
sp->clipdist = MulScale(sp->xrepeat,tileWidth(sp->picnum), 7);
}
else
{
@ -884,7 +884,7 @@ int spawn_r(int j, int pn)
case MINIONSTAYPUT:
sp->xrepeat = 16;
sp->yrepeat = 16;
sp->clipdist = mulscale7(sp->xrepeat,tileWidth(sp->picnum));
sp->clipdist = MulScale(sp->xrepeat,tileWidth(sp->picnum), 7);
if (isRRRA() && ufospawnsminion)
sp->pal = 8;
break;
@ -892,12 +892,12 @@ int spawn_r(int j, int pn)
case PIG:
sp->xrepeat = 16;
sp->yrepeat = 16;
sp->clipdist = mulscale7(sp->xrepeat,tileWidth(sp->picnum));
sp->clipdist = MulScale(sp->xrepeat,tileWidth(sp->picnum), 7);
break;
case RABBIT:
sp->xrepeat = 18;
sp->yrepeat = 18;
sp->clipdist = mulscale7(sp->xrepeat,tileWidth(sp->picnum));
sp->clipdist = MulScale(sp->xrepeat,tileWidth(sp->picnum), 7);
break;
case MAMACLOUD:
sp->xrepeat = 64;
@ -947,7 +947,7 @@ int spawn_r(int j, int pn)
case BIKER:
sp->xrepeat = 28;
sp->yrepeat = 22;
sp->clipdist = mulscale7(sp->xrepeat,tileWidth(sp->picnum));
sp->clipdist = MulScale(sp->xrepeat,tileWidth(sp->picnum), 7);
break;
case CHEERB:
sp->xrepeat = 28;
@ -958,46 +958,46 @@ int spawn_r(int j, int pn)
case CHEERSTAYPUT:
sp->xrepeat = 20;
sp->yrepeat = 20;
sp->clipdist = mulscale7(sp->xrepeat,tileWidth(sp->picnum));
sp->clipdist = MulScale(sp->xrepeat,tileWidth(sp->picnum), 7);
break;
case MAKEOUT:
sp->xrepeat = 26;
sp->yrepeat = 26;
sp->clipdist = mulscale7(sp->xrepeat,tileWidth(sp->picnum));
sp->clipdist = MulScale(sp->xrepeat,tileWidth(sp->picnum), 7);
break;
case MINIONBOAT:
sp->xrepeat = 16;
sp->yrepeat = 16;
sp->clipdist = mulscale7(sp->xrepeat,tileWidth(sp->picnum));
sp->clipdist = MulScale(sp->xrepeat,tileWidth(sp->picnum), 7);
break;
case HULKBOAT:
sp->xrepeat = 48;
sp->yrepeat = 48;
sp->clipdist = mulscale7(sp->xrepeat,tileWidth(sp->picnum));
sp->clipdist = MulScale(sp->xrepeat,tileWidth(sp->picnum), 7);
break;
case CHEERBOAT:
sp->xrepeat = 32;
sp->yrepeat = 32;
sp->clipdist = mulscale7(sp->xrepeat,tileWidth(sp->picnum));
sp->clipdist = MulScale(sp->xrepeat,tileWidth(sp->picnum), 7);
break;
case TORNADO:
sp->xrepeat = 64;
sp->yrepeat = 128;
sp->clipdist = mulscale7(sp->xrepeat,tileWidth(sp->picnum));
sp->clipdist = MulScale(sp->xrepeat,tileWidth(sp->picnum), 7);
sp->clipdist >>= 2;
sp->cstat = 2;
break;
case LTH:
sp->xrepeat = 24;
sp->yrepeat = 22;
sp->clipdist = mulscale7(sp->xrepeat,tileWidth(sp->picnum));
sp->clipdist = MulScale(sp->xrepeat,tileWidth(sp->picnum), 7);
break;
case ROCK:
case ROCK2:
sp->xrepeat = 64;
sp->yrepeat = 64;
sp->clipdist = mulscale7(sp->xrepeat,tileWidth(sp->picnum));
sp->clipdist = MulScale(sp->xrepeat,tileWidth(sp->picnum), 7);
break;
case UFO1_RRRA:
@ -1008,13 +1008,13 @@ int spawn_r(int j, int pn)
case UFO5:
sp->xrepeat = 32;
sp->yrepeat = 32;
sp->clipdist = mulscale7(sp->xrepeat,tileWidth(sp->picnum));
sp->clipdist = MulScale(sp->xrepeat,tileWidth(sp->picnum), 7);
sp->extra = 50;
break;
case SBMOVE:
sp->xrepeat = 48;
sp->yrepeat = 48;
sp->clipdist = mulscale7(sp->xrepeat,tileWidth(sp->picnum));
sp->clipdist = MulScale(sp->xrepeat,tileWidth(sp->picnum), 7);
break;
default:
@ -1409,7 +1409,7 @@ int spawn_r(int j, int pn)
sp->pal = 0;
sp->xrepeat = 18;
sp->yrepeat = 18;
sp->clipdist = mulscale7(sp->xrepeat,tileWidth(sp->picnum));
sp->clipdist = MulScale(sp->xrepeat,tileWidth(sp->picnum), 7);
act->saved_ammo = 100;
sp->cstat = 257;
sp->lotag = 1;
@ -1425,7 +1425,7 @@ int spawn_r(int j, int pn)
sp->pal = 0;
sp->xrepeat = 32;
sp->yrepeat = 32;
sp->clipdist = mulscale7(sp->xrepeat,tileWidth(sp->picnum));
sp->clipdist = MulScale(sp->xrepeat,tileWidth(sp->picnum), 7);
act->saved_ammo = 20;
sp->cstat = 257;
sp->lotag = 1;

View file

@ -304,8 +304,8 @@ DoDebrisCurrent(SPRITEp sp)
//sp->clipdist = (256+128)>>2;
nx = mulscale14(DIV4(sectu->speed), bcos(sectu->ang));
ny = mulscale14(DIV4(sectu->speed), bsin(sectu->ang));
nx = MulScale(DIV4(sectu->speed), bcos(sectu->ang), 14);
ny = MulScale(DIV4(sectu->speed), bsin(sectu->ang), 14);
// faster than move_sprite
//move_missile(sp-sprite, nx, ny, 0, Z(2), Z(0), 0, ACTORMOVETICS);
@ -316,8 +316,8 @@ DoDebrisCurrent(SPRITEp sp)
{
short rang = RANDOM_P2(2048);
nx = mulscale14(DIV4(sectu->speed), bcos(sectu->ang + rang));
nx = mulscale14(DIV4(sectu->speed), bsin(sectu->ang + rang));
nx = MulScale(DIV4(sectu->speed), bcos(sectu->ang + rang), 14);
nx = MulScale(DIV4(sectu->speed), bsin(sectu->ang + rang), 14);
move_sprite(sp-sprite, nx, ny, 0, u->ceiling_dist, u->floor_dist, 0, ACTORMOVETICS);
}
@ -444,8 +444,8 @@ DoActorDebris(short SpriteNum)
{
//nx = sp->xvel * ACTORMOVETICS * bcos(sp->ang) >> 14;
//ny = sp->xvel * ACTORMOVETICS * bsin(sp->ang) >> 14;
nx = mulscale14(ACTORMOVETICS, bcos(sp->ang));
ny = mulscale14(ACTORMOVETICS, bsin(sp->ang));
nx = MulScale(ACTORMOVETICS, bcos(sp->ang), 14);
ny = MulScale(ACTORMOVETICS, bsin(sp->ang), 14);
//sp->clipdist = (256+128)>>2;
@ -459,7 +459,7 @@ DoActorDebris(short SpriteNum)
{
u->WaitTics = (u->WaitTics + (ACTORMOVETICS << 3)) & 1023;
//sp->z = Z(2) + u->loz + ((Z(4) * (int) bsin(u->WaitTics)) >> 14);
sp->z = u->loz - mulscale14(Z(2), bsin(u->WaitTics));
sp->z = u->loz - MulScale(Z(2), bsin(u->WaitTics), 14);
}
}
else
@ -489,7 +489,7 @@ DoFireFly(short SpriteNum)
u->WaitTics = (u->WaitTics + (ACTORMOVETICS << 1)) & 2047;
sp->z = u->sz + mulscale14(Z(32), bsin(u->WaitTics));
sp->z = u->sz + MulScale(Z(32), bsin(u->WaitTics), 14);
return 0;
}
@ -635,8 +635,8 @@ DoActorSlide(short SpriteNum)
USERp u = User[SpriteNum];
int nx, ny;
nx = mulscale14(u->slide_vel, bcos(u->slide_ang));
ny = mulscale14(u->slide_vel, bsin(u->slide_ang));
nx = MulScale(u->slide_vel, bcos(u->slide_ang), 14);
ny = MulScale(u->slide_vel, bsin(u->slide_ang), 14);
if (!move_actor(SpriteNum, nx, ny, 0L))
{
@ -853,8 +853,8 @@ DoActorDeathMove(short SpriteNum)
DoActorFall(SpriteNum);
}
nx = mulscale14(sp->xvel, bcos(sp->ang));
ny = mulscale14(sp->xvel, bsin(sp->ang));
nx = MulScale(sp->xvel, bcos(sp->ang), 14);
ny = MulScale(sp->xvel, bsin(sp->ang), 14);
sp->clipdist = (128+64)>>2;
move_actor(SpriteNum, nx, ny, 0);

View file

@ -1127,8 +1127,8 @@ DoActorMoveCloser(short SpriteNum)
SPRITEp sp = User[SpriteNum]->SpriteP;
int nx, ny;
nx = mulscale14(sp->xvel, bcos(sp->ang));
ny = mulscale14(sp->xvel, bsin(sp->ang));
nx = MulScale(sp->xvel, bcos(sp->ang), 14);
ny = MulScale(sp->xvel, bsin(sp->ang), 14);
// if cannot move the sprite
if (!move_actor(SpriteNum, nx, ny, 0L))
@ -1707,8 +1707,8 @@ DoActorMoveJump(short SpriteNum)
// Move while jumping
nx = mulscale14(sp->xvel, bcos(sp->ang));
ny = mulscale14(sp->xvel, bsin(sp->ang));
nx = MulScale(sp->xvel, bcos(sp->ang), 14);
ny = MulScale(sp->xvel, bsin(sp->ang), 14);
move_actor(SpriteNum, nx, ny, 0L);
@ -1753,8 +1753,8 @@ int move_scan(short SpriteNum, short ang, int dist, int *stopx, int *stopy, int
// do the move
sp->ang = ang;
nx = mulscale14(dist, bcos(sp->ang));
ny = mulscale14(dist, bsin(sp->ang));
nx = MulScale(dist, bcos(sp->ang), 14);
ny = MulScale(dist, bsin(sp->ang), 14);
ret = move_sprite(SpriteNum, nx, ny, 0, u->ceiling_dist, u->floor_dist, cliptype, 1);
// move_sprite DOES do a getzrange point?
@ -2042,8 +2042,8 @@ DoActorReposition(short SpriteNum)
SPRITEp sp = User[SpriteNum]->SpriteP;
int nx, ny;
nx = mulscale14(sp->xvel, bcos(sp->ang));
ny = mulscale14(sp->xvel, bsin(sp->ang));
nx = MulScale(sp->xvel, bcos(sp->ang), 14);
ny = MulScale(sp->xvel, bsin(sp->ang), 14);
// still might hit something and have to handle it.
if (!move_actor(SpriteNum, nx, ny, 0L))
@ -2129,8 +2129,8 @@ DoActorReposition(short SpriteNum)
SPRITEp sp = User[SpriteNum]->SpriteP;
int nx, ny;
nx = mulscale14(sp->xvel, bcos(sp->ang));
ny = mulscale14(sp->xvel, bsin(sp->ang));
nx = MulScale(sp->xvel, bcos(sp->ang), 14);
ny = MulScale(sp->xvel, bsin(sp->ang), 14);
if (!move_actor(SpriteNum, nx, ny, 0L))
{

View file

@ -895,8 +895,8 @@ DoBunnyMoveJump(short SpriteNum)
int nx, ny;
// Move while jumping
nx = mulscale14(sp->xvel, bcos(sp->ang));
ny = mulscale14(sp->xvel, bsin(sp->ang));
nx = MulScale(sp->xvel, bcos(sp->ang), 14);
ny = MulScale(sp->xvel, bsin(sp->ang), 14);
move_actor(SpriteNum, nx, ny, 0L);

View file

@ -697,7 +697,7 @@ int DoCoolgMatchPlayerZ(short SpriteNum)
u->sz = max(u->sz, hiz + u->ceiling_dist);
u->Counter = (u->Counter + (ACTORMOVETICS<<3)) & 2047;
sp->z = u->sz + mulscale14(COOLG_BOB_AMT, bsin(u->Counter));
sp->z = u->sz + MulScale(COOLG_BOB_AMT, bsin(u->Counter), 14);
bound = u->hiz + u->ceiling_dist + COOLG_BOB_AMT;
if (sp->z < bound)
@ -751,8 +751,8 @@ int DoCoolgCircle(short SpriteNum)
sp->ang = NORM_ANGLE(sp->ang + u->Counter2);
nx = mulscale14(sp->xvel, bcos(sp->ang));
ny = mulscale14(sp->xvel, bsin(sp->ang));
nx = MulScale(sp->xvel, bcos(sp->ang), 14);
ny = MulScale(sp->xvel, bsin(sp->ang), 14);
if (!move_actor(SpriteNum, nx, ny, 0L))
{
@ -812,8 +812,8 @@ DoCoolgDeath(short SpriteNum)
DoActorSlide(SpriteNum);
// slide while falling
nx = mulscale14(sp->xvel, bcos(sp->ang));
ny = mulscale14(sp->xvel, bsin(sp->ang));
nx = MulScale(sp->xvel, bcos(sp->ang), 14);
ny = MulScale(sp->xvel, bsin(sp->ang), 14);
u->ret = move_sprite(SpriteNum, nx, ny, 0L, u->ceiling_dist, u->floor_dist, CLIPMASK_MISSILE, ACTORMOVETICS);
DoFindGroundPoint(SpriteNum);

View file

@ -618,9 +618,9 @@ analyzesprites(int viewx, int viewy, int viewz, bool mirror)
{
if (tsp->statnum <= STAT_SKIP4_INTERP_END)
{
tsp->x = tu->ox + mulscale18(tsp->x - tu->ox, smr4);
tsp->y = tu->oy + mulscale18(tsp->y - tu->oy, smr4);
tsp->z = tu->oz + mulscale18(tsp->z - tu->oz, smr4);
tsp->x = tu->ox + MulScale(tsp->x - tu->ox, smr4, 18);
tsp->y = tu->oy + MulScale(tsp->y - tu->oy, smr4, 18);
tsp->z = tu->oz + MulScale(tsp->z - tu->oz, smr4, 18);
}
}
@ -628,9 +628,9 @@ analyzesprites(int viewx, int viewy, int viewz, bool mirror)
{
if (tsp->statnum <= STAT_SKIP2_INTERP_END)
{
tsp->x = tu->ox + mulscale17(tsp->x - tu->ox, smr2);
tsp->y = tu->oy + mulscale17(tsp->y - tu->oy, smr2);
tsp->z = tu->oz + mulscale17(tsp->z - tu->oz, smr2);
tsp->x = tu->ox + MulScale(tsp->x - tu->ox, smr2, 17);
tsp->y = tu->oy + MulScale(tsp->y - tu->oy, smr2, 17);
tsp->z = tu->oz + MulScale(tsp->z - tu->oz, smr2, 17);
}
}
}
@ -786,10 +786,10 @@ analyzesprites(int viewx, int viewy, int viewz, bool mirror)
else // Otherwise just interpolate the player sprite
{
PLAYERp pp = tu->PlayerP;
tsp->x -= mulscale16(pp->posx - pp->oposx, 65536-smoothratio);
tsp->y -= mulscale16(pp->posy - pp->oposy, 65536-smoothratio);
tsp->z -= mulscale16(pp->posz - pp->oposz, 65536-smoothratio);
tsp->ang -= mulscale16(pp->angle.ang.asbuild() - pp->angle.oang.asbuild(), 65536-smoothratio);
tsp->x -= MulScale(pp->posx - pp->oposx, 65536-smoothratio, 16);
tsp->y -= MulScale(pp->posy - pp->oposy, 65536-smoothratio, 16);
tsp->z -= MulScale(pp->posz - pp->oposz, 65536-smoothratio, 16);
tsp->ang -= MulScale(pp->angle.ang.asbuild() - pp->angle.oang.asbuild(), 65536-smoothratio, 16);
}
}
@ -988,9 +988,9 @@ BackView(int *nx, int *ny, int *nz, short *vsect, binangle *nang, fixed_t q16hor
i = vx * bsin(daang) + vy * -bcos(daang);
if (klabs(vx) > klabs(vy))
hx -= mulscale28(vx, i);
hx -= MulScale(vx, i, 28);
else
hy -= mulscale28(vy, i);
hy -= MulScale(vy, i, 28);
}
else if (hitinfo.sprite < 0) // Push you off the ceiling/floor
{
@ -1023,9 +1023,9 @@ BackView(int *nx, int *ny, int *nz, short *vsect, binangle *nang, fixed_t q16hor
i = vx * bsin(daang) + vy * -bcos(daang);
if (klabs(vx) > klabs(vy))
hx -= mulscale28(vx, i);
hx -= MulScale(vx, i, 28);
else
hy -= mulscale28(vy, i);
hy -= MulScale(vy, i, 28);
}
}
@ -1040,9 +1040,9 @@ BackView(int *nx, int *ny, int *nz, short *vsect, binangle *nang, fixed_t q16hor
}
// Actually move you! (Camerdist is 65536 if nothing is in the way)
*nx = (*nx) + mulscale16(vx, pp->camera_dist);
*ny = (*ny) + mulscale16(vy, pp->camera_dist);
*nz = (*nz) + mulscale16(vz, pp->camera_dist);
*nx = (*nx) + MulScale(vx, pp->camera_dist, 16);
*ny = (*ny) + MulScale(vy, pp->camera_dist, 16);
*nz = (*nz) + MulScale(vz, pp->camera_dist, 16);
// Slowly increase pp->camera_dist until it reaches 65536
// Synctics is a timer variable so it increases the same rate
@ -1110,9 +1110,9 @@ CircleCamera(int *nx, int *ny, int *nz, short *vsect, binangle *nang, fixed_t q1
i = vx * bsin(daang) + vy * -bcos(daang);
if (klabs(vx) > klabs(vy))
hx -= mulscale28(vx, i);
hx -= MulScale(vx, i, 28);
else
hy -= mulscale28(vy, i);
hy -= MulScale(vy, i, 28);
}
else if (hitinfo.sprite < 0) // Push you off the ceiling/floor
{
@ -1888,8 +1888,8 @@ bool GameInterface::DrawAutomapPlayer(int cposx, int cposy, int czoom, int cang,
xvect = -bsin(cang) * czoom;
yvect = -bcos(cang) * czoom;
xvect2 = mulscale16(xvect, yxaspect);
yvect2 = mulscale16(yvect, yxaspect);
xvect2 = MulScale(xvect, yxaspect, 16);
yvect2 = MulScale(yvect, yxaspect, 16);
// Draw sprites
@ -1957,7 +1957,7 @@ bool GameInterface::DrawAutomapPlayer(int cposx, int cposy, int czoom, int cang,
double xd = ((x1 << 4) + (xdim << 15)) / 65536.;
double yd = ((y1 << 4) + (ydim << 15)) / 65536.;
double sc = mulscale16(czoom * (spr->yrepeat), yxaspect) / 32768.;
double sc = MulScale(czoom * (spr->yrepeat), yxaspect, 16) / 32768.;
if (spnum >= 0)
{
DrawTexture(twod, tileGetTexture(1196 + pspr_ndx[myconnectindex], true), xd, yd, DTA_ScaleX, sc, DTA_ScaleY, sc, DTA_Rotate, daang * (-360. / 2048),
@ -1980,20 +1980,20 @@ bool GameInterface::DrawAutomapPlayer(int cposx, int cposy, int czoom, int cang,
day = -bcos(k) * l;
l = tileWidth(tilenum);
k = (l >> 1) + xoff;
x1 -= mulscale16(dax, k);
x2 = x1 + mulscale16(dax, l);
y1 -= mulscale16(day, k);
y2 = y1 + mulscale16(day, l);
x1 -= MulScale(dax, k, 16);
x2 = x1 + MulScale(dax, l, 16);
y1 -= MulScale(day, k, 16);
y2 = y1 + MulScale(day, l, 16);
ox = x1 - cposx;
oy = y1 - cposy;
x1 = mulscale16(ox, xvect) - mulscale16(oy, yvect);
y1 = mulscale16(oy, xvect2) + mulscale16(ox, yvect2);
x1 = MulScale(ox, xvect, 16) - MulScale(oy, yvect, 16);
y1 = MulScale(oy, xvect2, 16) + MulScale(ox, yvect2, 16);
ox = x2 - cposx;
oy = y2 - cposy;
x2 = mulscale16(ox, xvect) - mulscale16(oy, yvect);
y2 = mulscale16(oy, xvect2) + mulscale16(ox, yvect2);
x2 = MulScale(ox, xvect, 16) - MulScale(oy, yvect, 16);
y2 = MulScale(oy, xvect2, 16) + MulScale(ox, yvect2, 16);
drawlinergb(x1 + (xdim << 11), y1 + (ydim << 11),
x2 + (xdim << 11), y2 + (ydim << 11), col);
@ -2020,38 +2020,38 @@ bool GameInterface::DrawAutomapPlayer(int cposx, int cposy, int czoom, int cang,
dax = ((xspan >> 1) + xoff) * xrepeat;
day = ((yspan >> 1) + yoff) * yrepeat;
x1 = sprx + mulscale16(sinang, dax) + mulscale16(cosang, day);
y1 = spry + mulscale16(sinang, day) - mulscale16(cosang, dax);
x1 = sprx + MulScale(sinang, dax, 16) + MulScale(cosang, day, 16);
y1 = spry + MulScale(sinang, day, 16) - MulScale(cosang, dax, 16);
l = xspan * xrepeat;
x2 = x1 - mulscale16(sinang, l);
y2 = y1 + mulscale16(cosang, l);
x2 = x1 - MulScale(sinang, l, 16);
y2 = y1 + MulScale(cosang, l, 16);
l = yspan * yrepeat;
k = -mulscale16(cosang, l);
k = -MulScale(cosang, l, 16);
x3 = x2 + k;
x4 = x1 + k;
k = -mulscale16(sinang, l);
k = -MulScale(sinang, l, 16);
y3 = y2 + k;
y4 = y1 + k;
ox = x1 - cposx;
oy = y1 - cposy;
x1 = mulscale16(ox, xvect) - mulscale16(oy, yvect);
y1 = mulscale16(oy, xvect2) + mulscale16(ox, yvect2);
x1 = MulScale(ox, xvect, 16) - MulScale(oy, yvect, 16);
y1 = MulScale(oy, xvect2, 16) + MulScale(ox, yvect2, 16);
ox = x2 - cposx;
oy = y2 - cposy;
x2 = mulscale16(ox, xvect) - mulscale16(oy, yvect);
y2 = mulscale16(oy, xvect2) + mulscale16(ox, yvect2);
x2 = MulScale(ox, xvect, 16) - MulScale(oy, yvect, 16);
y2 = MulScale(oy, xvect2, 16) + MulScale(ox, yvect2, 16);
ox = x3 - cposx;
oy = y3 - cposy;
x3 = mulscale16(ox, xvect) - mulscale16(oy, yvect);
y3 = mulscale16(oy, xvect2) + mulscale16(ox, yvect2);
x3 = MulScale(ox, xvect, 16) - MulScale(oy, yvect, 16);
y3 = MulScale(oy, xvect2, 16) + MulScale(ox, yvect2, 16);
ox = x4 - cposx;
oy = y4 - cposy;
x4 = mulscale16(ox, xvect) - mulscale16(oy, yvect);
y4 = mulscale16(oy, xvect2) + mulscale16(ox, yvect2);
x4 = MulScale(ox, xvect, 16) - MulScale(oy, yvect, 16);
y4 = MulScale(oy, xvect2, 16) + MulScale(ox, yvect2, 16);
drawlinergb(x1 + (xdim << 11), y1 + (ydim << 11),
x2 + (xdim << 11), y2 + (ydim << 11), col);

View file

@ -545,7 +545,7 @@ int DoEelMatchPlayerZ(short SpriteNum)
u->sz = max(u->sz, hiz + u->ceiling_dist);
u->Counter = (u->Counter + (ACTORMOVETICS << 3) + (ACTORMOVETICS << 1)) & 2047;
sp->z = u->sz + mulscale14(EEL_BOB_AMT, bsin(u->Counter));
sp->z = u->sz + MulScale(EEL_BOB_AMT, bsin(u->Counter), 14);
bound = u->hiz + u->ceiling_dist + EEL_BOB_AMT;
if (sp->z < bound)
@ -578,8 +578,8 @@ DoEelDeath(short SpriteNum)
DoActorSlide(SpriteNum);
// slide while falling
nx = mulscale14(sp->xvel, bcos(sp->ang));
ny = mulscale14(sp->xvel, bsin(sp->ang));
nx = MulScale(sp->xvel, bcos(sp->ang), 14);
ny = MulScale(sp->xvel, bsin(sp->ang), 14);
u->ret = move_sprite(SpriteNum, nx, ny, 0L, u->ceiling_dist, u->floor_dist, CLIPMASK_MISSILE, ACTORMOVETICS);
DoFindGroundPoint(SpriteNum);

View file

@ -267,8 +267,8 @@ int StdRandomRange(int range);
#define RANDOM_NEG(x,y) ((RANDOM_P2(((x)<<(y))<<1) - (x))<<(y))
#define MOVEx(vel,ang) (mulscale14(vel, bcos(ang)))
#define MOVEy(vel,ang) (mulscale14(vel, bsin(ang)))
#define MOVEx(vel,ang) (MulScale(vel, bcos(ang), 14))
#define MOVEy(vel,ang) (MulScale(vel, bsin(ang), 14))
#define DIST(x1, y1, x2, y2) ksqrt( SQ((x1) - (x2)) + SQ((y1) - (y2)) )
@ -289,12 +289,12 @@ inline void DISTANCE(int x1, int y1, int x2, int y2, int& dist, int& tx, int& ty
inline int SPRITEp_SIZE_X(const spritetype* sp)
{
return mulscale6(tileWidth(sp->picnum), sp->xrepeat);
return MulScale(tileWidth(sp->picnum), sp->xrepeat, 6);
}
inline int SPRITEp_SIZE_Y(const spritetype* sp)
{
return mulscale6(tileHeight(sp->picnum), sp->yrepeat);
return MulScale(tileHeight(sp->picnum), sp->yrepeat, 6);
}
inline int SPRITEp_SIZE_Z(const spritetype* sp)
@ -351,8 +351,8 @@ inline int SPRITEp_SIZE_BOS(const spritetype* sp)
// two vectors
// can determin direction
#define DOT_PRODUCT_2D(x1,y1,x2,y2) (mulscale16((x1), (x2)) + mulscale16((y1), (y2)))
#define DOT_PRODUCT_3D(x1,y1,z1,x2,y2,z2) (mulscale16((x1), (x2)) + mulscale16((y1), (y2)) + mulscale16((z1), (z2)))
#define DOT_PRODUCT_2D(x1,y1,x2,y2) (MulScale((x1), (x2), 16) + MulScale((y1), (y2), 16))
#define DOT_PRODUCT_3D(x1,y1,z1,x2,y2,z2) (MulScale((x1), (x2), 16) + MulScale((y1), (y2), 16) + MulScale((z1), (z2), 16))
// just determine if the player is moving
#define PLAYER_MOVING(pp) ((pp)->xvect|(pp)->yvect)

View file

@ -796,8 +796,8 @@ GirlNinjaJumpActionFunc(short SpriteNum)
int nx, ny;
// Move while jumping
nx = mulscale14(sp->xvel, bcos(sp->ang));
ny = mulscale14(sp->xvel, bsin(sp->ang));
nx = MulScale(sp->xvel, bcos(sp->ang), 14);
ny = MulScale(sp->xvel, bsin(sp->ang), 14);
// if cannot move the sprite
if (!move_actor(SpriteNum, nx, ny, 0L))

View file

@ -409,7 +409,7 @@ int DoHornetMatchPlayerZ(short SpriteNum)
u->sz = max(u->sz, hiz + u->ceiling_dist);
u->Counter = (u->Counter + (ACTORMOVETICS << 3) + (ACTORMOVETICS << 1)) & 2047;
sp->z = u->sz + mulscale14(HORNET_BOB_AMT, bsin(u->Counter));
sp->z = u->sz + MulScale(HORNET_BOB_AMT, bsin(u->Counter), 14);
bound = u->hiz + u->ceiling_dist + HORNET_BOB_AMT;
if (sp->z < bound)
@ -461,8 +461,8 @@ int DoHornetCircle(short SpriteNum)
sp->ang = NORM_ANGLE(sp->ang + u->Counter2);
nx = mulscale14(sp->xvel, bcos(sp->ang));
ny = mulscale14(sp->xvel, bsin(sp->ang));
nx = MulScale(sp->xvel, bcos(sp->ang), 14);
ny = MulScale(sp->xvel, bsin(sp->ang), 14);
if (!move_actor(SpriteNum, nx, ny, 0L))
{
@ -471,8 +471,8 @@ int DoHornetCircle(short SpriteNum)
// try moving in the opposite direction
u->Counter2 = -u->Counter2;
sp->ang = NORM_ANGLE(sp->ang + 1024);
nx = mulscale14(sp->xvel, bcos(sp->ang));
ny = mulscale14(sp->xvel, bsin(sp->ang));
nx = MulScale(sp->xvel, bcos(sp->ang), 14);
ny = MulScale(sp->xvel, bsin(sp->ang), 14);
if (!move_actor(SpriteNum, nx, ny, 0L))
{
@ -531,8 +531,8 @@ DoHornetDeath(short SpriteNum)
DoActorSlide(SpriteNum);
// slide while falling
nx = mulscale14(sp->xvel, bcos(sp->ang));
ny = mulscale14(sp->xvel, bsin(sp->ang));
nx = MulScale(sp->xvel, bcos(sp->ang), 14);
ny = MulScale(sp->xvel, bsin(sp->ang), 14);
u->ret = move_sprite(SpriteNum, nx, ny, 0L, u->ceiling_dist, u->floor_dist, 1, ACTORMOVETICS);

View file

@ -204,8 +204,8 @@ void GameInterface::GetInput(InputPacket *packet, ControlInfo* const hidInput)
if (packet)
{
*packet = loc;
packet->fvel = mulscale9(loc.fvel, pp->angle.ang.bcos()) + mulscale9(loc.svel, pp->angle.ang.bsin());
packet->svel = mulscale9(loc.fvel, pp->angle.ang.bsin()) - mulscale9(loc.svel, pp->angle.ang.bcos());
packet->fvel = MulScale(loc.fvel, pp->angle.ang.bcos(), 9) + MulScale(loc.svel, pp->angle.ang.bsin(), 9);
packet->svel = MulScale(loc.fvel, pp->angle.ang.bsin(), 9) - MulScale(loc.svel, pp->angle.ang.bcos(), 9);
loc = {};
}
}

View file

@ -358,11 +358,11 @@ void so_dointerpolations(int32_t smoothratio) // Stick at b
}
if (data->spriteofang >= 0)
sprite[data->spriteofang].ang = NORM_ANGLE(data->lastoldipos + mulscale16(data->lastangdiff, ratio));
sprite[data->spriteofang].ang = NORM_ANGLE(data->lastoldipos + MulScale(data->lastangdiff, ratio, 16));
else
{
delta = data->lastipos - data->lastoldipos;
getvalue(data->curelement) = data->lastoldipos + mulscale16(delta, ratio);
getvalue(data->curelement) = data->lastoldipos + MulScale(delta, ratio, 16);
}
}
}

View file

@ -758,9 +758,9 @@ void JS_DrawMirrors(PLAYERp pp, int tx, int ty, int tz, fixed_t tpq16ang, fixed
mirrorinview = true;
// tx = pp->oposx + mulscale16(pp->posx - pp->oposx, smoothratio);
// ty = pp->oposy + mulscale16(pp->posy - pp->oposy, smoothratio);
// tz = pp->oposz + mulscale16(pp->posz - pp->oposz, smoothratio);
// tx = pp->oposx + MulScale(pp->posx - pp->oposx, smoothratio, 16);
// ty = pp->oposy + MulScale(pp->posy - pp->oposy, smoothratio, 16);
// tz = pp->oposz + MulScale(pp->posz - pp->oposz, smoothratio, 16);
// tpq16ang = pp->angle.ang.asq16();

View file

@ -77,8 +77,8 @@ int MultiClipMove(PLAYERp pp, int z, int floor_dist)
min_dist = 0;
min_ndx = i;
// ox is where it should be
ox[i] = x[i] = pp->posx + mulscale14(sop->clipbox_vdist[i], bcos(ang));
oy[i] = y[i] = pp->posy + mulscale14(sop->clipbox_vdist[i], bsin(ang));
ox[i] = x[i] = pp->posx + MulScale(sop->clipbox_vdist[i], bcos(ang), 14);
oy[i] = y[i] = pp->posy + MulScale(sop->clipbox_vdist[i], bsin(ang), 14);
// xs is where it hit
x[i] = xs;

View file

@ -288,8 +288,8 @@ void ScaleRandomPoint(SECTOR_OBJECTp sop, short k, short ang, int x, int y, int
xmul = (sop->scale_point_dist[k] * sop->scale_x_mult)>>8;
ymul = (sop->scale_point_dist[k] * sop->scale_y_mult)>>8;
*dx = x + mulscale14(xmul, bcos(ang));
*dy = y + mulscale14(ymul, bsin(ang));
*dx = x + MulScale(xmul, bcos(ang), 14);
*dy = y + MulScale(ymul, bsin(ang), 14);
}
//
@ -322,8 +322,8 @@ MorphTornado(SECTOR_OBJECTp sop)
sy = y;
// move it from last x,y
mx = x + mulscale14(sop->morph_speed, bcos(sop->morph_ang));
my = y + mulscale14(sop->morph_speed, bsin(sop->morph_ang));
mx = x + MulScale(sop->morph_speed, bcos(sop->morph_ang), 14);
my = y + MulScale(sop->morph_speed, bsin(sop->morph_ang), 14);
// bound check radius
if (ksqrt(SQ(sop->xmid - mx) + SQ(sop->ymid - my)) > sop->morph_dist_max + sop->scale_dist)
@ -334,8 +334,8 @@ MorphTornado(SECTOR_OBJECTp sop)
sop->morph_ang = NORM_ANGLE(sop->morph_ang + 1024);
// move back some from last point
mx = sx + mulscale14(sop->morph_speed << 1, bcos(sop->morph_ang));
my = sy + mulscale14(sop->morph_speed << 1, bsin(sop->morph_ang));
mx = sx + MulScale(sop->morph_speed << 1, bcos(sop->morph_ang), 14);
my = sy + MulScale(sop->morph_speed << 1, bsin(sop->morph_ang), 14);
sop->morph_xoff = sop->xmid - mx;
sop->morph_yoff = sop->ymid - my;
@ -400,8 +400,8 @@ MorphFloor(SECTOR_OBJECTp sop)
y = sop->ymid - sop->morph_yoff;
// move it from last x,y
mx = x + mulscale14(sop->morph_speed, bcos(sop->morph_ang));
my = y + mulscale14(sop->morph_speed, bsin(sop->morph_ang));
mx = x + MulScale(sop->morph_speed, bcos(sop->morph_ang), 14);
my = y + MulScale(sop->morph_speed, bsin(sop->morph_ang), 14);
// save x,y back as offset info
sop->morph_xoff = sop->xmid - mx;
@ -415,8 +415,8 @@ MorphFloor(SECTOR_OBJECTp sop)
sop->morph_ang = NORM_ANGLE(sop->morph_ang + 1024);
// back it up and save it off
mx = x + mulscale14(sop->morph_speed, bcos(sop->morph_ang));
my = y + mulscale14(sop->morph_speed, bsin(sop->morph_ang));
mx = x + MulScale(sop->morph_speed, bcos(sop->morph_ang), 14);
my = y + MulScale(sop->morph_speed, bsin(sop->morph_ang), 14);
sop->morph_xoff = sop->xmid - mx;
sop->morph_yoff = sop->ymid - my;

View file

@ -2067,8 +2067,8 @@ NinjaJumpActionFunc(short SpriteNum)
int nx, ny;
// Move while jumping
nx = mulscale14(sp->xvel, bcos(sp->ang));
ny = mulscale14(sp->xvel, bsin(sp->ang));
nx = MulScale(sp->xvel, bcos(sp->ang), 14);
ny = MulScale(sp->xvel, bsin(sp->ang), 14);
// if cannot move the sprite
if (!move_actor(SpriteNum, nx, ny, 0L))

View file

@ -1690,14 +1690,14 @@ DoPlayerBob(PLAYERp pp)
{
//amt = 10;
amt = 12;
amt = mulscale16(amt, dist<<8);
dist = mulscale16(dist, 26000);
amt = MulScale(amt, dist<<8, 16);
dist = MulScale(dist, 26000, 16);
}
else
{
amt = 5;
amt = mulscale16(amt, dist<<9);
dist = mulscale16(dist, 32000);
amt = MulScale(amt, dist<<9, 16);
dist = MulScale(dist, 32000, 16);
}
// controls how fast you move through the sin table
@ -1708,7 +1708,7 @@ DoPlayerBob(PLAYERp pp)
// move pp->q16horiz up and down from 100 using sintable
//pp->bob_z = Z((8 * bsin(pp->bcnt)) >> 14);
pp->bob_z = mulscale14(Z(amt), bsin(pp->bcnt));
pp->bob_z = MulScale(Z(amt), bsin(pp->bcnt), 14);
}
void
@ -1749,7 +1749,7 @@ DoPlayerSpriteBob(PLAYERp pp, short player_height, short bob_amt, short bob_spee
pp->bob_ndx = (pp->bob_ndx + (synctics << bob_speed)) & 2047;
pp->bob_amt = mulscale14(bob_amt, bsin(pp->bob_ndx));
pp->bob_amt = MulScale(bob_amt, bsin(pp->bob_ndx), 14);
sp->z = (pp->posz + player_height) + pp->bob_amt;
}
@ -1983,8 +1983,8 @@ DoPlayerSlide(PLAYERp pp)
if (pp->sop)
return;
pp->slide_xvect = mulscale16(pp->slide_xvect, PLAYER_SLIDE_FRICTION);
pp->slide_yvect = mulscale16(pp->slide_yvect, PLAYER_SLIDE_FRICTION);
pp->slide_xvect = MulScale(pp->slide_xvect, PLAYER_SLIDE_FRICTION, 16);
pp->slide_yvect = MulScale(pp->slide_yvect, PLAYER_SLIDE_FRICTION, 16);
if (labs(pp->slide_xvect) < 12800 && labs(pp->slide_yvect) < 12800)
pp->slide_xvect = pp->slide_yvect = 0;
@ -2115,8 +2115,8 @@ DoPlayerMove(PLAYERp pp)
friction -= pp->WadeDepth * 100L;
}
pp->xvect = mulscale16(pp->xvect, friction);
pp->yvect = mulscale16(pp->yvect, friction);
pp->xvect = MulScale(pp->xvect, friction, 16);
pp->yvect = MulScale(pp->yvect, friction, 16);
if (TEST(pp->Flags, PF_FLYING))
{
@ -2392,8 +2392,8 @@ DoPlayerMoveBoat(PLAYERp pp)
if (sop->drive_speed)
{
pp->xvect = mulscale6(pp->input.fvel, sop->drive_speed);
pp->yvect = mulscale6(pp->input.svel, sop->drive_speed);
pp->xvect = MulScale(pp->input.fvel, sop->drive_speed, 6);
pp->yvect = MulScale(pp->input.svel, sop->drive_speed, 6);
// does sliding/momentum
pp->xvect = (pp->xvect + (pp->oxvect*(sop->drive_slide-1)))/sop->drive_slide;
@ -2404,8 +2404,8 @@ DoPlayerMoveBoat(PLAYERp pp)
pp->xvect += ((pp->input.fvel*synctics*2)<<6);
pp->yvect += ((pp->input.svel*synctics*2)<<6);
pp->xvect = mulscale16(pp->xvect, BOAT_FRICTION);
pp->yvect = mulscale16(pp->yvect, BOAT_FRICTION);
pp->xvect = MulScale(pp->xvect, BOAT_FRICTION, 16);
pp->yvect = MulScale(pp->yvect, BOAT_FRICTION, 16);
// does sliding/momentum
pp->xvect = (pp->xvect + (pp->oxvect*5))/6;
@ -2764,8 +2764,8 @@ DoPlayerMoveVehicle(PLAYERp pp)
if (sop->drive_speed)
{
pp->xvect = mulscale6(pp->input.fvel, sop->drive_speed);
pp->yvect = mulscale6(pp->input.svel, sop->drive_speed);
pp->xvect = MulScale(pp->input.fvel, sop->drive_speed, 6);
pp->yvect = MulScale(pp->input.svel, sop->drive_speed, 6);
// does sliding/momentum
pp->xvect = (pp->xvect + (pp->oxvect*(sop->drive_slide-1)))/sop->drive_slide;
@ -2776,8 +2776,8 @@ DoPlayerMoveVehicle(PLAYERp pp)
pp->xvect += ((pp->input.fvel*synctics*2)<<6);
pp->yvect += ((pp->input.svel*synctics*2)<<6);
pp->xvect = mulscale16(pp->xvect, TANK_FRICTION);
pp->yvect = mulscale16(pp->yvect, TANK_FRICTION);
pp->xvect = MulScale(pp->xvect, TANK_FRICTION, 16);
pp->yvect = MulScale(pp->yvect, TANK_FRICTION, 16);
pp->xvect = (pp->xvect + (pp->oxvect*1))/2;
pp->yvect = (pp->yvect + (pp->oyvect*1))/2;
@ -3385,8 +3385,8 @@ DoPlayerClimb(PLAYERp pp)
pp->xvect += ((pp->input.fvel*synctics*2)<<6);
pp->yvect += ((pp->input.svel*synctics*2)<<6);
pp->xvect = mulscale16(pp->xvect, PLAYER_CLIMB_FRICTION);
pp->yvect = mulscale16(pp->yvect, PLAYER_CLIMB_FRICTION);
pp->xvect = MulScale(pp->xvect, PLAYER_CLIMB_FRICTION, 16);
pp->yvect = MulScale(pp->yvect, PLAYER_CLIMB_FRICTION, 16);
if (labs(pp->xvect) < 12800 && labs(pp->yvect) < 12800)
pp->xvect = pp->yvect = 0;
@ -3511,7 +3511,7 @@ DoPlayerClimb(PLAYERp pp)
pp->climb_ndx &= 1023;
// pp->posz += mulscale14(climb_amt, bsin(pp->climb_ndx));
// pp->posz += MulScale(climb_amt, bsin(pp->climb_ndx), 14);
pp->posz += climb_amt;
// if you are touching the floor
@ -3849,7 +3849,7 @@ DoPlayerFly(PLAYERp pp)
pp->z_speed = -PLAYER_FLY_MAX_SPEED;
}
pp->z_speed = mulscale16(pp->z_speed, 58000);
pp->z_speed = MulScale(pp->z_speed, 58000, 16);
pp->posz += pp->z_speed;
@ -4703,7 +4703,7 @@ DoPlayerDive(PLAYERp pp)
pp->z_speed = -PLAYER_DIVE_MAX_SPEED;
}
pp->z_speed = mulscale16(pp->z_speed, 58000);
pp->z_speed = MulScale(pp->z_speed, 58000, 16);
if (labs(pp->z_speed) < 16)
pp->z_speed = 0;

View file

@ -242,10 +242,10 @@ void QuakeViewChange(PLAYERp pp, int *z_diff, int *x_diff, int *y_diff, short *a
dist_diff = radius - save_dist;
scale_value = divscale16(dist_diff, radius);
*z_diff = mulscale16(*z_diff, scale_value);
*ang_diff = mulscale16(*ang_diff, scale_value);
*x_diff = mulscale16(*x_diff, scale_value);
*y_diff = mulscale16(*y_diff, scale_value);
*z_diff = MulScale(*z_diff, scale_value, 16);
*ang_diff = MulScale(*ang_diff, scale_value, 16);
*x_diff = MulScale(*x_diff, scale_value, 16);
*y_diff = MulScale(*y_diff, scale_value, 16);
}
}

View file

@ -1020,8 +1020,8 @@ DoRipperMoveHang(short SpriteNum)
int nx, ny;
// Move while jumping
nx = mulscale14(sp->xvel, bcos(sp->ang));
ny = mulscale14(sp->xvel, bsin(sp->ang));
nx = MulScale(sp->xvel, bcos(sp->ang), 14);
ny = MulScale(sp->xvel, bsin(sp->ang), 14);
// if cannot move the sprite
if (!move_actor(SpriteNum, nx, ny, 0L))

View file

@ -1020,8 +1020,8 @@ DoRipper2MoveHang(short SpriteNum)
int nx, ny;
// Move while jumping
nx = mulscale14(sp->xvel, bcos(sp->ang));
ny = mulscale14(sp->xvel, bsin(sp->ang));
nx = MulScale(sp->xvel, bcos(sp->ang), 14);
ny = MulScale(sp->xvel, bsin(sp->ang), 14);
// if cannot move the sprite
if (!move_actor(SpriteNum, nx, ny, 0L))

View file

@ -2760,13 +2760,13 @@ DoSineWaveFloor(void)
if (TEST(flags, SINE_FLOOR))
{
newz = swf->floor_origz + mulscale14(swf->range, bsin(swf->sintable_ndx));
newz = swf->floor_origz + MulScale(swf->range, bsin(swf->sintable_ndx), 14);
sector[swf->sector].floorz = newz;
}
if (TEST(flags, SINE_CEILING))
{
newz = swf->ceiling_origz + mulscale14(swf->range, bsin(swf->sintable_ndx));
newz = swf->ceiling_origz + MulScale(swf->range, bsin(swf->sintable_ndx), 14);
sector[swf->sector].ceilingz = newz;
}
@ -2824,13 +2824,13 @@ DoSineWaveWall(void)
if (!sw->type)
{
New = sw->orig_xy + mulscale14(sw->range, bsin(sw->sintable_ndx));
New = sw->orig_xy + MulScale(sw->range, bsin(sw->sintable_ndx), 14);
// wall[sw->wall].y = New;
dragpoint(sw->wall, wall[sw->wall].x, New, 0);
}
else
{
New = sw->orig_xy + mulscale14(sw->range, bsin(sw->sintable_ndx));
New = sw->orig_xy + MulScale(sw->range, bsin(sw->sintable_ndx), 14);
// wall[sw->wall].x = New;
dragpoint(sw->wall, New, wall[sw->wall].y, 0);
}
@ -3207,8 +3207,8 @@ DoPanning(void)
sp = &sprite[i];
sectp = &sector[sp->sectnum];
nx = mulscale20(sp->xvel, bcos(sp->ang));
ny = mulscale20(sp->xvel, bsin(sp->ang));
nx = MulScale(sp->xvel, bcos(sp->ang), 20);
ny = MulScale(sp->xvel, bsin(sp->ang), 20);
sectp->addfloorxpan(nx);
sectp->addfloorypan(ny);
@ -3220,8 +3220,8 @@ DoPanning(void)
sp = &sprite[i];
sectp = &sector[sp->sectnum];
nx = mulscale20(sp->xvel, bcos(sp->ang));
ny = mulscale20(sp->xvel, bsin(sp->ang));
nx = MulScale(sp->xvel, bcos(sp->ang), 20);
ny = MulScale(sp->xvel, bsin(sp->ang), 20);
sectp->addceilingxpan(nx);
sectp->addceilingypan(ny);
@ -3233,8 +3233,8 @@ DoPanning(void)
sp = &sprite[i];
wallp = &wall[sp->owner];
nx = mulscale20(sp->xvel, bcos(sp->ang));
ny = mulscale20(sp->xvel, bsin(sp->ang));
nx = MulScale(sp->xvel, bcos(sp->ang), 20);
ny = MulScale(sp->xvel, bsin(sp->ang), 20);
wallp->addxpan(nx);
wallp->addypan(ny);

View file

@ -438,8 +438,8 @@ int DoSkullBob(short SpriteNum)
#define SKULL_BOB_AMT (Z(16))
u->Counter = (u->Counter + (ACTORMOVETICS << 3) + (ACTORMOVETICS << 1)) & 2047;
sp->z = u->sz + mulscale14(SKULL_BOB_AMT, bsin(u->Counter)) +
mulscale14(DIV2(SKULL_BOB_AMT), bsin(u->Counter));
sp->z = u->sz + MulScale(SKULL_BOB_AMT, bsin(u->Counter), 14) +
MulScale(DIV2(SKULL_BOB_AMT), bsin(u->Counter), 14);
return 0;
}
@ -849,8 +849,8 @@ int DoBettyBob(short SpriteNum)
#define BETTY_BOB_AMT (Z(16))
u->Counter = (u->Counter + (ACTORMOVETICS << 3) + (ACTORMOVETICS << 1)) & 2047;
sp->z = u->sz + mulscale14(BETTY_BOB_AMT, bsin(u->Counter)) +
mulscale14(DIV2(BETTY_BOB_AMT), bsin(u->Counter));
sp->z = u->sz + MulScale(BETTY_BOB_AMT, bsin(u->Counter), 14) +
MulScale(DIV2(BETTY_BOB_AMT), bsin(u->Counter), 14);
return 0;
}

View file

@ -4797,13 +4797,13 @@ getzrangepoint(int x, int y, int z, short sectnum,
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);
x2 = x1 - MulScale(sinang, l, 16);
y2 = y1 + MulScale(cosang, l, 16);
l = yspan * spr->yrepeat;
k = -mulscale16(cosang, l);
k = -MulScale(cosang, l, 16);
x3 = x2 + k;
x4 = x1 + k;
k = -mulscale16(sinang, l);
k = -MulScale(sinang, l, 16);
y3 = y2 + k;
y4 = y1 + k;

View file

@ -398,15 +398,15 @@ void QuickJumpSetup(short stat, short lotag, short type)
// add jump point
nsp = &sprite[SpriteNum];
nsp->x += mulscale14(64, bcos(nsp->ang));
nsp->y += mulscale14(64, bsin(nsp->ang));
nsp->x += MulScale(64, bcos(nsp->ang), 14);
nsp->y += MulScale(64, bsin(nsp->ang), 14);
nsp->lotag = lotag;
TrackAddPoint(t, tp, SpriteNum);
// add end point
nsp = &sprite[end_sprite];
nsp->x += mulscale14(2048, bcos(nsp->ang));
nsp->y += mulscale14(2048, bsin(nsp->ang));
nsp->x += MulScale(2048, bcos(nsp->ang), 14);
nsp->y += MulScale(2048, bsin(nsp->ang), 14);
nsp->lotag = TRACK_END;
nsp->hitag = 0;
TrackAddPoint(t, tp, end_sprite);
@ -456,8 +456,8 @@ void QuickScanSetup(short stat, short lotag, short type)
nsp = &sprite[start_sprite];
nsp->lotag = TRACK_START;
nsp->hitag = 0;
nsp->x += mulscale14(64, -bcos(nsp->ang));
nsp->y += mulscale14(64, -bsin(nsp->ang));
nsp->x += MulScale(64, -bcos(nsp->ang), 14);
nsp->y += MulScale(64, -bsin(nsp->ang), 14);
TrackAddPoint(t, tp, start_sprite);
// add jump point
@ -467,8 +467,8 @@ void QuickScanSetup(short stat, short lotag, short type)
// add end point
nsp = &sprite[end_sprite];
nsp->x += mulscale14(64, bcos(nsp->ang));
nsp->y += mulscale14(64, bsin(nsp->ang));
nsp->x += MulScale(64, bcos(nsp->ang), 14);
nsp->y += MulScale(64, bsin(nsp->ang), 14);
nsp->lotag = TRACK_END;
nsp->hitag = 0;
TrackAddPoint(t, tp, end_sprite);
@ -522,8 +522,8 @@ void QuickExitSetup(short stat, short type)
// add end point
nsp = &sprite[end_sprite];
nsp->x += mulscale14(1024, bcos(nsp->ang));
nsp->y += mulscale14(1024, bsin(nsp->ang));
nsp->x += MulScale(1024, bcos(nsp->ang), 14);
nsp->y += MulScale(1024, bsin(nsp->ang), 14);
nsp->lotag = TRACK_END;
nsp->hitag = 0;
TrackAddPoint(t, tp, end_sprite);
@ -1980,8 +1980,8 @@ void RefreshPoints(SECTOR_OBJECTp sop, int nx, int ny, bool dynamic)
int xmul = (sop->scale_dist * sop->scale_x_mult)>>8;
int ymul = (sop->scale_dist * sop->scale_y_mult)>>8;
dx = x + mulscale14(xmul, bcos(ang));
dy = y + mulscale14(ymul, bsin(ang));
dx = x + MulScale(xmul, bcos(ang), 14);
dy = y + MulScale(ymul, bsin(ang), 14);
}
}
}
@ -2176,7 +2176,7 @@ MoveZ(SECTOR_OBJECTp sop)
if (sop->bob_amt)
{
sop->bob_sine_ndx = (PlayClock << sop->bob_speed) & 2047;
sop->bob_diff = mulscale14(sop->bob_amt, bsin(sop->bob_sine_ndx));
sop->bob_diff = MulScale(sop->bob_amt, bsin(sop->bob_sine_ndx), 14);
// for all sectors
for (i = 0, sectp = &sop->sectp[0]; *sectp; sectp++, i++)
@ -2785,7 +2785,7 @@ OperateSectorObjectForTics(SECTOR_OBJECTp sop, short newang, int newx, int newy,
if (sop->bob_amt)
{
sop->bob_sine_ndx = (PlayClock << sop->bob_speed) & 2047;
sop->bob_diff = mulscale14(sop->bob_amt, bsin(sop->bob_sine_ndx));
sop->bob_diff = MulScale(sop->bob_amt, bsin(sop->bob_sine_ndx), 14);
// for all sectors
for (i = 0, sectp = &sop->sectp[0]; *sectp; sectp++, i++)
@ -3826,8 +3826,8 @@ ActorFollowTrack(short SpriteNum, short locktics)
else
{
// calculate a new x and y
nx = mulscale14(sp->xvel, bcos(sp->ang));
ny = mulscale14(sp->xvel, bsin(sp->ang));
nx = MulScale(sp->xvel, bcos(sp->ang), 14);
ny = MulScale(sp->xvel, bsin(sp->ang), 14);
}
nz = 0;

View file

@ -65,8 +65,8 @@ void SOwallmove(SECTOR_OBJECTp sop, SPRITEp sp, WALLp find_wallp, int dist, int
ASSERT(User[sp - sprite]);
ang = User[sp - sprite]->sang;
*nx = mulscale14(dist, bcos(ang));
*ny = mulscale14(dist, bsin(ang));
*nx = MulScale(dist, bcos(ang), 14);
*ny = MulScale(dist, bsin(ang), 14);
sop->xorig[wallcount] -= *nx;
sop->yorig[wallcount] -= *ny;
@ -101,8 +101,8 @@ int DoWallMove(SPRITEp sp)
if (dang)
ang = NORM_ANGLE(ang + (RANDOM_RANGE(dang) - dang/2));
nx = mulscale14(dist, bcos(ang));
ny = mulscale14(dist, bsin(ang));
nx = MulScale(dist, bcos(ang), 14);
ny = MulScale(dist, bsin(ang), 14);
for (wallp = wall; wallp < &wall[numwalls]; wallp++)
{

View file

@ -3896,8 +3896,8 @@ DoVomit(short SpriteNum)
USERp u = User[SpriteNum];
u->Counter = NORM_ANGLE(u->Counter + (30*MISSILEMOVETICS));
sp->xrepeat = u->sx + mulscale14(12, bcos(u->Counter));
sp->yrepeat = u->sy + mulscale14(12, bsin(u->Counter));
sp->xrepeat = u->sx + MulScale(12, bcos(u->Counter), 14);
sp->yrepeat = u->sy + MulScale(12, bsin(u->Counter), 14);
if (TEST(u->Flags, SPR_JUMPING))
{
DoJump(SpriteNum);
@ -3946,8 +3946,8 @@ DoVomit(short SpriteNum)
USERp u = User[SpriteNum];
u->Counter = NORM_ANGLE(u->Counter + (30*MISSILEMOVETICS));
sp->xrepeat = u->sx + mulscale14(12, bcos(u->Counter));
sp->yrepeat = u->sy + mulscale14(12, bsin(u->Counter));
sp->xrepeat = u->sx + MulScale(12, bcos(u->Counter), 14);
sp->yrepeat = u->sy + MulScale(12, bsin(u->Counter), 14);
if (TEST(u->Flags, SPR_JUMPING))
{
@ -8102,13 +8102,13 @@ DoStar(int16_t Weapon)
break; // will be killed below - u->ret != 0
// 32000 to 96000
u->xchange = mulscale16(u->xchange, 64000 + (RANDOM_RANGE(64000) - 32000));
u->ychange = mulscale16(u->ychange, 64000 + (RANDOM_RANGE(64000) - 32000));
u->xchange = MulScale(u->xchange, 64000 + (RANDOM_RANGE(64000) - 32000), 16);
u->ychange = MulScale(u->ychange, 64000 + (RANDOM_RANGE(64000) - 32000), 16);
if (sp->z > DIV2(u->hiz + u->loz))
u->zchange = mulscale16(u->zchange, 50000); // floor
u->zchange = MulScale(u->zchange, 50000, 16); // floor
else
u->zchange = mulscale16(u->zchange, 40000); // ceiling
u->zchange = MulScale(u->zchange, 40000, 16); // ceiling
if (SlopeBounce(Weapon, &did_hit_wall))
{
@ -8145,12 +8145,12 @@ DoStar(int16_t Weapon)
u->zchange = -u->zchange;
// 32000 to 96000
u->xchange = mulscale16(u->xchange, 64000 + (RANDOM_RANGE(64000) - 32000));
u->ychange = mulscale16(u->ychange, 64000 + (RANDOM_RANGE(64000) - 32000));
u->xchange = MulScale(u->xchange, 64000 + (RANDOM_RANGE(64000) - 32000), 16);
u->ychange = MulScale(u->ychange, 64000 + (RANDOM_RANGE(64000) - 32000), 16);
if (sp->z > DIV2(u->hiz + u->loz))
u->zchange = mulscale16(u->zchange, 50000); // floor
u->zchange = MulScale(u->zchange, 50000, 16); // floor
else
u->zchange = mulscale16(u->zchange, 40000); // ceiling
u->zchange = MulScale(u->zchange, 40000, 16); // ceiling
break;
}
@ -8794,9 +8794,9 @@ void ScaleSpriteVector(short SpriteNum, int scale)
{
USERp u = User[SpriteNum];
u->xchange = mulscale16(u->xchange, scale);
u->ychange = mulscale16(u->ychange, scale);
u->zchange = mulscale16(u->zchange, scale);
u->xchange = MulScale(u->xchange, scale, 16);
u->ychange = MulScale(u->ychange, scale, 16);
u->zchange = MulScale(u->zchange, scale, 16);
}
void WallBounce(short SpriteNum, short ang)
@ -8818,7 +8818,7 @@ void WallBounce(short SpriteNum, short ang)
u->bounce++;
//k = cos(ang) * sin(ang) * 2
k = mulscale13(bcos(ang), bsin(ang));
k = MulScale(bcos(ang), bsin(ang), 13);
//l = cos(ang * 2)
l = bcos(ang << 1);
@ -8890,21 +8890,21 @@ bool SlopeBounce(short SpriteNum, bool *hit_wall)
// k is now the slope of the ceiling or floor
// normal vector of the slope
dax = mulscale14(slope, bsin(daang));
day = mulscale14(slope, -bcos(daang));
dax = MulScale(slope, bsin(daang), 14);
day = MulScale(slope, -bcos(daang), 14);
daz = 4096; // 4096 = 45 degrees
// reflection code
k = ((u->xchange*dax) + (u->ychange*day)) + mulscale4(u->zchange, daz);
k = ((u->xchange*dax) + (u->ychange*day)) + MulScale(u->zchange, daz, 4);
l = (dax*dax) + (day*day) + (daz*daz);
// make sure divscale doesn't overflow
if ((klabs(k)>>14) < l)
{
k = divscale17(k, l);
u->xchange -= mulscale16(dax, k);
u->ychange -= mulscale16(day, k);
u->zchange -= mulscale12(daz, k);
u->xchange -= MulScale(dax, k, 16);
u->ychange -= MulScale(day, k, 16);
u->zchange -= MulScale(daz, k, 12);
sp->ang = getangle(u->xchange, u->ychange);
}
@ -9264,9 +9264,9 @@ DoVulcanBoulder(int16_t Weapon)
if (sp->z > DIV2(u->hiz + u->loz))
{
// hit a floor
u->xchange = mulscale16(u->xchange, 30000);
u->ychange = mulscale16(u->ychange, 30000);
u->zchange = mulscale16(u->zchange, 12000);
u->xchange = MulScale(u->xchange, 30000, 16);
u->ychange = MulScale(u->ychange, 30000, 16);
u->zchange = MulScale(u->zchange, 12000, 16);
u->ret = 0;
u->Counter = 0;
@ -9291,9 +9291,9 @@ DoVulcanBoulder(int16_t Weapon)
u->ret = 0;
u->Counter = 0;
u->xchange = mulscale16(u->xchange, 20000);
u->ychange = mulscale16(u->ychange, 20000);
u->zchange = mulscale16(u->zchange, 32000);
u->xchange = MulScale(u->xchange, 20000, 16);
u->ychange = MulScale(u->ychange, 20000, 16);
u->zchange = MulScale(u->zchange, 32000, 16);
// limit to a reasonable bounce value
if (u->zchange > Z(24))
@ -12314,8 +12314,8 @@ DoBloodWorm(int16_t Weapon)
by = sp->y;
amt = RANDOM_P2(2048) - 1024;
sp->x += mulscale15(amt,xvect);
sp->y += mulscale15(amt,yvect);
sp->x += MulScale(amt,xvect, 15);
sp->y += MulScale(amt,yvect, 15);
sectnum = sp->sectnum;
updatesectorz(sp->x, sp->y, sp->z, &sectnum);
@ -12427,8 +12427,8 @@ DoBloodWorm(int16_t Weapon)
by = sp->y;
amt = RANDOM_P2(2048) - 1024;
sp->x += mulscale15(amt,xvect);
sp->y += mulscale15(amt,yvect);
sp->x += MulScale(amt,xvect, 15);
sp->y += MulScale(amt,yvect, 15);
sectnum = sp->sectnum;
updatesectorz(sp->x, sp->y, sp->z, &sectnum);
@ -12445,8 +12445,8 @@ DoBloodWorm(int16_t Weapon)
sp->y = by;
amt = RANDOM_P2(2048) - 1024;
sp->x += mulscale15(amt,xvect);
sp->y += mulscale15(amt,yvect);
sp->x += MulScale(amt,xvect, 15);
sp->y += MulScale(amt,yvect, 15);
sectnum = sp->sectnum;
updatesectorz(sp->x, sp->y, sp->z, &sectnum);
@ -12822,8 +12822,8 @@ DoRing(int16_t Weapon)
sp->ang = NORM_ANGLE(sp->ang + (4 * RINGMOVETICS) + RINGMOVETICS);
// put it out there
sp->x += mulscale14(u->Dist, bcos(sp->ang));
sp->y += mulscale14(u->Dist, bsin(sp->ang));
sp->x += MulScale(u->Dist, bcos(sp->ang), 14);
sp->y += MulScale(u->Dist, bsin(sp->ang), 14);
if (User[sp->owner]->PlayerP)
sp->z += (u->Dist * (-pp->horizon.horiz.asq16() >> 9)) >> 9;
@ -12910,8 +12910,8 @@ InitSpellRing(PLAYERp pp)
//SET(u->Flags, SPR_XFLIP_TOGGLE);
// put it out there
sp->x += mulscale14(u->Dist, bcos(sp->ang));
sp->y += mulscale14(u->Dist, bsin(sp->ang));
sp->x += MulScale(u->Dist, bcos(sp->ang), 14);
sp->y += MulScale(u->Dist, bsin(sp->ang), 14);
sp->z = pp->posz + Z(20) + ((u->Dist * (-pp->horizon.horiz.asq16() >> 9)) >> 9);
sp->ang = NORM_ANGLE(sp->ang + 512);
@ -12972,8 +12972,8 @@ DoSerpRing(int16_t Weapon)
sp->ang = NORM_ANGLE(sp->ang - (28 * RINGMOVETICS));
// put it out there
sp->x += mulscale14(u->Dist, bcos(u->slide_ang));
sp->y += mulscale14(u->Dist, bsin(u->slide_ang));
sp->x += MulScale(u->Dist, bcos(u->slide_ang), 14);
sp->y += MulScale(u->Dist, bsin(u->slide_ang), 14);
setsprite(Weapon, &sp->pos);
@ -13225,8 +13225,8 @@ InitSerpRing(short SpriteNum)
nu->spal = np->pal = 27; // Bright Green
// put it out there
np->x += mulscale14(nu->Dist, bcos(np->ang));
np->y += mulscale14(nu->Dist, bsin(np->ang));
np->x += MulScale(nu->Dist, bcos(np->ang), 14);
np->y += MulScale(nu->Dist, bsin(np->ang), 14);
np->z = SPRITEp_TOS(sp) + Z(20);
np->ang = NORM_ANGLE(np->ang + 512);
@ -13758,7 +13758,7 @@ InitSwordAttack(PLAYERp pp)
int daz;
daang = pp->angle.ang.asbuild();
daz = -mulscale16(pp->horizon.horiz.asq16(), 2000) + (RANDOM_RANGE(24000) - 12000);
daz = -MulScale(pp->horizon.horiz.asq16(), 2000, 16) + (RANDOM_RANGE(24000) - 12000);
FAFhitscan(pp->posx, pp->posy, pp->posz, pp->cursectnum, // Start position
bcos(daang), // X vector of 3D ang
@ -13949,7 +13949,7 @@ InitFistAttack(PLAYERp pp)
int daz;
daang = pp->angle.ang.asbuild();
daz = -mulscale16(pp->horizon.horiz.asq16(), 2000) + (RANDOM_RANGE(24000) - 12000);
daz = -MulScale(pp->horizon.horiz.asq16(), 2000, 16) + (RANDOM_RANGE(24000) - 12000);
FAFhitscan(pp->posx, pp->posy, pp->posz, pp->cursectnum, // Start position
bcos(daang), // X vector of 3D ang
@ -14619,7 +14619,7 @@ InitStar(PLAYERp pp)
wp->clipdist = 32L >> 2;
// wp->zvel was overflowing with this calculation - had to move to a local
// long var
zvel = -mulscale16(pp->horizon.horiz.asq16(), HORIZ_MULT+STAR_HORIZ_ADJ);
zvel = -MulScale(pp->horizon.horiz.asq16(), HORIZ_MULT+STAR_HORIZ_ADJ, 16);
wu->ceiling_dist = Z(1);
wu->floor_dist = Z(1);
@ -14676,7 +14676,7 @@ InitStar(PLAYERp pp)
if (TEST(pp->Flags, PF_DIVING) || SpriteInUnderwaterArea(np))
SET(nu->Flags, SPR_UNDERWATER);
zvel = -mulscale16(pp->horizon.horiz.asq16(), HORIZ_MULT+STAR_HORIZ_ADJ);
zvel = -MulScale(pp->horizon.horiz.asq16(), HORIZ_MULT+STAR_HORIZ_ADJ, 16);
np->zvel = zvel >> 1;
if (MissileSetPos(nw, DoStar, 1000))
@ -14964,7 +14964,7 @@ InitShotgun(PLAYERp pp)
}
else
{
daz = -mulscale16(pp->horizon.horiz.asq16(), 2000);
daz = -MulScale(pp->horizon.horiz.asq16(), 2000, 16);
daang = pp->angle.ang.asbuild();
}
@ -15247,7 +15247,7 @@ InitRail(PLAYERp pp)
wp->yrepeat = 52;
wp->xrepeat = 52;
wp->shade = -15;
zvel = -mulscale16(pp->horizon.horiz.asq16(), HORIZ_MULT + 17);
zvel = -MulScale(pp->horizon.horiz.asq16(), HORIZ_MULT + 17, 16);
wu->RotNum = 5;
NewStateGroup(w, &sg_Rail[0]);
@ -15448,7 +15448,7 @@ InitRocket(PLAYERp pp)
wp->yrepeat = 90;
wp->xrepeat = 90;
wp->shade = -15;
zvel = -mulscale16(pp->horizon.horiz.asq16(), HORIZ_MULT + 35);
zvel = -MulScale(pp->horizon.horiz.asq16(), HORIZ_MULT + 35, 16);
wp->clipdist = 64L>>2;
@ -15579,7 +15579,7 @@ InitBunnyRocket(PLAYERp pp)
wp->yrepeat = 64;
wp->xrepeat = 64;
wp->shade = -15;
zvel = -mulscale16(pp->horizon.horiz.asq16(), HORIZ_MULT + 35);
zvel = -MulScale(pp->horizon.horiz.asq16(), HORIZ_MULT + 35, 16);
wp->clipdist = 64L>>2;
@ -15693,7 +15693,7 @@ InitNuke(PLAYERp pp)
wp->yrepeat = 128;
wp->xrepeat = 128;
wp->shade = -15;
zvel = -mulscale16(pp->horizon.horiz.asq16(), HORIZ_MULT + 36);
zvel = -MulScale(pp->horizon.horiz.asq16(), HORIZ_MULT + 36, 16);
wp->clipdist = 64L>>2;
// Set to red palette
@ -16106,12 +16106,12 @@ WallSpriteInsideSprite(SPRITEp wsp, SPRITEp sp)
mid_dist = DIV2(xsiz) + xoff;
// starting from the center find the first point
x1 -= mulscale16(dax, mid_dist);
x1 -= MulScale(dax, mid_dist, 16);
// starting from the first point find the end point
x2 = x1 + mulscale16(dax, xsiz);
x2 = x1 + MulScale(dax, xsiz, 16);
y1 -= mulscale16(day, mid_dist);
y2 = y1 + mulscale16(day, xsiz);
y1 -= MulScale(day, mid_dist, 16);
y2 = y1 + MulScale(day, xsiz, 16);
return !!clipinsideboxline(sp->x, sp->y, x1, y1, x2, y2, ((int) sp->clipdist) << 2);
}
@ -17074,8 +17074,8 @@ InitCoolgFire(short SpriteNum)
wu->ychange = MOVEy(wp->xvel, wp->ang);
wu->zchange = wp->zvel;
nx = mulscale14(728, bcos(nang));
ny = mulscale14(728, bsin(nang));
nx = MulScale(728, bcos(nang), 14);
ny = MulScale(728, bsin(nang), 14);
move_missile(w, nx, ny, 0L, wu->ceiling_dist, wu->floor_dist, 0, 3L);
@ -17439,8 +17439,8 @@ InitTracerUzi(PLAYERp pp)
nx = pp->posx;
ny = pp->posy;
//nz = pp->posz + pp->bob_z + Z(8);
//nz = pp->posz + pp->bob_z + Z(8) + -mulscale16(pp->horizon.horiz.asq16(), 72);
nz = pp->posz + Z(8) + -mulscale16(pp->horizon.horiz.asq16(), 72);
//nz = pp->posz + pp->bob_z + Z(8) + -MulScale(pp->horizon.horiz.asq16(), 72, 16);
nz = pp->posz + Z(8) + -MulScale(pp->horizon.horiz.asq16(), 72, 16);
// Spawn a shot
// Inserting and setting up variables
@ -17517,7 +17517,7 @@ InitTracerTurret(short SpriteNum, short Operator, fixed_t q16horiz)
nx = sp->x;
ny = sp->y;
nz = sp->z + -mulscale16(q16horiz, 72);
nz = sp->z + -MulScale(q16horiz, 72, 16);
// Spawn a shot
// Inserting and setting up variables
@ -17836,7 +17836,7 @@ InitUzi(PLAYERp pp)
{
//daang = NORM_ANGLE(pp->angle.ang.asbuild() + (RANDOM_RANGE(50) - 25));
daang = NORM_ANGLE(pp->angle.ang.asbuild() + (RANDOM_RANGE(24) - 12));
daz = -mulscale16(pp->horizon.horiz.asq16(), 2000) + (RANDOM_RANGE(24000) - 12000);
daz = -MulScale(pp->horizon.horiz.asq16(), 2000, 16) + (RANDOM_RANGE(24000) - 12000);
}
@ -18011,7 +18011,7 @@ InitEMP(PLAYERp pp)
InitTracerUzi(pp);
//daz = nz = pp->posz + Z(8) + -mulscale16(pp->horizon.horiz.asq16(), 72);
//daz = nz = pp->posz + Z(8) + -MulScale(pp->horizon.horiz.asq16(), 72, 16);
//daang = NORM_ANGLE(pp->angle.ang.asbuild() + (RANDOM_RANGE(50) - 25));
daz = nz = pp->posz + pp->bob_z;
@ -18021,7 +18021,7 @@ InitEMP(PLAYERp pp)
}
else
{
daz = -mulscale16(pp->horizon.horiz.asq16(), 2000);
daz = -MulScale(pp->horizon.horiz.asq16(), 2000, 16);
daang = pp->angle.ang.asbuild();
}
@ -18572,7 +18572,7 @@ InitSobjMachineGun(short SpriteNum, PLAYERp pp)
if (q16horiz < horizmin)
q16horiz = horizmin;
daz = -mulscale16(q16horiz, 2000) + (RANDOM_RANGE(Z(80)) - Z(40));
daz = -MulScale(q16horiz, 2000, 16) + (RANDOM_RANGE(Z(80)) - Z(40));
daang = sp->ang;
}
@ -19623,8 +19623,8 @@ InitFireball(PLAYERp pp)
wu->ceiling_dist = Z(6);
wu->floor_dist = Z(6);
//zvel = -mulscale16(pp->horizon.horiz.asq16(), 100 + ADJUST);
zvel = -mulscale16(pp->horizon.horiz.asq16(), 240);
//zvel = -MulScale(pp->horizon.horiz.asq16(), 100 + ADJUST, 16);
zvel = -MulScale(pp->horizon.horiz.asq16(), 240, 16);
//wu->RotNum = 5;
//NewStateGroup(w, &sg_Fireball);
@ -19642,7 +19642,7 @@ InitFireball(PLAYERp pp)
if (TEST(pp->Flags, PF_DIVING) || SpriteInUnderwaterArea(wp))
SET(wu->Flags, SPR_UNDERWATER);
if (TestMissileSetPos(w, DoFireball, 1200, mulscale16(zvel,44000)))
if (TestMissileSetPos(w, DoFireball, 1200, MulScale(zvel,44000, 16)))
{
pp->SpriteP->clipdist = oclipdist;
KillSprite(w);