framebuffer formalitites
[carveJwlIkooP6JGAAIwe30JlM.git] / player_animation.h
index 4d579653e643b4801fa348283d6d9d6633e9a20f..e08991014629b05224ab5babd4754873af2cdc6a 100644 (file)
@@ -161,7 +161,7 @@ VG_STATIC void player_animate(void)
    {
       float dirz = phys->reverse > 0.0f? 0.0f: 1.0f,
             dirx = phys->slip < 0.0f?    0.0f: 1.0f,
-            fly  = phys->in_air?         1.0f: 0.0f;
+            fly  = (phys->in_air|phys->grind)?  1.0f: 0.0f;
 
       player.fdirz = vg_lerpf( player.fdirz, dirz, 2.4f*vg.time_delta );
       player.fdirx = vg_lerpf( player.fdirx, dirx, 0.6f*vg.time_delta );
@@ -336,15 +336,21 @@ VG_STATIC void player_animate_camera(void)
       /* Look angles */
       v3_lerp( phys->vl, phys->rb.v, 0.05f, phys->vl );
 
+      player.fgrind = vg_lerpf( player.fgrind, phys->grind, vg.time_delta );
+
       float yaw = atan2f(  phys->vl[0], -phys->vl[2] ),
-          pitch = atan2f( -phys->vl[1], 
-                sqrtf(
-                  phys->vl[0]*phys->vl[0] + phys->vl[2]*phys->vl[2]
-                )) * 0.7f;
+          pitch = atan2f
+                  ( 
+                      -phys->vl[1], 
+                      sqrtf
+                      (
+                        phys->vl[0]*phys->vl[0] + phys->vl[2]*phys->vl[2]
+                      )
+                  ) 
+                  * 0.7f + vg_lerpf( 0.30f, 0.90f, player.fgrind );
 
       player.angles[0] = yaw;
-      player.angles[1] = vg_lerpf( player.angles[1], pitch + 0.30f, 
-                                                         player.fonboard );
+      player.angles[1] = vg_lerpf( player.angles[1], pitch, player.fonboard );
 
       /* Camera shake */
       static v2f shake_damp = {0.0f,0.0f};