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