diff options
author | Paweł Redman <pawel.redman@gmail.com> | 2018-04-20 12:35:21 +0200 |
---|---|---|
committer | Paweł Redman <pawel.redman@gmail.com> | 2018-04-20 12:35:21 +0200 |
commit | f4fe2c7f10a8d2e253de27f1a540ca68184d5d29 (patch) | |
tree | 4916ce9f704aa2df7a71b6186c08fea2543090fe /src/game/units.cpp | |
parent | fade55e67e1a6944461c16c1495dea9546243756 (diff) |
Pseudo 3D firing and misc. fixes.
Diffstat (limited to 'src/game/units.cpp')
-rw-r--r-- | src/game/units.cpp | 28 |
1 files changed, 6 insertions, 22 deletions
diff --git a/src/game/units.cpp b/src/game/units.cpp index 968e93e..20e74a7 100644 --- a/src/game/units.cpp +++ b/src/game/units.cpp @@ -110,11 +110,7 @@ bool unit_t::keep_moving(double speed) if (!move.moving) return true; - if (move.blocked && game->now < move.next_attempt) - return true; - time = game->dt * speed; - move.blocked = true; while (time > 0.0f) { v2f_t delta, next, x_new; @@ -142,25 +138,17 @@ bool unit_t::keep_moving(double speed) test_cmodel.bounds = size + x_new; test_cmodel.cflags = move.cflags; - if (!world->test_rect(&test_cmodel, this)) { - x = x_new; - cmodel.bounds = test_cmodel.bounds; - move.blocked = false; - continue; + if (world->test_rect(&test_cmodel, this)) { + rv = false; + break; } - if (move.attempts_left) { - move.attempts_left--; - move.next_attempt = game->now + 0.2f; - } else { - if ((x - move.dst).len() > 1.5f) - rv = false; - move.moving = false; - } - break; + x = x_new; + cmodel.bounds = test_cmodel.bounds; } place(world, x); + move.blocked = !rv; return rv; } @@ -186,10 +174,6 @@ bool unit_t::start_moving(v2f_t dst) } move.moving = true; - - move.blocked = false; - move.attempts_left = 10; - move.next_attempt = -INFINITY; return true; } |