X-Git-Url: http://de.git.xonotic.org/?a=blobdiff_plain;f=cd_shared.c;h=5d093e73292a0b86f258dd7419c5b576d36900ed;hb=ba778de98fff820dc678eaf1aeb64616feebf725;hp=c0f0514c48cb9fa314af94dd33e5e2a2aa34142f;hpb=7c320ed3cd5e1738024b3cd3f1fc305940f88dce;p=xonotic%2Fdarkplaces.git diff --git a/cd_shared.c b/cd_shared.c index c0f0514c..5d093e73 100644 --- a/cd_shared.c +++ b/cd_shared.c @@ -21,6 +21,8 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. // rights reserved. #include "quakedef.h" +#include "cdaudio.h" +#include "snd_main.h" #define MAXTRACKS 256 @@ -97,25 +99,26 @@ void CDAudio_Play (qbyte track, qboolean looping) { sfx_t* sfx; + Host_StartVideo(); + if (!enabled) return; track = remap[track]; if (track < 1) { - Con_DPrintf("CDAudio: Bad track number %u.\n", track); + Con_Printf("CDAudio: Bad track number %u.\n", track); return; } - if (cdPlaying && cdPlayTrack == track) + if (cdPlaying && cdPlayTrack == track && faketrack == -1) return; CDAudio_Stop (); // Try playing a fake track (sound file) first - sfx = S_PrecacheSound (va ("cdtracks/track%02u.wav", track), false, true, false); - // FIXME: perhaps force it to be always %03u (but for compatibility?): - if (!sfx) - sfx = S_PrecacheSound (va ("cdtracks/track%03u.wav", track), false, true, false); + sfx = S_PrecacheSound (va ("cdtracks/track%02u.wav", track), false, false); + if (sfx == NULL || sfx->fetcher == NULL) + sfx = S_PrecacheSound (va ("cdtracks/track%03u.wav", track), false, false); if (sfx != NULL) { faketrack = S_StartSound (-1, 0, sfx, vec3_origin, cdvolume, 0); @@ -124,7 +127,7 @@ void CDAudio_Play (qbyte track, qboolean looping) if (looping) S_SetChannelFlag (faketrack, CHANNELFLAG_FORCELOOP, true); S_SetChannelFlag (faketrack, CHANNELFLAG_FULLVOLUME, true); - Con_DPrintf ("Fake CD track %u playing...\n", track); + Con_Printf ("Fake CD track %u playing...\n", track); } } @@ -210,6 +213,8 @@ static void CD_f (void) int ret; int n; + Host_StartVideo(); + if (Cmd_Argc() < 2) return; @@ -381,22 +386,22 @@ int CDAudio_Startup (void) if (CDAudio_GetAudioDiskInfo()) { - Con_DPrint("CDAudio_Init: No CD in player.\n"); + Con_Print("CDAudio_Init: No CD in player.\n"); cdValid = false; } saved_vol = CDAudio_SysGetVolume (); if (saved_vol < 0.0f) { - Con_DPrint ("Can't get initial CD volume\n"); + Con_Print ("Can't get initial CD volume\n"); saved_vol = 1.0f; } else - Con_DPrintf ("Initial CD volume: %g\n", saved_vol); + Con_Printf ("Initial CD volume: %g\n", saved_vol); initialized = true; - Con_DPrint("CD Audio Initialized\n"); + Con_Print("CD Audio Initialized\n"); return 0; }