fix misc things that I previously missed.

git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@4625 fc73d0e0-1445-4013-8a0c-d673dee63da5
This commit is contained in:
Spoike 2014-03-30 10:43:05 +00:00
parent cdf7815cf7
commit 42d428df5a
8 changed files with 48 additions and 27 deletions

View file

@ -8,6 +8,14 @@
#include "shader.h"
#if !defined(NOMEDIA)
#if defined(_WIN32) && !defined(WINRT)
#define WINAMP
#endif
#if defined(_WIN32) && !defined(WINRT)
#define WINAVI
#endif
typedef struct mediatrack_s{
char filename[MAX_QPATH];
char nicename[MAX_QPATH];
@ -456,9 +464,15 @@ void CD_f (void)
return;
}
if (!bgmvolume.ival)
if (Q_strcasecmp(command, "stop") == 0)
{
Con_Printf("Background music is disabled. %s is 0\n", bgmvolume.name);
Media_Clear();
return;
}
if (!bgmvolume.value)
{
Con_Printf("Background music is disabled: %s is 0\n", bgmvolume.name);
return;
}
@ -509,12 +523,6 @@ void CD_f (void)
}
}
if (Q_strcasecmp(command, "stop") == 0)
{
CDAudio_Stop();
return;
}
if (Q_strcasecmp(command, "pause") == 0)
{
Media_SetPauseTrack(true);

View file

@ -503,6 +503,16 @@ static void OpenAL_ChannelUpdate(soundcardinfo_t *sc, channel_t *chan, unsigned
offset = (chan->pos>>PITCHSHIFT) - sbuf.soundoffset;
sbuf.data += offset * sc->width*sc->numchannels;
sbuf.length -= offset;
if (!sbuf.length && (chan->pos>>PITCHSHIFT) == sbuf.soundoffset)
{
chan->sfx = NULL;
if (sfx->decoder.abort)
{
if (!S_IsPlayingSomewhere(sfx))
sfx->decoder.abort(sfx);
}
}
sbuf.soundoffset = 0;
//build a buffer with it and queue it up.

View file

@ -61,7 +61,7 @@ int desired_bits = 16;
int sound_started=0;
cvar_t bgmvolume = CVARAFD( "musicvolume", "0", "bgmvolume", CVAR_ARCHIVE,
cvar_t bgmvolume = CVARAFD( "musicvolume", "0.3", "bgmvolume", CVAR_ARCHIVE,
"Volume level for background music.");
cvar_t volume = CVARFD( "volume", "0.7", CVAR_ARCHIVE,
"Main volume level for all engine sound.");
@ -2566,6 +2566,7 @@ void S_UpdateAmbientSounds (soundcardinfo_t *sc)
for (i = MUSIC_FIRST; i < MUSIC_STOP; i++)
{
qboolean changed = false;
chan = &sc->channel[i];
if (!chan->sfx)
{
@ -2581,13 +2582,17 @@ void S_UpdateAmbientSounds (soundcardinfo_t *sc)
chan->sfx = newmusic;
chan->rate = 1<<PITCHSHIFT;
chan->pos = 0;
changed = true;
}
}
}
if (chan->sfx)
{
chan->master_vol = 255; //bypasses volume cvar completely.
chan->vol[0] = chan->vol[1] = chan->vol[2] = chan->vol[3] = chan->vol[4] = chan->vol[5] = bound(0, chan->master_vol*bgmvolume.value*voicevolumemod, 255);
chan->flags = CF_ABSVOLUME; //bypasses volume cvar completely.
chan->master_vol = bound(0, 255*bgmvolume.value*voicevolumemod, 255);
chan->vol[0] = chan->vol[1] = chan->vol[2] = chan->vol[3] = chan->vol[4] = chan->vol[5] = chan->master_vol;
if (sc->ChannelUpdate)
sc->ChannelUpdate(sc, chan, changed);
}
}

View file

@ -2336,7 +2336,6 @@ static void Mod_FloodFillSkin( qbyte *skin, int skinwidth, int skinheight )
skin[x + skinwidth * y] = fdc;
}
}
#endif
skinid_t *skinfilelist;
int skinfilecount;
@ -2467,7 +2466,6 @@ shader_t *Mod_ShaderFromQ3SkinFile(char *out, galiasinfo_t *surf, char *modelnam
return NULL;
}
#ifndef SERVERONLY
shader_t *Mod_LoadSkinFile(char *defaultshadername, galiasinfo_t *surf, int skinnumber, unsigned char *rawdata, int width, int height, unsigned char *palette, char *outskinname)
{
shader_t *shader;

View file

@ -456,6 +456,8 @@ typedef struct zonegroupblock_s
} zonegroupblock_t;
#ifdef USE_MSVCRT_DEBUG
#undef ZG_Malloc
void *ZG_Malloc(zonegroup_t *ctx, int size){return ZG_MallocNamed(ctx, size, "ZG_Malloc", size);}
void *ZG_MallocNamed(zonegroup_t *ctx, int size, char *file, int line)
#else
void *ZG_Malloc(zonegroup_t *ctx, int size)

View file

@ -2310,7 +2310,6 @@ void BE_GenPolyBatches(batch_t **batches)
}
}
void R_HalfLife_GenerateBatches(entity_t *e, batch_t **batches);
model_t *Mod_LoadModel (model_t *mod, qboolean crash);
void BE_GenModelBatches(batch_t **batches, const dlight_t *dl, unsigned int bemode)
{
int i;
@ -2367,7 +2366,7 @@ void BE_GenModelBatches(batch_t **batches, const dlight_t *dl, unsigned int bemo
continue;
if (ent->model->needload)
{
if (!Mod_LoadModel(ent->model, false))
if (!Mod_LoadModel(ent->model, MLV_WARN))
continue;
}

View file

@ -2532,7 +2532,6 @@ static void Terr_RebuildMesh(model_t *model, hmsection_t *s, int x, int y)
#endif
}
model_t *Mod_LoadModel (model_t *mod, qboolean crash);
struct tdibctx
{
heightmap_t *hm;
@ -2611,7 +2610,7 @@ void Terr_DrawInBounds(struct tdibctx *ctx, int x, int y, int w, int h)
if (hm->beinglazy)
continue;
hm->beinglazy = true;
Mod_LoadModel(model, false);
Mod_LoadModel(model, MLV_WARN);
}
if (model->needload)
continue;

View file

@ -211,11 +211,11 @@ void Mod_Init (qboolean initial)
}
int Mod_RegisterModelFormatText(void *module, const char *formatname, char *magictext, qboolean (QDECL *load) (struct model_s *mod, void *buffer))
int Mod_RegisterModelFormatText(void *module, const char *formatname, char *magictext, qboolean (QDECL *load) (struct model_s *mod, void *buffer, size_t fsize))
{
return 0;
}
int Mod_RegisterModelFormatMagic(void *module, const char *formatname, unsigned int magic, qboolean (QDECL *load) (struct model_s *mod, void *buffer))
int Mod_RegisterModelFormatMagic(void *module, const char *formatname, unsigned int magic, qboolean (QDECL *load) (struct model_s *mod, void *buffer, size_t fsize))
{
return 0;
}
@ -476,36 +476,36 @@ model_t *Mod_LoadModel (model_t *mod, qboolean crash)
case BSPVERSIONPREREL:
case BSPVERSION:
case BSPVERSIONHL:
if (!Mod_LoadBrushModel (mod, buf))
if (!Mod_LoadBrushModel (mod, buf, com_filesize))
goto couldntload;
break;
case RAPOLYHEADER:
case IDPOLYHEADER:
if (!Mod_LoadQ1Model(mod, buf))
if (!Mod_LoadQ1Model(mod, buf, com_filesize))
goto couldntload;
break;
#ifdef MD2MODELS
case MD2IDALIASHEADER:
if (!Mod_LoadQ2Model(mod, buf))
if (!Mod_LoadQ2Model(mod, buf, com_filesize))
goto couldntload;
break;
#endif
#ifdef MD3MODELS
case MD3_IDENT:
if (!Mod_LoadQ3Model (mod, buf))
if (!Mod_LoadQ3Model (mod, buf, com_filesize))
goto couldntload;
break;
#endif
#ifdef ZYMOTICMODELS
case (('O'<<24)+('M'<<16)+('Y'<<8)+'Z'):
if (!Mod_LoadZymoticModel(mod, buf))
if (!Mod_LoadZymoticModel(mod, buf, com_filesize))
goto couldntload;
break;
#endif
#ifdef ZYMOTICMODELS
case (('K'<<24)+('R'<<16)+('A'<<8)+'D'):
if (!Mod_LoadDarkPlacesModel(mod, buf))
if (!Mod_LoadDarkPlacesModel(mod, buf, com_filesize))
goto couldntload;
break;
#endif
@ -523,7 +523,7 @@ model_t *Mod_LoadModel (model_t *mod, qboolean crash)
#ifdef TERRAIN
if (!strcmp(com_token, "terrain")) //custom format, text based.
{
if (!Terr_LoadTerrainModel(mod, buf))
if (!Terr_LoadTerrainModel(mod, buf, com_filesize))
goto couldntload;
break;
}
@ -1767,7 +1767,7 @@ qboolean Mod_LoadPlanes (lump_t *l)
Mod_LoadBrushModel
=================
*/
qboolean Mod_LoadBrushModel (model_t *mod, void *buffer)
qboolean Mod_LoadBrushModel (model_t *mod, void *buffer, size_t buffersize)
{
int i, j;
dheader_t *header;