renamed variables
authorHolger Schemel <holger.schemel@virtion.de>
Sun, 15 Sep 2024 21:51:47 +0000 (23:51 +0200)
committerHolger Schemel <holger.schemel@virtion.de>
Sun, 15 Sep 2024 21:51:55 +0000 (23:51 +0200)
src/game_bd/bd_cave.h
src/game_bd/bd_caveengine.c

index f1ed353285bea423e58e9a7f2adce8412ecbeab7..3ba7824b49cc16a608804226b16848c456d3750e 100644 (file)
@@ -328,7 +328,8 @@ typedef struct _gd_c64_random_generator
 // Structure holding all data belonging to a cave.
 // ----------------------------------------------------------------------------
 
-#define GD_HIGHSCORE_NUM 20
+#define GD_HIGHSCORE_NUM               20
+#define GD_PLAYER_MEM_SIZE             16
 
 typedef struct _gd_cave
 {
@@ -617,7 +618,8 @@ typedef struct _gd_cave
   boolean sweet_eaten;                  // player ate sweet, he's strong. prob_sweet applies,
                                         // and also able to push chasing stones
   int player_x, player_y;               // Coordinates of player (for scrolling)
-  int px[16], py[16];                   // coordinates of player, for chasing stone
+  int player_x_mem[GD_PLAYER_MEM_SIZE]; // coordinates of player, for chasing stone
+  int player_y_mem[GD_PLAYER_MEM_SIZE];
   int key1, key2, key3;                 // The player is holding this number of keys of each color
   boolean diamond_key_collected;        // Key collected, so trapped diamonds convert to diamonds
   boolean inbox_flash_toggle;           // negated every scan. helps drawing inboxes, and making
index 58c0d030dcba269d2f87fa0fc0ff8a208655aaf9..cb9967d7d3777036cefbe9a8bdf151e532bfcd76 100644 (file)
@@ -2771,8 +2771,8 @@ void gd_cave_iterate(GdCave *cave, GdDirection player_move, boolean player_fire,
 
        case O_CHASING_STONE:
          {
-           int px = cave->px[0];
-           int py = cave->py[0];
+           int px = cave->player_x_mem[0];
+           int py = cave->player_y_mem[0];
            boolean horizontal = gd_rand_boolean(cave->random);
            boolean dont_move = FALSE;
            int i = 3;
@@ -3928,14 +3928,14 @@ void gd_cave_iterate(GdCave *cave, GdDirection player_move, boolean player_fire,
   }
 
   // record coordinates of player for chasing stone
-  for (i = 0; i < ARRAY_SIZE(cave->px) - 1; i++)
+  for (i = 0; i < GD_PLAYER_MEM_SIZE - 1; i++)
   {
-    cave->px[i] = cave->px[i + 1];
-    cave->py[i] = cave->py[i + 1];
+    cave->player_x_mem[i] = cave->player_x_mem[i + 1];
+    cave->player_y_mem[i] = cave->player_y_mem[i + 1];
   }
 
-  cave->px[ARRAY_SIZE(cave->px) - 1] = cave->player_x;
-  cave->py[ARRAY_SIZE(cave->py) - 1] = cave->player_y;
+  cave->player_x_mem[GD_PLAYER_MEM_SIZE - 1] = cave->player_x;
+  cave->player_y_mem[GD_PLAYER_MEM_SIZE - 1] = cave->player_y;
 
   // SCHEDULING