diff --git a/common/cl_main.c b/common/cl_main.c index 55a601a..3ecd987 100644 --- a/common/cl_main.c +++ b/common/cl_main.c @@ -132,6 +132,7 @@ cvar_t *cl_talksound; extern cvar_t *sys_nostdout; +extern void COM_Maplist_f (void); cvar_t *localid; #ifdef QUAKEWORLD @@ -1636,6 +1637,7 @@ void CL_Init (void) // // register our commands // + Cmd_AddCommand ("maplist", COM_Maplist_f); Cmd_AddCommand ("changing", CL_Changing_f); #ifdef UQUAKE Cmd_AddCommand ("entities", CL_PrintEntities_f); diff --git a/common/quakefs.c b/common/quakefs.c index 64bd5aa..344222b 100644 --- a/common/quakefs.c +++ b/common/quakefs.c @@ -192,6 +192,33 @@ void COM_Path_f (void) } } +void COM_Maplist_f (void) +{ + searchpath_t *search; + DIR *dir_ptr; + struct dirent *dirent; + char buf[MAX_OSPATH]; + + for (search = com_searchpaths ; search ; search = search->next) + { + if (!Q_strcmp (search->filename, "")) + continue; + snprintf (buf, sizeof(buf), "%s/maps", search->filename); + dir_ptr = opendir(buf); + Con_Printf ("Looking in %s...\n",buf); + if (!dir_ptr) + continue; + while ((dirent = readdir (dir_ptr))) + { + if (!fnmatch ("*.bsp", dirent->d_name, 0)) + { + Con_Printf ("%s\n", dirent->d_name); + } + } + closedir (dir_ptr); + } +} + /* ============ COM_WriteFile