]> de.git.xonotic.org Git - xonotic/darkplaces.git/blobdiff - cl_parse.c
moved many cl_ prefixed variables into cl. or cls.
[xonotic/darkplaces.git] / cl_parse.c
index 7430363d1b62a196e9d11aad69cb932382e5597c..dfd07743659c8e4a0fb3bfc4943065e027e234ac 100644 (file)
@@ -83,7 +83,7 @@ char *svc_strings[128] =
        "", // 47
        "", // 48
        "", // 49
-       "svc_cgame", //                         50              // [short] length [bytes] data
+       "svc_unusedlh1", //                             50              //
        "svc_updatestatubyte", //                       51              // [byte] stat [byte] value
        "svc_effect", //                        52              // [vector] org [byte] modelindex [byte] startframe [byte] framecount [byte] framerate
        "svc_effect2", //                       53              // [vector] org [short] modelindex [short] startframe [byte] framecount [byte] framerate
@@ -490,11 +490,10 @@ static void QW_CL_RequestNextDownload(void)
 
                // now that we have a world model, set up the world entity, renderer
                // modules and csqc
-               cl_entities[0].render.model = cl.worldmodel = cl.model_precache[1];
-               CL_BoundingBoxForEntity(&cl_entities[0].render);
+               cl.entities[0].render.model = cl.worldmodel = cl.model_precache[1];
+               CL_BoundingBoxForEntity(&cl.entities[0].render);
 
                R_Modules_NewMap();
-               CL_CGVM_Start();
 
                // done checking sounds and models, send a prespawn command now
                MSG_WriteByte(&cls.netcon->message, qw_clc_stringcmd);
@@ -587,7 +586,7 @@ static void QW_CL_ParseDownload(void)
                while (cls.qw_downloadmemorymaxsize < cls.qw_downloadmemorycursize + size)
                        cls.qw_downloadmemorymaxsize *= 2;
                old = cls.qw_downloadmemory;
-               cls.qw_downloadmemory = Mem_Alloc(cl_mempool, cls.qw_downloadmemorymaxsize);
+               cls.qw_downloadmemory = Mem_Alloc(cls.mempool, cls.qw_downloadmemorymaxsize);
                if (old)
                {
                        memcpy(cls.qw_downloadmemory, old, cls.qw_downloadmemorycursize);
@@ -749,7 +748,7 @@ void QW_CL_StartUpload(unsigned char *data, int size)
 
        Con_DPrintf("Starting upload of %d bytes...\n", size);
 
-       cls.qw_uploaddata = Mem_Alloc(cl_mempool, size);
+       cls.qw_uploaddata = Mem_Alloc(cls.mempool, size);
        memcpy(cls.qw_uploaddata, data, size);
        cls.qw_uploadsize = size;
        cls.qw_uploadpos = 0;
@@ -986,7 +985,7 @@ void CL_ParseServerInfo (void)
        cls.protocol = protocol;
        Con_DPrintf("Server protocol is %s\n", Protocol_NameForEnum(cls.protocol));
 
-       cl_num_entities = 1;
+       cl.num_entities = 1;
 
        if (protocol == PROTOCOL_QUAKEWORLD)
        {
@@ -1017,7 +1016,7 @@ void CL_ParseServerInfo (void)
                i = MSG_ReadByte();
                cl.qw_spectator = (i & 128) != 0;
                cl.playerentity = cl.viewentity = (i & 127) + 1;
-               cl.scores = (scoreboard_t *)Mem_Alloc(cl_mempool, cl.maxclients*sizeof(*cl.scores));
+               cl.scores = (scoreboard_t *)Mem_Alloc(cls.mempool, cl.maxclients*sizeof(*cl.scores));
 
                // get the full level name
                str = MSG_ReadString ();
@@ -1060,7 +1059,7 @@ void CL_ParseServerInfo (void)
                        Host_Error("Bad maxclients (%u) from server", cl.maxclients);
                        return;
                }
-               cl.scores = (scoreboard_t *)Mem_Alloc(cl_mempool, cl.maxclients*sizeof(*cl.scores));
+               cl.scores = (scoreboard_t *)Mem_Alloc(cls.mempool, cl.maxclients*sizeof(*cl.scores));
 
        // parse gametype
                cl.gametype = MSG_ReadByte ();
@@ -1151,10 +1150,9 @@ void CL_ParseServerInfo (void)
                }
 
                // we now have the worldmodel so we can set up the game world
-               cl_entities[0].render.model = cl.worldmodel = cl.model_precache[1];
-               CL_BoundingBoxForEntity(&cl_entities[0].render);
+               cl.entities[0].render.model = cl.worldmodel = cl.model_precache[1];
+               CL_BoundingBoxForEntity(&cl.entities[0].render);
                R_Modules_NewMap();
-               CL_CGVM_Start();
        }
 
        // check memory integrity
@@ -1417,9 +1415,9 @@ void CL_ParseStatic (int large)
 {
        entity_t *ent;
 
-       if (cl_num_static_entities >= cl_max_static_entities)
+       if (cl.num_static_entities >= cl.max_static_entities)
                Host_Error ("Too many static entities");
-       ent = &cl_static_entities[cl_num_static_entities++];
+       ent = &cl.static_entities[cl.num_static_entities++];
        CL_ParseBaseline (ent, large);
 
 // copy it to the current state
@@ -1443,7 +1441,7 @@ void CL_ParseStatic (int large)
 
        // This is definitely cheating...
        if (ent->render.model == NULL)
-               cl_num_static_entities--;
+               cl.num_static_entities--;
 }
 
 /*
@@ -1511,23 +1509,23 @@ void CL_ParseBeam (model_t *m, int lightning)
                ent = 0;
        }
 
-       if (ent >= cl_max_entities)
+       if (ent >= cl.max_entities)
                CL_ExpandEntities(ent);
 
        // override any beam with the same entity
-       i = cl_max_beams;
+       i = cl.max_beams;
        if (ent)
-               for (i = 0, b = cl_beams;i < cl_max_beams;i++, b++)
+               for (i = 0, b = cl.beams;i < cl.max_beams;i++, b++)
                        if (b->entity == ent)
                                break;
        // if the entity was not found then just replace an unused beam
-       if (i == cl_max_beams)
-               for (i = 0, b = cl_beams;i < cl_max_beams;i++, b++)
+       if (i == cl.max_beams)
+               for (i = 0, b = cl.beams;i < cl.max_beams;i++, b++)
                        if (!b->model || b->endtime < cl.time)
                                break;
-       if (i < cl_max_beams)
+       if (i < cl.max_beams)
        {
-               cl_activebeams = max(cl_activebeams, i + 1);
+               cl.num_beams = max(cl.num_beams, i + 1);
                b->entity = ent;
                b->lightning = lightning;
                b->model = m;
@@ -1535,14 +1533,14 @@ void CL_ParseBeam (model_t *m, int lightning)
                VectorCopy (start, b->start);
                VectorCopy (end, b->end);
                b->relativestartvalid = 0;
-               if (ent && cl_entities[ent].state_current.active)
+               if (ent && cl.entities[ent].state_current.active)
                {
                        entity_state_t *p;
                        matrix4x4_t matrix, imatrix;
                        if (ent == cl.viewentity && cl.movement)
-                               p = &cl_entities[b->entity].state_previous;
+                               p = &cl.entities[b->entity].state_previous;
                        else
-                               p = &cl_entities[b->entity].state_current;
+                               p = &cl.entities[b->entity].state_current;
                        // not really valid yet, we need to get the orientation now
                        // (ParseBeam flagged this because it is received before
                        //  entities are received, by now they have been received)
@@ -2149,8 +2147,6 @@ void CL_VM_Parse_StuffCmd (const char *msg);
 void CL_VM_Parse_CenterPrint (const char *msg);
 void CSQC_AddPrintText (const char *msg);
 void CSQC_ReadEntities (void);
-//
-static unsigned char cgamenetbuffer[65536];
 
 /*
 =====================
@@ -2196,7 +2192,7 @@ void CL_ParseServerMessage(void)
 
                // slightly kill qw player entities each frame
                for (i = 1;i < cl.maxclients;i++)
-                       cl_entities_active[i] = false;
+                       cl.entities_active[i] = false;
 
                // kill all qw nails
                cl.qw_num_nails = 0;
@@ -2303,14 +2299,14 @@ void CL_ParseServerMessage(void)
 
                        case qw_svc_lightstyle:
                                i = MSG_ReadByte ();
-                               if (i >= cl_max_lightstyle)
+                               if (i >= cl.max_lightstyle)
                                {
                                        Con_Printf ("svc_lightstyle >= MAX_LIGHTSTYLES");
                                        break;
                                }
-                               strlcpy (cl_lightstyle[i].map,  MSG_ReadString(), sizeof (cl_lightstyle[i].map));
-                               cl_lightstyle[i].map[MAX_STYLESTRING - 1] = 0;
-                               cl_lightstyle[i].length = (int)strlen(cl_lightstyle[i].map);
+                               strlcpy (cl.lightstyle[i].map,  MSG_ReadString(), sizeof (cl.lightstyle[i].map));
+                               cl.lightstyle[i].map[MAX_STYLESTRING - 1] = 0;
+                               cl.lightstyle[i].length = (int)strlen(cl.lightstyle[i].map);
                                break;
 
                        case qw_svc_sound:
@@ -2355,9 +2351,9 @@ void CL_ParseServerMessage(void)
                                i = (unsigned short) MSG_ReadShort();
                                if (i < 0 || i >= MAX_EDICTS)
                                        Host_Error ("CL_ParseServerMessage: svc_spawnbaseline: invalid entity number %i", i);
-                               if (i >= cl_max_entities)
+                               if (i >= cl.max_entities)
                                        CL_ExpandEntities(i);
-                               CL_ParseBaseline(cl_entities + i, false);
+                               CL_ParseBaseline(cl.entities + i, false);
                                break;
                        case qw_svc_spawnstatic:
                                CL_ParseStatic(false);
@@ -2431,9 +2427,9 @@ void CL_ParseServerMessage(void)
                                // NOTE: in QW this only worked on clients
                                if (i < 0 || i >= MAX_EDICTS)
                                        Host_Error("CL_ParseServerMessage: svc_spawnbaseline: invalid entity number %i", i);
-                               if (i >= cl_max_entities)
+                               if (i >= cl.max_entities)
                                        CL_ExpandEntities(i);
-                               cl_entities[i].persistent.muzzleflash = 1.0f;
+                               cl.entities[i].persistent.muzzleflash = 1.0f;
                                break;
 
                        case qw_svc_updateuserinfo:
@@ -2510,8 +2506,8 @@ void CL_ParseServerMessage(void)
 
                // fully kill the still slightly dead qw player entities each frame
                for (i = 1;i < cl.maxclients;i++)
-                       if (!cl_entities_active[i])
-                               cl_entities[i].state_current.active = false;
+                       if (!cl.entities_active[i])
+                               cl.entities[i].state_current.active = false;
        }
        else
        {
@@ -2649,7 +2645,7 @@ void CL_ParseServerMessage(void)
                                cl.viewentity = (unsigned short)MSG_ReadShort ();
                                if (cl.viewentity >= MAX_EDICTS)
                                        Host_Error("svc_setview >= MAX_EDICTS");
-                               if (cl.viewentity >= cl_max_entities)
+                               if (cl.viewentity >= cl.max_entities)
                                        CL_ExpandEntities(cl.viewentity);
                                // LordHavoc: assume first setview recieved is the real player entity
                                if (!cl.playerentity)
@@ -2658,14 +2654,14 @@ void CL_ParseServerMessage(void)
 
                        case svc_lightstyle:
                                i = MSG_ReadByte ();
-                               if (i >= cl_max_lightstyle)
+                               if (i >= cl.max_lightstyle)
                                {
                                        Con_Printf ("svc_lightstyle >= MAX_LIGHTSTYLES");
                                        break;
                                }
-                               strlcpy (cl_lightstyle[i].map,  MSG_ReadString(), sizeof (cl_lightstyle[i].map));
-                               cl_lightstyle[i].map[MAX_STYLESTRING - 1] = 0;
-                               cl_lightstyle[i].length = (int)strlen(cl_lightstyle[i].map);
+                               strlcpy (cl.lightstyle[i].map,  MSG_ReadString(), sizeof (cl.lightstyle[i].map));
+                               cl.lightstyle[i].map[MAX_STYLESTRING - 1] = 0;
+                               cl.lightstyle[i].length = (int)strlen(cl.lightstyle[i].map);
                                break;
 
                        case svc_sound:
@@ -2752,17 +2748,17 @@ void CL_ParseServerMessage(void)
                                i = (unsigned short) MSG_ReadShort ();
                                if (i < 0 || i >= MAX_EDICTS)
                                        Host_Error ("CL_ParseServerMessage: svc_spawnbaseline: invalid entity number %i", i);
-                               if (i >= cl_max_entities)
+                               if (i >= cl.max_entities)
                                        CL_ExpandEntities(i);
-                               CL_ParseBaseline (cl_entities + i, false);
+                               CL_ParseBaseline (cl.entities + i, false);
                                break;
                        case svc_spawnbaseline2:
                                i = (unsigned short) MSG_ReadShort ();
                                if (i < 0 || i >= MAX_EDICTS)
                                        Host_Error ("CL_ParseServerMessage: svc_spawnbaseline2: invalid entity number %i", i);
-                               if (i >= cl_max_entities)
+                               if (i >= cl.max_entities)
                                        CL_ExpandEntities(i);
-                               CL_ParseBaseline (cl_entities + i, true);
+                               CL_ParseBaseline (cl.entities + i, true);
                                break;
                        case svc_spawnstatic:
                                CL_ParseStatic (false);
@@ -2887,16 +2883,6 @@ void CL_ParseServerMessage(void)
                        case svc_skybox:
                                R_SetSkyBox(MSG_ReadString());
                                break;
-                       case svc_cgame:
-                               {
-                                       int length;
-                                       length = (int) ((unsigned short) MSG_ReadShort());
-                                       for (i = 0;i < length;i++)
-                                               cgamenetbuffer[i] = MSG_ReadByte();
-                                       if (!msg_badread)
-                                               CL_CGVM_ParseNetwork(cgamenetbuffer, length);
-                               }
-                               break;
                        case svc_entities:
                                if (cls.signon == SIGNONS - 1)
                                {