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 e8e17f1..460ef27 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 c9cecff..1d3696a 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 2ba5c51..edd85c2 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 6f2651f..8605cbb 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 1b915c1..d44d22c 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 8b0106d..c0ecf32 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++;