renamed variables
authorHolger Schemel <holger.schemel@virtion.de>
Mon, 24 Jun 2024 15:55:32 +0000 (17:55 +0200)
committerHolger Schemel <holger.schemel@virtion.de>
Mon, 24 Jun 2024 16:00:13 +0000 (18:00 +0200)
This renames misleading variable names in the BD game engine for two
buffers that do not contain actual playfield elements, but mapped
elements only used for (re)drawing the playfield element graphics.

src/game_bd/bd_cave.c
src/game_bd/bd_cave.h
src/game_bd/bd_gameplay.c
src/game_bd/bd_gameplay.h
src/game_bd/bd_graphics.c
src/game_bd/export_bd.h
src/game_bd/main_bd.c

index 6a22a6379556b13d962f2cd26f7eb293eeb8aa09..a406afb7c6d16ac16d14e1ec68327cd50a84a3a1 100644 (file)
@@ -1317,7 +1317,7 @@ void gd_cave_count_diamonds(GdCave *cave)
   by the caller.
 */
 void gd_drawcave_game(const GdCave *cave,
-                     int **element_buffer, int **last_element_buffer, int **gfx_buffer,
+                     int **drawing_buffer, int **last_drawing_buffer, int **gfx_buffer,
                      boolean bonus_life_flash, int animcycle, boolean hate_invisible_outbox)
 {
   static int player_blinking = 0;
@@ -1558,7 +1558,7 @@ void gd_drawcave_game(const GdCave *cave,
        // special check needed when smooth game element movements selected in setup menu:
        // last element must either be player (before pushing) or pushable element (while pushing)
        // (extra check needed to prevent pushing animation when moving towards pushable element)
-       if (!use_bd_smooth_movements() || last_element_buffer[y][x] != O_SPACE)
+       if (!use_bd_smooth_movements() || last_drawing_buffer[y][x] != O_SPACE)
        {
          if (cave->last_direction == GD_MV_LEFT)
            map = O_PLAYER_PUSH_LEFT;
@@ -1581,8 +1581,8 @@ void gd_drawcave_game(const GdCave *cave,
        draw += GD_NUM_OF_CELLS;
 
       // set to buffer, with caching
-      if (element_buffer[y][x] != map)
-       element_buffer[y][x] = map;
+      if (drawing_buffer[y][x] != map)
+       drawing_buffer[y][x] = map;
 
       if (gfx_buffer[y][x] != draw)
        gfx_buffer[y][x] = draw | GD_REDRAW;
index 3dede416f53f3dc8e5702baa67447e9057595568..c551de659900e4a9c2c75662d5812ed944a8710e 100644 (file)
@@ -704,7 +704,7 @@ GdScheduling gd_scheduling_from_string(const char *str);
 #define GD_REDRAW (1 << 10)
 
 void gd_drawcave_game(const GdCave *cave,
-                     int **element_buffer, int **last_element_buffer, int **gfx_buffer,
+                     int **drawing_buffer, int **last_drawing_buffer, int **gfx_buffer,
                      boolean bonus_life_flash, int animcycle, boolean hate_invisible_outbox);
 
 // function to copy a GdString
index 0b4f48cdac4eab23a22b7d4bae0f441309ca132d..db10e62e3bee18b851b869103a44aaa242594a04 100644 (file)
@@ -22,10 +22,10 @@ void gd_game_free(GdGame *game)
   // stop sounds
   gd_sound_off();
 
-  if (game->element_buffer)
-    gd_cave_map_free(game->element_buffer);
-  if (game->last_element_buffer)
-    gd_cave_map_free(game->last_element_buffer);
+  if (game->drawing_buffer)
+    gd_cave_map_free(game->drawing_buffer);
+  if (game->last_drawing_buffer)
+    gd_cave_map_free(game->last_drawing_buffer);
   if (game->dir_buffer_from)
     gd_cave_map_free(game->dir_buffer_from);
   if (game->dir_buffer_to)
@@ -81,15 +81,15 @@ static void load_cave(GdGame *game)
 {
   int x, y;
 
-  // delete element buffer
-  if (game->element_buffer)
-    gd_cave_map_free(game->element_buffer);
-  game->element_buffer = NULL;
+  // delete drawing buffer
+  if (game->drawing_buffer)
+    gd_cave_map_free(game->drawing_buffer);
+  game->drawing_buffer = NULL;
 
-  // delete last element buffer
-  if (game->last_element_buffer)
-    gd_cave_map_free(game->last_element_buffer);
-  game->last_element_buffer = NULL;
+  // delete last drawing buffer
+  if (game->last_drawing_buffer)
+    gd_cave_map_free(game->last_drawing_buffer);
+  game->last_drawing_buffer = NULL;
 
   // delete direction buffer (from)
   if (game->dir_buffer_from)
@@ -131,19 +131,19 @@ static void load_cave(GdGame *game)
 
   game->cycle_counter = 0;
 
-  // create new element buffer
-  game->element_buffer = gd_cave_map_new(game->cave, int);
+  // create new drawing buffer
+  game->drawing_buffer = gd_cave_map_new(game->cave, int);
 
   for (y = 0; y < game->cave->h; y++)
     for (x = 0; x < game->cave->w; x++)
-      game->element_buffer[y][x] = O_NONE;
+      game->drawing_buffer[y][x] = O_NONE;
 
-  // create new last element buffer
-  game->last_element_buffer = gd_cave_map_new(game->cave, int);
+  // create new last drawing buffer
+  game->last_drawing_buffer = gd_cave_map_new(game->cave, int);
 
   for (y = 0; y < game->cave->h; y++)
     for (x = 0; x < game->cave->w; x++)
-      game->last_element_buffer[y][x] = O_NONE;
+      game->last_drawing_buffer[y][x] = O_NONE;
 
   // create new direction buffer (from)
   game->dir_buffer_from = gd_cave_map_new(game->cave, int);
@@ -406,7 +406,7 @@ static GdGameState gd_game_main_int(GdGame *game, boolean allow_iterate, boolean
       {
        for (x = 0; x < game->cave->w; x++)
        {
-         game->last_element_buffer[y][x] = game->element_buffer[y][x];
+         game->last_drawing_buffer[y][x] = game->drawing_buffer[y][x];
          game->dir_buffer_from[y][x] = GD_MV_STILL;
          game->dir_buffer_to[y][x]   = GD_MV_STILL;
        }
@@ -595,8 +595,8 @@ static GdGameState gd_game_main_int(GdGame *game, boolean allow_iterate, boolean
 
   // always render the cave to the gfx buffer;
   // however it may do nothing if animcycle was not changed.
-  if (game->element_buffer && game->gfx_buffer)
-    gd_drawcave_game(game->cave, game->element_buffer, game->last_element_buffer, game->gfx_buffer,
+  if (game->drawing_buffer && game->gfx_buffer)
+    gd_drawcave_game(game->cave, game->drawing_buffer, game->last_drawing_buffer, game->gfx_buffer,
                     game->bonus_life_flash != 0, game->animcycle, setup.bd_show_invisible_outbox);
 
   game->state_counter = counter_next;
@@ -650,7 +650,7 @@ void play_game_func(GdGame *game, int action)
   // if drawcave was before scrolling, it would draw, scroll would invalidate,
   // and then it should be drawn again
   // only do the drawing if the cave already exists.
-  if (game->cave && game->element_buffer && game->gfx_buffer)
+  if (game->cave && game->drawing_buffer && game->gfx_buffer)
   {
     // if fine scrolling, scroll at 50hz. if not, only scroll at every second call, so 25hz.
     // do the scrolling. scroll exactly, if player is not yet alive
index 2ea5d8c4bfc1929f6cf9c0c3151a98211d5fc470..1378f0ef22388bde9a5b740d7d60d9e0d19bca50 100644 (file)
@@ -75,8 +75,8 @@ typedef struct _gd_game
   int bonus_life_flash;         // different kind of flashing, for bonus life
 
   int state_counter;            // counter used to control the game flow, rendering of caves
-  int **element_buffer;
-  int **last_element_buffer;
+  int **drawing_buffer;
+  int **last_drawing_buffer;
   int **dir_buffer_from;
   int **dir_buffer_to;
   int **gfx_buffer;             // contains the indexes to the cells;
index fa139d0cec13b52f0f886f4165a9fe43df98b268..881a67886baa6616191ee2c2b45480fed5a18de5 100644 (file)
@@ -602,8 +602,8 @@ static void gd_drawcave_tile(Bitmap *dest, GdGame *game, int x, int y, boolean d
   int sy = y * cell_size - scroll_y;
   int dir_from = game->dir_buffer_from[y][x];
   int dir_to = game->dir_buffer_to[y][x];
-  int tile = game->element_buffer[y][x];
-  int tile_last = game->last_element_buffer[y][x];
+  int tile = game->drawing_buffer[y][x];
+  int tile_last = game->last_drawing_buffer[y][x];
   int tile_from = O_NONE;      // source element if element is moving (will be set later)
   int tile_to = tile;          // target element if element is moving
   int frame = game->animcycle;
@@ -620,7 +620,7 @@ static void gd_drawcave_tile(Bitmap *dest, GdGame *game, int x, int y, boolean d
     int new_x = cave->getx(cave, x + dx, y + dy);
     int new_y = cave->gety(cave, x + dx, y + dy);
 
-    tile_from = game->element_buffer[new_y][new_x];
+    tile_from = game->drawing_buffer[new_y][new_x];
 
     // handle special case of player running into enemy/explosion from top or left side
     if ((el_growing(tile_from) || el_explosion(tile_from)) && el_player(tile_last))
index 7778b066a4a8e37265111872ad1f0376d2283f5f..ea288cd840de62fe70b2fbc5312e774727718228 100644 (file)
@@ -81,8 +81,8 @@ struct EngineSnapshotInfo_BD
   GdGame game;
 
   // data from pointers in game structure
-  int element_buffer[MAX_PLAYFIELD_WIDTH][MAX_PLAYFIELD_HEIGHT];
-  int last_element_buffer[MAX_PLAYFIELD_WIDTH][MAX_PLAYFIELD_HEIGHT];
+  int drawing_buffer[MAX_PLAYFIELD_WIDTH][MAX_PLAYFIELD_HEIGHT];
+  int last_drawing_buffer[MAX_PLAYFIELD_WIDTH][MAX_PLAYFIELD_HEIGHT];
   int dir_buffer_from[MAX_PLAYFIELD_WIDTH][MAX_PLAYFIELD_HEIGHT];
   int dir_buffer_to[MAX_PLAYFIELD_WIDTH][MAX_PLAYFIELD_HEIGHT];
   int gfx_buffer[MAX_PLAYFIELD_WIDTH][MAX_PLAYFIELD_HEIGHT];
index 4404d0ab06d3765ffd1afb71ae93d1f3cdc04c36..4e0396fc80acdf0b361b50c23f8074d235a78559 100644 (file)
@@ -572,8 +572,8 @@ void SaveEngineSnapshotValues_BD(void)
   {
     for (x = 0; x < cave->w; x++)
     {
-      engine_snapshot_bd.element_buffer[x][y]      = game->element_buffer[y][x];
-      engine_snapshot_bd.last_element_buffer[x][y] = game->last_element_buffer[y][x];
+      engine_snapshot_bd.drawing_buffer[x][y]      = game->drawing_buffer[y][x];
+      engine_snapshot_bd.last_drawing_buffer[x][y] = game->last_drawing_buffer[y][x];
       engine_snapshot_bd.dir_buffer_from[x][y]     = game->dir_buffer_from[y][x];
       engine_snapshot_bd.dir_buffer_to[x][y]       = game->dir_buffer_to[y][x];
       engine_snapshot_bd.gfx_buffer[x][y]          = game->gfx_buffer[y][x];
@@ -604,8 +604,8 @@ void LoadEngineSnapshotValues_BD(void)
   engine_snapshot_bd.game.cave                = game->cave;
   engine_snapshot_bd.game.original_cave       = game->original_cave;
 
-  engine_snapshot_bd.game.element_buffer      = game->element_buffer;
-  engine_snapshot_bd.game.last_element_buffer = game->last_element_buffer;
+  engine_snapshot_bd.game.drawing_buffer      = game->drawing_buffer;
+  engine_snapshot_bd.game.last_drawing_buffer = game->last_drawing_buffer;
   engine_snapshot_bd.game.dir_buffer_from     = game->dir_buffer_from;
   engine_snapshot_bd.game.dir_buffer_to       = game->dir_buffer_to;
   engine_snapshot_bd.game.gfx_buffer          = game->gfx_buffer;
@@ -616,8 +616,8 @@ void LoadEngineSnapshotValues_BD(void)
   {
     for (x = 0; x < cave->w; x++)
     {
-      game->element_buffer[y][x]      = engine_snapshot_bd.element_buffer[x][y];
-      game->last_element_buffer[y][x] = engine_snapshot_bd.last_element_buffer[x][y];
+      game->drawing_buffer[y][x]      = engine_snapshot_bd.drawing_buffer[x][y];
+      game->last_drawing_buffer[y][x] = engine_snapshot_bd.last_drawing_buffer[x][y];
       game->dir_buffer_from[y][x]     = engine_snapshot_bd.dir_buffer_from[x][y];
       game->dir_buffer_to[y][x]       = engine_snapshot_bd.dir_buffer_to[x][y];
       game->gfx_buffer[y][x]          = engine_snapshot_bd.gfx_buffer[x][y];