summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--data/sounds/roar_enraged.wavbin0 -> 50906 bytes
-rw-r--r--include/asset_defs.h1
-rw-r--r--include/audio.h1
-rw-r--r--issues2
-rw-r--r--src/asset_defs.c1
-rw-r--r--src/audio.c10
-rw-r--r--src/zombies.c2
7 files changed, 15 insertions, 2 deletions
diff --git a/data/sounds/roar_enraged.wav b/data/sounds/roar_enraged.wav
new file mode 100644
index 0000000..daa324a
--- /dev/null
+++ b/data/sounds/roar_enraged.wav
Binary files differ
diff --git a/include/asset_defs.h b/include/asset_defs.h
index 7f99767..3e8bed2 100644
--- a/include/asset_defs.h
+++ b/include/asset_defs.h
@@ -94,6 +94,7 @@ Mix_Chunk* wav_error;
Mix_Chunk* wav_collect;
Mix_Chunk* wav_character;
+Mix_Chunk* wav_roar_enraged;
Mix_Chunk* wav_round_change;
Mix_Chunk* wav_step;
diff --git a/include/audio.h b/include/audio.h
index 1ab8322..b32148f 100644
--- a/include/audio.h
+++ b/include/audio.h
@@ -26,6 +26,7 @@ typedef enum t_audio_event_type {
EVENT_CHARACTER_TYPE,
EVENT_FOOTSTEP,
EVENT_ZOMBIESCREECH,
+ EVENT_ZOMBIEROAR,
} audio_event_type;
typedef struct t_audio_event {
diff --git a/issues b/issues
index 9c01fed..f7f507e 100644
--- a/issues
+++ b/issues
@@ -1,3 +1,3 @@
-- client ping is wrong
+- client ping is wrong (platform_get_time is not universal)
- client cant purchase
- client crash allocator out of space \ No newline at end of file
diff --git a/src/asset_defs.c b/src/asset_defs.c
index 7d7e947..95e709c 100644
--- a/src/asset_defs.c
+++ b/src/asset_defs.c
@@ -94,6 +94,7 @@ void load_assets() {
wav_round_change = Mix_LoadWAV("data/sounds/round_change.wav");
wav_character = Mix_LoadWAV("data/sounds/character.wav");
wav_step = Mix_LoadWAV("data/sounds/step.wav");
+ wav_roar_enraged = Mix_LoadWAV("data/sounds/roar_enraged.wav");
for (int i = 1; i <= NUM_SCREECHES; i++) {
char path[100];
diff --git a/src/audio.c b/src/audio.c
index ab81906..c97319b 100644
--- a/src/audio.c
+++ b/src/audio.c
@@ -81,6 +81,13 @@ static Mix_Chunk* get_sample_from_audio_event(audio_event event, u32 playerid) {
}
}
+ case EVENT_ZOMBIEROAR: {
+ switch (event.zombie)
+ {
+ case ZOMBIE_TYPE_ENRAGED: return wav_roar_enraged;
+ default: return wav_error;
+ }
+ }
case EVENT_IMPACT: {
if (event.zombie != ZOMBIE_TYPE_NONE) {
switch (event.zombie)
@@ -149,6 +156,7 @@ void play_positioned_sound(int channel, Mix_Chunk* wav, vec3f pos, float max_aud
int tiles_between_throwable_and_player = distance_between_3f((vec3f){.x = p->playerx, .y = p->playery, .z = p->height}, pos);
float volume = (tiles_between_throwable_and_player / max_audible_dist);
if (volume > 1.0f) volume = 1.0f;
+ if (volume < 0.0f) volume = 0.0f;
// calculate angle
/*
@@ -160,6 +168,6 @@ void play_positioned_sound(int channel, Mix_Chunk* wav, vec3f pos, float max_aud
if (rads > 360) rads -= 360;
*/
- //Mix_SetPosition(0, 0, volume*255);
+ Mix_SetPosition(channel, 0, (int)(volume*255));
Mix_PlayChannel(channel, wav, 0);
}
diff --git a/src/zombies.c b/src/zombies.c
index 9dd377c..60b2c52 100644
--- a/src/zombies.c
+++ b/src/zombies.c
@@ -85,6 +85,8 @@ static void set_enraged_zombie_stats(zombie *zombie) {
zombie->sprite_run = create_sprite(img_alien_run, 6, 32, 32, 0.1f);
zombie->sprite_run.zoom = 1.20f;
zombie->speed = 5.0f;
+
+ add_zombie_audio_event_to_queue(EVENT_ZOMBIEROAR, ZOMBIE_TYPE_ENRAGED, zombie->position);
}
static void set_normal_zombie_stats(zombie *zombie) {