]> git.rm.cloudns.org Git - xonotic/darkplaces.git/commitdiff
miscellaneous fixes from graphitemaster
authoreihrul <eihrul@d7cf8633-e32d-0410-b094-e92efae38249>
Tue, 9 Dec 2014 13:30:53 +0000 (13:30 +0000)
committereihrul <eihrul@d7cf8633-e32d-0410-b094-e92efae38249>
Tue, 9 Dec 2014 13:30:53 +0000 (13:30 +0000)
git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@12106 d7cf8633-e32d-0410-b094-e92efae38249

cl_parse.c
clvm_cmds.c
meshqueue.c
model_brush.c
mvm_cmds.c
r_shadow.c

index e8e17f1cb980309bd6c85615dcdc5cad01e1af07..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;
@@ -1039,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;
index c9cecff39a20590d61ce1c63550ef4c1210decf7..1d3696acab493ab69a398938aa55bf7928d355ed 100644 (file)
@@ -3560,7 +3560,7 @@ void Debug_PolygonVertex(float x, float y, float z, float s, float t, float r, f
                return;
        }
 
-       if(debugPolys.begin_vertices > VMPOLYGONS_MAXPOINTS)
+       if(debugPolys.begin_vertices >= VMPOLYGONS_MAXPOINTS)
        {
                Con_Printf("Debug_PolygonVertex: may have %i vertices max\n", VMPOLYGONS_MAXPOINTS);
                return;
index 2ba5c518004de13ce324ca07dd6b11283f520525..edd85c227ac83c14e8f19fc56b966d4ae228d15c 100644 (file)
@@ -87,14 +87,14 @@ void R_MeshQueue_RenderTransparent(void)
                trans_sortarraysize = r_transparent_sortarraysize.integer;
                if (trans_hash)
                        Mem_Free(trans_hash);
-               trans_hash = (meshqueue_t **)Mem_Alloc(cls.permanentmempool, sizeof(trans_hash) * trans_sortarraysize); 
+               trans_hash = (meshqueue_t **)Mem_Alloc(cls.permanentmempool, sizeof(meshqueue_t *) * trans_sortarraysize); 
                if (trans_hashpointer)
                        Mem_Free(trans_hashpointer);
-               trans_hashpointer = (meshqueue_t ***)Mem_Alloc(cls.permanentmempool, sizeof(trans_hashpointer) * trans_sortarraysize); 
+               trans_hashpointer = (meshqueue_t ***)Mem_Alloc(cls.permanentmempool, sizeof(meshqueue_t **) * trans_sortarraysize); 
        }
 
        // build index
-       memset(trans_hash, 0, sizeof(trans_hash) * trans_sortarraysize);
+       memset(trans_hash, 0, sizeof(meshqueue_t *) * trans_sortarraysize);
        for (i = 0; i < trans_sortarraysize; i++)
                trans_hashpointer[i] = &trans_hash[i];
        distscale = (trans_sortarraysize - 1) / min(mqt_viewmaxdist, r_transparent_sortmaxdist.integer);
index 6f2651f6def8dbdc7802d6e6f42e9da578eb4f4f..8605cbb0cc3aad75d53a63f6ebb7264b6ebfe7cf 100644 (file)
@@ -2129,7 +2129,7 @@ static void Mod_Q1BSP_ParseWadsFromEntityLump(const char *data)
                                for (i = 0;i < (int)sizeof(value);i++)
                                        if (value[i] != ';' && value[i] != '\\' && value[i] != '/' && value[i] != ':')
                                                break;
-                               if (value[i])
+                               if (i < (int)sizeof(value) && value[i])
                                {
                                        for (;i < (int)sizeof(value);i++)
                                        {
index 1b915c1f5870f63a58acbd162246134e7ee6916b..d44d22c363ef7020b93c0bdb657a4b51ba7bf4ec 100644 (file)
@@ -318,9 +318,9 @@ static void VM_M_setserverlistmaskstring(prvm_prog_t *prog)
        str = PRVM_G_STRING( OFS_PARM2 );
 
        masknr = (int)PRVM_G_FLOAT( OFS_PARM0 );
-       if( masknr >= 0 && masknr <= SERVERLIST_ANDMASKCOUNT )
+       if( masknr >= 0 && masknr < SERVERLIST_ANDMASKCOUNT )
                mask = &serverlist_andmasks[masknr];
-       else if( masknr >= 512 && masknr - 512 <= SERVERLIST_ORMASKCOUNT )
+       else if( masknr >= 512 && masknr - 512 < SERVERLIST_ORMASKCOUNT )
                mask = &serverlist_ormasks[masknr - 512 ];
        else
        {
@@ -380,9 +380,9 @@ static void VM_M_setserverlistmasknumber(prvm_prog_t *prog)
        VM_SAFEPARMCOUNT( 4, VM_M_setserverlistmasknumber );
 
        masknr = (int)PRVM_G_FLOAT( OFS_PARM0 );
-       if( masknr >= 0 && masknr <= SERVERLIST_ANDMASKCOUNT )
+       if( masknr >= 0 && masknr < SERVERLIST_ANDMASKCOUNT )
                mask = &serverlist_andmasks[masknr];
-       else if( masknr >= 512 && masknr - 512 <= SERVERLIST_ORMASKCOUNT )
+       else if( masknr >= 512 && masknr - 512 < SERVERLIST_ORMASKCOUNT )
                mask = &serverlist_ormasks[masknr - 512 ];
        else
        {
index 8b0106dd78c69e73a29274d0dd16178d446a7815..c0ecf32056c314380b30b4803267859309c682a6 100644 (file)
@@ -3530,7 +3530,7 @@ void R_RTLight_Compile(rtlight_t *rtlight)
                                lighttris++;
 
        shadowtris = 0;
-       if (rtlight->static_numlighttrispvsbytes)
+       if (rtlight->static_numshadowtrispvsbytes)
                for (i = 0;i < rtlight->static_numshadowtrispvsbytes*8;i++)
                        if (CHECKPVSBIT(rtlight->static_shadowtrispvs, i))
                                shadowtris++;