mirror of
https://git.code.sf.net/p/quake/newtree
synced 2025-05-31 17:21:46 +00:00
cl_demospeed cvar. 1 = normal speed, < 1 = slow-mo, > 1 = timelaps.
host.h: remove Host_SimulationTime prototype cl_main.c: cl_demospeed stuff. Host_SimulationTime was resurected because of gcc warnings about setjmp clobbering vars. It's made static inline so its resurection doesn't cost fps.
This commit is contained in:
parent
c2194db299
commit
3320cf5e2c
2 changed files with 13 additions and 17 deletions
|
@ -64,7 +64,6 @@ void Host_Init (void);
|
||||||
void Host_Shutdown(void);
|
void Host_Shutdown(void);
|
||||||
void Host_Error (char *error, ...) __attribute__((format(printf,1,2)));
|
void Host_Error (char *error, ...) __attribute__((format(printf,1,2)));
|
||||||
void Host_EndGame (char *message, ...) __attribute__((format(printf,1,2)));
|
void Host_EndGame (char *message, ...) __attribute__((format(printf,1,2)));
|
||||||
qboolean Host_SimulationTime(float time);
|
|
||||||
void Host_Frame (float time);
|
void Host_Frame (float time);
|
||||||
void Host_Quit_f (void);
|
void Host_Quit_f (void);
|
||||||
void Host_ClientCommands (char *fmt, ...) __attribute__((format(printf,1,2)));
|
void Host_ClientCommands (char *fmt, ...) __attribute__((format(printf,1,2)));
|
||||||
|
|
|
@ -190,6 +190,7 @@ cvar_t *host_speeds; // set for running times
|
||||||
cvar_t *show_fps; // set for running times
|
cvar_t *show_fps; // set for running times
|
||||||
cvar_t *show_time;
|
cvar_t *show_time;
|
||||||
cvar_t *developer;
|
cvar_t *developer;
|
||||||
|
cvar_t *cl_demospeed;
|
||||||
|
|
||||||
int fps_count;
|
int fps_count;
|
||||||
|
|
||||||
|
@ -1204,6 +1205,8 @@ CL_Init_Cvars (void)
|
||||||
"display host processing times");
|
"display host processing times");
|
||||||
developer = Cvar_Get ("developer", "0", CVAR_NONE,
|
developer = Cvar_Get ("developer", "0", CVAR_NONE,
|
||||||
"show info interesting to developers");
|
"show info interesting to developers");
|
||||||
|
cl_demospeed = Cvar_Get ("cl_demospeed", "1.0", CVAR_NONE,
|
||||||
|
"adjust demo playback speed. 1.0 = normal, < 1 slow-mo, > 1 timelaps");
|
||||||
// Misty: Turn on or off screen filling colors for powerups among other things.
|
// Misty: Turn on or off screen filling colors for powerups among other things.
|
||||||
cl_cshift_bonus = Cvar_Get ("cl_cshift_bonus", "1", CVAR_ARCHIVE,
|
cl_cshift_bonus = Cvar_Get ("cl_cshift_bonus", "1", CVAR_ARCHIVE,
|
||||||
"Show bonus flash on item pickup");
|
"Show bonus flash on item pickup");
|
||||||
|
@ -1374,17 +1377,23 @@ Host_WriteConfiguration (void)
|
||||||
|
|
||||||
//============================================================================
|
//============================================================================
|
||||||
|
|
||||||
#if 0
|
|
||||||
/*
|
/*
|
||||||
Host_SimulationTime
|
Host_SimulationTime
|
||||||
|
|
||||||
This determines if enough time has passed to run a simulation frame
|
This determines if enough time has passed to run a simulation frame
|
||||||
*/
|
*/
|
||||||
qboolean
|
static inline qboolean
|
||||||
Host_SimulationTime (float time)
|
Host_SimulationTime (float time)
|
||||||
{
|
{
|
||||||
float fps;
|
float fps;
|
||||||
|
float timescale = 1.0;
|
||||||
|
|
||||||
|
if (cls.demoplayback) {
|
||||||
|
timescale = bound (0.1, cl_demospeed->value, 5);
|
||||||
|
time *= timescale;
|
||||||
|
}
|
||||||
|
|
||||||
|
realtime += time;
|
||||||
if (oldrealtime > realtime)
|
if (oldrealtime > realtime)
|
||||||
oldrealtime = 0;
|
oldrealtime = 0;
|
||||||
|
|
||||||
|
@ -1393,12 +1402,10 @@ Host_SimulationTime (float time)
|
||||||
else
|
else
|
||||||
fps = max (30.0, min (rate->value / 80.0, 72.0));
|
fps = max (30.0, min (rate->value / 80.0, 72.0));
|
||||||
|
|
||||||
if (!cls.timedemo && (realtime + time) - oldrealtime < 1.0 / fps)
|
if (!cls.timedemo && realtime - oldrealtime < timescale / fps)
|
||||||
return false; // framerate is too high
|
return false; // framerate is too high
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Host_Frame
|
Host_Frame
|
||||||
|
@ -1413,22 +1420,12 @@ Host_Frame (float time)
|
||||||
static double time2 = 0;
|
static double time2 = 0;
|
||||||
static double time3 = 0;
|
static double time3 = 0;
|
||||||
int pass1, pass2, pass3;
|
int pass1, pass2, pass3;
|
||||||
float fps;
|
|
||||||
|
|
||||||
if (setjmp (host_abort)) // something bad happened, or the server disconnected
|
if (setjmp (host_abort)) // something bad happened, or the server disconnected
|
||||||
return;
|
return;
|
||||||
|
|
||||||
// decide the simulation time
|
// decide the simulation time
|
||||||
realtime += time;
|
if (!Host_SimulationTime (time))
|
||||||
if (oldrealtime > realtime)
|
|
||||||
oldrealtime = 0;
|
|
||||||
|
|
||||||
if (cl_maxfps->value)
|
|
||||||
fps = max (30.0, min (cl_maxfps->value, 72.0));
|
|
||||||
else
|
|
||||||
fps = max (30.0, min (rate->value / 80.0, 72.0));
|
|
||||||
|
|
||||||
if (!cls.timedemo && realtime - oldrealtime < 1.0 / fps)
|
|
||||||
return; // framerate is too high
|
return; // framerate is too high
|
||||||
|
|
||||||
host_frametime = realtime - oldrealtime;
|
host_frametime = realtime - oldrealtime;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue