]> de.git.xonotic.org Git - xonotic/darkplaces.git/blobdiff - zone.c
no longer compresses embedded textures (in q1 and hl formats) because
[xonotic/darkplaces.git] / zone.c
diff --git a/zone.c b/zone.c
index 0bb325385f1ded23fe763e170f93bdadeb954bde..32655d9ad143e38fa8e9d390d6f62dd2d4b8fcd4 100644 (file)
--- a/zone.c
+++ b/zone.c
@@ -393,7 +393,7 @@ void Mem_ExpandableArray_FreeArray(memexpandablearray_t *l)
        size_t i;
        if (l->maxarrays)
        {
-               for (i = 0;i != l->numarrays;l++)
+               for (i = 0;i != l->numarrays;i++)
                        Mem_Free(l->arrays[i].data);
                Mem_Free(l->arrays);
        }
@@ -458,6 +458,28 @@ void Mem_ExpandableArray_FreeRecord(memexpandablearray_t *l, void *record)
        }
 }
 
+size_t Mem_ExpandableArray_IndexRange(memexpandablearray_t *l)
+{
+       size_t i, j, k;
+       if (!l->numarrays)
+               return 0;
+       i = l->numarrays - 1;
+       for (j = 0, k = 0;k < l->arrays[i].numflaggedrecords;j++)
+               if (l->arrays[i].allocflags[j])
+                       k++;
+       return l->numrecordsperarray * i + j;
+}
+
+void *Mem_ExpandableArray_RecordAtIndex(memexpandablearray_t *l, size_t index)
+{
+       size_t i, j;
+       i = index / l->numrecordsperarray;
+       j = index % l->numrecordsperarray;
+       if (i >= l->numarrays || !l->arrays[i].allocflags[j])
+               return NULL;
+       return (void *)(l->arrays[i].data + j * l->recordsize);
+}
+
 
 // used for temporary memory allocations around the engine, not for longterm
 // storage, if anything in this pool stays allocated during gameplay, it is
@@ -531,6 +553,7 @@ void MemStats_f(void)
 {
        Mem_CheckSentinelsGlobal();
        R_TextureStats_Print(false, false, true);
+       GL_Mesh_ListVBOs(false);
        Mem_PrintStats();
 }