cmd_serverfromclient.userdefined = &cmd_userdefined_null;
}
-void Cmd_Init_Commands(void)
+void Cmd_Init_Commands(qboolean dedicated_server)
{
//
// register our commands
void Cbuf_Lock(cmd_state_t *cmd);
void Cbuf_Unlock(cmd_state_t *cmd);
-void Cmd_Init_Commands(void);
+void Cmd_Init_Commands(qboolean dedicated_server);
/*! as new commands are generated from the console or keybindings,
* the text is added to the end of the command buffer.
mempool_t *collision_mempool;
-void Collision_Init_Commands (void)
+void Collision_Init (void)
{
Cvar_RegisterVariable(&collision_impactnudge);
Cvar_RegisterVariable(&collision_extendmovelength);
Cvar_RegisterVariable(&collision_triangle_bevelsides);
Cvar_RegisterVariable(&collision_triangle_axialsides);
Cvar_RegisterVariable(&collision_bih_fullrecursion);
-}
-
-void Collision_Init (void)
-{
collision_mempool = Mem_AllocPool("collision cache", 0, NULL);
Collision_Cache_Init(collision_mempool);
}
}
trace_t;
-void Collision_Init_Commands(void);
void Collision_Init(void);
void Collision_ClipTrace_Box(trace_t *trace, const vec3_t cmins, const vec3_t cmaxs, const vec3_t start, const vec3_t mins, const vec3_t maxs, const vec3_t end, int hitsupercontentsmask, int skipsupercontentsmask, int skipmaterialflagsmask, int boxsupercontents, int boxq3surfaceflags, const texture_t *boxtexture);
void Collision_ClipTrace_Point(trace_t *trace, const vec3_t cmins, const vec3_t cmaxs, const vec3_t start, int hitsupercontentsmask, int skipsupercontentsmask, int skipmaterialflagsmask, int boxsupercontents, int boxq3surfaceflags, const texture_t *boxtexture);
if (con_mutex) Thread_UnlockMutex(con_mutex);
}
-void Con_Init_Commands(void)
+/*
+================
+Con_Init
+================
+*/
+void Con_Init (void)
{
+ con_linewidth = 80;
+ ConBuffer_Init(&con, CON_TEXTSIZE, CON_MAXLINES, zonemempool);
+ if (Thread_HasThreads())
+ con_mutex = Thread_CreateMutex();
+
+ // Allocate a log queue, this will be freed after configs are parsed
+ logq_size = MAX_INPUTLINE;
+ logqueue = (unsigned char *)Mem_Alloc (tempmempool, logq_size);
+ logq_ind = 0;
+
Cvar_RegisterVariable (&sys_colortranslation);
Cvar_RegisterVariable (&sys_specialcharactertranslation);
Cmd_AddCommand(CMD_SHARED, "maps", Con_Maps_f, "list information about available maps");
Cmd_AddCommand(CMD_SHARED, "condump", Con_ConDump_f, "output console history to a file (see also log_file)");
-}
-
-/*
-================
-Con_Init
-================
-*/
-void Con_Init (void)
-{
- con_linewidth = 80;
- ConBuffer_Init(&con, CON_TEXTSIZE, CON_MAXLINES, zonemempool);
- if (Thread_HasThreads())
- con_mutex = Thread_CreateMutex();
-
- // Allocate a log queue, this will be freed after configs are parsed
- logq_size = MAX_INPUTLINE;
- logqueue = (unsigned char *)Mem_Alloc (tempmempool, logq_size);
- logq_ind = 0;
-
con_initialized = true;
Con_DPrint("Console initialized.\n");
}
void Host_LoadConfig_f(cmd_state_t *cmd);
extern cvar_t sv_writepicture_quality;
extern cvar_t r_texture_jpeg_fastpicmip;
-static void Host_InitLocal_Commands (void)
+static void Host_InitLocal (void)
{
Cmd_AddCommand(CMD_SHARED, "saveconfig", Host_SaveConfig_f, "save settings to config.cfg (or a specified filename) immediately (also automatic when quitting)");
Cmd_AddCommand(CMD_SHARED, "loadconfig", Host_LoadConfig_f, "reset everything and reload configs");
static qfile_t *locksession_fh = NULL;
static qboolean locksession_run = false;
-static void Host_InitSession_Commands(void)
-{
- Cvar_RegisterVariable(&sessionid);
- Cvar_RegisterVariable(&locksession);
-}
-
static void Host_InitSession(void)
{
int i;
char *buf;
+ Cvar_RegisterVariable(&sessionid);
+ Cvar_RegisterVariable(&locksession);
// load the session ID into the read-only cvar
if ((i = COM_CheckParm("-sessionid")) && (i + 1 < sys.argc))
int i;
const char* os;
char vabuf[1024];
+ qboolean dedicated_server = COM_CheckParm("-dedicated") || !cl_available;
cmd_state_t *cmd = &cmd_client;
host.state = host_init;
if (COM_CheckParm("-nostdout"))
sys_nostdout = 1;
- // Stage 0 - Initialize core subsystems (memory management, command interpreters)
- Memory_Init(); // used by everything
- Cmd_Init(); // initialize console command/cvar/alias/command execution systems
-
- // Stage 1 - Initialize all commands and cvars
- Cmd_Init_Commands();
+ // used by everything
+ Memory_Init();
+
+ // initialize console command/cvar/alias/command execution systems
+ Cmd_Init();
+
+ Cmd_Init_Commands(dedicated_server);
+
+ // initialize memory subsystem cvars/commands
Memory_Init_Commands();
- Con_Init_Commands();
- u8_Init_Commands();
+
+ // initialize console and logging and its cvars/commands
+ Con_Init();
+
+ // initialize various cvars that could not be initialized earlier
+ u8_Init();
Curl_Init_Commands();
Sys_Init_Commands();
COM_Init_Commands();
FS_Init_Commands();
- NetConn_Init_Commands();
- Crypto_Init_Commands();
- PRVM_Init_Commands();
- Mod_Init_Commands();
- World_Init_Commands();
- SV_Init_Commands();
- V_Init(); // some cvars needed by server player physics (cl_rollangle etc)
- Host_Init_Commands();
- Host_InitSession_Commands(); // register the cvars for session locking
- Host_InitLocal_Commands();
- TaskQueue_Init();
-
- // initialize console and logging and its cvars/commands
- Con_Init();
// initialize console window (only used by sys_win.c)
Sys_InitConsole();
// initialize filesystem (including fs_basedir, fs_gamedir, -game, scr_screenshot_name)
FS_Init();
+ // register the cvars for session locking
Host_InitSession();
// must be after FS_Init
Crypto_Init();
+ Crypto_Init_Commands();
NetConn_Init();
Curl_Init();
Mod_Init();
World_Init();
SV_Init();
+ V_Init(); // some cvars needed by server player physics (cl_rollangle etc)
+ Host_InitCommands();
+ Host_InitLocal();
Host_ServerOptions();
Thread_Init();
+ TaskQueue_Init();
CL_Init();
/*
==================
-Host_Init_Commands
+Host_InitCommands
==================
*/
-void Host_Init_Commands (void)
+void Host_InitCommands (void)
{
dpsnprintf(cls.userinfo, sizeof(cls.userinfo), "\\name\\player\\team\\none\\topcolor\\0\\bottomcolor\\0\\rate\\10000\\msg\\1\\noaim\\1\\*ver\\dp");
static void Mod_Precache_f(cmd_state_t *cmd);
static void Mod_Decompile_f(cmd_state_t *cmd);
static void Mod_GenerateLightmaps_f(cmd_state_t *cmd);
-void Mod_Init_Commands (void)
+void Mod_Init (void)
{
+ mod_mempool = Mem_AllocPool("modelinfo", 0, NULL);
+ Mem_ExpandableArray_NewArray(&models, mod_mempool, sizeof(dp_model_t), 16);
+
+ Mod_BrushInit();
+ Mod_AliasInit();
+ Mod_SpriteInit();
+
Cvar_RegisterVariable(&r_mipskins);
Cvar_RegisterVariable(&r_mipnormalmaps);
Cvar_RegisterVariable(&mod_generatelightmaps_unitspersample);
Cmd_AddCommand(CMD_CLIENT, "mod_generatelightmaps", Mod_GenerateLightmaps_f, "rebuilds lighting on current worldmodel");
}
-void Mod_Init (void)
-{
- mod_mempool = Mem_AllocPool("modelinfo", 0, NULL);
- Mem_ExpandableArray_NewArray(&models, mod_mempool, sizeof(dp_model_t), 16);
-
- Mod_BrushInit();
- Mod_AliasInit();
- Mod_SpriteInit();
-}
-
void Mod_RenderInit(void)
{
R_RegisterModule("Models", mod_start, mod_shutdown, mod_newmap, NULL, NULL);
extern cvar_t mod_q3bsp_lightgrid_world_surfaces;
extern cvar_t mod_q3bsp_lightgrid_bsp_surfaces;
-void Mod_Init_Commands (void);
void Mod_Init (void);
void Mod_Reload (void);
dp_model_t *Mod_LoadModel(dp_model_t *mod, qboolean crash, qboolean checkdisk);
}
#endif
-void NetConn_Init_Commands(void)
+void NetConn_Init(void)
{
+ int i;
+ lhnetaddress_t tempaddress;
+ netconn_mempool = Mem_AllocPool("network connections", 0, NULL);
Cmd_AddCommand(CMD_SHARED, "net_stats", Net_Stats_f, "print network statistics");
#ifdef CONFIG_MENU
Cmd_AddCommand(CMD_CLIENT, "net_slist", Net_Slist_f, "query dp master servers and print all server information");
Cvar_RegisterVariable(&sv_public);
Cvar_RegisterVariable(&sv_public_rejectreason);
Cvar_RegisterVariable(&sv_heartbeatperiod);
- for (int i = 0;sv_masters[i].name;i++)
+ for (i = 0;sv_masters[i].name;i++)
Cvar_RegisterVariable(&sv_masters[i]);
Cvar_RegisterVariable(&gameversion);
Cvar_RegisterVariable(&gameversion_min);
Cvar_RegisterVariable(&gameversion_max);
-}
-
-void NetConn_Init(void)
-{
- int i;
- lhnetaddress_t tempaddress;
- netconn_mempool = Mem_AllocPool("network connections", 0, NULL);
-
// COMMANDLINEOPTION: Server: -ip <ipaddress> sets the ip address of this machine for purposes of networking (default 0.0.0.0 also known as INADDR_ANY), use only if you have multiple network adapters and need to choose one specifically.
if ((i = COM_CheckParm("-ip")) && i + 1 < sys.argc)
{
void NetConn_UpdateSockets(void);
lhnetsocket_t *NetConn_ChooseClientSocketForAddress(lhnetaddress_t *address);
lhnetsocket_t *NetConn_ChooseServerSocketForAddress(lhnetaddress_t *address);
-void NetConn_Init_Commands(void);
void NetConn_Init(void);
void NetConn_Shutdown(void);
netconn_t *NetConn_Open(lhnetsocket_t *mysocket, lhnetaddress_t *peeraddress);
void VM_Cmd_Init(prvm_prog_t *prog);
void VM_Cmd_Reset(prvm_prog_t *prog);
//============================================================================
-void PRVM_Init_Commands (void);
+
void PRVM_Init (void);
#ifdef PROFILING
PRVM_UpdateBreakpoints(prog);
}
-void PRVM_Init_Commands (void)
+/*
+===============
+PRVM_Init
+===============
+*/
+void PRVM_Init (void)
{
Cmd_AddCommand(CMD_SHARED, "prvm_edict", PRVM_ED_PrintEdict_f, "print all data about an entity number in the selected VM (server, client, menu)");
Cmd_AddCommand(CMD_SHARED, "prvm_edicts", PRVM_ED_PrintEdicts_f, "prints all data about all entities in the selected VM (server, client, menu)");
Cvar_RegisterVariable (&prvm_garbagecollection_scan_limit);
Cvar_RegisterVariable (&prvm_garbagecollection_strings);
Cvar_RegisterVariable (&prvm_stringdebug);
-}
-/*
-===============
-PRVM_Init
-===============
-*/
-void PRVM_Init (void)
-{
// COMMANDLINEOPTION: PRVM: -norunaway disables the runaway loop check (it might be impossible to exit DarkPlaces if used!)
prvm_runawaycheck = !COM_CheckParm("-norunaway");
extern host_t host;
-void Host_Init_Commands(void);
+void Host_InitCommands(void);
void Host_Main(void);
void Host_Shutdown(void);
void Host_StartVideo(void);
//===========================================================
-void SV_Init_Commands(void);
void SV_Init (void);
void SV_StartParticle (vec3_t org, vec3_t dir, int color, int count);
World_PrintAreaStats(&sv.world, "server");
}
-void SV_Init_Commands(void)
+/*
+===============
+SV_Init
+===============
+*/
+void SV_Init (void)
{
// init the csqc progs cvars, since they are updated/used by the server code
// TODO: fix this since this is a quick hack to make some of [515]'s broken code run ;) [9/13/2006 Black]
extern cvar_t csqc_progcrc;
extern cvar_t csqc_progsize;
extern cvar_t csqc_usedemoprogs;
+
Cvar_RegisterVariable(&sv_worldmessage);
Cvar_RegisterVariable(&sv_worldname);
Cvar_RegisterVariable(&sv_worldnamenoextension);
Cvar_RegisterVariable (&halflifebsp);
Cvar_RegisterVariable (&sv_mapformat_is_quake2);
Cvar_RegisterVariable (&sv_mapformat_is_quake3);
-}
-/*
-===============
-SV_Init
-===============
-*/
-void SV_Init (void)
-{
sv_mempool = Mem_AllocPool("server", 0, NULL);
}
// for compatibility this defaults to 0
cvar_t utf8_enable = {CVAR_CLIENT | CVAR_SERVER | CVAR_SAVE, "utf8_enable", "0", "Enable UTF-8 support. For compatibility, this is disabled by default in most games."};
-void u8_Init_Commands(void)
+void u8_Init(void)
{
Cvar_RegisterVariable(&utf8_enable);
}
// u8_byteofs() and u8_charidx() will simply return whatever is passed as index parameter
// u8_getchar() will will just return the next byte, u8_fromchar will write one byte, ...
extern cvar_t utf8_enable;
-void u8_Init_Commands(void);
+void u8_Init(void);
size_t u8_strlen(const char*);
size_t u8_strnlen(const char*, size_t);
line of sight checks trace->inopen and trace->inwater, but bullets don't
*/
-static void World_Physics_Init_Commands(void);
-static void World_Physics_Init(void);
-void World_Init_Commands(void)
-{
- Collision_Init_Commands();
- World_Physics_Init_Commands();
-}
+static void World_Physics_Init(void);
void World_Init(void)
{
Collision_Init();
#endif
#endif
-static void World_Physics_Init_Commands(void)
+static void World_Physics_Init(void)
{
#ifdef USEODE
+#ifndef LINK_TO_LIBODE
+ const char* dllnames [] =
+ {
+# if defined(WIN32)
+ "libode3.dll",
+ "libode2.dll",
+ "libode1.dll",
+# elif defined(MACOSX)
+ "libode.3.dylib",
+ "libode.2.dylib",
+ "libode.1.dylib",
+# else
+ "libode.so.3",
+ "libode.so.2",
+ "libode.so.1",
+# endif
+ NULL
+ };
+#endif
+
Cvar_RegisterVariable(&physics_ode_quadtree_depth);
Cvar_RegisterVariable(&physics_ode_contactsurfacelayer);
Cvar_RegisterVariable(&physics_ode_worldstep_iterations);
Cvar_RegisterVariable(&physics_ode_printstats);
Cvar_RegisterVariable(&physics_ode_allowconvex);
Cvar_RegisterVariable(&physics_ode);
-#endif
-}
-
-static void World_Physics_Init(void)
-{
-#ifdef USEODE
-#ifndef LINK_TO_LIBODE
- const char* dllnames [] =
- {
-# if defined(WIN32)
- "libode3.dll",
- "libode2.dll",
- "libode1.dll",
-# elif defined(MACOSX)
- "libode.3.dylib",
- "libode.2.dylib",
- "libode.1.dylib",
-# else
- "libode.so.3",
- "libode.so.2",
- "libode.so.1",
-# endif
- NULL
- };
-#endif
#ifndef LINK_TO_LIBODE
// Load the DLL
void World_RemoveLink(link_t *l);
void World_InsertLinkBefore(link_t *l, link_t *before, int entitynumber);
-void World_Init_Commands(void);
void World_Init(void);
void World_Shutdown(void);