summaryrefslogtreecommitdiff
path: root/src/game
diff options
context:
space:
mode:
Diffstat (limited to 'src/game')
-rw-r--r--src/game/assets.cpp7
-rw-r--r--src/game/game.hpp4
-rw-r--r--src/game/units.cpp6
3 files changed, 16 insertions, 1 deletions
diff --git a/src/game/assets.cpp b/src/game/assets.cpp
index f14a060..f0dddbf 100644
--- a/src/game/assets.cpp
+++ b/src/game/assets.cpp
@@ -43,6 +43,13 @@ void load(void)
soldier.fire.load("assets/units/soldier/fire.ogg");
+ soldier.step_stone.load("assets/units/soldier/step_stone_1.ogg");
+ soldier.step_stone.load("assets/units/soldier/step_stone_2.ogg");
+ soldier.step_stone.load("assets/units/soldier/step_stone_3.ogg");
+ soldier.step_stone.load("assets/units/soldier/step_stone_4.ogg");
+ soldier.step_stone.load("assets/units/soldier/step_stone_5.ogg");
+ soldier.step_stone.volume = 0.4f;
+
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);
diff --git a/src/game/game.hpp b/src/game/game.hpp
index 848ba92..bb2ce69 100644
--- a/src/game/game.hpp
+++ b/src/game/game.hpp
@@ -55,7 +55,7 @@ namespace game {
render::oriented_sprite_4M2_t legs_idle, legs_walking;
render::animated_texture_t dead;
- audio::sound_t fire;
+ audio::sound_t fire, step_stone, step_dirt;
} soldier_assets_t;
typedef struct {
@@ -194,6 +194,8 @@ namespace game {
bool blocked;
size_t attempts_left;
float next_attempt;
+
+ v2f_t last_step;
} move;
bool keep_moving(double speed);
diff --git a/src/game/units.cpp b/src/game/units.cpp
index f3d53d7..30cfdd5 100644
--- a/src/game/units.cpp
+++ b/src/game/units.cpp
@@ -171,6 +171,7 @@ bool unit_t::start_moving(v2f_t dst)
move.dst = dst;
move.path.clear();
+ move.last_step = x;
rep.cflags = move.cflags & ~(cmodel.cflags);
rep.bounds = cmodel.bounds;
@@ -454,6 +455,11 @@ void unit_soldier_t::on_think(void)
panic_turn = game->now + 0.3;
}
}
+
+ if (move.moving && (x - move.last_step).len() > 0.5f) {
+ move.last_step = x;
+ assets::soldier.step_stone.play();
+ }
}
void unit_soldier_t::on_death(void)