From: Holger Schemel Date: Sun, 11 Apr 2004 10:09:58 +0000 (+0200) Subject: rnd-20040411-1-src X-Git-Tag: 3.1.0^2~22 X-Git-Url: https://git.artsoft.org/?a=commitdiff_plain;h=af07d74262e7d5075feaea67fa16c04c6be0e3f6;p=rocksndiamonds.git rnd-20040411-1-src * added "collectible" and "removable" to extended replacement types (where "removable" replaces "diggable" and "collectible" elements) * added "collectible & throwable" (to throw element to the next field) * fixed bug with CEs digging elements that are just about to explode * changed mouse cursor now always being visible when game is paused --- diff --git a/ChangeLog b/ChangeLog index dd75aacd..f153f082 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2004-04-10 + * added "collectible" and "removable" to extended replacement types + (where "removable" replaces "diggable" and "collectible" elements) + * added "collectible & throwable" (to throw element to the next field) + * fixed bug with CEs digging elements that are just about to explode + * changed mouse cursor now always being visible when game is paused + 2004-04-09 * added possibility to push/press accessible elements from a side that is not accessible diff --git a/src/conftime.h b/src/conftime.h index 979a9aea..e9b0ec9a 100644 --- a/src/conftime.h +++ b/src/conftime.h @@ -1 +1 @@ -#define COMPILE_DATE_STRING "[2004-04-10 02:27]" +#define COMPILE_DATE_STRING "[2004-04-11 03:36]" diff --git a/src/editor.c b/src/editor.c index 3011e86d..665fef5e 100644 --- a/src/editor.c +++ b/src/editor.c @@ -1221,6 +1221,7 @@ static struct ValueTextInfo options_walk_to_action[] = { EP_DIGGABLE, "diggable" }, { EP_COLLECTIBLE_ONLY, "collectible" }, { EP_DROPPABLE, "collectible & droppable" }, + { EP_THROWABLE, "collectible & throwable" }, { EP_PUSHABLE, "pushable" }, { -1, NULL } @@ -1244,10 +1245,10 @@ static struct ValueTextInfo options_move_pattern[] = { MV_TURNING_LEFT_RIGHT, "turning left, right" }, { MV_TURNING_RIGHT_LEFT, "turning right, left" }, { MV_TURNING_RANDOM, "turning random" }, - { MV_WHEN_PUSHED, "when pushed" }, - { MV_WHEN_DROPPED, "when dropped" }, { MV_MAZE_RUNNER, "maze runner style" }, { MV_MAZE_HUNTER, "maze hunter style" }, + { MV_WHEN_PUSHED, "when pushed" }, + { MV_WHEN_DROPPED, "when dropped/thrown" }, { -1, NULL } }; @@ -1338,24 +1339,19 @@ static struct ValueTextInfo options_time_units[] = static struct ValueTextInfo options_change_direct_action[] = { - { CE_TOUCHED_BY_PLAYER, "touched by player ..." }, - { CE_PRESSED_BY_PLAYER, "pressed by player ..." }, - { CE_PUSHED_BY_PLAYER, "pushed by player ..." }, - { CE_ENTERED_BY_PLAYER, "entered by player ..." }, - { CE_LEFT_BY_PLAYER, "left by player ..." }, - { CE_DROPPED_BY_PLAYER, "dropped by player" }, - { CE_SWITCHED, "switched ..." }, + { CE_TOUCHED_BY_PLAYER, "touched by player" }, + { CE_PRESSED_BY_PLAYER, "pressed by player" }, + { CE_PUSHED_BY_PLAYER, "pushed by player" }, + { CE_ENTERED_BY_PLAYER, "entered by player" }, + { CE_LEFT_BY_PLAYER, "left by player" }, + { CE_DROPPED_BY_PLAYER, "dropped/thrown by player" }, + { CE_SWITCHED, "switched" }, #if 1 - { CE_HITTING_SOMETHING, "hitting something ..." }, - { CE_HIT_BY_SOMETHING, "hit by something ..." }, + { CE_HITTING_SOMETHING, "hitting something" }, + { CE_HIT_BY_SOMETHING, "hit by something" }, #else - { CE_HITTING_SOMETHING, "collision ..." }, -#endif - -#if 0 - { CE_BLOCKED, "blocked ..." }, + { CE_HITTING_SOMETHING, "collision" }, #endif - { CE_IMPACT, "impact (on something)" }, { CE_SMASHED, "smashed (from above)" }, @@ -1364,20 +1360,20 @@ static struct ValueTextInfo options_change_direct_action[] = static struct ValueTextInfo options_change_other_action[] = { - { CE_OTHER_GETS_TOUCHED, "player touches ..." }, - { CE_OTHER_GETS_PRESSED, "player presses ..." }, - { CE_OTHER_GETS_PUSHED, "player pushes ..." }, - { CE_OTHER_GETS_ENTERED, "player enters ..." }, - { CE_OTHER_GETS_LEFT, "player leaves ..." }, + { CE_OTHER_GETS_TOUCHED, "player touches" }, + { CE_OTHER_GETS_PRESSED, "player presses" }, + { CE_OTHER_GETS_PUSHED, "player pushes" }, + { CE_OTHER_GETS_ENTERED, "player enters" }, + { CE_OTHER_GETS_LEFT, "player leaves" }, { CE_OTHER_GETS_DIGGED, "player digs" }, { CE_OTHER_GETS_COLLECTED, "player collects" }, - { CE_OTHER_GETS_DROPPED, "player drops" }, - { CE_OTHER_IS_TOUCHING, "touching ..." }, + { CE_OTHER_GETS_DROPPED, "player drops/throws" }, + { CE_OTHER_IS_TOUCHING, "touching" }, #if 1 - { CE_OTHER_IS_HITTING, "hitting ..." }, - { CE_OTHER_GETS_HIT, "hit by ..." }, + { CE_OTHER_IS_HITTING, "hitting" }, + { CE_OTHER_GETS_HIT, "hit by" }, #endif - { CE_OTHER_IS_SWITCHING, "switch of ..." }, + { CE_OTHER_IS_SWITCHING, "switch of" }, { CE_OTHER_IS_CHANGING, "change by page of" }, { CE_OTHER_IS_EXPLODING, "explosion of" }, @@ -1451,6 +1447,8 @@ static struct ValueTextInfo options_change_replace_when[] = { { CP_WHEN_EMPTY, "empty" }, { CP_WHEN_DIGGABLE, "diggable" }, + { CP_WHEN_COLLECTIBLE, "collectible" }, + { CP_WHEN_REMOVABLE, "removable" }, { CP_WHEN_DESTRUCTIBLE, "destructible" }, { -1, NULL } @@ -1637,7 +1635,7 @@ static struct -1, options_change_trigger_side, &custom_element_change.trigger_side, - "... at", "side", "element side that causes change" + "at", "side", "element side that causes change" }, { ED_SETTINGS_XPOS(2), ED_SETTINGS_YPOS(7), @@ -5811,12 +5809,14 @@ static void CopyCustomElementPropertiesToEditor(int element) (IS_DIGGABLE(element) ? EP_DIGGABLE : IS_COLLECTIBLE_ONLY(element) ? EP_COLLECTIBLE_ONLY : IS_DROPPABLE(element) ? EP_DROPPABLE : + IS_THROWABLE(element) ? EP_THROWABLE : IS_PUSHABLE(element) ? EP_PUSHABLE : custom_element.walk_to_action); custom_element_properties[EP_WALK_TO_OBJECT] = (IS_DIGGABLE(element) || IS_COLLECTIBLE_ONLY(element) || IS_DROPPABLE(element) || + IS_THROWABLE(element) || IS_PUSHABLE(element)); /* set smash targets selectbox help value */ @@ -5875,7 +5875,6 @@ 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); @@ -5987,6 +5986,7 @@ static void CopyCustomElementPropertiesToGame(int element) custom_element_properties[EP_DIGGABLE] = FALSE; custom_element_properties[EP_COLLECTIBLE_ONLY] = FALSE; custom_element_properties[EP_DROPPABLE] = FALSE; + custom_element_properties[EP_THROWABLE] = FALSE; custom_element_properties[EP_PUSHABLE] = FALSE; custom_element_properties[custom_element.walk_to_action] = custom_element_properties[EP_WALK_TO_OBJECT]; @@ -6041,7 +6041,6 @@ 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] = @@ -6755,14 +6754,16 @@ static void DrawPropertiesInfo() { EP_PASSABLE_OVER, "- player can pass over it" }, { EP_PASSABLE_INSIDE, "- player can pass through it" }, { EP_PASSABLE_UNDER, "- player can pass under it" }, + { EP_PROTECTED, "- player is protected by it" }, { EP_DIGGABLE, "- can be digged away" }, { EP_COLLECTIBLE, "- can be collected" }, { EP_DROPPABLE, "- can be dropped after collecting" }, + { EP_THROWABLE, "- can be thrown after collecting" }, { EP_PUSHABLE, "- can be pushed" }, - { EP_CAN_MOVE, "- can move" }, { EP_CAN_FALL, "- can fall" }, + { EP_CAN_MOVE, "- can move" }, { EP_CAN_SMASH_PLAYER, "- can smash player" }, #if 0 @@ -6770,7 +6771,7 @@ static void DrawPropertiesInfo() #endif { EP_CAN_SMASH_EVERYTHING, "- can smash everything smashable" }, - { EP_SLIPPERY, "- slippery for falling objects" }, + { EP_SLIPPERY, "- slippery for falling elements" }, { EP_EM_SLIPPERY_WALL, "- slippery for some gems (EM style)" }, { EP_DONT_RUN_INTO, "- deadly when running into" }, @@ -6787,6 +6788,7 @@ static void DrawPropertiesInfo() /* pre-defined properties */ { EP_CAN_PASS_MAGIC_WALL, "- can pass magic walls" }, + { EP_SWITCHABLE, "- can be switched" }, { EP_HAS_CONTENT, "- can contain other elements" }, { -1, NULL } diff --git a/src/events.c b/src/events.c index b123c86d..abf5711f 100644 --- a/src/events.c +++ b/src/events.c @@ -112,7 +112,7 @@ void EventLoop(void) else { /* when playing, display a special mouse pointer inside the playfield */ - if (game_status == GAME_MODE_PLAYING) + if (game_status == GAME_MODE_PLAYING && !tape.pausing) { if (!playfield_cursor_set && cursor_inside_playfield && DelayReached(&playfield_cursor_delay, 1000)) diff --git a/src/game.c b/src/game.c index e80a1d1b..59ced416 100644 --- a/src/game.c +++ b/src/game.c @@ -96,6 +96,9 @@ /* values for other actions */ #define MOVE_STEPSIZE_NORMAL (TILEX / MOVE_DELAY_NORMAL_SPEED) +#define GET_DX_FROM_DIR(d) ((d) == MV_LEFT ? -1 : (d) == MV_RIGHT ? 1 : 0) +#define GET_DY_FROM_DIR(d) ((d) == MV_UP ? -1 : (d) == MV_DOWN ? 1 : 0) + #define INIT_GFX_RANDOM() (SimpleRND(1000000)) #define GET_NEW_PUSH_DELAY(e) ( (element_info[e].push_delay_fixed) + \ @@ -1633,6 +1636,7 @@ void InitGame() AmoebaNr[x][y] = 0; WasJustMoving[x][y] = 0; WasJustFalling[x][y] = 0; + CheckCollision[x][y] = 0; Stop[x][y] = FALSE; Pushed[x][y] = FALSE; @@ -2518,6 +2522,10 @@ static void RemoveField(int x, int y) ChangePage[x][y] = -1; Pushed[x][y] = FALSE; +#if 0 + ExplodeField[x][y] = EX_TYPE_NONE; +#endif + GfxElement[x][y] = EL_UNDEFINED; GfxAction[x][y] = ACTION_DEFAULT; GfxDir[x][y] = MV_NO_MOVING; @@ -3939,6 +3947,7 @@ void Impact(int x, int y) return; } + /* !!! not sufficient for all cases -- see EL_PEARL below !!! */ /* only reset graphic animation if graphic really changes after impact */ if (impact && el_act_dir2img(element, GfxAction[x][y], MV_DOWN) != el2img(element)) @@ -3954,6 +3963,8 @@ void Impact(int x, int y) } else if (impact && element == EL_PEARL) { + ResetGfxAnimation(x, y); + Feld[x][y] = EL_PEARL_BREAKING; PlayLevelSound(x, y, SND_PEARL_BREAKING); return; @@ -4073,6 +4084,8 @@ void Impact(int x, int y) } else if (smashed == EL_PEARL) { + ResetGfxAnimation(x, y); + Feld[x][y + 1] = EL_PEARL_BREAKING; PlayLevelSound(x, y, SND_PEARL_BREAKING); return; @@ -5046,12 +5059,16 @@ void StartMoving(int x, int y) #endif } #if 1 - else if ((game.engine_version < VERSION_IDENT(2,2,0,7) && - CAN_SMASH(element) && WasJustMoving[x][y] && !Pushed[x][y + 1] && - (Feld[x][y + 1] == EL_BLOCKED)) || + else if ((game.engine_version >= VERSION_IDENT(3,1,0,0) && + CheckCollision[x][y] && !IS_FREE(x, y + 1)) || + (game.engine_version >= VERSION_IDENT(3,0,7,0) && CAN_SMASH(element) && WasJustFalling[x][y] && - (Feld[x][y + 1] == EL_BLOCKED || IS_PLAYER(x, y + 1)))) + (Feld[x][y + 1] == EL_BLOCKED || IS_PLAYER(x, y + 1))) || + + (game.engine_version < VERSION_IDENT(2,2,0,7) && + CAN_SMASH(element) && WasJustMoving[x][y] && !Pushed[x][y + 1] && + (Feld[x][y + 1] == EL_BLOCKED))) #else #if 1 @@ -5212,10 +5229,16 @@ void StartMoving(int x, int y) return; #endif +#if 1 + #if 1 + if (game.engine_version >= VERSION_IDENT(3,1,0,0) && + CheckCollision[x][y] && IN_LEV_FIELD_AND_NOT_FREE(newx, newy)) +#else if (game.engine_version >= VERSION_IDENT(3,1,0,0) && WasJustMoving[x][y] && IN_LEV_FIELD(newx, newy) && (Feld[newx][newy] == EL_BLOCKED || IS_PLAYER(newx, newy))) +#endif { #if 0 printf("::: element %d '%s' WasJustMoving %d [%d, %d, %d, %d]\n", @@ -5603,6 +5626,9 @@ void StartMoving(int x, int y) DrawLevelField(newx, newy); } + /* if digged element was about to explode, prevent the explosion */ + ExplodeField[newx][newy] = EX_TYPE_NONE; + PlayLevelSoundAction(x, y, action); } @@ -6059,10 +6085,16 @@ void ContinueMoving(int x, int y) if (!pushed_by_player) { + int nextx = newx + dx, nexty = newy + dy; + boolean check_collision_again = IN_LEV_FIELD_AND_IS_FREE(nextx, nexty); + WasJustMoving[newx][newy] = 3; if (CAN_FALL(element) && direction == MV_DOWN) WasJustFalling[newx][newy] = 3; + + if ((!CAN_FALL(element) || direction == MV_DOWN) && check_collision_again) + CheckCollision[newx][newy] = 2; } if (DONT_TOUCH(element)) /* object may be nasty to player or others */ @@ -7219,6 +7251,8 @@ static boolean ChangeElementNow(int x, int y, int element, int page) { boolean is_empty; boolean is_diggable; + boolean is_collectible; + boolean is_removable; boolean is_destructible; int ex = x + xx - 1; int ey = y + yy - 1; @@ -7260,11 +7294,15 @@ static boolean ChangeElementNow(int x, int y, int element, int page) IS_WALKABLE(content_element))); #endif is_diggable = (is_empty || IS_DIGGABLE(e)); + is_collectible = (is_empty || IS_COLLECTIBLE(e)); + is_removable = (is_diggable || is_collectible); is_destructible = (is_empty || !IS_INDESTRUCTIBLE(e)); can_replace[xx][yy] = - ((change->replace_when == CP_WHEN_EMPTY && is_empty) || - (change->replace_when == CP_WHEN_DIGGABLE && is_diggable) || + ((change->replace_when == CP_WHEN_EMPTY && is_empty) || + (change->replace_when == CP_WHEN_DIGGABLE && is_diggable) || + (change->replace_when == CP_WHEN_COLLECTIBLE && is_collectible) || + (change->replace_when == CP_WHEN_REMOVABLE && is_removable) || (change->replace_when == CP_WHEN_DESTRUCTIBLE && is_destructible)); if (!can_replace[xx][yy]) @@ -8179,6 +8217,8 @@ void GameActions() WasJustMoving[x][y]--; if (WasJustFalling[x][y] > 0) WasJustFalling[x][y]--; + if (CheckCollision[x][y] > 0) + CheckCollision[x][y]--; GfxFrame[x][y]++; @@ -10740,7 +10780,8 @@ int DigField(struct PlayerInfo *player, ShowEnvelope(element - EL_ENVELOPE_1); #endif } - else if (IS_DROPPABLE(element)) /* can be collected and dropped */ + else if (IS_DROPPABLE(element) || + IS_THROWABLE(element)) /* can be collected and dropped */ { int i; @@ -11170,10 +11211,10 @@ boolean DropElement(struct PlayerInfo *player) CH_SIDE_TOP, /* dropping up */ CH_SIDE_BOTTOM, /* dropping down */ }; - int jx = player->jx, jy = player->jy; + int old_element, new_element; + int dropx = player->jx, dropy = player->jy; int drop_direction = player->MovDir; int drop_side = trigger_sides[MV_DIR_BIT(drop_direction)]; - int old_element = Feld[jx][jy]; int drop_element = (player->inventory_size > 0 ? player->inventory_element[player->inventory_size - 1] : player->inventory_infinite_element != EL_UNDEFINED ? @@ -11181,7 +11222,18 @@ boolean DropElement(struct PlayerInfo *player) player->dynabombs_left > 0 ? EL_DYNABOMB_PLAYER_1_ACTIVE + player->index_nr : EL_UNDEFINED); - int new_element = drop_element; /* default: element does not change */ + + if (IS_THROWABLE(drop_element)) + { + dropx += GET_DX_FROM_DIR(drop_direction); + dropy += GET_DY_FROM_DIR(drop_direction); + + if (!IN_LEV_FIELD(dropx, dropy)) + return FALSE; + } + + old_element = Feld[dropx][dropy]; /* old element at dropping position */ + new_element = drop_element; /* default: no change when dropping */ /* check if player is active, not moving and ready to drop */ if (!player->active || player->MovPos || player->drop_delay > 0) @@ -11214,10 +11266,10 @@ boolean DropElement(struct PlayerInfo *player) #endif if (old_element != EL_EMPTY) - Back[jx][jy] = old_element; /* store old element on this field */ + Back[dropx][dropy] = old_element; /* store old element on this field */ - ResetGfxAnimation(jx, jy); - ResetRandomAnimationValue(jx, jy); + ResetGfxAnimation(dropx, dropy); + ResetRandomAnimationValue(dropx, dropy); if (player->inventory_size > 0 || player->inventory_infinite_element != EL_UNDEFINED) @@ -11238,34 +11290,35 @@ boolean DropElement(struct PlayerInfo *player) new_element = EL_SP_DISK_RED_ACTIVE; } - Feld[jx][jy] = new_element; + Feld[dropx][dropy] = new_element; - if (IN_SCR_FIELD(SCREENX(jx), SCREENY(jy))) - DrawGraphicThruMask(SCREENX(jx), SCREENY(jy), el2img(Feld[jx][jy]), 0); + if (IN_SCR_FIELD(SCREENX(dropx), SCREENY(dropy))) + DrawGraphicThruMask(SCREENX(dropx), SCREENY(dropy), + el2img(Feld[dropx][dropy]), 0); - PlayLevelSoundAction(jx, jy, ACTION_DROPPING); + PlayLevelSoundAction(dropx, dropy, ACTION_DROPPING); #if 1 /* needed if previous element just changed to "empty" in the last frame */ - Changed[jx][jy] = 0; /* allow another change */ + Changed[dropx][dropy] = 0; /* allow another change */ #endif #if 1 /* !!! TEST ONLY !!! */ - CheckElementChangeByPlayer(jx, jy, new_element, CE_DROPPED_BY_PLAYER, + CheckElementChangeByPlayer(dropx, dropy, new_element, CE_DROPPED_BY_PLAYER, player->index_bit, drop_side); - CheckTriggeredElementChangeByPlayer(jx, jy, new_element, + CheckTriggeredElementChangeByPlayer(dropx, dropy, new_element, CE_OTHER_GETS_DROPPED, player->index_bit, drop_side); #else - CheckTriggeredElementChangeByPlayer(jx, jy, new_element, + CheckTriggeredElementChangeByPlayer(dropx, dropy, new_element, CE_OTHER_GETS_DROPPED, player->index_bit, drop_side); - CheckElementChangeByPlayer(jx, jy, new_element, CE_DROPPED_BY_PLAYER, + CheckElementChangeByPlayer(dropx, dropy, new_element, CE_DROPPED_BY_PLAYER, player->index_bit, drop_side); #endif - TestIfElementTouchesCustomElement(jx, jy); + TestIfElementTouchesCustomElement(dropx, dropy); } else /* player is dropping a dyna bomb */ { @@ -11275,30 +11328,31 @@ boolean DropElement(struct PlayerInfo *player) new_element = EL_DYNABOMB_PLAYER_1_ACTIVE + player->index_nr; #endif - Feld[jx][jy] = new_element; + Feld[dropx][dropy] = new_element; - if (IN_SCR_FIELD(SCREENX(jx), SCREENY(jy))) - DrawGraphicThruMask(SCREENX(jx), SCREENY(jy), el2img(Feld[jx][jy]), 0); + if (IN_SCR_FIELD(SCREENX(dropx), SCREENY(dropy))) + DrawGraphicThruMask(SCREENX(dropx), SCREENY(dropy), + el2img(Feld[dropx][dropy]), 0); - PlayLevelSoundAction(jx, jy, ACTION_DROPPING); + PlayLevelSoundAction(dropx, dropy, ACTION_DROPPING); } #if 1 - if (Feld[jx][jy] == new_element) /* uninitialized unless CE change */ + if (Feld[dropx][dropy] == new_element) /* uninitialized unless CE change */ { #if 1 - InitField_WithBug1(jx, jy, FALSE); + InitField_WithBug1(dropx, dropy, FALSE); #else - InitField(jx, jy, FALSE); - if (CAN_MOVE(Feld[jx][jy])) - InitMovDir(jx, jy); + InitField(dropx, dropy, FALSE); + if (CAN_MOVE(Feld[dropx][dropy])) + InitMovDir(dropx, dropy); #endif } - new_element = Feld[jx][jy]; /* element might have changed */ + new_element = Feld[dropx][dropy]; /* element might have changed */ if (IS_CUSTOM_ELEMENT(new_element) && CAN_MOVE(new_element) && element_info[new_element].move_pattern == MV_WHEN_DROPPED) @@ -11306,37 +11360,46 @@ boolean DropElement(struct PlayerInfo *player) #if 0 int move_stepsize = element_info[new_element].move_stepsize; #endif - int direction, dx, dy, nextx, nexty; + int move_direction, nextx, nexty; if (element_info[new_element].move_direction_initial == MV_START_AUTOMATIC) - MovDir[jx][jy] = player->MovDir; + MovDir[dropx][dropy] = drop_direction; - direction = MovDir[jx][jy]; - dx = (direction == MV_LEFT ? -1 : direction == MV_RIGHT ? +1 : 0); - dy = (direction == MV_UP ? -1 : direction == MV_DOWN ? +1 : 0); - nextx = jx + dx; - nexty = jy + dy; + move_direction = MovDir[dropx][dropy]; + nextx = dropx + GET_DX_FROM_DIR(move_direction); + nexty = dropy + GET_DY_FROM_DIR(move_direction); + +#if 1 + Changed[dropx][dropy] = 0; /* allow another change */ + CheckCollision[dropx][dropy] = 2; +#else if (IN_LEV_FIELD(nextx, nexty) && IS_FREE(nextx, nexty)) { #if 0 - WasJustMoving[jx][jy] = 3; + WasJustMoving[dropx][dropy] = 3; #else - InitMovingField(jx, jy, direction); - ContinueMoving(jx, jy); +#if 1 + InitMovingField(dropx, dropy, move_direction); + ContinueMoving(dropx, dropy); +#endif #endif } +#if 1 else { - Changed[jx][jy] = 0; /* allow another change */ + Changed[dropx][dropy] = 0; /* allow another change */ #if 1 - TestIfElementHitsCustomElement(jx, jy, direction); + TestIfElementHitsCustomElement(dropx, dropy, move_direction); #else - CheckElementChangeBySide(jx, jy, new_element, touched_element, - CE_HITTING_SOMETHING, direction); + CheckElementChangeBySide(dropx, dropy, new_element, touched_element, + CE_HITTING_SOMETHING, move_direction); #endif } +#endif + +#endif #if 0 player->drop_delay = 2 * TILEX / move_stepsize + 1; diff --git a/src/init.c b/src/init.c index be534850..0b925c68 100644 --- a/src/init.c +++ b/src/init.c @@ -2258,6 +2258,11 @@ void InitElementPropertiesStatic() -1 }; + static int ep_throwable[] = + { + -1 + }; + static int ep_player[] = { EL_PLAYER_1, @@ -3058,6 +3063,7 @@ void InitElementPropertiesStatic() { ep_pushable, EP_PUSHABLE }, { ep_can_explode_cross, EP_CAN_EXPLODE_CROSS }, { ep_protected, EP_PROTECTED }, + { ep_throwable, EP_THROWABLE }, { ep_player, EP_PLAYER }, { ep_can_pass_magic_wall, EP_CAN_PASS_MAGIC_WALL }, @@ -3260,7 +3266,8 @@ void InitElementPropertiesEngine(int engine_version) /* ---------- COLLECTIBLE ---------------------------------------------- */ SET_PROPERTY(i, EP_COLLECTIBLE, (IS_COLLECTIBLE_ONLY(i) || - IS_DROPPABLE(i))); + IS_DROPPABLE(i) || + IS_THROWABLE(i))); /* ---------- SNAPPABLE ------------------------------------------------ */ SET_PROPERTY(i, EP_SNAPPABLE, (IS_DIGGABLE(i) || diff --git a/src/main.c b/src/main.c index 9e6c6251..7f74f6ae 100644 --- a/src/main.c +++ b/src/main.c @@ -55,6 +55,7 @@ unsigned long Changed[MAX_LEV_FIELDX][MAX_LEV_FIELDY]; unsigned long ChangeEvent[MAX_LEV_FIELDX][MAX_LEV_FIELDY]; short WasJustMoving[MAX_LEV_FIELDX][MAX_LEV_FIELDY]; short WasJustFalling[MAX_LEV_FIELDX][MAX_LEV_FIELDY]; +short CheckCollision[MAX_LEV_FIELDX][MAX_LEV_FIELDY]; short AmoebaNr[MAX_LEV_FIELDX][MAX_LEV_FIELDY]; short AmoebaCnt[MAX_NUM_AMOEBA]; short AmoebaCnt2[MAX_NUM_AMOEBA]; diff --git a/src/main.h b/src/main.h index 2842cbf4..0690bafe 100644 --- a/src/main.h +++ b/src/main.h @@ -89,6 +89,7 @@ #define EP_CAN_EXPLODE_CROSS 25 #define EP_PROTECTED 26 #define EP_CAN_MOVE_INTO_ACID 27 +#define EP_THROWABLE 28 /* values for pre-defined properties */ #define EP_PLAYER 32 @@ -196,9 +197,8 @@ #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 31 +#define NUM_CHANGE_EVENTS 30 #define CE_BITMASK_DEFAULT 0 @@ -242,6 +242,8 @@ #define CP_WHEN_EMPTY 0 #define CP_WHEN_DIGGABLE 1 #define CP_WHEN_DESTRUCTIBLE 2 +#define CP_WHEN_COLLECTIBLE 3 +#define CP_WHEN_REMOVABLE 4 /* values for custom move patterns (bits 0 - 3: basic move directions) */ #define MV_BIT_TOWARDS_PLAYER 4 @@ -330,6 +332,7 @@ #define CAN_EXPLODE_CROSS(e) HAS_PROPERTY(e, EP_CAN_EXPLODE_CROSS) #define IS_PROTECTED(e) HAS_PROPERTY(e, EP_PROTECTED) #define CAN_MOVE_INTO_ACID(e) HAS_PROPERTY(e, EP_CAN_MOVE_INTO_ACID) +#define IS_THROWABLE(e) HAS_PROPERTY(e, EP_THROWABLE) /* macros for special configurable properties */ #define IS_EM_SLIPPERY_WALL(e) HAS_PROPERTY(e, EP_EM_SLIPPERY_WALL) @@ -1865,6 +1868,7 @@ extern unsigned long Changed[MAX_LEV_FIELDX][MAX_LEV_FIELDY]; extern unsigned long ChangeEvent[MAX_LEV_FIELDX][MAX_LEV_FIELDY]; extern short WasJustMoving[MAX_LEV_FIELDX][MAX_LEV_FIELDY]; extern short WasJustFalling[MAX_LEV_FIELDX][MAX_LEV_FIELDY]; +extern short CheckCollision[MAX_LEV_FIELDX][MAX_LEV_FIELDY]; extern short AmoebaNr[MAX_LEV_FIELDX][MAX_LEV_FIELDY]; extern short AmoebaCnt[MAX_NUM_AMOEBA]; extern short AmoebaCnt2[MAX_NUM_AMOEBA]; diff --git a/src/tape.c b/src/tape.c index 34474bde..479adfbf 100644 --- a/src/tape.c +++ b/src/tape.c @@ -1152,6 +1152,17 @@ void TapeQuickSave() void TapeQuickLoad() { + if (tape.recording && !Request("Stop recording and load tape ?", + REQ_ASK | REQ_STAY_CLOSED)) + { + BlitBitmap(bitmap_db_door, bitmap_db_door, + DOOR_GFX_PAGEX2, DOOR_GFX_PAGEY1, DXSIZE, DYSIZE, + DOOR_GFX_PAGEX1, DOOR_GFX_PAGEY1); + OpenDoor(DOOR_OPEN_1); + + return; + } + if (game_status == GAME_MODE_PLAYING || game_status == GAME_MODE_MAIN) { TapeStop(); diff --git a/src/tools.c b/src/tools.c index 26ec6c22..616cf6e8 100644 --- a/src/tools.c +++ b/src/tools.c @@ -2311,8 +2311,8 @@ boolean Request(char *text, unsigned int req_state) if (!(req_state & REQ_STAY_CLOSED) && (old_door_state & DOOR_OPEN_1)) { BlitBitmap(bitmap_db_door, bitmap_db_door, - DOOR_GFX_PAGEX2,DOOR_GFX_PAGEY1, DXSIZE,DYSIZE, - DOOR_GFX_PAGEX1,DOOR_GFX_PAGEY1); + DOOR_GFX_PAGEX2, DOOR_GFX_PAGEY1, DXSIZE, DYSIZE, + DOOR_GFX_PAGEX1, DOOR_GFX_PAGEY1); OpenDoor(DOOR_OPEN_1); } }