fixed bug with laser still growing amoeba after it was destroyed by bomb
[rocksndiamonds.git] / src / game_mm / mm_game.c
index 192dbf585aada246cfb17f0dd7fe484f5ed69430..f89e23d80168367b31614bc36ff6c8335342c036 100644 (file)
@@ -275,6 +275,9 @@ static void InitLaser()
   laser.num_beamers = 0;
   laser.beamer_edge[0] = 0;
 
+  laser.dest_element = EL_EMPTY;
+  laser.wall_mask = 0;
+
   AddLaserEdge(LX, LY);                /* set laser starting edge */
 
   pen_ray = GetPixelFromRGB(window,
@@ -738,7 +741,7 @@ void ScanLaser()
   if (rf)
     DrawLaser(rf - 1, DL_LASER_ENABLED);
 
-  Ct = CT = Counter();
+  Ct = CT = FrameCounter;
 
 #if 0
     if (!IN_LEV_FIELD(ELX, ELY))
@@ -2181,17 +2184,19 @@ static void Explode_MM(int x, int y, int phase, int mode)
   {
     if (Store[x][y] == EL_BOMB)
     {
-      laser.num_damages--;
       DrawLaser(0, DL_LASER_DISABLED);
-      laser.num_edges = 0;
+      InitLaser();
 
       Bang_MM(laser.start_edge.x, laser.start_edge.y);
       Store[x][y] = EL_EMPTY;
+
+      game_mm.game_over = TRUE;
+      game_mm.game_over_cause = GAME_OVER_BOMB;
+
+      laser.overloaded = FALSE;
     }
     else if (IS_MCDUFFIN(Store[x][y]))
     {
-      game_mm.game_over = TRUE;
-      game_mm.game_over_cause = GAME_OVER_BOMB;
       Store[x][y] = EL_EMPTY;
     }
 
@@ -2733,9 +2738,9 @@ void ColorCycling(void)
   if (color_status == STATIC_COLORS)
     return;
 
-  CC = Counter();
+  CC = FrameCounter;
 
-  if (CC < Cc || CC > Cc + 50)
+  if (CC < Cc || CC > Cc + 2)
   {
     Cc = CC;
 
@@ -2811,7 +2816,7 @@ static void GameActions_MM_Ext(struct MouseActionInfo action, boolean warp_mode)
   laser.redraw = FALSE;
 #endif
 
-  CT = Counter();
+  CT = FrameCounter;
 
   if (game_mm.num_pacman && FrameReached(&pacman_delay, PACMAN_MOVE_DELAY))
   {
@@ -3015,7 +3020,7 @@ static void GameActions_MM_Ext(struct MouseActionInfo action, boolean warp_mode)
 
   CT -= Ct;
 
-  if (element == EL_BOMB && CT > 1500)
+  if (element == EL_BOMB && CT > 75)
   {
     if (game_mm.cheat_no_explosion)
       return;
@@ -3053,7 +3058,7 @@ static void GameActions_MM_Ext(struct MouseActionInfo action, boolean warp_mode)
     return;
   }
 
-  if (element == EL_FUSE_ON && CT > 500)
+  if (element == EL_FUSE_ON && CT > 25)
   {
     laser.fuse_off = TRUE;
     laser.fuse_x = ELX;
@@ -3063,7 +3068,7 @@ static void GameActions_MM_Ext(struct MouseActionInfo action, boolean warp_mode)
     DrawGraphic_MM(ELX, ELY, IMG_MM_FUSE);
   }
 
-  if (element == EL_BALL_GRAY && CT > 1500)
+  if (element == EL_BALL_GRAY && CT > 75)
   {
     static int new_elements[] =
     {
@@ -3182,7 +3187,7 @@ static void GameActions_MM_Ext(struct MouseActionInfo action, boolean warp_mode)
     return;
   }
 
-  if (IS_WALL_ICE(element) && CT > 1000)
+  if (IS_WALL_ICE(element) && CT > 50)
   {
     PlayLevelSound_MM(ELX, ELY, element, MM_ACTION_SHRINKING);
 
@@ -3234,7 +3239,7 @@ static void GameActions_MM_Ext(struct MouseActionInfo action, boolean warp_mode)
     return;
   }
 
-  if (IS_WALL_AMOEBA(element) && CT > 1200)
+  if (IS_WALL_AMOEBA(element) && CT > 60)
   {
     int k1, k2, k3, dx, dy, de, dm;
     int element2 = Feld[ELX][ELY];
@@ -3352,7 +3357,7 @@ static void GameActions_MM_Ext(struct MouseActionInfo action, boolean warp_mode)
   }
 
   if ((element == EL_BLOCK_WOOD || element == EL_BLOCK_STONE) &&
-      laser.stops_inside_element && CT > 1500)
+      laser.stops_inside_element && CT > 75)
   {
     int x, y;
     int k;
@@ -3409,7 +3414,7 @@ static void GameActions_MM_Ext(struct MouseActionInfo action, boolean warp_mode)
     return;
   }
 
-  if (element == EL_FUEL_FULL && CT > 200)
+  if (element == EL_FUEL_FULL && CT > 10)
   {
     for (i = game_mm.energy_left; i <= MAX_LASER_ENERGY; i+=2)
     {
@@ -3511,7 +3516,7 @@ void MovePacMen()
 
       getGraphicSource(graphic, 0, &bitmap, &src_x, &src_y);
 
-      CT = Counter();
+      CT = FrameCounter;
       ox = SX + ox * TILEX;
       oy = SY + oy * TILEY;
 
@@ -3519,7 +3524,7 @@ void MovePacMen()
        BlitBitmap(bitmap, window,
                   src_x, src_y, TILEX, TILEY,
                   ox + i * mx, oy + i * my);
-      Ct = Ct + Counter() - CT;
+      Ct = Ct + FrameCounter - CT;
     }
 
     DrawField_MM(nx, ny);