update helpers/location to 'frosted' ui
[carveJwlIkooP6JGAAIwe30JlM.git] / vehicle.c
index 0576963e1f59ff8f4bfd0c541c9a7e9f8813a2a6..35004d6a81c08cbd323622a5bcce7c9ccf32e442 100644 (file)
--- a/vehicle.c
+++ b/vehicle.c
@@ -1,10 +1,14 @@
-#ifndef VEHICLE_C
-#define VEHICLE_C
-
+#include "skaterift.h"
 #include "vehicle.h"
 #include "scene_rigidbody.h"
 
-static int spawn_car( int argc, const char *argv[] ){
+struct drivable_vehicle gzoomer =
+{
+   .rb.co = {-2000,-2000,-2000}
+};
+
+int spawn_car( int argc, const char *argv[] )
+{
    v3f ra, rb, rx;
    v3_copy( skaterift.cam.pos, ra );
    v3_muladds( ra, skaterift.cam.transform[2], -10.0f, rb );
@@ -31,7 +35,8 @@ static int spawn_car( int argc, const char *argv[] ){
    return 0;
 }
 
-static void vehicle_init(void){
+void vehicle_init(void)
+{
    q_identity( gzoomer.rb.q );
    v3_zero( gzoomer.rb.w );
    v3_zero( gzoomer.rb.v );
@@ -58,7 +63,8 @@ static void vehicle_init(void){
    v3_copy((v3f){  1.0f, -0.25f,  1.5f }, gzoomer.wheels_local[3] );
 }
 
-static void vehicle_wheel_force( int index ){
+void vehicle_wheel_force( int index )
+{
    v3f pa, pb, n;
    m4x3_mulv( gzoomer.rb.to_world, gzoomer.wheels_local[index], pa );
    v3_muladds( pa, gzoomer.rb.to_world[1], -k_car_spring_length, pb );
@@ -164,7 +170,8 @@ static void vehicle_wheel_force( int index ){
    }
 }
 
-static void vehicle_solve_friction(void){
+void vehicle_solve_friction(void)
+{
    rigidbody *rb = &gzoomer.rb;
    for( int i=0; i<4; i++ ){
       v3f raW;
@@ -196,7 +203,7 @@ static void vehicle_solve_friction(void){
    }
 }
 
-static void vehicle_update_fixed(void)
+void vehicle_update_fixed(void)
 {
    if( !gzoomer.alive )
       return;
@@ -251,7 +258,8 @@ static void vehicle_update_fixed(void)
    rb_update_matrices( rb );
 }
 
-static void vehicle_update_post(void){
+void vehicle_update_post(void)
+{
    if( !gzoomer.alive )
       return;
 
@@ -269,5 +277,3 @@ static void vehicle_update_post(void){
       vg_line( p0, py, VG__GREEN );
    }
 }
-
-#endif /* VEHICLE_H */