From 84a648723674934ef46e1799404d778474a74aeb Mon Sep 17 00:00:00 2001 From: Paweł Redman Date: Fri, 13 Apr 2018 11:30:01 +0200 Subject: Explosions, better AI and misc refactoring. --- src/game/game.hpp | 36 ++++++++++++++++++++++++++++-------- 1 file changed, 28 insertions(+), 8 deletions(-) (limited to 'src/game/game.hpp') diff --git a/src/game/game.hpp b/src/game/game.hpp index 4773f9c..6c71736 100644 --- a/src/game/game.hpp +++ b/src/game/game.hpp @@ -80,7 +80,8 @@ namespace game { } repl_assets_t; typedef struct { - render::animated_texture_t blood, flash; + render::animated_texture_t blood, flash, explosion; + audio::sound_t explosion_sound; } fx_assets_t; typedef struct { @@ -138,7 +139,6 @@ namespace game { entity_t(game::state_t *game, int type_); virtual ~entity_t(void) = 0; - void destroy(void); void place(world::world_t *world); void place(world::world_t *world, v2f_t x_); @@ -158,6 +158,7 @@ namespace game { class fx_aim_marker_t; unit_t *find_target(world::world_t *world, v2f_t x, float r, bool friendly); + void hivemind_attack(unit_t *source, v2f_t target); class unit_t : public entity_t { protected: @@ -212,7 +213,11 @@ namespace game { void damage(int points, unit_t *attacker); void try_attack(unit_t *target); void die(unit_t *killer); - virtual void on_death() = 0; + + virtual void on_damage(unit_t *attacker) = 0; + virtual void on_death(void) = 0; + + bool have_target = false; std::string say_text; double say_time = -INFINITY; @@ -247,6 +252,7 @@ namespace game { void on_think(void); void on_spawn(void) {}; void on_wake(void) {}; + void on_damage(unit_t *attacker) {}; void on_death(void); }; @@ -261,7 +267,8 @@ namespace game { void on_think(void); void on_spawn(void) {}; - void on_wake(void); + void on_wake(void) {}; + void on_damage(unit_t *attacker); void on_death(void); }; @@ -276,8 +283,9 @@ namespace game { void on_think(void); void on_spawn(void); - void on_death(void); void on_wake(void) {}; + void on_damage(unit_t *attacker) {}; + void on_death(void); }; class unit_repl_t : public unit_t { @@ -289,8 +297,10 @@ namespace game { void on_think(void); void on_spawn(void); - void on_death(void); void on_wake(void) {}; + void on_damage(unit_t *attacker) {}; + void on_death(void); + void activate(void); }; @@ -345,7 +355,7 @@ namespace game { public: fx_move_marker_t(game::state_t *game_, v2f_t x_); - ~fx_move_marker_t(void); + ~fx_move_marker_t(void) {}; void render_to(render::state_t *render); }; @@ -355,7 +365,17 @@ namespace game { public: fx_aim_marker_t(game::state_t *game_, v2f_t x_); - ~fx_aim_marker_t(void); + ~fx_aim_marker_t(void) {}; + + void render_to(render::state_t *render); + }; + + class fx_explosion_t : public effect_t { + v2f_t x; + + public: + fx_explosion_t(game::state_t *game_, v2f_t x_); + ~fx_explosion_t(void) {}; void render_to(render::state_t *render); }; -- cgit