added -nomusic command line switch to turn off playing external music files.

added new cvar bgm_extmusic to enable/disable playing of external music files.
added a new menu entry to control bgm_extmusic.


git-svn-id: svn+ssh://svn.code.sf.net/p/quakespasm/code/trunk@384 af15c1b1-3010-417e-b628-4374ebc0bcbd
This commit is contained in:
sezero 2011-01-10 08:33:22 +00:00
parent ff60c5ae71
commit f7be45e71e
3 changed files with 24 additions and 5 deletions

View file

@ -37,7 +37,9 @@
#define MUSIC_DIRNAME "music"
qboolean bgmloop;
cvar_t bgm_extmusic = {"bgm_extmusic", "1", true};
static qboolean no_extmusic= false;
static float old_volume = -1.0f;
typedef enum _bgm_player
@ -127,12 +129,16 @@ qboolean BGM_Init (void)
music_handler_t *handlers = NULL;
int i;
Cvar_RegisterVariable(&bgm_extmusic, NULL);
Cmd_AddCommand("music", BGM_Play_f);
Cmd_AddCommand("music_pause", BGM_Pause_f);
Cmd_AddCommand("music_resume", BGM_Resume_f);
Cmd_AddCommand("music_loop", BGM_Loop_f);
Cmd_AddCommand("music_stop", BGM_Stop_f);
if (COM_CheckParm("-nomusic") != 0)
no_extmusic = true;
bgmloop = true;
for (i = 0; wanted_handlers[i].type != CODECTYPE_NONE; i++)
@ -304,6 +310,9 @@ void BGM_PlayCDtrack (byte track, qboolean looping)
if (CDAudio_Play(track, looping) == 0)
return; /* success */
if (no_extmusic || !bgm_extmusic.value)
return;
prev_id = 0;
type = 0;
ext = NULL;

View file

@ -28,6 +28,7 @@
#define _BGMUSIC_H_
extern qboolean bgmloop;
extern cvar_t bgm_extmusic;
qboolean BGM_Init (void);
void BGM_Shutdown (void);

View file

@ -24,6 +24,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include "net_sys.h" /* FIXME */
#include "quakedef.h"
#include "net_defs.h" /* FIXME */
#include "bgmusic.h"
void (*vid_menucmdfn)(void); //johnfitz
void (*vid_menudrawfn)(void);
@ -954,8 +955,9 @@ enum
OPT_GAMMA,
OPT_MOUSESPEED,
OPT_SBALPHA,
OPT_MUSICVOL,
OPT_SNDVOL,
OPT_MUSICVOL,
OPT_MUSICEXT,
OPT_ALWAYRUN,
OPT_INVMOUSE,
OPT_ALWAYSMLOOK,
@ -1041,6 +1043,9 @@ void M_AdjustSliders (int dir)
bgmvolume.value = 1;
Cvar_SetValue ("bgmvolume", bgmvolume.value);
break;
case OPT_MUSICEXT: // enable external music vs cdaudio
Cvar_SetValue ("bgm_extmusic", !bgm_extmusic.value);
break;
case OPT_SNDVOL: // sfx volume
sfxvolume.value += dir * 0.1;
if (sfxvolume.value < 0)
@ -1156,15 +1161,19 @@ void M_Options_Draw (void)
r = (1.0 - scr_sbaralpha.value) ; // scr_sbaralpha range is 1.0 to 0.0
M_DrawSlider (220, 32 + 8*OPT_SBALPHA, r);
// OPT_SNDVOL:
M_Print (16, 32 + 8*OPT_SNDVOL, " Sound Volume");
r = sfxvolume.value;
M_DrawSlider (220, 32 + 8*OPT_SNDVOL, r);
// OPT_MUSICVOL:
M_Print (16, 32 + 8*OPT_MUSICVOL, " Music Volume");
r = bgmvolume.value;
M_DrawSlider (220, 32 + 8*OPT_MUSICVOL, r);
// OPT_SNDVOL:
M_Print (16, 32 + 8*OPT_SNDVOL, " Sound Volume");
r = sfxvolume.value;
M_DrawSlider (220, 32 + 8*OPT_SNDVOL, r);
// OPT_MUSICEXT:
M_Print (16, 32 + 8*OPT_MUSICEXT, " External Music");
M_DrawCheckbox (220, 32 + 8*OPT_MUSICEXT, bgm_extmusic.value);
// OPT_ALWAYRUN:
M_Print (16, 32 + 8*OPT_ALWAYRUN, " Always Run");