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

This commit is contained in:
Mitchell Richters 2021-01-04 22:57:26 +11:00
parent b5aac8723f
commit 868aa7f07a
23 changed files with 93 additions and 96 deletions

View file

@ -3953,7 +3953,7 @@ void actKickObject(spritetype *pSprite1, spritetype *pSprite2)
int nSpeed = ClipLow(approxDist(xvel[nSprite1], yvel[nSprite1])*2, 0xaaaaa);
xvel[nSprite2] = MulScale(nSpeed, Cos(pSprite1->ang+Random2(85)), 30);
yvel[nSprite2] = MulScale(nSpeed, Sin(pSprite1->ang+Random2(85)), 30);
zvel[nSprite2] = mulscale(nSpeed, -0x2000, 14);
zvel[nSprite2] = MulScale(nSpeed, -0x2000, 14);
pSprite2->flags = 7;
}
@ -4020,15 +4020,15 @@ void ProcessTouchObjects(spritetype *pSprite, int nXSprite)
pSprite2->flags |= 4;
// Inlined ?
xvel[pSprite2->index] += mulscale(4, pSprite2->x-sprite[nSprite].x, 2);
yvel[pSprite2->index] += mulscale(4, pSprite2->y-sprite[nSprite].y, 2);
xvel[pSprite2->index] += MulScale(4, pSprite2->x-sprite[nSprite].x, 2);
yvel[pSprite2->index] += MulScale(4, pSprite2->y-sprite[nSprite].y, 2);
}
else
{
pSprite2->flags |= 5;
xvel[pSprite2->index] += mulscale(4, pSprite2->x-sprite[nSprite].x, 2);
yvel[pSprite2->index] += mulscale(4, pSprite2->y-sprite[nSprite].y, 2);
xvel[pSprite2->index] += MulScale(4, pSprite2->x-sprite[nSprite].x, 2);
yvel[pSprite2->index] += MulScale(4, pSprite2->y-sprite[nSprite].y, 2);
#ifdef NOONE_EXTENSIONS
// add size shroom abilities
@ -4407,7 +4407,7 @@ int MoveThing(spritetype *pSprite)
pSprite->flags |= 4;
int vax = actFloorBounceVector((int*)&xvel[nSprite], (int*)&yvel[nSprite], (int*)&v20, pSprite->sectnum, pThingInfo->elastic);
int nDamage = mulscale(vax, vax, 30)-pThingInfo->dmgResist;
int nDamage = MulScale(vax, vax, 30)-pThingInfo->dmgResist;
if (nDamage > 0)
actDamageSprite(nSprite, pSprite, DAMAGE_TYPE_0, nDamage);
zvel[nSprite] = v20;
@ -4481,8 +4481,8 @@ int MoveThing(spritetype *pSprite)
int nHitSprite = floorHit & 0x3fff;
if ((sprite[nHitSprite].cstat & 0x30) == 0)
{
xvel[nSprite] += mulscale(4, pSprite->x - sprite[nHitSprite].x, 2);
yvel[nSprite] += mulscale(4, pSprite->y - sprite[nHitSprite].y, 2);
xvel[nSprite] += MulScale(4, pSprite->x - sprite[nHitSprite].x, 2);
yvel[nSprite] += MulScale(4, pSprite->y - sprite[nHitSprite].y, 2);
v8 = gSpriteHit[nXSprite].hit;
}
}
@ -4934,7 +4934,7 @@ void MoveDude(spritetype *pSprite)
if (v30 > 0)
{
int vax = actFloorBounceVector((int*)&xvel[nSprite], (int*)&yvel[nSprite], (int*)&v30, pSprite->sectnum, 0);
int nDamage = mulscale(vax, vax, 30);
int nDamage = MulScale(vax, vax, 30);
if (pPlayer)
{
pPlayer->fallScream = 0;
@ -5013,8 +5013,8 @@ void MoveDude(spritetype *pSprite)
int nHitSprite = floorHit & 0x3fff;
if ((sprite[nHitSprite].cstat & 0x30) == 0)
{
xvel[nSprite] += mulscale(4, pSprite->x - sprite[nHitSprite].x, 2);
yvel[nSprite] += mulscale(4, pSprite->y - sprite[nHitSprite].y, 2);
xvel[nSprite] += MulScale(4, pSprite->x - sprite[nHitSprite].x, 2);
yvel[nSprite] += MulScale(4, pSprite->y - sprite[nHitSprite].y, 2);
return;
}
}
@ -6262,7 +6262,7 @@ spritetype * actFireThing(spritetype *pSprite, int a2, int a3, int a4, int thing
pThing->ang = pSprite->ang;
xvel[pThing->index] = MulScale(a6, Cos(pThing->ang), 30);
yvel[pThing->index] = MulScale(a6, Sin(pThing->ang), 30);
zvel[pThing->index] = mulscale(a6, a4, 14);
zvel[pThing->index] = MulScale(a6, a4, 14);
xvel[pThing->index] += xvel[pSprite->index]/2;
yvel[pThing->index] += yvel[pSprite->index]/2;
zvel[pThing->index] += zvel[pSprite->index]/2;
@ -6309,9 +6309,9 @@ spritetype* actFireMissile(spritetype *pSprite, int a2, int a3, int a4, int a5,
pMissile->yrepeat = pMissileInfo->yrepeat;
pMissile->picnum = pMissileInfo->picnum;
pMissile->ang = (pSprite->ang+pMissileInfo->angleOfs)&2047;
xvel[nMissile] = mulscale(pMissileInfo->velocity, a4, 14);
yvel[nMissile] = mulscale(pMissileInfo->velocity, a5, 14);
zvel[nMissile] = mulscale(pMissileInfo->velocity, a6, 14);
xvel[nMissile] = MulScale(pMissileInfo->velocity, a4, 14);
yvel[nMissile] = MulScale(pMissileInfo->velocity, a5, 14);
zvel[nMissile] = MulScale(pMissileInfo->velocity, a6, 14);
pMissile->owner = pSprite->index;
pMissile->cstat |= 1;
int nXSprite = pMissile->extra;
@ -6525,9 +6525,9 @@ void actFireVector(spritetype *pShooter, int a2, int a3, int a4, int a5, int a6,
}
}
}
int x = gHitInfo.hitx-mulscale(a4, 16, 14);
int y = gHitInfo.hity-mulscale(a5, 16, 14);
int z = gHitInfo.hitz-mulscale(a6, 256, 14);
int x = gHitInfo.hitx-MulScale(a4, 16, 14);
int y = gHitInfo.hity-MulScale(a5, 16, 14);
int z = gHitInfo.hitz-MulScale(a6, 256, 14);
short nSector = gHitInfo.hitsect;
unsigned char nSurf = kSurfNone;
if (nRange == 0 || approxDist(gHitInfo.hitx-pShooter->x, gHitInfo.hity-pShooter->y) < nRange)
@ -6559,9 +6559,9 @@ void actFireVector(spritetype *pShooter, int a2, int a3, int a4, int a5, int a6,
nSurf = surfType[wall[nWall].picnum];
if (actCanSplatWall(nWall))
{
int x = gHitInfo.hitx-mulscale(a4, 16, 14);
int y = gHitInfo.hity-mulscale(a5, 16, 14);
int z = gHitInfo.hitz-mulscale(a6, 256, 14);
int x = gHitInfo.hitx-MulScale(a4, 16, 14);
int y = gHitInfo.hity-MulScale(a5, 16, 14);
int z = gHitInfo.hitz-MulScale(a6, 256, 14);
int nSurf = surfType[wall[nWall].picnum];
assert(nSurf < kSurfMax);
if (pVectorData->surfHit[nSurf].fx1 >= 0)
@ -6596,9 +6596,9 @@ void actFireVector(spritetype *pShooter, int a2, int a3, int a4, int a5, int a6,
nSurf = surfType[sprite[nSprite].picnum];
assert(nSprite >= 0 && nSprite < kMaxSprites);
spritetype *pSprite = &sprite[nSprite];
x -= mulscale(a4, 112, 14);
y -= mulscale(a5, 112, 14);
z -= mulscale(a6, 112<<4, 14);
x -= MulScale(a4, 112, 14);
y -= MulScale(a5, 112, 14);
z -= MulScale(a6, 112<<4, 14);
int shift = 4;
if (vectorType == VECTOR_TYPE_0 && !IsPlayerSprite(pSprite))
shift = 3;
@ -6671,9 +6671,9 @@ void actFireVector(spritetype *pShooter, int a2, int a3, int a4, int a5, int a6,
int nSector = gHitInfo.hitsect;
if (actCanSplatWall(nWall))
{
int x = gHitInfo.hitx - mulscale(a4, 16, 14);
int y = gHitInfo.hity - mulscale(a5, 16, 14);
int z = gHitInfo.hitz - mulscale(a6, 16<<4, 14);
int x = gHitInfo.hitx - MulScale(a4, 16, 14);
int y = gHitInfo.hity - MulScale(a5, 16, 14);
int z = gHitInfo.hitz - MulScale(a6, 16<<4, 14);
int nSurf = surfType[wall[nWall].picnum];
const VECTORDATA *pVectorData = &gVectorData[19];
FX_ID t2 = pVectorData->surfHit[nSurf].fx2;

View file

@ -123,8 +123,8 @@ void cerberusBurnSeqCallback(int, DBloodActor* actor)
}
int tx = x+MulScale(Cos(pSprite->ang), nDist, 30);
int ty = y+MulScale(Sin(pSprite->ang), nDist, 30);
int tz = z+mulscale(actor->dudeSlope, nDist, 10);
int tsr = mulscale(9460, nDist, 10);
int tz = z+MulScale(actor->dudeSlope, nDist, 10);
int tsr = MulScale(9460, nDist, 10);
int top, bottom;
GetSpriteExtents(pSprite2, &top, &bottom);
if (tz-tsr > bottom || tz+tsr < top)
@ -208,8 +208,8 @@ void cerberusBurnSeqCallback2(int, DBloodActor* actor)
}
int tx = x+MulScale(Cos(pSprite->ang), nDist, 30);
int ty = y+MulScale(Sin(pSprite->ang), nDist, 30);
int tz = z+mulscale(actor->dudeSlope, nDist, 10);
int tsr = mulscale(9460, nDist, 10);
int tz = z+MulScale(actor->dudeSlope, nDist, 10);
int tsr = MulScale(9460, nDist, 10);
int top, bottom;
GetSpriteExtents(pSprite2, &top, &bottom);
if (tz-tsr > bottom || tz+tsr < top)

View file

@ -147,8 +147,8 @@ void BlastSSeqCallback(int, DBloodActor* actor)
}
int tx = x+MulScale(Cos(pSprite->ang), nDist, 30);
int ty = y+MulScale(Sin(pSprite->ang), nDist, 30);
int tz = z+mulscale(actor->dudeSlope, nDist, 10);
int tsr = mulscale(9460, nDist, 10);
int tz = z+MulScale(actor->dudeSlope, nDist, 10);
int tsr = MulScale(9460, nDist, 10);
int top, bottom;
GetSpriteExtents(pSprite2, &top, &bottom);
if (tz-tsr > bottom || tz+tsr < top)

View file

@ -130,8 +130,8 @@ void ghostBlastSeqCallback(int, DBloodActor* actor)
}
int tx = x+MulScale(Cos(pSprite->ang), nDist, 30);
int ty = y+MulScale(Sin(pSprite->ang), nDist, 30);
int tz = z+mulscale(actor->dudeSlope, nDist, 10);
int tsr = mulscale(9460, nDist, 10);
int tz = z+MulScale(actor->dudeSlope, nDist, 10);
int tsr = MulScale(9460, nDist, 10);
int top, bottom;
GetSpriteExtents(pSprite2, &top, &bottom);
if (tz-tsr > bottom || tz+tsr < top)

View file

@ -105,8 +105,8 @@ void sub_71BD4(int, DBloodActor* actor)
}
int tx = x+MulScale(Cos(pSprite->ang), nDist, 30);
int ty = y+MulScale(Sin(pSprite->ang), nDist, 30);
int tz = z+mulscale(actor->dudeSlope, nDist, 10);
int tsr = mulscale(9460, nDist, 10);
int tz = z+MulScale(actor->dudeSlope, nDist, 10);
int tsr = MulScale(9460, nDist, 10);
int top, bottom;
GetSpriteExtents(pSprite2, &top, &bottom);
if (tz-tsr > bottom || tz+tsr < top)
@ -184,8 +184,8 @@ void sub_720AC(int, DBloodActor* actor)
}
int tx = x+MulScale(Cos(pSprite->ang), nDist, 30);
int ty = y+MulScale(Sin(pSprite->ang), nDist, 30);
int tz = z+mulscale(actor->dudeSlope, nDist, 10);
int tsr = mulscale(9460, nDist, 10);
int tz = z+MulScale(actor->dudeSlope, nDist, 10);
int tsr = MulScale(9460, nDist, 10);
int top, bottom;
GetSpriteExtents(pSprite2, &top, &bottom);
if (tz-tsr > bottom || tz+tsr < top)

View file

@ -1025,8 +1025,8 @@ void aiGenDudeMoveForward(DBloodActor* actor)
int cos = Cos(pSprite->ang);
int frontSpeed = gGenDudeExtra[pSprite->index].moveSpeed;
xvel[pSprite->index] += mulscale(cos, frontSpeed, 30);
yvel[pSprite->index] += mulscale(sin, frontSpeed, 30);
xvel[pSprite->index] += MulScale(cos, frontSpeed, 30);
yvel[pSprite->index] += MulScale(sin, frontSpeed, 30);
}
}

View file

@ -565,27 +565,27 @@ inline char Chance(int a1)
inline unsigned int Random(int a1)
{
return mulscale(wrand(), a1, 15);
return MulScale(wrand(), a1, 15);
}
inline int Random2(int a1)
{
return mulscale(wrand(), a1, 14)-a1;
return MulScale(wrand(), a1, 14)-a1;
}
inline int Random3(int a1)
{
return mulscale(wrand()+wrand(), a1, 15) - a1;
return MulScale(wrand()+wrand(), a1, 15) - a1;
}
inline unsigned int QRandom(int a1)
{
return mulscale(qrand(), a1, 15);
return MulScale(qrand(), a1, 15);
}
inline int QRandom2(int a1)
{
return mulscale(qrand(), a1, 14)-a1;
return MulScale(qrand(), a1, 14)-a1;
}
template<class T>

View file

@ -1213,8 +1213,8 @@ void debrisMove(int listIndex) {
int nHitSprite = floorHit & 0x3fff;
if ((sprite[nHitSprite].cstat & 0x30) == 0)
{
xvel[nSprite] += mulscale(4, pSprite->x - sprite[nHitSprite].x, 2);
yvel[nSprite] += mulscale(4, pSprite->y - sprite[nHitSprite].y, 2);
xvel[nSprite] += MulScale(4, pSprite->x - sprite[nHitSprite].x, 2);
yvel[nSprite] += MulScale(4, pSprite->y - sprite[nHitSprite].y, 2);
moveHit = gSpriteHit[nXSprite].hit;
}
}
@ -4341,9 +4341,9 @@ void useUniMissileGen(int, int nXSprite) {
if (pXSprite->data2 > 0) {
int velocity = pXSprite->data2 << 12;
xvel[pMissile->index] = mulscale(velocity, dx, 14);
yvel[pMissile->index] = mulscale(velocity, dy, 14);
zvel[pMissile->index] = mulscale(velocity, dz, 14);
xvel[pMissile->index] = MulScale(velocity, dx, 14);
yvel[pMissile->index] = MulScale(velocity, dy, 14);
zvel[pMissile->index] = MulScale(velocity, dz, 14);
}

View file

@ -550,8 +550,8 @@ static void fakeMoveDude(spritetype *pSprite)
int nHitSprite = floorHit & 0x3fff;
if ((sprite[nHitSprite].cstat & 0x30) == 0)
{
predict.at5c += mulscale(4, predict.at50 - sprite[nHitSprite].x, 2);
predict.at60 += mulscale(4, predict.at54 - sprite[nHitSprite].y, 2);
predict.at5c += MulScale(4, predict.at50 - sprite[nHitSprite].x, 2);
predict.at60 += MulScale(4, predict.at54 - sprite[nHitSprite].y, 2);
return;
}
}

View file

@ -204,7 +204,7 @@ void CalcOtherPosition(spritetype *pSprite, int *pX, int *pY, int *pZ, int *vsec
{
int vX = MulScale(-Cos(nAng), 1280, 30);
int vY = MulScale(-Sin(nAng), 1280, 30);
int vZ = FixedToInt(mulscale(zm, 1280, 3))-(16<<8);
int vZ = FixedToInt(MulScale(zm, 1280, 3))-(16<<8);
int bakCstat = pSprite->cstat;
pSprite->cstat &= ~256;
assert(*vsectnum >= 0 && *vsectnum < kMaxSectors);
@ -250,7 +250,7 @@ void CalcPosition(spritetype *pSprite, int *pX, int *pY, int *pZ, int *vsectnum,
{
int vX = MulScale(-Cos(nAng), 1280, 30);
int vY = MulScale(-Sin(nAng), 1280, 30);
int vZ = FixedToInt(mulscale(zm, 1280, 3))-(16<<8);
int vZ = FixedToInt(MulScale(zm, 1280, 3))-(16<<8);
int bakCstat = pSprite->cstat;
pSprite->cstat &= ~256;
assert(*vsectnum >= 0 && *vsectnum < kMaxSectors);
@ -959,7 +959,7 @@ bool GameInterface::DrawAutomapPlayer(int x, int y, int z, int a, double const s
GetZRange(pSprite, &ceilZ, &ceilHit, &floorZ, &floorHit, (pSprite->clipdist << 2) + 16, CLIPMASK0, PARALLAXCLIP_CEILING | PARALLAXCLIP_FLOOR);
int nTop, nBottom;
GetSpriteExtents(pSprite, &nTop, &nBottom);
int nScale = mulscale((pSprite->yrepeat + ((floorZ - nBottom) >> 8)) * z, yxaspect, 16);
int nScale = MulScale((pSprite->yrepeat + ((floorZ - nBottom) >> 8)) * z, yxaspect, 16);
nScale = ClipRange(nScale, 8000, 65536 << 1);
// Players on automap
double x = xdim / 2. + x1 / double(1 << 12);

View file

@ -381,8 +381,8 @@ void UpdateAimVector(PLAYER * pPlayer)
}
int lx = x + MulScale(Cos(pPSprite->ang), nDist, 30);
int ly = y + MulScale(Sin(pPSprite->ang), nDist, 30);
int lz = z + mulscale(pPlayer->slope, nDist, 10);
int zRange = mulscale(9460, nDist, 10);
int lz = z + MulScale(pPlayer->slope, nDist, 10);
int zRange = MulScale(9460, nDist, 10);
int top, bottom;
GetSpriteExtents(pSprite, &top, &bottom);
if (lz-zRange>bottom || lz+zRange<top)
@ -433,7 +433,7 @@ void UpdateAimVector(PLAYER * pPlayer)
continue;
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 lz = z + MulScale(pPlayer->slope, nDist, 10);
int zRange = MulScale(9460, nDist, 10);
int top, bottom;
GetSpriteExtents(pSprite, &top, &bottom);

View file

@ -36,9 +36,6 @@ static inline constexpr int ksgn(int32_t a) { return (a > 0) - (a < 0); }
inline int sgn(int32_t a) { return (a > 0) - (a < 0); }
static inline int32_t mulscale(int32_t eax, int32_t edx, int32_t ecx) { return dw((qw(eax) * edx) >> by(ecx)); }
static inline double fmulscale(double eax, double edx, int32_t ecx) { return (eax * edx) / (double)(qw(1) << ecx); }
static inline int32_t krecipasm(int32_t i)
{
// Ken did this

View file

@ -1802,8 +1802,8 @@ void renderDrawMapView(int32_t dax, int32_t day, int32_t zoome, int16_t ang)
if ((1 << ox) != xspan)
{
ox++;
globalx1 = mulscale(globalx1,xspan,ox);
globaly1 = mulscale(globaly1,xspan,ox);
globalx1 = MulScale(globalx1,xspan,ox);
globaly1 = MulScale(globaly1,xspan,ox);
}
bak.x = (bak.x>>4)-(xdim<<7); bak.y = (bak.y>>4)-(ydim<<7);

View file

@ -91,7 +91,7 @@ bool GameInterface::DrawAutomapPlayer(int x, int y, int z, int a, double const s
getzrange_old(pSprite->x, pSprite->y, pSprite->z, pSprite->sectnum, &ceilZ, &ceilHit, &floorZ, &floorHit, (pSprite->clipdist << 2) + 16, CLIPMASK0);
int nTop, nBottom;
GetSpriteExtents(pSprite, &nTop, &nBottom);
int nScale = mulscale((pSprite->yrepeat + ((floorZ - nBottom) >> 8)) * z, yxaspect, 16);
int nScale = MulScale((pSprite->yrepeat + ((floorZ - nBottom) >> 8)) * z, yxaspect, 16);
nScale = clamp(nScale, 8000, 65536 << 1);
// Players on automap
double x = xdim / 2. + x1 / double(1 << 12);

View file

@ -3951,8 +3951,8 @@ void move_d(DDukeActor *actor, int playernum, int xvel)
}
else
{
ps[playernum].posxv = mulscale(ps[playernum].posxv, gs.playerfriction - 0x2000, 16);
ps[playernum].posyv = mulscale(ps[playernum].posyv, gs.playerfriction - 0x2000, 16);
ps[playernum].posxv = MulScale(ps[playernum].posxv, gs.playerfriction - 0x2000, 16);
ps[playernum].posyv = MulScale(ps[playernum].posyv, gs.playerfriction - 0x2000, 16);
}
}
else if (spr->picnum != DRONE && spr->picnum != SHARK && spr->picnum != COMMANDER)

View file

@ -3916,8 +3916,8 @@ void move_r(DDukeActor *actor, int pnum, int xvel)
}
else
{
ps[pnum].posxv = mulscale(ps[pnum].posxv, gs.playerfriction - 0x2000, 16);
ps[pnum].posyv = mulscale(ps[pnum].posyv, gs.playerfriction - 0x2000, 16);
ps[pnum].posxv = MulScale(ps[pnum].posxv, gs.playerfriction - 0x2000, 16);
ps[pnum].posyv = MulScale(ps[pnum].posyv, gs.playerfriction - 0x2000, 16);
}
}
else if ((isRRRA() && spr->picnum != DRONE && spr->picnum != SHARK && spr->picnum != UFO1_RRRA) ||

View file

@ -572,7 +572,7 @@ bool GameInterface::DrawAutomapPlayer(int cposx, int cposy, int czoom, int cang,
i = TILE_APLAYERTOP;
j = klabs(pp.truefz - pp.posz) >> 8;
j = mulscale(czoom * (pspr->yrepeat + j), yxaspect, 16);
j = MulScale(czoom * (pspr->yrepeat + j), yxaspect, 16);
if (j < 22000) j = 22000;
else if (j > (65536 << 1)) j = (65536 << 1);

View file

@ -3161,7 +3161,7 @@ int ParseState::parse(void)
int i;
insptr++;
i = *(insptr++); // ID of def
SetGameVarID(i, mulscale(rand(), *insptr, 15), g_ac, g_p);
SetGameVarID(i, MulScale(rand(), *insptr, 15), g_ac, g_p);
insptr++;
break;
}
@ -3252,7 +3252,7 @@ int ParseState::parse(void)
i = *(insptr++); // ID of def
l1 = GetGameVarID(i, g_ac, g_p); // not used for this command
l2 = GetGameVarID(*insptr, g_ac, g_p);
lResult = mulscale(rand(), l2, 15);
lResult = MulScale(rand(), l2, 15);
SetGameVarID(i, lResult, g_ac, g_p);
insptr++;
break;

View file

@ -332,7 +332,7 @@ DDukeActor* aim(DDukeActor* actor, int aang)
if ((dy1 * xv) <= (dx1 * yv))
if ((dy2 * xv) >= (dx2 * yv))
{
sdist = mulscale(dx3, xv, 14) + mulscale(dy3, yv, 14);
sdist = MulScale(dx3, xv, 14) + MulScale(dy3, yv, 14);
if (sdist > 512 && sdist < smax)
{
if (s->picnum == TILE_APLAYER)

View file

@ -885,7 +885,7 @@ static void shootlaser(DDukeActor* actor, int p, int sx, int sy, int sz, int sa)
int lLifetimeVar = GetGameVar("STICKYBOMB_LIFETIME_VAR", NAM_GRENADE_LIFETIME_VAR, nullptr, p);
// set timer. blows up when at zero....
bomb->s.extra = lLifetime
+ mulscale(krand(), lLifetimeVar, 14)
+ MulScale(krand(), lLifetimeVar, 14)
- lLifetimeVar;
}
}
@ -2210,7 +2210,7 @@ static void operateweapon(int snum, ESyncBits actions, int psect)
if (isNam())
{
spawned->s.extra = mulscale(krand(), NAM_GRENADE_LIFETIME_VAR, 14);
spawned->s.extra = MulScale(krand(), NAM_GRENADE_LIFETIME_VAR, 14);
}
if (k == 15)
@ -2999,20 +2999,20 @@ void processinput_d(int snum)
else check = ((aplWeaponWorksLike[p->curr_weapon][snum] == KNEE_WEAPON && p->kickback_pic > 10 && p->on_ground) || (p->on_ground && (actions & SB_CROUCH)));
if (check)
{
p->posxv = mulscale(p->posxv, gs.playerfriction - 0x2000, 16);
p->posyv = mulscale(p->posyv, gs.playerfriction - 0x2000, 16);
p->posxv = MulScale(p->posxv, gs.playerfriction - 0x2000, 16);
p->posyv = MulScale(p->posyv, gs.playerfriction - 0x2000, 16);
}
else
{
if (psectlotag == 2)
{
p->posxv = mulscale(p->posxv, gs.playerfriction - 0x1400, 16);
p->posyv = mulscale(p->posyv, gs.playerfriction - 0x1400, 16);
p->posxv = MulScale(p->posxv, gs.playerfriction - 0x1400, 16);
p->posyv = MulScale(p->posyv, gs.playerfriction - 0x1400, 16);
}
else
{
p->posxv = mulscale(p->posxv, gs.playerfriction, 16);
p->posyv = mulscale(p->posyv, gs.playerfriction, 16);
p->posxv = MulScale(p->posxv, gs.playerfriction, 16);
p->posyv = MulScale(p->posyv, gs.playerfriction, 16);
}
}

View file

@ -3717,20 +3717,20 @@ void processinput_r(int snum)
if (!isRRRA() && ((p->curr_weapon == KNEE_WEAPON && p->kickback_pic > 10 && p->on_ground) || (p->on_ground && (actions & SB_CROUCH))))
{
p->posxv = mulscale(p->posxv, gs.playerfriction - 0x2000, 16);
p->posyv = mulscale(p->posyv, gs.playerfriction - 0x2000, 16);
p->posxv = MulScale(p->posxv, gs.playerfriction - 0x2000, 16);
p->posyv = MulScale(p->posyv, gs.playerfriction - 0x2000, 16);
}
else
{
if (psectlotag == 2)
{
p->posxv = mulscale(p->posxv, gs.playerfriction - 0x1400, 16);
p->posyv = mulscale(p->posyv, gs.playerfriction - 0x1400, 16);
p->posxv = MulScale(p->posxv, gs.playerfriction - 0x1400, 16);
p->posyv = MulScale(p->posyv, gs.playerfriction - 0x1400, 16);
}
else
{
p->posxv = mulscale(p->posxv, gs.playerfriction, 16);
p->posyv = mulscale(p->posyv, gs.playerfriction, 16);
p->posxv = MulScale(p->posxv, gs.playerfriction, 16);
p->posyv = MulScale(p->posyv, gs.playerfriction, 16);
}
}
@ -3751,8 +3751,8 @@ void processinput_r(int snum)
p->boot_amount--;
else
{
p->posxv = mulscale(p->posxv, gs.playerfriction, 16);
p->posyv = mulscale(p->posyv, gs.playerfriction, 16);
p->posxv = MulScale(p->posxv, gs.playerfriction, 16);
p->posyv = MulScale(p->posyv, gs.playerfriction, 16);
}
}
else
@ -3763,8 +3763,8 @@ void processinput_r(int snum)
{
if (p->on_ground)
{
p->posxv = mulscale(p->posxv, gs.playerfriction - 0x1800, 16);
p->posyv = mulscale(p->posyv, gs.playerfriction - 0x1800, 16);
p->posxv = MulScale(p->posxv, gs.playerfriction - 0x1800, 16);
p->posyv = MulScale(p->posyv, gs.playerfriction - 0x1800, 16);
}
}
else
@ -3772,8 +3772,8 @@ void processinput_r(int snum)
p->boot_amount--;
else
{
p->posxv = mulscale(p->posxv, gs.playerfriction - 0x1800, 16);
p->posyv = mulscale(p->posyv, gs.playerfriction - 0x1800, 16);
p->posxv = MulScale(p->posxv, gs.playerfriction - 0x1800, 16);
p->posyv = MulScale(p->posyv, gs.playerfriction - 0x1800, 16);
}
}

View file

@ -352,7 +352,7 @@ void operateweapon_ww(int snum, ESyncBits actions, int psect)
int lGrenadeLifetimeVar = GetGameVar("GRENADE_LIFETIME_VAR", NAM_GRENADE_LIFETIME_VAR, nullptr, snum);
// set timer. blows up when at zero....
j->s.extra = lGrenadeLifetime
+ mulscale(krand(), lGrenadeLifetimeVar, 14)
+ MulScale(krand(), lGrenadeLifetimeVar, 14)
- lGrenadeLifetimeVar;
}

View file

@ -1660,8 +1660,8 @@ void SlipSlope(PLAYERp pp)
ang = NORM_ANGLE(ang + 512);
pp->xvect += mulscale(bcos(ang), sector[pp->cursectnum].floorheinum, sectu->speed);
pp->yvect += mulscale(bsin(ang), sector[pp->cursectnum].floorheinum, sectu->speed);
pp->xvect += MulScale(bcos(ang), sector[pp->cursectnum].floorheinum, sectu->speed);
pp->yvect += MulScale(bsin(ang), sector[pp->cursectnum].floorheinum, sectu->speed);
}
void