--- quake2/qcommon/files.c 2018/04/24 17:58:32 1.1 +++ quake2/qcommon/files.c 2018/04/24 18:02:16 1.1.1.4 @@ -1,3 +1,22 @@ +/* +Copyright (C) 1997-2001 Id Software, Inc. + +This program is free software; you can redistribute it and/or +modify it under the terms of the GNU General Public License +as published by the Free Software Foundation; either version 2 +of the License, or (at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + +See the GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program; if not, write to the Free Software +Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +*/ #include "qcommon.h" @@ -21,8 +40,6 @@ QUAKE FILESYSTEM */ -#define BASEDIRNAME "baseq2" - // // in memory // @@ -134,6 +151,46 @@ void FS_FCloseFile (FILE *f) fclose (f); } + +// RAFAEL +/* + Developer_searchpath +*/ +int Developer_searchpath (int who) +{ + + int ch; + // PMM - warning removal +// char *start; + searchpath_t *search; + + if (who == 1) // xatrix + ch = 'x'; + else if (who == 2) + ch = 'r'; + + for (search = fs_searchpaths ; search ; search = search->next) + { + if (strstr (search->filename, "xatrix")) + return 1; + + if (strstr (search->filename, "rogue")) + return 2; +/* + start = strchr (search->filename, ch); + + if (start == NULL) + continue; + + if (strcmp (start ,"xatrix") == 0) + return (1); +*/ + } + return (0); + +} + + /* =========== FS_FOpenFile @@ -144,6 +201,7 @@ Used for streaming data out of either a a seperate file. =========== */ +int file_from_pak = 0; #ifndef NO_ADDONS int FS_FOpenFile (char *filename, FILE **file) { @@ -153,6 +211,8 @@ int FS_FOpenFile (char *filename, FILE * int i; filelink_t *link; + file_from_pak = 0; + // check for links first for (link = fs_links ; link ; link=link->next) { @@ -182,6 +242,7 @@ int FS_FOpenFile (char *filename, FILE * for (i=0 ; inumfiles ; i++) if (!Q_strcasecmp (pak->files[i].name, filename)) { // found it! + file_from_pak = 1; Com_DPrintf ("PackFile: %s : %s\n",pak->filename, filename); // open a new file on the pakfile *file = fopen (pak->filename, "rb"); @@ -225,6 +286,8 @@ int FS_FOpenFile (char *filename, FILE * pack_t *pak; int i; + file_from_pak = 0; + // get config from directory, everything else from pak if (!strcmp(filename, "config.cfg") || !strncmp(filename, "players/", 8)) { @@ -252,6 +315,7 @@ int FS_FOpenFile (char *filename, FILE * for (i=0 ; inumfiles ; i++) if (!Q_strcasecmp (pak->files[i].name, filename)) { // found it! + file_from_pak = 1; Com_DPrintf ("PackFile: %s : %s\n",pak->filename, filename); // open a new file on the pakfile *file = fopen (pak->filename, "rb"); @@ -490,7 +554,10 @@ Called to find where to write a file (de */ char *FS_Gamedir (void) { - return fs_gamedir; + if (*fs_gamedir) + return fs_gamedir; + else + return BASEDIRNAME; } /*