fteqw/engine/client/cd_sdl.c
Spoike d396450a0a log file defaults changed to be more readable. timestamps now included by default. also fixed a bug in the location the log is written.
fixed numerous shadowmapping bugs. actually seems to work now. appears to draw more lights than is actually needed, however.
changed how keyboard focus works. can now have menu+console open at once, although you probably need shift+escape to get at it.
fixed a few issues with nexuiz compat. there are *still* other issues.
greatly refactored cd playback code. cd driver code is now a backend only and does not provide its own commands. track remapping accepts named faketracks. worked around missing notifications in vista+, so looping will now work.

git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@4491 fc73d0e0-1445-4013-8a0c-d673dee63da5
2013-10-08 14:28:11 +00:00

123 lines
1.7 KiB
C

#include "quakedef.h"
#include <SDL.h>
extern cvar_t bgmvolume;
static qboolean initialized = false;
static SDL_CD *cddevice;
void CDAudio_Eject(void)
{
if (SDL_CDEject(cddevice))
Con_DPrintf("SDL_CDEject failed\n");
}
void CDAudio_CloseDoor(void)
{
Con_Printf("SDL does not support this\n");
}
int CDAudio_GetAudioDiskInfo(void)
{
switch (SDL_CDStatus(cddevice))
{
case CD_ERROR:
Con_Printf("SDL_CDStatus returned error\n");
return -1;
case CD_TRAYEMPTY:
return 0;
default:
break;
}
return cddevice->numtracks;
}
void CDAudio_Play(int track)
{
if (SDL_CDPlayTracks(cddevice, track, 0, 1, 0))
{
Con_Printf("CDAudio: track %i is not audio\n", track);
return;
}
if (!bgmvolume.value)
CDAudio_Pause ();
return;
}
void CDAudio_Stop(void)
{
if (SDL_CDStop(cddevice))
Con_DPrintf("CDAudio: SDL_CDStop failed");
}
void CDAudio_Pause(void)
{
if (SDL_CDPause(cddevice))
Con_DPrintf("CDAudio: SDL_CDPause failed");
}
void CDAudio_Resume(void)
{
if (SDL_CDResume(cddevice))
{
Con_DPrintf("CDAudio: SDL_CDResume failed\n");
return;
}
}
void CDAudio_Update(void)
{
}
void CDAudio_Init(void)
{
}
qboolean CDAudio_Startup(void)
{
if (initialized)
return !!cddevice;
if (!bgmvolume.value)
return false;
initialized = true;
SDL_InitSubSystem(SDL_INIT_CDROM|SDL_INIT_NOPARACHUTE);
if(!SDL_CDNumDrives())
{
Con_DPrintf("CDAudio_Init: No CD drives\n");
return false;
}
cddevice = SDL_CDOpen(0);
if (!cddevice)
{
Con_Printf("CDAudio_Init: SDL_CDOpen failed\n");
return false;
}
return true;
}
void CDAudio_Shutdown(void)
{
if (!initialized)
return;
CDAudio_Stop();
SDL_CDClose(cddevice);
cddevice = NULL;
initialized = false;
}