X-Git-Url: https://harrygodden.com/git/?a=blobdiff_plain;f=main.c;h=175f12efe879a4af4a8244c231bf57fd3f47117a;hb=89032d64e2867adb66e4598a0c66d3e853a22bb0;hp=d8a2cebab93c4ce3c1c832a8796067ea6328a798;hpb=be0f28b651e5c39943e476c0cd68c146e9952857;p=carveJwlIkooP6JGAAIwe30JlM.git diff --git a/main.c b/main.c index d8a2ceb..175f12e 100644 --- a/main.c +++ b/main.c @@ -20,6 +20,14 @@ static int lightedit = 0; static int sv_scene = 0; /* Components */ +#define SR_NETWORKED + +/* uncomment this to run the game without any graphics being drawn */ +//#define SR_NETWORK_TEST + +#include "steam.h" +#include "network.h" + #include "road.h" #include "scene.h" #include "ik.h" @@ -93,6 +101,8 @@ static int playermodel( int argc, char const *argv[] ) void vg_start(void) { + steam_init(); + vg_convar_push( (struct vg_convar){ .name = "fc", .data = &freecam, @@ -166,13 +176,15 @@ void vg_start(void) if( sv_scene == 0 ) { - character_load( &player.mdl, "ch_outlaw" ); + character_load( &player.mdl, "ch_default" ); character_init_ragdoll( &player.mdl ); world_load(); reset_player( 1, (const char *[]){ "start" } ); rb_init( &player.rb ); + + network_init(); } else { @@ -182,13 +194,19 @@ void vg_start(void) void vg_free(void) { + network_end(); vg_tex2d_free( texture_list, vg_list_size(texture_list) ); + /* TODO: THE REST OF THE GOD DAMN FREEING STUFF */ + steam_end(); } void vg_update(void) { + steam_update(); + if( sv_scene == 0 ) { + network_update(); player_update(); world_update(); //traffic_visualize( world.traffic, world.traffic_count ); @@ -231,7 +249,7 @@ static void render_main_game(void) gpipeline.fov = freecam? 60.0f: 135.0f; /* 120 */ m4x4_projection( vg_pv, gpipeline.fov, (float)vg_window_x / (float)vg_window_y, - 0.1f, 2100.0f ); + 0.02f, 2100.0f ); m4x4_mul( vg_pv, world_4x4, vg_pv ); @@ -240,20 +258,15 @@ static void render_main_game(void) /* * Draw world */ - + render_world( vg_pv, player.camera ); render_water_texture( player.camera ); glBindFramebuffer( GL_FRAMEBUFFER, 0 ); render_water_surface( vg_pv, player.camera ); - vg_tex2d_bind( &tex_water, 1 ); - - for( int i=0; i