X-Git-Url: https://git.artsoft.org/?a=blobdiff_plain;f=src%2Fgame.c;h=2ead5c3675942c1dcead4e96024d89f800fc2044;hb=85115f113921052bd1fb3a9794f5c583f942bbec;hp=41add9e6745afd10fb6ad28fafe4e438d6aa7e9e;hpb=1afe0b4fb9e16c78f2bb810c1225098f5d77e2d3;p=rocksndiamonds.git diff --git a/src/game.c b/src/game.c index 41add9e6..2ead5c36 100644 --- a/src/game.c +++ b/src/game.c @@ -4428,8 +4428,6 @@ void GameEnd() if (!local_player->LevelSolved_SaveScore) { - FadeOut(REDRAW_FIELD); - game_status = GAME_MODE_MAIN; DrawMainMenu(); @@ -4461,8 +4459,6 @@ void GameEnd() } else { - FadeOut(REDRAW_FIELD); - game_status = GAME_MODE_MAIN; if (raise_level) @@ -4895,167 +4891,101 @@ void DrawRelocateScreen(int old_x, int old_y, int x, int y, int move_dir, boolean no_delay = (tape.warp_forward); int frame_delay_value = (ffwd_delay ? FfwdFrameDelay : GameFrameDelay); int wait_delay_value = (no_delay ? 0 : frame_delay_value); + int scroll_xx, scroll_yy; if (level.lazy_relocation && IN_VIS_FIELD(SCREENX(x), SCREENY(y))) { - RedrawPlayfield(); - } - else if (quick_relocation) - { - if (!IN_VIS_FIELD(SCREENX(x), SCREENY(y)) || center_screen) - { - if (!level.shifted_relocation || center_screen) - { - /* quick relocation (without scrolling), with centering of screen */ - - scroll_x = (x < SBX_Left + MIDPOSX ? SBX_Left : - x > SBX_Right + MIDPOSX ? SBX_Right : - x - MIDPOSX); - - scroll_y = (y < SBY_Upper + MIDPOSY ? SBY_Upper : - y > SBY_Lower + MIDPOSY ? SBY_Lower : - y - MIDPOSY); - } - else - { - /* quick relocation (without scrolling), but do not center screen */ - - int center_scroll_x = (old_x < SBX_Left + MIDPOSX ? SBX_Left : - old_x > SBX_Right + MIDPOSX ? SBX_Right : - old_x - MIDPOSX); - - int center_scroll_y = (old_y < SBY_Upper + MIDPOSY ? SBY_Upper : - old_y > SBY_Lower + MIDPOSY ? SBY_Lower : - old_y - MIDPOSY); - - int offset_x = x + (scroll_x - center_scroll_x); - int offset_y = y + (scroll_y - center_scroll_y); - - scroll_x = (offset_x < SBX_Left + MIDPOSX ? SBX_Left : - offset_x > SBX_Right + MIDPOSX ? SBX_Right : - offset_x - MIDPOSX); + /* case 1: quick relocation inside visible screen (without scrolling) */ - scroll_y = (offset_y < SBY_Upper + MIDPOSY ? SBY_Upper : - offset_y > SBY_Lower + MIDPOSY ? SBY_Lower : - offset_y - MIDPOSY); - } - } - else - { - if (!level.shifted_relocation || center_screen) - { - /* quick relocation (without scrolling), with centering of screen */ - - scroll_x = (x < SBX_Left + MIDPOSX ? SBX_Left : - x > SBX_Right + MIDPOSX ? SBX_Right : - x - MIDPOSX); - - scroll_y = (y < SBY_Upper + MIDPOSY ? SBY_Upper : - y > SBY_Lower + MIDPOSY ? SBY_Lower : - y - MIDPOSY); - } - else - { - /* quick relocation (without scrolling), but do not center screen */ - - int center_scroll_x = (old_x < SBX_Left + MIDPOSX ? SBX_Left : - old_x > SBX_Right + MIDPOSX ? SBX_Right : - old_x - MIDPOSX); - - int center_scroll_y = (old_y < SBY_Upper + MIDPOSY ? SBY_Upper : - old_y > SBY_Lower + MIDPOSY ? SBY_Lower : - old_y - MIDPOSY); + RedrawPlayfield(); - int offset_x = x + (scroll_x - center_scroll_x); - int offset_y = y + (scroll_y - center_scroll_y); + return; + } - scroll_x = (offset_x < SBX_Left + MIDPOSX ? SBX_Left : - offset_x > SBX_Right + MIDPOSX ? SBX_Right : - offset_x - MIDPOSX); + if (!level.shifted_relocation || center_screen) + { + /* relocation _with_ centering of screen */ - scroll_y = (offset_y < SBY_Upper + MIDPOSY ? SBY_Upper : - offset_y > SBY_Lower + MIDPOSY ? SBY_Lower : - offset_y - MIDPOSY); - } - } + scroll_xx = (x < SBX_Left + MIDPOSX ? SBX_Left : + x > SBX_Right + MIDPOSX ? SBX_Right : + x - MIDPOSX); - RedrawPlayfield(); + scroll_yy = (y < SBY_Upper + MIDPOSY ? SBY_Upper : + y > SBY_Lower + MIDPOSY ? SBY_Lower : + y - MIDPOSY); } else { - int scroll_xx, scroll_yy; + /* relocation _without_ centering of screen */ - if (!level.shifted_relocation || center_screen) - { - /* visible relocation (with scrolling), with centering of screen */ + int center_scroll_x = (old_x < SBX_Left + MIDPOSX ? SBX_Left : + old_x > SBX_Right + MIDPOSX ? SBX_Right : + old_x - MIDPOSX); - scroll_xx = (x < SBX_Left + MIDPOSX ? SBX_Left : - x > SBX_Right + MIDPOSX ? SBX_Right : - x - MIDPOSX); + int center_scroll_y = (old_y < SBY_Upper + MIDPOSY ? SBY_Upper : + old_y > SBY_Lower + MIDPOSY ? SBY_Lower : + old_y - MIDPOSY); - scroll_yy = (y < SBY_Upper + MIDPOSY ? SBY_Upper : - y > SBY_Lower + MIDPOSY ? SBY_Lower : - y - MIDPOSY); - } - else - { - /* visible relocation (with scrolling), but do not center screen */ + int offset_x = x + (scroll_x - center_scroll_x); + int offset_y = y + (scroll_y - center_scroll_y); - int center_scroll_x = (old_x < SBX_Left + MIDPOSX ? SBX_Left : - old_x > SBX_Right + MIDPOSX ? SBX_Right : - old_x - MIDPOSX); + scroll_xx = (offset_x < SBX_Left + MIDPOSX ? SBX_Left : + offset_x > SBX_Right + MIDPOSX ? SBX_Right : + offset_x - MIDPOSX); - int center_scroll_y = (old_y < SBY_Upper + MIDPOSY ? SBY_Upper : - old_y > SBY_Lower + MIDPOSY ? SBY_Lower : - old_y - MIDPOSY); - - int offset_x = x + (scroll_x - center_scroll_x); - int offset_y = y + (scroll_y - center_scroll_y); + scroll_yy = (offset_y < SBY_Upper + MIDPOSY ? SBY_Upper : + offset_y > SBY_Lower + MIDPOSY ? SBY_Lower : + offset_y - MIDPOSY); + } - scroll_xx = (offset_x < SBX_Left + MIDPOSX ? SBX_Left : - offset_x > SBX_Right + MIDPOSX ? SBX_Right : - offset_x - MIDPOSX); + if (quick_relocation) + { + /* case 2: quick relocation (redraw without visible scrolling) */ - scroll_yy = (offset_y < SBY_Upper + MIDPOSY ? SBY_Upper : - offset_y > SBY_Lower + MIDPOSY ? SBY_Lower : - offset_y - MIDPOSY); - } + scroll_x = scroll_xx; + scroll_y = scroll_yy; - ScrollScreen(NULL, SCROLL_GO_ON); /* scroll last frame to full tile */ + RedrawPlayfield(); - while (scroll_x != scroll_xx || scroll_y != scroll_yy) - { - int dx = 0, dy = 0; - int fx = FX, fy = FY; + return; + } - dx = (scroll_xx < scroll_x ? +1 : scroll_xx > scroll_x ? -1 : 0); - dy = (scroll_yy < scroll_y ? +1 : scroll_yy > scroll_y ? -1 : 0); + /* case 3: visible relocation (with scrolling to new position) */ - if (dx == 0 && dy == 0) /* no scrolling needed at all */ - break; + ScrollScreen(NULL, SCROLL_GO_ON); /* scroll last frame to full tile */ - scroll_x -= dx; - scroll_y -= dy; + while (scroll_x != scroll_xx || scroll_y != scroll_yy) + { + int dx = 0, dy = 0; + int fx = FX, fy = FY; - fx += dx * TILEX / 2; - fy += dy * TILEY / 2; + dx = (scroll_xx < scroll_x ? +1 : scroll_xx > scroll_x ? -1 : 0); + dy = (scroll_yy < scroll_y ? +1 : scroll_yy > scroll_y ? -1 : 0); - ScrollLevel(dx, dy); - DrawAllPlayers(); + if (dx == 0 && dy == 0) /* no scrolling needed at all */ + break; - /* scroll in two steps of half tile size to make things smoother */ - BlitBitmap(drawto_field, window, fx, fy, SXSIZE, SYSIZE, SX, SY); - Delay(wait_delay_value); + scroll_x -= dx; + scroll_y -= dy; - /* scroll second step to align at full tile size */ - BackToFront(); - Delay(wait_delay_value); - } + fx += dx * TILEX / 2; + fy += dy * TILEY / 2; + ScrollLevel(dx, dy); DrawAllPlayers(); + + /* scroll in two steps of half tile size to make things smoother */ + BlitBitmap(drawto_field, window, fx, fy, SXSIZE, SYSIZE, SX, SY); + Delay(wait_delay_value); + + /* scroll second step to align at full tile size */ BackToFront(); Delay(wait_delay_value); } + + DrawAllPlayers(); + BackToFront(); + Delay(wait_delay_value); } void RelocatePlayer(int jx, int jy, int el_player_raw)