From 601a366b8c665f760463259552fedd7be43e5754 Mon Sep 17 00:00:00 2001 From: oroborus Date: Sat, 2 Feb 2008 20:37:46 +0000 Subject: - zvuky v hre - hudba/zvuky sa daju zapnut/vypnut - tuxovia nemozu ist v arene do nekonecna - oprava chyby, ak bol zaskrknuty iba samopal, hra sa zasekla - do widgetu textfiled sa neda pisat donekonecna - tux ovladany pomocou keyboard_left stiriela a meni zbran - tuxovia nemozu prechadzat cez seba git-svn-id: http://opensvn.csie.org/tuxanci_ng@2 0ee4d065-81f0-4d1e-b06c-ff20ad07cc3e --- src/sound.c | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) (limited to 'src/sound.c') diff --git a/src/sound.c b/src/sound.c index 45cb225..2e7ef4b 100644 --- a/src/sound.c +++ b/src/sound.c @@ -14,6 +14,7 @@ static list_t *listSound; static bool_t isSoundInit = FALSE; +static bool_t isSoundActive = TRUE; bool_t isSoundInicialized() { @@ -22,10 +23,14 @@ bool_t isSoundInicialized() void initSound() { - assert( isAudioInicialized() ); + if( isAudioInicialized() == FALSE ) + { + isSoundInit = FALSE; + } listSound = newList(); isSoundInit = TRUE; + isSoundActive = TRUE; printf("init sound..\n"); } @@ -35,6 +40,7 @@ static Mix_Chunk* loadMixSound(char *file) Mix_Chunk *new; char str[STR_PATH_SIZE]; + printf("load sound %s..\n", file); sprintf(str, PATH_SOUND "%s", file); new = Mix_LoadWAV(str); @@ -85,6 +91,12 @@ void playSound(char *name, int group) int i; sound_t *this; + if( isSoundInit == FALSE || + isSoundActive == FALSE ) + { + return; + } + for( i = 0 ; i < listSound->count ; i++ ) { this = (sound_t *)listSound->list[i]; @@ -97,8 +109,18 @@ void playSound(char *name, int group) } } +void setSoundActive(bool_t n) +{ + isSoundActive = n; +} + void quitSound() { + if( isSoundInit == FALSE ) + { + return; + } + destroyListItem(listSound, destroySound); isSoundInit = FALSE; printf("quit sound..\n"); -- cgit v1.2.3