mirror of
https://github.com/DrBeef/Raze.git
synced 2025-02-20 18:52:43 +00:00
- Blood: Replace game-side scale()
with backend Scale()
.
This commit is contained in:
parent
4db3e91f24
commit
5badbd7884
6 changed files with 14 additions and 20 deletions
|
@ -2545,7 +2545,7 @@ static void ConcussSprite(DBloodActor* source, DBloodActor* actor, int x, int y,
|
|||
int dz = (actor->spr.pos.Z - z) >> 4;
|
||||
int dist2 = 0x40000 + dx * dx + dy * dy + dz * dz;
|
||||
assert(dist2 > 0);
|
||||
damage = scale(0x40000, damage, dist2);
|
||||
damage = Scale(0x40000, damage, dist2);
|
||||
|
||||
if (actor->spr.flags & kPhysMove)
|
||||
{
|
||||
|
@ -2573,7 +2573,7 @@ static void ConcussSprite(DBloodActor* source, DBloodActor* actor, int x, int y,
|
|||
if (mass > 0)
|
||||
{
|
||||
int size = (tileWidth(actor->spr.picnum) * actor->spr.xrepeat * tileHeight(actor->spr.picnum) * actor->spr.yrepeat) >> 1;
|
||||
int t = scale(damage, size, mass);
|
||||
int t = Scale(damage, size, mass);
|
||||
actor->xvel += MulScale(t, dx, 16);
|
||||
actor->yvel += MulScale(t, dy, 16);
|
||||
actor->zvel += MulScale(t, dz, 16);
|
||||
|
@ -4130,7 +4130,7 @@ static void actTouchFloor(DBloodActor* actor, sectortype* pSector)
|
|||
if (pXSector->data) nDamage = ClipRange(pXSector->data, 0, 1000);
|
||||
else nDamage = 1000;
|
||||
|
||||
actDamageSprite(actor, actor, nDamageType, scale(4, nDamage, 120) << 4);
|
||||
actDamageSprite(actor, actor, nDamageType, Scale(4, nDamage, 120) << 4);
|
||||
}
|
||||
if (tileGetSurfType(pSector->floorpicnum) == kSurfLava)
|
||||
{
|
||||
|
@ -5200,7 +5200,7 @@ void MoveDude(DBloodActor* actor)
|
|||
return;
|
||||
int nDrag = gDudeDrag;
|
||||
if (actor->xspr.height > 0)
|
||||
nDrag -= scale(gDudeDrag, actor->xspr.height, 0x100);
|
||||
nDrag -= Scale(gDudeDrag, actor->xspr.height, 0x100);
|
||||
actor->xvel -= mulscale16r(actor->xvel, nDrag);
|
||||
actor->yvel -= mulscale16r(actor->yvel, nDrag);
|
||||
|
||||
|
@ -5318,7 +5318,7 @@ int MoveMissile(DBloodActor* actor)
|
|||
pos.X -= MulScale(Cos(nAngle), 16, 30);
|
||||
pos.Y -= MulScale(Sin(nAngle), 16, 30);
|
||||
int nVel = approxDist(actor->xvel, actor->yvel);
|
||||
vz -= scale(0x100, actor->zvel, nVel);
|
||||
vz -= Scale(0x100, actor->zvel, nVel);
|
||||
updatesector(pos.X, pos.Y, &pSector);
|
||||
pSector2 = pSector;
|
||||
}
|
||||
|
|
|
@ -560,12 +560,6 @@ inline int QRandom2(int a1)
|
|||
return MulScale(qrand(), a1, 14) - a1;
|
||||
}
|
||||
|
||||
// This is to override the namepace prioritization without altering the actual calls.
|
||||
inline int scale(int a, int b, int c)
|
||||
{
|
||||
return ::Scale(a, b, c);
|
||||
}
|
||||
|
||||
inline int scale(int a1, int a2, int a3, int a4, int a5)
|
||||
{
|
||||
return a4 + (a5 - a4) * (a1 - a2) / (a3 - a2);
|
||||
|
|
|
@ -99,7 +99,7 @@ void CGameMenuItemQAV::Draw(void)
|
|||
|
||||
if (bWideScreen)
|
||||
{
|
||||
int xdim43 = scale(ydim, 4, 3);
|
||||
int xdim43 = Scale(ydim, 4, 3);
|
||||
int nCount = (twod->GetWidth() + xdim43 - 1) / xdim43;
|
||||
int backX = data->x;
|
||||
for (int i = 0; i < nCount; i++)
|
||||
|
|
|
@ -476,7 +476,7 @@ int VectorScan(DBloodActor* actor, int nOffset, int nZOffset, int dx, int dy, in
|
|||
if (nTopOfs)
|
||||
otherZ -= (nTopOfs * other->spr.yrepeat) << 2;
|
||||
assert(height > 0);
|
||||
int height2 = scale(otherZ - gHitInfo.hitpos.Z, tileHeight(nPicnum), height);
|
||||
int height2 = Scale(otherZ - gHitInfo.hitpos.Z, tileHeight(nPicnum), height);
|
||||
if (!(other->spr.cstat & CSTAT_SPRITE_YFLIP))
|
||||
height2 = tileHeight(nPicnum) - height2;
|
||||
if (height2 >= 0 && height2 < tileHeight(nPicnum))
|
||||
|
@ -485,7 +485,7 @@ int VectorScan(DBloodActor* actor, int nOffset, int nZOffset, int dx, int dy, in
|
|||
width = (width * 3) / 4;
|
||||
int check1 = ((y1 - other->spr.pos.Y) * dx - (x1 - other->spr.pos.X) * dy) / ksqrt(dx * dx + dy * dy);
|
||||
assert(width > 0);
|
||||
int width2 = scale(check1, tileWidth(nPicnum), width);
|
||||
int width2 = Scale(check1, tileWidth(nPicnum), width);
|
||||
int nLeftOfs = tileLeftOffset(nPicnum);
|
||||
width2 += nLeftOfs + tileWidth(nPicnum) / 2;
|
||||
if (width2 >= 0 && width2 < tileWidth(nPicnum))
|
||||
|
@ -724,8 +724,8 @@ int GetDistToLine(int x1, int y1, int x2, int y2, int x3, int y3)
|
|||
}
|
||||
else if (vv > v8)
|
||||
{
|
||||
t1 = x2 + scale(x3 - x2, v8, vv);
|
||||
t2 = y2 + scale(y3 - y2, v8, vv);
|
||||
t1 = x2 + Scale(x3 - x2, v8, vv);
|
||||
t2 = y2 + Scale(y3 - y2, v8, vv);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
@ -92,7 +92,7 @@ static void viewBurnTime(int gScale)
|
|||
int nScale = burnTable[i].nScale;
|
||||
if (gScale < 600)
|
||||
{
|
||||
nScale = scale(nScale, gScale, 600);
|
||||
nScale = Scale(nScale, gScale, 600);
|
||||
}
|
||||
drawElement(burnTable[i].nX, burnTable[i].nY, nTile, nScale / 65536.);
|
||||
}
|
||||
|
|
|
@ -1551,14 +1551,14 @@ void debrisConcuss(DBloodActor* owneractor, int listIndex, int x, int y, int z,
|
|||
if (actor != nullptr && actor->hasX())
|
||||
{
|
||||
int dx = actor->spr.pos.X - x; int dy = actor->spr.pos.Y - y; int dz = (actor->spr.pos.Z - z) >> 4;
|
||||
dmg = scale(0x40000, dmg, 0x40000 + dx * dx + dy * dy + dz * dz);
|
||||
dmg = Scale(0x40000, dmg, 0x40000 + dx * dx + dy * dy + dz * dz);
|
||||
bool thing = (actor->spr.type >= kThingBase && actor->spr.type < kThingMax);
|
||||
int size = (tileWidth(actor->spr.picnum) * actor->spr.xrepeat * tileHeight(actor->spr.picnum) * actor->spr.yrepeat) >> 1;
|
||||
if (actor->xspr.physAttr & kPhysDebrisExplode)
|
||||
{
|
||||
if (actor->spriteMass.mass > 0)
|
||||
{
|
||||
int t = scale(dmg, size, actor->spriteMass.mass);
|
||||
int t = Scale(dmg, size, actor->spriteMass.mass);
|
||||
|
||||
actor->xvel += MulScale(t, dx, 16);
|
||||
actor->yvel += MulScale(t, dy, 16);
|
||||
|
@ -1843,7 +1843,7 @@ void debrisMove(int listIndex)
|
|||
|
||||
int nDrag = 0x2a00;
|
||||
if (actor->xspr.height > 0)
|
||||
nDrag -= scale(nDrag, actor->xspr.height, 0x100);
|
||||
nDrag -= Scale(nDrag, actor->xspr.height, 0x100);
|
||||
|
||||
actor->xvel -= mulscale16r(actor->xvel, nDrag);
|
||||
actor->yvel -= mulscale16r(actor->yvel, nDrag);
|
||||
|
|
Loading…
Reference in a new issue