├── LICENSE.md ├── README.md └── src ├── .gitattributes ├── ChangeLog ├── DrawFunctions.c ├── DrawFunctions.h ├── FILES ├── FILES2 ├── Makefile ├── README.asm ├── README.b ├── README.book ├── README.gl ├── README.sound ├── TODO ├── XDriver.c ├── am_map.c ├── am_map.h ├── d_englsh.h ├── d_event.h ├── d_french.h ├── d_items.c ├── d_items.h ├── d_main.c ├── d_main.h ├── d_net.c ├── d_net.h ├── d_player.h ├── d_textur.h ├── d_think.h ├── d_ticcmd.h ├── doomdata.h ├── doomdef.c ├── doomdef.h ├── doomstat.c ├── doomstat.h ├── doomtype.h ├── dstrings.c ├── dstrings.h ├── f_finale.c ├── f_finale.h ├── f_wipe.c ├── f_wipe.h ├── g_game.c ├── g_game.h ├── hu_lib.c ├── hu_lib.h ├── hu_stuff.c ├── hu_stuff.h ├── i_main.c ├── i_net.c ├── i_net.h ├── i_sound.c ├── i_sound.h ├── i_system.c ├── i_system.h ├── i_video.c ├── i_video.h ├── i_video_console.c ├── info.c ├── info.h ├── m_argv.c ├── m_argv.h ├── m_bbox.c ├── m_bbox.h ├── m_cheat.c ├── m_cheat.h ├── m_fixed.c ├── m_fixed.h ├── m_menu.c ├── m_menu.h ├── m_misc.c ├── m_misc.h ├── m_random.c ├── m_random.h ├── m_swap.c ├── m_swap.h ├── os_generic.c ├── os_generic.h ├── p_ceilng.c ├── p_doors.c ├── p_enemy.c ├── p_floor.c ├── p_inter.c ├── p_inter.h ├── p_lights.c ├── p_local.h ├── p_map.c ├── p_maputl.c ├── p_mobj.c ├── p_mobj.h ├── p_plats.c ├── p_pspr.c ├── p_pspr.h ├── p_saveg.c ├── p_saveg.h ├── p_setup.c ├── p_setup.h ├── p_sight.c ├── p_spec.c ├── p_spec.h ├── p_switch.c ├── p_telept.c ├── p_tick.c ├── p_tick.h ├── p_user.c ├── r_bsp.c ├── r_bsp.h ├── r_data.c ├── r_data.h ├── r_defs.h ├── r_draw.c ├── r_draw.h ├── r_local.h ├── r_main.c ├── r_main.h ├── r_plane.c ├── r_plane.h ├── r_segs.c ├── r_segs.h ├── r_sky.c ├── r_sky.h ├── r_state.h ├── r_things.c ├── r_things.h ├── s_sound.c ├── s_sound.h ├── sounds.c ├── sounds.h ├── st_lib.c ├── st_lib.h ├── st_stuff.c ├── st_stuff.h ├── stubs.c ├── stubs.h ├── support ├── LICENSE.txt ├── augment_sprites.txt ├── doom1.wad ├── rawwad.c ├── rawwad.h ├── shrinkwad.c ├── stripchoice-E1M1ONLY.txt ├── stripchoice.txt ├── stripchoicebegin.txt └── wadder.c ├── tables.c ├── tables.h ├── v_video.c ├── v_video.h ├── w_wad.c ├── w_wad.h ├── wi_stuff.c ├── wi_stuff.h ├── z_zone.c └── z_zone.h /LICENSE.md: -------------------------------------------------------------------------------- 1 | 2 | 3 | LIMITED USE SOFTWARE LICENSE AGREEMENT 4 | 5 | This Limited Use Software License Agreement (the "Agreement") 6 | is a legal agreement between you, the end-user, and Id Software, Inc. 7 | ("ID"). By downloading or purchasing the software material, which 8 | includes source code (the "Source Code"), artwork data, music and 9 | software tools (collectively, the "Software"), you are agreeing to 10 | be bound by the terms of this Agreement. If you do not agree to the 11 | terms of this Agreement, promptly destroy the Software you may have 12 | downloaded or copied. 13 | 14 | ID SOFTWARE LICENSE 15 | 16 | 1. Grant of License. ID grants to you the right to use the 17 | Software. You have no ownership or proprietary rights in or to the 18 | Software, or the Trademark. For purposes of this section, "use" means 19 | loading the Software into RAM, as well as installation on a hard disk 20 | or other storage device. The Software, together with any archive copy 21 | thereof, shall be destroyed when no longer used in accordance with 22 | this Agreement, or when the right to use the Software is terminated. 23 | You agree that the Software will not be shipped, transferred or 24 | exported into any country in violation of the U.S. Export 25 | Administration Act (or any other law governing such matters) and that 26 | you will not utilize, in any other manner, the Software in violation 27 | of any applicable law. 28 | 29 | 2. Permitted Uses. For educational purposes only, you, the 30 | end-user, may use portions of the Source Code, such as particular 31 | routines, to develop your own software, but may not duplicate the 32 | Source Code, except as noted in paragraph 4. The limited right 33 | referenced in the preceding sentence is hereinafter referred to as 34 | "Educational Use." By so exercising the Educational Use right you 35 | shall not obtain any ownership, copyright, proprietary or other 36 | interest in or to the Source Code, or any portion of the Source 37 | Code. You may dispose of your own software in your sole discretion. 38 | With the exception of the Educational Use right, you may not 39 | otherwise use the Software, or an portion of the Software, which 40 | includes the Source Code, for commercial gain. 41 | 42 | 3. Prohibited Uses: Under no circumstances shall you, the 43 | end-user, be permitted, allowed or authorized to commercially exploit 44 | the Software. Neither you nor anyone at your direction shall do any 45 | of the following acts with regard to the Software, or any portion 46 | thereof: 47 | 48 | Rent; 49 | 50 | Sell; 51 | 52 | Lease; 53 | 54 | Offer on a pay-per-play basis; 55 | 56 | Distribute for money or any other consideration; or 57 | 58 | In any other manner and through any medium whatsoever 59 | commercially exploit or use for any commercial purpose. 60 | 61 | Notwithstanding the foregoing prohibitions, you may commercially 62 | exploit the software you develop by exercising the Educational Use 63 | right, referenced in paragraph 2. hereinabove. 64 | 65 | 4. Copyright. The Software and all copyrights related thereto 66 | (including all characters and other images generated by the Software 67 | or depicted in the Software) are owned by ID and is protected by 68 | United States copyright laws and international treaty provisions. 69 | Id shall retain exclusive ownership and copyright in and to the 70 | Software and all portions of the Software and you shall have no 71 | ownership or other proprietary interest in such materials. You must 72 | treat the Software like any other copyrighted material. You may not 73 | otherwise reproduce, copy or disclose to others, in whole or in any 74 | part, the Software. You may not copy the written materials 75 | accompanying the Software. You agree to use your best efforts to 76 | see that any user of the Software licensed hereunder complies with 77 | this Agreement. 78 | 79 | 5. NO WARRANTIES. ID DISCLAIMS ALL WARRANTIES, BOTH EXPRESS 80 | IMPLIED, INCLUDING BUT NOT LIMITED TO, IMPLIED WARRANTIES OF 81 | MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE WITH RESPECT 82 | TO THE SOFTWARE. THIS LIMITED WARRANTY GIVES YOU SPECIFIC LEGAL 83 | RIGHTS. YOU MAY HAVE OTHER RIGHTS WHICH VARY FROM JURISDICTION TO 84 | JURISDICTION. ID DOES NOT WARRANT THAT THE OPERATION OF THE SOFTWARE 85 | WILL BE UNINTERRUPTED, ERROR FREE OR MEET YOUR SPECIFIC REQUIREMENTS. 86 | THE WARRANTY SET FORTH ABOVE IS IN LIEU OF ALL OTHER EXPRESS 87 | WARRANTIES WHETHER ORAL OR WRITTEN. THE AGENTS, EMPLOYEES, 88 | DISTRIBUTORS, AND DEALERS OF ID ARE NOT AUTHORIZED TO MAKE 89 | MODIFICATIONS TO THIS WARRANTY, OR ADDITIONAL WARRANTIES ON BEHALF 90 | OF ID. 91 | 92 | Exclusive Remedies. The Software is being offered to you 93 | free of any charge. You agree that you have no remedy against ID, its 94 | affiliates, contractors, suppliers, and agents for loss or damage 95 | caused by any defect or failure in the Software regardless of the form 96 | of action, whether in contract, tort, includinegligence, strict 97 | liability or otherwise, with regard to the Software. This Agreement 98 | shall be construed in accordance with and governed by the laws of the 99 | State of Texas. Copyright and other proprietary matters will be 100 | governed by United States laws and international treaties. IN ANY 101 | CASE, ID SHALL NOT BE LIABLE FOR LOSS OF DATA, LOSS OF PROFITS, LOST 102 | SAVINGS, SPECIAL, INCIDENTAL, CONSEQUENTIAL, INDIRECT OR OTHER 103 | SIMILAR DAMAGES ARISING FROM BREACH OF WARRANTY, BREACH OF CONTRACT, 104 | NEGLIGENCE, OR OTHER LEGAL THEORY EVEN IF ID OR ITS AGENT HAS BEEN 105 | ADVISED OF THE POSSIBILITY OF SUCH DAMAGES, OR FOR ANY CLAIM BY ANY 106 | OTHER PARTY. Some jurisdictions do not allow the exclusion or 107 | limitation of incidental or consequential damages, so the above 108 | limitation or exclusion may not apply to you. 109 | 110 | 111 | 112 | 113 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # embeddedDOOM 2 | 3 | A port of DOOM targeted for memory-strapped systems. 4 | 5 | The first rev of this is lifted directly from https://github.com/id-Software/DOOM. 6 | 7 | This is specifically targeted for the shareware version of DOOM, and rips out a few features here and there in favor of being as small (RAM-wise) as possible.s 8 | 9 | WARNING: This repository uses LFS to store the Shareware. You will need to do a ```git lfs fetch``` in the firmware folder to get it updated. Sometimes something goes wrong with it and you have to ```git lfs install --force; git lfs pull``` 10 | 11 | Right now, it uses (on -m32 / linux): 12 | * .bss: 170,992 bytes + DOOM Heap (recommend 294,912 if possible, can use as little as 120kB for E1M1) 13 | * DOOM Heap: Some levels take more than others, E1M6 takes ~280kB, E1M1 takes ~107kB 14 | * Configurable in stubs.h -- variable is DOOMHeap 15 | * Framebuffer lives in this space. It's `CombinedScreens` -- Note: This is not the normal behavior, normally DOOM Keeps 4 copies of each screen, but we just lie and alias all 4 copies. It does mean you can't get the blood transitions between levels and the end screens get a tad sloppy. 16 | * .data: 45,600 bytes 17 | * .text: 108,536 bytes 18 | * .rodata: 5,685,632 bytes -- Includes the WAD files. 19 | 20 | Also, this build requires no file I/O had has highly customizable user input and video output. 21 | 22 | So, theoretically, you could run this on a system with only 384kB RAM. 23 | 24 | ## For installing on x64 25 | 26 | Because DOOM (in its current state is 32-bit ONLY, you can only compile to 32-bit targets. This is OK though, since the Makefile includes `-m32`, but you must install the 32-bit compat libs with the following: 27 | 28 | #### On Debian/Ubuntu based systems: 29 | ``` 30 | sudo apt-get install gcc-multilib libx11-dev:i386 libxext-dev:i386 libnsl-dev:i386 31 | ``` 32 | #### On Arch based systems: 33 | ``` 34 | sudo pacman -S lib32-libx11 lib32-libxext lib32-libnsl gcc-multilib 35 | ``` 36 | 37 | ## Btw 38 | 39 | Use ```./emdoom -warp 1 2``` where second number is the map # (1 to 9) 40 | 41 | I cut out screen transitions because it took an extra 64kB on the Heap! 42 | 43 | ## Files of interest 44 | 45 | * stubs.h/.c is where most of the control for the pairin 46 | * doomdef.h - just has some useful bits. Consider turning on `RANGECHECK` if you are going to be making substantial changes. 47 | * i_*.c has al the interface files for a host system. 48 | * Check out if the configuration of COMBINE_SCREENS is what you want. It controls how the screen memory is allocated. 49 | 50 | 51 | ## Building, etc. 52 | 53 | * Type "make" -- this builds the .wad into a .c (if build step is uncommented) and into the target arch's .o. Then, it builds doom with that and a very large heap. It runs it once to generate all of the tables used for various things. It then writes those tables to .c files in the support/ folder... Which it compiles into target arch .o's. These .o's are linked in to provide the tables needed in .ro so they aren't taking up prescious ram. 54 | 55 | To see memory usage: 56 | 57 | * Type "make emdoom.size" - it'll show you a list of all of the DATA, BSS and TEXT items, increasing in size (second column) as well as size of all sections. You probably care about .text, .rodata, .data and .bss. 58 | 59 | ## TODO: 60 | 61 | * Figure out how to separate out things like the lines and line segments into rodata and .data/.bss. 62 | * Figure out how to change screen size successfully. It just really loves making errors. 63 | 64 | ## To port 65 | 66 | Edit i_video.c 67 | Edit i_system.c 68 | Configure stubs.h to your liking. 69 | -------------------------------------------------------------------------------- /src/.gitattributes: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cnlohr/embeddedDOOM/68d3f729913185fda994bb9f09af66c02990a49e/src/.gitattributes -------------------------------------------------------------------------------- /src/DrawFunctions.h: -------------------------------------------------------------------------------- 1 | //Copyright (c) 2011 <>< Charles Lohr - Under the MIT/x11 or NewBSD License you choose. 2 | 3 | #ifndef _DRAWFUCNTIONS_H 4 | #define _DRAWFUCNTIONS_H 5 | 6 | #ifdef __cplusplus 7 | extern "C" { 8 | #endif 9 | 10 | #include 11 | 12 | typedef struct { 13 | short x, y; 14 | } RDPoint; 15 | 16 | extern int CNFGPenX, CNFGPenY; 17 | extern uint32_t CNFGBGColor; 18 | extern uint32_t CNFGLastColor; 19 | extern uint32_t CNFGDialogColor; //background for boxes 20 | 21 | void CNFGDrawText( const char * text, int scale ); 22 | void CNFGDrawBox( int x1, int y1, int x2, int y2 ); 23 | void CNFGGetTextExtents( const char * text, int * w, int * h, int textsize ); 24 | void CNFGDrawTextbox( int x, int y, const char * text, int textsize ); //ignores pen. 25 | 26 | //To be provided by driver. 27 | uint32_t CNFGColor( uint32_t RGB ); 28 | void CNFGUpdateScreenWithBitmap( unsigned long * data, int w, int h ); 29 | void CNFGTackPixel( short x1, short y1 ); 30 | void CNFGTackSegment( short x1, short y1, short x2, short y2 ); 31 | void CNFGTackRectangle( short x1, short y1, short x2, short y2 ); 32 | void CNFGTackPoly( RDPoint * points, int verts ); 33 | void CNFGClearFrame(); 34 | void CNFGSwapBuffers(); 35 | 36 | void CNFGGetDimensions( short * x, short * y ); 37 | void CNFGSetup( const char * WindowName, int w, int h ); 38 | void CNFGSetupFullscreen( const char * WindowName, int screen_number ); 39 | void CNFGHandleInput(); 40 | 41 | 42 | //You must provide: 43 | void HandleKey( int keycode, int bDown ); 44 | void HandleButton( int x, int y, int button, int bDown ); 45 | void HandleMotion( int x, int y, int mask ); 46 | 47 | 48 | #ifdef __cplusplus 49 | }; 50 | #endif 51 | 52 | 53 | #endif 54 | 55 | -------------------------------------------------------------------------------- /src/FILES: -------------------------------------------------------------------------------- 1 | total 1258 2 | -rw-r--r-- 1 b1 prog 0 Jan 18 15:08 FILES 3 | -rw-r--r-- 1 b1 prog 5799 Jan 18 15:07 Makefile 4 | -rw-r--r-- 1 b1 prog 1943 Jan 18 15:07 am_data.h 5 | -rw-r--r-- 1 b1 prog 20263 Jan 18 15:07 am_map.c 6 | -rw-r--r-- 1 b1 prog 2494 Jan 18 15:07 am_map.h 7 | -rw-r--r-- 1 b1 prog 1499 Jan 18 15:07 am_oids.c 8 | -rw-r--r-- 1 b1 prog 338 Jan 18 15:07 am_oids.h 9 | -rw-r--r-- 1 b1 prog 14005 Jan 18 15:07 d_french.h 10 | -rw-r--r-- 1 b1 prog 25287 Jan 18 15:07 d_main.c 11 | -rw-r--r-- 1 b1 prog 15586 Jan 18 15:07 d_net.c 12 | -rw-r--r-- 1 b1 prog 744 Jan 18 15:07 defs.inc 13 | -rw-r--r-- 1 b1 prog 3569 Jan 18 15:07 dither.c 14 | -rw-r--r-- 1 b1 prog 355 Jan 18 15:07 dither.h 15 | -rw-r--r-- 1 b1 prog 4234 Jan 18 15:07 doomdata.h 16 | -rw-r--r-- 1 b1 prog 32779 Jan 18 15:07 doomdef.h 17 | -rw-r--r-- 1 b1 prog 192 Jan 18 15:07 drcoord.h 18 | -rw-r--r-- 1 b1 prog 22377 Jan 18 15:07 dstrings.h 19 | -rw-r--r-- 1 b1 prog 6582 Jan 18 15:07 dutils.c 20 | -rw-r--r-- 1 b1 prog 1821 Jan 18 15:07 dutils.h 21 | -rw-r--r-- 1 b1 prog 14072 Jan 18 15:07 f_finale.c 22 | -rw-r--r-- 1 b1 prog 7357 Jan 18 15:07 fpfunc.S 23 | -rw-r--r-- 1 b1 prog 34770 Jan 18 15:07 g_game.c 24 | -rw-r--r-- 1 b1 prog 5394 Jan 18 15:07 hu_lib.c 25 | -rw-r--r-- 1 b1 prog 2878 Jan 18 15:07 hu_lib.h 26 | -rw-r--r-- 1 b1 prog 12040 Jan 18 15:07 hu_stuff.c 27 | -rw-r--r-- 1 b1 prog 934 Jan 18 15:07 hu_stuff.h 28 | -rw-r--r-- 1 b1 prog 6238 Jan 18 15:07 i_cyber.c 29 | -rw-r--r-- 1 b1 prog 18324 Jan 18 15:07 i_dga.c 30 | -rw-r--r-- 1 b1 prog 2499 Jan 18 15:07 i_header.h 31 | -rw-r--r-- 1 b1 prog 32815 Jan 18 15:07 i_ibm.c 32 | -rw-r--r-- 1 b1 prog 1867 Jan 18 15:07 i_ibm_a.asm 33 | -rw-r--r-- 1 b1 prog 121 Jan 18 15:07 i_main.c 34 | -rw-r--r-- 1 b1 prog 8251 Jan 18 15:07 i_pcnet.c 35 | -rw-r--r-- 1 b1 prog 8561 Jan 18 15:07 i_sound.c 36 | -rw-r--r-- 1 b1 prog 439 Jan 18 15:07 i_sound.h 37 | -rw-r--r-- 1 b1 prog 9537 Jan 18 15:07 i_svgalib.c 38 | -rw-r--r-- 1 b1 prog 10886 Jan 18 15:07 i_unix.c 39 | -rw-r--r-- 1 b1 prog 20891 Jan 18 15:07 i_x.c 40 | -rw-r--r-- 1 b1 prog 128797 Jan 18 15:07 info.c 41 | -rw-r--r-- 1 b1 prog 15840 Jan 18 15:07 info.h 42 | -rw-r--r-- 1 b1 prog 3477 Jan 18 15:07 irix.c 43 | -rw-r--r-- 1 b1 prog 240 Jan 18 15:07 irix.h 44 | -rw-r--r-- 1 b1 prog 1363 Jan 18 15:07 linux.c 45 | -rw-r--r-- 1 b1 prog 34628 Jan 18 15:07 m_menu.c 46 | -rw-r--r-- 1 b1 prog 13741 Jan 18 15:07 m_misc.c 47 | -rw-r--r-- 1 b1 prog 6117 Jan 18 15:07 p_ceilng.c 48 | -rw-r--r-- 1 b1 prog 15062 Jan 18 15:07 p_doors.c 49 | -rw-r--r-- 1 b1 prog 33758 Jan 18 15:07 p_enemy.c 50 | -rw-r--r-- 1 b1 prog 11409 Jan 18 15:07 p_floor.c 51 | -rw-r--r-- 1 b1 prog 16265 Jan 18 15:07 p_inter.c 52 | -rw-r--r-- 1 b1 prog 7592 Jan 18 15:07 p_lights.c 53 | -rw-r--r-- 1 b1 prog 6447 Jan 18 15:07 p_local.h 54 | -rw-r--r-- 1 b1 prog 30138 Jan 18 15:07 p_map.c 55 | -rw-r--r-- 1 b1 prog 14672 Jan 18 15:07 p_maputl.c 56 | -rw-r--r-- 1 b1 prog 17276 Jan 18 15:07 p_mobj.c 57 | -rw-r--r-- 1 b1 prog 5940 Jan 18 15:07 p_plats.c 58 | -rw-r--r-- 1 b1 prog 17084 Jan 18 15:07 p_pspr.c 59 | -rw-r--r-- 1 b1 prog 12828 Jan 18 15:07 p_setup.c 60 | -rw-r--r-- 1 b1 prog 5962 Jan 18 15:07 p_sight.c 61 | -rw-r--r-- 1 b1 prog 23846 Jan 18 15:07 p_spec.c 62 | -rw-r--r-- 1 b1 prog 11140 Jan 18 15:07 p_spec.h 63 | -rw-r--r-- 1 b1 prog 14229 Jan 18 15:07 p_switch.c 64 | -rw-r--r-- 1 b1 prog 1910 Jan 18 15:07 p_telept.c 65 | -rw-r--r-- 1 b1 prog 14075 Jan 18 15:07 p_tick.c 66 | -rw-r--r-- 1 b1 prog 7044 Jan 18 15:07 p_user.c 67 | -rw-r--r-- 1 b1 prog 13013 Jan 18 15:07 planar.asm 68 | -rw-r--r-- 1 b1 prog 9811 Jan 18 15:07 r_bsp.c 69 | -rw-r--r-- 1 b1 prog 14619 Jan 18 15:07 r_data.c 70 | -rw-r--r-- 1 b1 prog 13591 Jan 18 15:07 r_draw.c 71 | -rw-r--r-- 1 b1 prog 11378 Jan 18 15:07 r_local.h 72 | -rw-r--r-- 1 b1 prog 14868 Jan 18 15:07 r_main.c 73 | -rw-r--r-- 1 b1 prog 7108 Jan 18 15:07 r_plane.c 74 | -rw-r--r-- 1 b1 prog 15420 Jan 18 15:07 r_segs.c 75 | -rw-r--r-- 1 b1 prog 18969 Jan 18 15:07 r_things.c 76 | -rw-r--r-- 1 b1 prog 12274 Jan 18 15:07 s_sound.c 77 | -rw-r--r-- 1 b1 prog 12812 Jan 18 15:07 sndserver.c 78 | -rw-r--r-- 1 b1 prog 141 Jan 18 15:07 sndserver.h 79 | -rw-r--r-- 1 b1 prog 5811 Jan 18 15:07 sounds.c 80 | -rw-r--r-- 1 b1 prog 2674 Jan 18 15:07 sounds.h 81 | -rw-r--r-- 1 b1 prog 3975 Jan 18 15:07 soundst.h 82 | -rw-r--r-- 1 b1 prog 3461 Jan 18 15:07 st_lib.c 83 | -rw-r--r-- 1 b1 prog 2254 Jan 18 15:07 st_lib.h 84 | -rw-r--r-- 1 b1 prog 22769 Jan 18 15:07 st_stuff.c 85 | -rw-r--r-- 1 b1 prog 4685 Jan 18 15:07 st_stuff.h 86 | -rw-r--r-- 1 b1 prog 1725 Jan 18 15:07 sun.c 87 | -rw-r--r-- 1 b1 prog 75 Jan 18 15:07 t.c 88 | -rw-r--r-- 1 b1 prog 114621 Jan 18 15:07 tables.c 89 | -rw-r--r-- 1 b1 prog 5485 Jan 18 15:07 tmap.S 90 | -rw-r--r-- 1 b1 prog 10904 Jan 18 15:07 v_video.c 91 | -rw-r--r-- 1 b1 prog 268 Jan 18 15:07 vgaview.h 92 | -rw-r--r-- 1 b1 prog 9920 Jan 18 15:07 w_wad.c 93 | -rw-r--r-- 1 b1 prog 3629 Jan 18 15:07 wadread.c 94 | -rw-r--r-- 1 b1 prog 551 Jan 18 15:07 wadread.h 95 | -rw-r--r-- 1 b1 prog 3583 Jan 18 15:07 wi_data.h 96 | -rw-r--r-- 1 b1 prog 25608 Jan 18 15:07 wi_stuff.c 97 | -rw-r--r-- 1 b1 prog 1544 Jan 18 15:07 wi_stuff.h 98 | -rw-r--r-- 1 b1 prog 8501 Jan 18 15:07 z_zone.c 99 | -------------------------------------------------------------------------------- /src/Makefile: -------------------------------------------------------------------------------- 1 | ################################################################ 2 | # 3 | # $Id:$ 4 | # 5 | # $Log:$ 6 | # 7 | 8 | HOSTGCC?=gcc 9 | 10 | CC?=gcc # gcc or g++ 11 | CC_HOST?=gcc 12 | # 13 | 14 | # for E1M1 Only, 15 | # make clean && cp support/stripchoice-E1M1ONLY.txt support/stripchoice.txt && cp support/stripchoice-E1M1ONLY.txt support/stripchoicebegin.txt && EXTRA_CFLAGS="-DE1M1ONLY=1" make && ls -l emdoom 16 | # 17 | 18 | CFLAGS?=-m32 -Os -g -w -flto -DNORMALUNIX -DLINUX -DMAXPLAYERS=1 -DRANGECHECK -DDISABLE_NETWORK -fdata-sections -ffunction-sections $(EXTRA_CFLAGS) # -DUSEASM 19 | LDFLAGS?=-L/usr/X11R6/lib -Wl,--gc-sections $(CFLAGS) 20 | LIBS?=-lXext -lX11 -lnsl -lm -lpthread 21 | CFLAGS_HOST?=-m32 -DNORMALUNIX -DLINUX $(EXTRA_CFLAGS) 22 | LDFLAGS_HOST?=-L/usr/X11R6/lib 23 | LIBS_HOST?=-lXext -lX11 -lnsl -lm -lpthread 24 | CS?=i_video.c 25 | 26 | 27 | # If you want to reduce printf junk 28 | CFLAGS+=-DSET_MEMORY_DEBUG=0 29 | 30 | 31 | #CFLAGS_FINAL:=$(CFLAGS) 32 | #CFLAGS_FINAL+=-DFIXED_HEAP=262144 33 | #CS:=i_video.c 34 | 35 | # if you need to do low-level memory debugging. This will help find things like out-of-array writing. 36 | #CFLAGS_HOST+=-fsanitize=address -static-libasan -g 37 | 38 | # For RISC-V 39 | #CFLAGS:=-fno-stack-protector -static-libgcc -fdata-sections -ffunction-sections -g -Os -march=rv32ima -mabi=ilp32 -static -I/usr/include -DRV32IMA_BUILD -DDISABLE_NETWORK -I/usr/include 40 | #LDFLAGS:= -T flatfile-rv32ima.lds -nostdlib -Wl,--gc-sections 41 | #LIBS:= 42 | #SUPPORT_FILES:=startup.S 43 | #CC:=riscv64-unknown-elf-gcc 44 | 45 | # Tricky - if removing maps, also be careful to add/remove maps from stripchoice.txt 46 | STRIKEMAP:=-strikemap 2 3 4 5 6 7 8 9 47 | 48 | BAKED:=support/baked_texture_data.o support/baked_map_data.o 49 | # subdirectory for objects 50 | O=linux 51 | 52 | # not too sophisticated dependency 53 | CS+= \ 54 | doomdef.c \ 55 | doomstat.c \ 56 | dstrings.c \ 57 | i_system.c \ 58 | tables.c \ 59 | f_finale.c \ 60 | f_wipe.c \ 61 | d_main.c \ 62 | d_items.c \ 63 | g_game.c \ 64 | m_menu.c \ 65 | m_misc.c \ 66 | m_argv.c \ 67 | m_bbox.c \ 68 | m_fixed.c \ 69 | m_swap.c \ 70 | m_cheat.c \ 71 | m_random.c \ 72 | am_map.c \ 73 | p_ceilng.c \ 74 | p_doors.c \ 75 | p_enemy.c \ 76 | p_floor.c \ 77 | p_inter.c \ 78 | p_lights.c \ 79 | p_map.c \ 80 | p_maputl.c \ 81 | p_plats.c \ 82 | p_pspr.c \ 83 | p_setup.c \ 84 | p_sight.c \ 85 | p_spec.c \ 86 | p_switch.c \ 87 | p_mobj.c \ 88 | p_telept.c \ 89 | p_tick.c \ 90 | p_saveg.c \ 91 | p_user.c \ 92 | r_bsp.c \ 93 | r_data.c \ 94 | r_draw.c \ 95 | r_main.c \ 96 | r_plane.c \ 97 | r_segs.c \ 98 | r_sky.c \ 99 | r_things.c \ 100 | w_wad.c \ 101 | wi_stuff.c \ 102 | v_video.c \ 103 | st_lib.c \ 104 | st_stuff.c \ 105 | hu_stuff.c \ 106 | hu_lib.c \ 107 | z_zone.c \ 108 | info.c \ 109 | i_net.c \ 110 | d_net.c \ 111 | stubs.c \ 112 | sounds.c \ 113 | s_sound.c \ 114 | i_sound.c 115 | 116 | all: emdoom 117 | 118 | emdoom: $(CS) i_main.c $(BAKED) $(SUPPORT_FILES) support/rawwad_use.o 119 | $(CC) $(CFLAGS_FINAL) $^ -o emdoom $(LDFLAGS) $(LIBS) 120 | 121 | support/baked_texture_data.c support/baked_map_data.c bakedoutput.txt : emdoom.gentables.initial 122 | ./emdoom.gentables.initial $(STRIKEMAP) > support/bakedoutput.txt 123 | 124 | support/add_sprites.txt : support/bakedoutput.txt support/augment_sprites.txt 125 | cat support/bakedoutput.txt | grep ADD_SPRITE > support/add_sprites.txt 126 | cat support/augment_sprites.txt >> support/add_sprites.txt 127 | 128 | #support/baked_map_data.c support/baked_texture_data.c : emdoom.gentables 129 | # ./emdoom.gentables $(STRIKEMAP) 130 | 131 | support/baked_map_data.o : support/baked_map_data.c 132 | $(CC) $(CFLAGS) -c -o $@ $^ 133 | 134 | support/baked_texture_data.o : support/baked_texture_data.c 135 | $(CC) $(CFLAGS) -c -o $@ $^ 136 | 137 | support/wadder : support/wadder.c 138 | $(HOSTGCC) -o $@ $^ 139 | 140 | # Don't normally need to do this, so it's hidden from the steps. 141 | support/rawwad.c : support/wadder 142 | (cd support;./wadder;cd ..) 143 | 144 | support/rawwad_use.o : support/rawwad_use.c 145 | $(CC) $(CFLAGS) -c -o tmp.o $^ 146 | mv tmp.o $@ 147 | 148 | 149 | support/rawwad_use_host.o : support/rawwad_use.c 150 | $(CC_HOST) $(CFLAGS_HOST) -c -o tmp.o $^ 151 | mv tmp.o $@ 152 | 153 | support/rawwad_host.o : support/rawwad.c 154 | $(CC_HOST) $(CFLAGS_HOST) -c -o tmp.o $^ 155 | mv tmp.o $@ 156 | 157 | support/rawwad_host_begin.o : support/rawwad_begin.c 158 | $(CC_HOST) $(CFLAGS_HOST) -c -o tmp.o $^ 159 | mv tmp.o $@ 160 | 161 | 162 | emdoom.size : emdoom 163 | nm --print-size --size-sort --radix=d emdoom | grep -v " r " | grep -v " R " 164 | size emdoom -A 165 | 166 | #emdoom.gentables : i_main.c $(CS) support/rawwad_host_begin.o $(BAKED) 167 | # $(CC_HOST) $(CFLAGS_HOST) $(LDFLAGS_HOST) $^ -o emdoom.gentables -g -DGENERATE_BAKED $(LIBS_HOST) 168 | 169 | emdoom.gentables.initial : i_main.c $(CS) support/rawwad_host_begin.o 170 | $(CC_HOST) $(CFLAGS_HOST) $(LDFLAGS_HOST) $^ -o emdoom.gentables.initial -g -DGENERATE_BAKED -DGENERATE_BAKED_INITIAL $(LIBS_HOST) 171 | 172 | 173 | clean: 174 | rm -f *.o *~ *.flc 175 | rm -f emdoom emdoom.gentables emdoom.gentables.initial $(BAKED) support/wadder support/rawwad_host.o support/rawwad_host_use.o support/rawwad_host_begin.o support/shrinkwad 176 | rm -rf support/baked_map_data.c support/baked_texture_data.c 177 | rm -rf support/rawwad_begin.c support/rawwad_begin.o support/rawwad_use.c support/rawwad_use.o support/bakedoutput.txt 178 | 179 | ### Extra features 180 | 181 | support/shrinkwad : support/shrinkwad.c 182 | $(CC_HOST) $(CFLAGS_HOST) $(LDFLAGS_HOST) -o $@ $^ $(LIBS_HOST) 183 | 184 | support/rawwad_use.c : support/shrinkwad support/stripchoice.txt support/add_sprites.txt 185 | cd support && ./shrinkwad stripchoice.txt add_sprites.txt rawwad_use.c rawwad_use.h 186 | 187 | support/rawwad_begin.c : support/shrinkwad support/stripchoicebegin.txt 188 | #cat gentableslog.txt | grep -a ACCESS_LUMP > lumpaccess.txt 189 | cd support && ./shrinkwad stripchoicebegin.txt 0 rawwad_begin.c rawwad_begin.h 190 | 191 | ############################################################# 192 | # 193 | ############################################################# 194 | -------------------------------------------------------------------------------- /src/README.b: -------------------------------------------------------------------------------- 1 | 2 | README for Linux DOOM Source distribution 3 | ========================================= 4 | 5 | 6 | DISCLAIMER 7 | ---------- 8 | This is not "The DOOM Source Code" dump for a bunch 9 | of reasons. It is based on a DOOM development directory 10 | snapshot as of January 10th, but has been stripped and 11 | changed. Thus it is the DOOM source, but there are many 12 | minor differences to the source as last used by id 13 | Software. 14 | 15 | Note that thus neither John Carmack nor Dave Taylor nor 16 | anybody else at id is responsible for the contents of 17 | this archive, or the changes introduced to the original 18 | source. 19 | 20 | If there are any questions, contact me at bk@gamers.org, 21 | or preferably post to the mailing list at 22 | 23 | doom-editing@gamers.org 24 | 25 | (send mail to majordomo@gamers.org, content just 26 | a single "info doom-editing"). I will post any updates 27 | or notifcation of corrections there. I will probably 28 | put some stuff at 29 | 30 | http://www.gamers.org/dEngine/doom/ 31 | 32 | as well. Look there for the "Unofficial DOOM Specs" as 33 | minimal recommended documentation. 34 | 35 | 36 | 37 | REMARKS 38 | ------- 39 | I made a few minor bug fixes, added some experimental sound 40 | code, and, and changed the handling of IWAD dependend game 41 | modes. Most of the changes though have been shuffling 42 | around sources in a sometimes futile attempt to separate 43 | modules more cleanly, and make certain parts easier 44 | to locate and modify. There is still much left to do, but 45 | I hope that the current source is a good base to start 46 | with, especially with a cooperative effort in mind. Those 47 | so inclined will find the source prepared for CVS. 48 | 49 | There is a list of changes and fixes I did not get around 50 | to in TODO, and an incomplete worklog in ChangeLog, that 51 | also includes some minor ToDo statements scattered throughout 52 | the log. 53 | 54 | 55 | a) Linux SVGA 56 | There is no SVGA support. For development and debug 57 | purposes, the X11 version seems to be more handy. 58 | 59 | b) Sound - see README.sound, 60 | and the sndserver.tgz archive. 61 | 62 | c) GLDOOM - see README.gl 63 | 64 | d) Win32 65 | There was no Win32 support in the original dump. 66 | 67 | e) DOS 68 | Original DOS support (including the texture 69 | mapping and fixed point assembler) has been 70 | removed, mainly because of the lack of sound 71 | support. 72 | 73 | f) DoomEd 74 | The NeXTStep DoomEd sources in the dump were 75 | garbled (filenames - prolly an issue of ISO9660 76 | with or w/o extensions). Somehow Bear never got 77 | around to send me a list of the correct filenames, 78 | and I won't bother guessing without a NeXT box 79 | at hand. 80 | 81 | There is a plethora of useful editors 82 | for DOOM. I suggest using DEU for X11. 83 | 84 | g) BSP Tools 85 | The BSP builder and other tools have 86 | been released by John Carmack long ago, 87 | and since improved/replaced by others. 88 | Again, I recommend taking a pick among 89 | the tools available for Linux. 90 | 91 | h) DOOM game tools 92 | There are a number of tools that have 93 | not been released, namely those which 94 | compiled the Things and State Tables, 95 | the frame animation LUT's, sound tables 96 | etc. Basically, they compile similarly 97 | complex LUT's to generate C files. The 98 | tools are omitted from this distribution. 99 | 100 | There are some files in the 101 | distribution (info.h/c, sounds.h/c) 102 | that are essentially the output of these 103 | tools. This is the data that defines 104 | DOOM (as a game) for all practical 105 | purposes. 106 | 107 | I recommend keeping them, as they are 108 | part of the source. In the long run, 109 | handling them as well as the action/ 110 | animation functions as a separate game.so 111 | library (as with Quake2) seems to be a 112 | good idea. 113 | 114 | i) Artwork 115 | Neither the original artwork nor the 116 | misc. WAD files are included in this 117 | archive. You will at least need the 118 | shareware WAD file to run the executable, 119 | but it shouldn't be to difficult to get 120 | a hold of that. 121 | 122 | Note that the mechanism to detect the 123 | presence of a registered or commercial 124 | version is still in the source, and 125 | homebrew maps are still disabled. This 126 | is easily removed now, but as FinalDOOM, 127 | Ultimate DOOM and DOOM 2 are still in 128 | the shops, it is probably polite not 129 | to distribute a source or binary without 130 | that mechanism. 131 | 132 | This version of Linuxdoom supports Plutonia 133 | and TNT WAD from FinalDOOM as well. No 134 | guarantees, though. 135 | 136 | 137 | Enjoy! 138 | 139 | 140 | b. 97/12/22 141 | -------------------------------------------------------------------------------- /src/README.book: -------------------------------------------------------------------------------- 1 | 2 | The DOOM Book 3 | 4 | Shortly after the Wolfenstein 3D source release, 5 | I sent a mail to Jay Wilbur suggesting a book 6 | about the DOOM engine. I anticipated a similar 7 | release of the DOOM sources within a year or 8 | two, and the obvious problems with the Wolfenstein 9 | sources (lack of accompanying artwork, a code 10 | base not maintained for quite some time) seemed 11 | to demand a better approach. I talked to some 12 | publishing company reps at the Book Fair in 1995, 13 | and while they were cautiously interested, id was 14 | not. 15 | 16 | In the last weeks of 1996, following a visit at 17 | id Software two months earlier, and after the 18 | departure of Jay Wilbur, John Carmack asked me 19 | whether I was still interested in doing the book. 20 | I was, Bear sent me a code dump, and Todd 21 | Hollenshead set out to address the legal concerns 22 | (of which were many). 23 | 24 | Unfortunately, what might have worked in 1995 25 | turned out to be a doomed attempt in 1997. I won't 26 | go into the details - let's just say that my 27 | leaving university and going back to full time 28 | writing for a living repeatedly forced me to 29 | change priorities on what looked more and more 30 | like a project unlikely to generate any revenue. 31 | 32 | By mid of the year, when the legal issues had 33 | finally been settled, it didn't look like I was 34 | going to find a publisher at all. Following the 35 | Book Fair in 1997 and some more discussions 36 | (with about a dozen publishers, total), I gritted 37 | my teeth and decided to abandon the project. 38 | 39 | Note that the book project as such wasn't supposed 40 | to hold up the source release to the public. 41 | However, given the legal concerns relating to 42 | the third party sound code in DOS DOOM, and the 43 | lack of Win32 support as well as the advantages of 44 | an OpenGL based release, the idea was to put 45 | together a consistent, stable code base prior to 46 | public release - most of which was supposed to be 47 | an offspring of my reformatting and modifying the 48 | code for the book. 49 | 50 | None of this worked out as intended. However, I 51 | hope that, at long last, this distribution 52 | will finally provide a good point to start for 53 | any cooperative effort to extend the already 54 | impressive lifespan of DOOM into the age of 55 | multiplayer servers and hardware-accelerated 56 | clients. 57 | 58 | -------------------------------------------------------------------------------- /src/README.sound: -------------------------------------------------------------------------------- 1 | 2 | README: sound in DOOM 3 | 4 | 5 | 1) DOS/Win32 sound 6 | 7 | id licensed a third party sound library called 8 | DMX for DOS DOOM. The situation exhibited 9 | many symptons of serious NIH "Not Invented Here"), 10 | and one of the consequences is that the original 11 | DOOM sound code does not work without DMX. As 12 | DMX is not publicly available, the original DOOM 13 | sound support is removed. 14 | 15 | Win32 was not supported in the source dump I got. 16 | I have no knowledge how the WinDOOM port did the 17 | sound handling. A Win32 port should probaly rely on 18 | DirectSound. So far, the Win32 glDOOM port Jim Dose 19 | is working on has no sound support. 20 | 21 | In consequence, the only target with a working sound 22 | code is UNIX, which I could only verify with Linux 23 | on Intel586. 24 | 25 | 2) Linux sound 26 | 27 | DOOM for Linux used a separate process, sndserver. 28 | 29 | Quoting Dave Taylor: 30 | 31 | "Sound drivers should be an asychronous model, either 32 | a seperate thread or a seperate process. This is 33 | because sound should always be fed to the card without 34 | interruption or else you get pops and with low latency 35 | or else you get angry players. 36 | 37 | Now it turns out that this kind of code isn't too fun 38 | to write. In the days of Linux Doom, threads were not a 39 | happnin thing in Linux. In fact, they still largely 40 | aren't. You can use them these days if you have gnu's 41 | libc installed, but you still can't debug them because 42 | gdb doesn't support them properly yet. I believe the 43 | original seperate process had a bad latency delay 44 | because of the time it took for commands to be flushed 45 | through the pipe used to communicate with the seperate 46 | process. I should have looked into this more thoroughly. 47 | 48 | In Quake, I discovered that I could feed multiple 49 | acknowledgements to a SoundBlaster or compatible without 50 | any side-effects such as pops or other malfunctions. 51 | This discovery led me to switch to a completely synchronous 52 | model, much much easier to debug and understand, so I 53 | think this was fairly intelligent. Although we had to 54 | populate the game with calls in the right places to keep 55 | the sound buffers fed, and although it wasn't gauranteed to 56 | be always fed, well over 99% of the time, it was fed, and 57 | your the latency was never worse than the frequency of your 58 | refills (several times per frame) plus a small lead time 59 | (40th of a second?)." 60 | 61 | The separate sndserver code base introduced some redundancy 62 | (WAD access for sound lumps) for each UNIX target (Sun, SGI, 63 | Linux) and more differences between DOS and UNIX version. 64 | However, I kept the IPC based parts in the source, and 65 | separated the sndserver target in another directory to avoid 66 | further redundancy. There seem to be a few bug-like things 67 | going on in the sndserver that do not receive penalty as 68 | the program has to do only a simple task. One example would 69 | be a libc realloc mixed with zone memory allocation. 70 | 71 | Ungraceful and untimely demise of Linuxdoom (core instead 72 | of I_Error) will leave idle sndserver processes in your 73 | system, blocking /dev/bsp. Kill them manually. 74 | 75 | I put the non-redundant parts of the sndserver program 76 | into the i_sound module of doom, and with the SND_SERV 77 | compiler switch you can choose to use the internal sound 78 | support. However, there is a problem with e.g. the 79 | double shotgun and the plasma gun - walk up to a wall, 80 | face it straight, and fire. The sound output is crappy. 81 | This vanishes with decreasing screen size. A similar 82 | problem occurs with trimer driven asynchronous output 83 | enabled by SNDINTR. 84 | 85 | I agree with Dave that threads would be preferable. 86 | With respect to Linux ports of John Carmack's next 87 | Trinity engine, this one will rely on Win32 88 | multithreading e.g. for input sampling. So the Linux 89 | community will have to sort out threads anyway :-). 90 | 91 | To improve the current sound server, other means of 92 | IPC should take care of the latency. The mixing 93 | buffer/command buffer as shared memory comes to mind. 94 | 95 | 96 | 97 | 3) Music support 98 | 99 | There is, and was, no music support in Linuxdoom. Fine with 100 | me - I wouldn't give a bat's tail feathers for DOOM music. 101 | Your mileage may vary. There are a few leftovers of the DOS 102 | music support also interfacing DMX, so there is a place 103 | to start. However, in the age of CDROM based music, I 104 | recommend getting e.g. Workman to cooperate with DOOM 105 | (currently, DOOM accessing the soundcard SpekerOut 106 | interferes with Workman controlling the CD drives 107 | SpeakerOut), so musci could be chosen and run completely 108 | independend of the game. You could try Linuxdoom with 109 | Q2 music that way. 110 | 111 | -------------------------------------------------------------------------------- /src/TODO: -------------------------------------------------------------------------------- 1 | 2 | - create Web repository for sources, patches, 3 | news, and pointer to doom-editing mailing 4 | list. 5 | 6 | - get DOOM Public License from id 7 | 8 | ----------------------------------------------- 9 | 10 | - remove m_fixed, switch to floating point 11 | More stable, and prolly even faster. 12 | 13 | - make SCREENWIDTH/HEIGHT work at startup? 14 | Well, the HUD/STBar stuff is tied to the 15 | scales implied by the graphics. Rather do 16 | GLDOOM and use texture mapping. 17 | 18 | - fix aspect ratio? 19 | 320x200 is nothing viable nowadays. 20 | A 320x240 base (4:3) would be a lot better. 21 | See above on width/height. 22 | 23 | - limited look up/down by y-shearing? 24 | Prolly not worth it, rather switch to GLDOOM. 25 | 26 | - switch to C++? 27 | The action function pointers have varying 28 | argument lists (no parameter, one, etc.). 29 | C++ doesn't like that much. A major rewrite. 30 | 31 | - switch to doommain.c plus libdoom? Have 32 | libref, libgame etc.? 33 | Another major rewrite. 34 | 35 | - use XFree86 DGA, prolly not that much faster 36 | than MIT SHM, but allows for directly sampled 37 | mouse (and even freelook). Recommended for 38 | GLDOOM. 39 | 40 | - put together an accompanying developer toolkit 41 | source distribution: DEU, RMB, BSP for Linux/X. 42 | 43 | - move info.h, info.c, sounds.h, sounds.c and 44 | other data to a separate lump in the WAD, 45 | or into a libgame.so, to separate the 46 | generic stuff (refresh, I/O) from the 47 | DOOM specifics. 48 | 49 | - decide whether precaching all sounds is 50 | better than retrieving and releasing 51 | every so often. DOOM seems to do that 52 | frequently (8bit stuff, originally for 53 | DOS), and the Linux sound is 16bit 54 | (conversion in the mixing, requires 55 | some padding) - we prolly got the memory 56 | to spare. 57 | 58 | - 16bpp CLUT. The lightmaps and the 59 | framebuffer could be changed to switch 60 | to 64K colors. Prolly better to do 61 | GLDOOM right away. 62 | 63 | - remove checks for commercial etc., in 64 | non-essential issues (enabling PWAD's). 65 | 66 | - change (simplify) determination of 67 | sky texture (done by game version). 68 | Explicit? 69 | 70 | - remove all game version checks 71 | 72 | - different handling of Demo - don't 73 | exit on "different game version" 74 | 75 | - how about shareware/retail "You are here" 76 | intermission animation? Wasn't in 77 | commercial (DOOM 2). 78 | 79 | - double shotgun in DOOM1, all weapons with 80 | shareware 81 | 82 | - checks for required lumps. We need fallbacks 83 | for lumps that are not present, that is, 84 | default sounds etc. to be used instead, 85 | or removing THINGS w/o sprites etc. 86 | 87 | - client/server? I'd suggest ripping off some stuff 88 | from the abandoned IBM WebView project 89 | 90 | - Blockmap 91 | The BLOCKMAP lump might be (partly) redundant, 92 | as the BSP allows for clipping (except certain 93 | LineDefs that will not spawn Segs). 94 | 95 | - LOS 96 | REJECT and intersection based LOS checking could be 97 | done using the BSP. In case of REJECT, certain 98 | monster AI special effects would be lost, though. 99 | 100 | - correct handling of height in collision. This is 101 | not done, and the checks are scattered around in 102 | many places. It does require handling of "player 103 | on top of monster" situations, too - we have to 104 | make sure the players falls off far enough to 105 | avoid getting "stuck in monster". 106 | 107 | - remove obsolete menus (Detail. Music Volume?) 108 | 109 | - clip explosion range damage (and sprites) using 110 | REJECT? That is, if one Sector/SSector not 111 | visible from the other, do not apply damage, 112 | not render sprite if player in other sector. 113 | Hmmm - explosion behind small pillar might not be 114 | visible at all, but do we care? 115 | 116 | 117 | - Ungraceful and untimely demise of Linuxdoom (core 118 | instead of I_Error) will leave idle sndserver 119 | processes in your system, blocking /dev/bsp. 120 | A timeout on lack of input for "sndserver"? 121 | 122 | - threaded sndserver? SHM mixing buffer? 123 | Or internal, timer-based? 124 | -------------------------------------------------------------------------------- /src/am_map.h: -------------------------------------------------------------------------------- 1 | // Emacs style mode select -*- C++ -*- 2 | //----------------------------------------------------------------------------- 3 | // 4 | // $Id:$ 5 | // 6 | // Copyright (C) 1993-1996 by id Software, Inc. 7 | // 8 | // This source is available for distribution and/or modification 9 | // only under the terms of the DOOM Source Code License as 10 | // published by id Software. All rights reserved. 11 | // 12 | // The source is distributed in the hope that it will be useful, 13 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | // FITNESS FOR A PARTICULAR PURPOSE. See the DOOM Source Code License 15 | // for more details. 16 | // 17 | // DESCRIPTION: 18 | // AutoMap module. 19 | // 20 | //----------------------------------------------------------------------------- 21 | 22 | #ifndef __AMMAP_H__ 23 | #define __AMMAP_H__ 24 | 25 | // Used by ST StatusBar stuff. 26 | #define AM_MSGHEADER (('a'<<24)+('m'<<16)) 27 | #define AM_MSGENTERED (AM_MSGHEADER | ('e'<<8)) 28 | #define AM_MSGEXITED (AM_MSGHEADER | ('x'<<8)) 29 | 30 | 31 | // Called by main loop. 32 | boolean AM_Responder (event_t* ev); 33 | 34 | // Called by main loop. 35 | void AM_Ticker (void); 36 | 37 | // Called by main loop, 38 | // called instead of view drawer if automap active. 39 | void AM_Drawer (void); 40 | 41 | // Called to force the automap to quit 42 | // if the level is completed while it is up. 43 | void AM_Stop (void); 44 | 45 | 46 | 47 | #endif 48 | //----------------------------------------------------------------------------- 49 | // 50 | // $Log:$ 51 | // 52 | //----------------------------------------------------------------------------- 53 | -------------------------------------------------------------------------------- /src/d_event.h: -------------------------------------------------------------------------------- 1 | // Emacs style mode select -*- C++ -*- 2 | //----------------------------------------------------------------------------- 3 | // 4 | // $Id:$ 5 | // 6 | // Copyright (C) 1993-1996 by id Software, Inc. 7 | // 8 | // This source is available for distribution and/or modification 9 | // only under the terms of the DOOM Source Code License as 10 | // published by id Software. All rights reserved. 11 | // 12 | // The source is distributed in the hope that it will be useful, 13 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | // FITNESS FOR A PARTICULAR PURPOSE. See the DOOM Source Code License 15 | // for more details. 16 | // 17 | // DESCRIPTION: 18 | // 19 | // 20 | //----------------------------------------------------------------------------- 21 | 22 | 23 | #ifndef __D_EVENT__ 24 | #define __D_EVENT__ 25 | 26 | 27 | #include "doomtype.h" 28 | 29 | 30 | // 31 | // Event handling. 32 | // 33 | 34 | // Input event types. 35 | typedef enum 36 | { 37 | ev_keydown, 38 | ev_keyup, 39 | ev_mouse, 40 | ev_joystick 41 | } evtype_t; 42 | 43 | // Event structure. 44 | typedef struct 45 | { 46 | evtype_t type; 47 | int data1; // keys / mouse/joystick buttons 48 | int data2; // mouse/joystick x move 49 | int data3; // mouse/joystick y move 50 | } event_t; 51 | 52 | 53 | typedef enum 54 | { 55 | ga_nothing, 56 | ga_loadlevel, 57 | ga_newgame, 58 | ga_loadgame, 59 | ga_savegame, 60 | ga_playdemo, 61 | ga_completed, 62 | ga_victory, 63 | ga_worlddone, 64 | ga_screenshot 65 | } gameaction_t; 66 | 67 | 68 | 69 | // 70 | // Button/action code definitions. 71 | // 72 | typedef enum 73 | { 74 | // Press "Fire". 75 | BT_ATTACK = 1, 76 | // Use button, to open doors, activate switches. 77 | BT_USE = 2, 78 | 79 | // Flag: game events, not really buttons. 80 | BT_SPECIAL = 128, 81 | BT_SPECIALMASK = 3, 82 | 83 | // Flag, weapon change pending. 84 | // If true, the next 3 bits hold weapon num. 85 | BT_CHANGE = 4, 86 | // The 3bit weapon mask and shift, convenience. 87 | BT_WEAPONMASK = (8+16+32), 88 | BT_WEAPONSHIFT = 3, 89 | 90 | // Pause the game. 91 | BTS_PAUSE = 1, 92 | // Save the game at each console. 93 | BTS_SAVEGAME = 2, 94 | 95 | // Savegame slot numbers 96 | // occupy the second byte of buttons. 97 | BTS_SAVEMASK = (4+8+16), 98 | BTS_SAVESHIFT = 2, 99 | 100 | } buttoncode_t; 101 | 102 | 103 | 104 | 105 | // 106 | // GLOBAL VARIABLES 107 | // 108 | #define MAXEVENTS 64 109 | 110 | extern event_t events[MAXEVENTS]; 111 | extern int eventhead; 112 | extern int eventtail; 113 | 114 | extern gameaction_t gameaction; 115 | 116 | 117 | #endif 118 | //----------------------------------------------------------------------------- 119 | // 120 | // $Log:$ 121 | // 122 | //----------------------------------------------------------------------------- 123 | -------------------------------------------------------------------------------- /src/d_items.c: -------------------------------------------------------------------------------- 1 | // Emacs style mode select -*- C++ -*- 2 | //----------------------------------------------------------------------------- 3 | // 4 | // $Id:$ 5 | // 6 | // Copyright (C) 1993-1996 by id Software, Inc. 7 | // 8 | // This source is available for distribution and/or modification 9 | // only under the terms of the DOOM Source Code License as 10 | // published by id Software. All rights reserved. 11 | // 12 | // The source is distributed in the hope that it will be useful, 13 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | // FITNESS FOR A PARTICULAR PURPOSE. See the DOOM Source Code License 15 | // for more details. 16 | // 17 | // $Log:$ 18 | // 19 | // DESCRIPTION: 20 | // 21 | //----------------------------------------------------------------------------- 22 | 23 | //static const char 24 | //rcsid[] = "$Id:$"; 25 | 26 | // We are referring to sprite numbers. 27 | #include "info.h" 28 | 29 | #ifdef __GNUG__ 30 | #pragma implementation "d_items.h" 31 | #endif 32 | #include "d_items.h" 33 | 34 | 35 | // 36 | // PSPRITE ACTIONS for waepons. 37 | // This struct controls the weapon animations. 38 | // 39 | // Each entry is: 40 | // ammo/amunition type 41 | // upstate 42 | // downstate 43 | // readystate 44 | // atkstate, i.e. attack/fire/hit frame 45 | // flashstate, muzzle flash 46 | // 47 | weaponinfo_t weaponinfo[NUMWEAPONS] = 48 | { 49 | { 50 | // fist 51 | am_noammo, 52 | S_PUNCHUP, 53 | S_PUNCHDOWN, 54 | S_PUNCH, 55 | S_PUNCH1, 56 | S_NULL 57 | }, 58 | { 59 | // pistol 60 | am_clip, 61 | S_PISTOLUP, 62 | S_PISTOLDOWN, 63 | S_PISTOL, 64 | S_PISTOL1, 65 | S_PISTOLFLASH 66 | }, 67 | { 68 | // shotgun 69 | am_shell, 70 | S_SGUNUP, 71 | S_SGUNDOWN, 72 | S_SGUN, 73 | S_SGUN1, 74 | S_SGUNFLASH1 75 | }, 76 | { 77 | // chaingun 78 | am_clip, 79 | S_CHAINUP, 80 | S_CHAINDOWN, 81 | S_CHAIN, 82 | S_CHAIN1, 83 | S_CHAINFLASH1 84 | }, 85 | { 86 | // missile launcher 87 | am_misl, 88 | S_MISSILEUP, 89 | S_MISSILEDOWN, 90 | S_MISSILE, 91 | S_MISSILE1, 92 | S_MISSILEFLASH1 93 | }, 94 | { 95 | // plasma rifle 96 | am_cell, 97 | S_PLASMAUP, 98 | S_PLASMADOWN, 99 | S_PLASMA, 100 | S_PLASMA1, 101 | S_PLASMAFLASH1 102 | }, 103 | { 104 | // bfg 9000 105 | am_cell, 106 | S_BFGUP, 107 | S_BFGDOWN, 108 | S_BFG, 109 | S_BFG1, 110 | S_BFGFLASH1 111 | }, 112 | { 113 | // chainsaw 114 | am_noammo, 115 | S_SAWUP, 116 | S_SAWDOWN, 117 | S_SAW, 118 | S_SAW1, 119 | S_NULL 120 | }, 121 | { 122 | // super shotgun 123 | am_shell, 124 | S_DSGUNUP, 125 | S_DSGUNDOWN, 126 | S_DSGUN, 127 | S_DSGUN1, 128 | S_DSGUNFLASH1 129 | }, 130 | }; 131 | 132 | 133 | 134 | 135 | 136 | 137 | 138 | 139 | -------------------------------------------------------------------------------- /src/d_items.h: -------------------------------------------------------------------------------- 1 | // Emacs style mode select -*- C++ -*- 2 | //----------------------------------------------------------------------------- 3 | // 4 | // $Id:$ 5 | // 6 | // Copyright (C) 1993-1996 by id Software, Inc. 7 | // 8 | // This source is available for distribution and/or modification 9 | // only under the terms of the DOOM Source Code License as 10 | // published by id Software. All rights reserved. 11 | // 12 | // The source is distributed in the hope that it will be useful, 13 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | // FITNESS FOR A PARTICULAR PURPOSE. See the DOOM Source Code License 15 | // for more details. 16 | // 17 | // DESCRIPTION: 18 | // Items: key cards, artifacts, weapon, ammunition. 19 | // 20 | //----------------------------------------------------------------------------- 21 | 22 | 23 | #ifndef __D_ITEMS__ 24 | #define __D_ITEMS__ 25 | 26 | #include "doomdef.h" 27 | 28 | #ifdef __GNUG__ 29 | #pragma interface 30 | #endif 31 | 32 | 33 | // Weapon info: sprite frames, ammunition use. 34 | typedef struct 35 | { 36 | ammotype_t ammo; 37 | int upstate; 38 | int downstate; 39 | int readystate; 40 | int atkstate; 41 | int flashstate; 42 | 43 | } weaponinfo_t; 44 | 45 | extern weaponinfo_t weaponinfo[NUMWEAPONS]; 46 | 47 | #endif 48 | //----------------------------------------------------------------------------- 49 | // 50 | // $Log:$ 51 | // 52 | //----------------------------------------------------------------------------- 53 | -------------------------------------------------------------------------------- /src/d_main.h: -------------------------------------------------------------------------------- 1 | // Emacs style mode select -*- C++ -*- 2 | //----------------------------------------------------------------------------- 3 | // 4 | // $Id:$ 5 | // 6 | // Copyright (C) 1993-1996 by id Software, Inc. 7 | // 8 | // This source is available for distribution and/or modification 9 | // only under the terms of the DOOM Source Code License as 10 | // published by id Software. All rights reserved. 11 | // 12 | // The source is distributed in the hope that it will be useful, 13 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | // FITNESS FOR A PARTICULAR PURPOSE. See the DOOM Source Code License 15 | // for more details. 16 | // 17 | // $Log:$ 18 | // 19 | // DESCRIPTION: 20 | // System specific interface stuff. 21 | // 22 | //----------------------------------------------------------------------------- 23 | 24 | 25 | #ifndef __D_MAIN__ 26 | #define __D_MAIN__ 27 | 28 | #include "d_event.h" 29 | 30 | #ifdef __GNUG__ 31 | #pragma interface 32 | #endif 33 | 34 | 35 | 36 | #define MAXWADFILES 20 37 | extern char* wadfiles[MAXWADFILES]; 38 | 39 | void D_AddFile (char *file); 40 | 41 | 42 | 43 | // 44 | // D_DoomMain() 45 | // Not a globally visible function, just included for source reference, 46 | // calls all startup code, parses command line options. 47 | // If not overrided by user input, calls N_AdvanceDemo. 48 | // 49 | void D_DoomMain (void); 50 | 51 | // Called by IO functions when input is detected. 52 | void D_PostEvent (event_t* ev); 53 | 54 | 55 | 56 | // 57 | // BASE LEVEL 58 | // 59 | void D_PageTicker (void); 60 | void D_PageDrawer (void); 61 | void D_AdvanceDemo (void); 62 | void D_StartTitle (void); 63 | 64 | #endif 65 | -------------------------------------------------------------------------------- /src/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 | -------------------------------------------------------------------------------- /src/d_player.h: -------------------------------------------------------------------------------- 1 | // Emacs style mode select -*- C++ -*- 2 | //----------------------------------------------------------------------------- 3 | // 4 | // $Id:$ 5 | // 6 | // Copyright (C) 1993-1996 by id Software, Inc. 7 | // 8 | // This source is available for distribution and/or modification 9 | // only under the terms of the DOOM Source Code License as 10 | // published by id Software. All rights reserved. 11 | // 12 | // The source is distributed in the hope that it will be useful, 13 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | // FITNESS FOR A PARTICULAR PURPOSE. See the DOOM Source Code License 15 | // for more details. 16 | // 17 | // DESCRIPTION: 18 | // 19 | // 20 | //----------------------------------------------------------------------------- 21 | 22 | 23 | #ifndef __D_PLAYER__ 24 | #define __D_PLAYER__ 25 | 26 | 27 | // The player data structure depends on a number 28 | // of other structs: items (internal inventory), 29 | // animation states (closely tied to the sprites 30 | // used to represent them, unfortunately). 31 | #include "d_items.h" 32 | #include "p_pspr.h" 33 | 34 | // In addition, the player is just a special 35 | // case of the generic moving object/actor. 36 | #include "p_mobj.h" 37 | 38 | // Finally, for odd reasons, the player input 39 | // is buffered within the player data struct, 40 | // as commands per game tick. 41 | #include "d_ticcmd.h" 42 | 43 | #ifdef __GNUG__ 44 | #pragma interface 45 | #endif 46 | 47 | 48 | 49 | 50 | // 51 | // Player states. 52 | // 53 | typedef enum 54 | { 55 | // Playing or camping. 56 | PST_LIVE, 57 | // Dead on the ground, view follows killer. 58 | PST_DEAD, 59 | // Ready to restart/respawn??? 60 | PST_REBORN 61 | 62 | } playerstate_t; 63 | 64 | 65 | // 66 | // Player internal flags, for cheats and debug. 67 | // 68 | typedef enum 69 | { 70 | // No clipping, walk through barriers. 71 | CF_NOCLIP = 1, 72 | // No damage, no health loss. 73 | CF_GODMODE = 2, 74 | // Not really a cheat, just a debug aid. 75 | CF_NOMOMENTUM = 4 76 | 77 | } cheat_t; 78 | 79 | 80 | // 81 | // Extended player object info: player_t 82 | // 83 | typedef struct player_s 84 | { 85 | mobj_t* mo; 86 | playerstate_t playerstate; 87 | ticcmd_t cmd; 88 | 89 | // Determine POV, 90 | // including viewpoint bobbing during movement. 91 | // Focal origin above r.z 92 | fixed_t viewz; 93 | // Base height above floor for viewz. 94 | fixed_t viewheight; 95 | // Bob/squat speed. 96 | fixed_t deltaviewheight; 97 | // bounded/scaled total momentum. 98 | fixed_t bob; 99 | 100 | // This is only used between levels, 101 | // mo->health is used during levels. 102 | int health; 103 | int armorpoints; 104 | // Armor type is 0-2. 105 | int armortype; 106 | 107 | // Power ups. invinc and invis are tic counters. 108 | int powers[NUMPOWERS]; 109 | boolean cards[NUMCARDS]; 110 | boolean backpack; 111 | 112 | // Frags, kills of other players. 113 | int frags[MAXPLAYERS]; 114 | weapontype_t readyweapon; 115 | 116 | // Is wp_nochange if not changing. 117 | weapontype_t pendingweapon; 118 | 119 | boolean weaponowned[NUMWEAPONS]; 120 | int ammo[NUMAMMO]; 121 | int maxammo[NUMAMMO]; 122 | 123 | // True if button down last tic. 124 | int attackdown; 125 | int usedown; 126 | 127 | // Bit flags, for cheats and debug. 128 | // See cheat_t, above. 129 | int cheats; 130 | 131 | // Refired shots are less accurate. 132 | int refire; 133 | 134 | // For intermission stats. 135 | int killcount; 136 | int itemcount; 137 | int secretcount; 138 | 139 | // Hint messages. 140 | char* message; 141 | 142 | // For screen flashing (red or bright). 143 | int damagecount; 144 | int bonuscount; 145 | 146 | // Who did damage (NULL for floors/ceilings). 147 | mobj_t* attacker; 148 | 149 | // So gun flashes light up areas. 150 | int extralight; 151 | 152 | // Current PLAYPAL, ??? 153 | // can be set to REDCOLORMAP for pain, etc. 154 | int fixedcolormap; 155 | 156 | // Player skin colorshift, 157 | // 0-3 for which color to draw player. 158 | int colormap; 159 | 160 | // Overlay view sprites (gun, etc). 161 | pspdef_t psprites[NUMPSPRITES]; 162 | 163 | // True if secret level has been done. 164 | boolean didsecret; 165 | 166 | } player_t; 167 | 168 | 169 | // 170 | // INTERMISSION 171 | // Structure passed e.g. to WI_Start(wb) 172 | // 173 | typedef struct 174 | { 175 | boolean in; // whether the player is in game 176 | 177 | // Player stats, kills, collected items etc. 178 | int skills; 179 | int sitems; 180 | int ssecret; 181 | int stime; 182 | int frags[4]; 183 | int score; // current score on entry, modified on return 184 | 185 | } wbplayerstruct_t; 186 | 187 | typedef struct 188 | { 189 | int epsd; // episode # (0-2) 190 | 191 | // if true, splash the secret level 192 | boolean didsecret; 193 | 194 | // previous and next levels, origin 0 195 | int last; 196 | int next; 197 | 198 | int maxkills; 199 | int maxitems; 200 | int maxsecret; 201 | int maxfrags; 202 | 203 | // the par time 204 | int partime; 205 | 206 | // index of this player in game 207 | int pnum; 208 | 209 | wbplayerstruct_t plyr[MAXPLAYERS]; 210 | 211 | } wbstartstruct_t; 212 | 213 | 214 | #endif 215 | //----------------------------------------------------------------------------- 216 | // 217 | // $Log:$ 218 | // 219 | //----------------------------------------------------------------------------- 220 | -------------------------------------------------------------------------------- /src/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 | -------------------------------------------------------------------------------- /src/d_think.h: -------------------------------------------------------------------------------- 1 | // Emacs style mode select -*- C++ -*- 2 | //----------------------------------------------------------------------------- 3 | // 4 | // $Id:$ 5 | // 6 | // Copyright (C) 1993-1996 by id Software, Inc. 7 | // 8 | // This source is available for distribution and/or modification 9 | // only under the terms of the DOOM Source Code License as 10 | // published by id Software. All rights reserved. 11 | // 12 | // The source is distributed in the hope that it will be useful, 13 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | // FITNESS FOR A PARTICULAR PURPOSE. See the DOOM Source Code License 15 | // for more details. 16 | // 17 | // DESCRIPTION: 18 | // MapObj data. Map Objects or mobjs are actors, entities, 19 | // thinker, take-your-pick... anything that moves, acts, or 20 | // suffers state changes of more or less violent nature. 21 | // 22 | //----------------------------------------------------------------------------- 23 | 24 | 25 | #ifndef __D_THINK__ 26 | #define __D_THINK__ 27 | 28 | 29 | #ifdef __GNUG__ 30 | #pragma interface 31 | #endif 32 | 33 | 34 | 35 | // 36 | // Experimental stuff. 37 | // To compile this as "ANSI C with classes" 38 | // we will need to handle the various 39 | // action functions cleanly. 40 | // 41 | typedef void (*actionf_v)(); 42 | typedef void (*actionf_p1)( void* ); 43 | typedef void (*actionf_p2)( void*, void* ); 44 | 45 | typedef union 46 | { 47 | actionf_p1 acp1; 48 | actionf_v acv; 49 | actionf_p2 acp2; 50 | 51 | } actionf_t; 52 | 53 | 54 | 55 | 56 | 57 | // Historically, "think_t" is yet another 58 | // function pointer to a routine to handle 59 | // an actor. 60 | typedef actionf_t think_t; 61 | 62 | 63 | // Doubly linked list of actors. 64 | typedef struct thinker_s 65 | { 66 | struct thinker_s* prev; 67 | struct thinker_s* next; 68 | think_t function; 69 | 70 | } thinker_t; 71 | 72 | 73 | 74 | #endif 75 | //----------------------------------------------------------------------------- 76 | // 77 | // $Log:$ 78 | // 79 | //----------------------------------------------------------------------------- 80 | -------------------------------------------------------------------------------- /src/d_ticcmd.h: -------------------------------------------------------------------------------- 1 | // Emacs style mode select -*- C++ -*- 2 | //----------------------------------------------------------------------------- 3 | // 4 | // $Id:$ 5 | // 6 | // Copyright (C) 1993-1996 by id Software, Inc. 7 | // 8 | // This source is available for distribution and/or modification 9 | // only under the terms of the DOOM Source Code License as 10 | // published by id Software. All rights reserved. 11 | // 12 | // The source is distributed in the hope that it will be useful, 13 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | // FITNESS FOR A PARTICULAR PURPOSE. See the DOOM Source Code License 15 | // for more details. 16 | // 17 | // DESCRIPTION: 18 | // System specific interface stuff. 19 | // 20 | //----------------------------------------------------------------------------- 21 | 22 | 23 | #ifndef __D_TICCMD__ 24 | #define __D_TICCMD__ 25 | 26 | #include "doomtype.h" 27 | 28 | #ifdef __GNUG__ 29 | #pragma interface 30 | #endif 31 | 32 | // The data sampled per tick (single player) 33 | // and transmitted to other peers (multiplayer). 34 | // Mainly movements/button commands per game tick, 35 | // plus a checksum for internal state consistency. 36 | typedef struct 37 | { 38 | char forwardmove; // *2048 for move 39 | char sidemove; // *2048 for move 40 | short angleturn; // <<16 for angle delta 41 | short consistancy; // checks for net game 42 | byte chatchar; 43 | byte buttons; 44 | } ticcmd_t; 45 | 46 | 47 | 48 | #endif 49 | //----------------------------------------------------------------------------- 50 | // 51 | // $Log:$ 52 | // 53 | //----------------------------------------------------------------------------- 54 | -------------------------------------------------------------------------------- /src/doomdata.h: -------------------------------------------------------------------------------- 1 | // Emacs style mode select -*- C++ -*- 2 | //----------------------------------------------------------------------------- 3 | // 4 | // $Id:$ 5 | // 6 | // Copyright (C) 1993-1996 by id Software, Inc. 7 | // 8 | // This source is available for distribution and/or modification 9 | // only under the terms of the DOOM Source Code License as 10 | // published by id Software. All rights reserved. 11 | // 12 | // The source is distributed in the hope that it will be useful, 13 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | // FITNESS FOR A PARTICULAR PURPOSE. See the DOOM Source Code License 15 | // for more details. 16 | // 17 | // DESCRIPTION: 18 | // all external data is defined here 19 | // most of the data is loaded into different structures at run time 20 | // some internal structures shared by many modules are here 21 | // 22 | //----------------------------------------------------------------------------- 23 | 24 | #ifndef __DOOMDATA__ 25 | #define __DOOMDATA__ 26 | 27 | // The most basic types we use, portability. 28 | #include "doomtype.h" 29 | 30 | // Some global defines, that configure the game. 31 | #include "doomdef.h" 32 | 33 | 34 | 35 | // 36 | // Map level types. 37 | // The following data structures define the persistent format 38 | // used in the lumps of the WAD files. 39 | // 40 | 41 | // Lump order in a map WAD: each map needs a couple of lumps 42 | // to provide a complete scene geometry description. 43 | enum 44 | { 45 | ML_LABEL, // A separator, name, ExMx or MAPxx 46 | ML_THINGS, // Monsters, items.. 47 | ML_LINEDEFS, // LineDefs, from editing 48 | ML_SIDEDEFS, // SideDefs, from editing 49 | ML_VERTEXES, // Vertices, edited and BSP splits generated 50 | ML_SEGS, // LineSegs, from LineDefs split by BSP 51 | ML_SSECTORS, // SubSectors, list of LineSegs 52 | ML_NODES, // BSP nodes 53 | ML_SECTORS, // Sectors, from editing 54 | ML_REJECT, // LUT, sector-sector visibility 55 | ML_BLOCKMAP // LUT, motion clipping, walls/grid element 56 | }; 57 | 58 | 59 | // A single Vertex. 60 | typedef struct 61 | { 62 | short x; 63 | short y; 64 | } mapvertex_t; 65 | 66 | 67 | // A SideDef, defining the visual appearance of a wall, 68 | // by setting textures and offsets. 69 | typedef struct 70 | { 71 | short textureoffset; 72 | short rowoffset; 73 | char toptexture[8]; 74 | char bottomtexture[8]; 75 | char midtexture[8]; 76 | // Front sector, towards viewer. 77 | short sector; 78 | } mapsidedef_t; 79 | 80 | 81 | 82 | // A LineDef, as used for editing, and as input 83 | // to the BSP builder. 84 | typedef struct 85 | { 86 | short v1; 87 | short v2; 88 | short flags; 89 | short special; 90 | short tag; 91 | // sidenum[1] will be -1 if one sided 92 | short sidenum[2]; 93 | } maplinedef_t; 94 | 95 | 96 | // 97 | // LineDef attributes. 98 | // 99 | 100 | // Solid, is an obstacle. 101 | #define ML_BLOCKING 1 102 | 103 | // Blocks monsters only. 104 | #define ML_BLOCKMONSTERS 2 105 | 106 | // Backside will not be present at all 107 | // if not two sided. 108 | #define ML_TWOSIDED 4 109 | 110 | // If a texture is pegged, the texture will have 111 | // the end exposed to air held constant at the 112 | // top or bottom of the texture (stairs or pulled 113 | // down things) and will move with a height change 114 | // of one of the neighbor sectors. 115 | // Unpegged textures allways have the first row of 116 | // the texture at the top pixel of the line for both 117 | // top and bottom textures (use next to windows). 118 | 119 | // upper texture unpegged 120 | #define ML_DONTPEGTOP 8 121 | 122 | // lower texture unpegged 123 | #define ML_DONTPEGBOTTOM 16 124 | 125 | // In AutoMap: don't map as two sided: IT'S A SECRET! 126 | #define ML_SECRET 32 127 | 128 | // Sound rendering: don't let sound cross two of these. 129 | #define ML_SOUNDBLOCK 64 130 | 131 | // Don't draw on the automap at all. 132 | #define ML_DONTDRAW 128 133 | 134 | // Set if already seen, thus drawn in automap. 135 | #define ML_MAPPED 256 136 | 137 | 138 | 139 | 140 | // Sector definition, from editing. 141 | typedef struct 142 | { 143 | short floorheight; 144 | short ceilingheight; 145 | char floorpic[8]; 146 | char ceilingpic[8]; 147 | short lightlevel; 148 | short special; 149 | short tag; 150 | } mapsector_t; 151 | 152 | // SubSector, as generated by BSP. 153 | typedef struct 154 | { 155 | short numsegs; 156 | // Index of first one, segs are stored sequentially. 157 | short firstseg; 158 | } mapsubsector_t; 159 | 160 | 161 | // LineSeg, generated by splitting LineDefs 162 | // using partition lines selected by BSP builder. 163 | typedef struct 164 | { 165 | short v1; 166 | short v2; 167 | short angle; 168 | short linedef; 169 | short side; 170 | short offset; 171 | } mapseg_t; 172 | 173 | 174 | 175 | // BSP node structure. 176 | 177 | // Indicate a leaf. 178 | #define NF_SUBSECTOR 0x8000 179 | 180 | typedef struct 181 | { 182 | // Partition line from (x,y) to x+dx,y+dy) 183 | short x; 184 | short y; 185 | short dx; 186 | short dy; 187 | 188 | // Bounding box for each child, 189 | // clip against view frustum. 190 | short bbox[2][4]; 191 | 192 | // If NF_SUBSECTOR its a subsector, 193 | // else it's a node of another subtree. 194 | unsigned short children[2]; 195 | 196 | } mapnode_t; 197 | 198 | 199 | 200 | 201 | // Thing definition, position, orientation and type, 202 | // plus skill/visibility flags and attributes. 203 | typedef struct 204 | { 205 | short x; 206 | short y; 207 | short angle; 208 | short type; 209 | short options; 210 | } mapthing_t; 211 | 212 | 213 | 214 | 215 | 216 | #endif // __DOOMDATA__ 217 | //----------------------------------------------------------------------------- 218 | // 219 | // $Log:$ 220 | // 221 | //----------------------------------------------------------------------------- 222 | 223 | -------------------------------------------------------------------------------- /src/doomdef.c: -------------------------------------------------------------------------------- 1 | // Emacs style mode select -*- C++ -*- 2 | //----------------------------------------------------------------------------- 3 | // 4 | // $Id:$ 5 | // 6 | // Copyright (C) 1993-1996 by id Software, Inc. 7 | // 8 | // This source is available for distribution and/or modification 9 | // only under the terms of the DOOM Source Code License as 10 | // published by id Software. All rights reserved. 11 | // 12 | // The source is distributed in the hope that it will be useful, 13 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | // FITNESS FOR A PARTICULAR PURPOSE. See the DOOM Source Code License 15 | // for more details. 16 | // 17 | // $Log:$ 18 | // 19 | // DESCRIPTION: 20 | // DoomDef - basic defines for DOOM, e.g. Version, game mode 21 | // and skill level, and display parameters. 22 | // 23 | //----------------------------------------------------------------------------- 24 | 25 | //static const char 26 | //rcsid[] = "$Id: m_bbox.c,v 1.1 1997/02/03 22:45:10 b1 Exp $"; 27 | 28 | 29 | #ifdef __GNUG__ 30 | #pragma implementation "doomdef.h" 31 | #endif 32 | #include "doomdef.h" 33 | 34 | // Location for any defines turned variables. 35 | 36 | // None. 37 | 38 | 39 | -------------------------------------------------------------------------------- /src/doomstat.c: -------------------------------------------------------------------------------- 1 | // Emacs style mode select -*- C++ -*- 2 | //----------------------------------------------------------------------------- 3 | // 4 | // $Id:$ 5 | // 6 | // Copyright (C) 1993-1996 by id Software, Inc. 7 | // 8 | // This source is available for distribution and/or modification 9 | // only under the terms of the DOOM Source Code License as 10 | // published by id Software. All rights reserved. 11 | // 12 | // The source is distributed in the hope that it will be useful, 13 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | // FITNESS FOR A PARTICULAR PURPOSE. See the DOOM Source Code License 15 | // for more details. 16 | // 17 | // $Log:$ 18 | // 19 | // DESCRIPTION: 20 | // Put all global tate variables here. 21 | // 22 | //----------------------------------------------------------------------------- 23 | 24 | //static const char 25 | //rcsid[] = "$Id: m_bbox.c,v 1.1 1997/02/03 22:45:10 b1 Exp $"; 26 | 27 | 28 | #ifdef __GNUG__ 29 | #pragma implementation "doomstat.h" 30 | #endif 31 | #include "doomstat.h" 32 | 33 | 34 | // Game Mode - identify IWAD as shareware, retail etc. 35 | GameMode_t gamemode = indetermined; 36 | GameMission_t gamemission = doom; 37 | 38 | // Language. 39 | Language_t language = english; 40 | 41 | // Set if homebrew PWAD stuff has been added. 42 | boolean modifiedgame; 43 | 44 | 45 | 46 | 47 | -------------------------------------------------------------------------------- /src/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 | 59 | 60 | 61 | #endif 62 | //----------------------------------------------------------------------------- 63 | // 64 | // $Log:$ 65 | // 66 | //----------------------------------------------------------------------------- 67 | -------------------------------------------------------------------------------- /src/dstrings.c: -------------------------------------------------------------------------------- 1 | // Emacs style mode select -*- C++ -*- 2 | //----------------------------------------------------------------------------- 3 | // 4 | // $Id:$ 5 | // 6 | // Copyright (C) 1993-1996 by id Software, Inc. 7 | // 8 | // This source is available for distribution and/or modification 9 | // only under the terms of the DOOM Source Code License as 10 | // published by id Software. All rights reserved. 11 | // 12 | // The source is distributed in the hope that it will be useful, 13 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | // FITNESS FOR A PARTICULAR PURPOSE. See the DOOM Source Code License 15 | // for more details. 16 | // 17 | // $Log:$ 18 | // 19 | // DESCRIPTION: 20 | // Globally defined strings. 21 | // 22 | //----------------------------------------------------------------------------- 23 | 24 | //static const char 25 | //rcsid[] = "$Id: m_bbox.c,v 1.1 1997/02/03 22:45:10 b1 Exp $"; 26 | 27 | 28 | #ifdef __GNUG__ 29 | #pragma implementation "dstrings.h" 30 | #endif 31 | #include "dstrings.h" 32 | 33 | 34 | 35 | char* endmsg[NUM_QUITMESSAGES+1]= 36 | { 37 | // DOOM1 38 | QUITMSG, 39 | "please don't leave, there's more\ndemons to toast!", 40 | "let's beat it -- this is turning\ninto a bloodbath!", 41 | "i wouldn't leave if i were you.\ndos is much worse.", 42 | "you're trying to say you like dos\nbetter than me, right?", 43 | "don't leave yet -- there's a\ndemon around that corner!", 44 | "ya know, next time you come in here\ni'm gonna toast ya.", 45 | "go ahead and leave. see if i care." 46 | 47 | // QuitDOOM II messages 48 | "you want to quit?\nthen, thou hast lost an eighth!", 49 | "don't go now, there's a \ndimensional shambler waiting\nat the dos prompt!", 50 | "get outta here and go back\nto your boring programs.", 51 | "if i were your boss, i'd \n deathmatch ya in a minute!", 52 | "look, bud. you leave now\nand you forfeit your body count!", 53 | "just leave. when you come\nback, i'll be waiting with a bat.", 54 | "you're lucky i don't smack\nyou for thinking about leaving." 55 | 56 | // FinalDOOM? 57 | "fuck you, pussy!\nget the fuck out!", 58 | "you quit and i'll jizz\nin your cystholes!", 59 | "if you leave, i'll make\nthe lord drink my jizz.", 60 | "hey, ron! can we say\n'fuck' in the game?", 61 | "i'd leave: this is just\nmore monsters and levels.\nwhat a load.", 62 | "suck it down, asshole!\nyou're a fucking wimp!", 63 | "don't quit now! we're \nstill spending your money!", 64 | 65 | // Internal debug. Different style, too. 66 | "THIS IS NO MESSAGE!\nPage intentionally left blank." 67 | }; 68 | 69 | 70 | 71 | 72 | 73 | -------------------------------------------------------------------------------- /src/dstrings.h: -------------------------------------------------------------------------------- 1 | // Emacs style mode select -*- C++ -*- 2 | //----------------------------------------------------------------------------- 3 | // 4 | // $Id:$ 5 | // 6 | // Copyright (C) 1993-1996 by id Software, Inc. 7 | // 8 | // This source is available for distribution and/or modification 9 | // only under the terms of the DOOM Source Code License as 10 | // published by id Software. All rights reserved. 11 | // 12 | // The source is distributed in the hope that it will be useful, 13 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | // FITNESS FOR A PARTICULAR PURPOSE. See the DOOM Source Code License 15 | // for more details. 16 | // 17 | // 18 | // $Log:$ 19 | // 20 | // DESCRIPTION: 21 | // DOOM strings, by language. 22 | // 23 | //----------------------------------------------------------------------------- 24 | 25 | 26 | #ifndef __DSTRINGS__ 27 | #define __DSTRINGS__ 28 | 29 | 30 | // All important printed strings. 31 | // Language selection (message strings). 32 | // Use -DFRENCH etc. 33 | 34 | #ifdef FRENCH 35 | #include "d_french.h" 36 | #else 37 | #include "d_englsh.h" 38 | #endif 39 | 40 | // Misc. other strings. 41 | #define SAVEGAMENAME "doomsav" 42 | 43 | 44 | // 45 | // File locations, 46 | // relative to current position. 47 | // Path names are OS-sensitive. 48 | // 49 | #define DEVMAPS "devmaps" 50 | #define DEVDATA "devdata" 51 | 52 | 53 | // Not done in french? 54 | 55 | // QuitDOOM messages 56 | #define NUM_QUITMESSAGES 22 57 | 58 | extern char* endmsg[]; 59 | 60 | 61 | #endif 62 | //----------------------------------------------------------------------------- 63 | // 64 | // $Log:$ 65 | // 66 | //----------------------------------------------------------------------------- 67 | -------------------------------------------------------------------------------- /src/f_finale.h: -------------------------------------------------------------------------------- 1 | // Emacs style mode select -*- C++ -*- 2 | //----------------------------------------------------------------------------- 3 | // 4 | // $Id:$ 5 | // 6 | // Copyright (C) 1993-1996 by id Software, Inc. 7 | // 8 | // This source is available for distribution and/or modification 9 | // only under the terms of the DOOM Source Code License as 10 | // published by id Software. All rights reserved. 11 | // 12 | // The source is distributed in the hope that it will be useful, 13 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | // FITNESS FOR A PARTICULAR PURPOSE. See the DOOM Source Code License 15 | // for more details. 16 | // 17 | // DESCRIPTION: 18 | // 19 | // 20 | //----------------------------------------------------------------------------- 21 | 22 | 23 | #ifndef __F_FINALE__ 24 | #define __F_FINALE__ 25 | 26 | 27 | #include "doomtype.h" 28 | #include "d_event.h" 29 | // 30 | // FINALE 31 | // 32 | 33 | // Called by main loop. 34 | boolean F_Responder (event_t* ev); 35 | 36 | // Called by main loop. 37 | void F_Ticker (void); 38 | 39 | // Called by main loop. 40 | void F_Drawer (void); 41 | 42 | 43 | void F_StartFinale (void); 44 | 45 | 46 | 47 | 48 | #endif 49 | //----------------------------------------------------------------------------- 50 | // 51 | // $Log:$ 52 | // 53 | //----------------------------------------------------------------------------- 54 | -------------------------------------------------------------------------------- /src/f_wipe.h: -------------------------------------------------------------------------------- 1 | // Emacs style mode select -*- C++ -*- 2 | //----------------------------------------------------------------------------- 3 | // 4 | // $Id:$ 5 | // 6 | // Copyright (C) 1993-1996 by id Software, Inc. 7 | // 8 | // This source is available for distribution and/or modification 9 | // only under the terms of the DOOM Source Code License as 10 | // published by id Software. All rights reserved. 11 | // 12 | // The source is distributed in the hope that it will be useful, 13 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | // FITNESS FOR A PARTICULAR PURPOSE. See the DOOM Source Code License 15 | // for more details. 16 | // 17 | // DESCRIPTION: 18 | // Mission start screen wipe/melt, special effects. 19 | // 20 | //----------------------------------------------------------------------------- 21 | 22 | 23 | #ifndef __F_WIPE_H__ 24 | #define __F_WIPE_H__ 25 | 26 | // 27 | // SCREEN WIPE PACKAGE 28 | // 29 | 30 | enum 31 | { 32 | // simple gradual pixel change for 8-bit only 33 | wipe_ColorXForm, 34 | 35 | // weird screen melt 36 | wipe_Melt, 37 | 38 | wipe_NUMWIPES 39 | }; 40 | 41 | int 42 | wipe_StartScreen 43 | ( int x, 44 | int y, 45 | int width, 46 | int height ); 47 | 48 | 49 | int 50 | wipe_EndScreen 51 | ( int x, 52 | int y, 53 | int width, 54 | int height ); 55 | 56 | 57 | int 58 | wipe_ScreenWipe 59 | ( int wipeno, 60 | int x, 61 | int y, 62 | int width, 63 | int height, 64 | int ticks ); 65 | 66 | #endif 67 | //----------------------------------------------------------------------------- 68 | // 69 | // $Log:$ 70 | // 71 | //----------------------------------------------------------------------------- 72 | -------------------------------------------------------------------------------- /src/g_game.h: -------------------------------------------------------------------------------- 1 | // Emacs style mode select -*- C++ -*- 2 | //----------------------------------------------------------------------------- 3 | // 4 | // $Id:$ 5 | // 6 | // Copyright (C) 1993-1996 by id Software, Inc. 7 | // 8 | // This source is available for distribution and/or modification 9 | // only under the terms of the DOOM Source Code License as 10 | // published by id Software. All rights reserved. 11 | // 12 | // The source is distributed in the hope that it will be useful, 13 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | // FITNESS FOR A PARTICULAR PURPOSE. See the DOOM Source Code License 15 | // for more details. 16 | // 17 | // DESCRIPTION: 18 | // Duh. 19 | // 20 | //----------------------------------------------------------------------------- 21 | 22 | 23 | #ifndef __G_GAME__ 24 | #define __G_GAME__ 25 | 26 | #include "doomdef.h" 27 | #include "d_event.h" 28 | 29 | 30 | 31 | // 32 | // GAME 33 | // 34 | void G_DeathMatchSpawnPlayer (int playernum); 35 | 36 | void G_InitNew (skill_t skill, int episode, int map); 37 | 38 | // Can be called by the startup code or M_Responder. 39 | // A normal game starts at map 1, 40 | // but a warp test can start elsewhere 41 | void G_DeferedInitNew (skill_t skill, int episode, int map); 42 | 43 | void G_DeferedPlayDemo (char* demo); 44 | 45 | // Can be called by the startup code or M_Responder, 46 | // calls P_SetupLevel or W_EnterWorld. 47 | void G_LoadGame (char* name); 48 | 49 | void G_DoLoadGame (void); 50 | 51 | // Called by M_Responder. 52 | void G_SaveGame (int slot, char* description); 53 | 54 | // Only called by startup code. 55 | void G_RecordDemo (char* name); 56 | 57 | void G_BeginRecording (void); 58 | 59 | void G_PlayDemo (char* name); 60 | void G_TimeDemo (char* name); 61 | boolean G_CheckDemoStatus (void); 62 | 63 | void G_ExitLevel (void); 64 | void G_SecretExitLevel (void); 65 | 66 | void G_WorldDone (void); 67 | 68 | void G_Ticker (void); 69 | boolean G_Responder (event_t* ev); 70 | 71 | void G_ScreenShot (void); 72 | 73 | 74 | #endif 75 | //----------------------------------------------------------------------------- 76 | // 77 | // $Log:$ 78 | // 79 | //----------------------------------------------------------------------------- 80 | -------------------------------------------------------------------------------- /src/hu_lib.h: -------------------------------------------------------------------------------- 1 | // Emacs style mode select -*- C++ -*- 2 | //----------------------------------------------------------------------------- 3 | // 4 | // $Id:$ 5 | // 6 | // Copyright (C) 1993-1996 by id Software, Inc. 7 | // 8 | // This source is available for distribution and/or modification 9 | // only under the terms of the DOOM Source Code License as 10 | // published by id Software. All rights reserved. 11 | // 12 | // The source is distributed in the hope that it will be useful, 13 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | // FITNESS FOR A PARTICULAR PURPOSE. See the DOOM Source Code License 15 | // for more details. 16 | // 17 | // DESCRIPTION: none 18 | // 19 | //----------------------------------------------------------------------------- 20 | 21 | #ifndef __HULIB__ 22 | #define __HULIB__ 23 | 24 | // We are referring to patches. 25 | #include "r_defs.h" 26 | 27 | 28 | // background and foreground screen numbers 29 | // different from other modules. 30 | #define BG 1 31 | #define FG 0 32 | 33 | // font stuff 34 | #define HU_CHARERASE KEY_BACKSPACE 35 | 36 | #define HU_MAXLINES 4 37 | #define HU_MAXLINELENGTH 80 38 | 39 | // 40 | // Typedefs of widgets 41 | // 42 | 43 | // Text Line widget 44 | // (parent of Scrolling Text and Input Text widgets) 45 | typedef struct 46 | { 47 | // left-justified position of scrolling text window 48 | int x; 49 | int y; 50 | 51 | patch_t** f; // font 52 | int sc; // start character 53 | char l[HU_MAXLINELENGTH+1]; // line of text 54 | int len; // current line length 55 | 56 | // whether this line needs to be udpated 57 | int needsupdate; 58 | 59 | } hu_textline_t; 60 | 61 | 62 | 63 | // Scrolling Text window widget 64 | // (child of Text Line widget) 65 | typedef struct 66 | { 67 | hu_textline_t l[HU_MAXLINES]; // text lines to draw 68 | int h; // height in lines 69 | int cl; // current line number 70 | 71 | // pointer to boolean stating whether to update window 72 | boolean* on; 73 | boolean laston; // last value of *->on. 74 | 75 | } hu_stext_t; 76 | 77 | 78 | 79 | // Input Text Line widget 80 | // (child of Text Line widget) 81 | typedef struct 82 | { 83 | hu_textline_t l; // text line to input on 84 | 85 | // left margin past which I am not to delete characters 86 | int lm; 87 | 88 | // pointer to boolean stating whether to update window 89 | boolean* on; 90 | boolean laston; // last value of *->on; 91 | 92 | } hu_itext_t; 93 | 94 | 95 | // 96 | // Widget creation, access, and update routines 97 | // 98 | 99 | // initializes heads-up widget library 100 | void HUlib_init(void); 101 | 102 | // 103 | // textline code 104 | // 105 | 106 | // clear a line of text 107 | void HUlib_clearTextLine(hu_textline_t *t); 108 | 109 | void HUlib_initTextLine(hu_textline_t *t, int x, int y, patch_t **f, int sc); 110 | 111 | // returns success 112 | boolean HUlib_addCharToTextLine(hu_textline_t *t, char ch); 113 | 114 | // returns success 115 | boolean HUlib_delCharFromTextLine(hu_textline_t *t); 116 | 117 | // draws tline 118 | void HUlib_drawTextLine(hu_textline_t *l, boolean drawcursor); 119 | 120 | // erases text line 121 | void HUlib_eraseTextLine(hu_textline_t *l); 122 | 123 | 124 | // 125 | // Scrolling Text window widget routines 126 | // 127 | 128 | // ? 129 | void 130 | HUlib_initSText 131 | ( hu_stext_t* s, 132 | int x, 133 | int y, 134 | int h, 135 | patch_t** font, 136 | int startchar, 137 | boolean* on ); 138 | 139 | // add a new line 140 | void HUlib_addLineToSText(hu_stext_t* s); 141 | 142 | // ? 143 | void 144 | HUlib_addMessageToSText 145 | ( hu_stext_t* s, 146 | char* prefix, 147 | char* msg ); 148 | 149 | // draws stext 150 | void HUlib_drawSText(hu_stext_t* s); 151 | 152 | // erases all stext lines 153 | void HUlib_eraseSText(hu_stext_t* s); 154 | 155 | // Input Text Line widget routines 156 | void 157 | HUlib_initIText 158 | ( hu_itext_t* it, 159 | int x, 160 | int y, 161 | patch_t** font, 162 | int startchar, 163 | boolean* on ); 164 | 165 | // enforces left margin 166 | void HUlib_delCharFromIText(hu_itext_t* it); 167 | 168 | // enforces left margin 169 | void HUlib_eraseLineFromIText(hu_itext_t* it); 170 | 171 | // resets line and left margin 172 | void HUlib_resetIText(hu_itext_t* it); 173 | 174 | // left of left-margin 175 | void 176 | HUlib_addPrefixToIText 177 | ( hu_itext_t* it, 178 | char* str ); 179 | 180 | // whether eaten 181 | boolean 182 | HUlib_keyInIText 183 | ( hu_itext_t* it, 184 | unsigned char ch ); 185 | 186 | void HUlib_drawIText(hu_itext_t* it); 187 | 188 | // erases all itext lines 189 | void HUlib_eraseIText(hu_itext_t* it); 190 | 191 | #endif 192 | //----------------------------------------------------------------------------- 193 | // 194 | // $Log:$ 195 | // 196 | //----------------------------------------------------------------------------- 197 | -------------------------------------------------------------------------------- /src/hu_stuff.h: -------------------------------------------------------------------------------- 1 | // Emacs style mode select -*- C++ -*- 2 | //----------------------------------------------------------------------------- 3 | // 4 | // $Id:$ 5 | // 6 | // Copyright (C) 1993-1996 by id Software, Inc. 7 | // 8 | // This source is available for distribution and/or modification 9 | // only under the terms of the DOOM Source Code License as 10 | // published by id Software. All rights reserved. 11 | // 12 | // The source is distributed in the hope that it will be useful, 13 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | // FITNESS FOR A PARTICULAR PURPOSE. See the DOOM Source Code License 15 | // for more details. 16 | // 17 | // DESCRIPTION: Head up display 18 | // 19 | //----------------------------------------------------------------------------- 20 | 21 | #ifndef __HU_STUFF_H__ 22 | #define __HU_STUFF_H__ 23 | 24 | #include "d_event.h" 25 | 26 | 27 | // 28 | // Globally visible constants. 29 | // 30 | #define HU_FONTSTART '!' // the first font characters 31 | #define HU_FONTEND '_' // the last font characters 32 | 33 | // Calculate # of glyphs in font. 34 | #define HU_FONTSIZE (HU_FONTEND - HU_FONTSTART + 1) 35 | 36 | #define HU_BROADCAST 5 37 | 38 | #define HU_MSGREFRESH KEY_ENTER 39 | #define HU_MSGX 0 40 | #define HU_MSGY 0 41 | #define HU_MSGWIDTH 64 // in characters 42 | #define HU_MSGHEIGHT 1 // in lines 43 | 44 | #define HU_MSGTIMEOUT (4*TICRATE) 45 | 46 | // 47 | // HEADS UP TEXT 48 | // 49 | 50 | void HU_Init(void); 51 | void HU_Start(void); 52 | 53 | boolean HU_Responder(event_t* ev); 54 | 55 | void HU_Ticker(void); 56 | void HU_Drawer(void); 57 | char HU_dequeueChatChar(void); 58 | void HU_Erase(void); 59 | 60 | 61 | #endif 62 | //----------------------------------------------------------------------------- 63 | // 64 | // $Log:$ 65 | // 66 | //----------------------------------------------------------------------------- 67 | -------------------------------------------------------------------------------- /src/i_main.c: -------------------------------------------------------------------------------- 1 | // Emacs style mode select -*- C++ -*- 2 | //----------------------------------------------------------------------------- 3 | // 4 | // $Id:$ 5 | // 6 | // Copyright (C) 1993-1996 by id Software, Inc. 7 | // 8 | // This source is available for distribution and/or modification 9 | // only under the terms of the DOOM Source Code License as 10 | // published by id Software. All rights reserved. 11 | // 12 | // The source is distributed in the hope that it will be useful, 13 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | // FITNESS FOR A PARTICULAR PURPOSE. See the DOOM Source Code License 15 | // for more details. 16 | // 17 | // $Log:$ 18 | // 19 | // DESCRIPTION: 20 | // Main program, simply calls D_DoomMain high level loop. 21 | // 22 | //----------------------------------------------------------------------------- 23 | 24 | //static const char 25 | //rcsid[] = "$Id: i_main.c,v 1.4 1997/02/03 22:45:10 b1 Exp $"; 26 | 27 | 28 | 29 | #include "doomdef.h" 30 | 31 | #include "m_argv.h" 32 | #include "d_main.h" 33 | 34 | int 35 | main 36 | ( int argc, 37 | char** argv ) 38 | { 39 | myargc = argc; 40 | myargv = argv; 41 | 42 | D_DoomMain (); 43 | 44 | return 0; 45 | } 46 | -------------------------------------------------------------------------------- /src/i_net.h: -------------------------------------------------------------------------------- 1 | // Emacs style mode select -*- C++ -*- 2 | //----------------------------------------------------------------------------- 3 | // 4 | // $Id:$ 5 | // 6 | // Copyright (C) 1993-1996 by id Software, Inc. 7 | // 8 | // This source is available for distribution and/or modification 9 | // only under the terms of the DOOM Source Code License as 10 | // published by id Software. All rights reserved. 11 | // 12 | // The source is distributed in the hope that it will be useful, 13 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | // FITNESS FOR A PARTICULAR PURPOSE. See the DOOM Source Code License 15 | // for more details. 16 | // 17 | // DESCRIPTION: 18 | // System specific network interface stuff. 19 | // 20 | //----------------------------------------------------------------------------- 21 | 22 | 23 | #ifndef __I_NET__ 24 | #define __I_NET__ 25 | 26 | 27 | #ifdef __GNUG__ 28 | #pragma interface 29 | #endif 30 | 31 | 32 | 33 | // Called by D_DoomMain. 34 | 35 | 36 | void I_InitNetwork (void); 37 | void I_NetCmd (void); 38 | 39 | 40 | #endif 41 | //----------------------------------------------------------------------------- 42 | // 43 | // $Log:$ 44 | // 45 | //----------------------------------------------------------------------------- 46 | -------------------------------------------------------------------------------- /src/i_sound.h: -------------------------------------------------------------------------------- 1 | // Emacs style mode select -*- C++ -*- 2 | //----------------------------------------------------------------------------- 3 | // 4 | // $Id:$ 5 | // 6 | // Copyright (C) 1993-1996 by id Software, Inc. 7 | // 8 | // This source is available for distribution and/or modification 9 | // only under the terms of the DOOM Source Code License as 10 | // published by id Software. All rights reserved. 11 | // 12 | // The source is distributed in the hope that it will be useful, 13 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | // FITNESS FOR A PARTICULAR PURPOSE. See the DOOM Source Code License 15 | // for more details. 16 | // 17 | // 18 | // DESCRIPTION: 19 | // System interface, sound. 20 | // 21 | //----------------------------------------------------------------------------- 22 | 23 | #ifndef __I_SOUND__ 24 | #define __I_SOUND__ 25 | 26 | #include "doomdef.h" 27 | 28 | // UNIX hack, to be removed. 29 | #ifdef SNDSERV 30 | #include 31 | extern FILE* sndserver; 32 | extern char* sndserver_filename; 33 | #endif 34 | 35 | #include "doomstat.h" 36 | #include "sounds.h" 37 | 38 | 39 | 40 | // Init at program start... 41 | void I_InitSound(); 42 | 43 | // ... update sound buffer and audio device at runtime... 44 | void I_UpdateSound(void); 45 | void I_SubmitSound(void); 46 | 47 | // ... shut down and relase at program termination. 48 | void I_ShutdownSound(void); 49 | 50 | 51 | // 52 | // SFX I/O 53 | // 54 | 55 | // Initialize channels? 56 | void I_SetChannels(); 57 | 58 | // Get raw data lump index for sound descriptor. 59 | int I_GetSfxLumpNum (sfxinfo_t* sfxinfo ); 60 | 61 | 62 | // Starts a sound in a particular sound channel. 63 | int 64 | I_StartSound 65 | ( int id, 66 | int vol, 67 | int sep, 68 | int pitch, 69 | int priority ); 70 | 71 | 72 | // Stops a sound channel. 73 | void I_StopSound(int handle); 74 | 75 | // Called by S_*() functions 76 | // to see if a channel is still playing. 77 | // Returns 0 if no longer playing, 1 if playing. 78 | int I_SoundIsPlaying(int handle); 79 | 80 | // Updates the volume, separation, 81 | // and pitch of a sound channel. 82 | void 83 | I_UpdateSoundParams 84 | ( int handle, 85 | int vol, 86 | int sep, 87 | int pitch ); 88 | 89 | 90 | // 91 | // MUSIC I/O 92 | // 93 | void I_InitMusic(void); 94 | void I_ShutdownMusic(void); 95 | // Volume. 96 | void I_SetMusicVolume(int volume); 97 | // PAUSE game handling. 98 | void I_PauseSong(int handle); 99 | void I_ResumeSong(int handle); 100 | // Registers a song handle to song data. 101 | int I_RegisterSong(void *data); 102 | // Called by anything that wishes to start music. 103 | // plays a song, and when the song is done, 104 | // starts playing it again in an endless loop. 105 | // Horrible thing to do, considering. 106 | void 107 | I_PlaySong 108 | ( int handle, 109 | int looping ); 110 | // Stops a song over 3 seconds. 111 | void I_StopSong(int handle); 112 | // See above (register), then think backwards 113 | void I_UnRegisterSong(int handle); 114 | 115 | 116 | 117 | #endif 118 | //----------------------------------------------------------------------------- 119 | // 120 | // $Log:$ 121 | // 122 | //----------------------------------------------------------------------------- 123 | -------------------------------------------------------------------------------- /src/i_system.c: -------------------------------------------------------------------------------- 1 | // Emacs style mode select -*- C++ -*- 2 | //----------------------------------------------------------------------------- 3 | // 4 | // $Id:$ 5 | // 6 | // Copyright (C) 1993-1996 by id Software, Inc. 7 | // 8 | // This source is available for distribution and/or modification 9 | // only under the terms of the DOOM Source Code License as 10 | // published by id Software. All rights reserved. 11 | // 12 | // The source is distributed in the hope that it will be useful, 13 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | // FITNESS FOR A PARTICULAR PURPOSE. See the DOOM Source Code License 15 | // for more details. 16 | // 17 | // $Log:$ 18 | // 19 | // DESCRIPTION: 20 | // 21 | //----------------------------------------------------------------------------- 22 | 23 | //static const char 24 | //rcsid[] = "$Id: m_bbox.c,v 1.1 1997/02/03 22:45:10 b1 Exp $"; 25 | 26 | 27 | #include 28 | #include 29 | #include 30 | 31 | #include 32 | #include 33 | #include 34 | 35 | #include "doomdef.h" 36 | #include "m_misc.h" 37 | #include "i_video.h" 38 | #include "i_sound.h" 39 | 40 | #include "d_net.h" 41 | #include "g_game.h" 42 | 43 | #ifdef __GNUG__ 44 | #pragma implementation "i_system.h" 45 | #endif 46 | #include "i_system.h" 47 | 48 | 49 | #ifdef COMBINE_SCREENS 50 | unsigned char CombinedScreens[SCREENWIDTH*SCREENHEIGHT]; 51 | #else 52 | unsigned char CombinedScreens[SCREENWIDTH*SCREENHEIGHT*4]; 53 | #endif 54 | 55 | 56 | int mb_used = 6; 57 | 58 | 59 | void 60 | I_Tactile 61 | ( int on, 62 | int off, 63 | int total ) 64 | { 65 | // UNUSED. 66 | on = off = total = 0; 67 | } 68 | 69 | ticcmd_t emptycmd; 70 | ticcmd_t* I_BaseTiccmd(void) 71 | { 72 | return &emptycmd; 73 | } 74 | 75 | unsigned char DOOMHeap[FIXED_HEAP]; 76 | 77 | int I_GetHeapSize (void) 78 | { 79 | return FIXED_HEAP; 80 | } 81 | 82 | byte* I_ZoneBase (int* size) 83 | { 84 | *size = FIXED_HEAP; //mb_used*1024*1024; 85 | return (byte *) DOOMHeap; 86 | } 87 | 88 | 89 | 90 | // 91 | // I_GetTime 92 | // returns time in 1/70th second tics 93 | // 94 | int I_GetTime (void) 95 | { 96 | struct timeval tp; 97 | struct timezone tzp; 98 | int newtics; 99 | static int basetime=0; 100 | 101 | gettimeofday(&tp, &tzp); 102 | if (!basetime) 103 | basetime = tp.tv_sec; 104 | newtics = (tp.tv_sec-basetime)*TICRATE + tp.tv_usec*TICRATE/1000000; 105 | return newtics; 106 | } 107 | 108 | 109 | 110 | // 111 | // I_Init 112 | // 113 | void I_Init (void) 114 | { 115 | I_InitSound(); 116 | // I_InitGraphics(); 117 | } 118 | 119 | // 120 | // I_Quit 121 | // 122 | void I_Quit (void) 123 | { 124 | D_QuitNetGame (); 125 | I_ShutdownSound(); 126 | I_ShutdownMusic(); 127 | M_SaveDefaults (); 128 | I_ShutdownGraphics(); 129 | exit(0); 130 | } 131 | 132 | void I_WaitVBL(int count) 133 | { 134 | #ifdef SGI 135 | sginap(1); 136 | #else 137 | #ifdef SUN 138 | sleep(0); 139 | #else 140 | usleep (count * (1000000/700) ); 141 | #endif 142 | #endif 143 | } 144 | 145 | void I_BeginRead(void) 146 | { 147 | } 148 | 149 | void I_EndRead(void) 150 | { 151 | } 152 | 153 | byte* I_AllocLow(int length) 154 | { 155 | byte* mem; 156 | mem = CombinedScreens; 157 | memset (mem,0,length); 158 | return mem; 159 | } 160 | 161 | 162 | // 163 | // I_Error 164 | // 165 | extern boolean demorecording; 166 | 167 | void I_Error (char *error, ...) 168 | { 169 | va_list argptr; 170 | 171 | // Message first. 172 | va_start (argptr,error); 173 | fprintf (stderr, "Error: "); 174 | vfprintf (stderr,error,argptr); 175 | fprintf (stderr, "\n"); 176 | va_end (argptr); 177 | 178 | fflush( stderr ); 179 | 180 | // Shutdown. Here might be other errors. 181 | if (demorecording) 182 | G_CheckDemoStatus(); 183 | 184 | D_QuitNetGame (); 185 | I_ShutdownGraphics(); 186 | 187 | exit(-1); 188 | } 189 | -------------------------------------------------------------------------------- /src/i_system.h: -------------------------------------------------------------------------------- 1 | // Emacs style mode select -*- C++ -*- 2 | //----------------------------------------------------------------------------- 3 | // 4 | // $Id:$ 5 | // 6 | // Copyright (C) 1993-1996 by id Software, Inc. 7 | // 8 | // This source is available for distribution and/or modification 9 | // only under the terms of the DOOM Source Code License as 10 | // published by id Software. All rights reserved. 11 | // 12 | // The source is distributed in the hope that it will be useful, 13 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | // FITNESS FOR A PARTICULAR PURPOSE. See the DOOM Source Code License 15 | // for more details. 16 | // 17 | // DESCRIPTION: 18 | // System specific interface stuff. 19 | // 20 | //----------------------------------------------------------------------------- 21 | 22 | 23 | #ifndef __I_SYSTEM__ 24 | #define __I_SYSTEM__ 25 | 26 | #include "d_ticcmd.h" 27 | #include "d_event.h" 28 | 29 | #ifdef __GNUG__ 30 | #pragma interface 31 | #endif 32 | 33 | 34 | // Called by DoomMain. 35 | void I_Init (void); 36 | 37 | // Called by startup code 38 | // to get the ammount of memory to malloc 39 | // for the zone management. 40 | byte* I_ZoneBase (int *size); 41 | 42 | 43 | // Called by D_DoomLoop, 44 | // returns current time in tics. 45 | int I_GetTime (void); 46 | 47 | 48 | // 49 | // Called by D_DoomLoop, 50 | // called before processing any tics in a frame 51 | // (just after displaying a frame). 52 | // Time consuming syncronous operations 53 | // are performed here (joystick reading). 54 | // Can call D_PostEvent. 55 | // 56 | void I_StartFrame (void); 57 | 58 | 59 | // 60 | // Called by D_DoomLoop, 61 | // called before processing each tic in a frame. 62 | // Quick syncronous operations are performed here. 63 | // Can call D_PostEvent. 64 | void I_StartTic (void); 65 | 66 | // Asynchronous interrupt functions should maintain private queues 67 | // that are read by the synchronous functions 68 | // to be converted into events. 69 | 70 | // Either returns a null ticcmd, 71 | // or calls a loadable driver to build it. 72 | // This ticcmd will then be modified by the gameloop 73 | // for normal input. 74 | ticcmd_t* I_BaseTiccmd (void); 75 | 76 | 77 | // Called by M_Responder when quit is selected. 78 | // Clean exit, displays sell blurb. 79 | void I_Quit (void); 80 | 81 | 82 | // Allocates from low memory under dos, 83 | // just mallocs under unix 84 | byte* I_AllocLow (int length); 85 | 86 | void I_Tactile (int on, int off, int total); 87 | 88 | 89 | void I_Error (char *error, ...); 90 | 91 | 92 | #endif 93 | //----------------------------------------------------------------------------- 94 | // 95 | // $Log:$ 96 | // 97 | //----------------------------------------------------------------------------- 98 | -------------------------------------------------------------------------------- /src/i_video.h: -------------------------------------------------------------------------------- 1 | // Emacs style mode select -*- C++ -*- 2 | //----------------------------------------------------------------------------- 3 | // 4 | // $Id:$ 5 | // 6 | // Copyright (C) 1993-1996 by id Software, Inc. 7 | // 8 | // This source is available for distribution and/or modification 9 | // only under the terms of the DOOM Source Code License as 10 | // published by id Software. All rights reserved. 11 | // 12 | // The source is distributed in the hope that it will be useful, 13 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | // FITNESS FOR A PARTICULAR PURPOSE. See the DOOM Source Code License 15 | // for more details. 16 | // 17 | // DESCRIPTION: 18 | // System specific interface stuff. 19 | // 20 | //----------------------------------------------------------------------------- 21 | 22 | 23 | #ifndef __I_VIDEO__ 24 | #define __I_VIDEO__ 25 | 26 | 27 | #include "doomtype.h" 28 | 29 | #ifdef __GNUG__ 30 | #pragma interface 31 | #endif 32 | 33 | 34 | // Called by D_DoomMain, 35 | // determines the hardware configuration 36 | // and sets up the video mode 37 | void I_InitGraphics (void); 38 | 39 | 40 | void I_ShutdownGraphics(void); 41 | 42 | // Takes full 8 bit values. 43 | void I_SetPalette (byte* palette); 44 | 45 | void I_UpdateNoBlit (void); 46 | void I_FinishUpdate (void); 47 | 48 | // Wait for vertical retrace or pause a bit. 49 | void I_WaitVBL(int count); 50 | 51 | void I_ReadScreen (byte* scr); 52 | 53 | void I_BeginRead (void); 54 | void I_EndRead (void); 55 | 56 | 57 | 58 | #endif 59 | //----------------------------------------------------------------------------- 60 | // 61 | // $Log:$ 62 | // 63 | //----------------------------------------------------------------------------- 64 | -------------------------------------------------------------------------------- /src/m_argv.c: -------------------------------------------------------------------------------- 1 | // Emacs style mode select -*- C++ -*- 2 | //----------------------------------------------------------------------------- 3 | // 4 | // $Id:$ 5 | // 6 | // Copyright (C) 1993-1996 by id Software, Inc. 7 | // 8 | // This source is available for distribution and/or modification 9 | // only under the terms of the DOOM Source Code License as 10 | // published by id Software. All rights reserved. 11 | // 12 | // The source is distributed in the hope that it will be useful, 13 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | // FITNESS FOR A PARTICULAR PURPOSE. See the DOOM Source Code License 15 | // for more details. 16 | // 17 | // $Log:$ 18 | // 19 | // DESCRIPTION: 20 | // 21 | //----------------------------------------------------------------------------- 22 | 23 | //static const char 24 | //rcsid[] = "$Id: m_argv.c,v 1.1 1997/02/03 22:45:10 b1 Exp $"; 25 | 26 | 27 | #include 28 | 29 | int myargc; 30 | char** myargv; 31 | 32 | 33 | 34 | 35 | // 36 | // M_CheckParm 37 | // Checks for the given parameter 38 | // in the program's command line arguments. 39 | // Returns the argument number (1 to argc-1) 40 | // or 0 if not present 41 | int M_CheckParm (char *check) 42 | { 43 | int i; 44 | 45 | for (i = 1;ibox[BOXRIGHT]) 54 | box[BOXRIGHT] = x; 55 | if (ybox[BOXTOP]) 58 | box[BOXTOP] = y; 59 | } 60 | 61 | 62 | 63 | 64 | 65 | -------------------------------------------------------------------------------- /src/m_bbox.h: -------------------------------------------------------------------------------- 1 | // Emacs style mode select -*- C++ -*- 2 | //----------------------------------------------------------------------------- 3 | // 4 | // $Id:$ 5 | // 6 | // Copyright (C) 1993-1996 by id Software, Inc. 7 | // 8 | // This source is available for distribution and/or modification 9 | // only under the terms of the DOOM Source Code License as 10 | // published by id Software. All rights reserved. 11 | // 12 | // The source is distributed in the hope that it will be useful, 13 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | // FITNESS FOR A PARTICULAR PURPOSE. See the DOOM Source Code License 15 | // for more details. 16 | // 17 | // DESCRIPTION: 18 | // Nil. 19 | // 20 | //----------------------------------------------------------------------------- 21 | 22 | 23 | #ifndef __M_BBOX__ 24 | #define __M_BBOX__ 25 | 26 | #include 27 | 28 | #include "m_fixed.h" 29 | 30 | 31 | // Bounding box coordinate storage. 32 | enum 33 | { 34 | BOXTOP, 35 | BOXBOTTOM, 36 | BOXLEFT, 37 | BOXRIGHT 38 | }; // bbox coordinates 39 | 40 | // Bounding box functions. 41 | void M_ClearBox (fixed_t* box); 42 | 43 | void 44 | M_AddToBox 45 | ( fixed_t* box, 46 | fixed_t x, 47 | fixed_t y ); 48 | 49 | 50 | #endif 51 | //----------------------------------------------------------------------------- 52 | // 53 | // $Log:$ 54 | // 55 | //----------------------------------------------------------------------------- 56 | -------------------------------------------------------------------------------- /src/m_cheat.c: -------------------------------------------------------------------------------- 1 | // Emacs style mode select -*- C++ -*- 2 | //----------------------------------------------------------------------------- 3 | // 4 | // $Id:$ 5 | // 6 | // Copyright (C) 1993-1996 by id Software, Inc. 7 | // 8 | // This source is available for distribution and/or modification 9 | // only under the terms of the DOOM Source Code License as 10 | // published by id Software. All rights reserved. 11 | // 12 | // The source is distributed in the hope that it will be useful, 13 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | // FITNESS FOR A PARTICULAR PURPOSE. See the DOOM Source Code License 15 | // for more details. 16 | // 17 | // $Log:$ 18 | // 19 | // DESCRIPTION: 20 | // Cheat sequence checking. 21 | // 22 | //----------------------------------------------------------------------------- 23 | 24 | 25 | //static const char 26 | //rcsid[] = "$Id: m_cheat.c,v 1.1 1997/02/03 21:24:34 b1 Exp $"; 27 | 28 | #include "m_cheat.h" 29 | 30 | // 31 | // CHEAT SEQUENCE PACKAGE 32 | // 33 | 34 | static int firsttime = 1; 35 | static unsigned char cheat_xlate_table[256]; 36 | 37 | 38 | // 39 | // Called in st_stuff module, which handles the input. 40 | // Returns a 1 if the cheat was successful, 0 if failed. 41 | // 42 | int 43 | cht_CheckCheat 44 | ( cheatseq_t* cht, 45 | char key ) 46 | { 47 | int i; 48 | int rc = 0; 49 | 50 | if (firsttime) 51 | { 52 | firsttime = 0; 53 | for (i=0;i<256;i++) cheat_xlate_table[i] = SCRAMBLE(i); 54 | } 55 | 56 | if (!cht->p) 57 | cht->p = cht->sequence; // initialize if first time 58 | 59 | if (*cht->p == 0) 60 | *(cht->p++) = key; 61 | else if 62 | (cheat_xlate_table[(unsigned char)key] == *cht->p) cht->p++; 63 | else 64 | cht->p = cht->sequence; 65 | 66 | if (*cht->p == 1) 67 | cht->p++; 68 | else if (*cht->p == 0xff) // end of sequence character 69 | { 70 | cht->p = cht->sequence; 71 | rc = 1; 72 | } 73 | 74 | return rc; 75 | } 76 | 77 | void 78 | cht_GetParam 79 | ( cheatseq_t* cht, 80 | char* buffer ) 81 | { 82 | 83 | unsigned char *p, c; 84 | 85 | p = cht->sequence; 86 | while (*(p++) != 1); 87 | 88 | do 89 | { 90 | c = *p; 91 | *(buffer++) = c; 92 | *(p++) = 0; 93 | } 94 | while (c && *p!=0xff ); 95 | 96 | if (*p==0xff) 97 | *buffer = 0; 98 | 99 | } 100 | 101 | 102 | -------------------------------------------------------------------------------- /src/m_cheat.h: -------------------------------------------------------------------------------- 1 | // Emacs style mode select -*- C++ -*- 2 | //----------------------------------------------------------------------------- 3 | // 4 | // $Id:$ 5 | // 6 | // Copyright (C) 1993-1996 by id Software, Inc. 7 | // 8 | // This source is available for distribution and/or modification 9 | // only under the terms of the DOOM Source Code License as 10 | // published by id Software. All rights reserved. 11 | // 12 | // The source is distributed in the hope that it will be useful, 13 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | // FITNESS FOR A PARTICULAR PURPOSE. See the DOOM Source Code License 15 | // for more details. 16 | // 17 | // DESCRIPTION: 18 | // Cheat code checking. 19 | // 20 | //----------------------------------------------------------------------------- 21 | 22 | 23 | #ifndef __M_CHEAT__ 24 | #define __M_CHEAT__ 25 | 26 | // 27 | // CHEAT SEQUENCE PACKAGE 28 | // 29 | 30 | #define SCRAMBLE(a) \ 31 | ((((a)&1)<<7) + (((a)&2)<<5) + ((a)&4) + (((a)&8)<<1) \ 32 | + (((a)&16)>>1) + ((a)&32) + (((a)&64)>>5) + (((a)&128)>>7)) 33 | 34 | typedef struct 35 | { 36 | unsigned char* sequence; 37 | unsigned char* p; 38 | 39 | } cheatseq_t; 40 | 41 | int 42 | cht_CheckCheat 43 | ( cheatseq_t* cht, 44 | char key ); 45 | 46 | 47 | void 48 | cht_GetParam 49 | ( cheatseq_t* cht, 50 | char* buffer ); 51 | 52 | 53 | #endif 54 | //----------------------------------------------------------------------------- 55 | // 56 | // $Log:$ 57 | // 58 | //----------------------------------------------------------------------------- 59 | -------------------------------------------------------------------------------- /src/m_fixed.c: -------------------------------------------------------------------------------- 1 | // Emacs style mode select -*- C++ -*- 2 | //----------------------------------------------------------------------------- 3 | // 4 | // $Id:$ 5 | // 6 | // Copyright (C) 1993-1996 by id Software, Inc. 7 | // 8 | // This source is available for distribution and/or modification 9 | // only under the terms of the DOOM Source Code License as 10 | // published by id Software. All rights reserved. 11 | // 12 | // The source is distributed in the hope that it will be useful, 13 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | // FITNESS FOR A PARTICULAR PURPOSE. See the DOOM Source Code License 15 | // for more details. 16 | // 17 | // $Log:$ 18 | // 19 | // DESCRIPTION: 20 | // Fixed point implementation. 21 | // 22 | //----------------------------------------------------------------------------- 23 | 24 | 25 | //static const char 26 | //rcsid[] = "$Id: m_bbox.c,v 1.1 1997/02/03 22:45:10 b1 Exp $"; 27 | 28 | #include "stdlib.h" 29 | 30 | #include "doomtype.h" 31 | #include "i_system.h" 32 | 33 | #ifdef __GNUG__ 34 | #pragma implementation "m_fixed.h" 35 | #endif 36 | #include "m_fixed.h" 37 | 38 | 39 | 40 | 41 | // Fixme. __USE_C_FIXED__ or something. 42 | 43 | fixed_t 44 | FixedMul 45 | ( fixed_t a, 46 | fixed_t b ) 47 | { 48 | return ((long long) a * (long long) b) >> FRACBITS; 49 | } 50 | 51 | 52 | 53 | // 54 | // FixedDiv, C version. 55 | // 56 | 57 | fixed_t 58 | FixedDiv 59 | ( fixed_t a, 60 | fixed_t b ) 61 | { 62 | if ( (abs(a)>>14) >= abs(b)) 63 | return (a^b)<0 ? MININT : MAXINT; 64 | return FixedDiv2 (a,b); 65 | } 66 | 67 | 68 | 69 | fixed_t 70 | FixedDiv2 71 | ( fixed_t a, 72 | fixed_t b ) 73 | { 74 | #if 0 75 | long long c; 76 | c = ((long long)a<<16) / ((long long)b); 77 | return (fixed_t) c; 78 | #endif 79 | 80 | double c; 81 | 82 | c = ((double)a) / ((double)b) * FRACUNIT; 83 | 84 | if (c >= 2147483648.0 || c < -2147483648.0) 85 | I_Error("FixedDiv: divide by zero"); 86 | return (fixed_t) c; 87 | } 88 | -------------------------------------------------------------------------------- /src/m_fixed.h: -------------------------------------------------------------------------------- 1 | // Emacs style mode select -*- C++ -*- 2 | //----------------------------------------------------------------------------- 3 | // 4 | // $Id:$ 5 | // 6 | // Copyright (C) 1993-1996 by id Software, Inc. 7 | // 8 | // This source is available for distribution and/or modification 9 | // only under the terms of the DOOM Source Code License as 10 | // published by id Software. All rights reserved. 11 | // 12 | // The source is distributed in the hope that it will be useful, 13 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | // FITNESS FOR A PARTICULAR PURPOSE. See the DOOM Source Code License 15 | // for more details. 16 | // 17 | // DESCRIPTION: 18 | // Fixed point arithemtics, implementation. 19 | // 20 | //----------------------------------------------------------------------------- 21 | 22 | 23 | #ifndef __M_FIXED__ 24 | #define __M_FIXED__ 25 | 26 | 27 | #ifdef __GNUG__ 28 | #pragma interface 29 | #endif 30 | 31 | 32 | // 33 | // Fixed point, 32bit as 16.16. 34 | // 35 | #define FRACBITS 16 36 | #define FRACUNIT (1<>8) | (x<<8); 42 | } 43 | 44 | // Swapping 32bit. 45 | unsigned long SwapLONG( unsigned long x) 46 | { 47 | return 48 | (x>>24) 49 | | ((x>>8) & 0xff00) 50 | | ((x<<8) & 0xff0000) 51 | | (x<<24); 52 | } 53 | 54 | 55 | #endif 56 | 57 | 58 | -------------------------------------------------------------------------------- /src/m_swap.h: -------------------------------------------------------------------------------- 1 | // Emacs style mode select -*- C++ -*- 2 | //----------------------------------------------------------------------------- 3 | // 4 | // $Id:$ 5 | // 6 | // Copyright (C) 1993-1996 by id Software, Inc. 7 | // 8 | // This source is available for distribution and/or modification 9 | // only under the terms of the DOOM Source Code License as 10 | // published by id Software. All rights reserved. 11 | // 12 | // The source is distributed in the hope that it will be useful, 13 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | // FITNESS FOR A PARTICULAR PURPOSE. See the DOOM Source Code License 15 | // for more details. 16 | // 17 | // DESCRIPTION: 18 | // Endianess handling, swapping 16bit and 32bit. 19 | // 20 | //----------------------------------------------------------------------------- 21 | 22 | 23 | #ifndef __M_SWAP__ 24 | #define __M_SWAP__ 25 | 26 | 27 | #ifdef __GNUG__ 28 | #pragma interface 29 | #endif 30 | 31 | 32 | // Endianess handling. 33 | // WAD files are stored little endian. 34 | #ifdef __BIG_ENDIAN__ 35 | short SwapSHORT(short); 36 | long SwapLONG(long); 37 | #define SHORT(x) ((short)SwapSHORT((unsigned short) (x))) 38 | #define LONG(x) ((long)SwapLONG((unsigned long) (x))) 39 | #else 40 | #define SHORT(x) (x) 41 | #define LONG(x) (x) 42 | #endif 43 | 44 | 45 | 46 | 47 | #endif 48 | //----------------------------------------------------------------------------- 49 | // 50 | // $Log:$ 51 | // 52 | //----------------------------------------------------------------------------- 53 | -------------------------------------------------------------------------------- /src/os_generic.h: -------------------------------------------------------------------------------- 1 | #ifndef _OS_GENERIC_H 2 | #define _OS_GENERIC_H 3 | 4 | #ifdef WIN32 5 | #define USE_WINDOWS 6 | #endif 7 | 8 | 9 | #ifdef __cplusplus 10 | extern "C" { 11 | #endif 12 | 13 | //Things that shouldn't be macro'd 14 | double OGGetAbsoluteTime(); 15 | void OGSleep( int is ); 16 | void OGUSleep( int ius ); 17 | double OGGetFileTime( const char * file ); 18 | 19 | //Threads and Mutices 20 | typedef void* og_thread_t; 21 | typedef void* og_mutex_t; 22 | typedef void* og_sema_t; 23 | 24 | og_thread_t OGCreateThread( void * (routine)( void * ), void * parameter ); 25 | void * OGJoinThread( og_thread_t ot ); 26 | void OGCancelThread( og_thread_t ot ); 27 | 28 | //Always a recrusive mutex. 29 | og_mutex_t OGCreateMutex(); 30 | void OGLockMutex( og_mutex_t om ); 31 | void OGUnlockMutex( og_mutex_t om ); 32 | void OGDeleteMutex( og_mutex_t om ); 33 | 34 | //Always a semaphore 35 | og_sema_t OGCreateSema(); //Create a semaphore, comes locked initially. NOTE: Max count is 32767 36 | void OGLockSema( og_sema_t os ); 37 | int OGGetSema( og_sema_t os ); //if <0 there was a failure. 38 | void OGUnlockSema( og_sema_t os ); 39 | void OGDeleteSema( og_sema_t os ); 40 | 41 | #ifdef __cplusplus 42 | }; 43 | #endif 44 | 45 | 46 | 47 | #endif 48 | 49 | 50 | //Date Stamp: 2012-02-15 51 | 52 | /* 53 | NOTE: Portions (namely the top section) are part of headers from other 54 | sources. 55 | 56 | Copyright (c) 2011-2012 <>< Charles Lohr 57 | 58 | Permission is hereby granted, free of charge, to any person obtaining a 59 | copy of this software and associated documentation files (the "Software"), 60 | to deal in the Software without restriction, including without limitation 61 | the rights to use, copy, modify, merge, publish, distribute, sublicense, 62 | and/or sell copies of the Software, and to permit persons to whom the 63 | Software is furnished to do so, subject to the following conditions: 64 | 65 | The above copyright notice and this permission notice shall be included in 66 | all copies or substantial portions of this file. 67 | 68 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 69 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 70 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 71 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 72 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 73 | FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS 74 | IN THE SOFTWARE. 75 | */ 76 | 77 | -------------------------------------------------------------------------------- /src/p_inter.h: -------------------------------------------------------------------------------- 1 | // Emacs style mode select -*- C++ -*- 2 | //----------------------------------------------------------------------------- 3 | // 4 | // $Id:$ 5 | // 6 | // Copyright (C) 1993-1996 by id Software, Inc. 7 | // 8 | // This source is available for distribution and/or modification 9 | // only under the terms of the DOOM Source Code License as 10 | // published by id Software. All rights reserved. 11 | // 12 | // The source is distributed in the hope that it will be useful, 13 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | // FITNESS FOR A PARTICULAR PURPOSE. See the DOOM Source Code License 15 | // for more details. 16 | // 17 | // DESCRIPTION: 18 | // 19 | // 20 | //----------------------------------------------------------------------------- 21 | 22 | 23 | #ifndef __P_INTER__ 24 | #define __P_INTER__ 25 | 26 | 27 | #ifdef __GNUG__ 28 | #pragma interface 29 | #endif 30 | 31 | 32 | boolean P_GivePower(player_t*, int); 33 | 34 | 35 | 36 | #endif 37 | //----------------------------------------------------------------------------- 38 | // 39 | // $Log:$ 40 | // 41 | //----------------------------------------------------------------------------- 42 | -------------------------------------------------------------------------------- /src/p_pspr.h: -------------------------------------------------------------------------------- 1 | // Emacs style mode select -*- C++ -*- 2 | //----------------------------------------------------------------------------- 3 | // 4 | // $Id:$ 5 | // 6 | // Copyright (C) 1993-1996 by id Software, Inc. 7 | // 8 | // This source is available for distribution and/or modification 9 | // only under the terms of the DOOM Source Code License as 10 | // published by id Software. All rights reserved. 11 | // 12 | // The source is distributed in the hope that it will be useful, 13 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | // FITNESS FOR A PARTICULAR PURPOSE. See the DOOM Source Code License 15 | // for more details. 16 | // 17 | // DESCRIPTION: 18 | // Sprite animation. 19 | // 20 | //----------------------------------------------------------------------------- 21 | 22 | 23 | #ifndef __P_PSPR__ 24 | #define __P_PSPR__ 25 | 26 | // Basic data types. 27 | // Needs fixed point, and BAM angles. 28 | #include "m_fixed.h" 29 | #include "tables.h" 30 | 31 | 32 | // 33 | // Needs to include the precompiled 34 | // sprite animation tables. 35 | // Header generated by multigen utility. 36 | // This includes all the data for thing animation, 37 | // i.e. the Thing Atrributes table 38 | // and the Frame Sequence table. 39 | #include "info.h" 40 | 41 | #ifdef __GNUG__ 42 | #pragma interface 43 | #endif 44 | 45 | 46 | // 47 | // Frame flags: 48 | // handles maximum brightness (torches, muzzle flare, light sources) 49 | // 50 | #define FF_FULLBRIGHT 0x8000 // flag in thing->frame 51 | #define FF_FRAMEMASK 0x7fff 52 | 53 | 54 | 55 | // 56 | // Overlay psprites are scaled shapes 57 | // drawn directly on the view screen, 58 | // coordinates are given for a 320*200 view screen. 59 | // 60 | typedef enum 61 | { 62 | ps_weapon, 63 | ps_flash, 64 | NUMPSPRITES 65 | 66 | } psprnum_t; 67 | 68 | typedef struct 69 | { 70 | state_t* state; // a NULL state means not active 71 | int tics; 72 | fixed_t sx; 73 | fixed_t sy; 74 | 75 | } pspdef_t; 76 | 77 | #endif 78 | //----------------------------------------------------------------------------- 79 | // 80 | // $Log:$ 81 | // 82 | //----------------------------------------------------------------------------- 83 | -------------------------------------------------------------------------------- /src/p_saveg.h: -------------------------------------------------------------------------------- 1 | // Emacs style mode select -*- C++ -*- 2 | //----------------------------------------------------------------------------- 3 | // 4 | // $Id:$ 5 | // 6 | // Copyright (C) 1993-1996 by id Software, Inc. 7 | // 8 | // This source is available for distribution and/or modification 9 | // only under the terms of the DOOM Source Code License as 10 | // published by id Software. All rights reserved. 11 | // 12 | // The source is distributed in the hope that it will be useful, 13 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | // FITNESS FOR A PARTICULAR PURPOSE. See the DOOM Source Code License 15 | // for more details. 16 | // 17 | // DESCRIPTION: 18 | // Savegame I/O, archiving, persistence. 19 | // 20 | //----------------------------------------------------------------------------- 21 | 22 | 23 | #ifndef __P_SAVEG__ 24 | #define __P_SAVEG__ 25 | 26 | 27 | #ifdef __GNUG__ 28 | #pragma interface 29 | #endif 30 | 31 | 32 | // Persistent storage/archiving. 33 | // These are the load / save game routines. 34 | void P_ArchivePlayers (void); 35 | void P_UnArchivePlayers (void); 36 | void P_ArchiveWorld (void); 37 | void P_UnArchiveWorld (void); 38 | void P_ArchiveThinkers (void); 39 | void P_UnArchiveThinkers (void); 40 | void P_ArchiveSpecials (void); 41 | void P_UnArchiveSpecials (void); 42 | 43 | extern byte* save_p; 44 | 45 | 46 | #endif 47 | //----------------------------------------------------------------------------- 48 | // 49 | // $Log:$ 50 | // 51 | //----------------------------------------------------------------------------- 52 | -------------------------------------------------------------------------------- /src/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 | void * 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 | -------------------------------------------------------------------------------- /src/p_telept.c: -------------------------------------------------------------------------------- 1 | // Emacs style mode select -*- C++ -*- 2 | //----------------------------------------------------------------------------- 3 | // 4 | // $Id:$ 5 | // 6 | // Copyright (C) 1993-1996 by id Software, Inc. 7 | // 8 | // This source is available for distribution and/or modification 9 | // only under the terms of the DOOM Source Code License as 10 | // published by id Software. All rights reserved. 11 | // 12 | // The source is distributed in the hope that it will be useful, 13 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | // FITNESS FOR A PARTICULAR PURPOSE. See the DOOM Source Code License 15 | // for more details. 16 | // 17 | // $Log:$ 18 | // 19 | // DESCRIPTION: 20 | // Teleportation. 21 | // 22 | //----------------------------------------------------------------------------- 23 | 24 | //static const char 25 | //rcsid[] = "$Id: p_telept.c,v 1.3 1997/01/28 22:08:29 b1 Exp $"; 26 | 27 | 28 | 29 | #include "doomdef.h" 30 | 31 | #include "s_sound.h" 32 | 33 | #include "p_local.h" 34 | 35 | 36 | // Data. 37 | #include "sounds.h" 38 | 39 | // State. 40 | #include "r_state.h" 41 | 42 | 43 | 44 | // 45 | // TELEPORTATION 46 | // 47 | int 48 | EV_Teleport 49 | ( line_t* line, 50 | int side, 51 | mobj_t* thing ) 52 | { 53 | int i; 54 | int tag; 55 | mobj_t* m; 56 | mobj_t* fog; 57 | unsigned an; 58 | thinker_t* thinker; 59 | sector_t* sector; 60 | fixed_t oldx; 61 | fixed_t oldy; 62 | fixed_t oldz; 63 | 64 | // don't teleport missiles 65 | if (thing->flags & MF_MISSILE) 66 | return 0; 67 | 68 | // Don't teleport if hit back of line, 69 | // so you can get out of teleporter. 70 | if (side == 1) 71 | return 0; 72 | 73 | 74 | tag = line->tag; 75 | for (i = 0; i < numsectors; i++) 76 | { 77 | if (sectors[ i ].tag == tag ) 78 | { 79 | thinker = thinkercap.next; 80 | for (thinker = thinkercap.next; 81 | thinker != &thinkercap; 82 | thinker = thinker->next) 83 | { 84 | // not a mobj 85 | if (thinker->function.acp1 != (actionf_p1)P_MobjThinker) 86 | continue; 87 | 88 | m = (mobj_t *)thinker; 89 | 90 | // not a teleportman 91 | if (m->type != MT_TELEPORTMAN ) 92 | continue; 93 | 94 | sector = m->subsector->sector; 95 | // wrong sector 96 | if (sector-sectors != i ) 97 | continue; 98 | 99 | oldx = thing->x; 100 | oldy = thing->y; 101 | oldz = thing->z; 102 | 103 | if (!P_TeleportMove (thing, m->x, m->y)) 104 | return 0; 105 | 106 | thing->z = thing->floorz; //fixme: not needed? 107 | if (thing->player) 108 | thing->player->viewz = thing->z+thing->player->viewheight; 109 | 110 | // spawn teleport fog at source and destination 111 | fog = P_SpawnMobj (oldx, oldy, oldz, MT_TFOG); 112 | S_StartSound (fog, sfx_telept); 113 | an = m->angle >> ANGLETOFINESHIFT; 114 | fog = P_SpawnMobj (m->x+20*finecosine[an], m->y+20*finesine[an] 115 | , thing->z, MT_TFOG); 116 | 117 | // emit sound, where? 118 | S_StartSound (fog, sfx_telept); 119 | 120 | // don't move for a bit 121 | if (thing->player) 122 | thing->reactiontime = 18; 123 | 124 | thing->angle = m->angle; 125 | thing->momx = thing->momy = thing->momz = 0; 126 | return 1; 127 | } 128 | } 129 | } 130 | return 0; 131 | } 132 | 133 | -------------------------------------------------------------------------------- /src/p_tick.c: -------------------------------------------------------------------------------- 1 | // Emacs style mode select -*- C++ -*- 2 | //----------------------------------------------------------------------------- 3 | // 4 | // $Id:$ 5 | // 6 | // Copyright (C) 1993-1996 by id Software, Inc. 7 | // 8 | // This source is available for distribution and/or modification 9 | // only under the terms of the DOOM Source Code License as 10 | // published by id Software. All rights reserved. 11 | // 12 | // The source is distributed in the hope that it will be useful, 13 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | // FITNESS FOR A PARTICULAR PURPOSE. See the DOOM Source Code License 15 | // for more details. 16 | // 17 | // $Log:$ 18 | // 19 | // DESCRIPTION: 20 | // Archiving: SaveGame I/O. 21 | // Thinker, Ticker. 22 | // 23 | //----------------------------------------------------------------------------- 24 | 25 | //static const char 26 | //rcsid[] = "$Id: p_tick.c,v 1.4 1997/02/03 16:47:55 b1 Exp $"; 27 | 28 | #include "z_zone.h" 29 | #include "p_local.h" 30 | 31 | #include "doomstat.h" 32 | 33 | 34 | int leveltime; 35 | 36 | // 37 | // THINKERS 38 | // All thinkers should be allocated by Z_Malloc 39 | // so they can be operated on uniformly. 40 | // The actual structures will vary in size, 41 | // but the first element must be thinker_t. 42 | // 43 | 44 | 45 | 46 | // Both the head and tail of the thinker list. 47 | thinker_t thinkercap; 48 | 49 | 50 | // 51 | // P_InitThinkers 52 | // 53 | void P_InitThinkers (void) 54 | { 55 | thinkercap.prev = thinkercap.next = &thinkercap; 56 | } 57 | 58 | 59 | 60 | 61 | // 62 | // P_AddThinker 63 | // Adds a new thinker at the end of the list. 64 | // 65 | void P_AddThinker (thinker_t* thinker) 66 | { 67 | thinkercap.prev->next = thinker; 68 | thinker->next = &thinkercap; 69 | thinker->prev = thinkercap.prev; 70 | thinkercap.prev = thinker; 71 | } 72 | 73 | 74 | 75 | // 76 | // P_RemoveThinker 77 | // Deallocation is lazy -- it will not actually be freed 78 | // until its thinking turn comes up. 79 | // 80 | void P_RemoveThinker (thinker_t* thinker) 81 | { 82 | // FIXME: NOP. 83 | thinker->function.acv = (actionf_v)(-1); 84 | } 85 | 86 | 87 | 88 | // 89 | // P_AllocateThinker 90 | // Allocates memory and adds a new thinker at the end of the list. 91 | // 92 | void P_AllocateThinker (thinker_t* thinker) 93 | { 94 | } 95 | 96 | 97 | 98 | // 99 | // P_RunThinkers 100 | // 101 | void P_RunThinkers (void) 102 | { 103 | thinker_t* currentthinker; 104 | 105 | currentthinker = thinkercap.next; 106 | while (currentthinker != &thinkercap) 107 | { 108 | if ( currentthinker->function.acv == (actionf_v)(-1) ) 109 | { 110 | // time to remove it 111 | currentthinker->next->prev = currentthinker->prev; 112 | currentthinker->prev->next = currentthinker->next; 113 | Z_Free (currentthinker); 114 | } 115 | else 116 | { 117 | if (currentthinker->function.acp1) 118 | currentthinker->function.acp1 (currentthinker); 119 | } 120 | currentthinker = currentthinker->next; 121 | } 122 | } 123 | 124 | 125 | 126 | // 127 | // P_Ticker 128 | // 129 | 130 | void P_Ticker (void) 131 | { 132 | int i; 133 | 134 | // run the tic 135 | if (paused) 136 | return; 137 | 138 | // pause if in menu and at least one tic has been run 139 | if ( !netgame 140 | && menuactive 141 | && !demoplayback 142 | && players[consoleplayer].viewz != 1) 143 | { 144 | return; 145 | } 146 | 147 | 148 | for (i=0 ; i 56 | // using from sounds.h 57 | // 58 | void 59 | S_StartSound 60 | ( void* origin, 61 | int sound_id ); 62 | 63 | 64 | 65 | // Will start a sound at a given volume. 66 | void 67 | S_StartSoundAtVolume 68 | ( void* origin, 69 | int sound_id, 70 | int volume ); 71 | 72 | 73 | // Stop sound for thing at 74 | void S_StopSound(void* origin); 75 | 76 | 77 | // Start music using from sounds.h 78 | void S_StartMusic(int music_id); 79 | 80 | // Start music using from sounds.h, 81 | // and set whether looping 82 | void 83 | S_ChangeMusic 84 | ( int music_id, 85 | int looping ); 86 | 87 | // Stops the music fer sure. 88 | void S_StopMusic(void); 89 | 90 | // Stop and resume music, during game PAUSE. 91 | void S_PauseSound(void); 92 | void S_ResumeSound(void); 93 | 94 | 95 | // 96 | // Updates music & sounds 97 | // 98 | void S_UpdateSounds(void* listener); 99 | 100 | void S_SetMusicVolume(int volume); 101 | void S_SetSfxVolume(int volume); 102 | 103 | 104 | #endif 105 | //----------------------------------------------------------------------------- 106 | // 107 | // $Log:$ 108 | // 109 | //----------------------------------------------------------------------------- 110 | -------------------------------------------------------------------------------- /src/sounds.h: -------------------------------------------------------------------------------- 1 | // Emacs style mode select -*- C++ -*- 2 | //----------------------------------------------------------------------------- 3 | // 4 | // $Id:$ 5 | // 6 | // Copyright (C) 1993-1996 by id Software, Inc. 7 | // 8 | // This source is available for distribution and/or modification 9 | // only under the terms of the DOOM Source Code License as 10 | // published by id Software. All rights reserved. 11 | // 12 | // The source is distributed in the hope that it will be useful, 13 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | // FITNESS FOR A PARTICULAR PURPOSE. See the DOOM Source Code License 15 | // for more details. 16 | // 17 | // DESCRIPTION: 18 | // Created by the sound utility written by Dave Taylor. 19 | // Kept as a sample, DOOM2 sounds. Frozen. 20 | // 21 | //----------------------------------------------------------------------------- 22 | 23 | #ifndef __SOUNDS__ 24 | #define __SOUNDS__ 25 | 26 | 27 | // 28 | // SoundFX struct. 29 | // 30 | typedef struct sfxinfo_struct sfxinfo_t; 31 | 32 | struct sfxinfo_struct 33 | { 34 | // up to 6-character name 35 | char* name; 36 | 37 | // Sfx singularity (only one at a time) 38 | int singularity; 39 | 40 | // Sfx priority 41 | int priority; 42 | 43 | // referenced sound if a link 44 | sfxinfo_t* link; 45 | 46 | // pitch if a link 47 | int pitch; 48 | 49 | // volume if a link 50 | int volume; 51 | 52 | // sound data 53 | void* data; 54 | 55 | // this is checked every second to see if sound 56 | // can be thrown out (if 0, then decrement, if -1, 57 | // then throw out, if > 0, then it is in use) 58 | int usefulness; 59 | 60 | // lump number of sfx 61 | int lumpnum; 62 | }; 63 | 64 | 65 | 66 | 67 | // 68 | // MusicInfo struct. 69 | // 70 | typedef struct 71 | { 72 | // up to 6-character name 73 | char* name; 74 | 75 | // lump number of music 76 | int lumpnum; 77 | 78 | // music data 79 | void* data; 80 | 81 | // music handle once registered 82 | int handle; 83 | 84 | } musicinfo_t; 85 | 86 | 87 | 88 | 89 | // the complete set of sound effects 90 | extern sfxinfo_t S_sfx[]; 91 | 92 | // the complete set of music 93 | extern musicinfo_t S_music[]; 94 | 95 | // 96 | // Identifiers for all music in game. 97 | // 98 | 99 | typedef enum 100 | { 101 | mus_None, 102 | mus_e1m1, 103 | mus_e1m2, 104 | mus_e1m3, 105 | mus_e1m4, 106 | mus_e1m5, 107 | mus_e1m6, 108 | mus_e1m7, 109 | mus_e1m8, 110 | mus_e1m9, 111 | mus_e2m1, 112 | mus_e2m2, 113 | mus_e2m3, 114 | mus_e2m4, 115 | mus_e2m5, 116 | mus_e2m6, 117 | mus_e2m7, 118 | mus_e2m8, 119 | mus_e2m9, 120 | mus_e3m1, 121 | mus_e3m2, 122 | mus_e3m3, 123 | mus_e3m4, 124 | mus_e3m5, 125 | mus_e3m6, 126 | mus_e3m7, 127 | mus_e3m8, 128 | mus_e3m9, 129 | mus_inter, 130 | mus_intro, 131 | mus_bunny, 132 | mus_victor, 133 | mus_introa, 134 | mus_runnin, 135 | mus_stalks, 136 | mus_countd, 137 | mus_betwee, 138 | mus_doom, 139 | mus_the_da, 140 | mus_shawn, 141 | mus_ddtblu, 142 | mus_in_cit, 143 | mus_dead, 144 | mus_stlks2, 145 | mus_theda2, 146 | mus_doom2, 147 | mus_ddtbl2, 148 | mus_runni2, 149 | mus_dead2, 150 | mus_stlks3, 151 | mus_romero, 152 | mus_shawn2, 153 | mus_messag, 154 | mus_count2, 155 | mus_ddtbl3, 156 | mus_ampie, 157 | mus_theda3, 158 | mus_adrian, 159 | mus_messg2, 160 | mus_romer2, 161 | mus_tense, 162 | mus_shawn3, 163 | mus_openin, 164 | mus_evil, 165 | mus_ultima, 166 | mus_read_m, 167 | mus_dm2ttl, 168 | mus_dm2int, 169 | NUMMUSIC 170 | } musicenum_t; 171 | 172 | 173 | // 174 | // Identifiers for all sfx in game. 175 | // 176 | 177 | typedef enum 178 | { 179 | sfx_None, 180 | sfx_pistol, 181 | sfx_shotgn, 182 | sfx_sgcock, 183 | sfx_dshtgn, 184 | sfx_dbopn, 185 | sfx_dbcls, 186 | sfx_dbload, 187 | sfx_plasma, 188 | sfx_bfg, 189 | sfx_sawup, 190 | sfx_sawidl, 191 | sfx_sawful, 192 | sfx_sawhit, 193 | sfx_rlaunc, 194 | sfx_rxplod, 195 | sfx_firsht, 196 | sfx_firxpl, 197 | sfx_pstart, 198 | sfx_pstop, 199 | sfx_doropn, 200 | sfx_dorcls, 201 | sfx_stnmov, 202 | sfx_swtchn, 203 | sfx_swtchx, 204 | sfx_plpain, 205 | sfx_dmpain, 206 | sfx_popain, 207 | sfx_vipain, 208 | sfx_mnpain, 209 | sfx_pepain, 210 | sfx_slop, 211 | sfx_itemup, 212 | sfx_wpnup, 213 | sfx_oof, 214 | sfx_telept, 215 | sfx_posit1, 216 | sfx_posit2, 217 | sfx_posit3, 218 | sfx_bgsit1, 219 | sfx_bgsit2, 220 | sfx_sgtsit, 221 | sfx_cacsit, 222 | sfx_brssit, 223 | sfx_cybsit, 224 | sfx_spisit, 225 | sfx_bspsit, 226 | sfx_kntsit, 227 | sfx_vilsit, 228 | sfx_mansit, 229 | sfx_pesit, 230 | sfx_sklatk, 231 | sfx_sgtatk, 232 | sfx_skepch, 233 | sfx_vilatk, 234 | sfx_claw, 235 | sfx_skeswg, 236 | sfx_pldeth, 237 | sfx_pdiehi, 238 | sfx_podth1, 239 | sfx_podth2, 240 | sfx_podth3, 241 | sfx_bgdth1, 242 | sfx_bgdth2, 243 | sfx_sgtdth, 244 | sfx_cacdth, 245 | sfx_skldth, 246 | sfx_brsdth, 247 | sfx_cybdth, 248 | sfx_spidth, 249 | sfx_bspdth, 250 | sfx_vildth, 251 | sfx_kntdth, 252 | sfx_pedth, 253 | sfx_skedth, 254 | sfx_posact, 255 | sfx_bgact, 256 | sfx_dmact, 257 | sfx_bspact, 258 | sfx_bspwlk, 259 | sfx_vilact, 260 | sfx_noway, 261 | sfx_barexp, 262 | sfx_punch, 263 | sfx_hoof, 264 | sfx_metal, 265 | sfx_chgun, 266 | sfx_tink, 267 | sfx_bdopn, 268 | sfx_bdcls, 269 | sfx_itmbk, 270 | sfx_flame, 271 | sfx_flamst, 272 | sfx_getpow, 273 | sfx_bospit, 274 | sfx_boscub, 275 | sfx_bossit, 276 | sfx_bospn, 277 | sfx_bosdth, 278 | sfx_manatk, 279 | sfx_mandth, 280 | sfx_sssit, 281 | sfx_ssdth, 282 | sfx_keenpn, 283 | sfx_keendt, 284 | sfx_skeact, 285 | sfx_skesit, 286 | sfx_skeatk, 287 | sfx_radio, 288 | NUMSFX 289 | } sfxenum_t; 290 | 291 | #endif 292 | //----------------------------------------------------------------------------- 293 | // 294 | // $Log:$ 295 | // 296 | //----------------------------------------------------------------------------- 297 | 298 | -------------------------------------------------------------------------------- /src/st_lib.c: -------------------------------------------------------------------------------- 1 | // Emacs style mode select -*- C++ -*- 2 | //----------------------------------------------------------------------------- 3 | // 4 | // $Id:$ 5 | // 6 | // Copyright (C) 1993-1996 by id Software, Inc. 7 | // 8 | // This source is available for distribution and/or modification 9 | // only under the terms of the DOOM Source Code License as 10 | // published by id Software. All rights reserved. 11 | // 12 | // The source is distributed in the hope that it will be useful, 13 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | // FITNESS FOR A PARTICULAR PURPOSE. See the DOOM Source Code License 15 | // for more details. 16 | // 17 | // $Log:$ 18 | // 19 | // DESCRIPTION: 20 | // The status bar widget code. 21 | // 22 | //----------------------------------------------------------------------------- 23 | 24 | 25 | //static const char 26 | //rcsid[] = "$Id: st_lib.c,v 1.4 1997/02/03 16:47:56 b1 Exp $"; 27 | 28 | #include 29 | 30 | #include "doomdef.h" 31 | 32 | #include "z_zone.h" 33 | #include "v_video.h" 34 | 35 | #include "m_swap.h" 36 | 37 | #include "i_system.h" 38 | 39 | #include "w_wad.h" 40 | 41 | #include "st_stuff.h" 42 | #include "st_lib.h" 43 | #include "r_local.h" 44 | 45 | 46 | // in AM_map.c 47 | extern boolean automapactive; 48 | 49 | 50 | 51 | 52 | // 53 | // Hack display negative frags. 54 | // Loads and store the stminus lump. 55 | // 56 | patch_t* sttminus; 57 | 58 | void STlib_init(void) 59 | { 60 | sttminus = (patch_t *) W_CacheLumpName("STTMINUS", PU_STATIC); 61 | } 62 | 63 | 64 | // ? 65 | void 66 | STlib_initNum 67 | ( st_number_t* n, 68 | int x, 69 | int y, 70 | patch_t** pl, 71 | int* num, 72 | boolean* on, 73 | int width ) 74 | { 75 | n->x = x; 76 | n->y = y; 77 | n->oldnum = 0; 78 | n->width = width; 79 | n->num = num; 80 | n->on = on; 81 | n->p = pl; 82 | } 83 | 84 | 85 | // 86 | // A fairly efficient way to draw a number 87 | // based on differences from the old number. 88 | // Note: worth the trouble? 89 | // 90 | void 91 | STlib_drawNum 92 | ( st_number_t* n, 93 | boolean refresh ) 94 | { 95 | 96 | int numdigits = n->width; 97 | int num = *n->num; 98 | 99 | int w = SHORT(n->p[0]->width); 100 | int h = SHORT(n->p[0]->height); 101 | int x = n->x; 102 | 103 | int neg; 104 | 105 | n->oldnum = *n->num; 106 | 107 | neg = num < 0; 108 | 109 | if (neg) 110 | { 111 | if (numdigits == 2 && num < -9) 112 | num = -9; 113 | else if (numdigits == 3 && num < -99) 114 | num = -99; 115 | 116 | num = -num; 117 | } 118 | 119 | // clear the area 120 | x = n->x - numdigits*w; 121 | 122 | if (n->y - ST_Y < 0) 123 | I_Error("drawNum: n->y - ST_Y < 0"); 124 | 125 | V_CopyRect(x, n->y - ST_Y, BG, w*numdigits, h, x, n->y, FG); 126 | 127 | // if non-number, do not draw it 128 | if (num == 1994) 129 | return; 130 | 131 | x = n->x; 132 | 133 | // in the special case of 0, you draw 0 134 | if (!num) 135 | V_DrawPatch(x - w, n->y, FG, n->p[ 0 ]); 136 | 137 | // draw the new number 138 | while (num && numdigits--) 139 | { 140 | x -= w; 141 | V_DrawPatch(x, n->y, FG, n->p[ num % 10 ]); 142 | num /= 10; 143 | } 144 | 145 | // draw a minus sign if necessary 146 | if (neg) 147 | V_DrawPatch(x - 8, n->y, FG, sttminus); 148 | } 149 | 150 | 151 | // 152 | void 153 | STlib_updateNum 154 | ( st_number_t* n, 155 | boolean refresh ) 156 | { 157 | if (*n->on) STlib_drawNum(n, refresh); 158 | } 159 | 160 | 161 | // 162 | void 163 | STlib_initPercent 164 | ( st_percent_t* p, 165 | int x, 166 | int y, 167 | patch_t** pl, 168 | int* num, 169 | boolean* on, 170 | patch_t* percent ) 171 | { 172 | STlib_initNum(&p->n, x, y, pl, num, on, 3); 173 | p->p = percent; 174 | } 175 | 176 | 177 | 178 | 179 | void 180 | STlib_updatePercent 181 | ( st_percent_t* per, 182 | int refresh ) 183 | { 184 | if (refresh && *per->n.on) 185 | V_DrawPatch(per->n.x, per->n.y, FG, per->p); 186 | 187 | STlib_updateNum(&per->n, refresh); 188 | } 189 | 190 | 191 | 192 | void 193 | STlib_initMultIcon 194 | ( st_multicon_t* i, 195 | int x, 196 | int y, 197 | patch_t** il, 198 | int* inum, 199 | boolean* on ) 200 | { 201 | i->x = x; 202 | i->y = y; 203 | i->oldinum = -1; 204 | i->inum = inum; 205 | i->on = on; 206 | i->p = il; 207 | } 208 | 209 | 210 | 211 | void 212 | STlib_updateMultIcon 213 | ( st_multicon_t* mi, 214 | boolean refresh ) 215 | { 216 | int w; 217 | int h; 218 | int x; 219 | int y; 220 | 221 | if (*mi->on 222 | && (mi->oldinum != *mi->inum || refresh) 223 | && (*mi->inum!=-1)) 224 | { 225 | if (mi->oldinum != -1) 226 | { 227 | x = mi->x - SHORT(mi->p[mi->oldinum]->leftoffset); 228 | y = mi->y - SHORT(mi->p[mi->oldinum]->topoffset); 229 | w = SHORT(mi->p[mi->oldinum]->width); 230 | h = SHORT(mi->p[mi->oldinum]->height); 231 | 232 | if (y - ST_Y < 0) 233 | I_Error("updateMultIcon: y - ST_Y < 0"); 234 | 235 | V_CopyRect(x, y-ST_Y, BG, w, h, x, y, FG); 236 | } 237 | V_DrawPatch(mi->x, mi->y, FG, mi->p[*mi->inum]); 238 | mi->oldinum = *mi->inum; 239 | } 240 | } 241 | 242 | 243 | 244 | void 245 | STlib_initBinIcon 246 | ( st_binicon_t* b, 247 | int x, 248 | int y, 249 | patch_t* i, 250 | boolean* val, 251 | boolean* on ) 252 | { 253 | b->x = x; 254 | b->y = y; 255 | b->oldval = 0; 256 | b->val = val; 257 | b->on = on; 258 | b->p = i; 259 | } 260 | 261 | 262 | 263 | void 264 | STlib_updateBinIcon 265 | ( st_binicon_t* bi, 266 | boolean refresh ) 267 | { 268 | int x; 269 | int y; 270 | int w; 271 | int h; 272 | 273 | if (*bi->on 274 | && (bi->oldval != *bi->val || refresh)) 275 | { 276 | x = bi->x - SHORT(bi->p->leftoffset); 277 | y = bi->y - SHORT(bi->p->topoffset); 278 | w = SHORT(bi->p->width); 279 | h = SHORT(bi->p->height); 280 | 281 | if (y - ST_Y < 0) 282 | I_Error("updateBinIcon: y - ST_Y < 0"); 283 | 284 | if (*bi->val) 285 | V_DrawPatch(bi->x, bi->y, FG, bi->p); 286 | else 287 | V_CopyRect(x, y-ST_Y, BG, w, h, x, y, FG); 288 | 289 | bi->oldval = *bi->val; 290 | } 291 | 292 | } 293 | 294 | -------------------------------------------------------------------------------- /src/st_lib.h: -------------------------------------------------------------------------------- 1 | // Emacs style mode select -*- C++ -*- 2 | //----------------------------------------------------------------------------- 3 | // 4 | // $Id:$ 5 | // 6 | // Copyright (C) 1993-1996 by id Software, Inc. 7 | // 8 | // This source is available for distribution and/or modification 9 | // only under the terms of the DOOM Source Code License as 10 | // published by id Software. All rights reserved. 11 | // 12 | // The source is distributed in the hope that it will be useful, 13 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | // FITNESS FOR A PARTICULAR PURPOSE. See the DOOM Source Code License 15 | // for more details. 16 | // 17 | // DESCRIPTION: 18 | // The status bar widget code. 19 | // 20 | //----------------------------------------------------------------------------- 21 | 22 | #ifndef __STLIB__ 23 | #define __STLIB__ 24 | 25 | 26 | // We are referring to patches. 27 | #include "r_defs.h" 28 | 29 | 30 | // 31 | // Background and foreground screen numbers 32 | // 33 | #define BG 4 34 | #define FG 0 35 | 36 | 37 | 38 | // 39 | // Typedefs of widgets 40 | // 41 | 42 | // Number widget 43 | 44 | typedef struct 45 | { 46 | // upper right-hand corner 47 | // of the number (right-justified) 48 | int x; 49 | int y; 50 | 51 | // max # of digits in number 52 | int width; 53 | 54 | // last number value 55 | int oldnum; 56 | 57 | // pointer to current value 58 | int* num; 59 | 60 | // pointer to boolean stating 61 | // whether to update number 62 | boolean* on; 63 | 64 | // list of patches for 0-9 65 | patch_t** p; 66 | 67 | // user data 68 | int data; 69 | 70 | } st_number_t; 71 | 72 | 73 | 74 | // Percent widget ("child" of number widget, 75 | // or, more precisely, contains a number widget.) 76 | typedef struct 77 | { 78 | // number information 79 | st_number_t n; 80 | 81 | // percent sign graphic 82 | patch_t* p; 83 | 84 | } st_percent_t; 85 | 86 | 87 | 88 | // Multiple Icon widget 89 | typedef struct 90 | { 91 | // center-justified location of icons 92 | int x; 93 | int y; 94 | 95 | // last icon number 96 | int oldinum; 97 | 98 | // pointer to current icon 99 | int* inum; 100 | 101 | // pointer to boolean stating 102 | // whether to update icon 103 | boolean* on; 104 | 105 | // list of icons 106 | patch_t** p; 107 | 108 | // user data 109 | int data; 110 | 111 | } st_multicon_t; 112 | 113 | 114 | 115 | 116 | // Binary Icon widget 117 | 118 | typedef struct 119 | { 120 | // center-justified location of icon 121 | int x; 122 | int y; 123 | 124 | // last icon value 125 | int oldval; 126 | 127 | // pointer to current icon status 128 | boolean* val; 129 | 130 | // pointer to boolean 131 | // stating whether to update icon 132 | boolean* on; 133 | 134 | 135 | patch_t* p; // icon 136 | int data; // user data 137 | 138 | } st_binicon_t; 139 | 140 | 141 | 142 | // 143 | // Widget creation, access, and update routines 144 | // 145 | 146 | // Initializes widget library. 147 | // More precisely, initialize STMINUS, 148 | // everything else is done somewhere else. 149 | // 150 | void STlib_init(void); 151 | 152 | 153 | 154 | // Number widget routines 155 | void 156 | STlib_initNum 157 | ( st_number_t* n, 158 | int x, 159 | int y, 160 | patch_t** pl, 161 | int* num, 162 | boolean* on, 163 | int width ); 164 | 165 | void 166 | STlib_updateNum 167 | ( st_number_t* n, 168 | boolean refresh ); 169 | 170 | 171 | // Percent widget routines 172 | void 173 | STlib_initPercent 174 | ( st_percent_t* p, 175 | int x, 176 | int y, 177 | patch_t** pl, 178 | int* num, 179 | boolean* on, 180 | patch_t* percent ); 181 | 182 | 183 | void 184 | STlib_updatePercent 185 | ( st_percent_t* per, 186 | int refresh ); 187 | 188 | 189 | // Multiple Icon widget routines 190 | void 191 | STlib_initMultIcon 192 | ( st_multicon_t* mi, 193 | int x, 194 | int y, 195 | patch_t** il, 196 | int* inum, 197 | boolean* on ); 198 | 199 | 200 | void 201 | STlib_updateMultIcon 202 | ( st_multicon_t* mi, 203 | boolean refresh ); 204 | 205 | // Binary Icon widget routines 206 | 207 | void 208 | STlib_initBinIcon 209 | ( st_binicon_t* b, 210 | int x, 211 | int y, 212 | patch_t* i, 213 | boolean* val, 214 | boolean* on ); 215 | 216 | void 217 | STlib_updateBinIcon 218 | ( st_binicon_t* bi, 219 | boolean refresh ); 220 | 221 | #endif 222 | //----------------------------------------------------------------------------- 223 | // 224 | // $Log:$ 225 | // 226 | //----------------------------------------------------------------------------- 227 | -------------------------------------------------------------------------------- /src/st_stuff.h: -------------------------------------------------------------------------------- 1 | // Emacs style mode select -*- C++ -*- 2 | //----------------------------------------------------------------------------- 3 | // 4 | // $Id:$ 5 | // 6 | // Copyright (C) 1993-1996 by id Software, Inc. 7 | // 8 | // This source is available for distribution and/or modification 9 | // only under the terms of the DOOM Source Code License as 10 | // published by id Software. All rights reserved. 11 | // 12 | // The source is distributed in the hope that it will be useful, 13 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | // FITNESS FOR A PARTICULAR PURPOSE. See the DOOM Source Code License 15 | // for more details. 16 | // 17 | // DESCRIPTION: 18 | // Status bar code. 19 | // Does the face/direction indicator animatin. 20 | // Does palette indicators as well (red pain/berserk, bright pickup) 21 | // 22 | //----------------------------------------------------------------------------- 23 | 24 | #ifndef __STSTUFF_H__ 25 | #define __STSTUFF_H__ 26 | 27 | #include "doomtype.h" 28 | #include "d_event.h" 29 | 30 | // Size of statusbar. 31 | // Now sensitive for scaling. 32 | #define ST_HEIGHT 32*SCREEN_MUL 33 | #define ST_WIDTH SCREENWIDTH 34 | #define ST_Y (SCREENHEIGHT - ST_HEIGHT) 35 | 36 | 37 | // 38 | // STATUS BAR 39 | // 40 | 41 | // Called by main loop. 42 | boolean ST_Responder (event_t* ev); 43 | 44 | // Called by main loop. 45 | void ST_Ticker (void); 46 | 47 | // Called by main loop. 48 | void ST_Drawer (boolean fullscreen, boolean refresh); 49 | 50 | // Called when the console player is spawned on each level. 51 | void ST_Start (void); 52 | 53 | // Called by startup code. 54 | void ST_Init (void); 55 | 56 | 57 | 58 | // States for status bar code. 59 | typedef enum 60 | { 61 | AutomapState, 62 | FirstPersonState 63 | 64 | } st_stateenum_t; 65 | 66 | 67 | // States for the chat code. 68 | typedef enum 69 | { 70 | StartChatState, 71 | WaitDestState, 72 | GetChatState 73 | 74 | } st_chatstateenum_t; 75 | 76 | 77 | boolean ST_Responder(event_t* ev); 78 | 79 | 80 | 81 | #endif 82 | //----------------------------------------------------------------------------- 83 | // 84 | // $Log:$ 85 | // 86 | //----------------------------------------------------------------------------- 87 | -------------------------------------------------------------------------------- /src/stubs.c: -------------------------------------------------------------------------------- 1 | #include "doomstat.h" 2 | 3 | 4 | //ticcmd_t netcmds[MAXPLAYERS][BACKUPTICS]; 5 | //int maketic; 6 | //int ticdup; 7 | 8 | 9 | #ifdef STUB_SOUND 10 | int snd_SfxVolume = 15; 11 | int snd_MusicVolume = 15; 12 | int numChannels; 13 | const char * sndserver_filename = " "; 14 | #endif 15 | 16 | -------------------------------------------------------------------------------- /src/stubs.h: -------------------------------------------------------------------------------- 1 | #define TUNE_MAXVISPLANES 32 //At 16, frequently causes visual glitches, but size is critical. 2 | #define TUNE_MAXOPENINGS SCREENWIDTH*16 3 | #define STUB_NET 4 | 5 | #ifndef SET_MEMORY_DEBUG 6 | #define SET_MEMORY_DEBUG 1 // For printing free RAM. 7 | #endif 8 | 9 | #define COMBINE_SCREENS //Overlap memory for screens #0-3, saves RAM would mess up wipes, but we don't care. 10 | 11 | //Disable screen wipings, saves peaks of 64k on heap. 12 | #define DISABLE_WIPES 13 | 14 | //We can create tables for things like the textures and maps... You can set the flags here to produce these. 15 | //Don't do this on target hardware!!! 16 | 17 | #ifndef FIXED_HEAP 18 | #ifdef GENERATE_BAKED 19 | #define FIXED_HEAP 40000000 //Heap size when running on computer to store full size. 20 | #else 21 | #define FIXED_HEAP (384*1024) //Actual heap for embedded device. 22 | #endif 23 | #endif 24 | 25 | 26 | //Always stub sound, right now the existing system takes up like 1.5MB of heap! 27 | #define STUB_SOUND 28 | 29 | 30 | 31 | #ifdef STUB_SOUND 32 | #define __S_SOUND__ 33 | #define S_StartSound( dev, sound ) 34 | #define S_ChangeMusic( musnum, id) 35 | #define I_UpdateSound(x) 36 | #define I_ShutdownSound(x) 37 | #define I_ShutdownMusic(x) 38 | #define S_PauseSound(x) 39 | #define S_ResumeSound(x) 40 | #define S_StartMusic(x) 41 | #define S_SetMusicVolume(v) 42 | #define S_UpdateSounds( listener ) 43 | #define S_SetSfxVolume(iv) 44 | #define I_SubmitSound(vod) 45 | #define I_InitSound() 46 | #define S_Init(x,y) 47 | #define S_Start(x) 48 | #define S_StopSound(x) 49 | #endif 50 | 51 | 52 | 53 | 54 | -------------------------------------------------------------------------------- /src/support/LICENSE.txt: -------------------------------------------------------------------------------- 1 | # doom1.wad included 2 | 3 | It is important to use the same doom1.wad because all of the baked textures, etc. were compiled agains this one. 4 | 5 | 6 | X-Sender: johnc@mail.idsoftware.com 7 | X-Mailer: Windows Eudora Pro Version 3.0 (32) 8 | Date: Sat, 23 Oct 1999 20:01:30 -0500 9 | To: Joe Drew 10 | From: johnc@idsoftware.com (John Carmack) 11 | Subject: Re: Doom shareware WAD license 12 | 13 | At 08:02 PM 10/23/99 -0400, you wrote: 14 | >Can you give me a definite license on the doom 1 shareware wad? I find certain 15 | >things that say "freely distribute" and others that say "get vendor's license" 16 | >... All I need to have is a license so I can package it up for Debian. 17 | >Thanks. 18 | >Joe 19 | 20 | The DOOM shareware wad is freely distributable. No Quake data is freely 21 | distributable. 22 | 23 | John Carmack 24 | -------------------------------------------------------------------------------- /src/support/augment_sprites.txt: -------------------------------------------------------------------------------- 1 | ADD_SPRITE 2 3 PISG 2 | 3 | -------------------------------------------------------------------------------- /src/support/doom1.wad: -------------------------------------------------------------------------------- 1 | version https://git-lfs.github.com/spec/v1 2 | oid sha256:1d7d43be501e67d927e415e0b8f3e29c3bf33075e859721816f652a526cac771 3 | size 4196020 4 | -------------------------------------------------------------------------------- /src/support/rawwad.h: -------------------------------------------------------------------------------- 1 | #ifndef _RAWWAD_H 2 | #define _RAWWAD_H 3 | extern const int numlumps; 4 | extern const unsigned char rawwad[4196020]; 5 | #endif 6 | 7 | -------------------------------------------------------------------------------- /src/support/stripchoice-E1M1ONLY.txt: -------------------------------------------------------------------------------- 1 | # Not used before E1M3 2 | # Use this command to do E1M1Only. 3 | # make clean && cp support/stripchoice-E1M1ONLY.txt support/stripchoice.txt && cp support/stripchoice-E1M1ONLY.txt support/stripchoicebegin.txt && EXTRA_CFLAGS="-DE1M1ONLY=1" make && ls -l emdoom 4 | 5 | -BOSS* 6 | -MIS* 7 | -SOUL* 8 | -TRE* 9 | -SPOS* 10 | -DPS* 11 | -DSS* 12 | -SARG* 13 | -BAL* 14 | -DSB* 15 | -MAN* 16 | -DSP* 17 | -DSTELEPT 18 | -D_E1* 19 | -D_INTER 20 | -D_VICTOR 21 | -GENMIDI 22 | 23 | -DSRLAUNC 24 | -DSRXPLOD 25 | -DSFIRSHT 26 | -DSFIRXPL 27 | -DSDOROPN 28 | -DSDORCLS 29 | -DSDMACT 30 | -HELP1 31 | +D_E1M1 32 | 33 | 34 | +S_END 35 | +F1_END 36 | +F_END 37 | +P1_END 38 | +P_END 39 | +F_START 40 | +F1_START 41 | 42 | -DEMO1 43 | -DEMO2 44 | -DEMO3 45 | +E1M1 46 | -E1M2 47 | -E1M3 48 | -E1M4 49 | -E1M5 50 | -E1M6 51 | -E1M7 52 | -E1M8 53 | -E1M9 54 | -TITLEPIC 55 | -M_* 56 | -WI* 57 | -CREDIT 58 | -HELP2 59 | 60 | 61 | +PIS* 62 | +PUFF* 63 | +BEXP* 64 | +BLUD* 65 | +CHG* 66 | +PISG* 67 | +BON2* 68 | 69 | -------------------------------------------------------------------------------- /src/support/stripchoice.txt: -------------------------------------------------------------------------------- 1 | # Not used before E1M3 2 | #-BOSS* 3 | #-MIS* 4 | #-SOUL* 5 | #-TRE* 6 | #-SPOS* 7 | #-DPS* 8 | #-DSS* 9 | #-SARG* 10 | #-BAL* 11 | #-DSB* 12 | #-MAN* 13 | #-DSP* 14 | +PISG* 15 | +PISF* 16 | +PUFF* 17 | +BEXP* 18 | +BLUD* 19 | 20 | +S_END 21 | +F1_END 22 | +F_END 23 | +P1_END 24 | +P_END 25 | +F_START 26 | +F1_START 27 | 28 | 0VERTEXES 29 | 0NODES 30 | +DEMO1 31 | -DEMO2 32 | -DEMO3 33 | +E1M1 34 | +E1M2 35 | -E1M3 36 | -E1M4 37 | -E1M5 38 | -E1M6 39 | -E1M7 40 | -E1M8 41 | -E1M9 42 | +TITLEPIC 43 | +M_DOOM 44 | +M_NGAME 45 | +M_OPTION 46 | +M_LOADG 47 | +M_RDTHIS 48 | +M_SAVEG 49 | +M_QUITG 50 | +M_SKULL1 51 | +M_SKULL2 52 | +M_THERMO 53 | +M_THERMR 54 | +M_THERMM 55 | +M_THERML 56 | +M_ENDGAM 57 | +M_PAUSE 58 | +M_MESSG 59 | +M_MSGON 60 | +M_MSGOFF 61 | +M_EPISOD 62 | +M_EPI1 63 | +M_EPI2 64 | +M_EPI3 65 | +M_HURT 66 | +M_JKILL 67 | +M_ROUGH 68 | +M_SKILL 69 | +M_NEWG 70 | +M_ULTRA 71 | +M_NMARE 72 | +M_SVOL 73 | +M_OPTTTL 74 | +M_DISP 75 | +M_MSENS 76 | +M_GDHIGH 77 | +M_GDLOW 78 | +M_DETAIL 79 | +M_DISOPT 80 | +M_SCRNSZ 81 | +M_SGTTL 82 | +M_LGTTL 83 | +M_SFXVOL 84 | +M_MUSVOL 85 | +M_LSLEFT 86 | +M_LSCNTR 87 | +M_LSRGHT 88 | +WIMAP0 89 | +WILV00 90 | +WILV01 91 | +WILV02 92 | +WILV03 93 | +WILV04 94 | +WILV05 95 | +WILV06 96 | +WILV07 97 | +WILV08 98 | +WILV11 99 | +WILV12 100 | +WILV14 101 | +WILV15 102 | +WILV16 103 | +WILV17 104 | +WILV18 105 | +WILV20 106 | +WILV21 107 | +WILV22 108 | +WILV23 109 | +WILV24 110 | +WILV25 111 | +WILV26 112 | +WILV27 113 | +WILV28 114 | +WILV13 115 | +WILV10 116 | +CREDIT 117 | +HELP2 118 | +WIURH0 119 | +WIURH1 120 | +WISPLAT 121 | +WIA00900 122 | +WIA00901 123 | +WIA00902 124 | +WIA00800 125 | +WIA00801 126 | +WIA00802 127 | +WIA00700 128 | +WIA00701 129 | +WIA00702 130 | +WIA00600 131 | +WIA00601 132 | +WIA00602 133 | +WIA00500 134 | +WIA00501 135 | +WIA00502 136 | +WIA00400 137 | +WIA00401 138 | +WIA00402 139 | +WIA00300 140 | +WIA00301 141 | +WIA00302 142 | +WIA00200 143 | +WIA00201 144 | +WIA00202 145 | +WIA00100 146 | +WIA00101 147 | +WIA00102 148 | +WIA00000 149 | +WIA00001 150 | +WIA00002 151 | +WIOSTK 152 | +WIOSTI 153 | +WIF 154 | +WIMSTT 155 | +WIOSTS 156 | +WIOSTF 157 | +WITIME 158 | +WIPAR 159 | +WIMSTAR 160 | +WIMINUS 161 | +WIPCNT 162 | +WINUM0 163 | +WINUM1 164 | +WINUM2 165 | +WINUM3 166 | +WINUM4 167 | +WINUM5 168 | +WINUM6 169 | +WINUM7 170 | +WINUM8 171 | +WINUM9 172 | +WICOLON 173 | +WISUCKS 174 | +WIFRGS 175 | +WIP1 176 | +WIP2 177 | +WIP3 178 | +WIP4 179 | +WIBP1 180 | +WIBP2 181 | +WIBP3 182 | +WIBP4 183 | +WIKILRS 184 | +WIVCTMS 185 | +WISCRT2 186 | +WIENTER 187 | +STCFN121 188 | +STFB1 189 | +STFB2 190 | +STFB3 191 | +STPB1 192 | +STPB0 193 | +STPB2 194 | +STPB3 195 | +BRDR_TL 196 | +BRDR_T 197 | +BRDR_TR 198 | +BRDR_L 199 | +BRDR_R 200 | +BRDR_BL 201 | +BRDR_B 202 | +BRDR_BR 203 | 204 | 205 | -------------------------------------------------------------------------------- /src/support/stripchoicebegin.txt: -------------------------------------------------------------------------------- 1 | # Not used before E1M3 2 | #-BOSS* 3 | #-MIS* 4 | #-SOUL* 5 | #-TRE* 6 | #-SPOS* 7 | #-DPS* 8 | #-DSS* 9 | #-SARG* 10 | #-BAL* 11 | #-DSB* 12 | #-MAN* 13 | #-DSP* 14 | +PISGA* 15 | +PUFF* 16 | 17 | +S_END 18 | +F1_END 19 | +F_END 20 | +P1_END 21 | +P_END 22 | +F_START 23 | +F1_START 24 | +DEMO1 25 | -DEMO2 26 | -DEMO3 27 | +E1M1 28 | +E1M2 29 | -E1M3 30 | -E1M4 31 | -E1M5 32 | -E1M6 33 | -E1M7 34 | -E1M8 35 | -E1M9 36 | +TITLEPIC 37 | +M_DOOM 38 | +M_NGAME 39 | +M_OPTION 40 | +M_LOADG 41 | +M_RDTHIS 42 | +M_SAVEG 43 | +M_QUITG 44 | +M_SKULL1 45 | +M_SKULL2 46 | +M_THERMO 47 | +M_THERMR 48 | +M_THERMM 49 | +M_THERML 50 | +M_ENDGAM 51 | +M_PAUSE 52 | +M_MESSG 53 | +M_MSGON 54 | +M_MSGOFF 55 | +M_EPISOD 56 | +M_EPI1 57 | +M_EPI2 58 | +M_EPI3 59 | +M_HURT 60 | +M_JKILL 61 | +M_ROUGH 62 | +M_SKILL 63 | +M_NEWG 64 | +M_ULTRA 65 | +M_NMARE 66 | +M_SVOL 67 | +M_OPTTTL 68 | +M_DISP 69 | +M_MSENS 70 | +M_GDHIGH 71 | +M_GDLOW 72 | +M_DETAIL 73 | +M_DISOPT 74 | +M_SCRNSZ 75 | +M_SGTTL 76 | +M_LGTTL 77 | +M_SFXVOL 78 | +M_MUSVOL 79 | +M_LSLEFT 80 | +M_LSCNTR 81 | +M_LSRGHT 82 | +WIMAP0 83 | +WILV00 84 | +WILV01 85 | +WILV02 86 | +WILV03 87 | +WILV04 88 | +WILV05 89 | +WILV06 90 | +WILV07 91 | +WILV08 92 | +WILV11 93 | +WILV12 94 | +WILV14 95 | +WILV15 96 | +WILV16 97 | +WILV17 98 | +WILV18 99 | +WILV20 100 | +WILV21 101 | +WILV22 102 | +WILV23 103 | +WILV24 104 | +WILV25 105 | +WILV26 106 | +WILV27 107 | +WILV28 108 | +WILV13 109 | +WILV10 110 | +CREDIT 111 | +HELP2 112 | +WIURH0 113 | +WIURH1 114 | +WISPLAT 115 | +WIA00900 116 | +WIA00901 117 | +WIA00902 118 | +WIA00800 119 | +WIA00801 120 | +WIA00802 121 | +WIA00700 122 | +WIA00701 123 | +WIA00702 124 | +WIA00600 125 | +WIA00601 126 | +WIA00602 127 | +WIA00500 128 | +WIA00501 129 | +WIA00502 130 | +WIA00400 131 | +WIA00401 132 | +WIA00402 133 | +WIA00300 134 | +WIA00301 135 | +WIA00302 136 | +WIA00200 137 | +WIA00201 138 | +WIA00202 139 | +WIA00100 140 | +WIA00101 141 | +WIA00102 142 | +WIA00000 143 | +WIA00001 144 | +WIA00002 145 | +WIOSTK 146 | +WIOSTI 147 | +WIF 148 | +WIMSTT 149 | +WIOSTS 150 | +WIOSTF 151 | +WITIME 152 | +WIPAR 153 | +WIMSTAR 154 | +WIMINUS 155 | +WIPCNT 156 | +WINUM0 157 | +WINUM1 158 | +WINUM2 159 | +WINUM3 160 | +WINUM4 161 | +WINUM5 162 | +WINUM6 163 | +WINUM7 164 | +WINUM8 165 | +WINUM9 166 | +WICOLON 167 | +WISUCKS 168 | +WIFRGS 169 | +WIP1 170 | +WIP2 171 | +WIP3 172 | +WIP4 173 | +WIBP1 174 | +WIBP2 175 | +WIBP3 176 | +WIBP4 177 | +WIKILRS 178 | +WIVCTMS 179 | +WISCRT2 180 | +WIENTER 181 | +STCFN121 182 | +STFB1 183 | +STFB2 184 | +STFB3 185 | +STPB1 186 | +STPB0 187 | +STPB2 188 | +STPB3 189 | +BRDR_TL 190 | +BRDR_T 191 | +BRDR_TR 192 | +BRDR_L 193 | +BRDR_R 194 | +BRDR_BL 195 | +BRDR_B 196 | +BRDR_BR 197 | 198 | -------------------------------------------------------------------------------- /src/support/wadder.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | 6 | #define LONG(x) x 7 | 8 | typedef struct 9 | { 10 | // Should be "IWAD" or "PWAD". 11 | char identification[4]; 12 | int numlumps; 13 | int infotableofs; 14 | 15 | } wadinfo_t; 16 | 17 | typedef struct 18 | { 19 | int filepos; 20 | int size; 21 | char name[8]; 22 | 23 | } filelump_t; 24 | 25 | // 26 | // WADFILE I/O related stuff. 27 | // 28 | typedef struct 29 | { 30 | char name[8]; 31 | int handle; 32 | int position; 33 | int size; 34 | } lumpinfo_t; 35 | 36 | 37 | lumpinfo_t* lumpinfo; 38 | int numlumps; 39 | 40 | 41 | int main() 42 | { 43 | FILE * f = fopen( "doom1.wad", "rb" ); 44 | fseek( f, 0, SEEK_END ); 45 | int len = ftell(f); 46 | if( len <= 0 ) 47 | { 48 | fprintf( stderr, "Error: Bad WAD.\n" ); 49 | } 50 | fseek( f, 0, SEEK_SET ); 51 | unsigned char * rawwad = malloc(len); 52 | fread( rawwad, 1, len, f ); 53 | fclose( f); 54 | 55 | 56 | // open all the files, load headers, and count lumps 57 | numlumps = 0; 58 | 59 | // will be realloced as lumps are added 60 | lumpinfo = malloc(1); 61 | 62 | wadinfo_t header; 63 | lumpinfo_t* lump_p; 64 | unsigned i; 65 | int length; 66 | int startlump; 67 | filelump_t* fileinfo; 68 | filelump_t singleinfo; 69 | int handle = 1; 70 | // open the file and add to directory 71 | 72 | int filepos = 0; 73 | startlump = numlumps; 74 | 75 | // WAD file 76 | //read_W (handle, &header, sizeof(header)); 77 | memcpy( &header, &rawwad[filepos], sizeof(header)); filepos +=sizeof(header); 78 | if (strncmp(header.identification,"IWAD",4)) 79 | { 80 | // Homebrew levels? 81 | if (strncmp(header.identification,"PWAD",4)) 82 | { 83 | fprintf ( stderr, "Wad file doesn't have IWAD " 84 | "or PWAD id\n"); 85 | exit(-1); 86 | } 87 | 88 | // ???modifiedgame = true; 89 | } 90 | header.numlumps = LONG(header.numlumps); 91 | header.infotableofs = LONG(header.infotableofs); 92 | printf( "Table: %d %d\n", header.numlumps, header.infotableofs ); 93 | length = header.numlumps*sizeof(filelump_t); 94 | fileinfo = alloca (length); 95 | filepos = header.infotableofs; 96 | //read_W (handle, fileinfo, length); 97 | memcpy( fileinfo, &rawwad[filepos], length ); filepos += length; 98 | numlumps += header.numlumps; 99 | 100 | // Fill in lumpinfo 101 | lumpinfo = realloc (lumpinfo, numlumps*sizeof(lumpinfo_t)); 102 | 103 | if (!lumpinfo) 104 | { 105 | fprintf( stderr, "Couldn't realloc lumpinfo"); 106 | return -1; 107 | } 108 | 109 | lump_p = &lumpinfo[startlump]; 110 | 111 | int storehandle = 1; //XXX this looks wrong? 112 | 113 | for (i=startlump ; ihandle = storehandle; 116 | lump_p->position = LONG(fileinfo->filepos); 117 | lump_p->size = LONG(fileinfo->size); 118 | strncpy (lump_p->name, fileinfo->name, 8); 119 | } 120 | 121 | 122 | 123 | 124 | 125 | FILE * fo = fopen( "rawwad.c_resource", "w" ); 126 | fprintf( fo, "#include \"../w_wad.h\"\n" ); 127 | fprintf( fo, "const int numlumps = %d;\n", numlumps ); 128 | fprintf( fo, "const unsigned char rawwad[%d] = {", len ); 129 | int byte = 0; 130 | int dat; 131 | while( byte < len ) 132 | { 133 | dat = rawwad[byte]; 134 | if( (byte & 0x1f) == 0 ) fprintf( fo, "\n\t" ); 135 | fprintf( fo, "0x%02x, ", dat ); 136 | byte++; 137 | } 138 | fprintf( fo, "};\n\n" ); 139 | fprintf( fo, "const lumpinfo_t lumpinfo[%d] = {\n", numlumps ); 140 | for( i = 0; i < numlumps; i++ ) 141 | { 142 | char st[100]; 143 | memcpy( st, lumpinfo[i].name, 8 ); 144 | st[8] = 0; 145 | fprintf( fo, " { \"%s\", %d, %d, },\n", st, lumpinfo[i].position, lumpinfo[i].size ); 146 | } 147 | fprintf( fo, "};\n" ); 148 | 149 | 150 | 151 | fclose( fo ); 152 | 153 | fo = fopen("rawwad.h", "w" ); 154 | fprintf( fo, "#ifndef _RAWWAD_H\n#define _RAWWAD_H\n" ); 155 | fprintf( fo, "extern const unsigned char rawwad[%d];\n#endif\n", byte ); 156 | } 157 | 158 | -------------------------------------------------------------------------------- /src/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 pahse 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 ANG45 0x20000000 69 | #define ANG90 0x40000000 70 | #define ANG180 0x80000000 71 | #define ANG270 0xc0000000 72 | 73 | 74 | #define SLOPERANGE 2048 75 | #define SLOPEBITS 11 76 | #define DBITS (FRACBITS-SLOPEBITS) 77 | 78 | typedef unsigned angle_t; 79 | 80 | 81 | // Effective size is 2049; 82 | // The +1 size is to handle the case when x==y 83 | // without additional checking. 84 | extern const angle_t tantoangle[SLOPERANGE+1]; 85 | 86 | 87 | // Utility function, 88 | // called by R_PointToAngle. 89 | int 90 | SlopeDiv 91 | ( unsigned num, 92 | unsigned den); 93 | 94 | 95 | #endif 96 | //----------------------------------------------------------------------------- 97 | // 98 | // $Log:$ 99 | // 100 | //----------------------------------------------------------------------------- 101 | -------------------------------------------------------------------------------- /src/v_video.h: -------------------------------------------------------------------------------- 1 | // Emacs style mode select -*- C++ -*- 2 | //----------------------------------------------------------------------------- 3 | // 4 | // $Id:$ 5 | // 6 | // Copyright (C) 1993-1996 by id Software, Inc. 7 | // 8 | // This source is available for distribution and/or modification 9 | // only under the terms of the DOOM Source Code License as 10 | // published by id Software. All rights reserved. 11 | // 12 | // The source is distributed in the hope that it will be useful, 13 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | // FITNESS FOR A PARTICULAR PURPOSE. See the DOOM Source Code License 15 | // for more details. 16 | // 17 | // DESCRIPTION: 18 | // Gamma correction LUT. 19 | // Functions to draw patches (by post) directly to screen. 20 | // Functions to blit a block to the screen. 21 | // 22 | //----------------------------------------------------------------------------- 23 | 24 | 25 | #ifndef __V_VIDEO__ 26 | #define __V_VIDEO__ 27 | 28 | #include "doomtype.h" 29 | 30 | #include "doomdef.h" 31 | 32 | // Needed because we are refering to patches. 33 | #include "r_data.h" 34 | 35 | // 36 | // VIDEO 37 | // 38 | 39 | #define CENTERY (SCREENHEIGHT/2) 40 | 41 | 42 | // Screen 0 is the screen updated by I_Update screen. 43 | // Screen 1 is an extra buffer. 44 | 45 | 46 | 47 | extern byte* screens[5]; 48 | 49 | extern int dirtybox[4]; 50 | 51 | extern byte gammatable[5][256]; 52 | extern int usegamma; 53 | 54 | 55 | 56 | // Allocates buffer screens, call before R_Init. 57 | void V_Init (void); 58 | 59 | 60 | void 61 | V_CopyRect 62 | ( int srcx, 63 | int srcy, 64 | int srcscrn, 65 | int width, 66 | int height, 67 | int destx, 68 | int desty, 69 | int destscrn ); 70 | 71 | void 72 | V_DrawPatch 73 | ( int x, 74 | int y, 75 | int scrn, 76 | patch_t* patch); 77 | 78 | void 79 | V_DrawPatchDirect 80 | ( int x, 81 | int y, 82 | int scrn, 83 | patch_t* patch ); 84 | 85 | 86 | // Draw a linear block of pixels into the view buffer. 87 | void 88 | V_DrawBlock 89 | ( int x, 90 | int y, 91 | int scrn, 92 | int width, 93 | int height, 94 | byte* src ); 95 | 96 | // Reads a linear block of pixels into the view buffer. 97 | void 98 | V_GetBlock 99 | ( int x, 100 | int y, 101 | int scrn, 102 | int width, 103 | int height, 104 | byte* dest ); 105 | 106 | 107 | void 108 | V_MarkRect 109 | ( int x, 110 | int y, 111 | int width, 112 | int height ); 113 | 114 | #endif 115 | //----------------------------------------------------------------------------- 116 | // 117 | // $Log:$ 118 | // 119 | //----------------------------------------------------------------------------- 120 | -------------------------------------------------------------------------------- /src/w_wad.h: -------------------------------------------------------------------------------- 1 | // Emacs style mode select -*- C++ -*- 2 | //----------------------------------------------------------------------------- 3 | // 4 | // $Id:$ 5 | // 6 | // Copyright (C) 1993-1996 by id Software, Inc. 7 | // 8 | // This source is available for distribution and/or modification 9 | // only under the terms of the DOOM Source Code License as 10 | // published by id Software. All rights reserved. 11 | // 12 | // The source is distributed in the hope that it will be useful, 13 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | // FITNESS FOR A PARTICULAR PURPOSE. See the DOOM Source Code License 15 | // for more details. 16 | // 17 | // DESCRIPTION: 18 | // WAD I/O functions. 19 | // 20 | //----------------------------------------------------------------------------- 21 | 22 | 23 | #ifndef __W_WAD__ 24 | #define __W_WAD__ 25 | 26 | 27 | #ifdef __GNUG__ 28 | #pragma interface 29 | #endif 30 | 31 | 32 | // 33 | // TYPES 34 | // 35 | typedef struct 36 | { 37 | // Should be "IWAD" or "PWAD". 38 | char identification[4]; 39 | int numlumps; 40 | int infotableofs; 41 | 42 | } wadinfo_t; 43 | 44 | 45 | typedef struct 46 | { 47 | int filepos; 48 | int size; 49 | char name[8]; 50 | 51 | } filelump_t; 52 | 53 | // 54 | // WADFILE I/O related stuff. 55 | // 56 | typedef struct 57 | { 58 | char name[8]; 59 | // int handle; //Handle is nonsensical in compiled-in-binary mode. 60 | int position; 61 | int size; 62 | } lumpinfo_t; 63 | 64 | 65 | extern const lumpinfo_t lumpinfo[]; 66 | extern const int numlumps; 67 | 68 | void W_InitMultipleFiles (char** filenames); 69 | void W_Reload (void); 70 | 71 | int W_CheckNumForName (char* name); 72 | int W_GetNumForName (char* name); 73 | 74 | int W_LumpLength (int lump); 75 | void W_ReadLump (int lump, void *dest); 76 | 77 | const void* W_CacheLumpNum (int lump, int tag); 78 | void* W_CacheLumpName (char* name, int tag); 79 | void* W_CacheLumpNum_Old (int lump, int tag); 80 | 81 | 82 | 83 | 84 | #endif 85 | //----------------------------------------------------------------------------- 86 | // 87 | // $Log:$ 88 | // 89 | //----------------------------------------------------------------------------- 90 | -------------------------------------------------------------------------------- /src/wi_stuff.h: -------------------------------------------------------------------------------- 1 | // Emacs style mode select -*- C++ -*- 2 | //----------------------------------------------------------------------------- 3 | // 4 | // $Id:$ 5 | // 6 | // Copyright (C) 1993-1996 by id Software, Inc. 7 | // 8 | // This source is available for distribution and/or modification 9 | // only under the terms of the DOOM Source Code License as 10 | // published by id Software. All rights reserved. 11 | // 12 | // The source is distributed in the hope that it will be useful, 13 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | // FITNESS FOR A PARTICULAR PURPOSE. See the DOOM Source Code License 15 | // for more details. 16 | // 17 | // DESCRIPTION: 18 | // Intermission. 19 | // 20 | //----------------------------------------------------------------------------- 21 | 22 | #ifndef __WI_STUFF__ 23 | #define __WI_STUFF__ 24 | 25 | //#include "v_video.h" 26 | 27 | #include "doomdef.h" 28 | 29 | // States for the intermission 30 | 31 | typedef enum 32 | { 33 | NoState = -1, 34 | StatCount, 35 | ShowNextLoc 36 | 37 | } stateenum_t; 38 | 39 | // Called by main loop, animate the intermission. 40 | void WI_Ticker (void); 41 | 42 | // Called by main loop, 43 | // draws the intermission directly into the screen buffer. 44 | void WI_Drawer (void); 45 | 46 | // Setup for an intermission screen. 47 | void WI_Start(wbstartstruct_t* wbstartstruct); 48 | 49 | #endif 50 | //----------------------------------------------------------------------------- 51 | // 52 | // $Log:$ 53 | // 54 | //----------------------------------------------------------------------------- 55 | -------------------------------------------------------------------------------- /src/z_zone.h: -------------------------------------------------------------------------------- 1 | // Emacs style mode select -*- C++ -*- 2 | //----------------------------------------------------------------------------- 3 | // 4 | // $Id:$ 5 | // 6 | // Copyright (C) 1993-1996 by id Software, Inc. 7 | // 8 | // This source is available for distribution and/or modification 9 | // only under the terms of the DOOM Source Code License as 10 | // published by id Software. All rights reserved. 11 | // 12 | // The source is distributed in the hope that it will be useful, 13 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | // FITNESS FOR A PARTICULAR PURPOSE. See the DOOM Source Code License 15 | // for more details. 16 | // 17 | // DESCRIPTION: 18 | // Zone Memory Allocation, perhaps NeXT ObjectiveC inspired. 19 | // Remark: this was the only stuff that, according 20 | // to John Carmack, might have been useful for 21 | // Quake. 22 | // 23 | //--------------------------------------------------------------------- 24 | 25 | 26 | 27 | #ifndef __Z_ZONE__ 28 | #define __Z_ZONE__ 29 | 30 | #include 31 | 32 | // 33 | // ZONE MEMORY 34 | // PU - purge tags. 35 | // Tags < 100 are not overwritten until freed. 36 | #define PU_STATIC 1 // static entire execution time 37 | #define PU_SOUND 2 // static while playing 38 | #define PU_MUSIC 3 // static while playing 39 | #define PU_DAVE 4 // anything else Dave wants static 40 | #define PU_LEVEL 50 // static until level exited 41 | #define PU_LEVSPEC 51 // a special thinker in a level 42 | // Tags >= 100 are purgable whenever needed. 43 | #define PU_PURGELEVEL 100 44 | #define PU_CACHE 101 45 | 46 | 47 | void Z_Init (void); 48 | void* Z_Malloc_Internal (int size, int tag, void *ptr); 49 | void* Z_Malloc_Internal_Extended (int size, int tag, void *ptr, const char * fil, int line); 50 | void Z_Free (void *ptr); 51 | void Z_FreeTags (int lowtag, int hightag); 52 | void Z_DumpHeap (int lowtag, int hightag); 53 | void Z_FileDumpHeap (FILE *f); 54 | void Z_CheckHeap (void); 55 | void Z_ChangeTag2 (void *ptr, int tag); 56 | int Z_FreeMemory (void); 57 | 58 | 59 | typedef struct memblock_s 60 | { 61 | int size; // including the header and possibly tiny fragments 62 | void** user; // NULL if a free block 63 | int tag; // purgelevel 64 | int id; // should be ZONEID 65 | struct memblock_s* next; 66 | struct memblock_s* prev; 67 | } memblock_t; 68 | 69 | // 70 | // This is used to get the local FILE:LINE info from CPP 71 | // prior to really call the function in question. 72 | // 73 | #define Z_ChangeTag(p,t) \ 74 | { \ 75 | /* XXX This was edited by CNL because we don't care if the cache is bad. It's almost certainly from a disk thing. */\ 76 | if (( (memblock_t *)( (byte *)(p) - sizeof(memblock_t)))->id!=0x1d4a11) \ 77 | /* I_Error("Z_CT at "__FILE__":%i",__LINE__); */; \ 78 | else \ 79 | Z_ChangeTag2(p,t); \ 80 | }; 81 | 82 | #define Z_Malloc( size, tag, user ) \ 83 | Z_Malloc_Internal_Extended( size, tag, user, __FILE__, __LINE__); \ 84 | 85 | 86 | 87 | #endif 88 | //----------------------------------------------------------------------------- 89 | // 90 | // $Log:$ 91 | // 92 | //----------------------------------------------------------------------------- 93 | --------------------------------------------------------------------------------