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