Skip to content

Commit

Permalink
Adding the release of the DOOM IPX driver.
Browse files Browse the repository at this point in the history
  • Loading branch information
Travis Bradshaw committed Jan 31, 2012
1 parent 4eb368a commit 73424b6
Show file tree
Hide file tree
Showing 8 changed files with 1,003 additions and 0 deletions.
73 changes: 73 additions & 0 deletions ipx/DOOMNET.C
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
//#define DOOM2

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <process.h>
#include <conio.h>
#include <dos.h>

#include "doomnet.h"
//#include "ipxstr.h"
#include "ipx_frch.h" // FRENCH VERSION

doomcom_t doomcom;
int vectorishooked;
void interrupt (*olddoomvect) (void);



/*
=============
=
= LaunchDOOM
=
These fields in doomcom should be filled in before calling:
short numnodes; // console is allways node 0
short ticdup; // 1 = no duplication, 2-5 = dup for
slow nets
short extratics; // 1 = send a backup tic in every
packet
short consoleplayer; // 0-3 = player number
short numplayers; // 1-4
short angleoffset; // 1 = left, 0 = center, -1 = right
short drone; // 1 = drone
=============
*/

void LaunchDOOM (void)
{
char *newargs[99];
char adrstring[10];
long flatadr;

// prepare for DOOM
doomcom.id = DOOMCOM_ID;

// hook the interrupt vector
olddoomvect = getvect (doomcom.intnum);
setvect (doomcom.intnum,(void interrupt (*)(void))MK_FP(_CS,
(int)NetISR));
vectorishooked = 1;

// build the argument list for DOOM, adding a -net &doomcom
memcpy (newargs, _argv, (_argc+1)*2);
newargs[_argc] = "-net";
flatadr = (long)_DS*16 + (unsigned)&doomcom;
sprintf (adrstring,"%lu",flatadr);
newargs[_argc+1] = adrstring;
newargs[_argc+2] = NULL;

if (!access("doom2.exe",0))
spawnv (P_WAIT, "doom2", newargs);
else
spawnv (P_WAIT, "doom", newargs);

#ifdef DOOM2
printf (STR_RETURNED"\n");
#else
printf ("Returned from DOOM\n");
#endif
}
58 changes: 58 additions & 0 deletions ipx/DOOMNET.H
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
// doomnet.h

#define PEL_WRITE_ADR 0x3c8
#define PEL_DATA 0x3c9

#define I_ColorBlack(r,g,b) {outp(PEL_WRITE_ADR,0);outp(PEL_DATA,r);outp(PEL_DATA,g);outp(PEL_DATA,b);};



#define MAXNETNODES 8 // max computers in a game
#define MAXPLAYERS 4 // 4 players max + drones


#define CMD_SEND 1
#define CMD_GET 2

#define DOOMCOM_ID 0x12345678l

typedef struct
{
long id;
short intnum; // DOOM executes an int to send commands

// communication between DOOM and the driver
short command; // CMD_SEND or CMD_GET
short remotenode; // dest for send, set by get (-1 = no packet)
short datalength; // bytes in doomdata to be sent / bytes read

// info common to all nodes
short numnodes; // console is allways node 0
short ticdup; // 1 = no duplication, 2-5 = dup for slow nets
short extratics; // 1 = send a backup tic in every packet
short deathmatch; // 1 = deathmatch
short savegame; // -1 = new game, 0-5 = load savegame
short episode; // 1-3
short map; // 1-9
short skill; // 1-5

// info specific to this node
short consoleplayer; // 0-3 = player number
short numplayers; // 1-4
short angleoffset; // 1 = left, 0 = center, -1 = right
short drone; // 1 = drone

// packet data to be sent
char data[512];
} doomcom_t;



extern doomcom_t doomcom;
extern void interrupt (*olddoomvect) (void);
extern int vectorishooked;

int CheckParm (char *check);
void LaunchDOOM (void);
void interrupt NetISR (void);

Loading

0 comments on commit 73424b6

Please sign in to comment.