X-Git-Url: https://harrygodden.com/git/?a=blobdiff_plain;f=vehicle.c;h=3d68d1152793b2fbaeb29bf48460e12df055d78b;hb=137d40d96fe923600d8378b8e138e3c276f27ff4;hp=ad3e00d675e7158aa3221738626da518af5bec91;hpb=342fcbf6fda017bdd38d56ce0fa7c9e59e589f3b;p=carveJwlIkooP6JGAAIwe30JlM.git diff --git a/vehicle.c b/vehicle.c index ad3e00d..3d68d11 100644 --- a/vehicle.c +++ b/vehicle.c @@ -3,15 +3,14 @@ #include "vehicle.h" -VG_STATIC int spawn_car( int argc, const char *argv[] ) -{ +static int spawn_car( int argc, const char *argv[] ){ v3f ra, rb, rx; - v3_copy( main_camera.pos, ra ); - v3_muladds( ra, main_camera.transform[2], -10.0f, rb ); + v3_copy( skaterift.cam.pos, ra ); + v3_muladds( ra, skaterift.cam.transform[2], -10.0f, rb ); float t; if( spherecast_world( world_current_instance(), ra, rb, - gzoomer.obj.inf.sphere.radius, &t, rx ) != -1 ) + gzoomer.obj.inf.sphere.radius, &t, rx, 0 ) != -1 ) { v3_lerp( ra, rb, t, gzoomer.obj.rb.co ); gzoomer.obj.rb.co[1] += 4.0f; @@ -31,7 +30,7 @@ VG_STATIC int spawn_car( int argc, const char *argv[] ) return 0; } -VG_STATIC void vehicle_init(void) +static void vehicle_init(void) { q_identity( gzoomer.obj.rb.q ); v3_zero( gzoomer.obj.rb.w ); @@ -59,7 +58,7 @@ VG_STATIC void vehicle_init(void) v3_copy((v3f){ 1.0f, -0.25f, 1.5f }, gzoomer.wheels_local[3] ); } -VG_STATIC void vehicle_wheel_force( int index ) +static void vehicle_wheel_force( int index ) { v3f pa, pb, n; m4x3_mulv( gzoomer.obj.rb.to_world, gzoomer.wheels_local[index], pa ); @@ -69,7 +68,7 @@ VG_STATIC void vehicle_wheel_force( int index ) #if 1 float t; if( spherecast_world( world_current_instance(), pa, pb, - k_car_wheel_radius, &t, n ) == -1 ) + k_car_wheel_radius, &t, n, 0 ) == -1 ) { t = 1.0f; } @@ -92,7 +91,7 @@ VG_STATIC void vehicle_wheel_force( int index ) m4x3f mtx; m3x3_copy( gzoomer.obj.rb.to_world, mtx ); v3_copy( pc, mtx[3] ); - debug_sphere( mtx, k_car_wheel_radius, VG__BLACK ); + vg_line_sphere( mtx, k_car_wheel_radius, VG__BLACK ); vg_line( pa, pc, VG__WHITE ); v3_copy( pc, gzoomer.wheels[index] ); @@ -166,7 +165,7 @@ VG_STATIC void vehicle_wheel_force( int index ) } } -VG_STATIC void vehicle_solve_friction(void) +static void vehicle_solve_friction(void) { rigidbody *rb = &gzoomer.obj.rb; for( int i=0; i<4; i++ ){ @@ -199,7 +198,7 @@ VG_STATIC void vehicle_solve_friction(void) } } -VG_STATIC void vehicle_update_fixed(void) +static void vehicle_update_fixed(void) { if( !gzoomer.alive ) return; @@ -226,7 +225,7 @@ VG_STATIC void vehicle_update_fixed(void) rb_ct manifold[64]; int len = rb_sphere__scene( rb->to_world, &gzoomer.obj.inf.sphere, NULL, &world_current_instance()->rb_geo.inf.scene, - manifold ); + manifold, 0 ); for( int j=0; jrb_geo.rb; @@ -250,7 +249,7 @@ VG_STATIC void vehicle_update_fixed(void) rb_update_transform( rb ); } -VG_STATIC void vehicle_update_post(void) +static void vehicle_update_post(void) { if( !gzoomer.alive ) return;