From: Holger Schemel Date: Mon, 12 Apr 2004 19:48:36 +0000 (+0200) Subject: rnd-20040412-1-src X-Git-Tag: 3.1.0^2~21 X-Git-Url: https://git.artsoft.org/?a=commitdiff_plain;h=aa6a89fa41dc0014b12fa87eca2c2382782a4c9d;p=rocksndiamonds.git rnd-20040412-1-src --- diff --git a/src/conftime.h b/src/conftime.h index e9b0ec9a..ac82660f 100644 --- a/src/conftime.h +++ b/src/conftime.h @@ -1 +1 @@ -#define COMPILE_DATE_STRING "[2004-04-11 03:36]" +#define COMPILE_DATE_STRING "[2004-04-12 20:40]" diff --git a/src/editor.c b/src/editor.c index 665fef5e..f499cf11 100644 --- a/src/editor.c +++ b/src/editor.c @@ -1351,6 +1351,9 @@ static struct ValueTextInfo options_change_direct_action[] = { CE_HIT_BY_SOMETHING, "hit by something" }, #else { CE_HITTING_SOMETHING, "collision" }, +#endif +#if 1 + { CE_BLOCKED, "blocked" }, #endif { CE_IMPACT, "impact (on something)" }, { CE_SMASHED, "smashed (from above)" }, @@ -5875,6 +5878,7 @@ static void CopyCustomElementPropertiesToEditor(int element) HAS_CHANGE_EVENT(element, CE_SWITCHED) ? CE_SWITCHED : HAS_CHANGE_EVENT(element, CE_HITTING_SOMETHING) ? CE_HITTING_SOMETHING : HAS_CHANGE_EVENT(element, CE_HIT_BY_SOMETHING) ? CE_HIT_BY_SOMETHING : + HAS_CHANGE_EVENT(element, CE_BLOCKED) ? CE_BLOCKED : HAS_CHANGE_EVENT(element, CE_IMPACT) ? CE_IMPACT : HAS_CHANGE_EVENT(element, CE_SMASHED) ? CE_SMASHED : custom_element_change.direct_action); @@ -6041,6 +6045,7 @@ static void CopyCustomElementPropertiesToGame(int element) custom_element_change_events[CE_SWITCHED] = FALSE; custom_element_change_events[CE_HITTING_SOMETHING] = FALSE; custom_element_change_events[CE_HIT_BY_SOMETHING] = FALSE; + custom_element_change_events[CE_BLOCKED] = FALSE; custom_element_change_events[CE_IMPACT] = FALSE; custom_element_change_events[CE_SMASHED] = FALSE; custom_element_change_events[custom_element_change.direct_action] = diff --git a/src/game.c b/src/game.c index 59ced416..da15ed43 100644 --- a/src/game.c +++ b/src/game.c @@ -5097,6 +5097,8 @@ void StartMoving(int x, int y) WasJustFalling[x][y] = 0; #endif + CheckCollision[x][y] = 0; + Impact(x, y); } else if (IS_FREE(x, y + 1) && element == EL_SPRING && level.use_spring_bug) @@ -5211,11 +5213,24 @@ void StartMoving(int x, int y) } /* not "else if" because of elements that can fall and move (EL_SPRING) */ +#if 0 + if (CAN_MOVE(element) && !started_moving && MovDir[x][y] != MV_NO_MOVING) +#else if (CAN_MOVE(element) && !started_moving) +#endif { int move_pattern = element_info[element].move_pattern; int newx, newy; +#if DEBUG + if (MovDir[x][y] == MV_NO_MOVING) + { + printf("StartMoving(): %d,%d: element %d ['%s'] not moving\n", + x, y, element, element_info[element].token_name); + printf("StartMoving(): This should never happen!\n"); + } +#endif + Moving2Blocked(x, y, &newx, &newy); #if 1 @@ -5254,6 +5269,8 @@ void StartMoving(int x, int y) WasJustMoving[x][y] = 0; #endif + CheckCollision[x][y] = 0; + TestIfElementHitsCustomElement(x, y, MovDir[x][y]); #if 0 @@ -5808,6 +5825,25 @@ void StartMoving(int x, int y) TurnRound(x, y); + if (move_pattern & MV_ANY_DIRECTION && + move_pattern == MovDir[x][y]) + { + int blocking_element = + (IN_LEV_FIELD(newx, newy) ? Feld[newx][newy] : BorderElement); + +#if 0 + printf("::: '%s' is blocked by '%s'! [%d,%d -> %d,%d]\n", + element_info[element].token_name, + element_info[blocking_element].token_name, + x, y, newx, newy); +#endif + + CheckElementChangeBySide(x, y, element, blocking_element, CE_BLOCKED, + MovDir[x][y]); + + element = Feld[x][y]; /* element might have changed */ + } + #if 1 if (GFX_ELEMENT(element) != EL_SAND) /* !!! FIX THIS (crumble) !!! */ DrawLevelElementAnimation(x, y, element); @@ -6080,7 +6116,12 @@ void ContinueMoving(int x, int y) /* prevent elements on conveyor belt from moving on in last direction */ if (pushed_by_conveyor && CAN_FALL(element) && direction & MV_HORIZONTAL) - MovDir[newx][newy] = 0; + { + if (CAN_MOVE(element)) + InitMovDir(newx, newy); + else + MovDir[newx][newy] = 0; + } #endif if (!pushed_by_player) diff --git a/src/main.h b/src/main.h index 0690bafe..e89d1fee 100644 --- a/src/main.h +++ b/src/main.h @@ -197,8 +197,9 @@ #define CE_HIT_BY_SOMETHING 27 #define CE_OTHER_IS_HITTING 28 #define CE_OTHER_GETS_HIT 29 +#define CE_BLOCKED 30 -#define NUM_CHANGE_EVENTS 30 +#define NUM_CHANGE_EVENTS 31 #define CE_BITMASK_DEFAULT 0 diff --git a/src/tools.c b/src/tools.c index 616cf6e8..39af85ee 100644 --- a/src/tools.c +++ b/src/tools.c @@ -302,10 +302,10 @@ void BackToFront() if (redraw_mask & REDRAW_TILES) { for (x = 0; x < SCR_FIELDX; x++) - for (y =0 ; y < SCR_FIELDY; y++) + for (y = 0 ; y < SCR_FIELDY; y++) if (redraw[redraw_x1 + x][redraw_y1 + y]) BlitBitmap(buffer, window, - FX + x * TILEX, FX + y * TILEY, TILEX, TILEY, + FX + x * TILEX, FY + y * TILEY, TILEX, TILEY, SX + x * TILEX, SY + y * TILEY); }