sfx_t* sfx;
char filename[MAX_QPATH];
- Host_StartVideo();
+ CL_StartVideo();
if (!enabled)
return;
command = Cmd_Argv(cmd, 1);
if (strcasecmp(command, "remap") != 0)
- Host_StartVideo();
+ CL_StartVideo();
if (strcasecmp(command, "on") == 0)
{
CL_UpdateEntityShading_Entity(r_refdef.scene.entities[i]);
}
+qbool vid_opened = false;
+void CL_StartVideo(void)
+{
+ if (!vid_opened && cls.state != ca_dedicated)
+ {
+ vid_opened = true;
+#ifdef WIN32
+ // make sure we open sockets before opening video because the Windows Firewall "unblock?" dialog can screw up the graphics context on some graphics drivers
+ NetConn_UpdateSockets();
+#endif
+ VID_Start();
+ CDAudio_Startup();
+ }
+}
+
extern cvar_t host_framerate;
extern cvar_t host_speeds;
void CL_VideoStart(char *filename, const char *subtitlesfile)
{
- Host_StartVideo();
+ CL_StartVideo();
if( cl_videos->state != CLVIDEO_UNUSED )
CL_CloseVideo( cl_videos );
char name[MAX_QPATH], subtitlesfile[MAX_QPATH];
const char *extension;
- Host_StartVideo();
+ CL_StartVideo();
if (Sys_CheckParm("-benchmark"))
return;
void CL_Shutdown (void);
void CL_Init (void);
+void CL_StartVideo(void);
+
void CL_EstablishConnection(const char *host, int firstarg);
void CL_Disconnect (void);
PRVM_Crash(MVM_prog);
#endif
- cl.csqc_loaded = false;
Cvar_SetValueQuick(&csqc_progcrc, -1);
Cvar_SetValueQuick(&csqc_progsize, -1);
Host_AbortCurrentFrame();
}
-static void Host_ServerOptions (void)
-{
- int i;
-
- // general default
- svs.maxclients = 8;
-
-// COMMANDLINEOPTION: Server: -dedicated [playerlimit] starts a dedicated server (with a command console), default playerlimit is 8
-// COMMANDLINEOPTION: Server: -listen [playerlimit] starts a multiplayer server with graphical client, like singleplayer but other players can connect, default playerlimit is 8
- // if no client is in the executable or -dedicated is specified on
- // commandline, start a dedicated server
- i = Sys_CheckParm ("-dedicated");
- if (i || !cl_available)
- {
- cls.state = ca_dedicated;
- // check for -dedicated specifying how many players
- if (i && i + 1 < sys.argc && atoi (sys.argv[i+1]) >= 1)
- svs.maxclients = atoi (sys.argv[i+1]);
- if (Sys_CheckParm ("-listen"))
- Con_Printf ("Only one of -dedicated or -listen can be specified\n");
- // default sv_public on for dedicated servers (often hosted by serious administrators), off for listen servers (often hosted by clueless users)
- Cvar_SetValue(&cvars_all, "sv_public", 1);
- }
- else if (cl_available)
- {
- // client exists and not dedicated, check if -listen is specified
- cls.state = ca_disconnected;
- i = Sys_CheckParm ("-listen");
- if (i)
- {
- // default players unless specified
- if (i + 1 < sys.argc && atoi (sys.argv[i+1]) >= 1)
- svs.maxclients = atoi (sys.argv[i+1]);
- }
- else
- {
- // default players in some games, singleplayer in most
- if (gamemode != GAME_GOODVSBAD2 && !IS_NEXUIZ_DERIVED(gamemode) && gamemode != GAME_BATTLEMECH)
- svs.maxclients = 1;
- }
- }
-
- svs.maxclients = svs.maxclients_next = bound(1, svs.maxclients, MAX_SCOREBOARD);
-
- svs.clients = (client_t *)Mem_Alloc(sv_mempool, sizeof(client_t) * svs.maxclients);
-
- if (svs.maxclients > 1 && !deathmatch.integer && !coop.integer)
- Cvar_SetValueQuick(&deathmatch, 1);
-}
-
/*
==================
Host_Quit_f
//============================================================================
-qbool vid_opened = false;
-void Host_StartVideo(void)
-{
- if (!vid_opened && cls.state != ca_dedicated)
- {
- vid_opened = true;
-#ifdef WIN32
- // make sure we open sockets before opening video because the Windows Firewall "unblock?" dialog can screw up the graphics context on some graphics drivers
- NetConn_UpdateSockets();
-#endif
- VID_Start();
- CDAudio_Startup();
- }
-}
-
char engineversion[128];
qbool sys_nostdout = false;
World_Init();
SV_Init();
Host_InitLocal();
- Host_ServerOptions();
Thread_Init();
TaskQueue_Init();
host.state = host_active;
- Host_StartVideo();
+ CL_StartVideo();
Log_Start();
void Host_Main(void);
double Host_Frame(double time);
void Host_Shutdown(void);
-void Host_StartVideo(void);
void Host_Error(const char *error, ...) DP_FUNC_PRINTF(1) DP_FUNC_NORETURN;
void Host_LockSession(void);
void Host_UnlockSession(void);
{
int m;
m = ((Cmd_Argc(cmd) < 2) ? -1 : atoi(Cmd_Argv(cmd, 1)));
- Host_StartVideo();
+ CL_StartVideo();
if(MR_ToggleMenu)
MR_ToggleMenu(m);
}
// FIXME: So we don't crash if a server is started early.
if(!vid_opened)
- Host_StartVideo();
+ CL_StartVideo();
model = Mod_FindName(name, parentname);
if (!model->loaded || checkdisk)
void PRVM_Crash(prvm_prog_t *prog)
{
char vabuf[1024];
+
+ cl.csqc_loaded = false;
+
if (prog == NULL)
return;
if (!prog->loaded)
void R_Modules_Restart_f(cmd_state_t *cmd)
{
- Host_StartVideo();
+ CL_StartVideo();
Con_Print("restarting renderer\n");
R_Modules_Shutdown();
R_Modules_Start();
}
+static void SV_ServerOptions (void)
+{
+ int i;
+
+ // general default
+ svs.maxclients = 8;
+
+// COMMANDLINEOPTION: Server: -dedicated [playerlimit] starts a dedicated server (with a command console), default playerlimit is 8
+// COMMANDLINEOPTION: Server: -listen [playerlimit] starts a multiplayer server with graphical client, like singleplayer but other players can connect, default playerlimit is 8
+ // if no client is in the executable or -dedicated is specified on
+ // commandline, start a dedicated server
+ i = Sys_CheckParm ("-dedicated");
+ if (i || !cl_available)
+ {
+ cls.state = ca_dedicated;
+ // check for -dedicated specifying how many players
+ if (i && i + 1 < sys.argc && atoi (sys.argv[i+1]) >= 1)
+ svs.maxclients = atoi (sys.argv[i+1]);
+ if (Sys_CheckParm ("-listen"))
+ Con_Printf ("Only one of -dedicated or -listen can be specified\n");
+ // default sv_public on for dedicated servers (often hosted by serious administrators), off for listen servers (often hosted by clueless users)
+ Cvar_SetValue(&cvars_all, "sv_public", 1);
+ }
+ else if (cl_available)
+ {
+ // client exists and not dedicated, check if -listen is specified
+ cls.state = ca_disconnected;
+ i = Sys_CheckParm ("-listen");
+ if (i)
+ {
+ // default players unless specified
+ if (i + 1 < sys.argc && atoi (sys.argv[i+1]) >= 1)
+ svs.maxclients = atoi (sys.argv[i+1]);
+ }
+ else
+ {
+ // default players in some games, singleplayer in most
+ if (gamemode != GAME_GOODVSBAD2 && !IS_NEXUIZ_DERIVED(gamemode) && gamemode != GAME_BATTLEMECH)
+ svs.maxclients = 1;
+ }
+ }
+
+ svs.maxclients = svs.maxclients_next = bound(1, svs.maxclients, MAX_SCOREBOARD);
+
+ svs.clients = (client_t *)Mem_Alloc(sv_mempool, sizeof(client_t) * svs.maxclients);
+
+ if (svs.maxclients > 1 && !deathmatch.integer && !coop.integer)
+ Cvar_SetValueQuick(&deathmatch, 1);
+}
+
/*
===============
SV_Init
Cvar_RegisterVariable (&sv_mapformat_is_quake2);
Cvar_RegisterVariable (&sv_mapformat_is_quake3);
+ SV_ServerOptions();
SV_InitOperatorCommands();
host.hook.SV_CanSave = SV_CanSave;
}
dllfunction_t;
+qbool Sys_LoadSelf(dllhandle_t *handle);
+
/*! Loads a library.
* \param dllnames a NULL terminated array of possible names for the DLL you want to load.
* \param handle
return false;
}
+qbool Sys_LoadSelf(dllhandle_t *handle)
+{
+ dllhandle_t dllhandle = 0;
+
+ if (handle == NULL)
+ return false;
+#ifdef WIN32
+ dllhandle = LoadLibrary (NULL);
+#else
+ dllhandle = dlopen (NULL, RTLD_NOW | RTLD_GLOBAL);
+#endif
+ *handle = dllhandle;
+ return true;
+}
+
qbool Sys_LoadLibrary (const char** dllnames, dllhandle_t* handle, const dllfunction_t *fcts)
{
#ifdef SUPPORTDLL
{NULL, NULL}
};
-// this is only called once by Host_StartVideo and again on each FS_GameDir_f
+// this is only called once by CL_StartVideo and again on each FS_GameDir_f
void VID_Start(void)
{
int i = 0;