home *** CD-ROM | disk | FTP | other *** search
/ ST-Computer Leser-CD 2000 January / LCD_01_2000.iso / games / doom / pmdoom / include / d_net.h < prev    next >
Encoding:
C/C++ Source or Header  |  1999-12-17  |  3.6 KB  |  150 lines

  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.  
  22.  
  23. #ifndef __D_NET__
  24. #define __D_NET__
  25.  
  26. #include "d_player.h"
  27.  
  28.  
  29. #ifdef __GNUG__
  30. #pragma interface
  31. #endif
  32.  
  33.  
  34. /*  */
  35. /*  Network play related stuff. */
  36. /*  There is a data struct that stores network */
  37. /*   communication related stuff, and another */
  38. /*   one that defines the actual packets to */
  39. /*   be transmitted. */
  40. /*  */
  41.  
  42. #define DOOMCOM_ID        0x12345678l
  43.  
  44. /*  Max computers/players in a game. */
  45. #define MAXNETNODES        8
  46.  
  47.  
  48. /*  Networking and tick handling related. */
  49. #define BACKUPTICS        12
  50.  
  51. typedef enum
  52. {
  53.     CMD_SEND    = 1,
  54.     CMD_GET    = 2
  55.  
  56. } command_t;
  57.  
  58.  
  59. /*  */
  60. /*  Network packet data. */
  61. /*  */
  62. typedef struct
  63. {
  64.     /*  High bit is retransmit request. */
  65.     unsigned        checksum;
  66.     /*  Only valid if NCMD_RETRANSMIT. */
  67.     byte        retransmitfrom;
  68.     
  69.     byte        starttic;
  70.     byte        player;
  71.     byte        numtics;
  72.     ticcmd_t        cmds[BACKUPTICS];
  73.  
  74. } doomdata_t;
  75.  
  76.  
  77.  
  78.  
  79. typedef struct
  80. {
  81.     /*  Supposed to be DOOMCOM_ID? */
  82.     long        id;
  83.     
  84.     /*  DOOM executes an int to execute commands. */
  85.     short        intnum;        
  86.     /*  Communication between DOOM and the driver. */
  87.     /*  Is CMD_SEND or CMD_GET. */
  88.     short        command;
  89.     /*  Is dest for send, set by get (-1 = no packet). */
  90.     short        remotenode;
  91.     
  92.     /*  Number of bytes in doomdata to be sent */
  93.     short        datalength;
  94.  
  95.     /*  Info common to all nodes. */
  96.     /*  Console is allways node 0. */
  97.     short        numnodes;
  98.     /*  Flag: 1 = no duplication, 2-5 = dup for slow nets. */
  99.     short        ticdup;
  100.     /*  Flag: 1 = send a backup tic in every packet. */
  101.     short        extratics;
  102.     /*  Flag: 1 = deathmatch. */
  103.     short        deathmatch;
  104.     /*  Flag: -1 = new game, 0-5 = load savegame */
  105.     short        savegame;
  106.     short        episode;    /*  1-3 */
  107.     short        map;        /*  1-9 */
  108.     short        skill;        /*  1-5 */
  109.  
  110.     /*  Info specific to this node. */
  111.     short        consoleplayer;
  112.     short        numplayers;
  113.     
  114.     /*  These are related to the 3-display mode, */
  115.     /*   in which two drones looking left and right */
  116.     /*   were used to render two additional views */
  117.     /*   on two additional computers. */
  118.     /*  Probably not operational anymore. */
  119.     /*  1 = left, 0 = center, -1 = right */
  120.     short        angleoffset;
  121.     /*  1 = drone */
  122.     short        drone;        
  123.  
  124.     /*  The packet data to be sent. */
  125.     doomdata_t        data;
  126.     
  127. } doomcom_t;
  128.  
  129.  
  130.  
  131. /*  Create any new ticcmds and broadcast to other players. */
  132. void NetUpdate (void);
  133.  
  134. /*  Broadcasts special packets to other players */
  135. /*   to notify of game exit */
  136. void D_QuitNetGame (void);
  137.  
  138. /* ? how many ticks to run? */
  139. void TryRunTics (void);
  140.  
  141.  
  142. #endif
  143.  
  144. /* ----------------------------------------------------------------------------- */
  145. /*  */
  146. /*  $Log:$ */
  147. /*  */
  148. /* ----------------------------------------------------------------------------- */
  149.  
  150.