From 628a06067baa2fd9689922621f6a722758c8a1bb Mon Sep 17 00:00:00 2001 From: Dennis Schridde Date: Sat, 1 Apr 2006 17:50:19 +0000 Subject: [PATCH] lib/ivis_opengl/screen.c: - G++ fix( PHYSFS_file ). other: - Simplify sound code. - Make Warzone run with busy audio device (Linux). All patches by cybersphinx. git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@412 4a71c877-e1ca-e34f-864e-861f7616d084 --- lib/ivis_opengl/screen.c | 2 +- lib/sound/audio.c | 24 +++--------------------- lib/sound/audio.h | 3 +-- lib/sound/track.c | 2 +- lib/sound/track.h | 2 +- src/init.c | 8 ++------ 6 files changed, 9 insertions(+), 32 deletions(-) diff --git a/lib/ivis_opengl/screen.c b/lib/ivis_opengl/screen.c index 81a13a836..6361afd15 100644 --- a/lib/ivis_opengl/screen.c +++ b/lib/ivis_opengl/screen.c @@ -701,7 +701,7 @@ void screenToggleMode(void) typedef struct { struct jpeg_destination_mgr pub; - struct PHYSFS_File* file; + PHYSFS_file* file; JOCTET * buffer; } my_jpeg_destination_mgr; diff --git a/lib/sound/audio.c b/lib/sound/audio.c index 37c6c51dc..fe3108bc0 100644 --- a/lib/sound/audio.c +++ b/lib/sound/audio.c @@ -71,18 +71,10 @@ BOOL audio_Disabled( void ) // ======================================================================================================================= // ======================================================================================================================= // -BOOL audio_Init( HWND hWnd, BOOL bEnabled, AUDIO_CALLBACK pStopTrackCallback ) +BOOL audio_Init( AUDIO_CALLBACK pStopTrackCallback ) { - // if audio not enabled return TRUE to carry on game without audio - if ( bEnabled == FALSE ) - { - g_bAudioEnabled = FALSE; - return TRUE; - } - // init audio system - g_bAudioEnabled = sound_Init( hWnd, MAX_SAME_SAMPLES ); - if ( g_bAudioEnabled == TRUE ) + if (g_bAudioEnabled = sound_Init(MAX_SAME_SAMPLES)) { // allocate sample heap if ( !HEAP_CREATE(&g_psSampleHeap, AUDIO_SAMPLE_HEAP_INIT, AUDIO_SAMPLE_HEAP_EXT, sizeof(AUDIO_SAMPLE)) ) @@ -92,18 +84,8 @@ BOOL audio_Init( HWND hWnd, BOOL bEnabled, AUDIO_CALLBACK pStopTrackCallback ) } sound_SetStoppedCallback( pStopTrackCallback ); - - // ifdef WIN32 //Not needed ?--Qamly - // - // InitializeCriticalSection( &critSecAudio ); - // - // endif - return TRUE; - } - else - { - return FALSE; } + return g_bAudioEnabled; } //* diff --git a/lib/sound/audio.h b/lib/sound/audio.h index 9ad8bbc41..971911dcc 100644 --- a/lib/sound/audio.h +++ b/lib/sound/audio.h @@ -11,8 +11,7 @@ /***************************************************************************/ -extern BOOL audio_Init( HWND hWnd, BOOL bEnabled, - AUDIO_CALLBACK pStopTrackCallback ); +extern BOOL audio_Init( AUDIO_CALLBACK pStopTrackCallback ); extern BOOL audio_Update(); extern BOOL audio_Shutdown(); extern BOOL audio_Disabled( void ); diff --git a/lib/sound/track.c b/lib/sound/track.c index 1a5b09f45..363fdc534 100644 --- a/lib/sound/track.c +++ b/lib/sound/track.c @@ -63,7 +63,7 @@ BOOL sound_CheckDevice( void ) // ======================================================================================================================= // ======================================================================================================================= // -BOOL sound_Init( HWND hWnd, SDWORD iMaxSameSamples ) +BOOL sound_Init( SDWORD iMaxSameSamples ) { //~~~~~~~~~~~~~ #ifdef USE_COMPRESSED_SPEECH diff --git a/lib/sound/track.h b/lib/sound/track.h index fc065c652..23678c27a 100644 --- a/lib/sound/track.h +++ b/lib/sound/track.h @@ -87,7 +87,7 @@ typedef struct TRACK /* functions */ -BOOL sound_Init( HWND hWnd, SDWORD iMaxSameSamples ); +BOOL sound_Init( SDWORD iMaxSameSamples ); BOOL sound_Shutdown(); BOOL sound_LoadTrackFromFile( signed char szFileName[] ); diff --git a/src/init.c b/src/init.c index ca1582343..b1af8bb37 100644 --- a/src/init.c +++ b/src/init.c @@ -987,13 +987,9 @@ BOOL systemInitialise(void) return FALSE; } - #ifdef AUDIO_DISABLED - if (!audio_Init(frameGetWinHandle(), FALSE, droidAudioTrackStopped)) // audio. - #else - if (!audio_Init((HWND) frameGetWinHandle(), TRUE, droidAudioTrackStopped)) - #endif + if (!audio_Init(droidAudioTrackStopped)) { - DBERROR( ("Couldn't initialise audio system: continuing without audio\n") ); + debug( LOG_SOUND, "Couldn't initialise audio system: continuing without audio\n" ); } if (war_GetPlayAudioCDs()) {