]> de.git.xonotic.org Git - xonotic/darkplaces.git/blobdiff - cd_sdl.c
fix bugs with bbox vs bbox traces (the collision box's planes didn't have correct...
[xonotic/darkplaces.git] / cd_sdl.c
index 4ec4f95805573e7cdd33fcc5ae45ca4ae42fa75f..b9a7a7539423ea6eaecb02ebeccd18c6230996ff 100644 (file)
--- a/cd_sdl.c
+++ b/cd_sdl.c
@@ -20,9 +20,10 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
 */
 
 #include "quakedef.h"
 */
 
 #include "quakedef.h"
+#include "cdaudio.h"
 #include <SDL.h>
 
 #include <SDL.h>
 
-/*IMPORTANT: 
+/*IMPORTANT:
 SDL 1.2.7 and older seems to have a strange bug regarding CDPause and CDResume under WIN32.
 If CDResume is called, it plays to end of the CD regardless what values for lasttrack and lastframe
 were passed to CDPlayTracks.
 SDL 1.2.7 and older seems to have a strange bug regarding CDPause and CDResume under WIN32.
 If CDResume is called, it plays to end of the CD regardless what values for lasttrack and lastframe
 were passed to CDPlayTracks.
@@ -79,7 +80,7 @@ void CDAudio_SysSetVolume (float volume)
 }
 
 
 }
 
 
-int CDAudio_SysPlay (qbyte track)
+int CDAudio_SysPlay (unsigned char track)
 {
        SDL_CDStop( cd );
        endtime = realtime + (float) cd->track[ track - 1 ].length / CD_FPS;
 {
        SDL_CDStop( cd );
        endtime = realtime + (float) cd->track[ track - 1 ].length / CD_FPS;
@@ -105,7 +106,7 @@ int CDAudio_SysResume (void)
 {
        SDL_CDResume( cd );
        endtime = realtime + (cd->track[ cdPlayTrack - 1 ].length - pauseoffset) / CD_FPS;
 {
        SDL_CDResume( cd );
        endtime = realtime + (cd->track[ cdPlayTrack - 1 ].length - pauseoffset) / CD_FPS;
-       return SDL_CDPlayTracks( cd, cdPlayTrack - 1, pauseoffset, cdPlayTrack, 0 );
+       return SDL_CDPlayTracks( cd, cdPlayTrack - 1, (int)pauseoffset, cdPlayTrack, 0 );
 }
 
 int CDAudio_SysUpdate (void)
 }
 
 int CDAudio_SysUpdate (void)
@@ -128,10 +129,10 @@ int CDAudio_SysUpdate (void)
 
 void CDAudio_SysInit (void)
 {
 
 void CDAudio_SysInit (void)
 {
-       if( SDL_InitSubSystem( SDL_INIT_CDROM ) == -1 ) 
-               Con_SafePrint( "Failed to init the CDROM SDL subsystem!\n" );
+       if( SDL_InitSubSystem( SDL_INIT_CDROM ) == -1 )
+               Con_Print( "Failed to init the CDROM SDL subsystem!\n" );
 
 
-       Cmd_AddCommand( "cddrive", CDAudio_SDL_CDDrive_f );
+       Cmd_AddCommand( "cddrive", CDAudio_SDL_CDDrive_f, "select an SDL-detected CD drive by number" );
 }
 
 static int IsAudioCD( void )
 }
 
 static int IsAudioCD( void )
@@ -147,17 +148,17 @@ int CDAudio_SysStartup (void)
 {
        int i;
        int numdrives;
 {
        int i;
        int numdrives;
-    
+
        numdrives = SDL_CDNumDrives();
        if( numdrives == -1 ) // was the CDROM system initialized correctly?
                return -1;
 
        numdrives = SDL_CDNumDrives();
        if( numdrives == -1 ) // was the CDROM system initialized correctly?
                return -1;
 
-       Con_DPrintf( "Found %i cdrom drives.\n", numdrives );
+       Con_Printf( "Found %i cdrom drives.\n", numdrives );
 
        for( i = 0 ; i < numdrives ; i++, cd = NULL ) {
                cd = SDL_CDOpen( i );
                if( !cd ) {
 
        for( i = 0 ; i < numdrives ; i++, cd = NULL ) {
                cd = SDL_CDOpen( i );
                if( !cd ) {
-                       Con_DPrintf( "CD drive %i is invalid.\n", i );
+                       Con_Printf( "CD drive %i is invalid.\n", i );
                        continue;
                }
 
                        continue;
                }
 
@@ -165,9 +166,9 @@ int CDAudio_SysStartup (void)
                        if( IsAudioCD() )
                                break;
                        else
                        if( IsAudioCD() )
                                break;
                        else
-                               Con_DPrintf( "The CD in drive %i is not an audio cd.\n", i );
+                               Con_Printf( "The CD in drive %i is not an audio cd.\n", i );
                else
                else
-                       Con_DPrintf( "No CD in drive %i.\n", i );
+                       Con_Printf( "No CD in drive %i.\n", i );
 
                SDL_CDClose( cd );
        }
 
                SDL_CDClose( cd );
        }
@@ -209,8 +210,8 @@ void CDAudio_SDL_CDDrive_f( void )
        if( !cd ) {
                Con_Printf( "Couldn't open drive %i.\n", i );
                return;
        if( !cd ) {
                Con_Printf( "Couldn't open drive %i.\n", i );
                return;
-       } 
-       
+       }
+
        if( !CD_INDRIVE( SDL_CDStatus( cd ) ) )
                Con_Printf( "No cd in drive %i.\n", i );
        else if( !IsAudioCD() )
        if( !CD_INDRIVE( SDL_CDStatus( cd ) ) )
                Con_Printf( "No cd in drive %i.\n", i );
        else if( !IsAudioCD() )
@@ -223,4 +224,4 @@ void CDAudio_SDL_CDDrive_f( void )
 
 
 
 
 
 
-               
+