X-Git-Url: https://harrygodden.com/git/?a=blobdiff_plain;f=skaterift.c;h=7b1d1d15dbcc723067562329187f0bff4676e56f;hb=01e2535f8daaab0e3d46dcc61a08a9268babd47c;hp=9c83a88f4caccb02bea424f7304ff097687e1b09;hpb=e5dfbef890431a69291a9f0a9ca4a88ea8d0705a;p=carveJwlIkooP6JGAAIwe30JlM.git diff --git a/skaterift.c b/skaterift.c index 9c83a88..7b1d1d1 100644 --- a/skaterift.c +++ b/skaterift.c @@ -12,6 +12,7 @@ */ #define SR_NETWORKED +#define VG_DEVWINDOW #include "common.h" #include "conf.h" #include "steam.h" @@ -21,7 +22,6 @@ #include "font.h" - #include "player.h" static player_instance localplayer; VG_STATIC struct player_avatar localplayer_avatar; @@ -40,12 +40,19 @@ player_instance *tmp_localplayer(void) static int cl_ui = 1, cl_light_edit = 0; +#define DEV_AARON +#ifdef DEV_AARON +static rb_object aaron={ + .type=k_rb_shape_box, + .rb.bbx = {{ -2.0f, -1.0f, -1.0f }, { 2.0f, 1.0f, 1.0f }} +}; +#endif + int main( int argc, char *argv[] ) { vg_mem.use_libc_malloc = 0; vg_set_mem_quota( 160*1024*1024 ); vg_enter( argc, argv, "Voyager Game Engine" ); - return 0; } @@ -163,6 +170,14 @@ vg_info(" ' ' '--' [] '----- '----- ' ' '---' " steam_init(); vg_loader_step( NULL, steam_end ); vg_loader_step( network_init, network_end ); + +#ifdef DEV_AARON + q_identity( aaron.rb.q ); + v3_zero( aaron.rb.w ); + v3_zero( aaron.rb.co ); + v3_zero( aaron.rb.v ); + rb_init_object( &aaron ); +#endif } VG_STATIC void load_playermodels(void) @@ -223,7 +238,7 @@ VG_STATIC void vg_load(void) font3d_load( &world_global.font, "models/rs_font.mdl", vg_mem.rtmemory ); //vg_loader_step( player_init, NULL ); - //vg_loader_step( vehicle_init, NULL ); + vg_loader_step( vehicle_init, NULL ); // //vg_loader_step( player_model_init, NULL ); @@ -275,55 +290,54 @@ VG_STATIC void vg_update(void) { steam_update(); - if( vg.is_loaded ) - { + if( vg.is_loaded ){ draw_origin_axis(); network_update(); -#if 0 - if( !gzoomer.inside ) - player_update_pre(); -#endif - player__pre_update( &localplayer ); - world_update( get_active_world(), localplayer.rb.co ); - audio_update(); + world_update( get_active_world(), localplayer.rb.co ); + audio_ambient_sprites_update( get_active_world(), localplayer.rb.co ); } } VG_STATIC void vg_update_fixed(void) { - if( vg.is_loaded ) - { -#if 0 - if( !gzoomer.inside ) - player_update_fixed(); + if( vg.is_loaded ){ + world_routes_fixedupdate( get_active_world() ); + player__update( &localplayer ); vehicle_update_fixed(); + +#ifdef DEV_AARON + world_instance *world = get_active_world(); + rb_solver_reset(); + rb_ct *buf = rb_global_buffer(); + + int l = rb_box__scene( aaron.rb.to_world, aaron.rb.bbx, + NULL, &world->rb_geo.inf.scene, buf ); + for( int j=0; jrb_geo.rb; + } + rb_contact_count += l; + rb_presolve_contacts( rb_contact_buffer, rb_contact_count ); + + for( int j=0; j<8; j++ ){ + rb_solve_contacts( rb_contact_buffer, rb_contact_count ); + } + + rb_iter( &aaron.rb ); + rb_update_transform( &aaron.rb ); #endif - player__update( &localplayer ); } } VG_STATIC void vg_update_post(void) { - if( vg.is_loaded ) - { -#if 0 - if( gzoomer.inside ) - { - vehicle_camera(); - } - else - { - player_update_post(); - } -#endif - + if( vg.is_loaded ){ player__post_update( &localplayer ); - float inr3 = 0.57735027, inr2 = 0.70710678118; @@ -390,7 +404,6 @@ VG_STATIC void vg_update_post(void) if( si >= 14 ) si = 0; - /* FIXME: TEMP */ audio_lock(); vg_dsp.echo_distances[si] = dist; @@ -411,8 +424,20 @@ VG_STATIC void vg_update_post(void) audio_unlock(); menu_update(); -#if 0 vehicle_update_post(); + +#ifdef DEV_AARON + SDL_Scancode sc = SDL_GetScancodeFromKey( SDLK_q ); + if( vg_input.sdl_keys[sc] ){ + m4x3_mulv( main_camera.transform, (v3f){0.0f,0.0f,-3.0f}, + aaron.rb.co ); + + v3_zero( aaron.rb.v ); + v3_zero( aaron.rb.w ); + rb_update_transform( &aaron.rb ); + } + + rb_object_debug( &aaron, VG__PINK ); #endif } } @@ -607,42 +632,5 @@ VG_STATIC void vg_ui(void) world_instance *world = get_active_world(); menu_crap_ui(); - audio_debug_soundscapes(); render_view_framebuffer_ui(); - -#if 0 - player_physics_gui(); -#endif -} - -VG_STATIC void run_debug_info(void) -{ -#if 0 - char buf[40]; - - snprintf( buf, 40, "%.2fm/s", v3_length( player.rb.v ) ); - ui_text( (ui_px [2]){ 0, 0 }, buf, 1, k_text_align_left ); - - snprintf( buf, 40, "%.2f %.2f %.2f m/s", - player.phys.a[0], player.phys.a[1], player.phys.a[2] ); - ui_text( (ui_px [2]){ 0, 20 }, buf, 1, k_text_align_left ); - - snprintf( buf, 40, "pos %.2f %.2f %.2f", - player.phys.rb.co[0], player.phys.rb.co[1], player.phys.rb.co[2] ); - ui_text( (ui_px [2]){ 0, 40 }, buf, 1, k_text_align_left ); - - if( vg_input.controller_handle ) - { - for( int i=0; i