doom

a minimalistic implementation of doom
git clone git://ssnf.xyz/doom
Log | Files | Refs

commit 181908bd2667000b6139f92c8834059b4ec3f98a
parent 77735c3ff0772609e9c8d29e3ce2ab42ff54d20b
Author: ssnf <ssnf@ssnf.xyz>
Date:   Thu, 17 Jun 2021 01:32:14 +0000

general file cleanup

Diffstat:
DREADME.TXT | 78------------------------------------------------------------------------------
Adoom1.wad | 0
Dipx/DOOMNET.C | 73-------------------------------------------------------------------------
Dipx/DOOMNET.H | 58----------------------------------------------------------
Dipx/IPXNET.C | 294-------------------------------------------------------------------------------
Dipx/IPXNET.H | 117-------------------------------------------------------------------------------
Dipx/IPXSETUP.C | 420-------------------------------------------------------------------------------
Dipx/IPXSTR.H | 19-------------------
Dipx/IPX_FRCH.H | 21---------------------
Dipx/README | 1-
Dlinuxdoom-1.10/CVS/Entries | 109-------------------------------------------------------------------------------
Dlinuxdoom-1.10/CVS/Repository | 1-
Dlinuxdoom-1.10/CVS/Root | 1-
Dlinuxdoom-1.10/ChangeLog | 922-------------------------------------------------------------------------------
Dlinuxdoom-1.10/DOOMLIC.TXT | 112-------------------------------------------------------------------------------
Dlinuxdoom-1.10/FILES | 98-------------------------------------------------------------------------------
Dlinuxdoom-1.10/FILES2 | 221-------------------------------------------------------------------------------
Dlinuxdoom-1.10/Makefile | 96-------------------------------------------------------------------------------
Dlinuxdoom-1.10/README.asm | 283-------------------------------------------------------------------------------
Dlinuxdoom-1.10/README.b | 140-------------------------------------------------------------------------------
Dlinuxdoom-1.10/README.book | 57---------------------------------------------------------
Dlinuxdoom-1.10/README.gl | 149-------------------------------------------------------------------------------
Dlinuxdoom-1.10/README.sound | 110-------------------------------------------------------------------------------
Dlinuxdoom-1.10/TODO | 123-------------------------------------------------------------------------------
Dlinuxdoom-1.10/d_englsh.h | 701-------------------------------------------------------------------------------
Dlinuxdoom-1.10/i_sound.c | 985-------------------------------------------------------------------------------
Dlinuxdoom-1.10/i_video.c | 1050-------------------------------------------------------------------------------
Dsersrc/DOOMNET.C | 126-------------------------------------------------------------------------------
Dsersrc/DOOMNET.H | 60------------------------------------------------------------
Dsersrc/PORT.C | 428-------------------------------------------------------------------------------
Dsersrc/README.TXT | 1-
Dsersrc/SERSETUP.C | 680-------------------------------------------------------------------------------
Dsersrc/SERSETUP.H | 102-------------------------------------------------------------------------------
Dsersrc/SERSTR.H | 21---------------------
Dsersrc/SER_FRCH.H | 25-------------------------
Msndserv/soundsrv.c | 18++++++------------
Asrc/Makefile | 95+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Rlinuxdoom-1.10/am_map.c -> src/am_map.c | 0
Rlinuxdoom-1.10/am_map.h -> src/am_map.h | 0
Asrc/d_englsh.h | 701+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Rlinuxdoom-1.10/d_event.h -> src/d_event.h | 0
Rlinuxdoom-1.10/d_french.h -> src/d_french.h | 0
Rlinuxdoom-1.10/d_items.c -> src/d_items.c | 0
Rlinuxdoom-1.10/d_items.h -> src/d_items.h | 0
Rlinuxdoom-1.10/d_main.c -> src/d_main.c | 0
Rlinuxdoom-1.10/d_main.h -> src/d_main.h | 0
Rlinuxdoom-1.10/d_net.c -> src/d_net.c | 0
Rlinuxdoom-1.10/d_net.h -> src/d_net.h | 0
Rlinuxdoom-1.10/d_player.h -> src/d_player.h | 0
Rlinuxdoom-1.10/d_textur.h -> src/d_textur.h | 0
Rlinuxdoom-1.10/d_think.h -> src/d_think.h | 0
Rlinuxdoom-1.10/d_ticcmd.h -> src/d_ticcmd.h | 0
Rlinuxdoom-1.10/doomdata.h -> src/doomdata.h | 0
Rlinuxdoom-1.10/doomdef.c -> src/doomdef.c | 0
Rlinuxdoom-1.10/doomdef.h -> src/doomdef.h | 0
Rlinuxdoom-1.10/doomstat.c -> src/doomstat.c | 0
Rlinuxdoom-1.10/doomstat.h -> src/doomstat.h | 0
Rlinuxdoom-1.10/doomtype.h -> src/doomtype.h | 0
Rlinuxdoom-1.10/dstrings.c -> src/dstrings.c | 0
Rlinuxdoom-1.10/dstrings.h -> src/dstrings.h | 0
Rlinuxdoom-1.10/f_finale.c -> src/f_finale.c | 0
Rlinuxdoom-1.10/f_finale.h -> src/f_finale.h | 0
Rlinuxdoom-1.10/f_wipe.c -> src/f_wipe.c | 0
Rlinuxdoom-1.10/f_wipe.h -> src/f_wipe.h | 0
Rlinuxdoom-1.10/g_game.c -> src/g_game.c | 0
Rlinuxdoom-1.10/g_game.h -> src/g_game.h | 0
Rlinuxdoom-1.10/hu_lib.c -> src/hu_lib.c | 0
Rlinuxdoom-1.10/hu_lib.h -> src/hu_lib.h | 0
Rlinuxdoom-1.10/hu_stuff.c -> src/hu_stuff.c | 0
Rlinuxdoom-1.10/hu_stuff.h -> src/hu_stuff.h | 0
Rlinuxdoom-1.10/i_main.c -> src/i_main.c | 0
Rlinuxdoom-1.10/i_net.c -> src/i_net.c | 0
Rlinuxdoom-1.10/i_net.h -> src/i_net.h | 0
Asrc/i_sound.c | 984+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Rlinuxdoom-1.10/i_sound.h -> src/i_sound.h | 0
Rlinuxdoom-1.10/i_system.c -> src/i_system.c | 0
Rlinuxdoom-1.10/i_system.h -> src/i_system.h | 0
Asrc/i_video.c | 1050+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Rlinuxdoom-1.10/i_video.h -> src/i_video.h | 0
Rlinuxdoom-1.10/info.c -> src/info.c | 0
Rlinuxdoom-1.10/info.h -> src/info.h | 0
Rlinuxdoom-1.10/m_argv.c -> src/m_argv.c | 0
Rlinuxdoom-1.10/m_argv.h -> src/m_argv.h | 0
Rlinuxdoom-1.10/m_bbox.c -> src/m_bbox.c | 0
Rlinuxdoom-1.10/m_bbox.h -> src/m_bbox.h | 0
Rlinuxdoom-1.10/m_cheat.c -> src/m_cheat.c | 0
Rlinuxdoom-1.10/m_cheat.h -> src/m_cheat.h | 0
Rlinuxdoom-1.10/m_fixed.c -> src/m_fixed.c | 0
Rlinuxdoom-1.10/m_fixed.h -> src/m_fixed.h | 0
Rlinuxdoom-1.10/m_menu.c -> src/m_menu.c | 0
Rlinuxdoom-1.10/m_menu.h -> src/m_menu.h | 0
Rlinuxdoom-1.10/m_misc.c -> src/m_misc.c | 0
Rlinuxdoom-1.10/m_misc.h -> src/m_misc.h | 0
Rlinuxdoom-1.10/m_random.c -> src/m_random.c | 0
Rlinuxdoom-1.10/m_random.h -> src/m_random.h | 0
Rlinuxdoom-1.10/m_swap.c -> src/m_swap.c | 0
Rlinuxdoom-1.10/m_swap.h -> src/m_swap.h | 0
Rlinuxdoom-1.10/p_ceilng.c -> src/p_ceilng.c | 0
Rlinuxdoom-1.10/p_doors.c -> src/p_doors.c | 0
Rlinuxdoom-1.10/p_enemy.c -> src/p_enemy.c | 0
Rlinuxdoom-1.10/p_floor.c -> src/p_floor.c | 0
Rlinuxdoom-1.10/p_inter.c -> src/p_inter.c | 0
Rlinuxdoom-1.10/p_inter.h -> src/p_inter.h | 0
Rlinuxdoom-1.10/p_lights.c -> src/p_lights.c | 0
Rlinuxdoom-1.10/p_local.h -> src/p_local.h | 0
Rlinuxdoom-1.10/p_map.c -> src/p_map.c | 0
Rlinuxdoom-1.10/p_maputl.c -> src/p_maputl.c | 0
Rlinuxdoom-1.10/p_mobj.c -> src/p_mobj.c | 0
Rlinuxdoom-1.10/p_mobj.h -> src/p_mobj.h | 0
Rlinuxdoom-1.10/p_plats.c -> src/p_plats.c | 0
Rlinuxdoom-1.10/p_pspr.c -> src/p_pspr.c | 0
Rlinuxdoom-1.10/p_pspr.h -> src/p_pspr.h | 0
Rlinuxdoom-1.10/p_saveg.c -> src/p_saveg.c | 0
Rlinuxdoom-1.10/p_saveg.h -> src/p_saveg.h | 0
Rlinuxdoom-1.10/p_setup.c -> src/p_setup.c | 0
Rlinuxdoom-1.10/p_setup.h -> src/p_setup.h | 0
Rlinuxdoom-1.10/p_sight.c -> src/p_sight.c | 0
Rlinuxdoom-1.10/p_spec.c -> src/p_spec.c | 0
Rlinuxdoom-1.10/p_spec.h -> src/p_spec.h | 0
Rlinuxdoom-1.10/p_switch.c -> src/p_switch.c | 0
Rlinuxdoom-1.10/p_telept.c -> src/p_telept.c | 0
Rlinuxdoom-1.10/p_tick.c -> src/p_tick.c | 0
Rlinuxdoom-1.10/p_tick.h -> src/p_tick.h | 0
Rlinuxdoom-1.10/p_user.c -> src/p_user.c | 0
Rlinuxdoom-1.10/r_bsp.c -> src/r_bsp.c | 0
Rlinuxdoom-1.10/r_bsp.h -> src/r_bsp.h | 0
Rlinuxdoom-1.10/r_data.c -> src/r_data.c | 0
Rlinuxdoom-1.10/r_data.h -> src/r_data.h | 0
Rlinuxdoom-1.10/r_defs.h -> src/r_defs.h | 0
Rlinuxdoom-1.10/r_draw.c -> src/r_draw.c | 0
Rlinuxdoom-1.10/r_draw.h -> src/r_draw.h | 0
Rlinuxdoom-1.10/r_local.h -> src/r_local.h | 0
Rlinuxdoom-1.10/r_main.c -> src/r_main.c | 0
Rlinuxdoom-1.10/r_main.h -> src/r_main.h | 0
Rlinuxdoom-1.10/r_plane.c -> src/r_plane.c | 0
Rlinuxdoom-1.10/r_plane.h -> src/r_plane.h | 0
Rlinuxdoom-1.10/r_segs.c -> src/r_segs.c | 0
Rlinuxdoom-1.10/r_segs.h -> src/r_segs.h | 0
Rlinuxdoom-1.10/r_sky.c -> src/r_sky.c | 0
Rlinuxdoom-1.10/r_sky.h -> src/r_sky.h | 0
Rlinuxdoom-1.10/r_state.h -> src/r_state.h | 0
Rlinuxdoom-1.10/r_things.c -> src/r_things.c | 0
Rlinuxdoom-1.10/r_things.h -> src/r_things.h | 0
Rlinuxdoom-1.10/s_sound.c -> src/s_sound.c | 0
Rlinuxdoom-1.10/s_sound.h -> src/s_sound.h | 0
Rlinuxdoom-1.10/sounds.c -> src/sounds.c | 0
Rlinuxdoom-1.10/sounds.h -> src/sounds.h | 0
Rlinuxdoom-1.10/st_lib.c -> src/st_lib.c | 0
Rlinuxdoom-1.10/st_lib.h -> src/st_lib.h | 0
Rlinuxdoom-1.10/st_stuff.c -> src/st_stuff.c | 0
Rlinuxdoom-1.10/st_stuff.h -> src/st_stuff.h | 0
Rlinuxdoom-1.10/tables.c -> src/tables.c | 0
Rlinuxdoom-1.10/tables.h -> src/tables.h | 0
Asrc/update | 0
Rlinuxdoom-1.10/v_video.c -> src/v_video.c | 0
Rlinuxdoom-1.10/v_video.h -> src/v_video.h | 0
Rlinuxdoom-1.10/w_wad.c -> src/w_wad.c | 0
Rlinuxdoom-1.10/w_wad.h -> src/w_wad.h | 0
Rlinuxdoom-1.10/wi_stuff.c -> src/wi_stuff.c | 0
Rlinuxdoom-1.10/wi_stuff.h -> src/wi_stuff.h | 0
Rlinuxdoom-1.10/z_zone.c -> src/z_zone.c | 0
Rlinuxdoom-1.10/z_zone.h -> src/z_zone.h | 0
162 files changed, 2836 insertions(+), 7694 deletions(-)

diff --git a/README.TXT b/README.TXT @@ -1,78 +0,0 @@ - -Here it is, at long last. The DOOM source code is released for your -non-profit use. You still need real DOOM data to work with this code. -If you don't actually own a real copy of one of the DOOMs, you should -still be able to find them at software stores. - -Many thanks to Bernd Kreimeier for taking the time to clean up the -project and make sure that it actually works. Projects tends to rot if -you leave it alone for a few years, and it takes effort for someone to -deal with it again. - -The bad news: this code only compiles and runs on linux. We couldn't -release the dos code because of a copyrighted sound library we used -(wow, was that a mistake -- I write my own sound code now), and I -honestly don't even know what happened to the port that microsoft did -to windows. - -Still, the code is quite portable, and it should be straightforward to -bring it up on just about any platform. - -I wrote this code a long, long time ago, and there are plenty of things -that seem downright silly in retrospect (using polar coordinates for -clipping comes to mind), but overall it should still be a usefull base -to experiment and build on. - -The basic rendering concept -- horizontal and vertical lines of constant -Z with fixed light shading per band was dead-on, but the implementation -could be improved dramatically from the original code if it were -revisited. The way the rendering proceded from walls to floors to -sprites could be collapsed into a single front-to-back walk of the bsp -tree to collect information, then draw all the contents of a subsector -on the way back up the tree. It requires treating floors and ceilings -as polygons, rather than just the gaps between walls, and it requires -clipping sprite billboards into subsector fragments, but it would be -The Right Thing. - -The movement and line of sight checking against the lines is one of the -bigger misses that I look back on. It is messy code that had some -failure cases, and there was a vastly simpler (and faster) solution -sitting in front of my face. I used the BSP tree for rendering things, -but I didn't realize at the time that it could also be used for -environment testing. Replacing the line of sight test with a bsp line -clip would be pretty easy. Sweeping volumes for movement gets a bit -tougher, and touches on many of the challenges faced in quake / quake2 -with edge bevels on polyhedrons. - -Some project ideas: - -Port it to your favorite operating system. - -Add some rendering features -- transparency, look up / down, slopes, -etc. - -Add some game features -- weapons, jumping, ducking, flying, etc. - -Create a packet server based internet game. - -Create a client / server based internet game. - -Do a 3D accelerated version. On modern hardware (fast pentium + 3DFX) -you probably wouldn't even need to be clever -- you could just draw the -entire level and get reasonable speed. With a touch of effort, it should -easily lock at 60 fps (well, there are some issues with DOOM's 35 hz -timebase...). The biggest issues would probably be the non-power of two -texture sizes and the walls composed of multiple textures. - - -I don't have a real good guess at how many people are going to be -playing with this, but if significant projects are undertaken, it would -be cool to see a level of community cooperation. I know that most early -projects are going to be rough hacks done in isolation, but I would be -very pleased to see a coordinated 'net release of an improved, backwards -compatable version of DOOM on multiple platforms next year. - -Have fun. - -John Carmack -12-23-97 diff --git a/doom1.wad b/doom1.wad Binary files differ. diff --git a/ipx/DOOMNET.C b/ipx/DOOMNET.C @@ -1,73 +0,0 @@ -//#define DOOM2 - -#include <stdio.h> -#include <stdlib.h> -#include <string.h> -#include <process.h> -#include <conio.h> -#include <dos.h> - -#include "doomnet.h" -//#include "ipxstr.h" -#include "ipx_frch.h" // FRENCH VERSION - -doomcom_t doomcom; -int vectorishooked; -void interrupt (*olddoomvect) (void); - - - -/* -============= -= -= LaunchDOOM -= -These fields in doomcom should be filled in before calling: - - short numnodes; // console is allways node 0 - short ticdup; // 1 = no duplication, 2-5 = dup for -slow nets - short extratics; // 1 = send a backup tic in every -packet - - short consoleplayer; // 0-3 = player number - short numplayers; // 1-4 - short angleoffset; // 1 = left, 0 = center, -1 = right - short drone; // 1 = drone -============= -*/ - -void LaunchDOOM (void) -{ - char *newargs[99]; - char adrstring[10]; - long flatadr; - -// prepare for DOOM - doomcom.id = DOOMCOM_ID; - -// hook the interrupt vector - olddoomvect = getvect (doomcom.intnum); - setvect (doomcom.intnum,(void interrupt (*)(void))MK_FP(_CS, -(int)NetISR)); - vectorishooked = 1; - -// build the argument list for DOOM, adding a -net &doomcom - memcpy (newargs, _argv, (_argc+1)*2); - newargs[_argc] = "-net"; - flatadr = (long)_DS*16 + (unsigned)&doomcom; - sprintf (adrstring,"%lu",flatadr); - newargs[_argc+1] = adrstring; - newargs[_argc+2] = NULL; - - if (!access("doom2.exe",0)) - spawnv (P_WAIT, "doom2", newargs); - else - spawnv (P_WAIT, "doom", newargs); - - #ifdef DOOM2 - printf (STR_RETURNED"\n"); - #else - printf ("Returned from DOOM\n"); - #endif -} diff --git a/ipx/DOOMNET.H b/ipx/DOOMNET.H @@ -1,58 +0,0 @@ -// doomnet.h - -#define PEL_WRITE_ADR 0x3c8 -#define PEL_DATA 0x3c9 - -#define I_ColorBlack(r,g,b) {outp(PEL_WRITE_ADR,0);outp(PEL_DATA,r);outp(PEL_DATA,g);outp(PEL_DATA,b);}; - - - -#define MAXNETNODES 8 // max computers in a game -#define MAXPLAYERS 4 // 4 players max + drones - - -#define CMD_SEND 1 -#define CMD_GET 2 - -#define DOOMCOM_ID 0x12345678l - -typedef struct -{ - long id; - short intnum; // DOOM executes an int to send commands - -// communication between DOOM and the driver - short command; // CMD_SEND or CMD_GET - short remotenode; // dest for send, set by get (-1 = no packet) - short datalength; // bytes in doomdata to be sent / bytes read - -// info common to all nodes - short numnodes; // console is allways node 0 - short ticdup; // 1 = no duplication, 2-5 = dup for slow nets - short extratics; // 1 = send a backup tic in every packet - short deathmatch; // 1 = deathmatch - short savegame; // -1 = new game, 0-5 = load savegame - short episode; // 1-3 - short map; // 1-9 - short skill; // 1-5 - -// info specific to this node - short consoleplayer; // 0-3 = player number - short numplayers; // 1-4 - short angleoffset; // 1 = left, 0 = center, -1 = right - short drone; // 1 = drone - -// packet data to be sent - char data[512]; -} doomcom_t; - - - -extern doomcom_t doomcom; -extern void interrupt (*olddoomvect) (void); -extern int vectorishooked; - -int CheckParm (char *check); -void LaunchDOOM (void); -void interrupt NetISR (void); - diff --git a/ipx/IPXNET.C b/ipx/IPXNET.C @@ -1,294 +0,0 @@ -// ipxnet.c - -#include <stdio.h> -#include <stdlib.h> -#include <dos.h> -#include <string.h> -#include <process.h> -#include <values.h> - -#include "ipxnet.h" - -/* -========================================================================== -=== - - IPX PACKET DRIVER - -========================================================================== -=== -*/ - -packet_t packets[NUMPACKETS]; - -nodeadr_t nodeadr[MAXNETNODES+1]; // first is local, last is broadcast - -nodeadr_t remoteadr; // set by each GetPacket - -localadr_t localadr; // set at startup - -extern int socketid; - -void far (*IPX)(void); - -long localtime; // for time stamp in packets -long remotetime; - -//=========================================================================== - -int OpenSocket(short socketNumber) -{ - _DX = socketNumber; - _BX = 0; - _AL = 0; - IPX(); - if(_AL) - Error ("OpenSocket: 0x%x", _AL); - return _DX; -} - - -void CloseSocket(short socketNumber) -{ - _DX = socketNumber; - _BX = 1; - IPX(); -} - -void ListenForPacket(ECB *ecb) -{ - _SI = FP_OFF(ecb); - _ES = FP_SEG(ecb); - _BX = 4; - IPX(); - if(_AL) - Error ("ListenForPacket: 0x%x", _AL); -} - - -void GetLocalAddress (void) -{ - _SI = FP_OFF(&localadr); - _ES = FP_SEG(&localadr); - _BX = 9; - IPX(); -} - - - -/* -==================== -= -= InitNetwork -= -==================== -*/ - -void InitNetwork (void) -{ - int i,j; - -// -// get IPX function address -// - _AX = 0x7a00; - geninterrupt(0x2f); - if(_AL != 0xff) - Error ("IPX not detected\n"); - IPX = MK_FP(_ES, _DI); - - -// -// allocate a socket for sending and receiving -// - socketid = OpenSocket ( (socketid>>8) + ((socketid&255)<<8) ); - - GetLocalAddress(); - -// -// set up several receiving ECBs -// - memset (packets,0,NUMPACKETS*sizeof(packet_t)); - - for (i=1 ; i<NUMPACKETS ; i++) - { - packets[i].ecb.ECBSocket = socketid; - packets[i].ecb.FragmentCount = 1; - packets[i].ecb.fAddress[0] = FP_OFF(&packets[i].ipx); - packets[i].ecb.fAddress[1] = FP_SEG(&packets[i].ipx); - packets[i].ecb.fSize = sizeof(packet_t)-sizeof(ECB); - - ListenForPacket (&packets[i].ecb); - } - -// -// set up a sending ECB -// - memset (&packets[0],0,sizeof(packets[0])); - - packets[0].ecb.ECBSocket = socketid; - packets[0].ecb.FragmentCount = 2; - packets[0].ecb.fAddress[0] = FP_OFF(&packets[0].ipx); - packets[0].ecb.fAddress[1] = FP_SEG(&packets[0].ipx); - for (j=0 ; j<4 ; j++) - packets[0].ipx.dNetwork[j] = localadr.network[j]; - packets[0].ipx.dSocket[0] = socketid&255; - packets[0].ipx.dSocket[1] = socketid>>8; - packets[0].ecb.f2Address[0] = FP_OFF(&doomcom.data); - packets[0].ecb.f2Address[1] = FP_SEG(&doomcom.data); - -// known local node at 0 - for (i=0 ; i<6 ; i++) - nodeadr[0].node[i] = localadr.node[i]; - -// broadcast node at MAXNETNODES - for (j=0 ; j<6 ; j++) - nodeadr[MAXNETNODES].node[j] = 0xff; -} - - -/* -==================== -= -= ShutdownNetwork -= -==================== -*/ - -void ShutdownNetwork (void) -{ - if (IPX) - CloseSocket (socketid); -} - - -/* -============== -= -= SendPacket -= -= A destination of MAXNETNODES is a broadcast -============== -*/ - -void SendPacket (int destination) -{ - int j; - -// set the time - packets[0].time = localtime; - -// set the address - for (j=0 ; j<6 ; j++) - packets[0].ipx.dNode[j] = -packets[0].ecb.ImmediateAddress[j] = - nodeadr[destination].node[j]; - -// set the length (ipx + time + datalength) - packets[0].ecb.fSize = sizeof(IPXPacket) + 4; - packets[0].ecb.f2Size = doomcom.datalength + 4; - -// send the packet - _SI = FP_OFF(&packets[0]); - _ES = FP_SEG(&packets[0]); - _BX = 3; - IPX(); - if(_AL) - Error("SendPacket: 0x%x", _AL); - - while(packets[0].ecb.InUseFlag != 0) - { - // IPX Relinquish Control - polled drivers MUST have this here! - _BX = 10; - IPX(); - } -} - - -unsigned short ShortSwap (unsigned short i) -{ - return ((i&255)<<8) + ((i>>8)&255); -} - -/* -============== -= -= GetPacket -= -= Returns false if no packet is waiting -= -============== -*/ - -int GetPacket (void) -{ - int packetnum; - int i, j; - long besttic; - packet_t *packet; - -// if multiple packets are waiting, return them in order by time - - besttic = MAXLONG; - packetnum = -1; - doomcom.remotenode = -1; - - for ( i = 1 ; i < NUMPACKETS ; i++) - { - if (packets[i].ecb.InUseFlag) - { - continue; - } - - if (packets[i].time < besttic) - { - besttic = packets[i].time; - packetnum = i; - } - } - - if (besttic == MAXLONG) - return 0; // no packets - - packet = &packets[packetnum]; - - if (besttic == -1 && localtime != -1) - { - ListenForPacket (&packet->ecb); - return 0; // setup broadcast from other game - } - - remotetime = besttic; - -// -// got a good packet -// - if (packet->ecb.CompletionCode) - Error ("GetPacket: ecb.ComletionCode = 0x%x",packet->ecb.CompletionCode); - -// set remoteadr to the sender of the packet - memcpy (&remoteadr, packet->ipx.sNode, sizeof(remoteadr)); - for (i=0 ; i<doomcom.numnodes ; i++) - if (!memcmp(&remoteadr, &nodeadr[i], sizeof(remoteadr))) - break; - if (i < doomcom.numnodes) - doomcom.remotenode = i; - else - { - if (localtime != -1) - { // this really shouldn't happen - ListenForPacket (&packet->ecb); - return 0; - } - } - -// copy out the data - doomcom.datalength = ShortSwap(packet->ipx.PacketLength) - 38; - memcpy (&doomcom.data, &packet->data, doomcom.datalength); - -// repost the ECB - ListenForPacket (&packet->ecb); - - return 1; -} - diff --git a/ipx/IPXNET.H b/ipx/IPXNET.H @@ -1,117 +0,0 @@ -// ipxnet.h - - -typedef struct -{ - char private[512]; -} doomdata_t; - - -#include "DoomNet.h" - -//=========================================================================== - -#define NUMPACKETS 10 // max outstanding packets before loss - -// setupdata_t is used as doomdata_t during setup -typedef struct -{ - short gameid; // so multiple games can setup at once - short drone; - short nodesfound; - short nodeswanted; -} setupdata_t; - - - -typedef unsigned char BYTE; -typedef unsigned short WORD; -typedef unsigned long LONG; - -typedef struct IPXPacketStructure -{ - WORD PacketCheckSum; /* high-low */ - WORD PacketLength; /* high-low */ - BYTE PacketTransportControl; - BYTE PacketType; - - BYTE dNetwork[4]; /* high-low */ - BYTE dNode[6]; /* high-low */ - BYTE dSocket[2]; /* high-low */ - - BYTE sNetwork[4]; /* high-low */ - BYTE sNode[6]; /* high-low */ - BYTE sSocket[2]; /* high-low */ -} IPXPacket; - - -typedef struct -{ - BYTE network[4]; /* high-low */ - BYTE node[6]; /* high-low */ -} localadr_t; - -typedef struct -{ - BYTE node[6]; /* high-low */ -} nodeadr_t; - -typedef struct ECBStructure -{ - WORD Link[2]; /* offset-segment */ - WORD ESRAddress[2]; /* offset-segment */ - BYTE InUseFlag; - BYTE CompletionCode; - WORD ECBSocket; /* high-low */ - BYTE IPXWorkspace[4]; /* N/A */ - BYTE DriverWorkspace[12]; /* N/A */ - BYTE ImmediateAddress[6]; /* high-low */ - WORD FragmentCount; /* low-high */ - - WORD fAddress[2]; /* offset-segment */ - WORD fSize; /* low-high */ - - WORD f2Address[2]; /* offset-segment */ - WORD f2Size; /* low-high */ -} ECB; - - -// time is used by the communication driver to sequence packets returned -// to DOOM when more than one is waiting - -typedef struct -{ - ECB ecb; - IPXPacket ipx; - - long time; - doomdata_t data; -} packet_t; - - -extern doomcom_t doomcom; -extern int gameid; - -extern nodeadr_t nodeadr[MAXNETNODES+1]; -extern int localnodenum; - -extern long localtime; // for time stamp in packets -extern long remotetime; // timestamp of last packet gotten - -extern nodeadr_t remoteadr; - -extern int myargc; - -extern char **myargv; - -void Error (char *error, ...); - - -void InitNetwork (void); -void ShutdownNetwork (void); -void SendPacket (int destination); -int GetPacket (void); -int CheckParm (char *check); - -void PrintAddress (nodeadr_t *adr, char *str); - diff --git a/ipx/IPXSETUP.C b/ipx/IPXSETUP.C @@ -1,420 +0,0 @@ -// ipxsetup.c - -#define DOOM2 - -#include <conio.h> -#include <stdio.h> -#include <stdlib.h> -#include <dos.h> -#include <string.h> -#include <process.h> -#include <stdarg.h> -#include <bios.h> - -#include "ipxnet.h" -//#include "ipxstr.h" -#include "ipx_frch.h" // FRENCH VERSION - -int gameid; -int numnetnodes; -int socketid = 0x869c; // 0x869c is the official DOOM socket -int myargc; -char **myargv; - -setupdata_t nodesetup[MAXNETNODES]; - - -/* -================= -= -= Error -= -= For abnormal program terminations -= -================= -*/ - -void Error (char *error, ...) -{ - va_list argptr; - - if (vectorishooked) - setvect (doomcom.intnum,olddoomvect); - - va_start (argptr,error); - vprintf (error,argptr); - va_end (argptr); - printf ("\n"); - ShutdownNetwork (); - exit (1); -} - - -/* -================= -= -= CheckParm -= -= Checks for the given parameter in the program's command line arguments -= -= Returns the argument number (1 to argc-1) or 0 if not present -= -================= -*/ - -int CheckParm(char *parm) - { - int i; - - for(i = 1; i < myargc; i++) - if(stricmp(parm, myargv[i]) == 0) - return i; - - return 0; - } - - -/* -============= -= -= NetISR -= -============= -*/ - -void interrupt NetISR (void) -{ - if (doomcom.command == CMD_SEND) - { - localtime++; - SendPacket (doomcom.remotenode); - } - else if (doomcom.command == CMD_GET) - { - GetPacket (); - } -} - - - -/* -=================== -= -= LookForNodes -= -= Finds all the nodes for the game and works out player numbers among -them -= -= Exits with nodesetup[0..numnodes] and nodeadr[0..numnodes] filled in -=================== -*/ - -void LookForNodes (void) -{ - int i,j,k; - int netids[MAXNETNODES]; - int netplayer[MAXNETNODES]; - struct time time; - int oldsec; - setupdata_t *setup, *dest; - char str[80]; - int total, console; - -// -// wait until we get [numnetnodes] packets, then start playing -// the playernumbers are assigned by netid -// - printf(STR_ATTEMPT, numnetnodes); - - printf (STR_LOOKING); - - oldsec = -1; - setup = (setupdata_t *)&doomcom.data; - localtime = -1; // in setup time, not game time - -// -// build local setup info -// - nodesetup[0].nodesfound = 1; - nodesetup[0].nodeswanted = numnetnodes; - doomcom.numnodes = 1; - - do - { -// -// check for aborting -// - while ( bioskey(1) ) - { - if ( (bioskey (0) & 0xff) == 27) - Error ("\n\n"STR_NETABORT); - } - -// -// listen to the network -// - while (GetPacket ()) - { - if (doomcom.remotenode == -1) - dest = &nodesetup[doomcom.numnodes]; - else - dest = &nodesetup[doomcom.remotenode]; - - if (remotetime != -1) - { // an early game packet, not a setup packet - if (doomcom.remotenode == -1) - Error (STR_UNKNOWN); - // if it allready started, it must have found all nodes - dest->nodesfound = dest->nodeswanted; - continue; - } - - // update setup ingo - memcpy (dest, setup, sizeof(*dest) ); - - if (doomcom.remotenode != -1) - continue; // allready know that node address - - // - // this is a new node - // - memcpy (&nodeadr[doomcom.numnodes], &remoteadr - , sizeof(nodeadr[doomcom.numnodes]) ); - - // - // if this node has a lower address, take all startup info - // - if ( memcmp (&remoteadr, &nodeadr[0], sizeof(&remoteadr) ) -< 0 ) - { - } - - doomcom.numnodes++; - - printf ("\n"STR_FOUND"\n"); - - if (doomcom.numnodes < numnetnodes) - printf (STR_LOOKING); - } -// -// we are done if all nodes have found all other nodes -// - for (i=0 ; i<doomcom.numnodes ; i++) - if (nodesetup[i].nodesfound != nodesetup[i].nodeswanted) - break; - - if (i == nodesetup[0].nodeswanted) - break; // got them all - -// -// send out a broadcast packet every second -// - gettime (&time); - if (time.ti_sec == oldsec) - continue; - oldsec = time.ti_sec; - - printf ("."); - doomcom.datalength = sizeof(*setup); - - nodesetup[0].nodesfound = doomcom.numnodes; - - memcpy (&doomcom.data, &nodesetup[0], sizeof(*setup)); - - SendPacket (MAXNETNODES); // send to all - - } while (1); - -// -// count players -// - total = 0; - console = 0; - - for (i=0 ; i<numnetnodes ; i++) - { - if (nodesetup[i].drone) - continue; - total++; - if (total > MAXPLAYERS) - Error (STR_MORETHAN,MAXPLAYERS); - if (memcmp (&nodeadr[i], &nodeadr[0], sizeof(nodeadr[0])) < 0) - console++; - } - - - if (!total) - Error (STR_NONESPEC); - - doomcom.consoleplayer = console; - doomcom.numplayers = total; - - printf (STR_CONSOLEIS"\n", console+1, total); -} - - -//======================================================== -// -// Find a Response File -// -//======================================================== -void FindResponseFile (void) -{ - int i; - #define MAXARGVS 100 - - for (i = 1;i < myargc;i++) - if (myargv[i][0] == '@') - { - FILE * handle; - int size; - int k; - int index; - int indexinfile; - char *infile; - char *file; - char *moreargs[20]; - char *firstargv; - - // READ THE RESPONSE FILE INTO MEMORY - handle = fopen (&myargv[i][1],"rb"); - if (!handle) - Error (STR_NORESP); - printf(STR_FOUNDRESP" \"%s\"!\n",strupr(&myargv[i][1])); - fseek (handle,0,SEEK_END); - size = ftell(handle); - fseek (handle,0,SEEK_SET); - file = malloc (size); - fread (file,size,1,handle); - fclose (handle); - - // KEEP ALL CMDLINE ARGS FOLLOWING @RESPONSEFILE ARG - for (index = 0,k = i+1; k < myargc; k++) - moreargs[index++] = myargv[k]; - - firstargv = myargv[0]; - myargv = malloc(sizeof(char *)*MAXARGVS); - memset(myargv,0,sizeof(char *)*MAXARGVS); - myargv[0] = firstargv; - - infile = file; - indexinfile = k = 0; - indexinfile++; // SKIP PAST ARGV[0] (KEEP IT) - do - { - myargv[indexinfile++] = infile+k; - while(k < size && - ((*(infile+k)>= ' '+1) && (*(infile+k)<='z'))) - k++; - *(infile+k) = 0; - while(k < size && - ((*(infile+k)<= ' ') || (*(infile+k)>'z'))) - k++; - } while(k < size); - - for (k = 0;k < index;k++) - myargv[indexinfile++] = moreargs[k]; - myargc = indexinfile; - - // DISPLAY ARGS -// printf("%d command-line args:\n",myargc); -// for (k=1;k<myargc;k++) -// printf("%s\n",myargv[k]); - - break; - } -} - - -/* -============= -= -= main -= -============= -*/ - -void main (void) - { - int i; - unsigned char far *vector; - -// -// determine game parameters -// - gameid = 0; - numnetnodes = 2; - doomcom.ticdup = 1; - doomcom.extratics = 1; - doomcom.episode = 1; - doomcom.map = 1; - doomcom.skill = 2; - doomcom.deathmatch = 0; - - printf("\n" - "-----------------------------\n" - #ifdef DOOM2 - STR_DOOMNETDRV"\n" - #else - "DOOM NETWORK DEVICE DRIVER\n" - #endif - "v1.22\n" - "-----------------------------\n"); - - myargc = _argc; - myargv = _argv; - FindResponseFile(); - - if((i = CheckParm("-nodes")) != 0) - numnetnodes = atoi(myargv[i+1]); - - if((i = CheckParm("-vector")) != 0) - { - doomcom.intnum = sscanf ("0x%x",myargv[i+1]); - vector = *(char far * far *)(doomcom.intnum*4); - if(vector != NULL && *vector != 0xcf) - { - printf(STR_VECTSPEC"\n", doomcom.intnum); - exit(-1); - } - } - else - { - for(doomcom.intnum = 0x60 ; doomcom.intnum <= 0x66 ; -doomcom.intnum++) - { - vector = *(char far * far *)(doomcom.intnum*4); - if(vector == NULL || *vector == 0xcf) - break; - } - if(doomcom.intnum == 0x67) - { - printf(STR_NONULL"\n"); - exit(-1); - } - } - printf(STR_COMMVECT"\n",doomcom.intnum); - - if((i = CheckParm("-port")) != 0) - { - socketid = atoi (myargv[i+1]); - printf (STR_USEALT"\n", socketid); - } - - InitNetwork (); - - LookForNodes (); - - localtime = 0; - - LaunchDOOM (); - - ShutdownNetwork (); - - if (vectorishooked) - setvect (doomcom.intnum,olddoomvect); - - exit(0); - } - - diff --git a/ipx/IPXSTR.H b/ipx/IPXSTR.H @@ -1,19 +0,0 @@ -#define STR_NETABORT "Network game synchronization aborted." -#define STR_UNKNOWN "Got an unknown game packet during setup" -#define STR_FOUND "Found a node!" -#define STR_LOOKING "Looking for a node" -#define STR_MORETHAN "More than %i players specified!" -#define STR_NONESPEC "No players specified for game!" -#define STR_CONSOLEIS "Console is player %i of %i" -#define STR_NORESP "No such response file!" -#define STR_FOUNDRESP "Found response file" -#define STR_DOOMNETDRV "DOOM II NETWORK DEVICE DRIVER" -#define STR_VECTSPEC "The specified vector (0x%02x) was already hooked." -#define STR_NONULL \ -"Warning: no NULL or iret interrupt vectors were found in the 0x60 to 0x66\n"\ -"range. You can specify a vector with the -vector 0x<num> parameter." -#define STR_COMMVECT "Communicating with interrupt vector 0x%x" -#define STR_USEALT "Using alternate port %i for network" -#define STR_RETURNED "Returned from DOOM II" -#define STR_ATTEMPT "Attempting to find all players for %i player net play. "\ - "Press ESC to exit.\n" diff --git a/ipx/IPX_FRCH.H b/ipx/IPX_FRCH.H @@ -1,21 +0,0 @@ -#define STR_NETABORT "Synchronisation du jeu sur r‚seau annul‚e." -#define STR_UNKNOWN "Paquet de jeu inconnu durant la configuration" -#define STR_FOUND "Noeud d‚tect‚!" -#define STR_LOOKING "Recherche d'un noeud" -#define STR_MORETHAN "Plus de %i joueurs sp‚cifi‚s!" -#define STR_NONESPEC "Pas de joueurs sp‚cifi‚s pour le jeu!" -#define STR_CONSOLEIS "Console: joueur %i sur %i" -#define STR_NORESP "Ce fichier de r‚ponse n'existe pas!" -#define STR_FOUNDRESP "Fichier de r‚ponse trouv‚" -#define STR_DOOMNETDRV "GESTIONNAIRE DE RESEAU DOOM II" -#define STR_VECTSPEC "Le vecteur sp‚cifi‚ (0x%02x) ‚tait d‚j… connect‚." -#define STR_NONULL \ -"Attention: pas de vecteurs d'interruption NULL ou iret trouv‚s entre 0x60 et 0x66.\n"\ -"Vous pouvez sp‚cifier un vecteur avec le paramŠtre -vector 0x<num‚ro>." -#define STR_COMMVECT "Communication avec le vecteur d'interruption 0x%x" -#define STR_USEALT "Utilisation du port alternatif %i pour le r‚seau" -#define STR_RETURNED "Retour de DOOM II" -#define STR_ATTEMPT \ -"Tentatative de recherche de tous les joueurs pour le jeu en riseau `%i jouers\n" \ -"Appuyez sur ECHAP pour quitter.\n" - diff --git a/ipx/README b/ipx/README @@ -1 +0,0 @@ -This is the source for the DOOM ipx network driver. diff --git a/linuxdoom-1.10/CVS/Entries b/linuxdoom-1.10/CVS/Entries @@ -1,109 +0,0 @@ -/ChangeLog/1.14/Mon Feb 3 22:45:08 1997// -/DOOMLIC.TXT/1.3/Sun Jan 26 07:44:56 1997// -/FILES/1.1/Sun Jan 19 17:22:41 1997// -/FILES2/1.1/Sun Jan 19 17:22:42 1997// -/Makefile/1.6/Mon Feb 3 22:45:08 1997// -/am_data.h/1.2/Tue Jan 21 18:59:56 1997// -/am_map.c/1.4/Mon Feb 3 21:24:33 1997// -/am_map.h/1.2/Tue Jan 21 18:59:56 1997// -/d_englsh.h/1.1/Mon Feb 3 21:48:03 1997// -/d_event.h/1.2/Mon Feb 3 22:01:47 1997// -/d_french.h/1.3/Mon Feb 3 21:48:03 1997// -/d_main.c/1.8/Mon Feb 3 22:45:09 1997// -/d_net.c/1.3/Mon Feb 3 22:01:47 1997// -/d_textur.h/1.1/Mon Feb 3 16:47:51 1997// -/doomdata.h/1.5/Mon Feb 3 22:45:09 1997// -/doomdef.h/1.9/Mon Feb 3 22:45:09 1997// -/doomtype.h/1.2/Mon Feb 3 22:45:09 1997// -/dstrings.h/1.4/Mon Feb 3 21:48:03 1997// -/dutils.c/1.5/Mon Feb 3 17:11:23 1997// -/dutils.h/1.4/Mon Feb 3 17:11:23 1997// -/f_finale.c/1.5/Mon Feb 3 21:26:34 1997// -/f_finale.h/1.1/Mon Feb 3 21:26:34 1997// -/f_wipe.c/1.2/Mon Feb 3 22:45:09 1997// -/f_wipe.h/1.1/Mon Feb 3 17:11:23 1997// -/fpfunc.S/1.1/Sun Jan 19 17:22:43 1997// -/g_game.c/1.8/Mon Feb 3 22:45:09 1997// -/g_game.h/1.1/Mon Feb 3 21:34:47 1997// -/hu_lib.c/1.3/Sun Jan 26 07:44:58 1997// -/hu_lib.h/1.4/Mon Feb 3 16:47:52 1997// -/hu_stuff.c/1.4/Mon Feb 3 16:47:52 1997// -/hu_stuff.h/1.3/Sun Jan 26 07:44:58 1997// -/i_dga.c/1.3/Sun Jan 26 07:44:58 1997// -/i_ibm.c/1.3/Sun Jan 26 07:44:58 1997// -/i_main.c/1.4/Mon Feb 3 22:45:10 1997// -/i_pcnet.c/1.3/Sun Jan 26 07:44:59 1997// -/i_sound.c/1.3/Sun Jan 26 07:44:59 1997// -/i_sound.h/1.3/Sun Jan 26 07:44:59 1997// -/i_svga.c/1.3/Sun Jan 26 07:44:59 1997// -/i_unix.c/1.5/Mon Feb 3 22:45:10 1997// -/i_x.c/1.6/Mon Feb 3 22:45:10 1997// -/info.c/1.3/Sun Jan 26 07:45:00 1997// -/info.h/1.3/Sun Jan 26 07:45:00 1997// -/irix.c/1.3/Sun Jan 26 07:45:00 1997// -/irix.h/1.3/Sun Jan 26 07:45:01 1997// -/linux.c/1.3/Sun Jan 26 07:45:01 1997// -/m_argv.c/1.1/Mon Feb 3 22:45:10 1997// -/m_argv.h/1.1/Mon Feb 3 22:45:10 1997// -/m_bbox.c/1.1/Mon Feb 3 22:45:10 1997// -/m_bbox.h/1.1/Mon Feb 3 22:45:10 1997// -/m_cheat.c/1.1/Mon Feb 3 21:24:34 1997// -/m_cheat.h/1.1/Mon Feb 3 21:24:34 1997// -/m_menu.c/1.7/Mon Feb 3 22:45:10 1997// -/m_menu.h/1.1/Mon Feb 3 22:01:49 1997// -/m_misc.c/1.6/Mon Feb 3 22:45:10 1997// -/m_misc.h/1.1/Mon Feb 3 22:45:11 1997// -/m_random.c/1.1/Mon Feb 3 22:45:11 1997// -/m_random.h/1.1/Mon Feb 3 22:45:11 1997// -/p_ceilng.c/1.4/Mon Feb 3 16:47:53 1997// -/p_doors.c/1.4/Mon Feb 3 16:47:53 1997// -/p_enemy.c/1.5/Mon Feb 3 22:45:11 1997// -/p_floor.c/1.4/Mon Feb 3 16:47:54 1997// -/p_inter.c/1.4/Mon Feb 3 22:45:11 1997// -/p_lights.c/1.5/Mon Feb 3 22:45:11 1997// -/p_local.h/1.3/Tue Jan 28 22:08:27 1997// -/p_map.c/1.5/Mon Feb 3 22:45:11 1997// -/p_maputl.c/1.5/Mon Feb 3 22:45:11 1997// -/p_mobj.c/1.5/Mon Feb 3 22:45:12 1997// -/p_plats.c/1.5/Mon Feb 3 22:45:12 1997// -/p_pspr.c/1.5/Mon Feb 3 22:45:12 1997// -/p_setup.c/1.5/Mon Feb 3 22:45:12 1997// -/p_sight.c/1.3/Tue Jan 28 22:08:28 1997// -/p_spec.c/1.6/Mon Feb 3 22:45:12 1997// -/p_spec.h/1.3/Tue Jan 28 22:08:29 1997// -/p_switch.c/1.3/Tue Jan 28 22:08:29 1997// -/p_telept.c/1.3/Tue Jan 28 22:08:29 1997// -/p_tick.c/1.4/Mon Feb 3 16:47:55 1997// -/p_user.c/1.3/Tue Jan 28 22:08:29 1997// -/r_bsp.c/1.4/Mon Feb 3 22:45:12 1997// -/r_data.c/1.4/Mon Feb 3 16:47:55 1997// -/r_draw.c/1.4/Mon Feb 3 16:47:55 1997// -/r_local.h/1.4/Mon Feb 3 21:26:34 1997// -/r_main.c/1.5/Mon Feb 3 22:45:12 1997// -/r_plane.c/1.4/Mon Feb 3 16:47:55 1997// -/r_segs.c/1.3/Wed Jan 29 20:10:19 1997// -/r_things.c/1.5/Mon Feb 3 16:47:56 1997// -/s_sound.c/1.6/Mon Feb 3 22:45:12 1997// -/sounds.c/1.3/Wed Jan 29 22:40:44 1997// -/sounds.h/1.3/Wed Jan 29 22:40:44 1997// -/soundsrv.c/1.3/Wed Jan 29 22:40:44 1997// -/soundsrv.h/1.3/Wed Jan 29 22:40:44 1997// -/soundst.h/1.3/Wed Jan 29 22:40:45 1997// -/st_lib.c/1.4/Mon Feb 3 16:47:56 1997// -/st_lib.h/1.4/Mon Feb 3 16:47:56 1997// -/st_stuff.c/1.6/Mon Feb 3 22:45:13 1997// -/st_stuff.h/1.3/Thu Jan 30 19:54:22 1997// -/sun.c/1.3/Thu Jan 30 19:54:22 1997// -/tables.c/1.4/Mon Feb 3 16:47:57 1997// -/tables.h/1.1/Mon Feb 3 16:47:57 1997// -/tmap.S/1.1/Sun Jan 19 17:22:51 1997// -/v_video.c/1.5/Mon Feb 3 22:45:13 1997// -/v_video.h/1.2/Mon Feb 3 17:11:59 1997// -/w_wad.c/1.5/Mon Feb 3 16:47:57 1997// -/wadread.c/1.3/Thu Jan 30 19:54:23 1997// -/wadread.h/1.3/Thu Jan 30 19:54:23 1997// -/wi_data.h/1.3/Thu Jan 30 19:54:23 1997// -/wi_stuff.c/1.7/Mon Feb 3 22:45:13 1997// -/wi_stuff.h/1.4/Mon Feb 3 16:47:58 1997// -/z_zone.c/1.4/Mon Feb 3 16:47:58 1997// -/z_zone.h/1.1/Mon Feb 3 16:47:58 1997// diff --git a/linuxdoom-1.10/CVS/Repository b/linuxdoom-1.10/CVS/Repository @@ -1 +0,0 @@ -/info/cvsroot/id/id_doom diff --git a/linuxdoom-1.10/CVS/Root b/linuxdoom-1.10/CVS/Root @@ -1 +0,0 @@ -/info/cvsroot/ diff --git a/linuxdoom-1.10/ChangeLog b/linuxdoom-1.10/ChangeLog @@ -1,922 +0,0 @@ - - - - * TODO: see below, and in the "TODO" file. Enjoy! - -Mon Dec 22 20:29:16 1997 <bk@gamers.org> - - * CVS logs and other obsolete stuff removed. Anybody - who wants to keep some revision control now has a - clean slate to start with. - -Mon Dec 22 19:53:34 1997 <bk@gamers.org> - - - * i_sound.c: enabled SNDSERV, as SNDINTR for - some reason just gives ghastly results e.g. - on E4M2. Frankly, I am at a loss. SNDSERV is - now default, until the internal sound driver - is a bit more reliable. - Note that the current redundancy means that - changes like the one below will have to - be propagated manually to the soundserver - sources. - - * m_menu.c: the 4th episode is now removed with - the original doom.wad. You need to rename the - Ultimate DOOM/Special Edition retail IWAD to - doomu.wad now, or you won't see the 4th episode - in the menu. The compile time SPECIAL define - is thus gone. - -Mon Dec 22 17:08:33 1997 <bk@gamers.org> - - * v_video.c (V_DrawPatch): another last minute hack. - While shareware, retail, commercial, and plutonia - (being a full DOOM2 IWAD) seem to work okay now, - TNT gives an error on finishing the first mission: - "Patch at -35, -5 exceeds LFB". - I changed the error abort into a simple return, - thus the patch is ignored. The intermission screen - seems to come up okay. - * TODO: check which patch, and whether it is an IWAD - problem. - - * i_sound.c: the sound table is hardwired in - sounds.h/sounds.c. As our current crude - sound handling simply loads *all* sounds at - startup, we are going to miss some with DOOM1 - WAD files. I could skip them, but decided to - load a placeholder instead (dspistol). It might - be good to use a distinct default sound for - WAD debug purposes. A zero length sound lump - would work, but would not be noticeable. - Anyway, shareware and retail work now. - * TODO: implement proper handling for missing - lumps, sound and otherwise. - Perhaps move sound table into WAD? - - * g_game.c (G_DoPlayDemo): finally removed the - annoying "Demo is from a different game version" - abort. It now simply declines to playback the - demo, and waits for user input on some - do_nothing screen. - - * doomdef.h&Cie.: Lesson of the day - do not - replace a bunch of booleans with an enum and - use the same identifiers. Point in case: - "if ( commercial )" will not give an error, - and will always be true as long as the enum - value is greater than zero. - I found that the DOOM2 vs. DOOM differences - are everywhere (weapons, monsters, doors). - Number of episodes varies from shareware/commercial - to registered to retail, while commercial has - a unique set (two of them, counting the german - edition) of maps in one episode. Plus, TNT and - Plutonia add some TITLE strings to the mixture. - - Well, Plutonia and TNT are treated as DOOM2 for - now, so you will miss the startup message. - - * wi_stuff.h (NUMEPISODES): removed SPECIAL switch. - It is no 4 times 9 for wi_stuff.c internal - static arrays - doesn't matter. - * TODO: unified handling with DOOM 2 - dynamic - allocation of arrays. - - * i_sound.c (I_UpdateSound): okay, I separated - the mixing, now done synchonously, along with - a flag signalling the timer that the mixing buffer - has been updated. The handler is now very short, - and I tried several intervals down to 50usecs, - w/o complaints. Now the man page says: - "system timer resolution currently 10ms". Odd. - Anyway, while the double shotgun/plasma rapid - fire problem seems to be a bit less disturbing - at higher refresh, it's still there. I set the - interval to 500usec, which is sufficient for - avoiding any buffer update misses. - Conclusion after just two days of experimentation: - yep, sound driver code isn't fun at all. - - As for the bug - well, Dave Taylor suggested - close distance getting into a divide-by-near-zero - situation, screwing up the volume. I can't figure - why latency of an external sound driver or screen - size affect this, but I am running out of ideas. - - * i_sound.c: - Some more experimentation with the timer driven - sound. It doesn't work well using an intervall - of less then 30 msecs - there will be artifacts - with say 50 msecs. This is pretty obvious with - a target frame rate of at least 30fps, methinks. - Using the REAL/SIGALRM timer with 30msec gets - rid of the artifacts, it seems - at the expense - of slowing down things on a P133 to a noticeable - jerkiness. Bah. - -Mon Dec 22 00:36:54 1997 <bk@gamers.org> - - * info.c: and i_video.c and i_sound.c - don't ask - me why some Linux header files are different with - gcc vs. g++, or what the complaint about the g++ - complaint info.c state table is all about: - "initializer element for `states[..].action.acp1' - is not constant" - Undid some changes, compiled with gcc, playtested, - seems okay. Done for today... yesterday. - - * i_net.c (ntohl): okay, htons/htonl, ntohs,ntohl - are back to haunt me. Copied the macros that - on my box aren't used for whatever reason directly - into the source. Got rid of all other multiple and - undefined references. CC=g++ now compiles (still - many warnings) and links, but the binary dumps a - core after Init PlayLoop. So be it. - -Sun Dec 21 12:38:08 1997 <bk@gamers.org> - - * p_enemy.c (P_NewChaseDir): changed tdir to int, - removed the LUTs - spurious locks were due to - endless loops created by boneheaded predecessor - map. Has to be a better way to do enum dirtype_t - anyway. Problem seems to be fixed. - - * CC=gcc again, this time loads of #includes to - fix "implicit declarations, and one or two - unused variables. DOOM now compiles without - any -Wall warnings left, as C. - - * Bug: compiled the reworked code with gcc. Within a - solid while of testing and blasting away, it - locked once. Got a core, which gdb doesn't grok. - Bah. - - * TODO: okay, linkage of g++ build modules give loads - of errors, because we have many implicits, plus - missing #pragma implementation causing multiple - definitions. Yet, this is the very first time DOOM - was compiled as C++ without a parsing error. So there. - - * sounds.c: included doomtype.h and removed yet another - enum { false, true } definition. - - * p_saveg.c (misc): several. - * p_mobj.c (P_SpawnMobj): (actionf_p1)P_MobjThinker - * p_spec.c (EV_DoDonut): (action_p1) T_MoveFloor (twice). - * p_plats.c (EV_DoPlat): (actionf_p1) T_PlatRaise. - * p_plats.c (EV_StopPlat): (actionf_v)NULL. - * p_plats.c (P_ActivateInStasis): same - * p_lights.c (P_SpawnGlowingLight): (actionf_p1) T_Glow. - * p_lights.c (P_SpawnStrobeFlash): (actionf_p1) T_StrobeFlash. - * p_lights.c (P_SpawnLightFlash): (actionf_p1) T_LightFlash. - * p_lights.c (P_SpawnFireFlicker): (actionf_p1) T_FireFlicker. - * p_floor.c (EV_DoFloor): (actionf_p1) T_MoveFloor. - * p_floor.c (EV_BuildStairs): same (twice). - * p_doors.c (EV_VerticalDoor): (actionf_p1)T_VerticalDoor. - * p_doors.c (P_SpawnDoorCloseIn30): same - * p_doors.c (P_SpawnDoorRaiseIn5Mins): same - * p_doors.c (EV_DoDoor): same - * p_ceilng.c (EV_CeilingCrushStop): (actionf_v)NULL. - * p_ceilng.c (EV_DoCeiling): (actionf_p1)T_MoveCeiling. - * p_ceilng.c (P_ActivateInStasisCeiling): same. - These gave g++ errors, but have been ignored by gcc. - - * r_data.c (R_PrecacheLevel): (actionf_p1)P_MobjThinker. - - * p_saveg.c: conversions (actionf_p1)T_Whatever. - - * p_tick.c: cast (actionf_v)(-1). - - * p_telept.c: yet another (actionf_p1)P_MobjThinker. - - * p_mobj.c (P_MobjThinker): cast (actionf_v)(-1). - * TODO: decent NOP/NULL/Nil function pointer. - I'd introduce a global A_NOP() function that - chokes up an error message. - Why -1 instead of NULL? - - * p_enemy.c: conversions (actionf_p1)P_MobjThinker. - - * d_think.h/info.h: think_t is essentially - the same action function pointer stuff. - I moved the definitions from info.h to - d_think.h, and aliased them with a typedef. - Now more changes needed. - - * p_enemy.c (successor, predecessor): new LUT, - to provide increments/decrements for enum - dirtype_t, as g++ complaints: - "no post-increment/decrement operator for type" - - * Makefile (CC): okay, tried "g++" once more. - A few errors (above). Plus shitloads of warnings - (obviously, better "unused" checking with C++, - lots of the usual int2enum suspects, implicit - declarations, the works). - - - * p_mobj.c: action.acp1 used accordingly. - * p_pspr.c: action.acp2 used accordingly. - * TODO: info.c:144 warning - "missing braces around initializer for `states[0].action'" - - * info.h/info.c: some experimental stuff on - action function pointers. - - * TODO: still some sound glitches at startup. - * i_sound.c: few more cleanups. Made mixing use - channel loop instead of unroll, set mixbuffer - to zero ot start. - Removed some more DOS leftovers (8bit), - kept some as comment. - - * hu_stuff.c (HU_Start): - More gamemode changes. As in d_main.c, I - decided to use DOOM2 as default whenever - one needed - it was sold most, and had the - superset of items, enemies and monsters. - - * TODO: the handling of WAD specific messages - like HU_TITLE, HU_TITLE2, HU_TITLEP etc. - should definitely be removed. - - * d_main.c (CheckBetaTest): - Removed outdated, DOS specific BETATEST stuff. - d_main.c (IdentifyVersion): - Numerous changes to gamemode handling. - - * TODO: currently, french language is enabled by - detecting an doom2f.wad - yet it needs FRENCH - define at compile time. I removed most language - stuff, and propose handling that at runtime, - using a switch in the config file. Well, - mission specific texts won't work outside the - WAD anyway. - - * TODO: along the same lines: I suggest removing - the misc. devparm switches as well - lots of - redundancy not needed anymore. - - * Makefile: finally added a doomstat.c for all - the global state variables listing internal - engine configuration. Right now, these are - scattered everywhere. Declaration to be found - in doomstat.h header. - - * f_finale.c (F_StartFinale): - Reworked the entire finale handling based on - game mode enum. - - * doomstat.h: - Global variables for game mode and language. - Removed old booleans. - - * doomdef.h: GameMode_t and Language_t enum added. - Boolean for language was kinda limiting to 2 - alternatives (french, english), and five boolean - plus #define SPECIAL for game version is just ugly. - - * wi_stuff.h: SPECIAL switch compiles two - different EXE's, one for 3 episodes of 9 maps - each (DOOM 1 registered), one for 4 episodes - of 9 maps each (DOOM 1 retail/FinalDOOM). - Implicitely, the DOOM2 config (one episode, - 34 missions) is handled. How is the german - edition (32 missions only) done? - Frankly, this is a mess. The problem is that - intermission (animated as in DOOM 1, simple - backdrop as in DOOM2) as well as certain - items (double shotgun) as well as certain - rendering stuff (sky texture) depend on this. - - Plus, it ties into runtime flags as "commercial" - as well. Yuck. - - Each change will change the game. Postponed. - - * d_net.c,m_misc.c: removed last two NeXT remains. - - * d_englsh.h,d_french.h,d_main.c,m_misc.c,r_draw.c,v_video.c: - more WATCOM remains removed. Kept some stuff that - handeld the blocky mode/detailshift in DOS, which - is n.a. in Linux - but probably not worth fixing. - -Sat Dec 20 15:16:51 1997 <bk@gamers.org> - - * Bug: core dump when using doom.wad or doom1.wad - without a "-file UNUSED/doom2.wad". Version - dependend handling of stuff (double shotgun) - comes to mind. - - * doomdef.h: - SNDSERV enables external sound server - support. SNDINTR enables internal sound - output with timer (asynchronous). Default - is internal, synchronous. - - * i_sound.c (I_HandleSoundTimer): - Okay, the plasma/double shotgun sound bug - (crapyy sund when firing nose-to-wall) is - obviously a problem with blocking at - refresh - smaller screen size makes it go - away. - I won't do threads w/o a proper gdb, and - I can't do whatever Dave Taylor did with - LinuxQuake w/o the sources, thus I broke - down and implemented a timer based solution. - Seems to work fine, given the fact that - this is the first time ever I implemented - sound handling. - -Fri Dec 19 10:02:48 1997 <bk@gamers.org> - - * m_menu.c/i_sound.c/s_sound.c: - Removed a few more inconsistencies due to - old internal sound handling (DOS), - external (Linux sndserver), and - new internal (the unfinished merge of - both the former). - The Options/Sound/Music volume menu is - accessible now. It was due to an internal - scaling of the menu (effective range 0-15), - up to 0..120, by multiply with 8 scattered - all over the place, that we got a - v_video.c: I_Error ("Bad V_DrawPatch") - Now I am using the menu resolution - everywhere, and scaling should only be done - in the actual mixing/output. - - * OK, obviously this hasn't been updated in months. - This is because: a) most of the time nothing - happened, and b) when something got done, it was - too much to keep track of it by CVS and/or ChangeLog. - - Basically, what happened in the meantime is that - I did not find a publisher who believed that the book - sales would be worth doing it. Within the limited - amount of time that I could dedicate to a project - that will not generate any revenue whatsoever, - I spent some time on cleaning up the Linux code - base which works, essentially. I might or might not - be able to participate in a Mesa+Voodoo+Glide based - GLDOOM port for Linux. I won't waste a minute on - Win32 without getting paid for it. - - Because of the legal issues involved with the - DMX sound library id licensed for DOS DOOM, Linuxdoom - is the only code base that has sound support at all. - Other UNIX ports (SGI, Sun) could probably be revived - and integrated w/o too many problems. There is no - Win32 port - I never had access to WinDOOM or - Jim Dose's GLDOOM sources. There is no Linux - OpenGL (read: Mesa) support yet - that'd involve - internal changes which will best be done after a - public source release. - - John Carmack opted for a release of the Linux code. - I have removed all DMX references I could get a - hold of, but preserved some of the original - sound handling within DOOM that interfaced - with DMX. Linuxdoom (like previous UNIX ports) - used a separate sound server binary. I did some - work on putting the sound server module back into - the engine. It works, but shutdown (pending sounds), - and sound output parallel to refresh (blocking) - is crappy, and there is a problem with double - shotgun and plasma at close distance (as well as - with lots of other noises going on). As the - mixing code is identical to the separate - soundserver, and as it doesn't seem to be a - blocking issue, I am currently at a loss - I - wonder whether the IPC communication with the - soundserver process introduced a delay that - changed behaviour, or whether I simply overlooked - a bug. I am currently lacking the time to track - this down, so I am keeping both internal and - soundserver source. - - I did remove DOS and Watcom specifics. I did also - remove the texture mapping and fixed point assembly. - From my experience, it isn't worth the trouble - to ue GCC inline assembler, as performance of - the same loop written in C is perfectly sufficient. - On demand I will put both assembly modules into some - documentation, as they are probably of historic - interest. - - There is no Sun DGA, Irix, or other non-Linux stuff - in this code base (at least, not intentionally). - They will be back when ports to other UNIX - environments will be merged back (I can't do - testing, and the modules were separate and not - consistent, so I refrained from wasting time on - this prior to a public release). - - While I made only minor changes to the actual code - (some fixes, some cleaning up of SHM and audio), - I did a huge amount of shuffling around. I - introduced many more header files and modules, - some of them laughably small (doing these changes - is bound to screw up CVS, so no CVS record anymore - for the time being). I would introduce even more - separation if I had the time. Splitting the - animation/AI/behaviour code that defines - "DOOM - The Game" into a separate game.so (like - Quake2 does) should definitely be done. Separating - a ref_soft.so aka "DOOM - The Engine", and defining - a clean interface prior to introducing a ref_gl.so - is recommended as well. - - I am going to purge some more leftovers, remove - the obsolete CVS history except for comments, - and try to clean up the last "implicit declaration" - and "unused variable" warnings. Except for enabling - cheats in nightmare (to have more fun while testing), - I did not change the game mechanics at all. I would - strongly advise against doing so w/o the proper - separations suggested above. I will not waste time - on fixing detail and blocky mode, lack of resize, - or other stuff that it better addressed by a proper - GLDOOM port. - - -Sat Aug 16 08:07:16 1997 <bk@hal.gamers.org> - - * p_pspr.c: - Moved the sprite animation stuff from doomdef.h here. - - * info.h: - Added #ifndef __INFO__ for multiple inclusion. I am - not going to deal with multigen, or changing the - original DOOM monster animation anyway. - - * p_spec.h/c: - Moved anim_t etc., locally used only. There is - another anim_t in wi_stuff.h/c, now local as well, - so collisions on header inclusion should not occur. - #include "doomdef.h" - #include "doomstat.h" - these should now be topmost includes. - - * doomstat.h, doomdef.h, wi_stuff.h, d_player.h: - I moved wbstartstruct_t to d_player.h, and wminfo - to doomstat.h. Basically, I will try to move all - global state related stuff into doomstat.h, and - all data structures defined for state variables - into doomdef.h - this will be kinda greek tragedy, - and never finished, but a body can try. - - * wi_stuff.h/c, wi_data.h: - Removed wi_data.h, put all local stuff blah... see - below. - I have found several unused global variables, - started outcommenting them with //U, will remove - them later. It might be Watcom/PC stuff, or - somebody put the actual numbers into the implementation - instead of using STARDIST, ANIMPERIOD & Cie. - - * st_stuff.h/c: from doomdef.h, local stuff moved - into st_stuff.c, etc. - In the current revisions, I am tolerating warnings - of the "implicit declaration" kind - the linker - resolves the stuff, and it will be handy in - unmangling the modules once the headers contain - only the globally visible stuff. - - * am_map.h/c, am_data.h: - Removed am_data.h, put all local stuff into - am_map.c, moved globally needed headers from - doomdef.h into am_map.h. - - * p_saveg.h, p_setup.h, p_tick.h: - created, stuff from doomde.h moved there - - * d_main.c, d_net.c, doomdef.h: - Decided to dump mprintf, as only needed for - Watcom support which is not going to happen. - - * doomdef.h: - Moved function prototypes to appropriate headers: - d_main.h, d_net.h. - -Fri Aug 15 16:38:53 1997 <bk@hal.gamers.org> - - * doomstat.h: - added a few more comments, regrouped some of the - state variables. - - * doomdata.h: added a few more comments. - -Thu Aug 14 10:38:37 1997 <bk@hal.gamers.org> - - * g_game.c (G_DoLoadLevel): - copied the skyflatnum determination here, from - the R_InitSkyMap - once should be sufficient. - - * Makefile, r_sky.h/c: - added r_sky module. The sky handling was scattered - over r_bsp, r_main, r_plane, doomstat.h... - - * r_bsp.c, r_main.c, r_segs.c: - Removed RD_* calls from R_debug.m, NeXT switches. - - * r_local.h: - Removed the R_debug.m NeXT specific debugging - code headers. Removed "drawbsp" flag from - here, and r_main.c, too. - - * r_data.c: - Started to remove NORMALUNIX switches, using - LINUX instead. Basically, different UNIX - platforms using the same code should simply - be ANDed in the #ifdef switches. - - * r_draw.c: - Removed some more, but not all WATCOMC support. - There is an unresolved problem with the fuzzy - blitting in the lowres (blocky) modes - either - the "detailshift" flag triggered lowres mode - will be removed, or the bug has to be fixed. - - * r_bsp.h, r_draw.h, r_things.h, r_data.h, - r_segs.h, r_main.h, r_plane.h: - Created from r_local.h. - - * Back to work. - Till March 22nd, a lot of source shuffling and addition - of new header files, separating stuff, and creating - new, smaller modules. Some Watcom/PC/DMX/NeXT etc. - related stuff got removed, but not all (yet). None of - this ended up in the Log (sorry) or the revision control - (CVS is not well suited while number of files and - respective names change a lot, especially if stuff gets - deleted and/or re-introduced). - Major change: part of the sound code got copied from the - separate Linux sndserver sources to the linuxdoom source. - Re-integration and removal of sndserver pending. - Nothing of importance happend since then (priorities). - -Mon Feb 3 16:41:05 1997 <bk@gamers.org ()> - - * m_misc.c: - Created m_argv, m_random and m_bbox, kept remains in m_misc - for the time being. Misc. files changed to include only - necessary modules. Moved bbox definitions from doomdata.h. - - * m_menu.h: - Created from doomdef.h. Misc. changes in dependend modules. - I am not going to list every affected file from now on. - See Log entries within each file. - - * dstrings.h: - Now handles multi-language support and switches. - So far, only english (default) and french are available. - - * d_englsh.h: - Created from dstrings.h. - - * g_game.h: - Created, from doomdef.h. - - * am_map.c, st_stuff.c, wi_stuff.c: - * Makefile: - Added m_cheat, removed dutils. Doubly linked list stuff unused. - - * m_cheat.h, m_cheat.c: - Created, basci cheat string scrambling and check, from dutils.h - and dutils.c. - - * doomdef.h - Moved screen declaration to v_video.h. - - * dutils.h, dutils.c - Remode code for f_wipe.h and f_wipe.c. - - * Makefile - * d_main.c, - Added f_wipe files. - - * f_wipe.h, f_wipe.c: - Created, screen wipe/melt at mission begin, from dutils.h - and dutils.c. - - * d_textur.h: - Created from doomdata.h. Separates all the patch/texture - defintions. Needed for v_video module. - - * r_local.h, wi_stuff.h, st_lib.h, hu_lib.h: - * i_x.c, d_main.c, m_menu.c, m_misc.c: - Added v_video.h. - - * v_video.h: - Created. Using headers from doomdef.h. Forward of patch_t. - Moved bool and byte to doomtype.h. - -Thu Jan 30 20:50:16 1997 <bk@gamers.org ()> - - * doomtype.h: - Created, for fixed_t. Should add angle_t here, too. - - * tables.c: - Added SlopeDiv from r_main.c, added all defines and typedefs - related to basic trig table use here, removed it. - Currently "tables.h" is included in doomdef.h and - r_local.h, too. This is not too cleanly separated, but - we have to start somewhere, right? - - * tables.h: - Created from doomdef.h. - Note that tables.c had fixed size tables, while doomdef.h - calculated from the value of FINEANGLES. In addition, - entries were given as either "int" or "fixed_t". Bad boys. - - * z_zone.c: - * s_sound.c: - * hu_stuff.c: - * st_lib.c, st_stuff.c: - * wi_stuff.c: - * w_wad.c: - * r_things.c, r_plane.c, r_draw.c, r_data.c: - * p_tick.c, p_mobj.c, p_spec.c, p_setup.c, p_lights.c, - p_plats.c, p_floor.c, p_doors.c, p_ceilng.c: - * am_map.c: - * m_misc.c, m_menu.c: - * g_game.c: - * d_main.c: - * f_finale.c: - Added #include "z_zone.h". - - * z_zone.h: - Created, from stuff in doomdef.h - - * CVS checkin. Reformatting run, last one. - Took a week to go through all the sources, w/o even - looking to closely. - - * st_stuff.c (ST_Responder): - Removed a first tiny bit of redundancy (NO_CLIP checks). - Should remove idspispod completely, later. - -Wed Jan 29 19:53:43 1997 <bk@gamers.org ()> - - * Another one, while we are on it. All S (Sound) files. - - * CVS checkin. Reformatting run, all R (Refresh) files. - - * r_draw.c (R_DrawSpanLow): - The non-Watcom, non-asm lowres mode was just a copy - of the default mode. As detailshift was used to scale - the image down, lowres mode just filled the left half - of the buffer. - * r_draw.c (R_DrawColumnLow): - Tried the same hack for walls, horribly broken. - Postponed. - -Tue Jan 28 19:32:48 1997 <bk@gamers.org ()> - - * CVS checkin. Another reformatting run. Did all P files. - - * p_spec.c: P_FindNextHighestFloor - The number of adjoining sectors is limited to 20, because - of a temporary LUT needed for determining lowest height - in adjacent sectors. No overflow checking is done. - -Sun Jan 26 08:41:21 1997 <bk@gamers.org ()> - - * Another CVS checkin of a formatting run. - D,F,G,HU,I,M have been changed. - - * Note: in initial and current release, - linuxxdoom -3 -file plutonia.wad, idclev 12 - produces a Segmentation fault. - -Wed Jan 22 14:03:00 1997 <bk@gamers.org ()> - - * m_menu.c: - initializer-string for array of chars is too long (skullName) - warning: unused parameter `int choice' (a couple of times) - - * Attempt to compile as C++. Loads of warnings, a couple of errors. - p_enemy.c (P_Move): - r_things.c (R_ProjectSprite) - `catch', `throw', and `try' are all C++ reserved words, - thus changed "try" to "try_ok". Fixed. - p_pspr.c: In function `void P_SetPsprite(struct player_s *, ... )': - too many arguments to function - No convenient fix - state->action is declared void action(), - but called w/o, with one, or with two parameters. - There are more like this. Going to be a tough one. - Union of pointers? - Postponed. - - r_plane.c: In function `void R_DrawPlanes()': - s_sound.c: In function `int S_AdjustSoundParams(struct mobj_s *, .. )': - p_map.c: In function `bool PIT_StompThing(struct mobj_s *)': - p_maputl.c: In function `int P_AproxDistance(int, int)': - r_main.c: In function `int R_PointToDist(int, int)': - p_enemy.c: In function `void P_NewChaseDir(struct mobj_s *)': - warning: implicit declaration of function `int abs(...)' <stdlib.h> - -Wed Jan 22 12:15:00 1997 <bk@gamers.org ()> - - * CVS checkin of purification run. Sources now compile - without any "-Wall" warnings. - - * Note: with -file "tnt.wad", we get an "Error: Bad V_DrawPatch" - abort each time we enter an exit. Invalid or missing - intermission screen? - - * Makefile (CFLAGS): added -Wall, first purification run. - - d_main.c: In function `D_DoomMain': - warning: implicit declaration of function `mkdir' <fcntl.h> - - i_unix.c: In function `I_StartSound': - warning: control reaches end of non-void function - i_unix.c: In function `I_InitNetwork': - warning: implicit declaration of function `inet_addr' <arpa/inet.h> - i_unix.c: At top level: - warning: `endianness' defined but not used - - i_x.c: In function `I_Error': - warning: unused variable `string' - i_x.c: In function `I_GetEvent': - warning: suggest parentheses around arithmetic in operand of | - i_x.c: In function `I_FinishUpdate': - warning: unused variable `bigscreen' - i_x.c: In function `grabsharedmemory': - warning: implicit declaration of function `getuid' <unistd.h> - warning: unused variable `done' - i_x.c: In function `I_InitGraphics': - warning: suggest parentheses around assignment used as truth value - warning: char format, different type arg (arg 3) - warning: char format, different type arg (arg 5) - warning: implicit declaration of function `XShmGetEventBase' - i_x.c: In function `InitExpand2': - warning: unused variable `jexp' - warning: unused variable `iexp' - - m_menu.c: In function `M_ReadSaveStrings': - warning: implicit declaration of function `read' <sys/types.h> - warning: implicit declaration of function `close' <unistd.h> - - m_misc.c: In function `M_WriteFile': - warning: implicit declaration of function `write' - warning: implicit declaration of function `close' - m_misc.c: In function `M_ReadFile': - warning: implicit declaration of function `read' - m_misc.c: In function `M_ScreenShot': - warning: implicit declaration of function `access' <unistd.h> - - p_pspr.c: In function `P_MovePsprites': - suggest parentheses around assignment used as truth value - - p_spec.c: In function `P_SpawnSpecials': - warning: implicit declaration of function `atoi' <stdlib.h> - - w_wad.c: In function `strupr': - warning: implicit declaration of function `toupper' <ctype.h> - w_wad.c: In function `W_AddFile': - warning: implicit declaration of function `read' <sys/types.h> - warning: implicit declaration of function `lseek' - warning: implicit declaration of function `close' <unistd.h> - - wi_stuff.c: In function `WI_loadData': - warning: unused variable `pic' - wi_stuff.c: At top level: - warning: `background' defined but not used - -Tue Jan 21 22:00:00 1997 <bk@gamers.org ()> - - * doomdata.h (__BYTEBOOL__): - Use builtin ANSI C++ bool. - - * d_main.c (IdentifyVersion): - Bug fix: insufficient malloc created errors in malloc/realloc - calls later on. Welcome to the risks of Copy'n'paste. - -Tue Jan 21 13:20:05 1997 <bk@gamers.org ()> - - * First formatting checkin. - A word of explanation: prior to making any changes to the - source, a couple of formatting runs will be made, followed - by some purification runs. - For this run, the Emacs mode selection line has been changed - to use C++ style indenting (cc-mode.el). Each file has - been automatically reformatted using Emacs indent-region. - A few files have been changed manually already (i.e., - comments, use of tabs). - Warning: using "diff" to compare files of different states - during the reformatting will not give useful results. - - * hu_stuff.c: - fixed "assignment discard const", the last remaining error - message with default compilation. - - -Sun Jan 19 14:27:06 1997 <bk@gamers.org ()> - - * Makefile: - Minor fix for sndserver target, removed linuxsdoom target - for the time being, added CVS header (kind of). - - * Initial CVS checkin. - - * soundsrv/irix/linux/sun.c: - Changed includes (irix.h removed, soundsrv.h included). - - * i_svga.c: - Changed to DOS 8+3. - - * soundsrv.h/c: - Changed to DOS 8+3, included irix.h in soundsrv.h. - - * r_local.h: - Same for PI, include math.h with Linux. - - * doomdef.h: - Got rid of multiply defined warnings for Linux, - included values.h. - - * FILES2: - created a commented list of all files, removed a few - more files (sndserver test, NeXT leftovers, DMX header). - Identified the following main modules (see FILES2): - AM, HU, M, P, R, S, ST, W, WI. Some stuff is separate - (Z, F), some not clearly separable (G, D). System specific - interfaces are in I. Some of the latter replace i_main.c - (i.e. the void/int main(argc,argv) call), e.g. SVGA, - others (X11, SHM, DGA) don't. There is a certain amount - of overlap, and the largest module (with possibly most - overlap) is P - playing, i.e. all the games state and - animation handling. - Dithering is currently not used. - -Sat Jan 18 15:14:41 1997 <bk@gamers.org ()> - - * r_draw.c: - fixed !defined(USEASM) lines for R_DrawColumn/Span. - Removed fpfunc.o/S from Makefile, now compiling - X11 w/o any assembler. - Got a running linuxxdoom again. We are in business. - This source is going to be used for the initial CVS - check in. - - * Tried a quick hack compiling it as COFF a.out instead - of ELF, with "gcc -b i486-linuxaout". Same linker - errors. - Tried removing -DUSE_ASM. Still using fpfunc.S. - - - * Tried linuxxdoom. - Compile run: some warnings (redefinition of MAX/MIN - SHORT/INT/LONG) in doomdef.h and (PI redefined) - r_local.h. - Link run: crashed, undefined references in - d_main.c: undefined reference to `FixedDiv2' - am_map.c: undefined reference to `FixedMul' - r_main.c: undefined reference to `R_DrawColumn' - r_main.c: undefined reference to `R_DrawSpan' - r_plane.c: undefined reference to `FixedMul' - - This stuff is defined in fpfunc.S (Fixed point) and - in r_draw.c (assembler in tmap.S not used). - However, "nm," shows that r_draw.o does not include - the drawing functions (see below - USE_ASM). - Furthermore, the global symbols in fpfunc.S begin - with an underscore, "_FixedMul" and "_FixedDiv2". - - More problems within fpfunc.o: undefined references to - - `_dc_yl' `_dc_yh' - `_ylookup' - `_centery' - `_dc_x' - `_columnofs' - `_dc_iscale' - `_dc_texturemid' - `_dc_source' - `_dc_colormap' - - `_ds_y' `_ds_x1' `_ds_x2' - `_ds_xfrac' `_ds_yfrac' - `_ds_xstep' `_ds_ystep' - `_ds_colormap' - `_ds_source' - - Again, underscore problem. - Note: tmap.S currently obsolete, as somebody pasted all - the texture mapping assembly into fpfunc.S. Gotta clean - that up. - - * Created initial release from CD sources, created ChangeLog. - Let the games begin. - - - ************************************************************** - DOOM source code ChangeLog file - ************************************************************** - diff --git a/linuxdoom-1.10/DOOMLIC.TXT b/linuxdoom-1.10/DOOMLIC.TXT @@ -1,112 +0,0 @@ - - - LIMITED USE SOFTWARE LICENSE AGREEMENT - - This Limited Use Software License Agreement (the "Agreement") -is a legal agreement between you, the end-user, and Id Software, Inc. -("ID"). By downloading or purchasing the software material, which -includes source code (the "Source Code"), artwork data, music and -software tools (collectively, the "Software"), you are agreeing to -be bound by the terms of this Agreement. If you do not agree to the -terms of this Agreement, promptly destroy the Software you may have -downloaded or copied. - -ID SOFTWARE LICENSE - -1. Grant of License. ID grants to you the right to use the -Software. You have no ownership or proprietary rights in or to the -Software, or the Trademark. For purposes of this section, "use" means -loading the Software into RAM, as well as installation on a hard disk -or other storage device. The Software, together with any archive copy -thereof, shall be destroyed when no longer used in accordance with -this Agreement, or when the right to use the Software is terminated. -You agree that the Software will not be shipped, transferred or -exported into any country in violation of the U.S. Export -Administration Act (or any other law governing such matters) and that -you will not utilize, in any other manner, the Software in violation -of any applicable law. - -2. Permitted Uses. For educational purposes only, you, the -end-user, may use portions of the Source Code, such as particular -routines, to develop your own software, but may not duplicate the -Source Code, except as noted in paragraph 4. The limited right -referenced in the preceding sentence is hereinafter referred to as -"Educational Use." By so exercising the Educational Use right you -shall not obtain any ownership, copyright, proprietary or other -interest in or to the Source Code, or any portion of the Source -Code. You may dispose of your own software in your sole discretion. -With the exception of the Educational Use right, you may not -otherwise use the Software, or an portion of the Software, which -includes the Source Code, for commercial gain. - -3. Prohibited Uses: Under no circumstances shall you, the -end-user, be permitted, allowed or authorized to commercially exploit -the Software. Neither you nor anyone at your direction shall do any -of the following acts with regard to the Software, or any portion -thereof: - - Rent; - - Sell; - - Lease; - - Offer on a pay-per-play basis; - - Distribute for money or any other consideration; or - - In any other manner and through any medium whatsoever -commercially exploit or use for any commercial purpose. - -Notwithstanding the foregoing prohibitions, you may commercially -exploit the software you develop by exercising the Educational Use -right, referenced in paragraph 2. hereinabove. - -4. Copyright. The Software and all copyrights related thereto -(including all characters and other images generated by the Software -or depicted in the Software) are owned by ID and is protected by -United States copyright laws and international treaty provisions. -Id shall retain exclusive ownership and copyright in and to the -Software and all portions of the Software and you shall have no -ownership or other proprietary interest in such materials. You must -treat the Software like any other copyrighted material. You may not -otherwise reproduce, copy or disclose to others, in whole or in any -part, the Software. You may not copy the written materials -accompanying the Software. You agree to use your best efforts to -see that any user of the Software licensed hereunder complies with -this Agreement. - -5. NO WARRANTIES. ID DISCLAIMS ALL WARRANTIES, BOTH EXPRESS -IMPLIED, INCLUDING BUT NOT LIMITED TO, IMPLIED WARRANTIES OF -MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE WITH RESPECT -TO THE SOFTWARE. THIS LIMITED WARRANTY GIVES YOU SPECIFIC LEGAL -RIGHTS. YOU MAY HAVE OTHER RIGHTS WHICH VARY FROM JURISDICTION TO -JURISDICTION. ID DOES NOT WARRANT THAT THE OPERATION OF THE SOFTWARE -WILL BE UNINTERRUPTED, ERROR FREE OR MEET YOUR SPECIFIC REQUIREMENTS. -THE WARRANTY SET FORTH ABOVE IS IN LIEU OF ALL OTHER EXPRESS -WARRANTIES WHETHER ORAL OR WRITTEN. THE AGENTS, EMPLOYEES, -DISTRIBUTORS, AND DEALERS OF ID ARE NOT AUTHORIZED TO MAKE -MODIFICATIONS TO THIS WARRANTY, OR ADDITIONAL WARRANTIES ON BEHALF -OF ID. - - Exclusive Remedies. The Software is being offered to you -free of any charge. You agree that you have no remedy against ID, its -affiliates, contractors, suppliers, and agents for loss or damage -caused by any defect or failure in the Software regardless of the form -of action, whether in contract, tort, includinegligence, strict -liability or otherwise, with regard to the Software. This Agreement -shall be construed in accordance with and governed by the laws of the -State of Texas. Copyright and other proprietary matters will be -governed by United States laws and international treaties. IN ANY -CASE, ID SHALL NOT BE LIABLE FOR LOSS OF DATA, LOSS OF PROFITS, LOST -SAVINGS, SPECIAL, INCIDENTAL, CONSEQUENTIAL, INDIRECT OR OTHER -SIMILAR DAMAGES ARISING FROM BREACH OF WARRANTY, BREACH OF CONTRACT, -NEGLIGENCE, OR OTHER LEGAL THEORY EVEN IF ID OR ITS AGENT HAS BEEN -ADVISED OF THE POSSIBILITY OF SUCH DAMAGES, OR FOR ANY CLAIM BY ANY -OTHER PARTY. Some jurisdictions do not allow the exclusion or -limitation of incidental or consequential damages, so the above -limitation or exclusion may not apply to you. - - - - diff --git a/linuxdoom-1.10/FILES b/linuxdoom-1.10/FILES @@ -1,98 +0,0 @@ -total 1258 --rw-r--r-- 1 b1 prog 0 Jan 18 15:08 FILES --rw-r--r-- 1 b1 prog 5799 Jan 18 15:07 Makefile --rw-r--r-- 1 b1 prog 1943 Jan 18 15:07 am_data.h --rw-r--r-- 1 b1 prog 20263 Jan 18 15:07 am_map.c --rw-r--r-- 1 b1 prog 2494 Jan 18 15:07 am_map.h --rw-r--r-- 1 b1 prog 1499 Jan 18 15:07 am_oids.c --rw-r--r-- 1 b1 prog 338 Jan 18 15:07 am_oids.h --rw-r--r-- 1 b1 prog 14005 Jan 18 15:07 d_french.h --rw-r--r-- 1 b1 prog 25287 Jan 18 15:07 d_main.c --rw-r--r-- 1 b1 prog 15586 Jan 18 15:07 d_net.c --rw-r--r-- 1 b1 prog 744 Jan 18 15:07 defs.inc --rw-r--r-- 1 b1 prog 3569 Jan 18 15:07 dither.c --rw-r--r-- 1 b1 prog 355 Jan 18 15:07 dither.h --rw-r--r-- 1 b1 prog 4234 Jan 18 15:07 doomdata.h --rw-r--r-- 1 b1 prog 32779 Jan 18 15:07 doomdef.h --rw-r--r-- 1 b1 prog 192 Jan 18 15:07 drcoord.h --rw-r--r-- 1 b1 prog 22377 Jan 18 15:07 dstrings.h --rw-r--r-- 1 b1 prog 6582 Jan 18 15:07 dutils.c --rw-r--r-- 1 b1 prog 1821 Jan 18 15:07 dutils.h --rw-r--r-- 1 b1 prog 14072 Jan 18 15:07 f_finale.c --rw-r--r-- 1 b1 prog 7357 Jan 18 15:07 fpfunc.S --rw-r--r-- 1 b1 prog 34770 Jan 18 15:07 g_game.c --rw-r--r-- 1 b1 prog 5394 Jan 18 15:07 hu_lib.c --rw-r--r-- 1 b1 prog 2878 Jan 18 15:07 hu_lib.h --rw-r--r-- 1 b1 prog 12040 Jan 18 15:07 hu_stuff.c --rw-r--r-- 1 b1 prog 934 Jan 18 15:07 hu_stuff.h --rw-r--r-- 1 b1 prog 6238 Jan 18 15:07 i_cyber.c --rw-r--r-- 1 b1 prog 18324 Jan 18 15:07 i_dga.c --rw-r--r-- 1 b1 prog 2499 Jan 18 15:07 i_header.h --rw-r--r-- 1 b1 prog 32815 Jan 18 15:07 i_ibm.c --rw-r--r-- 1 b1 prog 1867 Jan 18 15:07 i_ibm_a.asm --rw-r--r-- 1 b1 prog 121 Jan 18 15:07 i_main.c --rw-r--r-- 1 b1 prog 8251 Jan 18 15:07 i_pcnet.c --rw-r--r-- 1 b1 prog 8561 Jan 18 15:07 i_sound.c --rw-r--r-- 1 b1 prog 439 Jan 18 15:07 i_sound.h --rw-r--r-- 1 b1 prog 9537 Jan 18 15:07 i_svgalib.c --rw-r--r-- 1 b1 prog 10886 Jan 18 15:07 i_unix.c --rw-r--r-- 1 b1 prog 20891 Jan 18 15:07 i_x.c --rw-r--r-- 1 b1 prog 128797 Jan 18 15:07 info.c --rw-r--r-- 1 b1 prog 15840 Jan 18 15:07 info.h --rw-r--r-- 1 b1 prog 3477 Jan 18 15:07 irix.c --rw-r--r-- 1 b1 prog 240 Jan 18 15:07 irix.h --rw-r--r-- 1 b1 prog 1363 Jan 18 15:07 linux.c --rw-r--r-- 1 b1 prog 34628 Jan 18 15:07 m_menu.c --rw-r--r-- 1 b1 prog 13741 Jan 18 15:07 m_misc.c --rw-r--r-- 1 b1 prog 6117 Jan 18 15:07 p_ceilng.c --rw-r--r-- 1 b1 prog 15062 Jan 18 15:07 p_doors.c --rw-r--r-- 1 b1 prog 33758 Jan 18 15:07 p_enemy.c --rw-r--r-- 1 b1 prog 11409 Jan 18 15:07 p_floor.c --rw-r--r-- 1 b1 prog 16265 Jan 18 15:07 p_inter.c --rw-r--r-- 1 b1 prog 7592 Jan 18 15:07 p_lights.c --rw-r--r-- 1 b1 prog 6447 Jan 18 15:07 p_local.h --rw-r--r-- 1 b1 prog 30138 Jan 18 15:07 p_map.c --rw-r--r-- 1 b1 prog 14672 Jan 18 15:07 p_maputl.c --rw-r--r-- 1 b1 prog 17276 Jan 18 15:07 p_mobj.c --rw-r--r-- 1 b1 prog 5940 Jan 18 15:07 p_plats.c --rw-r--r-- 1 b1 prog 17084 Jan 18 15:07 p_pspr.c --rw-r--r-- 1 b1 prog 12828 Jan 18 15:07 p_setup.c --rw-r--r-- 1 b1 prog 5962 Jan 18 15:07 p_sight.c --rw-r--r-- 1 b1 prog 23846 Jan 18 15:07 p_spec.c --rw-r--r-- 1 b1 prog 11140 Jan 18 15:07 p_spec.h --rw-r--r-- 1 b1 prog 14229 Jan 18 15:07 p_switch.c --rw-r--r-- 1 b1 prog 1910 Jan 18 15:07 p_telept.c --rw-r--r-- 1 b1 prog 14075 Jan 18 15:07 p_tick.c --rw-r--r-- 1 b1 prog 7044 Jan 18 15:07 p_user.c --rw-r--r-- 1 b1 prog 13013 Jan 18 15:07 planar.asm --rw-r--r-- 1 b1 prog 9811 Jan 18 15:07 r_bsp.c --rw-r--r-- 1 b1 prog 14619 Jan 18 15:07 r_data.c --rw-r--r-- 1 b1 prog 13591 Jan 18 15:07 r_draw.c --rw-r--r-- 1 b1 prog 11378 Jan 18 15:07 r_local.h --rw-r--r-- 1 b1 prog 14868 Jan 18 15:07 r_main.c --rw-r--r-- 1 b1 prog 7108 Jan 18 15:07 r_plane.c --rw-r--r-- 1 b1 prog 15420 Jan 18 15:07 r_segs.c --rw-r--r-- 1 b1 prog 18969 Jan 18 15:07 r_things.c --rw-r--r-- 1 b1 prog 12274 Jan 18 15:07 s_sound.c --rw-r--r-- 1 b1 prog 12812 Jan 18 15:07 sndserver.c --rw-r--r-- 1 b1 prog 141 Jan 18 15:07 sndserver.h --rw-r--r-- 1 b1 prog 5811 Jan 18 15:07 sounds.c --rw-r--r-- 1 b1 prog 2674 Jan 18 15:07 sounds.h --rw-r--r-- 1 b1 prog 3975 Jan 18 15:07 soundst.h --rw-r--r-- 1 b1 prog 3461 Jan 18 15:07 st_lib.c --rw-r--r-- 1 b1 prog 2254 Jan 18 15:07 st_lib.h --rw-r--r-- 1 b1 prog 22769 Jan 18 15:07 st_stuff.c --rw-r--r-- 1 b1 prog 4685 Jan 18 15:07 st_stuff.h --rw-r--r-- 1 b1 prog 1725 Jan 18 15:07 sun.c --rw-r--r-- 1 b1 prog 75 Jan 18 15:07 t.c --rw-r--r-- 1 b1 prog 114621 Jan 18 15:07 tables.c --rw-r--r-- 1 b1 prog 5485 Jan 18 15:07 tmap.S --rw-r--r-- 1 b1 prog 10904 Jan 18 15:07 v_video.c --rw-r--r-- 1 b1 prog 268 Jan 18 15:07 vgaview.h --rw-r--r-- 1 b1 prog 9920 Jan 18 15:07 w_wad.c --rw-r--r-- 1 b1 prog 3629 Jan 18 15:07 wadread.c --rw-r--r-- 1 b1 prog 551 Jan 18 15:07 wadread.h --rw-r--r-- 1 b1 prog 3583 Jan 18 15:07 wi_data.h --rw-r--r-- 1 b1 prog 25608 Jan 18 15:07 wi_stuff.c --rw-r--r-- 1 b1 prog 1544 Jan 18 15:07 wi_stuff.h --rw-r--r-- 1 b1 prog 8501 Jan 18 15:07 z_zone.c diff --git a/linuxdoom-1.10/FILES2 b/linuxdoom-1.10/FILES2 @@ -1,221 +0,0 @@ -ChangeLog -FILES -FILES2 -Makefile - ------------------------------------------------------------------------ -Global and misc. stuff ------------------------------------------------------------------------ -doomdata.h - external data definitions (WAD file structure) -doomdef.h - internal data definitions (game structs) -dstrings.h - printed strings for translation, english -d_french.h - printed strings for translation - -info.h -info.c - LUT's for Thing TAB, Frame TAB, - generated by multigen utility -dutils.h -dutils.c - Dave's utilities - including doubly-linked lists & simple state machines. - Used in WI, ST, AM, and d_main.c - ------------------------------------------------------------------------- -DOOM game loop and top level stuff ------------------------------------------------------------------------- -g_game.c - Game loop functions, event handling etc. - - boolean G_CheckDemoStatus (void); - void G_ReadDemoTiccmd (ticcmd_t *cmd); - void G_WriteDemoTiccmd (ticcmd_t *cmd); - void G_PlayerReborn (int player); - void G_InitNew (skill_t skill, int episode, int map); - - void G_DoReborn (int playernum); - - void G_DoLoadLevel (void); - void G_DoNewGame (void); - void G_DoLoadGame (void); - void G_DoPlayDemo (void); - void G_DoCompleted (void); - void G_DoVictory (void); - void G_DoWorldDone (void); - void G_DoSaveGame (void); - -d_main.c - event handling, D_DoomMain() and other functions - NOT int main() - -d_net.c - high level networking protocol code - ------------------------------------------------------------------- -I Interfaces, system specifics ------------------------------------------------------------------- -i_main.c - main(), calls D_DoomMain(). -i_svgalib.c - Linux SVGAlib code, including main(), - replaces i_main.c - -i_x.c - X11 with SHM code, use with i_main.c -i_dga.c - X11 DGA code, use with i_main.c -i_unix.c - fixed point, networking, and display stuff for UNIX - -i_ibm.c - IBM DOS VGA graphics and key/mouse/joystick, - use with i_main.c -i_pcnet.c - IPX networking, DOS - -fpfunc.S - fixed point assembly and (currently) duplicate of -tmap.S - texture mapping assembly (currently unused) - ------------------------------------------------------------------- -AM AutoMap ------------------------------------------------------------------- -am_data.h - vector graphics for the automap - -am_map.h -am_map.c - automap code - ------------------------------------------------------------------- -HU Heads Up ------------------------------------------------------------------- -hu_lib.h -hu_lib.c - heads-up text and input code - -hu_stuff.h -hu_stuff.c - Heads-up displays - - -------------------------------------------------------------------- -M Menu -------------------------------------------------------------------- -m_menu.c - DOOM options code and leaving messages - -m_misc.c - misc. HUD text display, input checks, and - random table, file I/O - - -------------------------------------------------------------------- -P Play??? -------------------------------------------------------------------- -p_local.h - header for all play modules - -p_spec.h - specials, lighting, doors, plats, texture animation -p_spec.c - specials, texture animation - -p_doors.c - door code -p_plats.c - platform raising/lowering code -p_ceilng.c - active (e.g. crushing) ceilings -p_floor.c - active (e.g. raising) floors -p_lights.c - dynamic (e.g. flickering) lighting -p_switch.c - button switches and animation - -p_enemy.c - enemy AI and animation -p_inter.c - object/object interaction? -p_map.c - movement objects, handling of collisions -p_maputl.c - distance, position etc. utilities for movement -p_mobj.c - mobile objects handling, spawn etc. -p_user.c - more movement, bobbing etc. - -p_telept.c - teleportation code - -p_sight.c - LOS checks, REJECT - - -p_pspr.c - weapon overlays, bobbing, raising, sprite tables, - firing, ammo bookkeeping - -p_setup.c - load map from WAF file, setup code - - -p_tick.c - savegame function (archive/unarchive), - thinker list handling, allocation, - game tick execution (updates) - - -------------------------------------------------------------------- -R Rendering -------------------------------------------------------------------- -r_local.h - header for all rendering modules, - internal map data structure definitions - -r_bsp.c - BSP seg's clipping - -r_data.c - texture column caching, patch assembly, - flats, colormaps, sprites, - lookup by name - -r_draw.c - access to framebuffer API, drawing C functions - - -r_main.c - geometry functions, trigonometry lookups, - R_RenderPlayerView - -r_plane.c - floor/ceiling visplanes, sky - -r_segs.c - drawing segs, marking hslices for floors/ceilings - -r_things.c - sprite and sprite frame/rotation handling, drawing - - -tables.c - trigonometry lookup tables, static - -v_video.c - gamma correction lookup, patch drawing to rectangle - -------------------------------------------------------------------- -S Sound -------------------------------------------------------------------- -s_sound.c - more sound and music handling - -soundst.h - sound and music data structures -sounds.h -sounds.c - sound and music lump LUT's (manually maintained) - -sndserver.h -sndserver.c - (Irix) sndserver code - -irix.h -irix.c - SGI Irix sound/sndserver support code - -linux.c - Linux voxware sound/sndserver support code, - replaces irix.c, uses irix.h -sun.c - SUN replacement for irix.c - - -i_sound.h -i_sound.c - DOS DMX music and sound interface - -------------------------------------------------------------------- -ST STatus bar -------------------------------------------------------------------- -st_lib.h -st_lib.c - status bar widget code - -st_stuff.c -st_stuff.h - status bar code - - -------------------------------------------------------------------- -W Wad file I/O -------------------------------------------------------------------- -w_wad.c - lump based functions -wadread.h -wadread.c - lump I/O, get SFX - -------------------------------------------------------------------- -WI WIn / level end screens -------------------------------------------------------------------- -wi_data.h - lookups for intermission screens, patch positions - -wi_stuff.h -wi_stuff.c - intermission animation patchwork - -------------------------------------------------------------------- -Z Zone memory allocation -------------------------------------------------------------------- -z_zone.c - -------------------------------------------------------------------- -F Final screen animation -------------------------------------------------------------------- -f_finale.c - DOOM mission end screens? (bunny) - - - -------------------------------------------------------------------- diff --git a/linuxdoom-1.10/Makefile b/linuxdoom-1.10/Makefile @@ -1,95 +0,0 @@ -################################################################ -# -# $Id:$ -# -# $Log:$ -# -CC= gcc # gcc or g++ - -CFLAGS=-g -Wall -DNORMALUNIX -DLINUX # -DUSEASM -LDFLAGS=-L/usr/X11R6/lib -LIBS=-lXext -lX11 -lnsl -lm - -# subdirectory for objects -O=linux - -# not too sophisticated dependency -OBJS= \ - $(O)/doomdef.o \ - $(O)/doomstat.o \ - $(O)/dstrings.o \ - $(O)/i_system.o \ - $(O)/i_sound.o \ - $(O)/i_video.o \ - $(O)/i_net.o \ - $(O)/tables.o \ - $(O)/f_finale.o \ - $(O)/f_wipe.o \ - $(O)/d_main.o \ - $(O)/d_net.o \ - $(O)/d_items.o \ - $(O)/g_game.o \ - $(O)/m_menu.o \ - $(O)/m_misc.o \ - $(O)/m_argv.o \ - $(O)/m_bbox.o \ - $(O)/m_fixed.o \ - $(O)/m_swap.o \ - $(O)/m_cheat.o \ - $(O)/m_random.o \ - $(O)/am_map.o \ - $(O)/p_ceilng.o \ - $(O)/p_doors.o \ - $(O)/p_enemy.o \ - $(O)/p_floor.o \ - $(O)/p_inter.o \ - $(O)/p_lights.o \ - $(O)/p_map.o \ - $(O)/p_maputl.o \ - $(O)/p_plats.o \ - $(O)/p_pspr.o \ - $(O)/p_setup.o \ - $(O)/p_sight.o \ - $(O)/p_spec.o \ - $(O)/p_switch.o \ - $(O)/p_mobj.o \ - $(O)/p_telept.o \ - $(O)/p_tick.o \ - $(O)/p_saveg.o \ - $(O)/p_user.o \ - $(O)/r_bsp.o \ - $(O)/r_data.o \ - $(O)/r_draw.o \ - $(O)/r_main.o \ - $(O)/r_plane.o \ - $(O)/r_segs.o \ - $(O)/r_sky.o \ - $(O)/r_things.o \ - $(O)/w_wad.o \ - $(O)/wi_stuff.o \ - $(O)/v_video.o \ - $(O)/st_lib.o \ - $(O)/st_stuff.o \ - $(O)/hu_stuff.o \ - $(O)/hu_lib.o \ - $(O)/s_sound.o \ - $(O)/z_zone.o \ - $(O)/info.o \ - $(O)/sounds.o - -all: $(O)/linuxxdoom - -clean: - rm -f *.o *~ *.flc - rm -f linux/* - -$(O)/linuxxdoom: $(OBJS) $(O)/i_main.o - $(CC) $(CFLAGS) $(LDFLAGS) $(OBJS) $(O)/i_main.o \ - -o $(O)/linuxxdoom $(LIBS) - -$(O)/%.o: %.c - $(CC) $(CFLAGS) -c $< -o $@ - -############################################################# -# -############################################################# -\ No newline at end of file diff --git a/linuxdoom-1.10/README.asm b/linuxdoom-1.10/README.asm @@ -1,283 +0,0 @@ - -README - DOOM assembly code - -Okay, I add the DOS assembly module for the historically -inclined here (may rec.games.programmer suffer). If anyone -feels the urge to port these to GNU GCC; either inline or -as separate modules including Makefile support, be my guest. - -Module tmap.S includes the inner loops for texture mapping, -the interesting one being the floor/ceiling span rendering. - -There was another module in the source dump, fpfunc.S, that -had both texture mapping and fixed point functions. It -contained implementations both for i386 and M68k. For -brevity, I include only the i386 fixed point stuff below. - -//==================================================== -// tmap.S as of January 10th, 1997 - -//================ -// -// R_DrawColumn -// -//================ - - .data -loopcount .long 0 -pixelcount .long 0 - - .text - - .align 16 -.globl _R_DrawColumn -_R_DrawColumn: - - pushad - - movl ebp,[_dc_yl] - movl ebx,ebp - movl edi,[_ylookup+ebx*4] - movl ebx,[_dc_x] - addl edi,[_columnofs + ebx*4] - - movl eax,[_dc_yh] - incl eax - subl eax,ebp // pixel count - movl [pixelcount],eax // save for final pixel - js done // nothing to scale - shrl eax,1 // double pixel count - movl [loopcount],eax - - movl ecx,[_dc_iscale] - - movl eax,[_centery] - subl eax,ebp - imull ecx - movl ebp,[_dc_texturemid] - subl ebp,eax - shll ebp,9 // 7 significant bits, 25 frac - - movl esi,[_dc_source] - - - movl ebx,[_dc_iscale] - shll ebx,9 - movl eax,OFFSET patch1+2 // convice tasm to modify code... - movl [eax],ebx - movl eax,OFFSET patch2+2 // convice tasm to modify code... - movl [eax],ebx - -// eax aligned colormap -// ebx aligned colormap -// ecx,edx scratch -// esi virtual source -// edi moving destination pointer -// ebp frac - - movl ecx,ebp // begin calculating first pixel - addl ebp,ebx // advance frac pointer - shrl ecx,25 // finish calculation for first pixel - movl edx,ebp // begin calculating second pixel - addl ebp,ebx // advance frac pointer - shrl edx,25 // finish calculation for second pixel - movl eax,[_dc_colormap] - movl ebx,eax - movb al,[esi+ecx] // get first pixel - movb bl,[esi+edx] // get second pixel - movb al,[eax] // color translate first pixel - movb bl,[ebx] // color translate second pixel - - testl [pixelcount],0fffffffeh - jnz doubleloop // at least two pixels to map - jmp checklast - - .align 16 -doubleloop: - movl ecx,ebp // begin calculating third pixel -patch1: - addl ebp,12345678h // advance frac pointer - movb [edi],al // write first pixel - shrl ecx,25 // finish calculation for third pixel - movl edx,ebp // begin calculating fourth pixel -patch2: - addl ebp,12345678h // advance frac pointer - movl [edi+SCREENWIDTH],bl // write second pixel - shrl edx,25 // finish calculation for fourth pixel - movb al,[esi+ecx] // get third pixel - addl edi,SCREENWIDTH*2 // advance to third pixel destination - movb bl,[esi+edx] // get fourth pixel - decl [loopcount] // done with loop? - movb al,[eax] // color translate third pixel - movb bl,[ebx] // color translate fourth pixel - jnz doubleloop - -// check for final pixel -checklast: - testl [pixelcount],1 - jz done - movb [edi],al // write final pixel - -done: - popad - ret - - - -//================ -// -// R_DrawSpan -// -// Horizontal texture mapping -// -//================ - - - .align 16 -.globl _R_DrawSpan -_R_DrawSpan: - pushad - -// -// find loop count -// - movl eax,[_ds_x2] - incl eax - subl eax,[_ds_x1] // pixel count - movl [pixelcount],eax // save for final pixel - js hdone // nothing to scale - shrl eax,1 // double pixel count - movl [loopcount],eax - -// -// build composite position -// - movl ebp,[_ds_xfrac] - shll ebp,10 - andl ebp,0ffff0000h - movl eax,[_ds_yfrac] - shrl eax,6 - andl eax,0ffffh - orl ebp,eax - - movl esi,[_ds_source] - -// -// calculate screen dest -// - movl edi,[_ds_y] - movl edi,[_ylookup+edi*4] - movl eax,[_ds_x1] - addl edi,[_columnofs+eax*4] - -// -// build composite step -// - movl ebx,[_ds_xstep] - shll ebx,10 - andl ebx,0ffff0000h - movl eax,[_ds_ystep] - shrl eax,6 - andl eax,0ffffh - orl ebx,eax - - movl eax,OFFSET hpatch1+2 // convice tasm to modify code... - movl [eax],ebx - movl eax,OFFSET hpatch2+2 // convice tasm to modify code... - movl [eax],ebx - -// eax aligned colormap -// ebx aligned colormap -// ecx,edx scratch -// esi virtual source -// edi moving destination pointer -// ebp frac - - shldl ecx,ebp,22 // begin calculating third pixel (y units) - shldl ecx,ebp,6 // begin calculating third pixel (x units) - addl ebp,ebx // advance frac pointer - andl ecx,4095 // finish calculation for third pixel - shldl edx,ebp,22 // begin calculating fourth pixel (y units) - shldl edx,ebp,6 // begin calculating fourth pixel (x units) - addl ebp,ebx // advance frac pointer - andl edx,4095 // finish calculation for fourth pixel - movl eax,[_ds_colormap] - movl ebx,eax - movb al,[esi+ecx] // get first pixel - movb bl,[esi+edx] // get second pixel - movb al,[eax] // color translate first pixel - movb bl,[ebx] // color translate second pixel - - testl [pixelcount],0fffffffeh - jnz hdoubleloop // at least two pixels to map - jmp hchecklast - - - .align 16 -hdoubleloop: - shldl ecx,ebp,22 // begin calculating third pixel (y units) - shldl ecx,ebp,6 // begin calculating third pixel (x units) -hpatch1: - addl ebp,12345678h // advance frac pointer - movb [edi],al // write first pixel - andl ecx,4095 // finish calculation for third pixel - shldl edx,ebp,22 // begin calculating fourth pixel (y units) - shldl edx,ebp,6 // begin calculating fourth pixel (x units) -hpatch2: - addl ebp,12345678h // advance frac pointer - movb [edi+1],bl // write second pixel - andl edx,4095 // finish calculation for fourth pixel - movb al,[esi+ecx] // get third pixel - addl edi,2 // advance to third pixel destination - movb bl,[esi+edx] // get fourth pixel - decl [loopcount] // done with loop? - movb al,[eax] // color translate third pixel - movb bl,[ebx] // color translate fourth pixel - jnz hdoubleloop - -// check for final pixel -hchecklast: - testl [pixelcount],1 - jz hdone - movb [edi],al // write final pixel - -hdone: - popad - ret - - - - -//==================================================== -// fpfunc.S as of January 10th, 1997 (parts) - -#ifdef i386 - -.text - .align 4 -.globl _FixedMul -_FixedMul: - pushl %ebp - movl %esp,%ebp - movl 8(%ebp),%eax - imull 12(%ebp) - shrdl $16,%edx,%eax - popl %ebp - ret - - - .align 4 -.globl _FixedDiv2 -_FixedDiv2: - pushl %ebp - movl %esp,%ebp - movl 8(%ebp),%eax - cdq - shldl $16,%eax,%edx - sall $16,%eax - idivl 12(%ebp) - popl %ebp - ret - -#endif - diff --git a/linuxdoom-1.10/README.b b/linuxdoom-1.10/README.b @@ -1,140 +0,0 @@ - -README for Linux DOOM Source distribution -========================================= - - -DISCLAIMER ----------- -This is not "The DOOM Source Code" dump for a bunch -of reasons. It is based on a DOOM development directory -snapshot as of January 10th, but has been stripped and -changed. Thus it is the DOOM source, but there are many -minor differences to the source as last used by id -Software. - -Note that thus neither John Carmack nor Dave Taylor nor -anybody else at id is responsible for the contents of -this archive, or the changes introduced to the original -source. - -If there are any questions, contact me at bk@gamers.org, -or preferably post to the mailing list at - - doom-editing@gamers.org - -(send mail to majordomo@gamers.org, content just -a single "info doom-editing"). I will post any updates -or notifcation of corrections there. I will probably -put some stuff at - - http://www.gamers.org/dEngine/doom/ - -as well. Look there for the "Unofficial DOOM Specs" as -minimal recommended documentation. - - - -REMARKS -------- -I made a few minor bug fixes, added some experimental sound -code, and, and changed the handling of IWAD dependend game -modes. Most of the changes though have been shuffling -around sources in a sometimes futile attempt to separate -modules more cleanly, and make certain parts easier -to locate and modify. There is still much left to do, but -I hope that the current source is a good base to start -with, especially with a cooperative effort in mind. Those -so inclined will find the source prepared for CVS. - -There is a list of changes and fixes I did not get around -to in TODO, and an incomplete worklog in ChangeLog, that -also includes some minor ToDo statements scattered throughout -the log. - - -a) Linux SVGA -There is no SVGA support. For development and debug -purposes, the X11 version seems to be more handy. - -b) Sound - see README.sound, - and the sndserver.tgz archive. - -c) GLDOOM - see README.gl - -d) Win32 -There was no Win32 support in the original dump. - -e) DOS -Original DOS support (including the texture -mapping and fixed point assembler) has been -removed, mainly because of the lack of sound -support. - -f) DoomEd -The NeXTStep DoomEd sources in the dump were -garbled (filenames - prolly an issue of ISO9660 -with or w/o extensions). Somehow Bear never got -around to send me a list of the correct filenames, -and I won't bother guessing without a NeXT box -at hand. - -There is a plethora of useful editors -for DOOM. I suggest using DEU for X11. - -g) BSP Tools -The BSP builder and other tools have -been released by John Carmack long ago, -and since improved/replaced by others. -Again, I recommend taking a pick among -the tools available for Linux. - -h) DOOM game tools -There are a number of tools that have -not been released, namely those which -compiled the Things and State Tables, -the frame animation LUT's, sound tables -etc. Basically, they compile similarly -complex LUT's to generate C files. The -tools are omitted from this distribution. - -There are some files in the -distribution (info.h/c, sounds.h/c) -that are essentially the output of these -tools. This is the data that defines -DOOM (as a game) for all practical -purposes. - -I recommend keeping them, as they are -part of the source. In the long run, -handling them as well as the action/ -animation functions as a separate game.so -library (as with Quake2) seems to be a -good idea. - -i) Artwork -Neither the original artwork nor the -misc. WAD files are included in this -archive. You will at least need the -shareware WAD file to run the executable, -but it shouldn't be to difficult to get -a hold of that. - -Note that the mechanism to detect the -presence of a registered or commercial -version is still in the source, and -homebrew maps are still disabled. This -is easily removed now, but as FinalDOOM, -Ultimate DOOM and DOOM 2 are still in -the shops, it is probably polite not -to distribute a source or binary without -that mechanism. - -This version of Linuxdoom supports Plutonia -and TNT WAD from FinalDOOM as well. No -guarantees, though. - - -Enjoy! - - - b. 97/12/22 diff --git a/linuxdoom-1.10/README.book b/linuxdoom-1.10/README.book @@ -1,57 +0,0 @@ - -The DOOM Book - -Shortly after the Wolfenstein 3D source release, -I sent a mail to Jay Wilbur suggesting a book -about the DOOM engine. I anticipated a similar -release of the DOOM sources within a year or -two, and the obvious problems with the Wolfenstein -sources (lack of accompanying artwork, a code -base not maintained for quite some time) seemed -to demand a better approach. I talked to some -publishing company reps at the Book Fair in 1995, -and while they were cautiously interested, id was -not. - -In the last weeks of 1996, following a visit at -id Software two months earlier, and after the -departure of Jay Wilbur, John Carmack asked me -whether I was still interested in doing the book. -I was, Bear sent me a code dump, and Todd -Hollenshead set out to address the legal concerns -(of which were many). - -Unfortunately, what might have worked in 1995 -turned out to be a doomed attempt in 1997. I won't -go into the details - let's just say that my -leaving university and going back to full time -writing for a living repeatedly forced me to -change priorities on what looked more and more -like a project unlikely to generate any revenue. - -By mid of the year, when the legal issues had -finally been settled, it didn't look like I was -going to find a publisher at all. Following the -Book Fair in 1997 and some more discussions -(with about a dozen publishers, total), I gritted -my teeth and decided to abandon the project. - -Note that the book project as such wasn't supposed -to hold up the source release to the public. -However, given the legal concerns relating to -the third party sound code in DOS DOOM, and the -lack of Win32 support as well as the advantages of -an OpenGL based release, the idea was to put -together a consistent, stable code base prior to -public release - most of which was supposed to be -an offspring of my reformatting and modifying the -code for the book. - -None of this worked out as intended. However, I -hope that, at long last, this distribution -will finally provide a good point to start for -any cooperative effort to extend the already -impressive lifespan of DOOM into the age of -multiplayer servers and hardware-accelerated -clients. - diff --git a/linuxdoom-1.10/README.gl b/linuxdoom-1.10/README.gl @@ -1,149 +0,0 @@ - -README: glDOOM - -I never got around to do anything with respect to -a Linux glDOOM port except for assembling a Linux3Dfx -HOWTO (which, at that time, was a prerequisite -to get permission to publicly distribute the -already finished LinuxGlide port by Daryll Strauss). - -Linux q2test (and soon LinuxQuake2) demonstrate that -Mesa with the MesaVoodoo driver is quite up to the -requirements for a glDOOM port. If anybody wants to -get into Linux glDOOM, please drop me a line. - -There is a Win32 GLDOOM port in the works, by Jim Dose. -Quoting a recent posting by him: - -"I haven't had as much time lately to really work on -the conversion. I currently have the renderer drawing -the walls and floors as texture spans as the are in -the software renderer. There's lighting on the walls, -but not the floors, and sprites are being drawn, but -not with the right texture. I figure that this is one -nights work to get the game looking "normal". I haven't -tested the game on less than a p200, so I'm not sure -how it will perform under the average machine, but I -don't expect it to be blindingly fast because of the -number of spans that have to be drawn each frame. -Rendering as polys is definitely the way to go. - -The reason I chose to do spans first was because it -left the base renderer intact and I could concentrate -on ironing out any Windows compatibility problems. -Actually, the first version I had running was simply -a blit of the 320x200 game screen through Open GL. -Surprisingly, this actually was very playable, but -certainly wasn't taking any advantage of 3D acceleration. -Once the game was running, I started converting all -the span routines over." - -Comment: for merging Linuxdoom with Win32, this is -probably the best source for getting the Win32 -environment done - before more significant changes -occur. - -"One problem with drawing spans is that the engine -doesn't calculate the texture coordinates with -fractional accuracy, so the bilinear filtering works -vertically, but not horizontally on the walls. I may -try to fix this, but since I plan to use polys for -the final version, it's not really high priority. -Also, spans don't really allow for looking up and -down." - -Comment: true looking up/down vs. Heretic-style -y-shearing seems to require either a strange kind -of transofrmation matrix (he probably does not use -the OpenGL transformation at all), or rendering -all the spans as textured rectangular slices -instead of using glDrawBitmap. No, polys are the -way to go. - -"When I tackle the conversion to polys, one big problem -I'll encounter is drawing floors. Since the world is -stored in a 2D bsp tree, there is no information on -the shape of the floors. In fact the floors can be -concave and may include holes (typically, most renderers -break concave polys down into a collection of convex -polys or triangles). In software, the floors are actually -drawn using an algorithm that's similar to a flood fill -(except that a list of open spans is kept instead of a -buffer of pixels). This makes drawing the floors as -polys fairly difficult." - -A polygon based approach will require significant changes -to the data structures used in the refresh module. I -recommend either separating a libref_soft.so first (a -Quake2 like approach), and creating libref_gl afterwards, -or abandoning the software rendering entirely. - -John Carmack wrote once upon a time: -"... the U64 DOOM engine is much more what I would consider -The Right Thing now -- it turns the subsector boundaries -into polygons for the floors and ceilings ahead of time, -then for rendering it walks the BSP front to back, doing -visibility determination of subsectors by the one dimensional -occlusion buffer and clipping sprites into subsectors, then -it goes backwards through the visible subsectors, drawing -floors, ceilings, walls, then sorted internal sprite fragments. -It's a ton simpler and a ton faster, although it does suffer -some overdraw when a high subsector overlooks a low one (but -that is more than made up for by the simplicity of everything -else)." - -Well, IMO compiling a separate list of floor/ceiling polygons -after having read the WAD file, and thus introducing this as -a completely separate data structure to the current code base -might be the easiest thing to do. Jim Dose writes: - -"One method I may use to draw the floors as polys was suggested -by Billy Zelsnack of Rebel Boat Rocker when we were working -at 3D Realms together a few years ago. Basically, Billy was -designing an engine that dealt with the world in a 2D portal -format similar to the one that Build used, except that it had -true looking up and down (no shearing). Since floors were -basically implicit and could be concave, Billy drew them as -if the walls extended downwards to infinity, but fixed the -texture coordinates to appear that they were on the plane of -the floor. The effect was that you could look up and down and -there were no gaps or overdraw. It's a fairly clever method -and allows you to store the world in a simpler data format. -Had perspective texture mapping been fast enough back then, -both Build and Doom could have done this in software." - -Perhaps the above is sufficient to get you started. -Other Issues: - -1. Occlusion -DOOM uses a per-column lookup (top/bottom index) to do HLHSR. -This works fine with span based rendering (well, getting -horizontal spans of floors/ceilings into the picture is a -separate story). It isn't really mindboggling with polygon -based rendering. GLDOOM should abandon that. - -2. Precalculated Visibility -DOOM has the data used by Quake's PVS - in REJECT. -During Quake development, lots of replacements for the -occlusion buffer were tried, and PVS turned out to be best. -I suggest usind the REJECT as PVS. - -There have been special effects using a utility named RMB. -REJECT is a lump meant for enemy AI LoS calculation - a -nonstandard REJECT will not work as a PVS, and introduce -rendering errors. I suggest looking for a PVS lump in the -WAD, and using REJECT if none is found. That way, it might -be feasible to eat the cake and keep it. - -3. Mipmaps -DOOM does not have mipmapping. As we have 8bit palettized -textures, OpenGL mipmapping might not give the desired -results. Plus, composing textures from patches at runtime -would require runtime mipmapping. Precalculated mipmaps -in the WAD? - -4. Sprites -Partly transparent textures and sprites impose another -problem related to mipmapping. Without alpha channel, -this could give strange results. Precalculated, valid -sprite mipmaps (w/o alpha)? diff --git a/linuxdoom-1.10/README.sound b/linuxdoom-1.10/README.sound @@ -1,110 +0,0 @@ - -README: sound in DOOM - - -1) DOS/Win32 sound - -id licensed a third party sound library called -DMX for DOS DOOM. The situation exhibited -many symptons of serious NIH "Not Invented Here"), -and one of the consequences is that the original -DOOM sound code does not work without DMX. As -DMX is not publicly available, the original DOOM -sound support is removed. - -Win32 was not supported in the source dump I got. -I have no knowledge how the WinDOOM port did the -sound handling. A Win32 port should probaly rely on -DirectSound. So far, the Win32 glDOOM port Jim Dose -is working on has no sound support. - -In consequence, the only target with a working sound -code is UNIX, which I could only verify with Linux -on Intel586. - -2) Linux sound - -DOOM for Linux used a separate process, sndserver. - -Quoting Dave Taylor: - -"Sound drivers should be an asychronous model, either -a seperate thread or a seperate process. This is -because sound should always be fed to the card without -interruption or else you get pops and with low latency -or else you get angry players. - -Now it turns out that this kind of code isn't too fun -to write. In the days of Linux Doom, threads were not a -happnin thing in Linux. In fact, they still largely -aren't. You can use them these days if you have gnu's -libc installed, but you still can't debug them because -gdb doesn't support them properly yet. I believe the -original seperate process had a bad latency delay -because of the time it took for commands to be flushed -through the pipe used to communicate with the seperate -process. I should have looked into this more thoroughly. - -In Quake, I discovered that I could feed multiple -acknowledgements to a SoundBlaster or compatible without -any side-effects such as pops or other malfunctions. -This discovery led me to switch to a completely synchronous -model, much much easier to debug and understand, so I -think this was fairly intelligent. Although we had to -populate the game with calls in the right places to keep -the sound buffers fed, and although it wasn't gauranteed to -be always fed, well over 99% of the time, it was fed, and -your the latency was never worse than the frequency of your -refills (several times per frame) plus a small lead time -(40th of a second?)." - -The separate sndserver code base introduced some redundancy -(WAD access for sound lumps) for each UNIX target (Sun, SGI, -Linux) and more differences between DOS and UNIX version. -However, I kept the IPC based parts in the source, and -separated the sndserver target in another directory to avoid -further redundancy. There seem to be a few bug-like things -going on in the sndserver that do not receive penalty as -the program has to do only a simple task. One example would -be a libc realloc mixed with zone memory allocation. - -Ungraceful and untimely demise of Linuxdoom (core instead -of I_Error) will leave idle sndserver processes in your -system, blocking /dev/bsp. Kill them manually. - -I put the non-redundant parts of the sndserver program -into the i_sound module of doom, and with the SND_SERV -compiler switch you can choose to use the internal sound -support. However, there is a problem with e.g. the -double shotgun and the plasma gun - walk up to a wall, -face it straight, and fire. The sound output is crappy. -This vanishes with decreasing screen size. A similar -problem occurs with trimer driven asynchronous output -enabled by SNDINTR. - -I agree with Dave that threads would be preferable. -With respect to Linux ports of John Carmack's next -Trinity engine, this one will rely on Win32 -multithreading e.g. for input sampling. So the Linux -community will have to sort out threads anyway :-). - -To improve the current sound server, other means of -IPC should take care of the latency. The mixing -buffer/command buffer as shared memory comes to mind. - - - -3) Music support - -There is, and was, no music support in Linuxdoom. Fine with -me - I wouldn't give a bat's tail feathers for DOOM music. -Your mileage may vary. There are a few leftovers of the DOS -music support also interfacing DMX, so there is a place -to start. However, in the age of CDROM based music, I -recommend getting e.g. Workman to cooperate with DOOM -(currently, DOOM accessing the soundcard SpekerOut -interferes with Workman controlling the CD drives -SpeakerOut), so musci could be chosen and run completely -independend of the game. You could try Linuxdoom with -Q2 music that way. - diff --git a/linuxdoom-1.10/TODO b/linuxdoom-1.10/TODO @@ -1,123 +0,0 @@ - -- create Web repository for sources, patches, - news, and pointer to doom-editing mailing - list. - -- get DOOM Public License from id - ------------------------------------------------ - -- remove m_fixed, switch to floating point - More stable, and prolly even faster. - -- make SCREENWIDTH/HEIGHT work at startup? - Well, the HUD/STBar stuff is tied to the - scales implied by the graphics. Rather do - GLDOOM and use texture mapping. - -- fix aspect ratio? - 320x200 is nothing viable nowadays. - A 320x240 base (4:3) would be a lot better. - See above on width/height. - -- limited look up/down by y-shearing? - Prolly not worth it, rather switch to GLDOOM. - -- switch to C++? - The action function pointers have varying - argument lists (no parameter, one, etc.). - C++ doesn't like that much. A major rewrite. - -- switch to doommain.c plus libdoom? Have - libref, libgame etc.? - Another major rewrite. - -- use XFree86 DGA, prolly not that much faster - than MIT SHM, but allows for directly sampled - mouse (and even freelook). Recommended for - GLDOOM. - -- put together an accompanying developer toolkit - source distribution: DEU, RMB, BSP for Linux/X. - -- move info.h, info.c, sounds.h, sounds.c and - other data to a separate lump in the WAD, - or into a libgame.so, to separate the - generic stuff (refresh, I/O) from the - DOOM specifics. - -- decide whether precaching all sounds is - better than retrieving and releasing - every so often. DOOM seems to do that - frequently (8bit stuff, originally for - DOS), and the Linux sound is 16bit - (conversion in the mixing, requires - some padding) - we prolly got the memory - to spare. - -- 16bpp CLUT. The lightmaps and the - framebuffer could be changed to switch - to 64K colors. Prolly better to do - GLDOOM right away. - -- remove checks for commercial etc., in - non-essential issues (enabling PWAD's). - -- change (simplify) determination of - sky texture (done by game version). - Explicit? - -- remove all game version checks - -- different handling of Demo - don't - exit on "different game version" - -- how about shareware/retail "You are here" - intermission animation? Wasn't in - commercial (DOOM 2). - -- double shotgun in DOOM1, all weapons with - shareware - -- checks for required lumps. We need fallbacks - for lumps that are not present, that is, - default sounds etc. to be used instead, - or removing THINGS w/o sprites etc. - -- client/server? I'd suggest ripping off some stuff - from the abandoned IBM WebView project - -- Blockmap - The BLOCKMAP lump might be (partly) redundant, - as the BSP allows for clipping (except certain - LineDefs that will not spawn Segs). - -- LOS - REJECT and intersection based LOS checking could be - done using the BSP. In case of REJECT, certain - monster AI special effects would be lost, though. - -- correct handling of height in collision. This is - not done, and the checks are scattered around in - many places. It does require handling of "player - on top of monster" situations, too - we have to - make sure the players falls off far enough to - avoid getting "stuck in monster". - -- remove obsolete menus (Detail. Music Volume?) - -- clip explosion range damage (and sprites) using - REJECT? That is, if one Sector/SSector not - visible from the other, do not apply damage, - not render sprite if player in other sector. - Hmmm - explosion behind small pillar might not be - visible at all, but do we care? - - -- Ungraceful and untimely demise of Linuxdoom (core - instead of I_Error) will leave idle sndserver - processes in your system, blocking /dev/bsp. - A timeout on lack of input for "sndserver"? - -- threaded sndserver? SHM mixing buffer? - Or internal, timer-based? diff --git a/linuxdoom-1.10/d_englsh.h b/linuxdoom-1.10/d_englsh.h @@ -1,701 +0,0 @@ -// Emacs style mode select -*- C++ -*- -//----------------------------------------------------------------------------- -// -// $Id:$ -// -// Copyright (C) 1993-1996 by id Software, Inc. -// -// This source is available for distribution and/or modification -// only under the terms of the DOOM Source Code License as -// published by id Software. All rights reserved. -// -// The source is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// FITNESS FOR A PARTICULAR PURPOSE. See the DOOM Source Code License -// for more details. -// -// DESCRIPTION: -// Printed strings for translation. -// English language support (default). -// -//----------------------------------------------------------------------------- - -#ifndef __D_ENGLSH__ -#define __D_ENGLSH__ - -// -// Printed strings for translation -// - -// -// D_Main.C -// -#define D_DEVSTR "Development mode ON.\n" -#define D_CDROM "CD-ROM Version: default.cfg from c:\\doomdata\n" - -// -// M_Menu.C -// -#define PRESSKEY "press a key." -#define PRESSYN "press y or n." -#define QUITMSG "are you sure you want to\nquit this great game?" -#define LOADNET "you can't do load while in a net game!\n\n"PRESSKEY -#define QLOADNET "you can't quickload during a netgame!\n\n"PRESSKEY -#define QSAVESPOT "you haven't picked a quicksave slot yet!\n\n"PRESSKEY -#define SAVEDEAD "you can't save if you aren't playing!\n\n"PRESSKEY -#define QSPROMPT "quicksave over your game named\n\n'%s'?\n\n"PRESSYN -#define QLPROMPT "do you want to quickload the game named\n\n'%s'?\n\n"PRESSYN - -#define NEWGAME \ -"you can't start a new game\n"\ -"while in a network game.\n\n"PRESSKEY - -#define NIGHTMARE \ -"are you sure? this skill level\n"\ -"isn't even remotely fair.\n\n"PRESSYN - -#define SWSTRING \ -"this is the shareware version of doom.\n\n"\ -"you need to order the entire trilogy.\n\n"PRESSKEY - -#define MSGOFF "Messages OFF" -#define MSGON "Messages ON" -#define NETEND "you can't end a netgame!\n\n"PRESSKEY -#define ENDGAME "are you sure you want to end the game?\n\n"PRESSYN - -#define DOSY "(press y to quit)" - -#define DETAILHI "High detail" -#define DETAILLO "Low detail" -#define GAMMALVL0 "Gamma correction OFF" -#define GAMMALVL1 "Gamma correction level 1" -#define GAMMALVL2 "Gamma correction level 2" -#define GAMMALVL3 "Gamma correction level 3" -#define GAMMALVL4 "Gamma correction level 4" -#define EMPTYSTRING "empty slot" - -// -// P_inter.C -// -#define GOTARMOR "Picked up the armor." -#define GOTMEGA "Picked up the MegaArmor!" -#define GOTHTHBONUS "Picked up a health bonus." -#define GOTARMBONUS "Picked up an armor bonus." -#define GOTSTIM "Picked up a stimpack." -#define GOTMEDINEED "Picked up a medikit that you REALLY need!" -#define GOTMEDIKIT "Picked up a medikit." -#define GOTSUPER "Supercharge!" - -#define GOTBLUECARD "Picked up a blue keycard." -#define GOTYELWCARD "Picked up a yellow keycard." -#define GOTREDCARD "Picked up a red keycard." -#define GOTBLUESKUL "Picked up a blue skull key." -#define GOTYELWSKUL "Picked up a yellow skull key." -#define GOTREDSKULL "Picked up a red skull key." - -#define GOTINVUL "Invulnerability!" -#define GOTBERSERK "Berserk!" -#define GOTINVIS "Partial Invisibility" -#define GOTSUIT "Radiation Shielding Suit" -#define GOTMAP "Computer Area Map" -#define GOTVISOR "Light Amplification Visor" -#define GOTMSPHERE "MegaSphere!" - -#define GOTCLIP "Picked up a clip." -#define GOTCLIPBOX "Picked up a box of bullets." -#define GOTROCKET "Picked up a rocket." -#define GOTROCKBOX "Picked up a box of rockets." -#define GOTCELL "Picked up an energy cell." -#define GOTCELLBOX "Picked up an energy cell pack." -#define GOTSHELLS "Picked up 4 shotgun shells." -#define GOTSHELLBOX "Picked up a box of shotgun shells." -#define GOTBACKPACK "Picked up a backpack full of ammo!" - -#define GOTBFG9000 "You got the BFG9000! Oh, yes." -#define GOTCHAINGUN "You got the chaingun!" -#define GOTCHAINSAW "A chainsaw! Find some meat!" -#define GOTLAUNCHER "You got the rocket launcher!" -#define GOTPLASMA "You got the plasma gun!" -#define GOTSHOTGUN "You got the shotgun!" -#define GOTSHOTGUN2 "You got the super shotgun!" - -// -// P_Doors.C -// -#define PD_BLUEO "You need a blue key to activate this object" -#define PD_REDO "You need a red key to activate this object" -#define PD_YELLOWO "You need a yellow key to activate this object" -#define PD_BLUEK "You need a blue key to open this door" -#define PD_REDK "You need a red key to open this door" -#define PD_YELLOWK "You need a yellow key to open this door" - -// -// G_game.C -// -#define GGSAVED "game saved." - -// -// HU_stuff.C -// -#define HUSTR_MSGU "[Message unsent]" - -#define HUSTR_E1M1 "E1M1: Hangar" -#define HUSTR_E1M2 "E1M2: Nuclear Plant" -#define HUSTR_E1M3 "E1M3: Toxin Refinery" -#define HUSTR_E1M4 "E1M4: Command Control" -#define HUSTR_E1M5 "E1M5: Phobos Lab" -#define HUSTR_E1M6 "E1M6: Central Processing" -#define HUSTR_E1M7 "E1M7: Computer Station" -#define HUSTR_E1M8 "E1M8: Phobos Anomaly" -#define HUSTR_E1M9 "E1M9: Military Base" - -#define HUSTR_E2M1 "E2M1: Deimos Anomaly" -#define HUSTR_E2M2 "E2M2: Containment Area" -#define HUSTR_E2M3 "E2M3: Refinery" -#define HUSTR_E2M4 "E2M4: Deimos Lab" -#define HUSTR_E2M5 "E2M5: Command Center" -#define HUSTR_E2M6 "E2M6: Halls of the Damned" -#define HUSTR_E2M7 "E2M7: Spawning Vats" -#define HUSTR_E2M8 "E2M8: Tower of Babel" -#define HUSTR_E2M9 "E2M9: Fortress of Mystery" - -#define HUSTR_E3M1 "E3M1: Hell Keep" -#define HUSTR_E3M2 "E3M2: Slough of Despair" -#define HUSTR_E3M3 "E3M3: Pandemonium" -#define HUSTR_E3M4 "E3M4: House of Pain" -#define HUSTR_E3M5 "E3M5: Unholy Cathedral" -#define HUSTR_E3M6 "E3M6: Mt. Erebus" -#define HUSTR_E3M7 "E3M7: Limbo" -#define HUSTR_E3M8 "E3M8: Dis" -#define HUSTR_E3M9 "E3M9: Warrens" - -#define HUSTR_E4M1 "E4M1: Hell Beneath" -#define HUSTR_E4M2 "E4M2: Perfect Hatred" -#define HUSTR_E4M3 "E4M3: Sever The Wicked" -#define HUSTR_E4M4 "E4M4: Unruly Evil" -#define HUSTR_E4M5 "E4M5: They Will Repent" -#define HUSTR_E4M6 "E4M6: Against Thee Wickedly" -#define HUSTR_E4M7 "E4M7: And Hell Followed" -#define HUSTR_E4M8 "E4M8: Unto The Cruel" -#define HUSTR_E4M9 "E4M9: Fear" - -#define HUSTR_1 "level 1: entryway" -#define HUSTR_2 "level 2: underhalls" -#define HUSTR_3 "level 3: the gantlet" -#define HUSTR_4 "level 4: the focus" -#define HUSTR_5 "level 5: the waste tunnels" -#define HUSTR_6 "level 6: the crusher" -#define HUSTR_7 "level 7: dead simple" -#define HUSTR_8 "level 8: tricks and traps" -#define HUSTR_9 "level 9: the pit" -#define HUSTR_10 "level 10: refueling base" -#define HUSTR_11 "level 11: 'o' of destruction!" - -#define HUSTR_12 "level 12: the factory" -#define HUSTR_13 "level 13: downtown" -#define HUSTR_14 "level 14: the inmost dens" -#define HUSTR_15 "level 15: industrial zone" -#define HUSTR_16 "level 16: suburbs" -#define HUSTR_17 "level 17: tenements" -#define HUSTR_18 "level 18: the courtyard" -#define HUSTR_19 "level 19: the citadel" -#define HUSTR_20 "level 20: gotcha!" - -#define HUSTR_21 "level 21: nirvana" -#define HUSTR_22 "level 22: the catacombs" -#define HUSTR_23 "level 23: barrels o' fun" -#define HUSTR_24 "level 24: the chasm" -#define HUSTR_25 "level 25: bloodfalls" -#define HUSTR_26 "level 26: the abandoned mines" -#define HUSTR_27 "level 27: monster condo" -#define HUSTR_28 "level 28: the spirit world" -#define HUSTR_29 "level 29: the living end" -#define HUSTR_30 "level 30: icon of sin" - -#define HUSTR_31 "level 31: wolfenstein" -#define HUSTR_32 "level 32: grosse" - -#define PHUSTR_1 "level 1: congo" -#define PHUSTR_2 "level 2: well of souls" -#define PHUSTR_3 "level 3: aztec" -#define PHUSTR_4 "level 4: caged" -#define PHUSTR_5 "level 5: ghost town" -#define PHUSTR_6 "level 6: baron's lair" -#define PHUSTR_7 "level 7: caughtyard" -#define PHUSTR_8 "level 8: realm" -#define PHUSTR_9 "level 9: abattoire" -#define PHUSTR_10 "level 10: onslaught" -#define PHUSTR_11 "level 11: hunted" - -#define PHUSTR_12 "level 12: speed" -#define PHUSTR_13 "level 13: the crypt" -#define PHUSTR_14 "level 14: genesis" -#define PHUSTR_15 "level 15: the twilight" -#define PHUSTR_16 "level 16: the omen" -#define PHUSTR_17 "level 17: compound" -#define PHUSTR_18 "level 18: neurosphere" -#define PHUSTR_19 "level 19: nme" -#define PHUSTR_20 "level 20: the death domain" - -#define PHUSTR_21 "level 21: slayer" -#define PHUSTR_22 "level 22: impossible mission" -#define PHUSTR_23 "level 23: tombstone" -#define PHUSTR_24 "level 24: the final frontier" -#define PHUSTR_25 "level 25: the temple of darkness" -#define PHUSTR_26 "level 26: bunker" -#define PHUSTR_27 "level 27: anti-christ" -#define PHUSTR_28 "level 28: the sewers" -#define PHUSTR_29 "level 29: odyssey of noises" -#define PHUSTR_30 "level 30: the gateway of hell" - -#define PHUSTR_31 "level 31: cyberden" -#define PHUSTR_32 "level 32: go 2 it" - -#define THUSTR_1 "level 1: system control" -#define THUSTR_2 "level 2: human bbq" -#define THUSTR_3 "level 3: power control" -#define THUSTR_4 "level 4: wormhole" -#define THUSTR_5 "level 5: hanger" -#define THUSTR_6 "level 6: open season" -#define THUSTR_7 "level 7: prison" -#define THUSTR_8 "level 8: metal" -#define THUSTR_9 "level 9: stronghold" -#define THUSTR_10 "level 10: redemption" -#define THUSTR_11 "level 11: storage facility" - -#define THUSTR_12 "level 12: crater" -#define THUSTR_13 "level 13: nukage processing" -#define THUSTR_14 "level 14: steel works" -#define THUSTR_15 "level 15: dead zone" -#define THUSTR_16 "level 16: deepest reaches" -#define THUSTR_17 "level 17: processing area" -#define THUSTR_18 "level 18: mill" -#define THUSTR_19 "level 19: shipping/respawning" -#define THUSTR_20 "level 20: central processing" - -#define THUSTR_21 "level 21: administration center" -#define THUSTR_22 "level 22: habitat" -#define THUSTR_23 "level 23: lunar mining project" -#define THUSTR_24 "level 24: quarry" -#define THUSTR_25 "level 25: baron's den" -#define THUSTR_26 "level 26: ballistyx" -#define THUSTR_27 "level 27: mount pain" -#define THUSTR_28 "level 28: heck" -#define THUSTR_29 "level 29: river styx" -#define THUSTR_30 "level 30: last call" - -#define THUSTR_31 "level 31: pharaoh" -#define THUSTR_32 "level 32: caribbean" - -#define HUSTR_CHATMACRO1 "I'm ready to kick butt!" -#define HUSTR_CHATMACRO2 "I'm OK." -#define HUSTR_CHATMACRO3 "I'm not looking too good!" -#define HUSTR_CHATMACRO4 "Help!" -#define HUSTR_CHATMACRO5 "You suck!" -#define HUSTR_CHATMACRO6 "Next time, scumbag..." -#define HUSTR_CHATMACRO7 "Come here!" -#define HUSTR_CHATMACRO8 "I'll take care of it." -#define HUSTR_CHATMACRO9 "Yes" -#define HUSTR_CHATMACRO0 "No" - -#define HUSTR_TALKTOSELF1 "You mumble to yourself" -#define HUSTR_TALKTOSELF2 "Who's there?" -#define HUSTR_TALKTOSELF3 "You scare yourself" -#define HUSTR_TALKTOSELF4 "You start to rave" -#define HUSTR_TALKTOSELF5 "You've lost it..." - -#define HUSTR_MESSAGESENT "[Message Sent]" - -// The following should NOT be changed unless it seems -// just AWFULLY necessary - -#define HUSTR_PLRGREEN "Green: " -#define HUSTR_PLRINDIGO "Indigo: " -#define HUSTR_PLRBROWN "Brown: " -#define HUSTR_PLRRED "Red: " - -#define HUSTR_KEYGREEN 'g' -#define HUSTR_KEYINDIGO 'i' -#define HUSTR_KEYBROWN 'b' -#define HUSTR_KEYRED 'r' - -// -// AM_map.C -// - -#define AMSTR_FOLLOWON "Follow Mode ON" -#define AMSTR_FOLLOWOFF "Follow Mode OFF" - -#define AMSTR_GRIDON "Grid ON" -#define AMSTR_GRIDOFF "Grid OFF" - -#define AMSTR_MARKEDSPOT "Marked Spot" -#define AMSTR_MARKSCLEARED "All Marks Cleared" - -// -// ST_stuff.C -// - -#define STSTR_MUS "Music Change" -#define STSTR_NOMUS "IMPOSSIBLE SELECTION" -#define STSTR_DQDON "Degreelessness Mode On" -#define STSTR_DQDOFF "Degreelessness Mode Off" - -#define STSTR_KFAADDED "Very Happy Ammo Added" -#define STSTR_FAADDED "Ammo (no keys) Added" - -#define STSTR_NCON "No Clipping Mode ON" -#define STSTR_NCOFF "No Clipping Mode OFF" - -#define STSTR_BEHOLD "inVuln, Str, Inviso, Rad, Allmap, or Lite-amp" -#define STSTR_BEHOLDX "Power-up Toggled" - -#define STSTR_CHOPPERS "... doesn't suck - GM" -#define STSTR_CLEV "Changing Level..." - -// -// F_Finale.C -// -#define E1TEXT \ -"Once you beat the big badasses and\n"\ -"clean out the moon base you're supposed\n"\ -"to win, aren't you? Aren't you? Where's\n"\ -"your fat reward and ticket home? What\n"\ -"the hell is this? It's not supposed to\n"\ -"end this way!\n"\ -"\n" \ -"It stinks like rotten meat, but looks\n"\ -"like the lost Deimos base. Looks like\n"\ -"you're stuck on The Shores of Hell.\n"\ -"The only way out is through.\n"\ -"\n"\ -"To continue the DOOM experience, play\n"\ -"The Shores of Hell and its amazing\n"\ -"sequel, Inferno!\n" - - -#define E2TEXT \ -"You've done it! The hideous cyber-\n"\ -"demon lord that ruled the lost Deimos\n"\ -"moon base has been slain and you\n"\ -"are triumphant! But ... where are\n"\ -"you? You clamber to the edge of the\n"\ -"moon and look down to see the awful\n"\ -"truth.\n" \ -"\n"\ -"Deimos floats above Hell itself!\n"\ -"You've never heard of anyone escaping\n"\ -"from Hell, but you'll make the bastards\n"\ -"sorry they ever heard of you! Quickly,\n"\ -"you rappel down to the surface of\n"\ -"Hell.\n"\ -"\n" \ -"Now, it's on to the final chapter of\n"\ -"DOOM! -- Inferno." - - -#define E3TEXT \ -"The loathsome spiderdemon that\n"\ -"masterminded the invasion of the moon\n"\ -"bases and caused so much death has had\n"\ -"its ass kicked for all time.\n"\ -"\n"\ -"A hidden doorway opens and you enter.\n"\ -"You've proven too tough for Hell to\n"\ -"contain, and now Hell at last plays\n"\ -"fair -- for you emerge from the door\n"\ -"to see the green fields of Earth!\n"\ -"Home at last.\n" \ -"\n"\ -"You wonder what's been happening on\n"\ -"Earth while you were battling evil\n"\ -"unleashed. It's good that no Hell-\n"\ -"spawn could have come through that\n"\ -"door with you ..." - - -#define E4TEXT \ -"the spider mastermind must have sent forth\n"\ -"its legions of hellspawn before your\n"\ -"final confrontation with that terrible\n"\ -"beast from hell. but you stepped forward\n"\ -"and brought forth eternal damnation and\n"\ -"suffering upon the horde as a true hero\n"\ -"would in the face of something so evil.\n"\ -"\n"\ -"besides, someone was gonna pay for what\n"\ -"happened to daisy, your pet rabbit.\n"\ -"\n"\ -"but now, you see spread before you more\n"\ -"potential pain and gibbitude as a nation\n"\ -"of demons run amok among our cities.\n"\ -"\n"\ -"next stop, hell on earth!" - - -// after level 6, put this: - -#define C1TEXT \ -"YOU HAVE ENTERED DEEPLY INTO THE INFESTED\n" \ -"STARPORT. BUT SOMETHING IS WRONG. THE\n" \ -"MONSTERS HAVE BROUGHT THEIR OWN REALITY\n" \ -"WITH THEM, AND THE STARPORT'S TECHNOLOGY\n" \ -"IS BEING SUBVERTED BY THEIR PRESENCE.\n" \ -"\n"\ -"AHEAD, YOU SEE AN OUTPOST OF HELL, A\n" \ -"FORTIFIED ZONE. IF YOU CAN GET PAST IT,\n" \ -"YOU CAN PENETRATE INTO THE HAUNTED HEART\n" \ -"OF THE STARBASE AND FIND THE CONTROLLING\n" \ -"SWITCH WHICH HOLDS EARTH'S POPULATION\n" \ -"HOSTAGE." - -// After level 11, put this: - -#define C2TEXT \ -"YOU HAVE WON! YOUR VICTORY HAS ENABLED\n" \ -"HUMANKIND TO EVACUATE EARTH AND ESCAPE\n"\ -"THE NIGHTMARE. NOW YOU ARE THE ONLY\n"\ -"HUMAN LEFT ON THE FACE OF THE PLANET.\n"\ -"CANNIBAL MUTATIONS, CARNIVOROUS ALIENS,\n"\ -"AND EVIL SPIRITS ARE YOUR ONLY NEIGHBORS.\n"\ -"YOU SIT BACK AND WAIT FOR DEATH, CONTENT\n"\ -"THAT YOU HAVE SAVED YOUR SPECIES.\n"\ -"\n"\ -"BUT THEN, EARTH CONTROL BEAMS DOWN A\n"\ -"MESSAGE FROM SPACE: \"SENSORS HAVE LOCATED\n"\ -"THE SOURCE OF THE ALIEN INVASION. IF YOU\n"\ -"GO THERE, YOU MAY BE ABLE TO BLOCK THEIR\n"\ -"ENTRY. THE ALIEN BASE IS IN THE HEART OF\n"\ -"YOUR OWN HOME CITY, NOT FAR FROM THE\n"\ -"STARPORT.\" SLOWLY AND PAINFULLY YOU GET\n"\ -"UP AND RETURN TO THE FRAY." - - -// After level 20, put this: - -#define C3TEXT \ -"YOU ARE AT THE CORRUPT HEART OF THE CITY,\n"\ -"SURROUNDED BY THE CORPSES OF YOUR ENEMIES.\n"\ -"YOU SEE NO WAY TO DESTROY THE CREATURES'\n"\ -"ENTRYWAY ON THIS SIDE, SO YOU CLENCH YOUR\n"\ -"TEETH AND PLUNGE THROUGH IT.\n"\ -"\n"\ -"THERE MUST BE A WAY TO CLOSE IT ON THE\n"\ -"OTHER SIDE. WHAT DO YOU CARE IF YOU'VE\n"\ -"GOT TO GO THROUGH HELL TO GET TO IT?" - - -// After level 29, put this: - -#define C4TEXT \ -"THE HORRENDOUS VISAGE OF THE BIGGEST\n"\ -"DEMON YOU'VE EVER SEEN CRUMBLES BEFORE\n"\ -"YOU, AFTER YOU PUMP YOUR ROCKETS INTO\n"\ -"HIS EXPOSED BRAIN. THE MONSTER SHRIVELS\n"\ -"UP AND DIES, ITS THRASHING LIMBS\n"\ -"DEVASTATING UNTOLD MILES OF HELL'S\n"\ -"SURFACE.\n"\ -"\n"\ -"YOU'VE DONE IT. THE INVASION IS OVER.\n"\ -"EARTH IS SAVED. HELL IS A WRECK. YOU\n"\ -"WONDER WHERE BAD FOLKS WILL GO WHEN THEY\n"\ -"DIE, NOW. WIPING THE SWEAT FROM YOUR\n"\ -"FOREHEAD YOU BEGIN THE LONG TREK BACK\n"\ -"HOME. REBUILDING EARTH OUGHT TO BE A\n"\ -"LOT MORE FUN THAN RUINING IT WAS.\n" - - - -// Before level 31, put this: - -#define C5TEXT \ -"CONGRATULATIONS, YOU'VE FOUND THE SECRET\n"\ -"LEVEL! LOOKS LIKE IT'S BEEN BUILT BY\n"\ -"HUMANS, RATHER THAN DEMONS. YOU WONDER\n"\ -"WHO THE INMATES OF THIS CORNER OF HELL\n"\ -"WILL BE." - - -// Before level 32, put this: - -#define C6TEXT \ -"CONGRATULATIONS, YOU'VE FOUND THE\n"\ -"SUPER SECRET LEVEL! YOU'D BETTER\n"\ -"BLAZE THROUGH THIS ONE!\n" - - -// after map 06 - -#define P1TEXT \ -"You gloat over the steaming carcass of the\n"\ -"Guardian. With its death, you've wrested\n"\ -"the Accelerator from the stinking claws\n"\ -"of Hell. You relax and glance around the\n"\ -"room. Damn! There was supposed to be at\n"\ -"least one working prototype, but you can't\n"\ -"see it. The demons must have taken it.\n"\ -"\n"\ -"You must find the prototype, or all your\n"\ -"struggles will have been wasted. Keep\n"\ -"moving, keep fighting, keep killing.\n"\ -"Oh yes, keep living, too." - - -// after map 11 - -#define P2TEXT \ -"Even the deadly Arch-Vile labyrinth could\n"\ -"not stop you, and you've gotten to the\n"\ -"prototype Accelerator which is soon\n"\ -"efficiently and permanently deactivated.\n"\ -"\n"\ -"You're good at that kind of thing." - - -// after map 20 - -#define P3TEXT \ -"You've bashed and battered your way into\n"\ -"the heart of the devil-hive. Time for a\n"\ -"Search-and-Destroy mission, aimed at the\n"\ -"Gatekeeper, whose foul offspring is\n"\ -"cascading to Earth. Yeah, he's bad. But\n"\ -"you know who's worse!\n"\ -"\n"\ -"Grinning evilly, you check your gear, and\n"\ -"get ready to give the bastard a little Hell\n"\ -"of your own making!" - -// after map 30 - -#define P4TEXT \ -"The Gatekeeper's evil face is splattered\n"\ -"all over the place. As its tattered corpse\n"\ -"collapses, an inverted Gate forms and\n"\ -"sucks down the shards of the last\n"\ -"prototype Accelerator, not to mention the\n"\ -"few remaining demons. You're done. Hell\n"\ -"has gone back to pounding bad dead folks \n"\ -"instead of good live ones. Remember to\n"\ -"tell your grandkids to put a rocket\n"\ -"launcher in your coffin. If you go to Hell\n"\ -"when you die, you'll need it for some\n"\ -"final cleaning-up ..." - -// before map 31 - -#define P5TEXT \ -"You've found the second-hardest level we\n"\ -"got. Hope you have a saved game a level or\n"\ -"two previous. If not, be prepared to die\n"\ -"aplenty. For master marines only." - -// before map 32 - -#define P6TEXT \ -"Betcha wondered just what WAS the hardest\n"\ -"level we had ready for ya? Now you know.\n"\ -"No one gets out alive." - - -#define T1TEXT \ -"You've fought your way out of the infested\n"\ -"experimental labs. It seems that UAC has\n"\ -"once again gulped it down. With their\n"\ -"high turnover, it must be hard for poor\n"\ -"old UAC to buy corporate health insurance\n"\ -"nowadays..\n"\ -"\n"\ -"Ahead lies the military complex, now\n"\ -"swarming with diseased horrors hot to get\n"\ -"their teeth into you. With luck, the\n"\ -"complex still has some warlike ordnance\n"\ -"laying around." - - -#define T2TEXT \ -"You hear the grinding of heavy machinery\n"\ -"ahead. You sure hope they're not stamping\n"\ -"out new hellspawn, but you're ready to\n"\ -"ream out a whole herd if you have to.\n"\ -"They might be planning a blood feast, but\n"\ -"you feel about as mean as two thousand\n"\ -"maniacs packed into one mad killer.\n"\ -"\n"\ -"You don't plan to go down easy." - - -#define T3TEXT \ -"The vista opening ahead looks real damn\n"\ -"familiar. Smells familiar, too -- like\n"\ -"fried excrement. You didn't like this\n"\ -"place before, and you sure as hell ain't\n"\ -"planning to like it now. The more you\n"\ -"brood on it, the madder you get.\n"\ -"Hefting your gun, an evil grin trickles\n"\ -"onto your face. Time to take some names." - -#define T4TEXT \ -"Suddenly, all is silent, from one horizon\n"\ -"to the other. The agonizing echo of Hell\n"\ -"fades away, the nightmare sky turns to\n"\ -"blue, the heaps of monster corpses start \n"\ -"to evaporate along with the evil stench \n"\ -"that filled the air. Jeeze, maybe you've\n"\ -"done it. Have you really won?\n"\ -"\n"\ -"Something rumbles in the distance.\n"\ -"A blue light begins to glow inside the\n"\ -"ruined skull of the demon-spitter." - - -#define T5TEXT \ -"What now? Looks totally different. Kind\n"\ -"of like King Tut's condo. Well,\n"\ -"whatever's here can't be any worse\n"\ -"than usual. Can it? Or maybe it's best\n"\ -"to let sleeping gods lie.." - - -#define T6TEXT \ -"Time for a vacation. You've burst the\n"\ -"bowels of hell and by golly you're ready\n"\ -"for a break. You mutter to yourself,\n"\ -"Maybe someone else can kick Hell's ass\n"\ -"next time around. Ahead lies a quiet town,\n"\ -"with peaceful flowing water, quaint\n"\ -"buildings, and presumably no Hellspawn.\n"\ -"\n"\ -"As you step off the transport, you hear\n"\ -"the stomp of a cyberdemon's iron shoe." - - - -// -// Character cast strings F_FINALE.C -// -#define CC_ZOMBIE "ZOMBIEMAN" -#define CC_SHOTGUN "SHOTGUN GUY" -#define CC_HEAVY "HEAVY WEAPON DUDE" -#define CC_IMP "IMP" -#define CC_DEMON "DEMON" -#define CC_LOST "LOST SOUL" -#define CC_CACO "CACODEMON" -#define CC_HELL "HELL KNIGHT" -#define CC_BARON "BARON OF HELL" -#define CC_ARACH "ARACHNOTRON" -#define CC_PAIN "PAIN ELEMENTAL" -#define CC_REVEN "REVENANT" -#define CC_MANCU "MANCUBUS" -#define CC_ARCH "ARCH-VILE" -#define CC_SPIDER "THE SPIDER MASTERMIND" -#define CC_CYBER "THE CYBERDEMON" -#define CC_HERO "OUR HERO" - - -#endif -//----------------------------------------------------------------------------- -// -// $Log:$ -// -//----------------------------------------------------------------------------- diff --git a/linuxdoom-1.10/i_sound.c b/linuxdoom-1.10/i_sound.c @@ -1,985 +0,0 @@ -// Emacs style mode select -*- C++ -*- -//----------------------------------------------------------------------------- -// -// $Id:$ -// -// Copyright (C) 1993-1996 by id Software, Inc. -// -// This source is available for distribution and/or modification -// only under the terms of the DOOM Source Code License as -// published by id Software. All rights reserved. -// -// The source is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// FITNESS FOR A PARTICULAR PURPOSE. See the DOOM Source Code License -// for more details. -// -// $Log:$ -// -// DESCRIPTION: -// System interface for sound. -// -//----------------------------------------------------------------------------- - -static const char -rcsid[] = "$Id: i_unix.c,v 1.5 1997/02/03 22:45:10 b1 Exp $"; - -#include <stdio.h> -#include <stdlib.h> -#include <stdarg.h> - -#include <math.h> - -#include <sys/time.h> -#include <sys/types.h> - -#ifndef LINUX -#include <sys/filio.h> -#endif - -#include <fcntl.h> -#include <unistd.h> -#include <sys/ioctl.h> - -// Linux voxware output. -#include <linux/soundcard.h> - -// Timer stuff. Experimental. -#include <time.h> -#include <signal.h> - -#include "z_zone.h" - -#include "i_system.h" -#include "i_sound.h" -#include "m_argv.h" -#include "m_misc.h" -#include "w_wad.h" - -#include "doomdef.h" - -// UNIX hack, to be removed. -#ifdef SNDSERV -// Separate sound server process. -FILE* sndserver=0; -char* sndserver_filename = "./sndserver "; -#elif SNDINTR - -// Update all 30 millisecs, approx. 30fps synchronized. -// Linux resolution is allegedly 10 millisecs, -// scale is microseconds. -#define SOUND_INTERVAL 500 - -// Get the interrupt. Set duration in millisecs. -int I_SoundSetTimer( int duration_of_tick ); -void I_SoundDelTimer( void ); -#else -// None? -#endif - - -// A quick hack to establish a protocol between -// synchronous mix buffer updates and asynchronous -// audio writes. Probably redundant with gametic. -static int flag = 0; - -// The number of internal mixing channels, -// the samples calculated for each mixing step, -// the size of the 16bit, 2 hardware channel (stereo) -// mixing buffer, and the samplerate of the raw data. - - -// Needed for calling the actual sound output. -#define SAMPLECOUNT 512 -#define NUM_CHANNELS 8 -// It is 2 for 16bit, and 2 for two channels. -#define BUFMUL 4 -#define MIXBUFFERSIZE (SAMPLECOUNT*BUFMUL) - -#define SAMPLERATE 11025 // Hz -#define SAMPLESIZE 2 // 16bit - -// The actual lengths of all sound effects. -int lengths[NUMSFX]; - -// The actual output device. -int audio_fd; - -// The global mixing buffer. -// Basically, samples from all active internal channels -// are modifed and added, and stored in the buffer -// that is submitted to the audio device. -signed short mixbuffer[MIXBUFFERSIZE]; - - -// The channel step amount... -unsigned int channelstep[NUM_CHANNELS]; -// ... and a 0.16 bit remainder of last step. -unsigned int channelstepremainder[NUM_CHANNELS]; - - -// The channel data pointers, start and end. -unsigned char* channels[NUM_CHANNELS]; -unsigned char* channelsend[NUM_CHANNELS]; - - -// Time/gametic that the channel started playing, -// used to determine oldest, which automatically -// has lowest priority. -// In case number of active sounds exceeds -// available channels. -int channelstart[NUM_CHANNELS]; - -// The sound in channel handles, -// determined on registration, -// might be used to unregister/stop/modify, -// currently unused. -int channelhandles[NUM_CHANNELS]; - -// SFX id of the playing sound effect. -// Used to catch duplicates (like chainsaw). -int channelids[NUM_CHANNELS]; - -// Pitch to stepping lookup, unused. -int steptable[256]; - -// Volume lookups. -int vol_lookup[128*256]; - -// Hardware left and right channel volume lookup. -int* channelleftvol_lookup[NUM_CHANNELS]; -int* channelrightvol_lookup[NUM_CHANNELS]; - - - - -// -// Safe ioctl, convenience. -// -void -myioctl -( int fd, - int command, - int* arg ) -{ - int rc; - extern int errno; - - rc = ioctl(fd, command, arg); - if (rc < 0) - { - fprintf(stderr, "ioctl(dsp,%d,arg) failed\n", command); - fprintf(stderr, "errno=%d\n", errno); - exit(-1); - } -} - - - - - -// -// This function loads the sound data from the WAD lump, -// for single sound. -// -void* -getsfx -( char* sfxname, - int* len ) -{ - unsigned char* sfx; - unsigned char* paddedsfx; - int i; - int size; - int paddedsize; - char name[20]; - int sfxlump; - - - // Get the sound data from the WAD, allocate lump - // in zone memory. - sprintf(name, "ds%s", sfxname); - - // Now, there is a severe problem with the - // sound handling, in it is not (yet/anymore) - // gamemode aware. That means, sounds from - // DOOM II will be requested even with DOOM - // shareware. - // The sound list is wired into sounds.c, - // which sets the external variable. - // I do not do runtime patches to that - // variable. Instead, we will use a - // default sound for replacement. - if ( W_CheckNumForName(name) == -1 ) - sfxlump = W_GetNumForName("dspistol"); - else - sfxlump = W_GetNumForName(name); - - size = W_LumpLength( sfxlump ); - - // Debug. - // fprintf( stderr, "." ); - //fprintf( stderr, " -loading %s (lump %d, %d bytes)\n", - // sfxname, sfxlump, size ); - //fflush( stderr ); - - sfx = (unsigned char*)W_CacheLumpNum( sfxlump, PU_STATIC ); - - // Pads the sound effect out to the mixing buffer size. - // The original realloc would interfere with zone memory. - paddedsize = ((size-8 + (SAMPLECOUNT-1)) / SAMPLECOUNT) * SAMPLECOUNT; - - // Allocate from zone memory. - paddedsfx = (unsigned char*)Z_Malloc( paddedsize+8, PU_STATIC, 0 ); - // ddt: (unsigned char *) realloc(sfx, paddedsize+8); - // This should interfere with zone memory handling, - // which does not kick in in the soundserver. - - // Now copy and pad. - memcpy( paddedsfx, sfx, size ); - for (i=size ; i<paddedsize+8 ; i++) - paddedsfx[i] = 128; - - // Remove the cached lump. - Z_Free( sfx ); - - // Preserve padded length. - *len = paddedsize; - - // Return allocated padded data. - return (void *) (paddedsfx + 8); -} - - - - - -// -// This function adds a sound to the -// list of currently active sounds, -// which is maintained as a given number -// (eight, usually) of internal channels. -// Returns a handle. -// -int -addsfx -( int sfxid, - int volume, - int step, - int seperation ) -{ - static unsigned short handlenums = 0; - - int i; - int rc = -1; - - int oldest = gametic; - int oldestnum = 0; - int slot; - - int rightvol; - int leftvol; - - // Chainsaw troubles. - // Play these sound effects only one at a time. - if ( sfxid == sfx_sawup - || sfxid == sfx_sawidl - || sfxid == sfx_sawful - || sfxid == sfx_sawhit - || sfxid == sfx_stnmov - || sfxid == sfx_pistol ) - { - // Loop all channels, check. - for (i=0 ; i<NUM_CHANNELS ; i++) - { - // Active, and using the same SFX? - if ( (channels[i]) - && (channelids[i] == sfxid) ) - { - // Reset. - channels[i] = 0; - // We are sure that iff, - // there will only be one. - break; - } - } - } - - // Loop all channels to find oldest SFX. - for (i=0; (i<NUM_CHANNELS) && (channels[i]); i++) - { - if (channelstart[i] < oldest) - { - oldestnum = i; - oldest = channelstart[i]; - } - } - - // Tales from the cryptic. - // If we found a channel, fine. - // If not, we simply overwrite the first one, 0. - // Probably only happens at startup. - if (i == NUM_CHANNELS) - slot = oldestnum; - else - slot = i; - - // Okay, in the less recent channel, - // we will handle the new SFX. - // Set pointer to raw data. - channels[slot] = (unsigned char *) S_sfx[sfxid].data; - // Set pointer to end of raw data. - channelsend[slot] = channels[slot] + lengths[sfxid]; - - // Reset current handle number, limited to 0..100. - if (!handlenums) - handlenums = 100; - - // Assign current handle number. - // Preserved so sounds could be stopped (unused). - channelhandles[slot] = rc = handlenums++; - - // Set stepping??? - // Kinda getting the impression this is never used. - channelstep[slot] = step; - // ??? - channelstepremainder[slot] = 0; - // Should be gametic, I presume. - channelstart[slot] = gametic; - - // Separation, that is, orientation/stereo. - // range is: 1 - 256 - seperation += 1; - - // Per left/right channel. - // x^2 seperation, - // adjust volume properly. - leftvol = - volume - ((volume*seperation*seperation) >> 16); ///(256*256); - seperation = seperation - 257; - rightvol = - volume - ((volume*seperation*seperation) >> 16); - - // Sanity check, clamp volume. - if (rightvol < 0 || rightvol > 127) - I_Error("rightvol out of bounds"); - - if (leftvol < 0 || leftvol > 127) - I_Error("leftvol out of bounds"); - - // Get the proper lookup table piece - // for this volume level??? - channelleftvol_lookup[slot] = &vol_lookup[leftvol*256]; - channelrightvol_lookup[slot] = &vol_lookup[rightvol*256]; - - // Preserve sound SFX id, - // e.g. for avoiding duplicates of chainsaw. - channelids[slot] = sfxid; - - // You tell me. - return rc; -} - - - - - -// -// SFX API -// Note: this was called by S_Init. -// However, whatever they did in the -// old DPMS based DOS version, this -// were simply dummies in the Linux -// version. -// See soundserver initdata(). -// -void I_SetChannels() -{ - // Init internal lookups (raw data, mixing buffer, channels). - // This function sets up internal lookups used during - // the mixing process. - int i; - int j; - - int* steptablemid = steptable + 128; - - // Okay, reset internal mixing channels to zero. - /*for (i=0; i<NUM_CHANNELS; i++) - { - channels[i] = 0; - }*/ - - // This table provides step widths for pitch parameters. - // I fail to see that this is currently used. - for (i=-128 ; i<128 ; i++) - steptablemid[i] = (int)(pow(2.0, (i/64.0))*65536.0); - - - // Generates volume lookup tables - // which also turn the unsigned samples - // into signed samples. - for (i=0 ; i<128 ; i++) - for (j=0 ; j<256 ; j++) - vol_lookup[i*256+j] = (i*(j-128)*256)/127; -} - - -void I_SetSfxVolume(int volume) -{ - // Identical to DOS. - // Basically, this should propagate - // the menu/config file setting - // to the state variable used in - // the mixing. - snd_SfxVolume = volume; -} - -// MUSIC API - dummy. Some code from DOS version. -void I_SetMusicVolume(int volume) -{ - // Internal state variable. - snd_MusicVolume = volume; - // Now set volume on output device. - // Whatever( snd_MusciVolume ); -} - - -// -// Retrieve the raw data lump index -// for a given SFX name. -// -int I_GetSfxLumpNum(sfxinfo_t* sfx) -{ - char namebuf[9]; - sprintf(namebuf, "ds%s", sfx->name); - return W_GetNumForName(namebuf); -} - -// -// Starting a sound means adding it -// to the current list of active sounds -// in the internal channels. -// As the SFX info struct contains -// e.g. a pointer to the raw data, -// it is ignored. -// As our sound handling does not handle -// priority, it is ignored. -// Pitching (that is, increased speed of playback) -// is set, but currently not used by mixing. -// -int -I_StartSound -( int id, - int vol, - int sep, - int pitch, - int priority ) -{ - - // UNUSED - priority = 0; - -#ifdef SNDSERV - if (sndserver) - { - fprintf(sndserver, "p%2.2x%2.2x%2.2x%2.2x\n", id, pitch, vol, sep); - fflush(sndserver); - } - // warning: control reaches end of non-void function. - return id; -#else - // Debug. - //fprintf( stderr, "starting sound %d", id ); - - // Returns a handle (not used). - id = addsfx( id, vol, steptable[pitch], sep ); - - // fprintf( stderr, "/handle is %d\n", id ); - - return id; -#endif -} - - - -void I_StopSound (int handle) -{ - // You need the handle returned by StartSound. - // Would be looping all channels, - // tracking down the handle, - // an setting the channel to zero. - - // UNUSED. - handle = 0; -} - - -int I_SoundIsPlaying(int handle) -{ - // Ouch. - return gametic < handle; -} - - - - -// -// This function loops all active (internal) sound -// channels, retrieves a given number of samples -// from the raw sound data, modifies it according -// to the current (internal) channel parameters, -// mixes the per channel samples into the global -// mixbuffer, clamping it to the allowed range, -// and sets up everything for transferring the -// contents of the mixbuffer to the (two) -// hardware channels (left and right, that is). -// -// This function currently supports only 16bit. -// -void I_UpdateSound( void ) -{ -#ifdef SNDINTR - // Debug. Count buffer misses with interrupt. - static int misses = 0; -#endif - - - // Mix current sound data. - // Data, from raw sound, for right and left. - register unsigned int sample; - register int dl; - register int dr; - - // Pointers in global mixbuffer, left, right, end. - signed short* leftout; - signed short* rightout; - signed short* leftend; - // Step in mixbuffer, left and right, thus two. - int step; - - // Mixing channel index. - int chan; - - // Left and right channel - // are in global mixbuffer, alternating. - leftout = mixbuffer; - rightout = mixbuffer+1; - step = 2; - - // Determine end, for left channel only - // (right channel is implicit). - leftend = mixbuffer + SAMPLECOUNT*step; - - // Mix sounds into the mixing buffer. - // Loop over step*SAMPLECOUNT, - // that is 512 values for two channels. - while (leftout != leftend) - { - // Reset left/right value. - dl = 0; - dr = 0; - - // Love thy L2 chache - made this a loop. - // Now more channels could be set at compile time - // as well. Thus loop those channels. - for ( chan = 0; chan < NUM_CHANNELS; chan++ ) - { - // Check channel, if active. - if (channels[ chan ]) - { - // Get the raw data from the channel. - sample = *channels[ chan ]; - // Add left and right part - // for this channel (sound) - // to the current data. - // Adjust volume accordingly. - dl += channelleftvol_lookup[ chan ][sample]; - dr += channelrightvol_lookup[ chan ][sample]; - // Increment index ??? - channelstepremainder[ chan ] += channelstep[ chan ]; - // MSB is next sample??? - channels[ chan ] += channelstepremainder[ chan ] >> 16; - // Limit to LSB??? - channelstepremainder[ chan ] &= 65536-1; - - // Check whether we are done. - if (channels[ chan ] >= channelsend[ chan ]) - channels[ chan ] = 0; - } - } - - // Clamp to range. Left hardware channel. - // Has been char instead of short. - // if (dl > 127) *leftout = 127; - // else if (dl < -128) *leftout = -128; - // else *leftout = dl; - - if (dl > 0x7fff) - *leftout = 0x7fff; - else if (dl < -0x8000) - *leftout = -0x8000; - else - *leftout = dl; - - // Same for right hardware channel. - if (dr > 0x7fff) - *rightout = 0x7fff; - else if (dr < -0x8000) - *rightout = -0x8000; - else - *rightout = dr; - - // Increment current pointers in mixbuffer. - leftout += step; - rightout += step; - } - -#ifdef SNDINTR - // Debug check. - if ( flag ) - { - misses += flag; - flag = 0; - } - - if ( misses > 10 ) - { - fprintf( stderr, "I_SoundUpdate: missed 10 buffer writes\n"); - misses = 0; - } - - // Increment flag for update. - flag++; -#endif -} - - -// -// This would be used to write out the mixbuffer -// during each game loop update. -// Updates sound buffer and audio device at runtime. -// It is called during Timer interrupt with SNDINTR. -// Mixing now done synchronous, and -// only output be done asynchronous? -// -void -I_SubmitSound(void) -{ - // Write it to DSP device. - write(audio_fd, mixbuffer, SAMPLECOUNT*BUFMUL); -} - - - -void -I_UpdateSoundParams -( int handle, - int vol, - int sep, - int pitch) -{ - // I fail too see that this is used. - // Would be using the handle to identify - // on which channel the sound might be active, - // and resetting the channel parameters. - - // UNUSED. - handle = vol = sep = pitch = 0; -} - - - - -void I_ShutdownSound(void) -{ -#ifdef SNDSERV - if (sndserver) - { - // Send a "quit" command. - fprintf(sndserver, "q\n"); - fflush(sndserver); - } -#else - // Wait till all pending sounds are finished. - int done = 0; - int i; - - - // FIXME (below). - fprintf( stderr, "I_ShutdownSound: NOT finishing pending sounds\n"); - fflush( stderr ); - - while ( !done ) - { - for( i=0 ; i<8 && !channels[i] ; i++); - - // FIXME. No proper channel output. - //if (i==8) - done=1; - } -#ifdef SNDINTR - I_SoundDelTimer(); -#endif - - // Cleaning up -releasing the DSP device. - close ( audio_fd ); -#endif - - // Done. - return; -} - - - - - - -void -I_InitSound() -{ -#ifdef SNDSERV - char buffer[256]; - - if (getenv("DOOMWADDIR")) - sprintf(buffer, "%s/%s", - getenv("DOOMWADDIR"), - sndserver_filename); - else - sprintf(buffer, "%s", sndserver_filename); - - // start sound process - if ( !access(buffer, X_OK) ) - { - strcat(buffer, " -quiet"); - sndserver = popen(buffer, "w"); - } - else - fprintf(stderr, "Could not start sound server [%s]\n", buffer); -#else - - int i; - -#ifdef SNDINTR - fprintf( stderr, "I_SoundSetTimer: %d microsecs\n", SOUND_INTERVAL ); - I_SoundSetTimer( SOUND_INTERVAL ); -#endif - - // Secure and configure sound device first. - fprintf( stderr, "I_InitSound: "); - - audio_fd = open("/dev/dsp", O_WRONLY); - if (audio_fd<0) - fprintf(stderr, "Could not open /dev/dsp\n"); - - - i = 11 | (2<<16); - myioctl(audio_fd, SNDCTL_DSP_SETFRAGMENT, &i); - myioctl(audio_fd, SNDCTL_DSP_RESET, 0); - - i=SAMPLERATE; - - myioctl(audio_fd, SNDCTL_DSP_SPEED, &i); - - i=1; - myioctl(audio_fd, SNDCTL_DSP_STEREO, &i); - - myioctl(audio_fd, SNDCTL_DSP_GETFMTS, &i); - - if (i&=AFMT_S16_LE) - myioctl(audio_fd, SNDCTL_DSP_SETFMT, &i); - else - fprintf(stderr, "Could not play signed 16 data\n"); - - fprintf(stderr, " configured audio device\n" ); - - - // Initialize external data (all sounds) at start, keep static. - fprintf( stderr, "I_InitSound: "); - - for (i=1 ; i<NUMSFX ; i++) - { - // Alias? Example is the chaingun sound linked to pistol. - if (!S_sfx[i].link) - { - // Load data from WAD file. - S_sfx[i].data = getsfx( S_sfx[i].name, &lengths[i] ); - } - else - { - // Previously loaded already? - S_sfx[i].data = S_sfx[i].link->data; - lengths[i] = lengths[(S_sfx[i].link - S_sfx)/sizeof(sfxinfo_t)]; - } - } - - fprintf( stderr, " pre-cached all sound data\n"); - - // Now initialize mixbuffer with zero. - for ( i = 0; i< MIXBUFFERSIZE; i++ ) - mixbuffer[i] = 0; - - // Finished initialization. - fprintf(stderr, "I_InitSound: sound module ready\n"); - -#endif -} - - - - -// -// MUSIC API. -// Still no music done. -// Remains. Dummies. -// -void I_InitMusic(void) { } -void I_ShutdownMusic(void) { } - -static int looping=0; -static int musicdies=-1; - -void I_PlaySong(int handle, int looping) -{ - // UNUSED. - handle = looping = 0; - musicdies = gametic + TICRATE*30; -} - -void I_PauseSong (int handle) -{ - // UNUSED. - handle = 0; -} - -void I_ResumeSong (int handle) -{ - // UNUSED. - handle = 0; -} - -void I_StopSong(int handle) -{ - // UNUSED. - handle = 0; - - looping = 0; - musicdies = 0; -} - -void I_UnRegisterSong(int handle) -{ - // UNUSED. - handle = 0; -} - -int I_RegisterSong(void* data) -{ - // UNUSED. - data = NULL; - - return 1; -} - -// Is the song playing? -int I_QrySongPlaying(int handle) -{ - // UNUSED. - handle = 0; - return looping || musicdies > gametic; -} - - - -// -// Experimental stuff. -// A Linux timer interrupt, for asynchronous -// sound output. -// I ripped this out of the Timer class in -// our Difference Engine, including a few -// SUN remains... -// -#ifdef sun - typedef sigset_t tSigSet; -#else - typedef int tSigSet; -#endif - - -// We might use SIGVTALRM and ITIMER_VIRTUAL, if the process -// time independend timer happens to get lost due to heavy load. -// SIGALRM and ITIMER_REAL doesn't really work well. -// There are issues with profiling as well. -static int /*__itimer_which*/ itimer = ITIMER_REAL; - -static int sig = SIGALRM; - -// Interrupt handler. -void I_HandleSoundTimer( int ignore ) -{ - // Debug. - //fprintf( stderr, "%c", '+' ); fflush( stderr ); - - // Feed sound device if necesary. - if ( flag ) - { - // See I_SubmitSound(). - // Write it to DSP device. - write(audio_fd, mixbuffer, SAMPLECOUNT*BUFMUL); - - // Reset flag counter. - flag = 0; - } - else - return; - - // UNUSED, but required. - ignore = 0; - return; -} - -// Get the interrupt. Set duration in millisecs. -int I_SoundSetTimer( int duration_of_tick ) -{ - // Needed for gametick clockwork. - struct itimerval value; - struct itimerval ovalue; - struct sigaction act; - struct sigaction oact; - - int res; - - // This sets to SA_ONESHOT and SA_NOMASK, thus we can not use it. - // signal( _sig, handle_SIG_TICK ); - - // Now we have to change this attribute for repeated calls. - act.sa_handler = I_HandleSoundTimer; -#ifndef sun - //ac t.sa_mask = _sig; -#endif - act.sa_flags = SA_RESTART; - - sigaction( sig, &act, &oact ); - - value.it_interval.tv_sec = 0; - value.it_interval.tv_usec = duration_of_tick; - value.it_value.tv_sec = 0; - value.it_value.tv_usec = duration_of_tick; - - // Error is -1. - res = setitimer( itimer, &value, &ovalue ); - - // Debug. - if ( res == -1 ) - fprintf( stderr, "I_SoundSetTimer: interrupt n.a.\n"); - - return res; -} - - -// Remove the interrupt. Set duration to zero. -void I_SoundDelTimer() -{ - // Debug. - if ( I_SoundSetTimer( 0 ) == -1) - fprintf( stderr, "I_SoundDelTimer: failed to remove interrupt. Doh!\n"); -} diff --git a/linuxdoom-1.10/i_video.c b/linuxdoom-1.10/i_video.c @@ -1,1050 +0,0 @@ -// Emacs style mode select -*- C++ -*- -//----------------------------------------------------------------------------- -// -// $Id:$ -// -// Copyright (C) 1993-1996 by id Software, Inc. -// -// This source is available for distribution and/or modification -// only under the terms of the DOOM Source Code License as -// published by id Software. All rights reserved. -// -// The source is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// FITNESS FOR A PARTICULAR PURPOSE. See the DOOM Source Code License -// for more details. -// -// $Log:$ -// -// DESCRIPTION: -// DOOM graphics stuff for X11, UNIX. -// -//----------------------------------------------------------------------------- - -static const char -rcsid[] = "$Id: i_x.c,v 1.6 1997/02/03 22:45:10 b1 Exp $"; - -#include <stdlib.h> -#include <unistd.h> -#include <sys/ipc.h> -#include <sys/shm.h> - -#include <X11/Xlib.h> -#include <X11/Xutil.h> -#include <X11/keysym.h> - -#include <X11/extensions/XShm.h> -// Had to dig up XShm.c for this one. -// It is in the libXext, but not in the XFree86 headers. -#ifdef LINUX -int XShmGetEventBase( Display* dpy ); // problems with g++? -#endif - -#include <stdarg.h> -#include <sys/time.h> -#include <sys/types.h> -#include <sys/socket.h> - -#include <netinet/in.h> -#include <errnos.h> -#include <signal.h> - -#include "doomstat.h" -#include "i_system.h" -#include "v_video.h" -#include "m_argv.h" -#include "d_main.h" - -#include "doomdef.h" - -#define POINTER_WARP_COUNTDOWN 1 - -Display* X_display=0; -Window X_mainWindow; -Colormap X_cmap; -Visual* X_visual; -GC X_gc; -XEvent X_event; -int X_screen; -XVisualInfo X_visualinfo; -XImage* image; -int X_width; -int X_height; - -// MIT SHared Memory extension. -boolean doShm; - -XShmSegmentInfo X_shminfo; -int X_shmeventtype; - -// Fake mouse handling. -// This cannot work properly w/o DGA. -// Needs an invisible mouse cursor at least. -boolean grabMouse; -int doPointerWarp = POINTER_WARP_COUNTDOWN; - -// Blocky mode, -// replace each 320x200 pixel with multiply*multiply pixels. -// According to Dave Taylor, it still is a bonehead thing -// to use .... -static int multiply=1; - - -// -// Translates the key currently in X_event -// - -int xlatekey(void) -{ - - int rc; - - switch(rc = XKeycodeToKeysym(X_display, X_event.xkey.keycode, 0)) - { - case XK_Left: rc = KEY_LEFTARROW; break; - case XK_Right: rc = KEY_RIGHTARROW; break; - case XK_Down: rc = KEY_DOWNARROW; break; - case XK_Up: rc = KEY_UPARROW; break; - case XK_Escape: rc = KEY_ESCAPE; break; - case XK_Return: rc = KEY_ENTER; break; - case XK_Tab: rc = KEY_TAB; break; - case XK_F1: rc = KEY_F1; break; - case XK_F2: rc = KEY_F2; break; - case XK_F3: rc = KEY_F3; break; - case XK_F4: rc = KEY_F4; break; - case XK_F5: rc = KEY_F5; break; - case XK_F6: rc = KEY_F6; break; - case XK_F7: rc = KEY_F7; break; - case XK_F8: rc = KEY_F8; break; - case XK_F9: rc = KEY_F9; break; - case XK_F10: rc = KEY_F10; break; - case XK_F11: rc = KEY_F11; break; - case XK_F12: rc = KEY_F12; break; - - case XK_BackSpace: - case XK_Delete: rc = KEY_BACKSPACE; break; - - case XK_Pause: rc = KEY_PAUSE; break; - - case XK_KP_Equal: - case XK_equal: rc = KEY_EQUALS; break; - - case XK_KP_Subtract: - case XK_minus: rc = KEY_MINUS; break; - - case XK_Shift_L: - case XK_Shift_R: - rc = KEY_RSHIFT; - break; - - case XK_Control_L: - case XK_Control_R: - rc = KEY_RCTRL; - break; - - case XK_Alt_L: - case XK_Meta_L: - case XK_Alt_R: - case XK_Meta_R: - rc = KEY_RALT; - break; - - default: - if (rc >= XK_space && rc <= XK_asciitilde) - rc = rc - XK_space + ' '; - if (rc >= 'A' && rc <= 'Z') - rc = rc - 'A' + 'a'; - break; - } - - return rc; - -} - -void I_ShutdownGraphics(void) -{ - // Detach from X server - if (!XShmDetach(X_display, &X_shminfo)) - I_Error("XShmDetach() failed in I_ShutdownGraphics()"); - - // Release shared memory. - shmdt(X_shminfo.shmaddr); - shmctl(X_shminfo.shmid, IPC_RMID, 0); - - // Paranoia. - image->data = NULL; -} - - - -// -// I_StartFrame -// -void I_StartFrame (void) -{ - // er? - -} - -static int lastmousex = 0; -static int lastmousey = 0; -boolean mousemoved = false; -boolean shmFinished; - -void I_GetEvent(void) -{ - - event_t event; - - // put event-grabbing stuff in here - XNextEvent(X_display, &X_event); - switch (X_event.type) - { - case KeyPress: - event.type = ev_keydown; - event.data1 = xlatekey(); - D_PostEvent(&event); - // fprintf(stderr, "k"); - break; - case KeyRelease: - event.type = ev_keyup; - event.data1 = xlatekey(); - D_PostEvent(&event); - // fprintf(stderr, "ku"); - break; - case ButtonPress: - event.type = ev_mouse; - event.data1 = - (X_event.xbutton.state & Button1Mask) - | (X_event.xbutton.state & Button2Mask ? 2 : 0) - | (X_event.xbutton.state & Button3Mask ? 4 : 0) - | (X_event.xbutton.button == Button1) - | (X_event.xbutton.button == Button2 ? 2 : 0) - | (X_event.xbutton.button == Button3 ? 4 : 0); - event.data2 = event.data3 = 0; - D_PostEvent(&event); - // fprintf(stderr, "b"); - break; - case ButtonRelease: - event.type = ev_mouse; - event.data1 = - (X_event.xbutton.state & Button1Mask) - | (X_event.xbutton.state & Button2Mask ? 2 : 0) - | (X_event.xbutton.state & Button3Mask ? 4 : 0); - // suggest parentheses around arithmetic in operand of | - event.data1 = - event.data1 - ^ (X_event.xbutton.button == Button1 ? 1 : 0) - ^ (X_event.xbutton.button == Button2 ? 2 : 0) - ^ (X_event.xbutton.button == Button3 ? 4 : 0); - event.data2 = event.data3 = 0; - D_PostEvent(&event); - // fprintf(stderr, "bu"); - break; - case MotionNotify: - event.type = ev_mouse; - event.data1 = - (X_event.xmotion.state & Button1Mask) - | (X_event.xmotion.state & Button2Mask ? 2 : 0) - | (X_event.xmotion.state & Button3Mask ? 4 : 0); - event.data2 = (X_event.xmotion.x - lastmousex) << 2; - event.data3 = (lastmousey - X_event.xmotion.y) << 2; - - if (event.data2 || event.data3) - { - lastmousex = X_event.xmotion.x; - lastmousey = X_event.xmotion.y; - if (X_event.xmotion.x != X_width/2 && - X_event.xmotion.y != X_height/2) - { - D_PostEvent(&event); - // fprintf(stderr, "m"); - mousemoved = false; - } else - { - mousemoved = true; - } - } - break; - - case Expose: - case ConfigureNotify: - break; - - default: - if (doShm && X_event.type == X_shmeventtype) shmFinished = true; - break; - } - -} - -Cursor -createnullcursor -( Display* display, - Window root ) -{ - Pixmap cursormask; - XGCValues xgc; - GC gc; - XColor dummycolour; - Cursor cursor; - - cursormask = XCreatePixmap(display, root, 1, 1, 1/*depth*/); - xgc.function = GXclear; - gc = XCreateGC(display, cursormask, GCFunction, &xgc); - XFillRectangle(display, cursormask, gc, 0, 0, 1, 1); - dummycolour.pixel = 0; - dummycolour.red = 0; - dummycolour.flags = 04; - cursor = XCreatePixmapCursor(display, cursormask, cursormask, - &dummycolour,&dummycolour, 0,0); - XFreePixmap(display,cursormask); - XFreeGC(display,gc); - return cursor; -} - -// -// I_StartTic -// -void I_StartTic (void) -{ - - if (!X_display) - return; - - while (XPending(X_display)) - I_GetEvent(); - - // Warp the pointer back to the middle of the window - // or it will wander off - that is, the game will - // loose input focus within X11. - if (grabMouse) - { - if (!--doPointerWarp) - { - XWarpPointer( X_display, - None, - X_mainWindow, - 0, 0, - 0, 0, - X_width/2, X_height/2); - - doPointerWarp = POINTER_WARP_COUNTDOWN; - } - } - - mousemoved = false; - -} - - -// -// I_UpdateNoBlit -// -void I_UpdateNoBlit (void) -{ - // what is this? -} - -// -// I_FinishUpdate -// -void I_FinishUpdate (void) -{ - - static int lasttic; - int tics; - int i; - // UNUSED static unsigned char *bigscreen=0; - - // draws little dots on the bottom of the screen - if (devparm) - { - - i = I_GetTime(); - tics = i - lasttic; - lasttic = i; - if (tics > 20) tics = 20; - - for (i=0 ; i<tics*2 ; i+=2) - screens[0][ (SCREENHEIGHT-1)*SCREENWIDTH + i] = 0xff; - for ( ; i<20*2 ; i+=2) - screens[0][ (SCREENHEIGHT-1)*SCREENWIDTH + i] = 0x0; - - } - - // scales the screen size before blitting it - if (multiply == 2) - { - unsigned int *olineptrs[2]; - unsigned int *ilineptr; - int x, y, i; - unsigned int twoopixels; - unsigned int twomoreopixels; - unsigned int fouripixels; - - ilineptr = (unsigned int *) (screens[0]); - for (i=0 ; i<2 ; i++) - olineptrs[i] = (unsigned int *) &image->data[i*X_width]; - - y = SCREENHEIGHT; - while (y--) - { - x = SCREENWIDTH; - do - { - fouripixels = *ilineptr++; - twoopixels = (fouripixels & 0xff000000) - | ((fouripixels>>8) & 0xffff00) - | ((fouripixels>>16) & 0xff); - twomoreopixels = ((fouripixels<<16) & 0xff000000) - | ((fouripixels<<8) & 0xffff00) - | (fouripixels & 0xff); -#ifdef __BIG_ENDIAN__ - *olineptrs[0]++ = twoopixels; - *olineptrs[1]++ = twoopixels; - *olineptrs[0]++ = twomoreopixels; - *olineptrs[1]++ = twomoreopixels; -#else - *olineptrs[0]++ = twomoreopixels; - *olineptrs[1]++ = twomoreopixels; - *olineptrs[0]++ = twoopixels; - *olineptrs[1]++ = twoopixels; -#endif - } while (x-=4); - olineptrs[0] += X_width/4; - olineptrs[1] += X_width/4; - } - - } - else if (multiply == 3) - { - unsigned int *olineptrs[3]; - unsigned int *ilineptr; - int x, y, i; - unsigned int fouropixels[3]; - unsigned int fouripixels; - - ilineptr = (unsigned int *) (screens[0]); - for (i=0 ; i<3 ; i++) - olineptrs[i] = (unsigned int *) &image->data[i*X_width]; - - y = SCREENHEIGHT; - while (y--) - { - x = SCREENWIDTH; - do - { - fouripixels = *ilineptr++; - fouropixels[0] = (fouripixels & 0xff000000) - | ((fouripixels>>8) & 0xff0000) - | ((fouripixels>>16) & 0xffff); - fouropixels[1] = ((fouripixels<<8) & 0xff000000) - | (fouripixels & 0xffff00) - | ((fouripixels>>8) & 0xff); - fouropixels[2] = ((fouripixels<<16) & 0xffff0000) - | ((fouripixels<<8) & 0xff00) - | (fouripixels & 0xff); -#ifdef __BIG_ENDIAN__ - *olineptrs[0]++ = fouropixels[0]; - *olineptrs[1]++ = fouropixels[0]; - *olineptrs[2]++ = fouropixels[0]; - *olineptrs[0]++ = fouropixels[1]; - *olineptrs[1]++ = fouropixels[1]; - *olineptrs[2]++ = fouropixels[1]; - *olineptrs[0]++ = fouropixels[2]; - *olineptrs[1]++ = fouropixels[2]; - *olineptrs[2]++ = fouropixels[2]; -#else - *olineptrs[0]++ = fouropixels[2]; - *olineptrs[1]++ = fouropixels[2]; - *olineptrs[2]++ = fouropixels[2]; - *olineptrs[0]++ = fouropixels[1]; - *olineptrs[1]++ = fouropixels[1]; - *olineptrs[2]++ = fouropixels[1]; - *olineptrs[0]++ = fouropixels[0]; - *olineptrs[1]++ = fouropixels[0]; - *olineptrs[2]++ = fouropixels[0]; -#endif - } while (x-=4); - olineptrs[0] += 2*X_width/4; - olineptrs[1] += 2*X_width/4; - olineptrs[2] += 2*X_width/4; - } - - } - else if (multiply == 4) - { - // Broken. Gotta fix this some day. - void Expand4(unsigned *, double *); - Expand4 ((unsigned *)(screens[0]), (double *) (image->data)); - } - - if (doShm) - { - - if (!XShmPutImage( X_display, - X_mainWindow, - X_gc, - image, - 0, 0, - 0, 0, - X_width, X_height, - True )) - I_Error("XShmPutImage() failed\n"); - - // wait for it to finish and processes all input events - shmFinished = false; - do - { - I_GetEvent(); - } while (!shmFinished); - - } - else - { - - // draw the image - XPutImage( X_display, - X_mainWindow, - X_gc, - image, - 0, 0, - 0, 0, - X_width, X_height ); - - // sync up with server - XSync(X_display, False); - - } - -} - - -// -// I_ReadScreen -// -void I_ReadScreen (byte* scr) -{ - memcpy (scr, screens[0], SCREENWIDTH*SCREENHEIGHT); -} - - -// -// Palette stuff. -// -static XColor colors[256]; - -void UploadNewPalette(Colormap cmap, byte *palette) -{ - - register int i; - register int c; - static boolean firstcall = true; - -#ifdef __cplusplus - if (X_visualinfo.c_class == PseudoColor && X_visualinfo.depth == 8) -#else - if (X_visualinfo.class == PseudoColor && X_visualinfo.depth == 8) -#endif - { - // initialize the colormap - if (firstcall) - { - firstcall = false; - for (i=0 ; i<256 ; i++) - { - colors[i].pixel = i; - colors[i].flags = DoRed|DoGreen|DoBlue; - } - } - - // set the X colormap entries - for (i=0 ; i<256 ; i++) - { - c = gammatable[usegamma][*palette++]; - colors[i].red = (c<<8) + c; - c = gammatable[usegamma][*palette++]; - colors[i].green = (c<<8) + c; - c = gammatable[usegamma][*palette++]; - colors[i].blue = (c<<8) + c; - } - - // store the colors to the current colormap - XStoreColors(X_display, cmap, colors, 256); - - } -} - -// -// I_SetPalette -// -void I_SetPalette (byte* palette) -{ - UploadNewPalette(X_cmap, palette); -} - - -// -// This function is probably redundant, -// if XShmDetach works properly. -// ddt never detached the XShm memory, -// thus there might have been stale -// handles accumulating. -// -void grabsharedmemory(int size) -{ - - int key = ('d'<<24) | ('o'<<16) | ('o'<<8) | 'm'; - struct shmid_ds shminfo; - int minsize = 320*200; - int id; - int rc; - // UNUSED int done=0; - int pollution=5; - - // try to use what was here before - do - { - id = shmget((key_t) key, minsize, 0777); // just get the id - if (id != -1) - { - rc=shmctl(id, IPC_STAT, &shminfo); // get stats on it - if (!rc) - { - if (shminfo.shm_nattch) - { - fprintf(stderr, "User %d appears to be running " - "DOOM. Is that wise?\n", shminfo.shm_cpid); - key++; - } - else - { - if (getuid() == shminfo.shm_perm.cuid) - { - rc = shmctl(id, IPC_RMID, 0); - if (!rc) - fprintf(stderr, - "Was able to kill my old shared memory\n"); - else - I_Error("Was NOT able to kill my old shared memory"); - - id = shmget((key_t)key, size, IPC_CREAT|0777); - if (id==-1) - I_Error("Could not get shared memory"); - - rc=shmctl(id, IPC_STAT, &shminfo); - - break; - - } - if (size >= shminfo.shm_segsz) - { - fprintf(stderr, - "will use %d's stale shared memory\n", - shminfo.shm_cpid); - break; - } - else - { - fprintf(stderr, - "warning: can't use stale " - "shared memory belonging to id %d, " - "key=0x%x\n", - shminfo.shm_cpid, key); - key++; - } - } - } - else - { - I_Error("could not get stats on key=%d", key); - } - } - else - { - id = shmget((key_t)key, size, IPC_CREAT|0777); - if (id==-1) - { - extern int errno; - fprintf(stderr, "errno=%d\n", errno); - I_Error("Could not get any shared memory"); - } - break; - } - } while (--pollution); - - if (!pollution) - { - I_Error("Sorry, system too polluted with stale " - "shared memory segments.\n"); - } - - X_shminfo.shmid = id; - - // attach to the shared memory segment - image->data = X_shminfo.shmaddr = shmat(id, 0, 0); - - fprintf(stderr, "shared memory id=%d, addr=0x%x\n", id, - (int) (image->data)); -} - -void I_InitGraphics(void) -{ - - char* displayname; - char* d; - int n; - int pnum; - int x=0; - int y=0; - - // warning: char format, different type arg - char xsign=' '; - char ysign=' '; - - int oktodraw; - unsigned long attribmask; - XSetWindowAttributes attribs; - XGCValues xgcvalues; - int valuemask; - static int firsttime=1; - - if (!firsttime) - return; - firsttime = 0; - - signal(SIGINT, (void (*)(int)) I_Quit); - - if (M_CheckParm("-2")) - multiply = 2; - - if (M_CheckParm("-3")) - multiply = 3; - - if (M_CheckParm("-4")) - multiply = 4; - - X_width = SCREENWIDTH * multiply; - X_height = SCREENHEIGHT * multiply; - - // check for command-line display name - if ( (pnum=M_CheckParm("-disp")) ) // suggest parentheses around assignment - displayname = myargv[pnum+1]; - else - displayname = 0; - - // check if the user wants to grab the mouse (quite unnice) - grabMouse = !!M_CheckParm("-grabmouse"); - - // check for command-line geometry - if ( (pnum=M_CheckParm("-geom")) ) // suggest parentheses around assignment - { - // warning: char format, different type arg 3,5 - n = sscanf(myargv[pnum+1], "%c%d%c%d", &xsign, &x, &ysign, &y); - - if (n==2) - x = y = 0; - else if (n==6) - { - if (xsign == '-') - x = -x; - if (ysign == '-') - y = -y; - } - else - I_Error("bad -geom parameter"); - } - - // open the display - X_display = XOpenDisplay(displayname); - if (!X_display) - { - if (displayname) - I_Error("Could not open display [%s]", displayname); - else - I_Error("Could not open display (DISPLAY=[%s])", getenv("DISPLAY")); - } - - // use the default visual - X_screen = DefaultScreen(X_display); - if (!XMatchVisualInfo(X_display, X_screen, 8, PseudoColor, &X_visualinfo)) - I_Error("xdoom currently only supports 256-color PseudoColor screens"); - X_visual = X_visualinfo.visual; - - // check for the MITSHM extension - doShm = XShmQueryExtension(X_display); - - // even if it's available, make sure it's a local connection - if (doShm) - { - if (!displayname) displayname = (char *) getenv("DISPLAY"); - if (displayname) - { - d = displayname; - while (*d && (*d != ':')) d++; - if (*d) *d = 0; - if (!(!strcasecmp(displayname, "unix") || !*displayname)) doShm = false; - } - } - - fprintf(stderr, "Using MITSHM extension\n"); - - // create the colormap - X_cmap = XCreateColormap(X_display, RootWindow(X_display, - X_screen), X_visual, AllocAll); - - // setup attributes for main window - attribmask = CWEventMask | CWColormap | CWBorderPixel; - attribs.event_mask = - KeyPressMask - | KeyReleaseMask - // | PointerMotionMask | ButtonPressMask | ButtonReleaseMask - | ExposureMask; - - attribs.colormap = X_cmap; - attribs.border_pixel = 0; - - // create the main window - X_mainWindow = XCreateWindow( X_display, - RootWindow(X_display, X_screen), - x, y, - X_width, X_height, - 0, // borderwidth - 8, // depth - InputOutput, - X_visual, - attribmask, - &attribs ); - - XDefineCursor(X_display, X_mainWindow, - createnullcursor( X_display, X_mainWindow ) ); - - // create the GC - valuemask = GCGraphicsExposures; - xgcvalues.graphics_exposures = False; - X_gc = XCreateGC( X_display, - X_mainWindow, - valuemask, - &xgcvalues ); - - // map the window - XMapWindow(X_display, X_mainWindow); - - // wait until it is OK to draw - oktodraw = 0; - while (!oktodraw) - { - XNextEvent(X_display, &X_event); - if (X_event.type == Expose - && !X_event.xexpose.count) - { - oktodraw = 1; - } - } - - // grabs the pointer so it is restricted to this window - if (grabMouse) - XGrabPointer(X_display, X_mainWindow, True, - ButtonPressMask|ButtonReleaseMask|PointerMotionMask, - GrabModeAsync, GrabModeAsync, - X_mainWindow, None, CurrentTime); - - if (doShm) - { - - X_shmeventtype = XShmGetEventBase(X_display) + ShmCompletion; - - // create the image - image = XShmCreateImage( X_display, - X_visual, - 8, - ZPixmap, - 0, - &X_shminfo, - X_width, - X_height ); - - grabsharedmemory(image->bytes_per_line * image->height); - - - // UNUSED - // create the shared memory segment - // X_shminfo.shmid = shmget (IPC_PRIVATE, - // image->bytes_per_line * image->height, IPC_CREAT | 0777); - // if (X_shminfo.shmid < 0) - // { - // perror(""); - // I_Error("shmget() failed in InitGraphics()"); - // } - // fprintf(stderr, "shared memory id=%d\n", X_shminfo.shmid); - // attach to the shared memory segment - // image->data = X_shminfo.shmaddr = shmat(X_shminfo.shmid, 0, 0); - - - if (!image->data) - { - perror(""); - I_Error("shmat() failed in InitGraphics()"); - } - - // get the X server to attach to it - if (!XShmAttach(X_display, &X_shminfo)) - I_Error("XShmAttach() failed in InitGraphics()"); - - } - else - { - image = XCreateImage( X_display, - X_visual, - 8, - ZPixmap, - 0, - (char*)malloc(X_width * X_height), - X_width, X_height, - 8, - X_width ); - - } - - if (multiply == 1) - screens[0] = (unsigned char *) (image->data); - else - screens[0] = (unsigned char *) malloc (SCREENWIDTH * SCREENHEIGHT); - -} - - -unsigned exptable[256]; - -void InitExpand (void) -{ - int i; - - for (i=0 ; i<256 ; i++) - exptable[i] = i | (i<<8) | (i<<16) | (i<<24); -} - -double exptable2[256*256]; - -void InitExpand2 (void) -{ - int i; - int j; - // UNUSED unsigned iexp, jexp; - double* exp; - union - { - double d; - unsigned u[2]; - } pixel; - - printf ("building exptable2...\n"); - exp = exptable2; - for (i=0 ; i<256 ; i++) - { - pixel.u[0] = i | (i<<8) | (i<<16) | (i<<24); - for (j=0 ; j<256 ; j++) - { - pixel.u[1] = j | (j<<8) | (j<<16) | (j<<24); - *exp++ = pixel.d; - } - } - printf ("done.\n"); -} - -int inited; - -void -Expand4 -( unsigned* lineptr, - double* xline ) -{ - double dpixel; - unsigned x; - unsigned y; - unsigned fourpixels; - unsigned step; - double* exp; - - exp = exptable2; - if (!inited) - { - inited = 1; - InitExpand2 (); - } - - - step = 3*SCREENWIDTH/2; - - y = SCREENHEIGHT-1; - do - { - x = SCREENWIDTH; - - do - { - fourpixels = lineptr[0]; - - dpixel = *(double *)( (int)exp + ( (fourpixels&0xffff0000)>>13) ); - xline[0] = dpixel; - xline[160] = dpixel; - xline[320] = dpixel; - xline[480] = dpixel; - - dpixel = *(double *)( (int)exp + ( (fourpixels&0xffff)<<3 ) ); - xline[1] = dpixel; - xline[161] = dpixel; - xline[321] = dpixel; - xline[481] = dpixel; - - fourpixels = lineptr[1]; - - dpixel = *(double *)( (int)exp + ( (fourpixels&0xffff0000)>>13) ); - xline[2] = dpixel; - xline[162] = dpixel; - xline[322] = dpixel; - xline[482] = dpixel; - - dpixel = *(double *)( (int)exp + ( (fourpixels&0xffff)<<3 ) ); - xline[3] = dpixel; - xline[163] = dpixel; - xline[323] = dpixel; - xline[483] = dpixel; - - fourpixels = lineptr[2]; - - dpixel = *(double *)( (int)exp + ( (fourpixels&0xffff0000)>>13) ); - xline[4] = dpixel; - xline[164] = dpixel; - xline[324] = dpixel; - xline[484] = dpixel; - - dpixel = *(double *)( (int)exp + ( (fourpixels&0xffff)<<3 ) ); - xline[5] = dpixel; - xline[165] = dpixel; - xline[325] = dpixel; - xline[485] = dpixel; - - fourpixels = lineptr[3]; - - dpixel = *(double *)( (int)exp + ( (fourpixels&0xffff0000)>>13) ); - xline[6] = dpixel; - xline[166] = dpixel; - xline[326] = dpixel; - xline[486] = dpixel; - - dpixel = *(double *)( (int)exp + ( (fourpixels&0xffff)<<3 ) ); - xline[7] = dpixel; - xline[167] = dpixel; - xline[327] = dpixel; - xline[487] = dpixel; - - lineptr+=4; - xline+=8; - } while (x-=16); - xline += step; - } while (y--); -} - - diff --git a/sersrc/DOOMNET.C b/sersrc/DOOMNET.C @@ -1,126 +0,0 @@ -#include <stdio.h> -#include <io.h> -#include <stdlib.h> -#include <string.h> -#include <process.h> -#include <dos.h> -#include "doomnet.h" - -//#include "serstr.h" -#include "ser_frch.h" // FRENCH VERSION - -#define DOOM2 - -extern int myargc; -extern char **myargv; - -doomcom_t doomcom; -int vectorishooked; -void interrupt (*olddoomvect) (void); - - - -/* -================= -= -= CheckParm -= -= Checks for the given parameter in the program's command line arguments -= -= Returns the argument number (1 to argc-1) or 0 if not present -= -================= -*/ - -int CheckParm (char *check) -{ - int i; - - for (i = 1;i<myargc;i++) - if ( !stricmp(check,myargv[i]) ) - return i; - - return 0; -} - - -/* -============= -= -= LaunchDOOM -= -These fields in doomcom should be filled in before calling: - - short numnodes; // console is allways node 0 - short ticdup; // 1 = no duplication, 2-5 = dup for slow nets - short extratics; // 1 = send a backup tic in every packet - - short consoleplayer; // 0-3 = player number - short numplayers; // 1-4 - short angleoffset; // 1 = left, 0 = center, -1 = right - short drone; // 1 = drone -============= -*/ - -void LaunchDOOM (void) -{ - char *newargs[99]; - char adrstring[10]; - long flatadr; - int p; - unsigned char far *vector; - -// prepare for DOOM - doomcom.id = DOOMCOM_ID; - -// hook an interrupt vector - p= CheckParm ("-vector"); - - if (p) - { - doomcom.intnum = sscanf ("0x%x",_argv[p+1]); - } - else - { - for (doomcom.intnum = 0x60 ; doomcom.intnum <= 0x66 ; doomcom.intnum++) - { - vector = *(char far * far *)(doomcom.intnum*4); - if ( !vector || *vector == 0xcf ) - break; - } - if (doomcom.intnum == 0x67) - { - printf (STR_WARNING); - doomcom.intnum = 0x66; - } - } - printf (STR_COMM"\n",doomcom.intnum); - - olddoomvect = getvect (doomcom.intnum); - setvect (doomcom.intnum,NetISR); - vectorishooked = 1; - -// build the argument list for DOOM, adding a -net &doomcom - memcpy (newargs, myargv, (myargc+1)*2); - newargs[myargc] = "-net"; - flatadr = (long)_DS*16 + (unsigned)&doomcom; - sprintf (adrstring,"%lu",flatadr); - newargs[myargc+1] = adrstring; - newargs[myargc+2] = NULL; - -// spawnv (P_WAIT, "m:\\newdoom\\doom", newargs); - if (!access("doom2.exe",0)) - spawnv (P_WAIT, "doom2", newargs); - else - spawnv (P_WAIT, "doom", newargs); - - #ifdef DOOM2 - printf (STR_RETURNED"\n"); - #else - printf ("Returned from DOOM\n"); - #endif - - -} - - diff --git a/sersrc/DOOMNET.H b/sersrc/DOOMNET.H @@ -1,60 +0,0 @@ -// doomnet.h - - -#define PEL_WRITE_ADR 0x3c8 -#define PEL_DATA 0x3c9 - -#define I_ColorBlack(r,g,b) {outp(PEL_WRITE_ADR,0);outp(PEL_DATA,r);outp(PEL_DATA,g);outp(PEL_DATA,b);}; - - - - -#define MAXNETNODES 8 // max computers in a game -#define MAXPLAYERS 4 // 4 players max + drones - - -#define CMD_SEND 1 -#define CMD_GET 2 - -#define DOOMCOM_ID 0x12345678l - -typedef struct -{ - long id; - short intnum; // DOOM executes an int to send commands - -// communication between DOOM and the driver - short command; // CMD_SEND or CMD_GET - short remotenode; // dest for send, set by get (-1 = no packet) - short datalength; // bytes in doomdata to be sent / bytes read - -// info common to all nodes - short numnodes; // console is allways node 0 - short ticdup; // 1 = no duplication, 2-5 = dup for slow nets - short extratics; // 1 = send a backup tic in every packet - short deathmatch; // 1 = deathmatch - short savegame; // -1 = new game, 0-5 = load savegame - short episode; // 1-3 - short map; // 1-9 - short skill; // 1-5 - -// info specific to this node - short consoleplayer; // 0-3 = player number - short numplayers; // 1-4 - short angleoffset; // 1 = left, 0 = center, -1 = right - short drone; // 1 = drone - -// packet data to be sent - char data[512]; -} doomcom_t; - - - -extern doomcom_t doomcom; -extern void interrupt (*olddoomvect) (void); -extern int vectorishooked; - -int CheckParm (char *check); -void LaunchDOOM (void); -void interrupt NetISR (void); - diff --git a/sersrc/PORT.C b/sersrc/PORT.C @@ -1,428 +0,0 @@ -// port.c - -#include "doomnet.h" -#include "sersetup.h" -//#include "serstr.h" -#include "ser_frch.h" // FRENCH VERSION - - -void jump_start( void ); - -void interrupt isr_8250 (void); -void interrupt isr_16550 (void); - -union REGS regs; -struct SREGS sregs; - -que_t inque, outque; - - -int uart; // io address -enum {UART_8250, UART_16550} uart_type; -int irq; - -int modem_status = -1; -int line_status = -1; - -void interrupt (*oldirqvect) (void); -int irqintnum; - -int comport; - -int baudbits; - - -/* -============== -= -= GetUart -= -============== -*/ - -void GetUart (void) -{ - char far *system_data; - static int ISA_uarts[] = {0x3f8,0x2f8,0x3e8,0x2e8}; - static int ISA_IRQs[] = {4,3,4,3}; - static int MCA_uarts[] = {0x03f8,0x02f8,0x3220,0x3228}; - static int MCA_IRQs[] = {4,3,3,3}; - int p; - - if (CheckParm ("-com2")) - comport = 2; - else if (CheckParm ("-com3")) - comport = 3; - else if (CheckParm ("-com4")) - comport = 4; - else - comport = 1; - - regs.h.ah = 0xc0; - int86x( 0x15, &regs, &regs, &sregs ); - if ( regs.x.cflag ) - { - irq = ISA_IRQs[ comport-1 ]; - uart = ISA_uarts[ comport-1 ]; - return; - } - system_data = ( char far *) ( ( (long) sregs.es << 16 ) + regs.x.bx ); - if ( system_data[ 5 ] & 0x02 ) - { - irq = MCA_IRQs[ comport-1 ]; - uart = MCA_uarts[ comport-1 ]; - } - else - { - irq = ISA_IRQs[ comport-1 ]; - uart = ISA_uarts[ comport-1 ]; - } - - p = CheckParm ("-port"); - if (p) - sscanf (_argv[p+1],"0x%x",&uart); - p = CheckParm ("-irq"); - if (p) - sscanf (_argv[p+1],"%i",&irq); - - - printf (STR_PORTLOOK" 0x%x, irq %i\n",uart,irq); -} - - - - -/* -=============== -= -= InitPort -= -=============== -*/ - -void InitPort (void) -{ - int mcr; - int temp; - int u; - -// -// find the irq and io address of the port -// - GetUart (); - -// -// disable all uart interrupts -// - OUTPUT( uart + INTERRUPT_ENABLE_REGISTER, 0 ); - -// -// init com port settings -// - - printf (STR_PORTSET"\n",115200l/baudbits); - -// set baud rate - OUTPUT(uart + LINE_CONTROL_REGISTER, 0x83); - OUTPUT(uart, baudbits); - OUTPUT(uart + 1, 0); - -// set line control register (N81) - OUTPUT(uart + LINE_CONTROL_REGISTER, 0x03); - -// set modem control register (OUT2+RTS+DTR) - OUTPUT( uart + MODEM_CONTROL_REGISTER,8+2+1); - -// -// check for a 16550 -// - if (CheckParm("-8250")) - // allow a forced 8250 - { - uart_type = UART_8250; - printf (STR_UART8250"\n\n"); - } - else - { - OUTPUT ( uart + FIFO_CONTROL_REGISTER, - FCR_FIFO_ENABLE + FCR_TRIGGER_04 ); - temp = INPUT( uart + INTERRUPT_ID_REGISTER ); - if ( ( temp & 0xf8 ) == 0xc0 ) - { - uart_type = UART_16550; - } - else - { - uart_type = UART_8250; - OUTPUT( uart + FIFO_CONTROL_REGISTER, 0 ); - } - } - -// -// clear out any pending uart events -// - printf (STR_CLEARPEND); - for (u=0 ; u<16 ; u++) // clear an entire 16550 silo - INPUT( uart + RECEIVE_BUFFER_REGISTER ); - - do - { - switch( u = INPUT( uart + INTERRUPT_ID_REGISTER ) & 7 ) - { - case IIR_MODEM_STATUS_INTERRUPT : - modem_status = INPUT( uart + MODEM_STATUS_REGISTER ); - break; - - case IIR_LINE_STATUS_INTERRUPT : - line_status = INPUT( uart + LINE_STATUS_REGISTER ); - break; - - case IIR_TX_HOLDING_REGISTER_INTERRUPT : - break; - - case IIR_RX_DATA_READY_INTERRUPT : - INPUT( uart + RECEIVE_BUFFER_REGISTER ); - break; - } - } while (! (u&1) ); - - -// -// hook the irq vector -// - irqintnum = irq + 8; - - oldirqvect = getvect (irqintnum); - if (uart_type == UART_16550) - { - setvect (irqintnum,isr_16550); - printf (STR_UART16550"\n\n"); - } - else - { - setvect (irqintnum,isr_8250); - printf (STR_UART8250"\n\n"); - - } - - - OUTPUT( 0x20 + 1, INPUT( 0x20 + 1 ) & ~(1<<irq) ); - - CLI(); - -// enable RX and TX interrupts at the uart - - OUTPUT( uart + INTERRUPT_ENABLE_REGISTER,IER_RX_DATA_READY + IER_TX_HOLDING_REGISTER_EMPTY); - -// enable interrupts through the interrupt controller - - OUTPUT( 0x20, 0xc2 ); - - STI(); -} - - -/* -============= -= -= ShutdownPort -= -============= -*/ - -void ShutdownPort ( void ) -{ - int u; - - OUTPUT( uart + INTERRUPT_ENABLE_REGISTER, 0 ); - OUTPUT( uart + MODEM_CONTROL_REGISTER, 0 ); - - for (u=0 ; u<16 ; u++) // clear an entire 16550 silo - INPUT( uart + RECEIVE_BUFFER_REGISTER ); - - OUTPUT( 0x20 + 1, INPUT( 0x20 + 1 ) | (1<<irq) ); - - setvect (irqintnum,oldirqvect); - -// -// init com port settings to defaults -// - regs.x.ax = 0xf3; //f3= 9600 n 8 1 - regs.x.dx = comport - 1; - int86 (0x14, &regs, &regs); -} - - -int read_byte( void ) -{ - int c; - - if (inque.tail >= inque.head) - return -1; - c = inque.data[inque.tail&(QUESIZE-1)]; - inque.tail++; - return c; -} - - -void write_byte( int c ) -{ - outque.data[outque.head&(QUESIZE-1)] = c; - outque.head++; -} - - - -//========================================================================== - - -/* -============== -= -= isr_8250 -= -============== -*/ - -void interrupt isr_8250(void) -{ - int c; - - while (1) - { - switch( INPUT( uart + INTERRUPT_ID_REGISTER ) & 7 ) - { -// not enabled - case IIR_MODEM_STATUS_INTERRUPT : - modem_status = INPUT( uart + MODEM_STATUS_REGISTER ); - break; - -// not enabled - case IIR_LINE_STATUS_INTERRUPT : - line_status = INPUT( uart + LINE_STATUS_REGISTER ); - break; - -// -// transmit -// - case IIR_TX_HOLDING_REGISTER_INTERRUPT : -//I_ColorBlack (63,0,0); - if (outque.tail < outque.head) - { - c = outque.data[outque.tail&(QUESIZE-1)]; - outque.tail++; - OUTPUT( uart + TRANSMIT_HOLDING_REGISTER, c ); - } - break; - -// -// receive -// - case IIR_RX_DATA_READY_INTERRUPT : -//I_ColorBlack (0,63,0); - c = INPUT( uart + RECEIVE_BUFFER_REGISTER ); - inque.data[inque.head&(QUESIZE-1)] = c; - inque.head++; - break; - -// -// done -// - default : -//I_ColorBlack (0,0,0); - OUTPUT( 0x20, 0x20 ); - return; - } - } -} - - -/* -============== -= -= isr_16550 -= -============== -*/ - -void interrupt isr_16550(void) -{ - int c; - int count; - - while (1) - { - switch( INPUT( uart + INTERRUPT_ID_REGISTER ) & 7 ) - { -// not enabled - case IIR_MODEM_STATUS_INTERRUPT : - modem_status = INPUT( uart + MODEM_STATUS_REGISTER ); - break; - -// not enabled - case IIR_LINE_STATUS_INTERRUPT : - line_status = INPUT( uart + LINE_STATUS_REGISTER ); - break; - -// -// transmit -// - case IIR_TX_HOLDING_REGISTER_INTERRUPT : -//I_ColorBlack (63,0,0); - count = 16; - while (outque.tail < outque.head && count--) - { - c = outque.data[outque.tail&(QUESIZE-1)]; - outque.tail++; - OUTPUT( uart + TRANSMIT_HOLDING_REGISTER, c ); - } - break; - -// -// receive -// - case IIR_RX_DATA_READY_INTERRUPT : -//I_ColorBlack (0,63,0); - do - { - c = INPUT( uart + RECEIVE_BUFFER_REGISTER ); - inque.data[inque.head&(QUESIZE-1)] = c; - inque.head++; - } while (INPUT( uart + LINE_STATUS_REGISTER ) & LSR_DATA_READY ); - - break; - -// -// done -// - default : -//I_ColorBlack (0,0,0); - OUTPUT( 0x20, 0x20 ); - return; - } - } -} - - -/* -=============== -= -= jump_start -= -= Start up the transmition interrupts by sending the first char -=============== -*/ - -void jump_start( void ) -{ - int c; - - if (outque.tail < outque.head) - { - c = outque.data [outque.tail&(QUESIZE-1)]; - outque.tail++; - OUTPUT( uart, c ); - } -} - - diff --git a/sersrc/README.TXT b/sersrc/README.TXT @@ -1 +0,0 @@ -This is the source for the DOOM serial / modem driver. diff --git a/sersrc/SERSETUP.C b/sersrc/SERSETUP.C @@ -1,680 +0,0 @@ -// sersetup.c -#define DOOM2 -#include "sersetup.h" -//#include "serstr.h" -#include "ser_frch.h" // FRENCH VERSION -#include "DoomNet.h" - -extern que_t inque, outque; - -void jump_start( void ); -extern int uart; - -int usemodem; -char startup[256], shutdown[256], baudrate[256]; - -extern int baudbits; - -void ModemCommand (char *str); - -int myargc; -char **myargv; - -//====================================== -// -// I_Error -// -//====================================== -void I_Error(char *string) -{ - printf("%s\n",string); - exit(1); -} - -/* -================ -= -= write_buffer -= -================ -*/ - -void write_buffer( char *buffer, unsigned int count ) -{ - int i; - -// if this would overrun the buffer, throw everything else out - if (outque.head-outque.tail+count > QUESIZE) - outque.tail = outque.head; - - while (count--) - write_byte (*buffer++); - - if ( INPUT( uart + LINE_STATUS_REGISTER ) & 0x40) - jump_start(); -} - - -/* -================= -= -= Error -= -= For abnormal program terminations -= -================= -*/ - -void Error (char *error, ...) -{ - va_list argptr; - - if (usemodem) - { - printf ("\n"); - printf ("\n"STR_DROPDTR"\n"); - - OUTPUT(uart+MODEM_CONTROL_REGISTER, INPUT(uart+MODEM_CONTROL_REGISTER)&~MCR_DTR); - delay (1250); - OUTPUT( uart + MODEM_CONTROL_REGISTER, INPUT( uart + MODEM_CONTROL_REGISTER ) | MCR_DTR ); - ModemCommand("+++"); - delay (1250); - ModemCommand(shutdown); - delay (1250); - - } - - ShutdownPort (); - - if (vectorishooked) - setvect (doomcom.intnum,olddoomvect); - - if (error) - { - va_start (argptr,error); - vprintf (error,argptr); - va_end (argptr); - printf ("\n"); - exit (1); - } - - printf (STR_CLEANEXIT"\n"); - exit (0); -} - - -/* -================ -= -= ReadPacket -= -================ -*/ - -#define MAXPACKET 512 -#define FRAMECHAR 0x70 - -char packet[MAXPACKET]; -int packetlen; -int inescape; -int newpacket; - -boolean ReadPacket (void) -{ - int c; - -// if the buffer has overflowed, throw everything out - - if (inque.head-inque.tail > QUESIZE - 4) // check for buffer overflow - { - inque.tail = inque.head; - newpacket = true; - return false; - } - - if (newpacket) - { - packetlen = 0; - newpacket = 0; - } - - do - { - c = read_byte (); - if (c < 0) - return false; // haven't read a complete packet -//printf ("%c",c); - if (inescape) - { - inescape = false; - if (c!=FRAMECHAR) - { - newpacket = 1; - return true; // got a good packet - } - } - else if (c==FRAMECHAR) - { - inescape = true; - continue; // don't know yet if it is a terminator - } // or a literal FRAMECHAR - - if (packetlen >= MAXPACKET) - continue; // oversize packet - packet[packetlen] = c; - packetlen++; - } while (1); - -} - - -/* -============= -= -= WritePacket -= -============= -*/ - - - -void WritePacket (char *buffer, int len) -{ - int b; - char static localbuffer[MAXPACKET*2+2]; - - b = 0; - if (len > MAXPACKET) - return; - - while (len--) - { - if (*buffer == FRAMECHAR) - localbuffer[b++] = FRAMECHAR; // escape it for literal - localbuffer[b++] = *buffer++; - } - - localbuffer[b++] = FRAMECHAR; - localbuffer[b++] = 0; - - write_buffer (localbuffer, b); -} - - -/* -============= -= -= NetISR -= -============= -*/ - -void interrupt NetISR (void) -{ - if (doomcom.command == CMD_SEND) - { -//I_ColorBlack (0,0,63); - WritePacket ((char *)&doomcom.data, doomcom.datalength); - } - else if (doomcom.command == CMD_GET) - { -//I_ColorBlack (63,63,0); - - if (ReadPacket () && packetlen <= sizeof(doomcom.data) ) - { - doomcom.remotenode = 1; - doomcom.datalength = packetlen; - memcpy (&doomcom.data, &packet, packetlen); - } - else - doomcom.remotenode = -1; - - } -//I_ColorBlack (0,0,0); -} - - - - -/* -================= -= -= Connect -= -= Figures out who is player 0 and 1 -================= -*/ - -void Connect (void) -{ - struct time time; - int oldsec; - int localstage, remotestage; - char str[20]; - char idstr[7]; - char remoteidstr[7]; - unsigned long idnum; - int i; - -// -// wait for a good packet -// - printf (STR_ATTEMPT"\n"); - -// -// build a (hopefully) unique id string by hashing up the current milliseconds -// and the interrupt table -// - if (CheckParm ("-player1")) - idnum = 0; - else if (CheckParm ("-player2")) - idnum = 999999; - else - { - gettime (&time); - idnum = time.ti_sec*100+time.ti_hund; - for (i=0 ; i<512 ; i++) - idnum += ((unsigned far *)0)[i]; - idnum %= 1000000; - } - - idstr[0] = '0' + idnum/ 100000l; - idnum -= (idstr[0]-'0')*100000l; - idstr[1] = '0' + idnum/ 10000l; - idnum -= (idstr[1]-'0')*10000l; - idstr[2] = '0' + idnum/ 1000l; - idnum -= (idstr[2]-'0')*1000l; - idstr[3] = '0' + idnum/ 100l; - idnum -= (idstr[3]-'0')*100l; - idstr[4] = '0' + idnum/ 10l; - idnum -= (idstr[4]-'0')*10l; - idstr[5] = '0' + idnum; - idstr[6] = 0; - -// -// sit in a loop until things are worked out -// -// the packet is: ID000000_0 -// the first field is the idnum, the second is the acknowledge stage -// ack stage starts out 0, is bumped to 1 after the other computer's id -// is known, and is bumped to 2 after the other computer has raised to 1 -// - oldsec = -1; - localstage = remotestage = 0; - - do - { - while ( bioskey(1) ) - { - if ( (bioskey (0) & 0xff) == 27) - Error ("\n\n"STR_NETABORT); - } - - if (ReadPacket ()) - { - packet[packetlen] = 0; - printf ("read : %s\n",packet); - if (packetlen != 10) - continue; - if (strncmp(packet,"ID",2) ) - continue; - if (!strncmp (packet+2,idstr,6)) - Error ("\n\n"STR_DUPLICATE); - strncpy (remoteidstr,packet+2,6); - - remotestage = packet[9] - '0'; - localstage = remotestage+1; - oldsec = -1; - } - - gettime (&time); - if (time.ti_sec != oldsec) - { - oldsec = time.ti_sec; - sprintf (str,"ID%s_%i",idstr,localstage); - WritePacket (str,strlen(str)); - printf ("wrote: %s\n",str); - } - - } while (localstage < 2); - -// -// decide who is who -// - if (strcmp(remoteidstr,idstr) > 0) - doomcom.consoleplayer = 0; - else - doomcom.consoleplayer = 1; - - -// -// flush out any extras -// - while (ReadPacket ()) - ; -} - - - -/* -============== -= -= ModemCommand -= -============== -*/ - -void ModemCommand (char *str) -{ - int i,l; - - printf (STR_MODEMCMD,str); - l = strlen(str); - for (i=0 ; i<l ; i++) - { - write_buffer (str+i,1); - printf ("%c",str[i]); - delay (100); - } - - write_buffer ("\r",1); - printf ("\n"); -} - - -/* -============== -= -= ModemResponse -= -= Waits for OK, RING, CONNECT, etc -============== -*/ - -char response[80]; - -void ModemResponse (char *resp) -{ - int c; - int respptr; - - do - { - printf (STR_MODEMRESP); - respptr=0; - do - { - while ( bioskey(1) ) - { - if ( (bioskey (0) & 0xff) == 27) - Error ("\n"STR_RESPABORT); - } - c = read_byte (); - if (c==-1) - continue; - if (c=='\n' || respptr == 79) - { - response[respptr] = 0; - printf ("%s\n",response); - break; - } - if (c>=' ') - { - response[respptr] = c; - respptr++; - } - } while (1); - - } while (strncmp(response,resp,strlen(resp))); -} - - -/* -============= -= -= ReadLine -= -============= -*/ - -void ReadLine (FILE *f, char *dest) -{ - int c; - - do - { - c = fgetc (f); - if (c == EOF || c == '\r' || c == '\n') - break; - *dest++ = c; - } while (1); - *dest = 0; -} - - -/* -============= -= -= ReadModemCfg -= -============= -*/ - -void ReadModemCfg (void) -{ - int mcr; - FILE *f; - unsigned baud; - - f = fopen ("modem.cfg","r"); - if (!f) - Error (STR_CANTREAD); - ReadLine (f, startup); - ReadLine (f, shutdown); - ReadLine (f, baudrate); - fclose (f); - - baud = atol(baudrate); - if (baud) - baudbits = 115200l/baud; - - usemodem = true; -} - - -/* -============= -= -= Dial -= -============= -*/ - -void Dial (void) -{ - char cmd[80]; - int p; - - ModemCommand(startup); - ModemResponse ("OK"); - - printf ("\n"STR_DIALING"\n\n"); - p = CheckParm ("-dial"); - sprintf (cmd,"ATDT%s",myargv[p+1]); - - ModemCommand(cmd); - ModemResponse (STR_CONNECT); - doomcom.consoleplayer = 1; -} - - -/* -============= -= -= Answer -= -============= -*/ - -void Answer (void) -{ - ModemCommand(startup); - ModemResponse ("OK"); - printf ("\n"STR_WAITRING"\n\n"); - - ModemResponse (STR_RING); - ModemCommand ("ATA"); - ModemResponse (STR_CONNECT); - - doomcom.consoleplayer = 0; -} - -//======================================================== -// -// Find a Response File -// -//======================================================== -void FindResponseFile (void) -{ - int i; - #define MAXARGVS 100 - - for (i = 1;i < myargc;i++) - if (myargv[i][0] == '@') - { - FILE * handle; - int size; - int k; - int index; - int indexinfile; - char *infile; - char *file; - char *moreargs[20]; - char *firstargv; - - // READ THE RESPONSE FILE INTO MEMORY - handle = fopen (&myargv[i][1],"rb"); - if (!handle) - I_Error (STR_NORESP); - printf("Found response file \"%s\"!\n",strupr(&myargv[i][1])); - fseek (handle,0,SEEK_END); - size = ftell(handle); - fseek (handle,0,SEEK_SET); - file = malloc (size); - fread (file,size,1,handle); - fclose (handle); - - // KEEP ALL CMDLINE ARGS FOLLOWING @RESPONSEFILE ARG - for (index = 0,k = i+1; k < myargc; k++) - moreargs[index++] = myargv[k]; - - firstargv = myargv[0]; - myargv = malloc(sizeof(char *)*MAXARGVS); - memset(myargv,0,sizeof(char *)*MAXARGVS); - myargv[0] = firstargv; - - infile = file; - indexinfile = k = 0; - indexinfile++; // SKIP PAST ARGV[0] (KEEP IT) - do - { - myargv[indexinfile++] = infile+k; - while(k < size && - ((*(infile+k)>= ' '+1) && (*(infile+k)<='z'))) - k++; - *(infile+k) = 0; - while(k < size && - ((*(infile+k)<= ' ') || (*(infile+k)>'z'))) - k++; - } while(k < size); - - for (k = 0;k < index;k++) - myargv[indexinfile++] = moreargs[k]; - myargc = indexinfile; - - // DISPLAY ARGS -// printf("%d command-line args:\n",myargc); -// for (k=1;k<myargc;k++) -// printf("%s\n",myargv[k]); - - break; - } -} - - - -/* -================= -= -= main -= -================= -*/ - -void main(void) -{ - int p; - -// -// set network characteristics -// - doomcom.ticdup = 1; - doomcom.extratics = 0; - doomcom.numnodes = 2; - doomcom.numplayers = 2; - doomcom.drone = 0; - - printf("\n" - "---------------------------------\n" - #ifdef DOOM2 - STR_DOOMSERIAL"\n" - #else - "DOOM SERIAL DEVICE DRIVER v1.4\n" - #endif - "---------------------------------\n"); - myargc = _argc; - myargv = _argv; - FindResponseFile(); - -// -// allow override of automatic player ordering to allow a slower computer -// to be set as player 1 allways -// - -// -// establish communications -// - - baudbits = 0x08; // default to 9600 if not specified on cmd line - // or in modem.cfg - - if (CheckParm ("-dial") || CheckParm ("-answer") ) - ReadModemCfg (); // may set baudbits - -// -// allow command-line override of modem.cfg baud rate -// - if (CheckParm ("-9600")) baudbits = 0x0c; - else if (CheckParm ("-14400")) baudbits = 0x08; - else if (CheckParm ("-19200")) baudbits = 0x06; - else if (CheckParm ("-38400")) baudbits = 0x03; - else if (CheckParm ("-57600")) baudbits = 0x02; - else if (CheckParm ("-115200")) baudbits = 0x01; - - InitPort (); - - if (CheckParm ("-dial")) - Dial (); - else if (CheckParm ("-answer")) - Answer (); - - Connect (); - -// -// launch DOOM -// - LaunchDOOM (); - - Error (NULL); -} - diff --git a/sersrc/SERSETUP.H b/sersrc/SERSETUP.H @@ -1,102 +0,0 @@ -#include <conio.h> -#include <stdio.h> -#include <stdlib.h> -#include <string.h> -#include <conio.h> -#include <ctype.h> -#include <dos.h> -#include <process.h> -#include <stdarg.h> -#include <bios.h> -#include <ctype.h> - - -#define INPUT(port) inportb(port) -#define OUTPUT(port,data) outportb(port,data) -#define CLI() disable() -#define STI() enable() - - -typedef enum {false, true} boolean; -typedef unsigned char byte; - - -#define TRANSMIT_HOLDING_REGISTER 0x00 -#define RECEIVE_BUFFER_REGISTER 0x00 -#define INTERRUPT_ENABLE_REGISTER 0x01 -#define IER_RX_DATA_READY 0x01 -#define IER_TX_HOLDING_REGISTER_EMPTY 0x02 -#define IER_LINE_STATUS 0x04 -#define IER_MODEM_STATUS 0x08 -#define INTERRUPT_ID_REGISTER 0x02 -#define IIR_MODEM_STATUS_INTERRUPT 0x00 -#define IIR_TX_HOLDING_REGISTER_INTERRUPT 0x02 -#define IIR_RX_DATA_READY_INTERRUPT 0x04 -#define IIR_LINE_STATUS_INTERRUPT 0x06 -#define FIFO_CONTROL_REGISTER 0x02 -#define FCR_FIFO_ENABLE 0x01 -#define FCR_RCVR_FIFO_RESET 0x02 -#define FCR_XMIT_FIFO_RESET 0x04 -#define FCR_RCVR_TRIGGER_LSB 0x40 -#define FCR_RCVR_TRIGGER_MSB 0x80 -#define FCR_TRIGGER_01 0x00 -#define FCR_TRIGGER_04 0x40 -#define FCR_TRIGGER_08 0x80 -#define FCR_TRIGGER_14 0xc0 -#define LINE_CONTROL_REGISTER 0x03 -#define LCR_WORD_LENGTH_MASK 0x03 -#define LCR_WORD_LENGTH_SELECT_0 0x01 -#define LCR_WORD_LENGTH_SELECT_1 0x02 -#define LCR_STOP_BITS 0x04 -#define LCR_PARITY_MASK 0x38 -#define LCR_PARITY_ENABLE 0x08 -#define LCR_EVEN_PARITY_SELECT 0x10 -#define LCR_STICK_PARITY 0x20 -#define LCR_SET_BREAK 0x40 -#define LCR_DLAB 0x80 -#define MODEM_CONTROL_REGISTER 0x04 -#define MCR_DTR 0x01 -#define MCR_RTS 0x02 -#define MCR_OUT1 0x04 -#define MCR_OUT2 0x08 -#define MCR_LOOPBACK 0x10 -#define LINE_STATUS_REGISTER 0x05 -#define LSR_DATA_READY 0x01 -#define LSR_OVERRUN_ERROR 0x02 -#define LSR_PARITY_ERROR 0x04 -#define LSR_FRAMING_ERROR 0x08 -#define LSR_BREAK_DETECT 0x10 -#define LSR_THRE 0x20 -#define MODEM_STATUS_REGISTER 0x06 -#define MSR_DELTA_CTS 0x01 -#define MSR_DELTA_DSR 0x02 -#define MSR_TERI 0x04 -#define MSR_DELTA_CD 0x08 -#define MSR_CTS 0x10 -#define MSR_DSR 0x20 -#define MSR_RI 0x40 -#define MSR_CD 0x80 -#define DIVISOR_LATCH_LOW 0x00 -#define DIVISOR_LATCH_HIGH 0x01 - - - -#define QUESIZE 2048 - -typedef struct -{ - long head, tail; // bytes are put on head and pulled from tail - unsigned char data[QUESIZE]; -} que_t; - -void InitPort (void); -void ShutdownPort (void); - -int read_byte( void ); -void write_byte( int c ); - - -void Error (char *error, ...); - -extern int argc; -extern char **argv; diff --git a/sersrc/SERSTR.H b/sersrc/SERSTR.H @@ -1,21 +0,0 @@ -#define STR_DROPDTR "Dropping DTR" -#define STR_CLEANEXIT "Clean exit from SERSETUP" -#define STR_ATTEMPT "Attempting to connect across serial link, press escape to abort." -#define STR_NETABORT "Network game synchronization aborted." -#define STR_DUPLICATE "Duplicate id string, try again or check modem init string." -#define STR_MODEMCMD "Modem command : " -#define STR_MODEMRESP "Modem response: " -#define STR_RESPABORT "Modem response aborted." -#define STR_CANTREAD "Couldn't read MODEM.CFG" -#define STR_DIALING "Dialing..." -#define STR_CONNECT "CONNECT" -#define STR_WAITRING "Waiting for ring..." -#define STR_RING "RING" -#define STR_NORESP "No such response file!" -#define STR_DOOMSERIAL "DOOM II SERIAL DEVICE DRIVER v1.4" -#define STR_WARNING \ -"Warning: no NULL or iret interrupt vectors were found in the 0x60 to 0x66\n"\ -"range. You can specify a vector with the -vector 0x<num> parameter.\n" -#define STR_COMM "Communicating with interrupt vector 0x%x" -#define STR_RETURNED "Returned from DOOM II" -#define STR_PORTSET "Setting port to %lu baud" diff --git a/sersrc/SER_FRCH.H b/sersrc/SER_FRCH.H @@ -1,25 +0,0 @@ -#define STR_DROPDTR "Abandon de DTR" -#define STR_CLEANEXIT "Sortie normale de SERSETUP" -#define STR_ATTEMPT "Tentative de connexion en s‚rie, appuyez sur ESC pour annuler." -#define STR_NETABORT "Synchronisation de jeu sur r‚seau annul‚e." -#define STR_DUPLICATE "ChaŒne id en double. R‚essayez ou v‚rifiez la chaŒne d'initialistion du modem." -#define STR_MODEMCMD "Commande du modem: " -#define STR_MODEMRESP "R‚ponse du modem: " -#define STR_RESPABORT "R‚ponse du modem annul‚e." -#define STR_CANTREAD "Lecture de MODEM.CFG impossible" -#define STR_DIALING "Composition du num‚ro..." -#define STR_CONNECT "CONNECTION" -#define STR_WAITRING "Attente d'appel..." -#define STR_RING "APPEL" -#define STR_NORESP "Ce fichier de r‚ponse n'existe pas!" -#define STR_DOOMSERIAL "GESTIONNAIRE DE LIAISON SERIE DOOM II v1.4" -#define STR_WARNING \ -"Attention: pas de vecteurs d'interruption NULL ou iret trouv‚s entre 0x60 et 0x66.\n"\ -"Vous pouvez sp‚cifier un vecteur avec le paramŠtre -vector 0x<num‚ro>." -#define STR_COMM "Communication avec le vecteur d'interruption 0x%x" -#define STR_RETURNED "Retour de DOOM II" -#define STR_PORTLOOK "Recherche de l'UART sur le port" -#define STR_UART8250 "UART = 8250" -#define STR_UART16550 "UART = 16550" -#define STR_CLEARPEND "Riinitilisation des interruptions en attente.\n" -#define STR_PORTSET "Réglage du port à %lu baud" diff --git a/sndserv/soundsrv.c b/sndserv/soundsrv.c @@ -301,9 +301,7 @@ int mix(void) void -grabdata -( int c, - char** v ) +grabdata(int argc, char** argv) { int i; char* name; @@ -343,9 +341,9 @@ grabdata // sprintf(basedefault, "%s/.doomrc", home); - for (i=1 ; i<c ; i++) + for (i=1 ; i<argc ; i++) { - if (!strcmp(v[i], "-quiet")) + if (!strcmp(argv[i], "-quiet")) { snd_verbose = 0; } @@ -585,11 +583,8 @@ fd_set scratchset; int -main -( int c, - char** v ) +main(int argc, char** argv) { - int done = 0; int rc; int nrc; @@ -598,7 +593,6 @@ main unsigned char commandbuf[10]; struct timeval zerowait = { 0, 0 }; - int step; int vol; @@ -608,7 +602,7 @@ main int waitingtofinish=0; // get sound data - grabdata(c, v); + grabdata(argc, argv); // init any data initdata(); @@ -648,7 +642,7 @@ main else { if (snd_verbose) - fprintf(stderr, "cmd: %c", commandbuf[0]); + fprintf(stderr, "cmd: %argc", commandbuf[0]); switch (commandbuf[0]) { diff --git a/src/Makefile b/src/Makefile @@ -0,0 +1,95 @@ +################################################################ +# +# $Id:$ +# +# $Log:$ +# +CC= gcc # gcc or g++ + +CFLAGS=-g -m32 -Wall -DNORMALUNIX -DLINUX # -DUSEASM +LDFLAGS=-L/usr/X11R6/lib -L/usr/lib/i386-linux-gnu +LIBS=-lXext -lX11 -lnsl -lm + +# subdirectory for objects +O=linux + +# not too sophisticated dependency +OBJS= \ + $(O)/doomdef.o \ + $(O)/doomstat.o \ + $(O)/dstrings.o \ + $(O)/i_system.o \ + $(O)/i_sound.o \ + $(O)/i_video.o \ + $(O)/i_net.o \ + $(O)/tables.o \ + $(O)/f_finale.o \ + $(O)/f_wipe.o \ + $(O)/d_main.o \ + $(O)/d_net.o \ + $(O)/d_items.o \ + $(O)/g_game.o \ + $(O)/m_menu.o \ + $(O)/m_misc.o \ + $(O)/m_argv.o \ + $(O)/m_bbox.o \ + $(O)/m_fixed.o \ + $(O)/m_swap.o \ + $(O)/m_cheat.o \ + $(O)/m_random.o \ + $(O)/am_map.o \ + $(O)/p_ceilng.o \ + $(O)/p_doors.o \ + $(O)/p_enemy.o \ + $(O)/p_floor.o \ + $(O)/p_inter.o \ + $(O)/p_lights.o \ + $(O)/p_map.o \ + $(O)/p_maputl.o \ + $(O)/p_plats.o \ + $(O)/p_pspr.o \ + $(O)/p_setup.o \ + $(O)/p_sight.o \ + $(O)/p_spec.o \ + $(O)/p_switch.o \ + $(O)/p_mobj.o \ + $(O)/p_telept.o \ + $(O)/p_tick.o \ + $(O)/p_saveg.o \ + $(O)/p_user.o \ + $(O)/r_bsp.o \ + $(O)/r_data.o \ + $(O)/r_draw.o \ + $(O)/r_main.o \ + $(O)/r_plane.o \ + $(O)/r_segs.o \ + $(O)/r_sky.o \ + $(O)/r_things.o \ + $(O)/w_wad.o \ + $(O)/wi_stuff.o \ + $(O)/v_video.o \ + $(O)/st_lib.o \ + $(O)/st_stuff.o \ + $(O)/hu_stuff.o \ + $(O)/hu_lib.o \ + $(O)/s_sound.o \ + $(O)/z_zone.o \ + $(O)/info.o \ + $(O)/sounds.o + +all: $(O)/linuxxdoom + +clean: + rm -f *.o *~ *.flc + rm -f linux/* + +$(O)/linuxxdoom: $(OBJS) $(O)/i_main.o + $(CC) $(CFLAGS) $(LDFLAGS) $(OBJS) $(O)/i_main.o \ + -o $(O)/linuxxdoom $(LIBS) + +$(O)/%.o: %.c + $(CC) $(CFLAGS) -c $< -o $@ + +############################################################# +# +############################################################# diff --git a/linuxdoom-1.10/am_map.c b/src/am_map.c diff --git a/linuxdoom-1.10/am_map.h b/src/am_map.h diff --git a/src/d_englsh.h b/src/d_englsh.h @@ -0,0 +1,701 @@ +// Emacs style mode select -*- C++ -*- +//----------------------------------------------------------------------------- +// +// $Id:$ +// +// Copyright (C) 1993-1996 by id Software, Inc. +// +// This source is available for distribution and/or modification +// only under the terms of the DOOM Source Code License as +// published by id Software. All rights reserved. +// +// The source is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// FITNESS FOR A PARTICULAR PURPOSE. See the DOOM Source Code License +// for more details. +// +// DESCRIPTION: +// Printed strings for translation. +// English language support (default). +// +//----------------------------------------------------------------------------- + +#ifndef __D_ENGLSH__ +#define __D_ENGLSH__ + +// +// Printed strings for translation +// + +// +// D_Main.C +// +#define D_DEVSTR "Development mode ON.\n" +#define D_CDROM "CD-ROM Version: default.cfg from c:\\doomdata\n" + +// +// M_Menu.C +// +#define PRESSKEY "press a key." +#define PRESSYN "press y or n." +#define QUITMSG "are you sure you want to\nquit this great game?" +#define LOADNET "you can't do load while in a net game!\n\n"PRESSKEY +#define QLOADNET "you can't quickload during a netgame!\n\n"PRESSKEY +#define QSAVESPOT "you haven't picked a quicksave slot yet!\n\n"PRESSKEY +#define SAVEDEAD "you can't save if you aren't playing!\n\n"PRESSKEY +#define QSPROMPT "quicksave over your game named\n\n'%s'?\n\n"PRESSYN +#define QLPROMPT "do you want to quickload the game named\n\n'%s'?\n\n"PRESSYN + +#define NEWGAME \ +"you can't start a new game\n"\ +"while in a network game.\n\n"PRESSKEY + +#define NIGHTMARE \ +"are you sure? this skill level\n"\ +"isn't even remotely fair.\n\n"PRESSYN + +#define SWSTRING \ +"this is the shareware version of doom.\n\n"\ +"you need to order the entire trilogy.\n\n"PRESSKEY + +#define MSGOFF "Messages OFF" +#define MSGON "Messages ON" +#define NETEND "you can't end a netgame!\n\n"PRESSKEY +#define ENDGAME "are you sure you want to end the game?\n\n"PRESSYN + +#define DOSY "(press y to quit)" + +#define DETAILHI "High detail" +#define DETAILLO "Low detail" +#define GAMMALVL0 "Gamma correction OFF" +#define GAMMALVL1 "Gamma correction level 1" +#define GAMMALVL2 "Gamma correction level 2" +#define GAMMALVL3 "Gamma correction level 3" +#define GAMMALVL4 "Gamma correction level 4" +#define EMPTYSTRING "empty slot" + +// +// P_inter.C +// +#define GOTARMOR "Picked up the armor." +#define GOTMEGA "Picked up the MegaArmor!" +#define GOTHTHBONUS "Picked up a health bonus." +#define GOTARMBONUS "Picked up an armor bonus." +#define GOTSTIM "Picked up a stimpack." +#define GOTMEDINEED "Picked up a medikit that you REALLY need!" +#define GOTMEDIKIT "Picked up a medikit." +#define GOTSUPER "Supercharge!" + +#define GOTBLUECARD "Picked up a blue keycard." +#define GOTYELWCARD "Picked up a yellow keycard." +#define GOTREDCARD "Picked up a red keycard." +#define GOTBLUESKUL "Picked up a blue skull key." +#define GOTYELWSKUL "Picked up a yellow skull key." +#define GOTREDSKULL "Picked up a red skull key." + +#define GOTINVUL "Invulnerability!" +#define GOTBERSERK "Berserk!" +#define GOTINVIS "Partial Invisibility" +#define GOTSUIT "Radiation Shielding Suit" +#define GOTMAP "Computer Area Map" +#define GOTVISOR "Light Amplification Visor" +#define GOTMSPHERE "MegaSphere!" + +#define GOTCLIP "Picked up a clip." +#define GOTCLIPBOX "Picked up a box of bullets." +#define GOTROCKET "Picked up a rocket." +#define GOTROCKBOX "Picked up a box of rockets." +#define GOTCELL "Picked up an energy cell." +#define GOTCELLBOX "Picked up an energy cell pack." +#define GOTSHELLS "Picked up 4 shotgun shells." +#define GOTSHELLBOX "Picked up a box of shotgun shells." +#define GOTBACKPACK "Picked up a backpack full of ammo!" + +#define GOTBFG9000 "You got the BFG9000! Oh, yes." +#define GOTCHAINGUN "You got the chaingun!" +#define GOTCHAINSAW "A chainsaw! Find some meat!" +#define GOTLAUNCHER "You got the rocket launcher!" +#define GOTPLASMA "You got the plasma gun!" +#define GOTSHOTGUN "You got the shotgun!" +#define GOTSHOTGUN2 "You got the super shotgun!" + +// +// P_Doors.C +// +#define PD_BLUEO "You need a blue key to activate this object" +#define PD_REDO "You need a red key to activate this object" +#define PD_YELLOWO "You need a yellow key to activate this object" +#define PD_BLUEK "You need a blue key to open this door" +#define PD_REDK "You need a red key to open this door" +#define PD_YELLOWK "You need a yellow key to open this door" + +// +// G_game.C +// +#define GGSAVED "game saved." + +// +// HU_stuff.C +// +#define HUSTR_MSGU "[Message unsent]" + +#define HUSTR_E1M1 "E1M1: Hangar" +#define HUSTR_E1M2 "E1M2: Nuclear Plant" +#define HUSTR_E1M3 "E1M3: Toxin Refinery" +#define HUSTR_E1M4 "E1M4: Command Control" +#define HUSTR_E1M5 "E1M5: Phobos Lab" +#define HUSTR_E1M6 "E1M6: Central Processing" +#define HUSTR_E1M7 "E1M7: Computer Station" +#define HUSTR_E1M8 "E1M8: Phobos Anomaly" +#define HUSTR_E1M9 "E1M9: Military Base" + +#define HUSTR_E2M1 "E2M1: Deimos Anomaly" +#define HUSTR_E2M2 "E2M2: Containment Area" +#define HUSTR_E2M3 "E2M3: Refinery" +#define HUSTR_E2M4 "E2M4: Deimos Lab" +#define HUSTR_E2M5 "E2M5: Command Center" +#define HUSTR_E2M6 "E2M6: Halls of the Damned" +#define HUSTR_E2M7 "E2M7: Spawning Vats" +#define HUSTR_E2M8 "E2M8: Tower of Babel" +#define HUSTR_E2M9 "E2M9: Fortress of Mystery" + +#define HUSTR_E3M1 "E3M1: Hell Keep" +#define HUSTR_E3M2 "E3M2: Slough of Despair" +#define HUSTR_E3M3 "E3M3: Pandemonium" +#define HUSTR_E3M4 "E3M4: House of Pain" +#define HUSTR_E3M5 "E3M5: Unholy Cathedral" +#define HUSTR_E3M6 "E3M6: Mt. Erebus" +#define HUSTR_E3M7 "E3M7: Limbo" +#define HUSTR_E3M8 "E3M8: Dis" +#define HUSTR_E3M9 "E3M9: Warrens" + +#define HUSTR_E4M1 "E4M1: Hell Beneath" +#define HUSTR_E4M2 "E4M2: Perfect Hatred" +#define HUSTR_E4M3 "E4M3: Sever The Wicked" +#define HUSTR_E4M4 "E4M4: Unruly Evil" +#define HUSTR_E4M5 "E4M5: They Will Repent" +#define HUSTR_E4M6 "E4M6: Against Thee Wickedly" +#define HUSTR_E4M7 "E4M7: And Hell Followed" +#define HUSTR_E4M8 "E4M8: Unto The Cruel" +#define HUSTR_E4M9 "E4M9: Fear" + +#define HUSTR_1 "level 1: entryway" +#define HUSTR_2 "level 2: underhalls" +#define HUSTR_3 "level 3: the gantlet" +#define HUSTR_4 "level 4: the focus" +#define HUSTR_5 "level 5: the waste tunnels" +#define HUSTR_6 "level 6: the crusher" +#define HUSTR_7 "level 7: dead simple" +#define HUSTR_8 "level 8: tricks and traps" +#define HUSTR_9 "level 9: the pit" +#define HUSTR_10 "level 10: refueling base" +#define HUSTR_11 "level 11: 'o' of destruction!" + +#define HUSTR_12 "level 12: the factory" +#define HUSTR_13 "level 13: downtown" +#define HUSTR_14 "level 14: the inmost dens" +#define HUSTR_15 "level 15: industrial zone" +#define HUSTR_16 "level 16: suburbs" +#define HUSTR_17 "level 17: tenements" +#define HUSTR_18 "level 18: the courtyard" +#define HUSTR_19 "level 19: the citadel" +#define HUSTR_20 "level 20: gotcha!" + +#define HUSTR_21 "level 21: nirvana" +#define HUSTR_22 "level 22: the catacombs" +#define HUSTR_23 "level 23: barrels o' fun" +#define HUSTR_24 "level 24: the chasm" +#define HUSTR_25 "level 25: bloodfalls" +#define HUSTR_26 "level 26: the abandoned mines" +#define HUSTR_27 "level 27: monster condo" +#define HUSTR_28 "level 28: the spirit world" +#define HUSTR_29 "level 29: the living end" +#define HUSTR_30 "level 30: icon of sin" + +#define HUSTR_31 "level 31: wolfenstein" +#define HUSTR_32 "level 32: grosse" + +#define PHUSTR_1 "level 1: congo" +#define PHUSTR_2 "level 2: well of souls" +#define PHUSTR_3 "level 3: aztec" +#define PHUSTR_4 "level 4: caged" +#define PHUSTR_5 "level 5: ghost town" +#define PHUSTR_6 "level 6: baron's lair" +#define PHUSTR_7 "level 7: caughtyard" +#define PHUSTR_8 "level 8: realm" +#define PHUSTR_9 "level 9: abattoire" +#define PHUSTR_10 "level 10: onslaught" +#define PHUSTR_11 "level 11: hunted" + +#define PHUSTR_12 "level 12: speed" +#define PHUSTR_13 "level 13: the crypt" +#define PHUSTR_14 "level 14: genesis" +#define PHUSTR_15 "level 15: the twilight" +#define PHUSTR_16 "level 16: the omen" +#define PHUSTR_17 "level 17: compound" +#define PHUSTR_18 "level 18: neurosphere" +#define PHUSTR_19 "level 19: nme" +#define PHUSTR_20 "level 20: the death domain" + +#define PHUSTR_21 "level 21: slayer" +#define PHUSTR_22 "level 22: impossible mission" +#define PHUSTR_23 "level 23: tombstone" +#define PHUSTR_24 "level 24: the final frontier" +#define PHUSTR_25 "level 25: the temple of darkness" +#define PHUSTR_26 "level 26: bunker" +#define PHUSTR_27 "level 27: anti-christ" +#define PHUSTR_28 "level 28: the sewers" +#define PHUSTR_29 "level 29: odyssey of noises" +#define PHUSTR_30 "level 30: the gateway of hell" + +#define PHUSTR_31 "level 31: cyberden" +#define PHUSTR_32 "level 32: go 2 it" + +#define THUSTR_1 "level 1: system control" +#define THUSTR_2 "level 2: human bbq" +#define THUSTR_3 "level 3: power control" +#define THUSTR_4 "level 4: wormhole" +#define THUSTR_5 "level 5: hanger" +#define THUSTR_6 "level 6: open season" +#define THUSTR_7 "level 7: prison" +#define THUSTR_8 "level 8: metal" +#define THUSTR_9 "level 9: stronghold" +#define THUSTR_10 "level 10: redemption" +#define THUSTR_11 "level 11: storage facility" + +#define THUSTR_12 "level 12: crater" +#define THUSTR_13 "level 13: nukage processing" +#define THUSTR_14 "level 14: steel works" +#define THUSTR_15 "level 15: dead zone" +#define THUSTR_16 "level 16: deepest reaches" +#define THUSTR_17 "level 17: processing area" +#define THUSTR_18 "level 18: mill" +#define THUSTR_19 "level 19: shipping/respawning" +#define THUSTR_20 "level 20: central processing" + +#define THUSTR_21 "level 21: administration center" +#define THUSTR_22 "level 22: habitat" +#define THUSTR_23 "level 23: lunar mining project" +#define THUSTR_24 "level 24: quarry" +#define THUSTR_25 "level 25: baron's den" +#define THUSTR_26 "level 26: ballistyx" +#define THUSTR_27 "level 27: mount pain" +#define THUSTR_28 "level 28: heck" +#define THUSTR_29 "level 29: river styx" +#define THUSTR_30 "level 30: last call" + +#define THUSTR_31 "level 31: pharaoh" +#define THUSTR_32 "level 32: caribbean" + +#define HUSTR_CHATMACRO1 "I'm ready to kick butt!" +#define HUSTR_CHATMACRO2 "I'm OK." +#define HUSTR_CHATMACRO3 "I'm not looking too good!" +#define HUSTR_CHATMACRO4 "Help!" +#define HUSTR_CHATMACRO5 "You suck!" +#define HUSTR_CHATMACRO6 "Next time, scumbag..." +#define HUSTR_CHATMACRO7 "Come here!" +#define HUSTR_CHATMACRO8 "I'll take care of it." +#define HUSTR_CHATMACRO9 "Yes" +#define HUSTR_CHATMACRO0 "No" + +#define HUSTR_TALKTOSELF1 "You mumble to yourself" +#define HUSTR_TALKTOSELF2 "Who's there?" +#define HUSTR_TALKTOSELF3 "You scare yourself" +#define HUSTR_TALKTOSELF4 "You start to rave" +#define HUSTR_TALKTOSELF5 "You've lost it..." + +#define HUSTR_MESSAGESENT "[Message Sent]" + +// The following should NOT be changed unless it seems +// just AWFULLY necessary + +#define HUSTR_PLRGREEN "Green: " +#define HUSTR_PLRINDIGO "Indigo: " +#define HUSTR_PLRBROWN "Brown: " +#define HUSTR_PLRRED "Red: " + +#define HUSTR_KEYGREEN 'g' +#define HUSTR_KEYINDIGO 'i' +#define HUSTR_KEYBROWN 'b' +#define HUSTR_KEYRED 'r' + +// +// AM_map.C +// + +#define AMSTR_FOLLOWON "Follow Mode ON" +#define AMSTR_FOLLOWOFF "Follow Mode OFF" + +#define AMSTR_GRIDON "Grid ON" +#define AMSTR_GRIDOFF "Grid OFF" + +#define AMSTR_MARKEDSPOT "Marked Spot" +#define AMSTR_MARKSCLEARED "All Marks Cleared" + +// +// ST_stuff.C +// + +#define STSTR_MUS "Music Change" +#define STSTR_NOMUS "IMPOSSIBLE SELECTION" +#define STSTR_DQDON "Degreelessness Mode On" +#define STSTR_DQDOFF "Degreelessness Mode Off" + +#define STSTR_KFAADDED "Very Happy Ammo Added" +#define STSTR_FAADDED "Ammo (no keys) Added" + +#define STSTR_NCON "No Clipping Mode ON" +#define STSTR_NCOFF "No Clipping Mode OFF" + +#define STSTR_BEHOLD "inVuln, Str, Inviso, Rad, Allmap, or Lite-amp" +#define STSTR_BEHOLDX "Power-up Toggled" + +#define STSTR_CHOPPERS "... doesn't suck - GM" +#define STSTR_CLEV "Changing Level..." + +// +// F_Finale.C +// +#define E1TEXT \ +"Once you beat the big badasses and\n"\ +"clean out the moon base you're supposed\n"\ +"to win, aren't you? Aren't you? Where's\n"\ +"your fat reward and ticket home? What\n"\ +"the hell is this? It's not supposed to\n"\ +"end this way!\n"\ +"\n" \ +"It stinks like rotten meat, but looks\n"\ +"like the lost Deimos base. Looks like\n"\ +"you're stuck on The Shores of Hell.\n"\ +"The only way out is through.\n"\ +"\n"\ +"To continue the DOOM experience, play\n"\ +"The Shores of Hell and its amazing\n"\ +"sequel, Inferno!\n" + + +#define E2TEXT \ +"You've done it! The hideous cyber-\n"\ +"demon lord that ruled the lost Deimos\n"\ +"moon base has been slain and you\n"\ +"are triumphant! But ... where are\n"\ +"you? You clamber to the edge of the\n"\ +"moon and look down to see the awful\n"\ +"truth.\n" \ +"\n"\ +"Deimos floats above Hell itself!\n"\ +"You've never heard of anyone escaping\n"\ +"from Hell, but you'll make the bastards\n"\ +"sorry they ever heard of you! Quickly,\n"\ +"you rappel down to the surface of\n"\ +"Hell.\n"\ +"\n" \ +"Now, it's on to the final chapter of\n"\ +"DOOM! -- Inferno." + + +#define E3TEXT \ +"The loathsome spiderdemon that\n"\ +"masterminded the invasion of the moon\n"\ +"bases and caused so much death has had\n"\ +"its ass kicked for all time.\n"\ +"\n"\ +"A hidden doorway opens and you enter.\n"\ +"You've proven too tough for Hell to\n"\ +"contain, and now Hell at last plays\n"\ +"fair -- for you emerge from the door\n"\ +"to see the green fields of Earth!\n"\ +"Home at last.\n" \ +"\n"\ +"You wonder what's been happening on\n"\ +"Earth while you were battling evil\n"\ +"unleashed. It's good that no Hell-\n"\ +"spawn could have come through that\n"\ +"door with you ..." + + +#define E4TEXT \ +"the spider mastermind must have sent forth\n"\ +"its legions of hellspawn before your\n"\ +"final confrontation with that terrible\n"\ +"beast from hell. but you stepped forward\n"\ +"and brought forth eternal damnation and\n"\ +"suffering upon the horde as a true hero\n"\ +"would in the face of something so evil.\n"\ +"\n"\ +"besides, someone was gonna pay for what\n"\ +"happened to daisy, your pet rabbit.\n"\ +"\n"\ +"but now, you see spread before you more\n"\ +"potential pain and gibbitude as a nation\n"\ +"of demons run amok among our cities.\n"\ +"\n"\ +"next stop, hell on earth!" + + +// after level 6, put this: + +#define C1TEXT \ +"YOU HAVE ENTERED DEEPLY INTO THE INFESTED\n" \ +"STARPORT. BUT SOMETHING IS WRONG. THE\n" \ +"MONSTERS HAVE BROUGHT THEIR OWN REALITY\n" \ +"WITH THEM, AND THE STARPORT'S TECHNOLOGY\n" \ +"IS BEING SUBVERTED BY THEIR PRESENCE.\n" \ +"\n"\ +"AHEAD, YOU SEE AN OUTPOST OF HELL, A\n" \ +"FORTIFIED ZONE. IF YOU CAN GET PAST IT,\n" \ +"YOU CAN PENETRATE INTO THE HAUNTED HEART\n" \ +"OF THE STARBASE AND FIND THE CONTROLLING\n" \ +"SWITCH WHICH HOLDS EARTH'S POPULATION\n" \ +"HOSTAGE." + +// After level 11, put this: + +#define C2TEXT \ +"YOU HAVE WON! YOUR VICTORY HAS ENABLED\n" \ +"HUMANKIND TO EVACUATE EARTH AND ESCAPE\n"\ +"THE NIGHTMARE. NOW YOU ARE THE ONLY\n"\ +"HUMAN LEFT ON THE FACE OF THE PLANET.\n"\ +"CANNIBAL MUTATIONS, CARNIVOROUS ALIENS,\n"\ +"AND EVIL SPIRITS ARE YOUR ONLY NEIGHBORS.\n"\ +"YOU SIT BACK AND WAIT FOR DEATH, CONTENT\n"\ +"THAT YOU HAVE SAVED YOUR SPECIES.\n"\ +"\n"\ +"BUT THEN, EARTH CONTROL BEAMS DOWN A\n"\ +"MESSAGE FROM SPACE: \"SENSORS HAVE LOCATED\n"\ +"THE SOURCE OF THE ALIEN INVASION. IF YOU\n"\ +"GO THERE, YOU MAY BE ABLE TO BLOCK THEIR\n"\ +"ENTRY. THE ALIEN BASE IS IN THE HEART OF\n"\ +"YOUR OWN HOME CITY, NOT FAR FROM THE\n"\ +"STARPORT.\" SLOWLY AND PAINFULLY YOU GET\n"\ +"UP AND RETURN TO THE FRAY." + + +// After level 20, put this: + +#define C3TEXT \ +"YOU ARE AT THE CORRUPT HEART OF THE CITY,\n"\ +"SURROUNDED BY THE CORPSES OF YOUR ENEMIES.\n"\ +"YOU SEE NO WAY TO DESTROY THE CREATURES'\n"\ +"ENTRYWAY ON THIS SIDE, SO YOU CLENCH YOUR\n"\ +"TEETH AND PLUNGE THROUGH IT.\n"\ +"\n"\ +"THERE MUST BE A WAY TO CLOSE IT ON THE\n"\ +"OTHER SIDE. WHAT DO YOU CARE IF YOU'VE\n"\ +"GOT TO GO THROUGH HELL TO GET TO IT?" + + +// After level 29, put this: + +#define C4TEXT \ +"THE HORRENDOUS VISAGE OF THE BIGGEST\n"\ +"DEMON YOU'VE EVER SEEN CRUMBLES BEFORE\n"\ +"YOU, AFTER YOU PUMP YOUR ROCKETS INTO\n"\ +"HIS EXPOSED BRAIN. THE MONSTER SHRIVELS\n"\ +"UP AND DIES, ITS THRASHING LIMBS\n"\ +"DEVASTATING UNTOLD MILES OF HELL'S\n"\ +"SURFACE.\n"\ +"\n"\ +"YOU'VE DONE IT. THE INVASION IS OVER.\n"\ +"EARTH IS SAVED. HELL IS A WRECK. YOU\n"\ +"WONDER WHERE BAD FOLKS WILL GO WHEN THEY\n"\ +"DIE, NOW. WIPING THE SWEAT FROM YOUR\n"\ +"FOREHEAD YOU BEGIN THE LONG TREK BACK\n"\ +"HOME. REBUILDING EARTH OUGHT TO BE A\n"\ +"LOT MORE FUN THAN RUINING IT WAS.\n" + + + +// Before level 31, put this: + +#define C5TEXT \ +"CONGRATULATIONS, YOU'VE FOUND THE SECRET\n"\ +"LEVEL! LOOKS LIKE IT'S BEEN BUILT BY\n"\ +"HUMANS, RATHER THAN DEMONS. YOU WONDER\n"\ +"WHO THE INMATES OF THIS CORNER OF HELL\n"\ +"WILL BE." + + +// Before level 32, put this: + +#define C6TEXT \ +"CONGRATULATIONS, YOU'VE FOUND THE\n"\ +"SUPER SECRET LEVEL! YOU'D BETTER\n"\ +"BLAZE THROUGH THIS ONE!\n" + + +// after map 06 + +#define P1TEXT \ +"You gloat over the steaming carcass of the\n"\ +"Guardian. With its death, you've wrested\n"\ +"the Accelerator from the stinking claws\n"\ +"of Hell. You relax and glance around the\n"\ +"room. Damn! There was supposed to be at\n"\ +"least one working prototype, but you can't\n"\ +"see it. The demons must have taken it.\n"\ +"\n"\ +"You must find the prototype, or all your\n"\ +"struggles will have been wasted. Keep\n"\ +"moving, keep fighting, keep killing.\n"\ +"Oh yes, keep living, too." + + +// after map 11 + +#define P2TEXT \ +"Even the deadly Arch-Vile labyrinth could\n"\ +"not stop you, and you've gotten to the\n"\ +"prototype Accelerator which is soon\n"\ +"efficiently and permanently deactivated.\n"\ +"\n"\ +"You're good at that kind of thing." + + +// after map 20 + +#define P3TEXT \ +"You've bashed and battered your way into\n"\ +"the heart of the devil-hive. Time for a\n"\ +"Search-and-Destroy mission, aimed at the\n"\ +"Gatekeeper, whose foul offspring is\n"\ +"cascading to Earth. Yeah, he's bad. But\n"\ +"you know who's worse!\n"\ +"\n"\ +"Grinning evilly, you check your gear, and\n"\ +"get ready to give the bastard a little Hell\n"\ +"of your own making!" + +// after map 30 + +#define P4TEXT \ +"The Gatekeeper's evil face is splattered\n"\ +"all over the place. As its tattered corpse\n"\ +"collapses, an inverted Gate forms and\n"\ +"sucks down the shards of the last\n"\ +"prototype Accelerator, not to mention the\n"\ +"few remaining demons. You're done. Hell\n"\ +"has gone back to pounding bad dead folks \n"\ +"instead of good live ones. Remember to\n"\ +"tell your grandkids to put a rocket\n"\ +"launcher in your coffin. If you go to Hell\n"\ +"when you die, you'll need it for some\n"\ +"final cleaning-up ..." + +// before map 31 + +#define P5TEXT \ +"You've found the second-hardest level we\n"\ +"got. Hope you have a saved game a level or\n"\ +"two previous. If not, be prepared to die\n"\ +"aplenty. For master marines only." + +// before map 32 + +#define P6TEXT \ +"Betcha wondered just what WAS the hardest\n"\ +"level we had ready for ya? Now you know.\n"\ +"No one gets out alive." + + +#define T1TEXT \ +"You've fought your way out of the infested\n"\ +"experimental labs. It seems that UAC has\n"\ +"once again gulped it down. With their\n"\ +"high turnover, it must be hard for poor\n"\ +"old UAC to buy corporate health insurance\n"\ +"nowadays..\n"\ +"\n"\ +"Ahead lies the military complex, now\n"\ +"swarming with diseased horrors hot to get\n"\ +"their teeth into you. With luck, the\n"\ +"complex still has some warlike ordnance\n"\ +"laying around." + + +#define T2TEXT \ +"You hear the grinding of heavy machinery\n"\ +"ahead. You sure hope they're not stamping\n"\ +"out new hellspawn, but you're ready to\n"\ +"ream out a whole herd if you have to.\n"\ +"They might be planning a blood feast, but\n"\ +"you feel about as mean as two thousand\n"\ +"maniacs packed into one mad killer.\n"\ +"\n"\ +"You don't plan to go down easy." + + +#define T3TEXT \ +"The vista opening ahead looks real damn\n"\ +"familiar. Smells familiar, too -- like\n"\ +"fried excrement. You didn't like this\n"\ +"place before, and you sure as hell ain't\n"\ +"planning to like it now. The more you\n"\ +"brood on it, the madder you get.\n"\ +"Hefting your gun, an evil grin trickles\n"\ +"onto your face. Time to take some names." + +#define T4TEXT \ +"Suddenly, all is silent, from one horizon\n"\ +"to the other. The agonizing echo of Hell\n"\ +"fades away, the nightmare sky turns to\n"\ +"blue, the heaps of monster corpses start \n"\ +"to evaporate along with the evil stench \n"\ +"that filled the air. Jeeze, maybe you've\n"\ +"done it. Have you really won?\n"\ +"\n"\ +"Something rumbles in the distance.\n"\ +"A blue light begins to glow inside the\n"\ +"ruined skull of the demon-spitter." + + +#define T5TEXT \ +"What now? Looks totally different. Kind\n"\ +"of like King Tut's condo. Well,\n"\ +"whatever's here can't be any worse\n"\ +"than usual. Can it? Or maybe it's best\n"\ +"to let sleeping gods lie.." + + +#define T6TEXT \ +"Time for a vacation. You've burst the\n"\ +"bowels of hell and by golly you're ready\n"\ +"for a break. You mutter to yourself,\n"\ +"Maybe someone else can kick Hell's ass\n"\ +"next time around. Ahead lies a quiet town,\n"\ +"with peaceful flowing water, quaint\n"\ +"buildings, and presumably no Hellspawn.\n"\ +"\n"\ +"As you step off the transport, you hear\n"\ +"the stomp of a cyberdemon's iron shoe." + + + +// +// Character cast strings F_FINALE.C +// +#define CC_ZOMBIE "ZOMBIEMAN" +#define CC_SHOTGUN "SHOTGUN GUY" +#define CC_HEAVY "HEAVY WEAPON DUDE" +#define CC_IMP "IMP" +#define CC_DEMON "DEMON" +#define CC_LOST "LOST SOUL" +#define CC_CACO "CACODEMON" +#define CC_HELL "HELL KNIGHT" +#define CC_BARON "BARON OF HELL" +#define CC_ARACH "ARACHNOTRON" +#define CC_PAIN "PAIN ELEMENTAL" +#define CC_REVEN "REVENANT" +#define CC_MANCU "MANCUBUS" +#define CC_ARCH "ARCH-VILE" +#define CC_SPIDER "THE SPIDER MASTERMIND" +#define CC_CYBER "THE CYBERDEMON" +#define CC_HERO "OUR HERO" + + +#endif +//----------------------------------------------------------------------------- +// +// $Log:$ +// +//----------------------------------------------------------------------------- diff --git a/linuxdoom-1.10/d_event.h b/src/d_event.h diff --git a/linuxdoom-1.10/d_french.h b/src/d_french.h diff --git a/linuxdoom-1.10/d_items.c b/src/d_items.c diff --git a/linuxdoom-1.10/d_items.h b/src/d_items.h diff --git a/linuxdoom-1.10/d_main.c b/src/d_main.c diff --git a/linuxdoom-1.10/d_main.h b/src/d_main.h diff --git a/linuxdoom-1.10/d_net.c b/src/d_net.c diff --git a/linuxdoom-1.10/d_net.h b/src/d_net.h diff --git a/linuxdoom-1.10/d_player.h b/src/d_player.h diff --git a/linuxdoom-1.10/d_textur.h b/src/d_textur.h diff --git a/linuxdoom-1.10/d_think.h b/src/d_think.h diff --git a/linuxdoom-1.10/d_ticcmd.h b/src/d_ticcmd.h diff --git a/linuxdoom-1.10/doomdata.h b/src/doomdata.h diff --git a/linuxdoom-1.10/doomdef.c b/src/doomdef.c diff --git a/linuxdoom-1.10/doomdef.h b/src/doomdef.h diff --git a/linuxdoom-1.10/doomstat.c b/src/doomstat.c diff --git a/linuxdoom-1.10/doomstat.h b/src/doomstat.h diff --git a/linuxdoom-1.10/doomtype.h b/src/doomtype.h diff --git a/linuxdoom-1.10/dstrings.c b/src/dstrings.c diff --git a/linuxdoom-1.10/dstrings.h b/src/dstrings.h diff --git a/linuxdoom-1.10/f_finale.c b/src/f_finale.c diff --git a/linuxdoom-1.10/f_finale.h b/src/f_finale.h diff --git a/linuxdoom-1.10/f_wipe.c b/src/f_wipe.c diff --git a/linuxdoom-1.10/f_wipe.h b/src/f_wipe.h diff --git a/linuxdoom-1.10/g_game.c b/src/g_game.c diff --git a/linuxdoom-1.10/g_game.h b/src/g_game.h diff --git a/linuxdoom-1.10/hu_lib.c b/src/hu_lib.c diff --git a/linuxdoom-1.10/hu_lib.h b/src/hu_lib.h diff --git a/linuxdoom-1.10/hu_stuff.c b/src/hu_stuff.c diff --git a/linuxdoom-1.10/hu_stuff.h b/src/hu_stuff.h diff --git a/linuxdoom-1.10/i_main.c b/src/i_main.c diff --git a/linuxdoom-1.10/i_net.c b/src/i_net.c diff --git a/linuxdoom-1.10/i_net.h b/src/i_net.h diff --git a/src/i_sound.c b/src/i_sound.c @@ -0,0 +1,984 @@ +// Emacs style mode select -*- C++ -*- +//----------------------------------------------------------------------------- +// +// $Id:$ +// +// Copyright (C) 1993-1996 by id Software, Inc. +// +// This source is available for distribution and/or modification +// only under the terms of the DOOM Source Code License as +// published by id Software. All rights reserved. +// +// The source is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// FITNESS FOR A PARTICULAR PURPOSE. See the DOOM Source Code License +// for more details. +// +// $Log:$ +// +// DESCRIPTION: +// System interface for sound. +// +//----------------------------------------------------------------------------- + +static const char +rcsid[] = "$Id: i_unix.c,v 1.5 1997/02/03 22:45:10 b1 Exp $"; + +#include <stdio.h> +#include <stdlib.h> +#include <stdarg.h> +#include <errno.h> +#include <math.h> + +#include <sys/time.h> +#include <sys/types.h> + +#ifndef LINUX +#include <sys/filio.h> +#endif + +#include <fcntl.h> +#include <unistd.h> +#include <sys/ioctl.h> + +// Linux voxware output. +#include <linux/soundcard.h> + +// Timer stuff. Experimental. +#include <time.h> +#include <signal.h> + +#include "z_zone.h" + +#include "i_system.h" +#include "i_sound.h" +#include "m_argv.h" +#include "m_misc.h" +#include "w_wad.h" + +#include "doomdef.h" + +// UNIX hack, to be removed. +#ifdef SNDSERV +// Separate sound server process. +FILE* sndserver=0; +char* sndserver_filename = "./sndserver "; +#elif SNDINTR + +// Update all 30 millisecs, approx. 30fps synchronized. +// Linux resolution is allegedly 10 millisecs, +// scale is microseconds. +#define SOUND_INTERVAL 500 + +// Get the interrupt. Set duration in millisecs. +int I_SoundSetTimer( int duration_of_tick ); +void I_SoundDelTimer( void ); +#else +// None? +#endif + + +// A quick hack to establish a protocol between +// synchronous mix buffer updates and asynchronous +// audio writes. Probably redundant with gametic. +static int flag = 0; + +// The number of internal mixing channels, +// the samples calculated for each mixing step, +// the size of the 16bit, 2 hardware channel (stereo) +// mixing buffer, and the samplerate of the raw data. + + +// Needed for calling the actual sound output. +#define SAMPLECOUNT 512 +#define NUM_CHANNELS 8 +// It is 2 for 16bit, and 2 for two channels. +#define BUFMUL 4 +#define MIXBUFFERSIZE (SAMPLECOUNT*BUFMUL) + +#define SAMPLERATE 11025 // Hz +#define SAMPLESIZE 2 // 16bit + +// The actual lengths of all sound effects. +int lengths[NUMSFX]; + +// The actual output device. +int audio_fd; + +// The global mixing buffer. +// Basically, samples from all active internal channels +// are modifed and added, and stored in the buffer +// that is submitted to the audio device. +signed short mixbuffer[MIXBUFFERSIZE]; + + +// The channel step amount... +unsigned int channelstep[NUM_CHANNELS]; +// ... and a 0.16 bit remainder of last step. +unsigned int channelstepremainder[NUM_CHANNELS]; + + +// The channel data pointers, start and end. +unsigned char* channels[NUM_CHANNELS]; +unsigned char* channelsend[NUM_CHANNELS]; + + +// Time/gametic that the channel started playing, +// used to determine oldest, which automatically +// has lowest priority. +// In case number of active sounds exceeds +// available channels. +int channelstart[NUM_CHANNELS]; + +// The sound in channel handles, +// determined on registration, +// might be used to unregister/stop/modify, +// currently unused. +int channelhandles[NUM_CHANNELS]; + +// SFX id of the playing sound effect. +// Used to catch duplicates (like chainsaw). +int channelids[NUM_CHANNELS]; + +// Pitch to stepping lookup, unused. +int steptable[256]; + +// Volume lookups. +int vol_lookup[128*256]; + +// Hardware left and right channel volume lookup. +int* channelleftvol_lookup[NUM_CHANNELS]; +int* channelrightvol_lookup[NUM_CHANNELS]; + + + + +// +// Safe ioctl, convenience. +// +void +myioctl +( int fd, + int command, + int* arg ) +{ + int rc; + + rc = ioctl(fd, command, arg); + if (rc < 0) + { + fprintf(stderr, "ioctl(dsp,%d,arg) failed\n", command); + fprintf(stderr, "errno=%d\n", errno); + exit(-1); + } +} + + + + + +// +// This function loads the sound data from the WAD lump, +// for single sound. +// +void* +getsfx +( char* sfxname, + int* len ) +{ + unsigned char* sfx; + unsigned char* paddedsfx; + int i; + int size; + int paddedsize; + char name[20]; + int sfxlump; + + + // Get the sound data from the WAD, allocate lump + // in zone memory. + sprintf(name, "ds%s", sfxname); + + // Now, there is a severe problem with the + // sound handling, in it is not (yet/anymore) + // gamemode aware. That means, sounds from + // DOOM II will be requested even with DOOM + // shareware. + // The sound list is wired into sounds.c, + // which sets the external variable. + // I do not do runtime patches to that + // variable. Instead, we will use a + // default sound for replacement. + if ( W_CheckNumForName(name) == -1 ) + sfxlump = W_GetNumForName("dspistol"); + else + sfxlump = W_GetNumForName(name); + + size = W_LumpLength( sfxlump ); + + // Debug. + // fprintf( stderr, "." ); + //fprintf( stderr, " -loading %s (lump %d, %d bytes)\n", + // sfxname, sfxlump, size ); + //fflush( stderr ); + + sfx = (unsigned char*)W_CacheLumpNum( sfxlump, PU_STATIC ); + + // Pads the sound effect out to the mixing buffer size. + // The original realloc would interfere with zone memory. + paddedsize = ((size-8 + (SAMPLECOUNT-1)) / SAMPLECOUNT) * SAMPLECOUNT; + + // Allocate from zone memory. + paddedsfx = (unsigned char*)Z_Malloc( paddedsize+8, PU_STATIC, 0 ); + // ddt: (unsigned char *) realloc(sfx, paddedsize+8); + // This should interfere with zone memory handling, + // which does not kick in in the soundserver. + + // Now copy and pad. + memcpy( paddedsfx, sfx, size ); + for (i=size ; i<paddedsize+8 ; i++) + paddedsfx[i] = 128; + + // Remove the cached lump. + Z_Free( sfx ); + + // Preserve padded length. + *len = paddedsize; + + // Return allocated padded data. + return (void *) (paddedsfx + 8); +} + + + + + +// +// This function adds a sound to the +// list of currently active sounds, +// which is maintained as a given number +// (eight, usually) of internal channels. +// Returns a handle. +// +int +addsfx +( int sfxid, + int volume, + int step, + int seperation ) +{ + static unsigned short handlenums = 0; + + int i; + int rc = -1; + + int oldest = gametic; + int oldestnum = 0; + int slot; + + int rightvol; + int leftvol; + + // Chainsaw troubles. + // Play these sound effects only one at a time. + if ( sfxid == sfx_sawup + || sfxid == sfx_sawidl + || sfxid == sfx_sawful + || sfxid == sfx_sawhit + || sfxid == sfx_stnmov + || sfxid == sfx_pistol ) + { + // Loop all channels, check. + for (i=0 ; i<NUM_CHANNELS ; i++) + { + // Active, and using the same SFX? + if ( (channels[i]) + && (channelids[i] == sfxid) ) + { + // Reset. + channels[i] = 0; + // We are sure that iff, + // there will only be one. + break; + } + } + } + + // Loop all channels to find oldest SFX. + for (i=0; (i<NUM_CHANNELS) && (channels[i]); i++) + { + if (channelstart[i] < oldest) + { + oldestnum = i; + oldest = channelstart[i]; + } + } + + // Tales from the cryptic. + // If we found a channel, fine. + // If not, we simply overwrite the first one, 0. + // Probably only happens at startup. + if (i == NUM_CHANNELS) + slot = oldestnum; + else + slot = i; + + // Okay, in the less recent channel, + // we will handle the new SFX. + // Set pointer to raw data. + channels[slot] = (unsigned char *) S_sfx[sfxid].data; + // Set pointer to end of raw data. + channelsend[slot] = channels[slot] + lengths[sfxid]; + + // Reset current handle number, limited to 0..100. + if (!handlenums) + handlenums = 100; + + // Assign current handle number. + // Preserved so sounds could be stopped (unused). + channelhandles[slot] = rc = handlenums++; + + // Set stepping??? + // Kinda getting the impression this is never used. + channelstep[slot] = step; + // ??? + channelstepremainder[slot] = 0; + // Should be gametic, I presume. + channelstart[slot] = gametic; + + // Separation, that is, orientation/stereo. + // range is: 1 - 256 + seperation += 1; + + // Per left/right channel. + // x^2 seperation, + // adjust volume properly. + leftvol = + volume - ((volume*seperation*seperation) >> 16); ///(256*256); + seperation = seperation - 257; + rightvol = + volume - ((volume*seperation*seperation) >> 16); + + // Sanity check, clamp volume. + if (rightvol < 0 || rightvol > 127) + I_Error("rightvol out of bounds"); + + if (leftvol < 0 || leftvol > 127) + I_Error("leftvol out of bounds"); + + // Get the proper lookup table piece + // for this volume level??? + channelleftvol_lookup[slot] = &vol_lookup[leftvol*256]; + channelrightvol_lookup[slot] = &vol_lookup[rightvol*256]; + + // Preserve sound SFX id, + // e.g. for avoiding duplicates of chainsaw. + channelids[slot] = sfxid; + + // You tell me. + return rc; +} + + + + + +// +// SFX API +// Note: this was called by S_Init. +// However, whatever they did in the +// old DPMS based DOS version, this +// were simply dummies in the Linux +// version. +// See soundserver initdata(). +// +void I_SetChannels() +{ + // Init internal lookups (raw data, mixing buffer, channels). + // This function sets up internal lookups used during + // the mixing process. + int i; + int j; + + int* steptablemid = steptable + 128; + + // Okay, reset internal mixing channels to zero. + /*for (i=0; i<NUM_CHANNELS; i++) + { + channels[i] = 0; + }*/ + + // This table provides step widths for pitch parameters. + // I fail to see that this is currently used. + for (i=-128 ; i<128 ; i++) + steptablemid[i] = (int)(pow(2.0, (i/64.0))*65536.0); + + + // Generates volume lookup tables + // which also turn the unsigned samples + // into signed samples. + for (i=0 ; i<128 ; i++) + for (j=0 ; j<256 ; j++) + vol_lookup[i*256+j] = (i*(j-128)*256)/127; +} + + +void I_SetSfxVolume(int volume) +{ + // Identical to DOS. + // Basically, this should propagate + // the menu/config file setting + // to the state variable used in + // the mixing. + snd_SfxVolume = volume; +} + +// MUSIC API - dummy. Some code from DOS version. +void I_SetMusicVolume(int volume) +{ + // Internal state variable. + snd_MusicVolume = volume; + // Now set volume on output device. + // Whatever( snd_MusciVolume ); +} + + +// +// Retrieve the raw data lump index +// for a given SFX name. +// +int I_GetSfxLumpNum(sfxinfo_t* sfx) +{ + char namebuf[9]; + sprintf(namebuf, "ds%s", sfx->name); + return W_GetNumForName(namebuf); +} + +// +// Starting a sound means adding it +// to the current list of active sounds +// in the internal channels. +// As the SFX info struct contains +// e.g. a pointer to the raw data, +// it is ignored. +// As our sound handling does not handle +// priority, it is ignored. +// Pitching (that is, increased speed of playback) +// is set, but currently not used by mixing. +// +int +I_StartSound +( int id, + int vol, + int sep, + int pitch, + int priority ) +{ + + // UNUSED + priority = 0; + +#ifdef SNDSERV + if (sndserver) + { + fprintf(sndserver, "p%2.2x%2.2x%2.2x%2.2x\n", id, pitch, vol, sep); + fflush(sndserver); + } + // warning: control reaches end of non-void function. + return id; +#else + // Debug. + //fprintf( stderr, "starting sound %d", id ); + + // Returns a handle (not used). + id = addsfx( id, vol, steptable[pitch], sep ); + + // fprintf( stderr, "/handle is %d\n", id ); + + return id; +#endif +} + + + +void I_StopSound (int handle) +{ + // You need the handle returned by StartSound. + // Would be looping all channels, + // tracking down the handle, + // an setting the channel to zero. + + // UNUSED. + handle = 0; +} + + +int I_SoundIsPlaying(int handle) +{ + // Ouch. + return gametic < handle; +} + + + + +// +// This function loops all active (internal) sound +// channels, retrieves a given number of samples +// from the raw sound data, modifies it according +// to the current (internal) channel parameters, +// mixes the per channel samples into the global +// mixbuffer, clamping it to the allowed range, +// and sets up everything for transferring the +// contents of the mixbuffer to the (two) +// hardware channels (left and right, that is). +// +// This function currently supports only 16bit. +// +void I_UpdateSound( void ) +{ +#ifdef SNDINTR + // Debug. Count buffer misses with interrupt. + static int misses = 0; +#endif + + + // Mix current sound data. + // Data, from raw sound, for right and left. + register unsigned int sample; + register int dl; + register int dr; + + // Pointers in global mixbuffer, left, right, end. + signed short* leftout; + signed short* rightout; + signed short* leftend; + // Step in mixbuffer, left and right, thus two. + int step; + + // Mixing channel index. + int chan; + + // Left and right channel + // are in global mixbuffer, alternating. + leftout = mixbuffer; + rightout = mixbuffer+1; + step = 2; + + // Determine end, for left channel only + // (right channel is implicit). + leftend = mixbuffer + SAMPLECOUNT*step; + + // Mix sounds into the mixing buffer. + // Loop over step*SAMPLECOUNT, + // that is 512 values for two channels. + while (leftout != leftend) + { + // Reset left/right value. + dl = 0; + dr = 0; + + // Love thy L2 chache - made this a loop. + // Now more channels could be set at compile time + // as well. Thus loop those channels. + for ( chan = 0; chan < NUM_CHANNELS; chan++ ) + { + // Check channel, if active. + if (channels[ chan ]) + { + // Get the raw data from the channel. + sample = *channels[ chan ]; + // Add left and right part + // for this channel (sound) + // to the current data. + // Adjust volume accordingly. + dl += channelleftvol_lookup[ chan ][sample]; + dr += channelrightvol_lookup[ chan ][sample]; + // Increment index ??? + channelstepremainder[ chan ] += channelstep[ chan ]; + // MSB is next sample??? + channels[ chan ] += channelstepremainder[ chan ] >> 16; + // Limit to LSB??? + channelstepremainder[ chan ] &= 65536-1; + + // Check whether we are done. + if (channels[ chan ] >= channelsend[ chan ]) + channels[ chan ] = 0; + } + } + + // Clamp to range. Left hardware channel. + // Has been char instead of short. + // if (dl > 127) *leftout = 127; + // else if (dl < -128) *leftout = -128; + // else *leftout = dl; + + if (dl > 0x7fff) + *leftout = 0x7fff; + else if (dl < -0x8000) + *leftout = -0x8000; + else + *leftout = dl; + + // Same for right hardware channel. + if (dr > 0x7fff) + *rightout = 0x7fff; + else if (dr < -0x8000) + *rightout = -0x8000; + else + *rightout = dr; + + // Increment current pointers in mixbuffer. + leftout += step; + rightout += step; + } + +#ifdef SNDINTR + // Debug check. + if ( flag ) + { + misses += flag; + flag = 0; + } + + if ( misses > 10 ) + { + fprintf( stderr, "I_SoundUpdate: missed 10 buffer writes\n"); + misses = 0; + } + + // Increment flag for update. + flag++; +#endif +} + + +// +// This would be used to write out the mixbuffer +// during each game loop update. +// Updates sound buffer and audio device at runtime. +// It is called during Timer interrupt with SNDINTR. +// Mixing now done synchronous, and +// only output be done asynchronous? +// +void +I_SubmitSound(void) +{ + // Write it to DSP device. + write(audio_fd, mixbuffer, SAMPLECOUNT*BUFMUL); +} + + + +void +I_UpdateSoundParams +( int handle, + int vol, + int sep, + int pitch) +{ + // I fail too see that this is used. + // Would be using the handle to identify + // on which channel the sound might be active, + // and resetting the channel parameters. + + // UNUSED. + handle = vol = sep = pitch = 0; +} + + + + +void I_ShutdownSound(void) +{ +#ifdef SNDSERV + if (sndserver) + { + // Send a "quit" command. + fprintf(sndserver, "q\n"); + fflush(sndserver); + } +#else + // Wait till all pending sounds are finished. + int done = 0; + int i; + + + // FIXME (below). + fprintf( stderr, "I_ShutdownSound: NOT finishing pending sounds\n"); + fflush( stderr ); + + while ( !done ) + { + for( i=0 ; i<8 && !channels[i] ; i++); + + // FIXME. No proper channel output. + //if (i==8) + done=1; + } +#ifdef SNDINTR + I_SoundDelTimer(); +#endif + + // Cleaning up -releasing the DSP device. + close ( audio_fd ); +#endif + + // Done. + return; +} + + + + + + +void +I_InitSound() +{ +#ifdef SNDSERV + char buffer[256]; + + if (getenv("DOOMWADDIR")) + sprintf(buffer, "%s/%s", + getenv("DOOMWADDIR"), + sndserver_filename); + else + sprintf(buffer, "%s", sndserver_filename); + + // start sound process + if ( !access(buffer, X_OK) ) + { + strcat(buffer, " -quiet"); + sndserver = popen(buffer, "w"); + } + else + fprintf(stderr, "Could not start sound server [%s]\n", buffer); +#else + + int i; + +#ifdef SNDINTR + fprintf( stderr, "I_SoundSetTimer: %d microsecs\n", SOUND_INTERVAL ); + I_SoundSetTimer( SOUND_INTERVAL ); +#endif + + // Secure and configure sound device first. + fprintf( stderr, "I_InitSound: "); + + audio_fd = open("/dev/dsp", O_WRONLY); + if (audio_fd<0) + fprintf(stderr, "Could not open /dev/dsp\n"); + + + i = 11 | (2<<16); + myioctl(audio_fd, SNDCTL_DSP_SETFRAGMENT, &i); + myioctl(audio_fd, SNDCTL_DSP_RESET, 0); + + i=SAMPLERATE; + + myioctl(audio_fd, SNDCTL_DSP_SPEED, &i); + + i=1; + myioctl(audio_fd, SNDCTL_DSP_STEREO, &i); + + myioctl(audio_fd, SNDCTL_DSP_GETFMTS, &i); + + if (i&=AFMT_S16_LE) + myioctl(audio_fd, SNDCTL_DSP_SETFMT, &i); + else + fprintf(stderr, "Could not play signed 16 data\n"); + + fprintf(stderr, " configured audio device\n" ); + + + // Initialize external data (all sounds) at start, keep static. + fprintf( stderr, "I_InitSound: "); + + for (i=1 ; i<NUMSFX ; i++) + { + // Alias? Example is the chaingun sound linked to pistol. + if (!S_sfx[i].link) + { + // Load data from WAD file. + S_sfx[i].data = getsfx( S_sfx[i].name, &lengths[i] ); + } + else + { + // Previously loaded already? + S_sfx[i].data = S_sfx[i].link->data; + lengths[i] = lengths[(S_sfx[i].link - S_sfx)/sizeof(sfxinfo_t)]; + } + } + + fprintf( stderr, " pre-cached all sound data\n"); + + // Now initialize mixbuffer with zero. + for ( i = 0; i< MIXBUFFERSIZE; i++ ) + mixbuffer[i] = 0; + + // Finished initialization. + fprintf(stderr, "I_InitSound: sound module ready\n"); + +#endif +} + + + + +// +// MUSIC API. +// Still no music done. +// Remains. Dummies. +// +void I_InitMusic(void) { } +void I_ShutdownMusic(void) { } + +static int looping=0; +static int musicdies=-1; + +void I_PlaySong(int handle, int looping) +{ + // UNUSED. + handle = looping = 0; + musicdies = gametic + TICRATE*30; +} + +void I_PauseSong (int handle) +{ + // UNUSED. + handle = 0; +} + +void I_ResumeSong (int handle) +{ + // UNUSED. + handle = 0; +} + +void I_StopSong(int handle) +{ + // UNUSED. + handle = 0; + + looping = 0; + musicdies = 0; +} + +void I_UnRegisterSong(int handle) +{ + // UNUSED. + handle = 0; +} + +int I_RegisterSong(void* data) +{ + // UNUSED. + data = NULL; + + return 1; +} + +// Is the song playing? +int I_QrySongPlaying(int handle) +{ + // UNUSED. + handle = 0; + return looping || musicdies > gametic; +} + + + +// +// Experimental stuff. +// A Linux timer interrupt, for asynchronous +// sound output. +// I ripped this out of the Timer class in +// our Difference Engine, including a few +// SUN remains... +// +#ifdef sun + typedef sigset_t tSigSet; +#else + typedef int tSigSet; +#endif + + +// We might use SIGVTALRM and ITIMER_VIRTUAL, if the process +// time independend timer happens to get lost due to heavy load. +// SIGALRM and ITIMER_REAL doesn't really work well. +// There are issues with profiling as well. +static int /*__itimer_which*/ itimer = ITIMER_REAL; + +static int sig = SIGALRM; + +// Interrupt handler. +void I_HandleSoundTimer( int ignore ) +{ + // Debug. + //fprintf( stderr, "%c", '+' ); fflush( stderr ); + + // Feed sound device if necesary. + if ( flag ) + { + // See I_SubmitSound(). + // Write it to DSP device. + write(audio_fd, mixbuffer, SAMPLECOUNT*BUFMUL); + + // Reset flag counter. + flag = 0; + } + else + return; + + // UNUSED, but required. + ignore = 0; + return; +} + +// Get the interrupt. Set duration in millisecs. +int I_SoundSetTimer( int duration_of_tick ) +{ + // Needed for gametick clockwork. + struct itimerval value; + struct itimerval ovalue; + struct sigaction act; + struct sigaction oact; + + int res; + + // This sets to SA_ONESHOT and SA_NOMASK, thus we can not use it. + // signal( _sig, handle_SIG_TICK ); + + // Now we have to change this attribute for repeated calls. + act.sa_handler = I_HandleSoundTimer; +#ifndef sun + //ac t.sa_mask = _sig; +#endif + act.sa_flags = SA_RESTART; + + sigaction( sig, &act, &oact ); + + value.it_interval.tv_sec = 0; + value.it_interval.tv_usec = duration_of_tick; + value.it_value.tv_sec = 0; + value.it_value.tv_usec = duration_of_tick; + + // Error is -1. + res = setitimer( itimer, &value, &ovalue ); + + // Debug. + if ( res == -1 ) + fprintf( stderr, "I_SoundSetTimer: interrupt n.a.\n"); + + return res; +} + + +// Remove the interrupt. Set duration to zero. +void I_SoundDelTimer() +{ + // Debug. + if ( I_SoundSetTimer( 0 ) == -1) + fprintf( stderr, "I_SoundDelTimer: failed to remove interrupt. Doh!\n"); +} diff --git a/linuxdoom-1.10/i_sound.h b/src/i_sound.h diff --git a/linuxdoom-1.10/i_system.c b/src/i_system.c diff --git a/linuxdoom-1.10/i_system.h b/src/i_system.h diff --git a/src/i_video.c b/src/i_video.c @@ -0,0 +1,1050 @@ +// Emacs style mode select -*- C++ -*- +//----------------------------------------------------------------------------- +// +// $Id:$ +// +// Copyright (C) 1993-1996 by id Software, Inc. +// +// This source is available for distribution and/or modification +// only under the terms of the DOOM Source Code License as +// published by id Software. All rights reserved. +// +// The source is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// FITNESS FOR A PARTICULAR PURPOSE. See the DOOM Source Code License +// for more details. +// +// $Log:$ +// +// DESCRIPTION: +// DOOM graphics stuff for X11, UNIX. +// +//----------------------------------------------------------------------------- + +static const char +rcsid[] = "$Id: i_x.c,v 1.6 1997/02/03 22:45:10 b1 Exp $"; + +#include <stdlib.h> +#include <unistd.h> +#include <sys/ipc.h> +#include <sys/shm.h> + +#include <X11/Xlib.h> +#include <X11/Xutil.h> +#include <X11/keysym.h> + +#include <X11/extensions/XShm.h> +// Had to dig up XShm.c for this one. +// It is in the libXext, but not in the XFree86 headers. +#ifdef LINUX +int XShmGetEventBase( Display* dpy ); // problems with g++? +#endif + +#include <stdarg.h> +#include <sys/time.h> +#include <sys/types.h> +#include <sys/socket.h> + +#include <netinet/in.h> +#include <errno.h> +#include <signal.h> + +#include "doomstat.h" +#include "i_system.h" +#include "v_video.h" +#include "m_argv.h" +#include "d_main.h" + +#include "doomdef.h" + +#define POINTER_WARP_COUNTDOWN 1 + +Display* X_display=0; +Window X_mainWindow; +Colormap X_cmap; +Visual* X_visual; +GC X_gc; +XEvent X_event; +int X_screen; +XVisualInfo X_visualinfo; +XImage* image; +int X_width; +int X_height; + +// MIT SHared Memory extension. +boolean doShm; + +XShmSegmentInfo X_shminfo; +int X_shmeventtype; + +// Fake mouse handling. +// This cannot work properly w/o DGA. +// Needs an invisible mouse cursor at least. +boolean grabMouse; +int doPointerWarp = POINTER_WARP_COUNTDOWN; + +// Blocky mode, +// replace each 320x200 pixel with multiply*multiply pixels. +// According to Dave Taylor, it still is a bonehead thing +// to use .... +static int multiply=1; + + +// +// Translates the key currently in X_event +// + +int xlatekey(void) +{ + + int rc; + + switch(rc = XKeycodeToKeysym(X_display, X_event.xkey.keycode, 0)) + { + case XK_Left: rc = KEY_LEFTARROW; break; + case XK_Right: rc = KEY_RIGHTARROW; break; + case XK_Down: rc = KEY_DOWNARROW; break; + case XK_Up: rc = KEY_UPARROW; break; + case XK_Escape: rc = KEY_ESCAPE; break; + case XK_Return: rc = KEY_ENTER; break; + case XK_Tab: rc = KEY_TAB; break; + case XK_F1: rc = KEY_F1; break; + case XK_F2: rc = KEY_F2; break; + case XK_F3: rc = KEY_F3; break; + case XK_F4: rc = KEY_F4; break; + case XK_F5: rc = KEY_F5; break; + case XK_F6: rc = KEY_F6; break; + case XK_F7: rc = KEY_F7; break; + case XK_F8: rc = KEY_F8; break; + case XK_F9: rc = KEY_F9; break; + case XK_F10: rc = KEY_F10; break; + case XK_F11: rc = KEY_F11; break; + case XK_F12: rc = KEY_F12; break; + + case XK_BackSpace: + case XK_Delete: rc = KEY_BACKSPACE; break; + + case XK_Pause: rc = KEY_PAUSE; break; + + case XK_KP_Equal: + case XK_equal: rc = KEY_EQUALS; break; + + case XK_KP_Subtract: + case XK_minus: rc = KEY_MINUS; break; + + case XK_Shift_L: + case XK_Shift_R: + rc = KEY_RSHIFT; + break; + + case XK_Control_L: + case XK_Control_R: + rc = KEY_RCTRL; + break; + + case XK_Alt_L: + case XK_Meta_L: + case XK_Alt_R: + case XK_Meta_R: + rc = KEY_RALT; + break; + + default: + if (rc >= XK_space && rc <= XK_asciitilde) + rc = rc - XK_space + ' '; + if (rc >= 'A' && rc <= 'Z') + rc = rc - 'A' + 'a'; + break; + } + + return rc; + +} + +void I_ShutdownGraphics(void) +{ + // Detach from X server + if (!XShmDetach(X_display, &X_shminfo)) + I_Error("XShmDetach() failed in I_ShutdownGraphics()"); + + // Release shared memory. + shmdt(X_shminfo.shmaddr); + shmctl(X_shminfo.shmid, IPC_RMID, 0); + + // Paranoia. + image->data = NULL; +} + + + +// +// I_StartFrame +// +void I_StartFrame (void) +{ + // er? + +} + +static int lastmousex = 0; +static int lastmousey = 0; +boolean mousemoved = false; +boolean shmFinished; + +void I_GetEvent(void) +{ + + event_t event; + + // put event-grabbing stuff in here + XNextEvent(X_display, &X_event); + switch (X_event.type) + { + case KeyPress: + event.type = ev_keydown; + event.data1 = xlatekey(); + D_PostEvent(&event); + // fprintf(stderr, "k"); + break; + case KeyRelease: + event.type = ev_keyup; + event.data1 = xlatekey(); + D_PostEvent(&event); + // fprintf(stderr, "ku"); + break; + case ButtonPress: + event.type = ev_mouse; + event.data1 = + (X_event.xbutton.state & Button1Mask) + | (X_event.xbutton.state & Button2Mask ? 2 : 0) + | (X_event.xbutton.state & Button3Mask ? 4 : 0) + | (X_event.xbutton.button == Button1) + | (X_event.xbutton.button == Button2 ? 2 : 0) + | (X_event.xbutton.button == Button3 ? 4 : 0); + event.data2 = event.data3 = 0; + D_PostEvent(&event); + // fprintf(stderr, "b"); + break; + case ButtonRelease: + event.type = ev_mouse; + event.data1 = + (X_event.xbutton.state & Button1Mask) + | (X_event.xbutton.state & Button2Mask ? 2 : 0) + | (X_event.xbutton.state & Button3Mask ? 4 : 0); + // suggest parentheses around arithmetic in operand of | + event.data1 = + event.data1 + ^ (X_event.xbutton.button == Button1 ? 1 : 0) + ^ (X_event.xbutton.button == Button2 ? 2 : 0) + ^ (X_event.xbutton.button == Button3 ? 4 : 0); + event.data2 = event.data3 = 0; + D_PostEvent(&event); + // fprintf(stderr, "bu"); + break; + case MotionNotify: + event.type = ev_mouse; + event.data1 = + (X_event.xmotion.state & Button1Mask) + | (X_event.xmotion.state & Button2Mask ? 2 : 0) + | (X_event.xmotion.state & Button3Mask ? 4 : 0); + event.data2 = (X_event.xmotion.x - lastmousex) << 2; + event.data3 = (lastmousey - X_event.xmotion.y) << 2; + + if (event.data2 || event.data3) + { + lastmousex = X_event.xmotion.x; + lastmousey = X_event.xmotion.y; + if (X_event.xmotion.x != X_width/2 && + X_event.xmotion.y != X_height/2) + { + D_PostEvent(&event); + // fprintf(stderr, "m"); + mousemoved = false; + } else + { + mousemoved = true; + } + } + break; + + case Expose: + case ConfigureNotify: + break; + + default: + if (doShm && X_event.type == X_shmeventtype) shmFinished = true; + break; + } + +} + +Cursor +createnullcursor +( Display* display, + Window root ) +{ + Pixmap cursormask; + XGCValues xgc; + GC gc; + XColor dummycolour; + Cursor cursor; + + cursormask = XCreatePixmap(display, root, 1, 1, 1/*depth*/); + xgc.function = GXclear; + gc = XCreateGC(display, cursormask, GCFunction, &xgc); + XFillRectangle(display, cursormask, gc, 0, 0, 1, 1); + dummycolour.pixel = 0; + dummycolour.red = 0; + dummycolour.flags = 04; + cursor = XCreatePixmapCursor(display, cursormask, cursormask, + &dummycolour,&dummycolour, 0,0); + XFreePixmap(display,cursormask); + XFreeGC(display,gc); + return cursor; +} + +// +// I_StartTic +// +void I_StartTic (void) +{ + + if (!X_display) + return; + + while (XPending(X_display)) + I_GetEvent(); + + // Warp the pointer back to the middle of the window + // or it will wander off - that is, the game will + // loose input focus within X11. + if (grabMouse) + { + if (!--doPointerWarp) + { + XWarpPointer( X_display, + None, + X_mainWindow, + 0, 0, + 0, 0, + X_width/2, X_height/2); + + doPointerWarp = POINTER_WARP_COUNTDOWN; + } + } + + mousemoved = false; + +} + + +// +// I_UpdateNoBlit +// +void I_UpdateNoBlit (void) +{ + // what is this? +} + +// +// I_FinishUpdate +// +void I_FinishUpdate (void) +{ + + static int lasttic; + int tics; + int i; + // UNUSED static unsigned char *bigscreen=0; + + // draws little dots on the bottom of the screen + if (devparm) + { + + i = I_GetTime(); + tics = i - lasttic; + lasttic = i; + if (tics > 20) tics = 20; + + for (i=0 ; i<tics*2 ; i+=2) + screens[0][ (SCREENHEIGHT-1)*SCREENWIDTH + i] = 0xff; + for ( ; i<20*2 ; i+=2) + screens[0][ (SCREENHEIGHT-1)*SCREENWIDTH + i] = 0x0; + + } + + // scales the screen size before blitting it + if (multiply == 2) + { + unsigned int *olineptrs[2]; + unsigned int *ilineptr; + int x, y, i; + unsigned int twoopixels; + unsigned int twomoreopixels; + unsigned int fouripixels; + + ilineptr = (unsigned int *) (screens[0]); + for (i=0 ; i<2 ; i++) + olineptrs[i] = (unsigned int *) &image->data[i*X_width]; + + y = SCREENHEIGHT; + while (y--) + { + x = SCREENWIDTH; + do + { + fouripixels = *ilineptr++; + twoopixels = (fouripixels & 0xff000000) + | ((fouripixels>>8) & 0xffff00) + | ((fouripixels>>16) & 0xff); + twomoreopixels = ((fouripixels<<16) & 0xff000000) + | ((fouripixels<<8) & 0xffff00) + | (fouripixels & 0xff); +#ifdef __BIG_ENDIAN__ + *olineptrs[0]++ = twoopixels; + *olineptrs[1]++ = twoopixels; + *olineptrs[0]++ = twomoreopixels; + *olineptrs[1]++ = twomoreopixels; +#else + *olineptrs[0]++ = twomoreopixels; + *olineptrs[1]++ = twomoreopixels; + *olineptrs[0]++ = twoopixels; + *olineptrs[1]++ = twoopixels; +#endif + } while (x-=4); + olineptrs[0] += X_width/4; + olineptrs[1] += X_width/4; + } + + } + else if (multiply == 3) + { + unsigned int *olineptrs[3]; + unsigned int *ilineptr; + int x, y, i; + unsigned int fouropixels[3]; + unsigned int fouripixels; + + ilineptr = (unsigned int *) (screens[0]); + for (i=0 ; i<3 ; i++) + olineptrs[i] = (unsigned int *) &image->data[i*X_width]; + + y = SCREENHEIGHT; + while (y--) + { + x = SCREENWIDTH; + do + { + fouripixels = *ilineptr++; + fouropixels[0] = (fouripixels & 0xff000000) + | ((fouripixels>>8) & 0xff0000) + | ((fouripixels>>16) & 0xffff); + fouropixels[1] = ((fouripixels<<8) & 0xff000000) + | (fouripixels & 0xffff00) + | ((fouripixels>>8) & 0xff); + fouropixels[2] = ((fouripixels<<16) & 0xffff0000) + | ((fouripixels<<8) & 0xff00) + | (fouripixels & 0xff); +#ifdef __BIG_ENDIAN__ + *olineptrs[0]++ = fouropixels[0]; + *olineptrs[1]++ = fouropixels[0]; + *olineptrs[2]++ = fouropixels[0]; + *olineptrs[0]++ = fouropixels[1]; + *olineptrs[1]++ = fouropixels[1]; + *olineptrs[2]++ = fouropixels[1]; + *olineptrs[0]++ = fouropixels[2]; + *olineptrs[1]++ = fouropixels[2]; + *olineptrs[2]++ = fouropixels[2]; +#else + *olineptrs[0]++ = fouropixels[2]; + *olineptrs[1]++ = fouropixels[2]; + *olineptrs[2]++ = fouropixels[2]; + *olineptrs[0]++ = fouropixels[1]; + *olineptrs[1]++ = fouropixels[1]; + *olineptrs[2]++ = fouropixels[1]; + *olineptrs[0]++ = fouropixels[0]; + *olineptrs[1]++ = fouropixels[0]; + *olineptrs[2]++ = fouropixels[0]; +#endif + } while (x-=4); + olineptrs[0] += 2*X_width/4; + olineptrs[1] += 2*X_width/4; + olineptrs[2] += 2*X_width/4; + } + + } + else if (multiply == 4) + { + // Broken. Gotta fix this some day. + void Expand4(unsigned *, double *); + Expand4 ((unsigned *)(screens[0]), (double *) (image->data)); + } + + if (doShm) + { + + if (!XShmPutImage( X_display, + X_mainWindow, + X_gc, + image, + 0, 0, + 0, 0, + X_width, X_height, + True )) + I_Error("XShmPutImage() failed\n"); + + // wait for it to finish and processes all input events + shmFinished = false; + do + { + I_GetEvent(); + } while (!shmFinished); + + } + else + { + + // draw the image + XPutImage( X_display, + X_mainWindow, + X_gc, + image, + 0, 0, + 0, 0, + X_width, X_height ); + + // sync up with server + XSync(X_display, False); + + } + +} + + +// +// I_ReadScreen +// +void I_ReadScreen (byte* scr) +{ + memcpy (scr, screens[0], SCREENWIDTH*SCREENHEIGHT); +} + + +// +// Palette stuff. +// +static XColor colors[256]; + +void UploadNewPalette(Colormap cmap, byte *palette) +{ + + register int i; + register int c; + static boolean firstcall = true; + +#ifdef __cplusplus + if (X_visualinfo.c_class == PseudoColor && X_visualinfo.depth == 8) +#else + if (X_visualinfo.class == PseudoColor && X_visualinfo.depth == 8) +#endif + { + // initialize the colormap + if (firstcall) + { + firstcall = false; + for (i=0 ; i<256 ; i++) + { + colors[i].pixel = i; + colors[i].flags = DoRed|DoGreen|DoBlue; + } + } + + // set the X colormap entries + for (i=0 ; i<256 ; i++) + { + c = gammatable[usegamma][*palette++]; + colors[i].red = (c<<8) + c; + c = gammatable[usegamma][*palette++]; + colors[i].green = (c<<8) + c; + c = gammatable[usegamma][*palette++]; + colors[i].blue = (c<<8) + c; + } + + // store the colors to the current colormap + XStoreColors(X_display, cmap, colors, 256); + + } +} + +// +// I_SetPalette +// +void I_SetPalette (byte* palette) +{ + UploadNewPalette(X_cmap, palette); +} + + +// +// This function is probably redundant, +// if XShmDetach works properly. +// ddt never detached the XShm memory, +// thus there might have been stale +// handles accumulating. +// +void grabsharedmemory(int size) +{ + + int key = ('d'<<24) | ('o'<<16) | ('o'<<8) | 'm'; + struct shmid_ds shminfo; + int minsize = 320*200; + int id; + int rc; + // UNUSED int done=0; + int pollution=5; + + // try to use what was here before + do + { + id = shmget((key_t) key, minsize, 0777); // just get the id + if (id != -1) + { + rc=shmctl(id, IPC_STAT, &shminfo); // get stats on it + if (!rc) + { + if (shminfo.shm_nattch) + { + fprintf(stderr, "User %d appears to be running " + "DOOM. Is that wise?\n", shminfo.shm_cpid); + key++; + } + else + { + if (getuid() == shminfo.shm_perm.cuid) + { + rc = shmctl(id, IPC_RMID, 0); + if (!rc) + fprintf(stderr, + "Was able to kill my old shared memory\n"); + else + I_Error("Was NOT able to kill my old shared memory"); + + id = shmget((key_t)key, size, IPC_CREAT|0777); + if (id==-1) + I_Error("Could not get shared memory"); + + rc=shmctl(id, IPC_STAT, &shminfo); + + break; + + } + if (size >= shminfo.shm_segsz) + { + fprintf(stderr, + "will use %d's stale shared memory\n", + shminfo.shm_cpid); + break; + } + else + { + fprintf(stderr, + "warning: can't use stale " + "shared memory belonging to id %d, " + "key=0x%x\n", + shminfo.shm_cpid, key); + key++; + } + } + } + else + { + I_Error("could not get stats on key=%d", key); + } + } + else + { + id = shmget((key_t)key, size, IPC_CREAT|0777); + if (id==-1) + { + extern int errno; + fprintf(stderr, "errno=%d\n", errno); + I_Error("Could not get any shared memory"); + } + break; + } + } while (--pollution); + + if (!pollution) + { + I_Error("Sorry, system too polluted with stale " + "shared memory segments.\n"); + } + + X_shminfo.shmid = id; + + // attach to the shared memory segment + image->data = X_shminfo.shmaddr = shmat(id, 0, 0); + + fprintf(stderr, "shared memory id=%d, addr=0x%x\n", id, + (int) (image->data)); +} + +void I_InitGraphics(void) +{ + + char* displayname; + char* d; + int n; + int pnum; + int x=0; + int y=0; + + // warning: char format, different type arg + char xsign=' '; + char ysign=' '; + + int oktodraw; + unsigned long attribmask; + XSetWindowAttributes attribs; + XGCValues xgcvalues; + int valuemask; + static int firsttime=1; + + if (!firsttime) + return; + firsttime = 0; + + signal(SIGINT, (void (*)(int)) I_Quit); + + if (M_CheckParm("-2")) + multiply = 2; + + if (M_CheckParm("-3")) + multiply = 3; + + if (M_CheckParm("-4")) + multiply = 4; + + X_width = SCREENWIDTH * multiply; + X_height = SCREENHEIGHT * multiply; + + // check for command-line display name + if ( (pnum=M_CheckParm("-disp")) ) // suggest parentheses around assignment + displayname = myargv[pnum+1]; + else + displayname = 0; + + // check if the user wants to grab the mouse (quite unnice) + grabMouse = !!M_CheckParm("-grabmouse"); + + // check for command-line geometry + if ( (pnum=M_CheckParm("-geom")) ) // suggest parentheses around assignment + { + // warning: char format, different type arg 3,5 + n = sscanf(myargv[pnum+1], "%c%d%c%d", &xsign, &x, &ysign, &y); + + if (n==2) + x = y = 0; + else if (n==6) + { + if (xsign == '-') + x = -x; + if (ysign == '-') + y = -y; + } + else + I_Error("bad -geom parameter"); + } + + // open the display + X_display = XOpenDisplay(displayname); + if (!X_display) + { + if (displayname) + I_Error("Could not open display [%s]", displayname); + else + I_Error("Could not open display (DISPLAY=[%s])", getenv("DISPLAY")); + } + + // use the default visual + X_screen = DefaultScreen(X_display); + if (!XMatchVisualInfo(X_display, X_screen, 8, PseudoColor, &X_visualinfo)) + I_Error("xdoom currently only supports 256-color PseudoColor screens"); + X_visual = X_visualinfo.visual; + + // check for the MITSHM extension + doShm = XShmQueryExtension(X_display); + + // even if it's available, make sure it's a local connection + if (doShm) + { + if (!displayname) displayname = (char *) getenv("DISPLAY"); + if (displayname) + { + d = displayname; + while (*d && (*d != ':')) d++; + if (*d) *d = 0; + if (!(!strcasecmp(displayname, "unix") || !*displayname)) doShm = false; + } + } + + fprintf(stderr, "Using MITSHM extension\n"); + + // create the colormap + X_cmap = XCreateColormap(X_display, RootWindow(X_display, + X_screen), X_visual, AllocAll); + + // setup attributes for main window + attribmask = CWEventMask | CWColormap | CWBorderPixel; + attribs.event_mask = + KeyPressMask + | KeyReleaseMask + // | PointerMotionMask | ButtonPressMask | ButtonReleaseMask + | ExposureMask; + + attribs.colormap = X_cmap; + attribs.border_pixel = 0; + + // create the main window + X_mainWindow = XCreateWindow( X_display, + RootWindow(X_display, X_screen), + x, y, + X_width, X_height, + 0, // borderwidth + 8, // depth + InputOutput, + X_visual, + attribmask, + &attribs ); + + XDefineCursor(X_display, X_mainWindow, + createnullcursor( X_display, X_mainWindow ) ); + + // create the GC + valuemask = GCGraphicsExposures; + xgcvalues.graphics_exposures = False; + X_gc = XCreateGC( X_display, + X_mainWindow, + valuemask, + &xgcvalues ); + + // map the window + XMapWindow(X_display, X_mainWindow); + + // wait until it is OK to draw + oktodraw = 0; + while (!oktodraw) + { + XNextEvent(X_display, &X_event); + if (X_event.type == Expose + && !X_event.xexpose.count) + { + oktodraw = 1; + } + } + + // grabs the pointer so it is restricted to this window + if (grabMouse) + XGrabPointer(X_display, X_mainWindow, True, + ButtonPressMask|ButtonReleaseMask|PointerMotionMask, + GrabModeAsync, GrabModeAsync, + X_mainWindow, None, CurrentTime); + + if (doShm) + { + + X_shmeventtype = XShmGetEventBase(X_display) + ShmCompletion; + + // create the image + image = XShmCreateImage( X_display, + X_visual, + 8, + ZPixmap, + 0, + &X_shminfo, + X_width, + X_height ); + + grabsharedmemory(image->bytes_per_line * image->height); + + + // UNUSED + // create the shared memory segment + // X_shminfo.shmid = shmget (IPC_PRIVATE, + // image->bytes_per_line * image->height, IPC_CREAT | 0777); + // if (X_shminfo.shmid < 0) + // { + // perror(""); + // I_Error("shmget() failed in InitGraphics()"); + // } + // fprintf(stderr, "shared memory id=%d\n", X_shminfo.shmid); + // attach to the shared memory segment + // image->data = X_shminfo.shmaddr = shmat(X_shminfo.shmid, 0, 0); + + + if (!image->data) + { + perror(""); + I_Error("shmat() failed in InitGraphics()"); + } + + // get the X server to attach to it + if (!XShmAttach(X_display, &X_shminfo)) + I_Error("XShmAttach() failed in InitGraphics()"); + + } + else + { + image = XCreateImage( X_display, + X_visual, + 8, + ZPixmap, + 0, + (char*)malloc(X_width * X_height), + X_width, X_height, + 8, + X_width ); + + } + + if (multiply == 1) + screens[0] = (unsigned char *) (image->data); + else + screens[0] = (unsigned char *) malloc (SCREENWIDTH * SCREENHEIGHT); + +} + + +unsigned exptable[256]; + +void InitExpand (void) +{ + int i; + + for (i=0 ; i<256 ; i++) + exptable[i] = i | (i<<8) | (i<<16) | (i<<24); +} + +double exptable2[256*256]; + +void InitExpand2 (void) +{ + int i; + int j; + // UNUSED unsigned iexp, jexp; + double* exp; + union + { + double d; + unsigned u[2]; + } pixel; + + printf ("building exptable2...\n"); + exp = exptable2; + for (i=0 ; i<256 ; i++) + { + pixel.u[0] = i | (i<<8) | (i<<16) | (i<<24); + for (j=0 ; j<256 ; j++) + { + pixel.u[1] = j | (j<<8) | (j<<16) | (j<<24); + *exp++ = pixel.d; + } + } + printf ("done.\n"); +} + +int inited; + +void +Expand4 +( unsigned* lineptr, + double* xline ) +{ + double dpixel; + unsigned x; + unsigned y; + unsigned fourpixels; + unsigned step; + double* exp; + + exp = exptable2; + if (!inited) + { + inited = 1; + InitExpand2 (); + } + + + step = 3*SCREENWIDTH/2; + + y = SCREENHEIGHT-1; + do + { + x = SCREENWIDTH; + + do + { + fourpixels = lineptr[0]; + + dpixel = *(double *)( (int)exp + ( (fourpixels&0xffff0000)>>13) ); + xline[0] = dpixel; + xline[160] = dpixel; + xline[320] = dpixel; + xline[480] = dpixel; + + dpixel = *(double *)( (int)exp + ( (fourpixels&0xffff)<<3 ) ); + xline[1] = dpixel; + xline[161] = dpixel; + xline[321] = dpixel; + xline[481] = dpixel; + + fourpixels = lineptr[1]; + + dpixel = *(double *)( (int)exp + ( (fourpixels&0xffff0000)>>13) ); + xline[2] = dpixel; + xline[162] = dpixel; + xline[322] = dpixel; + xline[482] = dpixel; + + dpixel = *(double *)( (int)exp + ( (fourpixels&0xffff)<<3 ) ); + xline[3] = dpixel; + xline[163] = dpixel; + xline[323] = dpixel; + xline[483] = dpixel; + + fourpixels = lineptr[2]; + + dpixel = *(double *)( (int)exp + ( (fourpixels&0xffff0000)>>13) ); + xline[4] = dpixel; + xline[164] = dpixel; + xline[324] = dpixel; + xline[484] = dpixel; + + dpixel = *(double *)( (int)exp + ( (fourpixels&0xffff)<<3 ) ); + xline[5] = dpixel; + xline[165] = dpixel; + xline[325] = dpixel; + xline[485] = dpixel; + + fourpixels = lineptr[3]; + + dpixel = *(double *)( (int)exp + ( (fourpixels&0xffff0000)>>13) ); + xline[6] = dpixel; + xline[166] = dpixel; + xline[326] = dpixel; + xline[486] = dpixel; + + dpixel = *(double *)( (int)exp + ( (fourpixels&0xffff)<<3 ) ); + xline[7] = dpixel; + xline[167] = dpixel; + xline[327] = dpixel; + xline[487] = dpixel; + + lineptr+=4; + xline+=8; + } while (x-=16); + xline += step; + } while (y--); +} + + diff --git a/linuxdoom-1.10/i_video.h b/src/i_video.h diff --git a/linuxdoom-1.10/info.c b/src/info.c diff --git a/linuxdoom-1.10/info.h b/src/info.h diff --git a/linuxdoom-1.10/m_argv.c b/src/m_argv.c diff --git a/linuxdoom-1.10/m_argv.h b/src/m_argv.h diff --git a/linuxdoom-1.10/m_bbox.c b/src/m_bbox.c diff --git a/linuxdoom-1.10/m_bbox.h b/src/m_bbox.h diff --git a/linuxdoom-1.10/m_cheat.c b/src/m_cheat.c diff --git a/linuxdoom-1.10/m_cheat.h b/src/m_cheat.h diff --git a/linuxdoom-1.10/m_fixed.c b/src/m_fixed.c diff --git a/linuxdoom-1.10/m_fixed.h b/src/m_fixed.h diff --git a/linuxdoom-1.10/m_menu.c b/src/m_menu.c diff --git a/linuxdoom-1.10/m_menu.h b/src/m_menu.h diff --git a/linuxdoom-1.10/m_misc.c b/src/m_misc.c diff --git a/linuxdoom-1.10/m_misc.h b/src/m_misc.h diff --git a/linuxdoom-1.10/m_random.c b/src/m_random.c diff --git a/linuxdoom-1.10/m_random.h b/src/m_random.h diff --git a/linuxdoom-1.10/m_swap.c b/src/m_swap.c diff --git a/linuxdoom-1.10/m_swap.h b/src/m_swap.h diff --git a/linuxdoom-1.10/p_ceilng.c b/src/p_ceilng.c diff --git a/linuxdoom-1.10/p_doors.c b/src/p_doors.c diff --git a/linuxdoom-1.10/p_enemy.c b/src/p_enemy.c diff --git a/linuxdoom-1.10/p_floor.c b/src/p_floor.c diff --git a/linuxdoom-1.10/p_inter.c b/src/p_inter.c diff --git a/linuxdoom-1.10/p_inter.h b/src/p_inter.h diff --git a/linuxdoom-1.10/p_lights.c b/src/p_lights.c diff --git a/linuxdoom-1.10/p_local.h b/src/p_local.h diff --git a/linuxdoom-1.10/p_map.c b/src/p_map.c diff --git a/linuxdoom-1.10/p_maputl.c b/src/p_maputl.c diff --git a/linuxdoom-1.10/p_mobj.c b/src/p_mobj.c diff --git a/linuxdoom-1.10/p_mobj.h b/src/p_mobj.h diff --git a/linuxdoom-1.10/p_plats.c b/src/p_plats.c diff --git a/linuxdoom-1.10/p_pspr.c b/src/p_pspr.c diff --git a/linuxdoom-1.10/p_pspr.h b/src/p_pspr.h diff --git a/linuxdoom-1.10/p_saveg.c b/src/p_saveg.c diff --git a/linuxdoom-1.10/p_saveg.h b/src/p_saveg.h diff --git a/linuxdoom-1.10/p_setup.c b/src/p_setup.c diff --git a/linuxdoom-1.10/p_setup.h b/src/p_setup.h diff --git a/linuxdoom-1.10/p_sight.c b/src/p_sight.c diff --git a/linuxdoom-1.10/p_spec.c b/src/p_spec.c diff --git a/linuxdoom-1.10/p_spec.h b/src/p_spec.h diff --git a/linuxdoom-1.10/p_switch.c b/src/p_switch.c diff --git a/linuxdoom-1.10/p_telept.c b/src/p_telept.c diff --git a/linuxdoom-1.10/p_tick.c b/src/p_tick.c diff --git a/linuxdoom-1.10/p_tick.h b/src/p_tick.h diff --git a/linuxdoom-1.10/p_user.c b/src/p_user.c diff --git a/linuxdoom-1.10/r_bsp.c b/src/r_bsp.c diff --git a/linuxdoom-1.10/r_bsp.h b/src/r_bsp.h diff --git a/linuxdoom-1.10/r_data.c b/src/r_data.c diff --git a/linuxdoom-1.10/r_data.h b/src/r_data.h diff --git a/linuxdoom-1.10/r_defs.h b/src/r_defs.h diff --git a/linuxdoom-1.10/r_draw.c b/src/r_draw.c diff --git a/linuxdoom-1.10/r_draw.h b/src/r_draw.h diff --git a/linuxdoom-1.10/r_local.h b/src/r_local.h diff --git a/linuxdoom-1.10/r_main.c b/src/r_main.c diff --git a/linuxdoom-1.10/r_main.h b/src/r_main.h diff --git a/linuxdoom-1.10/r_plane.c b/src/r_plane.c diff --git a/linuxdoom-1.10/r_plane.h b/src/r_plane.h diff --git a/linuxdoom-1.10/r_segs.c b/src/r_segs.c diff --git a/linuxdoom-1.10/r_segs.h b/src/r_segs.h diff --git a/linuxdoom-1.10/r_sky.c b/src/r_sky.c diff --git a/linuxdoom-1.10/r_sky.h b/src/r_sky.h diff --git a/linuxdoom-1.10/r_state.h b/src/r_state.h diff --git a/linuxdoom-1.10/r_things.c b/src/r_things.c diff --git a/linuxdoom-1.10/r_things.h b/src/r_things.h diff --git a/linuxdoom-1.10/s_sound.c b/src/s_sound.c diff --git a/linuxdoom-1.10/s_sound.h b/src/s_sound.h diff --git a/linuxdoom-1.10/sounds.c b/src/sounds.c diff --git a/linuxdoom-1.10/sounds.h b/src/sounds.h diff --git a/linuxdoom-1.10/st_lib.c b/src/st_lib.c diff --git a/linuxdoom-1.10/st_lib.h b/src/st_lib.h diff --git a/linuxdoom-1.10/st_stuff.c b/src/st_stuff.c diff --git a/linuxdoom-1.10/st_stuff.h b/src/st_stuff.h diff --git a/linuxdoom-1.10/tables.c b/src/tables.c diff --git a/linuxdoom-1.10/tables.h b/src/tables.h diff --git a/src/update b/src/update diff --git a/linuxdoom-1.10/v_video.c b/src/v_video.c diff --git a/linuxdoom-1.10/v_video.h b/src/v_video.h diff --git a/linuxdoom-1.10/w_wad.c b/src/w_wad.c diff --git a/linuxdoom-1.10/w_wad.h b/src/w_wad.h diff --git a/linuxdoom-1.10/wi_stuff.c b/src/wi_stuff.c diff --git a/linuxdoom-1.10/wi_stuff.h b/src/wi_stuff.h diff --git a/linuxdoom-1.10/z_zone.c b/src/z_zone.c diff --git a/linuxdoom-1.10/z_zone.h b/src/z_zone.h