mirror of
https://github.com/Shpoike/Quakespasm.git
synced 2024-11-10 07:21:58 +00:00
add new stdio replacement FS_fgetc() and use it in snd_mikmod.c.
git-svn-id: svn://svn.code.sf.net/p/quakespasm/code/trunk/quakespasm@869 af15c1b1-3010-417e-b628-4374ebc0bcbd
This commit is contained in:
parent
5e4849c61f
commit
a95bb25134
3 changed files with 20 additions and 17 deletions
|
@ -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;
|
||||
|
|
|
@ -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 */
|
||||
|
||||
|
|
|
@ -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))
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue