summaryrefslogtreecommitdiff
path: root/src/game/game.hpp
diff options
context:
space:
mode:
authorPaweł Redman <pawel.redman@gmail.com>2018-04-25 17:52:18 +0200
committerPaweł Redman <pawel.redman@gmail.com>2018-04-25 17:52:18 +0200
commit4fa5f46575e545437ab774c97f9dc88ec304251d (patch)
treefe18d39cd490bb788f787b08dfcf00f93a1c24e5 /src/game/game.hpp
parent273abc7c37e9bcdb7cf8d092ed356de01b906146 (diff)
Remake rockets into grenades.
Diffstat (limited to 'src/game/game.hpp')
-rw-r--r--src/game/game.hpp26
1 files changed, 19 insertions, 7 deletions
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<fx_aim_marker_t> 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) {};