diff --git a/.gitignore b/.gitignore index b6e5c07..09a79d8 100644 --- a/.gitignore +++ b/.gitignore @@ -1,8 +1,7 @@ +quake2 *.plg *.bce *.bcp *.opt -.vimrc debugi386 releasei386 -quake2 diff --git a/Makefile b/Makefile index dd013ce..5442fd2 100644 --- a/Makefile +++ b/Makefile @@ -82,7 +82,7 @@ BASE_CFLAGS=-Dstricmp=strcasecmp -Wall -Werror DEBUG_CFLAGS=$(BASE_CFLAGS) -g -LDFLAGS=-lz -lm -ldl -export-dynamic +LDFLAGS=-lm -ldl SVGALDFLAGS=-lvga @@ -272,7 +272,6 @@ QUAKE2_OBJS = \ $(BUILDDIR)/client/files.o \ $(BUILDDIR)/client/mdfour.o \ $(BUILDDIR)/client/net_chan.o \ - $(BUILDDIR)/client/quakeio.o \ \ $(BUILDDIR)/client/sv_ccmds.o \ $(BUILDDIR)/client/sv_ents.o \ @@ -401,9 +400,6 @@ $(BUILDDIR)/client/mdfour.o : $(COMMON_DIR)/mdfour.c $(BUILDDIR)/client/net_chan.o : $(COMMON_DIR)/net_chan.c $(DO_CC) -$(BUILDDIR)/client/quakeio.o : $(COMMON_DIR)/quakeio.c - $(DO_CC) - $(BUILDDIR)/client/q_shared.o : $(GAME_DIR)/q_shared.c $(DO_CC) diff --git a/client/.gitignore b/client/.gitignore index 2cc377c..a438335 100644 --- a/client/.gitignore +++ b/client/.gitignore @@ -1,2 +1 @@ *.d -.vimrc diff --git a/client/cl_cin.c b/client/cl_cin.c index d495626..18ea81a 100644 --- a/client/cl_cin.c +++ b/client/cl_cin.c @@ -170,7 +170,7 @@ void SCR_StopCinematic (void) } if (cl.cinematic_file) { - Qclose (cl.cinematic_file); + fclose (cl.cinematic_file); cl.cinematic_file = NULL; } if (cin.hnodes1) @@ -436,11 +436,11 @@ byte *SCR_ReadNextFrame (void) int start, end, count; // read the next frame - r = Qread (cl.cinematic_file, &command, 4); + r = fread (&command, 4, 1, cl.cinematic_file); if (r == 0) // we'll give it one more chance - r = Qread (cl.cinematic_file, &command, 4); + r = fread (&command, 4, 1, cl.cinematic_file); - if (r != 4) + if (r != 1) return NULL; command = LittleLong(command); if (command == 2) diff --git a/client/cl_main.c b/client/cl_main.c index 6f7123a..e19423a 100644 --- a/client/cl_main.c +++ b/client/cl_main.c @@ -117,8 +117,8 @@ void CL_WriteDemoMessage (void) // the first eight bytes are just packet sequencing stuff len = net_message.cursize-8; swlen = LittleLong(len); - Qwrite (cls.demofile, &swlen, 4); - Qwrite (cls.demofile, net_message.data+8, len); + fwrite (&swlen, 4, 1, cls.demofile); + fwrite (net_message.data+8, len, 1, cls.demofile); } @@ -141,8 +141,8 @@ void CL_Stop_f (void) // finish up len = -1; - Qwrite (cls.demofile, &len, 4); - Qclose (cls.demofile); + fwrite (&len, 4, 1, cls.demofile); + fclose (cls.demofile); cls.demofile = NULL; cls.demorecording = false; Com_Printf ("Stopped demo.\n"); @@ -192,7 +192,7 @@ void CL_Record_f (void) Com_Printf ("recording to %s.\n", name); FS_CreatePath (name); - cls.demofile = Qopen (name, "wb"); + cls.demofile = fopen (name, "wb"); if (!cls.demofile) { Com_Printf ("ERROR: couldn't open.\n"); @@ -226,8 +226,8 @@ void CL_Record_f (void) if (buf.cursize + strlen (cl.configstrings[i]) + 32 > buf.maxsize) { // write it out len = LittleLong (buf.cursize); - Qwrite (cls.demofile, &len, 4); - Qwrite (cls.demofile, buf.data, buf.cursize); + fwrite (&len, 4, 1, cls.demofile); + fwrite (buf.data, buf.cursize, 1, cls.demofile); buf.cursize = 0; } @@ -249,8 +249,8 @@ void CL_Record_f (void) if (buf.cursize + 64 > buf.maxsize) { // write it out len = LittleLong (buf.cursize); - Qwrite (cls.demofile, &len, 4); - Qwrite (cls.demofile, buf.data, buf.cursize); + fwrite (&len, 4, 1, cls.demofile); + fwrite (buf.data, buf.cursize, 1, cls.demofile); buf.cursize = 0; } @@ -264,8 +264,8 @@ void CL_Record_f (void) // write it to the demo file len = LittleLong (buf.cursize); - Qwrite (cls.demofile, &len, 4); - Qwrite (cls.demofile, buf.data, buf.cursize); + fwrite (&len, 4, 1, cls.demofile); + fwrite (buf.data, buf.cursize, 1, cls.demofile); // the rest of the demo file will be individual frames } @@ -652,7 +652,7 @@ void CL_Disconnect (void) // stop download if (cls.download) { - Qclose(cls.download); + fclose(cls.download); cls.download = NULL; } @@ -1555,23 +1555,23 @@ Writes key bindings and archived cvars to config.cfg */ void CL_WriteConfiguration (void) { - QFile *f; + FILE *f; char path[MAX_QPATH]; if (cls.state == ca_uninitialized) return; Com_sprintf (path, sizeof(path),"%s/config.cfg",FS_Gamedir()); - f = Qopen (path, "w"); + f = fopen (path, "w"); if (!f) { Com_Printf ("Couldn't write config.cfg.\n"); return; } - Qprintf (f, "// generated by quake, do not modify\n"); + fprintf (f, "// generated by quake, do not modify\n"); Key_WriteBindings (f); - Qclose (f); + fclose (f); Cvar_WriteVariables (path); } @@ -1755,14 +1755,14 @@ void CL_Frame (int msec) { lasttimecalled = Sys_Milliseconds(); if ( log_stats_file ) - Qprintf( log_stats_file, "0\n" ); + fprintf( log_stats_file, "0\n" ); } else { int now = Sys_Milliseconds(); if ( log_stats_file ) - Qprintf( log_stats_file, "%d\n", now - lasttimecalled ); + fprintf( log_stats_file, "%d\n", now - lasttimecalled ); lasttimecalled = now; } } diff --git a/client/cl_parse.c b/client/cl_parse.c index c3a9004..a79b217 100644 --- a/client/cl_parse.c +++ b/client/cl_parse.c @@ -68,7 +68,7 @@ to start a download from the server. */ qboolean CL_CheckOrDownloadFile (char *filename) { - QFile *fp; + FILE *fp; char name[MAX_OSPATH]; if (strstr (filename, "..")) @@ -97,11 +97,11 @@ qboolean CL_CheckOrDownloadFile (char *filename) // FS_CreatePath (name); - fp = Qopen (name, "r+bz"); + fp = fopen (name, "r+b"); if (fp) { // it exists int len; - Qseek(fp, 0, SEEK_END); - len = Qtell(fp); + fseek(fp, 0, SEEK_END); + len = ftell(fp); cls.download = fp; @@ -212,7 +212,7 @@ void CL_ParseDownload (void) if (cls.download) { // if here, we tried to resume a file but the server said no - Qclose (cls.download); + fclose (cls.download); cls.download = NULL; } CL_RequestNextDownload (); @@ -226,7 +226,7 @@ void CL_ParseDownload (void) FS_CreatePath (name); - cls.download = Qopen (name, "wb"); + cls.download = fopen (name, "wb"); if (!cls.download) { net_message.readcount += size; @@ -236,7 +236,7 @@ void CL_ParseDownload (void) } } - Qwrite (cls.download, net_message.data + net_message.readcount, size); + fwrite (net_message.data + net_message.readcount, 1, size, cls.download); net_message.readcount += size; if (percent != 100) @@ -263,7 +263,7 @@ void CL_ParseDownload (void) // Com_Printf ("100%%\n"); - Qclose (cls.download); + fclose (cls.download); // rename the temp file to it's final name CL_DownloadFileName(oldn, sizeof(oldn), cls.downloadtempname); @@ -715,7 +715,7 @@ void CL_ParseServerMessage (void) Com_Printf ("Server disconnected, reconnecting\n"); if (cls.download) { //ZOID, close download - Qclose (cls.download); + fclose (cls.download); cls.download = NULL; } cls.state = ca_connecting; diff --git a/client/cl_view.c b/client/cl_view.c index b2c82e6..4b75809 100644 --- a/client/cl_view.c +++ b/client/cl_view.c @@ -537,7 +537,7 @@ void V_RenderView( float stereo_separation ) if (cl_stats->value) Com_Printf ("ent:%i lt:%i part:%i\n", r_numentities, r_numdlights, r_numparticles); if ( log_stats->value && ( log_stats_file != 0 ) ) - Qprintf( log_stats_file, "%i,%i,%i,",r_numentities, r_numdlights, r_numparticles); + fprintf( log_stats_file, "%i,%i,%i,",r_numentities, r_numdlights, r_numparticles); SCR_AddDirtyPoint (scr_vrect.x, scr_vrect.y); diff --git a/client/client.h b/client/client.h index 697c5fe..2dc57a2 100644 --- a/client/client.h +++ b/client/client.h @@ -140,7 +140,7 @@ typedef struct // // non-gameserver infornamtion // FIXME: move this cinematic stuff into the cin_t structure - QFile *cinematic_file; + FILE *cinematic_file; int cinematictime; // cls.realtime for first cinematic frame int cinematicframe; char cinematicpalette[768]; @@ -225,7 +225,7 @@ typedef struct int challenge; // from the server to use for connecting - QFile *download; // file transfer from server + FILE *download; // file transfer from server char downloadtempname[MAX_OSPATH]; char downloadname[MAX_OSPATH]; int downloadnumber; @@ -235,7 +235,7 @@ typedef struct // demo recording info must be here, so it isn't cleared on level change qboolean demorecording; qboolean demowaiting; // don't record until a non-delta message is received - QFile *demofile; + FILE *demofile; } client_static_t; extern client_static_t cls; diff --git a/client/console.c b/client/console.c index ec1fbec..99e2e86 100644 --- a/client/console.c +++ b/client/console.c @@ -144,7 +144,7 @@ void Con_Dump_f (void) { int l, x; char *line; - QFile *f; + FILE *f; char buffer[1024]; char name[MAX_OSPATH]; @@ -158,7 +158,7 @@ void Con_Dump_f (void) Com_Printf ("Dumped console text to %s.\n", name); FS_CreatePath (name); - f = Qopen (name, "w"); + f = fopen (name, "w"); if (!f) { Com_Printf ("ERROR: couldn't open.\n"); @@ -192,10 +192,10 @@ void Con_Dump_f (void) for (x=0; buffer[x]; x++) buffer[x] &= 0x7f; - Qprintf (f, "%s\n", buffer); + fprintf (f, "%s\n", buffer); } - Qclose (f); + fclose (f); } diff --git a/client/keys.c b/client/keys.c index a1734f8..74d682d 100644 --- a/client/keys.c +++ b/client/keys.c @@ -613,13 +613,13 @@ Key_WriteBindings Writes lines containing "bind key value" ============ */ -void Key_WriteBindings (QFile *f) +void Key_WriteBindings (FILE *f) { int i; for (i=0 ; i<256 ; i++) if (keybindings[i] && keybindings[i][0]) - Qprintf (f, "bind %s \"%s\"\n", Key_KeynumToString(i), keybindings[i]); + fprintf (f, "bind %s \"%s\"\n", Key_KeynumToString(i), keybindings[i]); } diff --git a/client/keys.h b/client/keys.h index 35deb15..bed9735 100644 --- a/client/keys.h +++ b/client/keys.h @@ -139,7 +139,7 @@ extern qboolean chat_team; void Key_Event (int key, qboolean down, unsigned time); void Key_Init (void); -void Key_WriteBindings (QFile *f); +void Key_WriteBindings (FILE *f); void Key_SetBinding (int keynum, char *binding); void Key_ClearStates (void); int Key_GetKey (void); diff --git a/client/menu.c b/client/menu.c index 370c3da..150b510 100644 --- a/client/menu.c +++ b/client/menu.c @@ -2031,13 +2031,13 @@ qboolean m_savevalid[MAX_SAVEGAMES]; void Create_Savestrings (void) { int i; - QFile *f; + FILE *f; char name[MAX_OSPATH]; for (i=0 ; i"); @@ -2046,7 +2046,7 @@ void Create_Savestrings (void) else { FS_Read (m_savestrings[i], sizeof(m_savestrings[i]), f); - Qclose (f); + fclose (f); m_savevalid[i] = true; } } @@ -2514,13 +2514,13 @@ void StartServer_MenuInit( void ) char *s; int length; int i; - QFile *fp; + FILE *fp; /* ** load the list of map names */ Com_sprintf( mapsname, sizeof( mapsname ), "%s/maps.lst", FS_Gamedir() ); - if ( ( fp = Qopen( mapsname, "rbz" ) ) == 0 ) + if ( ( fp = fopen( mapsname, "rb" ) ) == 0 ) { if ( ( length = FS_LoadFile( "maps.lst", ( void ** ) &buffer ) ) == -1 ) Com_Error( ERR_DROP, "couldn't find maps.lst\n" ); @@ -2530,12 +2530,12 @@ void StartServer_MenuInit( void ) #ifdef _WIN32 length = filelength( fileno( fp ) ); #else - Qseek(fp, 0, SEEK_END); - length = Qtell(fp); - Qseek(fp, 0, SEEK_SET); + fseek(fp, 0, SEEK_END); + length = ftell(fp); + fseek(fp, 0, SEEK_SET); #endif buffer = malloc( length ); - Qread (fp , buffer, length); + fread( buffer, length, 1, fp ); } s = buffer; diff --git a/client/snd_dma.c b/client/snd_dma.c index 4a28e89..09e408d 100644 --- a/client/snd_dma.c +++ b/client/snd_dma.c @@ -589,7 +589,7 @@ struct sfx_s *S_RegisterSexedSound (entity_state_t *ent, char *base) int n; char *p; struct sfx_s *sfx; - QFile *f; + FILE *f; char model[MAX_QPATH]; char sexedFilename[MAX_QPATH]; char maleFilename[MAX_QPATH]; diff --git a/ctf/g_save.c b/ctf/g_save.c index a19f47f..b14696b 100644 --- a/ctf/g_save.c +++ b/ctf/g_save.c @@ -18,7 +18,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -#include "../qcommon/quakeio.h" #include "g_local.h" field_t fields[] = { @@ -237,7 +236,7 @@ void InitGame (void) //========================================================= -void WriteField1 (QFile *f, field_t *field, byte *base) +void WriteField1 (FILE *f, field_t *field, byte *base) { void *p; int len; @@ -288,7 +287,7 @@ void WriteField1 (QFile *f, field_t *field, byte *base) } } -void WriteField2 (QFile *f, field_t *field, byte *base) +void WriteField2 (FILE *f, field_t *field, byte *base) { int len; void *p; @@ -301,7 +300,7 @@ void WriteField2 (QFile *f, field_t *field, byte *base) if ( *(char **)p ) { len = strlen(*(char **)p) + 1; - Qwrite (f, *(char **)p, len); + fwrite (*(char **)p, len, 1, f); } break; default: @@ -309,7 +308,7 @@ void WriteField2 (QFile *f, field_t *field, byte *base) } } -void ReadField (QFile *f, field_t *field, byte *base) +void ReadField (FILE *f, field_t *field, byte *base) { void *p; int len; @@ -332,7 +331,7 @@ void ReadField (QFile *f, field_t *field, byte *base) else { *(char **)p = gi.TagMalloc (len, TAG_LEVEL); - Qread (f, *(char **)p, len); + fread (*(char **)p, len, 1, f); } break; case F_GSTRING: @@ -342,7 +341,7 @@ void ReadField (QFile *f, field_t *field, byte *base) else { *(char **)p = gi.TagMalloc (len, TAG_GAME); - Qread (f, *(char **)p, len); + fread (*(char **)p, len, 1, f); } break; case F_EDICT: @@ -381,7 +380,7 @@ WriteClient All pointer variables (except function pointers) must be handled specially. ============== */ -void WriteClient (QFile *f, gclient_t *client) +void WriteClient (FILE *f, gclient_t *client) { field_t *field; gclient_t temp; @@ -396,7 +395,7 @@ void WriteClient (QFile *f, gclient_t *client) } // write the block - Qwrite (f, &temp, sizeof(temp)); + fwrite (&temp, sizeof(temp), 1, f); // now write any allocated data following the edict for (field=clientfields ; field->name ; field++) @@ -412,11 +411,11 @@ ReadClient All pointer variables (except function pointers) must be handled specially. ============== */ -void ReadClient (QFile *f, gclient_t *client) +void ReadClient (FILE *f, gclient_t *client) { field_t *field; - Qread (f, client, sizeof(*client)); + fread (client, sizeof(*client), 1, f); for (field=clientfields ; field->name ; field++) { @@ -440,59 +439,59 @@ last save position. */ void WriteGame (char *filename, qboolean autosave) { - QFile *f; + FILE *f; int i; char str[16]; if (!autosave) SaveClientData (); - f = Qopen (filename, "wb"); + f = fopen (filename, "wb"); if (!f) gi.error ("Couldn't open %s", filename); memset (str, 0, sizeof(str)); strcpy (str, __DATE__); - Qwrite (f, str, sizeof(str)); + fwrite (str, sizeof(str), 1, f); game.autosaved = autosave; - Qwrite (f, &game, sizeof(game)); + fwrite (&game, sizeof(game), 1, f); game.autosaved = false; for (i=0 ; iname ; field++) @@ -537,7 +536,7 @@ WriteLevelLocals All pointer variables (except function pointers) must be handled specially. ============== */ -void WriteLevelLocals (QFile *f) +void WriteLevelLocals (FILE *f) { field_t *field; level_locals_t temp; @@ -552,7 +551,7 @@ void WriteLevelLocals (QFile *f) } // write the block - Qwrite (f, &temp, sizeof(temp)); + fwrite (&temp, sizeof(temp), 1, f); // now write any allocated data following the edict for (field=levelfields ; field->name ; field++) @@ -569,11 +568,11 @@ ReadEdict All pointer variables (except function pointers) must be handled specially. ============== */ -void ReadEdict (QFile *f, edict_t *ent) +void ReadEdict (FILE *f, edict_t *ent) { field_t *field; - Qread (f, ent, sizeof(*ent)); + fread (ent, sizeof(*ent), 1, f); for (field=savefields ; field->name ; field++) { @@ -588,11 +587,11 @@ ReadLevelLocals All pointer variables (except function pointers) must be handled specially. ============== */ -void ReadLevelLocals (QFile *f) +void ReadLevelLocals (FILE *f) { field_t *field; - Qread (f, &level, sizeof(level)); + fread (&level, sizeof(level), 1, f); for (field=levelfields ; field->name ; field++) { @@ -610,20 +609,20 @@ void WriteLevel (char *filename) { int i; edict_t *ent; - QFile *f; + FILE *f; void *base; - f = Qopen (filename, "wb"); + f = fopen (filename, "wb"); if (!f) gi.error ("Couldn't open %s", filename); // write out edict size for checking i = sizeof(edict_t); - Qwrite (f, &i, sizeof(i)); + fwrite (&i, sizeof(i), 1, f); // write out a function pointer for checking base = (void *)InitGame; - Qwrite (f, &base, sizeof(base)); + fwrite (&base, sizeof(base), 1, f); // write out level_locals_t WriteLevelLocals (f); @@ -634,13 +633,13 @@ void WriteLevel (char *filename) ent = &g_edicts[i]; if (!ent->inuse) continue; - Qwrite (f, &i, sizeof(i)); + fwrite (&i, sizeof(i), 1, f); WriteEdict (f, ent); } i = -1; - Qwrite (f, &i, sizeof(i)); + fwrite (&i, sizeof(i), 1, f); - Qclose (f); + fclose (f); } @@ -663,12 +662,12 @@ No clients are connected yet. void ReadLevel (char *filename) { int entnum; - QFile *f; + FILE *f; int i; void *base; edict_t *ent; - f = Qopen (filename, "rbz"); + f = fopen (filename, "rb"); if (!f) gi.error ("Couldn't open %s", filename); @@ -681,18 +680,18 @@ void ReadLevel (char *filename) globals.num_edicts = maxclients->value+1; // check edict size - Qread (f, &i, sizeof(i)); + fread (&i, sizeof(i), 1, f); if (i != sizeof(edict_t)) { - Qclose (f); + fclose (f); gi.error ("ReadLevel: mismatched edict size"); } // check function pointer base address - Qread (f, &base, sizeof(base)); + fread (&base, sizeof(base), 1, f); if (base != (void *)InitGame) { - Qclose (f); + fclose (f); gi.error ("ReadLevel: function pointers have moved"); } @@ -702,9 +701,9 @@ void ReadLevel (char *filename) // load all the entities while (1) { - if (Qread (f, &entnum, sizeof(entnum)) != sizeof(entnum)) + if (fread (&entnum, sizeof(entnum), 1, f) != 1) { - Qclose (f); + fclose (f); gi.error ("ReadLevel: failed to read entnum"); } if (entnum == -1) @@ -720,7 +719,7 @@ void ReadLevel (char *filename) gi.linkentity (ent); } - Qclose (f); + fclose (f); // mark all clients as unconnected for (i=0 ; ivalue ; i++) diff --git a/ctf/g_svcmds.c b/ctf/g_svcmds.c index b40efdc..6868633 100644 --- a/ctf/g_svcmds.c +++ b/ctf/g_svcmds.c @@ -18,7 +18,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -#include "../qcommon/quakeio.h" #include "g_local.h" @@ -238,7 +237,7 @@ SV_WriteIP_f */ void SVCmd_WriteIP_f (void) { - QFile *f; + FILE *f; char name[MAX_OSPATH]; byte b[4]; int i; @@ -253,22 +252,22 @@ void SVCmd_WriteIP_f (void) gi.cprintf (NULL, PRINT_HIGH, "Writing %s.\n", name); - f = Qopen (name, "wb"); + f = fopen (name, "wb"); if (!f) { gi.cprintf (NULL, PRINT_HIGH, "Couldn't open %s\n", name); return; } - Qprintf(f, "set filterban %d\n", (int)filterban->value); + fprintf(f, "set filterban %d\n", (int)filterban->value); for (i=0 ; iname ; field++) @@ -435,11 +434,11 @@ ReadClient All pointer variables (except function pointers) must be handled specially. ============== */ -void ReadClient (QFile *f, gclient_t *client) +void ReadClient (FILE *f, gclient_t *client) { field_t *field; - Qread (f, client, sizeof(*client)); + fread (client, sizeof(*client), 1, f); for (field=clientfields ; field->name ; field++) { @@ -463,59 +462,59 @@ last save position. */ void WriteGame (char *filename, qboolean autosave) { - QFile *f; + FILE *f; int i; char str[16]; if (!autosave) SaveClientData (); - f = Qopen (filename, "wb"); + f = fopen (filename, "wb"); if (!f) gi.error ("Couldn't open %s", filename); memset (str, 0, sizeof(str)); strcpy (str, __DATE__); - Qwrite (f, str, sizeof(str)); + fwrite (str, sizeof(str), 1, f); game.autosaved = autosave; - Qwrite (f, &game, sizeof(game)); + fwrite (&game, sizeof(game), 1, f); game.autosaved = false; for (i=0 ; iname ; field++) @@ -560,7 +559,7 @@ WriteLevelLocals All pointer variables (except function pointers) must be handled specially. ============== */ -void WriteLevelLocals (QFile *f) +void WriteLevelLocals (FILE *f) { field_t *field; level_locals_t temp; @@ -575,7 +574,7 @@ void WriteLevelLocals (QFile *f) } // write the block - Qwrite (f, &temp, sizeof(temp)); + fwrite (&temp, sizeof(temp), 1, f); // now write any allocated data following the edict for (field=levelfields ; field->name ; field++) @@ -592,11 +591,11 @@ ReadEdict All pointer variables (except function pointers) must be handled specially. ============== */ -void ReadEdict (QFile *f, edict_t *ent) +void ReadEdict (FILE *f, edict_t *ent) { field_t *field; - Qread (f, ent, sizeof(*ent)); + fread (ent, sizeof(*ent), 1, f); for (field=fields ; field->name ; field++) { @@ -611,11 +610,11 @@ ReadLevelLocals All pointer variables (except function pointers) must be handled specially. ============== */ -void ReadLevelLocals (QFile *f) +void ReadLevelLocals (FILE *f) { field_t *field; - Qread (f, &level, sizeof(level)); + fread (&level, sizeof(level), 1, f); for (field=levelfields ; field->name ; field++) { @@ -633,20 +632,20 @@ void WriteLevel (char *filename) { int i; edict_t *ent; - QFile *f; + FILE *f; void *base; - f = Qopen (filename, "wb"); + f = fopen (filename, "wb"); if (!f) gi.error ("Couldn't open %s", filename); // write out edict size for checking i = sizeof(edict_t); - Qwrite (f, &i, sizeof(i)); + fwrite (&i, sizeof(i), 1, f); // write out a function pointer for checking base = (void *)InitGame; - Qwrite (f, &base, sizeof(base)); + fwrite (&base, sizeof(base), 1, f); // write out level_locals_t WriteLevelLocals (f); @@ -657,13 +656,13 @@ void WriteLevel (char *filename) ent = &g_edicts[i]; if (!ent->inuse) continue; - Qwrite (f, &i, sizeof(i)); + fwrite (&i, sizeof(i), 1, f); WriteEdict (f, ent); } i = -1; - Qwrite (f, &i, sizeof(i)); + fwrite (&i, sizeof(i), 1, f); - Qclose (f); + fclose (f); } @@ -686,12 +685,12 @@ No clients are connected yet. void ReadLevel (char *filename) { int entnum; - QFile *f; + FILE *f; int i; void *base; edict_t *ent; - f = Qopen (filename, "rbz"); + f = fopen (filename, "rb"); if (!f) gi.error ("Couldn't open %s", filename); @@ -704,19 +703,19 @@ void ReadLevel (char *filename) globals.num_edicts = maxclients->value+1; // check edict size - Qread (f, &i, sizeof(i)); + fread (&i, sizeof(i), 1, f); if (i != sizeof(edict_t)) { - Qclose (f); + fclose (f); gi.error ("ReadLevel: mismatched edict size"); } // check function pointer base address - Qread (f, &base, sizeof(base)); + fread (&base, sizeof(base), 1, f); #ifdef _WIN32 if (base != (void *)InitGame) { - Qclose (f); + fclose (f); gi.error ("ReadLevel: function pointers have moved"); } #else @@ -729,9 +728,9 @@ void ReadLevel (char *filename) // load all the entities while (1) { - if (Qread (f, &entnum, sizeof(entnum)) != sizeof(entnum)) + if (fread (&entnum, sizeof(entnum), 1, f) != 1) { - Qclose (f); + fclose (f); gi.error ("ReadLevel: failed to read entnum"); } if (entnum == -1) @@ -747,7 +746,7 @@ void ReadLevel (char *filename) gi.linkentity (ent); } - Qclose (f); + fclose (f); // mark all clients as unconnected for (i=0 ; ivalue ; i++) diff --git a/game/g_svcmds.c b/game/g_svcmds.c index 56abb02..6868633 100644 --- a/game/g_svcmds.c +++ b/game/g_svcmds.c @@ -17,7 +17,7 @@ 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/quakeio.h" + #include "g_local.h" @@ -237,7 +237,7 @@ SV_WriteIP_f */ void SVCmd_WriteIP_f (void) { - QFile *f; + FILE *f; char name[MAX_OSPATH]; byte b[4]; int i; @@ -252,22 +252,22 @@ void SVCmd_WriteIP_f (void) gi.cprintf (NULL, PRINT_HIGH, "Writing %s.\n", name); - f = Qopen (name, "wb"); + f = fopen (name, "wb"); if (!f) { gi.cprintf (NULL, PRINT_HIGH, "Couldn't open %s\n", name); return; } - Qprintf(f, "set filterban %d\n", (int)filterban->value); + fprintf(f, "set filterban %d\n", (int)filterban->value); for (i=0 ; ivalue) return; - Qputs(string, stdout); + fputs(string, stdout); } void Sys_Printf (char *fmt, ...) @@ -321,7 +321,7 @@ int main (int argc, char **argv) void Sys_CopyProtect(void) { - QFile *mnt; + FILE *mnt; struct mntent *ent; char path[MAX_OSPATH]; struct stat st; diff --git a/irix/vid_so.c b/irix/vid_so.c index 0b1d4ed..10280e9 100644 --- a/irix/vid_so.c +++ b/irix/vid_so.c @@ -215,7 +215,7 @@ qboolean VID_LoadRefresh( char *name ) char fn[MAX_OSPATH]; struct stat st; extern uid_t saved_euid; - QFile *fp; + FILE *fp; char *path; char curpath[MAX_OSPATH]; diff --git a/linux/.gitignore b/linux/.gitignore index bdcee0e..47a24a1 100644 --- a/linux/.gitignore +++ b/linux/.gitignore @@ -1,6 +1,5 @@ *.d *.map -.vimrc debugi386 debugi386-glibc releasei386 diff --git a/linux/glw_linux.h b/linux/glw_linux.h index bf73353..cd04b0e 100644 --- a/linux/glw_linux.h +++ b/linux/glw_linux.h @@ -28,7 +28,7 @@ typedef struct { void *OpenGLLib; // instance of OpenGL library - QFile *log_fp; + FILE *log_fp; } glwstate_t; extern glwstate_t glw_state; diff --git a/linux/qgl_linux.c b/linux/qgl_linux.c index e99cd4c..f2cb670 100644 --- a/linux/qgl_linux.c +++ b/linux/qgl_linux.c @@ -743,179 +743,179 @@ static void ( APIENTRY * dllViewport )(GLint x, GLint y, GLsizei width, GLsizei static void APIENTRY logAccum(GLenum op, GLfloat value) { - Qprintf( glw_state.log_fp, "glAccum\n" ); + fprintf( glw_state.log_fp, "glAccum\n" ); dllAccum( op, value ); } static void APIENTRY logAlphaFunc(GLenum func, GLclampf ref) { - Qprintf( glw_state.log_fp, "glAlphaFunc( 0x%x, %f )\n", func, ref ); + fprintf( glw_state.log_fp, "glAlphaFunc( 0x%x, %f )\n", func, ref ); dllAlphaFunc( func, ref ); } static GLboolean APIENTRY logAreTexturesResident(GLsizei n, const GLuint *textures, GLboolean *residences) { - Qprintf( glw_state.log_fp, "glAreTexturesResident\n" ); + fprintf( glw_state.log_fp, "glAreTexturesResident\n" ); return dllAreTexturesResident( n, textures, residences ); } static void APIENTRY logArrayElement(GLint i) { - Qprintf( glw_state.log_fp, "glArrayElement\n" ); + fprintf( glw_state.log_fp, "glArrayElement\n" ); dllArrayElement( i ); } static void APIENTRY logBegin(GLenum mode) { - Qprintf( glw_state.log_fp, "glBegin( 0x%x )\n", mode ); + fprintf( glw_state.log_fp, "glBegin( 0x%x )\n", mode ); dllBegin( mode ); } static void APIENTRY logBindTexture(GLenum target, GLuint texture) { - Qprintf( glw_state.log_fp, "glBindTexture( 0x%x, %u )\n", target, texture ); + fprintf( glw_state.log_fp, "glBindTexture( 0x%x, %u )\n", target, texture ); dllBindTexture( target, texture ); } static void APIENTRY logBitmap(GLsizei width, GLsizei height, GLfloat xorig, GLfloat yorig, GLfloat xmove, GLfloat ymove, const GLubyte *bitmap) { - Qprintf( glw_state.log_fp, "glBitmap\n" ); + fprintf( glw_state.log_fp, "glBitmap\n" ); dllBitmap( width, height, xorig, yorig, xmove, ymove, bitmap ); } static void APIENTRY logBlendFunc(GLenum sfactor, GLenum dfactor) { - Qprintf( glw_state.log_fp, "glBlendFunc( 0x%x, 0x%x )\n", sfactor, dfactor ); + fprintf( glw_state.log_fp, "glBlendFunc( 0x%x, 0x%x )\n", sfactor, dfactor ); dllBlendFunc( sfactor, dfactor ); } static void APIENTRY logCallList(GLuint list) { - Qprintf( glw_state.log_fp, "glCallList( %u )\n", list ); + fprintf( glw_state.log_fp, "glCallList( %u )\n", list ); dllCallList( list ); } static void APIENTRY logCallLists(GLsizei n, GLenum type, const void *lists) { - Qprintf( glw_state.log_fp, "glCallLists\n" ); + fprintf( glw_state.log_fp, "glCallLists\n" ); dllCallLists( n, type, lists ); } static void APIENTRY logClear(GLbitfield mask) { - Qprintf( glw_state.log_fp, "glClear\n" ); + fprintf( glw_state.log_fp, "glClear\n" ); dllClear( mask ); } static void APIENTRY logClearAccum(GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha) { - Qprintf( glw_state.log_fp, "glClearAccum\n" ); + fprintf( glw_state.log_fp, "glClearAccum\n" ); dllClearAccum( red, green, blue, alpha ); } static void APIENTRY logClearColor(GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha) { - Qprintf( glw_state.log_fp, "glClearColor\n" ); + fprintf( glw_state.log_fp, "glClearColor\n" ); dllClearColor( red, green, blue, alpha ); } static void APIENTRY logClearDepth(GLclampd depth) { - Qprintf( glw_state.log_fp, "glClearDepth\n" ); + fprintf( glw_state.log_fp, "glClearDepth\n" ); dllClearDepth( depth ); } static void APIENTRY logClearIndex(GLfloat c) { - Qprintf( glw_state.log_fp, "glClearIndex\n" ); + fprintf( glw_state.log_fp, "glClearIndex\n" ); dllClearIndex( c ); } static void APIENTRY logClearStencil(GLint s) { - Qprintf( glw_state.log_fp, "glClearStencil\n" ); + fprintf( glw_state.log_fp, "glClearStencil\n" ); dllClearStencil( s ); } static void APIENTRY logClipPlane(GLenum plane, const GLdouble *equation) { - Qprintf( glw_state.log_fp, "glClipPlane\n" ); + fprintf( glw_state.log_fp, "glClipPlane\n" ); dllClipPlane( plane, equation ); } static void APIENTRY logColor3b(GLbyte red, GLbyte green, GLbyte blue) { - Qprintf( glw_state.log_fp, "glColor3b\n" ); + fprintf( glw_state.log_fp, "glColor3b\n" ); dllColor3b( red, green, blue ); } static void APIENTRY logColor3bv(const GLbyte *v) { - Qprintf( glw_state.log_fp, "glColor3bv\n" ); + fprintf( glw_state.log_fp, "glColor3bv\n" ); dllColor3bv( v ); } static void APIENTRY logColor3d(GLdouble red, GLdouble green, GLdouble blue) { - Qprintf( glw_state.log_fp, "glColor3d\n" ); + fprintf( glw_state.log_fp, "glColor3d\n" ); dllColor3d( red, green, blue ); } static void APIENTRY logColor3dv(const GLdouble *v) { - Qprintf( glw_state.log_fp, "glColor3dv\n" ); + fprintf( glw_state.log_fp, "glColor3dv\n" ); dllColor3dv( v ); } static void APIENTRY logColor3f(GLfloat red, GLfloat green, GLfloat blue) { - Qprintf( glw_state.log_fp, "glColor3f\n" ); + fprintf( glw_state.log_fp, "glColor3f\n" ); dllColor3f( red, green, blue ); } static void APIENTRY logColor3fv(const GLfloat *v) { - Qprintf( glw_state.log_fp, "glColor3fv\n" ); + fprintf( glw_state.log_fp, "glColor3fv\n" ); dllColor3fv( v ); } static void APIENTRY logColor3i(GLint red, GLint green, GLint blue) { - Qprintf( glw_state.log_fp, "glColor3i\n" ); + fprintf( glw_state.log_fp, "glColor3i\n" ); dllColor3i( red, green, blue ); } static void APIENTRY logColor3iv(const GLint *v) { - Qprintf( glw_state.log_fp, "glColor3iv\n" ); + fprintf( glw_state.log_fp, "glColor3iv\n" ); dllColor3iv( v ); } static void APIENTRY logColor3s(GLshort red, GLshort green, GLshort blue) { - Qprintf( glw_state.log_fp, "glColor3s\n" ); + fprintf( glw_state.log_fp, "glColor3s\n" ); dllColor3s( red, green, blue ); } static void APIENTRY logColor3sv(const GLshort *v) { - Qprintf( glw_state.log_fp, "glColor3sv\n" ); + fprintf( glw_state.log_fp, "glColor3sv\n" ); dllColor3sv( v ); } static void APIENTRY logColor3ub(GLubyte red, GLubyte green, GLubyte blue) { - Qprintf( glw_state.log_fp, "glColor3ub\n" ); + fprintf( glw_state.log_fp, "glColor3ub\n" ); dllColor3ub( red, green, blue ); } static void APIENTRY logColor3ubv(const GLubyte *v) { - Qprintf( glw_state.log_fp, "glColor3ubv\n" ); + fprintf( glw_state.log_fp, "glColor3ubv\n" ); dllColor3ubv( v ); } -#define SIG( x ) Qprintf( glw_state.log_fp, x "\n" ) +#define SIG( x ) fprintf( glw_state.log_fp, x "\n" ) static void APIENTRY logColor3ui(GLuint red, GLuint green, GLuint blue) { @@ -965,12 +965,12 @@ static void APIENTRY logColor4dv(const GLdouble *v) } static void APIENTRY logColor4f(GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha) { - Qprintf( glw_state.log_fp, "glColor4f( %f,%f,%f,%f )\n", red, green, blue, alpha ); + fprintf( glw_state.log_fp, "glColor4f( %f,%f,%f,%f )\n", red, green, blue, alpha ); dllColor4f( red, green, blue, alpha ); } static void APIENTRY logColor4fv(const GLfloat *v) { - Qprintf( glw_state.log_fp, "glColor4fv( %f,%f,%f,%f )\n", v[0], v[1], v[2], v[3] ); + fprintf( glw_state.log_fp, "glColor4fv( %f,%f,%f,%f )\n", v[0], v[1], v[2], v[3] ); dllColor4fv( v ); } static void APIENTRY logColor4i(GLint red, GLint green, GLint blue, GLint alpha) @@ -1108,7 +1108,7 @@ static void APIENTRY logDepthRange(GLclampd zNear, GLclampd zFar) static void APIENTRY logDisable(GLenum cap) { - Qprintf( glw_state.log_fp, "glDisable( 0x%x )\n", cap ); + fprintf( glw_state.log_fp, "glDisable( 0x%x )\n", cap ); dllDisable( cap ); } @@ -1162,7 +1162,7 @@ static void APIENTRY logEdgeFlagv(const GLboolean *flag) static void APIENTRY logEnable(GLenum cap) { - Qprintf( glw_state.log_fp, "glEnable( 0x%x )\n", cap ); + fprintf( glw_state.log_fp, "glEnable( 0x%x )\n", cap ); dllEnable( cap ); } @@ -1490,7 +1490,7 @@ static void APIENTRY logGetTexParameteriv(GLenum target, GLenum pname, GLint *pa static void APIENTRY logHint(GLenum target, GLenum mode) { - Qprintf( glw_state.log_fp, "glHint( 0x%x, 0x%x )\n", target, mode ); + fprintf( glw_state.log_fp, "glHint( 0x%x, 0x%x )\n", target, mode ); dllHint( target, mode ); } @@ -1909,7 +1909,7 @@ static void APIENTRY logPointSize(GLfloat size) static void APIENTRY logPolygonMode(GLenum face, GLenum mode) { - Qprintf( glw_state.log_fp, "glPolygonMode( 0x%x, 0x%x )\n", face, mode ); + fprintf( glw_state.log_fp, "glPolygonMode( 0x%x, 0x%x )\n", face, mode ); dllPolygonMode( face, mode ); } @@ -2389,7 +2389,7 @@ static void APIENTRY logTexCoordPointer(GLint size, GLenum type, GLsizei stride, static void APIENTRY logTexEnvf(GLenum target, GLenum pname, GLfloat param) { - Qprintf( glw_state.log_fp, "glTexEnvf( 0x%x, 0x%x, %f )\n", target, pname, param ); + fprintf( glw_state.log_fp, "glTexEnvf( 0x%x, 0x%x, %f )\n", target, pname, param ); dllTexEnvf( target, pname, param ); } @@ -2401,7 +2401,7 @@ static void APIENTRY logTexEnvfv(GLenum target, GLenum pname, const GLfloat *par static void APIENTRY logTexEnvi(GLenum target, GLenum pname, GLint param) { - Qprintf( glw_state.log_fp, "glTexEnvi( 0x%x, 0x%x, 0x%x )\n", target, pname, param ); + fprintf( glw_state.log_fp, "glTexEnvi( 0x%x, 0x%x, 0x%x )\n", target, pname, param ); dllTexEnvi( target, pname, param ); } static void APIENTRY logTexEnviv(GLenum target, GLenum pname, const GLint *params) @@ -2455,7 +2455,7 @@ static void APIENTRY logTexImage2D(GLenum target, GLint level, GLint internalfor static void APIENTRY logTexParameterf(GLenum target, GLenum pname, GLfloat param) { - Qprintf( glw_state.log_fp, "glTexParameterf( 0x%x, 0x%x, %f )\n", target, pname, param ); + fprintf( glw_state.log_fp, "glTexParameterf( 0x%x, 0x%x, %f )\n", target, pname, param ); dllTexParameterf( target, pname, param ); } @@ -2466,7 +2466,7 @@ static void APIENTRY logTexParameterfv(GLenum target, GLenum pname, const GLfloa } static void APIENTRY logTexParameteri(GLenum target, GLenum pname, GLint param) { - Qprintf( glw_state.log_fp, "glTexParameteri( 0x%x, 0x%x, 0x%x )\n", target, pname, param ); + fprintf( glw_state.log_fp, "glTexParameteri( 0x%x, 0x%x, 0x%x )\n", target, pname, param ); dllTexParameteri( target, pname, param ); } static void APIENTRY logTexParameteriv(GLenum target, GLenum pname, const GLint *params) @@ -3025,19 +3025,19 @@ qboolean QGL_Init( const char *dllname ) char fn[MAX_OSPATH]; char *path; #if 0 - QFile *fp; + FILE *fp; #endif // ri.Con_Printf(PRINT_ALL, "QGL_Init: Can't load %s from /etc/ld.so.conf: %s\n", // dllname, dlerror()); #if 0 - if ((fp = Qopen(so_file, "r")) == NULL) { + if ((fp = fopen(so_file, "r")) == NULL) { ri.Con_Printf(PRINT_ALL, "QGL_Init(\"%s\") failed: can't open %s\n", dllname, so_file); return false; } - Qgets(fn, sizeof(fn), fp); - Qclose(fp); + fgets(fn, sizeof(fn), fp); + fclose(fp); while (*fn && isspace(fn[strlen(fn) - 1])) fn[strlen(fn) - 1] = 0; #endif @@ -3433,9 +3433,9 @@ void GLimp_EnableLogging( qboolean enable ) asctime( newtime ); Com_sprintf( buffer, sizeof(buffer), "%s/gl.log", ri.FS_Gamedir() ); - glw_state.log_fp = Qopen( buffer, "wt" ); + glw_state.log_fp = fopen( buffer, "wt" ); - Qprintf( glw_state.log_fp, "%s\n", asctime( newtime ) ); + fprintf( glw_state.log_fp, "%s\n", asctime( newtime ) ); } qglAccum = logAccum; @@ -4119,7 +4119,7 @@ void GLimp_EnableLogging( qboolean enable ) void GLimp_LogNewFrame( void ) { - Qprintf( glw_state.log_fp, "*** R_BeginFrame ***\n" ); + fprintf( glw_state.log_fp, "*** R_BeginFrame ***\n" ); } diff --git a/linux/sys_linux.c b/linux/sys_linux.c index 3099258..3279609 100644 --- a/linux/sys_linux.c +++ b/linux/sys_linux.c @@ -250,7 +250,7 @@ void *Sys_GetGameAPI (void *parms) Com_DPrintf ("LoadLibrary (%s)\n",name); break; } else { - Com_DPrintf ("LoadLibrary (%s) failed %s\n", name, dlerror()); + Com_DPrintf ("LoadLibrary (%s) failed\n", name, dlerror()); } } @@ -324,7 +324,7 @@ int main (int argc, char **argv) #if 0 void Sys_CopyProtect(void) { - QFile *mnt; + FILE *mnt; struct mntent *ent; char path[MAX_OSPATH]; struct stat st; diff --git a/linux/vid_so.c b/linux/vid_so.c index 7ecd484..abf0cc9 100644 --- a/linux/vid_so.c +++ b/linux/vid_so.c @@ -206,7 +206,7 @@ qboolean VID_LoadRefresh( char *name ) struct stat st; extern uid_t saved_euid; #if 0 - QFile *fp; + FILE *fp; #endif if ( reflib_active ) @@ -227,12 +227,12 @@ qboolean VID_LoadRefresh( char *name ) seteuid(saved_euid); #if 0 - if ((fp = Qopen(so_file, "r")) == NULL) { + if ((fp = fopen(so_file, "r")) == NULL) { Com_Printf( "LoadLibrary(\"%s\") failed: can't open %s (required for location of ref libraries)\n", name, so_file); return false; } - Qgets(fn, sizeof(fn), fp); - Qclose(fp); + fgets(fn, sizeof(fn), fp); + fclose(fp); while (*fn && isspace(fn[strlen(fn) - 1])) fn[strlen(fn) - 1] = 0; diff --git a/qcommon/.gitignore b/qcommon/.gitignore index 2cc377c..a438335 100644 --- a/qcommon/.gitignore +++ b/qcommon/.gitignore @@ -1,2 +1 @@ *.d -.vimrc diff --git a/qcommon/cmodel.c b/qcommon/cmodel.c index fc699ae..7fc6879 100644 --- a/qcommon/cmodel.c +++ b/qcommon/cmodel.c @@ -1718,9 +1718,9 @@ CM_WritePortalState Writes the portal state to a savegame file =================== */ -void CM_WritePortalState (QFile *f) +void CM_WritePortalState (FILE *f) { - Qwrite (f, portalopen, sizeof(portalopen)); + fwrite (portalopen, sizeof(portalopen), 1, f); } /* @@ -1731,7 +1731,7 @@ Reads the portal state from a savegame file and recalculates the area connections =================== */ -void CM_ReadPortalState (QFile *f) +void CM_ReadPortalState (FILE *f) { FS_Read (portalopen, sizeof(portalopen), f); FloodAreaConnections (); diff --git a/qcommon/common.c b/qcommon/common.c index 63ea45c..ef1a661 100644 --- a/qcommon/common.c +++ b/qcommon/common.c @@ -34,7 +34,7 @@ int realtime; jmp_buf abortframe; // an ERR_DROP occured, exit the entire frame -QFile *log_stats_file; +FILE *log_stats_file; cvar_t *host_speeds; cvar_t *log_stats; @@ -45,7 +45,7 @@ cvar_t *logfile_active; // 1 = buffer log, 2 = flush after each print cvar_t *showtrace; cvar_t *dedicated; -QFile *logfile; +FILE *logfile; int server_state; @@ -132,14 +132,14 @@ void Com_Printf (char *fmt, ...) { Com_sprintf (name, sizeof(name), "%s/qconsole.log", FS_Gamedir ()); if (logfile_active->value > 2) - logfile = Qopen (name, "a"); + logfile = fopen (name, "a"); else - logfile = Qopen (name, "w"); + logfile = fopen (name, "w"); } if (logfile) - Qprintf (logfile, "%s", msg); + fprintf (logfile, "%s", msg); if (logfile_active->value > 1) - Qflush (logfile); // force it to save every time + fflush (logfile); // force it to save every time } } @@ -211,7 +211,7 @@ void Com_Error (int code, char *fmt, ...) if (logfile) { - Qclose (logfile); + fclose (logfile); logfile = NULL; } @@ -234,7 +234,7 @@ void Com_Quit (void) if (logfile) { - Qclose (logfile); + fclose (logfile); logfile = NULL; } @@ -1506,18 +1506,18 @@ void Qcommon_Frame (volatile int msec) { if ( log_stats_file ) { - Qclose( log_stats_file ); + fclose( log_stats_file ); log_stats_file = 0; } - log_stats_file = Qopen( "stats.log", "w" ); + log_stats_file = fopen( "stats.log", "w" ); if ( log_stats_file ) - Qprintf( log_stats_file, "entities,dlights,parts,frame time\n" ); + fprintf( log_stats_file, "entities,dlights,parts,frame time\n" ); } else { if ( log_stats_file ) { - Qclose( log_stats_file ); + fclose( log_stats_file ); log_stats_file = 0; } } diff --git a/qcommon/cvar.c b/qcommon/cvar.c index 43d28de..29a12df 100644 --- a/qcommon/cvar.c +++ b/qcommon/cvar.c @@ -430,18 +430,18 @@ void Cvar_WriteVariables (char *path) { cvar_t *var; char buffer[1024]; - QFile *f; + FILE *f; - f = Qopen (path, "a"); + f = fopen (path, "a"); for (var = cvar_vars ; var ; var = var->next) { if (var->flags & CVAR_ARCHIVE) { Com_sprintf (buffer, sizeof(buffer), "set %s \"%s\"\n", var->name, var->string); - Qprintf (f, "%s", buffer); + fprintf (f, "%s", buffer); } } - Qclose (f); + fclose (f); } /* diff --git a/qcommon/files.c b/qcommon/files.c index 14c7458..1bcfdc2 100644 --- a/qcommon/files.c +++ b/qcommon/files.c @@ -18,11 +18,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -#include -#include -#include -#include - #include "qcommon.h" // define this to dissalow any data but the demo pak file @@ -58,7 +53,7 @@ typedef struct typedef struct pack_s { char filename[MAX_OSPATH]; - QFile *handle; + FILE *handle; int numfiles; packfile_t *files; } pack_t; @@ -106,15 +101,15 @@ The "game directory" is the first tree on the search path and directory that all FS_filelength ================ */ -int FS_filelength (QFile *f) +int FS_filelength (FILE *f) { int pos; int end; - pos = Qtell (f); - Qseek (f, 0, SEEK_END); - end = Qtell (f); - Qseek (f, pos, SEEK_SET); + pos = ftell (f); + fseek (f, 0, SEEK_END); + end = ftell (f); + fseek (f, pos, SEEK_SET); return end; } @@ -147,13 +142,13 @@ void FS_CreatePath (char *path) ============== FS_FCloseFile -For some reason, other dll's can't just cal Qclose() +For some reason, other dll's can't just cal fclose() on files returned by FS_FOpenFile... ============== */ -void FS_FCloseFile (QFile *f) +void FS_FCloseFile (FILE *f) { - Qclose (f); + fclose (f); } @@ -196,74 +191,25 @@ int Developer_searchpath (int who) } -QFile * -FS_OpenRead (const char *path, int offs, int len, int zip, int *size) -{ - int fd = open (path, O_RDONLY); - unsigned char id[2]; - unsigned char len_bytes[4]; - - if (fd == -1) - return 0; - if (offs < 0 || len < 0) { - // normal file - offs = 0; - len = lseek (fd, 0, SEEK_END); - lseek (fd, 0, SEEK_SET); - } - lseek (fd, offs, SEEK_SET); - if (zip) { - read (fd, id, 2); - if (id[0] == 0x1f && id[1] == 0x8b) { - lseek (fd, offs + len - 4, SEEK_SET); - read (fd, len_bytes, 4); - len = ((len_bytes[3] << 24) - | (len_bytes[2] << 16) - | (len_bytes[1] << 8) - | (len_bytes[0])); - } - } - lseek (fd, offs, SEEK_SET); - *size = len; -#ifdef WIN32 - setmode (fd, O_BINARY); -#endif - if (zip) - return Qdopen (fd, "rbz"); - else - return Qdopen (fd, "rb"); -} - - /* =========== FS_FOpenFile Finds the file in the search path. -returns filesize and an open QFile * +returns filesize and an open FILE * Used for streaming data out of either a pak file or a seperate file. =========== */ int file_from_pak = 0; - -int _FS_FOpenFile (char *filename, QFile **file, char *foundname, int zip) +#ifndef NO_ADDONS +int FS_FOpenFile (char *filename, FILE **file) { searchpath_t *search; char netpath[MAX_OSPATH]; pack_t *pak; int i; filelink_t *link; - int size; - -#ifdef HAVE_ZLIB - char gzfilename[MAX_OSPATH]; - int filenamelen; - - filenamelen = strlen (filename); - strncpy (gzfilename, filename, sizeof (gzfilename)); - strncat (gzfilename, ".gz", sizeof (gzfilename) - strlen (gzfilename)); -#endif file_from_pak = 0; @@ -273,18 +219,11 @@ int _FS_FOpenFile (char *filename, QFile **file, char *foundname, int zip) if (!strncmp (filename, link->from, link->fromlength)) { Com_sprintf (netpath, sizeof(netpath), "%s%s",link->to, filename+link->fromlength); - *file = FS_OpenRead (netpath, -1, -1, zip, &size); -#ifdef HAVE_ZLIB - if (!*file) { - Com_sprintf (netpath, sizeof(netpath), "%s%s.gz",link->to, filename+link->fromlength); - *file = FS_OpenRead (netpath, -1, -1, zip, &size); - } -#endif + *file = fopen (netpath, "rb"); if (*file) { - strncpy (foundname, netpath, MAX_OSPATH); Com_DPrintf ("link file: %s\n",netpath); - return size; + return FS_filelength (*file); } return -1; } @@ -301,22 +240,16 @@ int _FS_FOpenFile (char *filename, QFile **file, char *foundname, int zip) // look through all the pak file elements pak = search->pack; for (i=0 ; inumfiles ; i++) - if (!Q_strcasecmp (pak->files[i].name, filename) -#ifdef HAVE_ZLIB - || !Q_strcasecmp (pak->files[i].name, gzfilename) -#endif - ) + 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 - strncpy (foundname, pak->files[i].name, MAX_OSPATH); - *file = FS_OpenRead (pak->filename, - pak->files[i].filepos, - pak->files[i].filelen, zip, &size); + *file = fopen (pak->filename, "rb"); if (!*file) - Com_Error (ERR_FATAL, "Couldn't open %s", foundname); - return size; + Com_Error (ERR_FATAL, "Couldn't reopen %s", pak->filename); + fseek (*file, pak->files[i].filepos, SEEK_SET); + return pak->files[i].filelen; } } else @@ -325,20 +258,13 @@ int _FS_FOpenFile (char *filename, QFile **file, char *foundname, int zip) Com_sprintf (netpath, sizeof(netpath), "%s/%s",search->filename, filename); - *file = FS_OpenRead (netpath, -1, -1, zip, &size); -#ifdef HAVE_ZLIB - if (!*file) { - Com_sprintf (netpath, sizeof(netpath), "%s/%s.gz",search->filename, filename); - *file = FS_OpenRead (netpath, -1, -1, zip, &size); - } -#endif + *file = fopen (netpath, "rb"); if (!*file) continue; - strncpy (foundname, netpath, MAX_OSPATH); Com_DPrintf ("FindFile: %s\n",netpath); - return size; + return FS_filelength (*file); } } @@ -349,14 +275,64 @@ int _FS_FOpenFile (char *filename, QFile **file, char *foundname, int zip) return -1; } -int -FS_FOpenFile (char *filename, QFile **gzfile) -{ - char foundname[MAX_OSPATH]; +#else - return _FS_FOpenFile (filename, gzfile, foundname, 1); +// this is just for demos to prevent add on hacking + +int FS_FOpenFile (char *filename, FILE **file) +{ + searchpath_t *search; + char netpath[MAX_OSPATH]; + 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)) + { + Com_sprintf (netpath, sizeof(netpath), "%s/%s",FS_Gamedir(), filename); + + *file = fopen (netpath, "rb"); + if (!*file) + return -1; + + Com_DPrintf ("FindFile: %s\n",netpath); + + return FS_filelength (*file); + } + + for (search = fs_searchpaths ; search ; search = search->next) + if (search->pack) + break; + if (!search) + { + *file = NULL; + return -1; + } + + pak = search->pack; + 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"); + if (!*file) + Com_Error (ERR_FATAL, "Couldn't reopen %s", pak->filename); + fseek (*file, pak->files[i].filepos, SEEK_SET); + return pak->files[i].filelen; + } + + Com_DPrintf ("FindFile: can't find %s\n", filename); + + *file = NULL; + return -1; } +#endif + /* ================= @@ -367,7 +343,7 @@ Properly handles partial reads */ void CDAudio_Stop(void); #define MAX_READ 0x10000 // read in blocks of 64k -void FS_Read (void *buffer, int len, QFile *f) +void FS_Read (void *buffer, int len, FILE *f) { int block, remaining; int read; @@ -384,7 +360,7 @@ void FS_Read (void *buffer, int len, QFile *f) block = remaining; if (block > MAX_READ) block = MAX_READ; - read = Qread (f, buf, block); + read = fread (buf, 1, block, f); if (read == 0) { // we might have been trying to read from a CD @@ -417,7 +393,7 @@ a null buffer will just return the file length without loading */ int FS_LoadFile (char *path, void **buffer) { - QFile *h; + FILE *h; byte *buf; int len; @@ -434,7 +410,7 @@ int FS_LoadFile (char *path, void **buffer) if (!buffer) { - Qclose (h); + fclose (h); return len; } @@ -443,7 +419,7 @@ int FS_LoadFile (char *path, void **buffer) FS_Read (buf, len, h); - Qclose (h); + fclose (h); return len; } @@ -476,15 +452,15 @@ pack_t *FS_LoadPackFile (char *packfile) packfile_t *newfiles; int numpackfiles; pack_t *pack; - QFile *packhandle; + FILE *packhandle; dpackfile_t info[MAX_FILES_IN_PACK]; unsigned checksum; - packhandle = Qopen(packfile, "rb"); + packhandle = fopen(packfile, "rb"); if (!packhandle) return NULL; - Qread (packhandle, &header, sizeof(header)); + fread (&header, 1, sizeof(header), packhandle); if (LittleLong(header.ident) != IDPAKHEADER) Com_Error (ERR_FATAL, "%s is not a packfile", packfile); header.dirofs = LittleLong (header.dirofs); @@ -497,8 +473,8 @@ pack_t *FS_LoadPackFile (char *packfile) newfiles = Z_Malloc (numpackfiles * sizeof(packfile_t)); - Qseek (packhandle, header.dirofs, SEEK_SET); - Qread (packhandle, info, header.dirlen); + fseek (packhandle, header.dirofs, SEEK_SET); + fread (info, 1, header.dirlen, packhandle); // crc the directory to check for modifications checksum = Com_BlockChecksum ((void *)info, header.dirlen); @@ -654,7 +630,7 @@ void FS_SetGamedir (char *dir) { if (fs_searchpaths->pack) { - Qclose (fs_searchpaths->pack->handle); + fclose (fs_searchpaths->pack->handle); Z_Free (fs_searchpaths->pack->files); Z_Free (fs_searchpaths->pack); } diff --git a/qcommon/qcommon.h b/qcommon/qcommon.h index 2d301ac..13eb26f 100644 --- a/qcommon/qcommon.h +++ b/qcommon/qcommon.h @@ -21,7 +21,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. // qcommon.h -- definitions common between client and server, but not game.dll #include "../game/q_shared.h" -#include "../qcommon/quakeio.h" + #define VERSION 3.21 @@ -667,8 +667,8 @@ qboolean CM_AreasConnected (int area1, int area2); int CM_WriteAreaBits (byte *buffer, int area); qboolean CM_HeadnodeVisible (int headnode, byte *visbits); -void CM_WritePortalState (QFile *f); -void CM_ReadPortalState (QFile *f); +void CM_WritePortalState (FILE *f); +void CM_ReadPortalState (FILE *f); /* ============================================================== @@ -698,15 +698,15 @@ char *FS_Gamedir (void); char *FS_NextPath (char *prevpath); void FS_ExecAutoexec (void); -int FS_FOpenFile (char *filename, QFile **file); -void FS_FCloseFile (QFile *f); +int FS_FOpenFile (char *filename, FILE **file); +void FS_FCloseFile (FILE *f); // note: this can't be called from another DLL, due to MS libc issues int FS_LoadFile (char *path, void **buffer); // a null buffer will just return the file length without loading // a -1 length is not present -void FS_Read (void *buffer, int len, QFile *f); +void FS_Read (void *buffer, int len, FILE *f); // properly handles partial reads void FS_FreeFile (void *buffer); @@ -755,7 +755,7 @@ extern cvar_t *dedicated; extern cvar_t *host_speeds; extern cvar_t *log_stats; -extern QFile *log_stats_file; +extern FILE *log_stats_file; // host_speeds times extern int time_before_game; diff --git a/ref_gl/gl_rmisc.c b/ref_gl/gl_rmisc.c index 0c572f5..b1753ff 100644 --- a/ref_gl/gl_rmisc.c +++ b/ref_gl/gl_rmisc.c @@ -119,7 +119,7 @@ void GL_ScreenShot_f (void) char picname[80]; char checkname[MAX_OSPATH]; int i, c, temp; - QFile *f; + FILE *f; // create the scrnshots directory if it doesn't exist Com_sprintf (checkname, sizeof(checkname), "%s/scrnshot", ri.FS_Gamedir()); @@ -135,10 +135,10 @@ void GL_ScreenShot_f (void) picname[5] = i/10 + '0'; picname[6] = i%10 + '0'; Com_sprintf (checkname, sizeof(checkname), "%s/scrnshot/%s", ri.FS_Gamedir(), picname); - f = Qopen (checkname, "rb"); + f = fopen (checkname, "rb"); if (!f) break; // file doesn't exist - Qclose (f); + fclose (f); } if (i==100) { @@ -167,9 +167,9 @@ void GL_ScreenShot_f (void) buffer[i+2] = temp; } - f = Qopen (checkname, "wb"); - Qwrite (f, buffer, c); - Qclose (f); + f = fopen (checkname, "wb"); + fwrite (buffer, 1, c, f); + fclose (f); free (buffer); ri.Con_Printf (PRINT_ALL, "Wrote %s\n", picname); diff --git a/ref_soft/r_misc.c b/ref_soft/r_misc.c index b00be57..ce6837c 100644 --- a/ref_soft/r_misc.c +++ b/ref_soft/r_misc.c @@ -550,7 +550,7 @@ void WritePCXfile (char *filename, byte *data, int width, int height, int i, j, length; pcx_t *pcx; byte *pack; - QFile *f; + FILE *f; pcx = (pcx_t *)malloc (width*height*2+1000); if (!pcx) @@ -598,13 +598,13 @@ void WritePCXfile (char *filename, byte *data, int width, int height, // write output file length = pack - (byte *)pcx; - f = Qopen (filename, "wb"); + f = fopen (filename, "wb"); if (!f) ri.Con_Printf (PRINT_ALL, "Failed to open to %s\n", filename); else { - Qwrite (f, (void *)pcx, length); - Qclose (f); + fwrite ((void *)pcx, 1, length, f); + fclose (f); } free (pcx); @@ -622,7 +622,7 @@ void R_ScreenShot_f (void) int i; char pcxname[80]; char checkname[MAX_OSPATH]; - QFile *f; + FILE *f; byte palette[768]; // create the scrnshots directory if it doesn't exist @@ -639,10 +639,10 @@ void R_ScreenShot_f (void) pcxname[5] = i/10 + '0'; pcxname[6] = i%10 + '0'; Com_sprintf (checkname, sizeof(checkname), "%s/scrnshot/%s", ri.FS_Gamedir(), pcxname); - f = Qopen (checkname, "r"); + f = fopen (checkname, "r"); if (!f) break; // file doesn't exist - Qclose (f); + fclose (f); } if (i==100) { diff --git a/server/.gitignore b/server/.gitignore index 2cc377c..a438335 100644 --- a/server/.gitignore +++ b/server/.gitignore @@ -1,2 +1 @@ *.d -.vimrc diff --git a/server/server.h b/server/server.h index 7e8a76b..a8d30ca 100644 --- a/server/server.h +++ b/server/server.h @@ -62,7 +62,7 @@ typedef struct byte multicast_buf[MAX_MSGLEN]; // demo server information - QFile *demofile; + FILE *demofile; qboolean timedemo; // don't time sync } server_t; @@ -175,7 +175,7 @@ typedef struct challenge_t challenges[MAX_CHALLENGES]; // to prevent invalid IPs from connecting // serverrecord values - QFile *demofile; + FILE *demofile; sizebuf_t demo_multicast; byte demo_multicast_buf[MAX_MSGLEN]; } server_static_t; diff --git a/server/sv_ccmds.c b/server/sv_ccmds.c index 8aabca0..ebe6203 100644 --- a/server/sv_ccmds.c +++ b/server/sv_ccmds.c @@ -191,32 +191,32 @@ CopyFile */ void CopyFile (char *src, char *dst) { - QFile *f1, *f2; + FILE *f1, *f2; int l; byte buffer[65536]; Com_DPrintf ("CopyFile (%s, %s)\n", src, dst); - f1 = Qopen (src, "rb"); + f1 = fopen (src, "rb"); if (!f1) return; - f2 = Qopen (dst, "wb"); + f2 = fopen (dst, "wb"); if (!f2) { - Qclose (f1); + fclose (f1); return; } while (1) { - l = Qread (f1, buffer, sizeof(buffer)); + l = fread (buffer, 1, sizeof(buffer), f1); if (!l) break; - Qwrite (f2, buffer, l); + fwrite (buffer, 1, l, f2); } - Qclose (f1); - Qclose (f2); + fclose (f1); + fclose (f2); } @@ -278,20 +278,20 @@ SV_WriteLevelFile void SV_WriteLevelFile (void) { char name[MAX_OSPATH]; - QFile *f; + FILE *f; Com_DPrintf("SV_WriteLevelFile()\n"); Com_sprintf (name, sizeof(name), "%s/save/current/%s.sv2", FS_Gamedir(), sv.name); - f = Qopen(name, "wb"); + f = fopen(name, "wb"); if (!f) { Com_Printf ("Failed to open %s\n", name); return; } - Qwrite (f, sv.configstrings, sizeof(sv.configstrings)); + fwrite (sv.configstrings, sizeof(sv.configstrings), 1, f); CM_WritePortalState (f); - Qclose (f); + fclose (f); Com_sprintf (name, sizeof(name), "%s/save/current/%s.sav", FS_Gamedir(), sv.name); ge->WriteLevel (name); @@ -306,12 +306,12 @@ SV_ReadLevelFile void SV_ReadLevelFile (void) { char name[MAX_OSPATH]; - QFile *f; + FILE *f; Com_DPrintf("SV_ReadLevelFile()\n"); Com_sprintf (name, sizeof(name), "%s/save/current/%s.sv2", FS_Gamedir(), sv.name); - f = Qopen(name, "rbz"); + f = fopen(name, "rb"); if (!f) { Com_Printf ("Failed to open %s\n", name); @@ -319,7 +319,7 @@ void SV_ReadLevelFile (void) } FS_Read (sv.configstrings, sizeof(sv.configstrings), f); CM_ReadPortalState (f); - Qclose (f); + fclose (f); Com_sprintf (name, sizeof(name), "%s/save/current/%s.sav", FS_Gamedir(), sv.name); ge->ReadLevel (name); @@ -333,7 +333,7 @@ SV_WriteServerFile */ void SV_WriteServerFile (qboolean autosave) { - QFile *f; + FILE *f; cvar_t *var; char name[MAX_OSPATH], string[128]; char comment[32]; @@ -343,7 +343,7 @@ void SV_WriteServerFile (qboolean autosave) Com_DPrintf("SV_WriteServerFile(%s)\n", autosave ? "true" : "false"); Com_sprintf (name, sizeof(name), "%s/save/current/server.ssv", FS_Gamedir()); - f = Qopen (name, "wb"); + f = fopen (name, "wb"); if (!f) { Com_Printf ("Couldn't write %s\n", name); @@ -366,10 +366,10 @@ void SV_WriteServerFile (qboolean autosave) Com_sprintf (comment, sizeof(comment), "ENTERING %s", sv.configstrings[CS_NAME]); } - Qwrite (f, comment, sizeof(comment)); + fwrite (comment, 1, sizeof(comment), f); // write the mapcmd - Qwrite (f, svs.mapcmd, sizeof(svs.mapcmd)); + fwrite (svs.mapcmd, 1, sizeof(svs.mapcmd), f); // write all CVAR_LATCH cvars // these will be things like coop, skill, deathmatch, etc @@ -387,11 +387,11 @@ void SV_WriteServerFile (qboolean autosave) memset (string, 0, sizeof(string)); strcpy (name, var->name); strcpy (string, var->string); - Qwrite (f, name, sizeof(name)); - Qwrite (f, string, sizeof(string)); + fwrite (name, 1, sizeof(name), f); + fwrite (string, 1, sizeof(string), f); } - Qclose (f); + fclose (f); // write game state Com_sprintf (name, sizeof(name), "%s/save/current/game.ssv", FS_Gamedir()); @@ -406,7 +406,7 @@ SV_ReadServerFile */ void SV_ReadServerFile (void) { - QFile *f; + FILE *f; char name[MAX_OSPATH], string[128]; char comment[32]; char mapcmd[MAX_TOKEN_CHARS]; @@ -414,7 +414,7 @@ void SV_ReadServerFile (void) Com_DPrintf("SV_ReadServerFile()\n"); Com_sprintf (name, sizeof(name), "%s/save/current/server.ssv", FS_Gamedir()); - f = Qopen (name, "rbz"); + f = fopen (name, "rb"); if (!f) { Com_Printf ("Couldn't read %s\n", name); @@ -430,14 +430,14 @@ void SV_ReadServerFile (void) // these will be things like coop, skill, deathmatch, etc while (1) { - if (!Qread (f, name, sizeof(name))) + if (!fread (name, 1, sizeof(name), f)) break; FS_Read (string, sizeof(string), f); Com_DPrintf ("Set %s = %s\n", name, string); Cvar_ForceSet (name, string); } - Qclose (f); + fclose (f); // start a new game fresh with new cvars SV_InitGame (); @@ -594,7 +594,7 @@ SV_Loadgame_f void SV_Loadgame_f (void) { char name[MAX_OSPATH]; - QFile *f; + FILE *f; char *dir; if (Cmd_Argc() != 2) @@ -613,13 +613,13 @@ void SV_Loadgame_f (void) // make sure the server.ssv file exists Com_sprintf (name, sizeof(name), "%s/save/%s/server.ssv", FS_Gamedir(), Cmd_Argv(1)); - f = Qopen (name, "rb"); + f = fopen (name, "rb"); if (!f) { Com_Printf ("No such savegame: %s\n", name); return; } - Qclose (f); + fclose (f); SV_CopySaveGame (Cmd_Argv(1), "current"); @@ -912,7 +912,7 @@ void SV_ServerRecord_f (void) Com_Printf ("recording to %s.\n", name); FS_CreatePath (name); - svs.demofile = Qopen (name, "wb"); + svs.demofile = fopen (name, "wb"); if (!svs.demofile) { Com_Printf ("ERROR: couldn't open.\n"); @@ -953,8 +953,8 @@ void SV_ServerRecord_f (void) // write it to the demo file Com_DPrintf ("signon message length: %i\n", buf.cursize); len = LittleLong (buf.cursize); - Qwrite (svs.demofile, &len, 4); - Qwrite (svs.demofile, buf.data, buf.cursize); + fwrite (&len, 4, 1, svs.demofile); + fwrite (buf.data, buf.cursize, 1, svs.demofile); // the rest of the demo file will be individual frames } @@ -974,7 +974,7 @@ void SV_ServerStop_f (void) Com_Printf ("Not doing a serverrecord.\n"); return; } - Qclose (svs.demofile); + fclose (svs.demofile); svs.demofile = NULL; Com_Printf ("Recording completed.\n"); } diff --git a/server/sv_ents.c b/server/sv_ents.c index 117e739..3df6c4a 100644 --- a/server/sv_ents.c +++ b/server/sv_ents.c @@ -721,7 +721,7 @@ void SV_RecordDemoMessage (void) // now write the entire message to the file, prefixed by the length len = LittleLong (buf.cursize); - Qwrite (svs.demofile, &len, 4); - Qwrite (svs.demofile, buf.data, buf.cursize); + fwrite (&len, 4, 1, svs.demofile); + fwrite (buf.data, buf.cursize, 1, svs.demofile); } diff --git a/server/sv_init.c b/server/sv_init.c index 275f30d..c41382a 100644 --- a/server/sv_init.c +++ b/server/sv_init.c @@ -117,7 +117,7 @@ SV_CheckForSavegame void SV_CheckForSavegame (void) { char name[MAX_OSPATH]; - QFile *f; + FILE *f; int i; if (sv_noreload->value) @@ -127,11 +127,11 @@ void SV_CheckForSavegame (void) return; Com_sprintf (name, sizeof(name), "%s/save/current/%s.sav", FS_Gamedir(), sv.name); - f = Qopen (name, "rb"); + f = fopen (name, "rb"); if (!f) return; // no savegame - Qclose (f); + fclose (f); SV_ClearWorld (); @@ -178,7 +178,7 @@ void SV_SpawnServer (char *server, char *spawnpoint, server_state_t serverstate, Com_DPrintf ("SpawnServer: %s\n",server); if (sv.demofile) - Qclose (sv.demofile); + fclose (sv.demofile); svs.spawncount++; // any partially connected client will be // restarted diff --git a/server/sv_main.c b/server/sv_main.c index 9f7ff34..590aa67 100644 --- a/server/sv_main.c +++ b/server/sv_main.c @@ -1042,7 +1042,7 @@ void SV_Shutdown (char *finalmsg, qboolean reconnect) // free current level if (sv.demofile) - Qclose (sv.demofile); + fclose (sv.demofile); memset (&sv, 0, sizeof(sv)); Com_SetServerState (sv.state); @@ -1052,7 +1052,7 @@ void SV_Shutdown (char *finalmsg, qboolean reconnect) if (svs.client_entities) Z_Free (svs.client_entities); if (svs.demofile) - Qclose (svs.demofile); + fclose (svs.demofile); memset (&svs, 0, sizeof(svs)); } diff --git a/server/sv_send.c b/server/sv_send.c index ca3e841..70aeb14 100644 --- a/server/sv_send.c +++ b/server/sv_send.c @@ -441,7 +441,7 @@ void SV_DemoCompleted (void) { if (sv.demofile) { - Qclose (sv.demofile); + fclose (sv.demofile); sv.demofile = NULL; } SV_Nextserver (); @@ -505,8 +505,8 @@ void SV_SendClientMessages (void) else { // get the next message - r = Qread (sv.demofile, &msglen, 4); - if (r != 4) + r = fread (&msglen, 4, 1, sv.demofile); + if (r != 1) { SV_DemoCompleted (); return; @@ -519,8 +519,8 @@ void SV_SendClientMessages (void) } if (msglen > MAX_MSGLEN) Com_Error (ERR_DROP, "SV_SendClientMessages: msglen > MAX_MSGLEN"); - r = Qread (sv.demofile, msgbuf, msglen); - if (r != msglen) + r = fread (msgbuf, msglen, 1, sv.demofile); + if (r != 1) { SV_DemoCompleted (); return; diff --git a/solaris/sys_solaris.c b/solaris/sys_solaris.c index bd52c01..0890750 100644 --- a/solaris/sys_solaris.c +++ b/solaris/sys_solaris.c @@ -56,7 +56,7 @@ void Sys_ConsoleOutput (char *string) if (nostdout && nostdout->value) return; - Qputs(string, stdout); + fputs(string, stdout); } void Sys_Printf (char *fmt, ...) diff --git a/win32/glw_imp.c b/win32/glw_imp.c index 3ddf69a..943d878 100644 --- a/win32/glw_imp.c +++ b/win32/glw_imp.c @@ -323,7 +323,7 @@ void GLimp_Shutdown( void ) if ( glw_state.log_fp ) { - Qclose( glw_state.log_fp ); + fclose( glw_state.log_fp ); glw_state.log_fp = 0; } diff --git a/win32/glw_win.h b/win32/glw_win.h index e11ae67..ba7aa2b 100644 --- a/win32/glw_win.h +++ b/win32/glw_win.h @@ -39,7 +39,7 @@ typedef struct qboolean allowdisplaydepthchange; qboolean mcd_accelerated; - QFile *log_fp; + FILE *log_fp; } glwstate_t; extern glwstate_t glw_state; diff --git a/win32/qgl_win.c b/win32/qgl_win.c index f062768..09da1e9 100644 --- a/win32/qgl_win.c +++ b/win32/qgl_win.c @@ -3440,7 +3440,7 @@ void GLimp_EnableLogging( qboolean enable ) asctime( newtime ); Com_sprintf( buffer, sizeof(buffer), "%s/gl.log", ri.FS_Gamedir() ); - glw_state.log_fp = Qopen( buffer, "wt" ); + glw_state.log_fp = fopen( buffer, "wt" ); fprintf( glw_state.log_fp, "%s\n", asctime( newtime ) ); } diff --git a/win32/sys_win.c b/win32/sys_win.c index f14dfb3..02e5b90 100644 --- a/win32/sys_win.c +++ b/win32/sys_win.c @@ -140,7 +140,7 @@ char *Sys_ScanForCD (void) static qboolean done; #ifndef DEMO char drive[4]; - QFile *f; + FILE *f; char test[MAX_QPATH]; if (done) // don't re-check @@ -162,10 +162,10 @@ char *Sys_ScanForCD (void) // where activision put the stuff... sprintf (cddir, "%sinstall\\data", drive); sprintf (test, "%sinstall\\data\\quake2.exe", drive); - f = Qopen(test, "r"); + f = fopen(test, "r"); if (f) { - Qclose (f); + fclose (f); if (GetDriveType (drive) == DRIVE_CDROM) return cddir; }