#define USE_CHANGE_TO_TRIGGERED (TRUE * USE_NEW_STUFF * 1)
+#define USE_BACK_WALKABLE_BUGFIX (TRUE * USE_NEW_STUFF * 1)
+
/* for DigField() */
#define DF_NO_PUSH 0
void Impact(int x, int y)
{
- boolean lastline = (y == lev_fieldy-1);
+ boolean last_line = (y == lev_fieldy - 1);
boolean object_hit = FALSE;
- boolean impact = (lastline || object_hit);
+ boolean impact = (last_line || object_hit);
int element = Feld[x][y];
int smashed = EL_STEELWALL;
printf("IMPACT!\n");
#endif
- if (!lastline) /* check if element below was hit */
+ if (!last_line) /* check if element below was hit */
{
if (Feld[x][y + 1] == EL_PLAYER_IS_LEAVING)
return;
if (object_hit)
smashed = MovingOrBlocked2Element(x, y + 1);
- impact = (lastline || object_hit);
+ impact = (last_line || object_hit);
}
- if (!lastline && smashed == EL_ACID) /* element falls into acid */
+ if (!last_line && smashed == EL_ACID) /* element falls into acid */
{
SplashAcid(x, y + 1);
return;
}
/* play sound of magic wall / mill */
- if (!lastline &&
+ if (!last_line &&
(Feld[x][y + 1] == EL_MAGIC_WALL_ACTIVE ||
Feld[x][y + 1] == EL_BD_MAGIC_WALL_ACTIVE))
{
}
/* play sound of object that hits the ground */
- if (lastline || object_hit)
+ if (last_line || object_hit)
PlayLevelSoundElementAction(x, y, element, ACTION_IMPACT);
}
ContinueMoving(x, y);
}
+void dummy()
+{
+}
+
void ContinueMoving(int x, int y)
{
int element = Feld[x][y];
#else
boolean pushed_by_player = Pushed[x][y];
#endif
+ boolean last_line = (newy == lev_fieldy - 1);
MovPos[x][y] += getElementMoveStepsize(x, y);
#if USE_NEW_MOVE_STYLE
#if 0
if (CAN_FALL(element) && direction == MV_DOWN &&
- (newy == lev_fieldy - 1 || !IS_FREE(x, newy + 1)) &&
- IS_PLAYER(x, newy + 1))
+ !last_line && IS_PLAYER(x, newy + 1))
printf("::: we would now kill the player [%d]\n", FrameCounter);
#endif
/* give the player one last chance (one more frame) to move away */
if (CAN_FALL(element) && direction == MV_DOWN &&
- (newy == lev_fieldy - 1 || !IS_FREE(x, newy + 1)) &&
- ((newy < lev_fieldy - 1 && !IS_PLAYER(x, newy + 1)) ||
- game.engine_version < VERSION_IDENT(3,1,1,0)))
+ (last_line || (!IS_FREE(x, newy + 1) &&
+ (!IS_PLAYER(x, newy + 1) ||
+ game.engine_version < VERSION_IDENT(3,1,1,0)))))
Impact(x, newy);
#else
if (CAN_FALL(element) && direction == MV_DOWN &&
- (newy == lev_fieldy - 1 || !IS_FREE(x, newy + 1)))
+ (last_line || !IS_FREE(x, newy + 1)))
Impact(x, newy);
#endif
DrawLevelFieldCrumbledSand(x, y);
}
-static void ChangeElementNowExt(int x, int y, int target_element)
+static void HandleChangeAction(int change_action)
+{
+ if (change_action == CA_EXIT_PLAYER)
+ {
+ printf("::: CA_EXIT_GAME\n");
+
+ /* !!! local_player <-> 4 players !!! (EXTEND THIS) !!! */
+ local_player->LevelSolved = local_player->GameOver = TRUE;
+ }
+ else if (change_action == CA_KILL_PLAYER)
+ {
+ printf("::: CA_KILL_PLAYER\n");
+
+ /* !!! local_player <-> 4 players !!! (EXTEND THIS) !!! */
+ KillHero(local_player);
+ }
+}
+
+static void ChangeElementNowExt(struct ElementChangeInfo *change,
+ int x, int y, int target_element)
{
int previous_move_direction = MovDir[x][y];
#if 1
TestIfPlayerTouchesCustomElement(x, y);
TestIfElementTouchesCustomElement(x, y);
#endif
+
+ if (change->use_change_action)
+ HandleChangeAction(change->change_action);
}
static boolean ChangeElementNow(int x, int y, int element, int page)
content_element = change->target_content[xx][yy];
target_element = GET_TARGET_ELEMENT(content_element, change);
- ChangeElementNowExt(ex, ey, target_element);
+ ChangeElementNowExt(change, ex, ey, target_element);
something_has_changed = TRUE;
{
target_element = GET_TARGET_ELEMENT(change->target_element, change);
- ChangeElementNowExt(x, y, target_element);
+ ChangeElementNowExt(change, x, y, target_element);
PlayLevelSoundElementAction(x, y, element, ACTION_CHANGING);
}
if (IS_TUBE(Back[jx][jy]) && game.engine_version >= VERSION_IDENT(2,2,0,0))
old_element = Back[jx][jy];
+#if USE_BACK_WALKABLE_BUGFIX
+
+ /* in case of element dropped at player position, check background */
+ else if (Back[jx][jy] != EL_EMPTY &&
+ game.engine_version >= VERSION_IDENT(2,2,0,0))
+ old_element = Back[jx][jy];
+#endif
#endif