mirror of
https://github.com/ZDoom/Raze.git
synced 2024-11-15 08:51:24 +00:00
- moved all interpolate* methods from spritetypebase to DCoreActor.
The places where it was used on tsprites were redone to use the actor's base coordinate, which at the point of the operation would always be the same.
This commit is contained in:
parent
c10fb1278a
commit
7f62df517d
11 changed files with 60 additions and 60 deletions
|
@ -42,6 +42,45 @@ public:
|
|||
return spr.time;
|
||||
}
|
||||
|
||||
int32_t interpolatedx(double const smoothratio, int const scale = 16)
|
||||
{
|
||||
return interpolatedvalue(spr.opos.X, spr.pos.X, smoothratio, scale);
|
||||
}
|
||||
|
||||
int32_t interpolatedy(double const smoothratio, int const scale = 16)
|
||||
{
|
||||
return interpolatedvalue(spr.opos.Y, spr.pos.Y, smoothratio, scale);
|
||||
}
|
||||
|
||||
int32_t interpolatedz(double const smoothratio, int const scale = 16)
|
||||
{
|
||||
return interpolatedvalue(spr.opos.Z, spr.pos.Z, smoothratio, scale);
|
||||
}
|
||||
|
||||
vec2_t interpolatedvec2(double const smoothratio, int const scale = 16)
|
||||
{
|
||||
return
|
||||
{
|
||||
interpolatedx(smoothratio, scale),
|
||||
interpolatedy(smoothratio, scale)
|
||||
};
|
||||
}
|
||||
|
||||
vec3_t interpolatedvec3(double const smoothratio, int const scale = 16)
|
||||
{
|
||||
return
|
||||
{
|
||||
interpolatedx(smoothratio, scale),
|
||||
interpolatedy(smoothratio, scale),
|
||||
interpolatedz(smoothratio, scale)
|
||||
};
|
||||
}
|
||||
|
||||
int16_t interpolatedang(double const smoothratio)
|
||||
{
|
||||
return interpolatedangle(spr.oang, spr.ang, smoothratio, 16);
|
||||
}
|
||||
|
||||
void backupx()
|
||||
{
|
||||
spr.opos.X = spr.pos.X;
|
||||
|
|
|
@ -451,45 +451,6 @@ struct spritetypebase
|
|||
{
|
||||
pos = newpos;
|
||||
}
|
||||
|
||||
int32_t interpolatedx(double const smoothratio, int const scale = 16)
|
||||
{
|
||||
return interpolatedvalue(opos.X, pos.X, smoothratio, scale);
|
||||
}
|
||||
|
||||
int32_t interpolatedy(double const smoothratio, int const scale = 16)
|
||||
{
|
||||
return interpolatedvalue(opos.Y, pos.Y, smoothratio, scale);
|
||||
}
|
||||
|
||||
int32_t interpolatedz(double const smoothratio, int const scale = 16)
|
||||
{
|
||||
return interpolatedvalue(opos.Z, pos.Z, smoothratio, scale);
|
||||
}
|
||||
|
||||
vec2_t interpolatedvec2(double const smoothratio, int const scale = 16)
|
||||
{
|
||||
return
|
||||
{
|
||||
interpolatedx(smoothratio, scale),
|
||||
interpolatedy(smoothratio, scale)
|
||||
};
|
||||
}
|
||||
|
||||
vec3_t interpolatedvec3(double const smoothratio, int const scale = 16)
|
||||
{
|
||||
return
|
||||
{
|
||||
interpolatedx(smoothratio, scale),
|
||||
interpolatedy(smoothratio, scale),
|
||||
interpolatedz(smoothratio, scale)
|
||||
};
|
||||
}
|
||||
|
||||
int16_t interpolatedang(double const smoothratio)
|
||||
{
|
||||
return interpolatedangle(oang, ang, smoothratio, 16);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
|
|
|
@ -53,7 +53,7 @@ void collectTSpritesForPortal(int x, int y, int i, int interpolation)
|
|||
pTSprite->pos.X = dx + interpolatedvalue(actor->spr.opos.X, actor->spr.pos.X, interpolation);
|
||||
pTSprite->pos.Y = dy + interpolatedvalue(actor->spr.opos.Y, actor->spr.pos.Y, interpolation);
|
||||
pTSprite->pos.Z = dz + interpolatedvalue(actor->spr.opos.Z, actor->spr.pos.Z, interpolation);
|
||||
pTSprite->ang = actor->spr.interpolatedang(interpolation);
|
||||
pTSprite->ang = actor->interpolatedang(interpolation);
|
||||
|
||||
int nAnim = 0;
|
||||
switch (picanm[pTSprite->picnum].extra & 7)
|
||||
|
|
|
@ -577,8 +577,8 @@ void viewProcessSprites(tspritetype* tsprite, int& spritesortcnt, int32_t cX, in
|
|||
|
||||
if (cl_interpolate && owneractor->interpolated && !(pTSprite->flags & 512))
|
||||
{
|
||||
pTSprite->pos = pTSprite->interpolatedvec3(gInterpolate);
|
||||
pTSprite->ang = pTSprite->interpolatedang(gInterpolate);
|
||||
pTSprite->pos = owneractor->interpolatedvec3(gInterpolate);
|
||||
pTSprite->ang = owneractor->interpolatedang(gInterpolate);
|
||||
}
|
||||
int nAnim = 0;
|
||||
switch (picanm[nTile].extra & 7) {
|
||||
|
|
|
@ -172,7 +172,7 @@ void animatesprites_d(tspritetype* tsprite, int& spritesortcnt, int x, int y, in
|
|||
}
|
||||
else if (h->spr.picnum != CRANEPOLE)
|
||||
{
|
||||
t->pos = h->spr.interpolatedvec3(smoothratio);
|
||||
t->pos = h->interpolatedvec3(smoothratio);
|
||||
}
|
||||
|
||||
auto sectp = h->sector();
|
||||
|
|
|
@ -155,7 +155,7 @@ void animatesprites_r(tspritetype* tsprite, int& spritesortcnt, int x, int y, in
|
|||
}
|
||||
else if (h->spr.picnum != CRANEPOLE)
|
||||
{
|
||||
t->pos = h->spr.interpolatedvec3(smoothratio);
|
||||
t->pos = h->interpolatedvec3(smoothratio);
|
||||
}
|
||||
|
||||
auto sectp = h->sector();
|
||||
|
|
|
@ -549,7 +549,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->spr.interpolatedvec2(smoothratio);
|
||||
auto spos = act->interpolatedvec2(smoothratio);
|
||||
|
||||
ox = mx - cposx;
|
||||
oy = my - cposy;
|
||||
|
@ -558,7 +558,7 @@ bool GameInterface::DrawAutomapPlayer(int mx, int my, int cposx, int cposy, int
|
|||
int xx = xdim / 2. + x1 / 4096.;
|
||||
int yy = ydim / 2. + y1 / 4096.;
|
||||
|
||||
daang = ((!SyncInput() ? act->spr.ang : act->spr.interpolatedang(smoothratio)) - cang) & 2047;
|
||||
daang = ((!SyncInput() ? act->spr.ang : act->interpolatedang(smoothratio)) - cang) & 2047;
|
||||
|
||||
if (p == screenpeek || ud.coop == 1)
|
||||
{
|
||||
|
|
|
@ -110,7 +110,7 @@ void GameInterface::UpdateCameras(double smoothratio)
|
|||
screen->RenderTextureView(canvas, [=](IntRect& rect)
|
||||
{
|
||||
auto camera = camsprite->GetOwner();
|
||||
auto ang = buildang(camera->spr.interpolatedang(smoothratio));
|
||||
auto ang = buildang(camera->interpolatedang(smoothratio));
|
||||
display_mirror = 1; // should really be 'display external view'.
|
||||
if (!testnewrenderer)
|
||||
{
|
||||
|
@ -356,7 +356,7 @@ void displayrooms(int snum, double smoothratio)
|
|||
if (p->newOwner != nullptr)
|
||||
{
|
||||
auto act = p->newOwner;
|
||||
cang = buildang(act->spr.interpolatedang(smoothratio));
|
||||
cang = buildang(act->interpolatedang(smoothratio));
|
||||
choriz = buildhoriz(act->spr.shade);
|
||||
cposx = act->spr.pos.X;
|
||||
cposy = act->spr.pos.Y;
|
||||
|
|
|
@ -50,8 +50,8 @@ void DrawMap(double const smoothratio)
|
|||
{
|
||||
auto pPlayerActor = PlayerList[nLocalPlayer].pActor;
|
||||
|
||||
int x = pPlayerActor->spr.interpolatedx(smoothratio);
|
||||
int y = pPlayerActor->spr.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);
|
||||
}
|
||||
|
|
|
@ -78,8 +78,8 @@ static void analyzesprites(tspritetype* tsprite, int& spritesortcnt, int x, int
|
|||
if (pTSprite->ownerActor)
|
||||
{
|
||||
// interpolate sprite position
|
||||
pTSprite->pos = pTSprite->interpolatedvec3(smoothratio);
|
||||
pTSprite->ang = pTSprite->interpolatedang(smoothratio);
|
||||
pTSprite->pos = pTSprite->ownerActor->interpolatedvec3(smoothratio);
|
||||
pTSprite->ang = pTSprite->ownerActor->interpolatedang(smoothratio);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -240,9 +240,9 @@ void DrawView(double smoothRatio, bool sceneonly)
|
|||
}
|
||||
else
|
||||
{
|
||||
playerX = pPlayerActor->spr.interpolatedx(smoothRatio);
|
||||
playerY = pPlayerActor->spr.interpolatedy(smoothRatio);
|
||||
playerZ = pPlayerActor->spr.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);
|
||||
|
|
|
@ -638,7 +638,7 @@ void analyzesprites(tspritetype* tsprite, int& spritesortcnt, int viewx, int vie
|
|||
{
|
||||
if (tsp->statnum <= STAT_SKIP4_INTERP_END)
|
||||
{
|
||||
tsp->pos = tsp->interpolatedvec3(smr4, 18);
|
||||
tsp->pos = tActor->interpolatedvec3(smr4, 18);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -646,7 +646,7 @@ void analyzesprites(tspritetype* tsprite, int& spritesortcnt, int viewx, int vie
|
|||
{
|
||||
if (tsp->statnum <= STAT_SKIP2_INTERP_END)
|
||||
{
|
||||
tsp->pos = tsp->interpolatedvec3(smr2, 17);
|
||||
tsp->pos = tActor->interpolatedvec3(smr2, 17);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1660,8 +1660,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->spr.interpolatedx(smoothratio);
|
||||
spry = actor->spr.interpolatedy(smoothratio);
|
||||
sprx = actor->interpolatedx(smoothratio);
|
||||
spry = actor->interpolatedy(smoothratio);
|
||||
}
|
||||
|
||||
switch (actor->spr.cstat & CSTAT_SPRITE_ALIGNMENT_MASK)
|
||||
|
@ -1678,7 +1678,7 @@ bool GameInterface::DrawAutomapPlayer(int mx, int my, int cposx, int cposy, int
|
|||
|
||||
if (czoom > 192)
|
||||
{
|
||||
daang = ((!SyncInput() ? actor->spr.ang : actor->spr.interpolatedang(smoothratio)) - cang) & 2047;
|
||||
daang = ((!SyncInput() ? actor->spr.ang : actor->interpolatedang(smoothratio)) - cang) & 2047;
|
||||
|
||||
// Special case tiles
|
||||
if (actor->spr.picnum == 3123) break;
|
||||
|
|
Loading…
Reference in a new issue