- Floatify smoothratio for calcChaseCamPos().

This commit is contained in:
Mitchell Richters 2022-09-07 17:00:58 +10:00 committed by Christoph Oelckers
parent e84a0f3245
commit 6716d0f2e9
3 changed files with 7 additions and 7 deletions

View file

@ -36,7 +36,7 @@ IntRect viewport3d;
double cameradist, cameraclock;
bool calcChaseCamPos(DVector3& ppos, DCoreActor* act, sectortype** psect, DAngle ang, fixedhoriz horiz, double const smoothratio)
bool calcChaseCamPos(DVector3& ppos, DCoreActor* act, sectortype** psect, DAngle ang, fixedhoriz horiz, double const interpfrac)
{
HitInfoBase hitinfo;
DAngle daang;
@ -90,7 +90,7 @@ bool calcChaseCamPos(DVector3& ppos, DCoreActor* act, sectortype** psect, DAngle
{
bakcstat = hit->spr.cstat;
hit->spr.cstat &= ~(CSTAT_SPRITE_BLOCK | CSTAT_SPRITE_BLOCK_HITSCAN);
calcChaseCamPos(ppos, act, psect, ang, horiz, smoothratio);
calcChaseCamPos(ppos, act, psect, ang, horiz, interpfrac);
hit->spr.cstat = bakcstat;
return false;
}
@ -115,7 +115,7 @@ bool calcChaseCamPos(DVector3& ppos, DCoreActor* act, sectortype** psect, DAngle
ppos += npos * cameradist;
// Calculate clock using GameTicRate so it increases the same rate on all speed computers.
double myclock = PlayClock + 120 / GameTicRate * smoothratio * (1. / MaxSmoothRatio);
double myclock = PlayClock + 120 / GameTicRate * interpfrac;
if (cameraclock == INT_MIN)
{
// Third person view was just started.

View file

@ -257,12 +257,12 @@ extern double cameradist, cameraclock;
void loaddefinitionsfile(const char* fn, bool cumulative = false, bool maingrp = false);
bool calcChaseCamPos(DVector3& ppos, DCoreActor* pspr, sectortype** psectnum, DAngle ang, fixedhoriz horiz, double const smoothratio);
bool calcChaseCamPos(DVector3& ppos, DCoreActor* pspr, sectortype** psectnum, DAngle ang, fixedhoriz horiz, double const interpfrac);
inline bool calcChaseCamPos(int* px, int* py, int* pz, DCoreActor* pspr, sectortype** psectnum, DAngle ang, fixedhoriz horiz, double const smoothratio)
{
auto pos = DVector3((*px) * inttoworld, (*py) * inttoworld, (*pz) * zinttoworld);
auto res = calcChaseCamPos(pos, pspr, psectnum, ang, horiz, smoothratio);
auto res = calcChaseCamPos(pos, pspr, psectnum, ang, horiz, smoothratio * (1. / MaxSmoothRatio));
(*px) = pos.X * worldtoint;
(*py) = pos.Y * worldtoint;
(*pz) = pos.Z * zworldtoint;

View file

@ -258,10 +258,10 @@ void DrawView(double interpfrac, bool sceneonly)
if (bCamera)
{
nCamerapos.Z -= 10;
if (!calcChaseCamPos(nCamerapos, pPlayerActor, &pSector, nCameraang, nCamerapan, interpfrac * MaxSmoothRatio))
if (!calcChaseCamPos(nCamerapos, pPlayerActor, &pSector, nCameraang, nCamerapan, interpfrac))
{
nCamerapos.Z += 10;
calcChaseCamPos(nCamerapos, pPlayerActor, &pSector, nCameraang, nCamerapan, interpfrac * MaxSmoothRatio);
calcChaseCamPos(nCamerapos, pPlayerActor, &pSector, nCameraang, nCamerapan, interpfrac);
}
}
}