From d337287c2354ce4d256186e54f5474ecf77a2deb Mon Sep 17 00:00:00 2001 From: Holger Schemel Date: Sun, 14 Oct 2012 12:41:11 +0200 Subject: [PATCH] rnd-20121014-1-src --- ChangeLog | 10 +++++++--- src/conftime.h | 2 +- src/game.c | 6 ++++-- src/libgame/system.h | 11 +++++++++++ src/tools.c | 38 +++++++++++++++++++++++++++++++++++++- 5 files changed, 60 insertions(+), 7 deletions(-) diff --git a/ChangeLog b/ChangeLog index 79cce66a..48c60341 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,10 +1,14 @@ 2012-10-13 - * fixed display of current level time when making use of time orb bug - (see level set "rnd_equinox_tetrachloride_ii", level 053) + * fixed display of level time switching from ascending to descending + when making use of the "time orb bug" (see element setting in editor) + (see level 053 of set "rnd_equinox_tetrachloride_ii" for an example) + * fixed graphics performance problems (especially on Mac OS X) by using + whole-playfield redraw on SDL target, while still using the previous + single-tile redraw method on X11 target (using redraw tiles threshold) 2011-10-07 * fixed code (esp. random/tape handling) when compiled on 64-bit systems - (by simply replacing all "long" by "int" types) + (by replacing all "long" types by "int" types) 2010-11-19 * fixed nasty bug (affecting crumbled graphics) after adding new special diff --git a/src/conftime.h b/src/conftime.h index 1c9bdbb1..db82a298 100644 --- a/src/conftime.h +++ b/src/conftime.h @@ -1 +1 @@ -#define COMPILE_DATE_STRING "2012-10-13 11:08" +#define COMPILE_DATE_STRING "2012-10-13 23:04" diff --git a/src/game.c b/src/game.c index 9445ac72..5f9161f1 100644 --- a/src/game.c +++ b/src/game.c @@ -12225,7 +12225,8 @@ static void CheckLevelTime() game_panel_controls[GAME_PANEL_TIME].value = TimeLeft; - DisplayGameControlValues(); + /* (already called by UpdateAndDisplayGameControlValues() below) */ + // DisplayGameControlValues(); #else DrawGameValue_Time(TimeLeft); #endif @@ -12244,7 +12245,8 @@ static void CheckLevelTime() { game_panel_controls[GAME_PANEL_TIME].value = TimePlayed; - DisplayGameControlValues(); + /* (already called by UpdateAndDisplayGameControlValues() below) */ + // DisplayGameControlValues(); } #else else if (game.no_time_limit && !AllPlayersGone) /* level w/o time limit */ diff --git a/src/libgame/system.h b/src/libgame/system.h index df95c9d3..11670c69 100644 --- a/src/libgame/system.h +++ b/src/libgame/system.h @@ -285,7 +285,18 @@ REDRAW_TILES | \ REDRAW_MICROLEVEL) #define REDRAW_FPS (1 << 11) + +#if defined(TARGET_X11) +/* on old-style, classic and potentially slow graphics systems, redraw single + tiles instead of the whole playfield unless a certain threshold is reached; + when using the X11 target, this method should still be fast on all systems */ #define REDRAWTILES_THRESHOLD (SCR_FIELDX * SCR_FIELDY / 2) +#else +/* on modern graphics systems and when using the SDL target, this tile redraw + optimization can slow things down a lot due to many small blits compared to + one single playfield-sized blit (especially observed on Mac OS X with SDL) */ +#define REDRAWTILES_THRESHOLD 0 +#endif #define IN_GFX_SCREEN(x, y) (x >= gfx.sx && x < gfx.sx + gfx.sxsize && \ y >= gfx.sy && y < gfx.sy + gfx.sysize) diff --git a/src/tools.c b/src/tools.c index 588f7f8e..bc63ef9a 100644 --- a/src/tools.c +++ b/src/tools.c @@ -396,7 +396,15 @@ 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) + 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 +416,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 +1086,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) -- 2.34.1