add g3_uninit_polygon_model (doesn't do anything)
[btb/d2x.git] / main / netmisc.h
1 /* $Id: netmisc.h,v 1.6 2004-08-28 23:17:45 schaffner Exp $ */
2 /*
3 THE COMPUTER CODE CONTAINED HEREIN IS THE SOLE PROPERTY OF PARALLAX
4 SOFTWARE CORPORATION ("PARALLAX").  PARALLAX, IN DISTRIBUTING THE CODE TO
5 END-USERS, AND SUBJECT TO ALL OF THE TERMS AND CONDITIONS HEREIN, GRANTS A
6 ROYALTY-FREE, PERPETUAL LICENSE TO SUCH END-USERS FOR USE BY SUCH END-USERS
7 IN USING, DISPLAYING,  AND CREATING DERIVATIVE WORKS THEREOF, SO LONG AS
8 SUCH USE, DISPLAY OR CREATION IS FOR NON-COMMERCIAL, ROYALTY OR REVENUE
9 FREE PURPOSES.  IN NO EVENT SHALL THE END-USER USE THE COMPUTER CODE
10 CONTAINED HEREIN FOR REVENUE-BEARING PURPOSES.  THE END-USER UNDERSTANDS
11 AND AGREES TO THE TERMS HEREIN AND ACCEPTS THE SAME BY USE OF THIS FILE.
12 COPYRIGHT 1993-1999 PARALLAX SOFTWARE CORPORATION.  ALL RIGHTS RESERVED.
13 */
14
15 /*
16  *
17  * Header for netmisc.c
18  *
19  */
20
21
22 #ifndef _NETMISC_H
23 #define _NETMISC_H
24
25 #include "multi.h"
26 #include "network.h"
27
28 // Returns a checksum of a block of memory.
29 extern ushort netmisc_calc_checksum(void *vptr, int len);
30
31 // Finds the difference between block1 and block2.  Fills in
32 // diff_buffer and returns the size of diff_buffer.
33 extern int netmisc_find_diff(void *block1, void *block2, int block_size, void *diff_buffer);
34
35 // Applies diff_buffer to block1 to create a new block1.  Returns the
36 // final size of block1.
37 extern int netmisc_apply_diff(void *block1, void *diff_buffer, int diff_size);
38
39 #ifdef WORDS_BIGENDIAN
40
41 // some mac only routines to deal with incorrectly aligned network structures
42
43 void receive_netplayer_info(ubyte *data, AllNetPlayers_info *info);
44
45 void receive_netplayers_packet(ubyte *data, AllNetPlayers_info *pinfo);
46 void send_netplayers_packet(ubyte *server, ubyte *node);
47 #define send_broadcast_netplayers_packet() \
48         send_netplayers_packet(NULL, NULL)
49
50 void send_sequence_packet(sequence_packet seq, ubyte *server, ubyte *node, ubyte *net_address);
51 #define send_internetwork_sequence_packet(seq, server, node) \
52         send_sequence_packet(seq, server, node, NULL)
53 #define send_broadcast_sequence_packet(seq) \
54         send_sequence_packet(seq, NULL, NULL, NULL)
55 void receive_sequence_packet(ubyte *data, sequence_packet *seq);
56
57 void send_netgame_packet(ubyte *server, ubyte *node, ubyte *net_address, int lite_flag);
58 #define send_full_netgame_packet(server, node, net_address) \
59         send_netgame_packet(server, node, net_address, 0)
60 #define send_lite_netgame_packet(server, node, net_address) \
61         send_netgame_packet(server, node, net_address, 1)
62 #define send_internetwork_full_netgame_packet(server, node) \
63         send_netgame_packet(server, node, NULL, 0)
64 #define send_internetwork_lite_netgame_packet(server, node) \
65         send_netgame_packet(server, node, NULL, 1)
66 #define send_broadcast_full_netgame_packet() \
67         send_netgame_packet(NULL, NULL, NULL, 0)
68 #define send_broadcast_lite_netgame_packet() \
69         send_netgame_packet(NULL, NULL, NULL, 1)
70 void receive_netgame_packet(ubyte *data, netgame_info *netgame, int lite_flag);
71 #define receive_full_netgame_packet(data, netgame) \
72         receive_netgame_packet(data, netgame, 0)
73 #define receive_lite_netgame_packet(data, netgame) \
74         receive_netgame_packet(data, netgame, 1)
75
76 void swap_object(object *obj);
77
78 #else
79
80 #define receive_netplayers_packet(data, pinfo) \
81         memcpy(pinfo, data, sizeof(AllNetPlayers_info))
82 #define send_netplayers_packet(server, node) \
83         ipx_send_internetwork_packet_data((ubyte *)&NetPlayers, sizeof(AllNetPlayers_info), server, node)
84 #define send_broadcast_netplayers_packet() \
85         ipx_send_broadcast_packet_data((ubyte *)&NetPlayers, sizeof(AllNetPlayers_info))
86
87 #define send_sequence_packet(seq, server, node, net_address) \
88         ipx_send_packet_data((ubyte *)&seq, sizeof(sequence_packet), server, node, net_address)
89 #define send_internetwork_sequence_packet(seq, server, node) \
90         ipx_send_internetwork_packet_data((ubyte *)&seq, sizeof(sequence_packet), server, node)
91 #define send_broadcast_sequence_packet(seq) \
92         ipx_send_broadcast_packet_data((ubyte *)&seq, sizeof(sequence_packet))
93
94 #define send_full_netgame_packet(server, node, net_address) \
95         ipx_send_packet_data((ubyte *)&Netgame, sizeof(netgame_info), server, node, net_address)
96 #define send_lite_netgame_packet(server, node, net_address) \
97         ipx_send_packet_data((ubyte *)&Netgame, sizeof(lite_info), server, node, net_address)
98 #define send_internetwork_full_netgame_packet(server, node) \
99         ipx_send_internetwork_packet_data((ubyte *)&Netgame, sizeof(netgame_info), server, node)
100 #define send_internetwork_lite_netgame_packet(server, node) \
101         ipx_send_internetwork_packet_data((ubyte *)&Netgame, sizeof(lite_info), server, node)
102 #define send_broadcast_full_netgame_packet() \
103         ipx_send_broadcast_packet_data((ubyte *)&Netgame, sizeof(netgame_info))
104 #define send_broadcast_lite_netgame_packet() \
105         ipx_send_broadcast_packet_data((ubyte *)&Netgame, sizeof(lite_info))
106 #define receive_full_netgame_packet(data, netgame) \
107         memcpy((ubyte *)(netgame), data, sizeof(netgame_info))
108 #define receive_lite_netgame_packet(data, netgame) \
109         memcpy((ubyte *)(netgame), data, sizeof(lite_info))
110
111 #define swap_object(obj)
112
113 #endif
114
115 #endif /* _NETMISC_H */