aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorElias Fleckenstein <eliasfleckenstein@web.de>2021-06-09 18:07:27 +0200
committerElias Fleckenstein <eliasfleckenstein@web.de>2021-06-09 18:07:27 +0200
commitb956b3dea0cbc513221a5d640f24793783269411 (patch)
treec0a009b91a85689fc879dc0c9f3791ca54f86f5b
parent741f8c8b7d743e73ae3cb6e01e98c48ebd310275 (diff)
downloaddungeon_game-b956b3dea0cbc513221a5d640f24793783269411.tar.xz
Hide color-indepenent entities at a light level <= 0.0
-rw-r--r--plugins/game/game.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/plugins/game/game.c b/plugins/game/game.c
index c77a53c..c6ca4f8 100644
--- a/plugins/game/game.c
+++ b/plugins/game/game.c
@@ -267,10 +267,11 @@ void mix_color(struct color *color, struct color other, double ratio)
color->b = (color->b + other.b * ratio) / ratio_total;
}
-void render_color(struct color color, double light, bool bg)
+static bool render_color(struct color color, double light, bool bg)
{
if (light <= 0.0) {
set_color(black, bg);
+ return false;
} else {
if (damage_overlay > 0.0)
mix_color(&color, get_color("#F20000"), damage_overlay * 2.0);
@@ -278,6 +279,7 @@ void render_color(struct color color, double light, bool bg)
light_color(&color, light);
set_color(color, bg);
+ return true;
}
}
@@ -319,12 +321,10 @@ static void render(render_entity_list entity_list)
struct entity *entity = entity_list[x + LIGHT][y + LIGHT];
- if (entity) {
- render_color(entity->color, light, false);
+ if (entity && render_color(entity->color, light, false))
printf("%s", entity->texture);
- } else {
+ else
printf(" ");
- }
}
set_color(black, true);