soft merge bgm and cdaudio functions

master
an 2019-11-25 01:55:37 -05:00
parent 98b8e36bdc
commit 8452118b9c
6 changed files with 14 additions and 21 deletions

View File

@ -25,6 +25,7 @@
#include "quakedef.h" #include "quakedef.h"
#include "snd_codec.h" #include "snd_codec.h"
#include "bgmusic.h" #include "bgmusic.h"
#include "cdaudio.h"
#define MUSIC_DIRNAME "music" #define MUSIC_DIRNAME "music"
@ -169,7 +170,7 @@ qboolean BGM_Init (void)
} }
} }
return true; return CDAudio_Init ();
} }
void BGM_Shutdown (void) void BGM_Shutdown (void)
@ -178,6 +179,7 @@ void BGM_Shutdown (void)
/* sever our connections to /* sever our connections to
* midi_drv and snd_codec */ * midi_drv and snd_codec */
music_handlers = NULL; music_handlers = NULL;
CDAudio_Shutdown ();
} }
static void BGM_Play_noext (const char *filename, unsigned int allowed_types) static void BGM_Play_noext (const char *filename, unsigned int allowed_types)
@ -344,6 +346,7 @@ void BGM_Stop (void)
bgmstream = NULL; bgmstream = NULL;
s_rawend = 0; s_rawend = 0;
} }
CDAudio_Stop();
} }
void BGM_Pause (void) void BGM_Pause (void)
@ -353,6 +356,7 @@ void BGM_Pause (void)
if (bgmstream->status == STREAM_PLAY) if (bgmstream->status == STREAM_PLAY)
bgmstream->status = STREAM_PAUSE; bgmstream->status = STREAM_PAUSE;
} }
CDAudio_Pause ();
} }
void BGM_Resume (void) void BGM_Resume (void)
@ -362,6 +366,7 @@ void BGM_Resume (void)
if (bgmstream->status == STREAM_PAUSE) if (bgmstream->status == STREAM_PAUSE)
bgmstream->status = STREAM_PLAY; bgmstream->status = STREAM_PLAY;
} }
CDAudio_Resume ();
} }
static void BGM_UpdateStream (void) static void BGM_UpdateStream (void)
@ -465,5 +470,7 @@ void BGM_Update (void)
} }
if (bgmstream) if (bgmstream)
BGM_UpdateStream (); BGM_UpdateStream ();
CDAudio_Update();
} }

View File

@ -107,7 +107,6 @@ void CL_Disconnect (void)
// stop sounds (especially looping!) // stop sounds (especially looping!)
S_StopAllSounds (true); S_StopAllSounds (true);
BGM_Stop(); BGM_Stop();
CDAudio_Stop();
// if running a local server, shut it down // if running a local server, shut it down
if (cls.demoplayback) if (cls.demoplayback)
@ -446,7 +445,7 @@ void CL_RelinkEntities (void)
{ {
if (!ent->model) if (!ent->model)
{ // empty slot { // empty slot
// ericw -- efrags are only used for static entities in GLQuake // ericw -- efrags are only used for static entities in GLQuake
// ent can't be static, so this is a no-op. // ent can't be static, so this is a no-op.
//if (ent->forcelink) //if (ent->forcelink)
@ -791,7 +790,7 @@ void CL_Init (void)
Cvar_RegisterVariable (&lookspring); Cvar_RegisterVariable (&lookspring);
Cvar_RegisterVariable (&lookstrafe); Cvar_RegisterVariable (&lookstrafe);
Cvar_RegisterVariable (&sensitivity); Cvar_RegisterVariable (&sensitivity);
Cvar_RegisterVariable (&cl_alwaysrun); Cvar_RegisterVariable (&cl_alwaysrun);
Cvar_RegisterVariable (&m_pitch); Cvar_RegisterVariable (&m_pitch);

View File

@ -286,17 +286,17 @@ void CL_ParseServerInfo (void)
if (cl.protocol == PROTOCOL_RMQ) if (cl.protocol == PROTOCOL_RMQ)
{ {
const unsigned int supportedflags = (PRFL_SHORTANGLE | PRFL_FLOATANGLE | PRFL_24BITCOORD | PRFL_FLOATCOORD | PRFL_EDICTSCALE | PRFL_INT32COORD); const unsigned int supportedflags = (PRFL_SHORTANGLE | PRFL_FLOATANGLE | PRFL_24BITCOORD | PRFL_FLOATCOORD | PRFL_EDICTSCALE | PRFL_INT32COORD);
// mh - read protocol flags from server so that we know what protocol features to expect // mh - read protocol flags from server so that we know what protocol features to expect
cl.protocolflags = (unsigned int) MSG_ReadLong (); cl.protocolflags = (unsigned int) MSG_ReadLong ();
if (0 != (cl.protocolflags & (~supportedflags))) if (0 != (cl.protocolflags & (~supportedflags)))
{ {
Con_Warning("PROTOCOL_RMQ protocolflags %i contains unsupported flags\n", cl.protocolflags); Con_Warning("PROTOCOL_RMQ protocolflags %i contains unsupported flags\n", cl.protocolflags);
} }
} }
else cl.protocolflags = 0; else cl.protocolflags = 0;
// parse maxclients // parse maxclients
cl.maxclients = MSG_ReadByte (); cl.maxclients = MSG_ReadByte ();
if (cl.maxclients < 1 || cl.maxclients > MAX_SCOREBOARD) if (cl.maxclients < 1 || cl.maxclients > MAX_SCOREBOARD)
@ -816,7 +816,7 @@ void CL_ParseClientdata (void)
else else
cl.viewent.alpha = ENTALPHA_DEFAULT; cl.viewent.alpha = ENTALPHA_DEFAULT;
//johnfitz //johnfitz
//johnfitz -- lerping //johnfitz -- lerping
//ericw -- this was done before the upper 8 bits of cl.stats[STAT_WEAPON] were filled in, breaking on large maps like zendar.bsp //ericw -- this was done before the upper 8 bits of cl.stats[STAT_WEAPON] were filled in, breaking on large maps like zendar.bsp
if (cl.viewent.model != cl.model_precache[cl.stats[STAT_WEAPON]]) if (cl.viewent.model != cl.model_precache[cl.stats[STAT_WEAPON]])
@ -1124,15 +1124,9 @@ void CL_ParseServerMessage (void)
case svc_setpause: case svc_setpause:
cl.paused = MSG_ReadByte (); cl.paused = MSG_ReadByte ();
if (cl.paused) if (cl.paused)
{
CDAudio_Pause ();
BGM_Pause (); BGM_Pause ();
}
else else
{
CDAudio_Resume ();
BGM_Resume (); BGM_Resume ();
}
break; break;
case svc_signonnum: case svc_signonnum:

View File

@ -485,7 +485,6 @@ static qboolean VID_SetMode (int width, int height, int refreshrate, int bpp, qb
temp = scr_disabled_for_loading; temp = scr_disabled_for_loading;
scr_disabled_for_loading = true; scr_disabled_for_loading = true;
CDAudio_Pause ();
BGM_Pause (); BGM_Pause ();
/* z-buffer depth */ /* z-buffer depth */
@ -599,7 +598,6 @@ static qboolean VID_SetMode (int width, int height, int refreshrate, int bpp, qb
modestate = VID_GetFullscreen() ? MS_FULLSCREEN : MS_WINDOWED; modestate = VID_GetFullscreen() ? MS_FULLSCREEN : MS_WINDOWED;
CDAudio_Resume ();
BGM_Resume (); BGM_Resume ();
scr_disabled_for_loading = temp; scr_disabled_for_loading = temp;

View File

@ -749,8 +749,6 @@ void _Host_Frame (float time)
else else
S_Update (vec3_origin, vec3_origin, vec3_origin, vec3_origin); S_Update (vec3_origin, vec3_origin, vec3_origin, vec3_origin);
CDAudio_Update();
if (host_speeds.value) if (host_speeds.value)
{ {
pass1 = (time1 - time3)*1000; pass1 = (time1 - time3)*1000;
@ -862,7 +860,6 @@ void Host_Init (void)
SCR_Init (); SCR_Init ();
R_Init (); R_Init ();
S_Init (); S_Init ();
CDAudio_Init ();
BGM_Init(); BGM_Init();
Sbar_Init (); Sbar_Init ();
CL_Init (); CL_Init ();
@ -924,7 +921,6 @@ void Host_Shutdown(void)
if (con_initialized) if (con_initialized)
History_Shutdown (); History_Shutdown ();
BGM_Shutdown(); BGM_Shutdown();
CDAudio_Shutdown ();
S_Shutdown (); S_Shutdown ();
IN_Shutdown (); IN_Shutdown ();
VID_Shutdown(); VID_Shutdown();

View File

@ -241,7 +241,6 @@ typedef struct
#include "input.h" #include "input.h"
#include "keys.h" #include "keys.h"
#include "menu.h" #include "menu.h"
#include "cdaudio.h"
#include "glquake.h" #include "glquake.h"