add support for gziped maps (*.bsp.gz) and pak files in general to COM_MapList_f

This commit is contained in:
Bill Currie 2000-03-31 04:46:53 +00:00
parent 4c7ce6d614
commit 4d1176e8c5

View file

@ -199,25 +199,31 @@ void COM_Maplist_f (void)
struct dirent *dirent; struct dirent *dirent;
char buf[MAX_OSPATH]; char buf[MAX_OSPATH];
for (search = com_searchpaths ; search ; search = search->next) for (search = com_searchpaths ; search ; search = search->next) {
{ if (search->pack) {
if (!Q_strcmp (search->filename, "")) int i;
continue; pack_t *pak = search->pack;
Con_Printf ("Looking in %s...\n",search->filename);
for (i=0 ; i<pak->numfiles ; i++) {
char *name=pak->files[i].name;
if (!fnmatch ("maps/*.bsp", name, FNM_PATHNAME)
|| !fnmatch ("maps/*.bsp.gz", name, FNM_PATHNAME))
Con_Printf ("%s\n", name+5);
}
} else {
snprintf (buf, sizeof(buf), "%s/maps", search->filename); snprintf (buf, sizeof(buf), "%s/maps", search->filename);
dir_ptr = opendir(buf); dir_ptr = opendir(buf);
Con_Printf ("Looking in %s...\n",buf); Con_Printf ("Looking in %s...\n",buf);
if (!dir_ptr) if (!dir_ptr)
continue; continue;
while ((dirent = readdir (dir_ptr))) while ((dirent = readdir (dir_ptr)))
{ if (!fnmatch ("*.bsp", dirent->d_name, 0)
if (!fnmatch ("*.bsp", dirent->d_name, 0)) || !fnmatch ("*.bsp.gz", dirent->d_name, 0))
{
Con_Printf ("%s\n", dirent->d_name); Con_Printf ("%s\n", dirent->d_name);
}
}
closedir (dir_ptr); closedir (dir_ptr);
} }
} }
}
/* /*
============ ============