diff options
-rw-r--r-- | assets/units/soldier/body_aiming_ny_0.png (renamed from assets/units/human/body_aiming_ny_0.png) | bin | 1415 -> 1415 bytes | |||
-rw-r--r-- | assets/units/soldier/body_aiming_ny_1.png (renamed from assets/units/human/body_aiming_ny_1.png) | bin | 1202 -> 1202 bytes | |||
-rw-r--r-- | assets/units/soldier/body_aiming_x_0.png (renamed from assets/units/human/body_aiming_x_0.png) | bin | 2180 -> 2180 bytes | |||
-rw-r--r-- | assets/units/soldier/body_aiming_x_1.png (renamed from assets/units/human/body_aiming_x_1.png) | bin | 2249 -> 2249 bytes | |||
-rw-r--r-- | assets/units/soldier/body_aiming_y_0.png (renamed from assets/units/human/body_aiming_y_0.png) | bin | 1933 -> 1933 bytes | |||
-rw-r--r-- | assets/units/soldier/body_aiming_y_1.png (renamed from assets/units/human/body_aiming_y_1.png) | bin | 1897 -> 1897 bytes | |||
-rw-r--r-- | assets/units/soldier/body_firing_ny_0.png (renamed from assets/units/human/body_firing_ny_0.png) | bin | 1249 -> 1249 bytes | |||
-rw-r--r-- | assets/units/soldier/body_firing_ny_1.png (renamed from assets/units/human/body_firing_ny_1.png) | bin | 1362 -> 1362 bytes | |||
-rw-r--r-- | assets/units/soldier/body_firing_x_0.png (renamed from assets/units/human/body_firing_x_0.png) | bin | 2235 -> 2235 bytes | |||
-rw-r--r-- | assets/units/soldier/body_firing_x_1.png (renamed from assets/units/human/body_firing_x_1.png) | bin | 2460 -> 2460 bytes | |||
-rw-r--r-- | assets/units/soldier/body_firing_y_0.png (renamed from assets/units/human/body_firing_y_0.png) | bin | 2605 -> 2605 bytes | |||
-rw-r--r-- | assets/units/soldier/body_firing_y_1.png (renamed from assets/units/human/body_firing_y_1.png) | bin | 2298 -> 2298 bytes | |||
-rw-r--r-- | assets/units/soldier/body_idle_ny_0.png (renamed from assets/units/human/body_idle_ny_0.png) | bin | 2049 -> 2049 bytes | |||
-rw-r--r-- | assets/units/soldier/body_idle_ny_1.png (renamed from assets/units/human/body_idle_ny_1.png) | bin | 1962 -> 1962 bytes | |||
-rw-r--r-- | assets/units/soldier/body_idle_x_0.png (renamed from assets/units/human/body_idle_x_0.png) | bin | 2861 -> 2861 bytes | |||
-rw-r--r-- | assets/units/soldier/body_idle_x_1.png (renamed from assets/units/human/body_idle_x_1.png) | bin | 2697 -> 2697 bytes | |||
-rw-r--r-- | assets/units/soldier/body_idle_y_0.png (renamed from assets/units/human/body_idle_y_0.png) | bin | 2414 -> 2414 bytes | |||
-rw-r--r-- | assets/units/soldier/body_idle_y_1.png (renamed from assets/units/human/body_idle_y_1.png) | bin | 2544 -> 2544 bytes | |||
-rw-r--r-- | assets/units/soldier/dead_0.png (renamed from assets/units/human/dead_0.png) | bin | 4431 -> 4431 bytes | |||
-rw-r--r-- | assets/units/soldier/head_idle_ny_0.png (renamed from assets/units/human/head_idle_ny_0.png) | bin | 1591 -> 1591 bytes | |||
-rw-r--r-- | assets/units/soldier/head_idle_x_0.png (renamed from assets/units/human/head_idle_x_0.png) | bin | 2045 -> 2045 bytes | |||
-rw-r--r-- | assets/units/soldier/head_idle_y_0.png (renamed from assets/units/human/head_idle_y_0.png) | bin | 1743 -> 1743 bytes | |||
-rw-r--r-- | assets/units/soldier/legs_idle_x_0.png (renamed from assets/units/human/legs_idle_x_0.png) | bin | 793 -> 793 bytes | |||
-rw-r--r-- | assets/units/soldier/legs_idle_x_1.png (renamed from assets/units/human/legs_idle_x_1.png) | bin | 848 -> 848 bytes | |||
-rw-r--r-- | assets/units/soldier/legs_idle_y_0.png (renamed from assets/units/human/legs_idle_y_0.png) | bin | 751 -> 751 bytes | |||
-rw-r--r-- | assets/units/soldier/legs_idle_y_1.png (renamed from assets/units/human/legs_idle_y_1.png) | bin | 655 -> 655 bytes | |||
-rw-r--r-- | assets/units/soldier/legs_walking_x_0.png (renamed from assets/units/human/legs_walking_x_0.png) | bin | 961 -> 961 bytes | |||
-rw-r--r-- | assets/units/soldier/legs_walking_x_1.png (renamed from assets/units/human/legs_walking_x_1.png) | bin | 964 -> 964 bytes | |||
-rw-r--r-- | assets/units/soldier/legs_walking_y_0.png (renamed from assets/units/human/legs_walking_y_0.png) | bin | 502 -> 502 bytes | |||
-rw-r--r-- | assets/units/soldier/legs_walking_y_1.png (renamed from assets/units/human/legs_walking_y_1.png) | bin | 587 -> 587 bytes | |||
-rw-r--r-- | assets/units/spider/dead_0.png (renamed from assets/units/alien/dead_0.png) | bin | 1822 -> 1822 bytes | |||
-rw-r--r-- | assets/units/spider/idle_ny_0.png (renamed from assets/units/alien/idle_ny_0.png) | bin | 1546 -> 1546 bytes | |||
-rw-r--r-- | assets/units/spider/idle_ny_1.png (renamed from assets/units/alien/idle_ny_1.png) | bin | 1505 -> 1505 bytes | |||
-rw-r--r-- | assets/units/spider/idle_x_0.png (renamed from assets/units/alien/idle_x_0.png) | bin | 1775 -> 1775 bytes | |||
-rw-r--r-- | assets/units/spider/idle_x_1.png (renamed from assets/units/alien/idle_x_1.png) | bin | 1562 -> 1562 bytes | |||
-rw-r--r-- | assets/units/spider/idle_y_0.png (renamed from assets/units/alien/idle_y_0.png) | bin | 1590 -> 1590 bytes | |||
-rw-r--r-- | assets/units/spider/idle_y_1.png (renamed from assets/units/alien/idle_y_1.png) | bin | 1555 -> 1555 bytes | |||
-rw-r--r-- | assets/units/spider/walking_ny_0.png (renamed from assets/units/alien/walking_ny_0.png) | bin | 1508 -> 1508 bytes | |||
-rw-r--r-- | assets/units/spider/walking_ny_1.png (renamed from assets/units/alien/walking_ny_1.png) | bin | 1470 -> 1470 bytes | |||
-rw-r--r-- | assets/units/spider/walking_x_0.png (renamed from assets/units/alien/walking_x_0.png) | bin | 1484 -> 1484 bytes | |||
-rw-r--r-- | assets/units/spider/walking_x_1.png (renamed from assets/units/alien/walking_x_1.png) | bin | 1460 -> 1460 bytes | |||
-rw-r--r-- | assets/units/spider/walking_y_0.png (renamed from assets/units/alien/walking_y_0.png) | bin | 1513 -> 1513 bytes | |||
-rw-r--r-- | assets/units/spider/walking_y_1.png (renamed from assets/units/alien/walking_y_1.png) | bin | 1578 -> 1578 bytes | |||
-rw-r--r-- | src/common.hpp | 4 | ||||
-rw-r--r-- | src/game/assets.cpp | 26 | ||||
-rw-r--r-- | src/game/game.cpp | 30 | ||||
-rw-r--r-- | src/game/game.hpp | 27 | ||||
-rw-r--r-- | src/game/units.cpp | 50 | ||||
-rw-r--r-- | src/text.cpp | 18 |
49 files changed, 80 insertions, 75 deletions
diff --git a/assets/units/human/body_aiming_ny_0.png b/assets/units/soldier/body_aiming_ny_0.png Binary files differindex 6fb5791..6fb5791 100644 --- a/assets/units/human/body_aiming_ny_0.png +++ b/assets/units/soldier/body_aiming_ny_0.png diff --git a/assets/units/human/body_aiming_ny_1.png b/assets/units/soldier/body_aiming_ny_1.png Binary files differindex eec667a..eec667a 100644 --- a/assets/units/human/body_aiming_ny_1.png +++ b/assets/units/soldier/body_aiming_ny_1.png diff --git a/assets/units/human/body_aiming_x_0.png b/assets/units/soldier/body_aiming_x_0.png Binary files differindex ff9fab2..ff9fab2 100644 --- a/assets/units/human/body_aiming_x_0.png +++ b/assets/units/soldier/body_aiming_x_0.png diff --git a/assets/units/human/body_aiming_x_1.png b/assets/units/soldier/body_aiming_x_1.png Binary files differindex dcaba13..dcaba13 100644 --- a/assets/units/human/body_aiming_x_1.png +++ b/assets/units/soldier/body_aiming_x_1.png diff --git a/assets/units/human/body_aiming_y_0.png b/assets/units/soldier/body_aiming_y_0.png Binary files differindex 34d6d50..34d6d50 100644 --- a/assets/units/human/body_aiming_y_0.png +++ b/assets/units/soldier/body_aiming_y_0.png diff --git a/assets/units/human/body_aiming_y_1.png b/assets/units/soldier/body_aiming_y_1.png Binary files differindex d0689c1..d0689c1 100644 --- a/assets/units/human/body_aiming_y_1.png +++ b/assets/units/soldier/body_aiming_y_1.png diff --git a/assets/units/human/body_firing_ny_0.png b/assets/units/soldier/body_firing_ny_0.png Binary files differindex 214e5c4..214e5c4 100644 --- a/assets/units/human/body_firing_ny_0.png +++ b/assets/units/soldier/body_firing_ny_0.png diff --git a/assets/units/human/body_firing_ny_1.png b/assets/units/soldier/body_firing_ny_1.png Binary files differindex b0dedae..b0dedae 100644 --- a/assets/units/human/body_firing_ny_1.png +++ b/assets/units/soldier/body_firing_ny_1.png diff --git a/assets/units/human/body_firing_x_0.png b/assets/units/soldier/body_firing_x_0.png Binary files differindex 274bebc..274bebc 100644 --- a/assets/units/human/body_firing_x_0.png +++ b/assets/units/soldier/body_firing_x_0.png diff --git a/assets/units/human/body_firing_x_1.png b/assets/units/soldier/body_firing_x_1.png Binary files differindex 640f37d..640f37d 100644 --- a/assets/units/human/body_firing_x_1.png +++ b/assets/units/soldier/body_firing_x_1.png diff --git a/assets/units/human/body_firing_y_0.png b/assets/units/soldier/body_firing_y_0.png Binary files differindex 20363b0..20363b0 100644 --- a/assets/units/human/body_firing_y_0.png +++ b/assets/units/soldier/body_firing_y_0.png diff --git a/assets/units/human/body_firing_y_1.png b/assets/units/soldier/body_firing_y_1.png Binary files differindex d2ca534..d2ca534 100644 --- a/assets/units/human/body_firing_y_1.png +++ b/assets/units/soldier/body_firing_y_1.png diff --git a/assets/units/human/body_idle_ny_0.png b/assets/units/soldier/body_idle_ny_0.png Binary files differindex a4305fe..a4305fe 100644 --- a/assets/units/human/body_idle_ny_0.png +++ b/assets/units/soldier/body_idle_ny_0.png diff --git a/assets/units/human/body_idle_ny_1.png b/assets/units/soldier/body_idle_ny_1.png Binary files differindex ea99192..ea99192 100644 --- a/assets/units/human/body_idle_ny_1.png +++ b/assets/units/soldier/body_idle_ny_1.png diff --git a/assets/units/human/body_idle_x_0.png b/assets/units/soldier/body_idle_x_0.png Binary files differindex d998a21..d998a21 100644 --- a/assets/units/human/body_idle_x_0.png +++ b/assets/units/soldier/body_idle_x_0.png diff --git a/assets/units/human/body_idle_x_1.png b/assets/units/soldier/body_idle_x_1.png Binary files differindex 03907f0..03907f0 100644 --- a/assets/units/human/body_idle_x_1.png +++ b/assets/units/soldier/body_idle_x_1.png diff --git a/assets/units/human/body_idle_y_0.png b/assets/units/soldier/body_idle_y_0.png Binary files differindex 524ed6a..524ed6a 100644 --- a/assets/units/human/body_idle_y_0.png +++ b/assets/units/soldier/body_idle_y_0.png diff --git a/assets/units/human/body_idle_y_1.png b/assets/units/soldier/body_idle_y_1.png Binary files differindex 6714693..6714693 100644 --- a/assets/units/human/body_idle_y_1.png +++ b/assets/units/soldier/body_idle_y_1.png diff --git a/assets/units/human/dead_0.png b/assets/units/soldier/dead_0.png Binary files differindex a2accf3..a2accf3 100644 --- a/assets/units/human/dead_0.png +++ b/assets/units/soldier/dead_0.png diff --git a/assets/units/human/head_idle_ny_0.png b/assets/units/soldier/head_idle_ny_0.png Binary files differindex d46674a..d46674a 100644 --- a/assets/units/human/head_idle_ny_0.png +++ b/assets/units/soldier/head_idle_ny_0.png diff --git a/assets/units/human/head_idle_x_0.png b/assets/units/soldier/head_idle_x_0.png Binary files differindex 49c8d62..49c8d62 100644 --- a/assets/units/human/head_idle_x_0.png +++ b/assets/units/soldier/head_idle_x_0.png diff --git a/assets/units/human/head_idle_y_0.png b/assets/units/soldier/head_idle_y_0.png Binary files differindex 07f3e11..07f3e11 100644 --- a/assets/units/human/head_idle_y_0.png +++ b/assets/units/soldier/head_idle_y_0.png diff --git a/assets/units/human/legs_idle_x_0.png b/assets/units/soldier/legs_idle_x_0.png Binary files differindex eca9f71..eca9f71 100644 --- a/assets/units/human/legs_idle_x_0.png +++ b/assets/units/soldier/legs_idle_x_0.png diff --git a/assets/units/human/legs_idle_x_1.png b/assets/units/soldier/legs_idle_x_1.png Binary files differindex 4867503..4867503 100644 --- a/assets/units/human/legs_idle_x_1.png +++ b/assets/units/soldier/legs_idle_x_1.png diff --git a/assets/units/human/legs_idle_y_0.png b/assets/units/soldier/legs_idle_y_0.png Binary files differindex 89624f7..89624f7 100644 --- a/assets/units/human/legs_idle_y_0.png +++ b/assets/units/soldier/legs_idle_y_0.png diff --git a/assets/units/human/legs_idle_y_1.png b/assets/units/soldier/legs_idle_y_1.png Binary files differindex 47ec27e..47ec27e 100644 --- a/assets/units/human/legs_idle_y_1.png +++ b/assets/units/soldier/legs_idle_y_1.png diff --git a/assets/units/human/legs_walking_x_0.png b/assets/units/soldier/legs_walking_x_0.png Binary files differindex 680e47d..680e47d 100644 --- a/assets/units/human/legs_walking_x_0.png +++ b/assets/units/soldier/legs_walking_x_0.png diff --git a/assets/units/human/legs_walking_x_1.png b/assets/units/soldier/legs_walking_x_1.png Binary files differindex 694d71b..694d71b 100644 --- a/assets/units/human/legs_walking_x_1.png +++ b/assets/units/soldier/legs_walking_x_1.png diff --git a/assets/units/human/legs_walking_y_0.png b/assets/units/soldier/legs_walking_y_0.png Binary files differindex 9197a87..9197a87 100644 --- a/assets/units/human/legs_walking_y_0.png +++ b/assets/units/soldier/legs_walking_y_0.png diff --git a/assets/units/human/legs_walking_y_1.png b/assets/units/soldier/legs_walking_y_1.png Binary files differindex c4ac188..c4ac188 100644 --- a/assets/units/human/legs_walking_y_1.png +++ b/assets/units/soldier/legs_walking_y_1.png diff --git a/assets/units/alien/dead_0.png b/assets/units/spider/dead_0.png Binary files differindex bde771b..bde771b 100644 --- a/assets/units/alien/dead_0.png +++ b/assets/units/spider/dead_0.png diff --git a/assets/units/alien/idle_ny_0.png b/assets/units/spider/idle_ny_0.png Binary files differindex 20c622e..20c622e 100644 --- a/assets/units/alien/idle_ny_0.png +++ b/assets/units/spider/idle_ny_0.png diff --git a/assets/units/alien/idle_ny_1.png b/assets/units/spider/idle_ny_1.png Binary files differindex 6929178..6929178 100644 --- a/assets/units/alien/idle_ny_1.png +++ b/assets/units/spider/idle_ny_1.png diff --git a/assets/units/alien/idle_x_0.png b/assets/units/spider/idle_x_0.png Binary files differindex 7378357..7378357 100644 --- a/assets/units/alien/idle_x_0.png +++ b/assets/units/spider/idle_x_0.png diff --git a/assets/units/alien/idle_x_1.png b/assets/units/spider/idle_x_1.png Binary files differindex cc94179..cc94179 100644 --- a/assets/units/alien/idle_x_1.png +++ b/assets/units/spider/idle_x_1.png diff --git a/assets/units/alien/idle_y_0.png b/assets/units/spider/idle_y_0.png Binary files differindex 18a6598..18a6598 100644 --- a/assets/units/alien/idle_y_0.png +++ b/assets/units/spider/idle_y_0.png diff --git a/assets/units/alien/idle_y_1.png b/assets/units/spider/idle_y_1.png Binary files differindex 0af362e..0af362e 100644 --- a/assets/units/alien/idle_y_1.png +++ b/assets/units/spider/idle_y_1.png diff --git a/assets/units/alien/walking_ny_0.png b/assets/units/spider/walking_ny_0.png Binary files differindex 3b1a5df..3b1a5df 100644 --- a/assets/units/alien/walking_ny_0.png +++ b/assets/units/spider/walking_ny_0.png diff --git a/assets/units/alien/walking_ny_1.png b/assets/units/spider/walking_ny_1.png Binary files differindex 49b7b50..49b7b50 100644 --- a/assets/units/alien/walking_ny_1.png +++ b/assets/units/spider/walking_ny_1.png diff --git a/assets/units/alien/walking_x_0.png b/assets/units/spider/walking_x_0.png Binary files differindex 3b74409..3b74409 100644 --- a/assets/units/alien/walking_x_0.png +++ b/assets/units/spider/walking_x_0.png diff --git a/assets/units/alien/walking_x_1.png b/assets/units/spider/walking_x_1.png Binary files differindex b0bdf80..b0bdf80 100644 --- a/assets/units/alien/walking_x_1.png +++ b/assets/units/spider/walking_x_1.png diff --git a/assets/units/alien/walking_y_0.png b/assets/units/spider/walking_y_0.png Binary files differindex 8108c3f..8108c3f 100644 --- a/assets/units/alien/walking_y_0.png +++ b/assets/units/spider/walking_y_0.png diff --git a/assets/units/alien/walking_y_1.png b/assets/units/spider/walking_y_1.png Binary files differindex a9cdb8f..a9cdb8f 100644 --- a/assets/units/alien/walking_y_1.png +++ b/assets/units/spider/walking_y_1.png diff --git a/src/common.hpp b/src/common.hpp index 5a9dccc..f18f0b8 100644 --- a/src/common.hpp +++ b/src/common.hpp @@ -358,8 +358,8 @@ namespace text { SAY_BLOCKED, SAY_READY, SAY_MOVING, - UNIT_ALIEN, - UNIT_HUMAN, + UNIT_NAME_SPIDER, + UNIT_NAME_SOLDIER, UNIT_DEATH, UNIT_ATTACK, UNIT_MISS, diff --git a/src/game/assets.cpp b/src/game/assets.cpp index e5fee38..a4a03e5 100644 --- a/src/game/assets.cpp +++ b/src/game/assets.cpp @@ -2,24 +2,24 @@ namespace game::assets { -human_assets_t human; -alien_assets_t alien; +soldier_assets_t soldier; +spider_assets_t spider; fx_assets_t fx; deco_assets_t deco; void load(void) { - human.head_idle.load("assets/units/human/head_idle", 1, 1, 1); - human.body_idle.load("assets/units/human/body_idle", 2, 2, 2); - human.body_aiming.load("assets/units/human/body_aiming", 2, 2, 2); - human.body_firing.load("assets/units/human/body_firing", 2, 2, 2); - human.legs_idle.load("assets/units/human/legs_idle", 2, 2); - human.legs_walking.load("assets/units/human/legs_walking", 2, 2); - human.dead.load("assets/units/human/dead_", 1); - - alien.idle.load("assets/units/alien/idle", 2, 2, 2); - alien.walking.load("assets/units/alien/walking", 2, 2, 2); - alien.dead.load("assets/units/alien/dead_", 1); + soldier.head_idle.load("assets/units/soldier/head_idle", 1, 1, 1); + soldier.body_idle.load("assets/units/soldier/body_idle", 2, 2, 2); + soldier.body_aiming.load("assets/units/soldier/body_aiming", 2, 2, 2); + soldier.body_firing.load("assets/units/soldier/body_firing", 2, 2, 2); + soldier.legs_idle.load("assets/units/soldier/legs_idle", 2, 2); + soldier.legs_walking.load("assets/units/soldier/legs_walking", 2, 2); + soldier.dead.load("assets/units/soldier/dead_", 1); + + spider.idle.load("assets/units/spider/idle", 2, 2, 2); + spider.walking.load("assets/units/spider/walking", 2, 2, 2); + spider.dead.load("assets/units/spider/dead_", 1); fx.blood.load("assets/units/blood_", 4); diff --git a/src/game/game.cpp b/src/game/game.cpp index 35d66ec..51dca09 100644 --- a/src/game/game.cpp +++ b/src/game/game.cpp @@ -63,25 +63,25 @@ void entity_t::sleep(void) void state_t::start(void) { - human_t *human; - alien_t *alien; + unit_soldier_t *soldier; + unit_spider_t *spider; world.generator = worldgen; world.generator_data = (void*)this; - human = new human_t(this); - human->place(&world, v2f_t(0.5, 0.5)); - human = new human_t(this); - human->place(&world, v2f_t(1.5, 0.5)); - human = new human_t(this); - human->place(&world, v2f_t(2.5, 0.5)); + soldier = new unit_soldier_t(this); + soldier->place(&world, v2f_t(0.5, 0.5)); + soldier = new unit_soldier_t(this); + soldier->place(&world, v2f_t(1.5, 0.5)); + soldier = new unit_soldier_t(this); + soldier->place(&world, v2f_t(2.5, 0.5)); - alien = new alien_t(this); - alien->place(&world, v2f_t(15.5, -2.5)); - alien = new alien_t(this); - alien->place(&world, v2f_t(14.5, -2.5)); - alien = new alien_t(this); - alien->place(&world, v2f_t(13.5, -2.5)); + spider = new unit_spider_t(this); + spider->place(&world, v2f_t(15.5, -2.5)); + spider = new unit_spider_t(this); + spider->place(&world, v2f_t(14.5, -2.5)); + spider = new unit_spider_t(this); + spider->place(&world, v2f_t(13.5, -2.5)); } void state_t::stop(void) @@ -103,7 +103,7 @@ void state_t::select(rectf_t x) unit = (unit_t*)ent; - if (unit->type != unit_t::UNIT_HUMAN) + if (!unit->controllable) continue; if (!unit->dead && unit->selected != old_cookie) diff --git a/src/game/game.hpp b/src/game/game.hpp index c17de64..df027ce 100644 --- a/src/game/game.hpp +++ b/src/game/game.hpp @@ -32,12 +32,12 @@ namespace game { render::oriented_sprite_4M_t body_aiming, body_firing; render::oriented_sprite_4M2_t legs_idle, legs_walking; render::animated_texture_t dead; - } human_assets_t; + } soldier_assets_t; typedef struct { render::oriented_sprite_4M_t idle, walking; render::animated_texture_t dead; - } alien_assets_t; + } spider_assets_t; typedef struct { render::animated_texture_t blood; @@ -47,8 +47,8 @@ namespace game { render::animated_texture_t stone, eyething, nest; } deco_assets_t; - extern human_assets_t human; - extern alien_assets_t alien; + extern soldier_assets_t soldier; + extern spider_assets_t spider; extern fx_assets_t fx; extern deco_assets_t deco; @@ -88,8 +88,8 @@ namespace game { size_t selected = 0; typedef enum { - UNIT_HUMAN, - UNIT_ALIEN + UNIT_SOLDIER, + UNIT_SPIDER } type_t; type_t type; @@ -97,6 +97,9 @@ namespace game { unit_t(game::state_t *game_, type_t type_); + bool friendly = false; + bool controllable = false; + struct { bool moving = false; v2f_t dst; @@ -134,13 +137,13 @@ namespace game { }; - class human_t : public unit_t { + class unit_soldier_t : public unit_t { double last_target_time = -INFINITY; v2f_t last_target_x; public: - human_t(game::state_t *game_); - ~human_t(void) {}; + unit_soldier_t(game::state_t *game_); + ~unit_soldier_t(void) {}; void render_to(render::state_t *render); void on_think(void); @@ -149,10 +152,10 @@ namespace game { void on_death(void); }; - class alien_t : public unit_t { + class unit_spider_t : public unit_t { public: - alien_t(game::state_t *game_); - ~alien_t(void) {}; + unit_spider_t(game::state_t *game_); + ~unit_spider_t(void) {}; void render_to(render::state_t *render); void on_think(void); 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); } diff --git a/src/text.cpp b/src/text.cpp index 0959277..3204776 100644 --- a/src/text.cpp +++ b/src/text.cpp @@ -4,7 +4,7 @@ namespace text { language_t language = LANG_ENGLISH; -static const char *human_names[] = { +static const char *soldier_names[] = { "Kowalski", "Jackson", "Carter", "O'Neill", "Hammond", "Mitchell" }; @@ -23,11 +23,11 @@ static std::string get_english(index_t index) case SAY_MOVING: return "On my way."; - case UNIT_ALIEN: - return "Alien"; + case UNIT_NAME_SPIDER: + return "Spider"; - case UNIT_HUMAN: - return human_names[rand() % count(human_names)]; + case UNIT_NAME_SOLDIER: + return soldier_names[rand() % count(soldier_names)]; case UNIT_DEATH: return "died"; @@ -67,11 +67,11 @@ static std::string get_polish(index_t index) case SAY_MOVING: return "Jestem w drodze."; - case UNIT_ALIEN: - return "Obcy"; + case UNIT_NAME_SPIDER: + return "Pająk"; - case UNIT_HUMAN: - return human_names[rand() % count(human_names)]; + case UNIT_NAME_SOLDIER: + return soldier_names[rand() % count(soldier_names)]; case UNIT_DEATH: return "nie żyje"; |