]> icculus.org git repositories - taylor/freespace2.git/blob - include/multi_oo.h
Initial revision
[taylor/freespace2.git] / include / multi_oo.h
1 #ifndef _MULTIPLAYER_OBJECT_UPDATE_HEADER_FILE
2 #define _MULTIPLAYER_OBJECT_UPDATE_HEADER_FILE
3
4 #include "vecmat.h"
5
6 #define OO_NEW
7
8 #ifdef OO_NEW
9         #include "multi_obj.h"
10 #else 
11
12 // ---------------------------------------------------------------------------------------------------
13 // OBJECT UPDATE DEFINES/VARS
14 //
15 struct interp_info;
16 struct object;
17 struct header;
18 struct net_player;
19
20 // client button info flags
21 #define OOC_FIRE_PRIMARY                        (1<<0)
22 #define OOC_FIRE_SECONDARY                      (1<<1)
23 #define OOC_FIRE_COUNTERMEASURE (1<<2)
24 #define OOC_TARGET_LOCKED                       (1<<3)
25 #define OOC_TARGET_SEEK_LOCK            (1<<4)
26 #define OOC_LOCKING_ON_CENTER           (1<<5)
27
28 // interpolation info struct 
29 typedef struct interp_info {
30         // position and timestamp
31         vector pos;
32         int pos_time;
33
34         // velocity and timestamp
35         vector vel;
36         int vel_time;
37
38         // desired velocity and timestamp
39         vector desired_vel;
40         int desired_vel_time;
41
42         // orientation and timestamp
43         matrix orient;
44         int orient_time;
45
46         // rotvel and timestamp
47         vector rotvel;
48         int rotvel_time;
49
50         // desired rotvel and timestamp
51         vector desired_rotvel;
52         int desired_rotvel_time;
53
54         // ping info (in ms)
55         int lowest_ping;                                // lowest ping (or -1, if not known)
56         int lowest_ping_avg;                    // (lowest ping + average ping)/2   or -1 if not known
57 } interp_info;
58
59
60 // ---------------------------------------------------------------------------------------------------
61 // OBJECT UPDATE FUNCTIONS
62 //
63
64 // process all object update details for this frame
65 void multi_oo_process();
66
67 // process incoming object update data
68 void multi_oo_process_update(ubyte *data, header *hinfo);
69
70 // initialize all object update timestamps (call whenever entering gameplay state)
71 void multi_oo_gameplay_init();
72
73 // process an object update sync packet
74 void multi_oo_process_update_sync(ubyte *data, header *hinfo);
75
76 // send an update sync packet
77 void multi_oo_send_update_sync(net_player *pl = NULL);
78
79 // initialize the server's time sync stuff
80 void multi_oo_sync_init();
81
82 // send control info for a client (which is basically a "reverse" object update)
83 void multi_oo_send_control_info();
84
85 // reset all sequencing info
86 void multi_oo_reset_sequencing();
87
88 // interpolate for this object
89 void multi_oo_interpolate(object *objp, interp_info *current, interp_info *last);
90
91 // do all interpolation for this frame - client side and server side
92 void multi_oo_interpolate_all();
93
94 // set global object update timestamp for this frame
95 void multi_oo_set_global_timestamp();
96
97
98 // ---------------------------------------------------------------------------------------------------
99 // DATARATE DEFINES/VARS
100 //
101
102 #define OO_HIGH_RATE_DEFAULT                            11000
103
104
105 // ---------------------------------------------------------------------------------------------------
106 // DATARATE FUNCTIONS
107 //
108
109 // process all object update datarate details
110 void multi_oo_rate_process();
111
112 // initialize all datarate checking stuff
113 void multi_oo_rate_init_all();
114
115 // initialize the rate limiting for the passed in player
116 void multi_oo_rate_init(net_player *pl);
117
118 // if the given net-player has exceeded his datarate limit, or if the overall datarate limit has been reached
119 int multi_oo_rate_exceeded(net_player *pl);
120
121 // if it is ok for me to send a control info (will be ~N times a second)
122 int multi_oo_cirate_can_send();
123
124 // display any oo info on the hud
125 void multi_oo_display();
126
127 #endif // #ifdef OO_NEW
128
129 #endif
130