]> git.xonotic.org Git - xonotic/darkplaces.git/blobdiff - model_shared.c
R_MeshQueue_AddTransparent: Switch checks for RENDER_NODEPTHTEST and RENDER_WORLDOBJE...
[xonotic/darkplaces.git] / model_shared.c
index ea41b8ad4f650adaa1f6a052ff1b6676e536595e..5d06edc5b869c07527550d466025646f4b7b02be 100644 (file)
@@ -507,7 +507,7 @@ dp_model_t *Mod_LoadModel(dp_model_t *mod, qboolean crash, qboolean checkdisk)
                else if (!memcmp(buf, "ACTRHEAD", 8)) Mod_PSKMODEL_Load(mod, buf, bufend);
                else if (!memcmp(buf, "INTERQUAKEMODEL", 16)) Mod_INTERQUAKEMODEL_Load(mod, buf, bufend);
                else if (strlen(mod->name) >= 4 && !strcmp(mod->name + strlen(mod->name) - 4, ".map")) Mod_MAP_Load(mod, buf, bufend);
-               else if (num == BSPVERSION || num == 30) Mod_Q1BSP_Load(mod, buf, bufend);
+               else if (num == BSPVERSION || num == 30 || !memcmp(buf, "BSP2", 4)) Mod_Q1BSP_Load(mod, buf, bufend);
                else Con_Printf("Mod_LoadModel: model \"%s\" is of unknown/unsupported type\n", mod->name);
                Mem_Free(buf);
 
@@ -1391,7 +1391,7 @@ void Mod_CreateCollisionMesh(dp_model_t *mod)
        for (k = 0;k < mod->nummodelsurfaces;k++)
        {
                surface = mod->data_surfaces + mod->firstmodelsurface + k;
-               if (!strcmp(surface->texture->name, "collision")) // found collision mesh
+               if (!strcmp(surface->texture->name, "collision") || !strcmp(surface->texture->name, "collisionconvex")) // found collision mesh
                {
                        usesinglecollisionmesh = true;
                        numcollisionmeshtriangles = surface->num_triangles;
@@ -3359,6 +3359,11 @@ static void Mod_Decompile_f(void)
        FS_StripExtension(inname, basename, sizeof(basename));
 
        mod = Mod_ForName(inname, false, true, inname[0] == '*' ? cl.model_name[1] : NULL);
+       if (!mod)
+       {
+               Con_Print("No such model\n");
+               return;
+       }
        if (mod->brush.submodel)
        {
                // if we're decompiling a submodel, be sure to give it a proper name based on its parent
@@ -3366,11 +3371,6 @@ static void Mod_Decompile_f(void)
                dpsnprintf(basename, sizeof(basename), "%s/%s", outname, mod->name);
                outname[0] = 0;
        }
-       if (!mod)
-       {
-               Con_Print("No such model\n");
-               return;
-       }
        if (!mod->surfmesh.num_triangles)
        {
                Con_Print("Empty model (or sprite)\n");
@@ -4367,7 +4367,6 @@ static void Mod_GenerateLightmaps_CreateLightmaps(dp_model_t *model)
        for (surfaceindex = 0;surfaceindex < model->num_surfaces;surfaceindex++)
        {
                surface = model->data_surfaces + surfaceindex;
-               e = model->surfmesh.data_element3i + surface->num_firsttriangle*3;
                if (!surface->num_triangles)
                        continue;
                lightmapindex = mod_generatelightmaps_lightmaptriangles[surface->num_firsttriangle].lightmapindex;