]> de.git.xonotic.org Git - xonotic/darkplaces.git/blobdiff - cl_parse.c
Removed globaldefindex_progid field from cvar struct.
[xonotic/darkplaces.git] / cl_parse.c
index f7e77a3b0bfd641a5f2b6a7f5bd78cfde2e78f2c..923e48e734ad8471ead538b2f1f6783e19fc8f30 100644 (file)
@@ -227,7 +227,7 @@ static void CL_ParseStartSoundPacket(int largesoundindex)
                        attenuation = MSG_ReadByte(&cl_message) / 64.0;
                else
                        attenuation = DEFAULT_SOUND_PACKET_ATTENUATION;
-       
+
                speed = 1.0f;
 
                ent = (channel>>3)&1023;
@@ -276,7 +276,7 @@ static void CL_ParseStartSoundPacket(int largesoundindex)
 
        MSG_ReadVector(&cl_message, pos, cls.protocol);
 
-       if (sound_num >= MAX_SOUNDS)
+       if (sound_num < 0 || sound_num >= MAX_SOUNDS)
        {
                Con_Printf("CL_ParseStartSoundPacket: sound_num (%i) >= MAX_SOUNDS (%i)\n", sound_num, MAX_SOUNDS);
                return;
@@ -380,6 +380,7 @@ void CL_KeepaliveMessage (qboolean readmessages)
 
 void CL_ParseEntityLump(char *entdata)
 {
+       qboolean loadedsky = false;
        const char *data;
        char key[128], value[MAX_INPUTLINE];
        FOG_clear(); // LordHavoc: no fog until set
@@ -408,11 +409,20 @@ void CL_ParseEntityLump(char *entdata)
                        return; // error
                strlcpy (value, com_token, sizeof (value));
                if (!strcmp("sky", key))
+               {
+                       loadedsky = true;
                        R_SetSkyBox(value);
+               }
                else if (!strcmp("skyname", key)) // non-standard, introduced by QuakeForge... sigh.
+               {
+                       loadedsky = true;
                        R_SetSkyBox(value);
+               }
                else if (!strcmp("qlsky", key)) // non-standard, introduced by QuakeLives (EEK)
+               {
+                       loadedsky = true;
                        R_SetSkyBox(value);
+               }
                else if (!strcmp("fog", key))
                {
                        FOG_clear(); // so missing values get good defaults
@@ -455,6 +465,9 @@ void CL_ParseEntityLump(char *entdata)
                        r_refdef.fog_height_texturename[63] = 0;
                }
        }
+
+       if (!loadedsky && cl.worldmodel->brush.isq2bsp)
+               R_SetSkyBox("unit1_");
 }
 
 static const vec3_t defaultmins = {-4096, -4096, -4096};
@@ -573,6 +586,12 @@ static void QW_CL_RequestNextDownload(void)
        // clear name of file that just finished
        cls.qw_downloadname[0] = 0;
 
+       // skip the download fragment if playing a demo
+       if (!cls.netcon)
+       {
+               return;
+       }
+
        switch (cls.qw_downloadtype)
        {
        case dl_single:
@@ -1026,7 +1045,7 @@ static void QW_CL_ParseNails(void)
        {
                for (j = 0;j < 6;j++)
                        bits[j] = MSG_ReadByte(&cl_message);
-               if (cl.qw_num_nails > 255)
+               if (cl.qw_num_nails >= 255)
                        continue;
                v = cl.qw_nails[cl.qw_num_nails++];
                v[0] = ( ( bits[0] + ((bits[1]&15)<<8) ) <<1) - 4096;
@@ -2292,6 +2311,13 @@ static void CL_ParseStaticSound (int large)
                sound_num = (unsigned short) MSG_ReadShort(&cl_message);
        else
                sound_num = MSG_ReadByte(&cl_message);
+
+       if (sound_num < 0 || sound_num >= MAX_SOUNDS)
+       {
+               Con_Printf("CL_ParseStaticSound: sound_num(%i) >= MAX_SOUNDS (%i)\n", sound_num, MAX_SOUNDS);
+               return;
+       }
+
        vol = MSG_ReadByte(&cl_message);
        atten = MSG_ReadByte(&cl_message);
 
@@ -2867,6 +2893,8 @@ static void CL_ParseTempEntity(void)
                        CL_FindNonSolidLocation(pos, pos, 10);
                        colorStart = MSG_ReadByte(&cl_message);
                        colorLength = MSG_ReadByte(&cl_message);
+                       if (colorLength == 0)
+                               colorLength = 1;
                        CL_ParticleExplosion2(pos, colorStart, colorLength);
                        tempcolor = palette_rgb[(rand()%colorLength) + colorStart];
                        color[0] = tempcolor[0] * (2.0f / 255.0f);