From: Cloudwalk Date: Sun, 25 Oct 2020 16:58:12 +0000 (-0400) Subject: Merge branch 'master' into Cloudwalk/Host_Init-overhaul X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=refs%2Fheads%2FCloudwalk%2FHost_Init-overhaul;p=xonotic%2Fdarkplaces.git Merge branch 'master' into Cloudwalk/Host_Init-overhaul --- aa4f509e3be132d1f1fe049a23dd6c06b06fc8ee diff --cc cd_shared.c index 69c80a12,0f2f6fd1..af200218 --- a/cd_shared.c +++ b/cd_shared.c @@@ -577,7 -570,9 +577,7 @@@ void CDAudio_Init_Commands(void Cvar_RegisterVariable(&music_playlist_sampleposition[i]); } - 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"); + Cmd_AddCommand(CF_CLIENT | CF_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 --cc cdaudio.h index 1369cd3d,09099190..93599734 --- a/cdaudio.h +++ b/cdaudio.h @@@ -21,8 -24,7 +24,8 @@@ Foundation, Inc., 59 Temple Place - Sui extern cvar_t cdaudioinitialized; int CDAudio_Init(void); +void CDAudio_Init_Commands(void); - void CDAudio_Play(int track, qboolean looping); + void CDAudio_Play(int track, qbool looping); void CDAudio_Stop(void); void CDAudio_Pause(void); void CDAudio_Resume(void); diff --cc cl_main.c index 8eeb0114,2a2b9976..d5551891 --- a/cl_main.c +++ b/cl_main.c @@@ -2920,8 -2950,13 +2948,10 @@@ void CL_Init (void { Con_Printf("Initializing client\n"); + Cvar_SetValueQuick(&host_isclient, 1); + - R_Modules_Init(); Palette_Init(); -#ifdef CONFIG_MENU - MR_Init_Commands(); -#endif + VID_Shared_Init(); VID_Init(); Render_Init(); @@@ -2941,53 -2977,12 +2971,53 @@@ 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; - - #ifdef CONFIG_MENU - Cbuf_InsertText(&cmd_client,"menu_start\n"); - #endif ++ host.hook.ConnectLocal = CL_EstablishConnection_Local; ++ host.hook.Disconnect = CL_Disconnect; ++ host.hook.CL_Intermission = CL_Intermission; ++ host.hook.ToggleMenu = CL_ToggleMenu_Hook; + } +} + +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)"); ++ Cmd_AddCommand(CF_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(); - // - // register our commands - // - CL_InitCommands(); + CL_InitServer_Commands(); Cvar_RegisterVariable (&cl_upspeed); Cvar_RegisterVariable (&cl_forwardspeed); @@@ -3015,20 -3010,23 +3045,20 @@@ Cvar_RegisterVariable (&cl_itembobspeed); Cvar_RegisterVariable (&cl_itembobheight); - 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"); - Cmd_AddCommand(CMD_CLIENT | CMD_CLIENT_FROM_SERVER, "reconnect", CL_Reconnect_f, "reconnect to the last server you were on, or resets a quakeworld connection (do not use if currently playing on a netquake server)"); - - CL_Demo_Init(); - + Cmd_AddCommand(CF_CLIENT, "entities", CL_PrintEntities_f, "print information on network entities known to client"); + Cmd_AddCommand(CF_CLIENT, "disconnect", CL_Disconnect_f, "disconnect from server (or disconnect all clients if running a server)"); + Cmd_AddCommand(CF_CLIENT, "connect", CL_Connect_f, "connect to a server by IP address or hostname"); + Cmd_AddCommand(CF_CLIENT | CF_CLIENT_FROM_SERVER, "reconnect", CL_Reconnect_f, "reconnect to the last server you were on, or resets a quakeworld connection (do not use if currently playing on a netquake server)"); // Support Client-side Model Index List - Cmd_AddCommand(CMD_CLIENT, "cl_modelindexlist", CL_ModelIndexList_f, "list information on all models in the client modelindex"); + Cmd_AddCommand(CF_CLIENT, "cl_modelindexlist", CL_ModelIndexList_f, "list information on all models in the client modelindex"); // Support Client-side Sound Index List - Cmd_AddCommand(CMD_CLIENT, "cl_soundindexlist", CL_SoundIndexList_f, "list all sounds in the client soundindex"); + Cmd_AddCommand(CF_CLIENT, "cl_soundindexlist", CL_SoundIndexList_f, "list all sounds in the client soundindex"); - Cmd_AddCommand(CMD_CLIENT, "fog", CL_Fog_f, "set global fog parameters (density red green blue [alpha [mindist [maxdist [top [fadedepth]]]]])"); - Cmd_AddCommand(CMD_CLIENT, "fog_heighttexture", CL_Fog_HeightTexture_f, "set global fog parameters (density red green blue alpha mindist maxdist top depth textures/mapname/fogheight.tga)"); + Cmd_AddCommand(CF_CLIENT, "fog", CL_Fog_f, "set global fog parameters (density red green blue [alpha [mindist [maxdist [top [fadedepth]]]]])"); + Cmd_AddCommand(CF_CLIENT, "fog_heighttexture", CL_Fog_HeightTexture_f, "set global fog parameters (density red green blue alpha mindist maxdist top depth textures/mapname/fogheight.tga)"); - Cmd_AddCommand(CMD_CLIENT, "cl_areastats", CL_AreaStats_f, "prints statistics on entity culling during collision traces"); + Cmd_AddCommand(CF_CLIENT, "cl_areastats", CL_AreaStats_f, "prints statistics on entity culling during collision traces"); Cvar_RegisterVariable(&r_draweffects); Cvar_RegisterVariable(&cl_explosions_alpha_start); @@@ -3053,8 -3051,9 +3083,8 @@@ // 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"); + Cmd_AddCommand(CF_CLIENT, "timerefresh", CL_TimeRefresh_f, "turn quickly and print rendering statistcs"); Cvar_RegisterVariable(&cl_locs_enable); Cvar_RegisterVariable(&cl_locs_show); diff --cc cl_screen.c index c5adf194,186342d1..fcce2cf4 --- a/cl_screen.c +++ b/cl_screen.c @@@ -1278,19 -763,6 +763,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")) ++ if (Sys_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); @@@ -1379,11 -851,22 +864,12 @@@ Cvar_RegisterVariable(&r_speeds_graph_height); Cvar_RegisterVariable(&r_speeds_graph_maxtimedelta); Cvar_RegisterVariable(&r_speeds_graph_maxdefault); - 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)"); + - // if we want no console, turn it off here too - if (Sys_CheckParm ("-noconsole")) - Cvar_SetQuick(&scr_conforcewhiledisconnected, "0"); - + Cmd_AddCommand(CF_CLIENT, "sizeup",SCR_SizeUp_f, "increase view size (increases viewsize cvar)"); + Cmd_AddCommand(CF_CLIENT, "sizedown",SCR_SizeDown_f, "decrease view size (decreases viewsize cvar)"); + Cmd_AddCommand(CF_CLIENT, "screenshot",SCR_ScreenShot_f, "takes a screenshot of the next rendered frame"); + Cmd_AddCommand(CF_CLIENT, "envmap", R_Envmap_f, "render a cubemap (skybox) of the current scene"); + Cmd_AddCommand(CF_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 --cc cl_video.c index 15be13e9,2804661b..4a16b16b --- a/cl_video.c +++ b/cl_video.c @@@ -689,15 -689,8 +689,15 @@@ 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" ); + Cmd_AddCommand(CF_CLIENT, "playvideo", CL_PlayVideo_f, "play a .dpv video file" ); + Cmd_AddCommand(CF_CLIENT, "stopvideo", CL_StopVideo_f, "stop playing a .dpv video file" ); Cvar_RegisterVariable(&cl_video_subtitles); Cvar_RegisterVariable(&cl_video_subtitles_lines); diff --cc client.h index 5824d83a,b4e8eb7a..2074d7bd --- a/client.h +++ b/client.h @@@ -1537,8 -1213,9 +1213,10 @@@ double CL_Frame(double time) void CL_Shutdown (void); void CL_Init (void); +void CL_Init_Commands(void); + void CL_StartVideo(void); + void CL_EstablishConnection(const char *host, int firstarg); void CL_Disconnect (void); diff --cc console.c index ddab28ad,ad20495c..a84fa6ae --- a/console.c +++ b/console.c @@@ -873,20 -873,6 +873,20 @@@ 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) ++ if (Sys_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); @@@ -929,13 -921,19 +929,13 @@@ Cvar_RegisterVariable(&rcon_password); // register our commands - Cmd_AddCommand(CMD_CLIENT, "toggleconsole", Con_ToggleConsole_f, "opens or closes the console"); - Cmd_AddCommand(CMD_CLIENT, "messagemode", Con_MessageMode_f, "input a chat message to say to everyone"); - Cmd_AddCommand(CMD_CLIENT, "messagemode2", Con_MessageMode2_f, "input a chat message to say to only your team"); - Cmd_AddCommand(CMD_CLIENT, "commandmode", Con_CommandMode_f, "input a console command"); - 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)"); + Cmd_AddCommand(CF_CLIENT, "toggleconsole", Con_ToggleConsole_f, "opens or closes the console"); + Cmd_AddCommand(CF_CLIENT, "messagemode", Con_MessageMode_f, "input a chat message to say to everyone"); + Cmd_AddCommand(CF_CLIENT, "messagemode2", Con_MessageMode2_f, "input a chat message to say to only your team"); + Cmd_AddCommand(CF_CLIENT, "commandmode", Con_CommandMode_f, "input a console command"); + Cmd_AddCommand(CF_SHARED, "clear", Con_Clear_f, "clear console history"); + Cmd_AddCommand(CF_SHARED, "maps", Con_Maps_f, "list information about available maps"); + Cmd_AddCommand(CF_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 --cc gl_backend.c index 8451c3ef,ad4a0cdc..978c97de --- a/gl_backend.c +++ b/gl_backend.c @@@ -379,10 -374,12 +379,10 @@@ void gl_backend_init_Commands(void Cvar_RegisterVariable(&gl_paranoid); 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"); + Cmd_AddCommand(CF_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); + void GL_SetMirrorState(qbool state); void R_Viewport_TransformToScreen(const r_viewport_t *v, const vec4_t in, vec4_t out) { diff --cc gl_draw.c index 671ef1a3,2211f261..8153a075 --- a/gl_draw.c +++ b/gl_draw.c @@@ -758,23 -771,7 +758,23 @@@ void GL_Draw_Init (void 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"); ++ Cmd_AddCommand(CF_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 --cc gl_rmain.c index 4a83380e,5fc7862b..ae3ee8a0 --- a/gl_rmain.c +++ b/gl_rmain.c @@@ -3227,16 -3227,9 +3227,16 @@@ void GL_Main_Init(void 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"); + Cmd_AddCommand(CF_CLIENT, "r_glsl_restart", R_GLSL_Restart_f, "unloads GLSL shaders, they will then be reloaded as needed"); + Cmd_AddCommand(CF_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 if (gamemode == GAME_NEHAHRA) { diff --cc gl_textures.c index eb8e8631,83475227..f091229f --- a/gl_textures.c +++ b/gl_textures.c @@@ -699,14 -699,9 +699,14 @@@ static void r_textures_devicerestored(v 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"); + Cmd_AddCommand(CF_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(CF_CLIENT, "r_texturestats", R_TextureStats_f, "print information about all loaded textures and some statistics"); Cvar_RegisterVariable (&gl_max_size); Cvar_RegisterVariable (&gl_picmip); Cvar_RegisterVariable (&gl_picmip_world); diff --cc host.c index 111d2b2b,8cf8593d..b1f6f1fe --- a/host.c +++ b/host.c @@@ -232,12 -176,12 +176,12 @@@ 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"); - 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"); + Cmd_AddCommand(CF_SHARED, "quit", Host_Quit_f, "quit the game"); + Cmd_AddCommand(CF_SHARED, "version", Host_Version_f, "print engine version"); + Cmd_AddCommand(CF_SHARED, "saveconfig", Host_SaveConfig_f, "save settings to config.cfg (or a specified filename) immediately (also automatic when quitting)"); + Cmd_AddCommand(CF_SHARED, "loadconfig", Host_LoadConfig_f, "reset everything and reload configs"); Cvar_RegisterVariable (&cl_maxphysicsframesperserverframe); Cvar_RegisterVariable (&host_framerate); Cvar_RegisterCallback (&host_framerate, Host_Framerate_c); @@@ -656,15 -595,9 +595,15 @@@ static void Host_Init (void } // COMMANDLINEOPTION: Console: -nostdout disables text output to the terminal the game was launched from - if (COM_CheckParm("-nostdout")) + if (Sys_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(); @@@ -719,9 -640,10 +658,8 @@@ Mod_Init(); World_Init(); SV_Init(); - Host_ServerOptions(); - Host_InitLocal(); Thread_Init(); - TaskQueue_Init(); CL_Init(); diff --cc keys.h index 8f8a5f10,f6b78cd0..143fc015 --- a/keys.h +++ b/keys.h @@@ -371,12 -375,12 +375,12 @@@ extern int chat_mode; // 0 for say, 1 f extern char chat_buffer[MAX_INPUTLINE]; extern int chat_bufferpos; - int Key_ClearEditLine(qboolean is_console); + int Key_ClearEditLine(qbool is_console); void Key_WriteBindings(qfile_t *f); void Key_Init(void); +void Key_Init_Commands(void); void Key_Shutdown(void); - void Key_Event(int key, int ascii, qboolean down); -void Key_Init_Cvars(void); + void Key_Event(int key, int ascii, qbool down); void Key_ReleaseAll (void); void Key_ReleaseAll_f(cmd_state_t *cmd); void Key_EventQueue_Block(void); diff --cc model_brush.c index 0b0a3c37,cc52e72e..56da707c --- a/model_brush.c +++ b/model_brush.c @@@ -73,42 -73,9 +73,42 @@@ static texture_t mod_q1bsp_texture_lava static texture_t mod_q1bsp_texture_slime; 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); + static qbool 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); @@@ -149,9 -116,39 +149,9 @@@ 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) + static mleaf_t *Mod_BSP_PointInLeaf(model_t *model, const vec3_t p) { mnode_t *node; diff --cc model_shared.h index 13152c0d,0e477789..0afd1a39 --- a/model_shared.h +++ b/model_shared.h @@@ -1081,30 -558,29 +558,30 @@@ typedef struct modloader_ } modloader_t; // sky/water subdivision - //extern cvar_t gl_subdivide_size; + //extern struct cvar_s gl_subdivide_size; // texture fullbrights - extern cvar_t r_fullbrights; - - extern cvar_t mod_noshader_default_offsetmapping; - extern cvar_t mod_q3shader_default_offsetmapping; - extern cvar_t mod_q3shader_default_offsetmapping_scale; - extern cvar_t mod_q3shader_default_offsetmapping_bias; - extern cvar_t mod_q3shader_default_polygonoffset; - extern cvar_t mod_q3shader_default_polygonfactor; - extern cvar_t mod_q3shader_default_refractive_index; - extern cvar_t mod_q3shader_force_addalpha; - extern cvar_t mod_q3shader_force_terrain_alphaflag; - extern cvar_t mod_q3bsp_lightgrid_texture; - extern cvar_t mod_q3bsp_lightgrid_world_surfaces; - extern cvar_t mod_q3bsp_lightgrid_bsp_surfaces; + extern struct cvar_s r_fullbrights; + + extern struct cvar_s mod_noshader_default_offsetmapping; + extern struct cvar_s mod_q3shader_default_offsetmapping; + extern struct cvar_s mod_q3shader_default_offsetmapping_scale; + extern struct cvar_s mod_q3shader_default_offsetmapping_bias; + extern struct cvar_s mod_q3shader_default_polygonoffset; + extern struct cvar_s mod_q3shader_default_polygonfactor; + extern struct cvar_s mod_q3shader_default_refractive_index; + extern struct cvar_s mod_q3shader_force_addalpha; + extern struct cvar_s mod_q3shader_force_terrain_alphaflag; + extern struct cvar_s mod_q3bsp_lightgrid_texture; + extern struct cvar_s mod_q3bsp_lightgrid_world_surfaces; + extern struct cvar_s 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); - dp_model_t *Mod_ForName (const char *name, qboolean crash, qboolean checkdisk, const char *parentname); - void Mod_UnloadModel (dp_model_t *mod); + model_t *Mod_LoadModel(model_t *mod, qbool crash, qbool checkdisk); + model_t *Mod_FindName (const char *name, const char *parentname); + model_t *Mod_ForName (const char *name, qbool crash, qbool checkdisk, const char *parentname); + void Mod_UnloadModel (model_t *mod); void Mod_ClearUsed(void); void Mod_PurgeUnused(void); @@@ -1243,33 -718,32 +720,33 @@@ bih_t *Mod_MakeCollisionBIH(model_t *mo 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); + int Mod_Alias_GetTagMatrix(const model_t *model, const struct frameblend_s *frameblend, const struct skeleton_s *skeleton, int tagindex, matrix4x4_t *outmatrix); + int Mod_Alias_GetTagIndexForName(const model_t *model, unsigned int skin, const char *tagname); + int Mod_Alias_GetExtendedTagInfoForIndex(const 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); 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); - void Mod_BSP2_Load(dp_model_t *mod, void *buffer, void *bufferend); - void Mod_HLBSP_Load(dp_model_t *mod, void *buffer, void *bufferend); - void Mod_Q1BSP_Load(dp_model_t *mod, void *buffer, void *bufferend); - void Mod_IBSP_Load(dp_model_t *mod, void *buffer, void *bufferend); - void Mod_MAP_Load(dp_model_t *mod, void *buffer, void *bufferend); - void Mod_OBJ_Load(dp_model_t *mod, void *buffer, void *bufferend); - void Mod_IDP0_Load(dp_model_t *mod, void *buffer, void *bufferend); - void Mod_IDP2_Load(dp_model_t *mod, void *buffer, void *bufferend); - void Mod_IDP3_Load(dp_model_t *mod, void *buffer, void *bufferend); - void Mod_ZYMOTICMODEL_Load(dp_model_t *mod, void *buffer, void *bufferend); - void Mod_DARKPLACESMODEL_Load(dp_model_t *mod, void *buffer, void *bufferend); - void Mod_PSKMODEL_Load(dp_model_t *mod, void *buffer, void *bufferend); - void Mod_IDSP_Load(dp_model_t *mod, void *buffer, void *bufferend); - void Mod_IDS2_Load(dp_model_t *mod, void *buffer, void *bufferend); - void Mod_INTERQUAKEMODEL_Load(dp_model_t *mod, void *buffer, void *bufferend); + void Mod_2PSB_Load(model_t *mod, void *buffer, void *bufferend); + void Mod_BSP2_Load(model_t *mod, void *buffer, void *bufferend); + void Mod_HLBSP_Load(model_t *mod, void *buffer, void *bufferend); + void Mod_Q1BSP_Load(model_t *mod, void *buffer, void *bufferend); + void Mod_IBSP_Load(model_t *mod, void *buffer, void *bufferend); + void Mod_MAP_Load(model_t *mod, void *buffer, void *bufferend); + void Mod_OBJ_Load(model_t *mod, void *buffer, void *bufferend); + void Mod_IDP0_Load(model_t *mod, void *buffer, void *bufferend); + void Mod_IDP2_Load(model_t *mod, void *buffer, void *bufferend); + void Mod_IDP3_Load(model_t *mod, void *buffer, void *bufferend); + void Mod_ZYMOTICMODEL_Load(model_t *mod, void *buffer, void *bufferend); + void Mod_DARKPLACESMODEL_Load(model_t *mod, void *buffer, void *bufferend); + void Mod_PSKMODEL_Load(model_t *mod, void *buffer, void *bufferend); + void Mod_IDSP_Load(model_t *mod, void *buffer, void *bufferend); + void Mod_IDS2_Load(model_t *mod, void *buffer, void *bufferend); + void Mod_INTERQUAKEMODEL_Load(model_t *mod, void *buffer, void *bufferend); #endif // MODEL_SHARED_H diff --cc netconn.c index d77a30ba,1b48ac69..9a409459 --- a/netconn.c +++ b/netconn.c @@@ -3870,52 -3863,13 +3863,52 @@@ 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 ((i = Sys_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) ++ if (((i = Sys_CheckParm("-port")) || (i = Sys_CheckParm("-ipport")) || (i = Sys_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"); + Cmd_AddCommand(CF_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"); - Cmd_AddCommand(CMD_CLIENT, "net_slistqw", Net_SlistQW_f, "query qw master servers and print all server information"); - Cmd_AddCommand(CMD_CLIENT, "net_refresh", Net_Refresh_f, "query dp master servers and refresh all server information"); + Cmd_AddCommand(CF_CLIENT, "net_slist", Net_Slist_f, "query dp master servers and print all server information"); + Cmd_AddCommand(CF_CLIENT, "net_slistqw", Net_SlistQW_f, "query qw master servers and print all server information"); + Cmd_AddCommand(CF_CLIENT, "net_refresh", Net_Refresh_f, "query dp master servers and refresh all server information"); #endif - Cmd_AddCommand(CMD_SERVER, "heartbeat", Net_Heartbeat_f, "send a heartbeat to the master server (updates your server information)"); + Cmd_AddCommand(CF_SERVER, "heartbeat", Net_Heartbeat_f, "send a heartbeat to the master server (updates your server information)"); Cvar_RegisterVariable(&net_test); Cvar_RegisterVariable(&net_usesizelimit); Cvar_RegisterVariable(&net_burstreserve); diff --cc prvm_edict.c index 1198df60,5efd5ed6..cc1fc859 --- a/prvm_edict.c +++ b/prvm_edict.c @@@ -3137,35 -3137,27 +3137,35 @@@ PRVM_Ini =============== */ 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"); ++ prvm_runawaycheck = !Sys_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)"); - Cmd_AddCommand(CMD_SHARED, "prvm_edictcount", PRVM_ED_Count_f, "prints number of active entities in the selected VM (server, client, menu)"); - Cmd_AddCommand(CMD_SHARED, "prvm_profile", PRVM_Profile_f, "prints execution statistics about the most used QuakeC functions in the selected VM (server, client, menu)"); - Cmd_AddCommand(CMD_SHARED, "prvm_childprofile", PRVM_ChildProfile_f, "prints execution statistics about the most used QuakeC functions in the selected VM (server, client, menu), sorted by time taken in function with child calls"); - Cmd_AddCommand(CMD_SHARED, "prvm_callprofile", PRVM_CallProfile_f, "prints execution statistics about the most time consuming QuakeC calls from the engine in the selected VM (server, client, menu)"); - Cmd_AddCommand(CMD_SHARED, "prvm_fields", PRVM_Fields_f, "prints usage statistics on properties (how many entities have non-zero values) in the selected VM (server, client, menu)"); - Cmd_AddCommand(CMD_SHARED, "prvm_globals", PRVM_Globals_f, "prints all global variables in the selected VM (server, client, menu)"); - Cmd_AddCommand(CMD_SHARED, "prvm_global", PRVM_Global_f, "prints value of a specified global variable in the selected VM (server, client, menu)"); - Cmd_AddCommand(CMD_SHARED, "prvm_globalset", PRVM_GlobalSet_f, "sets value of a specified global variable in the selected VM (server, client, menu)"); - Cmd_AddCommand(CMD_SHARED, "prvm_edictset", PRVM_ED_EdictSet_f, "changes value of a specified property of a specified entity in the selected VM (server, client, menu)"); - Cmd_AddCommand(CMD_SHARED, "prvm_edictget", PRVM_ED_EdictGet_f, "retrieves the value of a specified property of a specified entity in the selected VM (server, client menu) into a cvar or to the console"); - Cmd_AddCommand(CMD_SHARED, "prvm_globalget", PRVM_ED_GlobalGet_f, "retrieves the value of a specified global variable in the selected VM (server, client menu) into a cvar or to the console"); - Cmd_AddCommand(CMD_SHARED, "prvm_printfunction", PRVM_PrintFunction_f, "prints a disassembly (QuakeC instructions) of the specified function in the selected VM (server, client, menu)"); - Cmd_AddCommand(CMD_SHARED, "cl_cmd", PRVM_GameCommand_Client_f, "calls the client QC function GameCommand with the supplied string as argument"); - Cmd_AddCommand(CMD_SHARED, "menu_cmd", PRVM_GameCommand_Menu_f, "calls the menu QC function GameCommand with the supplied string as argument"); - Cmd_AddCommand(CMD_SHARED, "sv_cmd", PRVM_GameCommand_Server_f, "calls the server QC function GameCommand with the supplied string as argument"); - Cmd_AddCommand(CMD_SHARED, "prvm_breakpoint", PRVM_Breakpoint_f, "marks a statement or function as breakpoint (when this is executed, a stack trace is printed); to actually halt and investigate state, combine this with a gdb breakpoint on PRVM_Breakpoint, or with prvm_breakpointdump; run with just progs name to clear breakpoint"); - Cmd_AddCommand(CMD_SHARED, "prvm_globalwatchpoint", PRVM_GlobalWatchpoint_f, "marks a global as watchpoint (when this is executed, a stack trace is printed); to actually halt and investigate state, combine this with a gdb breakpoint on PRVM_Breakpoint, or with prvm_breakpointdump; run with just progs name to clear watchpoint"); - Cmd_AddCommand(CMD_SHARED, "prvm_edictwatchpoint", PRVM_EdictWatchpoint_f, "marks an entity field as watchpoint (when this is executed, a stack trace is printed); to actually halt and investigate state, combine this with a gdb breakpoint on PRVM_Breakpoint, or with prvm_breakpointdump; run with just progs name to clear watchpoint"); + Cmd_AddCommand(CF_SHARED, "prvm_edict", PRVM_ED_PrintEdict_f, "print all data about an entity number in the selected VM (server, client, menu)"); + Cmd_AddCommand(CF_SHARED, "prvm_edicts", PRVM_ED_PrintEdicts_f, "prints all data about all entities in the selected VM (server, client, menu)"); + Cmd_AddCommand(CF_SHARED, "prvm_edictcount", PRVM_ED_Count_f, "prints number of active entities in the selected VM (server, client, menu)"); + Cmd_AddCommand(CF_SHARED, "prvm_profile", PRVM_Profile_f, "prints execution statistics about the most used QuakeC functions in the selected VM (server, client, menu)"); + Cmd_AddCommand(CF_SHARED, "prvm_childprofile", PRVM_ChildProfile_f, "prints execution statistics about the most used QuakeC functions in the selected VM (server, client, menu), sorted by time taken in function with child calls"); + Cmd_AddCommand(CF_SHARED, "prvm_callprofile", PRVM_CallProfile_f, "prints execution statistics about the most time consuming QuakeC calls from the engine in the selected VM (server, client, menu)"); + Cmd_AddCommand(CF_SHARED, "prvm_fields", PRVM_Fields_f, "prints usage statistics on properties (how many entities have non-zero values) in the selected VM (server, client, menu)"); + Cmd_AddCommand(CF_SHARED, "prvm_globals", PRVM_Globals_f, "prints all global variables in the selected VM (server, client, menu)"); + Cmd_AddCommand(CF_SHARED, "prvm_global", PRVM_Global_f, "prints value of a specified global variable in the selected VM (server, client, menu)"); + Cmd_AddCommand(CF_SHARED, "prvm_globalset", PRVM_GlobalSet_f, "sets value of a specified global variable in the selected VM (server, client, menu)"); + Cmd_AddCommand(CF_SHARED, "prvm_edictset", PRVM_ED_EdictSet_f, "changes value of a specified property of a specified entity in the selected VM (server, client, menu)"); + Cmd_AddCommand(CF_SHARED, "prvm_edictget", PRVM_ED_EdictGet_f, "retrieves the value of a specified property of a specified entity in the selected VM (server, client menu) into a cvar or to the console"); + Cmd_AddCommand(CF_SHARED, "prvm_globalget", PRVM_ED_GlobalGet_f, "retrieves the value of a specified global variable in the selected VM (server, client menu) into a cvar or to the console"); + Cmd_AddCommand(CF_SHARED, "prvm_printfunction", PRVM_PrintFunction_f, "prints a disassembly (QuakeC instructions) of the specified function in the selected VM (server, client, menu)"); + Cmd_AddCommand(CF_SHARED, "cl_cmd", PRVM_GameCommand_Client_f, "calls the client QC function GameCommand with the supplied string as argument"); + Cmd_AddCommand(CF_SHARED, "menu_cmd", PRVM_GameCommand_Menu_f, "calls the menu QC function GameCommand with the supplied string as argument"); + Cmd_AddCommand(CF_SHARED, "sv_cmd", PRVM_GameCommand_Server_f, "calls the server QC function GameCommand with the supplied string as argument"); + Cmd_AddCommand(CF_SHARED, "prvm_breakpoint", PRVM_Breakpoint_f, "marks a statement or function as breakpoint (when this is executed, a stack trace is printed); to actually halt and investigate state, combine this with a gdb breakpoint on PRVM_Breakpoint, or with prvm_breakpointdump; run with just progs name to clear breakpoint"); + Cmd_AddCommand(CF_SHARED, "prvm_globalwatchpoint", PRVM_GlobalWatchpoint_f, "marks a global as watchpoint (when this is executed, a stack trace is printed); to actually halt and investigate state, combine this with a gdb breakpoint on PRVM_Breakpoint, or with prvm_breakpointdump; run with just progs name to clear watchpoint"); + Cmd_AddCommand(CF_SHARED, "prvm_edictwatchpoint", PRVM_EdictWatchpoint_f, "marks an entity field as watchpoint (when this is executed, a stack trace is printed); to actually halt and investigate state, combine this with a gdb breakpoint on PRVM_Breakpoint, or with prvm_breakpointdump; run with just progs name to clear watchpoint"); Cvar_RegisterVariable (&prvm_language); Cvar_RegisterVariable (&prvm_traceqc); diff --cc r_lightning.c index fcfe30bf,9a73a50f..0901974e --- a/r_lightning.c +++ b/r_lightning.c @@@ -107,9 -102,10 +107,9 @@@ void R_LightningBeams_Init_Commands(voi 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) + static void CL_Beam_AddQuad(model_t *mod, msurface_t *surf, const vec3_t start, const vec3_t end, const vec3_t offset, float t1, float t2) { int e0, e1, e2, e3; vec3_t n; diff --cc r_sky.c index dfe74937,7fd1463d..5f60f038 --- a/r_sky.c +++ b/r_sky.c @@@ -462,15 -462,8 +462,15 @@@ 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)"); + Cmd_AddCommand(CF_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); diff --cc render.h index b737e6da,db5f9e85..0427e091 --- a/render.h +++ b/render.h @@@ -725,11 -979,10 +979,11 @@@ void R_DrawPortals(void) void R_BuildLightMap(const entity_render_t *ent, msurface_t *surface); void R_Water_AddWaterPlane(msurface_t *surface, int entno); int R_Shadow_GetRTLightInfo(unsigned int lightindex, float *origin, float *radius, float *color); - 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); + dp_font_t *FindFont(const char *title, qbool allocate_new); + void LoadFont(qbool 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); @@@ -746,19 -999,7 +1000,19 @@@ 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); + qbool R_CompileShader_CheckStaticParms(void); void R_GLSL_Restart_f(cmd_state_t *cmd); #endif diff --cc sbar.c index f7bedd52,6fc6c327..ade2ca18 --- a/sbar.c +++ b/sbar.c @@@ -359,18 -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"); + Cmd_AddCommand(CF_CLIENT, "+showscores", Sbar_ShowScores_f, "show scoreboard"); + Cmd_AddCommand(CF_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); diff --cc server.h index 10c53417,9a9a6d9b..67db5352 --- a/server.h +++ b/server.h @@@ -512,7 -512,10 +512,11 @@@ extern client_t *host_client //=========================================================== void SV_Init (void); +void SV_Init_Commands(void); + double SV_Frame(double time); + void SV_Shutdown(void); + + int SV_IsLocalServer(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 --cc snd_main.c index 0d96b2fa,3e8d52a8..d9a70325 --- a/snd_main.c +++ b/snd_main.c @@@ -702,31 -702,6 +702,31 @@@ S_Ini ================ */ void S_Init(void) +{ +// COMMANDLINEOPTION: Sound: -nosound disables sound (including CD audio) - if (COM_CheckParm("-nosound")) ++ if (Sys_CheckParm("-nosound")) + return; + + snd_mempool = Mem_AllocPool("sound", 0, NULL); + +// COMMANDLINEOPTION: Sound: -simsound runs sound mixing but with no output - if (COM_CheckParm("-simsound")) ++ if (Sys_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); @@@ -798,23 -773,31 +798,23 @@@ Cvar_RegisterVariable(&snd_identicalsoundrandomization_time); Cvar_RegisterVariable(&snd_identicalsoundrandomization_tics); - if (COM_CheckParm("-nosound")) - -// COMMANDLINEOPTION: Sound: -nosound disables sound (including CD audio) + if (Sys_CheckParm("-nosound")) { // dummy out Play and Play2 because mods stuffcmd that - Cmd_AddCommand(CMD_CLIENT, "play", Host_NoOperation_f, "does nothing because -nosound was specified"); - Cmd_AddCommand(CMD_CLIENT, "play2", Host_NoOperation_f, "does nothing because -nosound was specified"); + Cmd_AddCommand(CF_CLIENT, "play", Host_NoOperation_f, "does nothing because -nosound was specified"); + Cmd_AddCommand(CF_CLIENT, "play2", Host_NoOperation_f, "does nothing because -nosound was specified"); return; } - 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)"); - Cmd_AddCommand(CMD_CLIENT, "stopsound", S_StopAllSounds_f, "silence"); - Cmd_AddCommand(CMD_CLIENT, "pausesound", S_PauseSound_f, "temporary silence"); - Cmd_AddCommand(CMD_CLIENT, "soundlist", S_SoundList_f, "list loaded sounds"); - Cmd_AddCommand(CMD_CLIENT, "soundinfo", S_SoundInfo_f, "print sound system information (such as channels and speed)"); - Cmd_AddCommand(CMD_CLIENT, "snd_restart", S_Restart_f, "restart sound system"); - Cmd_AddCommand(CMD_CLIENT, "snd_unloadallsounds", S_UnloadAllSounds_f, "unload all sound files"); - snd_mempool = Mem_AllocPool("sound", 0, NULL); - -// COMMANDLINEOPTION: Sound: -simsound runs sound mixing but with no output - if (Sys_CheckParm("-simsound")) - simsound = true; - + Cmd_AddCommand(CF_CLIENT, "play", S_Play_f, "play a sound at your current location (not heard by anyone else)"); + Cmd_AddCommand(CF_CLIENT, "play2", S_Play2_f, "play a sound globally throughout the level (not heard by anyone else)"); + Cmd_AddCommand(CF_CLIENT, "playvol", S_PlayVol_f, "play a sound at the specified volume level at your current location (not heard by anyone else)"); + Cmd_AddCommand(CF_CLIENT, "stopsound", S_StopAllSounds_f, "silence"); + Cmd_AddCommand(CF_CLIENT, "pausesound", S_PauseSound_f, "temporary silence"); + Cmd_AddCommand(CF_CLIENT, "soundlist", S_SoundList_f, "list loaded sounds"); + Cmd_AddCommand(CF_CLIENT, "soundinfo", S_SoundInfo_f, "print sound system information (such as channels and speed)"); + Cmd_AddCommand(CF_CLIENT, "snd_restart", S_Restart_f, "restart sound system"); + Cmd_AddCommand(CF_CLIENT, "snd_unloadallsounds", S_UnloadAllSounds_f, "unload all sound files"); Cvar_RegisterVariable(&nosound); Cvar_RegisterVariable(&snd_precache); diff --cc snd_null.c index 65c083e1,f487874a..53dd11de --- a/snd_null.c +++ b/snd_null.c @@@ -22,18 -22,14 +22,18 @@@ Foundation, Inc., 59 Temple Place - Sui #include "quakedef.h" - cvar_t bgmvolume = {CVAR_SAVE, "bgmvolume", "1", "volume of background music (such as CD music or replacement files such as sound/cdtracks/track002.ogg)"}; - cvar_t mastervolume = {CVAR_SAVE, "mastervolume", "1", "master volume"}; - cvar_t volume = {CVAR_SAVE, "volume", "0.7", "volume of sound effects"}; - cvar_t snd_staticvolume = {CVAR_SAVE, "snd_staticvolume", "1", "volume of ambient sound effects (such as swampy sounds at the start of e1m2)"}; - cvar_t snd_initialized = { CVAR_READONLY, "snd_initialized", "0", "indicates the sound subsystem is active"}; - cvar_t snd_mutewhenidle = {CVAR_SAVE, "snd_mutewhenidle", "1", "whether to disable sound output when game window is inactive"}; + cvar_t bgmvolume = {CF_ARCHIVE, "bgmvolume", "1", "volume of background music (such as CD music or replacement files such as sound/cdtracks/track002.ogg)"}; + cvar_t mastervolume = {CF_ARCHIVE, "mastervolume", "1", "master volume"}; + cvar_t volume = {CF_ARCHIVE, "volume", "0.7", "volume of sound effects"}; + cvar_t snd_staticvolume = {CF_ARCHIVE, "snd_staticvolume", "1", "volume of ambient sound effects (such as swampy sounds at the start of e1m2)"}; + cvar_t snd_initialized = { CF_READONLY, "snd_initialized", "0", "indicates the sound subsystem is active"}; + cvar_t snd_mutewhenidle = {CF_ARCHIVE, "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 --cc sv_main.c index 36d4e284,10b321e2..9497dfe2 --- a/sv_main.c +++ b/sv_main.c @@@ -438,11 -512,6 +512,15 @@@ SV_Ini =============== */ void SV_Init (void) +{ + sv_mempool = Mem_AllocPool("server", 0, NULL); ++ ++ host.hook.SV_CanSave = SV_CanSave; ++ ++ SV_ServerOptions(); +} + +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] diff --cc taskqueue.h index 023df29e,0f64cf6f..d8877754 --- a/taskqueue.h +++ b/taskqueue.h @@@ -43,8 -43,8 +43,8 @@@ void TaskQueue_Setup(taskqueue_task_t * // 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); + void TaskQueue_Frame(qbool shutdown); #endif diff --cc utf8lib.c index 4ec965e7,155b4aea..de4b2df3 --- a/utf8lib.c +++ b/utf8lib.c @@@ -7,9 -8,9 +8,9 @@@ Initialization of UTF-8 support and ne ================================================================================ */ // 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."}; + cvar_t utf8_enable = {CF_CLIENT | CF_SERVER | CF_ARCHIVE, "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 --cc utf8lib.h index 1911c29b,f5454776..48fcae20 --- a/utf8lib.h +++ b/utf8lib.h @@@ -19,8 -20,8 +20,8 @@@ typedef int32_t Uchar // a non-utf8 version to work: u8_strlen() will wrap to strlen() // 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; + extern struct cvar_s 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 --cc vid_null.c index a984a29c,cf2ba864..dfa39737 --- a/vid_null.c +++ b/vid_null.c @@@ -64,11 -64,7 +64,11 @@@ void VID_Init(void InitSig(); // trap evil signals } +void VID_Init_Commands(void) +{ +} + - qboolean VID_InitMode(viddef_mode_t *mode) + qbool VID_InitMode(viddef_mode_t *mode) { return false; } diff --cc vid_sdl.c index a5ce4dbd,97e54735..0f395d6e --- a/vid_sdl.c +++ b/vid_sdl.c @@@ -1336,18 -1342,8 +1336,18 @@@ 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) + void VID_EnableJoystick(qbool enable) { int index = joy_enable.integer > 0 ? joy_index.integer : -1; int numsdljoysticks; diff --cc vid_shared.c index b469b7cb,df8662d5..9c66c8f8 --- a/vid_shared.c +++ b/vid_shared.c @@@ -1365,8 -1358,13 +1365,8 @@@ void VID_Shared_Init_Commands(void Cvar_RegisterVariable(&joy_x360_sensitivitypitch); Cvar_RegisterVariable(&joy_x360_sensitivityyaw); //Cvar_RegisterVariable(&joy_x360_sensitivityroll); - 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)"); - -#ifdef WIN32 - Sys_LoadLibrary(xinputdllnames, &xinputdll_dll, xinputdllfuncs); -#endif - + Cmd_AddCommand(CF_CLIENT, "force_centerview", Force_CenterView_f, "recenters view (stops looking up/down)"); + Cmd_AddCommand(CF_CLIENT, "vid_restart", VID_Restart_f, "restarts video system (closes and reopens the window, restarts renderer)"); } static int VID_Mode(int fullscreen, int width, int height, int bpp, float refreshrate, int stereobuffer)