summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/common.hpp2
-rw-r--r--src/game/effects.cpp13
-rw-r--r--src/render.cpp6
3 files changed, 14 insertions, 7 deletions
diff --git a/src/common.hpp b/src/common.hpp
index 34c7b60..b88434e 100644
--- a/src/common.hpp
+++ b/src/common.hpp
@@ -318,7 +318,7 @@ namespace render {
void end_frame(void);
void render(game::state_t *game);
- void render(double phase, animated_texture_t *anim, rectf_t bounds, bool mirror = false);
+ void render(double phase, animated_texture_t *anim, rectf_t bounds, sf::Color color = sf::Color::White, bool mirror = false);
void render(double phase, oriented_sprite_t *sprite, rectf_t bounds, float angle);
void render_text(v2f_t x, float height, std::string str, text_align_t align, sf::Color color);
diff --git a/src/game/effects.cpp b/src/game/effects.cpp
index 306405f..d9215e3 100644
--- a/src/game/effects.cpp
+++ b/src/game/effects.cpp
@@ -38,7 +38,7 @@ void fx_tracer_t::render_to(render::state_t *render)
fx_blood_t::fx_blood_t(state_t *game_, v2f_t x_, bool alien_) : effect_t(game_)
{
- ttl = game->now + 1.0f;
+ ttl = game->now + 0.3f;
x = x_;
alien = alien_;
@@ -52,9 +52,16 @@ fx_blood_t::fx_blood_t(state_t *game_, v2f_t x_, bool alien_) : effect_t(game_)
void fx_blood_t::render_to(render::state_t *render)
{
double phase;
+ sf::Color color;
- phase = (game->now - ttl) + 1;
- render->render(phase, &assets::fx.blood, render_bounds);
+ phase = (game->now - ttl) / 0.3 + 1;
+
+ if (alien)
+ color = sf::Color::Green;
+ else
+ color = sf::Color::Red;
+
+ render->render(phase, &assets::fx.blood, render_bounds, color);
}
} // namespace game
diff --git a/src/render.cpp b/src/render.cpp
index 0e04aab..792d70d 100644
--- a/src/render.cpp
+++ b/src/render.cpp
@@ -144,7 +144,7 @@ void state_t::render(game::state_t *game)
}
}
-void state_t::render(double phase, animated_texture_t *anim, rectf_t bounds, bool mirror){
+void state_t::render(double phase, animated_texture_t *anim, rectf_t bounds, sf::Color color, bool mirror){
size_t frame;
if (!anim)
@@ -156,7 +156,7 @@ void state_t::render(double phase, animated_texture_t *anim, rectf_t bounds, boo
frame = floor(fmod(phase, 1.0) * anim->frame_count);
wot_rect.setTexture(anim->frames + frame, true);
- wot_rect.setFillColor(sf::Color::White);
+ wot_rect.setFillColor(color);
if (!mirror) {
wot_rect.setPosition(bounds[0]);
@@ -179,7 +179,7 @@ void state_t::render(double phase, oriented_sprite_t *sprite, rectf_t bounds, fl
bool mirror;
index = sprite->select_index(angle, &mirror);
- render(phase, sprite->textures + index, bounds, mirror);
+ render(phase, sprite->textures + index, bounds, sf::Color::White, mirror);
}
void state_t::render_text(v2f_t x, float height, std::string str,