]> icculus.org git repositories - taylor/freespace2.git/blob - include/multi_obj.h
re-add PXO sources to project files
[taylor/freespace2.git] / include / multi_obj.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 _MULTI_NEW_OBJECT_UPDATE_HEADER_FILE
10 #define _MULTI_NEW_OBJECT_UPDATE_HEADER_FILE
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_SECONDARY                      (1<<0)
22 #define OOC_TARGET_LOCKED                       (1<<1)
23 #define OOC_TARGET_SEEK_LOCK            (1<<2)
24 #define OOC_LOCKING_ON_CENTER           (1<<3)
25 #define OOC_TRIGGER_DOWN                        (1<<4)
26 #define OOC_PRIMARY_BANK                        (1<<5)
27 #define OOC_PRIMARY_LINKED                      (1<<6)
28
29 // update info
30 typedef struct np_update {      
31         ubyte           seq;                                                    // sequence #
32         int             update_stamp;                           // global update stamp
33         int             status_update_stamp;
34         int             subsys_update_stamp;
35         ushort  pos_chksum;                                     // positional checksum
36         ushort  orient_chksum;                          // orient checksum
37 } np_update;
38
39 // safer version of timestamp
40 #define timestamp_elapsed_safe(_a, _b)          ( (_a != 0) ? (((timestamp_ticker >= (_a)) || (timestamp_ticker < (_a - (_b + 100)))) ? 1 : 0) : 1 )
41
42 // ---------------------------------------------------------------------------------------------------
43 // OBJECT UPDATE FUNCTIONS
44 //
45
46 // process all object update details for this frame
47 void multi_oo_process();
48
49 // process incoming object update data
50 void multi_oo_process_update(ubyte *data, header *hinfo);
51
52 // initialize all object update timestamps (call whenever entering gameplay state)
53 void multi_oo_gameplay_init();
54
55 // send control info for a client (which is basically a "reverse" object update)
56 void multi_oo_send_control_info();
57
58 // reset all sequencing info
59 void multi_oo_reset_sequencing();
60
61 // is this object one which needs to go through the interpolation
62 int multi_oo_is_interp_object(object *objp);
63
64 // interp
65 void multi_oo_interp(object *objp);
66
67
68 // ---------------------------------------------------------------------------------------------------
69 // DATARATE DEFINES/VARS
70 //
71
72 #define OO_HIGH_RATE_DEFAULT                            11000
73
74
75 // ---------------------------------------------------------------------------------------------------
76 // DATARATE FUNCTIONS
77 //
78
79 // process all object update datarate details
80 void multi_oo_rate_process();
81
82 // initialize all datarate checking stuff
83 void multi_oo_rate_init_all();
84
85 // initialize the rate limiting for the passed in player
86 void multi_oo_rate_init(net_player *pl);
87
88 // if the given net-player has exceeded his datarate limit, or if the overall datarate limit has been reached
89 int multi_oo_rate_exceeded(net_player *pl);
90
91 // if it is ok for me to send a control info (will be ~N times a second)
92 int multi_oo_cirate_can_send();
93
94 // display any oo info on the hud
95 void multi_oo_display();
96
97 // notify of a player join
98 void multi_oo_player_reset_all(net_player *pl = NULL);
99
100 #endif
101