aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorquou <quou@disroot.org>2023-05-07 18:37:10 +1000
committerquou <quou@disroot.org>2023-05-07 18:37:10 +1000
commit97e79598aa3fbbf7e7b69894964ccb232dfc0347 (patch)
tree4b176682b581148fab1e05f0fb8378c76f55800b
parent955f6ae56cdd3b20eabb44e7c9b931bdb17c2b3e (diff)
Add more sound effects.
-rw-r--r--collision_system.c4
-rw-r--r--config.h2
-rw-r--r--enemy.c2
-rw-r--r--player.c2
-rw-r--r--sound.c3
5 files changed, 10 insertions, 3 deletions
diff --git a/collision_system.c b/collision_system.c
index a5342d2..6d8368c 100644
--- a/collision_system.c
+++ b/collision_system.c
@@ -67,6 +67,8 @@ static void handle_bullet_vs_enemy(
e->hp--;
destroy_entity(world, bullet);
new_player_bullet_explosion(world, pos->x, pos->y);
+
+ play_beep(50, 500);
}
static void handle_bullet_vs_solid(
@@ -86,6 +88,8 @@ static void handle_bullet_vs_solid(
new_player_bullet_explosion(world, pos->x, pos->y);
}
+ play_beep(50, 100);
+
destroy_entity(world, bullet);
}
diff --git a/config.h b/config.h
index 2df5ce8..b1c18f8 100644
--- a/config.h
+++ b/config.h
@@ -23,6 +23,6 @@
#define wave_max_subwaves 8
#define wave_max_spawns 16
-#define max_beeps 32
+#define max_beeps 128
#endif
diff --git a/enemy.c b/enemy.c
index 60366fb..e6d7a88 100644
--- a/enemy.c
+++ b/enemy.c
@@ -170,6 +170,8 @@ void enemy_system(World* world) {
tpy * enemy_bullet_speed
);
enemy->shoot_timer = 0;
+
+ play_beep(50, 300);
}
enemy->shoot_timer++;
diff --git a/player.c b/player.c
index dbd318d..97c3573 100644
--- a/player.c
+++ b/player.c
@@ -173,6 +173,8 @@ void player_take_damage(
if (player->invul) { return; }
+ play_beep(70, 1000);
+
player->hp -= dmg;
player->invul = player_invul_frames;
player->invul_counter = 0;
diff --git a/sound.c b/sound.c
index 611bca9..798e8c2 100644
--- a/sound.c
+++ b/sound.c
@@ -86,8 +86,7 @@ void sound_mix(unsigned char* stream, int len) {
for (i = 0; i < len; i++) {
/* stream[i] = sys.t % 50;*/
- stream[i] = 0;
- stream[i] = f(sys.t) / 2;
+ stream[i] = f(sys.t) / 5;
for (j = sys.beep_count - 1; j >= 0; j--) {
beep = &sys.beeps[j];
stream[i] |= (sys.t % beep->pitch) * 5;