From eb9e15a9b3d5992fa48e880a1459fccff0bc85a6 Mon Sep 17 00:00:00 2001 From: Ozkan Sezer Date: Sat, 20 Feb 2010 08:50:31 +0000 Subject: [PATCH] the custom embedded comback image is intended to replace the id1 image .. * .. when running in fitz-compatibility mode (-fitz command line switch) * .. or when the mods themselves did not provide their own conback image themselves, ie. the "Q" conback image of id1 is just not wanted. So, just modify/corrupt the gfx/conback.lmp filename in the id1/pak0.pak file list, achieving the intention that way. common.c (kill_id1_conback): new QuakeSpasm customization helper. (COM_InitFilesystem): call kill_id1_conback() just after adding the id1 directory to the search path when not running in fitzmode. gl_draw.c (Draw_ConbackPic): when not running in fitzmode, do search for the gfx/conback.lmp file before loading the embedded custom image to see whether the mod provided its own conback image. git-svn-id: svn://svn.code.sf.net/p/quakespasm/code/trunk/quakespasm@76 af15c1b1-3010-417e-b628-4374ebc0bcbd --- Quake/common.c | 28 ++++++++++++++++++++++++++++ Quake/gl_draw.c | 4 ++++ 2 files changed, 32 insertions(+) diff --git a/Quake/common.c b/Quake/common.c index 9aa70998..9a758c99 100644 --- a/Quake/common.c +++ b/Quake/common.c @@ -1813,6 +1813,29 @@ void COM_AddGameDirectory (char *dir) } } +static void kill_id1_conback (void) /* QuakeSpasm customization: */ +{ + searchpath_t *search; + int i; + + for (search = com_searchpaths; search; search = search->next) + { + if (!search->pack) + continue; + if (!strstr(search->pack->filename, "/id1/pak0.pak")) + continue; + for (i = 0 ; i < search->pack->numfiles ; i++) + { + if (strcmp(search->pack->files[i].name, + "gfx/conback.lmp") == 0) + { + search->pack->files[i].name[0] = '$'; + return; + } + } + } +} + /* ================= COM_InitFilesystem @@ -1854,6 +1877,11 @@ void COM_InitFilesystem () //johnfitz -- modified based on topaz's tutorial COM_AddGameDirectory (va("%s/"GAMENAME, basedir) ); strcpy (com_gamedir, va("%s/"GAMENAME, basedir)); + if (!fitzmode) + { /* QuakeSpasm customization: */ + kill_id1_conback (); + } + //johnfitz -- track number of mission packs added //since we don't want to allow the "game" command to strip them away com_nummissionpacks = 0; diff --git a/Quake/gl_draw.c b/Quake/gl_draw.c index 2b7ea114..f9773f9b 100644 --- a/Quake/gl_draw.c +++ b/Quake/gl_draw.c @@ -323,6 +323,10 @@ qpic_t *Draw_ConbackPic (void) { if (fitzmode) { return Draw_CachePic ("gfx/conback.lmp"); + } else if (COM_LoadTempFile("gfx/conback.lmp")) { + /* even if we are running in custom mode + allow for mod-provided conback images */ + return Draw_CachePic ("gfx/conback.lmp"); } else { /* QuakeSpasm customization: */ cachepic_t *pic;