X-Git-Url: https://harrygodden.com/git/?a=blobdiff_plain;f=player_remote.c;h=e910170ca3f2d4462adc4a9d1b42811fe4bc39ff;hb=78cc452a8343821ba47c0905d755657847dafd25;hp=7256fbd08548feb7cf7b2d39127bd25b071eeccf;hpb=3b1909cad505b859b9c6524498b1969cd018af8c;p=carveJwlIkooP6JGAAIwe30JlM.git diff --git a/player_remote.c b/player_remote.c index 7256fbd..e910170 100644 --- a/player_remote.c +++ b/player_remote.c @@ -616,6 +616,8 @@ static void render_remote_players( world_instance *world, camera *cam ){ struct network_player *player = &netplayers.list[i]; if( !player->active || player->isblocked ) continue; if( player->active_world != world ) continue; + if( !player->isfriend && + (world-world_static.instances == k_world_purpose_hub)) continue; m4x3f *final_mtx = &netplayers.final_mtx[ sk->bone_count*i ]; @@ -640,10 +642,12 @@ static int remote_players_randomize( int argc, const char *argv[] ){ for( int i=0; iactive = (vg_randu32() & 0x1)? 2: 0; - player->isfriend = vg_randu32() & vg_randu32() & 0x1; - player->isblocked = vg_randu32() & vg_randu32() & vg_randu32() & 0x1; - player->world_match[ 0 ] = vg_randu32() & 0x1; + player->active = (vg_randu32(&vg.rand) & 0x1)? 2: 0; + player->isfriend = vg_randu32(&vg.rand) & vg_randu32(&vg.rand) & 0x1; + player->isblocked = vg_randu32(&vg.rand) & + vg_randu32(&vg.rand) & + vg_randu32(&vg.rand) & 0x1; + player->world_match[ 0 ] = vg_randu32(&vg.rand) & 0x1; player->world_match[ 1 ] = 0; if( player->world_match[0] ) @@ -652,20 +656,20 @@ static int remote_players_randomize( int argc, const char *argv[] ){ player->active_world = NULL; for( int i=0; iusername)-1; i ++ ){ - player->username[i] = 'a' + (vg_randu32() % 30); + player->username[i] = 'a' + (vg_randu32(&vg.rand) % 30); player->username[i+1] = '\0'; - if( (vg_randu32() % 8) == 3 ) + if( (vg_randu32(&vg.rand) % 8) == 3 ) break; } for( int i=0; i<3; i ++ ){ - player->medals[i] = vg_randu32() % 3; + player->medals[i] = vg_randu32(&vg.rand) % 3; } v3f pos; - vg_rand_sphere( pos ); + vg_rand_sphere( &vg.rand, pos ); v3_muladds( localplayer.rb.co, pos, 100.0f, netplayers.final_mtx[ i*localplayer.skeleton.bone_count][3] ); } @@ -855,15 +859,20 @@ static void remote_player_gui_info( ui_rect box, } static void remote_players_imgui_lobby(void){ - /* - * TODO: send location string over the network */ + if( network_client.user_intent == k_server_intent_online ){ + if( !(steam_ready && + (network_client.state == k_ESteamNetworkingConnectionState_Connected))) + { + return; + } + } ui_px y = 50, width = 200, height = 42, gap = 2, x = vg.window_x - width; vg_ui.font = &vg_ui_font_big; ui_text( (ui_rect){ x, 0, width, height }, - "Online Players", 1, k_ui_align_middle_center, 0 ); + "In World", 1, k_ui_align_middle_center, 0 ); vg_ui.font = &vg_ui_font_small; @@ -877,8 +886,7 @@ static void remote_players_imgui_lobby(void){ struct network_player *player = &netplayers.list[i]; if( !player->active || player->isblocked ) continue; - int in_same_world = player->active_world != world_current_instance(); - + int in_same_world = player->active_world == world_current_instance(); if( !player->isfriend && !in_same_world ) continue; @@ -906,6 +914,8 @@ static void remote_players_imgui_world( world_instance *world, m4x4f pv, if( !player->active_world ) continue; + if( !player->isfriend && + (world-world_static.instances == k_world_purpose_hub)) continue; /* their in our active subworld */ if( player->active_world != world ){