From 97e79598aa3fbbf7e7b69894964ccb232dfc0347 Mon Sep 17 00:00:00 2001 From: quou Date: Sun, 7 May 2023 18:37:10 +1000 Subject: Add more sound effects. --- collision_system.c | 4 ++++ config.h | 2 +- enemy.c | 2 ++ player.c | 2 ++ sound.c | 3 +-- 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; -- cgit v1.2.3-54-g00ecf