projects
/
rocksndiamonds.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
added single step support for BD engine
[rocksndiamonds.git]
/
src
/
game_bd
/
bd_graphics.c
diff --git
a/src/game_bd/bd_graphics.c
b/src/game_bd/bd_graphics.c
index 4687ebfbe7e7d9f5aaedf26c25a25f080e67c80c..5da166f2f5bed8aaf28db0990fa03b181acf4782 100644
(file)
--- a/
src/game_bd/bd_graphics.c
+++ b/
src/game_bd/bd_graphics.c
@@
-543,6
+543,12
@@
static inline boolean el_player(const int element)
return (gd_elements[element & O_MASK].properties & P_PLAYER) != 0;
}
return (gd_elements[element & O_MASK].properties & P_PLAYER) != 0;
}
+// returns true if the element is walkable
+static inline boolean el_walkable(const int element)
+{
+ return (gd_elements[element & O_MASK].properties & P_WALKABLE) != 0;
+}
+
// returns true if the element is diggable
static inline boolean el_diggable(const int element)
{
// returns true if the element is diggable
static inline boolean el_diggable(const int element)
{
@@
-690,6
+696,7
@@
static void gd_drawcave_tile(Bitmap *dest, GdGame *game, int x, int y, boolean d
int old_x = cave->getx(cave, x + dx, y + dy);
int old_y = cave->gety(cave, x + dx, y + dy);
int tile_from = game->element_buffer[old_y][old_x] & ~SKIPPED; // should never be skipped
int old_x = cave->getx(cave, x + dx, y + dy);
int old_y = cave->gety(cave, x + dx, y + dy);
int tile_from = game->element_buffer[old_y][old_x] & ~SKIPPED; // should never be skipped
+ int tile_last = game->last_element_buffer[y][x] & ~SKIPPED;
struct GraphicInfo_BD *g_from = &graphic_info_bd_object[tile_from][frame];
Bitmap *tile_bitmap_from = gd_get_tile_bitmap(g_from->bitmap);
boolean old_is_player = el_player(tile_from);
struct GraphicInfo_BD *g_from = &graphic_info_bd_object[tile_from][frame];
Bitmap *tile_bitmap_from = gd_get_tile_bitmap(g_from->bitmap);
boolean old_is_player = el_player(tile_from);
@@
-726,6
+733,11
@@
static void gd_drawcave_tile(Bitmap *dest, GdGame *game, int x, int y, boolean d
int itercycle = MIN(MAX(0, game->itermax - game->itercycle - 1), game->itermax);
int shift = cell_size * itercycle / game->itermax;
int itercycle = MIN(MAX(0, game->itermax - game->itercycle - 1), game->itermax);
int shift = cell_size * itercycle / game->itermax;
+ // when drawing player over walkable elements, always use masked drawing
+ // (does not use masking if moving from walkable to diggable tiles etc.)
+ if (el_player(tile) && el_walkable(tile_from) && el_walkable(tile_last))
+ blit_bitmap = BlitBitmapMasked;
+
blit_bitmap(tile_bitmap, dest, g->src_x, g->src_y, cell_size, cell_size,
sx + dx * shift, sy + dy * shift);
blit_bitmap(tile_bitmap, dest, g->src_x, g->src_y, cell_size, cell_size,
sx + dx * shift, sy + dy * shift);