X-Git-Url: https://harrygodden.com/git/?a=blobdiff_plain;f=audio.h;h=e6e76bdd22d5940a1ffb3beff528485d06b4854a;hb=5ae8830824afe4fd399f8a2f912e4df9735f9fd5;hp=5eb499a0c44ce2eebfeca0f7a3daba7b0736bf3c;hpb=be8ea6efdbfd9c0fdad97401ed7d92041d8c8778;p=carveJwlIkooP6JGAAIwe30JlM.git diff --git a/audio.h b/audio.h index 5eb499a..e6e76bd 100644 --- a/audio.h +++ b/audio.h @@ -186,10 +186,12 @@ VG_STATIC void audio_ambient_sprite_play( v3f co, audio_clip *clip ) audio_unlock(); } +VG_STATIC +enum audio_sprite_type world_audio_sample_sprite_random(v3f origin, v3f output); VG_STATIC void audio_ambient_sprites_update( world_instance *world, v3f co ) { static float accum = 0.0f; - accum += vg.frame_delta; + accum += vg.time_delta; if( accum > 0.1f ) accum -= 0.1f; @@ -201,11 +203,13 @@ VG_STATIC void audio_ambient_sprites_update( world_instance *world, v3f co ) if( sprite_type != k_audio_sprite_type_none ){ if( sprite_type == k_audio_sprite_type_grass ){ - audio_ambient_sprite_play( sprite_pos, &audio_grass[rand()%4] ); + audio_ambient_sprite_play( sprite_pos, &audio_grass[vg_randu32()%4] ); } else if( sprite_type == k_audio_sprite_type_water ){ - if( world->water.enabled ) - audio_ambient_sprite_play( sprite_pos, &audio_water[rand()%6] ); + if( world->water.enabled ){ + audio_ambient_sprite_play( sprite_pos, + &audio_water[vg_randu32()%6] ); + } } } }