]> git.xonotic.org Git - xonotic/darkplaces.git/blobdiff - model_brush.c
a few more PRVM_EDICTFIELDVALUE/PRVM_GLOBALFIELDVALUE uses fixed
[xonotic/darkplaces.git] / model_brush.c
index 37285c6b03372cd49a00a8c3b5d6e8939d7d018e..2129d75fd03cdc0473f876cf2d8a2a2633994558 100644 (file)
@@ -1157,7 +1157,7 @@ void Collision_ClipTrace_Point(trace_t *trace, const vec3_t cmins, const vec3_t
 static qboolean Mod_Q1BSP_TraceLineOfSight(struct model_s *model, const vec3_t start, const vec3_t end)
 {
        trace_t trace;
-       model->TraceLine(model, NULL, NULL, &trace, start, end, SUPERCONTENTS_VISBLOCKERMASK);
+       Mod_Q1BSP_TraceLine(model, NULL, NULL, &trace, start, end, SUPERCONTENTS_VISBLOCKERMASK);
        return trace.fraction == 1;
 }
 
@@ -1578,8 +1578,8 @@ void R_Q1BSP_LoadSplitSky (unsigned char *src, int width, int height, int bytesp
                }
        }
 
-       loadmodel->brush.solidskyskinframe = R_SkinFrame_LoadInternalBGRA("sky_solidtexture", 0         , (unsigned char *) solidpixels, w, h, bytesperpixel == 4 && r_texture_sRGB_skybox.integer);
-       loadmodel->brush.alphaskyskinframe = R_SkinFrame_LoadInternalBGRA("sky_alphatexture", TEXF_ALPHA, (unsigned char *) alphapixels, w, h, bytesperpixel == 4 && r_texture_sRGB_skybox.integer);
+       loadmodel->brush.solidskyskinframe = R_SkinFrame_LoadInternalBGRA("sky_solidtexture", 0         , (unsigned char *) solidpixels, w, h, vid.sRGB3D);
+       loadmodel->brush.alphaskyskinframe = R_SkinFrame_LoadInternalBGRA("sky_alphatexture", TEXF_ALPHA, (unsigned char *) alphapixels, w, h, vid.sRGB3D);
        Mem_Free(solidpixels);
        Mem_Free(alphapixels);
 }
@@ -1770,9 +1770,9 @@ static void Mod_Q1BSP_LoadTextures(lump_t *l)
                        // LordHavoc: HL sky textures are entirely different than quake
                        if (!loadmodel->brush.ishlbsp && !strncmp(tx->name, "sky", 3) && mtwidth == mtheight * 2)
                        {
-                               data = loadimagepixelsbgra(gamemode == GAME_TENEBRAE ? tx->name : va("textures/%s/%s", mapname, tx->name), false, false, r_texture_sRGB_skin_diffuse.integer != 0, NULL);
+                               data = loadimagepixelsbgra(gamemode == GAME_TENEBRAE ? tx->name : va("textures/%s/%s", mapname, tx->name), false, false, false, NULL);
                                if (!data)
-                                       data = loadimagepixelsbgra(gamemode == GAME_TENEBRAE ? tx->name : va("textures/%s", tx->name), false, false, r_texture_sRGB_skin_diffuse.integer != 0, NULL);
+                                       data = loadimagepixelsbgra(gamemode == GAME_TENEBRAE ? tx->name : va("textures/%s", tx->name), false, false, false, NULL);
                                if (data && image_width == image_height * 2)
                                {
                                        R_Q1BSP_LoadSplitSky(data, image_width, image_height, 4);
@@ -5836,6 +5836,7 @@ static void Mod_Q3BSP_LightPoint(dp_model_t *model, const vec3_t p, vec3_t ambie
                break;
        case RENDERPATH_GL11:
        case RENDERPATH_GL13:
+       case RENDERPATH_GLES1:
                stylescale = r_refdef.scene.rtlightstylevalue[0];
                break;
        }
@@ -5991,6 +5992,9 @@ void Mod_CollisionBIH_TracePoint(dp_model_t *model, const frameblend_t *frameble
        trace->hitsupercontentsmask = hitsupercontentsmask;
 
        bih = &model->collision_bih;
+       if(!bih->nodes)
+               return;
+
        nodenum = bih->rootnode;
        nodestack[nodestackpos++] = nodenum;
        while (nodestackpos)
@@ -6047,6 +6051,9 @@ void Mod_CollisionBIH_TraceLineShared(dp_model_t *model, const frameblend_t *fra
        vec_t d1, d2, d3, d4, f, nodestackline[1024][6];
        int axis, nodenum, nodestackpos = 0, nodestack[1024];
 
+       if(!bih->nodes)
+               return;
+
        if (VectorCompare(start, end))
        {
                Mod_CollisionBIH_TracePoint(model, frameblend, skeleton, trace, start, hitsupercontentsmask);
@@ -6180,6 +6187,8 @@ void Mod_CollisionBIH_TraceBrush(dp_model_t *model, const frameblend_t *frameble
        }
 
        bih = &model->collision_bih;
+       if(!bih->nodes)
+               return;
        nodenum = bih->rootnode;
 
        // box trace, performed as brush trace
@@ -7303,6 +7312,9 @@ void Mod_OBJ_Load(dp_model_t *mod, void *buffer, void *bufferend)
        VectorClear(mins);
        VectorClear(maxs);
 
+       // we always have model 0, i.e. the first "submodel"
+       loadmodel->brush.numsubmodels = 1;
+
        // parse the OBJ text now
        for(;;)
        {