]> git.xonotic.org Git - xonotic/darkplaces.git/blobdiff - cl_parse.c
miscellaneous fixes from graphitemaster
[xonotic/darkplaces.git] / cl_parse.c
index f7e77a3b0bfd641a5f2b6a7f5bd78cfde2e78f2c..460ef2701b7f2b6fdcf9038c275e66865fa4a6d1 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;
@@ -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};
@@ -1026,7 +1039,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;