added optional button to restart game (door, panel and touch variants)
[rocksndiamonds.git] / src / game_em / logic.c
index a56547b14a462365e830a8cdfbdb59ac0adead0b..b73edab2558584e6bc2d53475c04dd9aa81383b5 100644 (file)
@@ -293,7 +293,7 @@ static boolean player_killed(struct PLAYER *ply)
   if (!ply->alive)
     return FALSE;
 
-  if (lev.killed_out_of_time && setup.time_limit)
+  if (lev.killed_out_of_time && game.time_limit)
     return TRUE;
 
   switch (cave[x][y-1])
@@ -777,6 +777,9 @@ static boolean player_digfield(struct PLAYER *ply, int dx, int dy)
        if (dy)
          break;
 
+       if (game_em.use_push_delay && RANDOM(32) < 16)
+         goto stone_push_anim;
+
        switch (cave[x+dx][y])
        {
           case Xblank:
@@ -817,6 +820,8 @@ static boolean player_digfield(struct PLAYER *ply, int dx, int dy)
            break;
        }
 
+      stone_push_anim:
+
        ply->anim = PLY_push_n + anim;
        break;
 
@@ -824,6 +829,9 @@ static boolean player_digfield(struct PLAYER *ply, int dx, int dy)
        if (dy)
          break;
 
+       if (game_em.use_push_delay && RANDOM(32) < 22)
+         goto bomb_push_anim;
+
        switch (cave[x+dx][y])
        {
          case Xblank:
@@ -864,6 +872,8 @@ static boolean player_digfield(struct PLAYER *ply, int dx, int dy)
            break;
        }
 
+      bomb_push_anim:
+
        ply->anim = PLY_push_n + anim;
        break;
 
@@ -871,6 +881,9 @@ static boolean player_digfield(struct PLAYER *ply, int dx, int dy)
        if (dy)
          break;
 
+       if (game_em.use_push_delay && RANDOM(32) < 19)
+         goto nut_push_anim;
+
        switch (cave[x+dx][y])
        {
           case Xblank:
@@ -911,6 +924,8 @@ static boolean player_digfield(struct PLAYER *ply, int dx, int dy)
            break;
        }
 
+      nut_push_anim:
+
        ply->anim = PLY_push_n + anim;
        break;
 
@@ -1469,6 +1484,8 @@ static void check_player(struct PLAYER *ply)
 
   ply->dynamite_cnt = 0;       /* reset dynamite timer if we move */
 
+  seed = game_em.random;
+
   if (!ply->joy_snap)          /* player wants to move */
   {
     boolean moved = FALSE;
@@ -1500,6 +1517,8 @@ static void check_player(struct PLAYER *ply)
   {
     game_em.any_player_snapping = player_digfield(ply, dx, dy);
   }
+
+  game_em.random = seed;
 }
 
 static void set_nearest_player_xy(int x, int y, int *dx, int *dy)
@@ -7768,6 +7787,18 @@ static void logic_players(void)
       next[ply[i].x][ply[i].y] = add_player[element];
     }
   }
+
+  /* check for wheel at wrap-around position */
+  if (lev.wheel_x < lev.left ||
+      lev.wheel_x > lev.right - 1)
+  {
+    int direction = (lev.wheel_x < lev.left ? -1 : 1);
+
+    lev.wheel_x += -direction * lev.width;
+
+    if (!lev.infinite_true)
+      lev.wheel_y += direction;
+  }
 }
 
 static void logic_objects(void)