#include <time.h>
#include "quakedef.h"
+#include "libcurl.h"
#include "cdaudio.h"
#include "cl_video.h"
#include "progsvm.h"
cvar_t temp1 = {0, "temp1","0", "general cvar for mods to use, in stock id1 this selects which death animation to use on players (0 = random death, other values select specific death scenes)"};
cvar_t timestamps = {CVAR_SAVE, "timestamps", "0", "prints timestamps on console messages"};
-cvar_t timeformat = {CVAR_SAVE, "timeformat", "[%b %e %X] ", "time format to use on timestamped console messages"};
+cvar_t timeformat = {CVAR_SAVE, "timeformat", "[%Y-%m-%d %H:%M:%S] ", "time format to use on timestamped console messages"};
/*
================
Sys_Error ("Host_Error: recursively entered (original error was: %s new error is: %s)", hosterrorstring2, hosterrorstring1);
hosterror = true;
- strcpy(hosterrorstring2, hosterrorstring1);
+ strlcpy(hosterrorstring2, hosterrorstring1, sizeof(hosterrorstring2));
CL_Parse_DumpPacket();
static void Host_Init(void);
void Host_Main(void)
{
- double frameoldtime, framenewtime, frametime, cl_timer, sv_timer;
+ static double time1 = 0;
+ static double time2 = 0;
+ static double time3 = 0;
+ // these are static because of setjmp/longjmp warnings in mingw32 gcc 2.95.3
+ static double frameoldtime, framenewtime, frametime, cl_timer, sv_timer;
Host_Init();
framenewtime = Sys_DoubleTime();
for (;;)
{
- static double time1 = 0;
- static double time2 = 0;
- static double time3 = 0;
+ if (setjmp(host_abortframe))
+ continue; // something bad happened, or the server disconnected
frameoldtime = framenewtime;
framenewtime = Sys_DoubleTime();
cl_timer += frametime;
sv_timer += frametime;
- if (setjmp(host_abortframe))
- continue; // something bad happened, or the server disconnected
-
if (slowmo.value < 0)
Cvar_SetValue("slowmo", 0);
if (host_framerate.value < 0.00001 && host_framerate.value != 0)
NetConn_UpdateSockets();
+ Curl_Run();
+
//-------------------
//
// server operations
//
//-------------------
+ // check for commands typed to the host
+ Host_GetConsoleCommands();
+
if (sv_timer > 0)
{
if (!sv.active)
// the middle of Host_Frame
NetConn_ServerFrame();
- // check for commands typed to the host
- Host_GetConsoleCommands();
-
// run the world state
// don't allow simulation to run too fast or too slow or logic glitches can occur
// stop running server frames if the wall time reaches this value
- if (sys_ticrate.value <= 0 || (cl.islocalgame && !sv_fixedframeratesingleplayer.integer))
+ if (sys_ticrate.value <= 0)
advancetime = sv_timer;
+ else if (cl.islocalgame && !sv_fixedframeratesingleplayer.integer)
+ {
+ // synchronize to the client frametime, but no less than 10ms and no more than sys_ticrate
+ advancetime = bound(0.01, cl_timer, sys_ticrate.value);
+ framelimit = 10;
+ aborttime = Sys_DoubleTime() + 0.1;
+ }
else
{
advancetime = sys_ticrate.value;
// decide the simulation time
if (!cls.timedemo)
{
- if (cls.capturevideo_active && !cls.capturevideo_soundfile)
+ if (cls.capturevideo.active)
{
- frametime = 1.0 / cls.capturevideo_framerate;
- cl.realframetime = max(cl.realframetime, frametime);
+ if (cls.capturevideo.realtime)
+ frametime = cl.realframetime = max(cl.realframetime, 1.0 / cls.capturevideo.framerate);
+ else
+ {
+ frametime = 1.0 / cls.capturevideo.framerate;
+ cl.realframetime = max(cl.realframetime, frametime);
+ }
}
else if (vid_activewindow)
frametime = cl.realframetime = max(cl.realframetime, 1.0 / cl_maxfps.value);
csqc_usecsqclistener = false;
}
else
- S_Update(&r_refdef.viewentitymatrix);
+ S_Update(&r_view.matrix);
CDAudio_Update();
}
extern void PR_Cmd_Init(void);
extern void COM_Init_Commands(void);
extern void FS_Init_Commands(void);
-extern void COM_CheckRegistered(void);
extern qboolean host_stuffcmdsrun;
/*
int i;
const char* os;
+ // LordHavoc: quake never seeded the random number generator before... heh
+ srand(time(NULL));
+
// FIXME: this is evil, but possibly temporary
// COMMANDLINEOPTION: Console: -developer enables warnings and other notices (RECOMMENDED for mod developers)
if (COM_CheckParm("-developer"))
developer_memorydebug.string = "100";
}
- // LordHavoc: quake never seeded the random number generator before... heh
- srand(time(NULL));
+// COMMANDLINEOPTION: Console: -nostdout disables text output to the terminal the game was launched from
+ if (COM_CheckParm("-nostdout"))
+ sys_nostdout = 1;
// used by everything
Memory_Init();
- // initialize console and logging
- Con_Init();
-
// initialize console command/cvar/alias/command execution systems
Cmd_Init();
- // parse commandline
- COM_InitArgv();
+ // initialize memory subsystem cvars/commands
+ Memory_Init_Commands();
+
+ // initialize console and logging and its cvars/commands
+ Con_Init();
+
+ // initialize various cvars that could not be initialized earlier
+ Curl_Init_Commands();
+ Cmd_Init_Commands();
+ Sys_Init_Commands();
+ COM_Init_Commands();
+ FS_Init_Commands();
// initialize console window (only used by sys_win.c)
Sys_InitConsole();
os = "Unknown";
#endif
dpsnprintf (engineversion, sizeof (engineversion), "%s %s %s", gamename, os, buildstring);
+ Con_Printf("%s\n", engineversion);
-// COMMANDLINEOPTION: Console: -nostdout disables text output to the terminal the game was launched from
- if (COM_CheckParm("-nostdout"))
- sys_nostdout = 1;
- else
- Con_Printf("%s\n", engineversion);
+ // initialize ixtable
+ Mathlib_Init();
// initialize filesystem (including fs_basedir, fs_gamedir, -path, -game, scr_screenshot_name)
FS_Init();
- // initialize various cvars that could not be initialized earlier
- Memory_Init_Commands();
- Con_Init_Commands();
- Cmd_Init_Commands();
- Sys_Init_Commands();
- COM_Init_Commands();
- FS_Init_Commands();
- COM_CheckRegistered();
-
- // initialize ixtable
- Mathlib_Init();
-
NetConn_Init();
+ Curl_Init();
//PR_Init();
//PR_Cmd_Init();
PRVM_Init();
CDAudio_Shutdown ();
S_Terminate ();
+ Curl_Shutdown ();
NetConn_Shutdown ();
//PR_Shutdown ();