1 // Emacs style mode select -*- C++ -*-
2 //-----------------------------------------------------------------------------
6 // Copyright (C) 1993-1996 by id Software, Inc.
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.
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
21 //-----------------------------------------------------------------------------
24 rcsid[] = "$Id: m_bbox.c,v 1.1 1997/02/03 22:45:10 b1 Exp $";
29 // #include "i_system.h"
30 // #include "d_event.h"
40 void I_InitNetwork (void)
42 printf("PORTME i_net.c I_InitNetwork (use 9P)\n");
44 doomcom = malloc (sizeof(*doomcom));
45 memset (doomcom, 0, sizeof(*doomcom));
47 /* set up for network */
49 doomcom->extratics = 0;
51 // netsend = PacketSend;
52 // netget = PacketGet;
55 /* parse player number and host list */
56 // doomcom->consoleplayer = myargv[i+1][0]-'1';
58 doomcom->numnodes = 1; // this node for sure
60 doomcom->id = DOOMCOM_ID;
61 doomcom->numplayers = doomcom->numnodes;
64 boolean trueval = true;
67 struct hostent* hostentry; // host information entry
69 doomcom = malloc (sizeof (*doomcom) );
70 memset (doomcom, 0, sizeof(*doomcom) );
73 i = M_CheckParm ("-dup");
76 doomcom->ticdup = myargv[i+1][0]-'0';
77 if (doomcom->ticdup < 1)
79 if (doomcom->ticdup > 9)
85 if (M_CheckParm ("-extratic"))
86 doomcom-> extratics = 1;
88 doomcom-> extratics = 0;
90 p = M_CheckParm ("-port");
93 DOOMPORT = atoi (myargv[p+1]);
94 printf ("using alternate port %i\n",DOOMPORT);
97 // parse network game options,
98 // -net <consoleplayer> <host> <host> ...
99 i = M_CheckParm ("-net");
102 // single player game
104 doomcom->id = DOOMCOM_ID;
105 doomcom->numplayers = doomcom->numnodes = 1;
106 doomcom->deathmatch = false;
107 doomcom->consoleplayer = 0;
111 netsend = PacketSend;
115 // parse player number and host list
116 doomcom->consoleplayer = myargv[i+1][0]-'1';
118 doomcom->numnodes = 1; // this node for sure
121 while (++i < myargc && myargv[i][0] != '-')
123 sendaddress[doomcom->numnodes].sin_family = AF_INET;
124 sendaddress[doomcom->numnodes].sin_port = htons(DOOMPORT);
125 if (myargv[i][0] == '.')
127 sendaddress[doomcom->numnodes].sin_addr.s_addr
128 = inet_addr (myargv[i]+1);
132 hostentry = gethostbyname (myargv[i]);
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];
141 doomcom->id = DOOMCOM_ID;
142 doomcom->numplayers = doomcom->numnodes;
150 if (doomcom->command == CMD_SEND)
154 else if (doomcom->command == CMD_GET)
159 I_Error ("Bad net cmd: %i\n",doomcom->command);