├── README.TXT ├── ipx ├── DOOMNET.C ├── DOOMNET.H ├── IPXNET.C ├── IPXNET.H ├── IPXSETUP.C ├── IPXSTR.H ├── IPX_FRCH.H └── README ├── linuxdoom-1.10 ├── .gitignore ├── CVS │ ├── Entries │ ├── Repository │ └── Root ├── ChangeLog ├── DOOMLIC.TXT ├── FILES ├── FILES2 ├── Makefile ├── README.asm ├── README.b ├── README.book ├── README.gl ├── README.sound ├── TODO ├── am_map.c ├── am_map.h ├── d_englsh.h ├── d_event.h ├── d_french.h ├── d_items.c ├── d_items.h ├── d_main.c ├── d_main.h ├── d_net.c ├── d_net.h ├── d_player.h ├── d_textur.h ├── d_think.h ├── d_ticcmd.h ├── doom.inf ├── doom.wad ├── doomdata.h ├── doomdef.c ├── doomdef.h ├── doomstat.c ├── doomstat.h ├── doomtype.h ├── dstrings.c ├── dstrings.h ├── efi │ ├── i_net.c │ ├── i_sound.c │ ├── i_system.c │ └── i_video.c ├── f_finale.c ├── f_finale.h ├── f_wipe.c ├── f_wipe.h ├── g_game.c ├── g_game.h ├── hu_lib.c ├── hu_lib.h ├── hu_stuff.c ├── hu_stuff.h ├── i_main.c ├── i_net.c ├── i_net.h ├── i_sound.c ├── i_sound.h ├── i_system.c ├── i_system.h ├── i_video.c ├── i_video.h ├── info.c ├── info.h ├── m_argv.c ├── m_argv.h ├── m_bbox.c ├── m_bbox.h ├── m_cheat.c ├── m_cheat.h ├── m_fixed.c ├── m_fixed.h ├── m_menu.c ├── m_menu.h ├── m_misc.c ├── m_misc.h ├── m_random.c ├── m_random.h ├── m_swap.c ├── m_swap.h ├── p_ceilng.c ├── p_doors.c ├── p_enemy.c ├── p_floor.c ├── p_inter.c ├── p_inter.h ├── p_lights.c ├── p_local.h ├── p_map.c ├── p_maputl.c ├── p_mobj.c ├── p_mobj.h ├── p_plats.c ├── p_pspr.c ├── p_pspr.h ├── p_saveg.c ├── p_saveg.h ├── p_setup.c ├── p_setup.h ├── p_sight.c ├── p_spec.c ├── p_spec.h ├── p_switch.c ├── p_telept.c ├── p_tick.c ├── p_tick.h ├── p_user.c ├── r_bsp.c ├── r_bsp.h ├── r_data.c ├── r_data.h ├── r_defs.h ├── r_draw.c ├── r_draw.h ├── r_local.h ├── r_main.c ├── r_main.h ├── r_plane.c ├── r_plane.h ├── r_segs.c ├── r_segs.h ├── r_sky.c ├── r_sky.h ├── r_state.h ├── r_things.c ├── r_things.h ├── s_sound.c ├── s_sound.h ├── sounds.c ├── sounds.h ├── st_lib.c ├── st_lib.h ├── st_stuff.c ├── st_stuff.h ├── tables.c ├── tables.h ├── tools │ ├── Makefile │ ├── texdump.c │ ├── wad.c │ ├── wad.h │ └── wadtool.c ├── v_video.c ├── v_video.h ├── w_wad.c ├── w_wad.h ├── wi_stuff.c ├── wi_stuff.h ├── z_zone.c └── z_zone.h ├── sersrc ├── DOOMNET.C ├── DOOMNET.H ├── PORT.C ├── README.TXT ├── SERSETUP.C ├── SERSETUP.H ├── SERSTR.H └── SER_FRCH.H └── sndserv ├── Makefile ├── README.sndserv ├── linux.c ├── sounds.c ├── sounds.h ├── soundsrv.c ├── soundsrv.h ├── soundst.h ├── wadread.c └── wadread.h /README.TXT: -------------------------------------------------------------------------------- 1 | 2 | Here it is, at long last. The DOOM source code is released for your 3 | non-profit use. You still need real DOOM data to work with this code. 4 | If you don't actually own a real copy of one of the DOOMs, you should 5 | still be able to find them at software stores. 6 | 7 | Many thanks to Bernd Kreimeier for taking the time to clean up the 8 | project and make sure that it actually works. Projects tends to rot if 9 | you leave it alone for a few years, and it takes effort for someone to 10 | deal with it again. 11 | 12 | The bad news: this code only compiles and runs on linux. We couldn't 13 | release the dos code because of a copyrighted sound library we used 14 | (wow, was that a mistake -- I write my own sound code now), and I 15 | honestly don't even know what happened to the port that microsoft did 16 | to windows. 17 | 18 | Still, the code is quite portable, and it should be straightforward to 19 | bring it up on just about any platform. 20 | 21 | I wrote this code a long, long time ago, and there are plenty of things 22 | that seem downright silly in retrospect (using polar coordinates for 23 | clipping comes to mind), but overall it should still be a usefull base 24 | to experiment and build on. 25 | 26 | The basic rendering concept -- horizontal and vertical lines of constant 27 | Z with fixed light shading per band was dead-on, but the implementation 28 | could be improved dramatically from the original code if it were 29 | revisited. The way the rendering proceded from walls to floors to 30 | sprites could be collapsed into a single front-to-back walk of the bsp 31 | tree to collect information, then draw all the contents of a subsector 32 | on the way back up the tree. It requires treating floors and ceilings 33 | as polygons, rather than just the gaps between walls, and it requires 34 | clipping sprite billboards into subsector fragments, but it would be 35 | The Right Thing. 36 | 37 | The movement and line of sight checking against the lines is one of the 38 | bigger misses that I look back on. It is messy code that had some 39 | failure cases, and there was a vastly simpler (and faster) solution 40 | sitting in front of my face. I used the BSP tree for rendering things, 41 | but I didn't realize at the time that it could also be used for 42 | environment testing. Replacing the line of sight test with a bsp line 43 | clip would be pretty easy. Sweeping volumes for movement gets a bit 44 | tougher, and touches on many of the challenges faced in quake / quake2 45 | with edge bevels on polyhedrons. 46 | 47 | Some project ideas: 48 | 49 | Port it to your favorite operating system. 50 | 51 | Add some rendering features -- transparency, look up / down, slopes, 52 | etc. 53 | 54 | Add some game features -- weapons, jumping, ducking, flying, etc. 55 | 56 | Create a packet server based internet game. 57 | 58 | Create a client / server based internet game. 59 | 60 | Do a 3D accelerated version. On modern hardware (fast pentium + 3DFX) 61 | you probably wouldn't even need to be clever -- you could just draw the 62 | entire level and get reasonable speed. With a touch of effort, it should 63 | easily lock at 60 fps (well, there are some issues with DOOM's 35 hz 64 | timebase...). The biggest issues would probably be the non-power of two 65 | texture sizes and the walls composed of multiple textures. 66 | 67 | 68 | I don't have a real good guess at how many people are going to be 69 | playing with this, but if significant projects are undertaken, it would 70 | be cool to see a level of community cooperation. I know that most early 71 | projects are going to be rough hacks done in isolation, but I would be 72 | very pleased to see a coordinated 'net release of an improved, backwards 73 | compatable version of DOOM on multiple platforms next year. 74 | 75 | Have fun. 76 | 77 | John Carmack 78 | 12-23-97 79 | -------------------------------------------------------------------------------- /ipx/DOOMNET.C: -------------------------------------------------------------------------------- 1 | //#define DOOM2 2 | 3 | #include 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 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 | } 74 | -------------------------------------------------------------------------------- /ipx/DOOMNET.H: -------------------------------------------------------------------------------- 1 | // doomnet.h 2 | 3 | #define PEL_WRITE_ADR 0x3c8 4 | #define PEL_DATA 0x3c9 5 | 6 | #define I_ColorBlack(r,g,b) {outp(PEL_WRITE_ADR,0);outp(PEL_DATA,r);outp(PEL_DATA,g);outp(PEL_DATA,b);}; 7 | 8 | 9 | 10 | #define MAXNETNODES 8 // max computers in a game 11 | #define MAXPLAYERS 4 // 4 players max + drones 12 | 13 | 14 | #define CMD_SEND 1 15 | #define CMD_GET 2 16 | 17 | #define DOOMCOM_ID 0x12345678l 18 | 19 | typedef struct 20 | { 21 | long id; 22 | short intnum; // DOOM executes an int to send commands 23 | 24 | // communication between DOOM and the driver 25 | short command; // CMD_SEND or CMD_GET 26 | short remotenode; // dest for send, set by get (-1 = no packet) 27 | short datalength; // bytes in doomdata to be sent / bytes read 28 | 29 | // info common to all nodes 30 | short numnodes; // console is allways node 0 31 | short ticdup; // 1 = no duplication, 2-5 = dup for slow nets 32 | short extratics; // 1 = send a backup tic in every packet 33 | short deathmatch; // 1 = deathmatch 34 | short savegame; // -1 = new game, 0-5 = load savegame 35 | short episode; // 1-3 36 | short map; // 1-9 37 | short skill; // 1-5 38 | 39 | // info specific to this node 40 | short consoleplayer; // 0-3 = player number 41 | short numplayers; // 1-4 42 | short angleoffset; // 1 = left, 0 = center, -1 = right 43 | short drone; // 1 = drone 44 | 45 | // packet data to be sent 46 | char data[512]; 47 | } doomcom_t; 48 | 49 | 50 | 51 | extern doomcom_t doomcom; 52 | extern void interrupt (*olddoomvect) (void); 53 | extern int vectorishooked; 54 | 55 | int CheckParm (char *check); 56 | void LaunchDOOM (void); 57 | void interrupt NetISR (void); 58 | 59 | -------------------------------------------------------------------------------- /ipx/IPXNET.H: -------------------------------------------------------------------------------- 1 | // ipxnet.h 2 | 3 | 4 | typedef struct 5 | { 6 | char private[512]; 7 | } doomdata_t; 8 | 9 | 10 | #include "DoomNet.h" 11 | 12 | //=========================================================================== 13 | 14 | #define NUMPACKETS 10 // max outstanding packets before loss 15 | 16 | // setupdata_t is used as doomdata_t during setup 17 | typedef struct 18 | { 19 | short gameid; // so multiple games can setup at once 20 | short drone; 21 | short nodesfound; 22 | short nodeswanted; 23 | } setupdata_t; 24 | 25 | 26 | 27 | typedef unsigned char BYTE; 28 | typedef unsigned short WORD; 29 | typedef unsigned long LONG; 30 | 31 | typedef struct IPXPacketStructure 32 | { 33 | WORD PacketCheckSum; /* high-low */ 34 | WORD PacketLength; /* high-low */ 35 | BYTE PacketTransportControl; 36 | BYTE PacketType; 37 | 38 | BYTE dNetwork[4]; /* high-low */ 39 | BYTE dNode[6]; /* high-low */ 40 | BYTE dSocket[2]; /* high-low */ 41 | 42 | BYTE sNetwork[4]; /* high-low */ 43 | BYTE sNode[6]; /* high-low */ 44 | BYTE sSocket[2]; /* high-low */ 45 | } IPXPacket; 46 | 47 | 48 | typedef struct 49 | { 50 | BYTE network[4]; /* high-low */ 51 | BYTE node[6]; /* high-low */ 52 | } localadr_t; 53 | 54 | typedef struct 55 | { 56 | BYTE node[6]; /* high-low */ 57 | } nodeadr_t; 58 | 59 | typedef struct ECBStructure 60 | { 61 | WORD Link[2]; /* offset-segment */ 62 | WORD ESRAddress[2]; /* offset-segment */ 63 | BYTE InUseFlag; 64 | BYTE CompletionCode; 65 | WORD ECBSocket; /* high-low */ 66 | BYTE IPXWorkspace[4]; /* N/A */ 67 | BYTE DriverWorkspace[12]; /* N/A */ 68 | BYTE ImmediateAddress[6]; /* high-low */ 69 | WORD FragmentCount; /* low-high */ 70 | 71 | WORD fAddress[2]; /* offset-segment */ 72 | WORD fSize; /* low-high */ 73 | 74 | WORD f2Address[2]; /* offset-segment */ 75 | WORD f2Size; /* low-high */ 76 | } ECB; 77 | 78 | 79 | // time is used by the communication driver to sequence packets returned 80 | // to DOOM when more than one is waiting 81 | 82 | typedef struct 83 | { 84 | ECB ecb; 85 | IPXPacket ipx; 86 | 87 | long time; 88 | doomdata_t data; 89 | } packet_t; 90 | 91 | 92 | extern doomcom_t doomcom; 93 | extern int gameid; 94 | 95 | extern nodeadr_t nodeadr[MAXNETNODES+1]; 96 | extern int localnodenum; 97 | 98 | extern long localtime; // for time stamp in packets 99 | extern long remotetime; // timestamp of last packet gotten 100 | 101 | extern nodeadr_t remoteadr; 102 | 103 | extern int myargc; 104 | 105 | extern char **myargv; 106 | 107 | void Error (char *error, ...); 108 | 109 | 110 | void InitNetwork (void); 111 | void ShutdownNetwork (void); 112 | void SendPacket (int destination); 113 | int GetPacket (void); 114 | int CheckParm (char *check); 115 | 116 | void PrintAddress (nodeadr_t *adr, char *str); 117 | 118 | -------------------------------------------------------------------------------- /ipx/IPXSTR.H: -------------------------------------------------------------------------------- 1 | #define STR_NETABORT "Network game synchronization aborted." 2 | #define STR_UNKNOWN "Got an unknown game packet during setup" 3 | #define STR_FOUND "Found a node!" 4 | #define STR_LOOKING "Looking for a node" 5 | #define STR_MORETHAN "More than %i players specified!" 6 | #define STR_NONESPEC "No players specified for game!" 7 | #define STR_CONSOLEIS "Console is player %i of %i" 8 | #define STR_NORESP "No such response file!" 9 | #define STR_FOUNDRESP "Found response file" 10 | #define STR_DOOMNETDRV "DOOM II NETWORK DEVICE DRIVER" 11 | #define STR_VECTSPEC "The specified vector (0x%02x) was already hooked." 12 | #define STR_NONULL \ 13 | "Warning: no NULL or iret interrupt vectors were found in the 0x60 to 0x66\n"\ 14 | "range. You can specify a vector with the -vector 0x parameter." 15 | #define STR_COMMVECT "Communicating with interrupt vector 0x%x" 16 | #define STR_USEALT "Using alternate port %i for network" 17 | #define STR_RETURNED "Returned from DOOM II" 18 | #define STR_ATTEMPT "Attempting to find all players for %i player net play. "\ 19 | "Press ESC to exit.\n" 20 | -------------------------------------------------------------------------------- /ipx/IPX_FRCH.H: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/the-eugen/DOOM/7ce9e63cd8e018be3d3e457cfbe66bc60e8f399d/ipx/IPX_FRCH.H -------------------------------------------------------------------------------- /ipx/README: -------------------------------------------------------------------------------- 1 | This is the source for the DOOM ipx network driver. 2 | -------------------------------------------------------------------------------- /linuxdoom-1.10/.gitignore: -------------------------------------------------------------------------------- 1 | linux/* 2 | *.swp 3 | -------------------------------------------------------------------------------- /linuxdoom-1.10/CVS/Entries: -------------------------------------------------------------------------------- 1 | /ChangeLog/1.14/Mon Feb 3 22:45:08 1997// 2 | /DOOMLIC.TXT/1.3/Sun Jan 26 07:44:56 1997// 3 | /FILES/1.1/Sun Jan 19 17:22:41 1997// 4 | /FILES2/1.1/Sun Jan 19 17:22:42 1997// 5 | /Makefile/1.6/Mon Feb 3 22:45:08 1997// 6 | /am_data.h/1.2/Tue Jan 21 18:59:56 1997// 7 | /am_map.c/1.4/Mon Feb 3 21:24:33 1997// 8 | /am_map.h/1.2/Tue Jan 21 18:59:56 1997// 9 | /d_englsh.h/1.1/Mon Feb 3 21:48:03 1997// 10 | /d_event.h/1.2/Mon Feb 3 22:01:47 1997// 11 | /d_french.h/1.3/Mon Feb 3 21:48:03 1997// 12 | /d_main.c/1.8/Mon Feb 3 22:45:09 1997// 13 | /d_net.c/1.3/Mon Feb 3 22:01:47 1997// 14 | /d_textur.h/1.1/Mon Feb 3 16:47:51 1997// 15 | /doomdata.h/1.5/Mon Feb 3 22:45:09 1997// 16 | /doomdef.h/1.9/Mon Feb 3 22:45:09 1997// 17 | /doomtype.h/1.2/Mon Feb 3 22:45:09 1997// 18 | /dstrings.h/1.4/Mon Feb 3 21:48:03 1997// 19 | /dutils.c/1.5/Mon Feb 3 17:11:23 1997// 20 | /dutils.h/1.4/Mon Feb 3 17:11:23 1997// 21 | /f_finale.c/1.5/Mon Feb 3 21:26:34 1997// 22 | /f_finale.h/1.1/Mon Feb 3 21:26:34 1997// 23 | /f_wipe.c/1.2/Mon Feb 3 22:45:09 1997// 24 | /f_wipe.h/1.1/Mon Feb 3 17:11:23 1997// 25 | /fpfunc.S/1.1/Sun Jan 19 17:22:43 1997// 26 | /g_game.c/1.8/Mon Feb 3 22:45:09 1997// 27 | /g_game.h/1.1/Mon Feb 3 21:34:47 1997// 28 | /hu_lib.c/1.3/Sun Jan 26 07:44:58 1997// 29 | /hu_lib.h/1.4/Mon Feb 3 16:47:52 1997// 30 | /hu_stuff.c/1.4/Mon Feb 3 16:47:52 1997// 31 | /hu_stuff.h/1.3/Sun Jan 26 07:44:58 1997// 32 | /i_dga.c/1.3/Sun Jan 26 07:44:58 1997// 33 | /i_ibm.c/1.3/Sun Jan 26 07:44:58 1997// 34 | /i_main.c/1.4/Mon Feb 3 22:45:10 1997// 35 | /i_pcnet.c/1.3/Sun Jan 26 07:44:59 1997// 36 | /i_sound.c/1.3/Sun Jan 26 07:44:59 1997// 37 | /i_sound.h/1.3/Sun Jan 26 07:44:59 1997// 38 | /i_svga.c/1.3/Sun Jan 26 07:44:59 1997// 39 | /i_unix.c/1.5/Mon Feb 3 22:45:10 1997// 40 | /i_x.c/1.6/Mon Feb 3 22:45:10 1997// 41 | /info.c/1.3/Sun Jan 26 07:45:00 1997// 42 | /info.h/1.3/Sun Jan 26 07:45:00 1997// 43 | /irix.c/1.3/Sun Jan 26 07:45:00 1997// 44 | /irix.h/1.3/Sun Jan 26 07:45:01 1997// 45 | /linux.c/1.3/Sun Jan 26 07:45:01 1997// 46 | /m_argv.c/1.1/Mon Feb 3 22:45:10 1997// 47 | /m_argv.h/1.1/Mon Feb 3 22:45:10 1997// 48 | /m_bbox.c/1.1/Mon Feb 3 22:45:10 1997// 49 | /m_bbox.h/1.1/Mon Feb 3 22:45:10 1997// 50 | /m_cheat.c/1.1/Mon Feb 3 21:24:34 1997// 51 | /m_cheat.h/1.1/Mon Feb 3 21:24:34 1997// 52 | /m_menu.c/1.7/Mon Feb 3 22:45:10 1997// 53 | /m_menu.h/1.1/Mon Feb 3 22:01:49 1997// 54 | /m_misc.c/1.6/Mon Feb 3 22:45:10 1997// 55 | /m_misc.h/1.1/Mon Feb 3 22:45:11 1997// 56 | /m_random.c/1.1/Mon Feb 3 22:45:11 1997// 57 | /m_random.h/1.1/Mon Feb 3 22:45:11 1997// 58 | /p_ceilng.c/1.4/Mon Feb 3 16:47:53 1997// 59 | /p_doors.c/1.4/Mon Feb 3 16:47:53 1997// 60 | /p_enemy.c/1.5/Mon Feb 3 22:45:11 1997// 61 | /p_floor.c/1.4/Mon Feb 3 16:47:54 1997// 62 | /p_inter.c/1.4/Mon Feb 3 22:45:11 1997// 63 | /p_lights.c/1.5/Mon Feb 3 22:45:11 1997// 64 | /p_local.h/1.3/Tue Jan 28 22:08:27 1997// 65 | /p_map.c/1.5/Mon Feb 3 22:45:11 1997// 66 | /p_maputl.c/1.5/Mon Feb 3 22:45:11 1997// 67 | /p_mobj.c/1.5/Mon Feb 3 22:45:12 1997// 68 | /p_plats.c/1.5/Mon Feb 3 22:45:12 1997// 69 | /p_pspr.c/1.5/Mon Feb 3 22:45:12 1997// 70 | /p_setup.c/1.5/Mon Feb 3 22:45:12 1997// 71 | /p_sight.c/1.3/Tue Jan 28 22:08:28 1997// 72 | /p_spec.c/1.6/Mon Feb 3 22:45:12 1997// 73 | /p_spec.h/1.3/Tue Jan 28 22:08:29 1997// 74 | /p_switch.c/1.3/Tue Jan 28 22:08:29 1997// 75 | /p_telept.c/1.3/Tue Jan 28 22:08:29 1997// 76 | /p_tick.c/1.4/Mon Feb 3 16:47:55 1997// 77 | /p_user.c/1.3/Tue Jan 28 22:08:29 1997// 78 | /r_bsp.c/1.4/Mon Feb 3 22:45:12 1997// 79 | /r_data.c/1.4/Mon Feb 3 16:47:55 1997// 80 | /r_draw.c/1.4/Mon Feb 3 16:47:55 1997// 81 | /r_local.h/1.4/Mon Feb 3 21:26:34 1997// 82 | /r_main.c/1.5/Mon Feb 3 22:45:12 1997// 83 | /r_plane.c/1.4/Mon Feb 3 16:47:55 1997// 84 | /r_segs.c/1.3/Wed Jan 29 20:10:19 1997// 85 | /r_things.c/1.5/Mon Feb 3 16:47:56 1997// 86 | /s_sound.c/1.6/Mon Feb 3 22:45:12 1997// 87 | /sounds.c/1.3/Wed Jan 29 22:40:44 1997// 88 | /sounds.h/1.3/Wed Jan 29 22:40:44 1997// 89 | /soundsrv.c/1.3/Wed Jan 29 22:40:44 1997// 90 | /soundsrv.h/1.3/Wed Jan 29 22:40:44 1997// 91 | /soundst.h/1.3/Wed Jan 29 22:40:45 1997// 92 | /st_lib.c/1.4/Mon Feb 3 16:47:56 1997// 93 | /st_lib.h/1.4/Mon Feb 3 16:47:56 1997// 94 | /st_stuff.c/1.6/Mon Feb 3 22:45:13 1997// 95 | /st_stuff.h/1.3/Thu Jan 30 19:54:22 1997// 96 | /sun.c/1.3/Thu Jan 30 19:54:22 1997// 97 | /tables.c/1.4/Mon Feb 3 16:47:57 1997// 98 | /tables.h/1.1/Mon Feb 3 16:47:57 1997// 99 | /tmap.S/1.1/Sun Jan 19 17:22:51 1997// 100 | /v_video.c/1.5/Mon Feb 3 22:45:13 1997// 101 | /v_video.h/1.2/Mon Feb 3 17:11:59 1997// 102 | /w_wad.c/1.5/Mon Feb 3 16:47:57 1997// 103 | /wadread.c/1.3/Thu Jan 30 19:54:23 1997// 104 | /wadread.h/1.3/Thu Jan 30 19:54:23 1997// 105 | /wi_data.h/1.3/Thu Jan 30 19:54:23 1997// 106 | /wi_stuff.c/1.7/Mon Feb 3 22:45:13 1997// 107 | /wi_stuff.h/1.4/Mon Feb 3 16:47:58 1997// 108 | /z_zone.c/1.4/Mon Feb 3 16:47:58 1997// 109 | /z_zone.h/1.1/Mon Feb 3 16:47:58 1997// 110 | -------------------------------------------------------------------------------- /linuxdoom-1.10/CVS/Repository: -------------------------------------------------------------------------------- 1 | /info/cvsroot/id/id_doom 2 | -------------------------------------------------------------------------------- /linuxdoom-1.10/CVS/Root: -------------------------------------------------------------------------------- 1 | /info/cvsroot/ 2 | -------------------------------------------------------------------------------- /linuxdoom-1.10/Makefile: -------------------------------------------------------------------------------- 1 | ################################################################ 2 | # 3 | # $Id:$ 4 | # 5 | # $Log:$ 6 | # 7 | CC= gcc # gcc or g++ 8 | 9 | CFLAGS=-g -Wall -DNORMALUNIX -DLINUX -I. # -DUSEASM 10 | LDFLAGS=-L/usr/X11R6/lib 11 | LIBS=-lm 12 | 13 | # subdirectory for objects 14 | O=linux 15 | 16 | # not too sophisticated dependency 17 | OBJS= \ 18 | $(O)/doomdef.o \ 19 | $(O)/doomstat.o \ 20 | $(O)/dstrings.o \ 21 | $(O)/i_system.o \ 22 | $(O)/i_sound.o \ 23 | $(O)/i_video.o \ 24 | $(O)/i_net.o \ 25 | $(O)/tables.o \ 26 | $(O)/f_finale.o \ 27 | $(O)/f_wipe.o \ 28 | $(O)/d_main.o \ 29 | $(O)/d_net.o \ 30 | $(O)/d_items.o \ 31 | $(O)/g_game.o \ 32 | $(O)/m_menu.o \ 33 | $(O)/m_misc.o \ 34 | $(O)/m_argv.o \ 35 | $(O)/m_bbox.o \ 36 | $(O)/m_fixed.o \ 37 | $(O)/m_swap.o \ 38 | $(O)/m_cheat.o \ 39 | $(O)/m_random.o \ 40 | $(O)/am_map.o \ 41 | $(O)/p_ceilng.o \ 42 | $(O)/p_doors.o \ 43 | $(O)/p_enemy.o \ 44 | $(O)/p_floor.o \ 45 | $(O)/p_inter.o \ 46 | $(O)/p_lights.o \ 47 | $(O)/p_map.o \ 48 | $(O)/p_maputl.o \ 49 | $(O)/p_plats.o \ 50 | $(O)/p_pspr.o \ 51 | $(O)/p_setup.o \ 52 | $(O)/p_sight.o \ 53 | $(O)/p_spec.o \ 54 | $(O)/p_switch.o \ 55 | $(O)/p_mobj.o \ 56 | $(O)/p_telept.o \ 57 | $(O)/p_tick.o \ 58 | $(O)/p_saveg.o \ 59 | $(O)/p_user.o \ 60 | $(O)/r_bsp.o \ 61 | $(O)/r_data.o \ 62 | $(O)/r_draw.o \ 63 | $(O)/r_main.o \ 64 | $(O)/r_plane.o \ 65 | $(O)/r_segs.o \ 66 | $(O)/r_sky.o \ 67 | $(O)/r_things.o \ 68 | $(O)/w_wad.o \ 69 | $(O)/wi_stuff.o \ 70 | $(O)/v_video.o \ 71 | $(O)/st_lib.o \ 72 | $(O)/st_stuff.o \ 73 | $(O)/hu_stuff.o \ 74 | $(O)/hu_lib.o \ 75 | $(O)/s_sound.o \ 76 | $(O)/z_zone.o \ 77 | $(O)/info.o \ 78 | $(O)/sounds.o 79 | 80 | all: $(O)/linuxxdoom 81 | 82 | clean: 83 | rm -f *.o *~ *.flc 84 | rm -f linux/* 85 | 86 | $(O)/linuxxdoom: $(OBJS) $(O)/i_main.o 87 | $(CC) $(CFLAGS) $(LDFLAGS) $(OBJS) $(O)/i_main.o \ 88 | -o $(O)/linuxxdoom $(LIBS) 89 | 90 | $(O)/%.o: %.c 91 | $(CC) $(CFLAGS) -c $< -o $@ 92 | 93 | $(O)/i_sound.o: efi/i_sound.c 94 | $(CC) $(CFLAGS) -c $< -o $@ 95 | 96 | $(O)/i_net.o: efi/i_net.c 97 | $(CC) $(CFLAGS) -c $< -o $@ 98 | 99 | $(O)/i_system.o: efi/i_system.c 100 | $(CC) $(CFLAGS) -c $< -o $@ 101 | 102 | $(O)/i_video.o: efi/i_video.c 103 | $(CC) $(CFLAGS) -c $< -o $@ 104 | 105 | ############################################################# 106 | # 107 | ############################################################# 108 | -------------------------------------------------------------------------------- /linuxdoom-1.10/README.b: -------------------------------------------------------------------------------- 1 | 2 | README for Linux DOOM Source distribution 3 | ========================================= 4 | 5 | 6 | DISCLAIMER 7 | ---------- 8 | This is not "The DOOM Source Code" dump for a bunch 9 | of reasons. It is based on a DOOM development directory 10 | snapshot as of January 10th, but has been stripped and 11 | changed. Thus it is the DOOM source, but there are many 12 | minor differences to the source as last used by id 13 | Software. 14 | 15 | Note that thus neither John Carmack nor Dave Taylor nor 16 | anybody else at id is responsible for the contents of 17 | this archive, or the changes introduced to the original 18 | source. 19 | 20 | If there are any questions, contact me at bk@gamers.org, 21 | or preferably post to the mailing list at 22 | 23 | doom-editing@gamers.org 24 | 25 | (send mail to majordomo@gamers.org, content just 26 | a single "info doom-editing"). I will post any updates 27 | or notifcation of corrections there. I will probably 28 | put some stuff at 29 | 30 | http://www.gamers.org/dEngine/doom/ 31 | 32 | as well. Look there for the "Unofficial DOOM Specs" as 33 | minimal recommended documentation. 34 | 35 | 36 | 37 | REMARKS 38 | ------- 39 | I made a few minor bug fixes, added some experimental sound 40 | code, and, and changed the handling of IWAD dependend game 41 | modes. Most of the changes though have been shuffling 42 | around sources in a sometimes futile attempt to separate 43 | modules more cleanly, and make certain parts easier 44 | to locate and modify. There is still much left to do, but 45 | I hope that the current source is a good base to start 46 | with, especially with a cooperative effort in mind. Those 47 | so inclined will find the source prepared for CVS. 48 | 49 | There is a list of changes and fixes I did not get around 50 | to in TODO, and an incomplete worklog in ChangeLog, that 51 | also includes some minor ToDo statements scattered throughout 52 | the log. 53 | 54 | 55 | a) Linux SVGA 56 | There is no SVGA support. For development and debug 57 | purposes, the X11 version seems to be more handy. 58 | 59 | b) Sound - see README.sound, 60 | and the sndserver.tgz archive. 61 | 62 | c) GLDOOM - see README.gl 63 | 64 | d) Win32 65 | There was no Win32 support in the original dump. 66 | 67 | e) DOS 68 | Original DOS support (including the texture 69 | mapping and fixed point assembler) has been 70 | removed, mainly because of the lack of sound 71 | support. 72 | 73 | f) DoomEd 74 | The NeXTStep DoomEd sources in the dump were 75 | garbled (filenames - prolly an issue of ISO9660 76 | with or w/o extensions). Somehow Bear never got 77 | around to send me a list of the correct filenames, 78 | and I won't bother guessing without a NeXT box 79 | at hand. 80 | 81 | There is a plethora of useful editors 82 | for DOOM. I suggest using DEU for X11. 83 | 84 | g) BSP Tools 85 | The BSP builder and other tools have 86 | been released by John Carmack long ago, 87 | and since improved/replaced by others. 88 | Again, I recommend taking a pick among 89 | the tools available for Linux. 90 | 91 | h) DOOM game tools 92 | There are a number of tools that have 93 | not been released, namely those which 94 | compiled the Things and State Tables, 95 | the frame animation LUT's, sound tables 96 | etc. Basically, they compile similarly 97 | complex LUT's to generate C files. The 98 | tools are omitted from this distribution. 99 | 100 | There are some files in the 101 | distribution (info.h/c, sounds.h/c) 102 | that are essentially the output of these 103 | tools. This is the data that defines 104 | DOOM (as a game) for all practical 105 | purposes. 106 | 107 | I recommend keeping them, as they are 108 | part of the source. In the long run, 109 | handling them as well as the action/ 110 | animation functions as a separate game.so 111 | library (as with Quake2) seems to be a 112 | good idea. 113 | 114 | i) Artwork 115 | Neither the original artwork nor the 116 | misc. WAD files are included in this 117 | archive. You will at least need the 118 | shareware WAD file to run the executable, 119 | but it shouldn't be to difficult to get 120 | a hold of that. 121 | 122 | Note that the mechanism to detect the 123 | presence of a registered or commercial 124 | version is still in the source, and 125 | homebrew maps are still disabled. This 126 | is easily removed now, but as FinalDOOM, 127 | Ultimate DOOM and DOOM 2 are still in 128 | the shops, it is probably polite not 129 | to distribute a source or binary without 130 | that mechanism. 131 | 132 | This version of Linuxdoom supports Plutonia 133 | and TNT WAD from FinalDOOM as well. No 134 | guarantees, though. 135 | 136 | 137 | Enjoy! 138 | 139 | 140 | b. 97/12/22 141 | -------------------------------------------------------------------------------- /linuxdoom-1.10/README.book: -------------------------------------------------------------------------------- 1 | 2 | The DOOM Book 3 | 4 | Shortly after the Wolfenstein 3D source release, 5 | I sent a mail to Jay Wilbur suggesting a book 6 | about the DOOM engine. I anticipated a similar 7 | release of the DOOM sources within a year or 8 | two, and the obvious problems with the Wolfenstein 9 | sources (lack of accompanying artwork, a code 10 | base not maintained for quite some time) seemed 11 | to demand a better approach. I talked to some 12 | publishing company reps at the Book Fair in 1995, 13 | and while they were cautiously interested, id was 14 | not. 15 | 16 | In the last weeks of 1996, following a visit at 17 | id Software two months earlier, and after the 18 | departure of Jay Wilbur, John Carmack asked me 19 | whether I was still interested in doing the book. 20 | I was, Bear sent me a code dump, and Todd 21 | Hollenshead set out to address the legal concerns 22 | (of which were many). 23 | 24 | Unfortunately, what might have worked in 1995 25 | turned out to be a doomed attempt in 1997. I won't 26 | go into the details - let's just say that my 27 | leaving university and going back to full time 28 | writing for a living repeatedly forced me to 29 | change priorities on what looked more and more 30 | like a project unlikely to generate any revenue. 31 | 32 | By mid of the year, when the legal issues had 33 | finally been settled, it didn't look like I was 34 | going to find a publisher at all. Following the 35 | Book Fair in 1997 and some more discussions 36 | (with about a dozen publishers, total), I gritted 37 | my teeth and decided to abandon the project. 38 | 39 | Note that the book project as such wasn't supposed 40 | to hold up the source release to the public. 41 | However, given the legal concerns relating to 42 | the third party sound code in DOS DOOM, and the 43 | lack of Win32 support as well as the advantages of 44 | an OpenGL based release, the idea was to put 45 | together a consistent, stable code base prior to 46 | public release - most of which was supposed to be 47 | an offspring of my reformatting and modifying the 48 | code for the book. 49 | 50 | None of this worked out as intended. However, I 51 | hope that, at long last, this distribution 52 | will finally provide a good point to start for 53 | any cooperative effort to extend the already 54 | impressive lifespan of DOOM into the age of 55 | multiplayer servers and hardware-accelerated 56 | clients. 57 | 58 | -------------------------------------------------------------------------------- /linuxdoom-1.10/README.sound: -------------------------------------------------------------------------------- 1 | 2 | README: sound in DOOM 3 | 4 | 5 | 1) DOS/Win32 sound 6 | 7 | id licensed a third party sound library called 8 | DMX for DOS DOOM. The situation exhibited 9 | many symptons of serious NIH "Not Invented Here"), 10 | and one of the consequences is that the original 11 | DOOM sound code does not work without DMX. As 12 | DMX is not publicly available, the original DOOM 13 | sound support is removed. 14 | 15 | Win32 was not supported in the source dump I got. 16 | I have no knowledge how the WinDOOM port did the 17 | sound handling. A Win32 port should probaly rely on 18 | DirectSound. So far, the Win32 glDOOM port Jim Dose 19 | is working on has no sound support. 20 | 21 | In consequence, the only target with a working sound 22 | code is UNIX, which I could only verify with Linux 23 | on Intel586. 24 | 25 | 2) Linux sound 26 | 27 | DOOM for Linux used a separate process, sndserver. 28 | 29 | Quoting Dave Taylor: 30 | 31 | "Sound drivers should be an asychronous model, either 32 | a seperate thread or a seperate process. This is 33 | because sound should always be fed to the card without 34 | interruption or else you get pops and with low latency 35 | or else you get angry players. 36 | 37 | Now it turns out that this kind of code isn't too fun 38 | to write. In the days of Linux Doom, threads were not a 39 | happnin thing in Linux. In fact, they still largely 40 | aren't. You can use them these days if you have gnu's 41 | libc installed, but you still can't debug them because 42 | gdb doesn't support them properly yet. I believe the 43 | original seperate process had a bad latency delay 44 | because of the time it took for commands to be flushed 45 | through the pipe used to communicate with the seperate 46 | process. I should have looked into this more thoroughly. 47 | 48 | In Quake, I discovered that I could feed multiple 49 | acknowledgements to a SoundBlaster or compatible without 50 | any side-effects such as pops or other malfunctions. 51 | This discovery led me to switch to a completely synchronous 52 | model, much much easier to debug and understand, so I 53 | think this was fairly intelligent. Although we had to 54 | populate the game with calls in the right places to keep 55 | the sound buffers fed, and although it wasn't gauranteed to 56 | be always fed, well over 99% of the time, it was fed, and 57 | your the latency was never worse than the frequency of your 58 | refills (several times per frame) plus a small lead time 59 | (40th of a second?)." 60 | 61 | The separate sndserver code base introduced some redundancy 62 | (WAD access for sound lumps) for each UNIX target (Sun, SGI, 63 | Linux) and more differences between DOS and UNIX version. 64 | However, I kept the IPC based parts in the source, and 65 | separated the sndserver target in another directory to avoid 66 | further redundancy. There seem to be a few bug-like things 67 | going on in the sndserver that do not receive penalty as 68 | the program has to do only a simple task. One example would 69 | be a libc realloc mixed with zone memory allocation. 70 | 71 | Ungraceful and untimely demise of Linuxdoom (core instead 72 | of I_Error) will leave idle sndserver processes in your 73 | system, blocking /dev/bsp. Kill them manually. 74 | 75 | I put the non-redundant parts of the sndserver program 76 | into the i_sound module of doom, and with the SND_SERV 77 | compiler switch you can choose to use the internal sound 78 | support. However, there is a problem with e.g. the 79 | double shotgun and the plasma gun - walk up to a wall, 80 | face it straight, and fire. The sound output is crappy. 81 | This vanishes with decreasing screen size. A similar 82 | problem occurs with trimer driven asynchronous output 83 | enabled by SNDINTR. 84 | 85 | I agree with Dave that threads would be preferable. 86 | With respect to Linux ports of John Carmack's next 87 | Trinity engine, this one will rely on Win32 88 | multithreading e.g. for input sampling. So the Linux 89 | community will have to sort out threads anyway :-). 90 | 91 | To improve the current sound server, other means of 92 | IPC should take care of the latency. The mixing 93 | buffer/command buffer as shared memory comes to mind. 94 | 95 | 96 | 97 | 3) Music support 98 | 99 | There is, and was, no music support in Linuxdoom. Fine with 100 | me - I wouldn't give a bat's tail feathers for DOOM music. 101 | Your mileage may vary. There are a few leftovers of the DOS 102 | music support also interfacing DMX, so there is a place 103 | to start. However, in the age of CDROM based music, I 104 | recommend getting e.g. Workman to cooperate with DOOM 105 | (currently, DOOM accessing the soundcard SpekerOut 106 | interferes with Workman controlling the CD drives 107 | SpeakerOut), so musci could be chosen and run completely 108 | independend of the game. You could try Linuxdoom with 109 | Q2 music that way. 110 | 111 | -------------------------------------------------------------------------------- /linuxdoom-1.10/TODO: -------------------------------------------------------------------------------- 1 | 2 | - create Web repository for sources, patches, 3 | news, and pointer to doom-editing mailing 4 | list. 5 | 6 | - get DOOM Public License from id 7 | 8 | ----------------------------------------------- 9 | 10 | - remove m_fixed, switch to floating point 11 | More stable, and prolly even faster. 12 | 13 | - make SCREENWIDTH/HEIGHT work at startup? 14 | Well, the HUD/STBar stuff is tied to the 15 | scales implied by the graphics. Rather do 16 | GLDOOM and use texture mapping. 17 | 18 | - fix aspect ratio? 19 | 320x200 is nothing viable nowadays. 20 | A 320x240 base (4:3) would be a lot better. 21 | See above on width/height. 22 | 23 | - limited look up/down by y-shearing? 24 | Prolly not worth it, rather switch to GLDOOM. 25 | 26 | - switch to C++? 27 | The action function pointers have varying 28 | argument lists (no parameter, one, etc.). 29 | C++ doesn't like that much. A major rewrite. 30 | 31 | - switch to doommain.c plus libdoom? Have 32 | libref, libgame etc.? 33 | Another major rewrite. 34 | 35 | - use XFree86 DGA, prolly not that much faster 36 | than MIT SHM, but allows for directly sampled 37 | mouse (and even freelook). Recommended for 38 | GLDOOM. 39 | 40 | - put together an accompanying developer toolkit 41 | source distribution: DEU, RMB, BSP for Linux/X. 42 | 43 | - move info.h, info.c, sounds.h, sounds.c and 44 | other data to a separate lump in the WAD, 45 | or into a libgame.so, to separate the 46 | generic stuff (refresh, I/O) from the 47 | DOOM specifics. 48 | 49 | - decide whether precaching all sounds is 50 | better than retrieving and releasing 51 | every so often. DOOM seems to do that 52 | frequently (8bit stuff, originally for 53 | DOS), and the Linux sound is 16bit 54 | (conversion in the mixing, requires 55 | some padding) - we prolly got the memory 56 | to spare. 57 | 58 | - 16bpp CLUT. The lightmaps and the 59 | framebuffer could be changed to switch 60 | to 64K colors. Prolly better to do 61 | GLDOOM right away. 62 | 63 | - remove checks for commercial etc., in 64 | non-essential issues (enabling PWAD's). 65 | 66 | - change (simplify) determination of 67 | sky texture (done by game version). 68 | Explicit? 69 | 70 | - remove all game version checks 71 | 72 | - different handling of Demo - don't 73 | exit on "different game version" 74 | 75 | - how about shareware/retail "You are here" 76 | intermission animation? Wasn't in 77 | commercial (DOOM 2). 78 | 79 | - double shotgun in DOOM1, all weapons with 80 | shareware 81 | 82 | - checks for required lumps. We need fallbacks 83 | for lumps that are not present, that is, 84 | default sounds etc. to be used instead, 85 | or removing THINGS w/o sprites etc. 86 | 87 | - client/server? I'd suggest ripping off some stuff 88 | from the abandoned IBM WebView project 89 | 90 | - Blockmap 91 | The BLOCKMAP lump might be (partly) redundant, 92 | as the BSP allows for clipping (except certain 93 | LineDefs that will not spawn Segs). 94 | 95 | - LOS 96 | REJECT and intersection based LOS checking could be 97 | done using the BSP. In case of REJECT, certain 98 | monster AI special effects would be lost, though. 99 | 100 | - correct handling of height in collision. This is 101 | not done, and the checks are scattered around in 102 | many places. It does require handling of "player 103 | on top of monster" situations, too - we have to 104 | make sure the players falls off far enough to 105 | avoid getting "stuck in monster". 106 | 107 | - remove obsolete menus (Detail. Music Volume?) 108 | 109 | - clip explosion range damage (and sprites) using 110 | REJECT? That is, if one Sector/SSector not 111 | visible from the other, do not apply damage, 112 | not render sprite if player in other sector. 113 | Hmmm - explosion behind small pillar might not be 114 | visible at all, but do we care? 115 | 116 | 117 | - Ungraceful and untimely demise of Linuxdoom (core 118 | instead of I_Error) will leave idle sndserver 119 | processes in your system, blocking /dev/bsp. 120 | A timeout on lack of input for "sndserver"? 121 | 122 | - threaded sndserver? SHM mixing buffer? 123 | Or internal, timer-based? 124 | -------------------------------------------------------------------------------- /linuxdoom-1.10/am_map.h: -------------------------------------------------------------------------------- 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 | // DESCRIPTION: 18 | // AutoMap module. 19 | // 20 | //----------------------------------------------------------------------------- 21 | 22 | #ifndef __AMMAP_H__ 23 | #define __AMMAP_H__ 24 | 25 | // Used by ST StatusBar stuff. 26 | #define AM_MSGHEADER (('a'<<24)+('m'<<16)) 27 | #define AM_MSGENTERED (AM_MSGHEADER | ('e'<<8)) 28 | #define AM_MSGEXITED (AM_MSGHEADER | ('x'<<8)) 29 | 30 | 31 | // Called by main loop. 32 | boolean AM_Responder (event_t* ev); 33 | 34 | // Called by main loop. 35 | void AM_Ticker (void); 36 | 37 | // Called by main loop, 38 | // called instead of view drawer if automap active. 39 | void AM_Drawer (void); 40 | 41 | // Called to force the automap to quit 42 | // if the level is completed while it is up. 43 | void AM_Stop (void); 44 | 45 | 46 | 47 | #endif 48 | //----------------------------------------------------------------------------- 49 | // 50 | // $Log:$ 51 | // 52 | //----------------------------------------------------------------------------- 53 | -------------------------------------------------------------------------------- /linuxdoom-1.10/d_event.h: -------------------------------------------------------------------------------- 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 | // DESCRIPTION: 18 | // 19 | // 20 | //----------------------------------------------------------------------------- 21 | 22 | 23 | #ifndef __D_EVENT__ 24 | #define __D_EVENT__ 25 | 26 | 27 | #include "doomtype.h" 28 | 29 | 30 | // 31 | // Event handling. 32 | // 33 | 34 | // Input event types. 35 | typedef enum 36 | { 37 | ev_keydown, 38 | ev_keyup, 39 | ev_mouse, 40 | ev_joystick 41 | } evtype_t; 42 | 43 | // Event structure. 44 | typedef struct 45 | { 46 | evtype_t type; 47 | int data1; // keys / mouse/joystick buttons 48 | int data2; // mouse/joystick x move 49 | int data3; // mouse/joystick y move 50 | } event_t; 51 | 52 | 53 | typedef enum 54 | { 55 | ga_nothing, 56 | ga_loadlevel, 57 | ga_newgame, 58 | ga_loadgame, 59 | ga_savegame, 60 | ga_playdemo, 61 | ga_completed, 62 | ga_victory, 63 | ga_worlddone, 64 | ga_screenshot 65 | } gameaction_t; 66 | 67 | 68 | 69 | // 70 | // Button/action code definitions. 71 | // 72 | typedef enum 73 | { 74 | // Press "Fire". 75 | BT_ATTACK = 1, 76 | // Use button, to open doors, activate switches. 77 | BT_USE = 2, 78 | 79 | // Flag: game events, not really buttons. 80 | BT_SPECIAL = 128, 81 | BT_SPECIALMASK = 3, 82 | 83 | // Flag, weapon change pending. 84 | // If true, the next 3 bits hold weapon num. 85 | BT_CHANGE = 4, 86 | // The 3bit weapon mask and shift, convenience. 87 | BT_WEAPONMASK = (8+16+32), 88 | BT_WEAPONSHIFT = 3, 89 | 90 | // Pause the game. 91 | BTS_PAUSE = 1, 92 | // Save the game at each console. 93 | BTS_SAVEGAME = 2, 94 | 95 | // Savegame slot numbers 96 | // occupy the second byte of buttons. 97 | BTS_SAVEMASK = (4+8+16), 98 | BTS_SAVESHIFT = 2, 99 | 100 | } buttoncode_t; 101 | 102 | 103 | 104 | 105 | // 106 | // GLOBAL VARIABLES 107 | // 108 | #define MAXEVENTS 64 109 | 110 | extern event_t events[MAXEVENTS]; 111 | extern int eventhead; 112 | extern int eventtail; 113 | 114 | extern gameaction_t gameaction; 115 | 116 | 117 | #endif 118 | //----------------------------------------------------------------------------- 119 | // 120 | // $Log:$ 121 | // 122 | //----------------------------------------------------------------------------- 123 | -------------------------------------------------------------------------------- /linuxdoom-1.10/d_items.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:$"; 25 | 26 | // We are referring to sprite numbers. 27 | #include "info.h" 28 | 29 | #ifdef __GNUG__ 30 | #pragma implementation "d_items.h" 31 | #endif 32 | #include "d_items.h" 33 | 34 | 35 | // 36 | // PSPRITE ACTIONS for waepons. 37 | // This struct controls the weapon animations. 38 | // 39 | // Each entry is: 40 | // ammo/amunition type 41 | // upstate 42 | // downstate 43 | // readystate 44 | // atkstate, i.e. attack/fire/hit frame 45 | // flashstate, muzzle flash 46 | // 47 | weaponinfo_t weaponinfo[NUMWEAPONS] = 48 | { 49 | { 50 | // fist 51 | am_noammo, 52 | S_PUNCHUP, 53 | S_PUNCHDOWN, 54 | S_PUNCH, 55 | S_PUNCH1, 56 | S_NULL 57 | }, 58 | { 59 | // pistol 60 | am_clip, 61 | S_PISTOLUP, 62 | S_PISTOLDOWN, 63 | S_PISTOL, 64 | S_PISTOL1, 65 | S_PISTOLFLASH 66 | }, 67 | { 68 | // shotgun 69 | am_shell, 70 | S_SGUNUP, 71 | S_SGUNDOWN, 72 | S_SGUN, 73 | S_SGUN1, 74 | S_SGUNFLASH1 75 | }, 76 | { 77 | // chaingun 78 | am_clip, 79 | S_CHAINUP, 80 | S_CHAINDOWN, 81 | S_CHAIN, 82 | S_CHAIN1, 83 | S_CHAINFLASH1 84 | }, 85 | { 86 | // missile launcher 87 | am_misl, 88 | S_MISSILEUP, 89 | S_MISSILEDOWN, 90 | S_MISSILE, 91 | S_MISSILE1, 92 | S_MISSILEFLASH1 93 | }, 94 | { 95 | // plasma rifle 96 | am_cell, 97 | S_PLASMAUP, 98 | S_PLASMADOWN, 99 | S_PLASMA, 100 | S_PLASMA1, 101 | S_PLASMAFLASH1 102 | }, 103 | { 104 | // bfg 9000 105 | am_cell, 106 | S_BFGUP, 107 | S_BFGDOWN, 108 | S_BFG, 109 | S_BFG1, 110 | S_BFGFLASH1 111 | }, 112 | { 113 | // chainsaw 114 | am_noammo, 115 | S_SAWUP, 116 | S_SAWDOWN, 117 | S_SAW, 118 | S_SAW1, 119 | S_NULL 120 | }, 121 | { 122 | // super shotgun 123 | am_shell, 124 | S_DSGUNUP, 125 | S_DSGUNDOWN, 126 | S_DSGUN, 127 | S_DSGUN1, 128 | S_DSGUNFLASH1 129 | }, 130 | }; 131 | 132 | 133 | 134 | 135 | 136 | 137 | 138 | 139 | -------------------------------------------------------------------------------- /linuxdoom-1.10/d_items.h: -------------------------------------------------------------------------------- 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 | // DESCRIPTION: 18 | // Items: key cards, artifacts, weapon, ammunition. 19 | // 20 | //----------------------------------------------------------------------------- 21 | 22 | 23 | #ifndef __D_ITEMS__ 24 | #define __D_ITEMS__ 25 | 26 | #include "doomdef.h" 27 | 28 | #ifdef __GNUG__ 29 | #pragma interface 30 | #endif 31 | 32 | 33 | // Weapon info: sprite frames, ammunition use. 34 | typedef struct 35 | { 36 | ammotype_t ammo; 37 | int upstate; 38 | int downstate; 39 | int readystate; 40 | int atkstate; 41 | int flashstate; 42 | 43 | } weaponinfo_t; 44 | 45 | extern weaponinfo_t weaponinfo[NUMWEAPONS]; 46 | 47 | #endif 48 | //----------------------------------------------------------------------------- 49 | // 50 | // $Log:$ 51 | // 52 | //----------------------------------------------------------------------------- 53 | -------------------------------------------------------------------------------- /linuxdoom-1.10/d_main.h: -------------------------------------------------------------------------------- 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 | // System specific interface stuff. 21 | // 22 | //----------------------------------------------------------------------------- 23 | 24 | 25 | #ifndef __D_MAIN__ 26 | #define __D_MAIN__ 27 | 28 | #include "d_event.h" 29 | 30 | #ifdef __GNUG__ 31 | #pragma interface 32 | #endif 33 | 34 | 35 | 36 | #define MAXWADFILES 20 37 | extern char* wadfiles[MAXWADFILES]; 38 | 39 | void D_AddFile (char *file); 40 | 41 | 42 | 43 | // 44 | // D_DoomMain() 45 | // Not a globally visible function, just included for source reference, 46 | // calls all startup code, parses command line options. 47 | // If not overrided by user input, calls N_AdvanceDemo. 48 | // 49 | void D_DoomMain (void); 50 | 51 | // Called by IO functions when input is detected. 52 | void D_PostEvent (event_t* ev); 53 | 54 | 55 | 56 | // 57 | // BASE LEVEL 58 | // 59 | void D_PageTicker (void); 60 | void D_PageDrawer (void); 61 | void D_AdvanceDemo (void); 62 | void D_StartTitle (void); 63 | 64 | #endif 65 | -------------------------------------------------------------------------------- /linuxdoom-1.10/d_net.h: -------------------------------------------------------------------------------- 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 | // DESCRIPTION: 18 | // Networking stuff. 19 | // 20 | //----------------------------------------------------------------------------- 21 | 22 | 23 | #ifndef __D_NET__ 24 | #define __D_NET__ 25 | 26 | #include "d_player.h" 27 | 28 | 29 | #ifdef __GNUG__ 30 | #pragma interface 31 | #endif 32 | 33 | 34 | // 35 | // Network play related stuff. 36 | // There is a data struct that stores network 37 | // communication related stuff, and another 38 | // one that defines the actual packets to 39 | // be transmitted. 40 | // 41 | 42 | #define DOOMCOM_ID 0x12345678l 43 | 44 | // Max computers/players in a game. 45 | #define MAXNETNODES 8 46 | 47 | 48 | // Networking and tick handling related. 49 | #define BACKUPTICS 12 50 | 51 | typedef enum 52 | { 53 | CMD_SEND = 1, 54 | CMD_GET = 2 55 | 56 | } command_t; 57 | 58 | 59 | // 60 | // Network packet data. 61 | // 62 | typedef struct 63 | { 64 | // High bit is retransmit request. 65 | unsigned checksum; 66 | // Only valid if NCMD_RETRANSMIT. 67 | byte retransmitfrom; 68 | 69 | byte starttic; 70 | byte player; 71 | byte numtics; 72 | ticcmd_t cmds[BACKUPTICS]; 73 | 74 | } doomdata_t; 75 | 76 | 77 | 78 | 79 | typedef struct 80 | { 81 | // Supposed to be DOOMCOM_ID? 82 | long id; 83 | 84 | // DOOM executes an int to execute commands. 85 | short intnum; 86 | // Communication between DOOM and the driver. 87 | // Is CMD_SEND or CMD_GET. 88 | short command; 89 | // Is dest for send, set by get (-1 = no packet). 90 | short remotenode; 91 | 92 | // Number of bytes in doomdata to be sent 93 | short datalength; 94 | 95 | // Info common to all nodes. 96 | // Console is allways node 0. 97 | short numnodes; 98 | // Flag: 1 = no duplication, 2-5 = dup for slow nets. 99 | short ticdup; 100 | // Flag: 1 = send a backup tic in every packet. 101 | short extratics; 102 | // Flag: 1 = deathmatch. 103 | short deathmatch; 104 | // Flag: -1 = new game, 0-5 = load savegame 105 | short savegame; 106 | short episode; // 1-3 107 | short map; // 1-9 108 | short skill; // 1-5 109 | 110 | // Info specific to this node. 111 | short consoleplayer; 112 | short numplayers; 113 | 114 | // These are related to the 3-display mode, 115 | // in which two drones looking left and right 116 | // were used to render two additional views 117 | // on two additional computers. 118 | // Probably not operational anymore. 119 | // 1 = left, 0 = center, -1 = right 120 | short angleoffset; 121 | // 1 = drone 122 | short drone; 123 | 124 | // The packet data to be sent. 125 | doomdata_t data; 126 | 127 | } doomcom_t; 128 | 129 | 130 | 131 | // Create any new ticcmds and broadcast to other players. 132 | void NetUpdate (void); 133 | 134 | // Broadcasts special packets to other players 135 | // to notify of game exit 136 | void D_QuitNetGame (void); 137 | 138 | //? how many ticks to run? 139 | void TryRunTics (void); 140 | 141 | 142 | #endif 143 | 144 | //----------------------------------------------------------------------------- 145 | // 146 | // $Log:$ 147 | // 148 | //----------------------------------------------------------------------------- 149 | 150 | -------------------------------------------------------------------------------- /linuxdoom-1.10/d_textur.h: -------------------------------------------------------------------------------- 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 | // DESCRIPTION: 18 | // Typedefs related to to textures etc., 19 | // isolated here to make it easier separating modules. 20 | // 21 | //----------------------------------------------------------------------------- 22 | 23 | 24 | #ifndef __D_TEXTUR__ 25 | #define __D_TEXTUR__ 26 | 27 | #include "doomtype.h" 28 | 29 | 30 | 31 | 32 | // 33 | // Flats? 34 | // 35 | // a pic is an unmasked block of pixels 36 | typedef struct 37 | { 38 | byte width; 39 | byte height; 40 | byte data; 41 | } pic_t; 42 | 43 | 44 | 45 | 46 | #endif 47 | //----------------------------------------------------------------------------- 48 | // 49 | // $Log:$ 50 | // 51 | //----------------------------------------------------------------------------- 52 | -------------------------------------------------------------------------------- /linuxdoom-1.10/d_think.h: -------------------------------------------------------------------------------- 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 | // DESCRIPTION: 18 | // MapObj data. Map Objects or mobjs are actors, entities, 19 | // thinker, take-your-pick... anything that moves, acts, or 20 | // suffers state changes of more or less violent nature. 21 | // 22 | //----------------------------------------------------------------------------- 23 | 24 | 25 | #ifndef __D_THINK__ 26 | #define __D_THINK__ 27 | 28 | 29 | #ifdef __GNUG__ 30 | #pragma interface 31 | #endif 32 | 33 | 34 | 35 | // 36 | // Experimental stuff. 37 | // To compile this as "ANSI C with classes" 38 | // we will need to handle the various 39 | // action functions cleanly. 40 | // 41 | typedef void (*actionf_v)(); 42 | typedef void (*actionf_p1)( void* ); 43 | typedef void (*actionf_p2)( void*, void* ); 44 | 45 | typedef union 46 | { 47 | actionf_p1 acp1; 48 | actionf_v acv; 49 | actionf_p2 acp2; 50 | 51 | } actionf_t; 52 | 53 | 54 | 55 | 56 | 57 | // Historically, "think_t" is yet another 58 | // function pointer to a routine to handle 59 | // an actor. 60 | typedef actionf_t think_t; 61 | 62 | 63 | // Doubly linked list of actors. 64 | typedef struct thinker_s 65 | { 66 | struct thinker_s* prev; 67 | struct thinker_s* next; 68 | think_t function; 69 | 70 | } thinker_t; 71 | 72 | 73 | 74 | #endif 75 | //----------------------------------------------------------------------------- 76 | // 77 | // $Log:$ 78 | // 79 | //----------------------------------------------------------------------------- 80 | -------------------------------------------------------------------------------- /linuxdoom-1.10/d_ticcmd.h: -------------------------------------------------------------------------------- 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 | // DESCRIPTION: 18 | // System specific interface stuff. 19 | // 20 | //----------------------------------------------------------------------------- 21 | 22 | 23 | #ifndef __D_TICCMD__ 24 | #define __D_TICCMD__ 25 | 26 | #include "doomtype.h" 27 | 28 | #ifdef __GNUG__ 29 | #pragma interface 30 | #endif 31 | 32 | // The data sampled per tick (single player) 33 | // and transmitted to other peers (multiplayer). 34 | // Mainly movements/button commands per game tick, 35 | // plus a checksum for internal state consistency. 36 | typedef struct 37 | { 38 | char forwardmove; // *2048 for move 39 | char sidemove; // *2048 for move 40 | short angleturn; // <<16 for angle delta 41 | short consistancy; // checks for net game 42 | byte chatchar; 43 | byte buttons; 44 | } ticcmd_t; 45 | 46 | 47 | 48 | #endif 49 | //----------------------------------------------------------------------------- 50 | // 51 | // $Log:$ 52 | // 53 | //----------------------------------------------------------------------------- 54 | -------------------------------------------------------------------------------- /linuxdoom-1.10/doom.inf: -------------------------------------------------------------------------------- 1 | 2 | [Defines] 3 | INF_VERSION = 0x00010005 4 | BASE_NAME = doom 5 | FILE_GUID = 6987936E-ED34-44db-AE97-1FA5E4ED2116 6 | MODULE_TYPE = UEFI_APPLICATION 7 | VERSION_STRING = 1.0 8 | ENTRY_POINT = UefiMain 9 | 10 | # 11 | # The following information is for reference only and not required by the build tools. 12 | # 13 | # VALID_ARCHITECTURES = IA32 X64 IPF EBC 14 | # 15 | 16 | [Sources] 17 | efi/i_system.c 18 | efi/i_net.c 19 | efi/i_sound.c 20 | efi/i_video.c 21 | am_map.c 22 | d_items.c 23 | d_main.c 24 | d_net.c 25 | doomdef.c 26 | doomstat.c 27 | dstrings.c 28 | f_finale.c 29 | f_wipe.c 30 | g_game.c 31 | hu_lib.c 32 | hu_stuff.c 33 | i_main.c 34 | info.c 35 | m_argv.c 36 | m_bbox.c 37 | m_cheat.c 38 | m_fixed.c 39 | m_menu.c 40 | m_misc.c 41 | m_random.c 42 | m_swap.c 43 | p_ceilng.c 44 | p_doors.c 45 | p_enemy.c 46 | p_floor.c 47 | p_inter.c 48 | p_lights.c 49 | p_map.c 50 | p_maputl.c 51 | p_mobj.c 52 | p_plats.c 53 | p_pspr.c 54 | p_saveg.c 55 | p_setup.c 56 | p_sight.c 57 | p_spec.c 58 | p_switch.c 59 | p_telept.c 60 | p_tick.c 61 | p_user.c 62 | r_bsp.c 63 | r_data.c 64 | r_draw.c 65 | r_main.c 66 | r_plane.c 67 | r_segs.c 68 | r_sky.c 69 | r_things.c 70 | s_sound.c 71 | sounds.c 72 | st_lib.c 73 | st_stuff.c 74 | tables.c 75 | v_video.c 76 | w_wad.c 77 | wi_stuff.c 78 | z_zone.c 79 | 80 | [Packages] 81 | MdePkg/MdePkg.dec 82 | MdeModulePkg/MdeModulePkg.dec 83 | StdLib/StdLib.dec 84 | 85 | [LibraryClasses] 86 | UefiApplicationEntryPoint 87 | UefiLib 88 | LibC 89 | ShellCEntryLib 90 | UefiBootServicesTableLib 91 | DevShell 92 | SerialPortLib 93 | 94 | [Protocols] 95 | gEfiLoadedImageProtocolGuid 96 | gEfiDevicePathToTextProtocolGuid 97 | gEfiSimplePointerProtocolGuid 98 | 99 | [BuildOptions] 100 | *:*_*_*_CC_FLAGS = -DNORMALUNIX 101 | 102 | -------------------------------------------------------------------------------- /linuxdoom-1.10/doom.wad: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/the-eugen/DOOM/7ce9e63cd8e018be3d3e457cfbe66bc60e8f399d/linuxdoom-1.10/doom.wad -------------------------------------------------------------------------------- /linuxdoom-1.10/doomdef.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 | // DoomDef - basic defines for DOOM, e.g. Version, game mode 21 | // and skill level, and display parameters. 22 | // 23 | //----------------------------------------------------------------------------- 24 | 25 | static const char 26 | rcsid[] = "$Id: m_bbox.c,v 1.1 1997/02/03 22:45:10 b1 Exp $"; 27 | 28 | 29 | #ifdef __GNUG__ 30 | #pragma implementation "doomdef.h" 31 | #endif 32 | #include "doomdef.h" 33 | 34 | // Location for any defines turned variables. 35 | 36 | // None. 37 | 38 | 39 | -------------------------------------------------------------------------------- /linuxdoom-1.10/doomstat.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 | // Put all global tate variables here. 21 | // 22 | //----------------------------------------------------------------------------- 23 | 24 | static const char 25 | rcsid[] = "$Id: m_bbox.c,v 1.1 1997/02/03 22:45:10 b1 Exp $"; 26 | 27 | 28 | #ifdef __GNUG__ 29 | #pragma implementation "doomstat.h" 30 | #endif 31 | #include "doomstat.h" 32 | 33 | 34 | // Game Mode - identify IWAD as shareware, retail etc. 35 | GameMode_t gamemode = indetermined; 36 | GameMission_t gamemission = doom; 37 | 38 | // Language. 39 | Language_t language = english; 40 | 41 | // Set if homebrew PWAD stuff has been added. 42 | boolean modifiedgame; 43 | 44 | 45 | 46 | 47 | -------------------------------------------------------------------------------- /linuxdoom-1.10/doomtype.h: -------------------------------------------------------------------------------- 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 | // DESCRIPTION: 18 | // Simple basic typedefs, isolated here to make it easier 19 | // separating modules. 20 | // 21 | //----------------------------------------------------------------------------- 22 | 23 | 24 | #ifndef __DOOMTYPE__ 25 | #define __DOOMTYPE__ 26 | 27 | 28 | #ifndef __BYTEBOOL__ 29 | #define __BYTEBOOL__ 30 | // Fixed to use builtin bool type with C++. 31 | #ifdef __cplusplus 32 | typedef bool boolean; 33 | #else 34 | typedef enum {false, true} boolean; 35 | #endif 36 | typedef unsigned char byte; 37 | #endif 38 | 39 | 40 | // Predefined with some OS. 41 | //#ifdef LINUX 42 | //#include 43 | //#include 44 | //#else 45 | #define MAXCHAR ((char)0x7f) 46 | #define MAXSHORT ((short)0x7fff) 47 | 48 | // Max pos 32-bit int. 49 | #define MAXINT ((int)0x7fffffff) 50 | #define MAXLONG ((long)0x7fffffff) 51 | #define MINCHAR ((char)0x80) 52 | #define MINSHORT ((short)0x8000) 53 | 54 | // Max negative 32-bit integer. 55 | #define MININT ((int)0x80000000) 56 | #define MINLONG ((long)0x80000000) 57 | //#endif 58 | 59 | 60 | 61 | 62 | #endif 63 | //----------------------------------------------------------------------------- 64 | // 65 | // $Log:$ 66 | // 67 | //----------------------------------------------------------------------------- 68 | -------------------------------------------------------------------------------- /linuxdoom-1.10/dstrings.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 | // Globally defined strings. 21 | // 22 | //----------------------------------------------------------------------------- 23 | 24 | static const char 25 | rcsid[] = "$Id: m_bbox.c,v 1.1 1997/02/03 22:45:10 b1 Exp $"; 26 | 27 | 28 | #ifdef __GNUG__ 29 | #pragma implementation "dstrings.h" 30 | #endif 31 | #include "dstrings.h" 32 | 33 | 34 | 35 | char* endmsg[NUM_QUITMESSAGES+1]= 36 | { 37 | // DOOM1 38 | QUITMSG, 39 | "please don't leave, there's more\ndemons to toast!", 40 | "let's beat it -- this is turning\ninto a bloodbath!", 41 | "i wouldn't leave if i were you.\ndos is much worse.", 42 | "you're trying to say you like dos\nbetter than me, right?", 43 | "don't leave yet -- there's a\ndemon around that corner!", 44 | "ya know, next time you come in here\ni'm gonna toast ya.", 45 | "go ahead and leave. see if i care." 46 | 47 | // QuitDOOM II messages 48 | "you want to quit?\nthen, thou hast lost an eighth!", 49 | "don't go now, there's a \ndimensional shambler waiting\nat the dos prompt!", 50 | "get outta here and go back\nto your boring programs.", 51 | "if i were your boss, i'd \n deathmatch ya in a minute!", 52 | "look, bud. you leave now\nand you forfeit your body count!", 53 | "just leave. when you come\nback, i'll be waiting with a bat.", 54 | "you're lucky i don't smack\nyou for thinking about leaving." 55 | 56 | // FinalDOOM? 57 | "fuck you, pussy!\nget the fuck out!", 58 | "you quit and i'll jizz\nin your cystholes!", 59 | "if you leave, i'll make\nthe lord drink my jizz.", 60 | "hey, ron! can we say\n'fuck' in the game?", 61 | "i'd leave: this is just\nmore monsters and levels.\nwhat a load.", 62 | "suck it down, asshole!\nyou're a fucking wimp!", 63 | "don't quit now! we're \nstill spending your money!", 64 | 65 | // Internal debug. Different style, too. 66 | "THIS IS NO MESSAGE!\nPage intentionally left blank." 67 | }; 68 | 69 | 70 | 71 | 72 | 73 | -------------------------------------------------------------------------------- /linuxdoom-1.10/dstrings.h: -------------------------------------------------------------------------------- 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 | // 18 | // $Log:$ 19 | // 20 | // DESCRIPTION: 21 | // DOOM strings, by language. 22 | // 23 | //----------------------------------------------------------------------------- 24 | 25 | 26 | #ifndef __DSTRINGS__ 27 | #define __DSTRINGS__ 28 | 29 | 30 | // All important printed strings. 31 | // Language selection (message strings). 32 | // Use -DFRENCH etc. 33 | 34 | #ifdef FRENCH 35 | #include "d_french.h" 36 | #else 37 | #include "d_englsh.h" 38 | #endif 39 | 40 | // Misc. other strings. 41 | #define SAVEGAMENAME "doomsav" 42 | 43 | 44 | // 45 | // File locations, 46 | // relative to current position. 47 | // Path names are OS-sensitive. 48 | // 49 | #define DEVMAPS "devmaps" 50 | #define DEVDATA "devdata" 51 | 52 | 53 | // Not done in french? 54 | 55 | // QuitDOOM messages 56 | #define NUM_QUITMESSAGES 22 57 | 58 | extern char* endmsg[]; 59 | 60 | 61 | #endif 62 | //----------------------------------------------------------------------------- 63 | // 64 | // $Log:$ 65 | // 66 | //----------------------------------------------------------------------------- 67 | -------------------------------------------------------------------------------- /linuxdoom-1.10/efi/i_net.c: -------------------------------------------------------------------------------- 1 | 2 | #include 3 | #include 4 | #include 5 | 6 | void I_InitNetwork (void) 7 | { 8 | boolean trueval = true; 9 | int i; 10 | int p; 11 | 12 | doomcom = malloc (sizeof (*doomcom) ); 13 | memset (doomcom, 0, sizeof(*doomcom) ); 14 | 15 | // set up for network 16 | i = M_CheckParm ("-dup"); 17 | 18 | if (i && i< myargc-1) 19 | { 20 | doomcom->ticdup = myargv[i+1][0]-'0'; 21 | if (doomcom->ticdup < 1) 22 | doomcom->ticdup = 1; 23 | if (doomcom->ticdup > 9) 24 | doomcom->ticdup = 9; 25 | } 26 | else 27 | doomcom-> ticdup = 1; 28 | 29 | if (M_CheckParm ("-extratic")) 30 | doomcom-> extratics = 1; 31 | else 32 | doomcom-> extratics = 0; 33 | 34 | //p = M_CheckParm ("-port"); 35 | //if (p && p ... 43 | i = M_CheckParm ("-net"); 44 | if (!i) 45 | { 46 | printf("Initializing single player game\n"); 47 | // single player game 48 | netgame = false; 49 | doomcom->id = DOOMCOM_ID; 50 | doomcom->numplayers = doomcom->numnodes = 1; 51 | doomcom->deathmatch = false; 52 | doomcom->consoleplayer = 0; 53 | return; 54 | } 55 | 56 | //netsend = PacketSend; 57 | //netget = PacketGet; 58 | //netgame = true; 59 | 60 | // parse player number and host list 61 | //doomcom->consoleplayer = myargv[i+1][0]-'1'; 62 | 63 | //doomcom->numnodes = 1; // this node for sure 64 | 65 | //i++; 66 | /* 67 | while (++i < myargc && myargv[i][0] != '-') 68 | { 69 | sendaddress[doomcom->numnodes].sin_family = AF_INET; 70 | sendaddress[doomcom->numnodes].sin_port = htons(DOOMPORT); 71 | if (myargv[i][0] == '.') 72 | { 73 | sendaddress[doomcom->numnodes].sin_addr.s_addr = inet_addr (myargv[i]+1); 74 | } 75 | else 76 | { 77 | hostentry = gethostbyname (myargv[i]); 78 | if (!hostentry) 79 | I_Error ("gethostbyname: couldn't find %s", myargv[i]); 80 | 81 | sendaddress[doomcom->numnodes].sin_addr.s_addr = *(int *)hostentry->h_addr_list[0]; 82 | } 83 | 84 | doomcom->numnodes++; 85 | } 86 | 87 | doomcom->id = DOOMCOM_ID; 88 | doomcom->numplayers = doomcom->numnodes; 89 | 90 | // build message to receive 91 | insocket = UDPsocket (); 92 | BindToLocalPort (insocket,htons(DOOMPORT)); 93 | ioctl (insocket, FIONBIO, &trueval); 94 | 95 | sendsocket = UDPsocket (); 96 | */ 97 | } 98 | 99 | void I_NetCmd (void) 100 | { 101 | printf("I_NetCmd\n"); 102 | } 103 | 104 | -------------------------------------------------------------------------------- /linuxdoom-1.10/efi/i_sound.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | void I_InitSound() 4 | { 5 | 6 | } 7 | 8 | void I_UpdateSound(void) 9 | { 10 | 11 | } 12 | 13 | void I_SubmitSound(void) 14 | { 15 | 16 | } 17 | 18 | void I_ShutdownSound(void) 19 | { 20 | 21 | } 22 | 23 | 24 | // 25 | // SFX I/O 26 | // 27 | 28 | void I_SetChannels() 29 | { 30 | 31 | } 32 | 33 | int I_GetSfxLumpNum(sfxinfo_t* sfx) 34 | { 35 | //char namebuf[9]; 36 | //sprintf(namebuf, "ds%s", sfx->name); 37 | //return W_GetNumForName(namebuf); 38 | return 0; 39 | } 40 | 41 | 42 | // Starts a sound in a particular sound channel. 43 | int 44 | I_StartSound 45 | ( int id, 46 | int vol, 47 | int sep, 48 | int pitch, 49 | int priority ) 50 | { 51 | return id; 52 | } 53 | 54 | 55 | void I_StopSound(int handle) 56 | { 57 | 58 | } 59 | 60 | // Called by S_*() functions 61 | // to see if a channel is still playing. 62 | // Returns 0 if no longer playing, 1 if playing. 63 | int I_SoundIsPlaying(int handle) 64 | { 65 | return 0; 66 | } 67 | 68 | // Updates the volume, separation, 69 | // and pitch of a sound channel. 70 | void 71 | I_UpdateSoundParams 72 | ( int handle, 73 | int vol, 74 | int sep, 75 | int pitch ) 76 | { 77 | 78 | } 79 | 80 | 81 | // 82 | // MUSIC I/O 83 | // 84 | void I_InitMusic(void) 85 | { 86 | 87 | } 88 | 89 | void I_ShutdownMusic(void) 90 | { 91 | 92 | } 93 | 94 | // Volume. 95 | void I_SetMusicVolume(int volume) 96 | { 97 | 98 | } 99 | 100 | // PAUSE game handling. 101 | void I_PauseSong(int handle) 102 | { 103 | 104 | } 105 | 106 | void I_ResumeSong(int handle) 107 | { 108 | 109 | } 110 | 111 | // Registers a song handle to song data. 112 | int I_RegisterSong(void *data) 113 | { 114 | return 1; 115 | } 116 | 117 | // Called by anything that wishes to start music. 118 | // plays a song, and when the song is done, 119 | // starts playing it again in an endless loop. 120 | // Horrible thing to do, considering. 121 | void 122 | I_PlaySong 123 | ( int handle, 124 | int looping ) 125 | { 126 | 127 | } 128 | 129 | // Stops a song over 3 seconds. 130 | void I_StopSong(int handle) 131 | { 132 | 133 | } 134 | 135 | // See above (register), then think backwards 136 | void I_UnRegisterSong(int handle) 137 | { 138 | 139 | } 140 | 141 | -------------------------------------------------------------------------------- /linuxdoom-1.10/efi/i_system.c: -------------------------------------------------------------------------------- 1 | 2 | #include 3 | #include 4 | #include 5 | 6 | #include 7 | #include 8 | #include 9 | 10 | #include "doomdef.h" 11 | #include "m_misc.h" 12 | #include "i_video.h" 13 | #include "i_sound.h" 14 | 15 | #include "d_net.h" 16 | #include "g_game.h" 17 | 18 | #ifdef __GNUG__ 19 | #pragma implementation "i_system.h" 20 | #endif 21 | #include "i_system.h" 22 | 23 | 24 | 25 | 26 | int mb_used = 20; 27 | 28 | 29 | void 30 | I_Tactile 31 | ( int on, 32 | int off, 33 | int total ) 34 | { 35 | // UNUSED. 36 | on = off = total = 0; 37 | } 38 | 39 | ticcmd_t emptycmd; 40 | ticcmd_t* I_BaseTiccmd(void) 41 | { 42 | return &emptycmd; 43 | } 44 | 45 | 46 | int I_GetHeapSize (void) 47 | { 48 | return mb_used*1024*1024; 49 | } 50 | 51 | byte* I_ZoneBase (int* size) 52 | { 53 | *size = mb_used*1024*1024; 54 | return (byte *) malloc (*size); 55 | } 56 | 57 | 58 | 59 | // 60 | // I_GetTime 61 | // returns time in 1/70th second tics 62 | // 63 | int I_GetTime (void) 64 | { 65 | struct timeval tp; 66 | //struct timezone tzp; 67 | int newtics; 68 | static int basetime=0; 69 | 70 | gettimeofday(&tp, NULL); 71 | if (!basetime) 72 | basetime = tp.tv_sec; 73 | newtics = (tp.tv_sec-basetime)*TICRATE + tp.tv_usec*TICRATE/1000000; 74 | return newtics; 75 | } 76 | 77 | 78 | 79 | // 80 | // I_Init 81 | // 82 | void I_Init (void) 83 | { 84 | I_InitSound(); 85 | // I_InitGraphics(); 86 | } 87 | 88 | // 89 | // I_Quit 90 | // 91 | void I_Quit (void) 92 | { 93 | D_QuitNetGame (); 94 | I_ShutdownSound(); 95 | I_ShutdownMusic(); 96 | M_SaveDefaults (); 97 | I_ShutdownGraphics(); 98 | 99 | printf("I_Quit: locking\n"); 100 | while(1) ; 101 | //exit(0); 102 | } 103 | 104 | void I_WaitVBL(int count) 105 | { 106 | #ifdef SGI 107 | sginap(1); 108 | #else 109 | #ifdef SUN 110 | sleep(0); 111 | #else 112 | usleep (count * (1000000/70) ); 113 | #endif 114 | #endif 115 | } 116 | 117 | void I_BeginRead(void) 118 | { 119 | } 120 | 121 | void I_EndRead(void) 122 | { 123 | } 124 | 125 | byte* I_AllocLow(int length) 126 | { 127 | byte* mem; 128 | 129 | mem = (byte *)malloc (length); 130 | memset (mem,0,length); 131 | return mem; 132 | } 133 | 134 | 135 | // 136 | // I_Error 137 | // 138 | extern boolean demorecording; 139 | 140 | void I_Error (char *error, ...) 141 | { 142 | va_list argptr; 143 | 144 | // Message first. 145 | va_start (argptr,error); 146 | printf ("Error: "); 147 | vprintf (error,argptr); 148 | printf ("\n"); 149 | va_end (argptr); 150 | 151 | // Shutdown. Here might be other errors. 152 | if (demorecording) 153 | G_CheckDemoStatus(); 154 | 155 | D_QuitNetGame (); 156 | I_ShutdownGraphics(); 157 | 158 | while(1) ; 159 | //exit(-1); 160 | } 161 | 162 | /// 163 | 164 | extern 165 | INTN 166 | ShellAppMain ( 167 | IN UINTN Argc, 168 | IN CHAR16 **Argv 169 | ); 170 | 171 | #include 172 | #include 173 | #include 174 | #include 175 | #include 176 | 177 | EFI_STATUS UefiMain(EFI_HANDLE handle, EFI_SYSTEM_TABLE* st) 178 | { 179 | const char* msg = "DOOM: testing serial port\n"; 180 | SerialPortInitialize(); 181 | SerialPortWrite(msg, strlen(msg)); 182 | 183 | const CHAR16* argv[] = {L"doom.exe", NULL}; 184 | return ShellAppMain(1, argv); 185 | } 186 | 187 | 188 | -------------------------------------------------------------------------------- /linuxdoom-1.10/f_finale.h: -------------------------------------------------------------------------------- 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 | // DESCRIPTION: 18 | // 19 | // 20 | //----------------------------------------------------------------------------- 21 | 22 | 23 | #ifndef __F_FINALE__ 24 | #define __F_FINALE__ 25 | 26 | 27 | #include "doomtype.h" 28 | #include "d_event.h" 29 | // 30 | // FINALE 31 | // 32 | 33 | // Called by main loop. 34 | boolean F_Responder (event_t* ev); 35 | 36 | // Called by main loop. 37 | void F_Ticker (void); 38 | 39 | // Called by main loop. 40 | void F_Drawer (void); 41 | 42 | 43 | void F_StartFinale (void); 44 | 45 | 46 | 47 | 48 | #endif 49 | //----------------------------------------------------------------------------- 50 | // 51 | // $Log:$ 52 | // 53 | //----------------------------------------------------------------------------- 54 | -------------------------------------------------------------------------------- /linuxdoom-1.10/f_wipe.h: -------------------------------------------------------------------------------- 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 | // DESCRIPTION: 18 | // Mission start screen wipe/melt, special effects. 19 | // 20 | //----------------------------------------------------------------------------- 21 | 22 | 23 | #ifndef __F_WIPE_H__ 24 | #define __F_WIPE_H__ 25 | 26 | // 27 | // SCREEN WIPE PACKAGE 28 | // 29 | 30 | enum 31 | { 32 | // simple gradual pixel change for 8-bit only 33 | wipe_ColorXForm, 34 | 35 | // weird screen melt 36 | wipe_Melt, 37 | 38 | wipe_NUMWIPES 39 | }; 40 | 41 | int 42 | wipe_StartScreen 43 | ( int x, 44 | int y, 45 | int width, 46 | int height ); 47 | 48 | 49 | int 50 | wipe_EndScreen 51 | ( int x, 52 | int y, 53 | int width, 54 | int height ); 55 | 56 | 57 | int 58 | wipe_ScreenWipe 59 | ( int wipeno, 60 | int x, 61 | int y, 62 | int width, 63 | int height, 64 | int ticks ); 65 | 66 | #endif 67 | //----------------------------------------------------------------------------- 68 | // 69 | // $Log:$ 70 | // 71 | //----------------------------------------------------------------------------- 72 | -------------------------------------------------------------------------------- /linuxdoom-1.10/g_game.h: -------------------------------------------------------------------------------- 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 | // DESCRIPTION: 18 | // Duh. 19 | // 20 | //----------------------------------------------------------------------------- 21 | 22 | 23 | #ifndef __G_GAME__ 24 | #define __G_GAME__ 25 | 26 | #include "doomdef.h" 27 | #include "d_event.h" 28 | 29 | 30 | 31 | // 32 | // GAME 33 | // 34 | void G_DeathMatchSpawnPlayer (int playernum); 35 | 36 | void G_InitNew (skill_t skill, int episode, int map); 37 | 38 | // Can be called by the startup code or M_Responder. 39 | // A normal game starts at map 1, 40 | // but a warp test can start elsewhere 41 | void G_DeferedInitNew (skill_t skill, int episode, int map); 42 | 43 | void G_DeferedPlayDemo (char* demo); 44 | 45 | // Can be called by the startup code or M_Responder, 46 | // calls P_SetupLevel or W_EnterWorld. 47 | void G_LoadGame (char* name); 48 | 49 | void G_DoLoadGame (void); 50 | 51 | // Called by M_Responder. 52 | void G_SaveGame (int slot, char* description); 53 | 54 | // Only called by startup code. 55 | void G_RecordDemo (char* name); 56 | 57 | void G_BeginRecording (void); 58 | 59 | void G_PlayDemo (char* name); 60 | void G_TimeDemo (char* name); 61 | boolean G_CheckDemoStatus (void); 62 | 63 | void G_ExitLevel (void); 64 | void G_SecretExitLevel (void); 65 | 66 | void G_WorldDone (void); 67 | 68 | void G_Ticker (void); 69 | boolean G_Responder (event_t* ev); 70 | 71 | void G_ScreenShot (void); 72 | 73 | 74 | #endif 75 | //----------------------------------------------------------------------------- 76 | // 77 | // $Log:$ 78 | // 79 | //----------------------------------------------------------------------------- 80 | -------------------------------------------------------------------------------- /linuxdoom-1.10/hu_lib.h: -------------------------------------------------------------------------------- 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 | // DESCRIPTION: none 18 | // 19 | //----------------------------------------------------------------------------- 20 | 21 | #ifndef __HULIB__ 22 | #define __HULIB__ 23 | 24 | // We are referring to patches. 25 | #include "r_defs.h" 26 | 27 | 28 | // background and foreground screen numbers 29 | // different from other modules. 30 | #define BG 1 31 | #define FG 0 32 | 33 | // font stuff 34 | #define HU_CHARERASE KEY_BACKSPACE 35 | 36 | #define HU_MAXLINES 4 37 | #define HU_MAXLINELENGTH 80 38 | 39 | // 40 | // Typedefs of widgets 41 | // 42 | 43 | // Text Line widget 44 | // (parent of Scrolling Text and Input Text widgets) 45 | typedef struct 46 | { 47 | // left-justified position of scrolling text window 48 | int x; 49 | int y; 50 | 51 | patch_t** f; // font 52 | int sc; // start character 53 | char l[HU_MAXLINELENGTH+1]; // line of text 54 | int len; // current line length 55 | 56 | // whether this line needs to be udpated 57 | int needsupdate; 58 | 59 | } hu_textline_t; 60 | 61 | 62 | 63 | // Scrolling Text window widget 64 | // (child of Text Line widget) 65 | typedef struct 66 | { 67 | hu_textline_t l[HU_MAXLINES]; // text lines to draw 68 | int h; // height in lines 69 | int cl; // current line number 70 | 71 | // pointer to boolean stating whether to update window 72 | boolean* on; 73 | boolean laston; // last value of *->on. 74 | 75 | } hu_stext_t; 76 | 77 | 78 | 79 | // Input Text Line widget 80 | // (child of Text Line widget) 81 | typedef struct 82 | { 83 | hu_textline_t l; // text line to input on 84 | 85 | // left margin past which I am not to delete characters 86 | int lm; 87 | 88 | // pointer to boolean stating whether to update window 89 | boolean* on; 90 | boolean laston; // last value of *->on; 91 | 92 | } hu_itext_t; 93 | 94 | 95 | // 96 | // Widget creation, access, and update routines 97 | // 98 | 99 | // initializes heads-up widget library 100 | void HUlib_init(void); 101 | 102 | // 103 | // textline code 104 | // 105 | 106 | // clear a line of text 107 | void HUlib_clearTextLine(hu_textline_t *t); 108 | 109 | void HUlib_initTextLine(hu_textline_t *t, int x, int y, patch_t **f, int sc); 110 | 111 | // returns success 112 | boolean HUlib_addCharToTextLine(hu_textline_t *t, char ch); 113 | 114 | // returns success 115 | boolean HUlib_delCharFromTextLine(hu_textline_t *t); 116 | 117 | // draws tline 118 | void HUlib_drawTextLine(hu_textline_t *l, boolean drawcursor); 119 | 120 | // erases text line 121 | void HUlib_eraseTextLine(hu_textline_t *l); 122 | 123 | 124 | // 125 | // Scrolling Text window widget routines 126 | // 127 | 128 | // ? 129 | void 130 | HUlib_initSText 131 | ( hu_stext_t* s, 132 | int x, 133 | int y, 134 | int h, 135 | patch_t** font, 136 | int startchar, 137 | boolean* on ); 138 | 139 | // add a new line 140 | void HUlib_addLineToSText(hu_stext_t* s); 141 | 142 | // ? 143 | void 144 | HUlib_addMessageToSText 145 | ( hu_stext_t* s, 146 | char* prefix, 147 | char* msg ); 148 | 149 | // draws stext 150 | void HUlib_drawSText(hu_stext_t* s); 151 | 152 | // erases all stext lines 153 | void HUlib_eraseSText(hu_stext_t* s); 154 | 155 | // Input Text Line widget routines 156 | void 157 | HUlib_initIText 158 | ( hu_itext_t* it, 159 | int x, 160 | int y, 161 | patch_t** font, 162 | int startchar, 163 | boolean* on ); 164 | 165 | // enforces left margin 166 | void HUlib_delCharFromIText(hu_itext_t* it); 167 | 168 | // enforces left margin 169 | void HUlib_eraseLineFromIText(hu_itext_t* it); 170 | 171 | // resets line and left margin 172 | void HUlib_resetIText(hu_itext_t* it); 173 | 174 | // left of left-margin 175 | void 176 | HUlib_addPrefixToIText 177 | ( hu_itext_t* it, 178 | char* str ); 179 | 180 | // whether eaten 181 | boolean 182 | HUlib_keyInIText 183 | ( hu_itext_t* it, 184 | unsigned char ch ); 185 | 186 | void HUlib_drawIText(hu_itext_t* it); 187 | 188 | // erases all itext lines 189 | void HUlib_eraseIText(hu_itext_t* it); 190 | 191 | #endif 192 | //----------------------------------------------------------------------------- 193 | // 194 | // $Log:$ 195 | // 196 | //----------------------------------------------------------------------------- 197 | -------------------------------------------------------------------------------- /linuxdoom-1.10/hu_stuff.h: -------------------------------------------------------------------------------- 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 | // DESCRIPTION: Head up display 18 | // 19 | //----------------------------------------------------------------------------- 20 | 21 | #ifndef __HU_STUFF_H__ 22 | #define __HU_STUFF_H__ 23 | 24 | #include "d_event.h" 25 | 26 | 27 | // 28 | // Globally visible constants. 29 | // 30 | #define HU_FONTSTART '!' // the first font characters 31 | #define HU_FONTEND '_' // the last font characters 32 | 33 | // Calculate # of glyphs in font. 34 | #define HU_FONTSIZE (HU_FONTEND - HU_FONTSTART + 1) 35 | 36 | #define HU_BROADCAST 5 37 | 38 | #define HU_MSGREFRESH KEY_ENTER 39 | #define HU_MSGX 0 40 | #define HU_MSGY 0 41 | #define HU_MSGWIDTH 64 // in characters 42 | #define HU_MSGHEIGHT 1 // in lines 43 | 44 | #define HU_MSGTIMEOUT (4*TICRATE) 45 | 46 | // 47 | // HEADS UP TEXT 48 | // 49 | 50 | void HU_Init(void); 51 | void HU_Start(void); 52 | 53 | boolean HU_Responder(event_t* ev); 54 | 55 | void HU_Ticker(void); 56 | void HU_Drawer(void); 57 | char HU_dequeueChatChar(void); 58 | void HU_Erase(void); 59 | 60 | 61 | #endif 62 | //----------------------------------------------------------------------------- 63 | // 64 | // $Log:$ 65 | // 66 | //----------------------------------------------------------------------------- 67 | -------------------------------------------------------------------------------- /linuxdoom-1.10/i_main.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 | // Main program, simply calls D_DoomMain high level loop. 21 | // 22 | //----------------------------------------------------------------------------- 23 | 24 | static const char 25 | rcsid[] = "$Id: i_main.c,v 1.4 1997/02/03 22:45:10 b1 Exp $"; 26 | 27 | 28 | 29 | #include "doomdef.h" 30 | 31 | #include "m_argv.h" 32 | #include "d_main.h" 33 | 34 | int 35 | main 36 | ( int argc, 37 | char** argv ) 38 | { 39 | myargc = argc; 40 | myargv = argv; 41 | 42 | D_DoomMain (); 43 | 44 | return 0; 45 | } 46 | -------------------------------------------------------------------------------- /linuxdoom-1.10/i_net.h: -------------------------------------------------------------------------------- 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 | // DESCRIPTION: 18 | // System specific network interface stuff. 19 | // 20 | //----------------------------------------------------------------------------- 21 | 22 | 23 | #ifndef __I_NET__ 24 | #define __I_NET__ 25 | 26 | 27 | #ifdef __GNUG__ 28 | #pragma interface 29 | #endif 30 | 31 | 32 | 33 | // Called by D_DoomMain. 34 | 35 | 36 | void I_InitNetwork (void); 37 | void I_NetCmd (void); 38 | 39 | 40 | #endif 41 | //----------------------------------------------------------------------------- 42 | // 43 | // $Log:$ 44 | // 45 | //----------------------------------------------------------------------------- 46 | -------------------------------------------------------------------------------- /linuxdoom-1.10/i_sound.h: -------------------------------------------------------------------------------- 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 | // 18 | // DESCRIPTION: 19 | // System interface, sound. 20 | // 21 | //----------------------------------------------------------------------------- 22 | 23 | #ifndef __I_SOUND__ 24 | #define __I_SOUND__ 25 | 26 | #include "doomdef.h" 27 | 28 | // UNIX hack, to be removed. 29 | #ifdef SNDSERV 30 | #include 31 | extern FILE* sndserver; 32 | extern char* sndserver_filename; 33 | #endif 34 | 35 | #include "doomstat.h" 36 | #include "sounds.h" 37 | 38 | 39 | 40 | // Init at program start... 41 | void I_InitSound(); 42 | 43 | // ... update sound buffer and audio device at runtime... 44 | void I_UpdateSound(void); 45 | void I_SubmitSound(void); 46 | 47 | // ... shut down and relase at program termination. 48 | void I_ShutdownSound(void); 49 | 50 | 51 | // 52 | // SFX I/O 53 | // 54 | 55 | // Initialize channels? 56 | void I_SetChannels(); 57 | 58 | // Get raw data lump index for sound descriptor. 59 | int I_GetSfxLumpNum (sfxinfo_t* sfxinfo ); 60 | 61 | 62 | // Starts a sound in a particular sound channel. 63 | int 64 | I_StartSound 65 | ( int id, 66 | int vol, 67 | int sep, 68 | int pitch, 69 | int priority ); 70 | 71 | 72 | // Stops a sound channel. 73 | void I_StopSound(int handle); 74 | 75 | // Called by S_*() functions 76 | // to see if a channel is still playing. 77 | // Returns 0 if no longer playing, 1 if playing. 78 | int I_SoundIsPlaying(int handle); 79 | 80 | // Updates the volume, separation, 81 | // and pitch of a sound channel. 82 | void 83 | I_UpdateSoundParams 84 | ( int handle, 85 | int vol, 86 | int sep, 87 | int pitch ); 88 | 89 | 90 | // 91 | // MUSIC I/O 92 | // 93 | void I_InitMusic(void); 94 | void I_ShutdownMusic(void); 95 | // Volume. 96 | void I_SetMusicVolume(int volume); 97 | // PAUSE game handling. 98 | void I_PauseSong(int handle); 99 | void I_ResumeSong(int handle); 100 | // Registers a song handle to song data. 101 | int I_RegisterSong(void *data); 102 | // Called by anything that wishes to start music. 103 | // plays a song, and when the song is done, 104 | // starts playing it again in an endless loop. 105 | // Horrible thing to do, considering. 106 | void 107 | I_PlaySong 108 | ( int handle, 109 | int looping ); 110 | // Stops a song over 3 seconds. 111 | void I_StopSong(int handle); 112 | // See above (register), then think backwards 113 | void I_UnRegisterSong(int handle); 114 | 115 | 116 | 117 | #endif 118 | //----------------------------------------------------------------------------- 119 | // 120 | // $Log:$ 121 | // 122 | //----------------------------------------------------------------------------- 123 | -------------------------------------------------------------------------------- /linuxdoom-1.10/i_system.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 | 27 | #include 28 | #include 29 | #include 30 | 31 | #include 32 | #include 33 | #include 34 | 35 | #include "doomdef.h" 36 | #include "m_misc.h" 37 | #include "i_video.h" 38 | #include "i_sound.h" 39 | 40 | #include "d_net.h" 41 | #include "g_game.h" 42 | 43 | #ifdef __GNUG__ 44 | #pragma implementation "i_system.h" 45 | #endif 46 | #include "i_system.h" 47 | 48 | 49 | 50 | 51 | int mb_used = 6; 52 | 53 | 54 | void 55 | I_Tactile 56 | ( int on, 57 | int off, 58 | int total ) 59 | { 60 | // UNUSED. 61 | on = off = total = 0; 62 | } 63 | 64 | ticcmd_t emptycmd; 65 | ticcmd_t* I_BaseTiccmd(void) 66 | { 67 | return &emptycmd; 68 | } 69 | 70 | 71 | int I_GetHeapSize (void) 72 | { 73 | return mb_used*1024*1024; 74 | } 75 | 76 | byte* I_ZoneBase (int* size) 77 | { 78 | *size = mb_used*1024*1024; 79 | return (byte *) malloc (*size); 80 | } 81 | 82 | 83 | 84 | // 85 | // I_GetTime 86 | // returns time in 1/70th second tics 87 | // 88 | int I_GetTime (void) 89 | { 90 | struct timeval tp; 91 | struct timezone tzp; 92 | int newtics; 93 | static int basetime=0; 94 | 95 | gettimeofday(&tp, &tzp); 96 | if (!basetime) 97 | basetime = tp.tv_sec; 98 | newtics = (tp.tv_sec-basetime)*TICRATE + tp.tv_usec*TICRATE/1000000; 99 | return newtics; 100 | } 101 | 102 | 103 | 104 | // 105 | // I_Init 106 | // 107 | void I_Init (void) 108 | { 109 | I_InitSound(); 110 | // I_InitGraphics(); 111 | } 112 | 113 | // 114 | // I_Quit 115 | // 116 | void I_Quit (void) 117 | { 118 | D_QuitNetGame (); 119 | I_ShutdownSound(); 120 | I_ShutdownMusic(); 121 | M_SaveDefaults (); 122 | I_ShutdownGraphics(); 123 | exit(0); 124 | } 125 | 126 | void I_WaitVBL(int count) 127 | { 128 | #ifdef SGI 129 | sginap(1); 130 | #else 131 | #ifdef SUN 132 | sleep(0); 133 | #else 134 | usleep (count * (1000000/70) ); 135 | #endif 136 | #endif 137 | } 138 | 139 | void I_BeginRead(void) 140 | { 141 | } 142 | 143 | void I_EndRead(void) 144 | { 145 | } 146 | 147 | byte* I_AllocLow(int length) 148 | { 149 | byte* mem; 150 | 151 | mem = (byte *)malloc (length); 152 | memset (mem,0,length); 153 | return mem; 154 | } 155 | 156 | 157 | // 158 | // I_Error 159 | // 160 | extern boolean demorecording; 161 | 162 | void I_Error (char *error, ...) 163 | { 164 | va_list argptr; 165 | 166 | // Message first. 167 | va_start (argptr,error); 168 | fprintf (stderr, "Error: "); 169 | vfprintf (stderr,error,argptr); 170 | fprintf (stderr, "\n"); 171 | va_end (argptr); 172 | 173 | fflush( stderr ); 174 | 175 | // Shutdown. Here might be other errors. 176 | if (demorecording) 177 | G_CheckDemoStatus(); 178 | 179 | D_QuitNetGame (); 180 | I_ShutdownGraphics(); 181 | 182 | exit(-1); 183 | } 184 | -------------------------------------------------------------------------------- /linuxdoom-1.10/i_system.h: -------------------------------------------------------------------------------- 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 | // DESCRIPTION: 18 | // System specific interface stuff. 19 | // 20 | //----------------------------------------------------------------------------- 21 | 22 | 23 | #ifndef __I_SYSTEM__ 24 | #define __I_SYSTEM__ 25 | 26 | #include "d_ticcmd.h" 27 | #include "d_event.h" 28 | 29 | #ifdef __GNUG__ 30 | #pragma interface 31 | #endif 32 | 33 | 34 | // Called by DoomMain. 35 | void I_Init (void); 36 | 37 | // Called by startup code 38 | // to get the ammount of memory to malloc 39 | // for the zone management. 40 | byte* I_ZoneBase (int *size); 41 | 42 | 43 | // Called by D_DoomLoop, 44 | // returns current time in tics. 45 | int I_GetTime (void); 46 | 47 | 48 | // 49 | // Called by D_DoomLoop, 50 | // called before processing any tics in a frame 51 | // (just after displaying a frame). 52 | // Time consuming syncronous operations 53 | // are performed here (joystick reading). 54 | // Can call D_PostEvent. 55 | // 56 | void I_StartFrame (void); 57 | 58 | 59 | // 60 | // Called by D_DoomLoop, 61 | // called before processing each tic in a frame. 62 | // Quick syncronous operations are performed here. 63 | // Can call D_PostEvent. 64 | void I_StartTic (void); 65 | 66 | // Asynchronous interrupt functions should maintain private queues 67 | // that are read by the synchronous functions 68 | // to be converted into events. 69 | 70 | // Either returns a null ticcmd, 71 | // or calls a loadable driver to build it. 72 | // This ticcmd will then be modified by the gameloop 73 | // for normal input. 74 | ticcmd_t* I_BaseTiccmd (void); 75 | 76 | 77 | // Called by M_Responder when quit is selected. 78 | // Clean exit, displays sell blurb. 79 | void I_Quit (void); 80 | 81 | 82 | // Allocates from low memory under dos, 83 | // just mallocs under unix 84 | byte* I_AllocLow (int length); 85 | 86 | void I_Tactile (int on, int off, int total); 87 | 88 | 89 | void I_Error (char *error, ...); 90 | 91 | 92 | #endif 93 | //----------------------------------------------------------------------------- 94 | // 95 | // $Log:$ 96 | // 97 | //----------------------------------------------------------------------------- 98 | -------------------------------------------------------------------------------- /linuxdoom-1.10/i_video.h: -------------------------------------------------------------------------------- 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 | // DESCRIPTION: 18 | // System specific interface stuff. 19 | // 20 | //----------------------------------------------------------------------------- 21 | 22 | 23 | #ifndef __I_VIDEO__ 24 | #define __I_VIDEO__ 25 | 26 | 27 | #include "doomtype.h" 28 | 29 | #ifdef __GNUG__ 30 | #pragma interface 31 | #endif 32 | 33 | 34 | // Called by D_DoomMain, 35 | // determines the hardware configuration 36 | // and sets up the video mode 37 | void I_InitGraphics (void); 38 | 39 | 40 | void I_ShutdownGraphics(void); 41 | 42 | // Takes full 8 bit values. 43 | void I_SetPalette (byte* palette); 44 | 45 | void I_UpdateNoBlit (void); 46 | void I_FinishUpdate (void); 47 | 48 | // Wait for vertical retrace or pause a bit. 49 | void I_WaitVBL(int count); 50 | 51 | void I_ReadScreen (byte* scr); 52 | 53 | void I_BeginRead (void); 54 | void I_EndRead (void); 55 | 56 | 57 | 58 | #endif 59 | //----------------------------------------------------------------------------- 60 | // 61 | // $Log:$ 62 | // 63 | //----------------------------------------------------------------------------- 64 | -------------------------------------------------------------------------------- /linuxdoom-1.10/m_argv.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_argv.c,v 1.1 1997/02/03 22:45:10 b1 Exp $"; 25 | 26 | 27 | #include 28 | 29 | int myargc; 30 | char** myargv; 31 | 32 | 33 | 34 | 35 | // 36 | // M_CheckParm 37 | // Checks for the given parameter 38 | // in the program's command line arguments. 39 | // Returns the argument number (1 to argc-1) 40 | // or 0 if not present 41 | int M_CheckParm (char *check) 42 | { 43 | int i; 44 | 45 | for (i = 1;ibox[BOXRIGHT]) 54 | box[BOXRIGHT] = x; 55 | if (ybox[BOXTOP]) 58 | box[BOXTOP] = y; 59 | } 60 | 61 | 62 | 63 | 64 | 65 | -------------------------------------------------------------------------------- /linuxdoom-1.10/m_bbox.h: -------------------------------------------------------------------------------- 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 | // DESCRIPTION: 18 | // Nil. 19 | // 20 | //----------------------------------------------------------------------------- 21 | 22 | 23 | #ifndef __M_BBOX__ 24 | #define __M_BBOX__ 25 | 26 | //#include 27 | #include "doomtype.h" 28 | 29 | #include "m_fixed.h" 30 | 31 | 32 | // Bounding box coordinate storage. 33 | enum 34 | { 35 | BOXTOP, 36 | BOXBOTTOM, 37 | BOXLEFT, 38 | BOXRIGHT 39 | }; // bbox coordinates 40 | 41 | // Bounding box functions. 42 | void M_ClearBox (fixed_t* box); 43 | 44 | void 45 | M_AddToBox 46 | ( fixed_t* box, 47 | fixed_t x, 48 | fixed_t y ); 49 | 50 | 51 | #endif 52 | //----------------------------------------------------------------------------- 53 | // 54 | // $Log:$ 55 | // 56 | //----------------------------------------------------------------------------- 57 | -------------------------------------------------------------------------------- /linuxdoom-1.10/m_cheat.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 | // Cheat sequence checking. 21 | // 22 | //----------------------------------------------------------------------------- 23 | 24 | 25 | static const char 26 | rcsid[] = "$Id: m_cheat.c,v 1.1 1997/02/03 21:24:34 b1 Exp $"; 27 | 28 | #include "m_cheat.h" 29 | 30 | // 31 | // CHEAT SEQUENCE PACKAGE 32 | // 33 | 34 | static int firsttime = 1; 35 | static unsigned char cheat_xlate_table[256]; 36 | 37 | 38 | // 39 | // Called in st_stuff module, which handles the input. 40 | // Returns a 1 if the cheat was successful, 0 if failed. 41 | // 42 | int 43 | cht_CheckCheat 44 | ( cheatseq_t* cht, 45 | char key ) 46 | { 47 | int i; 48 | int rc = 0; 49 | 50 | if (firsttime) 51 | { 52 | firsttime = 0; 53 | for (i=0;i<256;i++) cheat_xlate_table[i] = SCRAMBLE(i); 54 | } 55 | 56 | if (!cht->p) 57 | cht->p = cht->sequence; // initialize if first time 58 | 59 | if (*cht->p == 0) 60 | *(cht->p++) = key; 61 | else if 62 | (cheat_xlate_table[(unsigned char)key] == *cht->p) cht->p++; 63 | else 64 | cht->p = cht->sequence; 65 | 66 | if (*cht->p == 1) 67 | cht->p++; 68 | else if (*cht->p == 0xff) // end of sequence character 69 | { 70 | cht->p = cht->sequence; 71 | rc = 1; 72 | } 73 | 74 | return rc; 75 | } 76 | 77 | void 78 | cht_GetParam 79 | ( cheatseq_t* cht, 80 | char* buffer ) 81 | { 82 | 83 | unsigned char *p, c; 84 | 85 | p = cht->sequence; 86 | while (*(p++) != 1); 87 | 88 | do 89 | { 90 | c = *p; 91 | *(buffer++) = c; 92 | *(p++) = 0; 93 | } 94 | while (c && *p!=0xff ); 95 | 96 | if (*p==0xff) 97 | *buffer = 0; 98 | 99 | } 100 | 101 | 102 | -------------------------------------------------------------------------------- /linuxdoom-1.10/m_cheat.h: -------------------------------------------------------------------------------- 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 | // DESCRIPTION: 18 | // Cheat code checking. 19 | // 20 | //----------------------------------------------------------------------------- 21 | 22 | 23 | #ifndef __M_CHEAT__ 24 | #define __M_CHEAT__ 25 | 26 | // 27 | // CHEAT SEQUENCE PACKAGE 28 | // 29 | 30 | #define SCRAMBLE(a) \ 31 | ((((a)&1)<<7) + (((a)&2)<<5) + ((a)&4) + (((a)&8)<<1) \ 32 | + (((a)&16)>>1) + ((a)&32) + (((a)&64)>>5) + (((a)&128)>>7)) 33 | 34 | typedef struct 35 | { 36 | unsigned char* sequence; 37 | unsigned char* p; 38 | 39 | } cheatseq_t; 40 | 41 | int 42 | cht_CheckCheat 43 | ( cheatseq_t* cht, 44 | char key ); 45 | 46 | 47 | void 48 | cht_GetParam 49 | ( cheatseq_t* cht, 50 | char* buffer ); 51 | 52 | 53 | #endif 54 | //----------------------------------------------------------------------------- 55 | // 56 | // $Log:$ 57 | // 58 | //----------------------------------------------------------------------------- 59 | -------------------------------------------------------------------------------- /linuxdoom-1.10/m_fixed.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 | // Fixed point implementation. 21 | // 22 | //----------------------------------------------------------------------------- 23 | 24 | 25 | static const char 26 | rcsid[] = "$Id: m_bbox.c,v 1.1 1997/02/03 22:45:10 b1 Exp $"; 27 | 28 | #include "stdlib.h" 29 | 30 | #include "doomtype.h" 31 | #include "i_system.h" 32 | 33 | #ifdef __GNUG__ 34 | #pragma implementation "m_fixed.h" 35 | #endif 36 | #include "m_fixed.h" 37 | 38 | 39 | 40 | 41 | // Fixme. __USE_C_FIXED__ or something. 42 | 43 | fixed_t 44 | FixedMul 45 | ( fixed_t a, 46 | fixed_t b ) 47 | { 48 | return ((long long) a * (long long) b) >> FRACBITS; 49 | } 50 | 51 | 52 | 53 | // 54 | // FixedDiv, C version. 55 | // 56 | 57 | fixed_t 58 | FixedDiv 59 | ( fixed_t a, 60 | fixed_t b ) 61 | { 62 | if ( (abs(a)>>14) >= abs(b)) 63 | return (a^b)<0 ? MININT : MAXINT; 64 | return FixedDiv2 (a,b); 65 | } 66 | 67 | 68 | 69 | fixed_t 70 | FixedDiv2 71 | ( fixed_t a, 72 | fixed_t b ) 73 | { 74 | #if 0 75 | long long c; 76 | c = ((long long)a<<16) / ((long long)b); 77 | return (fixed_t) c; 78 | #endif 79 | 80 | double c; 81 | 82 | c = ((double)a) / ((double)b) * FRACUNIT; 83 | 84 | if (c >= 2147483648.0 || c < -2147483648.0) 85 | I_Error("FixedDiv: divide by zero"); 86 | return (fixed_t) c; 87 | } 88 | -------------------------------------------------------------------------------- /linuxdoom-1.10/m_fixed.h: -------------------------------------------------------------------------------- 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 | // DESCRIPTION: 18 | // Fixed point arithemtics, implementation. 19 | // 20 | //----------------------------------------------------------------------------- 21 | 22 | 23 | #ifndef __M_FIXED__ 24 | #define __M_FIXED__ 25 | 26 | 27 | #ifdef __GNUG__ 28 | #pragma interface 29 | #endif 30 | 31 | 32 | // 33 | // Fixed point, 32bit as 16.16. 34 | // 35 | #define FRACBITS 16 36 | #define FRACUNIT (1<>8) | (x<<8); 42 | } 43 | 44 | // Swapping 32bit. 45 | unsigned long SwapLONG( unsigned long x) 46 | { 47 | return 48 | (x>>24) 49 | | ((x>>8) & 0xff00) 50 | | ((x<<8) & 0xff0000) 51 | | (x<<24); 52 | } 53 | 54 | 55 | #endif 56 | 57 | 58 | -------------------------------------------------------------------------------- /linuxdoom-1.10/m_swap.h: -------------------------------------------------------------------------------- 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 | // DESCRIPTION: 18 | // Endianess handling, swapping 16bit and 32bit. 19 | // 20 | //----------------------------------------------------------------------------- 21 | 22 | 23 | #ifndef __M_SWAP__ 24 | #define __M_SWAP__ 25 | 26 | 27 | #ifdef __GNUG__ 28 | #pragma interface 29 | #endif 30 | 31 | 32 | // Endianess handling. 33 | // WAD files are stored little endian. 34 | #ifdef __BIG_ENDIAN__ 35 | short SwapSHORT(short); 36 | long SwapLONG(long); 37 | #define SHORT(x) ((short)SwapSHORT((unsigned short) (x))) 38 | #define LONG(x) ((long)SwapLONG((unsigned long) (x))) 39 | #else 40 | #define SHORT(x) (x) 41 | #define LONG(x) (x) 42 | #endif 43 | 44 | 45 | 46 | 47 | #endif 48 | //----------------------------------------------------------------------------- 49 | // 50 | // $Log:$ 51 | // 52 | //----------------------------------------------------------------------------- 53 | -------------------------------------------------------------------------------- /linuxdoom-1.10/p_inter.h: -------------------------------------------------------------------------------- 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 | // DESCRIPTION: 18 | // 19 | // 20 | //----------------------------------------------------------------------------- 21 | 22 | 23 | #ifndef __P_INTER__ 24 | #define __P_INTER__ 25 | 26 | 27 | #ifdef __GNUG__ 28 | #pragma interface 29 | #endif 30 | 31 | 32 | boolean P_GivePower(player_t*, int); 33 | 34 | 35 | 36 | #endif 37 | //----------------------------------------------------------------------------- 38 | // 39 | // $Log:$ 40 | // 41 | //----------------------------------------------------------------------------- 42 | -------------------------------------------------------------------------------- /linuxdoom-1.10/p_pspr.h: -------------------------------------------------------------------------------- 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 | // DESCRIPTION: 18 | // Sprite animation. 19 | // 20 | //----------------------------------------------------------------------------- 21 | 22 | 23 | #ifndef __P_PSPR__ 24 | #define __P_PSPR__ 25 | 26 | // Basic data types. 27 | // Needs fixed point, and BAM angles. 28 | #include "m_fixed.h" 29 | #include "tables.h" 30 | 31 | 32 | // 33 | // Needs to include the precompiled 34 | // sprite animation tables. 35 | // Header generated by multigen utility. 36 | // This includes all the data for thing animation, 37 | // i.e. the Thing Atrributes table 38 | // and the Frame Sequence table. 39 | #include "info.h" 40 | 41 | #ifdef __GNUG__ 42 | #pragma interface 43 | #endif 44 | 45 | 46 | // 47 | // Frame flags: 48 | // handles maximum brightness (torches, muzzle flare, light sources) 49 | // 50 | #define FF_FULLBRIGHT 0x8000 // flag in thing->frame 51 | #define FF_FRAMEMASK 0x7fff 52 | 53 | 54 | 55 | // 56 | // Overlay psprites are scaled shapes 57 | // drawn directly on the view screen, 58 | // coordinates are given for a 320*200 view screen. 59 | // 60 | typedef enum 61 | { 62 | ps_weapon, 63 | ps_flash, 64 | NUMPSPRITES 65 | 66 | } psprnum_t; 67 | 68 | typedef struct 69 | { 70 | state_t* state; // a NULL state means not active 71 | int tics; 72 | fixed_t sx; 73 | fixed_t sy; 74 | 75 | } pspdef_t; 76 | 77 | #endif 78 | //----------------------------------------------------------------------------- 79 | // 80 | // $Log:$ 81 | // 82 | //----------------------------------------------------------------------------- 83 | -------------------------------------------------------------------------------- /linuxdoom-1.10/p_saveg.h: -------------------------------------------------------------------------------- 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 | // DESCRIPTION: 18 | // Savegame I/O, archiving, persistence. 19 | // 20 | //----------------------------------------------------------------------------- 21 | 22 | 23 | #ifndef __P_SAVEG__ 24 | #define __P_SAVEG__ 25 | 26 | 27 | #ifdef __GNUG__ 28 | #pragma interface 29 | #endif 30 | 31 | 32 | // Persistent storage/archiving. 33 | // These are the load / save game routines. 34 | void P_ArchivePlayers (void); 35 | void P_UnArchivePlayers (void); 36 | void P_ArchiveWorld (void); 37 | void P_UnArchiveWorld (void); 38 | void P_ArchiveThinkers (void); 39 | void P_UnArchiveThinkers (void); 40 | void P_ArchiveSpecials (void); 41 | void P_UnArchiveSpecials (void); 42 | 43 | extern byte* save_p; 44 | 45 | 46 | #endif 47 | //----------------------------------------------------------------------------- 48 | // 49 | // $Log:$ 50 | // 51 | //----------------------------------------------------------------------------- 52 | -------------------------------------------------------------------------------- /linuxdoom-1.10/p_setup.h: -------------------------------------------------------------------------------- 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 | // DESCRIPTION: 18 | // Setup a game, startup stuff. 19 | // 20 | //----------------------------------------------------------------------------- 21 | 22 | 23 | #ifndef __P_SETUP__ 24 | #define __P_SETUP__ 25 | 26 | 27 | #ifdef __GNUG__ 28 | #pragma interface 29 | #endif 30 | 31 | 32 | // NOT called by W_Ticker. Fixme. 33 | void 34 | P_SetupLevel 35 | ( int episode, 36 | int map, 37 | int playermask, 38 | skill_t skill); 39 | 40 | // Called by startup code. 41 | void P_Init (void); 42 | 43 | #endif 44 | //----------------------------------------------------------------------------- 45 | // 46 | // $Log:$ 47 | // 48 | //----------------------------------------------------------------------------- 49 | -------------------------------------------------------------------------------- /linuxdoom-1.10/p_telept.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 | // Teleportation. 21 | // 22 | //----------------------------------------------------------------------------- 23 | 24 | static const char 25 | rcsid[] = "$Id: p_telept.c,v 1.3 1997/01/28 22:08:29 b1 Exp $"; 26 | 27 | 28 | 29 | #include "doomdef.h" 30 | 31 | #include "s_sound.h" 32 | 33 | #include "p_local.h" 34 | 35 | 36 | // Data. 37 | #include "sounds.h" 38 | 39 | // State. 40 | #include "r_state.h" 41 | 42 | 43 | 44 | // 45 | // TELEPORTATION 46 | // 47 | int 48 | EV_Teleport 49 | ( line_t* line, 50 | int side, 51 | mobj_t* thing ) 52 | { 53 | int i; 54 | int tag; 55 | mobj_t* m; 56 | mobj_t* fog; 57 | unsigned an; 58 | thinker_t* thinker; 59 | sector_t* sector; 60 | fixed_t oldx; 61 | fixed_t oldy; 62 | fixed_t oldz; 63 | 64 | // don't teleport missiles 65 | if (thing->flags & MF_MISSILE) 66 | return 0; 67 | 68 | // Don't teleport if hit back of line, 69 | // so you can get out of teleporter. 70 | if (side == 1) 71 | return 0; 72 | 73 | 74 | tag = line->tag; 75 | for (i = 0; i < numsectors; i++) 76 | { 77 | if (sectors[ i ].tag == tag ) 78 | { 79 | thinker = thinkercap.next; 80 | for (thinker = thinkercap.next; 81 | thinker != &thinkercap; 82 | thinker = thinker->next) 83 | { 84 | // not a mobj 85 | if (thinker->function.acp1 != (actionf_p1)P_MobjThinker) 86 | continue; 87 | 88 | m = (mobj_t *)thinker; 89 | 90 | // not a teleportman 91 | if (m->type != MT_TELEPORTMAN ) 92 | continue; 93 | 94 | sector = m->subsector->sector; 95 | // wrong sector 96 | if (sector-sectors != i ) 97 | continue; 98 | 99 | oldx = thing->x; 100 | oldy = thing->y; 101 | oldz = thing->z; 102 | 103 | if (!P_TeleportMove (thing, m->x, m->y)) 104 | return 0; 105 | 106 | thing->z = thing->floorz; //fixme: not needed? 107 | if (thing->player) 108 | thing->player->viewz = thing->z+thing->player->viewheight; 109 | 110 | // spawn teleport fog at source and destination 111 | fog = P_SpawnMobj (oldx, oldy, oldz, MT_TFOG); 112 | S_StartSound (fog, sfx_telept); 113 | an = m->angle >> ANGLETOFINESHIFT; 114 | fog = P_SpawnMobj (m->x+20*finecosine[an], m->y+20*finesine[an] 115 | , thing->z, MT_TFOG); 116 | 117 | // emit sound, where? 118 | S_StartSound (fog, sfx_telept); 119 | 120 | // don't move for a bit 121 | if (thing->player) 122 | thing->reactiontime = 18; 123 | 124 | thing->angle = m->angle; 125 | thing->momx = thing->momy = thing->momz = 0; 126 | return 1; 127 | } 128 | } 129 | } 130 | return 0; 131 | } 132 | 133 | -------------------------------------------------------------------------------- /linuxdoom-1.10/p_tick.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 | // Archiving: SaveGame I/O. 21 | // Thinker, Ticker. 22 | // 23 | //----------------------------------------------------------------------------- 24 | 25 | static const char 26 | rcsid[] = "$Id: p_tick.c,v 1.4 1997/02/03 16:47:55 b1 Exp $"; 27 | 28 | #include "z_zone.h" 29 | #include "p_local.h" 30 | 31 | #include "doomstat.h" 32 | 33 | 34 | int leveltime; 35 | 36 | // 37 | // THINKERS 38 | // All thinkers should be allocated by Z_Malloc 39 | // so they can be operated on uniformly. 40 | // The actual structures will vary in size, 41 | // but the first element must be thinker_t. 42 | // 43 | 44 | 45 | 46 | // Both the head and tail of the thinker list. 47 | thinker_t thinkercap; 48 | 49 | 50 | // 51 | // P_InitThinkers 52 | // 53 | void P_InitThinkers (void) 54 | { 55 | thinkercap.prev = thinkercap.next = &thinkercap; 56 | } 57 | 58 | 59 | 60 | 61 | // 62 | // P_AddThinker 63 | // Adds a new thinker at the end of the list. 64 | // 65 | void P_AddThinker (thinker_t* thinker) 66 | { 67 | thinkercap.prev->next = thinker; 68 | thinker->next = &thinkercap; 69 | thinker->prev = thinkercap.prev; 70 | thinkercap.prev = thinker; 71 | } 72 | 73 | 74 | 75 | // 76 | // P_RemoveThinker 77 | // Deallocation is lazy -- it will not actually be freed 78 | // until its thinking turn comes up. 79 | // 80 | void P_RemoveThinker (thinker_t* thinker) 81 | { 82 | // FIXME: NOP. 83 | thinker->function.acv = (actionf_v)(-1); 84 | } 85 | 86 | 87 | 88 | // 89 | // P_AllocateThinker 90 | // Allocates memory and adds a new thinker at the end of the list. 91 | // 92 | void P_AllocateThinker (thinker_t* thinker) 93 | { 94 | } 95 | 96 | 97 | 98 | // 99 | // P_RunThinkers 100 | // 101 | void P_RunThinkers (void) 102 | { 103 | thinker_t* currentthinker; 104 | 105 | currentthinker = thinkercap.next; 106 | while (currentthinker != &thinkercap) 107 | { 108 | if ( currentthinker->function.acv == (actionf_v)(-1) ) 109 | { 110 | // time to remove it 111 | currentthinker->next->prev = currentthinker->prev; 112 | currentthinker->prev->next = currentthinker->next; 113 | Z_Free (currentthinker); 114 | } 115 | else 116 | { 117 | if (currentthinker->function.acp1) 118 | currentthinker->function.acp1 (currentthinker); 119 | } 120 | currentthinker = currentthinker->next; 121 | } 122 | } 123 | 124 | 125 | 126 | // 127 | // P_Ticker 128 | // 129 | 130 | void P_Ticker (void) 131 | { 132 | int i; 133 | 134 | // run the tic 135 | if (paused) 136 | return; 137 | 138 | // pause if in menu and at least one tic has been run 139 | if ( !netgame 140 | && menuactive 141 | && !demoplayback 142 | && players[consoleplayer].viewz != 1) 143 | { 144 | return; 145 | } 146 | 147 | 148 | for (i=0 ; i 56 | // using from sounds.h 57 | // 58 | void 59 | S_StartSound 60 | ( void* origin, 61 | int sound_id ); 62 | 63 | 64 | 65 | // Will start a sound at a given volume. 66 | void 67 | S_StartSoundAtVolume 68 | ( void* origin, 69 | int sound_id, 70 | int volume ); 71 | 72 | 73 | // Stop sound for thing at 74 | void S_StopSound(void* origin); 75 | 76 | 77 | // Start music using from sounds.h 78 | void S_StartMusic(int music_id); 79 | 80 | // Start music using from sounds.h, 81 | // and set whether looping 82 | void 83 | S_ChangeMusic 84 | ( int music_id, 85 | int looping ); 86 | 87 | // Stops the music fer sure. 88 | void S_StopMusic(void); 89 | 90 | // Stop and resume music, during game PAUSE. 91 | void S_PauseSound(void); 92 | void S_ResumeSound(void); 93 | 94 | 95 | // 96 | // Updates music & sounds 97 | // 98 | void S_UpdateSounds(void* listener); 99 | 100 | void S_SetMusicVolume(int volume); 101 | void S_SetSfxVolume(int volume); 102 | 103 | 104 | #endif 105 | //----------------------------------------------------------------------------- 106 | // 107 | // $Log:$ 108 | // 109 | //----------------------------------------------------------------------------- 110 | -------------------------------------------------------------------------------- /linuxdoom-1.10/st_lib.h: -------------------------------------------------------------------------------- 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 | // DESCRIPTION: 18 | // The status bar widget code. 19 | // 20 | //----------------------------------------------------------------------------- 21 | 22 | #ifndef __STLIB__ 23 | #define __STLIB__ 24 | 25 | 26 | // We are referring to patches. 27 | #include "r_defs.h" 28 | 29 | 30 | // 31 | // Background and foreground screen numbers 32 | // 33 | #define BG 4 34 | #define FG 0 35 | 36 | 37 | 38 | // 39 | // Typedefs of widgets 40 | // 41 | 42 | // Number widget 43 | 44 | typedef struct 45 | { 46 | // upper right-hand corner 47 | // of the number (right-justified) 48 | int x; 49 | int y; 50 | 51 | // max # of digits in number 52 | int width; 53 | 54 | // last number value 55 | int oldnum; 56 | 57 | // pointer to current value 58 | int* num; 59 | 60 | // pointer to boolean stating 61 | // whether to update number 62 | boolean* on; 63 | 64 | // list of patches for 0-9 65 | patch_t** p; 66 | 67 | // user data 68 | int data; 69 | 70 | } st_number_t; 71 | 72 | 73 | 74 | // Percent widget ("child" of number widget, 75 | // or, more precisely, contains a number widget.) 76 | typedef struct 77 | { 78 | // number information 79 | st_number_t n; 80 | 81 | // percent sign graphic 82 | patch_t* p; 83 | 84 | } st_percent_t; 85 | 86 | 87 | 88 | // Multiple Icon widget 89 | typedef struct 90 | { 91 | // center-justified location of icons 92 | int x; 93 | int y; 94 | 95 | // last icon number 96 | int oldinum; 97 | 98 | // pointer to current icon 99 | int* inum; 100 | 101 | // pointer to boolean stating 102 | // whether to update icon 103 | boolean* on; 104 | 105 | // list of icons 106 | patch_t** p; 107 | 108 | // user data 109 | int data; 110 | 111 | } st_multicon_t; 112 | 113 | 114 | 115 | 116 | // Binary Icon widget 117 | 118 | typedef struct 119 | { 120 | // center-justified location of icon 121 | int x; 122 | int y; 123 | 124 | // last icon value 125 | int oldval; 126 | 127 | // pointer to current icon status 128 | boolean* val; 129 | 130 | // pointer to boolean 131 | // stating whether to update icon 132 | boolean* on; 133 | 134 | 135 | patch_t* p; // icon 136 | int data; // user data 137 | 138 | } st_binicon_t; 139 | 140 | 141 | 142 | // 143 | // Widget creation, access, and update routines 144 | // 145 | 146 | // Initializes widget library. 147 | // More precisely, initialize STMINUS, 148 | // everything else is done somewhere else. 149 | // 150 | void STlib_init(void); 151 | 152 | 153 | 154 | // Number widget routines 155 | void 156 | STlib_initNum 157 | ( st_number_t* n, 158 | int x, 159 | int y, 160 | patch_t** pl, 161 | int* num, 162 | boolean* on, 163 | int width ); 164 | 165 | void 166 | STlib_updateNum 167 | ( st_number_t* n, 168 | boolean refresh ); 169 | 170 | 171 | // Percent widget routines 172 | void 173 | STlib_initPercent 174 | ( st_percent_t* p, 175 | int x, 176 | int y, 177 | patch_t** pl, 178 | int* num, 179 | boolean* on, 180 | patch_t* percent ); 181 | 182 | 183 | void 184 | STlib_updatePercent 185 | ( st_percent_t* per, 186 | int refresh ); 187 | 188 | 189 | // Multiple Icon widget routines 190 | void 191 | STlib_initMultIcon 192 | ( st_multicon_t* mi, 193 | int x, 194 | int y, 195 | patch_t** il, 196 | int* inum, 197 | boolean* on ); 198 | 199 | 200 | void 201 | STlib_updateMultIcon 202 | ( st_multicon_t* mi, 203 | boolean refresh ); 204 | 205 | // Binary Icon widget routines 206 | 207 | void 208 | STlib_initBinIcon 209 | ( st_binicon_t* b, 210 | int x, 211 | int y, 212 | patch_t* i, 213 | boolean* val, 214 | boolean* on ); 215 | 216 | void 217 | STlib_updateBinIcon 218 | ( st_binicon_t* bi, 219 | boolean refresh ); 220 | 221 | #endif 222 | //----------------------------------------------------------------------------- 223 | // 224 | // $Log:$ 225 | // 226 | //----------------------------------------------------------------------------- 227 | -------------------------------------------------------------------------------- /linuxdoom-1.10/st_stuff.h: -------------------------------------------------------------------------------- 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 | // DESCRIPTION: 18 | // Status bar code. 19 | // Does the face/direction indicator animatin. 20 | // Does palette indicators as well (red pain/berserk, bright pickup) 21 | // 22 | //----------------------------------------------------------------------------- 23 | 24 | #ifndef __STSTUFF_H__ 25 | #define __STSTUFF_H__ 26 | 27 | #include "doomtype.h" 28 | #include "d_event.h" 29 | 30 | // Size of statusbar. 31 | // Now sensitive for scaling. 32 | #define ST_HEIGHT 32*SCREEN_MUL 33 | #define ST_WIDTH SCREENWIDTH 34 | #define ST_Y (SCREENHEIGHT - ST_HEIGHT) 35 | 36 | 37 | // 38 | // STATUS BAR 39 | // 40 | 41 | // Called by main loop. 42 | boolean ST_Responder (event_t* ev); 43 | 44 | // Called by main loop. 45 | void ST_Ticker (void); 46 | 47 | // Called by main loop. 48 | void ST_Drawer (boolean fullscreen, boolean refresh); 49 | 50 | // Called when the console player is spawned on each level. 51 | void ST_Start (void); 52 | 53 | // Called by startup code. 54 | void ST_Init (void); 55 | 56 | 57 | 58 | // States for status bar code. 59 | typedef enum 60 | { 61 | AutomapState, 62 | FirstPersonState 63 | 64 | } st_stateenum_t; 65 | 66 | 67 | // States for the chat code. 68 | typedef enum 69 | { 70 | StartChatState, 71 | WaitDestState, 72 | GetChatState 73 | 74 | } st_chatstateenum_t; 75 | 76 | 77 | boolean ST_Responder(event_t* ev); 78 | 79 | 80 | 81 | #endif 82 | //----------------------------------------------------------------------------- 83 | // 84 | // $Log:$ 85 | // 86 | //----------------------------------------------------------------------------- 87 | -------------------------------------------------------------------------------- /linuxdoom-1.10/tables.h: -------------------------------------------------------------------------------- 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 | // DESCRIPTION: 18 | // Lookup tables. 19 | // Do not try to look them up :-). 20 | // In the order of appearance: 21 | // 22 | // int finetangent[4096] - Tangens LUT. 23 | // Should work with BAM fairly well (12 of 16bit, 24 | // effectively, by shifting). 25 | // 26 | // int finesine[10240] - Sine lookup. 27 | // Guess what, serves as cosine, too. 28 | // Remarkable thing is, how to use BAMs with this? 29 | // 30 | // int tantoangle[2049] - ArcTan LUT, 31 | // maps tan(angle) to angle fast. Gotta search. 32 | // 33 | //----------------------------------------------------------------------------- 34 | 35 | 36 | #ifndef __TABLES__ 37 | #define __TABLES__ 38 | 39 | 40 | 41 | #ifdef LINUX 42 | #include 43 | #else 44 | #define PI 3.141592657 45 | #endif 46 | 47 | 48 | #include "m_fixed.h" 49 | 50 | #define FINEANGLES 8192 51 | #define FINEMASK (FINEANGLES-1) 52 | 53 | 54 | // 0x100000000 to 0x2000 55 | #define ANGLETOFINESHIFT 19 56 | 57 | // Effective size is 10240. 58 | extern fixed_t finesine[5*FINEANGLES/4]; 59 | 60 | // Re-use data, is just PI/2 pahse shift. 61 | extern fixed_t* finecosine; 62 | 63 | 64 | // Effective size is 4096. 65 | extern fixed_t finetangent[FINEANGLES/2]; 66 | 67 | // Binary Angle Measument, BAM. 68 | #define ANG45 0x20000000 69 | #define ANG90 0x40000000 70 | #define ANG180 0x80000000 71 | #define ANG270 0xc0000000 72 | 73 | 74 | #define SLOPERANGE 2048 75 | #define SLOPEBITS 11 76 | #define DBITS (FRACBITS-SLOPEBITS) 77 | 78 | typedef unsigned angle_t; 79 | 80 | 81 | // Effective size is 2049; 82 | // The +1 size is to handle the case when x==y 83 | // without additional checking. 84 | extern angle_t tantoangle[SLOPERANGE+1]; 85 | 86 | 87 | // Utility function, 88 | // called by R_PointToAngle. 89 | int 90 | SlopeDiv 91 | ( unsigned num, 92 | unsigned den); 93 | 94 | 95 | #endif 96 | //----------------------------------------------------------------------------- 97 | // 98 | // $Log:$ 99 | // 100 | //----------------------------------------------------------------------------- 101 | -------------------------------------------------------------------------------- /linuxdoom-1.10/tools/Makefile: -------------------------------------------------------------------------------- 1 | 2 | CC = gcc 3 | CFLAGS = -I. -Wall -std=c99 4 | 5 | WAD_TOOL = wad 6 | WAD_TOOL_OBJS = wad.o wadtool.o 7 | 8 | TEXDUMP_TOOL = texdump 9 | TEXDUMP_OBJS = wad.o texdump.o 10 | 11 | all: Makefile $(WAD_TOOL) $(TEXDUMP_TOOL) 12 | 13 | $(WAD_TOOL): Makefile $(WAD_TOOL_OBJS) 14 | $(CC) $(CFLAGS) $(LDFLAGS) $(WAD_TOOL_OBJS) -o $(WAD_TOOL) 15 | 16 | 17 | $(TEXDUMP_TOOL): Makefile $(TEXDUMP_OBJS) 18 | $(CC) $(CFLAGS) $(LDFLAGS) $(TEXDUMP_OBJS) -o $(TEXDUMP_TOOL) 19 | 20 | clean: 21 | rm -f *.o *~ 22 | rm -f $(WAD_TOOL) 23 | rm -f $(TEXDUMP_TOOL) 24 | 25 | %.o: %.c 26 | $(CC) $(CFLAGS) -c $< -o $@ 27 | 28 | 29 | 30 | -------------------------------------------------------------------------------- /linuxdoom-1.10/tools/wad.h: -------------------------------------------------------------------------------- 1 | /* 2 | * ===================================================================================== 3 | * 4 | * Filename: wad.h 5 | * 6 | * Description: 7 | * 8 | * Version: 1.0 9 | * Created: 10/06/2013 18:34:05 10 | * Revision: none 11 | * Compiler: gcc 12 | * 13 | * Author: YOUR NAME (), 14 | * Company: 15 | * 16 | * ===================================================================================== 17 | */ 18 | 19 | #ifndef EFI_DOOM_TOOLS_WAD_H 20 | #define EFI_DOOM_TOOLS_WAD_H 21 | 22 | #include 23 | 24 | //////////////////////////////////////////////////////////////////////////// 25 | 26 | // File structures 27 | 28 | #define WAD_ID_SIZE 4 29 | #define WAD_LUMP_NAME_SIZE 8 30 | 31 | typedef struct 32 | { 33 | char id[WAD_ID_SIZE]; 34 | uint32_t numlumps; 35 | uint32_t offset; 36 | } wad_info; 37 | 38 | typedef struct 39 | { 40 | uint32_t fileoff; 41 | uint32_t size; 42 | char name[WAD_LUMP_NAME_SIZE]; 43 | } lump_info; 44 | 45 | // Runtime structures 46 | 47 | typedef struct 48 | { 49 | int fd; // File descriptor 50 | uint32_t numlumps; // Total lumps in this WAD file 51 | uint32_t offset; 52 | lump_info* lumpTable; // Cached table of lump info structured 53 | } wad_file; 54 | 55 | typedef struct 56 | { 57 | char name[WAD_LUMP_NAME_SIZE + 1]; // Name, +1 for extra 0 byte 58 | int num; // Lump number in WAD file 59 | void* data; // Data 60 | uint32_t size; // Data size 61 | } lump_t; 62 | 63 | //////////////////////////////////////////////////////////////////////////// 64 | 65 | #ifdef __cplusplus 66 | extern "C" { 67 | #endif 68 | 69 | // Load and parse WAD file. 70 | int LoadWadFile(const char* path, wad_file* outFile); 71 | 72 | // Check that there is a lump with this name in wad file and get its info initialized on success 73 | int CheckLumpName(const wad_file* wad, const char* lumpName, lump_info* outLump); 74 | int CheckLumpNum(const wad_file* wad, int num, lump_info* outLump); 75 | 76 | // Return a lump number with a given name. 77 | // Returns either a positive lump number or a negative error code 78 | int GetLumpNumberByName(const wad_file* wad, const char* name); 79 | 80 | // Load lump data by its name, caller has to free returned buffer 81 | int LoadLump(const wad_file* wad, const lump_info* lump, lump_t* outLump); 82 | int LoadLumpName(const wad_file* wad, const char* lumpName, lump_t* outLump); 83 | int LoadLumpNum(const wad_file* wad, int lumpNum, lump_t* outLump); 84 | 85 | void FreeLump(lump_t* lump); 86 | 87 | // Close wad file handle 88 | void CloseWadFile(wad_file* wad); 89 | 90 | #ifdef __cplusplus 91 | } 92 | #endif 93 | 94 | //////////////////////////////////////////////////////////////////////////// 95 | 96 | #endif // EFI_DOOM_TOOLS_WAD_H 97 | 98 | -------------------------------------------------------------------------------- /linuxdoom-1.10/tools/wadtool.c: -------------------------------------------------------------------------------- 1 | /* 2 | * ===================================================================================== 3 | * 4 | * Filename: wadtool.c 5 | * 6 | * Description: 7 | * 8 | * Version: 1.0 9 | * Created: 10/06/2013 18:57:46 10 | * Revision: none 11 | * Compiler: gcc 12 | * 13 | * Author: YOUR NAME (), 14 | * Company: 15 | * 16 | * ===================================================================================== 17 | */ 18 | 19 | #include "wad.h" 20 | 21 | #include 22 | #include 23 | #include 24 | #include 25 | #include 26 | #include 27 | #include 28 | #include 29 | 30 | //////////////////////////////////////////////////////////////////////////// 31 | 32 | static void usage(void) 33 | { 34 | printf("wad info \n"); 35 | printf("wad dump \n"); 36 | printf("wad unpack \n"); 37 | } 38 | 39 | // wad info 40 | static int DoInfo(int argc, char** argv) 41 | { 42 | assert (0 == strcmp(argv[0], "info")); 43 | 44 | if (argc != 2) 45 | { 46 | usage(); 47 | return EXIT_FAILURE; 48 | } 49 | 50 | const char* wadPath = argv[1]; 51 | 52 | wad_file wad; 53 | int error = LoadWadFile(wadPath, &wad); 54 | if (error) 55 | { 56 | printf("Failed opening wad file %s: %s\n", wadPath, strerror(error)); 57 | return error; 58 | } 59 | 60 | printf("\nWAD file %s:\n", wadPath); 61 | printf("> total lumps = %d\n", wad.numlumps); 62 | printf("> lump table offset = %d\n", wad.offset); 63 | 64 | printf("\nLumps info:\n"); 65 | 66 | for (unsigned i = 0; i < wad.numlumps; ++i) 67 | { 68 | lump_info lump; 69 | error = CheckLumpNum(&wad, i, &lump); 70 | if (error) 71 | { 72 | printf("Failed reading lump %d: %s\n", i, strerror(error)); 73 | return error; 74 | } 75 | 76 | char namebuf[sizeof(lump.name) + 1] = {0}; 77 | memcpy(namebuf, lump.name, sizeof(lump.name)); 78 | 79 | printf("> %8s: offset %d, size %d\n", namebuf, lump.fileoff, lump.size); 80 | } 81 | 82 | CloseWadFile(&wad); 83 | return EXIT_SUCCESS; 84 | } 85 | 86 | // wad dump 87 | static int DoDump(int argc, char** argv) 88 | { 89 | assert (0 == strcmp(argv[0], "dump")); 90 | 91 | if (argc != 3) 92 | { 93 | usage(); 94 | return EXIT_FAILURE; 95 | } 96 | 97 | const char* lumpName = argv[2]; 98 | const char* wadPath = argv[1]; 99 | 100 | wad_file wad; 101 | int error = LoadWadFile(wadPath, &wad); 102 | if (error) 103 | { 104 | printf("Failed opening wad file %s: %s\n", wadPath, strerror(error)); 105 | return error; 106 | } 107 | 108 | lump_t lump; 109 | error = LoadLumpName(&wad, lumpName, &lump); 110 | if (error) 111 | { 112 | printf("Could not find lump name %s\n", lumpName); 113 | return error; 114 | } 115 | 116 | for (size_t j = 0; j < lump.size; ++j) 117 | { 118 | if (0 == (j % 32)) 119 | { 120 | printf("\n"); 121 | } 122 | 123 | printf("%02x ", ((uint8_t*)lump.data)[j]); 124 | } 125 | 126 | printf("\n"); 127 | 128 | FreeLump(&lump); 129 | CloseWadFile(&wad); 130 | 131 | return 0; 132 | } 133 | 134 | static int DoUnpack(int argc, char** argv) 135 | { 136 | assert (0 == strcmp(argv[0], "unpack")); 137 | 138 | if (argc != 3) 139 | { 140 | usage(); 141 | return EXIT_FAILURE; 142 | } 143 | 144 | const char* wadPath = argv[1]; 145 | const char* dirPath = argv[2]; 146 | 147 | wad_file wad; 148 | int error = LoadWadFile(wadPath, &wad); 149 | if (error) 150 | { 151 | printf("Failed opening wad file %s: %s\n", wadPath, strerror(error)); 152 | return error; 153 | } 154 | 155 | // Dump all lumps into files in a folder 156 | for (unsigned i = 0; i < wad.numlumps; ++i) 157 | { 158 | lump_t lump; 159 | error = LoadLumpNum(&wad, i, &lump); 160 | if (error) 161 | { 162 | printf("Could not load lump %d\n", i); 163 | return error; 164 | } 165 | 166 | char pathbuf[1024] = {0}; 167 | snprintf(pathbuf, sizeof(pathbuf) - 1, "%s/%s", dirPath, lump.name); 168 | 169 | // some lumps have the same name, so append 170 | int lump_fd = open(pathbuf, O_RDWR | O_CREAT | O_APPEND, S_IRWXU); 171 | if (lump_fd < 0) 172 | { 173 | printf("Failed to create lump dump file %s: %s\n", pathbuf, strerror(errno)); 174 | return errno; 175 | } 176 | 177 | if (lump.size != write(lump_fd, lump.data, lump.size)) 178 | { 179 | printf("Failed writing lump data: %s\n", strerror(errno)); 180 | return errno; 181 | } 182 | 183 | close(lump_fd); 184 | FreeLump(&lump); 185 | } 186 | 187 | CloseWadFile(&wad); 188 | return 0; 189 | } 190 | 191 | 192 | int main(int argc, char** argv) 193 | { 194 | if (argc < 2) 195 | { 196 | printf("wad: not enough arguments\n"); 197 | usage(); 198 | return EXIT_FAILURE; 199 | } 200 | 201 | const char* command = argv[1]; 202 | ++argv; 203 | --argc; 204 | 205 | if (0 == strcmp(command, "info")) 206 | { 207 | return DoInfo(argc, argv); 208 | } 209 | else if (0 == strcmp(command, "dump")) 210 | { 211 | return DoDump(argc, argv); 212 | } 213 | else if (0 == strcmp(command, "unpack")) 214 | { 215 | return DoUnpack(argc, argv); 216 | } 217 | else 218 | { 219 | usage(); 220 | return EXIT_FAILURE; 221 | } 222 | } 223 | 224 | -------------------------------------------------------------------------------- /linuxdoom-1.10/v_video.h: -------------------------------------------------------------------------------- 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 | // DESCRIPTION: 18 | // Gamma correction LUT. 19 | // Functions to draw patches (by post) directly to screen. 20 | // Functions to blit a block to the screen. 21 | // 22 | //----------------------------------------------------------------------------- 23 | 24 | 25 | #ifndef __V_VIDEO__ 26 | #define __V_VIDEO__ 27 | 28 | #include "doomtype.h" 29 | 30 | #include "doomdef.h" 31 | 32 | // Needed because we are refering to patches. 33 | #include "r_data.h" 34 | 35 | // 36 | // VIDEO 37 | // 38 | 39 | #define CENTERY (SCREENHEIGHT/2) 40 | 41 | 42 | // Screen 0 is the screen updated by I_Update screen. 43 | // Screen 1 is an extra buffer. 44 | 45 | 46 | 47 | extern byte* screens[5]; 48 | 49 | extern int dirtybox[4]; 50 | 51 | extern byte gammatable[5][256]; 52 | extern int usegamma; 53 | 54 | 55 | 56 | // Allocates buffer screens, call before R_Init. 57 | void V_Init (void); 58 | 59 | 60 | void 61 | V_CopyRect 62 | ( int srcx, 63 | int srcy, 64 | int srcscrn, 65 | int width, 66 | int height, 67 | int destx, 68 | int desty, 69 | int destscrn ); 70 | 71 | void 72 | V_DrawPatch 73 | ( int x, 74 | int y, 75 | int scrn, 76 | patch_t* patch); 77 | 78 | void 79 | V_DrawPatchDirect 80 | ( int x, 81 | int y, 82 | int scrn, 83 | patch_t* patch ); 84 | 85 | 86 | // Draw a linear block of pixels into the view buffer. 87 | void 88 | V_DrawBlock 89 | ( int x, 90 | int y, 91 | int scrn, 92 | int width, 93 | int height, 94 | byte* src ); 95 | 96 | // Reads a linear block of pixels into the view buffer. 97 | void 98 | V_GetBlock 99 | ( int x, 100 | int y, 101 | int scrn, 102 | int width, 103 | int height, 104 | byte* dest ); 105 | 106 | 107 | void 108 | V_MarkRect 109 | ( int x, 110 | int y, 111 | int width, 112 | int height ); 113 | 114 | #endif 115 | //----------------------------------------------------------------------------- 116 | // 117 | // $Log:$ 118 | // 119 | //----------------------------------------------------------------------------- 120 | -------------------------------------------------------------------------------- /linuxdoom-1.10/w_wad.h: -------------------------------------------------------------------------------- 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 | // DESCRIPTION: 18 | // WAD I/O functions. 19 | // 20 | //----------------------------------------------------------------------------- 21 | 22 | 23 | #ifndef __W_WAD__ 24 | #define __W_WAD__ 25 | 26 | 27 | #ifdef __GNUG__ 28 | #pragma interface 29 | #endif 30 | 31 | 32 | // 33 | // TYPES 34 | // 35 | typedef struct 36 | { 37 | // Should be "IWAD" or "PWAD". 38 | char identification[4]; 39 | int numlumps; 40 | int infotableofs; 41 | 42 | } wadinfo_t; 43 | 44 | 45 | typedef struct 46 | { 47 | int filepos; 48 | int size; 49 | char name[8]; 50 | 51 | } filelump_t; 52 | 53 | // 54 | // WADFILE I/O related stuff. 55 | // 56 | typedef struct 57 | { 58 | char name[8]; 59 | int handle; 60 | int position; 61 | int size; 62 | } lumpinfo_t; 63 | 64 | 65 | extern void** lumpcache; 66 | extern lumpinfo_t* lumpinfo; 67 | extern int numlumps; 68 | 69 | void W_InitMultipleFiles (char** filenames); 70 | void W_Reload (void); 71 | 72 | int W_CheckNumForName (char* name); 73 | int W_GetNumForName (char* name); 74 | 75 | int W_LumpLength (int lump); 76 | void W_ReadLump (int lump, void *dest); 77 | 78 | void* W_CacheLumpNum (int lump, int tag); 79 | void* W_CacheLumpName (char* name, int tag); 80 | 81 | 82 | 83 | 84 | #endif 85 | //----------------------------------------------------------------------------- 86 | // 87 | // $Log:$ 88 | // 89 | //----------------------------------------------------------------------------- 90 | -------------------------------------------------------------------------------- /linuxdoom-1.10/wi_stuff.h: -------------------------------------------------------------------------------- 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 | // DESCRIPTION: 18 | // Intermission. 19 | // 20 | //----------------------------------------------------------------------------- 21 | 22 | #ifndef __WI_STUFF__ 23 | #define __WI_STUFF__ 24 | 25 | //#include "v_video.h" 26 | 27 | #include "doomdef.h" 28 | 29 | // States for the intermission 30 | 31 | typedef enum 32 | { 33 | NoState = -1, 34 | StatCount, 35 | ShowNextLoc 36 | 37 | } stateenum_t; 38 | 39 | // Called by main loop, animate the intermission. 40 | void WI_Ticker (void); 41 | 42 | // Called by main loop, 43 | // draws the intermission directly into the screen buffer. 44 | void WI_Drawer (void); 45 | 46 | // Setup for an intermission screen. 47 | void WI_Start(wbstartstruct_t* wbstartstruct); 48 | 49 | #endif 50 | //----------------------------------------------------------------------------- 51 | // 52 | // $Log:$ 53 | // 54 | //----------------------------------------------------------------------------- 55 | -------------------------------------------------------------------------------- /linuxdoom-1.10/z_zone.h: -------------------------------------------------------------------------------- 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 | // DESCRIPTION: 18 | // Zone Memory Allocation, perhaps NeXT ObjectiveC inspired. 19 | // Remark: this was the only stuff that, according 20 | // to John Carmack, might have been useful for 21 | // Quake. 22 | // 23 | //--------------------------------------------------------------------- 24 | 25 | 26 | 27 | #ifndef __Z_ZONE__ 28 | #define __Z_ZONE__ 29 | 30 | #include 31 | 32 | // 33 | // ZONE MEMORY 34 | // PU - purge tags. 35 | // Tags < 100 are not overwritten until freed. 36 | #define PU_STATIC 1 // static entire execution time 37 | #define PU_SOUND 2 // static while playing 38 | #define PU_MUSIC 3 // static while playing 39 | #define PU_DAVE 4 // anything else Dave wants static 40 | #define PU_LEVEL 50 // static until level exited 41 | #define PU_LEVSPEC 51 // a special thinker in a level 42 | // Tags >= 100 are purgable whenever needed. 43 | #define PU_PURGELEVEL 100 44 | #define PU_CACHE 101 45 | 46 | 47 | void Z_Init (void); 48 | void* _Z_Malloc (int size, int tag, void *ptr); 49 | void _Z_Free (void *ptr); 50 | void Z_FreeTags (int lowtag, int hightag); 51 | void Z_DumpHeap (int lowtag, int hightag); 52 | void Z_FileDumpHeap (FILE *f); 53 | void Z_CheckHeap (void); 54 | void Z_ChangeTag2 (void *ptr, int tag); 55 | int Z_FreeMemory (void); 56 | 57 | 58 | typedef struct memblock_s 59 | { 60 | int size; // including the header and possibly tiny fragments 61 | void** user; // NULL if a free block 62 | int tag; // purgelevel 63 | int id; // should be ZONEID 64 | struct memblock_s* next; 65 | struct memblock_s* prev; 66 | } memblock_t; 67 | 68 | // 69 | // This is used to get the local FILE:LINE info from CPP 70 | // prior to really call the function in question. 71 | // 72 | #define Z_ChangeTag(p,t) \ 73 | { \ 74 | if (( (memblock_t *)( (byte *)(p) - sizeof(memblock_t)))->id!=0x1d4a11) \ 75 | I_Error("Z_CT at "__FILE__":%i",__LINE__); \ 76 | Z_ChangeTag2(p,t); \ 77 | } \ 78 | 79 | //#define Z_DEBUG 80 | 81 | #ifdef Z_DEBUG 82 | #include 83 | 84 | void Z_FreeDebug(void* ptr, const char* file, int line); 85 | void* Z_MallocDebug(int size, int tag, void* ptr, const char* file, int line); 86 | 87 | #define Z_Free(_ptr_) Z_FreeDebug((_ptr_), __FILE__, __LINE__) 88 | #define Z_Malloc(_size_, _tag_, _ptr_) Z_MallocDebug((_size_), (_tag_), (_ptr_), __FILE__, __LINE__) 89 | 90 | #else 91 | 92 | #define Z_Free(_ptr_) _Z_Free((_ptr_)) 93 | #define Z_Malloc(_size_, _tag_, _ptr_) _Z_Malloc((_size_), (_tag_), (_ptr_)) 94 | 95 | #endif 96 | 97 | #endif 98 | //----------------------------------------------------------------------------- 99 | // 100 | // $Log:$ 101 | // 102 | //----------------------------------------------------------------------------- 103 | -------------------------------------------------------------------------------- /sersrc/DOOMNET.C: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | #include 6 | #include 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 2 | #include 3 | #include 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | #include 10 | #include 11 | #include 12 | 13 | 14 | #define INPUT(port) inportb(port) 15 | #define OUTPUT(port,data) outportb(port,data) 16 | #define CLI() disable() 17 | #define STI() enable() 18 | 19 | 20 | typedef enum {false, true} boolean; 21 | typedef unsigned char byte; 22 | 23 | 24 | #define TRANSMIT_HOLDING_REGISTER 0x00 25 | #define RECEIVE_BUFFER_REGISTER 0x00 26 | #define INTERRUPT_ENABLE_REGISTER 0x01 27 | #define IER_RX_DATA_READY 0x01 28 | #define IER_TX_HOLDING_REGISTER_EMPTY 0x02 29 | #define IER_LINE_STATUS 0x04 30 | #define IER_MODEM_STATUS 0x08 31 | #define INTERRUPT_ID_REGISTER 0x02 32 | #define IIR_MODEM_STATUS_INTERRUPT 0x00 33 | #define IIR_TX_HOLDING_REGISTER_INTERRUPT 0x02 34 | #define IIR_RX_DATA_READY_INTERRUPT 0x04 35 | #define IIR_LINE_STATUS_INTERRUPT 0x06 36 | #define FIFO_CONTROL_REGISTER 0x02 37 | #define FCR_FIFO_ENABLE 0x01 38 | #define FCR_RCVR_FIFO_RESET 0x02 39 | #define FCR_XMIT_FIFO_RESET 0x04 40 | #define FCR_RCVR_TRIGGER_LSB 0x40 41 | #define FCR_RCVR_TRIGGER_MSB 0x80 42 | #define FCR_TRIGGER_01 0x00 43 | #define FCR_TRIGGER_04 0x40 44 | #define FCR_TRIGGER_08 0x80 45 | #define FCR_TRIGGER_14 0xc0 46 | #define LINE_CONTROL_REGISTER 0x03 47 | #define LCR_WORD_LENGTH_MASK 0x03 48 | #define LCR_WORD_LENGTH_SELECT_0 0x01 49 | #define LCR_WORD_LENGTH_SELECT_1 0x02 50 | #define LCR_STOP_BITS 0x04 51 | #define LCR_PARITY_MASK 0x38 52 | #define LCR_PARITY_ENABLE 0x08 53 | #define LCR_EVEN_PARITY_SELECT 0x10 54 | #define LCR_STICK_PARITY 0x20 55 | #define LCR_SET_BREAK 0x40 56 | #define LCR_DLAB 0x80 57 | #define MODEM_CONTROL_REGISTER 0x04 58 | #define MCR_DTR 0x01 59 | #define MCR_RTS 0x02 60 | #define MCR_OUT1 0x04 61 | #define MCR_OUT2 0x08 62 | #define MCR_LOOPBACK 0x10 63 | #define LINE_STATUS_REGISTER 0x05 64 | #define LSR_DATA_READY 0x01 65 | #define LSR_OVERRUN_ERROR 0x02 66 | #define LSR_PARITY_ERROR 0x04 67 | #define LSR_FRAMING_ERROR 0x08 68 | #define LSR_BREAK_DETECT 0x10 69 | #define LSR_THRE 0x20 70 | #define MODEM_STATUS_REGISTER 0x06 71 | #define MSR_DELTA_CTS 0x01 72 | #define MSR_DELTA_DSR 0x02 73 | #define MSR_TERI 0x04 74 | #define MSR_DELTA_CD 0x08 75 | #define MSR_CTS 0x10 76 | #define MSR_DSR 0x20 77 | #define MSR_RI 0x40 78 | #define MSR_CD 0x80 79 | #define DIVISOR_LATCH_LOW 0x00 80 | #define DIVISOR_LATCH_HIGH 0x01 81 | 82 | 83 | 84 | #define QUESIZE 2048 85 | 86 | typedef struct 87 | { 88 | long head, tail; // bytes are put on head and pulled from tail 89 | unsigned char data[QUESIZE]; 90 | } que_t; 91 | 92 | void InitPort (void); 93 | void ShutdownPort (void); 94 | 95 | int read_byte( void ); 96 | void write_byte( int c ); 97 | 98 | 99 | void Error (char *error, ...); 100 | 101 | extern int argc; 102 | extern char **argv; 103 | -------------------------------------------------------------------------------- /sersrc/SERSTR.H: -------------------------------------------------------------------------------- 1 | #define STR_DROPDTR "Dropping DTR" 2 | #define STR_CLEANEXIT "Clean exit from SERSETUP" 3 | #define STR_ATTEMPT "Attempting to connect across serial link, press escape to abort." 4 | #define STR_NETABORT "Network game synchronization aborted." 5 | #define STR_DUPLICATE "Duplicate id string, try again or check modem init string." 6 | #define STR_MODEMCMD "Modem command : " 7 | #define STR_MODEMRESP "Modem response: " 8 | #define STR_RESPABORT "Modem response aborted." 9 | #define STR_CANTREAD "Couldn't read MODEM.CFG" 10 | #define STR_DIALING "Dialing..." 11 | #define STR_CONNECT "CONNECT" 12 | #define STR_WAITRING "Waiting for ring..." 13 | #define STR_RING "RING" 14 | #define STR_NORESP "No such response file!" 15 | #define STR_DOOMSERIAL "DOOM II SERIAL DEVICE DRIVER v1.4" 16 | #define STR_WARNING \ 17 | "Warning: no NULL or iret interrupt vectors were found in the 0x60 to 0x66\n"\ 18 | "range. You can specify a vector with the -vector 0x parameter.\n" 19 | #define STR_COMM "Communicating with interrupt vector 0x%x" 20 | #define STR_RETURNED "Returned from DOOM II" 21 | #define STR_PORTSET "Setting port to %lu baud" 22 | -------------------------------------------------------------------------------- /sersrc/SER_FRCH.H: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/the-eugen/DOOM/7ce9e63cd8e018be3d3e457cfbe66bc60e8f399d/sersrc/SER_FRCH.H -------------------------------------------------------------------------------- /sndserv/Makefile: -------------------------------------------------------------------------------- 1 | ########################################################## 2 | # 3 | # $Id:$ 4 | # 5 | # $Log:$ 6 | # 7 | # 8 | 9 | CC=gcc 10 | CFLAGS=-O -DNORMALUNIX -DLINUX 11 | LDFLAGS= 12 | LIBS=-lm 13 | 14 | O=linux 15 | 16 | all: $(O)/sndserver 17 | 18 | clean: 19 | rm -f *.o *~ *.flc 20 | rm -f linux/* 21 | 22 | # Target 23 | $(O)/sndserver: \ 24 | $(O)/soundsrv.o \ 25 | $(O)/sounds.o \ 26 | $(O)/wadread.o \ 27 | $(O)/linux.o 28 | $(CC) $(CFLAGS) $(LDFLAGS) \ 29 | $(O)/soundsrv.o \ 30 | $(O)/sounds.o \ 31 | $(O)/wadread.o \ 32 | $(O)/linux.o -o $(O)/sndserver $(LIBS) 33 | echo make complete. 34 | 35 | # Rule 36 | $(O)/%.o: %.c 37 | $(CC) $(CFLAGS) -c $< -o $@ 38 | 39 | 40 | -------------------------------------------------------------------------------- /sndserv/README.sndserv: -------------------------------------------------------------------------------- 1 | 2 | This is the soundserver as used by the original 3 | Linuxdoom release. I separated the source from 4 | the actual Linuxduum source. For various reasons 5 | the separate sound process seems to give the 6 | best results - both synchronous and timer driven 7 | output demonstrate glitches. These might either 8 | be timing issues, or introduced by the changes 9 | I made to the linux sound code while merging it 10 | back into the main tree. 11 | 12 | Note that neither John Carmack nor Dave Taylor 13 | are responsible for the current sound handling. 14 | 15 | -------------------------------------------------------------------------------- /sndserv/linux.c: -------------------------------------------------------------------------------- 1 | // Emacs style mode select -*- C++ -*- 2 | //----------------------------------------------------------------------------- 3 | // 4 | // $Id: linux.c,v 1.3 1997/01/26 07:45:01 b1 Exp $ 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 | // 18 | // $Log: linux.c,v $ 19 | // Revision 1.3 1997/01/26 07:45:01 b1 20 | // 2nd formatting run, fixed a few warnings as well. 21 | // 22 | // Revision 1.2 1997/01/21 19:00:01 b1 23 | // First formatting run: 24 | // using Emacs cc-mode.el indentation for C++ now. 25 | // 26 | // Revision 1.1 1997/01/19 17:22:45 b1 27 | // Initial check in DOOM sources as of Jan. 10th, 1997 28 | // 29 | // 30 | // DESCRIPTION: 31 | // UNIX, soundserver for Linux i386. 32 | // 33 | //----------------------------------------------------------------------------- 34 | 35 | static const char rcsid[] = "$Id: linux.c,v 1.3 1997/01/26 07:45:01 b1 Exp $"; 36 | 37 | 38 | #include 39 | #include 40 | #include 41 | #include 42 | 43 | #include 44 | 45 | #include "soundsrv.h" 46 | 47 | int audio_fd; 48 | 49 | void 50 | myioctl 51 | ( int fd, 52 | int command, 53 | int* arg ) 54 | { 55 | int rc; 56 | extern int errno; 57 | 58 | rc = ioctl(fd, command, arg); 59 | if (rc < 0) 60 | { 61 | fprintf(stderr, "ioctl(dsp,%d,arg) failed\n", command); 62 | fprintf(stderr, "errno=%d\n", errno); 63 | exit(-1); 64 | } 65 | } 66 | 67 | void I_InitMusic(void) 68 | { 69 | } 70 | 71 | void 72 | I_InitSound 73 | ( int samplerate, 74 | int samplesize ) 75 | { 76 | 77 | int i; 78 | 79 | audio_fd = open("/dev/dsp", O_WRONLY); 80 | if (audio_fd<0) 81 | fprintf(stderr, "Could not open /dev/dsp\n"); 82 | 83 | 84 | i = 11 | (2<<16); 85 | myioctl(audio_fd, SNDCTL_DSP_SETFRAGMENT, &i); 86 | 87 | myioctl(audio_fd, SNDCTL_DSP_RESET, 0); 88 | i=11025; 89 | myioctl(audio_fd, SNDCTL_DSP_SPEED, &i); 90 | i=1; 91 | myioctl(audio_fd, SNDCTL_DSP_STEREO, &i); 92 | 93 | myioctl(audio_fd, SNDCTL_DSP_GETFMTS, &i); 94 | if (i&=AFMT_S16_LE) 95 | myioctl(audio_fd, SNDCTL_DSP_SETFMT, &i); 96 | else 97 | fprintf(stderr, "Could not play signed 16 data\n"); 98 | 99 | } 100 | 101 | void 102 | I_SubmitOutputBuffer 103 | ( void* samples, 104 | int samplecount ) 105 | { 106 | write(audio_fd, samples, samplecount*4); 107 | } 108 | 109 | void I_ShutdownSound(void) 110 | { 111 | 112 | close(audio_fd); 113 | 114 | } 115 | 116 | void I_ShutdownMusic(void) 117 | { 118 | } 119 | -------------------------------------------------------------------------------- /sndserv/sounds.h: -------------------------------------------------------------------------------- 1 | // Emacs style mode select -*- C++ -*- 2 | //----------------------------------------------------------------------------- 3 | // 4 | // $Id: sounds.h,v 1.3 1997/01/29 22:40:44 b1 Exp $ 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 | // 18 | // $Log: sounds.h,v $ 19 | // Revision 1.3 1997/01/29 22:40:44 b1 20 | // Reformatting, S (sound) module files. 21 | // 22 | // Revision 1.2 1997/01/21 19:00:07 b1 23 | // First formatting run: 24 | // using Emacs cc-mode.el indentation for C++ now. 25 | // 26 | // Revision 1.1 1997/01/19 17:22:50 b1 27 | // Initial check in DOOM sources as of Jan. 10th, 1997 28 | // 29 | // 30 | // DESCRIPTION: 31 | // Created by Dave Taylor's sound utility. 32 | // Kept as a sample, DOOM sounds. 33 | // 34 | //----------------------------------------------------------------------------- 35 | 36 | #ifndef __SOUNDSH__ 37 | #define __SOUNDSH__ 38 | 39 | #include "soundst.h" 40 | 41 | // 42 | // Identifiers for all music in game. 43 | // 44 | 45 | typedef enum 46 | { 47 | mus_None, 48 | mus_e1m1, 49 | mus_e1m2, 50 | mus_e1m3, 51 | mus_e1m4, 52 | mus_e1m5, 53 | mus_e1m6, 54 | mus_e1m7, 55 | mus_e1m8, 56 | mus_e1m9, 57 | mus_e2m1, 58 | mus_e2m2, 59 | mus_e2m3, 60 | mus_e2m4, 61 | mus_e2m5, 62 | mus_e2m6, 63 | mus_e2m7, 64 | mus_e2m8, 65 | mus_e2m9, 66 | mus_e3m1, 67 | mus_e3m2, 68 | mus_e3m3, 69 | mus_e3m4, 70 | mus_e3m5, 71 | mus_e3m6, 72 | mus_e3m7, 73 | mus_e3m8, 74 | mus_e3m9, 75 | mus_inter, 76 | mus_intro, 77 | mus_bunny, 78 | mus_victor, 79 | mus_introa, 80 | mus_runnin, 81 | mus_stalks, 82 | mus_countd, 83 | mus_betwee, 84 | mus_doom, 85 | mus_the_da, 86 | mus_shawn, 87 | mus_ddtblu, 88 | mus_in_cit, 89 | mus_dead, 90 | mus_stlks2, 91 | mus_theda2, 92 | mus_doom2, 93 | mus_ddtbl2, 94 | mus_runni2, 95 | mus_dead2, 96 | mus_stlks3, 97 | mus_romero, 98 | mus_shawn2, 99 | mus_messag, 100 | mus_count2, 101 | mus_ddtbl3, 102 | mus_ampie, 103 | mus_theda3, 104 | mus_adrian, 105 | mus_messg2, 106 | mus_romer2, 107 | mus_tense, 108 | mus_shawn3, 109 | mus_openin, 110 | mus_evil, 111 | mus_ultima, 112 | mus_read_m, 113 | mus_dm2ttl, 114 | mus_dm2int, 115 | NUMMUSIC 116 | } musicenum_t; 117 | 118 | 119 | // 120 | // Identifiers for all sfx in game. 121 | // 122 | 123 | typedef enum 124 | { 125 | sfx_None, 126 | sfx_pistol, 127 | sfx_shotgn, 128 | sfx_sgcock, 129 | sfx_dshtgn, 130 | sfx_dbopn, 131 | sfx_dbcls, 132 | sfx_dbload, 133 | sfx_plasma, 134 | sfx_bfg, 135 | sfx_sawup, 136 | sfx_sawidl, 137 | sfx_sawful, 138 | sfx_sawhit, 139 | sfx_rlaunc, 140 | sfx_rxplod, 141 | sfx_firsht, 142 | sfx_firxpl, 143 | sfx_pstart, 144 | sfx_pstop, 145 | sfx_doropn, 146 | sfx_dorcls, 147 | sfx_stnmov, 148 | sfx_swtchn, 149 | sfx_swtchx, 150 | sfx_plpain, 151 | sfx_dmpain, 152 | sfx_popain, 153 | sfx_vipain, 154 | sfx_mnpain, 155 | sfx_pepain, 156 | sfx_slop, 157 | sfx_itemup, 158 | sfx_wpnup, 159 | sfx_oof, 160 | sfx_telept, 161 | sfx_posit1, 162 | sfx_posit2, 163 | sfx_posit3, 164 | sfx_bgsit1, 165 | sfx_bgsit2, 166 | sfx_sgtsit, 167 | sfx_cacsit, 168 | sfx_brssit, 169 | sfx_cybsit, 170 | sfx_spisit, 171 | sfx_bspsit, 172 | sfx_kntsit, 173 | sfx_vilsit, 174 | sfx_mansit, 175 | sfx_pesit, 176 | sfx_sklatk, 177 | sfx_sgtatk, 178 | sfx_skepch, 179 | sfx_vilatk, 180 | sfx_claw, 181 | sfx_skeswg, 182 | sfx_pldeth, 183 | sfx_pdiehi, 184 | sfx_podth1, 185 | sfx_podth2, 186 | sfx_podth3, 187 | sfx_bgdth1, 188 | sfx_bgdth2, 189 | sfx_sgtdth, 190 | sfx_cacdth, 191 | sfx_skldth, 192 | sfx_brsdth, 193 | sfx_cybdth, 194 | sfx_spidth, 195 | sfx_bspdth, 196 | sfx_vildth, 197 | sfx_kntdth, 198 | sfx_pedth, 199 | sfx_skedth, 200 | sfx_posact, 201 | sfx_bgact, 202 | sfx_dmact, 203 | sfx_bspact, 204 | sfx_bspwlk, 205 | sfx_vilact, 206 | sfx_noway, 207 | sfx_barexp, 208 | sfx_punch, 209 | sfx_hoof, 210 | sfx_metal, 211 | sfx_chgun, 212 | sfx_tink, 213 | sfx_bdopn, 214 | sfx_bdcls, 215 | sfx_itmbk, 216 | sfx_flame, 217 | sfx_flamst, 218 | sfx_getpow, 219 | sfx_bospit, 220 | sfx_boscub, 221 | sfx_bossit, 222 | sfx_bospn, 223 | sfx_bosdth, 224 | sfx_manatk, 225 | sfx_mandth, 226 | sfx_sssit, 227 | sfx_ssdth, 228 | sfx_keenpn, 229 | sfx_keendt, 230 | sfx_skeact, 231 | sfx_skesit, 232 | sfx_skeatk, 233 | sfx_radio, 234 | NUMSFX 235 | } sfxenum_t; 236 | 237 | extern musicinfo_t S_music[]; 238 | extern sfxinfo_t S_sfx[]; 239 | 240 | #endif 241 | 242 | -------------------------------------------------------------------------------- /sndserv/soundsrv.h: -------------------------------------------------------------------------------- 1 | // Emacs style mode select -*- C++ -*- 2 | //----------------------------------------------------------------------------- 3 | // 4 | // $Id: soundsrv.h,v 1.3 1997/01/29 22:40:44 b1 Exp $ 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 | // 18 | // $Log: soundsrv.h,v $ 19 | // Revision 1.3 1997/01/29 22:40:44 b1 20 | // Reformatting, S (sound) module files. 21 | // 22 | // Revision 1.2 1997/01/21 19:00:07 b1 23 | // First formatting run: 24 | // using Emacs cc-mode.el indentation for C++ now. 25 | // 26 | // Revision 1.1 1997/01/19 17:22:50 b1 27 | // Initial check in DOOM sources as of Jan. 10th, 1997 28 | // 29 | // 30 | // DESCRIPTION: 31 | // UNIX soundserver, separate process. 32 | // 33 | //----------------------------------------------------------------------------- 34 | 35 | #ifndef __SNDSERVER_H__ 36 | #define __SNDSERVER_H__ 37 | 38 | #define SAMPLECOUNT 512 39 | #define MIXBUFFERSIZE (SAMPLECOUNT*2*2) 40 | #define SPEED 11025 41 | 42 | 43 | void I_InitMusic(void); 44 | 45 | void 46 | I_InitSound 47 | ( int samplerate, 48 | int samplesound ); 49 | 50 | void 51 | I_SubmitOutputBuffer 52 | ( void* samples, 53 | int samplecount ); 54 | 55 | void I_ShutdownSound(void); 56 | void I_ShutdownMusic(void); 57 | 58 | #endif 59 | -------------------------------------------------------------------------------- /sndserv/wadread.h: -------------------------------------------------------------------------------- 1 | // Emacs style mode select -*- C++ -*- 2 | //----------------------------------------------------------------------------- 3 | // 4 | // $Id: wadread.h,v 1.3 1997/01/30 19:54:23 b1 Exp $ 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 | // 18 | // $Log: wadread.h,v $ 19 | // Revision 1.3 1997/01/30 19:54:23 b1 20 | // Final reformatting run. All the remains (ST, W, WI, Z). 21 | // 22 | // Revision 1.2 1997/01/21 19:00:10 b1 23 | // First formatting run: 24 | // using Emacs cc-mode.el indentation for C++ now. 25 | // 26 | // Revision 1.1 1997/01/19 17:22:52 b1 27 | // Initial check in DOOM sources as of Jan. 10th, 1997 28 | // 29 | // 30 | // DESCRIPTION: 31 | // WAD and Lump I/O, the second. 32 | // This time for soundserver only. 33 | // Welcome to Department of Redundancy Department. 34 | // (Yeah, I said that elsewhere already). 35 | // Note: makes up for a nice w_wad.h. 36 | // 37 | //----------------------------------------------------------------------------- 38 | 39 | #ifndef __WADREAD_H__ 40 | #define __WADREAD_H__ 41 | 42 | // 43 | // Opens the wadfile specified. 44 | // Must be called before any calls to loadlump() or getsfx(). 45 | // 46 | 47 | void openwad(char* wadname); 48 | 49 | // 50 | // Gets a sound effect from the wad file. The pointer points to the 51 | // start of the data. Returns a 0 if the sfx was not 52 | // found. Sfx names should be no longer than 6 characters. All data is 53 | // rounded up in size to the nearest MIXBUFFERSIZE and is padded out with 54 | // 0x80's. Returns the data length in len. 55 | // 56 | 57 | void* 58 | getsfx 59 | ( char* sfxname, 60 | int* len ); 61 | 62 | #endif 63 | --------------------------------------------------------------------------------