From 5c4e9d9d723237bbc66d7e575c7d002687295c06 Mon Sep 17 00:00:00 2001 From: Holger Schemel Date: Sun, 14 Apr 2024 20:22:34 +0200 Subject: [PATCH] changed functions to check smooth movements in BD engine --- src/game_bd/bd_graphics.c | 10 +--------- src/game_bd/export_bd.h | 3 +++ src/game_bd/main_bd.c | 13 +++++++++++++ 3 files changed, 17 insertions(+), 9 deletions(-) diff --git a/src/game_bd/bd_graphics.c b/src/game_bd/bd_graphics.c index 635e21f6..302dddbb 100644 --- a/src/game_bd/bd_graphics.c +++ b/src/game_bd/bd_graphics.c @@ -530,12 +530,6 @@ Bitmap *gd_get_tile_bitmap(Bitmap *bitmap) return bitmap; } -// workaround to prevent variable name scope problem -static boolean use_native_bd_graphics_engine(void) -{ - return game.use_native_bd_graphics_engine; -} - // returns true if the element is a player static inline boolean is_player(const int element) { @@ -593,9 +587,7 @@ static void gd_drawcave_tile(Bitmap *dest, GdGame *game, int x, int y, boolean d boolean is_movable = (can_move(tile) || can_fall(tile) || is_pushable(tile) || is_player(tile)); boolean is_movable_or_diggable = (is_movable || is_diggable(game->last_element_buffer[y][x])); boolean is_moving = (is_movable_or_diggable && dir != GD_MV_STILL); - boolean use_smooth_movements = - ((setup.bd_smooth_movements == TRUE) || - (setup.bd_smooth_movements == AUTO && !use_native_bd_graphics_engine())); + boolean use_smooth_movements = use_bd_smooth_movements(); // do not use smooth movement animation for exploding game elements (like player) if (is_explosion(tile) && dir != GD_MV_STILL) diff --git a/src/game_bd/export_bd.h b/src/game_bd/export_bd.h index 688d506e..b7d62467 100644 --- a/src/game_bd/export_bd.h +++ b/src/game_bd/export_bd.h @@ -112,6 +112,9 @@ unsigned int InitEngineRandom_BD(int); void InitGameEngine_BD(void); void GameActions_BD(byte[MAX_PLAYERS]); +boolean use_native_bd_graphics_engine(void); +boolean use_bd_smooth_movements(void); + Bitmap **GetTitleScreenBitmaps_BD(void); void CoverScreen_BD(void); diff --git a/src/game_bd/main_bd.c b/src/game_bd/main_bd.c index f6d60f6e..c734d5ea 100644 --- a/src/game_bd/main_bd.c +++ b/src/game_bd/main_bd.c @@ -433,6 +433,19 @@ void GameActions_BD(byte action[MAX_PLAYERS]) // graphics functions // ============================================================================ +// check if native BD graphics engine requested in custom graphics configuration +boolean use_native_bd_graphics_engine(void) +{ + return game.use_native_bd_graphics_engine; +} + +// check if smooth game element movements selected in setup menu +boolean use_bd_smooth_movements(void) +{ + return ((setup.bd_smooth_movements == TRUE) || + (setup.bd_smooth_movements == AUTO && !use_native_bd_graphics_engine())); +} + Bitmap **GetTitleScreenBitmaps_BD(void) { Bitmap **title_screen_bitmaps = gd_get_title_screen_bitmaps(); -- 2.34.1