mirror of
https://github.com/DrBeef/Raze.git
synced 2024-11-15 08:52:00 +00:00
- Rename interpolatedvalue()
in preparation for replacement.
This commit is contained in:
parent
8fd6452baf
commit
06e772b44b
12 changed files with 42 additions and 42 deletions
|
@ -37,12 +37,12 @@
|
|||
|
||||
#include "fixedhorizon.h"
|
||||
|
||||
inline constexpr int32_t interpolatedvalue(int32_t oval, int32_t val, double const smoothratio, int const scale = 16)
|
||||
inline constexpr int32_t __interpvalue(int32_t oval, int32_t val, double const smoothratio, int const scale = 16)
|
||||
{
|
||||
return oval + MulScale(val - oval, int(smoothratio), scale);
|
||||
}
|
||||
|
||||
inline constexpr int32_t interpolatedvalue(int32_t oval, int32_t val, int const smoothratio, int const scale = 16)
|
||||
inline constexpr int32_t __interpvalue(int32_t oval, int32_t val, int const smoothratio, int const scale = 16)
|
||||
{
|
||||
return oval + MulScale(val - oval, smoothratio, scale);
|
||||
}
|
||||
|
|
|
@ -1863,14 +1863,14 @@ void playerProcess(PLAYER* pPlayer)
|
|||
}
|
||||
ProcessInput(pPlayer);
|
||||
int nSpeed = approxDist(actor->int_vel().X, actor->int_vel().Y);
|
||||
pPlayer->zViewVel = interpolatedvalue(pPlayer->zViewVel, actor->int_vel().Z, 0x7000);
|
||||
pPlayer->zViewVel = __interpvalue(pPlayer->zViewVel, actor->int_vel().Z, 0x7000);
|
||||
int dz = pPlayer->actor->int_pos().Z - pPosture->eyeAboveZ - pPlayer->zView;
|
||||
if (dz > 0)
|
||||
pPlayer->zViewVel += MulScale(dz << 8, 0xa000, 16);
|
||||
else
|
||||
pPlayer->zViewVel += MulScale(dz << 8, 0x1800, 16);
|
||||
pPlayer->zView += pPlayer->zViewVel >> 8;
|
||||
pPlayer->zWeaponVel = interpolatedvalue(pPlayer->zWeaponVel, actor->int_vel().Z, 0x5000);
|
||||
pPlayer->zWeaponVel = __interpvalue(pPlayer->zWeaponVel, actor->int_vel().Z, 0x5000);
|
||||
dz = pPlayer->actor->int_pos().Z - pPosture->weaponAboveZ - pPlayer->zWeapon;
|
||||
if (dz > 0)
|
||||
pPlayer->zWeaponVel += MulScale(dz << 8, 0x8000, 16);
|
||||
|
|
|
@ -287,7 +287,7 @@ void fakePlayerProcess(PLAYER* pPlayer, InputPacket* pInput)
|
|||
|
||||
int nSpeed = approxDist(predict.xvel, predict.yvel);
|
||||
|
||||
predict.at3c = interpolatedvalue(predict.at3c, predict.zvel, 0x7000);
|
||||
predict.at3c = __interpvalue(predict.at3c, predict.zvel, 0x7000);
|
||||
int dz = predict.z - pPosture->eyeAboveZ - predict.viewz;
|
||||
if (dz > 0)
|
||||
predict.at3c += MulScale(dz << 8, 0xa000, 16);
|
||||
|
@ -295,7 +295,7 @@ void fakePlayerProcess(PLAYER* pPlayer, InputPacket* pInput)
|
|||
predict.at3c += MulScale(dz << 8, 0x1800, 16);
|
||||
predict.viewz += predict.at3c >> 8;
|
||||
|
||||
predict.at44 = interpolatedvalue(predict.at44, predict.zvel, 0x5000);
|
||||
predict.at44 = __interpvalue(predict.at44, predict.zvel, 0x5000);
|
||||
dz = predict.z - pPosture->weaponAboveZ - predict.at40;
|
||||
if (dz > 0)
|
||||
predict.at44 += MulScale(dz << 8, 0x8000, 16);
|
||||
|
|
|
@ -199,7 +199,7 @@ void QAV::Draw(double x, double y, int ticks, int stat, int shade, int palnum, b
|
|||
tileY += __interpvaluef(prevTile->y, thisTile->y, smoothratio);
|
||||
tileZ = __interpvaluef(prevTile->z, thisTile->z, smoothratio);
|
||||
tileA = interpolatedangle(DAngle::fromBuild(prevTile->angle), DAngle::fromBuild(thisTile->angle), smoothratio * (1. / MaxSmoothRatio)).Buildfang();
|
||||
tileShade = interpolatedvalue(prevTile->shade, thisTile->shade, smoothratio) + shade;
|
||||
tileShade = __interpvalue(prevTile->shade, thisTile->shade, smoothratio) + shade;
|
||||
auto prevAlpha = ((stat | prevTile->stat) & RS_TRANS1) ? glblend[0].def[!!((stat | prevTile->stat) & RS_TRANS2)].alpha : 1.;
|
||||
auto thisAlpha = (tileStat & RS_TRANS1) ? glblend[0].def[!!(tileStat & RS_TRANS2)].alpha : 1.;
|
||||
tileAlpha = __interpvaluef(prevAlpha, thisAlpha, smoothratio);
|
||||
|
|
|
@ -842,14 +842,14 @@ void PathSound(sectortype* pSector, int nSound)
|
|||
void TranslateSector(sectortype* pSector, int a2, int a3, int a4, int a5, int a6, int a7, int a8, int a9, int a10, int a11, bool bAllWalls)
|
||||
{
|
||||
XSECTOR* pXSector = &pSector->xs();
|
||||
int v20 = interpolatedvalue(a6, a9, a2);
|
||||
int vc = interpolatedvalue(a6, a9, a3);
|
||||
int v20 = __interpvalue(a6, a9, a2);
|
||||
int vc = __interpvalue(a6, a9, a3);
|
||||
int v28 = vc - v20;
|
||||
int v24 = interpolatedvalue(a7, a10, a2);
|
||||
int v8 = interpolatedvalue(a7, a10, a3);
|
||||
int v24 = __interpvalue(a7, a10, a2);
|
||||
int v8 = __interpvalue(a7, a10, a3);
|
||||
int v2c = v8 - v24;
|
||||
int v44 = interpolatedvalue(a8, a11, a2);
|
||||
int ang = interpolatedvalue(a8, a11, a3);
|
||||
int v44 = __interpvalue(a8, a11, a2);
|
||||
int ang = __interpvalue(a8, a11, a3);
|
||||
int v14 = ang - v44;
|
||||
|
||||
DVector2 pivot = { a4 * inttoworld, a5 * inttoworld };
|
||||
|
|
|
@ -472,7 +472,7 @@ static void DrawMap(DBloodActor* view)
|
|||
tm = 1;
|
||||
}
|
||||
VIEW* pView = &gPrevView[gViewIndex];
|
||||
auto xy = DVector2(interpolatedvalue(pView->x, view->int_pos().X, gInterpolate), interpolatedvalue(pView->y, view->int_pos().Y, gInterpolate)) * inttoworld;
|
||||
auto xy = DVector2(__interpvalue(pView->x, view->int_pos().X, gInterpolate), __interpvalue(pView->y, view->int_pos().Y, gInterpolate))* inttoworld;
|
||||
auto ang = !SyncInput() ? gView->angle.sum() : gView->angle.interpolatedsum(gInterpolate * (1. / MaxSmoothRatio));
|
||||
DrawOverheadMap(xy, ang, gInterpolate);
|
||||
if (tm)
|
||||
|
@ -494,12 +494,12 @@ void SetupView(int& cX, int& cY, int& cZ, DAngle& cA, fixedhoriz& cH, sectortype
|
|||
if (numplayers > 1 && gView == gMe && gPrediction && gMe->actor->xspr.health > 0)
|
||||
{
|
||||
nSectnum = predict.sectnum;
|
||||
cX = interpolatedvalue(predictOld.x, predict.x, gInterpolate);
|
||||
cY = interpolatedvalue(predictOld.y, predict.y, gInterpolate);
|
||||
cZ = interpolatedvalue(predictOld.viewz, predict.viewz, gInterpolate);
|
||||
cX = __interpvalue(predictOld.x, predict.x, gInterpolate);
|
||||
cY = __interpvalue(predictOld.y, predict.y, gInterpolate);
|
||||
cZ = __interpvalue(predictOld.viewz, predict.viewz, gInterpolate);
|
||||
zDelta = __interpvaluef(predictOld.weaponZ, predict.weaponZ, gInterpolate);
|
||||
bobWidth = interpolatedvalue(predictOld.bobWidth, predict.bobWidth, gInterpolate);
|
||||
bobHeight = interpolatedvalue(predictOld.bobHeight, predict.bobHeight, gInterpolate);
|
||||
bobWidth = __interpvalue(predictOld.bobWidth, predict.bobWidth, gInterpolate);
|
||||
bobHeight = __interpvalue(predictOld.bobHeight, predict.bobHeight, gInterpolate);
|
||||
shakeX = __interpvaluef(predictOld.shakeBobX, predict.shakeBobX, gInterpolate);
|
||||
shakeY = __interpvaluef(predictOld.shakeBobY, predict.shakeBobY, gInterpolate);
|
||||
|
||||
|
@ -520,12 +520,12 @@ void SetupView(int& cX, int& cY, int& cZ, DAngle& cA, fixedhoriz& cH, sectortype
|
|||
#endif
|
||||
{
|
||||
VIEW* pView = &gPrevView[gViewIndex];
|
||||
cX = interpolatedvalue(pView->x, gView->actor->int_pos().X, gInterpolate);
|
||||
cY = interpolatedvalue(pView->y, gView->actor->int_pos().Y, gInterpolate);
|
||||
cZ = interpolatedvalue(pView->viewz, gView->zView, gInterpolate);
|
||||
cX = __interpvalue(pView->x, gView->actor->int_pos().X, gInterpolate);
|
||||
cY = __interpvalue(pView->y, gView->actor->int_pos().Y, gInterpolate);
|
||||
cZ = __interpvalue(pView->viewz, gView->zView, gInterpolate);
|
||||
zDelta = __interpvaluef(pView->weaponZ, gView->zWeapon - gView->zView - (12 << 8), gInterpolate);
|
||||
bobWidth = interpolatedvalue(pView->bobWidth, gView->bobWidth, gInterpolate);
|
||||
bobHeight = interpolatedvalue(pView->bobHeight, gView->bobHeight, gInterpolate);
|
||||
bobWidth = __interpvalue(pView->bobWidth, gView->bobWidth, gInterpolate);
|
||||
bobHeight = __interpvalue(pView->bobHeight, gView->bobHeight, gInterpolate);
|
||||
shakeX = __interpvaluef(pView->shakeBobX, gView->swayWidth, gInterpolate);
|
||||
shakeY = __interpvaluef(pView->shakeBobY, gView->swayHeight, gInterpolate);
|
||||
|
||||
|
|
|
@ -546,9 +546,9 @@ void UpdateAimVector(PLAYER* pPlayer)
|
|||
aim2 = aim;
|
||||
RotateVector((int*)&aim2.dx, (int*)&aim2.dy, -plActor->int_ang());
|
||||
aim2.dz -= pPlayer->slope;
|
||||
pPlayer->relAim.dx = interpolatedvalue(pPlayer->relAim.dx, aim2.dx, pWeaponTrack->aimSpeedHorz);
|
||||
pPlayer->relAim.dy = interpolatedvalue(pPlayer->relAim.dy, aim2.dy, pWeaponTrack->aimSpeedHorz);
|
||||
pPlayer->relAim.dz = interpolatedvalue(pPlayer->relAim.dz, aim2.dz, pWeaponTrack->aimSpeedVert);
|
||||
pPlayer->relAim.dx = __interpvalue(pPlayer->relAim.dx, aim2.dx, pWeaponTrack->aimSpeedHorz);
|
||||
pPlayer->relAim.dy = __interpvalue(pPlayer->relAim.dy, aim2.dy, pWeaponTrack->aimSpeedHorz);
|
||||
pPlayer->relAim.dz = __interpvalue(pPlayer->relAim.dz, aim2.dz, pWeaponTrack->aimSpeedVert);
|
||||
pPlayer->aim = pPlayer->relAim;
|
||||
RotateVector((int*)&pPlayer->aim.dx, (int*)&pPlayer->aim.dy, plActor->int_ang());
|
||||
pPlayer->aim.dz += pPlayer->slope;
|
||||
|
|
|
@ -307,9 +307,9 @@ void animatesprites_d(tspriteArray& tsprites, int x, int y, int a, int smoothrat
|
|||
#if 0 // multiplayer only
|
||||
if (screenpeek == myconnectindex && numplayers >= 2)
|
||||
{
|
||||
t->x = interpolatedvalue(omyx, myx, smoothratio);
|
||||
t->y = interpolatedvalue(omyy, myy, smoothratio);
|
||||
t->z = interpolatedvalue(omyz, myz, smoothratio) + gs_playerheight;
|
||||
t->x = __interpvalue(omyx, myx, smoothratio);
|
||||
t->y = __interpvalue(omyy, myy, smoothratio);
|
||||
t->z = __interpvalue(omyz, myz, smoothratio) + gs_playerheight;
|
||||
t->ang = interpolatedangle(omyang, myang, smoothratio * (1. / MaxSmoothRatio)).asbuild();
|
||||
t->sector = mycursectnum;
|
||||
}
|
||||
|
|
|
@ -349,9 +349,9 @@ void animatesprites_r(tspriteArray& tsprites, int x, int y, int a, int smoothrat
|
|||
#if 0 // multiplayer only
|
||||
if (screenpeek == myconnectindex && numplayers >= 2)
|
||||
{
|
||||
t->x = interpolatedvalue(omyx, myx, smoothratio);
|
||||
t->y = interpolatedvalue(omyy, myy, smoothratio);
|
||||
t->z = interpolatedvalue(omyz, myz, smoothratio) + gs.playerheight;
|
||||
t->x = __interpvalue(omyx, myx, smoothratio);
|
||||
t->y = __interpvalue(omyy, myy, smoothratio);
|
||||
t->z = __interpvalue(omyz, myz, smoothratio) + gs.playerheight;
|
||||
t->ang = interpolatedangle(omyang, myang, smoothratio * (1. / MaxSmoothRatio)).asbuild();
|
||||
t->sector = mycursectnum;
|
||||
}
|
||||
|
|
|
@ -266,7 +266,7 @@ void drawoverlays(double smoothratio)
|
|||
{
|
||||
if (screenpeek == myconnectindex && numplayers > 1)
|
||||
{
|
||||
cposxy = DVector2(interpolatedvalue(omyx, myx, smoothratio), interpolatedvalue(omyy, myy, smoothratio)) * inttoworld;
|
||||
cposxy = DVector2(__interpvalue(omyx, myx, smoothratio), __interpvalue(omyy, myy, smoothratio)) * inttoworld;
|
||||
cang = !SyncInput() ? myang : interpolatedangle(omyang, myang, smoothratio * (1. / MaxSmoothRatio));
|
||||
}
|
||||
else
|
||||
|
|
|
@ -286,9 +286,9 @@ void displayrooms(int snum, double smoothratio, bool sceneonly)
|
|||
#if 0
|
||||
if ((snum == myconnectindex) && (numplayers > 1))
|
||||
{
|
||||
cposx = interpolatedvalue(omyx, myx, smoothratio);
|
||||
cposy = interpolatedvalue(omyy, myy, smoothratio);
|
||||
cposz = interpolatedvalue(omyz, myz, smoothratio);
|
||||
cposx = __interpvalue(omyx, myx, smoothratio);
|
||||
cposy = __interpvalue(omyy, myy, smoothratio);
|
||||
cposz = __interpvalue(omyz, myz, smoothratio);
|
||||
if (SyncInput())
|
||||
{
|
||||
choriz = interpolatedhorizon(omyhoriz + omyhorizoff, myhoriz + myhorizoff, smoothratio);
|
||||
|
@ -304,9 +304,9 @@ void displayrooms(int snum, double smoothratio, bool sceneonly)
|
|||
else
|
||||
#endif
|
||||
{
|
||||
cposx = interpolatedvalue(p->player_int_opos().X, p->player_int_pos().X, smoothratio);
|
||||
cposy = interpolatedvalue(p->player_int_opos().Y, p->player_int_pos().Y, smoothratio);
|
||||
cposz = interpolatedvalue(p->player_int_opos().Z, p->player_int_pos().Z, smoothratio);;
|
||||
cposx = __interpvalue(p->player_int_opos().X, p->player_int_pos().X, smoothratio);
|
||||
cposy = __interpvalue(p->player_int_opos().Y, p->player_int_pos().Y, smoothratio);
|
||||
cposz = __interpvalue(p->player_int_opos().Z, p->player_int_pos().Z, smoothratio);;
|
||||
if (SyncInput())
|
||||
{
|
||||
// Original code for when the values are passed through the sync struct
|
||||
|
|
|
@ -1465,11 +1465,11 @@ void drawscreen(PLAYER* pp, double smoothratio, bool sceneonly)
|
|||
if (cl_viewbob)
|
||||
{
|
||||
tz += bobamt;
|
||||
tz += interpolatedvalue(pp->obob_z, pp->bob_z, smoothratio) * zworldtoint;
|
||||
tz += __interpvalue(pp->obob_z, pp->bob_z, smoothratio) * zworldtoint;
|
||||
}
|
||||
|
||||
// recoil only when not in camera
|
||||
thoriz = q16horiz(clamp(thoriz.asq16() + interpolatedvalue(pp->recoil_ohorizoff, pp->recoil_horizoff, smoothratio), gi->playerHorizMin(), gi->playerHorizMax()));
|
||||
thoriz = q16horiz(clamp(thoriz.asq16() + __interpvalue(pp->recoil_ohorizoff, pp->recoil_horizoff, smoothratio), gi->playerHorizMin(), gi->playerHorizMax()));
|
||||
}
|
||||
|
||||
if (automapMode != am_full)
|
||||
|
|
Loading…
Reference in a new issue