X-Git-Url: https://git.artsoft.org/?p=rocksndiamonds.git;a=blobdiff_plain;f=src%2Ftools.c;h=55a28fc40d0cf13ef90ec1df29c3910bb15e5661;hp=2ca18cf6b5f773e117aa6e0ebbfaf0fc010479f3;hb=9eb4ba2e639c16c6a5e72ddaeabfb455a85c66bf;hpb=567cfcb396e3fc031a25362b747dd0a5a096b4ec diff --git a/src/tools.c b/src/tools.c index 2ca18cf6..55a28fc4 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); } @@ -926,6 +933,10 @@ void FadeIn(int fade_mask) FADE_SXSIZE = FULL_SXSIZE; FADE_SYSIZE = FULL_SYSIZE; + if (game_status == GAME_MODE_PLAYING && + strEqual(setup.touch.control_type, TOUCH_CONTROL_VIRTUAL_BUTTONS)) + SetOverlayActive(TRUE); + SetScreenStates_AfterFadingIn(); // force update of global animation status in case of rapid screen changes @@ -941,6 +952,8 @@ void FadeOut(int fade_mask) SetScreenStates_BeforeFadingOut(); + SetOverlayActive(FALSE); + #if 0 DrawMaskedBorder(REDRAW_ALL); #endif @@ -2322,6 +2335,10 @@ void DrawScreenField(int x, int y) int newly = ly + (dir == MV_UP ? -1 : dir == MV_DOWN ? +1 : 0); DrawLevelElementThruMask(newlx, newly, EL_ACID); + + // prevent target field from being drawn again (but without masking) + // (this would happen if target field is scanned after moving element) + Stop[newlx][newly] = TRUE; } } else if (IS_BLOCKED(lx, ly)) @@ -4207,10 +4224,19 @@ static boolean RequestEnvelope(char *text, unsigned int req_state) boolean Request(char *text, unsigned int req_state) { + boolean overlay_active = GetOverlayActive(); + boolean result; + + SetOverlayActive(FALSE); + if (global.use_envelope_request) - return RequestEnvelope(text, req_state); + result = RequestEnvelope(text, req_state); else - return RequestDoor(text, req_state); + result = RequestDoor(text, req_state); + + SetOverlayActive(overlay_active); + + return result; } static int compareDoorPartOrderInfo(const void *object1, const void *object2) @@ -8379,7 +8405,37 @@ 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() +{ + PlayMenuSound(); + 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() +{ + FadeMenuSounds(); + FadeMenuMusic(); } void PlaySoundActivating() @@ -8488,6 +8544,9 @@ void SetAnimStatus(int anim_status_new) void SetGameStatus(int game_status_new) { + if (game_status_new != game_status) + game_status_last_screen = game_status; + game_status = game_status_new; SetAnimStatus(game_status_new);