* common.c (FS_fread): fixed coding style.

* bgmusic.c:  minor updates from uhexen2.


git-svn-id: http://svn.code.sf.net/p/quakespasm/code/trunk/quakespasm@406 af15c1b1-3010-417e-b628-4374ebc0bcbd
This commit is contained in:
sezero 2011-02-08 11:00:29 +00:00
parent 687eb577cd
commit c851a07cc6
3 changed files with 19 additions and 26 deletions

View file

@ -26,14 +26,6 @@
#include "snd_codec.h"
#include "bgmusic.h"
/*
* MUSIC FILE DIRECTORIES:
*
* Midi music file have always lived under "midi" directory, we are
* not changing that. Any other music files, including cd-rips, are
* expected under the "music" directory.
*/
#define MUSIC_DIRNAME "music"
qboolean bgmloop;
@ -63,15 +55,15 @@ static music_handler_t wanted_handlers[] =
{
{ CODECTYPE_OGG, BGM_STREAMER, -1, ".ogg", MUSIC_DIRNAME, NULL },
{ CODECTYPE_MP3, BGM_STREAMER, -1, ".mp3", MUSIC_DIRNAME, NULL },
{ CODECTYPE_WAV, BGM_STREAMER, -1, ".wav", MUSIC_DIRNAME, NULL },
{ CODECTYPE_FLAC, BGM_STREAMER, -1, ".flac", MUSIC_DIRNAME, NULL },
{ CODECTYPE_WAV, BGM_STREAMER, -1, ".wav", MUSIC_DIRNAME, NULL },
{ CODECTYPE_NONE, BGM_NONE, -1, NULL, NULL, NULL }
};
static music_handler_t *music_handlers = NULL;
#define ANY_CODECTYPE 0xFFFFFFFF
#define CDRIP_TYPES (CODECTYPE_OGG | CODECTYPE_MP3 | CODECTYPE_WAV)
#define CDRIP_TYPES (CODECTYPE_OGG | CODECTYPE_MP3 | CODECTYPE_FLAC | CODECTYPE_WAV)
#define CDRIPTYPE(x) (((x) & CDRIP_TYPES) != 0)
static snd_stream_t *bgmstream = NULL;

View file

@ -34,11 +34,12 @@ qboolean BGM_Init (void);
void BGM_Shutdown (void);
void BGM_Play (const char *filename);
void BGM_PlayCDtrack (byte track, qboolean looping);
void BGM_Stop (void);
void BGM_Update (void);
void BGM_Pause (void);
void BGM_Resume (void);
void BGM_PlayCDtrack (byte track, qboolean looping);
#endif /* _BGMUSIC_H_ */

View file

@ -1957,9 +1957,9 @@ void COM_InitFilesystem (void) //johnfitz -- modified based on topaz's tutorial
size_t FS_fread(void *ptr, size_t size, size_t nmemb, fshandle_t *fh)
{
long byteSize;
long bytesRead;
size_t nMembRead;
long byte_size;
long bytes_read;
size_t nmemb_read;
if (!ptr)
{
@ -1979,21 +1979,21 @@ size_t FS_fread(void *ptr, size_t size, size_t nmemb, fshandle_t *fh)
return 0;
}
byteSize = nmemb * size;
if (byteSize > fh->length - fh->pos) /* just read to end */
byteSize = fh->length - fh->pos;
bytesRead = fread(ptr, 1, byteSize, fh->file);
fh->pos += bytesRead;
/* return the number of elements read not the number of bytes */
nMembRead = bytesRead / size;
byte_size = nmemb * size;
if (byte_size > fh->length - fh->pos) /* just read to end */
byte_size = fh->length - fh->pos;
bytes_read = fread(ptr, 1, byte_size, fh->file);
fh->pos += bytes_read;
/* fread() must return the number of elements read,
* not the total number of bytes. */
nmemb_read = bytes_read / size;
/* even if the last member is only read partially
* it is counted as a whole in the return value */
if (bytesRead % size)
nMembRead++;
* it is counted as a whole in the return value. */
if (bytes_read % size)
nmemb_read++;
return nMembRead;
return nmemb_read;
}
int FS_fseek(fshandle_t *fh, long offset, int whence)