]> de.git.xonotic.org Git - xonotic/darkplaces.git/blobdiff - cl_parse.c
rewrite of map texture loading (mainly to do with HL textures and wads)
[xonotic/darkplaces.git] / cl_parse.c
index 44525d8ffc2c6cf47a5ab9531520fa6ffd2b1add..0d776abff948e84593a95c23b6ee3daa19e4a44a 100644 (file)
@@ -226,7 +226,7 @@ extern cvar_t r_farclip;
 void CL_ParseEntityLump(char *entdata)
 {
        char *data;
-       char key[128], value[1024];
+       char key[128], value[4096];
        char wadname[128];
        int i, j, k;
        FOG_clear(); // LordHavoc: no fog until set
@@ -282,12 +282,12 @@ void CL_ParseEntityLump(char *entdata)
                else if (!strcmp("wad", key)) // for HalfLife maps
                {
                        j = 0;
-                       for (i = 0;i < 128;i++)
+                       for (i = 0;i < 4096;i++)
                                if (value[i] != ';' && value[i] != '\\' && value[i] != '/' && value[i] != ':')
                                        break;
                        if (value[i])
                        {
-                               for (;i < 128;i++)
+                               for (;i < 4096;i++)
                                {
                                        // ignore path - the \\ check is for HalfLife... stupid windoze 'programmers'...
                                        if (value[i] == '\\' || value[i] == '/' || value[i] == ':')
@@ -298,7 +298,7 @@ void CL_ParseEntityLump(char *entdata)
                                                value[i] = 0;
                                                strcpy(wadname, "textures/");
                                                strcat(wadname, &value[j]);
-                                               W_LoadTextureWadFile (wadname, FALSE);
+                                               W_LoadTextureWadFile (wadname, false);
                                                j = i+1;
                                                if (!k)
                                                        break;
@@ -863,9 +863,17 @@ void CL_ParseServerMessage (void)
                
                case svc_version:
                        i = MSG_ReadLong ();
-                       if (i != PROTOCOL_VERSION && i != 250)
-                               Host_Error ("CL_ParseServerMessage: Server is protocol %i instead of %i\n", i, PROTOCOL_VERSION);
-                       Nehahrademcompatibility = i == 250;
+                       if (i != PROTOCOL_VERSION && i != DPPROTOCOL_VERSION && i != 250)
+                       {
+                               Host_Error ("CL_ParseServerMessage: Server is protocol %i, not %i or %i", i, DPPROTOCOL_VERSION, PROTOCOL_VERSION);
+                               return;
+                       }
+                       Nehahrademcompatibility = false;
+                       if (i == 250)
+                               Nehahrademcompatibility = true;
+                       if (cls.demoplayback && demo_nehahra.value)
+                               Nehahrademcompatibility = true;
+                       dpprotocol = i == DPPROTOCOL_VERSION;
                        break;
                        
                case svc_disconnect:
@@ -905,7 +913,8 @@ void CL_ParseServerMessage (void)
                        i = MSG_ReadByte ();
                        if (i >= MAX_LIGHTSTYLES)
                                Host_Error ("svc_lightstyle > MAX_LIGHTSTYLES");
-                       strcpy (cl_lightstyle[i].map,  MSG_ReadString());
+                       strncpy (cl_lightstyle[i].map,  MSG_ReadString(), MAX_STYLESTRING - 1);
+                       cl_lightstyle[i].map[MAX_STYLESTRING - 1] = 0;
                        cl_lightstyle[i].length = strlen(cl_lightstyle[i].map);
                        break;
                        
@@ -921,21 +930,21 @@ void CL_ParseServerMessage (void)
                case svc_updatename:
                        i = MSG_ReadByte ();
                        if (i >= cl.maxclients)
-                               Host_Error ("CL_ParseServerMessage: svc_updatename > MAX_SCOREBOARD");
+                               Host_Error ("CL_ParseServerMessage: svc_updatename >= MAX_SCOREBOARD");
                        strcpy (cl.scores[i].name, MSG_ReadString ());
                        break;
                        
                case svc_updatefrags:
                        i = MSG_ReadByte ();
                        if (i >= cl.maxclients)
-                               Host_Error ("CL_ParseServerMessage: svc_updatefrags > MAX_SCOREBOARD");
+                               Host_Error ("CL_ParseServerMessage: svc_updatefrags >= MAX_SCOREBOARD");
                        cl.scores[i].frags = MSG_ReadShort ();
                        break;                  
 
                case svc_updatecolors:
                        i = MSG_ReadByte ();
                        if (i >= cl.maxclients)
-                               Host_Error ("CL_ParseServerMessage: svc_updatecolors > MAX_SCOREBOARD");
+                               Host_Error ("CL_ParseServerMessage: svc_updatecolors >= MAX_SCOREBOARD");
                        cl.scores[i].colors = MSG_ReadByte ();
                        break;
                        
@@ -983,7 +992,7 @@ void CL_ParseServerMessage (void)
                        i = MSG_ReadByte ();
                        if (i < 0 || i >= MAX_CL_STATS)
                                Host_Error ("svc_updatestat: %i is invalid", i);
-                       cl.stats[i] = MSG_ReadLong ();;
+                       cl.stats[i] = MSG_ReadLong ();
                        break;
                        
                case svc_spawnstaticsound: