rnd-20000831-1-src
[rocksndiamonds.git] / src / tools.c
index 559e06bfb8f3e036f83840f7e0e350a8af3a3de6..d4e42abbafe356c94354a505e4c547aecba8a343 100644 (file)
@@ -99,6 +99,49 @@ void BackToFront()
   if (!redraw_mask)
     return;
 
+
+
+  if (1 &&   game_status == PLAYING)
+  {
+    static boolean last_frame_skipped = 0;
+    int fps_slowdown_factor = 2;
+    boolean skip_even_when_not_scrolling = 1;
+    boolean just_scrolling = (ScreenMovDir != 0);
+    boolean p = 0;
+
+    /*
+    printf("ScreenMovDir = %d\n", ScreenMovDir);
+    */
+
+    /*
+    printf("ScreenGfxPos = %d\n", ScreenGfxPos);
+    */
+
+    if (fps_slowdown_factor > 1 &&
+       (FrameCounter % fps_slowdown_factor) &&
+       (just_scrolling || skip_even_when_not_scrolling))
+    {
+      redraw_mask &= ~REDRAW_MAIN;
+
+      if (p)
+       printf("FRAME SKIPPED\n");
+
+      last_frame_skipped = 1;
+    }
+    else
+    {
+      if (last_frame_skipped)
+       redraw_mask |= REDRAW_FIELD;
+
+      last_frame_skipped = 0;
+
+      if (p)
+       printf("frame not skipped\n");
+    }
+  }
+
+
+
   /* synchronize X11 graphics at this point; if we would synchronize the
      display immediately after the buffer switching (after the XFlush),
      this could mean that we have to wait for the graphics to complete,
@@ -151,6 +194,7 @@ void BackToFront()
 #endif
       }
     }
+
     redraw_mask &= ~REDRAW_MAIN;
   }
 
@@ -207,6 +251,14 @@ void BackToFront()
                     SX + x * TILEX, SY + y * TILEY);
   }
 
+  if (redraw_mask & REDRAW_FPS)                /* display frames per second */
+  {
+    char text[100];
+
+    sprintf(text, "%.1f fps", global.frames_per_second);
+    DrawTextExt(window, gc, SX, SY, text, FS_SMALL, FC_YELLOW);
+  }
+
   FlushDisplay();
 
   for(x=0; x<MAX_BUF_XSIZE; x++)
@@ -1783,7 +1835,7 @@ boolean Request(char *text, unsigned int req_state)
   int mx, my, ty, result = -1;
   unsigned int old_door_state;
 
-#ifndef MSDOS
+#if !defined(MSDOS) && !defined(WIN32)
   /* pause network game while waiting for request to answer */
   if (options.network &&
       game_status == PLAYING &&
@@ -2007,7 +2059,7 @@ boolean Request(char *text, unsigned int req_state)
 
   RemapAllGadgets();
 
-#ifndef MSDOS
+#if !defined(MSDOS) && !defined(WIN32)
   /* continue network game after request */
   if (options.network &&
       game_status == PLAYING &&