rnd-19980915
[rocksndiamonds.git] / src / cartoons.c
index a295844ff733f9febfcf6fab182ea0c0b5e734b0..1d5373142b4a6fa18a90b2402383f5884f2570a3 100644 (file)
@@ -125,18 +125,30 @@ void HandleAnimation(int mode)
       reset_delay = TRUE;
 
       /* Fill empty backbuffer for animation functions */
-      if (direct_draw_on && game_status==PLAYING)
+      if (direct_draw_on && game_status == PLAYING)
       {
        int xx,yy;
 
-       drawto_field = backbuffer;
+       SetDrawtoField(DRAW_BACKBUFFER);
 
        for(xx=0;xx<SCR_FIELDX;xx++)
          for(yy=0;yy<SCR_FIELDY;yy++)
            DrawScreenField(xx,yy);
        DrawPlayerField();
 
-       drawto_field = window;
+       SetDrawtoField(DRAW_DIRECT);
+      }
+
+      if (soft_scrolling_on && game_status == PLAYING)
+      {
+       int fx = FX, fy = FY;
+
+        fx += (PlayerMovDir & (MV_LEFT|MV_RIGHT) ? ScreenMovPos : 0);
+        fy += (PlayerMovDir & (MV_UP|MV_DOWN)    ? ScreenMovPos : 0);
+
+       XCopyArea(display,fieldbuffer,backbuffer,gc,
+                 fx,fy, SXSIZE,SYSIZE,
+                 SX,SY);
       }
 
       return;
@@ -144,7 +156,7 @@ void HandleAnimation(int mode)
     case ANIM_CONTINUE:
       break;
     case ANIM_STOP:
-      redraw_mask |= REDRAW_FIELD;
+      redraw_mask |= (REDRAW_FIELD | REDRAW_FROM_BACKBUFFER);
 
       /* Redraw background even when in direct drawing mode */
       draw_mode = direct_draw_on;