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.cpp50
1 files changed, 26 insertions, 24 deletions
diff --git a/src/game/units.cpp b/src/game/units.cpp
index 8eb11c7..ee6ee9f 100644
--- a/src/game/units.cpp
+++ b/src/game/units.cpp
@@ -153,7 +153,7 @@ void unit_t::damage(int points, unit_t *attacker)
{
fx_blood_t *blood;
- blood = new fx_blood_t(game, x, type == UNIT_ALIEN);
+ blood = new fx_blood_t(game, x, type == UNIT_SPIDER);
blood->place(&game->world);
health -= points;
@@ -237,9 +237,11 @@ static unit_t *find_target(world::world_t *world, v2f_t x, float r,
return nearest;
}
-human_t::human_t(game::state_t *game) : unit_t(game, UNIT_HUMAN)
+unit_soldier_t::unit_soldier_t(game::state_t *game) : unit_t(game, UNIT_SOLDIER)
{
always_awake = true;
+ friendly = true;
+ controllable = true;
cmodel.cflags = CF_BODY;
health = max_health = 20;
@@ -247,14 +249,14 @@ human_t::human_t(game::state_t *game) : unit_t(game, UNIT_HUMAN)
size[1] = v2f_t(+0.4f, +0.4f);
render_size[0] = v2f_t(-0.5f, -1.0f);
render_size[1] = v2f_t(+0.5f, +0.5f);
- name = text::get(text::UNIT_HUMAN);
+ name = text::get(text::UNIT_NAME_SOLDIER);
cs.armor_class = 10;
cs.hit_roll = roll_params_t(20);
cs.damage_roll = roll_params_t(4);
}
-void human_t::on_think(void)
+void unit_soldier_t::on_think(void)
{
if (dead)
return;
@@ -264,7 +266,7 @@ void human_t::on_think(void)
if (game->now > next_targetting) {
unit_t *target;
- target = find_target(world, x, 10.0f, UNIT_ALIEN);
+ target = find_target(world, x, 10.0f, UNIT_SPIDER);
if (target) {
last_target_time = game->now;
last_target_x = target->x;
@@ -293,7 +295,7 @@ void human_t::on_think(void)
say(text::get(text::SAY_BLOCKED));
}
-void human_t::on_death(void)
+void unit_soldier_t::on_death(void)
{
render_size[0] = v2f_t(-0.75f, -0.5f);
render_size[1] = v2f_t(+0.75f, +0.5f);
@@ -302,40 +304,40 @@ void human_t::on_death(void)
place(world, x);
}
-void human_t::render_to(render::state_t *render)
+void unit_soldier_t::render_to(render::state_t *render)
{
if (!dead) {
render::oriented_sprite_t *legs, *body;
float body_angle;
if (move.moving && !move.blocked)
- legs = &assets::human.legs_walking;
+ legs = &assets::soldier.legs_walking;
else
- legs = &assets::human.legs_idle;
+ legs = &assets::soldier.legs_idle;
if (last_target_time + 3 > game->now) {
if (last_attack + 0.1 > game->now)
- body = &assets::human.body_firing;
+ body = &assets::soldier.body_firing;
else
- body = &assets::human.body_aiming;
+ body = &assets::soldier.body_aiming;
body_angle = (last_target_x - x).angle();
} else {
- body = &assets::human.body_idle;
+ body = &assets::soldier.body_idle;
body_angle = move.angle;
}
render->render(game->now * 10, legs, render_bounds, move.angle);
render->render(game->now * 10, body, render_bounds, body_angle);
- render->render(game->now * 10, &assets::human.head_idle, render_bounds, body_angle);
+ render->render(game->now * 10, &assets::soldier.head_idle, render_bounds, body_angle);
} else
- render->render(game->now * 10, &assets::human.dead, render_bounds);
+ render->render(game->now * 10, &assets::soldier.dead, render_bounds);
unit_t::render_to(render);
}
-alien_t::alien_t(game::state_t *game) : unit_t(game, UNIT_ALIEN)
+unit_spider_t::unit_spider_t(game::state_t *game) : unit_t(game, UNIT_SPIDER)
{
cmodel.cflags = CF_BODY_SMALL;
health = max_health = 4;
@@ -343,14 +345,14 @@ alien_t::alien_t(game::state_t *game) : unit_t(game, UNIT_ALIEN)
size[1] = v2f_t(+0.2f, +0.3f);
render_size[0] = v2f_t(-0.3f, -0.3f);
render_size[1] = v2f_t(+0.3f, +0.3f);
- name = text::get(text::UNIT_ALIEN);
+ name = text::get(text::UNIT_NAME_SPIDER);
cs.armor_class = 5;
cs.hit_roll = roll_params_t(20);
cs.damage_roll = roll_params_t(3, 6, 1);
}
-void alien_t::on_think(void)
+void unit_spider_t::on_think(void)
{
if (dead)
return;
@@ -358,7 +360,7 @@ void alien_t::on_think(void)
if (game->now > next_targetting) {
unit_t *target;
- target = find_target(world, x, 10.0f, UNIT_HUMAN);
+ target = find_target(world, x, 10.0f, UNIT_SOLDIER);
if (target) {
if (last_attack + 0.5 < game->now) {
world::trace_t trace;
@@ -381,28 +383,28 @@ void alien_t::on_think(void)
keep_moving(7.0);
}
-void alien_t::on_wake(void)
+void unit_spider_t::on_wake(void)
{
next_targetting = game->now;
}
-void alien_t::on_death(void)
+void unit_spider_t::on_death(void)
{
render_layer = -1;
cmodel.cflags = CF_BACKGROUND;
}
-void alien_t::render_to(render::state_t *render)
+void unit_spider_t::render_to(render::state_t *render)
{
bool moving;
moving = move.moving && !move.blocked;
if (!dead)
- render->render(game->now * 20, (moving ? &assets::alien.walking :
- &assets::alien.idle), render_bounds, move.angle);
+ render->render(game->now * 20, (moving ? &assets::spider.walking :
+ &assets::spider.idle), render_bounds, move.angle);
else
- render->render(game->now * 20, &assets::alien.dead, render_bounds);
+ render->render(game->now * 20, &assets::spider.dead, render_bounds);
unit_t::render_to(render);
}