- WH: enable sprite interpolation.

For all games: completely disable interpolation by setting smoothratio to 1 when cl_interpolate == 0 or cl_capfps == 1.
This commit is contained in:
Christoph Oelckers 2021-11-21 23:49:37 +01:00
parent 11831b0a26
commit 47436c58d7
24 changed files with 58 additions and 8 deletions

View file

@ -16,6 +16,7 @@ EXTERN_CVAR(Bool, cl_weaponsway)
EXTERN_CVAR(Bool, cl_viewhbob)
EXTERN_CVAR(Bool, cl_viewvbob)
EXTERN_CVAR(Bool, cl_interpolate)
EXTERN_CVAR(Bool, cl_capfps)
EXTERN_CVAR(Bool, cl_slopetilting)
EXTERN_CVAR(Int, cl_showweapon)
EXTERN_CVAR(Int, cl_weaponswitch)

View file

@ -83,7 +83,7 @@ void CGameMenuItemQAV::Draw(void)
duration = data->duration;
}
auto currentDuration = data->duration - duration;
auto smoothratio = I_GetTimeFrac(data->ticrate) * MaxSmoothRatio;
auto smoothratio = !cl_interpolate || cl_capfps? MaxSmoothRatio : I_GetTimeFrac(data->ticrate) * MaxSmoothRatio;
data->Play(currentDuration - data->ticksPerFrame, currentDuration, -1, NULL);

View file

@ -307,7 +307,7 @@ void qavProcessTimer(PLAYER* const pPlayer, QAV* const pQAV, int* duration, doub
{
// Apply normal values.
*duration = pQAV->duration - pPlayer->qavTimer;
*smoothratio = I_GetTimeFrac(pQAV->ticrate) * MaxSmoothRatio;
*smoothratio = !cl_interpolate || cl_capfps ? MaxSmoothRatio : I_GetTimeFrac(pQAV->ticrate) * MaxSmoothRatio;
}
}
else

View file

@ -552,7 +552,7 @@ void viewDrawScreen(bool sceneonly)
if (!paused && (!M_Active() || gGameOptions.nGameType != 0))
{
gInterpolate = I_GetTimeFrac() * MaxSmoothRatio;
gInterpolate = !cl_interpolate || cl_capfps ? MaxSmoothRatio : I_GetTimeFrac() * MaxSmoothRatio;
}
else gInterpolate = MaxSmoothRatio;
pm_smoothratio = (int)gInterpolate;

View file

@ -128,7 +128,7 @@ void GameInterface::Render()
drawtime.Reset();
drawtime.Clock();
videoSetBrightness(thunder_brightness);
double const smoothRatio = playrunning() ? I_GetTimeFrac() * MaxSmoothRatio : MaxSmoothRatio;
double const smoothRatio = !playrunning() || !cl_interpolate || cl_capfps ? MaxSmoothRatio : I_GetTimeFrac() * MaxSmoothRatio;
displayrooms(screenpeek, smoothRatio);
drawoverlays(smoothRatio);
drawtime.Unclock();

View file

@ -231,7 +231,7 @@ void DrawClock()
double calc_smoothratio()
{
if (bRecord || bPlayback || nFreeze != 0 || paused)
if (bRecord || bPlayback || nFreeze != 0 || paused || cl_capfps || !cl_interpolate)
return MaxSmoothRatio;
return I_GetTimeFrac() * MaxSmoothRatio;

View file

@ -621,7 +621,7 @@ void GameInterface::Render()
}
else
{
smoothratio = I_GetTimeFrac() * MaxSmoothRatio;
smoothratio = !cl_interpolate || cl_capfps ? MaxSmoothRatio : I_GetTimeFrac() * MaxSmoothRatio;
}
drawtime.Reset();

View file

@ -634,6 +634,7 @@ void castspell(PLAYER& plr, DWHActor* actor) {
spawned.clipdist = 16;
spawned.lotag = 512;
spawned.hitag = 0;
spawned.backuploc();
}
void skullycastspell(PLAYER& plr, int i) {
@ -670,6 +671,7 @@ void skullycastspell(PLAYER& plr, int i) {
spawned.lotag = 512;
spawned.hitag = 0;
spawned.pal = 7;
spawned.backuploc();
}
void attack(PLAYER& plr, int const i) {
@ -1011,6 +1013,7 @@ void monsterweapon(int i) {
weap.cstat = 0;
weap.cstat &= ~3;
weap.pal = 0;
weap.backuploc();
int type = (krand() % 4);
weap.picnum = (short)(FLASKBLUE + type);

View file

@ -374,6 +374,7 @@ static void firebreath(PLAYER& plr, int i, int a, int b, int c)
spawned.clipdist = 16;
spawned.lotag = 512;
spawned.hitag = 0;
spawned.backuploc();
}
}

View file

@ -280,6 +280,7 @@ static void throwspank(PLAYER& plr, DWHActor* actor)
spawned.lotag = 512;
spawned.hitag = 0;
spawned.pal = 0;
spawned.backuploc();
}
void createFatwitchAI() {

View file

@ -692,6 +692,7 @@ static void gonzopike(short s, PLAYER& plr) {
spr.lotag = 1024;
spr.hitag = 0;
spr.pal = 0;
spr.backuploc();
}
@ -813,6 +814,7 @@ void deaddude(short sn) {
spawned.owner = 0;
spawned.lotag = 0;
spawned.hitag = 0;
spawned.backuploc();
}
END_WH_NS

View file

@ -490,6 +490,7 @@ static void throwhalberd(int s) {
movesprite((short)j, (bcos(spr.extra) * TICSPERFRAME) << 7,
(bsin(spr.extra) * TICSPERFRAME) << 7, daz, 4 << 8, 4 << 8, 1);
spr.cstat = 21;
spr.backuploc();
}
void createGronAI() {

View file

@ -409,6 +409,7 @@ void spawnabaddy(DWHActor* actor, int monster) {
killcnt++;
setsprite(j, spawned.x, spawned.y, spawned.z);
spawned.backuploc();
}

View file

@ -398,6 +398,7 @@ static void newguyarrow(short s, PLAYER& plr) {
spr.lotag = 1024;
spr.hitag = 0;
spr.pal = 0;
spr.backuploc();
}
void createNewGuyAI() {

View file

@ -671,6 +671,12 @@ void GameInterface::Ticker()
return;
}
UpdateInterpolations();
WHSpriteIterator it;
while (auto ac = it.Next())
{
ac->s().backuploc();
}
for (int i = connecthead; i >= 0; i = connectpoint2[i])
player[i].oldsector = player[i].sector;

View file

@ -155,6 +155,7 @@ void randompotion(int i) {
int type = krand() % 4;
spawned.picnum = (short)(FLASKBLUE + type);
spawned.detail = (short)(FLASKBLUETYPE + type);
spawned.backuploc();
}
END_WH_NS

View file

@ -129,7 +129,7 @@ void GameInterface::processSprites(spritetype* tsprite, int& spritesortcnt, int
void GameInterface::Render()
{
double const smoothRatio = playrunning() ? I_GetTimeFrac() * MaxSmoothRatio : MaxSmoothRatio;
double const smoothRatio = !playrunning() || !cl_interpolate || cl_capfps ? MaxSmoothRatio : I_GetTimeFrac() * MaxSmoothRatio;
drawscreen(pyrn, smoothRatio, false);
if (!paused && isWh2() && attacktheme && !Mus_IsPlaying())

View file

@ -274,6 +274,7 @@ void nukespell(PLAYER& plr, short const j) {
spawned.y = spr.y;
spawned.z = spr.z;
spawned.cstat = spr.cstat;
spawned.backuploc();
return;
}

View file

@ -1723,6 +1723,7 @@ void shootgun(PLAYER& plr, float ang, int guntype) {
spawned.owner = sprite[plr.spritenum].owner;
spawned.lotag = 32;
spawned.hitag = 0;
spawned.backuploc();
spritesound(S_ARROWHIT, &spawned);
if (isWh2() && plr.weapon[6] == 3 && plr.currweapon == 6) {
@ -1745,6 +1746,7 @@ void shootgun(PLAYER& plr, float ang, int guntype) {
spawned.owner = 0;
spawned.lotag = 1200;
spawned.hitag = 0;
spawned.backuploc();
}
}
@ -1773,6 +1775,7 @@ void shootgun(PLAYER& plr, float ang, int guntype) {
spawned.hitag = 0;
movesprite((short) j, (bcos(spawned.ang) * TICSPERFRAME) << 3,
(bsin(spawned.ang) * TICSPERFRAME) << 3, 0, 4 << 8, 4 << 8, 0);
spawned.backuploc();
}
if ((pHitInfo.hitsprite >= 0) && (sprite[pHitInfo.hitsprite].statnum < MAXSTATUS)) {
auto& hitspr = sprite[pHitInfo.hitsprite];
@ -1980,6 +1983,7 @@ void shootgun(PLAYER& plr, float ang, int guntype) {
movesprite((short) j, (bcos(spawned.extra) * TICSPERFRAME) << 3,
(bsin(spawned.extra) * TICSPERFRAME) << 3, 0, 4 << 8, 4 << 8, 0);
setsprite((short) j, spawned.x, spawned.y, spawned.z);
spawned.backuploc();
} else {
j = insertsprite(plr.sector, MISSILE);
auto& spawned = sprite[j];
@ -2002,6 +2006,7 @@ void shootgun(PLAYER& plr, float ang, int guntype) {
spawned.lotag = 1024;
spawned.hitag = 0;
spawned.pal = 0;
spawned.backuploc();
}
} else {
j = insertsprite(plr.sector, MISSILE);
@ -2030,6 +2035,7 @@ void shootgun(PLAYER& plr, float ang, int guntype) {
spawned.lotag = 1024;
spawned.hitag = 0;
spawned.pal = 0;
spawned.backuploc();
}
}
}
@ -2072,6 +2078,7 @@ void shootgun(PLAYER& plr, float ang, int guntype) {
movesprite((short) j, (bcos(spawned.extra) * TICSPERFRAME) << 3,
(bsin(spawned.extra) * TICSPERFRAME) << 3, 0, 4 << 8, 4 << 8, 0);
setsprite((short) j, spawned.x, spawned.y, spawned.z);
spawned.backuploc();
} else {
j = insertsprite(plr.sector, MISSILE);
auto& spawned = sprite[j];
@ -2094,6 +2101,7 @@ void shootgun(PLAYER& plr, float ang, int guntype) {
spawned.lotag = 1024;
spawned.hitag = 0;
spawned.pal = 0;
spawned.backuploc();
}
} else {
j = insertsprite(plr.sector, MISSILE);
@ -2120,6 +2128,7 @@ void shootgun(PLAYER& plr, float ang, int guntype) {
spawned.lotag = 1024;
spawned.hitag = 0;
spawned.pal = 0;
spawned.backuploc();
}
}
@ -2162,6 +2171,7 @@ void shootgun(PLAYER& plr, float ang, int guntype) {
movesprite((short) j, (bcos(spawned.ang) * TICSPERFRAME) << 3,
(bsin(spawned.ang) * TICSPERFRAME) << 3, 0, 4 << 8, 4 << 8, 0);
setsprite(j, spawned.x, spawned.y, spawned.z);
spawned.backuploc();
break;
}
@ -2204,6 +2214,7 @@ void shootgun(PLAYER& plr, float ang, int guntype) {
movesprite((short) j, (bcos(spawned.ang) * TICSPERFRAME) << 3,
(bsin(spawned.ang) * TICSPERFRAME) << 3, 0, 4 << 8, 4 << 8, 0);
setsprite(j, spawned.x, spawned.y, spawned.z);
spawned.backuploc();
break;
}

View file

@ -271,6 +271,7 @@ void animateobjs(PLAYER& plr) {
spawned.hitag = 0;
spawned.detail = GONZOTYPE;
DeleteActor(actor);
spawned.backuploc();
}
}
@ -1352,6 +1353,7 @@ void animateobjs(PLAYER& plr) {
spawned.owner = spr.owner;
spawned.lotag = 256;
spawned.hitag = 0;
spawned.backuploc();
}
if (spr.lotag < 0) {

View file

@ -829,6 +829,7 @@ void makeasplash(int picnum, PLAYER& plr) {
movesprite((short) j, (bcos(spawned.ang) * TICSPERFRAME) << 3,
(bsin(spawned.ang) * TICSPERFRAME) << 3, 0, 4 << 8, 4 << 8, 0);
spawned.backuploc();
}
void makemonstersplash(int picnum, int i) {
@ -860,6 +861,7 @@ void makemonstersplash(int picnum, int i) {
spawned.clipdist = 16;
spawned.lotag = 8;
spawned.hitag = 0;
spawned.backuploc();
// JSA 5/3 start
switch (picnum) {
@ -902,6 +904,7 @@ void bats(PLAYER& plr, int k) {
spawned.lotag = 128;
spawned.hitag = (short) k;
spawned.extra = 0;
spawned.backuploc();
newstatus(j, FLOCK);
@ -1029,6 +1032,7 @@ void warpfxsprite(int s) {
movesprite((short) j, (bcos(daang) * TICSPERFRAME) << 3,
(bsin(daang) * TICSPERFRAME) << 3, daz, 4 << 8, 4 << 8, 1);
spawned.backuploc();
}
void resetEffects() {
@ -1122,6 +1126,7 @@ void makesparks(short i, int type) {
spawned.extra = 0;
spawned.pal = 0;
spawned.backuploc();
}
void shards(int i, int type) {
@ -1144,6 +1149,7 @@ void shards(int i, int type) {
spawned.hitag = 0;
spawned.extra = (short) type;
spawned.pal = 0;
spawned.backuploc();
}

View file

@ -768,6 +768,7 @@ boolean prepareboard(const char* fname) {
sp.cstat = 515;
sp.shade = -3;
sp.xrepeat = sp.yrepeat = 64;
sp.backuploc();
}
}
}
@ -809,6 +810,7 @@ boolean prepareboard(const char* fname) {
// dont forget to cleanup values
plr.treasure[TONYXRING] = 0;
soundEngine->StopAllChannels();
pspr.backuploc();
justteleported = false;
} else {

View file

@ -1390,6 +1390,7 @@ void makeafire(int i, int firetype) {
spawned.lotag = 2047;
spawned.hitag = 0;
changespritestat(j, FIRE);
spawned.backuploc();
}
void explosion(int i, int x, int y, int z, int owner) {
@ -1427,6 +1428,7 @@ void explosion(int i, int x, int y, int z, int owner) {
spawned.picnum = EXPLOSTART;
spawned.lotag = 12;
}
spawned.backuploc();
}
void explosion2(int i, int x, int y, int z, int owner) {
@ -1466,7 +1468,8 @@ void explosion2(int i, int x, int y, int z, int owner) {
spawned.picnum = EXPLOSTART;
spawned.lotag = 12;
}
spawned.backuploc();
}
void trailingsmoke(DWHActor* actor, boolean ball) {
@ -1494,6 +1497,7 @@ void trailingsmoke(DWHActor* actor, boolean ball) {
spawned.owner = spr.owner;
spawned.lotag = 256;
spawned.hitag = 0;
spawned.backuploc();
}
void icecubes(int i, int x, int y, int z, int owner) {
@ -1525,6 +1529,7 @@ void icecubes(int i, int x, int y, int z, int owner) {
spawned.lotag = 2048;
else spawned.lotag = 999;
spawned.hitag = 0;
spawned.backuploc();
}
@ -1834,6 +1839,7 @@ void trowajavlin(int s) {
spawned.lotag = 0;
spawned.hitag = 0;
spawned.pal = 0;
spawned.backuploc();
}
void spawnhornskull(short i) {
@ -1851,6 +1857,7 @@ void spawnhornskull(short i) {
spawned.detail = HORNEDSKULLTYPE;
spawned.xrepeat = 64;
spawned.yrepeat = 64;
spawned.backuploc();
}
void spawnapentagram(int sn) {
@ -1873,6 +1880,7 @@ void spawnapentagram(int sn) {
spawned.detail = PENTAGRAMTYPE;
setsprite(j, spawned.x, spawned.y, spawned.z);
spawned.backuploc();
}
END_WH_NS

View file

@ -211,6 +211,7 @@ void initplayersprite(PLAYER& plr) {
plr.nightglowtime = -1;
plr.strongtime = -1;
plr.invisibletime = -1;
spr.backuploc();
}
void updateviewmap(PLAYER& plr) {
@ -434,6 +435,7 @@ void chunksofmeat(PLAYER& plr, DWHActor* hitActor, int hitx, int hity, int hitz,
spawned.pal = 0;
movesprite((short) j, (bcos(spawned.ang) * TICSPERFRAME) << 3,
(bsin(spawned.ang) * TICSPERFRAME) << 3, 0, 4 << 8, 4 << 8, 0);
spawned.backuploc();
}
}