home *** CD-ROM | disk | FTP | other *** search
/ Amiga Format CD 28 / amigaformatcd28.iso / -screenplay- / otherstuff / adoomppc_src / d_net.h < prev    next >
C/C++ Source or Header  |  1998-04-23  |  3KB  |  154 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. #pragma options align=mac68k
  60.  
  61. //
  62. // Network packet data.
  63. //
  64. typedef struct
  65. {
  66.     // High bit is retransmit request.
  67.     unsigned        checksum;
  68.     // Only valid if NCMD_RETRANSMIT.
  69.     byte        retransmitfrom;
  70.     
  71.     byte        starttic;
  72.     byte        player;
  73.     byte        numtics;
  74.     ticcmd_t        cmds[BACKUPTICS];
  75.  
  76. } doomdata_t;
  77.  
  78.  
  79.  
  80.  
  81. typedef struct
  82. {
  83.     // Supposed to be DOOMCOM_ID?
  84.     long        id;
  85.     
  86.     // DOOM executes an int to execute commands.
  87.     short        intnum;        
  88.     // Communication between DOOM and the driver.
  89.     // Is CMD_SEND or CMD_GET.
  90.     short        command;
  91.     // Is dest for send, set by get (-1 = no packet).
  92.     short        remotenode;
  93.     
  94.     // Number of bytes in doomdata to be sent
  95.     short        datalength;
  96.  
  97.     // Info common to all nodes.
  98.     // Console is allways node 0.
  99.     short        numnodes;
  100.     // Flag: 1 = no duplication, 2-5 = dup for slow nets.
  101.     short        ticdup;
  102.     // Flag: 1 = send a backup tic in every packet.
  103.     short        extratics;
  104.     // Flag: 1 = deathmatch.
  105.     short        deathmatch;
  106.     // Flag: -1 = new game, 0-5 = load savegame
  107.     short        savegame;
  108.     short        episode;    // 1-3
  109.     short        map;        // 1-9
  110.     short        skill;        // 1-5
  111.  
  112.     // Info specific to this node.
  113.     short        consoleplayer;
  114.     short        numplayers;
  115.     
  116.     // These are related to the 3-display mode,
  117.     //  in which two drones looking left and right
  118.     //  were used to render two additional views
  119.     //  on two additional computers.
  120.     // Probably not operational anymore.
  121.     // 1 = left, 0 = center, -1 = right
  122.     short        angleoffset;
  123.     // 1 = drone
  124.     short        drone;        
  125.  
  126.     // The packet data to be sent.
  127.     doomdata_t        data;
  128.     
  129. } doomcom_t;
  130.  
  131. #pragma options align=power
  132.  
  133.  
  134.  
  135. // Create any new ticcmds and broadcast to other players.
  136. void NetUpdate (void);
  137.  
  138. // Broadcasts special packets to other players
  139. //  to notify of game exit
  140. void D_QuitNetGame (void);
  141.  
  142. //? how many ticks to run?
  143. void TryRunTics (void);
  144.  
  145.  
  146. #endif
  147.  
  148. //-----------------------------------------------------------------------------
  149. //
  150. // $Log:$
  151. //
  152. //-----------------------------------------------------------------------------
  153.  
  154.