From 44b8ddd534b959221831369c7c834e03cd38d5cc Mon Sep 17 00:00:00 2001 From: Holger Schemel Date: Thu, 22 Aug 2024 19:28:28 +0200 Subject: [PATCH] added functions for scanned/non-scanned BD elements (not used yet) --- src/game_bd/bd_caveengine.c | 24 ++++++++++++++++++++++++ src/game_bd/bd_caveengine.h | 3 +++ 2 files changed, 27 insertions(+) diff --git a/src/game_bd/bd_caveengine.c b/src/game_bd/bd_caveengine.c index 1b743c5a..6ec87a39 100644 --- a/src/game_bd/bd_caveengine.c +++ b/src/game_bd/bd_caveengine.c @@ -516,6 +516,30 @@ static inline boolean moved_by_conveyor_bottom_dir(const GdCave *cave, const int return (gd_element_properties[get_dir(cave, x, y, dir) & O_MASK].properties & P_MOVED_BY_CONVEYOR_BOTTOM) != 0; } +// returns true, if the given element is scanned +boolean is_scanned_element(GdElement e) +{ + return (gd_element_properties[e].properties & P_SCANNED) != 0; +} + +// This function converts an element to its scanned pair. +GdElement scanned_pair(GdElement of_what) +{ + if (gd_element_properties[of_what].properties & P_SCANNED) // already scanned? + return of_what; + + return gd_element_properties[of_what].pair; +} + +// This function converts an element to its non-scanned pair. +GdElement non_scanned_pair(GdElement of_what) +{ + if (!(gd_element_properties[of_what].properties & P_SCANNED)) // already non-scanned? + return of_what; + + return gd_element_properties[of_what].pair; +} + static inline boolean is_scanned_dir(const GdCave *cave, const int x, const int y, const GdDirection dir) { diff --git a/src/game_bd/bd_caveengine.h b/src/game_bd/bd_caveengine.h index b4c44f5b..073b8531 100644 --- a/src/game_bd/bd_caveengine.h +++ b/src/game_bd/bd_caveengine.h @@ -21,6 +21,9 @@ // the game itself +boolean is_scanned_element(GdElement e); +GdElement scanned_pair(GdElement of_what); +GdElement non_scanned_pair(GdElement of_what); boolean is_player(const GdCave *cave, const int x, const int y); boolean can_be_pushed_dir(const GdCave *cave, const int x, const int y, const GdDirection dir); GdDirection gd_direction_from_keypress(boolean up, boolean down, boolean left, boolean right); -- 2.34.1