projects
/
rocksndiamonds.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
renamed another preprocessor constant
[rocksndiamonds.git]
/
src
/
game_bd
/
bd_caveengine.c
diff --git
a/src/game_bd/bd_caveengine.c
b/src/game_bd/bd_caveengine.c
index e221ca7784551455c8e7e5d376129f8c31dac05b..2793d26f2f93c968e7b4d4d83ff2df997abac611 100644
(file)
--- a/
src/game_bd/bd_caveengine.c
+++ b/
src/game_bd/bd_caveengine.c
@@
-126,9
+126,19
@@
void gd_cave_set_seconds_sound(GdCave *cave)
}
}
}
}
+// returns true if the element can fall
+static inline boolean el_can_fall(const int element)
+{
+ return (gd_elements[element & O_MASK].properties & P_CAN_FALL) != 0;
+}
+
// play diamond or stone sound of given element.
static void play_sound_of_element(GdCave *cave, GdElement element, int x, int y)
{
// play diamond or stone sound of given element.
static void play_sound_of_element(GdCave *cave, GdElement element, int x, int y)
{
+ // check if sound should be skipped for falling elements (and only be played on impact)
+ if (el_can_fall(element) && skip_bd_falling_sounds())
+ return;
+
// stone and diamond fall sounds.
switch (element)
{
// stone and diamond fall sounds.
switch (element)
{
@@
-449,7
+459,7
@@
static inline boolean rotates_ccw (const GdCave *cave, const int x, const int y)
}
// returns true if the element is a player
}
// returns true if the element is a player
-
static inline
boolean is_player(const GdCave *cave, const int x, const int y)
+boolean is_player(const GdCave *cave, const int x, const int y)
{
return (gd_elements[get(cave, x, y) & O_MASK].properties & P_PLAYER) != 0;
}
{
return (gd_elements[get(cave, x, y) & O_MASK].properties & P_PLAYER) != 0;
}
@@
-467,6
+477,13
@@
static inline boolean can_be_hammered_dir(const GdCave *cave, const int x, const
return (gd_elements[get_dir(cave, x, y, dir) & O_MASK].properties & P_CAN_BE_HAMMERED) != 0;
}
return (gd_elements[get_dir(cave, x, y, dir) & O_MASK].properties & P_CAN_BE_HAMMERED) != 0;
}
+// returns true if the element can be pushed
+boolean can_be_pushed_dir(const GdCave *cave, const int x, const int y,
+ const GdDirection dir)
+{
+ return (gd_elements[get_dir(cave, x, y, dir) & O_MASK].properties & P_PUSHABLE) != 0;
+}
+
// returns true if the element is explodable and explodes to space, for example the player
static inline boolean is_first_stage_of_explosion(const GdCave *cave, const int x, const int y)
{
// returns true if the element is explodable and explodes to space, for example the player
static inline boolean is_first_stage_of_explosion(const GdCave *cave, const int x, const int y)
{