From: hgn Date: Tue, 4 Oct 2022 18:36:41 +0000 (+0100) Subject: water splash X-Git-Url: https://harrygodden.com/git/?a=commitdiff_plain;h=1740c935bfdacc65c5c7e4bb95fba1ada1f7118a;hp=0c3ef87e654d436e0cad5f5b40f3631ae26ab649;p=carveJwlIkooP6JGAAIwe30JlM.git water splash --- diff --git a/audio.h b/audio.h index 3e4fc77..25f3aa8 100644 --- a/audio.h +++ b/audio.h @@ -18,8 +18,8 @@ audio_clip audio_board[] = {.path="sound/reverb.ogg",.source_mode=k_audio_source_compressed } }; -audio_clip audio_ding = -{ .path = "sound/ding.ogg", .source_mode=k_audio_source_compressed }; +audio_clip audio_splash = +{ .path = "sound/splash.ogg", .source_mode=k_audio_source_compressed }; audio_clip audio_jumps[] = { { .path = "sound/jump0.ogg", .source_mode=k_audio_source_compressed, }, @@ -136,7 +136,7 @@ static void audio_init(void) audio_clip_loadn( audio_board, vg_list_size(audio_board) ); audio_clip_loadn( audio_ambience, vg_list_size(audio_ambience) ); - audio_clip_loadn( &audio_ding, 1 ); + audio_clip_loadn( &audio_splash, 1 ); audio_clip_loadn( &audio_gate_pass, 1 ); audio_clip_loadn( &audio_gate_lap, 1 ); audio_clip_loadn( &audio_gate_ambient, 1 ); diff --git a/player.h b/player.h index e4c0fce..fa9335c 100644 --- a/player.h +++ b/player.h @@ -220,12 +220,13 @@ static void player_update(void) /* 2 */ phys->on_board ^= 0x1; } - if( (glfwGetKey( vg_window, GLFW_KEY_O ) || (phys->rb.co[1] < 0.0f)) && - !player.is_dead) +#if 0 + if( (glfwGetKey( vg_window, GLFW_KEY_O ) )) { player_ragdoll_copy_model( phys->rb.v ); player.is_dead = 1; } +#endif if( player.is_dead ) { diff --git a/player_audio.h b/player_audio.h index b5ba735..5402b7a 100644 --- a/player_audio.h +++ b/player_audio.h @@ -10,15 +10,6 @@ static void player_audio(void) { struct player_phys *phys = &player.phys; - static int _ding = 0; - - int last = _ding; - _ding = glfwGetKey(vg_window, GLFW_KEY_C); - - int trigger_ding = 0; - if( _ding && !last ) - trigger_ding = 1; - static int _air = 0; int l2 = _air; @@ -53,9 +44,6 @@ static void player_audio(void) float *cam = player.camera[3], *pos = phys->rb.co; - if( trigger_ding ) - audio_player_playclip( &audio_player_extra, &audio_ding ); - audio_player_set_position( &audio_player0, phys->rb.co ); audio_player_set_position( &audio_player1, phys->rb.co ); audio_player_set_position( &audio_player2, phys->rb.co ); @@ -112,6 +100,7 @@ static void player_audio(void) audio_player_set_vol( &audio_player0, 0.0f ); audio_player_set_vol( &audio_player1, 0.0f ); audio_player_set_vol( &audio_player2, 0.0f ); + audio_player_set_vol( &audio_player3, 0.0f ); int walk_phase = 0; if( vg_fractf(player.walk_timer) > 0.5f ) diff --git a/player_physics.h b/player_physics.h index f9584a2..ebcb55e 100644 --- a/player_physics.h +++ b/player_physics.h @@ -547,7 +547,8 @@ static void player_physics(void) phys->jump = 0.0f; player.jump_time = vg_time; - + + /* TODO: Move to audio file */ audio_lock(); audio_player_set_flags( &audio_player_extra, AUDIO_FLAG_SPACIAL_3D ); audio_player_set_position( &audio_player_extra, phys->rb.co ); @@ -587,6 +588,18 @@ static void player_do_motion(void) float horizontal = vg_get_axis("horizontal"), vertical = vg_get_axis("vertical"); + if( (phys->rb.co[1] < 0.0f) && !player.is_dead ) + { + audio_lock(); + audio_player_set_flags( &audio_player_extra, AUDIO_FLAG_SPACIAL_3D ); + audio_player_set_position( &audio_player_extra, phys->rb.co ); + audio_player_set_vol( &audio_player_extra, 20.0f ); + audio_player_playclip( &audio_player_extra, &audio_splash ); + audio_unlock(); + + player_kill(); + } + if( phys->on_board ) player_physics(); else @@ -659,7 +672,7 @@ static void player_do_motion(void) player_save_frame(); audio_lock(); - audio_play_oneshot( &audio_gate_lap, 1.0f ); + audio_play_oneshot( &audio_gate_pass, 1.0f ); audio_unlock(); break; } diff --git a/sound_src/gate_ambient.ogg b/sound_src/gate_ambient.ogg index 3cf2dd7..b30ff3c 100644 Binary files a/sound_src/gate_ambient.ogg and b/sound_src/gate_ambient.ogg differ diff --git a/sound_src/gate_lap.ogg b/sound_src/gate_lap.ogg index 5bc5d73..85a3cdc 100644 Binary files a/sound_src/gate_lap.ogg and b/sound_src/gate_lap.ogg differ diff --git a/sound_src/gate_pass.ogg b/sound_src/gate_pass.ogg index 9cbb487..8067a12 100644 Binary files a/sound_src/gate_pass.ogg and b/sound_src/gate_pass.ogg differ diff --git a/sound_src/splash.ogg b/sound_src/splash.ogg new file mode 100644 index 0000000..2af25f4 Binary files /dev/null and b/sound_src/splash.ogg differ