fix regression with gate flipping
[carveJwlIkooP6JGAAIwe30JlM.git] / player_remote.h
1 #pragma once
2 #include "player.h"
3 #include "network.h"
4 #include "network_common.h"
5 #include "player_render.h"
6 #include "player_effects.h"
7 #include "player_api.h"
8
9 #include "player_skate.h"
10 #include "player_walk.h"
11 #include "player_dead.h"
12 #include "player_basic_info.h"
13 #include "player_glide.h"
14
15 #define NETWORK_SFX_QUEUE_LENGTH 12
16
17 struct global_netplayers
18 {
19 struct network_player {
20 int active, isfriend, isblocked;
21 u64 steamid;
22 u16 board_view_slot, playermodel_view_slot;
23 enum player_subsystem subsystem;
24
25 /* this is set IF they exist in a world that we have loaded */
26 world_instance *active_world;
27 int world_match[ k_world_max ];
28 u32 location_pstr; /* TODO: valid if active_world set. */
29
30 /* TODO: Compression with server code */
31 char username[ NETWORK_USERNAME_MAX ];
32 char items[k_netmsg_playeritem_max][ADDON_UID_MAX];
33 char chat[ NETWORK_MAX_CHAT ];
34 char region[ NETWORK_REGION_MAX ];
35 u32 region_flags;
36 f64 chat_time;
37
38 /* ui */
39 u32 medals[3];
40 f32 opacity;
41
42 u32 down_bytes;
43 f32 down_kbs;
44
45 struct player_effects_data effect_data;
46 bool render_glider;
47 }
48 list[ NETWORK_MAX_PLAYERS ];
49
50 struct interp_buffer {
51 /* collect the most recent 6 frames of animation data */
52 struct interp_frame {
53 int active;
54 f64 timestamp;
55 enum player_subsystem subsystem;
56
57 u8 flags;
58 u16 boundary_hash;
59
60 union interp_animdata {
61 /* these aren't accessed directly, just used to take the
62 * max(sizeof) all systems */
63 struct player_skate_animator __skate;
64 struct player_walk_animator __walk;
65 struct player_dead_animator __dead;
66 struct player_basic_info_animator __basic;
67 }
68 data;
69
70 struct remote_glider_animator data_glider;
71 }
72 frames[ NETWORK_BUFFERFRAMES ];
73
74 f64 t;
75 }
76 interp_data[ NETWORK_MAX_PLAYERS ];
77
78 struct net_sfx sfx_queue[ NETWORK_SFX_QUEUE_LENGTH ];
79
80 m4x3f *final_mtx,
81 *glider_mtx;
82 struct player_board_pose board_poses[ NETWORK_MAX_PLAYERS ];
83
84 u32 up_bytes;
85 f32 up_kbs, down_kbs;
86 f64 last_data_measurement;
87
88 int chatting;
89 char chat_buffer[ NETWORK_MAX_CHAT ], chat_message[ NETWORK_MAX_CHAT ];
90 f64 chat_time;
91 }
92 extern netplayers;
93
94 void player_remote_rx_200_300( SteamNetworkingMessage_t *msg );
95 void remote_player_debug_update(void);
96 void remote_player_send_playerframe(void);
97 void animate_remote_player( u32 index );
98 void animate_remote_players(void);
99 void render_remote_players( world_instance *world, vg_camera *cam );
100 void relink_all_remote_player_worlds(void);
101 void player_remote_update_friendflags( struct network_player *remote );
102 void remote_players_init(void);
103 void remote_sfx_pre_update(void);
104 void remote_player_network_imgui( m4x4f pv );
105 void remote_players_imgui_world( world_instance *world, m4x4f pv,
106 f32 max_dist, int geo_cull );
107 void remote_players_imgui_lobby(void);
108 void remote_players_chat_imgui(void);