rnd-20070323-1-src
[rocksndiamonds.git] / src / game.c
index 593a8bac409ac4b4a1f45cf0fc957ffe0d49ec56..8495b7b1c3d9796a4ce6dfe30124cdd01e1ab81a 100644 (file)
@@ -1897,7 +1897,7 @@ void DrawGameValue_Keys(int key[MAX_NUM_KEYS])
 #if 1
     struct TextPosInfo *pos = &game.panel.key[i];
 #endif
-    int src_x = DOOR_GFX_PAGEX5 + 18;
+    int src_x = DOOR_GFX_PAGEX5 + 18 + (i % 4) * MINI_TILEX;
     int src_y = DOOR_GFX_PAGEY1 + 123;
 #if 1
     int dst_x = PANEL_XPOS(pos);
@@ -2596,7 +2596,9 @@ void InitGame()
   boolean emulate_bd = TRUE;   /* unless non-BOULDERDASH elements found */
   boolean emulate_sb = TRUE;   /* unless non-SOKOBAN     elements found */
   boolean emulate_sp = TRUE;   /* unless non-SUPAPLEX    elements found */
+#if 0
   boolean do_fading = (game_status == GAME_MODE_MAIN);
+#endif
   int i, j, x, y;
 
   game_status = GAME_MODE_PLAYING;
@@ -3155,16 +3157,20 @@ void InitGame()
   if (!game.restart_level)
     CloseDoor(DOOR_CLOSE_1);
 
+#if 1
+  if (level_editor_test_game)
+    FadeSkipNextFadeIn();
+  else
+    FadeSetStartItem();
+#else
   if (level_editor_test_game)
     fading = fading_none;
   else
     fading = menu.destination;
+#endif
 
 #if 1
-  if (fading.anim_mode == ANIM_CROSSFADE)
-    FadeCrossSaveBackbuffer();
-  else
-    FadeOut(REDRAW_FIELD);
+  FadeOut(REDRAW_FIELD);
 #else
   if (do_fading)
     FadeOut(REDRAW_FIELD);
@@ -3196,10 +3202,7 @@ void InitGame()
   /* !!! FIX THIS (END) !!! */
 
 #if 1
-  if (fading.anim_mode == ANIM_CROSSFADE)
-    FadeCross(redraw_mask);
-  else
-    FadeIn(redraw_mask);
+  FadeIn(REDRAW_FIELD);
 #else
   if (do_fading)
     FadeIn(REDRAW_FIELD);
@@ -3668,11 +3671,6 @@ void GameEnd()
   if (!local_player->LevelSolved_SaveScore)
   {
 #if 1
-    if (fading.anim_mode == ANIM_CROSSFADE)
-      FadeCrossSaveBackbuffer();
-    else
-      FadeOut(REDRAW_FIELD);
-#else
     FadeOut(REDRAW_FIELD);
 #endif
 
@@ -3707,11 +3705,6 @@ void GameEnd()
   else
   {
 #if 1
-    if (fading.anim_mode == ANIM_CROSSFADE)
-      FadeCrossSaveBackbuffer();
-    else
-      FadeOut(REDRAW_FIELD);
-#else
     FadeOut(REDRAW_FIELD);
 #endif
 
@@ -4198,8 +4191,10 @@ void DrawRelocateScreen(int old_x, int old_y, int x, int y, int move_dir,
 
     if (!IN_VIS_FIELD(SCREENX(x), SCREENY(y)) || center_screen)
     {
-      if (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);
@@ -4234,6 +4229,8 @@ void DrawRelocateScreen(int old_x, int old_y, int x, int y, int move_dir,
     }
     else
     {
+      /* quick relocation (without scrolling), inside visible screen area */
+
       if ((move_dir == MV_LEFT  && scroll_x > x - MIDPOSX + offset) ||
          (move_dir == MV_RIGHT && scroll_x < x - MIDPOSX - offset))
        scroll_x = x - MIDPOSX + (scroll_x < x - MIDPOSX ? -offset : +offset);
@@ -4255,6 +4252,49 @@ void DrawRelocateScreen(int old_x, int old_y, int x, int y, int move_dir,
   }
   else
   {
+#if 1
+    int scroll_xx, scroll_yy;
+
+    if (!level.shifted_relocation || center_screen)
+    {
+      /* visible relocation (with scrolling), with centering of screen */
+
+      scroll_xx = (x < SBX_Left  + MIDPOSX ? SBX_Left :
+                  x > SBX_Right + MIDPOSX ? SBX_Right :
+                  x - MIDPOSX);
+
+      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 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_xx = (offset_x < SBX_Left  + MIDPOSX ? SBX_Left :
+                  offset_x > SBX_Right + MIDPOSX ? SBX_Right :
+                  offset_x - MIDPOSX);
+
+      scroll_yy = (offset_y < SBY_Upper + MIDPOSY ? SBY_Upper :
+                  offset_y > SBY_Lower + MIDPOSY ? SBY_Lower :
+                  offset_y - MIDPOSY);
+    }
+
+#else
+
+    /* visible relocation (with scrolling), with centering of screen */
+
     int scroll_xx = (x < SBX_Left  + MIDPOSX ? SBX_Left :
                     x > SBX_Right + MIDPOSX ? SBX_Right :
                     x - MIDPOSX);
@@ -4262,6 +4302,7 @@ void DrawRelocateScreen(int old_x, int old_y, int x, int y, int move_dir,
     int scroll_yy = (y < SBY_Upper + MIDPOSY ? SBY_Upper :
                     y > SBY_Lower + MIDPOSY ? SBY_Lower :
                     y - MIDPOSY);
+#endif
 
     ScrollScreen(NULL, SCROLL_GO_ON);  /* scroll last frame to full tile */
 
@@ -14131,7 +14172,13 @@ void RequestQuitGameExt(boolean skip_request, boolean quick_quit, char *message)
       if (quick_quit)
       {
 #if 1
+
+#if 1
+       FadeSkipNextFadeIn();
+#else
        fading = fading_none;
+#endif
+
 #else
        OpenDoor(DOOR_CLOSE_1);
 #endif
@@ -14147,14 +14194,7 @@ void RequestQuitGameExt(boolean skip_request, boolean quick_quit, char *message)
       else
       {
 #if 0
-#if 1
-       if (fading.anim_mode == ANIM_CROSSFADE)
-         FadeCrossSaveBackbuffer();
-       else
-         FadeOut(REDRAW_FIELD);
-#else
        FadeOut(REDRAW_FIELD);
-#endif
 #endif
 
        game_status = GAME_MODE_MAIN;