- allow tga as q3 mapshot

git-svn-id: http://svn.code.sf.net/p/xqf/code/trunk@591 d2ac09be-c843-0410-8b1f-f8a84130e0ec
This commit is contained in:
Ludwig Nussel 2004-02-08 16:06:27 +00:00 committed by l-n
parent b3001b4e95
commit 075d8e6ee4
2 changed files with 18 additions and 3 deletions

View File

@ -1,3 +1,6 @@
Feb 08, 2004: Ludwig Nussel <l-n@users.sourceforge.net>
- allow tga as q3 mapshot
Feb 02, 2004: Jordi Mallach <jordi@sindominio.net>
- switch to intltoolize
- add desktop file for GNOME and KDE

View File

@ -138,6 +138,19 @@ static void findmaps_pak(const char* packfile, GHashTable* maphash)
return;
}
static inline gboolean is_q3_mapshot(const char* buf)
{
if(g_strncasecmp(buf,"levelshots/",11))
return FALSE;
if (!g_strcasecmp(buf+strlen(buf)-4,".jpg"))
return TRUE;
if(!g_strcasecmp(buf+strlen(buf)-4,".tga"))
return TRUE;
return FALSE;
}
/** open zip file and insert all contained .bsp into maphash */
static void findq3maps_zip(const char* path, GHashTable* maphash)
{
@ -175,8 +188,7 @@ static void findq3maps_zip(const char* path, GHashTable* maphash)
g_hash_table_insert(maphash,mapname,GUINT_TO_POINTER(-1));
}
}
else if(!g_strncasecmp(buf,"levelshots/",11) &&
(!g_strcasecmp(buf+strlen(buf)-4,".jpg")))
else if(is_q3_mapshot(buf))
{
struct q3mapinfo* mi = NULL;
size_t psize, nsize;
@ -484,7 +496,7 @@ void findq3maps(GHashTable* maphash, const char* startdir)
char* mapname = NULL;
char* origkey = NULL;
gboolean found = FALSE;
// 11 = levelshots, 4 = .jpg
// 11 = levelshots/, 4 = .jpg
if(!mi->levelshot || strlen(mi->levelshot) < 11+4 ) { g_free(mi); continue; }
mapname=g_strndup(mi->levelshot+11,strlen(mi->levelshot)-4-11);
g_strdown(mapname);