diff --git a/Quake/common.c b/Quake/common.c index a8baa061..321b35a5 100644 --- a/Quake/common.c +++ b/Quake/common.c @@ -1212,9 +1212,6 @@ static void COM_CheckRegistered (void) if (h == -1) { Cvar_SetROM ("registered", "0"); -#if WINDED - Sys_Error ("This dedicated server requires a full registered copy of Quake"); -#endif Con_Printf ("Playing shareware version.\n"); if (com_modified) Sys_Error ("You must have the registered version to use modified games"); @@ -2166,6 +2163,18 @@ int FS_ferror(fshandle_t *fh) return ferror(fh->file); } +int FS_fgetc(fshandle_t *fh) +{ + if (!fh) { + errno = EBADF; + return EOF; + } + if (fh->pos >= fh->length) + return EOF; + fh->pos += 1; + return fgetc(fh->file); +} + char *FS_fgets(char *s, int size, fshandle_t *fh) { char *ret; diff --git a/Quake/common.h b/Quake/common.h index d04ea501..4cfc36d3 100644 --- a/Quake/common.h +++ b/Quake/common.h @@ -245,16 +245,15 @@ void FS_rewind(fshandle_t *fh); int FS_feof(fshandle_t *fh); int FS_ferror(fshandle_t *fh); int FS_fclose(fshandle_t *fh); +int FS_fgetc(fshandle_t *fh); char *FS_fgets(char *s, int size, fshandle_t *fh); long FS_filelength (fshandle_t *fh); -extern struct cvar_s registered; - +extern struct cvar_s registered; extern qboolean standard_quake, rogue, hipnotic; - extern qboolean fitzmode; -/* if true, runs in fitzquake mode disabling custom quakespasm hacks. */ + /* if true, run in fitzquake mode disabling custom quakespasm hacks */ #endif /* _Q_COMMON_H */ diff --git a/Quake/snd_mikmod.c b/Quake/snd_mikmod.c index 55c9605f..abfbe000 100644 --- a/Quake/snd_mikmod.c +++ b/Quake/snd_mikmod.c @@ -44,12 +44,12 @@ typedef struct _mik_priv { static BOOL MIK_Seek (MREADER *r, long ofs, int whence) { - return FS_fseek (((mik_priv_t *)r)->fh, ofs, whence); + return FS_fseek(((mik_priv_t *)r)->fh, ofs, whence); } static long MIK_Tell (MREADER *r) { - return FS_ftell (((mik_priv_t *)r)->fh); + return FS_ftell(((mik_priv_t *)r)->fh); } static BOOL MIK_Read (MREADER *r, void *ptr, size_t siz) @@ -59,12 +59,7 @@ static BOOL MIK_Read (MREADER *r, void *ptr, size_t siz) static int MIK_Get (MREADER *r) { - unsigned char c; - if (FS_feof(((mik_priv_t *)r)->fh)) - return EOF; - if (FS_fread(&c, 1, 1, ((mik_priv_t *)r)->fh)) - return (int)c; - return EOF; + return FS_fgetc(((mik_priv_t *)r)->fh); } static BOOL MIK_Eof (MREADER *r) @@ -94,10 +89,10 @@ static qboolean S_MIKMOD_CodecInitialize (void) * md_pansep (stereo channels separation) default 128 is OK. * no reverbation (md_reverb 0 (up to 15)) is OK. * md_musicvolume and md_sndfxvolume defaults are 128: OK. - * just tone down overall volume md_volume from 128 to 96: */ + * just tone down overall volume md_volume from 128 to 96? */ md_volume = 96; - MikMod_RegisterDriver(&drv_nos); + MikMod_RegisterDriver(&drv_nos); /* only need the "nosound" driver, none else */ MikMod_RegisterAllLoaders(); if (MikMod_Init(NULL)) {