From 4fa5f46575e545437ab774c97f9dc88ec304251d Mon Sep 17 00:00:00 2001 From: Paweł Redman Date: Wed, 25 Apr 2018 17:52:18 +0200 Subject: Remake rockets into grenades. --- src/game/game.hpp | 26 +++++++++++++++++++------- 1 file changed, 19 insertions(+), 7 deletions(-) (limited to 'src/game/game.hpp') diff --git a/src/game/game.hpp b/src/game/game.hpp index 31001f7..50f903b 100644 --- a/src/game/game.hpp +++ b/src/game/game.hpp @@ -199,10 +199,12 @@ namespace game { render::oriented_sprite_4M_t body_aiming, body_firing; render::oriented_sprite_4M2_t legs_idle, legs_walking; render::animated_texture_t dead, gibbing; - render::animated_texture_t rocket; render::animated_texture_t avatar; audio::sound_t fire, step_stone, step_dirt, pain, death; + + render::animated_texture_t grenade; + audio::sound_t grenade_bounce; } soldier_assets_t; typedef struct { @@ -301,6 +303,10 @@ namespace game { unit_t *find_target(world::world_t *world, v2f_t x, float r, bool friendly); + typedef struct { + size_t grenades, max_grenades = 0; + } storage_t; + class unit_t : public entity_t { protected: double next_targetting = -INFINITY; @@ -362,6 +368,8 @@ namespace game { bool have_target = false; + storage_t storage; + std::string say_text; double say_time = -INFINITY; void say(std::string str, bool on_interface=true); @@ -383,8 +391,6 @@ namespace game { bool manual_firing = false; v2f_t manual_firing_target; - bool rocket_fired = false; - void check_area(void); void shoot(v2f_t from, v2f_t at, int damage); void fire_shotgun(v2f_t aim); @@ -402,6 +408,8 @@ namespace game { void on_wake(void) {}; void on_damage(unit_t *attacker); void on_death(void); + + void command_throw_grenade(v2f_t at); }; class unit_scientist_t : public unit_t { @@ -638,13 +646,17 @@ namespace game { void damage(int points, unit_t *attacker); }; - class rocket_t : public game::entity_t { + class grenade_t : public game::entity_t { unit_t *shooter; - v2f_t target, v; - std::unique_ptr aim_marker; + v2f_t v; + float z, v_z; + + ntime_t explosion_time; + + void compute_bounds(void); public: - rocket_t(game::state_t *game, v2f_t x_, v2f_t target_, unit_t *shooter_); + grenade_t(game::state_t *game, v2f_t x_, v2f_t target, unit_t *shooter_); void render_to(render::state_t *render); void render_late_to(render::state_t *render) {}; -- cgit