diff --git a/Makefile b/Makefile index 8c1755ef..e5cee0e3 100644 --- a/Makefile +++ b/Makefile @@ -59,7 +59,7 @@ CC := gcc # # -MMD to generate header dependencies. CFLAGS := -O2 -fno-strict-aliasing -fomit-frame-pointer \ - -Wall -pipe -g -MMD + -Wall -pipe -g -MMD -DCDA -DOGG # ---------- diff --git a/src/client/cl_cin.c b/src/client/cl_cin.c index f9d1d44c..45024a8d 100644 --- a/src/client/cl_cin.c +++ b/src/client/cl_cin.c @@ -451,8 +451,10 @@ SCR_PlayCinematic(char *arg) { byte *palette; char name[MAX_OSPATH], *dot; - /* make sure CD isn't playing music */ + /* make sure background music is not playing */ +#ifdef CDA CDAudio_Stop(); +#endif #ifdef OGG OGG_Stop(); #endif diff --git a/src/client/cl_main.c b/src/client/cl_main.c index 00da222e..07d80d5b 100644 --- a/src/client/cl_main.c +++ b/src/client/cl_main.c @@ -738,7 +738,9 @@ void CL_Frame (int msec) /* update audio */ S_Update (cl.refdef.vieworg, cl.v_forward, cl.v_right, cl.v_up); +#ifdef CDA CDAudio_Update(); +#endif /* advance local effects for next frame */ CL_RunDLights (); @@ -800,7 +802,9 @@ void CL_Init (void) cls.disable_screen = true; /* don't draw yet */ +#ifdef CDA CDAudio_Init (); +#endif CL_InitLocal (); @@ -824,7 +828,9 @@ void CL_Shutdown(void) CL_WriteConfiguration (); +#ifdef CDA CDAudio_Shutdown (); +#endif #ifdef OGG OGG_Stop(); #endif diff --git a/src/client/cl_network.c b/src/client/cl_network.c index 73a562db..92100741 100644 --- a/src/client/cl_network.c +++ b/src/client/cl_network.c @@ -294,7 +294,9 @@ void CL_Disconnect (void) #ifdef OGG OGG_Stop(); #endif +#ifdef CDA CDAudio_Stop(); +#endif if (cls.demorecording) CL_Stop_f (); diff --git a/src/client/cl_parse.c b/src/client/cl_parse.c index d725c2e2..5a118b56 100644 --- a/src/client/cl_parse.c +++ b/src/client/cl_parse.c @@ -837,7 +837,9 @@ void CL_ParseConfigString (void) { else if (i == CS_CDTRACK) { if (cl.refresh_prepped) { +#ifdef CDA CDAudio_Play (atoi(cl.configstrings[CS_CDTRACK]), true); +#endif #ifdef OGG /* OGG/Vorbis */ diff --git a/src/client/cl_screen.c b/src/client/cl_screen.c index 7a44547a..e2ea5141 100644 --- a/src/client/cl_screen.c +++ b/src/client/cl_screen.c @@ -443,7 +443,9 @@ void SCR_DrawConsole (void) { void SCR_BeginLoadingPlaque (void) { S_StopAllSounds (); cl.sound_prepped = false; /* don't play ambients */ +#ifdef CDA CDAudio_Stop (); +#endif #ifdef OGG OGG_Stop(); #endif diff --git a/src/client/cl_view.c b/src/client/cl_view.c index 76cd8072..2e5dd73f 100644 --- a/src/client/cl_view.c +++ b/src/client/cl_view.c @@ -302,12 +302,16 @@ void CL_PrepRefresh (void) { cl.refresh_prepped = true; cl.force_refdef = true; /* make sure we have a valid refdef */ +#if defined(OGG) || defined(CDA) /* start the cd track */ if (Cvar_VariableValue("cd_shuffle")) { +#ifdef CDA CDAudio_RandomPlay(); - +#endif } else { +#ifdef CDA CDAudio_Play (atoi(cl.configstrings[CS_CDTRACK]), true); +#endif #ifdef OGG /* OGG/Vorbis */ @@ -320,6 +324,7 @@ void CL_PrepRefresh (void) { } #endif } +#endif } float CalcFov (float fov_x, float width, float height) { diff --git a/src/client/menu/menu.c b/src/client/menu/menu.c index 667b71d5..cf5560a7 100644 --- a/src/client/menu/menu.c +++ b/src/client/menu/menu.c @@ -998,8 +998,12 @@ static menulist_s s_options_lookspring_box; static menulist_s s_options_lookstrafe_box; static menulist_s s_options_crosshair_box; static menuslider_s s_options_sfxvolume_slider; +#ifdef CDA static menulist_s s_options_cdvolume_box; +#endif +#if defined(OGG) || defined(CDA) static menulist_s s_options_cdshuffle_box; +#endif #ifdef OGG static menulist_s s_options_oggvolume_box; #endif @@ -1036,7 +1040,9 @@ static float ClampCvar( float min, float max, float value ) { static void ControlsSetMenuItemValues( void ) { s_options_sfxvolume_slider.curvalue = Cvar_VariableValue( "s_volume" ) * 10; +#ifdef CDA s_options_cdvolume_box.curvalue = !Cvar_VariableValue("cd_nocd"); +#endif #ifdef OGG s_options_oggvolume_box.curvalue = Cvar_VariableValue("ogg_enable"); @@ -1095,6 +1101,7 @@ static void UpdateVolumeFunc( void *unused ) { Cvar_SetValue( "s_volume", s_options_sfxvolume_slider.curvalue / 10 ); } +#if defined(OGG) || defined(CDA) static void CDShuffleFunc(void *unused) { Cvar_SetValue("cd_shuffle", s_options_cdshuffle_box.curvalue); @@ -1125,7 +1132,9 @@ static void CDShuffleFunc(void *unused) { } #endif } +#endif +#ifdef CDA static void UpdateCDVolumeFunc( void *unused ) { Cvar_SetValue( "cd_nocd", (float)!s_options_cdvolume_box.curvalue ); #ifdef OGG @@ -1149,14 +1158,19 @@ static void UpdateCDVolumeFunc( void *unused ) { CDAudio_Stop(); } } +#endif #ifdef OGG static void UpdateOGGVolumeFunc( void *unused ) { Cvar_SetValue( "ogg_enable", (float)s_options_oggvolume_box.curvalue ); +#ifdef CDA Cvar_SetValue( "cd_nocd", 1 ); +#endif if (s_options_oggvolume_box.curvalue) { +#ifdef CDA CDAudio_Stop(); +#endif OGG_Init(); OGG_Stop(); @@ -1211,11 +1225,13 @@ static void UpdateSoundQualityFunc( void *unused ) { } static void Options_MenuInit( void ) { +#ifdef CDA static const char *cd_music_items[] = { "disabled", "enabled", 0 }; +#endif #ifdef OGG static const char *ogg_music_items[] = { @@ -1225,11 +1241,13 @@ static void Options_MenuInit( void ) { }; #endif +#if defined(OGG) || defined(CDA) static const char *cd_shuffle[] = { "disabled", "enabled", 0 }; +#endif static const char *quality_items[] = { "normal", "high", 0 @@ -1262,7 +1280,8 @@ static void Options_MenuInit( void ) { s_options_sfxvolume_slider.minvalue = 0; s_options_sfxvolume_slider.maxvalue = 10; s_options_sfxvolume_slider.curvalue = Cvar_VariableValue( "s_volume" ) * 10.0f; - + +#ifdef CDA s_options_cdvolume_box.generic.type = MTYPE_SPINCONTROL; s_options_cdvolume_box.generic.x = 0; s_options_cdvolume_box.generic.y = 10; @@ -1270,6 +1289,7 @@ static void Options_MenuInit( void ) { s_options_cdvolume_box.generic.callback = UpdateCDVolumeFunc; s_options_cdvolume_box.itemnames = cd_music_items; s_options_cdvolume_box.curvalue = !Cvar_VariableValue("cd_nocd"); +#endif #ifdef OGG s_options_oggvolume_box.generic.type = MTYPE_SPINCONTROL; @@ -1281,6 +1301,7 @@ static void Options_MenuInit( void ) { s_options_oggvolume_box.curvalue = Cvar_VariableValue("ogg_enable"); #endif +#if defined(OGG) || defined(CDA) s_options_cdshuffle_box.generic.type = MTYPE_SPINCONTROL; s_options_cdshuffle_box.generic.x = 0; s_options_cdshuffle_box.generic.y = 30; @@ -1288,6 +1309,7 @@ static void Options_MenuInit( void ) { s_options_cdshuffle_box.generic.callback = CDShuffleFunc; s_options_cdshuffle_box.itemnames = cd_shuffle; s_options_cdshuffle_box.curvalue = Cvar_VariableValue("cd_shuffle");; +#endif s_options_quality_list.generic.type = MTYPE_SPINCONTROL; s_options_quality_list.generic.x = 0; @@ -1368,11 +1390,15 @@ static void Options_MenuInit( void ) { ControlsSetMenuItemValues(); Menu_AddItem( &s_options_menu, ( void * ) &s_options_sfxvolume_slider ); +#ifdef CDA Menu_AddItem( &s_options_menu, ( void * ) &s_options_cdvolume_box ); +#endif #ifdef OGG Menu_AddItem( &s_options_menu, ( void * ) &s_options_oggvolume_box ); #endif +#if defined(OGG) || defined(CDA) Menu_AddItem( &s_options_menu, ( void * ) &s_options_cdshuffle_box ); +#endif Menu_AddItem( &s_options_menu, ( void * ) &s_options_quality_list ); Menu_AddItem( &s_options_menu, ( void * ) &s_options_sensitivity_slider ); Menu_AddItem( &s_options_menu, ( void * ) &s_options_alwaysrun_box ); diff --git a/src/client/sound/header/cdaudio.h b/src/client/sound/header/cdaudio.h index 758d56ab..bb20b979 100644 --- a/src/client/sound/header/cdaudio.h +++ b/src/client/sound/header/cdaudio.h @@ -24,6 +24,8 @@ * ======================================================================= */ +#ifdef CDA + #ifndef CL_SOUND_CDAUDIO_H #define CL_SOUND_CDAUDIO_H @@ -36,4 +38,5 @@ void CDAudio_Activate (qboolean active); void CDAudio_RandomPlay(void); #endif +#endif diff --git a/src/client/sound/snd_dma.c b/src/client/sound/snd_dma.c index 2168fb6a..269ccfa4 100644 --- a/src/client/sound/snd_dma.c +++ b/src/client/sound/snd_dma.c @@ -202,8 +202,10 @@ S_Shutdown ( void ) Cmd_RemoveCommand( "soundinfo" ); Cmd_RemoveCommand( "play" ); Cmd_RemoveCommand( "stopsound" ); +#ifdef OGG Cmd_RemoveCommand( "ogg_init" ); Cmd_RemoveCommand( "ogg_shutdown" ); +#endif } /* diff --git a/src/sdl/cd.c b/src/sdl/cd.c index d8b1b741..99daa7fd 100644 --- a/src/sdl/cd.c +++ b/src/sdl/cd.c @@ -25,6 +25,8 @@ * ======================================================================= */ +#ifdef CDA + #include #include "SDL.h" #include "../client/header/client.h" @@ -514,3 +516,5 @@ CDAudio_Activate ( qboolean active ) } } +#endif /* CDA */ +