X-Git-Url: https://harrygodden.com/git/?a=blobdiff_plain;f=skaterift.c;h=df5c1479f8fd01ea8729570474f71d2c7834567b;hb=f99902f513b0ad606437bf32de47405dd4ea5f98;hp=8b909d2e2450fb83b053d7f73c2f40dcf99ec6b1;hpb=610907ae753bdda202236d52a6fcf77d14d63193;p=carveJwlIkooP6JGAAIwe30JlM.git diff --git a/skaterift.c b/skaterift.c index 8b909d2..df5c147 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" @@ -19,10 +20,8 @@ #include "audio.h" #include "world.h" #include "font.h" - - - #include "player.h" + static player_instance localplayer; VG_STATIC struct player_avatar localplayer_avatar; VG_STATIC glmesh localplayer_meshes[3]; @@ -37,15 +36,19 @@ player_instance *tmp_localplayer(void) #include "menu.h" #include "vehicle.h" -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; } @@ -116,35 +119,8 @@ VG_STATIC void vg_preload(void) { g_conf_init(); - common_var_temp(); - - vg_var_push( (struct vg_var){ - .name = "cl_ui", - .data = &cl_ui, - .data_type = k_var_dtype_i32, - .opt_i32 = { .min=0, .max=1, .clamp=1 }, - .persistent = 0 - }); - - vg_var_push( (struct vg_var){ - .name = "ledit", - .data = &cl_light_edit, - .data_type = k_var_dtype_i32, - .opt_i32 = { .min=0, .max=1, .clamp=1 }, - .persistent = 0 - }); - - vg_function_push( (struct vg_cmd) { - .name = "respawn", - .function = __respawn, - //.poll_suggest = reset_player_poll - }); - - vg_function_push( (struct vg_cmd) { - .name = "ded", - .function = __kill, - //.poll_suggest = reset_player_poll - }); + vg_console_reg_cmd( "respawn", __respawn, NULL ); + vg_console_reg_cmd( "ded", __kill, NULL ); vg_info(" Copyright . . . -----, ,----- ,---. .---. \n" ); vg_info(" 2021-2022 |\\ /| | / | | | | /| \n" ); @@ -163,6 +139,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) @@ -218,14 +202,13 @@ VG_STATIC void vg_load(void) vg_loader_step( render_init, NULL ); vg_loader_step( menu_init, NULL ); vg_loader_step( world_init, NULL ); + vg_loader_step( vehicle_init, NULL ); vg_loader_step( font3d_init, NULL ); 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( player_model_init, NULL ); + vg_loader_step( player_init, NULL ); + vg_loader_step( player_ragdoll_init, NULL ); /* ----------------- */ vg_loader_step( load_playermodels, NULL ); @@ -279,49 +262,50 @@ VG_STATIC void vg_update(void) 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(); + 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 - world_routes_fixedupdate( get_active_world() ); - 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; @@ -388,7 +372,6 @@ VG_STATIC void vg_update_post(void) if( si >= 14 ) si = 0; - /* FIXME: TEMP */ audio_lock(); vg_dsp.echo_distances[si] = dist; @@ -409,8 +392,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 } } @@ -495,6 +490,7 @@ VG_STATIC void render_scene(void) return; } + world_prerender( view_world ); render_world( view_world, &main_camera, 0 ); render_water_texture( view_world, &main_camera, 0 ); @@ -605,42 +601,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