X-Git-Url: https://git.artsoft.org/?a=blobdiff_plain;f=src%2Ftools.c;h=77f574db3c25be10c396853295bf822bf25191ea;hb=a8b2caa1d373c84c1b3fc2f615370c2a319051ca;hp=d4e42abbafe356c94354a505e4c547aecba8a343;hpb=8eee8a56a5aae567522998ccddf929e38aed6872;p=rocksndiamonds.git diff --git a/src/tools.c b/src/tools.c index d4e42abb..77f574db 100644 --- a/src/tools.c +++ b/src/tools.c @@ -99,49 +99,36 @@ void BackToFront() if (!redraw_mask) return; - - - if (1 && game_status == PLAYING) + if (global.fps_slowdown && game_status == PLAYING) { - static boolean last_frame_skipped = 0; - int fps_slowdown_factor = 2; - boolean skip_even_when_not_scrolling = 1; + static boolean last_frame_skipped = FALSE; + boolean skip_even_when_not_scrolling = TRUE; boolean just_scrolling = (ScreenMovDir != 0); - boolean p = 0; - - /* - printf("ScreenMovDir = %d\n", ScreenMovDir); - */ + boolean verbose = FALSE; - /* - printf("ScreenGfxPos = %d\n", ScreenGfxPos); - */ - - if (fps_slowdown_factor > 1 && - (FrameCounter % fps_slowdown_factor) && + if (global.fps_slowdown_factor > 1 && + (FrameCounter % global.fps_slowdown_factor) && (just_scrolling || skip_even_when_not_scrolling)) { redraw_mask &= ~REDRAW_MAIN; - if (p) - printf("FRAME SKIPPED\n"); + last_frame_skipped = TRUE; - last_frame_skipped = 1; + if (verbose) + printf("FRAME SKIPPED\n"); } else { if (last_frame_skipped) redraw_mask |= REDRAW_FIELD; - last_frame_skipped = 0; + last_frame_skipped = FALSE; - if (p) + if (verbose) 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, @@ -254,8 +241,13 @@ void BackToFront() if (redraw_mask & REDRAW_FPS) /* display frames per second */ { char text[100]; + char info1[100]; + + sprintf(info1, " (only every %d. frame)", global.fps_slowdown_factor); + if (!global.fps_slowdown) + info1[0] = '\0'; - sprintf(text, "%.1f fps", global.frames_per_second); + sprintf(text, "%.1f fps%s", global.frames_per_second, info1); DrawTextExt(window, gc, SX, SY, text, FS_SMALL, FC_YELLOW); } @@ -935,7 +927,7 @@ void DrawGraphicThruMaskExt(DrawBuffer d, int dest_x, int dest_y, int graphic) else { #if DEBUG -#ifndef USE_SDL_LIBRARY +#ifndef TARGET_SDL printf("DrawGraphicThruMask(): tile '%d' needs clipping!\n", tile); #endif #endif @@ -1118,7 +1110,7 @@ void DrawGraphicShifted(int x,int y, int dx,int dy, int graphic, else { #if DEBUG -#ifndef USE_SDL_LIBRARY +#ifndef TARGET_SDL printf("DrawGraphicShifted(): tile '%d' needs clipping!\n", tile); #endif #endif @@ -2257,7 +2249,7 @@ void UndrawSpecialEditorDoor() redraw_mask |= REDRAW_ALL; } -#ifndef USE_SDL_LIBRARY +#ifndef TARGET_SDL int ReadPixel(DrawBuffer d, int x, int y) { XImage *pixel_image;