minor changes
authorHolger Schemel <holger.schemel@virtion.de>
Thu, 12 Sep 2024 23:10:43 +0000 (01:10 +0200)
committerHolger Schemel <holger.schemel@virtion.de>
Thu, 12 Sep 2024 23:49:30 +0000 (01:49 +0200)
src/game_bd/bd_caveengine.c

index ab8869f05d894ac869b84dc5aeb3c5f7a32c6484..919abcc434216a3799b02d3f15e4dff0f49208a6 100644 (file)
@@ -973,15 +973,15 @@ static void inline explode_dir(GdCave *cave, const int x, const int y, GdDirecti
 // @param y The coordinate of player
 // @param dir The direction the player is moving
 // @return remaining element
-static GdElement player_eat_element(GdCavecave, const GdElement element, int x, int y)
+static GdElement player_eat_element(GdCave *cave, const GdElement element, int x, int y)
 {
   int i;
 
   switch (element)
   {
     case O_DIAMOND_KEY:
-      cave->diamond_key_collected = TRUE;
       gd_sound_play(cave, GD_S_DIAMOND_KEY_COLLECTING, element, x, y);
+      cave->diamond_key_collected = TRUE;
       return O_SPACE;
 
     // KEYS AND DOORS
@@ -1022,34 +1022,40 @@ static GdElement player_eat_element(GdCave* cave, const GdElement element, int x
       return O_SPACE;
 
     // SWITCHES
-    case O_CREATURE_SWITCH:        // creatures change direction.
+    case O_CREATURE_SWITCH:
+      // creatures change direction.
       gd_sound_play(cave, GD_S_SWITCH_CREATURES, element, x, y);
       cave->creatures_backwards = !cave->creatures_backwards;
       return element;
 
-    case O_EXPANDING_WALL_SWITCH:        // expanding wall change direction.
+    case O_EXPANDING_WALL_SWITCH:
+      // expanding wall change direction.
       gd_sound_play(cave, GD_S_SWITCH_EXPANDING, element, x, y);
       cave->expanding_wall_changed = !cave->expanding_wall_changed;
       return element;
 
-    case O_BITER_SWITCH:        // biter change delay
+    case O_BITER_SWITCH:
+      // biter change delay
       gd_sound_play(cave, GD_S_SWITCH_BITER, element, x, y);
       cave->biter_delay_frame++;
       if (cave->biter_delay_frame == 4)
        cave->biter_delay_frame = 0;
       return element;
 
-    case O_REPLICATOR_SWITCH:    // replicator on/off switch
+    case O_REPLICATOR_SWITCH:
+      // replicator on/off switch
       gd_sound_play(cave, GD_S_SWITCH_REPLICATOR, element, x, y);
       cave->replicators_active = !cave->replicators_active;
       return element;
 
-    case O_CONVEYOR_SWITCH:    // conveyor belts on/off
+    case O_CONVEYOR_SWITCH:
+      // conveyor belts on/off
       gd_sound_play(cave, GD_S_SWITCH_CONVEYOR, element, x, y);
       cave->conveyor_belts_active = !cave->conveyor_belts_active;
       return element;
 
-    case O_CONVEYOR_DIR_SWITCH: // conveyor belts switch direction
+    case O_CONVEYOR_DIR_SWITCH:
+      // conveyor belts switch direction
       gd_sound_play(cave, GD_S_SWITCH_CONVEYOR, element, x, y);
       cave->conveyor_belts_direction_changed = !cave->conveyor_belts_direction_changed;
       return element;
@@ -1057,17 +1063,22 @@ static GdElement player_eat_element(GdCave* cave, const GdElement element, int x
     // USUAL STUFF
     case O_DIRT:
     case O_DIRT2:
-    case O_STEEL_EATABLE:
-    case O_BRICK_EATABLE:
     case O_DIRT_SLOPED_UP_RIGHT:
     case O_DIRT_SLOPED_UP_LEFT:
     case O_DIRT_SLOPED_DOWN_LEFT:
     case O_DIRT_SLOPED_DOWN_RIGHT:
     case O_DIRT_BALL:
     case O_DIRT_LOOSE:
+    case O_STEEL_EATABLE:
+    case O_BRICK_EATABLE:
       gd_sound_play(cave, GD_S_DIRT_WALKING, element, x, y);
       return O_SPACE;
 
+    case O_SPACE:
+    case O_LAVA:    // player goes into lava, as if it was space
+      gd_sound_play(cave, GD_S_EMPTY_WALKING, element, x, y);
+      return O_SPACE;
+
     case O_SWEET:
       gd_sound_play(cave, GD_S_SWEET_COLLECTING, element, x, y);
       cave->sweet_eaten = TRUE;
@@ -1126,11 +1137,6 @@ static GdElement player_eat_element(GdCave* cave, const GdElement element, int x
       cave->player_state = GD_PL_EXITED;    // player now exits the cave!
       return O_SPACE;
 
-    case O_SPACE:
-    case O_LAVA:    // player goes into lava, as if it was space
-      gd_sound_play(cave, GD_S_EMPTY_WALKING, element, x, y);
-      return O_SPACE;
-
     default:
       // the element will remain there.
       return element;
@@ -2145,7 +2151,7 @@ void gd_cave_iterate(GdCave *cave, GdDirection player_move, boolean player_fire,
 
                default:
                  // get element. if cannot get, player_eat_element will return the same
-                 remains = player_eat_element (cave, what, x, y);
+                 remains = player_eat_element(cave, what, x, y);
                  break;
              }
            }