#include "../common.hpp" 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); namespace assets { typedef struct { render::oriented_sprite_4M_t head_idle, body_idle; render::oriented_sprite_4M2_t legs_idle, legs_walking; } human_assets_t; extern human_assets_t human; extern sf::Texture tile_dirt; extern sf::Texture tile_wall; 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 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); }; };