]> git.lizzy.rs Git - plan9front.git/blob - sys/src/games/doom/i_net.c
games/doom: fix switch textures swapping in ultimate doom (thansk qu7uux)
[plan9front.git] / sys / src / games / doom / i_net.c
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 // $Log:$
18 //
19 // DESCRIPTION:
20 //
21 //-----------------------------------------------------------------------------
22
23 static const char
24 rcsid[] = "$Id: m_bbox.c,v 1.1 1997/02/03 22:45:10 b1 Exp $";
25
26 #include "doomdef.h"
27 #include "doomstat.h"
28
29 // #include "i_system.h"
30 // #include "d_event.h"
31 #include "d_net.h"
32 #include "m_argv.h"
33
34 #include "i_net.h"
35
36
37 //
38 // I_InitNetwork
39 //
40 void I_InitNetwork (void)
41 {
42 printf("PORTME i_net.c I_InitNetwork (use 9P)\n");
43
44         doomcom = malloc (sizeof(*doomcom));
45         memset (doomcom, 0, sizeof(*doomcom));
46
47         /* set up for network */
48         doomcom->ticdup = 1;
49         doomcom->extratics = 0;
50
51 //      netsend = PacketSend;
52 //      netget = PacketGet;
53 //      netgame = true;
54
55         /* parse player number and host list */
56 //      doomcom->consoleplayer = myargv[i+1][0]-'1';
57
58         doomcom->numnodes = 1;  // this node for sure
59
60         doomcom->id = DOOMCOM_ID;
61         doomcom->numplayers = doomcom->numnodes;
62
63 /*
64     boolean             trueval = true;
65     int                 i;
66     int                 p;
67     struct hostent*     hostentry;      // host information entry
68         
69     doomcom = malloc (sizeof (*doomcom) );
70     memset (doomcom, 0, sizeof(*doomcom) );
71     
72     // set up for network
73     i = M_CheckParm ("-dup");
74     if (i && i< myargc-1)
75     {
76         doomcom->ticdup = myargv[i+1][0]-'0';
77         if (doomcom->ticdup < 1)
78             doomcom->ticdup = 1;
79         if (doomcom->ticdup > 9)
80             doomcom->ticdup = 9;
81     }
82     else
83         doomcom-> ticdup = 1;
84         
85     if (M_CheckParm ("-extratic"))
86         doomcom-> extratics = 1;
87     else
88         doomcom-> extratics = 0;
89                 
90     p = M_CheckParm ("-port");
91     if (p && p<myargc-1)
92     {
93         DOOMPORT = atoi (myargv[p+1]);
94         printf ("using alternate port %i\n",DOOMPORT);
95     }
96     
97     // parse network game options,
98     //  -net <consoleplayer> <host> <host> ...
99     i = M_CheckParm ("-net");
100     if (!i)
101     {
102         // single player game
103         netgame = false;
104         doomcom->id = DOOMCOM_ID;
105         doomcom->numplayers = doomcom->numnodes = 1;
106         doomcom->deathmatch = false;
107         doomcom->consoleplayer = 0;
108         return;
109     }
110
111     netsend = PacketSend;
112     netget = PacketGet;
113     netgame = true;
114
115     // parse player number and host list
116     doomcom->consoleplayer = myargv[i+1][0]-'1';
117
118     doomcom->numnodes = 1;      // this node for sure
119         
120     i++;
121     while (++i < myargc && myargv[i][0] != '-')
122     {
123         sendaddress[doomcom->numnodes].sin_family = AF_INET;
124         sendaddress[doomcom->numnodes].sin_port = htons(DOOMPORT);
125         if (myargv[i][0] == '.')
126         {
127             sendaddress[doomcom->numnodes].sin_addr.s_addr 
128                 = inet_addr (myargv[i]+1);
129         }
130         else
131         {
132             hostentry = gethostbyname (myargv[i]);
133             if (!hostentry)
134                 I_Error ("gethostbyname: couldn't find %s", myargv[i]);
135             sendaddress[doomcom->numnodes].sin_addr.s_addr 
136                 = *(int *)hostentry->h_addr_list[0];
137         }
138         doomcom->numnodes++;
139     }
140         
141     doomcom->id = DOOMCOM_ID;
142     doomcom->numplayers = doomcom->numnodes;
143 */
144 }
145
146
147 void I_NetCmd (void)
148 {
149 /*
150     if (doomcom->command == CMD_SEND)
151     {
152         netsend ();
153     }
154     else if (doomcom->command == CMD_GET)
155     {
156         netget ();
157     }
158     else
159         I_Error ("Bad net cmd: %i\n",doomcom->command);
160 */
161 }