mirror of
https://github.com/Shpoike/Quakespasm.git
synced 2025-02-21 03:21:08 +00:00
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:
parent
ff60c5ae71
commit
f7be45e71e
3 changed files with 24 additions and 5 deletions
|
@ -37,7 +37,9 @@
|
||||||
#define MUSIC_DIRNAME "music"
|
#define MUSIC_DIRNAME "music"
|
||||||
|
|
||||||
qboolean bgmloop;
|
qboolean bgmloop;
|
||||||
|
cvar_t bgm_extmusic = {"bgm_extmusic", "1", true};
|
||||||
|
|
||||||
|
static qboolean no_extmusic= false;
|
||||||
static float old_volume = -1.0f;
|
static float old_volume = -1.0f;
|
||||||
|
|
||||||
typedef enum _bgm_player
|
typedef enum _bgm_player
|
||||||
|
@ -127,12 +129,16 @@ qboolean BGM_Init (void)
|
||||||
music_handler_t *handlers = NULL;
|
music_handler_t *handlers = NULL;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
|
Cvar_RegisterVariable(&bgm_extmusic, NULL);
|
||||||
Cmd_AddCommand("music", BGM_Play_f);
|
Cmd_AddCommand("music", BGM_Play_f);
|
||||||
Cmd_AddCommand("music_pause", BGM_Pause_f);
|
Cmd_AddCommand("music_pause", BGM_Pause_f);
|
||||||
Cmd_AddCommand("music_resume", BGM_Resume_f);
|
Cmd_AddCommand("music_resume", BGM_Resume_f);
|
||||||
Cmd_AddCommand("music_loop", BGM_Loop_f);
|
Cmd_AddCommand("music_loop", BGM_Loop_f);
|
||||||
Cmd_AddCommand("music_stop", BGM_Stop_f);
|
Cmd_AddCommand("music_stop", BGM_Stop_f);
|
||||||
|
|
||||||
|
if (COM_CheckParm("-nomusic") != 0)
|
||||||
|
no_extmusic = true;
|
||||||
|
|
||||||
bgmloop = true;
|
bgmloop = true;
|
||||||
|
|
||||||
for (i = 0; wanted_handlers[i].type != CODECTYPE_NONE; i++)
|
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)
|
if (CDAudio_Play(track, looping) == 0)
|
||||||
return; /* success */
|
return; /* success */
|
||||||
|
|
||||||
|
if (no_extmusic || !bgm_extmusic.value)
|
||||||
|
return;
|
||||||
|
|
||||||
prev_id = 0;
|
prev_id = 0;
|
||||||
type = 0;
|
type = 0;
|
||||||
ext = NULL;
|
ext = NULL;
|
||||||
|
|
|
@ -28,6 +28,7 @@
|
||||||
#define _BGMUSIC_H_
|
#define _BGMUSIC_H_
|
||||||
|
|
||||||
extern qboolean bgmloop;
|
extern qboolean bgmloop;
|
||||||
|
extern cvar_t bgm_extmusic;
|
||||||
|
|
||||||
qboolean BGM_Init (void);
|
qboolean BGM_Init (void);
|
||||||
void BGM_Shutdown (void);
|
void BGM_Shutdown (void);
|
||||||
|
|
|
@ -24,6 +24,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
#include "net_sys.h" /* FIXME */
|
#include "net_sys.h" /* FIXME */
|
||||||
#include "quakedef.h"
|
#include "quakedef.h"
|
||||||
#include "net_defs.h" /* FIXME */
|
#include "net_defs.h" /* FIXME */
|
||||||
|
#include "bgmusic.h"
|
||||||
|
|
||||||
void (*vid_menucmdfn)(void); //johnfitz
|
void (*vid_menucmdfn)(void); //johnfitz
|
||||||
void (*vid_menudrawfn)(void);
|
void (*vid_menudrawfn)(void);
|
||||||
|
@ -954,8 +955,9 @@ enum
|
||||||
OPT_GAMMA,
|
OPT_GAMMA,
|
||||||
OPT_MOUSESPEED,
|
OPT_MOUSESPEED,
|
||||||
OPT_SBALPHA,
|
OPT_SBALPHA,
|
||||||
OPT_MUSICVOL,
|
|
||||||
OPT_SNDVOL,
|
OPT_SNDVOL,
|
||||||
|
OPT_MUSICVOL,
|
||||||
|
OPT_MUSICEXT,
|
||||||
OPT_ALWAYRUN,
|
OPT_ALWAYRUN,
|
||||||
OPT_INVMOUSE,
|
OPT_INVMOUSE,
|
||||||
OPT_ALWAYSMLOOK,
|
OPT_ALWAYSMLOOK,
|
||||||
|
@ -1041,6 +1043,9 @@ void M_AdjustSliders (int dir)
|
||||||
bgmvolume.value = 1;
|
bgmvolume.value = 1;
|
||||||
Cvar_SetValue ("bgmvolume", bgmvolume.value);
|
Cvar_SetValue ("bgmvolume", bgmvolume.value);
|
||||||
break;
|
break;
|
||||||
|
case OPT_MUSICEXT: // enable external music vs cdaudio
|
||||||
|
Cvar_SetValue ("bgm_extmusic", !bgm_extmusic.value);
|
||||||
|
break;
|
||||||
case OPT_SNDVOL: // sfx volume
|
case OPT_SNDVOL: // sfx volume
|
||||||
sfxvolume.value += dir * 0.1;
|
sfxvolume.value += dir * 0.1;
|
||||||
if (sfxvolume.value < 0)
|
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
|
r = (1.0 - scr_sbaralpha.value) ; // scr_sbaralpha range is 1.0 to 0.0
|
||||||
M_DrawSlider (220, 32 + 8*OPT_SBALPHA, r);
|
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:
|
// OPT_MUSICVOL:
|
||||||
M_Print (16, 32 + 8*OPT_MUSICVOL, " Music Volume");
|
M_Print (16, 32 + 8*OPT_MUSICVOL, " Music Volume");
|
||||||
r = bgmvolume.value;
|
r = bgmvolume.value;
|
||||||
M_DrawSlider (220, 32 + 8*OPT_MUSICVOL, r);
|
M_DrawSlider (220, 32 + 8*OPT_MUSICVOL, r);
|
||||||
|
|
||||||
// OPT_SNDVOL:
|
// OPT_MUSICEXT:
|
||||||
M_Print (16, 32 + 8*OPT_SNDVOL, " Sound Volume");
|
M_Print (16, 32 + 8*OPT_MUSICEXT, " External Music");
|
||||||
r = sfxvolume.value;
|
M_DrawCheckbox (220, 32 + 8*OPT_MUSICEXT, bgm_extmusic.value);
|
||||||
M_DrawSlider (220, 32 + 8*OPT_SNDVOL, r);
|
|
||||||
|
|
||||||
// OPT_ALWAYRUN:
|
// OPT_ALWAYRUN:
|
||||||
M_Print (16, 32 + 8*OPT_ALWAYRUN, " Always Run");
|
M_Print (16, 32 + 8*OPT_ALWAYRUN, " Always Run");
|
||||||
|
|
Loading…
Reference in a new issue