From: Holger Schemel Date: Thu, 22 Aug 2024 17:28:28 +0000 (+0200) Subject: added functions for scanned/non-scanned BD elements (not used yet) X-Git-Tag: 4.4.0.0-test-4~300 X-Git-Url: https://git.artsoft.org/?a=commitdiff_plain;h=44b8ddd534b959221831369c7c834e03cd38d5cc;p=rocksndiamonds.git added functions for scanned/non-scanned BD elements (not used yet) --- 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);