X-Git-Url: https://git.artsoft.org/?a=blobdiff_plain;f=src%2Ftools.c;h=f71aacbdfbf3ffac0001deb2bb9e58100fd3b13c;hb=68d1418be737276c8214780106399c0dae588d1c;hp=588f7f8eda16162eaa538c7f5b815a7419aa93e9;hpb=61c3da024802ecc0268bab42d7499fc0346e4fd3;p=rocksndiamonds.git diff --git a/src/tools.c b/src/tools.c index 588f7f8e..f71aacbd 100644 --- a/src/tools.c +++ b/src/tools.c @@ -396,7 +396,16 @@ void BackToFront() redraw_mask |= REDRAW_FIELD; #if 0 - /* !!! TEST ONLY !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!1 */ + // never redraw single tiles, always redraw the whole field + // (redrawing single tiles up to a certain threshold was faster on old, + // now legacy graphics, but slows things down on modern graphics now) + // UPDATE: this is now globally defined by value of REDRAWTILES_THRESHOLD + if (redraw_mask & REDRAW_TILES) + redraw_mask |= REDRAW_FIELD; +#endif + +#if 0 + /* !!! TEST ONLY !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! */ /* (force full redraw) */ if (game_status == GAME_MODE_PLAYING) redraw_mask |= REDRAW_FIELD; @@ -408,6 +417,23 @@ void BackToFront() if (redraw_mask == REDRAW_NONE) return; +#if 0 + printf("::: "); + if (redraw_mask & REDRAW_ALL) + printf("[REDRAW_ALL]"); + if (redraw_mask & REDRAW_FIELD) + printf("[REDRAW_FIELD]"); + if (redraw_mask & REDRAW_TILES) + printf("[REDRAW_TILES]"); + if (redraw_mask & REDRAW_DOOR_1) + printf("[REDRAW_DOOR_1]"); + if (redraw_mask & REDRAW_DOOR_2) + printf("[REDRAW_DOOR_2]"); + if (redraw_mask & REDRAW_FROM_BACKBUFFER) + printf("[REDRAW_FROM_BACKBUFFER]"); + printf(" [%d]\n", FrameCounter); +#endif + if (redraw_mask & REDRAW_TILES && game_status == GAME_MODE_PLAYING && border.draw_masked[GAME_MODE_PLAYING]) @@ -1061,7 +1087,18 @@ void DrawBackground(int x, int y, int width, int height) ClearRectangleOnBackground(backbuffer, x, y, width, height); #endif +#if 1 + /* (this only works for the current arrangement of playfield and panels) */ + if (x < gfx.dx) + redraw_mask |= REDRAW_FIELD; + else if (y < gfx.vy) + redraw_mask |= REDRAW_DOOR_1; + else + redraw_mask |= REDRAW_DOOR_2; +#else + /* (this is just wrong (when drawing to one of the two door panel areas)) */ redraw_mask |= REDRAW_FIELD; +#endif } void DrawBackgroundForFont(int x, int y, int width, int height, int font_nr) @@ -4135,6 +4172,9 @@ boolean Request(char *text, unsigned int req_state) break; case KSYM_Escape: +#if defined(TARGET_SDL2) + case KSYM_Back: +#endif result = 0; break; @@ -8803,15 +8843,16 @@ void CheckSingleStepMode_EM(byte action[MAX_PLAYERS], int frame, boolean any_player_moving, boolean player_is_dropping) { - int i; - if (tape.single_step && tape.recording && !tape.pausing) { +#if 0 boolean active_players = FALSE; + int i; for (i = 0; i < MAX_PLAYERS; i++) if (action[i] != JOY_NO_ACTION) active_players = TRUE; +#endif // if (frame == 0) if (frame == 0 && !player_is_dropping) @@ -8949,11 +8990,37 @@ void ToggleFullscreenIfNeeded() boolean change_fullscreen_mode = (video.fullscreen_enabled && !strEqual(setup.fullscreen_mode, video.fullscreen_mode_current)); + boolean change_window_scaling_percent = (!video.fullscreen_enabled && + setup.window_scaling_percent != + video.window_scaling_percent); - if (!video.fullscreen_available) + if (change_window_scaling_percent && video.fullscreen_enabled) return; - if (change_fullscreen || change_fullscreen_mode) + if (!change_window_scaling_percent && !video.fullscreen_available) + return; + +#if defined(TARGET_SDL2) + if (change_window_scaling_percent) + { + SDLSetWindowScaling(setup.window_scaling_percent); + + return; + } + else if (change_fullscreen) + { + SDLSetWindowFullscreen(setup.fullscreen); + + /* set setup value according to successfully changed fullscreen mode */ + setup.fullscreen = video.fullscreen_enabled; + + return; + } +#endif + + if (change_fullscreen || + change_fullscreen_mode || + change_window_scaling_percent) { Bitmap *tmp_backbuffer = CreateBitmap(WIN_XSIZE, WIN_YSIZE, DEFAULT_DEPTH); @@ -8966,9 +9033,16 @@ void ToggleFullscreenIfNeeded() video.fullscreen_enabled = FALSE; /* force new fullscreen mode */ } + if (change_window_scaling_percent) + { + /* keep window mode, but change window scaling */ + video.fullscreen_enabled = TRUE; /* force new window scaling */ + } + /* toggle fullscreen */ ChangeVideoModeIfNeeded(setup.fullscreen); + /* set setup value according to successfully changed fullscreen mode */ setup.fullscreen = video.fullscreen_enabled; /* restore backbuffer content from temporary backbuffer backup bitmap */