From: Holger Schemel Date: Tue, 18 Sep 2007 00:13:59 +0000 (+0200) Subject: rnd-20070918-1-src X-Git-Tag: 3.2.5^2~7 X-Git-Url: https://git.artsoft.org/?a=commitdiff_plain;h=85d006b46303672112431f6a333c3e1de6acbabb;p=rocksndiamonds.git rnd-20070918-1-src * fixed crash bug (hopefully) when scrolling with cursor keys in editor --- diff --git a/ChangeLog b/ChangeLog index 39f60d68..88c53f42 100644 --- a/ChangeLog +++ b/ChangeLog @@ -3,6 +3,7 @@ for both EMC and R'n'D graphics engine (heavy workarounds needed due to massively broken handling of quicksand in R'n'D game engine) * fixed off-limits access to array in DrawLevelFieldCrumbledSandExt() + * fixed crash bug (hopefully) when scrolling with cursor keys in editor 2007-09-16 * fixed small bug in toon drawing (introduced when fixing the crash bug) diff --git a/src/conftime.h b/src/conftime.h index 0a5a656b..2b817800 100644 --- a/src/conftime.h +++ b/src/conftime.h @@ -1 +1 @@ -#define COMPILE_DATE_STRING "2007-09-17 23:24" +#define COMPILE_DATE_STRING "2007-09-18 02:08" diff --git a/src/editor.c b/src/editor.c index 38af449c..2fab93d6 100644 --- a/src/editor.c +++ b/src/editor.c @@ -4988,10 +4988,36 @@ static void DrawDrawingArea(int id) static void ScrollMiniLevel(int from_x, int from_y, int scroll) { - int x,y; +#if 1 + static Bitmap *tmp_backbuffer = NULL; +#endif + int x, y; int dx = (scroll == ED_SCROLL_LEFT ? -1 : scroll == ED_SCROLL_RIGHT ? 1 : 0); int dy = (scroll == ED_SCROLL_UP ? -1 : scroll == ED_SCROLL_DOWN ? 1 : 0); +#if 1 + if (tmp_backbuffer == NULL) + tmp_backbuffer = CreateBitmap(WIN_XSIZE, WIN_YSIZE, DEFAULT_DEPTH); + + /* needed when blitting directly to same bitmap -- should not be needed with + recent SDL libraries, but apparently does not work in 1.2.11 directly */ + BlitBitmap(drawto, tmp_backbuffer, + SX + (dx == -1 ? MINI_TILEX : 0), + SY + (dy == -1 ? MINI_TILEY : 0), + (ed_fieldx * MINI_TILEX) - (dx != 0 ? MINI_TILEX : 0), + (ed_fieldy * MINI_TILEY) - (dy != 0 ? MINI_TILEY : 0), + SX + (dx == +1 ? MINI_TILEX : 0), + SY + (dy == +1 ? MINI_TILEY : 0)); + BlitBitmap(tmp_backbuffer, drawto, + SX + (dx == +1 ? MINI_TILEX : 0), + SY + (dy == +1 ? MINI_TILEY : 0), + (ed_fieldx * MINI_TILEX) - (dx != 0 ? MINI_TILEX : 0), + (ed_fieldy * MINI_TILEY) - (dy != 0 ? MINI_TILEY : 0), + SX + (dx == +1 ? MINI_TILEX : 0), + SY + (dy == +1 ? MINI_TILEY : 0)); + +#else + BlitBitmap(drawto, drawto, SX + (dx == -1 ? MINI_TILEX : 0), SY + (dy == -1 ? MINI_TILEY : 0), @@ -4999,6 +5025,10 @@ static void ScrollMiniLevel(int from_x, int from_y, int scroll) (ed_fieldy * MINI_TILEY) - (dy != 0 ? MINI_TILEY : 0), SX + (dx == +1 ? MINI_TILEX : 0), SY + (dy == +1 ? MINI_TILEY : 0)); +#endif + + printf("::: ScrollMiniLevel: A.1\n"); + if (dx) { x = (dx == 1 ? 0 : ed_fieldx - 1); @@ -5012,6 +5042,8 @@ static void ScrollMiniLevel(int from_x, int from_y, int scroll) DrawMiniElementOrWall(x, y, from_x, from_y); } + printf("::: ScrollMiniLevel: Z\n"); + redraw_mask |= REDRAW_FIELD; BackToFront(); }