From: Holger Schemel Date: Mon, 17 Sep 2007 21:35:16 +0000 (+0200) Subject: rnd-20070917-2-src X-Git-Tag: 3.2.5^2~8 X-Git-Url: https://git.artsoft.org/?a=commitdiff_plain;h=a672ed603b77a6119d35890793b922a7ec82099e;p=rocksndiamonds.git rnd-20070917-2-src * fixed drawing of animated "quicksand.filling" and "quicksand.emptying" 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() --- diff --git a/ChangeLog b/ChangeLog index adba9e8e..39f60d68 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2007-09-17 + * fixed drawing of animated "quicksand.filling" and "quicksand.emptying" + 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() + 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 73469ff5..0a5a656b 100644 --- a/src/conftime.h +++ b/src/conftime.h @@ -1 +1 @@ -#define COMPILE_DATE_STRING "2007-09-17 02:41" +#define COMPILE_DATE_STRING "2007-09-17 23:24" diff --git a/src/game.c b/src/game.c index 88bca397..708c0510 100644 --- a/src/game.c +++ b/src/game.c @@ -7565,10 +7565,18 @@ void StartMoving(int x, int y) else if (Feld[x][y + 1] == EL_QUICKSAND_EMPTY) { if (!MovDelay[x][y]) + { MovDelay[x][y] = TILEY + 1; + ResetGfxAnimation(x, y); + ResetGfxAnimation(x, y + 1); + } + if (MovDelay[x][y]) { + DrawLevelElement(x, y, EL_QUICKSAND_EMPTYING); + DrawLevelElement(x, y + 1, EL_QUICKSAND_FILLING); + MovDelay[x][y]--; if (MovDelay[x][y]) return; @@ -7602,10 +7610,18 @@ void StartMoving(int x, int y) else if (Feld[x][y + 1] == EL_QUICKSAND_FAST_EMPTY) { if (!MovDelay[x][y]) + { MovDelay[x][y] = TILEY + 1; + ResetGfxAnimation(x, y); + ResetGfxAnimation(x, y + 1); + } + if (MovDelay[x][y]) { + DrawLevelElement(x, y, EL_QUICKSAND_FAST_EMPTYING); + DrawLevelElement(x, y + 1, EL_QUICKSAND_FAST_FILLING); + MovDelay[x][y]--; if (MovDelay[x][y]) return; diff --git a/src/tools.c b/src/tools.c index 23be2acb..61320d3c 100644 --- a/src/tools.c +++ b/src/tools.c @@ -1364,6 +1364,13 @@ void DrawLevelFieldThruMask(int x, int y) DrawLevelElementExt(x, y, 0, 0, Feld[x][y], NO_CUTTING, USE_MASKING); } +/* !!! implementation of quicksand is totally broken !!! */ +#define IS_CRUMBLED_TILE(x, y, e) \ + (GFX_CRUMBLED(e) && (!IN_LEV_FIELD(x, y) || \ + !IS_MOVING(x, y) || \ + (e) == EL_QUICKSAND_EMPTYING || \ + (e) == EL_QUICKSAND_FAST_EMPTYING)) + static void DrawLevelFieldCrumbledSandExt(int x, int y, int graphic, int frame) { Bitmap *src_bitmap; @@ -1386,7 +1393,11 @@ static void DrawLevelFieldCrumbledSandExt(int x, int y, int graphic, int frame) element = TILE_GFX_ELEMENT(x, y); /* crumble field itself */ +#if 1 + if (IS_CRUMBLED_TILE(x, y, element)) +#else if (GFX_CRUMBLED(element) && !IS_MOVING(x, y)) +#endif { if (!IN_SCR_FIELD(sx, sy)) return; @@ -1402,8 +1413,13 @@ static void DrawLevelFieldCrumbledSandExt(int x, int y, int graphic, int frame) BorderElement); /* check if neighbour field is of same type */ +#if 1 + if (IS_CRUMBLED_TILE(xx, yy, element)) + continue; +#else if (GFX_CRUMBLED(element) && !IS_MOVING(xx, yy)) continue; +#endif if (i == 1 || i == 2) { @@ -1435,18 +1451,29 @@ static void DrawLevelFieldCrumbledSandExt(int x, int y, int graphic, int frame) int sxx = sx + xy[i][0]; int syy = sy + xy[i][1]; +#if 1 + if (!IN_LEV_FIELD(xx, yy) || + !IN_SCR_FIELD(sxx, syy)) + continue; +#else if (!IN_LEV_FIELD(xx, yy) || !IN_SCR_FIELD(sxx, syy) || IS_MOVING(xx, yy)) continue; +#endif if (Feld[xx][yy] == EL_ELEMENT_SNAPPING) continue; element = TILE_GFX_ELEMENT(xx, yy); +#if 1 + if (!IS_CRUMBLED_TILE(xx, yy, element)) + continue; +#else if (!GFX_CRUMBLED(element)) continue; +#endif graphic = el_act2crm(element, ACTION_DEFAULT); crumbled_border_size = graphic_info[graphic].border_size; @@ -1600,6 +1627,7 @@ void DrawScreenField(int x, int y) element = getBorderElement(lx, ly); DrawScreenElement(x, y, element); + return; } @@ -1625,8 +1653,22 @@ void DrawScreenField(int x, int y) element == EL_DC_MAGIC_WALL_FILLING) cut_mode = CUT_BELOW; +#if 0 + if (lx == 9 && ly == 1) + printf("::: %s [%d] [%d, %d] [%d]\n", + EL_NAME(TILE_GFX_ELEMENT(lx, ly)), + el_act2crm(TILE_GFX_ELEMENT(lx, ly), ACTION_DEFAULT), + element_info[EL_QUICKSAND_EMPTYING].graphic[ACTION_DEFAULT], + element_info[EL_QUICKSAND_EMPTYING].crumbled[ACTION_DEFAULT], + GFX_CRUMBLED(TILE_GFX_ELEMENT(lx, ly))); +#endif + if (cut_mode == CUT_ABOVE) +#if 1 + DrawScreenElement(x, y, element); +#else DrawScreenElementShifted(x, y, 0, 0, element, NO_CUTTING); +#endif else DrawScreenElement(x, y, EL_EMPTY); @@ -1635,8 +1677,16 @@ void DrawScreenField(int x, int y) else if (cut_mode == NO_CUTTING) DrawScreenElementShifted(x, y, 0, MovPos[lx][ly], element, cut_mode); else + { DrawScreenElementShifted(x, y, 0, MovPos[lx][ly], content, cut_mode); +#if 1 + if (cut_mode == CUT_BELOW && + IN_LEV_FIELD(lx, ly + 1) && IN_SCR_FIELD(x, y + 1)) + DrawLevelElement(lx, ly + 1, element); +#endif + } + if (content == EL_ACID) { int dir = MovDir[lx][ly];