X-Git-Url: https://git.artsoft.org/?a=blobdiff_plain;f=src%2Ftools.c;h=6c990cbc2cb956ff1cf009e92bfef32a56f4493d;hb=d275633f8688c5ea2846b1fe063e07bbe3ea53b0;hp=9b573f66c2c2bbebb0880b9d882808ce1135d4e0;hpb=5facf9255f9b11b10ecb89d4e552ae931e35bb89;p=rocksndiamonds.git diff --git a/src/tools.c b/src/tools.c index 9b573f66..6c990cbc 100644 --- a/src/tools.c +++ b/src/tools.c @@ -759,6 +759,13 @@ void BackToFront() y2 = MAX(y2, EY + EYSIZE); } + // make sure that at least one pixel is blitted, and inside the screen + // (else nothing is blitted, causing the animations not to be updated) + x1 = MIN(MAX(0, x1), WIN_XSIZE - 1); + y1 = MIN(MAX(0, y1), WIN_YSIZE - 1); + x2 = MIN(MAX(1, x2), WIN_XSIZE); + y2 = MIN(MAX(1, y2), WIN_YSIZE); + BlitBitmap(backbuffer, window, x1, y1, x2 - x1, y2 - y1, x1, y1); } @@ -3729,6 +3736,9 @@ void WaitForEventToContinue() { boolean still_wait = TRUE; + if (program.headless) + return; + /* simulate releasing mouse button over last gadget, if still pressed */ if (button_status) HandleGadgets(-1, -1, 0); @@ -8398,7 +8408,11 @@ void PlayMenuMusicExt(int music) void PlayMenuMusic() { - PlayMenuMusicExt(menu.music[game_status]); + char *curr_music = getCurrentlyPlayingMusicFilename(); + char *next_music = getMusicListEntry(menu.music[game_status])->filename; + + if (!strEqual(curr_music, next_music)) + PlayMenuMusicExt(menu.music[game_status]); } void PlayMenuSoundsAndMusic() @@ -8407,9 +8421,24 @@ void PlayMenuSoundsAndMusic() PlayMenuMusic(); } +static void FadeMenuSounds() +{ + FadeSounds(); +} + +static void FadeMenuMusic() +{ + char *curr_music = getCurrentlyPlayingMusicFilename(); + char *next_music = getMusicListEntry(menu.music[game_status])->filename; + + if (!strEqual(curr_music, next_music)) + FadeMusic(); +} + void FadeMenuSoundsAndMusic() { - FadeSoundsAndMusic(); + FadeMenuSounds(); + FadeMenuMusic(); } void PlaySoundActivating()