X-Git-Url: https://harrygodden.com/git/?a=blobdiff_plain;f=skaterift.c;h=acb0a2e7af66df6ada950ee5a0df795c011eaf7b;hb=e8a65239f85784e2e596d2622c2baddda9fb5fae;hp=e8b1f4dd5e3dea85dee98e0abfe75372d50f0041;hpb=b3ca3b7a45eec11c46eb19772e10021177665adb;p=carveJwlIkooP6JGAAIwe30JlM.git diff --git a/skaterift.c b/skaterift.c index e8b1f4d..acb0a2e 100644 --- a/skaterift.c +++ b/skaterift.c @@ -11,6 +11,8 @@ * ============================================================================= */ +#if 1 + #define SR_NETWORKED #define VG_DEVWINDOW #include "common.h" @@ -23,6 +25,7 @@ #include "player.h" #include "entity.c" +#include "workshop.c" VG_STATIC struct player_avatar localplayer_avatar; VG_STATIC struct player_model localplayer_models[3]; @@ -32,14 +35,6 @@ VG_STATIC int skaterift_status = 0; #include "menu.h" #include "vehicle.h" -#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; @@ -78,14 +73,6 @@ 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) @@ -130,6 +117,7 @@ VG_STATIC void vg_load(void) vg_loader_step( player_init, NULL ); vg_loader_step( player_ragdoll_init, NULL ); + vg_loader_step( workshop_init, NULL ); vg_loader_step( skateshop_init, NULL ); /* ----------------- */ @@ -149,7 +137,6 @@ VG_STATIC void vg_load(void) vg_loader_step( audio_init, audio_free ); /* 'systems' are completely loaded now */ - /* load home world */ #if 1 @@ -203,29 +190,6 @@ VG_STATIC void vg_update_fixed(void) 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 - } } @@ -256,21 +220,8 @@ VG_STATIC void vg_update_post(void) audio_unlock(); menu_update(); + vg.time_rate = 1.0f-menu.factive; 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 } } @@ -301,7 +252,7 @@ VG_STATIC void present_view_with_post_processing(void) shader_blitblur_uInverseRatio( inverse ); v2f menu_blurring; - v2_muls( (v2f){ 0.04f, 0.001f }, menu_opacity, menu_blurring ); + v2_muls( (v2f){ 0.04f, 0.001f }, menu.factive, menu_blurring ); shader_blitblur_uOverrideDir( menu_blurring ); render_fb_bind_texture( gpipeline.fb_main, 0, 0 ); @@ -375,37 +326,11 @@ VG_STATIC void render_scene_gate_subview(void) VG_STATIC void render_main_game(void) { -#if 0 - static float fov = 60.0f; - float fov_target = vg_lerpf( 90.0f, 110.0f, cl_fov ); - - if( player.controller == k_player_controller_skate ) - fov_target = vg_lerpf( 97.0f, 135.0f, cl_fov ); - - if( cl_menu ) - fov_target = menu_fov_target; - fov = vg_lerpf( fov, fov_target, vg.frame_delta * 2.0f ); - fov = freecam? 60.0f: fov; - - main_camera.fov = fov; -#endif - player__pre_render( &localplayer ); + main_camera.fov = localplayer.cam.fov; + v3_copy( localplayer.cam.pos, main_camera.pos ); + v3_copy( localplayer.cam.angles, main_camera.angles ); - v3_lerp( localplayer.cam.pos, menu_camera_pos, menu_opacity, - main_camera.pos ); - main_camera.angles[0] = - vg_alerpf( localplayer.cam.angles[0], menu_camera_angles[0], - menu_opacity ); - main_camera.angles[1] = - vg_lerpf ( localplayer.cam.angles[1], menu_camera_angles[1], - menu_opacity ); - - main_camera.fov = vg_lerpf( localplayer.cam.fov, menu_smooth_fov, - menu_opacity ); - - main_camera.fov = vg_lerpf( main_camera.fov, 90.0f, - global_skateshop.factive ); main_camera.nearz = 0.1f; main_camera.farz = 2100.0f; @@ -428,20 +353,17 @@ VG_STATIC void render_main_game(void) render_scene(); - if( cl_menu ) { - //glClear( GL_DEPTH_BUFFER_BIT ); - menu_render_bg(); - glEnable( GL_DEPTH_TEST ); - } + glEnable( GL_DEPTH_TEST ); render_player_transparent(); render_scene_gate_subview(); present_view_with_post_processing(); - if( cl_menu ) - menu_render_fg( &main_camera ); - + if( menu.active ){ + glClear( GL_DEPTH_BUFFER_BIT ); + menu_render(); + } /* =========== End Frame =========== */ } @@ -456,6 +378,7 @@ VG_STATIC void vg_render(void) glViewport( 0,0, vg.window_x, vg.window_y ); glDisable( GL_DEPTH_TEST ); + glDisable( GL_BLEND ); glClearColor( 1.0f, 0.0f, 0.0f, 0.0f ); glClear( GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT ); @@ -472,7 +395,7 @@ VG_STATIC void vg_render(void) gui_draw(); } -VG_STATIC void vg_ui(void) +VG_STATIC void vg_gui(void) { if( skaterift_status == 0 ){ return; @@ -482,7 +405,13 @@ VG_STATIC void vg_ui(void) player__im_gui( &localplayer ); #endif world_instance *world = get_active_world(); - menu_crap_ui(); - + + workshop_form_gui(); render_view_framebuffer_ui(); } + +#else + +#include "skaterift_imgui_dev.c" + +#endif