X-Git-Url: https://jasonwoof.com/gitweb/?p=vor.git;a=blobdiff_plain;f=sound.c;h=471808efd42440a8d288d8e63eee6c896b85a1c2;hp=16f3d607c0ed65de60bacdd2666b09091c5ae81f;hb=a9bcdd09afa1b6ea40a7fb09fdd16b60dc932775;hpb=3079660eb1f60a861b677b746da581c4c0e6c3dd diff --git a/sound.c b/sound.c index 16f3d60..471808e 100644 --- a/sound.c +++ b/sound.c @@ -11,7 +11,7 @@ static Mix_Music *music[NUM_TUNES]; -static int music_volume[NUM_TUNES] = {128,128,128}; +static int music_volume[NUM_TUNES] = {88,88,88}; static Mix_Chunk *wav[NUM_SOUNDS]; int audio_rate; @@ -20,10 +20,7 @@ int audio_channels; char *add_data_path(char *); char *wav_file[] = { - "booom.wav", - "cboom.wav", - "boom.wav", - "bzboom.wav" + "bang.wav" }; char *tune_file[] = { @@ -77,18 +74,48 @@ int playing=-1; void play_tune(int i) { - if(!opt_sound) return; - if (playing==i) - return; + if(!opt_sound) { + return; + } + if (playing == i) { + return; + } if (playing) { - Mix_FadeOutMusic(1500); + Mix_FadeOutMusic(2500); + } + if(i == TUNE_GAMEPLAY) { + Mix_FadeInMusic(music[i],-1,2000); + Mix_VolumeMusic(music_volume[i]); } - Mix_FadeInMusic(music[i],-1,2000); - Mix_VolumeMusic(music_volume[i]); playing = i; } + +int tune_paused=0; + +void +pause_tune() { + if(!opt_sound) { + return; + } + if(playing == TUNE_GAMEPLAY && !tune_paused) { + Mix_PauseMusic(); + tune_paused = 1; + } +} + +void +resume_tune() { + if(!opt_sound) { + return; + } + if(playing == TUNE_GAMEPLAY && tune_paused) { + Mix_ResumeMusic(); + tune_paused = 0; + } +} + /* * * The init_sound() routine is called first.