summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAldrik Ramaekers <aldrik@amftech.nl>2023-12-24 11:55:06 +0100
committerAldrik Ramaekers <aldrik@amftech.nl>2023-12-24 11:55:06 +0100
commiteefc69b2c3816ed4c97bf976b7373175b8e7343d (patch)
treebf4b146e2667daacc7d5c838ee96c170966b306e
parentff3de32a164619ee1599c4f43600872f6cf955c4 (diff)
auudio
-rw-r--r--build/data/sounds/screech1.wavbin0 -> 129914 bytes
-rw-r--r--build/data/sounds/screech10.wavbin0 -> 131388 bytes
-rw-r--r--build/data/sounds/screech11.wavbin0 -> 45906 bytes
-rw-r--r--build/data/sounds/screech2.wavbin0 -> 45904 bytes
-rw-r--r--build/data/sounds/screech3.wavbin0 -> 75382 bytes
-rw-r--r--build/data/sounds/screech4.wavbin0 -> 65802 bytes
-rw-r--r--build/data/sounds/screech5.wavbin0 -> 59170 bytes
-rw-r--r--build/data/sounds/screech6.wavbin0 -> 41484 bytes
-rw-r--r--build/data/sounds/screech7.wavbin0 -> 39274 bytes
-rw-r--r--build/data/sounds/screech8.wavbin0 -> 28218 bytes
-rw-r--r--build/data/sounds/screech9.wavbin0 -> 68014 bytes
-rw-r--r--build/zombies.exebin2097887 -> 2098429 bytes
-rw-r--r--data/sounds/screech1.wavbin0 -> 129914 bytes
-rw-r--r--data/sounds/screech10.wavbin0 -> 131388 bytes
-rw-r--r--data/sounds/screech11.wavbin0 -> 45906 bytes
-rw-r--r--data/sounds/screech2.wavbin0 -> 45904 bytes
-rw-r--r--data/sounds/screech3.wavbin0 -> 75382 bytes
-rw-r--r--data/sounds/screech4.wavbin0 -> 65802 bytes
-rw-r--r--data/sounds/screech5.wavbin0 -> 59170 bytes
-rw-r--r--data/sounds/screech6.wavbin0 -> 41484 bytes
-rw-r--r--data/sounds/screech7.wavbin0 -> 39274 bytes
-rw-r--r--data/sounds/screech8.wavbin0 -> 28218 bytes
-rw-r--r--data/sounds/screech9.wavbin0 -> 68014 bytes
-rw-r--r--include/asset_defs.h3
-rw-r--r--include/audio.h3
-rw-r--r--src/asset_defs.c6
-rw-r--r--src/audio.c8
-rw-r--r--src/bullets.c2
-rw-r--r--src/zombies.c2
29 files changed, 20 insertions, 4 deletions
diff --git a/build/data/sounds/screech1.wav b/build/data/sounds/screech1.wav
new file mode 100644
index 0000000..8bcdc7d
--- /dev/null
+++ b/build/data/sounds/screech1.wav
Binary files differ
diff --git a/build/data/sounds/screech10.wav b/build/data/sounds/screech10.wav
new file mode 100644
index 0000000..4e33ed7
--- /dev/null
+++ b/build/data/sounds/screech10.wav
Binary files differ
diff --git a/build/data/sounds/screech11.wav b/build/data/sounds/screech11.wav
new file mode 100644
index 0000000..adc2b5b
--- /dev/null
+++ b/build/data/sounds/screech11.wav
Binary files differ
diff --git a/build/data/sounds/screech2.wav b/build/data/sounds/screech2.wav
new file mode 100644
index 0000000..0ac199b
--- /dev/null
+++ b/build/data/sounds/screech2.wav
Binary files differ
diff --git a/build/data/sounds/screech3.wav b/build/data/sounds/screech3.wav
new file mode 100644
index 0000000..b9ed3a8
--- /dev/null
+++ b/build/data/sounds/screech3.wav
Binary files differ
diff --git a/build/data/sounds/screech4.wav b/build/data/sounds/screech4.wav
new file mode 100644
index 0000000..65bb5ee
--- /dev/null
+++ b/build/data/sounds/screech4.wav
Binary files differ
diff --git a/build/data/sounds/screech5.wav b/build/data/sounds/screech5.wav
new file mode 100644
index 0000000..3db6f6d
--- /dev/null
+++ b/build/data/sounds/screech5.wav
Binary files differ
diff --git a/build/data/sounds/screech6.wav b/build/data/sounds/screech6.wav
new file mode 100644
index 0000000..2d947cd
--- /dev/null
+++ b/build/data/sounds/screech6.wav
Binary files differ
diff --git a/build/data/sounds/screech7.wav b/build/data/sounds/screech7.wav
new file mode 100644
index 0000000..77eb04e
--- /dev/null
+++ b/build/data/sounds/screech7.wav
Binary files differ
diff --git a/build/data/sounds/screech8.wav b/build/data/sounds/screech8.wav
new file mode 100644
index 0000000..6f7b470
--- /dev/null
+++ b/build/data/sounds/screech8.wav
Binary files differ
diff --git a/build/data/sounds/screech9.wav b/build/data/sounds/screech9.wav
new file mode 100644
index 0000000..6460c7a
--- /dev/null
+++ b/build/data/sounds/screech9.wav
Binary files differ
diff --git a/build/zombies.exe b/build/zombies.exe
index bba25ee..f350c96 100644
--- a/build/zombies.exe
+++ b/build/zombies.exe
Binary files differ
diff --git a/data/sounds/screech1.wav b/data/sounds/screech1.wav
new file mode 100644
index 0000000..8bcdc7d
--- /dev/null
+++ b/data/sounds/screech1.wav
Binary files differ
diff --git a/data/sounds/screech10.wav b/data/sounds/screech10.wav
new file mode 100644
index 0000000..4e33ed7
--- /dev/null
+++ b/data/sounds/screech10.wav
Binary files differ
diff --git a/data/sounds/screech11.wav b/data/sounds/screech11.wav
new file mode 100644
index 0000000..adc2b5b
--- /dev/null
+++ b/data/sounds/screech11.wav
Binary files differ
diff --git a/data/sounds/screech2.wav b/data/sounds/screech2.wav
new file mode 100644
index 0000000..0ac199b
--- /dev/null
+++ b/data/sounds/screech2.wav
Binary files differ
diff --git a/data/sounds/screech3.wav b/data/sounds/screech3.wav
new file mode 100644
index 0000000..b9ed3a8
--- /dev/null
+++ b/data/sounds/screech3.wav
Binary files differ
diff --git a/data/sounds/screech4.wav b/data/sounds/screech4.wav
new file mode 100644
index 0000000..65bb5ee
--- /dev/null
+++ b/data/sounds/screech4.wav
Binary files differ
diff --git a/data/sounds/screech5.wav b/data/sounds/screech5.wav
new file mode 100644
index 0000000..3db6f6d
--- /dev/null
+++ b/data/sounds/screech5.wav
Binary files differ
diff --git a/data/sounds/screech6.wav b/data/sounds/screech6.wav
new file mode 100644
index 0000000..2d947cd
--- /dev/null
+++ b/data/sounds/screech6.wav
Binary files differ
diff --git a/data/sounds/screech7.wav b/data/sounds/screech7.wav
new file mode 100644
index 0000000..77eb04e
--- /dev/null
+++ b/data/sounds/screech7.wav
Binary files differ
diff --git a/data/sounds/screech8.wav b/data/sounds/screech8.wav
new file mode 100644
index 0000000..6f7b470
--- /dev/null
+++ b/data/sounds/screech8.wav
Binary files differ
diff --git a/data/sounds/screech9.wav b/data/sounds/screech9.wav
new file mode 100644
index 0000000..6460c7a
--- /dev/null
+++ b/data/sounds/screech9.wav
Binary files differ
diff --git a/include/asset_defs.h b/include/asset_defs.h
index e1dd72a..57613de 100644
--- a/include/asset_defs.h
+++ b/include/asset_defs.h
@@ -73,6 +73,9 @@ Mix_Chunk* wav_character;
Mix_Chunk* wav_round_change;
Mix_Chunk* wav_step;
+#define NUM_SCREECHES 11
+Mix_Chunk* wav_screech[NUM_SCREECHES];
+
Mix_Music* music_inside1;
void load_assets();
diff --git a/include/audio.h b/include/audio.h
index 705748e..1ab8322 100644
--- a/include/audio.h
+++ b/include/audio.h
@@ -25,6 +25,7 @@ typedef enum t_audio_event_type {
EVENT_ROUND_CHANGE,
EVENT_CHARACTER_TYPE,
EVENT_FOOTSTEP,
+ EVENT_ZOMBIESCREECH,
} audio_event_type;
typedef struct t_audio_event {
@@ -45,7 +46,7 @@ int max_audio_events = MAX_AUDIO_EVENTS;
void play_music(Mix_Music* music);
void audio_channel_finished(int channel);
void add_throwable_audio_event_to_queue(audio_event_type event, throwable_type throwable, u32 playerid, vec3f position);
-void add_zombie_audio_event_to_queue(audio_event_type event, zombie_type zombie, u32 playerid, vec3f position);
+void add_zombie_audio_event_to_queue(audio_event_type event, zombie_type zombie, vec3f position);
void add_object_audio_event_to_queue(audio_event_type event, object_type obj, u32 playerid, vec3f position);
void add_audio_event_to_queue(audio_event_type event, u32 playerid, vec3f position);
void add_ui_audio_event_to_queue(audio_event_type event);
diff --git a/src/asset_defs.c b/src/asset_defs.c
index f53c5ea..c4caf68 100644
--- a/src/asset_defs.c
+++ b/src/asset_defs.c
@@ -70,6 +70,12 @@ void load_assets() {
wav_character = Mix_LoadWAV("data/sounds/character.wav");
wav_step = Mix_LoadWAV("data/sounds/step.wav");
+ for (int i = 1; i <= NUM_SCREECHES; i++) {
+ char path[100];
+ sprintf(path, "data/sounds/screech%d.wav", i);
+ wav_screech[i] = Mix_LoadWAV(path);
+ }
+
// music
music_inside1 = Mix_LoadMUS("data/sounds/music_inside1.mp3");
}
diff --git a/src/audio.c b/src/audio.c
index 696b9ec..4dbcdc9 100644
--- a/src/audio.c
+++ b/src/audio.c
@@ -9,11 +9,11 @@ void add_throwable_audio_event_to_queue(audio_event_type event, throwable_type t
}
}
-void add_zombie_audio_event_to_queue(audio_event_type event, zombie_type zombie, u32 playerid, vec3f position) {
+void add_zombie_audio_event_to_queue(audio_event_type event, zombie_type zombie, vec3f position) {
for (int i = 0; i < max_audio_events; i++) {
if (audio_events[i].active) continue;
- audio_events[i] = (audio_event){.active = true, .throwable = THROWABLE_NONE, .obj = OBJECT_NONE, .zombie = zombie, .playerid = playerid, .position = position, .type = event};
+ audio_events[i] = (audio_event){.active = true, .throwable = THROWABLE_NONE, .obj = OBJECT_NONE, .zombie = zombie, .playerid = -1, .position = position, .type = event};
return;
}
}
@@ -97,6 +97,10 @@ static Mix_Chunk* get_sample_from_audio_event(audio_event event, u32 playerid) {
}
}
}
+ case EVENT_ZOMBIESCREECH: {
+ int random_screech_index = rand() % NUM_SCREECHES;
+ return wav_screech[random_screech_index];
+ }
default: return wav_error;
}
diff --git a/src/bullets.c b/src/bullets.c
index 6cb4b66..c8fc6e9 100644
--- a/src/bullets.c
+++ b/src/bullets.c
@@ -247,7 +247,7 @@ void update_bullets_server(platform_window* window) {
b = bullets[i];
add_points_to_player(p, POINTS_PER_HIT);
- add_zombie_audio_event_to_queue(EVENT_IMPACT, ZOMBIE_TYPE_NORMAL, p->id, (vec3f){.x = p->playerx, .y = p->playery, .z = p->height});
+ add_zombie_audio_event_to_queue(EVENT_IMPACT, ZOMBIE_TYPE_NORMAL, (vec3f){.x = p->playerx, .y = p->playery, .z = p->height});
}
}
}
diff --git a/src/zombies.c b/src/zombies.c
index 6bb4eb6..1006e95 100644
--- a/src/zombies.c
+++ b/src/zombies.c
@@ -54,6 +54,8 @@ bool hit_zombie(int index, int damage) {
int chunk_count = rand() % 4 + 1;
for (int c = 0; c < chunk_count; c++) spawn_zombie_chunk(center);
+ add_zombie_audio_event_to_queue(EVENT_ZOMBIESCREECH, zombies[index].type, zombies[index].position);
+
zombies[index].alive = false;
spawn_drop(zombies[index].position);
return true;