- renamed interpolate functions as preparation for floatifying opos.

This commit is contained in:
Christoph Oelckers 2022-02-03 21:58:28 +01:00
parent 403e1ad3b3
commit 5df4caa82f
11 changed files with 27 additions and 40 deletions

View file

@ -129,40 +129,41 @@ public:
return { spr.pos.X, -spr.pos.Y, -spr.pos.Z };
}
int32_t interpolatedx(double const smoothratio, int const scale = 16)
int32_t __interpolatedx(double const smoothratio, int const scale = 16)
{
return interpolatedvalue(opos.X, spr.int_pos().X, smoothratio, scale);
}
int32_t interpolatedy(double const smoothratio, int const scale = 16)
int32_t __interpolatedy(double const smoothratio, int const scale = 16)
{
return interpolatedvalue(opos.Y, spr.int_pos().Y, smoothratio, scale);
}
int32_t interpolatedz(double const smoothratio, int const scale = 16)
int32_t __interpolatedz(double const smoothratio, int const scale = 16)
{
return interpolatedvalue(opos.Z, spr.int_pos().Z, smoothratio, scale);
}
vec2_t interpolatedvec2(double const smoothratio, int const scale = 16)
vec2_t __interpolatedvec2(double const smoothratio, int const scale = 16)
{
return
{
interpolatedx(smoothratio, scale),
interpolatedy(smoothratio, scale)
__interpolatedx(smoothratio, scale),
__interpolatedy(smoothratio, scale)
};
}
vec3_t interpolatedvec3(double const smoothratio, int const scale = 16)
vec3_t __interpolatedvec3(double const smoothratio, int const scale = 16)
{
return
{
interpolatedx(smoothratio, scale),
interpolatedy(smoothratio, scale),
interpolatedz(smoothratio, scale)
__interpolatedx(smoothratio, scale),
__interpolatedy(smoothratio, scale),
__interpolatedz(smoothratio, scale)
};
}
int16_t interpolatedang(double const smoothratio)
{
return interpolatedangle(oang, spr.ang, smoothratio, 16);

View file

@ -578,7 +578,7 @@ void viewProcessSprites(tspriteArray& tsprites, int32_t cX, int32_t cY, int32_t
if (cl_interpolate && owneractor->interpolated && !(pTSprite->flags & 512))
{
pTSprite->set_int_pos(owneractor->interpolatedvec3(gInterpolate));
pTSprite->set_int_pos(owneractor->__interpolatedvec3(gInterpolate));
pTSprite->ang = owneractor->interpolatedang(gInterpolate);
}
int nAnim = 0;

View file

@ -792,9 +792,7 @@ void movecrane(DDukeActor *actor, int crane)
else if (actor->IsActiveCrane())
{
auto ang = ps[p].angle.ang.asbuild();
ps[p].opos.X = ps[p].pos.X;
ps[p].opos.Y = ps[p].pos.Y;
ps[p].opos.Z = ps[p].pos.Z;
ps[p].opos = ps[p].pos;
ps[p].pos.X = actor->int_pos().X - bcos(ang, -6);
ps[p].pos.Y = actor->int_pos().Y - bsin(ang, -6);
ps[p].pos.Z = actor->int_pos().Z + (2 << 8);

View file

@ -172,7 +172,7 @@ void animatesprites_d(tspriteArray& tsprites, int x, int y, int a, int smoothrat
}
else if (!actorflag(h, SFLAG_NOINTERPOLATE))
{
t->set_int_pos(h->interpolatedvec3(smoothratio));
t->set_int_pos(h->__interpolatedvec3(smoothratio));
}
auto sectp = h->sector();

View file

@ -154,7 +154,7 @@ void animatesprites_r(tspriteArray& tsprites, int x, int y, int a, int smoothrat
}
else if (!actorflag(h, SFLAG_NOINTERPOLATE))
{
t->set_int_pos(h->interpolatedvec3(smoothratio));
t->set_int_pos(h->__interpolatedvec3(smoothratio));
}
auto sectp = h->sector();

View file

@ -558,7 +558,7 @@ bool GameInterface::DrawAutomapPlayer(int mx, int my, int cposx, int cposy, int
for (p = connecthead; p >= 0; p = connectpoint2[p])
{
auto act = ps[p].GetActor();
auto spos = act->interpolatedvec2(smoothratio);
auto spos = act->__interpolatedvec2(smoothratio);
ox = mx - cposx;
oy = my - cposy;

View file

@ -1321,18 +1321,6 @@ void DoActor(bool bSet, int lVar1, int lLabelID, int lVar2, DDukeActor* sActor,
if (bSet) act->ovel.Y = lValue;
else SetGameVarID(lVar2, act->ovel.Y, sActor, sPlayer);
break;
case ACTOR_HTBPOSX:
if (bSet) act->opos.X = lValue;
else SetGameVarID(lVar2, act->opos.X, sActor, sPlayer);
break;
case ACTOR_HTBPOSY:
if (bSet) act->opos.Y = lValue;
else SetGameVarID(lVar2, act->opos.Y, sActor, sPlayer);
break;
case ACTOR_HTBPOSZ:
if (bSet) act->opos.Z = lValue;
else SetGameVarID(lVar2, act->opos.Z, sActor, sPlayer);
break;
case ACTOR_HTG_T0:
if (bSet) act->temp_data[0] = lValue;
else SetGameVarID(lVar2, act->temp_data[0], sActor, sPlayer);

View file

@ -50,8 +50,8 @@ void DrawMap(double const smoothratio)
{
auto pPlayerActor = PlayerList[nLocalPlayer].pActor;
int x = pPlayerActor->interpolatedx(smoothratio);
int y = pPlayerActor->interpolatedy(smoothratio);
int x = pPlayerActor->__interpolatedx(smoothratio);
int y = pPlayerActor->__interpolatedy(smoothratio);
int ang = (!SyncInput() ? PlayerList[nLocalPlayer].angle.sum() : PlayerList[nLocalPlayer].angle.interpolatedsum(smoothratio)).asbuild();
DrawOverheadMap(x, y, ang, smoothratio);
}

View file

@ -38,7 +38,7 @@ void GameInterface::WarpToCoords(int x, int y, int z, int ang, int horz)
Player *nPlayer = &PlayerList[nLocalPlayer];
nPlayer->pActor->set_int_pos({ x, y, z });
nPlayer->pActor->opos = nPlayer->pActor->int_pos();
nPlayer->pActor->backuppos();
if (ang != INT_MIN)
{

View file

@ -73,7 +73,7 @@ static void analyzesprites(tspriteArray& tsprites, int x, int y, int z, double c
if (pTSprite->ownerActor)
{
// interpolate sprite position
pTSprite->set_int_pos(pTSprite->ownerActor->interpolatedvec3(smoothratio));
pTSprite->set_int_pos(pTSprite->ownerActor->__interpolatedvec3(smoothratio));
pTSprite->ang = pTSprite->ownerActor->interpolatedang(smoothratio);
}
}
@ -230,9 +230,9 @@ void DrawView(double smoothRatio, bool sceneonly)
}
else
{
playerX = pPlayerActor->interpolatedx(smoothRatio);
playerY = pPlayerActor->interpolatedy(smoothRatio);
playerZ = pPlayerActor->interpolatedz(smoothRatio) + interpolatedvalue(PlayerList[nLocalPlayer].oeyelevel, PlayerList[nLocalPlayer].eyelevel, smoothRatio);
playerX = pPlayerActor->__interpolatedx(smoothRatio);
playerY = pPlayerActor->__interpolatedy(smoothRatio);
playerZ = pPlayerActor->__interpolatedz(smoothRatio) + interpolatedvalue(PlayerList[nLocalPlayer].oeyelevel, PlayerList[nLocalPlayer].eyelevel, smoothRatio);
pSector = PlayerList[nLocalPlayer].pPlayerViewSect;
updatesector(playerX, playerY, &pSector);

View file

@ -625,7 +625,7 @@ void analyzesprites(tspriteArray& tsprites, int viewx, int viewy, int viewz, int
{
if (tsp->statnum <= STAT_SKIP4_INTERP_END)
{
tsp->set_int_pos(tActor->interpolatedvec3(smr4, 18));
tsp->set_int_pos(tActor->__interpolatedvec3(smr4, 18));
}
}
@ -633,7 +633,7 @@ void analyzesprites(tspriteArray& tsprites, int viewx, int viewy, int viewz, int
{
if (tsp->statnum <= STAT_SKIP2_INTERP_END)
{
tsp->set_int_pos(tActor->interpolatedvec3(smr2, 17));
tsp->set_int_pos(tActor->__interpolatedvec3(smr2, 17));
}
}
}
@ -1636,8 +1636,8 @@ bool GameInterface::DrawAutomapPlayer(int mx, int my, int cposx, int cposy, int
k = actor->spr.statnum;
if ((k >= 1) && (k <= 8) && (k != 2)) // Interpolate moving
{
sprx = actor->interpolatedx(smoothratio);
spry = actor->interpolatedy(smoothratio);
sprx = actor->__interpolatedx(smoothratio);
spry = actor->__interpolatedy(smoothratio);
}
switch (actor->spr.cstat & CSTAT_SPRITE_ALIGNMENT_MASK)