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
master
Dennis Schridde 2006-04-01 17:50:19 +00:00
parent 045755e9a3
commit 628a06067b
6 changed files with 9 additions and 32 deletions

View File

@ -701,7 +701,7 @@ void screenToggleMode(void)
typedef struct { typedef struct {
struct jpeg_destination_mgr pub; struct jpeg_destination_mgr pub;
struct PHYSFS_File* file; PHYSFS_file* file;
JOCTET * buffer; JOCTET * buffer;
} my_jpeg_destination_mgr; } my_jpeg_destination_mgr;

View File

@ -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 // init audio system
g_bAudioEnabled = sound_Init( hWnd, MAX_SAME_SAMPLES ); if (g_bAudioEnabled = sound_Init(MAX_SAME_SAMPLES))
if ( g_bAudioEnabled == TRUE )
{ {
// allocate sample heap // allocate sample heap
if ( !HEAP_CREATE(&g_psSampleHeap, AUDIO_SAMPLE_HEAP_INIT, AUDIO_SAMPLE_HEAP_EXT, sizeof(AUDIO_SAMPLE)) ) 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 ); sound_SetStoppedCallback( pStopTrackCallback );
// ifdef WIN32 //Not needed ?--Qamly
//
// InitializeCriticalSection( &critSecAudio );
//
// endif
return TRUE;
}
else
{
return FALSE;
} }
return g_bAudioEnabled;
} }
//* //*

View File

@ -11,8 +11,7 @@
/***************************************************************************/ /***************************************************************************/
extern BOOL audio_Init( HWND hWnd, BOOL bEnabled, extern BOOL audio_Init( AUDIO_CALLBACK pStopTrackCallback );
AUDIO_CALLBACK pStopTrackCallback );
extern BOOL audio_Update(); extern BOOL audio_Update();
extern BOOL audio_Shutdown(); extern BOOL audio_Shutdown();
extern BOOL audio_Disabled( void ); extern BOOL audio_Disabled( void );

View File

@ -63,7 +63,7 @@ BOOL sound_CheckDevice( void )
// ======================================================================================================================= // =======================================================================================================================
// ======================================================================================================================= // =======================================================================================================================
// //
BOOL sound_Init( HWND hWnd, SDWORD iMaxSameSamples ) BOOL sound_Init( SDWORD iMaxSameSamples )
{ {
//~~~~~~~~~~~~~ //~~~~~~~~~~~~~
#ifdef USE_COMPRESSED_SPEECH #ifdef USE_COMPRESSED_SPEECH

View File

@ -87,7 +87,7 @@ typedef struct TRACK
/* functions /* functions
*/ */
BOOL sound_Init( HWND hWnd, SDWORD iMaxSameSamples ); BOOL sound_Init( SDWORD iMaxSameSamples );
BOOL sound_Shutdown(); BOOL sound_Shutdown();
BOOL sound_LoadTrackFromFile( signed char szFileName[] ); BOOL sound_LoadTrackFromFile( signed char szFileName[] );

View File

@ -987,13 +987,9 @@ BOOL systemInitialise(void)
return FALSE; return FALSE;
} }
#ifdef AUDIO_DISABLED if (!audio_Init(droidAudioTrackStopped))
if (!audio_Init(frameGetWinHandle(), FALSE, droidAudioTrackStopped)) // audio.
#else
if (!audio_Init((HWND) frameGetWinHandle(), TRUE, droidAudioTrackStopped))
#endif
{ {
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()) { if (war_GetPlayAudioCDs()) {