added file_from_pak as a new flobal, made COM_FindFile() to set it properly.

from quakeworld sources.


git-svn-id: svn://svn.code.sf.net/p/quakespasm/code/trunk/quakespasm@352 af15c1b1-3010-417e-b628-4374ebc0bcbd
This commit is contained in:
Ozkan Sezer 2010-12-30 16:35:16 +00:00
parent b0550eeacd
commit 56a7b2e6fd
2 changed files with 5 additions and 0 deletions

View file

@ -1365,6 +1365,7 @@ typedef struct
char com_gamedir[MAX_OSPATH]; char com_gamedir[MAX_OSPATH];
char com_basedir[MAX_OSPATH]; char com_basedir[MAX_OSPATH];
int file_from_pak; // ZOID: global indicating that file came from a pak
typedef struct searchpath_s typedef struct searchpath_s
{ {
@ -1499,6 +1500,8 @@ int COM_FindFile (const char *filename, int *handle, FILE **file)
if (!file && !handle) if (!file && !handle)
Sys_Error ("COM_FindFile: neither handle or file set"); Sys_Error ("COM_FindFile: neither handle or file set");
file_from_pak = 0;
// //
// search through the path, one element at a time // search through the path, one element at a time
// //
@ -1531,6 +1534,7 @@ int COM_FindFile (const char *filename, int *handle, FILE **file)
if (*file) if (*file)
fseek (*file, pak->files[i].filepos, SEEK_SET); fseek (*file, pak->files[i].filepos, SEEK_SET);
} }
file_from_pak = 1;
com_filesize = pak->files[i].filelen; com_filesize = pak->files[i].filelen;
return com_filesize; return com_filesize;
} }

View file

@ -183,6 +183,7 @@ struct cache_user_s;
extern char com_basedir[MAX_OSPATH]; extern char com_basedir[MAX_OSPATH];
extern char com_gamedir[MAX_OSPATH]; extern char com_gamedir[MAX_OSPATH];
extern int file_from_pak; // global indicating that file came from a pak
void COM_WriteFile (const char *filename, const void *data, int len); void COM_WriteFile (const char *filename, const void *data, int len);
int COM_OpenFile (const char *filename, int *hndl); int COM_OpenFile (const char *filename, int *hndl);