├── .github └── workflows │ └── main.yml ├── LICENSE ├── azure-pipelines.yml ├── readme.md ├── uefidoom.dsc └── uefidoom ├── .gitignore ├── CVS ├── Entries ├── Repository └── Root ├── ChangeLog ├── DOOMLIC.TXT ├── FILES ├── FILES2 ├── Makefile ├── README.asm ├── README.b ├── README.book ├── README.gl ├── README.sound ├── TODO ├── am_map.c ├── am_map.h ├── d_englsh.h ├── d_event.h ├── d_french.h ├── d_items.c ├── d_items.h ├── d_main.c ├── d_main.h ├── d_net.c ├── d_net.h ├── d_player.h ├── d_textur.h ├── d_think.h ├── d_ticcmd.h ├── doom.inf ├── doomdata.h ├── doomdef.c ├── doomdef.h ├── doomstat.c ├── doomstat.h ├── doomtype.h ├── dstrings.c ├── dstrings.h ├── efi ├── alloca.h ├── chkstk.nasm ├── i_net.c ├── i_sound.c ├── i_system.c ├── i_video.c └── stb_image_resize.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 ├── info.c ├── info.h ├── m_argv.c ├── m_argv.h ├── m_bbox.c ├── m_bbox.h ├── m_cheat.c ├── m_cheat.h ├── m_fixed.c ├── m_fixed.h ├── m_menu.c ├── m_menu.h ├── m_misc.c ├── m_misc.h ├── m_random.c ├── m_random.h ├── m_swap.c ├── m_swap.h ├── p_ceilng.c ├── p_doors.c ├── p_enemy.c ├── p_floor.c ├── p_inter.c ├── p_inter.h ├── p_lights.c ├── p_local.h ├── p_map.c ├── p_maputl.c ├── p_mobj.c ├── p_mobj.h ├── p_plats.c ├── p_pspr.c ├── p_pspr.h ├── p_saveg.c ├── p_saveg.h ├── p_setup.c ├── p_setup.h ├── p_sight.c ├── p_spec.c ├── p_spec.h ├── p_switch.c ├── p_telept.c ├── p_tick.c ├── p_tick.h ├── p_user.c ├── r_bsp.c ├── r_bsp.h ├── r_data.c ├── r_data.h ├── r_defs.h ├── r_draw.c ├── r_draw.h ├── r_local.h ├── r_main.c ├── r_main.h ├── r_plane.c ├── r_plane.h ├── r_segs.c ├── r_segs.h ├── r_sky.c ├── r_sky.h ├── r_state.h ├── r_things.c ├── r_things.h ├── s_sound.c ├── s_sound.h ├── sound ├── COPYING.txt ├── common.h ├── config.h ├── fastest_coeffs.h ├── float_cast.h ├── high_qual_coeffs.h ├── mid_qual_coeffs.h ├── samplerate.c ├── samplerate.h ├── src_linear.c ├── src_sinc.c └── src_zoh.c ├── sounds.c ├── sounds.h ├── st_lib.c ├── st_lib.h ├── st_stuff.c ├── st_stuff.h ├── tables.c ├── tables.h ├── tools ├── Makefile ├── texdump.c ├── wad.c ├── wad.h └── wadtool.c ├── v_video.c ├── v_video.h ├── w_wad.c ├── w_wad.h ├── wi_stuff.c ├── wi_stuff.h ├── z_zone.c └── z_zone.h /.github/workflows/main.yml: -------------------------------------------------------------------------------- 1 | # This is a basic workflow to help you get started with Actions 2 | 3 | name: CI 4 | 5 | # Controls when the action will run. Triggers the workflow on push or pull request 6 | # events but only for the master branch 7 | on: 8 | push: 9 | branches: [ master ] 10 | pull_request: 11 | branches: [ master ] 12 | 13 | # A workflow run is made up of one or more jobs that can run sequentially or in parallel 14 | jobs: 15 | # This workflow contains a single job called "build" 16 | build: 17 | # The type of runner that the job will run on 18 | runs-on: windows-latest 19 | 20 | # Steps represent a sequence of tasks that will be executed as part of the job 21 | steps: 22 | # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it 23 | - uses: actions/checkout@v2 24 | 25 | # Runs a single command using the runners shell 26 | - name: Run a one-line script 27 | run: Get-ChildItem Env:GITHUB_WORKSPACE 28 | 29 | # Runs a set of commands using the runners shell 30 | - name: Run a multi-line script 31 | run: | 32 | echo Add other actions to build, 33 | echo test, and deploy your project. 34 | -------------------------------------------------------------------------------- /azure-pipelines.yml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | # Start with a minimal pipeline that you can customize to build and deploy your code. 5 | # Add steps that build, run tests, deploy, and more: 6 | # https://aka.ms/yaml 7 | 8 | trigger: 9 | - master 10 | 11 | pool: 12 | vmImage: 'windows-latest' 13 | 14 | steps: 15 | - script: echo Hello, world! 16 | displayName: 'Run a one-line script' 17 | 18 | - script: | 19 | echo Add other tasks to build, test, and deploy your project. 20 | echo See https://aka.ms/yaml 21 | displayName: 'Run a multi-line script' 22 | -------------------------------------------------------------------------------- /readme.md: -------------------------------------------------------------------------------- 1 | # Cacodemon345's UEFI-DOOM (forked from warfish's DOOM repo) 2 | 3 | A port of DOOM to UEFI systems. 4 | Tested with: QEMU with OVMF, MSI B150M-PRO-VD UEFI firmware, a HP Pavilion 8th Gen laptop. 5 | 6 | # Building 7 | Prerequisites: 8 | 1. EDK II: https://github.com/tianocore/edk2 9 | 2. Visual Studio 2015 toolset 10 | 3. EDK II LibC (EADK): https://github.com/tianocore/edk2-libc 11 | 12 | Instructions: 13 | 1. Install the Visual Studio 2015 toolset. 14 | 2. Clone the EDK II and EDK II LibC repo. 15 | 3. Follow the instuctions for setting up the workspace. You also can just drop everything from the EDK II LibC repo to the main EDK II workspace. 16 | 4. Edit the AppPkg.dsc; add the following line at the end of [LibraryClasses] list: 17 | `SerialPortLib|PcAtChipsetPkg/Library/SerialIoLib/SerialIoLib.inf` 18 | Also add the path to the inf file of this project in the [Components] list like this: 19 | `AppPkg/Applications/uefidoom/doom.inf` 20 | 5. Move the "uefidoom" folder from this project inside Applications. 21 | 6. Download the AudioDxe source code from https://github.com/FangJiaZhen/AudioPkg. 22 | 7. Open a command prompt, type `edksetup.bat` (assuming you set up the environment properly) and then type `build -t VS2015 -b DEBUG -a X64` 23 | 8. If everything goes well, look for a file called "doom.efi" inside this path: 24 | `path\to\edk2\Build\AppPkg\DEBUG_VS2015\X64\` 25 | 9. Now just copy the Doom IWADs into it. 26 | This should make sure everything is ready for playing. 27 | # Running: 28 | Make sure you have a UEFI environment in your real hardware. Also, make sure the executable resides inside a FAT32 partition and that the DOOM IWAD files resides in the same directory as the executable. 29 | You will also need UEFI command-line shell for that (binaries are available online). 30 | Steps: 31 | 1. Build the UEFI Shell package (ShellPkg) using `build -t VS2015 -a X64 -p ShellPkg/ShellPkg.dsc -b DEBUG` (run edksetup.bat before that, once again assuming the environment is properly set). If everything goes well, look for `Shell.efi` inside `path\to\edk2\Build\DEBUG_VS2015\X64\ShellPkg\Application\Shell\Shell\OUTPUT` 32 | Alternative: Look for a EFI Shell binary online. 33 | 2. Copy the shell binary into a FAT32-formatted USB key; make a folder named EFI, make another folder inside it named BOOT, and copy the shell binary into it. 34 | 3. Rename it into `BOOTX64.efi` 35 | 4. Boot your UEFI computer into the UEFI Shell environment. 36 | 5. Change to the directory where the "doom.efi" exec is stored (change the current filesystem drive to the one that contains the exec e.g `FS0:`) 37 | 6. Type "doom" to start DOOM. 38 | # Bugs: 39 | 1. The "numsprites" variable in the sprite loading function will be decreased by 3 to allow it to load the sprites. 40 | 2. ~~Game is very slow.~~ 41 | 3. ~~TICRATE constant remains 65 from the original DOOM UEFI port by warfish.~~ 42 | 4. ~~In-game input doesn't work?~~ 43 | # Planned: 44 | 1. Audio support (using GoldFish64's AudioDxe driver). 45 | # Helping 46 | Help is accepted! Please let me know of any problems. Thanks. 47 | -------------------------------------------------------------------------------- /uefidoom.dsc: -------------------------------------------------------------------------------- 1 | [Defines] 2 | PLATFORM_NAME = DoomPkg 3 | PLATFORM_GUID = 4f6d7f8a-555c-4691-bcbd-538d1580223b 4 | PLATFORM_VERSION = 0.01 5 | DSC_SPECIFICATION = 0x00010006 6 | OUTPUT_DIRECTORY = Build/DoomPkg 7 | SUPPORTED_ARCHITECTURES = IA32|X64|ARM|AARCH64 8 | BUILD_TARGETS = DEBUG|RELEASE|NOOPT 9 | SKUID_IDENTIFIER = DEFAULT 10 | 11 | # 12 | # Debug output control 13 | # 14 | DEFINE DEBUG_ENABLE_OUTPUT = FALSE # Set to TRUE to enable debug output 15 | DEFINE DEBUG_PRINT_ERROR_LEVEL = 0x80000040 # Flags to control amount of debug output 16 | DEFINE DEBUG_PROPERTY_MASK = 0 17 | 18 | [PcdsFeatureFlag] 19 | 20 | [PcdsFixedAtBuild] 21 | gEfiMdePkgTokenSpaceGuid.PcdDebugPropertyMask|$(DEBUG_PROPERTY_MASK) 22 | gEfiMdePkgTokenSpaceGuid.PcdDebugPrintErrorLevel|$(DEBUG_PRINT_ERROR_LEVEL) 23 | 24 | [LibraryClasses] 25 | # 26 | # Entry Point Libraries 27 | # 28 | UefiApplicationEntryPoint|MdePkg/Library/UefiApplicationEntryPoint/UefiApplicationEntryPoint.inf 29 | ShellCEntryLib|ShellPkg/Library/UefiShellCEntryLib/UefiShellCEntryLib.inf 30 | UefiDriverEntryPoint|MdePkg/Library/UefiDriverEntryPoint/UefiDriverEntryPoint.inf 31 | # 32 | # Common Libraries 33 | # 34 | BaseLib|MdePkg/Library/BaseLib/BaseLib.inf 35 | BaseMemoryLib|MdePkg/Library/BaseMemoryLib/BaseMemoryLib.inf 36 | UefiLib|MdePkg/Library/UefiLib/UefiLib.inf 37 | PrintLib|MdePkg/Library/BasePrintLib/BasePrintLib.inf 38 | PcdLib|MdePkg/Library/BasePcdLibNull/BasePcdLibNull.inf 39 | MemoryAllocationLib|MdePkg/Library/UefiMemoryAllocationLib/UefiMemoryAllocationLib.inf 40 | UefiBootServicesTableLib|MdePkg/Library/UefiBootServicesTableLib/UefiBootServicesTableLib.inf 41 | UefiRuntimeServicesTableLib|MdePkg/Library/UefiRuntimeServicesTableLib/UefiRuntimeServicesTableLib.inf 42 | !if $(DEBUG_ENABLE_OUTPUT) 43 | DebugLib|MdePkg/Library/UefiDebugLibConOut/UefiDebugLibConOut.inf 44 | DebugPrintErrorLevelLib|MdePkg/Library/BaseDebugPrintErrorLevelLib/BaseDebugPrintErrorLevelLib.inf 45 | !else ## DEBUG_ENABLE_OUTPUT 46 | DebugLib|MdePkg/Library/BaseDebugLibNull/BaseDebugLibNull.inf 47 | !endif ## DEBUG_ENABLE_OUTPUT 48 | 49 | DevicePathLib|MdePkg/Library/UefiDevicePathLib/UefiDevicePathLib.inf 50 | PeCoffGetEntryPointLib|MdePkg/Library/BasePeCoffGetEntryPointLib/BasePeCoffGetEntryPointLib.inf 51 | IoLib|MdePkg/Library/BaseIoLibIntrinsic/BaseIoLibIntrinsic.inf 52 | PciLib|MdePkg/Library/BasePciLibCf8/BasePciLibCf8.inf 53 | PciCf8Lib|MdePkg/Library/BasePciCf8Lib/BasePciCf8Lib.inf 54 | SynchronizationLib|MdePkg/Library/BaseSynchronizationLib/BaseSynchronizationLib.inf 55 | UefiRuntimeLib|MdePkg/Library/UefiRuntimeLib/UefiRuntimeLib.inf 56 | HiiLib|MdeModulePkg/Library/UefiHiiLib/UefiHiiLib.inf 57 | UefiHiiServicesLib|MdeModulePkg/Library/UefiHiiServicesLib/UefiHiiServicesLib.inf 58 | PerformanceLib|MdeModulePkg/Library/DxePerformanceLib/DxePerformanceLib.inf 59 | HobLib|MdePkg/Library/DxeHobLib/DxeHobLib.inf 60 | FileHandleLib|MdePkg/Library/UefiFileHandleLib/UefiFileHandleLib.inf 61 | SortLib|MdeModulePkg/Library/UefiSortLib/UefiSortLib.inf 62 | SerialPortLib|PcAtChipsetPkg/Library/SerialIoLib/SerialIoLib.inf 63 | ShellLib|ShellPkg/Library/UefiShellLib/UefiShellLib.inf 64 | LocalApicLib|UefiCpuPkg/Library/BaseXApicLib/BaseXApicLib.inf 65 | TimerLib|UefiCpuPkg/Library/SecPeiDxeTimerLibUefiCpu/SecPeiDxeTimerLibUefiCpu.inf 66 | 67 | CacheMaintenanceLib|MdePkg/Library/BaseCacheMaintenanceLib/BaseCacheMaintenanceLib.inf 68 | [Components] 69 | uefidoom/uefidoom/doom.inf 70 | 71 | !include StdLib/StdLib.inc 72 | -------------------------------------------------------------------------------- /uefidoom/.gitignore: -------------------------------------------------------------------------------- 1 | linux/* 2 | *.swp 3 | -------------------------------------------------------------------------------- /uefidoom/CVS/Entries: -------------------------------------------------------------------------------- 1 | /ChangeLog/1.14/Mon Feb 3 22:45:08 1997// 2 | /DOOMLIC.TXT/1.3/Sun Jan 26 07:44:56 1997// 3 | /FILES/1.1/Sun Jan 19 17:22:41 1997// 4 | /FILES2/1.1/Sun Jan 19 17:22:42 1997// 5 | /Makefile/1.6/Mon Feb 3 22:45:08 1997// 6 | /am_data.h/1.2/Tue Jan 21 18:59:56 1997// 7 | /am_map.c/1.4/Mon Feb 3 21:24:33 1997// 8 | /am_map.h/1.2/Tue Jan 21 18:59:56 1997// 9 | /d_englsh.h/1.1/Mon Feb 3 21:48:03 1997// 10 | /d_event.h/1.2/Mon Feb 3 22:01:47 1997// 11 | /d_french.h/1.3/Mon Feb 3 21:48:03 1997// 12 | /d_main.c/1.8/Mon Feb 3 22:45:09 1997// 13 | /d_net.c/1.3/Mon Feb 3 22:01:47 1997// 14 | /d_textur.h/1.1/Mon Feb 3 16:47:51 1997// 15 | /doomdata.h/1.5/Mon Feb 3 22:45:09 1997// 16 | /doomdef.h/1.9/Mon Feb 3 22:45:09 1997// 17 | /doomtype.h/1.2/Mon Feb 3 22:45:09 1997// 18 | /dstrings.h/1.4/Mon Feb 3 21:48:03 1997// 19 | /dutils.c/1.5/Mon Feb 3 17:11:23 1997// 20 | /dutils.h/1.4/Mon Feb 3 17:11:23 1997// 21 | /f_finale.c/1.5/Mon Feb 3 21:26:34 1997// 22 | /f_finale.h/1.1/Mon Feb 3 21:26:34 1997// 23 | /f_wipe.c/1.2/Mon Feb 3 22:45:09 1997// 24 | /f_wipe.h/1.1/Mon Feb 3 17:11:23 1997// 25 | /fpfunc.S/1.1/Sun Jan 19 17:22:43 1997// 26 | /g_game.c/1.8/Mon Feb 3 22:45:09 1997// 27 | /g_game.h/1.1/Mon Feb 3 21:34:47 1997// 28 | /hu_lib.c/1.3/Sun Jan 26 07:44:58 1997// 29 | /hu_lib.h/1.4/Mon Feb 3 16:47:52 1997// 30 | /hu_stuff.c/1.4/Mon Feb 3 16:47:52 1997// 31 | /hu_stuff.h/1.3/Sun Jan 26 07:44:58 1997// 32 | /i_dga.c/1.3/Sun Jan 26 07:44:58 1997// 33 | /i_ibm.c/1.3/Sun Jan 26 07:44:58 1997// 34 | /i_main.c/1.4/Mon Feb 3 22:45:10 1997// 35 | /i_pcnet.c/1.3/Sun Jan 26 07:44:59 1997// 36 | /i_sound.c/1.3/Sun Jan 26 07:44:59 1997// 37 | /i_sound.h/1.3/Sun Jan 26 07:44:59 1997// 38 | /i_svga.c/1.3/Sun Jan 26 07:44:59 1997// 39 | /i_unix.c/1.5/Mon Feb 3 22:45:10 1997// 40 | /i_x.c/1.6/Mon Feb 3 22:45:10 1997// 41 | /info.c/1.3/Sun Jan 26 07:45:00 1997// 42 | /info.h/1.3/Sun Jan 26 07:45:00 1997// 43 | /irix.c/1.3/Sun Jan 26 07:45:00 1997// 44 | /irix.h/1.3/Sun Jan 26 07:45:01 1997// 45 | /linux.c/1.3/Sun Jan 26 07:45:01 1997// 46 | /m_argv.c/1.1/Mon Feb 3 22:45:10 1997// 47 | /m_argv.h/1.1/Mon Feb 3 22:45:10 1997// 48 | /m_bbox.c/1.1/Mon Feb 3 22:45:10 1997// 49 | /m_bbox.h/1.1/Mon Feb 3 22:45:10 1997// 50 | /m_cheat.c/1.1/Mon Feb 3 21:24:34 1997// 51 | /m_cheat.h/1.1/Mon Feb 3 21:24:34 1997// 52 | /m_menu.c/1.7/Mon Feb 3 22:45:10 1997// 53 | /m_menu.h/1.1/Mon Feb 3 22:01:49 1997// 54 | /m_misc.c/1.6/Mon Feb 3 22:45:10 1997// 55 | /m_misc.h/1.1/Mon Feb 3 22:45:11 1997// 56 | /m_random.c/1.1/Mon Feb 3 22:45:11 1997// 57 | /m_random.h/1.1/Mon Feb 3 22:45:11 1997// 58 | /p_ceilng.c/1.4/Mon Feb 3 16:47:53 1997// 59 | /p_doors.c/1.4/Mon Feb 3 16:47:53 1997// 60 | /p_enemy.c/1.5/Mon Feb 3 22:45:11 1997// 61 | /p_floor.c/1.4/Mon Feb 3 16:47:54 1997// 62 | /p_inter.c/1.4/Mon Feb 3 22:45:11 1997// 63 | /p_lights.c/1.5/Mon Feb 3 22:45:11 1997// 64 | /p_local.h/1.3/Tue Jan 28 22:08:27 1997// 65 | /p_map.c/1.5/Mon Feb 3 22:45:11 1997// 66 | /p_maputl.c/1.5/Mon Feb 3 22:45:11 1997// 67 | /p_mobj.c/1.5/Mon Feb 3 22:45:12 1997// 68 | /p_plats.c/1.5/Mon Feb 3 22:45:12 1997// 69 | /p_pspr.c/1.5/Mon Feb 3 22:45:12 1997// 70 | /p_setup.c/1.5/Mon Feb 3 22:45:12 1997// 71 | /p_sight.c/1.3/Tue Jan 28 22:08:28 1997// 72 | /p_spec.c/1.6/Mon Feb 3 22:45:12 1997// 73 | /p_spec.h/1.3/Tue Jan 28 22:08:29 1997// 74 | /p_switch.c/1.3/Tue Jan 28 22:08:29 1997// 75 | /p_telept.c/1.3/Tue Jan 28 22:08:29 1997// 76 | /p_tick.c/1.4/Mon Feb 3 16:47:55 1997// 77 | /p_user.c/1.3/Tue Jan 28 22:08:29 1997// 78 | /r_bsp.c/1.4/Mon Feb 3 22:45:12 1997// 79 | /r_data.c/1.4/Mon Feb 3 16:47:55 1997// 80 | /r_draw.c/1.4/Mon Feb 3 16:47:55 1997// 81 | /r_local.h/1.4/Mon Feb 3 21:26:34 1997// 82 | /r_main.c/1.5/Mon Feb 3 22:45:12 1997// 83 | /r_plane.c/1.4/Mon Feb 3 16:47:55 1997// 84 | /r_segs.c/1.3/Wed Jan 29 20:10:19 1997// 85 | /r_things.c/1.5/Mon Feb 3 16:47:56 1997// 86 | /s_sound.c/1.6/Mon Feb 3 22:45:12 1997// 87 | /sounds.c/1.3/Wed Jan 29 22:40:44 1997// 88 | /sounds.h/1.3/Wed Jan 29 22:40:44 1997// 89 | /soundsrv.c/1.3/Wed Jan 29 22:40:44 1997// 90 | /soundsrv.h/1.3/Wed Jan 29 22:40:44 1997// 91 | /soundst.h/1.3/Wed Jan 29 22:40:45 1997// 92 | /st_lib.c/1.4/Mon Feb 3 16:47:56 1997// 93 | /st_lib.h/1.4/Mon Feb 3 16:47:56 1997// 94 | /st_stuff.c/1.6/Mon Feb 3 22:45:13 1997// 95 | /st_stuff.h/1.3/Thu Jan 30 19:54:22 1997// 96 | /sun.c/1.3/Thu Jan 30 19:54:22 1997// 97 | /tables.c/1.4/Mon Feb 3 16:47:57 1997// 98 | /tables.h/1.1/Mon Feb 3 16:47:57 1997// 99 | /tmap.S/1.1/Sun Jan 19 17:22:51 1997// 100 | /v_video.c/1.5/Mon Feb 3 22:45:13 1997// 101 | /v_video.h/1.2/Mon Feb 3 17:11:59 1997// 102 | /w_wad.c/1.5/Mon Feb 3 16:47:57 1997// 103 | /wadread.c/1.3/Thu Jan 30 19:54:23 1997// 104 | /wadread.h/1.3/Thu Jan 30 19:54:23 1997// 105 | /wi_data.h/1.3/Thu Jan 30 19:54:23 1997// 106 | /wi_stuff.c/1.7/Mon Feb 3 22:45:13 1997// 107 | /wi_stuff.h/1.4/Mon Feb 3 16:47:58 1997// 108 | /z_zone.c/1.4/Mon Feb 3 16:47:58 1997// 109 | /z_zone.h/1.1/Mon Feb 3 16:47:58 1997// 110 | -------------------------------------------------------------------------------- /uefidoom/CVS/Repository: -------------------------------------------------------------------------------- 1 | /info/cvsroot/id/id_doom 2 | -------------------------------------------------------------------------------- /uefidoom/CVS/Root: -------------------------------------------------------------------------------- 1 | /info/cvsroot/ 2 | -------------------------------------------------------------------------------- /uefidoom/DOOMLIC.TXT: -------------------------------------------------------------------------------- 1 | 2 | 3 | LIMITED USE SOFTWARE LICENSE AGREEMENT 4 | 5 | This Limited Use Software License Agreement (the "Agreement") 6 | is a legal agreement between you, the end-user, and Id Software, Inc. 7 | ("ID"). By downloading or purchasing the software material, which 8 | includes source code (the "Source Code"), artwork data, music and 9 | software tools (collectively, the "Software"), you are agreeing to 10 | be bound by the terms of this Agreement. If you do not agree to the 11 | terms of this Agreement, promptly destroy the Software you may have 12 | downloaded or copied. 13 | 14 | ID SOFTWARE LICENSE 15 | 16 | 1. Grant of License. ID grants to you the right to use the 17 | Software. You have no ownership or proprietary rights in or to the 18 | Software, or the Trademark. For purposes of this section, "use" means 19 | loading the Software into RAM, as well as installation on a hard disk 20 | or other storage device. The Software, together with any archive copy 21 | thereof, shall be destroyed when no longer used in accordance with 22 | this Agreement, or when the right to use the Software is terminated. 23 | You agree that the Software will not be shipped, transferred or 24 | exported into any country in violation of the U.S. Export 25 | Administration Act (or any other law governing such matters) and that 26 | you will not utilize, in any other manner, the Software in violation 27 | of any applicable law. 28 | 29 | 2. Permitted Uses. For educational purposes only, you, the 30 | end-user, may use portions of the Source Code, such as particular 31 | routines, to develop your own software, but may not duplicate the 32 | Source Code, except as noted in paragraph 4. The limited right 33 | referenced in the preceding sentence is hereinafter referred to as 34 | "Educational Use." By so exercising the Educational Use right you 35 | shall not obtain any ownership, copyright, proprietary or other 36 | interest in or to the Source Code, or any portion of the Source 37 | Code. You may dispose of your own software in your sole discretion. 38 | With the exception of the Educational Use right, you may not 39 | otherwise use the Software, or an portion of the Software, which 40 | includes the Source Code, for commercial gain. 41 | 42 | 3. Prohibited Uses: Under no circumstances shall you, the 43 | end-user, be permitted, allowed or authorized to commercially exploit 44 | the Software. Neither you nor anyone at your direction shall do any 45 | of the following acts with regard to the Software, or any portion 46 | thereof: 47 | 48 | Rent; 49 | 50 | Sell; 51 | 52 | Lease; 53 | 54 | Offer on a pay-per-play basis; 55 | 56 | Distribute for money or any other consideration; or 57 | 58 | In any other manner and through any medium whatsoever 59 | commercially exploit or use for any commercial purpose. 60 | 61 | Notwithstanding the foregoing prohibitions, you may commercially 62 | exploit the software you develop by exercising the Educational Use 63 | right, referenced in paragraph 2. hereinabove. 64 | 65 | 4. Copyright. The Software and all copyrights related thereto 66 | (including all characters and other images generated by the Software 67 | or depicted in the Software) are owned by ID and is protected by 68 | United States copyright laws and international treaty provisions. 69 | Id shall retain exclusive ownership and copyright in and to the 70 | Software and all portions of the Software and you shall have no 71 | ownership or other proprietary interest in such materials. You must 72 | treat the Software like any other copyrighted material. You may not 73 | otherwise reproduce, copy or disclose to others, in whole or in any 74 | part, the Software. You may not copy the written materials 75 | accompanying the Software. You agree to use your best efforts to 76 | see that any user of the Software licensed hereunder complies with 77 | this Agreement. 78 | 79 | 5. NO WARRANTIES. ID DISCLAIMS ALL WARRANTIES, BOTH EXPRESS 80 | IMPLIED, INCLUDING BUT NOT LIMITED TO, IMPLIED WARRANTIES OF 81 | MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE WITH RESPECT 82 | TO THE SOFTWARE. THIS LIMITED WARRANTY GIVES YOU SPECIFIC LEGAL 83 | RIGHTS. YOU MAY HAVE OTHER RIGHTS WHICH VARY FROM JURISDICTION TO 84 | JURISDICTION. ID DOES NOT WARRANT THAT THE OPERATION OF THE SOFTWARE 85 | WILL BE UNINTERRUPTED, ERROR FREE OR MEET YOUR SPECIFIC REQUIREMENTS. 86 | THE WARRANTY SET FORTH ABOVE IS IN LIEU OF ALL OTHER EXPRESS 87 | WARRANTIES WHETHER ORAL OR WRITTEN. THE AGENTS, EMPLOYEES, 88 | DISTRIBUTORS, AND DEALERS OF ID ARE NOT AUTHORIZED TO MAKE 89 | MODIFICATIONS TO THIS WARRANTY, OR ADDITIONAL WARRANTIES ON BEHALF 90 | OF ID. 91 | 92 | Exclusive Remedies. The Software is being offered to you 93 | free of any charge. You agree that you have no remedy against ID, its 94 | affiliates, contractors, suppliers, and agents for loss or damage 95 | caused by any defect or failure in the Software regardless of the form 96 | of action, whether in contract, tort, includinegligence, strict 97 | liability or otherwise, with regard to the Software. This Agreement 98 | shall be construed in accordance with and governed by the laws of the 99 | State of Texas. Copyright and other proprietary matters will be 100 | governed by United States laws and international treaties. IN ANY 101 | CASE, ID SHALL NOT BE LIABLE FOR LOSS OF DATA, LOSS OF PROFITS, LOST 102 | SAVINGS, SPECIAL, INCIDENTAL, CONSEQUENTIAL, INDIRECT OR OTHER 103 | SIMILAR DAMAGES ARISING FROM BREACH OF WARRANTY, BREACH OF CONTRACT, 104 | NEGLIGENCE, OR OTHER LEGAL THEORY EVEN IF ID OR ITS AGENT HAS BEEN 105 | ADVISED OF THE POSSIBILITY OF SUCH DAMAGES, OR FOR ANY CLAIM BY ANY 106 | OTHER PARTY. Some jurisdictions do not allow the exclusion or 107 | limitation of incidental or consequential damages, so the above 108 | limitation or exclusion may not apply to you. 109 | 110 | 111 | 112 | 113 | -------------------------------------------------------------------------------- /uefidoom/Makefile: -------------------------------------------------------------------------------- 1 | ################################################################ 2 | # 3 | # $Id:$ 4 | # 5 | # $Log:$ 6 | # 7 | CC= gcc # gcc or g++ 8 | 9 | CFLAGS=-g -Wall -DNORMALUNIX -DLINUX -I. # -DUSEASM 10 | LDFLAGS=-L/usr/X11R6/lib 11 | LIBS=-lm 12 | 13 | # subdirectory for objects 14 | O=linux 15 | 16 | # not too sophisticated dependency 17 | OBJS= \ 18 | $(O)/doomdef.o \ 19 | $(O)/doomstat.o \ 20 | $(O)/dstrings.o \ 21 | $(O)/i_system.o \ 22 | $(O)/i_sound.o \ 23 | $(O)/i_video.o \ 24 | $(O)/i_net.o \ 25 | $(O)/tables.o \ 26 | $(O)/f_finale.o \ 27 | $(O)/f_wipe.o \ 28 | $(O)/d_main.o \ 29 | $(O)/d_net.o \ 30 | $(O)/d_items.o \ 31 | $(O)/g_game.o \ 32 | $(O)/m_menu.o \ 33 | $(O)/m_misc.o \ 34 | $(O)/m_argv.o \ 35 | $(O)/m_bbox.o \ 36 | $(O)/m_fixed.o \ 37 | $(O)/m_swap.o \ 38 | $(O)/m_cheat.o \ 39 | $(O)/m_random.o \ 40 | $(O)/am_map.o \ 41 | $(O)/p_ceilng.o \ 42 | $(O)/p_doors.o \ 43 | $(O)/p_enemy.o \ 44 | $(O)/p_floor.o \ 45 | $(O)/p_inter.o \ 46 | $(O)/p_lights.o \ 47 | $(O)/p_map.o \ 48 | $(O)/p_maputl.o \ 49 | $(O)/p_plats.o \ 50 | $(O)/p_pspr.o \ 51 | $(O)/p_setup.o \ 52 | $(O)/p_sight.o \ 53 | $(O)/p_spec.o \ 54 | $(O)/p_switch.o \ 55 | $(O)/p_mobj.o \ 56 | $(O)/p_telept.o \ 57 | $(O)/p_tick.o \ 58 | $(O)/p_saveg.o \ 59 | $(O)/p_user.o \ 60 | $(O)/r_bsp.o \ 61 | $(O)/r_data.o \ 62 | $(O)/r_draw.o \ 63 | $(O)/r_main.o \ 64 | $(O)/r_plane.o \ 65 | $(O)/r_segs.o \ 66 | $(O)/r_sky.o \ 67 | $(O)/r_things.o \ 68 | $(O)/w_wad.o \ 69 | $(O)/wi_stuff.o \ 70 | $(O)/v_video.o \ 71 | $(O)/st_lib.o \ 72 | $(O)/st_stuff.o \ 73 | $(O)/hu_stuff.o \ 74 | $(O)/hu_lib.o \ 75 | $(O)/s_sound.o \ 76 | $(O)/z_zone.o \ 77 | $(O)/info.o \ 78 | $(O)/sounds.o 79 | 80 | all: $(O)/linuxxdoom 81 | 82 | clean: 83 | rm -f *.o *~ *.flc 84 | rm -f linux/* 85 | 86 | $(O)/linuxxdoom: $(OBJS) $(O)/i_main.o 87 | $(CC) $(CFLAGS) $(LDFLAGS) $(OBJS) $(O)/i_main.o \ 88 | -o $(O)/linuxxdoom $(LIBS) 89 | 90 | $(O)/%.o: %.c 91 | $(CC) $(CFLAGS) -c $< -o $@ 92 | 93 | $(O)/i_sound.o: efi/i_sound.c 94 | $(CC) $(CFLAGS) -c $< -o $@ 95 | 96 | $(O)/i_net.o: efi/i_net.c 97 | $(CC) $(CFLAGS) -c $< -o $@ 98 | 99 | $(O)/i_system.o: efi/i_system.c 100 | $(CC) $(CFLAGS) -c $< -o $@ 101 | 102 | $(O)/i_video.o: efi/i_video.c 103 | $(CC) $(CFLAGS) -c $< -o $@ 104 | 105 | ############################################################# 106 | # 107 | ############################################################# 108 | -------------------------------------------------------------------------------- /uefidoom/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 | -------------------------------------------------------------------------------- /uefidoom/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 | -------------------------------------------------------------------------------- /uefidoom/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 | -------------------------------------------------------------------------------- /uefidoom/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 | -------------------------------------------------------------------------------- /uefidoom/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 | -------------------------------------------------------------------------------- /uefidoom/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 | -------------------------------------------------------------------------------- /uefidoom/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 | -------------------------------------------------------------------------------- /uefidoom/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 | -------------------------------------------------------------------------------- /uefidoom/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 | -------------------------------------------------------------------------------- /uefidoom/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 | -------------------------------------------------------------------------------- /uefidoom/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 | -------------------------------------------------------------------------------- /uefidoom/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 | -------------------------------------------------------------------------------- /uefidoom/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 | -------------------------------------------------------------------------------- /uefidoom/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 | -------------------------------------------------------------------------------- /uefidoom/doom.inf: -------------------------------------------------------------------------------- 1 | 2 | [Defines] 3 | INF_VERSION = 0x00010005 4 | BASE_NAME = doom 5 | FILE_GUID = 6987936E-ED34-44db-AE97-1FA5E4ED2116 6 | MODULE_TYPE = UEFI_APPLICATION 7 | VERSION_STRING = 1.0 8 | ENTRY_POINT = ShellCEntryLib 9 | 10 | # 11 | # The following information is for reference only and not required by the build tools. 12 | # 13 | # VALID_ARCHITECTURES = IA32 X64 IPF EBC 14 | # 15 | 16 | [Sources] 17 | efi/i_system.c 18 | efi/i_net.c 19 | efi/i_sound.c 20 | efi/i_video.c 21 | sound/samplerate.c 22 | sound/src_linear.c 23 | sound/src_sinc.c 24 | sound/src_zoh.c 25 | am_map.c 26 | d_items.c 27 | d_main.c 28 | d_net.c 29 | doomdef.c 30 | doomstat.c 31 | dstrings.c 32 | f_finale.c 33 | f_wipe.c 34 | g_game.c 35 | hu_lib.c 36 | hu_stuff.c 37 | i_main.c 38 | info.c 39 | m_argv.c 40 | m_bbox.c 41 | m_cheat.c 42 | m_fixed.c 43 | m_menu.c 44 | m_misc.c 45 | m_random.c 46 | m_swap.c 47 | p_ceilng.c 48 | p_doors.c 49 | p_enemy.c 50 | p_floor.c 51 | p_inter.c 52 | p_lights.c 53 | p_map.c 54 | p_maputl.c 55 | p_mobj.c 56 | p_plats.c 57 | p_pspr.c 58 | p_saveg.c 59 | p_setup.c 60 | p_sight.c 61 | p_spec.c 62 | p_switch.c 63 | p_telept.c 64 | p_tick.c 65 | p_user.c 66 | r_bsp.c 67 | r_data.c 68 | r_draw.c 69 | r_main.c 70 | r_plane.c 71 | r_segs.c 72 | r_sky.c 73 | r_things.c 74 | s_sound.c 75 | sounds.c 76 | st_lib.c 77 | st_stuff.c 78 | tables.c 79 | v_video.c 80 | w_wad.c 81 | wi_stuff.c 82 | z_zone.c 83 | 84 | [Sources.X64] 85 | efi/chkstk.nasm | MSFT 86 | 87 | [Packages] 88 | MdePkg/MdePkg.dec 89 | MdeModulePkg/MdeModulePkg.dec 90 | ShellPkg/ShellPkg.dec 91 | StdLib/StdLib.dec 92 | AudioPkg/AudioPkg.dec 93 | [LibraryClasses] 94 | UefiApplicationEntryPoint 95 | UefiLib 96 | LibC 97 | ShellCEntryLib 98 | UefiBootServicesTableLib 99 | DevShell 100 | SerialPortLib 101 | LibMath 102 | 103 | [Protocols] 104 | gEfiLoadedImageProtocolGuid 105 | gEfiDevicePathToTextProtocolGuid 106 | gEfiSimplePointerProtocolGuid 107 | gEfiSimpleTextInputExProtocolGuid 108 | gEfiAudioIoProtocolGuid 109 | 110 | [BuildOptions] 111 | *:*_*_*_CC_FLAGS = -DNORMALUNIX 112 | MSFT:*_*_*_CC_FLAGS = -DNORMALUNIX /W2 /WX- /WL /FAs 113 | GCC:*_*_*_CC_FLAGS = -fno-stack-clash-protection -Wno-error 114 | 115 | -------------------------------------------------------------------------------- /uefidoom/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 | -------------------------------------------------------------------------------- /uefidoom/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 | -------------------------------------------------------------------------------- /uefidoom/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 | -------------------------------------------------------------------------------- /uefidoom/doomtype.h: -------------------------------------------------------------------------------- 1 | // Emacs style mode select -*- C++ -*- 2 | //----------------------------------------------------------------------------- 3 | // 4 | // $Id:$ 5 | // 6 | // Copyright (C) 1993-1996 by id Software, Inc. 7 | // 8 | // This source is available for distribution and/or modification 9 | // only under the terms of the DOOM Source Code License as 10 | // published by id Software. All rights reserved. 11 | // 12 | // The source is distributed in the hope that it will be useful, 13 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | // FITNESS FOR A PARTICULAR PURPOSE. See the DOOM Source Code License 15 | // for more details. 16 | // 17 | // DESCRIPTION: 18 | // Simple basic typedefs, isolated here to make it easier 19 | // separating modules. 20 | // 21 | //----------------------------------------------------------------------------- 22 | 23 | 24 | #ifndef __DOOMTYPE__ 25 | #define __DOOMTYPE__ 26 | 27 | 28 | #ifndef __BYTEBOOL__ 29 | #define __BYTEBOOL__ 30 | // Fixed to use builtin bool type with C++. 31 | #ifdef __cplusplus 32 | typedef bool boolean; 33 | #else 34 | typedef enum {false, true} boolean; 35 | #endif 36 | typedef unsigned char byte; 37 | #endif 38 | 39 | 40 | // Predefined with some OS. 41 | //#ifdef LINUX 42 | //#include 43 | //#include 44 | //#else 45 | #define MAXCHAR ((char)0x7f) 46 | #define MAXSHORT ((short)0x7fff) 47 | 48 | // Max pos 32-bit int. 49 | #define MAXINT ((int)0x7fffffff) 50 | #define MAXLONG ((long)0x7fffffff) 51 | #define MINCHAR ((char)0x80) 52 | #define MINSHORT ((short)0x8000) 53 | 54 | // Max negative 32-bit integer. 55 | #define MININT ((int)0x80000000) 56 | #define MINLONG ((long)0x80000000) 57 | //#endif 58 | 59 | 60 | 61 | 62 | #endif 63 | //----------------------------------------------------------------------------- 64 | // 65 | // $Log:$ 66 | // 67 | //----------------------------------------------------------------------------- 68 | -------------------------------------------------------------------------------- /uefidoom/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 | -------------------------------------------------------------------------------- /uefidoom/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 | -------------------------------------------------------------------------------- /uefidoom/efi/alloca.h: -------------------------------------------------------------------------------- 1 | #ifndef EFI_ALLOCA_H 2 | #define EFI_ALLOCA_H 3 | 4 | #include 5 | 6 | #if defined(__GNUC__) 7 | #define alloca __builtin_alloca 8 | #elif defined(_MSC_VER) 9 | #define alloca(size) _alloca(size) 10 | void *_alloca(size_t); 11 | #else 12 | #error Not supported 13 | #endif 14 | 15 | #endif // EFI_ALLOCA_H 16 | -------------------------------------------------------------------------------- /uefidoom/efi/chkstk.nasm: -------------------------------------------------------------------------------- 1 | SECTION .text 2 | 3 | ; A stub needed for alloca() support in MS compiler 4 | global ASM_PFX(__chkstk) 5 | ASM_PFX(__chkstk): 6 | ret 7 | -------------------------------------------------------------------------------- /uefidoom/efi/i_net.c: -------------------------------------------------------------------------------- 1 | 2 | #include 3 | #include 4 | #include 5 | #include 6 | 7 | void I_InitNetwork (void) 8 | { 9 | boolean trueval = true; 10 | int i; 11 | int p; 12 | 13 | doomcom = (doomcom_t*)malloc (sizeof (*doomcom) ); 14 | memset (doomcom, 0, sizeof(*doomcom) ); 15 | 16 | // set up for network 17 | i = M_CheckParm ("-dup"); 18 | 19 | if (i && i< myargc-1) 20 | { 21 | doomcom->ticdup = myargv[i+1][0]-'0'; 22 | if (doomcom->ticdup < 1) 23 | doomcom->ticdup = 1; 24 | if (doomcom->ticdup > 9) 25 | doomcom->ticdup = 9; 26 | } 27 | else 28 | doomcom-> ticdup = 1; 29 | 30 | if (M_CheckParm ("-extratic")) 31 | doomcom-> extratics = 1; 32 | else 33 | doomcom-> extratics = 0; 34 | 35 | //p = M_CheckParm ("-port"); 36 | //if (p && p ... 44 | i = M_CheckParm ("-net"); 45 | if (!i) 46 | { 47 | printf("Initializing single player game\n"); 48 | // single player game 49 | netgame = false; 50 | doomcom->id = DOOMCOM_ID; 51 | doomcom->numplayers = doomcom->numnodes = 1; 52 | doomcom->deathmatch = false; 53 | doomcom->consoleplayer = 0; 54 | return; 55 | } 56 | 57 | //netsend = PacketSend; 58 | //netget = PacketGet; 59 | //netgame = true; 60 | 61 | // parse player number and host list 62 | //doomcom->consoleplayer = myargv[i+1][0]-'1'; 63 | 64 | //doomcom->numnodes = 1; // this node for sure 65 | 66 | //i++; 67 | /* 68 | while (++i < myargc && myargv[i][0] != '-') 69 | { 70 | sendaddress[doomcom->numnodes].sin_family = AF_INET; 71 | sendaddress[doomcom->numnodes].sin_port = htons(DOOMPORT); 72 | if (myargv[i][0] == '.') 73 | { 74 | sendaddress[doomcom->numnodes].sin_addr.s_addr = inet_addr (myargv[i]+1); 75 | } 76 | else 77 | { 78 | hostentry = gethostbyname (myargv[i]); 79 | if (!hostentry) 80 | I_Error ("gethostbyname: couldn't find %s", myargv[i]); 81 | 82 | sendaddress[doomcom->numnodes].sin_addr.s_addr = *(int *)hostentry->h_addr_list[0]; 83 | } 84 | 85 | doomcom->numnodes++; 86 | } 87 | 88 | doomcom->id = DOOMCOM_ID; 89 | doomcom->numplayers = doomcom->numnodes; 90 | 91 | // build message to receive 92 | insocket = UDPsocket (); 93 | BindToLocalPort (insocket,htons(DOOMPORT)); 94 | ioctl (insocket, FIONBIO, &trueval); 95 | 96 | sendsocket = UDPsocket (); 97 | */ 98 | } 99 | 100 | void I_NetCmd (void) 101 | { 102 | printf("I_NetCmd\n"); 103 | } 104 | 105 | -------------------------------------------------------------------------------- /uefidoom/efi/i_system.c: -------------------------------------------------------------------------------- 1 | 2 | #include 3 | #include 4 | #include 5 | 6 | #include 7 | #include 8 | #include 9 | 10 | #include "doomdef.h" 11 | #include "m_misc.h" 12 | #include "i_video.h" 13 | #include "i_sound.h" 14 | 15 | #include "d_net.h" 16 | #include "g_game.h" 17 | 18 | #ifdef __GNUG__ 19 | #pragma implementation "i_system.h" 20 | #endif 21 | #include "i_system.h" 22 | #include 23 | #include 24 | #include 25 | #include 26 | #include 27 | 28 | int mb_used = 20; 29 | 30 | 31 | void 32 | I_Tactile 33 | ( int on, 34 | int off, 35 | int total ) 36 | { 37 | // UNUSED. 38 | on = off = total = 0; 39 | } 40 | 41 | ticcmd_t emptycmd; 42 | ticcmd_t* I_BaseTiccmd(void) 43 | { 44 | return &emptycmd; 45 | } 46 | 47 | 48 | int I_GetHeapSize (void) 49 | { 50 | return mb_used*1024*1024; 51 | } 52 | 53 | byte* I_ZoneBase (int* size) 54 | { 55 | *size = mb_used*1024*1024; 56 | return (byte *) malloc (*size); 57 | } 58 | 59 | // 60 | // I_GetTime 61 | // returns time in 1/70th second tics 62 | // 63 | // [Cacodemon345] Rely upon the EFI Runtime Services GetTime function. 64 | 65 | int I_GetTime (void) 66 | { 67 | struct timeval tp; 68 | //struct timezone tzp; 69 | int newtics; 70 | static int basetime=0; 71 | EFI_TIME *time = malloc(sizeof(EFI_TIME)); 72 | memset(time,0,sizeof(EFI_TIME)); 73 | EFI_TIME_CAPABILITIES *timecaps = malloc(sizeof(EFI_TIME_CAPABILITIES)); 74 | memset(timecaps,0,sizeof(EFI_TIME_CAPABILITIES)); 75 | EFI_STATUS status; 76 | if (gST) status = gST->RuntimeServices->GetTime(time,timecaps); 77 | if (!EFI_ERROR (status)) 78 | { 79 | tp.tv_sec = time->Second; 80 | tp.tv_usec = time->Nanosecond / 1000; 81 | } 82 | else 83 | { 84 | gettimeofday(&tp, NULL); 85 | } 86 | if (!basetime) 87 | basetime = tp.tv_sec; 88 | newtics = (tp.tv_sec-basetime)*TICRATE + tp.tv_usec*TICRATE/1000000; 89 | free(time); 90 | free(timecaps); 91 | return newtics; 92 | } 93 | int nano100ticks = 0; 94 | void EFIAPI I_TickTime(IN EFI_EVENT Event, IN VOID *Context) 95 | { 96 | nano100ticks++; 97 | AsciiPrint("Ticks passed: %d",nano100ticks); 98 | } 99 | EFI_EVENT timerEvent = 0; 100 | // 101 | // I_Init 102 | // 103 | void I_Init (void) 104 | { 105 | gBS->SetWatchdogTimer(0,0,0,NULL); 106 | I_InitSound(); 107 | gBS->CreateEvent(EVT_TIMER | EVT_NOTIFY_SIGNAL | EVT_NOTIFY_WAIT,TPL_CALLBACK,(EFI_EVENT_NOTIFY)&I_TickTime,NULL,&timerEvent); 108 | gBS->SetTimer(&timerEvent,TimerPeriodic,1); 109 | // I_InitGraphics(); 110 | } 111 | #include "w_wad.h" 112 | // 113 | // I_Quit 114 | // 115 | void I_Quit (void) 116 | { 117 | D_QuitNetGame (); 118 | I_ShutdownSound(); 119 | I_ShutdownMusic(); 120 | M_SaveDefaults (); 121 | I_ShutdownGraphics(); 122 | 123 | int lump = W_CheckNumForName("ENDOOM"); 124 | if (lump != -1) 125 | { 126 | char* allocChar = malloc(W_LumpLength(lump)); 127 | W_ReadLump(lump, allocChar); 128 | for (int vgaline = 0; vgaline < 80; vgaline++) 129 | { 130 | for (int vgacol = 0; vgacol < 50; vgacol += 2) 131 | { 132 | unsigned char ascChar = allocChar[vgaline * 50 + vgacol]; 133 | unsigned char attrChar = allocChar[vgaline * 50 + (vgacol + 1)]; 134 | if (ascChar == (unsigned char)196) 135 | { 136 | ascChar = '-'; 137 | } 138 | gST->ConOut->SetAttribute(gST->ConOut,attrChar & 0x7F); 139 | gST->ConOut->OutputString(gST->ConOut, (wchar_t[]){ascChar,0}); 140 | } 141 | } 142 | } 143 | 144 | exit(0); 145 | } 146 | 147 | void I_WaitVBL(int count) 148 | { 149 | #ifdef SGI 150 | sginap(1); 151 | #else 152 | #ifdef SUN 153 | sleep(0); 154 | #else 155 | usleep (count * (1000000/70) ); 156 | #endif 157 | #endif 158 | } 159 | 160 | void I_BeginRead(void) 161 | { 162 | } 163 | 164 | void I_EndRead(void) 165 | { 166 | } 167 | 168 | byte* I_AllocLow(int length) 169 | { 170 | byte* mem; 171 | 172 | mem = (byte *)malloc (length); 173 | memset (mem,0,length); 174 | return mem; 175 | } 176 | 177 | 178 | // 179 | // I_Error 180 | // 181 | extern boolean demorecording; 182 | 183 | void I_Error (char *error, ...) 184 | { 185 | // [Cacodemon345] First, shut everything down. Specially, we need to exit back to text mode. 186 | // Shutdown. Here might be other errors. 187 | if (demorecording) 188 | G_CheckDemoStatus(); 189 | 190 | D_QuitNetGame (); 191 | I_ShutdownGraphics(); 192 | I_ShutdownSound(); 193 | 194 | // Message first. 195 | va_list argptr; 196 | va_start (argptr,error); 197 | printf ("Error: "); 198 | vprintf (error,argptr); 199 | printf ("\n"); 200 | va_end (argptr); 201 | 202 | exit(-1); 203 | } 204 | 205 | /// 206 | 207 | extern 208 | INTN 209 | ShellAppMain ( 210 | IN UINTN Argc, 211 | IN CHAR16 **Argv 212 | ); 213 | 214 | #include 215 | #include 216 | #include 217 | #include 218 | #include 219 | 220 | EFI_STATUS EFIAPI UefiMain(EFI_HANDLE handle, EFI_SYSTEM_TABLE* st) 221 | { 222 | const char* msg = "DOOM: testing serial port\n"; 223 | SerialPortInitialize(); 224 | SerialPortWrite(msg, strlen(msg)); 225 | const CHAR16* argv[] = {L"doom.exe", NULL}; 226 | return ShellAppMain(1, argv); 227 | } 228 | 229 | 230 | -------------------------------------------------------------------------------- /uefidoom/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 | -------------------------------------------------------------------------------- /uefidoom/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 | -------------------------------------------------------------------------------- /uefidoom/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 | -------------------------------------------------------------------------------- /uefidoom/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 | -------------------------------------------------------------------------------- /uefidoom/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 | -------------------------------------------------------------------------------- /uefidoom/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 | #include 34 | #include 35 | #include 36 | char* UCS2toANSI(wchar_t* wstr) 37 | { 38 | char* newchar = calloc(wcslen(wstr) + 1,1); 39 | int i = 0; 40 | for (i = 0; i < wcslen(wstr); i++) 41 | { 42 | newchar[i] = wstr[i]; 43 | } 44 | newchar[i] = 0; 45 | return newchar; 46 | } 47 | int 48 | main 49 | ( int argc, 50 | char** argv ) 51 | { 52 | myargc = argc; 53 | myargv = argv; 54 | mywargv = (wchar_t**)argv; 55 | /*for (int i = 0; i < argc; i++) 56 | { 57 | myargv[i] = UCS2toANSI(mywargv[i]); 58 | }*/ 59 | D_DoomMain (); 60 | 61 | return 0; 62 | } 63 | -------------------------------------------------------------------------------- /uefidoom/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 | -------------------------------------------------------------------------------- /uefidoom/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 | -------------------------------------------------------------------------------- /uefidoom/i_system.c: -------------------------------------------------------------------------------- 1 | // Emacs style mode select -*- C++ -*- 2 | //----------------------------------------------------------------------------- 3 | // 4 | // $Id:$ 5 | // 6 | // Copyright (C) 1993-1996 by id Software, Inc. 7 | // 8 | // This source is available for distribution and/or modification 9 | // only under the terms of the DOOM Source Code License as 10 | // published by id Software. All rights reserved. 11 | // 12 | // The source is distributed in the hope that it will be useful, 13 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | // FITNESS FOR A PARTICULAR PURPOSE. See the DOOM Source Code License 15 | // for more details. 16 | // 17 | // $Log:$ 18 | // 19 | // DESCRIPTION: 20 | // 21 | //----------------------------------------------------------------------------- 22 | 23 | static const char 24 | rcsid[] = "$Id: m_bbox.c,v 1.1 1997/02/03 22:45:10 b1 Exp $"; 25 | 26 | 27 | #include 28 | #include 29 | #include 30 | 31 | #include 32 | #include 33 | #include 34 | 35 | #include "doomdef.h" 36 | #include "m_misc.h" 37 | #include "i_video.h" 38 | #include "i_sound.h" 39 | 40 | #include "d_net.h" 41 | #include "g_game.h" 42 | 43 | #ifdef __GNUG__ 44 | #pragma implementation "i_system.h" 45 | #endif 46 | #include "i_system.h" 47 | 48 | 49 | 50 | 51 | int mb_used = 6; 52 | 53 | 54 | void 55 | I_Tactile 56 | ( int on, 57 | int off, 58 | int total ) 59 | { 60 | // UNUSED. 61 | on = off = total = 0; 62 | } 63 | 64 | ticcmd_t emptycmd; 65 | ticcmd_t* I_BaseTiccmd(void) 66 | { 67 | return &emptycmd; 68 | } 69 | 70 | 71 | int I_GetHeapSize (void) 72 | { 73 | return mb_used*1024*1024; 74 | } 75 | 76 | byte* I_ZoneBase (int* size) 77 | { 78 | *size = mb_used*1024*1024; 79 | return (byte *) malloc (*size); 80 | } 81 | 82 | 83 | 84 | // 85 | // I_GetTime 86 | // returns time in 1/70th second tics 87 | // 88 | int I_GetTime (void) 89 | { 90 | struct timeval tp; 91 | struct timezone tzp; 92 | int newtics; 93 | static int basetime=0; 94 | 95 | gettimeofday(&tp, &tzp); 96 | if (!basetime) 97 | basetime = tp.tv_sec; 98 | newtics = (tp.tv_sec-basetime)*TICRATE + tp.tv_usec*TICRATE/1000000; 99 | return newtics; 100 | } 101 | 102 | 103 | 104 | // 105 | // I_Init 106 | // 107 | void I_Init (void) 108 | { 109 | I_InitSound(); 110 | // I_InitGraphics(); 111 | } 112 | 113 | // 114 | // I_Quit 115 | // 116 | void I_Quit (void) 117 | { 118 | D_QuitNetGame (); 119 | I_ShutdownSound(); 120 | I_ShutdownMusic(); 121 | M_SaveDefaults (); 122 | I_ShutdownGraphics(); 123 | exit(0); 124 | } 125 | 126 | void I_WaitVBL(int count) 127 | { 128 | #ifdef SGI 129 | sginap(1); 130 | #else 131 | #ifdef SUN 132 | sleep(0); 133 | #else 134 | usleep (count * (1000000/70) ); 135 | #endif 136 | #endif 137 | } 138 | 139 | void I_BeginRead(void) 140 | { 141 | } 142 | 143 | void I_EndRead(void) 144 | { 145 | } 146 | 147 | byte* I_AllocLow(int length) 148 | { 149 | byte* mem; 150 | 151 | mem = (byte *)malloc (length); 152 | memset (mem,0,length); 153 | return mem; 154 | } 155 | 156 | 157 | // 158 | // I_Error 159 | // 160 | extern boolean demorecording; 161 | 162 | void I_Error (char *error, ...) 163 | { 164 | va_list argptr; 165 | 166 | // Message first. 167 | va_start (argptr,error); 168 | fprintf (stderr, "Error: "); 169 | vfprintf (stderr,error,argptr); 170 | fprintf (stderr, "\n"); 171 | va_end (argptr); 172 | 173 | fflush( stderr ); 174 | 175 | // Shutdown. Here might be other errors. 176 | if (demorecording) 177 | G_CheckDemoStatus(); 178 | 179 | D_QuitNetGame (); 180 | I_ShutdownGraphics(); 181 | 182 | exit(-1); 183 | } 184 | -------------------------------------------------------------------------------- /uefidoom/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 | -------------------------------------------------------------------------------- /uefidoom/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 | -------------------------------------------------------------------------------- /uefidoom/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 | #include 29 | #include 30 | #include 31 | 32 | int myargc; 33 | char** myargv; 34 | wchar_t** mywargv; 35 | 36 | mbstate_t convstate; 37 | 38 | // Taken from ReactOS. 39 | int wcscasecmp(const wchar_t* cs,const wchar_t * ct) 40 | { 41 | while (towlower(*cs) == towlower(*ct)) 42 | { 43 | if (*cs == 0) 44 | return 0; 45 | cs++; 46 | ct++; 47 | } 48 | return towlower(*cs) - towlower(*ct); 49 | } 50 | 51 | // 52 | // M_CheckParm 53 | // Checks for the given parameter 54 | // in the program's command line arguments. 55 | // Returns the argument number (1 to argc-1) 56 | // or 0 if not present 57 | int M_CheckParm (char *check) 58 | { 59 | int i = 1; 60 | for (i = 1;ibox[BOXRIGHT]) 54 | box[BOXRIGHT] = x; 55 | if (ybox[BOXTOP]) 58 | box[BOXTOP] = y; 59 | } 60 | 61 | 62 | 63 | 64 | 65 | -------------------------------------------------------------------------------- /uefidoom/m_bbox.h: -------------------------------------------------------------------------------- 1 | // Emacs style mode select -*- C++ -*- 2 | //----------------------------------------------------------------------------- 3 | // 4 | // $Id:$ 5 | // 6 | // Copyright (C) 1993-1996 by id Software, Inc. 7 | // 8 | // This source is available for distribution and/or modification 9 | // only under the terms of the DOOM Source Code License as 10 | // published by id Software. All rights reserved. 11 | // 12 | // The source is distributed in the hope that it will be useful, 13 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | // FITNESS FOR A PARTICULAR PURPOSE. See the DOOM Source Code License 15 | // for more details. 16 | // 17 | // DESCRIPTION: 18 | // Nil. 19 | // 20 | //----------------------------------------------------------------------------- 21 | 22 | 23 | #ifndef __M_BBOX__ 24 | #define __M_BBOX__ 25 | 26 | //#include 27 | #include "doomtype.h" 28 | 29 | #include "m_fixed.h" 30 | 31 | 32 | // Bounding box coordinate storage. 33 | enum 34 | { 35 | BOXTOP, 36 | BOXBOTTOM, 37 | BOXLEFT, 38 | BOXRIGHT 39 | }; // bbox coordinates 40 | 41 | // Bounding box functions. 42 | void M_ClearBox (fixed_t* box); 43 | 44 | void 45 | M_AddToBox 46 | ( fixed_t* box, 47 | fixed_t x, 48 | fixed_t y ); 49 | 50 | 51 | #endif 52 | //----------------------------------------------------------------------------- 53 | // 54 | // $Log:$ 55 | // 56 | //----------------------------------------------------------------------------- 57 | -------------------------------------------------------------------------------- /uefidoom/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 | -------------------------------------------------------------------------------- /uefidoom/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 | -------------------------------------------------------------------------------- /uefidoom/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 | -------------------------------------------------------------------------------- /uefidoom/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 | -------------------------------------------------------------------------------- /uefidoom/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 | -------------------------------------------------------------------------------- /uefidoom/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 | -------------------------------------------------------------------------------- /uefidoom/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 | -------------------------------------------------------------------------------- /uefidoom/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 | -------------------------------------------------------------------------------- /uefidoom/p_setup.h: -------------------------------------------------------------------------------- 1 | // Emacs style mode select -*- C++ -*- 2 | //----------------------------------------------------------------------------- 3 | // 4 | // $Id:$ 5 | // 6 | // Copyright (C) 1993-1996 by id Software, Inc. 7 | // 8 | // This source is available for distribution and/or modification 9 | // only under the terms of the DOOM Source Code License as 10 | // published by id Software. All rights reserved. 11 | // 12 | // The source is distributed in the hope that it will be useful, 13 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | // FITNESS FOR A PARTICULAR PURPOSE. See the DOOM Source Code License 15 | // for more details. 16 | // 17 | // DESCRIPTION: 18 | // Setup a game, startup stuff. 19 | // 20 | //----------------------------------------------------------------------------- 21 | 22 | 23 | #ifndef __P_SETUP__ 24 | #define __P_SETUP__ 25 | 26 | 27 | #ifdef __GNUG__ 28 | #pragma interface 29 | #endif 30 | 31 | 32 | // NOT called by W_Ticker. Fixme. 33 | void 34 | P_SetupLevel 35 | ( int episode, 36 | int map, 37 | int playermask, 38 | skill_t skill); 39 | 40 | // Called by startup code. 41 | void P_Init (void); 42 | 43 | #endif 44 | //----------------------------------------------------------------------------- 45 | // 46 | // $Log:$ 47 | // 48 | //----------------------------------------------------------------------------- 49 | -------------------------------------------------------------------------------- /uefidoom/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 | -------------------------------------------------------------------------------- /uefidoom/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 | -------------------------------------------------------------------------------- /uefidoom/sound/COPYING.txt: -------------------------------------------------------------------------------- 1 | Copyright (c) 2012-2016, Erik de Castro Lopo 2 | All rights reserved. 3 | 4 | Redistribution and use in source and binary forms, with or without 5 | modification, are permitted provided that the following conditions are 6 | met: 7 | 8 | 1. Redistributions of source code must retain the above copyright 9 | notice, this list of conditions and the following disclaimer. 10 | 11 | 2. Redistributions in binary form must reproduce the above copyright 12 | notice, this list of conditions and the following disclaimer in the 13 | documentation and/or other materials provided with the distribution. 14 | 15 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS 16 | IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED 17 | TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A 18 | PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 19 | HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 20 | SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED 21 | TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 22 | PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF 23 | LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 24 | NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 25 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -------------------------------------------------------------------------------- /uefidoom/sound/common.h: -------------------------------------------------------------------------------- 1 | /* 2 | ** Copyright (c) 2002-2016, Erik de Castro Lopo 3 | ** All rights reserved. 4 | ** 5 | ** This code is released under 2-clause BSD license. Please see the 6 | ** file at : https://github.com/erikd/libsamplerate/blob/master/COPYING 7 | */ 8 | 9 | #ifndef COMMON_H_INCLUDED 10 | #define COMMON_H_INCLUDED 11 | 12 | #ifdef HAVE_STDINT_H 13 | #include 14 | #elif (SIZEOF_INT == 4) 15 | typedef int int32_t ; 16 | #elif (SIZEOF_LONG == 4) 17 | typedef long int32_t ; 18 | #endif 19 | 20 | #include "float_cast.h" 21 | 22 | #define SRC_MAX_RATIO 256 23 | #define SRC_MAX_RATIO_STR "256" 24 | 25 | #define SRC_MIN_RATIO_DIFF (1e-20) 26 | 27 | #define MAX(a,b) (((a) > (b)) ? (a) : (b)) 28 | #define MIN(a,b) (((a) < (b)) ? (a) : (b)) 29 | 30 | #define ARRAY_LEN(x) ((int) (sizeof (x) / sizeof ((x) [0]))) 31 | #define OFFSETOF(type,member) ((int) (&((type*) 0)->member)) 32 | 33 | #define MAKE_MAGIC(a,b,c,d,e,f) ((a) + ((b) << 4) + ((c) << 8) + ((d) << 12) + ((e) << 16) + ((f) << 20)) 34 | 35 | /* 36 | ** Inspiration : http://sourcefrog.net/weblog/software/languages/C/unused.html 37 | */ 38 | #ifdef UNUSED 39 | #elif defined (__GNUC__) 40 | # define UNUSED(x) UNUSED_ ## x __attribute__ ((unused)) 41 | #elif defined (__LCLINT__) 42 | # define UNUSED(x) /*@unused@*/ x 43 | #else 44 | # define UNUSED(x) x 45 | #endif 46 | 47 | #ifdef __GNUC__ 48 | # define WARN_UNUSED __attribute__ ((warn_unused_result)) 49 | #else 50 | # define WARN_UNUSED 51 | #endif 52 | 53 | 54 | #include "samplerate.h" 55 | 56 | enum 57 | { SRC_FALSE = 0, 58 | SRC_TRUE = 1, 59 | 60 | SRC_MODE_PROCESS = 555, 61 | SRC_MODE_CALLBACK = 556 62 | } ; 63 | 64 | enum 65 | { SRC_ERR_NO_ERROR = 0, 66 | 67 | SRC_ERR_MALLOC_FAILED, 68 | SRC_ERR_BAD_STATE, 69 | SRC_ERR_BAD_DATA, 70 | SRC_ERR_BAD_DATA_PTR, 71 | SRC_ERR_NO_PRIVATE, 72 | SRC_ERR_BAD_SRC_RATIO, 73 | SRC_ERR_BAD_PROC_PTR, 74 | SRC_ERR_SHIFT_BITS, 75 | SRC_ERR_FILTER_LEN, 76 | SRC_ERR_BAD_CONVERTER, 77 | SRC_ERR_BAD_CHANNEL_COUNT, 78 | SRC_ERR_SINC_BAD_BUFFER_LEN, 79 | SRC_ERR_SIZE_INCOMPATIBILITY, 80 | SRC_ERR_BAD_PRIV_PTR, 81 | SRC_ERR_BAD_SINC_STATE, 82 | SRC_ERR_DATA_OVERLAP, 83 | SRC_ERR_BAD_CALLBACK, 84 | SRC_ERR_BAD_MODE, 85 | SRC_ERR_NULL_CALLBACK, 86 | SRC_ERR_NO_VARIABLE_RATIO, 87 | SRC_ERR_SINC_PREPARE_DATA_BAD_LEN, 88 | SRC_ERR_BAD_INTERNAL_STATE, 89 | 90 | /* This must be the last error number. */ 91 | SRC_ERR_MAX_ERROR 92 | } ; 93 | 94 | typedef struct SRC_PRIVATE_tag 95 | { double last_ratio, last_position ; 96 | 97 | int error ; 98 | int channels ; 99 | 100 | /* SRC_MODE_PROCESS or SRC_MODE_CALLBACK */ 101 | int mode ; 102 | 103 | /* Pointer to data to converter specific data. */ 104 | void *private_data ; 105 | 106 | /* Varispeed process function. */ 107 | int (*vari_process) (struct SRC_PRIVATE_tag *psrc, SRC_DATA *data) ; 108 | 109 | /* Constant speed process function. */ 110 | int (*const_process) (struct SRC_PRIVATE_tag *psrc, SRC_DATA *data) ; 111 | 112 | /* State reset. */ 113 | void (*reset) (struct SRC_PRIVATE_tag *psrc) ; 114 | 115 | /* Data specific to SRC_MODE_CALLBACK. */ 116 | src_callback_t callback_func ; 117 | void *user_callback_data ; 118 | long saved_frames ; 119 | const float *saved_data ; 120 | } SRC_PRIVATE ; 121 | 122 | /* In src_sinc.c */ 123 | const char* sinc_get_name (int src_enum) ; 124 | const char* sinc_get_description (int src_enum) ; 125 | 126 | int sinc_set_converter (SRC_PRIVATE *psrc, int src_enum) ; 127 | 128 | /* In src_linear.c */ 129 | const char* linear_get_name (int src_enum) ; 130 | const char* linear_get_description (int src_enum) ; 131 | 132 | int linear_set_converter (SRC_PRIVATE *psrc, int src_enum) ; 133 | 134 | /* In src_zoh.c */ 135 | const char* zoh_get_name (int src_enum) ; 136 | const char* zoh_get_description (int src_enum) ; 137 | 138 | int zoh_set_converter (SRC_PRIVATE *psrc, int src_enum) ; 139 | 140 | /*---------------------------------------------------------- 141 | ** Common static inline functions. 142 | */ 143 | 144 | static inline double 145 | fmod_one (double x) 146 | { double res ; 147 | 148 | res = x - lrint (x) ; 149 | if (res < 0.0) 150 | return res + 1.0 ; 151 | 152 | return res ; 153 | } /* fmod_one */ 154 | 155 | static inline int 156 | is_bad_src_ratio (double ratio) 157 | { return (ratio < (1.0 / SRC_MAX_RATIO) || ratio > (1.0 * SRC_MAX_RATIO)) ; 158 | } /* is_bad_src_ratio */ 159 | 160 | 161 | #endif /* COMMON_H_INCLUDED */ 162 | 163 | -------------------------------------------------------------------------------- /uefidoom/sound/samplerate.h: -------------------------------------------------------------------------------- 1 | /* 2 | ** Copyright (c) 2002-2016, Erik de Castro Lopo 3 | ** All rights reserved. 4 | ** 5 | ** This code is released under 2-clause BSD license. Please see the 6 | ** file at : https://github.com/erikd/libsamplerate/blob/master/COPYING 7 | */ 8 | 9 | /* 10 | ** API documentation is available here: 11 | ** http://www.mega-nerd.com/SRC/api.html 12 | */ 13 | 14 | #ifndef SAMPLERATE_H 15 | #define SAMPLERATE_H 16 | 17 | #ifdef __cplusplus 18 | extern "C" { 19 | #endif /* __cplusplus */ 20 | 21 | 22 | /* Opaque data type SRC_STATE. */ 23 | typedef struct SRC_STATE_tag SRC_STATE ; 24 | 25 | /* SRC_DATA is used to pass data to src_simple() and src_process(). */ 26 | typedef struct 27 | { const float *data_in ; 28 | float *data_out ; 29 | 30 | long input_frames, output_frames ; 31 | long input_frames_used, output_frames_gen ; 32 | 33 | int end_of_input ; 34 | 35 | double src_ratio ; 36 | } SRC_DATA ; 37 | 38 | /* 39 | ** User supplied callback function type for use with src_callback_new() 40 | ** and src_callback_read(). First parameter is the same pointer that was 41 | ** passed into src_callback_new(). Second parameter is pointer to a 42 | ** pointer. The user supplied callback function must modify *data to 43 | ** point to the start of the user supplied float array. The user supplied 44 | ** function must return the number of frames that **data points to. 45 | */ 46 | 47 | typedef long (*src_callback_t) (void *cb_data, float **data) ; 48 | 49 | /* 50 | ** Standard initialisation function : return an anonymous pointer to the 51 | ** internal state of the converter. Choose a converter from the enums below. 52 | ** Error returned in *error. 53 | */ 54 | 55 | SRC_STATE* src_new (int converter_type, int channels, int *error) ; 56 | 57 | /* 58 | ** Initilisation for callback based API : return an anonymous pointer to the 59 | ** internal state of the converter. Choose a converter from the enums below. 60 | ** The cb_data pointer can point to any data or be set to NULL. Whatever the 61 | ** value, when processing, user supplied function "func" gets called with 62 | ** cb_data as first parameter. 63 | */ 64 | 65 | SRC_STATE* src_callback_new (src_callback_t func, int converter_type, int channels, 66 | int *error, void* cb_data) ; 67 | 68 | /* 69 | ** Cleanup all internal allocations. 70 | ** Always returns NULL. 71 | */ 72 | 73 | SRC_STATE* src_delete (SRC_STATE *state) ; 74 | 75 | /* 76 | ** Standard processing function. 77 | ** Returns non zero on error. 78 | */ 79 | 80 | int src_process (SRC_STATE *state, SRC_DATA *data) ; 81 | 82 | /* 83 | ** Callback based processing function. Read up to frames worth of data from 84 | ** the converter int *data and return frames read or -1 on error. 85 | */ 86 | long src_callback_read (SRC_STATE *state, double src_ratio, long frames, float *data) ; 87 | 88 | /* 89 | ** Simple interface for performing a single conversion from input buffer to 90 | ** output buffer at a fixed conversion ratio. 91 | ** Simple interface does not require initialisation as it can only operate on 92 | ** a single buffer worth of audio. 93 | */ 94 | 95 | int src_simple (SRC_DATA *data, int converter_type, int channels) ; 96 | 97 | /* 98 | ** This library contains a number of different sample rate converters, 99 | ** numbered 0 through N. 100 | ** 101 | ** Return a string giving either a name or a more full description of each 102 | ** sample rate converter or NULL if no sample rate converter exists for 103 | ** the given value. The converters are sequentially numbered from 0 to N. 104 | */ 105 | 106 | const char *src_get_name (int converter_type) ; 107 | const char *src_get_description (int converter_type) ; 108 | const char *src_get_version (void) ; 109 | 110 | /* 111 | ** Set a new SRC ratio. This allows step responses 112 | ** in the conversion ratio. 113 | ** Returns non zero on error. 114 | */ 115 | 116 | int src_set_ratio (SRC_STATE *state, double new_ratio) ; 117 | 118 | /* 119 | ** Get the current channel count. 120 | ** Returns negative on error, positive channel count otherwise 121 | */ 122 | 123 | int src_get_channels (SRC_STATE *state) ; 124 | 125 | /* 126 | ** Reset the internal SRC state. 127 | ** Does not modify the quality settings. 128 | ** Does not free any memory allocations. 129 | ** Returns non zero on error. 130 | */ 131 | 132 | int src_reset (SRC_STATE *state) ; 133 | 134 | /* 135 | ** Return TRUE if ratio is a valid conversion ratio, FALSE 136 | ** otherwise. 137 | */ 138 | 139 | int src_is_valid_ratio (double ratio) ; 140 | 141 | /* 142 | ** Return an error number. 143 | */ 144 | 145 | int src_error (SRC_STATE *state) ; 146 | 147 | /* 148 | ** Convert the error number into a string. 149 | */ 150 | const char* src_strerror (int error) ; 151 | 152 | /* 153 | ** The following enums can be used to set the interpolator type 154 | ** using the function src_set_converter(). 155 | */ 156 | 157 | enum 158 | { 159 | SRC_SINC_BEST_QUALITY = 0, 160 | SRC_SINC_MEDIUM_QUALITY = 1, 161 | SRC_SINC_FASTEST = 2, 162 | SRC_ZERO_ORDER_HOLD = 3, 163 | SRC_LINEAR = 4, 164 | } ; 165 | 166 | /* 167 | ** Extra helper functions for converting from short to float and 168 | ** back again. 169 | */ 170 | 171 | void src_short_to_float_array (const short *in, float *out, int len) ; 172 | void src_float_to_short_array (const float *in, short *out, int len) ; 173 | 174 | void src_int_to_float_array (const int *in, float *out, int len) ; 175 | void src_float_to_int_array (const float *in, int *out, int len) ; 176 | 177 | 178 | #ifdef __cplusplus 179 | } /* extern "C" */ 180 | #endif /* __cplusplus */ 181 | 182 | #endif /* SAMPLERATE_H */ 183 | 184 | -------------------------------------------------------------------------------- /uefidoom/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 | -------------------------------------------------------------------------------- /uefidoom/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 | -------------------------------------------------------------------------------- /uefidoom/tables.h: -------------------------------------------------------------------------------- 1 | // Emacs style mode select -*- C++ -*- 2 | //----------------------------------------------------------------------------- 3 | // 4 | // $Id:$ 5 | // 6 | // Copyright (C) 1993-1996 by id Software, Inc. 7 | // 8 | // This source is available for distribution and/or modification 9 | // only under the terms of the DOOM Source Code License as 10 | // published by id Software. All rights reserved. 11 | // 12 | // The source is distributed in the hope that it will be useful, 13 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | // FITNESS FOR A PARTICULAR PURPOSE. See the DOOM Source Code License 15 | // for more details. 16 | // 17 | // DESCRIPTION: 18 | // Lookup tables. 19 | // Do not try to look them up :-). 20 | // In the order of appearance: 21 | // 22 | // int finetangent[4096] - Tangens LUT. 23 | // Should work with BAM fairly well (12 of 16bit, 24 | // effectively, by shifting). 25 | // 26 | // int finesine[10240] - Sine lookup. 27 | // Guess what, serves as cosine, too. 28 | // Remarkable thing is, how to use BAMs with this? 29 | // 30 | // int tantoangle[2049] - ArcTan LUT, 31 | // maps tan(angle) to angle fast. Gotta search. 32 | // 33 | //----------------------------------------------------------------------------- 34 | 35 | 36 | #ifndef __TABLES__ 37 | #define __TABLES__ 38 | 39 | 40 | 41 | #ifdef LINUX 42 | #include 43 | #else 44 | #define PI 3.141592657 45 | #endif 46 | 47 | 48 | #include "m_fixed.h" 49 | 50 | #define FINEANGLES 8192 51 | #define FINEMASK (FINEANGLES-1) 52 | 53 | 54 | // 0x100000000 to 0x2000 55 | #define ANGLETOFINESHIFT 19 56 | 57 | // Effective size is 10240. 58 | extern fixed_t finesine[5*FINEANGLES/4]; 59 | 60 | // Re-use data, is just PI/2 pahse shift. 61 | extern fixed_t* finecosine; 62 | 63 | 64 | // Effective size is 4096. 65 | extern fixed_t finetangent[FINEANGLES/2]; 66 | 67 | // Binary Angle Measument, BAM. 68 | #define ANG45 0x20000000 69 | #define ANG90 0x40000000 70 | #define ANG180 0x80000000 71 | #define ANG270 0xc0000000 72 | 73 | 74 | #define SLOPERANGE 2048 75 | #define SLOPEBITS 11 76 | #define DBITS (FRACBITS-SLOPEBITS) 77 | 78 | typedef unsigned angle_t; 79 | 80 | 81 | // Effective size is 2049; 82 | // The +1 size is to handle the case when x==y 83 | // without additional checking. 84 | extern angle_t tantoangle[SLOPERANGE+1]; 85 | 86 | 87 | // Utility function, 88 | // called by R_PointToAngle. 89 | int 90 | SlopeDiv 91 | ( unsigned num, 92 | unsigned den); 93 | 94 | 95 | #endif 96 | //----------------------------------------------------------------------------- 97 | // 98 | // $Log:$ 99 | // 100 | //----------------------------------------------------------------------------- 101 | -------------------------------------------------------------------------------- /uefidoom/tools/Makefile: -------------------------------------------------------------------------------- 1 | 2 | CC = gcc 3 | CFLAGS = -I. -Wall -std=c99 4 | 5 | WAD_TOOL = wad 6 | WAD_TOOL_OBJS = wad.o wadtool.o 7 | 8 | TEXDUMP_TOOL = texdump 9 | TEXDUMP_OBJS = wad.o texdump.o 10 | 11 | all: Makefile $(WAD_TOOL) $(TEXDUMP_TOOL) 12 | 13 | $(WAD_TOOL): Makefile $(WAD_TOOL_OBJS) 14 | $(CC) $(CFLAGS) $(LDFLAGS) $(WAD_TOOL_OBJS) -o $(WAD_TOOL) 15 | 16 | 17 | $(TEXDUMP_TOOL): Makefile $(TEXDUMP_OBJS) 18 | $(CC) $(CFLAGS) $(LDFLAGS) $(TEXDUMP_OBJS) -o $(TEXDUMP_TOOL) 19 | 20 | clean: 21 | rm -f *.o *~ 22 | rm -f $(WAD_TOOL) 23 | rm -f $(TEXDUMP_TOOL) 24 | 25 | %.o: %.c 26 | $(CC) $(CFLAGS) -c $< -o $@ 27 | 28 | 29 | 30 | -------------------------------------------------------------------------------- /uefidoom/tools/wad.h: -------------------------------------------------------------------------------- 1 | /* 2 | * ===================================================================================== 3 | * 4 | * Filename: wad.h 5 | * 6 | * Description: 7 | * 8 | * Version: 1.0 9 | * Created: 10/06/2013 18:34:05 10 | * Revision: none 11 | * Compiler: gcc 12 | * 13 | * Author: YOUR NAME (), 14 | * Company: 15 | * 16 | * ===================================================================================== 17 | */ 18 | 19 | #ifndef EFI_DOOM_TOOLS_WAD_H 20 | #define EFI_DOOM_TOOLS_WAD_H 21 | 22 | #include 23 | 24 | //////////////////////////////////////////////////////////////////////////// 25 | 26 | // File structures 27 | 28 | #define WAD_ID_SIZE 4 29 | #define WAD_LUMP_NAME_SIZE 8 30 | 31 | typedef struct 32 | { 33 | char id[WAD_ID_SIZE]; 34 | uint32_t numlumps; 35 | uint32_t offset; 36 | } wad_info; 37 | 38 | typedef struct 39 | { 40 | uint32_t fileoff; 41 | uint32_t size; 42 | char name[WAD_LUMP_NAME_SIZE]; 43 | } lump_info; 44 | 45 | // Runtime structures 46 | 47 | typedef struct 48 | { 49 | int fd; // File descriptor 50 | uint32_t numlumps; // Total lumps in this WAD file 51 | uint32_t offset; 52 | lump_info* lumpTable; // Cached table of lump info structured 53 | } wad_file; 54 | 55 | typedef struct 56 | { 57 | char name[WAD_LUMP_NAME_SIZE + 1]; // Name, +1 for extra 0 byte 58 | int num; // Lump number in WAD file 59 | void* data; // Data 60 | uint32_t size; // Data size 61 | } lump_t; 62 | 63 | //////////////////////////////////////////////////////////////////////////// 64 | 65 | #ifdef __cplusplus 66 | extern "C" { 67 | #endif 68 | 69 | // Load and parse WAD file. 70 | int LoadWadFile(const char* path, wad_file* outFile); 71 | 72 | // Check that there is a lump with this name in wad file and get its info initialized on success 73 | int CheckLumpName(const wad_file* wad, const char* lumpName, lump_info* outLump); 74 | int CheckLumpNum(const wad_file* wad, int num, lump_info* outLump); 75 | 76 | // Return a lump number with a given name. 77 | // Returns either a positive lump number or a negative error code 78 | int GetLumpNumberByName(const wad_file* wad, const char* name); 79 | 80 | // Load lump data by its name, caller has to free returned buffer 81 | int LoadLump(const wad_file* wad, const lump_info* lump, lump_t* outLump); 82 | int LoadLumpName(const wad_file* wad, const char* lumpName, lump_t* outLump); 83 | int LoadLumpNum(const wad_file* wad, int lumpNum, lump_t* outLump); 84 | 85 | void FreeLump(lump_t* lump); 86 | 87 | // Close wad file handle 88 | void CloseWadFile(wad_file* wad); 89 | 90 | #ifdef __cplusplus 91 | } 92 | #endif 93 | 94 | //////////////////////////////////////////////////////////////////////////// 95 | 96 | #endif // EFI_DOOM_TOOLS_WAD_H 97 | 98 | -------------------------------------------------------------------------------- /uefidoom/tools/wadtool.c: -------------------------------------------------------------------------------- 1 | /* 2 | * ===================================================================================== 3 | * 4 | * Filename: wadtool.c 5 | * 6 | * Description: 7 | * 8 | * Version: 1.0 9 | * Created: 10/06/2013 18:57:46 10 | * Revision: none 11 | * Compiler: gcc 12 | * 13 | * Author: YOUR NAME (), 14 | * Company: 15 | * 16 | * ===================================================================================== 17 | */ 18 | 19 | #include "wad.h" 20 | 21 | #include 22 | #include 23 | #include 24 | #include 25 | #include 26 | #include 27 | #include 28 | #include 29 | 30 | //////////////////////////////////////////////////////////////////////////// 31 | 32 | static void usage(void) 33 | { 34 | printf("wad info \n"); 35 | printf("wad dump \n"); 36 | printf("wad unpack \n"); 37 | } 38 | 39 | // wad info 40 | static int DoInfo(int argc, char** argv) 41 | { 42 | assert (0 == strcmp(argv[0], "info")); 43 | 44 | if (argc != 2) 45 | { 46 | usage(); 47 | return EXIT_FAILURE; 48 | } 49 | 50 | const char* wadPath = argv[1]; 51 | 52 | wad_file wad; 53 | int error = LoadWadFile(wadPath, &wad); 54 | if (error) 55 | { 56 | printf("Failed opening wad file %s: %s\n", wadPath, strerror(error)); 57 | return error; 58 | } 59 | 60 | printf("\nWAD file %s:\n", wadPath); 61 | printf("> total lumps = %d\n", wad.numlumps); 62 | printf("> lump table offset = %d\n", wad.offset); 63 | 64 | printf("\nLumps info:\n"); 65 | 66 | for (unsigned i = 0; i < wad.numlumps; ++i) 67 | { 68 | lump_info lump; 69 | error = CheckLumpNum(&wad, i, &lump); 70 | if (error) 71 | { 72 | printf("Failed reading lump %d: %s\n", i, strerror(error)); 73 | return error; 74 | } 75 | 76 | char namebuf[sizeof(lump.name) + 1] = {0}; 77 | memcpy(namebuf, lump.name, sizeof(lump.name)); 78 | 79 | printf("> %8s: offset %d, size %d\n", namebuf, lump.fileoff, lump.size); 80 | } 81 | 82 | CloseWadFile(&wad); 83 | return EXIT_SUCCESS; 84 | } 85 | 86 | // wad dump 87 | static int DoDump(int argc, char** argv) 88 | { 89 | assert (0 == strcmp(argv[0], "dump")); 90 | 91 | if (argc != 3) 92 | { 93 | usage(); 94 | return EXIT_FAILURE; 95 | } 96 | 97 | const char* lumpName = argv[2]; 98 | const char* wadPath = argv[1]; 99 | 100 | wad_file wad; 101 | int error = LoadWadFile(wadPath, &wad); 102 | if (error) 103 | { 104 | printf("Failed opening wad file %s: %s\n", wadPath, strerror(error)); 105 | return error; 106 | } 107 | 108 | lump_t lump; 109 | error = LoadLumpName(&wad, lumpName, &lump); 110 | if (error) 111 | { 112 | printf("Could not find lump name %s\n", lumpName); 113 | return error; 114 | } 115 | 116 | for (size_t j = 0; j < lump.size; ++j) 117 | { 118 | if (0 == (j % 32)) 119 | { 120 | printf("\n"); 121 | } 122 | 123 | printf("%02x ", ((uint8_t*)lump.data)[j]); 124 | } 125 | 126 | printf("\n"); 127 | 128 | FreeLump(&lump); 129 | CloseWadFile(&wad); 130 | 131 | return 0; 132 | } 133 | 134 | static int DoUnpack(int argc, char** argv) 135 | { 136 | assert (0 == strcmp(argv[0], "unpack")); 137 | 138 | if (argc != 3) 139 | { 140 | usage(); 141 | return EXIT_FAILURE; 142 | } 143 | 144 | const char* wadPath = argv[1]; 145 | const char* dirPath = argv[2]; 146 | 147 | wad_file wad; 148 | int error = LoadWadFile(wadPath, &wad); 149 | if (error) 150 | { 151 | printf("Failed opening wad file %s: %s\n", wadPath, strerror(error)); 152 | return error; 153 | } 154 | 155 | // Dump all lumps into files in a folder 156 | for (unsigned i = 0; i < wad.numlumps; ++i) 157 | { 158 | lump_t lump; 159 | error = LoadLumpNum(&wad, i, &lump); 160 | if (error) 161 | { 162 | printf("Could not load lump %d\n", i); 163 | return error; 164 | } 165 | 166 | char pathbuf[1024] = {0}; 167 | snprintf(pathbuf, sizeof(pathbuf) - 1, "%s/%s", dirPath, lump.name); 168 | 169 | // some lumps have the same name, so append 170 | int lump_fd = open(pathbuf, O_RDWR | O_CREAT | O_APPEND, S_IRWXU); 171 | if (lump_fd < 0) 172 | { 173 | printf("Failed to create lump dump file %s: %s\n", pathbuf, strerror(errno)); 174 | return errno; 175 | } 176 | 177 | if (lump.size != write(lump_fd, lump.data, lump.size)) 178 | { 179 | printf("Failed writing lump data: %s\n", strerror(errno)); 180 | return errno; 181 | } 182 | 183 | close(lump_fd); 184 | FreeLump(&lump); 185 | } 186 | 187 | CloseWadFile(&wad); 188 | return 0; 189 | } 190 | 191 | 192 | int main(int argc, char** argv) 193 | { 194 | if (argc < 2) 195 | { 196 | printf("wad: not enough arguments\n"); 197 | usage(); 198 | return EXIT_FAILURE; 199 | } 200 | 201 | const char* command = argv[1]; 202 | ++argv; 203 | --argc; 204 | 205 | if (0 == strcmp(command, "info")) 206 | { 207 | return DoInfo(argc, argv); 208 | } 209 | else if (0 == strcmp(command, "dump")) 210 | { 211 | return DoDump(argc, argv); 212 | } 213 | else if (0 == strcmp(command, "unpack")) 214 | { 215 | return DoUnpack(argc, argv); 216 | } 217 | else 218 | { 219 | usage(); 220 | return EXIT_FAILURE; 221 | } 222 | } 223 | 224 | -------------------------------------------------------------------------------- /uefidoom/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 | -------------------------------------------------------------------------------- /uefidoom/w_wad.h: -------------------------------------------------------------------------------- 1 | // Emacs style mode select -*- C++ -*- 2 | //----------------------------------------------------------------------------- 3 | // 4 | // $Id:$ 5 | // 6 | // Copyright (C) 1993-1996 by id Software, Inc. 7 | // 8 | // This source is available for distribution and/or modification 9 | // only under the terms of the DOOM Source Code License as 10 | // published by id Software. All rights reserved. 11 | // 12 | // The source is distributed in the hope that it will be useful, 13 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | // FITNESS FOR A PARTICULAR PURPOSE. See the DOOM Source Code License 15 | // for more details. 16 | // 17 | // DESCRIPTION: 18 | // WAD I/O functions. 19 | // 20 | //----------------------------------------------------------------------------- 21 | 22 | 23 | #ifndef __W_WAD__ 24 | #define __W_WAD__ 25 | 26 | 27 | #ifdef __GNUG__ 28 | #pragma interface 29 | #endif 30 | 31 | 32 | // 33 | // TYPES 34 | // 35 | typedef struct 36 | { 37 | // Should be "IWAD" or "PWAD". 38 | char identification[4]; 39 | int numlumps; 40 | int infotableofs; 41 | 42 | } wadinfo_t; 43 | 44 | 45 | typedef struct 46 | { 47 | int filepos; 48 | int size; 49 | char name[8]; 50 | 51 | } filelump_t; 52 | 53 | // 54 | // WADFILE I/O related stuff. 55 | // 56 | typedef struct 57 | { 58 | char name[8]; 59 | int handle; 60 | int position; 61 | int size; 62 | } lumpinfo_t; 63 | 64 | 65 | extern void** lumpcache; 66 | extern lumpinfo_t* lumpinfo; 67 | extern int numlumps; 68 | 69 | void W_InitMultipleFiles (char** filenames); 70 | void W_Reload (void); 71 | 72 | int W_CheckNumForName (char* name); 73 | int W_GetNumForName (char* name); 74 | 75 | int W_LumpLength (int lump); 76 | void W_ReadLump (int lump, void *dest); 77 | 78 | void* W_CacheLumpNum (int lump, int tag); 79 | void* W_CacheLumpName (char* name, int tag); 80 | 81 | 82 | 83 | 84 | #endif 85 | //----------------------------------------------------------------------------- 86 | // 87 | // $Log:$ 88 | // 89 | //----------------------------------------------------------------------------- 90 | -------------------------------------------------------------------------------- /uefidoom/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 | -------------------------------------------------------------------------------- /uefidoom/z_zone.h: -------------------------------------------------------------------------------- 1 | // Emacs style mode select -*- C++ -*- 2 | //----------------------------------------------------------------------------- 3 | // 4 | // $Id:$ 5 | // 6 | // Copyright (C) 1993-1996 by id Software, Inc. 7 | // 8 | // This source is available for distribution and/or modification 9 | // only under the terms of the DOOM Source Code License as 10 | // published by id Software. All rights reserved. 11 | // 12 | // The source is distributed in the hope that it will be useful, 13 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | // FITNESS FOR A PARTICULAR PURPOSE. See the DOOM Source Code License 15 | // for more details. 16 | // 17 | // DESCRIPTION: 18 | // Zone Memory Allocation, perhaps NeXT ObjectiveC inspired. 19 | // Remark: this was the only stuff that, according 20 | // to John Carmack, might have been useful for 21 | // Quake. 22 | // 23 | //--------------------------------------------------------------------- 24 | 25 | 26 | 27 | #ifndef __Z_ZONE__ 28 | #define __Z_ZONE__ 29 | 30 | #include 31 | 32 | // 33 | // ZONE MEMORY 34 | // PU - purge tags. 35 | // Tags < 100 are not overwritten until freed. 36 | #define PU_STATIC 1 // static entire execution time 37 | #define PU_SOUND 2 // static while playing 38 | #define PU_MUSIC 3 // static while playing 39 | #define PU_DAVE 4 // anything else Dave wants static 40 | #define PU_LEVEL 50 // static until level exited 41 | #define PU_LEVSPEC 51 // a special thinker in a level 42 | // Tags >= 100 are purgable whenever needed. 43 | #define PU_PURGELEVEL 100 44 | #define PU_CACHE 101 45 | 46 | 47 | void Z_Init (void); 48 | void* _Z_Malloc (int size, int tag, void *ptr); 49 | void _Z_Free (void *ptr); 50 | void Z_FreeTags (int lowtag, int hightag); 51 | void Z_DumpHeap (int lowtag, int hightag); 52 | void Z_FileDumpHeap (FILE *f); 53 | void Z_CheckHeap (void); 54 | void Z_ChangeTag2 (void *ptr, int tag); 55 | int Z_FreeMemory (void); 56 | 57 | 58 | typedef struct memblock_s 59 | { 60 | int size; // including the header and possibly tiny fragments 61 | void** user; // NULL if a free block 62 | int tag; // purgelevel 63 | int id; // should be ZONEID 64 | struct memblock_s* next; 65 | struct memblock_s* prev; 66 | } memblock_t; 67 | 68 | // 69 | // This is used to get the local FILE:LINE info from CPP 70 | // prior to really call the function in question. 71 | // 72 | #define Z_ChangeTag(p,t) \ 73 | { \ 74 | if (( (memblock_t *)( (byte *)(p) - sizeof(memblock_t)))->id!=0x1d4a11) \ 75 | I_Error("Z_CT at "__FILE__":%i",__LINE__); \ 76 | Z_ChangeTag2(p,t); \ 77 | } \ 78 | 79 | //#define Z_DEBUG 80 | 81 | #include 82 | 83 | #ifdef Z_DEBUG 84 | void Z_FreeDebug(void* ptr, const char* file, int line); 85 | void* Z_MallocDebug(int size, int tag, void* ptr, const char* file, int line); 86 | 87 | #define Z_Free(_ptr_) Z_FreeDebug((_ptr_), __FILE__, __LINE__) 88 | #define Z_Malloc(_size_, _tag_, _ptr_) Z_MallocDebug((_size_), (_tag_), (_ptr_), __FILE__, __LINE__) 89 | 90 | #else 91 | 92 | #define Z_Free(_ptr_) _Z_Free((_ptr_)) 93 | #define Z_Malloc(_size_, _tag_, _ptr_) _Z_Malloc((_size_), (_tag_), (_ptr_)) 94 | 95 | #endif 96 | 97 | #endif 98 | //----------------------------------------------------------------------------- 99 | // 100 | // $Log:$ 101 | // 102 | //----------------------------------------------------------------------------- 103 | --------------------------------------------------------------------------------