2 * Copyright (C) Volition, Inc. 1999. All rights reserved.
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
9 #ifndef _MULTIPLAYER_OBJECT_UPDATE_HEADER_FILE
10 #define _MULTIPLAYER_OBJECT_UPDATE_HEADER_FILE
17 #include "multi_obj.h"
20 // ---------------------------------------------------------------------------------------------------
21 // OBJECT UPDATE DEFINES/VARS
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)
36 // interpolation info struct
37 typedef struct interp_info {
38 // position and timestamp
42 // velocity and timestamp
46 // desired velocity and timestamp
50 // orientation and timestamp
54 // rotvel and timestamp
58 // desired rotvel and timestamp
59 vector desired_rotvel;
60 int desired_rotvel_time;
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
68 // ---------------------------------------------------------------------------------------------------
69 // OBJECT UPDATE FUNCTIONS
72 // process all object update details for this frame
73 void multi_oo_process();
75 // process incoming object update data
76 void multi_oo_process_update(ubyte *data, header *hinfo);
78 // initialize all object update timestamps (call whenever entering gameplay state)
79 void multi_oo_gameplay_init();
81 // process an object update sync packet
82 void multi_oo_process_update_sync(ubyte *data, header *hinfo);
84 // send an update sync packet
85 void multi_oo_send_update_sync(net_player *pl = NULL);
87 // initialize the server's time sync stuff
88 void multi_oo_sync_init();
90 // send control info for a client (which is basically a "reverse" object update)
91 void multi_oo_send_control_info();
93 // reset all sequencing info
94 void multi_oo_reset_sequencing();
96 // interpolate for this object
97 void multi_oo_interpolate(object *objp, interp_info *current, interp_info *last);
99 // do all interpolation for this frame - client side and server side
100 void multi_oo_interpolate_all();
102 // set global object update timestamp for this frame
103 void multi_oo_set_global_timestamp();
106 // ---------------------------------------------------------------------------------------------------
107 // DATARATE DEFINES/VARS
110 #define OO_HIGH_RATE_DEFAULT 11000
113 // ---------------------------------------------------------------------------------------------------
114 // DATARATE FUNCTIONS
117 // process all object update datarate details
118 void multi_oo_rate_process();
120 // initialize all datarate checking stuff
121 void multi_oo_rate_init_all();
123 // initialize the rate limiting for the passed in player
124 void multi_oo_rate_init(net_player *pl);
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);
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();
132 // display any oo info on the hud
133 void multi_oo_display();
135 #endif // #ifdef OO_NEW