afef269aec7ee42eb1e18c7c154a43d2458d03cc
[carveJwlIkooP6JGAAIwe30JlM.git] / player_remote.h
1 #ifndef PLAYER_REMOTE_H
2 #define PLAYER_REMOTE_H
3
4 #include "player.h"
5 #include "network.h"
6 #include "network_common.h"
7
8 struct {
9 struct network_player {
10 int active;
11 u16 board_view_slot, playermodel_view_slot;
12 enum player_subsystem subsystem;
13
14 /* this is set IF they exist in a world that we have loaded */
15 world_instance *active_world;
16 int hub_match, client_match;
17
18 /* TODO: Compression with server code */
19 char username[ NETWORK_USERNAME_MAX ];
20 char items[k_netmsg_playeritem_max][ADDON_UID_MAX];
21
22 u32 down_bytes;
23 f32 down_kbs;
24 }
25 list[ NETWORK_MAX_PLAYERS ];
26
27 struct interp_buffer {
28 /* collect the most recent 6 frames of animation data */
29 struct interp_frame {
30 int active;
31 f64 timestamp;
32 enum player_subsystem subsystem;
33
34 u8 instance_id;
35 u16 boundary_hash;
36
37 union interp_animdata {
38 struct player_skate_animator _skate;
39 struct player_walk_animator _walk;
40 struct player_dead_animator _dead;
41 }
42 data;
43 }
44 frames[6];
45
46 f64 t;
47 }
48 interp_data[ NETWORK_MAX_PLAYERS ];
49
50 m4x3f *final_mtx;
51 struct player_board_pose board_poses[ NETWORK_MAX_PLAYERS ];
52
53 u32 up_bytes;
54 f32 up_kbs, down_kbs;
55 f64 last_data_measurement;
56 }
57 static netplayers;
58
59 static void player_remote_rx_200_300( SteamNetworkingMessage_t *msg );
60 static void remote_player_debug_update(void);
61 static void remote_player_send_playerframe(void);
62 static void animate_remote_player( u32 index );
63 static void render_remote_players( world_instance *world, camera *cam );
64 static void relink_all_remote_player_worlds(void);
65
66 #endif /* PLAYER_REMOTE_H */