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;
// 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;
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;
#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
// 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)
{
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)
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);
{
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;
}
// 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;
// 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
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;
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;
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))
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];
{
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];
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;
{
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];