X-Git-Url: https://harrygodden.com/git/?a=blobdiff_plain;f=player_remote.h;h=265409c873933cca4a665002c1bd773a1a44f4bd;hb=74b2136d5b41b18e2eec698f1fd11b503aa1100a;hp=bd5f6ddafdd61831753486100ab44da071b3c6cf;hpb=46f4e9ee87dc67402166e4c6b05efbe922cd7574;p=carveJwlIkooP6JGAAIwe30JlM.git diff --git a/player_remote.h b/player_remote.h index bd5f6dd..265409c 100644 --- a/player_remote.h +++ b/player_remote.h @@ -3,26 +3,89 @@ #include "player.h" #include "network.h" +#include "network_common.h" +#include "player_effects.h" + +#define NETWORK_SFX_QUEUE_LENGTH 12 struct { struct network_player { - int active; + int active, isfriend, isblocked; + u64 steamid; u16 board_view_slot, playermodel_view_slot; - player_pose pose; + enum player_subsystem subsystem; - char username[32]; + /* this is set IF they exist in a world that we have loaded */ + world_instance *active_world; + int world_match[ k_world_max ]; + u32 location_pstr; /* TODO: valid if active_world set. */ - enum player_subsystem subsystem; - union { - struct player_skate_animator _skate; - struct player_walk_animator _walk; - struct player_dead_animator _dead; - }; + /* TODO: Compression with server code */ + char username[ NETWORK_USERNAME_MAX ]; + char items[k_netmsg_playeritem_max][ADDON_UID_MAX]; + char chat[ NETWORK_MAX_CHAT ]; + char region[ NETWORK_REGION_MAX ]; + u32 region_flags; + f64 chat_time; + + /* ui */ + u32 medals[3]; + f32 opacity; + + u32 down_bytes; + f32 down_kbs; + + struct player_effects_data effect_data; + } + list[ NETWORK_MAX_PLAYERS ]; + + struct interp_buffer { + /* collect the most recent 6 frames of animation data */ + struct interp_frame { + int active; + f64 timestamp; + enum player_subsystem subsystem; + + u8 instance_id; + u16 boundary_hash; + + union interp_animdata { + /* these aren't accessed directly, just used to take the + * max(sizeof) all systems */ + struct player_skate_animator __skate; + struct player_walk_animator __walk; + struct player_dead_animator __dead; + struct player_basic_info_animator __basic; + } + data; + } + frames[ NETWORK_BUFFERFRAMES ]; + + f64 t; } - list[ 32 ]; + interp_data[ NETWORK_MAX_PLAYERS ]; + + struct net_sfx sfx_queue[ NETWORK_SFX_QUEUE_LENGTH ]; + + m4x3f *final_mtx; + struct player_board_pose board_poses[ NETWORK_MAX_PLAYERS ]; + + u32 up_bytes; + f32 up_kbs, down_kbs; + f64 last_data_measurement; + + int chatting; + char chat_buffer[ NETWORK_MAX_CHAT ], chat_message[ NETWORK_MAX_CHAT ]; + f64 chat_time; } static netplayers; -static void player_remote_packet( SteamNetworkingMessage_t *msg ); +static void player_remote_rx_200_300( SteamNetworkingMessage_t *msg ); +static void remote_player_debug_update(void); +static void remote_player_send_playerframe(void); +static void animate_remote_player( u32 index ); +static void render_remote_players( world_instance *world, camera *cam ); +static void relink_all_remote_player_worlds(void); +static void player_remote_update_friendflags( struct network_player *remote ); #endif /* PLAYER_REMOTE_H */