X-Git-Url: https://harrygodden.com/git/?a=blobdiff_plain;ds=sidebyside;f=audio.h;h=9622c50a81eee572bb52a082339f45668d4e15b0;hb=a3c10b9dec1ed7136721695033ebeef30717f249;hp=26c1a35ca3b69152c2a0b2f99c556e63567c7247;hpb=be6707a307bfeec1b45cca8b3fb647e81262be87;p=carveJwlIkooP6JGAAIwe30JlM.git diff --git a/audio.h b/audio.h index 26c1a35..9622c50 100644 --- a/audio.h +++ b/audio.h @@ -37,6 +37,24 @@ audio_clip audio_footsteps[] = { {.path = "sound/step_concrete3.ogg" } }; +audio_clip audio_footsteps_grass[] = { + {.path = "sound/step_bush0.ogg" }, + {.path = "sound/step_bush1.ogg" }, + {.path = "sound/step_bush2.ogg" }, + {.path = "sound/step_bush3.ogg" }, + {.path = "sound/step_bush4.ogg" }, + {.path = "sound/step_bush5.ogg" } +}; + +audio_clip audio_footsteps_wood[] = { + {.path = "sound/step_wood0.ogg" }, + {.path = "sound/step_wood1.ogg" }, + {.path = "sound/step_wood2.ogg" }, + {.path = "sound/step_wood3.ogg" }, + {.path = "sound/step_wood4.ogg" }, + {.path = "sound/step_wood5.ogg" } +}; + audio_clip audio_lands[] = { { .path = "sound/land0.ogg" }, { .path = "sound/land1.ogg" }, @@ -167,6 +185,10 @@ VG_STATIC void audio_init(void) audio_clip_loadn( audio_water, vg_list_size(audio_water), NULL ); audio_clip_loadn( audio_grass, vg_list_size(audio_grass), NULL ); audio_clip_loadn( audio_footsteps, vg_list_size(audio_footsteps), NULL ); + audio_clip_loadn( audio_footsteps_grass, + vg_list_size(audio_footsteps_grass), NULL ); + audio_clip_loadn( audio_footsteps_wood, + vg_list_size(audio_footsteps_wood), NULL ); audio_clip_loadn( audio_rewind, vg_list_size(audio_rewind), NULL ); audio_clip_loadn( audio_ui, vg_list_size(audio_ui), NULL ); @@ -281,7 +303,7 @@ enum audio_sprite_type * Trace out a random point, near the player to try and determine water areas */ VG_STATIC enum audio_sprite_type audio_sample_sprite_random( v3f origin, - v3f output ) + v3f output ) { v3f chance = { (vg_randf()-0.5f) * 30.0f, 8.0f, @@ -296,22 +318,29 @@ VG_STATIC enum audio_sprite_type audio_sample_sprite_random( v3f origin, if( ray_world( pos, (v3f){0.0f,-1.0f,0.0f}, &contact ) ) { - if( ray_hit_is_ramp( &contact ) ) + struct world_material *mat = ray_hit_material( &contact ); + + if( mat->info.surface_prop == k_surface_prop_grass) + { + v3_copy( contact.pos, output ); + return k_audio_sprite_type_grass; + } + else { vg_line( pos, contact.pos, 0xff0000ff ); vg_line_pt3( contact.pos, 0.3f, 0xff0000ff ); return k_audio_sprite_type_none; } - - v3_copy( contact.pos, output ); - return k_audio_sprite_type_grass; } output[0] = pos[0]; output[1] = 0.0f; output[2] = pos[2]; - - return k_audio_sprite_type_water; + + if( world.water.enabled ) + return k_audio_sprite_type_water; + else + return k_audio_sprite_type_none; } VG_STATIC void audio_debug_soundscapes(void)