diff --git a/polymer/eduke32/source/demo.c b/polymer/eduke32/source/demo.c index 9ec0ff8f7..58f346d1a 100644 --- a/polymer/eduke32/source/demo.c +++ b/polymer/eduke32/source/demo.c @@ -40,11 +40,11 @@ int32_t g_demo_rewind=0; int32_t g_demo_showStats=1; static int32_t g_demo_soundToggle; -static int32_t demo_hasdiffs, demorec_diffs=1, demorec_difftics = 2*(TICRATE/TICSPERFRAME); +static int32_t demo_hasdiffs, demorec_diffs=1, demorec_difftics = 2*REALGAMETICSPERSEC; int32_t demoplay_diffs=1; int32_t demorec_diffs_cvar=1; int32_t demorec_force_cvar=0; -int32_t demorec_difftics_cvar = 2*(TICRATE/TICSPERFRAME); +int32_t demorec_difftics_cvar = 2*REALGAMETICSPERSEC; int32_t demorec_diffcompress_cvar=1; int32_t demorec_synccompress_cvar=1; int32_t demorec_seeds_cvar=1; @@ -114,7 +114,7 @@ static int32_t G_OpenDemoRead(int32_t g_whichDemo) // 0 = mine demo_hasseeds = demo_synccompress&2; demo_synccompress &= 1; - i = g_demo_totalCnt/(TICRATE/TICSPERFRAME); + i = g_demo_totalCnt/REALGAMETICSPERSEC; OSD_Printf("demo %d duration: %d min %d sec\n", g_whichDemo, i/60, i%60); g_demo_cnt = 1; @@ -494,7 +494,7 @@ RECHECK: } while (totalclock >= (lockclock+TICSPERFRAME) - // || (ud.reccnt > (TICRATE/TICSPERFRAME)*2 && ud.pause_on) + // || (ud.reccnt > REALGAMETICSPERSEC*2 && ud.pause_on) || (g_demo_goalCnt>0 && g_demo_cnt 0) { // smoothratio = min(max(smoothratio,0),65536); - smoothratio = min(max((totalclock - ototalclock) * (65536 / 4),0),65536); + smoothratio = calc_smoothratio(totalclock, ototalclock); G_DoInterpolations(smoothratio); + if (ud.scrollmode == 0) { if (pp->newowner == -1 && !ud.pause_on) @@ -7638,7 +7639,7 @@ void G_HandleLocalKeys(void) { KB_ClearKeyDown(sc_kpad_6); j = (15< g_demo_totalCnt) @@ -7650,7 +7651,7 @@ void G_HandleLocalKeys(void) { KB_ClearKeyDown(sc_kpad_4); j = (15<gm&MODE_MENU)) || (g_netServer || ud.multimode > 1) || ud.recstat == 2) - i = min(max((totalclock-ototalclock)*(65536L/TICSPERFRAME),0),65536); + i = calc_smoothratio(totalclock, ototalclock); else i = 65536; diff --git a/polymer/eduke32/source/game.h b/polymer/eduke32/source/game.h index 2c1cfcd63..3f64f3b6c 100644 --- a/polymer/eduke32/source/game.h +++ b/polymer/eduke32/source/game.h @@ -340,6 +340,11 @@ static inline void G_HandleAsync(void) Net_GetPackets(); } +static inline int32_t calc_smoothratio(int32_t totalclk, int32_t ototalclk) +{ + return clamp((totalclk-ototalclk)*(65536/TICSPERFRAME), 0, 65536); +} + // sector effector lotags enum { SE_16_REACTOR = 16, diff --git a/polymer/eduke32/source/gameexec.c b/polymer/eduke32/source/gameexec.c index 6b999166f..99fd0ec11 100644 --- a/polymer/eduke32/source/gameexec.c +++ b/polymer/eduke32/source/gameexec.c @@ -2415,7 +2415,7 @@ nullquote: int32_t y1=Gv_GetVarX(*insptr++); int32_t x2=Gv_GetVarX(*insptr++); int32_t y2=Gv_GetVarX(*insptr++); - int32_t smoothratio = min(max((totalclock - ototalclock) * (65536 / 4),0),65536); + int32_t smoothratio = calc_smoothratio(totalclock, ototalclock); #ifdef USE_OPENGL int32_t oprojhacks; #endif @@ -2479,11 +2479,6 @@ nullquote: newaspect_enable = o; } -#if 0 - if (!ud.pause_on && ((ud.show_help == 0 && (!net_server && ud.multimode < 2) && !(g_player[myconnectindex].ps->gm&MODE_MENU)) - || (net_server || ud.multimode > 1) || ud.recstat == 2)) - smoothratio = min(max((totalclock-ototalclock)*(65536L/TICSPERFRAME),0),65536); -#endif G_DoInterpolations(smoothratio); G_HandleMirror(x, y, z, a, horiz, smoothratio); diff --git a/polymer/eduke32/source/osdcmds.c b/polymer/eduke32/source/osdcmds.c index a8828077d..3c692083a 100644 --- a/polymer/eduke32/source/osdcmds.c +++ b/polymer/eduke32/source/osdcmds.c @@ -1403,7 +1403,7 @@ int32_t registerosdcommands(void) { "demorec_force","demorec_force: enable/disable forced demo recording",(void *)&demorec_force_cvar, CVAR_BOOL|CVAR_NOSAVE, 0, 1 }, { "demorec_difftics","demorec_difftics : sets game tic interval after which a diff is recorded", - (void *)&demorec_difftics_cvar, CVAR_INT, 2, 60*(TICRATE/TICSPERFRAME) + (void *)&demorec_difftics_cvar, CVAR_INT, 2, 60*REALGAMETICSPERSEC }, { "demorec_diffcompress","demorec_diffcompress : Compression method for diffs. (0: none, 1: KSLZW)",(void *)&demorec_diffcompress_cvar, CVAR_INT, 0, 1 }, { "demorec_synccompress","demorec_synccompress : Compression method for input. (0: none, 1: KSLZW)",(void *)&demorec_synccompress_cvar, CVAR_INT, 0, 1 },