]> git.xonotic.org Git - xonotic/darkplaces.git/blobdiff - cl_main.c
prvm_edict: Spelling
[xonotic/darkplaces.git] / cl_main.c
index 17b607d623a79ac1c0d0a00bca54fede213fb3e3..2a2b9976d204dd82cc6e41bf67c9c3e1b1e6cf50 100644 (file)
--- a/cl_main.c
+++ b/cl_main.c
@@ -147,7 +147,7 @@ void CL_ClearState(void)
 
        // tweak these if the game runs out
        cl.max_csqcrenderentities = 0;
-       cl.max_entities = MAX_ENITIES_INITIAL;
+       cl.max_entities = MAX_ENTITIES_INITIAL;
        cl.max_static_entities = MAX_STATICENTITIES;
        cl.max_effects = MAX_EFFECTS;
        cl.max_beams = MAX_BEAMS;
@@ -340,6 +340,16 @@ void CL_ExpandCSQCRenderEntities(int num)
        }
 }
 
+static void CL_ToggleMenu_Hook(void)
+{
+#ifdef CONFIG_MENU
+       // remove menu
+       if (key_dest == key_menu || key_dest == key_menu_grabbed)
+               MR_ToggleMenu(0);
+#endif
+       key_dest = key_game;
+}
+
 extern cvar_t rcon_secure;
 
 /*
@@ -430,7 +440,7 @@ This command causes the client to wait for the signon messages again.
 This is sent just before a server changes levels
 ==================
 */
-void CL_Reconnect_f(cmd_state_t *cmd)
+static void CL_Reconnect_f(cmd_state_t *cmd)
 {
        char temp[128];
        // if not connected, reconnect to the most recent server
@@ -529,9 +539,6 @@ void CL_EstablishConnection(const char *address, int firstarg)
        M_Update_Return_Reason("");
 #endif
 
-       // Disconnect from the current server, or stop a running demo.
-       CL_Disconnect();
-
        // make sure the client ports are open before attempting to connect
        NetConn_UpdateSockets();
 
@@ -571,7 +578,13 @@ void CL_EstablishConnection(const char *address, int firstarg)
 
 static void CL_EstablishConnection_Local(void)
 {
-       CL_EstablishConnection("local:1", -2);
+       if(cls.state == ca_disconnected)
+               CL_EstablishConnection("local:1", -2);
+}
+
+static qbool CL_Intermission(void)
+{
+       return cl.intermission;
 }
 
 /*
@@ -609,7 +622,7 @@ List information on all models in the client modelindex
 static void CL_ModelIndexList_f(cmd_state_t *cmd)
 {
        int i;
-       dp_model_t *model;
+       model_t *model;
 
        // Print Header
        Con_Printf("%3s: %-30s %-8s %-8s\n", "ID", "Name", "Type", "Triangles");
@@ -656,7 +669,7 @@ void CL_UpdateRenderEntity(entity_render_t *ent)
 {
        vec3_t org;
        vec_t scale;
-       dp_model_t *model = ent->model;
+       model_t *model = ent->model;
        // update the inverse matrix for the renderer
        Matrix4x4_Invert_Simple(&ent->inversematrix, &ent->matrix);
        // update the animation blend state
@@ -766,7 +779,7 @@ entity_render_t *CL_NewTempEntity(double shadertime)
        return render;
 }
 
-void CL_Effect(vec3_t org, dp_model_t *model, int startframe, int framecount, float framerate)
+void CL_Effect(vec3_t org, model_t *model, int startframe, int framecount, float framerate)
 {
        int i;
        cl_effect_t *e;
@@ -2463,7 +2476,7 @@ void CL_Locs_Reload_f(cmd_state_t *cmd)
 }
 
 entity_t cl_meshentities[NUM_MESHENTITIES];
-dp_model_t cl_meshentitymodels[NUM_MESHENTITIES];
+model_t cl_meshentitymodels[NUM_MESHENTITIES];
 const char *cl_meshentitynames[NUM_MESHENTITIES] =
 {
        "MESH_SCENE",
@@ -2715,6 +2728,21 @@ void CL_UpdateEntityShading(void)
                CL_UpdateEntityShading_Entity(r_refdef.scene.entities[i]);
 }
 
+qbool vid_opened = false;
+void CL_StartVideo(void)
+{
+       if (!vid_opened && cls.state != ca_dedicated)
+       {
+               vid_opened = true;
+#ifdef WIN32
+               // make sure we open sockets before opening video because the Windows Firewall "unblock?" dialog can screw up the graphics context on some graphics drivers
+               NetConn_UpdateSockets();
+#endif
+               VID_Start();
+               CDAudio_Startup();
+       }
+}
+
 extern cvar_t host_framerate;
 extern cvar_t host_speeds;
 
@@ -2922,6 +2950,8 @@ void CL_Init (void)
        {
                Con_Printf("Initializing client\n");
 
+               Cvar_SetValueQuick(&host_isclient, 1);
+
                R_Modules_Init();
                Palette_Init();
 #ifdef CONFIG_MENU
@@ -3055,9 +3085,8 @@ void CL_Init (void)
                CL_Video_Init();
 
                host.hook.ConnectLocal = CL_EstablishConnection_Local;
-
-               #ifdef CONFIG_MENU
-               Cbuf_InsertText(&cmd_client,"menu_start\n");
-               #endif
+               host.hook.Disconnect = CL_Disconnect;
+               host.hook.CL_Intermission = CL_Intermission;
+               host.hook.ToggleMenu = CL_ToggleMenu_Hook;
        }
 }