From caa7be46bc7ce305abd88713dade4e2eaca2060a Mon Sep 17 00:00:00 2001 From: cloudwalk Date: Thu, 4 Jun 2020 14:57:35 +0000 Subject: [PATCH] Make sure the rest of CL_Init only runs on client, matching previous behavior git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@12634 d7cf8633-e32d-0410-b094-e92efae38249 --- cl_main.c | 225 +++++++++++++++++++++++++++--------------------------- 1 file changed, 113 insertions(+), 112 deletions(-) diff --git a/cl_main.c b/cl_main.c index 83f7d97c..b57d5043 100644 --- a/cl_main.c +++ b/cl_main.c @@ -2664,117 +2664,118 @@ void CL_Init (void) S_Init(); CDAudio_Init(); Key_Init(); - } - cls.levelmempool = Mem_AllocPool("client (per-level memory)", 0, NULL); - cls.permanentmempool = Mem_AllocPool("client (long term memory)", 0, NULL); - - memset(&r_refdef, 0, sizeof(r_refdef)); - // max entities sent to renderer per frame - r_refdef.scene.maxentities = MAX_EDICTS + 256 + 512; - r_refdef.scene.entities = (entity_render_t **)Mem_Alloc(cls.permanentmempool, sizeof(entity_render_t *) * r_refdef.scene.maxentities); - - // max temp entities - 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 (); - -// -// register our commands -// - Cvar_RegisterVariable (&cl_upspeed); - Cvar_RegisterVariable (&cl_forwardspeed); - Cvar_RegisterVariable (&cl_backspeed); - Cvar_RegisterVariable (&cl_sidespeed); - Cvar_RegisterVariable (&cl_movespeedkey); - Cvar_RegisterVariable (&cl_yawspeed); - Cvar_RegisterVariable (&cl_pitchspeed); - Cvar_RegisterVariable (&cl_anglespeedkey); - Cvar_RegisterVariable (&cl_shownet); - Cvar_RegisterVariable (&cl_nolerp); - Cvar_RegisterVariable (&cl_lerpexcess); - Cvar_RegisterVariable (&cl_lerpanim_maxdelta_server); - Cvar_RegisterVariable (&cl_lerpanim_maxdelta_framegroups); - Cvar_RegisterVariable (&cl_deathfade); - Cvar_RegisterVariable (&lookspring); - Cvar_RegisterVariable (&lookstrafe); - Cvar_RegisterVariable (&sensitivity); - Cvar_RegisterVariable (&freelook); - - Cvar_RegisterVariable (&m_pitch); - Cvar_RegisterVariable (&m_yaw); - Cvar_RegisterVariable (&m_forward); - Cvar_RegisterVariable (&m_side); - - 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, "record", CL_Record_f, "record a demo"); - Cmd_AddCommand(&cmd_client, "stop", CL_Stop_f, "stop recording or playing a demo"); - Cmd_AddCommand(&cmd_client, "playdemo", CL_PlayDemo_f, "watch a demo file"); - Cmd_AddCommand(&cmd_client, "timedemo", CL_TimeDemo_f, "play back a demo as fast as possible and save statistics to benchmark.log"); - - // Support Client-side Model Index List - Cmd_AddCommand(&cmd_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"); - - Cvar_RegisterVariable (&cl_autodemo); - Cvar_RegisterVariable (&cl_autodemo_nameformat); - Cvar_RegisterVariable (&cl_autodemo_delete); - - 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)"); - - // LadyHavoc: added pausedemo - Cmd_AddCommand(&cmd_client, "pausedemo", CL_PauseDemo_f, "pause demo playback (can also safely pause demo recording if using QUAKE, QUAKEDP or NEHAHRAMOVIE protocol, useful for making movies)"); - - Cmd_AddCommand(&cmd_client, "cl_areastats", CL_AreaStats_f, "prints statistics on entity culling during collision traces"); - - Cvar_RegisterVariable(&r_draweffects); - Cvar_RegisterVariable(&cl_explosions_alpha_start); - Cvar_RegisterVariable(&cl_explosions_alpha_end); - Cvar_RegisterVariable(&cl_explosions_size_start); - Cvar_RegisterVariable(&cl_explosions_size_end); - Cvar_RegisterVariable(&cl_explosions_lifetime); - Cvar_RegisterVariable(&cl_stainmaps); - Cvar_RegisterVariable(&cl_stainmaps_clearonload); - Cvar_RegisterVariable(&cl_beams_polygons); - Cvar_RegisterVariable(&cl_beams_quakepositionhack); - Cvar_RegisterVariable(&cl_beams_instantaimhack); - Cvar_RegisterVariable(&cl_beams_lightatend); - Cvar_RegisterVariable(&cl_noplayershadow); - Cvar_RegisterVariable(&cl_dlights_decayradius); - Cvar_RegisterVariable(&cl_dlights_decaybrightness); - - Cvar_RegisterVariable(&cl_prydoncursor); - Cvar_RegisterVariable(&cl_prydoncursor_notrace); - - Cvar_RegisterVariable(&cl_deathnoviewmodel); - - // 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"); - - Cvar_RegisterVariable(&cl_locs_enable); - Cvar_RegisterVariable(&cl_locs_show); - Cmd_AddCommand(&cmd_client, "locs_add", CL_Locs_Add_f, "add a point or box location (usage: x y z[ x y z] \"name\", if two sets of xyz are supplied it is a box, otherwise point)"); - Cmd_AddCommand(&cmd_client, "locs_removenearest", CL_Locs_RemoveNearest_f, "remove the nearest point or box (note: you need to be very near a box to remove it)"); - Cmd_AddCommand(&cmd_client, "locs_clear", CL_Locs_Clear_f, "remove all loc points/boxes"); - Cmd_AddCommand(&cmd_client, "locs_reload", CL_Locs_Reload_f, "reload .loc file for this map"); - Cmd_AddCommand(&cmd_client, "locs_save", CL_Locs_Save_f, "save .loc file for this map containing currently defined points and boxes"); - - Cvar_RegisterVariable(&csqc_polygons_defaultmaterial_nocullface); - - CL_Parse_Init(); - CL_Particles_Init(); - CL_Screen_Init(); - CL_MeshEntities_Init(); - - CL_Video_Init(); + + cls.levelmempool = Mem_AllocPool("client (per-level memory)", 0, NULL); + cls.permanentmempool = Mem_AllocPool("client (long term memory)", 0, NULL); + + memset(&r_refdef, 0, sizeof(r_refdef)); + // max entities sent to renderer per frame + r_refdef.scene.maxentities = MAX_EDICTS + 256 + 512; + r_refdef.scene.entities = (entity_render_t **)Mem_Alloc(cls.permanentmempool, sizeof(entity_render_t *) * r_refdef.scene.maxentities); + + // max temp entities + 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 (); + + // + // register our commands + // + Cvar_RegisterVariable (&cl_upspeed); + Cvar_RegisterVariable (&cl_forwardspeed); + Cvar_RegisterVariable (&cl_backspeed); + Cvar_RegisterVariable (&cl_sidespeed); + Cvar_RegisterVariable (&cl_movespeedkey); + Cvar_RegisterVariable (&cl_yawspeed); + Cvar_RegisterVariable (&cl_pitchspeed); + Cvar_RegisterVariable (&cl_anglespeedkey); + Cvar_RegisterVariable (&cl_shownet); + Cvar_RegisterVariable (&cl_nolerp); + Cvar_RegisterVariable (&cl_lerpexcess); + Cvar_RegisterVariable (&cl_lerpanim_maxdelta_server); + Cvar_RegisterVariable (&cl_lerpanim_maxdelta_framegroups); + Cvar_RegisterVariable (&cl_deathfade); + Cvar_RegisterVariable (&lookspring); + Cvar_RegisterVariable (&lookstrafe); + Cvar_RegisterVariable (&sensitivity); + Cvar_RegisterVariable (&freelook); + + Cvar_RegisterVariable (&m_pitch); + Cvar_RegisterVariable (&m_yaw); + Cvar_RegisterVariable (&m_forward); + Cvar_RegisterVariable (&m_side); + + 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, "record", CL_Record_f, "record a demo"); + Cmd_AddCommand(&cmd_client, "stop", CL_Stop_f, "stop recording or playing a demo"); + Cmd_AddCommand(&cmd_client, "playdemo", CL_PlayDemo_f, "watch a demo file"); + Cmd_AddCommand(&cmd_client, "timedemo", CL_TimeDemo_f, "play back a demo as fast as possible and save statistics to benchmark.log"); + + // Support Client-side Model Index List + Cmd_AddCommand(&cmd_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"); + + Cvar_RegisterVariable (&cl_autodemo); + Cvar_RegisterVariable (&cl_autodemo_nameformat); + Cvar_RegisterVariable (&cl_autodemo_delete); + + 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)"); + + // LadyHavoc: added pausedemo + Cmd_AddCommand(&cmd_client, "pausedemo", CL_PauseDemo_f, "pause demo playback (can also safely pause demo recording if using QUAKE, QUAKEDP or NEHAHRAMOVIE protocol, useful for making movies)"); + + Cmd_AddCommand(&cmd_client, "cl_areastats", CL_AreaStats_f, "prints statistics on entity culling during collision traces"); + + Cvar_RegisterVariable(&r_draweffects); + Cvar_RegisterVariable(&cl_explosions_alpha_start); + Cvar_RegisterVariable(&cl_explosions_alpha_end); + Cvar_RegisterVariable(&cl_explosions_size_start); + Cvar_RegisterVariable(&cl_explosions_size_end); + Cvar_RegisterVariable(&cl_explosions_lifetime); + Cvar_RegisterVariable(&cl_stainmaps); + Cvar_RegisterVariable(&cl_stainmaps_clearonload); + Cvar_RegisterVariable(&cl_beams_polygons); + Cvar_RegisterVariable(&cl_beams_quakepositionhack); + Cvar_RegisterVariable(&cl_beams_instantaimhack); + Cvar_RegisterVariable(&cl_beams_lightatend); + Cvar_RegisterVariable(&cl_noplayershadow); + Cvar_RegisterVariable(&cl_dlights_decayradius); + Cvar_RegisterVariable(&cl_dlights_decaybrightness); + + Cvar_RegisterVariable(&cl_prydoncursor); + Cvar_RegisterVariable(&cl_prydoncursor_notrace); + + Cvar_RegisterVariable(&cl_deathnoviewmodel); + + // 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"); + + Cvar_RegisterVariable(&cl_locs_enable); + Cvar_RegisterVariable(&cl_locs_show); + Cmd_AddCommand(&cmd_client, "locs_add", CL_Locs_Add_f, "add a point or box location (usage: x y z[ x y z] \"name\", if two sets of xyz are supplied it is a box, otherwise point)"); + Cmd_AddCommand(&cmd_client, "locs_removenearest", CL_Locs_RemoveNearest_f, "remove the nearest point or box (note: you need to be very near a box to remove it)"); + Cmd_AddCommand(&cmd_client, "locs_clear", CL_Locs_Clear_f, "remove all loc points/boxes"); + Cmd_AddCommand(&cmd_client, "locs_reload", CL_Locs_Reload_f, "reload .loc file for this map"); + Cmd_AddCommand(&cmd_client, "locs_save", CL_Locs_Save_f, "save .loc file for this map containing currently defined points and boxes"); + + Cvar_RegisterVariable(&csqc_polygons_defaultmaterial_nocullface); + + CL_Parse_Init(); + CL_Particles_Init(); + CL_Screen_Init(); + CL_MeshEntities_Init(); + + CL_Video_Init(); + } } -- 2.39.2