1 /* XQF - Quake server browser and launcher 2 * Functions for finding installed q3 maps 3 * Copyright (C) 2002 Ludwig Nussel <l-n@users.sourceforge.net> 4 * 5 * This program is free software; you can redistribute it and/or modify 6 * it under the terms of the GNU General Public License as published by 7 * the Free Software Foundation; either version 2 of the License, or 8 * (at your option) any later version. 9 * 10 * This program is distributed in the hope that it will be useful, 11 * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 * GNU General Public License for more details. 14 * 15 * You should have received a copy of the GNU General Public License 16 * along with this program; if not, write to the Free Software 17 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA 18 */ 19 20 #ifndef Q3MAPS_H 21 #define Q3MAPS_H 22 23 #include <glib.h> 24 25 /** 26 * name is the full path of a file at found at level l 27 */ 28 typedef void (*FoundFileFunction)(const char* name, int l, gpointer data); 29 30 /** 31 * the current directory which is at level l contains directory name. 32 * return TRUE if this directory should be visited, false otherwise 33 */ 34 typedef gboolean (*FoundDirFunction)(const char* name, int l, gpointer data); 35 36 /** free all keys and destroy maphash */ 37 void q3_clear_maps(GHashTable* maphash); 38 39 /** create map hash */ 40 GHashTable* q3_init_maphash(); 41 42 /** return true if mapname is contained in maphash, false otherwise */ 43 gboolean q3_lookup_map(GHashTable* maphash, const char* mapname); 44 45 /** return true if mapname is contained in maphash, false otherwise 46 * same as q3_lookup_mapshot except operates on basename of mapname 47 */ 48 gboolean doom3_lookup_map(GHashTable* maphash, const char* mapname); 49 50 /** acquire image data, function allocates space in buf, returns size. buf must 51 * be freed by caller */ 52 size_t q3_lookup_mapshot(GHashTable* maphash, const char* mapname, guchar** buf); 53 54 /** acquire image data, function allocates space in buf, returns size. buf must 55 * be freed by caller 56 * 57 * same as q3_lookup_mapshot except operates on basename of mapname 58 */ 59 size_t doom3_lookup_mapshot(GHashTable* maphash, const char* mapname, guchar** buf); 60 61 /** 62 * find all maps in .pk3 files one level under startdir 63 */ 64 void findq3maps(GHashTable* maphash, const char* startdir); 65 66 /** 67 * find all maps in .pk4 files one level under startdir 68 */ 69 void finddoom3maps(GHashTable* maphash, const char* startdir); 70 void findquake4maps(GHashTable* maphash, const char* startdir); 71 void findetqwmaps(GHashTable* maphash, const char* startdir); 72 73 void findquakemaps(GHashTable* maphash, const char* startdir); 74 75 #endif 76