From 6721a6aa054dadedd97c6f19c5bf44a650f2d547 Mon Sep 17 00:00:00 2001 From: Mitchell Richters Date: Tue, 5 Jan 2021 23:47:56 +1100 Subject: [PATCH] - Exhumed: Leverage new `spritetype` methods within Exhumed. --- source/exhumed/src/exhumed.cpp | 20 ++++---------------- source/exhumed/src/view.cpp | 7 ++----- source/exhumed/src/view.h | 6 ------ 3 files changed, 6 insertions(+), 27 deletions(-) diff --git a/source/exhumed/src/exhumed.cpp b/source/exhumed/src/exhumed.cpp index 567bb82a3..2c0c5fc6d 100644 --- a/source/exhumed/src/exhumed.cpp +++ b/source/exhumed/src/exhumed.cpp @@ -175,8 +175,6 @@ int nTimeLimit; int bVanilla = 0; -Loc oldLocs[MAXSPRITES]; - void DebugOut(const char *fmt, ...) { #ifdef _DEBUG @@ -263,24 +261,14 @@ double calc_smoothratio() 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) { FixPalette(); - recordoldspritepos(); + for (int i = 0; i < MAXSPRITES; i++) + { + sprite[i].backuploc(); + } if (currentLevel->levelNumber == kMap20) { diff --git a/source/exhumed/src/view.cpp b/source/exhumed/src/view.cpp index d369fa12b..5abd88456 100644 --- a/source/exhumed/src/view.cpp +++ b/source/exhumed/src/view.cpp @@ -72,11 +72,8 @@ static void analyzesprites(double const smoothratio) 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); + pTSprite->pos = pTSprite->interpolatedvec3(smoothratio); + pTSprite->ang = pTSprite->interpolatedang(smoothratio); } } diff --git a/source/exhumed/src/view.h b/source/exhumed/src/view.h index feda98beb..04f558c54 100644 --- a/source/exhumed/src/view.h +++ b/source/exhumed/src/view.h @@ -40,12 +40,6 @@ extern short bTouchFloor; extern short nChunkTotal; 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) { return a + MulScale(((b+1024-a)&2047)-1024, smooth, 16);