From f43f52903f29d010a72183de24ae8f56ab6702bb Mon Sep 17 00:00:00 2001 From: Paweł Redman Date: Sat, 21 Apr 2018 16:45:40 +0200 Subject: Add the scientist. --- src/game/game.hpp | 35 ++++++++++++++++++++++++++++++++++- 1 file changed, 34 insertions(+), 1 deletion(-) (limited to 'src/game/game.hpp') diff --git a/src/game/game.hpp b/src/game/game.hpp index 1cd61aa..908d73b 100644 --- a/src/game/game.hpp +++ b/src/game/game.hpp @@ -19,6 +19,7 @@ along with Minitrem. If not, see . namespace game { enum { + ET_NONE, ET_UNIT, ET_EFFECT, ET_DECO, @@ -70,6 +71,12 @@ namespace game { audio::sound_t fire, step_stone, step_dirt, pain, death; } soldier_assets_t; + typedef struct { + render::oriented_sprite_4M_t body_idle, body_walking; + render::oriented_sprite_4M_t head_idle; + render::animated_texture_t avatar; + } scientist_assets_t; + typedef struct { render::oriented_sprite_4M_t idle, walking; render::animated_texture_t dead; @@ -102,6 +109,7 @@ namespace game { } deco_assets_t; extern soldier_assets_t soldier; + extern scientist_assets_t scientist; extern spider_assets_t spider; extern nest_assets_t nest; extern repl_assets_t repl; @@ -182,6 +190,7 @@ namespace game { typedef enum { UNIT_SOLDIER, + UNIT_SCIENTIST, UNIT_SPIDER, UNIT_NEST, UNIT_REPL @@ -269,6 +278,30 @@ namespace game { void on_death(void); }; + class unit_scientist_t : public unit_t { + public: + std::unique_ptr move_marker; + std::unique_ptr aim_marker; + + sf::Color selection_color; + + void check_area(void); + void shoot(v2f_t from, v2f_t at, int damage); + void fire_shotgun(v2f_t aim); + void target_and_attack(void); + + unit_scientist_t(game::state_t *game_); + ~unit_scientist_t(void) {}; + void render_to(render::state_t *render); + void render_late_to(render::state_t *render); + + void on_think(void); + void on_spawn(void) {}; + void on_wake(void) {}; + void on_damage(unit_t *attacker); + void on_death(void); + }; + class unit_spider_t : public unit_t { public: unit_spider_t(game::state_t *game_); @@ -314,7 +347,7 @@ namespace game { void on_damage(unit_t *attacker); void on_death(void); - void activate(void); + void activate(unit_t::type_t type); }; class effect_t : public game::entity_t { -- cgit