point maps (wip)
[carveJwlIkooP6JGAAIwe30JlM.git] / player_skate.c
index e1971b2000725198264cf07b6d7ec5f65e675d40..f38f6d4302a38c8914ac4b60c4de46ebd470b56d 100644 (file)
@@ -980,7 +980,7 @@ VG_STATIC void skate_apply_jump_model( player_instance *player )
       s->state.jump_time = vg.time;
 
       audio_lock();
-      audio_oneshot_3d( &audio_jumps[rand()%2], player->rb.co, 40.0f, 1.0f );
+      audio_oneshot_3d( &audio_jumps[vg_randu32()%2], player->rb.co, 40.0f, 1.0f );
       audio_unlock();
    }
 }
@@ -1192,13 +1192,10 @@ VG_STATIC void player__skate_post_update( player_instance *player )
       slide = 0.0f;
    }
 
-   static float menu_gate = 1.0f;
-   menu_gate = vg_lerpf( menu_gate, 1-cl_menu, vg.time_frame_delta*4.0f );
-
-   float
-         vol_main    = sqrtf( (1.0f-air)*attn*(1.0f-slide) * 0.4f ) * menu_gate,
-         vol_air     = sqrtf(       air *attn * 0.5f )              * menu_gate,
-         vol_slide   = sqrtf( (1.0f-air)*attn*slide * 0.25f )       * menu_gate;
+   f32 gate        = 1.0f-menu.factive,
+       vol_main    = sqrtf( (1.0f-air)*attn*(1.0f-slide) * 0.4f ) * gate,
+       vol_air     = sqrtf(       air *attn * 0.5f )              * gate,
+       vol_slide   = sqrtf( (1.0f-air)*attn*slide * 0.25f )       * gate;
 
    const u32 flags = AUDIO_FLAG_SPACIAL_3D|AUDIO_FLAG_LOOP;
 
@@ -2199,7 +2196,7 @@ VG_STATIC void player__skate_update( player_instance *player )
          if( !prev_contacts[i] ){
             v3f co;
             m4x3_mulv( player->rb.to_world, wheels[i].pos, co );
-            audio_oneshot_3d( &audio_taps[rand()%4], co, 40.0f, 0.75f );
+            audio_oneshot_3d( &audio_taps[vg_randu32()%4], co, 40.0f, 0.75f );
          }
       }
       audio_unlock();
@@ -2573,11 +2570,11 @@ begin_collision:;
 
       if( s->state.activity == k_skate_activity_ground ){
          if( (fabsf(s->state.slip) > 0.75f) ){
-            audio_oneshot_3d( &audio_lands[rand()%2+3], player->rb.co, 
+            audio_oneshot_3d( &audio_lands[vg_randu32()%2+3], player->rb.co, 
                               40.0f, 1.0f );
          }
          else{
-            audio_oneshot_3d( &audio_lands[rand()%3], player->rb.co, 
+            audio_oneshot_3d( &audio_lands[vg_randu32()%3], player->rb.co, 
                               40.0f, 1.0f );
          }
       }
@@ -2668,7 +2665,7 @@ VG_STATIC void player__skate_animate( player_instance *player,
 
    float curspeed  = v3_length( player->rb.v ),
          kickspeed = vg_clampf( curspeed*(1.0f/40.0f), 0.0f, 1.0f ),
-         kicks     = (vg_randf()-0.5f)*2.0f*kickspeed,
+         kicks     = (vg_randf64()-0.5f)*2.0f*kickspeed,
          sign      = vg_signf( kicks );
 
    s->wobble[0] = vg_lerpf( s->wobble[0], kicks*kicks*sign, 6.0f*vg.time_delta);