├── doomsav0.dsg ├── ps2doom.h ├── ps2doom.c ├── configure.in ├── README.PS2 ├── README.SDL ├── README.md ├── mkinstalldirs ├── Makefile.ps2 ├── p_inter.h ├── doomdef.c ├── i_main.c ├── config.cache ├── r_segs.h ├── config.log ├── i_net.h ├── m_argv.h ├── p_tick.h ├── doomstat.c ├── m_random.h ├── p_setup.h ├── d_textur.h ├── f_finale.h ├── r_sky.h ├── m_swap.c ├── m_argv.c ├── m_bbox.h ├── m_fixed.h ├── d_items.h ├── m_misc.h ├── m_cheat.h ├── p_saveg.h ├── wi_stuff.h ├── m_bbox.c ├── r_local.h ├── am_map.h ├── m_swap.h ├── d_ticcmd.h ├── d_main.h ├── r_sky.c ├── dstrings.h ├── i_video.h ├── f_wipe.h ├── r_data.h ├── hu_stuff.h ├── m_menu.h ├── r_bsp.h ├── m_fixed.c ├── r_plane.h ├── d_think.h ├── w_wad.h ├── r_things.h ├── p_pspr.h ├── g_game.h ├── st_stuff.h ├── doomtype.h ├── README.book ├── m_cheat.c ├── dstrings.c ├── tables.h ├── Makefile.am ├── s_sound.h ├── v_video.h ├── d_items.c ├── z_zone.h ├── m_random.c ├── i_system.h ├── i_sound.h ├── d_event.h ├── r_draw.h ├── r_state.h ├── p_telept.c ├── p_tick.c ├── i_system.c ├── d_net.h ├── r_main.h ├── TODO ├── README.b ├── st_lib.h ├── hu_lib.h ├── d_player.h ├── DOOMLIC.TXT ├── doomdata.h ├── config.status ├── st_lib.c ├── sounds.h ├── FILES ├── acinclude.m4 ├── f_wipe.c └── install-sh /doomsav0.dsg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lukaszdk/ps2doom/HEAD/doomsav0.dsg -------------------------------------------------------------------------------- /ps2doom.h: -------------------------------------------------------------------------------- 1 | #ifndef _PS2DOOM_H_ 2 | #define _PS2DOOM_H_ 3 | 4 | #include 5 | 6 | 7 | 8 | int gethostname(char *name, int len); 9 | u32 inet_addr(const char *cp); 10 | 11 | float pow(float a, float b); 12 | 13 | // void setbuf ( FILE * stream, char * buffer ); 14 | 15 | #endif 16 | 17 | -------------------------------------------------------------------------------- /ps2doom.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | 5 | int gethostname(char *name, int len) 6 | { 7 | 8 | return -1; 9 | } 10 | 11 | u32 inet_addr(const char *cp) 12 | { 13 | return 0; 14 | } 15 | 16 | float pow(float a, float b) 17 | { 18 | return powf(a,b); 19 | } 20 | 21 | int setbuf ( FILE * stream, char * buffer ) 22 | { 23 | 24 | return 0; 25 | } 26 | -------------------------------------------------------------------------------- /configure.in: -------------------------------------------------------------------------------- 1 | dnl Process this file with autoconf to produce a configure script. 2 | AC_INIT(README.b) 3 | 4 | dnl Setup for automake 5 | AM_INIT_AUTOMAKE(sdldoom, 1.10) 6 | 7 | dnl Check for tools 8 | 9 | AC_PROG_MAKE_SET 10 | AC_PROG_CC 11 | AC_PROG_INSTALL 12 | 13 | dnl Check for SDL 14 | SDL_VERSION=1.0.1 15 | AM_PATH_SDL($SDL_VERSION, 16 | :, 17 | AC_MSG_ERROR([*** SDL version $SDL_VERSION not found!]) 18 | ) 19 | CFLAGS="$CFLAGS $SDL_CFLAGS" 20 | LIBS="$LIBS $SDL_LIBS" 21 | 22 | # Finally create all the generated files 23 | AC_OUTPUT([ 24 | Makefile 25 | ]) 26 | -------------------------------------------------------------------------------- /README.PS2: -------------------------------------------------------------------------------- 1 | Quick PlayStation 2 port by Lukasz Bruun www.lukasz.dk - 11.02.2008 2 | 3 | Requires PS2SDK, gsKit and SDL from svn.ps2dev.org to compile. 4 | 5 | Build with: make -f Makefile.ps2 6 | 7 | Some very hackish stuff in w_wad.c / W_ReadLump function, to speed up loading, 8 | which will probably break loading from multiple files. 9 | 10 | Controls: 11 | 12 | Left Analog Stick : Move 13 | Cross : Enter 14 | Square/R1 : CTRL / Fire 15 | Circle/R2 : Space / Open doors 16 | Triangle : Escape 17 | L1 : x 18 | L2 : y 19 | 20 | L1 and L2 are for entering savegame names. 21 | -------------------------------------------------------------------------------- /README.SDL: -------------------------------------------------------------------------------- 1 | 2 | Simple DirectMedia Library: 3 | 4 | This is a quick and dirty port of DOOM to the SDL library. 5 | The only thing that is system dependent really is the endianness detection 6 | 7 | It was very simple, and only took an afternoon, thanks to the efforts 8 | of all those folks who have ported this game to everything but the toaster. :) 9 | 10 | Here's the web page for my library: 11 | http://www.devolution.com/~slouken/SDL/ 12 | 13 | Thanks go to all those involved in the DOOM game. ID Software comes to mind. :) 14 | 15 | Note the addition of a "-fullscreen" command line option. 16 | 17 | See ya! 18 | -Sam Lantinga (slouken@devolution.com) 19 | 20 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | PS2 Doom 2 | ======== 3 | 4 | Quick PlayStation 2 port - More information available at my [website](http://lukasz.dk/2008/02/11/doom-playstation-2-port/) 5 | 6 | Requires PS2SDK, gsKit and SDL for PS2 to compile. 7 | 8 | Build with: make -f Makefile.ps2 9 | 10 | Some very hackish stuff in w_wad.c / W_ReadLump function, to speed up loading, 11 | which will probably break loading from multiple files. 12 | 13 | Controls: 14 | 15 | Left Analog Stick : Move 16 | Cross : Enter 17 | Square/R1 : CTRL / Fire 18 | Circle/R2 : Space / Open doors 19 | Triangle : Escape 20 | L1 : x 21 | L2 : y 22 | 23 | L1 and L2 are for entering savegame names. 24 | 25 | -------------------------------------------------------------------------------- /mkinstalldirs: -------------------------------------------------------------------------------- 1 | #! /bin/sh 2 | # mkinstalldirs --- make directory hierarchy 3 | # Author: Noah Friedman 4 | # Created: 1993-05-16 5 | # Public domain 6 | 7 | # $Id: mkinstalldirs,v 1.13 1999/01/05 03:18:55 bje Exp $ 8 | 9 | errstatus=0 10 | 11 | for file 12 | do 13 | set fnord `echo ":$file" | sed -ne 's/^:\//#/;s/^://;s/\// /g;s/^#/\//;p'` 14 | shift 15 | 16 | pathcomp= 17 | for d 18 | do 19 | pathcomp="$pathcomp$d" 20 | case "$pathcomp" in 21 | -* ) pathcomp=./$pathcomp ;; 22 | esac 23 | 24 | if test ! -d "$pathcomp"; then 25 | echo "mkdir $pathcomp" 26 | 27 | mkdir "$pathcomp" || lasterr=$? 28 | 29 | if test ! -d "$pathcomp"; then 30 | errstatus=$lasterr 31 | fi 32 | fi 33 | 34 | pathcomp="$pathcomp/" 35 | done 36 | done 37 | 38 | exit $errstatus 39 | 40 | # mkinstalldirs ends here 41 | -------------------------------------------------------------------------------- /Makefile.ps2: -------------------------------------------------------------------------------- 1 | 2 | EE_OBJS = am_map.o d_items.o d_main.o d_net.o doomdef.o doomstat.o \ 3 | dstrings.o f_finale.o f_wipe.o g_game.o hu_lib.o hu_stuff.o i_main.o \ 4 | i_net.o i_sound.o i_system.o i_video.o info.o m_argv.o m_bbox.o \ 5 | m_cheat.o m_fixed.o m_menu.o m_misc.o m_random.o m_swap.o p_ceilng.o \ 6 | p_doors.o p_enemy.o p_floor.o p_inter.o p_lights.o p_map.o p_maputl.o \ 7 | p_mobj.o p_plats.o p_pspr.o p_saveg.o p_setup.o p_sight.o p_spec.o \ 8 | p_switch.o p_telept.o p_tick.o p_user.o r_bsp.o r_data.o r_draw.o \ 9 | r_main.o r_plane.o r_segs.o r_sky.o r_things.o s_sound.o sounds.o \ 10 | st_lib.o st_stuff.o tables.o v_video.o w_wad.o wi_stuff.o z_zone.o ps2doom.o 11 | 12 | EE_BIN = doom.elf 13 | 14 | EE_INCS = -I$(PS2SDK)/ports/include/SDL 15 | EE_LDFLAGS = -L$(PS2SDK)/ports/lib -L$(PS2DEV)/gsKit/lib 16 | EE_LIBS = -lsdlmain -lsdl -lgskit -lcdvd -lmf -lps2ip 17 | 18 | all: $(EE_BIN) 19 | 20 | clean: 21 | rm -f $(EE_OBJS) $(EE_BIN) 22 | 23 | run: 24 | ps2client execee host:$(EE_BIN) 25 | 26 | reset: 27 | ps2client reset 28 | 29 | include $(PS2SDK)/samples/Makefile.pref 30 | include $(PS2SDK)/samples/Makefile.eeglobal 31 | 32 | -------------------------------------------------------------------------------- /p_inter.h: -------------------------------------------------------------------------------- 1 | // Emacs style mode select -*- C++ -*- 2 | //----------------------------------------------------------------------------- 3 | // 4 | // $Id:$ 5 | // 6 | // Copyright (C) 1993-1996 by id Software, Inc. 7 | // 8 | // This source is available for distribution and/or modification 9 | // only under the terms of the DOOM Source Code License as 10 | // published by id Software. All rights reserved. 11 | // 12 | // The source is distributed in the hope that it will be useful, 13 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | // FITNESS FOR A PARTICULAR PURPOSE. See the DOOM Source Code License 15 | // for more details. 16 | // 17 | // DESCRIPTION: 18 | // 19 | // 20 | //----------------------------------------------------------------------------- 21 | 22 | 23 | #ifndef __P_INTER__ 24 | #define __P_INTER__ 25 | 26 | 27 | #ifdef __GNUG__ 28 | #pragma interface 29 | #endif 30 | 31 | 32 | boolean P_GivePower(player_t*, int); 33 | 34 | 35 | 36 | #endif 37 | //----------------------------------------------------------------------------- 38 | // 39 | // $Log:$ 40 | // 41 | //----------------------------------------------------------------------------- 42 | -------------------------------------------------------------------------------- /doomdef.c: -------------------------------------------------------------------------------- 1 | // Emacs style mode select -*- C++ -*- 2 | //----------------------------------------------------------------------------- 3 | // 4 | // $Id:$ 5 | // 6 | // Copyright (C) 1993-1996 by id Software, Inc. 7 | // 8 | // This source is available for distribution and/or modification 9 | // only under the terms of the DOOM Source Code License as 10 | // published by id Software. All rights reserved. 11 | // 12 | // The source is distributed in the hope that it will be useful, 13 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | // FITNESS FOR A PARTICULAR PURPOSE. See the DOOM Source Code License 15 | // for more details. 16 | // 17 | // $Log:$ 18 | // 19 | // DESCRIPTION: 20 | // DoomDef - basic defines for DOOM, e.g. Version, game mode 21 | // and skill level, and display parameters. 22 | // 23 | //----------------------------------------------------------------------------- 24 | 25 | static const char 26 | rcsid[] = "$Id: m_bbox.c,v 1.1 1997/02/03 22:45:10 b1 Exp $"; 27 | 28 | 29 | #ifdef __GNUG__ 30 | #pragma implementation "doomdef.h" 31 | #endif 32 | #include "doomdef.h" 33 | 34 | // Location for any defines turned variables. 35 | 36 | // None. 37 | 38 | 39 | -------------------------------------------------------------------------------- /i_main.c: -------------------------------------------------------------------------------- 1 | // Emacs style mode select -*- C++ -*- 2 | //----------------------------------------------------------------------------- 3 | // 4 | // $Id:$ 5 | // 6 | // Copyright (C) 1993-1996 by id Software, Inc. 7 | // 8 | // This source is available for distribution and/or modification 9 | // only under the terms of the DOOM Source Code License as 10 | // published by id Software. All rights reserved. 11 | // 12 | // The source is distributed in the hope that it will be useful, 13 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | // FITNESS FOR A PARTICULAR PURPOSE. See the DOOM Source Code License 15 | // for more details. 16 | // 17 | // $Log:$ 18 | // 19 | // DESCRIPTION: 20 | // Main program, simply calls D_DoomMain high level loop. 21 | // 22 | //----------------------------------------------------------------------------- 23 | 24 | static const char 25 | rcsid[] = "$Id: i_main.c,v 1.4 1997/02/03 22:45:10 b1 Exp $"; 26 | 27 | 28 | #include "SDL.h" 29 | 30 | #include "doomdef.h" 31 | 32 | #include "m_argv.h" 33 | #include "d_main.h" 34 | 35 | int 36 | main 37 | ( int argc, 38 | char** argv ) 39 | { 40 | myargc = argc; 41 | myargv = argv; 42 | 43 | D_DoomMain (); 44 | 45 | return 0; 46 | } 47 | -------------------------------------------------------------------------------- /config.cache: -------------------------------------------------------------------------------- 1 | # This file is a shell script that caches the results of configure 2 | # tests run on this system so they can be shared between configure 3 | # scripts and configure runs. It is not useful on other systems. 4 | # If it contains results you don't want to keep, you may remove or edit it. 5 | # 6 | # By default, configure uses ./config.cache as the cache file, 7 | # creating it if it does not exist already. You can give configure 8 | # the --cache-file=FILE option to use a different cache file; that is 9 | # what configure does when it calls configure scripts in 10 | # subdirectories, so they share the cache. 11 | # Giving --cache-file=/dev/null disables caching, for debugging configure. 12 | # config.status only pays attention to the cache file if you give it the 13 | # --recheck option to rerun configure. 14 | # 15 | ac_cv_path_SDL_CONFIG=${ac_cv_path_SDL_CONFIG='/usr/bin/sdl-config'} 16 | ac_cv_path_install=${ac_cv_path_install='/usr/bin/install -c'} 17 | ac_cv_prog_CC=${ac_cv_prog_CC='gcc'} 18 | ac_cv_prog_cc_cross=${ac_cv_prog_cc_cross='no'} 19 | ac_cv_prog_cc_g=${ac_cv_prog_cc_g='yes'} 20 | ac_cv_prog_cc_works=${ac_cv_prog_cc_works='yes'} 21 | ac_cv_prog_gcc=${ac_cv_prog_gcc='yes'} 22 | ac_cv_prog_make_make_set=${ac_cv_prog_make_make_set='yes'} 23 | -------------------------------------------------------------------------------- /r_segs.h: -------------------------------------------------------------------------------- 1 | // Emacs style mode select -*- C++ -*- 2 | //----------------------------------------------------------------------------- 3 | // 4 | // $Id:$ 5 | // 6 | // Copyright (C) 1993-1996 by id Software, Inc. 7 | // 8 | // This source is available for distribution and/or modification 9 | // only under the terms of the DOOM Source Code License as 10 | // published by id Software. All rights reserved. 11 | // 12 | // The source is distributed in the hope that it will be useful, 13 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | // FITNESS FOR A PARTICULAR PURPOSE. See the DOOM Source Code License 15 | // for more details. 16 | // 17 | // DESCRIPTION: 18 | // Refresh module, drawing LineSegs from BSP. 19 | // 20 | //----------------------------------------------------------------------------- 21 | 22 | 23 | #ifndef __R_SEGS__ 24 | #define __R_SEGS__ 25 | 26 | 27 | #ifdef __GNUG__ 28 | #pragma interface 29 | #endif 30 | 31 | 32 | void 33 | R_RenderMaskedSegRange 34 | ( drawseg_t* ds, 35 | int x1, 36 | int x2 ); 37 | 38 | 39 | #endif 40 | //----------------------------------------------------------------------------- 41 | // 42 | // $Log:$ 43 | // 44 | //----------------------------------------------------------------------------- 45 | -------------------------------------------------------------------------------- /config.log: -------------------------------------------------------------------------------- 1 | This file contains any messages produced by compilers while 2 | running configure, to aid debugging if configure makes a mistake. 3 | 4 | configure:563: checking for a BSD compatible install 5 | configure:616: checking whether build environment is sane 6 | configure:673: checking whether make sets ${MAKE} 7 | configure:719: checking for working aclocal 8 | configure:732: checking for working autoconf 9 | configure:745: checking for working automake 10 | configure:758: checking for working autoheader 11 | configure:771: checking for working makeinfo 12 | configure:787: checking whether make sets ${MAKE} 13 | configure:816: checking for gcc 14 | configure:929: checking whether the C compiler (gcc ) works 15 | configure:945: gcc -o conftest conftest.c 1>&5 16 | configure:971: checking whether the C compiler (gcc ) is a cross-compiler 17 | configure:976: checking whether we are using GNU C 18 | configure:985: gcc -E conftest.c 19 | configure:1004: checking whether gcc accepts -g 20 | configure:1047: checking for a BSD compatible install 21 | configure:1142: checking for sdl-config 22 | configure:1177: checking for SDL - version >= 1.0.1 23 | configure:1259: gcc -o conftest -g -O2 -I/usr/include/SDL -D_GNU_SOURCE=1 -D_REENTRANT conftest.c -L/usr/lib -lSDL 1>&5 24 | -------------------------------------------------------------------------------- /i_net.h: -------------------------------------------------------------------------------- 1 | // Emacs style mode select -*- C++ -*- 2 | //----------------------------------------------------------------------------- 3 | // 4 | // $Id:$ 5 | // 6 | // Copyright (C) 1993-1996 by id Software, Inc. 7 | // 8 | // This source is available for distribution and/or modification 9 | // only under the terms of the DOOM Source Code License as 10 | // published by id Software. All rights reserved. 11 | // 12 | // The source is distributed in the hope that it will be useful, 13 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | // FITNESS FOR A PARTICULAR PURPOSE. See the DOOM Source Code License 15 | // for more details. 16 | // 17 | // DESCRIPTION: 18 | // System specific network interface stuff. 19 | // 20 | //----------------------------------------------------------------------------- 21 | 22 | 23 | #ifndef __I_NET__ 24 | #define __I_NET__ 25 | 26 | 27 | #ifdef __GNUG__ 28 | #pragma interface 29 | #endif 30 | 31 | 32 | 33 | // Called by D_DoomMain. 34 | 35 | 36 | void I_InitNetwork (void); 37 | void I_NetCmd (void); 38 | 39 | 40 | #endif 41 | //----------------------------------------------------------------------------- 42 | // 43 | // $Log:$ 44 | // 45 | //----------------------------------------------------------------------------- 46 | -------------------------------------------------------------------------------- /m_argv.h: -------------------------------------------------------------------------------- 1 | // Emacs style mode select -*- C++ -*- 2 | //----------------------------------------------------------------------------- 3 | // 4 | // $Id:$ 5 | // 6 | // Copyright (C) 1993-1996 by id Software, Inc. 7 | // 8 | // This source is available for distribution and/or modification 9 | // only under the terms of the DOOM Source Code License as 10 | // published by id Software. All rights reserved. 11 | // 12 | // The source is distributed in the hope that it will be useful, 13 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | // FITNESS FOR A PARTICULAR PURPOSE. See the DOOM Source Code License 15 | // for more details. 16 | // 17 | // DESCRIPTION: 18 | // Nil. 19 | // 20 | //----------------------------------------------------------------------------- 21 | 22 | 23 | #ifndef __M_ARGV__ 24 | #define __M_ARGV__ 25 | 26 | // 27 | // MISC 28 | // 29 | extern int myargc; 30 | extern char** myargv; 31 | 32 | // Returns the position of the given parameter 33 | // in the arg list (0 if not found). 34 | int M_CheckParm (char* check); 35 | 36 | 37 | #endif 38 | //----------------------------------------------------------------------------- 39 | // 40 | // $Log:$ 41 | // 42 | //----------------------------------------------------------------------------- 43 | -------------------------------------------------------------------------------- /p_tick.h: -------------------------------------------------------------------------------- 1 | // Emacs style mode select -*- C++ -*- 2 | //----------------------------------------------------------------------------- 3 | // 4 | // $Id:$ 5 | // 6 | // Copyright (C) 1993-1996 by id Software, Inc. 7 | // 8 | // This source is available for distribution and/or modification 9 | // only under the terms of the DOOM Source Code License as 10 | // published by id Software. All rights reserved. 11 | // 12 | // The source is distributed in the hope that it will be useful, 13 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | // FITNESS FOR A PARTICULAR PURPOSE. See the DOOM Source Code License 15 | // for more details. 16 | // 17 | // DESCRIPTION: 18 | // ? 19 | // 20 | //----------------------------------------------------------------------------- 21 | 22 | 23 | #ifndef __P_TICK__ 24 | #define __P_TICK__ 25 | 26 | 27 | #ifdef __GNUG__ 28 | #pragma interface 29 | #endif 30 | 31 | 32 | // Called by C_Ticker, 33 | // can call G_PlayerExited. 34 | // Carries out all thinking of monsters and players. 35 | void P_Ticker (void); 36 | 37 | 38 | 39 | #endif 40 | //----------------------------------------------------------------------------- 41 | // 42 | // $Log:$ 43 | // 44 | //----------------------------------------------------------------------------- 45 | -------------------------------------------------------------------------------- /doomstat.c: -------------------------------------------------------------------------------- 1 | // Emacs style mode select -*- C++ -*- 2 | //----------------------------------------------------------------------------- 3 | // 4 | // $Id:$ 5 | // 6 | // Copyright (C) 1993-1996 by id Software, Inc. 7 | // 8 | // This source is available for distribution and/or modification 9 | // only under the terms of the DOOM Source Code License as 10 | // published by id Software. All rights reserved. 11 | // 12 | // The source is distributed in the hope that it will be useful, 13 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | // FITNESS FOR A PARTICULAR PURPOSE. See the DOOM Source Code License 15 | // for more details. 16 | // 17 | // $Log:$ 18 | // 19 | // DESCRIPTION: 20 | // Put all global tate variables here. 21 | // 22 | //----------------------------------------------------------------------------- 23 | 24 | static const char 25 | rcsid[] = "$Id: m_bbox.c,v 1.1 1997/02/03 22:45:10 b1 Exp $"; 26 | 27 | 28 | #ifdef __GNUG__ 29 | #pragma implementation "doomstat.h" 30 | #endif 31 | #include "doomstat.h" 32 | 33 | 34 | // Game Mode - identify IWAD as shareware, retail etc. 35 | GameMode_t gamemode = indetermined; 36 | GameMission_t gamemission = doom; 37 | 38 | // Language. 39 | Language_t language = english; 40 | 41 | // Set if homebrew PWAD stuff has been added. 42 | boolean modifiedgame; 43 | 44 | 45 | 46 | 47 | -------------------------------------------------------------------------------- /m_random.h: -------------------------------------------------------------------------------- 1 | // Emacs style mode select -*- C++ -*- 2 | //----------------------------------------------------------------------------- 3 | // 4 | // $Id:$ 5 | // 6 | // Copyright (C) 1993-1996 by id Software, Inc. 7 | // 8 | // This source is available for distribution and/or modification 9 | // only under the terms of the DOOM Source Code License as 10 | // published by id Software. All rights reserved. 11 | // 12 | // The source is distributed in the hope that it will be useful, 13 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | // FITNESS FOR A PARTICULAR PURPOSE. See the DOOM Source Code License 15 | // for more details. 16 | // 17 | // DESCRIPTION: 18 | // 19 | // 20 | //----------------------------------------------------------------------------- 21 | 22 | 23 | #ifndef __M_RANDOM__ 24 | #define __M_RANDOM__ 25 | 26 | 27 | #include "doomtype.h" 28 | 29 | 30 | 31 | // Returns a number from 0 to 255, 32 | // from a lookup table. 33 | int M_Random (void); 34 | 35 | // As M_Random, but used only by the play simulation. 36 | int P_Random (void); 37 | 38 | // Fix randoms for demos. 39 | void M_ClearRandom (void); 40 | 41 | 42 | #endif 43 | //----------------------------------------------------------------------------- 44 | // 45 | // $Log:$ 46 | // 47 | //----------------------------------------------------------------------------- 48 | -------------------------------------------------------------------------------- /p_setup.h: -------------------------------------------------------------------------------- 1 | // Emacs style mode select -*- C++ -*- 2 | //----------------------------------------------------------------------------- 3 | // 4 | // $Id:$ 5 | // 6 | // Copyright (C) 1993-1996 by id Software, Inc. 7 | // 8 | // This source is available for distribution and/or modification 9 | // only under the terms of the DOOM Source Code License as 10 | // published by id Software. All rights reserved. 11 | // 12 | // The source is distributed in the hope that it will be useful, 13 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | // FITNESS FOR A PARTICULAR PURPOSE. See the DOOM Source Code License 15 | // for more details. 16 | // 17 | // DESCRIPTION: 18 | // Setup a game, startup stuff. 19 | // 20 | //----------------------------------------------------------------------------- 21 | 22 | 23 | #ifndef __P_SETUP__ 24 | #define __P_SETUP__ 25 | 26 | 27 | #ifdef __GNUG__ 28 | #pragma interface 29 | #endif 30 | 31 | 32 | // NOT called by W_Ticker. Fixme. 33 | void 34 | P_SetupLevel 35 | ( int episode, 36 | int map, 37 | int playermask, 38 | skill_t skill); 39 | 40 | // Called by startup code. 41 | void P_Init (void); 42 | 43 | #endif 44 | //----------------------------------------------------------------------------- 45 | // 46 | // $Log:$ 47 | // 48 | //----------------------------------------------------------------------------- 49 | -------------------------------------------------------------------------------- /d_textur.h: -------------------------------------------------------------------------------- 1 | // Emacs style mode select -*- C++ -*- 2 | //----------------------------------------------------------------------------- 3 | // 4 | // $Id:$ 5 | // 6 | // Copyright (C) 1993-1996 by id Software, Inc. 7 | // 8 | // This source is available for distribution and/or modification 9 | // only under the terms of the DOOM Source Code License as 10 | // published by id Software. All rights reserved. 11 | // 12 | // The source is distributed in the hope that it will be useful, 13 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | // FITNESS FOR A PARTICULAR PURPOSE. See the DOOM Source Code License 15 | // for more details. 16 | // 17 | // DESCRIPTION: 18 | // Typedefs related to to textures etc., 19 | // isolated here to make it easier separating modules. 20 | // 21 | //----------------------------------------------------------------------------- 22 | 23 | 24 | #ifndef __D_TEXTUR__ 25 | #define __D_TEXTUR__ 26 | 27 | #include "doomtype.h" 28 | 29 | 30 | 31 | 32 | // 33 | // Flats? 34 | // 35 | // a pic is an unmasked block of pixels 36 | typedef struct 37 | { 38 | byte width; 39 | byte height; 40 | byte data; 41 | } pic_t; 42 | 43 | 44 | 45 | 46 | #endif 47 | //----------------------------------------------------------------------------- 48 | // 49 | // $Log:$ 50 | // 51 | //----------------------------------------------------------------------------- 52 | -------------------------------------------------------------------------------- /f_finale.h: -------------------------------------------------------------------------------- 1 | // Emacs style mode select -*- C++ -*- 2 | //----------------------------------------------------------------------------- 3 | // 4 | // $Id:$ 5 | // 6 | // Copyright (C) 1993-1996 by id Software, Inc. 7 | // 8 | // This source is available for distribution and/or modification 9 | // only under the terms of the DOOM Source Code License as 10 | // published by id Software. All rights reserved. 11 | // 12 | // The source is distributed in the hope that it will be useful, 13 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | // FITNESS FOR A PARTICULAR PURPOSE. See the DOOM Source Code License 15 | // for more details. 16 | // 17 | // DESCRIPTION: 18 | // 19 | // 20 | //----------------------------------------------------------------------------- 21 | 22 | 23 | #ifndef __F_FINALE__ 24 | #define __F_FINALE__ 25 | 26 | 27 | #include "doomtype.h" 28 | #include "d_event.h" 29 | // 30 | // FINALE 31 | // 32 | 33 | // Called by main loop. 34 | boolean F_Responder (event_t* ev); 35 | 36 | // Called by main loop. 37 | void F_Ticker (void); 38 | 39 | // Called by main loop. 40 | void F_Drawer (void); 41 | 42 | 43 | void F_StartFinale (void); 44 | 45 | 46 | 47 | 48 | #endif 49 | //----------------------------------------------------------------------------- 50 | // 51 | // $Log:$ 52 | // 53 | //----------------------------------------------------------------------------- 54 | -------------------------------------------------------------------------------- /r_sky.h: -------------------------------------------------------------------------------- 1 | // Emacs style mode select -*- C++ -*- 2 | //----------------------------------------------------------------------------- 3 | // 4 | // $Id:$ 5 | // 6 | // Copyright (C) 1993-1996 by id Software, Inc. 7 | // 8 | // This source is available for distribution and/or modification 9 | // only under the terms of the DOOM Source Code License as 10 | // published by id Software. All rights reserved. 11 | // 12 | // The source is distributed in the hope that it will be useful, 13 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | // FITNESS FOR A PARTICULAR PURPOSE. See the DOOM Source Code License 15 | // for more details. 16 | // 17 | // DESCRIPTION: 18 | // Sky rendering. 19 | // 20 | //----------------------------------------------------------------------------- 21 | 22 | 23 | #ifndef __R_SKY__ 24 | #define __R_SKY__ 25 | 26 | 27 | #ifdef __GNUG__ 28 | #pragma interface 29 | #endif 30 | 31 | // SKY, store the number for name. 32 | #define SKYFLATNAME "F_SKY1" 33 | 34 | // The sky map is 256*128*4 maps. 35 | #define ANGLETOSKYSHIFT 22 36 | 37 | extern int skytexture; 38 | extern int skytexturemid; 39 | 40 | // Called whenever the view size changes. 41 | void R_InitSkyMap (void); 42 | 43 | #endif 44 | //----------------------------------------------------------------------------- 45 | // 46 | // $Log:$ 47 | // 48 | //----------------------------------------------------------------------------- 49 | -------------------------------------------------------------------------------- /m_swap.c: -------------------------------------------------------------------------------- 1 | // Emacs style mode select -*- C++ -*- 2 | //----------------------------------------------------------------------------- 3 | // 4 | // $Id:$ 5 | // 6 | // Copyright (C) 1993-1996 by id Software, Inc. 7 | // 8 | // This source is available for distribution and/or modification 9 | // only under the terms of the DOOM Source Code License as 10 | // published by id Software. All rights reserved. 11 | // 12 | // The source is distributed in the hope that it will be useful, 13 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | // FITNESS FOR A PARTICULAR PURPOSE. See the DOOM Source Code License 15 | // for more details. 16 | // 17 | // $Log:$ 18 | // 19 | // DESCRIPTION: 20 | // Endianess handling, swapping 16bit and 32bit. 21 | // 22 | //----------------------------------------------------------------------------- 23 | 24 | static const char 25 | rcsid[] = "$Id: m_bbox.c,v 1.1 1997/02/03 22:45:10 b1 Exp $"; 26 | 27 | 28 | #ifdef __GNUG__ 29 | #pragma implementation "m_swap.h" 30 | #endif 31 | #include "m_swap.h" 32 | 33 | 34 | // Swap 16bit, that is, MSB and LSB byte. 35 | unsigned short SwapSHORT(unsigned short x) 36 | { 37 | // No masking with 0xFF should be necessary. 38 | return (x>>8) | (x<<8); 39 | } 40 | 41 | // Swapping 32bit. 42 | unsigned long SwapLONG( unsigned long x) 43 | { 44 | return 45 | (x>>24) 46 | | ((x>>8) & 0xff00) 47 | | ((x<<8) & 0xff0000) 48 | | (x<<24); 49 | } 50 | 51 | 52 | -------------------------------------------------------------------------------- /m_argv.c: -------------------------------------------------------------------------------- 1 | // Emacs style mode select -*- C++ -*- 2 | //----------------------------------------------------------------------------- 3 | // 4 | // $Id:$ 5 | // 6 | // Copyright (C) 1993-1996 by id Software, Inc. 7 | // 8 | // This source is available for distribution and/or modification 9 | // only under the terms of the DOOM Source Code License as 10 | // published by id Software. All rights reserved. 11 | // 12 | // The source is distributed in the hope that it will be useful, 13 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | // FITNESS FOR A PARTICULAR PURPOSE. See the DOOM Source Code License 15 | // for more details. 16 | // 17 | // $Log:$ 18 | // 19 | // DESCRIPTION: 20 | // 21 | //----------------------------------------------------------------------------- 22 | 23 | static const char 24 | rcsid[] = "$Id: m_argv.c,v 1.1 1997/02/03 22:45:10 b1 Exp $"; 25 | 26 | 27 | #include 28 | 29 | #include "i_system.h" 30 | 31 | int myargc; 32 | char** myargv; 33 | 34 | 35 | 36 | 37 | // 38 | // M_CheckParm 39 | // Checks for the given parameter 40 | // in the program's command line arguments. 41 | // Returns the argument number (1 to argc-1) 42 | // or 0 if not present 43 | int M_CheckParm (char *check) 44 | { 45 | int i; 46 | 47 | for (i = 1;i>1) + ((a)&32) + (((a)&64)>>5) + (((a)&128)>>7)) 33 | 34 | typedef struct 35 | { 36 | unsigned char* sequence; 37 | unsigned char* p; 38 | 39 | } cheatseq_t; 40 | 41 | int 42 | cht_CheckCheat 43 | ( cheatseq_t* cht, 44 | char key ); 45 | 46 | 47 | void 48 | cht_GetParam 49 | ( cheatseq_t* cht, 50 | char* buffer ); 51 | 52 | 53 | #endif 54 | //----------------------------------------------------------------------------- 55 | // 56 | // $Log:$ 57 | // 58 | //----------------------------------------------------------------------------- 59 | -------------------------------------------------------------------------------- /p_saveg.h: -------------------------------------------------------------------------------- 1 | // Emacs style mode select -*- C++ -*- 2 | //----------------------------------------------------------------------------- 3 | // 4 | // $Id:$ 5 | // 6 | // Copyright (C) 1993-1996 by id Software, Inc. 7 | // 8 | // This source is available for distribution and/or modification 9 | // only under the terms of the DOOM Source Code License as 10 | // published by id Software. All rights reserved. 11 | // 12 | // The source is distributed in the hope that it will be useful, 13 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | // FITNESS FOR A PARTICULAR PURPOSE. See the DOOM Source Code License 15 | // for more details. 16 | // 17 | // DESCRIPTION: 18 | // Savegame I/O, archiving, persistence. 19 | // 20 | //----------------------------------------------------------------------------- 21 | 22 | 23 | #ifndef __P_SAVEG__ 24 | #define __P_SAVEG__ 25 | 26 | 27 | #ifdef __GNUG__ 28 | #pragma interface 29 | #endif 30 | 31 | 32 | // Persistent storage/archiving. 33 | // These are the load / save game routines. 34 | void P_ArchivePlayers (void); 35 | void P_UnArchivePlayers (void); 36 | void P_ArchiveWorld (void); 37 | void P_UnArchiveWorld (void); 38 | void P_ArchiveThinkers (void); 39 | void P_UnArchiveThinkers (void); 40 | void P_ArchiveSpecials (void); 41 | void P_UnArchiveSpecials (void); 42 | 43 | extern byte* save_p; 44 | 45 | 46 | #endif 47 | //----------------------------------------------------------------------------- 48 | // 49 | // $Log:$ 50 | // 51 | //----------------------------------------------------------------------------- 52 | -------------------------------------------------------------------------------- /wi_stuff.h: -------------------------------------------------------------------------------- 1 | // Emacs style mode select -*- C++ -*- 2 | //----------------------------------------------------------------------------- 3 | // 4 | // $Id:$ 5 | // 6 | // Copyright (C) 1993-1996 by id Software, Inc. 7 | // 8 | // This source is available for distribution and/or modification 9 | // only under the terms of the DOOM Source Code License as 10 | // published by id Software. All rights reserved. 11 | // 12 | // The source is distributed in the hope that it will be useful, 13 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | // FITNESS FOR A PARTICULAR PURPOSE. See the DOOM Source Code License 15 | // for more details. 16 | // 17 | // DESCRIPTION: 18 | // Intermission. 19 | // 20 | //----------------------------------------------------------------------------- 21 | 22 | #ifndef __WI_STUFF__ 23 | #define __WI_STUFF__ 24 | 25 | //#include "v_video.h" 26 | 27 | #include "doomdef.h" 28 | 29 | // States for the intermission 30 | 31 | typedef enum 32 | { 33 | NoState = -1, 34 | StatCount, 35 | ShowNextLoc 36 | 37 | } stateenum_t; 38 | 39 | // Called by main loop, animate the intermission. 40 | void WI_Ticker (void); 41 | 42 | // Called by main loop, 43 | // draws the intermission directly into the screen buffer. 44 | void WI_Drawer (void); 45 | 46 | // Setup for an intermission screen. 47 | void WI_Start(wbstartstruct_t* wbstartstruct); 48 | 49 | #endif 50 | //----------------------------------------------------------------------------- 51 | // 52 | // $Log:$ 53 | // 54 | //----------------------------------------------------------------------------- 55 | -------------------------------------------------------------------------------- /m_bbox.c: -------------------------------------------------------------------------------- 1 | // Emacs style mode select -*- C++ -*- 2 | //----------------------------------------------------------------------------- 3 | // 4 | // $Id:$ 5 | // 6 | // Copyright (C) 1993-1996 by id Software, Inc. 7 | // 8 | // This source is available for distribution and/or modification 9 | // only under the terms of the DOOM Source Code License as 10 | // published by id Software. All rights reserved. 11 | // 12 | // The source is distributed in the hope that it will be useful, 13 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | // FITNESS FOR A PARTICULAR PURPOSE. See the DOOM Source Code License 15 | // for more details. 16 | // 17 | // $Log:$ 18 | // 19 | // DESCRIPTION: 20 | // Main loop menu stuff. 21 | // Random number LUT. 22 | // Default Config File. 23 | // PCX Screenshots. 24 | // 25 | //----------------------------------------------------------------------------- 26 | 27 | static const char 28 | rcsid[] = "$Id: m_bbox.c,v 1.1 1997/02/03 22:45:10 b1 Exp $"; 29 | 30 | 31 | #ifdef __GNUG__ 32 | #pragma implementation "m_bbox.h" 33 | #endif 34 | #include "m_bbox.h" 35 | 36 | 37 | 38 | 39 | void M_ClearBox (fixed_t *box) 40 | { 41 | box[BOXTOP] = box[BOXRIGHT] = MININT; 42 | box[BOXBOTTOM] = box[BOXLEFT] = MAXINT; 43 | } 44 | 45 | void 46 | M_AddToBox 47 | ( fixed_t* box, 48 | fixed_t x, 49 | fixed_t y ) 50 | { 51 | if (xbox[BOXRIGHT]) 54 | box[BOXRIGHT] = x; 55 | if (ybox[BOXTOP]) 58 | box[BOXTOP] = y; 59 | } 60 | 61 | 62 | 63 | 64 | 65 | -------------------------------------------------------------------------------- /r_local.h: -------------------------------------------------------------------------------- 1 | // Emacs style mode select -*- C++ -*- 2 | //----------------------------------------------------------------------------- 3 | // 4 | // $Id:$ 5 | // 6 | // Copyright (C) 1993-1996 by id Software, Inc. 7 | // 8 | // This source is available for distribution and/or modification 9 | // only under the terms of the DOOM Source Code License as 10 | // published by id Software. All rights reserved. 11 | // 12 | // The source is distributed in the hope that it will be useful, 13 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | // FITNESS FOR A PARTICULAR PURPOSE. See the DOOM Source Code License 15 | // for more details. 16 | // 17 | // DESCRIPTION: 18 | // Refresh (R_*) module, global header. 19 | // All the rendering/drawing stuff is here. 20 | // 21 | //----------------------------------------------------------------------------- 22 | 23 | #ifndef __R_LOCAL__ 24 | #define __R_LOCAL__ 25 | 26 | // Binary Angles, sine/cosine/atan lookups. 27 | #include "tables.h" 28 | 29 | // Screen size related parameters. 30 | #include "doomdef.h" 31 | 32 | // Include the refresh/render data structs. 33 | #include "r_data.h" 34 | 35 | 36 | 37 | // 38 | // Separate header file for each module. 39 | // 40 | #include "r_main.h" 41 | #include "r_bsp.h" 42 | #include "r_segs.h" 43 | #include "r_plane.h" 44 | #include "r_data.h" 45 | #include "r_things.h" 46 | #include "r_draw.h" 47 | 48 | #endif // __R_LOCAL__ 49 | //----------------------------------------------------------------------------- 50 | // 51 | // $Log:$ 52 | // 53 | //----------------------------------------------------------------------------- 54 | -------------------------------------------------------------------------------- /am_map.h: -------------------------------------------------------------------------------- 1 | // Emacs style mode select -*- C++ -*- 2 | //----------------------------------------------------------------------------- 3 | // 4 | // $Id:$ 5 | // 6 | // Copyright (C) 1993-1996 by id Software, Inc. 7 | // 8 | // This source is available for distribution and/or modification 9 | // only under the terms of the DOOM Source Code License as 10 | // published by id Software. All rights reserved. 11 | // 12 | // The source is distributed in the hope that it will be useful, 13 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | // FITNESS FOR A PARTICULAR PURPOSE. See the DOOM Source Code License 15 | // for more details. 16 | // 17 | // DESCRIPTION: 18 | // AutoMap module. 19 | // 20 | //----------------------------------------------------------------------------- 21 | 22 | #ifndef __AMMAP_H__ 23 | #define __AMMAP_H__ 24 | 25 | // Used by ST StatusBar stuff. 26 | #define AM_MSGHEADER (('a'<<24)+('m'<<16)) 27 | #define AM_MSGENTERED (AM_MSGHEADER | ('e'<<8)) 28 | #define AM_MSGEXITED (AM_MSGHEADER | ('x'<<8)) 29 | 30 | 31 | // Called by main loop. 32 | boolean AM_Responder (event_t* ev); 33 | 34 | // Called by main loop. 35 | void AM_Ticker (void); 36 | 37 | // Called by main loop, 38 | // called instead of view drawer if automap active. 39 | void AM_Drawer (void); 40 | 41 | // Called to force the automap to quit 42 | // if the level is completed while it is up. 43 | void AM_Stop (void); 44 | 45 | 46 | 47 | #endif 48 | //----------------------------------------------------------------------------- 49 | // 50 | // $Log:$ 51 | // 52 | //----------------------------------------------------------------------------- 53 | -------------------------------------------------------------------------------- /m_swap.h: -------------------------------------------------------------------------------- 1 | // Emacs style mode select -*- C++ -*- 2 | //----------------------------------------------------------------------------- 3 | // 4 | // $Id:$ 5 | // 6 | // Copyright (C) 1993-1996 by id Software, Inc. 7 | // 8 | // This source is available for distribution and/or modification 9 | // only under the terms of the DOOM Source Code License as 10 | // published by id Software. All rights reserved. 11 | // 12 | // The source is distributed in the hope that it will be useful, 13 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | // FITNESS FOR A PARTICULAR PURPOSE. See the DOOM Source Code License 15 | // for more details. 16 | // 17 | // DESCRIPTION: 18 | // Endianess handling, swapping 16bit and 32bit. 19 | // 20 | //----------------------------------------------------------------------------- 21 | 22 | 23 | #ifndef __M_SWAP__ 24 | #define __M_SWAP__ 25 | 26 | 27 | #ifdef __GNUG__ 28 | #pragma interface 29 | #endif 30 | 31 | 32 | // Endianess handling. 33 | // WAD files are stored little endian. 34 | #ifdef sparc 35 | #define __BIG_ENDIAN__ 36 | #endif 37 | #ifdef __BEOS__ 38 | #include 39 | #if B_HOST_IS_BENDIAN 40 | #define __BIG_ENDIAN__ 41 | #endif 42 | #endif 43 | #ifdef __BIG_ENDIAN__ 44 | #define SHORT(x) ((short)SwapSHORT((unsigned short) (x))) 45 | #define LONG(x) ((long)SwapLONG((unsigned long) (x))) 46 | #else 47 | #define SHORT(x) (x) 48 | #define LONG(x) (x) 49 | #endif 50 | 51 | 52 | 53 | 54 | #endif 55 | //----------------------------------------------------------------------------- 56 | // 57 | // $Log:$ 58 | // 59 | //----------------------------------------------------------------------------- 60 | -------------------------------------------------------------------------------- /d_ticcmd.h: -------------------------------------------------------------------------------- 1 | // Emacs style mode select -*- C++ -*- 2 | //----------------------------------------------------------------------------- 3 | // 4 | // $Id:$ 5 | // 6 | // Copyright (C) 1993-1996 by id Software, Inc. 7 | // 8 | // This source is available for distribution and/or modification 9 | // only under the terms of the DOOM Source Code License as 10 | // published by id Software. All rights reserved. 11 | // 12 | // The source is distributed in the hope that it will be useful, 13 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | // FITNESS FOR A PARTICULAR PURPOSE. See the DOOM Source Code License 15 | // for more details. 16 | // 17 | // DESCRIPTION: 18 | // System specific interface stuff. 19 | // 20 | //----------------------------------------------------------------------------- 21 | 22 | 23 | #ifndef __D_TICCMD__ 24 | #define __D_TICCMD__ 25 | 26 | #include "doomtype.h" 27 | 28 | #ifdef __GNUG__ 29 | #pragma interface 30 | #endif 31 | 32 | // The data sampled per tick (single player) 33 | // and transmitted to other peers (multiplayer). 34 | // Mainly movements/button commands per game tick, 35 | // plus a checksum for internal state consistency. 36 | typedef struct 37 | { 38 | char forwardmove; // *2048 for move 39 | char sidemove; // *2048 for move 40 | short angleturn; // <<16 for angle delta 41 | short consistancy; // checks for net game 42 | byte chatchar; 43 | byte buttons; 44 | } ticcmd_t; 45 | 46 | 47 | 48 | #endif 49 | //----------------------------------------------------------------------------- 50 | // 51 | // $Log:$ 52 | // 53 | //----------------------------------------------------------------------------- 54 | -------------------------------------------------------------------------------- /d_main.h: -------------------------------------------------------------------------------- 1 | // Emacs style mode select -*- C++ -*- 2 | //----------------------------------------------------------------------------- 3 | // 4 | // $Id:$ 5 | // 6 | // Copyright (C) 1993-1996 by id Software, Inc. 7 | // 8 | // This source is available for distribution and/or modification 9 | // only under the terms of the DOOM Source Code License as 10 | // published by id Software. All rights reserved. 11 | // 12 | // The source is distributed in the hope that it will be useful, 13 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | // FITNESS FOR A PARTICULAR PURPOSE. See the DOOM Source Code License 15 | // for more details. 16 | // 17 | // $Log:$ 18 | // 19 | // DESCRIPTION: 20 | // System specific interface stuff. 21 | // 22 | //----------------------------------------------------------------------------- 23 | 24 | 25 | #ifndef __D_MAIN__ 26 | #define __D_MAIN__ 27 | 28 | #include "d_event.h" 29 | 30 | #ifdef __GNUG__ 31 | #pragma interface 32 | #endif 33 | 34 | 35 | 36 | #define MAXWADFILES 20 37 | extern char* wadfiles[MAXWADFILES]; 38 | 39 | void D_AddFile (char *file); 40 | 41 | 42 | 43 | // 44 | // D_DoomMain() 45 | // Not a globally visible function, just included for source reference, 46 | // calls all startup code, parses command line options. 47 | // If not overrided by user input, calls N_AdvanceDemo. 48 | // 49 | void D_DoomMain (void); 50 | 51 | // Called by IO functions when input is detected. 52 | void D_PostEvent (event_t* ev); 53 | 54 | 55 | 56 | // 57 | // BASE LEVEL 58 | // 59 | void D_PageTicker (void); 60 | void D_PageDrawer (void); 61 | void D_AdvanceDemo (void); 62 | void D_StartTitle (void); 63 | 64 | #endif 65 | -------------------------------------------------------------------------------- /r_sky.c: -------------------------------------------------------------------------------- 1 | // Emacs style mode select -*- C++ -*- 2 | //----------------------------------------------------------------------------- 3 | // 4 | // $Id:$ 5 | // 6 | // Copyright (C) 1993-1996 by id Software, Inc. 7 | // 8 | // This source is available for distribution and/or modification 9 | // only under the terms of the DOOM Source Code License as 10 | // published by id Software. All rights reserved. 11 | // 12 | // The source is distributed in the hope that it will be useful, 13 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | // FITNESS FOR A PARTICULAR PURPOSE. See the DOOM Source Code License 15 | // for more details. 16 | // 17 | // $Log:$ 18 | // 19 | // DESCRIPTION: 20 | // Sky rendering. The DOOM sky is a texture map like any 21 | // wall, wrapping around. A 1024 columns equal 360 degrees. 22 | // The default sky map is 256 columns and repeats 4 times 23 | // on a 320 screen? 24 | // 25 | // 26 | //----------------------------------------------------------------------------- 27 | 28 | static const char 29 | rcsid[] = "$Id: m_bbox.c,v 1.1 1997/02/03 22:45:10 b1 Exp $"; 30 | 31 | 32 | // Needed for FRACUNIT. 33 | #include "m_fixed.h" 34 | 35 | // Needed for Flat retrieval. 36 | #include "r_data.h" 37 | 38 | 39 | #ifdef __GNUG__ 40 | #pragma implementation "r_sky.h" 41 | #endif 42 | #include "r_sky.h" 43 | 44 | // 45 | // sky mapping 46 | // 47 | int skyflatnum; 48 | int skytexture; 49 | int skytexturemid; 50 | 51 | 52 | 53 | // 54 | // R_InitSkyMap 55 | // Called whenever the view size changes. 56 | // 57 | void R_InitSkyMap (void) 58 | { 59 | // skyflatnum = R_FlatNumForName ( SKYFLATNAME ); 60 | skytexturemid = 100*FRACUNIT; 61 | } 62 | 63 | -------------------------------------------------------------------------------- /dstrings.h: -------------------------------------------------------------------------------- 1 | // Emacs style mode select -*- C++ -*- 2 | //----------------------------------------------------------------------------- 3 | // 4 | // $Id:$ 5 | // 6 | // Copyright (C) 1993-1996 by id Software, Inc. 7 | // 8 | // This source is available for distribution and/or modification 9 | // only under the terms of the DOOM Source Code License as 10 | // published by id Software. All rights reserved. 11 | // 12 | // The source is distributed in the hope that it will be useful, 13 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | // FITNESS FOR A PARTICULAR PURPOSE. See the DOOM Source Code License 15 | // for more details. 16 | // 17 | // 18 | // $Log:$ 19 | // 20 | // DESCRIPTION: 21 | // DOOM strings, by language. 22 | // 23 | //----------------------------------------------------------------------------- 24 | 25 | 26 | #ifndef __DSTRINGS__ 27 | #define __DSTRINGS__ 28 | 29 | 30 | // All important printed strings. 31 | // Language selection (message strings). 32 | // Use -DFRENCH etc. 33 | 34 | #ifdef FRENCH 35 | #include "d_french.h" 36 | #else 37 | #include "d_englsh.h" 38 | #endif 39 | 40 | // Misc. other strings. 41 | #define SAVEGAMENAME "doomsav" 42 | 43 | 44 | // 45 | // File locations, 46 | // relative to current position. 47 | // Path names are OS-sensitive. 48 | // 49 | #define DEVMAPS "devmaps" 50 | #define DEVDATA "devdata" 51 | 52 | 53 | // Not done in french? 54 | 55 | // QuitDOOM messages 56 | #define NUM_QUITMESSAGES 22 57 | 58 | extern char* endmsg[]; 59 | 60 | 61 | #endif 62 | //----------------------------------------------------------------------------- 63 | // 64 | // $Log:$ 65 | // 66 | //----------------------------------------------------------------------------- 67 | -------------------------------------------------------------------------------- /i_video.h: -------------------------------------------------------------------------------- 1 | // Emacs style mode select -*- C++ -*- 2 | //----------------------------------------------------------------------------- 3 | // 4 | // $Id:$ 5 | // 6 | // Copyright (C) 1993-1996 by id Software, Inc. 7 | // 8 | // This source is available for distribution and/or modification 9 | // only under the terms of the DOOM Source Code License as 10 | // published by id Software. All rights reserved. 11 | // 12 | // The source is distributed in the hope that it will be useful, 13 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | // FITNESS FOR A PARTICULAR PURPOSE. See the DOOM Source Code License 15 | // for more details. 16 | // 17 | // DESCRIPTION: 18 | // System specific interface stuff. 19 | // 20 | //----------------------------------------------------------------------------- 21 | 22 | 23 | #ifndef __I_VIDEO__ 24 | #define __I_VIDEO__ 25 | 26 | 27 | #include "doomtype.h" 28 | 29 | #ifdef __GNUG__ 30 | #pragma interface 31 | #endif 32 | 33 | 34 | // Called by D_DoomMain, 35 | // determines the hardware configuration 36 | // and sets up the video mode 37 | void I_InitGraphics (void); 38 | 39 | 40 | void I_ShutdownGraphics(void); 41 | 42 | // Takes full 8 bit values. 43 | void I_SetPalette (byte* palette); 44 | 45 | void I_UpdateNoBlit (void); 46 | void I_FinishUpdate (void); 47 | 48 | // Wait for vertical retrace or pause a bit. 49 | void I_WaitVBL(int count); 50 | 51 | void I_ReadScreen (byte* scr); 52 | 53 | void I_BeginRead (void); 54 | void I_EndRead (void); 55 | 56 | 57 | 58 | #endif 59 | //----------------------------------------------------------------------------- 60 | // 61 | // $Log:$ 62 | // 63 | //----------------------------------------------------------------------------- 64 | -------------------------------------------------------------------------------- /f_wipe.h: -------------------------------------------------------------------------------- 1 | // Emacs style mode select -*- C++ -*- 2 | //----------------------------------------------------------------------------- 3 | // 4 | // $Id:$ 5 | // 6 | // Copyright (C) 1993-1996 by id Software, Inc. 7 | // 8 | // This source is available for distribution and/or modification 9 | // only under the terms of the DOOM Source Code License as 10 | // published by id Software. All rights reserved. 11 | // 12 | // The source is distributed in the hope that it will be useful, 13 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | // FITNESS FOR A PARTICULAR PURPOSE. See the DOOM Source Code License 15 | // for more details. 16 | // 17 | // DESCRIPTION: 18 | // Mission start screen wipe/melt, special effects. 19 | // 20 | //----------------------------------------------------------------------------- 21 | 22 | 23 | #ifndef __F_WIPE_H__ 24 | #define __F_WIPE_H__ 25 | 26 | // 27 | // SCREEN WIPE PACKAGE 28 | // 29 | 30 | enum 31 | { 32 | // simple gradual pixel change for 8-bit only 33 | wipe_ColorXForm, 34 | 35 | // weird screen melt 36 | wipe_Melt, 37 | 38 | wipe_NUMWIPES 39 | }; 40 | 41 | int 42 | wipe_StartScreen 43 | ( int x, 44 | int y, 45 | int width, 46 | int height ); 47 | 48 | 49 | int 50 | wipe_EndScreen 51 | ( int x, 52 | int y, 53 | int width, 54 | int height ); 55 | 56 | 57 | int 58 | wipe_ScreenWipe 59 | ( int wipeno, 60 | int x, 61 | int y, 62 | int width, 63 | int height, 64 | int ticks ); 65 | 66 | #endif 67 | //----------------------------------------------------------------------------- 68 | // 69 | // $Log:$ 70 | // 71 | //----------------------------------------------------------------------------- 72 | -------------------------------------------------------------------------------- /r_data.h: -------------------------------------------------------------------------------- 1 | // Emacs style mode select -*- C++ -*- 2 | //----------------------------------------------------------------------------- 3 | // 4 | // $Id:$ 5 | // 6 | // Copyright (C) 1993-1996 by id Software, Inc. 7 | // 8 | // This source is available for distribution and/or modification 9 | // only under the terms of the DOOM Source Code License as 10 | // published by id Software. All rights reserved. 11 | // 12 | // The source is distributed in the hope that it will be useful, 13 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | // FITNESS FOR A PARTICULAR PURPOSE. See the DOOM Source Code License 15 | // for more details. 16 | // 17 | // DESCRIPTION: 18 | // Refresh module, data I/O, caching, retrieval of graphics 19 | // by name. 20 | // 21 | //----------------------------------------------------------------------------- 22 | 23 | 24 | #ifndef __R_DATA__ 25 | #define __R_DATA__ 26 | 27 | #include "r_defs.h" 28 | #include "r_state.h" 29 | 30 | #ifdef __GNUG__ 31 | #pragma interface 32 | #endif 33 | 34 | // Retrieve column data for span blitting. 35 | byte* 36 | R_GetColumn 37 | ( int tex, 38 | int col ); 39 | 40 | 41 | // I/O, setting up the stuff. 42 | void R_InitData (void); 43 | void R_PrecacheLevel (void); 44 | 45 | 46 | // Retrieval. 47 | // Floor/ceiling opaque texture tiles, 48 | // lookup by name. For animation? 49 | int R_FlatNumForName (char* name); 50 | 51 | 52 | // Called by P_Ticker for switches and animations, 53 | // returns the texture number for the texture name. 54 | int R_TextureNumForName (char *name); 55 | int R_CheckTextureNumForName (char *name); 56 | 57 | #endif 58 | //----------------------------------------------------------------------------- 59 | // 60 | // $Log:$ 61 | // 62 | //----------------------------------------------------------------------------- 63 | -------------------------------------------------------------------------------- /hu_stuff.h: -------------------------------------------------------------------------------- 1 | // Emacs style mode select -*- C++ -*- 2 | //----------------------------------------------------------------------------- 3 | // 4 | // $Id:$ 5 | // 6 | // Copyright (C) 1993-1996 by id Software, Inc. 7 | // 8 | // This source is available for distribution and/or modification 9 | // only under the terms of the DOOM Source Code License as 10 | // published by id Software. All rights reserved. 11 | // 12 | // The source is distributed in the hope that it will be useful, 13 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | // FITNESS FOR A PARTICULAR PURPOSE. See the DOOM Source Code License 15 | // for more details. 16 | // 17 | // DESCRIPTION: Head up display 18 | // 19 | //----------------------------------------------------------------------------- 20 | 21 | #ifndef __HU_STUFF_H__ 22 | #define __HU_STUFF_H__ 23 | 24 | #include "d_event.h" 25 | 26 | 27 | // 28 | // Globally visible constants. 29 | // 30 | #define HU_FONTSTART '!' // the first font characters 31 | #define HU_FONTEND '_' // the last font characters 32 | 33 | // Calculate # of glyphs in font. 34 | #define HU_FONTSIZE (HU_FONTEND - HU_FONTSTART + 1) 35 | 36 | #define HU_BROADCAST 5 37 | 38 | #define HU_MSGREFRESH KEY_ENTER 39 | #define HU_MSGX 0 40 | #define HU_MSGY 0 41 | #define HU_MSGWIDTH 64 // in characters 42 | #define HU_MSGHEIGHT 1 // in lines 43 | 44 | #define HU_MSGTIMEOUT (4*TICRATE) 45 | 46 | // 47 | // HEADS UP TEXT 48 | // 49 | 50 | void HU_Init(void); 51 | void HU_Start(void); 52 | 53 | boolean HU_Responder(event_t* ev); 54 | 55 | void HU_Ticker(void); 56 | void HU_Drawer(void); 57 | char HU_dequeueChatChar(void); 58 | void HU_Erase(void); 59 | 60 | 61 | #endif 62 | //----------------------------------------------------------------------------- 63 | // 64 | // $Log:$ 65 | // 66 | //----------------------------------------------------------------------------- 67 | -------------------------------------------------------------------------------- /m_menu.h: -------------------------------------------------------------------------------- 1 | // Emacs style mode select -*- C++ -*- 2 | //----------------------------------------------------------------------------- 3 | // 4 | // $Id:$ 5 | // 6 | // Copyright (C) 1993-1996 by id Software, Inc. 7 | // 8 | // This source is available for distribution and/or modification 9 | // only under the terms of the DOOM Source Code License as 10 | // published by id Software. All rights reserved. 11 | // 12 | // The source is distributed in the hope that it will be useful, 13 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | // FITNESS FOR A PARTICULAR PURPOSE. See the DOOM Source Code License 15 | // for more details. 16 | // 17 | // DESCRIPTION: 18 | // Menu widget stuff, episode selection and such. 19 | // 20 | //----------------------------------------------------------------------------- 21 | 22 | 23 | #ifndef __M_MENU__ 24 | #define __M_MENU__ 25 | 26 | 27 | 28 | #include "d_event.h" 29 | 30 | // 31 | // MENUS 32 | // 33 | // Called by main loop, 34 | // saves config file and calls I_Quit when user exits. 35 | // Even when the menu is not displayed, 36 | // this can resize the view and change game parameters. 37 | // Does all the real work of the menu interaction. 38 | boolean M_Responder (event_t *ev); 39 | 40 | 41 | // Called by main loop, 42 | // only used for menu (skull cursor) animation. 43 | void M_Ticker (void); 44 | 45 | // Called by main loop, 46 | // draws the menus directly into the screen buffer. 47 | void M_Drawer (void); 48 | 49 | // Called by D_DoomMain, 50 | // loads the config file. 51 | void M_Init (void); 52 | 53 | // Called by intro code to force menu up upon a keypress, 54 | // does nothing if menu is already up. 55 | void M_StartControlPanel (void); 56 | 57 | 58 | 59 | 60 | 61 | 62 | #endif 63 | //----------------------------------------------------------------------------- 64 | // 65 | // $Log:$ 66 | // 67 | //----------------------------------------------------------------------------- 68 | -------------------------------------------------------------------------------- /r_bsp.h: -------------------------------------------------------------------------------- 1 | // Emacs style mode select -*- C++ -*- 2 | //----------------------------------------------------------------------------- 3 | // 4 | // $Id:$ 5 | // 6 | // Copyright (C) 1993-1996 by id Software, Inc. 7 | // 8 | // This source is available for distribution and/or modification 9 | // only under the terms of the DOOM Source Code License as 10 | // published by id Software. All rights reserved. 11 | // 12 | // The source is distributed in the hope that it will be useful, 13 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | // FITNESS FOR A PARTICULAR PURPOSE. See the DOOM Source Code License 15 | // for more details. 16 | // 17 | // DESCRIPTION: 18 | // Refresh module, BSP traversal and handling. 19 | // 20 | //----------------------------------------------------------------------------- 21 | 22 | 23 | #ifndef __R_BSP__ 24 | #define __R_BSP__ 25 | 26 | #ifdef __GNUG__ 27 | #pragma interface 28 | #endif 29 | 30 | 31 | extern seg_t* curline; 32 | extern side_t* sidedef; 33 | extern line_t* linedef; 34 | extern sector_t* frontsector; 35 | extern sector_t* backsector; 36 | 37 | extern int rw_x; 38 | extern int rw_stopx; 39 | 40 | extern boolean segtextured; 41 | 42 | // false if the back side is the same plane 43 | extern boolean markfloor; 44 | extern boolean markceiling; 45 | 46 | extern boolean skymap; 47 | 48 | extern drawseg_t drawsegs[MAXDRAWSEGS]; 49 | extern drawseg_t* ds_p; 50 | 51 | extern lighttable_t** hscalelight; 52 | extern lighttable_t** vscalelight; 53 | extern lighttable_t** dscalelight; 54 | 55 | 56 | typedef void (*drawfunc_t) (int start, int stop); 57 | 58 | 59 | // BSP? 60 | void R_ClearClipSegs (void); 61 | void R_ClearDrawSegs (void); 62 | 63 | 64 | void R_RenderBSPNode (int bspnum); 65 | 66 | 67 | #endif 68 | //----------------------------------------------------------------------------- 69 | // 70 | // $Log:$ 71 | // 72 | //----------------------------------------------------------------------------- 73 | -------------------------------------------------------------------------------- /m_fixed.c: -------------------------------------------------------------------------------- 1 | // Emacs style mode select -*- C++ -*- 2 | //----------------------------------------------------------------------------- 3 | // 4 | // $Id:$ 5 | // 6 | // Copyright (C) 1993-1996 by id Software, Inc. 7 | // 8 | // This source is available for distribution and/or modification 9 | // only under the terms of the DOOM Source Code License as 10 | // published by id Software. All rights reserved. 11 | // 12 | // The source is distributed in the hope that it will be useful, 13 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | // FITNESS FOR A PARTICULAR PURPOSE. See the DOOM Source Code License 15 | // for more details. 16 | // 17 | // $Log:$ 18 | // 19 | // DESCRIPTION: 20 | // Fixed point implementation. 21 | // 22 | //----------------------------------------------------------------------------- 23 | 24 | 25 | static const char 26 | rcsid[] = "$Id: m_bbox.c,v 1.1 1997/02/03 22:45:10 b1 Exp $"; 27 | 28 | #include "stdlib.h" 29 | 30 | #include "doomtype.h" 31 | #include "i_system.h" 32 | 33 | #ifdef __GNUG__ 34 | #pragma implementation "m_fixed.h" 35 | #endif 36 | #include "m_fixed.h" 37 | 38 | 39 | 40 | 41 | // Fixme. __USE_C_FIXED__ or something. 42 | 43 | fixed_t 44 | FixedMul 45 | ( fixed_t a, 46 | fixed_t b ) 47 | { 48 | return ((long long) a * (long long) b) >> FRACBITS; 49 | } 50 | 51 | 52 | 53 | // 54 | // FixedDiv, C version. 55 | // 56 | 57 | fixed_t 58 | FixedDiv 59 | ( fixed_t a, 60 | fixed_t b ) 61 | { 62 | if ( (abs(a)>>14) >= abs(b)) 63 | return (a^b)<0 ? MININT : MAXINT; 64 | return FixedDiv2 (a,b); 65 | } 66 | 67 | 68 | 69 | fixed_t 70 | FixedDiv2 71 | ( fixed_t a, 72 | fixed_t b ) 73 | { 74 | #if 0 75 | long long c; 76 | c = ((long long)a<<16) / ((long long)b); 77 | return (fixed_t) c; 78 | #endif 79 | 80 | double c; 81 | 82 | c = ((double)a) / ((double)b) * FRACUNIT; 83 | 84 | if (c >= 2147483648.0 || c < -2147483648.0) 85 | I_Error("FixedDiv: divide by zero"); 86 | return (fixed_t) c; 87 | } 88 | -------------------------------------------------------------------------------- /r_plane.h: -------------------------------------------------------------------------------- 1 | // Emacs style mode select -*- C++ -*- 2 | //----------------------------------------------------------------------------- 3 | // 4 | // $Id:$ 5 | // 6 | // Copyright (C) 1993-1996 by id Software, Inc. 7 | // 8 | // This source is available for distribution and/or modification 9 | // only under the terms of the DOOM Source Code License as 10 | // published by id Software. All rights reserved. 11 | // 12 | // The source is distributed in the hope that it will be useful, 13 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | // FITNESS FOR A PARTICULAR PURPOSE. See the DOOM Source Code License 15 | // for more details. 16 | // 17 | // DESCRIPTION: 18 | // Refresh, visplane stuff (floor, ceilings). 19 | // 20 | //----------------------------------------------------------------------------- 21 | 22 | 23 | #ifndef __R_PLANE__ 24 | #define __R_PLANE__ 25 | 26 | 27 | #include "r_data.h" 28 | 29 | #ifdef __GNUG__ 30 | #pragma interface 31 | #endif 32 | 33 | 34 | // Visplane related. 35 | extern short* lastopening; 36 | 37 | 38 | typedef void (*planefunction_t) (int top, int bottom); 39 | 40 | extern planefunction_t floorfunc; 41 | extern planefunction_t ceilingfunc_t; 42 | 43 | extern short floorclip[SCREENWIDTH]; 44 | extern short ceilingclip[SCREENWIDTH]; 45 | 46 | extern fixed_t yslope[SCREENHEIGHT]; 47 | extern fixed_t distscale[SCREENWIDTH]; 48 | 49 | void R_InitPlanes (void); 50 | void R_ClearPlanes (void); 51 | 52 | void 53 | R_MapPlane 54 | ( int y, 55 | int x1, 56 | int x2 ); 57 | 58 | void 59 | R_MakeSpans 60 | ( int x, 61 | int t1, 62 | int b1, 63 | int t2, 64 | int b2 ); 65 | 66 | void R_DrawPlanes (void); 67 | 68 | visplane_t* 69 | R_FindPlane 70 | ( fixed_t height, 71 | int picnum, 72 | int lightlevel ); 73 | 74 | visplane_t* 75 | R_CheckPlane 76 | ( visplane_t* pl, 77 | int start, 78 | int stop ); 79 | 80 | 81 | 82 | #endif 83 | //----------------------------------------------------------------------------- 84 | // 85 | // $Log:$ 86 | // 87 | //----------------------------------------------------------------------------- 88 | -------------------------------------------------------------------------------- /d_think.h: -------------------------------------------------------------------------------- 1 | // Emacs style mode select -*- C++ -*- 2 | //----------------------------------------------------------------------------- 3 | // 4 | // $Id:$ 5 | // 6 | // Copyright (C) 1993-1996 by id Software, Inc. 7 | // 8 | // This source is available for distribution and/or modification 9 | // only under the terms of the DOOM Source Code License as 10 | // published by id Software. All rights reserved. 11 | // 12 | // The source is distributed in the hope that it will be useful, 13 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | // FITNESS FOR A PARTICULAR PURPOSE. See the DOOM Source Code License 15 | // for more details. 16 | // 17 | // DESCRIPTION: 18 | // MapObj data. Map Objects or mobjs are actors, entities, 19 | // thinker, take-your-pick... anything that moves, acts, or 20 | // suffers state changes of more or less violent nature. 21 | // 22 | //----------------------------------------------------------------------------- 23 | 24 | 25 | #ifndef __D_THINK__ 26 | #define __D_THINK__ 27 | 28 | 29 | #ifdef __GNUG__ 30 | #pragma interface 31 | #endif 32 | 33 | 34 | 35 | // 36 | // Experimental stuff. 37 | // To compile this as "ANSI C with classes" 38 | // we will need to handle the various 39 | // action functions cleanly. 40 | // 41 | typedef void (*actionf_v)(); 42 | typedef void (*actionf_p1)( void* ); 43 | typedef void (*actionf_p2)( void*, void* ); 44 | 45 | typedef union 46 | { 47 | actionf_p1 acp1; 48 | actionf_v acv; 49 | actionf_p2 acp2; 50 | 51 | } actionf_t; 52 | 53 | 54 | 55 | 56 | 57 | // Historically, "think_t" is yet another 58 | // function pointer to a routine to handle 59 | // an actor. 60 | typedef actionf_t think_t; 61 | 62 | 63 | // Doubly linked list of actors. 64 | typedef struct thinker_s 65 | { 66 | struct thinker_s* prev; 67 | struct thinker_s* next; 68 | think_t function; 69 | 70 | } thinker_t; 71 | 72 | 73 | 74 | #endif 75 | //----------------------------------------------------------------------------- 76 | // 77 | // $Log:$ 78 | // 79 | //----------------------------------------------------------------------------- 80 | -------------------------------------------------------------------------------- /w_wad.h: -------------------------------------------------------------------------------- 1 | // Emacs style mode select -*- C++ -*- 2 | //----------------------------------------------------------------------------- 3 | // 4 | // $Id:$ 5 | // 6 | // Copyright (C) 1993-1996 by id Software, Inc. 7 | // 8 | // This source is available for distribution and/or modification 9 | // only under the terms of the DOOM Source Code License as 10 | // published by id Software. All rights reserved. 11 | // 12 | // The source is distributed in the hope that it will be useful, 13 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | // FITNESS FOR A PARTICULAR PURPOSE. See the DOOM Source Code License 15 | // for more details. 16 | // 17 | // DESCRIPTION: 18 | // WAD I/O functions. 19 | // 20 | //----------------------------------------------------------------------------- 21 | 22 | 23 | #ifndef __W_WAD__ 24 | #define __W_WAD__ 25 | 26 | 27 | #ifdef __GNUG__ 28 | #pragma interface 29 | #endif 30 | 31 | 32 | // 33 | // TYPES 34 | // 35 | typedef struct 36 | { 37 | // Should be "IWAD" or "PWAD". 38 | char identification[4]; 39 | int numlumps; 40 | int infotableofs; 41 | 42 | } wadinfo_t; 43 | 44 | 45 | typedef struct 46 | { 47 | int filepos; 48 | int size; 49 | char name[8]; 50 | 51 | } filelump_t; 52 | 53 | // 54 | // WADFILE I/O related stuff. 55 | // 56 | typedef struct 57 | { 58 | char name[8]; 59 | int handle; 60 | int position; 61 | int size; 62 | } lumpinfo_t; 63 | 64 | 65 | extern void** lumpcache; 66 | extern lumpinfo_t* lumpinfo; 67 | extern int numlumps; 68 | 69 | void W_InitMultipleFiles (char** filenames); 70 | void W_Reload (void); 71 | 72 | int W_CheckNumForName (char* name); 73 | int W_GetNumForName (char* name); 74 | 75 | int W_LumpLength (int lump); 76 | void W_ReadLump (int lump, void *dest); 77 | 78 | void* W_CacheLumpNum (int lump, int tag); 79 | void* W_CacheLumpName (char* name, int tag); 80 | 81 | 82 | 83 | 84 | #endif 85 | //----------------------------------------------------------------------------- 86 | // 87 | // $Log:$ 88 | // 89 | //----------------------------------------------------------------------------- 90 | -------------------------------------------------------------------------------- /r_things.h: -------------------------------------------------------------------------------- 1 | // Emacs style mode select -*- C++ -*- 2 | //----------------------------------------------------------------------------- 3 | // 4 | // $Id:$ 5 | // 6 | // Copyright (C) 1993-1996 by id Software, Inc. 7 | // 8 | // This source is available for distribution and/or modification 9 | // only under the terms of the DOOM Source Code License as 10 | // published by id Software. All rights reserved. 11 | // 12 | // The source is distributed in the hope that it will be useful, 13 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | // FITNESS FOR A PARTICULAR PURPOSE. See the DOOM Source Code License 15 | // for more details. 16 | // 17 | // DESCRIPTION: 18 | // Rendering of moving objects, sprites. 19 | // 20 | //----------------------------------------------------------------------------- 21 | 22 | 23 | #ifndef __R_THINGS__ 24 | #define __R_THINGS__ 25 | 26 | 27 | #ifdef __GNUG__ 28 | #pragma interface 29 | #endif 30 | 31 | #define MAXVISSPRITES 128 32 | 33 | extern vissprite_t vissprites[MAXVISSPRITES]; 34 | extern vissprite_t* vissprite_p; 35 | extern vissprite_t vsprsortedhead; 36 | 37 | // Constant arrays used for psprite clipping 38 | // and initializing clipping. 39 | extern short negonearray[SCREENWIDTH]; 40 | extern short screenheightarray[SCREENWIDTH]; 41 | 42 | // vars for R_DrawMaskedColumn 43 | extern short* mfloorclip; 44 | extern short* mceilingclip; 45 | extern fixed_t spryscale; 46 | extern fixed_t sprtopscreen; 47 | 48 | extern fixed_t pspritescale; 49 | extern fixed_t pspriteiscale; 50 | 51 | 52 | void R_DrawMaskedColumn (column_t* column); 53 | 54 | 55 | void R_SortVisSprites (void); 56 | 57 | void R_AddSprites (sector_t* sec); 58 | void R_AddPSprites (void); 59 | void R_DrawSprites (void); 60 | void R_InitSprites (char** namelist); 61 | void R_ClearSprites (void); 62 | void R_DrawMasked (void); 63 | 64 | void 65 | R_ClipVisSprite 66 | ( vissprite_t* vis, 67 | int xl, 68 | int xh ); 69 | 70 | 71 | #endif 72 | //----------------------------------------------------------------------------- 73 | // 74 | // $Log:$ 75 | // 76 | //----------------------------------------------------------------------------- 77 | -------------------------------------------------------------------------------- /p_pspr.h: -------------------------------------------------------------------------------- 1 | // Emacs style mode select -*- C++ -*- 2 | //----------------------------------------------------------------------------- 3 | // 4 | // $Id:$ 5 | // 6 | // Copyright (C) 1993-1996 by id Software, Inc. 7 | // 8 | // This source is available for distribution and/or modification 9 | // only under the terms of the DOOM Source Code License as 10 | // published by id Software. All rights reserved. 11 | // 12 | // The source is distributed in the hope that it will be useful, 13 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | // FITNESS FOR A PARTICULAR PURPOSE. See the DOOM Source Code License 15 | // for more details. 16 | // 17 | // DESCRIPTION: 18 | // Sprite animation. 19 | // 20 | //----------------------------------------------------------------------------- 21 | 22 | 23 | #ifndef __P_PSPR__ 24 | #define __P_PSPR__ 25 | 26 | // Basic data types. 27 | // Needs fixed point, and BAM angles. 28 | #include "m_fixed.h" 29 | #include "tables.h" 30 | 31 | 32 | // 33 | // Needs to include the precompiled 34 | // sprite animation tables. 35 | // Header generated by multigen utility. 36 | // This includes all the data for thing animation, 37 | // i.e. the Thing Atrributes table 38 | // and the Frame Sequence table. 39 | #include "info.h" 40 | 41 | #ifdef __GNUG__ 42 | #pragma interface 43 | #endif 44 | 45 | 46 | // 47 | // Frame flags: 48 | // handles maximum brightness (torches, muzzle flare, light sources) 49 | // 50 | #define FF_FULLBRIGHT 0x8000 // flag in thing->frame 51 | #define FF_FRAMEMASK 0x7fff 52 | 53 | 54 | 55 | // 56 | // Overlay psprites are scaled shapes 57 | // drawn directly on the view screen, 58 | // coordinates are given for a 320*200 view screen. 59 | // 60 | typedef enum 61 | { 62 | ps_weapon, 63 | ps_flash, 64 | NUMPSPRITES 65 | 66 | } psprnum_t; 67 | 68 | typedef struct 69 | { 70 | state_t* state; // a NULL state means not active 71 | int tics; 72 | fixed_t sx; 73 | fixed_t sy; 74 | 75 | } pspdef_t; 76 | 77 | #endif 78 | //----------------------------------------------------------------------------- 79 | // 80 | // $Log:$ 81 | // 82 | //----------------------------------------------------------------------------- 83 | -------------------------------------------------------------------------------- /g_game.h: -------------------------------------------------------------------------------- 1 | // Emacs style mode select -*- C++ -*- 2 | //----------------------------------------------------------------------------- 3 | // 4 | // $Id:$ 5 | // 6 | // Copyright (C) 1993-1996 by id Software, Inc. 7 | // 8 | // This source is available for distribution and/or modification 9 | // only under the terms of the DOOM Source Code License as 10 | // published by id Software. All rights reserved. 11 | // 12 | // The source is distributed in the hope that it will be useful, 13 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | // FITNESS FOR A PARTICULAR PURPOSE. See the DOOM Source Code License 15 | // for more details. 16 | // 17 | // DESCRIPTION: 18 | // Duh. 19 | // 20 | //----------------------------------------------------------------------------- 21 | 22 | 23 | #ifndef __G_GAME__ 24 | #define __G_GAME__ 25 | 26 | #include "doomdef.h" 27 | #include "d_event.h" 28 | 29 | 30 | 31 | // 32 | // GAME 33 | // 34 | void G_DeathMatchSpawnPlayer (int playernum); 35 | 36 | void G_InitNew (skill_t skill, int episode, int map); 37 | 38 | // Can be called by the startup code or M_Responder. 39 | // A normal game starts at map 1, 40 | // but a warp test can start elsewhere 41 | void G_DeferedInitNew (skill_t skill, int episode, int map); 42 | 43 | void G_DeferedPlayDemo (char* demo); 44 | 45 | // Can be called by the startup code or M_Responder, 46 | // calls P_SetupLevel or W_EnterWorld. 47 | void G_LoadGame (char* name); 48 | 49 | void G_DoLoadGame (void); 50 | 51 | // Called by M_Responder. 52 | void G_SaveGame (int slot, char* description); 53 | 54 | // Only called by startup code. 55 | void G_RecordDemo (char* name); 56 | 57 | void G_BeginRecording (void); 58 | 59 | void G_PlayDemo (char* name); 60 | void G_TimeDemo (char* name); 61 | boolean G_CheckDemoStatus (void); 62 | 63 | void G_ExitLevel (void); 64 | void G_SecretExitLevel (void); 65 | 66 | void G_WorldDone (void); 67 | 68 | void G_Ticker (void); 69 | boolean G_Responder (event_t* ev); 70 | 71 | void G_ScreenShot (void); 72 | 73 | 74 | #endif 75 | //----------------------------------------------------------------------------- 76 | // 77 | // $Log:$ 78 | // 79 | //----------------------------------------------------------------------------- 80 | -------------------------------------------------------------------------------- /st_stuff.h: -------------------------------------------------------------------------------- 1 | // Emacs style mode select -*- C++ -*- 2 | //----------------------------------------------------------------------------- 3 | // 4 | // $Id:$ 5 | // 6 | // Copyright (C) 1993-1996 by id Software, Inc. 7 | // 8 | // This source is available for distribution and/or modification 9 | // only under the terms of the DOOM Source Code License as 10 | // published by id Software. All rights reserved. 11 | // 12 | // The source is distributed in the hope that it will be useful, 13 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | // FITNESS FOR A PARTICULAR PURPOSE. See the DOOM Source Code License 15 | // for more details. 16 | // 17 | // DESCRIPTION: 18 | // Status bar code. 19 | // Does the face/direction indicator animatin. 20 | // Does palette indicators as well (red pain/berserk, bright pickup) 21 | // 22 | //----------------------------------------------------------------------------- 23 | 24 | #ifndef __STSTUFF_H__ 25 | #define __STSTUFF_H__ 26 | 27 | #include "doomtype.h" 28 | #include "d_event.h" 29 | 30 | // Size of statusbar. 31 | // Now sensitive for scaling. 32 | #define ST_HEIGHT 32*SCREEN_MUL 33 | #define ST_WIDTH SCREENWIDTH 34 | #define ST_Y (SCREENHEIGHT - ST_HEIGHT) 35 | 36 | 37 | // 38 | // STATUS BAR 39 | // 40 | 41 | // Called by main loop. 42 | boolean ST_Responder (event_t* ev); 43 | 44 | // Called by main loop. 45 | void ST_Ticker (void); 46 | 47 | // Called by main loop. 48 | void ST_Drawer (boolean fullscreen, boolean refresh); 49 | 50 | // Called when the console player is spawned on each level. 51 | void ST_Start (void); 52 | 53 | // Called by startup code. 54 | void ST_Init (void); 55 | 56 | 57 | 58 | // States for status bar code. 59 | typedef enum 60 | { 61 | AutomapState, 62 | FirstPersonState 63 | 64 | } st_stateenum_t; 65 | 66 | 67 | // States for the chat code. 68 | typedef enum 69 | { 70 | StartChatState, 71 | WaitDestState, 72 | GetChatState 73 | 74 | } st_chatstateenum_t; 75 | 76 | 77 | boolean ST_Responder(event_t* ev); 78 | 79 | 80 | 81 | #endif 82 | //----------------------------------------------------------------------------- 83 | // 84 | // $Log:$ 85 | // 86 | //----------------------------------------------------------------------------- 87 | -------------------------------------------------------------------------------- /doomtype.h: -------------------------------------------------------------------------------- 1 | // Emacs style mode select -*- C++ -*- 2 | //----------------------------------------------------------------------------- 3 | // 4 | // $Id:$ 5 | // 6 | // Copyright (C) 1993-1996 by id Software, Inc. 7 | // 8 | // This source is available for distribution and/or modification 9 | // only under the terms of the DOOM Source Code License as 10 | // published by id Software. All rights reserved. 11 | // 12 | // The source is distributed in the hope that it will be useful, 13 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | // FITNESS FOR A PARTICULAR PURPOSE. See the DOOM Source Code License 15 | // for more details. 16 | // 17 | // DESCRIPTION: 18 | // Simple basic typedefs, isolated here to make it easier 19 | // separating modules. 20 | // 21 | //----------------------------------------------------------------------------- 22 | 23 | 24 | #ifndef __DOOMTYPE__ 25 | #define __DOOMTYPE__ 26 | 27 | 28 | #ifndef __BYTEBOOL__ 29 | #define __BYTEBOOL__ 30 | // Fixed to use builtin bool type with C++. 31 | #ifdef __cplusplus 32 | typedef bool boolean; 33 | #else 34 | #ifdef __BEOS__ /* boolean is a builtin type for MWCC */ 35 | #define boolean D_BOOL 36 | #undef false 37 | #define false D_false 38 | #undef true 39 | #define true D_true 40 | #endif 41 | typedef enum {false, true} boolean; 42 | #endif 43 | typedef unsigned char byte; 44 | #endif 45 | 46 | 47 | // Predefined with some OS. 48 | #ifdef LINUX 49 | #include 50 | #else 51 | #ifndef MAXCHAR 52 | #define MAXCHAR ((char)0x7f) 53 | #endif 54 | #ifndef MAXSHORT 55 | #define MAXSHORT ((short)0x7fff) 56 | #endif 57 | 58 | // Max pos 32-bit int. 59 | #ifndef MAXINT 60 | #define MAXINT ((int)0x7fffffff) 61 | #endif 62 | #ifndef MAXLONG 63 | #define MAXLONG ((long)0x7fffffff) 64 | #endif 65 | #ifndef MINCHAR 66 | #define MINCHAR ((char)0x80) 67 | #endif 68 | #ifndef MINSHORT 69 | #define MINSHORT ((short)0x8000) 70 | #endif 71 | 72 | // Max negative 32-bit integer. 73 | #ifndef MININT 74 | #define MININT ((int)0x80000000) 75 | #endif 76 | #ifndef MINLONG 77 | #define MINLONG ((long)0x80000000) 78 | #endif 79 | #endif 80 | 81 | 82 | 83 | 84 | #endif 85 | //----------------------------------------------------------------------------- 86 | // 87 | // $Log:$ 88 | // 89 | //----------------------------------------------------------------------------- 90 | -------------------------------------------------------------------------------- /README.book: -------------------------------------------------------------------------------- 1 | 2 | The DOOM Book 3 | 4 | Shortly after the Wolfenstein 3D source release, 5 | I sent a mail to Jay Wilbur suggesting a book 6 | about the DOOM engine. I anticipated a similar 7 | release of the DOOM sources within a year or 8 | two, and the obvious problems with the Wolfenstein 9 | sources (lack of accompanying artwork, a code 10 | base not maintained for quite some time) seemed 11 | to demand a better approach. I talked to some 12 | publishing company reps at the Book Fair in 1995, 13 | and while they were cautiously interested, id was 14 | not. 15 | 16 | In the last weeks of 1996, following a visit at 17 | id Software two months earlier, and after the 18 | departure of Jay Wilbur, John Carmack asked me 19 | whether I was still interested in doing the book. 20 | I was, Bear sent me a code dump, and Todd 21 | Hollenshead set out to address the legal concerns 22 | (of which were many). 23 | 24 | Unfortunately, what might have worked in 1995 25 | turned out to be a doomed attempt in 1997. I won't 26 | go into the details - let's just say that my 27 | leaving university and going back to full time 28 | writing for a living repeatedly forced me to 29 | change priorities on what looked more and more 30 | like a project unlikely to generate any revenue. 31 | 32 | By mid of the year, when the legal issues had 33 | finally been settled, it didn't look like I was 34 | going to find a publisher at all. Following the 35 | Book Fair in 1997 and some more discussions 36 | (with about a dozen publishers, total), I gritted 37 | my teeth and decided to abandon the project. 38 | 39 | Note that the book project as such wasn't supposed 40 | to hold up the source release to the public. 41 | However, given the legal concerns relating to 42 | the third party sound code in DOS DOOM, and the 43 | lack of Win32 support as well as the advantages of 44 | an OpenGL based release, the idea was to put 45 | together a consistent, stable code base prior to 46 | public release - most of which was supposed to be 47 | an offspring of my reformatting and modifying the 48 | code for the book. 49 | 50 | None of this worked out as intended. However, I 51 | hope that, at long last, this distribution 52 | will finally provide a good point to start for 53 | any cooperative effort to extend the already 54 | impressive lifespan of DOOM into the age of 55 | multiplayer servers and hardware-accelerated 56 | clients. 57 | 58 | -------------------------------------------------------------------------------- /m_cheat.c: -------------------------------------------------------------------------------- 1 | // Emacs style mode select -*- C++ -*- 2 | //----------------------------------------------------------------------------- 3 | // 4 | // $Id:$ 5 | // 6 | // Copyright (C) 1993-1996 by id Software, Inc. 7 | // 8 | // This source is available for distribution and/or modification 9 | // only under the terms of the DOOM Source Code License as 10 | // published by id Software. All rights reserved. 11 | // 12 | // The source is distributed in the hope that it will be useful, 13 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | // FITNESS FOR A PARTICULAR PURPOSE. See the DOOM Source Code License 15 | // for more details. 16 | // 17 | // $Log:$ 18 | // 19 | // DESCRIPTION: 20 | // Cheat sequence checking. 21 | // 22 | //----------------------------------------------------------------------------- 23 | 24 | 25 | static const char 26 | rcsid[] = "$Id: m_cheat.c,v 1.1 1997/02/03 21:24:34 b1 Exp $"; 27 | 28 | #include "m_cheat.h" 29 | 30 | // 31 | // CHEAT SEQUENCE PACKAGE 32 | // 33 | 34 | static int firsttime = 1; 35 | static unsigned char cheat_xlate_table[256]; 36 | 37 | 38 | // 39 | // Called in st_stuff module, which handles the input. 40 | // Returns a 1 if the cheat was successful, 0 if failed. 41 | // 42 | int 43 | cht_CheckCheat 44 | ( cheatseq_t* cht, 45 | char key ) 46 | { 47 | int i; 48 | int rc = 0; 49 | 50 | if (firsttime) 51 | { 52 | firsttime = 0; 53 | for (i=0;i<256;i++) cheat_xlate_table[i] = SCRAMBLE(i); 54 | } 55 | 56 | if (!cht->p) 57 | cht->p = cht->sequence; // initialize if first time 58 | 59 | if (*cht->p == 0) 60 | *(cht->p++) = key; 61 | else if 62 | (cheat_xlate_table[(unsigned char)key] == *cht->p) cht->p++; 63 | else 64 | cht->p = cht->sequence; 65 | 66 | if (*cht->p == 1) 67 | cht->p++; 68 | else if (*cht->p == 0xff) // end of sequence character 69 | { 70 | cht->p = cht->sequence; 71 | rc = 1; 72 | } 73 | 74 | return rc; 75 | } 76 | 77 | void 78 | cht_GetParam 79 | ( cheatseq_t* cht, 80 | char* buffer ) 81 | { 82 | 83 | unsigned char *p, c; 84 | 85 | p = cht->sequence; 86 | while (*(p++) != 1); 87 | 88 | do 89 | { 90 | c = *p; 91 | *(buffer++) = c; 92 | *(p++) = 0; 93 | } 94 | while (c && *p!=0xff ); 95 | 96 | if (*p==0xff) 97 | *buffer = 0; 98 | 99 | } 100 | 101 | 102 | -------------------------------------------------------------------------------- /dstrings.c: -------------------------------------------------------------------------------- 1 | // Emacs style mode select -*- C++ -*- 2 | //----------------------------------------------------------------------------- 3 | // 4 | // $Id:$ 5 | // 6 | // Copyright (C) 1993-1996 by id Software, Inc. 7 | // 8 | // This source is available for distribution and/or modification 9 | // only under the terms of the DOOM Source Code License as 10 | // published by id Software. All rights reserved. 11 | // 12 | // The source is distributed in the hope that it will be useful, 13 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | // FITNESS FOR A PARTICULAR PURPOSE. See the DOOM Source Code License 15 | // for more details. 16 | // 17 | // $Log:$ 18 | // 19 | // DESCRIPTION: 20 | // Globally defined strings. 21 | // 22 | //----------------------------------------------------------------------------- 23 | 24 | static const char 25 | rcsid[] = "$Id: m_bbox.c,v 1.1 1997/02/03 22:45:10 b1 Exp $"; 26 | 27 | 28 | #ifdef __GNUG__ 29 | #pragma implementation "dstrings.h" 30 | #endif 31 | #include "dstrings.h" 32 | 33 | 34 | 35 | char* endmsg[NUM_QUITMESSAGES+1]= 36 | { 37 | // DOOM1 38 | QUITMSG, 39 | "please don't leave, there's more\ndemons to toast!", 40 | "let's beat it -- this is turning\ninto a bloodbath!", 41 | "i wouldn't leave if i were you.\ndos is much worse.", 42 | "you're trying to say you like dos\nbetter than me, right?", 43 | "don't leave yet -- there's a\ndemon around that corner!", 44 | "ya know, next time you come in here\ni'm gonna toast ya.", 45 | "go ahead and leave. see if i care." 46 | 47 | // QuitDOOM II messages 48 | "you want to quit?\nthen, thou hast lost an eighth!", 49 | "don't go now, there's a \ndimensional shambler waiting\nat the dos prompt!", 50 | "get outta here and go back\nto your boring programs.", 51 | "if i were your boss, i'd \n deathmatch ya in a minute!", 52 | "look, bud. you leave now\nand you forfeit your body count!", 53 | "just leave. when you come\nback, i'll be waiting with a bat.", 54 | "you're lucky i don't smack\nyou for thinking about leaving." 55 | 56 | // FinalDOOM? 57 | "fuck you, pussy!\nget the fuck out!", 58 | "you quit and i'll jizz\nin your cystholes!", 59 | "if you leave, i'll make\nthe lord drink my jizz.", 60 | "hey, ron! can we say\n'fuck' in the game?", 61 | "i'd leave: this is just\nmore monsters and levels.\nwhat a load.", 62 | "suck it down, asshole!\nyou're a fucking wimp!", 63 | "don't quit now! we're \nstill spending your money!", 64 | 65 | // Internal debug. Different style, too. 66 | "THIS IS NO MESSAGE!\nPage intentionally left blank." 67 | }; 68 | 69 | 70 | 71 | 72 | 73 | -------------------------------------------------------------------------------- /tables.h: -------------------------------------------------------------------------------- 1 | // Emacs style mode select -*- C++ -*- 2 | //----------------------------------------------------------------------------- 3 | // 4 | // $Id:$ 5 | // 6 | // Copyright (C) 1993-1996 by id Software, Inc. 7 | // 8 | // This source is available for distribution and/or modification 9 | // only under the terms of the DOOM Source Code License as 10 | // published by id Software. All rights reserved. 11 | // 12 | // The source is distributed in the hope that it will be useful, 13 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | // FITNESS FOR A PARTICULAR PURPOSE. See the DOOM Source Code License 15 | // for more details. 16 | // 17 | // DESCRIPTION: 18 | // Lookup tables. 19 | // Do not try to look them up :-). 20 | // In the order of appearance: 21 | // 22 | // int finetangent[4096] - Tangens LUT. 23 | // Should work with BAM fairly well (12 of 16bit, 24 | // effectively, by shifting). 25 | // 26 | // int finesine[10240] - Sine lookup. 27 | // Guess what, serves as cosine, too. 28 | // Remarkable thing is, how to use BAMs with this? 29 | // 30 | // int tantoangle[2049] - ArcTan LUT, 31 | // maps tan(angle) to angle fast. Gotta search. 32 | // 33 | //----------------------------------------------------------------------------- 34 | 35 | 36 | #ifndef __TABLES__ 37 | #define __TABLES__ 38 | 39 | 40 | 41 | #ifndef PI 42 | #define PI 3.141592657 43 | #endif 44 | 45 | 46 | #include "m_fixed.h" 47 | 48 | #define FINEANGLES 8192 49 | #define FINEMASK (FINEANGLES-1) 50 | 51 | 52 | // 0x100000000 to 0x2000 53 | #define ANGLETOFINESHIFT 19 54 | 55 | // Effective size is 10240. 56 | extern fixed_t finesine[5*FINEANGLES/4]; 57 | 58 | // Re-use data, is just PI/2 pahse shift. 59 | extern fixed_t* finecosine; 60 | 61 | 62 | // Effective size is 4096. 63 | extern fixed_t finetangent[FINEANGLES/2]; 64 | 65 | // Binary Angle Measument, BAM. 66 | #define ANG45 0x20000000 67 | #define ANG90 0x40000000 68 | #define ANG180 0x80000000 69 | #define ANG270 0xc0000000 70 | 71 | 72 | #define SLOPERANGE 2048 73 | #define SLOPEBITS 11 74 | #define DBITS (FRACBITS-SLOPEBITS) 75 | 76 | typedef unsigned angle_t; 77 | 78 | 79 | // Effective size is 2049; 80 | // The +1 size is to handle the case when x==y 81 | // without additional checking. 82 | extern angle_t tantoangle[SLOPERANGE+1]; 83 | 84 | 85 | // Utility function, 86 | // called by R_PointToAngle. 87 | int 88 | SlopeDiv 89 | ( unsigned num, 90 | unsigned den); 91 | 92 | 93 | #endif 94 | //----------------------------------------------------------------------------- 95 | // 96 | // $Log:$ 97 | // 98 | //----------------------------------------------------------------------------- 99 | -------------------------------------------------------------------------------- /Makefile.am: -------------------------------------------------------------------------------- 1 | 2 | EXTRA_DIST = \ 3 | Changelog \ 4 | DOOMLIC.TXT \ 5 | FILES \ 6 | FILES2 \ 7 | README.SDL \ 8 | README.asm \ 9 | README.b \ 10 | README.book \ 11 | README.gl \ 12 | TODO 13 | 14 | bin_PROGRAMS = doom 15 | 16 | doom_SOURCES = \ 17 | am_map.c \ 18 | am_map.h \ 19 | d_englsh.h \ 20 | d_event.h \ 21 | d_french.h \ 22 | d_items.c \ 23 | d_items.h \ 24 | d_main.c \ 25 | d_main.h \ 26 | d_net.c \ 27 | d_net.h \ 28 | d_player.h \ 29 | d_textur.h \ 30 | d_think.h \ 31 | d_ticcmd.h \ 32 | doomdata.h \ 33 | doomdef.c \ 34 | doomdef.h \ 35 | doomstat.c \ 36 | doomstat.h \ 37 | doomtype.h \ 38 | dstrings.c \ 39 | dstrings.h \ 40 | f_finale.c \ 41 | f_finale.h \ 42 | f_wipe.c \ 43 | f_wipe.h \ 44 | g_game.c \ 45 | g_game.h \ 46 | hu_lib.c \ 47 | hu_lib.h \ 48 | hu_stuff.c \ 49 | hu_stuff.h \ 50 | i_main.c \ 51 | i_net.c \ 52 | i_net.h \ 53 | i_sound.c \ 54 | i_sound.h \ 55 | i_system.c \ 56 | i_system.h \ 57 | i_video.c \ 58 | i_video.h \ 59 | info.c \ 60 | info.h \ 61 | m_argv.c \ 62 | m_argv.h \ 63 | m_bbox.c \ 64 | m_bbox.h \ 65 | m_cheat.c \ 66 | m_cheat.h \ 67 | m_fixed.c \ 68 | m_fixed.h \ 69 | m_menu.c \ 70 | m_menu.h \ 71 | m_misc.c \ 72 | m_misc.h \ 73 | m_random.c \ 74 | m_random.h \ 75 | m_swap.c \ 76 | m_swap.h \ 77 | p_ceilng.c \ 78 | p_doors.c \ 79 | p_enemy.c \ 80 | p_floor.c \ 81 | p_inter.c \ 82 | p_inter.h \ 83 | p_lights.c \ 84 | p_local.h \ 85 | p_map.c \ 86 | p_maputl.c \ 87 | p_mobj.c \ 88 | p_mobj.h \ 89 | p_plats.c \ 90 | p_pspr.c \ 91 | p_pspr.h \ 92 | p_saveg.c \ 93 | p_saveg.h \ 94 | p_setup.c \ 95 | p_setup.h \ 96 | p_sight.c \ 97 | p_spec.c \ 98 | p_spec.h \ 99 | p_switch.c \ 100 | p_telept.c \ 101 | p_tick.c \ 102 | p_tick.h \ 103 | p_user.c \ 104 | r_bsp.c \ 105 | r_bsp.h \ 106 | r_data.c \ 107 | r_data.h \ 108 | r_defs.h \ 109 | r_draw.c \ 110 | r_draw.h \ 111 | r_local.h \ 112 | r_main.c \ 113 | r_main.h \ 114 | r_plane.c \ 115 | r_plane.h \ 116 | r_segs.c \ 117 | r_segs.h \ 118 | r_sky.c \ 119 | r_sky.h \ 120 | r_state.h \ 121 | r_things.c \ 122 | r_things.h \ 123 | s_sound.c \ 124 | s_sound.h \ 125 | sounds.c \ 126 | sounds.h \ 127 | st_lib.c \ 128 | st_lib.h \ 129 | st_stuff.c \ 130 | st_stuff.h \ 131 | tables.c \ 132 | tables.h \ 133 | v_video.c \ 134 | v_video.h \ 135 | w_wad.c \ 136 | w_wad.h \ 137 | wi_stuff.c \ 138 | wi_stuff.h \ 139 | z_zone.c \ 140 | z_zone.h 141 | 142 | doom_LDADD = -lm 143 | 144 | -------------------------------------------------------------------------------- /s_sound.h: -------------------------------------------------------------------------------- 1 | // Emacs style mode select -*- C++ -*- 2 | //----------------------------------------------------------------------------- 3 | // 4 | // $Id:$ 5 | // 6 | // Copyright (C) 1993-1996 by id Software, Inc. 7 | // 8 | // This source is available for distribution and/or modification 9 | // only under the terms of the DOOM Source Code License as 10 | // published by id Software. All rights reserved. 11 | // 12 | // The source is distributed in the hope that it will be useful, 13 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | // FITNESS FOR A PARTICULAR PURPOSE. See the DOOM Source Code License 15 | // for more details. 16 | // 17 | // DESCRIPTION: 18 | // The not so system specific sound interface. 19 | // 20 | //----------------------------------------------------------------------------- 21 | 22 | 23 | #ifndef __S_SOUND__ 24 | #define __S_SOUND__ 25 | 26 | 27 | #ifdef __GNUG__ 28 | #pragma interface 29 | #endif 30 | 31 | 32 | 33 | // 34 | // Initializes sound stuff, including volume 35 | // Sets channels, SFX and music volume, 36 | // allocates channel buffer, sets S_sfx lookup. 37 | // 38 | void 39 | S_Init 40 | ( int sfxVolume, 41 | int musicVolume ); 42 | 43 | 44 | 45 | 46 | // 47 | // Per level startup code. 48 | // Kills playing sounds at start of level, 49 | // determines music if any, changes music. 50 | // 51 | void S_Start(void); 52 | 53 | 54 | // 55 | // Start sound for thing at 56 | // using from sounds.h 57 | // 58 | void 59 | S_StartSound 60 | ( void* origin, 61 | int sound_id ); 62 | 63 | 64 | 65 | // Will start a sound at a given volume. 66 | void 67 | S_StartSoundAtVolume 68 | ( void* origin, 69 | int sound_id, 70 | int volume ); 71 | 72 | 73 | // Stop sound for thing at 74 | void S_StopSound(void* origin); 75 | 76 | 77 | // Start music using from sounds.h 78 | void S_StartMusic(int music_id); 79 | 80 | // Start music using from sounds.h, 81 | // and set whether looping 82 | void 83 | S_ChangeMusic 84 | ( int music_id, 85 | int looping ); 86 | 87 | // Stops the music fer sure. 88 | void S_StopMusic(void); 89 | 90 | // Stop and resume music, during game PAUSE. 91 | void S_PauseSound(void); 92 | void S_ResumeSound(void); 93 | 94 | 95 | // 96 | // Updates music & sounds 97 | // 98 | void S_UpdateSounds(void* listener); 99 | 100 | void S_SetMusicVolume(int volume); 101 | void S_SetSfxVolume(int volume); 102 | 103 | 104 | #endif 105 | //----------------------------------------------------------------------------- 106 | // 107 | // $Log:$ 108 | // 109 | //----------------------------------------------------------------------------- 110 | -------------------------------------------------------------------------------- /v_video.h: -------------------------------------------------------------------------------- 1 | // Emacs style mode select -*- C++ -*- 2 | //----------------------------------------------------------------------------- 3 | // 4 | // $Id:$ 5 | // 6 | // Copyright (C) 1993-1996 by id Software, Inc. 7 | // 8 | // This source is available for distribution and/or modification 9 | // only under the terms of the DOOM Source Code License as 10 | // published by id Software. All rights reserved. 11 | // 12 | // The source is distributed in the hope that it will be useful, 13 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | // FITNESS FOR A PARTICULAR PURPOSE. See the DOOM Source Code License 15 | // for more details. 16 | // 17 | // DESCRIPTION: 18 | // Gamma correction LUT. 19 | // Functions to draw patches (by post) directly to screen. 20 | // Functions to blit a block to the screen. 21 | // 22 | //----------------------------------------------------------------------------- 23 | 24 | 25 | #ifndef __V_VIDEO__ 26 | #define __V_VIDEO__ 27 | 28 | #include "doomtype.h" 29 | 30 | #include "doomdef.h" 31 | 32 | // Needed because we are refering to patches. 33 | #include "r_data.h" 34 | 35 | // 36 | // VIDEO 37 | // 38 | 39 | #define CENTERY (SCREENHEIGHT/2) 40 | 41 | 42 | // Screen 0 is the screen updated by I_Update screen. 43 | // Screen 1 is an extra buffer. 44 | 45 | 46 | 47 | extern byte* screens[5]; 48 | 49 | extern int dirtybox[4]; 50 | 51 | extern byte gammatable[5][256]; 52 | extern int usegamma; 53 | 54 | 55 | 56 | // Allocates buffer screens, call before R_Init. 57 | void V_Init (void); 58 | 59 | 60 | void 61 | V_CopyRect 62 | ( int srcx, 63 | int srcy, 64 | int srcscrn, 65 | int width, 66 | int height, 67 | int destx, 68 | int desty, 69 | int destscrn ); 70 | 71 | void 72 | V_DrawPatch 73 | ( int x, 74 | int y, 75 | int scrn, 76 | patch_t* patch); 77 | 78 | void 79 | V_DrawPatchDirect 80 | ( int x, 81 | int y, 82 | int scrn, 83 | patch_t* patch ); 84 | 85 | 86 | // Draw a linear block of pixels into the view buffer. 87 | void 88 | V_DrawBlock 89 | ( int x, 90 | int y, 91 | int scrn, 92 | int width, 93 | int height, 94 | byte* src ); 95 | 96 | // Reads a linear block of pixels into the view buffer. 97 | void 98 | V_GetBlock 99 | ( int x, 100 | int y, 101 | int scrn, 102 | int width, 103 | int height, 104 | byte* dest ); 105 | 106 | 107 | void 108 | V_MarkRect 109 | ( int x, 110 | int y, 111 | int width, 112 | int height ); 113 | 114 | #endif 115 | //----------------------------------------------------------------------------- 116 | // 117 | // $Log:$ 118 | // 119 | //----------------------------------------------------------------------------- 120 | -------------------------------------------------------------------------------- /d_items.c: -------------------------------------------------------------------------------- 1 | // Emacs style mode select -*- C++ -*- 2 | //----------------------------------------------------------------------------- 3 | // 4 | // $Id:$ 5 | // 6 | // Copyright (C) 1993-1996 by id Software, Inc. 7 | // 8 | // This source is available for distribution and/or modification 9 | // only under the terms of the DOOM Source Code License as 10 | // published by id Software. All rights reserved. 11 | // 12 | // The source is distributed in the hope that it will be useful, 13 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | // FITNESS FOR A PARTICULAR PURPOSE. See the DOOM Source Code License 15 | // for more details. 16 | // 17 | // $Log:$ 18 | // 19 | // DESCRIPTION: 20 | // 21 | //----------------------------------------------------------------------------- 22 | 23 | static const char 24 | rcsid[] = "$Id:$"; 25 | 26 | // We are referring to sprite numbers. 27 | #include "info.h" 28 | 29 | #ifdef __GNUG__ 30 | #pragma implementation "d_items.h" 31 | #endif 32 | #include "d_items.h" 33 | 34 | 35 | // 36 | // PSPRITE ACTIONS for waepons. 37 | // This struct controls the weapon animations. 38 | // 39 | // Each entry is: 40 | // ammo/amunition type 41 | // upstate 42 | // downstate 43 | // readystate 44 | // atkstate, i.e. attack/fire/hit frame 45 | // flashstate, muzzle flash 46 | // 47 | weaponinfo_t weaponinfo[NUMWEAPONS] = 48 | { 49 | { 50 | // fist 51 | am_noammo, 52 | S_PUNCHUP, 53 | S_PUNCHDOWN, 54 | S_PUNCH, 55 | S_PUNCH1, 56 | S_NULL 57 | }, 58 | { 59 | // pistol 60 | am_clip, 61 | S_PISTOLUP, 62 | S_PISTOLDOWN, 63 | S_PISTOL, 64 | S_PISTOL1, 65 | S_PISTOLFLASH 66 | }, 67 | { 68 | // shotgun 69 | am_shell, 70 | S_SGUNUP, 71 | S_SGUNDOWN, 72 | S_SGUN, 73 | S_SGUN1, 74 | S_SGUNFLASH1 75 | }, 76 | { 77 | // chaingun 78 | am_clip, 79 | S_CHAINUP, 80 | S_CHAINDOWN, 81 | S_CHAIN, 82 | S_CHAIN1, 83 | S_CHAINFLASH1 84 | }, 85 | { 86 | // missile launcher 87 | am_misl, 88 | S_MISSILEUP, 89 | S_MISSILEDOWN, 90 | S_MISSILE, 91 | S_MISSILE1, 92 | S_MISSILEFLASH1 93 | }, 94 | { 95 | // plasma rifle 96 | am_cell, 97 | S_PLASMAUP, 98 | S_PLASMADOWN, 99 | S_PLASMA, 100 | S_PLASMA1, 101 | S_PLASMAFLASH1 102 | }, 103 | { 104 | // bfg 9000 105 | am_cell, 106 | S_BFGUP, 107 | S_BFGDOWN, 108 | S_BFG, 109 | S_BFG1, 110 | S_BFGFLASH1 111 | }, 112 | { 113 | // chainsaw 114 | am_noammo, 115 | S_SAWUP, 116 | S_SAWDOWN, 117 | S_SAW, 118 | S_SAW1, 119 | S_NULL 120 | }, 121 | { 122 | // super shotgun 123 | am_shell, 124 | S_DSGUNUP, 125 | S_DSGUNDOWN, 126 | S_DSGUN, 127 | S_DSGUN1, 128 | S_DSGUNFLASH1 129 | }, 130 | }; 131 | 132 | 133 | 134 | 135 | 136 | 137 | 138 | 139 | -------------------------------------------------------------------------------- /z_zone.h: -------------------------------------------------------------------------------- 1 | // Emacs style mode select -*- C++ -*- 2 | //----------------------------------------------------------------------------- 3 | // 4 | // $Id:$ 5 | // 6 | // Copyright (C) 1993-1996 by id Software, Inc. 7 | // 8 | // This source is available for distribution and/or modification 9 | // only under the terms of the DOOM Source Code License as 10 | // published by id Software. All rights reserved. 11 | // 12 | // The source is distributed in the hope that it will be useful, 13 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | // FITNESS FOR A PARTICULAR PURPOSE. See the DOOM Source Code License 15 | // for more details. 16 | // 17 | // DESCRIPTION: 18 | // Zone Memory Allocation, perhaps NeXT ObjectiveC inspired. 19 | // Remark: this was the only stuff that, according 20 | // to John Carmack, might have been useful for 21 | // Quake. 22 | // 23 | //--------------------------------------------------------------------- 24 | 25 | 26 | 27 | #ifndef __Z_ZONE__ 28 | #define __Z_ZONE__ 29 | 30 | #include 31 | 32 | // 33 | // ZONE MEMORY 34 | // PU - purge tags. 35 | // Tags < 100 are not overwritten until freed. 36 | #define PU_STATIC 1 // static entire execution time 37 | #define PU_SOUND 2 // static while playing 38 | #define PU_MUSIC 3 // static while playing 39 | #define PU_DAVE 4 // anything else Dave wants static 40 | #define PU_LEVEL 50 // static until level exited 41 | #define PU_LEVSPEC 51 // a special thinker in a level 42 | // Tags >= 100 are purgable whenever needed. 43 | #define PU_PURGELEVEL 100 44 | #define PU_CACHE 101 45 | 46 | 47 | void Z_Init (void); 48 | void* Z_Malloc (int size, int tag, void *ptr); 49 | void Z_Free (void *ptr); 50 | void Z_FreeTags (int lowtag, int hightag); 51 | void Z_DumpHeap (int lowtag, int hightag); 52 | void Z_FileDumpHeap (FILE *f); 53 | void Z_CheckHeap (void); 54 | void Z_ChangeTag2 (void *ptr, int tag); 55 | int Z_FreeMemory (void); 56 | 57 | 58 | typedef struct memblock_s 59 | { 60 | int size; // including the header and possibly tiny fragments 61 | void** user; // NULL if a free block 62 | int tag; // purgelevel 63 | int id; // should be ZONEID 64 | struct memblock_s* next; 65 | struct memblock_s* prev; 66 | } memblock_t; 67 | 68 | // 69 | // This is used to get the local FILE:LINE info from CPP 70 | // prior to really call the function in question. 71 | // 72 | #define Z_ChangeTag(p,t) \ 73 | { \ 74 | if (( (memblock_t *)( (byte *)(p) - sizeof(memblock_t)))->id!=0x1d4a11) \ 75 | I_Error("Z_CT at "__FILE__":%i",__LINE__); \ 76 | Z_ChangeTag2(p,t); \ 77 | }; 78 | 79 | 80 | 81 | #endif 82 | //----------------------------------------------------------------------------- 83 | // 84 | // $Log:$ 85 | // 86 | //----------------------------------------------------------------------------- 87 | -------------------------------------------------------------------------------- /m_random.c: -------------------------------------------------------------------------------- 1 | // Emacs style mode select -*- C++ -*- 2 | //----------------------------------------------------------------------------- 3 | // 4 | // $Id:$ 5 | // 6 | // Copyright (C) 1993-1996 by id Software, Inc. 7 | // 8 | // This source is available for distribution and/or modification 9 | // only under the terms of the DOOM Source Code License as 10 | // published by id Software. All rights reserved. 11 | // 12 | // The source is distributed in the hope that it will be useful, 13 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | // FITNESS FOR A PARTICULAR PURPOSE. See the DOOM Source Code License 15 | // for more details. 16 | // 17 | // $Log:$ 18 | // 19 | // DESCRIPTION: 20 | // Random number LUT. 21 | // 22 | //----------------------------------------------------------------------------- 23 | 24 | static const char rcsid[] = "$Id: m_random.c,v 1.1 1997/02/03 22:45:11 b1 Exp $"; 25 | 26 | 27 | // 28 | // M_Random 29 | // Returns a 0-255 number 30 | // 31 | unsigned char rndtable[256] = { 32 | 0, 8, 109, 220, 222, 241, 149, 107, 75, 248, 254, 140, 16, 66 , 33 | 74, 21, 211, 47, 80, 242, 154, 27, 205, 128, 161, 89, 77, 36 , 34 | 95, 110, 85, 48, 212, 140, 211, 249, 22, 79, 200, 50, 28, 188 , 35 | 52, 140, 202, 120, 68, 145, 62, 70, 184, 190, 91, 197, 152, 224 , 36 | 149, 104, 25, 178, 252, 182, 202, 182, 141, 197, 4, 81, 181, 242 , 37 | 145, 42, 39, 227, 156, 198, 225, 193, 219, 93, 122, 175, 249, 0 , 38 | 175, 143, 70, 239, 46, 246, 163, 53, 163, 109, 168, 135, 2, 235 , 39 | 25, 92, 20, 145, 138, 77, 69, 166, 78, 176, 173, 212, 166, 113 , 40 | 94, 161, 41, 50, 239, 49, 111, 164, 70, 60, 2, 37, 171, 75 , 41 | 136, 156, 11, 56, 42, 146, 138, 229, 73, 146, 77, 61, 98, 196 , 42 | 135, 106, 63, 197, 195, 86, 96, 203, 113, 101, 170, 247, 181, 113 , 43 | 80, 250, 108, 7, 255, 237, 129, 226, 79, 107, 112, 166, 103, 241 , 44 | 24, 223, 239, 120, 198, 58, 60, 82, 128, 3, 184, 66, 143, 224 , 45 | 145, 224, 81, 206, 163, 45, 63, 90, 168, 114, 59, 33, 159, 95 , 46 | 28, 139, 123, 98, 125, 196, 15, 70, 194, 253, 54, 14, 109, 226 , 47 | 71, 17, 161, 93, 186, 87, 244, 138, 20, 52, 123, 251, 26, 36 , 48 | 17, 46, 52, 231, 232, 76, 31, 221, 84, 37, 216, 165, 212, 106 , 49 | 197, 242, 98, 43, 39, 175, 254, 145, 190, 84, 118, 222, 187, 136 , 50 | 120, 163, 236, 249 51 | }; 52 | 53 | int rndindex = 0; 54 | int prndindex = 0; 55 | 56 | // Which one is deterministic? 57 | int P_Random (void) 58 | { 59 | prndindex = (prndindex+1)&0xff; 60 | return rndtable[prndindex]; 61 | } 62 | 63 | int M_Random (void) 64 | { 65 | rndindex = (rndindex+1)&0xff; 66 | return rndtable[rndindex]; 67 | } 68 | 69 | void M_ClearRandom (void) 70 | { 71 | rndindex = prndindex = 0; 72 | } 73 | 74 | 75 | 76 | 77 | -------------------------------------------------------------------------------- /i_system.h: -------------------------------------------------------------------------------- 1 | // Emacs style mode select -*- C++ -*- 2 | //----------------------------------------------------------------------------- 3 | // 4 | // $Id:$ 5 | // 6 | // Copyright (C) 1993-1996 by id Software, Inc. 7 | // 8 | // This source is available for distribution and/or modification 9 | // only under the terms of the DOOM Source Code License as 10 | // published by id Software. All rights reserved. 11 | // 12 | // The source is distributed in the hope that it will be useful, 13 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | // FITNESS FOR A PARTICULAR PURPOSE. See the DOOM Source Code License 15 | // for more details. 16 | // 17 | // DESCRIPTION: 18 | // System specific interface stuff. 19 | // 20 | //----------------------------------------------------------------------------- 21 | 22 | 23 | #ifndef __I_SYSTEM__ 24 | #define __I_SYSTEM__ 25 | 26 | #include "d_ticcmd.h" 27 | #include "d_event.h" 28 | 29 | #ifdef __GNUG__ 30 | #pragma interface 31 | #endif 32 | 33 | 34 | // Called by DoomMain. 35 | void I_Init (void); 36 | 37 | // Called by startup code 38 | // to get the ammount of memory to malloc 39 | // for the zone management. 40 | byte* I_ZoneBase (int *size); 41 | 42 | 43 | // Called by D_DoomLoop, 44 | // returns current time in tics. 45 | int I_GetTime (void); 46 | 47 | 48 | // 49 | // Called by D_DoomLoop, 50 | // called before processing any tics in a frame 51 | // (just after displaying a frame). 52 | // Time consuming syncronous operations 53 | // are performed here (joystick reading). 54 | // Can call D_PostEvent. 55 | // 56 | void I_StartFrame (void); 57 | 58 | 59 | // 60 | // Called by D_DoomLoop, 61 | // called before processing each tic in a frame. 62 | // Quick syncronous operations are performed here. 63 | // Can call D_PostEvent. 64 | void I_StartTic (void); 65 | 66 | // Asynchronous interrupt functions should maintain private queues 67 | // that are read by the synchronous functions 68 | // to be converted into events. 69 | 70 | // Either returns a null ticcmd, 71 | // or calls a loadable driver to build it. 72 | // This ticcmd will then be modified by the gameloop 73 | // for normal input. 74 | ticcmd_t* I_BaseTiccmd (void); 75 | 76 | 77 | // Called by M_Responder when quit is selected. 78 | // Clean exit, displays sell blurb. 79 | void I_Quit (void); 80 | 81 | 82 | // Allocates from low memory under dos, 83 | // just mallocs under unix 84 | byte* I_AllocLow (int length); 85 | 86 | void I_Tactile (int on, int off, int total); 87 | 88 | 89 | void I_Error (char *error, ...); 90 | 91 | // fixes bug under Win32 (mingwin32) 92 | int I_strncasecmp(char *str1, char *str2, int len); 93 | 94 | #endif 95 | //----------------------------------------------------------------------------- 96 | // 97 | // $Log:$ 98 | // 99 | //----------------------------------------------------------------------------- 100 | -------------------------------------------------------------------------------- /i_sound.h: -------------------------------------------------------------------------------- 1 | // Emacs style mode select -*- C++ -*- 2 | //----------------------------------------------------------------------------- 3 | // 4 | // $Id:$ 5 | // 6 | // Copyright (C) 1993-1996 by id Software, Inc. 7 | // 8 | // This source is available for distribution and/or modification 9 | // only under the terms of the DOOM Source Code License as 10 | // published by id Software. All rights reserved. 11 | // 12 | // The source is distributed in the hope that it will be useful, 13 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | // FITNESS FOR A PARTICULAR PURPOSE. See the DOOM Source Code License 15 | // for more details. 16 | // 17 | // 18 | // DESCRIPTION: 19 | // System interface, sound. 20 | // 21 | //----------------------------------------------------------------------------- 22 | 23 | #ifndef __I_SOUND__ 24 | #define __I_SOUND__ 25 | 26 | #include "doomdef.h" 27 | 28 | #include "doomstat.h" 29 | #include "sounds.h" 30 | 31 | 32 | 33 | // Init at program start... 34 | void I_InitSound(); 35 | 36 | // ... shut down and relase at program termination. 37 | void I_ShutdownSound(void); 38 | 39 | 40 | // 41 | // SFX I/O 42 | // 43 | 44 | // Initialize channels? 45 | void I_SetChannels(); 46 | 47 | // Get raw data lump index for sound descriptor. 48 | int I_GetSfxLumpNum (sfxinfo_t* sfxinfo ); 49 | 50 | 51 | // Starts a sound in a particular sound channel. 52 | int 53 | I_StartSound 54 | ( int id, 55 | int vol, 56 | int sep, 57 | int pitch, 58 | int priority ); 59 | 60 | 61 | // Stops a sound channel. 62 | void I_StopSound(int handle); 63 | 64 | // Called by S_*() functions 65 | // to see if a channel is still playing. 66 | // Returns 0 if no longer playing, 1 if playing. 67 | int I_SoundIsPlaying(int handle); 68 | 69 | // Updates the volume, separation, 70 | // and pitch of a sound channel. 71 | void 72 | I_UpdateSoundParams 73 | ( int handle, 74 | int vol, 75 | int sep, 76 | int pitch ); 77 | 78 | 79 | // 80 | // MUSIC I/O 81 | // 82 | void I_InitMusic(void); 83 | void I_ShutdownMusic(void); 84 | // Volume. 85 | void I_SetMusicVolume(int volume); 86 | // PAUSE game handling. 87 | void I_PauseSong(int handle); 88 | void I_ResumeSong(int handle); 89 | // Registers a song handle to song data. 90 | int I_RegisterSong(void *data); 91 | // Called by anything that wishes to start music. 92 | // plays a song, and when the song is done, 93 | // starts playing it again in an endless loop. 94 | // Horrible thing to do, considering. 95 | void 96 | I_PlaySong 97 | ( int handle, 98 | int looping ); 99 | // Stops a song over 3 seconds. 100 | void I_StopSong(int handle); 101 | // See above (register), then think backwards 102 | void I_UnRegisterSong(int handle); 103 | 104 | 105 | 106 | #endif 107 | //----------------------------------------------------------------------------- 108 | // 109 | // $Log:$ 110 | // 111 | //----------------------------------------------------------------------------- 112 | -------------------------------------------------------------------------------- /d_event.h: -------------------------------------------------------------------------------- 1 | // Emacs style mode select -*- C++ -*- 2 | //----------------------------------------------------------------------------- 3 | // 4 | // $Id:$ 5 | // 6 | // Copyright (C) 1993-1996 by id Software, Inc. 7 | // 8 | // This source is available for distribution and/or modification 9 | // only under the terms of the DOOM Source Code License as 10 | // published by id Software. All rights reserved. 11 | // 12 | // The source is distributed in the hope that it will be useful, 13 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | // FITNESS FOR A PARTICULAR PURPOSE. See the DOOM Source Code License 15 | // for more details. 16 | // 17 | // DESCRIPTION: 18 | // 19 | // 20 | //----------------------------------------------------------------------------- 21 | 22 | 23 | #ifndef __D_EVENT__ 24 | #define __D_EVENT__ 25 | 26 | 27 | #include "doomtype.h" 28 | 29 | 30 | // 31 | // Event handling. 32 | // 33 | 34 | // Input event types. 35 | typedef enum 36 | { 37 | ev_keydown, 38 | ev_keyup, 39 | ev_mouse, 40 | ev_joystick 41 | } evtype_t; 42 | 43 | // Event structure. 44 | typedef struct 45 | { 46 | evtype_t type; 47 | int data1; // keys / mouse/joystick buttons 48 | int data2; // mouse/joystick x move 49 | int data3; // mouse/joystick y move 50 | } event_t; 51 | 52 | 53 | typedef enum 54 | { 55 | ga_nothing, 56 | ga_loadlevel, 57 | ga_newgame, 58 | ga_loadgame, 59 | ga_savegame, 60 | ga_playdemo, 61 | ga_completed, 62 | ga_victory, 63 | ga_worlddone, 64 | ga_screenshot 65 | } gameaction_t; 66 | 67 | 68 | 69 | // 70 | // Button/action code definitions. 71 | // 72 | typedef enum 73 | { 74 | // Press "Fire". 75 | BT_ATTACK = 1, 76 | // Use button, to open doors, activate switches. 77 | BT_USE = 2, 78 | 79 | // Flag: game events, not really buttons. 80 | BT_SPECIAL = 128, 81 | BT_SPECIALMASK = 3, 82 | 83 | // Flag, weapon change pending. 84 | // If true, the next 3 bits hold weapon num. 85 | BT_CHANGE = 4, 86 | // The 3bit weapon mask and shift, convenience. 87 | BT_WEAPONMASK = (8+16+32), 88 | BT_WEAPONSHIFT = 3, 89 | 90 | // Pause the game. 91 | BTS_PAUSE = 1, 92 | // Save the game at each console. 93 | BTS_SAVEGAME = 2, 94 | 95 | // Savegame slot numbers 96 | // occupy the second byte of buttons. 97 | BTS_SAVEMASK = (4+8+16), 98 | BTS_SAVESHIFT = 2, 99 | 100 | } buttoncode_t; 101 | 102 | 103 | 104 | 105 | // 106 | // GLOBAL VARIABLES 107 | // 108 | #define MAXEVENTS 64 109 | 110 | extern event_t events[MAXEVENTS]; 111 | extern int eventhead; 112 | extern int eventtail; 113 | 114 | extern gameaction_t gameaction; 115 | 116 | 117 | #endif 118 | //----------------------------------------------------------------------------- 119 | // 120 | // $Log:$ 121 | // 122 | //----------------------------------------------------------------------------- 123 | -------------------------------------------------------------------------------- /r_draw.h: -------------------------------------------------------------------------------- 1 | // Emacs style mode select -*- C++ -*- 2 | //----------------------------------------------------------------------------- 3 | // 4 | // $Id:$ 5 | // 6 | // Copyright (C) 1993-1996 by id Software, Inc. 7 | // 8 | // This source is available for distribution and/or modification 9 | // only under the terms of the DOOM Source Code License as 10 | // published by id Software. All rights reserved. 11 | // 12 | // The source is distributed in the hope that it will be useful, 13 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | // FITNESS FOR A PARTICULAR PURPOSE. See the DOOM Source Code License 15 | // for more details. 16 | // 17 | // DESCRIPTION: 18 | // System specific interface stuff. 19 | // 20 | //----------------------------------------------------------------------------- 21 | 22 | 23 | #ifndef __R_DRAW__ 24 | #define __R_DRAW__ 25 | 26 | 27 | #ifdef __GNUG__ 28 | #pragma interface 29 | #endif 30 | 31 | 32 | extern lighttable_t* dc_colormap; 33 | extern int dc_x; 34 | extern int dc_yl; 35 | extern int dc_yh; 36 | extern fixed_t dc_iscale; 37 | extern fixed_t dc_texturemid; 38 | 39 | // first pixel in a column 40 | extern byte* dc_source; 41 | 42 | 43 | // The span blitting interface. 44 | // Hook in assembler or system specific BLT 45 | // here. 46 | void R_DrawColumn (void); 47 | void R_DrawColumnLow (void); 48 | 49 | // The Spectre/Invisibility effect. 50 | void R_DrawFuzzColumn (void); 51 | void R_DrawFuzzColumnLow (void); 52 | 53 | // Draw with color translation tables, 54 | // for player sprite rendering, 55 | // Green/Red/Blue/Indigo shirts. 56 | void R_DrawTranslatedColumn (void); 57 | void R_DrawTranslatedColumnLow (void); 58 | 59 | void 60 | R_VideoErase 61 | ( unsigned ofs, 62 | int count ); 63 | 64 | extern int ds_y; 65 | extern int ds_x1; 66 | extern int ds_x2; 67 | 68 | extern lighttable_t* ds_colormap; 69 | 70 | extern fixed_t ds_xfrac; 71 | extern fixed_t ds_yfrac; 72 | extern fixed_t ds_xstep; 73 | extern fixed_t ds_ystep; 74 | 75 | // start of a 64*64 tile image 76 | extern byte* ds_source; 77 | 78 | extern byte* translationtables; 79 | extern byte* dc_translation; 80 | 81 | 82 | // Span blitting for rows, floor/ceiling. 83 | // No Sepctre effect needed. 84 | void R_DrawSpan (void); 85 | 86 | // Low resolution mode, 160x200? 87 | void R_DrawSpanLow (void); 88 | 89 | 90 | void 91 | R_InitBuffer 92 | ( int width, 93 | int height ); 94 | 95 | 96 | // Initialize color translation tables, 97 | // for player rendering etc. 98 | void R_InitTranslationTables (void); 99 | 100 | 101 | 102 | // Rendering function. 103 | void R_FillBackScreen (void); 104 | 105 | // If the view size is not full screen, draws a border around it. 106 | void R_DrawViewBorder (void); 107 | 108 | 109 | 110 | #endif 111 | //----------------------------------------------------------------------------- 112 | // 113 | // $Log:$ 114 | // 115 | //----------------------------------------------------------------------------- 116 | -------------------------------------------------------------------------------- /r_state.h: -------------------------------------------------------------------------------- 1 | // Emacs style mode select -*- C++ -*- 2 | //----------------------------------------------------------------------------- 3 | // 4 | // $Id:$ 5 | // 6 | // Copyright (C) 1993-1996 by id Software, Inc. 7 | // 8 | // This source is available for distribution and/or modification 9 | // only under the terms of the DOOM Source Code License as 10 | // published by id Software. All rights reserved. 11 | // 12 | // The source is distributed in the hope that it will be useful, 13 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | // FITNESS FOR A PARTICULAR PURPOSE. See the DOOM Source Code License 15 | // for more details. 16 | // 17 | // DESCRIPTION: 18 | // Refresh/render internal state variables (global). 19 | // 20 | //----------------------------------------------------------------------------- 21 | 22 | 23 | #ifndef __R_STATE__ 24 | #define __R_STATE__ 25 | 26 | // Need data structure definitions. 27 | #include "d_player.h" 28 | #include "r_data.h" 29 | 30 | 31 | 32 | #ifdef __GNUG__ 33 | #pragma interface 34 | #endif 35 | 36 | 37 | 38 | // 39 | // Refresh internal data structures, 40 | // for rendering. 41 | // 42 | 43 | // needed for texture pegging 44 | extern fixed_t* textureheight; 45 | 46 | // needed for pre rendering (fracs) 47 | extern fixed_t* spritewidth; 48 | 49 | extern fixed_t* spriteoffset; 50 | extern fixed_t* spritetopoffset; 51 | 52 | extern lighttable_t* colormaps; 53 | 54 | extern int viewwidth; 55 | extern int scaledviewwidth; 56 | extern int viewheight; 57 | 58 | extern int firstflat; 59 | 60 | // for global animation 61 | extern int* flattranslation; 62 | extern int* texturetranslation; 63 | 64 | 65 | // Sprite.... 66 | extern int firstspritelump; 67 | extern int lastspritelump; 68 | extern int numspritelumps; 69 | 70 | 71 | 72 | // 73 | // Lookup tables for map data. 74 | // 75 | extern int numsprites; 76 | extern spritedef_t* sprites; 77 | 78 | extern int numvertexes; 79 | extern vertex_t* vertexes; 80 | 81 | extern int numsegs; 82 | extern seg_t* segs; 83 | 84 | extern int numsectors; 85 | extern sector_t* sectors; 86 | 87 | extern int numsubsectors; 88 | extern subsector_t* subsectors; 89 | 90 | extern int numnodes; 91 | extern node_t* nodes; 92 | 93 | extern int numlines; 94 | extern line_t* lines; 95 | 96 | extern int numsides; 97 | extern side_t* sides; 98 | 99 | 100 | // 101 | // POV data. 102 | // 103 | extern fixed_t viewx; 104 | extern fixed_t viewy; 105 | extern fixed_t viewz; 106 | 107 | extern angle_t viewangle; 108 | extern player_t* viewplayer; 109 | 110 | 111 | // ? 112 | extern angle_t clipangle; 113 | 114 | extern int viewangletox[FINEANGLES/2]; 115 | extern angle_t xtoviewangle[SCREENWIDTH+1]; 116 | //extern fixed_t finetangent[FINEANGLES/2]; 117 | 118 | extern fixed_t rw_distance; 119 | extern angle_t rw_normalangle; 120 | 121 | 122 | 123 | // angle to line origin 124 | extern int rw_angle1; 125 | 126 | // Segs count? 127 | extern int sscount; 128 | 129 | extern visplane_t* floorplane; 130 | extern visplane_t* ceilingplane; 131 | 132 | 133 | #endif 134 | //----------------------------------------------------------------------------- 135 | // 136 | // $Log:$ 137 | // 138 | //----------------------------------------------------------------------------- 139 | -------------------------------------------------------------------------------- /p_telept.c: -------------------------------------------------------------------------------- 1 | // Emacs style mode select -*- C++ -*- 2 | //----------------------------------------------------------------------------- 3 | // 4 | // $Id:$ 5 | // 6 | // Copyright (C) 1993-1996 by id Software, Inc. 7 | // 8 | // This source is available for distribution and/or modification 9 | // only under the terms of the DOOM Source Code License as 10 | // published by id Software. All rights reserved. 11 | // 12 | // The source is distributed in the hope that it will be useful, 13 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | // FITNESS FOR A PARTICULAR PURPOSE. See the DOOM Source Code License 15 | // for more details. 16 | // 17 | // $Log:$ 18 | // 19 | // DESCRIPTION: 20 | // Teleportation. 21 | // 22 | //----------------------------------------------------------------------------- 23 | 24 | static const char 25 | rcsid[] = "$Id: p_telept.c,v 1.3 1997/01/28 22:08:29 b1 Exp $"; 26 | 27 | 28 | 29 | #include "doomdef.h" 30 | 31 | #include "s_sound.h" 32 | 33 | #include "p_local.h" 34 | 35 | 36 | // Data. 37 | #include "sounds.h" 38 | 39 | // State. 40 | #include "r_state.h" 41 | 42 | 43 | 44 | // 45 | // TELEPORTATION 46 | // 47 | int 48 | EV_Teleport 49 | ( line_t* line, 50 | int side, 51 | mobj_t* thing ) 52 | { 53 | int i; 54 | int tag; 55 | mobj_t* m; 56 | mobj_t* fog; 57 | unsigned an; 58 | thinker_t* thinker; 59 | sector_t* sector; 60 | fixed_t oldx; 61 | fixed_t oldy; 62 | fixed_t oldz; 63 | 64 | // don't teleport missiles 65 | if (thing->flags & MF_MISSILE) 66 | return 0; 67 | 68 | // Don't teleport if hit back of line, 69 | // so you can get out of teleporter. 70 | if (side == 1) 71 | return 0; 72 | 73 | 74 | tag = line->tag; 75 | for (i = 0; i < numsectors; i++) 76 | { 77 | if (sectors[ i ].tag == tag ) 78 | { 79 | thinker = thinkercap.next; 80 | for (thinker = thinkercap.next; 81 | thinker != &thinkercap; 82 | thinker = thinker->next) 83 | { 84 | // not a mobj 85 | if (thinker->function.acp1 != (actionf_p1)P_MobjThinker) 86 | continue; 87 | 88 | m = (mobj_t *)thinker; 89 | 90 | // not a teleportman 91 | if (m->type != MT_TELEPORTMAN ) 92 | continue; 93 | 94 | sector = m->subsector->sector; 95 | // wrong sector 96 | if (sector-sectors != i ) 97 | continue; 98 | 99 | oldx = thing->x; 100 | oldy = thing->y; 101 | oldz = thing->z; 102 | 103 | if (!P_TeleportMove (thing, m->x, m->y)) 104 | return 0; 105 | 106 | thing->z = thing->floorz; //fixme: not needed? 107 | if (thing->player) 108 | thing->player->viewz = thing->z+thing->player->viewheight; 109 | 110 | // spawn teleport fog at source and destination 111 | fog = P_SpawnMobj (oldx, oldy, oldz, MT_TFOG); 112 | S_StartSound (fog, sfx_telept); 113 | an = m->angle >> ANGLETOFINESHIFT; 114 | fog = P_SpawnMobj (m->x+20*finecosine[an], m->y+20*finesine[an] 115 | , thing->z, MT_TFOG); 116 | 117 | // emit sound, where? 118 | S_StartSound (fog, sfx_telept); 119 | 120 | // don't move for a bit 121 | if (thing->player) 122 | thing->reactiontime = 18; 123 | 124 | thing->angle = m->angle; 125 | thing->momx = thing->momy = thing->momz = 0; 126 | return 1; 127 | } 128 | } 129 | } 130 | return 0; 131 | } 132 | 133 | -------------------------------------------------------------------------------- /p_tick.c: -------------------------------------------------------------------------------- 1 | // Emacs style mode select -*- C++ -*- 2 | //----------------------------------------------------------------------------- 3 | // 4 | // $Id:$ 5 | // 6 | // Copyright (C) 1993-1996 by id Software, Inc. 7 | // 8 | // This source is available for distribution and/or modification 9 | // only under the terms of the DOOM Source Code License as 10 | // published by id Software. All rights reserved. 11 | // 12 | // The source is distributed in the hope that it will be useful, 13 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | // FITNESS FOR A PARTICULAR PURPOSE. See the DOOM Source Code License 15 | // for more details. 16 | // 17 | // $Log:$ 18 | // 19 | // DESCRIPTION: 20 | // Archiving: SaveGame I/O. 21 | // Thinker, Ticker. 22 | // 23 | //----------------------------------------------------------------------------- 24 | 25 | static const char 26 | rcsid[] = "$Id: p_tick.c,v 1.4 1997/02/03 16:47:55 b1 Exp $"; 27 | 28 | #include "z_zone.h" 29 | #include "p_local.h" 30 | 31 | #include "doomstat.h" 32 | 33 | 34 | int leveltime; 35 | 36 | // 37 | // THINKERS 38 | // All thinkers should be allocated by Z_Malloc 39 | // so they can be operated on uniformly. 40 | // The actual structures will vary in size, 41 | // but the first element must be thinker_t. 42 | // 43 | 44 | 45 | 46 | // Both the head and tail of the thinker list. 47 | thinker_t thinkercap; 48 | 49 | 50 | // 51 | // P_InitThinkers 52 | // 53 | void P_InitThinkers (void) 54 | { 55 | thinkercap.prev = thinkercap.next = &thinkercap; 56 | } 57 | 58 | 59 | 60 | 61 | // 62 | // P_AddThinker 63 | // Adds a new thinker at the end of the list. 64 | // 65 | void P_AddThinker (thinker_t* thinker) 66 | { 67 | thinkercap.prev->next = thinker; 68 | thinker->next = &thinkercap; 69 | thinker->prev = thinkercap.prev; 70 | thinkercap.prev = thinker; 71 | } 72 | 73 | 74 | 75 | // 76 | // P_RemoveThinker 77 | // Deallocation is lazy -- it will not actually be freed 78 | // until its thinking turn comes up. 79 | // 80 | void P_RemoveThinker (thinker_t* thinker) 81 | { 82 | // FIXME: NOP. 83 | thinker->function.acv = (actionf_v)(-1); 84 | } 85 | 86 | 87 | 88 | // 89 | // P_AllocateThinker 90 | // Allocates memory and adds a new thinker at the end of the list. 91 | // 92 | void P_AllocateThinker (thinker_t* thinker) 93 | { 94 | } 95 | 96 | 97 | 98 | // 99 | // P_RunThinkers 100 | // 101 | void P_RunThinkers (void) 102 | { 103 | thinker_t* currentthinker; 104 | 105 | currentthinker = thinkercap.next; 106 | while (currentthinker != &thinkercap) 107 | { 108 | if ( currentthinker->function.acv == (actionf_v)(-1) ) 109 | { 110 | // time to remove it 111 | currentthinker->next->prev = currentthinker->prev; 112 | currentthinker->prev->next = currentthinker->next; 113 | Z_Free (currentthinker); 114 | } 115 | else 116 | { 117 | if (currentthinker->function.acp1) 118 | currentthinker->function.acp1 (currentthinker); 119 | } 120 | currentthinker = currentthinker->next; 121 | } 122 | } 123 | 124 | 125 | 126 | // 127 | // P_Ticker 128 | // 129 | 130 | void P_Ticker (void) 131 | { 132 | int i; 133 | 134 | // run the tic 135 | if (paused) 136 | return; 137 | 138 | // pause if in menu and at least one tic has been run 139 | if ( !netgame 140 | && menuactive 141 | && !demoplayback 142 | && players[consoleplayer].viewz != 1) 143 | { 144 | return; 145 | } 146 | 147 | 148 | for (i=0 ; i 28 | #include 29 | #include 30 | #include "SDL.h" 31 | #include "SDL_timer.h" 32 | 33 | #include "doomdef.h" 34 | #include "m_misc.h" 35 | #include "i_video.h" 36 | #include "i_sound.h" 37 | 38 | #include "d_net.h" 39 | #include "g_game.h" 40 | 41 | #ifdef __GNUG__ 42 | #pragma implementation "i_system.h" 43 | #endif 44 | #include "i_system.h" 45 | 46 | 47 | 48 | 49 | int mb_used = 6; 50 | 51 | 52 | int I_strncasecmp(char *str1, char *str2, int len) 53 | { 54 | char c1, c2; 55 | 56 | while ( *str1 && *str2 && len-- ) { 57 | c1 = *str1++; 58 | c2 = *str2++; 59 | if ( toupper(c1) != toupper(c2) ) 60 | return(1); 61 | } 62 | return(0); 63 | } 64 | 65 | void 66 | I_Tactile 67 | ( int on, 68 | int off, 69 | int total ) 70 | { 71 | // UNUSED. 72 | on = off = total = 0; 73 | } 74 | 75 | ticcmd_t emptycmd; 76 | ticcmd_t* I_BaseTiccmd(void) 77 | { 78 | return &emptycmd; 79 | } 80 | 81 | 82 | int I_GetHeapSize (void) 83 | { 84 | return mb_used*1024*1024; 85 | } 86 | 87 | byte* I_ZoneBase (int* size) 88 | { 89 | *size = mb_used*1024*1024; 90 | return (byte *) malloc (*size); 91 | } 92 | 93 | 94 | 95 | // 96 | // I_GetTime 97 | // returns time in 1/35 second tics 98 | // 99 | int I_GetTime (void) 100 | { 101 | return (SDL_GetTicks()*TICRATE)/1000; 102 | } 103 | 104 | 105 | 106 | // 107 | // I_Init 108 | // 109 | void I_Init (void) 110 | { 111 | if ( SDL_Init(SDL_INIT_AUDIO|SDL_INIT_VIDEO|SDL_INIT_JOYSTICK) < 0 ) 112 | I_Error("Could not initialize SDL: %s", SDL_GetError()); 113 | 114 | I_InitSound(); 115 | // I_InitGraphics(); 116 | 117 | SDL_Joystick *joystick; 118 | 119 | joystick = SDL_JoystickOpen(0); 120 | 121 | } 122 | 123 | // 124 | // I_Quit 125 | // 126 | void I_Quit (void) 127 | { 128 | D_QuitNetGame (); 129 | I_ShutdownSound(); 130 | I_ShutdownMusic(); 131 | M_SaveDefaults (); 132 | I_ShutdownGraphics(); 133 | exit(0); 134 | } 135 | 136 | void I_WaitVBL(int count) 137 | { 138 | SDL_Delay((count*1000)/70); 139 | } 140 | 141 | void I_BeginRead(void) 142 | { 143 | } 144 | 145 | void I_EndRead(void) 146 | { 147 | } 148 | 149 | byte* I_AllocLow(int length) 150 | { 151 | byte* mem; 152 | 153 | mem = (byte *)malloc (length); 154 | memset (mem,0,length); 155 | return mem; 156 | } 157 | 158 | 159 | // 160 | // I_Error 161 | // 162 | extern boolean demorecording; 163 | 164 | void I_Error (char *error, ...) 165 | { 166 | va_list argptr; 167 | 168 | // Message first. 169 | va_start (argptr,error); 170 | fprintf (stderr, "Error: "); 171 | vfprintf (stderr,error,argptr); 172 | fprintf (stderr, "\n"); 173 | va_end (argptr); 174 | 175 | fflush( stderr ); 176 | 177 | // Shutdown. Here might be other errors. 178 | if (demorecording) 179 | G_CheckDemoStatus(); 180 | 181 | D_QuitNetGame (); 182 | I_ShutdownGraphics(); 183 | 184 | exit(-1); 185 | } 186 | -------------------------------------------------------------------------------- /d_net.h: -------------------------------------------------------------------------------- 1 | // Emacs style mode select -*- C++ -*- 2 | //----------------------------------------------------------------------------- 3 | // 4 | // $Id:$ 5 | // 6 | // Copyright (C) 1993-1996 by id Software, Inc. 7 | // 8 | // This source is available for distribution and/or modification 9 | // only under the terms of the DOOM Source Code License as 10 | // published by id Software. All rights reserved. 11 | // 12 | // The source is distributed in the hope that it will be useful, 13 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | // FITNESS FOR A PARTICULAR PURPOSE. See the DOOM Source Code License 15 | // for more details. 16 | // 17 | // DESCRIPTION: 18 | // Networking stuff. 19 | // 20 | //----------------------------------------------------------------------------- 21 | 22 | 23 | #ifndef __D_NET__ 24 | #define __D_NET__ 25 | 26 | #include "d_player.h" 27 | 28 | 29 | #ifdef __GNUG__ 30 | #pragma interface 31 | #endif 32 | 33 | 34 | // 35 | // Network play related stuff. 36 | // There is a data struct that stores network 37 | // communication related stuff, and another 38 | // one that defines the actual packets to 39 | // be transmitted. 40 | // 41 | 42 | #define DOOMCOM_ID 0x12345678l 43 | 44 | // Max computers/players in a game. 45 | #define MAXNETNODES 8 46 | 47 | 48 | // Networking and tick handling related. 49 | #define BACKUPTICS 12 50 | 51 | typedef enum 52 | { 53 | CMD_SEND = 1, 54 | CMD_GET = 2 55 | 56 | } command_t; 57 | 58 | 59 | // 60 | // Network packet data. 61 | // 62 | typedef struct 63 | { 64 | // High bit is retransmit request. 65 | unsigned checksum; 66 | // Only valid if NCMD_RETRANSMIT. 67 | byte retransmitfrom; 68 | 69 | byte starttic; 70 | byte player; 71 | byte numtics; 72 | ticcmd_t cmds[BACKUPTICS]; 73 | 74 | } doomdata_t; 75 | 76 | 77 | 78 | 79 | typedef struct 80 | { 81 | // Supposed to be DOOMCOM_ID? 82 | long id; 83 | 84 | // DOOM executes an int to execute commands. 85 | short intnum; 86 | // Communication between DOOM and the driver. 87 | // Is CMD_SEND or CMD_GET. 88 | short command; 89 | // Is dest for send, set by get (-1 = no packet). 90 | short remotenode; 91 | 92 | // Number of bytes in doomdata to be sent 93 | short datalength; 94 | 95 | // Info common to all nodes. 96 | // Console is allways node 0. 97 | short numnodes; 98 | // Flag: 1 = no duplication, 2-5 = dup for slow nets. 99 | short ticdup; 100 | // Flag: 1 = send a backup tic in every packet. 101 | short extratics; 102 | // Flag: 1 = deathmatch. 103 | short deathmatch; 104 | // Flag: -1 = new game, 0-5 = load savegame 105 | short savegame; 106 | short episode; // 1-3 107 | short map; // 1-9 108 | short skill; // 1-5 109 | 110 | // Info specific to this node. 111 | short consoleplayer; 112 | short numplayers; 113 | 114 | // These are related to the 3-display mode, 115 | // in which two drones looking left and right 116 | // were used to render two additional views 117 | // on two additional computers. 118 | // Probably not operational anymore. 119 | // 1 = left, 0 = center, -1 = right 120 | short angleoffset; 121 | // 1 = drone 122 | short drone; 123 | 124 | // The packet data to be sent. 125 | doomdata_t data; 126 | 127 | } doomcom_t; 128 | 129 | 130 | 131 | // Create any new ticcmds and broadcast to other players. 132 | void NetUpdate (void); 133 | 134 | // Broadcasts special packets to other players 135 | // to notify of game exit 136 | void D_QuitNetGame (void); 137 | 138 | //? how many ticks to run? 139 | void TryRunTics (void); 140 | 141 | 142 | #endif 143 | 144 | //----------------------------------------------------------------------------- 145 | // 146 | // $Log:$ 147 | // 148 | //----------------------------------------------------------------------------- 149 | 150 | -------------------------------------------------------------------------------- /r_main.h: -------------------------------------------------------------------------------- 1 | // Emacs style mode select -*- C++ -*- 2 | //----------------------------------------------------------------------------- 3 | // 4 | // $Id:$ 5 | // 6 | // Copyright (C) 1993-1996 by id Software, Inc. 7 | // 8 | // This source is available for distribution and/or modification 9 | // only under the terms of the DOOM Source Code License as 10 | // published by id Software. All rights reserved. 11 | // 12 | // The source is distributed in the hope that it will be useful, 13 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | // FITNESS FOR A PARTICULAR PURPOSE. See the DOOM Source Code License 15 | // for more details. 16 | // 17 | // DESCRIPTION: 18 | // System specific interface stuff. 19 | // 20 | //----------------------------------------------------------------------------- 21 | 22 | 23 | #ifndef __R_MAIN__ 24 | #define __R_MAIN__ 25 | 26 | #include "d_player.h" 27 | #include "r_data.h" 28 | 29 | 30 | #ifdef __GNUG__ 31 | #pragma interface 32 | #endif 33 | 34 | 35 | // 36 | // POV related. 37 | // 38 | extern fixed_t viewcos; 39 | extern fixed_t viewsin; 40 | 41 | extern int viewwidth; 42 | extern int viewheight; 43 | extern int viewwindowx; 44 | extern int viewwindowy; 45 | 46 | 47 | 48 | extern int centerx; 49 | extern int centery; 50 | 51 | extern fixed_t centerxfrac; 52 | extern fixed_t centeryfrac; 53 | extern fixed_t projection; 54 | 55 | extern int validcount; 56 | 57 | extern int linecount; 58 | extern int loopcount; 59 | 60 | 61 | // 62 | // Lighting LUT. 63 | // Used for z-depth cuing per column/row, 64 | // and other lighting effects (sector ambient, flash). 65 | // 66 | 67 | // Lighting constants. 68 | // Now why not 32 levels here? 69 | #define LIGHTLEVELS 16 70 | #define LIGHTSEGSHIFT 4 71 | 72 | #define MAXLIGHTSCALE 48 73 | #define LIGHTSCALESHIFT 12 74 | #define MAXLIGHTZ 128 75 | #define LIGHTZSHIFT 20 76 | 77 | extern lighttable_t* scalelight[LIGHTLEVELS][MAXLIGHTSCALE]; 78 | extern lighttable_t* scalelightfixed[MAXLIGHTSCALE]; 79 | extern lighttable_t* zlight[LIGHTLEVELS][MAXLIGHTZ]; 80 | 81 | extern int extralight; 82 | extern lighttable_t* fixedcolormap; 83 | 84 | 85 | // Number of diminishing brightness levels. 86 | // There a 0-31, i.e. 32 LUT in the COLORMAP lump. 87 | #define NUMCOLORMAPS 32 88 | 89 | 90 | // Blocky/low detail mode. 91 | //B remove this? 92 | // 0 = high, 1 = low 93 | extern int detailshift; 94 | 95 | 96 | // 97 | // Function pointers to switch refresh/drawing functions. 98 | // Used to select shadow mode etc. 99 | // 100 | extern void (*colfunc) (void); 101 | extern void (*basecolfunc) (void); 102 | extern void (*fuzzcolfunc) (void); 103 | // No shadow effects on floors. 104 | extern void (*spanfunc) (void); 105 | 106 | 107 | // 108 | // Utility functions. 109 | int 110 | R_PointOnSide 111 | ( fixed_t x, 112 | fixed_t y, 113 | node_t* node ); 114 | 115 | int 116 | R_PointOnSegSide 117 | ( fixed_t x, 118 | fixed_t y, 119 | seg_t* line ); 120 | 121 | angle_t 122 | R_PointToAngle 123 | ( fixed_t x, 124 | fixed_t y ); 125 | 126 | angle_t 127 | R_PointToAngle2 128 | ( fixed_t x1, 129 | fixed_t y1, 130 | fixed_t x2, 131 | fixed_t y2 ); 132 | 133 | fixed_t 134 | R_PointToDist 135 | ( fixed_t x, 136 | fixed_t y ); 137 | 138 | 139 | fixed_t R_ScaleFromGlobalAngle (angle_t visangle); 140 | 141 | subsector_t* 142 | R_PointInSubsector 143 | ( fixed_t x, 144 | fixed_t y ); 145 | 146 | void 147 | R_AddPointToBox 148 | ( int x, 149 | int y, 150 | fixed_t* box ); 151 | 152 | 153 | 154 | // 155 | // REFRESH - the actual rendering functions. 156 | // 157 | 158 | // Called by G_Drawer. 159 | void R_RenderPlayerView (player_t *player); 160 | 161 | // Called by startup code. 162 | void R_Init (void); 163 | 164 | // Called by M_Responder. 165 | void R_SetViewSize (int blocks, int detail); 166 | 167 | #endif 168 | //----------------------------------------------------------------------------- 169 | // 170 | // $Log:$ 171 | // 172 | //----------------------------------------------------------------------------- 173 | -------------------------------------------------------------------------------- /TODO: -------------------------------------------------------------------------------- 1 | 2 | - create Web repository for sources, patches, 3 | news, and pointer to doom-editing mailing 4 | list. 5 | 6 | - get DOOM Public License from id 7 | 8 | ----------------------------------------------- 9 | 10 | - remove m_fixed, switch to floating point 11 | More stable, and prolly even faster. 12 | 13 | - make SCREENWIDTH/HEIGHT work at startup? 14 | Well, the HUD/STBar stuff is tied to the 15 | scales implied by the graphics. Rather do 16 | GLDOOM and use texture mapping. 17 | 18 | - fix aspect ratio? 19 | 320x200 is nothing viable nowadays. 20 | A 320x240 base (4:3) would be a lot better. 21 | See above on width/height. 22 | 23 | - limited look up/down by y-shearing? 24 | Prolly not worth it, rather switch to GLDOOM. 25 | 26 | - switch to C++? 27 | The action function pointers have varying 28 | argument lists (no parameter, one, etc.). 29 | C++ doesn't like that much. A major rewrite. 30 | 31 | - switch to doommain.c plus libdoom? Have 32 | libref, libgame etc.? 33 | Another major rewrite. 34 | 35 | - use XFree86 DGA, prolly not that much faster 36 | than MIT SHM, but allows for directly sampled 37 | mouse (and even freelook). Recommended for 38 | GLDOOM. 39 | 40 | - put together an accompanying developer toolkit 41 | source distribution: DEU, RMB, BSP for Linux/X. 42 | 43 | - move info.h, info.c, sounds.h, sounds.c and 44 | other data to a separate lump in the WAD, 45 | or into a libgame.so, to separate the 46 | generic stuff (refresh, I/O) from the 47 | DOOM specifics. 48 | 49 | - decide whether precaching all sounds is 50 | better than retrieving and releasing 51 | every so often. DOOM seems to do that 52 | frequently (8bit stuff, originally for 53 | DOS), and the Linux sound is 16bit 54 | (conversion in the mixing, requires 55 | some padding) - we prolly got the memory 56 | to spare. 57 | 58 | - 16bpp CLUT. The lightmaps and the 59 | framebuffer could be changed to switch 60 | to 64K colors. Prolly better to do 61 | GLDOOM right away. 62 | 63 | - remove checks for commercial etc., in 64 | non-essential issues (enabling PWAD's). 65 | 66 | - change (simplify) determination of 67 | sky texture (done by game version). 68 | Explicit? 69 | 70 | - remove all game version checks 71 | 72 | - different handling of Demo - don't 73 | exit on "different game version" 74 | 75 | - how about shareware/retail "You are here" 76 | intermission animation? Wasn't in 77 | commercial (DOOM 2). 78 | 79 | - double shotgun in DOOM1, all weapons with 80 | shareware 81 | 82 | - checks for required lumps. We need fallbacks 83 | for lumps that are not present, that is, 84 | default sounds etc. to be used instead, 85 | or removing THINGS w/o sprites etc. 86 | 87 | - client/server? I'd suggest ripping off some stuff 88 | from the abandoned IBM WebView project 89 | 90 | - Blockmap 91 | The BLOCKMAP lump might be (partly) redundant, 92 | as the BSP allows for clipping (except certain 93 | LineDefs that will not spawn Segs). 94 | 95 | - LOS 96 | REJECT and intersection based LOS checking could be 97 | done using the BSP. In case of REJECT, certain 98 | monster AI special effects would be lost, though. 99 | 100 | - correct handling of height in collision. This is 101 | not done, and the checks are scattered around in 102 | many places. It does require handling of "player 103 | on top of monster" situations, too - we have to 104 | make sure the players falls off far enough to 105 | avoid getting "stuck in monster". 106 | 107 | - remove obsolete menus (Detail. Music Volume?) 108 | 109 | - clip explosion range damage (and sprites) using 110 | REJECT? That is, if one Sector/SSector not 111 | visible from the other, do not apply damage, 112 | not render sprite if player in other sector. 113 | Hmmm - explosion behind small pillar might not be 114 | visible at all, but do we care? 115 | 116 | 117 | - Ungraceful and untimely demise of Linuxdoom (core 118 | instead of I_Error) will leave idle sndserver 119 | processes in your system, blocking /dev/bsp. 120 | A timeout on lack of input for "sndserver"? 121 | 122 | - threaded sndserver? SHM mixing buffer? 123 | Or internal, timer-based? 124 | -------------------------------------------------------------------------------- /README.b: -------------------------------------------------------------------------------- 1 | 2 | README for Linux DOOM Source distribution 3 | ========================================= 4 | 5 | 6 | DISCLAIMER 7 | ---------- 8 | This is not "The DOOM Source Code" dump for a bunch 9 | of reasons. It is based on a DOOM development directory 10 | snapshot as of January 10th, but has been stripped and 11 | changed. Thus it is the DOOM source, but there are many 12 | minor differences to the source as last used by id 13 | Software. 14 | 15 | Note that thus neither John Carmack nor Dave Taylor nor 16 | anybody else at id is responsible for the contents of 17 | this archive, or the changes introduced to the original 18 | source. 19 | 20 | If there are any questions, contact me at bk@gamers.org, 21 | or preferably post to the mailing list at 22 | 23 | doom-editing@gamers.org 24 | 25 | (send mail to majordomo@gamers.org, content just 26 | a single "info doom-editing"). I will post any updates 27 | or notifcation of corrections there. I will probably 28 | put some stuff at 29 | 30 | http://www.gamers.org/dEngine/doom/ 31 | 32 | as well. Look there for the "Unofficial DOOM Specs" as 33 | minimal recommended documentation. 34 | 35 | 36 | 37 | REMARKS 38 | ------- 39 | I made a few minor bug fixes, added some experimental sound 40 | code, and, and changed the handling of IWAD dependend game 41 | modes. Most of the changes though have been shuffling 42 | around sources in a sometimes futile attempt to separate 43 | modules more cleanly, and make certain parts easier 44 | to locate and modify. There is still much left to do, but 45 | I hope that the current source is a good base to start 46 | with, especially with a cooperative effort in mind. Those 47 | so inclined will find the source prepared for CVS. 48 | 49 | There is a list of changes and fixes I did not get around 50 | to in TODO, and an incomplete worklog in ChangeLog, that 51 | also includes some minor ToDo statements scattered throughout 52 | the log. 53 | 54 | 55 | a) Linux SVGA 56 | There is no SVGA support. For development and debug 57 | purposes, the X11 version seems to be more handy. 58 | 59 | b) Sound - see README.sound, 60 | and the sndserver.tgz archive. 61 | 62 | c) GLDOOM - see README.gl 63 | 64 | d) Win32 65 | There was no Win32 support in the original dump. 66 | 67 | e) DOS 68 | Original DOS support (including the texture 69 | mapping and fixed point assembler) has been 70 | removed, mainly because of the lack of sound 71 | support. 72 | 73 | f) DoomEd 74 | The NeXTStep DoomEd sources in the dump were 75 | garbled (filenames - prolly an issue of ISO9660 76 | with or w/o extensions). Somehow Bear never got 77 | around to send me a list of the correct filenames, 78 | and I won't bother guessing without a NeXT box 79 | at hand. 80 | 81 | There is a plethora of useful editors 82 | for DOOM. I suggest using DEU for X11. 83 | 84 | g) BSP Tools 85 | The BSP builder and other tools have 86 | been released by John Carmack long ago, 87 | and since improved/replaced by others. 88 | Again, I recommend taking a pick among 89 | the tools available for Linux. 90 | 91 | h) DOOM game tools 92 | There are a number of tools that have 93 | not been released, namely those which 94 | compiled the Things and State Tables, 95 | the frame animation LUT's, sound tables 96 | etc. Basically, they compile similarly 97 | complex LUT's to generate C files. The 98 | tools are omitted from this distribution. 99 | 100 | There are some files in the 101 | distribution (info.h/c, sounds.h/c) 102 | that are essentially the output of these 103 | tools. This is the data that defines 104 | DOOM (as a game) for all practical 105 | purposes. 106 | 107 | I recommend keeping them, as they are 108 | part of the source. In the long run, 109 | handling them as well as the action/ 110 | animation functions as a separate game.so 111 | library (as with Quake2) seems to be a 112 | good idea. 113 | 114 | i) Artwork 115 | Neither the original artwork nor the 116 | misc. WAD files are included in this 117 | archive. You will at least need the 118 | shareware WAD file to run the executable, 119 | but it shouldn't be to difficult to get 120 | a hold of that. 121 | 122 | Note that the mechanism to detect the 123 | presence of a registered or commercial 124 | version is still in the source, and 125 | homebrew maps are still disabled. This 126 | is easily removed now, but as FinalDOOM, 127 | Ultimate DOOM and DOOM 2 are still in 128 | the shops, it is probably polite not 129 | to distribute a source or binary without 130 | that mechanism. 131 | 132 | This version of Linuxdoom supports Plutonia 133 | and TNT WAD from FinalDOOM as well. No 134 | guarantees, though. 135 | 136 | 137 | Enjoy! 138 | 139 | 140 | b. 97/12/22 141 | -------------------------------------------------------------------------------- /st_lib.h: -------------------------------------------------------------------------------- 1 | // Emacs style mode select -*- C++ -*- 2 | //----------------------------------------------------------------------------- 3 | // 4 | // $Id:$ 5 | // 6 | // Copyright (C) 1993-1996 by id Software, Inc. 7 | // 8 | // This source is available for distribution and/or modification 9 | // only under the terms of the DOOM Source Code License as 10 | // published by id Software. All rights reserved. 11 | // 12 | // The source is distributed in the hope that it will be useful, 13 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | // FITNESS FOR A PARTICULAR PURPOSE. See the DOOM Source Code License 15 | // for more details. 16 | // 17 | // DESCRIPTION: 18 | // The status bar widget code. 19 | // 20 | //----------------------------------------------------------------------------- 21 | 22 | #ifndef __STLIB__ 23 | #define __STLIB__ 24 | 25 | 26 | // We are referring to patches. 27 | #include "r_defs.h" 28 | 29 | 30 | // 31 | // Background and foreground screen numbers 32 | // 33 | #define BG 4 34 | #define FG 0 35 | 36 | 37 | 38 | // 39 | // Typedefs of widgets 40 | // 41 | 42 | // Number widget 43 | 44 | typedef struct 45 | { 46 | // upper right-hand corner 47 | // of the number (right-justified) 48 | int x; 49 | int y; 50 | 51 | // max # of digits in number 52 | int width; 53 | 54 | // last number value 55 | int oldnum; 56 | 57 | // pointer to current value 58 | int* num; 59 | 60 | // pointer to boolean stating 61 | // whether to update number 62 | boolean* on; 63 | 64 | // list of patches for 0-9 65 | patch_t** p; 66 | 67 | // user data 68 | int data; 69 | 70 | } st_number_t; 71 | 72 | 73 | 74 | // Percent widget ("child" of number widget, 75 | // or, more precisely, contains a number widget.) 76 | typedef struct 77 | { 78 | // number information 79 | st_number_t n; 80 | 81 | // percent sign graphic 82 | patch_t* p; 83 | 84 | } st_percent_t; 85 | 86 | 87 | 88 | // Multiple Icon widget 89 | typedef struct 90 | { 91 | // center-justified location of icons 92 | int x; 93 | int y; 94 | 95 | // last icon number 96 | int oldinum; 97 | 98 | // pointer to current icon 99 | int* inum; 100 | 101 | // pointer to boolean stating 102 | // whether to update icon 103 | boolean* on; 104 | 105 | // list of icons 106 | patch_t** p; 107 | 108 | // user data 109 | int data; 110 | 111 | } st_multicon_t; 112 | 113 | 114 | 115 | 116 | // Binary Icon widget 117 | 118 | typedef struct 119 | { 120 | // center-justified location of icon 121 | int x; 122 | int y; 123 | 124 | // last icon value 125 | int oldval; 126 | 127 | // pointer to current icon status 128 | boolean* val; 129 | 130 | // pointer to boolean 131 | // stating whether to update icon 132 | boolean* on; 133 | 134 | 135 | patch_t* p; // icon 136 | int data; // user data 137 | 138 | } st_binicon_t; 139 | 140 | 141 | 142 | // 143 | // Widget creation, access, and update routines 144 | // 145 | 146 | // Initializes widget library. 147 | // More precisely, initialize STMINUS, 148 | // everything else is done somewhere else. 149 | // 150 | void STlib_init(void); 151 | 152 | 153 | 154 | // Number widget routines 155 | void 156 | STlib_initNum 157 | ( st_number_t* n, 158 | int x, 159 | int y, 160 | patch_t** pl, 161 | int* num, 162 | boolean* on, 163 | int width ); 164 | 165 | void 166 | STlib_updateNum 167 | ( st_number_t* n, 168 | boolean refresh ); 169 | 170 | 171 | // Percent widget routines 172 | void 173 | STlib_initPercent 174 | ( st_percent_t* p, 175 | int x, 176 | int y, 177 | patch_t** pl, 178 | int* num, 179 | boolean* on, 180 | patch_t* percent ); 181 | 182 | 183 | void 184 | STlib_updatePercent 185 | ( st_percent_t* per, 186 | int refresh ); 187 | 188 | 189 | // Multiple Icon widget routines 190 | void 191 | STlib_initMultIcon 192 | ( st_multicon_t* mi, 193 | int x, 194 | int y, 195 | patch_t** il, 196 | int* inum, 197 | boolean* on ); 198 | 199 | 200 | void 201 | STlib_updateMultIcon 202 | ( st_multicon_t* mi, 203 | boolean refresh ); 204 | 205 | // Binary Icon widget routines 206 | 207 | void 208 | STlib_initBinIcon 209 | ( st_binicon_t* b, 210 | int x, 211 | int y, 212 | patch_t* i, 213 | boolean* val, 214 | boolean* on ); 215 | 216 | void 217 | STlib_updateBinIcon 218 | ( st_binicon_t* bi, 219 | boolean refresh ); 220 | 221 | #endif 222 | //----------------------------------------------------------------------------- 223 | // 224 | // $Log:$ 225 | // 226 | //----------------------------------------------------------------------------- 227 | -------------------------------------------------------------------------------- /hu_lib.h: -------------------------------------------------------------------------------- 1 | // Emacs style mode select -*- C++ -*- 2 | //----------------------------------------------------------------------------- 3 | // 4 | // $Id:$ 5 | // 6 | // Copyright (C) 1993-1996 by id Software, Inc. 7 | // 8 | // This source is available for distribution and/or modification 9 | // only under the terms of the DOOM Source Code License as 10 | // published by id Software. All rights reserved. 11 | // 12 | // The source is distributed in the hope that it will be useful, 13 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | // FITNESS FOR A PARTICULAR PURPOSE. See the DOOM Source Code License 15 | // for more details. 16 | // 17 | // DESCRIPTION: none 18 | // 19 | //----------------------------------------------------------------------------- 20 | 21 | #ifndef __HULIB__ 22 | #define __HULIB__ 23 | 24 | // We are referring to patches. 25 | #include "r_defs.h" 26 | 27 | 28 | // background and foreground screen numbers 29 | // different from other modules. 30 | #define BG 1 31 | #define FG 0 32 | 33 | // font stuff 34 | #define HU_CHARERASE KEY_BACKSPACE 35 | 36 | #define HU_MAXLINES 4 37 | #define HU_MAXLINELENGTH 80 38 | 39 | // 40 | // Typedefs of widgets 41 | // 42 | 43 | // Text Line widget 44 | // (parent of Scrolling Text and Input Text widgets) 45 | typedef struct 46 | { 47 | // left-justified position of scrolling text window 48 | int x; 49 | int y; 50 | 51 | patch_t** f; // font 52 | int sc; // start character 53 | char l[HU_MAXLINELENGTH+1]; // line of text 54 | int len; // current line length 55 | 56 | // whether this line needs to be udpated 57 | int needsupdate; 58 | 59 | } hu_textline_t; 60 | 61 | 62 | 63 | // Scrolling Text window widget 64 | // (child of Text Line widget) 65 | typedef struct 66 | { 67 | hu_textline_t l[HU_MAXLINES]; // text lines to draw 68 | int h; // height in lines 69 | int cl; // current line number 70 | 71 | // pointer to boolean stating whether to update window 72 | boolean* on; 73 | boolean laston; // last value of *->on. 74 | 75 | } hu_stext_t; 76 | 77 | 78 | 79 | // Input Text Line widget 80 | // (child of Text Line widget) 81 | typedef struct 82 | { 83 | hu_textline_t l; // text line to input on 84 | 85 | // left margin past which I am not to delete characters 86 | int lm; 87 | 88 | // pointer to boolean stating whether to update window 89 | boolean* on; 90 | boolean laston; // last value of *->on; 91 | 92 | } hu_itext_t; 93 | 94 | 95 | // 96 | // Widget creation, access, and update routines 97 | // 98 | 99 | // initializes heads-up widget library 100 | void HUlib_init(void); 101 | 102 | // 103 | // textline code 104 | // 105 | 106 | // clear a line of text 107 | void HUlib_clearTextLine(hu_textline_t *t); 108 | 109 | void HUlib_initTextLine(hu_textline_t *t, int x, int y, patch_t **f, int sc); 110 | 111 | // returns success 112 | boolean HUlib_addCharToTextLine(hu_textline_t *t, char ch); 113 | 114 | // returns success 115 | boolean HUlib_delCharFromTextLine(hu_textline_t *t); 116 | 117 | // draws tline 118 | void HUlib_drawTextLine(hu_textline_t *l, boolean drawcursor); 119 | 120 | // erases text line 121 | void HUlib_eraseTextLine(hu_textline_t *l); 122 | 123 | 124 | // 125 | // Scrolling Text window widget routines 126 | // 127 | 128 | // ? 129 | void 130 | HUlib_initSText 131 | ( hu_stext_t* s, 132 | int x, 133 | int y, 134 | int h, 135 | patch_t** font, 136 | int startchar, 137 | boolean* on ); 138 | 139 | // add a new line 140 | void HUlib_addLineToSText(hu_stext_t* s); 141 | 142 | // ? 143 | void 144 | HUlib_addMessageToSText 145 | ( hu_stext_t* s, 146 | char* prefix, 147 | char* msg ); 148 | 149 | // draws stext 150 | void HUlib_drawSText(hu_stext_t* s); 151 | 152 | // erases all stext lines 153 | void HUlib_eraseSText(hu_stext_t* s); 154 | 155 | // Input Text Line widget routines 156 | void 157 | HUlib_initIText 158 | ( hu_itext_t* it, 159 | int x, 160 | int y, 161 | patch_t** font, 162 | int startchar, 163 | boolean* on ); 164 | 165 | // enforces left margin 166 | void HUlib_delCharFromIText(hu_itext_t* it); 167 | 168 | // enforces left margin 169 | void HUlib_eraseLineFromIText(hu_itext_t* it); 170 | 171 | // resets line and left margin 172 | void HUlib_resetIText(hu_itext_t* it); 173 | 174 | // left of left-margin 175 | void 176 | HUlib_addPrefixToIText 177 | ( hu_itext_t* it, 178 | char* str ); 179 | 180 | // whether eaten 181 | boolean 182 | HUlib_keyInIText 183 | ( hu_itext_t* it, 184 | unsigned char ch ); 185 | 186 | void HUlib_drawIText(hu_itext_t* it); 187 | 188 | // erases all itext lines 189 | void HUlib_eraseIText(hu_itext_t* it); 190 | 191 | #endif 192 | //----------------------------------------------------------------------------- 193 | // 194 | // $Log:$ 195 | // 196 | //----------------------------------------------------------------------------- 197 | -------------------------------------------------------------------------------- /d_player.h: -------------------------------------------------------------------------------- 1 | // Emacs style mode select -*- C++ -*- 2 | //----------------------------------------------------------------------------- 3 | // 4 | // $Id:$ 5 | // 6 | // Copyright (C) 1993-1996 by id Software, Inc. 7 | // 8 | // This source is available for distribution and/or modification 9 | // only under the terms of the DOOM Source Code License as 10 | // published by id Software. All rights reserved. 11 | // 12 | // The source is distributed in the hope that it will be useful, 13 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | // FITNESS FOR A PARTICULAR PURPOSE. See the DOOM Source Code License 15 | // for more details. 16 | // 17 | // DESCRIPTION: 18 | // 19 | // 20 | //----------------------------------------------------------------------------- 21 | 22 | 23 | #ifndef __D_PLAYER__ 24 | #define __D_PLAYER__ 25 | 26 | 27 | // The player data structure depends on a number 28 | // of other structs: items (internal inventory), 29 | // animation states (closely tied to the sprites 30 | // used to represent them, unfortunately). 31 | #include "d_items.h" 32 | #include "p_pspr.h" 33 | 34 | // In addition, the player is just a special 35 | // case of the generic moving object/actor. 36 | #include "p_mobj.h" 37 | 38 | // Finally, for odd reasons, the player input 39 | // is buffered within the player data struct, 40 | // as commands per game tick. 41 | #include "d_ticcmd.h" 42 | 43 | #ifdef __GNUG__ 44 | #pragma interface 45 | #endif 46 | 47 | 48 | 49 | 50 | // 51 | // Player states. 52 | // 53 | typedef enum 54 | { 55 | // Playing or camping. 56 | PST_LIVE, 57 | // Dead on the ground, view follows killer. 58 | PST_DEAD, 59 | // Ready to restart/respawn??? 60 | PST_REBORN 61 | 62 | } playerstate_t; 63 | 64 | 65 | // 66 | // Player internal flags, for cheats and debug. 67 | // 68 | typedef enum 69 | { 70 | // No clipping, walk through barriers. 71 | CF_NOCLIP = 1, 72 | // No damage, no health loss. 73 | CF_GODMODE = 2, 74 | // Not really a cheat, just a debug aid. 75 | CF_NOMOMENTUM = 4 76 | 77 | } cheat_t; 78 | 79 | 80 | // 81 | // Extended player object info: player_t 82 | // 83 | typedef struct player_s 84 | { 85 | mobj_t* mo; 86 | playerstate_t playerstate; 87 | ticcmd_t cmd; 88 | 89 | // Determine POV, 90 | // including viewpoint bobbing during movement. 91 | // Focal origin above r.z 92 | fixed_t viewz; 93 | // Base height above floor for viewz. 94 | fixed_t viewheight; 95 | // Bob/squat speed. 96 | fixed_t deltaviewheight; 97 | // bounded/scaled total momentum. 98 | fixed_t bob; 99 | 100 | // This is only used between levels, 101 | // mo->health is used during levels. 102 | int health; 103 | int armorpoints; 104 | // Armor type is 0-2. 105 | int armortype; 106 | 107 | // Power ups. invinc and invis are tic counters. 108 | int powers[NUMPOWERS]; 109 | boolean cards[NUMCARDS]; 110 | boolean backpack; 111 | 112 | // Frags, kills of other players. 113 | int frags[MAXPLAYERS]; 114 | weapontype_t readyweapon; 115 | 116 | // Is wp_nochange if not changing. 117 | weapontype_t pendingweapon; 118 | 119 | boolean weaponowned[NUMWEAPONS]; 120 | int ammo[NUMAMMO]; 121 | int maxammo[NUMAMMO]; 122 | 123 | // True if button down last tic. 124 | int attackdown; 125 | int usedown; 126 | 127 | // Bit flags, for cheats and debug. 128 | // See cheat_t, above. 129 | int cheats; 130 | 131 | // Refired shots are less accurate. 132 | int refire; 133 | 134 | // For intermission stats. 135 | int killcount; 136 | int itemcount; 137 | int secretcount; 138 | 139 | // Hint messages. 140 | char* message; 141 | 142 | // For screen flashing (red or bright). 143 | int damagecount; 144 | int bonuscount; 145 | 146 | // Who did damage (NULL for floors/ceilings). 147 | mobj_t* attacker; 148 | 149 | // So gun flashes light up areas. 150 | int extralight; 151 | 152 | // Current PLAYPAL, ??? 153 | // can be set to REDCOLORMAP for pain, etc. 154 | int fixedcolormap; 155 | 156 | // Player skin colorshift, 157 | // 0-3 for which color to draw player. 158 | int colormap; 159 | 160 | // Overlay view sprites (gun, etc). 161 | pspdef_t psprites[NUMPSPRITES]; 162 | 163 | // True if secret level has been done. 164 | boolean didsecret; 165 | 166 | } player_t; 167 | 168 | 169 | // 170 | // INTERMISSION 171 | // Structure passed e.g. to WI_Start(wb) 172 | // 173 | typedef struct 174 | { 175 | boolean in; // whether the player is in game 176 | 177 | // Player stats, kills, collected items etc. 178 | int skills; 179 | int sitems; 180 | int ssecret; 181 | int stime; 182 | int frags[4]; 183 | int score; // current score on entry, modified on return 184 | 185 | } wbplayerstruct_t; 186 | 187 | typedef struct 188 | { 189 | int epsd; // episode # (0-2) 190 | 191 | // if true, splash the secret level 192 | boolean didsecret; 193 | 194 | // previous and next levels, origin 0 195 | int last; 196 | int next; 197 | 198 | int maxkills; 199 | int maxitems; 200 | int maxsecret; 201 | int maxfrags; 202 | 203 | // the par time 204 | int partime; 205 | 206 | // index of this player in game 207 | int pnum; 208 | 209 | wbplayerstruct_t plyr[MAXPLAYERS]; 210 | 211 | } wbstartstruct_t; 212 | 213 | 214 | #endif 215 | //----------------------------------------------------------------------------- 216 | // 217 | // $Log:$ 218 | // 219 | //----------------------------------------------------------------------------- 220 | -------------------------------------------------------------------------------- /DOOMLIC.TXT: -------------------------------------------------------------------------------- 1 | 2 | 3 | LIMITED USE SOFTWARE LICENSE AGREEMENT 4 | 5 | This Limited Use Software License Agreement (the "Agreement") 6 | is a legal agreement between you, the end-user, and Id Software, Inc. 7 | ("ID"). By downloading or purchasing the software material, which 8 | includes source code (the "Source Code"), artwork data, music and 9 | software tools (collectively, the "Software"), you are agreeing to 10 | be bound by the terms of this Agreement. If you do not agree to the 11 | terms of this Agreement, promptly destroy the Software you may have 12 | downloaded or copied. 13 | 14 | ID SOFTWARE LICENSE 15 | 16 | 1. Grant of License. ID grants to you the right to use the 17 | Software. You have no ownership or proprietary rights in or to the 18 | Software, or the Trademark. For purposes of this section, "use" means 19 | loading the Software into RAM, as well as installation on a hard disk 20 | or other storage device. The Software, together with any archive copy 21 | thereof, shall be destroyed when no longer used in accordance with 22 | this Agreement, or when the right to use the Software is terminated. 23 | You agree that the Software will not be shipped, transferred or 24 | exported into any country in violation of the U.S. Export 25 | Administration Act (or any other law governing such matters) and that 26 | you will not utilize, in any other manner, the Software in violation 27 | of any applicable law. 28 | 29 | 2. Permitted Uses. For educational purposes only, you, the 30 | end-user, may use portions of the Source Code, such as particular 31 | routines, to develop your own software, but may not duplicate the 32 | Source Code, except as noted in paragraph 4. The limited right 33 | referenced in the preceding sentence is hereinafter referred to as 34 | "Educational Use." By so exercising the Educational Use right you 35 | shall not obtain any ownership, copyright, proprietary or other 36 | interest in or to the Source Code, or any portion of the Source 37 | Code. You may dispose of your own software in your sole discretion. 38 | With the exception of the Educational Use right, you may not 39 | otherwise use the Software, or an portion of the Software, which 40 | includes the Source Code, for commercial gain. 41 | 42 | 3. Prohibited Uses: Under no circumstances shall you, the 43 | end-user, be permitted, allowed or authorized to commercially exploit 44 | the Software. Neither you nor anyone at your direction shall do any 45 | of the following acts with regard to the Software, or any portion 46 | thereof: 47 | 48 | Rent; 49 | 50 | Sell; 51 | 52 | Lease; 53 | 54 | Offer on a pay-per-play basis; 55 | 56 | Distribute for money or any other consideration; or 57 | 58 | In any other manner and through any medium whatsoever 59 | commercially exploit or use for any commercial purpose. 60 | 61 | Notwithstanding the foregoing prohibitions, you may commercially 62 | exploit the software you develop by exercising the Educational Use 63 | right, referenced in paragraph 2. hereinabove. 64 | 65 | 4. Copyright. The Software and all copyrights related thereto 66 | (including all characters and other images generated by the Software 67 | or depicted in the Software) are owned by ID and is protected by 68 | United States copyright laws and international treaty provisions. 69 | Id shall retain exclusive ownership and copyright in and to the 70 | Software and all portions of the Software and you shall have no 71 | ownership or other proprietary interest in such materials. You must 72 | treat the Software like any other copyrighted material. You may not 73 | otherwise reproduce, copy or disclose to others, in whole or in any 74 | part, the Software. You may not copy the written materials 75 | accompanying the Software. You agree to use your best efforts to 76 | see that any user of the Software licensed hereunder complies with 77 | this Agreement. 78 | 79 | 5. NO WARRANTIES. ID DISCLAIMS ALL WARRANTIES, BOTH EXPRESS 80 | IMPLIED, INCLUDING BUT NOT LIMITED TO, IMPLIED WARRANTIES OF 81 | MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE WITH RESPECT 82 | TO THE SOFTWARE. THIS LIMITED WARRANTY GIVES YOU SPECIFIC LEGAL 83 | RIGHTS. YOU MAY HAVE OTHER RIGHTS WHICH VARY FROM JURISDICTION TO 84 | JURISDICTION. ID DOES NOT WARRANT THAT THE OPERATION OF THE SOFTWARE 85 | WILL BE UNINTERRUPTED, ERROR FREE OR MEET YOUR SPECIFIC REQUIREMENTS. 86 | THE WARRANTY SET FORTH ABOVE IS IN LIEU OF ALL OTHER EXPRESS 87 | WARRANTIES WHETHER ORAL OR WRITTEN. THE AGENTS, EMPLOYEES, 88 | DISTRIBUTORS, AND DEALERS OF ID ARE NOT AUTHORIZED TO MAKE 89 | MODIFICATIONS TO THIS WARRANTY, OR ADDITIONAL WARRANTIES ON BEHALF 90 | OF ID. 91 | 92 | Exclusive Remedies. The Software is being offered to you 93 | free of any charge. You agree that you have no remedy against ID, its 94 | affiliates, contractors, suppliers, and agents for loss or damage 95 | caused by any defect or failure in the Software regardless of the form 96 | of action, whether in contract, tort, includinegligence, strict 97 | liability or otherwise, with regard to the Software. This Agreement 98 | shall be construed in accordance with and governed by the laws of the 99 | State of Texas. Copyright and other proprietary matters will be 100 | governed by United States laws and international treaties. IN ANY 101 | CASE, ID SHALL NOT BE LIABLE FOR LOSS OF DATA, LOSS OF PROFITS, LOST 102 | SAVINGS, SPECIAL, INCIDENTAL, CONSEQUENTIAL, INDIRECT OR OTHER 103 | SIMILAR DAMAGES ARISING FROM BREACH OF WARRANTY, BREACH OF CONTRACT, 104 | NEGLIGENCE, OR OTHER LEGAL THEORY EVEN IF ID OR ITS AGENT HAS BEEN 105 | ADVISED OF THE POSSIBILITY OF SUCH DAMAGES, OR FOR ANY CLAIM BY ANY 106 | OTHER PARTY. Some jurisdictions do not allow the exclusion or 107 | limitation of incidental or consequential damages, so the above 108 | limitation or exclusion may not apply to you. 109 | 110 | 111 | 112 | 113 | -------------------------------------------------------------------------------- /doomdata.h: -------------------------------------------------------------------------------- 1 | // Emacs style mode select -*- C++ -*- 2 | //----------------------------------------------------------------------------- 3 | // 4 | // $Id:$ 5 | // 6 | // Copyright (C) 1993-1996 by id Software, Inc. 7 | // 8 | // This source is available for distribution and/or modification 9 | // only under the terms of the DOOM Source Code License as 10 | // published by id Software. All rights reserved. 11 | // 12 | // The source is distributed in the hope that it will be useful, 13 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | // FITNESS FOR A PARTICULAR PURPOSE. See the DOOM Source Code License 15 | // for more details. 16 | // 17 | // DESCRIPTION: 18 | // all external data is defined here 19 | // most of the data is loaded into different structures at run time 20 | // some internal structures shared by many modules are here 21 | // 22 | //----------------------------------------------------------------------------- 23 | 24 | #ifndef __DOOMDATA__ 25 | #define __DOOMDATA__ 26 | 27 | // The most basic types we use, portability. 28 | #include "doomtype.h" 29 | 30 | // Some global defines, that configure the game. 31 | #include "doomdef.h" 32 | 33 | 34 | 35 | // 36 | // Map level types. 37 | // The following data structures define the persistent format 38 | // used in the lumps of the WAD files. 39 | // 40 | 41 | // Lump order in a map WAD: each map needs a couple of lumps 42 | // to provide a complete scene geometry description. 43 | enum 44 | { 45 | ML_LABEL, // A separator, name, ExMx or MAPxx 46 | ML_THINGS, // Monsters, items.. 47 | ML_LINEDEFS, // LineDefs, from editing 48 | ML_SIDEDEFS, // SideDefs, from editing 49 | ML_VERTEXES, // Vertices, edited and BSP splits generated 50 | ML_SEGS, // LineSegs, from LineDefs split by BSP 51 | ML_SSECTORS, // SubSectors, list of LineSegs 52 | ML_NODES, // BSP nodes 53 | ML_SECTORS, // Sectors, from editing 54 | ML_REJECT, // LUT, sector-sector visibility 55 | ML_BLOCKMAP // LUT, motion clipping, walls/grid element 56 | }; 57 | 58 | 59 | // A single Vertex. 60 | typedef struct 61 | { 62 | short x; 63 | short y; 64 | } mapvertex_t; 65 | 66 | 67 | // A SideDef, defining the visual appearance of a wall, 68 | // by setting textures and offsets. 69 | typedef struct 70 | { 71 | short textureoffset; 72 | short rowoffset; 73 | char toptexture[8]; 74 | char bottomtexture[8]; 75 | char midtexture[8]; 76 | // Front sector, towards viewer. 77 | short sector; 78 | } mapsidedef_t; 79 | 80 | 81 | 82 | // A LineDef, as used for editing, and as input 83 | // to the BSP builder. 84 | typedef struct 85 | { 86 | short v1; 87 | short v2; 88 | short flags; 89 | short special; 90 | short tag; 91 | // sidenum[1] will be -1 if one sided 92 | short sidenum[2]; 93 | } maplinedef_t; 94 | 95 | 96 | // 97 | // LineDef attributes. 98 | // 99 | 100 | // Solid, is an obstacle. 101 | #define ML_BLOCKING 1 102 | 103 | // Blocks monsters only. 104 | #define ML_BLOCKMONSTERS 2 105 | 106 | // Backside will not be present at all 107 | // if not two sided. 108 | #define ML_TWOSIDED 4 109 | 110 | // If a texture is pegged, the texture will have 111 | // the end exposed to air held constant at the 112 | // top or bottom of the texture (stairs or pulled 113 | // down things) and will move with a height change 114 | // of one of the neighbor sectors. 115 | // Unpegged textures allways have the first row of 116 | // the texture at the top pixel of the line for both 117 | // top and bottom textures (use next to windows). 118 | 119 | // upper texture unpegged 120 | #define ML_DONTPEGTOP 8 121 | 122 | // lower texture unpegged 123 | #define ML_DONTPEGBOTTOM 16 124 | 125 | // In AutoMap: don't map as two sided: IT'S A SECRET! 126 | #define ML_SECRET 32 127 | 128 | // Sound rendering: don't let sound cross two of these. 129 | #define ML_SOUNDBLOCK 64 130 | 131 | // Don't draw on the automap at all. 132 | #define ML_DONTDRAW 128 133 | 134 | // Set if already seen, thus drawn in automap. 135 | #define ML_MAPPED 256 136 | 137 | 138 | 139 | 140 | // Sector definition, from editing. 141 | typedef struct 142 | { 143 | short floorheight; 144 | short ceilingheight; 145 | char floorpic[8]; 146 | char ceilingpic[8]; 147 | short lightlevel; 148 | short special; 149 | short tag; 150 | } mapsector_t; 151 | 152 | // SubSector, as generated by BSP. 153 | typedef struct 154 | { 155 | short numsegs; 156 | // Index of first one, segs are stored sequentially. 157 | short firstseg; 158 | } mapsubsector_t; 159 | 160 | 161 | // LineSeg, generated by splitting LineDefs 162 | // using partition lines selected by BSP builder. 163 | typedef struct 164 | { 165 | short v1; 166 | short v2; 167 | short angle; 168 | short linedef; 169 | short side; 170 | short offset; 171 | } mapseg_t; 172 | 173 | 174 | 175 | // BSP node structure. 176 | 177 | // Indicate a leaf. 178 | #define NF_SUBSECTOR 0x8000 179 | 180 | typedef struct 181 | { 182 | // Partition line from (x,y) to x+dx,y+dy) 183 | short x; 184 | short y; 185 | short dx; 186 | short dy; 187 | 188 | // Bounding box for each child, 189 | // clip against view frustum. 190 | short bbox[2][4]; 191 | 192 | // If NF_SUBSECTOR its a subsector, 193 | // else it's a node of another subtree. 194 | unsigned short children[2]; 195 | 196 | } mapnode_t; 197 | 198 | 199 | 200 | 201 | // Thing definition, position, orientation and type, 202 | // plus skill/visibility flags and attributes. 203 | typedef struct 204 | { 205 | short x; 206 | short y; 207 | short angle; 208 | short type; 209 | short options; 210 | } mapthing_t; 211 | 212 | 213 | 214 | 215 | 216 | #endif // __DOOMDATA__ 217 | //----------------------------------------------------------------------------- 218 | // 219 | // $Log:$ 220 | // 221 | //----------------------------------------------------------------------------- 222 | 223 | -------------------------------------------------------------------------------- /config.status: -------------------------------------------------------------------------------- 1 | #! /bin/sh 2 | # Generated automatically by configure. 3 | # Run this file to recreate the current configuration. 4 | # This directory was configured as follows, 5 | # on host zen: 6 | # 7 | # ./configure 8 | # 9 | # Compiler output produced by configure, useful for debugging 10 | # configure, is in ./config.log if it exists. 11 | 12 | ac_cs_usage="Usage: ./config.status [--recheck] [--version] [--help]" 13 | for ac_option 14 | do 15 | case "$ac_option" in 16 | -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r) 17 | echo "running ${CONFIG_SHELL-/bin/sh} ./configure --no-create --no-recursion" 18 | exec ${CONFIG_SHELL-/bin/sh} ./configure --no-create --no-recursion ;; 19 | -version | --version | --versio | --versi | --vers | --ver | --ve | --v) 20 | echo "./config.status generated by autoconf version 2.13" 21 | exit 0 ;; 22 | -help | --help | --hel | --he | --h) 23 | echo "$ac_cs_usage"; exit 0 ;; 24 | *) echo "$ac_cs_usage"; exit 1 ;; 25 | esac 26 | done 27 | 28 | ac_given_srcdir=. 29 | ac_given_INSTALL="/usr/bin/install -c" 30 | 31 | trap 'rm -fr 32 | Makefile conftest*; exit 1' 1 2 15 33 | 34 | # Protect against being on the right side of a sed subst in config.status. 35 | sed 's/%@/@@/; s/@%/@@/; s/%g$/@g/; /@g$/s/[\\&%]/\\&/g; 36 | s/@@/%@/; s/@@/@%/; s/@g$/%g/' > conftest.subs <<\CEOF 37 | /^[ ]*VPATH[ ]*=[^:]*$/d 38 | 39 | s%@SHELL@%/bin/sh%g 40 | s%@CFLAGS@%-g -O2 -I/usr/include/SDL -D_GNU_SOURCE=1 -D_REENTRANT%g 41 | s%@CPPFLAGS@%%g 42 | s%@CXXFLAGS@%%g 43 | s%@FFLAGS@%%g 44 | s%@DEFS@% -DPACKAGE=\"sdldoom\" -DVERSION=\"1.10\" %g 45 | s%@LDFLAGS@%%g 46 | s%@LIBS@% -L/usr/lib -lSDL%g 47 | s%@exec_prefix@%${prefix}%g 48 | s%@prefix@%/usr/local%g 49 | s%@program_transform_name@%s,x,x,%g 50 | s%@bindir@%${exec_prefix}/bin%g 51 | s%@sbindir@%${exec_prefix}/sbin%g 52 | s%@libexecdir@%${exec_prefix}/libexec%g 53 | s%@datadir@%${prefix}/share%g 54 | s%@sysconfdir@%${prefix}/etc%g 55 | s%@sharedstatedir@%${prefix}/com%g 56 | s%@localstatedir@%${prefix}/var%g 57 | s%@libdir@%${exec_prefix}/lib%g 58 | s%@includedir@%${prefix}/include%g 59 | s%@oldincludedir@%/usr/include%g 60 | s%@infodir@%${prefix}/info%g 61 | s%@mandir@%${prefix}/man%g 62 | s%@INSTALL_PROGRAM@%${INSTALL}%g 63 | s%@INSTALL_SCRIPT@%${INSTALL_PROGRAM}%g 64 | s%@INSTALL_DATA@%${INSTALL} -m 644%g 65 | s%@PACKAGE@%sdldoom%g 66 | s%@VERSION@%1.10%g 67 | s%@ACLOCAL@%aclocal%g 68 | s%@AUTOCONF@%autoconf%g 69 | s%@AUTOMAKE@%automake%g 70 | s%@AUTOHEADER@%autoheader%g 71 | s%@MAKEINFO@%/home/lukasz/code/ps2/projects/sdldoom-1.10/missing makeinfo%g 72 | s%@SET_MAKE@%%g 73 | s%@CC@%gcc%g 74 | s%@SDL_CONFIG@%/usr/bin/sdl-config%g 75 | s%@SDL_CFLAGS@%-I/usr/include/SDL -D_GNU_SOURCE=1 -D_REENTRANT%g 76 | s%@SDL_LIBS@%-L/usr/lib -lSDL%g 77 | 78 | CEOF 79 | 80 | # Split the substitutions into bite-sized pieces for seds with 81 | # small command number limits, like on Digital OSF/1 and HP-UX. 82 | ac_max_sed_cmds=90 # Maximum number of lines to put in a sed script. 83 | ac_file=1 # Number of current file. 84 | ac_beg=1 # First line for current file. 85 | ac_end=$ac_max_sed_cmds # Line after last line for current file. 86 | ac_more_lines=: 87 | ac_sed_cmds="" 88 | while $ac_more_lines; do 89 | if test $ac_beg -gt 1; then 90 | sed "1,${ac_beg}d; ${ac_end}q" conftest.subs > conftest.s$ac_file 91 | else 92 | sed "${ac_end}q" conftest.subs > conftest.s$ac_file 93 | fi 94 | if test ! -s conftest.s$ac_file; then 95 | ac_more_lines=false 96 | rm -f conftest.s$ac_file 97 | else 98 | if test -z "$ac_sed_cmds"; then 99 | ac_sed_cmds="sed -f conftest.s$ac_file" 100 | else 101 | ac_sed_cmds="$ac_sed_cmds | sed -f conftest.s$ac_file" 102 | fi 103 | ac_file=`expr $ac_file + 1` 104 | ac_beg=$ac_end 105 | ac_end=`expr $ac_end + $ac_max_sed_cmds` 106 | fi 107 | done 108 | if test -z "$ac_sed_cmds"; then 109 | ac_sed_cmds=cat 110 | fi 111 | 112 | CONFIG_FILES=${CONFIG_FILES-"Makefile 113 | "} 114 | for ac_file in .. $CONFIG_FILES; do if test "x$ac_file" != x..; then 115 | # Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in". 116 | case "$ac_file" in 117 | *:*) ac_file_in=`echo "$ac_file"|sed 's%[^:]*:%%'` 118 | ac_file=`echo "$ac_file"|sed 's%:.*%%'` ;; 119 | *) ac_file_in="${ac_file}.in" ;; 120 | esac 121 | 122 | # Adjust a relative srcdir, top_srcdir, and INSTALL for subdirectories. 123 | 124 | # Remove last slash and all that follows it. Not all systems have dirname. 125 | ac_dir=`echo $ac_file|sed 's%/[^/][^/]*$%%'` 126 | if test "$ac_dir" != "$ac_file" && test "$ac_dir" != .; then 127 | # The file is in a subdirectory. 128 | test ! -d "$ac_dir" && mkdir "$ac_dir" 129 | ac_dir_suffix="/`echo $ac_dir|sed 's%^\./%%'`" 130 | # A "../" for each directory in $ac_dir_suffix. 131 | ac_dots=`echo $ac_dir_suffix|sed 's%/[^/]*%../%g'` 132 | else 133 | ac_dir_suffix= ac_dots= 134 | fi 135 | 136 | case "$ac_given_srcdir" in 137 | .) srcdir=. 138 | if test -z "$ac_dots"; then top_srcdir=. 139 | else top_srcdir=`echo $ac_dots|sed 's%/$%%'`; fi ;; 140 | /*) srcdir="$ac_given_srcdir$ac_dir_suffix"; top_srcdir="$ac_given_srcdir" ;; 141 | *) # Relative path. 142 | srcdir="$ac_dots$ac_given_srcdir$ac_dir_suffix" 143 | top_srcdir="$ac_dots$ac_given_srcdir" ;; 144 | esac 145 | 146 | case "$ac_given_INSTALL" in 147 | [/$]*) INSTALL="$ac_given_INSTALL" ;; 148 | *) INSTALL="$ac_dots$ac_given_INSTALL" ;; 149 | esac 150 | 151 | echo creating "$ac_file" 152 | rm -f "$ac_file" 153 | configure_input="Generated automatically from `echo $ac_file_in|sed 's%.*/%%'` by configure." 154 | case "$ac_file" in 155 | *Makefile*) ac_comsub="1i\\ 156 | # $configure_input" ;; 157 | *) ac_comsub= ;; 158 | esac 159 | 160 | ac_file_inputs=`echo $ac_file_in|sed -e "s%^%$ac_given_srcdir/%" -e "s%:% $ac_given_srcdir/%g"` 161 | sed -e "$ac_comsub 162 | s%@configure_input@%$configure_input%g 163 | s%@srcdir@%$srcdir%g 164 | s%@top_srcdir@%$top_srcdir%g 165 | s%@INSTALL@%$INSTALL%g 166 | " $ac_file_inputs | (eval "$ac_sed_cmds") > $ac_file 167 | fi; done 168 | rm -f conftest.s* 169 | 170 | 171 | 172 | exit 0 173 | -------------------------------------------------------------------------------- /st_lib.c: -------------------------------------------------------------------------------- 1 | // Emacs style mode select -*- C++ -*- 2 | //----------------------------------------------------------------------------- 3 | // 4 | // $Id:$ 5 | // 6 | // Copyright (C) 1993-1996 by id Software, Inc. 7 | // 8 | // This source is available for distribution and/or modification 9 | // only under the terms of the DOOM Source Code License as 10 | // published by id Software. All rights reserved. 11 | // 12 | // The source is distributed in the hope that it will be useful, 13 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | // FITNESS FOR A PARTICULAR PURPOSE. See the DOOM Source Code License 15 | // for more details. 16 | // 17 | // $Log:$ 18 | // 19 | // DESCRIPTION: 20 | // The status bar widget code. 21 | // 22 | //----------------------------------------------------------------------------- 23 | 24 | 25 | static const char 26 | rcsid[] = "$Id: st_lib.c,v 1.4 1997/02/03 16:47:56 b1 Exp $"; 27 | 28 | #include 29 | 30 | #include "m_swap.h" 31 | 32 | #include "doomdef.h" 33 | 34 | #include "z_zone.h" 35 | #include "v_video.h" 36 | 37 | #include "i_system.h" 38 | 39 | #include "w_wad.h" 40 | 41 | #include "st_stuff.h" 42 | #include "st_lib.h" 43 | #include "r_local.h" 44 | 45 | 46 | // in AM_map.c 47 | extern boolean automapactive; 48 | 49 | 50 | 51 | 52 | // 53 | // Hack display negative frags. 54 | // Loads and store the stminus lump. 55 | // 56 | patch_t* sttminus; 57 | 58 | void STlib_init(void) 59 | { 60 | sttminus = (patch_t *) W_CacheLumpName("STTMINUS", PU_STATIC); 61 | } 62 | 63 | 64 | // ? 65 | void 66 | STlib_initNum 67 | ( st_number_t* n, 68 | int x, 69 | int y, 70 | patch_t** pl, 71 | int* num, 72 | boolean* on, 73 | int width ) 74 | { 75 | n->x = x; 76 | n->y = y; 77 | n->oldnum = 0; 78 | n->width = width; 79 | n->num = num; 80 | n->on = on; 81 | n->p = pl; 82 | } 83 | 84 | 85 | // 86 | // A fairly efficient way to draw a number 87 | // based on differences from the old number. 88 | // Note: worth the trouble? 89 | // 90 | void 91 | STlib_drawNum 92 | ( st_number_t* n, 93 | boolean refresh ) 94 | { 95 | 96 | int numdigits = n->width; 97 | int num = *n->num; 98 | 99 | int w = SHORT(n->p[0]->width); 100 | int h = SHORT(n->p[0]->height); 101 | int x = n->x; 102 | 103 | int neg; 104 | 105 | n->oldnum = *n->num; 106 | 107 | neg = num < 0; 108 | 109 | if (neg) 110 | { 111 | if (numdigits == 2 && num < -9) 112 | num = -9; 113 | else if (numdigits == 3 && num < -99) 114 | num = -99; 115 | 116 | num = -num; 117 | } 118 | 119 | // clear the area 120 | x = n->x - numdigits*w; 121 | 122 | if (n->y - ST_Y < 0) 123 | I_Error("drawNum: n->y - ST_Y < 0"); 124 | 125 | V_CopyRect(x, n->y - ST_Y, BG, w*numdigits, h, x, n->y, FG); 126 | 127 | // if non-number, do not draw it 128 | if (num == 1994) 129 | return; 130 | 131 | x = n->x; 132 | 133 | // in the special case of 0, you draw 0 134 | if (!num) 135 | V_DrawPatch(x - w, n->y, FG, n->p[ 0 ]); 136 | 137 | // draw the new number 138 | while (num && numdigits--) 139 | { 140 | x -= w; 141 | V_DrawPatch(x, n->y, FG, n->p[ num % 10 ]); 142 | num /= 10; 143 | } 144 | 145 | // draw a minus sign if necessary 146 | if (neg) 147 | V_DrawPatch(x - 8, n->y, FG, sttminus); 148 | } 149 | 150 | 151 | // 152 | void 153 | STlib_updateNum 154 | ( st_number_t* n, 155 | boolean refresh ) 156 | { 157 | if (*n->on) STlib_drawNum(n, refresh); 158 | } 159 | 160 | 161 | // 162 | void 163 | STlib_initPercent 164 | ( st_percent_t* p, 165 | int x, 166 | int y, 167 | patch_t** pl, 168 | int* num, 169 | boolean* on, 170 | patch_t* percent ) 171 | { 172 | STlib_initNum(&p->n, x, y, pl, num, on, 3); 173 | p->p = percent; 174 | } 175 | 176 | 177 | 178 | 179 | void 180 | STlib_updatePercent 181 | ( st_percent_t* per, 182 | int refresh ) 183 | { 184 | if (refresh && *per->n.on) 185 | V_DrawPatch(per->n.x, per->n.y, FG, per->p); 186 | 187 | STlib_updateNum(&per->n, refresh); 188 | } 189 | 190 | 191 | 192 | void 193 | STlib_initMultIcon 194 | ( st_multicon_t* i, 195 | int x, 196 | int y, 197 | patch_t** il, 198 | int* inum, 199 | boolean* on ) 200 | { 201 | i->x = x; 202 | i->y = y; 203 | i->oldinum = -1; 204 | i->inum = inum; 205 | i->on = on; 206 | i->p = il; 207 | } 208 | 209 | 210 | 211 | void 212 | STlib_updateMultIcon 213 | ( st_multicon_t* mi, 214 | boolean refresh ) 215 | { 216 | int w; 217 | int h; 218 | int x; 219 | int y; 220 | 221 | if (*mi->on 222 | && (mi->oldinum != *mi->inum || refresh) 223 | && (*mi->inum!=-1)) 224 | { 225 | if (mi->oldinum != -1) 226 | { 227 | x = mi->x - SHORT(mi->p[mi->oldinum]->leftoffset); 228 | y = mi->y - SHORT(mi->p[mi->oldinum]->topoffset); 229 | w = SHORT(mi->p[mi->oldinum]->width); 230 | h = SHORT(mi->p[mi->oldinum]->height); 231 | 232 | if (y - ST_Y < 0) 233 | I_Error("updateMultIcon: y - ST_Y < 0"); 234 | 235 | V_CopyRect(x, y-ST_Y, BG, w, h, x, y, FG); 236 | } 237 | V_DrawPatch(mi->x, mi->y, FG, mi->p[*mi->inum]); 238 | mi->oldinum = *mi->inum; 239 | } 240 | } 241 | 242 | 243 | 244 | void 245 | STlib_initBinIcon 246 | ( st_binicon_t* b, 247 | int x, 248 | int y, 249 | patch_t* i, 250 | boolean* val, 251 | boolean* on ) 252 | { 253 | b->x = x; 254 | b->y = y; 255 | b->oldval = 0; 256 | b->val = val; 257 | b->on = on; 258 | b->p = i; 259 | } 260 | 261 | 262 | 263 | void 264 | STlib_updateBinIcon 265 | ( st_binicon_t* bi, 266 | boolean refresh ) 267 | { 268 | int x; 269 | int y; 270 | int w; 271 | int h; 272 | 273 | if (*bi->on 274 | && (bi->oldval != *bi->val || refresh)) 275 | { 276 | x = bi->x - SHORT(bi->p->leftoffset); 277 | y = bi->y - SHORT(bi->p->topoffset); 278 | w = SHORT(bi->p->width); 279 | h = SHORT(bi->p->height); 280 | 281 | if (y - ST_Y < 0) 282 | I_Error("updateBinIcon: y - ST_Y < 0"); 283 | 284 | if (*bi->val) 285 | V_DrawPatch(bi->x, bi->y, FG, bi->p); 286 | else 287 | V_CopyRect(x, y-ST_Y, BG, w, h, x, y, FG); 288 | 289 | bi->oldval = *bi->val; 290 | } 291 | 292 | } 293 | 294 | -------------------------------------------------------------------------------- /sounds.h: -------------------------------------------------------------------------------- 1 | // Emacs style mode select -*- C++ -*- 2 | //----------------------------------------------------------------------------- 3 | // 4 | // $Id:$ 5 | // 6 | // Copyright (C) 1993-1996 by id Software, Inc. 7 | // 8 | // This source is available for distribution and/or modification 9 | // only under the terms of the DOOM Source Code License as 10 | // published by id Software. All rights reserved. 11 | // 12 | // The source is distributed in the hope that it will be useful, 13 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | // FITNESS FOR A PARTICULAR PURPOSE. See the DOOM Source Code License 15 | // for more details. 16 | // 17 | // DESCRIPTION: 18 | // Created by the sound utility written by Dave Taylor. 19 | // Kept as a sample, DOOM2 sounds. Frozen. 20 | // 21 | //----------------------------------------------------------------------------- 22 | 23 | #ifndef __SOUNDS__ 24 | #define __SOUNDS__ 25 | 26 | 27 | // 28 | // SoundFX struct. 29 | // 30 | typedef struct sfxinfo_struct sfxinfo_t; 31 | 32 | struct sfxinfo_struct 33 | { 34 | // up to 6-character name 35 | char* name; 36 | 37 | // Sfx singularity (only one at a time) 38 | int singularity; 39 | 40 | // Sfx priority 41 | int priority; 42 | 43 | // referenced sound if a link 44 | sfxinfo_t* link; 45 | 46 | // pitch if a link 47 | int pitch; 48 | 49 | // volume if a link 50 | int volume; 51 | 52 | // sound data 53 | void* data; 54 | 55 | // this is checked every second to see if sound 56 | // can be thrown out (if 0, then decrement, if -1, 57 | // then throw out, if > 0, then it is in use) 58 | int usefulness; 59 | 60 | // lump number of sfx 61 | int lumpnum; 62 | }; 63 | 64 | 65 | 66 | 67 | // 68 | // MusicInfo struct. 69 | // 70 | typedef struct 71 | { 72 | // up to 6-character name 73 | char* name; 74 | 75 | // lump number of music 76 | int lumpnum; 77 | 78 | // music data 79 | void* data; 80 | 81 | // music handle once registered 82 | int handle; 83 | 84 | } musicinfo_t; 85 | 86 | 87 | 88 | 89 | // the complete set of sound effects 90 | extern sfxinfo_t S_sfx[]; 91 | 92 | // the complete set of music 93 | extern musicinfo_t S_music[]; 94 | 95 | // 96 | // Identifiers for all music in game. 97 | // 98 | 99 | typedef enum 100 | { 101 | mus_None, 102 | mus_e1m1, 103 | mus_e1m2, 104 | mus_e1m3, 105 | mus_e1m4, 106 | mus_e1m5, 107 | mus_e1m6, 108 | mus_e1m7, 109 | mus_e1m8, 110 | mus_e1m9, 111 | mus_e2m1, 112 | mus_e2m2, 113 | mus_e2m3, 114 | mus_e2m4, 115 | mus_e2m5, 116 | mus_e2m6, 117 | mus_e2m7, 118 | mus_e2m8, 119 | mus_e2m9, 120 | mus_e3m1, 121 | mus_e3m2, 122 | mus_e3m3, 123 | mus_e3m4, 124 | mus_e3m5, 125 | mus_e3m6, 126 | mus_e3m7, 127 | mus_e3m8, 128 | mus_e3m9, 129 | mus_inter, 130 | mus_intro, 131 | mus_bunny, 132 | mus_victor, 133 | mus_introa, 134 | mus_runnin, 135 | mus_stalks, 136 | mus_countd, 137 | mus_betwee, 138 | mus_doom, 139 | mus_the_da, 140 | mus_shawn, 141 | mus_ddtblu, 142 | mus_in_cit, 143 | mus_dead, 144 | mus_stlks2, 145 | mus_theda2, 146 | mus_doom2, 147 | mus_ddtbl2, 148 | mus_runni2, 149 | mus_dead2, 150 | mus_stlks3, 151 | mus_romero, 152 | mus_shawn2, 153 | mus_messag, 154 | mus_count2, 155 | mus_ddtbl3, 156 | mus_ampie, 157 | mus_theda3, 158 | mus_adrian, 159 | mus_messg2, 160 | mus_romer2, 161 | mus_tense, 162 | mus_shawn3, 163 | mus_openin, 164 | mus_evil, 165 | mus_ultima, 166 | mus_read_m, 167 | mus_dm2ttl, 168 | mus_dm2int, 169 | NUMMUSIC 170 | } musicenum_t; 171 | 172 | 173 | // 174 | // Identifiers for all sfx in game. 175 | // 176 | 177 | typedef enum 178 | { 179 | sfx_None, 180 | sfx_pistol, 181 | sfx_shotgn, 182 | sfx_sgcock, 183 | sfx_dshtgn, 184 | sfx_dbopn, 185 | sfx_dbcls, 186 | sfx_dbload, 187 | sfx_plasma, 188 | sfx_bfg, 189 | sfx_sawup, 190 | sfx_sawidl, 191 | sfx_sawful, 192 | sfx_sawhit, 193 | sfx_rlaunc, 194 | sfx_rxplod, 195 | sfx_firsht, 196 | sfx_firxpl, 197 | sfx_pstart, 198 | sfx_pstop, 199 | sfx_doropn, 200 | sfx_dorcls, 201 | sfx_stnmov, 202 | sfx_swtchn, 203 | sfx_swtchx, 204 | sfx_plpain, 205 | sfx_dmpain, 206 | sfx_popain, 207 | sfx_vipain, 208 | sfx_mnpain, 209 | sfx_pepain, 210 | sfx_slop, 211 | sfx_itemup, 212 | sfx_wpnup, 213 | sfx_oof, 214 | sfx_telept, 215 | sfx_posit1, 216 | sfx_posit2, 217 | sfx_posit3, 218 | sfx_bgsit1, 219 | sfx_bgsit2, 220 | sfx_sgtsit, 221 | sfx_cacsit, 222 | sfx_brssit, 223 | sfx_cybsit, 224 | sfx_spisit, 225 | sfx_bspsit, 226 | sfx_kntsit, 227 | sfx_vilsit, 228 | sfx_mansit, 229 | sfx_pesit, 230 | sfx_sklatk, 231 | sfx_sgtatk, 232 | sfx_skepch, 233 | sfx_vilatk, 234 | sfx_claw, 235 | sfx_skeswg, 236 | sfx_pldeth, 237 | sfx_pdiehi, 238 | sfx_podth1, 239 | sfx_podth2, 240 | sfx_podth3, 241 | sfx_bgdth1, 242 | sfx_bgdth2, 243 | sfx_sgtdth, 244 | sfx_cacdth, 245 | sfx_skldth, 246 | sfx_brsdth, 247 | sfx_cybdth, 248 | sfx_spidth, 249 | sfx_bspdth, 250 | sfx_vildth, 251 | sfx_kntdth, 252 | sfx_pedth, 253 | sfx_skedth, 254 | sfx_posact, 255 | sfx_bgact, 256 | sfx_dmact, 257 | sfx_bspact, 258 | sfx_bspwlk, 259 | sfx_vilact, 260 | sfx_noway, 261 | sfx_barexp, 262 | sfx_punch, 263 | sfx_hoof, 264 | sfx_metal, 265 | sfx_chgun, 266 | sfx_tink, 267 | sfx_bdopn, 268 | sfx_bdcls, 269 | sfx_itmbk, 270 | sfx_flame, 271 | sfx_flamst, 272 | sfx_getpow, 273 | sfx_bospit, 274 | sfx_boscub, 275 | sfx_bossit, 276 | sfx_bospn, 277 | sfx_bosdth, 278 | sfx_manatk, 279 | sfx_mandth, 280 | sfx_sssit, 281 | sfx_ssdth, 282 | sfx_keenpn, 283 | sfx_keendt, 284 | sfx_skeact, 285 | sfx_skesit, 286 | sfx_skeatk, 287 | sfx_radio, 288 | NUMSFX 289 | } sfxenum_t; 290 | 291 | #endif 292 | //----------------------------------------------------------------------------- 293 | // 294 | // $Log:$ 295 | // 296 | //----------------------------------------------------------------------------- 297 | 298 | -------------------------------------------------------------------------------- /FILES: -------------------------------------------------------------------------------- 1 | total 1258 2 | -rw-r--r-- 1 b1 prog 0 Jan 18 15:08 FILES 3 | -rw-r--r-- 1 b1 prog 5799 Jan 18 15:07 Makefile 4 | -rw-r--r-- 1 b1 prog 1943 Jan 18 15:07 am_data.h 5 | -rw-r--r-- 1 b1 prog 20263 Jan 18 15:07 am_map.c 6 | -rw-r--r-- 1 b1 prog 2494 Jan 18 15:07 am_map.h 7 | -rw-r--r-- 1 b1 prog 1499 Jan 18 15:07 am_oids.c 8 | -rw-r--r-- 1 b1 prog 338 Jan 18 15:07 am_oids.h 9 | -rw-r--r-- 1 b1 prog 14005 Jan 18 15:07 d_french.h 10 | -rw-r--r-- 1 b1 prog 25287 Jan 18 15:07 d_main.c 11 | -rw-r--r-- 1 b1 prog 15586 Jan 18 15:07 d_net.c 12 | -rw-r--r-- 1 b1 prog 744 Jan 18 15:07 defs.inc 13 | -rw-r--r-- 1 b1 prog 3569 Jan 18 15:07 dither.c 14 | -rw-r--r-- 1 b1 prog 355 Jan 18 15:07 dither.h 15 | -rw-r--r-- 1 b1 prog 4234 Jan 18 15:07 doomdata.h 16 | -rw-r--r-- 1 b1 prog 32779 Jan 18 15:07 doomdef.h 17 | -rw-r--r-- 1 b1 prog 192 Jan 18 15:07 drcoord.h 18 | -rw-r--r-- 1 b1 prog 22377 Jan 18 15:07 dstrings.h 19 | -rw-r--r-- 1 b1 prog 6582 Jan 18 15:07 dutils.c 20 | -rw-r--r-- 1 b1 prog 1821 Jan 18 15:07 dutils.h 21 | -rw-r--r-- 1 b1 prog 14072 Jan 18 15:07 f_finale.c 22 | -rw-r--r-- 1 b1 prog 7357 Jan 18 15:07 fpfunc.S 23 | -rw-r--r-- 1 b1 prog 34770 Jan 18 15:07 g_game.c 24 | -rw-r--r-- 1 b1 prog 5394 Jan 18 15:07 hu_lib.c 25 | -rw-r--r-- 1 b1 prog 2878 Jan 18 15:07 hu_lib.h 26 | -rw-r--r-- 1 b1 prog 12040 Jan 18 15:07 hu_stuff.c 27 | -rw-r--r-- 1 b1 prog 934 Jan 18 15:07 hu_stuff.h 28 | -rw-r--r-- 1 b1 prog 6238 Jan 18 15:07 i_cyber.c 29 | -rw-r--r-- 1 b1 prog 18324 Jan 18 15:07 i_dga.c 30 | -rw-r--r-- 1 b1 prog 2499 Jan 18 15:07 i_header.h 31 | -rw-r--r-- 1 b1 prog 32815 Jan 18 15:07 i_ibm.c 32 | -rw-r--r-- 1 b1 prog 1867 Jan 18 15:07 i_ibm_a.asm 33 | -rw-r--r-- 1 b1 prog 121 Jan 18 15:07 i_main.c 34 | -rw-r--r-- 1 b1 prog 8251 Jan 18 15:07 i_pcnet.c 35 | -rw-r--r-- 1 b1 prog 8561 Jan 18 15:07 i_sound.c 36 | -rw-r--r-- 1 b1 prog 439 Jan 18 15:07 i_sound.h 37 | -rw-r--r-- 1 b1 prog 9537 Jan 18 15:07 i_svgalib.c 38 | -rw-r--r-- 1 b1 prog 10886 Jan 18 15:07 i_unix.c 39 | -rw-r--r-- 1 b1 prog 20891 Jan 18 15:07 i_x.c 40 | -rw-r--r-- 1 b1 prog 128797 Jan 18 15:07 info.c 41 | -rw-r--r-- 1 b1 prog 15840 Jan 18 15:07 info.h 42 | -rw-r--r-- 1 b1 prog 3477 Jan 18 15:07 irix.c 43 | -rw-r--r-- 1 b1 prog 240 Jan 18 15:07 irix.h 44 | -rw-r--r-- 1 b1 prog 1363 Jan 18 15:07 linux.c 45 | -rw-r--r-- 1 b1 prog 34628 Jan 18 15:07 m_menu.c 46 | -rw-r--r-- 1 b1 prog 13741 Jan 18 15:07 m_misc.c 47 | -rw-r--r-- 1 b1 prog 6117 Jan 18 15:07 p_ceilng.c 48 | -rw-r--r-- 1 b1 prog 15062 Jan 18 15:07 p_doors.c 49 | -rw-r--r-- 1 b1 prog 33758 Jan 18 15:07 p_enemy.c 50 | -rw-r--r-- 1 b1 prog 11409 Jan 18 15:07 p_floor.c 51 | -rw-r--r-- 1 b1 prog 16265 Jan 18 15:07 p_inter.c 52 | -rw-r--r-- 1 b1 prog 7592 Jan 18 15:07 p_lights.c 53 | -rw-r--r-- 1 b1 prog 6447 Jan 18 15:07 p_local.h 54 | -rw-r--r-- 1 b1 prog 30138 Jan 18 15:07 p_map.c 55 | -rw-r--r-- 1 b1 prog 14672 Jan 18 15:07 p_maputl.c 56 | -rw-r--r-- 1 b1 prog 17276 Jan 18 15:07 p_mobj.c 57 | -rw-r--r-- 1 b1 prog 5940 Jan 18 15:07 p_plats.c 58 | -rw-r--r-- 1 b1 prog 17084 Jan 18 15:07 p_pspr.c 59 | -rw-r--r-- 1 b1 prog 12828 Jan 18 15:07 p_setup.c 60 | -rw-r--r-- 1 b1 prog 5962 Jan 18 15:07 p_sight.c 61 | -rw-r--r-- 1 b1 prog 23846 Jan 18 15:07 p_spec.c 62 | -rw-r--r-- 1 b1 prog 11140 Jan 18 15:07 p_spec.h 63 | -rw-r--r-- 1 b1 prog 14229 Jan 18 15:07 p_switch.c 64 | -rw-r--r-- 1 b1 prog 1910 Jan 18 15:07 p_telept.c 65 | -rw-r--r-- 1 b1 prog 14075 Jan 18 15:07 p_tick.c 66 | -rw-r--r-- 1 b1 prog 7044 Jan 18 15:07 p_user.c 67 | -rw-r--r-- 1 b1 prog 13013 Jan 18 15:07 planar.asm 68 | -rw-r--r-- 1 b1 prog 9811 Jan 18 15:07 r_bsp.c 69 | -rw-r--r-- 1 b1 prog 14619 Jan 18 15:07 r_data.c 70 | -rw-r--r-- 1 b1 prog 13591 Jan 18 15:07 r_draw.c 71 | -rw-r--r-- 1 b1 prog 11378 Jan 18 15:07 r_local.h 72 | -rw-r--r-- 1 b1 prog 14868 Jan 18 15:07 r_main.c 73 | -rw-r--r-- 1 b1 prog 7108 Jan 18 15:07 r_plane.c 74 | -rw-r--r-- 1 b1 prog 15420 Jan 18 15:07 r_segs.c 75 | -rw-r--r-- 1 b1 prog 18969 Jan 18 15:07 r_things.c 76 | -rw-r--r-- 1 b1 prog 12274 Jan 18 15:07 s_sound.c 77 | -rw-r--r-- 1 b1 prog 12812 Jan 18 15:07 sndserver.c 78 | -rw-r--r-- 1 b1 prog 141 Jan 18 15:07 sndserver.h 79 | -rw-r--r-- 1 b1 prog 5811 Jan 18 15:07 sounds.c 80 | -rw-r--r-- 1 b1 prog 2674 Jan 18 15:07 sounds.h 81 | -rw-r--r-- 1 b1 prog 3975 Jan 18 15:07 soundst.h 82 | -rw-r--r-- 1 b1 prog 3461 Jan 18 15:07 st_lib.c 83 | -rw-r--r-- 1 b1 prog 2254 Jan 18 15:07 st_lib.h 84 | -rw-r--r-- 1 b1 prog 22769 Jan 18 15:07 st_stuff.c 85 | -rw-r--r-- 1 b1 prog 4685 Jan 18 15:07 st_stuff.h 86 | -rw-r--r-- 1 b1 prog 1725 Jan 18 15:07 sun.c 87 | -rw-r--r-- 1 b1 prog 75 Jan 18 15:07 t.c 88 | -rw-r--r-- 1 b1 prog 114621 Jan 18 15:07 tables.c 89 | -rw-r--r-- 1 b1 prog 5485 Jan 18 15:07 tmap.S 90 | -rw-r--r-- 1 b1 prog 10904 Jan 18 15:07 v_video.c 91 | -rw-r--r-- 1 b1 prog 268 Jan 18 15:07 vgaview.h 92 | -rw-r--r-- 1 b1 prog 9920 Jan 18 15:07 w_wad.c 93 | -rw-r--r-- 1 b1 prog 3629 Jan 18 15:07 wadread.c 94 | -rw-r--r-- 1 b1 prog 551 Jan 18 15:07 wadread.h 95 | -rw-r--r-- 1 b1 prog 3583 Jan 18 15:07 wi_data.h 96 | -rw-r--r-- 1 b1 prog 25608 Jan 18 15:07 wi_stuff.c 97 | -rw-r--r-- 1 b1 prog 1544 Jan 18 15:07 wi_stuff.h 98 | -rw-r--r-- 1 b1 prog 8501 Jan 18 15:07 z_zone.c 99 | -------------------------------------------------------------------------------- /acinclude.m4: -------------------------------------------------------------------------------- 1 | # Configure paths for SDL 2 | # Sam Lantinga 9/21/99 3 | # stolen from Manish Singh 4 | # stolen back from Frank Belew 5 | # stolen from Manish Singh 6 | # Shamelessly stolen from Owen Taylor 7 | 8 | dnl AM_PATH_SDL([MINIMUM-VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]]) 9 | dnl Test for SDL, and define SDL_CFLAGS and SDL_LIBS 10 | dnl 11 | AC_DEFUN(AM_PATH_SDL, 12 | [dnl 13 | dnl Get the cflags and libraries from the sdl-config script 14 | dnl 15 | AC_ARG_WITH(sdl-prefix,[ --with-sdl-prefix=PFX Prefix where SDL is installed (optional)], 16 | sdl_prefix="$withval", sdl_prefix="") 17 | AC_ARG_WITH(sdl-exec-prefix,[ --with-sdl-exec-prefix=PFX Exec prefix where SDL is installed (optional)], 18 | sdl_exec_prefix="$withval", sdl_exec_prefix="") 19 | AC_ARG_ENABLE(sdltest, [ --disable-sdltest Do not try to compile and run a test SDL program], 20 | , enable_sdltest=yes) 21 | 22 | if test x$sdl_exec_prefix != x ; then 23 | sdl_args="$sdl_args --exec-prefix=$sdl_exec_prefix" 24 | if test x${SDL_CONFIG+set} != xset ; then 25 | SDL_CONFIG=$sdl_exec_prefix/bin/sdl-config 26 | fi 27 | fi 28 | if test x$sdl_prefix != x ; then 29 | sdl_args="$sdl_args --prefix=$sdl_prefix" 30 | if test x${SDL_CONFIG+set} != xset ; then 31 | SDL_CONFIG=$sdl_prefix/bin/sdl-config 32 | fi 33 | fi 34 | 35 | AC_PATH_PROG(SDL_CONFIG, sdl-config, no) 36 | min_sdl_version=ifelse([$1], ,0.11.0,$1) 37 | AC_MSG_CHECKING(for SDL - version >= $min_sdl_version) 38 | no_sdl="" 39 | if test "$SDL_CONFIG" = "no" ; then 40 | no_sdl=yes 41 | else 42 | SDL_CFLAGS=`$SDL_CONFIG $sdlconf_args --cflags` 43 | SDL_LIBS=`$SDL_CONFIG $sdlconf_args --libs` 44 | 45 | sdl_major_version=`$SDL_CONFIG $sdl_args --version | \ 46 | sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'` 47 | sdl_minor_version=`$SDL_CONFIG $sdl_args --version | \ 48 | sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'` 49 | sdl_micro_version=`$SDL_CONFIG $sdl_config_args --version | \ 50 | sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'` 51 | if test "x$enable_sdltest" = "xyes" ; then 52 | ac_save_CFLAGS="$CFLAGS" 53 | ac_save_LIBS="$LIBS" 54 | CFLAGS="$CFLAGS $SDL_CFLAGS" 55 | LIBS="$LIBS $SDL_LIBS" 56 | dnl 57 | dnl Now check if the installed SDL is sufficiently new. (Also sanity 58 | dnl checks the results of sdl-config to some extent 59 | dnl 60 | rm -f conf.sdltest 61 | AC_TRY_RUN([ 62 | #include 63 | #include 64 | #include 65 | #include 66 | 67 | char* 68 | my_strdup (char *str) 69 | { 70 | char *new_str; 71 | 72 | if (str) 73 | { 74 | new_str = malloc ((strlen (str) + 1) * sizeof(char)); 75 | strcpy (new_str, str); 76 | } 77 | else 78 | new_str = NULL; 79 | 80 | return new_str; 81 | } 82 | 83 | int main () 84 | { 85 | int major, minor, micro; 86 | char *tmp_version; 87 | 88 | system ("touch conf.sdltest"); 89 | 90 | /* HP/UX 9 (%@#!) writes to sscanf strings */ 91 | tmp_version = my_strdup("$min_sdl_version"); 92 | if (sscanf(tmp_version, "%d.%d.%d", &major, &minor, µ) != 3) { 93 | printf("%s, bad version string\n", "$min_sdl_version"); 94 | exit(1); 95 | } 96 | 97 | if (($sdl_major_version > major) || 98 | (($sdl_major_version == major) && ($sdl_minor_version > minor)) || 99 | (($sdl_major_version == major) && ($sdl_minor_version == minor) && ($sdl_micro_version >= micro))) 100 | { 101 | return 0; 102 | } 103 | else 104 | { 105 | printf("\n*** 'sdl-config --version' returned %d.%d.%d, but the minimum version\n", $sdl_major_version, $sdl_minor_version, $sdl_micro_version); 106 | printf("*** of SDL required is %d.%d.%d. If sdl-config is correct, then it is\n", major, minor, micro); 107 | printf("*** best to upgrade to the required version.\n"); 108 | printf("*** If sdl-config was wrong, set the environment variable SDL_CONFIG\n"); 109 | printf("*** to point to the correct copy of sdl-config, and remove the file\n"); 110 | printf("*** config.cache before re-running configure\n"); 111 | return 1; 112 | } 113 | } 114 | 115 | ],, no_sdl=yes,[echo $ac_n "cross compiling; assumed OK... $ac_c"]) 116 | CFLAGS="$ac_save_CFLAGS" 117 | LIBS="$ac_save_LIBS" 118 | fi 119 | fi 120 | if test "x$no_sdl" = x ; then 121 | AC_MSG_RESULT(yes) 122 | ifelse([$2], , :, [$2]) 123 | else 124 | AC_MSG_RESULT(no) 125 | if test "$SDL_CONFIG" = "no" ; then 126 | echo "*** The sdl-config script installed by SDL could not be found" 127 | echo "*** If SDL was installed in PREFIX, make sure PREFIX/bin is in" 128 | echo "*** your path, or set the SDL_CONFIG environment variable to the" 129 | echo "*** full path to sdl-config." 130 | else 131 | if test -f conf.sdltest ; then 132 | : 133 | else 134 | echo "*** Could not run SDL test program, checking why..." 135 | CFLAGS="$CFLAGS $SDL_CFLAGS" 136 | LIBS="$LIBS $SDL_LIBS" 137 | AC_TRY_LINK([ 138 | #include 139 | #include 140 | ], [ return 0; ], 141 | [ echo "*** The test program compiled, but did not run. This usually means" 142 | echo "*** that the run-time linker is not finding SDL or finding the wrong" 143 | echo "*** version of SDL. If it is not finding SDL, you'll need to set your" 144 | echo "*** LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.conf to point" 145 | echo "*** to the installed location Also, make sure you have run ldconfig if that" 146 | echo "*** is required on your system" 147 | echo "***" 148 | echo "*** If you have an old version installed, it is best to remove it, although" 149 | echo "*** you may also be able to get things to work by modifying LD_LIBRARY_PATH"], 150 | [ echo "*** The test program failed to compile or link. See the file config.log for the" 151 | echo "*** exact error that occured. This usually means SDL was incorrectly installed" 152 | echo "*** or that you have moved SDL since it was installed. In the latter case, you" 153 | echo "*** may want to edit the sdl-config script: $SDL_CONFIG" ]) 154 | CFLAGS="$ac_save_CFLAGS" 155 | LIBS="$ac_save_LIBS" 156 | fi 157 | fi 158 | SDL_CFLAGS="" 159 | SDL_LIBS="" 160 | ifelse([$3], , :, [$3]) 161 | fi 162 | AC_SUBST(SDL_CFLAGS) 163 | AC_SUBST(SDL_LIBS) 164 | rm -f conf.sdltest 165 | ]) 166 | -------------------------------------------------------------------------------- /f_wipe.c: -------------------------------------------------------------------------------- 1 | // Emacs style mode select -*- C++ -*- 2 | //----------------------------------------------------------------------------- 3 | // 4 | // $Id:$ 5 | // 6 | // Copyright (C) 1993-1996 by id Software, Inc. 7 | // 8 | // This source is available for distribution and/or modification 9 | // only under the terms of the DOOM Source Code License as 10 | // published by id Software. All rights reserved. 11 | // 12 | // The source is distributed in the hope that it will be useful, 13 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | // FITNESS FOR A PARTICULAR PURPOSE. See the DOOM Source Code License 15 | // for more details. 16 | // 17 | // $Log:$ 18 | // 19 | // DESCRIPTION: 20 | // Mission begin melt/wipe screen special effect. 21 | // 22 | //----------------------------------------------------------------------------- 23 | 24 | 25 | static const char rcsid[] = "$Id: f_wipe.c,v 1.2 1997/02/03 22:45:09 b1 Exp $"; 26 | 27 | 28 | 29 | #include "z_zone.h" 30 | #include "i_video.h" 31 | #include "v_video.h" 32 | #include "m_random.h" 33 | 34 | #include "doomdef.h" 35 | 36 | #include "f_wipe.h" 37 | 38 | // 39 | // SCREEN WIPE PACKAGE 40 | // 41 | 42 | // when zero, stop the wipe 43 | static boolean go = 0; 44 | 45 | static byte* wipe_scr_start; 46 | static byte* wipe_scr_end; 47 | static byte* wipe_scr; 48 | 49 | 50 | void 51 | wipe_shittyColMajorXform 52 | ( short* array, 53 | int width, 54 | int height ) 55 | { 56 | int x; 57 | int y; 58 | short* dest; 59 | 60 | dest = (short*) Z_Malloc(width*height*2, PU_STATIC, 0); 61 | 62 | for(y=0;y *e) 102 | { 103 | newval = *w - ticks; 104 | if (newval < *e) 105 | *w = *e; 106 | else 107 | *w = newval; 108 | changed = true; 109 | } 110 | else if (*w < *e) 111 | { 112 | newval = *w + ticks; 113 | if (newval > *e) 114 | *w = *e; 115 | else 116 | *w = newval; 117 | changed = true; 118 | } 119 | } 120 | w++; 121 | e++; 122 | } 123 | 124 | return !changed; 125 | 126 | } 127 | 128 | int 129 | wipe_exitColorXForm 130 | ( int width, 131 | int height, 132 | int ticks ) 133 | { 134 | return 0; 135 | } 136 | 137 | 138 | static int* y; 139 | 140 | int 141 | wipe_initMelt 142 | ( int width, 143 | int height, 144 | int ticks ) 145 | { 146 | int i, r; 147 | 148 | // copy start screen to main screen 149 | memcpy(wipe_scr, wipe_scr_start, width*height); 150 | 151 | // makes this wipe faster (in theory) 152 | // to have stuff in column-major format 153 | wipe_shittyColMajorXform((short*)wipe_scr_start, width/2, height); 154 | wipe_shittyColMajorXform((short*)wipe_scr_end, width/2, height); 155 | 156 | // setup initial column positions 157 | // (y<0 => not ready to scroll yet) 158 | y = (int *) Z_Malloc(width*sizeof(int), PU_STATIC, 0); 159 | y[0] = -(M_Random()%16); 160 | for (i=1;i 0) y[i] = 0; 165 | else if (y[i] == -16) y[i] = -15; 166 | } 167 | 168 | return 0; 169 | } 170 | 171 | int 172 | wipe_doMelt 173 | ( int width, 174 | int height, 175 | int ticks ) 176 | { 177 | int i; 178 | int j; 179 | int dy; 180 | int idx; 181 | 182 | short* s; 183 | short* d; 184 | boolean done = true; 185 | 186 | width/=2; 187 | 188 | while (ticks--) 189 | { 190 | for (i=0;i= height) dy = height - y[i]; 200 | s = &((short *)wipe_scr_end)[i*height+y[i]]; 201 | d = &((short *)wipe_scr)[y[i]*width+i]; 202 | idx = 0; 203 | for (j=dy;j;j--) 204 | { 205 | d[idx] = *(s++); 206 | idx += width; 207 | } 208 | y[i] += dy; 209 | s = &((short *)wipe_scr_start)[i*height]; 210 | d = &((short *)wipe_scr)[y[i]*width+i]; 211 | idx = 0; 212 | for (j=height-y[i];j;j--) 213 | { 214 | d[idx] = *(s++); 215 | idx += width; 216 | } 217 | done = false; 218 | } 219 | } 220 | } 221 | 222 | return done; 223 | 224 | } 225 | 226 | int 227 | wipe_exitMelt 228 | ( int width, 229 | int height, 230 | int ticks ) 231 | { 232 | Z_Free(y); 233 | return 0; 234 | } 235 | 236 | int 237 | wipe_StartScreen 238 | ( int x, 239 | int y, 240 | int width, 241 | int height ) 242 | { 243 | wipe_scr_start = screens[2]; 244 | I_ReadScreen(wipe_scr_start); 245 | return 0; 246 | } 247 | 248 | int 249 | wipe_EndScreen 250 | ( int x, 251 | int y, 252 | int width, 253 | int height ) 254 | { 255 | wipe_scr_end = screens[3]; 256 | I_ReadScreen(wipe_scr_end); 257 | V_DrawBlock(x, y, 0, width, height, wipe_scr_start); // restore start scr. 258 | return 0; 259 | } 260 | 261 | int 262 | wipe_ScreenWipe 263 | ( int wipeno, 264 | int x, 265 | int y, 266 | int width, 267 | int height, 268 | int ticks ) 269 | { 270 | int rc; 271 | static int (*wipes[])(int, int, int) = 272 | { 273 | wipe_initColorXForm, wipe_doColorXForm, wipe_exitColorXForm, 274 | wipe_initMelt, wipe_doMelt, wipe_exitMelt 275 | }; 276 | 277 | void V_MarkRect(int, int, int, int); 278 | 279 | // initial stuff 280 | if (!go) 281 | { 282 | go = 1; 283 | // wipe_scr = (byte *) Z_Malloc(width*height, PU_STATIC, 0); // DEBUG 284 | wipe_scr = screens[0]; 285 | (*wipes[wipeno*3])(width, height, ticks); 286 | } 287 | 288 | // do a piece of wipe-in 289 | V_MarkRect(0, 0, width, height); 290 | rc = (*wipes[wipeno*3+1])(width, height, ticks); 291 | // V_DrawBlock(x, y, 0, width, height, wipe_scr); // DEBUG 292 | 293 | // final stuff 294 | if (rc) 295 | { 296 | go = 0; 297 | (*wipes[wipeno*3+2])(width, height, ticks); 298 | } 299 | 300 | return !go; 301 | 302 | } 303 | -------------------------------------------------------------------------------- /install-sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # 3 | # install - install a program, script, or datafile 4 | # This comes from X11R5 (mit/util/scripts/install.sh). 5 | # 6 | # Copyright 1991 by the Massachusetts Institute of Technology 7 | # 8 | # Permission to use, copy, modify, distribute, and sell this software and its 9 | # documentation for any purpose is hereby granted without fee, provided that 10 | # the above copyright notice appear in all copies and that both that 11 | # copyright notice and this permission notice appear in supporting 12 | # documentation, and that the name of M.I.T. not be used in advertising or 13 | # publicity pertaining to distribution of the software without specific, 14 | # written prior permission. M.I.T. makes no representations about the 15 | # suitability of this software for any purpose. It is provided "as is" 16 | # without express or implied warranty. 17 | # 18 | # Calling this script install-sh is preferred over install.sh, to prevent 19 | # `make' implicit rules from creating a file called install from it 20 | # when there is no Makefile. 21 | # 22 | # This script is compatible with the BSD install script, but was written 23 | # from scratch. It can only install one file at a time, a restriction 24 | # shared with many OS's install programs. 25 | 26 | 27 | # set DOITPROG to echo to test this script 28 | 29 | # Don't use :- since 4.3BSD and earlier shells don't like it. 30 | doit="${DOITPROG-}" 31 | 32 | 33 | # put in absolute paths if you don't have them in your path; or use env. vars. 34 | 35 | mvprog="${MVPROG-mv}" 36 | cpprog="${CPPROG-cp}" 37 | chmodprog="${CHMODPROG-chmod}" 38 | chownprog="${CHOWNPROG-chown}" 39 | chgrpprog="${CHGRPPROG-chgrp}" 40 | stripprog="${STRIPPROG-strip}" 41 | rmprog="${RMPROG-rm}" 42 | mkdirprog="${MKDIRPROG-mkdir}" 43 | 44 | transformbasename="" 45 | transform_arg="" 46 | instcmd="$mvprog" 47 | chmodcmd="$chmodprog 0755" 48 | chowncmd="" 49 | chgrpcmd="" 50 | stripcmd="" 51 | rmcmd="$rmprog -f" 52 | mvcmd="$mvprog" 53 | src="" 54 | dst="" 55 | dir_arg="" 56 | 57 | while [ x"$1" != x ]; do 58 | case $1 in 59 | -c) instcmd="$cpprog" 60 | shift 61 | continue;; 62 | 63 | -d) dir_arg=true 64 | shift 65 | continue;; 66 | 67 | -m) chmodcmd="$chmodprog $2" 68 | shift 69 | shift 70 | continue;; 71 | 72 | -o) chowncmd="$chownprog $2" 73 | shift 74 | shift 75 | continue;; 76 | 77 | -g) chgrpcmd="$chgrpprog $2" 78 | shift 79 | shift 80 | continue;; 81 | 82 | -s) stripcmd="$stripprog" 83 | shift 84 | continue;; 85 | 86 | -t=*) transformarg=`echo $1 | sed 's/-t=//'` 87 | shift 88 | continue;; 89 | 90 | -b=*) transformbasename=`echo $1 | sed 's/-b=//'` 91 | shift 92 | continue;; 93 | 94 | *) if [ x"$src" = x ] 95 | then 96 | src=$1 97 | else 98 | # this colon is to work around a 386BSD /bin/sh bug 99 | : 100 | dst=$1 101 | fi 102 | shift 103 | continue;; 104 | esac 105 | done 106 | 107 | if [ x"$src" = x ] 108 | then 109 | echo "install: no input file specified" 110 | exit 1 111 | else 112 | true 113 | fi 114 | 115 | if [ x"$dir_arg" != x ]; then 116 | dst=$src 117 | src="" 118 | 119 | if [ -d $dst ]; then 120 | instcmd=: 121 | chmodcmd="" 122 | else 123 | instcmd=mkdir 124 | fi 125 | else 126 | 127 | # Waiting for this to be detected by the "$instcmd $src $dsttmp" command 128 | # might cause directories to be created, which would be especially bad 129 | # if $src (and thus $dsttmp) contains '*'. 130 | 131 | if [ -f $src -o -d $src ] 132 | then 133 | true 134 | else 135 | echo "install: $src does not exist" 136 | exit 1 137 | fi 138 | 139 | if [ x"$dst" = x ] 140 | then 141 | echo "install: no destination specified" 142 | exit 1 143 | else 144 | true 145 | fi 146 | 147 | # If destination is a directory, append the input filename; if your system 148 | # does not like double slashes in filenames, you may need to add some logic 149 | 150 | if [ -d $dst ] 151 | then 152 | dst="$dst"/`basename $src` 153 | else 154 | true 155 | fi 156 | fi 157 | 158 | ## this sed command emulates the dirname command 159 | dstdir=`echo $dst | sed -e 's,[^/]*$,,;s,/$,,;s,^$,.,'` 160 | 161 | # Make sure that the destination directory exists. 162 | # this part is taken from Noah Friedman's mkinstalldirs script 163 | 164 | # Skip lots of stat calls in the usual case. 165 | if [ ! -d "$dstdir" ]; then 166 | defaultIFS=' 167 | ' 168 | IFS="${IFS-${defaultIFS}}" 169 | 170 | oIFS="${IFS}" 171 | # Some sh's can't handle IFS=/ for some reason. 172 | IFS='%' 173 | set - `echo ${dstdir} | sed -e 's@/@%@g' -e 's@^%@/@'` 174 | IFS="${oIFS}" 175 | 176 | pathcomp='' 177 | 178 | while [ $# -ne 0 ] ; do 179 | pathcomp="${pathcomp}${1}" 180 | shift 181 | 182 | if [ ! -d "${pathcomp}" ] ; 183 | then 184 | $mkdirprog "${pathcomp}" 185 | else 186 | true 187 | fi 188 | 189 | pathcomp="${pathcomp}/" 190 | done 191 | fi 192 | 193 | if [ x"$dir_arg" != x ] 194 | then 195 | $doit $instcmd $dst && 196 | 197 | if [ x"$chowncmd" != x ]; then $doit $chowncmd $dst; else true ; fi && 198 | if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dst; else true ; fi && 199 | if [ x"$stripcmd" != x ]; then $doit $stripcmd $dst; else true ; fi && 200 | if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dst; else true ; fi 201 | else 202 | 203 | # If we're going to rename the final executable, determine the name now. 204 | 205 | if [ x"$transformarg" = x ] 206 | then 207 | dstfile=`basename $dst` 208 | else 209 | dstfile=`basename $dst $transformbasename | 210 | sed $transformarg`$transformbasename 211 | fi 212 | 213 | # don't allow the sed command to completely eliminate the filename 214 | 215 | if [ x"$dstfile" = x ] 216 | then 217 | dstfile=`basename $dst` 218 | else 219 | true 220 | fi 221 | 222 | # Make a temp file name in the proper directory. 223 | 224 | dsttmp=$dstdir/#inst.$$# 225 | 226 | # Move or copy the file name to the temp name 227 | 228 | $doit $instcmd $src $dsttmp && 229 | 230 | trap "rm -f ${dsttmp}" 0 && 231 | 232 | # and set any options; do chmod last to preserve setuid bits 233 | 234 | # If any of these fail, we abort the whole thing. If we want to 235 | # ignore errors from any of these, just make sure not to ignore 236 | # errors from the above "$doit $instcmd $src $dsttmp" command. 237 | 238 | if [ x"$chowncmd" != x ]; then $doit $chowncmd $dsttmp; else true;fi && 239 | if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dsttmp; else true;fi && 240 | if [ x"$stripcmd" != x ]; then $doit $stripcmd $dsttmp; else true;fi && 241 | if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dsttmp; else true;fi && 242 | 243 | # Now rename the file to the real destination. 244 | 245 | $doit $rmcmd -f $dstdir/$dstfile && 246 | $doit $mvcmd $dsttmp $dstdir/$dstfile 247 | 248 | fi && 249 | 250 | 251 | exit 0 252 | --------------------------------------------------------------------------------