code is no longer based :(
authorhgn <hgodden00@gmail.com>
Sun, 19 Nov 2023 09:27:17 +0000 (09:27 +0000)
committerhgn <hgodden00@gmail.com>
Sun, 19 Nov 2023 09:27:17 +0000 (09:27 +0000)
12 files changed:
ent_skateshop.c
menu.h
player.c
player.h
player_common.c
player_common.h
player_replay.c
player_skate.c
player_walk.c
skaterift.c
workshop.c
world_entity.c

index 842d814db98cd115fb2f895c8d2dc4a000b42796..427347d430379a153f2b1206f396a804d5744cb4 100644 (file)
@@ -137,8 +137,7 @@ static void ent_skateshop_preupdate( ent_skateshop *shop, int active ){
       
    v3f dir = {0.0f,-1.0f,0.0f};
    mdl_transform_vector( &ref->transform, dir, dir );
-   m3x3_mulv( localplayer.invbasis, dir, dir );
-   player_vector_angles( world_static.focus_cam.angles, dir, 1.0f, 0.0f );
+   v3_angles( dir, world_static.focus_cam.angles );
 
    v3f lookat;
    if( shop->type == k_skateshop_type_boardshop ||
diff --git a/menu.h b/menu.h
index c2a963e0071c2ae954ce028d302ba8c66100ab3a..8da5026898ad5c0bc693526f94b2c42164d0fb63 100644 (file)
--- a/menu.h
+++ b/menu.h
@@ -635,7 +635,7 @@ static void menu_render(void){
 
       v3f v0;
       mdl_transform_vector( &menu.cam->transform, (v3f){0.0f,-1.0f,0.0f}, v0 );
-      player_vector_angles( target.angles, v0, 1.0f, 0.0f );
+      v3_angles( v0, target.angles );
 
       camera_lerp( &menu.view, &target, rate, &menu.view );
 
index fce9c488aaabf58f4e341881d497de9ede7c296e..23cb5fcaf4ceeaae7f8d09c020be987e08d5fba0 100644 (file)
--- a/player.c
+++ b/player.c
@@ -132,16 +132,13 @@ static void player__pass_gate( u32 id ){
    m4x3_mulv( gate->transport, cc->tpv_lpf, cc->tpv_lpf );
    m3x3_mulv( gate->transport, cc->cam_velocity_smooth, 
                                cc->cam_velocity_smooth );
-   m3x3_copy( localplayer.basis, localplayer.basis_gate );
-
-   v4f q;
-   m3x3_q( gate->transport, q );
-   q_mul( q, localplayer.qbasis, localplayer.qbasis );
-   q_normalize( localplayer.qbasis );
-   q_m3x3( localplayer.qbasis, localplayer.basis );
-   m3x3_transpose( localplayer.basis, localplayer.invbasis );
 
    m4x3_mulv( gate->transport, localplayer.cam.pos, localplayer.cam.pos );
+   
+   v3f v0;
+   v3_angles_vector( localplayer.angles, v0 );
+   m3x3_mulv( gate->transport, v0, v0 );
+   v3_angles( v0, localplayer.angles );
 
    audio_lock();
    audio_oneshot( &audio_gate_pass, 1.0f, 0.0f );
@@ -209,7 +206,6 @@ static void player__im_gui(void){
 
    player__debugtext( 2, "player" );
    player__debugtext( 1, "angles: " PRINTF_v3f( localplayer.cam.angles ) );
-   player__debugtext( 1, "basis:  " PRINTF_v4f( localplayer.qbasis ) );
 
    if( player_subsystems[ localplayer.subsystem ]->im_gui )
       player_subsystems[ localplayer.subsystem ]->im_gui();
@@ -235,10 +231,6 @@ static void player__reset(void){
 
    rb_update_transform( &localplayer.rb );
 
-   q_identity( localplayer.qbasis );
-   m3x3_identity( localplayer.basis );
-   m3x3_identity( localplayer.invbasis );
-
    localplayer.subsystem = k_player_subsystem_walk;
    player__walk_reset();
 
index 2b7519a01b5b1db790ca5c4a7708deef9dd22f3f..cd6bca59e83419045ec930bd668918ceef32c6ee 100644 (file)
--- a/player.h
+++ b/player.h
@@ -73,8 +73,10 @@ struct {
    rigidbody rb;
    v3f angles;
 
+#if 0
    v4f   qbasis;
    m3x3f basis, invbasis, basis_gate;
+#endif
    world_instance *viewable_world;
 
    /*
index 84ce9e3606e1deb7c937dde3af1022152fad0c41..8ea57a4380021585af39ea05e0ad3868ed421f20 100644 (file)
@@ -7,26 +7,9 @@
 #include "menu.h"
 #include "vg/vg_perlin.h"
 
-static void player_vector_angles( v3f angles, v3f v, float C, float k ){
-   float yaw = atan2f( v[0], -v[2] ),
-       pitch = atan2f
-               ( 
-                   -v[1], 
-                   sqrtf
-                   (
-                     v[0]*v[0] + v[2]*v[2]
-                   )
-               ) * C + k;
-
-   angles[0] = yaw;
-   angles[1] = pitch;
-   angles[2] = 0.0f;
-}
-
 static float player_get_heading_yaw(void){
    v3f xz;
    q_mulv( localplayer.rb.q, (v3f){ 0.0f,0.0f,1.0f }, xz );
-   m3x3_mulv( localplayer.invbasis, xz, xz );
    return atan2f( xz[0], xz[2] );
 }
 
@@ -52,6 +35,11 @@ static void player_camera_portal_correction(void){
          m4x3_invert_affine( localplayer.gate_waiting->transport, inverse );
          m4x3_mulv( inverse, localplayer.cam.pos, localplayer.cam.pos );
 
+         v3f v0;
+         v3_angles_vector( localplayer.cam.angles, v0 );
+         m3x3_mulv( inverse, v0, v0 );
+         v3_angles( v0, localplayer.cam.angles );
+
          skeleton_apply_transform( &localplayer.skeleton, inverse, 
                                     localplayer.final_mtx );
       }
@@ -136,11 +124,9 @@ static void player__cam_iterate(void){
    v3_lerp( cc->cam_velocity_smooth, localplayer.rb.v, 4.0f*vg.time_frame_delta, 
             cc->cam_velocity_smooth );
 
-   v3f velocity_local;
-   m3x3_mulv( localplayer.invbasis, cc->cam_velocity_smooth, velocity_local );
-   player_vector_angles( velocity_angles, velocity_local,
-                         localplayer.cam_velocity_coefficient_smooth,
-                         localplayer.cam_velocity_constant_smooth );
+   v3_angles( cc->cam_velocity_smooth, velocity_angles );
+   velocity_angles[1] *= localplayer.cam_velocity_coefficient_smooth;
+   velocity_angles[1] += localplayer.cam_velocity_constant_smooth;
 
    float inf_fpv = localplayer.cam_velocity_influence_smooth * 
                      cc->camera_type_blend,
@@ -162,7 +148,6 @@ static void player__cam_iterate(void){
 
    v3f future;
    v3_muls( localplayer.rb.v, 0.4f*vg.time_frame_delta, future );
-   m3x3_mulv( localplayer.invbasis, future, future );
 
    v3f camera_follow_dir = 
       { -sinf( localplayer.angles[0] ) * cosf( localplayer.angles[1] ),
@@ -177,7 +162,7 @@ static void player__cam_iterate(void){
    follow_angles[0] = atan2f( -v0[0], v0[2] );
    follow_angles[1] = 0.3f + velocity_angles[1] * 0.2f;
 
-   float ya = atan2f( -velocity_local[1], 30.0f );
+   float ya = atan2f( -cc->cam_velocity_smooth[1], 30.0f );
 
    follow_angles[1] = 0.3f + ya;
    camera_lerp_angles( localplayer.angles, follow_angles,
@@ -199,7 +184,6 @@ static void player__cam_iterate(void){
    v3_add( tpv_origin, cc->tpv_lpf, tpv_origin );
 
    /* offset */
-   m3x3_mulv( localplayer.basis, camera_follow_dir, camera_follow_dir );
    v3_muls( camera_follow_dir, 1.8f, tpv_offset );
    v3_muladds( tpv_offset, cc->cam_velocity_smooth, -0.025f, tpv_offset );
 
@@ -254,9 +238,10 @@ static void player__cam_iterate(void){
          v3f v0;
          if( k_cinema_fixed )
             mdl_transform_vector( &cam->transform, (v3f){0.0f,-1.0f,0.0f}, v0 );
-         else v3_sub( localplayer.rb.co, cam->transform.co, v0 );
-         m3x3_mulv( localplayer.invbasis, v0, v0 );
-         player_vector_angles( localplayer.cam.angles, v0, 1.0f, 0.0f );
+         else 
+            v3_sub( localplayer.rb.co, cam->transform.co, v0 );
+
+         v3_angles( v0, localplayer.cam.angles );
       }
    }
 
index d11982720e85f6f855ee3ea62db24908171bcf18..4510835e125d7509d00cf62f117a04927a9cd70f 100644 (file)
@@ -15,7 +15,6 @@ static ui_rect g_player_debugger;
 
 static void player_look( v3f angles, float speed );
 static void player__cam_iterate(void);
-static void player_vector_angles( v3f angles, v3f v, float C, float k );
 static struct player_board 
    *player_get_player_board( struct player_instance *player );
 static struct player_model 
index 0e71408bd1fb60996bc05cb372b646357e69dc9a..6a59e252ea9dab0d9580f22eb82e404828697e47 100644 (file)
@@ -470,12 +470,9 @@ static void skaterift_replay_pre_update(void){
  
          v3f lookdir = { 0.0f, 0.0f, -1.0f },
              sidedir = { 1.0f, 0.0f,  0.0f };
-
-         m3x3f mtx;
-         m3x3_mul( cam->transform, localplayer.basis, mtx );
          
-         m3x3_mulv( mtx, lookdir, lookdir );
-         m3x3_mulv( mtx, sidedir, sidedir );
+         m3x3_mulv( cam->transform, lookdir, lookdir );
+         m3x3_mulv( cam->transform, sidedir, sidedir );
 
          v2f input;
          joystick_state( k_srjoystick_steer, input );
index 74668282b51104bf70c52c6e3b110a94776a6d5b..522ea3010a3fd93cf909063e4f6be1397203c202 100644 (file)
@@ -117,7 +117,7 @@ static int skate_grind_scansq( v3f pos, v3f dir, float r,
        support_max;
 
    v3f support_axis;
-   v3_cross( plane, localplayer.basis[1], support_axis );
+   v3_cross( plane, (v3f){0,1,0}, support_axis );
    v3_normalize( support_axis );
    
    bh_iter it;
@@ -154,9 +154,9 @@ static int skate_grind_scansq( v3f pos, v3f dir, float r,
             v3_cross( va, vb, normal );
 
             sample->normal[0] = v3_dot( support_axis, normal );
-            sample->normal[1] = v3_dot( localplayer.basis[1], normal );
+            sample->normal[1] = normal[1];
             sample->co[0]     = v3_dot( support_axis, d );
-            sample->co[1]     = v3_dot( localplayer.basis[1], d );
+            sample->co[1]     = d[1];
 
             v3_copy( normal, sample->normal3 ); /* normalize later
                                                    if we want to us it */
@@ -234,8 +234,8 @@ too_many_samples:
          v3_muls( dir, vg_signf(v3_dot(dir,plane)), dir );
          v3_add( average_direction, dir, average_direction );
 
-         float yi = v3_dot( localplayer.basis[1], si->normal3 ),
-               yj = v3_dot( localplayer.basis[1], sj->normal3 );
+         float yi = si->normal3[1],
+               yj = sj->normal3[1];
 
          if( yi > yj ) v3_add( si->normal3, average_normal, average_normal );
          else          v3_add( sj->normal3, average_normal, average_normal );
@@ -287,18 +287,14 @@ static int create_jumps_to_hit_target( jump_info *jumps,
 
    v3f v0;
    v3_sub( target, localplayer.rb.co, v0 );
-   m3x3_mulv( localplayer.invbasis, v0, v0 );
 
    v3f ax;
    v3_copy( v0, ax );
    ax[1] = 0.0f;
    v3_normalize( ax );
 
-   v3f v_local;
-   m3x3_mulv( localplayer.invbasis, localplayer.rb.v, v_local );
-
-   v2f d = { v3_dot( ax, v0 ),           v0[1] },
-       v = { v3_dot( ax, v_local ), v_local[1] };
+   v2f d = { v3_dot( ax, v0 ),               v0[1] },
+       v = { v3_dot( ax, localplayer.rb.v ), localplayer.rb.v[1] };
 
    float a = atan2f( v[1], v[0] ),
          m = v2_length( v ),
@@ -317,7 +313,6 @@ static int create_jumps_to_hit_target( jump_info *jumps,
 
          v3_muls( ax, cosf( a0 ) * m, inf->v );
          inf->v[1] += sinf( a0 ) * m;
-         m3x3_mulv( localplayer.basis, inf->v, inf->v );
          inf->land_dist = d[0] / (cosf(a0)*m);
          inf->gravity = gravity;
 
@@ -330,7 +325,6 @@ static int create_jumps_to_hit_target( jump_info *jumps,
 
          v3_muls( ax, cosf( a1 ) * m, inf->v );
          inf->v[1] += sinf( a1 ) * m;
-         m3x3_mulv( localplayer.basis, inf->v, inf->v );
          inf->land_dist = d[0] / (cosf(a1)*m);
          inf->gravity = gravity;
 
@@ -358,7 +352,7 @@ static void player__approximate_best_trajectory(void){
    v3_normalize( axis );
 
    /* at high slopes, Y component is low */
-   float upness      = v3_dot( localplayer.rb.to_world[1], localplayer.basis[1] ),
+   float upness      = localplayer.rb.to_world[1][1],
          angle_begin = -(1.0f-fabsf( upness )),
          angle_end   =   1.0f;
 
@@ -408,17 +402,14 @@ static void player__approximate_best_trajectory(void){
       inf->gravity = gravity;
       v3_copy( launch_v, inf->v );
 
-      m3x3f basis;
-      m3x3_copy( localplayer.basis, basis );
-
       for( int i=1; i<=50; i++ ){
          float t = (float)i * k_trace_delta;
 
          v3_muls( launch_v, t, co1 );
-         v3_muladds( co1, basis[1], -0.5f * gravity * t*t, co1 );
+         co1[1] += -0.5f * gravity * t*t;
          v3_add( launch_co, co1, co1 );
 
-         float launch_vy = v3_dot( launch_v,basis[1] );
+         float launch_vy = launch_v[1];
 
          int search_for_grind = 1;
          if( grind_located ) search_for_grind = 0;
@@ -439,7 +430,7 @@ static void player__approximate_best_trajectory(void){
 
                for( int j=0; j<2; j++ ){
                   v3_muls( launch_v_bounds[j], t, bound[j] );
-                  v3_muladds( bound[j], basis[1], -0.5f*gravity*t*t, bound[j] );
+                  bound[j][1] += -0.5f*gravity*t*t;
                   v3_add( launch_co, bound[j], bound[j] );
                }
 
@@ -458,14 +449,12 @@ static void player__approximate_best_trajectory(void){
          if( search_for_grind ){
             v3f ve;
             v3_copy( launch_v, ve );
-            v3_muladds( ve, basis[1], -gravity * t, ve );
+            ve[1] += -gravity * t;
 
             if( skate_grind_scansq( closest, ve, 0.5f, &grind ) ){
                /* check alignment */
-               v2f v0 = { v3_dot( ve, basis[0] ), 
-                          v3_dot( ve, basis[2] ) },
-                   v1 = { v3_dot( grind.dir, basis[0] ), 
-                          v3_dot( grind.dir, basis[2] ) };
+               v2f v0 = { ve[0], ve[2] },
+                   v1 = { grind.dir[0], grind.dir[2] };
 
                v2_normalize( v0 );
                v2_normalize( v1 );
@@ -494,7 +483,6 @@ static void player__approximate_best_trajectory(void){
                m4x3_mulv( gate->transport, co1, co1 );
                m3x3_mulv( gate->transport, launch_v, launch_v);
                m4x3_mulv( gate->transport, launch_co, launch_co );
-               m3x3_mul( gate->transport, basis, basis );
             }
          }
 
@@ -520,7 +508,7 @@ static void player__approximate_best_trajectory(void){
 
             v3f ve;
             v3_copy( launch_v, ve );
-            v3_muladds( ve, localplayer.basis[1], -gravity * t, ve );
+            ve[1] += -gravity * t;
 
             inf->score = -v3_dot( ve, inf->n );
             inf->land_dist = t + k_trace_delta * t1;
@@ -567,13 +555,10 @@ static void player__approximate_best_trajectory(void){
 
          v3_copy( jump->v, launch_v );
          v3_copy( localplayer.rb.co, launch_co );
-
-         m3x3f basis;
-         m3x3_copy( localplayer.basis, basis );
          
          float t = 0.05f * jump->land_dist;
          v3_muls( launch_v, t, co0 );
-         v3_muladds( co0, basis[1], -0.5f * jump->gravity * t*t, co0 );
+         co0[1] += -0.5f * jump->gravity * t*t;
          v3_add( launch_co, co0, co0 );
 
          /* rough scan to make sure we dont collide with anything */
@@ -584,7 +569,7 @@ static void player__approximate_best_trajectory(void){
             t *= jump->land_dist;
 
             v3_muls( launch_v, t, co1 );
-            v3_muladds( co1, basis[1], -0.5f * jump->gravity * t*t, co1 );
+            co1[1] += -0.5f * jump->gravity * t*t;
             v3_add( launch_co, co1, co1 );
             
             float t1;
@@ -605,8 +590,7 @@ static void player__approximate_best_trajectory(void){
          /* determine score */
          v3f ve;
          v3_copy( jump->v, ve );
-         v3_muladds( ve, localplayer.basis[1], 
-                     -jump->gravity*jump->land_dist, ve );
+         ve[1] += -jump->gravity*jump->land_dist;
          jump->score = -v3_dot( ve, grind.n ) * 0.9f;
 
          player_skate.possible_jumps[ player_skate.possible_jump_count ++ ] = 
@@ -677,9 +661,8 @@ invalidated_grind:;
          v3_zero( state->flip_axis );
       }
    }
-   else{
-      v3_copy( localplayer.basis[1], state->land_normal );
-   }
+   else
+      v3_copy( (v3f){0,1,0}, state->land_normal );
 }
 
 /*
@@ -939,7 +922,7 @@ static void skate_apply_jump_model(void){
       v3f jumpdir;
       
       /* Launch more up if alignment is up else improve velocity */
-      float aup = v3_dot( localplayer.basis[1], localplayer.rb.to_world[1] ),
+      float aup = localplayer.rb.to_world[1][1],
             mod = 0.5f,
             dir = mod + fabsf(aup)*(1.0f-mod);
 
@@ -1049,9 +1032,7 @@ static void skate_apply_cog_model(void){
 
    /* Apply forces & intergrate */
    v3_muladds( state->cog_v, F, -rb, state->cog_v );
-   v3_muladds( state->cog_v, localplayer.basis[1], -9.8f * k_rb_delta,
-               state->cog_v );
-
+   state->cog_v[1] += -9.8f * k_rb_delta;
    v3_muladds( state->cog, state->cog_v, k_rb_delta, state->cog );
 }
 
@@ -1497,7 +1478,7 @@ static void skate_adjust_up_direction(void){
    }
    else{
       v3f avg;
-      v3_add( localplayer.rb.to_world[1], localplayer.basis[1], avg );
+      v3_add( localplayer.rb.to_world[1], (v3f){0,1,0}, avg );
       v3_normalize( avg );
 
       v3_lerp( state->up_dir, avg,
@@ -2102,9 +2083,7 @@ static void player__skate_update(void){
          }
       }
       min_dist -= 0.2f;
-      float vy = v3_dot( localplayer.basis[1], localplayer.rb.v );
-            vy = vg_maxf( 0.0f, vy );
-
+      float vy = vg_maxf( 0.0f, localplayer.rb.v[1] );
       slap = vg_clampf( (min_dist/0.5f) + vy, 0.0f, 1.0f )*0.3f;
    }
    state->slap = vg_lerpf( state->slap, slap, 10.0f*k_rb_delta );
@@ -2305,9 +2284,7 @@ begin_collision:;
    }
 
    rb_update_transform( &localplayer.rb );
-   v3_muladds( localplayer.rb.v, localplayer.basis[1],
-               -state->gravity_bias * player_skate.substep_delta, 
-               localplayer.rb.v );
+   localplayer.rb.v[1] += -state->gravity_bias * player_skate.substep_delta;
 
    player_skate.substep -= player_skate.substep_delta;
 
index ebd9dad0cbe37b2ac50e3879006c96e0dff5726d..e269166630dfd85c0eb909fbdc8b34e3c7902867 100644 (file)
@@ -7,18 +7,14 @@
 
 static void player_walk_drop_in_vector( v3f vec ){
    v3f axis, init_dir;
-   v3_cross( localplayer.basis[1], player_walk.state.drop_in_normal, axis );
+   v3_cross( (v3f){0.0f,1.0f,0.0f}, player_walk.state.drop_in_normal, axis );
    v3_cross( axis, player_walk.state.drop_in_normal, init_dir );
    v3_normalize( init_dir );
    v3_muls( init_dir, 4.25f, vec );
 }
 
 static float player_xyspeed2(void){
-   v3f xy;
-   v3_muladds( localplayer.rb.v, localplayer.basis[1], 
-               -v3_dot( localplayer.basis[1], localplayer.rb.v ), xy );
-
-   return v3_length2(xy);
+   return v3_length2( (v3f){localplayer.rb.v[0], 0.0f, localplayer.rb.v[2]} );
 }
 
 static void player_walk_generic_to_skate( enum skate_activity init, f32 yaw ){
@@ -37,11 +33,9 @@ static void player_walk_generic_to_skate( enum skate_activity init, f32 yaw ){
    v3f dir;
    v3_copy( v, dir );
    v3_normalize( dir );
-   m3x3_mulv( localplayer.invbasis, dir, dir );
 
    q_axis_angle( localplayer.rb.q, (v3f){0.0f,1.0f,0.0f}, 
                  atan2f(-dir[0],-dir[2]) );
-   q_mul( localplayer.qbasis, localplayer.rb.q, localplayer.rb.q );
    q_normalize( localplayer.rb.q );
 
    q_mulv( localplayer.rb.q, (v3f){0.0f,1.0f,0.0f}, player_skate.state.cog );
@@ -85,7 +79,7 @@ static void player_walk_drop_in_to_skate(void){
 
 static void player_walk_drop_in_overhang_transform( f32 t, v3f co, v4f q ){
    v3f axis;
-   v3_cross( localplayer.basis[1], player_walk.state.drop_in_normal, axis );
+   v3_cross( (v3f){0,1,0}, player_walk.state.drop_in_normal, axis );
    v3_normalize( axis );
 
    float a = acosf( player_walk.state.drop_in_normal[1] ) * t;
@@ -349,7 +343,7 @@ static void player__walk_pre_update(void){
 }
 
 static int player_walk_normal_standable( v3f n ){
-   return v3_dot( n, localplayer.basis[1] ) > 0.70710678118f;
+   return n[1] > 0.70710678118f;
 }
 
 static void player_accelerate( v3f v, v3f movedir, f32 speed, f32 accel ){
@@ -451,7 +445,7 @@ static void player__walk_update(void){
 
    m4x3f mtx;
    m3x3_copy( localplayer.rb.to_world, mtx );
-   v3_add( localplayer.rb.co, localplayer.basis[1], mtx[3] );
+   v3_add( localplayer.rb.co, (v3f){0,1,0}, mtx[3] );
 
    vg_line_capsule( mtx, w->collider.radius, w->collider.height, VG__WHITE );
 
@@ -463,10 +457,6 @@ static void player__walk_update(void){
    v3f forward_dir = { -sinf(yaw),         0.0f,  cosf(yaw) };
    v3f right_dir   = {  forward_dir[2],    0.0f, -forward_dir[0] };
 
-   m3x3_mulv( localplayer.basis, forward_dir, forward_dir );
-   m3x3_mulv( localplayer.basis, right_dir,   right_dir );
-
-
    w->move_speed = localplayer.immobile? 0.0f: v2_length( steer );
 
    /* 
@@ -533,11 +523,7 @@ static void player__walk_update(void){
 
          f32 t = vg.time - w->state.jump_input_time;
          if( t < PLAYER_JUMP_EPSILON ){
-            float d = v3_dot( localplayer.basis[1], localplayer.rb.v );
-            v3_muladds( localplayer.rb.v, localplayer.basis[1], -d,
-                        localplayer.rb.v );
-            v3_muladds( localplayer.rb.v, localplayer.basis[1], 5.0f, 
-                        localplayer.rb.v );
+            localplayer.rb.v[1] = 5.0f;
             w->state.activity = k_walk_activity_air;
             prev_state = k_walk_activity_air;
             accel_speed = k_walk_air_accel;
@@ -584,8 +570,8 @@ static void player__walk_update(void){
 
       v3f pa, pb;
       v3_copy( localplayer.rb.co, pa );
-      v3_muladds( pa, localplayer.basis[1], w->collider.radius + max_dist, pa );
-      v3_muladds( pa, localplayer.basis[1], -max_dist * 2.0f, pb );
+      pa[1] += w->collider.radius + max_dist;
+      v3_add( pa, (v3f){0, -max_dist * 2.0f, 0}, pb );
       vg_line( pa, pb, 0xff000000 );
 
       v3f n;
@@ -594,16 +580,12 @@ static void player__walk_update(void){
                             w->collider.radius, &t, n, 0 ) != -1 ){
          if( player_walk_normal_standable(n) ){
             v3_lerp( pa, pb, t, localplayer.rb.co );
-            v3_muladds( localplayer.rb.co, localplayer.basis[1], 
-                        -w->collider.radius - k_penetration_slop,
-                        localplayer.rb.co );
+            localplayer.rb.co[1] += -w->collider.radius - k_penetration_slop;
             w->state.activity = k_walk_activity_ground;
 
-            float d = -v3_dot(n,localplayer.rb.v),
-                  g = -k_gravity * k_rb_delta;
+            float d = -v3_dot(n,localplayer.rb.v);
             v3_muladds( localplayer.rb.v, n, d, localplayer.rb.v );
-            v3_muladds( localplayer.rb.v, localplayer.basis[1], g, 
-                        localplayer.rb.v );
+            localplayer.rb.v[1] += -k_gravity * k_rb_delta;
          }
       }
    }
@@ -617,8 +599,7 @@ static void player__walk_update(void){
 
    /* integrate */
    if( w->state.activity == k_walk_activity_air ){
-      v3_muladds( localplayer.rb.v, localplayer.basis[1], -k_gravity*k_rb_delta, 
-                  localplayer.rb.v );
+      localplayer.rb.v[1] += -k_gravity*k_rb_delta;
    }
 
    if( localplayer.immobile ){
@@ -628,7 +609,7 @@ static void player__walk_update(void){
 
    v3_muladds( localplayer.rb.co, localplayer.rb.v, k_rb_delta, 
                localplayer.rb.co );
-   v3_add( localplayer.rb.co, localplayer.basis[1], mtx[3] );
+   v3_add( localplayer.rb.co, (v3f){0,1,0}, mtx[3] );
    vg_line_capsule( mtx, w->collider.radius, w->collider.height, VG__GREEN );
 
    /* 
@@ -657,7 +638,7 @@ static void player__walk_update(void){
          localplayer.rb.co[1] -= w->collider.radius;
          rb_update_transform( &localplayer.rb );
 
-         v3_add( localplayer.rb.co, localplayer.basis[1], mtx[3] );
+         v3_add( localplayer.rb.co, (v3f){0,1,0}, mtx[3] );
          vg_line_capsule( mtx, w->collider.radius, w->collider.height, VG__RED);
       }
    }
@@ -683,7 +664,7 @@ static void player__walk_post_update(void){
 
    m4x3f mtx;
    m3x3_copy( localplayer.rb.to_world, mtx );
-   v3_add( localplayer.rb.co, localplayer.basis[1], mtx[3] );
+   v3_add( localplayer.rb.co, (v3f){0,1,0}, mtx[3] );
 
    float substep = vg.time_fixed_extrapolate;
    v3_muladds( mtx[3], localplayer.rb.v, k_rb_delta*substep, mtx[3] );
@@ -692,15 +673,9 @@ static void player__walk_post_update(void){
 
    /* Calculate header */
    v3f v;
-   if( player_xyspeed2() > 0.1f*0.1f )
-   {
-      v3f v_xy;
-      m3x3_mulv( localplayer.invbasis, localplayer.rb.v, v_xy );
-      float a = atan2f( v_xy[0], v_xy[2] );
-
+   if( player_xyspeed2() > 0.1f*0.1f ){
+      float a = atan2f( localplayer.rb.v[0], localplayer.rb.v[2] );
       q_axis_angle( localplayer.rb.q, (v3f){0.0f,1.0f,0.0f}, a );
-      q_mul( localplayer.qbasis, localplayer.rb.q, localplayer.rb.q );
-      q_normalize( localplayer.rb.q );
    }
 
    vg_line_point( w->state.drop_in_target, 0.1f, VG__GREEN );
@@ -718,12 +693,10 @@ static void player__walk_post_update(void){
    p1[0] = sinf( a );
    p1[1] = 0.0f;
    p1[2] = cosf( a );
-   m3x3_mulv( localplayer.basis, p1, p1 );
 
    v3_add( localplayer.rb.co, p1, p1 );
    vg_line( localplayer.rb.co, p1, VG__PINK );
 
-
    int walk_phase = 0;
    if( vg_fractf(w->state.walk_timer) > 0.5f )
       walk_phase = 1;
@@ -883,8 +856,6 @@ static void player__walk_animate(void){
    }
 
    q_axis_angle( animator->root_q, (v3f){0.0f,1.0f,0.0f}, walk_yaw + VG_PIf );
-   q_mul( localplayer.qbasis, animator->root_q, animator->root_q );
-   q_normalize( animator->root_q );
 }
 
 static void player__walk_pose( void *_animator, player_pose *pose ){
@@ -1053,12 +1024,8 @@ static void player__walk_transition(void){
 
    v3f fwd = { 0.0f, 0.0f, 1.0f };
    q_mulv( localplayer.rb.q, fwd, fwd );
-   m3x3_mulv( localplayer.invbasis, fwd, fwd );
-
    q_axis_angle( localplayer.rb.q, (v3f){0.0f,1.0f,0.0f}, 
                  atan2f(fwd[0], fwd[2]) );
-   q_mul( localplayer.qbasis, localplayer.rb.q, localplayer.rb.q );
-   q_normalize( localplayer.rb.q );
 
    rb_update_transform( &localplayer.rb );
 }
index a2b8347ecb673802e1d02eb3ede6d292934c07e8..24c39a8ff9fa307ea6bc81ec6166eb0528ab7687 100644 (file)
@@ -545,6 +545,7 @@ static void skaterift_composite_maincamera(void){
 
    camera_update_transform( &skaterift.cam );
 
+#if 0 
    if( skaterift.activity != k_skaterift_respawning ){
       if( localplayer.gate_waiting ){
          m3x3_mul( localplayer.basis_gate, skaterift.cam.transform, 
@@ -555,6 +556,7 @@ static void skaterift_composite_maincamera(void){
                    skaterift.cam.transform );
       }
    }
+#endif
    
    camera_update_view( &skaterift.cam );
    camera_update_projection( &skaterift.cam );
index 5b0d5855e213ebaa0e61b2fc7eb068ec5b707bd0..d8f15ed80a4635819e39e60b26ecfb29e96500df 100644 (file)
@@ -953,7 +953,7 @@ static void workshop_render_board_preview(void){
    float dist = v3_length( basevector );
 
    v3f baseangles;
-   player_vector_angles( baseangles, basevector, 1.0f, 0.0f );
+   v3_angles( basevector, baseangles );
 
    v2_add( workshop_form.view_angles, baseangles, cam.angles );
    cam.angles[2] = 0.0f;
index 975c008c2d4910ceb48f7feb9c09f98eeccf07fe..a12e071ade86fdf4a749ea840e1f61edcc434ed7 100644 (file)
@@ -37,8 +37,7 @@ static void world_entity_focus_camera( world_instance *world, u32 uid ){
 
       v3f dir = {0.0f,-1.0f,0.0f};
       mdl_transform_vector( &cam->transform, dir, dir );
-      m3x3_mulv( localplayer.invbasis, dir, dir );
-      player_vector_angles( world_static.focus_cam.angles, dir, 1.0f, 0.0f );
+      v3_angles( dir, world_static.focus_cam.angles );
       v3_copy( cam->transform.co, world_static.focus_cam.pos );
       world_static.focus_cam.fov = cam->fov;
    }