NETWORK.H 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  1. #define TRUE 1
  2. #define FALSE 0
  3. enum {
  4. NET_ONLINE,
  5. NET_GO,
  6. NET_MESSAGE,
  7. NET_QUIT,
  8. NET_SINGLE,
  9. NET_MULTIPLE,
  10. NET_READY,
  11. NET_SEED,
  12. NET_PAUSE,
  13. NET_INFO
  14. };
  15. typedef struct // Header packet
  16. {
  17. int dwSequence; // reserved by NetNow!
  18. short player; // player
  19. short type; // type
  20. int frame; // frame number when issued (not always used)
  21. } packet_header;
  22. typedef struct // Setup info packet
  23. {
  24. _NETNOW_NODE_ADDR address; //node received info from.
  25. int Team_A,Team_B;
  26. int Team;
  27. int Player;
  28. } packet_info;
  29. typedef struct // Input data packet
  30. {
  31. short x,y; // 15 bits of signed directional data + lowest bits for two buttons
  32. } packet_single;
  33. typedef struct // Multiple input data packet
  34. {
  35. packet_single inp[20];
  36. } packet_multiple;
  37. typedef struct // Message packet
  38. {
  39. char mes[12];
  40. } packet_data;
  41. typedef struct // Random seed packet
  42. {
  43. int num;
  44. } packet_seed;
  45. typedef struct // Pause key packet
  46. {
  47. int paused;
  48. } packet_pause;
  49. extern packet_header in_header;
  50. extern packet_data in_data[8];
  51. extern short wConsoleNode;
  52. extern volatile int writeptr,readptr;
  53. extern volatile packet_multiple copy_multiple[512];
  54. extern short master;
  55. extern volatile int active_nodes;
  56. extern volatile int net_quit;
  57. void __far nethandler(void);
  58. void Initialise_Network();
  59. void send_quit();
  60. void send_mes(char *m);
  61. int receive_mes();
  62. void close_network();
  63. void send_seed(int num);
  64. void send_ready();
  65. void send_single(int plyr);
  66. void send_multiple();
  67. void receive_multiple();
  68. void receive_all_singles();
  69. void send_name(char *m);
  70. void TransmitInit(void);
  71. int FindNodes();
  72. void send_pause();
  73. void transmitpausetoslaves(void);
  74. void NetInitialisation();
  75. void FoundNodes();
  76. void SendNetDone();
  77. void SendPlayerInfo();
  78.