summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/game/assets.cpp17
-rw-r--r--src/game/game.cpp1
-rw-r--r--src/game/game.hpp19
-rw-r--r--src/game/unit_nest.cpp10
-rw-r--r--src/game/unit_repl.cpp7
-rw-r--r--src/game/unit_soldier.cpp6
-rw-r--r--src/game/unit_spider.cpp9
7 files changed, 55 insertions, 14 deletions
diff --git a/src/game/assets.cpp b/src/game/assets.cpp
index 2009672..59cf89a 100644
--- a/src/game/assets.cpp
+++ b/src/game/assets.cpp
@@ -44,6 +44,9 @@ void load(void)
soldier.fire.load("assets/units/soldier/fire.ogg");
soldier.fire.volume = 4.0f;
+ soldier.pain.load("assets/units/soldier/pain.ogg");
+ soldier.death.load("assets/units/soldier/death1.ogg");
+ soldier.death.load("assets/units/soldier/death2.ogg");
soldier.gib_sound.load("assets/units/soldier/gibbing.ogg");
soldier.step_stone.load("assets/units/soldier/step_stone_1.ogg");
@@ -56,13 +59,27 @@ void load(void)
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);
+ spider.sounds.load("assets/units/spider/sound1.ogg");
+ spider.sounds.load("assets/units/spider/sound2.ogg");
+ spider.sounds.load("assets/units/spider/sound3.ogg");
+ spider.sounds.load("assets/units/spider/sound4.ogg");
+ spider.sounds.load("assets/units/spider/sound5.ogg");
+ spider.sounds.load("assets/units/spider/sound6.ogg");
+ spider.sounds.load("assets/units/spider/sound7.ogg");
+ spider.bite.load("assets/units/spider/bite.ogg");
nest.idle.load("assets/units/nest/idle_", 5);
nest.dead.load("assets/units/nest/dead_", 1);
+ nest.spawn.load("assets/units/nest/spawn.ogg");
+ nest.pain.load("assets/units/nest/pain.ogg");
+ nest.death.load("assets/units/nest/death.ogg");
repl.idle.load("assets/units/repl/idle_", 1);
repl.dead.load("assets/units/repl/dead_", 1);
repl.sound.load("assets/units/repl/sound.ogg");
+ repl.damage.load("assets/units/repl/damage1.ogg");
+ repl.damage.load("assets/units/repl/damage2.ogg");
+ repl.damage.load("assets/units/repl/damage3.ogg");
fx.blood.load("assets/units/blood_", 4);
fx.flash.load("assets/units/flash_", 1);
diff --git a/src/game/game.cpp b/src/game/game.cpp
index 6e8ea78..bf9ec97 100644
--- a/src/game/game.cpp
+++ b/src/game/game.cpp
@@ -417,7 +417,6 @@ void state_t::explosion(v2f_t x)
continue;
damage = pow(1 - trace.frac, 2.0f) * 40.0f;
- printf("frac=%f, damage=%i\n", trace.frac, damage);
unit->damage(damage, nullptr);
}
}
diff --git a/src/game/game.hpp b/src/game/game.hpp
index 6c71736..27faf46 100644
--- a/src/game/game.hpp
+++ b/src/game/game.hpp
@@ -62,21 +62,24 @@ namespace game {
render::oriented_sprite_4M2_t legs_idle, legs_walking;
render::animated_texture_t dead, gibbing;
- audio::sound_t fire, step_stone, step_dirt, gib_sound;
+ audio::sound_t fire, step_stone, step_dirt, pain, death, gib_sound;
} soldier_assets_t;
typedef struct {
render::oriented_sprite_4M_t idle, walking;
render::animated_texture_t dead;
+
+ audio::sound_t sounds, bite;
} spider_assets_t;
typedef struct {
render::animated_texture_t idle, dead;
+ audio::sound_t spawn, pain, death;
} nest_assets_t;
typedef struct {
render::animated_texture_t idle, dead;
- audio::sound_t sound;
+ audio::sound_t sound, damage;
} repl_assets_t;
typedef struct {
@@ -252,7 +255,7 @@ namespace game {
void on_think(void);
void on_spawn(void) {};
void on_wake(void) {};
- void on_damage(unit_t *attacker) {};
+ void on_damage(unit_t *attacker);
void on_death(void);
};
@@ -267,7 +270,7 @@ namespace game {
void on_think(void);
void on_spawn(void) {};
- void on_wake(void) {};
+ void on_wake(void);
void on_damage(unit_t *attacker);
void on_death(void);
};
@@ -284,7 +287,7 @@ namespace game {
void on_think(void);
void on_spawn(void);
void on_wake(void) {};
- void on_damage(unit_t *attacker) {};
+ void on_damage(unit_t *attacker);
void on_death(void);
};
@@ -295,10 +298,10 @@ namespace game {
void render_to(render::state_t *render);
void render_late_to(render::state_t *render) {};
- void on_think(void);
- void on_spawn(void);
+ void on_think(void) {};
+ void on_spawn(void) {};
void on_wake(void) {};
- void on_damage(unit_t *attacker) {};
+ void on_damage(unit_t *attacker);
void on_death(void);
void activate(void);
diff --git a/src/game/unit_nest.cpp b/src/game/unit_nest.cpp
index cae98f5..5890d34 100644
--- a/src/game/unit_nest.cpp
+++ b/src/game/unit_nest.cpp
@@ -68,6 +68,7 @@ void unit_nest_t::on_think(void)
return;
spawn_spider(game, x);
+ assets::nest.spawn.play_3d(x);
next_spawning = game->now + game->prng.next_float() * 10 + 5;
}
@@ -78,10 +79,19 @@ void unit_nest_t::on_spawn(void)
spawn_spider(game, x);
}
+void unit_nest_t::on_damage(unit_t *attacker)
+{
+ if (attacker)
+ hivemind_attack(this, attacker->x);
+
+ assets::nest.pain.play_3d(x);
+}
+
void unit_nest_t::on_death(void)
{
render_layer = render::LAYER_FLAT;
cmodel.cflags = CF_BACKGROUND;
+ assets::nest.death.play_3d(x);
}
void unit_nest_t::render_to(render::state_t *render)
diff --git a/src/game/unit_repl.cpp b/src/game/unit_repl.cpp
index e11d204..11f49ae 100644
--- a/src/game/unit_repl.cpp
+++ b/src/game/unit_repl.cpp
@@ -35,12 +35,9 @@ unit_repl_t::unit_repl_t(game::state_t *game_) : unit_t(game_, UNIT_REPL)
controllable = true;
}
-void unit_repl_t::on_think(void)
-{
-}
-
-void unit_repl_t::on_spawn(void)
+void unit_repl_t::on_damage(unit_t *attacker)
{
+ assets::repl.damage.play_3d(x);
}
void unit_repl_t::on_death(void)
diff --git a/src/game/unit_soldier.cpp b/src/game/unit_soldier.cpp
index e49c25a..f4432bf 100644
--- a/src/game/unit_soldier.cpp
+++ b/src/game/unit_soldier.cpp
@@ -163,11 +163,17 @@ void unit_soldier_t::on_think(void)
}
}
+void unit_soldier_t::on_damage(unit_t *attacker)
+{
+ assets::soldier.pain.play_3d(x);
+}
+
void unit_soldier_t::on_death(void)
{
if (health >= -10) {
render_size[0] = v2f_t(-0.75f, -0.5f);
render_size[1] = v2f_t(+0.75f, +0.5f);
+ assets::soldier.death.play_3d(x);
} else {
assets::soldier.gib_sound.play_3d(x);
}
diff --git a/src/game/unit_spider.cpp b/src/game/unit_spider.cpp
index df9073c..32ae178 100644
--- a/src/game/unit_spider.cpp
+++ b/src/game/unit_spider.cpp
@@ -68,6 +68,12 @@ void unit_spider_t::target_and_attack(void)
last_attack = game->now;
target->damage(15, this);
+ assets::spider.bite.play_3d(x);
+}
+
+void unit_spider_t::on_wake(void)
+{
+ assets::spider.sounds.play_3d(x);
}
void unit_spider_t::on_think(void)
@@ -85,6 +91,8 @@ void unit_spider_t::on_think(void)
void unit_spider_t::on_damage(unit_t *attacker)
{
+ assets::spider.sounds.play_3d(x);
+
if (!attacker)
return;
@@ -101,6 +109,7 @@ void unit_spider_t::on_death(void)
render_layer = render::LAYER_FLAT;
cmodel.cflags = CF_BACKGROUND;
+ assets::spider.sounds.play_3d(x);
}
void unit_spider_t::render_to(render::state_t *render)