diff --git a/source/core/gamefuncs.cpp b/source/core/gamefuncs.cpp index 3d134faf5..3aa15b2f9 100644 --- a/source/core/gamefuncs.cpp +++ b/source/core/gamefuncs.cpp @@ -33,7 +33,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. int cameradist, cameraclock; -bool calcChaseCamPos(int* px, int* py, int* pz, spritetype* pspr, sectortype** psect, binangle ang, fixedhoriz horiz, double const smoothratio) +bool calcChaseCamPos(int* px, int* py, int* pz, DCoreActor* act, sectortype** psect, binangle ang, fixedhoriz horiz, double const smoothratio) { HitInfoBase hitinfo; binangle daang; @@ -45,11 +45,11 @@ bool calcChaseCamPos(int* px, int* py, int* pz, spritetype* pspr, sectortype** p int ny = gi->chaseCamY(ang); int nz = gi->chaseCamZ(horiz); - auto bakcstat = pspr->cstat; - pspr->cstat &= ~CSTAT_SPRITE_BLOCK_ALL; + auto bakcstat = act->spr.cstat; + act->spr.cstat &= ~CSTAT_SPRITE_BLOCK_ALL; updatesectorz(*px, *py, *pz, psect); hitscan({ *px, *py, *pz }, *psect, { nx, ny, nz }, hitinfo, CLIPMASK1); - pspr->cstat = bakcstat; + act->spr.cstat = bakcstat; int hx = hitinfo.hitpos.X - *px; int hy = hitinfo.hitpos.Y - *py; @@ -94,14 +94,14 @@ bool calcChaseCamPos(int* px, int* py, int* pz, spritetype* pspr, sectortype** p { bakcstat = hit->spr.cstat; hit->spr.cstat &= ~(CSTAT_SPRITE_BLOCK | CSTAT_SPRITE_BLOCK_HITSCAN); - calcChaseCamPos(px, py, pz, pspr, psect, ang, horiz, smoothratio); + calcChaseCamPos(px, py, pz, act, psect, ang, horiz, smoothratio); hit->spr.cstat = bakcstat; return false; } else { // same as wall calculation. - daang = buildang(pspr->ang - 512); + daang = buildang(act->spr.ang - 512); newdist = nx * daang.bsin() + ny * -daang.bcos(); if (abs(nx) > abs(ny)) diff --git a/source/core/gamefuncs.h b/source/core/gamefuncs.h index 42c4103e4..5e936d89e 100644 --- a/source/core/gamefuncs.h +++ b/source/core/gamefuncs.h @@ -116,7 +116,7 @@ extern int cameradist, cameraclock; void loaddefinitionsfile(const char* fn, bool cumulative = false, bool maingrp = false); -bool calcChaseCamPos(int* px, int* py, int* pz, spritetype* pspr, sectortype** psectnum, binangle ang, fixedhoriz horiz, double const smoothratio); +bool calcChaseCamPos(int* px, int* py, int* pz, DCoreActor* pspr, sectortype** psectnum, binangle ang, fixedhoriz horiz, double const smoothratio); void PlanesAtPoint(const sectortype* sec, float dax, float day, float* ceilz, float* florz); @@ -199,21 +199,6 @@ inline DVector2 WallDelta(const walltype* wallnum) return WallEnd(wallnum) - WallStart(wallnum); } -inline double SpriteX(spritetype* spr) -{ - return spr->pos.X * (1 / 16.); -} - -inline double SpriteY(spritetype* spr) -{ - return spr->pos.Y * (1 / -16.); -} - -inline DVector2 SpritePos(spritetype* spr) -{ - return { SpriteX(spr), SpriteY(spr) }; -} - inline double PointOnLineSide(double x, double y, double linex, double liney, double deltax, double deltay) { return (x - linex) * deltay - (y - liney) * deltax; diff --git a/source/games/blood/src/view.cpp b/source/games/blood/src/view.cpp index cb779ac06..1439f26a3 100644 --- a/source/games/blood/src/view.cpp +++ b/source/games/blood/src/view.cpp @@ -381,7 +381,7 @@ int gLastPal = 0; int32_t g_frameRate; -static void DrawMap(spritetype* pSprite) +static void DrawMap(DBloodActor* view) { int tm = 0; if (windowxy1.X > 0) @@ -390,8 +390,8 @@ static void DrawMap(spritetype* pSprite) tm = 1; } VIEW* pView = &gPrevView[gViewIndex]; - int x = interpolatedvalue(pView->x, pSprite->pos.X, gInterpolate); - int y = interpolatedvalue(pView->y, pSprite->pos.Y, gInterpolate); + int x = interpolatedvalue(pView->x, view->spr.pos.X, gInterpolate); + int y = interpolatedvalue(pView->y, view->spr.pos.Y, gInterpolate); int ang = (!SyncInput() ? gView->angle.sum() : gView->angle.interpolatedsum(gInterpolate)).asbuild(); DrawOverheadMap(x, y, ang, gInterpolate); if (tm) @@ -475,7 +475,7 @@ void SetupView(int &cX, int& cY, int& cZ, binangle& cA, fixedhoriz& cH, sectorty } else { - calcChaseCamPos((int*)&cX, (int*)&cY, (int*)&cZ, &gView->actor->spr, &pSector, cA, cH, gInterpolate); + calcChaseCamPos((int*)&cX, (int*)&cY, (int*)&cZ, gView->actor, &pSector, cA, cH, gInterpolate); } CheckLink((int*)&cX, (int*)&cY, (int*)&cZ, &pSector); } @@ -711,7 +711,7 @@ void viewDrawScreen(bool sceneonly) UpdateDacs(0, true); // keep the view palette active only for the actual 3D view and its overlays. if (automapMode != am_off) { - DrawMap (&gView->actor->spr); + DrawMap (gView->actor); } UpdateStatusBar(); int zn = ((gView->zWeapon-gView->zView-(12<<8))>>7)+220; diff --git a/source/games/duke/src/render.cpp b/source/games/duke/src/render.cpp index 9012c86a6..93e74885f 100644 --- a/source/games/duke/src/render.cpp +++ b/source/games/duke/src/render.cpp @@ -368,10 +368,10 @@ void displayrooms(int snum, double smoothratio) cposz -= isRR() ? 3840 : 3072; viewer = p->GetActor(); - if (!calcChaseCamPos(&cposx, &cposy, &cposz, &viewer->spr, §, cang, choriz, smoothratio)) + if (!calcChaseCamPos(&cposx, &cposy, &cposz, viewer, §, cang, choriz, smoothratio)) { cposz += isRR() ? 3840 : 3072; - calcChaseCamPos(&cposx, &cposy, &cposz, &viewer->spr, §, cang, choriz, smoothratio); + calcChaseCamPos(&cposx, &cposy, &cposz, viewer, §, cang, choriz, smoothratio); } } diff --git a/source/games/exhumed/src/view.cpp b/source/games/exhumed/src/view.cpp index 1673a9af2..18d0d86a4 100644 --- a/source/games/exhumed/src/view.cpp +++ b/source/games/exhumed/src/view.cpp @@ -297,10 +297,10 @@ void DrawView(double smoothRatio, bool sceneonly) if (bCamera) { viewz -= 2560; - if (!calcChaseCamPos(&playerX, &playerY, &viewz, pPlayerSprite, &pSector, nAngle, pan, smoothRatio)) + if (!calcChaseCamPos(&playerX, &playerY, &viewz, pPlayerActor, &pSector, nAngle, pan, smoothRatio)) { viewz += 2560; - calcChaseCamPos(&playerX, &playerY, &viewz, pPlayerSprite, &pSector, nAngle, pan, smoothRatio); + calcChaseCamPos(&playerX, &playerY, &viewz, pPlayerActor, &pSector, nAngle, pan, smoothRatio); } } } diff --git a/source/games/sw/src/draw.cpp b/source/games/sw/src/draw.cpp index 2ac008630..1cb052eb3 100644 --- a/source/games/sw/src/draw.cpp +++ b/source/games/sw/src/draw.cpp @@ -1520,10 +1520,10 @@ void drawscreen(PLAYERp pp, double smoothratio) { tz -= 8448; - if (!calcChaseCamPos(&tx, &ty, &tz, &pp->Actor()->s(), &tsect, tang, thoriz, smoothratio)) + if (!calcChaseCamPos(&tx, &ty, &tz, pp->Actor(), &tsect, tang, thoriz, smoothratio)) { tz += 8448; - calcChaseCamPos(&tx, &ty, &tz, &pp->Actor()->s(), &tsect, tang, thoriz, smoothratio); + calcChaseCamPos(&tx, &ty, &tz, pp->Actor(), &tsect, tang, thoriz, smoothratio); } } else