From c9a0aff5a9333cf5e0ee55ba5c8551457a3ae13c Mon Sep 17 00:00:00 2001 From: Paweł Redman Date: Mon, 26 Mar 2018 19:27:17 +0200 Subject: WIP --- src/game/units.cpp | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) (limited to 'src/game/units.cpp') diff --git a/src/game/units.cpp b/src/game/units.cpp index edb41ec..5f722aa 100644 --- a/src/game/units.cpp +++ b/src/game/units.cpp @@ -163,6 +163,8 @@ bool unit_t::keep_moving(double speed) bool unit_t::start_moving(v2f_t dst) { world::cmodel_t rep; + ntime_t t0; + bool rv; if (!world) { printf("unit_t::start_moving: entity is not linked\n"); @@ -175,7 +177,10 @@ bool unit_t::start_moving(v2f_t dst) rep.cflags = move.cflags & ~(cmodel.cflags); rep.bounds = cmodel.bounds; - if (!world->find_path(x, move.dst, &rep, this, &move.path)) { + t0 = nclock(); + rv = world->find_path(x, move.dst, &rep, this, &move.path); + game->pathfinder_time += nclock() - t0; + if (!rv) { move.moving = false; return false; } @@ -531,8 +536,8 @@ void unit_soldier_t::render_late_to(render::state_t *render) unit_spider_t::unit_spider_t(game::state_t *game) : unit_t(game, UNIT_SPIDER) { - size[0] = v2f_t(-0.2f, +0.0f); - size[1] = v2f_t(+0.2f, +0.3f); + size[0] = v2f_t(-0.3f, +0.0f); + size[1] = v2f_t(+0.3f, +0.3f); render_size[0] = v2f_t(-0.3f, -0.3f); render_size[1] = v2f_t(+0.3f, +0.3f); cmodel.cflags = CF_BODY_SMALL; @@ -560,7 +565,7 @@ void unit_spider_t::target_and_attack(void) return; start_moving(target->x); - next_targetting = game->now + 0.2; + next_targetting = game->now + 500.0; if (last_attack + 0.5 > game->now) return; @@ -588,7 +593,6 @@ void unit_spider_t::on_think(void) void unit_spider_t::on_wake(void) { - next_targetting = game->now; } void unit_spider_t::on_death(void) -- cgit