From b0c1d1ce2010fc6dfb083795d30fa439046a5ccb Mon Sep 17 00:00:00 2001 From: eukos Date: Sun, 23 Aug 2015 15:35:37 +0200 Subject: [PATCH] Fixed crash when loading HLBSP maps that use skyboxes --- engine/model.c | 19 ++++++++----------- renderer/d_edge.c | 6 ++++++ 2 files changed, 14 insertions(+), 11 deletions(-) diff --git a/engine/model.c b/engine/model.c index 757d395..d4f7b16 100644 --- a/engine/model.c +++ b/engine/model.c @@ -1037,25 +1037,22 @@ void Mod_LoadFaces (lump_t *l) else out->samples = loadmodel->lightdata + i; } - // set the drawing flags flag - // if (!strncmp(out->texinfo->texture->name,"light",5) || !strncmp(out->texinfo->texture->name,"dem",3)|| !strncmp(out->texinfo->texture->name,"rune",4)) // light hack - // { - // out->flags |= ( SURF_FLARE); - // continue; - // } // for the d_mipdetail 64 setting - keep buttons and other small textures sharp while allowing the rest to blur out - if (out->texinfo->texture->height < 33 && out->texinfo->texture->width < 33) + if ((out->texinfo->texture->height < 33 && out->texinfo->texture->width < 33) && loadmodel->fromgame != fg_halflife) { out->flags |= ( SURF_DONTMIP64); continue; } - if (!strncmp(out->texinfo->texture->name,"sky",3)) // sky + else if (!strncmp(out->texinfo->texture->name,"sky",3)) // sky { - out->flags |= (SURF_DRAWSKY | SURF_DRAWTILED); + if(loadmodel->fromgame == fg_halflife) // HLBSP uses external skies + out->flags |= SURF_DRAWSKYBOX; + else + out->flags |= (SURF_DRAWSKY | SURF_DRAWTILED); + continue; } - - if (!strncmp(out->texinfo->texture->name,"*",1)) // turbulent + else if (!strncmp(out->texinfo->texture->name,"*",1)) // turbulent { out->flags |= (SURF_DRAWTURB | SURF_DRAWTILED | SURF_DRAWTRANSLUCENT); // no lava/water check. we're trying to emulate dp/glq behavior here if (strncmp(out->texinfo->texture->name, "*lava", 3)) diff --git a/renderer/d_edge.c b/renderer/d_edge.c index b485496..8a32b80 100644 --- a/renderer/d_edge.c +++ b/renderer/d_edge.c @@ -248,6 +248,12 @@ void D_DrawSurfaces (void) D_DrawSkyScans8 (s->spans); D_DrawZSpans (s->spans); } + else if (s->flags & SURF_DRAWSKYBOX) + { + D_DrawSolidSurface (s, (int)r_clearcolor->value & 0xFF); + D_DrawZSpans (s->spans); + } + else if (s->flags & SURF_DRAWBACKGROUND) {