summaryrefslogtreecommitdiff
path: root/src/game/game.hpp
diff options
context:
space:
mode:
authorPaweł Redman <pawel.redman@gmail.com>2017-12-12 22:22:14 +0100
committerPaweł Redman <pawel.redman@gmail.com>2017-12-12 22:22:14 +0100
commit2ea209cd523d9076a257ae9aacc3283930ee8f3b (patch)
treee25bcb0969ea91199c3de30aeb2ec1c1a9fb5399 /src/game/game.hpp
parent18b29beb5fa9c5f4bffbd5b9df17643dd78f6ef2 (diff)
Separate units from game.cpp.
Diffstat (limited to 'src/game/game.hpp')
-rw-r--r--src/game/game.hpp48
1 files changed, 48 insertions, 0 deletions
diff --git a/src/game/game.hpp b/src/game/game.hpp
index 5da6370..fa75da1 100644
--- a/src/game/game.hpp
+++ b/src/game/game.hpp
@@ -2,11 +2,17 @@
namespace game {
enum {
+ ET_UNIT
+ };
+
+ enum {
TILE_NONE,
TILE_DIRT,
TILE_WALL
};
+ extern size_t selection_cookie;
+
void worldgen(world::tile_t *tile, world::tile_index_t x,
procgen::perlin_noise_t *perlin);
@@ -22,4 +28,46 @@ namespace game {
void load(void);
}
+
+ class unit_t : public world::entity_t {
+ protected:
+ world::world_t *world;
+
+ world::cmodel_t make_cmodel(v2f_t at);
+ void compute_bounds();
+
+ public:
+ v2f_t x;
+ rectf_t size, render_size;
+ world::cflags_t cflags;
+ size_t selected = 0;
+
+ unit_t();
+
+ struct {
+ bool moving = false;
+ v2f_t dst;
+ float angle = 0.0f;
+
+ std::list<v2f_t> path;
+
+ bool blocked;
+ size_t attempts_left;
+ float next_attempt;
+ } move;
+
+ const wchar_t *say_text;
+ double say_time = -INFINITY;
+
+ void say(const wchar_t *wstr, double now);
+ void place(world::world_t *world_, v2f_t x_);
+ void keep_moving(double now, double dt);
+ bool start_moving(v2f_t dst_, double now);
+ };
+
+ class human_t : public unit_t {
+ public:
+ human_t();
+ void render_to(render::state_t *render);
+ };
};