Skip to content

Commit 77735c3

Browse files
author
Travis Bradshaw
committed
The source for the DOOM serial / model driver.
1 parent 73424b6 commit 77735c3

File tree

8 files changed

+1443
-0
lines changed

8 files changed

+1443
-0
lines changed

sersrc/DOOMNET.C

+126
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,126 @@
1+
#include <stdio.h>
2+
#include <io.h>
3+
#include <stdlib.h>
4+
#include <string.h>
5+
#include <process.h>
6+
#include <dos.h>
7+
#include "doomnet.h"
8+
9+
//#include "serstr.h"
10+
#include "ser_frch.h" // FRENCH VERSION
11+
12+
#define DOOM2
13+
14+
extern int myargc;
15+
extern char **myargv;
16+
17+
doomcom_t doomcom;
18+
int vectorishooked;
19+
void interrupt (*olddoomvect) (void);
20+
21+
22+
23+
/*
24+
=================
25+
=
26+
= CheckParm
27+
=
28+
= Checks for the given parameter in the program's command line arguments
29+
=
30+
= Returns the argument number (1 to argc-1) or 0 if not present
31+
=
32+
=================
33+
*/
34+
35+
int CheckParm (char *check)
36+
{
37+
int i;
38+
39+
for (i = 1;i<myargc;i++)
40+
if ( !stricmp(check,myargv[i]) )
41+
return i;
42+
43+
return 0;
44+
}
45+
46+
47+
/*
48+
=============
49+
=
50+
= LaunchDOOM
51+
=
52+
These fields in doomcom should be filled in before calling:
53+
54+
short numnodes; // console is allways node 0
55+
short ticdup; // 1 = no duplication, 2-5 = dup for slow nets
56+
short extratics; // 1 = send a backup tic in every packet
57+
58+
short consoleplayer; // 0-3 = player number
59+
short numplayers; // 1-4
60+
short angleoffset; // 1 = left, 0 = center, -1 = right
61+
short drone; // 1 = drone
62+
=============
63+
*/
64+
65+
void LaunchDOOM (void)
66+
{
67+
char *newargs[99];
68+
char adrstring[10];
69+
long flatadr;
70+
int p;
71+
unsigned char far *vector;
72+
73+
// prepare for DOOM
74+
doomcom.id = DOOMCOM_ID;
75+
76+
// hook an interrupt vector
77+
p= CheckParm ("-vector");
78+
79+
if (p)
80+
{
81+
doomcom.intnum = sscanf ("0x%x",_argv[p+1]);
82+
}
83+
else
84+
{
85+
for (doomcom.intnum = 0x60 ; doomcom.intnum <= 0x66 ; doomcom.intnum++)
86+
{
87+
vector = *(char far * far *)(doomcom.intnum*4);
88+
if ( !vector || *vector == 0xcf )
89+
break;
90+
}
91+
if (doomcom.intnum == 0x67)
92+
{
93+
printf (STR_WARNING);
94+
doomcom.intnum = 0x66;
95+
}
96+
}
97+
printf (STR_COMM"\n",doomcom.intnum);
98+
99+
olddoomvect = getvect (doomcom.intnum);
100+
setvect (doomcom.intnum,NetISR);
101+
vectorishooked = 1;
102+
103+
// build the argument list for DOOM, adding a -net &doomcom
104+
memcpy (newargs, myargv, (myargc+1)*2);
105+
newargs[myargc] = "-net";
106+
flatadr = (long)_DS*16 + (unsigned)&doomcom;
107+
sprintf (adrstring,"%lu",flatadr);
108+
newargs[myargc+1] = adrstring;
109+
newargs[myargc+2] = NULL;
110+
111+
// spawnv (P_WAIT, "m:\\newdoom\\doom", newargs);
112+
if (!access("doom2.exe",0))
113+
spawnv (P_WAIT, "doom2", newargs);
114+
else
115+
spawnv (P_WAIT, "doom", newargs);
116+
117+
#ifdef DOOM2
118+
printf (STR_RETURNED"\n");
119+
#else
120+
printf ("Returned from DOOM\n");
121+
#endif
122+
123+
124+
}
125+
126+

sersrc/DOOMNET.H

+60
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
// doomnet.h
2+
3+
4+
#define PEL_WRITE_ADR 0x3c8
5+
#define PEL_DATA 0x3c9
6+
7+
#define I_ColorBlack(r,g,b) {outp(PEL_WRITE_ADR,0);outp(PEL_DATA,r);outp(PEL_DATA,g);outp(PEL_DATA,b);};
8+
9+
10+
11+
12+
#define MAXNETNODES 8 // max computers in a game
13+
#define MAXPLAYERS 4 // 4 players max + drones
14+
15+
16+
#define CMD_SEND 1
17+
#define CMD_GET 2
18+
19+
#define DOOMCOM_ID 0x12345678l
20+
21+
typedef struct
22+
{
23+
long id;
24+
short intnum; // DOOM executes an int to send commands
25+
26+
// communication between DOOM and the driver
27+
short command; // CMD_SEND or CMD_GET
28+
short remotenode; // dest for send, set by get (-1 = no packet)
29+
short datalength; // bytes in doomdata to be sent / bytes read
30+
31+
// info common to all nodes
32+
short numnodes; // console is allways node 0
33+
short ticdup; // 1 = no duplication, 2-5 = dup for slow nets
34+
short extratics; // 1 = send a backup tic in every packet
35+
short deathmatch; // 1 = deathmatch
36+
short savegame; // -1 = new game, 0-5 = load savegame
37+
short episode; // 1-3
38+
short map; // 1-9
39+
short skill; // 1-5
40+
41+
// info specific to this node
42+
short consoleplayer; // 0-3 = player number
43+
short numplayers; // 1-4
44+
short angleoffset; // 1 = left, 0 = center, -1 = right
45+
short drone; // 1 = drone
46+
47+
// packet data to be sent
48+
char data[512];
49+
} doomcom_t;
50+
51+
52+
53+
extern doomcom_t doomcom;
54+
extern void interrupt (*olddoomvect) (void);
55+
extern int vectorishooked;
56+
57+
int CheckParm (char *check);
58+
void LaunchDOOM (void);
59+
void interrupt NetISR (void);
60+

0 commit comments

Comments
 (0)