d_net.h 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150
  1. // Emacs style mode select -*- C++ -*-
  2. //-----------------------------------------------------------------------------
  3. //
  4. // $Id:$
  5. //
  6. // Copyright (C) 1993-1996 by id Software, Inc.
  7. //
  8. // This source is available for distribution and/or modification
  9. // only under the terms of the DOOM Source Code License as
  10. // published by id Software. All rights reserved.
  11. //
  12. // The source is distributed in the hope that it will be useful,
  13. // but WITHOUT ANY WARRANTY; without even the implied warranty of
  14. // FITNESS FOR A PARTICULAR PURPOSE. See the DOOM Source Code License
  15. // for more details.
  16. //
  17. // DESCRIPTION:
  18. // Networking stuff.
  19. //
  20. //-----------------------------------------------------------------------------
  21. #ifndef __D_NET__
  22. #define __D_NET__
  23. #include "d_player.h"
  24. #ifdef __GNUG__
  25. #pragma interface
  26. #endif
  27. //
  28. // Network play related stuff.
  29. // There is a data struct that stores network
  30. // communication related stuff, and another
  31. // one that defines the actual packets to
  32. // be transmitted.
  33. //
  34. #define DOOMCOM_ID 0x12345678l
  35. // Max computers/players in a game.
  36. #define MAXNETNODES 8
  37. // Networking and tick handling related.
  38. #define BACKUPTICS 12
  39. typedef enum
  40. {
  41. CMD_SEND = 1,
  42. CMD_GET = 2
  43. } command_t;
  44. //
  45. // Network packet data.
  46. //
  47. typedef struct
  48. {
  49. // High bit is retransmit request.
  50. unsigned checksum;
  51. // Only valid if NCMD_RETRANSMIT.
  52. byte retransmitfrom;
  53. byte starttic;
  54. byte player;
  55. byte numtics;
  56. ticcmd_t cmds[BACKUPTICS];
  57. } doomdata_t;
  58. typedef struct
  59. {
  60. // Supposed to be DOOMCOM_ID?
  61. long id;
  62. // DOOM executes an int to execute commands.
  63. short intnum;
  64. // Communication between DOOM and the driver.
  65. // Is CMD_SEND or CMD_GET.
  66. short command;
  67. // Is dest for send, set by get (-1 = no packet).
  68. short remotenode;
  69. // Number of bytes in doomdata to be sent
  70. short datalength;
  71. // Info common to all nodes.
  72. // Console is allways node 0.
  73. short numnodes;
  74. // Flag: 1 = no duplication, 2-5 = dup for slow nets.
  75. short ticdup;
  76. // Flag: 1 = send a backup tic in every packet.
  77. short extratics;
  78. // Flag: 1 = deathmatch.
  79. short deathmatch;
  80. // Flag: -1 = new game, 0-5 = load savegame
  81. short savegame;
  82. short episode; // 1-3
  83. short map; // 1-9
  84. short skill; // 1-5
  85. // Info specific to this node.
  86. short consoleplayer;
  87. short numplayers;
  88. // These are related to the 3-display mode,
  89. // in which two drones looking left and right
  90. // were used to render two additional views
  91. // on two additional computers.
  92. // Probably not operational anymore.
  93. // 1 = left, 0 = center, -1 = right
  94. short angleoffset;
  95. // 1 = drone
  96. short drone;
  97. // The packet data to be sent.
  98. doomdata_t data;
  99. } doomcom_t;
  100. // Create any new ticcmds and broadcast to other players.
  101. void NetUpdate (void);
  102. // Broadcasts special packets to other players
  103. // to notify of game exit
  104. void D_QuitNetGame (void);
  105. //? how many ticks to run?
  106. void TryRunTics (void);
  107. #endif
  108. //-----------------------------------------------------------------------------
  109. //
  110. // $Log:$
  111. //
  112. //-----------------------------------------------------------------------------