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