From: Cloudwalk Date: Wed, 12 Aug 2020 14:54:28 +0000 (-0400) Subject: host: Initialize all cvars and commands before starting subsystems X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=daac07df64acbdb7c456accc45f375919350b55a;p=xonotic%2Fdarkplaces.git host: Initialize all cvars and commands before starting subsystems The goal is to have all cvars, mempools, and commands initialized before the subsystems themselves are started. This should be safe and cleans things up a bit for a future refactor. --- diff --git a/cd_shared.c b/cd_shared.c index 3eee8510..69c80a12 100644 --- a/cd_shared.c +++ b/cd_shared.c @@ -557,10 +557,17 @@ int CDAudio_Init (void) *remap[i] = 0; #endif - Cvar_RegisterVariable(&cdaudioinitialized); Cvar_SetValueQuick(&cdaudioinitialized, true); enabled = true; + return 0; +} + +void CDAudio_Init_Commands(void) +{ + int i; + + Cvar_RegisterVariable(&cdaudioinitialized); Cvar_RegisterVariable(&music_playlist_index); for (i = 0;i < MAX_PLAYLISTS;i++) { @@ -571,8 +578,6 @@ int CDAudio_Init (void) } Cmd_AddCommand(CMD_CLIENT | CMD_CLIENT_FROM_SERVER, "cd", CD_f, "execute a CD drive command (cd on/off/reset/remap/close/play/loop/stop/pause/resume/eject/info) - use cd by itself for usage"); - - return 0; } int CDAudio_Startup (void) diff --git a/cdaudio.h b/cdaudio.h index 6c46f602..1369cd3d 100644 --- a/cdaudio.h +++ b/cdaudio.h @@ -21,6 +21,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. extern cvar_t cdaudioinitialized; int CDAudio_Init(void); +void CDAudio_Init_Commands(void); void CDAudio_Play(int track, qboolean looping); void CDAudio_Stop(void); void CDAudio_Pause(void); diff --git a/cl_cmd.c b/cl_cmd.c index e8f90268..5070eebc 100644 --- a/cl_cmd.c +++ b/cl_cmd.c @@ -633,7 +633,7 @@ static void CL_PingPLReport_f(cmd_state_t *cmd) } } -void CL_InitCommands(void) +void CL_InitServer_Commands(void) { dpsnprintf(cls.userinfo, sizeof(cls.userinfo), "\\name\\player\\team\\none\\topcolor\\0\\bottomcolor\\0\\rate\\10000\\msg\\1\\noaim\\1\\*ver\\dp"); diff --git a/cl_main.c b/cl_main.c index de454ffe..8eeb0114 100644 --- a/cl_main.c +++ b/cl_main.c @@ -2915,25 +2915,19 @@ CL_Init void CL_Init (void) { if (cls.state == ca_dedicated) - { - Cmd_AddCommand(CMD_SERVER, "disconnect", CL_Disconnect_f, "disconnect from server (or disconnect all clients if running a server)"); - } + return; else { Con_Printf("Initializing client\n"); - R_Modules_Init(); Palette_Init(); -#ifdef CONFIG_MENU - MR_Init_Commands(); -#endif + VID_Shared_Init(); VID_Init(); Render_Init(); S_Init(); CDAudio_Init(); Key_Init(); - V_Init(); cls.levelmempool = Mem_AllocPool("client (per-level memory)", 0, NULL); cls.permanentmempool = Mem_AllocPool("client (long term memory)", 0, NULL); @@ -2947,12 +2941,53 @@ void CL_Init (void) r_refdef.scene.maxtempentities = MAX_TEMPENTITIES; r_refdef.scene.tempentities = (entity_render_t *)Mem_Alloc(cls.permanentmempool, sizeof(entity_render_t) * r_refdef.scene.maxtempentities); - CL_InitInput (); + Cvar_SetValueQuick(&qport, (rand() * RAND_MAX + rand()) & 0xffff); + + CL_Screen_Init(); + CL_MeshEntities_Init(); + + CL_Video_Init(); + + host.hook.ConnectLocal = CL_EstablishConnection_Local; - // - // register our commands - // - CL_InitCommands(); + #ifdef CONFIG_MENU + Cbuf_InsertText(&cmd_client,"menu_start\n"); + #endif + } +} + +void CL_Init_Commands(void) +{ + if (cls.state == ca_dedicated) + { + Cmd_AddCommand(CMD_SERVER, "disconnect", CL_Disconnect_f, "disconnect from server (or disconnect all clients if running a server)"); + } + else + { + // + // register our commands + // + R_Modules_Init(); + Palette_Init_Commands(); +#ifdef CONFIG_MENU + MR_Init_Commands(); +#endif + VID_Shared_Init_Commands(); + VID_Init_Commands(); + Render_Init_Commands(); + S_Init_Commands(); + CDAudio_Init_Commands(); + Key_Init_Commands(); + V_Init(); + + CL_InitInput(); + CL_Demo_Init(); + CL_Parse_Init(); + CL_Particles_Init(); + CL_Screen_Init_Commands(); + CL_Video_Init_Commands(); + + CL_InitServer_Commands(); Cvar_RegisterVariable (&cl_upspeed); Cvar_RegisterVariable (&cl_forwardspeed); @@ -2980,9 +3015,6 @@ void CL_Init (void) Cvar_RegisterVariable (&cl_itembobspeed); Cvar_RegisterVariable (&cl_itembobheight); - - CL_Demo_Init(); - Cmd_AddCommand(CMD_CLIENT, "entities", CL_PrintEntities_f, "print information on network entities known to client"); Cmd_AddCommand(CMD_CLIENT, "disconnect", CL_Disconnect_f, "disconnect from server (or disconnect all clients if running a server)"); Cmd_AddCommand(CMD_CLIENT, "connect", CL_Connect_f, "connect to a server by IP address or hostname"); @@ -3021,7 +3053,6 @@ void CL_Init (void) // for QW connections Cvar_RegisterVariable(&qport); - Cvar_SetValueQuick(&qport, (rand() * RAND_MAX + rand()) & 0xffff); Cmd_AddCommand(CMD_CLIENT, "timerefresh", CL_TimeRefresh_f, "turn quickly and print rendering statistcs"); @@ -3046,18 +3077,5 @@ void CL_Init (void) Cvar_RegisterVariable (&cl_maxfps); Cvar_RegisterVariable (&cl_maxfps_alwayssleep); Cvar_RegisterVariable (&cl_maxidlefps); - - CL_Parse_Init(); - CL_Particles_Init(); - CL_Screen_Init(); - CL_MeshEntities_Init(); - - CL_Video_Init(); - - host.hook.ConnectLocal = CL_EstablishConnection_Local; - - #ifdef CONFIG_MENU - Cbuf_InsertText(&cmd_client,"menu_start\n"); - #endif } -} +} \ No newline at end of file diff --git a/cl_particles.c b/cl_particles.c index 6ff07233..d788e34d 100644 --- a/cl_particles.c +++ b/cl_particles.c @@ -2438,13 +2438,17 @@ void R_Particles_Init (void) particle_elements[i*6+5] = i*4+3; } + R_RegisterModule("R_Particles", r_part_start, r_part_shutdown, r_part_newmap, NULL, NULL); +} + +void R_Particles_Init_Commands (void) +{ Cvar_RegisterVariable(&r_drawparticles); Cvar_RegisterVariable(&r_drawparticles_drawdistance); Cvar_RegisterVariable(&r_drawparticles_nearclip_min); Cvar_RegisterVariable(&r_drawparticles_nearclip_max); Cvar_RegisterVariable(&r_drawdecals); Cvar_RegisterVariable(&r_drawdecals_drawdistance); - R_RegisterModule("R_Particles", r_part_start, r_part_shutdown, r_part_newmap, NULL, NULL); } static void R_DrawParticle_TransparentCallback(const entity_render_t *ent, const rtlight_t *rtlight, int numsurfaces, int *surfacelist) diff --git a/cl_screen.c b/cl_screen.c index 67a9609d..c5adf194 100644 --- a/cl_screen.c +++ b/cl_screen.c @@ -1278,6 +1278,19 @@ void CL_Screen_Shutdown(void) } void CL_Screen_Init(void) +{ + // if we want no console, turn it off here too + if (COM_CheckParm ("-noconsole")) + Cvar_SetQuick(&scr_conforcewhiledisconnected, "0"); + +#ifdef CONFIG_VIDEO_CAPTURE + SCR_CaptureVideo_Ogg_Init(); +#endif + + scr_initialized = true; +} + +void CL_Screen_Init_Commands(void) { int i; Cvar_RegisterVariable (&scr_fov); @@ -1366,22 +1379,11 @@ void CL_Screen_Init(void) Cvar_RegisterVariable(&r_speeds_graph_height); Cvar_RegisterVariable(&r_speeds_graph_maxtimedelta); Cvar_RegisterVariable(&r_speeds_graph_maxdefault); - - // if we want no console, turn it off here too - if (COM_CheckParm ("-noconsole")) - Cvar_SetQuick(&scr_conforcewhiledisconnected, "0"); - Cmd_AddCommand(CMD_CLIENT, "sizeup",SCR_SizeUp_f, "increase view size (increases viewsize cvar)"); Cmd_AddCommand(CMD_CLIENT, "sizedown",SCR_SizeDown_f, "decrease view size (decreases viewsize cvar)"); Cmd_AddCommand(CMD_CLIENT, "screenshot",SCR_ScreenShot_f, "takes a screenshot of the next rendered frame"); Cmd_AddCommand(CMD_CLIENT, "envmap", R_Envmap_f, "render a cubemap (skybox) of the current scene"); Cmd_AddCommand(CMD_CLIENT, "infobar", SCR_InfoBar_f, "display a text in the infobar (usage: infobar expiretime string)"); - -#ifdef CONFIG_VIDEO_CAPTURE - SCR_CaptureVideo_Ogg_Init(); -#endif - - scr_initialized = true; } /* diff --git a/cl_screen.h b/cl_screen.h index faf906b2..ec1f2ca6 100644 --- a/cl_screen.h +++ b/cl_screen.h @@ -17,6 +17,7 @@ extern cvar_t scr_screenshot_name; void CL_Screen_NewMap(void); void CL_Screen_Init(void); +void CL_Screen_Init_Commands(void); void CL_Screen_Shutdown(void); void CL_UpdateScreen(void); diff --git a/cl_video.c b/cl_video.c index e9d5e21b..15be13e9 100644 --- a/cl_video.c +++ b/cl_video.c @@ -689,6 +689,13 @@ void CL_Video_Init( void ) bgra.i = 0;bgra.b[1] = 0xFF;cl_videogmask = bgra.i; bgra.i = 0;bgra.b[2] = 0xFF;cl_videormask = bgra.i; + R_RegisterModule( "CL_Video", cl_video_start, cl_video_shutdown, cl_video_newmap, NULL, NULL ); + + LibAvW_OpenLibrary(); +} + +void CL_Video_Init_Commands(void) +{ Cmd_AddCommand(CMD_CLIENT, "playvideo", CL_PlayVideo_f, "play a .dpv video file" ); Cmd_AddCommand(CMD_CLIENT, "stopvideo", CL_StopVideo_f, "stop playing a .dpv video file" ); @@ -704,10 +711,6 @@ void CL_Video_Init( void ) Cvar_RegisterVariable(&cl_video_fadeout); Cvar_RegisterVariable(&v_glslgamma_video); - - R_RegisterModule( "CL_Video", cl_video_start, cl_video_shutdown, cl_video_newmap, NULL, NULL ); - - LibAvW_OpenLibrary(); } void CL_Video_Shutdown( void ) diff --git a/cl_video.h b/cl_video.h index e96e2a47..e8744b98 100644 --- a/cl_video.h +++ b/cl_video.h @@ -82,6 +82,7 @@ void CL_PurgeOwner( int owner ); void CL_Video_Frame( void ); // update all videos void CL_Video_Init( void ); +void CL_Video_Init_Commands( void ); void CL_Video_Shutdown( void ); // old interface diff --git a/client.h b/client.h index a9a1eb36..5824d83a 100644 --- a/client.h +++ b/client.h @@ -1537,6 +1537,7 @@ double CL_Frame(double time); void CL_Shutdown (void); void CL_Init (void); +void CL_Init_Commands(void); void CL_EstablishConnection(const char *host, int firstarg); @@ -1605,7 +1606,7 @@ void CL_ForwardToServer (const char *s); /// things like godmode, noclip, etc, are commands directed to the server, /// so when they are typed in at the console, they will need to be forwarded. void CL_ForwardToServer_f (cmd_state_t *cmd); -void CL_InitCommands(void); +void CL_InitServer_Commands(void); // diff --git a/collision.c b/collision.c index 4f90e33f..01f1e670 100644 --- a/collision.c +++ b/collision.c @@ -23,6 +23,12 @@ cvar_t collision_bih_fullrecursion = {CVAR_CLIENT | CVAR_SERVER, "collision_bih_ mempool_t *collision_mempool; void Collision_Init (void) +{ + collision_mempool = Mem_AllocPool("collision cache", 0, NULL); + Collision_Cache_Init(collision_mempool); +} + +void Collision_Init_Commands(void) { Cvar_RegisterVariable(&collision_impactnudge); Cvar_RegisterVariable(&collision_extendmovelength); @@ -33,8 +39,6 @@ void Collision_Init (void) Cvar_RegisterVariable(&collision_triangle_bevelsides); Cvar_RegisterVariable(&collision_triangle_axialsides); Cvar_RegisterVariable(&collision_bih_fullrecursion); - collision_mempool = Mem_AllocPool("collision cache", 0, NULL); - Collision_Cache_Init(collision_mempool); } @@ -48,8 +52,6 @@ void Collision_Init (void) - - static void Collision_PrintBrushAsQHull(colbrushf_t *brush, const char *name) { int i; diff --git a/collision.h b/collision.h index 9984a166..9f85d635 100644 --- a/collision.h +++ b/collision.h @@ -68,6 +68,7 @@ typedef struct trace_s trace_t; void Collision_Init(void); +void Collision_Init_Commands(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); diff --git a/common.c b/common.c index 03b7087e..c92f8302 100644 --- a/common.c +++ b/common.c @@ -918,18 +918,11 @@ float Com_CalcRoll (const vec3_t angles, const vec3_t velocity, const vec_t angl COM_Init ================ */ -void COM_Init_Commands (void) +void COM_Init (void) { int i, j, n; char com_cmdline[MAX_INPUTLINE]; - Cvar_RegisterVariable (®istered); - Cvar_RegisterVariable (&cmdline); - Cvar_RegisterVariable(&cl_playermodel); - Cvar_RegisterAlias(&cl_playermodel, "_cl_playermodel"); - Cvar_RegisterVariable(&cl_playerskin); - Cvar_RegisterAlias(&cl_playerskin, "_cl_playerskin"); - // reconstitute the command line for the cmdline externally visible cvar n = 0; for (j = 0;(j < MAX_NUM_ARGVS) && (j < sys.argc);j++) @@ -966,6 +959,16 @@ void COM_Init_Commands (void) Cvar_SetQuick(&cmdline, com_cmdline); } +void COM_Init_Commands (void) +{ + Cvar_RegisterVariable (®istered); + Cvar_RegisterVariable (&cmdline); + Cvar_RegisterVariable(&cl_playermodel); + Cvar_RegisterAlias(&cl_playermodel, "_cl_playermodel"); + Cvar_RegisterVariable(&cl_playerskin); + Cvar_RegisterAlias(&cl_playerskin, "_cl_playerskin"); +} + /* ============ va diff --git a/console.c b/console.c index 7a523605..ddab28ad 100644 --- a/console.c +++ b/console.c @@ -873,18 +873,26 @@ void Con_Init (void) logqueue = (unsigned char *)Mem_Alloc (tempmempool, logq_size); logq_ind = 0; + // support for the classic Quake option +// COMMANDLINEOPTION: Console: -condebug logs console messages to qconsole.log, see also log_file + if (COM_CheckParm ("-condebug") != 0) + Cvar_SetQuick (&log_file, "qconsole.log"); + + con_initialized = true; + // initialize console window (only used by sys_win.c) + Sys_InitConsole(); + + Con_Print("Console initialized.\n"); +} + +void Con_Init_Commands(void) +{ Cvar_RegisterVariable (&sys_colortranslation); Cvar_RegisterVariable (&sys_specialcharactertranslation); Cvar_RegisterVariable (&log_file); Cvar_RegisterVariable (&log_file_stripcolors); Cvar_RegisterVariable (&log_dest_udp); - - // support for the classic Quake option -// COMMANDLINEOPTION: Console: -condebug logs console messages to qconsole.log, see also log_file - if (COM_CheckParm ("-condebug") != 0) - Cvar_SetQuick (&log_file, "qconsole.log"); - // register our cvars Cvar_RegisterVariable (&con_chat); Cvar_RegisterVariable (&con_chatpos); @@ -928,12 +936,6 @@ void Con_Init (void) Cmd_AddCommand(CMD_SHARED, "clear", Con_Clear_f, "clear console history"); 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_initialized = true; - // initialize console window (only used by sys_win.c) - Sys_InitConsole(); - - Con_Print("Console initialized.\n"); } void Con_Shutdown (void) diff --git a/fs.c b/fs.c index 3bedf6b0..d51a4fbb 100644 --- a/fs.c +++ b/fs.c @@ -2190,8 +2190,6 @@ void FS_Init(void) { fs_mempool = Mem_AllocPool("file management", 0, NULL); - FS_Init_Commands(); - PK3_OpenLibrary (); // initialize the self-pack (must be before COM_InitGameType as it may add command line options) diff --git a/ft2.c b/ft2.c index d4f9e07a..1752c7b8 100644 --- a/ft2.c +++ b/ft2.c @@ -421,6 +421,12 @@ void font_newmap(void) } void Font_Init(void) +{ + // let's open it at startup already + Font_OpenLibrary(); +} + +void Font_Init_Commands(void) { Cvar_RegisterVariable(&r_font_nonpoweroftwo); Cvar_RegisterVariable(&r_font_disable_freetype); @@ -430,9 +436,6 @@ void Font_Init(void) Cvar_RegisterVariable(&r_font_diskcache); Cvar_RegisterVariable(&r_font_compress); Cvar_RegisterVariable(&developer_font); - - // let's open it at startup already - Font_OpenLibrary(); } /* diff --git a/gl_backend.c b/gl_backend.c index f5317e01..8451c3ef 100644 --- a/gl_backend.c +++ b/gl_backend.c @@ -365,6 +365,11 @@ void gl_backend_init(void) for (i = 0;i < QUADELEMENTS_MAXQUADS*6;i++) quadelement3i[i] = quadelement3s[i]; + R_RegisterModule("GL_Backend", gl_backend_start, gl_backend_shutdown, gl_backend_newmap, gl_backend_devicelost, gl_backend_devicerestored); +} + +void gl_backend_init_Commands(void) +{ Cvar_RegisterVariable(&r_render); Cvar_RegisterVariable(&r_renderview); Cvar_RegisterVariable(&r_waterwarp); @@ -375,8 +380,6 @@ void gl_backend_init(void) Cvar_RegisterVariable(&gl_printcheckerror); Cmd_AddCommand(CMD_CLIENT, "gl_vbostats", GL_VBOStats_f, "prints a list of all buffer objects (vertex data and triangle elements) and total video memory used by them"); - - R_RegisterModule("GL_Backend", gl_backend_start, gl_backend_shutdown, gl_backend_newmap, gl_backend_devicelost, gl_backend_devicerestored); } void GL_SetMirrorState(qboolean state); diff --git a/gl_backend.h b/gl_backend.h index d12ab1c6..cc4b282d 100644 --- a/gl_backend.h +++ b/gl_backend.h @@ -61,6 +61,7 @@ extern cvar_t gl_printcheckerror; // adds console variables and registers the render module (only call from GL_Init) void gl_backend_init(void); +void gl_backend_init_Commands(void); // starts mesh rendering for the frame void R_Mesh_Start(void); diff --git a/gl_draw.c b/gl_draw.c index fd4eef5d..671ef1a3 100644 --- a/gl_draw.c +++ b/gl_draw.c @@ -735,19 +735,6 @@ void GL_Draw_Init (void) { int i, j; - Cvar_RegisterVariable(&r_font_postprocess_blur); - Cvar_RegisterVariable(&r_font_postprocess_outline); - Cvar_RegisterVariable(&r_font_postprocess_shadow_x); - Cvar_RegisterVariable(&r_font_postprocess_shadow_y); - Cvar_RegisterVariable(&r_font_postprocess_shadow_z); - Cvar_RegisterVariable(&r_font_hinting); - Cvar_RegisterVariable(&r_font_antialias); - Cvar_RegisterVariable(&r_textshadow); - Cvar_RegisterVariable(&r_textbrightness); - Cvar_RegisterVariable(&r_textcontrast); - Cvar_RegisterVariable(&r_nearest_2d); - Cvar_RegisterVariable(&r_nearest_conchars); - // allocate fonts storage fonts_mempool = Mem_AllocPool("FONTS", 0, NULL); dp_fonts.maxsize = MAX_FONTS; @@ -768,10 +755,26 @@ void GL_Draw_Init (void) if(!FONT_USER(i)->title[0]) dpsnprintf(FONT_USER(i)->title, sizeof(FONT_USER(i)->title), "user%d", j++); - Cmd_AddCommand(CMD_CLIENT, "loadfont", LoadFont_f, "loadfont function tganame loads a font; example: loadfont console gfx/veramono; loadfont without arguments lists the available functions"); R_RegisterModule("GL_Draw", gl_draw_start, gl_draw_shutdown, gl_draw_newmap, NULL, NULL); } +void GL_Draw_Init_Commands(void) +{ + Cvar_RegisterVariable(&r_font_postprocess_blur); + Cvar_RegisterVariable(&r_font_postprocess_outline); + Cvar_RegisterVariable(&r_font_postprocess_shadow_x); + Cvar_RegisterVariable(&r_font_postprocess_shadow_y); + Cvar_RegisterVariable(&r_font_postprocess_shadow_z); + Cvar_RegisterVariable(&r_font_hinting); + Cvar_RegisterVariable(&r_font_antialias); + Cvar_RegisterVariable(&r_textshadow); + Cvar_RegisterVariable(&r_textbrightness); + Cvar_RegisterVariable(&r_textcontrast); + Cvar_RegisterVariable(&r_nearest_2d); + Cvar_RegisterVariable(&r_nearest_conchars); + Cmd_AddCommand(CMD_CLIENT, "loadfont", LoadFont_f, "loadfont function tganame loads a font; example: loadfont console gfx/veramono; loadfont without arguments lists the available functions"); +} + void DrawQ_Start(void) { r_refdef.draw2dstage = 1; diff --git a/gl_rmain.c b/gl_rmain.c index 19f97cf8..45e44008 100644 --- a/gl_rmain.c +++ b/gl_rmain.c @@ -3224,10 +3224,17 @@ static void gl_main_newmap(void) void GL_Main_Init(void) { - int i; r_main_mempool = Mem_AllocPool("Renderer", 0, NULL); R_InitShaderModeInfo(); + if (gamemode == GAME_NEHAHRA || gamemode == GAME_TENEBRAE) + Cvar_SetValue(&cvars_all, "r_fullbrights", 0); + + R_RegisterModule("GL_Main", gl_main_start, gl_main_shutdown, gl_main_newmap, NULL, NULL); +} + +void GL_Main_Init_Commands(void) +{ Cmd_AddCommand(CMD_CLIENT, "r_glsl_restart", R_GLSL_Restart_f, "unloads GLSL shaders, they will then be reloaded as needed"); Cmd_AddCommand(CMD_CLIENT, "r_glsl_dumpshader", R_GLSL_DumpShader_f, "dumps the engine internal default.glsl shader into glsl/default.glsl"); // FIXME: the client should set up r_refdef.fog stuff including the fogmasktable @@ -3406,11 +3413,9 @@ void GL_Main_Init(void) Cvar_RegisterVariable(&r_glsl_saturation_redcompensate); Cvar_RegisterVariable(&r_glsl_vertextextureblend_usebothalphas); Cvar_RegisterVariable(&r_framedatasize); - for (i = 0;i < R_BUFFERDATA_COUNT;i++) + for (int i = 0;i < R_BUFFERDATA_COUNT;i++) Cvar_RegisterVariable(&r_buffermegs[i]); Cvar_RegisterVariable(&r_batch_dynamicbuffer); - if (gamemode == GAME_NEHAHRA || gamemode == GAME_TENEBRAE) - Cvar_SetValue(&cvars_all, "r_fullbrights", 0); #ifdef DP_MOBILETOUCH // GLES devices have terrible depth precision in general, so... Cvar_SetValueQuick(&r_nearclip, 4); @@ -3418,7 +3423,6 @@ void GL_Main_Init(void) Cvar_SetValueQuick(&r_farclip_world, 0); Cvar_SetValueQuick(&r_useinfinitefarclip, 0); #endif - R_RegisterModule("GL_Main", gl_main_start, gl_main_shutdown, gl_main_newmap, NULL, NULL); } void Render_Init(void) @@ -3430,7 +3434,7 @@ void Render_Init(void) GL_Draw_Init(); R_Shadow_Init(); R_Sky_Init(); - GL_Surf_Init(); + //GL_Surf_Init(); Sbar_Init(); R_Particles_Init(); R_Explosion_Init(); @@ -3438,6 +3442,22 @@ void Render_Init(void) Mod_RenderInit(); } +void Render_Init_Commands(void) +{ + gl_backend_init_Commands(); + R_Textures_Init_Commands(); + GL_Main_Init_Commands(); + Font_Init_Commands(); + GL_Draw_Init_Commands(); + R_Shadow_Init_Commands(); + R_Sky_Init_Commands(); + GL_Surf_Init(); + Sbar_Init_Commands(); + R_Particles_Init_Commands(); + R_Explosion_Init_Commands(); + R_LightningBeams_Init_Commands(); +} + int R_CullBox(const vec3_t mins, const vec3_t maxs) { int i; diff --git a/gl_textures.c b/gl_textures.c index eef12da9..eb8e8631 100644 --- a/gl_textures.c +++ b/gl_textures.c @@ -699,6 +699,11 @@ static void r_textures_devicerestored(void) void R_Textures_Init (void) +{ + R_RegisterModule("R_Textures", r_textures_start, r_textures_shutdown, r_textures_newmap, r_textures_devicelost, r_textures_devicerestored); +} + +void R_Textures_Init_Commands(void) { Cmd_AddCommand(CMD_CLIENT, "gl_texturemode", &GL_TextureMode_f, "set texture filtering mode (GL_NEAREST, GL_LINEAR, GL_LINEAR_MIPMAP_LINEAR, etc); an additional argument 'force' forces the texture mode even in cases where it may not be appropriate"); Cmd_AddCommand(CMD_CLIENT, "r_texturestats", R_TextureStats_f, "print information about all loaded textures and some statistics"); @@ -728,8 +733,6 @@ void R_Textures_Init (void) Cvar_RegisterVariable (&r_texture_dds_load_alphamode); Cvar_RegisterVariable (&r_texture_dds_load_logfailure); Cvar_RegisterVariable (&r_texture_dds_swdecode); - - R_RegisterModule("R_Textures", r_textures_start, r_textures_shutdown, r_textures_newmap, r_textures_devicelost, r_textures_devicerestored); } void R_Textures_Frame (void) diff --git a/host.c b/host.c index cf102463..3774863f 100644 --- a/host.c +++ b/host.c @@ -225,14 +225,14 @@ static void Host_Framerate_c(cvar_t *var) /* ======================= -Host_InitLocal +Host_InitLocal_Commands ====================== */ void Host_SaveConfig_f(cmd_state_t *cmd); 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 (void) +static void Host_InitLocal_Commands (void) { Cmd_AddCommand(CMD_SHARED, "quit", Host_Quit_f, "quit the game"); Cmd_AddCommand(CMD_SHARED, "version", Host_Version_f, "print engine version"); @@ -659,20 +659,42 @@ static void Host_Init (void) if (COM_CheckParm("-nostdout")) sys_nostdout = 1; + /* FIXME: We don't know if we're dedicated until after cvars are initialized + * yet we use this to gate off some cvars. Setting this early. + */ + if(!cl_available) + cls.state = ca_dedicated; + // initialize console command/cvar/alias/command execution systems Cmd_Init(); // initialize memory subsystem cvars/commands Memory_Init_Commands(); - // initialize console and logging and its cvars/commands - Con_Init(); - + // initialize console cvars/commands + Con_Init_Commands(); // initialize various cvars that could not be initialized earlier - u8_Init(); - Curl_Init_Commands(); + u8_Init_Commands(); Sys_Init_Commands(); COM_Init_Commands(); + FS_Init_Commands(); + Crypto_Init_Commands(); + NetConn_Init_Commands(); + Curl_Init_Commands(); + PRVM_Init_Commands(); + Mod_Init_Commands(); + World_Init_Commands(); + SV_Init_Commands(); + Host_InitLocal_Commands(); + TaskQueue_Init_Commands(); + CL_Init_Commands(); + + // register the cvars for session locking + Host_InitSession(); + + // initialize console and logging + Con_Init(); + COM_Init(); // initialize filesystem (including fs_basedir, fs_gamedir, -game, scr_screenshot_name) FS_Init(); @@ -688,12 +710,8 @@ static void Host_Init (void) // initialize ixtable Mathlib_Init(); - // register the cvars for session locking - Host_InitSession(); - // must be after FS_Init Crypto_Init(); - Crypto_Init_Commands(); NetConn_Init(); Curl_Init(); @@ -701,11 +719,9 @@ static void Host_Init (void) Mod_Init(); World_Init(); SV_Init(); - Host_InitLocal(); Host_ServerOptions(); Thread_Init(); - TaskQueue_Init(); CL_Init(); diff --git a/keys.c b/keys.c index 7363590e..9d219723 100644 --- a/keys.c +++ b/keys.c @@ -1707,7 +1707,11 @@ Key_Init (void) { Key_History_Init(); key_linepos = Key_ClearEditLine(true); +} +void +Key_Init_Commands (void) +{ // // register our functions // diff --git a/keys.h b/keys.h index 6c10a6f1..8f8a5f10 100644 --- a/keys.h +++ b/keys.h @@ -374,8 +374,8 @@ extern int chat_bufferpos; int Key_ClearEditLine(qboolean is_console); void Key_WriteBindings(qfile_t *f); void Key_Init(void); +void Key_Init_Commands(void); void Key_Shutdown(void); -void Key_Init_Cvars(void); void Key_Event(int key, int ascii, qboolean down); void Key_ReleaseAll (void); void Key_ReleaseAll_f(cmd_state_t *cmd); diff --git a/model_alias.c b/model_alias.c index 5aa98c53..7a41dc2a 100644 --- a/model_alias.c +++ b/model_alias.c @@ -189,6 +189,12 @@ static void Mod_Skeletal_AnimateVertices(const dp_model_t * RESTRICT model, cons void Mod_AliasInit (void) { int i; + for (i = 0;i < 320;i++) + mod_md3_sin[i] = sin(i * M_PI * 2.0f / 256.0); +} + +void Mod_AliasInit_Commands(void) +{ Cvar_RegisterVariable(&r_skeletal_debugbone); Cvar_RegisterVariable(&r_skeletal_debugbonecomponent); Cvar_RegisterVariable(&r_skeletal_debugbonevalue); @@ -197,8 +203,6 @@ void Mod_AliasInit (void) Cvar_RegisterVariable(&r_skeletal_debugtranslatez); Cvar_RegisterVariable(&mod_alias_supporttagscale); Cvar_RegisterVariable(&mod_alias_force_animated); - for (i = 0;i < 320;i++) - mod_md3_sin[i] = sin(i * M_PI * 2.0f / 256.0); #ifdef SSE_POSSIBLE if(Sys_HaveSSE()) { diff --git a/model_brush.c b/model_brush.c index 9c99ef4c..d888fa69 100644 --- a/model_brush.c +++ b/model_brush.c @@ -76,6 +76,39 @@ static texture_t mod_q1bsp_texture_water; static qboolean Mod_Q3BSP_TraceLineOfSight(struct model_s *model, const vec3_t start, const vec3_t end, const vec3_t acceptmins, const vec3_t acceptmaxs); void Mod_BrushInit(void) +{ + // these games were made for older DP engines and are no longer + // maintained; use this hack to show their textures properly + if(gamemode == GAME_NEXUIZ) + Cvar_SetQuick(&mod_q3shader_force_addalpha, "1"); + + memset(&mod_q1bsp_texture_solid, 0, sizeof(mod_q1bsp_texture_solid)); + strlcpy(mod_q1bsp_texture_solid.name, "solid" , sizeof(mod_q1bsp_texture_solid.name)); + mod_q1bsp_texture_solid.surfaceflags = 0; + mod_q1bsp_texture_solid.supercontents = SUPERCONTENTS_SOLID; + + mod_q1bsp_texture_sky = mod_q1bsp_texture_solid; + strlcpy(mod_q1bsp_texture_sky.name, "sky", sizeof(mod_q1bsp_texture_sky.name)); + mod_q1bsp_texture_sky.surfaceflags = Q3SURFACEFLAG_SKY | Q3SURFACEFLAG_NOIMPACT | Q3SURFACEFLAG_NOMARKS | Q3SURFACEFLAG_NODLIGHT | Q3SURFACEFLAG_NOLIGHTMAP; + mod_q1bsp_texture_sky.supercontents = SUPERCONTENTS_SKY | SUPERCONTENTS_NODROP; + + mod_q1bsp_texture_lava = mod_q1bsp_texture_solid; + strlcpy(mod_q1bsp_texture_lava.name, "*lava", sizeof(mod_q1bsp_texture_lava.name)); + mod_q1bsp_texture_lava.surfaceflags = Q3SURFACEFLAG_NOMARKS; + mod_q1bsp_texture_lava.supercontents = SUPERCONTENTS_LAVA | SUPERCONTENTS_NODROP; + + mod_q1bsp_texture_slime = mod_q1bsp_texture_solid; + strlcpy(mod_q1bsp_texture_slime.name, "*slime", sizeof(mod_q1bsp_texture_slime.name)); + mod_q1bsp_texture_slime.surfaceflags = Q3SURFACEFLAG_NOMARKS; + mod_q1bsp_texture_slime.supercontents = SUPERCONTENTS_SLIME; + + mod_q1bsp_texture_water = mod_q1bsp_texture_solid; + strlcpy(mod_q1bsp_texture_water.name, "*water", sizeof(mod_q1bsp_texture_water.name)); + mod_q1bsp_texture_water.surfaceflags = Q3SURFACEFLAG_NOMARKS; + mod_q1bsp_texture_water.supercontents = SUPERCONTENTS_WATER; +} + +void Mod_BrushInit_Commands(void) { // Cvar_RegisterVariable(&r_subdivide_size); Cvar_RegisterVariable(&mod_bsp_portalize); @@ -116,36 +149,6 @@ void Mod_BrushInit(void) Cvar_RegisterVariable(&mod_q3shader_force_terrain_alphaflag); Cvar_RegisterVariable(&mod_q1bsp_polygoncollisions); Cvar_RegisterVariable(&mod_recalculatenodeboxes); - - // these games were made for older DP engines and are no longer - // maintained; use this hack to show their textures properly - if(gamemode == GAME_NEXUIZ) - Cvar_SetQuick(&mod_q3shader_force_addalpha, "1"); - - memset(&mod_q1bsp_texture_solid, 0, sizeof(mod_q1bsp_texture_solid)); - strlcpy(mod_q1bsp_texture_solid.name, "solid" , sizeof(mod_q1bsp_texture_solid.name)); - mod_q1bsp_texture_solid.surfaceflags = 0; - mod_q1bsp_texture_solid.supercontents = SUPERCONTENTS_SOLID; - - mod_q1bsp_texture_sky = mod_q1bsp_texture_solid; - strlcpy(mod_q1bsp_texture_sky.name, "sky", sizeof(mod_q1bsp_texture_sky.name)); - mod_q1bsp_texture_sky.surfaceflags = Q3SURFACEFLAG_SKY | Q3SURFACEFLAG_NOIMPACT | Q3SURFACEFLAG_NOMARKS | Q3SURFACEFLAG_NODLIGHT | Q3SURFACEFLAG_NOLIGHTMAP; - mod_q1bsp_texture_sky.supercontents = SUPERCONTENTS_SKY | SUPERCONTENTS_NODROP; - - mod_q1bsp_texture_lava = mod_q1bsp_texture_solid; - strlcpy(mod_q1bsp_texture_lava.name, "*lava", sizeof(mod_q1bsp_texture_lava.name)); - mod_q1bsp_texture_lava.surfaceflags = Q3SURFACEFLAG_NOMARKS; - mod_q1bsp_texture_lava.supercontents = SUPERCONTENTS_LAVA | SUPERCONTENTS_NODROP; - - mod_q1bsp_texture_slime = mod_q1bsp_texture_solid; - strlcpy(mod_q1bsp_texture_slime.name, "*slime", sizeof(mod_q1bsp_texture_slime.name)); - mod_q1bsp_texture_slime.surfaceflags = Q3SURFACEFLAG_NOMARKS; - mod_q1bsp_texture_slime.supercontents = SUPERCONTENTS_SLIME; - - mod_q1bsp_texture_water = mod_q1bsp_texture_solid; - strlcpy(mod_q1bsp_texture_water.name, "*water", sizeof(mod_q1bsp_texture_water.name)); - mod_q1bsp_texture_water.surfaceflags = Q3SURFACEFLAG_NOMARKS; - mod_q1bsp_texture_water.supercontents = SUPERCONTENTS_WATER; } static mleaf_t *Mod_BSP_PointInLeaf(dp_model_t *model, const vec3_t p) diff --git a/model_shared.c b/model_shared.c index 65a4e155..c587a347 100644 --- a/model_shared.c +++ b/model_shared.c @@ -181,7 +181,13 @@ void Mod_Init (void) Mod_BrushInit(); Mod_AliasInit(); - Mod_SpriteInit(); +} + +void Mod_Init_Commands(void) +{ + Mod_BrushInit_Commands(); + Mod_AliasInit_Commands(); + Mod_SpriteInit_Commands(); Cvar_RegisterVariable(&r_mipskins); Cvar_RegisterVariable(&r_mipnormalmaps); diff --git a/model_shared.h b/model_shared.h index 5c38de4d..13152c0d 100644 --- a/model_shared.h +++ b/model_shared.h @@ -1099,6 +1099,7 @@ extern cvar_t mod_q3bsp_lightgrid_world_surfaces; extern cvar_t mod_q3bsp_lightgrid_bsp_surfaces; void Mod_Init (void); +void Mod_Init_Commands (void); void Mod_Reload (void); dp_model_t *Mod_LoadModel(dp_model_t *mod, qboolean crash, qboolean checkdisk); dp_model_t *Mod_FindName (const char *name, const char *parentname); @@ -1195,6 +1196,7 @@ qboolean Mod_AllocLightmap_Block(mod_alloclightmap_state_t *state, int blockwidt // bsp models void Mod_BrushInit(void); +void Mod_BrushInit_Commands(void); // used for talking to the QuakeC mainly int Mod_Q1BSP_NativeContentsFromSuperContents(int supercontents); int Mod_Q1BSP_SuperContentsFromNativeContents(int nativecontents); @@ -1241,6 +1243,7 @@ bih_t *Mod_MakeCollisionBIH(dp_model_t *model, qboolean userendersurfaces, bih_t struct frameblend_s; struct skeleton_s; void Mod_AliasInit(void); +void Mod_AliasInit_Commands(void); int Mod_Alias_GetTagMatrix(const dp_model_t *model, const struct frameblend_s *frameblend, const struct skeleton_s *skeleton, int tagindex, matrix4x4_t *outmatrix); int Mod_Alias_GetTagIndexForName(const dp_model_t *model, unsigned int skin, const char *tagname); int Mod_Alias_GetExtendedTagInfoForIndex(const dp_model_t *model, unsigned int skin, const struct frameblend_s *frameblend, const struct skeleton_s *skeleton, int tagindex, int *parentindex, const char **tagname, matrix4x4_t *tag_localmatrix); @@ -1248,7 +1251,7 @@ int Mod_Alias_GetExtendedTagInfoForIndex(const dp_model_t *model, unsigned int s void Mod_Skeletal_FreeBuffers(void); // sprite models -void Mod_SpriteInit(void); +void Mod_SpriteInit_Commands(void); // loaders void Mod_2PSB_Load(dp_model_t *mod, void *buffer, void *bufferend); diff --git a/model_sprite.c b/model_sprite.c index acfac9f5..c3d00c8b 100644 --- a/model_sprite.c +++ b/model_sprite.c @@ -39,10 +39,10 @@ cvar_t r_track_sprites_scaleh = {CVAR_CLIENT | CVAR_SAVE, "r_track_sprites_scale /* =============== -Mod_SpriteInit +Mod_SpriteInit_Commands =============== */ -void Mod_SpriteInit (void) +void Mod_SpriteInit_Commands (void) { Cvar_RegisterVariable(&r_mipsprites); Cvar_RegisterVariable(&r_labelsprites_scale); diff --git a/netconn.c b/netconn.c index 4425dfd5..d77a30ba 100755 --- a/netconn.c +++ b/netconn.c @@ -3870,6 +3870,45 @@ void NetConn_Init(void) int i; lhnetaddress_t tempaddress; netconn_mempool = Mem_AllocPool("network connections", 0, NULL); + +// COMMANDLINEOPTION: Server: -ip 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) + { + if (LHNETADDRESS_FromString(&tempaddress, sys.argv[i + 1], 0) == 1) + { + Con_Printf("-ip option used, setting net_address to \"%s\"\n", sys.argv[i + 1]); + Cvar_SetQuick(&net_address, sys.argv[i + 1]); + } + else + Con_Printf(CON_ERROR "-ip option used, but unable to parse the address \"%s\"\n", sys.argv[i + 1]); + } +// COMMANDLINEOPTION: Server: -port sets the port to use for a server (default 26000, the same port as QUAKE itself), useful if you host multiple servers on your machine + if (((i = COM_CheckParm("-port")) || (i = COM_CheckParm("-ipport")) || (i = COM_CheckParm("-udpport"))) && i + 1 < sys.argc) + { + i = atoi(sys.argv[i + 1]); + if (i >= 0 && i < 65536) + { + Con_Printf("-port option used, setting port cvar to %i\n", i); + Cvar_SetValueQuick(&sv_netport, i); + } + else + Con_Printf(CON_ERROR "-port option used, but %i is not a valid port number\n", i); + } + cl_numsockets = 0; + sv_numsockets = 0; + cl_message.data = cl_message_buf; + cl_message.maxsize = sizeof(cl_message_buf); + cl_message.cursize = 0; + sv_message.data = sv_message_buf; + sv_message.maxsize = sizeof(sv_message_buf); + sv_message.cursize = 0; + LHNET_Init(); + if (Thread_HasThreads()) + netconn_mutex = Thread_CreateMutex(); +} + +void NetConn_Init_Commands(void) +{ 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"); @@ -3915,45 +3954,11 @@ void NetConn_Init(void) Cvar_RegisterVariable(&sv_public); Cvar_RegisterVariable(&sv_public_rejectreason); Cvar_RegisterVariable(&sv_heartbeatperiod); - for (i = 0;sv_masters[i].name;i++) + for (int i = 0;sv_masters[i].name;i++) Cvar_RegisterVariable(&sv_masters[i]); Cvar_RegisterVariable(&gameversion); Cvar_RegisterVariable(&gameversion_min); Cvar_RegisterVariable(&gameversion_max); -// COMMANDLINEOPTION: Server: -ip 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) - { - if (LHNETADDRESS_FromString(&tempaddress, sys.argv[i + 1], 0) == 1) - { - Con_Printf("-ip option used, setting net_address to \"%s\"\n", sys.argv[i + 1]); - Cvar_SetQuick(&net_address, sys.argv[i + 1]); - } - else - Con_Printf(CON_ERROR "-ip option used, but unable to parse the address \"%s\"\n", sys.argv[i + 1]); - } -// COMMANDLINEOPTION: Server: -port sets the port to use for a server (default 26000, the same port as QUAKE itself), useful if you host multiple servers on your machine - if (((i = COM_CheckParm("-port")) || (i = COM_CheckParm("-ipport")) || (i = COM_CheckParm("-udpport"))) && i + 1 < sys.argc) - { - i = atoi(sys.argv[i + 1]); - if (i >= 0 && i < 65536) - { - Con_Printf("-port option used, setting port cvar to %i\n", i); - Cvar_SetValueQuick(&sv_netport, i); - } - else - Con_Printf(CON_ERROR "-port option used, but %i is not a valid port number\n", i); - } - cl_numsockets = 0; - sv_numsockets = 0; - cl_message.data = cl_message_buf; - cl_message.maxsize = sizeof(cl_message_buf); - cl_message.cursize = 0; - sv_message.data = sv_message_buf; - sv_message.maxsize = sizeof(sv_message_buf); - sv_message.cursize = 0; - LHNET_Init(); - if (Thread_HasThreads()) - netconn_mutex = Thread_CreateMutex(); } void NetConn_Shutdown(void) diff --git a/netconn.h b/netconn.h index 8e3cdab3..c90c4fe0 100755 --- a/netconn.h +++ b/netconn.h @@ -441,6 +441,7 @@ void NetConn_OpenServerPorts(int opennetports); 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); diff --git a/palette.c b/palette.c index 5b874342..18170983 100644 --- a/palette.c +++ b/palette.c @@ -366,6 +366,10 @@ static void Palette_Load(void) void Palette_Init(void) { R_RegisterModule("Palette", Palette_Load, Palette_Shutdown, Palette_NewMap, NULL, NULL); - Cvar_RegisterVariable(&r_colormap_palette); Palette_Load(); } + +void Palette_Init_Commands(void) +{ + Cvar_RegisterVariable(&r_colormap_palette); +} \ No newline at end of file diff --git a/palette.h b/palette.h index 8658f128..3cc71a32 100644 --- a/palette.h +++ b/palette.h @@ -38,6 +38,7 @@ void BuildGammaTable8(float prescale, float gamma, float scale, float base, floa void BuildGammaTable16(float prescale, float gamma, float scale, float base, float contrastboost, unsigned short *out, int rampsize); void Palette_Init(void); +void Palette_Init_Commands(void); #endif diff --git a/progsvm.h b/progsvm.h index 738101bb..fb0903e6 100644 --- a/progsvm.h +++ b/progsvm.h @@ -782,7 +782,7 @@ void VM_Cmd_Reset(prvm_prog_t *prog); //============================================================================ void PRVM_Init (void); - +void PRVM_Init_Commands (void); #ifdef PROFILING void SVVM_ExecuteProgram (prvm_prog_t *prog, func_t fnum, const char *errormessage); void CLVM_ExecuteProgram (prvm_prog_t *prog, func_t fnum, const char *errormessage); diff --git a/prvm_edict.c b/prvm_edict.c index 92004b0a..4a2eb2ec 100644 --- a/prvm_edict.c +++ b/prvm_edict.c @@ -2995,6 +2995,14 @@ 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"); + + //VM_Cmd_Init(); +} + +void PRVM_Init_Commands (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)"); @@ -3035,11 +3043,6 @@ void PRVM_Init (void) Cvar_RegisterVariable (&prvm_garbagecollection_scan_limit); Cvar_RegisterVariable (&prvm_garbagecollection_strings); Cvar_RegisterVariable (&prvm_stringdebug); - - // COMMANDLINEOPTION: PRVM: -norunaway disables the runaway loop check (it might be impossible to exit DarkPlaces if used!) - prvm_runawaycheck = !COM_CheckParm("-norunaway"); - - //VM_Cmd_Init(); } /* diff --git a/r_explosion.c b/r_explosion.c index b60bfc2d..a20e39c4 100644 --- a/r_explosion.c +++ b/r_explosion.c @@ -157,6 +157,14 @@ void R_Explosion_Init(void) #endif } +void R_Explosion_Init_Commands(void) +{ + Cvar_RegisterVariable(&r_explosionclip); +#ifdef MAX_EXPLOSIONS + Cvar_RegisterVariable(&r_drawexplosions); +#endif +} + void R_NewExplosion(const vec3_t org) { #ifdef MAX_EXPLOSIONS diff --git a/r_lightning.c b/r_lightning.c index 8471e739..fcfe30bf 100644 --- a/r_lightning.c +++ b/r_lightning.c @@ -94,6 +94,11 @@ static void r_lightningbeams_newmap(void) } void R_LightningBeams_Init(void) +{ + R_RegisterModule("R_LightningBeams", r_lightningbeams_start, r_lightningbeams_shutdown, r_lightningbeams_newmap, NULL, NULL); +} + +void R_LightningBeams_Init_Commands(void) { Cvar_RegisterVariable(&r_lightningbeam_thickness); Cvar_RegisterVariable(&r_lightningbeam_scroll); @@ -102,7 +107,6 @@ void R_LightningBeams_Init(void) Cvar_RegisterVariable(&r_lightningbeam_color_green); Cvar_RegisterVariable(&r_lightningbeam_color_blue); Cvar_RegisterVariable(&r_lightningbeam_qmbtexture); - R_RegisterModule("R_LightningBeams", r_lightningbeams_start, r_lightningbeams_shutdown, r_lightningbeams_newmap, NULL, NULL); } static void CL_Beam_AddQuad(dp_model_t *mod, msurface_t *surf, const vec3_t start, const vec3_t end, const vec3_t offset, float t1, float t2) diff --git a/r_shadow.c b/r_shadow.c index a34af2c8..a5368ebe 100644 --- a/r_shadow.c +++ b/r_shadow.c @@ -601,6 +601,42 @@ static void r_shadow_newmap(void) } void R_Shadow_Init(void) +{ + Mem_ExpandableArray_NewArray(&r_shadow_worldlightsarray, r_main_mempool, sizeof(dlight_t), 128); + r_shadow_scenemaxlights = 0; + r_shadow_scenenumlights = 0; + r_shadow_scenelightlist = NULL; + maxshadowtriangles = 0; + shadowelements = NULL; + maxshadowvertices = 0; + shadowvertex3f = NULL; + maxvertexupdate = 0; + vertexupdate = NULL; + vertexremap = NULL; + vertexupdatenum = 0; + maxshadowmark = 0; + numshadowmark = 0; + shadowmark = NULL; + shadowmarklist = NULL; + shadowmarkcount = 0; + maxshadowsides = 0; + numshadowsides = 0; + shadowsides = NULL; + shadowsideslist = NULL; + r_shadow_buffer_numleafpvsbytes = 0; + r_shadow_buffer_visitingleafpvs = NULL; + r_shadow_buffer_leafpvs = NULL; + r_shadow_buffer_leaflist = NULL; + r_shadow_buffer_numsurfacepvsbytes = 0; + r_shadow_buffer_surfacepvs = NULL; + r_shadow_buffer_surfacelist = NULL; + r_shadow_buffer_surfacesides = NULL; + r_shadow_buffer_shadowtrispvs = NULL; + r_shadow_buffer_lighttrispvs = NULL; + R_RegisterModule("R_Shadow", r_shadow_start, r_shadow_shutdown, r_shadow_newmap, NULL, NULL); +} + +void R_Shadow_Init_Commands(void) { Cvar_RegisterVariable(&r_shadow_bumpscale_basetexture); Cvar_RegisterVariable(&r_shadow_bumpscale_bumpmap); @@ -698,39 +734,8 @@ void R_Shadow_Init(void) Cvar_RegisterVariable(&r_coronas_occlusionsizescale); Cvar_RegisterVariable(&r_coronas_occlusionquery); Cvar_RegisterVariable(&gl_flashblend); + R_Shadow_EditLights_Init(); - Mem_ExpandableArray_NewArray(&r_shadow_worldlightsarray, r_main_mempool, sizeof(dlight_t), 128); - r_shadow_scenemaxlights = 0; - r_shadow_scenenumlights = 0; - r_shadow_scenelightlist = NULL; - maxshadowtriangles = 0; - shadowelements = NULL; - maxshadowvertices = 0; - shadowvertex3f = NULL; - maxvertexupdate = 0; - vertexupdate = NULL; - vertexremap = NULL; - vertexupdatenum = 0; - maxshadowmark = 0; - numshadowmark = 0; - shadowmark = NULL; - shadowmarklist = NULL; - shadowmarkcount = 0; - maxshadowsides = 0; - numshadowsides = 0; - shadowsides = NULL; - shadowsideslist = NULL; - r_shadow_buffer_numleafpvsbytes = 0; - r_shadow_buffer_visitingleafpvs = NULL; - r_shadow_buffer_leafpvs = NULL; - r_shadow_buffer_leaflist = NULL; - r_shadow_buffer_numsurfacepvsbytes = 0; - r_shadow_buffer_surfacepvs = NULL; - r_shadow_buffer_surfacelist = NULL; - r_shadow_buffer_surfacesides = NULL; - r_shadow_buffer_shadowtrispvs = NULL; - r_shadow_buffer_lighttrispvs = NULL; - R_RegisterModule("R_Shadow", r_shadow_start, r_shadow_shutdown, r_shadow_newmap, NULL, NULL); } matrix4x4_t matrix_attenuationxyz = diff --git a/r_sky.c b/r_sky.c index 43d60a37..dfe74937 100644 --- a/r_sky.c +++ b/r_sky.c @@ -462,14 +462,17 @@ static void r_sky_newmap(void) void R_Sky_Init(void) +{ + memset(&skyboxskinframe, 0, sizeof(skyboxskinframe)); + skyname[0] = 0; + R_RegisterModule("R_Sky", r_sky_start, r_sky_shutdown, r_sky_newmap, NULL, NULL); +} + +void R_Sky_Init_Commands(void) { Cmd_AddCommand(CMD_CLIENT, "loadsky", &LoadSky_f, "load a skybox by basename (for example loadsky mtnsun_ loads mtnsun_ft.tga and so on)"); Cvar_RegisterVariable (&r_sky); Cvar_RegisterVariable (&r_skyscroll1); Cvar_RegisterVariable (&r_skyscroll2); Cvar_RegisterVariable (&r_sky_scissor); - memset(&skyboxskinframe, 0, sizeof(skyboxskinframe)); - skyname[0] = 0; - R_RegisterModule("R_Sky", r_sky_start, r_sky_shutdown, r_sky_newmap, NULL, NULL); } - diff --git a/render.h b/render.h index c8d63be8..b737e6da 100644 --- a/render.h +++ b/render.h @@ -729,6 +729,7 @@ dp_font_t *FindFont(const char *title, qboolean allocate_new); void LoadFont(qboolean override, const char *name, dp_font_t *fnt, float scale, float voffset); void Render_Init(void); +void Render_Init_Commands(void); // these are called by Render_Init void R_Textures_Init(void); @@ -745,6 +746,18 @@ void R_LightningBeams_Init(void); void Mod_RenderInit(void); void Font_Init(void); +void R_Textures_Init_Commands(void); +void GL_Draw_Init_Commands(void); +void GL_Main_Init_Commands(void); +void R_Shadow_Init_Commands(void); +void R_Sky_Init_Commands(void); +void R_Particles_Init_Commands(void); +void R_Explosion_Init_Commands(void); +void gl_backend_init_Commands(void); +void Sbar_Init_Commands(void); +void R_LightningBeams_Init_Commands(void); +void Font_Init_Commands(void); + qboolean R_CompileShader_CheckStaticParms(void); void R_GLSL_Restart_f(cmd_state_t *cmd); diff --git a/sbar.c b/sbar.c index 288965a2..f7bedd52 100644 --- a/sbar.c +++ b/sbar.c @@ -359,11 +359,18 @@ static void sbar_newmap(void) void Sbar_Init (void) { + // FIXME: Don't know what game we're running until after cvars are initialized. + // So we're not doing this in our Init_Commands function yet. if(gamemode == GAME_NORMAL) // Workaround so Quake doesn't trample on Xonotic. { Cmd_AddCommand(CMD_CLIENT, "+showscores", Sbar_ShowScores_f, "show scoreboard"); Cmd_AddCommand(CMD_CLIENT, "-showscores", Sbar_DontShowScores_f, "hide scoreboard"); } + R_RegisterModule("sbar", sbar_start, sbar_shutdown, sbar_newmap, NULL, NULL); +} + +void Sbar_Init_Commands(void) +{ Cvar_RegisterVariable(&cl_showfps); Cvar_RegisterVariable(&cl_showsound); Cvar_RegisterVariable(&cl_showblur); @@ -404,11 +411,8 @@ void Sbar_Init (void) Cvar_RegisterVariable(&sbar_flagstatus_right); // (GAME_NEXUZI ONLY) Cvar_RegisterVariable(&sbar_flagstatus_pos); // (GAME_NEXUIZ ONLY) - - R_RegisterModule("sbar", sbar_start, sbar_shutdown, sbar_newmap, NULL, NULL); } - //============================================================================= // drawing routines are relative to the status bar location diff --git a/server.h b/server.h index 440cb49f..10c53417 100644 --- a/server.h +++ b/server.h @@ -512,6 +512,7 @@ extern client_t *host_client; //=========================================================== void SV_Init (void); +void SV_Init_Commands(void); void SV_StartParticle (vec3_t org, vec3_t dir, int color, int count); void SV_StartEffect (vec3_t org, int modelindex, int startframe, int framecount, int framerate); diff --git a/snd_main.c b/snd_main.c index 33c3a08b..0d96b2fa 100644 --- a/snd_main.c +++ b/snd_main.c @@ -702,6 +702,31 @@ S_Init ================ */ void S_Init(void) +{ +// COMMANDLINEOPTION: Sound: -nosound disables sound (including CD audio) + if (COM_CheckParm("-nosound")) + return; + + snd_mempool = Mem_AllocPool("sound", 0, NULL); + +// COMMANDLINEOPTION: Sound: -simsound runs sound mixing but with no output + if (COM_CheckParm("-simsound")) + simsound = true; + + Cvar_SetValueQuick(&snd_initialized, true); + + known_sfx = NULL; + + total_channels = MAX_DYNAMIC_CHANNELS + NUM_AMBIENTS; // no statics + memset(channels, 0, MAX_CHANNELS * sizeof(channel_t)); + + OGG_OpenLibrary (); +#ifdef USEXMP + XMP_OpenLibrary (); +#endif +} + +void S_Init_Commands(void) { Cvar_RegisterVariable(&volume); Cvar_RegisterVariable(&bgmvolume); @@ -773,8 +798,6 @@ void S_Init(void) Cvar_RegisterVariable(&snd_identicalsoundrandomization_time); Cvar_RegisterVariable(&snd_identicalsoundrandomization_tics); - -// COMMANDLINEOPTION: Sound: -nosound disables sound (including CD audio) if (COM_CheckParm("-nosound")) { // dummy out Play and Play2 because mods stuffcmd that @@ -783,12 +806,6 @@ void S_Init(void) return; } - snd_mempool = Mem_AllocPool("sound", 0, NULL); - -// COMMANDLINEOPTION: Sound: -simsound runs sound mixing but with no output - if (COM_CheckParm("-simsound")) - simsound = true; - Cmd_AddCommand(CMD_CLIENT, "play", S_Play_f, "play a sound at your current location (not heard by anyone else)"); Cmd_AddCommand(CMD_CLIENT, "play2", S_Play2_f, "play a sound globally throughout the level (not heard by anyone else)"); Cmd_AddCommand(CMD_CLIENT, "playvol", S_PlayVol_f, "play a sound at the specified volume level at your current location (not heard by anyone else)"); @@ -812,21 +829,8 @@ void S_Init(void) Cvar_RegisterVariable(&snd_swapstereo); // for people with backwards sound wiring Cvar_RegisterVariable(&snd_channellayout); Cvar_RegisterVariable(&snd_soundradius); - - Cvar_SetValueQuick(&snd_initialized, true); - - known_sfx = NULL; - - total_channels = MAX_DYNAMIC_CHANNELS + NUM_AMBIENTS; // no statics - memset(channels, 0, MAX_CHANNELS * sizeof(channel_t)); - - OGG_OpenLibrary (); -#ifdef USEXMP - XMP_OpenLibrary (); -#endif } - /* ================ S_Terminate diff --git a/snd_null.c b/snd_null.c index 42e88f04..65c083e1 100755 --- a/snd_null.c +++ b/snd_null.c @@ -30,6 +30,10 @@ cvar_t snd_initialized = { CVAR_READONLY, "snd_initialized", "0", "indicates the cvar_t snd_mutewhenidle = {CVAR_SAVE, "snd_mutewhenidle", "1", "whether to disable sound output when game window is inactive"}; void S_Init (void) +{ +} + +void S_Init_Commands (void) { Cvar_RegisterVariable(&bgmvolume); Cvar_RegisterVariable(&mastervolume); diff --git a/sound.h b/sound.h index 288b475c..ef8c17d4 100644 --- a/sound.h +++ b/sound.h @@ -59,6 +59,7 @@ extern cvar_t snd_mutewhenidle; // ==================================================================== void S_Init (void); +void S_Init_Commands(void); void S_Terminate (void); void S_Startup (void); diff --git a/sv_main.c b/sv_main.c index c2419941..36d4e284 100644 --- a/sv_main.c +++ b/sv_main.c @@ -438,6 +438,11 @@ SV_Init =============== */ void SV_Init (void) +{ + sv_mempool = Mem_AllocPool("server", 0, NULL); +} + +void SV_Init_Commands(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] @@ -632,8 +637,6 @@ void SV_Init (void) Cvar_RegisterVariable (&sv_mapformat_is_quake3); SV_InitOperatorCommands(); - - sv_mempool = Mem_AllocPool("server", 0, NULL); } static void SV_SaveEntFile_f(cmd_state_t *cmd) diff --git a/taskqueue.c b/taskqueue.c index ccde49c5..84d612c7 100644 --- a/taskqueue.c +++ b/taskqueue.c @@ -50,7 +50,7 @@ taskqueue_state_t; static taskqueue_state_t taskqueue_state; -void TaskQueue_Init(void) +void TaskQueue_Init_Commands(void) { Cvar_RegisterVariable(&taskqueue_minthreads); Cvar_RegisterVariable(&taskqueue_maxthreads); diff --git a/taskqueue.h b/taskqueue.h index 9e8741f4..023df29e 100644 --- a/taskqueue.h +++ b/taskqueue.h @@ -43,7 +43,7 @@ void TaskQueue_Setup(taskqueue_task_t *t, taskqueue_task_t *preceding, void(*fun // t->p[0] = array of taskqueue_task_t to check void TaskQueue_Task_CheckTasksDone(taskqueue_task_t *t); -void TaskQueue_Init(void); +void TaskQueue_Init_Commands(void); void TaskQueue_Shutdown(void); void TaskQueue_Frame(qboolean shutdown); diff --git a/utf8lib.c b/utf8lib.c index c66f06e1..4ec965e7 100644 --- a/utf8lib.c +++ b/utf8lib.c @@ -9,7 +9,7 @@ Initialization of UTF-8 support and new cvars. // 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(void) +void u8_Init_Commands(void) { Cvar_RegisterVariable(&utf8_enable); } diff --git a/utf8lib.h b/utf8lib.h index fc5d1be7..1911c29b 100644 --- a/utf8lib.h +++ b/utf8lib.h @@ -20,7 +20,7 @@ typedef int32_t Uchar; // 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(void); +void u8_Init_Commands(void); size_t u8_strlen(const char*); size_t u8_strnlen(const char*, size_t); diff --git a/vid.h b/vid.h index 2199ea0b..2a5e66a1 100644 --- a/vid.h +++ b/vid.h @@ -193,11 +193,14 @@ qboolean GL_ExtensionSupported(const char *name); void VID_Shared_Init(void); +void VID_Shared_Init_Commands(void); + void GL_Setup(void); void VID_ClearExtensions(void); void VID_Init (void); +void VID_Init_Commands(void); // Called at startup void VID_Shutdown (void); diff --git a/vid_null.c b/vid_null.c index aa409946..a984a29c 100644 --- a/vid_null.c +++ b/vid_null.c @@ -64,6 +64,10 @@ void VID_Init(void) InitSig(); // trap evil signals } +void VID_Init_Commands(void) +{ +} + qboolean VID_InitMode(viddef_mode_t *mode) { return false; diff --git a/vid_sdl.c b/vid_sdl.c index 9b258079..a5ce4dbd 100644 --- a/vid_sdl.c +++ b/vid_sdl.c @@ -1320,15 +1320,9 @@ static qboolean vid_sdl_initjoysticksystem = false; void VID_Init (void) { -#ifndef __IPHONEOS__ -#ifdef MACOSX - Cvar_RegisterVariable(&apple_mouse_noaccel); -#endif -#endif #ifdef DP_MOBILETOUCH Cvar_SetValueQuick(&vid_touchscreen, 1); #endif - Cvar_RegisterVariable(&joy_sdl2_trigger_deadzone); #ifdef SDL_R_RESTART R_RegisterModule("SDL", sdl_start, sdl_shutdown, sdl_newmap, NULL, NULL); @@ -1342,6 +1336,16 @@ void VID_Init (void) vid_isfullscreen = false; } +void VID_Init_Commands(void) +{ +#ifndef __IPHONEOS__ +#ifdef MACOSX + Cvar_RegisterVariable(&apple_mouse_noaccel); +#endif +#endif + Cvar_RegisterVariable(&joy_sdl2_trigger_deadzone); +} + static int vid_sdljoystickindex = -1; void VID_EnableJoystick(qboolean enable) { diff --git a/vid_shared.c b/vid_shared.c index 0e523ed5..b469b7cb 100644 --- a/vid_shared.c +++ b/vid_shared.c @@ -1255,6 +1255,13 @@ static dllhandle_t xinputdll_dll = NULL; #endif void VID_Shared_Init(void) +{ +#ifdef WIN32 + Sys_LoadLibrary(xinputdllnames, &xinputdll_dll, xinputdllfuncs); +#endif +} + +void VID_Shared_Init_Commands(void) { Cvar_RegisterVariable(&gl_info_vendor); Cvar_RegisterVariable(&gl_info_renderer); @@ -1358,11 +1365,6 @@ void VID_Shared_Init(void) Cvar_RegisterVariable(&joy_x360_sensitivitypitch); Cvar_RegisterVariable(&joy_x360_sensitivityyaw); //Cvar_RegisterVariable(&joy_x360_sensitivityroll); - -#ifdef WIN32 - Sys_LoadLibrary(xinputdllnames, &xinputdll_dll, xinputdllfuncs); -#endif - Cmd_AddCommand(CMD_CLIENT, "force_centerview", Force_CenterView_f, "recenters view (stops looking up/down)"); Cmd_AddCommand(CMD_CLIENT, "vid_restart", VID_Restart_f, "restarts video system (closes and reopens the window, restarts renderer)"); } diff --git a/world.c b/world.c index e460ed6f..64f7b31d 100644 --- a/world.c +++ b/world.c @@ -32,12 +32,19 @@ line of sight checks trace->inopen and trace->inwater, but bullets don't */ static void World_Physics_Init(void); +static void World_Physics_Init_Commands(void); void World_Init(void) { Collision_Init(); World_Physics_Init(); } +void World_Init_Commands(void) +{ + Collision_Init_Commands(); + World_Physics_Init_Commands(); +} + static void World_Physics_Shutdown(void); void World_Shutdown(void) { @@ -1494,36 +1501,6 @@ static void World_Physics_Init(void) }; #endif - Cvar_RegisterVariable(&physics_ode_quadtree_depth); - Cvar_RegisterVariable(&physics_ode_contactsurfacelayer); - Cvar_RegisterVariable(&physics_ode_worldstep_iterations); - Cvar_RegisterVariable(&physics_ode_contact_mu); - Cvar_RegisterVariable(&physics_ode_contact_erp); - Cvar_RegisterVariable(&physics_ode_contact_cfm); - Cvar_RegisterVariable(&physics_ode_contact_maxpoints); - Cvar_RegisterVariable(&physics_ode_world_erp); - Cvar_RegisterVariable(&physics_ode_world_cfm); - Cvar_RegisterVariable(&physics_ode_world_damping); - Cvar_RegisterVariable(&physics_ode_world_damping_linear); - Cvar_RegisterVariable(&physics_ode_world_damping_linear_threshold); - Cvar_RegisterVariable(&physics_ode_world_damping_angular); - Cvar_RegisterVariable(&physics_ode_world_damping_angular_threshold); - Cvar_RegisterVariable(&physics_ode_world_gravitymod); - Cvar_RegisterVariable(&physics_ode_iterationsperframe); - Cvar_RegisterVariable(&physics_ode_constantstep); - Cvar_RegisterVariable(&physics_ode_movelimit); - Cvar_RegisterVariable(&physics_ode_spinlimit); - Cvar_RegisterVariable(&physics_ode_trick_fixnan); - Cvar_RegisterVariable(&physics_ode_autodisable); - Cvar_RegisterVariable(&physics_ode_autodisable_steps); - Cvar_RegisterVariable(&physics_ode_autodisable_time); - Cvar_RegisterVariable(&physics_ode_autodisable_threshold_linear); - Cvar_RegisterVariable(&physics_ode_autodisable_threshold_angular); - Cvar_RegisterVariable(&physics_ode_autodisable_threshold_samples); - Cvar_RegisterVariable(&physics_ode_printstats); - Cvar_RegisterVariable(&physics_ode_allowconvex); - Cvar_RegisterVariable(&physics_ode); - #ifndef LINK_TO_LIBODE // Load the DLL if (Sys_LoadLibrary (dllnames, &ode_dll, odefuncs)) @@ -1560,6 +1537,41 @@ static void World_Physics_Init(void) #endif } +static void World_Physics_Init_Commands(void) +{ +#ifdef USEODE + Cvar_RegisterVariable(&physics_ode_quadtree_depth); + Cvar_RegisterVariable(&physics_ode_contactsurfacelayer); + Cvar_RegisterVariable(&physics_ode_worldstep_iterations); + Cvar_RegisterVariable(&physics_ode_contact_mu); + Cvar_RegisterVariable(&physics_ode_contact_erp); + Cvar_RegisterVariable(&physics_ode_contact_cfm); + Cvar_RegisterVariable(&physics_ode_contact_maxpoints); + Cvar_RegisterVariable(&physics_ode_world_erp); + Cvar_RegisterVariable(&physics_ode_world_cfm); + Cvar_RegisterVariable(&physics_ode_world_damping); + Cvar_RegisterVariable(&physics_ode_world_damping_linear); + Cvar_RegisterVariable(&physics_ode_world_damping_linear_threshold); + Cvar_RegisterVariable(&physics_ode_world_damping_angular); + Cvar_RegisterVariable(&physics_ode_world_damping_angular_threshold); + Cvar_RegisterVariable(&physics_ode_world_gravitymod); + Cvar_RegisterVariable(&physics_ode_iterationsperframe); + Cvar_RegisterVariable(&physics_ode_constantstep); + Cvar_RegisterVariable(&physics_ode_movelimit); + Cvar_RegisterVariable(&physics_ode_spinlimit); + Cvar_RegisterVariable(&physics_ode_trick_fixnan); + Cvar_RegisterVariable(&physics_ode_autodisable); + Cvar_RegisterVariable(&physics_ode_autodisable_steps); + Cvar_RegisterVariable(&physics_ode_autodisable_time); + Cvar_RegisterVariable(&physics_ode_autodisable_threshold_linear); + Cvar_RegisterVariable(&physics_ode_autodisable_threshold_angular); + Cvar_RegisterVariable(&physics_ode_autodisable_threshold_samples); + Cvar_RegisterVariable(&physics_ode_printstats); + Cvar_RegisterVariable(&physics_ode_allowconvex); + Cvar_RegisterVariable(&physics_ode); +#endif +} + static void World_Physics_Shutdown(void) { #ifdef USEODE diff --git a/world.h b/world.h index e43ebd14..90b72629 100644 --- a/world.h +++ b/world.h @@ -97,6 +97,7 @@ void World_RemoveLink(link_t *l); void World_InsertLinkBefore(link_t *l, link_t *before, int entitynumber); void World_Init(void); +void World_Init_Commands(void); void World_Shutdown(void); /// called after the world model has been loaded, before linking any entities