added flags for "level solved" and "game over" to EM engine
[rocksndiamonds.git] / src / game_em / synchro_1.c
index f09fc84819a0657ad872adc5bc533bbf926cc3f7..b390ad916e71dfeec0f108d8fa38d81edbdd9b7b 100644 (file)
@@ -10,8 +10,6 @@
 
 #define USE_CHANGED_ACID_STUFF         1
 
-extern boolean checkIfAllPlayersFitToScreen();
-
 static void check_player(struct PLAYER *);
 static void kill_player(struct PLAYER *);
 static boolean player_digfield(struct PLAYER *, int, int);
@@ -23,6 +21,7 @@ void synchro_1(void)
   int i;
 
   game_em.any_player_moving = FALSE;
+  game_em.any_player_snapping = FALSE;
 
   /* must test for death and actually kill separately */
   for (i = 0; i < MAX_PLAYERS; i++)
@@ -460,7 +459,7 @@ static void check_player(struct PLAYER *ply)
   }
   else                                 /* player wants to snap */
   {
-    player_digfield(ply, dx, dy);
+    game_em.any_player_snapping = player_digfield(ply, dx, dy);
   }
 }
 
@@ -584,6 +583,7 @@ static boolean player_digfield(struct PLAYER *ply, int dx, int dy)
        play_element_sound(x, y, SAMPLE_collect, element);
        lev.score += lev.diamond_score;
        lev.required = lev.required < 3 ? 0 : lev.required - 3;
+       game.snapshot.collected_item = TRUE;
        ply->anim = SPR_walk + anim;
        ply->x = x;
        ply->y = y;
@@ -596,6 +596,7 @@ static boolean player_digfield(struct PLAYER *ply, int dx, int dy)
        play_element_sound(x, y, SAMPLE_collect, element);
        lev.score += lev.emerald_score;
        lev.required = lev.required < 1 ? 0 : lev.required - 1;
+       game.snapshot.collected_item = TRUE;
        ply->anim = SPR_walk + anim;
        ply->x = x;
        ply->y = y;
@@ -1068,6 +1069,9 @@ static boolean player_digfield(struct PLAYER *ply, int dx, int dy)
       case Xexit_3:
        lev.home--;
 
+       if (lev.home == 0)
+         game_em.level_solved = TRUE;
+
        ply->anim = SPR_walk + anim;
        ply->x = x;
        ply->y = y;
@@ -1107,6 +1111,7 @@ static boolean player_digfield(struct PLAYER *ply, int dx, int dy)
        play_element_sound(x, y, SAMPLE_collect, element);
        lev.score += lev.diamond_score;
        lev.required = lev.required < 3 ? 0 : lev.required - 3;
+       game.snapshot.collected_item = TRUE;
        ply->anim = SPR_walk + anim;
        break;
 
@@ -1117,6 +1122,7 @@ static boolean player_digfield(struct PLAYER *ply, int dx, int dy)
        play_element_sound(x, y, SAMPLE_collect, element);
        lev.score += lev.emerald_score;
        lev.required = lev.required < 1 ? 0 : lev.required - 1;
+       game.snapshot.collected_item = TRUE;
        ply->anim = SPR_walk + anim;
        break;