|
| 1 | +//#define DOOM2 |
| 2 | + |
| 3 | +#include <stdio.h> |
| 4 | +#include <stdlib.h> |
| 5 | +#include <string.h> |
| 6 | +#include <process.h> |
| 7 | +#include <conio.h> |
| 8 | +#include <dos.h> |
| 9 | + |
| 10 | +#include "doomnet.h" |
| 11 | +//#include "ipxstr.h" |
| 12 | +#include "ipx_frch.h" // FRENCH VERSION |
| 13 | + |
| 14 | +doomcom_t doomcom; |
| 15 | +int vectorishooked; |
| 16 | +void interrupt (*olddoomvect) (void); |
| 17 | + |
| 18 | + |
| 19 | + |
| 20 | +/* |
| 21 | +============= |
| 22 | += |
| 23 | += LaunchDOOM |
| 24 | += |
| 25 | +These fields in doomcom should be filled in before calling: |
| 26 | +
|
| 27 | + short numnodes; // console is allways node 0 |
| 28 | + short ticdup; // 1 = no duplication, 2-5 = dup for |
| 29 | +slow nets |
| 30 | + short extratics; // 1 = send a backup tic in every |
| 31 | +packet |
| 32 | +
|
| 33 | + short consoleplayer; // 0-3 = player number |
| 34 | + short numplayers; // 1-4 |
| 35 | + short angleoffset; // 1 = left, 0 = center, -1 = right |
| 36 | + short drone; // 1 = drone |
| 37 | +============= |
| 38 | +*/ |
| 39 | + |
| 40 | +void LaunchDOOM (void) |
| 41 | +{ |
| 42 | + char *newargs[99]; |
| 43 | + char adrstring[10]; |
| 44 | + long flatadr; |
| 45 | + |
| 46 | +// prepare for DOOM |
| 47 | + doomcom.id = DOOMCOM_ID; |
| 48 | + |
| 49 | +// hook the interrupt vector |
| 50 | + olddoomvect = getvect (doomcom.intnum); |
| 51 | + setvect (doomcom.intnum,(void interrupt (*)(void))MK_FP(_CS, |
| 52 | +(int)NetISR)); |
| 53 | + vectorishooked = 1; |
| 54 | + |
| 55 | +// build the argument list for DOOM, adding a -net &doomcom |
| 56 | + memcpy (newargs, _argv, (_argc+1)*2); |
| 57 | + newargs[_argc] = "-net"; |
| 58 | + flatadr = (long)_DS*16 + (unsigned)&doomcom; |
| 59 | + sprintf (adrstring,"%lu",flatadr); |
| 60 | + newargs[_argc+1] = adrstring; |
| 61 | + newargs[_argc+2] = NULL; |
| 62 | + |
| 63 | + if (!access("doom2.exe",0)) |
| 64 | + spawnv (P_WAIT, "doom2", newargs); |
| 65 | + else |
| 66 | + spawnv (P_WAIT, "doom", newargs); |
| 67 | + |
| 68 | + #ifdef DOOM2 |
| 69 | + printf (STR_RETURNED"\n"); |
| 70 | + #else |
| 71 | + printf ("Returned from DOOM\n"); |
| 72 | + #endif |
| 73 | +} |
0 commit comments