mirror of
https://github.com/ZDoom/raze-gles.git
synced 2024-11-10 23:02:03 +00:00
- Exhumed: Add sprite interpolation to analyzesprites()
.
This commit is contained in:
parent
00ce61959c
commit
1504e19cf8
3 changed files with 41 additions and 3 deletions
|
@ -174,6 +174,8 @@ int nTimeLimit;
|
||||||
|
|
||||||
int bVanilla = 0;
|
int bVanilla = 0;
|
||||||
|
|
||||||
|
Loc oldLocs[MAXSPRITES];
|
||||||
|
|
||||||
void DebugOut(const char *fmt, ...)
|
void DebugOut(const char *fmt, ...)
|
||||||
{
|
{
|
||||||
#ifdef _DEBUG
|
#ifdef _DEBUG
|
||||||
|
@ -260,10 +262,25 @@ double calc_smoothratio()
|
||||||
return I_GetTimeFrac() * MaxSmoothRatio;
|
return I_GetTimeFrac() * MaxSmoothRatio;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void recordoldspritepos()
|
||||||
|
{
|
||||||
|
for (int i = 0; i < MAXSPRITES; i++)
|
||||||
|
{
|
||||||
|
auto* spr = &sprite[i];
|
||||||
|
Loc* oldLoc = &oldLocs[i];
|
||||||
|
oldLoc->x = spr->x;
|
||||||
|
oldLoc->y = spr->y;
|
||||||
|
oldLoc->z = spr->z;
|
||||||
|
oldLoc->ang = spr->ang;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void GameMove(void)
|
void GameMove(void)
|
||||||
{
|
{
|
||||||
FixPalette();
|
FixPalette();
|
||||||
|
|
||||||
|
recordoldspritepos();
|
||||||
|
|
||||||
if (currentLevel->levelNumber == kMap20)
|
if (currentLevel->levelNumber == kMap20)
|
||||||
{
|
{
|
||||||
if (lCountDown <= 0)
|
if (lCountDown <= 0)
|
||||||
|
|
|
@ -121,8 +121,24 @@ void viewRestoreInterpolations(void) //Stick at end of drawscreen
|
||||||
}
|
}
|
||||||
|
|
||||||
// NOTE - not to be confused with Ken's analyzesprites()
|
// NOTE - not to be confused with Ken's analyzesprites()
|
||||||
static void analyzesprites()
|
static void analyzesprites(double const smoothratio)
|
||||||
{
|
{
|
||||||
|
tspritetype *pTSprite;
|
||||||
|
|
||||||
|
for (int i = 0; i < spritesortcnt; i++) {
|
||||||
|
pTSprite = &tsprite[i];
|
||||||
|
|
||||||
|
if (pTSprite->owner != -1)
|
||||||
|
{
|
||||||
|
// interpolate sprite position
|
||||||
|
Loc* oldLoc = &oldLocs[pTSprite->owner];
|
||||||
|
pTSprite->x = oldLoc->x + MulScale(pTSprite->x - oldLoc->x, smoothratio, 16);
|
||||||
|
pTSprite->y = oldLoc->y + MulScale(pTSprite->y - oldLoc->y, smoothratio, 16);
|
||||||
|
pTSprite->z = oldLoc->z + MulScale(pTSprite->z - oldLoc->z, smoothratio, 16);
|
||||||
|
pTSprite->ang = oldLoc->ang + MulScale(((pTSprite->ang - oldLoc->ang + 1024) & 0x7FF) - 1024, smoothratio, 16);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
short nPlayerSprite = PlayerList[nLocalPlayer].nSprite;
|
short nPlayerSprite = PlayerList[nLocalPlayer].nSprite;
|
||||||
|
|
||||||
int var_38 = 20;
|
int var_38 = 20;
|
||||||
|
@ -142,7 +158,6 @@ static void analyzesprites()
|
||||||
int nAngle = (2048 - pPlayerSprite->ang) & kAngleMask;
|
int nAngle = (2048 - pPlayerSprite->ang) & kAngleMask;
|
||||||
|
|
||||||
int nTSprite;
|
int nTSprite;
|
||||||
tspritetype *pTSprite;
|
|
||||||
|
|
||||||
// int var_20 = var_24;
|
// int var_20 = var_24;
|
||||||
|
|
||||||
|
@ -398,7 +413,7 @@ void DrawView(double smoothRatio, bool sceneonly)
|
||||||
}
|
}
|
||||||
|
|
||||||
renderDrawRoomsQ16(nCamerax, nCameray, viewz, nCameraa.asq16(), nCamerapan.asq16(), nSector);
|
renderDrawRoomsQ16(nCamerax, nCameray, viewz, nCameraa.asq16(), nCamerapan.asq16(), nSector);
|
||||||
analyzesprites();
|
analyzesprites(smoothRatio);
|
||||||
renderDrawMasks();
|
renderDrawMasks();
|
||||||
|
|
||||||
if (HavePLURemap())
|
if (HavePLURemap())
|
||||||
|
|
|
@ -46,6 +46,12 @@ extern short bTouchFloor;
|
||||||
extern short nChunkTotal;
|
extern short nChunkTotal;
|
||||||
extern int gFov;
|
extern int gFov;
|
||||||
|
|
||||||
|
struct Loc
|
||||||
|
{
|
||||||
|
int x, y, z, ang;
|
||||||
|
};
|
||||||
|
extern Loc oldLocs[MAXSPRITES];
|
||||||
|
|
||||||
static inline int angle_interpolate16(int a, int b, int smooth)
|
static inline int angle_interpolate16(int a, int b, int smooth)
|
||||||
{
|
{
|
||||||
return a + mulscale16(((b+1024-a)&2047)-1024, smooth);
|
return a + mulscale16(((b+1024-a)&2047)-1024, smooth);
|
||||||
|
|
Loading…
Reference in a new issue