From b81cfa607772e4e5936da2eeaddba54db56b454d Mon Sep 17 00:00:00 2001 From: Spoike Date: Thu, 30 Sep 2004 23:02:52 +0000 Subject: [PATCH] playing with lit file paths, so that qw/maps/2fort5.lit isn't a higher priority than fortress/lits/2fort5.lit git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@276 fc73d0e0-1445-4013-8a0c-d673dee63da5 --- engine/gl/gl_model.c | 35 +++++++++++++++++++++++------------ 1 file changed, 23 insertions(+), 12 deletions(-) diff --git a/engine/gl/gl_model.c b/engine/gl/gl_model.c index aa05046cd..b02e81c7d 100644 --- a/engine/gl/gl_model.c +++ b/engine/gl/gl_model.c @@ -1269,22 +1269,33 @@ void GLMod_LoadLighting (lump_t *l) if (r_loadlits.value) { qbyte *litdata = NULL; - char litname[MAX_QPATH]; - if (!litdata) + char *litname; + char litnamemaps[MAX_QPATH]; + char litnamelits[MAX_QPATH]; + int depthmaps; + int depthlits; + { - strcpy(litname, loadmodel->name); - COM_StripExtension(loadmodel->name, litname); - COM_DefaultExtension(litname, ".lit"); - litdata = COM_LoadHunkFile(litname); + strcpy(litnamemaps, loadmodel->name); + COM_StripExtension(loadmodel->name, litnamemaps); + COM_DefaultExtension(litnamemaps, ".lit"); + depthmaps = COM_FDepthFile(litnamemaps, false); } - if (!litdata) { - strcpy(litname, "lits/"); - COM_StripExtension(COM_SkipPath(loadmodel->name), litname+5); - strcat(litname, ".lit"); - - litdata = COM_LoadHunkFile(litname); + strcpy(litnamelits, "lits/"); + COM_StripExtension(COM_SkipPath(loadmodel->name), litnamelits+5); + strcat(litnamelits, ".lit"); + depthlits = COM_FDepthFile(litnamelits, false); } + + if (depthmaps <= depthlits) + litname = litnamemaps; //maps has priority over lits + else + { + litname = litnamelits; + } + + litdata = COM_LoadHunkFile(litname); COM_StripExtension(COM_SkipPath(loadmodel->name), litname+5); strcat(litname, ".lit"); if (litdata && (litdata[0] == 'Q' && litdata[1] == 'L' && litdata[2] == 'I' && litdata[3] == 'T'))