mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2024-11-22 20:41:20 +00:00
rename all the globals in quakefs.[ch] to be QFS_* or qfs_*
This commit is contained in:
parent
a710e809f5
commit
6a687f5e45
61 changed files with 308 additions and 309 deletions
|
@ -51,44 +51,43 @@ typedef struct gamedir_s {
|
|||
const char *skinpath;
|
||||
} gamedir_t;
|
||||
|
||||
extern searchpath_t *com_searchpaths;
|
||||
extern searchpath_t *qfs_searchpaths;
|
||||
extern gamedir_t *qfs_gamedir;
|
||||
|
||||
extern struct cvar_s *fs_userpath;
|
||||
extern struct cvar_s *fs_sharepath;
|
||||
|
||||
extern int file_from_pak;
|
||||
extern int com_filesize;
|
||||
extern int qfs_filesize;
|
||||
|
||||
extern char qfs_gamedir_path[MAX_OSPATH];
|
||||
extern char qfs_gamedir_file[MAX_OSPATH];
|
||||
|
||||
struct cache_user_s;
|
||||
|
||||
extern char com_gamedir[MAX_OSPATH];
|
||||
extern char gamedirfile[MAX_OSPATH];
|
||||
char *QFS_CompressPath (const char *pth);
|
||||
void QFS_WriteFile (const char *filename, void *data, int len);
|
||||
void QFS_WriteBuffers (const char *filename, int count, ...);
|
||||
|
||||
char *COM_CompressPath (const char *pth);
|
||||
void COM_WriteFile (const char *filename, void *data, int len);
|
||||
void COM_WriteBuffers (const char *filename, int count, ...);
|
||||
|
||||
int _COM_FOpenFile (const char *filename, QFile **gzfile, char *foundname, int zip);
|
||||
int COM_FOpenFile (const char *filename, QFile **gzfile);
|
||||
void COM_CloseFile (QFile *h);
|
||||
void COM_FileBase (const char *in, char *out);
|
||||
void COM_DefaultExtension (char *path, const char *extension);
|
||||
const char *COM_SkipPath (const char *pathname);
|
||||
void COM_StripExtension (const char *in, char *out);
|
||||
int COM_NextFilename (char *filename, const char *prefix, const char *ext);
|
||||
const char *COM_FileExtension (const char *in);
|
||||
int _QFS_FOpenFile (const char *filename, QFile **gzfile, char *foundname, int zip);
|
||||
int QFS_FOpenFile (const char *filename, QFile **gzfile);
|
||||
void QFS_FileBase (const char *in, char *out);
|
||||
void QFS_DefaultExtension (char *path, const char *extension);
|
||||
const char *QFS_SkipPath (const char *pathname);
|
||||
void QFS_StripExtension (const char *in, char *out);
|
||||
int QFS_NextFilename (char *filename, const char *prefix, const char *ext);
|
||||
const char *QFS_FileExtension (const char *in);
|
||||
|
||||
|
||||
|
||||
byte *COM_LoadFile (const char *path, int usehunk);
|
||||
byte *COM_LoadStackFile (const char *path, void *buffer, int bufsize);
|
||||
byte *COM_LoadTempFile (const char *path);
|
||||
byte *COM_LoadHunkFile (const char *path);
|
||||
void COM_LoadCacheFile (const char *path, struct cache_user_s *cu);
|
||||
void COM_CreatePath (const char *path);
|
||||
void COM_Gamedir (const char *dir);
|
||||
byte *QFS_LoadFile (const char *path, int usehunk);
|
||||
byte *QFS_LoadStackFile (const char *path, void *buffer, int bufsize);
|
||||
byte *QFS_LoadTempFile (const char *path);
|
||||
byte *QFS_LoadHunkFile (const char *path);
|
||||
void QFS_LoadCacheFile (const char *path, struct cache_user_s *cu);
|
||||
void QFS_CreatePath (const char *path);
|
||||
void QFS_Gamedir (const char *dir);
|
||||
void QFS_Init (const char *game);
|
||||
void COM_Path_f (void);
|
||||
void COM_CreateGameDirectory (const char *gamename);
|
||||
void QFS_CreateGameDirectory (const char *gamename);
|
||||
|
||||
#endif // __quakefs_h
|
||||
|
|
|
@ -196,23 +196,23 @@ SND_LoadSound (sfx_t *sfx, cache_allocator_t allocator)
|
|||
// load it in
|
||||
strcpy (namebuffer, "sound/");
|
||||
strncat (namebuffer, sfx->name, sizeof (namebuffer) - strlen (namebuffer));
|
||||
_COM_FOpenFile (namebuffer, &file, foundname, 1);
|
||||
_QFS_FOpenFile (namebuffer, &file, foundname, 1);
|
||||
if (!file) {
|
||||
Sys_Printf ("Couldn't load %s\n", namebuffer);
|
||||
return 0;
|
||||
}
|
||||
if (strcmp (".ogg", COM_FileExtension (foundname)) == 0) {
|
||||
if (strcmp (".ogg", QFS_FileExtension (foundname)) == 0) {
|
||||
return SND_LoadOgg (file, sfx, allocator);
|
||||
}
|
||||
Qclose (file); //FIXME this is a dumb way to do this
|
||||
data = COM_LoadStackFile (namebuffer, stackbuf, sizeof (stackbuf));
|
||||
data = QFS_LoadStackFile (namebuffer, stackbuf, sizeof (stackbuf));
|
||||
|
||||
if (!data) {
|
||||
Sys_Printf ("Couldn't load %s\n", namebuffer);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
info = SND_GetWavinfo (sfx->name, data, com_filesize);
|
||||
info = SND_GetWavinfo (sfx->name, data, qfs_filesize);
|
||||
if (info.channels != 1) {
|
||||
Sys_Printf ("%s is a stereo sample\n", sfx->name);
|
||||
return NULL;
|
||||
|
|
|
@ -250,7 +250,7 @@ Condump_f (void)
|
|||
Con_Printf ("invalid character in filename\n");
|
||||
return;
|
||||
}
|
||||
snprintf (name, sizeof (name), "%s/%s.txt", com_gamedir, Cmd_Argv (1));
|
||||
snprintf (name, sizeof (name), "%s/%s.txt", qfs_gamedir_path, Cmd_Argv (1));
|
||||
|
||||
if (!(file = Qopen (name, "wt"))) {
|
||||
Con_Printf ("could not open %s for writing: %s\n", name,
|
||||
|
@ -452,7 +452,8 @@ C_Print (const char *fmt, va_list args)
|
|||
|
||||
// log all messages to file
|
||||
if (con_debuglog)
|
||||
Sys_DebugLog (va ("%s/qconsole.log", com_gamedir), "%s", buffer->str);
|
||||
Sys_DebugLog (va ("%s/qconsole.log", qfs_gamedir_path),
|
||||
"%s", buffer->str);
|
||||
|
||||
if (!con_initialized)
|
||||
return;
|
||||
|
@ -747,7 +748,7 @@ DrawDownload (int lines)
|
|||
if (!con_data.dl_name || !*con_data.dl_name)
|
||||
return;
|
||||
|
||||
text = COM_SkipPath(con_data.dl_name);
|
||||
text = QFS_SkipPath(con_data.dl_name);
|
||||
|
||||
x = con_linewidth - ((con_linewidth * 7) / 40);
|
||||
y = x - strlen (text) - 8;
|
||||
|
@ -808,9 +809,9 @@ C_NewMap (void)
|
|||
{
|
||||
static char old_gamedir[MAX_OSPATH];
|
||||
|
||||
if (!strequal (old_gamedir, com_gamedir))
|
||||
if (!strequal (old_gamedir, qfs_gamedir_path))
|
||||
Menu_Load ();
|
||||
strcpy (old_gamedir, com_gamedir);
|
||||
strcpy (old_gamedir, qfs_gamedir_path);
|
||||
}
|
||||
|
||||
static general_funcs_t plugin_info_general_funcs = {
|
||||
|
|
|
@ -177,7 +177,7 @@ filelist_fill (struct filelist *filelist, const char *path, const char *ext)
|
|||
struct dirent *dirent;
|
||||
char buf[MAX_OSPATH];
|
||||
|
||||
for (search = com_searchpaths; search != NULL; search = search->next) {
|
||||
for (search = qfs_searchpaths; search != NULL; search = search->next) {
|
||||
if (search->pack) {
|
||||
int i;
|
||||
pack_t *pak = search->pack;
|
||||
|
|
|
@ -406,7 +406,7 @@ menu_free_progs_mem (progs_t *pr, void *mem)
|
|||
static void *
|
||||
menu_load_file (progs_t *pr, const char *path)
|
||||
{
|
||||
return COM_LoadFile (path, 0);
|
||||
return QFS_LoadFile (path, 0);
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -474,7 +474,7 @@ Menu_Load (void)
|
|||
menu = 0;
|
||||
top_menu = 0;
|
||||
|
||||
if ((size = COM_FOpenFile (menu_pr_state.progs_name, &file)) != -1) {
|
||||
if ((size = QFS_FOpenFile (menu_pr_state.progs_name, &file)) != -1) {
|
||||
PR_LoadProgsFile (&menu_pr_state, file, size, 0, 256 * 1024);
|
||||
Qclose (file);
|
||||
|
||||
|
|
|
@ -144,7 +144,7 @@ bi_File_Open (progs_t *pr)
|
|||
do_read |= 1;
|
||||
}
|
||||
|
||||
path = COM_CompressPath (pth);
|
||||
path = QFS_CompressPath (pth);
|
||||
//printf ("'%s' '%s'\n", P_STRING (pr, 0), path);
|
||||
if (!path[0])
|
||||
goto error;
|
||||
|
@ -158,7 +158,7 @@ bi_File_Open (progs_t *pr)
|
|||
goto error;
|
||||
if (do_write && !file_writeable (path))
|
||||
goto error;
|
||||
R_INT (pr) = QFile_open (pr, va ("%s/%s", com_gamedir, path), mode);
|
||||
R_INT (pr) = QFile_open (pr, va ("%s/%s", qfs_gamedir_path, path), mode);
|
||||
free (path);
|
||||
return;
|
||||
error:
|
||||
|
|
|
@ -179,8 +179,8 @@ PR_LoadDebug (progs_t *pr)
|
|||
if (!str)
|
||||
return;
|
||||
pr->debugfile = PR_GetString (pr, str->string_var);
|
||||
sym_file = COM_SkipPath (pr->debugfile);
|
||||
path_end = COM_SkipPath (pr->progs_name);
|
||||
sym_file = QFS_SkipPath (pr->debugfile);
|
||||
path_end = QFS_SkipPath (pr->progs_name);
|
||||
sym_path = Hunk_TempAlloc (strlen (sym_file) + (path_end - pr->progs_name)
|
||||
+ 1);
|
||||
strncpy (sym_path, pr->progs_name, path_end - pr->progs_name);
|
||||
|
|
|
@ -75,7 +75,7 @@ var_get_key (void *d, void *_pr)
|
|||
static void *
|
||||
load_file (progs_t *pr, const char *path)
|
||||
{
|
||||
return COM_LoadHunkFile (path);
|
||||
return QFS_LoadHunkFile (path);
|
||||
}
|
||||
|
||||
static void *
|
||||
|
@ -99,8 +99,8 @@ PR_LoadProgsFile (progs_t * pr, QFile *file, int size, int edicts, int zone)
|
|||
if (Qread (file, &progs, sizeof (progs)) != sizeof (progs))
|
||||
PR_Error (pr, "error reading header");
|
||||
|
||||
pr->progs_size = com_filesize;
|
||||
Sys_DPrintf ("Programs occupy %iK.\n", com_filesize / 1024);
|
||||
pr->progs_size = qfs_filesize;
|
||||
Sys_DPrintf ("Programs occupy %iK.\n", qfs_filesize / 1024);
|
||||
|
||||
// store prog crc
|
||||
pr->crc = CRC_Block ((byte*)&progs, sizeof (progs));
|
||||
|
@ -263,11 +263,11 @@ void
|
|||
PR_LoadProgs (progs_t *pr, const char *progsname, int edicts, int zone)
|
||||
{
|
||||
QFile *file;
|
||||
COM_FOpenFile (progsname, &file);
|
||||
QFS_FOpenFile (progsname, &file);
|
||||
|
||||
pr->progs_name = progsname;
|
||||
if (file) {
|
||||
PR_LoadProgsFile (pr, file, com_filesize, edicts, zone);
|
||||
PR_LoadProgsFile (pr, file, qfs_filesize, edicts, zone);
|
||||
Qclose (file);
|
||||
}
|
||||
if (!pr->progs)
|
||||
|
|
|
@ -605,7 +605,7 @@ GIB_File_Transform_Path_Secure (dstring_t *path)
|
|||
return -1;
|
||||
/* Qexpand_squiggle (fs_userpath->string, e_dir); */
|
||||
dstring_insertstr (path, 0, "/");
|
||||
dstring_insertstr (path, 0, /* e_dir */ com_gamedir);
|
||||
dstring_insertstr (path, 0, /* e_dir */ qfs_gamedir_path);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
@ -64,7 +64,7 @@ GIB_Exec_Override_f (void) {
|
|||
}
|
||||
|
||||
mark = Hunk_LowMark ();
|
||||
f = (char *) COM_LoadHunkFile (Cmd_Argv (1));
|
||||
f = (char *) QFS_LoadHunkFile (Cmd_Argv (1));
|
||||
if (!f) {
|
||||
Sys_Printf ("couldn't exec %s\n", Cmd_Argv (1));
|
||||
return;
|
||||
|
|
|
@ -354,11 +354,11 @@ Mod_MakeAliasModelDisplayLists (model_t *m, aliashdr_t *hdr, void *_m, int _s, i
|
|||
|
||||
// look for a cached version
|
||||
strcpy (cache, "glquake/");
|
||||
COM_StripExtension (m->name + strlen ("progs/"),
|
||||
QFS_StripExtension (m->name + strlen ("progs/"),
|
||||
cache + strlen ("glquake/"));
|
||||
strncat (cache, ".qfms", sizeof (cache) - strlen (cache));
|
||||
|
||||
COM_FOpenFile (cache, &f);
|
||||
QFS_FOpenFile (cache, &f);
|
||||
if (f) {
|
||||
unsigned char d1[MDFOUR_DIGEST_BYTES];
|
||||
unsigned char d2[MDFOUR_DIGEST_BYTES];
|
||||
|
@ -431,11 +431,11 @@ Mod_MakeAliasModelDisplayLists (model_t *m, aliashdr_t *hdr, void *_m, int _s, i
|
|||
|
||||
if (do_cache) {
|
||||
// save out the cached version
|
||||
snprintf (fullpath, sizeof (fullpath), "%s/%s", com_gamedir,
|
||||
snprintf (fullpath, sizeof (fullpath), "%s/%s", qfs_gamedir_path,
|
||||
cache);
|
||||
f = Qopen (fullpath, "wbz9");
|
||||
if (!f) {
|
||||
COM_CreatePath (fullpath);
|
||||
QFS_CreatePath (fullpath);
|
||||
f = Qopen (fullpath, "wb");
|
||||
}
|
||||
|
||||
|
|
|
@ -271,7 +271,7 @@ Mod_LoadExternalSkin (maliasskindesc_t *pskindesc, char *filename)
|
|||
tex_t *targa;
|
||||
QFile *f;
|
||||
|
||||
COM_FOpenFile (filename, &f);
|
||||
QFS_FOpenFile (filename, &f);
|
||||
if (f)
|
||||
{
|
||||
targa = LoadTGA (f);
|
||||
|
|
|
@ -151,7 +151,7 @@ Mod_LoadAliasModel (model_t *mod, void *buffer, cache_allocator_t allocator)
|
|||
extra = 1; // extra precision bytes
|
||||
|
||||
CRC_Init (&crc);
|
||||
for (len = com_filesize, p = buffer; len; len--, p++)
|
||||
for (len = qfs_filesize, p = buffer; len; len--, p++)
|
||||
CRC_ProcessByte (&crc, *p);
|
||||
|
||||
start = Hunk_LowMark ();
|
||||
|
@ -289,7 +289,7 @@ Mod_LoadAliasModel (model_t *mod, void *buffer, cache_allocator_t allocator)
|
|||
mod->radius = RadiusFromBounds (mod->mins, mod->maxs);
|
||||
|
||||
// build the draw lists
|
||||
Mod_MakeAliasModelDisplayLists (mod, pheader, buffer, com_filesize, extra);
|
||||
Mod_MakeAliasModelDisplayLists (mod, pheader, buffer, qfs_filesize, extra);
|
||||
|
||||
Mod_FinalizeAliasModel (mod, pheader);
|
||||
|
||||
|
|
|
@ -90,7 +90,7 @@ Mod_LoadExternalTextures (model_t *mod)
|
|||
} else {
|
||||
filename = va ("maps/%s.tga", tx->name);
|
||||
}
|
||||
COM_FOpenFile (filename, &f);
|
||||
QFS_FOpenFile (filename, &f);
|
||||
|
||||
if (!f) {
|
||||
if (tx->name[0] == '*') {
|
||||
|
@ -98,7 +98,7 @@ Mod_LoadExternalTextures (model_t *mod)
|
|||
} else {
|
||||
filename = va ("textures/%s.tga", tx->name);
|
||||
}
|
||||
COM_FOpenFile (filename, &f);
|
||||
QFS_FOpenFile (filename, &f);
|
||||
}
|
||||
|
||||
if (f) {
|
||||
|
@ -123,10 +123,10 @@ Mod_LoadLighting (lump_t *l)
|
|||
if (mod_lightmap_bytes > 1) {
|
||||
// LordHavoc: check for a .lit file to load
|
||||
strcpy (litfilename, loadmodel->name);
|
||||
COM_StripExtension (litfilename, litfilename);
|
||||
QFS_StripExtension (litfilename, litfilename);
|
||||
strncat (litfilename, ".lit", sizeof (litfilename) -
|
||||
strlen (litfilename));
|
||||
data = (byte *) COM_LoadHunkFile (litfilename);
|
||||
data = (byte *) QFS_LoadHunkFile (litfilename);
|
||||
if (data) {
|
||||
if (data[0] == 'Q' && data[1] == 'L' && data[2] == 'I'
|
||||
&& data[3] == 'T') {
|
||||
|
|
|
@ -147,7 +147,7 @@ Mod_RealLoadModel (model_t *mod, qboolean crash, cache_allocator_t allocator)
|
|||
unsigned int *buf;
|
||||
|
||||
// load the file
|
||||
buf = (unsigned int *) COM_LoadFile (mod->name, 0);
|
||||
buf = (unsigned int *) QFS_LoadFile (mod->name, 0);
|
||||
if (!buf) {
|
||||
if (crash)
|
||||
Sys_Error ("Mod_LoadModel: %s not found", mod->name);
|
||||
|
@ -155,7 +155,7 @@ Mod_RealLoadModel (model_t *mod, qboolean crash, cache_allocator_t allocator)
|
|||
}
|
||||
|
||||
// allocate a new model
|
||||
COM_FileBase (mod->name, loadname);
|
||||
QFS_FileBase (mod->name, loadname);
|
||||
|
||||
loadmodel = mod;
|
||||
|
||||
|
|
|
@ -58,7 +58,7 @@ Mod_SpriteLoadTexture (mspriteframe_t *pspriteframe, int framenum)
|
|||
snprintf (name, sizeof (name), "%s_%i", loadmodel->name, framenum);
|
||||
|
||||
snprintf (filename, sizeof (filename), "%s.tga", name);
|
||||
COM_FOpenFile (filename, &f);
|
||||
QFS_FOpenFile (filename, &f);
|
||||
if (f) {
|
||||
targa = LoadTGA (f);
|
||||
Qclose (f);
|
||||
|
|
|
@ -476,7 +476,7 @@ Cmd_Exec_f (void)
|
|||
}
|
||||
|
||||
mark = Hunk_LowMark ();
|
||||
f = (char *) COM_LoadHunkFile (Cmd_Argv (1));
|
||||
f = (char *) QFS_LoadHunkFile (Cmd_Argv (1));
|
||||
if (!f) {
|
||||
Sys_Printf ("couldn't exec %s\n", Cmd_Argv (1));
|
||||
return;
|
||||
|
@ -623,7 +623,7 @@ Cmd_Exec_File (cbuf_t *cbuf, const char *path, int qfs)
|
|||
if (!path || !*path)
|
||||
return;
|
||||
if (qfs) {
|
||||
COM_FOpenFile (path, &file);
|
||||
QFS_FOpenFile (path, &file);
|
||||
} else {
|
||||
file = Qopen (path, "r");
|
||||
}
|
||||
|
|
|
@ -63,8 +63,8 @@ LoadPCX (QFile *f, int convert, byte *pal)
|
|||
|
||||
// parse the PCX file
|
||||
pcx_mark = Hunk_LowMark ();
|
||||
pcx = Hunk_AllocName (com_filesize, "PCX");
|
||||
Qread (f, pcx, com_filesize);
|
||||
pcx = Hunk_AllocName (qfs_filesize, "PCX");
|
||||
Qread (f, pcx, qfs_filesize);
|
||||
|
||||
pcx->xmax = LittleShort (pcx->xmax);
|
||||
pcx->xmin = LittleShort (pcx->xmin);
|
||||
|
@ -83,7 +83,7 @@ LoadPCX (QFile *f, int convert, byte *pal)
|
|||
return 0;
|
||||
}
|
||||
|
||||
palette = ((byte *) pcx) + com_filesize - 768;
|
||||
palette = ((byte *) pcx) + qfs_filesize - 768;
|
||||
dataByte = (byte *) &pcx[1];
|
||||
|
||||
count = (pcx->xmax + 1) * (pcx->ymax + 1);
|
||||
|
|
|
@ -118,12 +118,12 @@ cvar_t *fs_userpath;
|
|||
cvar_t *fs_sharepath;
|
||||
cvar_t *fs_dirconf;
|
||||
|
||||
char gamedirfile[MAX_OSPATH];
|
||||
char qfs_gamedir_file[MAX_OSPATH];
|
||||
|
||||
char com_gamedir[MAX_OSPATH];
|
||||
int com_filesize;
|
||||
char qfs_gamedir_path[MAX_OSPATH];
|
||||
int qfs_filesize;
|
||||
|
||||
searchpath_t *com_searchpaths;
|
||||
searchpath_t *qfs_searchpaths;
|
||||
|
||||
//QFS
|
||||
|
||||
|
@ -132,7 +132,7 @@ typedef struct qfs_var_s {
|
|||
char *val;
|
||||
} qfs_var_t;
|
||||
|
||||
static void COM_AddGameDirectory (const char *dir); //FIXME
|
||||
static void QFS_AddGameDirectory (const char *dir); //FIXME
|
||||
|
||||
gamedir_t *qfs_gamedir;
|
||||
static plitem_t *qfs_gd_plist;
|
||||
|
@ -373,7 +373,7 @@ qfs_process_path (const char *path, const char *gamedir)
|
|||
s--;
|
||||
if (s != e) {
|
||||
dsprintf (dir, "%.*s", (int) (e - s), s);
|
||||
COM_AddGameDirectory (dir->str);
|
||||
QFS_AddGameDirectory (dir->str);
|
||||
}
|
||||
e = --s;
|
||||
}
|
||||
|
@ -405,17 +405,17 @@ qfs_build_gamedir (const char **list)
|
|||
free (qfs_gamedir);
|
||||
}
|
||||
|
||||
while (com_searchpaths) {
|
||||
while (qfs_searchpaths) {
|
||||
searchpath_t *next;
|
||||
|
||||
if (com_searchpaths->pack) {
|
||||
Qclose (com_searchpaths->pack->handle);
|
||||
free (com_searchpaths->pack->files);
|
||||
free (com_searchpaths->pack);
|
||||
if (qfs_searchpaths->pack) {
|
||||
Qclose (qfs_searchpaths->pack->handle);
|
||||
free (qfs_searchpaths->pack->files);
|
||||
free (qfs_searchpaths->pack);
|
||||
}
|
||||
next = com_searchpaths->next;
|
||||
free (com_searchpaths);
|
||||
com_searchpaths = next;
|
||||
next = qfs_searchpaths->next;
|
||||
free (qfs_searchpaths);
|
||||
qfs_searchpaths = next;
|
||||
}
|
||||
|
||||
for (j = 0; list[j]; j++)
|
||||
|
@ -482,7 +482,7 @@ no_config:
|
|||
}
|
||||
|
||||
void
|
||||
COM_FileBase (const char *in, char *out)
|
||||
QFS_FileBase (const char *in, char *out)
|
||||
{
|
||||
const char *slash, *dot, *s;
|
||||
|
||||
|
@ -508,13 +508,13 @@ COM_FileBase (const char *in, char *out)
|
|||
}
|
||||
|
||||
|
||||
void
|
||||
COM_Path_f (void)
|
||||
static void
|
||||
QFS_Path_f (void)
|
||||
{
|
||||
searchpath_t *s;
|
||||
|
||||
Sys_Printf ("Current search path:\n");
|
||||
for (s = com_searchpaths; s; s = s->next) {
|
||||
for (s = qfs_searchpaths; s; s = s->next) {
|
||||
if (s->pack)
|
||||
Sys_Printf ("%s (%i files)\n", s->pack->filename,
|
||||
s->pack->numfiles);
|
||||
|
@ -524,38 +524,38 @@ COM_Path_f (void)
|
|||
}
|
||||
|
||||
/*
|
||||
COM_WriteFile
|
||||
QFS_WriteFile
|
||||
|
||||
The filename will be prefixed by the current game directory
|
||||
*/
|
||||
void
|
||||
COM_WriteFile (const char *filename, void *data, int len)
|
||||
QFS_WriteFile (const char *filename, void *data, int len)
|
||||
{
|
||||
char name[MAX_OSPATH];
|
||||
QFile *f;
|
||||
|
||||
snprintf (name, sizeof (name), "%s/%s", com_gamedir, filename);
|
||||
snprintf (name, sizeof (name), "%s/%s", qfs_gamedir_path, filename);
|
||||
|
||||
f = Qopen (name, "wb");
|
||||
if (!f) {
|
||||
Sys_mkdir (com_gamedir);
|
||||
Sys_mkdir (qfs_gamedir_path);
|
||||
f = Qopen (name, "wb");
|
||||
if (!f)
|
||||
Sys_Error ("Error opening %s", filename);
|
||||
}
|
||||
|
||||
Sys_Printf ("COM_WriteFile: %s\n", name);
|
||||
Sys_Printf ("QFS_WriteFile: %s\n", name);
|
||||
Qwrite (f, data, len);
|
||||
Qclose (f);
|
||||
}
|
||||
|
||||
/*
|
||||
COM_WriteBuffers
|
||||
QFS_WriteBuffers
|
||||
|
||||
The filename will be prefixed by the current game directory
|
||||
*/
|
||||
void
|
||||
COM_WriteBuffers (const char *filename, int count, ...)
|
||||
QFS_WriteBuffers (const char *filename, int count, ...)
|
||||
{
|
||||
char name[MAX_OSPATH];
|
||||
va_list args;
|
||||
|
@ -563,17 +563,17 @@ COM_WriteBuffers (const char *filename, int count, ...)
|
|||
|
||||
va_start (args, count);
|
||||
|
||||
snprintf (name, sizeof (name), "%s/%s", com_gamedir, filename);
|
||||
snprintf (name, sizeof (name), "%s/%s", qfs_gamedir_path, filename);
|
||||
|
||||
f = Qopen (name, "wb");
|
||||
if (!f) {
|
||||
Sys_mkdir (com_gamedir);
|
||||
Sys_mkdir (qfs_gamedir_path);
|
||||
f = Qopen (name, "wb");
|
||||
if (!f)
|
||||
Sys_Error ("Error opening %s", filename);
|
||||
}
|
||||
|
||||
Sys_Printf ("COM_WriteBuffers: %s\n", name);
|
||||
Sys_Printf ("QFS_WriteBuffers: %s\n", name);
|
||||
while (count--) {
|
||||
void *data = va_arg (args, void *);
|
||||
int len = va_arg (args, int);
|
||||
|
@ -585,12 +585,12 @@ COM_WriteBuffers (const char *filename, int count, ...)
|
|||
}
|
||||
|
||||
/*
|
||||
COM_CreatePath
|
||||
QFS_CreatePath
|
||||
|
||||
Only used for CopyFile and download
|
||||
*/
|
||||
void
|
||||
COM_CreatePath (const char *path)
|
||||
QFS_CreatePath (const char *path)
|
||||
{
|
||||
char *ofs;
|
||||
char e_path[MAX_OSPATH];
|
||||
|
@ -607,7 +607,7 @@ COM_CreatePath (const char *path)
|
|||
}
|
||||
|
||||
static QFile *
|
||||
COM_OpenRead (const char *path, int offs, int len, int zip)
|
||||
QFS_OpenRead (const char *path, int offs, int len, int zip)
|
||||
{
|
||||
QFile *file;
|
||||
|
||||
|
@ -621,13 +621,13 @@ COM_OpenRead (const char *path, int offs, int len, int zip)
|
|||
return 0;
|
||||
}
|
||||
|
||||
com_filesize = Qfilesize (file);
|
||||
qfs_filesize = Qfilesize (file);
|
||||
|
||||
return file;
|
||||
}
|
||||
|
||||
char *
|
||||
COM_CompressPath (const char *pth)
|
||||
QFS_CompressPath (const char *pth)
|
||||
{
|
||||
char *p, *d;
|
||||
char *path= malloc (strlen (pth) + 1);
|
||||
|
@ -707,10 +707,10 @@ contains_updir (const char *filename)
|
|||
int file_from_pak; // global indicating file came from pack file ZOID
|
||||
|
||||
/*
|
||||
COM_FOpenFile
|
||||
QFS_FOpenFile
|
||||
|
||||
Finds the file in the search path.
|
||||
Sets com_filesize and one of handle or file
|
||||
Sets qfs_filesize and one of handle or file
|
||||
*/
|
||||
|
||||
static int
|
||||
|
@ -731,10 +731,10 @@ open_file (searchpath_t *search, const char *filename, QFile **gzfile,
|
|||
packfile->name);
|
||||
// open a new file on the pakfile
|
||||
strncpy (foundname, packfile->name, MAX_OSPATH);
|
||||
*gzfile = COM_OpenRead (search->pack->filename, packfile->filepos,
|
||||
*gzfile = QFS_OpenRead (search->pack->filename, packfile->filepos,
|
||||
packfile->filelen, zip);
|
||||
file_from_pak = 1;
|
||||
return com_filesize;
|
||||
return qfs_filesize;
|
||||
}
|
||||
} else {
|
||||
// sanity check the strings
|
||||
|
@ -754,15 +754,15 @@ open_file (searchpath_t *search, const char *filename, QFile **gzfile,
|
|||
|
||||
Sys_DPrintf ("FindFile: %s\n", netpath);
|
||||
|
||||
*gzfile = COM_OpenRead (netpath, -1, -1, zip);
|
||||
return com_filesize;
|
||||
*gzfile = QFS_OpenRead (netpath, -1, -1, zip);
|
||||
return qfs_filesize;
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
int
|
||||
_COM_FOpenFile (const char *filename, QFile **gzfile, char *foundname, int zip)
|
||||
_QFS_FOpenFile (const char *filename, QFile **gzfile, char *foundname, int zip)
|
||||
{
|
||||
searchpath_t *search;
|
||||
char *path;
|
||||
|
@ -774,15 +774,15 @@ _COM_FOpenFile (const char *filename, QFile **gzfile, char *foundname, int zip)
|
|||
#endif
|
||||
|
||||
// make sure they're not trying to do weird stuff with our private files
|
||||
path = COM_CompressPath (filename);
|
||||
path = QFS_CompressPath (filename);
|
||||
if (contains_updir(path)) {
|
||||
Sys_Printf ("FindFile: %s: attempt to escape directory tree!\n", path);
|
||||
goto error;
|
||||
}
|
||||
|
||||
#ifdef HAVE_VORBIS
|
||||
if (strequal (".wav", COM_FileExtension (path))) {
|
||||
COM_StripExtension (path, oggfilename);
|
||||
if (strequal (".wav", QFS_FileExtension (path))) {
|
||||
QFS_StripExtension (path, oggfilename);
|
||||
strncat (oggfilename, ".ogg",
|
||||
sizeof (oggfilename) - strlen (oggfilename) - 1);
|
||||
} else {
|
||||
|
@ -794,7 +794,7 @@ _COM_FOpenFile (const char *filename, QFile **gzfile, char *foundname, int zip)
|
|||
#endif
|
||||
|
||||
// search through the path, one element at a time
|
||||
for (search = com_searchpaths; search; search = search->next) {
|
||||
for (search = qfs_searchpaths; search; search = search->next) {
|
||||
#ifdef HAVE_VORBIS
|
||||
//NOTE gzipped oggs not supported
|
||||
if (oggfilename[0]
|
||||
|
@ -812,20 +812,20 @@ _COM_FOpenFile (const char *filename, QFile **gzfile, char *foundname, int zip)
|
|||
Sys_DPrintf ("FindFile: can't find %s\n", filename);
|
||||
error:
|
||||
*gzfile = NULL;
|
||||
com_filesize = -1;
|
||||
qfs_filesize = -1;
|
||||
free (path);
|
||||
return -1;
|
||||
ok:
|
||||
free(path);
|
||||
return com_filesize;
|
||||
return qfs_filesize;
|
||||
}
|
||||
|
||||
int
|
||||
COM_FOpenFile (const char *filename, QFile **gzfile)
|
||||
QFS_FOpenFile (const char *filename, QFile **gzfile)
|
||||
{
|
||||
char foundname[MAX_OSPATH];
|
||||
|
||||
return _COM_FOpenFile (filename, gzfile, foundname, 1);
|
||||
return _QFS_FOpenFile (filename, gzfile, foundname, 1);
|
||||
}
|
||||
|
||||
cache_user_t *loadcache;
|
||||
|
@ -833,13 +833,13 @@ byte *loadbuf;
|
|||
int loadsize;
|
||||
|
||||
/*
|
||||
COM_LoadFile
|
||||
QFS_LoadFile
|
||||
|
||||
Filename are relative to the quake directory.
|
||||
Always appends a 0 byte to the loaded data.
|
||||
*/
|
||||
byte *
|
||||
COM_LoadFile (const char *path, int usehunk)
|
||||
QFS_LoadFile (const char *path, int usehunk)
|
||||
{
|
||||
QFile *h;
|
||||
byte *buf = NULL;
|
||||
|
@ -847,12 +847,12 @@ COM_LoadFile (const char *path, int usehunk)
|
|||
int len;
|
||||
|
||||
// look for it in the filesystem or pack files
|
||||
len = com_filesize = COM_FOpenFile (path, &h);
|
||||
len = qfs_filesize = QFS_FOpenFile (path, &h);
|
||||
if (!h)
|
||||
return NULL;
|
||||
|
||||
// extract the filename base name for hunk tag
|
||||
COM_FileBase (path, base);
|
||||
QFS_FileBase (path, base);
|
||||
|
||||
if (usehunk == 1)
|
||||
buf = Hunk_AllocName (len + 1, base);
|
||||
|
@ -868,10 +868,10 @@ COM_LoadFile (const char *path, int usehunk)
|
|||
else
|
||||
buf = loadbuf;
|
||||
} else
|
||||
Sys_Error ("COM_LoadFile: bad usehunk");
|
||||
Sys_Error ("QFS_LoadFile: bad usehunk");
|
||||
|
||||
if (!buf)
|
||||
Sys_Error ("COM_LoadFile: not enough space for %s", path);
|
||||
Sys_Error ("QFS_LoadFile: not enough space for %s", path);
|
||||
|
||||
buf[len] = 0;
|
||||
Qread (h, buf, len);
|
||||
|
@ -881,39 +881,39 @@ COM_LoadFile (const char *path, int usehunk)
|
|||
}
|
||||
|
||||
byte *
|
||||
COM_LoadHunkFile (const char *path)
|
||||
QFS_LoadHunkFile (const char *path)
|
||||
{
|
||||
return COM_LoadFile (path, 1);
|
||||
return QFS_LoadFile (path, 1);
|
||||
}
|
||||
|
||||
byte *
|
||||
COM_LoadTempFile (const char *path)
|
||||
QFS_LoadTempFile (const char *path)
|
||||
{
|
||||
return COM_LoadFile (path, 2);
|
||||
return QFS_LoadFile (path, 2);
|
||||
}
|
||||
|
||||
void
|
||||
COM_LoadCacheFile (const char *path, struct cache_user_s *cu)
|
||||
QFS_LoadCacheFile (const char *path, struct cache_user_s *cu)
|
||||
{
|
||||
loadcache = cu;
|
||||
COM_LoadFile (path, 3);
|
||||
QFS_LoadFile (path, 3);
|
||||
}
|
||||
|
||||
// uses temp hunk if larger than bufsize
|
||||
byte *
|
||||
COM_LoadStackFile (const char *path, void *buffer, int bufsize)
|
||||
QFS_LoadStackFile (const char *path, void *buffer, int bufsize)
|
||||
{
|
||||
byte *buf;
|
||||
|
||||
loadbuf = (byte *) buffer;
|
||||
loadsize = bufsize;
|
||||
buf = COM_LoadFile (path, 4);
|
||||
buf = QFS_LoadFile (path, 4);
|
||||
|
||||
return buf;
|
||||
}
|
||||
|
||||
/*
|
||||
COM_LoadPackFile
|
||||
QFS_LoadPackFile
|
||||
|
||||
Takes an explicit (not game tree related) path to a pak file.
|
||||
|
||||
|
@ -921,7 +921,7 @@ COM_LoadStackFile (const char *path, void *buffer, int bufsize)
|
|||
of the list so they override previous pack files.
|
||||
*/
|
||||
static pack_t *
|
||||
COM_LoadPackFile (char *packfile)
|
||||
QFS_LoadPackFile (char *packfile)
|
||||
{
|
||||
pack_t *pack = pack_open (packfile);
|
||||
|
||||
|
@ -968,7 +968,7 @@ qstrcmp (char **os1, char **os2)
|
|||
}
|
||||
|
||||
static void
|
||||
COM_LoadGameDirectory (const char *dir)
|
||||
QFS_LoadGameDirectory (const char *dir)
|
||||
{
|
||||
searchpath_t *search;
|
||||
pack_t *pak;
|
||||
|
@ -977,13 +977,13 @@ COM_LoadGameDirectory (const char *dir)
|
|||
char **pakfiles = NULL;
|
||||
int i = 0, bufsize = 0, count = 0;
|
||||
|
||||
Sys_DPrintf ("COM_LoadGameDirectory (\"%s\")\n", dir);
|
||||
Sys_DPrintf ("QFS_LoadGameDirectory (\"%s\")\n", dir);
|
||||
|
||||
pakfiles = calloc (1, FBLOCK_SIZE * sizeof (char *));
|
||||
|
||||
bufsize += FBLOCK_SIZE;
|
||||
if (!pakfiles)
|
||||
goto COM_LoadGameDirectory_free;
|
||||
goto QFS_LoadGameDirectory_free;
|
||||
|
||||
for (i = 0; i < bufsize; i++) {
|
||||
pakfiles[i] = NULL;
|
||||
|
@ -991,7 +991,7 @@ COM_LoadGameDirectory (const char *dir)
|
|||
|
||||
dir_ptr = opendir (dir);
|
||||
if (!dir_ptr)
|
||||
goto COM_LoadGameDirectory_free;
|
||||
goto QFS_LoadGameDirectory_free;
|
||||
|
||||
while ((dirent = readdir (dir_ptr))) {
|
||||
if (!fnmatch ("*.pak", dirent->d_name, 0)) {
|
||||
|
@ -1000,14 +1000,14 @@ COM_LoadGameDirectory (const char *dir)
|
|||
pakfiles = realloc (pakfiles, bufsize * sizeof (char *));
|
||||
|
||||
if (!pakfiles)
|
||||
goto COM_LoadGameDirectory_free;
|
||||
goto QFS_LoadGameDirectory_free;
|
||||
for (i = count; i < bufsize; i++)
|
||||
pakfiles[i] = NULL;
|
||||
}
|
||||
|
||||
pakfiles[count] = malloc (FNAME_SIZE);
|
||||
if (!pakfiles[count])
|
||||
Sys_Error ("COM_LoadGameDirectory: MemoryAllocationFailure");
|
||||
Sys_Error ("QFS_LoadGameDirectory: MemoryAllocationFailure");
|
||||
snprintf (pakfiles[count], FNAME_SIZE - 1, "%s/%s", dir,
|
||||
dirent->d_name);
|
||||
pakfiles[count][FNAME_SIZE - 1] = '\0';
|
||||
|
@ -1022,32 +1022,32 @@ COM_LoadGameDirectory (const char *dir)
|
|||
(int (*)(const void *, const void *)) qstrcmp);
|
||||
|
||||
for (i = 0; i < count; i++) {
|
||||
pak = COM_LoadPackFile (pakfiles[i]);
|
||||
pak = QFS_LoadPackFile (pakfiles[i]);
|
||||
|
||||
if (!pak) {
|
||||
Sys_Error (va ("Bad pakfile %s!!", pakfiles[i]));
|
||||
} else {
|
||||
search = calloc (1, sizeof (searchpath_t));
|
||||
search->pack = pak;
|
||||
search->next = com_searchpaths;
|
||||
com_searchpaths = search;
|
||||
search->next = qfs_searchpaths;
|
||||
qfs_searchpaths = search;
|
||||
}
|
||||
}
|
||||
|
||||
COM_LoadGameDirectory_free:
|
||||
QFS_LoadGameDirectory_free:
|
||||
for (i = 0; i < count; i++)
|
||||
free (pakfiles[i]);
|
||||
free (pakfiles);
|
||||
}
|
||||
|
||||
/*
|
||||
COM_AddDirectory
|
||||
QFS_AddDirectory
|
||||
|
||||
Sets com_gamedir, adds the directory to the head of the path,
|
||||
Sets qfs_gamedir_path, adds the directory to the head of the path,
|
||||
then loads and adds pak1.pak pak2.pak ...
|
||||
*/
|
||||
static void
|
||||
COM_AddDirectory (const char *dir)
|
||||
QFS_AddDirectory (const char *dir)
|
||||
{
|
||||
searchpath_t *search;
|
||||
char *p;
|
||||
|
@ -1057,43 +1057,43 @@ COM_AddDirectory (const char *dir)
|
|||
dir = e_dir;
|
||||
|
||||
if ((p = strrchr (dir, '/')) != NULL) {
|
||||
strcpy (gamedirfile, ++p);
|
||||
strcpy (com_gamedir, dir);
|
||||
strcpy (qfs_gamedir_file, ++p);
|
||||
strcpy (qfs_gamedir_path, dir);
|
||||
} else {
|
||||
strcpy (gamedirfile, dir);
|
||||
strcpy (com_gamedir, va ("%s/%s", fs_userpath->string, dir));
|
||||
strcpy (qfs_gamedir_file, dir);
|
||||
strcpy (qfs_gamedir_path, va ("%s/%s", fs_userpath->string, dir));
|
||||
}
|
||||
|
||||
// add the directory to the search path
|
||||
search = calloc (1, sizeof (searchpath_t));
|
||||
strcpy (search->filename, dir);
|
||||
search->next = com_searchpaths;
|
||||
com_searchpaths = search;
|
||||
search->next = qfs_searchpaths;
|
||||
qfs_searchpaths = search;
|
||||
|
||||
// add any pak files in the format pak0.pak pak1.pak, ...
|
||||
COM_LoadGameDirectory (dir);
|
||||
QFS_LoadGameDirectory (dir);
|
||||
}
|
||||
|
||||
static void
|
||||
COM_AddGameDirectory (const char *dir)
|
||||
QFS_AddGameDirectory (const char *dir)
|
||||
{
|
||||
if (!*dir)
|
||||
return;
|
||||
Sys_DPrintf ("COM_AddGameDirectory (\"%s/%s\")\n",
|
||||
Sys_DPrintf ("QFS_AddGameDirectory (\"%s/%s\")\n",
|
||||
fs_sharepath->string, dir);
|
||||
|
||||
if (strcmp (fs_sharepath->string, fs_userpath->string) != 0)
|
||||
COM_AddDirectory (va ("%s/%s", fs_sharepath->string, dir));
|
||||
COM_AddDirectory (va ("%s/%s", fs_userpath->string, dir));
|
||||
QFS_AddDirectory (va ("%s/%s", fs_sharepath->string, dir));
|
||||
QFS_AddDirectory (va ("%s/%s", fs_userpath->string, dir));
|
||||
}
|
||||
|
||||
/*
|
||||
COM_Gamedir
|
||||
QFS_Gamedir
|
||||
|
||||
Sets the gamedir and path to a different directory.
|
||||
*/
|
||||
void
|
||||
COM_Gamedir (const char *dir)
|
||||
QFS_Gamedir (const char *dir)
|
||||
{
|
||||
const char *list[2] = {dir, 0};
|
||||
|
||||
|
@ -1103,11 +1103,11 @@ COM_Gamedir (const char *dir)
|
|||
}
|
||||
|
||||
void
|
||||
COM_CreateGameDirectory (const char *gamename)
|
||||
QFS_CreateGameDirectory (const char *gamename)
|
||||
{
|
||||
if (strcmp (fs_userpath->string, "."))
|
||||
COM_CreatePath (va ("%s/%s/dummy", fs_userpath->string, gamename));
|
||||
COM_AddGameDirectory (gamename);
|
||||
QFS_CreatePath (va ("%s/%s/dummy", fs_userpath->string, gamename));
|
||||
QFS_AddGameDirectory (gamename);
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -1123,6 +1123,8 @@ QFS_Init (const char *game)
|
|||
fs_dirconf = Cvar_Get ("fs_dirconf", "", CVAR_ROM, NULL,
|
||||
"full path to gamedir.conf FIXME");
|
||||
|
||||
Cmd_AddCommand ("path", QFS_Path_f, "Show what paths Quake is using");
|
||||
|
||||
qfs_load_config ();
|
||||
|
||||
qfs_game = game;
|
||||
|
@ -1151,12 +1153,12 @@ QFS_Init (const char *game)
|
|||
free (gamedirs);
|
||||
free (list);
|
||||
} else {
|
||||
COM_Gamedir ("");
|
||||
QFS_Gamedir ("");
|
||||
}
|
||||
}
|
||||
|
||||
const char *
|
||||
COM_SkipPath (const char *pathname)
|
||||
QFS_SkipPath (const char *pathname)
|
||||
{
|
||||
const char *last;
|
||||
|
||||
|
@ -1170,7 +1172,7 @@ COM_SkipPath (const char *pathname)
|
|||
}
|
||||
|
||||
void
|
||||
COM_StripExtension (const char *in, char *out)
|
||||
QFS_StripExtension (const char *in, char *out)
|
||||
{
|
||||
while (*in && *in != '.')
|
||||
*out++ = *in++;
|
||||
|
@ -1178,7 +1180,7 @@ COM_StripExtension (const char *in, char *out)
|
|||
}
|
||||
|
||||
const char *
|
||||
COM_FileExtension (const char *in)
|
||||
QFS_FileExtension (const char *in)
|
||||
{
|
||||
while (*in && *in != '.')
|
||||
in++;
|
||||
|
@ -1186,7 +1188,7 @@ COM_FileExtension (const char *in)
|
|||
}
|
||||
|
||||
void
|
||||
COM_DefaultExtension (char *path, const char *extension)
|
||||
QFS_DefaultExtension (char *path, const char *extension)
|
||||
{
|
||||
char *src;
|
||||
|
||||
|
@ -1204,7 +1206,7 @@ COM_DefaultExtension (char *path, const char *extension)
|
|||
}
|
||||
|
||||
int
|
||||
COM_NextFilename (char *filename, const char *prefix, const char *ext)
|
||||
QFS_NextFilename (char *filename, const char *prefix, const char *ext)
|
||||
{
|
||||
char *digits;
|
||||
char checkname[MAX_OSPATH];
|
||||
|
@ -1220,7 +1222,7 @@ COM_NextFilename (char *filename, const char *prefix, const char *ext)
|
|||
digits[0] = i / 100 + '0';
|
||||
digits[1] = i / 10 % 10 + '0';
|
||||
digits[2] = i % 10 + '0';
|
||||
snprintf (checkname, sizeof (checkname), "%s/%s", com_gamedir,
|
||||
snprintf (checkname, sizeof (checkname), "%s/%s", qfs_gamedir_path,
|
||||
filename);
|
||||
if (Sys_FileTime (checkname) == -1)
|
||||
return 1; // file doesn't exist
|
||||
|
|
|
@ -187,7 +187,7 @@ enum e_pathtype
|
|||
Sys_PathType (const char *path)
|
||||
{
|
||||
enum e_pathtype type;
|
||||
char *comp = COM_CompressPath (path);
|
||||
char *comp = QFS_CompressPath (path);
|
||||
if (comp[0] == '/'
|
||||
#ifdef WIN32
|
||||
|| (comp[0] && comp[1] == ':')
|
||||
|
|
|
@ -125,8 +125,8 @@ LoadTGA (QFile *fin)
|
|||
tex_t *tex;
|
||||
|
||||
targa_mark = Hunk_LowMark ();
|
||||
targa = Hunk_AllocName (com_filesize, "TGA");
|
||||
Qread (fin, targa, com_filesize);
|
||||
targa = Hunk_AllocName (qfs_filesize, "TGA");
|
||||
Qread (fin, targa, qfs_filesize);
|
||||
|
||||
targa->colormap_index = LittleShort (targa->colormap_index);
|
||||
targa->colormap_length = LittleShort (targa->colormap_length);
|
||||
|
@ -244,6 +244,6 @@ WriteTGAfile (const char *tganame, byte *data, int width, int height)
|
|||
header.height = LittleShort (height);
|
||||
header.pixel_size = 24;
|
||||
|
||||
COM_WriteBuffers (tganame, 2, &header, sizeof (header), data,
|
||||
QFS_WriteBuffers (tganame, 2, &header, sizeof (header), data,
|
||||
width * height * 3);
|
||||
}
|
||||
|
|
|
@ -84,7 +84,7 @@ W_LoadWadFile (const char *filename)
|
|||
unsigned int i;
|
||||
int infotableofs;
|
||||
|
||||
wad_base = COM_LoadHunkFile (filename);
|
||||
wad_base = QFS_LoadHunkFile (filename);
|
||||
if (!wad_base)
|
||||
Sys_Error ("W_LoadWadFile: unable to load %s", filename);
|
||||
|
||||
|
|
|
@ -177,7 +177,7 @@ Draw_PicFromWad (const char *name)
|
|||
gl = (glpic_t *) p->data;
|
||||
|
||||
snprintf (filename, sizeof (filename), "%s.tga", name);
|
||||
COM_FOpenFile (filename, &f);
|
||||
QFS_FOpenFile (filename, &f);
|
||||
if (f) {
|
||||
targa = LoadTGA (f);
|
||||
Qclose (f);
|
||||
|
@ -225,7 +225,7 @@ Draw_CachePic (const char *path, qboolean alpha)
|
|||
Sys_Error ("menu_numcachepics == MAX_CACHED_PICS");
|
||||
|
||||
// Load the picture..
|
||||
dat = (qpic_t *) COM_LoadTempFile (path);
|
||||
dat = (qpic_t *) QFS_LoadTempFile (path);
|
||||
if (!dat)
|
||||
Sys_Error ("Draw_CachePic: failed to load %s", path);
|
||||
|
||||
|
@ -245,7 +245,7 @@ Draw_CachePic (const char *path, qboolean alpha)
|
|||
gl = (glpic_t *) pic->pic.data;
|
||||
|
||||
snprintf (filename, sizeof (filename), "%s.tga", path);
|
||||
COM_FOpenFile (filename, &f);
|
||||
QFS_FOpenFile (filename, &f);
|
||||
if (f) {
|
||||
targa = LoadTGA (f);
|
||||
Qclose (f);
|
||||
|
|
|
@ -183,7 +183,7 @@ R_ReadPointFile_f (void)
|
|||
snprintf (name, sizeof (name), "%s.pts", mapname);
|
||||
free (mapname);
|
||||
|
||||
COM_FOpenFile (name, &f);
|
||||
QFS_FOpenFile (name, &f);
|
||||
if (!f) {
|
||||
Con_Printf ("couldn't open %s\n", name);
|
||||
return;
|
||||
|
|
|
@ -88,39 +88,39 @@ R_Envmap_f (void)
|
|||
GL_BeginRendering (&glx, &gly, &glwidth, &glheight);
|
||||
R_RenderView ();
|
||||
qfglReadPixels (0, 0, 256, 256, GL_RGBA, GL_UNSIGNED_BYTE, buffer);
|
||||
COM_WriteFile ("env0.rgb", buffer, sizeof (buffer));
|
||||
QFS_WriteFile ("env0.rgb", buffer, sizeof (buffer));
|
||||
|
||||
r_refdef.viewangles[1] = 90;
|
||||
GL_BeginRendering (&glx, &gly, &glwidth, &glheight);
|
||||
R_RenderView ();
|
||||
qfglReadPixels (0, 0, 256, 256, GL_RGBA, GL_UNSIGNED_BYTE, buffer);
|
||||
COM_WriteFile ("env1.rgb", buffer, sizeof (buffer));
|
||||
QFS_WriteFile ("env1.rgb", buffer, sizeof (buffer));
|
||||
|
||||
r_refdef.viewangles[1] = 180;
|
||||
GL_BeginRendering (&glx, &gly, &glwidth, &glheight);
|
||||
R_RenderView ();
|
||||
qfglReadPixels (0, 0, 256, 256, GL_RGBA, GL_UNSIGNED_BYTE, buffer);
|
||||
COM_WriteFile ("env2.rgb", buffer, sizeof (buffer));
|
||||
QFS_WriteFile ("env2.rgb", buffer, sizeof (buffer));
|
||||
|
||||
r_refdef.viewangles[1] = 270;
|
||||
GL_BeginRendering (&glx, &gly, &glwidth, &glheight);
|
||||
R_RenderView ();
|
||||
qfglReadPixels (0, 0, 256, 256, GL_RGBA, GL_UNSIGNED_BYTE, buffer);
|
||||
COM_WriteFile ("env3.rgb", buffer, sizeof (buffer));
|
||||
QFS_WriteFile ("env3.rgb", buffer, sizeof (buffer));
|
||||
|
||||
r_refdef.viewangles[0] = -90;
|
||||
r_refdef.viewangles[1] = 0;
|
||||
GL_BeginRendering (&glx, &gly, &glwidth, &glheight);
|
||||
R_RenderView ();
|
||||
qfglReadPixels (0, 0, 256, 256, GL_RGBA, GL_UNSIGNED_BYTE, buffer);
|
||||
COM_WriteFile ("env4.rgb", buffer, sizeof (buffer));
|
||||
QFS_WriteFile ("env4.rgb", buffer, sizeof (buffer));
|
||||
|
||||
r_refdef.viewangles[0] = 90;
|
||||
r_refdef.viewangles[1] = 0;
|
||||
GL_BeginRendering (&glx, &gly, &glwidth, &glheight);
|
||||
R_RenderView ();
|
||||
qfglReadPixels (0, 0, 256, 256, GL_RGBA, GL_UNSIGNED_BYTE, buffer);
|
||||
COM_WriteFile ("env5.rgb", buffer, sizeof (buffer));
|
||||
QFS_WriteFile ("env5.rgb", buffer, sizeof (buffer));
|
||||
|
||||
envmap = false;
|
||||
qfglDrawBuffer (GL_BACK);
|
||||
|
|
|
@ -196,7 +196,7 @@ SCR_ScreenShot_f (void)
|
|||
char pcxname[MAX_OSPATH];
|
||||
|
||||
// find a file name to save it to
|
||||
if (!COM_NextFilename (pcxname, "qf", ".tga")) {
|
||||
if (!QFS_NextFilename (pcxname, "qf", ".tga")) {
|
||||
Con_Printf ("SCR_ScreenShot_f: Couldn't create a TGA file\n");
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -83,13 +83,13 @@ R_LoadSkys (const char *skyname)
|
|||
|
||||
qfglBindTexture (GL_TEXTURE_2D, SKY_TEX + i);
|
||||
snprintf (name, sizeof (name), "env/%s%s.tga", skyname, suf[i]);
|
||||
COM_FOpenFile (name, &f);
|
||||
QFS_FOpenFile (name, &f);
|
||||
if (!f) {
|
||||
Con_DPrintf ("Couldn't load %s\n", name);
|
||||
// also look in gfx/env, where Darkplaces looks for skies
|
||||
snprintf (name, sizeof (name), "gfx/env/%s%s.tga", skyname,
|
||||
suf[i]);
|
||||
COM_FOpenFile (name, &f);
|
||||
QFS_FOpenFile (name, &f);
|
||||
if (!f) {
|
||||
Con_DPrintf ("Couldn't load %s\n", name);
|
||||
skyloaded = false;
|
||||
|
|
|
@ -112,7 +112,7 @@ Draw_CachePic (const char *path, qboolean alpha)
|
|||
return dat;
|
||||
|
||||
// load the pic from disk
|
||||
COM_LoadCacheFile (path, &pic->cache);
|
||||
QFS_LoadCacheFile (path, &pic->cache);
|
||||
|
||||
dat = (qpic_t *) pic->cache.data;
|
||||
if (!dat) {
|
||||
|
|
|
@ -237,7 +237,7 @@ SCR_ScreenShot_f (void)
|
|||
int pcx_len;
|
||||
|
||||
// find a file name to save it to
|
||||
if (!COM_NextFilename (pcxname, "qf", ".pcx")) {
|
||||
if (!QFS_NextFilename (pcxname, "qf", ".pcx")) {
|
||||
Con_Printf ("SCR_ScreenShot_f: Couldn't create a PCX");
|
||||
return;
|
||||
}
|
||||
|
@ -248,7 +248,7 @@ SCR_ScreenShot_f (void)
|
|||
// save the pcx file
|
||||
pcx = EncodePCX (vid.buffer, vid.width, vid.height, vid.rowbytes,
|
||||
vid.basepal, false, &pcx_len);
|
||||
COM_WriteFile (pcxname, pcx, pcx_len);
|
||||
QFS_WriteFile (pcxname, pcx, pcx_len);
|
||||
|
||||
|
||||
// for adapters that can't stay mapped in for linear writes all the time
|
||||
|
|
|
@ -80,7 +80,7 @@ R_ReadPointFile_f (void)
|
|||
|
||||
// FIXME snprintf (name, sizeof (name), "maps/%s.pts", sv.name);
|
||||
|
||||
COM_FOpenFile (name, &f);
|
||||
QFS_FOpenFile (name, &f);
|
||||
if (!f) {
|
||||
Con_Printf ("couldn't open %s\n", name);
|
||||
return;
|
||||
|
|
|
@ -112,7 +112,7 @@ Draw_CachePic (const char *path, qboolean alpha)
|
|||
return dat;
|
||||
|
||||
// load the pic from disk
|
||||
COM_LoadCacheFile (path, &pic->cache);
|
||||
QFS_LoadCacheFile (path, &pic->cache);
|
||||
|
||||
dat = (qpic_t *) pic->cache.data;
|
||||
if (!dat) {
|
||||
|
|
|
@ -248,7 +248,7 @@ SCR_ScreenShot_f (void)
|
|||
int pcx_len;
|
||||
|
||||
// find a file name to save it to
|
||||
if (!COM_NextFilename (pcxname, "qf", ".pcx")) {
|
||||
if (!QFS_NextFilename (pcxname, "qf", ".pcx")) {
|
||||
Con_Printf ("SCR_ScreenShot_f: Couldn't create a PCX");
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -80,7 +80,7 @@ R_ReadPointFile_f (void)
|
|||
|
||||
// FIXME snprintf (name, sizeof (name), "maps/%s.pts", sv.name);
|
||||
|
||||
COM_FOpenFile (name, &f);
|
||||
QFS_FOpenFile (name, &f);
|
||||
if (!f) {
|
||||
Con_Printf ("couldn't open %s\n", name);
|
||||
return;
|
||||
|
|
|
@ -213,7 +213,7 @@ VID_SetPalette (unsigned char *palette)
|
|||
return;
|
||||
palflag = true;
|
||||
|
||||
COM_FOpenFile ("glquake/15to8.pal", &f);
|
||||
QFS_FOpenFile ("glquake/15to8.pal", &f);
|
||||
if (f) {
|
||||
Qread (f, d_15to8table, 1 << 15);
|
||||
Qclose (f);
|
||||
|
@ -243,8 +243,8 @@ VID_SetPalette (unsigned char *palette)
|
|||
}
|
||||
d_15to8table[i] = k;
|
||||
}
|
||||
snprintf (s, sizeof (s), "%s/glquake/15to8.pal", com_gamedir);
|
||||
COM_CreatePath (s);
|
||||
snprintf (s, sizeof (s), "%s/glquake/15to8.pal", qfs_gamedir_path);
|
||||
QFS_CreatePath (s);
|
||||
if ((f = Qopen (s, "wb")) != NULL) {
|
||||
Qwrite (f, d_15to8table, 1 << 15);
|
||||
Qclose (f);
|
||||
|
|
|
@ -253,7 +253,7 @@ CL_Record_f (void)
|
|||
} else
|
||||
track = -1;
|
||||
|
||||
snprintf (name, sizeof (name), "%s/%s", com_gamedir, Cmd_Argv (1));
|
||||
snprintf (name, sizeof (name), "%s/%s", qfs_gamedir_path, Cmd_Argv (1));
|
||||
|
||||
// start the map up
|
||||
//
|
||||
|
@ -264,13 +264,13 @@ CL_Record_f (void)
|
|||
//
|
||||
#ifdef HAVE_ZLIB
|
||||
if (demo_gzip->int_val) {
|
||||
COM_DefaultExtension (name, ".dem.gz");
|
||||
QFS_DefaultExtension (name, ".dem.gz");
|
||||
cls.demofile = Qopen (name, va ("wbz%d",
|
||||
bound (1, demo_gzip->int_val, 9)));
|
||||
} else
|
||||
#endif
|
||||
{
|
||||
COM_DefaultExtension (name, ".dem");
|
||||
QFS_DefaultExtension (name, ".dem");
|
||||
cls.demofile = Qopen (name, "wb");
|
||||
}
|
||||
|
||||
|
@ -302,10 +302,10 @@ CL_StartDemo (void)
|
|||
// open the demo file
|
||||
//
|
||||
strncpy (name, demoname, sizeof (name));
|
||||
COM_DefaultExtension (name, ".dem");
|
||||
QFS_DefaultExtension (name, ".dem");
|
||||
|
||||
Con_Printf ("Playing demo from %s.\n", name);
|
||||
COM_FOpenFile (name, &cls.demofile);
|
||||
QFS_FOpenFile (name, &cls.demofile);
|
||||
if (!cls.demofile) {
|
||||
Con_Printf ("ERROR: couldn't open.\n");
|
||||
cls.demonum = -1; // stop demo loop
|
||||
|
|
|
@ -225,9 +225,9 @@ map_cfg (const char *mapname, int all)
|
|||
char *name = malloc (strlen (mapname) + 4 + 1);
|
||||
QFile *f;
|
||||
|
||||
COM_StripExtension (mapname, name);
|
||||
QFS_StripExtension (mapname, name);
|
||||
strcat (name, ".cfg");
|
||||
COM_FOpenFile (name, &f);
|
||||
QFS_FOpenFile (name, &f);
|
||||
if (f) {
|
||||
Qclose (f);
|
||||
Cmd_Exec_File (host_cbuf, name, 1);
|
||||
|
|
|
@ -59,7 +59,7 @@ COM_CheckRegistered (void)
|
|||
unsigned short check[128];
|
||||
QFile *h;
|
||||
|
||||
COM_FOpenFile ("gfx/pop.lmp", &h);
|
||||
QFS_FOpenFile ("gfx/pop.lmp", &h);
|
||||
static_registered = 0;
|
||||
|
||||
if (h) {
|
||||
|
@ -80,7 +80,6 @@ COM_Init (void)
|
|||
registered = Cvar_Get ("registered", "0", CVAR_NONE, NULL,
|
||||
"Is the game the registered version. 1 yes 0 no");
|
||||
cmdline = Cvar_Get ("cmdline", "0", CVAR_SERVERINFO, Cvar_Info, "None");
|
||||
Cmd_AddCommand ("path", COM_Path_f, "Show what paths Quake is using");
|
||||
|
||||
COM_CheckRegistered ();
|
||||
}
|
||||
|
|
|
@ -47,17 +47,17 @@ Game_Init (void)
|
|||
// FIXME: make this dependant on QF metadata in the mission packs
|
||||
standard_quake = true;
|
||||
if ((i = COM_CheckParm ("-hipnotic"))) {
|
||||
COM_CreateGameDirectory ("hipnotic");
|
||||
QFS_CreateGameDirectory ("hipnotic");
|
||||
standard_quake = false;
|
||||
hipnotic = true;
|
||||
}
|
||||
if ((i = COM_CheckParm ("-rogue"))) {
|
||||
COM_CreateGameDirectory ("rogue");
|
||||
QFS_CreateGameDirectory ("rogue");
|
||||
standard_quake = false;
|
||||
rogue = true;
|
||||
}
|
||||
if ((i = COM_CheckParm ("-abyss"))) {
|
||||
COM_CreateGameDirectory ("abyss");
|
||||
QFS_CreateGameDirectory ("abyss");
|
||||
abyss = true;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -285,7 +285,7 @@ Host_WriteConfiguration (void)
|
|||
// dedicated servers initialize the host but don't parse and set the
|
||||
// config.cfg cvars
|
||||
if (host_initialized && !isDedicated && cl_writecfg->int_val) {
|
||||
char *path = va ("%s/config.cfg", com_gamedir);
|
||||
char *path = va ("%s/config.cfg", qfs_gamedir_path);
|
||||
f = Qopen (path, "w");
|
||||
if (!f) {
|
||||
Con_Printf ("Couldn't write config.cfg.\n");
|
||||
|
@ -798,7 +798,7 @@ check_quakerc (void)
|
|||
int ret = 1;
|
||||
QFile *f;
|
||||
|
||||
COM_FOpenFile ("quake.rc", &f);
|
||||
QFS_FOpenFile ("quake.rc", &f);
|
||||
if (!f)
|
||||
return 1;
|
||||
while ((l = Qgetline (f))) {
|
||||
|
@ -952,10 +952,10 @@ Host_Init (void)
|
|||
Con_Printf ("%4.1f megabyte heap\n", host_mem_size->value);
|
||||
|
||||
if (cls.state != ca_dedicated) {
|
||||
host_basepal = (byte *) COM_LoadHunkFile ("gfx/palette.lmp");
|
||||
host_basepal = (byte *) QFS_LoadHunkFile ("gfx/palette.lmp");
|
||||
if (!host_basepal)
|
||||
Sys_Error ("Couldn't load gfx/palette.lmp");
|
||||
vid_colormap = (byte *) COM_LoadHunkFile ("gfx/colormap.lmp");
|
||||
vid_colormap = (byte *) QFS_LoadHunkFile ("gfx/colormap.lmp");
|
||||
if (!vid_colormap)
|
||||
Sys_Error ("Couldn't load gfx/colormap.lmp");
|
||||
|
||||
|
|
|
@ -277,7 +277,7 @@ Host_Map_f (void)
|
|||
|
||||
// check to make sure the level exists
|
||||
expanded = va ("maps/%s.bsp", Cmd_Argv (1));
|
||||
COM_FOpenFile (expanded, &f);
|
||||
QFS_FOpenFile (expanded, &f);
|
||||
if (!f) {
|
||||
Con_Printf ("Can't find %s\n", expanded);
|
||||
return;
|
||||
|
@ -465,8 +465,8 @@ Host_Savegame_f (void)
|
|||
}
|
||||
}
|
||||
|
||||
snprintf (name, sizeof (name), "%s/%s", com_gamedir, Cmd_Argv (1));
|
||||
COM_DefaultExtension (name, ".sav");
|
||||
snprintf (name, sizeof (name), "%s/%s", qfs_gamedir_path, Cmd_Argv (1));
|
||||
QFS_DefaultExtension (name, ".sav");
|
||||
|
||||
Con_Printf ("Saving game to %s...\n", name);
|
||||
f = Qopen (name, "w");
|
||||
|
@ -528,8 +528,8 @@ Host_Loadgame_f (void)
|
|||
|
||||
cls.demonum = -1; // stop demo loop in case this fails
|
||||
|
||||
snprintf (name, sizeof (name), "%s/%s", com_gamedir, Cmd_Argv (1));
|
||||
COM_DefaultExtension (name, ".sav");
|
||||
snprintf (name, sizeof (name), "%s/%s", qfs_gamedir_path, Cmd_Argv (1));
|
||||
QFS_DefaultExtension (name, ".sav");
|
||||
|
||||
// we can't call SCR_BeginLoadingPlaque, because too much stack space has
|
||||
// been used. The menu calls it before stuffing loadgame command
|
||||
|
|
|
@ -140,7 +140,7 @@ locs_load (const char *filename)
|
|||
int templength = 0;
|
||||
|
||||
snprintf(tmp,sizeof(tmp), "maps/%s",filename);
|
||||
templength = _COM_FOpenFile (tmp, &file, foundname, 1);
|
||||
templength = _QFS_FOpenFile (tmp, &file, foundname, 1);
|
||||
if (!file) {
|
||||
Con_Printf ("Couldn't load %s\n", tmp);
|
||||
return;
|
||||
|
@ -162,7 +162,7 @@ locs_load (const char *filename)
|
|||
t2 = strrchr (t1, '\n');
|
||||
if (t2) {
|
||||
t2[0] = '\0';
|
||||
// handle dos format lines (COM_FOpenFile is binary only)
|
||||
// handle dos format lines (QFS_FOpenFile is binary only)
|
||||
// and unix is effectively binary only anyway
|
||||
while (t2 > t1 && t2[-1] == '\r') {
|
||||
t2[-1] = '\0';
|
||||
|
|
|
@ -104,7 +104,7 @@ Skin_Find (player_info_t *sc)
|
|||
if (!allskins[0] && (!s || !strcaseequal (name, s)))
|
||||
Info_SetValueForKey (sc->userinfo, "skin", name, 1);
|
||||
|
||||
COM_StripExtension (name, name);
|
||||
QFS_StripExtension (name, name);
|
||||
|
||||
skin = Hash_Find (skin_hash, name);
|
||||
if (skin) {
|
||||
|
@ -163,11 +163,11 @@ Skin_Cache (skin_t *skin)
|
|||
|
||||
// load the pic from disk
|
||||
snprintf (name, sizeof (name), "skins/%s.pcx", skin->name);
|
||||
COM_FOpenFile (name, &file);
|
||||
QFS_FOpenFile (name, &file);
|
||||
if (!file) {
|
||||
Con_Printf ("Couldn't load skin %s\n", name);
|
||||
snprintf (name, sizeof (name), "skins/%s.pcx", baseskin->string);
|
||||
COM_FOpenFile (name, &file);
|
||||
QFS_FOpenFile (name, &file);
|
||||
if (!file) {
|
||||
skin->failedload = true;
|
||||
return NULL;
|
||||
|
|
|
@ -539,22 +539,22 @@ CL_Record (const char *argv1)
|
|||
if (mapname[k] == '.')
|
||||
mapname[k] = '\0';
|
||||
|
||||
snprintf (name, sizeof (name), "%s/%s-%s", com_gamedir,
|
||||
snprintf (name, sizeof (name), "%s/%s-%s", qfs_gamedir_path,
|
||||
timestring, mapname);
|
||||
} else {
|
||||
snprintf (name, sizeof (name), "%s/%s", com_gamedir, argv1);
|
||||
snprintf (name, sizeof (name), "%s/%s", qfs_gamedir_path, argv1);
|
||||
}
|
||||
|
||||
// open the demo file
|
||||
#ifdef HAVE_ZLIB
|
||||
if (demo_gzip->int_val) {
|
||||
COM_DefaultExtension (name, ".qwd.gz");
|
||||
QFS_DefaultExtension (name, ".qwd.gz");
|
||||
cls.demofile = Qopen (name, va ("wbz%d",
|
||||
bound (1, demo_gzip->int_val, 9)));
|
||||
} else
|
||||
#endif
|
||||
{
|
||||
COM_DefaultExtension (name, ".qwd");
|
||||
QFS_DefaultExtension (name, ".qwd");
|
||||
cls.demofile = Qopen (name, "wb");
|
||||
}
|
||||
if (!cls.demofile) {
|
||||
|
@ -577,7 +577,7 @@ CL_Record (const char *argv1)
|
|||
MSG_WriteByte (&buf, svc_serverdata);
|
||||
MSG_WriteLong (&buf, PROTOCOL_VERSION);
|
||||
MSG_WriteLong (&buf, cl.servercount);
|
||||
MSG_WriteString (&buf, gamedirfile);
|
||||
MSG_WriteString (&buf, qfs_gamedir_file);
|
||||
|
||||
if (cl.spectator)
|
||||
MSG_WriteByte (&buf, cl.playernum | 128);
|
||||
|
@ -844,10 +844,10 @@ CL_ReRecord_f (void)
|
|||
if (cls.demorecording)
|
||||
CL_Stop_f ();
|
||||
|
||||
snprintf (name, sizeof (name), "%s/%s", com_gamedir, Cmd_Argv (1));
|
||||
snprintf (name, sizeof (name), "%s/%s", qfs_gamedir_path, Cmd_Argv (1));
|
||||
|
||||
// open the demo file
|
||||
COM_DefaultExtension (name, ".qwd");
|
||||
QFS_DefaultExtension (name, ".qwd");
|
||||
|
||||
cls.demofile = Qopen (name, "wb");
|
||||
if (!cls.demofile) {
|
||||
|
@ -869,10 +869,10 @@ CL_StartDemo (void)
|
|||
|
||||
// open the demo file
|
||||
strncpy (name, demoname, sizeof (name));
|
||||
COM_DefaultExtension (name, ".qwd");
|
||||
QFS_DefaultExtension (name, ".qwd");
|
||||
|
||||
Con_Printf ("Playing demo from %s.\n", name);
|
||||
COM_FOpenFile (name, &cls.demofile);
|
||||
QFS_FOpenFile (name, &cls.demofile);
|
||||
if (!cls.demofile) {
|
||||
Con_Printf ("ERROR: couldn't open.\n");
|
||||
cls.demonum = -1; // stop demo loop
|
||||
|
@ -880,7 +880,7 @@ CL_StartDemo (void)
|
|||
}
|
||||
|
||||
cls.demoplayback = true;
|
||||
if (strequal (COM_FileExtension (name), ".mvd")) {
|
||||
if (strequal (QFS_FileExtension (name), ".mvd")) {
|
||||
cls.demoplayback2 = true;
|
||||
Con_Printf ("mvd\n");
|
||||
} else {
|
||||
|
|
|
@ -1072,9 +1072,9 @@ CL_Download_f (void)
|
|||
}
|
||||
|
||||
snprintf (cls.downloadname, sizeof (cls.downloadname), "%s/%s",
|
||||
com_gamedir, Cmd_Argv (1));
|
||||
qfs_gamedir_path, Cmd_Argv (1));
|
||||
|
||||
COM_CreatePath (cls.downloadname);
|
||||
QFS_CreatePath (cls.downloadname);
|
||||
|
||||
strncpy (cls.downloadtempname, cls.downloadname,
|
||||
sizeof (cls.downloadtempname));
|
||||
|
@ -1413,9 +1413,9 @@ Host_WriteConfiguration (void)
|
|||
QFile *f;
|
||||
|
||||
if (host_initialized && cl_writecfg->int_val) {
|
||||
char *path = va ("%s/config.cfg", com_gamedir);
|
||||
char *path = va ("%s/config.cfg", qfs_gamedir_path);
|
||||
|
||||
COM_CreatePath (path);
|
||||
QFS_CreatePath (path);
|
||||
f = Qopen (path, "w");
|
||||
if (!f) {
|
||||
Con_Printf ("Couldn't write config.cfg.\n");
|
||||
|
@ -1601,7 +1601,7 @@ check_quakerc (void)
|
|||
int ret = 1;
|
||||
QFile *f;
|
||||
|
||||
COM_FOpenFile ("quake.rc", &f);
|
||||
QFS_FOpenFile ("quake.rc", &f);
|
||||
if (!f)
|
||||
return 1;
|
||||
while ((l = Qgetline (f))) {
|
||||
|
@ -1759,10 +1759,10 @@ Host_Init (void)
|
|||
|
||||
Con_Printf ("%4.1f megabyte heap.\n", cl_mem_size->value);
|
||||
|
||||
host_basepal = (byte *) COM_LoadHunkFile ("gfx/palette.lmp");
|
||||
host_basepal = (byte *) QFS_LoadHunkFile ("gfx/palette.lmp");
|
||||
if (!host_basepal)
|
||||
Sys_Error ("Couldn't load gfx/palette.lmp");
|
||||
vid_colormap = (byte *) COM_LoadHunkFile ("gfx/colormap.lmp");
|
||||
vid_colormap = (byte *) QFS_LoadHunkFile ("gfx/colormap.lmp");
|
||||
if (!vid_colormap)
|
||||
Sys_Error ("Couldn't load gfx/colormap.lmp");
|
||||
|
||||
|
|
|
@ -221,7 +221,7 @@ CL_CheckOrDownloadFile (const char *filename)
|
|||
return true;
|
||||
}
|
||||
|
||||
COM_FOpenFile (filename, &f);
|
||||
QFS_FOpenFile (filename, &f);
|
||||
if (f) { // it exists, no need to download
|
||||
Qclose (f);
|
||||
return true;
|
||||
|
@ -241,7 +241,7 @@ CL_CheckOrDownloadFile (const char *filename)
|
|||
|
||||
// download to a temp name, and only rename to the real name when done,
|
||||
// so if interrupted a runt file wont be left
|
||||
COM_StripExtension (cls.downloadname, cls.downloadtempname);
|
||||
QFS_StripExtension (cls.downloadname, cls.downloadtempname);
|
||||
strncat (cls.downloadtempname, ".tmp",
|
||||
sizeof (cls.downloadtempname) - strlen (cls.downloadtempname));
|
||||
|
||||
|
@ -260,9 +260,9 @@ map_cfg (const char *mapname, int all)
|
|||
char *name = malloc (strlen (mapname) + 4 + 1);
|
||||
QFile *f;
|
||||
|
||||
COM_StripExtension (mapname, name);
|
||||
QFS_StripExtension (mapname, name);
|
||||
strcat (name, ".cfg");
|
||||
COM_FOpenFile (name, &f);
|
||||
QFS_FOpenFile (name, &f);
|
||||
if (f) {
|
||||
Qclose (f);
|
||||
Cmd_Exec_File (cl_cbuf, name, 1);
|
||||
|
@ -324,7 +324,7 @@ Model_NextDownload (void)
|
|||
"downloaded.\n\n", cl.model_name[i]);
|
||||
Con_Printf ("You may need to download or purchase a %s client "
|
||||
"pack in order to play on this server.\n\n",
|
||||
gamedirfile);
|
||||
qfs_gamedir_file);
|
||||
CL_Disconnect ();
|
||||
return;
|
||||
}
|
||||
|
@ -492,13 +492,13 @@ CL_ParseDownload (void)
|
|||
if (!qfs_gamedir->skinpath
|
||||
|| !*qfs_gamedir->skinpath
|
||||
|| strncmp (cls.downloadtempname, "skins/", 6))
|
||||
snprintf (name, sizeof (name), "%s/%s", com_gamedir,
|
||||
snprintf (name, sizeof (name), "%s/%s", qfs_gamedir_path,
|
||||
cls.downloadtempname);
|
||||
else
|
||||
snprintf (name, sizeof (name), "%s/%s/%s", fs_userpath->string,
|
||||
qfs_gamedir->skinpath, cls.downloadtempname);
|
||||
|
||||
COM_CreatePath (name);
|
||||
QFS_CreatePath (name);
|
||||
|
||||
cls.download = Qopen (name, "wb");
|
||||
if (!cls.download) {
|
||||
|
@ -535,9 +535,9 @@ CL_ParseDownload (void)
|
|||
if (!qfs_gamedir->skinpath
|
||||
|| !*qfs_gamedir->skinpath
|
||||
|| strncmp (cls.downloadtempname, "skins/", 6)) {
|
||||
snprintf (oldn, sizeof (oldn), "%s/%s", com_gamedir,
|
||||
snprintf (oldn, sizeof (oldn), "%s/%s", qfs_gamedir_path,
|
||||
cls.downloadtempname);
|
||||
snprintf (newn, sizeof (newn), "%s/%s", com_gamedir,
|
||||
snprintf (newn, sizeof (newn), "%s/%s", qfs_gamedir_path,
|
||||
cls.downloadname);
|
||||
} else {
|
||||
snprintf (oldn, sizeof (oldn), "%s/%s/%s", fs_userpath->string,
|
||||
|
@ -679,14 +679,14 @@ CL_ParseServerData (void)
|
|||
// game directory
|
||||
str = MSG_ReadString (net_message);
|
||||
|
||||
if (!strequal (gamedirfile, str)) {
|
||||
if (!strequal (qfs_gamedir_file, str)) {
|
||||
// save current config
|
||||
Host_WriteConfiguration ();
|
||||
cflag = true;
|
||||
Draw_ClearCache ();
|
||||
}
|
||||
|
||||
COM_Gamedir (str);
|
||||
QFS_Gamedir (str);
|
||||
|
||||
// ZOID--run the autoexec.cfg in the gamedir if it exists
|
||||
if (cflag) {
|
||||
|
@ -983,7 +983,7 @@ CL_ProcessUserInfo (int slot, player_info_t *player)
|
|||
const char *s;
|
||||
|
||||
s = Info_ValueForKey (player->userinfo, "skin");
|
||||
COM_StripExtension (s, skin); // FIXME: buffer overflow
|
||||
QFS_StripExtension (s, skin); // FIXME: buffer overflow
|
||||
if (!strequal (s, skin))
|
||||
Info_SetValueForKey (player->userinfo, "skin", skin, 1);
|
||||
strncpy (player->name, Info_ValueForKey (player->userinfo, "name"),
|
||||
|
|
|
@ -194,7 +194,7 @@ static void
|
|||
skin_f (cvar_t *var)
|
||||
{
|
||||
char *s = Hunk_TempAlloc (strlen (var->string) + 1);
|
||||
COM_StripExtension (var->string, s);
|
||||
QFS_StripExtension (var->string, s);
|
||||
Cvar_Set (var, s);
|
||||
Cvar_Info (var);
|
||||
}
|
||||
|
|
|
@ -60,7 +60,7 @@ COM_CheckRegistered (void)
|
|||
unsigned short check[128];
|
||||
QFile *h;
|
||||
|
||||
COM_FOpenFile ("gfx/pop.lmp", &h);
|
||||
QFS_FOpenFile ("gfx/pop.lmp", &h);
|
||||
static_registered = 0;
|
||||
|
||||
if (h) {
|
||||
|
@ -78,8 +78,6 @@ COM_CheckRegistered (void)
|
|||
void
|
||||
COM_Init (void)
|
||||
{
|
||||
Cmd_AddCommand ("path", COM_Path_f, "Show what paths Quake is using");
|
||||
|
||||
COM_CheckRegistered ();
|
||||
}
|
||||
|
||||
|
|
|
@ -140,12 +140,12 @@ CF_BuildQuota (void)
|
|||
struct dirent *i;
|
||||
DIR *dir;
|
||||
|
||||
path = Hunk_TempAlloc (strlen (com_gamedir) + 1 + strlen (CF_DIR) + 256 +
|
||||
path = Hunk_TempAlloc (strlen (qfs_gamedir_path) + 1 + strlen (CF_DIR) + 256 +
|
||||
1);
|
||||
if (!path)
|
||||
return;
|
||||
|
||||
strcpy(path, com_gamedir);
|
||||
strcpy(path, qfs_gamedir_path);
|
||||
strcpy(path + strlen(path), "/");
|
||||
strcpy(path + strlen(path), CF_DIR);
|
||||
|
||||
|
@ -232,13 +232,13 @@ CF_Open (const char *path, const char *mode)
|
|||
return -1;
|
||||
}
|
||||
|
||||
fullpath = malloc(strlen(com_gamedir) + 1 + strlen(CF_DIR) + strlen(path) +
|
||||
1);
|
||||
fullpath = malloc(strlen(qfs_gamedir_path) + 1 + strlen(CF_DIR)
|
||||
+ strlen(path) + 1);
|
||||
if (!fullpath) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
strcpy(fullpath, com_gamedir);
|
||||
strcpy(fullpath, qfs_gamedir_path);
|
||||
strcpy(fullpath + strlen(fullpath), "/");
|
||||
strcpy(fullpath + strlen(fullpath), CF_DIR);
|
||||
j = fullpath + strlen(fullpath);
|
||||
|
|
|
@ -59,7 +59,7 @@ SV_Gamedir_f (void)
|
|||
const char *dir;
|
||||
|
||||
if (Cmd_Argc () == 1) {
|
||||
Con_Printf ("Current gamedir: %s\n", gamedirfile);
|
||||
Con_Printf ("Current gamedir: %s\n", qfs_gamedir_file);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -76,7 +76,7 @@ SV_Gamedir_f (void)
|
|||
return;
|
||||
}
|
||||
|
||||
COM_Gamedir (dir);
|
||||
QFS_Gamedir (dir);
|
||||
|
||||
if (is_server) {
|
||||
Info_SetValueForStarKey (*svs_info, "*gamedir", dir, 0);
|
||||
|
|
|
@ -140,7 +140,7 @@ locs_load (const char *filename)
|
|||
QFile *file;
|
||||
|
||||
snprintf(tmp,sizeof(tmp), "maps/%s",filename);
|
||||
templength = _COM_FOpenFile (tmp, &file, foundname, 1);
|
||||
templength = _QFS_FOpenFile (tmp, &file, foundname, 1);
|
||||
if (!file) {
|
||||
Con_Printf ("Couldn't load %s\n", tmp);
|
||||
return;
|
||||
|
@ -162,7 +162,7 @@ locs_load (const char *filename)
|
|||
t2 = strrchr (t1, '\n');
|
||||
if (t2) {
|
||||
t2[0] = '\0';
|
||||
// handle dos format lines (COM_FOpenFile is binary only)
|
||||
// handle dos format lines (QFS_FOpenFile is binary only)
|
||||
// and unix is effectively binary only anyway
|
||||
while (t2 > t1 && t2[-1] == '\r') {
|
||||
t2[-1] = '\0';
|
||||
|
|
|
@ -105,7 +105,7 @@ Skin_Find (player_info_t *sc)
|
|||
if (!allskins[0] && (!s || !strcaseequal (name, s)))
|
||||
Info_SetValueForKey (sc->userinfo, "skin", name, 1);
|
||||
|
||||
COM_StripExtension (name, name);
|
||||
QFS_StripExtension (name, name);
|
||||
|
||||
skin = Hash_Find (skin_hash, name);
|
||||
if (skin) {
|
||||
|
@ -161,11 +161,11 @@ Skin_Cache (skin_t *skin)
|
|||
|
||||
// load the pic from disk
|
||||
snprintf (name, sizeof (name), "skins/%s.pcx", skin->name);
|
||||
COM_FOpenFile (name, &file);
|
||||
QFS_FOpenFile (name, &file);
|
||||
if (!file) {
|
||||
Con_Printf ("Couldn't load skin %s\n", name);
|
||||
snprintf (name, sizeof (name), "skins/%s.pcx", baseskin->string);
|
||||
COM_FOpenFile (name, &file);
|
||||
QFS_FOpenFile (name, &file);
|
||||
if (!file) {
|
||||
skin->failedload = true;
|
||||
return NULL;
|
||||
|
|
|
@ -210,7 +210,7 @@ SV_Fraglogfile_f (void)
|
|||
}
|
||||
// find an unused name
|
||||
for (i = 0; i < 1000; i++) {
|
||||
snprintf (name, sizeof (name), "%s/frag_%i.log", com_gamedir, i);
|
||||
snprintf (name, sizeof (name), "%s/frag_%i.log", qfs_gamedir_path, i);
|
||||
sv_fraglogfile = Qopen (name, "r");
|
||||
if (!sv_fraglogfile) { // can't read it, so create this one
|
||||
sv_fraglogfile = Qopen (name, "w");
|
||||
|
@ -413,7 +413,7 @@ SV_Map_f (void)
|
|||
|
||||
// check to make sure the level exists
|
||||
snprintf (expanded, sizeof (expanded), "maps/%s.bsp", level);
|
||||
COM_FOpenFile (expanded, &f);
|
||||
QFS_FOpenFile (expanded, &f);
|
||||
if (!f) {
|
||||
SV_Printf ("Can't find %s\n", expanded);
|
||||
return;
|
||||
|
@ -1070,14 +1070,14 @@ SV_Snap (int uid)
|
|||
|
||||
snprintf (pcxname, sizeof (pcxname), "%d-00.pcx", uid);
|
||||
|
||||
snprintf (checkname, sizeof (checkname), "%s/snap", com_gamedir);
|
||||
COM_CreatePath (va ("%s/dummy", checkname));
|
||||
snprintf (checkname, sizeof (checkname), "%s/snap", qfs_gamedir_path);
|
||||
QFS_CreatePath (va ("%s/dummy", checkname));
|
||||
|
||||
for (i = 0; i <= 99; i++) {
|
||||
pcxname[strlen (pcxname) - 6] = i / 10 + '0';
|
||||
pcxname[strlen (pcxname) - 5] = i % 10 + '0';
|
||||
snprintf (checkname, sizeof (checkname), "%s/snap/%s", com_gamedir,
|
||||
pcxname);
|
||||
snprintf (checkname, sizeof (checkname), "%s/snap/%s",
|
||||
qfs_gamedir_path, pcxname);
|
||||
if (Sys_FileTime (checkname) == -1)
|
||||
break; // file doesn't exist
|
||||
}
|
||||
|
|
|
@ -593,7 +593,7 @@ SV_Stop (int reason)
|
|||
if (demo.disk)
|
||||
Qclose (demo.file);
|
||||
|
||||
sprintf (path, "%s/%s/%s", com_gamedir, demo.path->str, demo.name->str);
|
||||
sprintf (path, "%s/%s/%s", qfs_gamedir_path, demo.path->str, demo.name->str);
|
||||
unlink (path);
|
||||
|
||||
strcpy (path + strlen (path) - 3, "txt");
|
||||
|
@ -1102,16 +1102,16 @@ SV_Record_f (void)
|
|||
if (sv.demorecording)
|
||||
SV_Stop_f ();
|
||||
|
||||
dsprintf (name, "%s/%s/%s%s%s", com_gamedir, sv_demoDir->string,
|
||||
dsprintf (name, "%s/%s/%s%s%s", qfs_gamedir_path, sv_demoDir->string,
|
||||
sv_demoPrefix->string, SV_CleanName (Cmd_Argv (1)),
|
||||
sv_demoSuffix->string);
|
||||
|
||||
COM_CreatePath (name->str);
|
||||
QFS_CreatePath (name->str);
|
||||
|
||||
// open the demo file
|
||||
name->size += 4;
|
||||
dstring_adjust (name);
|
||||
COM_DefaultExtension (name->str, ".mvd");
|
||||
QFS_DefaultExtension (name->str, ".mvd");
|
||||
|
||||
SV_Record (name->str);
|
||||
|
||||
|
@ -1223,16 +1223,16 @@ SV_EasyRecord_f (void)
|
|||
}
|
||||
|
||||
// Make sure the filename doesn't contain illegal characters
|
||||
dsprintf (name2, "%s/%s/%s%s%s", com_gamedir, sv_demoDir->string,
|
||||
dsprintf (name2, "%s/%s/%s%s%s", qfs_gamedir_path, sv_demoDir->string,
|
||||
sv_demoPrefix->string, SV_CleanName (name->str),
|
||||
sv_demoSuffix->string);
|
||||
COM_CreatePath (name2->str);
|
||||
QFS_CreatePath (name2->str);
|
||||
|
||||
// find a filename that doesn't exist yet
|
||||
dsprintf (name, "%s", name2->str);
|
||||
name->size += 4;
|
||||
dstring_adjust (name);
|
||||
COM_DefaultExtension (name->str, ".mvd");
|
||||
QFS_DefaultExtension (name->str, ".mvd");
|
||||
if ((f = Qopen (name->str, "rb")) == 0)
|
||||
f = Qopen (va ("%s.gz", name->str), "rb");
|
||||
|
||||
|
@ -1243,7 +1243,7 @@ SV_EasyRecord_f (void)
|
|||
dsprintf (name, "%s_%02i", name2->str, i);
|
||||
name->size += 4;
|
||||
dstring_adjust (name);
|
||||
COM_DefaultExtension (name->str, ".mvd");
|
||||
QFS_DefaultExtension (name->str, ".mvd");
|
||||
if ((f = Qopen (name->str, "rb")) == 0)
|
||||
f = Qopen (va ("%s.gz", name->str), "rb");
|
||||
i++;
|
||||
|
@ -1266,8 +1266,8 @@ SV_DemoList_f (void)
|
|||
dir_t dir;
|
||||
file_t *list;
|
||||
|
||||
Con_Printf ("content of %s/%s/ *.mvd\n", com_gamedir, sv_demoDir->string);
|
||||
dir = Sys_listdir (va ("%s/%s", com_gamedir, sv_demoDir->string), ".mvd");
|
||||
Con_Printf ("content of %s/%s/ *.mvd\n", qfs_gamedir_path, sv_demoDir->string);
|
||||
dir = Sys_listdir (va ("%s/%s", qfs_gamedir_path, sv_demoDir->string), ".mvd");
|
||||
list = dir.files;
|
||||
if (!list->name[0]) {
|
||||
Con_Printf ("no demos\n");
|
||||
|
@ -1307,7 +1307,7 @@ SV_DemoNum (int num)
|
|||
file_t *list;
|
||||
dir_t dir;
|
||||
|
||||
dir = Sys_listdir (va ("%s/%s", com_gamedir, sv_demoDir->string), ".mvd");
|
||||
dir = Sys_listdir (va ("%s/%s", qfs_gamedir_path, sv_demoDir->string), ".mvd");
|
||||
list = dir.files;
|
||||
|
||||
if (num <= 0)
|
||||
|
@ -1376,7 +1376,7 @@ SV_DemoRemove_f (void)
|
|||
ptr++;
|
||||
|
||||
dir =
|
||||
Sys_listdir (va ("%s/%s", com_gamedir, sv_demoDir->string), ".mvd");
|
||||
Sys_listdir (va ("%s/%s", qfs_gamedir_path, sv_demoDir->string), ".mvd");
|
||||
list = dir.files;
|
||||
for (i = 0; list->name[0]; list++) {
|
||||
if (strstr (list->name, ptr)) {
|
||||
|
@ -1384,7 +1384,7 @@ SV_DemoRemove_f (void)
|
|||
SV_Stop_f ();
|
||||
|
||||
// stop recording first;
|
||||
sprintf (path, "%s/%s/%s", com_gamedir, sv_demoDir->string,
|
||||
sprintf (path, "%s/%s/%s", qfs_gamedir_path, sv_demoDir->string,
|
||||
list->name);
|
||||
if (!unlink (path)) {
|
||||
Con_Printf ("removing %s...\n", list->name);
|
||||
|
@ -1405,9 +1405,9 @@ SV_DemoRemove_f (void)
|
|||
}
|
||||
*/
|
||||
dsprintf (name, "%s", Cmd_Argv (1));
|
||||
COM_DefaultExtension (name->str, ".mvd");
|
||||
QFS_DefaultExtension (name->str, ".mvd");
|
||||
|
||||
sprintf (path, "%s/%s/%s", com_gamedir, sv_demoDir->string, name->str);
|
||||
sprintf (path, "%s/%s/%s", qfs_gamedir_path, sv_demoDir->string, name->str);
|
||||
|
||||
if (sv.demorecording && !strcmp (name->str, demo.name->str))
|
||||
SV_Stop_f ();
|
||||
|
@ -1459,7 +1459,7 @@ SV_DemoRemoveNum_f (void)
|
|||
if (sv.demorecording && !strcmp (name, demo.name->str))
|
||||
SV_Stop_f ();
|
||||
|
||||
sprintf (path, "%s/%s/%s", com_gamedir, sv_demoDir->string, name);
|
||||
sprintf (path, "%s/%s/%s", qfs_gamedir_path, sv_demoDir->string, name);
|
||||
if (!unlink (path)) {
|
||||
Con_Printf ("demo %s succesfully removed\n", name);
|
||||
/*
|
||||
|
@ -1504,7 +1504,7 @@ SV_DemoInfoAdd_f (void)
|
|||
return;
|
||||
}
|
||||
|
||||
sprintf (path, "%s/%s/%s", com_gamedir, demo.path->str,
|
||||
sprintf (path, "%s/%s/%s", qfs_gamedir_path, demo.path->str,
|
||||
SV_DemoName2Txt (demo.name->str));
|
||||
} else {
|
||||
name = SV_DemoTxTNum (atoi (Cmd_Argv (1)));
|
||||
|
@ -1514,7 +1514,7 @@ SV_DemoInfoAdd_f (void)
|
|||
return;
|
||||
}
|
||||
|
||||
sprintf (path, "%s/%s/%s", com_gamedir, sv_demoDir->string, name);
|
||||
sprintf (path, "%s/%s/%s", qfs_gamedir_path, sv_demoDir->string, name);
|
||||
}
|
||||
|
||||
if ((f = Qopen (path, "a+t")) == NULL) {
|
||||
|
@ -1551,7 +1551,7 @@ SV_DemoInfoRemove_f (void)
|
|||
return;
|
||||
}
|
||||
|
||||
sprintf (path, "%s/%s/%s", com_gamedir, demo.path->str,
|
||||
sprintf (path, "%s/%s/%s", qfs_gamedir_path, demo.path->str,
|
||||
SV_DemoName2Txt (demo.name->str));
|
||||
} else {
|
||||
name = SV_DemoTxTNum (atoi (Cmd_Argv (1)));
|
||||
|
@ -1561,7 +1561,7 @@ SV_DemoInfoRemove_f (void)
|
|||
return;
|
||||
}
|
||||
|
||||
sprintf (path, "%s/%s/%s", com_gamedir, sv_demoDir->string, name);
|
||||
sprintf (path, "%s/%s/%s", qfs_gamedir_path, sv_demoDir->string, name);
|
||||
}
|
||||
|
||||
if (unlink (path))
|
||||
|
@ -1589,7 +1589,7 @@ SV_DemoInfo_f (void)
|
|||
return;
|
||||
}
|
||||
|
||||
sprintf (path, "%s/%s/%s", com_gamedir, demo.path->str,
|
||||
sprintf (path, "%s/%s/%s", qfs_gamedir_path, demo.path->str,
|
||||
SV_DemoName2Txt (demo.name->str));
|
||||
} else {
|
||||
name = SV_DemoTxTNum (atoi (Cmd_Argv (1)));
|
||||
|
@ -1599,7 +1599,7 @@ SV_DemoInfo_f (void)
|
|||
return;
|
||||
}
|
||||
|
||||
sprintf (path, "%s/%s/%s", com_gamedir, sv_demoDir->string, name);
|
||||
sprintf (path, "%s/%s/%s", qfs_gamedir_path, sv_demoDir->string, name);
|
||||
}
|
||||
|
||||
if ((f = Qopen (path, "rt")) == NULL) {
|
||||
|
|
|
@ -273,9 +273,9 @@ SV_CheckModel (const char *mdl)
|
|||
|
||||
// int len;
|
||||
|
||||
buf = (byte *) COM_LoadStackFile (mdl, stackbuf, sizeof (stackbuf));
|
||||
buf = (byte *) QFS_LoadStackFile (mdl, stackbuf, sizeof (stackbuf));
|
||||
if (buf) {
|
||||
crc = CRC_Block (buf, com_filesize);
|
||||
crc = CRC_Block (buf, qfs_filesize);
|
||||
} else {
|
||||
SV_Printf ("WARNING: cannot generate checksum for %s\n", mdl);
|
||||
}
|
||||
|
|
|
@ -1536,7 +1536,7 @@ SV_WriteIP_f (void)
|
|||
QFile *f;
|
||||
const char *type;
|
||||
|
||||
snprintf (name, sizeof (name), "%s/listip.cfg", com_gamedir);
|
||||
snprintf (name, sizeof (name), "%s/listip.cfg", qfs_gamedir_path);
|
||||
|
||||
SV_Printf ("Writing IP Filters to %s.\n", name);
|
||||
|
||||
|
|
|
@ -710,7 +710,7 @@ SV_BeginDownload_f (ucmd_t *cmd)
|
|||
|
||||
zip = strchr (Info_ValueForKey (host_client->userinfo, "*cap"), 'z') != 0;
|
||||
|
||||
size = _COM_FOpenFile (name, &file, realname, !zip);
|
||||
size = _QFS_FOpenFile (name, &file, realname, !zip);
|
||||
|
||||
host_client->download = file;
|
||||
host_client->downloadsize = size;
|
||||
|
|
|
@ -353,7 +353,7 @@ locs_loc (void)
|
|||
if (!mapname)
|
||||
Sys_Error ("Can't duplicate mapname!");
|
||||
map_to_loc (cl.worldmodel->name,mapname);
|
||||
snprintf (locfile, sizeof (locfile), "%s/%s", com_gamedir, mapname);
|
||||
snprintf (locfile, sizeof (locfile), "%s/%s", qfs_gamedir_path, mapname);
|
||||
free(mapname);
|
||||
|
||||
if (strcasecmp (Cmd_Argv(1),"save") == 0) {
|
||||
|
|
|
@ -170,7 +170,7 @@ DecodeArgs (int argc, char **argv)
|
|||
options.bspfile = strdup (argv[optind++]);
|
||||
} else {
|
||||
options.bspfile = malloc (strlen (options.mapfile) + 5);
|
||||
COM_StripExtension (options.mapfile, options.bspfile);
|
||||
QFS_StripExtension (options.mapfile, options.bspfile);
|
||||
strcat (options.bspfile, ".bsp");
|
||||
}
|
||||
options.hullfile = malloc (strlen (options.bspfile) + 5);
|
||||
|
|
|
@ -789,13 +789,13 @@ static void
|
|||
ProcessFile (void)
|
||||
{
|
||||
// create filenames
|
||||
COM_StripExtension (options.bspfile, options.hullfile);
|
||||
QFS_StripExtension (options.bspfile, options.hullfile);
|
||||
strcat (options.hullfile, ".h0");
|
||||
|
||||
COM_StripExtension (options.bspfile, options.portfile);
|
||||
QFS_StripExtension (options.bspfile, options.portfile);
|
||||
strcat (options.portfile, ".prt");
|
||||
|
||||
COM_StripExtension (options.bspfile, options.pointfile);
|
||||
QFS_StripExtension (options.bspfile, options.pointfile);
|
||||
strcat (options.pointfile, ".pts");
|
||||
|
||||
if (!options.onlyents) {
|
||||
|
|
|
@ -141,8 +141,8 @@ main (int argc, char **argv)
|
|||
|
||||
InitThreads ();
|
||||
|
||||
COM_StripExtension (bspfile, bspfile);
|
||||
COM_DefaultExtension (bspfile, ".bsp");
|
||||
QFS_StripExtension (bspfile, bspfile);
|
||||
QFS_DefaultExtension (bspfile, ".bsp");
|
||||
|
||||
f = Qopen (bspfile, "rb");
|
||||
bsp = LoadBSPFile (f, Qfilesize (f));
|
||||
|
|
|
@ -774,8 +774,8 @@ main (int argc, char **argv)
|
|||
usage (1);
|
||||
}
|
||||
|
||||
COM_StripExtension (options.bspfile, options.bspfile);
|
||||
COM_DefaultExtension (options.bspfile, ".bsp");
|
||||
QFS_StripExtension (options.bspfile, options.bspfile);
|
||||
QFS_DefaultExtension (options.bspfile, ".bsp");
|
||||
|
||||
f = Qopen (options.bspfile, "rb");
|
||||
bsp = LoadBSPFile (f, Qfilesize (f));
|
||||
|
@ -785,7 +785,7 @@ main (int argc, char **argv)
|
|||
|
||||
portalfile->size = strlen (options.bspfile) + 1;
|
||||
dstring_adjust (portalfile);
|
||||
COM_StripExtension (options.bspfile, portalfile->str);
|
||||
QFS_StripExtension (options.bspfile, portalfile->str);
|
||||
dstring_appendstr (portalfile, ".prt");
|
||||
LoadPortals (portalfile->str);
|
||||
|
||||
|
|
Loading…
Reference in a new issue