From 12143c33141a9c35e8eb01609062655f560b4bc1 Mon Sep 17 00:00:00 2001 From: Paweł Redman Date: Thu, 14 Dec 2017 12:43:17 +0100 Subject: Get rid of all the time parameters in game. --- src/game/game.hpp | 41 +++++++++++++++++++++-------------------- 1 file changed, 21 insertions(+), 20 deletions(-) (limited to 'src/game/game.hpp') diff --git a/src/game/game.hpp b/src/game/game.hpp index f6687dc..107bfbf 100644 --- a/src/game/game.hpp +++ b/src/game/game.hpp @@ -41,6 +41,7 @@ namespace game { class unit_t : public world::entity_t { protected: + game::state_t *game; world::world_t *world; world::cmodel_t make_cmodel(v2f_t at); @@ -59,9 +60,9 @@ namespace game { type_t type; - unit_t(type_t type_); + unit_t(game::state_t *game_, type_t type_); - virtual void think(double now, double dt) = 0; + virtual void think(void) = 0; struct { bool moving = false; @@ -76,23 +77,23 @@ namespace game { } move; void place(world::world_t *world_, v2f_t x_); - bool keep_moving(double now, double dt, double speed); - bool start_moving(v2f_t dst_, double now); + bool keep_moving(double speed); + bool start_moving(v2f_t dst); bool awake = false; double wake_time = -INFINITY; - virtual void wake(double now, unit_t *by_whom) = 0; - virtual void sleep(double now) = 0; + virtual void wake(unit_t *by_whom) = 0; + virtual void sleep(void) = 0; bool dead = false; double death_time = -INFINITY; int health = 1, max_health = 1; - void damage(double now, int points); - virtual void die(double now) = 0; + void damage(int points); + virtual void die() = 0; const wchar_t *say_text; double say_time = -INFINITY; - void say(const wchar_t *wstr, double now); + void say(const wchar_t *wstr); void render_to(render::state_t *render); @@ -100,27 +101,27 @@ namespace game { class human_t : public unit_t { public: - human_t(); + human_t(game::state_t *game); void render_to(render::state_t *render); - void wake(double now, unit_t *by_whom); - void sleep(double now); - void think(double now, double dt); - void die(double now); + void wake(unit_t *by_whom); + void sleep(void); + void think(void); + void die(void); }; class alien_t : public unit_t { double next_targetting = -INFINITY; double next_attack = -INFINITY; - void attack(double now, unit_t *target, float range); + void attack(unit_t *target, float range); public: - alien_t(); + alien_t(game::state_t *game); void render_to(render::state_t *render); - void wake(double now, unit_t *by_whom); - void sleep(double now); - void think(double now, double dt); - void die(double now); + void wake(unit_t *by_whom); + void sleep(void); + void think(void); + void die(void); }; }; -- cgit