mirror of
https://git.code.sf.net/p/quake/quakeforge-old
synced 2024-11-10 06:31:56 +00:00
common/quakeio.c:
support gzipped files common/quakefs.c: qw_client/cl_parse.c: qw_server/sv_ccmds.c: uquake/host_cmd.c: uquake/menu.c: use "z" in mode flags when reading files uquake/Makefile.in: take cl_ents.c out again (too much work atm to get it to compile)
This commit is contained in:
parent
1983cf894b
commit
7d5b301d80
6 changed files with 56 additions and 12 deletions
|
@ -144,7 +144,7 @@ int COM_FileOpenRead (char *path, QFile **hndl)
|
|||
{
|
||||
QFile *f;
|
||||
|
||||
f = Qopen(path, "rb");
|
||||
f = Qopen(path, "rbz");
|
||||
if (!f)
|
||||
{
|
||||
*hndl = NULL;
|
||||
|
@ -290,7 +290,7 @@ QFile *COM_OpenRead(const char *path, int offs, int len)
|
|||
}
|
||||
lseek(fd,offs,SEEK_SET);
|
||||
com_filesize=len;
|
||||
return Qdopen(fd,"rb");
|
||||
return Qdopen(fd,"rbz");
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
@ -5,24 +5,68 @@
|
|||
QFile *Qopen(const char *path, const char *mode)
|
||||
{
|
||||
QFile *file;
|
||||
char m[80],*p;
|
||||
int zip=0;
|
||||
|
||||
for (p=m; *mode && p-m<(sizeof(m)-1); mode++) {
|
||||
if (*mode=='z') {
|
||||
zip=1;
|
||||
continue;
|
||||
}
|
||||
p++;
|
||||
}
|
||||
*p=0;
|
||||
|
||||
file=calloc(sizeof(*file),1);
|
||||
if (!file)
|
||||
return 0;
|
||||
file->file=fopen(path,mode);
|
||||
if (!file->file)
|
||||
return 0;
|
||||
if (zip) {
|
||||
file->gzfile=gzopen(path,m);
|
||||
if (!file->gzfile) {
|
||||
free(file);
|
||||
return 0;
|
||||
}
|
||||
} else {
|
||||
file->file=fopen(path,m);
|
||||
if (!file->file) {
|
||||
free(file);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
return file;
|
||||
}
|
||||
|
||||
QFile *Qdopen(int fd, const char *mode)
|
||||
{
|
||||
QFile *file;
|
||||
char m[80],*p;
|
||||
int zip=0;
|
||||
|
||||
for (p=m; *mode && p-m<(sizeof(m)-1); mode++) {
|
||||
if (*mode=='z') {
|
||||
zip=1;
|
||||
continue;
|
||||
}
|
||||
*p++=*mode;
|
||||
}
|
||||
*p=0;
|
||||
|
||||
file=calloc(sizeof(*file),1);
|
||||
if (!file)
|
||||
return 0;
|
||||
file->file=fdopen(fd,mode);
|
||||
if (!file->file)
|
||||
return 0;
|
||||
if (zip) {
|
||||
file->gzfile=gzdopen(fd,m);
|
||||
if (!file->gzfile) {
|
||||
free(file);
|
||||
return 0;
|
||||
}
|
||||
} else {
|
||||
file->file=fdopen(fd,m);
|
||||
if (!file->file) {
|
||||
free(file);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
return file;
|
||||
}
|
||||
|
||||
|
|
|
@ -580,7 +580,7 @@ void CL_ParseServerData (void)
|
|||
//if it exists
|
||||
if (cflag) {
|
||||
snprintf(fn, sizeof(fn), "%s/%s", com_gamedir, "config.cfg");
|
||||
if ((f = Qopen(fn, "r")) != NULL) {
|
||||
if ((f = Qopen(fn, "rz")) != NULL) {
|
||||
Qclose(f);
|
||||
Cbuf_AddText ("cl_warncmd 0\n");
|
||||
Cbuf_AddText("exec config.cfg\n");
|
||||
|
|
|
@ -175,7 +175,7 @@ SW_REND_SRC = screen.c $(SWREND_SRC_PLAT) draw.c \
|
|||
|
||||
# Client source files
|
||||
|
||||
CL_SRC = cl_demo.c cl_input.c cl_main.c cl_parse.c cl_tent.c cl_ents.c
|
||||
CL_SRC = cl_demo.c cl_input.c cl_main.c cl_parse.c cl_tent.c
|
||||
CL_GUI_SRC= console.c sbar.c view.c keys.c menu.c
|
||||
|
||||
# Server source files
|
||||
|
|
|
@ -609,7 +609,7 @@ void Host_Loadgame_f (void)
|
|||
// SCR_BeginLoadingPlaque ();
|
||||
|
||||
Con_Printf ("Loading game from %s...\n", name);
|
||||
f = Qopen (name, "r");
|
||||
f = Qopen (name, "rz");
|
||||
if (!f)
|
||||
{
|
||||
Con_Printf ("ERROR: couldn't open.\n");
|
||||
|
|
|
@ -482,7 +482,7 @@ void M_ScanSaves (void)
|
|||
strcpy (m_filenames[i], "--- UNUSED SLOT ---");
|
||||
loadable[i] = false;
|
||||
snprintf(name, sizeof(name), "%s/s%i.sav", com_gamedir, i);
|
||||
f = Qopen (name, "r");
|
||||
f = Qopen (name, "rz");
|
||||
if (!f)
|
||||
continue;
|
||||
Qgets(f,buf,sizeof(buf));
|
||||
|
|
Loading…
Reference in a new issue