X-Git-Url: https://harrygodden.com/git/?a=blobdiff_plain;f=player_remote.c;h=7256fbd08548feb7cf7b2d39127bd25b071eeccf;hb=3b1909cad505b859b9c6524498b1969cd018af8c;hp=82bc3da24ab24d29ed82d754fac781211ff6c188;hpb=15c0b8cb57ed5d10814103eaa0b5c06e8ae117e4;p=carveJwlIkooP6JGAAIwe30JlM.git diff --git a/player_remote.c b/player_remote.c index 82bc3da..7256fbd 100644 --- a/player_remote.c +++ b/player_remote.c @@ -6,6 +6,7 @@ #include "font.h" #include "gui.h" #include "ent_miniworld.h" +#include "ent_region.h" static i32 k_show_own_name = 0; @@ -285,6 +286,20 @@ static void player_remote_rx_200_300( SteamNetworkingMessage_t *msg ){ player->chat_time = vg.time_real; vg_info( "[%d]: %s\n", chat->client, player->chat ); } + else if( tmp->inetmsg_id == k_inetmsg_region ){ + netmsg_region *region = msg->m_pData; + struct network_player *player = &netplayers.list[ region->client ]; + + u32 l = network_msgstring( + region->loc, msg->m_cbSize, sizeof(netmsg_region), + player->region, NETWORK_REGION_MAX ); + player->region_flags = region->flags; + + if( l ) + player->region_flags |= k_ent_region_flag_hasname; + + player->effect_data.spark.colour = region_spark_colour(region->flags); + } } /* @@ -368,6 +383,20 @@ static void remote_player_debug_update(void){ * Debugging information */ static void remote_player_network_imgui( m4x4f pv ){ + if( network_client.user_intent == k_server_intent_online ){ + if( !(steam_ready && + (network_client.state == k_ESteamNetworkingConnectionState_Connected))) + { + char buf[128]; + vg_str str; + vg_strnull( &str, buf, sizeof(buf) ); + u32 fg = 0; + network_status_string( &str, &fg ); + ui_text( (ui_rect){ vg.window_x - 200, 0, 200, 48 }, buf, 1, + k_ui_align_middle_center, fg ); + } + } + if( !network_client.network_info ) return; @@ -431,6 +460,11 @@ static void remote_player_network_imgui( m4x4f pv ){ } } +static void remote_player_effect( struct network_player *player, + player_pose *final_pose ){ + /* effects */ +} + /* * write the remote players final_mtx */ @@ -448,6 +482,9 @@ static void pose_remote_player( u32 index, struct player_subsystem_interface *sys0 = player_subsystems[f0->subsystem], *sys1 = NULL; + struct player_board *board = + addon_cache_item_if_loaded( k_addon_type_board, player->board_view_slot ); + player_pose pose0, pose1, posed; sys0->pose( &f0->data, &pose0 ); @@ -471,15 +508,28 @@ static void pose_remote_player( u32 index, } instance_id = f1->instance_id; - lerp_player_pose( &pose0, &pose1, t, &posed ); + effect_blink_apply( &player->effect_data.blink, &posed, vg.time_delta ); + apply_full_skeleton_pose( sk, &posed, final_mtx ); + + if( t < 0.5f ){ + if( sys0->effects ) + sys0->effects( &f0->data, final_mtx, board, &player->effect_data ); + } + else{ + if( sys1->effects ) + sys1->effects( &f1->data, final_mtx, board, &player->effect_data ); + } + memcpy( board_pose, &posed.board, sizeof(*board_pose) ); } else { instance_id = f0->instance_id; - + effect_blink_apply( &player->effect_data.blink, &pose0, vg.time_delta ); apply_full_skeleton_pose( sk, &pose0, final_mtx ); + if( sys0->effects ) + sys0->effects( &f0->data, final_mtx, board, &player->effect_data ); memcpy( board_pose, &pose0.board, sizeof(*board_pose) ); } @@ -831,9 +881,14 @@ static void remote_players_imgui_lobby(void){ if( !player->isfriend && !in_same_world ) continue; + + const char *location = in_same_world? "": "another world"; + if( player->region_flags & k_ent_region_flag_hasname ){ + location = player->region; + } ui_rect box = { x, y, width, height }; - remote_player_gui_info( box, player->username, "", + remote_player_gui_info( box, player->username, location, player->isfriend, in_same_world ); y += height + gap; } @@ -841,7 +896,7 @@ static void remote_players_imgui_lobby(void){ static void remote_players_imgui_world( world_instance *world, m4x4f pv, f32 max_dist, int geo_cull ){ - ui_flush( k_ui_shader_colour ); + ui_flush( k_ui_shader_colour, vg.window_x, vg.window_y ); for( u32 i=0; iopacity; - ui_flush( k_ui_shader_colour ); + ui_flush( k_ui_shader_colour, vg.window_x, vg.window_y ); } } vg_ui.colour[3] = 1.0f; remote_player_world_gui( pv, localplayer.rb.co, NULL ); - ui_flush( k_ui_shader_colour ); + ui_flush( k_ui_shader_colour, vg.window_x, vg.window_y ); } static void chat_escape(void){