home *** CD-ROM | disk | FTP | other *** search
/ Amiga ACS 1998 #6 / amigaacscoverdisc1998-061998.iso / games / descent / source / main / network.h < prev    next >
Text File  |  1998-06-08  |  11KB  |  374 lines

  1. /*
  2. THE COMPUTER CODE CONTAINED HEREIN IS THE SOLE PROPERTY OF PARALLAX
  3. SOFTWARE CORPORATION ("PARALLAX").  PARALLAX, IN DISTRIBUTING THE CODE TO
  4. END-USERS, AND SUBJECT TO ALL OF THE TERMS AND CONDITIONS HEREIN, GRANTS A
  5. ROYALTY-FREE, PERPETUAL LICENSE TO SUCH END-USERS FOR USE BY SUCH END-USERS
  6. IN USING, DISPLAYING,  AND CREATING DERIVATIVE WORKS THEREOF, SO LONG AS
  7. SUCH USE, DISPLAY OR CREATION IS FOR NON-COMMERCIAL, ROYALTY OR REVENUE
  8. FREE PURPOSES.  IN NO EVENT SHALL THE END-USER USE THE COMPUTER CODE
  9. CONTAINED HEREIN FOR REVENUE-BEARING PURPOSES.  THE END-USER UNDERSTANDS
  10. AND AGREES TO THE TERMS HEREIN AND ACCEPTS THE SAME BY USE OF THIS FILE.  
  11. COPYRIGHT 1993-1998 PARALLAX SOFTWARE CORPORATION.  ALL RIGHTS RESERVED.
  12. */
  13. /*
  14.  * $Source: f:/miner/source/main/rcs/network.h $
  15.  * $Revision: 2.2 $
  16.  * $Author: john $
  17.  * $Date: 1995/03/21 14:58:09 $
  18.  * 
  19.  * Prototypes for network management functions.
  20.  * 
  21.  * $Log: network.h $
  22.  * Revision 2.2  1995/03/21  14:58:09  john
  23.  * *** empty log message ***
  24.  * 
  25.  * Revision 2.1  1995/03/21  14:39:43  john
  26.  * Ifdef'd out the NETWORK code.
  27.  * 
  28.  * Revision 2.0  1995/02/27  11:29:48  john
  29.  * New version 2.0, which has no anonymous unions, builds with
  30.  * Watcom 10.0, and doesn't require parsing BITMAPS.TBL.
  31.  * 
  32.  * Revision 1.72  1995/02/11  14:24:39  rob
  33.  * Added suppor for invul. cntrlcen.
  34.  * 
  35.  * Revision 1.71  1995/02/08  19:18:43  rob
  36.  * Added extern for segments checksum.
  37.  * 
  38.  * Revision 1.70  1995/02/08  11:01:16  rob
  39.  * Fixed a bug.
  40.  * 
  41.  * Revision 1.69  1995/02/07  21:16:49  rob
  42.  * Added flag for automap.
  43.  * 
  44.  * Revision 1.68  1995/02/06  18:18:33  rob
  45.  * Extern'ed Packet Urgent.
  46.  * 
  47.  * Revision 1.67  1995/02/05  14:36:29  rob
  48.  * Moved defines to network.h.
  49.  * 
  50.  * Revision 1.66  1995/02/01  16:34:09  john
  51.  * Linted.
  52.  * 
  53.  * Revision 1.65  1995/01/30  21:14:35  rob
  54.  * Fixed a bug in join menu.
  55.  * Simplified mission load support.
  56.  * 
  57.  * Revision 1.64  1995/01/30  18:19:40  rob
  58.  * Added mission title to gameinfo packet.
  59.  * 
  60.  * Revision 1.63  1995/01/28  17:02:39  rob
  61.  * Fixed monitor syncing bug (minor 19).
  62.  * 
  63.  * Revision 1.62  1995/01/27  11:15:25  rob
  64.  * removed extern of variable no longer in network.c
  65.  * 
  66.  * Revision 1.61  1995/01/26  12:17:34  rob
  67.  * Added new param to network_do_frame.
  68.  * 
  69.  * Revision 1.60  1995/01/22  17:32:11  rob
  70.  * Added mission support for network games.
  71.  * 
  72.  * Revision 1.59  1995/01/17  17:10:33  rob
  73.  * Added some flags to netgame struct.
  74.  * 
  75.  * Revision 1.58  1995/01/12  18:57:15  rob
  76.  * Added score resync stuff.
  77.  * 
  78.  * Revision 1.57  1995/01/12  16:42:18  rob
  79.  * Added new prototypes.
  80.  * 
  81.  * Revision 1.56  1995/01/05  12:12:10  rob
  82.  * Fixed a problem with packet size.
  83.  * 
  84.  * Revision 1.55  1995/01/05  11:12:36  rob
  85.  * Reduced packet size by 1 byte just to be safe.
  86.  * 
  87.  * Revision 1.54  1995/01/04  21:39:32  rob
  88.  * New framedata packet for registered.
  89.  * 
  90.  * Revision 1.53  1995/01/04  08:47:04  rob
  91.  * JOHN CHECKED IN FOR ROB !!!
  92.  * 
  93.  * Revision 1.52  1994/12/30  20:09:07  rob
  94.  * ADded a toggle for showing player names on HUD.
  95.  * 
  96.  * Revision 1.51  1994/12/29  15:59:52  rob
  97.  * Centralized network disconnects.
  98.  * 
  99.  * Revision 1.50  1994/12/09  21:21:57  rob
  100.  * rolled back changes.
  101.  * 
  102.  * Revision 1.48  1994/12/05  22:59:27  rob
  103.  * added prototype for send_endlevel_packet.
  104.  * 
  105.  * Revision 1.47  1994/12/05  21:47:34  rob
  106.  * Added a new field to netgame struct.
  107.  * 
  108.  * Revision 1.46  1994/12/05  14:39:16  rob
  109.  * Added new variable to indicate new net game starting.
  110.  * 
  111.  * Revision 1.45  1994/12/04  15:37:18  rob
  112.  * Fixed a typo.
  113.  * 
  114.  * Revision 1.44  1994/12/04  15:30:42  rob
  115.  * Added new fields to netgame struct.
  116.  * 
  117.  * Revision 1.43  1994/12/03  18:03:19  rob
  118.  * ADded team kill syncing.
  119.  * 
  120.  * Revision 1.42  1994/12/01  21:21:27  rob
  121.  * Added new system for object sync on rejoin.
  122.  * 
  123.  * Revision 1.41  1994/11/29  13:07:33  rob
  124.  * Changed structure defs to .h files.
  125.  * 
  126.  * Revision 1.40  1994/11/22  17:10:48  rob
  127.  * Fix for secret levels in network play mode.
  128.  * 
  129.  * Revision 1.39  1994/11/18  16:36:31  rob
  130.  * Added variable network_rejoined to enable random placement
  131.  * of rejoining palyers.
  132.  * 
  133.  * Revision 1.38  1994/11/12  19:51:13  rob
  134.  * Changed prototype for network_send_data to pass
  135.  * urgent flag.
  136.  * 
  137.  * Revision 1.37  1994/11/10  21:48:26  rob
  138.  * Changed net_endlevel to return an int.
  139.  * 
  140.  * Revision 1.36  1994/11/10  20:32:49  rob
  141.  * Added extern for LastPacketTime.
  142.  * 
  143.  * Revision 1.35  1994/11/09  11:36:34  rob
  144.  * ADded return value to network_level_sync for success/fail.
  145.  * 
  146.  * Revision 1.34  1994/11/08  21:22:31  rob
  147.  * Added proto for network_endlevel_snyc
  148.  * 
  149.  * Revision 1.33  1994/11/08  15:20:00  rob
  150.  * added proto for change_playernum_to
  151.  * 
  152.  * Revision 1.32  1994/11/07  17:45:40  rob
  153.  * Added prototype for network_endlevel (called from multi.c)
  154.  * 
  155.  * Revision 1.31  1994/11/04  19:52:37  rob
  156.  * Removed a function from network.h (network_show_player_list)
  157.  * 
  158.  * Revision 1.30  1994/11/01  19:39:26  rob
  159.  * Removed a couple of variables that should be externed from multi.c
  160.  * (remnants of the changover)
  161.  * 
  162.  * Revision 1.29  1994/10/31  19:18:24  rob
  163.  * Changed prototype for network_do_frame to add a parameter if you wish
  164.  * to force the frame to be sent.  Important if this is a leave_game frame.
  165.  * 
  166.  * Revision 1.28  1994/10/08  19:59:20  rob
  167.  * Removed network message variables.
  168.  * 
  169.  * Revision 1.27  1994/10/08  11:08:38  john
  170.  * Moved network_delete_unused objects into multi.c,
  171.  * took out network callsign stuff and used Matt's net
  172.  * players[.].callsign stuff.
  173.  * 
  174.  * Revision 1.26  1994/10/07  11:26:20  rob
  175.  * Changed network_start_frame to network_do_frame,.
  176.  * 
  177.  * 
  178.  * Revision 1.25  1994/10/05  13:58:10  rob
  179.  * Added a new function net_endlevel that is called after each level is 
  180.  * completed.  Currently it only does anything if SERIAL game is in effect.
  181.  * 
  182.  * Revision 1.24  1994/10/04  19:34:57  rob
  183.  * export network_find_max_net_players.
  184.  * 
  185.  * Revision 1.23  1994/10/04  17:31:10  rob
  186.  * Exported MaxNumNetPlayers.
  187.  * 
  188.  * Revision 1.22  1994/10/03  22:57:30  matt
  189.  * Took out redundant definition of callsign_len
  190.  * 
  191.  * Revision 1.21  1994/10/03  15:12:48  rob
  192.  * Boosted MAX_CREATE_OBJECTS to 15.
  193.  * 
  194.  * Revision 1.20  1994/09/30  18:19:51  rob
  195.  * Added two new variables for tracking object creation.
  196.  * 
  197.  * Revision 1.19  1994/09/27  15:03:18  rob
  198.  * Added prototype for network_delete_extra_objects used by modem.c
  199.  * 
  200.  * Revision 1.18  1994/09/27  14:36:45  rob
  201.  * Added two new varaibles for network/serial weapon firing.
  202.  * 
  203.  * Revision 1.17  1994/09/07  17:10:57  john
  204.  * Started adding code to sync powerups.
  205.  * 
  206.  * Revision 1.16  1994/09/06  19:29:05  john
  207.  * Added trial version of rejoin function.
  208.  * 
  209.  * Revision 1.15  1994/08/26  13:01:54  john
  210.  * Put high score system in.
  211.  * 
  212.  * Revision 1.14  1994/08/25  18:12:04  matt
  213.  * Made player's weapons and flares fire from the positions on the 3d model.
  214.  * Also added support for quad lasers.
  215.  * 
  216.  * Revision 1.13  1994/08/17  16:50:00  john
  217.  * Added damaging fireballs, missiles.
  218.  * 
  219.  * Revision 1.12  1994/08/16  12:25:22  john
  220.  * Added hooks for sending messages.
  221.  * 
  222.  * Revision 1.11  1994/08/13  12:20:18  john
  223.  * Made the networking uise the Players array.
  224.  * 
  225.  * Revision 1.10  1994/08/12  22:41:27  john
  226.  * Took away Player_stats; add Players array.
  227.  * 
  228.  * Revision 1.9  1994/08/12  03:10:22  john
  229.  * Made network be default off; Moved network options into
  230.  * main menu.  Made starting net game check that mines are the
  231.  * same.
  232.  * 
  233.  * Revision 1.8  1994/08/11  21:57:08  john
  234.  * Moved network options to main menu.
  235.  * 
  236.  * Revision 1.7  1994/08/10  11:29:20  john
  237.  * *** empty log message ***
  238.  * 
  239.  * Revision 1.6  1994/08/10  10:44:12  john
  240.  * Made net players fire..
  241.  * 
  242.  * Revision 1.5  1994/08/09  19:31:46  john
  243.  * Networking changes.
  244.  * 
  245.  * Revision 1.4  1994/08/05  16:30:26  john
  246.  * Added capability to turn off network.
  247.  * 
  248.  * Revision 1.3  1994/08/05  16:11:43  john
  249.  * Psuedo working version of networking.
  250.  * 
  251.  * Revision 1.2  1994/07/25  12:33:34  john
  252.  * Network "pinging" in.
  253.  * 
  254.  * Revision 1.1  1994/07/20  16:09:05  john
  255.  * Initial revision
  256.  * 
  257.  * 
  258.  */
  259.  
  260. #ifdef NETWORK
  261.  
  262. #ifndef _NETWORK_H
  263. #define _NETWORK_H
  264.  
  265. #include "gameseq.h"
  266. #include "multi.h"
  267.  
  268. #define NETSTAT_MENU                    0
  269. #define NETSTAT_PLAYING                1
  270. #define NETSTAT_BROWSING            2
  271. #define NETSTAT_WAITING                3
  272. #define NETSTAT_STARTING            4
  273. #define NETSTAT_ENDLEVEL            5
  274.  
  275. #define CONNECT_DISCONNECTED        0
  276. #define CONNECT_PLAYING                1
  277. #define CONNECT_WAITING                2
  278. #define CONNECT_DIED_IN_MINE        3
  279. #define CONNECT_FOUND_SECRET        4
  280. #define CONNECT_ESCAPE_TUNNEL        5
  281. #define CONNECT_END_MENU            6
  282.  
  283. typedef struct sequence_packet {
  284.     ubyte                    type;
  285.     netplayer_info        player;
  286. } sequence_packet;
  287.  
  288. #ifdef SHAREWARE
  289. #define NET_XDATA_SIZE 256
  290. #else
  291. #define NET_XDATA_SIZE 454
  292. #endif
  293.  
  294. #ifdef SHAREWARE
  295. typedef struct frame_info {
  296.     ubyte                type;                        // What type of p
  297.     int                numpackets;            
  298.     short                objnum;
  299.     ubyte                playernum;
  300.     short                obj_segnum;
  301.     vms_vector        obj_pos;
  302.     vms_matrix        obj_orient;
  303.     physics_info    obj_phys_info;
  304.     ubyte                obj_render_type;
  305.     ubyte                level_num;
  306.     ushort            data_size;        // Size of data appended to the net packet
  307.     ubyte                data[NET_XDATA_SIZE];        // extra data to be tacked on the end
  308. } frame_info;
  309. #else
  310. typedef struct frame_info {
  311.     ubyte                type;                        // What type of packet
  312.     ubyte                pad[3];                    // Pad out length of frame_info packet
  313.     int                numpackets;            
  314.     vms_vector        obj_pos;
  315.     vms_matrix        obj_orient;
  316.     vms_vector        phys_velocity;
  317.     vms_vector        phys_rotvel;
  318.     short                obj_segnum;
  319.     ushort            data_size;        // Size of data appended to the net packet
  320.     ubyte                playernum;
  321.     ubyte                obj_render_type;
  322.     ubyte                level_num;
  323.     ubyte                data[NET_XDATA_SIZE];        // extra data to be tacked on the end
  324. } frame_info;
  325. #endif
  326.  
  327.  
  328.  
  329. void network_start_game();
  330. void network_join_game();
  331. void network_rejoin_game();
  332. void network_leave_game();
  333. int network_endlevel(int *secret);
  334. int network_endlevel_poll2( int nitems, struct newmenu_item * menus, int * key, int citem );
  335.  
  336.  
  337. int network_level_sync();
  338. void network_send_endlevel_packet();
  339.  
  340. int network_delete_extra_objects();
  341. int network_find_max_net_players();
  342. int network_objnum_is_past(int objnum);
  343. char * network_get_player_name( int objnum );
  344.  
  345. void network_disconnect_player(int playernum);
  346.  
  347.  
  348. extern int Network_send_objects;
  349. extern int Network_send_objnum;
  350. extern int PacketUrgent;
  351. extern int Network_rejoined;
  352.  
  353. extern int Network_new_game;
  354. extern int Network_status;
  355.  
  356. extern fix LastPacketTime[MAX_PLAYERS];
  357.  
  358. extern ushort my_segments_checksum;
  359. // By putting an up-to-20-char-message into Network_message and 
  360. // setting Network_message_reciever to the player num you want to
  361. // send it to (100 for broadcast) the next frame the player will
  362. // get your message.
  363.  
  364. // Call once at the beginning of a frame
  365. void network_do_frame(int force, int listen);
  366.  
  367. // Tacks data of length 'len' onto the end of the next
  368. // packet that we're transmitting.
  369. void network_send_data( ubyte * ptr, int len, int urgent );
  370.  
  371. #endif
  372. #endif
  373. 
  374.