rnd-20060430-4-src
[rocksndiamonds.git] / src / game.c
index 158239c78e5504d90b20c3f31f45bfad3432f953..5d1f08f90516fbf347f65246e676f1c2fce9b631 100644 (file)
@@ -364,6 +364,8 @@ void RemovePlayer(struct PlayerInfo *);
 boolean SnapField(struct PlayerInfo *, int, int);
 boolean DropElement(struct PlayerInfo *);
 
+static int getInvisibleActiveFromInvisibleElement(int);
+static int getInvisibleFromInvisibleActiveElement(int);
 
 static struct GadgetInfo *game_gadget[NUM_GAME_BUTTONS];
 
@@ -1127,6 +1129,14 @@ static void InitField(int x, int y, boolean init_game)
        game.light_time_left = level.time_light * FRAMES_PER_SECOND;
       break;
 
+    case EL_INVISIBLE_STEELWALL:
+    case EL_INVISIBLE_WALL:
+    case EL_INVISIBLE_SAND:
+      if (game.light_time_left > 0 ||
+         game.lenses_time_left > 0)
+        Feld[x][y] = getInvisibleActiveFromInvisibleElement(element);
+      break;
+
     case EL_EMC_MAGIC_BALL:
       if (game.ball_state)
        Feld[x][y] = EL_EMC_MAGIC_BALL_ACTIVE;
@@ -5720,7 +5730,7 @@ inline static void TurnRoundExt(int x, int y)
 static void TurnRound(int x, int y)
 {
   int direction = MovDir[x][y];
-#if 1
+#if 0
   int element, graphic;
 #endif
 
@@ -8272,15 +8282,15 @@ static void ExecuteCustomElementAction(int x, int y, int element, int page)
     case CA_SET_CE_VALUE:
     {
 #if USE_NEW_CUSTOM_VALUE
-      int last_custom_value = CustomValue[x][y];
+      int last_ce_value = CustomValue[x][y];
 
       CustomValue[x][y] = action_arg_number_new;
 
 #if 0
-      printf("::: Count == %d\n", CustomValue[x][y]);
+      printf("::: CE value == %d\n", CustomValue[x][y]);
 #endif
 
-      if (CustomValue[x][y] == 0 && last_custom_value > 0)
+      if (CustomValue[x][y] == 0 && last_ce_value > 0)
       {
 #if 0
        printf("::: CE_VALUE_GETS_ZERO\n");
@@ -8300,8 +8310,30 @@ static void ExecuteCustomElementAction(int x, int y, int element, int page)
 
     case CA_SET_CE_SCORE:
     {
+#if USE_NEW_CUSTOM_VALUE
+      int last_ce_score = ei->collect_score;
+
       ei->collect_score = action_arg_number_new;
 
+#if 0
+      printf("::: CE score == %d\n", ei->collect_score);
+#endif
+
+      if (ei->collect_score == 0 && last_ce_score > 0)
+      {
+#if 0
+       printf("::: CE_SCORE_GETS_ZERO\n");
+#endif
+
+       CheckElementChange(x, y, element, EL_UNDEFINED, CE_SCORE_GETS_ZERO);
+       CheckTriggeredElementChange(x, y, element, CE_SCORE_GETS_ZERO_OF_X);
+
+#if 0
+       printf("::: RESULT: %d, %d\n", Feld[x][y], ChangePage[x][y]);
+#endif
+      }
+#endif
+
       break;
     }