└── Source ├── v_text.h ├── dstrings.c ├── acorn.h ├── r_patch.h ├── doomdef.c ├── p_tick.h ├── f_wipe.h ├── doomstat.c ├── i_net.h ├── r_segs.h ├── p_setup.h ├── i_main.c ├── d_textur.h ├── m_bbox.h ├── p_inter.h ├── m_random.h ├── m_argv.h ├── dh_stuff.h ├── m_fixed.h ├── m_misc.h ├── d_items.h ├── m_cheat.h ├── usleep.c ├── r_local.h ├── wi_stuff.h ├── m_bbox.c ├── p_saveg.h ├── m_swap.h ├── r_things.h ├── d_ticcmd.h ├── m_swap.c ├── am_map.h ├── i_video.h ├── r_sky.h ├── d_think.h ├── hpux └── Makefile ├── r_plane.h ├── r_bsp.h ├── hu_stuff.h ├── dstrings.h ├── includes.h ├── Riscos └── Makefile ├── d_main.h ├── Cygwin └── Makefile ├── Debian └── Makefile ├── p_pspr.h ├── m_menu.h ├── z_zone.h ├── m_cheat.c ├── doomtype.h ├── i_system.h ├── st_stuff.h ├── d_items.c ├── s_sound.h ├── d_event.h ├── v_video.h ├── i_system.c ├── i_sound.h ├── w_wad.h ├── r_draw.h ├── f_finale.h ├── r_state.h ├── tables.h ├── m_random.c ├── d_net.h ├── f_wipe.c ├── p_tick.c ├── r_data.h ├── m_argv.c ├── maths64.c ├── r_main.h ├── st_lib.h ├── hu_lib.h ├── d_player.h ├── g_game.h ├── st_lib.c ├── sounds.h ├── doomdata.h ├── p_enemy.h └── p_local.h /Source/v_text.h: -------------------------------------------------------------------------------- 1 | 2 | unsigned int V_drawMenuText (int x, int y, const char *str); 3 | unsigned int V_drawWILV (int y, const char *str); 4 | unsigned int V_MenuTextWidth (const char * str); 5 | void V_LoadFonts (void); 6 | -------------------------------------------------------------------------------- /Source/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 | #if 0 25 | static const char rcsid[] = "$Id: m_bbox.c,v 1.1 1997/02/03 22:45:10 b1 Exp $"; 26 | #endif 27 | 28 | 29 | #ifdef __GNUG__ 30 | #pragma implementation "dstrings.h" 31 | #endif 32 | #include "dstrings.h" 33 | 34 | /* Nothing left in here... */ 35 | -------------------------------------------------------------------------------- /Source/acorn.h: -------------------------------------------------------------------------------- 1 | /* Acorn RiscOS specific declarations */ 2 | /* Doom Port By J.A.Doggett. */ 3 | 4 | 5 | #ifndef ACORN_H 6 | #define ACORN_H 7 | 8 | #include 9 | #include 10 | #include 11 | #include 12 | 13 | #define F_OK 0 /* test for existence of file */ 14 | #define X_OK 0x01 /* test for execute or search permission */ 15 | #define W_OK 0x02 /* test for write permission */ 16 | #define R_OK 0x04 /* test for read permission */ 17 | 18 | 19 | 20 | void set_riscos_filetype (const char * file, unsigned int type); 21 | boolean riscos_screensave (const char * file); 22 | 23 | int access(const char * filename, int mode); 24 | int mkdir (const char * directory_name, mode_t perms); 25 | int strcasecmp (const char * s1, const char * s2); 26 | int strncasecmp (const char * s1, const char * s2, unsigned int max); 27 | char * strdup (const char * string); 28 | void usleep (unsigned int time); 29 | int RiscOs_expand_path (const char * path_name); 30 | 31 | 32 | /* Required by the sockets lib only on RiscOS */ 33 | extern int socketclose (int); 34 | 35 | #endif 36 | -------------------------------------------------------------------------------- /Source/r_patch.h: -------------------------------------------------------------------------------- 1 | 2 | #if !defined(__R_PATCH_H__) 3 | #define __R_PATCH_H__ 4 | 5 | typedef struct 6 | { 7 | int topdelta; 8 | int length; 9 | } rpost_t; 10 | 11 | typedef struct 12 | { 13 | int numPosts; 14 | rpost_t *posts; 15 | unsigned char *pixels; 16 | } rcolumn_t; 17 | 18 | typedef struct 19 | { 20 | int width; 21 | int height; 22 | 23 | // this is the single malloc'ed/free'd array 24 | // for this patch 25 | unsigned char *data; 26 | 27 | // these are pointers into the data array 28 | unsigned char *pixels; 29 | rcolumn_t *columns; 30 | rpost_t *posts; 31 | 32 | unsigned int locks; 33 | } rpatch_t; 34 | 35 | rpatch_t *R_CacheTextureCompositePatchNum(int id); 36 | void R_UnlockTextureCompositePatchNum(int id); 37 | 38 | rcolumn_t *R_GetPatchColumnWrapped(rpatch_t *patch, int columnIndex); 39 | rcolumn_t *R_GetPatchColumnClamped(rpatch_t *patch, int columnIndex); 40 | 41 | void R_InitPatches(void); 42 | 43 | #endif 44 | -------------------------------------------------------------------------------- /Source/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 | #if 0 26 | static const char rcsid[] = "$Id: m_bbox.c,v 1.1 1997/02/03 22:45:10 b1 Exp $"; 27 | #endif 28 | 29 | 30 | #ifdef __GNUG__ 31 | #pragma implementation "doomdef.h" 32 | #endif 33 | #include "doomdef.h" 34 | 35 | // Location for any defines turned variables. 36 | 37 | // None. 38 | 39 | 40 | -------------------------------------------------------------------------------- /Source/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 | -------------------------------------------------------------------------------- /Source/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 | 31 | int wipe_StartScreen (void); 32 | int wipe_EndScreen (void); 33 | boolean wipe_ScreenWipe (int ticks); 34 | 35 | #endif 36 | //----------------------------------------------------------------------------- 37 | // 38 | // $Log:$ 39 | // 40 | //----------------------------------------------------------------------------- 41 | -------------------------------------------------------------------------------- /Source/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 | #if 0 25 | static const char rcsid[] = "$Id: m_bbox.c,v 1.1 1997/02/03 22:45:10 b1 Exp $"; 26 | #endif 27 | 28 | 29 | #include "includes.h" 30 | 31 | 32 | // Game Mode - identify IWAD as shareware, retail etc. 33 | GameMode_t gamemode = indetermined; 34 | GameMission_t gamemission = doom; 35 | 36 | // Language. 37 | Language_t language = english; 38 | 39 | // Set if homebrew PWAD stuff has been added. 40 | boolean modifiedgame; 41 | 42 | 43 | 44 | 45 | -------------------------------------------------------------------------------- /Source/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_ShutdownNetwork (void); 38 | void I_NetCmd (void); 39 | 40 | 41 | #endif 42 | //----------------------------------------------------------------------------- 43 | // 44 | // $Log:$ 45 | // 46 | //----------------------------------------------------------------------------- 47 | -------------------------------------------------------------------------------- /Source/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 | void 39 | R_StoreWallRange 40 | ( int start, 41 | int stop ); 42 | 43 | 44 | #endif 45 | //----------------------------------------------------------------------------- 46 | // 47 | // $Log:$ 48 | // 49 | //----------------------------------------------------------------------------- 50 | -------------------------------------------------------------------------------- /Source/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 | -------------------------------------------------------------------------------- /Source/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 | //#include "doomdef.h" 25 | //#include "m_argv.h" 26 | //#include "d_main.h" 27 | 28 | #include "includes.h" 29 | 30 | #if 0 31 | static const char rcsid[] = "$Id: i_main.c,v 1.4 1997/02/03 22:45:10 b1 Exp $"; 32 | #endif 33 | 34 | /* ---------------------------------------------------------------------------- */ 35 | 36 | int main (int argc, char ** argv) 37 | { 38 | M_CopyArgs (argc, argv); 39 | D_DoomMain (); 40 | return 0; 41 | } 42 | 43 | /* ---------------------------------------------------------------------------- */ 44 | -------------------------------------------------------------------------------- /Source/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 | -------------------------------------------------------------------------------- /Source/m_bbox.h: -------------------------------------------------------------------------------- 1 | // Emacs style mode select -*- C++ -*- 2 | //----------------------------------------------------------------------------- 3 | // 4 | // $Id:$ 5 | // 6 | // Copyright (C) 1993-1996 by id Software, Inc. 7 | // 8 | // This source is available for distribution and/or modification 9 | // only under the terms of the DOOM Source Code License as 10 | // published by id Software. All rights reserved. 11 | // 12 | // The source is distributed in the hope that it will be useful, 13 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | // FITNESS FOR A PARTICULAR PURPOSE. See the DOOM Source Code License 15 | // for more details. 16 | // 17 | // DESCRIPTION: 18 | // Nil. 19 | // 20 | //----------------------------------------------------------------------------- 21 | 22 | 23 | #ifndef __M_BBOX__ 24 | #define __M_BBOX__ 25 | 26 | #include "m_fixed.h" 27 | 28 | 29 | // Bounding box coordinate storage. 30 | enum 31 | { 32 | BOXTOP, 33 | BOXBOTTOM, 34 | BOXLEFT, 35 | BOXRIGHT 36 | }; // bbox coordinates 37 | 38 | // Bounding box functions. 39 | void M_ClearBox (fixed_t* box); 40 | 41 | void 42 | M_AddToBox 43 | ( fixed_t* box, 44 | fixed_t x, 45 | fixed_t y ); 46 | 47 | 48 | #endif 49 | //----------------------------------------------------------------------------- 50 | // 51 | // $Log:$ 52 | // 53 | //----------------------------------------------------------------------------- 54 | -------------------------------------------------------------------------------- /Source/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* player, int num); 33 | boolean P_GiveBody (player_t* player, int num); 34 | char * P_GiveCard (player_t* player, card_t card); 35 | void P_NoMoreSectorDamage (sector_t* sector); 36 | void P_MakeSuitPerm (void); 37 | void P_AdjustKillCount (mobj_t* target, mobj_t* source, int amount); 38 | 39 | 40 | 41 | #endif 42 | //----------------------------------------------------------------------------- 43 | // 44 | // $Log:$ 45 | // 46 | //----------------------------------------------------------------------------- 47 | -------------------------------------------------------------------------------- /Source/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 | int M_SubRandom (void); 35 | 36 | // As M_Random, but used only by the play simulation. 37 | int P_Random (void); 38 | 39 | // Fix randoms for demos. 40 | void M_ClearRandom (void); 41 | 42 | int P_RandomHitscanAngle(fixed_t spread); 43 | int P_RandomHitscanSlope(fixed_t spread); 44 | 45 | #endif 46 | //----------------------------------------------------------------------------- 47 | // 48 | // $Log:$ 49 | // 50 | //----------------------------------------------------------------------------- 51 | -------------------------------------------------------------------------------- /Source/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 | #define MAXARGVS 100 30 | 31 | extern unsigned int myargc; 32 | extern char* myargv [MAXARGVS]; 33 | 34 | void M_CopyArgs (int argc, char ** argv); 35 | 36 | // Returns the position of the given parameter 37 | // in the arg list (0 if not found). 38 | unsigned int M_CheckParm_N (const char* check, unsigned int start_pos); 39 | 40 | //unsigned int M_CheckParm (const char* check); 41 | #define M_CheckParm(a) M_CheckParm_N(a,1) 42 | 43 | #endif 44 | //----------------------------------------------------------------------------- 45 | // 46 | // $Log:$ 47 | // 48 | //----------------------------------------------------------------------------- 49 | -------------------------------------------------------------------------------- /Source/dh_stuff.h: -------------------------------------------------------------------------------- 1 | /* dh_stuff.h */ 2 | /* Support for dehacker scripts */ 3 | 4 | #ifndef __DHSTUFF_H__ 5 | #define __DHSTUFF_H__ 6 | 7 | void DH_parse_hacker_file_f (const char * filename, FILE * fin, unsigned int filetop_pos); 8 | void DH_parse_language_file_f (FILE * fin, size_t filesize); 9 | void DH_replace_file_extension (char * newname, const char * oldname, const char * n_ext); 10 | void DH_parse_hacker_file (const char * filename); 11 | void DH_parse_hacker_wad_file (const char * wadname, boolean do_it); 12 | unsigned int dh_instr (const char * text, const char * search_string); 13 | unsigned int dh_inchar (const char * text, char search_char); 14 | unsigned int dh_rinchar (const char * text, char search_char); 15 | unsigned int dh_qty_match (const char * s1, const char * s2); 16 | char * dh_split_lines (char * ptr, char * top); 17 | char * dh_next_line (char * ptr, char * top); 18 | void dh_fgets (char * a_line, unsigned int max_length, FILE * fin); 19 | void Load_Mapinfo (void); 20 | void Change_To_Mapinfo (FILE * fin); 21 | void Change_To_UMapinfo (FILE * fin); 22 | void DH_pistol_start (void); 23 | void DH_remove_duplicate_mapinfos (void); 24 | void Load_Lockdefs (void); 25 | 26 | #if 0 27 | int dh_strcmp (const char * s1, const char * s2); 28 | #else 29 | #define dh_strcmp(s1,s2) strncasecmp(s1, s2, strlen(s2)) 30 | #endif 31 | 32 | #endif 33 | //----------------------------------------------------------------------------- 34 | // 35 | // $Log:$ 36 | // 37 | //----------------------------------------------------------------------------- 38 | -------------------------------------------------------------------------------- /Source/m_fixed.h: -------------------------------------------------------------------------------- 1 | // Emacs style mode select -*- C++ -*- 2 | //----------------------------------------------------------------------------- 3 | // 4 | // $Id:$ 5 | // 6 | // Copyright (C) 1993-1996 by id Software, Inc. 7 | // 8 | // This source is available for distribution and/or modification 9 | // only under the terms of the DOOM Source Code License as 10 | // published by id Software. All rights reserved. 11 | // 12 | // The source is distributed in the hope that it will be useful, 13 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | // FITNESS FOR A PARTICULAR PURPOSE. See the DOOM Source Code License 15 | // for more details. 16 | // 17 | // DESCRIPTION: 18 | // Fixed point arithemtics, implementation. 19 | // 20 | //----------------------------------------------------------------------------- 21 | 22 | 23 | #ifndef __M_FIXED__ 24 | #define __M_FIXED__ 25 | 26 | 27 | #ifdef __GNUG__ 28 | #pragma interface 29 | #endif 30 | 31 | 32 | // 33 | // Fixed point, 32bit as 16.16. 34 | // 35 | #define FRACBITS 16 36 | #define FRACUNIT (1<>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 | -------------------------------------------------------------------------------- /Source/usleep.c: -------------------------------------------------------------------------------- 1 | /* 2 | #ifndef lint 3 | static char sccsid[] = "@(#)usleep.c 1.3 91/05/24 XLOCK"; 4 | #endif 5 | */ 6 | /*- 7 | * usleep.c - OS dependant implementation of usleep(). 8 | * 9 | * Copyright (c) 1991 by Patrick J. Naughton. 10 | * 11 | * Revision History: 12 | * 30-Aug-90: written. 13 | * 14 | * 07-Dec-94: Bert Gijsbers 15 | * Changed "void usleep(unsigned long)" to "int usleep(unsigned)" 16 | * as this is what it seems to be on systems which do have usleep(3) (AIX). 17 | * Changed usleep into micro_delay to forego any possible prototype clashes. 18 | */ 19 | 20 | #include 21 | #include 22 | #include 23 | #include 24 | #include 25 | 26 | /* #include "types.h" */ 27 | 28 | #ifndef lint 29 | static char sourceid[] = 30 | "@(#)$Id: usleep.c,v 3.10 1996/05/02 16:06:02 bert Exp $"; 31 | #endif 32 | 33 | /* --------------------------------------------------------------------------------- */ 34 | 35 | int usleep(unsigned usec) 36 | { 37 | #if 0 /* SYSV */ 38 | poll((struct poll *) 0, (size_t) 0, usec / 1000); /* ms RES */ 39 | #endif 40 | #ifdef VMS 41 | float timeout; 42 | 43 | timeout = usec/1000000.0; 44 | LIB$WAIT(&timeout); 45 | #else 46 | struct timeval timeout; 47 | timeout.tv_usec = usec % (unsigned long) 1000000; 48 | timeout.tv_sec = usec / (unsigned long) 1000000; 49 | (void) select(0, NULL, NULL, NULL, &timeout); 50 | #endif 51 | 52 | return 0; 53 | } 54 | 55 | /* --------------------------------------------------------------------------------- */ 56 | -------------------------------------------------------------------------------- /Source/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 | -------------------------------------------------------------------------------- /Source/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 | int WI_checkForAccelerate (void); 49 | 50 | #endif 51 | //----------------------------------------------------------------------------- 52 | // 53 | // $Log:$ 54 | // 55 | //----------------------------------------------------------------------------- 56 | -------------------------------------------------------------------------------- /Source/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 | #if 0 28 | static const char rcsid[] = "$Id: m_bbox.c,v 1.1 1997/02/03 22:45:10 b1 Exp $"; 29 | #endif 30 | 31 | 32 | #ifdef __GNUG__ 33 | #pragma implementation "m_bbox.h" 34 | #endif 35 | #include "m_bbox.h" 36 | #include "doomtype.h" 37 | 38 | 39 | 40 | void M_ClearBox (fixed_t *box) 41 | { 42 | box[BOXTOP] = box[BOXRIGHT] = MININT; 43 | box[BOXBOTTOM] = box[BOXLEFT] = MAXINT; 44 | } 45 | 46 | void 47 | M_AddToBox 48 | ( fixed_t* box, 49 | fixed_t x, 50 | fixed_t y ) 51 | { 52 | if (xbox[BOXRIGHT]) 55 | box[BOXRIGHT] = x; 56 | if (ybox[BOXTOP]) 59 | box[BOXTOP] = y; 60 | } 61 | 62 | 63 | 64 | 65 | 66 | -------------------------------------------------------------------------------- /Source/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 | byte * P_ArchivePlayers (byte * save_p); 35 | byte * P_UnArchivePlayers (byte * save_p); 36 | byte * P_ArchiveWorld (byte * save_p); 37 | byte * P_UnArchiveWorld (byte * save_p); 38 | byte * P_ArchiveThinkers (byte * save_p); 39 | byte * P_UnArchiveThinkers (byte * save_p); 40 | byte * P_ArchiveSpecials (byte * save_p); 41 | byte * P_UnArchiveSpecials (byte * save_p); 42 | void P_RestoreTargets (void); 43 | 44 | #endif 45 | //----------------------------------------------------------------------------- 46 | // 47 | // $Log:$ 48 | // 49 | //----------------------------------------------------------------------------- 50 | -------------------------------------------------------------------------------- /Source/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 | extern short SwapSHORT(short); 32 | extern long SwapLONG(long); 33 | 34 | // Endianess handling. 35 | // WAD files are stored little endian. 36 | #ifdef __BIG_ENDIAN__ 37 | #define SHORT(x) ((short)SwapSHORT((unsigned short) (x))) 38 | #define USHORT(x) (((unsigned short)SwapSHORT((unsigned short) (x))) & 0xFFFF) 39 | #define LONG(x) ((long)SwapLONG((unsigned long) (x))) 40 | #else 41 | #define SHORT(x) (x) 42 | #define USHORT(x) (unsigned short)(x) 43 | #define LONG(x) (x) 44 | #endif 45 | 46 | #endif 47 | //----------------------------------------------------------------------------- 48 | // 49 | // $Log:$ 50 | // 51 | //----------------------------------------------------------------------------- 52 | -------------------------------------------------------------------------------- /Source/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 | 32 | // Constant arrays used for psprite clipping 33 | // and initializing clipping. 34 | extern dshort_t* negonearray; 35 | extern dshort_t* screenheightarray; 36 | 37 | // vars for R_DrawMaskedColumn 38 | extern dshort_t* mfloorclip; 39 | extern dshort_t* mceilingclip; 40 | extern fixed_t spryscale; 41 | extern fixed_t sprtopscreen; 42 | 43 | extern fixed_t pspritescale; 44 | extern fixed_t pspriteiscale; 45 | 46 | 47 | void R_AddSprites(sector_t* sec, int lightlevel); 48 | void R_InitSprites (void); 49 | void R_ClearSprites (void); 50 | void R_DrawMasked (void); 51 | 52 | #endif 53 | //----------------------------------------------------------------------------- 54 | // 55 | // $Log:$ 56 | // 57 | //----------------------------------------------------------------------------- 58 | -------------------------------------------------------------------------------- /Source/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 | byte argnum; 45 | byte value; 46 | byte spare1; 47 | byte spare2; 48 | } ticcmd_t; 49 | 50 | 51 | 52 | #endif 53 | //----------------------------------------------------------------------------- 54 | // 55 | // $Log:$ 56 | // 57 | //----------------------------------------------------------------------------- 58 | -------------------------------------------------------------------------------- /Source/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 | #if 0 25 | static const char rcsid[] = "$Id: m_bbox.c,v 1.1 1997/02/03 22:45:10 b1 Exp $"; 26 | #endif 27 | 28 | 29 | #ifdef __GNUG__ 30 | #pragma implementation "m_swap.h" 31 | #endif 32 | #include "m_swap.h" 33 | 34 | 35 | long SwapLONG (long ln) 36 | { 37 | unsigned long l; 38 | unsigned long rc; 39 | 40 | l = ln; 41 | rc = (l & 0xFF); 42 | rc <<= 8; 43 | l >>= 8; 44 | rc |= (l & 0xFF); 45 | rc <<= 8; 46 | l >>= 8; 47 | rc |= (l & 0xFF); 48 | rc <<= 8; 49 | l >>= 8; 50 | rc |= (l & 0xFF); 51 | return ((long)rc); 52 | } 53 | 54 | /* --------------------------------------------------------------------------------- */ 55 | 56 | short SwapSHORT (short ls) 57 | { 58 | unsigned int l; 59 | unsigned int rc; 60 | 61 | l = ls; 62 | rc = (l & 0xFF); 63 | rc <<= 8; 64 | l >>= 8; 65 | rc |= (l & 0xFF); 66 | return ((short)rc); 67 | } 68 | 69 | /* --------------------------------------------------------------------------------- */ 70 | -------------------------------------------------------------------------------- /Source/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_MSGENTERED 1 27 | #define AM_MSGEXITED 0 28 | 29 | unsigned char AM_load_colour (unsigned char c0, unsigned char c1, unsigned char c2, const byte * palette); 30 | void AM_LoadColours (int palette_lump); 31 | 32 | // Called by main loop. 33 | boolean AM_Responder (event_t* ev); 34 | 35 | // Called by main loop. 36 | void AM_Ticker (void); 37 | 38 | // Called by main loop, 39 | // called instead of view drawer if automap active. 40 | void AM_Drawer (void); 41 | 42 | // Called to force the automap to quit 43 | // if the level is completed while it is up. 44 | void AM_Stop (void); 45 | 46 | void AM_Start (unsigned int restart); 47 | void AM_LevelInit(void); 48 | void AM_SetKeyColour (int locknum, int keynum, int r, int g, int b); 49 | 50 | #endif 51 | //----------------------------------------------------------------------------- 52 | // 53 | // $Log:$ 54 | // 55 | //----------------------------------------------------------------------------- 56 | -------------------------------------------------------------------------------- /Source/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_InitKeyboard (void); 38 | void I_InitGraphics (void); 39 | 40 | 41 | void I_ShutdownGraphics(void); 42 | 43 | // Takes full 8 bit values. 44 | void I_SetPalette (byte* palette); 45 | 46 | void I_UpdateNoBlit (void); 47 | void I_FinishUpdate (void); 48 | 49 | // Wait for vertical retrace or pause a bit. 50 | void I_WaitVBL(int count); 51 | 52 | void I_ReadScreen (byte* scr); 53 | 54 | void I_BeginRead (void); 55 | void I_EndRead (void); 56 | 57 | void I_SetScreenSize (void); 58 | void I_SetWindowName (const char * title); 59 | 60 | 61 | #endif 62 | //----------------------------------------------------------------------------- 63 | // 64 | // $Log:$ 65 | // 66 | //----------------------------------------------------------------------------- 67 | -------------------------------------------------------------------------------- /Source/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 | // The sky map is 256*128*4 maps. 32 | #define ANGLETOSKYSHIFT 22 33 | 34 | extern int skyflatnum; 35 | extern int skytexture; 36 | extern int skytexturemid; 37 | extern int skycolumnoffset; 38 | extern int skyscrolldelta; 39 | extern fixed_t skyiscale; 40 | 41 | extern const char sky_0 []; 42 | extern const char sky_1 []; 43 | extern const char sky_2 []; 44 | extern const char sky_3 []; 45 | extern const char sky_4 []; 46 | extern const char sky_5 []; 47 | extern const char sky_6 []; 48 | extern const char sky_7 []; 49 | extern const char sky_8 []; 50 | extern const char sky_9 []; 51 | extern const char * const skies [10]; 52 | 53 | void R_InitSkyMap (map_dests_t * map_info_p); 54 | void R_InitSkyMapScale (void); 55 | void R_PatchSky (const char * a_line); 56 | 57 | #endif 58 | //----------------------------------------------------------------------------- 59 | // 60 | // $Log:$ 61 | // 62 | //----------------------------------------------------------------------------- 63 | -------------------------------------------------------------------------------- /Source/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_v acv; 48 | actionf_p1 acp1; 49 | actionf_p2 acp2; 50 | uintptr_t aci; 51 | } actionf_t; 52 | 53 | 54 | // Linked list of actors. 55 | typedef struct thinker_s 56 | { 57 | struct thinker_s* next; 58 | actionf_t function; 59 | } thinker_t; 60 | 61 | #endif 62 | //----------------------------------------------------------------------------- 63 | // 64 | // $Log:$ 65 | // 66 | //----------------------------------------------------------------------------- 67 | -------------------------------------------------------------------------------- /Source/hpux/Makefile: -------------------------------------------------------------------------------- 1 | ################################################################ 2 | # 3 | # $Id:$ 4 | # 5 | # $Log:$ 6 | # 7 | CC= cc # gcc or g++ 8 | 9 | CFLAGS= -Ae -O -I/usr/include/X11R5 -DNORMALUNIX -D__BIG_ENDIAN__ -DMORELIGHTLEVELS -DHAVE_ALLOCA 10 | LDFLAGS=-L/usr/lib/X11R5 11 | LIBS=-lXext -lX11 -lm 12 | VPATH=.. 13 | 14 | HDRS= am_map.h dh_stuff.h doomdata.h doomdef.h doomstat.h doomtype.h dstrings.h d_englsh.h \ 15 | d_event.h d_french.h d_items.h d_main.h d_net.h d_player.h d_textur.h d_think.h d_ticcmd.h \ 16 | f_finale.h f_wipe.h g_game.h hu_lib.h hu_stuff.h info.h i_net.h i_sound.h i_system.h i_video.h \ 17 | m_argv.h m_bbox.h m_cheat.h m_fixed.h m_menu.h m_misc.h m_random.h m_swap.h p_enemy.h p_inter.h \ 18 | p_local.h p_mobj.h p_pspr.h p_saveg.h p_setup.h p_spec.h p_tick.h r_bsp.h r_data.h r_defs.h \ 19 | r_draw.h r_local.h r_main.h r_patch.h r_plane.h r_segs.h r_sky.h r_state.h r_things.h sounds.h \ 20 | st_lib.h st_stuff.h s_sound.h tables.h v_text.h v_video.h wi_stuff.h w_wad.h z_zone.h 21 | 22 | OBJS= doomdef.o doomstat.o i_main.o i_system.o i_sound.o i_video.o i_net.o \ 23 | tables.o f_finale.o f_wipe.o dh_stuff.o d_main.o d_net.o d_items.o \ 24 | g_game.o m_menu.o m_misc.o m_argv.o m_bbox.o m_fixed.o m_swap.o \ 25 | m_cheat.o m_random.o am_map.o p_ceilng.o p_doors.o p_enemy.o \ 26 | p_floor.o p_inter.o p_lights.o p_map.o p_maputl.o p_plats.o p_pspr.o \ 27 | p_setup.o p_sight.o p_spec.o p_switch.o p_mobj.o p_telept.o p_tick.o \ 28 | p_saveg.o p_user.o r_bsp.o r_data.o r_draw.o r_main.o r_patch.o r_plane.o \ 29 | r_segs.o r_sky.o r_things.o w_wad.o wi_stuff.o v_text.o v_video.o st_lib.o \ 30 | st_stuff.o hu_stuff.o hu_lib.o s_sound.o z_zone.o info.o sounds.o \ 31 | usleep.o 32 | 33 | all: xdoom 34 | 35 | clean: 36 | rm -f *.o *~ *.flc 37 | rm -f linux/* 38 | 39 | xdoom: $(OBJS) 40 | $(CC) $(CFLAGS) $(LDFLAGS) $(OBJS) -o $@ $(LIBS) 41 | 42 | %.o: %.c 43 | $(CC) $(CFLAGS) -c $< -o $@ 44 | 45 | $(OBJS): $(HDRS) 46 | -------------------------------------------------------------------------------- /Source/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 | // killough 10/98: special mask indicates sky flat comes from sidedef 34 | #define PL_SKYFLAT (0x80000000) 35 | 36 | // Visplane related. 37 | extern unsigned int MAXOPENINGS; 38 | extern dshort_t* openings; 39 | extern dshort_t* lastopening; 40 | 41 | 42 | typedef void (*planefunction_t) (int top, int bottom); 43 | 44 | extern planefunction_t floorfunc; 45 | extern planefunction_t ceilingfunc_t; 46 | 47 | extern dshort_t* floorclip; 48 | extern dshort_t* ceilingclip; 49 | 50 | extern fixed_t* yslope; 51 | 52 | void R_InitPlanes (void); 53 | void R_ClearPlanes (void); 54 | uintptr_t R_IncreaseOpenings (size_t); 55 | void R_DrawPlanes (void); 56 | visplane_t* R_FindPlane (fixed_t height, int picnum, int lightlevel, fixed_t xoffs, fixed_t yoffs); 57 | visplane_t* R_CheckPlane (visplane_t* pl, int start, int stop); 58 | 59 | #endif 60 | //----------------------------------------------------------------------------- 61 | // 62 | // $Log:$ 63 | // 64 | //----------------------------------------------------------------------------- 65 | -------------------------------------------------------------------------------- /Source/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 boolean segtextured; 38 | 39 | // false if the back side is the same plane 40 | extern boolean markfloor; 41 | extern boolean markceiling; 42 | 43 | extern boolean skymap; 44 | 45 | extern drawseg_t* drawsegs; 46 | extern drawseg_t* ds_p; 47 | extern unsigned int drawsegoverflowcount; 48 | extern int drawsegstarttime; 49 | 50 | extern lighttable_t** hscalelight; 51 | extern lighttable_t** vscalelight; 52 | extern lighttable_t** dscalelight; 53 | 54 | 55 | typedef void (*drawfunc_t) (int start, int stop); 56 | 57 | 58 | // BSP? 59 | void R_InitDrawSegs (void); 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 | -------------------------------------------------------------------------------- /Source/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 | extern boolean mapnameschanged; 50 | 51 | void HU_Init(void); 52 | void HU_Start(void); 53 | void HU_createWidgets (unsigned int update); 54 | 55 | boolean HU_Responder(event_t* ev); 56 | 57 | void HU_Ticker(void); 58 | void HU_Drawer(void); 59 | char HU_dequeueChatChar(void); 60 | void HU_Erase(void); 61 | void HU_ParseMapHst (FILE* fin); 62 | char * HU_printf (const char * str, ...); 63 | 64 | #endif 65 | //----------------------------------------------------------------------------- 66 | // 67 | // $Log:$ 68 | // 69 | //----------------------------------------------------------------------------- 70 | -------------------------------------------------------------------------------- /Source/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 | #ifdef __riscos 42 | //#define SAVEGAMEDIR "." 43 | #define SAVEGAMENAME "dsav" 44 | #define DIRSEP "." 45 | #define DIRSEPC '.' 46 | #define EXTSEP "/" 47 | #define EXTSEPC '/' 48 | #define PATHSEPC ',' 49 | #else 50 | //#define SAVEGAMEDIR "" 51 | #define SAVEGAMENAME "doomsav" 52 | #define DIRSEP "/" 53 | #define DIRSEPC '/' 54 | #define EXTSEP "." 55 | #define EXTSEPC '.' 56 | #define PATHSEPC ':' 57 | #endif 58 | 59 | 60 | // 61 | // File locations, 62 | // relative to current position. 63 | // Path names are OS-sensitive. 64 | // 65 | #ifdef __riscos 66 | #define DEVMAPS "/" 67 | #define DEVDATA "/" 68 | #else 69 | #define DEVMAPS "devmaps" 70 | #define DEVDATA "devdata" 71 | #endif 72 | #endif 73 | //----------------------------------------------------------------------------- 74 | // 75 | // $Log:$ 76 | // 77 | //----------------------------------------------------------------------------- 78 | -------------------------------------------------------------------------------- /Source/includes.h: -------------------------------------------------------------------------------- 1 | /* Lazy way to include all of the files */ 2 | 3 | #include 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | #include 10 | #include 11 | #include 12 | 13 | #ifdef NORMALUNIX 14 | #include 15 | #include 16 | #endif 17 | 18 | #include "doomtype.h" 19 | #include "doomdef.h" 20 | #include "doomdata.h" 21 | #include "doomstat.h" 22 | 23 | #ifdef __riscos 24 | #include "acorn.h" 25 | #endif 26 | 27 | #include "d_event.h" 28 | 29 | #include "am_map.h" 30 | #include "dh_stuff.h" 31 | #include "dstrings.h" 32 | #include "d_englsh.h" 33 | //#include "d_french.h" 34 | #include "d_items.h" 35 | #include "d_main.h" 36 | #include "d_net.h" 37 | #include "d_player.h" 38 | #include "d_textur.h" 39 | #include "d_think.h" 40 | #include "d_ticcmd.h" 41 | #include "f_finale.h" 42 | #include "f_wipe.h" 43 | #include "g_game.h" 44 | #include "hu_lib.h" 45 | #include "hu_stuff.h" 46 | #include "info.h" 47 | #include "i_net.h" 48 | #include "i_sound.h" 49 | #include "i_system.h" 50 | #include "i_video.h" 51 | #include "m_argv.h" 52 | #include "m_bbox.h" 53 | #include "m_cheat.h" 54 | #include "m_fixed.h" 55 | #include "m_menu.h" 56 | #include "m_misc.h" 57 | #include "m_random.h" 58 | #include "m_swap.h" 59 | #include "p_enemy.h" 60 | #include "p_inter.h" 61 | #include "p_local.h" 62 | #include "p_mobj.h" 63 | #include "p_pspr.h" 64 | #include "p_saveg.h" 65 | #include "p_setup.h" 66 | #include "p_spec.h" 67 | #include "p_tick.h" 68 | #include "r_bsp.h" 69 | #include "r_data.h" 70 | #include "r_defs.h" 71 | #include "r_draw.h" 72 | #include "r_local.h" 73 | #include "r_main.h" 74 | #include "r_patch.h" 75 | #include "r_plane.h" 76 | #include "r_segs.h" 77 | #include "r_sky.h" 78 | #include "r_state.h" 79 | #include "r_things.h" 80 | #include "sounds.h" 81 | #include "st_lib.h" 82 | #include "st_stuff.h" 83 | #include "s_sound.h" 84 | #include "tables.h" 85 | #include "v_text.h" 86 | #include "v_video.h" 87 | #include "wi_stuff.h" 88 | #include "w_wad.h" 89 | #include "z_zone.h" 90 | -------------------------------------------------------------------------------- /Source/Riscos/Makefile: -------------------------------------------------------------------------------- 1 | ################################################################ 2 | # 3 | # $Id:$ 4 | # 5 | # $Log:$ 6 | # 7 | CC= cc 8 | ASM= objasm 9 | 10 | CFLAGS=-Wp -JC: -DPADDED_STRUCTS -DMORELIGHTLEVELS 11 | AFLAGS=-CPU ARM7M 12 | LDFLAGS= 13 | 14 | # The order of the libraries here is important - almost 15 | # any other sequence causes link errors. 16 | 17 | LIBS=-LC:unixlib.o -LC:inetlib.o -LC:socklib.o -LC:stubs.o 18 | 19 | HDRS= acorn.h am_map.h dh_stuff.h doomdata.h doomdef.h doomstat.h doomtype.h dstrings.h d_englsh.h \ 20 | d_event.h d_french.h d_items.h d_main.h d_net.h d_player.h d_textur.h d_think.h d_ticcmd.h \ 21 | f_finale.h f_wipe.h g_game.h hu_lib.h hu_stuff.h info.h i_net.h i_sound.h i_system.h i_video.h \ 22 | m_argv.h m_bbox.h m_cheat.h m_fixed.h m_menu.h m_misc.h m_random.h m_swap.h p_enemy.h p_inter.h \ 23 | p_local.h p_mobj.h p_pspr.h p_saveg.h p_setup.h p_spec.h p_tick.h r_bsp.h r_data.h r_defs.h \ 24 | r_draw.h r_local.h r_main.h r_patch.h r_plane.h r_segs.h r_sky.h r_state.h r_things.h sounds.h \ 25 | st_lib.h st_stuff.h s_sound.h tables.h v_text.h v_video.h wi_stuff.h w_wad.h z_zone.h 26 | 27 | 28 | OBJS= acorn.o am_map.o a_sound.o a_keyboard.o a_video.o dh_stuff.o doomdef.o doomstat.o \ 29 | d_items.o d_main.o d_net.o f_finale.o f_wipe.o g_game.o hu_lib.o hu_stuff.o info.o i_main.o \ 30 | i_net.o i_system.o m_argv.o m_bbox.o m_cheat.o m_fixed.o m_menu.o m_misc.o m_random.o \ 31 | m_swap.o p_ceilng.o p_doors.o p_enemy.o p_floor.o p_inter.o p_lights.o p_map.o p_maputl.o \ 32 | p_mobj.o p_plats.o p_pspr.o p_saveg.o p_setup.o p_sight.o p_spec.o p_switch.o p_telept.o \ 33 | p_tick.o p_user.o r_bsp.o r_data.o r_draw.o r_main.o r_patch.o r_plane.o r_segs.o r_sky.o r_things.o \ 34 | sounds.o st_lib.o st_stuff.o s_sound.o tables.o v_text.o v_video.o wi_stuff.o w_wad.o z_zone.o 35 | 36 | all: ^.!RunImage 37 | 38 | 39 | ^.!RunImage: $(OBJS) 40 | $(CC) $(CFLAGS) $(LDFLAGS) $(OBJS) $(LIBS) -o ^.!RunImage 41 | squeeze ^.!RunImage 42 | @echo Finished OK 43 | 44 | .SUFFIXES: .o .c 45 | .c.o:; $(CC) $(CFLAGS) -c -o $@ $*.c 46 | 47 | .SUFFIXES: .o .s 48 | .s.o:; $(ASM) $(AFLAGS) -o $@ $*.s 49 | 50 | 51 | $(OBJS): $(HDRS) 52 | -------------------------------------------------------------------------------- /Source/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 | typedef enum 36 | { 37 | D_D_DEVSTR, 38 | D_D_CDROM, 39 | D_D_CDROM_RO, 40 | D_ULTIMATE, 41 | D_SHAREWARE, 42 | D_REGISTERED, 43 | D_HELL_ON_EARTH, 44 | D_PLUTONIA, 45 | D_TNT, 46 | D_PUBLIC, 47 | D_SYSTEM_STARTUP, 48 | D_MODIFIED, 49 | D_SHAREWARE_2, 50 | D_COMMERCIAL, 51 | D_NOT_SHAREWARE, 52 | D_DO_NOT_DIST, 53 | D_CANNOT_FILE, 54 | D_NOT_REGISTERED, 55 | D_SHAREWARE_VERSION, 56 | D_REGISTERED_VERSION, 57 | D_COMMERCIAL_VERSION 58 | } main_texts_t; 59 | 60 | 61 | unsigned int D_Startup_msg_number (void); 62 | 63 | void D_LoadCheats (void); 64 | void D_ClearCheats (void); 65 | 66 | void D_AddFile (const char *file); 67 | 68 | 69 | // 70 | // D_DoomMain() 71 | // Not a globally visible function, just included for source reference, 72 | // calls all startup code, parses command line options. 73 | // If not overrided by user input, calls N_AdvanceDemo. 74 | // 75 | void D_DoomMain (void); 76 | 77 | // Called by IO functions when input is detected. 78 | void D_PostEvent (event_t* ev); 79 | 80 | 81 | 82 | // 83 | // BASE LEVEL 84 | // 85 | void D_PageTicker (void); 86 | void D_PageDrawer (const char * page); 87 | void D_AdvanceDemo (void); 88 | void D_StartTitle (void); 89 | 90 | #endif 91 | -------------------------------------------------------------------------------- /Source/Cygwin/Makefile: -------------------------------------------------------------------------------- 1 | ################################################################ 2 | # 3 | # $Id:$ 4 | # 5 | # $Log:$ 6 | # 7 | ##CC=i686-pc-mingw32-gcc 8 | ##CC=i686-pc-cygwin-gcc 9 | ##CC= x86_64-w64-mingw32-gcc 10 | #CC=x86_64-pc-cygwin-gcc 11 | CC=gcc 12 | ASM= 13 | VPATH=.. 14 | 15 | CFLAGS=-g -DMORELIGHTLEVELS -DPADDED_STRUCTS -DNORMALUNIX -DHAVE_ALLOCA 16 | #-Wpointer-to-int-cast -Wint-to-pointer-cast 17 | 18 | AFLAGS= 19 | LDFLAGS= 20 | 21 | LIBS=-lXext -lX11 -lm 22 | 23 | HDRS= am_map.h dh_stuff.h doomdata.h doomdef.h doomstat.h doomtype.h dstrings.h d_englsh.h \ 24 | d_event.h d_french.h d_items.h d_main.h d_net.h d_player.h d_textur.h d_think.h d_ticcmd.h \ 25 | f_finale.h f_wipe.h g_game.h hu_lib.h hu_stuff.h info.h i_net.h i_sound.h i_system.h i_video.h \ 26 | m_argv.h m_bbox.h m_cheat.h m_fixed.h m_menu.h m_misc.h m_random.h m_swap.h p_enemy.h p_inter.h \ 27 | p_local.h p_mobj.h p_pspr.h p_saveg.h p_setup.h p_spec.h p_tick.h r_bsp.h r_data.h r_defs.h \ 28 | r_draw.h r_local.h r_main.h r_patch.h r_plane.h r_segs.h r_sky.h r_state.h r_things.h sounds.h \ 29 | st_lib.h st_stuff.h s_sound.h tables.h v_text.h v_video.h wi_stuff.h w_wad.h z_zone.h 30 | 31 | 32 | OBJS= am_map.o i_sound.o i_video.o dh_stuff.o doomdef.o doomstat.o \ 33 | dstrings.o d_items.o d_main.o d_net.o f_finale.o f_wipe.o g_game.o hu_lib.o hu_stuff.o info.o \ 34 | i_main.o i_net.o i_system.o m_argv.o m_bbox.o m_cheat.o m_fixed.o m_menu.o m_misc.o m_random.o \ 35 | m_swap.o p_ceilng.o p_doors.o p_enemy.o p_floor.o p_inter.o p_lights.o p_map.o p_maputl.o \ 36 | p_mobj.o p_plats.o p_pspr.o p_saveg.o p_setup.o p_sight.o p_spec.o p_switch.o p_telept.o \ 37 | p_tick.o p_user.o r_bsp.o r_data.o r_draw.o r_main.o r_patch.o r_plane.o r_segs.o r_sky.o r_things.o \ 38 | sounds.o st_lib.o st_stuff.o s_sound.o tables.o v_text.o v_video.o wi_stuff.o w_wad.o z_zone.o 39 | 40 | all: /usr/local/lib/Doom/xdoom 41 | 42 | /usr/local/lib/Doom/xdoom: $(OBJS) 43 | $(CC) $(CFLAGS) $(LDFLAGS) $(OBJS) $(LIBS) -o $@ 44 | #upx $@ 45 | @echo Finished OK 46 | 47 | #.SUFFIXES: .o .c 48 | #.c.o:; $(CC) $(CFLAGS) -c -o $@ $*.c 49 | %.o: %.c 50 | $(CC) $(CFLAGS) -c $< -o $@ 51 | 52 | #.SUFFIXES: .o .s 53 | #.s.o:; $(ASM) $(AFLAGS) -o $@ $*.s 54 | 55 | 56 | $(OBJS): $(HDRS) 57 | -------------------------------------------------------------------------------- /Source/Debian/Makefile: -------------------------------------------------------------------------------- 1 | ################################################################ 2 | # 3 | # $Id:$ 4 | # 5 | # $Log:$ 6 | # 7 | ##CC=i686-pc-mingw32-gcc 8 | ##CC=i686-pc-cygwin-gcc 9 | ##CC= x86_64-w64-mingw32-gcc 10 | #CC=x86_64-pc-cygwin-gcc 11 | CC=gcc 12 | ASM= 13 | VPATH=.. 14 | 15 | CFLAGS=-g -DMORELIGHTLEVELS -DPADDED_STRUCTS -DNORMALUNIX -DHAVE_ALLOCA 16 | #-Wpointer-to-int-cast -Wint-to-pointer-cast 17 | 18 | AFLAGS= 19 | LDFLAGS= 20 | 21 | LIBS=-lXext -lX11 -lm 22 | 23 | HDRS= am_map.h dh_stuff.h doomdata.h doomdef.h doomstat.h doomtype.h dstrings.h d_englsh.h \ 24 | d_event.h d_french.h d_items.h d_main.h d_net.h d_player.h d_textur.h d_think.h d_ticcmd.h \ 25 | f_finale.h f_wipe.h g_game.h hu_lib.h hu_stuff.h info.h i_net.h i_sound.h i_system.h i_video.h \ 26 | m_argv.h m_bbox.h m_cheat.h m_fixed.h m_menu.h m_misc.h m_random.h m_swap.h p_enemy.h p_inter.h \ 27 | p_local.h p_mobj.h p_pspr.h p_saveg.h p_setup.h p_spec.h p_tick.h r_bsp.h r_data.h r_defs.h \ 28 | r_draw.h r_local.h r_main.h r_patch.h r_plane.h r_segs.h r_sky.h r_state.h r_things.h sounds.h \ 29 | st_lib.h st_stuff.h s_sound.h tables.h v_text.h v_video.h wi_stuff.h w_wad.h z_zone.h 30 | 31 | 32 | OBJS= am_map.o i_sound.o i_video.o dh_stuff.o doomdef.o doomstat.o \ 33 | dstrings.o d_items.o d_main.o d_net.o f_finale.o f_wipe.o g_game.o hu_lib.o hu_stuff.o info.o \ 34 | i_main.o i_net.o i_system.o m_argv.o m_bbox.o m_cheat.o m_fixed.o m_menu.o m_misc.o m_random.o \ 35 | m_swap.o p_ceilng.o p_doors.o p_enemy.o p_floor.o p_inter.o p_lights.o p_map.o p_maputl.o \ 36 | p_mobj.o p_plats.o p_pspr.o p_saveg.o p_setup.o p_sight.o p_spec.o p_switch.o p_telept.o \ 37 | p_tick.o p_user.o r_bsp.o r_data.o r_draw.o r_main.o r_patch.o r_plane.o r_segs.o r_sky.o r_things.o \ 38 | sounds.o st_lib.o st_stuff.o s_sound.o tables.o v_text.o v_video.o wi_stuff.o w_wad.o z_zone.o 39 | 40 | all: /usr/local/lib/Doom/xdoom 41 | 42 | /usr/local/lib/Doom/xdoom: $(OBJS) 43 | $(CC) $(CFLAGS) $(LDFLAGS) $(OBJS) $(LIBS) -o $@ 44 | #upx $@ 45 | @echo Finished OK 46 | 47 | #.SUFFIXES: .o .c 48 | #.c.o:; $(CC) $(CFLAGS) -c -o $@ $*.c 49 | %.o: %.c 50 | $(CC) $(CFLAGS) -c $< -o $@ 51 | 52 | #.SUFFIXES: .o .s 53 | #.s.o:; $(ASM) $(AFLAGS) -o $@ $*.s 54 | 55 | 56 | $(OBJS): $(HDRS) 57 | -------------------------------------------------------------------------------- /Source/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 // Flags in thing->frame 51 | #define FF_TRANSLUCENT MF_TRANSLUCENT // Cheat by using the same value 52 | #define FF_FRAMEMASK 0x7fff 53 | 54 | 55 | 56 | // 57 | // Overlay psprites are scaled shapes 58 | // drawn directly on the view screen, 59 | // coordinates are given for a 320*200 view screen. 60 | // 61 | typedef enum 62 | { 63 | ps_weapon, 64 | ps_flash, 65 | NUMPSPRITES 66 | 67 | } psprnum_t; 68 | 69 | typedef struct 70 | { 71 | state_t* state; // a NULL state means not active 72 | int tics; 73 | fixed_t sx; 74 | fixed_t sy; 75 | 76 | } pspdef_t; 77 | 78 | #endif 79 | //----------------------------------------------------------------------------- 80 | // 81 | // $Log:$ 82 | // 83 | //----------------------------------------------------------------------------- 84 | -------------------------------------------------------------------------------- /Source/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 | void M_SetEpiKey (unsigned int episode, unsigned int key); 58 | void M_SetEpiSel (unsigned int episode); 59 | void M_SetEpiName (unsigned int episode, char * name, unsigned int len); 60 | unsigned int M_GetNextEpi (unsigned int episode, unsigned int map); 61 | void M_SetNextEpiSel (unsigned int episode); 62 | void M_ClearEpiSel (unsigned int episode, unsigned int map); 63 | void M_DrawDisc (void); 64 | void M_RemoveDisc (void); 65 | int M_ScreenUpdated (void); 66 | 67 | #endif 68 | //----------------------------------------------------------------------------- 69 | // 70 | // $Log:$ 71 | // 72 | //----------------------------------------------------------------------------- 73 | -------------------------------------------------------------------------------- /Source/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 | #ifndef __Z_ZONE__ 26 | #define __Z_ZONE__ 27 | 28 | // Include system definitions so that prototypes become 29 | // active before macro replacements below are in effect. 30 | 31 | #include 32 | #include 33 | #include 34 | #include 35 | 36 | #ifdef NORMALUNIX 37 | #include 38 | #include 39 | #include 40 | #endif 41 | #ifdef __riscos 42 | #include "acorn.h" 43 | #include 44 | #endif 45 | #include "doomtype.h" 46 | 47 | // 48 | // ZONE MEMORY 49 | // PU - purge tags. 50 | // 51 | enum 52 | { 53 | PU_FREE, // a free block 54 | PU_STATIC, // static entire execution time 55 | PU_SOUND, // static while playing 56 | PU_MUSIC, // static while playing 57 | PU_LEVEL, // static until level exited 58 | PU_LEVSPEC, // a special thinker in a level 59 | PU_LEVMAP, // sector contents list 60 | PU_CACHE, 61 | PU_MAX, // Must always be last -- killough 62 | }; 63 | 64 | #define PU_PURGELEVEL PU_CACHE // First purgable tag's level 65 | 66 | void Z_Init (void); 67 | void *Z_Malloc (size_t size, uint32_t tag, void **ptr); 68 | void Z_Free (void *ptr); 69 | void Z_FreeTags (uint32_t lowtag, uint32_t hightag); 70 | void Z_ChangeTag (void *ptr, uint32_t tag); 71 | void *Z_Calloc (size_t size, uint32_t tag, void **user); 72 | void *Z_Realloc (void *ptr, size_t n, uint32_t tag, void **user); 73 | char *Z_Strdup (const char *s, uint32_t tag, void **user); 74 | 75 | #endif 76 | -------------------------------------------------------------------------------- /Source/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 | #if 0 26 | static const char rcsid[] = "$Id: m_cheat.c,v 1.1 1997/02/03 21:24:34 b1 Exp $"; 27 | #endif 28 | 29 | #include "m_cheat.h" 30 | 31 | // 32 | // CHEAT SEQUENCE PACKAGE 33 | // 34 | 35 | static int firsttime = 1; 36 | static unsigned char cheat_xlate_table[256]; 37 | 38 | 39 | // 40 | // Called in st_stuff module, which handles the input. 41 | // Returns a 1 if the cheat was successful, 0 if failed. 42 | // 43 | int 44 | cht_CheckCheat 45 | ( cheatseq_t* cht, 46 | char key ) 47 | { 48 | int i; 49 | int rc = 0; 50 | 51 | if (firsttime) 52 | { 53 | firsttime = 0; 54 | for (i=0;i<256;i++) cheat_xlate_table[i] = SCRAMBLE(i); 55 | } 56 | 57 | if (!cht->p) 58 | cht->p = cht->sequence; // initialize if first time 59 | 60 | if (*cht->p == 0) 61 | *(cht->p++) = key; 62 | else if 63 | (cheat_xlate_table[(unsigned char)key] == *cht->p) cht->p++; 64 | else 65 | cht->p = cht->sequence; 66 | 67 | if (*cht->p == 1) 68 | cht->p++; 69 | else if (*cht->p == 0xff) // end of sequence character 70 | { 71 | cht->p = cht->sequence; 72 | rc = 1; 73 | } 74 | 75 | return rc; 76 | } 77 | 78 | void 79 | cht_GetParam 80 | ( cheatseq_t* cht, 81 | char* buffer ) 82 | { 83 | 84 | unsigned char *p, c; 85 | 86 | p = cht->sequence; 87 | while (*(p++) != 1); 88 | 89 | do 90 | { 91 | c = *p; 92 | *(buffer++) = c; 93 | *(p++) = 0; 94 | } 95 | while (c && *p!=0xff ); 96 | 97 | if (*p==0xff) 98 | *buffer = 0; 99 | 100 | } 101 | 102 | 103 | -------------------------------------------------------------------------------- /Source/doomtype.h: -------------------------------------------------------------------------------- 1 | // Emacs style mode select -*- C++ -*- 2 | //----------------------------------------------------------------------------- 3 | // 4 | // $Id:$ 5 | // 6 | // Copyright (C) 1993-1996 by id Software, Inc. 7 | // 8 | // This source is available for distribution and/or modification 9 | // only under the terms of the DOOM Source Code License as 10 | // published by id Software. All rights reserved. 11 | // 12 | // The source is distributed in the hope that it will be useful, 13 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | // FITNESS FOR A PARTICULAR PURPOSE. See the DOOM Source Code License 15 | // for more details. 16 | // 17 | // DESCRIPTION: 18 | // Simple basic typedefs, isolated here to make it easier 19 | // separating modules. 20 | // 21 | //----------------------------------------------------------------------------- 22 | 23 | 24 | #ifndef __DOOMTYPE__ 25 | #define __DOOMTYPE__ 26 | 27 | 28 | #ifndef __BYTEBOOL__ 29 | #define __BYTEBOOL__ 30 | // Fixed to use builtin bool type with C++. 31 | #ifdef __cplusplus 32 | typedef bool boolean; 33 | #else 34 | typedef enum {false, true} boolean; 35 | #endif 36 | typedef unsigned char byte; 37 | #endif 38 | 39 | 40 | // Predefined with some OS. 41 | #ifdef LINUX 42 | #include 43 | #else 44 | #define MAXCHAR ((char)0x7f) 45 | #define MAXSHORT ((short)0x7fff) 46 | 47 | // Max pos 32-bit int. 48 | #define MAXINT ((int)0x7fffffff) 49 | #define MAXLONG ((long)0x7fffffff) 50 | #define MINCHAR ((char)0x80) 51 | #define MINSHORT ((short)0x8000) 52 | 53 | // Max negative 32-bit integer. 54 | #define MININT ((int)0x80000000) 55 | #define MINLONG ((long)0x80000000) 56 | #endif 57 | 58 | /* Type to use where the original version used short. */ 59 | #ifndef USE_SHORTS_ONLY 60 | 61 | typedef int dshort_t; 62 | typedef unsigned int dushort_t; 63 | #define MAXDSHORT MAXINT 64 | #define MAXDUSHORT 0xffffffff 65 | 66 | #else 67 | 68 | typedef short dshort_t; 69 | typedef unsigned short dushort_t; 70 | #define MAXDSHORT MAXSHORT 71 | #define MAXDUSHORT 0xffff 72 | 73 | #endif 74 | 75 | #ifndef M_PI 76 | #define M_PI 3.14159265358979323846 77 | #endif 78 | 79 | 80 | #ifdef BOOM 81 | #define BOOMSTATEMENT(stmt) stmt 82 | #else 83 | #define BOOMSTATEMENT(stmt) 84 | #endif 85 | 86 | 87 | #endif 88 | //----------------------------------------------------------------------------- 89 | // 90 | // $Log:$ 91 | // 92 | //----------------------------------------------------------------------------- 93 | -------------------------------------------------------------------------------- /Source/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 D_DoomLoop, 38 | // returns current time in tics. 39 | int I_GetTime (void); 40 | 41 | 42 | // 43 | // Called by D_DoomLoop, 44 | // called before processing any tics in a frame 45 | // (just after displaying a frame). 46 | // Time consuming syncronous operations 47 | // are performed here (joystick reading). 48 | // Can call D_PostEvent. 49 | // 50 | void I_StartFrame (void); 51 | 52 | 53 | // 54 | // Called by D_DoomLoop, 55 | // called before processing each tic in a frame. 56 | // Quick syncronous operations are performed here. 57 | // Can call D_PostEvent. 58 | void I_StartTic (void); 59 | 60 | // Asynchronous interrupt functions should maintain private queues 61 | // that are read by the synchronous functions 62 | // to be converted into events. 63 | 64 | // Either returns a null ticcmd, 65 | // or calls a loadable driver to build it. 66 | // This ticcmd will then be modified by the gameloop 67 | // for normal input. 68 | ticcmd_t* I_BaseTiccmd (void); 69 | 70 | 71 | // Called by M_Responder when quit is selected. 72 | // Clean exit, displays sell blurb. 73 | void I_Quit (void); 74 | 75 | 76 | // Allocates from low memory under dos, 77 | // just mallocs under unix 78 | byte* I_AllocLow (int length); 79 | 80 | void I_Tactile (int on, int off, int total); 81 | 82 | 83 | void I_Error (char *error, ...); 84 | 85 | 86 | #endif 87 | //----------------------------------------------------------------------------- 88 | // 89 | // $Log:$ 90 | // 91 | //----------------------------------------------------------------------------- 92 | -------------------------------------------------------------------------------- /Source/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*sbarscale) >> FRACBITS) 33 | #define ST_WIDTH ((320*sbarscale) >> FRACBITS) 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 | void ST_AutoMapEvent (int am_message); 44 | 45 | // Called by main loop. 46 | void ST_Ticker (void); 47 | 48 | // Called by main loop. 49 | void ST_Drawer (boolean fullscreen, boolean refresh); 50 | 51 | // Called when the console player is spawned on each level. 52 | void ST_Start (void); 53 | 54 | // Called by startup code. 55 | void ST_Init (void); 56 | void ST_createWidgets(void); 57 | 58 | // Clear the two rectangular areas either side of the status 59 | // bar when using a screen resolution of x > 320. 60 | void ST_ClearSbarSides (void); 61 | 62 | 63 | // States for status bar code. 64 | typedef enum 65 | { 66 | AutomapState, 67 | FirstPersonState 68 | 69 | } st_stateenum_t; 70 | 71 | 72 | // States for the chat code. 73 | typedef enum 74 | { 75 | StartChatState, 76 | WaitDestState, 77 | GetChatState 78 | 79 | } st_chatstateenum_t; 80 | 81 | 82 | boolean ST_Responder(event_t* ev); 83 | 84 | 85 | extern int weaponscale; 86 | extern int stbar_scale; 87 | extern int hutext_scale; 88 | extern fixed_t sbarscale; 89 | extern fixed_t hutextscale; 90 | 91 | extern void ST_SetPalette (byte * palette); 92 | 93 | #endif 94 | //----------------------------------------------------------------------------- 95 | // 96 | // $Log:$ 97 | // 98 | //----------------------------------------------------------------------------- 99 | -------------------------------------------------------------------------------- /Source/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 | #if 0 24 | static const char rcsid[] = "$Id:$"; 25 | #endif 26 | 27 | #include "includes.h" 28 | 29 | // 30 | // PSPRITE ACTIONS for waepons. 31 | // This struct controls the weapon animations. 32 | // 33 | // Each entry is: 34 | // ammo/amunition type 35 | // upstate 36 | // downstate 37 | // readystate 38 | // atkstate, i.e. attack/fire/hit frame 39 | // flashstate, muzzle flash 40 | // 41 | weaponinfo_t weaponinfo[NUMWEAPONS] = 42 | { 43 | { 44 | // fist 45 | am_noammo, 46 | S_PUNCHUP, 47 | S_PUNCHDOWN, 48 | S_PUNCH, 49 | S_PUNCH1, 50 | S_NULL, 51 | 1, // Ammo per shot 52 | 0 // MBF21 bits 53 | }, 54 | { 55 | // pistol 56 | am_clip, 57 | S_PISTOLUP, 58 | S_PISTOLDOWN, 59 | S_PISTOL, 60 | S_PISTOL1, 61 | S_PISTOLFLASH, 62 | 1,0 63 | }, 64 | { 65 | // shotgun 66 | am_shell, 67 | S_SGUNUP, 68 | S_SGUNDOWN, 69 | S_SGUN, 70 | S_SGUN1, 71 | S_SGUNFLASH1, 72 | 1,0 73 | }, 74 | { 75 | // chaingun 76 | am_clip, 77 | S_CHAINUP, 78 | S_CHAINDOWN, 79 | S_CHAIN, 80 | S_CHAIN1, 81 | S_CHAINFLASH1, 82 | 1,0 83 | }, 84 | { 85 | // missile launcher 86 | am_misl, 87 | S_MISSILEUP, 88 | S_MISSILEDOWN, 89 | S_MISSILE, 90 | S_MISSILE1, 91 | S_MISSILEFLASH1, 92 | 1,0 93 | }, 94 | { 95 | // plasma rifle 96 | am_cell, 97 | S_PLASMAUP, 98 | S_PLASMADOWN, 99 | S_PLASMA, 100 | S_PLASMA1, 101 | S_PLASMAFLASH1, 102 | 1,0 103 | }, 104 | { 105 | // bfg 9000 106 | am_cell, 107 | S_BFGUP, 108 | S_BFGDOWN, 109 | S_BFG, 110 | S_BFG1, 111 | S_BFGFLASH1, 112 | 40,0 113 | }, 114 | { 115 | // chainsaw 116 | am_noammo, 117 | S_SAWUP, 118 | S_SAWDOWN, 119 | S_SAW, 120 | S_SAW1, 121 | S_NULL, 122 | 1,0 123 | }, 124 | { 125 | // super shotgun 126 | am_shell, 127 | S_DSGUNUP, 128 | S_DSGUNDOWN, 129 | S_DSGUN, 130 | S_DSGUN1, 131 | S_DSGUNFLASH1, 132 | 2,0 133 | }, 134 | }; 135 | 136 | 137 | 138 | 139 | 140 | 141 | 142 | 143 | -------------------------------------------------------------------------------- /Source/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 | void S_InitSound (void); 33 | void S_ShutdownSound (void); 34 | 35 | // 36 | // Initializes sound stuff, including volume 37 | // Sets channels, SFX and music volume, 38 | // allocates channel buffer, sets S_sfx lookup. 39 | // 40 | void 41 | S_Init 42 | ( int sfxVolume, 43 | int musicVolume ); 44 | 45 | 46 | 47 | 48 | // 49 | // Per level startup code. 50 | // Kills playing sounds at start of level, 51 | // determines music if any, changes music. 52 | // 53 | void S_Start(void); 54 | 55 | 56 | // 57 | // Start sound for thing at 58 | // using from sounds.h 59 | // 60 | void 61 | S_StartSound 62 | ( mobj_t* origin, 63 | int sound_id ); 64 | 65 | void 66 | S_StartSoundOnce 67 | ( mobj_t* origin, 68 | int sound_id ); 69 | 70 | 71 | // Stop sound for thing at 72 | void S_StopSound(void* origin); 73 | void S_RemoveSoundOrigin (void *origin); 74 | 75 | 76 | int S_StartLevelMusic (unsigned int ge, unsigned int gm); 77 | 78 | // Start music using from sounds.h 79 | void S_StartMusic(int music_id); 80 | 81 | // Start music using from sounds.h, 82 | // and set whether looping 83 | void 84 | S_ChangeMusic 85 | ( int music_id, 86 | int looping ); 87 | 88 | // Stops the music fer sure. 89 | void S_StopMusic(void); 90 | 91 | // Stop and resume music, during game PAUSE. 92 | void S_PauseSound(void); 93 | void S_ResumeSound(void); 94 | 95 | int S_FindSoundData (sfxinfo_t * sfx); 96 | 97 | // 98 | // Updates music & sounds 99 | // 100 | void S_UpdateSounds(void* listener); 101 | 102 | void S_SetMusicVolume(int volume); 103 | void S_SetSfxVolume(int volume); 104 | 105 | void S_MusInfoThinker (mobj_t *thing); 106 | 107 | #endif 108 | //----------------------------------------------------------------------------- 109 | // 110 | // $Log:$ 111 | // 112 | //----------------------------------------------------------------------------- 113 | -------------------------------------------------------------------------------- /Source/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_newgame2, 59 | ga_newgamelater, 60 | ga_loadgame, 61 | ga_savegame, 62 | ga_playdemo, 63 | ga_completed, 64 | ga_completedlater, 65 | ga_victory, 66 | ga_worlddone, 67 | ga_screenshot 68 | } gameaction_t; 69 | 70 | 71 | 72 | // 73 | // Button/action code definitions. 74 | // 75 | typedef enum 76 | { 77 | // Press "Fire". 78 | BT_ATTACK = 1, 79 | // Use button, to open doors, activate switches. 80 | BT_USE = 2, 81 | 82 | // Flag: game events, not really buttons. 83 | BT_SPECIAL = 128, 84 | BT_SPECIALMASK = 3, 85 | 86 | // Flag, weapon change pending. 87 | // If true, the next 3 bits hold weapon num. 88 | BT_CHANGE = 4, 89 | // The 3bit weapon mask and shift, convenience. 90 | BT_WEAPONMASK = (8+16+32), 91 | BT_WEAPONSHIFT = 3, 92 | 93 | // Pause the game. 94 | BTS_PAUSE = 1, 95 | // Save the game at each console. 96 | BTS_SAVEGAME = 2, 97 | 98 | // Savegame slot numbers 99 | // occupy the second byte of buttons. 100 | BTS_SAVEMASK = (4+8+16), 101 | BTS_SAVESHIFT = 2 102 | 103 | } buttoncode_t; 104 | 105 | 106 | 107 | 108 | // 109 | // GLOBAL VARIABLES 110 | // 111 | #define MAXEVENTS 64 112 | 113 | extern event_t events[MAXEVENTS]; 114 | extern int eventhead; 115 | extern int eventtail; 116 | 117 | extern gameaction_t gameaction; 118 | 119 | 120 | #endif 121 | //----------------------------------------------------------------------------- 122 | // 123 | // $Log:$ 124 | // 125 | //----------------------------------------------------------------------------- 126 | -------------------------------------------------------------------------------- /Source/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 | void V_CopyRect (int srcx, int srcy, int srcscrn, int width, int height, int destx, int desty, int destscrn); 59 | void V_DrawPatchScaleFlip (int x, int y, int scrn, patch_t * patch, fixed_t xscale, fixed_t yscale, int flipped); 60 | 61 | #if 0 62 | #define V_DrawPatch(x,y,s,p) V_DrawPatchScaleFlip(x,y,s,p,FRACUNIT,FRACUNIT,0) 63 | #define V_DrawPatchDirect(x,y,s,p) V_DrawPatchScaleFlip(x,y,s,p,FRACUNIT,FRACUNIT,0) 64 | #define V_DrawPatchFlipped(x,y,s,p) V_DrawPatchScaleFlip(x,y,s,p,FRACUNIT,FRACUNIT,1) 65 | #else 66 | void V_DrawPatch (int x, int y, int scrn, patch_t* patch); 67 | void V_DrawPatchDirect (int x, int y, int scrn, patch_t* patch); 68 | void V_DrawPatchFlipped (int x, int y, int scrn, patch_t* patch); 69 | #endif 70 | 71 | #define V_DrawPatchScaled(x,y,s,p) V_DrawPatchFlippedScaled(x,y,s,p,0) 72 | 73 | void V_DrawPatchFlippedScaled (int x, int y, int scrn, patch_t* patch, int flipped); 74 | 75 | // Draw a linear block of pixels into the view buffer. 76 | void V_DrawBlock (int x, int y, int scrn, int width, int height, byte* src); 77 | 78 | // Reads a linear block of pixels into the view buffer. 79 | void V_GetBlock (int x, int y, int scrn, int width, int height, byte* dest); 80 | 81 | 82 | void V_MarkRect (int x, int y, int width, int height); 83 | 84 | void V_DrawPixel (int x, int y, int screen, int colour, fixed_t xscale, fixed_t yscale, boolean shadow); 85 | void V_DrawPixelScaled (int x, int y, int screen, int colour, boolean shadow); 86 | 87 | #endif 88 | 89 | //----------------------------------------------------------------------------- 90 | // 91 | // $Log:$ 92 | // 93 | //----------------------------------------------------------------------------- 94 | -------------------------------------------------------------------------------- /Source/i_system.c: -------------------------------------------------------------------------------- 1 | // Emacs style mode select -*- C++ -*- 2 | //----------------------------------------------------------------------------- 3 | // 4 | // $Id:$ 5 | // 6 | // Copyright (C) 1993-1996 by id Software, Inc. 7 | // 8 | // This source is available for distribution and/or modification 9 | // only under the terms of the DOOM Source Code License as 10 | // published by id Software. All rights reserved. 11 | // 12 | // The source is distributed in the hope that it will be useful, 13 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | // FITNESS FOR A PARTICULAR PURPOSE. See the DOOM Source Code License 15 | // for more details. 16 | // 17 | // $Log:$ 18 | // 19 | // DESCRIPTION: 20 | // 21 | //----------------------------------------------------------------------------- 22 | 23 | #if 0 24 | static const char rcsid[] = "$Id: m_bbox.c,v 1.1 1997/02/03 22:45:10 b1 Exp $"; 25 | #endif 26 | 27 | #include "includes.h" 28 | 29 | 30 | void 31 | I_Tactile 32 | ( int on, 33 | int off, 34 | int total ) 35 | { 36 | // UNUSED. 37 | on = off = total = 0; 38 | } 39 | 40 | ticcmd_t emptycmd; 41 | ticcmd_t* I_BaseTiccmd(void) 42 | { 43 | return &emptycmd; 44 | } 45 | 46 | 47 | // 48 | // I_GetTime 49 | // returns time in 1/70th second tics 50 | // 51 | int I_GetTime (void) 52 | { 53 | struct timeval tp; 54 | struct timezone tzp; 55 | int newtics; 56 | static int basetime=0; 57 | 58 | gettimeofday(&tp, &tzp); 59 | if (!basetime) 60 | basetime = (int) tp.tv_sec; 61 | newtics = (int) ((tp.tv_sec-basetime)*TICRATE + tp.tv_usec*TICRATE/1000000); 62 | return newtics; 63 | } 64 | 65 | 66 | 67 | // 68 | // I_Init 69 | // 70 | void I_Init (void) 71 | { 72 | S_InitSound(); 73 | // I_InitGraphics(); 74 | atexit (I_ShutdownNetwork); 75 | } 76 | 77 | // 78 | // I_Quit 79 | // 80 | void I_Quit (void) 81 | { 82 | D_QuitNetGame (); 83 | S_ShutdownSound(); 84 | M_SaveDefaults (); 85 | I_ShutdownGraphics(); 86 | I_ShutdownNetwork(); 87 | exit(0); 88 | } 89 | 90 | void I_WaitVBL(int count) 91 | { 92 | #ifdef SGI 93 | sginap(1); 94 | #else 95 | #ifdef SUN 96 | sleep(0); 97 | #else 98 | usleep (count * (1000000/70) ); 99 | #endif 100 | #endif 101 | } 102 | 103 | void I_BeginRead(void) 104 | { 105 | } 106 | 107 | void I_EndRead(void) 108 | { 109 | } 110 | 111 | byte* I_AllocLow(int length) 112 | { 113 | byte* mem; 114 | 115 | mem = (byte *)malloc (length); 116 | memset (mem,0,length); 117 | return mem; 118 | } 119 | 120 | 121 | // 122 | // I_Error 123 | // 124 | extern boolean demorecording; 125 | 126 | void I_Error (char *error, ...) 127 | { 128 | va_list argptr; 129 | 130 | // Message first. 131 | va_start (argptr,error); 132 | fprintf (stderr, "Error: "); 133 | vfprintf (stderr,error,argptr); 134 | fprintf (stderr, "\n"); 135 | va_end (argptr); 136 | 137 | fflush( stderr ); 138 | 139 | // Shutdown. Here might be other errors. 140 | if (demorecording) 141 | G_CheckDemoStatus(); 142 | 143 | D_QuitNetGame (); 144 | S_ShutdownSound(); 145 | I_ShutdownGraphics(); 146 | I_ShutdownNetwork(); 147 | 148 | exit(-1); 149 | } 150 | -------------------------------------------------------------------------------- /Source/i_sound.h: -------------------------------------------------------------------------------- 1 | // Emacs style mode select -*- C++ -*- 2 | //----------------------------------------------------------------------------- 3 | // 4 | // $Id:$ 5 | // 6 | // Copyright (C) 1993-1996 by id Software, Inc. 7 | // 8 | // This source is available for distribution and/or modification 9 | // only under the terms of the DOOM Source Code License as 10 | // published by id Software. All rights reserved. 11 | // 12 | // The source is distributed in the hope that it will be useful, 13 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | // FITNESS FOR A PARTICULAR PURPOSE. See the DOOM Source Code License 15 | // for more details. 16 | // 17 | // 18 | // DESCRIPTION: 19 | // System interface, sound. 20 | // 21 | //----------------------------------------------------------------------------- 22 | 23 | #ifndef __I_SOUND__ 24 | #define __I_SOUND__ 25 | 26 | #include "doomdef.h" 27 | 28 | // UNIX hack, to be removed. 29 | #ifdef SNDSERV 30 | #include 31 | extern FILE* sndserver; 32 | extern char* sndserver_filename; 33 | #endif 34 | 35 | #include "doomstat.h" 36 | #include "sounds.h" 37 | 38 | 39 | 40 | // Init at program start... 41 | void I_InitSound(void); 42 | 43 | // ... update sound buffer and audio device at runtime... 44 | void I_UpdateSound(void); 45 | void I_SubmitSound(void); 46 | 47 | // ... shut down and relase at program termination. 48 | void I_ShutdownSound(void); 49 | 50 | 51 | // 52 | // SFX I/O 53 | // 54 | 55 | // Initialize channels? 56 | void I_SetChannels(void); 57 | 58 | // Starts a sound in a particular sound channel. 59 | int 60 | I_StartSound 61 | ( int id, 62 | int vol, 63 | int sep, 64 | int pitch ); 65 | 66 | 67 | // Stops a sound channel. 68 | void I_StopSound(int handle); 69 | 70 | // Called by S_*() functions 71 | // to see if a channel is still playing. 72 | // Returns 0 if no longer playing, 1 if playing. 73 | int I_SoundIsPlaying(int handle); 74 | 75 | // Updates the volume, separation, 76 | // and pitch of a sound channel. 77 | void 78 | I_UpdateSoundParams 79 | ( 80 | channel_t* c, 81 | int vol, 82 | int sep, 83 | int pitch ); 84 | 85 | 86 | // 87 | // MUSIC I/O 88 | // 89 | void I_InitMusic(void); 90 | void I_ShutdownMusic(void); 91 | // Volume. 92 | void I_SetMusicVolume(int volume); 93 | // PAUSE game handling. 94 | void I_PauseSong(int handle); 95 | void I_ResumeSong(int handle); 96 | // Registers a song handle to song data. 97 | int I_RegisterSong(musicinfo_t* music, const char * lumpname); 98 | // Called by anything that wishes to start music. 99 | // plays a song, and when the song is done, 100 | // starts playing it again in an endless loop. 101 | // Horrible thing to do, considering. 102 | void 103 | I_PlaySong 104 | ( int handle, 105 | int looping ); 106 | // Stops a song over 3 seconds. 107 | void I_StopSong(int handle); 108 | // See above (register), then think backwards 109 | void I_UnRegisterSong(int handle); 110 | 111 | int I_QrySongPlaying(int handle); 112 | void I_FillMusBuffer(int handle); 113 | 114 | 115 | #endif 116 | //----------------------------------------------------------------------------- 117 | // 118 | // $Log:$ 119 | // 120 | //----------------------------------------------------------------------------- 121 | -------------------------------------------------------------------------------- /Source/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 wadfilelist_s 36 | { 37 | const char * filename; 38 | struct wadfilelist_s * next; 39 | } wadfilelist_t; 40 | 41 | 42 | typedef struct 43 | { 44 | // Should be "IWAD" or "PWAD". 45 | char identification[4]; 46 | int numlumps; 47 | int infotableofs; 48 | 49 | } wadinfo_t; 50 | 51 | 52 | typedef struct 53 | { 54 | int filepos; 55 | int size; 56 | char name[8]; 57 | 58 | } filelump_t; 59 | 60 | // 61 | // WADFILE I/O related stuff. 62 | // 63 | typedef struct 64 | { 65 | char name[8]; 66 | FILE* handle; 67 | int position; 68 | int size; 69 | void* cache; 70 | } lumpinfo_t; 71 | 72 | extern lumpinfo_t* lumpinfo; 73 | extern int numlumps; 74 | 75 | void W_InitMultipleFiles (wadfilelist_t * filenames); 76 | void W_Reload (void); 77 | 78 | void W_QuicksortLumps (int from, int to); 79 | void W_RemoveDuplicates (void); 80 | int W_CheckNumForNameBounded (const char * start, const char * end, char * name); 81 | int W_CheckNumForNameLinear (const char* name); 82 | int W_CheckNumForName (const char* name); 83 | int W_GetNumForName (const char* name); 84 | int W_NextLumpNumForName (const char* name, int startlump); 85 | int W_Strcmp_8 (const char * name1, const char * name2); 86 | 87 | char * strupr (char * name); 88 | unsigned int filesize (const char * path); 89 | 90 | unsigned int W_LumpLength (int lump); 91 | void W_ReadLump (int lump, void *dest); 92 | 93 | void* W_CacheLumpNum (int lump, int tag); 94 | void* W_CacheLumpName (const char* name, int tag); 95 | void* W_CacheLumpName0 (const char* name, int tag); 96 | extern unsigned int W_LumpNameHash(const char *s); 97 | void W_ReleaseLumpNum (unsigned int lumpnum); 98 | int W_SameWadfile (int lump1, int lump2); 99 | void W_Find_Start_Ends (void); 100 | 101 | #ifdef BOOM 102 | 103 | typedef struct prelumpinfo_t { 104 | char name[8]; 105 | int size; 106 | const void *data; 107 | } prelumpinfo_t; 108 | 109 | extern const prelumpinfo_t predefined_lumps[]; 110 | extern const int num_predefined_lumps; 111 | 112 | #endif 113 | 114 | 115 | 116 | #endif 117 | //----------------------------------------------------------------------------- 118 | // 119 | // $Log:$ 120 | // 121 | //----------------------------------------------------------------------------- 122 | -------------------------------------------------------------------------------- /Source/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 int dc_ylim; 37 | extern fixed_t dc_iscale; 38 | extern fixed_t dc_texturemid; 39 | extern fixed_t dc_texturefrac; 40 | 41 | // first pixel in a column 42 | extern byte* dc_source; 43 | 44 | 45 | // The span blitting interface. 46 | // Hook in assembler or system specific BLT 47 | // here. 48 | fixed_t R_CalcFrac (void); 49 | void R_DrawColumn (void); 50 | void R_DrawColumnLow (void); 51 | 52 | // The Spectre/Invisibility effect. 53 | void R_DrawFuzzColumn (void); 54 | void R_DrawFuzzColumnLow (void); 55 | 56 | void R_DrawTranslucentColumn (void); 57 | void R_DrawTranslatedTranslucentColumn (void); 58 | void R_DrawTranslucent50Column (void); 59 | 60 | // Draw with color translation tables, 61 | // for player sprite rendering, 62 | // Green/Red/Blue/Indigo shirts. 63 | void R_DrawTranslatedColumn (void); 64 | void R_DrawTranslatedColumnLow (void); 65 | 66 | void 67 | R_VideoErase 68 | ( unsigned ofs, 69 | int count ); 70 | 71 | extern int ds_y; 72 | extern int ds_x1; 73 | extern int ds_x2; 74 | 75 | extern lighttable_t* ds_colormap; 76 | 77 | extern fixed_t ds_xfrac; 78 | extern fixed_t ds_yfrac; 79 | extern fixed_t ds_xstep; 80 | extern fixed_t ds_ystep; 81 | 82 | // start of a 64*64 tile image 83 | extern byte* ds_source; 84 | 85 | extern byte* translationtables; 86 | extern byte* dc_translation; 87 | 88 | 89 | // Span blitting for rows, floor/ceiling. 90 | // No Sepctre effect needed. 91 | void R_DrawSpan (void); 92 | 93 | // Low resolution mode, 160x200? 94 | void R_DrawSpanLow (void); 95 | 96 | 97 | void 98 | R_InitBuffer 99 | ( int width, 100 | int height ); 101 | 102 | 103 | // Initialize color translation tables, 104 | // for player rendering etc. 105 | void R_InitTranslationTables (void); 106 | void R_InitTranslucencyTables (void); 107 | 108 | 109 | // Rendering function. 110 | void R_FillBackScreen (void); 111 | 112 | // If the view size is not full screen, draws a border around it. 113 | void R_DrawViewBorder (void); 114 | 115 | 116 | 117 | #endif 118 | //----------------------------------------------------------------------------- 119 | // 120 | // $Log:$ 121 | // 122 | //----------------------------------------------------------------------------- 123 | -------------------------------------------------------------------------------- /Source/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 | void F_DrawBackgroundFlat (const char * flat); 42 | void F_StartFinale (int always); 43 | 44 | typedef enum 45 | { 46 | e0text, 47 | e1text, 48 | e2text, 49 | e3text, 50 | e4text, 51 | e5text, 52 | e6text, 53 | e7text, 54 | e8text, 55 | e9text, 56 | c1text, 57 | c2text, 58 | c3text, 59 | c4text, 60 | c5text, 61 | c6text, 62 | c7text, 63 | c8text, 64 | c9text, 65 | p1text, 66 | p2text, 67 | p3text, 68 | p4text, 69 | p5text, 70 | p6text, 71 | p7text, 72 | p8text, 73 | p9text, 74 | t1text, 75 | t2text, 76 | t3text, 77 | t4text, 78 | t5text, 79 | t6text, 80 | t7text, 81 | t8text, 82 | t9text 83 | } finale_texts_t; 84 | 85 | typedef enum 86 | { 87 | BG_F_SKY1, 88 | BG_FLOOR4_8, 89 | BG_SFLR6_1, 90 | BG_MFLR8_4, 91 | BG_MFLR8_3, 92 | BG_SLIME16, 93 | BG_RROCK14, 94 | BG_RROCK07, 95 | BG_RROCK17, 96 | BG_RROCK13, 97 | BG_RROCK19, 98 | BG_BOSSBACK, 99 | BG_PFUB2, 100 | BG_PFUB1, 101 | BG_END0, 102 | BG_ENDI, 103 | BG_CREDIT, 104 | BG_HELP, 105 | BG_HELP1, 106 | BG_HELP2, 107 | BG_HELPxx, 108 | BG_VICTORY2, 109 | BG_TITLEPIC, 110 | BG_ENDPIC, 111 | BG_ENDPIC05, 112 | BG_ENDPIC06, 113 | BG_ENDPIC07, 114 | BG_ENDPIC08, 115 | BG_ENDPIC09, 116 | BG_ENDPIC10, 117 | BG_ENDPIC11, 118 | BG_ENDPIC12, 119 | BG_ENDPIC13, 120 | BG_ENDPIC14, 121 | BG_ENDPIC15, 122 | BG_ENDPIC16, 123 | BG_ENDPIC17, 124 | BG_ENDPIC18, 125 | BG_ENDPIC19, 126 | BG_ENDPICE 127 | } finale_floors_t; 128 | 129 | #define FINALE_MAX_ENDNUM ((BG_ENDPICE-BG_ENDPIC)+1+4) 130 | 131 | typedef struct clusterdefs_s 132 | { 133 | struct clusterdefs_s * next; 134 | unsigned int cnumber; 135 | char * entertext; 136 | char * normal_exittext; 137 | char * secret_exittext; 138 | char * flat; 139 | char * pic; 140 | char * music; 141 | } clusterdefs_t; 142 | 143 | clusterdefs_t * F_Access_ClusterDef (unsigned int num); 144 | clusterdefs_t * F_Create_ClusterDef (unsigned int num, char * default_flat); 145 | 146 | typedef struct castlist_s 147 | { 148 | struct castlist_s * next; 149 | char cast_name [1]; 150 | } castlist_t; 151 | 152 | #endif 153 | //----------------------------------------------------------------------------- 154 | // 155 | // $Log:$ 156 | // 157 | //----------------------------------------------------------------------------- 158 | -------------------------------------------------------------------------------- /Source/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 | typedef struct 44 | { 45 | texture_t * texture; 46 | fixed_t height; // for texture pegging 47 | int translation; // for global animation 48 | int pnames_lump; // Lump number of the PNAMES lump that references this texture. 49 | } texture_info_t; 50 | 51 | // needed for pre rendering (fracs) 52 | extern fixed_t* spritewidth; 53 | 54 | extern fixed_t* spriteoffset; 55 | extern fixed_t* spritetopoffset; 56 | 57 | /* Colourmap type fixed to byte by WAD! So use bytes, not lighttable_t */ 58 | #ifdef BOOM 59 | //extern byte** colormaps; 60 | extern lighttable_t* colormaps; 61 | extern byte* fullcolormap; 62 | extern int numcolormaps; 63 | #else 64 | //extern byte* colormaps; 65 | extern lighttable_t* colormaps; 66 | #endif 67 | 68 | extern int viewwidth; 69 | extern int scaledviewwidth; 70 | extern int viewheight; 71 | 72 | // for global animation 73 | extern int numtextures; 74 | extern texture_info_t * textures; 75 | 76 | // 77 | // Lookup tables for map data. 78 | // 79 | extern spritedef_t* sprites; 80 | 81 | extern unsigned int numvertexes; 82 | extern vertex_t* vertexes; 83 | 84 | extern unsigned int numsegs; 85 | extern seg_t* segs; 86 | 87 | extern unsigned int numsectors; 88 | extern sector_t* sectors; 89 | 90 | extern unsigned int numsubsectors; 91 | extern subsector_t* subsectors; 92 | 93 | extern unsigned int numnodes; 94 | extern node_t* nodes; 95 | 96 | extern unsigned int numlines; 97 | extern line_t* lines; 98 | 99 | extern unsigned int numsides; 100 | extern side_t* sides; 101 | 102 | 103 | // 104 | // POV data. 105 | // 106 | extern fixed_t viewx; 107 | extern fixed_t viewy; 108 | extern fixed_t viewz; 109 | 110 | extern angle_t viewangle; 111 | extern player_t* viewplayer; 112 | 113 | 114 | // ? 115 | extern angle_t clipangle; 116 | 117 | extern int viewangletox[FINEANGLES/2]; 118 | extern angle_t* xtoviewangle; 119 | //extern fixed_t finetangent[FINEANGLES/2]; 120 | 121 | extern angle_t rw_normalangle; 122 | 123 | 124 | 125 | // Segs count? 126 | extern int sscount; 127 | 128 | extern visplane_t* floorplane; 129 | extern visplane_t* ceilingplane; 130 | 131 | 132 | #endif 133 | //----------------------------------------------------------------------------- 134 | // 135 | // $Log:$ 136 | // 137 | //----------------------------------------------------------------------------- 138 | -------------------------------------------------------------------------------- /Source/tables.h: -------------------------------------------------------------------------------- 1 | // Emacs style mode select -*- C++ -*- 2 | //----------------------------------------------------------------------------- 3 | // 4 | // $Id:$ 5 | // 6 | // Copyright (C) 1993-1996 by id Software, Inc. 7 | // 8 | // This source is available for distribution and/or modification 9 | // only under the terms of the DOOM Source Code License as 10 | // published by id Software. All rights reserved. 11 | // 12 | // The source is distributed in the hope that it will be useful, 13 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | // FITNESS FOR A PARTICULAR PURPOSE. See the DOOM Source Code License 15 | // for more details. 16 | // 17 | // DESCRIPTION: 18 | // Lookup tables. 19 | // Do not try to look them up :-). 20 | // In the order of appearance: 21 | // 22 | // int finetangent[4096] - Tangens LUT. 23 | // Should work with BAM fairly well (12 of 16bit, 24 | // effectively, by shifting). 25 | // 26 | // int finesine[10240] - Sine lookup. 27 | // Guess what, serves as cosine, too. 28 | // Remarkable thing is, how to use BAMs with this? 29 | // 30 | // int tantoangle[2049] - ArcTan LUT, 31 | // maps tan(angle) to angle fast. Gotta search. 32 | // 33 | //----------------------------------------------------------------------------- 34 | 35 | 36 | #ifndef __TABLES__ 37 | #define __TABLES__ 38 | 39 | 40 | 41 | #ifdef LINUX 42 | #include 43 | #else 44 | #define PI 3.141592657 45 | #endif 46 | 47 | 48 | #include "m_fixed.h" 49 | 50 | #define FINEANGLES 8192 51 | #define FINEMASK (FINEANGLES-1) 52 | 53 | 54 | // 0x100000000 to 0x2000 55 | #define ANGLETOFINESHIFT 19 56 | 57 | // Effective size is 10240. 58 | extern const fixed_t finesine[5*FINEANGLES/4]; 59 | 60 | // Re-use data, is just PI/2 phase shift. 61 | extern const fixed_t* finecosine; 62 | 63 | 64 | // Effective size is 4096. 65 | extern const fixed_t finetangent[FINEANGLES/2]; 66 | 67 | // Binary Angle Measument, BAM. 68 | #define ANG1 (ANG45 / 45) 69 | #define ANG5 (ANG90 / 18) 70 | #define ANG45 0x20000000 71 | #define ANG90 0x40000000 72 | #define ANG180 0x80000000 73 | #define ANG270 0xc0000000 74 | #define ANGLE_MAX 0xFFFFFFFF 75 | 76 | 77 | #define SLOPERANGE 2048 78 | #define SLOPEBITS 11 79 | #define DBITS (FRACBITS-SLOPEBITS) 80 | 81 | typedef unsigned angle_t; 82 | 83 | 84 | // Effective size is 2049; 85 | // The +1 size is to handle the case when x==y 86 | // without additional checking. 87 | extern const angle_t tantoangle[SLOPERANGE+1]; 88 | 89 | // MBF21: More utility functions, courtesy of Quasar (James Haley). 90 | // These are straight from Eternity so demos stay in sync. 91 | static inline angle_t FixedToAngle(fixed_t a) 92 | { 93 | return (angle_t)(((uint64_t)a * ANG1) >> FRACBITS); 94 | } 95 | 96 | static inline fixed_t AngleToFixed(angle_t a) 97 | { 98 | return (fixed_t)(((uint64_t)a << FRACBITS) / ANG1); 99 | } 100 | 101 | // [XA] Clamped angle->slope, for convenience 102 | static inline fixed_t AngleToSlope(int a) 103 | { 104 | return finetangent[(a > ANG90 ? 0 : (-a > ANG90 ? FINEANGLES / 2 - 1 : (ANG90 - a) >> ANGLETOFINESHIFT))]; 105 | } 106 | 107 | // [XA] Ditto, using fixed-point-degrees input 108 | static inline fixed_t DegToSlope(fixed_t a) 109 | { 110 | return AngleToSlope(a >= 0 ? FixedToAngle(a) : -(int)FixedToAngle(-a)); 111 | } 112 | 113 | #endif 114 | //----------------------------------------------------------------------------- 115 | // 116 | // $Log:$ 117 | // 118 | //----------------------------------------------------------------------------- 119 | -------------------------------------------------------------------------------- /Source/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 | #if 0 25 | static const char rcsid[] = "$Id: m_random.c,v 1.1 1997/02/03 22:45:11 b1 Exp $"; 26 | #endif 27 | 28 | #include "includes.h" 29 | // 30 | // M_Random 31 | // Returns a 0-255 number 32 | // 33 | static const unsigned char rndtable [] = 34 | { 35 | 0, 8, 109, 220, 222, 241, 149, 107, 75, 248, 254, 140, 16, 66, 36 | 74, 21, 211, 47, 80, 242, 154, 27, 205, 128, 161, 89, 77, 36, 37 | 95, 110, 85, 48, 212, 140, 211, 249, 22, 79, 200, 50, 28, 188, 38 | 52, 140, 202, 120, 68, 145, 62, 70, 184, 190, 91, 197, 152, 224, 39 | 149, 104, 25, 178, 252, 182, 202, 182, 141, 197, 4, 81, 181, 242, 40 | 145, 42, 39, 227, 156, 198, 225, 193, 219, 93, 122, 175, 249, 0, 41 | 175, 143, 70, 239, 46, 246, 163, 53, 163, 109, 168, 135, 2, 235, 42 | 25, 92, 20, 145, 138, 77, 69, 166, 78, 176, 173, 212, 166, 113, 43 | 94, 161, 41, 50, 239, 49, 111, 164, 70, 60, 2, 37, 171, 75, 44 | 136, 156, 11, 56, 42, 146, 138, 229, 73, 146, 77, 61, 98, 196, 45 | 135, 106, 63, 197, 195, 86, 96, 203, 113, 101, 170, 247, 181, 113, 46 | 80, 250, 108, 7, 255, 237, 129, 226, 79, 107, 112, 166, 103, 241, 47 | 24, 223, 239, 120, 198, 58, 60, 82, 128, 3, 184, 66, 143, 224, 48 | 145, 224, 81, 206, 163, 45, 63, 90, 168, 114, 59, 33, 159, 95, 49 | 28, 139, 123, 98, 125, 196, 15, 70, 194, 253, 54, 14, 109, 226, 50 | 71, 17, 161, 93, 186, 87, 244, 138, 20, 52, 123, 251, 26, 36, 51 | 17, 46, 52, 231, 232, 76, 31, 221, 84, 37, 216, 165, 212, 106, 52 | 197, 242, 98, 43, 39, 175, 254, 145, 190, 84, 118, 222, 187, 136, 53 | 120, 163, 236, 249 54 | }; 55 | 56 | int rndindex = 0; 57 | static int prndindex = 0; 58 | 59 | // Which one is deterministic? 60 | int P_Random (void) 61 | { 62 | prndindex = (prndindex+1)&0xff; 63 | return rndtable[prndindex]; 64 | } 65 | 66 | int M_Random (void) 67 | { 68 | rndindex = (rndindex+1)&0xff; 69 | return rndtable[rndindex]; 70 | } 71 | 72 | int M_SubRandom (void) 73 | { 74 | int r = M_Random(); 75 | return (r - M_Random()); 76 | } 77 | 78 | void M_ClearRandom (void) 79 | { 80 | rndindex = prndindex = 0; 81 | } 82 | 83 | // MBF21: [XA] Common random formulas used by codepointers 84 | 85 | // 86 | // P_RandomHitscanAngle 87 | // Outputs a random angle between (-spread, spread), as an int ('cause it can be negative). 88 | // spread: Maximum angle (degrees, in fixed point -- not BAM!) 89 | // 90 | int P_RandomHitscanAngle(fixed_t spread) 91 | { 92 | return (int)(((int64_t)(spread < 0 ? FixedToAngle(-spread) : FixedToAngle(spread)) * M_SubRandom()) / 255); 93 | } 94 | 95 | // 96 | // P_RandomHitscanSlope 97 | // Outputs a random angle between (-spread, spread), converted to values used for slope 98 | // spread: Maximum vertical angle (degrees, in fixed point -- not BAM!) 99 | // 100 | int P_RandomHitscanSlope(fixed_t spread) 101 | { 102 | int angle = P_RandomHitscanAngle(spread); 103 | 104 | return finetangent[(angle > ANG90 ? 0 : (-angle > ANG90 ? FINEANGLES / 2 - 1 : (ANG90 - angle) >> ANGLETOFINESHIFT))]; 105 | } 106 | 107 | -------------------------------------------------------------------------------- /Source/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 | -------------------------------------------------------------------------------- /Source/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 | #if 0 26 | static const char rcsid[] = "$Id: f_wipe.c,v 1.2 1997/02/03 22:45:09 b1 Exp $"; 27 | #endif 28 | 29 | #include "includes.h" 30 | 31 | //----------------------------------------------------------------------------- 32 | // 33 | // SCREEN WIPE PACKAGE 34 | // 35 | 36 | static unsigned int * ptrs = NULL; 37 | 38 | #define wipe_scr_start screens[2] 39 | #define wipe_scr_end screens[3] 40 | 41 | //----------------------------------------------------------------------------- 42 | 43 | static void wipe_Init (void) 44 | { 45 | if (ptrs == NULL) 46 | { 47 | ptrs = Z_Malloc (SCREENWIDTH*sizeof(int), PU_STATIC, NULL); 48 | memset (ptrs, 0, SCREENWIDTH*sizeof(int)); 49 | } 50 | } 51 | 52 | //----------------------------------------------------------------------------- 53 | 54 | static void wipe_Finish (void) 55 | { 56 | if (ptrs) 57 | { 58 | Z_Free (ptrs); 59 | ptrs = NULL; 60 | } 61 | } 62 | 63 | //----------------------------------------------------------------------------- 64 | 65 | int wipe_StartScreen (void) 66 | { 67 | I_ReadScreen (wipe_scr_start); 68 | return 0; 69 | } 70 | 71 | //----------------------------------------------------------------------------- 72 | 73 | int wipe_EndScreen (void) 74 | { 75 | I_ReadScreen (wipe_scr_end); 76 | V_DrawBlock (0, 0, 0, SCREENWIDTH, SCREENHEIGHT, wipe_scr_start); // restore start scr. 77 | wipe_Init (); 78 | return 0; 79 | } 80 | 81 | //----------------------------------------------------------------------------- 82 | 83 | static void wipe_CopyColumn (unsigned int x, unsigned int y, unsigned int pos) 84 | { 85 | byte * dest; 86 | byte * source; 87 | unsigned int qty; 88 | 89 | dest = screens[0] + (y * SCREENWIDTH) + x; 90 | 91 | if (pos) 92 | { 93 | qty = pos; 94 | source = wipe_scr_end + (y * SCREENWIDTH) + x; 95 | do 96 | { 97 | *dest = *source; 98 | dest += SCREENWIDTH; 99 | source += SCREENWIDTH; 100 | } while (--qty); 101 | } 102 | 103 | qty = SCREENHEIGHT - (y + pos); 104 | if (qty) 105 | { 106 | source = wipe_scr_start + x; 107 | do 108 | { 109 | *dest = *source; 110 | dest += SCREENWIDTH; 111 | source += SCREENWIDTH; 112 | } while (--qty); 113 | } 114 | } 115 | 116 | //----------------------------------------------------------------------------- 117 | 118 | boolean wipe_ScreenWipe (int ticks) 119 | { 120 | unsigned int m; 121 | unsigned int q; 122 | unsigned int r; 123 | unsigned int x; 124 | unsigned int y; 125 | unsigned int qty; 126 | unsigned int * p; 127 | 128 | p = ptrs; 129 | qty = 0; 130 | x = 0; 131 | q = 10; 132 | m = 3; 133 | if (SCREENWIDTH > 800) 134 | m = 7; 135 | do 136 | { 137 | y = *p; 138 | if (y < SCREENHEIGHT) 139 | { 140 | if ((x & m) == 0) 141 | { 142 | if (rand() & 1) 143 | { 144 | if (q < 14) 145 | q += 1; 146 | } 147 | else 148 | { 149 | if (q > 6) 150 | q -= 1; 151 | } 152 | } 153 | r = q * ticks; 154 | if ((y + r) >= SCREENHEIGHT) 155 | r = SCREENHEIGHT - y; 156 | *p = y + r; 157 | wipe_CopyColumn (x, y, r); 158 | qty++; 159 | } 160 | p++; 161 | } while (++x < SCREENWIDTH); 162 | 163 | if (qty == 0) 164 | { 165 | wipe_Finish (); 166 | return (true); 167 | } 168 | 169 | return (false); 170 | } 171 | 172 | //----------------------------------------------------------------------------- 173 | -------------------------------------------------------------------------------- /Source/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 | #if 0 26 | static const char rcsid[] = "$Id: p_tick.c,v 1.4 1997/02/03 16:47:55 b1 Exp $"; 27 | #endif 28 | 29 | #include "includes.h" 30 | 31 | //----------------------------------------------------------------------------- 32 | 33 | int leveltime; 34 | 35 | // 36 | // THINKERS 37 | // All thinkers should be allocated by Z_Malloc 38 | // so they can be operated on uniformly. 39 | // The actual structures will vary in size, 40 | // but the first element must be thinker_t. 41 | // 42 | 43 | 44 | 45 | // Both the head and tail of the thinker list. 46 | thinker_t * thinker_head; 47 | static thinker_t * thinker_tail; 48 | 49 | //----------------------------------------------------------------------------- 50 | // 51 | // P_InitThinkers 52 | // 53 | void P_InitThinkers (void) 54 | { 55 | thinker_head = thinker_tail = NULL; 56 | } 57 | 58 | //----------------------------------------------------------------------------- 59 | // 60 | // P_AddThinker 61 | // Adds a new thinker at the end of the list. 62 | // 63 | void P_AddThinker (thinker_t* thinker, actionf_p1 func) 64 | { 65 | if (thinker_head == NULL) 66 | thinker_head = thinker; 67 | else 68 | thinker_tail -> next = thinker; 69 | 70 | thinker_tail = thinker; 71 | 72 | thinker -> next = NULL; 73 | thinker -> function.acp1 = func; 74 | } 75 | 76 | //----------------------------------------------------------------------------- 77 | // 78 | // P_RemoveThinker 79 | // Deallocation is lazy -- it will not actually be freed 80 | // until its thinking turn comes up. 81 | // 82 | 83 | void P_RemoveThinker (thinker_t* thinker) 84 | { 85 | // FIXME: NOP. 86 | thinker->function.aci = -1; 87 | } 88 | 89 | //----------------------------------------------------------------------------- 90 | // 91 | // P_RunThinkers 92 | // 93 | static void P_RunThinkers (void) 94 | { 95 | thinker_t* lastthinker; 96 | thinker_t* currentthinker; 97 | thinker_t** prevptr; 98 | 99 | prevptr = &thinker_head; 100 | lastthinker = NULL; 101 | 102 | while ((currentthinker = *prevptr) != NULL) 103 | { 104 | if (currentthinker->function.aci == -1) 105 | { 106 | /* time to remove it*/ 107 | if ((*prevptr = currentthinker->next) == NULL) // Released the last block? 108 | { 109 | thinker_tail = lastthinker; 110 | // printf ("Last thinker %X %X\n", prevptr, lastthinker); 111 | } 112 | Z_Free (currentthinker); 113 | } 114 | else 115 | { 116 | if (currentthinker->function.acp1) 117 | currentthinker->function.acp1 (currentthinker); 118 | lastthinker = currentthinker; 119 | prevptr = ¤tthinker -> next; 120 | } 121 | } 122 | } 123 | 124 | //----------------------------------------------------------------------------- 125 | // 126 | // P_Ticker 127 | // 128 | 129 | void P_Ticker (void) 130 | { 131 | int i; 132 | 133 | // run the tic 134 | if (paused) 135 | return; 136 | 137 | // pause if in menu and at least one tic has been run 138 | if ( !netgame 139 | && menuactive 140 | && !demoplayback 141 | && players[consoleplayer].viewz != 1) 142 | { 143 | return; 144 | } 145 | 146 | 147 | for (i=0 ; i start_pos) 155 | { 156 | do 157 | { 158 | // printf ("M_CheckParm %s %s\n", check, myargv[i]); 159 | if (strcasecmp(check, myargv[start_pos]) == 0) 160 | return (start_pos); 161 | } while (++start_pos < myargc); 162 | } 163 | return (0); 164 | } 165 | 166 | /* ---------------------------------------------------------------------------- */ 167 | #ifndef M_CheckParm 168 | 169 | unsigned int M_CheckParm (const char *check) 170 | { 171 | return (M_CheckParm_N (check, 1); 172 | } 173 | 174 | #endif 175 | /* ---------------------------------------------------------------------------- */ 176 | -------------------------------------------------------------------------------- /Source/maths64.c: -------------------------------------------------------------------------------- 1 | /* --------------------------------------------------------------------------------- */ 2 | /* 3 | When using StubsG, the 64 bit maths functions are not available 4 | so we link this file instead. 5 | */ 6 | 7 | 8 | #include 9 | #include 10 | #include 11 | #ifdef __riscos 12 | #include 13 | #endif 14 | 15 | /* --------------------------------------------------------------------------------- */ 16 | 17 | static uint64_t multiply_64 (uint32_t p1, uint32_t p2) 18 | { 19 | uint32_t answer_1; 20 | uint32_t answer_2; 21 | uint32_t answer_3; 22 | uint32_t answer_4; 23 | uint64_t answer; 24 | 25 | answer_1 = (p1 & 0xFFFF) * (p2 & 0xFFFF); 26 | answer_2 = (p1 & 0xFFFF) * (p2 >> 16); 27 | answer_3 = (p1 >> 16) * (p2 & 0xFFFF); 28 | answer_4 = (p1 >> 16) * (p2 >> 16); 29 | 30 | answer = ((uint64_t)answer_4 << 32) + answer_1; 31 | answer += (uint64_t)answer_2 << 16; 32 | answer += (uint64_t)answer_3 << 16; 33 | 34 | #ifdef DEBUG 35 | fprintf (stderr, "multiply_16 called with p1 = %d, p2 = %d\n", p1, p2); 36 | fprintf (stderr, "p1 = %X, p2 = %X, a1 = %X, a2 = %X, a3 = %X, a4 = %X, ah = %X, al = %X\n", p1, p2, answer_1, answer_2, answer_3, answer_4, answer[0], answer[1]); 37 | #endif 38 | return (answer); 39 | } 40 | 41 | /* --------------------------------------------------------------------------------- */ 42 | 43 | int64_t _ll_mulss (int32_t a, int32_t b) 44 | { 45 | unsigned int negatives; 46 | int64_t answer; 47 | 48 | // printf ("_ll_mulss %d %d", a,b); 49 | 50 | negatives = 0; 51 | if (a < 0) 52 | { 53 | a = -a; 54 | negatives++; 55 | } 56 | if (b < 0) 57 | { 58 | b = -b; 59 | negatives++; 60 | } 61 | 62 | answer = multiply_64 (a,b); 63 | if (negatives & 1) 64 | answer = -answer; 65 | 66 | // printf (" = %lld\n", answer); 67 | return (answer); 68 | } 69 | 70 | /* --------------------------------------------------------------------------------- */ 71 | 72 | static uint64_t div64_32 (uint64_t rem, uint32_t base) 73 | { 74 | uint64_t b; 75 | uint64_t d; 76 | uint64_t res; 77 | uint32_t high; 78 | 79 | if (base == 0) 80 | return (~0); 81 | 82 | b = base; 83 | d = 1; 84 | high = (uint32_t) (rem >> 32); 85 | res = 0; 86 | 87 | /* Reduce the thing a bit first */ 88 | if (high >= base) 89 | { 90 | high /= base; 91 | res = (uint64_t) high << 32; 92 | rem -= (uint64_t) (high*base) << 32; 93 | } 94 | 95 | while ((int64_t)b > 0 && b < rem) 96 | { 97 | b = b+b; 98 | d = d+d; 99 | } 100 | 101 | do 102 | { 103 | if (rem >= b) 104 | { 105 | rem -= b; 106 | res += d; 107 | } 108 | b >>= 1; 109 | d >>= 1; 110 | } while (d); 111 | 112 | return (res); 113 | } 114 | 115 | /* --------------------------------------------------------------------------------- */ 116 | 117 | int64_t _ll_sdiv (int64_t a, int64_t b) 118 | { 119 | unsigned int negatives; 120 | int64_t answer; 121 | 122 | // printf ("_ll_sdiv %lld %d\n", a,b); 123 | 124 | negatives = 0; 125 | if (a < 0) 126 | { 127 | a = -a; 128 | negatives++; 129 | } 130 | if (b < 0) 131 | { 132 | b = -b; 133 | negatives++; 134 | } 135 | 136 | if ((uint64_t) b > 0xFFFFFFFF) 137 | { 138 | /* Bodge it to make it fit! */ 139 | do 140 | { 141 | a = (uint64_t) a >> 1; 142 | b = (uint64_t) b >> 1; 143 | } while ((uint64_t) b > 0xFFFFFFFF); 144 | } 145 | 146 | answer = div64_32 (a, (uint32_t) b); 147 | 148 | if (negatives & 1) 149 | answer = -answer; 150 | 151 | return (answer); 152 | } 153 | 154 | /* --------------------------------------------------------------------------------- */ 155 | 156 | int64_t _ll_srdv (int64_t b, int64_t a) 157 | { 158 | return (_ll_sdiv (a, b)); 159 | } 160 | 161 | /* --------------------------------------------------------------------------------- */ 162 | 163 | uint64_t _ll_udiv (uint64_t a, uint64_t b) 164 | { 165 | uint64_t answer; 166 | 167 | // printf ("_ll_udiv %lld %d\n", a,b); 168 | 169 | if (b > 0xFFFFFFFF) 170 | { 171 | /* Bodge it to make it fit! */ 172 | do 173 | { 174 | a = a >> 1; 175 | b = b >> 1; 176 | } while (b > 0xFFFFFFFF); 177 | } 178 | 179 | answer = div64_32 (a, (uint32_t) b); 180 | return (answer); 181 | } 182 | 183 | /* --------------------------------------------------------------------------------- */ 184 | 185 | #ifdef MATHS_64_TESTING 186 | 187 | /* --------------------------------------------------------------------------------- */ 188 | 189 | int main (int argc, char * argv []) 190 | { 191 | int64_t ans; 192 | 193 | ans = _ll_sdiv (100000000, 8); 194 | printf ("ans = %lld\n", ans); 195 | } 196 | 197 | #endif 198 | 199 | -------------------------------------------------------------------------------- /Source/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 | extern int setsizeneeded; 61 | 62 | // 63 | // Lighting LUT. 64 | // Used for z-depth cuing per column/row, 65 | // and other lighting effects (sector ambient, flash). 66 | // 67 | 68 | // Lighting constants. 69 | // Now why not 32 levels here? 70 | #ifndef MORELIGHTLEVELS 71 | #define LIGHTLEVELS 16 72 | #define LIGHTSEGSHIFT 4 73 | #define LIGHTBRIGHT 1 74 | #define WFLASHBRIGHT 1 75 | 76 | #define MAXLIGHTSCALE 48 77 | #define LIGHTSCALESHIFT 12 78 | #define MAXLIGHTZ 128 79 | #define LIGHTZSHIFT 20 80 | 81 | // Number of diminishing brightness levels. 82 | // There a 0-31, i.e. 32 LUT in the COLORMAP lump. 83 | #define NUMCOLORMAPS 32 84 | 85 | #else 86 | 87 | #define LIGHTLEVELS 128 88 | #define LIGHTSEGSHIFT 1 89 | #define LIGHTBRIGHT 1 90 | #define WFLASHBRIGHT 1 91 | 92 | #define MAXLIGHTSCALE 0x180 93 | #define LIGHTSCALESHIFT 12 94 | #define MAXLIGHTZ 1024 95 | #define LIGHTZSHIFT 17 96 | 97 | // Number of diminishing brightness levels. 98 | // There a 0-31, i.e. 32 LUT in the COLORMAP lump. 99 | #define NUMCOLORMAPS 128 100 | 101 | #endif 102 | 103 | extern lighttable_t* scalelight[LIGHTLEVELS][MAXLIGHTSCALE]; 104 | extern lighttable_t* scalelightfixed[MAXLIGHTSCALE]; 105 | extern lighttable_t* zlight[LIGHTLEVELS][MAXLIGHTZ]; 106 | 107 | extern int extralight; 108 | extern int lightScaleShift; 109 | extern lighttable_t* fixedcolormap; 110 | 111 | 112 | 113 | // Blocky/low detail mode. 114 | //B remove this? 115 | // 0 = high, 1 = low 116 | extern int detailshift; 117 | 118 | 119 | // 120 | // Function pointers to switch refresh/drawing functions. 121 | // Used to select shadow mode etc. 122 | // 123 | extern void (*colfunc) (void); 124 | extern void (*basecolfunc) (void); 125 | extern void (*fuzzcolfunc) (void); 126 | // No shadow effects on floors. 127 | extern void (*spanfunc) (void); 128 | 129 | 130 | // 131 | // Utility functions. 132 | int 133 | R_PointOnSide 134 | ( fixed_t x, 135 | fixed_t y, 136 | node_t* node ); 137 | 138 | int 139 | R_PointOnSegSide 140 | ( fixed_t x, 141 | fixed_t y, 142 | seg_t* line ); 143 | 144 | 145 | angle_t R_PointToAngle (fixed_t x, fixed_t y); 146 | angle_t R_PointToAngle2 (fixed_t x1, fixed_t y1, fixed_t x, fixed_t y); 147 | angle_t R_PointToAngleEx (fixed_t x, fixed_t y); 148 | angle_t R_PointToAngleEx2 (fixed_t x1, fixed_t y1, fixed_t x, fixed_t y); 149 | 150 | 151 | fixed_t 152 | R_PointToDist 153 | ( fixed_t x, 154 | fixed_t y ); 155 | 156 | 157 | subsector_t* 158 | R_PointInSubsector 159 | ( fixed_t x, 160 | fixed_t y ); 161 | 162 | void 163 | R_AddPointToBox 164 | ( int x, 165 | int y, 166 | fixed_t* box ); 167 | 168 | 169 | angle_t R_GetVertexViewAngle (vertex_t *v); 170 | 171 | // 172 | // REFRESH - the actual rendering functions. 173 | // 174 | 175 | // Called by G_Drawer. 176 | void R_RenderPlayerView (player_t *player); 177 | 178 | // Called by startup code. 179 | void R_Init (void); 180 | 181 | // Called by M_Responder. 182 | void R_SetViewSize (int flag, int blocks, int detail); 183 | void R_ExecuteSetViewSize (void); 184 | 185 | void R_InitLightTables (void); 186 | 187 | #endif 188 | //----------------------------------------------------------------------------- 189 | // 190 | // $Log:$ 191 | // 192 | //----------------------------------------------------------------------------- 193 | -------------------------------------------------------------------------------- /Source/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 ST_BG 4 34 | #define ST_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 | void STlib_drawPatch 153 | ( int x, 154 | int y, 155 | int scrn, 156 | patch_t* patch ); 157 | 158 | 159 | // Number widget routines 160 | void 161 | STlib_initNum 162 | ( st_number_t* n, 163 | int x, 164 | int y, 165 | patch_t** pl, 166 | int* num, 167 | boolean* on, 168 | int width ); 169 | 170 | void 171 | STlib_updateNum 172 | ( st_number_t* n, 173 | boolean refresh ); 174 | 175 | 176 | // Percent widget routines 177 | void 178 | STlib_initPercent 179 | ( st_percent_t* p, 180 | int x, 181 | int y, 182 | patch_t** pl, 183 | int* num, 184 | boolean* on, 185 | patch_t* percent ); 186 | 187 | 188 | void 189 | STlib_updatePercent 190 | ( st_percent_t* per, 191 | boolean refresh ); 192 | 193 | 194 | // Multiple Icon widget routines 195 | void 196 | STlib_initMultIcon 197 | ( st_multicon_t* mi, 198 | int x, 199 | int y, 200 | patch_t** il, 201 | int* inum, 202 | boolean* on ); 203 | 204 | 205 | void 206 | STlib_updateMultIcon 207 | ( st_multicon_t* mi, 208 | boolean refresh ); 209 | 210 | // Binary Icon widget routines 211 | 212 | void 213 | STlib_initBinIcon 214 | ( st_binicon_t* b, 215 | int x, 216 | int y, 217 | patch_t* i, 218 | boolean* val, 219 | boolean* on ); 220 | 221 | void 222 | STlib_updateBinIcon 223 | ( st_binicon_t* bi, 224 | boolean refresh ); 225 | 226 | #endif 227 | //----------------------------------------------------------------------------- 228 | // 229 | // $Log:$ 230 | // 231 | //----------------------------------------------------------------------------- 232 | -------------------------------------------------------------------------------- /Source/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 HU_BG 1 31 | #define HU_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 | unsigned int HUlib_Kern (char this_one, char next_one); 106 | 107 | // clear a line of text 108 | void HUlib_clearTextLine(hu_textline_t *t); 109 | 110 | void HUlib_initTextLine(hu_textline_t *t, int x, int y, patch_t **f, int sc); 111 | 112 | // returns success 113 | boolean HUlib_addCharToTextLine(hu_textline_t *t, char ch); 114 | 115 | // returns success 116 | boolean HUlib_delCharFromTextLine(hu_textline_t *t); 117 | 118 | // draws tline 119 | void HUlib_drawTextLine(hu_textline_t *l, boolean drawcursor); 120 | 121 | // erases text line 122 | void HUlib_eraseTextLine(hu_textline_t *l); 123 | 124 | 125 | // 126 | // Scrolling Text window widget routines 127 | // 128 | 129 | // ? 130 | void 131 | HUlib_initSText 132 | ( hu_stext_t* s, 133 | int x, 134 | int y, 135 | int h, 136 | patch_t** font, 137 | int startchar, 138 | boolean* on ); 139 | 140 | // add a new line 141 | void HUlib_addLineToSText(hu_stext_t* s); 142 | 143 | // ? 144 | void 145 | HUlib_addMessageToSText 146 | ( hu_stext_t* s, 147 | char* prefix, 148 | char* msg ); 149 | 150 | // draws stext 151 | void HUlib_drawSText(hu_stext_t* s); 152 | 153 | // erases all stext lines 154 | void HUlib_eraseSText(hu_stext_t* s); 155 | 156 | // Input Text Line widget routines 157 | void 158 | HUlib_initIText 159 | ( hu_itext_t* it, 160 | int x, 161 | int y, 162 | patch_t** font, 163 | int startchar, 164 | boolean* on ); 165 | 166 | // enforces left margin 167 | void HUlib_delCharFromIText(hu_itext_t* it); 168 | 169 | // enforces left margin 170 | void HUlib_eraseLineFromIText(hu_itext_t* it); 171 | 172 | // resets line and left margin 173 | void HUlib_resetIText(hu_itext_t* it); 174 | 175 | // left of left-margin 176 | void 177 | HUlib_addPrefixToIText 178 | ( hu_itext_t* it, 179 | char* str ); 180 | 181 | // whether eaten 182 | boolean 183 | HUlib_keyInIText 184 | ( hu_itext_t* it, 185 | unsigned char ch ); 186 | 187 | void HUlib_drawIText(hu_itext_t* it); 188 | 189 | // erases all itext lines 190 | void HUlib_eraseIText(hu_itext_t* it); 191 | 192 | #endif 193 | //----------------------------------------------------------------------------- 194 | // 195 | // $Log:$ 196 | // 197 | //----------------------------------------------------------------------------- 198 | -------------------------------------------------------------------------------- /Source/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 | // Armour classes 81 | // 82 | typedef enum 83 | { 84 | NOARMOUR = 0, 85 | GREENARMOUR = 1, 86 | BLUEARMOUR = 2 87 | } armour_class_t; 88 | 89 | // 90 | // Extended player object info: player_t 91 | // 92 | typedef struct player_s 93 | { 94 | mobj_t* mo; 95 | playerstate_t playerstate; 96 | ticcmd_t cmd; 97 | 98 | // Determine POV, 99 | // including viewpoint bobbing during movement. 100 | // Focal origin above r.z 101 | fixed_t viewz; 102 | // Base height above floor for viewz. 103 | fixed_t viewheight; 104 | // Bob/squat speed. 105 | fixed_t deltaviewheight; 106 | // bounded/scaled total momentum. 107 | fixed_t bob; 108 | 109 | // This is only used between levels, 110 | // mo->health is used during levels. 111 | int health; 112 | int armourpoints; 113 | // Armour type is 0-2. 114 | armour_class_t armourtype; 115 | 116 | // Power ups. invinc and invis are tic counters. 117 | int powers[NUMPOWERS]; 118 | boolean cards[NUMCARDS]; 119 | boolean backpack; 120 | 121 | // Frags, kills of other players. 122 | int frags[MAXPLAYERS]; 123 | weapontype_t readyweapon; 124 | 125 | // Is wp_nochange if not changing. 126 | weapontype_t pendingweapon; 127 | 128 | boolean weaponowned[NUMWEAPONS]; 129 | int ammo[NUMAMMO]; 130 | int maxammo[NUMAMMO]; 131 | 132 | // True if button down last tic. 133 | int attackdown; 134 | int usedown; 135 | 136 | // Bit flags, for cheats and debug. 137 | // See cheat_t, above. 138 | int cheats; 139 | 140 | // Refired shots are less accurate. 141 | int refire; 142 | 143 | // For intermission stats. 144 | int killcount; 145 | int itemcount; 146 | int secretcount; 147 | 148 | // Hint messages. 149 | char* message; 150 | 151 | // For screen flashing (red or bright). 152 | int damagecount; 153 | int bonuscount; 154 | 155 | // Who did damage (NULL for floors/ceilings). 156 | mobj_t* attacker; 157 | 158 | // So gun flashes light up areas. 159 | int extralight; 160 | 161 | // Current PLAYPAL, ??? 162 | // can be set to REDCOLORMAP for pain, etc. 163 | int fixedcolormap; 164 | 165 | // Player skin colorshift, 166 | // 0-3 for which color to draw player. 167 | int colormap; 168 | 169 | // Overlay view sprites (gun, etc). 170 | pspdef_t psprites[NUMPSPRITES]; 171 | 172 | // True if secret level has been done. 173 | boolean didsecret; 174 | 175 | } player_t; 176 | 177 | 178 | // 179 | // INTERMISSION 180 | // Structure passed e.g. to WI_Start(wb) 181 | // 182 | typedef struct 183 | { 184 | boolean in; // whether the player is in game 185 | 186 | // Player stats, kills, collected items etc. 187 | int skills; 188 | int sitems; 189 | int ssecret; 190 | int stime; 191 | int frags[4]; 192 | int score; // current score on entry, modified on return 193 | 194 | } wbplayerstruct_t; 195 | 196 | typedef struct 197 | { 198 | int epsd; // episode # (0-2) 199 | 200 | // if true, splash the secret level 201 | boolean didsecret; 202 | 203 | // previous and next levels, origin 0 204 | int last; 205 | int next; 206 | 207 | int maxkills; 208 | int maxitems; 209 | int maxsecret; 210 | int maxfrags; 211 | 212 | // the par time 213 | int partime; 214 | int timesucks; 215 | 216 | // index of this player in game 217 | int pnum; 218 | 219 | int next_episode; 220 | int next_map; 221 | 222 | wbplayerstruct_t plyr[MAXPLAYERS]; 223 | 224 | } wbstartstruct_t; 225 | 226 | 227 | #endif 228 | //----------------------------------------------------------------------------- 229 | // 230 | // $Log:$ 231 | // 232 | //----------------------------------------------------------------------------- 233 | -------------------------------------------------------------------------------- /Source/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 | #include "info.h" 29 | 30 | 31 | typedef enum 32 | { 33 | GG_SAVEGAMENAME, 34 | GG_GGSAVED 35 | } save_g_msg_texts_t; 36 | 37 | // 38 | // GAME 39 | // 40 | 41 | #define QTY_EPISODES 4 // Episodes 1 - 4 42 | #define QTY_MAPS_PER_EPISODE 9 // Maps 1 - 9 43 | 44 | typedef struct 45 | { 46 | unsigned char normal_exit_to_episode; 47 | unsigned char normal_exit_to_map; 48 | unsigned char secret_exit_to_episode; 49 | unsigned char secret_exit_to_map; 50 | unsigned char this_is_a_secret_level; 51 | unsigned char reset_kit_etc_on_entering; 52 | unsigned char intermission_text; 53 | unsigned char cluster; 54 | unsigned char nointermission; 55 | unsigned char flags; // Bit 0 - allow_monster_telefrags 56 | // Bit 1 - no_sound_clipping 57 | unsigned char par_time_5; // Par time divided by 5 58 | unsigned char time_sucks; // Par time for sucks in minutes 59 | fixed_t skydelta; 60 | char * name; 61 | char * lumpname; 62 | char * sky; 63 | char * titlepatch; 64 | char * enterpic; 65 | char * exitpic; 66 | char * bordertexture; 67 | char * music; 68 | } map_dests_t; 69 | 70 | typedef struct extramaps_s 71 | { 72 | unsigned char episode; 73 | unsigned char map; 74 | map_dests_t mapdef; 75 | struct extramaps_s * next; 76 | } extramaps_t; 77 | 78 | typedef struct 79 | { 80 | unsigned char start_episode; 81 | unsigned char start_map; 82 | } map_starts_t; 83 | 84 | typedef struct item_to_drop_s 85 | { 86 | mobjtype_t just_died; 87 | mobjtype_t mt_spawn; 88 | struct item_to_drop_s * next; 89 | } item_to_drop_t; 90 | 91 | typedef struct 92 | { 93 | int right_1; // Default arrow keys 94 | int left_1; 95 | int up_1; 96 | int down_1; 97 | 98 | int right_2; // Default WASD 99 | int left_2; 100 | int up_2; 101 | int down_2; 102 | 103 | int strafeleft; 104 | int straferight; 105 | int fire; 106 | int use; 107 | int strafe; 108 | int speed; 109 | 110 | int always_run; 111 | int usemouse; 112 | int novert; 113 | int usejoystick; 114 | 115 | int mousebfire; 116 | int mousebstrafe; 117 | int mousebforward; 118 | 119 | int joybfire; 120 | int joybstrafe; 121 | int joybuse; 122 | int joybspeed; 123 | } keyb_t; 124 | 125 | extern boolean par_changed; 126 | extern boolean gamekeydown[NUMKEYS]; 127 | 128 | void G_DeathMatchSpawnPlayer (int playernum); 129 | 130 | void G_InitNew (skill_t skill, int episode, int map); 131 | 132 | // Can be called by the startup code or M_Responder. 133 | // A normal game starts at map 1, 134 | // but a warp test can start elsewhere 135 | void G_DeferedInitNew (skill_t skill, int episode, int map); 136 | void G_DeferedInitNewLater (skill_t skill, int episode, int map); 137 | 138 | void G_DeferedPlayDemo (char* demo); 139 | 140 | // Can be called by the startup code or M_Responder, 141 | // calls P_SetupLevel or W_EnterWorld. 142 | void G_LoadGame (char* name); 143 | 144 | void G_DoLoadGame (void); 145 | 146 | // Called by M_Responder. 147 | void G_SaveGame (int slot, char* description); 148 | void G_GetSaveGameName (char * name, int i); 149 | 150 | // Only called by startup code. 151 | void G_RecordDemo (char* name); 152 | 153 | void G_BeginRecording (void); 154 | 155 | void G_PlayDemo (char* name); 156 | void G_TimeDemo (char* name); 157 | boolean G_CheckDemoStatus (void); 158 | 159 | void G_ExitLevel (void); 160 | void G_SecretExitLevel (void); 161 | void G_ExitLevellater (void); 162 | void G_SecretExitLevellater (void); 163 | 164 | void G_WorldDone (void); 165 | void G_WorldDone2 (void); 166 | 167 | void G_Ticker (void); 168 | boolean G_Responder (event_t* ev); 169 | 170 | void G_ScreenShot (void); 171 | 172 | map_dests_t * G_Find_Mapdef (unsigned int episode, unsigned int map); 173 | map_dests_t * G_Access_MapInfoTab (unsigned int episode, unsigned int map); 174 | map_dests_t * G_Access_MapInfoTab_E (unsigned int episode, unsigned int map); 175 | map_starts_t * G_Access_MapStartTab (unsigned int episode); 176 | map_starts_t * G_Access_MapStartTab_E (unsigned int episode); 177 | void G_MapName (char * name, int episode, int map); 178 | void G_MapName_E (char * name, int episode, int map); 179 | int G_MapLump (int episode, int map); 180 | void G_ParseMapSeq (char * filename, FILE * fin, int docheck); 181 | void G_ReadMapSeq (char * filename); 182 | void G_ReadHstFile (char * filename); 183 | void G_parse_map_seq_wad_file (const char * wadfile, const char * extension, boolean do_it); 184 | const char * leafname (const char * path); 185 | void dirname (char * dest, const char * path); 186 | unsigned int scan_dir (char * dirname, char * filename, boolean do_it, boolean allow_recurse); 187 | void G_Patch_Map (void); 188 | void G_Patch_Map_Things (int thingnumber, mapthing_t * mt); 189 | void G_InitMapNames (void); 190 | char ** G_AccessMapname (unsigned int episode, unsigned int map); 191 | char ** G_AccessMapname_E (unsigned int episode, unsigned int map); 192 | 193 | #endif 194 | //----------------------------------------------------------------------------- 195 | // 196 | // $Log:$ 197 | // 198 | //----------------------------------------------------------------------------- 199 | -------------------------------------------------------------------------------- /Source/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 | #if 0 26 | static const char rcsid[] = "$Id: st_lib.c,v 1.4 1997/02/03 16:47:56 b1 Exp $"; 27 | #endif 28 | 29 | #include "includes.h" 30 | 31 | #include "doomdef.h" 32 | 33 | // in AM_map.c 34 | extern boolean automapactive; 35 | 36 | 37 | void STlib_drawPatch 38 | ( int x, 39 | int y, 40 | int scrn, 41 | patch_t* patch ) 42 | { 43 | y -= ((SHORT(patch->topoffset) * sbarscale) >> FRACBITS); 44 | x -= ((SHORT(patch->leftoffset) * sbarscale) >> FRACBITS); 45 | V_DrawPatchScaleFlip (x, y, scrn, patch, sbarscale, sbarscale, 0); 46 | } 47 | 48 | 49 | // 50 | // Hack display negative frags. 51 | // Loads and store the stminus lump. 52 | // 53 | patch_t* sttminus; 54 | 55 | void STlib_init(void) 56 | { 57 | sttminus = (patch_t *) W_CacheLumpName("STTMINUS", PU_STATIC); 58 | } 59 | 60 | 61 | // ? 62 | void 63 | STlib_initNum 64 | ( st_number_t* n, 65 | int x, 66 | int y, 67 | patch_t** pl, 68 | int* num, 69 | boolean* on, 70 | int width ) 71 | { 72 | n->x = x; 73 | n->y = y; 74 | n->oldnum = 0; 75 | n->width = width; 76 | n->num = num; 77 | n->on = on; 78 | n->p = pl; 79 | } 80 | 81 | 82 | // 83 | // A fairly efficient way to draw a number 84 | // based on differences from the old number. 85 | // Note: worth the trouble? 86 | // 87 | void 88 | STlib_drawNum 89 | ( st_number_t* n, 90 | boolean refresh ) 91 | { 92 | int numdigits = n->width; 93 | int num = *n->num; 94 | 95 | int w; 96 | int h; 97 | int x = n->x; 98 | int y; 99 | 100 | int neg; 101 | 102 | w = ((SHORT(n->p[0]->width)) * sbarscale) >> FRACBITS; 103 | h = ((SHORT(n->p[0]->height)) * sbarscale) >> FRACBITS; 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 | y = n->y - ST_Y; 122 | if ((y < 0) || (y > SCREENHEIGHT)) 123 | I_Error("drawNum: y < 0 (%d < %d (%d %d))\n", n->y, ST_Y, SCREENHEIGHT, ST_HEIGHT); 124 | if ((x < 0) || (y > SCREENWIDTH)) 125 | I_Error("drawNum: x < 0 (%d (%d %d))\n", n->x, numdigits, w); 126 | 127 | V_CopyRect(x, y, ST_BG, w*numdigits, h, x, n->y, ST_FG); 128 | 129 | // if non-number, do not draw it 130 | if (num == 1994) 131 | return; 132 | 133 | x = n->x; 134 | 135 | // draw the new number 136 | do 137 | { 138 | x -= w; 139 | STlib_drawPatch (x, n->y, ST_FG, n->p [num % 10]); 140 | num /= 10; 141 | } while (num && --numdigits); 142 | 143 | // draw a minus sign if necessary 144 | if (neg) 145 | STlib_drawPatch((x - 8), n->y, ST_FG, sttminus); 146 | } 147 | 148 | 149 | // 150 | void 151 | STlib_updateNum 152 | ( st_number_t* n, 153 | boolean refresh ) 154 | { 155 | if (*n->on) STlib_drawNum(n, refresh); 156 | } 157 | 158 | 159 | // 160 | void 161 | STlib_initPercent 162 | ( st_percent_t* p, 163 | int x, 164 | int y, 165 | patch_t** pl, 166 | int* num, 167 | boolean* on, 168 | patch_t* percent ) 169 | { 170 | STlib_initNum(&p->n, x, y, pl, num, on, 3); 171 | p->p = percent; 172 | } 173 | 174 | 175 | 176 | 177 | void 178 | STlib_updatePercent 179 | ( st_percent_t* per, 180 | boolean refresh ) 181 | { 182 | if (refresh && *per->n.on) 183 | STlib_drawPatch(per->n.x, per->n.y, ST_FG, per->p); 184 | 185 | STlib_updateNum(&per->n, refresh); 186 | } 187 | 188 | 189 | 190 | void 191 | STlib_initMultIcon 192 | ( st_multicon_t* i, 193 | int x, 194 | int y, 195 | patch_t** il, 196 | int* inum, 197 | boolean* on ) 198 | { 199 | i->x = x; 200 | i->y = y; 201 | i->oldinum = -1; 202 | i->inum = inum; 203 | i->on = on; 204 | i->p = il; 205 | } 206 | 207 | 208 | 209 | void 210 | STlib_updateMultIcon 211 | ( st_multicon_t* mi, 212 | boolean refresh ) 213 | { 214 | int w; 215 | int h; 216 | int x; 217 | int y; 218 | int y1; 219 | 220 | if (*mi->on 221 | && (mi->oldinum != *mi->inum || refresh) 222 | && (*mi->inum!=-1)) 223 | { 224 | if (mi->oldinum != -1) 225 | { 226 | x = mi->x - ((SHORT(mi->p[mi->oldinum]->leftoffset) * sbarscale) >> FRACBITS); 227 | y = mi->y - ((SHORT(mi->p[mi->oldinum]->topoffset) * sbarscale) >> FRACBITS); 228 | w = ((SHORT(mi->p[mi->oldinum]->width) * sbarscale) >> FRACBITS); 229 | h = ((SHORT(mi->p[mi->oldinum]->height) * sbarscale) >> FRACBITS); 230 | 231 | y1 = y - ST_Y; 232 | if (y1 < 0) 233 | I_Error("updateMultIcon: y1 - ST_Y < 0"); 234 | 235 | V_CopyRect(x, y1, ST_BG, w, h, x, y, ST_FG); 236 | } 237 | STlib_drawPatch(mi->x, mi->y, ST_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 y1; 271 | int w; 272 | int h; 273 | patch_t* patch; 274 | 275 | if (*bi->on 276 | && (bi->oldval != *bi->val || refresh)) 277 | { 278 | patch = bi->p; 279 | x = bi->x - ((SHORT(patch->leftoffset) * sbarscale) >> FRACBITS); 280 | y = bi->y - ((SHORT(patch->topoffset) * sbarscale) >> FRACBITS); 281 | w = ((SHORT(patch->width) * sbarscale) >> FRACBITS); 282 | h = ((SHORT(patch->height) * sbarscale) >> FRACBITS); 283 | 284 | y1 = y - ST_Y; 285 | if (y1 < 0) 286 | I_Error("updateBinIcon: y1 - ST_Y < 0"); 287 | 288 | if (*bi->val) 289 | STlib_drawPatch(bi->x, bi->y, ST_FG, patch); 290 | else 291 | V_CopyRect(x, y1, ST_BG, w, h, x, y, ST_FG); 292 | 293 | bi->oldval = *bi->val; 294 | } 295 | } 296 | 297 | -------------------------------------------------------------------------------- /Source/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 | enum 28 | { 29 | sg_none, 30 | sg_one, // Spare for DeHackEd use. 31 | sg_itemup, 32 | sg_wpnup, 33 | sg_oof, 34 | sg_getpow, 35 | sg_stnmov, 36 | sg_saw 37 | }; 38 | 39 | // 40 | // SoundFX struct. 41 | // 42 | 43 | typedef struct 44 | { 45 | // up to 6-character name 46 | char* name; 47 | 48 | // Sfx singularity (only one at a time) 49 | int singularity; 50 | 51 | // Sfx priority 52 | int priority; 53 | 54 | // referenced sound if a link 55 | int link; 56 | 57 | // pitch if a link 58 | int pitch; 59 | 60 | // volume if a link 61 | int volume; 62 | 63 | // lump number of sfx 64 | int lumpnum; 65 | 66 | /* Note - preinit table in sounds.c ends here */ 67 | 68 | // sample rate - usually 11025 69 | int samplerate; 70 | 71 | // sound data 72 | void* data; 73 | void* adata; // The actual address of the audio data 74 | unsigned int length; 75 | } sfxinfo_t; 76 | 77 | 78 | 79 | 80 | // 81 | // MusicInfo struct. 82 | // 83 | typedef struct 84 | { 85 | // up to 6-character name 86 | char* name; 87 | 88 | // lump number of music 89 | int lumpnum; 90 | 91 | // music data 92 | void* data; 93 | 94 | // music handle once registered 95 | int handle; 96 | 97 | } musicinfo_t; 98 | 99 | 100 | typedef struct 101 | { 102 | // sound information (if null, channel avail.) 103 | sfxinfo_t* sfxinfo; 104 | 105 | // origin of sound 106 | void* origin; 107 | 108 | // handle of the sound being played 109 | int handle; 110 | 111 | } channel_t; 112 | 113 | 114 | typedef struct muschange_s 115 | { 116 | int episode; 117 | int map; 118 | int musnum; 119 | char music [12]; 120 | struct muschange_s * next; 121 | } muschange_t; 122 | 123 | typedef struct 124 | { 125 | mobj_t *mapthing; 126 | int musnum; 127 | int gametic; 128 | int tics; 129 | muschange_t* head; 130 | } muschangeinfo_t; 131 | 132 | 133 | // the complete set of sound effects 134 | extern sfxinfo_t S_sfx[]; 135 | 136 | // the complete set of music 137 | extern musicinfo_t S_music[]; 138 | 139 | // 140 | // Identifiers for all music in game. 141 | // 142 | 143 | typedef enum 144 | { 145 | mus_None, 146 | mus_e1m1, 147 | mus_e1m2, 148 | mus_e1m3, 149 | mus_e1m4, 150 | mus_e1m5, 151 | mus_e1m6, 152 | mus_e1m7, 153 | mus_e1m8, 154 | mus_e1m9, 155 | mus_e2m1, 156 | mus_e2m2, 157 | mus_e2m3, 158 | mus_e2m4, 159 | mus_e2m5, 160 | mus_e2m6, 161 | mus_e2m7, 162 | mus_e2m8, 163 | mus_e2m9, 164 | mus_e3m1, 165 | mus_e3m2, 166 | mus_e3m3, 167 | mus_e3m4, 168 | mus_e3m5, 169 | mus_e3m6, 170 | mus_e3m7, 171 | mus_e3m8, 172 | mus_e3m9, 173 | mus_inter, 174 | mus_intro, 175 | mus_bunny, 176 | mus_victor, 177 | mus_introa, 178 | mus_runnin, 179 | mus_stalks, 180 | mus_countd, 181 | mus_betwee, 182 | mus_doom, 183 | mus_the_da, 184 | mus_shawn, 185 | mus_ddtblu, 186 | mus_in_cit, 187 | mus_dead, 188 | mus_stlks2, 189 | mus_theda2, 190 | mus_doom2, 191 | mus_ddtbl2, 192 | mus_runni2, 193 | mus_dead2, 194 | mus_stlks3, 195 | mus_romero, 196 | mus_shawn2, 197 | mus_messag, 198 | mus_count2, 199 | mus_ddtbl3, 200 | mus_ampie, 201 | mus_theda3, 202 | mus_adrian, 203 | mus_messg2, 204 | mus_romer2, 205 | mus_tense, 206 | mus_shawn3, 207 | mus_openin, 208 | mus_evil, 209 | mus_ultima, 210 | mus_read_m, 211 | mus_dm2ttl, 212 | mus_dm2int, 213 | mus_extra, 214 | NUMMUSIC 215 | } musicenum_t; 216 | 217 | 218 | // 219 | // Identifiers for all sfx in game. 220 | // 221 | 222 | typedef enum 223 | { 224 | sfx_None, 225 | sfx_pistol, 226 | sfx_shotgn, 227 | sfx_sgcock, 228 | sfx_dshtgn, 229 | sfx_dbopn, 230 | sfx_dbcls, 231 | sfx_dbload, 232 | sfx_plasma, 233 | sfx_bfg, 234 | sfx_sawup, 235 | sfx_sawidl, 236 | sfx_sawful, 237 | sfx_sawhit, 238 | sfx_rlaunc, 239 | sfx_rxplod, 240 | sfx_firsht, 241 | sfx_firxpl, 242 | sfx_pstart, 243 | sfx_pstop, 244 | sfx_doropn, 245 | sfx_dorcls, 246 | sfx_stnmov, 247 | sfx_swtchn, 248 | sfx_swtchx, 249 | sfx_plpain, 250 | sfx_dmpain, 251 | sfx_popain, 252 | sfx_vipain, 253 | sfx_mnpain, 254 | sfx_pepain, 255 | sfx_slop, 256 | sfx_itemup, 257 | sfx_wpnup, 258 | sfx_oof, 259 | sfx_telept, 260 | sfx_posit1, 261 | sfx_posit2, 262 | sfx_posit3, 263 | sfx_bgsit1, 264 | sfx_bgsit2, 265 | sfx_sgtsit, 266 | sfx_cacsit, 267 | sfx_brssit, 268 | sfx_cybsit, 269 | sfx_spisit, 270 | sfx_bspsit, 271 | sfx_kntsit, 272 | sfx_vilsit, 273 | sfx_mansit, 274 | sfx_pesit, 275 | sfx_sklatk, 276 | sfx_sgtatk, 277 | sfx_skepch, 278 | sfx_vilatk, 279 | sfx_claw, 280 | sfx_skeswg, 281 | sfx_pldeth, 282 | sfx_pdiehi, 283 | sfx_podth1, 284 | sfx_podth2, 285 | sfx_podth3, 286 | sfx_bgdth1, 287 | sfx_bgdth2, 288 | sfx_sgtdth, 289 | sfx_cacdth, 290 | sfx_skldth, 291 | sfx_brsdth, 292 | sfx_cybdth, 293 | sfx_spidth, 294 | sfx_bspdth, 295 | sfx_vildth, 296 | sfx_kntdth, 297 | sfx_pedth, 298 | sfx_skedth, 299 | sfx_posact, 300 | sfx_bgact, 301 | sfx_dmact, 302 | sfx_bspact, 303 | sfx_bspwlk, 304 | sfx_vilact, 305 | sfx_noway, 306 | sfx_barexp, 307 | sfx_punch, 308 | sfx_hoof, 309 | sfx_metal, 310 | sfx_chgun, 311 | sfx_tink, 312 | sfx_bdopn, 313 | sfx_bdcls, 314 | sfx_itmbk, 315 | sfx_flame, 316 | sfx_flamst, 317 | sfx_getpow, 318 | sfx_bospit, 319 | sfx_boscub, 320 | sfx_bossit, 321 | sfx_bospn, 322 | sfx_bosdth, 323 | sfx_manatk, 324 | sfx_mandth, 325 | sfx_sssit, 326 | sfx_ssdth, 327 | sfx_keenpn, 328 | sfx_keendt, 329 | sfx_skeact, 330 | sfx_skesit, 331 | sfx_skeatk, 332 | sfx_radio, 333 | // killough 11/98: dog sounds 334 | sfx_dgsit, 335 | sfx_dgatk, 336 | sfx_dgact, 337 | sfx_dgdth, 338 | sfx_dgpain, 339 | sfx_secret, 340 | sfx_gibdth, 341 | sfx_scrsht, 342 | sfx_extra001 = 500, 343 | NUMSFX = 700 // 200 extra sounds 344 | } sfxenum_t; 345 | 346 | #endif 347 | //----------------------------------------------------------------------------- 348 | // 349 | // $Log:$ 350 | // 351 | //----------------------------------------------------------------------------- 352 | 353 | -------------------------------------------------------------------------------- /Source/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 | unsigned short v1; 87 | unsigned short v2; 88 | unsigned short flags; 89 | unsigned short special; 90 | unsigned short tag; 91 | // sidenum[1] will be -1 if one sided 92 | unsigned 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 | // Set if further lines can be used after this one (Boom extension) 138 | #define ML_PASSUSE 512 139 | 140 | // MBF21 141 | #define ML_BLOCKLANDMONSTERS 4096 142 | #define ML_BLOCKPLAYERS 8192 143 | 144 | // Sector definition, from editing. 145 | typedef struct 146 | { 147 | short floorheight; 148 | short ceilingheight; 149 | char floorpic[8]; 150 | char ceilingpic[8]; 151 | short lightlevel; 152 | unsigned short special; 153 | unsigned short tag; 154 | } mapsector_t; 155 | 156 | // SubSector, as generated by BSP. 157 | typedef struct 158 | { 159 | unsigned short numsegs; 160 | // Index of first one, segs are stored sequentially. 161 | unsigned short firstseg; 162 | } mapsubsector_t; 163 | 164 | // [crispy] allow loading of maps with ZDBSP nodes 165 | // taken from prboom-plus/src/doomdata.h:168-170 166 | typedef struct 167 | { 168 | unsigned int numsegs; 169 | } mapsubsector_znod_t; 170 | 171 | 172 | typedef struct 173 | { 174 | unsigned char numsegs[2]; // Alignment issues when not using 'packed' 175 | unsigned char firstseg[4]; // so fiddle by declaring as char arrays... 176 | } mapsubsector_v4_t; 177 | 178 | // LineSeg, generated by splitting LineDefs 179 | // using partition lines selected by BSP builder. 180 | typedef struct 181 | { 182 | unsigned short v1; 183 | unsigned short v2; 184 | short angle; 185 | unsigned short linedef; 186 | unsigned short side; 187 | short offset; 188 | } mapseg_t; 189 | 190 | 191 | // [crispy] allow loading of maps with ZDBSP nodes 192 | // taken from prboom-plus/src/doomdata.h:192-196 193 | typedef struct 194 | { 195 | unsigned int v1; 196 | unsigned int v2; 197 | unsigned short linedef; 198 | unsigned char side; 199 | } mapseg_znod_t; 200 | 201 | typedef struct 202 | { 203 | int v1; 204 | int v2; 205 | unsigned short angle; 206 | unsigned short linedef; 207 | short side; 208 | unsigned short offset; 209 | } mapseg_v4_t; 210 | 211 | // BSP node structure. 212 | 213 | // Indicate a leaf. 214 | #define NF_SUBSECTOR 0x80000000 215 | 216 | typedef struct 217 | { 218 | // Partition line from (x,y) to x+dx,y+dy) 219 | short x; 220 | short y; 221 | short dx; 222 | short dy; 223 | 224 | // Bounding box for each child, 225 | // clip against view frustum. 226 | short bbox[2][4]; 227 | 228 | // If NF_SUBSECTOR its a subsector, 229 | // else it's a node of another subtree. 230 | unsigned short children[2]; 231 | } mapnode_t; 232 | 233 | // [crispy] allow loading of maps with ZDBSP nodes 234 | // taken from prboom-plus/src/doomdata.h:227-136 235 | typedef struct 236 | { 237 | short x; 238 | short y; 239 | short dx; 240 | short dy; 241 | short bbox[2][4]; 242 | int children[2]; 243 | } mapnode_znod_t; 244 | 245 | 246 | typedef struct 247 | { 248 | short x; // Partition line from (x,y) to x+dx,y+dy) 249 | short y; 250 | short dx; 251 | short dy; 252 | // Bounding box for each child, clip against view frustum. 253 | short bbox[2][4]; 254 | // If NF_SUBSECTOR its a subsector, else it's a node of another subtree. 255 | int children[2]; 256 | } mapnode_v4_t; 257 | 258 | 259 | 260 | // Thing definition, position, orientation and type, 261 | // plus skill/visibility flags and attributes. 262 | typedef struct 263 | { 264 | short x; 265 | short y; 266 | short angle; 267 | unsigned short type; 268 | unsigned short options; 269 | } mapthing_t; 270 | 271 | 272 | 273 | 274 | 275 | #endif // __DOOMDATA__ 276 | //----------------------------------------------------------------------------- 277 | // 278 | // $Log:$ 279 | // 280 | //----------------------------------------------------------------------------- 281 | 282 | -------------------------------------------------------------------------------- /Source/p_enemy.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_ENEMY__ 24 | #define __P_ENEMY__ 25 | 26 | 27 | #ifdef __GNUG__ 28 | #pragma interface 29 | #endif 30 | 31 | typedef void (*actionf2)( void*, unsigned int); 32 | typedef struct bossdeath_s 33 | { 34 | unsigned char episode; 35 | unsigned char map; 36 | mobjtype_t monster; 37 | unsigned int tag; 38 | actionf2 func; 39 | unsigned int action; 40 | struct bossdeath_s * next; 41 | } bossdeath_t; 42 | 43 | extern void A_Light0 (mobj_t* mo, pspdef_t* psp); 44 | extern void A_WeaponReady (mobj_t* mo, pspdef_t* psp); 45 | extern void A_Lower (mobj_t* mo, pspdef_t* psp); 46 | extern void A_Raise (mobj_t* mo, pspdef_t* psp); 47 | extern void A_Punch (mobj_t* mo, pspdef_t* psp); 48 | extern void A_ReFire (mobj_t* mo, pspdef_t* psp); 49 | extern void A_FirePistol (mobj_t* mo, pspdef_t* psp); 50 | extern void A_Light1 (mobj_t* mo, pspdef_t* psp); 51 | extern void A_FireShotgun (mobj_t* mo, pspdef_t* psp); 52 | extern void A_Light2 (mobj_t* mo, pspdef_t* psp); 53 | extern void A_FireShotgun2 (mobj_t* mo, pspdef_t* psp); 54 | extern void A_CheckReload (mobj_t* mo, pspdef_t* psp); 55 | extern void A_OpenShotgun2 (mobj_t* mo, pspdef_t* psp); 56 | extern void A_LoadShotgun2 (mobj_t* mo, pspdef_t* psp); 57 | extern void A_CloseShotgun2 (mobj_t* mo, pspdef_t* psp); 58 | extern void A_FireCGun (mobj_t* mo, pspdef_t* psp); 59 | extern void A_GunFlash (mobj_t* mo, pspdef_t* psp); 60 | extern void A_FireMissile (mobj_t* mo, pspdef_t* psp); 61 | extern void A_Saw (mobj_t* mo, pspdef_t* psp); 62 | extern void A_FirePlasma (mobj_t* mo, pspdef_t* psp); 63 | extern void A_BFGsound (mobj_t* mo, pspdef_t* psp); 64 | extern void A_FireBFG (mobj_t* mo, pspdef_t* psp); 65 | extern void A_FireOldBFG (mobj_t *mo, pspdef_t *psp); 66 | 67 | extern void A_BFGSpray (mobj_t* mo, pspdef_t *psp); 68 | extern void A_Explode (mobj_t* mo, pspdef_t *psp); 69 | extern void A_Pain (mobj_t* mo, pspdef_t *psp); 70 | extern void A_PlayerScream (mobj_t* mo, pspdef_t *psp); 71 | extern void A_Fall (mobj_t* mo, pspdef_t *psp); 72 | extern void A_XScream (mobj_t* mo, pspdef_t *psp); 73 | extern void A_Look (mobj_t* mo, pspdef_t *psp); 74 | extern void A_Chase (mobj_t* mo, pspdef_t *psp); 75 | extern void A_FaceTarget (mobj_t* mo, pspdef_t *psp); 76 | extern void A_PosAttack (mobj_t* mo, pspdef_t *psp); 77 | extern void A_Scream (mobj_t* mo, pspdef_t *psp); 78 | extern void A_SPosAttack (mobj_t* mo, pspdef_t *psp); 79 | extern void A_VileChase (mobj_t* mo, pspdef_t *psp); 80 | extern void A_VileStart (mobj_t* mo, pspdef_t *psp); 81 | extern void A_VileTarget (mobj_t* mo, pspdef_t *psp); 82 | extern void A_VileAttack (mobj_t* mo, pspdef_t *psp); 83 | extern void A_StartFire (mobj_t* mo, pspdef_t *psp); 84 | extern void A_Fire (mobj_t* mo, pspdef_t *psp); 85 | extern void A_FireCrackle (mobj_t* mo, pspdef_t *psp); 86 | extern void A_Tracer (mobj_t* mo, pspdef_t *psp); 87 | extern void A_SkelWhoosh (mobj_t* mo, pspdef_t *psp); 88 | extern void A_SkelFist (mobj_t* mo, pspdef_t *psp); 89 | extern void A_SkelMissile (mobj_t* mo, pspdef_t *psp); 90 | extern void A_FatRaise (mobj_t* mo, pspdef_t *psp); 91 | extern void A_FatAttack1 (mobj_t* mo, pspdef_t *psp); 92 | extern void A_FatAttack2 (mobj_t* mo, pspdef_t *psp); 93 | extern void A_FatAttack3 (mobj_t* mo, pspdef_t *psp); 94 | extern void A_BossDeath (mobj_t* mo, pspdef_t *psp); 95 | extern void A_CPosAttack (mobj_t* mo, pspdef_t *psp); 96 | extern void A_CPosRefire (mobj_t* mo, pspdef_t *psp); 97 | extern void A_TroopAttack (mobj_t* mo, pspdef_t *psp); 98 | extern void A_SargAttack (mobj_t* mo, pspdef_t *psp); 99 | extern void A_HeadAttack (mobj_t* mo, pspdef_t *psp); 100 | extern void A_BruisAttack (mobj_t* mo, pspdef_t *psp); 101 | extern void A_SkullAttack (mobj_t* mo, pspdef_t *psp); 102 | extern void A_BetaSkullAttack (mobj_t* mo, pspdef_t *psp); 103 | extern void A_Stop (mobj_t* mo, pspdef_t *psp); 104 | extern void A_Metal (mobj_t* mo, pspdef_t *psp); 105 | extern void A_SpidRefire (mobj_t* mo, pspdef_t *psp); 106 | extern void A_BabyMetal (mobj_t* mo, pspdef_t *psp); 107 | extern void A_BspiAttack (mobj_t* mo, pspdef_t *psp); 108 | extern void A_Hoof (mobj_t* mo, pspdef_t *psp); 109 | extern void A_CyberAttack (mobj_t* mo, pspdef_t *psp); 110 | extern void A_PainAttack (mobj_t* mo, pspdef_t *psp); 111 | extern void A_PainDie (mobj_t* mo, pspdef_t *psp); 112 | extern void A_KeenDie (mobj_t* mo, pspdef_t *psp); 113 | extern void A_BrainPain (mobj_t* mo, pspdef_t *psp); 114 | extern void A_BrainScream (mobj_t* mo, pspdef_t *psp); 115 | extern void A_BrainDie (mobj_t* mo, pspdef_t *psp); 116 | extern void A_BrainAwake (mobj_t* mo, pspdef_t *psp); 117 | extern void A_BrainSpit (mobj_t* mo, pspdef_t *psp); 118 | extern void A_SpawnSound (mobj_t* mo, pspdef_t *psp); 119 | extern void A_SpawnFly (mobj_t* mo, pspdef_t *psp); 120 | extern void A_BrainExplode (mobj_t* mo, pspdef_t *psp); 121 | extern void A_Detonate (mobj_t* mo, pspdef_t *psp); 122 | extern void A_Mushroom (mobj_t* mo, pspdef_t *psp); 123 | extern void A_Die (mobj_t* mo, pspdef_t *psp); 124 | extern void A_Spawn (mobj_t* mo, pspdef_t *psp); 125 | extern void A_Turn (mobj_t* mo, pspdef_t *psp); 126 | extern void A_Face (mobj_t* mo, pspdef_t *psp); 127 | extern void A_Scratch (mobj_t* mo, pspdef_t *psp); 128 | extern void A_PlaySound (mobj_t* mo, pspdef_t *psp); 129 | extern void A_RandomJump (mobj_t* mo, pspdef_t *psp); 130 | extern void A_SkullPop (mobj_t* mo, pspdef_t *psp); 131 | extern void A_LineEffect (mobj_t* mo, pspdef_t *psp); 132 | 133 | // [XA] New MBF21 codepointers 134 | void A_SpawnObject(mobj_t *actor, pspdef_t *psp); 135 | void A_MonsterProjectile(mobj_t *actor, pspdef_t *psp); 136 | void A_MonsterBulletAttack(mobj_t *actor, pspdef_t *psp); 137 | void A_MonsterMeleeAttack(mobj_t *actor, pspdef_t *psp); 138 | void A_RadiusDamage(mobj_t *actor, pspdef_t *psp); 139 | void A_NoiseAlert(mobj_t *actor, pspdef_t *psp); 140 | void A_HealChase(mobj_t *actor, pspdef_t *psp); 141 | void A_SeekTracer(mobj_t *actor, pspdef_t *psp); 142 | void A_FindTracer(mobj_t *actor, pspdef_t *psp); 143 | void A_ClearTracer(mobj_t *actor, pspdef_t *psp); 144 | void A_JumpIfHealthBelow(mobj_t *actor, pspdef_t *psp); 145 | void A_JumpIfTargetInSight(mobj_t *actor, pspdef_t *psp); 146 | void A_JumpIfTargetCloser(mobj_t *actor, pspdef_t *psp); 147 | void A_JumpIfTracerInSight(mobj_t *actor, pspdef_t *psp); 148 | void A_JumpIfTracerCloser(mobj_t *actor, pspdef_t *psp); 149 | void A_JumpIfFlagsSet(mobj_t *actor, pspdef_t *psp); 150 | void A_AddFlags(mobj_t *actor, pspdef_t *psp); 151 | void A_RemoveFlags(mobj_t *actor, pspdef_t *psp); 152 | 153 | void A_WeaponProjectile(mobj_t *actor, pspdef_t *psp); 154 | void A_WeaponBulletAttack(mobj_t *actor, pspdef_t *psp); 155 | void A_WeaponMeleeAttack(mobj_t *actor, pspdef_t *psp); 156 | void A_WeaponSound(mobj_t *actor, pspdef_t *psp); 157 | void A_WeaponAlert(mobj_t *actor, pspdef_t *psp); 158 | void A_WeaponJump(mobj_t *actor, pspdef_t *psp); 159 | void A_ConsumeAmmo(mobj_t *actor, pspdef_t *psp); 160 | void A_CheckAmmo(mobj_t *actor, pspdef_t *psp); 161 | void A_RefireTo(mobj_t *actor, pspdef_t *psp); 162 | void A_GunFlashTo(mobj_t *actor, pspdef_t *psp); 163 | 164 | extern void P_Massacre (void); 165 | extern unsigned int A_LineAction (mobj_t *mo, unsigned int special, unsigned int tag); 166 | 167 | #endif 168 | //----------------------------------------------------------------------------- 169 | // 170 | // $Log:$ 171 | // 172 | //----------------------------------------------------------------------------- 173 | -------------------------------------------------------------------------------- /Source/p_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 | // Play functions, animation, global header. 19 | // 20 | //----------------------------------------------------------------------------- 21 | 22 | 23 | #ifndef __P_LOCAL__ 24 | #define __P_LOCAL__ 25 | 26 | #ifndef __R_LOCAL__ 27 | #include "r_local.h" 28 | #endif 29 | 30 | #define FLOATSPEED (FRACUNIT*4) 31 | 32 | 33 | extern unsigned int Max_Health_100; /* Usually 100 */ 34 | extern unsigned int Max_Health_200; /* Usually 200 */ 35 | 36 | #define VIEWHEIGHT (41*FRACUNIT) 37 | 38 | // mapblocks are used to check movement 39 | // against lines and things 40 | #define MAPBLOCKUNITS 128 41 | #define MAPBLOCKSIZE (MAPBLOCKUNITS*FRACUNIT) 42 | #define MAPBLOCKSHIFT (FRACBITS+7) 43 | #define MAPBMASK (MAPBLOCKSIZE-1) 44 | #define MAPBTOFRAC (MAPBLOCKSHIFT-FRACBITS) 45 | 46 | 47 | // player radius for movement checking 48 | #define PLAYERRADIUS 16*FRACUNIT 49 | 50 | // MAXRADIUS is for precalculated sector block boxes 51 | // the spider demon is larger, 52 | // but we do not have any moving sectors nearby 53 | #define MAXRADIUS 32*FRACUNIT 54 | 55 | #define GRAVITY FRACUNIT 56 | #define MAXMOVE (30*FRACUNIT) 57 | 58 | #define USERANGE (64*FRACUNIT) 59 | #define MELEERANGE (64*FRACUNIT) 60 | #define MISSILERANGE (32*64*FRACUNIT) 61 | 62 | // follow a player exlusively for 3 seconds 63 | #define BASETHRESHOLD 100 64 | 65 | 66 | 67 | // 68 | // P_TICK 69 | // 70 | 71 | // both the head and tail of the thinker list 72 | extern thinker_t * thinker_head; 73 | 74 | 75 | void P_InitThinkers (void); 76 | void P_AddThinker (thinker_t* thinker, actionf_p1 func); 77 | void P_RemoveThinker (thinker_t* thinker); 78 | 79 | 80 | // 81 | // P_PSPR 82 | // 83 | void P_SetupPsprites (player_t* curplayer); 84 | void P_MovePsprites (player_t* curplayer); 85 | void P_DropWeapon (player_t* player); 86 | void P_SetPsprite (player_t* player, pspdef_t* psp, statenum_t stnum); 87 | 88 | 89 | // 90 | // P_USER 91 | // 92 | void P_PlayerThink (player_t* player); 93 | 94 | 95 | // 96 | // P_MOBJ 97 | // 98 | #define ONFLOORZ MININT 99 | #define ONCEILINGZ MAXINT 100 | 101 | // Time interval for item respawning. 102 | #define ITEMQUESIZE 128 103 | 104 | extern mapthing_t itemrespawnque[ITEMQUESIZE]; 105 | extern int itemrespawntime[ITEMQUESIZE]; 106 | extern int iquehead; 107 | extern int iquetail; 108 | 109 | 110 | void P_RespawnSpecials (void); 111 | 112 | mobj_t* 113 | P_SpawnMobj 114 | ( fixed_t x, 115 | fixed_t y, 116 | fixed_t z, 117 | mobjtype_t type ); 118 | 119 | int P_GetMobjSpeed (mobj_t* mobj); 120 | void P_RemoveMobj (mobj_t* th); 121 | boolean P_SetMobjState (mobj_t* mobj, statenum_t state); 122 | void P_MobjThinker (mobj_t* mobj); 123 | 124 | void P_SpawnPuff (fixed_t x, fixed_t y, fixed_t z); 125 | void P_SpawnBlood (fixed_t x, fixed_t y, fixed_t z, int damage); 126 | mobj_t* P_SpawnMissile (mobj_t* source, mobj_t* dest, mobjtype_t type); 127 | mobj_t* P_SpawnPlayerMissile (mobj_t* source, mobjtype_t type); 128 | void P_CheckMissileSpawn (mobj_t* th); 129 | boolean P_SeekerMissile(mobj_t *actor, mobj_t **seekTarget, angle_t thresh, angle_t turnmax, boolean seekcentre); 130 | 131 | 132 | // 133 | // P_ENEMY 134 | // 135 | void P_NoiseAlert (mobj_t* target, mobj_t* emmiter); 136 | 137 | 138 | // 139 | // P_MAPUTL 140 | // 141 | typedef struct 142 | { 143 | fixed_t x; 144 | fixed_t y; 145 | fixed_t dx; 146 | fixed_t dy; 147 | 148 | } divline_t; 149 | 150 | typedef struct 151 | { 152 | fixed_t frac; // along trace line 153 | mobj_t* thing; 154 | line_t* line; 155 | } intercept_t; 156 | 157 | typedef boolean (*traverser_t) (intercept_t *in); 158 | 159 | fixed_t P_ApproxDistance (fixed_t dx, fixed_t dy); 160 | int P_PointOnLineSide (fixed_t x, fixed_t y, line_t* line); 161 | int P_PointOnDivlineSide (fixed_t x, fixed_t y, divline_t* line); 162 | void P_MakeDivline (line_t* li, divline_t* dl); 163 | fixed_t P_InterceptVector (divline_t* v2, divline_t* v1); 164 | int P_BoxOnLineSide (fixed_t* tmbox, line_t* ld); 165 | 166 | // MAES: support 512x512 blockmaps. 167 | int P_GetSafeBlockX (int coord); 168 | int P_GetSafeBlockY (int coord); 169 | 170 | extern fixed_t opentop; 171 | extern fixed_t openbottom; 172 | extern fixed_t openrange; 173 | extern fixed_t lowfloor; 174 | 175 | void P_LineOpening (line_t* linedef); 176 | 177 | boolean P_BlockLinesIterator (int x, int y, boolean(*func)(line_t*) ); 178 | boolean P_BlockThingsIterator (int x, int y, boolean(*func)(mobj_t*) ); 179 | 180 | #define PT_ADDLINES 1 181 | #define PT_ADDTHINGS 2 182 | #define PT_EARLYOUT 4 183 | 184 | extern divline_t trace; 185 | 186 | boolean 187 | P_PathTraverse 188 | ( fixed_t x1, 189 | fixed_t y1, 190 | fixed_t x2, 191 | fixed_t y2, 192 | int flags, 193 | boolean (*trav) (intercept_t *)); 194 | 195 | void P_UnsetThingPosition (mobj_t* thing); 196 | void P_SetThingPosition (mobj_t* thing); 197 | mobj_t *P_RoughTargetSearch(mobj_t *mo, angle_t fov, int distance); 198 | 199 | 200 | // 201 | // P_MAP 202 | // 203 | 204 | // If "floatok" true, move would be ok 205 | // if within "tmfloorz - tmceilingz". 206 | extern boolean floatok; 207 | extern fixed_t tmfloorz; 208 | extern fixed_t tmceilingz; 209 | extern fixed_t tmbbox[4]; 210 | 211 | 212 | extern line_t* ceilingline; 213 | extern line_t* blockline; 214 | 215 | boolean P_CheckPosition (mobj_t *thing, fixed_t x, fixed_t y); 216 | mobj_t *P_CheckOnmobj (mobj_t *thing); 217 | void P_FakeZMovement (mobj_t *mo); 218 | boolean P_TryMove (mobj_t* thing, fixed_t x, fixed_t y); 219 | boolean P_TeleportMove (mobj_t* thing, fixed_t x, fixed_t y, fixed_t z, boolean boss); 220 | void P_SlideMove (mobj_t* mo); 221 | boolean P_CheckSight (mobj_t* t1, mobj_t* t2); 222 | boolean P_CheckFOV(mobj_t *t1, mobj_t *t2, angle_t fov); 223 | void P_UseLines (player_t* player); 224 | 225 | boolean P_ChangeSector (sector_t* sector, boolean crunch); 226 | 227 | boolean PIT_RadiusAttack (mobj_t* thing); 228 | 229 | extern mobj_t* linetarget; // who got hit (or NULL) 230 | 231 | fixed_t 232 | P_AimLineAttack 233 | ( mobj_t* t1, 234 | angle_t angle, 235 | fixed_t distance, 236 | int mask); 237 | 238 | void 239 | P_LineAttack 240 | ( mobj_t* t1, 241 | angle_t angle, 242 | fixed_t distance, 243 | fixed_t slope, 244 | int damage ); 245 | 246 | void 247 | P_RadiusAttack 248 | ( mobj_t* spot, 249 | mobj_t* source, 250 | int damage ); 251 | 252 | 253 | int P_GetFriction(const mobj_t *mo, int *frictionfactor); // killough 08/28/98 254 | int P_GetMoveFactor(const mobj_t *mo, int *frictionp); 255 | 256 | // 257 | // P_SETUP 258 | // 259 | extern byte* rejectmatrix; // for fast sight rejection 260 | extern unsigned int rejectmatrixsize; 261 | extern uint32_t* blockmaphead; 262 | extern int bmapwidth; 263 | extern int bmapheight; // in mapblocks 264 | extern fixed_t bmaporgx; 265 | extern fixed_t bmaporgy; // origin of block map 266 | extern mobj_t** blocklinks; // for thing chains 267 | 268 | 269 | 270 | // 271 | // P_INTER 272 | // 273 | extern int maxammo[NUMAMMO]; 274 | extern int clipammo[NUMAMMO]; 275 | 276 | void 277 | P_TouchSpecialThing 278 | ( mobj_t* special, 279 | mobj_t* toucher ); 280 | 281 | void 282 | P_DamageMobj 283 | ( mobj_t* target, 284 | mobj_t* inflictor, 285 | mobj_t* source, 286 | int damage ); 287 | 288 | 289 | // 290 | // P_SPEC 291 | // 292 | #include "p_spec.h" 293 | 294 | 295 | #endif // __P_LOCAL__ 296 | //----------------------------------------------------------------------------- 297 | // 298 | // $Log:$ 299 | // 300 | //----------------------------------------------------------------------------- 301 | 302 | 303 | --------------------------------------------------------------------------------