├── .appveyor.yml ├── .gitignore ├── .gitmodules ├── .travis.yml ├── AUTHORS ├── CMakeLists.txt ├── CMakeSettings.json ├── COPYING ├── CppProperties.json ├── LICENSE ├── Makefile ├── README.md ├── README.orig ├── build └── sce_sys │ ├── bg.png │ ├── icon0.png │ ├── pic0.png │ ├── startup.png │ └── template.xml ├── build_scripts ├── nightly_build.rb └── toolchain-mingw32.cmake ├── cmake ├── FindATK.cmake ├── FindCairo.cmake ├── FindFluidSynth.cmake ├── FindGDK3.cmake ├── FindGDKPixbuf.cmake ├── FindGIO.cmake ├── FindGLib.cmake ├── FindGObject.cmake ├── FindGObjectIntrospection.cmake ├── FindGTK3.cmake ├── FindPango.cmake ├── FindSDL2.cmake ├── FindSDL2_net.cmake ├── FindSoup.cmake ├── FindVala.cmake └── FindValadoc.cmake ├── conanfile.txt ├── distrib ├── doom64ex.6 ├── doom64ex.desktop ├── doom64ex.pk3 │ ├── animdefs.txt │ ├── graphics │ │ ├── buttons.png │ │ ├── confont.png │ │ ├── crshairs.png │ │ ├── cursor.png │ │ └── fancred.png │ ├── mapinfo.txt │ ├── palplay3.act │ └── skydefs.txt ├── doom64ex.png ├── doom64ex_pk3.txt └── linux_start.sh ├── extern ├── CMakeLists.txt └── patched-config_win32.h ├── include └── imp │ ├── App │ ├── Image │ ├── NativeUI │ ├── Pixel │ ├── Prelude │ ├── Property │ ├── Video │ ├── Wad │ └── util │ ├── ArrayView │ ├── Clamped │ ├── Convert │ ├── Endian │ ├── Guard │ ├── MurmurHash3 │ ├── Optional │ ├── PtrIterator │ ├── StringView │ └── Types ├── shot.png ├── src ├── config.hh.in ├── engine │ ├── App.cc │ ├── CMakeLists.txt │ ├── Globals.cc │ ├── automap │ │ ├── am_draw.cc │ │ ├── am_draw.h │ │ ├── am_map.cc │ │ └── am_map.h │ ├── common │ │ ├── Property.cc │ │ ├── _sal.h │ │ ├── defconfig.inc │ │ ├── doomdata.h │ │ ├── doomdef.h │ │ ├── doomstat.h │ │ ├── doomtype.h │ │ ├── info.cc │ │ ├── info.h │ │ ├── md5.cc │ │ ├── md5.h │ │ ├── psnprntf.cc │ │ ├── psnprntf.h │ │ ├── t_bsp.h │ │ ├── tables.cc │ │ └── tables.h │ ├── console │ │ ├── con_console.cc │ │ └── con_console.h │ ├── doom_main │ │ ├── d_devstat.cc │ │ ├── d_devstat.h │ │ ├── d_englsh.h │ │ ├── d_event.h │ │ ├── d_keywds.h │ │ ├── d_main.cc │ │ ├── d_main.h │ │ ├── d_net.cc │ │ ├── d_net.h │ │ ├── d_player.h │ │ ├── d_think.h │ │ └── d_ticcmd.h │ ├── finale │ │ ├── f_finale.cc │ │ ├── f_finale.h │ │ └── in_stuff.cc │ ├── fmt │ │ ├── format.cc │ │ ├── format.h │ │ ├── ostream.cc │ │ └── ostream.h │ ├── game │ │ ├── g_actions.cc │ │ ├── g_actions.h │ │ ├── g_controls.h │ │ ├── g_demo.cc │ │ ├── g_demo.h │ │ ├── g_game.cc │ │ ├── g_game.h │ │ ├── g_local.h │ │ ├── g_settings.cc │ │ └── g_settings.h │ ├── gfx │ │ ├── DoomImage.cc │ │ ├── Image.cc │ │ ├── Image_test.cc │ │ ├── Pixel.cc │ │ ├── Pixel_test.cc │ │ ├── Playpal.hh │ │ ├── PngImage.cc │ │ └── PngImage_test.cc │ ├── intermission │ │ ├── wi_stuff.cc │ │ └── wi_stuff.h │ ├── misc │ │ ├── m_cheat.cc │ │ ├── m_cheat.h │ │ ├── m_fixed.cc │ │ ├── m_fixed.h │ │ ├── m_keys.cc │ │ ├── m_keys.h │ │ ├── m_menu.cc │ │ ├── m_menu.h │ │ ├── m_misc.cc │ │ ├── m_misc.h │ │ ├── m_password.cc │ │ ├── m_password.h │ │ ├── m_random.cc │ │ ├── m_random.h │ │ ├── m_shift.cc │ │ └── m_shift.h │ ├── native_ui │ │ ├── Gtk3.cc │ │ ├── WinAPI-windows-is-dumb.c │ │ └── WinAPI.cc │ ├── net │ │ ├── net_client.cc │ │ ├── net_client.h │ │ ├── net_common.cc │ │ ├── net_common.h │ │ ├── net_dedicated.cc │ │ ├── net_dedicated.h │ │ ├── net_defs.h │ │ ├── net_io.cc │ │ ├── net_io.h │ │ ├── net_loop.cc │ │ ├── net_loop.h │ │ ├── net_packet.cc │ │ ├── net_packet.h │ │ ├── net_query.cc │ │ ├── net_query.h │ │ ├── net_sdl.cc │ │ ├── net_sdl.h │ │ ├── net_server.cc │ │ ├── net_server.h │ │ ├── net_structrw.cc │ │ └── net_structrw.h │ ├── opengl │ │ ├── dgl.cc │ │ ├── dgl.h │ │ ├── gl_draw.cc │ │ ├── gl_draw.h │ │ ├── gl_main.cc │ │ ├── gl_main.h │ │ ├── gl_texture.cc │ │ ├── gl_texture.h │ │ ├── glad.cc │ │ ├── glad.h │ │ └── khrplatform.h │ ├── parser │ │ ├── sc_main.cc │ │ └── sc_main.h │ ├── playloop │ │ ├── Map.cc │ │ ├── Map.hh │ │ ├── p_ceilng.cc │ │ ├── p_doors.cc │ │ ├── p_enemy.cc │ │ ├── p_floor.cc │ │ ├── p_inter.cc │ │ ├── p_inter.h │ │ ├── p_lights.cc │ │ ├── p_local.h │ │ ├── p_macros.cc │ │ ├── p_macros.h │ │ ├── p_map.cc │ │ ├── p_maputl.cc │ │ ├── p_mobj.cc │ │ ├── p_mobj.h │ │ ├── p_plats.cc │ │ ├── p_pspr.cc │ │ ├── p_pspr.h │ │ ├── p_saveg.cc │ │ ├── p_saveg.h │ │ ├── p_setup.cc │ │ ├── p_setup.h │ │ ├── p_sight.cc │ │ ├── p_spec.cc │ │ ├── p_spec.h │ │ ├── p_switch.cc │ │ ├── p_telept.cc │ │ ├── p_tick.cc │ │ ├── p_tick.h │ │ └── p_user.cc │ ├── renderer │ │ ├── r_bsp.cc │ │ ├── r_clipper.cc │ │ ├── r_clipper.h │ │ ├── r_drawlist.cc │ │ ├── r_drawlist.h │ │ ├── r_lights.cc │ │ ├── r_lights.h │ │ ├── r_local.h │ │ ├── r_main.cc │ │ ├── r_main.h │ │ ├── r_scene.cc │ │ ├── r_sky.cc │ │ ├── r_sky.h │ │ ├── r_things.cc │ │ ├── r_things.h │ │ ├── r_wipe.cc │ │ └── r_wipe.h │ ├── sound │ │ ├── s_sound.cc │ │ ├── s_sound.h │ │ └── sounds.h │ ├── statusbar │ │ ├── st_stuff.cc │ │ └── st_stuff.h │ ├── system │ │ ├── SdlVideo.cc │ │ ├── i_audio.cc │ │ ├── i_audio.h │ │ ├── i_cpu.cc │ │ ├── i_cpu_posix.cc │ │ ├── i_exception.cc │ │ ├── i_main.cc │ │ ├── i_opndir.cc │ │ ├── i_opndir.h │ │ ├── i_png.cc │ │ ├── i_png.h │ │ ├── i_swap.h │ │ ├── i_system.cc │ │ ├── i_system.h │ │ ├── i_video.cc │ │ ├── i_video.h │ │ └── win32 │ │ │ ├── afxres.h │ │ │ ├── doom64.ico │ │ │ ├── doom64.rc │ │ │ └── resource.h │ ├── util │ │ └── StringView_test.cc │ ├── wad │ │ ├── DoomWad.cc │ │ ├── RomWad.cc │ │ ├── SubStream.hh │ │ ├── Wad.cc │ │ ├── WadFormat.hh │ │ └── ZipWad.cc │ ├── wadgen │ │ ├── deflate-N64.cc │ │ ├── deflate-N64.h │ │ ├── gfx.cc │ │ ├── gfx.h │ │ ├── level.cc │ │ ├── level.h │ │ ├── png.cc │ │ ├── rom.cc │ │ ├── rom.h │ │ ├── sndfont.cc │ │ ├── sndfont.h │ │ ├── sound.cc │ │ ├── sound.h │ │ ├── sprite.cc │ │ ├── sprite.h │ │ ├── texture.cc │ │ ├── texture.h │ │ ├── wad.cc │ │ ├── wad.h │ │ ├── wadgen.cc │ │ └── wadgen.h │ └── zone │ │ ├── z_zone.cc │ │ └── z_zone.h └── gtk3 │ ├── CMakeLists.txt │ ├── console.vala │ └── thread.vala └── testdata ├── 16-color.png ├── color-alpha.png ├── color-crop.png ├── color-expand.png ├── color.png ├── index-alpha.png └── index.png /.appveyor.yml: -------------------------------------------------------------------------------- 1 | version: '{build}' 2 | 3 | branches: 4 | except: 5 | - /^travis.*$/ 6 | 7 | clone_depth: 1 8 | 9 | cache: 10 | - i686-6.2.0-release-win32-dwarf-rt_v5-rev1.7z 11 | - mingw-w64-i686.7z 12 | 13 | environment: 14 | CTEST_OUTPUT_ON_FAILURE: 1 15 | matrix: 16 | - MINGW_DIR: mingw32 17 | MINGW_URL: https://sourceforge.net/projects/mingw-w64/files/Toolchains%20targetting%20Win32/Personal%20Builds/mingw-builds/6.2.0/threads-win32/dwarf/i686-6.2.0-release-win32-dwarf-rt_v5-rev1.7z/download 18 | MINGW_ARCHIVE: i686-6.2.0-release-win32-dwarf-rt_v5-rev1.7z 19 | EXTERN_URL: https://dl.dropboxusercontent.com/u/7122698/mingw-w64-i686.7z 20 | EXTERN_ARCHIVE: mingw-w64-i686.7z 21 | 22 | install: 23 | - if not exist "%MINGW_ARCHIVE%" appveyor DownloadFile "%MINGW_URL%" -FileName "%MINGW_ARCHIVE%" 24 | - if not exist "%EXTERN_ARCHIVE%" appveyor DownloadFile "%EXTERN_URL%" -FileName "%EXTERN_ARCHIVE%" 25 | - 7z x -y "%MINGW_ARCHIVE%" > nul 26 | - 7z x -y "%EXTERN_ARCHIVE%" -o.\extern > nul 27 | # CMake refuses to generate MinGW Makefiles if sh.exe is in the Path 28 | - ps: Get-Command sh.exe -All | Remove-Item 29 | 30 | before_build: 31 | - set Path=%CD%\%MINGW_DIR%\bin;%Path% 32 | - g++ --version 33 | - mingw32-make --version 34 | - cmake --version 35 | - cmake -H. -Bbuild\mingw -G "MinGW Makefiles" -DCMAKE_BUILD_TYPE=%CMAKE_BUILD_TYPE% -DTESTING=ON 36 | 37 | build_script: 38 | - cmake --build build\mingw --use-stderr --target all -- -j%NUMBER_OF_PROCESSORS% 39 | 40 | after_build: 41 | - ctest 42 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | *.o 2 | *.elf 3 | *.velf 4 | *.bin 5 | *.vpk 6 | *.sfo 7 | 8 | # ignore CLion-specific project files 9 | /.idea/ 10 | /cmake-build-*/ 11 | 12 | # ignore Visual Studio-specific project files 13 | /.vs 14 | 15 | # extern 16 | /extern/ 17 | !/extern/CMakeLists.txt 18 | !/extern/patched-config_win32.h 19 | 20 | # build dir 21 | /build/wadgen 22 | 23 | # conan 24 | conanbuildinfo.cmake 25 | conaninfo.txt 26 | -------------------------------------------------------------------------------- /.gitmodules: -------------------------------------------------------------------------------- 1 | [submodule "fluidsynth"] 2 | path = fluidsynth 3 | url = https://github.com/dotfloat/fluidsynth-lite 4 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | language: c++ 2 | dist: trusty 3 | sudo: required 4 | 5 | matrix: 6 | include: 7 | - os: linux 8 | compiler: gcc 9 | env: GCC_VERSION=5 10 | addons: 11 | apt: 12 | sources: 13 | - ubuntu-toolchain-r-test 14 | - kubuntu-backports 15 | packages: 16 | - gcc-5 17 | - g++-5 18 | - cmake 19 | - libpng-dev 20 | - libgtest-dev 21 | - libsdl2-net-dev 22 | - os: linux 23 | compiler: clang 24 | env: CLANG_VERSION=3.5 25 | addons: 26 | apt: 27 | sources: 28 | - ubuntu-toolchain-r-test 29 | - llvm-toolchain-precise-3.5 30 | - kubuntu-backports 31 | packages: 32 | - clang-3.5 33 | - cmake 34 | - libstdc++-5-dev 35 | - libpng-dev 36 | - libgtest-dev 37 | - libsdl2-net-dev 38 | 39 | before_install: 40 | # Set correct GCC or Clang versions. 41 | - if [ -n "$GCC_VERSION" ]; then export CC="gcc-${GCC_VERSION}" CXX="g++-${GCC_VERSION}"; fi 42 | - if [ -n "$CLANG_VERSION" ]; then export CC="clang-${CLANG_VERSION}" CXX="clang++-${CLANG_VERSION}"; fi 43 | - which $CC 44 | - which $CXX 45 | 46 | install: 47 | # Compile google test library 48 | - cd /usr/src/gtest 49 | - sudo cmake -Dgtest_disable_pthreads=ON . 50 | - sudo cmake --build . 51 | - sudo mv libg* /usr/local/lib/ 52 | - cd - 53 | 54 | script: 55 | # Compile our thing! 56 | - mkdir build 57 | - cd build 58 | - cmake -DTESTING=ON -DCMAKE_BUILD_TYPE=Release .. 59 | - cmake --build . 60 | - ctest 61 | 62 | notifications: 63 | email: false 64 | irc: 65 | channels: 66 | - "irc.oftc.net#doom64ex" 67 | on_success: change 68 | on_failure: always 69 | template: 70 | - "%{author}: (%{branch} - %{commit}) -> %{message}" 71 | - "Change view -> %{compare_url}" 72 | - "Build details -> %{build_url}" 73 | -------------------------------------------------------------------------------- /AUTHORS: -------------------------------------------------------------------------------- 1 | This file is now the amalgamated list of authors, contributors and credits 2 | for Doom64 EX. Hopefully by keeping these all in one place, they will remain 3 | more accurate. 4 | 5 | Doom was originally written by id software; when playing with any id main 6 | wad file, you can see their list of credits, which includes the list of 7 | programmers. After some years, they released the source code, to allow 8 | others to work on improving the game. 9 | 10 | In October 1999, id Software re-released the Doom source code under the 11 | GNU General Public License. 12 | 13 | Samuel Villarreal 14 | Doom64 EX Author 15 | 16 | Paul Brook 17 | Author of the Doom3D source port in which Doom64 EX was originally based off of 18 | 19 | Zohar Malamant 20 | Additional programming, multi-platform support 21 | 22 | Cray Elliott 23 | Additional programming, multi-platform support 24 | 25 | Urchlay B. Watson 26 | *Unix support 27 | 28 | James 'Quasar' Haley 29 | For providing wisdom when it comes to working with all the backend stuff such as 30 | Doom's zone memory allocator. Also provided the macro script compiler utility. 31 | 32 | Simon 'Fraggle' Howard 33 | Networking system 34 | 35 | Lee Killough 36 | For just about anything that fixed all of Doom's mistakes, bugs, and errors. 37 | 38 | Team TNT 39 | For all Boom related enhancements and fixes. 40 | -------------------------------------------------------------------------------- /CMakeSettings.json: -------------------------------------------------------------------------------- 1 | // CMake configuration file for Microsoft Visual C++ 2 | { 3 | // See https://go.microsoft.com//fwlink//?linkid=834763 for more information about this file. 4 | "configurations": [ 5 | { 6 | "name": "x86-Debug", 7 | "generator": "Ninja", 8 | "configurationType": "Debug", 9 | "inheritEnvironments": [ "msvc_x86" ], 10 | "buildRoot": "${env.USERPROFILE}\\CMakeBuilds\\${workspaceHash}\\build\\${name}", 11 | "installRoot": "${env.USERPROFILE}\\CMakeBuilds\\${workspaceHash}\\install\\${name}", 12 | "cmakeCommandArgs": "", 13 | "buildCommandArgs": "-v", 14 | "ctestCommandArgs": "" 15 | }, 16 | { 17 | "name": "x86-Release", 18 | "generator": "Ninja", 19 | "configurationType": "RelWithDebInfo", 20 | "inheritEnvironments": [ "msvc_x86" ], 21 | "buildRoot": "${env.USERPROFILE}\\CMakeBuilds\\${workspaceHash}\\build\\${name}", 22 | "installRoot": "${env.USERPROFILE}\\CMakeBuilds\\${workspaceHash}\\install\\${name}", 23 | "cmakeCommandArgs": "", 24 | "buildCommandArgs": "-v", 25 | "ctestCommandArgs": "" 26 | }, 27 | { 28 | "name": "x64-Debug", 29 | "generator": "Ninja", 30 | "configurationType": "Debug", 31 | "inheritEnvironments": [ "msvc_x64_x64" ], 32 | "buildRoot": "${env.USERPROFILE}\\CMakeBuilds\\${workspaceHash}\\build\\${name}", 33 | "installRoot": "${env.USERPROFILE}\\CMakeBuilds\\${workspaceHash}\\install\\${name}", 34 | "cmakeCommandArgs": "", 35 | "buildCommandArgs": "-v", 36 | "ctestCommandArgs": "" 37 | }, 38 | { 39 | "name": "x64-Release", 40 | "generator": "Ninja", 41 | "configurationType": "RelWithDebInfo", 42 | "inheritEnvironments": [ "msvc_x64_x64" ], 43 | "buildRoot": "${env.USERPROFILE}\\CMakeBuilds\\${workspaceHash}\\build\\${name}", 44 | "installRoot": "${env.USERPROFILE}\\CMakeBuilds\\${workspaceHash}\\install\\${name}", 45 | "cmakeCommandArgs": "", 46 | "buildCommandArgs": "-v", 47 | "ctestCommandArgs": "" 48 | } 49 | ] 50 | } 51 | -------------------------------------------------------------------------------- /CppProperties.json: -------------------------------------------------------------------------------- 1 | { 2 | "configurations": [ 3 | { 4 | "inheritEnvironments": [ 5 | "msvc_x86" 6 | ], 7 | "name": "x86-Debug", 8 | "includePath": [ 9 | "${env.INCLUDE}", 10 | "${workspaceRoot}\\**" 11 | ], 12 | "defines": [ 13 | "WIN32", 14 | "_DEBUG", 15 | "UNICODE", 16 | "_UNICODE" 17 | ], 18 | "intelliSenseMode": "windows-msvc-x86" 19 | }, 20 | { 21 | "inheritEnvironments": [ 22 | "msvc_x86" 23 | ], 24 | "name": "x86-Release", 25 | "includePath": [ 26 | "${env.INCLUDE}", 27 | "${workspaceRoot}\\**" 28 | ], 29 | "defines": [ 30 | "WIN32", 31 | "NDEBUG", 32 | "UNICODE", 33 | "_UNICODE" 34 | ], 35 | "intelliSenseMode": "windows-msvc-x86" 36 | }, 37 | { 38 | "inheritEnvironments": [ 39 | "msvc_x64" 40 | ], 41 | "name": "x64-Debug", 42 | "includePath": [ 43 | "${env.INCLUDE}", 44 | "${workspaceRoot}\\**" 45 | ], 46 | "defines": [ 47 | "WIN32", 48 | "_DEBUG", 49 | "UNICODE", 50 | "_UNICODE" 51 | ], 52 | "intelliSenseMode": "windows-msvc-x64" 53 | }, 54 | { 55 | "inheritEnvironments": [ 56 | "msvc_x64" 57 | ], 58 | "name": "x64-Release", 59 | "includePath": [ 60 | "${env.INCLUDE}", 61 | "${workspaceRoot}\\**" 62 | ], 63 | "defines": [ 64 | "WIN32", 65 | "NDEBUG", 66 | "UNICODE", 67 | "_UNICODE" 68 | ], 69 | "intelliSenseMode": "windows-msvc-x64" 70 | } 71 | ] 72 | } -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Doom64EX Vita 2 |

3 | Doom64EX Vita is a port of Doom64EX for the PSVITA/PSTV.
4 | Doom64EX is a reverse-engineering project aimed to recreate Doom64 as close as possible with additional modding features. 5 | 6 | ## Requirements 7 | In order to run Doom64EX, you need libshacccg.suprx. If you don't have it installed already, you can install it by following this guide: https://samilops2.gitbook.io/vita-troubleshooting-guide/shader-compiler/extract-libshacccg.suprx 8 | 9 | ## Known Issues 10 | - Enabling the Texture Combiner will result in lighting being broken in game. It's suggested to keep it off. 11 | - When a lot of sounds are played simultaneously, framerate can hinder a bit (down to 30-40 fps). 12 | - Music playback and sounds sometime can go out of sync and/or repeat small chunks (This is due to a bug in fluidsynth). 13 | 14 | ## Default Controls 15 | - X = Jump (when enabled in Options) 16 | - Start = Pause 17 | - Select = Open AutoMap 18 | - Up/Down = Zoom In/Out AutoMap 19 | - Left/Right = Change Weapon 20 | - Triangle/Circle = Change Weapon 21 | - L = Run 22 | - R = Fire 23 | - Square = Activate/Use 24 | 25 | ## Initial Setup 26 | - Download Doom64EX.vpk from the Release section and install it. 27 | - Download Doom64EX.zip from the Release section and extract it in ux0:data/Doom64EX. 28 | - Follow one of the two paragraphs below to install game data files. 29 | 30 | ## Setup from N64 cartridge 31 | This is the indended way to install original Doom64EX. 32 | - Dump your own N64 cartridge of Doom 64 (any region works fine) with GameShark, GameGenie or any other source you prefer. 33 | - Download wadgen.zip from the Release section. 34 | - Run WadGen.exe and select the dump of your Doom 64 cartridge. It will generate the required files for Doom64EX to work. 35 | - Copy DOOM64.WAD and DOOMSND.SF2 to ux0:data/Doom64EX. 36 | 37 | ## Setup from Steam 38 | This allows to use Doom 64 remaster WAD with Doom64EX. It will have some minor issues with demo playback but will allow to play also the exclusive The Lost Levels. 39 | - [Buy the game on Steam](https://store.steampowered.com/app/1148590/DOOM_64/). 40 | - With a webbrowser, navigate to the url steam://nav/console. 41 | - When asked with what to open said link, select Steam. 42 | - On Steam, you'll get prompted with the console, input in the console `download_depot 1148590 1148591 7293157900876244073`. 43 | - Steam will start download the depot. Once finished, it will show in the console what path it downloaded it to, navigate towards that directory. 44 | - Download the Doom64EX Steam to EX patch made by Henky [from this url](http://henk.tech/doom64). 45 | - Extract the archive in the same folder of the downloaded depot. 46 | - Run run.cmd. It will generate an output folder with the required files for Doom64EX to work. 47 | - Copy DOOM64.WAD and DOOMSND.SF2 to ux0:data/Doom64EX. 48 | 49 | ## Compiling 50 | - Compile and install [vitaGL](https://github.com/Rinnegatamante/vitaGL) with `make NO_DEBUG=1 HAVE_HIGH_FFP_TEXUNITS=1 HAVE_WVP_ON_GPU=1 install`. 51 | - Compile and install [fluidsynth-lite](https://github.com/fgsfdsfgs/fluidsynth-lite). 52 | - Run `make`. 53 | 54 | ## Credits 55 | - svkaiser for the original Doom64EX. 56 | - fgsfds for the Doom64EX Switch port used as reference for some fixes. 57 | - CatoTheYounger for testing the homebrew. 58 | - Brandonheat8 for the Livearea assets. 59 | -------------------------------------------------------------------------------- /build/sce_sys/bg.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Rinnegatamante/Doom64EX/1344ab10f43a6aae374659d9714a0b234a5bd134/build/sce_sys/bg.png -------------------------------------------------------------------------------- /build/sce_sys/icon0.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Rinnegatamante/Doom64EX/1344ab10f43a6aae374659d9714a0b234a5bd134/build/sce_sys/icon0.png -------------------------------------------------------------------------------- /build/sce_sys/pic0.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Rinnegatamante/Doom64EX/1344ab10f43a6aae374659d9714a0b234a5bd134/build/sce_sys/pic0.png -------------------------------------------------------------------------------- /build/sce_sys/startup.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Rinnegatamante/Doom64EX/1344ab10f43a6aae374659d9714a0b234a5bd134/build/sce_sys/startup.png -------------------------------------------------------------------------------- /build/sce_sys/template.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | bg.png 6 | 7 | 8 | 9 | startup.png 10 | 11 | -------------------------------------------------------------------------------- /build_scripts/toolchain-mingw32.cmake: -------------------------------------------------------------------------------- 1 | set (CMAKE_SYSTEM_NAME Windows) 2 | 3 | # specify the cross compiler 4 | set (CMAKE_C_COMPILER i686-w64-mingw32-gcc) 5 | set (CMAKE_CXX_COMPILER i686-w64-mingw32-g++) 6 | 7 | # where is the target environment 8 | set (CMAKE_FIND_ROOT_PATH /usr/i686-w64-mingw32) 9 | 10 | # search for programs in the build host directories 11 | set (CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER) 12 | # for libraries and headers in the target directories 13 | set (CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY) 14 | set (CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY) 15 | set (CMAKE_FIND_ROOT_PATH_MODE_PACKAGE ONLY) 16 | 17 | # Make sure Qt can be detected by CMake 18 | set (QT_BINARY_DIR /usr/i686-w64-mingw32/bin /usr/bin) 19 | set (QT_INCLUDE_DIRS_NO_SYSTEM ON) 20 | 21 | # set the resource compiler (RHBZ #652435) 22 | set (CMAKE_RC_COMPILER i686-w64-mingw32-windres) 23 | set (CMAKE_MC_COMPILER i686-w64-mingw32-windmc) 24 | 25 | # override boost thread component suffix as mingw-w64-boost is compiled with threadapi=win32 26 | set (Boost_THREADAPI win32) 27 | 28 | # These are needed for compiling lapack (RHBZ #753906) 29 | set (CMAKE_Fortran_COMPILER i686-w64-mingw32-gfortran) 30 | set (CMAKE_AR:FILEPATH i686-w64-mingw32-ar) 31 | set (CMAKE_RANLIB:FILEPATH i686-w64-mingw32-ranlib) 32 | 33 | -------------------------------------------------------------------------------- /cmake/FindFluidSynth.cmake: -------------------------------------------------------------------------------- 1 | # - Find fluidsynth 2 | # Find the native fluidsynth includes and library 3 | # 4 | # FLUIDSYNTH_INCLUDE_DIR - where to find fluidsynth.h 5 | # FLUIDSYNTH_LIBRARIES - List of libraries when using fluidsynth. 6 | # FLUIDSYNTH_FOUND - True if fluidsynth found. 7 | 8 | 9 | IF (FLUIDSYNTH_INCLUDE_DIR AND FLUIDSYNTH_LIBRARIES) 10 | # Already in cache, be silent 11 | SET(FluidSynth_FIND_QUIETLY TRUE) 12 | ENDIF (FLUIDSYNTH_INCLUDE_DIR AND FLUIDSYNTH_LIBRARIES) 13 | 14 | FIND_PATH(FLUIDSYNTH_INCLUDE_DIR fluidsynth.h) 15 | 16 | FIND_LIBRARY(FLUIDSYNTH_LIBRARIES NAMES fluidsynth ) 17 | MARK_AS_ADVANCED( FLUIDSYNTH_LIBRARIES FLUIDSYNTH_INCLUDE_DIR ) 18 | 19 | # handle the QUIETLY and REQUIRED arguments and set FLUIDSYNTH_FOUND to TRUE if 20 | # all listed variables are TRUE 21 | INCLUDE(FindPackageHandleStandardArgs) 22 | FIND_PACKAGE_HANDLE_STANDARD_ARGS(FluidSynth DEFAULT_MSG FLUIDSYNTH_LIBRARIES FLUIDSYNTH_INCLUDE_DIR) 23 | -------------------------------------------------------------------------------- /cmake/FindGDKPixbuf.cmake: -------------------------------------------------------------------------------- 1 | # FindGDKPixbuf.cmake 2 | # 3 | # 4 | # CMake support for GDK Pixbuf. 5 | # 6 | # License: 7 | # 8 | # Copyright (c) 2016 Evan Nemerson 9 | # 10 | # Permission is hereby granted, free of charge, to any person 11 | # obtaining a copy of this software and associated documentation 12 | # files (the "Software"), to deal in the Software without 13 | # restriction, including without limitation the rights to use, copy, 14 | # modify, merge, publish, distribute, sublicense, and/or sell copies 15 | # of the Software, and to permit persons to whom the Software is 16 | # furnished to do so, subject to the following conditions: 17 | # 18 | # The above copyright notice and this permission notice shall be 19 | # included in all copies or substantial portions of the Software. 20 | # 21 | # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 22 | # EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 23 | # MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 24 | # NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 25 | # HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 26 | # WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 27 | # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 28 | # DEALINGS IN THE SOFTWARE. 29 | 30 | find_package(PkgConfig) 31 | 32 | set(GDKPixbuf_DEPS 33 | GLib) 34 | 35 | if(PKG_CONFIG_FOUND) 36 | pkg_search_module(GDKPixbuf_PKG gdk-pixbuf-2.0) 37 | endif() 38 | 39 | find_library(GDKPixbuf_LIBRARY gdk_pixbuf-2.0 HINTS ${GDKPixbuf_PKG_LIBRARY_DIRS}) 40 | set(GDKPixbuf "gdk_pixbuf-2.0") 41 | 42 | if(GDKPixbuf_LIBRARY) 43 | add_library(${GDKPixbuf} SHARED IMPORTED) 44 | set_property(TARGET ${GDKPixbuf} PROPERTY IMPORTED_LOCATION "${GDKPixbuf_LIBRARY}") 45 | set_property(TARGET ${GDKPixbuf} PROPERTY INTERFACE_COMPILE_OPTIONS "${GDKPixbuf_PKG_CFLAGS_OTHER}") 46 | 47 | set(GDKPixbuf_INCLUDE_DIRS) 48 | 49 | find_path(GDKPixbuf_INCLUDE_DIR "gdk-pixbuf/gdk-pixbuf.h" 50 | HINTS ${GDKPixbuf_PKG_INCLUDE_DIRS}) 51 | 52 | if(GDKPixbuf_INCLUDE_DIR) 53 | file(STRINGS "${GDKPixbuf_INCLUDE_DIR}/gdk-pixbuf/gdk-pixbuf-features.h" GDKPixbuf_VERSION REGEX "^#define GDKPIXBUF_VERSION \\\"[^\\\"]+\\\"") 54 | string(REGEX REPLACE "^#define GDKPIXBUF_VERSION \\\"([0-9]+)\\.([0-9]+)\\.([0-9]+)\\\"$" "\\1.\\2.\\3" GDKPixbuf_VERSION "${GDKPixbuf_VERSION}") 55 | 56 | list(APPEND GDKPixbuf_INCLUDE_DIRS ${GDKPixbuf_INCLUDE_DIR}) 57 | set_property(TARGET ${GDKPixbuf} PROPERTY INTERFACE_INCLUDE_DIRECTORIES "${GDKPixbuf_INCLUDE_DIR}") 58 | endif() 59 | endif() 60 | 61 | set(GDKPixbuf_DEPS_FOUND_VARS) 62 | foreach(gdkpixbuf_dep ${GDKPixbuf_DEPS}) 63 | find_package(${gdkpixbuf_dep}) 64 | 65 | list(APPEND GDKPixbuf_DEPS_FOUND_VARS "${gdkpixbuf_dep}_FOUND") 66 | list(APPEND GDKPixbuf_INCLUDE_DIRS ${${gdkpixbuf_dep}_INCLUDE_DIRS}) 67 | 68 | set_property (TARGET ${GDKPixbuf} APPEND PROPERTY INTERFACE_LINK_LIBRARIES "${${gdkpixbuf_dep}}") 69 | endforeach(gdkpixbuf_dep) 70 | 71 | include(FindPackageHandleStandardArgs) 72 | find_package_handle_standard_args(GDKPixbuf 73 | REQUIRED_VARS 74 | GDKPixbuf_LIBRARY 75 | GDKPixbuf_INCLUDE_DIRS 76 | ${GDKPixbuf_DEPS_FOUND_VARS} 77 | VERSION_VAR 78 | GDKPixbuf_VERSION) 79 | 80 | unset(GDKPixbuf_DEPS_FOUND_VARS) 81 | -------------------------------------------------------------------------------- /cmake/FindGLib.cmake: -------------------------------------------------------------------------------- 1 | # FindGLib.cmake 2 | # 3 | # 4 | # CMake support for GLib/GObject/GIO. 5 | # 6 | # License: 7 | # 8 | # Copyright (c) 2016 Evan Nemerson 9 | # 10 | # Permission is hereby granted, free of charge, to any person 11 | # obtaining a copy of this software and associated documentation 12 | # files (the "Software"), to deal in the Software without 13 | # restriction, including without limitation the rights to use, copy, 14 | # modify, merge, publish, distribute, sublicense, and/or sell copies 15 | # of the Software, and to permit persons to whom the Software is 16 | # furnished to do so, subject to the following conditions: 17 | # 18 | # The above copyright notice and this permission notice shall be 19 | # included in all copies or substantial portions of the Software. 20 | # 21 | # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 22 | # EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 23 | # MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 24 | # NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 25 | # HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 26 | # WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 27 | # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 28 | # DEALINGS IN THE SOFTWARE. 29 | 30 | find_package(PkgConfig) 31 | 32 | if(PKG_CONFIG_FOUND) 33 | pkg_search_module(GLib_PKG glib-2.0) 34 | endif() 35 | 36 | find_library(GLib_LIBRARY glib-2.0 HINTS ${GLib_PKG_LIBRARY_DIRS}) 37 | set(GLib glib-2.0) 38 | 39 | if(GLib_LIBRARY AND NOT GLib_FOUND) 40 | add_library(${GLib} SHARED IMPORTED) 41 | set_property(TARGET ${GLib} PROPERTY IMPORTED_LOCATION "${GLib_LIBRARY}") 42 | set_property(TARGET ${GLib} PROPERTY INTERFACE_COMPILE_OPTIONS "${GLib_PKG_CFLAGS_OTHER}") 43 | 44 | find_path(GLib_INCLUDE_DIRS "glib.h" 45 | HINTS ${GLib_PKG_INCLUDE_DIRS} 46 | PATH_SUFFIXES "glib-2.0") 47 | 48 | get_filename_component(GLib_LIBDIR "${GLib}" DIRECTORY) 49 | find_path(GLib_CONFIG_INCLUDE_DIR "glibconfig.h" 50 | HINTS 51 | ${GLib_LIBDIR} 52 | ${GLib_PKG_INCLUDE_DIRS} 53 | PATHS 54 | "${CMAKE_LIBRARY_PATH}" 55 | PATH_SUFFIXES 56 | "glib-2.0/include" 57 | "glib-2.0") 58 | unset(GLib_LIBDIR) 59 | 60 | if(GLib_CONFIG_INCLUDE_DIR) 61 | file(STRINGS "${GLib_CONFIG_INCLUDE_DIR}/glibconfig.h" GLib_MAJOR_VERSION REGEX "^#define GLIB_MAJOR_VERSION +([0-9]+)") 62 | string(REGEX REPLACE "^#define GLIB_MAJOR_VERSION ([0-9]+)$" "\\1" GLib_MAJOR_VERSION "${GLib_MAJOR_VERSION}") 63 | file(STRINGS "${GLib_CONFIG_INCLUDE_DIR}/glibconfig.h" GLib_MINOR_VERSION REGEX "^#define GLIB_MINOR_VERSION +([0-9]+)") 64 | string(REGEX REPLACE "^#define GLIB_MINOR_VERSION ([0-9]+)$" "\\1" GLib_MINOR_VERSION "${GLib_MINOR_VERSION}") 65 | file(STRINGS "${GLib_CONFIG_INCLUDE_DIR}/glibconfig.h" GLib_MICRO_VERSION REGEX "^#define GLIB_MICRO_VERSION +([0-9]+)") 66 | string(REGEX REPLACE "^#define GLIB_MICRO_VERSION ([0-9]+)$" "\\1" GLib_MICRO_VERSION "${GLib_MICRO_VERSION}") 67 | set(GLib_VERSION "${GLib_MAJOR_VERSION}.${GLib_MINOR_VERSION}.${GLib_MICRO_VERSION}") 68 | unset(GLib_MAJOR_VERSION) 69 | unset(GLib_MINOR_VERSION) 70 | unset(GLib_MICRO_VERSION) 71 | 72 | list(APPEND GLib_INCLUDE_DIRS ${GLib_CONFIG_INCLUDE_DIR}) 73 | set_property(TARGET ${GLib} PROPERTY INTERFACE_INCLUDE_DIRECTORIES "${GLib_INCLUDE_DIRS}") 74 | endif() 75 | endif() 76 | 77 | include(FindPackageHandleStandardArgs) 78 | find_package_handle_standard_args(GLib 79 | REQUIRED_VARS 80 | GLib_LIBRARY 81 | GLib_INCLUDE_DIRS 82 | VERSION_VAR 83 | GLib_VERSION) 84 | -------------------------------------------------------------------------------- /cmake/FindGObject.cmake: -------------------------------------------------------------------------------- 1 | # FindGObject.cmake 2 | # 3 | # 4 | # CMake support for GObject. 5 | # 6 | # License: 7 | # 8 | # Copyright (c) 2016 Evan Nemerson 9 | # 10 | # Permission is hereby granted, free of charge, to any person 11 | # obtaining a copy of this software and associated documentation 12 | # files (the "Software"), to deal in the Software without 13 | # restriction, including without limitation the rights to use, copy, 14 | # modify, merge, publish, distribute, sublicense, and/or sell copies 15 | # of the Software, and to permit persons to whom the Software is 16 | # furnished to do so, subject to the following conditions: 17 | # 18 | # The above copyright notice and this permission notice shall be 19 | # included in all copies or substantial portions of the Software. 20 | # 21 | # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 22 | # EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 23 | # MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 24 | # NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 25 | # HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 26 | # WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 27 | # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 28 | # DEALINGS IN THE SOFTWARE. 29 | 30 | find_package(PkgConfig) 31 | 32 | set(GObject_DEPS 33 | GLib) 34 | 35 | if(PKG_CONFIG_FOUND) 36 | pkg_search_module(GObject_PKG gobject-2.0) 37 | endif() 38 | 39 | find_library(GObject_LIBRARY gobject-2.0 HINTS ${GObject_PKG_LIBRARY_DIRS}) 40 | set(GObject gobject-2.0) 41 | 42 | if(GObject_LIBRARY AND NOT GObject_FOUND) 43 | add_library(${GObject} SHARED IMPORTED) 44 | set_property(TARGET ${GObject} PROPERTY IMPORTED_LOCATION "${GObject_LIBRARY}") 45 | set_property(TARGET ${GObject} PROPERTY INTERFACE_COMPILE_OPTIONS "${GObject_PKG_CFLAGS_OTHER}") 46 | 47 | find_path(GObject_INCLUDE_DIR "gobject/gobject.h" 48 | HINTS ${GObject_PKG_INCLUDE_DIRS}) 49 | 50 | find_package(GLib) 51 | set(GObject_VERSION "${GLib_VERSION}") 52 | 53 | list(APPEND GObject_DEPS_FOUND_VARS "GLib_FOUND") 54 | list(APPEND GObject_INCLUDE_DIRS ${GLib_INCLUDE_DIRS}) 55 | set_property(TARGET ${GObject} PROPERTY INTERFACE_INCLUDE_DIRECTORIES "${GObject_INCLUDE_DIR}") 56 | 57 | set_property (TARGET "${GObject}" APPEND PROPERTY INTERFACE_LINK_LIBRARIES "${GLib}") 58 | endif() 59 | 60 | find_program(GLib_GENMARSHAL glib-genmarshal) 61 | if(GLib_GENMARSHAL AND NOT GLib_FOUND) 62 | add_executable(glib-genmarshal IMPORTED) 63 | set_property(TARGET glib-genmarshal PROPERTY IMPORTED_LOCATION "${GLib_GENMARSHAL}") 64 | endif() 65 | 66 | find_program(GLib_MKENUMS glib-mkenums) 67 | if(GLib_MKENUMS AND NOT GLib_FOUND) 68 | add_executable(glib-mkenums IMPORTED) 69 | set_property(TARGET glib-mkenums PROPERTY IMPORTED_LOCATION "${GLib_MKENUMS}") 70 | endif() 71 | 72 | include(FindPackageHandleStandardArgs) 73 | find_package_handle_standard_args(GObject 74 | REQUIRED_VARS 75 | GObject_LIBRARY 76 | GObject_INCLUDE_DIRS 77 | ${GObject_DEPS_FOUND_VARS} 78 | VERSION_VAR 79 | GObject_VERSION) 80 | 81 | unset(GObject_DEPS_FOUND_VARS) 82 | -------------------------------------------------------------------------------- /cmake/FindSDL2_net.cmake: -------------------------------------------------------------------------------- 1 | # - Find SDL2_net library and headers 2 | # 3 | # Find module for SDL_net 2.0 (http://www.libsdl.org/projects/SDL_net/). 4 | # It defines the following variables: 5 | # SDL2_NET_INCLUDE_DIRS - The location of the headers, e.g., SDL_net.h. 6 | # SDL2_NET_LIBRARIES - The libraries to link against to use SDL2_net. 7 | # SDL2_NET_FOUND - If false, do not try to use SDL2_net. 8 | # SDL2_NET_VERSION_STRING 9 | # Human-readable string containing the version of SDL2_net. 10 | # 11 | # Also defined, but not for general use are: 12 | # SDL2_NET_INCLUDE_DIR - The directory that contains SDL_net.h. 13 | # SDL2_NET_LIBRARY - The location of the SDL2_net library. 14 | # 15 | 16 | #============================================================================= 17 | # Copyright 2013 Benjamin Eikel 18 | # 19 | # Distributed under the OSI-approved BSD License (the "License"); 20 | # see accompanying file Copyright.txt for details. 21 | # 22 | # This software is distributed WITHOUT ANY WARRANTY; without even the 23 | # implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 24 | # See the License for more information. 25 | #============================================================================= 26 | # (To distribute this file outside of CMake, substitute the full 27 | # License text for the above reference.) 28 | 29 | find_package(PkgConfig QUIET) 30 | pkg_check_modules(PC_SDL2_NET QUIET SDL2_net) 31 | 32 | find_path(SDL2_NET_INCLUDE_DIR 33 | NAMES SDL_net.h 34 | HINTS 35 | ${PC_SDL2_NET_INCLUDEDIR} 36 | ${PC_SDL2_NET_INCLUDE_DIRS} 37 | PATH_SUFFIXES SDL2 38 | ) 39 | 40 | find_library(SDL2_NET_LIBRARY 41 | NAMES SDL2_net 42 | HINTS 43 | ${PC_SDL2_NET_LIBDIR} 44 | ${PC_SDL2_NET_LIBRARY_DIRS} 45 | PATH_SUFFIXES x64 x86 46 | ) 47 | 48 | if(SDL2_NET_INCLUDE_DIR AND EXISTS "${SDL2_NET_INCLUDE_DIR}/SDL_net.h") 49 | file(STRINGS "${SDL2_NET_INCLUDE_DIR}/SDL_net.h" SDL2_NET_VERSION_MAJOR_LINE REGEX "^#define[ \t]+SDL_NET_MAJOR_VERSION[ \t]+[0-9]+$") 50 | file(STRINGS "${SDL2_NET_INCLUDE_DIR}/SDL_net.h" SDL2_NET_VERSION_MINOR_LINE REGEX "^#define[ \t]+SDL_NET_MINOR_VERSION[ \t]+[0-9]+$") 51 | file(STRINGS "${SDL2_NET_INCLUDE_DIR}/SDL_net.h" SDL2_NET_VERSION_PATCH_LINE REGEX "^#define[ \t]+SDL_NET_PATCHLEVEL[ \t]+[0-9]+$") 52 | string(REGEX REPLACE "^#define[ \t]+SDL_NET_MAJOR_VERSION[ \t]+([0-9]+)$" "\\1" SDL2_NET_VERSION_MAJOR "${SDL2_NET_VERSION_MAJOR_LINE}") 53 | string(REGEX REPLACE "^#define[ \t]+SDL_NET_MINOR_VERSION[ \t]+([0-9]+)$" "\\1" SDL2_NET_VERSION_MINOR "${SDL2_NET_VERSION_MINOR_LINE}") 54 | string(REGEX REPLACE "^#define[ \t]+SDL_NET_PATCHLEVEL[ \t]+([0-9]+)$" "\\1" SDL2_NET_VERSION_PATCH "${SDL2_NET_VERSION_PATCH_LINE}") 55 | set(SDL2_NET_VERSION_STRING ${SDL2_NET_VERSION_MAJOR}.${SDL2_NET_VERSION_MINOR}.${SDL2_NET_VERSION_PATCH}) 56 | unset(SDL2_NET_VERSION_MAJOR_LINE) 57 | unset(SDL2_NET_VERSION_MINOR_LINE) 58 | unset(SDL2_NET_VERSION_PATCH_LINE) 59 | unset(SDL2_NET_VERSION_MAJOR) 60 | unset(SDL2_NET_VERSION_MINOR) 61 | unset(SDL2_NET_VERSION_PATCH) 62 | endif() 63 | 64 | set(SDL2_NET_INCLUDE_DIRS ${SDL2_NET_INCLUDE_DIR}) 65 | set(SDL2_NET_LIBRARIES ${SDL2_NET_LIBRARY}) 66 | 67 | include(FindPackageHandleStandardArgs) 68 | 69 | find_package_handle_standard_args(SDL2_net 70 | REQUIRED_VARS SDL2_NET_INCLUDE_DIRS SDL2_NET_LIBRARIES 71 | VERSION_VAR SDL2_NET_VERSION_STRING) 72 | 73 | mark_as_advanced(SDL2_NET_INCLUDE_DIR SDL2_NET_LIBRARY) 74 | 75 | -------------------------------------------------------------------------------- /conanfile.txt: -------------------------------------------------------------------------------- 1 | [requires] 2 | # Stable 3 | libpng/1.6.23@lasote/stable 4 | zlib/1.2.8@lasote/stable 5 | SDL2/2.0.5@lasote/stable 6 | 7 | # Testing 8 | fmt/3.0.0@memsharded/testing 9 | 10 | # dotfloat's 11 | SDL2_net/2.0.1@dotfloat/testing 12 | fluidsynth-lite/1.1.6@dotfloat/testing 13 | 14 | [generators] 15 | cmake 16 | -------------------------------------------------------------------------------- /distrib/doom64ex.desktop: -------------------------------------------------------------------------------- 1 | [Desktop Entry] 2 | Name=Doom 64 EX 3 | Exec=doom64ex 4 | Icon=doom64ex 5 | Type=Application 6 | Comment=A Doom64 game engine 7 | Categories=Game;ActionGame; 8 | -------------------------------------------------------------------------------- /distrib/doom64ex.pk3/animdefs.txt: -------------------------------------------------------------------------------- 1 | // 2 | // ANIMATION DEFINITIONS FOR DOOM 64 3 | // 4 | 5 | 6 | animpic "SMONAA" 7 | { 8 | restartdelay = 15 9 | frames = 4 10 | speed = 7 11 | } 12 | 13 | animpic "SMONBA" 14 | { 15 | restartdelay = 0 16 | frames = 4 17 | speed = 1 18 | } 19 | 20 | animpic "SMONCA" 21 | { 22 | restartdelay = 0 23 | frames = 4 24 | speed = 7 25 | } 26 | 27 | animpic "CFACEA" 28 | { 29 | restartdelay = 90 30 | frames = 3 31 | speed = 3 32 | rewind 33 | } 34 | 35 | animpic "SMONDA" 36 | { 37 | restartdelay = 0 38 | frames = 4 39 | speed = 3 40 | } 41 | 42 | animpic "SMONEA" 43 | { 44 | restartdelay = 10 45 | frames = 4 46 | speed = 7 47 | } 48 | 49 | animpic "SPORTA" 50 | { 51 | restartdelay = 0 52 | frames = 9 53 | speed = 3 54 | cyclepalettes 55 | } 56 | 57 | animpic "SMONF" 58 | { 59 | restartdelay = 10 60 | frames = 5 61 | speed = 1 62 | rewind 63 | cyclepalettes 64 | } 65 | 66 | animpic "STRAKR" 67 | { 68 | restartdelay = 10 69 | frames = 5 70 | speed = 1 71 | rewind 72 | cyclepalettes 73 | } 74 | 75 | animpic "STRAKB" 76 | { 77 | restartdelay = 10 78 | frames = 5 79 | speed = 1 80 | rewind 81 | cyclepalettes 82 | } 83 | 84 | animpic "STRAKY" 85 | { 86 | restartdelay = 10 87 | frames = 5 88 | speed = 1 89 | rewind 90 | cyclepalettes 91 | } 92 | 93 | animpic "C307B" 94 | { 95 | restartdelay = 50 96 | frames = 5 97 | speed = 1 98 | rewind 99 | cyclepalettes 100 | } 101 | 102 | animpic "CTEL" 103 | { 104 | restartdelay = 0 105 | frames = 8 106 | speed = 3 107 | cyclepalettes 108 | } 109 | 110 | animpic "CASFL98" 111 | { 112 | restartdelay = 0 113 | frames = 5 114 | speed = 7 115 | rewind 116 | cyclepalettes 117 | } 118 | 119 | animpic "HTELA" 120 | { 121 | restartdelay = 0 122 | frames = 4 123 | speed = 1 124 | rewind 125 | } 126 | 127 | -------------------------------------------------------------------------------- /distrib/doom64ex.pk3/graphics/buttons.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Rinnegatamante/Doom64EX/1344ab10f43a6aae374659d9714a0b234a5bd134/distrib/doom64ex.pk3/graphics/buttons.png -------------------------------------------------------------------------------- /distrib/doom64ex.pk3/graphics/confont.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Rinnegatamante/Doom64EX/1344ab10f43a6aae374659d9714a0b234a5bd134/distrib/doom64ex.pk3/graphics/confont.png -------------------------------------------------------------------------------- /distrib/doom64ex.pk3/graphics/crshairs.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Rinnegatamante/Doom64EX/1344ab10f43a6aae374659d9714a0b234a5bd134/distrib/doom64ex.pk3/graphics/crshairs.png -------------------------------------------------------------------------------- /distrib/doom64ex.pk3/graphics/cursor.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Rinnegatamante/Doom64EX/1344ab10f43a6aae374659d9714a0b234a5bd134/distrib/doom64ex.pk3/graphics/cursor.png -------------------------------------------------------------------------------- /distrib/doom64ex.pk3/graphics/fancred.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Rinnegatamante/Doom64EX/1344ab10f43a6aae374659d9714a0b234a5bd134/distrib/doom64ex.pk3/graphics/fancred.png -------------------------------------------------------------------------------- /distrib/doom64ex.pk3/palplay3.act: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Rinnegatamante/Doom64EX/1344ab10f43a6aae374659d9714a0b234a5bd134/distrib/doom64ex.pk3/palplay3.act -------------------------------------------------------------------------------- /distrib/doom64ex.pk3/skydefs.txt: -------------------------------------------------------------------------------- 1 | // 2 | // SKY DEFINITIONS FOR DOOM 64 3 | // 4 | 5 | sky "F_SKYA" 6 | { 7 | pic = "CLOUD" 8 | fogcolor = 0 0 0 9 | basecolor = b0 80 ff 10 | highcolor = 0 0 0 11 | lowcolor = 0 0 15 12 | cloud 13 | thunder 14 | fogfactor = 985 15 | } 16 | 17 | sky "F_SKYB" 18 | { 19 | pic = "CLOUD" 20 | fogcolor = 0 0 0 21 | basecolor = ff 30 30 22 | highcolor = 10 0 0 23 | lowcolor = 10 0 0 24 | cloud 25 | fogfactor = 985 26 | } 27 | 28 | sky "F_SKYC" 29 | { 30 | pic = "CLOUD" 31 | backpic = "MOUNTB" 32 | fogcolor = 0 0 0 33 | basecolor = d0 70 40 34 | highcolor = 0 0 0 35 | lowcolor = 40 10 0 36 | cloud 37 | fogfactor = 985 38 | } 39 | 40 | sky "F_SKYD" 41 | { 42 | fogcolor = 0 0 0 43 | basecolor = 0 0 0 44 | highcolor = ff 0 0 45 | lowcolor = ff 60 0 46 | fire 47 | fogfactor = 985 48 | } 49 | 50 | sky "F_SKYE" 51 | { 52 | pic = "CLOUD" 53 | fogcolor = 30 10 8 54 | basecolor = d0 70 40 55 | highcolor = 0 0 0 56 | lowcolor = 40 10 0 57 | cloud 58 | fogfactor = 975 59 | } 60 | 61 | sky "F_SKYF" 62 | { 63 | pic = "SPACE" 64 | fogcolor = 0 0 0 65 | basecolor = 0 0 0 66 | highcolor = 0 0 0 67 | lowcolor = 0 0 0 68 | fogfactor = 985 69 | } 70 | 71 | sky "F_SKYG" 72 | { 73 | pic = "SPACE" 74 | backpic = "EVIL" 75 | fogcolor = 0 0 0 76 | basecolor = 0 0 0 77 | highcolor = 0 0 0 78 | lowcolor = 0 0 0 79 | fadeinbackground 80 | fogfactor = 995 81 | } 82 | 83 | sky "F_SKYH" 84 | { 85 | fogcolor = 0 40 40 86 | basecolor = 0 38 38 87 | highcolor = 0 0 0 88 | lowcolor = 0 0 0 89 | void 90 | fogfactor = 975 91 | } 92 | 93 | sky "F_SKYI" 94 | { 95 | fogcolor = 0 0 0 96 | basecolor = 0 0 0 97 | highcolor = 0 ff 0 98 | lowcolor = 70 70 0 99 | fire 100 | fogfactor = 985 101 | } 102 | 103 | sky "F_SKYJ" 104 | { 105 | pic = "CLOUD" 106 | backpic = "MOUNTC" 107 | fogcolor = 0 0 0 108 | basecolor = b0 80 ff 109 | highcolor = 0 0 0 110 | lowcolor = 0 0 15 111 | cloud 112 | thunder 113 | fogfactor = 985 114 | } 115 | 116 | sky "F_SKYK" 117 | { 118 | pic = "SPACE" 119 | backpic = "MOUNTA" 120 | fogcolor = 0 0 0 121 | basecolor = 0 0 0 122 | highcolor = 0 0 0 123 | lowcolor = 0 0 0 124 | fogfactor = 985 125 | } 126 | 127 | -------------------------------------------------------------------------------- /distrib/doom64ex.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Rinnegatamante/Doom64EX/1344ab10f43a6aae374659d9714a0b234a5bd134/distrib/doom64ex.png -------------------------------------------------------------------------------- /distrib/doom64ex_pk3.txt: -------------------------------------------------------------------------------- 1 | graphics/ 2 | animdefs.txt 3 | mapinfo.txt 4 | palplay3.act 5 | skydefs.txt 6 | -------------------------------------------------------------------------------- /distrib/linux_start.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | set -e 3 | 4 | arch=$(uname -m) 5 | case "$arch" in 6 | x86_64|amd64) 7 | bindir=linux64 8 | ;; 9 | x86|i*86) 10 | bindir=linux32 11 | ;; 12 | esac 13 | 14 | if [ -z $bindir ]; then 15 | echo "Unknown architecture: $arch" 16 | exit 17 | fi 18 | 19 | export LD_LIBRARY_PATH=$bindir 20 | "${bindir}/doom64ex" "$@" 21 | -------------------------------------------------------------------------------- /extern/patched-config_win32.h: -------------------------------------------------------------------------------- 1 | // Replaces FluidSynth's /src/config_win32.cmake 2 | // 3 | 4 | #pragma once 5 | 6 | #cmakedefine HAVE_IO_H @HAVE_IO_H@ 7 | 8 | #define DSOUND_SUPPORT 1 9 | #define WINMIDI_SUPPORT 1 10 | 11 | // Windows doesn't like this 12 | // #define snprintf _snprintf 13 | #define strcasecmp _stricmp 14 | 15 | #if _MSC_VER < 1500 16 | #define vsnprintf _vsnprintf 17 | #endif 18 | 19 | #define STDIN_FILENO 0 20 | #define STDOUT_FILENO 1 21 | #define STDERR_FILENO 2 22 | 23 | #pragma warning(disable : 4244) 24 | #pragma warning(disable : 4101) 25 | #pragma warning(disable : 4305) 26 | #pragma warning(disable : 4996) 27 | 28 | typedef int socklen_t; 29 | -------------------------------------------------------------------------------- /include/imp/NativeUI: -------------------------------------------------------------------------------- 1 | // -*- mode: c++ -*- 2 | //----------------------------------------------------------------------------- 3 | // 4 | // Copyright(C) 2017 Zohar Malamant 5 | // 6 | // This program is free software; you can redistribute it and/or 7 | // modify it under the terms of the GNU General Public License 8 | // as published by the Free Software Foundation; either version 2 9 | // of the License, or (at your option) any later version. 10 | // 11 | // This program is distributed in the hope that it will be useful, 12 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | // GNU General Public License for more details. 15 | // 16 | // You should have received a copy of the GNU General Public License 17 | // along with this program; if not, write to the Free Software 18 | // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 19 | // 02111-1307, USA. 20 | // 21 | //----------------------------------------------------------------------------- 22 | 23 | #ifndef __IMP_NATIVEUI__92059425 24 | #define __IMP_NATIVEUI__92059425 25 | 26 | #include "Prelude" 27 | 28 | namespace imp { 29 | namespace native_ui { 30 | void init(); 31 | 32 | void quit(); 33 | 34 | void console_show(bool); 35 | 36 | void console_add_line(StringView line); 37 | } 38 | } 39 | 40 | #endif //__IMP_NATIVEUI__92059425 41 | -------------------------------------------------------------------------------- /include/imp/Video: -------------------------------------------------------------------------------- 1 | // -*- C++ -*- 2 | #ifndef __IMP_VIDEO__38697988 3 | #define __IMP_VIDEO__38697988 4 | 5 | #include "Prelude" 6 | 7 | namespace imp { 8 | struct video_error : std::runtime_error { 9 | using std::runtime_error::runtime_error; 10 | }; 11 | 12 | enum struct Fullscreen { 13 | none, // Windowed 14 | noborder, // Noborder fullscreen window 15 | exclusive // Exclusive fullscreen 16 | }; 17 | 18 | enum struct OpenGLVer { 19 | gl14, 20 | gl33 21 | }; 22 | 23 | struct VideoMode { 24 | int width; 25 | int height; 26 | int buffer_size { 32 }; 27 | int depth_size { 24 }; 28 | Fullscreen fullscreen { Fullscreen::none }; 29 | int vsync { 1 }; 30 | }; 31 | 32 | struct IVideo { 33 | virtual ~IVideo() {} 34 | virtual void set_mode(const VideoMode&) = 0; 35 | virtual VideoMode current_mode() = 0; 36 | virtual ArrayView modes() = 0; 37 | virtual void swap_window() = 0; 38 | virtual void grab(bool) = 0; 39 | virtual void poll_events() = 0; 40 | virtual bool have_controller() = 0; 41 | 42 | bool is_windowed() 43 | { return current_mode().fullscreen == Fullscreen::none; } 44 | }; 45 | 46 | extern IVideo* Video; 47 | } 48 | 49 | #endif //__IMP_VIDEO__38697988 50 | -------------------------------------------------------------------------------- /include/imp/util/Clamped: -------------------------------------------------------------------------------- 1 | // -*- mode: c++ -*- 2 | #ifndef __IMP_CLAMPED__34482255 3 | #define __IMP_CLAMPED__34482255 4 | 5 | #include "Types" 6 | 7 | namespace imp { 8 | template 9 | constexpr T clamp(const T x, const T min, const T max) 10 | { return x > min ? (x < max ? x : max ) : min; } 11 | 12 | template 13 | class Clamped { 14 | T mValue; 15 | T mMin; 16 | T mMax; 17 | 18 | public: 19 | constexpr Clamped(const Clamped&) = default; 20 | 21 | constexpr Clamped(T min, T max): 22 | mValue(min), 23 | mMin(min), 24 | mMax(max) {} 25 | 26 | constexpr Clamped(T value, T min, T max): 27 | mValue(clamp(value, min, max)), 28 | mMin(min), 29 | mMax(max) {} 30 | 31 | constexpr Clamped& operator=(const Clamped& other) 32 | { 33 | mMin = std::max(mMin, other.mMin); 34 | mMax = std::min(mMax, other.mMax); 35 | 36 | if (mMin > mMax) 37 | std::swap(mMin, mMax); 38 | 39 | mValue = clamp(other.mValue, mMin, mMax); 40 | return *this; 41 | } 42 | 43 | template 44 | constexpr Clamped& operator=(const U& other) 45 | { 46 | mValue = clamp(other, mMin, mMax); 47 | return *this; 48 | } 49 | 50 | #define ORD_OP(Op) \ 51 | constexpr Clamped& operator Op##=(T x) \ 52 | { \ 53 | mValue = clamp(mValue Op x, mMin, mMax); \ 54 | return *this; \ 55 | } \ 56 | constexpr Clamped& operator Op##=(Clamped x) \ 57 | { \ 58 | mValue = clamp(mValue Op x.mValue, mMin, mMax); \ 59 | return *this; \ 60 | } \ 61 | template \ 62 | friend constexpr Clamped operator Op(Clamped l, Clamped r); \ 63 | template \ 64 | friend constexpr Clamped operator Op(Clamped l, U r); \ 65 | template \ 66 | friend constexpr Clamped operator Op(U l, Clamped r); 67 | 68 | ORD_OP(+) 69 | ORD_OP(-) 70 | ORD_OP(*) 71 | ORD_OP(/) 72 | #undef ORD_OP 73 | 74 | constexpr const T &value() const 75 | { return mValue; } 76 | 77 | constexpr operator const T &() const 78 | { return mValue; } 79 | }; 80 | } 81 | 82 | #define __IMP_CLAMPED_COMPARISON_OPERATORS(Op) \ 83 | template constexpr bool operator Op(const imp::Clamped &l, const imp::Clamped &r) { return l.value() Op static_cast(r.value()); } \ 84 | template constexpr bool operator Op(const imp::Clamped &l, const U &r) { return l.value() Op static_cast(r); } \ 85 | template constexpr bool operator Op(const T &l, const imp::Clamped &r) { return l Op static_cast(r.value()); } 86 | 87 | __IMP_CLAMPED_COMPARISON_OPERATORS(==) 88 | __IMP_CLAMPED_COMPARISON_OPERATORS(!=) 89 | __IMP_CLAMPED_COMPARISON_OPERATORS(<) 90 | __IMP_CLAMPED_COMPARISON_OPERATORS(>) 91 | __IMP_CLAMPED_COMPARISON_OPERATORS(<=) 92 | __IMP_CLAMPED_COMPARISON_OPERATORS(>=) 93 | 94 | #undef __IMP_CLAMPED_COMPARISON_OPERATORS 95 | 96 | #endif //__IMP_CLAMPED__34482255 97 | -------------------------------------------------------------------------------- /include/imp/util/Convert: -------------------------------------------------------------------------------- 1 | // -*- mode: c++ -*- 2 | #ifndef __IMP_CONVERT__63784703 3 | #define __IMP_CONVERT__63784703 4 | 5 | #include 6 | #include 7 | #include "Types" 8 | #include "StringView" 9 | 10 | namespace imp { 11 | template 12 | T from_string(StringView); 13 | 14 | template <> 15 | inline std::string from_string(StringView str) 16 | { return str.to_string(); } 17 | 18 | template <> 19 | inline int32 from_string(StringView str) 20 | { 21 | return atoi(str.data()); 22 | } 23 | 24 | template <> 25 | inline bool from_string(StringView str) 26 | { return std::atoi(str.data()) > 0; } 27 | 28 | template <> 29 | inline int64 from_string(StringView str) 30 | { return std::atoll(str.data()); } 31 | 32 | template <> 33 | inline float from_string(StringView str) 34 | { return std::strtof(str.data(), nullptr); } 35 | 36 | template <> 37 | inline double from_string(StringView str) 38 | { return std::strtod(str.data(), nullptr); } 39 | } 40 | 41 | #endif //__IMP_CONVERT__63784703 42 | -------------------------------------------------------------------------------- /include/imp/util/Guard: -------------------------------------------------------------------------------- 1 | // -*- mode: c++ -*- 2 | #ifndef __IMP_GUARD__26964644 3 | #define __IMP_GUARD__26964644 4 | 5 | namespace imp { 6 | /** 7 | * \brief A generic RAII guard 8 | * 9 | * \tparam Deleter A Callable type that will be called in {\ref Guard::~Guard} 10 | * 11 | * A generic RAII guard that calls the deleter on the Guard going out of scope 12 | */ 13 | template 14 | class Guard { 15 | bool mExecuted = false; 16 | Deleter mDeleter; 17 | 18 | public: 19 | Guard(Deleter&& deleter): 20 | mDeleter(std::move_if_noexcept(deleter)) {} 21 | 22 | ~Guard() 23 | { 24 | if (!mExecuted) 25 | mDeleter(); 26 | } 27 | 28 | /*! 29 | * Execute the deleter deliberately prior to the Guard object going out of scope 30 | */ 31 | void execute() 32 | { 33 | if (!mExecuted) { 34 | mDeleter(); 35 | mExecuted = true; 36 | } 37 | } 38 | 39 | /*! 40 | * Prevent deleter being executed on destruction 41 | */ 42 | void release() 43 | { mExecuted = true; } 44 | }; 45 | 46 | template 47 | inline Guard make_guard(Deleter&& deleter) 48 | { return { std::forward(deleter) }; } 49 | } 50 | 51 | #endif //__IMP_GUARD__26964644 52 | -------------------------------------------------------------------------------- /include/imp/util/Types: -------------------------------------------------------------------------------- 1 | // -*- mode: c++ -*- 2 | #ifndef __IMP_TYPES__14445451 3 | #define __IMP_TYPES__14445451 4 | 5 | #include 6 | #include 7 | 8 | namespace imp { 9 | // Integers 10 | using byte = std::uint8_t; 11 | 12 | using int8 = std::int8_t; 13 | using int16 = std::int16_t; 14 | using int32 = std::int32_t; 15 | using int64 = std::int64_t; 16 | 17 | using uint8 = std::uint8_t; 18 | using uint16 = std::uint16_t; 19 | using uint32 = std::uint32_t; 20 | using uint64 = std::uint64_t; 21 | 22 | // Standard library aliasing 23 | template 24 | using bool_type = std::integral_constant; 25 | 26 | using nullptr_t = std::nullptr_t; 27 | 28 | using false_type = std::false_type; 29 | 30 | using true_type = std::true_type; 31 | 32 | template 33 | using enable_if = std::enable_if_t; 34 | 35 | // Tags 36 | struct noinit_tag {}; 37 | 38 | // Misc 39 | namespace _detail { 40 | template 41 | struct is_any_same; 42 | 43 | /** When there are no more types to check -> false */ 44 | template 45 | struct is_any_same: false_type {}; 46 | 47 | /** When the first two types are the same -> true */ 48 | template 49 | struct is_any_same : true_type {}; 50 | 51 | /** When the first two types are not the same -> recurse */ 52 | template 53 | struct is_any_same : is_any_same {}; 54 | } 55 | 56 | /** A metafunction to be able to detect the validity of an expression at compile time. See C++17's `std::void_t` */ 57 | template 58 | using void_t = void; 59 | 60 | /** Analogue of std::is_same, but for N types */ 61 | template 62 | constexpr auto is_any_same = _detail::is_any_same::value; 63 | } 64 | 65 | #endif //__IMP_TYPES__14445451 66 | -------------------------------------------------------------------------------- /shot.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Rinnegatamante/Doom64EX/1344ab10f43a6aae374659d9714a0b234a5bd134/shot.png -------------------------------------------------------------------------------- /src/config.hh.in: -------------------------------------------------------------------------------- 1 | #ifndef __CONFIG_HH__51912889 2 | #define __CONFIG_HH__51912889 3 | 4 | #include 5 | 6 | namespace imp { 7 | namespace config { 8 | constexpr auto name = "@PROJECT_NAME@"_sv; 9 | constexpr auto version = "@VERSION@"_sv; 10 | constexpr auto version_git = "@VERSION_GIT@"_sv; 11 | constexpr auto version_full = "@VERSION_FULL@"_sv; 12 | } 13 | } 14 | 15 | #endif //__CONFIG_HH__51912889 16 | -------------------------------------------------------------------------------- /src/engine/Globals.cc: -------------------------------------------------------------------------------- 1 | // Global variables 2 | 3 | namespace imp { 4 | struct IVideo; 5 | IVideo *Video {}; 6 | } 7 | -------------------------------------------------------------------------------- /src/engine/automap/am_draw.h: -------------------------------------------------------------------------------- 1 | // Emacs style mode select -*- C++ -*- 2 | //----------------------------------------------------------------------------- 3 | // 4 | // Copyright(C) 1993-1997 Id Software, Inc. 5 | // Copyright(C) 2007-2012 Samuel Villarreal 6 | // 7 | // This program is free software; you can redistribute it and/or 8 | // modify it under the terms of the GNU General Public License 9 | // as published by the Free Software Foundation; either version 2 10 | // of the License, or (at your option) any later version. 11 | // 12 | // This program is distributed in the hope that it will be useful, 13 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | // GNU General Public License for more details. 16 | // 17 | // You should have received a copy of the GNU General Public License 18 | // along with this program; if not, write to the Free Software 19 | // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 20 | // 02111-1307, USA. 21 | // 22 | //----------------------------------------------------------------------------- 23 | 24 | #ifndef D3DR_AM_H 25 | #define D3DR_AM_H 26 | 27 | void AM_BeginDraw(angle_t view, fixed_t x, fixed_t y); 28 | void AM_EndDraw(void); 29 | void AM_DrawLeafs(float scale); 30 | void AM_DrawLine(int x1, int x2, int y1, int y2, float scale, rcolor c); 31 | void AM_DrawTriangle(mobj_t* mobj, float scale, dboolean solid, byte r, byte g, byte b); 32 | void AM_DrawSprite(mobj_t* thing, float scale); 33 | 34 | #endif -------------------------------------------------------------------------------- /src/engine/automap/am_map.h: -------------------------------------------------------------------------------- 1 | // Emacs style mode select -*- C++ -*- 2 | //----------------------------------------------------------------------------- 3 | // 4 | // Copyright(C) 1993-1997 Id Software, Inc. 5 | // Copyright(C) 2007-2012 Samuel Villarreal 6 | // 7 | // This program is free software; you can redistribute it and/or 8 | // modify it under the terms of the GNU General Public License 9 | // as published by the Free Software Foundation; either version 2 10 | // of the License, or (at your option) any later version. 11 | // 12 | // This program is distributed in the hope that it will be useful, 13 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | // GNU General Public License for more details. 16 | // 17 | // You should have received a copy of the GNU General Public License 18 | // along with this program; if not, write to the Free Software 19 | // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 20 | // 02111-1307, USA. 21 | // 22 | //----------------------------------------------------------------------------- 23 | 24 | #ifndef __AMMAP_H__ 25 | #define __AMMAP_H__ 26 | 27 | #include 28 | 29 | extern BoolProperty am_overlay; 30 | 31 | // Called by main loop. 32 | dboolean 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 | // Called on P_Start; resets automap variables 46 | void AM_Reset(void); 47 | 48 | void AM_RegisterCommands(void); 49 | 50 | #endif 51 | -------------------------------------------------------------------------------- /src/engine/common/Property.cc: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | 5 | namespace { 6 | struct PropertyLess { 7 | bool operator()(StringView a, StringView b) const 8 | { return a.icompare(b) < 0; } 9 | }; 10 | 11 | auto& _global() 12 | { 13 | static struct { 14 | // TODO: Write a radix tree for this 15 | std::map properties; 16 | std::vector new_properties; 17 | } global {}; 18 | return global; 19 | } 20 | } 21 | 22 | Property::Property(StringView name, StringView description, int flags): 23 | mName(name), 24 | mDescription(description), 25 | mFlags(flags) 26 | { 27 | if (_global().properties.count(name)) { 28 | // TODO: Replace with an exception 29 | println("Property with the name {} already exists!", name); 30 | } 31 | 32 | _global().properties.emplace(name, this); 33 | _global().new_properties.emplace_back(this); 34 | } 35 | 36 | Property::~Property() 37 | { 38 | _global().properties.erase(mName); 39 | } 40 | 41 | void Property::update() 42 | { 43 | if (is_network()) { 44 | STUB("Update networked property"); 45 | } 46 | } 47 | 48 | std::vector Property::all() 49 | { 50 | std::vector v; 51 | v.reserve(_global().properties.size()); 52 | for (auto& p : _global().properties) { 53 | assert(p.second != nullptr); 54 | v.emplace_back(p.second); 55 | } 56 | return v; 57 | } 58 | 59 | Optional Property::find(StringView name) 60 | { 61 | auto it = _global().properties.find(name); 62 | return it != _global().properties.end() ? it->second : nullptr; 63 | } 64 | 65 | Vector Property::partial(StringView prefix) 66 | { 67 | // Search will be optimised when radix tree gets implemented. 68 | Vector list; 69 | 70 | if (prefix.empty()) 71 | return list; 72 | 73 | auto lower = prefix.trim().to_string(); 74 | std::transform(lower.begin(), lower.end(), lower.begin(), ::tolower); 75 | bool found = false; 76 | for (auto it : _global().properties) { 77 | if (lower.length() > it.first.length()) 78 | continue; 79 | 80 | if (lower == it.first.substr(lower.length())) { 81 | list.emplace_back(it.second); 82 | found = true; 83 | } else if (found) { 84 | // std::map has sorted keys. If we've found some but stopped finding more, 85 | // it means we've gone too far. 86 | break; 87 | } 88 | } 89 | 90 | return list; 91 | } 92 | -------------------------------------------------------------------------------- /src/engine/common/defconfig.inc: -------------------------------------------------------------------------------- 1 | "unbindall\n" 2 | "bind Shift \"+run\"\n" 3 | "bind 1 \"weapon 2\"\n" 4 | "bind 2 \"weapon 3\"\n" 5 | "bind 3 \"weapon 4\"\n" 6 | "bind 4 \"weapon 6\"\n" 7 | "bind 5 \"weapon 7\"\n" 8 | "bind 6 \"weapon 8\"\n" 9 | "bind 7 \"weapon 9\"\n" 10 | "bind 8 \"weapon 10\"\n" 11 | "bind 9 \"weapon 1\"\n" 12 | "bind 0 \"weapon 5\"\n" 13 | "bind A \"+strafeleft\"\n" 14 | "bind S \"+back\"\n" 15 | "bind E \"+use\"\n" 16 | "bind W \"+forward\"\n" 17 | "bind D \"+straferight\"\n" 18 | "bind Ctrl \"+fire\"\n" 19 | "bind Left \"+left\"\n" 20 | "bind Right \"+right\"\n" 21 | "bind Caps \"autorun\"\n" 22 | "bind mouse1 \"+fire\"\n" 23 | "bind mouse2 \"+jump\"\n" 24 | "bind MouseWheelUp \"nextweap\"\n" 25 | "bind MouseWheelDown \"prevweap\"\n" 26 | "bind KeyPad+ \"+automap_in\"\n" 27 | "bind KeyPad- \"+automap_out\"\n" 28 | "bind Tab \"automap\"\n" 29 | "bind - \"+automap_out\"\n" 30 | "bind + \"+automap_in\"\n" 31 | "bind Q \"+automap_freepan\"\n" 32 | "bind F \"automap_follow\"\n" 33 | -------------------------------------------------------------------------------- /src/engine/common/doomtype.h: -------------------------------------------------------------------------------- 1 | // Emacs style mode select -*- C++ -*- 2 | //----------------------------------------------------------------------------- 3 | // 4 | // Copyright(C) 1993-1997 Id Software, Inc. 5 | // Copyright(C) 2007-2012 Samuel Villarreal 6 | // 7 | // This program is free software; you can redistribute it and/or 8 | // modify it under the terms of the GNU General Public License 9 | // as published by the Free Software Foundation; either version 2 10 | // of the License, or (at your option) any later version. 11 | // 12 | // This program is distributed in the hope that it will be useful, 13 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | // GNU General Public License for more details. 16 | // 17 | // You should have received a copy of the GNU General Public License 18 | // along with this program; if not, write to the Free Software 19 | // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 20 | // 02111-1307, USA. 21 | // 22 | //----------------------------------------------------------------------------- 23 | 24 | 25 | #ifndef __DOOMTYPE__ 26 | #define __DOOMTYPE__ 27 | 28 | #include 29 | 30 | #ifdef _WIN32 31 | #include "SDL_config.h" 32 | #endif 33 | 34 | typedef bool dboolean; 35 | typedef unsigned short word; // TODO: Rename every instance of 'word' to 'uint16'. 36 | // 'Word' isn't the correct term unless you're writing for 16-bit systems, which we're not. 37 | typedef unsigned int dword; // TODO: ditto, but 'dword' -> 'uint32' 38 | 39 | #include 40 | #define D_MININT INT_MIN 41 | #define D_MAXINT INT_MAX 42 | #endif 43 | 44 | #ifndef MAX 45 | #define MAX(a,b) ((a)>(b)?(a):(b)) 46 | #endif 47 | 48 | #ifndef MIN 49 | #define MIN(a,b) ((a)<(b)?(a):(b)) 50 | #endif 51 | 52 | #ifndef BETWEEN 53 | #define BETWEEN(l,u,x) ((l)>(x)?(l):(x)>(u)?(u):(x)) 54 | #endif 55 | 56 | #ifdef _WIN32 57 | 58 | #define DIR_SEPARATOR '\\' 59 | #define PATH_SEPARATOR ';' 60 | 61 | #else 62 | 63 | #define DIR_SEPARATOR '/' 64 | #define PATH_SEPARATOR ':' 65 | 66 | #endif 67 | 68 | 69 | -------------------------------------------------------------------------------- /src/engine/common/md5.h: -------------------------------------------------------------------------------- 1 | /* 2 | * This is the header file for the MD5 message-digest algorithm. 3 | * The algorithm is due to Ron Rivest. This code was 4 | * written by Colin Plumb in 1993, no copyright is claimed. 5 | * This code is in the public domain; do with it what you wish. 6 | * 7 | * Equivalent code is available from RSA Data Security, Inc. 8 | * This code has been tested against that, and is equivalent, 9 | * except that you don't need to include two pages of legalese 10 | * with every copy. 11 | * 12 | * To compute the message digest of a chunk of bytes, declare an 13 | * md5_context_s structure, pass it to MD5_Init, call MD5_Update as 14 | * needed on buffers full of bytes, and then call MD5_Final, which 15 | * will fill a supplied 16-byte array with the digest. 16 | * 17 | * Changed so as no longer to depend on Colin Plumb's `usual.h' 18 | * header definitions; now uses stuff from dpkg's config.h 19 | * - Ian Jackson . 20 | * Still in the public domain. 21 | */ 22 | 23 | #ifndef MD5_H 24 | #define MD5_H 25 | 26 | #include "doomtype.h" 27 | //#ifdef _WIN32 28 | #include "SDL_config.h" 29 | //#endif 30 | #ifdef HAVE_STDINT_H 31 | #include 32 | #endif 33 | 34 | typedef struct md5_context_s md5_context_t; 35 | typedef byte md5_digest_t[16]; 36 | 37 | struct md5_context_s { 38 | uint32_t buf[4]; 39 | uint32_t bytes[2]; 40 | uint32_t in[16]; 41 | }; 42 | 43 | void MD5_Init(md5_context_t *context); 44 | void MD5_Update(md5_context_t *context, byte const *buf, unsigned len); 45 | void MD5_UpdateInt32(md5_context_t *context, unsigned int val); 46 | void MD5_UpdateString(md5_context_t *context, char *str); 47 | void MD5_Final(unsigned char digest[16], md5_context_t *context); 48 | void MD5_Transform(uint32_t buf[4], uint32_t const in[16]); 49 | 50 | #endif /* !MD5_H */ 51 | 52 | -------------------------------------------------------------------------------- /src/engine/common/psnprntf.h: -------------------------------------------------------------------------------- 1 | #ifndef PSNPRINTF_H 2 | #define PSNPRINTF_H 3 | 4 | int psnprintf(char *str, size_t n, const char *format, ...); 5 | int pvsnprintf(char *str, size_t n, const char *format, va_list ap); 6 | 7 | /* haleyjd 08/01/09: rewritten to use a structure */ 8 | typedef struct psvnfmt_vars_s { 9 | char *pinsertion; 10 | size_t nmax; 11 | const char *fmt; 12 | int flags; 13 | int width; 14 | int precision; 15 | char prefix; 16 | } pvsnfmt_vars; 17 | 18 | /* Use these directly if you want to avoid overhead of psnprintf 19 | * Return value is number of characters printed (or number printed 20 | * if there had been enough room). 21 | */ 22 | int pvsnfmt_char(pvsnfmt_vars *info, char c); 23 | 24 | typedef union pvsnfmt_intparm_u { 25 | int i; 26 | void *p; 27 | } pvsnfmt_intparm_t; 28 | 29 | int pvsnfmt_int(pvsnfmt_vars *info, pvsnfmt_intparm_t *ip); 30 | 31 | int pvsnfmt_str(pvsnfmt_vars *info, const char *s); 32 | 33 | int pvsnfmt_double(pvsnfmt_vars *info, double d); 34 | 35 | /* These are the flags you need (use logical OR) for the flags parameter of 36 | * fmt functions above. 37 | */ 38 | #define FLAG_DEFAULT 0x00 39 | #define FLAG_LEFT_ALIGN 0x01 // - 40 | #define FLAG_SIGNED 0x02 // + 41 | #define FLAG_ZERO_PAD 0x04 // 0 42 | #define FLAG_SIGN_PAD 0x08 // ' ' 43 | #define FLAG_HASH 0x10 // # 44 | 45 | /* Portable strnlen function (doesn't exist on all systems!) */ 46 | size_t pstrnlen(const char *s, size_t count); 47 | 48 | 49 | #endif /* ifdef PSNPRINTF_H */ 50 | 51 | 52 | -------------------------------------------------------------------------------- /src/engine/common/tables.h: -------------------------------------------------------------------------------- 1 | // Emacs style mode select -*- C++ -*- 2 | //----------------------------------------------------------------------------- 3 | // 4 | // Copyright(C) 1993-1997 Id Software, Inc. 5 | // Copyright(C) 2007-2012 Samuel Villarreal 6 | // 7 | // This program is free software; you can redistribute it and/or 8 | // modify it under the terms of the GNU General Public License 9 | // as published by the Free Software Foundation; either version 2 10 | // of the License, or (at your option) any later version. 11 | // 12 | // This program is distributed in the hope that it will be useful, 13 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | // GNU General Public License for more details. 16 | // 17 | // You should have received a copy of the GNU General Public License 18 | // along with this program; if not, write to the Free Software 19 | // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 20 | // 02111-1307, USA. 21 | // 22 | //----------------------------------------------------------------------------- 23 | 24 | 25 | #ifndef __TABLES__ 26 | #define __TABLES__ 27 | 28 | #include "m_fixed.h" 29 | 30 | #ifdef M_PI 31 | #undef M_PI 32 | #endif 33 | 34 | #define M_PI 3.14159265358979323846 35 | 36 | #define FINEANGLES 8192 37 | #define FINEMASK (FINEANGLES-1) 38 | 39 | 40 | // 0x100000000 to 0x2000 41 | #define ANGLETOFINESHIFT 19 42 | 43 | // Binary Angle Measument, BAM. 44 | #define ANG45 0x20000000U 45 | #define ANG90 0x40000000U 46 | #define ANG180 0x80000000U 47 | #define ANG270 0xc0000000U 48 | #define ANG1 (ANG45/45) 49 | #define ANG5 (ANG90/18) 50 | #define ANGLE_MAX (0xffffffffU) 51 | 52 | 53 | #define SLOPERANGE 2048 54 | #define SLOPEBITS 11 55 | #define DBITS (FRACBITS-SLOPEBITS) 56 | 57 | #define TRUEANGLES(x) (((x) >> ANGLETOFINESHIFT) * 360.0f / FINEANGLES) 58 | 59 | typedef unsigned angle_t; 60 | 61 | // Effective size is 10240. 62 | extern fixed_t finesine[5*FINEANGLES/4]; 63 | 64 | // Re-use data, is just PI/2 pahse shift. 65 | extern fixed_t* finecosine; 66 | 67 | // Effective size is 2049; 68 | // The +1 size is to handle the case when x==y 69 | // without additional checking. 70 | extern angle_t tantoangle[SLOPERANGE+1]; 71 | 72 | 73 | // Utility function, 74 | // called by R_PointToAngle. 75 | int 76 | SlopeDiv 77 | (unsigned num, 78 | unsigned den); 79 | 80 | 81 | #endif 82 | -------------------------------------------------------------------------------- /src/engine/console/con_console.h: -------------------------------------------------------------------------------- 1 | // Emacs style mode select -*- C++ -*- 2 | //----------------------------------------------------------------------------- 3 | // 4 | // Copyright(C) 1999-2000 Paul Brook 5 | // Copyright(C) 2007-2012 Samuel Villarreal 6 | // 7 | // This program is free software; you can redistribute it and/or 8 | // modify it under the terms of the GNU General Public License 9 | // as published by the Free Software Foundation; either version 2 10 | // of the License, or (at your option) any later version. 11 | // 12 | // This program is distributed in the hope that it will be useful, 13 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | // GNU General Public License for more details. 16 | // 17 | // You should have received a copy of the GNU General Public License 18 | // along with this program; if not, write to the Free Software 19 | // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 20 | // 02111-1307, USA. 21 | // 22 | //----------------------------------------------------------------------------- 23 | 24 | #ifndef CON_CONSOLE_H 25 | #define CON_CONSOLE_H 26 | 27 | #include "d_event.h" 28 | #include "gl_main.h" 29 | 30 | #define MAX_CONSOLE_INPUT_LEN 80 31 | extern char console_inputbuffer[]; 32 | extern int console_inputlength; 33 | extern dboolean console_initialized; 34 | 35 | #define CONCLEARINPUT() (dmemset(console_inputbuffer+1, 0, MAX_CONSOLE_INPUT_LEN-1)) 36 | 37 | void CON_Init(void); 38 | void CON_AddText(const char *text); 39 | void CON_Printf(rcolor clr, const char *s, ...); 40 | void CON_Warnf(const char *s, ...); 41 | void CON_DPrintf(const char *s, ...); 42 | void CON_Draw(void); 43 | void CON_AddLine(const char *line, int len); 44 | void CON_Ticker(void); 45 | void CON_ToggleConsole(void); 46 | 47 | dboolean CON_Responder(event_t* ev); 48 | 49 | #endif 50 | -------------------------------------------------------------------------------- /src/engine/doom_main/d_devstat.h: -------------------------------------------------------------------------------- 1 | // Emacs style mode select -*- C++ -*- 2 | //----------------------------------------------------------------------------- 3 | // 4 | // Copyright(C) 2007-2012 Samuel Villarreal 5 | // 6 | // This program is free software; you can redistribute it and/or 7 | // modify it under the terms of the GNU General Public License 8 | // as published by the Free Software Foundation; either version 2 9 | // of the License, or (at your option) any later version. 10 | // 11 | // This program is distributed in the hope that it will be useful, 12 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | // GNU General Public License for more details. 15 | // 16 | // You should have received a copy of the GNU General Public License 17 | // along with this program; if not, write to the Free Software 18 | // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 19 | // 02111-1307, USA. 20 | // 21 | //----------------------------------------------------------------------------- 22 | 23 | #ifndef __D_DEVSTAT_H 24 | #define __D_DEVSTAT_H 25 | 26 | void D_DeveloperDisplay(void); 27 | void D_BoyISuck(void); 28 | dboolean D_DevKeyResponder(event_t* ev); 29 | 30 | #endif -------------------------------------------------------------------------------- /src/engine/doom_main/d_event.h: -------------------------------------------------------------------------------- 1 | // Emacs style mode select -*- C++ -*- 2 | //----------------------------------------------------------------------------- 3 | // 4 | // Copyright(C) 1993-1997 Id Software, Inc. 5 | // Copyright(C) 2007-2012 Samuel Villarreal 6 | // 7 | // This program is free software; you can redistribute it and/or 8 | // modify it under the terms of the GNU General Public License 9 | // as published by the Free Software Foundation; either version 2 10 | // of the License, or (at your option) any later version. 11 | // 12 | // This program is distributed in the hope that it will be useful, 13 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | // GNU General Public License for more details. 16 | // 17 | // You should have received a copy of the GNU General Public License 18 | // along with this program; if not, write to the Free Software 19 | // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 20 | // 02111-1307, USA. 21 | // 22 | //----------------------------------------------------------------------------- 23 | 24 | 25 | #ifndef __D_EVENT__ 26 | #define __D_EVENT__ 27 | 28 | 29 | #include "doomtype.h" 30 | 31 | 32 | // 33 | // Event handling. 34 | // 35 | 36 | // Input event types. 37 | typedef enum { 38 | ev_keydown, 39 | ev_keyup, 40 | ev_mouse, 41 | ev_mousedown, 42 | ev_mouseup, 43 | ev_gamepad 44 | } evtype_t; 45 | 46 | // Event structure. 47 | typedef struct { 48 | evtype_t type; 49 | int data1; // keys / mouse/joystick buttons 50 | int data2; // mouse/joystick x move 51 | int data3; // mouse/joystick y move 52 | int data4; // misc data 53 | } event_t; 54 | 55 | typedef int gameaction_t; 56 | enum { 57 | ga_nothing, 58 | ga_loadlevel, 59 | ga_newgame, 60 | ga_loadgame, 61 | ga_exitdemo, 62 | ga_completed, 63 | ga_victory, 64 | ga_finale, 65 | ga_screenshot, 66 | ga_warplevel, 67 | ga_warpquick, 68 | ga_title 69 | }; 70 | 71 | 72 | // 73 | // Button/action code definitions. 74 | // 75 | typedef enum { 76 | // Press "Fire". 77 | BT_ATTACK = 1, 78 | // Use button, to open doors, activate switches. 79 | BT_USE = 2, 80 | 81 | // Flag: game events, not really buttons. 82 | BT_SPECIAL = 0x80, 83 | BT_SPECIALMASK = 3, 84 | 85 | // Flag, weapon change pending. 86 | // If true, the next 3 bits hold weapon num. 87 | BT_CHANGE = 4, 88 | // The 3bit weapon mask and shift, convenience. 89 | BT_WEAPONMASK = 0x78, 90 | BT_WEAPONSHIFT = 3, 91 | 92 | // Pause the game. 93 | BTS_PAUSE = 1, 94 | // Save the game at each console. 95 | BTS_SAVEGAME = 2, 96 | 97 | // Savegame slot numbers 98 | // occupy the second byte of buttons. 99 | BTS_SAVEMASK = (4+8+16), 100 | BTS_SAVESHIFT = 2, 101 | } buttoncode_t; 102 | 103 | typedef enum { 104 | BT2_JUMP = 1, 105 | BT2_NEXTWEAP = 2, 106 | BT2_PREVWEAP = 4, 107 | BT2_CENTER = 8 108 | } buttoncode2_t; 109 | 110 | 111 | 112 | 113 | // 114 | // GLOBAL VARIABLES 115 | // 116 | 117 | #define MAXEVENTS 64 118 | 119 | extern event_t events[MAXEVENTS]; 120 | extern int eventhead; 121 | extern int eventtail; 122 | 123 | extern gameaction_t gameaction; 124 | 125 | #endif 126 | -------------------------------------------------------------------------------- /src/engine/doom_main/d_keywds.h: -------------------------------------------------------------------------------- 1 | // Emacs style mode select -*- C++ -*- 2 | //----------------------------------------------------------------------------- 3 | // 4 | // Copyright(C) 2005 James Haley 5 | // 6 | // This program is free software; you can redistribute it and/or modify 7 | // it under the terms of the GNU General Public License as published by 8 | // the Free Software Foundation; either version 2 of the License, or 9 | // (at your option) any later version. 10 | // 11 | // This program is distributed in the hope that it will be useful, 12 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | // GNU General Public License for more details. 15 | // 16 | // You should have received a copy of the GNU General Public License 17 | // along with this program; if not, write to the Free Software 18 | // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 19 | // 20 | //-------------------------------------------------------------------------- 21 | // 22 | // DESCRIPTION: 23 | // Macros to resolve compiler-dependent keywords and language 24 | // extensions. 25 | // 26 | //----------------------------------------------------------------------------- 27 | 28 | #ifndef D_KEYWDS_H__ 29 | #define D_KEYWDS_H__ 30 | 31 | // attribute hints are available only under GNU C 32 | 33 | #ifndef __GNUC__ 34 | #define __attribute__(x) 35 | #endif 36 | 37 | // function inlining is available on most platforms, however, 38 | // the GNU C __inline__ is too common and conflicts with a 39 | // definition in SDL, so it needs to be factored out into a 40 | // custom macro definition 41 | 42 | #define d_inline inline 43 | 44 | // 45 | // Non-standard function availability defines 46 | // 47 | // These control the presence of custom code for some common 48 | // non-ANSI libc functions that are in m_misc.c -- in some cases 49 | // its not worth having the code when its already available in 50 | // the platform's libc 51 | // 52 | 53 | // HAVE_ITOA -- define this if your platform has ITOA 54 | // ITOA_NAME -- name of your platform's itoa function 55 | // #define HAVE_ITOA 56 | // #define ITOA_NAME itoa 57 | 58 | // known platforms with itoa -- you can add yours here, but it 59 | // isn't absolutely necessary 60 | #ifndef HAVE_ITOA 61 | #ifdef DJGPP 62 | #define HAVE_ITOA 63 | #define ITOA_NAME itoa 64 | #endif 65 | #ifdef _MSC_VER 66 | //#define HAVE_ITOA 67 | #define ITOA_NAME _itoa 68 | #endif 69 | #endif 70 | 71 | #endif // D_KEYWDS_H__ 72 | 73 | // EOF 74 | -------------------------------------------------------------------------------- /src/engine/doom_main/d_main.h: -------------------------------------------------------------------------------- 1 | // Emacs style mode select -*- C++ -*- 2 | //----------------------------------------------------------------------------- 3 | // 4 | // Copyright(C) 1993-1997 Id Software, Inc. 5 | // Copyright(C) 1997 Midway Home Entertainment, Inc 6 | // Copyright(C) 2007-2012 Samuel Villarreal 7 | // 8 | // This program is free software; you can redistribute it and/or 9 | // modify it under the terms of the GNU General Public License 10 | // as published by the Free Software Foundation; either version 2 11 | // of the License, or (at your option) any later version. 12 | // 13 | // This program is distributed in the hope that it will be useful, 14 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | // GNU General Public License for more details. 17 | // 18 | // You should have received a copy of the GNU General Public License 19 | // along with this program; if not, write to the Free Software 20 | // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 21 | // 02111-1307, USA. 22 | // 23 | //----------------------------------------------------------------------------- 24 | 25 | 26 | #ifndef __D_MAIN__ 27 | #define __D_MAIN__ 28 | 29 | #include "d_event.h" 30 | 31 | #ifdef __GNUG__ 32 | #pragma interface 33 | #endif 34 | 35 | // 36 | // D_DoomMain() 37 | // Not a globally visible function, just included for source reference, 38 | // calls all startup code, parses command line options. 39 | // If not overrided by user input, calls N_AdvanceDemo. 40 | // 41 | [[noreturn]] 42 | void D_DoomMain(void); 43 | 44 | int D_MiniLoop(void (*start)(void), void (*stop)(void), 45 | void (*draw)(void), dboolean(*tick)(void)); 46 | 47 | // Called by IO functions when input is detected. 48 | void D_PostEvent(event_t* ev); 49 | 50 | 51 | // 52 | // BASE LEVEL 53 | // 54 | 55 | void D_IncValidCount(void); 56 | 57 | extern dboolean BusyDisk; 58 | 59 | #endif 60 | -------------------------------------------------------------------------------- /src/engine/doom_main/d_net.h: -------------------------------------------------------------------------------- 1 | // Emacs style mode select -*- C++ -*- 2 | //----------------------------------------------------------------------------- 3 | // 4 | // Copyright(C) 1993-1997 Id Software, Inc. 5 | // Copyright(C) 2005 Simon Howard 6 | // Copyright(C) 2007-2012 Samuel Villarreal 7 | // 8 | // This program is free software; you can redistribute it and/or 9 | // modify it under the terms of the GNU General Public License 10 | // as published by the Free Software Foundation; either version 2 11 | // of the License, or (at your option) any later version. 12 | // 13 | // This program is distributed in the hope that it will be useful, 14 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | // GNU General Public License for more details. 17 | // 18 | // You should have received a copy of the GNU General Public License 19 | // along with this program; if not, write to the Free Software 20 | // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 21 | // 02111-1307, USA. 22 | // 23 | //----------------------------------------------------------------------------- 24 | 25 | #ifndef __D_NET__ 26 | #define __D_NET__ 27 | 28 | #include "d_player.h" 29 | 30 | #include "net_client.h" 31 | #include "net_io.h" 32 | #include "net_query.h" 33 | #include "net_server.h" 34 | #include "net_sdl.h" 35 | #include "net_loop.h" 36 | 37 | #ifdef __GNUG__ 38 | #pragma interface 39 | #endif 40 | 41 | #define MAXNETNODES 8 // Max computers/players in a game. 42 | #define BACKUPTICS 128 // Networking and tick handling related. 43 | 44 | 45 | // Create any new ticcmds and broadcast to other players. 46 | void NetUpdate(void); 47 | 48 | // Broadcasts special packets to other players 49 | // to notify of game exit 50 | void D_QuitNetGame(void); 51 | 52 | extern dboolean ShowGun; 53 | extern dboolean drone; 54 | extern dboolean net_cl_new_sync; 55 | 56 | #endif 57 | 58 | -------------------------------------------------------------------------------- /src/engine/doom_main/d_think.h: -------------------------------------------------------------------------------- 1 | // Emacs style mode select -*- C++ -*- 2 | //----------------------------------------------------------------------------- 3 | // 4 | // Copyright(C) 1993-1997 Id Software, Inc. 5 | // Copyright(C) 2007-2012 Samuel Villarreal 6 | // 7 | // This program is free software; you can redistribute it and/or 8 | // modify it under the terms of the GNU General Public License 9 | // as published by the Free Software Foundation; either version 2 10 | // of the License, or (at your option) any later version. 11 | // 12 | // This program is distributed in the hope that it will be useful, 13 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | // GNU General Public License for more details. 16 | // 17 | // You should have received a copy of the GNU General Public License 18 | // along with this program; if not, write to the Free Software 19 | // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 20 | // 02111-1307, USA. 21 | // 22 | //----------------------------------------------------------------------------- 23 | 24 | #ifndef __D_THINK__ 25 | #define __D_THINK__ 26 | 27 | 28 | #ifdef __GNUG__ 29 | #pragma interface 30 | #endif 31 | 32 | // 33 | // Experimental stuff. 34 | // To compile this as "ANSI C with classes" 35 | // we will need to handle the various 36 | // action functions cleanly. 37 | // 38 | typedef void(*actionf_v)(void); 39 | typedef void(*actionf_p1)(void*); 40 | typedef void(*actionf_p2)(void*, void*); 41 | 42 | union actionf_t { 43 | actionf_p1 acp1; 44 | actionf_v acv; 45 | actionf_p2 acp2; 46 | 47 | actionf_t(); 48 | 49 | actionf_t(decltype(nullptr)); 50 | 51 | actionf_t(actionf_p1 f); 52 | 53 | actionf_t(actionf_v f); 54 | 55 | actionf_t(actionf_p2 f); 56 | }; 57 | 58 | // Historically, "think_t" is yet another 59 | // function pointaer to a routine to handle 60 | // an actor. 61 | typedef actionf_t think_t; 62 | 63 | 64 | // Doubly linked list of actors. 65 | typedef struct thinker_s { 66 | struct thinker_s* prev; 67 | struct thinker_s* next; 68 | think_t function; 69 | 70 | } thinker_t; 71 | 72 | #endif 73 | -------------------------------------------------------------------------------- /src/engine/doom_main/d_ticcmd.h: -------------------------------------------------------------------------------- 1 | // Emacs style mode select -*- C++ -*- 2 | //----------------------------------------------------------------------------- 3 | // 4 | // Copyright(C) 1993-1997 Id Software, Inc. 5 | // Copyright(C) 2007-2012 Samuel Villarreal 6 | // 7 | // This program is free software; you can redistribute it and/or 8 | // modify it under the terms of the GNU General Public License 9 | // as published by the Free Software Foundation; either version 2 10 | // of the License, or (at your option) any later version. 11 | // 12 | // This program is distributed in the hope that it will be useful, 13 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | // GNU General Public License for more details. 16 | // 17 | // You should have received a copy of the GNU General Public License 18 | // along with this program; if not, write to the Free Software 19 | // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 20 | // 02111-1307, USA. 21 | // 22 | //----------------------------------------------------------------------------- 23 | 24 | #ifndef __D_TICCMD__ 25 | #define __D_TICCMD__ 26 | 27 | #include "doomtype.h" 28 | 29 | #ifdef __GNUG__ 30 | #pragma interface 31 | #endif 32 | 33 | // The data sampled per tick (single player) 34 | // and transmitted to other peers (multiplayer). 35 | // Mainly movements/button commands per game tick, 36 | // plus a checksum for internal state consistency. 37 | typedef struct { 38 | char forwardmove; // *2048 for move 39 | char sidemove; // *2048 for move 40 | short angleturn; // <<16 for angle delta 41 | short pitch; 42 | byte consistency; // checks for net game 43 | byte chatchar; 44 | byte buttons; 45 | byte buttons2; 46 | } ticcmd_t; 47 | 48 | #endif 49 | -------------------------------------------------------------------------------- /src/engine/finale/f_finale.h: -------------------------------------------------------------------------------- 1 | // Emacs style mode select -*- C++ -*- 2 | //----------------------------------------------------------------------------- 3 | // 4 | // Copyright(C) 1993-1997 Id Software, Inc. 5 | // Copyright(C) 2007-2012 Samuel Villarreal 6 | // 7 | // This program is free software; you can redistribute it and/or 8 | // modify it under the terms of the GNU General Public License 9 | // as published by the Free Software Foundation; either version 2 10 | // of the License, or (at your option) any later version. 11 | // 12 | // This program is distributed in the hope that it will be useful, 13 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | // GNU General Public License for more details. 16 | // 17 | // You should have received a copy of the GNU General Public License 18 | // along with this program; if not, write to the Free Software 19 | // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 20 | // 02111-1307, USA. 21 | // 22 | //----------------------------------------------------------------------------- 23 | 24 | 25 | #ifndef __F_FINALE__ 26 | #define __F_FINALE__ 27 | 28 | 29 | #include "doomtype.h" 30 | #include "d_event.h" 31 | // 32 | // FINALE 33 | // 34 | 35 | void F_Start(void); 36 | void F_Stop(void); 37 | bool F_Ticker(void); // Called by main loop. 38 | void F_Drawer(void); 39 | 40 | void IN_Start(void); 41 | void IN_Stop(void); 42 | void IN_Drawer(void); 43 | bool IN_Ticker(void); 44 | 45 | 46 | 47 | #endif 48 | -------------------------------------------------------------------------------- /src/engine/fmt/ostream.cc: -------------------------------------------------------------------------------- 1 | /* 2 | Formatting library for C++ - std::ostream support 3 | 4 | Copyright (c) 2012 - 2016, Victor Zverovich 5 | All rights reserved. 6 | 7 | Redistribution and use in source and binary forms, with or without 8 | modification, are permitted provided that the following conditions are met: 9 | 10 | 1. Redistributions of source code must retain the above copyright notice, this 11 | list of conditions and the following disclaimer. 12 | 2. Redistributions in binary form must reproduce the above copyright notice, 13 | this list of conditions and the following disclaimer in the documentation 14 | and/or other materials provided with the distribution. 15 | 16 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 17 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 18 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 19 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR 20 | ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 21 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 22 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 23 | ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 24 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 25 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 26 | */ 27 | 28 | #include "ostream.h" 29 | 30 | namespace fmt { 31 | 32 | namespace { 33 | // Write the content of w to os. 34 | void write(std::ostream &os, Writer &w) { 35 | const char *data = w.data(); 36 | typedef internal::MakeUnsigned::Type UnsignedStreamSize; 37 | UnsignedStreamSize size = w.size(); 38 | UnsignedStreamSize max_size = 39 | internal::to_unsigned((std::numeric_limits::max)()); 40 | do { 41 | UnsignedStreamSize n = size <= max_size ? size : max_size; 42 | os.write(data, static_cast(n)); 43 | data += n; 44 | size -= n; 45 | } while (size != 0); 46 | } 47 | } 48 | 49 | FMT_FUNC void print(std::ostream &os, CStringRef format_str, ArgList args) { 50 | MemoryWriter w; 51 | w.write(format_str, args); 52 | write(os, w); 53 | } 54 | 55 | FMT_FUNC int fprintf(std::ostream &os, CStringRef format, ArgList args) { 56 | MemoryWriter w; 57 | printf(w, format, args); 58 | write(os, w); 59 | return static_cast(w.size()); 60 | } 61 | } // namespace fmt 62 | -------------------------------------------------------------------------------- /src/engine/game/g_actions.h: -------------------------------------------------------------------------------- 1 | // Emacs style mode select -*- C++ -*- 2 | //----------------------------------------------------------------------------- 3 | // 4 | // Copyright(C) 1999-2000 Paul Brook 5 | // Copyright(C) 2007-2012 Samuel Villarreal 6 | // 7 | // This program is free software; you can redistribute it and/or 8 | // modify it under the terms of the GNU General Public License 9 | // as published by the Free Software Foundation; either version 2 10 | // of the License, or (at your option) any later version. 11 | // 12 | // This program is distributed in the hope that it will be useful, 13 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | // GNU General Public License for more details. 16 | // 17 | // You should have received a copy of the GNU General Public License 18 | // along with this program; if not, write to the Free Software 19 | // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 20 | // 02111-1307, USA. 21 | // 22 | //----------------------------------------------------------------------------- 23 | 24 | #ifndef G_ACTIONS_H 25 | #define G_ACTIONS_H 26 | 27 | #define MAX_ACTIONPARAM 2 28 | 29 | typedef void (*actionproc_t)(int64 data, char **param); 30 | 31 | #define CMD(name) void CMD_ ## name(int64 data, char** param) 32 | 33 | void G_InitActions(void); 34 | dboolean G_ActionResponder(event_t *ev); 35 | void G_AddCommand(const char *name, actionproc_t proc, int64 data); 36 | void G_ActionTicker(void); 37 | void G_ExecuteCommand(char *action); 38 | void G_BindActionByName(char *key, char *action); 39 | dboolean G_BindActionByEvent(event_t *ev, char *action); 40 | void G_ShowBinding(char *key); 41 | void G_GetActionBindings(char *buff, const char *action); 42 | void G_UnbindAction(const char *action); 43 | int G_ListCommands(void); 44 | void G_OutputBindings(FILE *fh); 45 | void G_DoCmdMouseMove(int x, int y); 46 | void G_DoCmdGamepadMove(event_t *ev); 47 | 48 | extern dboolean ButtonAction; 49 | 50 | #endif 51 | -------------------------------------------------------------------------------- /src/engine/game/g_controls.h: -------------------------------------------------------------------------------- 1 | // Emacs style mode select -*- C++ -*- 2 | //----------------------------------------------------------------------------- 3 | // 4 | // Copyright(C) 1999-2000 Paul Brook 5 | // Copyright(C) 2007-2012 Samuel Villarreal 6 | // 7 | // This program is free software; you can redistribute it and/or 8 | // modify it under the terms of the GNU General Public License 9 | // as published by the Free Software Foundation; either version 2 10 | // of the License, or (at your option) any later version. 11 | // 12 | // This program is distributed in the hope that it will be useful, 13 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | // GNU General Public License for more details. 16 | // 17 | // You should have received a copy of the GNU General Public License 18 | // along with this program; if not, write to the Free Software 19 | // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 20 | // 02111-1307, USA. 21 | // 22 | //----------------------------------------------------------------------------- 23 | 24 | #ifndef G_CONTROLS_H 25 | #define G_CONTROLS_H 26 | 27 | #include "doomdef.h" 28 | 29 | // villsa 01052014 - changed to 420 30 | #define NUMKEYS 420 31 | 32 | #define PCKF_DOUBLEUSE 0x4000 33 | #define PCKF_UP 0x8000 34 | #define PCKF_COUNTMASK 0x00ff 35 | 36 | typedef enum { 37 | PCKEY_ATTACK, 38 | PCKEY_USE, 39 | PCKEY_STRAFE, 40 | PCKEY_FORWARD, 41 | PCKEY_BACK, 42 | PCKEY_LEFT, 43 | PCKEY_RIGHT, 44 | PCKEY_STRAFELEFT, 45 | PCKEY_STRAFERIGHT, 46 | PCKEY_RUN, 47 | PCKEY_JUMP, 48 | PCKEY_LOOKUP, 49 | PCKEY_LOOKDOWN, 50 | PCKEY_CENTER, 51 | NUM_PCKEYS 52 | } pckeys_t; 53 | 54 | typedef struct { 55 | int mousex; 56 | int mousey; 57 | int joyx; 58 | int joyy; 59 | int key[NUM_PCKEYS]; 60 | int nextweapon; 61 | int sdclicktime; 62 | int fdclicktime; 63 | int flags; 64 | } playercontrols_t; 65 | 66 | #define PCF_NEXTWEAPON 0x01 67 | #define PCF_FDCLICK 0x02 68 | #define PCF_FDCLICK2 0x04 69 | #define PCF_SDCLICK 0x08 70 | #define PCF_SDCLICK2 0x10 71 | #define PCF_PREVWEAPON 0x20 72 | #define PCF_GAMEPAD 0x40 73 | 74 | extern playercontrols_t Controls; 75 | extern char *G_GetConfigFileName(void); 76 | 77 | #endif 78 | -------------------------------------------------------------------------------- /src/engine/game/g_demo.h: -------------------------------------------------------------------------------- 1 | // Emacs style mode select -*- C++ -*- 2 | //----------------------------------------------------------------------------- 3 | // 4 | // Copyright(C) 1993-1997 Id Software, Inc. 5 | // Copyright(C) 2007-2012 Samuel Villarreal 6 | // 7 | // This program is free software; you can redistribute it and/or 8 | // modify it under the terms of the GNU General Public License 9 | // as published by the Free Software Foundation; either version 2 10 | // of the License, or (at your option) any later version. 11 | // 12 | // This program is distributed in the hope that it will be useful, 13 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | // GNU General Public License for more details. 16 | // 17 | // You should have received a copy of the GNU General Public License 18 | // along with this program; if not, write to the Free Software 19 | // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 20 | // 02111-1307, USA. 21 | // 22 | //----------------------------------------------------------------------------- 23 | 24 | #ifndef __G_DEMO_H__ 25 | #define __G_DEMO_H__ 26 | 27 | #define DEMOMARKER 0x80 28 | 29 | dboolean G_CheckDemoStatus(void); 30 | 31 | void G_RecordDemo(const char* name); 32 | void G_PlayDemo(const char* name); 33 | void G_ReadDemoTiccmd(ticcmd_t* cmd); 34 | void G_WriteDemoTiccmd(ticcmd_t* cmd); 35 | 36 | extern char demoname[256]; // name of demo lump 37 | extern dboolean demorecording; // currently recording a demo 38 | extern dboolean demoplayback; // currently playing a demo 39 | extern dboolean netdemo; 40 | extern byte* demobuffer; 41 | extern byte* demo_p; 42 | extern byte* demoend; 43 | extern dboolean singledemo; 44 | extern dboolean endDemo; // signal recorder to stop on next tick 45 | extern dboolean iwadDemo; // hide hud, end playback after one level 46 | 47 | #endif 48 | -------------------------------------------------------------------------------- /src/engine/game/g_game.h: -------------------------------------------------------------------------------- 1 | // Emacs style mode select -*- C++ -*- 2 | //----------------------------------------------------------------------------- 3 | // 4 | // Copyright(C) 1993-1997 Id Software, Inc. 5 | // Copyright(C) 2007-2012 Samuel Villarreal 6 | // 7 | // This program is free software; you can redistribute it and/or 8 | // modify it under the terms of the GNU General Public License 9 | // as published by the Free Software Foundation; either version 2 10 | // of the License, or (at your option) any later version. 11 | // 12 | // This program is distributed in the hope that it will be useful, 13 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | // GNU General Public License for more details. 16 | // 17 | // You should have received a copy of the GNU General Public License 18 | // along with this program; if not, write to the Free Software 19 | // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 20 | // 02111-1307, USA. 21 | // 22 | //----------------------------------------------------------------------------- 23 | 24 | #ifndef __G_GAME__ 25 | #define __G_GAME__ 26 | 27 | #include "doomdef.h" 28 | #include "d_event.h" 29 | 30 | extern dboolean sendpause; 31 | 32 | // 33 | // GAME 34 | // 35 | 36 | void G_Init(void); 37 | void G_ReloadDefaults(void); 38 | void G_SaveDefaults(void); 39 | void G_DeathMatchSpawnPlayer(int playernum); 40 | void G_InitNew(skill_t skill, int map); 41 | void G_DeferedInitNew(skill_t skill, int map); 42 | void G_LoadGame(const char* name); 43 | void G_DoLoadGame(void); 44 | void G_SaveGame(int slot, const char* description); 45 | void G_DoSaveGame(void); 46 | void G_CompleteLevel(void); 47 | void G_ExitLevel(void); 48 | void G_SecretExitLevel(int map); 49 | void G_Ticker(void); 50 | void G_ScreenShot(void); 51 | void G_RunTitleMap(void); 52 | void G_RunGame(void); 53 | 54 | dboolean G_Responder(event_t* ev); 55 | 56 | #endif 57 | -------------------------------------------------------------------------------- /src/engine/game/g_local.h: -------------------------------------------------------------------------------- 1 | // Emacs style mode select -*- C++ -*- 2 | //----------------------------------------------------------------------------- 3 | // 4 | // Copyright(C) 1993-1997 Id Software, Inc. 5 | // Copyright(C) 2007-2012 Samuel Villarreal 6 | // 7 | // This program is free software; you can redistribute it and/or 8 | // modify it under the terms of the GNU General Public License 9 | // as published by the Free Software Foundation; either version 2 10 | // of the License, or (at your option) any later version. 11 | // 12 | // This program is distributed in the hope that it will be useful, 13 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | // GNU General Public License for more details. 16 | // 17 | // You should have received a copy of the GNU General Public License 18 | // along with this program; if not, write to the Free Software 19 | // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 20 | // 02111-1307, USA. 21 | // 22 | //----------------------------------------------------------------------------- 23 | 24 | #ifndef G_LOCAL_H 25 | #define G_LOCAL_H 26 | 27 | #include "g_game.h" 28 | #include "g_actions.h" 29 | #include "g_controls.h" 30 | #include "g_settings.h" 31 | 32 | #endif 33 | -------------------------------------------------------------------------------- /src/engine/game/g_settings.h: -------------------------------------------------------------------------------- 1 | // Emacs style mode select -*- C++ -*- 2 | //----------------------------------------------------------------------------- 3 | // 4 | // Copyright(C) 1999-2000 Paul Brook 5 | // Copyright(C) 2007-2012 Samuel Villarreal 6 | // 7 | // This program is free software; you can redistribute it and/or 8 | // modify it under the terms of the GNU General Public License 9 | // as published by the Free Software Foundation; either version 2 10 | // of the License, or (at your option) any later version. 11 | // 12 | // This program is distributed in the hope that it will be useful, 13 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | // GNU General Public License for more details. 16 | // 17 | // You should have received a copy of the GNU General Public License 18 | // along with this program; if not, write to the Free Software 19 | // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 20 | // 02111-1307, USA. 21 | // 22 | //----------------------------------------------------------------------------- 23 | 24 | #ifndef G_SETTINGS_H 25 | #define G_SETTINGS_H 26 | 27 | void G_LoadSettings(void); 28 | void G_ExecuteFile(char *name); 29 | char *G_GetConfigFileName(void); 30 | 31 | #endif 32 | -------------------------------------------------------------------------------- /src/engine/gfx/Image_test.cc: -------------------------------------------------------------------------------- 1 | 2 | #include 3 | #include 4 | #include 5 | 6 | using namespace kex::gfx; 7 | 8 | template 9 | Image create_rgb_image(uint16 width, uint16 height, Callable &func) 10 | { 11 | Image image(PixelFormat::rgb, width, height, nullptr); 12 | 13 | for (int y = 0; y < height; y++) 14 | { 15 | for (int x = 0; x < width; x++) 16 | { 17 | Rgb c = func(x, y); 18 | image.set_pixel(x, y, c); 19 | } 20 | } 21 | 22 | return image; 23 | }; 24 | 25 | TEST(Image, comparison) 26 | { 27 | auto func_1 = [](int x, int y) { return Rgb(x, y, x ^ y); }; 28 | auto img_1 = create_rgb_image(6, 8, func_1); 29 | auto img_2 = create_rgb_image(6, 8, func_1); 30 | 31 | ASSERT_TRUE(img_1 == img_2); 32 | ASSERT_FALSE(img_1 != img_2); 33 | 34 | auto func_2 = [](int x, int y) { return Rgb(y, x, x ^ y); }; 35 | auto img_3 = create_rgb_image(6, 8, func_2); 36 | 37 | ASSERT_TRUE(img_1 != img_3); 38 | ASSERT_FALSE(img_1 == img_3); 39 | } 40 | 41 | TEST(Image, crop) 42 | { 43 | std::ifstream fileExpect("testdata/color-crop.png"); 44 | std::ifstream fileActual("testdata/color.png"); 45 | ASSERT_TRUE(fileExpect.is_open()); 46 | ASSERT_TRUE(fileActual.is_open()); 47 | 48 | Image imageExpect(fileExpect); 49 | Image imageActual(fileActual); 50 | 51 | imageActual.resize(imageExpect.width(), imageExpect.height()); 52 | 53 | ASSERT_EQ(imageExpect, imageActual); 54 | } 55 | 56 | TEST(Image, expand) 57 | { 58 | std::ifstream fileExpect("testdata/color-expand.png"); 59 | std::ifstream fileActual("testdata/color.png"); 60 | ASSERT_TRUE(fileExpect.is_open()); 61 | ASSERT_TRUE(fileActual.is_open()); 62 | 63 | Image imageExpect(fileExpect); 64 | Image imageActual(fileActual); 65 | 66 | imageActual.resize(imageExpect.width(), imageExpect.height()); 67 | 68 | ASSERT_EQ(imageExpect, imageActual); 69 | } -------------------------------------------------------------------------------- /src/engine/gfx/Pixel_test.cc: -------------------------------------------------------------------------------- 1 | 2 | #include 3 | #include 4 | 5 | using namespace kex::gfx; 6 | -------------------------------------------------------------------------------- /src/engine/gfx/PngImage_test.cc: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | 5 | using namespace kex::gfx; 6 | 7 | TEST(PngImage, load_rgb) 8 | { 9 | std::ifstream file("testdata/color.png"); 10 | ASSERT_TRUE(file.is_open()); 11 | 12 | Image image(file); 13 | ASSERT_EQ(PixelFormat::rgb, image.format()); 14 | ASSERT_EQ(320, image.width()); 15 | ASSERT_EQ(240, image.height()); 16 | ASSERT_EQ(nullptr, image.palette()); 17 | } 18 | 19 | TEST(PngImage, load_rgba) 20 | { 21 | std::ifstream file("testdata/color-alpha.png"); 22 | ASSERT_TRUE(file.is_open()); 23 | 24 | Image image(file); 25 | ASSERT_EQ(PixelFormat::rgba, image.format()); 26 | ASSERT_EQ(320, image.width()); 27 | ASSERT_EQ(240, image.height()); 28 | ASSERT_EQ(nullptr, image.palette()); 29 | } 30 | 31 | TEST(PngImage, load_index8_with_rgb_pal) 32 | { 33 | std::ifstream file("testdata/index.png"); 34 | ASSERT_TRUE(file.is_open()); 35 | 36 | Image image(file); 37 | ASSERT_EQ(PixelFormat::index8, image.format()); 38 | ASSERT_EQ(320, image.width()); 39 | ASSERT_EQ(240, image.height()); 40 | ASSERT_NE(nullptr, image.palette()); 41 | ASSERT_EQ(PixelFormat::rgb, image.palette()->format()); 42 | } 43 | 44 | TEST(PngImage, load_index8_with_rgba_pal) 45 | { 46 | std::ifstream file("testdata/index-alpha.png"); 47 | ASSERT_TRUE(file.is_open()); 48 | 49 | Image image(file); 50 | ASSERT_EQ(PixelFormat::index8, image.format()); 51 | ASSERT_EQ(320, image.width()); 52 | ASSERT_EQ(240, image.height()); 53 | ASSERT_NE(nullptr, image.palette()); 54 | ASSERT_EQ(PixelFormat::rgba, image.palette()->format()); 55 | } 56 | 57 | TEST(PngImage, resize_crop_rgb) 58 | { 59 | std::ifstream file_expect("testdata/color-crop.png"); 60 | std::ifstream file("testdata/color.png"); 61 | ASSERT_TRUE(file_expect.is_open()); 62 | ASSERT_TRUE(file.is_open()); 63 | 64 | Image image_expect(file_expect); 65 | Image image(file); 66 | 67 | image.resize(image_expect.width(), image_expect.height()); 68 | 69 | ASSERT_EQ(image_expect, image); 70 | } 71 | -------------------------------------------------------------------------------- /src/engine/intermission/wi_stuff.h: -------------------------------------------------------------------------------- 1 | // Emacs style mode select -*- C++ -*- 2 | //----------------------------------------------------------------------------- 3 | // 4 | // Copyright(C) 1993-1997 Id Software, Inc. 5 | // Copyright(C) 2007-2012 Samuel Villarreal 6 | // 7 | // This program is free software; you can redistribute it and/or 8 | // modify it under the terms of the GNU General Public License 9 | // as published by the Free Software Foundation; either version 2 10 | // of the License, or (at your option) any later version. 11 | // 12 | // This program is distributed in the hope that it will be useful, 13 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | // GNU General Public License for more details. 16 | // 17 | // You should have received a copy of the GNU General Public License 18 | // along with this program; if not, write to the Free Software 19 | // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 20 | // 02111-1307, USA. 21 | // 22 | //----------------------------------------------------------------------------- 23 | 24 | #ifndef __WI_STUFF__ 25 | #define __WI_STUFF__ 26 | 27 | #include "doomdef.h" 28 | 29 | // Called by main loop, animate the intermission. 30 | bool WI_Ticker(void); 31 | 32 | void WI_Stop(void); 33 | 34 | // Called by main loop, 35 | // draws the intermission directly into the screen buffer. 36 | void WI_Drawer(void); 37 | 38 | // Setup for an intermission screen. 39 | void WI_Start(void); 40 | 41 | #endif 42 | -------------------------------------------------------------------------------- /src/engine/misc/m_cheat.h: -------------------------------------------------------------------------------- 1 | // Emacs style mode select -*- C++ -*- 2 | //----------------------------------------------------------------------------- 3 | // 4 | // Copyright(C) 1993-1997 Id Software, Inc. 5 | // Copyright(C) 2007-2012 Samuel Villarreal 6 | // 7 | // This program is free software; you can redistribute it and/or 8 | // modify it under the terms of the GNU General Public License 9 | // as published by the Free Software Foundation; either version 2 10 | // of the License, or (at your option) any later version. 11 | // 12 | // This program is distributed in the hope that it will be useful, 13 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | // GNU General Public License for more details. 16 | // 17 | // You should have received a copy of the GNU General Public License 18 | // along with this program; if not, write to the Free Software 19 | // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 20 | // 02111-1307, USA. 21 | // 22 | //----------------------------------------------------------------------------- 23 | 24 | 25 | #ifndef __M_CHEAT__ 26 | #define __M_CHEAT__ 27 | 28 | #include "doomdef.h" 29 | #include "g_game.h" 30 | #include "doomstat.h" 31 | 32 | // 33 | // CHEAT SEQUENCE PACKAGE 34 | // 35 | 36 | void M_CheatProcess(player_t* plyr, event_t* ev); 37 | void M_ParseNetCheat(int player, int type, char *buff); 38 | 39 | void M_CheatGod(player_t* player, char dat[4]); 40 | void M_CheatClip(player_t* player, char dat[4]); 41 | void M_CheatKfa(player_t* player, char dat[4]); 42 | void M_CheatGiveWeapon(player_t* player, char dat[4]); 43 | void M_CheatArtifacts(player_t* player, char dat[4]); 44 | void M_CheatBoyISuck(player_t* player, char dat[4]); 45 | void M_CheatGiveKey(player_t* player, char dat[4]); 46 | 47 | extern int amCheating; 48 | 49 | #endif 50 | -------------------------------------------------------------------------------- /src/engine/misc/m_fixed.cc: -------------------------------------------------------------------------------- 1 | // Emacs style mode select -*- C++ -*- 2 | //----------------------------------------------------------------------------- 3 | // 4 | // Copyright(C) 1993-1997 Id Software, Inc. 5 | // Copyright(C) 2007-2012 Samuel Villarreal 6 | // 7 | // This program is free software; you can redistribute it and/or 8 | // modify it under the terms of the GNU General Public License 9 | // as published by the Free Software Foundation; either version 2 10 | // of the License, or (at your option) any later version. 11 | // 12 | // This program is distributed in the hope that it will be useful, 13 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | // GNU General Public License for more details. 16 | // 17 | // You should have received a copy of the GNU General Public License 18 | // along with this program; if not, write to the Free Software 19 | // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 20 | // 02111-1307, USA. 21 | // 22 | //----------------------------------------------------------------------------- 23 | // 24 | // DESCRIPTION: 25 | // Fixed point implementation. 26 | // 27 | //----------------------------------------------------------------------------- 28 | 29 | #include "stdlib.h" 30 | 31 | #include "doomtype.h" 32 | #include "doomdef.h" 33 | #include "i_system.h" 34 | 35 | #include "m_fixed.h" 36 | 37 | // Fixme. __USE_C_FIXED__ or something. 38 | 39 | fixed_t 40 | FixedMul 41 | (fixed_t a, 42 | fixed_t b) { 43 | #ifdef USE_ASM 44 | fixed_t c; 45 | _asm { 46 | mov eax, [a] 47 | mov ecx, [b] 48 | imul ecx 49 | shr eax, 16 50 | shl edx, 16 51 | or eax, edx 52 | mov [c], eax 53 | } 54 | return(c); 55 | #else 56 | return (fixed_t)(((int64) a * (int64) b) >> FRACBITS); 57 | #endif 58 | } 59 | 60 | 61 | 62 | // 63 | // FixedDiv, C version. 64 | // 65 | 66 | fixed_t 67 | FixedDiv 68 | (fixed_t a, 69 | fixed_t b) { 70 | if((D_abs(a)>>14) >= D_abs(b)) { 71 | return (a^b)<0 ? D_MININT : D_MAXINT; 72 | } 73 | return FixedDiv2(a,b); 74 | 75 | } 76 | 77 | 78 | 79 | fixed_t 80 | FixedDiv2 81 | (fixed_t a, 82 | fixed_t b) { 83 | return (fixed_t)((((int64)a)<>FRACBITS) 42 | #define FLOATTOFIXED(x) ((fixed_t)((x)*FRACUNIT)) 43 | #define F2D3D(x) (((float)(x))/FRACUNIT) 44 | 45 | typedef int fixed_t; 46 | 47 | fixed_t FixedMul(fixed_t a, fixed_t b); 48 | fixed_t FixedDiv(fixed_t a, fixed_t b); 49 | fixed_t FixedDiv2(fixed_t a, fixed_t b); 50 | fixed_t FixedDot(fixed_t a1, fixed_t b1, fixed_t c1, fixed_t a2, fixed_t b2, fixed_t c2); 51 | 52 | #endif 53 | -------------------------------------------------------------------------------- /src/engine/misc/m_keys.h: -------------------------------------------------------------------------------- 1 | // Emacs style mode select -*- C++ -*- 2 | //----------------------------------------------------------------------------- 3 | // 4 | // Copyright(C) 1999-2000 Paul Brook 5 | // Copyright(C) 2007-2012 Samuel Villarreal 6 | // 7 | // This program is free software; you can redistribute it and/or 8 | // modify it under the terms of the GNU General Public License 9 | // as published by the Free Software Foundation; either version 2 10 | // of the License, or (at your option) any later version. 11 | // 12 | // This program is distributed in the hope that it will be useful, 13 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | // GNU General Public License for more details. 16 | // 17 | // You should have received a copy of the GNU General Public License 18 | // along with this program; if not, write to the Free Software 19 | // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 20 | // 02111-1307, USA. 21 | // 22 | //----------------------------------------------------------------------------- 23 | 24 | #ifndef M_KEYS_H 25 | #define M_KEYS_H 26 | 27 | #define MAX_KEY_NAME_LENGTH 32 28 | 29 | int M_GetKeyName(char *buff, int key); 30 | 31 | #endif 32 | -------------------------------------------------------------------------------- /src/engine/misc/m_menu.h: -------------------------------------------------------------------------------- 1 | // Emacs style mode select -*- C++ -*- 2 | //----------------------------------------------------------------------------- 3 | // 4 | // Copyright(C) 1993-1997 Id Software, Inc. 5 | // Copyright(C) 2007-2012 Samuel Villarreal 6 | // 7 | // This program is free software; you can redistribute it and/or 8 | // modify it under the terms of the GNU General Public License 9 | // as published by the Free Software Foundation; either version 2 10 | // of the License, or (at your option) any later version. 11 | // 12 | // This program is distributed in the hope that it will be useful, 13 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | // GNU General Public License for more details. 16 | // 17 | // You should have received a copy of the GNU General Public License 18 | // along with this program; if not, write to the Free Software 19 | // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 20 | // 02111-1307, USA. 21 | // 22 | //----------------------------------------------------------------------------- 23 | 24 | #ifndef __M_MENU__ 25 | #define __M_MENU__ 26 | 27 | 28 | 29 | #include "d_event.h" 30 | 31 | // 32 | // MENUS 33 | // 34 | // Called by main loop, 35 | // saves config file and calls I_Quit when user exits. 36 | // Even when the menu is not displayed, 37 | // this can resize the view and change game parameters. 38 | // Does all the real work of the menu interaction. 39 | dboolean M_Responder(event_t *ev); 40 | 41 | 42 | // Called by main loop, 43 | // only used for menu (skull cursor) animation. 44 | void M_Ticker(void); 45 | 46 | // Called by main loop, 47 | // draws the menus directly into the screen buffer. 48 | void M_Drawer(void); 49 | 50 | // Called by D_DoomMain, 51 | // loads the config file. 52 | void M_Init(void); 53 | 54 | // Called by intro code to force menu up upon a keypress, 55 | // does nothing if menu is already up. 56 | void M_StartControlPanel(dboolean forcenext); 57 | 58 | void M_StartMainMenu(void); 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | #endif 67 | -------------------------------------------------------------------------------- /src/engine/misc/m_misc.h: -------------------------------------------------------------------------------- 1 | // Emacs style mode select -*- C++ -*- 2 | //----------------------------------------------------------------------------- 3 | // 4 | // Copyright(C) 1993-1997 Id Software, Inc. 5 | // Copyright(C) 2007-2012 Samuel Villarreal 6 | // 7 | // This program is free software; you can redistribute it and/or 8 | // modify it under the terms of the GNU General Public License 9 | // as published by the Free Software Foundation; either version 2 10 | // of the License, or (at your option) any later version. 11 | // 12 | // This program is distributed in the hope that it will be useful, 13 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | // GNU General Public License for more details. 16 | // 17 | // You should have received a copy of the GNU General Public License 18 | // along with this program; if not, write to the Free Software 19 | // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 20 | // 02111-1307, USA. 21 | // 22 | //----------------------------------------------------------------------------- 23 | 24 | 25 | #ifndef __M_MISC__ 26 | #define __M_MISC__ 27 | 28 | 29 | #include "doomtype.h" 30 | #include "m_fixed.h" 31 | #include "r_local.h" 32 | 33 | // 34 | // MISC 35 | // 36 | 37 | #ifndef O_BINARY 38 | #define O_BINARY 0 39 | #endif 40 | 41 | extern int myargc; 42 | extern char** myargv; 43 | 44 | // Returns the position of the given parameter 45 | // in the arg list (0 if not found). 46 | int M_CheckParm(const char* check); 47 | 48 | // Bounding box coordinate storage. 49 | enum { 50 | BOXTOP, 51 | BOXBOTTOM, 52 | BOXLEFT, 53 | BOXRIGHT 54 | }; // bbox coordinates 55 | 56 | // Bounding box functions. 57 | void M_ClearBox(fixed_t* box); 58 | 59 | void 60 | M_AddToBox 61 | (fixed_t* box, 62 | fixed_t x, 63 | fixed_t y); 64 | 65 | dboolean M_WriteFile(char const* name, void* source, int length); 66 | int M_ReadFile(char const* name, byte** buffer); 67 | void M_NormalizeSlashes(char *str); 68 | int M_FileExists(char *filename); 69 | long M_FileLength(FILE *handle); 70 | dboolean M_WriteTextFile(char const* name, char* source, int length); 71 | void M_ScreenShot(void); 72 | int M_CacheThumbNail(byte** data); 73 | void M_LoadDefaults(void); 74 | void M_SaveDefaults(void); 75 | 76 | // 77 | // DEFAULTS 78 | // 79 | extern int viewwidth; 80 | extern int viewheight; 81 | 82 | extern char* chat_macros[]; 83 | 84 | //extern dboolean HighSound; 85 | 86 | #endif 87 | -------------------------------------------------------------------------------- /src/engine/misc/m_password.h: -------------------------------------------------------------------------------- 1 | // Emacs style mode select -*- C++ -*- 2 | //----------------------------------------------------------------------------- 3 | // 4 | // Copyright(C) 1997 Midway Home Entertainment, Inc 5 | // Copyright(C) 2007-2012 Samuel Villarreal 6 | // 7 | // This program is free software; you can redistribute it and/or 8 | // modify it under the terms of the GNU General Public License 9 | // as published by the Free Software Foundation; either version 2 10 | // of the License, or (at your option) any later version. 11 | // 12 | // This program is distributed in the hope that it will be useful, 13 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | // GNU General Public License for more details. 16 | // 17 | // You should have received a copy of the GNU General Public License 18 | // along with this program; if not, write to the Free Software 19 | // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 20 | // 02111-1307, USA. 21 | // 22 | //----------------------------------------------------------------------------- 23 | 24 | 25 | #ifndef __M_PASSWORD_H__ 26 | #define __M_PASSWORD_H__ 27 | 28 | #include "doomtype.h" 29 | 30 | extern byte passwordData[16]; 31 | extern const char *passwordChar; 32 | extern dboolean doPassword; 33 | 34 | void M_EncodePassword(void); 35 | dboolean M_DecodePassword(dboolean checkOnly); 36 | 37 | #endif // __M_PASSWORD_H__ -------------------------------------------------------------------------------- /src/engine/misc/m_shift.cc: -------------------------------------------------------------------------------- 1 | //m_shift.c 2 | //shift transformation tables 3 | #include "doomstat.h" 4 | 5 | const char* shiftxform; 6 | 7 | const char english_shiftxform[] = { 8 | 9 | 0, 10 | 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11 | 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 12 | 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 13 | 31, 14 | ' ', '!', '"', '#', '$', '%', '&', 15 | '"', // shift-' 16 | '(', ')', '*', '+', 17 | '<', // shift-, 18 | '_', // shift-- 19 | '>', // shift-. 20 | '?', // shift-/ 21 | ')', // shift-0 22 | '!', // shift-1 23 | '@', // shift-2 24 | '#', // shift-3 25 | '$', // shift-4 26 | '%', // shift-5 27 | '^', // shift-6 28 | '&', // shift-7 29 | '*', // shift-8 30 | '(', // shift-9 31 | ':', 32 | ':', // shift-; 33 | '<', 34 | '+', // shift-= 35 | '>', '?', '@', 36 | 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 37 | 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z', 38 | '[', // shift-[ 39 | '!', // shift-backslash - OH MY GOD DOES WATCOM SUCK 40 | ']', // shift-] 41 | '"', '_', 42 | '\'', // shift-` 43 | 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 44 | 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z', 45 | '{', '|', '}', '~', 127 46 | }; 47 | 48 | void M_InitShiftXForm(void) { 49 | shiftxform = english_shiftxform; 50 | } 51 | -------------------------------------------------------------------------------- /src/engine/misc/m_shift.h: -------------------------------------------------------------------------------- 1 | // Emacs style mode select -*- C++ -*- 2 | //----------------------------------------------------------------------------- 3 | // 4 | // Copyright(C) 1999-2000 Paul Brook 5 | // Copyright(C) 2007-2012 Samuel Villarreal 6 | // 7 | // This program is free software; you can redistribute it and/or 8 | // modify it under the terms of the GNU General Public License 9 | // as published by the Free Software Foundation; either version 2 10 | // of the License, or (at your option) any later version. 11 | // 12 | // This program is distributed in the hope that it will be useful, 13 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | // GNU General Public License for more details. 16 | // 17 | // You should have received a copy of the GNU General Public License 18 | // along with this program; if not, write to the Free Software 19 | // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 20 | // 02111-1307, USA. 21 | // 22 | //----------------------------------------------------------------------------- 23 | 24 | #ifndef M_SHIFT_H 25 | #define M_SHIFT_H 26 | 27 | extern const char* shiftxform; 28 | void M_InitShiftXForm(void); 29 | 30 | #endif -------------------------------------------------------------------------------- /src/engine/native_ui/Gtk3.cc: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | namespace { 5 | using Init = void (); 6 | using Quit = void (); 7 | using ConsoleAddLine = void (const char *); 8 | 9 | Init* init_ {}; 10 | Quit* quit_ {}; 11 | ConsoleAddLine* console_add_line_ {}; 12 | 13 | void *handle_ = nullptr; 14 | } 15 | 16 | void native_ui::init() 17 | { 18 | handle_ = dlopen("./libDoom64EX-gtk3.so", RTLD_LAZY | RTLD_GLOBAL); 19 | if (!handle_) { 20 | println("Gtk3: Could not load libDoom64EX-gtk3.so"); 21 | return; 22 | } 23 | 24 | init_ = reinterpret_cast(dlsym(handle_, "init")); 25 | 26 | if (!init_) { 27 | println("Erro: {}", dlerror()); 28 | exit(0); 29 | } 30 | quit_ = reinterpret_cast(dlsym(handle_, "quit")); 31 | console_add_line_ = reinterpret_cast(dlsym(handle_, "console_add_line")); 32 | 33 | assert(quit_); 34 | assert(console_add_line_); 35 | 36 | init_(); 37 | } 38 | 39 | void native_ui::console_show(bool) 40 | { 41 | } 42 | 43 | void native_ui::console_add_line(StringView line) 44 | { 45 | if (!handle_) 46 | return; 47 | 48 | String str = line; 49 | console_add_line_(str.c_str()); 50 | } 51 | -------------------------------------------------------------------------------- /src/engine/native_ui/WinAPI.cc: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | extern "C" { 4 | 5 | void winapi_init(); 6 | void winapi_show(bool show); 7 | void winapi_add_text(const char *text); 8 | 9 | } 10 | 11 | void native_ui::init() 12 | { 13 | winapi_init(); 14 | } 15 | 16 | void native_ui::console_show(bool show) 17 | { 18 | winapi_show(show); 19 | } 20 | 21 | void native_ui::console_add_line(StringView line) 22 | { 23 | String text = line; 24 | winapi_add_text(text.c_str()); 25 | } 26 | -------------------------------------------------------------------------------- /src/engine/net/net_client.h: -------------------------------------------------------------------------------- 1 | // Emacs style mode select -*- C++ -*- 2 | //----------------------------------------------------------------------------- 3 | // 4 | // Copyright(C) 2005 Simon Howard 5 | // 6 | // This program is free software; you can redistribute it and/or 7 | // modify it under the terms of the GNU General Public License 8 | // as published by the Free Software Foundation; either version 2 9 | // of the License, or (at your option) any later version. 10 | // 11 | // This program is distributed in the hope that it will be useful, 12 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | // GNU General Public License for more details. 15 | // 16 | // You should have received a copy of the GNU General Public License 17 | // along with this program; if not, write to the Free Software 18 | // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 19 | // 02111-1307, USA. 20 | // 21 | // Network client code 22 | // 23 | 24 | #ifndef NET_CLIENT_H 25 | #define NET_CLIENT_H 26 | 27 | #include "doomdef.h" 28 | #include "doomtype.h" 29 | #include "d_ticcmd.h" 30 | #include "md5.h" 31 | #include "net_defs.h" 32 | 33 | #define MAXPLAYERNAME 30 34 | 35 | dboolean NET_CL_Connect(net_addr_t *addr); 36 | void NET_CL_Disconnect(void); 37 | void NET_CL_Run(void); 38 | void NET_CL_Init(void); 39 | void NET_CL_StartGame(); 40 | void NET_CL_SendTiccmd(ticcmd_t *ticcmd, int maketic); 41 | void NET_Init(void); 42 | void NET_CL_SendCheat(int player, int type, char *buff); 43 | 44 | extern dboolean net_client_connected; 45 | extern dboolean net_client_received_wait_data; 46 | extern dboolean net_client_controller; 47 | extern unsigned int net_clients_in_game; 48 | extern unsigned int net_drones_in_game; 49 | extern dboolean net_waiting_for_start; 50 | extern char net_player_names[MAXPLAYERS][MAXPLAYERNAME]; 51 | extern char net_player_addresses[MAXPLAYERS][MAXPLAYERNAME]; 52 | extern int net_player_number; 53 | extern String net_player_name; 54 | 55 | extern md5_digest_t net_server_wad_md5sum; 56 | extern md5_digest_t net_local_wad_md5sum; 57 | 58 | 59 | #endif /* #ifndef NET_CLIENT_H */ 60 | 61 | -------------------------------------------------------------------------------- /src/engine/net/net_dedicated.cc: -------------------------------------------------------------------------------- 1 | // Emacs style mode select -*- C++ -*- 2 | //----------------------------------------------------------------------------- 3 | // 4 | // Copyright(C) 2005 Simon Howard 5 | // 6 | // This program is free software; you can redistribute it and/or 7 | // modify it under the terms of the GNU General Public License 8 | // as published by the Free Software Foundation; either version 2 9 | // of the License, or (at your option) any later version. 10 | // 11 | // This program is distributed in the hope that it will be useful, 12 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | // GNU General Public License for more details. 15 | // 16 | // You should have received a copy of the GNU General Public License 17 | // along with this program; if not, write to the Free Software 18 | // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 19 | // 02111-1307, USA. 20 | // 21 | //----------------------------------------------------------------------------- 22 | // 23 | // Dedicated server code. 24 | // 25 | 26 | #include "doomtype.h" 27 | #include "i_system.h" 28 | #include "m_misc.h" 29 | 30 | #include "net_defs.h" 31 | #include "net_sdl.h" 32 | #include "net_server.h" 33 | 34 | // 35 | // People can become confused about how dedicated servers work. Game 36 | // options are specified to the controlling player who is the first to 37 | // join a game. Bomb out with an error message if game options are 38 | // specified to a dedicated server. 39 | // 40 | 41 | static const char *not_dedicated_options[] = 42 | { 43 | "-deh", "-iwad", "-cdrom", "-gameversion", "-nomonsters", "-respawn", 44 | "-fast", "-altdeath", "-deathmatch", "-turbo", "-merge", "-af", "-as", 45 | "-aa", "-file", "-wart", "-skill", "-episode", "-timer", "-avg", "-warp", 46 | "-loadgame", "-longtics", "-extratics", "-dup", NULL, 47 | }; 48 | 49 | static void CheckForClientOptions(void) 50 | { 51 | int i; 52 | 53 | for (i=0; not_dedicated_options[i] != NULL; ++i) 54 | { 55 | if (M_CheckParm(not_dedicated_options[i]) > 0) 56 | { 57 | I_Error("The command line parameter '%s' was specified to a " 58 | "dedicated server.\nGame parameters should be specified " 59 | "to the first player to join a server, \nnot to the " 60 | "server itself. ", 61 | not_dedicated_options[i]); 62 | } 63 | } 64 | } 65 | 66 | void NET_DedicatedServer(void) 67 | { 68 | CheckForClientOptions(); 69 | 70 | NET_SV_Init(); 71 | 72 | NET_SV_AddModule(&net_sdl_module); 73 | 74 | while (true) 75 | { 76 | NET_SV_Run(); 77 | I_Sleep(10); 78 | } 79 | } 80 | 81 | -------------------------------------------------------------------------------- /src/engine/net/net_dedicated.h: -------------------------------------------------------------------------------- 1 | // Emacs style mode select -*- C++ -*- 2 | //----------------------------------------------------------------------------- 3 | // 4 | // Copyright(C) 2005 Simon Howard 5 | // 6 | // This program is free software; you can redistribute it and/or 7 | // modify it under the terms of the GNU General Public License 8 | // as published by the Free Software Foundation; either version 2 9 | // of the License, or (at your option) any later version. 10 | // 11 | // This program is distributed in the hope that it will be useful, 12 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | // GNU General Public License for more details. 15 | // 16 | // You should have received a copy of the GNU General Public License 17 | // along with this program; if not, write to the Free Software 18 | // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 19 | // 02111-1307, USA. 20 | // 21 | //----------------------------------------------------------------------------- 22 | // 23 | // Dedicated server code. 24 | // 25 | 26 | #ifndef NET_DEDICATED_H 27 | #define NET_DEDICATED_H 28 | 29 | void NET_DedicatedServer(void); 30 | 31 | #endif /* #ifndef NET_DEDICATED_H */ 32 | 33 | 34 | -------------------------------------------------------------------------------- /src/engine/net/net_io.h: -------------------------------------------------------------------------------- 1 | // Emacs style mode select -*- C++ -*- 2 | //----------------------------------------------------------------------------- 3 | // 4 | // Copyright(C) 2005 Simon Howard 5 | // 6 | // This program is free software; you can redistribute it and/or 7 | // modify it under the terms of the GNU General Public License 8 | // as published by the Free Software Foundation; either version 2 9 | // of the License, or (at your option) any later version. 10 | // 11 | // This program is distributed in the hope that it will be useful, 12 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | // GNU General Public License for more details. 15 | // 16 | // You should have received a copy of the GNU General Public License 17 | // along with this program; if not, write to the Free Software 18 | // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 19 | // 02111-1307, USA. 20 | // 21 | // DESCRIPTION: 22 | // Network packet manipulation (net_packet_t) 23 | // 24 | //----------------------------------------------------------------------------- 25 | 26 | #ifndef NET_IO_H 27 | #define NET_IO_H 28 | 29 | #include "net_defs.h" 30 | 31 | extern net_addr_t net_broadcast_addr; 32 | 33 | net_context_t *NET_NewContext(void); 34 | void NET_AddModule(net_context_t *context, net_module_t *module); 35 | void NET_SendPacket(net_addr_t *addr, net_packet_t *packet); 36 | void NET_SendBroadcast(net_context_t *context, net_packet_t *packet); 37 | dboolean NET_RecvPacket(net_context_t *context, net_addr_t **addr, 38 | net_packet_t **packet); 39 | char *NET_AddrToString(net_addr_t *addr); 40 | void NET_FreeAddress(net_addr_t *addr); 41 | net_addr_t *NET_ResolveAddress(net_context_t *context, char *address); 42 | 43 | #endif /* #ifndef NET_IO_H */ 44 | 45 | -------------------------------------------------------------------------------- /src/engine/net/net_loop.h: -------------------------------------------------------------------------------- 1 | // Emacs style mode select -*- C++ -*- 2 | //----------------------------------------------------------------------------- 3 | // 4 | // Copyright(C) 2005 Simon Howard 5 | // 6 | // This program is free software; you can redistribute it and/or 7 | // modify it under the terms of the GNU General Public License 8 | // as published by the Free Software Foundation; either version 2 9 | // of the License, or (at your option) any later version. 10 | // 11 | // This program is distributed in the hope that it will be useful, 12 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | // GNU General Public License for more details. 15 | // 16 | // You should have received a copy of the GNU General Public License 17 | // along with this program; if not, write to the Free Software 18 | // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 19 | // 02111-1307, USA. 20 | // 21 | // DESCRIPTION: 22 | // Loopback network module for server compiled into the client 23 | // 24 | //----------------------------------------------------------------------------- 25 | 26 | #ifndef NET_LOOP_H 27 | #define NET_LOOP_H 28 | 29 | #include "net_defs.h" 30 | 31 | extern net_module_t net_loop_client_module; 32 | extern net_module_t net_loop_server_module; 33 | 34 | #endif /* #ifndef NET_LOOP_H */ 35 | 36 | -------------------------------------------------------------------------------- /src/engine/net/net_packet.h: -------------------------------------------------------------------------------- 1 | // Emacs style mode select -*- C++ -*- 2 | //----------------------------------------------------------------------------- 3 | // 4 | // Copyright(C) 2005 Simon Howard 5 | // 6 | // This program is free software; you can redistribute it and/or 7 | // modify it under the terms of the GNU General Public License 8 | // as published by the Free Software Foundation; either version 2 9 | // of the License, or (at your option) any later version. 10 | // 11 | // This program is distributed in the hope that it will be useful, 12 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | // GNU General Public License for more details. 15 | // 16 | // You should have received a copy of the GNU General Public License 17 | // along with this program; if not, write to the Free Software 18 | // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 19 | // 02111-1307, USA. 20 | // 21 | // DESCRIPTION: 22 | // Definitions for use in networking code. 23 | // 24 | //----------------------------------------------------------------------------- 25 | 26 | #ifndef NET_PACKET_H 27 | #define NET_PACKET_H 28 | 29 | #include "net_defs.h" 30 | 31 | net_packet_t *NET_NewPacket(int initial_size); 32 | net_packet_t *NET_PacketDup(net_packet_t *packet); 33 | void NET_FreePacket(net_packet_t *packet); 34 | 35 | dboolean NET_ReadInt8(net_packet_t *packet, unsigned int *data); 36 | dboolean NET_ReadInt16(net_packet_t *packet, unsigned int *data); 37 | dboolean NET_ReadInt32(net_packet_t *packet, unsigned int *data); 38 | 39 | dboolean NET_ReadSInt8(net_packet_t *packet, signed int *data); 40 | dboolean NET_ReadSInt16(net_packet_t *packet, signed int *data); 41 | dboolean NET_ReadSInt32(net_packet_t *packet, signed int *data); 42 | 43 | char *NET_ReadString(net_packet_t *packet); 44 | 45 | void NET_WriteInt8(net_packet_t *packet, unsigned int i); 46 | void NET_WriteInt16(net_packet_t *packet, unsigned int i); 47 | void NET_WriteInt32(net_packet_t *packet, unsigned int i); 48 | 49 | void NET_WriteString(net_packet_t *packet, StringView string); 50 | 51 | #endif /* #ifndef NET_PACKET_H */ 52 | 53 | -------------------------------------------------------------------------------- /src/engine/net/net_query.h: -------------------------------------------------------------------------------- 1 | // Emacs style mode select -*- C++ -*- 2 | //----------------------------------------------------------------------------- 3 | // 4 | // Copyright(C) 2005 Simon Howard 5 | // 6 | // This program is free software; you can redistribute it and/or 7 | // modify it under the terms of the GNU General Public License 8 | // as published by the Free Software Foundation; either version 2 9 | // of the License, or (at your option) any later version. 10 | // 11 | // This program is distributed in the hope that it will be useful, 12 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | // GNU General Public License for more details. 15 | // 16 | // You should have received a copy of the GNU General Public License 17 | // along with this program; if not, write to the Free Software 18 | // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 19 | // 02111-1307, USA. 20 | // 21 | // DESCRIPTION: 22 | // Querying servers to find their current status. 23 | // 24 | 25 | #ifndef NET_QUERY_H 26 | #define NET_QUERY_H 27 | 28 | #include "net_defs.h" 29 | 30 | extern void NET_QueryAddress(char *addr); 31 | extern void NET_LANQuery(void); 32 | extern net_addr_t *NET_FindLANServer(void); 33 | 34 | #endif /* #ifndef NET_QUERY_H */ 35 | 36 | -------------------------------------------------------------------------------- /src/engine/net/net_sdl.h: -------------------------------------------------------------------------------- 1 | // Emacs style mode select -*- C++ -*- 2 | //----------------------------------------------------------------------------- 3 | // 4 | // Copyright(C) 2005 Simon Howard 5 | // 6 | // This program is free software; you can redistribute it and/or 7 | // modify it under the terms of the GNU General Public License 8 | // as published by the Free Software Foundation; either version 2 9 | // of the License, or (at your option) any later version. 10 | // 11 | // This program is distributed in the hope that it will be useful, 12 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | // GNU General Public License for more details. 15 | // 16 | // You should have received a copy of the GNU General Public License 17 | // along with this program; if not, write to the Free Software 18 | // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 19 | // 02111-1307, USA. 20 | // 21 | // DESCRIPTION: 22 | // Networking module which uses SDL_net 23 | // 24 | //----------------------------------------------------------------------------- 25 | 26 | #ifndef NET_SDL_H 27 | #define NET_SDL_H 28 | 29 | #include "net_defs.h" 30 | 31 | extern net_module_t net_sdl_module; 32 | 33 | #endif /* #ifndef NET_SDL_H */ 34 | 35 | -------------------------------------------------------------------------------- /src/engine/net/net_server.h: -------------------------------------------------------------------------------- 1 | // Emacs style mode select -*- C++ -*- 2 | //----------------------------------------------------------------------------- 3 | // 4 | // Copyright(C) 2005 Simon Howard 5 | // 6 | // This program is free software; you can redistribute it and/or 7 | // modify it under the terms of the GNU General Public License 8 | // as published by the Free Software Foundation; either version 2 9 | // of the License, or (at your option) any later version. 10 | // 11 | // This program is distributed in the hope that it will be useful, 12 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | // GNU General Public License for more details. 15 | // 16 | // You should have received a copy of the GNU General Public License 17 | // along with this program; if not, write to the Free Software 18 | // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 19 | // 02111-1307, USA. 20 | // 21 | // Network server code 22 | // 23 | 24 | #ifndef NET_SERVER_H 25 | #define NET_SERVER_H 26 | 27 | #include 28 | 29 | // initialise server and wait for connections 30 | 31 | void NET_SV_Init(void); 32 | 33 | // run server: check for new packets received etc. 34 | 35 | void NET_SV_Run(void); 36 | 37 | // Shut down the server 38 | // Blocks until all clients disconnect, or until a 5 second timeout 39 | 40 | void NET_SV_Shutdown(void); 41 | 42 | // Add a network module to the context used by the server 43 | 44 | void NET_SV_AddModule(net_module_t *module); 45 | 46 | // Update server cvars across all clients if changed by host/listen server 47 | 48 | void NET_SV_UpdateCvars(const Property &cvar); 49 | 50 | #endif /* #ifndef NET_SERVER_H */ 51 | 52 | -------------------------------------------------------------------------------- /src/engine/net/net_structrw.h: -------------------------------------------------------------------------------- 1 | // Emacs style mode select -*- C++ -*- 2 | //----------------------------------------------------------------------------- 3 | // 4 | // Copyright(C) 2005 Simon Howard 5 | // 6 | // This program is free software; you can redistribute it and/or 7 | // modify it under the terms of the GNU General Public License 8 | // as published by the Free Software Foundation; either version 2 9 | // of the License, or (at your option) any later version. 10 | // 11 | // This program is distributed in the hope that it will be useful, 12 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | // GNU General Public License for more details. 15 | // 16 | // You should have received a copy of the GNU General Public License 17 | // along with this program; if not, write to the Free Software 18 | // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 19 | // 02111-1307, USA. 20 | // 21 | 22 | #ifndef NET_STRUCTRW_H 23 | #define NET_STRUCTRW_H 24 | 25 | #include "md5.h" 26 | #include "net_defs.h" 27 | #include "net_packet.h" 28 | 29 | extern void NET_WriteSettings(net_packet_t *packet, net_gamesettings_t *settings); 30 | extern dboolean NET_ReadSettings(net_packet_t *packet, net_gamesettings_t *settings); 31 | 32 | extern void NET_WriteQueryData(net_packet_t *packet, net_querydata_t *querydata); 33 | extern dboolean NET_ReadQueryData(net_packet_t *packet, net_querydata_t *querydata); 34 | 35 | extern void NET_WriteTiccmdDiff(net_packet_t *packet, net_ticdiff_t *diff, dboolean lowres_turn); 36 | extern dboolean NET_ReadTiccmdDiff(net_packet_t *packet, net_ticdiff_t *diff, dboolean lowres_turn); 37 | extern void NET_TiccmdDiff(ticcmd_t *tic1, ticcmd_t *tic2, net_ticdiff_t *diff); 38 | extern void NET_TiccmdPatch(ticcmd_t *src, net_ticdiff_t *diff, ticcmd_t *dest); 39 | 40 | dboolean NET_ReadFullTiccmd(net_packet_t *packet, net_full_ticcmd_t *cmd, dboolean lowres_turn); 41 | void NET_WriteFullTiccmd(net_packet_t *packet, net_full_ticcmd_t *cmd, dboolean lowres_turn); 42 | 43 | dboolean NET_ReadMD5Sum(net_packet_t *packet, md5_digest_t digest); 44 | void NET_WriteMD5Sum(net_packet_t *packet, md5_digest_t digest); 45 | 46 | #endif /* #ifndef NET_STRUCTRW_H */ 47 | 48 | -------------------------------------------------------------------------------- /src/engine/opengl/gl_draw.h: -------------------------------------------------------------------------------- 1 | // Emacs style mode select -*- C++ -*- 2 | //----------------------------------------------------------------------------- 3 | // 4 | // Copyright(C) 2007-2012 Samuel Villarreal 5 | // 6 | // This program is free software; you can redistribute it and/or 7 | // modify it under the terms of the GNU General Public License 8 | // as published by the Free Software Foundation; either version 2 9 | // of the License, or (at your option) any later version. 10 | // 11 | // This program is distributed in the hope that it will be useful, 12 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | // GNU General Public License for more details. 15 | // 16 | // You should have received a copy of the GNU General Public License 17 | // along with this program; if not, write to the Free Software 18 | // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 19 | // 02111-1307, USA. 20 | // 21 | //----------------------------------------------------------------------------- 22 | 23 | #ifndef __GL_DRAW_H__ 24 | #define __GL_DRAW_H__ 25 | 26 | #include "gl_main.h" 27 | 28 | void Draw_GfxImage(int x, int y, const char* name, 29 | rcolor color, dboolean alpha); 30 | void Draw_Sprite2D(int type, int rot, int frame, int x, int y, 31 | float scale, int pal, rcolor c); 32 | 33 | #define SM_FONT1 16 34 | #define SM_FONT2 42 35 | #define SM_MISCFONT 10 36 | #define SM_NUMBERS 0 37 | #define SM_SKULLS 70 38 | #define SM_THERMO 68 39 | #define SM_MICONS 78 40 | 41 | typedef struct { 42 | int x; 43 | int y; 44 | int w; 45 | int h; 46 | } symboldata_t; 47 | 48 | extern const symboldata_t symboldata[]; 49 | 50 | #define ST_FONTWHSIZE 8 51 | #define ST_FONTNUMSET 32 //# of fonts per row in font pic 52 | #define ST_FONTSTART '!' // the first font characters 53 | #define ST_FONTEND '_' // the last font characters 54 | #define ST_FONTSIZE (ST_FONTEND - ST_FONTSTART + 1) // Calculate # of glyphs in font. 55 | 56 | int Draw_Text(int x, int y, rcolor color, float scale, 57 | dboolean wrap, const char* string, ...); 58 | int Center_Text(const char* string); 59 | int Draw_BigText(int x, int y, rcolor color, const char* string); 60 | void Draw_Number(int x, int y, int num, int type, rcolor c); 61 | float Draw_ConsoleText(float x, float y, rcolor color, 62 | float scale, const char* string, ...); 63 | 64 | #endif 65 | 66 | -------------------------------------------------------------------------------- /src/engine/opengl/gl_texture.h: -------------------------------------------------------------------------------- 1 | // Emacs style mode select -*- C++ -*- 2 | //----------------------------------------------------------------------------- 3 | // 4 | // Copyright(C) 2007-2012 Samuel Villarreal 5 | // 6 | // This program is free software; you can redistribute it and/or 7 | // modify it under the terms of the GNU General Public License 8 | // as published by the Free Software Foundation; either version 2 9 | // of the License, or (at your option) any later version. 10 | // 11 | // This program is distributed in the hope that it will be useful, 12 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | // GNU General Public License for more details. 15 | // 16 | // You should have received a copy of the GNU General Public License 17 | // along with this program; if not, write to the Free Software 18 | // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 19 | // 02111-1307, USA. 20 | // 21 | //----------------------------------------------------------------------------- 22 | 23 | #ifndef __GL_TEXTURE_H__ 24 | #define __GL_TEXTURE_H__ 25 | 26 | #include "gl_main.h" 27 | 28 | extern int curtexture; 29 | extern int cursprite; 30 | extern int curtrans; 31 | extern int curgfx; 32 | 33 | extern word* texturewidth; 34 | extern word* textureheight; 35 | extern dtexture** textureptr; 36 | extern int swx_start; 37 | extern int numtextures; 38 | extern word* texturetranslation; 39 | extern word* palettetranslation; 40 | 41 | extern int numgfx; 42 | extern dtexture* gfxptr; 43 | extern word* gfxwidth; 44 | extern word* gfxorigwidth; 45 | extern word* gfxheight; 46 | extern word* gfxorigheight; 47 | 48 | extern dtexture** spriteptr; 49 | extern int numsprtex; 50 | extern word* spritewidth; 51 | extern float* spriteoffset; 52 | extern float* spritetopoffset; 53 | extern word* spriteheight; 54 | 55 | void GL_InitTextures(void); 56 | void GL_UnloadTexture(dtexture* texture); 57 | void GL_SetTextureUnit(int unit, dboolean enable); 58 | void GL_SetTextureMode(int mode); 59 | void GL_SetCombineState(int combine); 60 | void GL_SetCombineStateAlpha(int combine); 61 | void GL_SetEnvColor(float* param); 62 | void GL_SetCombineSourceRGB(int source, int target); 63 | void GL_SetCombineSourceAlpha(int source, int target); 64 | void GL_SetCombineOperandRGB(int operand, int target); 65 | void GL_SetCombineOperandAlpha(int operand, int target); 66 | void GL_BindWorldTexture(int texnum, int *width, int *height); 67 | void GL_BindSpriteTexture(int spritenum, int pal); 68 | int GL_BindGfxTexture(const char* name, dboolean alpha); 69 | int GL_PadTextureDims(int size); 70 | void GL_SetNewPalette(int id, byte palID); 71 | void GL_DumpTextures(void); 72 | void GL_ResetTextures(void); 73 | void GL_BindDummyTexture(void); 74 | void GL_UpdateEnvTexture(rcolor color); 75 | void GL_BindEnvTexture(void); 76 | dtexture GL_ScreenToTexture(void); 77 | void GL_ResampleTexture(unsigned int *in, int inwidth, int inheight, 78 | unsigned int *out, int outwidth, int outheight, 79 | int type); 80 | 81 | #endif 82 | -------------------------------------------------------------------------------- /src/engine/parser/sc_main.h: -------------------------------------------------------------------------------- 1 | // Emacs style mode select -*- C++ -*- 2 | //----------------------------------------------------------------------------- 3 | // 4 | // Copyright(C) 2007-2012 Samuel Villarreal 5 | // 6 | // This program is free software; you can redistribute it and/or 7 | // modify it under the terms of the GNU General Public License 8 | // as published by the Free Software Foundation; either version 2 9 | // of the License, or (at your option) any later version. 10 | // 11 | // This program is distributed in the hope that it will be useful, 12 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | // GNU General Public License for more details. 15 | // 16 | // You should have received a copy of the GNU General Public License 17 | // along with this program; if not, write to the Free Software 18 | // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 19 | // 02111-1307, USA. 20 | // 21 | //----------------------------------------------------------------------------- 22 | 23 | 24 | #ifndef __SC_MAIN__ 25 | #define __SC_MAIN__ 26 | 27 | typedef struct { 28 | char token[512]; 29 | byte* buffer; 30 | char* pointer_start; 31 | char* pointer_end; 32 | int linepos; 33 | int rowpos; 34 | int buffpos; 35 | int buffsize; 36 | void (*open)(const char*); 37 | void (*close)(void); 38 | void (*compare)(const char*); 39 | int (*find)(dboolean); 40 | char(*fgetchar)(void); 41 | void (*rewind)(void); 42 | char* (*getstring)(void); 43 | int (*getint)(void); 44 | int (*setdata)(void*, void*); 45 | int (*readtokens)(void); 46 | void (*error)(const char*); 47 | } scparser_t; 48 | 49 | extern scparser_t sc_parser; 50 | 51 | typedef struct { 52 | const char* token; 53 | ptrdiff_t ptroffset; 54 | char type; 55 | } scdatatable_t; 56 | 57 | void SC_Init(void); 58 | 59 | #endif // __SC_MAIN__ 60 | -------------------------------------------------------------------------------- /src/engine/playloop/Map.cc: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include "Map.hh" 4 | 5 | namespace { 6 | template 7 | void read_into(std::istream& s, T& x) 8 | { 9 | s.read(reinterpret_cast(&x), sizeof(T)); 10 | } 11 | 12 | struct Header { 13 | char id[4]; 14 | uint32 numlumps; 15 | uint32 infotableofs; 16 | }; 17 | 18 | struct Directory { 19 | uint32 filepos; 20 | uint32 size; 21 | char name[8]; 22 | }; 23 | 24 | std::vector _lumps; 25 | } 26 | 27 | void* W_GetMapLump(int lump) 28 | { 29 | return &_lumps[lump][0]; 30 | } 31 | 32 | void W_CacheMapLump(int map) 33 | { 34 | auto file = wad::find(format("MAP{:02d}", map)); 35 | 36 | if (!file) { 37 | fatal("Could not find MAP{:02d}", map); 38 | } 39 | 40 | _lumps.clear(); 41 | 42 | std::istringstream ss(file->as_bytes()); 43 | 44 | Header header; 45 | read_into(ss, header); 46 | 47 | if (memcmp(header.id, "IWAD", 4) != 0 && memcmp(header.id, "PWAD", 4)) { 48 | fatal("MAP{:02d} is an invalid WAD", map); 49 | } 50 | 51 | std::size_t numlumps = header.numlumps; 52 | ss.seekg(header.infotableofs); 53 | for (std::size_t i = 0; !ss.eof() && i < numlumps; ++i) { 54 | Directory dir; 55 | read_into(ss, dir); 56 | 57 | auto pos = ss.tellg(); 58 | ss.seekg(dir.filepos); 59 | _lumps.emplace_back(dir.size, 0); 60 | ss.read(&_lumps.back()[0], dir.size); 61 | ss.seekg(pos); 62 | } 63 | } 64 | 65 | void W_FreeMapLump() 66 | { 67 | // nop 68 | } 69 | 70 | int W_MapLumpLength(int lump) 71 | { 72 | return _lumps[lump].size(); 73 | } 74 | -------------------------------------------------------------------------------- /src/engine/playloop/Map.hh: -------------------------------------------------------------------------------- 1 | // -*- mode: c++ -*- 2 | #ifndef __DOOM64EX_MAP__59976677 3 | #define __DOOM64EX_MAP__59976677 4 | 5 | #include 6 | 7 | void* W_GetMapLump(int lump); 8 | 9 | void W_CacheMapLump(int map); 10 | 11 | void W_FreeMapLump(); 12 | 13 | int W_MapLumpLength(int lump); 14 | 15 | #endif //__DOOM64EX_MAP__59976677 16 | -------------------------------------------------------------------------------- /src/engine/playloop/p_inter.h: -------------------------------------------------------------------------------- 1 | // Emacs style mode select -*- C++ -*- 2 | //----------------------------------------------------------------------------- 3 | // 4 | // Copyright(C) 1993-1997 Id Software, Inc. 5 | // Copyright(C) 2007-2012 Samuel Villarreal 6 | // 7 | // This program is free software; you can redistribute it and/or 8 | // modify it under the terms of the GNU General Public License 9 | // as published by the Free Software Foundation; either version 2 10 | // of the License, or (at your option) any later version. 11 | // 12 | // This program is distributed in the hope that it will be useful, 13 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | // GNU General Public License for more details. 16 | // 17 | // You should have received a copy of the GNU General Public License 18 | // along with this program; if not, write to the Free Software 19 | // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 20 | // 02111-1307, USA. 21 | // 22 | //----------------------------------------------------------------------------- 23 | 24 | 25 | #ifndef __P_INTER__ 26 | #define __P_INTER__ 27 | 28 | 29 | #ifdef __GNUG__ 30 | #pragma interface 31 | #endif 32 | 33 | dboolean P_GivePower(player_t*, int); 34 | dboolean P_GiveWeapon(player_t* player, mobj_t *item, weapontype_t weapon, dboolean dropped); 35 | 36 | 37 | 38 | #endif 39 | -------------------------------------------------------------------------------- /src/engine/playloop/p_macros.h: -------------------------------------------------------------------------------- 1 | // Emacs style mode select -*- C++ -*- 2 | //----------------------------------------------------------------------------- 3 | // 4 | // Copyright(C) 2007-2012 Samuel Villarreal 5 | // 6 | // This program is free software; you can redistribute it and/or 7 | // modify it under the terms of the GNU General Public License 8 | // as published by the Free Software Foundation; either version 2 9 | // of the License, or (at your option) any later version. 10 | // 11 | // This program is distributed in the hope that it will be useful, 12 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | // GNU General Public License for more details. 15 | // 16 | // You should have received a copy of the GNU General Public License 17 | // along with this program; if not, write to the Free Software 18 | // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 19 | // 02111-1307, USA. 20 | // 21 | //----------------------------------------------------------------------------- 22 | 23 | #ifndef __P_MACROS__ 24 | #define __P_MACROS__ 25 | 26 | 27 | #ifdef __GNUG__ 28 | #pragma interface 29 | #endif 30 | 31 | #define MAXQUEUELIST 16 32 | 33 | extern int taglist[MAXQUEUELIST]; 34 | extern int taglistidx; 35 | 36 | void P_QueueSpecial(mobj_t* mobj); 37 | 38 | extern thinker_t *macrothinker; 39 | extern macrodef_t *macro; 40 | extern macrodata_t *nextmacro; 41 | extern mobj_t *mobjmacro; 42 | extern short macrocounter; 43 | extern short macroid; 44 | 45 | void P_InitMacroVars(void); 46 | void P_ToggleMacros(int tag, dboolean toggleon); 47 | void P_MacroDetachThinker(thinker_t *thinker); 48 | void P_RunMacros(void); 49 | 50 | int P_StartMacro(mobj_t *thing, line_t *line); 51 | int P_SuspendMacro(int tag); 52 | int P_InitMacroCounter(int counts); 53 | 54 | #endif -------------------------------------------------------------------------------- /src/engine/playloop/p_pspr.h: -------------------------------------------------------------------------------- 1 | // Emacs style mode select -*- C++ -*- 2 | //----------------------------------------------------------------------------- 3 | // 4 | // Copyright(C) 1993-1997 Id Software, Inc. 5 | // Copyright(C) 1997 Midway Home Entertainment, Inc 6 | // Copyright(C) 2007-2012 Samuel Villarreal 7 | // 8 | // This program is free software; you can redistribute it and/or 9 | // modify it under the terms of the GNU General Public License 10 | // as published by the Free Software Foundation; either version 2 11 | // of the License, or (at your option) any later version. 12 | // 13 | // This program is distributed in the hope that it will be useful, 14 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | // GNU General Public License for more details. 17 | // 18 | // You should have received a copy of the GNU General Public License 19 | // along with this program; if not, write to the Free Software 20 | // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 21 | // 02111-1307, USA. 22 | // 23 | //----------------------------------------------------------------------------- 24 | 25 | 26 | #ifndef __P_PSPR__ 27 | #define __P_PSPR__ 28 | 29 | #include "doomdef.h" 30 | // Basic data types. 31 | // Needs fixed point, and BAM angles. 32 | //#include "m_fixed.h" 33 | #include "tables.h" 34 | // 35 | // Needs to include the precompiled 36 | // sprite animation tables. 37 | // Header generated by multigen utility. 38 | // This includes all the data for thing animation, 39 | // i.e. the Thing Atrributes table 40 | // and the Frame Sequence table. 41 | #include "info.h" 42 | #include "m_fixed.h" 43 | 44 | #ifdef __GNUG__ 45 | #pragma interface 46 | #endif 47 | 48 | // 49 | // Frame flags: 50 | // handles maximum brightness (torches, muzzle flare, light sources) 51 | // 52 | 53 | #define FF_FULLBRIGHT 0x8000 // flag in thing->frame 54 | #define FF_FRAMEMASK 0x7fff 55 | 56 | 57 | 58 | // 59 | // Overlay psprites are scaled shapes 60 | // drawn directly on the view screen, 61 | // coordinates are given for a 320*200 view screen. 62 | // 63 | typedef enum { 64 | ps_weapon, 65 | ps_flash, 66 | NUMPSPRITES 67 | 68 | } psprnum_t; 69 | 70 | typedef struct { 71 | state_t* state; // a NULL state means not active 72 | int tics; 73 | fixed_t sx; 74 | fixed_t sy; 75 | int alpha; // [d64] for rendering 76 | 77 | // [kex] stuff that happens in between tics 78 | fixed_t frame_x; 79 | fixed_t frame_y; 80 | 81 | } pspdef_t; 82 | 83 | typedef struct { 84 | ammotype_t ammo; 85 | int upstate; 86 | int downstate; 87 | int readystate; 88 | int atkstate; 89 | int flashstate; 90 | 91 | } weaponinfo_t; 92 | 93 | // Weapon info: sprite frames, ammunition use. 94 | extern weaponinfo_t weaponinfo[NUMWEAPONS]; 95 | 96 | #endif 97 | -------------------------------------------------------------------------------- /src/engine/playloop/p_saveg.h: -------------------------------------------------------------------------------- 1 | // Emacs style mode select -*- C++ -*- 2 | //----------------------------------------------------------------------------- 3 | // 4 | // Copyright(C) 1993-1997 Id Software, Inc. 5 | // Copyright(C) 2005 Simon Howard 6 | // Copyright(C) 2007-2012 Samuel Villarreal 7 | // 8 | // This program is free software; you can redistribute it and/or 9 | // modify it under the terms of the GNU General Public License 10 | // as published by the Free Software Foundation; either version 2 11 | // of the License, or (at your option) any later version. 12 | // 13 | // This program is distributed in the hope that it will be useful, 14 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | // GNU General Public License for more details. 17 | // 18 | // You should have received a copy of the GNU General Public License 19 | // along with this program; if not, write to the Free Software 20 | // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 21 | // 02111-1307, USA. 22 | // 23 | //----------------------------------------------------------------------------- 24 | 25 | 26 | #ifndef __P_SAVEG__ 27 | #define __P_SAVEG__ 28 | 29 | 30 | #ifdef __GNUG__ 31 | #pragma interface 32 | #endif 33 | 34 | #define SAVEGAMESIZE 0x60000 35 | #define SAVEGAMETBSIZE 0xC000 36 | #define SAVESTRINGSIZE 16 37 | 38 | char *P_GetSaveGameName(int num); 39 | dboolean P_WriteSaveGame(char* description, int slot); 40 | dboolean P_ReadSaveGame(char* name); 41 | dboolean P_QuickReadSaveHeader(char* name, char* date, int* thumbnail, int* skill, int* map); 42 | 43 | // Persistent storage/archiving. 44 | // These are the load / save game routines. 45 | void P_ArchivePlayers(void); 46 | void P_UnArchivePlayers(void); 47 | void P_ArchiveWorld(void); 48 | void P_UnArchiveWorld(void); 49 | void P_ArchiveMobjs(void); 50 | void P_UnArchiveMobjs(void); 51 | void P_ArchiveSpecials(void); 52 | void P_UnArchiveSpecials(void); 53 | void P_ArchiveMacros(void); 54 | void P_UnArchiveMacros(void); 55 | 56 | #endif 57 | -------------------------------------------------------------------------------- /src/engine/playloop/p_setup.h: -------------------------------------------------------------------------------- 1 | // Emacs style mode select -*- C++ -*- 2 | //----------------------------------------------------------------------------- 3 | // 4 | // Copyright(C) 1993-1997 Id Software, Inc. 5 | // Copyright(C) 2007-2012 Samuel Villarreal 6 | // 7 | // This program is free software; you can redistribute it and/or 8 | // modify it under the terms of the GNU General Public License 9 | // as published by the Free Software Foundation; either version 2 10 | // of the License, or (at your option) any later version. 11 | // 12 | // This program is distributed in the hope that it will be useful, 13 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | // GNU General Public License for more details. 16 | // 17 | // You should have received a copy of the GNU General Public License 18 | // along with this program; if not, write to the Free Software 19 | // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 20 | // 02111-1307, USA. 21 | // 22 | //----------------------------------------------------------------------------- 23 | 24 | 25 | #ifndef __P_SETUP__ 26 | #define __P_SETUP__ 27 | 28 | 29 | #ifdef __GNUG__ 30 | #pragma interface 31 | #endif 32 | 33 | 34 | // NOT called by W_Ticker. Fixme. 35 | void P_SetupLevel(int map, int playermask, skill_t skill); 36 | 37 | // Called by startup code. 38 | void P_Init(void); 39 | 40 | 41 | // 42 | // [kex] mapinfo 43 | // 44 | mapdef_t* P_GetMapInfo(int map); 45 | clusterdef_t* P_GetCluster(int map); 46 | 47 | // 48 | // [kex] sky definitions 49 | // 50 | typedef enum { 51 | SKF_CLOUD = 0x1, 52 | SKF_THUNDER = 0x2, 53 | SKF_FIRE = 0x4, 54 | SKF_BACKGROUND = 0x8, 55 | SKF_FADEBACK = 0x10, 56 | SKF_VOID = 0x20 57 | } skyflags_e; 58 | 59 | typedef struct { 60 | char flat[9]; 61 | int flags; 62 | char pic[9]; 63 | char backdrop[9]; 64 | rcolor fogcolor; 65 | rcolor skycolor[3]; 66 | int fognear; 67 | } skydef_t; 68 | 69 | #endif 70 | -------------------------------------------------------------------------------- /src/engine/playloop/p_tick.h: -------------------------------------------------------------------------------- 1 | // Emacs style mode select -*- C++ -*- 2 | //----------------------------------------------------------------------------- 3 | // 4 | // Copyright(C) 1993-1997 Id Software, Inc. 5 | // Copyright(C) 2007-2012 Samuel Villarreal 6 | // 7 | // This program is free software; you can redistribute it and/or 8 | // modify it under the terms of the GNU General Public License 9 | // as published by the Free Software Foundation; either version 2 10 | // of the License, or (at your option) any later version. 11 | // 12 | // This program is distributed in the hope that it will be useful, 13 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | // GNU General Public License for more details. 16 | // 17 | // You should have received a copy of the GNU General Public License 18 | // along with this program; if not, write to the Free Software 19 | // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 20 | // 02111-1307, USA. 21 | // 22 | //----------------------------------------------------------------------------- 23 | 24 | 25 | #ifndef __P_TICK__ 26 | #define __P_TICK__ 27 | 28 | 29 | #ifdef __GNUG__ 30 | #pragma interface 31 | #endif 32 | 33 | void P_Start(void); 34 | void P_Stop(void); 35 | void P_Drawer(void); 36 | 37 | // Called by C_Ticker, 38 | // can call G_PlayerExited. 39 | // Carries out all thinking of monsters and players. 40 | bool P_Ticker(void); 41 | 42 | 43 | 44 | #endif 45 | -------------------------------------------------------------------------------- /src/engine/renderer/r_clipper.h: -------------------------------------------------------------------------------- 1 | // Emacs style mode select -*- C++ -*- 2 | //----------------------------------------------------------------------------- 3 | // 4 | // Copyright(C) 2003 Tim Stump 5 | // Copyright(C) 2007-2012 Samuel Villarreal 6 | // 7 | // This program is free software; you can redistribute it and/or 8 | // modify it under the terms of the GNU General Public License 9 | // as published by the Free Software Foundation; either version 2 10 | // of the License, or (at your option) any later version. 11 | // 12 | // This program is distributed in the hope that it will be useful, 13 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | // GNU General Public License for more details. 16 | // 17 | // You should have received a copy of the GNU General Public License 18 | // along with this program; if not, write to the Free Software 19 | // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 20 | // 02111-1307, USA. 21 | // 22 | //----------------------------------------------------------------------------- 23 | 24 | #ifndef R_CLIPPER_H 25 | #define R_CLIPPER_H 26 | 27 | dboolean R_Clipper_SafeCheckRange(angle_t startAngle, angle_t endAngle); 28 | void R_Clipper_SafeAddClipRange(angle_t startangle, angle_t endangle); 29 | void R_Clipper_Clear(void); 30 | 31 | extern float frustum[6][4]; 32 | 33 | angle_t R_FrustumAngle(void); 34 | void R_FrustrumSetup(void); 35 | dboolean R_FrustrumTestVertex(vtx_t* vertex, int count); 36 | 37 | #endif -------------------------------------------------------------------------------- /src/engine/renderer/r_drawlist.h: -------------------------------------------------------------------------------- 1 | // Emacs style mode select -*- C++ -*- 2 | //----------------------------------------------------------------------------- 3 | // 4 | // Copyright(C) 2007-2012 Samuel Villarreal 5 | // 6 | // This program is free software; you can redistribute it and/or 7 | // modify it under the terms of the GNU General Public License 8 | // as published by the Free Software Foundation; either version 2 9 | // of the License, or (at your option) any later version. 10 | // 11 | // This program is distributed in the hope that it will be useful, 12 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | // GNU General Public License for more details. 15 | // 16 | // You should have received a copy of the GNU General Public License 17 | // along with this program; if not, write to the Free Software 18 | // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 19 | // 02111-1307, USA. 20 | // 21 | //----------------------------------------------------------------------------- 22 | 23 | #ifndef _R_DRAWLIST_H_ 24 | #define _R_DRAWLIST_H_ 25 | 26 | #include "doomtype.h" 27 | #include "doomdef.h" 28 | #include "gl_main.h" 29 | #include "r_things.h" 30 | 31 | typedef enum { 32 | DLF_GLOW = 0x1, 33 | DLF_WATER1 = 0x2, 34 | DLF_CEILING = 0x4, 35 | DLF_MIRRORS = 0x8, 36 | DLF_MIRRORT = 0x10, 37 | DLF_WATER2 = 0x20 38 | } drawlistflag_e; 39 | 40 | typedef enum { 41 | DLT_WALL, 42 | DLT_FLAT, 43 | DLT_SPRITE, 44 | DLT_AMAP, 45 | NUMDRAWLISTS 46 | } drawlisttag_e; 47 | 48 | typedef struct { 49 | void *data; 50 | dboolean(*callback)(void*, vtx_t*); 51 | dtexture texid; 52 | int flags; 53 | int params; 54 | } vtxlist_t; 55 | 56 | typedef struct { 57 | vtxlist_t *list; 58 | int index; 59 | int max; 60 | } drawlist_t; 61 | 62 | extern drawlist_t drawlist[NUMDRAWLISTS]; 63 | 64 | #define MAXDLDRAWCOUNT 0x10000 65 | extern vtx_t drawVertex[MAXDLDRAWCOUNT]; 66 | 67 | dboolean DL_ProcessWalls(vtxlist_t* vl, int* drawcount); 68 | dboolean DL_ProcessLeafs(vtxlist_t* vl, int* drawcount); 69 | dboolean DL_ProcessSprites(vtxlist_t* vl, int* drawcount); 70 | 71 | vtxlist_t *DL_AddVertexList(drawlist_t *dl); 72 | int DL_GetDrawListSize(int tag); 73 | void DL_BeginDrawList(dboolean t, dboolean a); 74 | void DL_ProcessDrawList(int tag, dboolean(*procfunc)(vtxlist_t*, int*)); 75 | void DL_RenderDrawList(void); 76 | void DL_Init(void); 77 | 78 | #endif 79 | 80 | -------------------------------------------------------------------------------- /src/engine/renderer/r_lights.h: -------------------------------------------------------------------------------- 1 | // Emacs style mode select -*- C++ -*- 2 | //----------------------------------------------------------------------------- 3 | // 4 | // Copyright(C) 1997 Midway Home Entertainment, Inc 5 | // Copyright(C) 2007-2012 Samuel Villarreal 6 | // 7 | // This program is free software; you can redistribute it and/or 8 | // modify it under the terms of the GNU General Public License 9 | // as published by the Free Software Foundation; either version 2 10 | // of the License, or (at your option) any later version. 11 | // 12 | // This program is distributed in the hope that it will be useful, 13 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | // GNU General Public License for more details. 16 | // 17 | // You should have received a copy of the GNU General Public License 18 | // along with this program; if not, write to the Free Software 19 | // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 20 | // 02111-1307, USA. 21 | // 22 | //----------------------------------------------------------------------------- 23 | 24 | #ifndef D3DR_LIGHTS_H 25 | #define D3DR_LIGHTS_H 26 | 27 | #include "r_local.h" 28 | 29 | enum { 30 | LIGHT_FLOOR, 31 | LIGHT_CEILING, 32 | LIGHT_THING, 33 | LIGHT_UPRWALL, 34 | LIGHT_LWRWALL 35 | }; 36 | 37 | extern rcolor bspColor[5]; 38 | 39 | rcolor R_GetSectorLight(byte alpha, word ptr); 40 | void R_SetLightFactor(float lightfactor); 41 | void R_RefreshBrightness(void); 42 | void R_LightToVertex(vtx_t *v, int idx, word c); 43 | void R_SetSegLineColor(seg_t *line, vtx_t* v, byte side); 44 | 45 | #endif -------------------------------------------------------------------------------- /src/engine/renderer/r_local.h: -------------------------------------------------------------------------------- 1 | // Emacs style mode select -*- C++ -*- 2 | //----------------------------------------------------------------------------- 3 | // 4 | // Copyright(C) 1993-1997 Id Software, Inc. 5 | // Copyright(C) 2007-2012 Samuel Villarreal 6 | // 7 | // This program is free software; you can redistribute it and/or 8 | // modify it under the terms of the GNU General Public License 9 | // as published by the Free Software Foundation; either version 2 10 | // of the License, or (at your option) any later version. 11 | // 12 | // This program is distributed in the hope that it will be useful, 13 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | // GNU General Public License for more details. 16 | // 17 | // You should have received a copy of the GNU General Public License 18 | // along with this program; if not, write to the Free Software 19 | // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 20 | // 02111-1307, USA. 21 | // 22 | //----------------------------------------------------------------------------- 23 | 24 | #ifndef D3DR_LOCAL_H 25 | #define D3DR_LOCAL_H 26 | 27 | #include "r_main.h" 28 | #include "r_things.h" 29 | #include "r_lights.h" 30 | 31 | #endif -------------------------------------------------------------------------------- /src/engine/renderer/r_main.h: -------------------------------------------------------------------------------- 1 | // Emacs style mode select -*- C++ -*- 2 | //----------------------------------------------------------------------------- 3 | // 4 | // Copyright(C) 1993-1997 Id Software, Inc. 5 | // Copyright(C) 2007-2012 Samuel Villarreal 6 | // 7 | // This program is free software; you can redistribute it and/or 8 | // modify it under the terms of the GNU General Public License 9 | // as published by the Free Software Foundation; either version 2 10 | // of the License, or (at your option) any later version. 11 | // 12 | // This program is distributed in the hope that it will be useful, 13 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | // GNU General Public License for more details. 16 | // 17 | // You should have received a copy of the GNU General Public License 18 | // along with this program; if not, write to the Free Software 19 | // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 20 | // 02111-1307, USA. 21 | // 22 | //----------------------------------------------------------------------------- 23 | 24 | #ifndef D3DR_MAIN_H 25 | #define D3DR_MAIN_H 26 | 27 | #include 28 | 29 | #include "t_bsp.h" 30 | #include "d_player.h" 31 | #include "gl_main.h" 32 | 33 | extern fixed_t viewx; 34 | extern fixed_t viewy; 35 | extern fixed_t viewz; 36 | extern float fviewx; 37 | extern float fviewy; 38 | extern float fviewz; 39 | extern angle_t viewangle; 40 | extern angle_t viewpitch; 41 | extern fixed_t quakeviewx; 42 | extern fixed_t quakeviewy; 43 | extern angle_t viewangleoffset; 44 | extern rcolor flashcolor; 45 | 46 | extern float viewsin[2]; 47 | extern float viewcos[2]; 48 | extern float viewoffset; 49 | extern int skytexture; 50 | extern player_t *renderplayer; 51 | extern int logoAlpha; 52 | extern fixed_t scrollfrac; 53 | extern int vertCount; 54 | 55 | extern unsigned int renderTic; 56 | extern unsigned int spriteRenderTic; 57 | extern unsigned int glBindCalls; 58 | 59 | extern dboolean bRenderSky; 60 | 61 | extern FloatProperty r_fov; 62 | extern BoolProperty r_fillmode; 63 | extern BoolProperty r_uniformtime; 64 | extern BoolProperty r_drawtrace; 65 | 66 | void R_Init(void); 67 | void R_RenderPlayerView(player_t *player); 68 | subsector_t *R_PointInSubsector(fixed_t x, fixed_t y); 69 | angle_t R_PointToAngle2(fixed_t x1, fixed_t y1, fixed_t x2, fixed_t y2); 70 | angle_t R_PointToAngle(fixed_t x, fixed_t y);//note difference from sw version 71 | angle_t R_PointToPitch(fixed_t z1, fixed_t z2, fixed_t dist); 72 | void R_PrecacheLevel(void); 73 | int R_PointOnSide(fixed_t x, fixed_t y, node_t *node); 74 | fixed_t R_Interpolate(fixed_t ticframe, fixed_t updateframe, dboolean enable); 75 | void R_SetupLevel(void); 76 | void R_SetViewAngleOffset(angle_t angle); 77 | void R_SetViewOffset(int offset); 78 | void R_DrawWireframe(dboolean enable); //villsa 79 | void R_SetViewMatrix(void); 80 | void R_RenderWorld(void); 81 | void R_RenderBSPNode(int bspnum); 82 | void R_AllocSubsectorBuffer(void); 83 | 84 | #endif 85 | -------------------------------------------------------------------------------- /src/engine/renderer/r_sky.h: -------------------------------------------------------------------------------- 1 | // Emacs style mode select -*- C++ -*- 2 | //----------------------------------------------------------------------------- 3 | // 4 | // Copyright(C) 1993-1997 Id Software, Inc. 5 | // Copyright(C) 1997 Midway Home Entertainment, Inc 6 | // Copyright(C) 2007-2012 Samuel Villarreal 7 | // 8 | // This program is free software; you can redistribute it and/or 9 | // modify it under the terms of the GNU General Public License 10 | // as published by the Free Software Foundation; either version 2 11 | // of the License, or (at your option) any later version. 12 | // 13 | // This program is distributed in the hope that it will be useful, 14 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | // GNU General Public License for more details. 17 | // 18 | // You should have received a copy of the GNU General Public License 19 | // along with this program; if not, write to the Free Software 20 | // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 21 | // 02111-1307, USA. 22 | // 23 | //----------------------------------------------------------------------------- 24 | 25 | #ifndef D3DR_SKY_H 26 | #define D3DR_SKY_H 27 | 28 | #include "p_setup.h" 29 | 30 | extern skydef_t* sky; 31 | extern int skypicnum; 32 | extern int skybackdropnum; 33 | extern int thunderCounter; 34 | extern int lightningCounter; 35 | extern int thundertic; 36 | extern dboolean skyfadeback; 37 | 38 | // Needed to store the number of the dummy sky flat. 39 | // Used for rendering, as well as tracking projectiles etc. 40 | extern int skyflatnum; 41 | 42 | extern int fireLump; 43 | 44 | void R_SkyTicker(void); 45 | void R_DrawSky(void); 46 | void R_InitFire(void); 47 | 48 | #endif 49 | -------------------------------------------------------------------------------- /src/engine/renderer/r_things.h: -------------------------------------------------------------------------------- 1 | // Emacs style mode select -*- C++ -*- 2 | //----------------------------------------------------------------------------- 3 | // 4 | // Copyright(C) 1993-1997 Id Software, Inc. 5 | // Copyright(C) 2007-2012 Samuel Villarreal 6 | // 7 | // This program is free software; you can redistribute it and/or 8 | // modify it under the terms of the GNU General Public License 9 | // as published by the Free Software Foundation; either version 2 10 | // of the License, or (at your option) any later version. 11 | // 12 | // This program is distributed in the hope that it will be useful, 13 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | // GNU General Public License for more details. 16 | // 17 | // You should have received a copy of the GNU General Public License 18 | // along with this program; if not, write to the Free Software 19 | // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 20 | // 02111-1307, USA. 21 | // 22 | //----------------------------------------------------------------------------- 23 | 24 | #ifndef _R_THINGS_H_ 25 | #define _R_THINGS_H_ 26 | 27 | #include "doomtype.h" 28 | #include "doomdef.h" 29 | #include "t_bsp.h" 30 | #include "d_player.h" 31 | #include "gl_main.h" 32 | 33 | typedef struct { 34 | mobj_t* spr; 35 | fixed_t dist; 36 | float x; 37 | float y; 38 | float z; 39 | } visspritelist_t; 40 | 41 | void R_InitSprites(const char** namelist); 42 | void R_AddSprites(subsector_t *sub); 43 | void R_SetupSprites(void); 44 | void R_ClearSprites(void); 45 | void R_RenderPlayerSprites(player_t *player); 46 | void R_DrawThingBBox(void); 47 | 48 | extern spritedef_t *spriteinfo; 49 | extern int numsprites; 50 | 51 | #endif 52 | -------------------------------------------------------------------------------- /src/engine/renderer/r_wipe.h: -------------------------------------------------------------------------------- 1 | // Emacs style mode select -*- C++ -*- 2 | //----------------------------------------------------------------------------- 3 | // 4 | // Copyright(C) 1997 Midway Home Entertainment, Inc 5 | // Copyright(C) 2007-2012 Samuel Villarreal 6 | // 7 | // This program is free software; you can redistribute it and/or 8 | // modify it under the terms of the GNU General Public License 9 | // as published by the Free Software Foundation; either version 2 10 | // of the License, or (at your option) any later version. 11 | // 12 | // This program is distributed in the hope that it will be useful, 13 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | // GNU General Public License for more details. 16 | // 17 | // You should have received a copy of the GNU General Public License 18 | // along with this program; if not, write to the Free Software 19 | // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 20 | // 02111-1307, USA. 21 | // 22 | //----------------------------------------------------------------------------- 23 | 24 | #ifndef D3DF_WIPE_H 25 | #define D3DF_WIPE_H 26 | 27 | void WIPE_FadeScreen(int fadetics); 28 | void WIPE_MeltScreen(void); 29 | 30 | #endif -------------------------------------------------------------------------------- /src/engine/sound/s_sound.h: -------------------------------------------------------------------------------- 1 | // Emacs style mode select -*- C++ -*- 2 | //----------------------------------------------------------------------------- 3 | // 4 | // Copyright(C) 1993-1997 Id Software, Inc. 5 | // Copyright(C) 2007-2012 Samuel Villarreal 6 | // 7 | // This program is free software; you can redistribute it and/or 8 | // modify it under the terms of the GNU General Public License 9 | // as published by the Free Software Foundation; either version 2 10 | // of the License, or (at your option) any later version. 11 | // 12 | // This program is distributed in the hope that it will be useful, 13 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | // GNU General Public License for more details. 16 | // 17 | // You should have received a copy of the GNU General Public License 18 | // along with this program; if not, write to the Free Software 19 | // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 20 | // 02111-1307, USA. 21 | // 22 | //----------------------------------------------------------------------------- 23 | 24 | 25 | #ifndef __S_SOUND__ 26 | #define __S_SOUND__ 27 | 28 | 29 | #ifdef __GNUG__ 30 | #pragma interface 31 | #endif 32 | 33 | #include "p_mobj.h" 34 | #include "sounds.h" 35 | 36 | // 37 | // Initializes sound stuff, including volume 38 | // Sets channels, SFX and music volume, 39 | // allocates channel buffer 40 | // 41 | void S_Init(void); 42 | 43 | void S_SetSoundVolume(float volume); 44 | void S_SetMusicVolume(float volume); 45 | void S_SetGainOutput(float db); 46 | 47 | void S_ResetSound(void); 48 | void S_PauseSound(void); 49 | void S_ResumeSound(void); 50 | 51 | // 52 | // Start sound for thing at 53 | // using from sounds.h 54 | // 55 | void S_StartSound(mobj_t* origin, int sound_id); 56 | 57 | void S_UpdateSounds(void); 58 | void S_RemoveOrigin(mobj_t* origin); 59 | 60 | // Will start a sound at a given volume. 61 | void S_StartSoundAtVolume(mobj_t* origin, int sound_id, int volume); 62 | 63 | // Stop sound for thing at 64 | void S_StopSound(mobj_t* origin, int sfx_id); 65 | 66 | int S_GetActiveSounds(void); 67 | 68 | 69 | // Start music using from sounds.h 70 | void S_StartMusic(int mnum); 71 | void S_StopMusic(void); 72 | 73 | 74 | 75 | #endif 76 | -------------------------------------------------------------------------------- /src/engine/statusbar/st_stuff.h: -------------------------------------------------------------------------------- 1 | // Emacs style mode select -*- C++ -*- 2 | //----------------------------------------------------------------------------- 3 | // 4 | // Copyright(C) 1993-1997 Id Software, Inc. 5 | // Copyright(C) 1997 Midway Home Entertainment, Inc 6 | // Copyright(C) 2007-2012 Samuel Villarreal 7 | // 8 | // This program is free software; you can redistribute it and/or 9 | // modify it under the terms of the GNU General Public License 10 | // as published by the Free Software Foundation; either version 2 11 | // of the License, or (at your option) any later version. 12 | // 13 | // This program is distributed in the hope that it will be useful, 14 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | // GNU General Public License for more details. 17 | // 18 | // You should have received a copy of the GNU General Public License 19 | // along with this program; if not, write to the Free Software 20 | // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 21 | // 02111-1307, USA. 22 | // 23 | //----------------------------------------------------------------------------- 24 | 25 | #ifndef __STSTUFF_H__ 26 | #define __STSTUFF_H__ 27 | 28 | #include "doomtype.h" 29 | #include "d_event.h" 30 | #include "p_mobj.h" 31 | 32 | #include "net_client.h" 33 | 34 | // 35 | // STATUS BAR 36 | // 37 | 38 | // Called by main loop. 39 | dboolean ST_Responder(event_t* ev); 40 | 41 | // Called by main loop. 42 | void ST_Ticker(void); 43 | void ST_ClearMessage(void); 44 | 45 | // Called when the console player is spawned on each level. 46 | void ST_Start(void); 47 | 48 | // Called by startup code. 49 | void ST_Init(void); 50 | void ST_AddChatMsg(const char *msg, int player); 51 | void ST_Notification(const char *msg); 52 | void ST_Drawer(void); 53 | void ST_FlashingScreen(byte r, byte g, byte b, byte a); 54 | char ST_DequeueChatChar(void); 55 | void ST_DrawCrosshair(int x, int y, int slot, byte scalefactor, rcolor color); 56 | void ST_UpdateFlash(void); 57 | void ST_AddDamageMarker(mobj_t* target, mobj_t* source); 58 | void ST_ClearDamageMarkers(void); 59 | void ST_DisplayPendingWeapon(void); 60 | 61 | extern char player_names[MAXPLAYERS][MAXPLAYERNAME]; 62 | extern dboolean st_chatOn; 63 | extern int st_crosshairs; 64 | 65 | 66 | #endif 67 | -------------------------------------------------------------------------------- /src/engine/system/i_audio.h: -------------------------------------------------------------------------------- 1 | // Emacs style mode select -*- C++ -*- 2 | //----------------------------------------------------------------------------- 3 | // 4 | // Copyright(C) 2007-2012 Samuel Villarreal 5 | // 6 | // This program is free software; you can redistribute it and/or 7 | // modify it under the terms of the GNU General Public License 8 | // as published by the Free Software Foundation; either version 2 9 | // of the License, or (at your option) any later version. 10 | // 11 | // This program is distributed in the hope that it will be useful, 12 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | // GNU General Public License for more details. 15 | // 16 | // You should have received a copy of the GNU General Public License 17 | // along with this program; if not, write to the Free Software 18 | // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 19 | // 02111-1307, USA. 20 | // 21 | //----------------------------------------------------------------------------- 22 | 23 | #ifndef __I_AUDIO_H__ 24 | #define __I_AUDIO_H__ 25 | 26 | // 20120107 bkw: Linux users can change the default FluidSynth backend here: 27 | #ifndef _WIN32 28 | #define DEFAULT_FLUID_DRIVER "sndio" 29 | 30 | // 20120203 villsa: add default for windows 31 | #else 32 | #define DEFAULT_FLUID_DRIVER "dsound" 33 | 34 | #endif 35 | 36 | typedef struct { 37 | fixed_t x; 38 | fixed_t y; 39 | fixed_t z; 40 | } sndsrc_t; 41 | 42 | int I_GetMaxChannels(void); 43 | int I_GetVoiceCount(void); 44 | sndsrc_t* I_GetSoundSource(int c); 45 | 46 | void I_InitSequencer(void); 47 | void I_ShutdownSound(void); 48 | void I_UpdateChannel(int c, int volume, int pan); 49 | void I_RemoveSoundSource(int c); 50 | void I_SetMusicVolume(float volume); 51 | void I_SetSoundVolume(float volume); 52 | void I_ResetSound(void); 53 | void I_PauseSound(void); 54 | void I_ResumeSound(void); 55 | void I_SetGain(float db); 56 | void I_StopSound(sndsrc_t* origin, int sfx_id); 57 | void I_StartMusic(int mus_id); 58 | void I_StartSound(int sfx_id, sndsrc_t* origin, int volume, int pan, int reverb); 59 | 60 | #endif // __I_AUDIO_H__ 61 | -------------------------------------------------------------------------------- /src/engine/system/i_cpu_posix.cc: -------------------------------------------------------------------------------- 1 | // Emacs style mode select -*- C++ -*- 2 | //----------------------------------------------------------------------------- 3 | // 4 | // Copyright(C) 2009 James Haley 5 | // 6 | // Derived from Chocolate Doom 7 | // Copyright 2009 Simon Howard 8 | // 9 | // Derived from PrBoom 10 | // Copyright 2006 Florian Schulze, Colin Phipps, Neil Stevens, Andrey Budko 11 | // 12 | // This program is free software; you can redistribute it and/or modify 13 | // it under the terms of the GNU General Public License as published by 14 | // the Free Software Foundation; either version 2 of the License, or 15 | // (at your option) any later version. 16 | // 17 | // This program is distributed in the hope that it will be useful, 18 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 19 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 20 | // GNU General Public License for more details. 21 | // 22 | // You should have received a copy of the GNU General Public License 23 | // along with this program; if not, write to the Free Software 24 | // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 25 | // 26 | //---------------------------------------------------------------------------- 27 | // 28 | // DESCRIPTION: 29 | // 30 | // CPU-related system-specific module for POSIX systems 31 | // 32 | //----------------------------------------------------------------------------- 33 | 34 | #include 35 | #include 36 | 37 | #ifdef HAVE_SCHED_SETAFFINITY 38 | #include 39 | #include 40 | #endif 41 | 42 | // cannot include DOOM headers here; required externs: 43 | extern void I_Printf(const char* string, ...); 44 | extern int M_CheckParm(const char *); 45 | extern int datoi(const char *str); 46 | extern int myargc; 47 | extern char** myargv; 48 | 49 | unsigned int process_affinity_mask; 50 | 51 | // 52 | // I_SetAffinityMask 53 | // 54 | // Due to ongoing problems with the SDL_mixer library and/or the SDL audio 55 | // core, it is necessary to support the restriction of Eternity to a single 56 | // core or CPU. Apparent thread contention issues cause the library to 57 | // malfunction if multiple threads of the process run simultaneously. 58 | // 59 | // I wish SDL would fix their bullshit already. 60 | // 61 | void I_SetAffinityMask(void) { 62 | #ifdef HAVE_SCHED_SETAFFINITY 63 | int p = M_CheckParm("-affinity"); 64 | 65 | if(p && p < myargc - 1) { 66 | process_affinity_mask = datoi(myargv[p + 1]); 67 | } 68 | else { 69 | process_affinity_mask = 0; 70 | } 71 | 72 | // Set the process affinity mask so that all threads 73 | // run on the same processor. This is a workaround for a bug in 74 | // SDL_mixer that causes occasional crashes. 75 | if(process_affinity_mask) { 76 | int i; 77 | cpu_set_t set; 78 | 79 | CPU_ZERO(&set); 80 | 81 | for(i = 0; i < 16; ++i) { 82 | CPU_SET((process_affinity_mask>>i)&1, &set); 83 | } 84 | 85 | if(sched_setaffinity(getpid(), sizeof(set), &set) == -1) { 86 | I_Printf("I_SetAffinityMask: failed to set process affinity mask.\n"); 87 | } 88 | else { 89 | I_Printf("I_SetAffinityMask: applied affinity mask.\n"); 90 | } 91 | } 92 | #endif 93 | } 94 | 95 | // EOF 96 | 97 | -------------------------------------------------------------------------------- /src/engine/system/i_opndir.h: -------------------------------------------------------------------------------- 1 | // Emacs style mode select -*- C++ -*- 2 | //----------------------------------------------------------------------------- 3 | // 4 | // Copyright(C) 2006 James Haley 5 | // 6 | // This program is free software; you can redistribute it and/or modify 7 | // it under the terms of the GNU General Public License as published by 8 | // the Free Software Foundation; either version 2 of the License, or 9 | // (at your option) any later version. 10 | // 11 | // This program is distributed in the hope that it will be useful, 12 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | // GNU General Public License for more details. 15 | // 16 | // You should have received a copy of the GNU General Public License 17 | // along with this program; if not, write to the Free Software 18 | // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 19 | // 20 | //---------------------------------------------------------------------------- 21 | // 22 | // DESCRIPTION: 23 | // 24 | // Implementation of POSIX opendir for Visual C++. 25 | // Derived from the MinGW C Library Extensions Source (released to the 26 | // public domain). 27 | // 28 | //----------------------------------------------------------------------------- 29 | 30 | //Villsa: Implemented for Doom64EX 31 | 32 | #ifndef I_OPNDIR_H__ 33 | #define I_OPNDIR_H__ 34 | 35 | #ifdef _MSC_VER 36 | 37 | #include 38 | #include 39 | #define F_OK 0 40 | #define W_OK 2 41 | #define R_OK 4 42 | #define S_ISDIR(x) (((sbuf.st_mode & S_IFDIR)==S_IFDIR)?1:0) 43 | #ifndef TRUE 44 | #define TRUE true 45 | #endif 46 | #ifndef FALSE 47 | #define FALSE false 48 | #endif 49 | #define strcasecmp _stricmp 50 | #define strncasecmp _strnicmp 51 | #ifndef PATH_MAX 52 | #define PATH_MAX _MAX_PATH 53 | #endif 54 | 55 | #else 56 | #include 57 | #endif 58 | 59 | #ifndef FILENAME_MAX 60 | #define FILENAME_MAX 260 61 | #endif 62 | 63 | struct dirent { 64 | long d_ino; /* Always zero. */ 65 | unsigned short d_reclen; /* Always zero. */ 66 | unsigned short d_namlen; /* Length of name in d_name. */ 67 | char d_name[FILENAME_MAX]; /* File name. */ 68 | }; 69 | 70 | /* 71 | * This is an internal data structure. Good programmers will not use it 72 | * except as an argument to one of the functions below. 73 | * dd_stat field is now int (was short in older versions). 74 | */ 75 | typedef struct { 76 | /* disk transfer area for this dir */ 77 | struct _finddata_t dd_dta; 78 | 79 | /* dirent struct to return from dir (NOTE: this makes this thread 80 | * safe as long as only one thread uses a particular DIR struct at 81 | * a time) */ 82 | struct dirent dd_dir; 83 | 84 | /* _findnext handle */ 85 | long dd_handle; 86 | 87 | /* 88 | * Status of search: 89 | * 0 = not started yet (next entry to read is first entry) 90 | * -1 = off the end 91 | * positive = 0 based index of next entry 92 | */ 93 | int dd_stat; 94 | 95 | /* given path for dir with search pattern (struct is extended) */ 96 | char dd_name[1]; 97 | } DIR; 98 | 99 | DIR *opendir(const char *); 100 | struct dirent *readdir(DIR *); 101 | int closedir(DIR *); 102 | void rewinddir(DIR *); 103 | long telldir(DIR *); 104 | void seekdir(DIR *, long); 105 | 106 | #endif 107 | 108 | -------------------------------------------------------------------------------- /src/engine/system/i_png.h: -------------------------------------------------------------------------------- 1 | // Emacs style mode select -*- C++ -*- 2 | //----------------------------------------------------------------------------- 3 | // 4 | // Copyright(C) 2007-2012 Samuel Villarreal 5 | // 6 | // This program is free software; you can redistribute it and/or 7 | // modify it under the terms of the GNU General Public License 8 | // as published by the Free Software Foundation; either version 2 9 | // of the License, or (at your option) any later version. 10 | // 11 | // This program is distributed in the hope that it will be useful, 12 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | // GNU General Public License for more details. 15 | // 16 | // You should have received a copy of the GNU General Public License 17 | // along with this program; if not, write to the Free Software 18 | // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 19 | // 02111-1307, USA. 20 | // 21 | //----------------------------------------------------------------------------- 22 | 23 | #ifndef __I_PNG_H__ 24 | #define __I_PNG_H__ 25 | 26 | #include "doomtype.h" 27 | 28 | #include 29 | 30 | Image I_ReadImage(int lump, dboolean palette, dboolean nopack, double alpha, int palindex); 31 | 32 | void *I_PNGReadData(int lump, dboolean palette, dboolean nopack, dboolean alpha, 33 | int* w, int* h, int* offset, int palindex); 34 | 35 | #endif // __I_PNG_H__ 36 | -------------------------------------------------------------------------------- /src/engine/system/i_swap.h: -------------------------------------------------------------------------------- 1 | // Emacs style mode select -*- C++ -*- 2 | //----------------------------------------------------------------------------- 3 | // 4 | // Copyright(C) 2007-2012 Samuel Villarreal 5 | // 6 | // This program is free software; you can redistribute it and/or 7 | // modify it under the terms of the GNU General Public License 8 | // as published by the Free Software Foundation; either version 2 9 | // of the License, or (at your option) any later version. 10 | // 11 | // This program is distributed in the hope that it will be useful, 12 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | // GNU General Public License for more details. 15 | // 16 | // You should have received a copy of the GNU General Public License 17 | // along with this program; if not, write to the Free Software 18 | // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 19 | // 02111-1307, USA. 20 | // 21 | //----------------------------------------------------------------------------- 22 | 23 | #ifndef __I_SWAP_H__ 24 | #define __I_SWAP_H__ 25 | 26 | #include "SDL_endian.h" 27 | #include "doomtype.h" 28 | 29 | #define I_SwapLE16(x) SDL_SwapLE16(x) 30 | #define I_SwapLE32(x) SDL_SwapLE32(x) 31 | #define I_SwapBE16(x) SDL_SwapBE16(x) 32 | #define I_SwapBE32(x) SDL_SwapBE32(x) 33 | 34 | #define SHORT(x) ((signed short)I_SwapLE16(x)) 35 | #define LONG(x) ((signed long)I_SwapLE32(x)) 36 | 37 | // Defines for checking the endianness of the system. 38 | 39 | #if SDL_BYTEORDER == SYS_LIL_ENDIAN 40 | #define SYS_LITTLE_ENDIAN 41 | #elif SDL_BYTEORDER == SYS_BIG_ENDIAN 42 | #define SYS_BIG_ENDIAN 43 | #endif 44 | 45 | #endif // __I_SWAP_H__ -------------------------------------------------------------------------------- /src/engine/system/i_system.h: -------------------------------------------------------------------------------- 1 | // Emacs style mode select -*- C++ -*- 2 | //----------------------------------------------------------------------------- 3 | // 4 | // Copyright(C) 1993-1997 Id Software, Inc. 5 | // Copyright(C) 2007-2012 Samuel Villarreal 6 | // 7 | // This program is free software; you can redistribute it and/or 8 | // modify it under the terms of the GNU General Public License 9 | // as published by the Free Software Foundation; either version 2 10 | // of the License, or (at your option) any later version. 11 | // 12 | // This program is distributed in the hope that it will be useful, 13 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | // GNU General Public License for more details. 16 | // 17 | // You should have received a copy of the GNU General Public License 18 | // along with this program; if not, write to the Free Software 19 | // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 20 | // 02111-1307, USA. 21 | // 22 | //----------------------------------------------------------------------------- 23 | 24 | 25 | #ifndef __I_SYSTEM__ 26 | #define __I_SYSTEM__ 27 | 28 | #include 29 | 30 | #include "d_ticcmd.h" 31 | #include "d_event.h" 32 | #include "m_fixed.h" 33 | 34 | #ifdef __GNUG__ 35 | #pragma interface 36 | #endif 37 | 38 | // Called by DoomMain. 39 | void I_Init(void); 40 | 41 | #ifdef _WIN32 42 | 43 | #define USESYSCONSOLE 44 | 45 | void I_SpawnSysConsole(void); 46 | void I_ShowSysConsole(dboolean show); 47 | 48 | #endif 49 | 50 | 51 | // Called by D_DoomLoop, 52 | // returns current time in tics. 53 | 54 | extern fixed_t rendertic_frac; 55 | 56 | extern int (*I_GetTime)(void); 57 | void I_InitClockRate(void); 58 | int I_GetTimeMS(void); 59 | void I_Sleep(unsigned long usecs); 60 | dboolean I_StartDisplay(void); 61 | void I_EndDisplay(void); 62 | fixed_t I_GetTimeFrac(void); 63 | void I_GetTime_SaveMS(void); 64 | unsigned long I_GetRandomTimeSeed(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 | void I_BeginRead(void); 82 | void I_Error(const char *error, ...); 83 | void I_Printf(const char *msg, ...); 84 | 85 | char *I_GetUserDir(void); 86 | char *I_GetBaseDir(void); 87 | char *I_GetUserFile(const char *file); 88 | char *I_FindDataFile(const char *file); 89 | 90 | dboolean I_FileExists(const char *path); 91 | 92 | void I_RegisterCvars(void); 93 | 94 | extern FILE *DebugFile; 95 | 96 | #endif 97 | -------------------------------------------------------------------------------- /src/engine/system/i_video.h: -------------------------------------------------------------------------------- 1 | // Emacs style mode select -*- C++ -*- 2 | //----------------------------------------------------------------------------- 3 | // 4 | // Copyright(C) 1993-1997 Id Software, Inc. 5 | // Copyright(C) 2005 Simon Howard 6 | // Copyright(C) 2007-2012 Samuel Villarreal 7 | // 8 | // This program is free software; you can redistribute it and/or 9 | // modify it under the terms of the GNU General Public License 10 | // as published by the Free Software Foundation; either version 2 11 | // of the License, or (at your option) any later version. 12 | // 13 | // This program is distributed in the hope that it will be useful, 14 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | // GNU General Public License for more details. 17 | // 18 | // You should have received a copy of the GNU General Public License 19 | // along with this program; if not, write to the Free Software 20 | // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 21 | // 02111-1307, USA. 22 | // 23 | //----------------------------------------------------------------------------- 24 | 25 | 26 | #ifndef __I_VIDEO_H__ 27 | #define __I_VIDEO_H__ 28 | 29 | #include "SDL.h" 30 | #include "d_event.h" 31 | 32 | #define SDL_BPP 32 33 | 34 | ////////////Video/////////////// 35 | 36 | void I_InitVideo(void); 37 | void I_ShutdownVideo(void); 38 | // 39 | // Called by D_DoomLoop, 40 | // called before processing each tic in a frame. 41 | // Quick syncronous operations are performed here. 42 | // Can call D_PostEvent. 43 | void I_StartTic(void); 44 | void I_FinishUpdate(void); 45 | int I_ShutdownWait(void); 46 | void I_CenterMouse(void); 47 | 48 | ////////////Input////////////// 49 | 50 | extern int mouse_x; 51 | extern int mouse_y; 52 | 53 | int I_MouseAccel(int val); 54 | void I_MouseAccelChange(void); 55 | 56 | 57 | #endif 58 | -------------------------------------------------------------------------------- /src/engine/system/win32/afxres.h: -------------------------------------------------------------------------------- 1 | #ifndef _AFXRES_H 2 | #define _AFXRES_H 3 | #if __GNUC__ >= 3 4 | #pragma GCC system_header 5 | #endif 6 | 7 | #ifdef __cplusplus 8 | extern "C" { 9 | #endif 10 | 11 | #ifndef _WINDOWS_H 12 | #include 13 | #endif 14 | 15 | /* IDC_STATIC is documented in winuser.h, but not defined. */ 16 | #ifndef IDC_STATIC 17 | #define IDC_STATIC (-1) 18 | #endif 19 | 20 | #ifdef __cplusplus 21 | } 22 | #endif 23 | #endif 24 | -------------------------------------------------------------------------------- /src/engine/system/win32/doom64.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Rinnegatamante/Doom64EX/1344ab10f43a6aae374659d9714a0b234a5bd134/src/engine/system/win32/doom64.ico -------------------------------------------------------------------------------- /src/engine/system/win32/doom64.rc: -------------------------------------------------------------------------------- 1 | // Microsoft Visual C++ generated resource script. 2 | // 3 | #include "resource.h" 4 | 5 | #define APSTUDIO_READONLY_SYMBOLS 6 | ///////////////////////////////////////////////////////////////////////////// 7 | // 8 | // Generated from the TEXTINCLUDE 2 resource. 9 | // 10 | #include "afxres.h" 11 | 12 | ///////////////////////////////////////////////////////////////////////////// 13 | #undef APSTUDIO_READONLY_SYMBOLS 14 | 15 | ///////////////////////////////////////////////////////////////////////////// 16 | // English (U.S.) resources 17 | 18 | #if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU) 19 | #ifdef _WIN32 20 | LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US 21 | #pragma code_page(1252) 22 | #endif //_WIN32 23 | 24 | #ifdef APSTUDIO_INVOKED 25 | ///////////////////////////////////////////////////////////////////////////// 26 | // 27 | // TEXTINCLUDE 28 | // 29 | 30 | 1 TEXTINCLUDE 31 | BEGIN 32 | "resource.h\0" 33 | END 34 | 35 | 2 TEXTINCLUDE 36 | BEGIN 37 | "#include ""afxres.h""\r\n" 38 | "\0" 39 | END 40 | 41 | 3 TEXTINCLUDE 42 | BEGIN 43 | "\r\n" 44 | "\0" 45 | END 46 | 47 | #endif // APSTUDIO_INVOKED 48 | 49 | 50 | ///////////////////////////////////////////////////////////////////////////// 51 | // 52 | // Icon 53 | // 54 | 55 | // Icon with lowest ID value placed first to ensure application icon 56 | // remains consistent on all systems. 57 | IDI_ICON1 ICON "doom64.ico" 58 | #endif // English (U.S.) resources 59 | ///////////////////////////////////////////////////////////////////////////// 60 | 61 | 62 | 63 | #ifndef APSTUDIO_INVOKED 64 | ///////////////////////////////////////////////////////////////////////////// 65 | // 66 | // Generated from the TEXTINCLUDE 3 resource. 67 | // 68 | 69 | 70 | ///////////////////////////////////////////////////////////////////////////// 71 | #endif // not APSTUDIO_INVOKED 72 | 73 | -------------------------------------------------------------------------------- /src/engine/system/win32/resource.h: -------------------------------------------------------------------------------- 1 | //{{NO_DEPENDENCIES}} 2 | // Microsoft Visual C++ generated include file. 3 | // Used by DOOM64.rc 4 | // 5 | #define IDI_ICON1 101 6 | 7 | // Next default values for new objects 8 | // 9 | #ifdef APSTUDIO_INVOKED 10 | #ifndef APSTUDIO_READONLY_SYMBOLS 11 | #define _APS_NEXT_RESOURCE_VALUE 103 12 | #define _APS_NEXT_COMMAND_VALUE 40001 13 | #define _APS_NEXT_CONTROL_VALUE 1001 14 | #define _APS_NEXT_SYMED_VALUE 101 15 | #endif 16 | #endif 17 | -------------------------------------------------------------------------------- /src/engine/wad/SubStream.hh: -------------------------------------------------------------------------------- 1 | #ifndef DOOM64EX_SUBSTREAM_HH 2 | #define DOOM64EX_SUBSTREAM_HH 3 | 4 | #include 5 | 6 | namespace imp { 7 | class SubstreamBuf : std::basic_streambuf { 8 | std::istream& parent_; 9 | 10 | protected: 11 | SubstreamBuf(std::istream& parent): 12 | std::basic_streambuf(), 13 | parent_(parent) {} 14 | 15 | 16 | }; 17 | 18 | class Substream : std::basic_istream { 19 | 20 | }; 21 | } 22 | 23 | #endif //DOOM64EX_SUBSTREAM_HH 24 | -------------------------------------------------------------------------------- /src/engine/wad/WadFormat.hh: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | namespace imp { 4 | namespace wad { 5 | struct LumpInfo { 6 | String lump_name; 7 | std::size_t lump_index {}; 8 | Section section; 9 | std::size_t section_index {}; 10 | std::size_t mount {}; 11 | std::size_t mount_index; 12 | 13 | LumpInfo(String lump_name, Section section, std::size_t index): 14 | lump_name(lump_name), 15 | section(section), 16 | mount_index(index) {} 17 | 18 | LumpInfo(const LumpInfo&) = delete; 19 | 20 | LumpInfo(LumpInfo&&) = default; 21 | 22 | LumpInfo& operator=(const LumpInfo&) = delete; 23 | 24 | LumpInfo& operator=(LumpInfo&&) = default; 25 | }; 26 | 27 | struct Format { 28 | using loader = UniquePtr (*)(StringView); 29 | 30 | virtual ~Format() {} 31 | 32 | virtual Vector read_all() = 0; 33 | 34 | virtual UniquePtr find(std::size_t lump_id, std::size_t mount_id) = 0; 35 | }; 36 | 37 | UniquePtr doom_loader(StringView); 38 | UniquePtr zip_loader(StringView); 39 | UniquePtr rom_loader(StringView); 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /src/engine/wadgen/deflate-N64.h: -------------------------------------------------------------------------------- 1 | #ifndef _WADGEN_DEFLATE_H_ 2 | #define _WADGEN_DEFLATE_H_ 3 | 4 | void Deflate_Decompress(byte * input, byte * output); 5 | 6 | #endif 7 | -------------------------------------------------------------------------------- /src/engine/wadgen/gfx.h: -------------------------------------------------------------------------------- 1 | #ifndef _WADGEN_GFX_H_ 2 | #define _WADGEN_GFX_H_ 3 | 4 | #define MAXGFXEXITEMS 128 5 | 6 | typedef struct { 7 | word compressed; //-1 = not compressed (all gfx lumps are not compressed anyways) 8 | word u2; //unknown 9 | word width; //width (short swapped) 10 | word height; //height (short swapped) 11 | } gfxRomHeader_t; 12 | 13 | typedef struct { 14 | gfxRomHeader_t header; 15 | cache data; 16 | word palette[256]; //n64 format (16 bit rgb) 17 | } gfxRom_t; 18 | 19 | typedef struct { 20 | word width; 21 | word height; 22 | word size; //no longer used 23 | word palPos; //no longer used 24 | cache data; 25 | dPalette_t palette[256]; 26 | int lumpRef; 27 | } gfxEx_t; 28 | 29 | extern gfxEx_t gfxEx[MAXGFXEXITEMS]; 30 | 31 | void Gfx_Setup(void); 32 | 33 | #endif 34 | -------------------------------------------------------------------------------- /src/engine/wadgen/level.h: -------------------------------------------------------------------------------- 1 | #ifndef _WADGEN_LEVEL_H_ 2 | #define _WADGEN_LEVEL_H_ 3 | 4 | #define MAXLEVELWADS 33 5 | 6 | extern cache levelData[MAXLEVELWADS]; 7 | extern int levelSize[MAXLEVELWADS]; 8 | 9 | void Level_Setup(void); 10 | 11 | #endif 12 | -------------------------------------------------------------------------------- /src/engine/wadgen/rom.h: -------------------------------------------------------------------------------- 1 | #ifndef _WADGEN_ROM_H_ 2 | #define _WADGEN_ROM_H_ 3 | 4 | #define ROMHEADERSIZE 64 5 | 6 | /* From Daedalus */ 7 | typedef struct { 8 | byte x1; /* initial PI_BSB_DOM1_LAT_REG value */ 9 | byte x2; /* initial PI_BSB_DOM1_PGS_REG value */ 10 | byte x3; /* initial PI_BSB_DOM1_PWD_REG value */ 11 | byte x4; /* initial PI_BSB_DOM1_RLS_REG value */ 12 | unsigned int ClockRate; 13 | unsigned int BootAddress; 14 | unsigned int Release; 15 | unsigned int CRC1; 16 | unsigned int CRC2; 17 | unsigned int Unknown0; 18 | unsigned int Unknown1; 19 | char Name[20]; 20 | unsigned int Unknown2; 21 | unsigned short int Unknown3; 22 | byte Unknown4; 23 | byte Manufacturer; 24 | unsigned short int CartID; 25 | char CountryID; 26 | byte VersionID; 27 | } romHeader_t; 28 | 29 | typedef struct { 30 | romHeader_t header; 31 | cache data; 32 | uint length; 33 | } rom_t; 34 | 35 | typedef struct { 36 | const char *name; 37 | const char *countryID; // E = US, J = Japan, P = PAL/Europe, X = US (v1.1) 38 | } romLumpSpecial_t; 39 | 40 | extern rom_t RomFile; 41 | 42 | void Rom_Open(char *path); 43 | void Rom_Close(void); 44 | bool Rom_VerifyRomCode(const romLumpSpecial_t * l); 45 | 46 | #endif 47 | -------------------------------------------------------------------------------- /src/engine/wadgen/sprite.h: -------------------------------------------------------------------------------- 1 | #ifndef _WADGEN_SPRITE_H_ 2 | #define _WADGEN_SPRITE_H_ 3 | 4 | #define MAX_SPRITES 2048 5 | #define CMPPALCOUNT 16 6 | 7 | extern int spriteExCount; 8 | extern int hudSpriteExCount; 9 | extern int extPalLumpCount; 10 | 11 | #define INSPRITELIST(x) (x >= Wad_GetLumpNum("S_START") && x <= Wad_GetLumpNum("S_END")) 12 | 13 | //N64 sprite format 14 | typedef struct { 15 | short tiles; // how many tiles the sprite is divided into 16 | short compressed; // >=0 = 'two for one' byte compression, -1 = not compressed 17 | short cmpsize; // actual compressed size (0 if not compressed) 18 | short xoffs; // draw x offset 19 | short yoffs; // draw y offset 20 | short width; // draw width 21 | short height; // draw height 22 | short tileheight; // y height per tile piece 23 | } d64RawSprite_t; 24 | 25 | //D64EX sprite format 26 | typedef struct { 27 | word width; // draw width 28 | word height; // draw height 29 | short offsetx; // draw x offset 30 | short offsety; // draw y offset 31 | short useExtPal; // true = use internal palette, false = use external lump palette (for hi colored sprites) 32 | } d64ExSprite_t; 33 | 34 | typedef struct { 35 | d64ExSprite_t sprite; 36 | cache data; 37 | dPalette_t palette[256]; 38 | int size; 39 | int lumpRef; 40 | } d64ExSpriteLump_t; 41 | 42 | extern d64ExSpriteLump_t exSpriteLump[MAX_SPRITES]; 43 | 44 | typedef struct { 45 | dPalette_t extPalLumps[256]; 46 | char name[8]; 47 | } d64PaletteLump_t; 48 | 49 | extern d64PaletteLump_t d64PaletteLump[24]; 50 | 51 | void Sprite_Setup(void); 52 | 53 | #endif 54 | -------------------------------------------------------------------------------- /src/engine/wadgen/texture.h: -------------------------------------------------------------------------------- 1 | #ifndef _WADGEN_TEX_H_ 2 | #define _WADGEN_TEX_H_ 3 | 4 | #define MAXPALETTES 16 5 | #define NUMTEXPALETTES 16 6 | #define MAXTEXTURES 800 7 | 8 | // N64 Texture format 9 | 10 | typedef struct { 11 | word id; 12 | word numpal; 13 | word wshift; 14 | word hshift; 15 | } d64RawTextureHeader_t; 16 | 17 | typedef struct { 18 | d64RawTextureHeader_t header; 19 | cache data; 20 | word *palette; 21 | } d64RawTexture_t; 22 | 23 | // D64EX texture format 24 | 25 | typedef struct { 26 | word width; 27 | word height; 28 | word numpal; 29 | word compressed; 30 | } d64ExTextureHeader_t; 31 | 32 | typedef struct { 33 | d64ExTextureHeader_t header; 34 | cache data; 35 | dPalette_t palette[MAXPALETTES][NUMTEXPALETTES]; 36 | int size; 37 | int lumpRef; 38 | } d64ExTexture_t; 39 | 40 | extern d64ExTexture_t d64ExTexture[MAXTEXTURES]; 41 | 42 | void Texture_Setup(void); 43 | 44 | #endif 45 | -------------------------------------------------------------------------------- /src/engine/wadgen/wad.h: -------------------------------------------------------------------------------- 1 | #ifndef _WADGEN_WAD_H_ 2 | #define _WADGEN_WAD_H_ 3 | 4 | #include "sprite.h" 5 | #include "gfx.h" 6 | #include "texture.h" 7 | #include "sound.h" 8 | 9 | #define MAX_LUMPS 4096 10 | 11 | #ifdef _MSC_VER 12 | #pragma pack(push, 1) 13 | #endif 14 | 15 | typedef struct { 16 | char id[4]; 17 | int lmpcount; 18 | int lmpdirpos; 19 | } wadheader_t; 20 | 21 | typedef struct { 22 | int filepos; 23 | int size; 24 | char name[8]; 25 | } lump_t; 26 | 27 | #ifdef _MSC_VER 28 | #pragma pack(pop) 29 | #endif 30 | 31 | typedef struct { 32 | wadheader_t header; 33 | lump_t lump[MAX_LUMPS]; 34 | cache lumpcache[MAX_LUMPS]; 35 | uint size; 36 | } wadFile_t; 37 | 38 | extern wadFile_t romWadFile; 39 | extern wadFile_t outWadFile; 40 | 41 | void Wad_GetIwad(void); 42 | int Wad_GetLumpNum(const char *name); 43 | void *Wad_GetLump(char *name, bool dcmpType); 44 | void Wad_CreateOutput(void); 45 | void Wad_WriteOutput(path outFile); 46 | void Wad_AddOutputSprite(d64ExSpriteLump_t * sprite); 47 | void Wad_AddOutputTexture(d64ExTexture_t * tex); 48 | void Wad_AddOutputGfx(gfxEx_t * gfx); 49 | void Wad_AddOutputHudSprite(d64ExSpriteLump_t * sprite); 50 | void Wad_AddOutputPalette(d64PaletteLump_t * palette); 51 | void Wad_AddOutputMidi(midiheader_t * mthd, int index); 52 | void Wad_AddOutputLump(const char *name, int size, cache data); 53 | 54 | #endif 55 | -------------------------------------------------------------------------------- /src/engine/wadgen/wadgen.h: -------------------------------------------------------------------------------- 1 | #ifndef _WADGEN_H_ 2 | #define _WADGEN_H_ 3 | 4 | #ifdef _MSVC_VER 5 | #include "SDL_config.h" 6 | #else 7 | #include 8 | #endif 9 | 10 | #define PLATFORM_PC 11 | //#define PLATFORM_DS 12 | 13 | #ifdef _WIN32 14 | #include 15 | #include 16 | #include 17 | #include 18 | #include 19 | #else 20 | #ifdef __linux__ 21 | #include 22 | #else 23 | #include 24 | #endif 25 | #ifdef __vita__ 26 | #define PATH_MAX 256 27 | #endif 28 | #define MAX_PATH PATH_MAX 29 | #define ZeroMemory(a,l) memset(a, 0, l) 30 | #endif 31 | 32 | #include 33 | #include 34 | #include 35 | #include 36 | #include 37 | #ifdef __linux__ 38 | #define S_IREAD S_IRUSR 39 | #define S_IWRITE S_IWUSR 40 | #define S_IEXEC S_IXUSR 41 | #endif 42 | 43 | #ifdef PLATFORM_PC 44 | 45 | #define USE_PNG 46 | #include "png.h" 47 | 48 | #endif 49 | 50 | #define USE_SOUNDFONTS 51 | 52 | #pragma warning(disable:4996) 53 | 54 | typedef unsigned char byte; 55 | typedef unsigned short word; 56 | typedef int32_t int32; 57 | typedef uint32_t uint32; 58 | typedef uint32_t uint; 59 | typedef byte *cache; 60 | typedef char path[MAX_PATH]; 61 | 62 | typedef struct { 63 | byte r; 64 | byte g; 65 | byte b; 66 | byte a; 67 | } dPalette_t; 68 | 69 | #ifdef _WIN32 70 | extern HWND hwnd; 71 | extern HWND hwndWait; 72 | #endif 73 | extern int myargc; 74 | extern char **myargv; 75 | 76 | int WGen_Swap16(int x); 77 | uint WGen_Swap32(unsigned int x); 78 | 79 | #define _SWAP16(x) WGen_Swap16(x) 80 | #define _SWAP32(x) WGen_Swap32(x) 81 | #define _PAD4(x) x += (4 - ((uint) x & 3)) & 3 82 | #define _PAD8(x) x += (8 - ((uint) x & 7)) & 7 83 | #define _PAD16(x) x += (16 - ((uint) x & 15)) & 15 84 | 85 | void WGen_WadgenMain(); 86 | void WGen_Printf(const char *s, ...); 87 | void WGen_Complain(const char *fmt, ...); 88 | void WGen_UpdateProgress(const char *fmt, ...); 89 | void WGen_ConvertN64Pal(dPalette_t * palette, word * data, int indexes); 90 | void WGen_AddDigest(char *name, int lump, int size); 91 | 92 | #ifdef USE_PNG 93 | cache Png_Create(int width, int height, int numpal, dPalette_t * pal, 94 | int bits, cache data, int lump, int *size); 95 | #endif 96 | 97 | #define TOTALSTEPS 3500 98 | 99 | #if !defined(_WIN32) && !defined(__vita__) 100 | static inline char *strupr(char *in) 101 | { 102 | unsigned char *ptr = (unsigned char *)in; 103 | while (*ptr != '\0') { 104 | int c = toupper(*ptr); 105 | *ptr++ = c; 106 | } 107 | return in; 108 | } 109 | #endif 110 | 111 | #include "md5.h" 112 | 113 | #endif 114 | -------------------------------------------------------------------------------- /src/gtk3/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | ##------------------------------------------------------------------------------ 2 | ## 3 | ## Doom64EX CMake configuration 4 | ## 5 | ## LICENSE: 6 | ## 7 | ## Copyright(C) 2017 Zohar Malamant 8 | ## 9 | ## This program is free software; you can redistribute it and/or 10 | ## modify it under the terms of the GNU General Public License 11 | ## as published by the Free Software Foundation; either version 2 12 | ## of the License, or (at your option) any later version. 13 | ## 14 | ## This program is distributed in the hope that it will be useful, 15 | ## but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | ## GNU General Public License for more details. 18 | ## 19 | ## You should have received a copy of the GNU General Public License 20 | ## along with this program; if not, write to the Free Software 21 | ## Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 22 | ## 02111-1307, USA. 23 | ## 24 | 25 | ##------------------------------------------------------------------------------ 26 | ## Sources 27 | ## 28 | 29 | set(SOURCES 30 | console.vala 31 | thread.vala) 32 | 33 | ##------------------------------------------------------------------------------ 34 | ## Build target 35 | ## 36 | 37 | vala_precompile_target(${PROJECT_NAME}-gtk3-vala 38 | SOURCES 39 | ${SOURCES} 40 | 41 | PACKAGES 42 | "gtk+-3.0") 43 | 44 | add_library("${PROJECT_NAME}-gtk3" SHARED ${SOURCES}) 45 | add_dependencies("${PROJECT_NAME}-gtk3" "${PROJECT_NAME}-gtk3-vala") 46 | set_property(TARGET "${PROJECT_NAME}-gtk3" PROPERTY POSITION_INDEPENDENT_CODE ON) 47 | 48 | target_link_libraries("${PROJECT_NAME}-gtk3" 49 | ${GTK3_LIBRARY} 50 | ${GIO_LIBRARY} 51 | ${GObject_LIBRARY} 52 | ${GLib_LIBRARY}) 53 | 54 | target_include_directories("${PROJECT_NAME}-gtk3" PUBLIC 55 | ${GTK3_INCLUDE_DIRS}) 56 | 57 | ##------------------------------------------------------------------------------ 58 | ## Install target 59 | ## 60 | -------------------------------------------------------------------------------- /src/gtk3/console.vala: -------------------------------------------------------------------------------- 1 | using Gtk; 2 | 3 | namespace NativeUI { 4 | class Console : Window { 5 | private ScrolledWindow window; 6 | private TextBuffer text_buffer; 7 | 8 | public Console () { 9 | this.title = "Doom64EX Console"; 10 | this.border_width = 10; 11 | this.window_position = WindowPosition.CENTER; 12 | this.set_default_size (384, 480); 13 | 14 | var layout = new Box (Orientation.VERTICAL, 4); 15 | this.add (layout); 16 | 17 | var text_view = new TextView (); 18 | this.text_buffer = text_view.get_buffer (); 19 | text_view.cursor_visible = false; 20 | text_view.editable = false; 21 | text_view.monospace = true; 22 | text_view.wrap_mode = WrapMode.NONE; 23 | 24 | window = new ScrolledWindow (text_view.hadjustment, text_view.vadjustment); 25 | window.add (text_view); 26 | window.size_allocate.connect(() => { 27 | var adj = window.vadjustment; 28 | adj.set_value (adj.upper); 29 | }); 30 | layout.pack_start (window, true, true, 4); 31 | 32 | var buttons = new ButtonBox (Orientation.HORIZONTAL); 33 | var btn_copy = new Button.with_label ("Copy"); 34 | var btn_quit = new Button.with_label ("Quit"); 35 | 36 | btn_quit.clicked.connect (() => Gtk.main_quit ()); 37 | 38 | buttons.add (btn_copy); 39 | buttons.add (btn_quit); 40 | 41 | layout.pack_start (buttons, false, true, 4); 42 | } 43 | 44 | public void insert (string text) { 45 | text_buffer.insert_at_cursor (text, text.length); 46 | } 47 | } 48 | } -------------------------------------------------------------------------------- /src/gtk3/thread.vala: -------------------------------------------------------------------------------- 1 | using NativeUI; 2 | 3 | private Console console; 4 | private Thread gui_thread; 5 | 6 | public void init () { 7 | unowned string[]? argv = null; 8 | Gtk.init (ref argv); 9 | 10 | gui_thread = new Thread ("Gtk3 Thread", () => { 11 | console = new NativeUI.Console (); 12 | console.show_all (); 13 | 14 | Gtk.main (); 15 | 16 | return null; 17 | }); 18 | } 19 | 20 | public void quit () { 21 | Idle.add (() => { 22 | Gtk.main_quit (); 23 | return Source.REMOVE; 24 | }); 25 | 26 | gui_thread.join (); 27 | console = null; 28 | } 29 | 30 | public void console_add_line (string line) { 31 | Idle.add (() => { 32 | console.insert (line); 33 | return Source.REMOVE; 34 | }); 35 | } -------------------------------------------------------------------------------- /testdata/16-color.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Rinnegatamante/Doom64EX/1344ab10f43a6aae374659d9714a0b234a5bd134/testdata/16-color.png -------------------------------------------------------------------------------- /testdata/color-alpha.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Rinnegatamante/Doom64EX/1344ab10f43a6aae374659d9714a0b234a5bd134/testdata/color-alpha.png -------------------------------------------------------------------------------- /testdata/color-crop.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Rinnegatamante/Doom64EX/1344ab10f43a6aae374659d9714a0b234a5bd134/testdata/color-crop.png -------------------------------------------------------------------------------- /testdata/color-expand.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Rinnegatamante/Doom64EX/1344ab10f43a6aae374659d9714a0b234a5bd134/testdata/color-expand.png -------------------------------------------------------------------------------- /testdata/color.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Rinnegatamante/Doom64EX/1344ab10f43a6aae374659d9714a0b234a5bd134/testdata/color.png -------------------------------------------------------------------------------- /testdata/index-alpha.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Rinnegatamante/Doom64EX/1344ab10f43a6aae374659d9714a0b234a5bd134/testdata/index-alpha.png -------------------------------------------------------------------------------- /testdata/index.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Rinnegatamante/Doom64EX/1344ab10f43a6aae374659d9714a0b234a5bd134/testdata/index.png --------------------------------------------------------------------------------