if (setup.sound_music)
PlayMusic(level_nr);
- if (!tape.playing)
- KeyboardAutoRepeatOff();
+ KeyboardAutoRepeatOffUnlessAutoplay();
if (options.debug)
{
if (IS_PLAYER(x, y))
KillHeroUnlessProtected(x, y);
- else if (IS_EXPLOSIVE(element))
+ else if (IS_CAN_EXPLODE(element))
{
Feld[x][y] = Store2[x][y];
Store2[x][y] = 0;
MovDir[x][y] = MovPos[x][y] = MovDelay[x][y] = 0;
InitField(x, y, FALSE);
- if (CAN_MOVE(element) || COULD_MOVE(element))
+ if (CAN_MOVE(element))
InitMovDir(x, y);
DrawLevelField(x, y);
if (!lastline && object_hit) /* check which object was hit */
{
- if (CAN_CHANGE(element) &&
+ if (CAN_PASS_MAGIC_WALL(element) &&
(smashed == EL_MAGIC_WALL ||
smashed == EL_BD_MAGIC_WALL))
{
int rnd = RND(rnd_value);
if (IN_LEV_FIELD(left_x, left_y) &&
- (IS_FREE(left_x, left_y) || IS_GEM(Feld[left_x][left_y])))
+ (IS_FREE(left_x, left_y) || IS_FOOD_PIG(Feld[left_x][left_y])))
can_turn_left = TRUE;
if (IN_LEV_FIELD(right_x, right_y) &&
- (IS_FREE(right_x, right_y) || IS_GEM(Feld[right_x][right_y])))
+ (IS_FREE(right_x, right_y) || IS_FOOD_PIG(Feld[right_x][right_y])))
can_turn_right = TRUE;
if (IN_LEV_FIELD(move_x, move_y) &&
- (IS_FREE(move_x, move_y) || IS_GEM(Feld[move_x][move_y])))
+ (IS_FREE(move_x, move_y) || IS_FOOD_PIG(Feld[move_x][move_y])))
can_move_on = TRUE;
if (can_turn_left &&
MovDir[x][y] = back_dir;
if (!IS_FREE(x+move_xy[MovDir[x][y]].x, y+move_xy[MovDir[x][y]].y) &&
- !IS_GEM(Feld[x+move_xy[MovDir[x][y]].x][y+move_xy[MovDir[x][y]].y]))
+ !IS_FOOD_PIG(Feld[x+move_xy[MovDir[x][y]].x][y+move_xy[MovDir[x][y]].y]))
MovDir[x][y] = old_move_dir;
MovDelay[x][y] = 0;
void StartMoving(int x, int y)
{
- static boolean use_spring_bug = TRUE;
+ boolean use_spring_bug = (game.engine_version < VERSION_IDENT(2,2,0));
boolean started_moving = FALSE; /* some elements can fall _and_ move */
int element = Feld[x][y];
Store[x][y] = 0;
}
}
- else if (CAN_CHANGE(element) &&
+ else if (CAN_PASS_MAGIC_WALL(element) &&
(Feld[x][y+1] == EL_MAGIC_WALL_ACTIVE ||
Feld[x][y+1] == EL_BD_MAGIC_WALL_ACTIVE))
{
int sx = SCREENX(xx), sy = SCREENY(yy);
int flame_graphic = graphic + (i - 1);
-#if 1
if (!IN_LEV_FIELD(xx, yy) || IS_DRAGONFIRE_PROOF(Feld[xx][yy]))
break;
-#else
- if (!IN_LEV_FIELD(xx, yy) ||
- IS_HISTORIC_SOLID(Feld[xx][yy]) || Feld[xx][yy] == EL_EXPLOSION)
- break;
-#endif
if (MovDelay[x][y])
{
int flamed = MovingOrBlocked2Element(xx, yy);
- if (IS_ENEMY(flamed) || IS_EXPLOSIVE(flamed))
+ if (IS_ENEMY(flamed) || IS_CAN_EXPLODE(flamed))
Bang(xx, yy);
else
RemoveMovingField(xx, yy);
}
else if (element == EL_PIG && IN_LEV_FIELD(newx, newy))
{
- if (IS_GEM(Feld[newx][newy]))
+ if (IS_FOOD_PIG(Feld[newx][newy]))
{
if (IS_MOVING(newx, newy))
RemoveMovingField(newx, newy);
static boolean checkDiagonalPushing(struct PlayerInfo *player,
int x, int y, int real_dx, int real_dy)
{
-#if 1
int jx, jy, dx, dy, xx, yy;
if (real_dx == 0 || real_dy == 0) /* no diagonal direction => push */
xx = jx + (dx == 0 ? real_dx : 0);
yy = jy + (dy == 0 ? real_dy : 0);
- return (!IN_LEV_FIELD(xx, yy) || IS_SOLID(Feld[xx][yy]));
-#else
-
- if (real_dx && real_dy) /* diagonal direction input => do check */
- {
- /* diagonal direction: check alternative direction */
- int jx = player->jx, jy = player->jy;
- int dx = x - jx, dy = y - jy;
- int xx = jx + (dx == 0 ? real_dx : 0);
- int yy = jy + (dy == 0 ? real_dy : 0);
-
- if (IN_LEV_FIELD(xx, yy))
- {
- int element = Feld[xx][yy];
-
- if (game.engine_version < VERSION_IDENT(2,2,0))
- return IS_HISTORIC_SOLID(element);
- else
- return !(IS_WALKABLE(element) ||
- IS_DIGGABLE(element) ||
- IS_COLLECTIBLE(element));
- }
- }
-
- return TRUE; /* no diagonal direction input => push object */
-#endif
+ return (!IN_LEV_FIELD(xx, yy) || IS_SOLID_FOR_PUSHING(Feld[xx][yy]));
}
/*
{
player->Switching = FALSE;
player->push_delay = 0;
+
return MF_NO_ACTION;
}
element = Feld[x][y];
+#if 1
+ if (mode == DF_SNAP && !IS_SNAPPABLE(element) &&
+ game.engine_version >= VERSION_IDENT(2,2,0))
+ return MF_NO_ACTION;
+#endif
+
switch (element)
{
case EL_EMPTY:
player->Pushing = TRUE;
+#if 0
+ if (element == EL_ROCK)
+ printf("::: wanna push [%d] [%d]\n",
+ FrameCounter, player->push_delay_value);
+#endif
+
if (!IN_LEV_FIELD(x+dx, y+dy) || !IS_FREE(x+dx, y+dy))
return MF_NO_ACTION;
-#if 1
if (!checkDiagonalPushing(player, x, y, real_dx, real_dy))
return MF_NO_ACTION;
-#else
- if (real_dy)
- {
- if (IN_LEV_FIELD(jx, jy+real_dy) &&
- !IS_HISTORIC_SOLID(Feld[jx][jy+real_dy]))
- return MF_NO_ACTION;
- }
-#endif
if (player->push_delay == 0)
player->push_delay = FrameCounter;
|| !IS_SB_ELEMENT(element))))
return MF_NO_ACTION;
-#if 1
if (!checkDiagonalPushing(player, x, y, real_dx, real_dy))
return MF_NO_ACTION;
-#else
- if (dx && real_dy)
- {
- if (IN_LEV_FIELD(jx, jy+real_dy) &&
- !IS_HISTORIC_SOLID(Feld[jx][jy+real_dy]))
- return MF_NO_ACTION;
- }
- else if (dy && real_dx)
- {
- if (IN_LEV_FIELD(jx+real_dx, jy) &&
- !IS_HISTORIC_SOLID(Feld[jx+real_dx][jy]))
- return MF_NO_ACTION;
- }
-#endif
if (player->push_delay == 0)
player->push_delay = FrameCounter;
break;
default:
- if (IS_PUSHABLE(element))
+
+ if (IS_WALKABLE(element))
+ {
+ break;
+ }
+ else if (IS_DIGGABLE(element))
+ {
+ RemoveField(x, y);
+#if 1
+ if (mode != DF_SNAP)
+ {
+ GfxElement[x][y] = element;
+ player->is_digging = TRUE;
+ }
+#endif
+ PlaySoundLevelElementAction(x, y, element, ACTION_DIGGING);
+
+ break;
+ }
+ else if (IS_COLLECTIBLE(element))
+ {
+ RemoveField(x, y);
+#if 1
+ if (mode != DF_SNAP)
+ {
+ GfxElement[x][y] = element;
+ player->is_collecting = TRUE;
+ }
+#endif
+ PlaySoundLevelElementAction(x, y, element, ACTION_COLLECTING);
+
+ break;
+ }
+ else if (IS_PUSHABLE(element))
{
if (mode == DF_SNAP)
return MF_NO_ACTION;
if (!IN_LEV_FIELD(x+dx, y+dy) || !IS_FREE(x+dx, y+dy))
return MF_NO_ACTION;
-#if 1
if (!checkDiagonalPushing(player, x, y, real_dx, real_dy))
return MF_NO_ACTION;
-#else
- if (dx && real_dy)
- {
- if (IN_LEV_FIELD(jx, jy+real_dy) &&
- !IS_HISTORIC_SOLID(Feld[jx][jy+real_dy]))
- return MF_NO_ACTION;
- }
- else if (dy && real_dx)
- {
- if (IN_LEV_FIELD(jx+real_dx, jy) &&
- !IS_HISTORIC_SOLID(Feld[jx+real_dx][jy]))
- return MF_NO_ACTION;
- }
-#endif
if (player->push_delay == 0)
player->push_delay = FrameCounter;
int jx = player->jx, jy = player->jy;
int x = jx + dx, y = jy + dy;
+ if (player->MovPos && game.engine_version >= VERSION_IDENT(2,2,0))
+ return FALSE;
+
if (!player->active || !IN_LEV_FIELD(x, y))
return FALSE;
dy < 0 ? MV_UP :
dy > 0 ? MV_DOWN : MV_NO_MOVING);
- if (!DigField(player, x, y, 0, 0, DF_SNAP))
+ if (DigField(player, x, y, 0, 0, DF_SNAP) == MF_NO_ACTION)
return FALSE;
player->snapped = TRUE;