summaryrefslogtreecommitdiff
path: root/src/game/units.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/game/units.cpp')
-rw-r--r--src/game/units.cpp23
1 files changed, 14 insertions, 9 deletions
diff --git a/src/game/units.cpp b/src/game/units.cpp
index 5efab65..672e73f 100644
--- a/src/game/units.cpp
+++ b/src/game/units.cpp
@@ -139,8 +139,10 @@ bool unit_t::keep_moving(double speed)
return rv;
}
-bool unit_t::start_moving(v2f_t dst)
+bool unit_t::start_moving(v2f_t dst, world::cflags_t cflags)
{
+ world::cmodel_t rep;
+
if (!world) {
printf("unit_t::start_moving: entity is not linked\n");
return false;
@@ -149,7 +151,10 @@ bool unit_t::start_moving(v2f_t dst)
move.dst = dst;
move.path.clear();
- if (!world->find_path(x, move.dst, &cmodel, this, &move.path)) {
+ rep.cflags = cflags;
+ rep.bounds = cmodel.bounds;
+
+ if (!world->find_path(x, move.dst, &rep, this, &move.path)) {
move.moving = false;
return false;
}
@@ -166,7 +171,7 @@ void unit_t::damage(int points, unit_t *attacker)
{
health -= points;
if (health < 0) {
- game->interface->print(name + ": " + text::get(text::UNIT_DEATH) + ".");
+ game->interface->print(name + " " + text::get(text::UNIT_DEATH) + ".");
dead = true;
death_time = game->now;
cflags = 0;
@@ -208,7 +213,7 @@ void unit_t::try_attack(unit_t *target)
human_t::human_t(game::state_t *game) : unit_t(game, UNIT_HUMAN)
{
- cflags = CF_HUMAN;
+ cflags = CF_BODY;
health = max_health = 20;
size[0] = v2f_t(-0.4f, -0.4f);
size[1] = v2f_t(+0.4f, +0.4f);
@@ -271,7 +276,7 @@ void human_t::render_to(render::state_t *render)
alien_t::alien_t(game::state_t *game) : unit_t(game, UNIT_ALIEN)
{
- cflags = CF_SOLID;
+ cflags = CF_BODY_SMALL;
health = max_health = 4;
size[0] = v2f_t(-0.2f, -0.2f);
size[1] = v2f_t(+0.2f, +0.2f);
@@ -282,7 +287,7 @@ alien_t::alien_t(game::state_t *game) : unit_t(game, UNIT_ALIEN)
void alien_t::wake(unit_t *by_whom)
{
- start_moving(by_whom->x);
+ start_moving(by_whom->x, CF_SOLID);
next_targetting = game->now + 0.4;
}
@@ -351,10 +356,10 @@ void alien_t::think(void)
if (game->now > next_targetting) {
unit_t *target;
- target = find_target(world, x, 5.0f, UNIT_HUMAN);
+ target = find_target(world, x, 10.0f, UNIT_HUMAN);
if (target) {
- attack(target, 0.75f);
- start_moving(target->x);
+ attack(target, 1.0f);
+ start_moving(target->x, CF_SOLID);
}
next_targetting = game->now + 0.2;