- Exhumed: Leverage new spritetype methods within Exhumed.

This commit is contained in:
Mitchell Richters 2021-01-05 23:47:56 +11:00
parent 18fbc8996b
commit 6721a6aa05
3 changed files with 6 additions and 27 deletions

View file

@ -175,8 +175,6 @@ 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
@ -263,24 +261,14 @@ 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(); for (int i = 0; i < MAXSPRITES; i++)
{
sprite[i].backuploc();
}
if (currentLevel->levelNumber == kMap20) if (currentLevel->levelNumber == kMap20)
{ {

View file

@ -72,11 +72,8 @@ static void analyzesprites(double const smoothratio)
if (pTSprite->owner != -1) if (pTSprite->owner != -1)
{ {
// interpolate sprite position // interpolate sprite position
Loc* oldLoc = &oldLocs[pTSprite->owner]; pTSprite->pos = pTSprite->interpolatedvec3(smoothratio);
pTSprite->x = oldLoc->x + MulScale(pTSprite->x - oldLoc->x, smoothratio, 16); pTSprite->ang = pTSprite->interpolatedang(smoothratio);
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);
} }
} }

View file

@ -40,12 +40,6 @@ 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 + MulScale(((b+1024-a)&2047)-1024, smooth, 16); return a + MulScale(((b+1024-a)&2047)-1024, smooth, 16);