rnd-20030429-1-src
[rocksndiamonds.git] / src / game.c
index 1bea27fe4f59876bdfbc5aece1eff07dffbf4bdd..55658d8028daa1452f936a5e4398fe2d89a9db76 100644 (file)
@@ -5152,24 +5152,6 @@ boolean MoveFigure(struct PlayerInfo *player, int dx, int dy)
   if (!player->active || (!dx && !dy))
     return FALSE;
 
-#if 0
-  {
-    static boolean done = FALSE;
-    static old_count = -1;
-
-    if (FrameCounter < old_count)
-      done = FALSE;
-
-    if (FrameCounter < 100)
-    {
-      printf("::: wanna move [%d] [%d]\n",
-            FrameCounter, player->push_delay_value);
-      done = TRUE;
-      old_count = FrameCounter;
-    }
-  }
-#endif
-
 #if 0
   if (!FrameReached(&player->move_delay, player->move_delay_value) &&
       !tape.playing)
@@ -5756,24 +5738,6 @@ int DigField(struct PlayerInfo *player,
                        dy == +1 ? MV_DOWN : MV_NO_MOVING);
   int element;
 
-#if 0
-  {
-    static boolean done = FALSE;
-
-    if (FrameCounter < 10)
-      done = FALSE;
-
-    if (!done &&
-       real_dx == -1 &&
-       FrameCounter > 10)
-    {
-      printf("::: wanna move left [%d] [%d]\n",
-            FrameCounter, player->push_delay_value);
-      done = TRUE;
-    }
-  }
-#endif
-
   if (player->MovPos == 0)
   {
     player->is_digging = FALSE;
@@ -5787,6 +5751,7 @@ int DigField(struct PlayerInfo *player,
   {
     player->Switching = FALSE;
     player->push_delay = 0;
+
     return MF_NO_ACTION;
   }
 
@@ -5831,6 +5796,12 @@ int DigField(struct PlayerInfo *player,
 
   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:
@@ -6446,7 +6417,40 @@ int DigField(struct PlayerInfo *player,
       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;
@@ -6496,6 +6500,9 @@ boolean SnapField(struct PlayerInfo *player, int dx, int dy)
   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;
 
@@ -6526,7 +6533,7 @@ boolean SnapField(struct PlayerInfo *player, int dx, int dy)
                    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;