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