forgot to lock!
[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 #define NETWORK_SFX_QUEUE_LENGTH 12
9
10 struct {
11 struct network_player {
12 int active, isfriend, isblocked;
13 u64 steamid;
14 u16 board_view_slot, playermodel_view_slot;
15 enum player_subsystem subsystem;
16
17 /* this is set IF they exist in a world that we have loaded */
18 world_instance *active_world;
19 int world_match[ k_world_max ];
20 u32 location_pstr; /* TODO: valid if active_world set. */
21
22 /* TODO: Compression with server code */
23 char username[ NETWORK_USERNAME_MAX ];
24 char items[k_netmsg_playeritem_max][ADDON_UID_MAX];
25 char chat[ NETWORK_MAX_CHAT ];
26 f64 chat_time;
27
28 /* ui */
29 u32 medals[3];
30 f32 opacity;
31
32 u32 down_bytes;
33 f32 down_kbs;
34 }
35 list[ NETWORK_MAX_PLAYERS ];
36
37 struct interp_buffer {
38 /* collect the most recent 6 frames of animation data */
39 struct interp_frame {
40 int active;
41 f64 timestamp;
42 enum player_subsystem subsystem;
43
44 u8 instance_id;
45 u16 boundary_hash;
46
47 union interp_animdata {
48 struct player_skate_animator _skate;
49 struct player_walk_animator _walk;
50 struct player_dead_animator _dead;
51 }
52 data;
53 }
54 frames[ NETWORK_BUFFERFRAMES ];
55
56 f64 t;
57 }
58 interp_data[ NETWORK_MAX_PLAYERS ];
59
60 struct net_sfx sfx_queue[ NETWORK_SFX_QUEUE_LENGTH ];
61
62 m4x3f *final_mtx;
63 struct player_board_pose board_poses[ NETWORK_MAX_PLAYERS ];
64
65 u32 up_bytes;
66 f32 up_kbs, down_kbs;
67 f64 last_data_measurement;
68
69 int chatting;
70 char chat_buffer[ NETWORK_MAX_CHAT ], chat_message[ NETWORK_MAX_CHAT ];
71 f64 chat_time;
72 }
73 static netplayers;
74
75 static void player_remote_rx_200_300( SteamNetworkingMessage_t *msg );
76 static void remote_player_debug_update(void);
77 static void remote_player_send_playerframe(void);
78 static void animate_remote_player( u32 index );
79 static void render_remote_players( world_instance *world, camera *cam );
80 static void relink_all_remote_player_worlds(void);
81 static void player_remote_update_friendflags( struct network_player *remote );
82
83 #endif /* PLAYER_REMOTE_H */