]> git.xonotic.org Git - xonotic/darkplaces.git/blobdiff - model_shared.c
font: fix missing text in r_speeds (etc)
[xonotic/darkplaces.git] / model_shared.c
index e7d3228d13f8ed5e1fc377ccaf412ffaa1bea85c..bcf683e33f5a6677f3ca4777d9fb814fd68b8dd7 100644 (file)
@@ -2936,7 +2936,7 @@ void Mod_MakeSortedSurfaces(model_t *mod)
        if(cls.state == ca_dedicated)
                return;
 
-       info = (Mod_MakeSortedSurfaces_qsortsurface_t*)R_FrameData_Alloc(mod->num_surfaces * sizeof(*info));
+       info = (Mod_MakeSortedSurfaces_qsortsurface_t*)Mem_Alloc(loadmodel->mempool, mod->num_surfaces * sizeof(*info));
        if (!mod->modelsurfaces_sorted)
                mod->modelsurfaces_sorted = (int *) Mem_Alloc(loadmodel->mempool, mod->num_surfaces * sizeof(*mod->modelsurfaces_sorted));
        // the goal is to sort by submodel (can't change which submodel a surface belongs to), and then by effects and textures
@@ -2952,6 +2952,7 @@ void Mod_MakeSortedSurfaces(model_t *mod)
                        qsort(info + mod->brush.submodels[k]->submodelsurfaces_start, (size_t)mod->brush.submodels[k]->submodelsurfaces_end - mod->brush.submodels[k]->submodelsurfaces_start, sizeof(*info), Mod_MakeSortedSurfaces_qsortfunc);
        for (j = 0; j < mod->num_surfaces; j++)
                mod->modelsurfaces_sorted[j] = info[j].surfaceindex;
+       Mem_Free(info);
 }
 
 void Mod_BuildVBOs(void)
@@ -3202,7 +3203,7 @@ static void Mod_Decompile_SMD(model_t *model, const char *filename, int firstpos
                        // strangely the smd angles are for a transposed matrix, so we
                        // have to generate a transposed matrix, then convert that...
                        Matrix4x4_FromBonePose7s(&posematrix, model->num_posescale, model->data_poses7s + 7*(model->num_bones * poseindex + transformindex));
-                       Matrix4x4_ToArray12FloatGL(&posematrix, mtest[0]);
+                       Matrix4x4_ToArray12FloatGL(&posematrix, mtest);
                        AnglesFromVectors(angles, mtest[0], mtest[2], false);
                        if (angles[0] >= 180) angles[0] -= 360;
                        if (angles[1] >= 180) angles[1] -= 360;
@@ -4645,25 +4646,24 @@ static void Mod_Mesh_MakeSortedSurfaces(model_t *mod)
 {
        int i, j;
        texture_t *tex;
-       unsigned char* included = (unsigned char *)R_FrameData_Alloc(mod->num_surfaces * sizeof(unsigned char));
 
        // build the sorted surfaces list properly to reduce material setup
        // this is easy because we're just sorting on texture and don't care about the order of textures
        mod->submodelsurfaces_start = 0;
        mod->submodelsurfaces_end = 0;
        for (i = 0; i < mod->num_surfaces; i++)
-               included[i] = 0;
+               mod->data_surfaces[i].included = false;
        for (i = 0; i < mod->num_surfaces; i++)
        {
-               if (included[i])
+               if (mod->data_surfaces[i].included)
                        continue;
                tex = mod->data_surfaces[i].texture;
                // j = i is intentional
                for (j = i; j < mod->num_surfaces; j++)
                {
-                       if (!included[j] && mod->data_surfaces[j].texture == tex)
+                       if (!mod->data_surfaces[j].included && mod->data_surfaces[j].texture == tex)
                        {
-                               included[j] = 1;
+                               mod->data_surfaces[j].included = 1;
                                mod->modelsurfaces_sorted[mod->submodelsurfaces_end++] = j;
                        }
                }