diff --git a/.circleci/config.yml b/.circleci/config.yml index 1784ba1ea..61e508e4d 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -25,6 +25,13 @@ jobs: - run: name: Add i386 arch command: dpkg --add-architecture i386 + - run: + name: Add STJr PPA + command: | + apt-get -qq update + apt-get -qq -y install dirmngr + apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 0B1702D71499D9C25F986507F240F4449D3B0EC6 + echo "deb http://ppa.launchpad.net/stjr/srb2/ubuntu trusty main" >> /etc/apt/sources.list - run: name: Update APT listing command: apt-get -qq update @@ -36,7 +43,8 @@ jobs: - v1-SRB2-APT - run: name: Install SDK - command: apt-get -qq -y --no-install-recommends install git build-essential nasm libpng-dev:i386 libsdl2-mixer-dev:i386 libgme-dev:i386 gettext ccache wget gcc-multilib upx openssh-client + command: apt-get -qq -y --no-install-recommends install git build-essential nasm libpng-dev:i386 libsdl2-mixer-dev:i386 libgme-dev:i386 libopenmpt-dev:i386 gettext ccache wget gcc-multilib upx openssh-client + - save_cache: key: v1-SRB2-APT paths: @@ -63,4 +71,4 @@ jobs: - save_cache: key: v1-SRB2-{{ .Branch }}-{{ checksum "objs/Linux/SDL/Release/depend.dep" }} paths: - - /root/.ccache + - /root/.ccache \ No newline at end of file diff --git a/.travis.yml b/.travis.yml index 6d2e8cddf..f2ed43000 100644 --- a/.travis.yml +++ b/.travis.yml @@ -18,11 +18,14 @@ matrix: - os: linux addons: apt: + sources: + - sourceline: 'ppa:stjr/srb2' packages: - libsdl2-mixer-dev - libpng-dev - libgl1-mesa-dev - libgme-dev + - libopenmpt-dev - p7zip-full - gcc-4.4 compiler: gcc-4.4 @@ -32,11 +35,14 @@ matrix: - os: linux addons: apt: + sources: + - sourceline: 'ppa:stjr/srb2' packages: - libsdl2-mixer-dev - libpng-dev - libgl1-mesa-dev - libgme-dev + - libopenmpt-dev - p7zip-full - gcc-4.6 compiler: gcc-4.6 @@ -46,11 +52,14 @@ matrix: - os: linux addons: apt: + sources: + - sourceline: 'ppa:stjr/srb2' packages: - libsdl2-mixer-dev - libpng-dev - libgl1-mesa-dev - libgme-dev + - libopenmpt-dev - p7zip-full - gcc-4.7 compiler: gcc-4.7 @@ -67,11 +76,13 @@ matrix: apt: sources: - ubuntu-toolchain-r-test + - sourceline: 'ppa:stjr/srb2' packages: - libsdl2-mixer-dev - libpng-dev - libgl1-mesa-dev - libgme-dev + - libopenmpt-dev - p7zip-full - gcc-4.8 compiler: gcc-4.8 @@ -83,11 +94,13 @@ matrix: apt: sources: - ubuntu-toolchain-r-test + - sourceline: 'ppa:stjr/srb2' packages: - libsdl2-mixer-dev - libpng-dev - libgl1-mesa-dev - libgme-dev + - libopenmpt-dev - p7zip-full - gcc-7 compiler: gcc-7 @@ -99,11 +112,13 @@ matrix: apt: sources: - ubuntu-toolchain-r-test + - sourceline: 'ppa:stjr/srb2' packages: - libsdl2-mixer-dev - libpng-dev - libgl1-mesa-dev - libgme-dev + - libopenmpt-dev - p7zip-full - gcc-8 compiler: gcc-8 @@ -119,11 +134,13 @@ matrix: apt: sources: - llvm-toolchain-precise-3.5 + - sourceline: 'ppa:stjr/srb2' packages: - libsdl2-mixer-dev - libpng-dev - libgl1-mesa-dev - libgme-dev + - libopenmpt-dev - p7zip-full - clang-3.5 compiler: clang-3.5 @@ -135,11 +152,13 @@ matrix: sources: - llvm-toolchain-precise-3.6 - ubuntu-toolchain-r-test + - sourceline: 'ppa:stjr/srb2' packages: - libsdl2-mixer-dev - libpng-dev - libgl1-mesa-dev - libgme-dev + - libopenmpt-dev - p7zip-full - clang-3.6 compiler: clang-3.6 @@ -151,11 +170,13 @@ matrix: sources: - llvm-toolchain-precise-3.7 - ubuntu-toolchain-r-test + - sourceline: 'ppa:stjr/srb2' packages: - libsdl2-mixer-dev - libpng-dev - libgl1-mesa-dev - libgme-dev + - libopenmpt-dev - p7zip-full - clang-3.7 compiler: clang-3.7 @@ -167,11 +188,13 @@ matrix: sources: - llvm-toolchain-precise-3.8 - ubuntu-toolchain-r-test + - sourceline: 'ppa:stjr/srb2' packages: - libsdl2-mixer-dev - libpng-dev - libgl1-mesa-dev - libgme-dev + - libopenmpt-dev - p7zip-full - clang-3.8 compiler: clang-3.8 @@ -183,11 +206,13 @@ matrix: sources: - llvm-toolchain-precise-3.9 - ubuntu-toolchain-r-test + - sourceline: 'ppa:stjr/srb2' packages: - libsdl2-mixer-dev - libpng-dev - libgl1-mesa-dev - libgme-dev + - libopenmpt-dev - p7zip-full - clang-3.9 compiler: clang-3.9 @@ -199,11 +224,13 @@ matrix: # sources: # - llvm-toolchain-precise-4.0 # - ubuntu-toolchain-r-test +# - sourceline: 'ppa:stjr/srb2' # packages: # - libsdl2-mixer-dev # - libpng-dev # - libgl1-mesa-dev # - libgme-dev +# - libopenmpt-dev # - p7zip-full # - clang-4.0 # compiler: clang-4.0 @@ -215,11 +242,13 @@ matrix: # sources: # - llvm-toolchain-precise-5.0 # - ubuntu-toolchain-r-test +# - sourceline: 'ppa:stjr/srb2' # packages: # - libsdl2-mixer-dev # - libpng-dev # - libgl1-mesa-dev # - libgme-dev +# - libopenmpt-dev # - p7zip-full # - clang-5.0 # compiler: clang-5.0 @@ -561,12 +590,15 @@ cache: addons: apt: + sources: + - sourceline: 'ppa:stjr/srb2' packages: - libsdl2-mixer-dev - libpng-dev - libgl1-mesa-dev - libgme-dev - zlib1g-dev + - libopenmpt-dev - p7zip-full homebrew: taps: @@ -575,6 +607,7 @@ addons: - sdl2_mixer - game-music-emu - p7zip + - libopenmpt - cmake update: true diff --git a/README.md b/README.md index 7d92ab303..8a5ca1a1f 100644 --- a/README.md +++ b/README.md @@ -12,6 +12,7 @@ - SDL2-Mixer (Linux/OS X only) - libupnp (Linux/OS X only) - libgme (Linux/OS X only) +- libopenmpt (Linux/OS X only) ## Compiling diff --git a/bin/DC/.gitignore b/bin/DC/.gitignore deleted file mode 100644 index 42c6dc2c6..000000000 --- a/bin/DC/.gitignore +++ /dev/null @@ -1,2 +0,0 @@ -# DON'T REMOVE -# This keeps the folder from disappearing diff --git a/bin/Mingw/Release/.gitignore b/bin/Mingw/Release/.gitignore index 834f313e3..3458ff764 100644 --- a/bin/Mingw/Release/.gitignore +++ b/bin/Mingw/Release/.gitignore @@ -1,3 +1,4 @@ *.exe *.mo r_opengl.dll +*.bat diff --git a/bin/PS3/Debug/.gitignore b/bin/PS3/Debug/.gitignore deleted file mode 100644 index c4dcd19e5..000000000 --- a/bin/PS3/Debug/.gitignore +++ /dev/null @@ -1,5 +0,0 @@ -/*.elf -/*.self -/*.pkg -/*.BIN -/pkg diff --git a/bin/PS3/Release/.gitignore b/bin/PS3/Release/.gitignore deleted file mode 100644 index c4dcd19e5..000000000 --- a/bin/PS3/Release/.gitignore +++ /dev/null @@ -1,5 +0,0 @@ -/*.elf -/*.self -/*.pkg -/*.BIN -/pkg diff --git a/bin/PSP/Release/.gitignore b/bin/PSP/Release/.gitignore deleted file mode 100644 index 98d08e695..000000000 --- a/bin/PSP/Release/.gitignore +++ /dev/null @@ -1,4 +0,0 @@ -/EBOOT.PBP -/PARAM.SFO -/SRB2PSP.PBP -/SRB2PSP.elf diff --git a/bin/Wii/Debug/.gitignore b/bin/Wii/Debug/.gitignore deleted file mode 100644 index 200eea51f..000000000 --- a/bin/Wii/Debug/.gitignore +++ /dev/null @@ -1,3 +0,0 @@ -/*.elf -/*.dol -/apps diff --git a/bin/Wii/Release/.gitignore b/bin/Wii/Release/.gitignore deleted file mode 100644 index 200eea51f..000000000 --- a/bin/Wii/Release/.gitignore +++ /dev/null @@ -1,3 +0,0 @@ -/*.elf -/*.dol -/apps diff --git a/bin/WinCE/ARMV4Dbg/.gitignore b/bin/WinCE/ARMV4Dbg/.gitignore deleted file mode 100644 index 42c6dc2c6..000000000 --- a/bin/WinCE/ARMV4Dbg/.gitignore +++ /dev/null @@ -1,2 +0,0 @@ -# DON'T REMOVE -# This keeps the folder from disappearing diff --git a/bin/WinCE/ARMV4IDbg/.gitignore b/bin/WinCE/ARMV4IDbg/.gitignore deleted file mode 100644 index 42c6dc2c6..000000000 --- a/bin/WinCE/ARMV4IDbg/.gitignore +++ /dev/null @@ -1,2 +0,0 @@ -# DON'T REMOVE -# This keeps the folder from disappearing diff --git a/bin/WinCE/ARMV4IRel/.gitignore b/bin/WinCE/ARMV4IRel/.gitignore deleted file mode 100644 index 42c6dc2c6..000000000 --- a/bin/WinCE/ARMV4IRel/.gitignore +++ /dev/null @@ -1,2 +0,0 @@ -# DON'T REMOVE -# This keeps the folder from disappearing diff --git a/bin/WinCE/ARMV4Rel/.gitignore b/bin/WinCE/ARMV4Rel/.gitignore deleted file mode 100644 index 42c6dc2c6..000000000 --- a/bin/WinCE/ARMV4Rel/.gitignore +++ /dev/null @@ -1,2 +0,0 @@ -# DON'T REMOVE -# This keeps the folder from disappearing diff --git a/bin/WinCE/ARMV4TDbg/.gitignore b/bin/WinCE/ARMV4TDbg/.gitignore deleted file mode 100644 index 42c6dc2c6..000000000 --- a/bin/WinCE/ARMV4TDbg/.gitignore +++ /dev/null @@ -1,2 +0,0 @@ -# DON'T REMOVE -# This keeps the folder from disappearing diff --git a/bin/WinCE/ARMV4TRel/.gitignore b/bin/WinCE/ARMV4TRel/.gitignore deleted file mode 100644 index 42c6dc2c6..000000000 --- a/bin/WinCE/ARMV4TRel/.gitignore +++ /dev/null @@ -1,2 +0,0 @@ -# DON'T REMOVE -# This keeps the folder from disappearing diff --git a/bin/WinCE/MIPS16Dbg/.gitignore b/bin/WinCE/MIPS16Dbg/.gitignore deleted file mode 100644 index 42c6dc2c6..000000000 --- a/bin/WinCE/MIPS16Dbg/.gitignore +++ /dev/null @@ -1,2 +0,0 @@ -# DON'T REMOVE -# This keeps the folder from disappearing diff --git a/bin/WinCE/MIPS16Rel/.gitignore b/bin/WinCE/MIPS16Rel/.gitignore deleted file mode 100644 index 42c6dc2c6..000000000 --- a/bin/WinCE/MIPS16Rel/.gitignore +++ /dev/null @@ -1,2 +0,0 @@ -# DON'T REMOVE -# This keeps the folder from disappearing diff --git a/bin/WinCE/MIPSIIDbg/.gitignore b/bin/WinCE/MIPSIIDbg/.gitignore deleted file mode 100644 index 42c6dc2c6..000000000 --- a/bin/WinCE/MIPSIIDbg/.gitignore +++ /dev/null @@ -1,2 +0,0 @@ -# DON'T REMOVE -# This keeps the folder from disappearing diff --git a/bin/WinCE/MIPSIIRel/.gitignore b/bin/WinCE/MIPSIIRel/.gitignore deleted file mode 100644 index 42c6dc2c6..000000000 --- a/bin/WinCE/MIPSIIRel/.gitignore +++ /dev/null @@ -1,2 +0,0 @@ -# DON'T REMOVE -# This keeps the folder from disappearing diff --git a/bin/WinCE/MIPSII_FPDbg/.gitignore b/bin/WinCE/MIPSII_FPDbg/.gitignore deleted file mode 100644 index 42c6dc2c6..000000000 --- a/bin/WinCE/MIPSII_FPDbg/.gitignore +++ /dev/null @@ -1,2 +0,0 @@ -# DON'T REMOVE -# This keeps the folder from disappearing diff --git a/bin/WinCE/MIPSII_FPRel/.gitignore b/bin/WinCE/MIPSII_FPRel/.gitignore deleted file mode 100644 index 42c6dc2c6..000000000 --- a/bin/WinCE/MIPSII_FPRel/.gitignore +++ /dev/null @@ -1,2 +0,0 @@ -# DON'T REMOVE -# This keeps the folder from disappearing diff --git a/bin/WinCE/MIPSIVDbg/.gitignore b/bin/WinCE/MIPSIVDbg/.gitignore deleted file mode 100644 index 42c6dc2c6..000000000 --- a/bin/WinCE/MIPSIVDbg/.gitignore +++ /dev/null @@ -1,2 +0,0 @@ -# DON'T REMOVE -# This keeps the folder from disappearing diff --git a/bin/WinCE/MIPSIVRel/.gitignore b/bin/WinCE/MIPSIVRel/.gitignore deleted file mode 100644 index 42c6dc2c6..000000000 --- a/bin/WinCE/MIPSIVRel/.gitignore +++ /dev/null @@ -1,2 +0,0 @@ -# DON'T REMOVE -# This keeps the folder from disappearing diff --git a/bin/WinCE/MIPSIV_FPDbg/.gitignore b/bin/WinCE/MIPSIV_FPDbg/.gitignore deleted file mode 100644 index 42c6dc2c6..000000000 --- a/bin/WinCE/MIPSIV_FPDbg/.gitignore +++ /dev/null @@ -1,2 +0,0 @@ -# DON'T REMOVE -# This keeps the folder from disappearing diff --git a/bin/WinCE/MIPSIV_FPRel/.gitignore b/bin/WinCE/MIPSIV_FPRel/.gitignore deleted file mode 100644 index 42c6dc2c6..000000000 --- a/bin/WinCE/MIPSIV_FPRel/.gitignore +++ /dev/null @@ -1,2 +0,0 @@ -# DON'T REMOVE -# This keeps the folder from disappearing diff --git a/bin/WinCE/Release/.gitignore b/bin/WinCE/Release/.gitignore deleted file mode 100644 index 42c6dc2c6..000000000 --- a/bin/WinCE/Release/.gitignore +++ /dev/null @@ -1,2 +0,0 @@ -# DON'T REMOVE -# This keeps the folder from disappearing diff --git a/bin/WinCE/SH3Dbg/.gitignore b/bin/WinCE/SH3Dbg/.gitignore deleted file mode 100644 index 42c6dc2c6..000000000 --- a/bin/WinCE/SH3Dbg/.gitignore +++ /dev/null @@ -1,2 +0,0 @@ -# DON'T REMOVE -# This keeps the folder from disappearing diff --git a/bin/WinCE/SH3Rel/.gitignore b/bin/WinCE/SH3Rel/.gitignore deleted file mode 100644 index 42c6dc2c6..000000000 --- a/bin/WinCE/SH3Rel/.gitignore +++ /dev/null @@ -1,2 +0,0 @@ -# DON'T REMOVE -# This keeps the folder from disappearing diff --git a/bin/WinCE/SH4Dbg/.gitignore b/bin/WinCE/SH4Dbg/.gitignore deleted file mode 100644 index 42c6dc2c6..000000000 --- a/bin/WinCE/SH4Dbg/.gitignore +++ /dev/null @@ -1,2 +0,0 @@ -# DON'T REMOVE -# This keeps the folder from disappearing diff --git a/bin/WinCE/SH4Rel/.gitignore b/bin/WinCE/SH4Rel/.gitignore deleted file mode 100644 index 42c6dc2c6..000000000 --- a/bin/WinCE/SH4Rel/.gitignore +++ /dev/null @@ -1,2 +0,0 @@ -# DON'T REMOVE -# This keeps the folder from disappearing diff --git a/bin/WinCE/X86Dbg/.gitignore b/bin/WinCE/X86Dbg/.gitignore deleted file mode 100644 index 42c6dc2c6..000000000 --- a/bin/WinCE/X86Dbg/.gitignore +++ /dev/null @@ -1,2 +0,0 @@ -# DON'T REMOVE -# This keeps the folder from disappearing diff --git a/bin/WinCE/X86Rel/.gitignore b/bin/WinCE/X86Rel/.gitignore deleted file mode 100644 index 42c6dc2c6..000000000 --- a/bin/WinCE/X86Rel/.gitignore +++ /dev/null @@ -1,2 +0,0 @@ -# DON'T REMOVE -# This keeps the folder from disappearing diff --git a/bin/WinCE/emulatorDbg/.gitignore b/bin/WinCE/emulatorDbg/.gitignore deleted file mode 100644 index 42c6dc2c6..000000000 --- a/bin/WinCE/emulatorDbg/.gitignore +++ /dev/null @@ -1,2 +0,0 @@ -# DON'T REMOVE -# This keeps the folder from disappearing diff --git a/bin/WinCE/emulatorRel/.gitignore b/bin/WinCE/emulatorRel/.gitignore deleted file mode 100644 index 42c6dc2c6..000000000 --- a/bin/WinCE/emulatorRel/.gitignore +++ /dev/null @@ -1,2 +0,0 @@ -# DON'T REMOVE -# This keeps the folder from disappearing diff --git a/bin/nds/Debug/.gitignore b/bin/nds/Debug/.gitignore deleted file mode 100644 index 9bfc4a51d..000000000 --- a/bin/nds/Debug/.gitignore +++ /dev/null @@ -1,3 +0,0 @@ -*.arm9 -*.elf* -*.nds diff --git a/bin/nds/Release/.gitignore b/bin/nds/Release/.gitignore deleted file mode 100644 index 9bfc4a51d..000000000 --- a/bin/nds/Release/.gitignore +++ /dev/null @@ -1,3 +0,0 @@ -*.arm9 -*.elf* -*.nds diff --git a/cmake/Modules/FindOPENMPT.cmake b/cmake/Modules/FindOPENMPT.cmake new file mode 100644 index 000000000..2d334b6f0 --- /dev/null +++ b/cmake/Modules/FindOPENMPT.cmake @@ -0,0 +1,23 @@ +include(LibFindMacros) + +libfind_pkg_check_modules(OPENMPT_PKGCONF OPENMPT) + +find_path(OPENMPT_INCLUDE_DIR + NAMES libopenmpt.h + PATHS + ${OPENMPT_PKGCONF_INCLUDE_DIRS} + "/usr/include/libopenmpt" + "/usr/local/include/libopenmpt" +) + +find_library(OPENMPT_LIBRARY + NAMES openmpt + PATHS + ${OPENMPT_PKGCONF_LIBRARY_DIRS} + "/usr/lib" + "/usr/local/lib" +) + +set(OPENMPT_PROCESS_INCLUDES OPENMPT_INCLUDE_DIR) +set(OPENMPT_PROCESS_LIBS OPENMPT_LIBRARY) +libfind_process(OPENMPT) \ No newline at end of file diff --git a/libs/DLL-README.txt b/libs/DLL-README.txt index 058ec0685..45680c535 100644 --- a/libs/DLL-README.txt +++ b/libs/DLL-README.txt @@ -7,6 +7,7 @@ Here are the required DLLs, per build. For each architecture, copy all the binar * libs\dll-binaries\[i686/x86_64] * libs\SDL2\[i686/x86_64]...\bin * libs\SDL2_mixer\[i686/x86_64]...\bin +* libs\libopenmpt\[x86/x86_64]...\bin\mingw and don't forget to build r_opengl.dll for srb2dd. @@ -17,6 +18,7 @@ and don't forget to build r_opengl.dll for srb2dd. * libs\dll-binaries\i686\mgwhelp.dll (depend for exchndl.dll) * libs\SDL2\i686-w64-mingw32\bin\SDL2.dll * libs\SDL2_mixer\i686-w64-mingw32\bin\*.dll (get everything) +* libs\libopenmpt\x86\bin\mingw\libopenmpt.dll ## srb2win, 64-bit @@ -25,6 +27,7 @@ and don't forget to build r_opengl.dll for srb2dd. * libs\dll-binaries\x86_64\mgwhelp.dll (depend for exchndl.dll) * libs\SDL2\x86_64-w64-mingw32\bin\SDL2.dll * libs\SDL2_mixer\x86_64-w64-mingw32\bin\*.dll (get everything) +* libs\libopenmpt\x86_64\bin\mingw\libopenmpt.dll ## srb2dd, 32-bit diff --git a/libs/libopenmpt.props b/libs/libopenmpt.props new file mode 100644 index 000000000..8825907b6 --- /dev/null +++ b/libs/libopenmpt.props @@ -0,0 +1,16 @@ + + + + + + $(SolutionDir)libs\libopenmpt\inc;$(IncludePath) + $(SolutionDir)libs\libopenmpt\lib\x86;$(LibraryPath) + $(SolutionDir)libs\libopenmpt\lib\x86_64;$(LibraryPath) + + + + libopenmpt.lib;%(AdditionalDependencies) + + + + \ No newline at end of file diff --git a/libs/libopenmpt/LICENSE.txt b/libs/libopenmpt/LICENSE.txt new file mode 100644 index 000000000..e0f012166 --- /dev/null +++ b/libs/libopenmpt/LICENSE.txt @@ -0,0 +1,26 @@ +Copyright (c) 2004-2019, OpenMPT contributors +Copyright (c) 1997-2003, Olivier Lapicque +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + * Neither the name of the OpenMPT project nor the + names of its contributors may be used to endorse or promote products + derived from this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE CONTRIBUTORS ``AS IS'' AND ANY +EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY +DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + diff --git a/libs/libopenmpt/Licenses/License.Vorbis.txt b/libs/libopenmpt/Licenses/License.Vorbis.txt new file mode 100644 index 000000000..153b926a1 --- /dev/null +++ b/libs/libopenmpt/Licenses/License.Vorbis.txt @@ -0,0 +1,28 @@ +Copyright (c) 2002-2018 Xiph.org Foundation + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions +are met: + +- Redistributions of source code must retain the above copyright +notice, this list of conditions and the following disclaimer. + +- Redistributions in binary form must reproduce the above copyright +notice, this list of conditions and the following disclaimer in the +documentation and/or other materials provided with the distribution. + +- Neither the name of the Xiph.org Foundation nor the names of its +contributors may be used to endorse or promote products derived from +this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION +OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/libs/libopenmpt/Licenses/License.mpg123.Authors.txt b/libs/libopenmpt/Licenses/License.mpg123.Authors.txt new file mode 100644 index 000000000..c1eac976d --- /dev/null +++ b/libs/libopenmpt/Licenses/License.mpg123.Authors.txt @@ -0,0 +1,175 @@ +This is an attempt to give credit to the people who contributed in some way to the mpg123 project. +There are names and email addresses listed. Please use these addresses only to contact contributors with some question about their mpg123 contribution. +You are explicitly not allowed to send them unwanted business offers or to question the quality of their sex life. +-------------------- + +Being on the list of contributing authors not necessarily means that there +is significant copyright in parts of the source code. There are obviously +contributions of differing complexity. I try to mention people who motivated +changes at least by suggesting some definite code changes, even if their +code did not enter the mpg123 source verbatim. Trivial changes like pointing +out ovbious syntax errors that make compilers cry do not land here. + +-------------------- + +Current maintainers with various sorts of contributions: + Thomas Orgis + Patrick Dehne + Jonathan Yong <10walls@gmail.com> + Taihei Momma + +Co-initiator of the revived mpg123 project, but not that involved anymore: + Nicholas J Humfrey + +Special thanks go to Taihei, the person who keeps the assembly optimisations alive +and takes care of portability to OSX/iOS platforms. + +Generic address pointing to the current maintainer (hopefully still works in future in case maintainership will change again): + +The creator: Michael Hipp (email: hippm@informatik.uni-tuebingen.de - please bother maintainers first) + +Contributions/ideas Thomas Orgis era (includes backports from mhipp trunk): + +Won-Kyu Park : patch to get rid of asm textrels (x86 PIC) +Michael Weiser : update of coreaudio output to AudioComponents API +Bent Bisballe Nyeng : patch for MPG123_NO_PEEK_END and MPG123_FORCE_SEEKABLE +Eric S. Raymond : man page fixes +Tobias Weber : patch for --disable-equalizer +Hans de Goede : patch to skip APE tags +Stephan Vedder : MSVC++ 2013 port update +Rajeev V. Pillai : pointing out/patching issues in HTTP code and behaviour of mpg123 remote/terminal control +Jarno Lehtinen : tinyalsa output +Anthony Wells : initial version of ID3v2 APIC patch +David Wohlferd : Win32 WaveOut buffer destructor fix. +Mike Gorchak : QNX native audio output (QSA) +Dan McGee : various patches (also for test suite) +Jonathan Yong (jon_y) <10walls@gmail.com>: win32 hacking, win32 wasapi audio. +Malcolm Boczek : Common language runtime wrapper +Elbert Pol (TeLLie) : OS/2 port fixup +Jeroen Valkonet : motivate pitch control, suggestive patch for pitch command in generic control interface +Andy Hefner : patch for that second UTF16 issue +Taihei Monma : A whole lot of new/improved assembler code, including Altivec! +Christian Weisgerber , Brad Smith: sndio output +Patrick Dehne (P4tr3ck) : more MSVC++ porting, patch to handle missing bit reservoirs +Thorsten Glaser : icy2utf8, suggest utf8 locale stuff +Dan Smith : ABI fixes for ensuring stack alignment (esp. for MinGW-built DLL with MSVC) +Michael Ryzhykh : mpg123.spec.in +Stefan Lenselink : initial aRts output +Sergej Kvachonok : win32 audio rewrite +Winston: SunOS-4.1.4/gcc-2.7.0 testing and suggestions for fixes (legacy Makefile, integer type headers) +Mika Tiainen: pointing out the fix for the UTF to ASCII filtering of tags to actually work +Nick Kurshev : extended 3dnow (from mplayer) +Zuxy Meng : SSE (from mplayer) +Honza : idea and prototype patch for ICY meta data support +Petr Baudis : patches: term sigcont, id3 display unicode fallback and condensed output +Petr Salinger : i486 enhancement +mpdavig@users.sourceforge.net: linux-ppc-nas Makefile.legacy entry +Adrian Bacon : patched decode_i586_dither (noise shaped float/int rounding) +Cool Feet Audio project : realtime equalizer control +Steve Grundell : clean stdout in control mode with stdout decoding +Romain Dolbeau : Altivec support (taken from mplayer) +higway : MMX Patch +Clemens Ladisch : ALSA 0.9/1.0 support + +Debian Daniel Kobras era: + +Steve Kemp +Dan Olson +Syuuhei Kashiyama +Rupert Levene +Andreas Dilger +Erik B. Andersen +Chris Butler +Martin Sjogren +Chet Hosey +Roland Rosenfeld + + +Debian Colin Watson era: + +Helge Deller +Chet Hosey +Christopher C. Chimelis +Roland Rosenfeld +Marcelo E. Magallon + + +Initial Debianers: + +Tommi Virtanen +Paul Haggart + + +Contributions/ideas Michael Hipp era: + +Mikko Tommila: DCT9 +Oliver Fromme +MPEG Software Simulation Group: reference decoder package +Tobias Bading: idea for DCT64 in subband synthesis from maplay package +Jeff Tsay and Mikko Tommila: MDCT36 from maplay package +Philipp Knirsch : DCT36/manual unroll idea +Thomas Woerner: SGI Audio +Damien Clermonte: HP-UX audio fixes +Niclas Lindstrom : OS2 port +Stefan Bieschewski : Pentium optimizations, decode_i586.s +Martin Denn : NAS port +Niklas Beisert : MPEG 2.5 tables + and : NetBSD Patch(es) +Kevin Brintnall : BSD patch +Tony Million: win32 port +Steven Tiger Lang: advanced shuffle +Eric B. Mitchell: esd port +Ryan R. Prosser : esd port for Solaris +Andreas Neuhaus: initial generic control interface + +(additionally fetched from changelog:) + +Ralf Hildebrandt : audio_alib changes +: BSDOS 4.0 with gcc added to Makefile +Bertrand Petit : frontend changes +Erik Mouw : SGI audio fix for non RAD machines +Daniel O'Connor : freebsd-esd make-entry +D. Skarda <0rfelyus@atrey.karlin.mff.cuni.cz>: enhanced head_check +Wilson, Jeff D : xterm-title +Robert Bihlmeyer : esd changes +Hannu Napari's : SGI audio patches +: native AIX support +: playlist patch +Gilles Zunino : SGI audio patches +Matthew Parslow : esdserver patch +: equalizer patch (equalfile setting) +Ducroquet Erwan : HPUX/ALib support +Shane Wegner : genrepatch +Samuel Audet : wav-File patch +"J. Dean Brederson" : SGI-RAD support +Chou Ye-chi : sajberplay/FreeBSD patch +Fabrice Bellard : 486 optimizations +A. Hermansen and J. Kysela : ALSA output +KIMURA Takuhiro : K6-3DNow +Petr Stehlik : MINT +Andy : float2int speed up proposal +Brian Foutz : TK3Play +Thomas Niederreiter : RIFF header fix +Stefan Gybas : m68k patch +Grant Erickson : Linux PPC patch +Peter Berger : BSDi patch +Henrik P Johnson : HTTP auth +Steven Tiger Lang : advanced shuffle +"Brian J. Swetland" : front-end (remote) patch + +Tillmann Steinbrecher : shuffle patch +M.Stekelenburg : i386-getbits +Antti Andreimann : outburst patch +Hur TaeSung : 'http accept' patch + +(from post-0.59 changes that yet have to go into new trunk:) + +Hans Schwengeler : audio_dec additions +Wojciech Barañski's Mp3Play (check the tools folder): Mp3Play frontend +Daniel Koukola: audio_oss.c patch +Munechika SUMIKAWA : IPv6 +TEMNOTA : HTTP,FTP patch/playlist fix +Peter Surda : VBR patch +Ben : ARM startup time improvements +Dave MacKenzie : init_output() patch +pasky's : close-on-stop patch diff --git a/libs/libopenmpt/Licenses/License.mpg123.txt b/libs/libopenmpt/Licenses/License.mpg123.txt new file mode 100644 index 000000000..d7bb85fc3 --- /dev/null +++ b/libs/libopenmpt/Licenses/License.mpg123.txt @@ -0,0 +1,772 @@ +This is the file that contains the terms of use, copying, etc. for the mpg123 distribution package. + +Main message, to include in "About ..." boxes, etc: + + Copyright (c) 1995-2013 by Michael Hipp and others, + free software under the terms of the LGPL v2.1 + +There is an attempt to cover the actual list of authors in the AUTHORS file. +Project maintainer since 2006 is Thomas Orgis and many people have contributed +since the Michael Hipp era, but he stays the initial source and it would +be impractical to count them all individually, so it's "and others". +Source files contain the phrase "the mpg123 project" to the same effect +in their license boilerplate; especially those that were added after +maintainership changed. The person mainly responsible for the first version +is usually named in the phrase "initially written by ...". + +All files in the distribution that don't carry a license note on their own are +licensed under the terms of the LGPL 2.1; exceptions may apply, especially to +files not in the official distribution but in the revision control repository. + +The formal license text follows. + +======================= +1. The LGPL version 2.1 +======================= + + + GNU LESSER GENERAL PUBLIC LICENSE + Version 2.1, February 1999 + + Copyright (C) 1991, 1999 Free Software Foundation, Inc. + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + +[This is the first released version of the Lesser GPL. It also counts + as the successor of the GNU Library Public License, version 2, hence + the version number 2.1.] + + Preamble + + The licenses for most software are designed to take away your +freedom to share and change it. By contrast, the GNU General Public +Licenses are intended to guarantee your freedom to share and change +free software--to make sure the software is free for all its users. + + This license, the Lesser General Public License, applies to some +specially designated software packages--typically libraries--of the +Free Software Foundation and other authors who decide to use it. You +can use it too, but we suggest you first think carefully about whether +this license or the ordinary General Public License is the better +strategy to use in any particular case, based on the explanations below. + + When we speak of free software, we are referring to freedom of use, +not price. Our General Public Licenses are designed to make sure that +you have the freedom to distribute copies of free software (and charge +for this service if you wish); that you receive source code or can get +it if you want it; that you can change the software and use pieces of +it in new free programs; and that you are informed that you can do +these things. + + To protect your rights, we need to make restrictions that forbid +distributors to deny you these rights or to ask you to surrender these +rights. These restrictions translate to certain responsibilities for +you if you distribute copies of the library or if you modify it. + + For example, if you distribute copies of the library, whether gratis +or for a fee, you must give the recipients all the rights that we gave +you. You must make sure that they, too, receive or can get the source +code. If you link other code with the library, you must provide +complete object files to the recipients, so that they can relink them +with the library after making changes to the library and recompiling +it. And you must show them these terms so they know their rights. + + We protect your rights with a two-step method: (1) we copyright the +library, and (2) we offer you this license, which gives you legal +permission to copy, distribute and/or modify the library. + + To protect each distributor, we want to make it very clear that +there is no warranty for the free library. Also, if the library is +modified by someone else and passed on, the recipients should know +that what they have is not the original version, so that the original +author's reputation will not be affected by problems that might be +introduced by others. + + Finally, software patents pose a constant threat to the existence of +any free program. We wish to make sure that a company cannot +effectively restrict the users of a free program by obtaining a +restrictive license from a patent holder. Therefore, we insist that +any patent license obtained for a version of the library must be +consistent with the full freedom of use specified in this license. + + Most GNU software, including some libraries, is covered by the +ordinary GNU General Public License. This license, the GNU Lesser +General Public License, applies to certain designated libraries, and +is quite different from the ordinary General Public License. We use +this license for certain libraries in order to permit linking those +libraries into non-free programs. + + When a program is linked with a library, whether statically or using +a shared library, the combination of the two is legally speaking a +combined work, a derivative of the original library. The ordinary +General Public License therefore permits such linking only if the +entire combination fits its criteria of freedom. The Lesser General +Public License permits more lax criteria for linking other code with +the library. + + We call this license the "Lesser" General Public License because it +does Less to protect the user's freedom than the ordinary General +Public License. It also provides other free software developers Less +of an advantage over competing non-free programs. These disadvantages +are the reason we use the ordinary General Public License for many +libraries. However, the Lesser license provides advantages in certain +special circumstances. + + For example, on rare occasions, there may be a special need to +encourage the widest possible use of a certain library, so that it becomes +a de-facto standard. To achieve this, non-free programs must be +allowed to use the library. A more frequent case is that a free +library does the same job as widely used non-free libraries. In this +case, there is little to gain by limiting the free library to free +software only, so we use the Lesser General Public License. + + In other cases, permission to use a particular library in non-free +programs enables a greater number of people to use a large body of +free software. For example, permission to use the GNU C Library in +non-free programs enables many more people to use the whole GNU +operating system, as well as its variant, the GNU/Linux operating +system. + + Although the Lesser General Public License is Less protective of the +users' freedom, it does ensure that the user of a program that is +linked with the Library has the freedom and the wherewithal to run +that program using a modified version of the Library. + + The precise terms and conditions for copying, distribution and +modification follow. Pay close attention to the difference between a +"work based on the library" and a "work that uses the library". The +former contains code derived from the library, whereas the latter must +be combined with the library in order to run. + + GNU LESSER GENERAL PUBLIC LICENSE + TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION + + 0. This License Agreement applies to any software library or other +program which contains a notice placed by the copyright holder or +other authorized party saying it may be distributed under the terms of +this Lesser General Public License (also called "this License"). +Each licensee is addressed as "you". + + A "library" means a collection of software functions and/or data +prepared so as to be conveniently linked with application programs +(which use some of those functions and data) to form executables. + + The "Library", below, refers to any such software library or work +which has been distributed under these terms. A "work based on the +Library" means either the Library or any derivative work under +copyright law: that is to say, a work containing the Library or a +portion of it, either verbatim or with modifications and/or translated +straightforwardly into another language. (Hereinafter, translation is +included without limitation in the term "modification".) + + "Source code" for a work means the preferred form of the work for +making modifications to it. For a library, complete source code means +all the source code for all modules it contains, plus any associated +interface definition files, plus the scripts used to control compilation +and installation of the library. + + Activities other than copying, distribution and modification are not +covered by this License; they are outside its scope. The act of +running a program using the Library is not restricted, and output from +such a program is covered only if its contents constitute a work based +on the Library (independent of the use of the Library in a tool for +writing it). Whether that is true depends on what the Library does +and what the program that uses the Library does. + + 1. You may copy and distribute verbatim copies of the Library's +complete source code as you receive it, in any medium, provided that +you conspicuously and appropriately publish on each copy an +appropriate copyright notice and disclaimer of warranty; keep intact +all the notices that refer to this License and to the absence of any +warranty; and distribute a copy of this License along with the +Library. + + You may charge a fee for the physical act of transferring a copy, +and you may at your option offer warranty protection in exchange for a +fee. + + 2. You may modify your copy or copies of the Library or any portion +of it, thus forming a work based on the Library, and copy and +distribute such modifications or work under the terms of Section 1 +above, provided that you also meet all of these conditions: + + a) The modified work must itself be a software library. + + b) You must cause the files modified to carry prominent notices + stating that you changed the files and the date of any change. + + c) You must cause the whole of the work to be licensed at no + charge to all third parties under the terms of this License. + + d) If a facility in the modified Library refers to a function or a + table of data to be supplied by an application program that uses + the facility, other than as an argument passed when the facility + is invoked, then you must make a good faith effort to ensure that, + in the event an application does not supply such function or + table, the facility still operates, and performs whatever part of + its purpose remains meaningful. + + (For example, a function in a library to compute square roots has + a purpose that is entirely well-defined independent of the + application. Therefore, Subsection 2d requires that any + application-supplied function or table used by this function must + be optional: if the application does not supply it, the square + root function must still compute square roots.) + +These requirements apply to the modified work as a whole. If +identifiable sections of that work are not derived from the Library, +and can be reasonably considered independent and separate works in +themselves, then this License, and its terms, do not apply to those +sections when you distribute them as separate works. But when you +distribute the same sections as part of a whole which is a work based +on the Library, the distribution of the whole must be on the terms of +this License, whose permissions for other licensees extend to the +entire whole, and thus to each and every part regardless of who wrote +it. + +Thus, it is not the intent of this section to claim rights or contest +your rights to work written entirely by you; rather, the intent is to +exercise the right to control the distribution of derivative or +collective works based on the Library. + +In addition, mere aggregation of another work not based on the Library +with the Library (or with a work based on the Library) on a volume of +a storage or distribution medium does not bring the other work under +the scope of this License. + + 3. You may opt to apply the terms of the ordinary GNU General Public +License instead of this License to a given copy of the Library. To do +this, you must alter all the notices that refer to this License, so +that they refer to the ordinary GNU General Public License, version 2, +instead of to this License. (If a newer version than version 2 of the +ordinary GNU General Public License has appeared, then you can specify +that version instead if you wish.) Do not make any other change in +these notices. + + Once this change is made in a given copy, it is irreversible for +that copy, so the ordinary GNU General Public License applies to all +subsequent copies and derivative works made from that copy. + + This option is useful when you wish to copy part of the code of +the Library into a program that is not a library. + + 4. You may copy and distribute the Library (or a portion or +derivative of it, under Section 2) in object code or executable form +under the terms of Sections 1 and 2 above provided that you accompany +it with the complete corresponding machine-readable source code, which +must be distributed under the terms of Sections 1 and 2 above on a +medium customarily used for software interchange. + + If distribution of object code is made by offering access to copy +from a designated place, then offering equivalent access to copy the +source code from the same place satisfies the requirement to +distribute the source code, even though third parties are not +compelled to copy the source along with the object code. + + 5. A program that contains no derivative of any portion of the +Library, but is designed to work with the Library by being compiled or +linked with it, is called a "work that uses the Library". Such a +work, in isolation, is not a derivative work of the Library, and +therefore falls outside the scope of this License. + + However, linking a "work that uses the Library" with the Library +creates an executable that is a derivative of the Library (because it +contains portions of the Library), rather than a "work that uses the +library". The executable is therefore covered by this License. +Section 6 states terms for distribution of such executables. + + When a "work that uses the Library" uses material from a header file +that is part of the Library, the object code for the work may be a +derivative work of the Library even though the source code is not. +Whether this is true is especially significant if the work can be +linked without the Library, or if the work is itself a library. The +threshold for this to be true is not precisely defined by law. + + If such an object file uses only numerical parameters, data +structure layouts and accessors, and small macros and small inline +functions (ten lines or less in length), then the use of the object +file is unrestricted, regardless of whether it is legally a derivative +work. (Executables containing this object code plus portions of the +Library will still fall under Section 6.) + + Otherwise, if the work is a derivative of the Library, you may +distribute the object code for the work under the terms of Section 6. +Any executables containing that work also fall under Section 6, +whether or not they are linked directly with the Library itself. + + 6. As an exception to the Sections above, you may also combine or +link a "work that uses the Library" with the Library to produce a +work containing portions of the Library, and distribute that work +under terms of your choice, provided that the terms permit +modification of the work for the customer's own use and reverse +engineering for debugging such modifications. + + You must give prominent notice with each copy of the work that the +Library is used in it and that the Library and its use are covered by +this License. You must supply a copy of this License. If the work +during execution displays copyright notices, you must include the +copyright notice for the Library among them, as well as a reference +directing the user to the copy of this License. Also, you must do one +of these things: + + a) Accompany the work with the complete corresponding + machine-readable source code for the Library including whatever + changes were used in the work (which must be distributed under + Sections 1 and 2 above); and, if the work is an executable linked + with the Library, with the complete machine-readable "work that + uses the Library", as object code and/or source code, so that the + user can modify the Library and then relink to produce a modified + executable containing the modified Library. (It is understood + that the user who changes the contents of definitions files in the + Library will not necessarily be able to recompile the application + to use the modified definitions.) + + b) Use a suitable shared library mechanism for linking with the + Library. A suitable mechanism is one that (1) uses at run time a + copy of the library already present on the user's computer system, + rather than copying library functions into the executable, and (2) + will operate properly with a modified version of the library, if + the user installs one, as long as the modified version is + interface-compatible with the version that the work was made with. + + c) Accompany the work with a written offer, valid for at + least three years, to give the same user the materials + specified in Subsection 6a, above, for a charge no more + than the cost of performing this distribution. + + d) If distribution of the work is made by offering access to copy + from a designated place, offer equivalent access to copy the above + specified materials from the same place. + + e) Verify that the user has already received a copy of these + materials or that you have already sent this user a copy. + + For an executable, the required form of the "work that uses the +Library" must include any data and utility programs needed for +reproducing the executable from it. However, as a special exception, +the materials to be distributed need not include anything that is +normally distributed (in either source or binary form) with the major +components (compiler, kernel, and so on) of the operating system on +which the executable runs, unless that component itself accompanies +the executable. + + It may happen that this requirement contradicts the license +restrictions of other proprietary libraries that do not normally +accompany the operating system. Such a contradiction means you cannot +use both them and the Library together in an executable that you +distribute. + + 7. You may place library facilities that are a work based on the +Library side-by-side in a single library together with other library +facilities not covered by this License, and distribute such a combined +library, provided that the separate distribution of the work based on +the Library and of the other library facilities is otherwise +permitted, and provided that you do these two things: + + a) Accompany the combined library with a copy of the same work + based on the Library, uncombined with any other library + facilities. This must be distributed under the terms of the + Sections above. + + b) Give prominent notice with the combined library of the fact + that part of it is a work based on the Library, and explaining + where to find the accompanying uncombined form of the same work. + + 8. You may not copy, modify, sublicense, link with, or distribute +the Library except as expressly provided under this License. Any +attempt otherwise to copy, modify, sublicense, link with, or +distribute the Library is void, and will automatically terminate your +rights under this License. However, parties who have received copies, +or rights, from you under this License will not have their licenses +terminated so long as such parties remain in full compliance. + + 9. You are not required to accept this License, since you have not +signed it. However, nothing else grants you permission to modify or +distribute the Library or its derivative works. These actions are +prohibited by law if you do not accept this License. Therefore, by +modifying or distributing the Library (or any work based on the +Library), you indicate your acceptance of this License to do so, and +all its terms and conditions for copying, distributing or modifying +the Library or works based on it. + + 10. Each time you redistribute the Library (or any work based on the +Library), the recipient automatically receives a license from the +original licensor to copy, distribute, link with or modify the Library +subject to these terms and conditions. You may not impose any further +restrictions on the recipients' exercise of the rights granted herein. +You are not responsible for enforcing compliance by third parties with +this License. + + 11. If, as a consequence of a court judgment or allegation of patent +infringement or for any other reason (not limited to patent issues), +conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot +distribute so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you +may not distribute the Library at all. For example, if a patent +license would not permit royalty-free redistribution of the Library by +all those who receive copies directly or indirectly through you, then +the only way you could satisfy both it and this License would be to +refrain entirely from distribution of the Library. + +If any portion of this section is held invalid or unenforceable under any +particular circumstance, the balance of the section is intended to apply, +and the section as a whole is intended to apply in other circumstances. + +It is not the purpose of this section to induce you to infringe any +patents or other property right claims or to contest validity of any +such claims; this section has the sole purpose of protecting the +integrity of the free software distribution system which is +implemented by public license practices. Many people have made +generous contributions to the wide range of software distributed +through that system in reliance on consistent application of that +system; it is up to the author/donor to decide if he or she is willing +to distribute software through any other system and a licensee cannot +impose that choice. + +This section is intended to make thoroughly clear what is believed to +be a consequence of the rest of this License. + + 12. If the distribution and/or use of the Library is restricted in +certain countries either by patents or by copyrighted interfaces, the +original copyright holder who places the Library under this License may add +an explicit geographical distribution limitation excluding those countries, +so that distribution is permitted only in or among countries not thus +excluded. In such case, this License incorporates the limitation as if +written in the body of this License. + + 13. The Free Software Foundation may publish revised and/or new +versions of the Lesser General Public License from time to time. +Such new versions will be similar in spirit to the present version, +but may differ in detail to address new problems or concerns. + +Each version is given a distinguishing version number. If the Library +specifies a version number of this License which applies to it and +"any later version", you have the option of following the terms and +conditions either of that version or of any later version published by +the Free Software Foundation. If the Library does not specify a +license version number, you may choose any version ever published by +the Free Software Foundation. + + 14. If you wish to incorporate parts of the Library into other free +programs whose distribution conditions are incompatible with these, +write to the author to ask for permission. For software which is +copyrighted by the Free Software Foundation, write to the Free +Software Foundation; we sometimes make exceptions for this. Our +decision will be guided by the two goals of preserving the free status +of all derivatives of our free software and of promoting the sharing +and reuse of software generally. + + NO WARRANTY + + 15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO +WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW. +EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR +OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY +KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE +LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME +THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. + + 16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN +WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY +AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU +FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR +CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE +LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING +RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A +FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF +SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH +DAMAGES. + + END OF TERMS AND CONDITIONS + + +==================== +2. The GPL version 2 +==================== + + + GNU GENERAL PUBLIC LICENSE + Version 2, June 1991 + + Copyright (C) 1989, 1991 Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The licenses for most software are designed to take away your +freedom to share and change it. By contrast, the GNU General Public +License is intended to guarantee your freedom to share and change free +software--to make sure the software is free for all its users. This +General Public License applies to most of the Free Software +Foundation's software and to any other program whose authors commit to +using it. (Some other Free Software Foundation software is covered by +the GNU Lesser General Public License instead.) You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +this service if you wish), that you receive source code or can get it +if you want it, that you can change the software or use pieces of it +in new free programs; and that you know you can do these things. + + To protect your rights, we need to make restrictions that forbid +anyone to deny you these rights or to ask you to surrender the rights. +These restrictions translate to certain responsibilities for you if you +distribute copies of the software, or if you modify it. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must give the recipients all the rights that +you have. You must make sure that they, too, receive or can get the +source code. And you must show them these terms so they know their +rights. + + We protect your rights with two steps: (1) copyright the software, and +(2) offer you this license which gives you legal permission to copy, +distribute and/or modify the software. + + Also, for each author's protection and ours, we want to make certain +that everyone understands that there is no warranty for this free +software. If the software is modified by someone else and passed on, we +want its recipients to know that what they have is not the original, so +that any problems introduced by others will not reflect on the original +authors' reputations. + + Finally, any free program is threatened constantly by software +patents. We wish to avoid the danger that redistributors of a free +program will individually obtain patent licenses, in effect making the +program proprietary. To prevent this, we have made it clear that any +patent must be licensed for everyone's free use or not licensed at all. + + The precise terms and conditions for copying, distribution and +modification follow. + + GNU GENERAL PUBLIC LICENSE + TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION + + 0. This License applies to any program or other work which contains +a notice placed by the copyright holder saying it may be distributed +under the terms of this General Public License. The "Program", below, +refers to any such program or work, and a "work based on the Program" +means either the Program or any derivative work under copyright law: +that is to say, a work containing the Program or a portion of it, +either verbatim or with modifications and/or translated into another +language. (Hereinafter, translation is included without limitation in +the term "modification".) Each licensee is addressed as "you". + +Activities other than copying, distribution and modification are not +covered by this License; they are outside its scope. The act of +running the Program is not restricted, and the output from the Program +is covered only if its contents constitute a work based on the +Program (independent of having been made by running the Program). +Whether that is true depends on what the Program does. + + 1. You may copy and distribute verbatim copies of the Program's +source code as you receive it, in any medium, provided that you +conspicuously and appropriately publish on each copy an appropriate +copyright notice and disclaimer of warranty; keep intact all the +notices that refer to this License and to the absence of any warranty; +and give any other recipients of the Program a copy of this License +along with the Program. + +You may charge a fee for the physical act of transferring a copy, and +you may at your option offer warranty protection in exchange for a fee. + + 2. You may modify your copy or copies of the Program or any portion +of it, thus forming a work based on the Program, and copy and +distribute such modifications or work under the terms of Section 1 +above, provided that you also meet all of these conditions: + + a) You must cause the modified files to carry prominent notices + stating that you changed the files and the date of any change. + + b) You must cause any work that you distribute or publish, that in + whole or in part contains or is derived from the Program or any + part thereof, to be licensed as a whole at no charge to all third + parties under the terms of this License. + + c) If the modified program normally reads commands interactively + when run, you must cause it, when started running for such + interactive use in the most ordinary way, to print or display an + announcement including an appropriate copyright notice and a + notice that there is no warranty (or else, saying that you provide + a warranty) and that users may redistribute the program under + these conditions, and telling the user how to view a copy of this + License. (Exception: if the Program itself is interactive but + does not normally print such an announcement, your work based on + the Program is not required to print an announcement.) + +These requirements apply to the modified work as a whole. If +identifiable sections of that work are not derived from the Program, +and can be reasonably considered independent and separate works in +themselves, then this License, and its terms, do not apply to those +sections when you distribute them as separate works. But when you +distribute the same sections as part of a whole which is a work based +on the Program, the distribution of the whole must be on the terms of +this License, whose permissions for other licensees extend to the +entire whole, and thus to each and every part regardless of who wrote it. + +Thus, it is not the intent of this section to claim rights or contest +your rights to work written entirely by you; rather, the intent is to +exercise the right to control the distribution of derivative or +collective works based on the Program. + +In addition, mere aggregation of another work not based on the Program +with the Program (or with a work based on the Program) on a volume of +a storage or distribution medium does not bring the other work under +the scope of this License. + + 3. You may copy and distribute the Program (or a work based on it, +under Section 2) in object code or executable form under the terms of +Sections 1 and 2 above provided that you also do one of the following: + + a) Accompany it with the complete corresponding machine-readable + source code, which must be distributed under the terms of Sections + 1 and 2 above on a medium customarily used for software interchange; or, + + b) Accompany it with a written offer, valid for at least three + years, to give any third party, for a charge no more than your + cost of physically performing source distribution, a complete + machine-readable copy of the corresponding source code, to be + distributed under the terms of Sections 1 and 2 above on a medium + customarily used for software interchange; or, + + c) Accompany it with the information you received as to the offer + to distribute corresponding source code. (This alternative is + allowed only for noncommercial distribution and only if you + received the program in object code or executable form with such + an offer, in accord with Subsection b above.) + +The source code for a work means the preferred form of the work for +making modifications to it. For an executable work, complete source +code means all the source code for all modules it contains, plus any +associated interface definition files, plus the scripts used to +control compilation and installation of the executable. However, as a +special exception, the source code distributed need not include +anything that is normally distributed (in either source or binary +form) with the major components (compiler, kernel, and so on) of the +operating system on which the executable runs, unless that component +itself accompanies the executable. + +If distribution of executable or object code is made by offering +access to copy from a designated place, then offering equivalent +access to copy the source code from the same place counts as +distribution of the source code, even though third parties are not +compelled to copy the source along with the object code. + + 4. You may not copy, modify, sublicense, or distribute the Program +except as expressly provided under this License. Any attempt +otherwise to copy, modify, sublicense or distribute the Program is +void, and will automatically terminate your rights under this License. +However, parties who have received copies, or rights, from you under +this License will not have their licenses terminated so long as such +parties remain in full compliance. + + 5. You are not required to accept this License, since you have not +signed it. However, nothing else grants you permission to modify or +distribute the Program or its derivative works. These actions are +prohibited by law if you do not accept this License. Therefore, by +modifying or distributing the Program (or any work based on the +Program), you indicate your acceptance of this License to do so, and +all its terms and conditions for copying, distributing or modifying +the Program or works based on it. + + 6. Each time you redistribute the Program (or any work based on the +Program), the recipient automatically receives a license from the +original licensor to copy, distribute or modify the Program subject to +these terms and conditions. You may not impose any further +restrictions on the recipients' exercise of the rights granted herein. +You are not responsible for enforcing compliance by third parties to +this License. + + 7. If, as a consequence of a court judgment or allegation of patent +infringement or for any other reason (not limited to patent issues), +conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot +distribute so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you +may not distribute the Program at all. For example, if a patent +license would not permit royalty-free redistribution of the Program by +all those who receive copies directly or indirectly through you, then +the only way you could satisfy both it and this License would be to +refrain entirely from distribution of the Program. + +If any portion of this section is held invalid or unenforceable under +any particular circumstance, the balance of the section is intended to +apply and the section as a whole is intended to apply in other +circumstances. + +It is not the purpose of this section to induce you to infringe any +patents or other property right claims or to contest validity of any +such claims; this section has the sole purpose of protecting the +integrity of the free software distribution system, which is +implemented by public license practices. Many people have made +generous contributions to the wide range of software distributed +through that system in reliance on consistent application of that +system; it is up to the author/donor to decide if he or she is willing +to distribute software through any other system and a licensee cannot +impose that choice. + +This section is intended to make thoroughly clear what is believed to +be a consequence of the rest of this License. + + 8. If the distribution and/or use of the Program is restricted in +certain countries either by patents or by copyrighted interfaces, the +original copyright holder who places the Program under this License +may add an explicit geographical distribution limitation excluding +those countries, so that distribution is permitted only in or among +countries not thus excluded. In such case, this License incorporates +the limitation as if written in the body of this License. + + 9. The Free Software Foundation may publish revised and/or new versions +of the General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + +Each version is given a distinguishing version number. If the Program +specifies a version number of this License which applies to it and "any +later version", you have the option of following the terms and conditions +either of that version or of any later version published by the Free +Software Foundation. If the Program does not specify a version number of +this License, you may choose any version ever published by the Free Software +Foundation. + + 10. If you wish to incorporate parts of the Program into other free +programs whose distribution conditions are different, write to the author +to ask for permission. For software which is copyrighted by the Free +Software Foundation, write to the Free Software Foundation; we sometimes +make exceptions for this. Our decision will be guided by the two goals +of preserving the free status of all derivatives of our free software and +of promoting the sharing and reuse of software generally. + + NO WARRANTY + + 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY +FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN +OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES +PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED +OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS +TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE +PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, +REPAIR OR CORRECTION. + + 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR +REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, +INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING +OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED +TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY +YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER +PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE +POSSIBILITY OF SUCH DAMAGES. + + END OF TERMS AND CONDITIONS diff --git a/libs/libopenmpt/Licenses/License.ogg.txt b/libs/libopenmpt/Licenses/License.ogg.txt new file mode 100644 index 000000000..6111c6c5a --- /dev/null +++ b/libs/libopenmpt/Licenses/License.ogg.txt @@ -0,0 +1,28 @@ +Copyright (c) 2002, Xiph.org Foundation + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions +are met: + +- Redistributions of source code must retain the above copyright +notice, this list of conditions and the following disclaimer. + +- Redistributions in binary form must reproduce the above copyright +notice, this list of conditions and the following disclaimer in the +documentation and/or other materials provided with the distribution. + +- Neither the name of the Xiph.org Foundation nor the names of its +contributors may be used to endorse or promote products derived from +this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION +OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/libs/libopenmpt/Licenses/License.zlib.txt b/libs/libopenmpt/Licenses/License.zlib.txt new file mode 100644 index 000000000..51106de47 --- /dev/null +++ b/libs/libopenmpt/Licenses/License.zlib.txt @@ -0,0 +1,115 @@ +ZLIB DATA COMPRESSION LIBRARY + +zlib 1.2.11 is a general purpose data compression library. All the code is +thread safe. The data format used by the zlib library is described by RFCs +(Request for Comments) 1950 to 1952 in the files +http://tools.ietf.org/html/rfc1950 (zlib format), rfc1951 (deflate format) and +rfc1952 (gzip format). + +All functions of the compression library are documented in the file zlib.h +(volunteer to write man pages welcome, contact zlib@gzip.org). A usage example +of the library is given in the file test/example.c which also tests that +the library is working correctly. Another example is given in the file +test/minigzip.c. The compression library itself is composed of all source +files in the root directory. + +To compile all files and run the test program, follow the instructions given at +the top of Makefile.in. In short "./configure; make test", and if that goes +well, "make install" should work for most flavors of Unix. For Windows, use +one of the special makefiles in win32/ or contrib/vstudio/ . For VMS, use +make_vms.com. + +Questions about zlib should be sent to , or to Gilles Vollant + for the Windows DLL version. The zlib home page is +http://zlib.net/ . Before reporting a problem, please check this site to +verify that you have the latest version of zlib; otherwise get the latest +version and check whether the problem still exists or not. + +PLEASE read the zlib FAQ http://zlib.net/zlib_faq.html before asking for help. + +Mark Nelson wrote an article about zlib for the Jan. 1997 +issue of Dr. Dobb's Journal; a copy of the article is available at +http://marknelson.us/1997/01/01/zlib-engine/ . + +The changes made in version 1.2.11 are documented in the file ChangeLog. + +Unsupported third party contributions are provided in directory contrib/ . + +zlib is available in Java using the java.util.zip package, documented at +http://java.sun.com/developer/technicalArticles/Programming/compression/ . + +A Perl interface to zlib written by Paul Marquess is available +at CPAN (Comprehensive Perl Archive Network) sites, including +http://search.cpan.org/~pmqs/IO-Compress-Zlib/ . + +A Python interface to zlib written by A.M. Kuchling is +available in Python 1.5 and later versions, see +http://docs.python.org/library/zlib.html . + +zlib is built into tcl: http://wiki.tcl.tk/4610 . + +An experimental package to read and write files in .zip format, written on top +of zlib by Gilles Vollant , is available in the +contrib/minizip directory of zlib. + + +Notes for some targets: + +- For Windows DLL versions, please see win32/DLL_FAQ.txt + +- For 64-bit Irix, deflate.c must be compiled without any optimization. With + -O, one libpng test fails. The test works in 32 bit mode (with the -n32 + compiler flag). The compiler bug has been reported to SGI. + +- zlib doesn't work with gcc 2.6.3 on a DEC 3000/300LX under OSF/1 2.1 it works + when compiled with cc. + +- On Digital Unix 4.0D (formely OSF/1) on AlphaServer, the cc option -std1 is + necessary to get gzprintf working correctly. This is done by configure. + +- zlib doesn't work on HP-UX 9.05 with some versions of /bin/cc. It works with + other compilers. Use "make test" to check your compiler. + +- gzdopen is not supported on RISCOS or BEOS. + +- For PalmOs, see http://palmzlib.sourceforge.net/ + + +Acknowledgments: + + The deflate format used by zlib was defined by Phil Katz. The deflate and + zlib specifications were written by L. Peter Deutsch. Thanks to all the + people who reported problems and suggested various improvements in zlib; they + are too numerous to cite here. + +Copyright notice: + + (C) 1995-2017 Jean-loup Gailly and Mark Adler + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. + + Jean-loup Gailly Mark Adler + jloup@gzip.org madler@alumni.caltech.edu + +If you use the zlib library in a product, we would appreciate *not* receiving +lengthy legal documents to sign. The sources are provided for free but without +warranty of any kind. The library has been entirely written by Jean-loup +Gailly and Mark Adler; it does not include third-party code. + +If you redistribute modified sources, we would appreciate that you include in +the file ChangeLog history information documenting your changes. Please read +the FAQ for more information on the distribution of modified source versions. diff --git a/libs/libopenmpt/SRB2NOTE-DEBIAN.md b/libs/libopenmpt/SRB2NOTE-DEBIAN.md new file mode 100644 index 000000000..7e050d29a --- /dev/null +++ b/libs/libopenmpt/SRB2NOTE-DEBIAN.md @@ -0,0 +1,90 @@ +# libopenmpt Debian backport info + +Backported libopenmpt 0.4.0 packages are available at ppa:stjr/srb2 +for Ubuntu Disco, Cosmic, Bionic, Xenial, and Trusty as of 2019/01/04. + +Debian Jessie users should use the Trusty package. Later Debian versions +may use Disco or another working version. + +* libopenmpt 0.4.0 source package: http://archive.ubuntu.com/ubuntu/pool/universe/libo/libopenmpt/libopenmpt_0.4.0-1.dsc + +# Backporting from Disco to Cosmic and Bionic + +Cosmic and Bionic require no changes to the source package. They have +the prerequisite `debhelper` and `dpkg-dev` versions, a matching +`automake` version (1.15), as well as G++ > 5. + +Use the `backportpackage` script to automatically tag the package to +Cosmic and Bionic, then upload to PPA: + +``` +sudo apt install ubuntu-dev-tools +export UBUMAIL="John Doe " # Name and email associated with your PGP sign key +backportpackage -d [cosmic/bionic] -u [path-to-ppa] --key=[key-fingerprint] http://archive.ubuntu.com/ubuntu/pool/universe/libo/libopenmpt/libopenmpt_0.4.0-1.dsc +``` + +# Backporting from Disco to Xenial + +Download the package: + +``` +dget http://archive.ubuntu.com/ubuntu/pool/universe/libo/libopenmpt/libopenmpt_0.4.0-1.dsc +``` + +Xenial has an earlier `debhelper` version, but the rest of the prerequisites +are available. + +The required changes (see patch `debian/libopenmpt-0.4.0-xenial-backport.diff` in this directory): + +* `debian/control` + * Add `automake` to Build-Depends + * Change `debhelper` version to `(>= 9.0~)` +* `debian/compat` + * Change to `10` + +Then run these commands: + +``` +dch -i # Edit the changelog; make sure the Name and email match the PGP sign key and that the changelog targets xenial +debuild -s -d -k0x[key-fingerprint] # Build the updated package +dput [path-to-ppa] [path-to-changes-file] # Upload to PPA +``` + +# Backporting from Disco to Trusty + +Download the package: + +``` +dget http://archive.ubuntu.com/ubuntu/pool/universe/libo/libopenmpt/libopenmpt_0.4.0-1.dsc +``` + +Trusty requires more changes because it uses G++ 4.8 whereas the source +package expects G++ >= 5. Automake is an earlier version as well -- +1.14 vs 1.15 -- so `autoreconf` needs to be run at build time. + +The required changes (see patch `debian/libopenmpt-0.4.0-trusty-backport.diff` in this directory): + +* `debian/control` + * Add `automake` and `libtool` to Build-Depends + * Change `debhelper` version to `(>= 9.0~)` + * Change `dpkg-dev` version to `(>= 1.17.0)` +* `debian/compat` + * Change to `10` +* `debian/rules` + * Under `override_dh_auto_configure`, input this line as the first command: + `autoreconf --force --install` + * This re-configures the package for Automake 1.14 +* `debian/libopenmpt-modplug1.symbols` and `debian/libopenmpt0.symbols` + * Delete these files + * The C++ ABI for G++ 4.8 is incompatible with G++ >= 5, so the + generated symbols will be different than the expected symbols + in the `*.symbols` files. Deleting these files will skip the + symbol check. + +Then run these commands: + +``` +dch -i # Edit the changelog; make sure the Name and email match the PGP sign key and that the changelog targets trusty +debuild -s -d -k0x[key-fingerprint] # Build the updated package +dput [path-to-ppa] [path-to-changes-file] # Upload to PPA +``` diff --git a/libs/libopenmpt/SRB2NOTE.md b/libs/libopenmpt/SRB2NOTE.md new file mode 100644 index 000000000..d664ddd7e --- /dev/null +++ b/libs/libopenmpt/SRB2NOTE.md @@ -0,0 +1,54 @@ +# libopenmpt mingw-w64 binary info + +Current built version as of 2019/05/23 is 0.4.4+r11531.pkg + +* mingw binaries (.dll): `bin/[x86 or x86_64]/mingw` +* mingw import libraries (.dll.a): `lib/[x86 or x86_64]/mingw` + +# Building libopenmpt with mingw-w64 + +libopenmpt must be built from the Makefile / Android dev package in the +[Downloads page](https://lib.openmpt.org/libopenmpt/download/#all-downloads) + +Use the mingw-w64 distributions from +[SourceForge](https://sourceforge.net/projects/mingw-w64/files/#readme). + +You can download the appropriate 7-zip archive, extract to a folder of +your choice, remove any existing mingw directories from your PATH, +then call `mingw32-make.exe` from its direct location. + +FOR LIBOPENMPT, YOU MUST USE A MINGW PACKAGE THAT SUPPORTS THE POSIX +THREADING MODEL! DO NOT COMPILE WITH A WIN32 THREADING MODEL! + +I use GCC 7.3.0: + +* [x86_64-posix-seh](https://sourceforge.net/projects/mingw-w64/files/Toolchains%20targetting%20Win64/Personal%20Builds/mingw-builds/7.3.0/threads-posix/seh/x86_64-7.3.0-release-posix-seh-rt_v5-rev0.7z) +* [i686-posix-dwarf](https://sourceforge.net/projects/mingw-w64/files/Toolchains%20targetting%20Win32/Personal%20Builds/mingw-builds/7.3.0/threads-posix/dwarf/i686-7.3.0-release-posix-dwarf-rt_v5-rev0.7z) + +## x86 build instructions + +``` +set CFLAGS=-march=pentium -static-libgcc +set CXXFLAGS=-march=pentium -static-libgcc -static-libstdc++ +set LDFLAGS=-Wl,--out-implib,bin/libopenmpt.dll.a -Wl,-Bstatic,--whole-archive -lwinpthread -Wl,-Bdynamic,--no-whole-archive + +cd [libopenmpt-make-src] +[x86-mingw-w64-bin]/mingw32-make.exe CONFIG=mingw64-win32 +``` + +`libopenmpt.dll` and `libopenmpt.dll.a` will be built in the +`bin/` folder. + +## x86_64 build instructions + +``` +set CFLAGS=-march=nocona -static-libgcc +set CXXFLAGS=-march=nocona -static-libgcc -static-libstdc++ +set LDFLAGS=-Wl,--out-implib,bin/libopenmpt.dll.a -Wl,-Bstatic,--whole-archive -lwinpthread -Wl,-Bdynamic,--no-whole-archive + +cd [libopenmpt-make-src] +[x86_64-mingw-w64-bin]/mingw32-make.exe CONFIG=mingw64-win64 +``` + +`libopenmpt.dll` and `libopenmpt.dll.a` will be built in the +`bin/` folder. \ No newline at end of file diff --git a/libs/libopenmpt/bin/x86/libopenmpt.dll b/libs/libopenmpt/bin/x86/libopenmpt.dll new file mode 100644 index 000000000..0fc9e7656 Binary files /dev/null and b/libs/libopenmpt/bin/x86/libopenmpt.dll differ diff --git a/libs/libopenmpt/bin/x86/mingw/libopenmpt.dll b/libs/libopenmpt/bin/x86/mingw/libopenmpt.dll new file mode 100644 index 000000000..5fa364256 Binary files /dev/null and b/libs/libopenmpt/bin/x86/mingw/libopenmpt.dll differ diff --git a/libs/libopenmpt/bin/x86/openmpt-mpg123.dll b/libs/libopenmpt/bin/x86/openmpt-mpg123.dll new file mode 100644 index 000000000..79148a40e Binary files /dev/null and b/libs/libopenmpt/bin/x86/openmpt-mpg123.dll differ diff --git a/libs/libopenmpt/bin/x86/openmpt-ogg.dll b/libs/libopenmpt/bin/x86/openmpt-ogg.dll new file mode 100644 index 000000000..6b5a42e8f Binary files /dev/null and b/libs/libopenmpt/bin/x86/openmpt-ogg.dll differ diff --git a/libs/libopenmpt/bin/x86/openmpt-vorbis.dll b/libs/libopenmpt/bin/x86/openmpt-vorbis.dll new file mode 100644 index 000000000..486b30731 Binary files /dev/null and b/libs/libopenmpt/bin/x86/openmpt-vorbis.dll differ diff --git a/libs/libopenmpt/bin/x86/openmpt-zlib.dll b/libs/libopenmpt/bin/x86/openmpt-zlib.dll new file mode 100644 index 000000000..b6e028ab4 Binary files /dev/null and b/libs/libopenmpt/bin/x86/openmpt-zlib.dll differ diff --git a/libs/libopenmpt/bin/x86_64/libopenmpt.dll b/libs/libopenmpt/bin/x86_64/libopenmpt.dll new file mode 100644 index 000000000..536492798 Binary files /dev/null and b/libs/libopenmpt/bin/x86_64/libopenmpt.dll differ diff --git a/libs/libopenmpt/bin/x86_64/mingw/libopenmpt.dll b/libs/libopenmpt/bin/x86_64/mingw/libopenmpt.dll new file mode 100644 index 000000000..3f6bea95f Binary files /dev/null and b/libs/libopenmpt/bin/x86_64/mingw/libopenmpt.dll differ diff --git a/libs/libopenmpt/bin/x86_64/openmpt-mpg123.dll b/libs/libopenmpt/bin/x86_64/openmpt-mpg123.dll new file mode 100644 index 000000000..f96d446f2 Binary files /dev/null and b/libs/libopenmpt/bin/x86_64/openmpt-mpg123.dll differ diff --git a/libs/libopenmpt/bin/x86_64/openmpt-ogg.dll b/libs/libopenmpt/bin/x86_64/openmpt-ogg.dll new file mode 100644 index 000000000..3fd951414 Binary files /dev/null and b/libs/libopenmpt/bin/x86_64/openmpt-ogg.dll differ diff --git a/libs/libopenmpt/bin/x86_64/openmpt-vorbis.dll b/libs/libopenmpt/bin/x86_64/openmpt-vorbis.dll new file mode 100644 index 000000000..56047c82f Binary files /dev/null and b/libs/libopenmpt/bin/x86_64/openmpt-vorbis.dll differ diff --git a/libs/libopenmpt/bin/x86_64/openmpt-zlib.dll b/libs/libopenmpt/bin/x86_64/openmpt-zlib.dll new file mode 100644 index 000000000..562d8e6a9 Binary files /dev/null and b/libs/libopenmpt/bin/x86_64/openmpt-zlib.dll differ diff --git a/libs/libopenmpt/changelog.md b/libs/libopenmpt/changelog.md new file mode 100644 index 000000000..9847be119 --- /dev/null +++ b/libs/libopenmpt/changelog.md @@ -0,0 +1,791 @@ + +Changelog {#changelog} +========= + +For fully detailed change log, please see the source repository directly. This +is just a high-level summary. + +### libopenmpt 0.4.4 (2019-04-07) + + * [**Bug**] Channel VU meters were swapped. + + * Startrekker: Clamp speed to 31 ticks per row. + * MTM: Ignore unused Exy commands on import. Command E5x (Set Finetune) is now + applied correctly. + * MOD: Sample swapping was always enabled since it has been separated from the + ProTracker 1/2 compatibility flag. Now it is always enabled for Amiga-style + modules and otherwise the old heuristic is used again. + + * stb_vorbis: Update to v1.16 (2019-03-05). + +### libopenmpt 0.4.3 (2019-02-11) + + * [**Sec**] Possible crash due to null-pointer access when doing a portamento + from an OPL instrument to an empty instrument note map slot (r11348). + + * [**Bug**] libopenmpt did not compile on Apple platforms in C++17 mode. + + * IT: Various fixes for note-off + instrument number in Old Effects mode. + * MO3: Import IT row highlights as written by MO3 2.4.1.2 or newer. Required + for modules using modern tempo mode. + + * miniz: Update to v2.0.8 (2018-09-19). + * stb_vorbis: Update to v1.15 (2019-02-07). + +### libopenmpt 0.4.2 (2019-01-22) + + * [**Sec**] DSM: Assertion failure during file parsing with debug STLs + (r11209). + * [**Sec**] J2B: Assertion failure during file parsing with debug STLs + (r11216). + + * S3M: Allow volume change of OPL instruments after Note Cut. + +### libopenmpt 0.4.1 (2019-01-06) + + * [**Bug**] Binaries compiled for winold (Windows XP, Vista, 7, for CPUs + without SSE2 support) did not actually work on CPUs without SSE2 support. + * [**Bug**] libmodplug: Public symbols of the C++ API had `visibility=hidden` + set on non-MSVC systems, which made them not publicly accessible. + * [**Bug**] Project files for Windows 10 desktop builds on ARM and ARM64 + (`build/vs2017win10`) were missing from Windows source package. + * [**Bug**] MSVC project files in Windows source package lacked additional + files required to build DLLs. + + * MO3: Apply playback changes based on "ModPlug-made" header flag. + + * minimp3: Update to commit e9df0760e94044caded36a55d70ab4152134adc5 + (2018-12-23). + +### libopenmpt 0.4.0 (2018-12-23) + + * [**New**] libopenmpt now includes emulation of the OPL chip and thus plays + OPL instruments in S3M, C67 and MPTM files. OPL chip emulation volume can be + changed with the new ctl `render.opl.volume_factor`. + * [**New**] libopenmpt now supports CDFM / Composer 670 module files. + * [**New**] Autotools `configure` and plain `Makefile` now honor the variable + `CXXSTDLIB_PCLIBSPRIVATE` which serves the sole purpose of listing the + standard library (or libraries) required for static linking. The contents of + this variable will be put in `libopenmpt.pc` `Libs.private` and used for + nothing else. See \ref libopenmpt_c_staticlinking . + * [**New**] foo_openmpt: foo_openmpt now also works on Windows XP. + * [**New**] libopenmpt Emscripten builds now ship with MP3 support by + default, based on minimp3 by Lion (github.com/lieff). + * [**New**] libopenmpt: New ctl `play.at_end` can be used to change what + happens when the song end is reached: + * "fadeout": Fades the module out for a short while. Subsequent reads + after the fadeout will return 0 rendered frames. This is the default and + identical to the behaviour in previous libopenmpt versions. + * "continue": Returns 0 rendered frames when the song end is reached. + Subsequent reads will continue playing from the song start or loop + start. This can be used for custom loop logic, such as loop + auto-detection and longer fadeouts. + * "stop": Returns 0 rendered frames when the song end is reached. + Subsequent reads will return 0 rendered frames. + * [**New**] Add new metadata fields `"originaltype"` and `"originaltype_long"` + which allow more clearly reflecting what is going on with converted formats + like MO3 and GDM. + * [**New**] `Makefile` `CONFIG=emscripten` now can generate WebAssembly via + the additional option `EMSCRIPTEN_TARGET=wasm`. + * [**New**] Compiling for DOS is now experimentally supported via DJGPP GCC + 7.2 or later. + + * [**Change**] minimp3: Instead of the LGPL-2.1-licensed minimp3 by KeyJ, + libopenmpt now uses the CC0-1.0-licensed minimp3 by Lion (github.com/lieff) + as a fallback if libmpg123 is unavailable. The `USE_MINIMP3` `Makefile` + option is gone and minimp3 will be used automatically in the `Makefile` + build system if libmpg123 is not available. + * [**Change**] openmpt123: openmpt123 now rejects `--output-type` in `--ui` + and `--batch` modes and also rejects `--output` in `--render` mode. These + combinations of options really made no sense and were rather confusing. + * [**Change**] Android NDK build system now uses libc++ (`c++_shared`) instead + of GNU libstdc++ (`gnustl_shared`), as recommended by Android NDK r16b. + * [**Change**] xmp-openmpt: `openmpt-mpg123.dll` is no longer optional and + must be placed into the same directory as `xmp-openmpt.dll`. + * [**Change**] in_openmpt: `openmpt-mpg123.dll` is no longer optional and must + be placed either into the directory of the player itself or into the same + directory as `in_openmpt.dll`. This is dependent on how the player loads its + plugins. For WinAMP 5, `openmpt-mpg123.dll` needs to be in the directory + which contains `winamp.exe`. `in_openmpt.dll` needs to be in the `Plugins` + directory. + * [**Change**] foo_openmpt: foo_openmpt is now packaged as a fb2k-component + package for easier installation. + * [**Change**] When building libopenmpt with MinGW-w64, it is now recommended + to use the posix thread model (as opposed to the win32 threading model), + because the former does support std::mutex while the latter does not. When + building with win32 threading model with the Autotools build system, it is + recommended to provide the `mingw-std-threads` package. Building libopenmpt + with MinGW-w64 without any `std::thread`/`std::mutex` support is deprecated + and support for such configurations will be removed in libopenmpt 0.5. + * [**Change**] `Makefile` `CONFIG=emscripten` now has 4 `EMSCRIPTEN_TARGET=` + settings: `wasm` generates WebAssembly, `asmjs128m` generates asm.js with a + fixed size 128MB heap, `asmjs` generates asm.js with a fixed default size + heap (as of Emscripten 1.38.11, this amounts to 16MB), `js` generates + JavaScript with dynamic heap growth and with compatibility for older VMs. + * [**Change**] libmodplug: Update public headers to libmodplug 0.8.8.5. This + adds support for kind-of automatic MODPLUG_EXPORT decoration on Windows. + + * [**Regression**] Support for Clang 3.4, 3.5 has been removed. + * [**Regression**] Building with Android NDK older than NDK r16b is not + supported any more. + * [**Regression**] Support for Emscripten versions older than 1.38.5 has been + removed. + * [**Regression**] Support for libmpg123 older than 1.14.0 has been removed. + * [**Regression**] Using MediaFoundation to decode MP3 samples is no longer + supported. Use libmpg123 or minimp3 instead. + * [**Regression**] libmodplug: Support for emulating libmodplug 0.8.7 API/ABI + has been removed. + + * [**Bug**] xmp-openmpt: Sample rate and number of output channels were not + applied correctly when using per-file settings. + * [**Bug**] Internal mixer state was not initialized properly when initially + rendering in 44100kHz stereo format. + * [**Bug**] openmpt123: Prevent libsdl2 and libsdl from being enabled at the + same time because they conflict with each other. + * [**Bug**] libmodplug: Setting `SNDMIX_NORESAMPLING` in the C++ API always + resulted in linear interpolation instead of nearest neighbour + + * IT: In Compatible Gxx mode, allow sample changes next to a tone portamento + effect if a previous sample has already stopped playing. + * IT: Fix broken volume envelopes with negative values as found in breakdwn.it + by Elysis. + * MOD: Slides and delayed notes are executed on every repetition of a row with + row delay (fixes "ode to protracker"). + * XM: If the sustain point of the panning envelope is reached before key-off, + it is never released. + * XM: Do not default recall volume / panning for delayed instrument-less notes + * XM :E60 loop bug was not considered in song length calucation. + * S3M: Notes without instrument number use previous note's sample offset. + * Tighten M15 and MOD file rejection heuristics. + * J2B: Ignore frequency limits from file header. Fixes Medivo.j2b, broken + since libopenmpt-0.2.6401-beta17. + * STM: More accurate tempo calculation. + * STM: Better support for early format revisions (no such files have been + found in the wild, though). + * STM: Last character of sample name was missing. + * SFX: Work around bad conversions of the "Operation Stealth" soundtrack by + turning pattern breaks into note stops. + * IMF: Filter cutoff was upside down and the cutoff range was too small. + * ParamEq plugin center frequency was not limited correctly. + * Keep track of active SFx macro during seeking. + * The "note cut" duplicate note action did not volume-ramp the previously + playing sample. + * A song starting with non-existing patterns could not be played. + * DSM: Support restart position and 16-bit samples. + * DTM: Import global volume. + * MOD: Support notes in octave 2, like in FastTracker 2 (fixes DOPE.MOD). + * Do not apply Amiga playback heuristics to MOD files that have clearly been + written with a PC tracker. + * MPTM: More logical release node behaviour. + * Subsong search is now less thorough. It could previously find many subsongs + that are technically correct (unplayed rows at the beginning of patterns + that have been jumped over due to pattern breaks), but so far no real-world + module that would require such a thorough subsong detection was found. The + old mechanism caused way more false positives than intended with real-world + modules, though. + * Restrict the unpacked size of compressed DMF, IT, MDL and MO3 samples to + avoid huge allocations with malformed small files. + +### libopenmpt 0.3 (2017-09-27) + + * [**New**] New error handling functionality in the C API, which in particular + allows distinguishing potentially transient out-of-memory errors from parse + errors during module loading. + * [**New**] New API `openmpt::module::get_selected_subsong()` (C++) and + `openmpt_module_get_selected_subsong()` (C). + * [**New**] Faster file header probing API `openmpt::probe_file_header()` and + `openmpt::probe_file_header_get_recommended_size` (C++), and + `openmpt_probe_file_header()`, + `openmpt_probe_file_header_without_filesize()`, + `openmpt_probe_file_header_from_stream()` and + `openmpt_probe_file_header_get_recommended_size()` (C). + * [**New**] New API `openmpt::could_open_probability()` (C++) and + `openmpt_could_open_probability()` (C). This fixes a spelling error in the + old 0.2 API. + * [**New**] openmpt123: openmpt123 can now open M3U, M3U8, M3UEXT, M3U8EXT and + PLSv2 playlists via the `--playlist` option. + * [**New**] openmpt123: openmpt123 now supports very fast file header probing + via the `--probe` option. + * [**New**] Libopenmpt now supports building for Windows 10 Universal (Windows + Store 8.2) APIs with MSVC, and also for the older Windows Runtime APIs with + MinGW-w64. + * [**New**] New API header `libopenmpt_ext.h` which implements the libopenmpt + extension APIs also for the C interface. + * [**New**] The Reverb effect (S99 in S3M/IT/MPTM, and X99 in XM) is now + implemented in libopenmpt. + * [**New**] For Amiga modules, a new resampler based on the Amiga's sound + characteristics has been added. It can be activated by passing the + `render.resampler.emulate_amiga` ctl with a value of `1`. Non-Amiga modules + are not affected by this, and setting the ctl overrides the resampler choice + specified by `OPENMPT_MODULE_RENDER_INTERPOLATIONFILTER_LENGTH` or + `openmpt::module::RENDER_INTERPOLATIONFILTER_LENGTH`. Support for the MOD + command E0x (Set LED Filter) is also available when the Amiga resampler is + enabled. + + * [**Change**] libopenmpt versioning changed and follows the more conventional + major.minor.patch as well as the recommendations of the + [SemVer](http://semver.org/) scheme now. In addition to the SemVer + requirements, pre-1.0.0 versions will also honor API and ABI stability in + libopenmpt (i.e. libopenmpt ignores SemVer Clause 4). + * [**Change**] The output directories of the MSVC build system were changed to + `bin/vs2015-shared/x86-64-win7/` (and similar) layout which allows building + in the same tree with different compiler versions without overwriting other + outputs. + * [**Change**] The emscripten build now exports libopenmpt as 'libopenmpt' + instead of the default 'Module'. + * [**Change**] Android: The build system changed. The various Android.mk files + have been merged into a single one which can be controlled using command + line options. + * [**Change**] The `Makefile` build system now passes `std=c++11` to the + compiler by default. Older compilers may still work if you pass + `STDCXX=c++0x` to the `make` invocation. + * [**Change**] The `Makefile` option `ANCIENT=1` is gone. + * [**Change**] The optional dependencies on `libltdl` or `libdl` are gone. + They are no longer needed for any functionality. + + * [**Regression**] Compiling client code using the C++ API now requires a + compiler running in C++11 mode. + * [**Regression**] Support for GCC 4.1, 4.2, 4.3, 4.4, 4.5, 4.6, 4.7 has been + removed. + * [**Regression**] Support for Clang 3.0, 3.1, 3.2, 3.3 has been removed. + * [**Regression**] Support for Emscripten versions older than 1.31.0 has been + removed. + * [**Regression**] Support for Android NDK versions older than 11 has been + removed. + * [**Regression**] Visual Studio 2008, 2010, 2012, 2013 support has been + removed. + * [**Regression**] Dynamic run-time loading of libmpg123 is no longer + supported. Libmpg123 must be linked at link-time now. + * [**Regression**] xmp-openmpt: xmp-openmpt now requires XMPlay 3.8 or later + and compiling xmp-openmpt requires an appropriate XMPlay SDK with + `XMPIN_FACE` >= `4`. + * [**Regression**] Support for libmpg123 older than 1.13.0 has been removed. + * [**Regression**] Un4seen unmo3 support has been removed. + + * [**Bug**] C++ API: `openmpt::exception` did not define copy and move + constructors or copy and move assignment operators in libopenmpt 0.2. The + compiler-generated ones were not adequate though. libopenmpt 0.3 adds the + appropriate special member functions. This adds the respective symbol names + to the exported ABI, which, depending on the compiler, might or might not + have been there in libopenmpt 0.2. The possibly resulting possible ODR + violation only affects cases that did crash in the libopenmpt 0.2 API anyway + due to memory double-free, and does not cause any further problems in + practice for all known platforms and compilers. + * [**Bug**] The C API could crash instead of failing gracefully in + out-of-memory situations. + * [**Bug**] The test suite could fail on MacOSX or FreeBSD in non-fatal ways + when no locale was active. + * [**Bug**] `libopenmpt_stream_callbacks_fd.h` and + `libopenmpt_stream_callbacks_file.h` were missing in Windows development + packages. + * [**Bug**] libopenmpt on Windows did not properly guard against current + working directory DLL injection attacks. + * [**Bug**] localtime() was used to determine the version of Schism Tracker + used to save IT and S3M files. This function is not guaranteed to be + thread-safe by the standard and is now no longer used. + * [**Bug**] Possible crashes with malformed IT, ITP, AMS, MDL, MED, MPTM, PSM + and Startrekker files. + * [**Bug**] Possible hangs with malformed DBM, MPTM and PSM files. + * [**Bug**] Possible hangs with malformed files containing cyclic plugin + routings. + * [**Bug**] Excessive loading times with malformed ITP / truncated AMS files. + * [**Bug**] Plugins did not work correctly when changing the sample rate + between two render calls. + * [**Bug**] Possible NULL-pointer dereference read during obscure + out-of-memory situations while handling exceptions in the C API. + * [**Bug**] libmodplug: `libmodplug.pc` was wrong. + * [**Bug**] Cross-compiling libopenmpt with autotools for Windows now properly + sets `-municode` and `-mconsole` as well as all required Windows system + libraries. + * [**Bug**] foo_openmpt: Interpolation filter and volume ramping settings were + confused in previous versions. This version resets both to the defaults. + * [**Bug**] libmodplug: The CSoundFile::Read function in the emulated + libmodplug C++ API returned the wrong value, causing qmmp (and possibly + other software) to crash. + + * Support for SoundTracker Pro II (STP) and Digital Tracker (DTM) modules. + * Increased accuracy of the sample position and sample rate to drift less when + playing very long samples. + * Various playback improvements for IT and XM files. + * Channel frequency could wrap around after some excessive portamento / down + in some formats since libopenmpt 0.2-beta17. + * Playback improvements for S3M files made with Impulse Tracker and + Schism Tracker. + * ParamEq plugin emulation didn't do anything at full gain (+15dB). + * All standard DMO effects are now also emulated on non-Windows and non-MSVC + systems. + * Added `libopenmpt_stream_callbacks_buffer.h` which adds + `openmpt_stream_callbacks` support for in-memory buffers, possibly even only + using a truncated prefix view into a bigger file which is useful for + probing. + * Avoid enabling some ProTracker-specific quirks for MOD files most likely + created with ScreamTracker 3. + * Tremolo effect only had half the intended strength in MOD files. + * Pattern loops ending on the last row a pattern were not executed correctly + in S3M files. + * Work-around for reading MIDI macros and plugin settings in some malformed IT + files written by old UNMO3 versions. + * Improve tracker detection in IT format. + * Playback fixes for 8-channel MED files + * Do not set note volume to 0 on out-of-range offset in XM files. + * Better import of some slide commands in SFX files. + * Sample 15 in "Crew Generation" by Necros requires short loops at the + beginning of the sample to not be ignored. Since we need to ignore them in + some (non-ProTracker) modules, we heuristically disable the old loop + sanitization behaviour based on the module channel count. + * Both normal and percentage offset in PLM files were handled as percentage + offset. + * MT2 files with instruments that had both sample and plugin assignments were + not read correctly. + * Some valid FAR files were rejected erroneously. + * Support for VBlank timing flag and comment field in PT36 files. + * Improved accuracy of vibrato command in DIGI / DBM files. + * STM: Add support for "WUZAMOD!" magic bytes and allow some slightly + malformed STM files to load which were previously rejected. + * Detect whether "hidden" patterns in the order list of SoundTracker modules + should be taken into account or not. + * Tighten heuristics for rejecting invalid 669, M15, MOD and ICE files and + loosen them in other places to allow some valid MOD files to load. + * Improvements to seeking: Channel panning was not always updated from + instruments / samples when seeking, and out-of-range global volume was not + applied correctly in some formats. + * seek.sync_samples=1 did not apply PTM reverse offset effect and the volume + slide part of combined volume slide + vibrato commands. + * If the order list was longer than 256 items and there was a pattern break + effect without a position jump on the last pattern of the sequence, it did + not jump to the correct restart order. + * `Makefile` has now explicit support for FreeBSD with no special option or + configuration required. + * openmpt123: Improved section layout in man page. + * libmodplug: Added all missing C++ API symbols that are accessible via the + public libmodplug header file. + * Autotools build system now has options `--disable-openmpt123`, + `--disable-tests` and `--disable-examples` which may be desireable when + cross-compiling. + * Windows binary packages now ship with libmpg123 included. + +### libopenmpt 0.2-beta20 (2016-08-07) + + * [**Bug**] PSM loader was broken on big-endian platforms since forever. + * [**Bug**] `load.skip_samples` ctl did not work for PSM16 modules. + + * There is a new `subsong` ctl, which can return the currently selected + subsong. + * More accurate ProTracker arpeggio wrap-around emulation. + * More accurate sample tuning in PSM16 files. + * Samples in DSM files were sometimes detuned and some pattern commands were + not imported correctly. + * More accurate import of MDL 7-bit panning command. + * Only import pattern commands supported by the UltraTracker version that was + used to save ULT files. Add support for command 5-C (end loop). + * DMF sample loop lengths were off by one. + * Unis 669 pan slide effect was too deep. + * Several valid (but slightly corrupted possibly due to disk failures or data + transfer errors) SoundTracker files were no longer loading since libopenmpt + 0.2-beta18. + +### libopenmpt 0.2-beta19 (2016-07-23) + + * [**Change**] libopenmpt now uses C++14 `[[deprecated]]` attribute instead + of compiler-specific solutions when appropriate. + * [**Change**] libopenmpt C++ header now uses C++11 `noexcept` instead of + C++98 `throw()` exception specification when supported. `throw()` is + deprecated since C++11. This does not change API or ABI as they are + equivalent. Use `LIBOPENMPT_ASSUME_CPLUSPLUS_NOEXCEPT` to override the + default. + * [**Change**] The preprocessor macro `LIBOPENMPT_ANCIENT_COMPILER_STDINT` is + gone. Please use `LIBOPENMPT_ASSUME_CPLUSPLUS_CSTDINT instead`. + Additionally, the typedefs moved from illegal namespace ::std into somewhat + less dangerous namespace ::openmpt::std. You can test + `#ifdef LIBOPENMPT_QUIRK_NO_CSTDINT` client-side to check whether + `libopenmpt.hpp` used the non-standard types. (Note: Of all supported + compilers, this change only affects the 3 compilers with only limited + support: MSVC 2008, GCC 4.1, GCC 4.2.) + + * [**Bug**] xmp-openmpt: Crash when viewing sample texts. + + * The public libopenmpt C++ header has auto-detection logic for the used C++ + standard now. In case your client code compiler misreports the standard + version or you want to override it for other reasons, + `#define LIBOPENMPT_ASSUME_CPLUSPLUS` to the value of the standard version + you desire to be used. There is also a macro for each individual aspect, + like `LIBOPENMPT_ASSUME_CPLUSPLUS_CSTDINT`, + `LIBOPENMPT_ASSUME_CPLUSPLUS_DEPRECATED`, + `LIBOPENMPT_ASSUME_CPLUSPLUS_NOEXCEPT` which take precedence over the + general macro. + * Portamento with sample swap behaviour was wrong for ProTracker MODs. + * Rewritten loader and various playback fixes for MDL files. + * libopenmpt 0.2-beta18 broke import of many pattern commands in DBM, DMF and + ULT files. + * ADPCM samples in MOD files were broken since libopenmpt 0.2-beta17. + +### libopenmpt 0.2-beta18 (2016-07-11) + + * [**Change**] openmpt123: Add PulseAudio output support. Autotools and + `Makefile` build systems now depend on `libpulse` and `libpulse-simple` by + default. Disable with `--without-pulseaudio` or `NO_PULSEAUDIO=1` + respectively. When enabled, PulseAudio will be the default output driver, + * [**Change**] xmp-openmpt: Settings are now stored in xmplay.ini like with + every other plugin. + + * [**Regression**] openmpt123: Support for FLAC < 1.3.0 has been removed. FLAC + before 1.3.0 is broken beyond repair as it provides `assert.h` in the + include path. + + * [**Bug**] Generated pkg-config file libopenmpt.pc by both `Makefile` and + Autotools build systems was totally broken. + * [**Bug**] libopenmpt no longer uses the non-thread-safe global std::rand() + function. + * [**Bug**] Sample loops in GDM modules did not work when using Emscripten. + * [**Bug**] XM and MO3 loaders could crash due to unaligned memory accesses. + * [**Bug**] Fixed incorrect handling of custom MPTM tunings on big endian + platforms. + * [**Bug**] Fixed various problems found with clang 3.8 static analyzer, + address sanitizer and undefined behaviour sanitizer. + * [**Bug**] File header probing functionality was broken for most formats. + * [**Bug**] With non-seekable streams, the entire file was almost always + cached even if it was not of any supported module type. + + * Seeking in allsubsongs-mode now works correctly. + * openmpt123: Added subsong support. + * Various playback fixes for 669, IT, MT2 and MTM files. + * Some MOD files with more than 128 patterns (e.g. NIETNU.MOD) were not loaded + correctly. + * A new example `libopenmpt_example_c_probe` has been added which demonstrates + the usage and flexibility of openmpt_could_open_propability() in the C API + under various constraints. + +### libopenmpt 0.2-beta17 (2016-05-21) + + * [**Change**] The Makefile and Autotools build systems now require to + explicitly specify `NO_LTDL=1` or `--without-ltdl` respectively if no + support for dynamic loading of third party libraries via libtool libltdl is + desired. + * [**Change**] In the Makefile build system option `USE_MO3` and the Autotools + build system option `--enable-mo3` are gone. Dynamic loading of un4seen + unmo3 is now always enabled when dynamic loading is possible and built-in + MO3 support is not possible because either a MP3 or a Vorbis decoder is + missing. + * [**Change**] The MSVC build system changed. The `libopenmptDLL` project is + gone. Use the new `ReleaseShared` configuration of the `libopenmpt` project + instead. libopenmpt now links against zlib by default. A separate project + with smaller footprint linking against miniz is still available as + `libopenmpt-small`. + * [**Change**] The constants used to query library information from + `openmpt_get_string()` and `openmpt::string::get()` (i.e. OPENMPT_STRING_FOO + and openmpt::string::FOO) have been deprecated because having syntactic + constants for theses keys makes extending the API in a backwards and + forwards compatible way harder than it should be. Please just use the string + literals directly. + * [**Change**] Deprecated API identifiers will now cause deprecation warnings + with MSVC, GCC and clang. `#define LIBOPENMPT_NO_DEPRECATE` to disable the + warnings. + * [**Change**] openmpt123: `--[no-]shuffle` option has been renamed to + `--[no-]randomize`. A new `--[no-]shuffle` option has been added which + shuffles randomly through the playlist as opposed to randomizing the + playlist upfront. + * [**Change**] Support for Un4seen unmo3 has generally been deprecated in + favour of the new internal mo3 decoder. Un4seen unmo3 support will be + removed on 2018-01-01. + + * [**Bug**] Memory consumption during loading has been reduced by about 1/3 in + case a seekable input stream is provided (either via C API callback open + functions or via C++ API iostream constructors). + * [**Bug**] Some samples in AMS modules were detuned when using Emscripten. + * [**Bug**] Possible crash with excessive portamento down in some formats. + * [**Bug**] Possible crashes with malformed AMF, AMS, DBM, IT, MDL, MED, MPTM, + MT2, PSM and MMCMP-, XPK- and PP20-compressed files. + * [**Bug**] `openmpt::module::format_pattern_row_channel` with `width == 0` + was returning an empty string instead of an string with unconstrained + length. + + * Support for ProTracker 3.6 IFF-style modules and SoundFX / MultiMedia Sound + (SFX / MMS) modules. + * libopenmpt now has support for DMO plugins on Windows when built with MSVC. + Additionally, the DMO Compression, Distortion, Echo, Gargle, ParamEQ and + WavesReverb DSPs are emulated on on all other platforms. + * libopenmpt now supports the DigiBooster Echo DSP. + * To avoid any of the aforementioned plugins to be used, the load.skip_plugins + ctl can be passed when loading a module. + * libopenmpt got native MO3 support with MP3 decoding either via libmpg123 or + MediaFoundation (on Windows 7 and up) and Vorbis decoding via libogg, + libvorbis, libvorbisfile or stb_vorbis. + * libopenmpt MSVC builds with Visual Studio 2010 or later on Windows 7 or + later now use an internal MO3 decoder with libogg, libvorbis, libvorbisfile, + and libmpg123 or minimp3 or MediaFoundation suppport by default. Visual + Studio 2008 builds still use unmo3.dll by default but also support the + built-in decoder in which case libmpg123 is required. + * libopenmpt with Makefile or Autotools build system can now also use + glibc/libdl instead of libtool/libltdl for dynamic loading of third-party + libraries. Options `NO_DL=1` and `--without-dl` have been added + respectively. + * The `Makefile` build system got 4 new options NO_MPG123, NO_OGG, NO_VORBIS, + NO_VORBISFILE. The default is to use the new dependencies automatically. + * The `Autotools` build system got 4 new options --without-mpg123, + --without-ogg, --without-vorbis, --without-vorbisfile. The default is to use + the new dependencies automatically. + * Makefile and Android builds got support for using minimp3 instead of + libmpg123. For Android, use `Android-minimp3-stbvorbis.mk`, for Makefile use + `USE_MINIMP3=1`. You have to download + [minimp3](http://keyj.emphy.de/minimp3/) yourself and put its contents into + `include/minimp3/`. + * `"source_url"`, `"source_date"` and `"build_compiler"` keys have been added + to `openmpt_string_get()` and `openmpt::string::get()`. + * openmpt123: Add new `--[no-]restart]` option which restarts the playlist + when finished. + * Improved Ultimate SoundTracker version detection heuristics. + * Playing a sample at a sample rate close to the mix rate could lead to small + clicks when using vibrato. + * More fine-grained internal legacy module compatibility settings to correctly + play back modules made with older versions of OpenMPT and a few other + trackers. + * The tail of compressed MDL samples was slightly off. + * Some probably hex-edited XM files (e.g. cybernostra weekend.xm) were not + loaded correctly. + * Countless other playback fixes for MOD, XM, S3M, IT and MT2 files. + +### libopenmpt 0.2-beta16 (2015-11-22) + + * [**Change**] The Autotools build system does strict checking of all + dependencies now. Instead of best effort auto-magic detection of all + potentially optional dependencies, the default set of dependencies is now + enforced unless each individual dependency gets explicitely disabled via + `--without-foo` or `--disable-foo` `./configure` switches. Run + `./configure --help` for the full list of options. + + * [**Bug**] Some MOD files were erroneously detected as 669 files. + * [**Bug**] Some malformed AMF files could result in very long loading times. + * [**Bug**] Fixed crashes in IMF and MT2 loaders. + * [**Bug**] MTM files generated by UNMO3 were not loaded properly. + + * Improved MTM playback. + * `make CONFIG=haiku` for Haiku has been added. + * Language bindings for FreeBASIC have been added (see + `libopenmpt/bindings/`). + +### libopenmpt 0.2-beta15 (2015-10-31) + + * [**Change**] openmpt123: SDL2 is now supported and preferred to SDL1 if + available with the `Makefile` build system. + + * [**Bug**] Emscripten support for older emscripten versions broke in -beta14. + These are now supported again when using `make CONFIG=emscripten-old`. + * [**Bug**] Fixed crashes in MED loader. + + * Playback improvements and loader fixes for MOD, MT2 and MED. + +### libopenmpt 0.2-beta14 (2015-09-13) + + * [**Change**] The C++ API example now uses the PortAudio C++ bindings + instead of the C API. + * [**Change**] Default compiler options for Emscripten have been changed to + more closely match the Emscripten recommendations. + + * [**Bug**] Client code compilation with C89 compilers was broken in beta13. + * [**Bug**] Test suite failed on certain Emscripten/node.js combinations. + * [**Bug**] Fixed various crashes or hangs in DMF, OKT, PLM, IT and MPTM + loaders. + + * Implemented error handling in the libopenmpt API examples. + * Various playback improvements and fixes for OKT, IT and MOD. + +### libopenmpt 0.2-beta13 (2015-08-16) + + * [**Change**] The MSVC build system has been redone. Solutions are now + located in `build/vsVERSION/`. + + * [**Bug**] get_current_channel_vu_left and get_current_channel_vu_right only + return the volume of the front left and right channels now. + get_current_channel_vu_rear_left and get_current_channel_vu_rear_right + do now actually work and return non-zero values. + * [**Bug**] Fix crashes and hangs in MED and MDL loaders and with some + truncated compressed IT samples. + * [**Bug**] Fix crash when playing extremely high-pitched samples. + + * Completed C and C++ documentation + * Added new key for openmpt::module::get_metadata, "message_raw", which + returns an empty string if there is no song message rather than a list of + instrument names. + * in_openmpt: Support for compiling with VS2008. + * xmp-openmpt: Support for compiling with VS2008. + * in_openmpt: Add a more readable file information window. + +### libopenmpt 0.2-beta12 (2015-04-19) + + * Playback fix when row delay effect is used together with offset command. + * A couple of fixes for the seek.sync_samples=1 case. + * IT compatibility fix for IT note delay. + * ProTracker MOD playback compatibility improvement. + +### libopenmpt 0.2-beta11 (2015-04-18) + + * [**Change**] openmpt_stream_seek_func() now gets called with + OPENMPT_STREAM_SEEK_SET, OPENMPT_STREAM_SEEK_CUR and + OPENMPT_STREAM_SEEK_END whence parameter instead of SEEK_SET, SEEK_CUR and + SEEK_END. These are defined to 0, 1 and 2 respectively which corresponds to + the definition in all common C libraries. If your C library uses different + constants, this theoretically breaks binary compatibility. The old + libopenmpt code, however, never actually called the seek function, thus, + there will be no problem in practice. + * [**Change**] openmpt123: When both SDL1.2 and PortAudio are available, + SDL is now the preferred backend because SDL is more widespread and better + tested on all kinds of different platforms, and in general, SDL is just + more reliable. + + * [**Bug**] libopenmpt now also compiles with GCC 4.3. + + * libopenmpt now supports PLM (Disorder Tracker 2) files. + * Various playback improvements and fixes for IT, S3M, XM, MOD, PTM and 669 + files. + +### libopenmpt 0.2-beta10 (2015-02-17) + + * [**Change**] Makefile configuration filenames changed from + `build/make/Makefile.config.*` to `build/make/config-*.mk`. + * [**Change**] libopenmpt for Android now supports unmo3 from un4seen. See + `build/android_ndk/README.AndroidNDK.txt` for details. + + * [**Bug**] Fix out-of-bounds read in mixer code for ProTracker-compatible + MOD files which was introduced back in r4223 / beta6. + + * Vibrato effect was too weak in beta8 and beta9 in IT linear slide mode. + * Very small fine portamento was wrong in beta8 and beta9 in IT linear slide + mode. + * Tiny IT playback compatibility improvements. + * STM playback improvements. + +### libopenmpt 0.2-beta9 (2014-12-21) + + * [**Bug**] libopenmpt_ext.hpp was missing from the Windows binary zip files. + +### libopenmpt 0.2-beta8 (2014-12-21) + + * [**Change**] foo_openmpt: Settings are now accessible via foobar2000 + advanced settings. + * [**Change**] Autotools based build now supports libunmo3. Specify + --enable-unmo3. + * [**Change**] Support for dynamic loading of libunmo3 on MacOS X. + * [**Change**] libopenmpt now uses libltld (from libtool) for dynamic loading + of libunmo3 on all non-Windows platforms. + * [**Change**] Support for older compilers: + * GCC 4.1.x to 4.3.x (use `make ANCIENT=1`) + * Microsoft Visual Studio 2008 (with latest Service Pack) + (see `build/vs2008`) + * [**Change**] libopenmpt_ext.hpp is now distributed by default. The API is + still considered experimental and not guaranteed to stay API or ABI + compatible. + * [**Change**] xmp-openmpt / in_openmpt: No more libopenmpt_settings.dll. + The settings dialog now uses a statically linked copy of MFC. + + * [**Bug**] The -autotools tarballs were not working at all. + + * Vastly improved MT2 loader. + * Improved S3M playback compatibility. + * Added openmpt::ext::interactive, an extension which adds a whole bunch of + new functionality to change playback in some way or another. + * Added possibility to sync sample playback when using + openmpt::module::set_position_* by setting the ctl value + seek.sync_samples=1 + * Support for "hidden" subsongs has been added. + They are accessible through the same interface as ordinary subsongs, i.e. + use openmpt::module::select_subsong to switch between any kind of subsongs. + * All subsongs can now be played consecutively by passing -1 as the subsong + index in openmpt::module::select_subsong. + * Added documentation for a couple of more functions. + +### libopenmpt 0.2-beta7 (2014-09-07) + + * [**Change**] libopenmpt now has an GNU Autotools based build system (in + addition to all previously supported ways of building libopenmpt). + Autotools support is packaged separately as tarballs ending in + `-autotools.tar.gz`. + + * [**Bug**] The distributed windows .zip file did not include pugixml. + + * [**Regression**] openmpt123: Support for writing WavPack (.wv) files has + been removed. + + Reasoning: + 1. WavPack support was incomplete and did not include support for writing + WavPack metadata at all. + 2. openmpt123 already supports libSndFile which can be used to write + uncompressed lossless WAV files which can then be encoded to whatever + format the user desires with other tools. + +### libopenmpt 0.2-beta6 (2014-09-06) + + * [**Change**] openmpt123: SDL is now also used by default if availble, in + addition to PortAudio. + * [**Change**] Support for emscripten is no longer experimental. + * [**Change**] libopenmpt itself can now also be compiled with VS2008. + + * [**Bug**] Fix all known crashes on platforms that do not support unaligned + memory access. + * [**Bug**] openmpt123: Effect column was always missing in pattern display. + +### libopenmpt 0.2-beta5 (2014-06-15) + + * [**Change**] Add unmo3 support for non-Windows builds. + * [**Change**] Namespace all internal functions in order to allow statically + linking against libopenmpt without risking duplicate symbols. + * [**Change**] Iconv is now completely optional and only used on Linux + systems by default. + * [**Change**] Added libopenmpt_example_c_stdout.c, an example without + requiring PortAudio. + * [**Change**] Add experimental support for building libopenmpt with + emscripten. + + * [**Bug**] Fix ping-pong loop behaviour which broke in 0.2-beta3. + * [**Bug**] Fix crashes when accessing invalid patterns through libopenmpt + API. + * [**Bug**] Makefile: Support building with missing optional dependencies + without them being stated explicitely. + * [**Bug**] openmpt123: Crash when quitting while playback is stopped. + * [**Bug**] openmpt123: Crash when writing output to a file in interactive UI + mode. + * [**Bug**] openmpt123: Wrong FLAC output filename in --render mode. + + * Various smaller playback accuracy improvements. + +### libopenmpt 0.2-beta4 (2014-02-25) + + * [**Bug**] Makefile: Dependency tracking for the test suite did not work. + +### libopenmpt 0.2-beta3 (2014-02-21) + + * [**Change**] The test suite is now built by default with Makefile based + builds. Use `TEST=0` to skip building the tests. `make check` runs the test + suite. + + * [**Bug**] Crash in MOD and XM loaders on architectures not supporting + unaligned memory access. + * [**Bug**] MMCMP, PP20 and XPK unpackers should now work on non-x86 hardware + and implement proper bounds checking. + * [**Bug**] openmpt_module_get_num_samples() returned the wrong value. + * [**Bug**] in_openmpt: DSP plugins did not work properly. + * [**Bug**] in_openmpt/xmp-openmpt: Setting name for stereo separation was + misspelled. This version will revert your stereo separation settings to + default. + * [**Bug**] Crash when loading some corrupted modules with stereo samples. + + * Support building on Android NDK. + * Avoid clicks in sample loops when using interpolation. + * IT filters are now done in integer instead of floating point. This improves + performance, especially on architectures with no or a slow FPU. + * MOD pattern break handling fixes. + * Various XM playback improvements. + * Improved and switchable dithering when using 16bit integer API. + +### libopenmpt 0.2-beta2 (2014-01-12) + + * [**Bug**] MT2 loader crash. + * [**Bug**] Saving settings in in_openmpt and xmp-openmpt did not work. + * [**Bug**] Load libopenmpt_settings.dll also from below Plugins directory in + Winamp. + + * DBM playback improvements. + +### libopenmpt 0.2-beta1 (2013-12-31) + + * First release. + diff --git a/libs/libopenmpt/debian/libopenmpt-0.4.0-trusty-backport.diff b/libs/libopenmpt/debian/libopenmpt-0.4.0-trusty-backport.diff new file mode 100644 index 000000000..1c9b56ba5 --- /dev/null +++ b/libs/libopenmpt/debian/libopenmpt-0.4.0-trusty-backport.diff @@ -0,0 +1,550 @@ +diff -uraN ../../orig/libopenmpt-0.4.0/debian/changelog ./debian/changelog +--- ../../orig/libopenmpt-0.4.0/debian/changelog 2018-12-24 16:43:58.000000000 -0500 ++++ ./debian/changelog 2019-01-04 17:56:35.024725537 -0500 +@@ -1,3 +1,38 @@ ++libopenmpt (0.4.0-ubuntu14.04.1~ppa14) trusty; urgency=medium ++ ++ * Remove debian symbols files due to gcc 4.8 - 5 C++ abi incompatibility ++ ++ -- Sonic Team Junior Fri, 04 Jan 2019 17:56:01 -0500 ++ ++libopenmpt (0.4.0-ubuntu14.04.1~ppa13) trusty; urgency=medium ++ ++ * autoreconf libtool ++ ++ -- Sonic Team Junior Fri, 04 Jan 2019 17:10:45 -0500 ++ ++libopenmpt (0.4.0-ubuntu14.04.1~ppa12) trusty; urgency=medium ++ ++ * debian/rules autoreconf ++ ++ -- Sonic Team Junior Fri, 04 Jan 2019 17:03:19 -0500 ++ ++libopenmpt (0.4.0-ubuntu14.04.1~ppa11) trusty; urgency=medium ++ ++ * debian/rules autoreconf ++ ++ -- Sonic Team Junior Fri, 04 Jan 2019 16:59:08 -0500 ++ ++libopenmpt (0.4.0-ubuntu14.04.1~ppa10) trusty; urgency=medium ++ ++ * Backport to trusty ++ * Added automake build depend ++ * Adjusted debhelper depend to >= 9.0~ ++ * Adjusted dpkg-dev depend to >= 1.17.0 ++ * Adjusted debian/compat to 10 ++ * autoreconf --force --install ++ ++ -- Sonic Team Junior Fri, 04 Jan 2019 16:54:04 -0500 ++ + libopenmpt (0.4.0-1) unstable; urgency=medium + + * New upstream release. +diff -uraN ../../orig/libopenmpt-0.4.0/debian/compat ./debian/compat +--- ../../orig/libopenmpt-0.4.0/debian/compat 2018-12-24 16:43:58.000000000 -0500 ++++ ./debian/compat 2019-01-04 16:39:17.613976357 -0500 +@@ -1 +1 @@ +-11 ++10 +diff -uraN ../../orig/libopenmpt-0.4.0/debian/control ./debian/control +--- ../../orig/libopenmpt-0.4.0/debian/control 2018-12-24 16:43:58.000000000 -0500 ++++ ./debian/control 2019-01-04 17:10:42.008523333 -0500 +@@ -4,10 +4,12 @@ + Maintainer: Debian Multimedia Maintainers + Uploaders: James Cowgill + Build-Depends: +- debhelper (>= 11.1~), ++ automake, ++ libtool, ++ debhelper (>= 9.0~), + dh-exec, + doxygen, +- dpkg-dev (>= 1.18.0), ++ dpkg-dev (>= 1.17.0), + libflac-dev, + libmpg123-dev, + libogg-dev, +diff -uraN ../../orig/libopenmpt-0.4.0/debian/files ./debian/files +--- ../../orig/libopenmpt-0.4.0/debian/files 1969-12-31 19:00:00.000000000 -0500 ++++ ./debian/files 2019-01-04 17:56:47.813250880 -0500 +@@ -0,0 +1 @@ ++libopenmpt_0.4.0-ubuntu14.04.1~ppa14_source.buildinfo libs optional +diff -uraN ../../orig/libopenmpt-0.4.0/debian/libopenmpt0.symbols ./debian/libopenmpt0.symbols +--- ../../orig/libopenmpt-0.4.0/debian/libopenmpt0.symbols 2018-12-24 16:43:58.000000000 -0500 ++++ ./debian/libopenmpt0.symbols 1969-12-31 19:00:00.000000000 -0500 +@@ -1,256 +0,0 @@ +-libopenmpt.so.0 libopenmpt0 #MINVER# +-* Build-Depends-Package: libopenmpt-dev +-# Ignore std:: template instantiations +- (regex|optional)"^_ZN?K?S" 0.2.7025~beta20.1 +- _ZN7openmpt10module_ext13get_interfaceERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE@Base 0.2.7025~beta20.1 +- (arch-bits=32)_ZN7openmpt10module_extC1EPKcjRSoRKSt3mapINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEESA_St4lessISA_ESaISt4pairIKSA_SA_EEE@Base 0.2.7025~beta20.1 +- (arch-bits=64)_ZN7openmpt10module_extC1EPKcmRSoRKSt3mapINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEESA_St4lessISA_ESaISt4pairIKSA_SA_EEE@Base 0.2.7025~beta20.1 +- (arch-bits=32)_ZN7openmpt10module_extC1EPKvjRSoRKSt3mapINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEESA_St4lessISA_ESaISt4pairIKSA_SA_EEE@Base 0.2.7025~beta20.1 +- (arch-bits=64)_ZN7openmpt10module_extC1EPKvmRSoRKSt3mapINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEESA_St4lessISA_ESaISt4pairIKSA_SA_EEE@Base 0.2.7025~beta20.1 +- _ZN7openmpt10module_extC1ERKS0_@Base 0.2.7025~beta20.1 +- _ZN7openmpt10module_extC1ERKSt6vectorIcSaIcEERSoRKSt3mapINSt7__cxx1112basic_stringIcSt11char_traitsIcES2_EESC_St4lessISC_ESaISt4pairIKSC_SC_EEE@Base 0.2.7025~beta20.1 +- _ZN7openmpt10module_extC1ERSiRSoRKSt3mapINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEES9_St4lessIS9_ESaISt4pairIKS9_S9_EEE@Base 0.2.7025~beta20.1 +- (arch-bits=32)_ZN7openmpt10module_extC2EPKcjRSoRKSt3mapINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEESA_St4lessISA_ESaISt4pairIKSA_SA_EEE@Base 0.2.7025~beta20.1 +- (arch-bits=64)_ZN7openmpt10module_extC2EPKcmRSoRKSt3mapINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEESA_St4lessISA_ESaISt4pairIKSA_SA_EEE@Base 0.2.7025~beta20.1 +- (arch-bits=32)_ZN7openmpt10module_extC2EPKvjRSoRKSt3mapINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEESA_St4lessISA_ESaISt4pairIKSA_SA_EEE@Base 0.2.7025~beta20.1 +- (arch-bits=64)_ZN7openmpt10module_extC2EPKvmRSoRKSt3mapINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEESA_St4lessISA_ESaISt4pairIKSA_SA_EEE@Base 0.2.7025~beta20.1 +- _ZN7openmpt10module_extC2ERKS0_@Base 0.2.7025~beta20.1 +- _ZN7openmpt10module_extC2ERKSt6vectorIcSaIcEERSoRKSt3mapINSt7__cxx1112basic_stringIcSt11char_traitsIcES2_EESC_St4lessISC_ESaISt4pairIKSC_SC_EEE@Base 0.2.7025~beta20.1 +- _ZN7openmpt10module_extC2ERSiRSoRKSt3mapINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEES9_St4lessIS9_ESaISt4pairIKS9_S9_EEE@Base 0.2.7025~beta20.1 +- _ZN7openmpt10module_extD0Ev@Base 0.2.7025~beta20.1 +- _ZN7openmpt10module_extD1Ev@Base 0.2.7025~beta20.1 +- _ZN7openmpt10module_extD2Ev@Base 0.2.7025~beta20.1 +- _ZN7openmpt10module_extaSERKS0_@Base 0.2.7025~beta20.1 +- _ZN7openmpt16get_core_versionEv@Base 0.2.7025~beta20.1 +- (arch-bits=32)_ZN7openmpt17probe_file_headerEyPKhj@Base 0.3.0 +- (arch-bits=64)_ZN7openmpt17probe_file_headerEmPKhm@Base 0.3.0 +- (arch-bits=32)_ZN7openmpt17probe_file_headerEyPKhjy@Base 0.3.0 +- (arch-bits=64)_ZN7openmpt17probe_file_headerEmPKhmm@Base 0.3.0 +- (arch-bits=32)_ZN7openmpt17probe_file_headerEyRSi@Base 0.3.0 +- (arch-bits=64)_ZN7openmpt17probe_file_headerEmRSi@Base 0.3.0 +- _ZN7openmpt19get_library_versionEv@Base 0.2.7025~beta20.1 +- _ZN7openmpt22could_open_probabilityERSidRSo@Base 0.3.0 +- _ZN7openmpt22could_open_propabilityERSidRSo@Base 0.2.7025~beta20.1 +- _ZN7openmpt22is_extension_supportedERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE@Base 0.2.7025~beta20.1 +- _ZN7openmpt24get_supported_extensionsB5cxx11Ev@Base 0.2.7025~beta20.1 +- _ZN7openmpt38probe_file_header_get_recommended_sizeEv@Base 0.3.0 +- _ZN7openmpt6module14select_subsongEi@Base 0.2.7025~beta20.1 +- _ZN7openmpt6module16set_render_paramEii@Base 0.2.7025~beta20.1 +- _ZN7openmpt6module16set_repeat_countEi@Base 0.2.7025~beta20.1 +- _ZN7openmpt6module20set_position_secondsEd@Base 0.2.7025~beta20.1 +- (arch-bits=32)_ZN7openmpt6module21read_interleaved_quadEijPf@Base 0.2.7025~beta20.1 +- (arch-bits=64)_ZN7openmpt6module21read_interleaved_quadEimPf@Base 0.2.7025~beta20.1 +- (arch-bits=32)_ZN7openmpt6module21read_interleaved_quadEijPs@Base 0.2.7025~beta20.1 +- (arch-bits=64)_ZN7openmpt6module21read_interleaved_quadEimPs@Base 0.2.7025~beta20.1 +- _ZN7openmpt6module22set_position_order_rowEii@Base 0.2.7025~beta20.1 +- (arch-bits=32)_ZN7openmpt6module23read_interleaved_stereoEijPf@Base 0.2.7025~beta20.1 +- (arch-bits=64)_ZN7openmpt6module23read_interleaved_stereoEimPf@Base 0.2.7025~beta20.1 +- (arch-bits=32)_ZN7openmpt6module23read_interleaved_stereoEijPs@Base 0.2.7025~beta20.1 +- (arch-bits=64)_ZN7openmpt6module23read_interleaved_stereoEimPs@Base 0.2.7025~beta20.1 +- (arch-bits=32)_ZN7openmpt6module4readEijPf@Base 0.2.7025~beta20.1 +- (arch-bits=64)_ZN7openmpt6module4readEimPf@Base 0.2.7025~beta20.1 +- (arch-bits=32)_ZN7openmpt6module4readEijPfS1_@Base 0.2.7025~beta20.1 +- (arch-bits=64)_ZN7openmpt6module4readEimPfS1_@Base 0.2.7025~beta20.1 +- (arch-bits=32)_ZN7openmpt6module4readEijPfS1_S1_S1_@Base 0.2.7025~beta20.1 +- (arch-bits=64)_ZN7openmpt6module4readEimPfS1_S1_S1_@Base 0.2.7025~beta20.1 +- (arch-bits=32)_ZN7openmpt6module4readEijPs@Base 0.2.7025~beta20.1 +- (arch-bits=64)_ZN7openmpt6module4readEimPs@Base 0.2.7025~beta20.1 +- (arch-bits=32)_ZN7openmpt6module4readEijPsS1_@Base 0.2.7025~beta20.1 +- (arch-bits=64)_ZN7openmpt6module4readEimPsS1_@Base 0.2.7025~beta20.1 +- (arch-bits=32)_ZN7openmpt6module4readEijPsS1_S1_S1_@Base 0.2.7025~beta20.1 +- (arch-bits=64)_ZN7openmpt6module4readEimPsS1_S1_S1_@Base 0.2.7025~beta20.1 +- _ZN7openmpt6module7ctl_setERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEES8_@Base 0.2.7025~beta20.1 +- _ZN7openmpt6module8set_implEPNS_11module_implE@Base 0.2.7025~beta20.1 +- _ZN7openmpt6moduleC1EPKcS2_RSoRKSt3mapINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEESA_St4lessISA_ESaISt4pairIKSA_SA_EEE@Base 0.2.7025~beta20.1 +- (arch-bits=32)_ZN7openmpt6moduleC1EPKcjRSoRKSt3mapINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEESA_St4lessISA_ESaISt4pairIKSA_SA_EEE@Base 0.2.7025~beta20.1 +- (arch-bits=64)_ZN7openmpt6moduleC1EPKcmRSoRKSt3mapINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEESA_St4lessISA_ESaISt4pairIKSA_SA_EEE@Base 0.2.7025~beta20.1 +- _ZN7openmpt6moduleC1EPKhS2_RSoRKSt3mapINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEESA_St4lessISA_ESaISt4pairIKSA_SA_EEE@Base 0.2.7025~beta20.1 +- (arch-bits=32)_ZN7openmpt6moduleC1EPKhjRSoRKSt3mapINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEESA_St4lessISA_ESaISt4pairIKSA_SA_EEE@Base 0.2.7025~beta20.1 +- (arch-bits=64)_ZN7openmpt6moduleC1EPKhmRSoRKSt3mapINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEESA_St4lessISA_ESaISt4pairIKSA_SA_EEE@Base 0.2.7025~beta20.1 +- (arch-bits=32)_ZN7openmpt6moduleC1EPKvjRSoRKSt3mapINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEESA_St4lessISA_ESaISt4pairIKSA_SA_EEE@Base 0.2.7025~beta20.1 +- (arch-bits=64)_ZN7openmpt6moduleC1EPKvmRSoRKSt3mapINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEESA_St4lessISA_ESaISt4pairIKSA_SA_EEE@Base 0.2.7025~beta20.1 +- _ZN7openmpt6moduleC1ERKS0_@Base 0.2.7025~beta20.1 +- _ZN7openmpt6moduleC1ERKSt6vectorIcSaIcEERSoRKSt3mapINSt7__cxx1112basic_stringIcSt11char_traitsIcES2_EESC_St4lessISC_ESaISt4pairIKSC_SC_EEE@Base 0.2.7025~beta20.1 +- _ZN7openmpt6moduleC1ERKSt6vectorIhSaIhEERSoRKSt3mapINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEESD_St4lessISD_ESaISt4pairIKSD_SD_EEE@Base 0.2.7025~beta20.1 +- _ZN7openmpt6moduleC1ERSiRSoRKSt3mapINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEES9_St4lessIS9_ESaISt4pairIKS9_S9_EEE@Base 0.2.7025~beta20.1 +- _ZN7openmpt6moduleC1Ev@Base 0.2.7025~beta20.1 +- _ZN7openmpt6moduleC2EPKcS2_RSoRKSt3mapINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEESA_St4lessISA_ESaISt4pairIKSA_SA_EEE@Base 0.2.7025~beta20.1 +- (arch-bits=32)_ZN7openmpt6moduleC2EPKcjRSoRKSt3mapINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEESA_St4lessISA_ESaISt4pairIKSA_SA_EEE@Base 0.2.7025~beta20.1 +- (arch-bits=64)_ZN7openmpt6moduleC2EPKcmRSoRKSt3mapINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEESA_St4lessISA_ESaISt4pairIKSA_SA_EEE@Base 0.2.7025~beta20.1 +- _ZN7openmpt6moduleC2EPKhS2_RSoRKSt3mapINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEESA_St4lessISA_ESaISt4pairIKSA_SA_EEE@Base 0.2.7025~beta20.1 +- (arch-bits=32)_ZN7openmpt6moduleC2EPKhjRSoRKSt3mapINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEESA_St4lessISA_ESaISt4pairIKSA_SA_EEE@Base 0.2.7025~beta20.1 +- (arch-bits=64)_ZN7openmpt6moduleC2EPKhmRSoRKSt3mapINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEESA_St4lessISA_ESaISt4pairIKSA_SA_EEE@Base 0.2.7025~beta20.1 +- (arch-bits=32)_ZN7openmpt6moduleC2EPKvjRSoRKSt3mapINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEESA_St4lessISA_ESaISt4pairIKSA_SA_EEE@Base 0.2.7025~beta20.1 +- (arch-bits=64)_ZN7openmpt6moduleC2EPKvmRSoRKSt3mapINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEESA_St4lessISA_ESaISt4pairIKSA_SA_EEE@Base 0.2.7025~beta20.1 +- _ZN7openmpt6moduleC2ERKS0_@Base 0.2.7025~beta20.1 +- _ZN7openmpt6moduleC2ERKSt6vectorIcSaIcEERSoRKSt3mapINSt7__cxx1112basic_stringIcSt11char_traitsIcES2_EESC_St4lessISC_ESaISt4pairIKSC_SC_EEE@Base 0.2.7025~beta20.1 +- _ZN7openmpt6moduleC2ERKSt6vectorIhSaIhEERSoRKSt3mapINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEESD_St4lessISD_ESaISt4pairIKSD_SD_EEE@Base 0.2.7025~beta20.1 +- _ZN7openmpt6moduleC2ERSiRSoRKSt3mapINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEES9_St4lessIS9_ESaISt4pairIKS9_S9_EEE@Base 0.2.7025~beta20.1 +- _ZN7openmpt6moduleC2Ev@Base 0.2.7025~beta20.1 +- _ZN7openmpt6moduleD0Ev@Base 0.2.7025~beta20.1 +- _ZN7openmpt6moduleD1Ev@Base 0.2.7025~beta20.1 +- _ZN7openmpt6moduleD2Ev@Base 0.2.7025~beta20.1 +- _ZN7openmpt6moduleaSERKS0_@Base 0.2.7025~beta20.1 +- _ZN7openmpt6string3getERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE@Base 0.2.7025~beta20.1 +- _ZN7openmpt9exceptionC1EOS0_@Base 0.3.0 +- _ZN7openmpt9exceptionC1ERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE@Base 0.2.7025~beta20.1 +- _ZN7openmpt9exceptionC1ERKS0_@Base 0.3.0 +- _ZN7openmpt9exceptionC2EOS0_@Base 0.3.0 +- _ZN7openmpt9exceptionC2ERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE@Base 0.2.7025~beta20.1 +- _ZN7openmpt9exceptionC2ERKS0_@Base 0.3.0 +- _ZN7openmpt9exceptionD0Ev@Base 0.2.7025~beta20.1 +- _ZN7openmpt9exceptionD1Ev@Base 0.2.7025~beta20.1 +- _ZN7openmpt9exceptionD2Ev@Base 0.2.7025~beta20.1 +- _ZN7openmpt9exceptionaSEOS0_@Base 0.3.0 +- _ZN7openmpt9exceptionaSERKS0_@Base 0.3.0 +- _ZNK7openmpt6module12get_metadataERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE@Base 0.2.7025~beta20.1 +- _ZNK7openmpt6module14get_num_ordersEv@Base 0.2.7025~beta20.1 +- _ZNK7openmpt6module15get_current_rowEv@Base 0.2.7025~beta20.1 +- _ZNK7openmpt6module15get_num_samplesEv@Base 0.2.7025~beta20.1 +- _ZNK7openmpt6module15get_order_namesB5cxx11Ev@Base 0.2.7025~beta20.1 +- _ZNK7openmpt6module16get_num_channelsEv@Base 0.2.7025~beta20.1 +- _ZNK7openmpt6module16get_num_patternsEv@Base 0.2.7025~beta20.1 +- _ZNK7openmpt6module16get_num_subsongsEv@Base 0.2.7025~beta20.1 +- _ZNK7openmpt6module16get_render_paramEi@Base 0.2.7025~beta20.1 +- _ZNK7openmpt6module16get_repeat_countEv@Base 0.2.7025~beta20.1 +- _ZNK7openmpt6module16get_sample_namesB5cxx11Ev@Base 0.2.7025~beta20.1 +- _ZNK7openmpt6module17get_channel_namesB5cxx11Ev@Base 0.2.7025~beta20.1 +- _ZNK7openmpt6module17get_current_orderEv@Base 0.2.7025~beta20.1 +- _ZNK7openmpt6module17get_current_speedEv@Base 0.2.7025~beta20.1 +- _ZNK7openmpt6module17get_current_tempoEv@Base 0.2.7025~beta20.1 +- _ZNK7openmpt6module17get_metadata_keysB5cxx11Ev@Base 0.2.7025~beta20.1 +- _ZNK7openmpt6module17get_order_patternEi@Base 0.2.7025~beta20.1 +- _ZNK7openmpt6module17get_pattern_namesB5cxx11Ev@Base 0.2.7025~beta20.1 +- _ZNK7openmpt6module17get_subsong_namesB5cxx11Ev@Base 0.2.7025~beta20.1 +- _ZNK7openmpt6module19get_current_patternEv@Base 0.2.7025~beta20.1 +- _ZNK7openmpt6module19get_num_instrumentsEv@Base 0.2.7025~beta20.1 +- _ZNK7openmpt6module20get_duration_secondsEv@Base 0.2.7025~beta20.1 +- _ZNK7openmpt6module20get_instrument_namesB5cxx11Ev@Base 0.2.7025~beta20.1 +- _ZNK7openmpt6module20get_pattern_num_rowsEi@Base 0.2.7025~beta20.1 +- _ZNK7openmpt6module20get_position_secondsEv@Base 0.2.7025~beta20.1 +- _ZNK7openmpt6module20get_selected_subsongEv@Base 0.3.0 +- (arch-bits=32)_ZNK7openmpt6module26format_pattern_row_channelB5cxx11Eiiijb@Base 0.2.7025~beta20.1 +- (arch-bits=64)_ZNK7openmpt6module26format_pattern_row_channelB5cxx11Eiiimb@Base 0.2.7025~beta20.1 +- _ZNK7openmpt6module27get_current_channel_vu_leftEi@Base 0.2.7025~beta20.1 +- _ZNK7openmpt6module27get_current_channel_vu_monoEi@Base 0.2.7025~beta20.1 +- _ZNK7openmpt6module28get_current_channel_vu_rightEi@Base 0.2.7025~beta20.1 +- _ZNK7openmpt6module28get_current_playing_channelsEv@Base 0.2.7025~beta20.1 +- (arch-bits=32)_ZNK7openmpt6module29highlight_pattern_row_channelB5cxx11Eiiijb@Base 0.2.7025~beta20.1 +- (arch-bits=64)_ZNK7openmpt6module29highlight_pattern_row_channelB5cxx11Eiiimb@Base 0.2.7025~beta20.1 +- _ZNK7openmpt6module31get_pattern_row_channel_commandEiiii@Base 0.2.7025~beta20.1 +- _ZNK7openmpt6module32get_current_channel_vu_rear_leftEi@Base 0.2.7025~beta20.1 +- _ZNK7openmpt6module33get_current_channel_vu_rear_rightEi@Base 0.2.7025~beta20.1 +- _ZNK7openmpt6module34format_pattern_row_channel_commandB5cxx11Eiiii@Base 0.2.7025~beta20.1 +- _ZNK7openmpt6module37highlight_pattern_row_channel_commandB5cxx11Eiiii@Base 0.2.7025~beta20.1 +- _ZNK7openmpt6module7ctl_getERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE@Base 0.2.7025~beta20.1 +- _ZNK7openmpt6module8get_ctlsB5cxx11Ev@Base 0.2.7025~beta20.1 +- _ZNK7openmpt9exception4whatEv@Base 0.2.7025~beta20.1 +- _ZTIN7openmpt10module_extE@Base 0.2.7025~beta20.1 +- _ZTIN7openmpt6moduleE@Base 0.2.7025~beta20.1 +- _ZTIN7openmpt9exceptionE@Base 0.2.7025~beta20.1 +- (optional=weak)_ZTISt11_Mutex_baseILN9__gnu_cxx12_Lock_policyE2EE@Base 0.2.7025~beta20.1 +- (optional=weak)_ZTISt16_Sp_counted_baseILN9__gnu_cxx12_Lock_policyE2EE@Base 0.2.7025~beta20.1 +- _ZTSN7openmpt10module_extE@Base 0.2.7025~beta20.1 +- _ZTSN7openmpt6moduleE@Base 0.2.7025~beta20.1 +- _ZTSN7openmpt9exceptionE@Base 0.2.7025~beta20.1 +- (optional=weak)_ZTSSt11_Mutex_baseILN9__gnu_cxx12_Lock_policyE2EE@Base 0.2.7025~beta20.1 +- (optional=weak)_ZTSSt16_Sp_counted_baseILN9__gnu_cxx12_Lock_policyE2EE@Base 0.2.7025~beta20.1 +- (optional=weak)_ZTSSt19_Sp_make_shared_tag@Base 0.2.7025~beta20.1 +- _ZTVN7openmpt10module_extE@Base 0.2.7025~beta20.1 +- _ZTVN7openmpt6moduleE@Base 0.2.7025~beta20.1 +- _ZTVN7openmpt9exceptionE@Base 0.2.7025~beta20.1 +- (optional=weak)_ZZNSt19_Sp_make_shared_tag5_S_tiEvE5__tag@Base 0.4.0 +- openmpt_could_open_probability2@Base 0.3.0 +- openmpt_could_open_probability@Base 0.3.0 +- openmpt_could_open_propability@Base 0.2.7025~beta20.1 +- openmpt_error_func_default@Base 0.3.0 +- openmpt_error_func_errno@Base 0.3.0 +- openmpt_error_func_errno_userdata@Base 0.3.0 +- openmpt_error_func_ignore@Base 0.3.0 +- openmpt_error_func_log@Base 0.3.0 +- openmpt_error_func_store@Base 0.3.0 +- openmpt_error_is_transient@Base 0.3.0 +- openmpt_error_string@Base 0.3.0 +- openmpt_free_string@Base 0.2.7025~beta20.1 +- openmpt_get_core_version@Base 0.2.7025~beta20.1 +- openmpt_get_library_version@Base 0.2.7025~beta20.1 +- openmpt_get_string@Base 0.2.7025~beta20.1 +- openmpt_get_supported_extensions@Base 0.2.7025~beta20.1 +- openmpt_is_extension_supported@Base 0.2.7025~beta20.1 +- openmpt_log_func_default@Base 0.2.7025~beta20.1 +- openmpt_log_func_silent@Base 0.2.7025~beta20.1 +- openmpt_module_create2@Base 0.3.0 +- openmpt_module_create@Base 0.2.7025~beta20.1 +- openmpt_module_create_from_memory2@Base 0.3.0 +- openmpt_module_create_from_memory@Base 0.2.7025~beta20.1 +- openmpt_module_ctl_get@Base 0.2.7025~beta20.1 +- openmpt_module_ctl_set@Base 0.2.7025~beta20.1 +- openmpt_module_destroy@Base 0.2.7025~beta20.1 +- openmpt_module_error_clear@Base 0.3.0 +- openmpt_module_error_get_last@Base 0.3.0 +- openmpt_module_error_get_last_message@Base 0.3.0 +- openmpt_module_error_set_last@Base 0.3.0 +- openmpt_module_ext_create@Base 0.3.0 +- openmpt_module_ext_create_from_memory@Base 0.3.0 +- openmpt_module_ext_destroy@Base 0.3.0 +- openmpt_module_ext_get_interface@Base 0.3.0 +- openmpt_module_ext_get_module@Base 0.3.0 +- openmpt_module_format_pattern_row_channel@Base 0.2.7025~beta20.1 +- openmpt_module_format_pattern_row_channel_command@Base 0.2.7025~beta20.1 +- openmpt_module_get_channel_name@Base 0.2.7025~beta20.1 +- openmpt_module_get_ctls@Base 0.2.7025~beta20.1 +- openmpt_module_get_current_channel_vu_left@Base 0.2.7025~beta20.1 +- openmpt_module_get_current_channel_vu_mono@Base 0.2.7025~beta20.1 +- openmpt_module_get_current_channel_vu_rear_left@Base 0.2.7025~beta20.1 +- openmpt_module_get_current_channel_vu_rear_right@Base 0.2.7025~beta20.1 +- openmpt_module_get_current_channel_vu_right@Base 0.2.7025~beta20.1 +- openmpt_module_get_current_order@Base 0.2.7025~beta20.1 +- openmpt_module_get_current_pattern@Base 0.2.7025~beta20.1 +- openmpt_module_get_current_playing_channels@Base 0.2.7025~beta20.1 +- openmpt_module_get_current_row@Base 0.2.7025~beta20.1 +- openmpt_module_get_current_speed@Base 0.2.7025~beta20.1 +- openmpt_module_get_current_tempo@Base 0.2.7025~beta20.1 +- openmpt_module_get_duration_seconds@Base 0.2.7025~beta20.1 +- openmpt_module_get_instrument_name@Base 0.2.7025~beta20.1 +- openmpt_module_get_metadata@Base 0.2.7025~beta20.1 +- openmpt_module_get_metadata_keys@Base 0.2.7025~beta20.1 +- openmpt_module_get_num_channels@Base 0.2.7025~beta20.1 +- openmpt_module_get_num_instruments@Base 0.2.7025~beta20.1 +- openmpt_module_get_num_orders@Base 0.2.7025~beta20.1 +- openmpt_module_get_num_patterns@Base 0.2.7025~beta20.1 +- openmpt_module_get_num_samples@Base 0.2.7025~beta20.1 +- openmpt_module_get_num_subsongs@Base 0.2.7025~beta20.1 +- openmpt_module_get_order_name@Base 0.2.7025~beta20.1 +- openmpt_module_get_order_pattern@Base 0.2.7025~beta20.1 +- openmpt_module_get_pattern_name@Base 0.2.7025~beta20.1 +- openmpt_module_get_pattern_num_rows@Base 0.2.7025~beta20.1 +- openmpt_module_get_pattern_row_channel_command@Base 0.2.7025~beta20.1 +- openmpt_module_get_position_seconds@Base 0.2.7025~beta20.1 +- openmpt_module_get_render_param@Base 0.2.7025~beta20.1 +- openmpt_module_get_repeat_count@Base 0.2.7025~beta20.1 +- openmpt_module_get_sample_name@Base 0.2.7025~beta20.1 +- openmpt_module_get_selected_subsong@Base 0.3.0 +- openmpt_module_get_subsong_name@Base 0.2.7025~beta20.1 +- openmpt_module_highlight_pattern_row_channel@Base 0.2.7025~beta20.1 +- openmpt_module_highlight_pattern_row_channel_command@Base 0.2.7025~beta20.1 +- openmpt_module_read_float_mono@Base 0.2.7025~beta20.1 +- openmpt_module_read_float_quad@Base 0.2.7025~beta20.1 +- openmpt_module_read_float_stereo@Base 0.2.7025~beta20.1 +- openmpt_module_read_interleaved_float_quad@Base 0.2.7025~beta20.1 +- openmpt_module_read_interleaved_float_stereo@Base 0.2.7025~beta20.1 +- openmpt_module_read_interleaved_quad@Base 0.2.7025~beta20.1 +- openmpt_module_read_interleaved_stereo@Base 0.2.7025~beta20.1 +- openmpt_module_read_mono@Base 0.2.7025~beta20.1 +- openmpt_module_read_quad@Base 0.2.7025~beta20.1 +- openmpt_module_read_stereo@Base 0.2.7025~beta20.1 +- openmpt_module_select_subsong@Base 0.2.7025~beta20.1 +- openmpt_module_set_error_func@Base 0.3.0 +- openmpt_module_set_log_func@Base 0.3.0 +- openmpt_module_set_position_order_row@Base 0.2.7025~beta20.1 +- openmpt_module_set_position_seconds@Base 0.2.7025~beta20.1 +- openmpt_module_set_render_param@Base 0.2.7025~beta20.1 +- openmpt_module_set_repeat_count@Base 0.2.7025~beta20.1 +- openmpt_probe_file_header@Base 0.3.0 +- openmpt_probe_file_header_from_stream@Base 0.3.0 +- openmpt_probe_file_header_get_recommended_size@Base 0.3.0 +- openmpt_probe_file_header_without_filesize@Base 0.3.0 +diff -uraN ../../orig/libopenmpt-0.4.0/debian/libopenmpt-modplug1.symbols ./debian/libopenmpt-modplug1.symbols +--- ../../orig/libopenmpt-0.4.0/debian/libopenmpt-modplug1.symbols 2018-12-24 16:43:58.000000000 -0500 ++++ ./debian/libopenmpt-modplug1.symbols 1969-12-31 19:00:00.000000000 -0500 +@@ -1,200 +0,0 @@ +-libopenmpt_modplug.so.1 libopenmpt-modplug1 #MINVER# +-* Build-Depends-Package: libopenmpt-modplug-dev +- LIBOPENMPT_MODPLUG1@LIBOPENMPT_MODPLUG1 0.2.7386~beta20.3 +- ModPlug_ExportIT@LIBOPENMPT_MODPLUG1 0.2.7386~beta20.3 +- ModPlug_ExportMOD@LIBOPENMPT_MODPLUG1 0.2.7386~beta20.3 +- ModPlug_ExportS3M@LIBOPENMPT_MODPLUG1 0.2.7386~beta20.3 +- ModPlug_ExportXM@LIBOPENMPT_MODPLUG1 0.2.7386~beta20.3 +- ModPlug_GetCurrentOrder@LIBOPENMPT_MODPLUG1 0.2.7386~beta20.3 +- ModPlug_GetCurrentPattern@LIBOPENMPT_MODPLUG1 0.2.7386~beta20.3 +- ModPlug_GetCurrentRow@LIBOPENMPT_MODPLUG1 0.2.7386~beta20.3 +- ModPlug_GetCurrentSpeed@LIBOPENMPT_MODPLUG1 0.2.7386~beta20.3 +- ModPlug_GetCurrentTempo@LIBOPENMPT_MODPLUG1 0.2.7386~beta20.3 +- ModPlug_GetLength@LIBOPENMPT_MODPLUG1 0.2.7386~beta20.3 +- ModPlug_GetMasterVolume@LIBOPENMPT_MODPLUG1 0.2.7386~beta20.3 +- ModPlug_GetMessage@LIBOPENMPT_MODPLUG1 0.2.7386~beta20.3 +- ModPlug_GetModuleType@LIBOPENMPT_MODPLUG1 0.2.7386~beta20.3 +- ModPlug_GetName@LIBOPENMPT_MODPLUG1 0.2.7386~beta20.3 +- ModPlug_GetPattern@LIBOPENMPT_MODPLUG1 0.2.7386~beta20.3 +- ModPlug_GetPlayingChannels@LIBOPENMPT_MODPLUG1 0.2.7386~beta20.3 +- ModPlug_GetSettings@LIBOPENMPT_MODPLUG1 0.2.7386~beta20.3 +- ModPlug_InitMixerCallback@LIBOPENMPT_MODPLUG1 0.2.7386~beta20.3 +- ModPlug_InstrumentName@LIBOPENMPT_MODPLUG1 0.2.7386~beta20.3 +- ModPlug_Load@LIBOPENMPT_MODPLUG1 0.2.7386~beta20.3 +- ModPlug_NumChannels@LIBOPENMPT_MODPLUG1 0.2.7386~beta20.3 +- ModPlug_NumInstruments@LIBOPENMPT_MODPLUG1 0.2.7386~beta20.3 +- ModPlug_NumPatterns@LIBOPENMPT_MODPLUG1 0.2.7386~beta20.3 +- ModPlug_NumSamples@LIBOPENMPT_MODPLUG1 0.2.7386~beta20.3 +- ModPlug_Read@LIBOPENMPT_MODPLUG1 0.2.7386~beta20.3 +- ModPlug_SampleName@LIBOPENMPT_MODPLUG1 0.2.7386~beta20.3 +- ModPlug_Seek@LIBOPENMPT_MODPLUG1 0.2.7386~beta20.3 +- ModPlug_SeekOrder@LIBOPENMPT_MODPLUG1 0.2.7386~beta20.3 +- ModPlug_SetMasterVolume@LIBOPENMPT_MODPLUG1 0.2.7386~beta20.3 +- ModPlug_SetSettings@LIBOPENMPT_MODPLUG1 0.2.7386~beta20.3 +- ModPlug_Unload@LIBOPENMPT_MODPLUG1 0.2.7386~beta20.3 +- ModPlug_UnloadMixerCallback@LIBOPENMPT_MODPLUG1 0.2.7386~beta20.3 +- _ZN10CSoundFile10FreeSampleEPv@LIBOPENMPT_MODPLUG1 0.2.7561~beta20.5 +- _ZN10CSoundFile10InitPlayerEb@LIBOPENMPT_MODPLUG1 0.2.7561~beta20.5 +- _ZN10CSoundFile10NoteChangeEjibb@LIBOPENMPT_MODPLUG1 0.2.7561~beta20.5 +- _ZN10CSoundFile10PackSampleERii@LIBOPENMPT_MODPLUG1 0.2.7561~beta20.5 +- _ZN10CSoundFile10ProcessAGCEi@LIBOPENMPT_MODPLUG1 0.2.7561~beta20.5 +- _ZN10CSoundFile10ProcessRowEv@LIBOPENMPT_MODPLUG1 0.2.7561~beta20.5 +- _ZN10CSoundFile10ReadSampleEP14_MODINSTRUMENTjPKcj@LIBOPENMPT_MODPLUG1 0.2.7561~beta20.5 +- _ZN10CSoundFile10RetrigNoteEjj@LIBOPENMPT_MODPLUG1 0.2.7561~beta20.5 +- _ZN10CSoundFile10gdwSysInfoE@LIBOPENMPT_MODPLUG1 0.2.7386~beta20.3 +- _ZN10CSoundFile10gnCPUUsageE@LIBOPENMPT_MODPLUG1 0.2.7386~beta20.3 +- _ZN10CSoundFile10gnChannelsE@LIBOPENMPT_MODPLUG1 0.2.7386~beta20.3 +- _ZN10CSoundFile11DoFreqSlideEP11_MODCHANNELi@LIBOPENMPT_MODPLUG1 0.2.7561~beta20.5 +- _ZN10CSoundFile11FineVibratoEP11_MODCHANNELj@LIBOPENMPT_MODPLUG1 0.2.7561~beta20.5 +- _ZN10CSoundFile11FreePatternEPv@LIBOPENMPT_MODPLUG1 0.2.7561~beta20.5 +- _ZN10CSoundFile11InitSysInfoEv@LIBOPENMPT_MODPLUG1 0.2.7561~beta20.5 +- _ZN10CSoundFile11LoopPatternEii@LIBOPENMPT_MODPLUG1 0.2.7561~beta20.5 +- _ZN10CSoundFile11PatternLoopEP11_MODCHANNELj@LIBOPENMPT_MODPLUG1 0.2.7561~beta20.5 +- _ZN10CSoundFile11VolumeSlideEP11_MODCHANNELj@LIBOPENMPT_MODPLUG1 0.2.7561~beta20.5 +- _ZN10CSoundFile12FineVolumeUpEP11_MODCHANNELj@LIBOPENMPT_MODPLUG1 0.2.7561~beta20.5 +- _ZN10CSoundFile12ITInstrToMPTEPKvP17_INSTRUMENTHEADERj@LIBOPENMPT_MODPLUG1 0.2.7561~beta20.5 +- _ZN10CSoundFile12IsSampleUsedEj@LIBOPENMPT_MODPLUG1 0.2.7561~beta20.5 +- _ZN10CSoundFile12PanningSlideEP11_MODCHANNELj@LIBOPENMPT_MODPLUG1 0.2.7561~beta20.5 +- _ZN10CSoundFile12PortamentoUpEP11_MODCHANNELj@LIBOPENMPT_MODPLUG1 0.2.7561~beta20.5 +- _ZN10CSoundFile12ResetMidiCfgEv@LIBOPENMPT_MODPLUG1 0.2.7561~beta20.5 +- _ZN10CSoundFile12SetMixConfigEjj@LIBOPENMPT_MODPLUG1 0.2.7561~beta20.5 +- _ZN10CSoundFile12gnReverbTypeE@LIBOPENMPT_MODPLUG1 0.2.7386~beta20.3 +- _ZN10CSoundFile12gpSndMixHookE@LIBOPENMPT_MODPLUG1 0.2.7386~beta20.3 +- _ZN10CSoundFile13CanPackSampleEPcjjPh@LIBOPENMPT_MODPLUG1 0.2.7561~beta20.5 +- _ZN10CSoundFile13CheckCPUUsageEj@LIBOPENMPT_MODPLUG1 0.2.7561~beta20.5 +- _ZN10CSoundFile13DestroySampleEj@LIBOPENMPT_MODPLUG1 0.2.7561~beta20.5 +- _ZN10CSoundFile13ResetChannelsEv@LIBOPENMPT_MODPLUG1 0.2.7561~beta20.5 +- _ZN10CSoundFile13SetCurrentPosEj@LIBOPENMPT_MODPLUG1 0.2.7386~beta20.3 +- _ZN10CSoundFile13SetWaveConfigEjjjb@LIBOPENMPT_MODPLUG1 0.2.7386~beta20.3 +- _ZN10CSoundFile13gdwMixingFreqE@LIBOPENMPT_MODPLUG1 0.2.7386~beta20.3 +- _ZN10CSoundFile13gdwSoundSetupE@LIBOPENMPT_MODPLUG1 0.2.7386~beta20.3 +- _ZN10CSoundFile13m_nXBassDepthE@LIBOPENMPT_MODPLUG1 0.2.7386~beta20.3 +- _ZN10CSoundFile13m_nXBassRangeE@LIBOPENMPT_MODPLUG1 0.2.7386~beta20.3 +- _ZN10CSoundFile14AllocateSampleEj@LIBOPENMPT_MODPLUG1 0.2.7561~beta20.5 +- _ZN10CSoundFile14FineVolumeDownEP11_MODCHANNELj@LIBOPENMPT_MODPLUG1 0.2.7561~beta20.5 +- _ZN10CSoundFile14GlobalFadeSongEj@LIBOPENMPT_MODPLUG1 0.2.7561~beta20.5 +- _ZN10CSoundFile14GlobalVolSlideEj@LIBOPENMPT_MODPLUG1 0.2.7561~beta20.5 +- _ZN10CSoundFile14LoadMixPluginsEPKvj@LIBOPENMPT_MODPLUG1 0.2.7561~beta20.5 +- _ZN10CSoundFile14PortamentoDownEP11_MODCHANNELj@LIBOPENMPT_MODPLUG1 0.2.7561~beta20.5 +- _ZN10CSoundFile14ProcessEffectsEv@LIBOPENMPT_MODPLUG1 0.2.7561~beta20.5 +- _ZN10CSoundFile14SaveMixPluginsEP8_IO_FILEb@LIBOPENMPT_MODPLUG1 0.2.7561~beta20.5 +- _ZN10CSoundFile14SetPatternNameEjPKc@LIBOPENMPT_MODPLUG1 0.2.7561~beta20.5 +- _ZN10CSoundFile14TonePortamentoEP11_MODCHANNELj@LIBOPENMPT_MODPLUG1 0.2.7561~beta20.5 +- _ZN10CSoundFile14m_nReverbDelayE@LIBOPENMPT_MODPLUG1 0.2.7386~beta20.3 +- _ZN10CSoundFile14m_nReverbDepthE@LIBOPENMPT_MODPLUG1 0.2.7386~beta20.3 +- _ZN10CSoundFile15AllocatePatternEjj@LIBOPENMPT_MODPLUG1 0.2.7561~beta20.5 +- _ZN10CSoundFile15ChannelVolSlideEP11_MODCHANNELj@LIBOPENMPT_MODPLUG1 0.2.7561~beta20.5 +- _ZN10CSoundFile15CreateStereoMixEi@LIBOPENMPT_MODPLUG1 0.2.7561~beta20.5 +- _ZN10CSoundFile15GetSongCommentsEPcjj@LIBOPENMPT_MODPLUG1 0.2.7386~beta20.3 +- _ZN10CSoundFile15SetCurrentOrderEj@LIBOPENMPT_MODPLUG1 0.2.7561~beta20.5 +- _ZN10CSoundFile15SetMasterVolumeEjb@LIBOPENMPT_MODPLUG1 0.2.7561~beta20.5 +- _ZN10CSoundFile15SetWaveConfigExEbbbbbbb@LIBOPENMPT_MODPLUG1 0.2.7386~beta20.3 +- _ZN10CSoundFile15gnBitsPerSampleE@LIBOPENMPT_MODPLUG1 0.2.7386~beta20.3 +- _ZN10CSoundFile15m_nStreamVolumeE@LIBOPENMPT_MODPLUG1 0.2.7386~beta20.3 +- _ZN10CSoundFile16AdjustSampleLoopEP14_MODINSTRUMENT@LIBOPENMPT_MODPLUG1 0.2.7561~beta20.5 +- _ZN10CSoundFile16FinePortamentoUpEP11_MODCHANNELj@LIBOPENMPT_MODPLUG1 0.2.7561~beta20.5 +- _ZN10CSoundFile16InstrumentChangeEP11_MODCHANNELjbbb@LIBOPENMPT_MODPLUG1 0.2.7561~beta20.5 +- _ZN10CSoundFile16IsInstrumentUsedEj@LIBOPENMPT_MODPLUG1 0.2.7561~beta20.5 +- _ZN10CSoundFile16ProcessMidiMacroEjPKcj@LIBOPENMPT_MODPLUG1 0.2.7561~beta20.5 +- _ZN10CSoundFile16m_nProLogicDelayE@LIBOPENMPT_MODPLUG1 0.2.7386~beta20.3 +- _ZN10CSoundFile16m_nProLogicDepthE@LIBOPENMPT_MODPLUG1 0.2.7386~beta20.3 +- _ZN10CSoundFile17DestroyInstrumentEj@LIBOPENMPT_MODPLUG1 0.2.7561~beta20.5 +- _ZN10CSoundFile17MapMidiInstrumentEjjj@LIBOPENMPT_MODPLUG1 0.2.7561~beta20.5 +- _ZN10CSoundFile17SetResamplingModeEj@LIBOPENMPT_MODPLUG1 0.2.7386~beta20.3 +- _ZN10CSoundFile17m_nMaxMixChannelsE@LIBOPENMPT_MODPLUG1 0.2.7386~beta20.3 +- _ZN10CSoundFile18FinePortamentoDownEP11_MODCHANNELj@LIBOPENMPT_MODPLUG1 0.2.7561~beta20.5 +- _ZN10CSoundFile18GetRawSongCommentsEPcjj@LIBOPENMPT_MODPLUG1 0.2.7561~beta20.5 +- _ZN10CSoundFile18ReadSampleFromSongEjPS_j@LIBOPENMPT_MODPLUG1 0.2.7561~beta20.5 +- _ZN10CSoundFile18SetXBassParametersEjj@LIBOPENMPT_MODPLUG1 0.2.7386~beta20.3 +- _ZN10CSoundFile19DetectUnusedSamplesEPb@LIBOPENMPT_MODPLUG1 0.2.7561~beta20.5 +- _ZN10CSoundFile19ExtendedMODCommandsEjj@LIBOPENMPT_MODPLUG1 0.2.7561~beta20.5 +- _ZN10CSoundFile19ExtendedS3MCommandsEjj@LIBOPENMPT_MODPLUG1 0.2.7561~beta20.5 +- _ZN10CSoundFile19SetReverbParametersEjj@LIBOPENMPT_MODPLUG1 0.2.7386~beta20.3 +- _ZN10CSoundFile19gnVolumeRampSamplesE@LIBOPENMPT_MODPLUG1 0.2.7386~beta20.3 +- _ZN10CSoundFile19m_nStereoSeparationE@LIBOPENMPT_MODPLUG1 0.2.7386~beta20.3 +- _ZN10CSoundFile20FrequencyToTransposeEP14_MODINSTRUMENT@LIBOPENMPT_MODPLUG1 0.2.7561~beta20.5 +- _ZN10CSoundFile20FrequencyToTransposeEj@LIBOPENMPT_MODPLUG1 0.2.7561~beta20.5 +- _ZN10CSoundFile20Normalize24BitBufferEPhjjj@LIBOPENMPT_MODPLUG1 0.2.7561~beta20.5 +- _ZN10CSoundFile20TransposeToFrequencyEii@LIBOPENMPT_MODPLUG1 0.2.7561~beta20.5 +- _ZN10CSoundFile21ExtendedChannelEffectEP11_MODCHANNELj@LIBOPENMPT_MODPLUG1 0.2.7561~beta20.5 +- _ZN10CSoundFile21ExtraFinePortamentoUpEP11_MODCHANNELj@LIBOPENMPT_MODPLUG1 0.2.7561~beta20.5 +- _ZN10CSoundFile21RemoveSelectedSamplesEPb@LIBOPENMPT_MODPLUG1 0.2.7561~beta20.5 +- _ZN10CSoundFile21SetSurroundParametersEjj@LIBOPENMPT_MODPLUG1 0.2.7386~beta20.3 +- _ZN10CSoundFile21gpMixPluginCreateProcE@LIBOPENMPT_MODPLUG1 0.2.7386~beta20.3 +- _ZN10CSoundFile22ReadInstrumentFromSongEjPS_j@LIBOPENMPT_MODPLUG1 0.2.7561~beta20.5 +- _ZN10CSoundFile23ExtraFinePortamentoDownEP11_MODCHANNELj@LIBOPENMPT_MODPLUG1 0.2.7561~beta20.5 +- _ZN10CSoundFile23RemoveInstrumentSamplesEj@LIBOPENMPT_MODPLUG1 0.2.7561~beta20.5 +- _ZN10CSoundFile4ReadEPvj@LIBOPENMPT_MODPLUG1 0.2.7386~beta20.3 +- _ZN10CSoundFile5gnAGCE@LIBOPENMPT_MODPLUG1 0.2.7386~beta20.3 +- _ZN10CSoundFile6CreateEPKhj@LIBOPENMPT_MODPLUG1 0.2.7386~beta20.3 +- _ZN10CSoundFile6KeyOffEj@LIBOPENMPT_MODPLUG1 0.2.7561~beta20.5 +- _ZN10CSoundFile6ReadITEPKhj@LIBOPENMPT_MODPLUG1 0.2.7561~beta20.5 +- _ZN10CSoundFile6ReadXMEPKhj@LIBOPENMPT_MODPLUG1 0.2.7561~beta20.5 +- _ZN10CSoundFile6SetAGCEb@LIBOPENMPT_MODPLUG1 0.2.7561~beta20.5 +- _ZN10CSoundFile7DestroyEv@LIBOPENMPT_MODPLUG1 0.2.7386~beta20.3 +- _ZN10CSoundFile7NoteCutEjj@LIBOPENMPT_MODPLUG1 0.2.7561~beta20.5 +- _ZN10CSoundFile7Read669EPKhj@LIBOPENMPT_MODPLUG1 0.2.7561~beta20.5 +- _ZN10CSoundFile7ReadABCEPKhj@LIBOPENMPT_MODPLUG1 0.2.7561~beta20.5 +- _ZN10CSoundFile7ReadAMFEPKhj@LIBOPENMPT_MODPLUG1 0.2.7561~beta20.5 +- _ZN10CSoundFile7ReadAMSEPKhj@LIBOPENMPT_MODPLUG1 0.2.7561~beta20.5 +- _ZN10CSoundFile7ReadDBMEPKhj@LIBOPENMPT_MODPLUG1 0.2.7561~beta20.5 +- _ZN10CSoundFile7ReadDMFEPKhj@LIBOPENMPT_MODPLUG1 0.2.7561~beta20.5 +- _ZN10CSoundFile7ReadDSMEPKhj@LIBOPENMPT_MODPLUG1 0.2.7561~beta20.5 +- _ZN10CSoundFile7ReadFAREPKhj@LIBOPENMPT_MODPLUG1 0.2.7561~beta20.5 +- _ZN10CSoundFile7ReadJ2BEPKhj@LIBOPENMPT_MODPLUG1 0.2.7561~beta20.5 +- _ZN10CSoundFile7ReadMDLEPKhj@LIBOPENMPT_MODPLUG1 0.2.7561~beta20.5 +- _ZN10CSoundFile7ReadMIDEPKhj@LIBOPENMPT_MODPLUG1 0.2.7561~beta20.5 +- _ZN10CSoundFile7ReadMT2EPKhj@LIBOPENMPT_MODPLUG1 0.2.7561~beta20.5 +- _ZN10CSoundFile7ReadMTMEPKhj@LIBOPENMPT_MODPLUG1 0.2.7561~beta20.5 +- _ZN10CSoundFile7ReadMedEPKhj@LIBOPENMPT_MODPLUG1 0.2.7561~beta20.5 +- _ZN10CSoundFile7ReadModEPKhj@LIBOPENMPT_MODPLUG1 0.2.7561~beta20.5 +- _ZN10CSoundFile7ReadOKTEPKhj@LIBOPENMPT_MODPLUG1 0.2.7561~beta20.5 +- _ZN10CSoundFile7ReadPATEPKhj@LIBOPENMPT_MODPLUG1 0.2.7561~beta20.5 +- _ZN10CSoundFile7ReadPSMEPKhj@LIBOPENMPT_MODPLUG1 0.2.7561~beta20.5 +- _ZN10CSoundFile7ReadPTMEPKhj@LIBOPENMPT_MODPLUG1 0.2.7561~beta20.5 +- _ZN10CSoundFile7ReadS3MEPKhj@LIBOPENMPT_MODPLUG1 0.2.7561~beta20.5 +- _ZN10CSoundFile7ReadSTMEPKhj@LIBOPENMPT_MODPLUG1 0.2.7561~beta20.5 +- _ZN10CSoundFile7ReadUMXEPKhj@LIBOPENMPT_MODPLUG1 0.2.7561~beta20.5 +- _ZN10CSoundFile7ReadUltEPKhj@LIBOPENMPT_MODPLUG1 0.2.7561~beta20.5 +- _ZN10CSoundFile7ReadWavEPKhj@LIBOPENMPT_MODPLUG1 0.2.7561~beta20.5 +- _ZN10CSoundFile7TestABCEPKhj@LIBOPENMPT_MODPLUG1 0.2.7561~beta20.5 +- _ZN10CSoundFile7TestMIDEPKhj@LIBOPENMPT_MODPLUG1 0.2.7561~beta20.5 +- _ZN10CSoundFile7TestPATEPKhj@LIBOPENMPT_MODPLUG1 0.2.7561~beta20.5 +- _ZN10CSoundFile7TremoloEP11_MODCHANNELj@LIBOPENMPT_MODPLUG1 0.2.7561~beta20.5 +- _ZN10CSoundFile7VibratoEP11_MODCHANNELj@LIBOPENMPT_MODPLUG1 0.2.7561~beta20.5 +- _ZN10CSoundFile8CheckNNAEjjib@LIBOPENMPT_MODPLUG1 0.2.7561~beta20.5 +- _ZN10CSoundFile8FadeSongEj@LIBOPENMPT_MODPLUG1 0.2.7561~beta20.5 +- _ZN10CSoundFile8ReadAMS2EPKhj@LIBOPENMPT_MODPLUG1 0.2.7561~beta20.5 +- _ZN10CSoundFile8ReadNoteEv@LIBOPENMPT_MODPLUG1 0.2.7561~beta20.5 +- _ZN10CSoundFile8ResetAGCEv@LIBOPENMPT_MODPLUG1 0.2.7561~beta20.5 +- _ZN10CSoundFile8SetSpeedEj@LIBOPENMPT_MODPLUG1 0.2.7561~beta20.5 +- _ZN10CSoundFile8SetTempoEj@LIBOPENMPT_MODPLUG1 0.2.7561~beta20.5 +- _ZN10CSoundFile9GetLengthEbb@LIBOPENMPT_MODPLUG1 0.2.7386~beta20.3 +- _ZN10CSoundFile9PanbrelloEP11_MODCHANNELj@LIBOPENMPT_MODPLUG1 0.2.7561~beta20.5 +- _ZN10CSoundFile9gnVUMeterE@LIBOPENMPT_MODPLUG1 0.2.7386~beta20.3 +- _ZN10CSoundFileC1Ev@LIBOPENMPT_MODPLUG1 0.2.7386~beta20.3 +- _ZN10CSoundFileC2Ev@LIBOPENMPT_MODPLUG1 0.2.7386~beta20.3 +- _ZN10CSoundFileD1Ev@LIBOPENMPT_MODPLUG1 0.2.7386~beta20.3 +- _ZN10CSoundFileD2Ev@LIBOPENMPT_MODPLUG1 0.2.7386~beta20.3 +- _ZNK10CSoundFile10S3MConvertEP11_MODCOMMANDb@LIBOPENMPT_MODPLUG1 0.2.7561~beta20.5 +- _ZNK10CSoundFile13GetCurrentPosEv@LIBOPENMPT_MODPLUG1 0.2.7386~beta20.3 +- _ZNK10CSoundFile13GetNNAChannelEj@LIBOPENMPT_MODPLUG1 0.2.7561~beta20.5 +- _ZNK10CSoundFile13GetSampleNameEjPc@LIBOPENMPT_MODPLUG1 0.2.7561~beta20.5 +- _ZNK10CSoundFile14GetMaxPositionEv@LIBOPENMPT_MODPLUG1 0.2.7386~beta20.3 +- _ZNK10CSoundFile14GetNumChannelsEv@LIBOPENMPT_MODPLUG1 0.2.7561~beta20.5 +- _ZNK10CSoundFile14GetNumPatternsEv@LIBOPENMPT_MODPLUG1 0.2.7561~beta20.5 +- _ZNK10CSoundFile14GetPatternNameEjPcj@LIBOPENMPT_MODPLUG1 0.2.7561~beta20.5 +- _ZNK10CSoundFile14GetSaveFormatsEv@LIBOPENMPT_MODPLUG1 0.2.7561~beta20.5 +- _ZNK10CSoundFile14IsSongFinishedEjj@LIBOPENMPT_MODPLUG1 0.2.7561~beta20.5 +- _ZNK10CSoundFile14ModSaveCommandEPK11_MODCOMMANDb@LIBOPENMPT_MODPLUG1 0.2.7561~beta20.5 +- _ZNK10CSoundFile14S3MSaveConvertEPjS0_b@LIBOPENMPT_MODPLUG1 0.2.7561~beta20.5 +- _ZNK10CSoundFile17ConvertModCommandEP11_MODCOMMAND@LIBOPENMPT_MODPLUG1 0.2.7561~beta20.5 +- _ZNK10CSoundFile17CutOffToFrequencyEji@LIBOPENMPT_MODPLUG1 0.2.7561~beta20.5 +- _ZNK10CSoundFile17GetBestSaveFormatEv@LIBOPENMPT_MODPLUG1 0.2.7561~beta20.5 +- _ZNK10CSoundFile17GetFreqFromPeriodEjji@LIBOPENMPT_MODPLUG1 0.2.7561~beta20.5 +- _ZNK10CSoundFile17GetInstrumentNameEjPc@LIBOPENMPT_MODPLUG1 0.2.7561~beta20.5 +- _ZNK10CSoundFile17GetNoteFromPeriodEj@LIBOPENMPT_MODPLUG1 0.2.7561~beta20.5 +- _ZNK10CSoundFile17GetNumInstrumentsEv@LIBOPENMPT_MODPLUG1 0.2.7561~beta20.5 +- _ZNK10CSoundFile17GetPeriodFromNoteEjij@LIBOPENMPT_MODPLUG1 0.2.7561~beta20.5 +- _ZNK10CSoundFile18SetupChannelFilterEP11_MODCHANNELbi@LIBOPENMPT_MODPLUG1 0.2.7561~beta20.5 +- _ZNK10CSoundFile19IsValidBackwardJumpEjjjj@LIBOPENMPT_MODPLUG1 0.2.7561~beta20.5 +diff -uraN ../../orig/libopenmpt-0.4.0/debian/rules ./debian/rules +--- ../../orig/libopenmpt-0.4.0/debian/rules 2018-12-24 16:43:58.000000000 -0500 ++++ ./debian/rules 2019-01-04 17:03:16.206691071 -0500 +@@ -11,9 +11,10 @@ + dh $@ + + override_dh_autoreconf: +- dh_autoreconf --as-needed ++ autoreconf --force --install + + override_dh_auto_configure: ++ debian/rules override_dh_autoreconf + dh_auto_configure -- --disable-static --enable-libopenmpt_modplug + + override_dh_auto_build: diff --git a/libs/libopenmpt/debian/libopenmpt-0.4.0-xenial-backport.diff b/libs/libopenmpt/debian/libopenmpt-0.4.0-xenial-backport.diff new file mode 100644 index 000000000..9cb88b748 --- /dev/null +++ b/libs/libopenmpt/debian/libopenmpt-0.4.0-xenial-backport.diff @@ -0,0 +1,40 @@ +diff -uraN ../../orig/libopenmpt-0.4.0/debian/changelog ./debian/changelog +--- ../../orig/libopenmpt-0.4.0/debian/changelog 2018-12-24 16:43:58.000000000 -0500 ++++ ./debian/changelog 2019-01-04 16:37:08.788775423 -0500 +@@ -1,3 +1,12 @@ ++libopenmpt (0.4.0-ubuntu16.04.1~ppa10) xenial; urgency=medium ++ ++ * Backport to Xenial ++ * automake build depend added ++ * debhelper depend adjusted to >= 9.0~ ++ * deb compat level adjusted to 10 ++ ++ -- Sonic Team Junior Fri, 04 Jan 2019 16:35:08 -0500 ++ + libopenmpt (0.4.0-1) unstable; urgency=medium + + * New upstream release. +diff -uraN ../../orig/libopenmpt-0.4.0/debian/compat ./debian/compat +--- ../../orig/libopenmpt-0.4.0/debian/compat 2018-12-24 16:43:58.000000000 -0500 ++++ ./debian/compat 2019-01-04 16:34:31.830370437 -0500 +@@ -1 +1 @@ +-11 ++10 +diff -uraN ../../orig/libopenmpt-0.4.0/debian/control ./debian/control +--- ../../orig/libopenmpt-0.4.0/debian/control 2018-12-24 16:43:58.000000000 -0500 ++++ ./debian/control 2019-01-04 16:34:59.339499384 -0500 +@@ -4,7 +4,8 @@ + Maintainer: Debian Multimedia Maintainers + Uploaders: James Cowgill + Build-Depends: +- debhelper (>= 11.1~), ++ automake, ++ debhelper (>= 9.0~), + dh-exec, + doxygen, + dpkg-dev (>= 1.18.0), +diff -uraN ../../orig/libopenmpt-0.4.0/debian/files ./debian/files +--- ../../orig/libopenmpt-0.4.0/debian/files 1969-12-31 19:00:00.000000000 -0500 ++++ ./debian/files 2019-01-04 16:37:20.001229883 -0500 +@@ -0,0 +1 @@ ++libopenmpt_0.4.0-ubuntu16.04.1~ppa10_source.buildinfo libs optional diff --git a/libs/libopenmpt/inc/libopenmpt/libopenmpt.h b/libs/libopenmpt/inc/libopenmpt/libopenmpt.h new file mode 100644 index 000000000..d41324885 --- /dev/null +++ b/libs/libopenmpt/inc/libopenmpt/libopenmpt.h @@ -0,0 +1,1449 @@ +/* + * libopenmpt.h + * ------------ + * Purpose: libopenmpt public c interface + * Notes : (currently none) + * Authors: OpenMPT Devs + * The OpenMPT source code is released under the BSD license. Read LICENSE for more details. + */ + +#ifndef LIBOPENMPT_H +#define LIBOPENMPT_H + +#include "libopenmpt_config.h" +#include +#include + +/*! + * \page libopenmpt_c_overview C API + * + * \section libopenmpt_c_error Error Handling + * + * - Functions with no return value in the corresponding C++ API return 0 on + * failure and 1 on success. + * - Functions that return a string in the corresponding C++ API return a + * dynamically allocated const char *. In case of failure or memory allocation + * failure, a NULL pointer is returned. + * - Functions that return integer values signal error condition by returning + * an invalid value (-1 in most cases, 0 in some cases). + * - All functions that work on an \ref openmpt_module object will call an + * \ref openmpt_error_func and depending on the value returned by this function + * log the error code and/xor/or store it inside the openmpt_module object. + * Stored error codes can be accessed with the openmpt_module_error_get_last() + * and openmpt_module_error_get_last_message(). Stored errors will not get + * cleared automatically and should be reset with openmpt_module_error_clear(). + * - Some functions not directly related to an \ref openmpt_module object take + * an explicit \ref openmpt_error_func error function callback and a pointer to + * an int and behave analog to the functions working on an \ref openmpt_module + * object. + * + * \section libopenmpt_c_strings Strings + * + * - All strings returned from libopenmpt are encoded in UTF-8. + * - All strings passed to libopenmpt should also be encoded in UTF-8. + * Behaviour in case of invalid UTF-8 is unspecified. + * - libopenmpt does not enforce or expect any particular Unicode + * normalization form. + * - All strings returned from libopenmpt are dynamically allocated and must + * be freed with openmpt_free_string(). Do NOT use the C standard library + * free() for libopenmpt strings as that would make your code invalid on + * windows when dynamically linking against libopenmpt which itself statically + * links to the C runtime. + * - All strings passed to libopenmpt are copied. No ownership is assumed or + * transferred. + * + * \section libopenmpt_c_fileio File I/O + * + * libopenmpt can use 3 different strategies for file I/O. + * + * - openmpt_module_create_from_memory2() will load the module from the provided + * memory buffer, which will require loading all data upfront by the library + * caller. + * - openmpt_module_create2() with a seekable stream will load the module via + * callbacks to the stream interface. libopenmpt will not implement an + * additional buffering layer in this case which means the callbacks are assumed + * to be performant even with small i/o sizes. + * - openmpt_module_create2() with an unseekable stream will load the module via + * callbacks to the stream interface. libopempt will make an internal copy as + * it goes along, and sometimes have to pre-cache the whole file in case it + * needs to know the complete file size. This strategy is intended to be used + * if the file is located on a high latency network. + * + * | create function | speed | memory consumption | + * | ----------------------------------------------: | :----: | :----------------: | + * | openmpt_module_create_from_memory2() |

fast

|

medium

| + * | openmpt_module_create2() with seekable stream |

slow

|

low

| + * | openmpt_module_create2() with unseekable stream |

medium

|

high

| + * + * In all cases, the data or stream passed to the create function is no longer + * needed after the openmpt_module has been created and can be freed by the + * caller. + * + * \section libopenmpt_c_outputformat Output Format + * + * libopenmpt supports a wide range of PCM output formats: + * [8000..192000]/[mono|stereo|quad]/[f32|i16]. + * + * Unless you have some very specific requirements demanding a particular aspect + * of the output format, you should always prefer 48000/stereo/f32 as the + * libopenmpt PCM format. + * + * - Please prefer 48000Hz unless the user explicitly demands something else. + * Practically all audio equipment and file formats use 48000Hz nowadays. + * - Practically all module formats are made for stereo output. Mono will not + * give you any measurable speed improvements and can trivially be obtained from + * the stereo output anyway. Quad is not expected by almost all modules and even + * if they do use surround effects, they expect the effects to be mixed to + * stereo. + * - Floating point output provides headroom instead of hard clipping if the + * module is louder than 0dBFs, will give you a better signal-to-noise ratio + * than int16 output, and avoid the need to apply an additional dithering to the + * output by libopenmpt. Unless your platform has no floating point unit at all, + * floating point will thus also be slightly faster. + * + * \section libopenmpt_c_threads libopenmpt in multi-threaded environments + * + * - libopenmpt is thread-aware. + * - Individual libopenmpt objects are not thread-safe. + * - libopenmpt itself does not spawn any user-visible threads but may spawn + * threads for internal use. + * - You must ensure to only ever access a particular libopenmpt object from a + * single thread at a time. + * - Consecutive accesses can happen from different threads. + * - Different objects can be accessed concurrently from different threads. + * + * \section libopenmpt_c_staticlinking Statically linking to libopenmpt + * + * libopenmpt is implemented in C++. This implies that linking to libopenmpt + * statically requires linking to the C++ runtime and standard library. The + * **highly preferred and recommended** way to do this is by using the C++ + * compiler instead of the platform linker to do the linking. This will do all + * necessary things that are C++ specific (in particular, it will pull in the + * appropriate runtime and/or library). If for whatever reason it is not + * possible to use the C++ compiler for statically linking against libopenmpt, + * the libopenmpt build system can list the required libraries in the pkg-config + * file `libopenmpt.pc`. However, there is no reliable way to determine the name + * of the required library or libraries from within the build system. The + * libopenmpt autotools `configure` and plain `Makefile` honor the custom + * variable `CXXSTDLIB_PCLIBSPRIVATE` which serves the sole purpose of listing + * the standard library (or libraries) required for static linking. The contents + * of this variable will be put in `libopenmpt.pc` `Libs.private` and used for + * nothing else. + * + * This problem is inherent to libraries implemented in C++ that can also be used + * without a C++ compiler. Other libraries try to solve that by listing + * `-lstdc++` unconditionally in `Libs.private`. However, that will break + * platforms that use a different C++ standard library (in particular FreeBSD). + * + * See https://lists.freedesktop.org/archives/pkg-config/2016-August/001055.html . + * + * Dymically linking to libopenmpt does not require anything special and will + * work as usual (and exactly as done for libraries implemented in C). + * + * Note: This section does not apply when using Microsoft Visual Studio or + * Andriod NDK ndk-build build systems. + * + * \section libopenmpt_c_detailed Detailed documentation + * + * \ref libopenmpt_c + * + * In case a function is not documented here, you might want to look at the + * \ref libopenmpt_cpp documentation. The C and C++ APIs are kept semantically + * as close as possible. + * + * \section libopenmpt_c_examples Examples + * + * \subsection libopenmpt_c_example_unsafe Unsafe, simplified example without any error checking to get a first idea of the API + * \include libopenmpt_example_c_unsafe.c + * \subsection libopenmpt_c_example_file FILE* + * \include libopenmpt_example_c.c + * \subsection libopenmpt_c_example_inmemory in memory + * \include libopenmpt_example_c_mem.c + * \subsection libopenmpt_c_example_stdout reading FILE* and writing PCM data to STDOUT (usable without PortAudio) + * \include libopenmpt_example_c_stdout.c + * + */ + +/*! \defgroup libopenmpt_c libopenmpt C */ + +/*! \addtogroup libopenmpt_c + * @{ + */ + +#ifdef __cplusplus +extern "C" { +#endif + +/*! \brief Get the libopenmpt version number + * + * Returns the libopenmpt version number. + * \return The value represents (major << 24 + minor << 16 + patch << 0). + * \remarks libopenmpt < 0.3.0-pre used the following scheme: (major << 24 + minor << 16 + revision). + */ +LIBOPENMPT_API uint32_t openmpt_get_library_version(void); + +/*! \brief Get the core version number + * + * Return the OpenMPT core version number. + * \return The value represents (majormajor << 24 + major << 16 + minor << 8 + minorminor). + */ +LIBOPENMPT_API uint32_t openmpt_get_core_version(void); + +/*! Return a verbose library version string from openmpt_get_string(). \deprecated Please use `"library_version"` directly. */ +#define OPENMPT_STRING_LIBRARY_VERSION LIBOPENMPT_DEPRECATED_STRING( "library_version" ) +/*! Return a verbose library features string from openmpt_get_string(). \deprecated Please use `"library_features"` directly. */ +#define OPENMPT_STRING_LIBRARY_FEATURES LIBOPENMPT_DEPRECATED_STRING( "library_features" ) +/*! Return a verbose OpenMPT core version string from openmpt_get_string(). \deprecated Please use `"core_version"` directly. */ +#define OPENMPT_STRING_CORE_VERSION LIBOPENMPT_DEPRECATED_STRING( "core_version" ) +/*! Return information about the current build (e.g. the build date or compiler used) from openmpt_get_string(). \deprecated Please use `"build"` directly. */ +#define OPENMPT_STRING_BUILD LIBOPENMPT_DEPRECATED_STRING( "build" ) +/*! Return all contributors from openmpt_get_string(). \deprecated Please use `"credits"` directly. */ +#define OPENMPT_STRING_CREDITS LIBOPENMPT_DEPRECATED_STRING( "credits" ) +/*! Return contact information about libopenmpt from openmpt_get_string(). \deprecated Please use `"contact"` directly. */ +#define OPENMPT_STRING_CONTACT LIBOPENMPT_DEPRECATED_STRING( "contact" ) +/*! Return the libopenmpt license from openmpt_get_string(). \deprecated Please use `"license"` directly. */ +#define OPENMPT_STRING_LICENSE LIBOPENMPT_DEPRECATED_STRING( "license" ) + +/*! \brief Free a string returned by libopenmpt + * + * Frees any string that got returned by libopenmpt. + */ +LIBOPENMPT_API void openmpt_free_string( const char * str ); + +/*! \brief Get library related metadata. + * + * \param key Key to query. + * Possible keys are: + * - "library_version": verbose library version string + * - "library_version_is_release": "1" if the version is an officially released version + * - "library_features": verbose library features string + * - "core_version": verbose OpenMPT core version string + * - "source_url": original source code URL + * - "source_date": original source code date + * - "source_revision": original source code revision + * - "source_is_modified": "1" if the original source has been modified + * - "source_has_mixed_revisions": "1" if the original source has been compiled from different various revision + * - "source_is_package": "1" if the original source has been obtained from a source pacakge instead of source code version control + * - "build": information about the current build (e.g. the build date or compiler used) + * - "build_compiler": information about the compiler used to build libopenmpt + * - "credits": all contributors + * - "contact": contact information about libopenmpt + * - "license": the libopenmpt license + * - "url": libopenmpt website URL + * - "support_forum_url": libopenmpt support and discussions forum URL + * - "bugtracker_url": libopenmpt bug and issue tracker URL + * \return A (possibly multi-line) string containing the queried information. If no information is available, the string is empty. + */ +LIBOPENMPT_API const char * openmpt_get_string( const char * key ); + +/*! \brief Get a list of supported file extensions + * + * \return The semicolon-separated list of extensions supported by this libopenmpt build. The extensions are returned lower-case without a leading dot. + */ +LIBOPENMPT_API const char * openmpt_get_supported_extensions(void); + +/*! \brief Query whether a file extension is supported + * + * \param extension file extension to query without a leading dot. The case is ignored. + * \return 1 if the extension is supported by libopenmpt, 0 otherwise. + */ +LIBOPENMPT_API int openmpt_is_extension_supported( const char * extension ); + +/*! Seek to the given offset relative to the beginning of the file. */ +#define OPENMPT_STREAM_SEEK_SET 0 +/*! Seek to the given offset relative to the current position in the file. */ +#define OPENMPT_STREAM_SEEK_CUR 1 +/*! Seek to the given offset relative to the end of the file. */ +#define OPENMPT_STREAM_SEEK_END 2 + +/*! \brief Read bytes from stream + * + * Read bytes data from stream to dst. + * \param stream Stream to read data from + * \param dst Target where to copy data. + * \param bytes Number of bytes to read. + * \return Number of bytes actually read and written to dst. + * \retval 0 End of stream or error. + * \remarks Short reads are allowed as long as they return at least 1 byte if EOF is not reached. + */ +typedef size_t (*openmpt_stream_read_func)( void * stream, void * dst, size_t bytes ); + +/*! \brief Seek stream position + * + * Seek to stream position offset at whence. + * \param stream Stream to operate on. + * \param offset Offset to seek to. + * \param whence OPENMPT_STREAM_SEEK_SET, OPENMPT_STREAM_SEEK_CUR, OPENMPT_STREAM_SEEK_END. See C89 documentation. + * \return Returns 0 on success. + * \retval 0 Success. + * \retval -1 Failure. Position does not get updated. + * \remarks libopenmpt will not try to seek beyond the file size, thus it is not important whether you allow for virtual positioning after the file end, or return an error in that case. The position equal to the file size needs to be seekable to. + */ +typedef int (*openmpt_stream_seek_func)( void * stream, int64_t offset, int whence ); + +/*! \brief Tell stream position + * + * Tell position of stream. + * \param stream Stream to operate on. + * \return Current position in stream. + * \retval -1 Failure. + */ +typedef int64_t (*openmpt_stream_tell_func)( void * stream ); + +/*! \brief Stream callbacks + * + * Stream callbacks used by libopenmpt for stream operations. + * \sa openmpt_stream_get_file_callbacks + * \sa openmpt_stream_get_fd_callbacks + * \sa openmpt_stream_get_buffer_callbacks + */ +typedef struct openmpt_stream_callbacks { + + /*! \brief Read callback. + * + * \sa openmpt_stream_read_func + */ + openmpt_stream_read_func read; + + /*! \brief Seek callback. + * + * Seek callback can be NULL if seeking is not supported. + * \sa openmpt_stream_seek_func + */ + openmpt_stream_seek_func seek; + + /*! \brief Tell callback. + * + * Tell callback can be NULL if seeking is not supported. + * \sa openmpt_stream_tell_func + */ + openmpt_stream_tell_func tell; + +} openmpt_stream_callbacks; + +/*! \brief Logging function + * + * \param message UTF-8 encoded log message. + * \param user User context that was passed to openmpt_module_create2(), openmpt_module_create_from_memory2() or openmpt_could_open_probability2(). + */ +typedef void (*openmpt_log_func)( const char * message, void * user ); + +/*! \brief Default logging function + * + * Default logging function that logs anything to stderr. + */ +LIBOPENMPT_API void openmpt_log_func_default( const char * message, void * user ); + +/*! \brief Silent logging function + * + * Silent logging function that throws any log message away. + */ +LIBOPENMPT_API void openmpt_log_func_silent( const char * message, void * user ); + +/*! No error. \since 0.3.0 */ +#define OPENMPT_ERROR_OK 0 + +/*! Lowest value libopenmpt will use for any of its own error codes. \since 0.3.0 */ +#define OPENMPT_ERROR_BASE 256 + +/*! Unknown internal error. \since 0.3.0 */ +#define OPENMPT_ERROR_UNKNOWN ( OPENMPT_ERROR_BASE + 1 ) + +/*! Unknown internal C++ exception. \since 0.3.0 */ +#define OPENMPT_ERROR_EXCEPTION ( OPENMPT_ERROR_BASE + 11 ) + +/*! Out of memory. \since 0.3.0 */ +#define OPENMPT_ERROR_OUT_OF_MEMORY ( OPENMPT_ERROR_BASE + 21 ) + +/*! Runtime error. \since 0.3.0 */ +#define OPENMPT_ERROR_RUNTIME ( OPENMPT_ERROR_BASE + 30 ) +/*! Range error. \since 0.3.0 */ +#define OPENMPT_ERROR_RANGE ( OPENMPT_ERROR_BASE + 31 ) +/*! Arithmetic overflow. \since 0.3.0 */ +#define OPENMPT_ERROR_OVERFLOW ( OPENMPT_ERROR_BASE + 32 ) +/*! Arithmetic underflow. \since 0.3.0 */ +#define OPENMPT_ERROR_UNDERFLOW ( OPENMPT_ERROR_BASE + 33 ) + +/*! Logic error. \since 0.3.0 */ +#define OPENMPT_ERROR_LOGIC ( OPENMPT_ERROR_BASE + 40 ) +/*! Value domain error. \since 0.3.0 */ +#define OPENMPT_ERROR_DOMAIN ( OPENMPT_ERROR_BASE + 41 ) +/*! Maximum supported size exceeded. \since 0.3.0 */ +#define OPENMPT_ERROR_LENGTH ( OPENMPT_ERROR_BASE + 42 ) +/*! Argument out of range. \since 0.3.0 */ +#define OPENMPT_ERROR_OUT_OF_RANGE ( OPENMPT_ERROR_BASE + 43 ) +/*! Invalid argument. \since 0.3.0 */ +#define OPENMPT_ERROR_INVALID_ARGUMENT ( OPENMPT_ERROR_BASE + 44 ) + +/*! General libopenmpt error. \since 0.3.0 */ +#define OPENMPT_ERROR_GENERAL ( OPENMPT_ERROR_BASE + 101 ) +/*! openmpt_module * is invalid. \since 0.3.0 */ +#define OPENMPT_ERROR_INVALID_MODULE_POINTER ( OPENMPT_ERROR_BASE + 102 ) +/*! NULL pointer argument. \since 0.3.0 */ +#define OPENMPT_ERROR_ARGUMENT_NULL_POINTER ( OPENMPT_ERROR_BASE + 103 ) + +/*! \brief Check whether the error is transient + * + * Checks whether an error code represents a transient error which may not occur again in a later try if for example memory has been freed up after an out-of-memory error. + * \param error Error code. + * \retval 0 Error is not transient. + * \retval 1 Error is transient. + * \sa OPENMPT_ERROR_OUT_OF_MEMORY + * \since 0.3.0 + */ +LIBOPENMPT_API int openmpt_error_is_transient( int error ); + +/*! \brief Convert error code to text + * + * Converts an error code into a text string describing the error. + * \param error Error code. + * \return Allocated string describing the error. + * \retval NULL Not enough memory to allocate the string. + * \since 0.3.0 + */ +LIBOPENMPT_API const char * openmpt_error_string( int error ); + +/*! Do not log or store the error. \since 0.3.0 */ +#define OPENMPT_ERROR_FUNC_RESULT_NONE 0 +/*! Log the error. \since 0.3.0 */ +#define OPENMPT_ERROR_FUNC_RESULT_LOG ( 1 << 0 ) +/*! Store the error. \since 0.3.0 */ +#define OPENMPT_ERROR_FUNC_RESULT_STORE ( 1 << 1 ) +/*! Log and store the error. \since 0.3.0 */ +#define OPENMPT_ERROR_FUNC_RESULT_DEFAULT ( OPENMPT_ERROR_FUNC_RESULT_LOG | OPENMPT_ERROR_FUNC_RESULT_STORE ) + +/*! \brief Error function + * + * \param error Error code. + * \param user User context that was passed to openmpt_module_create2(), openmpt_module_create_from_memory2() or openmpt_could_open_probability2(). + * \return Mask of OPENMPT_ERROR_FUNC_RESULT_LOG and OPENMPT_ERROR_FUNC_RESULT_STORE. + * \retval OPENMPT_ERROR_FUNC_RESULT_NONE Do not log or store the error. + * \retval OPENMPT_ERROR_FUNC_RESULT_LOG Log the error. + * \retval OPENMPT_ERROR_FUNC_RESULT_STORE Store the error. + * \retval OPENMPT_ERROR_FUNC_RESULT_DEFAULT Log and store the error. + * \sa OPENMPT_ERROR_FUNC_RESULT_NONE + * \sa OPENMPT_ERROR_FUNC_RESULT_LOG + * \sa OPENMPT_ERROR_FUNC_RESULT_STORE + * \sa OPENMPT_ERROR_FUNC_RESULT_DEFAULT + * \sa openmpt_error_func_default + * \sa openmpt_error_func_log + * \sa openmpt_error_func_store + * \sa openmpt_error_func_ignore + * \sa openmpt_error_func_errno + * \since 0.3.0 + */ +typedef int (*openmpt_error_func)( int error, void * user ); + +/*! \brief Default error function + * + * Causes all errors to be logged and stored. + * \param error Error code. + * \param user Ignored. + * \retval OPENMPT_ERROR_FUNC_RESULT_DEFAULT Always. + * \since 0.3.0 + */ +LIBOPENMPT_API int openmpt_error_func_default( int error, void * user ); + +/*! \brief Log error function + * + * Causes all errors to be logged. + * \param error Error code. + * \param user Ignored. + * \retval OPENMPT_ERROR_FUNC_RESULT_LOG Always. + * \since 0.3.0 + */ +LIBOPENMPT_API int openmpt_error_func_log( int error, void * user ); + +/*! \brief Store error function + * + * Causes all errors to be stored. + * \param error Error code. + * \param user Ignored. + * \retval OPENMPT_ERROR_FUNC_RESULT_STORE Always. + * \since 0.3.0 + */ +LIBOPENMPT_API int openmpt_error_func_store( int error, void * user ); + +/*! \brief Ignore error function + * + * Causes all errors to be neither logged nor stored. + * \param error Error code. + * \param user Ignored. + * \retval OPENMPT_ERROR_FUNC_RESULT_NONE Always. + * \since 0.3.0 + */ +LIBOPENMPT_API int openmpt_error_func_ignore( int error, void * user ); + +/*! \brief Errno error function + * + * Causes all errors to be stored in the pointer passed in as user. + * \param error Error code. + * \param user Pointer to an int as generated by openmpt_error_func_errno_userdata. + * \retval OPENMPT_ERROR_FUNC_RESULT_NONE user is not NULL. + * \retval OPENMPT_ERROR_FUNC_RESULT_DEFAULT user is NULL. + * \since 0.3.0 + */ +LIBOPENMPT_API int openmpt_error_func_errno( int error, void * user ); + +/*! \brief User pointer for openmpt_error_func_errno + * + * Provides a suitable user pointer argument for openmpt_error_func_errno. + * \param error Pointer to an integer value to be used as output by openmpt_error_func_errno. + * \retval (void*)error. + * \since 0.3.0 + */ +LIBOPENMPT_API void * openmpt_error_func_errno_userdata( int * error ); + +/*! \brief Roughly scan the input stream to find out whether libopenmpt might be able to open it + * + * \param stream_callbacks Input stream callback operations. + * \param stream Input stream to scan. + * \param effort Effort to make when validating stream. Effort 0.0 does not even look at stream at all and effort 1.0 completely loads the file from stream. A lower effort requires less data to be loaded but only gives a rough estimate answer. Use an effort of 0.25 to only verify the header data of the module file. + * \param logfunc Logging function where warning and errors are written. May be NULL. + * \param user Logging function user context. Used to pass any user-defined data associated with this module to the logging function. + * \return Probability between 0.0 and 1.0. + * \remarks openmpt_could_open_probability() can return any value between 0.0 and 1.0. Only 0.0 and 1.0 are definitive answers, all values in between are just estimates. In general, any return value >0.0 means that you should try loading the file, and any value below 1.0 means that loading may fail. If you want a threshold above which you can be reasonably sure that libopenmpt will be able to load the file, use >=0.5. If you see the need for a threshold below which you could reasonably outright reject a file, use <0.25 (Note: Such a threshold for rejecting on the lower end is not recommended, but may be required for better integration into some other framework's probe scoring.). + * \remarks openmpt_could_open_probability() expects the complete file data to be eventually available to it, even if it is asked to just parse the header. Verification will be unreliable (both false positives and false negatives), if you pretend that the file is just some few bytes of initial data threshold in size. In order to really just access the first bytes of a file, check in your callback functions whether data or seeking is requested beyond your initial data threshold, and in that case, return an error. openmpt_could_open_probability() will treat this as any other I/O error and return 0.0. You must not expect the correct result in this case. You instead must remember that it asked for more data than you currently want to provide to it and treat this situation as if openmpt_could_open_probability() returned 0.5. + * \sa \ref libopenmpt_c_fileio + * \sa openmpt_stream_callbacks + * \deprecated Please use openmpt_could_open_probability2(). + * \since 0.3.0 + */ +LIBOPENMPT_API LIBOPENMPT_DEPRECATED double openmpt_could_open_probability( openmpt_stream_callbacks stream_callbacks, void * stream, double effort, openmpt_log_func logfunc, void * user ); + +/*! \brief Roughly scan the input stream to find out whether libopenmpt might be able to open it + * + * \param stream_callbacks Input stream callback operations. + * \param stream Input stream to scan. + * \param effort Effort to make when validating stream. Effort 0.0 does not even look at stream at all and effort 1.0 completely loads the file from stream. A lower effort requires less data to be loaded but only gives a rough estimate answer. Use an effort of 0.25 to only verify the header data of the module file. + * \param logfunc Logging function where warning and errors are written. May be NULL. + * \param user Logging function user context. Used to pass any user-defined data associated with this module to the logging function. + * \return Probability between 0.0 and 1.0. + * \remarks openmpt_could_open_probability() can return any value between 0.0 and 1.0. Only 0.0 and 1.0 are definitive answers, all values in between are just estimates. In general, any return value >0.0 means that you should try loading the file, and any value below 1.0 means that loading may fail. If you want a threshold above which you can be reasonably sure that libopenmpt will be able to load the file, use >=0.5. If you see the need for a threshold below which you could reasonably outright reject a file, use <0.25 (Note: Such a threshold for rejecting on the lower end is not recommended, but may be required for better integration into some other framework's probe scoring.). + * \remarks openmpt_could_open_probability() expects the complete file data to be eventually available to it, even if it is asked to just parse the header. Verification will be unreliable (both false positives and false negatives), if you pretend that the file is just some few bytes of initial data threshold in size. In order to really just access the first bytes of a file, check in your callback functions whether data or seeking is requested beyond your initial data threshold, and in that case, return an error. openmpt_could_open_probability() will treat this as any other I/O error and return 0.0. You must not expect the correct result in this case. You instead must remember that it asked for more data than you currently want to provide to it and treat this situation as if openmpt_could_open_probability() returned 0.5. + * \sa \ref libopenmpt_c_fileio + * \sa openmpt_stream_callbacks + * \deprecated Please use openmpt_could_open_probability2(). + */ +LIBOPENMPT_API LIBOPENMPT_DEPRECATED double openmpt_could_open_propability( openmpt_stream_callbacks stream_callbacks, void * stream, double effort, openmpt_log_func logfunc, void * user ); + +/*! \brief Roughly scan the input stream to find out whether libopenmpt might be able to open it + * + * \param stream_callbacks Input stream callback operations. + * \param stream Input stream to scan. + * \param effort Effort to make when validating stream. Effort 0.0 does not even look at stream at all and effort 1.0 completely loads the file from stream. A lower effort requires less data to be loaded but only gives a rough estimate answer. Use an effort of 0.25 to only verify the header data of the module file. + * \param logfunc Logging function where warning and errors are written. May be NULL. + * \param loguser Logging function user context. Used to pass any user-defined data associated with this module to the logging function. + * \param errfunc Error function to define error behaviour. May be NULL. + * \param erruser Error function user context. Used to pass any user-defined data associated with this module to the logging function. + * \param error Pointer to an integer where an error may get stored. May be NULL. + * \param error_message Pointer to a string pointer where an error message may get stored. May be NULL. + * \return Probability between 0.0 and 1.0. + * \remarks openmpt_probe_file_header() or openmpt_probe_file_header_without_filesize() provide a simpler and faster interface that fits almost all use cases better. It is recommended to use openmpt_probe_file_header() or openmpt_probe_file_header_without_filesize() instead of openmpt_could_open_probability(). + * \remarks openmpt_could_open_probability2() can return any value between 0.0 and 1.0. Only 0.0 and 1.0 are definitive answers, all values in between are just estimates. In general, any return value >0.0 means that you should try loading the file, and any value below 1.0 means that loading may fail. If you want a threshold above which you can be reasonably sure that libopenmpt will be able to load the file, use >=0.5. If you see the need for a threshold below which you could reasonably outright reject a file, use <0.25 (Note: Such a threshold for rejecting on the lower end is not recommended, but may be required for better integration into some other framework's probe scoring.). + * \remarks openmpt_could_open_probability2() expects the complete file data to be eventually available to it, even if it is asked to just parse the header. Verification will be unreliable (both false positives and false negatives), if you pretend that the file is just some few bytes of initial data threshold in size. In order to really just access the first bytes of a file, check in your callback functions whether data or seeking is requested beyond your initial data threshold, and in that case, return an error. openmpt_could_open_probability2() will treat this as any other I/O error and return 0.0. You must not expect the correct result in this case. You instead must remember that it asked for more data than you currently want to provide to it and treat this situation as if openmpt_could_open_probability2() returned 0.5. \include libopenmpt_example_c_probe.c + * \sa \ref libopenmpt_c_fileio + * \sa openmpt_stream_callbacks + * \sa openmpt_probe_file_header + * \sa openmpt_probe_file_header_without_filesize + * \since 0.3.0 + */ +LIBOPENMPT_API double openmpt_could_open_probability2( openmpt_stream_callbacks stream_callbacks, void * stream, double effort, openmpt_log_func logfunc, void * loguser, openmpt_error_func errfunc, void * erruser, int * error, const char * * error_message ); + +/*! \brief Get recommended header size for successfull format probing + * + * \sa openmpt_probe_file_header() + * \sa openmpt_probe_file_header_without_filesize() + * \since 0.3.0 + */ +LIBOPENMPT_API size_t openmpt_probe_file_header_get_recommended_size(void); + +/*! Probe for module formats in openmpt_probe_file_header() or openmpt_probe_file_header_without_filesize(). \since 0.3.0 */ +#define OPENMPT_PROBE_FILE_HEADER_FLAGS_MODULES 0x1ul +/*! Probe for module-specific container formats in openmpt_probe_file_header() or openmpt_probe_file_header_without_filesize(). \since 0.3.0 */ +#define OPENMPT_PROBE_FILE_HEADER_FLAGS_CONTAINERS 0x2ul + +/*! Probe for the default set of formats in openmpt_probe_file_header() or openmpt_probe_file_header_without_filesize(). \since 0.3.0 */ +#define OPENMPT_PROBE_FILE_HEADER_FLAGS_DEFAULT ( OPENMPT_PROBE_FILE_HEADER_FLAGS_MODULES | OPENMPT_PROBE_FILE_HEADER_FLAGS_CONTAINERS ) +/*! Probe for no formats in openmpt_probe_file_header() or openmpt_probe_file_header_without_filesize(). \since 0.3.0 */ +#define OPENMPT_PROBE_FILE_HEADER_FLAGS_NONE 0x0ul + +/*! Possible return values fo openmpt_probe_file_header() and openmpt_probe_file_header_without_filesize(). \since 0.3.0 */ +#define OPENMPT_PROBE_FILE_HEADER_RESULT_SUCCESS 1 +/*! Possible return values fo openmpt_probe_file_header() and openmpt_probe_file_header_without_filesize(). \since 0.3.0 */ +#define OPENMPT_PROBE_FILE_HEADER_RESULT_FAILURE 0 +/*! Possible return values fo openmpt_probe_file_header() and openmpt_probe_file_header_without_filesize(). \since 0.3.0 */ +#define OPENMPT_PROBE_FILE_HEADER_RESULT_WANTMOREDATA (-1) +/*! Possible return values fo openmpt_probe_file_header() and openmpt_probe_file_header_without_filesize(). \since 0.3.0 */ +#define OPENMPT_PROBE_FILE_HEADER_RESULT_ERROR (-255) + +/*! \brief Probe the provided bytes from the beginning of a file for supported file format headers to find out whether libopenmpt might be able to open it + * + * \param flags Ored mask of OPENMPT_PROBE_FILE_HEADER_FLAGS_MODULES and OPENMPT_PROBE_FILE_HEADER_FLAGS_CONTAINERS, or OPENMPT_PROBE_FILE_HEADER_FLAGS_DEFAULT. + * \param data Beginning of the file data. + * \param size Size of the beginning of the file data. + * \param filesize Full size of the file data on disk. + * \param logfunc Logging function where warning and errors are written. May be NULL. + * \param loguser Logging function user context. Used to pass any user-defined data associated with this module to the logging function. + * \param errfunc Error function to define error behaviour. May be NULL. + * \param erruser Error function user context. Used to pass any user-defined data associated with this module to the logging function. + * \param error Pointer to an integer where an error may get stored. May be NULL. + * \param error_message Pointer to a string pointer where an error message may get stored. May be NULL. + * \remarks It is recommended to provide openmpt_probe_file_header_get_recommended_size() bytes of data for data and size. If the file is smaller, only provide the filesize amount and set size and filesize to the file's size. + * \remarks openmpt_could_open_probability2() provides a more elaborate interface that might be required for special use cases. It is recommended to use openmpt_probe_file_header() though, if possible. + * \retval OPENMPT_PROBE_FILE_HEADER_RESULT_SUCCESS The file will most likely be supported by libopenmpt. + * \retval OPENMPT_PROBE_FILE_HEADER_RESULT_FAILURE The file is not supported by libopenmpt. + * \retval OPENMPT_PROBE_FILE_HEADER_RESULT_WANTMOREDATA An answer could not be determined with the amount of data provided. + * \retval OPENMPT_PROBE_FILE_HEADER_RESULT_ERROR An internal error occurred. + * \sa openmpt_probe_file_header_get_recommended_size() + * \sa openmpt_probe_file_header_without_filesize() + * \sa openmpt_probe_file_header_from_stream() + * \sa openmpt_could_open_probability2() + * \since 0.3.0 + */ +LIBOPENMPT_API int openmpt_probe_file_header( uint64_t flags, const void * data, size_t size, uint64_t filesize, openmpt_log_func logfunc, void * loguser, openmpt_error_func errfunc, void * erruser, int * error, const char * * error_message ); +/*! \brief Probe the provided bytes from the beginning of a file for supported file format headers to find out whether libopenmpt might be able to open it + * + * \param flags Ored mask of OPENMPT_PROBE_FILE_HEADER_FLAGS_MODULES and OPENMPT_PROBE_FILE_HEADER_FLAGS_CONTAINERS, or OPENMPT_PROBE_FILE_HEADER_FLAGS_DEFAULT. + * \param data Beginning of the file data. + * \param size Size of the beginning of the file data. + * \param logfunc Logging function where warning and errors are written. May be NULL. + * \param loguser Logging function user context. Used to pass any user-defined data associated with this module to the logging function. + * \param errfunc Error function to define error behaviour. May be NULL. + * \param erruser Error function user context. Used to pass any user-defined data associated with this module to the logging function. + * \param error Pointer to an integer where an error may get stored. May be NULL. + * \param error_message Pointer to a string pointer where an error message may get stored. May be NULL. + * \remarks It is recommended to use openmpt_probe_file_header() and provide the acutal file's size as a parameter if at all possible. libopenmpt can provide more accurate answers if the filesize is known. + * \remarks It is recommended to provide openmpt_probe_file_header_get_recommended_size() bytes of data for data and size. If the file is smaller, only provide the filesize amount and set size to the file's size. + * \remarks openmpt_could_open_probability2() provides a more elaborate interface that might be required for special use cases. It is recommended to use openmpt_probe_file_header() though, if possible. + * \retval OPENMPT_PROBE_FILE_HEADER_RESULT_SUCCESS The file will most likely be supported by libopenmpt. + * \retval OPENMPT_PROBE_FILE_HEADER_RESULT_FAILURE The file is not supported by libopenmpt. + * \retval OPENMPT_PROBE_FILE_HEADER_RESULT_WANTMOREDATA An answer could not be determined with the amount of data provided. + * \retval OPENMPT_PROBE_FILE_HEADER_RESULT_ERROR An internal error occurred. + * \sa openmpt_probe_file_header_get_recommended_size() + * \sa openmpt_probe_file_header() + * \sa openmpt_probe_file_header_from_stream() + * \sa openmpt_could_open_probability2() + * \since 0.3.0 + */ +LIBOPENMPT_API int openmpt_probe_file_header_without_filesize( uint64_t flags, const void * data, size_t size, openmpt_log_func logfunc, void * loguser, openmpt_error_func errfunc, void * erruser, int * error, const char * * error_message ); + +/*! \brief Probe the provided bytes from the beginning of a file for supported file format headers to find out whether libopenmpt might be able to open it + * + * \param flags Ored mask of OPENMPT_PROBE_FILE_HEADER_FLAGS_MODULES and OPENMPT_PROBE_FILE_HEADER_FLAGS_CONTAINERS, or OPENMPT_PROBE_FILE_HEADER_FLAGS_DEFAULT. + * \param stream_callbacks Input stream callback operations. + * \param stream Input stream to scan. + * \param logfunc Logging function where warning and errors are written. May be NULL. + * \param loguser Logging function user context. Used to pass any user-defined data associated with this module to the logging function. + * \param errfunc Error function to define error behaviour. May be NULL. + * \param erruser Error function user context. Used to pass any user-defined data associated with this module to the logging function. + * \param error Pointer to an integer where an error may get stored. May be NULL. + * \param error_message Pointer to a string pointer where an error message may get stored. May be NULL. + * \remarks The stream is left in an unspecified state when this function returns. + * \remarks It is recommended to provide openmpt_probe_file_header_get_recommended_size() bytes of data for data and size. If the file is smaller, only provide the filesize amount and set size and filesize to the file's size. + * \remarks openmpt_could_open_probability2() provides a more elaborate interface that might be required for special use cases. It is recommended to use openmpt_probe_file_header() though, if possible. + * \retval OPENMPT_PROBE_FILE_HEADER_RESULT_SUCCESS The file will most likely be supported by libopenmpt. + * \retval OPENMPT_PROBE_FILE_HEADER_RESULT_FAILURE The file is not supported by libopenmpt. + * \retval OPENMPT_PROBE_FILE_HEADER_RESULT_WANTMOREDATA An answer could not be determined with the amount of data provided. + * \retval OPENMPT_PROBE_FILE_HEADER_RESULT_ERROR An internal error occurred. + * \sa openmpt_probe_file_header_get_recommended_size() + * \sa openmpt_probe_file_header() + * \sa openmpt_probe_file_header_without_filesize() + * \sa openmpt_could_open_probability2() + * \since 0.3.0 + */ +LIBOPENMPT_API int openmpt_probe_file_header_from_stream( uint64_t flags, openmpt_stream_callbacks stream_callbacks, void * stream, openmpt_log_func logfunc, void * loguser, openmpt_error_func errfunc, void * erruser, int * error, const char * * error_message ); + + +/*! \brief Opaque type representing a libopenmpt module + */ +typedef struct openmpt_module openmpt_module; + +typedef struct openmpt_module_initial_ctl { + const char * ctl; + const char * value; +} openmpt_module_initial_ctl; + +/*! \brief Construct an openmpt_module + * + * \param stream_callbacks Input stream callback operations. + * \param stream Input stream to load the module from. + * \param logfunc Logging function where warning and errors are written. The logging function may be called throughout the lifetime of openmpt_module. May be NULL. + * \param loguser User-defined data associated with this module. This value will be passed to the logging callback function (logfunc) + * \param ctls A map of initial ctl values. See openmpt_module_get_ctls() + * \return A pointer to the constructed openmpt_module, or NULL on failure. + * \remarks The input data can be discarded after an openmpt_module has been constructed successfully. + * \sa openmpt_stream_callbacks + * \sa \ref libopenmpt_c_fileio + * \deprecated Please use openmpt_module_create2(). + */ +LIBOPENMPT_API LIBOPENMPT_DEPRECATED openmpt_module * openmpt_module_create( openmpt_stream_callbacks stream_callbacks, void * stream, openmpt_log_func logfunc, void * loguser, const openmpt_module_initial_ctl * ctls ); + +/*! \brief Construct an openmpt_module + * + * \param stream_callbacks Input stream callback operations. + * \param stream Input stream to load the module from. + * \param logfunc Logging function where warning and errors are written. The logging function may be called throughout the lifetime of openmpt_module. May be NULL. + * \param loguser User-defined data associated with this module. This value will be passed to the logging callback function (logfunc) + * \param errfunc Error function to define error behaviour. May be NULL. + * \param erruser Error function user context. Used to pass any user-defined data associated with this module to the logging function. + * \param error Pointer to an integer where an error may get stored. May be NULL. + * \param error_message Pointer to a string pointer where an error message may get stored. May be NULL. + * \param ctls A map of initial ctl values. See openmpt_module_get_ctls() + * \return A pointer to the constructed openmpt_module, or NULL on failure. + * \remarks The input data can be discarded after an openmpt_module has been constructed successfully. + * \sa openmpt_stream_callbacks + * \sa \ref libopenmpt_c_fileio + * \since 0.3.0 + */ +LIBOPENMPT_API openmpt_module * openmpt_module_create2( openmpt_stream_callbacks stream_callbacks, void * stream, openmpt_log_func logfunc, void * loguser, openmpt_error_func errfunc, void * erruser, int * error, const char * * error_message, const openmpt_module_initial_ctl * ctls ); + +/*! \brief Construct an openmpt_module + * + * \param filedata Data to load the module from. + * \param filesize Amount of data available. + * \param logfunc Logging function where warning and errors are written. The logging function may be called throughout the lifetime of openmpt_module. + * \param loguser User-defined data associated with this module. This value will be passed to the logging callback function (logfunc) + * \param ctls A map of initial ctl values. See openmpt_module_get_ctls() + * \return A pointer to the constructed openmpt_module, or NULL on failure. + * \remarks The input data can be discarded after an openmpt_module has been constructed successfully. + * \sa \ref libopenmpt_c_fileio + * \deprecated Please use openmpt_module_create_from_memory2(). + */ +LIBOPENMPT_API LIBOPENMPT_DEPRECATED openmpt_module * openmpt_module_create_from_memory( const void * filedata, size_t filesize, openmpt_log_func logfunc, void * loguser, const openmpt_module_initial_ctl * ctls ); + +/*! \brief Construct an openmpt_module + * + * \param filedata Data to load the module from. + * \param filesize Amount of data available. + * \param logfunc Logging function where warning and errors are written. The logging function may be called throughout the lifetime of openmpt_module. + * \param loguser User-defined data associated with this module. This value will be passed to the logging callback function (logfunc) + * \param errfunc Error function to define error behaviour. May be NULL. + * \param erruser Error function user context. Used to pass any user-defined data associated with this module to the logging function. + * \param error Pointer to an integer where an error may get stored. May be NULL. + * \param error_message Pointer to a string pointer where an error message may get stored. May be NULL. + * \param ctls A map of initial ctl values. See openmpt_module_get_ctls() + * \return A pointer to the constructed openmpt_module, or NULL on failure. + * \remarks The input data can be discarded after an openmpt_module has been constructed successfully. + * \sa \ref libopenmpt_c_fileio + * \since 0.3.0 + */ +LIBOPENMPT_API openmpt_module * openmpt_module_create_from_memory2( const void * filedata, size_t filesize, openmpt_log_func logfunc, void * loguser, openmpt_error_func errfunc, void * erruser, int * error, const char * * error_message, const openmpt_module_initial_ctl * ctls ); + +/*! \brief Unload a previously created openmpt_module from memory. + * + * \param mod The module to unload. + */ +LIBOPENMPT_API void openmpt_module_destroy( openmpt_module * mod ); + +/*! \brief Set logging function. + * + * Set the logging function of an already constructed openmpt_module. + * \param mod The module handle to work on. + * \param logfunc Logging function where warning and errors are written. The logging function may be called throughout the lifetime of openmpt_module. + * \param loguser User-defined data associated with this module. This value will be passed to the logging callback function (logfunc) + * \since 0.3.0 + */ +LIBOPENMPT_API void openmpt_module_set_log_func( openmpt_module * mod, openmpt_log_func logfunc, void * loguser ); + +/*! \brief Set error function. + * + * Set the error function of an already constructed openmpt_module. + * \param mod The module handle to work on. + * \param errfunc Error function to define error behaviour. May be NULL. + * \param erruser Error function user context. + * \since 0.3.0 + */ +LIBOPENMPT_API void openmpt_module_set_error_func( openmpt_module * mod, openmpt_error_func errfunc, void * erruser ); + +/*! \brief Get last error. + * + * Return the error currently stored in an openmpt_module. The stored error is not cleared. + * \param mod The module handle to work on. + * \return The error currently stored. + * \sa openmpt_module_error_get_last_message + * \sa openmpt_module_error_set_last + * \sa openmpt_module_error_clear + * \since 0.3.0 + */ +LIBOPENMPT_API int openmpt_module_error_get_last( openmpt_module * mod ); + +/*! \brief Get last error message. + * + * Return the error message currently stored in an openmpt_module. The stored error is not cleared. + * \param mod The module handle to work on. + * \return The error message currently stored. + * \sa openmpt_module_error_set_last + * \sa openmpt_module_error_clear + * \since 0.3.0 + */ +LIBOPENMPT_API const char * openmpt_module_error_get_last_message( openmpt_module * mod ); + +/*! \brief Set last error. + * + * Set the error currently stored in an openmpt_module. + * \param mod The module handle to work on. + * \param error Error to be stored. + * \sa openmpt_module_error_get_last + * \sa openmpt_module_error_clear + * \since 0.3.0 + */ +LIBOPENMPT_API void openmpt_module_error_set_last( openmpt_module * mod, int error ); + +/*! \brief Clear last error. + * + * Set the error currently stored in an openmpt_module to OPPENMPT_ERROR_OK. + * \param mod The module handle to work on. + * \sa openmpt_module_error_get_last + * \sa openmpt_module_error_set_last + * \since 0.3.0 + */ +LIBOPENMPT_API void openmpt_module_error_clear( openmpt_module * mod ); + +/** + * \defgroup openmpt_module_render_param Render param indices + * + * \brief Parameter index to use with openmpt_module_get_render_param() and openmpt_module_set_render_param() + * @{ + */ +/*! \brief Master Gain + * + * The related value represents a relative gain in milliBel.\n + * The default value is 0.\n + * The supported value range is unlimited.\n + */ +#define OPENMPT_MODULE_RENDER_MASTERGAIN_MILLIBEL 1 +/*! \brief Stereo Separation + * + * The related value represents the stereo separation generated by the libopenmpt mixer in percent.\n + * The default value is 100.\n + * The supported value range is [0,200].\n + */ +#define OPENMPT_MODULE_RENDER_STEREOSEPARATION_PERCENT 2 +/*! \brief Interpolation Filter + * + * The related value represents the interpolation filter length used by the libopenmpt mixer.\n + * The default value is 0, which indicates a recommended default value.\n + * The supported value range is [0,inf). Values greater than the implementation limit are clamped to the maximum supported value.\n + * Currently supported values: + * - 0: internal default + * - 1: no interpolation (zero order hold) + * - 2: linear interpolation + * - 4: cubic interpolation + * - 8: windowed sinc with 8 taps + */ +#define OPENMPT_MODULE_RENDER_INTERPOLATIONFILTER_LENGTH 3 +/*! \brief Volume Ramping Strength + * + * The related value represents the amount of volume ramping done by the libopenmpt mixer.\n + * The default value is -1, which indicates a recommended default value.\n + * The meaningful value range is [-1..10].\n + * A value of 0 completely disables volume ramping. This might cause clicks in sound output.\n + * Higher values imply slower/softer volume ramps. + */ +#define OPENMPT_MODULE_RENDER_VOLUMERAMPING_STRENGTH 4 +/** @}*/ + +/** + * \defgroup openmpt_module_command_index Pattern cell indices + * + * \brief Parameter index to use with openmpt_module_get_pattern_row_channel_command(), openmpt_module_format_pattern_row_channel_command() and openmpt_module_highlight_pattern_row_channel_command() + * @{ + */ +#define OPENMPT_MODULE_COMMAND_NOTE 0 +#define OPENMPT_MODULE_COMMAND_INSTRUMENT 1 +#define OPENMPT_MODULE_COMMAND_VOLUMEEFFECT 2 +#define OPENMPT_MODULE_COMMAND_EFFECT 3 +#define OPENMPT_MODULE_COMMAND_VOLUME 4 +#define OPENMPT_MODULE_COMMAND_PARAMETER 5 +/** @}*/ + +/*! \brief Select a sub-song from a multi-song module + * + * \param mod The module handle to work on. + * \param subsong Index of the sub-song. -1 plays all sub-songs consecutively. + * \return 1 on success, 0 on failure. + * \sa openmpt_module_get_num_subsongs, openmpt_module_get_selected_subsong, openmpt_module_get_subsong_name + * \remarks Whether subsong -1 (all subsongs consecutively), subsong 0 or some other subsong is selected by default, is an implementation detail and subject to change. If you do not want to care about subsongs, it is recommended to just not call openmpt_module_select_subsong() at all. + */ +LIBOPENMPT_API int openmpt_module_select_subsong( openmpt_module * mod, int32_t subsong ); +/*! \brief Get currently selected sub-song from a multi-song module + * + * \param mod The module handle to work on. + * \return Currently selected sub-song. -1 for all subsongs consecutively, 0 or greater for the current sub-song index. + * \sa openmpt_module_get_num_subsongs, openmpt_module_select_subsong, openmpt_module_get_subsong_name + * \since 0.3.0 + */ +LIBOPENMPT_API int32_t openmpt_module_get_selected_subsong( openmpt_module * mod ); +/*! \brief Set Repeat Count + * + * \param mod The module handle to work on. + * \param repeat_count Repeat Count + * - -1: repeat forever + * - 0: play once, repeat zero times (the default) + * - n>0: play once and repeat n times after that + * \return 1 on success, 0 on failure. + * \sa openmpt_module_get_repeat_count + */ +LIBOPENMPT_API int openmpt_module_set_repeat_count( openmpt_module * mod, int32_t repeat_count ); +/*! \brief Get Repeat Count + * + * \param mod The module handle to work on. + * \return Repeat Count + * - -1: repeat forever + * - 0: play once, repeat zero times (the default) + * - n>0: play once and repeat n times after that + * \sa openmpt_module_set_repeat_count + */ +LIBOPENMPT_API int32_t openmpt_module_get_repeat_count( openmpt_module * mod ); + +/*! \brief approximate song duration + * + * \param mod The module handle to work on. + * \return Approximate duration of current sub-song in seconds. + */ +LIBOPENMPT_API double openmpt_module_get_duration_seconds( openmpt_module * mod ); + +/*! \brief Set approximate current song position + * + * \param mod The module handle to work on. + * \param seconds Seconds to seek to. If seconds is out of range, the position gets set to song start or end respectively. + * \return Approximate new song position in seconds. + * \sa openmpt_module_get_position_seconds + */ +LIBOPENMPT_API double openmpt_module_set_position_seconds( openmpt_module * mod, double seconds ); +/*! \brief Get current song position + * + * \param mod The module handle to work on. + * \return Current song position in seconds. + * \sa openmpt_module_set_position_seconds + */ +LIBOPENMPT_API double openmpt_module_get_position_seconds( openmpt_module * mod ); + +/*! \brief Set approximate current song position + * + * If order or row are out of range, to position is not modified and the current position is returned. + * \param mod The module handle to work on. + * \param order Pattern order number to seek to. + * \param row Pattern row number to seek to. + * \return Approximate new song position in seconds. + * \sa openmpt_module_set_position_seconds + * \sa openmpt_module_get_position_seconds + */ +LIBOPENMPT_API double openmpt_module_set_position_order_row( openmpt_module * mod, int32_t order, int32_t row ); + +/*! \brief Get render parameter + * + * \param mod The module handle to work on. + * \param param Parameter to query. See \ref openmpt_module_render_param + * \param value Pointer to the variable that receives the current value of the parameter. + * \return 1 on success, 0 on failure (invalid param or value is NULL). + * \sa OPENMPT_MODULE_RENDER_MASTERGAIN_MILLIBEL + * \sa OPENMPT_MODULE_RENDER_STEREOSEPARATION_PERCENT + * \sa OPENMPT_MODULE_RENDER_INTERPOLATIONFILTER_LENGTH + * \sa OPENMPT_MODULE_RENDER_VOLUMERAMPING_STRENGTH + * \sa openmpt_module_set_render_param + */ +LIBOPENMPT_API int openmpt_module_get_render_param( openmpt_module * mod, int param, int32_t * value ); +/*! \brief Set render parameter + * + * \param mod The module handle to work on. + * \param param Parameter to set. See \ref openmpt_module_render_param + * \param value The value to set param to. + * \return 1 on success, 0 on failure (invalid param). + * \sa OPENMPT_MODULE_RENDER_MASTERGAIN_MILLIBEL + * \sa OPENMPT_MODULE_RENDER_STEREOSEPARATION_PERCENT + * \sa OPENMPT_MODULE_RENDER_INTERPOLATIONFILTER_LENGTH + * \sa OPENMPT_MODULE_RENDER_VOLUMERAMPING_STRENGTH + * \sa openmpt_module_get_render_param + */ +LIBOPENMPT_API int openmpt_module_set_render_param( openmpt_module * mod, int param, int32_t value ); + +/*@{*/ +/*! \brief Render audio data + * + * \param mod The module handle to work on. + * \param samplerate Sample rate to render output. Should be in [8000,192000], but this is not enforced. + * \param count Number of audio frames to render per channel. + * \param mono Pointer to a buffer of at least count elements that receives the mono/center output. + * \return The number of frames actually rendered. + * \retval 0 The end of song has been reached. + * \remarks The output buffers are only written to up to the returned number of elements. + * \remarks You can freely switch between any of the "openmpt_module_read*" variants if you see a need to do so. libopenmpt tries to introduce as little switching annoyances as possible. Normally, you would only use a single one of these functions for rendering a particular module. + * \remarks It is recommended to use the floating point API because of the greater dynamic range and no implied clipping. + * \sa \ref libopenmpt_c_outputformat + */ +LIBOPENMPT_API size_t openmpt_module_read_mono( openmpt_module * mod, int32_t samplerate, size_t count, int16_t * mono ); +/*! \brief Render audio data + * + * \param mod The module handle to work on. + * \param samplerate Sample rate to render output. Should be in [8000,192000], but this is not enforced. + * \param count Number of audio frames to render per channel. + * \param left Pointer to a buffer of at least count elements that receives the left output. + * \param right Pointer to a buffer of at least count elements that receives the right output. + * \return The number of frames actually rendered. + * \retval 0 The end of song has been reached. + * \remarks The output buffers are only written to up to the returned number of elements. + * \remarks You can freely switch between any of the "openmpt_module_read*" variants if you see a need to do so. libopenmpt tries to introduce as little switching annoyances as possible. Normally, you would only use a single one of these functions for rendering a particular module. + * \remarks It is recommended to use the floating point API because of the greater dynamic range and no implied clipping. + * \sa \ref libopenmpt_c_outputformat + */ +LIBOPENMPT_API size_t openmpt_module_read_stereo( openmpt_module * mod, int32_t samplerate, size_t count, int16_t * left, int16_t * right ); +/*! \brief Render audio data + * + * \param mod The module handle to work on. + * \param samplerate Sample rate to render output. Should be in [8000,192000], but this is not enforced. + * \param count Number of audio frames to render per channel. + * \param left Pointer to a buffer of at least count elements that receives the left output. + * \param right Pointer to a buffer of at least count elements that receives the right output. + * \param rear_left Pointer to a buffer of at least count elements that receives the rear left output. + * \param rear_right Pointer to a buffer of at least count elements that receives the rear right output. + * \return The number of frames actually rendered. + * \retval 0 The end of song has been reached. + * \remarks The output buffers are only written to up to the returned number of elements. + * \remarks You can freely switch between any of the "openmpt_module_read*" variants if you see a need to do so. libopenmpt tries to introduce as little switching annoyances as possible. Normally, you would only use a single one of these functions for rendering a particular module. + * \remarks It is recommended to use the floating point API because of the greater dynamic range and no implied clipping. + * \sa \ref libopenmpt_c_outputformat + */ +LIBOPENMPT_API size_t openmpt_module_read_quad( openmpt_module * mod, int32_t samplerate, size_t count, int16_t * left, int16_t * right, int16_t * rear_left, int16_t * rear_right ); +/*! \brief Render audio data + * + * \param mod The module handle to work on. + * \param samplerate Sample rate to render output. Should be in [8000,192000], but this is not enforced. + * \param count Number of audio frames to render per channel. + * \param mono Pointer to a buffer of at least count elements that receives the mono/center output. + * \return The number of frames actually rendered. + * \retval 0 The end of song has been reached. + * \remarks The output buffers are only written to up to the returned number of elements. + * \remarks You can freely switch between any of the "openmpt_module_read*" variants if you see a need to do so. libopenmpt tries to introduce as little switching annoyances as possible. Normally, you would only use a single one of these functions for rendering a particular module. + * \remarks Floating point samples are in the [-1.0..1.0] nominal range. They are not clipped to that range though and thus might overshoot. + * \sa \ref libopenmpt_c_outputformat + */ +LIBOPENMPT_API size_t openmpt_module_read_float_mono( openmpt_module * mod, int32_t samplerate, size_t count, float * mono ); +/*! \brief Render audio data + * + * \param mod The module handle to work on. + * \param samplerate Sample rate to render output. Should be in [8000,192000], but this is not enforced. + * \param count Number of audio frames to render per channel. + * \param left Pointer to a buffer of at least count elements that receives the left output. + * \param right Pointer to a buffer of at least count elements that receives the right output. + * \return The number of frames actually rendered. + * \retval 0 The end of song has been reached. + * \remarks The output buffers are only written to up to the returned number of elements. + * \remarks You can freely switch between any of the "openmpt_module_read*" variants if you see a need to do so. libopenmpt tries to introduce as little switching annoyances as possible. Normally, you would only use a single one of these functions for rendering a particular module. + * \remarks Floating point samples are in the [-1.0..1.0] nominal range. They are not clipped to that range though and thus might overshoot. + * \sa \ref libopenmpt_c_outputformat + */ +LIBOPENMPT_API size_t openmpt_module_read_float_stereo( openmpt_module * mod, int32_t samplerate, size_t count, float * left, float * right ); +/*! \brief Render audio data + * + * \param mod The module handle to work on. + * \param samplerate Sample rate to render output. Should be in [8000,192000], but this is not enforced. + * \param count Number of audio frames to render per channel. + * \param left Pointer to a buffer of at least count elements that receives the left output. + * \param right Pointer to a buffer of at least count elements that receives the right output. + * \param rear_left Pointer to a buffer of at least count elements that receives the rear left output. + * \param rear_right Pointer to a buffer of at least count elements that receives the rear right output. + * \return The number of frames actually rendered. + * \retval 0 The end of song has been reached. + * \remarks The output buffers are only written to up to the returned number of elements. + * \remarks You can freely switch between any of the "openmpt_module_read*" variants if you see a need to do so. libopenmpt tries to introduce as little switching annoyances as possible. Normally, you would only use a single one of these functions for rendering a particular module. + * \remarks Floating point samples are in the [-1.0..1.0] nominal range. They are not clipped to that range though and thus might overshoot. + * \sa \ref libopenmpt_c_outputformat + */ +LIBOPENMPT_API size_t openmpt_module_read_float_quad( openmpt_module * mod, int32_t samplerate, size_t count, float * left, float * right, float * rear_left, float * rear_right ); +/*! \brief Render audio data + * + * \param mod The module handle to work on. + * \param samplerate Sample rate to render output. Should be in [8000,192000], but this is not enforced. + * \param count Number of audio frames to render per channel. + * \param interleaved_stereo Pointer to a buffer of at least count*2 elements that receives the interleaved stereo output in the order (L,R). + * \return The number of frames actually rendered. + * \retval 0 The end of song has been reached. + * \remarks The output buffers are only written to up to the returned number of elements. + * \remarks You can freely switch between any of the "openmpt_module_read*" variants if you see a need to do so. libopenmpt tries to introduce as little switching annoyances as possible. Normally, you would only use a single one of these functions for rendering a particular module. + * \remarks It is recommended to use the floating point API because of the greater dynamic range and no implied clipping. + * \sa \ref libopenmpt_c_outputformat + */ +LIBOPENMPT_API size_t openmpt_module_read_interleaved_stereo( openmpt_module * mod, int32_t samplerate, size_t count, int16_t * interleaved_stereo ); +/*! \brief Render audio data + * + * \param mod The module handle to work on. + * \param samplerate Sample rate to render output. Should be in [8000,192000], but this is not enforced. + * \param count Number of audio frames to render per channel. + * \param interleaved_quad Pointer to a buffer of at least count*4 elements that receives the interleaved suad surround output in the order (L,R,RL,RR). + * \return The number of frames actually rendered. + * \retval 0 The end of song has been reached. + * \remarks The output buffers are only written to up to the returned number of elements. + * \remarks You can freely switch between any of the "openmpt_module_read*" variants if you see a need to do so. libopenmpt tries to introduce as little switching annoyances as possible. Normally, you would only use a single one of these functions for rendering a particular module. + * \remarks It is recommended to use the floating point API because of the greater dynamic range and no implied clipping. + * \sa \ref libopenmpt_c_outputformat + */ +LIBOPENMPT_API size_t openmpt_module_read_interleaved_quad( openmpt_module * mod, int32_t samplerate, size_t count, int16_t * interleaved_quad ); +/*! \brief Render audio data + * + * \param mod The module handle to work on. + * \param samplerate Sample rate to render output. Should be in [8000,192000], but this is not enforced. + * \param count Number of audio frames to render per channel. + * \param interleaved_stereo Pointer to a buffer of at least count*2 elements that receives the interleaved stereo output in the order (L,R). + * \return The number of frames actually rendered. + * \retval 0 The end of song has been reached. + * \remarks The output buffers are only written to up to the returned number of elements. + * \remarks You can freely switch between any of the "openmpt_module_read*" variants if you see a need to do so. libopenmpt tries to introduce as little switching annoyances as possible. Normally, you would only use a single one of these functions for rendering a particular module. + * \remarks Floating point samples are in the [-1.0..1.0] nominal range. They are not clipped to that range though and thus might overshoot. + * \sa \ref libopenmpt_c_outputformat + */ +LIBOPENMPT_API size_t openmpt_module_read_interleaved_float_stereo( openmpt_module * mod, int32_t samplerate, size_t count, float * interleaved_stereo ); +/*! \brief Render audio data + * + * \param mod The module handle to work on. + * \param samplerate Sample rate to render output. Should be in [8000,192000], but this is not enforced. + * \param count Number of audio frames to render per channel. + * \param interleaved_quad Pointer to a buffer of at least count*4 elements that receives the interleaved suad surround output in the order (L,R,RL,RR). + * \return The number of frames actually rendered. + * \retval 0 The end of song has been reached. + * \remarks The output buffers are only written to up to the returned number of elements. + * \remarks You can freely switch between any of the "openmpt_module_read*" variants if you see a need to do so. libopenmpt tries to introduce as little switching annoyances as possible. Normally, you would only use a single one of these functions for rendering a particular module. + * \remarks Floating point samples are in the [-1.0..1.0] nominal range. They are not clipped to that range though and thus might overshoot. + * \sa \ref libopenmpt_c_outputformat +*/ +LIBOPENMPT_API size_t openmpt_module_read_interleaved_float_quad( openmpt_module * mod, int32_t samplerate, size_t count, float * interleaved_quad ); +/*@}*/ + +/*! \brief Get the list of supported metadata item keys + * + * \param mod The module handle to work on. + * \return Metadata item keys supported by openmpt_module_get_metadata, as a semicolon-separated list. + * \sa openmpt_module_get_metadata + */ +LIBOPENMPT_API const char * openmpt_module_get_metadata_keys( openmpt_module * mod ); +/*! \brief Get a metadata item value + * + * \param mod The module handle to work on. + * \param key Metadata item key to query. Use openmpt_module_get_metadata_keys to check for available keys. + * Possible keys are: + * - type: Module format extension (e.g. it) + * - type_long: Format name associated with the module format (e.g. Impulse Tracker) + * - originaltype: Module format extension (e.g. it) of the original module in case the actual type is a converted format (e.g. mo3 or gdm) + * - originaltype_long: Format name associated with the module format (e.g. Impulse Tracker) of the original module in case the actual type is a converted format (e.g. mo3 or gdm) + * - container: Container format the module file is embedded in, if any (e.g. umx) + * - container_long: Full container name if the module is embedded in a container (e.g. Unreal Music) + * - tracker: Tracker that was (most likely) used to save the module file, if known + * - artist: Author of the module + * - title: Module title + * - date: Date the module was last saved, in ISO-8601 format. + * - message: Song message. If the song message is empty or the module format does not support song messages, a list of instrument and sample names is returned instead. + * - message_raw: Song message. If the song message is empty or the module format does not support song messages, an empty string is returned. + * - warnings: A list of warnings that were generated while loading the module. + * \return The associated value for key. + * \sa openmpt_module_get_metadata_keys + */ +LIBOPENMPT_API const char * openmpt_module_get_metadata( openmpt_module * mod, const char * key ); + +/*! \brief Get the current speed + * + * \param mod The module handle to work on. + * \return The current speed in ticks per row. + */ +LIBOPENMPT_API int32_t openmpt_module_get_current_speed( openmpt_module * mod ); +/*! \brief Get the current tempo + * + * \param mod The module handle to work on. + * \return The current tempo in tracker units. The exact meaning of this value depends on the tempo mode being used. + */ +LIBOPENMPT_API int32_t openmpt_module_get_current_tempo( openmpt_module * mod ); +/*! \brief Get the current order + * + * \param mod The module handle to work on. + * \return The current order at which the module is being played back. + */ +LIBOPENMPT_API int32_t openmpt_module_get_current_order( openmpt_module * mod ); +/*! \brief Get the current pattern + * + * \param mod The module handle to work on. + * \return The current pattern that is being played. + */ +LIBOPENMPT_API int32_t openmpt_module_get_current_pattern( openmpt_module * mod ); +/*! \brief Get the current row + * + * \param mod The module handle to work on. + * \return The current row at which the current pattern is being played. + */ +LIBOPENMPT_API int32_t openmpt_module_get_current_row( openmpt_module * mod ); +/*! \brief Get the current amount of playing channels. + * + * \param mod The module handle to work on. + * \return The amount of sample channels that are currently being rendered. + */ +LIBOPENMPT_API int32_t openmpt_module_get_current_playing_channels( openmpt_module * mod ); + +/*! \brief Get an approximate indication of the channel volume. + * + * \param mod The module handle to work on. + * \param channel The channel whose volume should be retrieved. + * \return The approximate channel volume. + * \remarks The returned value is solely based on the note velocity and does not take the actual waveform of the playing sample into account. + */ +LIBOPENMPT_API float openmpt_module_get_current_channel_vu_mono( openmpt_module * mod, int32_t channel ); +/*! \brief Get an approximate indication of the channel volume on the front-left speaker. + * + * \param mod The module handle to work on. + * \param channel The channel whose volume should be retrieved. + * \return The approximate channel volume. + * \remarks The returned value is solely based on the note velocity and does not take the actual waveform of the playing sample into account. + */ +LIBOPENMPT_API float openmpt_module_get_current_channel_vu_left( openmpt_module * mod, int32_t channel ); +/*! \brief Get an approximate indication of the channel volume on the front-right speaker. + * + * \param mod The module handle to work on. + * \param channel The channel whose volume should be retrieved. + * \return The approximate channel volume. + * \remarks The returned value is solely based on the note velocity and does not take the actual waveform of the playing sample into account. + */ +LIBOPENMPT_API float openmpt_module_get_current_channel_vu_right( openmpt_module * mod, int32_t channel ); +/*! \brief Get an approximate indication of the channel volume on the rear-left speaker. + * + * \param mod The module handle to work on. + * \param channel The channel whose volume should be retrieved. + * \return The approximate channel volume. + * \remarks The returned value is solely based on the note velocity and does not take the actual waveform of the playing sample into account. + */ +LIBOPENMPT_API float openmpt_module_get_current_channel_vu_rear_left( openmpt_module * mod, int32_t channel ); +/*! \brief Get an approximate indication of the channel volume on the rear-right speaker. + * + * \param mod The module handle to work on. + * \param channel The channel whose volume should be retrieved. + * \return The approximate channel volume. + * \remarks The returned value is solely based on the note velocity and does not take the actual waveform of the playing sample into account. + */ +LIBOPENMPT_API float openmpt_module_get_current_channel_vu_rear_right( openmpt_module * mod, int32_t channel ); + +/*! \brief Get the number of sub-songs + * + * \param mod The module handle to work on. + * \return The number of sub-songs in the module. This includes any "hidden" songs (songs that share the same sequence, but start at different order indices) and "normal" sub-songs or "sequences" (if the format supports them). + * \sa openmpt_module_get_subsong_name, openmpt_module_select_subsong, openmpt_module_get_selected_subsong + */ +LIBOPENMPT_API int32_t openmpt_module_get_num_subsongs( openmpt_module * mod ); +/*! \brief Get the number of pattern channels + * + * \param mod The module handle to work on. + * \return The number of pattern channels in the module. Not all channels do necessarily contain data. + * \remarks The number of pattern channels is completely independent of the number of output channels. libopenmpt can render modules in mono, stereo or quad surround, but the choice of which of the three modes to use must not be made based on the return value of this function, which may be any positive integer amount. Only use this function for informational purposes. + */ +LIBOPENMPT_API int32_t openmpt_module_get_num_channels( openmpt_module * mod ); +/*! \brief Get the number of orders + * + * \param mod The module handle to work on. + * \return The number of orders in the current sequence of the module. + */ +LIBOPENMPT_API int32_t openmpt_module_get_num_orders( openmpt_module * mod ); +/*! \brief Get the number of patterns + * + * \param mod The module handle to work on. + * \return The number of distinct patterns in the module. + */ +LIBOPENMPT_API int32_t openmpt_module_get_num_patterns( openmpt_module * mod ); +/*! \brief Get the number of instruments + * + * \param mod The module handle to work on. + * \return The number of instrument slots in the module. Instruments are a layer on top of samples, and are not supported by all module formats. + */ +LIBOPENMPT_API int32_t openmpt_module_get_num_instruments( openmpt_module * mod ); +/*! \brief Get the number of samples + * + * \param mod The module handle to work on. + * \return The number of sample slots in the module. + */ +LIBOPENMPT_API int32_t openmpt_module_get_num_samples( openmpt_module * mod ); + +/*! \brief Get a sub-song name + * + * \param mod The module handle to work on. + * \param index The sub-song whose name should be retrieved + * \return The sub-song name. + * \sa openmpt_module_get_num_subsongs, openmpt_module_select_subsong, openmpt_module_get_selected_subsong + */ +LIBOPENMPT_API const char * openmpt_module_get_subsong_name( openmpt_module * mod, int32_t index ); +/*! \brief Get a channel name + * + * \param mod The module handle to work on. + * \param index The channel whose name should be retrieved + * \return The channel name. + * \sa openmpt_module_get_num_channels + */ +LIBOPENMPT_API const char * openmpt_module_get_channel_name( openmpt_module * mod, int32_t index ); +/*! \brief Get an order name + * + * \param mod The module handle to work on. + * \param index The order whose name should be retrieved + * \return The order name. + * \sa openmpt_module_get_num_orders + */ +LIBOPENMPT_API const char * openmpt_module_get_order_name( openmpt_module * mod, int32_t index ); +/*! \brief Get a pattern name + * + * \param mod The module handle to work on. + * \param index The pattern whose name should be retrieved + * \return The pattern name. + * \sa openmpt_module_get_num_patterns + */ +LIBOPENMPT_API const char * openmpt_module_get_pattern_name( openmpt_module * mod, int32_t index ); +/*! \brief Get an instrument name + * + * \param mod The module handle to work on. + * \param index The instrument whose name should be retrieved + * \return The instrument name. + * \sa openmpt_module_get_num_instruments + */ +LIBOPENMPT_API const char * openmpt_module_get_instrument_name( openmpt_module * mod, int32_t index ); +/*! \brief Get a sample name + * + * \param mod The module handle to work on. + * \param index The sample whose name should be retrieved + * \return The sample name. + * \sa openmpt_module_get_num_samples + */ +LIBOPENMPT_API const char * openmpt_module_get_sample_name( openmpt_module * mod, int32_t index ); + +/*! \brief Get pattern at order position + * + * \param mod The module handle to work on. + * \param order The order item whose pattern index should be retrieved. + * \return The pattern index found at the given order position of the current sequence. + */ +LIBOPENMPT_API int32_t openmpt_module_get_order_pattern( openmpt_module * mod, int32_t order ); +/*! \brief Get the number of rows in a pattern + * + * \param mod The module handle to work on. + * \param pattern The pattern whose row count should be retrieved. + * \return The number of rows in the given pattern. If the pattern does not exist, 0 is returned. + */ +LIBOPENMPT_API int32_t openmpt_module_get_pattern_num_rows( openmpt_module * mod, int32_t pattern ); + +/*! \brief Get raw pattern content + * + * \param mod The module handle to work on. + * \param pattern The pattern whose data should be retrieved. + * \param row The row from which the data should be retrieved. + * \param channel The channel from which the data should be retrieved. + * \param command The cell index at which the data should be retrieved. See \ref openmpt_module_command_index + * \return The internal, raw pattern data at the given pattern position. + */ +LIBOPENMPT_API uint8_t openmpt_module_get_pattern_row_channel_command( openmpt_module * mod, int32_t pattern, int32_t row, int32_t channel, int command ); + +/*! \brief Get formatted (human-readable) pattern content + * + * \param mod The module handle to work on. + * \param pattern The pattern whose data should be retrieved. + * \param row The row from which the data should be retrieved. + * \param channel The channel from which the data should be retrieved. + * \param command The cell index at which the data should be retrieved. + * \return The formatted pattern data at the given pattern position. See \ref openmpt_module_command_index + * \sa openmpt_module_highlight_pattern_row_channel_command + */ +LIBOPENMPT_API const char * openmpt_module_format_pattern_row_channel_command( openmpt_module * mod, int32_t pattern, int32_t row, int32_t channel, int command ); +/*! \brief Get highlighting information for formatted pattern content + * + * \param mod The module handle to work on. + * \param pattern The pattern whose data should be retrieved. + * \param row The row from which the data should be retrieved. + * \param channel The channel from which the data should be retrieved. + * \param command The cell index at which the data should be retrieved. See \ref openmpt_module_command_index + * \return The highlighting string for the formatted pattern data as retrieved by openmpt_module_get_pattern_row_channel_command at the given pattern position. + * \remarks The returned string will map each character position of the string returned by openmpt_module_get_pattern_row_channel_command to a highlighting instruction. + * Possible highlighting characters are: + * - " " : empty/space + * - "." : empty/dot + * - "n" : generic note + * - "m" : special note + * - "i" : generic instrument + * - "u" : generic volume column effect + * - "v" : generic volume column parameter + * - "e" : generic effect column effect + * - "f" : generic effect column parameter + * \sa openmpt_module_get_pattern_row_channel_command + */ +LIBOPENMPT_API const char * openmpt_module_highlight_pattern_row_channel_command( openmpt_module * mod, int32_t pattern, int32_t row, int32_t channel, int command ); + +/*! \brief Get formatted (human-readable) pattern content + * + * \param mod The module handle to work on. + * \param pattern The pattern whose data should be retrieved. + * \param row The row from which the data should be retrieved. + * \param channel The channel from which the data should be retrieved. + * \param width The maximum number of characters the string should contain. 0 means no limit. + * \param pad If true, the string will be resized to the exact length provided in the width parameter. + * \return The formatted pattern data at the given pattern position. + * \sa openmpt_module_highlight_pattern_row_channel + */ +LIBOPENMPT_API const char * openmpt_module_format_pattern_row_channel( openmpt_module * mod, int32_t pattern, int32_t row, int32_t channel, size_t width, int pad ); +/*! \brief Get highlighting information for formatted pattern content + * + * \param mod The module handle to work on. + * \param pattern The pattern whose data should be retrieved. + * \param row The row from which the data should be retrieved. + * \param channel The channel from which the data should be retrieved. + * \param width The maximum number of characters the string should contain. 0 means no limit. + * \param pad If true, the string will be resized to the exact length provided in the width parameter. + * \return The highlighting string for the formatted pattern data as retrieved by openmpt_module_format_pattern_row_channel at the given pattern position. + * \sa openmpt_module_format_pattern_row_channel + */ +LIBOPENMPT_API const char * openmpt_module_highlight_pattern_row_channel( openmpt_module * mod, int32_t pattern, int32_t row, int32_t channel, size_t width, int pad ); + +/*! \brief Retrieve supported ctl keys + * + * \param mod The module handle to work on. + * \return A semicolon-separated list containing all supported ctl keys. + * \remarks Currently supported ctl values are: + * - load.skip_samples: Set to "1" to avoid loading samples into memory + * - load.skip_patterns: Set to "1" to avoid loading patterns into memory + * - load.skip_plugins: Set to "1" to avoid loading plugins + * - load.skip_subsongs_init: Set to "1" to avoid pre-initializing sub-songs. Skipping results in faster module loading but slower seeking. + * - seek.sync_samples: Set to "1" to sync sample playback when using openmpt_module_set_position_seconds or openmpt_module_set_position_order_row. + * - subsong: The current subsong. Setting it has identical semantics as openmpt_module_select_subsong(), getting it returns the currently selected subsong. + * - play.at_end: Chooses the behaviour when the end of song is reached: + * - "fadeout": Fades the module out for a short while. Subsequent reads after the fadeout will return 0 rendered frames. + * - "continue": Returns 0 rendered frames when the song end is reached. Subsequent reads will continue playing from the song start or loop start. + * - "stop": Returns 0 rendered frames when the song end is reached. Subsequent reads will return 0 rendered frames. + * - play.tempo_factor: Set a floating point tempo factor. "1.0" is the default tempo. + * - play.pitch_factor: Set a floating point pitch factor. "1.0" is the default pitch. + * - render.resampler.emulate_amiga: Set to "1" to enable the Amiga resampler for Amiga modules. This emulates the sound characteristics of the Paula chip and overrides the selected interpolation filter. Non-Amiga module formats are not affected by this setting. + * - render.opl.volume_factor: Set volume factor applied to synthesized OPL sounds, relative to the default OPL volume. + * - dither: Set the dither algorithm that is used for the 16 bit versions of openmpt_module_read. Supported values are: + * - 0: No dithering. + * - 1: Default mode. Chosen by OpenMPT code, might change. + * - 2: Rectangular, 0.5 bit depth, no noise shaping (original ModPlug Tracker). + * - 3: Rectangular, 1 bit depth, simple 1st order noise shaping + */ +LIBOPENMPT_API const char * openmpt_module_get_ctls( openmpt_module * mod ); +/*! \brief Get current ctl value + * + * \param mod The module handle to work on. + * \param ctl The ctl key whose value should be retrieved. + * \return The associated ctl value, or NULL on failure. + * \sa openmpt_module_get_ctls + */ +LIBOPENMPT_API const char * openmpt_module_ctl_get( openmpt_module * mod, const char * ctl ); +/*! \brief Set ctl value + * + * \param mod The module handle to work on. + * \param ctl The ctl key whose value should be set. + * \param value The value that should be set. + * \return 1 if successful, 0 in case the value is not sensible (e.g. negative tempo factor) or the ctl is not recognized. + * \sa openmpt_module_get_ctls + */ +LIBOPENMPT_API int openmpt_module_ctl_set( openmpt_module * mod, const char * ctl, const char * value ); + +/* remember to add new functions to both C and C++ interfaces and to increase OPENMPT_API_VERSION_MINOR */ + +#ifdef __cplusplus +} +#endif + +/*! + * @} + */ + +#endif /* LIBOPENMPT_H */ + diff --git a/libs/libopenmpt/inc/libopenmpt/libopenmpt.hpp b/libs/libopenmpt/inc/libopenmpt/libopenmpt.hpp new file mode 100644 index 000000000..55097f830 --- /dev/null +++ b/libs/libopenmpt/inc/libopenmpt/libopenmpt.hpp @@ -0,0 +1,1015 @@ +/* + * libopenmpt.hpp + * -------------- + * Purpose: libopenmpt public c++ interface + * Notes : (currently none) + * Authors: OpenMPT Devs + * The OpenMPT source code is released under the BSD license. Read LICENSE for more details. + */ + +#ifndef LIBOPENMPT_HPP +#define LIBOPENMPT_HPP + +#include "libopenmpt_config.h" + +#include +#include +#include +#include +#include +#include + +#include + +/*! + * \page libopenmpt_cpp_overview C++ API + * + * \section libopenmpt_cpp_error Error Handling + * + * libopenmpt C++ uses C++ exception handling for errror reporting. + * + * Unless otherwise noted, any libopenmpt function may throw exceptions and + * all exceptions thrown by libopenmpt itself are derived from + * openmpt::exception. + * In addition, any libopenmpt function may also throw any exception specified + * by the C++ language and C++ standard library. These are all derived from + * std::exception. + * + * \section libopenmpt_cpp_strings Strings + * + * - All strings returned from libopenmpt are encoded in UTF-8. + * - All strings passed to libopenmpt should also be encoded in UTF-8. + * Behaviour in case of invalid UTF-8 is unspecified. + * - libopenmpt does not enforce or expect any particular Unicode + * normalization form. + * + * \section libopenmpt_cpp_fileio File I/O + * + * libopenmpt can use 3 different strategies for file I/O. + * + * - openmpt::module::module() with any kind of memory buffer as parameter will + * load the module from the provided memory buffer, which will require loading + * all data upfront by the library + * caller. + * - openmpt::module::module() with a seekable std::istream as parameter will + * load the module via the stream interface. libopenmpt will not implement an + * additional buffering layer in this case whih means the callbacks are assumed + * to be performant even with small i/o sizes. + * - openmpt::module::module() with an unseekable std::istream as parameter + * will load the module via the stream interface. libopempt will make an + * internal copy as it goes along, and sometimes have to pre-cache the whole + * file in case it needs to know the complete file size. This strategy is + * intended to be used if the file is located on a high latency network. + * + * | constructor | speed | memory consumption | + * | ----------------: | :----: | :----------------: | + * | memory buffer |

fast

|

medium

| + * | seekable stream |

slow

|

low

| + * | unseekable stream |

medium

|

high

| + * + * In all cases, the data or stream passed to the constructor is no longer + * needed after the openmpt::module has been constructed and can be destroyed + * by the caller. + * + * \section libopenmpt_cpp_outputformat Output Format + * + * libopenmpt supports a wide range of PCM output formats: + * [8000..192000]/[mono|stereo|quad]/[f32|i16]. + * + * Unless you have some very specific requirements demanding a particular aspect + * of the output format, you should always prefer 48000/stereo/f32 as the + * libopenmpt PCM format. + * + * - Please prefer 48000Hz unless the user explicitly demands something else. + * Practically all audio equipment and file formats use 48000Hz nowadays. + * - Practically all module formats are made for stereo output. Mono will not + * give you any measurable speed improvements and can trivially be obtained from + * the stereo output anyway. Quad is not expected by almost all modules and even + * if they do use surround effects, they expect the effects to be mixed to + * stereo. + * - Floating point output provides headroom instead of hard clipping if the + * module is louder than 0dBFs, will give you a better signal-to-noise ratio + * than int16 output, and avoid the need to apply an additional dithering to the + * output by libopenmpt. Unless your platform has no floating point unit at all, + * floating point will thus also be slightly faster. + * + * \section libopenmpt_cpp_threads libopenmpt in multi-threaded environments + * + * - libopenmpt is thread-aware. + * - Individual libopenmpt objects are not thread-safe. + * - libopenmpt itself does not spawn any user-visible threads but may spawn + * threads for internal use. + * - You must ensure to only ever access a particular libopenmpt object via + * non-const member functions from a single thread at a time. + * - You may access a particular libopenmpt objects concurrently from different + * threads when using only const member functions from all threads. + * - Consecutive accesses can happen from different threads. + * - Different objects can be accessed concurrently from different threads. + * + * \section libopenmpt-cpp-windows Windows support + * + * Using the libopenmpt C++ API when libopenmpt is compiled as a DLL on Windows + * requires `#define LIBOPENMPT_USE_DLL` (or some equivalent build system + * configuration) before `#include ` in order to + * correctly import the symbols from the DLL. + * + * \section libopenmpt-cpp-detailed Detailed documentation + * + * \ref libopenmpt_cpp + * + * \section libopenmpt_cpp_examples Example + * + * \include libopenmpt_example_cxx.cpp + * + */ + +/*! \defgroup libopenmpt_cpp libopenmpt C++ */ + +/*! \addtogroup libopenmpt_cpp + @{ +*/ + +namespace openmpt { + +#if defined(_MSC_VER) +#pragma warning(push) +#pragma warning(disable:4275) +#endif +//! libopenmpt exception base class +/*! + Base class used for all exceptions that are thrown by libopenmpt itself. Libopenmpt may additionally throw any exception thrown by the standard library which are all derived from std::exception. + \sa \ref libopenmpt_cpp_error +*/ +class LIBOPENMPT_CXX_API exception : public std::exception { +private: + char * text; +public: + exception( const std::string & text ) noexcept; + exception( const exception & other ) noexcept; + exception( exception && other ) noexcept; + exception & operator = ( const exception & other ) noexcept; + exception & operator = ( exception && other ) noexcept; + virtual ~exception() noexcept; + const char * what() const noexcept override; +}; // class exception +#if defined(_MSC_VER) +#pragma warning(pop) +#endif + +//! Get the libopenmpt version number +/*! + Returns the libopenmpt version number. + \return The value represents (major << 24 + minor << 16 + patch << 0). + \remarks libopenmpt < 0.3.0-pre used the following scheme: (major << 24 + minor << 16 + revision). +*/ +LIBOPENMPT_CXX_API std::uint32_t get_library_version(); + +//! Get the core version number +/*! + Return the OpenMPT core version number. + \return The value represents (majormajor << 24 + major << 16 + minor << 8 + minorminor). +*/ +LIBOPENMPT_CXX_API std::uint32_t get_core_version(); + +namespace string { + +//! Return a verbose library version string from openmpt::string::get(). \deprecated Please use `"library_version"` directly. +LIBOPENMPT_DEPRECATED static const char library_version LIBOPENMPT_ATTR_DEPRECATED [] = "library_version"; +//! Return a verbose library features string from openmpt::string::get(). \deprecated Please use `"library_features"` directly. +LIBOPENMPT_DEPRECATED static const char library_features LIBOPENMPT_ATTR_DEPRECATED [] = "library_features"; +//! Return a verbose OpenMPT core version string from openmpt::string::get(). \deprecated Please use `"core_version"` directly. +LIBOPENMPT_DEPRECATED static const char core_version LIBOPENMPT_ATTR_DEPRECATED [] = "core_version"; +//! Return information about the current build (e.g. the build date or compiler used) from openmpt::string::get(). \deprecated Please use `"build"` directly. +LIBOPENMPT_DEPRECATED static const char build LIBOPENMPT_ATTR_DEPRECATED [] = "build"; +//! Return all contributors from openmpt::string::get(). \deprecated Please use `"credits"` directly. +LIBOPENMPT_DEPRECATED static const char credits LIBOPENMPT_ATTR_DEPRECATED [] = "credits"; +//! Return contact information about libopenmpt from openmpt::string::get(). \deprecated Please use `"contact"` directly. +LIBOPENMPT_DEPRECATED static const char contact LIBOPENMPT_ATTR_DEPRECATED [] = "contact"; +//! Return the libopenmpt license from openmpt::string::get(). \deprecated Please use `"license"` directly. +LIBOPENMPT_DEPRECATED static const char license LIBOPENMPT_ATTR_DEPRECATED [] = "license"; + +//! Get library related metadata. +/*! + \param key Key to query. + Possible keys are: + - "library_version": verbose library version string + - "library_version_major": libopenmpt major version number + - "library_version_minor": libopenmpt minor version number + - "library_version_patch": libopenmpt patch version number + - "library_version_prerel": libopenmpt pre-release version string + - "library_version_is_release": "1" if the version is an officially released version + - "library_features": verbose library features string + - "core_version": verbose OpenMPT core version string + - "source_url": original source code URL + - "source_date": original source code date + - "source_revision": original source code revision + - "source_is_modified": "1" if the original source has been modified + - "source_has_mixed_revisions": "1" if the original source has been compiled from different various revision + - "source_is_package": "1" if the original source has been obtained from a source pacakge instead of source code version control + - "build": information about the current build (e.g. the build date or compiler used) + - "build_compiler": information about the compiler used to build libopenmpt + - "credits": all contributors + - "contact": contact information about libopenmpt + - "license": the libopenmpt license + - "url": libopenmpt website URL + - "support_forum_url": libopenmpt support and discussions forum URL + - "bugtracker_url": libopenmpt bug and issue tracker URL + + \return A (possibly multi-line) string containing the queried information. If no information is available, the string is empty. +*/ +LIBOPENMPT_CXX_API std::string get( const std::string & key ); + +} // namespace string + +//! Get a list of supported file extensions +/*! + \return The list of extensions supported by this libopenmpt build. The extensions are returned lower-case without a leading dot. +*/ +LIBOPENMPT_CXX_API std::vector get_supported_extensions(); + +//! Query whether a file extension is supported +/*! + \param extension file extension to query without a leading dot. The case is ignored. + \return true if the extension is supported by libopenmpt, false otherwise. +*/ +LIBOPENMPT_CXX_API bool is_extension_supported( const std::string & extension ); + +//! Roughly scan the input stream to find out whether libopenmpt might be able to open it +/*! + \param stream Input stream to scan. + \param effort Effort to make when validating stream. Effort 0.0 does not even look at stream at all and effort 1.0 completely loads the file from stream. A lower effort requires less data to be loaded but only gives a rough estimate answer. Use an effort of 0.25 to only verify the header data of the module file. + \param log Log where warning and errors are written. + \return Probability between 0.0 and 1.0. + \remarks openmpt::probe_file_header() provides a simpler and faster interface that fits almost all use cases better. It is recommended to use openmpt::probe_file_header() instead of openmpt::could_open_probability(). + \remarks openmpt::could_open_probability() can return any value between 0.0 and 1.0. Only 0.0 and 1.0 are definitive answers, all values in between are just estimates. In general, any return value >0.0 means that you should try loading the file, and any value below 1.0 means that loading may fail. If you want a threshold above which you can be reasonably sure that libopenmpt will be able to load the file, use >=0.5. If you see the need for a threshold below which you could reasonably outright reject a file, use <0.25 (Note: Such a threshold for rejecting on the lower end is not recommended, but may be required for better integration into some other framework's probe scoring.). + \remarks openmpt::could_open_probability() expects the complete file data to be eventually available to it, even if it is asked to just parse the header. Verification will be unreliable (both false positives and false negatives), if you pretend that the file is just some few bytes of initial data threshold in size. In order to really just access the first bytes of a file, check in your std::istream implementation whether data or seeking is requested beyond your initial data threshold, and in that case, return an error. openmpt::could_open_probability() will treat this as any other I/O error and return 0.0. You must not expect the correct result in this case. You instead must remember that it asked for more data than you currently want to provide to it and treat this situation as if openmpt::could_open_probability() returned 0.5. + \sa \ref libopenmpt_c_fileio + \sa openmpt::probe_file_header() + \since 0.3.0 +*/ +LIBOPENMPT_CXX_API double could_open_probability( std::istream & stream, double effort = 1.0, std::ostream & log = std::clog ); + +//! Roughly scan the input stream to find out whether libopenmpt might be able to open it +/*! + \deprecated Please use openmpt::module::could_open_probability(). +*/ +LIBOPENMPT_ATTR_DEPRECATED LIBOPENMPT_CXX_API LIBOPENMPT_DEPRECATED double could_open_propability( std::istream & stream, double effort = 1.0, std::ostream & log = std::clog ); + +//! Get recommended header size for successfull format probing +/*! + \sa openmpt::probe_file_header() + \since 0.3.0 +*/ +LIBOPENMPT_CXX_API std::size_t probe_file_header_get_recommended_size(); + +//! Probe for module formats in openmpt::probe_file_header(). \since 0.3.0 +static const std::uint64_t probe_file_header_flags_modules = 0x1ul; + +//! Probe for module-specific container formats in openmpt::probe_file_header(). \since 0.3.0 +static const std::uint64_t probe_file_header_flags_containers = 0x2ul; + +//! Probe for the default set of formats in openmpt::probe_file_header(). \since 0.3.0 +static const std::uint64_t probe_file_header_flags_default = probe_file_header_flags_modules | probe_file_header_flags_containers; + +//! Probe for no formats in openmpt::probe_file_header(). \since 0.3.0 +static const std::uint64_t probe_file_header_flags_none = 0x0ul; + +//! Possible return values for openmpt::probe_file_header(). \since 0.3.0 +enum probe_file_header_result { + probe_file_header_result_success = 1, + probe_file_header_result_failure = 0, + probe_file_header_result_wantmoredata = -1 +}; + +//! Probe the provided bytes from the beginning of a file for supported file format headers to find out whether libopenmpt might be able to open it +/*! + \param flags Ored mask of openmpt::probe_file_header_flags_modules and openmpt::probe_file_header_flags_containers, or openmpt::probe_file_header_flags_default. + \param data Beginning of the file data. + \param size Size of the beginning of the file data. + \param filesize Full size of the file data on disk. + \remarks It is recommended to provide openmpt::probe_file_header_get_recommended_size() bytes of data for data and size. If the file is smaller, only provide the filesize amount and set size and filesize to the file's size. + \remarks openmpt::could_open_probability() provides a more elaborate interface that might be required for special use cases. It is recommended to use openmpt::probe_file_header() though, if possible. + \retval probe_file_header_result_success The file will most likely be supported by libopenmpt. + \retval probe_file_header_result_failure The file is not supported by libopenmpt. + \retval probe_file_header_result_wantmoredata An answer could not be determined with the amount of data provided. + \sa openmpt::probe_file_header_get_recommended_size() + \sa openmpt::could_open_probability() + \since 0.3.0 +*/ +LIBOPENMPT_CXX_API int probe_file_header( std::uint64_t flags, const std::uint8_t * data, std::size_t size, std::uint64_t filesize ); + +//! Probe the provided bytes from the beginning of a file for supported file format headers to find out whether libopenmpt might be able to open it +/*! + \param flags Ored mask of openmpt::probe_file_header_flags_modules and openmpt::probe_file_header_flags_containers, or openmpt::probe_file_header_flags_default. + \param data Beginning of the file data. + \param size Size of the beginning of the file data. + \remarks It is recommended to use the overload of this function that also takes the filesize as parameter if at all possile. libopenmpt can provide more accurate answers if the filesize is known. + \remarks It is recommended to provide openmpt::probe_file_header_get_recommended_size() bytes of data for data and size. If the file is smaller, only provide the filesize amount and set size to the file's size. + \remarks openmpt::could_open_probability() provides a more elaborate interface that might be required for special use cases. It is recommended to use openmpt::probe_file_header() though, if possible. + \retval probe_file_header_result_success The file will most likely be supported by libopenmpt. + \retval probe_file_header_result_failure The file is not supported by libopenmpt. + \retval probe_file_header_result_wantmoredata An answer could not be determined with the amount of data provided. + \sa openmpt::probe_file_header_get_recommended_size() + \sa openmpt::could_open_probability() + \since 0.3.0 +*/ +LIBOPENMPT_CXX_API int probe_file_header( std::uint64_t flags, const std::uint8_t * data, std::size_t size ); + +//! Probe the provided bytes from the beginning of a file for supported file format headers to find out whether libopenmpt might be able to open it +/*! + \param flags Ored mask of openmpt::probe_file_header_flags_modules and openmpt::probe_file_header_flags_containers, or openmpt::probe_file_header_flags_default. + \param stream Input stream to scan. + \remarks stream is left in an unspecified state when this function returns. + \remarks openmpt::could_open_probability() provides a more elaborate interface that might be required for special use cases. It is recommended to use openmpt::probe_file_header() though, if possible. + \retval probe_file_header_result_success The file will most likely be supported by libopenmpt. + \retval probe_file_header_result_failure The file is not supported by libopenmpt. + \retval probe_file_header_result_wantmoredata An answer could not be determined with the amount of data provided. + \sa openmpt::probe_file_header_get_recommended_size() + \sa openmpt::could_open_probability() + \since 0.3.0 +*/ +LIBOPENMPT_CXX_API int probe_file_header( std::uint64_t flags, std::istream & stream ); + +class module_impl; + +class module_ext; + +namespace detail { + +typedef std::map< std::string, std::string > initial_ctls_map; + +} // namespace detail + +class LIBOPENMPT_CXX_API module { + + friend class module_ext; + +public: + + //! Parameter index to use with openmpt::module::get_render_param and openmpt::module::set_render_param + enum render_param { + //! Master Gain + /*! + The related value represents a relative gain in milliBel.\n + The default value is 0.\n + The supported value range is unlimited.\n + */ + RENDER_MASTERGAIN_MILLIBEL = 1, + //! Stereo Separation + /*! + The related value represents the stereo separation generated by the libopenmpt mixer in percent.\n + The default value is 100.\n + The supported value range is [0,200].\n + */ + RENDER_STEREOSEPARATION_PERCENT = 2, + //! Interpolation Filter + /*! + The related value represents the interpolation filter length used by the libopenmpt mixer.\n + The default value is 0, which indicates a recommended default value.\n + The supported value range is [0,inf). Values greater than the implementation limit are clamped to the maximum supported value.\n + Currently supported values: + - 0: internal default + - 1: no interpolation (zero order hold) + - 2: linear interpolation + - 4: cubic interpolation + - 8: windowed sinc with 8 taps + */ + RENDER_INTERPOLATIONFILTER_LENGTH = 3, + //! Volume Ramping Strength + /*! + The related value represents the amount of volume ramping done by the libopenmpt mixer.\n + The default value is -1, which indicates a recommended default value.\n + The meaningful value range is [-1..10].\n + A value of 0 completely disables volume ramping. This might cause clicks in sound output.\n + Higher values imply slower/softer volume ramps. + */ + RENDER_VOLUMERAMPING_STRENGTH = 4 + }; + + //! Parameter index to use with openmpt::module::get_pattern_row_channel_command, openmpt::module::format_pattern_row_channel_command and openmpt::module::highlight_pattern_row_channel_command + enum command_index { + command_note = 0, + command_instrument = 1, + command_volumeffect = 2, + command_effect = 3, + command_volume = 4, + command_parameter = 5 + }; + +private: + module_impl * impl; +private: + // non-copyable + module( const module & ); + void operator = ( const module & ); +private: + // for module_ext + module(); + void set_impl( module_impl * i ); +public: + //! Construct an openmpt::module + /*! + \param stream Input stream from which the module is loaded. After the constructor has finished successfully, the input position of stream is set to the byte after the last byte that has been read. If the constructor fails, the state of the input position of stream is undefined. + \param log Log where any warnings or errors are printed to. The lifetime of the reference has to be as long as the lifetime of the module instance. + \param ctls A map of initial ctl values, see openmpt::module::get_ctls. + \throws openmpt::exception Throws an exception derived from openmpt::exception in case the provided file cannot be opened. + \remarks The input data can be discarded after an openmpt::module has been constructed successfully. + \sa \ref libopenmpt_cpp_fileio + */ + module( std::istream & stream, std::ostream & log = std::clog, const std::map< std::string, std::string > & ctls = detail::initial_ctls_map() ); + /*! + \param data Data to load the module from. + \param log Log where any warnings or errors are printed to. The lifetime of the reference has to be as long as the lifetime of the module instance. + \param ctls A map of initial ctl values, see openmpt::module::get_ctls. + \throws openmpt::exception Throws an exception derived from openmpt::exception in case the provided file cannot be opened. + \remarks The input data can be discarded after an openmpt::module has been constructed successfully. + \sa \ref libopenmpt_cpp_fileio + */ + module( const std::vector & data, std::ostream & log = std::clog, const std::map< std::string, std::string > & ctls = detail::initial_ctls_map() ); + /*! + \param beg Begin of data to load the module from. + \param end End of data to load the module from. + \param log Log where any warnings or errors are printed to. The lifetime of the reference has to be as long as the lifetime of the module instance. + \param ctls A map of initial ctl values, see openmpt::module::get_ctls. + \throws openmpt::exception Throws an exception derived from openmpt::exception in case the provided file cannot be opened. + \remarks The input data can be discarded after an openmpt::module has been constructed successfully. + \sa \ref libopenmpt_cpp_fileio + */ + module( const std::uint8_t * beg, const std::uint8_t * end, std::ostream & log = std::clog, const std::map< std::string, std::string > & ctls = detail::initial_ctls_map() ); + /*! + \param data Data to load the module from. + \param size Amount of data available. + \param log Log where any warnings or errors are printed to. The lifetime of the reference has to be as long as the lifetime of the module instance. + \param ctls A map of initial ctl values, see openmpt::module::get_ctls. + \throws openmpt::exception Throws an exception derived from openmpt::exception in case the provided file cannot be opened. + \remarks The input data can be discarded after an openmpt::module has been constructed successfully. + \sa \ref libopenmpt_cpp_fileio + */ + module( const std::uint8_t * data, std::size_t size, std::ostream & log = std::clog, const std::map< std::string, std::string > & ctls = detail::initial_ctls_map() ); + /*! + \param data Data to load the module from. + \param log Log where any warnings or errors are printed to. The lifetime of the reference has to be as long as the lifetime of the module instance. + \param ctls A map of initial ctl values, see openmpt::module::get_ctls. + \throws openmpt::exception Throws an exception derived from openmpt::exception in case the provided file cannot be opened. + \remarks The input data can be discarded after an openmpt::module has been constructed successfully. + \sa \ref libopenmpt_cpp_fileio + */ + module( const std::vector & data, std::ostream & log = std::clog, const std::map< std::string, std::string > & ctls = detail::initial_ctls_map() ); + /*! + \param beg Begin of data to load the module from. + \param end End of data to load the module from. + \param log Log where any warnings or errors are printed to. The lifetime of the reference has to be as long as the lifetime of the module instance. + \param ctls A map of initial ctl values, see openmpt::module::get_ctls. + \throws openmpt::exception Throws an exception derived from openmpt::exception in case the provided file cannot be opened. + \remarks The input data can be discarded after an openmpt::module has been constructed successfully. + \sa \ref libopenmpt_cpp_fileio + */ + module( const char * beg, const char * end, std::ostream & log = std::clog, const std::map< std::string, std::string > & ctls = detail::initial_ctls_map() ); + /*! + \param data Data to load the module from. + \param size Amount of data available. + \param log Log where any warnings or errors are printed to. The lifetime of the reference has to be as long as the lifetime of the module instance. + \param ctls A map of initial ctl values, see openmpt::module::get_ctls. + \throws openmpt::exception Throws an exception derived from openmpt::exception in case the provided file cannot be opened. + \remarks The input data can be discarded after an openmpt::module has been constructed successfully. + \sa \ref libopenmpt_cpp_fileio + */ + module( const char * data, std::size_t size, std::ostream & log = std::clog, const std::map< std::string, std::string > & ctls = detail::initial_ctls_map() ); + /*! + \param data Data to load the module from. + \param size Amount of data available. + \param log Log where any warnings or errors are printed to. The lifetime of the reference has to be as long as the lifetime of the module instance. + \param ctls A map of initial ctl values, see openmpt::module::get_ctls. + \throws openmpt::exception Throws an exception derived from openmpt::exception in case the provided file cannot be opened. + \remarks The input data can be discarded after an openmpt::module has been constructed successfully. + \sa \ref libopenmpt_cpp_fileio + */ + module( const void * data, std::size_t size, std::ostream & log = std::clog, const std::map< std::string, std::string > & ctls = detail::initial_ctls_map() ); + virtual ~module(); +public: + + //! Select a sub-song from a multi-song module + /*! + \param subsong Index of the sub-song. -1 plays all sub-songs consecutively. + \throws openmpt::exception Throws an exception derived from openmpt::exception if sub-song is not in range [-1,openmpt::module::get_num_subsongs()[ + \sa openmpt::module::get_num_subsongs, openmpt::module::get_selected_subsong, openmpt::module::get_subsong_names + \remarks Whether subsong -1 (all subsongs consecutively), subsong 0 or some other subsong is selected by default, is an implementation detail and subject to change. If you do not want to care about subsongs, it is recommended to just not call openmpt::module::select_subsong() at all. + */ + void select_subsong( std::int32_t subsong ); + //! Get currently selected sub-song from a multi-song module + /*! + \return Currently selected sub-song. -1 for all subsongs consecutively, 0 or greater for the current sub-song index. + \sa openmpt::module::get_num_subsongs, openmpt::module::select_subsong, openmpt::module::get_subsong_names + \since 0.3.0 + */ + std::int32_t get_selected_subsong() const; + //! Set Repeat Count + /*! + \param repeat_count Repeat Count + - -1: repeat forever + - 0: play once, repeat zero times (the default) + - n>0: play once and repeat n times after that + \sa openmpt::module::get_repeat_count + */ + void set_repeat_count( std::int32_t repeat_count ); + //! Get Repeat Count + /*! + \return Repeat Count + - -1: repeat forever + - 0: play once, repeat zero times (the default) + - n>0: play once and repeat n times after that + \sa openmpt::module::set_repeat_count + */ + std::int32_t get_repeat_count() const; + + //! Get approximate song duration + /*! + \return Approximate duration of current sub-song in seconds. + */ + double get_duration_seconds() const; + + //! Set approximate current song position + /*! + \param seconds Seconds to seek to. If seconds is out of range, the position gets set to song start or end respectively. + \return Approximate new song position in seconds. + \sa openmpt::module::get_position_seconds + */ + double set_position_seconds( double seconds ); + //! Get current song position + /*! + \return Current song position in seconds. + \sa openmpt::module::set_position_seconds + */ + double get_position_seconds() const; + + //! Set approximate current song position + /*! + If order or row are out of range, to position is not modified and the current position is returned. + \param order Pattern order number to seek to. + \param row Pattern row number to seek to. + \return Approximate new song position in seconds. + \sa openmpt::module::set_position_seconds + \sa openmpt::module::get_position_seconds + */ + double set_position_order_row( std::int32_t order, std::int32_t row ); + + //! Get render parameter + /*! + \param param Parameter to query. See openmpt::module::render_param. + \return The current value of the parameter. + \throws openmpt::exception Throws an exception derived from openmpt::exception if param is invalid. + \sa openmpt::module::render_param + \sa openmpt::module::set_render_param + */ + std::int32_t get_render_param( int param ) const; + //! Set render parameter + /*! + \param param Parameter to set. See openmpt::module::render_param. + \param value The value to set param to. + \throws openmpt::exception Throws an exception derived from openmpt::exception if param is invalid or value is out of range. + \sa openmpt::module::render_param + \sa openmpt::module::get_render_param + */ + void set_render_param( int param, std::int32_t value ); + + /*@{*/ + //! Render audio data + /*! + \param samplerate Sample rate to render output. Should be in [8000,192000], but this is not enforced. + \param count Number of audio frames to render per channel. + \param mono Pointer to a buffer of at least count elements that receives the mono/center output. + \return The number of frames actually rendered. + \retval 0 The end of song has been reached. + \remarks The output buffers are only written to up to the returned number of elements. + \remarks You can freely switch between any of the "read*" variants if you see a need to do so. libopenmpt tries to introduce as little switching annoyances as possible. Normally, you would only use a single one of these functions for rendering a particular module. + \remarks It is recommended to use the floating point API because of the greater dynamic range and no implied clipping. + \sa \ref libopenmpt_cpp_outputformat + */ + std::size_t read( std::int32_t samplerate, std::size_t count, std::int16_t * mono ); + //! Render audio data + /*! + \param samplerate Sample rate to render output. Should be in [8000,192000], but this is not enforced. + \param count Number of audio frames to render per channel. + \param left Pointer to a buffer of at least count elements that receives the left output. + \param right Pointer to a buffer of at least count elements that receives the right output. + \return The number of frames actually rendered. + \retval 0 The end of song has been reached. + \remarks The output buffers are only written to up to the returned number of elements. + \remarks You can freely switch between any of the "read*" variants if you see a need to do so. libopenmpt tries to introduce as little switching annoyances as possible. Normally, you would only use a single one of these functions for rendering a particular module. + \remarks It is recommended to use the floating point API because of the greater dynamic range and no implied clipping. + \sa \ref libopenmpt_cpp_outputformat + */ + std::size_t read( std::int32_t samplerate, std::size_t count, std::int16_t * left, std::int16_t * right ); + //! Render audio data + /*! + \param samplerate Sample rate to render output. Should be in [8000,192000], but this is not enforced. + \param count Number of audio frames to render per channel. + \param left Pointer to a buffer of at least count elements that receives the left output. + \param right Pointer to a buffer of at least count elements that receives the right output. + \param rear_left Pointer to a buffer of at least count elements that receives the rear left output. + \param rear_right Pointer to a buffer of at least count elements that receives the rear right output. + \return The number of frames actually rendered. + \retval 0 The end of song has been reached. + \remarks The output buffers are only written to up to the returned number of elements. + \remarks You can freely switch between any of the "read*" variants if you see a need to do so. libopenmpt tries to introduce as little switching annoyances as possible. Normally, you would only use a single one of these functions for rendering a particular module. + \remarks It is recommended to use the floating point API because of the greater dynamic range and no implied clipping. + \sa \ref libopenmpt_cpp_outputformat + */ + std::size_t read( std::int32_t samplerate, std::size_t count, std::int16_t * left, std::int16_t * right, std::int16_t * rear_left, std::int16_t * rear_right ); + //! Render audio data + /*! + \param samplerate Sample rate to render output. Should be in [8000,192000], but this is not enforced. + \param count Number of audio frames to render per channel. + \param mono Pointer to a buffer of at least count elements that receives the mono/center output. + \return The number of frames actually rendered. + \retval 0 The end of song has been reached. + \remarks The output buffers are only written to up to the returned number of elements. + \remarks You can freely switch between any of the "read*" variants if you see a need to do so. libopenmpt tries to introduce as little switching annoyances as possible. Normally, you would only use a single one of these functions for rendering a particular module. + \remarks Floating point samples are in the [-1.0..1.0] nominal range. They are not clipped to that range though and thus might overshoot. + \sa \ref libopenmpt_cpp_outputformat + */ + std::size_t read( std::int32_t samplerate, std::size_t count, float * mono ); + //! Render audio data + /*! + \param samplerate Sample rate to render output. Should be in [8000,192000], but this is not enforced. + \param count Number of audio frames to render per channel. + \param left Pointer to a buffer of at least count elements that receives the left output. + \param right Pointer to a buffer of at least count elements that receives the right output. + \return The number of frames actually rendered. + \retval 0 The end of song has been reached. + \remarks The output buffers are only written to up to the returned number of elements. + \remarks You can freely switch between any of the "read*" variants if you see a need to do so. libopenmpt tries to introduce as little switching annoyances as possible. Normally, you would only use a single one of these functions for rendering a particular module. + \remarks Floating point samples are in the [-1.0..1.0] nominal range. They are not clipped to that range though and thus might overshoot. + \sa \ref libopenmpt_cpp_outputformat + */ + std::size_t read( std::int32_t samplerate, std::size_t count, float * left, float * right ); + //! Render audio data + /*! + \param samplerate Sample rate to render output. Should be in [8000,192000], but this is not enforced. + \param count Number of audio frames to render per channel. + \param left Pointer to a buffer of at least count elements that receives the left output. + \param right Pointer to a buffer of at least count elements that receives the right output. + \param rear_left Pointer to a buffer of at least count elements that receives the rear left output. + \param rear_right Pointer to a buffer of at least count elements that receives the rear right output. + \return The number of frames actually rendered. + \retval 0 The end of song has been reached. + \remarks The output buffers are only written to up to the returned number of elements. + \remarks You can freely switch between any of the "read*" variants if you see a need to do so. libopenmpt tries to introduce as little switching annoyances as possible. Normally, you would only use a single one of these functions for rendering a particular module. + \remarks Floating point samples are in the [-1.0..1.0] nominal range. They are not clipped to that range though and thus might overshoot. + \sa \ref libopenmpt_cpp_outputformat + */ + std::size_t read( std::int32_t samplerate, std::size_t count, float * left, float * right, float * rear_left, float * rear_right ); + //! Render audio data + /*! + \param samplerate Sample rate to render output. Should be in [8000,192000], but this is not enforced. + \param count Number of audio frames to render per channel. + \param interleaved_stereo Pointer to a buffer of at least count*2 elements that receives the interleaved stereo output in the order (L,R). + \return The number of frames actually rendered. + \retval 0 The end of song has been reached. + \remarks The output buffers are only written to up to the returned number of elements. + \remarks You can freely switch between any of the "read*" variants if you see a need to do so. libopenmpt tries to introduce as little switching annoyances as possible. Normally, you would only use a single one of these functions for rendering a particular module. + \remarks It is recommended to use the floating point API because of the greater dynamic range and no implied clipping. + \sa \ref libopenmpt_cpp_outputformat + */ + std::size_t read_interleaved_stereo( std::int32_t samplerate, std::size_t count, std::int16_t * interleaved_stereo ); + //! Render audio data + /*! + \param samplerate Sample rate to render output. Should be in [8000,192000], but this is not enforced. + \param count Number of audio frames to render per channel. + \param interleaved_quad Pointer to a buffer of at least count*4 elements that receives the interleaved suad surround output in the order (L,R,RL,RR). + \return The number of frames actually rendered. + \retval 0 The end of song has been reached. + \remarks The output buffers are only written to up to the returned number of elements. + \remarks You can freely switch between any of the "read*" variants if you see a need to do so. libopenmpt tries to introduce as little switching annoyances as possible. Normally, you would only use a single one of these functions for rendering a particular module. + \remarks It is recommended to use the floating point API because of the greater dynamic range and no implied clipping. + \sa \ref libopenmpt_cpp_outputformat + */ + std::size_t read_interleaved_quad( std::int32_t samplerate, std::size_t count, std::int16_t * interleaved_quad ); + //! Render audio data + /*! + \param samplerate Sample rate to render output. Should be in [8000,192000], but this is not enforced. + \param count Number of audio frames to render per channel. + \param interleaved_stereo Pointer to a buffer of at least count*2 elements that receives the interleaved stereo output in the order (L,R). + \return The number of frames actually rendered. + \retval 0 The end of song has been reached. + \remarks The output buffers are only written to up to the returned number of elements. + \remarks You can freely switch between any of the "read*" variants if you see a need to do so. libopenmpt tries to introduce as little switching annoyances as possible. Normally, you would only use a single one of these functions for rendering a particular module. + \remarks Floating point samples are in the [-1.0..1.0] nominal range. They are not clipped to that range though and thus might overshoot. + \sa \ref libopenmpt_cpp_outputformat + */ + std::size_t read_interleaved_stereo( std::int32_t samplerate, std::size_t count, float * interleaved_stereo ); + //! Render audio data + /*! + \param samplerate Sample rate to render output. Should be in [8000,192000], but this is not enforced. + \param count Number of audio frames to render per channel. + \param interleaved_quad Pointer to a buffer of at least count*4 elements that receives the interleaved suad surround output in the order (L,R,RL,RR). + \return The number of frames actually rendered. + \retval 0 The end of song has been reached. + \remarks The output buffers are only written to up to the returned number of elements. + \remarks You can freely switch between any of the "read*" variants if you see a need to do so. libopenmpt tries to introduce as little switching annoyances as possible. Normally, you would only use a single one of these functions for rendering a particular module. + \remarks Floating point samples are in the [-1.0..1.0] nominal range. They are not clipped to that range though and thus might overshoot. + \sa \ref libopenmpt_cpp_outputformat + */ + std::size_t read_interleaved_quad( std::int32_t samplerate, std::size_t count, float * interleaved_quad ); + /*@}*/ + + //! Get the list of supported metadata item keys + /*! + \return Metadata item keys supported by openmpt::module::get_metadata + \sa openmpt::module::get_metadata + */ + std::vector get_metadata_keys() const; + //! Get a metadata item value + /*! + \param key Metadata item key to query. Use openmpt::module::get_metadata_keys to check for available keys. + Possible keys are: + - type: Module format extension (e.g. it) + - type_long: Format name associated with the module format (e.g. Impulse Tracker) + - originaltype: Module format extension (e.g. it) of the original module in case the actual type is a converted format (e.g. mo3 or gdm) + - originaltype_long: Format name associated with the module format (e.g. Impulse Tracker) of the original module in case the actual type is a converted format (e.g. mo3 or gdm) + - container: Container format the module file is embedded in, if any (e.g. umx) + - container_long: Full container name if the module is embedded in a container (e.g. Unreal Music) + - tracker: Tracker that was (most likely) used to save the module file, if known + - artist: Author of the module + - title: Module title + - date: Date the module was last saved, in ISO-8601 format. + - message: Song message. If the song message is empty or the module format does not support song messages, a list of instrument and sample names is returned instead. + - message_raw: Song message. If the song message is empty or the module format does not support song messages, an empty string is returned. + - warnings: A list of warnings that were generated while loading the module. + \return The associated value for key. + \sa openmpt::module::get_metadata_keys + */ + std::string get_metadata( const std::string & key ) const; + + //! Get the current speed + /*! + \return The current speed in ticks per row. + */ + std::int32_t get_current_speed() const; + //! Get the current tempo + /*! + \return The current tempo in tracker units. The exact meaning of this value depends on the tempo mode being used. + */ + std::int32_t get_current_tempo() const; + //! Get the current order + /*! + \return The current order at which the module is being played back. + */ + std::int32_t get_current_order() const; + //! Get the current pattern + /*! + \return The current pattern that is being played. + */ + std::int32_t get_current_pattern() const; + //! Get the current row + /*! + \return The current row at which the current pattern is being played. + */ + std::int32_t get_current_row() const; + //! Get the current amount of playing channels. + /*! + \return The amount of sample channels that are currently being rendered. + */ + std::int32_t get_current_playing_channels() const; + + //! Get an approximate indication of the channel volume. + /*! + \param channel The channel whose volume should be retrieved. + \return The approximate channel volume. + \remarks The returned value is solely based on the note velocity and does not take the actual waveform of the playing sample into account. + */ + float get_current_channel_vu_mono( std::int32_t channel ) const; + //! Get an approximate indication of the channel volume on the front-left speaker. + /*! + \param channel The channel whose volume should be retrieved. + \return The approximate channel volume. + \remarks The returned value is solely based on the note velocity and does not take the actual waveform of the playing sample into account. + */ + float get_current_channel_vu_left( std::int32_t channel ) const; + //! Get an approximate indication of the channel volume on the front-right speaker. + /*! + \param channel The channel whose volume should be retrieved. + \return The approximate channel volume. + \remarks The returned value is solely based on the note velocity and does not take the actual waveform of the playing sample into account. + */ + float get_current_channel_vu_right( std::int32_t channel ) const; + //! Get an approximate indication of the channel volume on the rear-left speaker. + /*! + \param channel The channel whose volume should be retrieved. + \return The approximate channel volume. + \remarks The returned value is solely based on the note velocity and does not take the actual waveform of the playing sample into account. + */ + float get_current_channel_vu_rear_left( std::int32_t channel ) const; + //! Get an approximate indication of the channel volume on the rear-right speaker. + /*! + \param channel The channel whose volume should be retrieved. + \return The approximate channel volume. + \remarks The returned value is solely based on the note velocity and does not take the actual waveform of the playing sample into account. + */ + float get_current_channel_vu_rear_right( std::int32_t channel ) const; + + //! Get the number of sub-songs + /*! + \return The number of sub-songs in the module. This includes any "hidden" songs (songs that share the same sequence, but start at different order indices) and "normal" sub-songs or "sequences" (if the format supports them). + \sa openmpt::module::get_subsong_names, openmpt::module::select_subsong, openmpt::module::get_selected_subsong + */ + std::int32_t get_num_subsongs() const; + //! Get the number of pattern channels + /*! + \return The number of pattern channels in the module. Not all channels do necessarily contain data. + \remarks The number of pattern channels is completely independent of the number of output channels. libopenmpt can render modules in mono, stereo or quad surround, but the choice of which of the three modes to use must not be made based on the return value of this function, which may be any positive integer amount. Only use this function for informational purposes. + */ + std::int32_t get_num_channels() const; + //! Get the number of orders + /*! + \return The number of orders in the current sequence of the module. + */ + std::int32_t get_num_orders() const; + //! Get the number of patterns + /*! + \return The number of distinct patterns in the module. + */ + std::int32_t get_num_patterns() const; + //! Get the number of instruments + /*! + \return The number of instrument slots in the module. Instruments are a layer on top of samples, and are not supported by all module formats. + */ + std::int32_t get_num_instruments() const; + //! Get the number of samples + /*! + \return The number of sample slots in the module. + */ + std::int32_t get_num_samples() const; + + //! Get a list of sub-song names + /*! + \return All sub-song names. + \sa openmpt::module::get_num_subsongs, openmpt::module::select_subsong, openmpt::module::get_selected_subsong + */ + std::vector get_subsong_names() const; + //! Get a list of channel names + /*! + \return All channel names. + \sa openmpt::module::get_num_channels + */ + std::vector get_channel_names() const; + //! Get a list of order names + /*! + \return All order names. + \sa openmpt::module::get_num_orders + */ + std::vector get_order_names() const; + //! Get a list of pattern names + /*! + \return All pattern names. + \sa openmpt::module::get_num_patterns + */ + std::vector get_pattern_names() const; + //! Get a list of instrument names + /*! + \return All instrument names. + \sa openmpt::module::get_num_instruments + */ + std::vector get_instrument_names() const; + //! Get a list of sample names + /*! + \return All sample names. + \sa openmpt::module::get_num_samples + */ + std::vector get_sample_names() const; + + //! Get pattern at order position + /*! + \param order The order item whose pattern index should be retrieved. + \return The pattern index found at the given order position of the current sequence. + */ + std::int32_t get_order_pattern( std::int32_t order ) const; + + //! Get the number of rows in a pattern + /*! + \param pattern The pattern whose row count should be retrieved. + \return The number of rows in the given pattern. If the pattern does not exist, 0 is returned. + */ + std::int32_t get_pattern_num_rows( std::int32_t pattern ) const; + + //! Get raw pattern content + /*! + \param pattern The pattern whose data should be retrieved. + \param row The row from which the data should be retrieved. + \param channel The channel from which the data should be retrieved. + \param command The cell index at which the data should be retrieved. See openmpt::module::command_index + \return The internal, raw pattern data at the given pattern position. + */ + std::uint8_t get_pattern_row_channel_command( std::int32_t pattern, std::int32_t row, std::int32_t channel, int command ) const; + + //! Get formatted (human-readable) pattern content + /*! + \param pattern The pattern whose data should be retrieved. + \param row The row from which the data should be retrieved. + \param channel The channel from which the data should be retrieved. + \param command The cell index at which the data should be retrieved. + \return The formatted pattern data at the given pattern position. See openmpt::module::command_index + \sa openmpt::module::highlight_pattern_row_channel_command + */ + std::string format_pattern_row_channel_command( std::int32_t pattern, std::int32_t row, std::int32_t channel, int command ) const; + + //! Get highlighting information for formatted pattern content + /*! + \param pattern The pattern whose data should be retrieved. + \param row The row from which the data should be retrieved. + \param channel The channel from which the data should be retrieved. + \param command The cell index at which the data should be retrieved. See openmpt::module::command_index + \return The highlighting string for the formatted pattern data as retrieved by openmpt::module::get_pattern_row_channel_command at the given pattern position. + \remarks The returned string will map each character position of the string returned by openmpt::module::get_pattern_row_channel_command to a highlighting instruction. + Possible highlighting characters are: + - " " : empty/space + - "." : empty/dot + - "n" : generic note + - "m" : special note + - "i" : generic instrument + - "u" : generic volume column effect + - "v" : generic volume column parameter + - "e" : generic effect column effect + - "f" : generic effect column parameter + \sa openmpt::module::get_pattern_row_channel_command + */ + std::string highlight_pattern_row_channel_command( std::int32_t pattern, std::int32_t row, std::int32_t channel, int command ) const; + + //! Get formatted (human-readable) pattern content + /*! + \param pattern The pattern whose data should be retrieved. + \param row The row from which the data should be retrieved. + \param channel The channel from which the data should be retrieved. + \param width The maximum number of characters the string should contain. 0 means no limit. + \param pad If true, the string will be resized to the exact length provided in the width parameter. + \return The formatted pattern data at the given pattern position. + \sa openmpt::module::highlight_pattern_row_channel + */ + std::string format_pattern_row_channel( std::int32_t pattern, std::int32_t row, std::int32_t channel, std::size_t width = 0, bool pad = true ) const; + //! Get highlighting information for formatted pattern content + /*! + \param pattern The pattern whose data should be retrieved. + \param row The row from which the data should be retrieved. + \param channel The channel from which the data should be retrieved. + \param width The maximum number of characters the string should contain. 0 means no limit. + \param pad If true, the string will be resized to the exact length provided in the width parameter. + \return The highlighting string for the formatted pattern data as retrieved by openmpt::module::format_pattern_row_channel at the given pattern position. + \sa openmpt::module::format_pattern_row_channel + */ + std::string highlight_pattern_row_channel( std::int32_t pattern, std::int32_t row, std::int32_t channel, std::size_t width = 0, bool pad = true ) const; + + //! Retrieve supported ctl keys + /*! + \return A vector containing all supported ctl keys. + \remarks Currently supported ctl values are: + - load.skip_samples: Set to "1" to avoid loading samples into memory + - load.skip_patterns: Set to "1" to avoid loading patterns into memory + - load.skip_plugins: Set to "1" to avoid loading plugins + - load.skip_subsongs_init: Set to "1" to avoid pre-initializing sub-songs. Skipping results in faster module loading but slower seeking. + - seek.sync_samples: Set to "1" to sync sample playback when using openmpt::module::set_position_seconds or openmpt::module::set_position_order_row. + - subsong: The current subsong. Setting it has identical semantics as openmpt::module::select_subsong(), getting it returns the currently selected subsong. + - play.at_end: Chooses the behaviour when the end of song is reached: + - "fadeout": Fades the module out for a short while. Subsequent reads after the fadeout will return 0 rendered frames. + - "continue": Returns 0 rendered frames when the song end is reached. Subsequent reads will continue playing from the song start or loop start. + - "stop": Returns 0 rendered frames when the song end is reached. Subsequent reads will return 0 rendered frames. + - play.tempo_factor: Set a floating point tempo factor. "1.0" is the default tempo. + - play.pitch_factor: Set a floating point pitch factor. "1.0" is the default pitch. + - render.resampler.emulate_amiga: Set to "1" to enable the Amiga resampler for Amiga modules. This emulates the sound characteristics of the Paula chip and overrides the selected interpolation filter. Non-Amiga module formats are not affected by this setting. + - render.opl.volume_factor: Set volume factor applied to synthesized OPL sounds, relative to the default OPL volume. + - dither: Set the dither algorithm that is used for the 16 bit versions of openmpt::module::read. Supported values are: + - 0: No dithering. + - 1: Default mode. Chosen by OpenMPT code, might change. + - 2: Rectangular, 0.5 bit depth, no noise shaping (original ModPlug Tracker). + - 3: Rectangular, 1 bit depth, simple 1st order noise shaping + + An exclamation mark ("!") or a question mark ("?") can be appended to any ctl key in order to influence the behaviour in case of an unknown ctl key. "!" causes an exception to be thrown; "?" causes the ctl to be silently ignored. In case neither is appended to the key name, unknown init_ctls are ignored by default and other ctls throw an exception by default. + */ + std::vector get_ctls() const; + + //! Get current ctl value + /*! + \param ctl The ctl key whose value should be retrieved. + \return The associated ctl value. + \sa openmpt::module::get_ctls + */ + std::string ctl_get( const std::string & ctl ) const; + //! Set ctl value + /*! + \param ctl The ctl key whose value should be set. + \param value The value that should be set. + \throws openmpt::exception Throws an exception derived from openmpt::exception in case the value is not sensible (e.g. negative tempo factor) or under the circumstances outlined in openmpt::module::get_ctls. + \sa openmpt::module::get_ctls + */ + void ctl_set( const std::string & ctl, const std::string & value ); + + // remember to add new functions to both C and C++ interfaces and to increase OPENMPT_API_VERSION_MINOR + +}; // class module + +} // namespace openmpt + +/*! + @} +*/ + +#endif // LIBOPENMPT_HPP diff --git a/libs/libopenmpt/inc/libopenmpt/libopenmpt_config.h b/libs/libopenmpt/inc/libopenmpt/libopenmpt_config.h new file mode 100644 index 000000000..0323ab1e0 --- /dev/null +++ b/libs/libopenmpt/inc/libopenmpt/libopenmpt_config.h @@ -0,0 +1,204 @@ +/* + * libopenmpt_config.h + * ------------------- + * Purpose: libopenmpt public interface configuration + * Notes : (currently none) + * Authors: OpenMPT Devs + * The OpenMPT source code is released under the BSD license. Read LICENSE for more details. + */ + +#ifndef LIBOPENMPT_CONFIG_H +#define LIBOPENMPT_CONFIG_H + +/*! \defgroup libopenmpt libopenmpt */ + +/*! \addtogroup libopenmpt + @{ +*/ + +/* provoke warnings if already defined */ +#define LIBOPENMPT_API +#undef LIBOPENMPT_API +#define LIBOPENMPT_CXX_API +#undef LIBOPENMPT_CXX_API + +/*! \brief Defined if libopenmpt/libopenmpt_stream_callbacks_buffer.h exists. */ +#define LIBOPENMPT_STREAM_CALLBACKS_BUFFER + +/*! \brief Defined if libopenmpt/libopenmpt_stream_callbacks_fd.h exists. + * \since 0.3 + * \remarks + * Use the following to check for availability: + * \code + * #include + * #if defined(LIBOPENMPT_STREAM_CALLBACKS_FD) || ((OPENMPT_API_VERSION_MAJOR == 0) && ((OPENMPT_API_VERSION_MINOR == 2) || (OPENMPT_API_VERSION_MINOR == 1))) + * #include + * #endif + * \endcode + */ +#define LIBOPENMPT_STREAM_CALLBACKS_FD + +/*! \brief Defined if libopenmpt/libopenmpt_stream_callbacks_file.h exists. + * \since 0.3 + * \remarks + * Use the following to check for availability: + * \code + * #include + * #if defined(LIBOPENMPT_STREAM_CALLBACKS_FILE) || ((OPENMPT_API_VERSION_MAJOR == 0) && ((OPENMPT_API_VERSION_MINOR == 2) || (OPENMPT_API_VERSION_MINOR == 1))) + * #include + * #endif + * \endcode + */ +#define LIBOPENMPT_STREAM_CALLBACKS_FILE + +#if defined(__DOXYGEN__) + +#define LIBOPENMPT_API_HELPER_EXPORT +#define LIBOPENMPT_API_HELPER_IMPORT +#define LIBOPENMPT_API_HELPER_PUBLIC +#define LIBOPENMPT_API_HELPER_LOCAL + +#elif defined(_MSC_VER) + +#define LIBOPENMPT_API_HELPER_EXPORT __declspec(dllexport) +#define LIBOPENMPT_API_HELPER_IMPORT __declspec(dllimport) +#define LIBOPENMPT_API_HELPER_PUBLIC +#define LIBOPENMPT_API_HELPER_LOCAL + +#elif defined(__EMSCRIPTEN__) + +#define LIBOPENMPT_API_HELPER_EXPORT __attribute__((visibility("default"))) __attribute__((used)) +#define LIBOPENMPT_API_HELPER_IMPORT __attribute__((visibility("default"))) __attribute__((used)) +#define LIBOPENMPT_API_HELPER_PUBLIC __attribute__((visibility("default"))) __attribute__((used)) +#define LIBOPENMPT_API_HELPER_LOCAL __attribute__((visibility("hidden"))) + +#elif (defined(__GNUC__) || defined(__clang__)) && defined(_WIN32) + +#define LIBOPENMPT_API_HELPER_EXPORT __declspec(dllexport) +#define LIBOPENMPT_API_HELPER_IMPORT __declspec(dllimport) +#define LIBOPENMPT_API_HELPER_PUBLIC __attribute__((visibility("default"))) +#define LIBOPENMPT_API_HELPER_LOCAL __attribute__((visibility("hidden"))) + +#elif defined(__GNUC__) || defined(__clang__) + +#define LIBOPENMPT_API_HELPER_EXPORT __attribute__((visibility("default"))) +#define LIBOPENMPT_API_HELPER_IMPORT __attribute__((visibility("default"))) +#define LIBOPENMPT_API_HELPER_PUBLIC __attribute__((visibility("default"))) +#define LIBOPENMPT_API_HELPER_LOCAL __attribute__((visibility("hidden"))) + +#elif defined(_WIN32) + +#define LIBOPENMPT_API_HELPER_EXPORT __declspec(dllexport) +#define LIBOPENMPT_API_HELPER_IMPORT __declspec(dllimport) +#define LIBOPENMPT_API_HELPER_PUBLIC +#define LIBOPENMPT_API_HELPER_LOCAL + +#else + +#define LIBOPENMPT_API_HELPER_EXPORT +#define LIBOPENMPT_API_HELPER_IMPORT +#define LIBOPENMPT_API_HELPER_PUBLIC +#define LIBOPENMPT_API_HELPER_LOCAL + +#endif + +#if defined(LIBOPENMPT_BUILD_DLL) +#define LIBOPENMPT_API LIBOPENMPT_API_HELPER_EXPORT +#elif defined(LIBOPENMPT_USE_DLL) +#define LIBOPENMPT_API LIBOPENMPT_API_HELPER_IMPORT +#else +#define LIBOPENMPT_API LIBOPENMPT_API_HELPER_PUBLIC +#endif + +#ifdef __cplusplus + +#define LIBOPENMPT_CXX_API LIBOPENMPT_API + +#if defined(LIBOPENMPT_USE_DLL) +#if defined(_MSC_VER) && !defined(_DLL) +#error "C++ interface is disabled if libopenmpt is built as a DLL and the runtime is statically linked. This is not supported by microsoft and cannot possibly work. Ever." +#undef LIBOPENMPT_CXX_API +#define LIBOPENMPT_CXX_API LIBOPENMPT_API_HELPER_LOCAL +#endif +#endif + +#if defined(__EMSCRIPTEN__) + +/* Only the C API is supported for emscripten. Disable the C++ API. */ +#undef LIBOPENMPT_CXX_API +#define LIBOPENMPT_CXX_API LIBOPENMPT_API_HELPER_LOCAL +#endif + +#endif + +/*! + @} +*/ + + +/* C */ + +#if !defined(LIBOPENMPT_NO_DEPRECATE) +#if defined(__clang__) +#define LIBOPENMPT_DEPRECATED __attribute__((deprecated)) +#elif defined(__GNUC__) +#define LIBOPENMPT_DEPRECATED __attribute__((deprecated)) +#elif defined(_MSC_VER) +#define LIBOPENMPT_DEPRECATED __declspec(deprecated) +#else +#define LIBOPENMPT_DEPRECATED +#endif +#endif + +#ifndef __cplusplus +#if !defined(LIBOPENMPT_NO_DEPRECATE) +LIBOPENMPT_DEPRECATED static const int LIBOPENMPT_DEPRECATED_STRING_CONSTANT = 0; +#define LIBOPENMPT_DEPRECATED_STRING( str ) ( LIBOPENMPT_DEPRECATED_STRING_CONSTANT ? ( str ) : ( str ) ) +#else +#define LIBOPENMPT_DEPRECATED_STRING( str ) str +#endif +#endif + + +/* C++ */ + +#ifdef __cplusplus + +#ifndef LIBOPENMPT_ASSUME_CPLUSPLUS_DEPRECATED +/* handle known broken compilers here by defining LIBOPENMPT_ASSUME_CPLUSPLUS_DEPRECATED appropriately */ +#endif + +#if defined(LIBOPENMPT_ASSUME_CPLUSPLUS) +#ifndef LIBOPENMPT_ASSUME_CPLUSPLUS_DEPRECATED +#define LIBOPENMPT_ASSUME_CPLUSPLUS_DEPRECATED LIBOPENMPT_ASSUME_CPLUSPLUS +#endif +#endif + +#if !defined(LIBOPENMPT_NO_DEPRECATE) +#if defined(LIBOPENMPT_ASSUME_CPLUSPLUS_DEPRECATED) +#if (LIBOPENMPT_ASSUME_CPLUSPLUS_DEPRECATED >= 201402L) +#define LIBOPENMPT_ATTR_DEPRECATED [[deprecated]] +#undef LIBOPENMPT_DEPRECATED +#define LIBOPENMPT_DEPRECATED +#else +#define LIBOPENMPT_ATTR_DEPRECATED +#endif +#elif (__cplusplus >= 201402L) +#define LIBOPENMPT_ATTR_DEPRECATED [[deprecated]] +#undef LIBOPENMPT_DEPRECATED +#define LIBOPENMPT_DEPRECATED +#else +#define LIBOPENMPT_ATTR_DEPRECATED +#endif +#else +#undef LIBOPENMPT_DEPRECATED +#define LIBOPENMPT_DEPRECATED +#define LIBOPENMPT_ATTR_DEPRECATED +#endif + +#endif + + +#include "libopenmpt_version.h" + +#endif /* LIBOPENMPT_CONFIG_H */ diff --git a/libs/libopenmpt/inc/libopenmpt/libopenmpt_ext.h b/libs/libopenmpt/inc/libopenmpt/libopenmpt_ext.h new file mode 100644 index 000000000..e76f758de --- /dev/null +++ b/libs/libopenmpt/inc/libopenmpt/libopenmpt_ext.h @@ -0,0 +1,318 @@ +/* + * libopenmpt_ext.h + * ---------------- + * Purpose: libopenmpt public c interface for libopenmpt extensions + * Notes : + * Authors: OpenMPT Devs + * The OpenMPT source code is released under the BSD license. Read LICENSE for more details. + */ + +#ifndef LIBOPENMPT_EXT_H +#define LIBOPENMPT_EXT_H + +#include "libopenmpt_config.h" +#include "libopenmpt.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/*! + * \page libopenmpt_ext_c_overview libopenmpt_ext C API + * + * libopenmpt_ext is included in all builds by default. + * + * \section libopenmpt-ext-c-detailed Detailed documentation + * + * \ref libopenmpt_ext_c + * + */ + +/*! \defgroup libopenmpt_ext_c libopenmpt_ext C */ + +/*! \addtogroup libopenmpt_ext_c + * @{ + */ + +/*! \brief Opaque type representing a libopenmpt extension module + */ +typedef struct openmpt_module_ext openmpt_module_ext; + +/*! \brief Construct an openmpt_module_ext + * + * \param stream_callbacks Input stream callback operations. + * \param stream Input stream to load the module from. + * \param logfunc Logging function where warning and errors are written. The logging function may be called throughout the lifetime of openmpt_module_ext. May be NULL. + * \param loguser User-defined data associated with this module. This value will be passed to the logging callback function (logfunc) + * \param errfunc Error function to define error behaviour. May be NULL. + * \param erruser Error function user context. Used to pass any user-defined data associated with this module to the logging function. + * \param error Pointer to an integer where an error may get stored. May be NULL. + * \param error_message Pointer to a string pointer where an error message may get stored. May be NULL. + * \param ctls A map of initial ctl values, see openmpt_module_get_ctls. + * \return A pointer to the constructed openmpt_module_ext, or NULL on failure. + * \remarks The input data can be discarded after an openmpt_module_ext has been constructed successfully. + * \sa openmpt_stream_callbacks + * \sa \ref libopenmpt_c_fileio + * \since 0.3.0 + */ +LIBOPENMPT_API openmpt_module_ext * openmpt_module_ext_create( openmpt_stream_callbacks stream_callbacks, void * stream, openmpt_log_func logfunc, void * loguser, openmpt_error_func errfunc, void * erruser, int * error, const char * * error_message, const openmpt_module_initial_ctl * ctls ); + +/*! \brief Construct an openmpt_module_ext + * + * \param filedata Data to load the module from. + * \param filesize Amount of data available. + * \param logfunc Logging function where warning and errors are written. The logging function may be called throughout the lifetime of openmpt_module_ext. + * \param loguser User-defined data associated with this module. This value will be passed to the logging callback function (logfunc) + * \param errfunc Error function to define error behaviour. May be NULL. + * \param erruser Error function user context. Used to pass any user-defined data associated with this module to the logging function. + * \param error Pointer to an integer where an error may get stored. May be NULL. + * \param error_message Pointer to a string pointer where an error message may get stored. May be NULL. + * \param ctls A map of initial ctl values, see openmpt_module_get_ctls. + * \return A pointer to the constructed openmpt_module_ext, or NULL on failure. + * \remarks The input data can be discarded after an openmpt_module_ext has been constructed successfully. + * \sa \ref libopenmpt_c_fileio + * \since 0.3.0 + */ +LIBOPENMPT_API openmpt_module_ext * openmpt_module_ext_create_from_memory( const void * filedata, size_t filesize, openmpt_log_func logfunc, void * loguser, openmpt_error_func errfunc, void * erruser, int * error, const char * * error_message, const openmpt_module_initial_ctl * ctls ); + +/*! \brief Unload a previously created openmpt_module_ext from memory. + * + * \param mod_ext The module to unload. + */ +LIBOPENMPT_API void openmpt_module_ext_destroy( openmpt_module_ext * mod_ext ); + +/*! \brief Retrieve the openmpt_module handle from an openmpt_module_ext handle. + * + * \param mod_ext The extension module handle to convert + * \return An equivalent openmpt_module handle to pass to standard libopenmpt functions + * \since 0.3.0 + */ +LIBOPENMPT_API openmpt_module * openmpt_module_ext_get_module( openmpt_module_ext * mod_ext ); + +/*! Retrieve a libopenmpt extension. + * + * \param mod_ext The module handle to work on. + * \param interface_id The name of the extension interface to retrieve (e.g. LIBOPENMPT_EXT_C_INTERFACE_PATTERN_VIS). + * \param interface Appropriate structure of interface function pointers which is to be filled by this function (e.g. a pointer to a openmpt_module_ext_interface_pattern_vis structure). + * \param interface_size Size of the interface's structure of function pointers (e.g. sizeof(openmpt_module_ext_interface_pattern_vis)). + * \return 1 on success, 0 if the interface was not found. + * \since 0.3.0 + */ +LIBOPENMPT_API int openmpt_module_ext_get_interface( openmpt_module_ext * mod_ext, const char * interface_id, void * interface, size_t interface_size ); + + + +#ifndef LIBOPENMPT_EXT_C_INTERFACE_PATTERN_VIS +#define LIBOPENMPT_EXT_C_INTERFACE_PATTERN_VIS "pattern_vis" +#endif + +/*! Pattern command type */ +#define OPENMPT_MODULE_EXT_INTERFACE_PATTERN_VIS_EFFECT_TYPE_UNKNOWN 0 +#define OPENMPT_MODULE_EXT_INTERFACE_PATTERN_VIS_EFFECT_TYPE_GENERAL 1 +#define OPENMPT_MODULE_EXT_INTERFACE_PATTERN_VIS_EFFECT_TYPE_GLOBAL 2 +#define OPENMPT_MODULE_EXT_INTERFACE_PATTERN_VIS_EFFECT_TYPE_VOLUME 3 +#define OPENMPT_MODULE_EXT_INTERFACE_PATTERN_VIS_EFFECT_TYPE_PANNING 4 +#define OPENMPT_MODULE_EXT_INTERFACE_PATTERN_VIS_EFFECT_TYPE_PITCH 5 + +typedef struct openmpt_module_ext_interface_pattern_vis { + /*! Get pattern command type for pattern highlighting + * + * \param mod_ext The module handle to work on. + * \param pattern The pattern whose data should be retrieved. + * \param row The row from which the data should be retrieved. + * \param channel The channel from which the data should be retrieved. + * \return The command type in the effect column at the given pattern position (see OPENMPT_MODULE_EXT_INTERFACE_PATTERN_VIS_EFFECT_TYPE_*) + * \sa openmpt_module_ext_interface_pattern_vis::get_pattern_row_channel_volume_effect_type + */ + int ( * get_pattern_row_channel_volume_effect_type ) ( openmpt_module_ext * mod_ext, int32_t pattern, int32_t row, int32_t channel ); + + /*! Get pattern command type for pattern highlighting + * + * \param mod_ext The module handle to work on. + * \param pattern The pattern whose data should be retrieved. + * \param row The row from which the data should be retrieved. + * \param channel The channel from which the data should be retrieved. + * \return The command type in the effect column at the given pattern position (see OPENMPT_MODULE_EXT_INTERFACE_PATTERN_VIS_EFFECT_TYPE_*) + * \sa openmpt_module_ext_interface_pattern_vis::get_pattern_row_channel_volume_effect_type + */ + int ( * get_pattern_row_channel_effect_type ) ( openmpt_module_ext * mod_ext, int32_t pattern, int32_t row, int32_t channel ); +} openmpt_module_ext_interface_pattern_vis; + + + +#ifndef LIBOPENMPT_EXT_C_INTERFACE_INTERACTIVE +#define LIBOPENMPT_EXT_C_INTERFACE_INTERACTIVE "interactive" +#endif + +typedef struct openmpt_module_ext_interface_interactive { + /*! Set the current ticks per row (speed) + * + * \param mod_ext The module handle to work on. + * \param speed The new tick count in range [1, 65535]. + * \return 1 on success, 0 on failure. + * \remarks The tick count may be reset by pattern commands at any time. + * \sa openmpt_module_get_current_speed + */ + int ( * set_current_speed ) ( openmpt_module_ext * mod_ext, int32_t speed ); + + /*! Set the current module tempo + * + * \param mod_ext The module handle to work on. + * \param tempo The new tempo in range [32, 512]. The exact meaning of the value depends on the tempo mode used by the module. + * \return 1 on success, 0 on failure. + * \remarks The tempo may be reset by pattern commands at any time. Use openmpt_module_ext_interface_interactive::set_tempo_factor to apply a tempo factor that is independent of pattern commands. + * \sa openmpt_module_get_current_tempo + */ + int ( * set_current_tempo ) ( openmpt_module_ext * mod_ext, int32_t tempo ); + + /*! Set the current module tempo factor without affecting playback pitch + * + * \param mod_ext The module handle to work on. + * \param factor The new tempo factor in range ]0.0, 4.0] - 1.0 means unmodified tempo. + * \return 1 on success, 0 on failure. + * \remarks Modifying the tempo without applying the same pitch factor using openmpt_module_ext_interface_interactive::set_pitch_factor may cause rhythmic samples (e.g. drum loops) to go out of sync. + * \sa openmpt_module_ext_interface_interactive::get_tempo_factor + */ + int ( * set_tempo_factor ) ( openmpt_module_ext * mod_ext, double factor ); + + /*! Gets the current module tempo factor + * + * \param mod_ext The module handle to work on. + * \return The current tempo factor. + * \sa openmpt_module_ext_interface_interactive::set_tempo_factor + */ + double ( * get_tempo_factor ) ( openmpt_module_ext * mod_ext ); + + /*! Set the current module pitch factor without affecting playback speed + * + * \param mod_ext The module handle to work on. + * \param factor The new pitch factor in range ]0.0, 4.0] - 1.0 means unmodified pitch. + * \return 1 on success, 0 on failure. + * \remarks Modifying the pitch without applying the the same tempo factor using openmpt_module_ext_interface_interactive::set_tempo_factor may cause rhythmic samples (e.g. drum loops) to go out of sync. + * \remarks To shift the pich by `n` semitones, the parameter can be calculated as follows: `pow( 2.0, n / 12.0 )` + * \sa openmpt_module_ext_interface_interactive::get_pitch_factor + */ + int ( * set_pitch_factor ) ( openmpt_module_ext * mod_ext, double factor ); + + /*! Gets the current module pitch factor + * + * \param mod_ext The module handle to work on. + * \return The current pitch factor. + * \sa openmpt_module_ext_interface_interactive::set_pitch_factor + */ + double ( * get_pitch_factor ) ( openmpt_module_ext * mod_ext ); + + /*! Set the current global volume + * + * \param mod_ext The module handle to work on. + * \param volume The new global volume in range [0.0, 1.0] + * \return 1 on success, 0 on failure. + * \remarks The global volume may be reset by pattern commands at any time. Use openmpt_module_set_render_param to apply a global overall volume factor that is independent of pattern commands. + * \sa openmpt_module_ext_interface_interactive::get_global_volume + */ + int ( * set_global_volume ) ( openmpt_module_ext * mod_ext, double volume ); + + /*! Get the current global volume + * + * \param mod_ext The module handle to work on. + * \return The current global volume in range [0.0, 1.0] + * \sa openmpt_module_ext_interface_interactive::set_global_volume + */ + double ( * get_global_volume ) ( openmpt_module_ext * mod_ext ); + + /*! Set the current channel volume for a channel + * + * \param mod_ext The module handle to work on. + * \param channel The channel whose volume should be set, in range [0, openmpt_module_get_num_channels()[ + * \param volume The new channel volume in range [0.0, 1.0] + * \return 1 on success, 0 on failure (channel out of range). + * \remarks The channel volume may be reset by pattern commands at any time. + * \sa openmpt_module_ext_interface_interactive::get_channel_volume + */ + int ( * set_channel_volume ) ( openmpt_module_ext * mod_ext, int32_t channel, double volume ); + + /*! Get the current channel volume for a channel + * + * \param mod_ext The module handle to work on. + * \param channel The channel whose volume should be retrieved, in range [0, openmpt_module_get_num_channels()[ + * \return The current channel volume in range [0.0, 1.0] + * \sa openmpt_module_ext_interface_interactive::set_channel_volume + */ + double ( * get_channel_volume ) ( openmpt_module_ext * mod_ext, int32_t channel ); + + /*! Set the current mute status for a channel + * + * \param mod_ext The module handle to work on. + * \param channel The channel whose mute status should be set, in range [0, openmpt_module_get_num_channels()[ + * \param mute The new mute status. true is muted, false is unmuted. + * \return 1 on success, 0 on failure (channel out of range). + * \sa openmpt_module_ext_interface_interactive::get_channel_mute_status + */ + int ( * set_channel_mute_status ) ( openmpt_module_ext * mod_ext, int32_t channel, int mute ); + + /*! Get the current mute status for a channel + * + * \param mod_ext The module handle to work on. + * \param channel The channel whose mute status should be retrieved, in range [0, openmpt_module_get_num_channels()[ + * \return The current channel mute status. 1 is muted, 0 is unmuted, -1 means the instrument was out of range + * \sa openmpt_module_ext_interface_interactive::set_channel_mute_status + */ + int ( * get_channel_mute_status ) ( openmpt_module_ext * mod_ext, int32_t channel ); + + /*! Set the current mute status for an instrument + * + * \param mod_ext The module handle to work on. + * \param instrument The instrument whose mute status should be set, in range [0, openmpt_module_get_num_instruments()[ if openmpt_module_get_num_instruments is not 0, otherwise in [0, openmpt_module_get_num_samples()[ + * \param mute The new mute status. true is muted, false is unmuted. + * \return 1 on success, 0 on failure (instrument out of range). + * \sa openmpt_module_ext_interface_interactive::get_instrument_mute_status + */ + int ( * set_instrument_mute_status ) ( openmpt_module_ext * mod_ext, int32_t instrument, int mute ); + + /*! Get the current mute status for an instrument + * + * \param mod_ext The module handle to work on. + * \param instrument The instrument whose mute status should be retrieved, in range [0, openmpt_module_get_num_instruments()[ if openmpt_module_get_num_instruments is not 0, otherwise in [0, openmpt_module_get_num_samples()[ + * \return The current instrument mute status. 1 is muted, 0 is unmuted, -1 means the instrument was out of range + * \sa openmpt_module_ext_interface_interactive::set_instrument_mute_status + */ + int ( * get_instrument_mute_status ) ( openmpt_module_ext * mod_ext, int32_t instrument ); + + /*! Play a note using the specified instrument + * + * \param mod_ext The module handle to work on. + * \param instrument The instrument that should be played, in range [0, openmpt_module_get_num_instruments()[ if openmpt_module_get_num_instruments is not 0, otherwise in [0, openmpt_module_get_num_samples()[ + * \param note The note to play, in rage [0, 119]. 60 is the middle C. + * \param volume The volume at which the note should be triggered, in range [0.0, 1.0] + * \param panning The panning position at which the note should be triggered, in range [-1.0, 1.0], 0.0 is center. + * \return The channel on which the note is played. This can pe be passed to openmpt_module_ext_interface_interactive::stop_note to stop the note. -1 means that no channel could be allocated and the note is not played. + * \sa openmpt_module_ext_interface_interactive::stop_note + */ + int32_t ( * play_note ) ( openmpt_module_ext * mod_ext, int32_t instrument, int32_t note, double volume, double panning ); + + /*! Stop the note playing on the specified channel + * + * \param mod_ext The module handle to work on. + * \param channel The channel on which the note should be stopped. + * \return 1 on success, 0 on failure (channel out of range). + * \sa openmpt_module_ext_interface_interactive::play_note + */ + int ( * stop_note ) ( openmpt_module_ext * mod_ext, int32_t channel ); +} openmpt_module_ext_interface_interactive; + + + +/* add stuff here */ + + + +#ifdef __cplusplus +} +#endif + +/*! + * @} + */ + +#endif /* LIBOPENMPT_EXT_H */ + diff --git a/libs/libopenmpt/inc/libopenmpt/libopenmpt_ext.hpp b/libs/libopenmpt/inc/libopenmpt/libopenmpt_ext.hpp new file mode 100644 index 000000000..686eaeeed --- /dev/null +++ b/libs/libopenmpt/inc/libopenmpt/libopenmpt_ext.hpp @@ -0,0 +1,306 @@ +/* + * libopenmpt_ext.hpp + * ------------------ + * Purpose: libopenmpt public c++ interface for libopenmpt extensions + * Notes : + * Authors: OpenMPT Devs + * The OpenMPT source code is released under the BSD license. Read LICENSE for more details. + */ + +#ifndef LIBOPENMPT_EXT_HPP +#define LIBOPENMPT_EXT_HPP + +#include "libopenmpt_config.h" +#include "libopenmpt.hpp" + +/*! + * \page libopenmpt_ext_cpp_overview libopenmpt_ext C++ API + * + * libopenmpt_ext is now included in all builds by default. + * + * \section libopenmpt-ext-cpp-detailed Detailed documentation + * + * \ref libopenmpt_ext_cpp + * + */ + +/*! \defgroup libopenmpt_ext_cpp libopenmpt_ext C++ */ + +/*! \addtogroup libopenmpt_ext_cpp + @{ +*/ + +namespace openmpt { + +class module_ext_impl; + +class LIBOPENMPT_CXX_API module_ext : public module { + +private: + module_ext_impl * ext_impl; +private: + // non-copyable + module_ext( const module_ext & ); + void operator = ( const module_ext & ); +public: + module_ext( std::istream & stream, std::ostream & log = std::clog, const std::map< std::string, std::string > & ctls = detail::initial_ctls_map() ); + module_ext( const std::vector & data, std::ostream & log = std::clog, const std::map< std::string, std::string > & ctls = detail::initial_ctls_map() ); + module_ext( const char * data, std::size_t size, std::ostream & log = std::clog, const std::map< std::string, std::string > & ctls = detail::initial_ctls_map() ); + module_ext( const void * data, std::size_t size, std::ostream & log = std::clog, const std::map< std::string, std::string > & ctls = detail::initial_ctls_map() ); + virtual ~module_ext(); + +public: + + //! Retrieve a libopenmpt extension. + /*! Example: Retrieving the interactive extension to change the tempo of a module: + \code{.cpp} + openmpt::module_ext *mod = new openmpt::module_ext( stream ); + #ifdef LIBOPENMPT_EXT_INTERFACE_INTERACTIVE + openmpt::ext::interactive *interactive = static_cast( self->mod->get_interface( openmpt::ext::interactive_id ) ); + if ( interactive ) { + interactive->set_tempo_factor( 2.0 ); // play module at double speed + } else { + // interface not available + } + #else + // interfae not available + #endif + \endcode + \param interface_id The name of the extension interface to retrieve. + \return The interface object. This may be a nullptr if the extension was not found. + */ + void * get_interface( const std::string & interface_id ); + +}; // class module_ext + +namespace ext { + +#define LIBOPENMPT_DECLARE_EXT_CXX_INTERFACE(name) \ + static const char name ## _id [] = # name ; \ + class name; \ +/**/ + +#define LIBOPENMPT_EXT_CXX_INTERFACE(name) \ + protected: \ + name () {} \ + virtual ~ name () {} \ + public: \ +/**/ + + +#ifndef LIBOPENMPT_EXT_INTERFACE_PATTERN_VIS +#define LIBOPENMPT_EXT_INTERFACE_PATTERN_VIS +#endif + +LIBOPENMPT_DECLARE_EXT_CXX_INTERFACE(pattern_vis) + +class pattern_vis { + + LIBOPENMPT_EXT_CXX_INTERFACE(pattern_vis) + + //! Pattern command type + enum effect_type { + + effect_unknown = 0, + effect_general = 1, + effect_global = 2, + effect_volume = 3, + effect_panning = 4, + effect_pitch = 5 + + }; // enum effect_type + + //! Get pattern command type for pattern highlighting + /*! + \param pattern The pattern whose data should be retrieved. + \param row The row from which the data should be retrieved. + \param channel The channel from which the data should be retrieved. + \return The command type in the effect column at the given pattern position (see openmpt::ext::pattern_vis::effect_type) + \sa openmpt::ext::pattern_vis::get_pattern_row_channel_effect_type + */ + virtual effect_type get_pattern_row_channel_volume_effect_type( std::int32_t pattern, std::int32_t row, std::int32_t channel ) const = 0; + + //! Get pattern command type for pattern highlighting + /*! + \param pattern The pattern whose data should be retrieved. + \param row The row from which the data should be retrieved. + \param channel The channel from which the data should be retrieved. + \return The command type in the volume column at the given pattern position (see openmpt::ext::pattern_vis::effect_type) + \sa openmpt::ext::pattern_vis::get_pattern_row_channel_volume_effect_type + */ + virtual effect_type get_pattern_row_channel_effect_type( std::int32_t pattern, std::int32_t row, std::int32_t channel ) const = 0; + +}; // class pattern_vis + + +#ifndef LIBOPENMPT_EXT_INTERFACE_INTERACTIVE +#define LIBOPENMPT_EXT_INTERFACE_INTERACTIVE +#endif + +LIBOPENMPT_DECLARE_EXT_CXX_INTERFACE(interactive) + +class interactive { + + LIBOPENMPT_EXT_CXX_INTERFACE(interactive) + + //! Set the current ticks per row (speed) + /*! + \param speed The new tick count in range [1, 65535]. + \throws openmpt::exception Throws an exception derived from openmpt::exception if the speed is outside the specified range. + \remarks The tick count may be reset by pattern commands at any time. + \sa openmpt::module::get_current_speed + */ + virtual void set_current_speed( std::int32_t speed ) = 0; + + //! Set the current module tempo + /*! + \param tempo The new tempo in range [32, 512]. The exact meaning of the value depends on the tempo mode used by the module. + \throws openmpt::exception Throws an exception derived from openmpt::exception if the tempo is outside the specified range. + \remarks The tempo may be reset by pattern commands at any time. Use openmpt::ext:interactive::set_tempo_factor to apply a tempo factor that is independent of pattern commands. + \sa openmpt::module::get_current_tempo + */ + virtual void set_current_tempo( std::int32_t tempo ) = 0; + + //! Set the current module tempo factor without affecting playback pitch + /*! + \param factor The new tempo factor in range ]0.0, 4.0] - 1.0 means unmodified tempo. + \throws openmpt::exception Throws an exception derived from openmpt::exception if the factor is outside the specified range. + \remarks Modifying the tempo without applying the same pitch factor using openmpt::ext::interactive::set_pitch_factor may cause rhythmic samples (e.g. drum loops) to go out of sync. + \sa openmpt::ext::interactive::get_tempo_factor + */ + virtual void set_tempo_factor( double factor ) = 0; + + //! Gets the current module tempo factor + /*! + \return The current tempo factor. + \sa openmpt::ext::interactive::set_tempo_factor + */ + virtual double get_tempo_factor( ) const = 0; + + //! Set the current module pitch factor without affecting playback speed + /*! + \param factor The new pitch factor in range ]0.0, 4.0] - 1.0 means unmodified pitch. + \throws openmpt::exception Throws an exception derived from openmpt::exception if the factor is outside the specified range. + \remarks Modifying the pitch without applying the the same tempo factor using openmpt::ext::interactive::set_tempo_factor may cause rhythmic samples (e.g. drum loops) to go out of sync. + \remarks To shift the pich by `n` semitones, the parameter can be calculated as follows: `pow( 2.0, n / 12.0 )` + \sa openmpt::ext::interactive::get_pitch_factor + */ + virtual void set_pitch_factor( double factor ) = 0; + + //! Gets the current module pitch factor + /*! + \return The current pitch factor. + \sa openmpt::ext::interactive::set_pitch_factor + */ + virtual double get_pitch_factor( ) const = 0; + + //! Set the current global volume + /*! + \param volume The new global volume in range [0.0, 1.0] + \throws openmpt::exception Throws an exception derived from openmpt::exception if the volume is outside the specified range. + \remarks The global volume may be reset by pattern commands at any time. Use openmpt::module::set_render_param to apply a global overall volume factor that is independent of pattern commands. + \sa openmpt::ext::interactive::get_global_volume + */ + virtual void set_global_volume( double volume ) = 0; + + //! Get the current global volume + /*! + \return The current global volume in range [0.0, 1.0] + \sa openmpt::ext::interactive::set_global_volume + */ + virtual double get_global_volume( ) const = 0; + + //! Set the current channel volume for a channel + /*! + \param channel The channel whose volume should be set, in range [0, openmpt::module::get_num_channels()[ + \param volume The new channel volume in range [0.0, 1.0] + \throws openmpt::exception Throws an exception derived from openmpt::exception if the channel or volume is outside the specified range. + \remarks The channel volume may be reset by pattern commands at any time. + \sa openmpt::ext::interactive::get_channel_volume + */ + virtual void set_channel_volume( std::int32_t channel, double volume ) = 0; + + //! Get the current channel volume for a channel + /*! + \param channel The channel whose volume should be retrieved, in range [0, openmpt::module::get_num_channels()[ + \return The current channel volume in range [0.0, 1.0] + \throws openmpt::exception Throws an exception derived from openmpt::exception if the channel is outside the specified range. + \sa openmpt::ext::interactive::set_channel_volume + */ + virtual double get_channel_volume( std::int32_t channel ) const = 0; + + //! Set the current mute status for a channel + /*! + \param channel The channel whose mute status should be set, in range [0, openmpt::module::get_num_channels()[ + \param mute The new mute status. true is muted, false is unmuted. + \throws openmpt::exception Throws an exception derived from openmpt::exception if the channel is outside the specified range. + \sa openmpt::ext::interactive::get_channel_mute_status + */ + virtual void set_channel_mute_status( std::int32_t channel, bool mute ) = 0; + + //! Get the current mute status for a channel + /*! + \param channel The channel whose mute status should be retrieved, in range [0, openmpt::module::get_num_channels()[ + \return The current channel mute status. true is muted, false is unmuted. + \throws openmpt::exception Throws an exception derived from openmpt::exception if the channel is outside the specified range. + \sa openmpt::ext::interactive::set_channel_mute_status + */ + virtual bool get_channel_mute_status( std::int32_t channel ) const = 0; + + //! Set the current mute status for an instrument + /*! + \param instrument The instrument whose mute status should be set, in range [0, openmpt::module::get_num_instruments()[ if openmpt::module::get_num_instruments is not 0, otherwise in [0, openmpt::module::get_num_samples()[ + \param mute The new mute status. true is muted, false is unmuted. + \throws openmpt::exception Throws an exception derived from openmpt::exception if the instrument is outside the specified range. + \sa openmpt::ext::interactive::get_instrument_mute_status + */ + virtual void set_instrument_mute_status( std::int32_t instrument, bool mute ) = 0; + + //! Get the current mute status for an instrument + /*! + \param instrument The instrument whose mute status should be retrieved, in range [0, openmpt::module::get_num_instruments()[ if openmpt::module::get_num_instruments is not 0, otherwise in [0, openmpt::module::get_num_samples()[ + \return The current instrument mute status. true is muted, false is unmuted. + \throws openmpt::exception Throws an exception derived from openmpt::exception if the instrument is outside the specified range. + \sa openmpt::ext::interactive::set_instrument_mute_status + */ + virtual bool get_instrument_mute_status( std::int32_t instrument ) const = 0; + + //! Play a note using the specified instrument + /*! + \param instrument The instrument that should be played, in range [0, openmpt::module::get_num_instruments()[ if openmpt::module::get_num_instruments is not 0, otherwise in [0, openmpt::module::get_num_samples()[ + \param note The note to play, in rage [0, 119]. 60 is the middle C. + \param volume The volume at which the note should be triggered, in range [0.0, 1.0] + \param panning The panning position at which the note should be triggered, in range [-1.0, 1.0], 0.0 is center. + \return The channel on which the note is played. This can pe be passed to openmpt::ext::interactive::stop_note to stop the note. + \throws openmpt::exception Throws an exception derived from openmpt::exception if the instrument or note is outside the specified range. + \sa openmpt::ext::interactive::stop_note + */ + virtual std::int32_t play_note( std::int32_t instrument, std::int32_t note, double volume, double panning ) = 0; + + //! Stop the note playing on the specified channel + /*! + \param channel The channel on which the note should be stopped. + \throws openmpt::exception Throws an exception derived from openmpt::exception if the channel index is invalid. + \sa openmpt::ext::interactive::play_note + */ + virtual void stop_note( std::int32_t channel ) = 0; + +}; // class interactive + + +/* add stuff here */ + + + +#undef LIBOPENMPT_DECLARE_EXT_CXX_INTERFACE +#undef LIBOPENMPT_EXT_CXX_INTERFACE + +} // namespace ext + +} // namespace openmpt + +/*! + @} +*/ + +#endif // LIBOPENMPT_EXT_HPP diff --git a/libs/libopenmpt/inc/libopenmpt/libopenmpt_stream_callbacks_buffer.h b/libs/libopenmpt/inc/libopenmpt/libopenmpt_stream_callbacks_buffer.h new file mode 100644 index 000000000..575049e4d --- /dev/null +++ b/libs/libopenmpt/inc/libopenmpt/libopenmpt_stream_callbacks_buffer.h @@ -0,0 +1,198 @@ +/* + * libopenmpt_stream_callbacks_buffer.h + * ------------------------------------ + * Purpose: libopenmpt public c interface + * Notes : (currently none) + * Authors: OpenMPT Devs + * The OpenMPT source code is released under the BSD license. Read LICENSE for more details. + */ + +#ifndef LIBOPENMPT_STREAM_CALLBACKS_BUFFER_H +#define LIBOPENMPT_STREAM_CALLBACKS_BUFFER_H + +#include "libopenmpt.h" + +/* The use of this header requires: + +#include +#if defined( LIBOPENMPT_STREAM_CALLBACKS_BUFFER ) +#include +#else +#error "libopenmpt too old." +#endif + +*/ + +#include +#include +#include + +/*! \addtogroup libopenmpt_c + * @{ + */ + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct openmpt_stream_buffer { + const void * file_data; /* or prefix data IFF prefix_size < file_size */ + int64_t file_size; + int64_t file_pos; + int64_t prefix_size; + int overflow; +} openmpt_stream_buffer; + +static size_t openmpt_stream_buffer_read_func( void * stream, void * dst, size_t bytes ) { + openmpt_stream_buffer * s = (openmpt_stream_buffer*)stream; + int64_t offset = 0; + int64_t begpos = 0; + int64_t endpos = 0; + size_t valid_bytes = 0; + if ( !s ) { + return 0; + } + offset = bytes; + begpos = s->file_pos; + endpos = s->file_pos; + valid_bytes = 0; + endpos = (uint64_t)endpos + (uint64_t)offset; + if ( ( offset > 0 ) && !( (uint64_t)endpos > (uint64_t)begpos ) ) { + /* integer wrapped */ + return 0; + } + if ( bytes == 0 ) { + return 0; + } + if ( begpos >= s->file_size ) { + return 0; + } + if ( endpos > s->file_size ) { + /* clip to eof */ + bytes = bytes - (size_t)( endpos - s->file_size ); + endpos = endpos - ( endpos - s->file_size ); + } + memset( dst, 0, bytes ); + if ( begpos >= s->prefix_size ) { + s->overflow = 1; + valid_bytes = 0; + } else if ( endpos > s->prefix_size ) { + s->overflow = 1; + valid_bytes = bytes - (size_t)( endpos - s->prefix_size ); + } else { + valid_bytes = bytes; + } + memcpy( dst, (const char*)s->file_data + s->file_pos, valid_bytes ); + s->file_pos = s->file_pos + bytes; + return bytes; +} + +static int openmpt_stream_buffer_seek_func( void * stream, int64_t offset, int whence ) { + openmpt_stream_buffer * s = (openmpt_stream_buffer*)stream; + int result = -1; + if ( !s ) { + return -1; + } + switch ( whence ) { + case OPENMPT_STREAM_SEEK_SET: + if ( offset < 0 ) { + return -1; + } + if ( offset > s->file_size ) { + return -1; + } + s->file_pos = offset; + result = 0; + break; + case OPENMPT_STREAM_SEEK_CUR: + do { + int64_t oldpos = s->file_pos; + int64_t pos = s->file_pos; + pos = (uint64_t)pos + (uint64_t)offset; + if ( ( offset > 0 ) && !( (uint64_t)pos > (uint64_t)oldpos ) ) { + /* integer wrapped */ + return -1; + } + if ( ( offset < 0 ) && !( (uint64_t)pos < (uint64_t)oldpos ) ) { + /* integer wrapped */ + return -1; + } + s->file_pos = pos; + } while(0); + result = 0; + break; + case OPENMPT_STREAM_SEEK_END: + if ( offset > 0 ) { + return -1; + } + do { + int64_t oldpos = s->file_pos; + int64_t pos = s->file_pos; + pos = s->file_size; + pos = (uint64_t)pos + (uint64_t)offset; + if ( ( offset < 0 ) && !( (uint64_t)pos < (uint64_t)oldpos ) ) { + /* integer wrapped */ + return -1; + } + s->file_pos = pos; + } while(0); + result = 0; + break; + } + return result; +} + +static int64_t openmpt_stream_buffer_tell_func( void * stream ) { + openmpt_stream_buffer * s = (openmpt_stream_buffer*)stream; + if ( !s ) { + return -1; + } + return s->file_pos; +} + +static void openmpt_stream_buffer_init( openmpt_stream_buffer * buffer, const void * file_data, int64_t file_size ) { + memset( buffer, 0, sizeof( openmpt_stream_buffer ) ); + buffer->file_data = file_data; + buffer->file_size = file_size; + buffer->file_pos = 0; + buffer->prefix_size = file_size; + buffer->overflow = 0; +} + +#define openmpt_stream_buffer_init_prefix_only( buffer_, prefix_data_, prefix_size_, file_size_ ) do { \ + openmpt_stream_buffer_init( (buffer_), (prefix_data_), (file_size_) ); \ + (buffer_)->prefix_size = (prefix_size_); \ +} while(0) + +#define openmpt_stream_buffer_overflowed( buffer_ ) ( (buffer_)->overflow ) + +/*! \brief Provide openmpt_stream_callbacks for in-memoy buffers + * + * Fills openmpt_stream_callbacks suitable for passing an in-memory buffer as a stream parameter to functions doing file input/output. + * + * \remarks The stream argument must be passed as `(void*)(openmpt_stream_buffer*)stream_buffer`. + * \sa \ref libopenmpt_c_fileio + * \sa openmpt_stream_callbacks + * \sa openmpt_could_open_probability2 + * \sa openmpt_probe_file_header_from_stream + * \sa openmpt_module_create2 + */ +static openmpt_stream_callbacks openmpt_stream_get_buffer_callbacks(void) { + openmpt_stream_callbacks retval; + memset( &retval, 0, sizeof( openmpt_stream_callbacks ) ); + retval.read = openmpt_stream_buffer_read_func; + retval.seek = openmpt_stream_buffer_seek_func; + retval.tell = openmpt_stream_buffer_tell_func; + return retval; +} + +#ifdef __cplusplus +} +#endif + +/*! + * @} + */ + +#endif /* LIBOPENMPT_STREAM_CALLBACKS_BUFFER_H */ + diff --git a/libs/libopenmpt/inc/libopenmpt/libopenmpt_stream_callbacks_fd.h b/libs/libopenmpt/inc/libopenmpt/libopenmpt_stream_callbacks_fd.h new file mode 100644 index 000000000..46b39f129 --- /dev/null +++ b/libs/libopenmpt/inc/libopenmpt/libopenmpt_stream_callbacks_fd.h @@ -0,0 +1,101 @@ +/* + * libopenmpt_stream_callbacks_fd.h + * -------------------------------- + * Purpose: libopenmpt public c interface + * Notes : (currently none) + * Authors: OpenMPT Devs + * The OpenMPT source code is released under the BSD license. Read LICENSE for more details. + */ + +#ifndef LIBOPENMPT_STREAM_CALLBACKS_FD_H +#define LIBOPENMPT_STREAM_CALLBACKS_FD_H + +#include "libopenmpt.h" + +#ifdef _MSC_VER +#include +#endif +#include +#include +#include +#include +#ifndef _MSC_VER +#include +#endif + +/*! \addtogroup libopenmpt_c + * @{ + */ + +#ifdef __cplusplus +extern "C" { +#endif + +/* This stuff has to be in a header file because of possibly different MSVC CRTs which cause problems for fd crossing CRT boundaries. */ + +static size_t openmpt_stream_fd_read_func( void * stream, void * dst, size_t bytes ) { + int fd = 0; + #if defined(_MSC_VER) + size_t retval = 0; + int to_read = 0; + int ret_read = 0; + #else + ssize_t retval = 0; + #endif + fd = (int)(uintptr_t)stream; + if ( fd < 0 ) { + return 0; + } + #if defined(_MSC_VER) + retval = 0; + while ( bytes > 0 ) { + to_read = 0; + if ( bytes < (size_t)INT_MAX ) { + to_read = (int)bytes; + } else { + to_read = INT_MAX; + } + ret_read = _read( fd, dst, to_read ); + if ( ret_read <= 0 ) { + return retval; + } + bytes -= ret_read; + retval += ret_read; + } + #else + retval = read( fd, dst, bytes ); + #endif + if ( retval <= 0 ) { + return 0; + } + return retval; +} + +/*! \brief Provide openmpt_stream_callbacks for standard POSIX file descriptors + * + * Fills openmpt_stream_callbacks suitable for passing a POSIX filer descriptor as a stream parameter to functions doing file input/output. + * + * \remarks The stream argument must be passed as `(void*)(uintptr_t)(int)fd`. + * \sa \ref libopenmpt_c_fileio + * \sa openmpt_stream_callbacks + * \sa openmpt_could_open_probability2 + * \sa openmpt_probe_file_header_from_stream + * \sa openmpt_module_create2 + */ +static openmpt_stream_callbacks openmpt_stream_get_fd_callbacks(void) { + openmpt_stream_callbacks retval; + memset( &retval, 0, sizeof( openmpt_stream_callbacks ) ); + retval.read = openmpt_stream_fd_read_func; + return retval; +} + +#ifdef __cplusplus +} +#endif + +/*! + * @} + */ + +#endif /* LIBOPENMPT_STREAM_CALLBACKS_FD_H */ + diff --git a/libs/libopenmpt/inc/libopenmpt/libopenmpt_stream_callbacks_file.h b/libs/libopenmpt/inc/libopenmpt/libopenmpt_stream_callbacks_file.h new file mode 100644 index 000000000..643049153 --- /dev/null +++ b/libs/libopenmpt/inc/libopenmpt/libopenmpt_stream_callbacks_file.h @@ -0,0 +1,132 @@ +/* + * libopenmpt_stream_callbacks_file.h + * ---------------------------------- + * Purpose: libopenmpt public c interface + * Notes : (currently none) + * Authors: OpenMPT Devs + * The OpenMPT source code is released under the BSD license. Read LICENSE for more details. + */ + +#ifndef LIBOPENMPT_STREAM_CALLBACKS_FILE_H +#define LIBOPENMPT_STREAM_CALLBACKS_FILE_H + +#include "libopenmpt.h" + +#include +#include +#include +#include +#ifdef _MSC_VER +#include /* off_t */ +#endif + +/*! \addtogroup libopenmpt_c + * @{ + */ + +#ifdef __cplusplus +extern "C" { +#endif + +/* This stuff has to be in a header file because of possibly different MSVC CRTs which cause problems for FILE * crossing CRT boundaries. */ + +static size_t openmpt_stream_file_read_func( void * stream, void * dst, size_t bytes ) { + FILE * f = 0; + size_t retval = 0; + f = (FILE*)stream; + if ( !f ) { + return 0; + } + retval = fread( dst, 1, bytes, f ); + if ( retval <= 0 ) { + return 0; + } + return retval; +} + +static int openmpt_stream_file_seek_func( void * stream, int64_t offset, int whence ) { + FILE * f = 0; + int fwhence = 0; + f = (FILE*)stream; + if ( !f ) { + return -1; + } + switch ( whence ) { +#if defined(SEEK_SET) + case OPENMPT_STREAM_SEEK_SET: + fwhence = SEEK_SET; + break; +#endif +#if defined(SEEK_CUR) + case OPENMPT_STREAM_SEEK_CUR: + fwhence = SEEK_CUR; + break; +#endif +#if defined(SEEK_END) + case OPENMPT_STREAM_SEEK_END: + fwhence = SEEK_END; + break; +#endif + default: + return -1; + break; + } + #if defined(_MSC_VER) + return _fseeki64( f, offset, fwhence ) ? -1 : 0; + #elif defined(_POSIX_SOURCE) && (_POSIX_SOURCE == 1) + return fseeko( f, offset, fwhence ) ? -1 : 0; + #else + return fseek( f, offset, fwhence ) ? -1 : 0; + #endif +} + +static int64_t openmpt_stream_file_tell_func( void * stream ) { + FILE * f = 0; + int64_t retval = 0; + f = (FILE*)stream; + if ( !f ) { + return -1; + } + #if defined(_MSC_VER) + retval = _ftelli64( f ); + #elif defined(_POSIX_SOURCE) && (_POSIX_SOURCE == 1) + retval = ftello( f ); + #else + retval = ftell( f ); + #endif + if ( retval < 0 ) { + return -1; + } + return retval; +} + +/*! \brief Provide openmpt_stream_callbacks for standard C FILE objects + * + * Fills openmpt_stream_callbacks suitable for passing a standard C FILE object as a stream parameter to functions doing file input/output. + * + * \remarks The stream argument must be passed as `(void*)(FILE*)file`. + * \sa \ref libopenmpt_c_fileio + * \sa openmpt_stream_callbacks + * \sa openmpt_could_open_probability2 + * \sa openmpt_probe_file_header_from_stream + * \sa openmpt_module_create2 + */ +static openmpt_stream_callbacks openmpt_stream_get_file_callbacks(void) { + openmpt_stream_callbacks retval; + memset( &retval, 0, sizeof( openmpt_stream_callbacks ) ); + retval.read = openmpt_stream_file_read_func; + retval.seek = openmpt_stream_file_seek_func; + retval.tell = openmpt_stream_file_tell_func; + return retval; +} + +#ifdef __cplusplus +} +#endif + +/*! + * @} + */ + +#endif /* LIBOPENMPT_STREAM_CALLBACKS_FILE_H */ + diff --git a/libs/libopenmpt/inc/libopenmpt/libopenmpt_version.h b/libs/libopenmpt/inc/libopenmpt/libopenmpt_version.h new file mode 100644 index 000000000..5ca7f21d0 --- /dev/null +++ b/libs/libopenmpt/inc/libopenmpt/libopenmpt_version.h @@ -0,0 +1,75 @@ +/* + * libopenmpt_version.h + * -------------------- + * Purpose: libopenmpt public interface version + * Notes : (currently none) + * Authors: OpenMPT Devs + * The OpenMPT source code is released under the BSD license. Read LICENSE for more details. + */ + +#ifndef LIBOPENMPT_VERSION_H +#define LIBOPENMPT_VERSION_H + +/*! \addtogroup libopenmpt + @{ +*/ + +/*! \brief libopenmpt major version number */ +#define OPENMPT_API_VERSION_MAJOR 0 +/*! \brief libopenmpt minor version number */ +#define OPENMPT_API_VERSION_MINOR 4 +/*! \brief libopenmpt patch version number */ +#define OPENMPT_API_VERSION_PATCH 4 +/*! \brief libopenmpt pre-release tag */ +#define OPENMPT_API_VERSION_PREREL "" +/*! \brief libopenmpt pre-release flag */ +#define OPENMPT_API_VERSION_IS_PREREL 0 + +/*! \brief libopenmpt version number as a single integer value + * \since 0.3 + * \remarks Use the following shim if you need to support earlier libopenmpt versions: + * \code + * #include + * #if !defined(OPENMPT_API_VERSION_MAKE) + * #define OPENMPT_API_VERSION_MAKE(major, minor, patch) (((major)<<24)|((minor)<<16)|((patch)<<0)) + * #endif + * \endcode + */ +#define OPENMPT_API_VERSION_MAKE(major, minor, patch) (((major)<<24)|((minor)<<16)|((patch)<<0)) + +/*! \brief libopenmpt API version number */ +#define OPENMPT_API_VERSION OPENMPT_API_VERSION_MAKE(OPENMPT_API_VERSION_MAJOR, OPENMPT_API_VERSION_MINOR, OPENMPT_API_VERSION_PATCH) + +/*! \brief Check whether the libopenmpt API is at least the provided version + * \since 0.3 + * \remarks Use the following shim if you need to support earlier libopenmpt versions: + * \code + * #include + * #if !defined(OPENMPT_API_VERSION_AT_LEAST) + * #define OPENMPT_API_VERSION_AT_LEAST(major, minor, patch) (OPENMPT_API_VERSION >= OPENMPT_API_VERSION_MAKE((major), (minor), (patch))) + * #endif + * \endcode + */ +#define OPENMPT_API_VERSION_AT_LEAST(major, minor, patch) (OPENMPT_API_VERSION >= OPENMPT_API_VERSION_MAKE((major), (minor), (patch))) + +/*! \brief Check whether the libopenmpt API is before the provided version + * \since 0.3 + * \remarks Use the following shim if you need to support earlier libopenmpt versions: + * \code + * #include + * #if !defined(OPENMPT_API_VERSION_BEFORE) + * #define OPENMPT_API_VERSION_BEFORE(major, minor, patch) (OPENMPT_API_VERSION < OPENMPT_API_VERSION_MAKE((major), (minor), (patch))) + * #endif + * \endcode + */ +#define OPENMPT_API_VERSION_BEFORE(major, minor, patch) (OPENMPT_API_VERSION < OPENMPT_API_VERSION_MAKE((major), (minor), (patch))) + +#define OPENMPT_API_VERSION_HELPER_STRINGIZE(x) #x +#define OPENMPT_API_VERSION_STRINGIZE(x) OPENMPT_API_VERSION_HELPER_STRINGIZE(x) +#define OPENMPT_API_VERSION_STRING OPENMPT_API_VERSION_STRINGIZE(OPENMPT_API_VERSION_MAJOR) "." OPENMPT_API_VERSION_STRINGIZE(OPENMPT_API_VERSION_MINOR) "." OPENMPT_API_VERSION_STRINGIZE(OPENMPT_API_VERSION_PATCH) OPENMPT_API_VERSION_PREREL + +/*! + @} +*/ + +#endif /* LIBOPENMPT_VERSION_H */ diff --git a/libs/libopenmpt/lib/x86/libopenmpt.lib b/libs/libopenmpt/lib/x86/libopenmpt.lib new file mode 100644 index 000000000..3f814528a Binary files /dev/null and b/libs/libopenmpt/lib/x86/libopenmpt.lib differ diff --git a/libs/libopenmpt/lib/x86/mingw/libopenmpt.dll.a b/libs/libopenmpt/lib/x86/mingw/libopenmpt.dll.a new file mode 100644 index 000000000..e3fa0c58f Binary files /dev/null and b/libs/libopenmpt/lib/x86/mingw/libopenmpt.dll.a differ diff --git a/libs/libopenmpt/lib/x86_64/libopenmpt.lib b/libs/libopenmpt/lib/x86_64/libopenmpt.lib new file mode 100644 index 000000000..75e3849fa Binary files /dev/null and b/libs/libopenmpt/lib/x86_64/libopenmpt.lib differ diff --git a/libs/libopenmpt/lib/x86_64/mingw/libopenmpt.dll.a b/libs/libopenmpt/lib/x86_64/mingw/libopenmpt.dll.a new file mode 100644 index 000000000..729403722 Binary files /dev/null and b/libs/libopenmpt/lib/x86_64/mingw/libopenmpt.dll.a differ diff --git a/objs/DC/SDL/Debug/.gitignore b/objs/DC/SDL/Debug/.gitignore deleted file mode 100644 index 42c6dc2c6..000000000 --- a/objs/DC/SDL/Debug/.gitignore +++ /dev/null @@ -1,2 +0,0 @@ -# DON'T REMOVE -# This keeps the folder from disappearing diff --git a/objs/DC/SDL/Release/.gitignore b/objs/DC/SDL/Release/.gitignore deleted file mode 100644 index 42c6dc2c6..000000000 --- a/objs/DC/SDL/Release/.gitignore +++ /dev/null @@ -1,2 +0,0 @@ -# DON'T REMOVE -# This keeps the folder from disappearing diff --git a/objs/PS3/SDL/Debug/.gitignore b/objs/PS3/SDL/Debug/.gitignore deleted file mode 100644 index 42c6dc2c6..000000000 --- a/objs/PS3/SDL/Debug/.gitignore +++ /dev/null @@ -1,2 +0,0 @@ -# DON'T REMOVE -# This keeps the folder from disappearing diff --git a/objs/PS3/SDL/Release/.gitignore b/objs/PS3/SDL/Release/.gitignore deleted file mode 100644 index 42c6dc2c6..000000000 --- a/objs/PS3/SDL/Release/.gitignore +++ /dev/null @@ -1,2 +0,0 @@ -# DON'T REMOVE -# This keeps the folder from disappearing diff --git a/objs/PSP/SDL/Release/.gitignore b/objs/PSP/SDL/Release/.gitignore deleted file mode 100644 index 42c6dc2c6..000000000 --- a/objs/PSP/SDL/Release/.gitignore +++ /dev/null @@ -1,2 +0,0 @@ -# DON'T REMOVE -# This keeps the folder from disappearing diff --git a/objs/Wii/SDL/Debug/.gitignore b/objs/Wii/SDL/Debug/.gitignore deleted file mode 100644 index 42c6dc2c6..000000000 --- a/objs/Wii/SDL/Debug/.gitignore +++ /dev/null @@ -1,2 +0,0 @@ -# DON'T REMOVE -# This keeps the folder from disappearing diff --git a/objs/Wii/SDL/Release/.gitignore b/objs/Wii/SDL/Release/.gitignore deleted file mode 100644 index 42c6dc2c6..000000000 --- a/objs/Wii/SDL/Release/.gitignore +++ /dev/null @@ -1,2 +0,0 @@ -# DON'T REMOVE -# This keeps the folder from disappearing diff --git a/objs/WinCE/SDL/Release/.gitignore b/objs/WinCE/SDL/Release/.gitignore deleted file mode 100644 index 42c6dc2c6..000000000 --- a/objs/WinCE/SDL/Release/.gitignore +++ /dev/null @@ -1,2 +0,0 @@ -# DON'T REMOVE -# This keeps the folder from disappearing diff --git a/objs/XBOX/SDL/Debug/.gitignore b/objs/XBOX/SDL/Debug/.gitignore deleted file mode 100644 index 42c6dc2c6..000000000 --- a/objs/XBOX/SDL/Debug/.gitignore +++ /dev/null @@ -1,2 +0,0 @@ -# DON'T REMOVE -# This keeps the folder from disappearing diff --git a/objs/XBOX/SDL/Release/.gitignore b/objs/XBOX/SDL/Release/.gitignore deleted file mode 100644 index 42c6dc2c6..000000000 --- a/objs/XBOX/SDL/Release/.gitignore +++ /dev/null @@ -1,2 +0,0 @@ -# DON'T REMOVE -# This keeps the folder from disappearing diff --git a/objs/nds/Debug/.gitignore b/objs/nds/Debug/.gitignore deleted file mode 100644 index 42c6dc2c6..000000000 --- a/objs/nds/Debug/.gitignore +++ /dev/null @@ -1,2 +0,0 @@ -# DON'T REMOVE -# This keeps the folder from disappearing diff --git a/objs/nds/Release/.gitignore b/objs/nds/Release/.gitignore deleted file mode 100644 index 42c6dc2c6..000000000 --- a/objs/nds/Release/.gitignore +++ /dev/null @@ -1,2 +0,0 @@ -# DON'T REMOVE -# This keeps the folder from disappearing diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 85cda35f6..fb1bd8afb 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -123,6 +123,7 @@ set(SRB2_CORE_RENDER_SOURCES r_sky.c r_splats.c r_things.c + r_portal.c r_bsp.h r_data.h @@ -136,6 +137,7 @@ set(SRB2_CORE_RENDER_SOURCES r_splats.h r_state.h r_things.h + r_portal.h ) set(SRB2_CORE_GAME_SOURCES @@ -218,6 +220,8 @@ set(SRB2_CONFIG_HAVE_ZLIB ON CACHE BOOL "Enable zlib support.") set(SRB2_CONFIG_HAVE_GME ON CACHE BOOL "Enable GME support.") +set(SRB2_CONFIG_HAVE_OPENMPT ON CACHE BOOL + "Enable OpenMPT support.") set(SRB2_CONFIG_HWRENDER ON CACHE BOOL "Enable hardware rendering through OpenGL.") set(SRB2_CONFIG_USEASM OFF CACHE BOOL @@ -230,7 +234,7 @@ set(SRB2_CONFIG_STATIC_OPENGL OFF CACHE BOOL ### use internal libraries? if(${CMAKE_SYSTEM} MATCHES "Windows") ###set on Windows only set(SRB2_CONFIG_USE_INTERNAL_LIBRARIES OFF CACHE BOOL - "Use SRB2's internal copies of required dependencies (SDL2, PNG, zlib, GME).") + "Use SRB2's internal copies of required dependencies (SDL2, PNG, zlib, GME, OpenMPT).") endif() if(${SRB2_CONFIG_HAVE_BLUA}) @@ -340,6 +344,26 @@ if(${SRB2_CONFIG_HAVE_GME}) endif() endif() +if(${SRB2_CONFIG_HAVE_OPENMPT}) + if(${SRB2_CONFIG_USE_INTERNAL_LIBRARIES}) + set(OPENMPT_FOUND ON) + set(OPENMPT_INCLUDE_DIRS ${CMAKE_SOURCE_DIR}/libs/libopenmpt/inc) + if(${SRB2_SYSTEM_BITS} EQUAL 64) + set(OPENMPT_LIBRARIES "-L${CMAKE_SOURCE_DIR}/libs/libopenmpt/lib/x86_64/mingw -lopenmpt") + else() # 32-bit + set(OPENMPT_LIBRARIES "-L${CMAKE_SOURCE_DIR}/libs/libopenmpt/lib/x86/mingw -lopenmpt") + endif() + else() + find_package(OPENMPT) + endif() + if(${OPENMPT_FOUND}) + set(SRB2_HAVE_OPENMPT ON) + add_definitions(-DHAVE_OPENMPT) + else() + message(WARNING "You have specified that OpenMPT is available but it was not found.") + endif() +endif() + if(${SRB2_CONFIG_HAVE_ZLIB}) if(${SRB2_CONFIG_USE_INTERNAL_LIBRARIES}) set(ZLIB_FOUND ON) diff --git a/src/Makefile b/src/Makefile index 6f7927077..e43c38f67 100644 --- a/src/Makefile +++ b/src/Makefile @@ -34,8 +34,6 @@ # compile all HW render and 3D sound DLLs for the set # opengl_dll # Pure Mingw only, compile OpenGL HW render DLL -# minigl_dll -# Pure Mingw only, compile MiniGL HW render DLL # ds3d_dll # Pure Mingw only, compile DirectX DirectSound HW sound DLL # fmod_dll @@ -74,6 +72,7 @@ # Compile without BSD API, add 'NONET=1' # Compile without IPX/SPX, add 'NOIPX=1' # Compile Mingw/SDL with S_DS3S, add 'DS3D=1' +# Compile without libopenmpt, add 'NOOPENMPT=1' # Compile with S_FMOD3D, add 'FMOD=1' (WIP) # Compile with S_OPENAL, add 'OPENAL=1' (WIP) # To link with the whole SDL_Image lib to load Icons, add 'SDL_IMAGE=1' but it isn't not realy needed @@ -83,7 +82,7 @@ # SRB2 data files D_DIR?=../bin/Resources -D_FILES=$(D_DIR)/srb2.srb \ +D_FILES=$(D_DIR)/srb2.pk3 \ $(D_DIR)/player.dta \ $(D_DIR)/rings.wpn \ $(D_DIR)/drill.dta \ @@ -93,10 +92,6 @@ D_FILES=$(D_DIR)/srb2.srb \ PKG_CONFIG?=pkg-config -ifdef WIILINUX -LINUX=1 -endif - ifdef PANDORA LINUX=1 endif @@ -120,12 +115,6 @@ ifdef HAIKU SDL=1 endif -ifdef NDS -# Include this before the main Makefile.cfg -EXENAME?=srb2.elf -include nds/Makefile.cfg -endif - include Makefile.cfg ifdef DUMMY @@ -152,36 +141,20 @@ PNG_CFLAGS?= PNG_LDFLAGS?=-lpng endif -ifdef WIILINUX -NONX86=1 -NOTERMIOS=1 -NOHW=1 -CFLAGS+=-DWMINPUT -NOTERMIOS=1 -NOPOSTPROCESSING=1 -endif - ifdef PANDORA NONX86=1 NOHW=1 NOHS=1 endif -ifdef WII -NONX86=1 -NOHW=1 -NOPOSTPROCESSING=1 -endif - -ifdef PS3N -NONX86=1 -NOHW=1 -endif - ifdef DJGPPDOS include djgppdos/Makefile.cfg endif +ifndef NOOPENMPT +HAVE_OPENMPT=1 +endif + ifdef MINGW include win32/Makefile.cfg endif #ifdef MINGW @@ -209,27 +182,8 @@ ifdef MACOSX UNIXCOMMON=1 endif -ifdef NDS -NOPNG=1 -NOZLIB=1 -NONET=1 -#NOHW=1 -NOHS=1 -NOASM=1 -NOIPX=1 -NONX86=1 -OBJS+=$(OBJDIR)/i_video.o -LIBS+=-lm -endif - ifdef SDL -#SDL 2.0 -ifndef SDL12 include sdl/Makefile.cfg -#SDL 1.2 -else - include sdl12/Makefile.cfg -endif #ifndef SDL12 endif #ifdef SDL ifdef DISTCC @@ -251,11 +205,7 @@ ifndef ECHO OBJDUMP:=@$(OBJDUMP) STRIP:=@$(STRIP) WINDRES:=@$(WINDRES) - CP:=@$(CP) MKDIR:=@$(MKDIR) - MKISOFS:=@$(MKISOFS) - DD:=@$(DD) - NDSTOOL:=@$(NDSTOOL) GZIP:=@$(GZIP) MSGFMT:=@$(MSGFMT) UPX:=@$(UPX) @@ -273,10 +223,8 @@ endif ifdef NOHW OPTS+=-DNOHW else -ifndef DC #Hurdler: not really supported and not tested recently #OPTS+=-DUSE_PALETTED_TEXTURE -endif OPTS+=-DHWRENDER OBJS+=$(OBJDIR)/hw_bsp.o $(OBJDIR)/hw_draw.o $(OBJDIR)/hw_light.o \ $(OBJDIR)/hw_main.o $(OBJDIR)/hw_clip.o $(OBJDIR)/hw_md2.o $(OBJDIR)/hw_cache.o $(OBJDIR)/hw_trick.o \ @@ -354,6 +302,17 @@ LIBS+=$(LIBGME_LDFLAGS) CFLAGS+=$(LIBGME_CFLAGS) endif +ifdef HAVE_OPENMPT +OPTS+=-DHAVE_OPENMPT + +LIBOPENMPT_PKGCONFIG?=libopenmpt +LIBOPENMPT_CFLAGS?=$(shell $(PKG_CONFIG) $(LIBOPENMPT_PKGCONFIG) --cflags) +LIBOPENMPT_LDFLAGS?=$(shell $(PKG_CONFIG) $(LIBOPENMPT_PKGCONFIG) --libs) + +LIBS+=$(LIBOPENMPT_LDFLAGS) +CFLAGS+=$(LIBOPENMPT_CFLAGS) +endif + ifndef NOZLIB OPTS+=-DHAVE_ZLIB ZLIB_PKGCONFIG?=zlib @@ -392,14 +351,6 @@ else OBJS:=$(OBJDIR)/md5.o $(OBJS) endif -ifdef FAKEDC - OPTS+=-DDC -endif - -ifdef FAKEPSP - OPTS+=-DPSP -endif - ifdef NOPOSTPROCESSING OPTS+=-DNOPOSTPROCESSING endif @@ -521,6 +472,7 @@ OBJS:=$(i_main_o) \ $(OBJDIR)/r_sky.o \ $(OBJDIR)/r_splats.o \ $(OBJDIR)/r_things.o \ + $(OBJDIR)/r_portal.o \ $(OBJDIR)/screen.o \ $(OBJDIR)/v_video.o \ $(OBJDIR)/s_sound.o \ @@ -552,49 +504,20 @@ ifdef DJGPPDOS all: pre-build $(BIN)/$(EXENAME) endif -ifdef XBOX -all: pre-build $(BIN)/$(BINNAME) -endif - -ifdef PS3N -all: pre-build $(BIN)/$(PKGNAME) -endif - -ifdef WII -all: pre-build $(BIN)/$(DOLNAME) -endif - ifdef PANDORA all: pre-build $(BIN)/$(PNDNAME) endif -ifdef PSP -all: pre-build $(BIN)/$(BINNAME) post-build -endif -ifdef DC -all: pre-build $(BIN)/$(BINNAME) post-build -endif - -ifndef DC -ifndef PSP -ifndef XBOX ifdef MINGW ifndef SDL all: pre-build $(BIN)/$(EXENAME) dll endif endif -endif -endif ifdef SDL all: pre-build $(BIN)/$(EXENAME) endif -endif - -ifdef NDS -all: $(BIN)/$(EXENAME:.elf=.nds) -endif ifdef DUMMY all: $(BIN)/$(EXENAME) @@ -648,12 +571,10 @@ endif # mac os x lsdlsrb2 does not like objcopy ifndef MACOSX -ifndef PSP $(OBJCOPY) $(BIN)/$(EXENAME) $(BIN)/$(DBGNAME) $(OBJCOPY) --strip-debug $(BIN)/$(EXENAME) -$(OBJCOPY) --add-gnu-debuglink=$(BIN)/$(DBGNAME) $(BIN)/$(EXENAME) endif -endif ifndef NOUPX -$(UPX) $(UPX_OPTS) $(BIN)/$(EXENAME) endif @@ -678,7 +599,7 @@ else dll : opengl_dll endif ifdef MINGW -all_dll: opengl_dll minigl_dll ds3d_dll fmod_dll openal_dll +all_dll: opengl_dll ds3d_dll fmod_dll openal_dll opengl_dll: $(BIN)/r_opengl.dll $(BIN)/r_opengl.dll: $(OBJDIR)/ogl_win.o $(OBJDIR)/r_opengl.o @@ -689,12 +610,6 @@ ifndef NOUPX -$(UPX) $(UPX_OPTS) $@ endif -minigl_dll: $(BIN)/r_minigl.dll -$(BIN)/r_minigl.dll: $(OBJDIR)/r_minigl.o - -$(MKDIR) $(BIN) - @echo Linking R_MiniGL.dll... - $(CC) --shared $^ -o $@ -g -Wl,--add-stdcall-alias -lgdi32 - ds3d_dll: $(BIN)/s_ds3d.dll $(BIN)/s_ds3d.dll: $(OBJDIR)/s_ds3d.o @echo Linking S_DS3d.dll... @@ -774,16 +689,6 @@ endif $(REMOVE) $(OBJDIR)/depend.ped @echo "Created dependency file, depend.dep" -ifdef DC -$(OBJDIR)/v_video.o: v_video.c doomdef.h doomtype.h g_state.h m_swap.h r_local.h \ - tables.h m_fixed.h screen.h command.h m_bbox.h r_main.h d_player.h \ - p_pspr.h info.h d_think.h sounds.h p_mobj.h doomdata.h d_ticcmd.h \ - r_data.h r_defs.h r_state.h r_bsp.h r_segs.h r_plane.h r_sky.h \ - r_things.h r_draw.h v_video.h hu_stuff.h d_event.h w_wad.h console.h \ - i_video.h z_zone.h doomstat.h d_clisrv.h d_netcmd.h - $(CC) $(CFLAGS) -fno-omit-frame-pointer $(WFLAGS) -c $< -o $@ -endif - ifdef VALGRIND $(OBJDIR)/z_zone.o: z_zone.c $(CC) $(CFLAGS) $(WFLAGS) -DHAVE_VALGRIND $(VALGRIND_CFLAGS) -c $< -o $@ @@ -825,70 +730,6 @@ $(OBJDIR)/%.o: %.s $(OBJDIR)/SRB2.res: win32/Srb2win.rc win32/afxres.h win32/resource.h $(WINDRES) -i $< -O rc $(WINDRESFLAGS) --include-dir=win32 -o $@ -O coff -ifdef DC -$(OBJDIR)/romdisk.img: - $(KOS_GENROMFS) -f romdisk.img -d ../data -v - -$(OBJDIR)/romdisk.o: romdisk.img - $(KOS_BASE)/utils/bin2o/bin2o romdisk.img romdisk romdisk.o - -$(OBJDIR)/dchelp.o: $(INTERFACE)/SRB2DC/dchelp.c - $(CC) $(CFLAGS) $(WFLAGS) -c $< -o $@ - -$(OBJDIR)/i_udp.o: $(INTERFACE)/SRB2DC/i_udp.c - $(CC) $(CFLAGS) $(WFLAGS) -c $< -o $@ - -$(BIN)/IP.BIN: $(INTERFACE)/SRB2DC/IP.BIN - $(CP) $< $@ - -$(BIN)/SRB2DC.cdi.pass1: $(INTERFACE)/SRB2DC/SELFBOOT.BIN - $(CP) $< $@ - -$(BIN)/$(BINNAME): $(BIN)/$(EXENAME) - $(KOS_OBJCOPY) -R .stack -O binary $< $@ - -$(BIN)/1ST_READ.BIN: $(BIN)/$(BINNAME) $(BIN)/scramble - $(BIN)/scramble $< $@ - -$(BIN)/scramble: $(INTERFACE)/SRB2DC/scramble.c - -$(MKDIR) $(BIN) - $(HOSTCC) $< -o $@ - -iso: $(BIN)/SRB2DC.iso -cdi: $(BIN)/SRB2DC.cdi - -$(BIN)/SRB2DC.iso.pass1: $(BIN)/1ST_READ.BIN $(BIN)/IP.BIN - -$(MKDIR) $(BIN)/cdrom - $(CP) $(BIN)/1ST_READ.BIN $(D_FILES) $(BIN)/cdrom - $(MKISOFS) -l -r -o $@ $(BIN)/cdrom - -$(BIN)/SRB2DC.iso.pass2: $(BIN)/SRB2DC.iso.pass1 - $(DD) if=$< of=$@ bs=2048 skip=16 status=noxfer - -$(BIN)/SRB2DC.iso: $(BIN)/SRB2DC.iso.pass2 $(BIN)/IP.BIN - @cat $(BIN)/IP.BIN $(BIN)/SRB2DC.iso.pass2 > $@ - -$(BIN)/SRB2DC.cdi: $(BIN)/SRB2DC.iso.pass2 $(BIN)/SRB2DC.cdi.pass1 $(BIN)/IP.BIN - @cat $(BIN)/SRB2DC.cdi.pass1 $(BIN)/IP.BIN $(BIN)/SRB2DC.iso.pass2 > $@ - -post-build: $(BIN)/1ST_READ.BIN -endif - -ifdef XBOX -$(OBJDIR)/xboxhelp.o: $(INTERFACE)/SRB2XBOX/xboxhelp.c - $(CC) $(CFLAGS) $(WFLAGS) -c $< -o $@ - -$(BIN)/$(BINNAME): $(BIN)/$(EXENAME) - $(CXBE) -OUT:"$@" -DUMPINFO:"$(BIN)/SRB2XBOX.cxbe" -TITLE:"Sonic Robo Blast 2" $< -endif - -ifdef NDS -$(BIN)/$(EXENAME:.elf=.nds): $(BIN)/$(EXENAME:.elf=.arm9) - $(NDSTOOL) -c $@ -9 $(BIN)/$(EXENAME:.elf=.arm9) - -%.arm9: %.elf - $(OBJCOPY) -O binary $< $@ -endif ifdef MINGW ifndef SDL @@ -910,15 +751,6 @@ $(OBJDIR)/ogl_win.o: hardware/r_opengl/ogl_win.c hardware/r_opengl/r_opengl.h \ am_map.h d_event.h d_player.h p_pspr.h m_fixed.h tables.h info.h d_think.h \ p_mobj.h doomdata.h d_ticcmd.h r_defs.h hardware/hw_dll.h $(CC) $(CFLAGS) $(WFLAGS) -D_WINDOWS -mwindows -c $< -o $@ - -$(OBJDIR)/r_minigl.o: hardware/r_minigl/r_minigl.c hardware/r_opengl/r_opengl.h \ - doomdef.h doomtype.h g_state.h m_swap.h hardware/hw_drv.h screen.h \ - command.h hardware/hw_data.h hardware/hw_glide.h hardware/hw_defs.h \ - hardware/hw_md2.h hardware/hw_glob.h hardware/hw_main.h hardware/hw_clip.h \ - hardware/hw_md2load.h hardware/hw_md3load.h hardware/hw_model.h hardware/u_list.h \ - am_map.h d_event.h d_player.h p_pspr.h m_fixed.h tables.h info.h d_think.h \ - p_mobj.h doomdata.h d_ticcmd.h r_defs.h hardware/hw_dll.h - $(CC) $(CFLAGS) $(WFLAGS) -D_WINDOWS -mwindows -c $< -o $@ endif ifndef NOHS @@ -968,25 +800,6 @@ $(OBJDIR)/s_openal.o: hardware/s_openal/s_openal.c hardware/hw3dsdrv.h \ hardware/hw_dll.h $(CC) $(ARCHOPTS) -Os -o $(OBJDIR)/s_openal.o -DHW3SOUND -DUNIXCOMMON -shared -nostartfiles -c hardware/s_openal/s_openal.c endif - -ifdef FILTERS -$(OBJDIR)/%.o: $(INTERFACE)/filter/%.c - @echo $< needs deps - $(CC) $(CFLAGS) $(WFLAGS) -c $< -o $@ - -$(OBJDIR)/filters.o: $(INTERFACE)/filter/filters.c $(INTERFACE)/filter/filters.c \ - $(INTERFACE)/filter/filters.h - $(CC) $(CFLAGS) $(WFLAGS) -c $< -o $@ - -$(OBJDIR)/hq2x.o: $(INTERFACE)/filter/hq2x.c $(INTERFACE)/filter/hq2x.c \ - $(INTERFACE)/filter/filters.h - $(CC) $(CFLAGS) $(WFLAGS) -c $< -o $@ - -$(OBJDIR)/lq2x.o: $(INTERFACE)/filter/lq2x.c $(INTERFACE)/filter/lq2x.c \ - $(INTERFACE)/filter/filters.h $(INTERFACE)/filter/interp.h \ - $(INTERFACE)/filter/hq2x.h $(INTERFACE)/filter/lq2x.h - $(CC) $(CFLAGS) $(WFLAGS) -c $< -o $@ -endif endif ############################################################# diff --git a/src/Makefile.cfg b/src/Makefile.cfg index a0398154a..2b05b7097 100644 --- a/src/Makefile.cfg +++ b/src/Makefile.cfg @@ -96,10 +96,6 @@ ifdef GCC295 GCC29=1 endif -ifdef DC -NOCASTALIGNWARN=1 -endif - OLDWFLAGS:=$(WFLAGS) # -W -Wno-unused WFLAGS=-Wall @@ -159,15 +155,11 @@ endif ifdef GCC40 WFLAGS+=-Wold-style-definition endif -ifndef XBOX WFLAGS+=-Wmissing-prototypes -Wmissing-declarations -endif ifdef GCC40 WFLAGS+=-Wmissing-field-initializers endif -ifndef XBOX WFLAGS+=-Wmissing-noreturn -endif #WFLAGS+=-Wmissing-format-attribute #WFLAGS+=-Wno-multichar #WFLAGS+=-Wno-deprecated-declarations @@ -235,19 +227,12 @@ endif #indicate platform and what interface use with -ifndef WINCE -ifndef XBOX -ifndef PSP -ifndef DC -ifndef WII -ifndef PS3N ifndef LINUX ifndef FREEBSD ifndef CYGWIN32 ifndef MINGW ifndef MINGW64 ifndef SDL -ifndef NDS ifndef DUMMY DJGPPDOS=1 endif @@ -257,13 +242,6 @@ endif endif endif endif -endif -endif -endif -endif -endif -endif -endif #determine the interface directory (where you put all i_*.c) i_cdmus_o=$(OBJDIR)/i_cdmus.o @@ -281,10 +259,7 @@ else NASM?=nasm endif REMOVE?=rm -f -CP?=cp MKDIR?=mkdir -p -MKISOFS?=mkisofs -DD?=dd GZIP?=gzip GZIP_OPTS?=-9 -f -n GZIP_OPT2=$(GZIP_OPTS) --rsyncable @@ -351,79 +326,11 @@ ifdef MINGW64 OBJDIR:=$(OBJDIR)/Mingw64 BIN:=$(BIN)/Mingw64 else -ifdef WII - INTERFACE=sdl12 - NONX86=1 - STATIC=1 - PREFIX?=powerpc-eabi - SDL=1 - SDL12=1 - SDLMAIN=1 - OBJDIR:=$(OBJDIR)/Wii - BIN:=$(BIN)/Wii - NOUPX=1 -else -ifdef PS3N - INTERFACE=sdl12 - NONX86=1 - STATIC=1 - PREFIX?=ppu - SDL=1 - SDL12=1 - # unsure? - #SDLMAIN=1 - # can't compile SDL_mixer for ps3... - NOMIXER=1 - OBJDIR:=$(OBJDIR)/PS3 - BIN:=$(BIN)/PS3 -else ifdef MINGW INTERFACE=win32 NASMFORMAT=win32 OBJDIR:=$(OBJDIR)/Mingw BIN:=$(BIN)/Mingw -else -ifdef XBOX - INTERFACE=sdl12 - NASMFORMAT=win32 - PREFIX?=/usr/local/openxdk/bin/i386-pc-xbox - SDL=1 - SDL12=1 - OBJDIR:=$(OBJDIR)/XBOX - BIN:=$(BIN)/XBOX -else -ifdef PSP - INTERFACE=sdl12 - NONX86=1 - SDL=1 - SDL12=1 - OBJDIR:=$(OBJDIR)/PSP - BIN:=$(BIN)/PSP - NOUPX=1 -else -ifdef DC - INTERFACE=sdl12 - NONX86=1 - SDL=1 - SDL12=1 - OBJDIR:=$(OBJDIR)/DC - BIN:=$(BIN)/DC - NOUPX=1 -else -ifdef WINCE - INTERFACE=sdl12 - NONX86=1 - PREFIX?=arm-wince-pe - SDL=1 - SDL12=1 - OBJDIR:=$(OBJDIR)/WinCE - BIN:=$(BIN)/WinCE -else -ifdef NDS - INTERFACE=nds - OBJDIR:=$(OBJDIR)/nds - BIN:=$(BIN)/nds - NOUPX=1 endif endif endif @@ -432,19 +339,6 @@ endif endif endif endif -endif -endif -endif -endif -endif -endif -endif - -ifdef GP2X -ifdef SDL - SDL12=1 -endif -endif ifdef ARCHNAME OBJDIR:=$(OBJDIR)/$(ARCHNAME) @@ -479,13 +373,7 @@ OBJDUMP_OPTS?=--wide --source --line-numbers LD=$(CC) ifdef SDL -# SDL 2.0 -ifndef SDL12 INTERFACE=sdl -# SDL 1.2 -else - INTERFACE=sdl12 -endif OBJDIR:=$(OBJDIR)/SDL endif diff --git a/src/am_map.c b/src/am_map.c index 5e73d2ec4..6d7042f1c 100644 --- a/src/am_map.c +++ b/src/am_map.c @@ -43,10 +43,6 @@ static const UINT8 NOCLIMBBROWNS = (2*16); static const UINT8 NOCLIMBYELLOWS = (11*16); -#ifdef _NDS -#undef BACKGROUND -#endif - // Automap colors #define BACKGROUND DBLACK #define WALLCOLORS (REDS + REDRANGE/2) diff --git a/src/b_bot.c b/src/b_bot.c index a6d07895b..17211b353 100644 --- a/src/b_bot.c +++ b/src/b_bot.c @@ -41,12 +41,13 @@ static inline void B_BuildTailsTiccmd(mobj_t *sonic, mobj_t *tails, ticcmd_t *cm return; #endif - if (tails->player->pflags & (PF_MACESPIN|PF_ITEMHANG)) + if (tails->player->powers[pw_carry] == CR_MACESPIN || tails->player->powers[pw_carry] == CR_GENERIC) { + boolean isrelevant = (sonic->player->powers[pw_carry] == CR_MACESPIN || sonic->player->powers[pw_carry] == CR_GENERIC); dist = P_AproxDistance(tails->x-sonic->x, tails->y-sonic->y); - if (sonic->player->cmd.buttons & BT_JUMP && sonic->player->pflags & (PF_JUMPED|PF_MACESPIN|PF_ITEMHANG)) + if (sonic->player->cmd.buttons & BT_JUMP && (sonic->player->pflags & PF_JUMPED) && isrelevant) cmd->buttons |= BT_JUMP; - if (sonic->player->pflags & (PF_MACESPIN|PF_ITEMHANG)) + if (isrelevant) { cmd->forwardmove = sonic->player->cmd.forwardmove; cmd->angleturn = abs((signed)(tails->angle - sonic->angle))>>16; @@ -211,8 +212,9 @@ boolean B_CheckRespawn(player_t *player) // Check if Sonic is busy first. // If he's doing any of these things, he probably doesn't want to see us. - if (sonic->player->pflags & (PF_ROPEHANG|PF_GLIDING|PF_CARRIED|PF_SLIDING|PF_ITEMHANG|PF_MACESPIN|PF_NIGHTSMODE) - || (sonic->player->panim != PA_IDLE && sonic->player->panim != PA_WALK)) + if (sonic->player->pflags & (PF_GLIDING|PF_SLIDING|PF_BOUNCING) + || (sonic->player->panim != PA_IDLE && sonic->player->panim != PA_WALK) + || (sonic->player->powers[pw_carry])) return false; // Low ceiling, do not want! @@ -269,15 +271,20 @@ void B_RespawnBot(INT32 playernum) player->powers[pw_spacetime] = sonic->player->powers[pw_spacetime]; player->powers[pw_gravityboots] = sonic->player->powers[pw_gravityboots]; player->powers[pw_nocontrol] = sonic->player->powers[pw_nocontrol]; + player->acceleration = sonic->player->acceleration; + player->accelstart = sonic->player->accelstart; + player->thrustfactor = sonic->player->thrustfactor; + player->normalspeed = sonic->player->normalspeed; + player->pflags |= PF_AUTOBRAKE|(sonic->player->pflags & PF_DIRECTIONCHAR); P_TeleportMove(tails, x, y, z); if (player->charability == CA_FLY) { - P_SetPlayerMobjState(tails, S_PLAY_ABL1); + P_SetPlayerMobjState(tails, S_PLAY_FLY); tails->player->powers[pw_tailsfly] = (UINT16)-1; } else - P_SetPlayerMobjState(tails, S_PLAY_FALL1); + P_SetPlayerMobjState(tails, S_PLAY_FALL); P_SetScale(tails, sonic->scale); tails->destscale = sonic->destscale; } diff --git a/src/blua/Makefile.cfg b/src/blua/Makefile.cfg index b1131eaca..8d2e73714 100644 --- a/src/blua/Makefile.cfg +++ b/src/blua/Makefile.cfg @@ -39,7 +39,6 @@ OBJS:=$(OBJS) \ $(OBJDIR)/lvm.o \ $(OBJDIR)/lua_script.o \ $(OBJDIR)/lua_baselib.o \ - $(OBJDIR)/lua_blockmaplib.o \ $(OBJDIR)/lua_mathlib.o \ $(OBJDIR)/lua_hooklib.o \ $(OBJDIR)/lua_consolelib.o \ @@ -49,4 +48,5 @@ OBJS:=$(OBJS) \ $(OBJDIR)/lua_skinlib.o \ $(OBJDIR)/lua_thinkerlib.o \ $(OBJDIR)/lua_maplib.o \ + $(OBJDIR)/lua_blockmaplib.o \ $(OBJDIR)/lua_hudlib.o diff --git a/src/command.c b/src/command.c index de5a99d51..600803cdb 100644 --- a/src/command.c +++ b/src/command.c @@ -1204,7 +1204,16 @@ found: var->value = (INT32)(d * FRACUNIT); } else - var->value = atoi(var->string); + { + if (var == &cv_forceskin) + { + var->value = R_SkinAvailable(var->string); + if (!R_SkinUsable(-1, var->value)) + var->value = -1; + } + else + var->value = atoi(var->string); + } finish: // See the note above. @@ -1270,7 +1279,7 @@ static void Got_NetVar(UINT8 **p, INT32 playernum) if (server) { - XBOXSTATIC UINT8 buf[2]; + UINT8 buf[2]; buf[0] = (UINT8)playernum; buf[1] = KICK_MSG_CON_FAIL; @@ -1289,9 +1298,6 @@ static void Got_NetVar(UINT8 **p, INT32 playernum) CONS_Alert(CONS_WARNING, "Netvar not found with netid %hu\n", netid); return; } -#if 0 //defined (GP2X) || defined (PSP) - CONS_Printf("Netvar received: %s [netid=%d] value %s\n", cvar->name, netid, svalue); -#endif DEBFILE(va("Netvar received: %s [netid=%d] value %s\n", cvar->name, netid, svalue)); Setvalue(cvar, svalue, stealth); @@ -1390,7 +1396,7 @@ static void CV_SetCVar(consvar_t *var, const char *value, boolean stealth) if (var->flags & CV_NETVAR) { // send the value of the variable - XBOXSTATIC UINT8 buf[128]; + UINT8 buf[128]; UINT8 *p = buf; if (!(server || (IsPlayerAdmin(consoleplayer)))) { @@ -1398,6 +1404,16 @@ static void CV_SetCVar(consvar_t *var, const char *value, boolean stealth) return; } + if (var == &cv_forceskin) + { + INT32 skin = R_SkinAvailable(value); + if ((stricmp(value, "None")) && ((skin == -1) || !R_SkinUsable(-1, skin))) + { + CONS_Printf("Please provide a valid skin name (\"None\" disables).\n"); + return; + } + } + // Only add to netcmd buffer if in a netgame, otherwise, just change it. if (netgame || multiplayer) { @@ -1431,6 +1447,30 @@ void CV_StealthSet(consvar_t *var, const char *value) CV_SetCVar(var, value, true); } +/** Sets a numeric value to a variable, sometimes calling its callback + * function. + * + * \param var The variable. + * \param value The numeric value, converted to a string before setting. + * \param stealth Do we call the callback function or not? + */ +static void CV_SetValueMaybeStealth(consvar_t *var, INT32 value, boolean stealth) +{ + char val[32]; + + if (var == &cv_forceskin) // Special handling. + { + if ((value < 0) || (value >= numskins)) + sprintf(val, "None"); + else + sprintf(val, "%s", skins[value].name); + } + else + sprintf(val, "%d", value); + + CV_SetCVar(var, val, stealth); +} + /** Sets a numeric value to a variable without calling its callback * function. * @@ -1440,10 +1480,7 @@ void CV_StealthSet(consvar_t *var, const char *value) */ void CV_StealthSetValue(consvar_t *var, INT32 value) { - char val[32]; - - sprintf(val, "%d", value); - CV_SetCVar(var, val, true); + CV_SetValueMaybeStealth(var, value, true); } // New wrapper for what used to be CV_Set() @@ -1461,10 +1498,7 @@ void CV_Set(consvar_t *var, const char *value) */ void CV_SetValue(consvar_t *var, INT32 value) { - char val[32]; - - sprintf(val, "%d", value); - CV_SetCVar(var, val, false); + CV_SetValueMaybeStealth(var, value, false); } /** Adds a value to a console variable. @@ -1484,7 +1518,23 @@ void CV_AddValue(consvar_t *var, INT32 increment) // count pointlimit better if (var == &cv_pointlimit && (gametype == GT_MATCH)) increment *= 50; - newvalue = var->value + increment; + + if (var == &cv_forceskin) // Special handling. + { + INT32 oldvalue = var->value; + newvalue = oldvalue; + do + { + newvalue += increment; + if (newvalue < -1) + newvalue = (numskins - 1); + else if (newvalue >= numskins) + newvalue = -1; + } while ((oldvalue != newvalue) + && !(R_SkinUsable(-1, newvalue))); + } + else + newvalue = var->value + increment; if (var->PossibleValue) { @@ -1554,34 +1604,27 @@ void CV_AddValue(consvar_t *var, INT32 increment) if (var == &cv_chooseskin) { // Special case for the chooseskin variable, used only directly from the menu - if (increment > 0) // Going up! + newvalue = var->value - 1; + do { - newvalue = var->value - 1; - do + if (increment > 0) // Going up! { newvalue++; if (newvalue == MAXSKINS) newvalue = 0; - } while (var->PossibleValue[newvalue].strvalue == NULL); - var->value = newvalue + 1; - var->string = var->PossibleValue[newvalue].strvalue; - var->func(); - return; - } - else if (increment < 0) // Going down! - { - newvalue = var->value - 1; - do + } + else if (increment < 0) // Going down! { newvalue--; if (newvalue == -1) newvalue = MAXSKINS-1; - } while (var->PossibleValue[newvalue].strvalue == NULL); - var->value = newvalue + 1; - var->string = var->PossibleValue[newvalue].strvalue; - var->func(); - return; - } + } + } while (var->PossibleValue[newvalue].strvalue == NULL); + + var->value = newvalue + 1; + var->string = var->PossibleValue[newvalue].strvalue; + var->func(); + return; } #ifdef PARANOIA if (currentindice == -1) diff --git a/src/config.h.in b/src/config.h.in index 1e6a7f514..fc32aef82 100644 --- a/src/config.h.in +++ b/src/config.h.in @@ -11,12 +11,11 @@ #ifdef CMAKECONFIG -#define ASSET_HASH_SRB2_SRB "${SRB2_ASSET_srb2.srb_HASH}" +#define ASSET_HASH_SRB2_PK3 "${SRB2_ASSET_srb2.pk3_HASH}" #define ASSET_HASH_PLAYER_DTA "${SRB2_ASSET_player.dta_HASH}" -#define ASSET_HASH_RINGS_DTA "${SRB2_ASSET_rings.dta_HASH}" #define ASSET_HASH_ZONES_DTA "${SRB2_ASSET_zones.dta_HASH}" #ifdef USE_PATCH_DTA -#define ASSET_HASH_PATCH_DTA "${SRB2_ASSET_patch.dta_HASH}" +#define ASSET_HASH_PATCH_PK3 "${SRB2_ASSET_patch.pk3_HASH}" #endif #define SRB2_COMP_REVISION "${SRB2_COMP_REVISION}" @@ -28,14 +27,13 @@ /* Manually defined asset hashes for non-CMake builds * Last updated 2015 / 05 / 03 - v2.1.15 - main assets - * Last updated 2018 / 12 / 23 - v2.1.22 - patch.dta + * Last updated 2018 / ?? / ?? - v2.2 - patch.pk3 */ -#define ASSET_HASH_SRB2_SRB "c1b9577687f8a795104aef4600720ea7" +#define ASSET_HASH_SRB2_PK3 "c1b9577687f8a795104aef4600720ea7" #define ASSET_HASH_ZONES_DTA "303838c6c534d9540288360fa49cca60" #define ASSET_HASH_PLAYER_DTA "cfca0f1c73023cbbd8f844f45480f799" -#define ASSET_HASH_RINGS_DTA "85901ad4bf94637e5753d2ac2c03ea26" #ifdef USE_PATCH_DTA -#define ASSET_HASH_PATCH_DTA "b04fd9624bfd94dc96dcf4f400f7deb4" +#define ASSET_HASH_PATCH_PK3 "dbbf8bc6121618ee3be2d5b14650429b" #endif #endif diff --git a/src/console.c b/src/console.c index 91baf25fc..c1c5557b9 100644 --- a/src/console.c +++ b/src/console.c @@ -12,9 +12,6 @@ #ifdef __GNUC__ #include -#ifdef _XBOX -#include -#endif #endif #include "doomdef.h" @@ -139,6 +136,7 @@ static CV_PossibleValue_t backcolor_cons_t[] = {{0, "White"}, {1, "Black"}, { {18,"Lavender"}, {0, NULL}}; + consvar_t cons_backcolor = {"con_backcolor", "Green", CV_CALL|CV_SAVE, backcolor_cons_t, CONS_backcolor_Change, 0, NULL, NULL, 0, 0, NULL}; static void CON_Print(char *msg); @@ -229,108 +227,139 @@ static void CONS_Bind_f(void) // Font colormap colors // TODO: This could probably be improved somehow... // These colormaps are 99% identical, with just a few changed bytes -UINT8 *yellowmap; -UINT8 *purplemap; -UINT8 *lgreenmap; -UINT8 *bluemap; -UINT8 *graymap; -UINT8 *redmap; -UINT8 *orangemap; +// This could EASILY be handled by modifying a centralised colormap +// for software depending on the prior state - but yknow, OpenGL... +UINT8 *yellowmap, *magentamap, *lgreenmap, *bluemap, *graymap, *redmap, *orangemap, *skymap, *purplemap, *aquamap, *peridotmap, *azuremap, *brownmap, *rosymap, *invertmap; // Console BG color UINT8 *consolebgmap = NULL; +UINT8 *promptbgmap = NULL; +static UINT8 promptbgcolor = UINT8_MAX; -void CON_SetupBackColormap(void) +void CON_SetupBackColormapEx(INT32 color, boolean prompt) { UINT16 i, palsum; UINT8 j, palindex; UINT8 *pal = W_CacheLumpName(GetPalette(), PU_CACHE); INT32 shift = 6; - if (!consolebgmap) - consolebgmap = (UINT8 *)Z_Malloc(256, PU_STATIC, NULL); + if (color == INT32_MAX) + color = cons_backcolor.value; - switch (cons_backcolor.value) + shift = 6; // 12 colors -- shift of 7 means 6 colors + + switch (color) { case 0: palindex = 15; break; // White - case 1: palindex = 31; break; // Gray - case 2: palindex = 47; break; // Sepia - case 3: palindex = 63; break; // Brown - case 4: palindex = 150; shift = 7; break; // Pink - case 5: palindex = 127; shift = 7; break; // Raspberry - case 6: palindex = 143; break; // Red - case 7: palindex = 86; shift = 7; break; // Creamsicle - case 8: palindex = 95; break; // Orange - case 9: palindex = 119; shift = 7; break; // Gold - case 10: palindex = 111; break; // Yellow - case 11: palindex = 191; shift = 7; break; // Emerald - case 12: palindex = 175; break; // Green - case 13: palindex = 219; break; // Cyan - case 14: palindex = 207; shift = 7; break; // Steel - case 15: palindex = 230; shift = 7; break; // Periwinkle - case 16: palindex = 239; break; // Blue - case 17: palindex = 199; shift = 7; break; // Purple - case 18: palindex = 255; shift = 7; break; // Lavender + case 1: palindex = 31; break; // Black + case 2: palindex = 251; break; // Sepia + case 3: palindex = 239; break; // Brown + case 4: palindex = 215; shift = 7; break; // Pink + case 5: palindex = 37; shift = 7; break; // Raspberry + case 6: palindex = 47; shift = 7; break; // Red + case 7: palindex = 53; shift = 7; break; // Creamsicle + case 8: palindex = 63; break; // Orange + case 9: palindex = 56; shift = 7; break; // Gold + case 10: palindex = 79; shift = 7; break; // Yellow + case 11: palindex = 119; shift = 7; break; // Emerald + case 12: palindex = 111; break; // Green + case 13: palindex = 136; shift = 7; break; // Cyan + case 14: palindex = 175; shift = 7; break; // Steel + case 15: palindex = 166; shift = 7; break; // Periwinkle + case 16: palindex = 159; break; // Blue + case 17: palindex = 187; shift = 7; break; // Purple + case 18: palindex = 199; shift = 7; break; // Lavender // Default green - default: palindex = 175; break; + default: palindex = 111; break; + } -} + if (prompt) + { + if (!promptbgmap) + promptbgmap = (UINT8 *)Z_Malloc(256, PU_STATIC, NULL); + + if (color == promptbgcolor) + return; + else + promptbgcolor = color; + } + else if (!consolebgmap) + consolebgmap = (UINT8 *)Z_Malloc(256, PU_STATIC, NULL); // setup background colormap for (i = 0, j = 0; i < 768; i += 3, j++) { palsum = (pal[i] + pal[i+1] + pal[i+2]) >> shift; - consolebgmap[j] = (UINT8)(palindex - palsum); + if (prompt) + promptbgmap[j] = (UINT8)(palindex - palsum); + else + consolebgmap[j] = (UINT8)(palindex - palsum); } } +void CON_SetupBackColormap(void) +{ + CON_SetupBackColormapEx(cons_backcolor.value, false); + CON_SetupBackColormapEx(1, true); // default to gray +} + static void CONS_backcolor_Change(void) { - CON_SetupBackColormap(); + CON_SetupBackColormapEx(cons_backcolor.value, false); } static void CON_SetupColormaps(void) { INT32 i; + UINT8 *memorysrc = (UINT8 *)Z_Malloc((256*15), PU_STATIC, NULL); - yellowmap = (UINT8 *)Z_Malloc(256, PU_STATIC, NULL); - graymap = (UINT8 *)Z_Malloc(256, PU_STATIC, NULL); - purplemap = (UINT8 *)Z_Malloc(256, PU_STATIC, NULL); - lgreenmap = (UINT8 *)Z_Malloc(256, PU_STATIC, NULL); - bluemap = (UINT8 *)Z_Malloc(256, PU_STATIC, NULL); - redmap = (UINT8 *)Z_Malloc(256, PU_STATIC, NULL); - orangemap = (UINT8 *)Z_Malloc(256, PU_STATIC, NULL); + magentamap = memorysrc; + yellowmap = (magentamap+256); + lgreenmap = (yellowmap+256); + bluemap = (lgreenmap+256); + redmap = (bluemap+256); + graymap = (redmap+256); + orangemap = (graymap+256); + skymap = (orangemap+256); + purplemap = (skymap+256); + aquamap = (purplemap+256); + peridotmap = (aquamap+256); + azuremap = (peridotmap+256); + brownmap = (azuremap+256); + rosymap = (brownmap+256); + invertmap = (rosymap+256); // setup the other colormaps, for console text // these don't need to be aligned, unless you convert the // V_DrawMappedPatch() into optimised asm. - for (i = 0; i < 256; i++) - { - yellowmap[i] = (UINT8)i; // remap each color to itself... - graymap[i] = (UINT8)i; - purplemap[i] = (UINT8)i; - lgreenmap[i] = (UINT8)i; - bluemap[i] = (UINT8)i; - redmap[i] = (UINT8)i; - orangemap[i] = (UINT8)i; - } + for (i = 0; i < (256*15); i++, ++memorysrc) + *memorysrc = (UINT8)(i & 0xFF); // remap each color to itself... - yellowmap[3] = (UINT8)103; - yellowmap[9] = (UINT8)115; - purplemap[3] = (UINT8)195; - purplemap[9] = (UINT8)198; - lgreenmap[3] = (UINT8)162; - lgreenmap[9] = (UINT8)170; - bluemap[3] = (UINT8)228; - bluemap[9] = (UINT8)238; - graymap[3] = (UINT8)10; - graymap[9] = (UINT8)15; - redmap[3] = (UINT8)124; - redmap[9] = (UINT8)127; - orangemap[3] = (UINT8)85; - orangemap[9] = (UINT8)90; +#define colset(map, a, b, c) \ + map[1] = (UINT8)a;\ + map[3] = (UINT8)b;\ + map[9] = (UINT8)c + + colset(magentamap, 177, 178, 184); + colset(yellowmap, 82, 73, 66); + colset(lgreenmap, 97, 98, 106); + colset(bluemap, 146, 147, 155); + colset(redmap, 210, 32, 39); + colset(graymap, 6, 8, 14); + colset(orangemap, 51, 52, 57); + colset(skymap, 129, 130, 133); + colset(purplemap, 160, 161, 163); + colset(aquamap, 120, 121, 123); + colset(peridotmap, 88, 188, 190); + colset(azuremap, 144, 145, 170); + colset(brownmap, 219, 221, 224); + colset(rosymap, 200, 201, 203); + colset(invertmap, 27, 26, 22); + invertmap[26] = (UINT8)3; + +#undef colset // Init back colormap CON_SetupBackColormap(); @@ -338,12 +367,7 @@ static void CON_SetupColormaps(void) // Setup the console text buffer // -// for WII, libogc already has a CON_Init function, we must rename it here -#ifdef _WII -void CON_InitWii(void) -#else void CON_Init(void) -#endif { INT32 i; @@ -1053,10 +1077,10 @@ boolean CON_Responder(event_t *ev) // allow people to use keypad in console (good for typing IP addresses) - Calum if (key >= KEY_KEYPAD7 && key <= KEY_KPADDEL) { - XBOXSTATIC char keypad_translation[] = {'7','8','9','-', - '4','5','6','+', - '1','2','3', - '0','.'}; + char keypad_translation[] = {'7','8','9','-', + '4','5','6','+', + '1','2','3', + '0','.'}; key = keypad_translation[key - KEY_KEYPAD7]; } @@ -1203,7 +1227,7 @@ static void CON_Print(char *msg) void CON_LogMessage(const char *msg) { - XBOXSTATIC char txt[8192], *t; + char txt[8192], *t; const char *p = msg, *e = txt+sizeof (txt)-2; for (t = txt; *p != '\0'; p++) @@ -1239,15 +1263,10 @@ void CONS_Printf(const char *fmt, ...) va_end(argptr); // echo console prints to log file -#ifndef _arch_dreamcast DEBFILE(txt); -#endif if (!con_started) { -#if defined (_XBOX) && defined (__GNUC__) - if (!keyboard_started) debugPrint(txt); -#endif #ifdef PC_DOS CON_LogMessage(txt); free(txt); @@ -1268,7 +1287,7 @@ void CONS_Printf(const char *fmt, ...) // if not in display loop, force screen update if (con_startup) { -#if (defined (_WINDOWS)) || (defined (__OS2__) && !defined (HAVE_SDL)) +#ifdef _WINDOWS patch_t *con_backpic = W_CachePatchName("CONSBACK", PU_CACHE); // Jimita: CON_DrawBackpic just called V_DrawScaledPatch @@ -1419,34 +1438,34 @@ static void CON_DrawInput(void) { x -= charwidth*3; if (input_sel < c) - V_DrawFill(x, y, charwidth*3, (10 * con_scalefactor), 107 | V_NOSCALESTART); + V_DrawFill(x, y, charwidth*3, (10 * con_scalefactor), 77 | V_NOSCALESTART); for (i = 0; i < 3; ++i, x += charwidth) - V_DrawCharacter(x, y, '.' | cv_constextsize.value | V_GRAYMAP | V_NOSCALESTART, !cv_allcaps.value); + V_DrawCharacter(x, y, '.' | cv_constextsize.value | V_GRAYMAP | V_NOSCALESTART, true); } else - V_DrawCharacter(x-charwidth, y, CON_PROMPTCHAR | cv_constextsize.value | V_GRAYMAP | V_NOSCALESTART, !cv_allcaps.value); + V_DrawCharacter(x-charwidth, y, CON_PROMPTCHAR | cv_constextsize.value | V_GRAYMAP | V_NOSCALESTART, true); for (cend = c + clen; c < cend; ++c, x += charwidth) { if ((input_sel > c && input_cur <= c) || (input_sel <= c && input_cur > c)) { - V_DrawFill(x, y, charwidth, (10 * con_scalefactor), 107 | V_NOSCALESTART); - V_DrawCharacter(x, y, p[c] | cv_constextsize.value | V_YELLOWMAP | V_NOSCALESTART, !cv_allcaps.value); + V_DrawFill(x, y, charwidth, (10 * con_scalefactor), 77 | V_NOSCALESTART); + V_DrawCharacter(x, y, p[c] | cv_constextsize.value | V_YELLOWMAP | V_NOSCALESTART, true); } else - V_DrawCharacter(x, y, p[c] | cv_constextsize.value | V_NOSCALESTART, !cv_allcaps.value); + V_DrawCharacter(x, y, p[c] | cv_constextsize.value | V_NOSCALESTART, true); if (c == input_cur && con_tick >= 4) - V_DrawCharacter(x, y + (con_scalefactor*2), '_' | cv_constextsize.value | V_NOSCALESTART, !cv_allcaps.value); + V_DrawCharacter(x, y + (con_scalefactor*2), '_' | cv_constextsize.value | V_NOSCALESTART, true); } if (cend == input_cur && con_tick >= 4) - V_DrawCharacter(x, y + (con_scalefactor*2), '_' | cv_constextsize.value | V_NOSCALESTART, !cv_allcaps.value); + V_DrawCharacter(x, y + (con_scalefactor*2), '_' | cv_constextsize.value | V_NOSCALESTART, true); if (rellip) { if (input_sel > cend) - V_DrawFill(x, y, charwidth*3, (10 * con_scalefactor), 107 | V_NOSCALESTART); + V_DrawFill(x, y, charwidth*3, (10 * con_scalefactor), 77 | V_NOSCALESTART); for (i = 0; i < 3; ++i, x += charwidth) - V_DrawCharacter(x, y, '.' | cv_constextsize.value | V_GRAYMAP | V_NOSCALESTART, !cv_allcaps.value); + V_DrawCharacter(x, y, '.' | cv_constextsize.value | V_GRAYMAP | V_NOSCALESTART, true); } } @@ -1492,11 +1511,11 @@ static void CON_DrawHudlines(void) else { //charwidth = SHORT(hu_font['A'-HU_FONTSTART]->width) * con_scalefactor; - V_DrawCharacter(x, y, (INT32)(*p) | charflags | cv_constextsize.value | V_NOSCALESTART, !cv_allcaps.value); + V_DrawCharacter(x, y, (INT32)(*p) | charflags | cv_constextsize.value | V_NOSCALESTART, true); } } - //V_DrawCharacter(x, y, (p[c]&0xff) | cv_constextsize.value | V_NOSCALESTART, !cv_allcaps.value); + //V_DrawCharacter(x, y, (p[c]&0xff) | cv_constextsize.value | V_NOSCALESTART, true); y += charheight; } @@ -1567,7 +1586,7 @@ static void CON_DrawConsole(void) charflags = (*p & 0x7f) << V_CHARCOLORSHIFT; p++; } - V_DrawCharacter(x, y, (INT32)(*p) | charflags | cv_constextsize.value | V_NOSCALESTART, !cv_allcaps.value); + V_DrawCharacter(x, y, (INT32)(*p) | charflags | cv_constextsize.value | V_NOSCALESTART, true); } } @@ -1588,6 +1607,8 @@ void CON_Drawer(void) if (con_curlines > 0) CON_DrawConsole(); - else if (gamestate == GS_LEVEL || gamestate == GS_INTERMISSION || gamestate == GS_CUTSCENE || gamestate == GS_CREDITS) + else if (gamestate == GS_LEVEL + || gamestate == GS_INTERMISSION || gamestate == GS_CUTSCENE + || gamestate == GS_CREDITS || gamestate == GS_EVALUATION) CON_DrawHudlines(); } diff --git a/src/console.h b/src/console.h index 7f448f5fe..f62808033 100644 --- a/src/console.h +++ b/src/console.h @@ -13,11 +13,7 @@ #include "d_event.h" #include "command.h" -#ifdef _WII -void CON_InitWii(void); -#else void CON_Init(void); -#endif boolean CON_Responder(event_t *ev); @@ -38,11 +34,13 @@ extern UINT32 con_scalefactor; // console text scale factor extern consvar_t cons_backcolor; -extern UINT8 *yellowmap, *purplemap, *lgreenmap, *bluemap, *graymap, *redmap, *orangemap; +extern UINT8 *yellowmap, *magentamap, *lgreenmap, *bluemap, *graymap, *redmap, *orangemap, *skymap, *purplemap, *aquamap, *peridotmap, *azuremap, *brownmap, *rosymap, *invertmap; // Console bg color (auto updated to match) extern UINT8 *consolebgmap; +extern UINT8 *promptbgmap; +void CON_SetupBackColormapEx(INT32 color, boolean prompt); void CON_SetupBackColormap(void); void CON_ClearHUD(void); // clear heads up messages diff --git a/src/d_clisrv.c b/src/d_clisrv.c index 58fa54f28..4352413e8 100644 --- a/src/d_clisrv.c +++ b/src/d_clisrv.c @@ -10,9 +10,7 @@ /// \file d_clisrv.c /// \brief SRB2 Network game communication and protocol, all OS independent parts. -#if !defined (UNDER_CE) #include -#endif #ifdef __GNUC__ #include //for unlink #endif @@ -51,10 +49,6 @@ #include "f_finale.h" #endif -#ifdef _XBOX -#include "sdl12/SRB2XBOX/xboxhelp.h" -#endif - // // NETWORKING // @@ -394,7 +388,7 @@ static void ExtraDataTicker(void) { if (server) { - XBOXSTATIC UINT8 buf[3]; + UINT8 buf[3]; buf[0] = (UINT8)i; buf[1] = KICK_MSG_CON_FAIL; @@ -519,7 +513,8 @@ static inline void resynch_write_player(resynch_pak *rsp, const size_t i) rsp->powers[j] = (UINT16)SHORT(players[i].powers[j]); // Score is resynched in the rspfirm resync packet - rsp->health = 0; // resynched with mo health + rsp->rings = SHORT(players[i].rings); + rsp->spheres = SHORT(players[i].spheres); rsp->lives = players[i].lives; rsp->continues = players[i].continues; rsp->scoreadd = players[i].scoreadd; @@ -528,8 +523,11 @@ static inline void resynch_write_player(resynch_pak *rsp, const size_t i) rsp->skincolor = players[i].skincolor; rsp->skin = LONG(players[i].skin); + rsp->availabilities = LONG(players[i].availabilities); // Just in case Lua does something like // modify these at runtime + rsp->camerascale = (fixed_t)LONG(players[i].camerascale); + rsp->shieldscale = (fixed_t)LONG(players[i].shieldscale); rsp->normalspeed = (fixed_t)LONG(players[i].normalspeed); rsp->runspeed = (fixed_t)LONG(players[i].runspeed); rsp->thrustfactor = players[i].thrustfactor; @@ -541,13 +539,15 @@ static inline void resynch_write_player(resynch_pak *rsp, const size_t i) rsp->thokitem = (UINT32)LONG(players[i].thokitem); //mobjtype_t rsp->spinitem = (UINT32)LONG(players[i].spinitem); //mobjtype_t rsp->revitem = (UINT32)LONG(players[i].revitem); //mobjtype_t + rsp->followitem = (UINT32)LONG(players[i].followitem); //mobjtype_t rsp->actionspd = (fixed_t)LONG(players[i].actionspd); rsp->mindash = (fixed_t)LONG(players[i].mindash); rsp->maxdash = (fixed_t)LONG(players[i].maxdash); rsp->jumpfactor = (fixed_t)LONG(players[i].jumpfactor); + rsp->playerheight = (fixed_t)LONG(players[i].height); + rsp->playerspinheight = (fixed_t)LONG(players[i].spinheight); rsp->speed = (fixed_t)LONG(players[i].speed); - rsp->jumping = players[i].jumping; rsp->secondjump = players[i].secondjump; rsp->fly1 = players[i].fly1; rsp->glidetime = (tic_t)LONG(players[i].glidetime); @@ -555,6 +555,7 @@ static inline void resynch_write_player(resynch_pak *rsp, const size_t i) rsp->deadtimer = players[i].deadtimer; rsp->exiting = (tic_t)LONG(players[i].exiting); rsp->homing = players[i].homing; + rsp->dashmode = (tic_t)LONG(players[i].dashmode); rsp->skidtime = (tic_t)LONG(players[i].skidtime); rsp->cmomx = (fixed_t)LONG(players[i].cmomx); rsp->cmomy = (fixed_t)LONG(players[i].cmomy); @@ -573,7 +574,6 @@ static inline void resynch_write_player(resynch_pak *rsp, const size_t i) rsp->maxlink = LONG(players[i].maxlink); rsp->dashspeed = (fixed_t)LONG(players[i].dashspeed); - rsp->dashtime = LONG(players[i].dashtime); rsp->angle_pos = (angle_t)LONG(players[i].angle_pos); rsp->old_angle_pos = (angle_t)LONG(players[i].old_angle_pos); rsp->bumpertime = (tic_t)LONG(players[i].bumpertime); @@ -602,7 +602,6 @@ static inline void resynch_write_player(resynch_pak *rsp, const size_t i) rsp->hasmo = true; rsp->health = LONG(players[i].mo->health); - rsp->angle = (angle_t)LONG(players[i].mo->angle); rsp->x = LONG(players[i].mo->x); rsp->y = LONG(players[i].mo->y); @@ -645,7 +644,8 @@ static void resynch_read_player(resynch_pak *rsp) players[i].powers[j] = (UINT16)SHORT(rsp->powers[j]); // Score is resynched in the rspfirm resync packet - players[i].health = rsp->health; + players[i].rings = SHORT(rsp->rings); + players[i].spheres = SHORT(rsp->spheres); players[i].lives = rsp->lives; players[i].continues = rsp->continues; players[i].scoreadd = rsp->scoreadd; @@ -654,8 +654,11 @@ static void resynch_read_player(resynch_pak *rsp) players[i].skincolor = rsp->skincolor; players[i].skin = LONG(rsp->skin); + players[i].availabilities = LONG(rsp->availabilities); // Just in case Lua does something like // modify these at runtime + players[i].camerascale = (fixed_t)LONG(rsp->camerascale); + players[i].shieldscale = (fixed_t)LONG(rsp->shieldscale); players[i].normalspeed = (fixed_t)LONG(rsp->normalspeed); players[i].runspeed = (fixed_t)LONG(rsp->runspeed); players[i].thrustfactor = rsp->thrustfactor; @@ -667,13 +670,15 @@ static void resynch_read_player(resynch_pak *rsp) players[i].thokitem = (UINT32)LONG(rsp->thokitem); //mobjtype_t players[i].spinitem = (UINT32)LONG(rsp->spinitem); //mobjtype_t players[i].revitem = (UINT32)LONG(rsp->revitem); //mobjtype_t + players[i].followitem = (UINT32)LONG(rsp->followitem); //mobjtype_t players[i].actionspd = (fixed_t)LONG(rsp->actionspd); players[i].mindash = (fixed_t)LONG(rsp->mindash); players[i].maxdash = (fixed_t)LONG(rsp->maxdash); players[i].jumpfactor = (fixed_t)LONG(rsp->jumpfactor); + players[i].height = (fixed_t)LONG(rsp->playerheight); + players[i].spinheight = (fixed_t)LONG(rsp->playerspinheight); players[i].speed = (fixed_t)LONG(rsp->speed); - players[i].jumping = rsp->jumping; players[i].secondjump = rsp->secondjump; players[i].fly1 = rsp->fly1; players[i].glidetime = (tic_t)LONG(rsp->glidetime); @@ -681,6 +686,7 @@ static void resynch_read_player(resynch_pak *rsp) players[i].deadtimer = rsp->deadtimer; players[i].exiting = (tic_t)LONG(rsp->exiting); players[i].homing = rsp->homing; + players[i].dashmode = (tic_t)LONG(rsp->dashmode); players[i].skidtime = (tic_t)LONG(rsp->skidtime); players[i].cmomx = (fixed_t)LONG(rsp->cmomx); players[i].cmomy = (fixed_t)LONG(rsp->cmomy); @@ -699,7 +705,6 @@ static void resynch_read_player(resynch_pak *rsp) players[i].maxlink = LONG(rsp->maxlink); players[i].dashspeed = (fixed_t)LONG(rsp->dashspeed); - players[i].dashtime = LONG(rsp->dashtime); players[i].angle_pos = (angle_t)LONG(rsp->angle_pos); players[i].old_angle_pos = (angle_t)LONG(rsp->old_angle_pos); players[i].bumpertime = (tic_t)LONG(rsp->bumpertime); @@ -761,8 +766,16 @@ static void resynch_read_player(resynch_pak *rsp) players[i].mo->scalespeed = LONG(rsp->scalespeed); // And finally, SET THE MOBJ SKIN damn it. - players[i].mo->skin = &skins[players[i].skin]; - players[i].mo->color = players[i].skincolor; + if ((players[i].powers[pw_carry] == CR_NIGHTSMODE) && (skins[players[i].skin].sprites[SPR2_NGT0].numframes == 0)) + { + players[i].mo->skin = &skins[DEFAULTNIGHTSSKIN]; + players[i].mo->color = skins[DEFAULTNIGHTSSKIN].prefcolor; // this will be corrected by thinker to super flash + } + else + { + players[i].mo->skin = &skins[players[i].skin]; + players[i].mo->color = players[i].skincolor; // this will be corrected by thinker to super flash/mario star + } P_SetThingPosition(players[i].mo); } @@ -876,6 +889,7 @@ static inline void resynch_write_others(resynchend_pak *rst) UINT8 i; rst->ingame = 0; + rst->outofcoop = 0; for (i = 0; i < MAXPLAYERS; ++i) { @@ -892,6 +906,8 @@ static inline void resynch_write_others(resynchend_pak *rst) if (!players[i].spectator) rst->ingame |= (1<outofcoop |= (1<ctfteam[i] = (INT32)LONG(players[i].ctfteam); rst->score[i] = (UINT32)LONG(players[i].score); rst->numboxes[i] = SHORT(players[i].numboxes); @@ -908,11 +924,13 @@ static inline void resynch_read_others(resynchend_pak *p) { UINT8 i; UINT32 loc_ingame = (UINT32)LONG(p->ingame); + UINT32 loc_outofcoop = (UINT32)LONG(p->outofcoop); for (i = 0; i < MAXPLAYERS; ++i) { // We don't care if they're in the game or not, just write all the data. players[i].spectator = !(loc_ingame & (1<ctfteam[i]); // no, 0 does not mean spectator, at least not in Match players[i].score = (UINT32)LONG(p->score[i]); players[i].numboxes = SHORT(p->numboxes[i]); @@ -1007,7 +1025,7 @@ static void SV_SendResynch(INT32 node) if (resynch_score[node] > (unsigned)cv_resynchattempts.value*250) { - XBOXSTATIC UINT8 buf[2]; + UINT8 buf[2]; buf[0] = (UINT8)nodetoplayer[node]; buf[1] = KICK_MSG_CON_FAIL; SendNetXCmd(XD_KICK, &buf, 2); @@ -1109,7 +1127,8 @@ static inline void CL_DrawConnectionStatus(void) INT32 ccstime = I_GetTime(); // Draw background fade - V_DrawFadeScreen(); + if (!menuactive) // menu already draws its own fade + V_DrawFadeScreen(0xFF00, 16); // force default // Draw the bottom box. M_DrawTextBox(BASEVIDWIDTH/2-128-8, BASEVIDHEIGHT-24-8, 32, 1); @@ -1118,7 +1137,7 @@ static inline void CL_DrawConnectionStatus(void) if (cl_mode != CL_DOWNLOADFILES) { INT32 i, animtime = ((ccstime / 4) & 15) + 16; - UINT8 palstart = (cl_mode == CL_SEARCHING) ? 128 : 160; + UINT8 palstart = (cl_mode == CL_SEARCHING) ? 32 : 96; // 15 pal entries total. const char *cltext; @@ -1165,8 +1184,8 @@ static inline void CL_DrawConnectionStatus(void) dldlength = (INT32)((file->currentsize/(double)file->totalsize) * 256); if (dldlength > 256) dldlength = 256; - V_DrawFill(BASEVIDWIDTH/2-128, BASEVIDHEIGHT-24, 256, 8, 175); - V_DrawFill(BASEVIDWIDTH/2-128, BASEVIDHEIGHT-24, dldlength, 8, 160); + V_DrawFill(BASEVIDWIDTH/2-128, BASEVIDHEIGHT-24, 256, 8, 111); + V_DrawFill(BASEVIDWIDTH/2-128, BASEVIDHEIGHT-24, dldlength, 8, 96); memset(tempname, 0, sizeof(tempname)); // offset filename to just the name only part @@ -1327,7 +1346,7 @@ static void SV_SendPlayerInfo(INT32 node) netbuffer->u.playerinfo[i].skin = (UINT8)players[i].skin; // Extra data - netbuffer->u.playerinfo[i].data = players[i].skincolor; + netbuffer->u.playerinfo[i].data = 0; //players[i].skincolor; if (players[i].pflags & PF_TAGIT) netbuffer->u.playerinfo[i].data |= 0x20; @@ -1371,6 +1390,7 @@ static boolean SV_SendServerConfig(INT32 node) // which is nice and easy for us to detect memset(netbuffer->u.servercfg.playerskins, 0xFF, sizeof(netbuffer->u.servercfg.playerskins)); memset(netbuffer->u.servercfg.playercolor, 0xFF, sizeof(netbuffer->u.servercfg.playercolor)); + memset(netbuffer->u.servercfg.playeravailabilities, 0xFF, sizeof(netbuffer->u.servercfg.playeravailabilities)); memset(netbuffer->u.servercfg.adminplayers, -1, sizeof(netbuffer->u.servercfg.adminplayers)); @@ -1382,6 +1402,7 @@ static boolean SV_SendServerConfig(INT32 node) continue; netbuffer->u.servercfg.playerskins[i] = (UINT8)players[i].skin; netbuffer->u.servercfg.playercolor[i] = (UINT8)players[i].skincolor; + netbuffer->u.servercfg.playeravailabilities[i] = (UINT32)LONG(players[i].availabilities); } memcpy(netbuffer->u.servercfg.server_context, server_context, 8); @@ -1499,7 +1520,7 @@ static void SV_SavedGame(void) { size_t length; UINT8 *savebuffer; - XBOXSTATIC char tmpsave[256]; + char tmpsave[256]; if (!cv_dumpconsistency.value) return; @@ -1541,7 +1562,7 @@ static void CL_LoadReceivedSavegame(void) { UINT8 *savebuffer = NULL; size_t length, decompressedlen; - XBOXSTATIC char tmpsave[256]; + char tmpsave[256]; sprintf(tmpsave, "%s" PATHSEP TMPSAVENAME, srb2home); @@ -1982,6 +2003,7 @@ static boolean CL_ServerConnectionTicker(boolean viams, const char *tmpsave, tic #ifdef CLIENT_LOADINGSCREEN if (client && cl_mode != CL_CONNECTED && cl_mode != CL_ABORTED) { + F_MenuPresTicker(true); // title sky F_TitleScreenTicker(true); F_TitleScreenDrawer(); CL_DrawConnectionStatus(); @@ -2014,7 +2036,7 @@ static void CL_ConnectToServer(boolean viams) tic_t asksent; #endif #ifdef JOININGAME - XBOXSTATIC char tmpsave[256]; + char tmpsave[256]; sprintf(tmpsave, "%s" PATHSEP TMPSAVENAME, srb2home); #endif @@ -2259,7 +2281,8 @@ static void Command_connect(void) CONS_Printf(M_GetText( "Connect (port): connect to a server\n" "Connect ANY: connect to the first lan server found\n" - "Connect SELF: connect to your own server.\n")); + //"Connect SELF: connect to your own server.\n" + )); return; } @@ -2273,7 +2296,7 @@ static void Command_connect(void) // we don't request a restart unless the filelist differs server = false; - +/* if (!stricmp(COM_Argv(1), "self")) { servernode = 0; @@ -2282,6 +2305,7 @@ static void Command_connect(void) //SV_SpawnServer(); } else +*/ { // used in menu to connect to a server in the list if (netgame && !stricmp(COM_Argv(1), "node")) @@ -2305,10 +2329,13 @@ static void Command_connect(void) if (!stricmp(COM_Argv(1), "any")) servernode = BROADCASTADDR; - else if (I_NetMakeNodewPort && COM_Argc() >= 3) - servernode = I_NetMakeNodewPort(COM_Argv(1), COM_Argv(2)); else if (I_NetMakeNodewPort) - servernode = I_NetMakeNode(COM_Argv(1)); + { + if (COM_Argc() >= 3) // address AND port + servernode = I_NetMakeNodewPort(COM_Argv(1), COM_Argv(2)); + else // address only, or address:port + servernode = I_NetMakeNode(COM_Argv(1)); + } else { CONS_Alert(CONS_ERROR, M_GetText("There is no server identification with this network driver\n")); @@ -2338,12 +2365,7 @@ static void ResetNode(INT32 node); void CL_ClearPlayer(INT32 playernum) { if (players[playernum].mo) - { - // Don't leave a NiGHTS ghost! - if ((players[playernum].pflags & PF_NIGHTSMODE) && players[playernum].mo->tracer) - P_RemoveMobj(players[playernum].mo->tracer); P_RemoveMobj(players[playernum].mo); - } memset(&players[playernum], 0, sizeof (player_t)); } @@ -2377,11 +2399,11 @@ static void CL_RemovePlayer(INT32 playernum, INT32 reason) if (gametype == GT_CTF) P_PlayerFlagBurst(&players[playernum], false); // Don't take the flag with you! - // If in a special stage, redistribute the player's rings across + // If in a special stage, redistribute the player's spheres across // the remaining players. if (G_IsSpecialStage(gamemap)) { - INT32 i, count, increment, rings; + INT32 i, count, increment, spheres; for (i = 0, count = 0; i < MAXPLAYERS; i++) { @@ -2390,19 +2412,19 @@ static void CL_RemovePlayer(INT32 playernum, INT32 reason) } count--; - rings = players[playernum].health - 1; - increment = rings/count; + spheres = players[playernum].spheres; + increment = spheres/count; for (i = 0; i < MAXPLAYERS; i++) { if (playeringame[i] && i != playernum) { - if (rings < increment) - P_GivePlayerRings(&players[i], rings); + if (spheres < increment) + P_GivePlayerSpheres(&players[i], spheres); else - P_GivePlayerRings(&players[i], increment); + P_GivePlayerSpheres(&players[i], increment); - rings -= increment; + spheres -= increment; } } } @@ -2573,7 +2595,7 @@ static void Command_Ban(void) if (server || IsPlayerAdmin(consoleplayer)) { - XBOXSTATIC UINT8 buf[3 + MAX_REASONLENGTH]; + UINT8 buf[3 + MAX_REASONLENGTH]; UINT8 *p = buf; const SINT8 pn = nametonum(COM_Argv(1)); const INT32 node = playernode[(INT32)pn]; @@ -2678,7 +2700,7 @@ static void Command_Kick(void) if (server || IsPlayerAdmin(consoleplayer)) { - XBOXSTATIC UINT8 buf[3 + MAX_REASONLENGTH]; + UINT8 buf[3 + MAX_REASONLENGTH]; UINT8 *p = buf; const SINT8 pn = nametonum(COM_Argv(1)); @@ -2730,7 +2752,7 @@ static void Command_Kick(void) static void Got_KickCmd(UINT8 **p, INT32 playernum) { INT32 pnum, msg; - XBOXSTATIC char buf[3 + MAX_REASONLENGTH]; + char buf[3 + MAX_REASONLENGTH]; char *reason = buf; kickreason_t kickreason = KR_KICK; @@ -3132,7 +3154,7 @@ static void Got_AddPlayer(UINT8 **p, INT32 playernum) CONS_Alert(CONS_WARNING, M_GetText("Illegal add player command received from %s\n"), player_names[playernum]); if (server) { - XBOXSTATIC UINT8 buf[2]; + UINT8 buf[2]; buf[0] = (UINT8)playernum; buf[1] = KICK_MSG_CON_FAIL; @@ -3200,7 +3222,7 @@ static void Got_AddPlayer(UINT8 **p, INT32 playernum) static boolean SV_AddWaitingPlayers(void) { INT32 node, n, newplayer = false; - XBOXSTATIC UINT8 buf[2]; + UINT8 buf[2]; UINT8 newplayernum = 0; // What is the reason for this? Why can't newplayernum always be 0? @@ -3313,7 +3335,7 @@ void CL_AddSplitscreenPlayer(void) void CL_RemoveSplitscreenPlayer(void) { - XBOXSTATIC UINT8 buf[2]; + UINT8 buf[2]; if (cl_mode != CL_CONNECTED) return; @@ -3678,10 +3700,12 @@ static void HandlePacketFromAwayNode(SINT8 node) for (j = 0; j < MAXPLAYERS; j++) { if (netbuffer->u.servercfg.playerskins[j] == 0xFF - && netbuffer->u.servercfg.playercolor[j] == 0xFF) + && netbuffer->u.servercfg.playercolor[j] == 0xFF + && netbuffer->u.servercfg.playeravailabilities[j] == 0xFFFFFFFF) continue; // not in game playeringame[j] = true; + players[j].availabilities = (UINT32)LONG(netbuffer->u.servercfg.playeravailabilities[j]); SetPlayerSkinByNum(j, (INT32)netbuffer->u.servercfg.playerskins[j]); players[j].skincolor = netbuffer->u.servercfg.playercolor[j]; } @@ -3756,11 +3780,10 @@ static void HandlePacketFromAwayNode(SINT8 node) * */ static void HandlePacketFromPlayer(SINT8 node) -{FILESTAMP - XBOXSTATIC INT32 netconsole; - XBOXSTATIC tic_t realend, realstart; - XBOXSTATIC UINT8 *pak, *txtpak, numtxtpak; -FILESTAMP +{ + INT32 netconsole; + tic_t realend, realstart; + UINT8 *pak, *txtpak, numtxtpak; txtpak = NULL; @@ -3834,7 +3857,7 @@ FILESTAMP if (netcmds[maketic%BACKUPTICS][netconsole].forwardmove > MAXPLMOVE || netcmds[maketic%BACKUPTICS][netconsole].forwardmove < -MAXPLMOVE || netcmds[maketic%BACKUPTICS][netconsole].sidemove > MAXPLMOVE || netcmds[maketic%BACKUPTICS][netconsole].sidemove < -MAXPLMOVE) { - XBOXSTATIC char buf[2]; + char buf[2]; CONS_Alert(CONS_WARNING, M_GetText("Illegal movement value received from node %d\n"), netconsole); //D_Clearticcmd(k); @@ -3877,7 +3900,7 @@ FILESTAMP } else { - XBOXSTATIC UINT8 buf[3]; + UINT8 buf[3]; buf[0] = (UINT8)netconsole; buf[1] = KICK_MSG_CON_FAIL; @@ -3968,7 +3991,7 @@ FILESTAMP nodewaiting[node] = 0; if (netconsole != -1 && playeringame[netconsole]) { - XBOXSTATIC UINT8 buf[2]; + UINT8 buf[2]; buf[0] = (UINT8)netconsole; if (netbuffer->packettype == PT_NODETIMEOUT) buf[1] = KICK_MSG_TIMEOUT; @@ -3996,7 +4019,7 @@ FILESTAMP if (server) { - XBOXSTATIC UINT8 buf[2]; + UINT8 buf[2]; buf[0] = (UINT8)node; buf[1] = KICK_MSG_CON_FAIL; SendNetXCmd(XD_KICK, &buf, 2); @@ -4021,7 +4044,7 @@ FILESTAMP if (server) { - XBOXSTATIC UINT8 buf[2]; + UINT8 buf[2]; buf[0] = (UINT8)node; buf[1] = KICK_MSG_CON_FAIL; SendNetXCmd(XD_KICK, &buf, 2); @@ -4088,7 +4111,7 @@ FILESTAMP if (server) { - XBOXSTATIC char buf[2]; + char buf[2]; buf[0] = (char)node; buf[1] = KICK_MSG_CON_FAIL; SendNetXCmd(XD_KICK, &buf, 2); @@ -4108,7 +4131,7 @@ FILESTAMP if (server) { - XBOXSTATIC char buf[2]; + char buf[2]; buf[0] = (char)node; buf[1] = KICK_MSG_CON_FAIL; SendNetXCmd(XD_KICK, &buf, 2); @@ -4138,7 +4161,7 @@ FILESTAMP if (server) { - XBOXSTATIC UINT8 buf[2]; + UINT8 buf[2]; buf[0] = (UINT8)node; buf[1] = KICK_MSG_CON_FAIL; SendNetXCmd(XD_KICK, &buf, 2); @@ -4161,9 +4184,8 @@ FILESTAMP * */ static void GetPackets(void) -{FILESTAMP - XBOXSTATIC SINT8 node; // The packet sender -FILESTAMP +{ + SINT8 node; // The packet sender player_joining = false; @@ -4683,7 +4705,7 @@ static inline void PingUpdate(void) { if (playeringame[i] && laggers[i]) { - XBOXSTATIC char buf[2]; + char buf[2]; buf[0] = (char)i; buf[1] = KICK_MSG_PING_HIGH; @@ -4755,9 +4777,9 @@ void NetUpdate(void) if (server) CL_SendClientCmd(); // send it -FILESTAMP + GetPackets(); // get packet from client or from server -FILESTAMP + // client send the command after a receive of the server // the server send before because in single player is beter diff --git a/src/d_clisrv.h b/src/d_clisrv.h index 8443b3fc0..4ed7ff957 100644 --- a/src/d_clisrv.h +++ b/src/d_clisrv.h @@ -136,6 +136,7 @@ typedef struct fixed_t flagz[2]; UINT32 ingame; // Spectator bit for each player + UINT32 outofcoop; // outofcoop bit for each player INT32 ctfteam[MAXPLAYERS]; // Which team? (can't be 1 bit, since in regular Match there are no teams) // Resynch game scores and the like all at once @@ -163,7 +164,8 @@ typedef struct UINT16 powers[NUMPOWERS]; // Score is resynched in the confirm resync packet - INT32 health; + INT16 rings; + INT16 spheres; SINT8 lives; SINT8 continues; UINT8 scoreadd; @@ -172,8 +174,11 @@ typedef struct UINT8 skincolor; INT32 skin; + UINT32 availabilities; // Just in case Lua does something like // modify these at runtime + fixed_t camerascale; + fixed_t shieldscale; fixed_t normalspeed; fixed_t runspeed; UINT8 thrustfactor; @@ -185,13 +190,15 @@ typedef struct UINT32 thokitem; // mobjtype_t UINT32 spinitem; // mobjtype_t UINT32 revitem; // mobjtype_t + UINT32 followitem; // mobjtype_t fixed_t actionspd; fixed_t mindash; fixed_t maxdash; fixed_t jumpfactor; + fixed_t playerheight; + fixed_t playerspinheight; fixed_t speed; - UINT8 jumping; UINT8 secondjump; UINT8 fly1; tic_t glidetime; @@ -199,6 +206,7 @@ typedef struct INT32 deadtimer; tic_t exiting; UINT8 homing; + tic_t dashmode; tic_t skidtime; fixed_t cmomx; fixed_t cmomy; @@ -217,7 +225,6 @@ typedef struct INT32 maxlink; fixed_t dashspeed; - INT32 dashtime; angle_t angle_pos; angle_t old_angle_pos; tic_t bumpertime; @@ -240,6 +247,7 @@ typedef struct //player->mo stuff UINT8 hasmo; // Boolean + INT32 health; angle_t angle; fixed_t x; fixed_t y; @@ -279,6 +287,7 @@ typedef struct // 0xFF == not in game; else player skin num UINT8 playerskins[MAXPLAYERS]; UINT8 playercolor[MAXPLAYERS]; + UINT32 playeravailabilities[MAXPLAYERS]; UINT8 gametype; UINT8 modifiedgame; diff --git a/src/d_main.c b/src/d_main.c index 23817750c..527eecd20 100644 --- a/src/d_main.c +++ b/src/d_main.c @@ -30,16 +30,12 @@ int snprintf(char *str, size_t n, const char *fmt, ...); //int vsnprintf(char *str, size_t n, const char *fmt, va_list ap); #endif -#if (defined (_WIN32) && !defined (_WIN32_WCE)) && !defined (_XBOX) +#ifdef _WIN32 #include #include #endif -#if !defined (UNDER_CE) #include -#elif defined (_XBOX) -#define NO_TIME -#endif #include "doomdef.h" #include "am_map.h" @@ -75,6 +71,7 @@ int snprintf(char *str, size_t n, const char *fmt, ...); #include "fastcmp.h" #include "keys.h" #include "filesrch.h" // refreshdirmenu, mainwadstally +#include "g_input.h" // tutorial mode control scheming #ifdef CMAKECONFIG #include "config.h" @@ -82,10 +79,6 @@ int snprintf(char *str, size_t n, const char *fmt, ...); #include "config.h.in" #endif -#ifdef _XBOX -#include "sdl12/SRB2XBOX/xboxhelp.h" -#endif - #ifdef HWRENDER #include "hardware/hw_main.h" // 3D View Rendering #endif @@ -108,8 +101,6 @@ UINT8 window_notinfocus = false; // // DEMO LOOP // -//static INT32 demosequence; -static const char *pagename = "MAP1PIC"; static char *startupwadfiles[MAX_WADFILES]; boolean devparm = false; // started game with -devparm @@ -125,27 +116,17 @@ INT32 postimgparam2; // These variables are only true if // whether the respective sound system is disabled // or they're init'ed, but the player just toggled them -#ifdef _XBOX -boolean midi_disabled = true, sound_disabled = true; -boolean digital_disabled = true; -#else boolean midi_disabled = false; boolean sound_disabled = false; boolean digital_disabled = false; -#endif boolean advancedemo; #ifdef DEBUGFILE INT32 debugload = 0; #endif -#ifdef _arch_dreamcast -char srb2home[256] = "/cd"; -char srb2path[256] = "/cd"; -#else char srb2home[256] = "."; char srb2path[256] = "."; -#endif boolean usehome = true; const char *pandf = "%s" PATHSEP "%s"; @@ -224,6 +205,9 @@ void D_ProcessEvents(void) // wipegamestate can be set to -1 to force a wipe on the next draw // added comment : there is a wipe eatch change of the gamestate gamestate_t wipegamestate = GS_LEVEL; +// -1: Default; 0-n: Wipe index; INT16_MAX: do not wipe +INT16 wipetypepre = -1; +INT16 wipetypepost = -1; static void D_Display(void) { @@ -257,7 +241,7 @@ static void D_Display(void) // save the current screen if about to wipe wipe = (gamestate != wipegamestate); - if (wipe) + if (wipe && wipetypepre != INT16_MAX) { // set for all later wipedefindex = gamestate; // wipe_xxx_toblack @@ -269,25 +253,41 @@ static void D_Display(void) wipedefindex = wipe_multinter_toblack; } + if (wipetypepre < 0 || !F_WipeExists(wipetypepre)) + wipetypepre = wipedefs[wipedefindex]; + if (rendermode != render_none) { // Fade to black first - if (gamestate != GS_LEVEL // fades to black on its own timing, always - && wipedefs[wipedefindex] != UINT8_MAX) + if ((wipegamestate == (gamestate_t)FORCEWIPE || + (wipegamestate != (gamestate_t)FORCEWIPEOFF + && !(gamestate == GS_LEVEL || (gamestate == GS_TITLESCREEN && titlemapinaction))) + ) // fades to black on its own timing, always + && wipetypepre != UINT8_MAX) { F_WipeStartScreen(); V_DrawFill(0, 0, BASEVIDWIDTH, BASEVIDHEIGHT, 31); F_WipeEndScreen(); - F_RunWipe(wipedefs[wipedefindex], gamestate != GS_TIMEATTACK); + F_RunWipe(wipetypepre, gamestate != GS_TIMEATTACK && gamestate != GS_TITLESCREEN); } F_WipeStartScreen(); } + + wipetypepre = -1; } + else + wipetypepre = -1; // do buffered drawing switch (gamestate) { + case GS_TITLESCREEN: + if (!titlemapinaction || !curbghide) { + F_TitleScreenDrawer(); + break; + } + // Intentional fall-through case GS_LEVEL: if (!gametic) break; @@ -322,6 +322,7 @@ static void D_Display(void) case GS_EVALUATION: F_GameEvaluationDrawer(); + HU_Erase(); HU_Drawer(); break; @@ -335,10 +336,6 @@ static void D_Display(void) HU_Drawer(); break; - case GS_TITLESCREEN: - F_TitleScreenDrawer(); - break; - case GS_WAITINGPLAYERS: // The clientconnect drawer is independent... case GS_DEDICATEDSERVER: @@ -346,80 +343,96 @@ static void D_Display(void) break; } - if (gamestate == GS_LEVEL) + // STUPID race condition... + if (wipegamestate == GS_INTRO && gamestate == GS_TITLESCREEN) + wipegamestate = FORCEWIPEOFF; + else { - // draw the view directly - if (cv_renderview.value && !automapactive) + wipegamestate = gamestate; + + // clean up border stuff + // see if the border needs to be initially drawn + if (gamestate == GS_LEVEL || (gamestate == GS_TITLESCREEN && titlemapinaction && curbghide)) { - if (players[displayplayer].mo || players[displayplayer].playerstate == PST_DEAD) - { - topleft = screens[0] + viewwindowy*vid.width + viewwindowx; - objectsdrawn = 0; -#ifdef HWRENDER - if (rendermode != render_soft) - HWR_RenderPlayerView(0, &players[displayplayer]); - else -#endif - if (rendermode != render_none) - R_RenderPlayerView(&players[displayplayer]); - } + // draw the view directly - // render the second screen - if (splitscreen && players[secondarydisplayplayer].mo) + if (!automapactive && !dedicated && cv_renderview.value) { -#ifdef HWRENDER - if (rendermode != render_soft) - HWR_RenderPlayerView(1, &players[secondarydisplayplayer]); - else -#endif - if (rendermode != render_none) + if (players[displayplayer].mo || players[displayplayer].playerstate == PST_DEAD) { - viewwindowy = vid.height / 2; - M_Memcpy(ylookup, ylookup2, viewheight*sizeof (ylookup[0])); - topleft = screens[0] + viewwindowy*vid.width + viewwindowx; + objectsdrawn = 0; + #ifdef HWRENDER + if (rendermode != render_soft) + HWR_RenderPlayerView(0, &players[displayplayer]); + else + #endif + if (rendermode != render_none) + R_RenderPlayerView(&players[displayplayer]); + } - R_RenderPlayerView(&players[secondarydisplayplayer]); + // render the second screen + if (splitscreen && players[secondarydisplayplayer].mo) + { + #ifdef HWRENDER + if (rendermode != render_soft) + HWR_RenderPlayerView(1, &players[secondarydisplayplayer]); + else + #endif + if (rendermode != render_none) + { + viewwindowy = vid.height / 2; + M_Memcpy(ylookup, ylookup2, viewheight*sizeof (ylookup[0])); - viewwindowy = 0; - M_Memcpy(ylookup, ylookup1, viewheight*sizeof (ylookup[0])); + topleft = screens[0] + viewwindowy*vid.width + viewwindowx; + + R_RenderPlayerView(&players[secondarydisplayplayer]); + + viewwindowy = 0; + M_Memcpy(ylookup, ylookup1, viewheight*sizeof (ylookup[0])); + } + } + + // Image postprocessing effect + if (rendermode == render_soft) + { + if (postimgtype) + V_DoPostProcessor(0, postimgtype, postimgparam); + if (postimgtype2) + V_DoPostProcessor(1, postimgtype2, postimgparam2); } } - // Image postprocessing effect - if (rendermode == render_soft) + if (lastdraw) { - if (postimgtype) - V_DoPostProcessor(0, postimgtype, postimgparam); - if (postimgtype2) - V_DoPostProcessor(1, postimgtype2, postimgparam2); + if (rendermode == render_soft) + { + VID_BlitLinearScreen(screens[0], screens[1], vid.width*vid.bpp, vid.height, vid.width*vid.bpp, vid.rowbytes); + usebuffer = true; + } + lastdraw = false; } - } - if (lastdraw) - { - if (rendermode == render_soft) + if (gamestate == GS_LEVEL) { - VID_BlitLinearScreen(screens[0], screens[1], vid.width*vid.bpp, vid.height, vid.width*vid.bpp, vid.rowbytes); - usebuffer = true; + ST_Drawer(); + F_TextPromptDrawer(); + HU_Drawer(); } - lastdraw = false; + else + F_TitleScreenDrawer(); } - - ST_Drawer(); - HU_Drawer(); } // change gamma if needed // (GS_LEVEL handles this already due to level-specific palettes) - if (forcerefresh && gamestate != GS_LEVEL) + if (forcerefresh && !(gamestate == GS_LEVEL || (gamestate == GS_TITLESCREEN && titlemapinaction))) V_SetPalette(0); - wipegamestate = gamestate; - // draw pause pic if (paused && cv_showhud.value && (!menuactive || netgame)) { +#if 0 INT32 py; patch_t *patch; if (automapactive) @@ -428,6 +441,11 @@ static void D_Display(void) py = viewwindowy + 4; patch = W_CachePatchName("M_PAUSE", PU_CACHE); V_DrawScaledPatch(viewwindowx + (BASEVIDWIDTH - SHORT(patch->width))/2, py, 0, patch); +#else + INT32 y = ((automapactive) ? (32) : (BASEVIDHEIGHT/2)); + M_DrawTextBox((BASEVIDWIDTH/2) - (60), y - (16), 13, 2); + V_DrawCenteredString(BASEVIDWIDTH/2, y - (4), V_YELLOWMAP, "Game Paused"); +#endif } // vid size change is now finished if it was on... @@ -443,16 +461,19 @@ static void D_Display(void) // // wipe update // - if (wipe) + if (wipe && wipetypepost != INT16_MAX) { // note: moved up here because NetUpdate does input changes // and input during wipe tends to mess things up wipedefindex += WIPEFINALSHIFT; + if (wipetypepost < 0 || !F_WipeExists(wipetypepost)) + wipetypepost = wipedefs[wipedefindex]; + if (rendermode != render_none) { F_WipeEndScreen(); - F_RunWipe(wipedefs[wipedefindex], gamestate != GS_TIMEATTACK); + F_RunWipe(wipetypepost, gamestate != GS_TIMEATTACK && gamestate != GS_TITLESCREEN); } // reset counters so timedemo doesn't count the wipe duration @@ -461,7 +482,11 @@ static void D_Display(void) framecount = 0; demostarttime = I_GetTime(); } + + wipetypepost = -1; } + else + wipetypepost = -1; NetUpdate(); // send out any new accumulation @@ -651,6 +676,9 @@ void D_AdvanceDemo(void) void D_StartTitle(void) { INT32 i; + + S_StopMusic(); + if (netgame) { if (gametype == GT_COOP) @@ -686,6 +714,7 @@ void D_StartTitle(void) botskin = 0; cv_debug = 0; emeralds = 0; + lastmaploaded = 0; // In case someone exits out at the same time they start a time attack run, // reset modeattacking @@ -694,17 +723,40 @@ void D_StartTitle(void) // empty maptol so mario/etc sounds don't play in sound test when they shouldn't maptol = 0; + // reset to default player stuff + COM_BufAddText (va("%s \"%s\"\n",cv_playername.name,cv_defaultplayername.string)); + COM_BufAddText (va("%s \"%s\"\n",cv_skin.name,cv_defaultskin.string)); + COM_BufAddText (va("%s \"%s\"\n",cv_playercolor.name,cv_defaultplayercolor.string)); + COM_BufAddText (va("%s \"%s\"\n",cv_playername2.name,cv_defaultplayername2.string)); + COM_BufAddText (va("%s \"%s\"\n",cv_skin2.name,cv_defaultskin2.string)); + COM_BufAddText (va("%s \"%s\"\n",cv_playercolor2.name,cv_defaultplayercolor2.string)); + gameaction = ga_nothing; displayplayer = consoleplayer = 0; - //demosequence = -1; gametype = GT_COOP; paused = false; advancedemo = false; + F_InitMenuPresValues(); F_StartTitleScreen(); + currentMenu = &MainDef; // reset the current menu ID + // Reset the palette if (rendermode != render_none) V_SetPaletteLump("PLAYPAL"); + + // The title screen is obviously not a tutorial! (Unless I'm mistaken) + if (tutorialmode && tutorialgcs) + { + G_CopyControls(gamecontrol, gamecontroldefault[gcs_custom], gcl_tutorial_full, num_gcl_tutorial_full); // using gcs_custom as temp storage + CV_SetValue(&cv_usemouse, tutorialusemouse); + CV_SetValue(&cv_alwaysfreelook, tutorialfreelook); + CV_SetValue(&cv_mousemove, tutorialmousemove); + CV_SetValue(&cv_analog, tutorialanalog); + M_StartMessage("Do you want to \x82save the recommended \x82movement controls?\x80\n\nPress 'Y' or 'Enter' to confirm\nPress 'N' or any key to keep \nyour current controls", + M_TutorialSaveControlResponse, MM_YESNO); + } + tutorialmode = false; } // @@ -744,11 +796,11 @@ static inline void D_CleanFile(void) static void IdentifyVersion(void) { - char *srb2wad1, *srb2wad2; + char *srb2wad; const char *srb2waddir = NULL; #if (defined (__unix__) && !defined (MSDOS)) || defined (UNIXCOMMON) || defined (HAVE_SDL) - // change to the directory where 'srb2.srb' is found + // change to the directory where 'srb2.pk3' is found srb2waddir = I_LocateWad(); #endif @@ -759,17 +811,11 @@ static void IdentifyVersion(void) } else { -#if !defined(_WIN32_WCE) && !defined(_PS3) if (getcwd(srb2path, 256) != NULL) srb2waddir = srb2path; else -#endif { -#ifdef _arch_dreamcast - srb2waddir = "/cd"; -#else srb2waddir = "."; -#endif } } @@ -779,31 +825,24 @@ static void IdentifyVersion(void) srb2waddir = I_GetWadDir(); #endif // Commercial. - srb2wad1 = malloc(strlen(srb2waddir)+1+8+1); - srb2wad2 = malloc(strlen(srb2waddir)+1+8+1); - if (srb2wad1 == NULL && srb2wad2 == NULL) + srb2wad = malloc(strlen(srb2waddir)+1+8+1); + if (srb2wad == NULL) I_Error("No more free memory to look in %s", srb2waddir); - if (srb2wad1 != NULL) - sprintf(srb2wad1, pandf, srb2waddir, "srb2.srb"); - if (srb2wad2 != NULL) - sprintf(srb2wad2, pandf, srb2waddir, "srb2.wad"); + else + sprintf(srb2wad, pandf, srb2waddir, "srb2.pk3"); // will be overwritten in case of -cdrom or unix/win home snprintf(configfile, sizeof configfile, "%s" PATHSEP CONFIGFILENAME, srb2waddir); configfile[sizeof configfile - 1] = '\0'; // Load the IWAD - if (srb2wad2 != NULL && FIL_ReadFileOK(srb2wad2)) - D_AddFile(srb2wad2); - else if (srb2wad1 != NULL && FIL_ReadFileOK(srb2wad1)) - D_AddFile(srb2wad1); + if (srb2wad != NULL && FIL_ReadFileOK(srb2wad)) + D_AddFile(srb2wad); else - I_Error("SRB2.SRB/SRB2.WAD not found! Expected in %s, ss files: %s or %s\n", srb2waddir, srb2wad1, srb2wad2); + I_Error("srb2.pk3 not found! Expected in %s, ss file: %s\n", srb2waddir, srb2wad); - if (srb2wad1) - free(srb2wad1); - if (srb2wad2) - free(srb2wad2); + if (srb2wad) + free(srb2wad); // if you change the ordering of this or add/remove a file, be sure to update the md5 // checking in D_SRB2Main @@ -814,12 +853,9 @@ static void IdentifyVersion(void) // Add the players D_AddFile(va(pandf,srb2waddir, "player.dta")); - // Add the weapons - D_AddFile(va(pandf,srb2waddir,"rings.dta")); - #ifdef USE_PATCH_DTA // Add our crappy patches to fix our bugs - D_AddFile(va(pandf,srb2waddir,"patch.dta")); + D_AddFile(va(pandf,srb2waddir,"patch.pk3")); #endif #if !defined (HAVE_SDL) || defined (HAVE_MIXER) @@ -834,36 +870,18 @@ static void IdentifyVersion(void) I_Error("File "str" has been modified with non-music/sound lumps"); \ } -#if defined (DC) && 0 - MUSICTEST("music_dc.dta") -#else MUSICTEST("music.dta") +#ifdef DEVELOP // remove when music_new.dta is merged into music.dta + MUSICTEST("music_new.dta") #endif } #endif } -/* ======================================================================== */ -// Just print the nice red titlebar like the original SRB2 for DOS. -/* ======================================================================== */ #ifdef PC_DOS -static inline void D_Titlebar(char *title1, char *title2) -{ - // SRB2 banner - clrscr(); - textattr((BLUE<<4)+WHITE); - clreol(); - cputs(title1); - - // standard srb2 banner - textattr((RED<<4)+WHITE); - clreol(); - gotoxy((80-strlen(title2))/2, 2); - cputs(title2); - normvideo(); - gotoxy(1,3); -} -#endif +/* ======================================================================== */ +// Code for printing SRB2's title bar in DOS +/* ======================================================================== */ // // Center the title string, then add the date and time of compilation. @@ -892,6 +910,31 @@ static inline void D_MakeTitleString(char *s) strcpy(s, temp); } +static inline void D_Titlebar(void) +{ + char title1[82]; // srb2 title banner + char title2[82]; + + strcpy(title1, "Sonic Robo Blast 2"); + strcpy(title2, "Sonic Robo Blast 2"); + + D_MakeTitleString(title1); + + // SRB2 banner + clrscr(); + textattr((BLUE<<4)+WHITE); + clreol(); + cputs(title1); + + // standard srb2 banner + textattr((RED<<4)+WHITE); + clreol(); + gotoxy((80-strlen(title2))/2, 2); + cputs(title2); + normvideo(); + gotoxy(1,3); +} +#endif // // D_SRB2Main @@ -899,8 +942,6 @@ static inline void D_MakeTitleString(char *s) void D_SRB2Main(void) { INT32 p; - char srb2[82]; // srb2 title banner - char title[82]; INT32 pstartmap = 1; boolean autostart = false; @@ -920,7 +961,7 @@ void D_SRB2Main(void) "in this program.\n\n"); // keep error messages until the final flush(stderr) -#if !defined (PC_DOS) && !defined (_WIN32_WCE) && !defined(NOTERMIOS) +#if !defined (PC_DOS) && !defined(NOTERMIOS) if (setvbuf(stderr, NULL, _IOFBF, 1000)) I_OutputMsg("setvbuf didnt work\n"); #endif @@ -942,11 +983,11 @@ void D_SRB2Main(void) // identify the main IWAD file to use IdentifyVersion(); -#if !defined (_WIN32_WCE) && !defined(NOTERMIOS) +#if !defined(NOTERMIOS) setbuf(stdout, NULL); // non-buffered output #endif -#if defined (_WIN32_WCE) //|| defined (_DEBUG) || defined (GP2X) +#if 0 //defined (_DEBUG) devparm = M_CheckParm("-nodebug") == 0; #else devparm = M_CheckParm("-debug") != 0; @@ -957,20 +998,8 @@ void D_SRB2Main(void) dedicated = M_CheckParm("-dedicated") != 0; #endif - strcpy(title, "Sonic Robo Blast 2"); - strcpy(srb2, "Sonic Robo Blast 2"); - D_MakeTitleString(srb2); - #ifdef PC_DOS - D_Titlebar(srb2, title); -#endif - -#if defined (__OS2__) && !defined (HAVE_SDL) - // set PM window title - snprintf(pmData->title, sizeof (pmData->title), - "Sonic Robo Blast 2" VERSIONSTRING ": %s", - title); - pmData->title[sizeof (pmData->title) - 1] = '\0'; + D_Titlebar(); #endif if (devparm) @@ -984,13 +1013,8 @@ void D_SRB2Main(void) if (!userhome) { -#if ((defined (__unix__) && !defined (MSDOS)) || defined(__APPLE__) || defined (UNIXCOMMON)) && !defined (__CYGWIN__) && !defined (DC) && !defined (PSP) && !defined(GP2X) +#if ((defined (__unix__) && !defined (MSDOS)) || defined(__APPLE__) || defined (UNIXCOMMON)) && !defined (__CYGWIN__) I_Error("Please set $HOME to your home directory\n"); -#elif defined (_WIN32_WCE) && 0 - if (dedicated) - snprintf(configfile, sizeof configfile, "/Storage Card/SRB2DEMO/d"CONFIGFILENAME); - else - snprintf(configfile, sizeof configfile, "/Storage Card/SRB2DEMO/"CONFIGFILENAME); #else if (dedicated) snprintf(configfile, sizeof configfile, "d"CONFIGFILENAME); @@ -1027,10 +1051,6 @@ void D_SRB2Main(void) } configfile[sizeof configfile - 1] = '\0'; - -#ifdef _arch_dreamcast - strcpy(downloaddir, "/ram"); // the dreamcast's TMP -#endif } // rand() needs seeded regardless of password @@ -1092,6 +1112,13 @@ void D_SRB2Main(void) // adapt tables to SRB2's needs, including extra slots for dehacked file support P_PatchInfoTables(); + // initiate menu metadata before SOCcing them + M_InitMenuPresTables(); + + // init title screen display params + if (M_CheckParm("-connect")) + F_InitMenuPresValues(); + //---------------------------------------------------- READY TIME // we need to check for dedicated before initialization of some subsystems @@ -1101,16 +1128,39 @@ void D_SRB2Main(void) // Make backups of some SOCcable tables. P_BackupTables(); - // Setup default unlockable conditions - M_SetupDefaultConditionSets(); - // Setup character tables // Have to be done here before files are loaded M_InitCharacterTables(); + mainwads = 0; + +#ifndef DEVELOP // md5s last updated 12/14/14 + + // Check MD5s of autoloaded files + W_VerifyFileMD5(mainwads++, ASSET_HASH_SRB2_PK3); // srb2.pk3 + W_VerifyFileMD5(mainwads++, ASSET_HASH_ZONES_DTA); // zones.dta + W_VerifyFileMD5(mainwads++, ASSET_HASH_PLAYER_DTA); // player.dta +#ifdef USE_PATCH_DTA + W_VerifyFileMD5(mainwads++, ASSET_HASH_PATCH_DTA); // patch.dta +#endif + // don't check music.dta because people like to modify it, and it doesn't matter if they do + // ...except it does if they slip maps in there, and that's what W_VerifyNMUSlumps is for. + //mainwads++; // music.dta does not increment mainwads (see <= 2.1.21) + //mainwads++; // neither does music_new.dta +#else + + mainwads++; // srb2.pk3 + mainwads++; // zones.dta + mainwads++; // player.dta +#ifdef USE_PATCH_DTA + mainwads++; // patch.dta +#endif + //mainwads++; // music.dta does not increment mainwads (see <= 2.1.21) + //mainwads++; // neither does music_new.dta + // load wad, including the main wad file CONS_Printf("W_InitMultipleFiles(): Adding IWAD and main PWADs.\n"); - if (!W_InitMultipleFiles(startupwadfiles)) + if (!W_InitMultipleFiles(startupwadfiles, mainwads)) #ifdef _DEBUG CONS_Error("A WAD file was not found or not valid.\nCheck the log to see which ones.\n"); #else @@ -1118,37 +1168,12 @@ void D_SRB2Main(void) #endif D_CleanFile(); - mainwads = 0; - -#ifndef DEVELOP // md5s last updated 12/14/14 - - // Check MD5s of autoloaded files - W_VerifyFileMD5(mainwads++, ASSET_HASH_SRB2_SRB); // srb2.srb/srb2.wad - W_VerifyFileMD5(mainwads++, ASSET_HASH_ZONES_DTA); // zones.dta - W_VerifyFileMD5(mainwads++, ASSET_HASH_PLAYER_DTA); // player.dta - W_VerifyFileMD5(mainwads++, ASSET_HASH_RINGS_DTA); // rings.dta -#ifdef USE_PATCH_DTA - W_VerifyFileMD5(mainwads++, ASSET_HASH_PATCH_DTA); // patch.dta -#endif - // don't check music.dta because people like to modify it, and it doesn't matter if they do - // ...except it does if they slip maps in there, and that's what W_VerifyNMUSlumps is for. - //mainwads++; // music.dta does not increment mainwads (see <= 2.1.21) - -#else - - mainwads++; // srb2.srb/srb2.wad - mainwads++; // zones.dta - mainwads++; // player.dta - mainwads++; // rings.dta -#ifdef USE_PATCH_DTA - mainwads++; // patch.dta -#endif - //mainwads++; // music.dta does not increment mainwads (see <= 2.1.21) - #endif //ifndef DEVELOP mainwadstally = packetsizetally; + mainwadstally = packetsizetally; + cht_Init(); //---------------------------------------------------- READY SCREEN @@ -1166,12 +1191,7 @@ void D_SRB2Main(void) HU_Init(); COM_Init(); - // libogc has a CON_Init function, we must rename SRB2's CON_Init in WII/libogc -#ifndef _WII CON_Init(); -#else - CON_InitWii(); -#endif D_RegisterServerCommands(); D_RegisterClientCommands(); // be sure that this is called before D_CheckNetGame @@ -1319,6 +1339,19 @@ void D_SRB2Main(void) ultimatemode = true; } + // rei/miru: bootmap (Idea: starts the game on a predefined map) + if (bootmap && !(M_CheckParm("-warp") && M_IsNextParm())) + { + pstartmap = bootmap; + + if (pstartmap < 1 || pstartmap > NUMMAPS) + I_Error("Cannot warp to map %d (out of range)\n", pstartmap); + else + { + autostart = true; + } + } + if (autostart || netgame) { gameaction = ga_nothing; @@ -1365,11 +1398,14 @@ void D_SRB2Main(void) else if (!dedicated && M_MapLocked(pstartmap)) I_Error("You need to unlock this level before you can warp to it!\n"); else + { D_MapChange(pstartmap, gametype, ultimatemode, true, 0, false, false); + } } } else if (M_CheckParm("-skipintro")) { + F_InitMenuPresValues(); F_StartTitleScreen(); } else @@ -1379,7 +1415,6 @@ void D_SRB2Main(void) if (dedicated && server) { - pagename = "TITLESKY"; levelstarttic = gametic; G_SetGamestate(GS_LEVEL); if (!P_SetupLevel(false)) @@ -1394,26 +1429,19 @@ const char *D_Home(void) #ifdef ANDROID return "/data/data/org.srb2/"; #endif -#ifdef _arch_dreamcast - char VMUHOME[] = "HOME=/vmu/a1"; - putenv(VMUHOME); //don't use I_PutEnv -#endif if (M_CheckParm("-home") && M_IsNextParm()) userhome = M_GetNextParm(); else { -#if defined (GP2X) - usehome = false; //let use the CWD - return NULL; -#elif !((defined (__unix__) && !defined (MSDOS)) || defined(__APPLE__) || defined (UNIXCOMMON)) && !defined (__APPLE__) && !defined(_WIN32_WCE) +#if !((defined (__unix__) && !defined (MSDOS)) || defined(__APPLE__) || defined (UNIXCOMMON)) && !defined (__APPLE__) if (FIL_FileOK(CONFIGFILENAME)) usehome = false; // Let's NOT use home else #endif userhome = I_GetEnv("HOME"); //Alam: my new HOME for srb2 } -#if defined (_WIN32) && !defined(_WIN32_WCE) //Alam: only Win32 have APPDATA and USERPROFILE +#ifdef _WIN32 //Alam: only Win32 have APPDATA and USERPROFILE if (!userhome && usehome) //Alam: Still not? { char *testhome = NULL; diff --git a/src/d_net.c b/src/d_net.c index cdd63ea32..9f68c187c 100644 --- a/src/d_net.c +++ b/src/d_net.c @@ -1360,11 +1360,6 @@ boolean D_CheckNetGame(void) netbuffer = (doomdata_t *)(void *)&doomcom->data; #ifdef DEBUGFILE -#ifdef _arch_dreamcast - //debugfile = stderr; - if (debugfile) - CONS_Printf(M_GetText("debug output to: %s\n"), "STDERR"); -#else if (M_CheckParm("-debugfile")) { char filename[21]; @@ -1382,7 +1377,6 @@ boolean D_CheckNetGame(void) else CONS_Alert(CONS_WARNING, M_GetText("cannot debug output to file %s!\n"), va("%s" PATHSEP "%s", srb2home, filename)); } -#endif #endif D_ClientServerInit(); diff --git a/src/d_netcmd.c b/src/d_netcmd.c index 689576018..98267869b 100644 --- a/src/d_netcmd.c +++ b/src/d_netcmd.c @@ -62,9 +62,6 @@ static void Got_WeaponPref(UINT8 **cp, INT32 playernum); static void Got_Mapcmd(UINT8 **cp, INT32 playernum); static void Got_ExitLevelcmd(UINT8 **cp, INT32 playernum); static void Got_RequestAddfilecmd(UINT8 **cp, INT32 playernum); -#ifdef DELFILE -static void Got_Delfilecmd(UINT8 **cp, INT32 playernum); -#endif static void Got_Addfilecmd(UINT8 **cp, INT32 playernum); static void Got_Pause(UINT8 **cp, INT32 playernum); static void Got_Suicide(UINT8 **cp, INT32 playernum); @@ -86,6 +83,9 @@ static void TeamScramble_OnChange(void); static void NetTimeout_OnChange(void); static void JoinTimeout_OnChange(void); +static void CoopStarposts_OnChange(void); +static void CoopLives_OnChange(void); + static void Ringslinger_OnChange(void); static void Gravity_OnChange(void); static void ForceSkin_OnChange(void); @@ -113,9 +113,6 @@ static void Command_ResetCamera_f(void); static void Command_Addfile(void); static void Command_ListWADS_f(void); -#ifdef DELFILE -static void Command_Delfile(void); -#endif static void Command_RunSOC(void); static void Command_Pause(void); static void Command_Suicide(void); @@ -187,22 +184,20 @@ static CV_PossibleValue_t joyport_cons_t[] = {{1, "/dev/js0"}, {2, "/dev/js1"}, #define usejoystick_cons_t NULL #endif -static CV_PossibleValue_t autobalance_cons_t[] = {{0, "MIN"}, {4, "MAX"}, {0, NULL}}; static CV_PossibleValue_t teamscramble_cons_t[] = {{0, "Off"}, {1, "Random"}, {2, "Points"}, {0, NULL}}; static CV_PossibleValue_t startingliveslimit_cons_t[] = {{1, "MIN"}, {99, "MAX"}, {0, NULL}}; static CV_PossibleValue_t sleeping_cons_t[] = {{-1, "MIN"}, {1000/TICRATE, "MAX"}, {0, NULL}}; -static CV_PossibleValue_t competitionboxes_cons_t[] = {{0, "Normal"}, {1, "Random"}, {2, "Teleports"}, +static CV_PossibleValue_t competitionboxes_cons_t[] = {{0, "Normal"}, {1, "Mystery"}, //{2, "Teleport"}, {3, "None"}, {0, NULL}}; -static CV_PossibleValue_t matchboxes_cons_t[] = {{0, "Normal"}, {1, "Random"}, {2, "Non-Random"}, +static CV_PossibleValue_t matchboxes_cons_t[] = {{0, "Normal"}, {1, "Mystery"}, {2, "Unchanging"}, {3, "None"}, {0, NULL}}; static CV_PossibleValue_t chances_cons_t[] = {{0, "MIN"}, {9, "MAX"}, {0, NULL}}; -static CV_PossibleValue_t match_scoring_cons_t[] = {{0, "Normal"}, {1, "Classic"}, {0, NULL}}; static CV_PossibleValue_t pause_cons_t[] = {{0, "Server"}, {1, "All"}, {0, NULL}}; -static CV_PossibleValue_t timetic_cons_t[] = {{0, "Normal"}, {1, "Tics"}, {2, "Centiseconds"}, {0, NULL}}; +consvar_t cv_showinputjoy = {"showinputjoy", "Off", 0, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL}; #ifdef NETGAME_DEVMODE static consvar_t cv_fishcake = {"fishcake", "Off", CV_CALL|CV_NOSHOWHELP|CV_RESTRICT, CV_OnOff, Fishcake_OnChange, 0, NULL, NULL, 0, 0, NULL}; @@ -218,7 +213,7 @@ consvar_t cv_startinglives = {"startinglives", "3", CV_NETVAR|CV_CHEAT, starting static CV_PossibleValue_t respawntime_cons_t[] = {{0, "MIN"}, {30, "MAX"}, {0, NULL}}; consvar_t cv_respawntime = {"respawndelay", "3", CV_NETVAR|CV_CHEAT, respawntime_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL}; -consvar_t cv_competitionboxes = {"competitionboxes", "Random", CV_NETVAR|CV_CHEAT, competitionboxes_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL}; +consvar_t cv_competitionboxes = {"competitionboxes", "Mystery", CV_NETVAR|CV_CHEAT, competitionboxes_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL}; #ifdef SEENAMES static CV_PossibleValue_t seenames_cons_t[] = {{0, "Off"}, {1, "Colorless"}, {2, "Team"}, {3, "Ally/Foe"}, {0, NULL}}; @@ -226,9 +221,9 @@ consvar_t cv_seenames = {"seenames", "Ally/Foe", CV_SAVE, seenames_cons_t, 0, 0, consvar_t cv_allowseenames = {"allowseenames", "Yes", CV_NETVAR, CV_YesNo, NULL, 0, NULL, NULL, 0, 0, NULL}; #endif -// these are just meant to be saved to the config -consvar_t cv_playername = {"name", "Sonic", CV_SAVE|CV_CALL|CV_NOINIT, NULL, Name_OnChange, 0, NULL, NULL, 0, 0, NULL}; -consvar_t cv_playername2 = {"name2", "Tails", CV_SAVE|CV_CALL|CV_NOINIT, NULL, Name2_OnChange, 0, NULL, NULL, 0, 0, NULL}; +// names +consvar_t cv_playername = {"name", "Sonic", CV_CALL|CV_NOINIT, NULL, Name_OnChange, 0, NULL, NULL, 0, 0, NULL}; +consvar_t cv_playername2 = {"name2", "Tails", CV_CALL|CV_NOINIT, NULL, Name2_OnChange, 0, NULL, NULL, 0, 0, NULL}; // player colors consvar_t cv_playercolor = {"color", "Blue", CV_CALL|CV_NOINIT, Color_cons_t, Color_OnChange, 0, NULL, NULL, 0, 0, NULL}; consvar_t cv_playercolor2 = {"color2", "Orange", CV_CALL|CV_NOINIT, Color_cons_t, Color2_OnChange, 0, NULL, NULL, 0, 0, NULL}; @@ -236,6 +231,14 @@ consvar_t cv_playercolor2 = {"color2", "Orange", CV_CALL|CV_NOINIT, Color_cons_t consvar_t cv_skin = {"skin", DEFAULTSKIN, CV_CALL|CV_NOINIT, NULL, Skin_OnChange, 0, NULL, NULL, 0, 0, NULL}; consvar_t cv_skin2 = {"skin2", DEFAULTSKIN2, CV_CALL|CV_NOINIT, NULL, Skin2_OnChange, 0, NULL, NULL, 0, 0, NULL}; +// saved versions of the above six +consvar_t cv_defaultplayername = {"defaultname", "Sonic", CV_SAVE, NULL, NULL, 0, NULL, NULL, 0, 0, NULL}; +consvar_t cv_defaultplayername2 = {"defaultname2", "Tails", CV_SAVE, NULL, NULL, 0, NULL, NULL, 0, 0, NULL}; +consvar_t cv_defaultplayercolor = {"defaultcolor", "Blue", CV_SAVE, Color_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL}; +consvar_t cv_defaultplayercolor2 = {"defaultcolor2", "Orange", CV_SAVE, Color_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL}; +consvar_t cv_defaultskin = {"defaultskin", DEFAULTSKIN, CV_SAVE, NULL, NULL, 0, NULL, NULL, 0, 0, NULL}; +consvar_t cv_defaultskin2 = {"defaultskin2", DEFAULTSKIN2, CV_SAVE, NULL, NULL, 0, NULL, NULL, 0, 0, NULL}; + consvar_t cv_skipmapcheck = {"skipmapcheck", "Off", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL}; INT32 cv_debug; @@ -243,22 +246,10 @@ INT32 cv_debug; consvar_t cv_usemouse = {"use_mouse", "On", CV_SAVE|CV_CALL,usemouse_cons_t, I_StartupMouse, 0, NULL, NULL, 0, 0, NULL}; consvar_t cv_usemouse2 = {"use_mouse2", "Off", CV_SAVE|CV_CALL,usemouse_cons_t, I_StartupMouse2, 0, NULL, NULL, 0, 0, NULL}; -#if defined (DC) || defined (_XBOX) || defined (WMINPUT) || defined (_WII) || defined(HAVE_SDL) || defined(_WINDOWS) //joystick 1 and 2 consvar_t cv_usejoystick = {"use_joystick", "1", CV_SAVE|CV_CALL, usejoystick_cons_t, I_InitJoystick, 0, NULL, NULL, 0, 0, NULL}; consvar_t cv_usejoystick2 = {"use_joystick2", "2", CV_SAVE|CV_CALL, usejoystick_cons_t, I_InitJoystick2, 0, NULL, NULL, 0, 0, NULL}; -#elif defined (PSP) || defined (GP2X) || defined (_NDS) //only one joystick -consvar_t cv_usejoystick = {"use_joystick", "1", CV_SAVE|CV_CALL, usejoystick_cons_t, - I_InitJoystick, 0, NULL, NULL, 0, 0, NULL}; -consvar_t cv_usejoystick2 = {"use_joystick2", "0", CV_SAVE|CV_CALL, usejoystick_cons_t, - I_InitJoystick2, 0, NULL, NULL, 0, 0, NULL}; -#else //all esle, no joystick -consvar_t cv_usejoystick = {"use_joystick", "0", CV_SAVE|CV_CALL, usejoystick_cons_t, - I_InitJoystick, 0, NULL, NULL, 0, 0, NULL}; -consvar_t cv_usejoystick2 = {"use_joystick2", "0", CV_SAVE|CV_CALL, usejoystick_cons_t, - I_InitJoystick2, 0, NULL, NULL, 0, 0, NULL}; -#endif #if (defined (LJOYSTICK) || defined (HAVE_SDL)) #ifdef LJOYSTICK consvar_t cv_joyport = {"joyport", "/dev/js0", CV_SAVE, joyport_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL}; @@ -306,7 +297,7 @@ consvar_t cv_countdowntime = {"countdowntime", "60", CV_NETVAR|CV_CHEAT, minitim consvar_t cv_touchtag = {"touchtag", "Off", CV_NETVAR, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL}; consvar_t cv_hidetime = {"hidetime", "30", CV_NETVAR|CV_CALL, minitimelimit_cons_t, Hidetime_OnChange, 0, NULL, NULL, 0, 0, NULL}; -consvar_t cv_autobalance = {"autobalance", "0", CV_NETVAR|CV_CALL, autobalance_cons_t, AutoBalance_OnChange, 0, NULL, NULL, 0, 0, NULL}; +consvar_t cv_autobalance = {"autobalance", "Off", CV_NETVAR|CV_CALL, CV_OnOff, AutoBalance_OnChange, 0, NULL, NULL, 0, 0, NULL}; consvar_t cv_teamscramble = {"teamscramble", "Off", CV_NETVAR|CV_CALL|CV_NOINIT, teamscramble_cons_t, TeamScramble_OnChange, 0, NULL, NULL, 0, 0, NULL}; consvar_t cv_scrambleonchange = {"scrambleonchange", "Off", CV_NETVAR, teamscramble_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL}; @@ -314,12 +305,16 @@ consvar_t cv_friendlyfire = {"friendlyfire", "Off", CV_NETVAR, CV_OnOff, NULL, 0 consvar_t cv_itemfinder = {"itemfinder", "Off", CV_CALL, CV_OnOff, ItemFinder_OnChange, 0, NULL, NULL, 0, 0, NULL}; // Scoring type options -consvar_t cv_match_scoring = {"matchscoring", "Normal", CV_NETVAR|CV_CHEAT, match_scoring_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL}; consvar_t cv_overtime = {"overtime", "Yes", CV_NETVAR, CV_YesNo, NULL, 0, NULL, NULL, 0, 0, NULL}; consvar_t cv_rollingdemos = {"rollingdemos", "On", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL}; -consvar_t cv_timetic = {"timerres", "Normal", CV_SAVE, timetic_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL}; // use tics in display +static CV_PossibleValue_t timetic_cons_t[] = {{0, "Classic"}, {1, "Centiseconds"}, {2, "Mania"}, {3, "Tics"}, {0, NULL}}; +consvar_t cv_timetic = {"timerres", "Classic", CV_SAVE, timetic_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL}; + +static CV_PossibleValue_t powerupdisplay_cons_t[] = {{0, "Never"}, {1, "First-person only"}, {2, "Always"}, {0, NULL}}; +consvar_t cv_powerupdisplay = {"powerupdisplay", "First-person only", CV_SAVE, powerupdisplay_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL}; + static CV_PossibleValue_t pointlimit_cons_t[] = {{0, "MIN"}, {999999990, "MAX"}, {0, NULL}}; consvar_t cv_pointlimit = {"pointlimit", "0", CV_NETVAR|CV_CALL|CV_NOINIT, pointlimit_cons_t, PointLimit_OnChange, 0, NULL, NULL, 0, 0, NULL}; @@ -334,7 +329,7 @@ consvar_t cv_usemapnumlaps = {"usemaplaps", "Yes", CV_NETVAR, CV_YesNo, NULL, 0, // log elemental hazards -- not a netvar, is local to current player consvar_t cv_hazardlog = {"hazardlog", "Yes", 0, CV_YesNo, NULL, 0, NULL, NULL, 0, 0, NULL}; -consvar_t cv_forceskin = {"forceskin", "-1", CV_NETVAR|CV_CALL|CV_CHEAT, NULL, ForceSkin_OnChange, 0, NULL, NULL, 0, 0, NULL}; +consvar_t cv_forceskin = {"forceskin", "None", CV_NETVAR|CV_CALL|CV_CHEAT, NULL, ForceSkin_OnChange, 0, NULL, NULL, 0, 0, NULL}; consvar_t cv_downloading = {"downloading", "On", 0, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL}; consvar_t cv_allowexitlevel = {"allowexitlevel", "No", CV_NETVAR, CV_YesNo, NULL, 0, NULL, NULL, 0, 0, NULL}; @@ -350,12 +345,18 @@ consvar_t cv_maxping = {"maxping", "0", CV_SAVE, CV_Unsigned, NULL, 0, NULL, NUL #endif // Intermission time Tails 04-19-2002 static CV_PossibleValue_t inttime_cons_t[] = {{0, "MIN"}, {3600, "MAX"}, {0, NULL}}; -consvar_t cv_inttime = {"inttime", "20", CV_NETVAR, inttime_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL}; +consvar_t cv_inttime = {"inttime", "10", CV_NETVAR, inttime_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL}; + +static CV_PossibleValue_t coopstarposts_cons_t[] = {{0, "Per-player"}, {1, "Shared"}, {2, "Teamwork"}, {0, NULL}}; +consvar_t cv_coopstarposts = {"coopstarposts", "Teamwork", CV_NETVAR|CV_CALL|CV_CHEAT, coopstarposts_cons_t, CoopStarposts_OnChange, 0, NULL, NULL, 0, 0, NULL}; + +static CV_PossibleValue_t cooplives_cons_t[] = {{0, "Infinite"}, {1, "Per-player"}, {2, "Avoid Game Over"}, {3, "Single pool"}, {0, NULL}}; +consvar_t cv_cooplives = {"cooplives", "Avoid Game Over", CV_NETVAR|CV_CALL|CV_CHEAT, cooplives_cons_t, CoopLives_OnChange, 0, NULL, NULL, 0, 0, NULL}; static CV_PossibleValue_t advancemap_cons_t[] = {{0, "Off"}, {1, "Next"}, {2, "Random"}, {0, NULL}}; consvar_t cv_advancemap = {"advancemap", "Next", CV_NETVAR, advancemap_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL}; -static CV_PossibleValue_t playersforexit_cons_t[] = {{0, "One"}, {1, "All"}, {0, NULL}}; -consvar_t cv_playersforexit = {"playersforexit", "One", CV_NETVAR, playersforexit_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL}; +static CV_PossibleValue_t playersforexit_cons_t[] = {{0, "One"}, {1, "1/4"}, {2, "Half"}, {3, "3/4"}, {4, "All"}, {0, NULL}}; +consvar_t cv_playersforexit = {"playersforexit", "All", CV_NETVAR, playersforexit_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL}; consvar_t cv_runscripts = {"runscripts", "Yes", 0, CV_YesNo, NULL, 0, NULL, NULL, 0, 0, NULL}; @@ -394,7 +395,7 @@ const char *netxcmdnames[MAXNETXCMD - 1] = "RANDOMSEED", "RUNSOC", "REQADDFILE", - "DELFILE", + "DELFILE", // replace next time we add an XD "SETMOTD", "SUICIDE", #ifdef HAVE_BLUA @@ -430,9 +431,6 @@ void D_RegisterServerCommands(void) RegisterNetXCmd(XD_EXITLEVEL, Got_ExitLevelcmd); RegisterNetXCmd(XD_ADDFILE, Got_Addfilecmd); RegisterNetXCmd(XD_REQADDFILE, Got_RequestAddfilecmd); -#ifdef DELFILE - RegisterNetXCmd(XD_DELFILE, Got_Delfilecmd); -#endif RegisterNetXCmd(XD_PAUSE, Got_Pause); RegisterNetXCmd(XD_SUICIDE, Got_Suicide); RegisterNetXCmd(XD_RUNSOC, Got_RunSOCcmd); @@ -468,9 +466,6 @@ void D_RegisterServerCommands(void) COM_AddCommand("addfile", Command_Addfile); COM_AddCommand("listwad", Command_ListWADS_f); -#ifdef DELFILE - COM_AddCommand("delfile", Command_Delfile); -#endif COM_AddCommand("runsoc", Command_RunSOC); COM_AddCommand("pause", Command_Pause); COM_AddCommand("suicide", Command_Suicide); @@ -503,7 +498,6 @@ void D_RegisterServerCommands(void) CV_RegisterVar(&cv_itemrespawntime); CV_RegisterVar(&cv_itemrespawn); CV_RegisterVar(&cv_flagtime); - CV_RegisterVar(&cv_suddendeath); // misc CV_RegisterVar(&cv_friendlyfire); @@ -528,6 +522,9 @@ void D_RegisterServerCommands(void) CV_RegisterVar(&cv_forceskin); CV_RegisterVar(&cv_downloading); + CV_RegisterVar(&cv_coopstarposts); + CV_RegisterVar(&cv_cooplives); + CV_RegisterVar(&cv_specialrings); CV_RegisterVar(&cv_powerstones); CV_RegisterVar(&cv_competitionboxes); @@ -551,7 +548,6 @@ void D_RegisterServerCommands(void) CV_RegisterVar(&cv_startinglives); CV_RegisterVar(&cv_countdowntime); CV_RegisterVar(&cv_runscripts); - CV_RegisterVar(&cv_match_scoring); CV_RegisterVar(&cv_overtime); CV_RegisterVar(&cv_pause); CV_RegisterVar(&cv_mute); @@ -633,6 +629,7 @@ void D_RegisterClientCommands(void) CV_RegisterVar(&cv_screenshot_option); CV_RegisterVar(&cv_screenshot_folder); + CV_RegisterVar(&cv_screenshot_colorprofile); CV_RegisterVar(&cv_moviemode); // PNG variables CV_RegisterVar(&cv_zlib_level); @@ -661,6 +658,13 @@ void D_RegisterClientCommands(void) CV_RegisterVar(&cv_playername2); CV_RegisterVar(&cv_playercolor2); CV_RegisterVar(&cv_skin2); + // saved versions of the above six + CV_RegisterVar(&cv_defaultplayername); + CV_RegisterVar(&cv_defaultplayercolor); + CV_RegisterVar(&cv_defaultskin); + CV_RegisterVar(&cv_defaultplayername2); + CV_RegisterVar(&cv_defaultplayercolor2); + CV_RegisterVar(&cv_defaultskin2); #ifdef SEENAMES CV_RegisterVar(&cv_seenames); @@ -674,7 +678,9 @@ void D_RegisterClientCommands(void) // HUD CV_RegisterVar(&cv_timetic); + CV_RegisterVar(&cv_powerupdisplay); CV_RegisterVar(&cv_itemfinder); + CV_RegisterVar(&cv_showinputjoy); // time attack ghost options are also saved to config CV_RegisterVar(&cv_ghost_bestscore); @@ -686,7 +692,29 @@ void D_RegisterClientCommands(void) COM_AddCommand("displayplayer", Command_Displayplayer_f); // FIXME: not to be here.. but needs be done for config loading - CV_RegisterVar(&cv_usegamma); + CV_RegisterVar(&cv_globalgamma); + CV_RegisterVar(&cv_globalsaturation); + + CV_RegisterVar(&cv_rhue); + CV_RegisterVar(&cv_yhue); + CV_RegisterVar(&cv_ghue); + CV_RegisterVar(&cv_chue); + CV_RegisterVar(&cv_bhue); + CV_RegisterVar(&cv_mhue); + + CV_RegisterVar(&cv_rgamma); + CV_RegisterVar(&cv_ygamma); + CV_RegisterVar(&cv_ggamma); + CV_RegisterVar(&cv_cgamma); + CV_RegisterVar(&cv_bgamma); + CV_RegisterVar(&cv_mgamma); + + CV_RegisterVar(&cv_rsaturation); + CV_RegisterVar(&cv_ysaturation); + CV_RegisterVar(&cv_gsaturation); + CV_RegisterVar(&cv_csaturation); + CV_RegisterVar(&cv_bsaturation); + CV_RegisterVar(&cv_msaturation); // m_menu.c CV_RegisterVar(&cv_compactscoreboard); @@ -703,6 +731,7 @@ void D_RegisterClientCommands(void) CV_RegisterVar(&cv_alwaysfreelook2); CV_RegisterVar(&cv_chasefreelook); CV_RegisterVar(&cv_chasefreelook2); + CV_RegisterVar(&cv_tutorialprompt); // g_input.c CV_RegisterVar(&cv_sideaxis); @@ -764,8 +793,15 @@ void D_RegisterClientCommands(void) CV_RegisterVar(&cv_useranalog); CV_RegisterVar(&cv_useranalog2); + // deez New User eXperiences + CV_RegisterVar(&cv_directionchar); + CV_RegisterVar(&cv_directionchar2); + CV_RegisterVar(&cv_autobrake); + CV_RegisterVar(&cv_autobrake2); + // s_sound.c CV_RegisterVar(&cv_soundvolume); + CV_RegisterVar(&cv_closedcaptioning); CV_RegisterVar(&cv_digmusicvolume); CV_RegisterVar(&cv_midimusicvolume); CV_RegisterVar(&cv_numChannels); @@ -788,6 +824,7 @@ void D_RegisterClientCommands(void) COM_AddCommand("writethings", Command_Writethings_f); CV_RegisterVar(&cv_speed); CV_RegisterVar(&cv_opflags); + CV_RegisterVar(&cv_ophoopflags); CV_RegisterVar(&cv_mapthingnum); // CV_RegisterVar(&cv_grid); // CV_RegisterVar(&cv_snapto); @@ -1030,7 +1067,7 @@ static void SetPlayerName(INT32 playernum, char *newname) CONS_Printf(M_GetText("Player %d sent a bad name change\n"), playernum+1); if (server && netgame) { - XBOXSTATIC UINT8 buf[2]; + UINT8 buf[2]; buf[0] = (UINT8)playernum; buf[1] = KICK_MSG_CON_FAIL; @@ -1046,7 +1083,7 @@ UINT8 CanChangeSkin(INT32 playernum) return true; // Force skin in effect. - if (client && (cv_forceskin.value != -1) && !(IsPlayerAdmin(playernum) && serverplayer == -1)) + if ((cv_forceskin.value != -1) || (mapheaderinfo[gamemap-1] && mapheaderinfo[gamemap-1]->forcecharacter[0] != '\0')) return false; // Can change skin in intermission and whatnot. @@ -1110,7 +1147,7 @@ static INT32 snacpending = 0, snac2pending = 0, chmappending = 0; // static void SendNameAndColor(void) { - XBOXSTATIC char buf[MAXPLAYERNAME+2]; + char buf[MAXPLAYERNAME+2]; char *p; p = buf; @@ -1144,6 +1181,8 @@ static void SendNameAndColor(void) if (!Playing()) return; + players[consoleplayer].availabilities = R_GetSkinAvailabilities(); + // If you're not in a netgame, merely update the skin, color, and name. if (!netgame) { @@ -1162,7 +1201,7 @@ static void SendNameAndColor(void) SetPlayerSkinByNum(consoleplayer, 0); CV_StealthSet(&cv_skin, skins[0].name); } - else if ((foundskin = R_SkinAvailable(cv_skin.string)) != -1) + else if ((foundskin = R_SkinAvailable(cv_skin.string)) != -1 && R_SkinUsable(consoleplayer, foundskin)) { boolean notsame; @@ -1177,7 +1216,7 @@ static void SendNameAndColor(void) { CV_StealthSetValue(&cv_playercolor, skins[cv_skin.value].prefcolor); - players[consoleplayer].skincolor = (cv_playercolor.value&0x1F) % MAXSKINCOLORS; + players[consoleplayer].skincolor = cv_playercolor.value % MAXSKINCOLORS; if (players[consoleplayer].mo) players[consoleplayer].mo->color = (UINT8)players[consoleplayer].skincolor; @@ -1209,7 +1248,7 @@ static void SendNameAndColor(void) // check if player has the skin loaded (cv_skin may have // the name of a skin that was available in the previous game) cv_skin.value = R_SkinAvailable(cv_skin.string); - if (cv_skin.value < 0) + if ((cv_skin.value < 0) || !R_SkinUsable(consoleplayer, cv_skin.value)) { CV_StealthSet(&cv_skin, DEFAULTSKIN); cv_skin.value = 0; @@ -1217,6 +1256,7 @@ static void SendNameAndColor(void) // Finally write out the complete packet and send it off. WRITESTRINGN(p, cv_playername.zstring, MAXPLAYERNAME); + WRITEUINT32(p, (UINT32)players[consoleplayer].availabilities); WRITEUINT8(p, (UINT8)cv_playercolor.value); WRITEUINT8(p, (UINT8)cv_skin.value); SendNetXCmd(XD_NAMEANDCOLOR, buf, p - buf); @@ -1259,6 +1299,8 @@ static void SendNameAndColor2(void) if (!Playing()) return; + players[secondplaya].availabilities = R_GetSkinAvailabilities(); + // If you're not in a netgame, merely update the skin, color, and name. if (botingame) { @@ -1287,7 +1329,7 @@ static void SendNameAndColor2(void) SetPlayerSkinByNum(secondplaya, forcedskin); CV_StealthSet(&cv_skin2, skins[forcedskin].name); } - else if ((foundskin = R_SkinAvailable(cv_skin2.string)) != -1) + else if ((foundskin = R_SkinAvailable(cv_skin2.string)) != -1 && R_SkinUsable(secondplaya, foundskin)) { boolean notsame; @@ -1301,7 +1343,7 @@ static void SendNameAndColor2(void) { CV_StealthSetValue(&cv_playercolor2, skins[players[secondplaya].skin].prefcolor); - players[secondplaya].skincolor = (cv_playercolor2.value&0x1F) % MAXSKINCOLORS; + players[secondplaya].skincolor = cv_playercolor2.value % MAXSKINCOLORS; if (players[secondplaya].mo) players[secondplaya].mo->color = players[secondplaya].skincolor; @@ -1342,6 +1384,7 @@ static void Got_NameAndColor(UINT8 **cp, INT32 playernum) #endif READSTRINGN(*cp, name, MAXPLAYERNAME); + p->availabilities = READUINT32(*cp); color = READUINT8(*cp); skin = READUINT8(*cp); @@ -1358,6 +1401,7 @@ static void Got_NameAndColor(UINT8 **cp, INT32 playernum) if (server && (p != &players[consoleplayer] && p != &players[secondarydisplayplayer])) { boolean kick = false; + INT32 s; // team colors if (G_GametypeHasTeams()) @@ -1372,9 +1416,19 @@ static void Got_NameAndColor(UINT8 **cp, INT32 playernum) if (!p->skincolor) kick = true; + // availabilities + for (s = 0; s < MAXSKINS; s++) + { + if (!skins[s].availability && (p->availabilities & (1 << s))) + { + kick = true; + break; + } + } + if (kick) { - XBOXSTATIC UINT8 buf[2]; + UINT8 buf[2]; CONS_Alert(CONS_WARNING, M_GetText("Illegal color change received from %s (team: %d), color: %d)\n"), player_names[playernum], p->ctfteam, p->skincolor); buf[0] = (UINT8)playernum; @@ -1401,25 +1455,33 @@ static void Got_NameAndColor(UINT8 **cp, INT32 playernum) void SendWeaponPref(void) { - XBOXSTATIC UINT8 buf[1]; + UINT8 buf[1]; buf[0] = 0; if (cv_flipcam.value) buf[0] |= 1; if (cv_analog.value) buf[0] |= 2; + if (cv_directionchar.value) + buf[0] |= 4; + if (cv_autobrake.value) + buf[0] |= 8; SendNetXCmd(XD_WEAPONPREF, buf, 1); } void SendWeaponPref2(void) { - XBOXSTATIC UINT8 buf[1]; + UINT8 buf[1]; buf[0] = 0; if (cv_flipcam2.value) buf[0] |= 1; if (cv_analog2.value) buf[0] |= 2; + if (cv_directionchar2.value) + buf[0] |= 4; + if (cv_autobrake2.value) + buf[0] |= 8; SendNetXCmd2(XD_WEAPONPREF, buf, 1); } @@ -1427,11 +1489,15 @@ static void Got_WeaponPref(UINT8 **cp,INT32 playernum) { UINT8 prefs = READUINT8(*cp); - players[playernum].pflags &= ~(PF_FLIPCAM|PF_ANALOGMODE); + players[playernum].pflags &= ~(PF_FLIPCAM|PF_ANALOGMODE|PF_DIRECTIONCHAR|PF_AUTOBRAKE); if (prefs & 1) players[playernum].pflags |= PF_FLIPCAM; if (prefs & 2) players[playernum].pflags |= PF_ANALOGMODE; + if (prefs & 4) + players[playernum].pflags |= PF_DIRECTIONCHAR; + if (prefs & 8) + players[playernum].pflags |= PF_AUTOBRAKE; } void D_SendPlayerConfig(void) @@ -1579,23 +1645,20 @@ void D_MapChange(INT32 mapnum, INT32 newgametype, boolean pultmode, boolean rese { static char buf[2+MAX_WADPATH+1+4]; static char *buf_p = buf; - // The supplied data are assumed to be good. I_Assert(delay >= 0 && delay <= 2); - + if (mapnum != -1) + CV_SetValue(&cv_nextmap, mapnum); CONS_Debug(DBG_GAMELOGIC, "Map change: mapnum=%d gametype=%d ultmode=%d resetplayers=%d delay=%d skipprecutscene=%d\n", mapnum, newgametype, pultmode, resetplayers, delay, skipprecutscene); - - if (netgame || multiplayer) + if ((netgame || multiplayer) && !((gametype == newgametype) && (newgametype == GT_COOP))) FLS = false; if (delay != 2) { UINT8 flags = 0; const char *mapname = G_BuildMapName(mapnum); - I_Assert(W_CheckNumForName(mapname) != LUMPERROR); - buf_p = buf; if (pultmode) flags |= 1; @@ -1743,9 +1806,19 @@ static void Command_Map_f(void) } } + // Prevent warping to locked levels + // ... unless you're in a dedicated server. Yes, technically this means you can view any level by + // running a dedicated server and joining it yourself, but that's better than making dedicated server's + // lives hell. + if (!dedicated && M_MapLocked(newmapnum)) + { + CONS_Alert(CONS_NOTICE, M_GetText("You need to unlock this level before you can warp to it!\n")); + return; + } + // don't use a gametype the map doesn't support if (cv_debug || COM_CheckParm("-force") || cv_skipmapcheck.value) - ; // The player wants us to trek on anyway. Do so. + fromlevelselect = false; // The player wants us to trek on anyway. Do so. // G_TOLFlag handles both multiplayer gametype and ignores it for !multiplayer // Alternatively, bail if the map header is completely missing anyway. else if (!mapheaderinfo[newmapnum-1] @@ -1763,19 +1836,20 @@ static void Command_Map_f(void) CONS_Alert(CONS_WARNING, M_GetText("%s doesn't support %s mode!\n(Use -force to override)\n"), mapname, gametypestring); return; } + else + fromlevelselect = ((netgame || multiplayer) && ((gametype == newgametype) && (newgametype == GT_COOP))); - // Prevent warping to locked levels - // ... unless you're in a dedicated server. Yes, technically this means you can view any level by - // running a dedicated server and joining it yourself, but that's better than making dedicated server's - // lives hell. - if (!dedicated && M_MapLocked(newmapnum)) + if (tutorialmode && tutorialgcs) { - CONS_Alert(CONS_NOTICE, M_GetText("You need to unlock this level before you can warp to it!\n")); - return; + G_CopyControls(gamecontrol, gamecontroldefault[gcs_custom], gcl_tutorial_full, num_gcl_tutorial_full); // using gcs_custom as temp storage + CV_SetValue(&cv_usemouse, tutorialusemouse); + CV_SetValue(&cv_alwaysfreelook, tutorialfreelook); + CV_SetValue(&cv_mousemove, tutorialmousemove); + CV_SetValue(&cv_analog, tutorialanalog); } + tutorialmode = false; // warping takes us out of tutorial mode - fromlevelselect = false; - D_MapChange(newmapnum, newgametype, false, newresetplayers, 0, false, false); + D_MapChange(newmapnum, newgametype, false, newresetplayers, 0, false, fromlevelselect); } /** Receives a map command and changes the map. @@ -1800,7 +1874,7 @@ static void Got_Mapcmd(UINT8 **cp, INT32 playernum) CONS_Alert(CONS_WARNING, M_GetText("Illegal map change received from %s\n"), player_names[playernum]); if (server) { - XBOXSTATIC UINT8 buf[2]; + UINT8 buf[2]; buf[0] = (UINT8)playernum; buf[1] = KICK_MSG_CON_FAIL; @@ -1845,10 +1919,14 @@ static void Got_Mapcmd(UINT8 **cp, INT32 playernum) if (demoplayback && !timingdemo) precache = false; - if (resetplayer) + if (resetplayer && !FLS) + emeralds = 0; + + if (modeattacking) { - if (!FLS || (netgame || multiplayer)) - emeralds = 0; + SetPlayerSkinByNum(0, cv_chooseskin.value-1); + players[0].skincolor = skins[players[0].skin].prefcolor; + CV_StealthSetValue(&cv_playercolor, players[0].skincolor); } #ifdef HAVE_BLUA @@ -1856,22 +1934,12 @@ static void Got_Mapcmd(UINT8 **cp, INT32 playernum) LUAh_MapChange(mapnumber); #endif - G_InitNew(ultimatemode, mapname, resetplayer, skipprecutscene); + G_InitNew(ultimatemode, mapname, resetplayer, skipprecutscene, FLS); if (demoplayback && !timingdemo) precache = true; if (timingdemo) G_DoneLevelLoad(); - if (modeattacking) - { - SetPlayerSkinByNum(0, cv_chooseskin.value-1); - players[0].skincolor = skins[players[0].skin].prefcolor; - CV_StealthSetValue(&cv_playercolor, players[0].skincolor); - - // a copy of color - if (players[0].mo) - players[0].mo->color = players[0].skincolor; - } if (metalrecording) G_BeginMetal(); if (demorecording) // Okay, level loaded, character spawned and skinned, @@ -1881,7 +1949,7 @@ static void Got_Mapcmd(UINT8 **cp, INT32 playernum) static void Command_Pause(void) { - XBOXSTATIC UINT8 buf[2]; + UINT8 buf[2]; UINT8 *cp = buf; if (COM_Argc() > 1) @@ -1917,7 +1985,7 @@ static void Got_Pause(UINT8 **cp, INT32 playernum) CONS_Alert(CONS_WARNING, M_GetText("Illegal pause command received from %s\n"), player_names[playernum]); if (server) { - XBOXSTATIC UINT8 buf[2]; + UINT8 buf[2]; buf[0] = (UINT8)playernum; buf[1] = KICK_MSG_CON_FAIL; @@ -1960,7 +2028,7 @@ static void Got_Pause(UINT8 **cp, INT32 playernum) // Command for stuck characters in netgames, griefing, etc. static void Command_Suicide(void) { - XBOXSTATIC UINT8 buf[4]; + UINT8 buf[4]; UINT8 *cp = buf; WRITEINT32(cp, consoleplayer); @@ -1997,7 +2065,7 @@ static void Got_Suicide(UINT8 **cp, INT32 playernum) CONS_Alert(CONS_WARNING, M_GetText("Illegal suicide command received from %s\n"), player_names[playernum]); if (server) { - XBOXSTATIC UINT8 buf[2]; + UINT8 buf[2]; buf[0] = (UINT8)playernum; buf[1] = KICK_MSG_CON_FAIL; @@ -2007,7 +2075,7 @@ static void Got_Suicide(UINT8 **cp, INT32 playernum) } if (players[suicideplayer].mo) - P_DamageMobj(players[suicideplayer].mo, NULL, NULL, 10000); + P_DamageMobj(players[suicideplayer].mo, NULL, NULL, 1, DMG_INSTAKILL); } /** Deals with an ::XD_RANDOMSEED message in a netgame. @@ -2066,7 +2134,7 @@ static void Got_Clearscores(UINT8 **cp, INT32 playernum) CONS_Alert(CONS_WARNING, M_GetText("Illegal clear scores command received from %s\n"), player_names[playernum]); if (server) { - XBOXSTATIC UINT8 buf[2]; + UINT8 buf[2]; buf[0] = (UINT8)playernum; buf[1] = KICK_MSG_CON_FAIL; @@ -2419,7 +2487,7 @@ static void Got_Teamchange(UINT8 **cp, INT32 playernum) CONS_Alert(CONS_WARNING, M_GetText("Illegal team change received from player %s\n"), player_names[playernum]); if (server) { - XBOXSTATIC UINT8 buf[2]; + UINT8 buf[2]; buf[0] = (UINT8)playernum; buf[1] = KICK_MSG_CON_FAIL; @@ -2434,7 +2502,7 @@ static void Got_Teamchange(UINT8 **cp, INT32 playernum) CONS_Alert(CONS_WARNING, M_GetText("Illegal team change received from player %s\n"), player_names[playernum]); if (server) { - XBOXSTATIC UINT8 buf[2]; + UINT8 buf[2]; buf[0] = (UINT8)playernum; buf[1] = KICK_MSG_CON_FAIL; @@ -2473,7 +2541,7 @@ static void Got_Teamchange(UINT8 **cp, INT32 playernum) CONS_Alert(CONS_WARNING, M_GetText("Illegal team change received from player %s\n"), player_names[playernum]); if (server) { - XBOXSTATIC UINT8 buf[2]; + UINT8 buf[2]; buf[0] = (UINT8)playernum; buf[1] = KICK_MSG_CON_FAIL; @@ -2526,7 +2594,7 @@ static void Got_Teamchange(UINT8 **cp, INT32 playernum) if (server && ((NetPacket.packet.newteam < 0 || NetPacket.packet.newteam > 3) || error)) { - XBOXSTATIC UINT8 buf[2]; + UINT8 buf[2]; buf[0] = (UINT8)playernum; buf[1] = KICK_MSG_CON_FAIL; @@ -2538,7 +2606,7 @@ static void Got_Teamchange(UINT8 **cp, INT32 playernum) if (players[playernum].mo) { if (!players[playernum].spectator) - P_DamageMobj(players[playernum].mo, NULL, NULL, 10000); + P_DamageMobj(players[playernum].mo, NULL, NULL, 1, DMG_INSTAKILL); else { P_RemoveMobj(players[playernum].mo); @@ -2557,12 +2625,12 @@ static void Got_Teamchange(UINT8 **cp, INT32 playernum) { players[playernum].spectator = true; players[playernum].pflags &= ~PF_TAGIT; - players[playernum].pflags &= ~PF_TAGGED; + players[playernum].pflags &= ~PF_GAMETYPEOVER; } else if (NetPacket.packet.newteam != 3) // .newteam == 1 or 2. { players[playernum].spectator = false; - players[playernum].pflags &= ~PF_TAGGED;//Just in case. + players[playernum].pflags &= ~PF_GAMETYPEOVER; //Just in case. if (NetPacket.packet.newteam == 1) //Make the player IT. players[playernum].pflags |= PF_TAGIT; @@ -2653,8 +2721,7 @@ static void Got_Teamchange(UINT8 **cp, INT32 playernum) // Clear player score and rings if a spectator. if (players[playernum].spectator) { - players[playernum].score = 0; - players[playernum].health = 1; + players[playernum].score = players[playernum].rings = 0; if (players[playernum].mo) players[playernum].mo->health = 1; } @@ -2677,7 +2744,7 @@ static void D_MD5PasswordPass(const UINT8 *buffer, size_t len, const char *salt, (void)salt; memset(dest, 0, 16); #else - XBOXSTATIC char tmpbuf[256]; + char tmpbuf[256]; const size_t sl = strlen(salt); if (len > 256-sl) @@ -2734,7 +2801,7 @@ static void Command_Login_f(void) // If we have no MD5 support then completely disable XD_LOGIN responses for security. CONS_Alert(CONS_NOTICE, "Remote administration commands are not supported in this build.\n"); #else - XBOXSTATIC UINT8 finalmd5[16]; + UINT8 finalmd5[16]; const char *pw; if (!netgame) @@ -2843,7 +2910,7 @@ void RemoveAdminPlayer(INT32 playernum) static void Command_Verify_f(void) { - XBOXSTATIC char buf[8]; // Should be plenty + char buf[8]; // Should be plenty char *temp; INT32 playernum; @@ -2886,7 +2953,7 @@ static void Got_Verification(UINT8 **cp, INT32 playernum) CONS_Alert(CONS_WARNING, M_GetText("Illegal verification received from %s (serverplayer is %s)\n"), player_names[playernum], player_names[serverplayer]); if (server) { - XBOXSTATIC UINT8 buf[2]; + UINT8 buf[2]; buf[0] = (UINT8)playernum; buf[1] = KICK_MSG_CON_FAIL; @@ -2905,7 +2972,7 @@ static void Got_Verification(UINT8 **cp, INT32 playernum) static void Command_RemoveAdmin_f(void) { - XBOXSTATIC char buf[8]; // Should be plenty + char buf[8]; // Should be plenty char *temp; INT32 playernum; @@ -2942,7 +3009,7 @@ static void Got_Removal(UINT8 **cp, INT32 playernum) CONS_Alert(CONS_WARNING, M_GetText("Illegal demotion received from %s (serverplayer is %s)\n"), player_names[playernum], player_names[serverplayer]); if (server) { - XBOXSTATIC UINT8 buf[2]; + UINT8 buf[2]; buf[0] = (UINT8)playernum; buf[1] = KICK_MSG_CON_FAIL; @@ -3022,7 +3089,7 @@ static void Got_MotD_f(UINT8 **cp, INT32 playernum) CONS_Alert(CONS_WARNING, M_GetText("Illegal motd change received from %s\n"), player_names[playernum]); if (server) { - XBOXSTATIC UINT8 buf[2]; + UINT8 buf[2]; buf[0] = (UINT8)playernum; buf[1] = KICK_MSG_CON_FAIL; @@ -3043,7 +3110,7 @@ static void Got_MotD_f(UINT8 **cp, INT32 playernum) static void Command_RunSOC(void) { const char *fn; - XBOXSTATIC char buf[255]; + char buf[255]; size_t length = 0; if (COM_Argc() != 2) @@ -3085,7 +3152,7 @@ static void Got_RunSOCcmd(UINT8 **cp, INT32 playernum) CONS_Alert(CONS_WARNING, M_GetText("Illegal runsoc command received from %s\n"), player_names[playernum]); if (server) { - XBOXSTATIC UINT8 buf[2]; + UINT8 buf[2]; buf[0] = (UINT8)playernum; buf[1] = KICK_MSG_CON_FAIL; @@ -3128,7 +3195,7 @@ static void Got_RunSOCcmd(UINT8 **cp, INT32 playernum) static void Command_Addfile(void) { const char *fn, *p; - XBOXSTATIC char buf[256]; + char buf[256]; char *buf_p = buf; INT32 i; int musiconly; // W_VerifyNMUSlumps isn't boolean @@ -3171,6 +3238,7 @@ static void Command_Addfile(void) if (*p == '\\' || *p == '/' || *p == ':') break; ++p; + // check total packet size and no of files currently loaded // See W_LoadWadFile in w_wad.c if ((numwadfiles >= MAX_WADFILES) @@ -3219,42 +3287,6 @@ static void Command_Addfile(void) SendNetXCmd(XD_ADDFILE, buf, buf_p - buf); } -#ifdef DELFILE -/** removes the last added pwad at runtime. - * Searches for sounds, maps, music and images to remove - */ -static void Command_Delfile(void) -{ - if (gamestate == GS_LEVEL) - { - CONS_Printf(M_GetText("You must NOT be in a level to use this.\n")); - return; - } - - if (netgame && !(server || adminplayer == consoleplayer)) - { - CONS_Printf(M_GetText("Only the server or a remote admin can use this.\n")); - return; - } - - if (numwadfiles <= mainwads) - { - CONS_Printf(M_GetText("No additional WADs are loaded.\n")); - return; - } - - if (!(netgame || multiplayer)) - { - P_DelWadFile(); - if (mainwads == numwadfiles && modifiedgame) - modifiedgame = false; - return; - } - - SendNetXCmd(XD_DELFILE, NULL, 0); -} -#endif - static void Got_RequestAddfilecmd(UINT8 **cp, INT32 playernum) { char filename[241]; @@ -3282,7 +3314,7 @@ static void Got_RequestAddfilecmd(UINT8 **cp, INT32 playernum) if ((playernum != serverplayer && !IsPlayerAdmin(playernum)) || kick) { - XBOXSTATIC UINT8 buf[2]; + UINT8 buf[2]; CONS_Alert(CONS_WARNING, M_GetText("Illegal addfile command received from %s\n"), player_names[playernum]); @@ -3324,33 +3356,6 @@ static void Got_RequestAddfilecmd(UINT8 **cp, INT32 playernum) COM_BufAddText(va("addfile %s\n", filename)); } -#ifdef DELFILE -static void Got_Delfilecmd(UINT8 **cp, INT32 playernum) -{ - if (playernum != serverplayer && playernum != adminplayer) - { - CONS_Alert(CONS_WARNING, M_GetText("Illegal delfile command received from %s\n"), player_names[playernum]); - if (server) - { - XBOXSTATIC UINT8 buf[2]; - - buf[0] = (UINT8)playernum; - buf[1] = KICK_MSG_CON_FAIL; - SendNetXCmd(XD_KICK, &buf, 2); - } - return; - } - (void)cp; - - if (numwadfiles <= mainwads) //sanity - return; - - P_DelWadFile(); - if (mainwads == numwadfiles && modifiedgame) - modifiedgame = false; -} -#endif - static void Got_Addfilecmd(UINT8 **cp, INT32 playernum) { char filename[241]; @@ -3365,7 +3370,7 @@ static void Got_Addfilecmd(UINT8 **cp, INT32 playernum) CONS_Alert(CONS_WARNING, M_GetText("Illegal addfile command received from %s\n"), player_names[playernum]); if (server) { - XBOXSTATIC UINT8 buf[2]; + UINT8 buf[2]; buf[0] = (UINT8)playernum; buf[1] = KICK_MSG_CON_FAIL; @@ -3417,6 +3422,8 @@ static void Command_ListWADS_f(void) CONS_Printf("\x82 IWAD\x80: %s\n", tempname); else if (i <= mainwads) CONS_Printf("\x82 * %.2d\x80: %s\n", i, tempname); + else if (!wadfiles[i]->important) + CONS_Printf("\x86 %.2d: %s\n", i, tempname); else CONS_Printf(" %.2d: %s\n", i, tempname); } @@ -3600,6 +3607,102 @@ static void JoinTimeout_OnChange(void) jointimeout = (tic_t)cv_jointimeout.value; } +static void CoopStarposts_OnChange(void) +{ + INT32 i; + + if (!(netgame || multiplayer) || gametype != GT_COOP) + return; + + switch (cv_coopstarposts.value) + { + case 0: + CONS_Printf(M_GetText("Starposts are now per-player.\n")); + break; + case 1: + CONS_Printf(M_GetText("Starposts are now shared between players.\n")); + break; + case 2: + CONS_Printf(M_GetText("Players now only spawn when starposts are hit.\n")); + return; + } + + if (G_IsSpecialStage(gamemap)) + return; + + for (i = 0; i < MAXPLAYERS; i++) + { + if (!playeringame[i]) + continue; + + if (!players[i].spectator) + continue; + + if (players[i].lives <= 0) + continue; + + break; + } + + if (i == MAXPLAYERS) + return; + + for (i = 0; i < MAXPLAYERS; i++) + { + if (!playeringame[i]) + continue; + + if (!players[i].spectator) + continue; + + if (players[i].lives <= 0 && (cv_cooplives.value == 1)) + continue; + + P_SpectatorJoinGame(&players[i]); + } +} + +static void CoopLives_OnChange(void) +{ + INT32 i; + + if (!(netgame || multiplayer) || gametype != GT_COOP) + return; + + switch (cv_cooplives.value) + { + case 0: + CONS_Printf(M_GetText("Players can now respawn indefinitely.\n")); + return; + case 1: + CONS_Printf(M_GetText("Lives are now per-player.\n")); + return; + case 2: + CONS_Printf(M_GetText("Players can now steal lives to avoid game over.\n")); + break; + case 3: + CONS_Printf(M_GetText("Lives are now shared between players.\n")); + break; + } + + if (cv_coopstarposts.value == 2) + return; + + for (i = 0; i < MAXPLAYERS; i++) + { + if (!playeringame[i]) + continue; + + if (!players[i].spectator) + continue; + + if (players[i].lives > 0) + continue; + + P_SpectatorJoinGame(&players[i]); + } +} + UINT32 timelimitintics = 0; /** Deals with a timelimit change by printing the change to the console. @@ -3888,7 +3991,7 @@ retryscramble: { if (red == maxcomposition) newteam = 2; - else if (blue == maxcomposition) + else //if (blue == maxcomposition) newteam = 1; repick = false; @@ -3929,14 +4032,11 @@ retryscramble: newteam = (INT16)((M_RandomByte() % 2) + 1); repick = false; } - else + else if (i != 2) // Mystic's secret sauce - ABBA is better than ABAB, so team B doesn't get worse players all around { // We will only randomly pick the team for the first guy. // Otherwise, just alternate back and forth, distributing players. - if (newteam == 1) - newteam = 2; - else - newteam = 1; + newteam = 3 - newteam; } scrambleteams[i] = newteam; @@ -4035,7 +4135,7 @@ static void Got_ExitLevelcmd(UINT8 **cp, INT32 playernum) CONS_Alert(CONS_WARNING, M_GetText("Illegal exitlevel command received from %s\n"), player_names[playernum]); if (server) { - XBOXSTATIC UINT8 buf[2]; + UINT8 buf[2]; buf[0] = (UINT8)playernum; buf[1] = KICK_MSG_CON_FAIL; diff --git a/src/d_netcmd.h b/src/d_netcmd.h index 505434541..c73f17618 100644 --- a/src/d_netcmd.h +++ b/src/d_netcmd.h @@ -25,6 +25,13 @@ extern consvar_t cv_skin; extern consvar_t cv_playername2; extern consvar_t cv_playercolor2; extern consvar_t cv_skin2; +// saved versions of the above six +extern consvar_t cv_defaultplayername; +extern consvar_t cv_defaultplayercolor; +extern consvar_t cv_defaultskin; +extern consvar_t cv_defaultplayername2; +extern consvar_t cv_defaultplayercolor2; +extern consvar_t cv_defaultskin2; #ifdef SEENAMES extern consvar_t cv_seenames, cv_allowseenames; @@ -51,7 +58,6 @@ extern consvar_t cv_itemrespawntime; extern consvar_t cv_itemrespawn; extern consvar_t cv_flagtime; -extern consvar_t cv_suddendeath; extern consvar_t cv_touchtag; extern consvar_t cv_hidetime; @@ -90,9 +96,7 @@ extern consvar_t cv_recycler; extern consvar_t cv_itemfinder; -extern consvar_t cv_inttime, cv_advancemap, cv_playersforexit; -extern consvar_t cv_soniccd; -extern consvar_t cv_match_scoring; +extern consvar_t cv_inttime, cv_coopstarposts, cv_cooplives, cv_advancemap, cv_playersforexit; extern consvar_t cv_overtime; extern consvar_t cv_startinglives; @@ -135,7 +139,7 @@ typedef enum XD_RANDOMSEED, // 15 XD_RUNSOC, // 16 XD_REQADDFILE, // 17 - XD_DELFILE, // 18 + XD_DELFILE, // 18 - replace next time we add an XD XD_SETMOTD, // 19 XD_SUICIDE, // 20 XD_DEMOTED, // 21 diff --git a/src/d_netfil.c b/src/d_netfil.c index deb04fbe1..db9fa12e4 100644 --- a/src/d_netfil.c +++ b/src/d_netfil.c @@ -11,21 +11,14 @@ /// \brief Transfer a file using HSendPacket. #include -#ifndef _WIN32_WCE -#ifdef __OS2__ -#include -#endif // __OS2__ #include -#endif -#if !defined (UNDER_CE) #include -#endif -#if ((defined (_WIN32) && !defined (_WIN32_WCE)) || defined (__DJGPP__)) && !defined (_XBOX) +#if defined (_WIN32) || defined (__DJGPP__) #include #include -#elif !defined (_WIN32_WCE) && !(defined (_XBOX) && !defined (__GNUC__)) +#else #include #include #include @@ -34,7 +27,7 @@ #ifdef __GNUC__ #include #include -#elif defined (_WIN32) && !defined (_WIN32_WCE) +#elif defined (_WIN32) #include #endif #ifdef __DJGPP__ @@ -104,7 +97,7 @@ INT32 lastfilenum = -1; /** Fills a serverinfo packet with information about wad files loaded. * * \todo Give this function a better name since it is in global scope. - * Used to have size limiting built in - now handed via W_LoadWadFile in w_wad.c + * Used to have size limiting built in - now handled via W_LoadWadFile in w_wad.c * */ UINT8 *PutFileNeeded(void) @@ -336,7 +329,7 @@ INT32 CL_CheckFiles(void) // return 1; // the first is the iwad (the main wad file) - // we don't care if it's called srb2.srb or srb2.wad. + // we don't care if it's called srb2.pk3 or not. // Never download the IWAD, just assume it's there and identical fileneeded[0].status = FS_OPEN; @@ -350,7 +343,7 @@ INT32 CL_CheckFiles(void) { if (j < numwadfiles && !wadfiles[j]->important) { - // Unimportant on our side. still don't care. + // Unimportant on our side. ++j; continue; } @@ -755,11 +748,11 @@ void Got_Filetxpak(void) char *filename = file->filename; static INT32 filetime = 0; - if (!(strcmp(filename, "srb2.srb") + if (!(strcmp(filename, "srb2.pk3") + && strcmp(filename, "srb2.srb") && strcmp(filename, "srb2.wad") && strcmp(filename, "zones.dta") && strcmp(filename, "player.dta") - && strcmp(filename, "rings.dta") && strcmp(filename, "patch.dta") && strcmp(filename, "music.dta") )) @@ -902,9 +895,9 @@ void nameonly(char *s) ns = &(s[j+1]); len = strlen(ns); #if 0 - M_Memcpy(s, ns, len+1); + M_Memcpy(s, ns, len+1); #else - memmove(s, ns, len+1); + memmove(s, ns, len+1); #endif return; } @@ -928,7 +921,7 @@ size_t nameonlylength(const char *s) filestatus_t checkfilemd5(char *filename, const UINT8 *wantedmd5sum) { -#if defined (NOMD5) || defined (_arch_dreamcast) +#if defined (NOMD5) (void)wantedmd5sum; (void)filename; #else @@ -980,11 +973,7 @@ filestatus_t findfile(char *filename, const UINT8 *wantedmd5sum, boolean complet // if not found at all, just move on without doing anything // finally check "." directory -#ifdef _arch_dreamcast - homecheck = filesearch(filename, "/cd", wantedmd5sum, completepath, 10); -#else homecheck = filesearch(filename, ".", wantedmd5sum, completepath, 10); -#endif if (homecheck != FS_NOTFOUND) // if not found this time, fall back on the below return statement return homecheck; // otherwise return the result we got diff --git a/src/d_player.h b/src/d_player.h index 7c5ac6890..cdc899f5e 100644 --- a/src/d_player.h +++ b/src/d_player.h @@ -32,13 +32,22 @@ // Extra abilities/settings for skins (combinable stuff) typedef enum { - SF_SUPER = 1, // Can turn super in singleplayer/co-op mode. - SF_SUPERANIMS = 1<<1, // If super, use the super sonic animations - SF_SUPERSPIN = 1<<2, // Should spin frames be played while super? - SF_HIRES = 1<<3, // Draw the sprite 2x as small? + SF_SUPER = 1, // Can turn super in singleplayer/co-op mode? + SF_NOSUPERSPIN = 1<<1, // Should spin frames be played while super? + SF_NOSPINDASHDUST = 1<<2, // Spawn dust particles when charging a spindash? + SF_HIRES = 1<<3, // Draw the sprite at different size? SF_NOSKID = 1<<4, // No skid particles etc SF_NOSPEEDADJUST = 1<<5, // Skin-specific version of disablespeedadjust SF_RUNONWATER = 1<<6, // Run on top of water FOFs? + SF_NOJUMPSPIN = 1<<7, // SPR2_JUMP defaults to SPR2_SPRG instead of SPR2_ROLL, falling states used, and player height is full when jumping? + SF_NOJUMPDAMAGE = 1<<8, // Don't damage enemies, etc whilst jumping? + SF_STOMPDAMAGE = 1<<9, // Always damage enemies, etc by landing on them, no matter your vunerability? + SF_MARIODAMAGE = SF_NOJUMPDAMAGE|SF_STOMPDAMAGE, // The Mario method of being able to damage enemies, etc. + SF_MACHINE = 1<<10, // Beep boop. Are you a robot? + SF_DASHMODE = 1<<11, // Sonic Advance 2 style top speed increase? + SF_FASTEDGE = 1<<12, // Faster edge teeter? + SF_MULTIABILITY = 1<<13, // Revenge of Final Demo. + // free up to and including 1<<31 } skinflags_t; //Primary and secondary skin abilities @@ -57,7 +66,9 @@ typedef enum CA_FALLSWITCH, CA_JUMPBOOST, CA_AIRDRILL, - CA_JUMPTHOK + CA_JUMPTHOK, + CA_BOUNCE, + CA_TWINSPIN } charability_t; //Secondary skin abilities @@ -65,7 +76,8 @@ typedef enum { CA2_NONE=0, CA2_SPINDASH, - CA2_MULTIABILITY + CA2_GUNSLINGER, + CA2_MELEE } charability2_t; // @@ -86,74 +98,60 @@ typedef enum // typedef enum { - // Flip camera angle with gravity flip prefrence. - PF_FLIPCAM = 1, + // Cvars + PF_FLIPCAM = 1, // Flip camera angle with gravity flip prefrence. + PF_ANALOGMODE = 1<<1, // Analog mode? + PF_DIRECTIONCHAR = 1<<2, // Directional character sprites? + PF_AUTOBRAKE = 1<<3, // Autobrake? // Cheats - PF_GODMODE = 1<<1, - PF_NOCLIP = 1<<2, - PF_INVIS = 1<<3, + PF_GODMODE = 1<<4, + PF_NOCLIP = 1<<5, + PF_INVIS = 1<<6, // True if button down last tic. - PF_ATTACKDOWN = 1<<4, - PF_USEDOWN = 1<<5, - PF_JUMPDOWN = 1<<6, - PF_WPNDOWN = 1<<7, + PF_ATTACKDOWN = 1<<7, + PF_USEDOWN = 1<<8, + PF_JUMPDOWN = 1<<9, + PF_WPNDOWN = 1<<10, // Unmoving states - PF_STASIS = 1<<8, // Player is not allowed to move - PF_JUMPSTASIS = 1<<9, // and that includes jumping. + PF_STASIS = 1<<11, // Player is not allowed to move + PF_JUMPSTASIS = 1<<12, // and that includes jumping. PF_FULLSTASIS = PF_STASIS|PF_JUMPSTASIS, - // Did you get a time-over? - PF_TIMEOVER = 1<<10, - - // Ready for Super? - PF_SUPERREADY = 1<<11, + // Applying autobrake? + PF_APPLYAUTOBRAKE = 1<<13, // Character action status - PF_JUMPED = 1<<12, - PF_SPINNING = 1<<13, - PF_STARTDASH = 1<<14, - PF_THOKKED = 1<<15, + PF_STARTJUMP = 1<<14, + PF_JUMPED = 1<<15, + PF_NOJUMPDAMAGE = 1<<16, - // Are you gliding? - PF_GLIDING = 1<<16, + PF_SPINNING = 1<<17, + PF_STARTDASH = 1<<18, - // Tails pickup! - PF_CARRIED = 1<<17, + PF_THOKKED = 1<<19, + PF_SHIELDABILITY = 1<<20, + PF_GLIDING = 1<<21, + PF_BOUNCING = 1<<22, // Sliding (usually in water) like Labyrinth/Oil Ocean - PF_SLIDING = 1<<18, + PF_SLIDING = 1<<23, - // Hanging on a rope - PF_ROPEHANG = 1<<19, - - // Hanging on an item of some kind - zipline, chain, etc. (->tracer) - PF_ITEMHANG = 1<<20, - - // On the mace chain spinning around (->tracer) - PF_MACESPIN = 1<<21, - - /*** NIGHTS STUFF ***/ - // Is the player in NiGHTS mode? - PF_NIGHTSMODE = 1<<22, - PF_TRANSFERTOCLOSEST = 1<<23, - - // Spill rings after falling - PF_NIGHTSFALL = 1<<24, + // NiGHTS stuff + PF_TRANSFERTOCLOSEST = 1<<24, PF_DRILLING = 1<<25, - PF_SKIDDOWN = 1<<26, - /*** TAG STUFF ***/ - PF_TAGGED = 1<<27, // Player has been tagged and awaits the next round in hide and seek. - PF_TAGIT = 1<<28, // The player is it! For Tag Mode + // Gametype-specific stuff + PF_GAMETYPEOVER = 1<<26, // Race time over, or H&S out-of-game + PF_TAGIT = 1<<27, // The player is it! For Tag Mode /*** misc ***/ - PF_FORCESTRAFE = 1<<29, // Turning inputs are translated into strafing inputs - PF_ANALOGMODE = 1<<30, // Analog mode? + PF_FORCESTRAFE = 1<<28, // Turning inputs are translated into strafing inputs + PF_CANCARRY = 1<<29, // Can carry another player? - // free: 1<<30 and 1<<31 + // up to 1<<31 is free } pflags_t; typedef enum @@ -161,35 +159,82 @@ typedef enum // Are animation frames playing? PA_ETC=0, PA_IDLE, + PA_EDGE, PA_WALK, PA_RUN, + PA_DASH, + PA_PAIN, PA_ROLL, + PA_JUMP, + PA_SPRING, PA_FALL, - PA_ABILITY + PA_ABILITY, + PA_ABILITY2, + PA_RIDE } panim_t; +// +// All of the base srb2 shields are either a single constant, +// or use damagetype-protecting flags applied to a constant, +// or are the force shield (which does everything weirdly). +// +// Base flags by themselves aren't used so modders can make +// abstract, ability-less shields should they so choose. +// typedef enum { SH_NONE = 0, - // Standard shields - SH_JUMP, - SH_ATTRACT, - SH_ELEMENTAL, - SH_BOMB, - // Stupid useless unimplimented Sonic 3 shields - SH_BUBBLEWRAP, - SH_THUNDERCOIN, - SH_FLAMEAURA, - // Pity shield: the world's most basic shield ever, given to players who suck at Match - SH_PITY, - // The fireflower is special, it combines with other shields. - SH_FIREFLOWER = 0x100, - // The force shield uses the lower 8 bits to count how many hits are left. - SH_FORCE = 0x200, - SH_STACK = SH_FIREFLOWER, + // Shield flags + SH_PROTECTFIRE = 0x400, + SH_PROTECTWATER = 0x800, + SH_PROTECTELECTRIC = 0x1000, + SH_PROTECTSPIKE = 0x2000, // cactus shield one day? thanks, subarashii + //SH_PROTECTNUKE = 0x4000, // intentionally no hardcoded defense against nukes + + // Indivisible shields + SH_PITY = 1, // the world's most basic shield ever, given to players who suck at Match + SH_WHIRLWIND, + SH_ARMAGEDDON, + + // Normal shields that use flags + SH_ATTRACT = SH_PITY|SH_PROTECTELECTRIC, + SH_ELEMENTAL = SH_PITY|SH_PROTECTFIRE|SH_PROTECTWATER, + + // Sonic 3 shields + SH_FLAMEAURA = SH_PITY|SH_PROTECTFIRE, + SH_BUBBLEWRAP = SH_PITY|SH_PROTECTWATER, + SH_THUNDERCOIN = SH_WHIRLWIND|SH_PROTECTELECTRIC, + + // The force shield uses the lower 8 bits to count how many extra hits are left. + SH_FORCE = 0x100, + SH_FORCEHP = 0xFF, // to be used as a bitmask only + + // Mostly for use with Mario mode. + SH_FIREFLOWER = 0x200, + + SH_STACK = SH_FIREFLOWER, // second-layer shields SH_NOSTACK = ~SH_STACK -} shieldtype_t; +} shieldtype_t; // pw_shield + +typedef enum +{ + CR_NONE = 0, + // The generic case is suitable for most objects. + CR_GENERIC, + // Tails carry. + CR_PLAYER, + // NiGHTS mode. Not technically a CARRYING, but doesn't stack with any of the others, so might as well go here. + CR_NIGHTSMODE, + CR_NIGHTSFALL, + // Old Brak sucks hard, but this gimmick could be used for something better, so we might as well continue supporting it. + CR_BRAKGOOP, + // Specific level gimmicks. + CR_ZOOMTUBE, + CR_ROPEHANG, + CR_MACESPIN, + CR_MINECART +} carrytype_t; // pw_carry // Player powers. (don't edit this comment) typedef enum @@ -198,10 +243,12 @@ typedef enum pw_sneakers, pw_flashing, pw_shield, + pw_carry, pw_tailsfly, // tails flying pw_underwater, // underwater timer pw_spacetime, // In space, no one can hear you spin! pw_extralife, // Extra Life timer + pw_pushing, pw_super, // Are you super? pw_gravityboots, // gravity boots @@ -223,9 +270,7 @@ typedef enum pw_nights_helper, pw_nights_linkfreeze, - //for linedef exec 427 - pw_nocontrol, - pw_ingoop, // In goop + pw_nocontrol, //for linedef exec 427 NUMPOWERS } powertype_t; @@ -261,6 +306,8 @@ typedef struct player_s playerstate_t playerstate; // Determine POV, including viewpoint bobbing during movement. + fixed_t camerascale; + fixed_t shieldscale; // Focal origin above r.z fixed_t viewz; // Base height above floor for viewz. @@ -274,10 +321,12 @@ typedef struct player_s // It is updated with cmd->aiming. angle_t aiming; - // This is only used between levels, - // mo->health is used during levels. - /// \todo Remove this. We don't need a second health definition for players. - INT32 health; + // fun thing for player sprite + angle_t drawangle; + + // player's ring count + INT16 rings; + INT16 spheres; SINT8 pity; // i pity the fool. INT32 currentweapon; // current weapon selected. @@ -301,10 +350,10 @@ typedef struct player_s UINT8 skincolor; INT32 skin; + UINT32 availabilities; UINT32 score; // player score fixed_t dashspeed; // dashing speed - INT32 dashtime; // tics dashing, used for rev sound fixed_t normalspeed; // Normal ground fixed_t runspeed; // Speed you break into the run animation @@ -322,6 +371,8 @@ typedef struct player_s mobjtype_t thokitem; // Object # to spawn for the thok mobjtype_t spinitem; // Object # to spawn for spindash/spinning mobjtype_t revitem; // Object # to spawn for spindash/spinning + mobjtype_t followitem; // Object # to spawn for Smiles + mobj_t *followmobj; // Smiles all around fixed_t actionspd; // Speed of thok/glide/fly fixed_t mindash; // Minimum spindash speed @@ -329,15 +380,17 @@ typedef struct player_s fixed_t jumpfactor; // How high can the player jump? - SINT8 lives; + fixed_t height; // Bounding box changes. + fixed_t spinheight; + + SINT8 lives; // number of lives - if == INFLIVES, the player has infinite lives SINT8 continues; // continues that player has acquired SINT8 xtralife; // Ring Extra Life counter UINT8 gotcontinue; // Got continue from this stage? fixed_t speed; // Player's speed (distance formula of MOMX and MOMY values) - UINT8 jumping; // Jump counter - UINT8 secondjump; + UINT8 secondjump; // Jump counter UINT8 fly1; // Tails flying UINT8 scoreadd; // Used for multiple enemy attack bonus @@ -347,6 +400,7 @@ typedef struct player_s tic_t exiting; // Exitlevel timer UINT8 homing; // Are you homing? + tic_t dashmode; // counter for dashmode ability tic_t skidtime; // Skid timer @@ -402,16 +456,28 @@ typedef struct player_s UINT8 drilldelay; boolean bonustime; // Capsule destroyed, now it's bonus time! mobj_t *capsule; // Go inside the capsule + mobj_t *drone; // Move center to the drone + fixed_t oldscale; // Pre-Nightserize scale UINT8 mare; // Current mare + UINT8 marelap; // Current mare lap + UINT8 marebonuslap; // Current mare lap starting from bonus time // Statistical purposes. tic_t marebegunat; // Leveltime when mare begun tic_t startedtime; // Time which you started this mare with. tic_t finishedtime; // Time it took you to finish the mare (used for display) - INT16 finishedrings; // The rings you had left upon finishing the mare + tic_t lapbegunat; // Leveltime when lap begun + tic_t lapstartedtime; // Time which you started this lap with. + INT16 finishedspheres; // The spheres you had left upon finishing the mare + INT16 finishedrings; // The rings/stars you had left upon finishing the mare UINT32 marescore; // score for this nights stage UINT32 lastmarescore; // score for the last mare + UINT32 totalmarescore; // score for all mares UINT8 lastmare; // previous mare + UINT8 lastmarelap; // previous mare lap + UINT8 lastmarebonuslap; // previous mare bonus lap + UINT8 totalmarelap; // total mare lap + UINT8 totalmarebonuslap; // total mare bonus lap INT32 maxlink; // maximum link obtained UINT8 texttimer; // nights_texttime should not be local UINT8 textvar; // which line of NiGHTS text to show -- let's not use cheap hacks @@ -428,6 +494,7 @@ typedef struct player_s angle_t awayviewaiming; // Used for cut-away view boolean spectator; + boolean outofcoop; UINT8 bot; tic_t jointime; // Timer when player joins game to change skin/color @@ -436,4 +503,7 @@ typedef struct player_s #endif } player_t; +// Value for infinite lives +#define INFLIVES 0x7F + #endif diff --git a/src/dehacked.c b/src/dehacked.c index bda0c38f7..8057f26d8 100644 --- a/src/dehacked.c +++ b/src/dehacked.c @@ -66,11 +66,13 @@ memset(used_spr,0,sizeof(UINT8) * ((NUMSPRITEFREESLOTS / 8) + 1));\ static mobjtype_t get_mobjtype(const char *word); static statenum_t get_state(const char *word); static spritenum_t get_sprite(const char *word); +static playersprite_t get_sprite2(const char *word); static sfxenum_t get_sfx(const char *word); #ifdef MUSICSLOT_COMPATIBILITY static UINT16 get_mus(const char *word, UINT8 dehacked_mode); #endif static hudnum_t get_huditem(const char *word); +static menutype_t get_menutype(const char *word); #ifndef HAVE_BLUA static powertype_t get_power(const char *word); #endif @@ -79,97 +81,8 @@ boolean deh_loaded = false; static int dbg_line; static boolean gamedataadded = false; - -#ifdef DELFILE -typedef struct undehacked_s -{ - char *undata; - struct undehacked_s *next; -} undehacked_t; - -static UINT16 unsocwad; -static undehacked_t *unsocdata[MAX_WADFILES]; -static boolean disableundo = false; - -void DEH_WriteUndoline(const char *value, const char *data, undotype_f flags) -{ - const char *eqstr = " = "; - const char *space = " "; - const char *pader = eqstr; - undehacked_t *newdata; - - if (disableundo || !unsocwad) - return; - - if ((newdata = malloc(sizeof(*newdata))) == NULL) - I_Error("Out of memory for unsoc line"); - - if (flags & UNDO_SPACE) - pader = space; - - if (flags & UNDO_ENDTEXT && !data) - data = space; - - if (value) - { - const size_t plen = strlen(pader); - const char *pound = "#"; - char *undata = NULL; - const size_t elen = strlen(pound); - size_t vlen = strlen(value), dlen = 0, len = 1; - - if (*(value+vlen-1) == '\n') - vlen--; // lnet not copy the ending \n - - if (flags & UNDO_ENDTEXT) - len += elen; // let malloc more space - - if (flags & UNDO_NEWLINE) - len++; // more space for the beginning \n - - if (data) - { - dlen = strlen(data); - if (flags & UNDO_CUTLINE && *(data+dlen-1) == '\n') - dlen--; // let not copy the ending \n - newdata->undata = malloc(vlen+plen+dlen+len); - newdata->undata[vlen+plen+dlen+len-1] = '\0'; - } - else - { - newdata->undata = malloc(vlen+len); - newdata->undata[vlen+len-1] = '\0'; - } - - if (newdata->undata) - { - undata = newdata->undata; - *undata = '\0'; - } - else - { - free(newdata); - I_Error("Out of memory for unsoc data"); - } - - if (flags & UNDO_NEWLINE) // let start with \n - strcat(undata, "\n"); - - strncat(undata, value, vlen); - - if (data) // value+pader+data - strncat(strncat(undata, pader, plen), data, dlen); - - if (flags & UNDO_ENDTEXT) // let end the text - strncat(undata, pound, elen); - } - else - newdata->undata = NULL; - - newdata->next = unsocdata[unsocwad]; - unsocdata[unsocwad] = newdata; -} -#endif +static boolean titlechanged = false; +static boolean introchanged = false; ATTRINLINE static FUNCINLINE char myfget_color(MYFILE *f) { @@ -254,9 +167,14 @@ static char *myhashfgets(char *buf, size_t bufsize, MYFILE *f) if (c == '\n') // Ensure debug line is right... dbg_line++; if (c == '#') + { + if (i > 0) // don't let i wrap past 0 + i--; // don't include hash char in string break; + } } - i++; + if (buf[i] != '#') // don't include hash char in string + i++; buf[i] = '\0'; return buf; @@ -373,7 +291,9 @@ static void clear_levels(void) // (no need to set num to 0, we're freeing the entire header shortly) Z_Free(mapheaderinfo[i]->customopts); + P_DeleteFlickies(i); P_DeleteGrades(i); + Z_Free(mapheaderinfo[i]); mapheaderinfo[i] = NULL; } @@ -382,68 +302,20 @@ static void clear_levels(void) P_AllocMapHeader(gamemap-1); } -/* -// Edits an animated texture slot on the array -// Tails 12-27-2003 -static void readAnimTex(MYFILE *f, INT32 num) -{ - char s[MAXLINELEN]; - char *word; - char *word2; - INT32 i; - - do { - if (myfgets(s, sizeof s, f) != NULL) - { - if (s[0] == '\n') break; - - tmp = strchr(s, '#'); - if (tmp) - *tmp = '\0'; - // set the value in the appropriate field - - word = strtok(s, " "); - if (word) - strupr(word); - else - break; - - word2 = strtok(NULL, " = "); - if (word2) - strupr(word2); - else - break; - - if (word2[strlen(word2)-1] == '\n') - word2[strlen(word2)-1] = '\0'; - - i = atoi(word2); - - if (fastcmp(word, "START")) - strncpy(harddefs[num].startname, word2, 8); - if (fastcmp(word, "END")) - strncpy(harddefs[num].endname, word2, 8); - else if (fastcmp(word, "SPEED")) harddefs[num].speed = i; - else if (fastcmp(word, "ISTEXTURE")) harddefs[num].istexture = i; - - else deh_warning("readAnimTex %d: unknown word '%s'", num, word); - } - } while (s[0] != '\n' && !myfeof(f)); //finish when the line is empty -} -*/ - static boolean findFreeSlot(INT32 *num) { // Send the character select entry to a free slot. - while (*num < MAXSKINS && PlayerMenu[*num].status != IT_DISABLED) + while (*num < MAXSKINS && (description[*num].used)) *num = *num+1; // No more free slots. :( if (*num >= MAXSKINS) return false; + description[*num].picname[0] = '\0'; // Redesign your logo. (See M_DrawSetupChoosePlayerMenu in m_menu.c...) + // Found one! ^_^ - return true; + return (description[*num].used = true); } // Reads a player. @@ -456,8 +328,6 @@ static void readPlayer(MYFILE *f, INT32 num) INT32 i; boolean slotfound = false; - DEH_WriteUndoline("PLAYERTEXT", description[num].notes, UNDO_ENDTEXT); - do { if (myfgets(s, MAXLINELEN, f)) @@ -477,7 +347,6 @@ static void readPlayer(MYFILE *f, INT32 num) if (!slotfound && (slotfound = findFreeSlot(&num)) == false) goto done; - PlayerMenu[num].status = IT_CALL; for (i = 0; i < MAXLINELEN-3; i++) { @@ -523,66 +392,32 @@ static void readPlayer(MYFILE *f, INT32 num) word2[strlen(word2)-1] = '\0'; i = atoi(word2); - /*if (fastcmp(word, "PLAYERNAME")) + if (fastcmp(word, "PICNAME")) { if (!slotfound && (slotfound = findFreeSlot(&num)) == false) goto done; - DEH_WriteUndoline(word, description[num].text, UNDO_NONE); - strlcpy(description[num].text, word2, sizeof (description[num].text)); - for (word2 = description[num].text; *word2; word2++) - if (*word2 == '_') - *word2 = ' '; - PlayerMenu[num].text = description[num].text; - }*/ -/* else if (fastcmp(word, "MENUPOSITION")) - { // Make sure you make MENUPOSITION the first thing under CHARACTER if you're using it! - // This is to manually choose a slot and overwrite existing characters! It is NOT necessary for most individual character wads!! -#ifdef DELFILE - if (disableundo) -#endif - { - slotfound = true; - num = i; - } - } */ - /*else*/ if (fastcmp(word, "PICNAME")) - { - if (!slotfound && (slotfound = findFreeSlot(&num)) == false) - goto done; - DEH_WriteUndoline(word, &description[num].picname[0], UNDO_NONE); - PlayerMenu[num].status = IT_CALL; + strncpy(description[num].picname, word2, 8); } else if (fastcmp(word, "STATUS")) { - // Limit the status to only IT_DISABLED and IT_CALL - if (i) - i = IT_CALL; - else - i = IT_DISABLED; - /* You MAY disable previous entries if you so desire... But try to enable something that's already enabled and you will be sent to a free slot. - Because of this, you are allowed to edit any previous entrys you like, but only if you + Because of this, you are allowed to edit any previous entries you like, but only if you signal that you are purposely doing so by disabling and then reenabling the slot. - - ... Or use MENUPOSITION first, that works too. Hell, you could edit multiple character - slots in a single section that way, due to how SOC editing works. */ - if (i != IT_DISABLED && !slotfound && (slotfound = findFreeSlot(&num)) == false) + if (i && !slotfound && (slotfound = findFreeSlot(&num)) == false) goto done; - DEH_WriteUndoline(word, va("%d", PlayerMenu[num].status), UNDO_NONE); - PlayerMenu[num].status = (INT16)i; + + description[num].used = (!!i); } else if (fastcmp(word, "SKINNAME")) { // Send to free slot. if (!slotfound && (slotfound = findFreeSlot(&num)) == false) goto done; - DEH_WriteUndoline(word, description[num].skinname, UNDO_NONE); - PlayerMenu[num].status = IT_CALL; strlcpy(description[num].skinname, word2, sizeof description[num].skinname); strlwr(description[num].skinname); @@ -592,11 +427,6 @@ static void readPlayer(MYFILE *f, INT32 num) } } while (!myfeof(f)); // finish when the line is empty -#ifdef DELFILE - if (slotfound) - DEH_WriteUndoline("MENUPOSITION", va("%d", num), UNDO_NONE); -#endif - done: Z_Free(s); } @@ -675,6 +505,22 @@ static void readfreeslots(MYFILE *f) break; } } + else if (fastcmp(type, "SPR2")) + { + // Search if we already have an SPR2 by that name... + for (i = SPR2_FIRSTFREESLOT; i < (int)free_spr2; i++) + if (memcmp(spr2names[i],word,4) == 0) + break; + // We found it? (Two mods using the same SPR2 name?) Then don't allocate another one. + if (i < (int)free_spr2) + continue; + // Copy in the spr2 name and increment free_spr2. + if (free_spr2 < NUMPLAYERSPRITES) { + strncpy(spr2names[free_spr2],word,4); + spr2names[free_spr2++][4] = 0; + } else + CONS_Alert(CONS_WARNING, "Ran out of free SPR2 slots!\n"); + } else deh_warning("Freeslots: unknown enum class '%s' for '%s_%s'", type, type, word); } @@ -718,122 +564,98 @@ static void readthing(MYFILE *f, INT32 num) if (fastcmp(word, "MAPTHINGNUM") || fastcmp(word, "DOOMEDNUM")) { - DEH_WriteUndoline(word, va("%d", mobjinfo[num].doomednum), UNDO_NONE); mobjinfo[num].doomednum = (INT32)atoi(word2); } else if (fastcmp(word, "SPAWNSTATE")) { - DEH_WriteUndoline(word, va("%d", mobjinfo[num].spawnstate), UNDO_NONE); mobjinfo[num].spawnstate = get_number(word2); } else if (fastcmp(word, "SPAWNHEALTH")) { - DEH_WriteUndoline(word, va("%d", mobjinfo[num].spawnhealth), UNDO_NONE); mobjinfo[num].spawnhealth = (INT32)get_number(word2); } else if (fastcmp(word, "SEESTATE")) { - DEH_WriteUndoline(word, va("%d", mobjinfo[num].seestate), UNDO_NONE); mobjinfo[num].seestate = get_number(word2); } else if (fastcmp(word, "SEESOUND")) { - DEH_WriteUndoline(word, va("%d", mobjinfo[num].seesound), UNDO_NONE); mobjinfo[num].seesound = get_number(word2); } else if (fastcmp(word, "REACTIONTIME")) { - DEH_WriteUndoline(word, va("%d", mobjinfo[num].reactiontime), UNDO_NONE); mobjinfo[num].reactiontime = (INT32)get_number(word2); } else if (fastcmp(word, "ATTACKSOUND")) { - DEH_WriteUndoline(word, va("%d", mobjinfo[num].attacksound), UNDO_NONE); mobjinfo[num].attacksound = get_number(word2); } else if (fastcmp(word, "PAINSTATE")) { - DEH_WriteUndoline(word, va("%d", mobjinfo[num].painstate), UNDO_NONE); mobjinfo[num].painstate = get_number(word2); } else if (fastcmp(word, "PAINCHANCE")) { - DEH_WriteUndoline(word, va("%d", mobjinfo[num].painchance), UNDO_NONE); mobjinfo[num].painchance = (INT32)get_number(word2); } else if (fastcmp(word, "PAINSOUND")) { - DEH_WriteUndoline(word, va("%d", mobjinfo[num].painsound), UNDO_NONE); mobjinfo[num].painsound = get_number(word2); } else if (fastcmp(word, "MELEESTATE")) { - DEH_WriteUndoline(word, va("%d", mobjinfo[num].meleestate), UNDO_NONE); mobjinfo[num].meleestate = get_number(word2); } else if (fastcmp(word, "MISSILESTATE")) { - DEH_WriteUndoline(word, va("%d", mobjinfo[num].missilestate), UNDO_NONE); mobjinfo[num].missilestate = get_number(word2); } else if (fastcmp(word, "DEATHSTATE")) { - DEH_WriteUndoline(word, va("%d", mobjinfo[num].deathstate), UNDO_NONE); mobjinfo[num].deathstate = get_number(word2); } else if (fastcmp(word, "DEATHSOUND")) { - DEH_WriteUndoline(word, va("%d", mobjinfo[num].deathsound), UNDO_NONE); mobjinfo[num].deathsound = get_number(word2); } else if (fastcmp(word, "XDEATHSTATE")) { - DEH_WriteUndoline(word, va("%d", mobjinfo[num].xdeathstate), UNDO_NONE); mobjinfo[num].xdeathstate = get_number(word2); } else if (fastcmp(word, "SPEED")) { - DEH_WriteUndoline(word, va("%d", mobjinfo[num].speed), UNDO_NONE); mobjinfo[num].speed = get_number(word2); } else if (fastcmp(word, "RADIUS")) { - DEH_WriteUndoline(word, va("%d", mobjinfo[num].radius), UNDO_NONE); mobjinfo[num].radius = get_number(word2); } else if (fastcmp(word, "HEIGHT")) { - DEH_WriteUndoline(word, va("%d", mobjinfo[num].height), UNDO_NONE); mobjinfo[num].height = get_number(word2); } else if (fastcmp(word, "DISPOFFSET")) { - DEH_WriteUndoline(word, va("%d", mobjinfo[num].dispoffset), UNDO_NONE); mobjinfo[num].dispoffset = get_number(word2); } else if (fastcmp(word, "MASS")) { - DEH_WriteUndoline(word, va("%d", mobjinfo[num].mass), UNDO_NONE); mobjinfo[num].mass = (INT32)get_number(word2); } else if (fastcmp(word, "DAMAGE")) { - DEH_WriteUndoline(word, va("%d", mobjinfo[num].damage), UNDO_NONE); mobjinfo[num].damage = (INT32)get_number(word2); } else if (fastcmp(word, "ACTIVESOUND")) { - DEH_WriteUndoline(word, va("%d", mobjinfo[num].activesound), UNDO_NONE); mobjinfo[num].activesound = get_number(word2); } else if (fastcmp(word, "FLAGS")) { - DEH_WriteUndoline(word, va("%d", mobjinfo[num].flags), UNDO_NONE); mobjinfo[num].flags = (INT32)get_number(word2); } else if (fastcmp(word, "RAISESTATE")) { - DEH_WriteUndoline(word, va("%d", mobjinfo[num].raisestate), UNDO_NONE); mobjinfo[num].raisestate = get_number(word2); } else @@ -877,37 +699,30 @@ static void readlight(MYFILE *f, INT32 num) if (fastcmp(word, "TYPE")) { - DEH_WriteUndoline(word, va("%d", lspr[num].type), UNDO_NONE); lspr[num].type = (UINT16)value; } else if (fastcmp(word, "OFFSETX")) { - DEH_WriteUndoline(word, va("%f", lspr[num].light_xoffset), UNDO_NONE); lspr[num].light_xoffset = fvalue; } else if (fastcmp(word, "OFFSETY")) { - DEH_WriteUndoline(word, va("%f", lspr[num].light_yoffset), UNDO_NONE); lspr[num].light_yoffset = fvalue; } else if (fastcmp(word, "CORONACOLOR")) { - DEH_WriteUndoline(word, va("%u", lspr[num].corona_color), UNDO_NONE); lspr[num].corona_color = value; } else if (fastcmp(word, "CORONARADIUS")) { - DEH_WriteUndoline(word, va("%f", lspr[num].corona_radius), UNDO_NONE); lspr[num].corona_radius = fvalue; } else if (fastcmp(word, "DYNAMICCOLOR")) { - DEH_WriteUndoline(word, va("%u", lspr[num].dynamic_color), UNDO_NONE); lspr[num].dynamic_color = value; } else if (fastcmp(word, "DYNAMICRADIUS")) { - DEH_WriteUndoline(word, va("%f", lspr[num].dynamic_radius), UNDO_NONE); lspr[num].dynamic_radius = fvalue; /// \note Update the sqrradius! unnecessary? @@ -954,7 +769,6 @@ static void readspritelight(MYFILE *f, INT32 num) INT32 oldvar; for (oldvar = 0; t_lspr[num] != &lspr[oldvar]; oldvar++) ; - DEH_WriteUndoline(word, va("%d", oldvar), UNDO_NONE); t_lspr[num] = &lspr[value]; } else @@ -966,6 +780,49 @@ static void readspritelight(MYFILE *f, INT32 num) } #endif // HWRENDER +static void readsprite2(MYFILE *f, INT32 num) +{ + char *s = Z_Malloc(MAXLINELEN, PU_STATIC, NULL); + char *word, *word2; + char *tmp; + + do + { + if (myfgets(s, MAXLINELEN, f)) + { + if (s[0] == '\n') + break; + + tmp = strchr(s, '#'); + if (tmp) + *tmp = '\0'; + if (s == tmp) + continue; // Skip comment lines, but don't break. + + word = strtok(s, " "); + if (word) + strupr(word); + else + break; + + word2 = strtok(NULL, " = "); + if (word2) + strupr(word2); + else + break; + if (word2[strlen(word2)-1] == '\n') + word2[strlen(word2)-1] = '\0'; + + if (fastcmp(word, "DEFAULT")) + spr2defaults[num] = get_number(word2); + else + deh_warning("Sprite2 %s: unknown word '%s'", spr2names[num], word); + } + } while (!myfeof(f)); // finish when the line is empty + + Z_Free(s); +} + static const struct { const char *name; const UINT16 flag; @@ -999,6 +856,36 @@ static const struct { {NULL, 0} }; +static const struct { + const char *name; + const mobjtype_t type; +} FLICKYTYPES[] = { + {"BLUEBIRD", MT_FLICKY_01}, // Flicky (Flicky) + {"RABBIT", MT_FLICKY_02}, // Pocky (1) + {"CHICKEN", MT_FLICKY_03}, // Cucky (1) + {"SEAL", MT_FLICKY_04}, // Rocky (1) + {"PIG", MT_FLICKY_05}, // Picky (1) + {"CHIPMUNK", MT_FLICKY_06}, // Ricky (1) + {"PENGUIN", MT_FLICKY_07}, // Pecky (1) + {"FISH", MT_FLICKY_08}, // Nicky (CD) + {"RAM", MT_FLICKY_09}, // Flocky (CD) + {"PUFFIN", MT_FLICKY_10}, // Wicky (CD) + {"COW", MT_FLICKY_11}, // Macky (SRB2) + {"RAT", MT_FLICKY_12}, // Micky (2) + {"BEAR", MT_FLICKY_13}, // Becky (2) + {"DOVE", MT_FLICKY_14}, // Docky (CD) + {"CAT", MT_FLICKY_15}, // Nyannyan (Flicky) + {"CANARY", MT_FLICKY_16}, // Lucky (CD) + {"a", 0}, // End of normal flickies - a lower case character so will never fastcmp valid with uppercase tmp + //{"FLICKER", MT_FLICKER}, // Flacky (SRB2) + {"SPIDER", MT_SECRETFLICKY_01}, // Sticky (SRB2) + {"BAT", MT_SECRETFLICKY_02}, // Backy (SRB2) + {"SEED", MT_SEED}, // Seed (CD) + {NULL, 0} +}; + +#define MAXFLICKIES 64 + static void readlevelheader(MYFILE *f, INT32 num) { char *s = Z_Malloc(MAXLINELEN, PU_STATIC, NULL); @@ -1009,8 +896,6 @@ static void readlevelheader(MYFILE *f, INT32 num) INT32 i; // Reset all previous map header information - // This call automatically saves all previous information when DELFILE is defined. - // We don't need to do it ourselves. P_AllocMapHeader((INT16)(num-1)); do @@ -1100,8 +985,82 @@ static void readlevelheader(MYFILE *f, INT32 num) // Now go to uppercase strupr(word2); + // List of flickies that are be freed in this map + if (fastcmp(word, "FLICKYLIST") || fastcmp(word, "ANIMALLIST")) + { + if (fastcmp(word2, "NONE")) + P_DeleteFlickies(num-1); + else if (fastcmp(word2, "DEMO")) + P_SetDemoFlickies(num-1); + else if (fastcmp(word2, "ALL")) + { + mobjtype_t tmpflickies[MAXFLICKIES]; + + for (mapheaderinfo[num-1]->numFlickies = 0; + ((mapheaderinfo[num-1]->numFlickies < MAXFLICKIES) && FLICKYTYPES[mapheaderinfo[num-1]->numFlickies].type); + mapheaderinfo[num-1]->numFlickies++) + tmpflickies[mapheaderinfo[num-1]->numFlickies] = FLICKYTYPES[mapheaderinfo[num-1]->numFlickies].type; + + if (mapheaderinfo[num-1]->numFlickies) // just in case... + { + size_t newsize = sizeof(mobjtype_t) * mapheaderinfo[num-1]->numFlickies; + mapheaderinfo[num-1]->flickies = Z_Realloc(mapheaderinfo[num-1]->flickies, newsize, PU_STATIC, NULL); + M_Memcpy(mapheaderinfo[num-1]->flickies, tmpflickies, newsize); + } + } + else + { + mobjtype_t tmpflickies[MAXFLICKIES]; + mapheaderinfo[num-1]->numFlickies = 0; + tmp = strtok(word2,","); + // get up to the first MAXFLICKIES flickies + do { + if (mapheaderinfo[num-1]->numFlickies == MAXFLICKIES) // never going to get above that number + { + deh_warning("Level header %d: too many flickies\n", num); + break; + } + + if (fastncmp(tmp, "MT_", 3)) // support for specified mobjtypes... + { + i = get_mobjtype(tmp); + if (!i) + { + //deh_warning("Level header %d: unknown flicky mobj type %s\n", num, tmp); -- no need for this line as get_mobjtype complains too + continue; + } + tmpflickies[mapheaderinfo[num-1]->numFlickies] = i; + } + else // ...or a quick, limited selection of default flickies! + { + for (i = 0; FLICKYTYPES[i].name; i++) + if (fastcmp(tmp, FLICKYTYPES[i].name)) + break; + + if (!FLICKYTYPES[i].name) + { + deh_warning("Level header %d: unknown flicky selection %s\n", num, tmp); + continue; + } + tmpflickies[mapheaderinfo[num-1]->numFlickies] = FLICKYTYPES[i].type; + } + mapheaderinfo[num-1]->numFlickies++; + } while ((tmp = strtok(NULL,",")) != NULL); + + if (mapheaderinfo[num-1]->numFlickies) + { + size_t newsize = sizeof(mobjtype_t) * mapheaderinfo[num-1]->numFlickies; + mapheaderinfo[num-1]->flickies = Z_Realloc(mapheaderinfo[num-1]->flickies, newsize, PU_STATIC, NULL); + // now we add them to the list! + M_Memcpy(mapheaderinfo[num-1]->flickies, tmpflickies, newsize); + } + else + deh_warning("Level header %d: no valid flicky types found\n", num); + } + } + // NiGHTS grades - if (fastncmp(word, "GRADES", 6)) + else if (fastncmp(word, "GRADES", 6)) { UINT8 mare = (UINT8)atoi(word + 6); @@ -1119,6 +1078,12 @@ static void readlevelheader(MYFILE *f, INT32 num) { deh_strlcpy(mapheaderinfo[num-1]->lvlttl, word2, sizeof(mapheaderinfo[num-1]->lvlttl), va("Level header %d: levelname", num)); + strlcpy(mapheaderinfo[num-1]->selectheading, word2, sizeof(mapheaderinfo[num-1]->selectheading)); // not deh_ so only complains once + } + else if (fastcmp(word, "SELECTHEADING")) + { + deh_strlcpy(mapheaderinfo[num-1]->selectheading, word2, + sizeof(mapheaderinfo[num-1]->selectheading), va("Level header %d: selectheading", num)); } else if (fastcmp(word, "SCRIPTNAME")) { @@ -1248,25 +1213,17 @@ static void readlevelheader(MYFILE *f, INT32 num) else if (fastcmp(word2, "NORMAL")) i = 0; else if (fastcmp(word2, "BOSS")) i = 1; else if (fastcmp(word2, "ERZ3")) i = 2; + else if (fastcmp(word2, "NIGHTS")) i = 3; + else if (fastcmp(word2, "NIGHTSLINK")) i = 4; - if (i >= -1 && i <= 2) // -1 for no bonus. Max is 2. + if (i >= -1 && i <= 4) // -1 for no bonus. Max is 4. mapheaderinfo[num-1]->bonustype = (SINT8)i; else deh_warning("Level header %d: invalid bonus type number %d", num, i); } - else if (fastcmp(word, "SAVEOVERRIDE")) - { - if (fastcmp(word2, "DEFAULT")) i = SAVE_DEFAULT; - else if (fastcmp(word2, "ALWAYS")) i = SAVE_ALWAYS; - else if (fastcmp(word2, "NEVER")) i = SAVE_NEVER; - - if (i >= SAVE_NEVER && i <= SAVE_ALWAYS) - mapheaderinfo[num-1]->saveoverride = (SINT8)i; - else - deh_warning("Level header %d: invalid save override number %d", num, i); - } - + else if (fastcmp(word, "MAXBONUSLIVES")) + mapheaderinfo[num-1]->maxbonuslives = (SINT8)i; else if (fastcmp(word, "LEVELFLAGS")) mapheaderinfo[num-1]->levelflags = (UINT8)i; else if (fastcmp(word, "MENUFLAGS")) @@ -1308,6 +1265,20 @@ static void readlevelheader(MYFILE *f, INT32 num) else mapheaderinfo[num-1]->levelflags &= ~LF_NOZONE; } + else if (fastcmp(word, "SAVEGAME")) + { + if (i || word2[0] == 'T' || word2[0] == 'Y') + mapheaderinfo[num-1]->levelflags |= LF_SAVEGAME; + else + mapheaderinfo[num-1]->levelflags &= ~LF_SAVEGAME; + } + else if (fastcmp(word, "MIXNIGHTSCOUNTDOWN")) + { + if (i || word2[0] == 'T' || word2[0] == 'Y') + mapheaderinfo[num-1]->levelflags |= LF_MIXNIGHTSCOUNTDOWN; + else + mapheaderinfo[num-1]->levelflags &= ~LF_MIXNIGHTSCOUNTDOWN; + } // Individual triggers for menu flags else if (fastcmp(word, "HIDDEN")) @@ -1345,6 +1316,15 @@ static void readlevelheader(MYFILE *f, INT32 num) else mapheaderinfo[num-1]->menuflags &= ~LF2_NOVISITNEEDED; } + else if (fastcmp(word, "WIDEICON")) + { + if (i || word2[0] == 'T' || word2[0] == 'Y') + mapheaderinfo[num-1]->menuflags |= LF2_WIDEICON; + else + mapheaderinfo[num-1]->menuflags &= ~LF2_WIDEICON; + } + else if (fastcmp(word, "STARTRINGS")) + mapheaderinfo[num-1]->startrings = (UINT16)i; else deh_warning("Level header %d: unknown word '%s'", num, word); } @@ -1353,6 +1333,8 @@ static void readlevelheader(MYFILE *f, INT32 num) Z_Free(s); } +#undef MAXFLICKIES + static void readcutscenescene(MYFILE *f, INT32 num, INT32 scenenum) { char *s = Z_Calloc(MAXLINELEN, PU_STATIC, NULL); @@ -1362,8 +1344,6 @@ static void readcutscenescene(MYFILE *f, INT32 num, INT32 scenenum) UINT16 usi; UINT8 picid; - DEH_WriteUndoline("SCENETEXT", cutscenes[num]->scene[scenenum].text, UNDO_ENDTEXT); - do { if (myfgets(s, MAXLINELEN, f)) @@ -1440,7 +1420,6 @@ static void readcutscenescene(MYFILE *f, INT32 num, INT32 scenenum) if (fastcmp(word, "NUMBEROFPICS")) { - DEH_WriteUndoline(word, va("%d", cutscenes[num]->scene[scenenum].numpics), UNDO_NONE); cutscenes[num]->scene[scenenum].numpics = (UINT8)i; } else if (fastncmp(word, "PIC", 3)) @@ -1455,27 +1434,22 @@ static void readcutscenescene(MYFILE *f, INT32 num, INT32 scenenum) if (fastcmp(word+4, "NAME")) { - DEH_WriteUndoline(word, cutscenes[num]->scene[scenenum].picname[picid], UNDO_NONE); strncpy(cutscenes[num]->scene[scenenum].picname[picid], word2, 8); } else if (fastcmp(word+4, "HIRES")) { - DEH_WriteUndoline(word, va("%d", cutscenes[num]->scene[scenenum].pichires[picid]), UNDO_NONE); cutscenes[num]->scene[scenenum].pichires[picid] = (UINT8)(i || word2[0] == 'T' || word2[0] == 'Y'); } else if (fastcmp(word+4, "DURATION")) { - DEH_WriteUndoline(word, va("%u", cutscenes[num]->scene[scenenum].picduration[picid]), UNDO_NONE); cutscenes[num]->scene[scenenum].picduration[picid] = usi; } else if (fastcmp(word+4, "XCOORD")) { - DEH_WriteUndoline(word, va("%u", cutscenes[num]->scene[scenenum].xcoord[picid]), UNDO_NONE); cutscenes[num]->scene[scenenum].xcoord[picid] = usi; } else if (fastcmp(word+4, "YCOORD")) { - DEH_WriteUndoline(word, va("%u", cutscenes[num]->scene[scenenum].ycoord[picid]), UNDO_NONE); cutscenes[num]->scene[scenenum].ycoord[picid] = usi; } else @@ -1483,14 +1457,12 @@ static void readcutscenescene(MYFILE *f, INT32 num, INT32 scenenum) } else if (fastcmp(word, "MUSIC")) { - DEH_WriteUndoline(word, cutscenes[num]->scene[scenenum].musswitch, UNDO_NONE); strncpy(cutscenes[num]->scene[scenenum].musswitch, word2, 7); cutscenes[num]->scene[scenenum].musswitch[6] = 0; } #ifdef MUSICSLOT_COMPATIBILITY else if (fastcmp(word, "MUSICSLOT")) { - DEH_WriteUndoline(word, cutscenes[num]->scene[scenenum].musswitch, UNDO_NONE); i = get_mus(word2, true); if (i && i <= 1035) snprintf(cutscenes[num]->scene[scenenum].musswitch, 7, "%sM", G_BuildMapName(i)); @@ -1503,42 +1475,34 @@ static void readcutscenescene(MYFILE *f, INT32 num, INT32 scenenum) #endif else if (fastcmp(word, "MUSICTRACK")) { - DEH_WriteUndoline(word, va("%u", cutscenes[num]->scene[scenenum].musswitchflags), UNDO_NONE); cutscenes[num]->scene[scenenum].musswitchflags = ((UINT16)i) & MUSIC_TRACKMASK; } else if (fastcmp(word, "MUSICPOS")) { - DEH_WriteUndoline(word, va("%u", cutscenes[num]->scene[scenenum].musswitchposition), UNDO_NONE); cutscenes[num]->scene[scenenum].musswitchposition = (UINT32)get_number(word2); } else if (fastcmp(word, "MUSICLOOP")) { - DEH_WriteUndoline(word, va("%u", cutscenes[num]->scene[scenenum].musicloop), UNDO_NONE); cutscenes[num]->scene[scenenum].musicloop = (UINT8)(i || word2[0] == 'T' || word2[0] == 'Y'); } else if (fastcmp(word, "TEXTXPOS")) { - DEH_WriteUndoline(word, va("%u", cutscenes[num]->scene[scenenum].textxpos), UNDO_NONE); cutscenes[num]->scene[scenenum].textxpos = usi; } else if (fastcmp(word, "TEXTYPOS")) { - DEH_WriteUndoline(word, va("%u", cutscenes[num]->scene[scenenum].textypos), UNDO_NONE); cutscenes[num]->scene[scenenum].textypos = usi; } else if (fastcmp(word, "FADEINID")) { - DEH_WriteUndoline(word, va("%u", cutscenes[num]->scene[scenenum].fadenum), UNDO_NONE); cutscenes[num]->scene[scenenum].fadeinid = (UINT8)i; } else if (fastcmp(word, "FADEOUTID")) { - DEH_WriteUndoline(word, va("%u", cutscenes[num]->scene[scenenum].fadenum), UNDO_NONE); cutscenes[num]->scene[scenenum].fadeoutid = (UINT8)i; } else if (fastcmp(word, "FADECOLOR")) { - DEH_WriteUndoline(word, va("%u", cutscenes[num]->scene[scenenum].fadenum), UNDO_NONE); cutscenes[num]->scene[scenenum].fadecolor = (UINT8)i; } else @@ -1556,9 +1520,6 @@ static void readcutscene(MYFILE *f, INT32 num) char *word2; char *tmp; INT32 value; -#ifdef DELFILE - const INT32 oldnumscenes = cutscenes[num]->numscenes; -#endif // Allocate memory for this cutscene if we don't yet have any if (!cutscenes[num]) @@ -1601,8 +1562,6 @@ static void readcutscene(MYFILE *f, INT32 num) if (1 <= value && value <= 128) { readcutscenescene(f, num, value - 1); - DEH_WriteUndoline(word, word2, UNDO_SPACE|UNDO_CUTLINE); - DEH_WriteUndoline("NUMSCENES", va("%d", oldnumscenes), UNDO_SPACE); } else deh_warning("Scene number %d out of range (1 - 128)", value); @@ -1616,6 +1575,528 @@ static void readcutscene(MYFILE *f, INT32 num) Z_Free(s); } +static void readtextpromptpage(MYFILE *f, INT32 num, INT32 pagenum) +{ + char *s = Z_Calloc(MAXLINELEN, PU_STATIC, NULL); + char *word; + char *word2; + INT32 i; + UINT16 usi; + UINT8 picid; + + do + { + if (myfgets(s, MAXLINELEN, f)) + { + if (s[0] == '\n') + break; + + word = strtok(s, " "); + if (word) + strupr(word); + else + break; + + if (fastcmp(word, "PAGETEXT")) + { + char *pagetext = NULL; + char *buffer; + const int bufferlen = 4096; + + for (i = 0; i < MAXLINELEN; i++) + { + if (s[i] == '=') + { + pagetext = &s[i+2]; + break; + } + } + + if (!pagetext) + { + Z_Free(textprompts[num]->page[pagenum].text); + textprompts[num]->page[pagenum].text = NULL; + continue; + } + + for (i = 0; i < MAXLINELEN; i++) + { + if (s[i] == '\0') + { + s[i] = '\n'; + s[i+1] = '\0'; + break; + } + } + + buffer = Z_Malloc(4096, PU_STATIC, NULL); + strcpy(buffer, pagetext); + + // \todo trim trailing whitespace before the # + // and also support # at the end of a PAGETEXT with no line break + + strcat(buffer, + myhashfgets(pagetext, bufferlen + - strlen(buffer) - 1, f)); + + // A text prompt overwriting another one... + Z_Free(textprompts[num]->page[pagenum].text); + + textprompts[num]->page[pagenum].text = Z_StrDup(buffer); + + Z_Free(buffer); + + continue; + } + + word2 = strtok(NULL, " = "); + if (word2) + strupr(word2); + else + break; + + if (word2[strlen(word2)-1] == '\n') + word2[strlen(word2)-1] = '\0'; + i = atoi(word2); + usi = (UINT16)i; + + // copypasta from readcutscenescene + if (fastcmp(word, "NUMBEROFPICS")) + { + textprompts[num]->page[pagenum].numpics = (UINT8)i; + } + else if (fastcmp(word, "PICMODE")) + { + UINT8 picmode = 0; // PROMPT_PIC_PERSIST + if (usi == 1 || word2[0] == 'L') picmode = PROMPT_PIC_LOOP; + else if (usi == 2 || word2[0] == 'D' || word2[0] == 'H') picmode = PROMPT_PIC_DESTROY; + textprompts[num]->page[pagenum].picmode = picmode; + } + else if (fastcmp(word, "PICTOLOOP")) + textprompts[num]->page[pagenum].pictoloop = (UINT8)i; + else if (fastcmp(word, "PICTOSTART")) + textprompts[num]->page[pagenum].pictostart = (UINT8)i; + else if (fastcmp(word, "PICSMETAPAGE")) + { + if (usi && usi <= textprompts[num]->numpages) + { + UINT8 metapagenum = usi - 1; + + textprompts[num]->page[pagenum].numpics = textprompts[num]->page[metapagenum].numpics; + textprompts[num]->page[pagenum].picmode = textprompts[num]->page[metapagenum].picmode; + textprompts[num]->page[pagenum].pictoloop = textprompts[num]->page[metapagenum].pictoloop; + textprompts[num]->page[pagenum].pictostart = textprompts[num]->page[metapagenum].pictostart; + + for (picid = 0; picid < MAX_PROMPT_PICS; picid++) + { + strncpy(textprompts[num]->page[pagenum].picname[picid], textprompts[num]->page[metapagenum].picname[picid], 8); + textprompts[num]->page[pagenum].pichires[picid] = textprompts[num]->page[metapagenum].pichires[picid]; + textprompts[num]->page[pagenum].picduration[picid] = textprompts[num]->page[metapagenum].picduration[picid]; + textprompts[num]->page[pagenum].xcoord[picid] = textprompts[num]->page[metapagenum].xcoord[picid]; + textprompts[num]->page[pagenum].ycoord[picid] = textprompts[num]->page[metapagenum].ycoord[picid]; + } + } + } + else if (fastncmp(word, "PIC", 3)) + { + picid = (UINT8)atoi(word + 3); + if (picid > MAX_PROMPT_PICS || picid == 0) + { + deh_warning("textpromptscene %d: unknown word '%s'", num, word); + continue; + } + --picid; + + if (fastcmp(word+4, "NAME")) + { + strncpy(textprompts[num]->page[pagenum].picname[picid], word2, 8); + } + else if (fastcmp(word+4, "HIRES")) + { + textprompts[num]->page[pagenum].pichires[picid] = (UINT8)(i || word2[0] == 'T' || word2[0] == 'Y'); + } + else if (fastcmp(word+4, "DURATION")) + { + textprompts[num]->page[pagenum].picduration[picid] = usi; + } + else if (fastcmp(word+4, "XCOORD")) + { + textprompts[num]->page[pagenum].xcoord[picid] = usi; + } + else if (fastcmp(word+4, "YCOORD")) + { + textprompts[num]->page[pagenum].ycoord[picid] = usi; + } + else + deh_warning("textpromptscene %d: unknown word '%s'", num, word); + } + else if (fastcmp(word, "MUSIC")) + { + strncpy(textprompts[num]->page[pagenum].musswitch, word2, 7); + textprompts[num]->page[pagenum].musswitch[6] = 0; + } +#ifdef MUSICSLOT_COMPATIBILITY + else if (fastcmp(word, "MUSICSLOT")) + { + i = get_mus(word2, true); + if (i && i <= 1035) + snprintf(textprompts[num]->page[pagenum].musswitch, 7, "%sM", G_BuildMapName(i)); + else if (i && i <= 1050) + strncpy(textprompts[num]->page[pagenum].musswitch, compat_special_music_slots[i - 1036], 7); + else + textprompts[num]->page[pagenum].musswitch[0] = 0; // becomes empty string + textprompts[num]->page[pagenum].musswitch[6] = 0; + } +#endif + else if (fastcmp(word, "MUSICTRACK")) + { + textprompts[num]->page[pagenum].musswitchflags = ((UINT16)i) & MUSIC_TRACKMASK; + } + else if (fastcmp(word, "MUSICLOOP")) + { + textprompts[num]->page[pagenum].musicloop = (UINT8)(i || word2[0] == 'T' || word2[0] == 'Y'); + } + // end copypasta from readcutscenescene + else if (fastcmp(word, "NAME")) + { + INT32 j; + + // HACK: Add yellow control char now + // so the drawing function doesn't call it repeatedly + char name[34]; + name[0] = '\x82'; // color yellow + name[1] = 0; + strncat(name, word2, 33); + name[33] = 0; + + // Replace _ with ' ' + for (j = 0; j < 32 && name[j]; j++) + { + if (name[j] == '_') + name[j] = ' '; + } + + strncpy(textprompts[num]->page[pagenum].name, name, 32); + } + else if (fastcmp(word, "ICON")) + strncpy(textprompts[num]->page[pagenum].iconname, word2, 8); + else if (fastcmp(word, "ICONALIGN")) + textprompts[num]->page[pagenum].rightside = (i || word2[0] == 'R'); + else if (fastcmp(word, "ICONFLIP")) + textprompts[num]->page[pagenum].iconflip = (i || word2[0] == 'T' || word2[0] == 'Y'); + else if (fastcmp(word, "LINES")) + textprompts[num]->page[pagenum].lines = usi; + else if (fastcmp(word, "BACKCOLOR")) + { + INT32 backcolor; + if (i == 0 || fastcmp(word2, "WHITE")) backcolor = 0; + else if (i == 1 || fastcmp(word2, "GRAY") || fastcmp(word2, "GREY") || + fastcmp(word2, "BLACK")) backcolor = 1; + else if (i == 2 || fastcmp(word2, "SEPIA")) backcolor = 2; + else if (i == 3 || fastcmp(word2, "BROWN")) backcolor = 3; + else if (i == 4 || fastcmp(word2, "PINK")) backcolor = 4; + else if (i == 5 || fastcmp(word2, "RASPBERRY")) backcolor = 5; + else if (i == 6 || fastcmp(word2, "RED")) backcolor = 6; + else if (i == 7 || fastcmp(word2, "CREAMSICLE")) backcolor = 7; + else if (i == 8 || fastcmp(word2, "ORANGE")) backcolor = 8; + else if (i == 9 || fastcmp(word2, "GOLD")) backcolor = 9; + else if (i == 10 || fastcmp(word2, "YELLOW")) backcolor = 10; + else if (i == 11 || fastcmp(word2, "EMERALD")) backcolor = 11; + else if (i == 12 || fastcmp(word2, "GREEN")) backcolor = 12; + else if (i == 13 || fastcmp(word2, "CYAN") || fastcmp(word2, "AQUA")) backcolor = 13; + else if (i == 14 || fastcmp(word2, "STEEL")) backcolor = 14; + else if (i == 15 || fastcmp(word2, "PERIWINKLE")) backcolor = 15; + else if (i == 16 || fastcmp(word2, "BLUE")) backcolor = 16; + else if (i == 17 || fastcmp(word2, "PURPLE")) backcolor = 17; + else if (i == 18 || fastcmp(word2, "LAVENDER")) backcolor = 18; + else if (i < 0) backcolor = INT32_MAX; // CONS_BACKCOLOR user-configured + else backcolor = 1; // default gray + textprompts[num]->page[pagenum].backcolor = backcolor; + } + else if (fastcmp(word, "ALIGN")) + { + UINT8 align = 0; // left + if (usi == 1 || word2[0] == 'R') align = 1; + else if (usi == 2 || word2[0] == 'C' || word2[0] == 'M') align = 2; + textprompts[num]->page[pagenum].align = align; + } + else if (fastcmp(word, "VERTICALALIGN")) + { + UINT8 align = 0; // top + if (usi == 1 || word2[0] == 'B') align = 1; + else if (usi == 2 || word2[0] == 'C' || word2[0] == 'M') align = 2; + textprompts[num]->page[pagenum].verticalalign = align; + } + else if (fastcmp(word, "TEXTSPEED")) + textprompts[num]->page[pagenum].textspeed = get_number(word2); + else if (fastcmp(word, "TEXTSFX")) + textprompts[num]->page[pagenum].textsfx = get_number(word2); + else if (fastcmp(word, "HIDEHUD")) + { + UINT8 hidehud = 0; + if ((word2[0] == 'F' && (word2[1] == 'A' || !word2[1])) || word2[0] == 'N') hidehud = 0; // false + else if (usi == 1 || word2[0] == 'T' || word2[0] == 'Y') hidehud = 1; // true (hide appropriate HUD elements) + else if (usi == 2 || word2[0] == 'A' || (word2[0] == 'F' && word2[1] == 'O')) hidehud = 2; // force (hide all HUD elements) + textprompts[num]->page[pagenum].hidehud = hidehud; + } + else if (fastcmp(word, "METAPAGE")) + { + if (usi && usi <= textprompts[num]->numpages) + { + UINT8 metapagenum = usi - 1; + + strncpy(textprompts[num]->page[pagenum].name, textprompts[num]->page[metapagenum].name, 32); + strncpy(textprompts[num]->page[pagenum].iconname, textprompts[num]->page[metapagenum].iconname, 8); + textprompts[num]->page[pagenum].rightside = textprompts[num]->page[metapagenum].rightside; + textprompts[num]->page[pagenum].iconflip = textprompts[num]->page[metapagenum].iconflip; + textprompts[num]->page[pagenum].lines = textprompts[num]->page[metapagenum].lines; + textprompts[num]->page[pagenum].backcolor = textprompts[num]->page[metapagenum].backcolor; + textprompts[num]->page[pagenum].align = textprompts[num]->page[metapagenum].align; + textprompts[num]->page[pagenum].verticalalign = textprompts[num]->page[metapagenum].verticalalign; + textprompts[num]->page[pagenum].textspeed = textprompts[num]->page[metapagenum].textspeed; + textprompts[num]->page[pagenum].textsfx = textprompts[num]->page[metapagenum].textsfx; + textprompts[num]->page[pagenum].hidehud = textprompts[num]->page[metapagenum].hidehud; + + // music: don't copy, else each page change may reset the music + } + } + else if (fastcmp(word, "TAG")) + strncpy(textprompts[num]->page[pagenum].tag, word2, 33); + else if (fastcmp(word, "NEXTPROMPT")) + textprompts[num]->page[pagenum].nextprompt = usi; + else if (fastcmp(word, "NEXTPAGE")) + textprompts[num]->page[pagenum].nextpage = usi; + else if (fastcmp(word, "NEXTTAG")) + strncpy(textprompts[num]->page[pagenum].nexttag, word2, 33); + else if (fastcmp(word, "TIMETONEXT")) + textprompts[num]->page[pagenum].timetonext = get_number(word2); + else + deh_warning("PromptPage %d: unknown word '%s'", num, word); + } + } while (!myfeof(f)); // finish when the line is empty + + Z_Free(s); +} + +static void readtextprompt(MYFILE *f, INT32 num) +{ + char *s = Z_Malloc(MAXLINELEN, PU_STATIC, NULL); + char *word; + char *word2; + char *tmp; + INT32 value; + + // Allocate memory for this prompt if we don't yet have any + if (!textprompts[num]) + textprompts[num] = Z_Calloc(sizeof (textprompt_t), PU_STATIC, NULL); + + do + { + if (myfgets(s, MAXLINELEN, f)) + { + if (s[0] == '\n') + break; + + tmp = strchr(s, '#'); + if (tmp) + *tmp = '\0'; + if (s == tmp) + continue; // Skip comment lines, but don't break. + + word = strtok(s, " "); + if (word) + strupr(word); + else + break; + + word2 = strtok(NULL, " "); + if (word2) + value = atoi(word2); + else + { + deh_warning("No value for token %s", word); + continue; + } + + if (fastcmp(word, "NUMPAGES")) + { + textprompts[num]->numpages = min(max(value, 0), MAX_PAGES); + } + else if (fastcmp(word, "PAGE")) + { + if (1 <= value && value <= MAX_PAGES) + { + textprompts[num]->page[value - 1].backcolor = 1; // default to gray + textprompts[num]->page[value - 1].hidehud = 1; // hide appropriate HUD elements + readtextpromptpage(f, num, value - 1); + } + else + deh_warning("Page number %d out of range (1 - %d)", value, MAX_PAGES); + + } + else + deh_warning("Prompt %d: unknown word '%s', Page expected.", num, word); + } + } while (!myfeof(f)); // finish when the line is empty + + Z_Free(s); +} + +static void readmenu(MYFILE *f, INT32 num) +{ + char *s = Z_Malloc(MAXLINELEN, PU_STATIC, NULL); + char *word = s; + char *word2; + char *tmp; + INT32 value; + + do + { + if (myfgets(s, MAXLINELEN, f)) + { + if (s[0] == '\n') + break; + + // First remove trailing newline, if there is one + tmp = strchr(s, '\n'); + if (tmp) + *tmp = '\0'; + + tmp = strchr(s, '#'); + if (tmp) + *tmp = '\0'; + if (s == tmp) + continue; // Skip comment lines, but don't break. + + // Get the part before the " = " + tmp = strchr(s, '='); + if (tmp) + *(tmp-1) = '\0'; + else + break; + strupr(word); + + // Now get the part after + word2 = (tmp += 2); + strupr(word2); + + value = atoi(word2); // used for numerical settings + + if (fastcmp(word, "BACKGROUNDNAME")) + { + strncpy(menupres[num].bgname, word2, 8); + titlechanged = true; + } + else if (fastcmp(word, "HIDEBACKGROUND")) + { + menupres[num].bghide = (boolean)(value || word2[0] == 'T' || word2[0] == 'Y'); + titlechanged = true; + } + else if (fastcmp(word, "BACKGROUNDCOLOR")) + { + menupres[num].bgcolor = get_number(word2); + titlechanged = true; + } + else if (fastcmp(word, "HIDETITLEPICS") || fastcmp(word, "HIDEPICS")) + { + // true by default, except MM_MAIN + menupres[num].hidetitlepics = (boolean)(value || word2[0] == 'T' || word2[0] == 'Y'); + titlechanged = true; + } + else if (fastcmp(word, "TITLESCROLLSPEED") || fastcmp(word, "TITLESCROLLXSPEED") + || fastcmp(word, "SCROLLSPEED") || fastcmp(word, "SCROLLXSPEED")) + { + menupres[num].titlescrollxspeed = get_number(word2); + titlechanged = true; + } + else if (fastcmp(word, "TITLESCROLLYSPEED") || fastcmp(word, "SCROLLYSPEED")) + { + menupres[num].titlescrollyspeed = get_number(word2); + titlechanged = true; + } + else if (fastcmp(word, "MUSIC")) + { + strncpy(menupres[num].musname, word2, 7); + menupres[num].musname[6] = 0; + titlechanged = true; + } +#ifdef MUSICSLOT_COMPATIBILITY + else if (fastcmp(word, "MUSICSLOT")) + { + value = get_mus(word2, true); + if (value && value <= 1035) + snprintf(menupres[num].musname, 7, "%sM", G_BuildMapName(value)); + else if (value && value <= 1050) + strncpy(menupres[num].musname, compat_special_music_slots[value - 1036], 7); + else + menupres[num].musname[0] = 0; // becomes empty string + menupres[num].musname[6] = 0; + titlechanged = true; + } +#endif + else if (fastcmp(word, "MUSICTRACK")) + { + menupres[num].mustrack = ((UINT16)value - 1); + titlechanged = true; + } + else if (fastcmp(word, "MUSICLOOP")) + { + // true by default except MM_MAIN + menupres[num].muslooping = (value || word2[0] == 'T' || word2[0] == 'Y'); + titlechanged = true; + } + else if (fastcmp(word, "NOMUSIC")) + { + menupres[num].musstop = (value || word2[0] == 'T' || word2[0] == 'Y'); + titlechanged = true; + } + else if (fastcmp(word, "IGNOREMUSIC")) + { + menupres[num].musignore = (value || word2[0] == 'T' || word2[0] == 'Y'); + titlechanged = true; + } + else if (fastcmp(word, "FADESTRENGTH")) + { + // one-based, <= 0 means use default value. 1-32 + menupres[num].fadestrength = get_number(word2)-1; + titlechanged = true; + } + else if (fastcmp(word, "NOENTERBUBBLE")) + { + menupres[num].enterbubble = !(value || word2[0] == 'T' || word2[0] == 'Y'); + titlechanged = true; + } + else if (fastcmp(word, "NOEXITBUBBLE")) + { + menupres[num].exitbubble = !(value || word2[0] == 'T' || word2[0] == 'Y'); + titlechanged = true; + } + else if (fastcmp(word, "ENTERTAG")) + { + menupres[num].entertag = get_number(word2); + titlechanged = true; + } + else if (fastcmp(word, "EXITTAG")) + { + menupres[num].exittag = get_number(word2); + titlechanged = true; + } + else if (fastcmp(word, "ENTERWIPE")) + { + menupres[num].enterwipe = get_number(word2); + titlechanged = true; + } + else if (fastcmp(word, "EXITWIPE")) + { + menupres[num].exitwipe = get_number(word2); + titlechanged = true; + } + } + } while (!myfeof(f)); // finish when the line is empty + + Z_Free(s); +} + static void readhuditem(MYFILE *f, INT32 num) { char *s = Z_Malloc(MAXLINELEN, PU_STATIC, NULL); @@ -1658,14 +2139,16 @@ static void readhuditem(MYFILE *f, INT32 num) if (fastcmp(word, "X")) { - DEH_WriteUndoline(word, va("%d", hudinfo[num].x), UNDO_NONE); hudinfo[num].x = i; } else if (fastcmp(word, "Y")) { - DEH_WriteUndoline(word, va("%d", hudinfo[num].y), UNDO_NONE); hudinfo[num].y = i; } + else if (fastcmp(word, "F")) + { + hudinfo[num].f = i; + } else deh_warning("Level header %d: unknown word '%s'", num, word); } @@ -1694,192 +2177,247 @@ typedef struct */ static actionpointer_t actionpointers[] = { - {{A_Explode}, "A_EXPLODE"}, - {{A_Pain}, "A_PAIN"}, - {{A_Fall}, "A_FALL"}, - {{A_MonitorPop}, "A_MONITORPOP"}, - {{A_Look}, "A_LOOK"}, - {{A_Chase}, "A_CHASE"}, - {{A_FaceStabChase}, "A_FACESTABCHASE"}, - {{A_FaceTarget}, "A_FACETARGET"}, - {{A_FaceTracer}, "A_FACETRACER"}, - {{A_Scream}, "A_SCREAM"}, - {{A_BossDeath}, "A_BOSSDEATH"}, - {{A_CustomPower}, "A_CUSTOMPOWER"}, - {{A_GiveWeapon}, "A_GIVEWEAPON"}, - {{A_RingShield}, "A_RINGSHIELD"}, - {{A_RingBox}, "A_RINGBOX"}, - {{A_Invincibility}, "A_INVINCIBILITY"}, - {{A_SuperSneakers}, "A_SUPERSNEAKERS"}, - {{A_BunnyHop}, "A_BUNNYHOP"}, - {{A_BubbleSpawn}, "A_BUBBLESPAWN"}, - {{A_FanBubbleSpawn}, "A_FANBUBBLESPAWN"}, - {{A_BubbleRise}, "A_BUBBLERISE"}, - {{A_BubbleCheck}, "A_BUBBLECHECK"}, - {{A_AwardScore}, "A_AWARDSCORE"}, - {{A_ExtraLife}, "A_EXTRALIFE"}, - {{A_BombShield}, "A_BOMBSHIELD"}, - {{A_JumpShield}, "A_JUMPSHIELD"}, - {{A_WaterShield}, "A_WATERSHIELD"}, - {{A_ForceShield}, "A_FORCESHIELD"}, - {{A_PityShield}, "A_PITYSHIELD"}, - {{A_GravityBox}, "A_GRAVITYBOX"}, - {{A_ScoreRise}, "A_SCORERISE"}, - {{A_ParticleSpawn}, "A_PARTICLESPAWN"}, - {{A_AttractChase}, "A_ATTRACTCHASE"}, - {{A_DropMine}, "A_DROPMINE"}, - {{A_FishJump}, "A_FISHJUMP"}, - {{A_ThrownRing}, "A_THROWNRING"}, - {{A_SetSolidSteam}, "A_SETSOLIDSTEAM"}, - {{A_UnsetSolidSteam}, "A_UNSETSOLIDSTEAM"}, - {{A_SignPlayer}, "A_SIGNPLAYER"}, - {{A_OverlayThink}, "A_OVERLAYTHINK"}, - {{A_JetChase}, "A_JETCHASE"}, - {{A_JetbThink}, "A_JETBTHINK"}, - {{A_JetgThink}, "A_JETGTHINK"}, - {{A_JetgShoot}, "A_JETGSHOOT"}, - {{A_ShootBullet}, "A_SHOOTBULLET"}, - {{A_MinusDigging}, "A_MINUSDIGGING"}, - {{A_MinusPopup}, "A_MINUSPOPUP"}, - {{A_MinusCheck}, "A_MINUSCHECK"}, - {{A_ChickenCheck}, "A_CHICKENCHECK"}, - {{A_MouseThink}, "A_MOUSETHINK"}, - {{A_DetonChase}, "A_DETONCHASE"}, - {{A_CapeChase}, "A_CAPECHASE"}, - {{A_RotateSpikeBall}, "A_ROTATESPIKEBALL"}, - {{A_SlingAppear}, "A_SLINGAPPEAR"}, - {{A_MaceRotate}, "A_MACEROTATE"}, - {{A_UnidusBall}, "A_UNIDUSBALL"}, - {{A_RockSpawn}, "A_ROCKSPAWN"}, - {{A_SetFuse}, "A_SETFUSE"}, - {{A_CrawlaCommanderThink}, "A_CRAWLACOMMANDERTHINK"}, - {{A_SmokeTrailer}, "A_SMOKETRAILER"}, - {{A_RingExplode}, "A_RINGEXPLODE"}, - {{A_OldRingExplode}, "A_OLDRINGEXPLODE"}, - {{A_MixUp}, "A_MIXUP"}, - {{A_RecyclePowers}, "A_RECYCLEPOWERS"}, - {{A_Boss1Chase}, "A_BOSS1CHASE"}, - {{A_FocusTarget}, "A_FOCUSTARGET"}, - {{A_Boss2Chase}, "A_BOSS2CHASE"}, - {{A_Boss2Pogo}, "A_BOSS2POGO"}, - {{A_BossZoom}, "A_BOSSZOOM"}, - {{A_BossScream}, "A_BOSSSCREAM"}, - {{A_Boss2TakeDamage}, "A_BOSS2TAKEDAMAGE"}, - {{A_Boss7Chase}, "A_BOSS7CHASE"}, - {{A_GoopSplat}, "A_GOOPSPLAT"}, - {{A_Boss2PogoSFX}, "A_BOSS2POGOSFX"}, - {{A_Boss2PogoTarget}, "A_BOSS2POGOTARGET"}, - {{A_BossJetFume}, "A_BOSSJETFUME"}, - {{A_EggmanBox}, "A_EGGMANBOX"}, - {{A_TurretFire}, "A_TURRETFIRE"}, - {{A_SuperTurretFire}, "A_SUPERTURRETFIRE"}, - {{A_TurretStop}, "A_TURRETSTOP"}, - {{A_JetJawRoam}, "A_JETJAWROAM"}, - {{A_JetJawChomp}, "A_JETJAWCHOMP"}, - {{A_PointyThink}, "A_POINTYTHINK"}, - {{A_CheckBuddy}, "A_CHECKBUDDY"}, - {{A_HoodThink}, "A_HOODTHINK"}, - {{A_ArrowCheck}, "A_ARROWCHECK"}, - {{A_SnailerThink}, "A_SNAILERTHINK"}, - {{A_SharpChase}, "A_SHARPCHASE"}, - {{A_SharpSpin}, "A_SHARPSPIN"}, - {{A_VultureVtol}, "A_VULTUREVTOL"}, - {{A_VultureCheck}, "A_VULTURECHECK"}, - {{A_SkimChase}, "A_SKIMCHASE"}, - {{A_1upThinker}, "A_1UPTHINKER"}, - {{A_SkullAttack}, "A_SKULLATTACK"}, - {{A_LobShot}, "A_LOBSHOT"}, - {{A_FireShot}, "A_FIRESHOT"}, - {{A_SuperFireShot}, "A_SUPERFIRESHOT"}, - {{A_BossFireShot}, "A_BOSSFIRESHOT"}, - {{A_Boss7FireMissiles}, "A_BOSS7FIREMISSILES"}, - {{A_Boss1Laser}, "A_BOSS1LASER"}, - {{A_Boss4Reverse}, "A_BOSS4REVERSE"}, - {{A_Boss4SpeedUp}, "A_BOSS4SPEEDUP"}, - {{A_Boss4Raise}, "A_BOSS4RAISE"}, - {{A_SparkFollow}, "A_SPARKFOLLOW"}, - {{A_BuzzFly}, "A_BUZZFLY"}, - {{A_GuardChase}, "A_GUARDCHASE"}, - {{A_EggShield}, "A_EGGSHIELD"}, - {{A_SetReactionTime}, "A_SETREACTIONTIME"}, - {{A_Boss1Spikeballs}, "A_BOSS1SPIKEBALLS"}, - {{A_Boss3TakeDamage}, "A_BOSS3TAKEDAMAGE"}, - {{A_Boss3Path}, "A_BOSS3PATH"}, - {{A_LinedefExecute}, "A_LINEDEFEXECUTE"}, - {{A_PlaySeeSound}, "A_PLAYSEESOUND"}, - {{A_PlayAttackSound}, "A_PLAYATTACKSOUND"}, - {{A_PlayActiveSound}, "A_PLAYACTIVESOUND"}, - {{A_SpawnObjectAbsolute}, "A_SPAWNOBJECTABSOLUTE"}, - {{A_SpawnObjectRelative}, "A_SPAWNOBJECTRELATIVE"}, - {{A_ChangeAngleRelative}, "A_CHANGEANGLERELATIVE"}, - {{A_ChangeAngleAbsolute}, "A_CHANGEANGLEABSOLUTE"}, - {{A_PlaySound}, "A_PLAYSOUND"}, - {{A_FindTarget}, "A_FINDTARGET"}, - {{A_FindTracer}, "A_FINDTRACER"}, - {{A_SetTics}, "A_SETTICS"}, - {{A_SetRandomTics}, "A_SETRANDOMTICS"}, - {{A_ChangeColorRelative}, "A_CHANGECOLORRELATIVE"}, - {{A_ChangeColorAbsolute}, "A_CHANGECOLORABSOLUTE"}, - {{A_MoveRelative}, "A_MOVERELATIVE"}, - {{A_MoveAbsolute}, "A_MOVEABSOLUTE"}, - {{A_Thrust}, "A_THRUST"}, - {{A_ZThrust}, "A_ZTHRUST"}, - {{A_SetTargetsTarget}, "A_SETTARGETSTARGET"}, - {{A_SetObjectFlags}, "A_SETOBJECTFLAGS"}, - {{A_SetObjectFlags2}, "A_SETOBJECTFLAGS2"}, - {{A_RandomState}, "A_RANDOMSTATE"}, - {{A_RandomStateRange}, "A_RANDOMSTATERANGE"}, - {{A_DualAction}, "A_DUALACTION"}, - {{A_RemoteAction}, "A_REMOTEACTION"}, - {{A_ToggleFlameJet}, "A_TOGGLEFLAMEJET"}, - {{A_OrbitNights}, "A_ORBITNIGHTS"}, - {{A_GhostMe}, "A_GHOSTME"}, - {{A_SetObjectState}, "A_SETOBJECTSTATE"}, - {{A_SetObjectTypeState}, "A_SETOBJECTTYPESTATE"}, - {{A_KnockBack}, "A_KNOCKBACK"}, - {{A_PushAway}, "A_PUSHAWAY"}, - {{A_RingDrain}, "A_RINGDRAIN"}, - {{A_SplitShot}, "A_SPLITSHOT"}, - {{A_MissileSplit}, "A_MISSILESPLIT"}, - {{A_MultiShot}, "A_MULTISHOT"}, - {{A_InstaLoop}, "A_INSTALOOP"}, - {{A_Custom3DRotate}, "A_CUSTOM3DROTATE"}, - {{A_SearchForPlayers}, "A_SEARCHFORPLAYERS"}, - {{A_CheckRandom}, "A_CHECKRANDOM"}, - {{A_CheckTargetRings}, "A_CHECKTARGETRINGS"}, - {{A_CheckRings}, "A_CHECKRINGS"}, - {{A_CheckTotalRings}, "A_CHECKTOTALRINGS"}, - {{A_CheckHealth}, "A_CHECKHEALTH"}, - {{A_CheckRange}, "A_CHECKRANGE"}, - {{A_CheckHeight}, "A_CHECKHEIGHT"}, - {{A_CheckTrueRange}, "A_CHECKTRUERANGE"}, - {{A_CheckThingCount}, "A_CHECKTHINGCOUNT"}, - {{A_CheckAmbush}, "A_CHECKAMBUSH"}, - {{A_CheckCustomValue}, "A_CHECKCUSTOMVALUE"}, - {{A_CheckCusValMemo}, "A_CHECKCUSVALMEMO"}, - {{A_SetCustomValue}, "A_SETCUSTOMVALUE"}, - {{A_UseCusValMemo}, "A_USECUSVALMEMO"}, - {{A_RelayCustomValue}, "A_RELAYCUSTOMVALUE"}, - {{A_CusValAction}, "A_CUSVALACTION"}, - {{A_ForceStop}, "A_FORCESTOP"}, - {{A_ForceWin}, "A_FORCEWIN"}, - {{A_SpikeRetract}, "A_SPIKERETRACT"}, - {{A_InfoState}, "A_INFOSTATE"}, - {{A_Repeat}, "A_REPEAT"}, - {{A_SetScale}, "A_SETSCALE"}, - {{A_RemoteDamage}, "A_REMOTEDAMAGE"}, - {{A_HomingChase}, "A_HOMINGCHASE"}, - {{A_TrapShot}, "A_TRAPSHOT"}, - {{A_VileTarget}, "A_VILETARGET"}, - {{A_VileAttack}, "A_VILEATTACK"}, - {{A_VileFire}, "A_VILEFIRE"}, - {{A_BrakChase}, "A_BRAKCHASE"}, - {{A_BrakFireShot}, "A_BRAKFIRESHOT"}, - {{A_BrakLobShot}, "A_BRAKLOBSHOT"}, - {{A_NapalmScatter}, "A_NAPALMSCATTER"}, - {{A_SpawnFreshCopy}, "A_SPAWNFRESHCOPY"}, - - {{NULL}, "NONE"}, + {{A_Explode}, "A_EXPLODE"}, + {{A_Pain}, "A_PAIN"}, + {{A_Fall}, "A_FALL"}, + {{A_MonitorPop}, "A_MONITORPOP"}, + {{A_GoldMonitorPop}, "A_GOLDMONITORPOP"}, + {{A_GoldMonitorRestore}, "A_GOLDMONITORRESTORE"}, + {{A_GoldMonitorSparkle}, "A_GOLDMONITORSPARKLE"}, + {{A_Look}, "A_LOOK"}, + {{A_Chase}, "A_CHASE"}, + {{A_FaceStabChase}, "A_FACESTABCHASE"}, + {{A_FaceStabRev}, "A_FACESTABREV"}, + {{A_FaceStabHurl}, "A_FACESTABHURL"}, + {{A_FaceStabMiss}, "A_FACESTABMISS"}, + {{A_StatueBurst}, "A_STATUEBURST"}, + {{A_FaceTarget}, "A_FACETARGET"}, + {{A_FaceTracer}, "A_FACETRACER"}, + {{A_Scream}, "A_SCREAM"}, + {{A_BossDeath}, "A_BOSSDEATH"}, + {{A_CustomPower}, "A_CUSTOMPOWER"}, + {{A_GiveWeapon}, "A_GIVEWEAPON"}, + {{A_RingBox}, "A_RINGBOX"}, + {{A_Invincibility}, "A_INVINCIBILITY"}, + {{A_SuperSneakers}, "A_SUPERSNEAKERS"}, + {{A_BunnyHop}, "A_BUNNYHOP"}, + {{A_BubbleSpawn}, "A_BUBBLESPAWN"}, + {{A_FanBubbleSpawn}, "A_FANBUBBLESPAWN"}, + {{A_BubbleRise}, "A_BUBBLERISE"}, + {{A_BubbleCheck}, "A_BUBBLECHECK"}, + {{A_AwardScore}, "A_AWARDSCORE"}, + {{A_ExtraLife}, "A_EXTRALIFE"}, + {{A_GiveShield}, "A_GIVESHIELD"}, + {{A_GravityBox}, "A_GRAVITYBOX"}, + {{A_ScoreRise}, "A_SCORERISE"}, + {{A_AttractChase}, "A_ATTRACTCHASE"}, + {{A_DropMine}, "A_DROPMINE"}, + {{A_FishJump}, "A_FISHJUMP"}, + {{A_ThrownRing}, "A_THROWNRING"}, + {{A_SetSolidSteam}, "A_SETSOLIDSTEAM"}, + {{A_UnsetSolidSteam}, "A_UNSETSOLIDSTEAM"}, + {{A_SignPlayer}, "A_SIGNPLAYER"}, + {{A_OverlayThink}, "A_OVERLAYTHINK"}, + {{A_JetChase}, "A_JETCHASE"}, + {{A_JetbThink}, "A_JETBTHINK"}, + {{A_JetgThink}, "A_JETGTHINK"}, + {{A_JetgShoot}, "A_JETGSHOOT"}, + {{A_ShootBullet}, "A_SHOOTBULLET"}, + {{A_MinusDigging}, "A_MINUSDIGGING"}, + {{A_MinusPopup}, "A_MINUSPOPUP"}, + {{A_MinusCheck}, "A_MINUSCHECK"}, + {{A_ChickenCheck}, "A_CHICKENCHECK"}, + {{A_MouseThink}, "A_MOUSETHINK"}, + {{A_DetonChase}, "A_DETONCHASE"}, + {{A_CapeChase}, "A_CAPECHASE"}, + {{A_RotateSpikeBall}, "A_ROTATESPIKEBALL"}, + {{A_SlingAppear}, "A_SLINGAPPEAR"}, + {{A_UnidusBall}, "A_UNIDUSBALL"}, + {{A_RockSpawn}, "A_ROCKSPAWN"}, + {{A_SetFuse}, "A_SETFUSE"}, + {{A_CrawlaCommanderThink}, "A_CRAWLACOMMANDERTHINK"}, + {{A_SmokeTrailer}, "A_SMOKETRAILER"}, + {{A_RingExplode}, "A_RINGEXPLODE"}, + {{A_OldRingExplode}, "A_OLDRINGEXPLODE"}, + {{A_MixUp}, "A_MIXUP"}, + {{A_RecyclePowers}, "A_RECYCLEPOWERS"}, + {{A_Boss1Chase}, "A_BOSS1CHASE"}, + {{A_FocusTarget}, "A_FOCUSTARGET"}, + {{A_Boss2Chase}, "A_BOSS2CHASE"}, + {{A_Boss2Pogo}, "A_BOSS2POGO"}, + {{A_BossZoom}, "A_BOSSZOOM"}, + {{A_BossScream}, "A_BOSSSCREAM"}, + {{A_Boss2TakeDamage}, "A_BOSS2TAKEDAMAGE"}, + {{A_Boss7Chase}, "A_BOSS7CHASE"}, + {{A_GoopSplat}, "A_GOOPSPLAT"}, + {{A_Boss2PogoSFX}, "A_BOSS2POGOSFX"}, + {{A_Boss2PogoTarget}, "A_BOSS2POGOTARGET"}, + {{A_BossJetFume}, "A_BOSSJETFUME"}, + {{A_EggmanBox}, "A_EGGMANBOX"}, + {{A_TurretFire}, "A_TURRETFIRE"}, + {{A_SuperTurretFire}, "A_SUPERTURRETFIRE"}, + {{A_TurretStop}, "A_TURRETSTOP"}, + {{A_JetJawRoam}, "A_JETJAWROAM"}, + {{A_JetJawChomp}, "A_JETJAWCHOMP"}, + {{A_PointyThink}, "A_POINTYTHINK"}, + {{A_CheckBuddy}, "A_CHECKBUDDY"}, + {{A_HoodFire}, "A_HOODFIRE"}, + {{A_HoodThink}, "A_HOODTHINK"}, + {{A_HoodFall}, "A_HOODFALL"}, + {{A_ArrowBonks}, "A_ARROWBONKS"}, + {{A_SnailerThink}, "A_SNAILERTHINK"}, + {{A_SharpChase}, "A_SHARPCHASE"}, + {{A_SharpSpin}, "A_SHARPSPIN"}, + {{A_SharpDecel}, "A_SHARPDECEL"}, + {{A_CrushstaceanWalk}, "A_CRUSHSTACEANWALK"}, + {{A_CrushstaceanPunch}, "A_CRUSHSTACEANPUNCH"}, + {{A_CrushclawAim}, "A_CRUSHCLAWAIM"}, + {{A_CrushclawLaunch}, "A_CRUSHCLAWLAUNCH"}, + {{A_VultureVtol}, "A_VULTUREVTOL"}, + {{A_VultureCheck}, "A_VULTURECHECK"}, + {{A_VultureHover}, "A_VULTUREHOVER"}, + {{A_VultureBlast}, "A_VULTUREBLAST"}, + {{A_VultureFly}, "A_VULTUREFLY"}, + {{A_SkimChase}, "A_SKIMCHASE"}, + {{A_1upThinker}, "A_1UPTHINKER"}, + {{A_SkullAttack}, "A_SKULLATTACK"}, + {{A_LobShot}, "A_LOBSHOT"}, + {{A_FireShot}, "A_FIRESHOT"}, + {{A_SuperFireShot}, "A_SUPERFIRESHOT"}, + {{A_BossFireShot}, "A_BOSSFIRESHOT"}, + {{A_Boss7FireMissiles}, "A_BOSS7FIREMISSILES"}, + {{A_Boss1Laser}, "A_BOSS1LASER"}, + {{A_Boss4Reverse}, "A_BOSS4REVERSE"}, + {{A_Boss4SpeedUp}, "A_BOSS4SPEEDUP"}, + {{A_Boss4Raise}, "A_BOSS4RAISE"}, + {{A_SparkFollow}, "A_SPARKFOLLOW"}, + {{A_BuzzFly}, "A_BUZZFLY"}, + {{A_GuardChase}, "A_GUARDCHASE"}, + {{A_EggShield}, "A_EGGSHIELD"}, + {{A_SetReactionTime}, "A_SETREACTIONTIME"}, + {{A_Boss1Spikeballs}, "A_BOSS1SPIKEBALLS"}, + {{A_Boss3TakeDamage}, "A_BOSS3TAKEDAMAGE"}, + {{A_Boss3Path}, "A_BOSS3PATH"}, + {{A_LinedefExecute}, "A_LINEDEFEXECUTE"}, + {{A_PlaySeeSound}, "A_PLAYSEESOUND"}, + {{A_PlayAttackSound}, "A_PLAYATTACKSOUND"}, + {{A_PlayActiveSound}, "A_PLAYACTIVESOUND"}, + {{A_SpawnObjectAbsolute}, "A_SPAWNOBJECTABSOLUTE"}, + {{A_SpawnObjectRelative}, "A_SPAWNOBJECTRELATIVE"}, + {{A_ChangeAngleRelative}, "A_CHANGEANGLERELATIVE"}, + {{A_ChangeAngleAbsolute}, "A_CHANGEANGLEABSOLUTE"}, + {{A_PlaySound}, "A_PLAYSOUND"}, + {{A_FindTarget}, "A_FINDTARGET"}, + {{A_FindTracer}, "A_FINDTRACER"}, + {{A_SetTics}, "A_SETTICS"}, + {{A_SetRandomTics}, "A_SETRANDOMTICS"}, + {{A_ChangeColorRelative}, "A_CHANGECOLORRELATIVE"}, + {{A_ChangeColorAbsolute}, "A_CHANGECOLORABSOLUTE"}, + {{A_MoveRelative}, "A_MOVERELATIVE"}, + {{A_MoveAbsolute}, "A_MOVEABSOLUTE"}, + {{A_Thrust}, "A_THRUST"}, + {{A_ZThrust}, "A_ZTHRUST"}, + {{A_SetTargetsTarget}, "A_SETTARGETSTARGET"}, + {{A_SetObjectFlags}, "A_SETOBJECTFLAGS"}, + {{A_SetObjectFlags2}, "A_SETOBJECTFLAGS2"}, + {{A_RandomState}, "A_RANDOMSTATE"}, + {{A_RandomStateRange}, "A_RANDOMSTATERANGE"}, + {{A_DualAction}, "A_DUALACTION"}, + {{A_RemoteAction}, "A_REMOTEACTION"}, + {{A_ToggleFlameJet}, "A_TOGGLEFLAMEJET"}, + {{A_OrbitNights}, "A_ORBITNIGHTS"}, + {{A_GhostMe}, "A_GHOSTME"}, + {{A_SetObjectState}, "A_SETOBJECTSTATE"}, + {{A_SetObjectTypeState}, "A_SETOBJECTTYPESTATE"}, + {{A_KnockBack}, "A_KNOCKBACK"}, + {{A_PushAway}, "A_PUSHAWAY"}, + {{A_RingDrain}, "A_RINGDRAIN"}, + {{A_SplitShot}, "A_SPLITSHOT"}, + {{A_MissileSplit}, "A_MISSILESPLIT"}, + {{A_MultiShot}, "A_MULTISHOT"}, + {{A_InstaLoop}, "A_INSTALOOP"}, + {{A_Custom3DRotate}, "A_CUSTOM3DROTATE"}, + {{A_SearchForPlayers}, "A_SEARCHFORPLAYERS"}, + {{A_CheckRandom}, "A_CHECKRANDOM"}, + {{A_CheckTargetRings}, "A_CHECKTARGETRINGS"}, + {{A_CheckRings}, "A_CHECKRINGS"}, + {{A_CheckTotalRings}, "A_CHECKTOTALRINGS"}, + {{A_CheckHealth}, "A_CHECKHEALTH"}, + {{A_CheckRange}, "A_CHECKRANGE"}, + {{A_CheckHeight}, "A_CHECKHEIGHT"}, + {{A_CheckTrueRange}, "A_CHECKTRUERANGE"}, + {{A_CheckThingCount}, "A_CHECKTHINGCOUNT"}, + {{A_CheckAmbush}, "A_CHECKAMBUSH"}, + {{A_CheckCustomValue}, "A_CHECKCUSTOMVALUE"}, + {{A_CheckCusValMemo}, "A_CHECKCUSVALMEMO"}, + {{A_SetCustomValue}, "A_SETCUSTOMVALUE"}, + {{A_UseCusValMemo}, "A_USECUSVALMEMO"}, + {{A_RelayCustomValue}, "A_RELAYCUSTOMVALUE"}, + {{A_CusValAction}, "A_CUSVALACTION"}, + {{A_ForceStop}, "A_FORCESTOP"}, + {{A_ForceWin}, "A_FORCEWIN"}, + {{A_SpikeRetract}, "A_SPIKERETRACT"}, + {{A_InfoState}, "A_INFOSTATE"}, + {{A_Repeat}, "A_REPEAT"}, + {{A_SetScale}, "A_SETSCALE"}, + {{A_RemoteDamage}, "A_REMOTEDAMAGE"}, + {{A_HomingChase}, "A_HOMINGCHASE"}, + {{A_TrapShot}, "A_TRAPSHOT"}, + {{A_VileTarget}, "A_VILETARGET"}, + {{A_VileAttack}, "A_VILEATTACK"}, + {{A_VileFire}, "A_VILEFIRE"}, + {{A_BrakChase}, "A_BRAKCHASE"}, + {{A_BrakFireShot}, "A_BRAKFIRESHOT"}, + {{A_BrakLobShot}, "A_BRAKLOBSHOT"}, + {{A_NapalmScatter}, "A_NAPALMSCATTER"}, + {{A_SpawnFreshCopy}, "A_SPAWNFRESHCOPY"}, + {{A_FlickySpawn}, "A_FLICKYSPAWN"}, + {{A_FlickyAim}, "A_FLICKYAIM"}, + {{A_FlickyFly}, "A_FLICKYFLY"}, + {{A_FlickySoar}, "A_FLICKYSOAR"}, + {{A_FlickyCoast}, "A_FLICKYCOAST"}, + {{A_FlickyHop}, "A_FLICKYHOP"}, + {{A_FlickyFlounder}, "A_FLICKYFLOUNDER"}, + {{A_FlickyCheck}, "A_FLICKYCHECK"}, + {{A_FlickyHeightCheck}, "A_FLICKYHEIGHTCHECK"}, + {{A_FlickyFlutter}, "A_FLICKYFLUTTER"}, + {{A_FlameParticle}, "A_FLAMEPARTICLE"}, + {{A_FadeOverlay}, "A_FADEOVERLAY"}, + {{A_Boss5Jump}, "A_BOSS5JUMP"}, + {{A_LightBeamReset}, "A_LIGHTBEAMRESET"}, + {{A_MineExplode}, "A_MINEEXPLODE"}, + {{A_MineRange}, "A_MINERANGE"}, + {{A_ConnectToGround}, "A_CONNECTTOGROUND"}, + {{A_SpawnParticleRelative}, "A_SPAWNPARTICLERELATIVE"}, + {{A_MultiShotDist}, "A_MULTISHOTDIST"}, + {{A_WhoCaresIfYourSonIsABee},"A_WHOCARESIFYOURSONISABEE"}, + {{A_ParentTriesToSleep}, "A_PARENTTRIESTOSLEEP"}, + {{A_CryingToMomma}, "A_CRYINGTOMOMMA"}, + {{A_CheckFlags2}, "A_CHECKFLAGS2"}, + {{A_Boss5FindWaypoint}, "A_BOSS5FINDWAYPOINT"}, + {{A_DoNPCSkid}, "A_DONPCSKID"}, + {{A_DoNPCPain}, "A_DONPCPAIN"}, + {{A_PrepareRepeat}, "A_PREPAREREPEAT"}, + {{A_Boss5ExtraRepeat}, "A_BOSS5EXTRAREPEAT"}, + {{A_Boss5Calm}, "A_BOSS5CALM"}, + {{A_Boss5CheckOnGround}, "A_BOSS5CHECKONGROUND"}, + {{A_Boss5CheckFalling}, "A_BOSS5CHECKFALLING"}, + {{A_Boss5PinchShot}, "A_BOSS5PINCHSHOT"}, + {{A_Boss5MakeItRain}, "A_BOSS5MAKEITRAIN"}, + {{A_LookForBetter}, "A_LOOKFORBETTER"}, + {{A_Boss5BombExplode}, "A_BOSS5BOMBEXPLODE"}, + {{A_DustDevilThink}, "A_DUSTDEVILTHINK"}, + {{A_TNTExplode}, "A_TNTEXPLODE"}, + {{A_DebrisRandom}, "A_DEBRISRANDOM"}, + {{A_TrainCameo}, "A_TRAINCAMEO"}, + {{A_TrainCameo2}, "A_TRAINCAMEO2"}, + {{A_CanarivoreGas}, "A_CANARIVOREGAS"}, + {{A_KillSegments}, "A_KILLSEGMENTS"}, + {{A_SnapperSpawn}, "A_SNAPPERSPAWN"}, + {{A_SnapperThinker}, "A_SNAPPERTHINKER"}, + {{A_SaloonDoorSpawn}, "A_SALOONDOORSPAWN"}, + {{A_MinecartSparkThink}, "A_MINECARTSPARKTHINK"}, + {{NULL}, "NONE"}, // This NULL entry must be the last in the list {{NULL}, NULL}, @@ -1921,39 +2459,33 @@ static void readframe(MYFILE *f, INT32 num) if (fastcmp(word1, "SPRITENUMBER") || fastcmp(word1, "SPRITENAME")) { - DEH_WriteUndoline(word1, va("%u", states[num].sprite), UNDO_NONE); states[num].sprite = get_sprite(word2); } else if (fastcmp(word1, "SPRITESUBNUMBER") || fastcmp(word1, "SPRITEFRAME")) { - DEH_WriteUndoline(word1, va("%d", states[num].frame), UNDO_NONE); states[num].frame = (INT32)get_number(word2); // So the FF_ flags get calculated } else if (fastcmp(word1, "DURATION")) { - DEH_WriteUndoline(word1, va("%u", states[num].tics), UNDO_NONE); states[num].tics = (INT32)get_number(word2); // So TICRATE can be used } else if (fastcmp(word1, "NEXT")) { - DEH_WriteUndoline(word1, va("%d", states[num].nextstate), UNDO_NONE); states[num].nextstate = get_state(word2); } else if (fastcmp(word1, "VAR1")) { - DEH_WriteUndoline(word1, va("%d", states[num].var1), UNDO_NONE); states[num].var1 = (INT32)get_number(word2); } else if (fastcmp(word1, "VAR2")) { - DEH_WriteUndoline(word1, va("%d", states[num].var2), UNDO_NONE); states[num].var2 = (INT32)get_number(word2); } else if (fastcmp(word1, "ACTION")) { size_t z; boolean found = false; - XBOXSTATIC char actiontocompare[32]; + char actiontocompare[32]; memset(actiontocompare, 0x00, sizeof(actiontocompare)); strlcpy(actiontocompare, word2, sizeof (actiontocompare)); @@ -1971,10 +2503,7 @@ static void readframe(MYFILE *f, INT32 num) for (z = 0; actionpointers[z].name; z++) { if (actionpointers[z].action.acv == states[num].action.acv) - { - DEH_WriteUndoline(word1, actionpointers[z].name, UNDO_NONE); break; - } } z = 0; @@ -2006,10 +2535,11 @@ static void readframe(MYFILE *f, INT32 num) Z_Free(s); } -static void readsound(MYFILE *f, INT32 num, const char *savesfxnames[]) +static void readsound(MYFILE *f, INT32 num) { char *s = Z_Malloc(MAXLINELEN, PU_STATIC, NULL); char *word; + char *word2; char *tmp; INT32 value; @@ -2023,8 +2553,8 @@ static void readsound(MYFILE *f, INT32 num, const char *savesfxnames[]) tmp = strchr(s, '#'); if (tmp) *tmp = '\0'; - - value = searchvalue(s); + if (s == tmp) + continue; // Skip comment lines, but don't break. word = strtok(s, " "); if (word) @@ -2032,43 +2562,38 @@ static void readsound(MYFILE *f, INT32 num, const char *savesfxnames[]) else break; -/* if (fastcmp(word, "OFFSET")) + word2 = strtok(NULL, " "); + if (word2) + value = atoi(word2); + else { - value -= 150360; - if (value <= 64) - value /= 8; - else if (value <= 260) - value = (value+4)/8; - else - value = (value+8)/8; - if (value >= -1 && value < sfx_freeslot0 - 1) - S_sfx[num].name = savesfxnames[value+1]; - else - deh_warning("Sound %d: offset out of bounds", num); + deh_warning("No value for token %s", word); + continue; } - else */if (fastcmp(word, "SINGULAR")) + + if (fastcmp(word, "SINGULAR")) { - DEH_WriteUndoline(word, va("%d", S_sfx[num].singularity), UNDO_NONE); S_sfx[num].singularity = value; } else if (fastcmp(word, "PRIORITY")) { - DEH_WriteUndoline(word, va("%d", S_sfx[num].priority), UNDO_NONE); S_sfx[num].priority = value; } else if (fastcmp(word, "FLAGS")) { - DEH_WriteUndoline(word, va("%d", S_sfx[num].pitch), UNDO_NONE); S_sfx[num].pitch = value; } + else if (fastcmp(word, "CAPTION") || fastcmp(word, "DESCRIPTION")) + { + deh_strlcpy(S_sfx[num].caption, word2, + sizeof(S_sfx[num].caption), va("Sound effect %d: caption", num)); + } else deh_warning("Sound %d : unknown word '%s'",num,word); } } while (!myfeof(f)); Z_Free(s); - - (void)savesfxnames; } /** Checks if a game data file name for a mod is good. @@ -2099,11 +2624,7 @@ static boolean GoodDataFileName(const char *s) p = s + strlen(s) - strlen(tail); if (p <= s) return false; // too short if (!fasticmp(p, tail)) return false; // doesn't end in .dat -#ifdef DELFILE - if (fasticmp(s, "gamedata.dat") && !disableundo) return false; -#else if (fasticmp(s, "gamedata.dat")) return false; -#endif return true; } @@ -2116,17 +2637,6 @@ static void reademblemdata(MYFILE *f, INT32 num) char *tmp; INT32 value; - // Reset all data initially - DEH_WriteUndoline("TYPE", va("%d", emblemlocations[num-1].type), UNDO_NONE); - DEH_WriteUndoline("X", va("%d", emblemlocations[num-1].x), UNDO_NONE); - DEH_WriteUndoline("Y", va("%d", emblemlocations[num-1].y), UNDO_NONE); - DEH_WriteUndoline("Z", va("%d", emblemlocations[num-1].z), UNDO_NONE); - DEH_WriteUndoline("MAPNUM", va("%d", emblemlocations[num-1].level), UNDO_NONE); - DEH_WriteUndoline("VAR", va("%d", emblemlocations[num-1].var), UNDO_NONE); - DEH_WriteUndoline("SPRITE", va("%d", emblemlocations[num-1].sprite), UNDO_NONE); - DEH_WriteUndoline("COLOR", va("%d", emblemlocations[num-1].color), UNDO_NONE); - DEH_WriteUndoline("HINT", extraemblems[num-1].hint, UNDO_NONE); - memset(&emblemlocations[num-1], 0, sizeof(emblem_t)); do @@ -2181,6 +2691,8 @@ static void reademblemdata(MYFILE *f, INT32 num) emblemlocations[num-1].type = ET_TIME; else if (fastcmp(word2, "RINGS")) emblemlocations[num-1].type = ET_RINGS; + else if (fastcmp(word2, "MAP")) + emblemlocations[num-1].type = ET_MAP; else if (fastcmp(word2, "NGRADE")) emblemlocations[num-1].type = ET_NGRADE; else if (fastcmp(word2, "NTIME")) @@ -2188,12 +2700,8 @@ static void reademblemdata(MYFILE *f, INT32 num) else emblemlocations[num-1].type = (UINT8)value; } - else if (fastcmp(word, "X")) - emblemlocations[num-1].x = (INT16)value; - else if (fastcmp(word, "Y")) - emblemlocations[num-1].y = (INT16)value; - else if (fastcmp(word, "Z")) - emblemlocations[num-1].z = (INT16)value; + else if (fastcmp(word, "TAG")) + emblemlocations[num-1].tag = (INT16)value; else if (fastcmp(word, "MAPNUM")) { // Support using the actual map name, @@ -2263,13 +2771,6 @@ static void readextraemblemdata(MYFILE *f, INT32 num) char *tmp; INT32 value; - // Reset all data initially - DEH_WriteUndoline("NAME", extraemblems[num-1].name, UNDO_NONE); - DEH_WriteUndoline("OBJECTIVE", extraemblems[num-1].description, UNDO_NONE); - DEH_WriteUndoline("CONDITIONSET", va("%d", extraemblems[num-1].conditionset), UNDO_NONE); - DEH_WriteUndoline("SPRITE", va("%d", extraemblems[num-1].sprite), UNDO_NONE); - DEH_WriteUndoline("COLOR", va("%d", extraemblems[num-1].color), UNDO_NONE); - memset(&extraemblems[num-1], 0, sizeof(extraemblem_t)); do @@ -2347,17 +2848,8 @@ static void readunlockable(MYFILE *f, INT32 num) char *tmp; INT32 i; - // Same deal with unlockables, clear all first - DEH_WriteUndoline("NAME", unlockables[num].name, UNDO_NONE); - DEH_WriteUndoline("OBJECTIVE", unlockables[num].objective, UNDO_NONE); - DEH_WriteUndoline("HEIGHT", va("%d", unlockables[num].height), UNDO_NONE); - DEH_WriteUndoline("CONDITIONSET", va("%d", unlockables[num].conditionset), UNDO_NONE); - DEH_WriteUndoline("TYPE", va("%d", unlockables[num].type), UNDO_NONE); - DEH_WriteUndoline("NOCECHO", va("%d", unlockables[num].nocecho), UNDO_NONE); - DEH_WriteUndoline("NOCHECKLIST", va("%d", unlockables[num].nochecklist), UNDO_NONE); - DEH_WriteUndoline("VAR", va("%d", unlockables[num].variable), UNDO_NONE); - memset(&unlockables[num], 0, sizeof(unlockable_t)); + unlockables[num].objective[0] = '/'; do { @@ -2705,190 +3197,6 @@ static void readconditionset(MYFILE *f, UINT8 setnum) Z_Free(s); } -static void readtexture(MYFILE *f, const char *name) -{ - char *s = Z_Malloc(MAXLINELEN, PU_STATIC, NULL); - char *word; - char *word2; - char *tmp; - INT32 i, j, value; - UINT16 width = 0, height = 0; - INT16 patchcount = 0; - texture_t *texture; - - do - { - if (myfgets(s, MAXLINELEN, f)) - { - if (s[0] == '\n') - break; - - tmp = strchr(s, '#'); - if (tmp) - *tmp = '\0'; - - value = searchvalue(s); - word = strtok(s, " "); - if (word) - strupr(word); - else - break; - - word2 = strtok(NULL, " "); - if (word2) - strupr(word2); - else - break; - - // Width of the texture. - if (fastcmp(word, "WIDTH")) - { - DEH_WriteUndoline(word, va("%d", width), UNDO_NONE); - width = SHORT((UINT16)value); - } - // Height of the texture. - else if (fastcmp(word, "HEIGHT")) - { - DEH_WriteUndoline(word, va("%d", height), UNDO_NONE); - height = SHORT((UINT16)value); - } - // Number of patches the texture has. - else if (fastcmp(word, "NUMPATCHES")) - { - DEH_WriteUndoline(word, va("%d", patchcount), UNDO_NONE); - patchcount = SHORT((UINT16)value); - } - else - deh_warning("readtexture: unknown word '%s'", word); - } - } while (!myfeof(f)); - - // Error checking. - if (!width) - I_Error("Texture %s has no width!\n", name); - - if (!height) - I_Error("Texture %s has no height!\n", name); - - if (!patchcount) - I_Error("Texture %s has no patches!\n", name); - - // Allocate memory for the texture, and fill in information. - texture = Z_Calloc(sizeof(texture_t) + (sizeof(texpatch_t) * SHORT(patchcount)), PU_STATIC, NULL); - M_Memcpy(texture->name, name, sizeof(texture->name)); - texture->width = width; - texture->height = height; - texture->patchcount = patchcount; - texture->holes = false; - // Fill out the texture patches, to allow them to be detected - // accurately by readpatch. - for (i = 0; i < patchcount; i++) - { - texture->patches[i].originx = 0; - texture->patches[i].originy = 0; - texture->patches[i].wad = UINT16_MAX; - texture->patches[i].lump = UINT16_MAX; - } - - // Jump to the next empty texture entry. - i = 0; - while (textures[i]) - i++; - - // Fill the global texture buffer entries. - j = 1; - while (j << 1 <= texture->width) - j <<= 1; - - textures[i] = texture; - texturewidthmask[i] = j - 1; - textureheight[i] = texture->height << FRACBITS; - - // Clean up. - Z_Free(s); -} - -static void readpatch(MYFILE *f, const char *name, UINT16 wad) -{ - char *s = Z_Malloc(MAXLINELEN, PU_STATIC, NULL); - char *word; - char *word2; - char *tmp; - INT32 i = 0, j = 0, value; - texpatch_t patch = {0, 0, UINT16_MAX, UINT16_MAX}; - - // Jump to the texture this patch belongs to, which, - // coincidentally, is always the last one on the buffer cache. - while (textures[i+1]) - i++; - - // Jump to the next empty patch entry. - while (memcmp(&(textures[i]->patches[j]), &patch, sizeof(patch))) - j++; - - patch.wad = wad; - // Set the texture number, but only if the lump exists. - if ((patch.lump = W_CheckNumForNamePwad(name, wad, 0)) == INT16_MAX) - I_Error("readpatch: Missing patch in texture %s", textures[i]->name); - - // note: undoing this patch will be done by other means - do - { - if (myfgets(s, MAXLINELEN, f)) - { - if (s[0] == '\n') - break; - - tmp = strchr(s, '#'); - if (tmp) - *tmp = '\0'; - - value = searchvalue(s); - word = strtok(s, " "); - if (word) - strupr(word); - else - break; - - word2 = strtok(NULL, " "); - if (word2) - strupr(word2); - else - break; - - // X position of the patch in the texture. - if (fastcmp(word, "X")) - { - //DEH_WriteUndoline(word, va("%d", patch->originx), UNDO_NONE); - patch.originx = (INT16)value; - } - // Y position of the patch in the texture. - else if (fastcmp(word, "Y")) - { - //DEH_WriteUndoline(word, va("%d", patch->originy), UNDO_NONE); - patch.originy = (INT16)value; - } - else - deh_warning("readpatch: unknown word '%s'", word); - } - } while (!myfeof(f)); - - // Error checking. - /* // Irrelevant. Origins cannot be unsigned. - if (patch.originx == UINT16_MAX) - I_Error("Patch %s on texture %s has no X position!\n", name, textures[i]->name); - - if (patch.originy == UINT16_MAX) - I_Error("Patch %s on texture %s has no Y position!\n", name, textures[i]->name); -*/ - - // Set the patch as that patch number. - textures[i]->patches[j] = patch; - - // Clean up. - Z_Free(s); -} - static void readmaincfg(MYFILE *f) { char *s = Z_Malloc(MAXLINELEN, PU_STATIC, NULL); @@ -2943,7 +3251,6 @@ static void readmaincfg(MYFILE *f) else value = get_number(word2); - DEH_WriteUndoline(word, va("%d", spstage_start), UNDO_NONE); spstage_start = (INT16)value; } else if (fastcmp(word, "SSTAGE_START")) @@ -2957,97 +3264,119 @@ static void readmaincfg(MYFILE *f) else value = get_number(word2); - DEH_WriteUndoline(word, va("%d", sstage_start), UNDO_NONE); sstage_start = (INT16)value; - sstage_end = (INT16)(sstage_start+6); // 7 special stages total + sstage_end = (INT16)(sstage_start+7); // 7 special stages total plus one weirdo } - else if (fastcmp(word, "USENIGHTSSS")) + else if (fastcmp(word, "SMPSTAGE_START")) { - DEH_WriteUndoline(word, va("%d", useNightsSS), UNDO_NONE); - useNightsSS = (value || word2[0] == 'T' || word2[0] == 'Y'); + // Support using the actual map name, + // i.e., Level AB, Level FZ, etc. + + // Convert to map number + if (word2[0] >= 'A' && word2[0] <= 'Z') + value = M_MapNumber(word2[0], word2[1]); + else + value = get_number(word2); + + smpstage_start = (INT16)value; + smpstage_end = (INT16)(smpstage_start+6); // 7 special stages total } else if (fastcmp(word, "REDTEAM")) { - DEH_WriteUndoline(word, va("%d", skincolor_redteam), UNDO_NONE); skincolor_redteam = (UINT8)get_number(word2); } else if (fastcmp(word, "BLUETEAM")) { - DEH_WriteUndoline(word, va("%d", skincolor_blueteam), UNDO_NONE); skincolor_blueteam = (UINT8)get_number(word2); } else if (fastcmp(word, "REDRING")) { - DEH_WriteUndoline(word, va("%d", skincolor_redring), UNDO_NONE); skincolor_redring = (UINT8)get_number(word2); } else if (fastcmp(word, "BLUERING")) { - DEH_WriteUndoline(word, va("%d", skincolor_bluering), UNDO_NONE); skincolor_bluering = (UINT8)get_number(word2); } else if (fastcmp(word, "INVULNTICS")) { - DEH_WriteUndoline(word, va("%u", invulntics), UNDO_NONE); invulntics = (UINT16)get_number(word2); } else if (fastcmp(word, "SNEAKERTICS")) { - DEH_WriteUndoline(word, va("%u", sneakertics), UNDO_NONE); sneakertics = (UINT16)get_number(word2); } else if (fastcmp(word, "FLASHINGTICS")) { - DEH_WriteUndoline(word, va("%u", flashingtics), UNDO_NONE); flashingtics = (UINT16)get_number(word2); } else if (fastcmp(word, "TAILSFLYTICS")) { - DEH_WriteUndoline(word, va("%u", tailsflytics), UNDO_NONE); tailsflytics = (UINT16)get_number(word2); } else if (fastcmp(word, "UNDERWATERTICS")) { - DEH_WriteUndoline(word, va("%u", underwatertics), UNDO_NONE); underwatertics = (UINT16)get_number(word2); } else if (fastcmp(word, "SPACETIMETICS")) { - DEH_WriteUndoline(word, va("%u", spacetimetics), UNDO_NONE); spacetimetics = (UINT16)get_number(word2); } else if (fastcmp(word, "EXTRALIFETICS")) { - DEH_WriteUndoline(word, va("%u", extralifetics), UNDO_NONE); extralifetics = (UINT16)get_number(word2); } + else if (fastcmp(word, "NIGHTSLINKTICS")) + { + nightslinktics = (UINT16)get_number(word2); + } else if (fastcmp(word, "GAMEOVERTICS")) { - DEH_WriteUndoline(word, va("%u", gameovertics), UNDO_NONE); gameovertics = get_number(word2); } - else if (fastcmp(word, "INTROTOPLAY")) { - DEH_WriteUndoline(word, va("%d", introtoplay), UNDO_NONE); introtoplay = (UINT8)get_number(word2); // range check, you morons. if (introtoplay > 128) introtoplay = 128; + introchanged = true; } else if (fastcmp(word, "LOOPTITLE")) { - DEH_WriteUndoline(word, va("%d", looptitle), UNDO_NONE); looptitle = (value || word2[0] == 'T' || word2[0] == 'Y'); + titlechanged = true; } - else if (fastcmp(word, "TITLESCROLLSPEED")) + else if (fastcmp(word, "TITLEMAP")) { - DEH_WriteUndoline(word, va("%d", titlescrollspeed), UNDO_NONE); - titlescrollspeed = get_number(word2); + // Support using the actual map name, + // i.e., Level AB, Level FZ, etc. + + // Convert to map number + if (word2[0] >= 'A' && word2[0] <= 'Z') + value = M_MapNumber(word2[0], word2[1]); + else + value = get_number(word2); + + titlemap = (INT16)value; + titlechanged = true; + } + else if (fastcmp(word, "HIDETITLEPICS")) + { + hidetitlepics = (boolean)(value || word2[0] == 'T' || word2[0] == 'Y'); + titlechanged = true; + } + else if (fastcmp(word, "TITLESCROLLSPEED") || fastcmp(word, "TITLESCROLLXSPEED")) + { + titlescrollxspeed = get_number(word2); + titlechanged = true; + } + else if (fastcmp(word, "TITLESCROLLYSPEED")) + { + titlescrollyspeed = get_number(word2); + titlechanged = true; } else if (fastcmp(word, "CREDITSCUTSCENE")) { - DEH_WriteUndoline(word, va("%d", creditscutscene), UNDO_NONE); creditscutscene = (UINT8)get_number(word2); // range check, you morons. if (creditscutscene > 128) @@ -3055,32 +3384,29 @@ static void readmaincfg(MYFILE *f) } else if (fastcmp(word, "DISABLESPEEDADJUST")) { - DEH_WriteUndoline(word, va("%d", disableSpeedAdjust), UNDO_NONE); disableSpeedAdjust = (value || word2[0] == 'T' || word2[0] == 'Y'); } else if (fastcmp(word, "NUMDEMOS")) { - DEH_WriteUndoline(word, va("%d", numDemos), UNDO_NONE); numDemos = (UINT8)get_number(word2); + titlechanged = true; } else if (fastcmp(word, "DEMODELAYTIME")) { - DEH_WriteUndoline(word, va("%d", demoDelayTime), UNDO_NONE); demoDelayTime = get_number(word2); + titlechanged = true; } else if (fastcmp(word, "DEMOIDLETIME")) { - DEH_WriteUndoline(word, va("%d", demoIdleTime), UNDO_NONE); demoIdleTime = get_number(word2); + titlechanged = true; } else if (fastcmp(word, "USE1UPSOUND")) { - DEH_WriteUndoline(word, va("%u", use1upSound), UNDO_NONE); use1upSound = (UINT8)(value || word2[0] == 'T' || word2[0] == 'Y'); } else if (fastcmp(word, "MAXXTRALIFE")) { - DEH_WriteUndoline(word, va("%u", maxXtraLife), UNDO_NONE); maxXtraLife = (UINT8)get_number(word2); } @@ -3094,7 +3420,6 @@ static void readmaincfg(MYFILE *f) I_Error("Maincfg: bad data file name '%s'\n", word2); G_SaveGameData(); - DEH_WriteUndoline(word, gamedatafilename, UNDO_NONE); strlcpy(gamedatafilename, word2, sizeof (gamedatafilename)); strlwr(gamedatafilename); savemoddata = true; @@ -3110,16 +3435,49 @@ static void readmaincfg(MYFILE *f) strcatbf(savegamename, srb2home, PATHSEP); gamedataadded = true; + titlechanged = true; } else if (fastcmp(word, "RESETDATA")) { - DEH_WriteUndoline(word, "0", UNDO_TODO); /// \todo P_ResetData(value); + titlechanged = true; } else if (fastcmp(word, "CUSTOMVERSION")) { - DEH_WriteUndoline(word, customversionstring, UNDO_NONE); strlcpy(customversionstring, word2, sizeof (customversionstring)); + //titlechanged = true; + } + else if (fastcmp(word, "BOOTMAP")) + { + // Support using the actual map name, + // i.e., Level AB, Level FZ, etc. + + // Convert to map number + if (word2[0] >= 'A' && word2[0] <= 'Z') + value = M_MapNumber(word2[0], word2[1]); + else + value = get_number(word2); + + bootmap = (INT16)value; + //titlechanged = true; + } + else if (fastcmp(word, "STARTCHAR")) + { + startchar = (INT16)value; + char_on = -1; + } + else if (fastcmp(word, "TUTORIALMAP")) + { + // Support using the actual map name, + // i.e., Level AB, Level FZ, etc. + + // Convert to map number + if (word2[0] >= 'A' && word2[0] <= 'Z') + value = M_MapNumber(word2[0], word2[1]); + else + value = get_number(word2); + + tutorialmap = (INT16)value; } else deh_warning("Maincfg: unknown word '%s'", word); @@ -3307,38 +3665,25 @@ static void ignorelines(MYFILE *f) Z_Free(s); } -static void DEH_LoadDehackedFile(MYFILE *f, UINT16 wad) +static void DEH_LoadDehackedFile(MYFILE *f, boolean mainfile) { char *s = Z_Malloc(MAXLINELEN, PU_STATIC, NULL); char *word; char *word2; INT32 i; - // do a copy of this for cross references probleme - //XBOXSTATIC actionf_t saveactions[NUMSTATES]; - //XBOXSTATIC const char *savesprnames[NUMSPRITES]; - XBOXSTATIC const char *savesfxnames[NUMSFX]; if (!deh_loaded) initfreeslots(); deh_num_warning = 0; - // save values for cross reference - /* - for (i = 0; i < NUMSTATES; i++) - saveactions[i] = states[i].action; - for (i = 0; i < NUMSPRITES; i++) - savesprnames[i] = sprnames[i]; - */ - for (i = 0; i < NUMSFX; i++) - savesfxnames[i] = S_sfx[i].name; - gamedataadded = false; + gamedataadded = titlechanged = introchanged = false; // it doesn't test the version of SRB2 and version of dehacked file dbg_line = -1; // start at -1 so the first line is 0. while (!myfeof(f)) { - XBOXSTATIC char origpos[128]; + char origpos[128]; INT32 size = 0; char *traverse; @@ -3372,25 +3717,24 @@ static void DEH_LoadDehackedFile(MYFILE *f, UINT16 wad) else if (fastcmp(word, "MAINCFG")) { readmaincfg(f); - DEH_WriteUndoline(word, "", UNDO_HEADER); continue; } else if (fastcmp(word, "WIPES")) { readwipes(f); - DEH_WriteUndoline(word, "", UNDO_HEADER); continue; } word2 = strtok(NULL, " "); + if (word2) { + strupr(word2); + if (word2[strlen(word2) - 1] == '\n') + word2[strlen(word2) - 1] = '\0'; + i = atoi(word2); + } + else + i = 0; if (fastcmp(word, "CHARACTER")) { - if (word2) { - strupr(word2); - if (word2[strlen(word2)-1] == '\n') - word2[strlen(word2)-1] = '\0'; - i = atoi(word2); - } else - i = 0; if (i >= 0 && i < 32) readPlayer(f, i); else @@ -3398,47 +3742,89 @@ static void DEH_LoadDehackedFile(MYFILE *f, UINT16 wad) deh_warning("Character %d out of range (0 - 31)", i); ignorelines(f); } - DEH_WriteUndoline(word, word2, UNDO_HEADER); + continue; + } + else if (fastcmp(word, "EMBLEM")) + { + if (!mainfile && !gamedataadded) + { + deh_warning("You must define a custom gamedata to use \"%s\"", word); + ignorelines(f); + } + else + { + if (!word2) + i = numemblems + 1; + + if (i > 0 && i <= MAXEMBLEMS) + { + if (numemblems < i) + numemblems = i; + reademblemdata(f, i); + } + else + { + deh_warning("Emblem number %d out of range (1 - %d)", i, MAXEMBLEMS); + ignorelines(f); + } + } + continue; + } + else if (fastcmp(word, "EXTRAEMBLEM")) + { + if (!mainfile && !gamedataadded) + { + deh_warning("You must define a custom gamedata to use \"%s\"", word); + ignorelines(f); + } + else + { + if (!word2) + i = numextraemblems + 1; + + if (i > 0 && i <= MAXEXTRAEMBLEMS) + { + if (numextraemblems < i) + numextraemblems = i; + readextraemblemdata(f, i); + } + else + { + deh_warning("Extra emblem number %d out of range (1 - %d)", i, MAXEXTRAEMBLEMS); + ignorelines(f); + } + } continue; } if (word2) { - strupr(word2); - if (word2[strlen(word2)-1] == '\n') - word2[strlen(word2)-1] = '\0'; - i = atoi(word2); - if (fastcmp(word, "TEXTURE")) - { - // Read texture from spec file. - readtexture(f, word2); - DEH_WriteUndoline(word, word2, UNDO_HEADER); - } - else if (fastcmp(word, "PATCH")) - { - // Read patch from spec file. - readpatch(f, word2, wad); - DEH_WriteUndoline(word, word2, UNDO_HEADER); - } - else if (fastcmp(word, "THING") || fastcmp(word, "MOBJ") || fastcmp(word, "OBJECT")) + if (fastcmp(word, "THING") || fastcmp(word, "MOBJ") || fastcmp(word, "OBJECT")) { if (i == 0 && word2[0] != '0') // If word2 isn't a number i = get_mobjtype(word2); // find a thing by name - if (i < NUMMOBJTYPES && i >= 0) + if (i < NUMMOBJTYPES && i > 0) readthing(f, i); else { - deh_warning("Thing %d out of range (0 - %d)", i, NUMMOBJTYPES-1); + deh_warning("Thing %d out of range (1 - %d)", i, NUMMOBJTYPES-1); ignorelines(f); } - DEH_WriteUndoline(word, word2, UNDO_HEADER); } -/* else if (fastcmp(word, "ANIMTEX")) + else if (fastcmp(word, "SPRITE2")) { - readAnimTex(f, i); - }*/ + if (i == 0 && word2[0] != '0') // If word2 isn't a number + i = get_sprite2(word2); // find a sprite by name + if (i < (INT32)free_spr2 && i >= (INT32)SPR2_FIRSTFREESLOT) + readsprite2(f, i); + else + { + deh_warning("Sprite2 number %d out of range (%d - %d)", i, SPR2_FIRSTFREESLOT, free_spr2-1); + ignorelines(f); + } + } +#ifdef HWRENDER else if (fastcmp(word, "LIGHT")) { -#ifdef HWRENDER // TODO: Read lights by name if (i > 0 && i < NUMLIGHTS) readlight(f, i); @@ -3447,24 +3833,20 @@ static void DEH_LoadDehackedFile(MYFILE *f, UINT16 wad) deh_warning("Light number %d out of range (1 - %d)", i, NUMLIGHTS-1); ignorelines(f); } - DEH_WriteUndoline(word, word2, UNDO_HEADER); -#endif } else if (fastcmp(word, "SPRITE")) { -#ifdef HWRENDER if (i == 0 && word2[0] != '0') // If word2 isn't a number i = get_sprite(word2); // find a sprite by name - if (i < NUMSPRITES && i >= 0) + if (i < NUMSPRITES && i > 0) readspritelight(f, i); else { deh_warning("Sprite number %d out of range (0 - %d)", i, NUMSPRITES-1); ignorelines(f); } - DEH_WriteUndoline(word, word2, UNDO_HEADER); -#endif } +#endif else if (fastcmp(word, "LEVEL")) { // Support using the actual map name, @@ -3481,7 +3863,6 @@ static void DEH_LoadDehackedFile(MYFILE *f, UINT16 wad) deh_warning("Level number %d out of range (1 - %d)", i, NUMMAPS); ignorelines(f); } - DEH_WriteUndoline(word, word2, UNDO_HEADER); } else if (fastcmp(word, "CUTSCENE")) { @@ -3492,7 +3873,16 @@ static void DEH_LoadDehackedFile(MYFILE *f, UINT16 wad) deh_warning("Cutscene number %d out of range (1 - 128)", i); ignorelines(f); } - DEH_WriteUndoline(word, word2, UNDO_HEADER); + } + else if (fastcmp(word, "PROMPT")) + { + if (i > 0 && i < MAX_PROMPTS) + readtextprompt(f, i - 1); + else + { + deh_warning("Prompt number %d out of range (1 - %d)", i, MAX_PROMPTS); + ignorelines(f); + } } else if (fastcmp(word, "FRAME") || fastcmp(word, "STATE")) { @@ -3505,63 +3895,19 @@ static void DEH_LoadDehackedFile(MYFILE *f, UINT16 wad) deh_warning("Frame %d out of range (0 - %d)", i, NUMSTATES-1); ignorelines(f); } - DEH_WriteUndoline(word, word2, UNDO_HEADER); } - // Added translations to this just in case its re-enabled -/* else if (fastcmp(word, "POINTER")) - { - word = strtok(NULL, " "); // get frame - word = strtok(NULL, ")"); - if (word) - { - i = atoi(word); - if (i < NUMSTATES && i >= 0) - { - if (myfgets(s, MAXLINELEN, f)) - states[i].action = saveactions[searchvalue(s)]; - } - else - { - deh_warning("Pointer: Frame %d doesn't exist", i); - ignorelines(f); - } - } - else - deh_warning("pointer (Frame %d) : missing ')'", i); - }*/ else if (fastcmp(word, "SOUND")) { if (i == 0 && word2[0] != '0') // If word2 isn't a number i = get_sfx(word2); // find a sound by name - if (i < NUMSFX && i >= 0) - readsound(f, i, savesfxnames); + if (i < NUMSFX && i > 0) + readsound(f, i); else { - deh_warning("Sound %d out of range (0 - %d)", i, NUMSFX-1); + deh_warning("Sound %d out of range (1 - %d)", i, NUMSFX-1); ignorelines(f); } - DEH_WriteUndoline(word, word2, UNDO_HEADER); } -/* else if (fastcmp(word, "SPRITE")) - { - if (i < NUMSPRITES && i >= 0) - { - if (myfgets(s, MAXLINELEN, f)) - { - INT32 k; - k = (searchvalue(s) - 151328)/8; - if (k >= 0 && k < NUMSPRITES) - sprnames[i] = savesprnames[k]; - else - { - deh_warning("Sprite %d: offset out of bounds", i); - ignorelines(f); - } - } - } - else - deh_warning("Sprite %d doesn't exist",i); - }*/ else if (fastcmp(word, "HUDITEM")) { if (i == 0 && word2[0] != '0') // If word2 isn't a number @@ -3573,51 +3919,23 @@ static void DEH_LoadDehackedFile(MYFILE *f, UINT16 wad) deh_warning("HUD item number %d out of range (0 - %d)", i, NUMHUDITEMS-1); ignorelines(f); } - DEH_WriteUndoline(word, word2, UNDO_HEADER); } - else if (fastcmp(word, "EMBLEM")) + else if (fastcmp(word, "MENU")) { - if (!gamedataadded) - { - deh_warning("You must define a custom gamedata to use \"%s\"", word); - ignorelines(f); - } - else if (i > 0 && i <= MAXEMBLEMS) - { - if (numemblems < i) - numemblems = i; - reademblemdata(f, i); - } + if (i == 0 && word2[0] != '0') // If word2 isn't a number + i = get_menutype(word2); // find a huditem by name + if (i >= 1 && i < NUMMENUTYPES) + readmenu(f, i); else { - deh_warning("Emblem number %d out of range (1 - %d)", i, MAXEMBLEMS); + // zero-based, but let's start at 1 + deh_warning("Menu number %d out of range (1 - %d)", i, NUMMENUTYPES-1); ignorelines(f); } - DEH_WriteUndoline(word, word2, UNDO_HEADER); - } - else if (fastcmp(word, "EXTRAEMBLEM")) - { - if (!gamedataadded) - { - deh_warning("You must define a custom gamedata to use \"%s\"", word); - ignorelines(f); - } - else if (i > 0 && i <= MAXEXTRAEMBLEMS) - { - if (numextraemblems < i) - numextraemblems = i; - readextraemblemdata(f, i); - } - else - { - deh_warning("Extra emblem number %d out of range (1 - %d)", i, MAXEXTRAEMBLEMS); - ignorelines(f); - } - DEH_WriteUndoline(word, word2, UNDO_HEADER); } else if (fastcmp(word, "UNLOCKABLE")) { - if (!gamedataadded) + if (!mainfile && !gamedataadded) { deh_warning("You must define a custom gamedata to use \"%s\"", word); ignorelines(f); @@ -3629,11 +3947,10 @@ static void DEH_LoadDehackedFile(MYFILE *f, UINT16 wad) deh_warning("Unlockable number %d out of range (1 - %d)", i, MAXUNLOCKABLES); ignorelines(f); } - DEH_WriteUndoline(word, word2, UNDO_HEADER); } else if (fastcmp(word, "CONDITIONSET")) { - if (!gamedataadded) + if (!mainfile && !gamedataadded) { deh_warning("You must define a custom gamedata to use \"%s\"", word); ignorelines(f); @@ -3645,25 +3962,26 @@ static void DEH_LoadDehackedFile(MYFILE *f, UINT16 wad) deh_warning("Condition set number %d out of range (1 - %d)", i, MAXCONDITIONSETS); ignorelines(f); } - // no undo support for this insanity yet - //DEH_WriteUndoline(word, word2, UNDO_HEADER); } - else if (fastcmp(word, "SRB2")) + // Last I heard this crashes the game if you try to use it + // so this is disabled for now + // -- Monster Iestyn +/* else if (fastcmp(word, "SRB2")) { INT32 ver = searchvalue(strtok(NULL, "\n")); if (ver != PATCHVERSION) deh_warning("Patch is for SRB2 version %d,\nonly version %d is supported", ver, PATCHVERSION); - //DEH_WriteUndoline(word, va("%d", ver), UNDO_NONE); } // Clear all data in certain locations (mostly for unlocks) // Unless you REALLY want to piss people off, // define a custom gamedata /before/ doing this!! // (then again, modifiedgame will prevent game data saving anyway) +*/ else if (fastcmp(word, "CLEAR")) { boolean clearall = (fastcmp(word2, "ALL")); - if (!gamedataadded) + if (!mainfile && !gamedataadded) { deh_warning("You must define a custom gamedata to use \"%s\"", word); continue; @@ -3703,6 +4021,20 @@ static void DEH_LoadDehackedFile(MYFILE *f, UINT16 wad) if (gamedataadded) G_LoadGameData(); + if (gamestate == GS_TITLESCREEN) + { + if (introchanged) + { + menuactive = false; + COM_BufAddText("playintro"); + } + else if (titlechanged) + { + menuactive = false; + COM_BufAddText("exitgame"); // Command_ExitGame_f() but delayed + } + } + dbg_line = -1; if (deh_num_warning) { @@ -3720,89 +4052,24 @@ static void DEH_LoadDehackedFile(MYFILE *f, UINT16 wad) // read dehacked lump in a wad (there is special trick for for deh // file that are converted to wad in w_wad.c) -void DEH_LoadDehackedLumpPwad(UINT16 wad, UINT16 lump) +void DEH_LoadDehackedLumpPwad(UINT16 wad, UINT16 lump, boolean mainfile) { MYFILE f; -#ifdef DELFILE - unsocwad = wad; -#endif f.wad = wad; f.size = W_LumpLengthPwad(wad, lump); f.data = Z_Malloc(f.size + 1, PU_STATIC, NULL); W_ReadLumpPwad(wad, lump, f.data); f.curpos = f.data; f.data[f.size] = 0; - DEH_LoadDehackedFile(&f, wad); - DEH_WriteUndoline(va("# uload for wad: %u, lump: %u", wad, lump), NULL, UNDO_DONE); + DEH_LoadDehackedFile(&f, mainfile); Z_Free(f.data); } void DEH_LoadDehackedLump(lumpnum_t lumpnum) { - DEH_LoadDehackedLumpPwad(WADFILENUM(lumpnum),LUMPNUM(lumpnum)); + DEH_LoadDehackedLumpPwad(WADFILENUM(lumpnum),LUMPNUM(lumpnum), false); } -#ifdef DELFILE -#define DUMPUNDONE - -// read (un)dehacked lump in wad's memory -void DEH_UnloadDehackedWad(UINT16 wad) -{ - undehacked_t *tmp, *curundo = unsocdata[wad]; - MYFILE f; - size_t len = 0; - char *data; -#ifdef DUMPUNDONE - FILE *UNDO = fopen("undo.soc", "wt"); -#endif - CONS_Printf(M_GetText("Unloading WAD SOC edits\n")); - while (curundo) - { - data = curundo->undata; - curundo = curundo->next; - if (data) - len += strlen(data); - len += 1; -#ifdef DUMPUNDONE - if (UNDO) - { - if (data) - fprintf(UNDO, "%s\n", data); - else - fprintf(UNDO, "\n"); - } -#endif - } -#ifndef DUMPUNDONE - if (UNDO) fclose(UNDO); -#endif - if (!len) return; - f.size = len; - data = f.data = Z_Malloc(f.size + 1, PU_STATIC, NULL); - curundo = unsocdata[wad]; - unsocdata[wad] = NULL; - while (curundo) - { - tmp = curundo; - curundo = curundo->next; - if (tmp->undata) - data += sprintf(data, "%s\n", tmp->undata); - else - data += sprintf(data, "\n"); - if (tmp->undata) free(tmp->undata); - free(tmp); - } - f.wad = wad; - f.curpos = f.data; - f.data[f.size] = 0; - disableundo = true; - DEH_LoadDehackedFile(&f); - disableundo = false; - Z_Free(f.data); -} -#endif //DELFILE - - //////////////////////////////////////////////////////////////////////////////// // CRAZY LIST OF STATE NAMES AND ALL FROM HERE DOWN // TODO: Make this all a seperate file or something, like part of info.c?? @@ -3830,61 +4097,65 @@ static const char *const STATE_LIST[] = { // array length left dynamic for sanit // Thok "S_THOK", + // Player "S_PLAY_STND", - "S_PLAY_TAP1", - "S_PLAY_TAP2", - "S_PLAY_RUN1", - "S_PLAY_RUN2", - "S_PLAY_RUN3", - "S_PLAY_RUN4", - "S_PLAY_RUN5", - "S_PLAY_RUN6", - "S_PLAY_RUN7", - "S_PLAY_RUN8", - "S_PLAY_SPD1", - "S_PLAY_SPD2", - "S_PLAY_SPD3", - "S_PLAY_SPD4", - "S_PLAY_ATK1", - "S_PLAY_ATK2", - "S_PLAY_ATK3", - "S_PLAY_ATK4", - "S_PLAY_SPRING", - "S_PLAY_FALL1", - "S_PLAY_FALL2", - "S_PLAY_ABL1", - "S_PLAY_ABL2", - "S_PLAY_SPC1", - "S_PLAY_SPC2", - "S_PLAY_SPC3", - "S_PLAY_SPC4", - "S_PLAY_CLIMB1", - "S_PLAY_CLIMB2", - "S_PLAY_CLIMB3", - "S_PLAY_CLIMB4", - "S_PLAY_CLIMB5", - "S_PLAY_GASP", + "S_PLAY_WAIT", + "S_PLAY_WALK", + "S_PLAY_SKID", + "S_PLAY_RUN", + "S_PLAY_DASH", "S_PLAY_PAIN", - "S_PLAY_DIE", - "S_PLAY_TEETER1", - "S_PLAY_TEETER2", - "S_PLAY_CARRY", - "S_PLAY_SUPERSTAND", - "S_PLAY_SUPERWALK1", - "S_PLAY_SUPERWALK2", - "S_PLAY_SUPERFLY1", - "S_PLAY_SUPERFLY2", - "S_PLAY_SUPERTEETER", - "S_PLAY_SUPERHIT", - "S_PLAY_SUPERTRANS1", - "S_PLAY_SUPERTRANS2", - "S_PLAY_SUPERTRANS3", - "S_PLAY_SUPERTRANS4", - "S_PLAY_SUPERTRANS5", - "S_PLAY_SUPERTRANS6", - "S_PLAY_SUPERTRANS7", - "S_PLAY_SUPERTRANS8", - "S_PLAY_SUPERTRANS9", // This has special significance in the code. If you add more frames, search for it and make the appropriate changes. + "S_PLAY_STUN", + "S_PLAY_DEAD", + "S_PLAY_DRWN", + "S_PLAY_ROLL", + "S_PLAY_GASP", + "S_PLAY_JUMP", + "S_PLAY_SPRING", + "S_PLAY_FALL", + "S_PLAY_EDGE", + "S_PLAY_RIDE", + + // CA2_SPINDASH + "S_PLAY_SPINDASH", + + // CA_FLY/SWIM + "S_PLAY_FLY", + "S_PLAY_SWIM", + "S_PLAY_FLY_TIRED", + + // CA_GLIDEANDCLIMB + "S_PLAY_GLIDE", + "S_PLAY_CLING", + "S_PLAY_CLIMB", + + // CA_FLOAT/CA_SLOWFALL + "S_PLAY_FLOAT", + "S_PLAY_FLOAT_RUN", + + // CA_BOUNCE + "S_PLAY_BOUNCE", + "S_PLAY_BOUNCE_LANDING", + + // CA2_GUNSLINGER + "S_PLAY_FIRE", + "S_PLAY_FIRE_FINISH", + + // CA_TWINSPIN + "S_PLAY_TWINSPIN", + + // CA2_MELEE + "S_PLAY_MELEE", + "S_PLAY_MELEE_FINISH", + "S_PLAY_MELEE_LANDING", + + // SF_SUPER + "S_PLAY_SUPER_TRANS1", + "S_PLAY_SUPER_TRANS2", + "S_PLAY_SUPER_TRANS3", + "S_PLAY_SUPER_TRANS4", + "S_PLAY_SUPER_TRANS5", + "S_PLAY_SUPER_TRANS6", // This has special significance in the code. If you add more frames, search for it and make the appropriate changes. // technically the player goes here but it's an infinite tic state "S_OBJPLACE_DUMMY", @@ -3899,6 +4170,61 @@ static const char *const STATE_LIST[] = { // array length left dynamic for sanit // Level end sign (uses player sprite) "S_PLAY_SIGN", + // NiGHTS character (uses player sprite) + "S_PLAY_NIGHTS_TRANS1", + "S_PLAY_NIGHTS_TRANS2", + "S_PLAY_NIGHTS_TRANS3", + "S_PLAY_NIGHTS_TRANS4", + "S_PLAY_NIGHTS_TRANS5", + "S_PLAY_NIGHTS_TRANS6", + + "S_PLAY_NIGHTS_STAND", + "S_PLAY_NIGHTS_FLOAT", + "S_PLAY_NIGHTS_STUN", + "S_PLAY_NIGHTS_PULL", + "S_PLAY_NIGHTS_ATTACK", + + "S_PLAY_NIGHTS_FLY0", + "S_PLAY_NIGHTS_DRILL0", + "S_PLAY_NIGHTS_FLY1", + "S_PLAY_NIGHTS_DRILL1", + "S_PLAY_NIGHTS_FLY2", + "S_PLAY_NIGHTS_DRILL2", + "S_PLAY_NIGHTS_FLY3", + "S_PLAY_NIGHTS_DRILL3", + "S_PLAY_NIGHTS_FLY4", + "S_PLAY_NIGHTS_DRILL4", + "S_PLAY_NIGHTS_FLY5", + "S_PLAY_NIGHTS_DRILL5", + "S_PLAY_NIGHTS_FLY6", + "S_PLAY_NIGHTS_DRILL6", + "S_PLAY_NIGHTS_FLY7", + "S_PLAY_NIGHTS_DRILL7", + "S_PLAY_NIGHTS_FLY8", + "S_PLAY_NIGHTS_DRILL8", + "S_PLAY_NIGHTS_FLY9", + "S_PLAY_NIGHTS_DRILL9", + "S_PLAY_NIGHTS_FLYA", + "S_PLAY_NIGHTS_DRILLA", + "S_PLAY_NIGHTS_FLYB", + "S_PLAY_NIGHTS_DRILLB", + "S_PLAY_NIGHTS_FLYC", + "S_PLAY_NIGHTS_DRILLC", + + // c: + "S_TAILSOVERLAY_STAND", + "S_TAILSOVERLAY_0DEGREES", + "S_TAILSOVERLAY_PLUS30DEGREES", + "S_TAILSOVERLAY_PLUS60DEGREES", + "S_TAILSOVERLAY_MINUS30DEGREES", + "S_TAILSOVERLAY_MINUS60DEGREES", + "S_TAILSOVERLAY_RUN", + "S_TAILSOVERLAY_FLY", + "S_TAILSOVERLAY_TIRE", + "S_TAILSOVERLAY_PAIN", + "S_TAILSOVERLAY_GASP", + "S_TAILSOVERLAY_EDGE", + // Blue Crawla "S_POSS_STND", "S_POSS_RUN1", @@ -3935,10 +4261,6 @@ static const char *const STATE_LIST[] = { // array length left dynamic for sanit "S_RBUZZFLY1", "S_RBUZZFLY2", - // AquaBuzz - "S_BBUZZFLY1", - "S_BBUZZFLY2", - // Jetty-Syn Bomber "S_JETBLOOK1", "S_JETBLOOK2", @@ -3975,7 +4297,6 @@ static const char *const STATE_LIST[] = { // array length left dynamic for sanit "S_DETON13", "S_DETON14", "S_DETON15", - "S_DETON16", // Skim Mine Dropper "S_SKIM1", @@ -4017,14 +4338,40 @@ static const char *const STATE_LIST[] = { // array length left dynamic for sanit "S_TURRETPOPDOWN7", "S_TURRETPOPDOWN8", - // Sharp - "S_SHARP_ROAM1", - "S_SHARP_ROAM2", - "S_SHARP_AIM1", - "S_SHARP_AIM2", - "S_SHARP_AIM3", - "S_SHARP_AIM4", - "S_SHARP_SPIN", + // Spincushion + "S_SPINCUSHION_LOOK", + "S_SPINCUSHION_CHASE1", + "S_SPINCUSHION_CHASE2", + "S_SPINCUSHION_CHASE3", + "S_SPINCUSHION_CHASE4", + "S_SPINCUSHION_AIM1", + "S_SPINCUSHION_AIM2", + "S_SPINCUSHION_AIM3", + "S_SPINCUSHION_AIM4", + "S_SPINCUSHION_AIM5", + "S_SPINCUSHION_SPIN1", + "S_SPINCUSHION_SPIN2", + "S_SPINCUSHION_SPIN3", + "S_SPINCUSHION_SPIN4", + "S_SPINCUSHION_STOP1", + "S_SPINCUSHION_STOP2", + "S_SPINCUSHION_STOP3", + "S_SPINCUSHION_STOP4", + + // Crushstacean + "S_CRUSHSTACEAN_ROAM1", + "S_CRUSHSTACEAN_ROAM2", + "S_CRUSHSTACEAN_ROAM3", + "S_CRUSHSTACEAN_ROAM4", + "S_CRUSHSTACEAN_ROAMPAUSE", + "S_CRUSHSTACEAN_PUNCH1", + "S_CRUSHSTACEAN_PUNCH2", + "S_CRUSHCLAW_AIM", + "S_CRUSHCLAW_OUT", + "S_CRUSHCLAW_STAY", + "S_CRUSHCLAW_IN", + "S_CRUSHCLAW_WAIT", + "S_CRUSHCHAIN", // Jet Jaw "S_JETJAW_ROAM1", @@ -4057,15 +4404,10 @@ static const char *const STATE_LIST[] = { // array length left dynamic for sanit // Vulture "S_VULTURE_STND", - "S_VULTURE_VTOL1", - "S_VULTURE_VTOL2", - "S_VULTURE_VTOL3", - "S_VULTURE_VTOL4", + "S_VULTURE_DRIFT", "S_VULTURE_ZOOM1", "S_VULTURE_ZOOM2", - "S_VULTURE_ZOOM3", - "S_VULTURE_ZOOM4", - "S_VULTURE_ZOOM5", + "S_VULTURE_STUNNED", // Pointy "S_POINTY1", @@ -4073,11 +4415,12 @@ static const char *const STATE_LIST[] = { // array length left dynamic for sanit // Robo-Hood "S_ROBOHOOD_LOOK", - "S_ROBOHOOD_STND", - "S_ROBOHOOD_SHOOT", - "S_ROBOHOOD_JUMP", + "S_ROBOHOOD_STAND", + "S_ROBOHOOD_FIRE1", + "S_ROBOHOOD_FIRE2", + "S_ROBOHOOD_JUMP1", "S_ROBOHOOD_JUMP2", - "S_ROBOHOOD_FALL", + "S_ROBOHOOD_JUMP3", // CastleBot FaceStabber "S_FACESTABBER_STND1", @@ -4090,6 +4433,11 @@ static const char *const STATE_LIST[] = { // array length left dynamic for sanit "S_FACESTABBER_CHARGE2", "S_FACESTABBER_CHARGE3", "S_FACESTABBER_CHARGE4", + "S_FACESTABBER_PAIN", + "S_FACESTABBER_DIE1", + "S_FACESTABBER_DIE2", + "S_FACESTABBER_DIE3", + "S_FACESTABBERSPEAR", // Egg Guard "S_EGGGUARD_STND", @@ -4107,17 +4455,34 @@ static const char *const STATE_LIST[] = { // array length left dynamic for sanit // Egg Shield for Egg Guard "S_EGGSHIELD", + "S_EGGSHIELDBREAK", // Green Snapper + "S_SNAPPER_SPAWN", + "S_SNAPPER_SPAWN2", "S_GSNAPPER_STND", "S_GSNAPPER1", "S_GSNAPPER2", "S_GSNAPPER3", "S_GSNAPPER4", + "S_SNAPPER_XPLD", + "S_SNAPPER_LEG", + "S_SNAPPER_LEGRAISE", + "S_SNAPPER_HEAD", // Minus + "S_MINUS_INIT", "S_MINUS_STND", - "S_MINUS_DIGGING", + "S_MINUS_DIGGING1", + "S_MINUS_DIGGING2", + "S_MINUS_DIGGING3", + "S_MINUS_DIGGING4", + "S_MINUS_BURST0", + "S_MINUS_BURST1", + "S_MINUS_BURST2", + "S_MINUS_BURST3", + "S_MINUS_BURST4", + "S_MINUS_BURST5", "S_MINUS_POPUP", "S_MINUS_UPWARD1", "S_MINUS_UPWARD2", @@ -4136,6 +4501,15 @@ static const char *const STATE_LIST[] = { // array length left dynamic for sanit "S_MINUS_DOWNWARD7", "S_MINUS_DOWNWARD8", + // Minus dirt + "S_MINUSDIRT1", + "S_MINUSDIRT2", + "S_MINUSDIRT3", + "S_MINUSDIRT4", + "S_MINUSDIRT5", + "S_MINUSDIRT6", + "S_MINUSDIRT7", + // Spring Shell "S_SSHELL_STND", "S_SSHELL_RUN1", @@ -4163,14 +4537,30 @@ static const char *const STATE_LIST[] = { // array length left dynamic for sanit "S_UNIDUS_RUN", "S_UNIDUS_BALL", + // Canarivore + "S_CANARIVORE_LOOK", + "S_CANARIVORE_AWAKEN1", + "S_CANARIVORE_AWAKEN2", + "S_CANARIVORE_AWAKEN3", + "S_CANARIVORE_GAS1", + "S_CANARIVORE_GAS2", + "S_CANARIVORE_GAS3", + "S_CANARIVORE_GAS4", + "S_CANARIVORE_GAS5", + "S_CANARIVORE_GASREPEAT", + "S_CANARIVORE_CLOSE1", + "S_CANARIVORE_CLOSE2", + "S_CANARIVOREGAS_1", + "S_CANARIVOREGAS_2", + "S_CANARIVOREGAS_3", + "S_CANARIVOREGAS_4", + "S_CANARIVOREGAS_5", + "S_CANARIVOREGAS_6", + "S_CANARIVOREGAS_7", + "S_CANARIVOREGAS_8", + // Boss Explosion - "S_BPLD1", - "S_BPLD2", - "S_BPLD3", - "S_BPLD4", - "S_BPLD5", - "S_BPLD6", - "S_BPLD7", + "S_BOSSEXPLODE", // S3&K Boss Explosion "S_SONIC3KBOSSEXPLOSION1", @@ -4272,6 +4662,7 @@ static const char *const STATE_LIST[] = { // array length left dynamic for sanit "S_GOOP1", "S_GOOP2", "S_GOOP3", + "S_GOOPTRAIL", // Boss 3 "S_EGGMOBILE3_STND", @@ -4390,6 +4781,96 @@ static const char *const STATE_LIST[] = { // array length left dynamic for sanit "S_JETFLAME1", "S_JETFLAME2", + // Boss 5 + "S_FANG_IDLE1", + "S_FANG_IDLE2", + "S_FANG_IDLE3", + "S_FANG_IDLE4", + "S_FANG_IDLE5", + "S_FANG_IDLE6", + "S_FANG_IDLE7", + "S_FANG_IDLE8", + "S_FANG_PAIN1", + "S_FANG_PAIN2", + "S_FANG_PATHINGSTART1", + "S_FANG_PATHINGSTART2", + "S_FANG_PATHING", + "S_FANG_BOUNCE1", + "S_FANG_BOUNCE2", + "S_FANG_BOUNCE3", + "S_FANG_BOUNCE4", + "S_FANG_FALL1", + "S_FANG_FALL2", + "S_FANG_CHECKPATH1", + "S_FANG_CHECKPATH2", + "S_FANG_PATHINGCONT1", + "S_FANG_PATHINGCONT2", + "S_FANG_PATHINGCONT3", + "S_FANG_SKID1", + "S_FANG_SKID2", + "S_FANG_SKID3", + "S_FANG_CHOOSEATTACK", + "S_FANG_FIRESTART1", + "S_FANG_FIRESTART2", + "S_FANG_FIRE1", + "S_FANG_FIRE2", + "S_FANG_FIRE3", + "S_FANG_FIRE4", + "S_FANG_FIREREPEAT", + "S_FANG_LOBSHOT1", + "S_FANG_LOBSHOT2", + "S_FANG_WAIT1", + "S_FANG_WAIT2", + "S_FANG_WALLHIT", + "S_FANG_PINCHPATHINGSTART1", + "S_FANG_PINCHPATHINGSTART2", + "S_FANG_PINCHPATHING", + "S_FANG_PINCHBOUNCE1", + "S_FANG_PINCHBOUNCE2", + "S_FANG_PINCHBOUNCE3", + "S_FANG_PINCHBOUNCE4", + "S_FANG_PINCHFALL1", + "S_FANG_PINCHFALL2", + "S_FANG_PINCHSKID1", + "S_FANG_PINCHSKID2", + "S_FANG_PINCHLOBSHOT1", + "S_FANG_PINCHLOBSHOT2", + "S_FANG_PINCHLOBSHOT3", + "S_FANG_PINCHLOBSHOT4", + "S_FANG_DIE1", + "S_FANG_DIE2", + "S_FANG_DIE3", + "S_FANG_DIE4", + "S_FANG_DIE5", + "S_FANG_DIE6", + "S_FANG_DIE7", + "S_FANG_DIE8", + "S_FANG_FLEEPATHING1", + "S_FANG_FLEEPATHING2", + "S_FANG_FLEEBOUNCE1", + "S_FANG_FLEEBOUNCE2", + "S_FANG_KO", + + "S_FBOMB1", + "S_FBOMB2", + "S_FBOMB_EXPL1", + "S_FBOMB_EXPL2", + "S_FBOMB_EXPL3", + "S_FBOMB_EXPL4", + "S_FBOMB_EXPL5", + "S_FBOMB_EXPL6", + "S_TNTDUST_1", + "S_TNTDUST_2", + "S_TNTDUST_3", + "S_TNTDUST_4", + "S_TNTDUST_5", + "S_TNTDUST_6", + "S_TNTDUST_7", + "S_TNTDUST_8", + "S_FSGNA", + "S_FSGNB", + "S_FSGNC", + // Black Eggman (Boss 7) "S_BLACKEGG_STND", "S_BLACKEGG_STND2", @@ -4626,7 +5107,7 @@ static const char *const STATE_LIST[] = { // array length left dynamic for sanit // S_PLAY_TAP1 "S_METALSONIC_WAIT1", "S_METALSONIC_WAIT2", - // S_PLAY_RUN1 + // S_PLAY_WALK "S_METALSONIC_WALK1", "S_METALSONIC_WALK2", "S_METALSONIC_WALK3", @@ -4644,11 +5125,11 @@ static const char *const STATE_LIST[] = { // array length left dynamic for sanit "S_METALSONIC_FLOAT", "S_METALSONIC_VECTOR", "S_METALSONIC_STUN", - "S_METALSONIC_BLOCK", "S_METALSONIC_RAISE", "S_METALSONIC_GATHER", "S_METALSONIC_DASH", "S_METALSONIC_BOUNCE", + "S_METALSONIC_BADBOUNCE", "S_METALSONIC_SHOOT", "S_METALSONIC_PAIN", "S_METALSONIC_DEATH", @@ -4674,27 +5155,33 @@ static const char *const STATE_LIST[] = { // array length left dynamic for sanit "S_RING", // Blue Sphere for special stages - "S_BLUEBALL", - "S_BLUEBALLSPARK", + "S_BLUESPHERE", + "S_BLUESPHEREBONUS", + "S_BLUESPHERESPARK", + + // Bomb Sphere + "S_BOMBSPHERE1", + "S_BOMBSPHERE2", + "S_BOMBSPHERE3", + "S_BOMBSPHERE4", + + // NiGHTS Chip + "S_NIGHTSCHIP", + "S_NIGHTSCHIPBONUS", + + // NiGHTS Star + "S_NIGHTSSTAR", + "S_NIGHTSSTARXMAS", // Gravity Wells for special stages "S_GRAVWELLGREEN", - "S_GRAVWELLGREEN2", - "S_GRAVWELLGREEN3", - "S_GRAVWELLRED", - "S_GRAVWELLRED2", - "S_GRAVWELLRED3", // Individual Team Rings "S_TEAMRING", - // Special Stage Token - "S_EMMY", - // Special Stage Token "S_TOKEN", - "S_MOVINGTOKEN", // CTF Flags "S_REDFLAG", @@ -4737,18 +5224,16 @@ static const char *const STATE_LIST[] = { // array length left dynamic for sanit "S_CEMG6", "S_CEMG7", - // Emeralds (for hunt) - "S_EMER1", - - "S_FAN", - "S_FAN2", - "S_FAN3", - "S_FAN4", - "S_FAN5", + // Emerald hunt shards + "S_SHRD1", + "S_SHRD2", + "S_SHRD3", // Bubble Source "S_BUBBLES1", "S_BUBBLES2", + "S_BUBBLES3", + "S_BUBBLES4", // Level End Sign "S_SIGN1", @@ -4805,16 +5290,6 @@ static const char *const STATE_LIST[] = { // array length left dynamic for sanit "S_SIGN52", // Eggman "S_SIGN53", - // Steam Riser - "S_STEAM1", - "S_STEAM2", - "S_STEAM3", - "S_STEAM4", - "S_STEAM5", - "S_STEAM6", - "S_STEAM7", - "S_STEAM8", - // Spike Ball "S_SPIKEBALL1", "S_SPIKEBALL2", @@ -4825,7 +5300,7 @@ static const char *const STATE_LIST[] = { // array length left dynamic for sanit "S_SPIKEBALL7", "S_SPIKEBALL8", - // Fire Shield's Spawn + // Elemental Shield's Spawn "S_SPINFIRE1", "S_SPINFIRE2", "S_SPINFIRE3", @@ -4843,190 +5318,169 @@ static const char *const STATE_LIST[] = { // array length left dynamic for sanit "S_SPIKED1", "S_SPIKED2", + // Wall spikes + "S_WALLSPIKE1", + "S_WALLSPIKE2", + "S_WALLSPIKE3", + "S_WALLSPIKE4", + "S_WALLSPIKE5", + "S_WALLSPIKE6", + "S_WALLSPIKEBASE", + "S_WALLSPIKED1", + "S_WALLSPIKED2", + // Starpost "S_STARPOST_IDLE", "S_STARPOST_FLASH", + "S_STARPOST_STARTSPIN", "S_STARPOST_SPIN", + "S_STARPOST_ENDSPIN", // Big floating mine - "S_BIGMINE1", - "S_BIGMINE2", - "S_BIGMINE3", - "S_BIGMINE4", - "S_BIGMINE5", - "S_BIGMINE6", - "S_BIGMINE7", - "S_BIGMINE8", + "S_BIGMINE_IDLE", + "S_BIGMINE_ALERT1", + "S_BIGMINE_ALERT2", + "S_BIGMINE_ALERT3", + "S_BIGMINE_SET1", + "S_BIGMINE_SET2", + "S_BIGMINE_SET3", + "S_BIGMINE_BLAST1", + "S_BIGMINE_BLAST2", + "S_BIGMINE_BLAST3", + "S_BIGMINE_BLAST4", + "S_BIGMINE_BLAST5", // Cannon Launcher "S_CANNONLAUNCHER1", "S_CANNONLAUNCHER2", "S_CANNONLAUNCHER3", - // Super Ring Box - "S_SUPERRINGBOX", - "S_SUPERRINGBOX1", - "S_SUPERRINGBOX2", - "S_SUPERRINGBOX3", - "S_SUPERRINGBOX4", - "S_SUPERRINGBOX5", - "S_SUPERRINGBOX6", + // Monitor Miscellany + "S_BOXSPARKLE1", + "S_BOXSPARKLE2", + "S_BOXSPARKLE3", + "S_BOXSPARKLE4", - // Red Team Ring Box - "S_REDRINGBOX", - "S_REDRINGBOX1", + "S_BOX_FLICKER", + "S_BOX_POP1", + "S_BOX_POP2", - // Blue Team Ring Box - "S_BLUERINGBOX", - "S_BLUERINGBOX1", + "S_GOLDBOX_FLICKER", + "S_GOLDBOX_OFF1", + "S_GOLDBOX_OFF2", + "S_GOLDBOX_OFF3", + "S_GOLDBOX_OFF4", + "S_GOLDBOX_OFF5", + "S_GOLDBOX_OFF6", + "S_GOLDBOX_OFF7", - // Super Sneakers Box - "S_SHTV", - "S_SHTV1", - "S_SHTV2", - "S_SHTV3", - "S_SHTV4", - "S_SHTV5", - "S_SHTV6", + // Monitor States (one per box) + "S_MYSTERY_BOX", + "S_RING_BOX", + "S_PITY_BOX", + "S_ATTRACT_BOX", + "S_FORCE_BOX", + "S_ARMAGEDDON_BOX", + "S_WHIRLWIND_BOX", + "S_ELEMENTAL_BOX", + "S_SNEAKERS_BOX", + "S_INVULN_BOX", + "S_1UP_BOX", + "S_EGGMAN_BOX", + "S_MIXUP_BOX", + "S_GRAVITY_BOX", + "S_RECYCLER_BOX", + "S_SCORE1K_BOX", + "S_SCORE10K_BOX", + "S_FLAMEAURA_BOX", + "S_BUBBLEWRAP_BOX", + "S_THUNDERCOIN_BOX", - // Invincibility Box - "S_PINV", - "S_PINV1", - "S_PINV2", - "S_PINV3", - "S_PINV4", - "S_PINV5", - "S_PINV6", + // Gold Repeat Monitor States (one per box) + "S_PITY_GOLDBOX", + "S_ATTRACT_GOLDBOX", + "S_FORCE_GOLDBOX", + "S_ARMAGEDDON_GOLDBOX", + "S_WHIRLWIND_GOLDBOX", + "S_ELEMENTAL_GOLDBOX", + "S_SNEAKERS_GOLDBOX", + "S_INVULN_GOLDBOX", + "S_EGGMAN_GOLDBOX", + "S_GRAVITY_GOLDBOX", + "S_FLAMEAURA_GOLDBOX", + "S_BUBBLEWRAP_GOLDBOX", + "S_THUNDERCOIN_GOLDBOX", - // 1-Up Box - "S_PRUP", - "S_PRUP1", - "S_PRUP2", - "S_PRUP3", - "S_PRUP4", - "S_PRUP5", - "S_PRUP6", + // Team Ring Boxes (these are special) + "S_RING_REDBOX1", + "S_RING_REDBOX2", + "S_REDBOX_POP1", + "S_REDBOX_POP2", - // Ring Shield Box - "S_YLTV", - "S_YLTV1", - "S_YLTV2", - "S_YLTV3", - "S_YLTV4", - "S_YLTV5", - "S_YLTV6", + "S_RING_BLUEBOX1", + "S_RING_BLUEBOX2", + "S_BLUEBOX_POP1", + "S_BLUEBOX_POP2", - // Force Shield Box - "S_BLTV1", - "S_BLTV2", - "S_BLTV3", - "S_BLTV4", - "S_BLTV5", - "S_BLTV6", - "S_BLTV7", + // Box Icons -- 2 states each, animation and action + "S_RING_ICON1", + "S_RING_ICON2", - // Bomb Shield Box - "S_BKTV1", - "S_BKTV2", - "S_BKTV3", - "S_BKTV4", - "S_BKTV5", - "S_BKTV6", - "S_BKTV7", + "S_PITY_ICON1", + "S_PITY_ICON2", - // Jump Shield Box - "S_WHTV1", - "S_WHTV2", - "S_WHTV3", - "S_WHTV4", - "S_WHTV5", - "S_WHTV6", - "S_WHTV7", + "S_ATTRACT_ICON1", + "S_ATTRACT_ICON2", - // Water Shield Box - "S_GRTV", - "S_GRTV1", - "S_GRTV2", - "S_GRTV3", - "S_GRTV4", - "S_GRTV5", - "S_GRTV6", + "S_FORCE_ICON1", + "S_FORCE_ICON2", - // Pity Shield Box - "S_PITV1", - "S_PITV2", - "S_PITV3", - "S_PITV4", - "S_PITV5", - "S_PITV6", - "S_PITV7", + "S_ARMAGEDDON_ICON1", + "S_ARMAGEDDON_ICON2", - // Eggman Box - "S_EGGTV1", - "S_EGGTV2", - "S_EGGTV3", - "S_EGGTV4", - "S_EGGTV5", - "S_EGGTV6", - "S_EGGTV7", + "S_WHIRLWIND_ICON1", + "S_WHIRLWIND_ICON2", - // Teleport Box - "S_MIXUPBOX1", - "S_MIXUPBOX2", - "S_MIXUPBOX3", - "S_MIXUPBOX4", - "S_MIXUPBOX5", - "S_MIXUPBOX6", - "S_MIXUPBOX7", + "S_ELEMENTAL_ICON1", + "S_ELEMENTAL_ICON2", - // Recycler Box - "S_RECYCLETV1", - "S_RECYCLETV2", - "S_RECYCLETV3", - "S_RECYCLETV4", - "S_RECYCLETV5", - "S_RECYCLETV6", - "S_RECYCLETV7", + "S_SNEAKERS_ICON1", + "S_SNEAKERS_ICON2", - // Question Box - "S_RANDOMBOX1", - "S_RANDOMBOX2", - "S_RANDOMBOX3", + "S_INVULN_ICON1", + "S_INVULN_ICON2", - // Gravity Boots Box - "S_GBTV1", - "S_GBTV2", - "S_GBTV3", - "S_GBTV4", - "S_GBTV5", - "S_GBTV6", - "S_GBTV7", + "S_1UP_ICON1", + "S_1UP_ICON2", - // Score boxes - "S_SCORETVA1", - "S_SCORETVA2", - "S_SCORETVA3", - "S_SCORETVA4", - "S_SCORETVA5", - "S_SCORETVA6", - "S_SCORETVA7", - "S_SCORETVB1", - "S_SCORETVB2", - "S_SCORETVB3", - "S_SCORETVB4", - "S_SCORETVB5", - "S_SCORETVB6", - "S_SCORETVB7", + "S_EGGMAN_ICON1", + "S_EGGMAN_ICON2", - // Monitor Explosion - "S_MONITOREXPLOSION1", - "S_MONITOREXPLOSION2", + "S_MIXUP_ICON1", + "S_MIXUP_ICON2", - "S_REDMONITOREXPLOSION1", - "S_REDMONITOREXPLOSION2", + "S_GRAVITY_ICON1", + "S_GRAVITY_ICON2", - "S_BLUEMONITOREXPLOSION1", - "S_BLUEMONITOREXPLOSION2", + "S_RECYCLER_ICON1", + "S_RECYCLER_ICON2", + + "S_SCORE1K_ICON1", + "S_SCORE1K_ICON2", + + "S_SCORE10K_ICON1", + "S_SCORE10K_ICON2", + + "S_FLAMEAURA_ICON1", + "S_FLAMEAURA_ICON2", + + "S_BUBBLEWRAP_ICON1", + "S_BUBBLEWRAP_ICON2", + + "S_THUNDERCOIN_ICON1", + "S_THUNDERCOIN_ICON2", + + // --- "S_ROCKET", @@ -5057,39 +5511,60 @@ static const char *const STATE_LIST[] = { // array length left dynamic for sanit // Arrow "S_ARROW", - "S_ARROWUP", - "S_ARROWDOWN", + "S_ARROWBONK", // Trapgoyle Demon fire - "S_DEMONFIRE1", - "S_DEMONFIRE2", - "S_DEMONFIRE3", - "S_DEMONFIRE4", - "S_DEMONFIRE5", - "S_DEMONFIRE6", + "S_DEMONFIRE", + // GFZ flowers "S_GFZFLOWERA", - "S_GFZFLOWERA2", - - "S_GFZFLOWERB1", - "S_GFZFLOWERB2", - - "S_GFZFLOWERC1", + "S_GFZFLOWERB", + "S_GFZFLOWERC", + "S_BLUEBERRYBUSH", "S_BERRYBUSH", "S_BUSH", - // THZ Plant - "S_THZPLANT1", - "S_THZPLANT2", - "S_THZPLANT3", - "S_THZPLANT4", + // Trees (both GFZ and misc) + "S_GFZTREE", + "S_GFZBERRYTREE", + "S_GFZCHERRYTREE", + "S_CHECKERTREE", + "S_CHECKERSUNSETTREE", + "S_FHZTREE", // Frozen Hillside + "S_FHZPINKTREE", + "S_POLYGONTREE", + "S_BUSHTREE", + "S_BUSHREDTREE", + "S_SPRINGTREE", + + // THZ flowers + "S_THZFLOWERA", // THZ1 Steam flower + "S_THZFLOWERB", // THZ1 Spin flower (red) + "S_THZFLOWERC", // THZ1 Spin flower (yellow) + + // THZ Steam Whistle tree/bush + "S_THZTREE", + "S_THZTREEBRANCH1", + "S_THZTREEBRANCH2", + "S_THZTREEBRANCH3", + "S_THZTREEBRANCH4", + "S_THZTREEBRANCH5", + "S_THZTREEBRANCH6", + "S_THZTREEBRANCH7", + "S_THZTREEBRANCH8", + "S_THZTREEBRANCH9", + "S_THZTREEBRANCH10", + "S_THZTREEBRANCH11", + "S_THZTREEBRANCH12", + "S_THZTREEBRANCH13", // THZ Alarm "S_ALARM1", // Deep Sea Gargoyle "S_GARGOYLE", + "S_BIGGARGOYLE", // DSZ Seaweed "S_SEAWEED1", @@ -5120,14 +5595,34 @@ static const char *const STATE_LIST[] = { // array length left dynamic for sanit // Blue Crystal "S_BLUECRYSTAL1", + // Kelp, + "S_KELP", + + // DSZ Stalagmites + "S_DSZSTALAGMITE", + "S_DSZ2STALAGMITE", + + // DSZ Light beam + "S_LIGHTBEAM1", + "S_LIGHTBEAM2", + "S_LIGHTBEAM3", + "S_LIGHTBEAM4", + "S_LIGHTBEAM5", + "S_LIGHTBEAM6", + "S_LIGHTBEAM7", + "S_LIGHTBEAM8", + "S_LIGHTBEAM9", + "S_LIGHTBEAM10", + "S_LIGHTBEAM11", + "S_LIGHTBEAM12", + // CEZ Chain "S_CEZCHAIN", // Flame - "S_FLAME1", - "S_FLAME2", - "S_FLAME3", - "S_FLAME4", + "S_FLAME", + "S_FLAMEPARTICLE", + "S_FLAMEREST", // Eggman Statue "S_EGGSTATUE1", @@ -5136,19 +5631,82 @@ static const char *const STATE_LIST[] = { // array length left dynamic for sanit "S_SLING1", "S_SLING2", - // CEZ Small Mace Chain + // CEZ maces and chains "S_SMALLMACECHAIN", - - // CEZ Big Mace Chain "S_BIGMACECHAIN", - - // CEZ Small Mace "S_SMALLMACE", - - // CEZ Big Mace "S_BIGMACE", + "S_SMALLGRABCHAIN", + "S_BIGGRABCHAIN", - "S_CEZFLOWER1", + // Yellow spring on a ball + "S_YELLOWSPRINGBALL", + "S_YELLOWSPRINGBALL2", + "S_YELLOWSPRINGBALL3", + "S_YELLOWSPRINGBALL4", + "S_YELLOWSPRINGBALL5", + + // Red spring on a ball + "S_REDSPRINGBALL", + "S_REDSPRINGBALL2", + "S_REDSPRINGBALL3", + "S_REDSPRINGBALL4", + "S_REDSPRINGBALL5", + + // Small Firebar + "S_SMALLFIREBAR1", + "S_SMALLFIREBAR2", + "S_SMALLFIREBAR3", + "S_SMALLFIREBAR4", + "S_SMALLFIREBAR5", + "S_SMALLFIREBAR6", + "S_SMALLFIREBAR7", + "S_SMALLFIREBAR8", + "S_SMALLFIREBAR9", + "S_SMALLFIREBAR10", + "S_SMALLFIREBAR11", + "S_SMALLFIREBAR12", + "S_SMALLFIREBAR13", + "S_SMALLFIREBAR14", + "S_SMALLFIREBAR15", + "S_SMALLFIREBAR16", + + // Big Firebar + "S_BIGFIREBAR1", + "S_BIGFIREBAR2", + "S_BIGFIREBAR3", + "S_BIGFIREBAR4", + "S_BIGFIREBAR5", + "S_BIGFIREBAR6", + "S_BIGFIREBAR7", + "S_BIGFIREBAR8", + "S_BIGFIREBAR9", + "S_BIGFIREBAR10", + "S_BIGFIREBAR11", + "S_BIGFIREBAR12", + "S_BIGFIREBAR13", + "S_BIGFIREBAR14", + "S_BIGFIREBAR15", + "S_BIGFIREBAR16", + + "S_CEZFLOWER", + "S_CEZPOLE", + "S_CEZBANNER", + "S_PINETREE", + "S_CEZBUSH1", + "S_CEZBUSH2", + "S_CANDLE", + "S_CANDLEPRICKET", + "S_FLAMEHOLDER", + "S_FIRETORCH", + "S_WAVINGFLAG", + "S_WAVINGFLAGSEG", + "S_CRAWLASTATUE", + "S_FACESTABBERSTATUE", + "S_SUSPICIOUSFACESTABBERSTATUE_WAIT", + "S_SUSPICIOUSFACESTABBERSTATUE_BURST1", + "S_SUSPICIOUSFACESTABBERSTATUE_BURST2", + "S_BRAMBLES", // Big Tumbleweed "S_BIGTUMBLEWEED", @@ -5177,6 +5735,95 @@ static const char *const STATE_LIST[] = { // array length left dynamic for sanit "S_CACTI2", "S_CACTI3", "S_CACTI4", + "S_CACTI5", + "S_CACTI6", + "S_CACTI7", + "S_CACTI8", + "S_CACTI9", + + // Warning signs sprites + "S_ARIDSIGN_CAUTION", + "S_ARIDSIGN_CACTI", + "S_ARIDSIGN_SHARPTURN", + + // Oil lamp + "S_OILLAMP", + "S_OILLAMPFLARE", + + // TNT barrel + "S_TNTBARREL_STND1", + "S_TNTBARREL_EXPL1", + "S_TNTBARREL_EXPL2", + "S_TNTBARREL_EXPL3", + "S_TNTBARREL_EXPL4", + "S_TNTBARREL_EXPL5", + "S_TNTBARREL_EXPL6", + "S_TNTBARREL_FLYING", + + // TNT proximity shell + "S_PROXIMITY_TNT", + "S_PROXIMITY_TNT_TRIGGER1", + "S_PROXIMITY_TNT_TRIGGER2", + "S_PROXIMITY_TNT_TRIGGER3", + "S_PROXIMITY_TNT_TRIGGER4", + "S_PROXIMITY_TNT_TRIGGER5", + "S_PROXIMITY_TNT_TRIGGER6", + "S_PROXIMITY_TNT_TRIGGER7", + "S_PROXIMITY_TNT_TRIGGER8", + "S_PROXIMITY_TNT_TRIGGER9", + "S_PROXIMITY_TNT_TRIGGER10", + "S_PROXIMITY_TNT_TRIGGER11", + "S_PROXIMITY_TNT_TRIGGER12", + "S_PROXIMITY_TNT_TRIGGER13", + "S_PROXIMITY_TNT_TRIGGER14", + "S_PROXIMITY_TNT_TRIGGER15", + "S_PROXIMITY_TNT_TRIGGER16", + "S_PROXIMITY_TNT_TRIGGER17", + "S_PROXIMITY_TNT_TRIGGER18", + "S_PROXIMITY_TNT_TRIGGER19", + "S_PROXIMITY_TNT_TRIGGER20", + "S_PROXIMITY_TNT_TRIGGER21", + "S_PROXIMITY_TNT_TRIGGER22", + "S_PROXIMITY_TNT_TRIGGER23", + + // Dust devil + "S_DUSTDEVIL", + "S_DUSTLAYER1", + "S_DUSTLAYER2", + "S_DUSTLAYER3", + "S_DUSTLAYER4", + "S_DUSTLAYER5", + "S_ARIDDUST1", + "S_ARIDDUST2", + "S_ARIDDUST3", + + // Minecart + "S_MINECART_IDLE", + "S_MINECART_DTH1", + "S_MINECARTEND", + "S_MINECARTSEG_FRONT", + "S_MINECARTSEG_BACK", + "S_MINECARTSEG_LEFT", + "S_MINECARTSEG_RIGHT", + "S_MINECARTSIDEMARK1", + "S_MINECARTSIDEMARK2", + "S_MINECARTSPARK", + + // Saloon door + "S_SALOONDOOR", + "S_SALOONDOORTHINKER", + + // Train cameo + "S_TRAINCAMEOSPAWNER_1", + "S_TRAINCAMEOSPAWNER_2", + "S_TRAINCAMEOSPAWNER_3", + "S_TRAINCAMEOSPAWNER_4", + "S_TRAINCAMEOSPAWNER_5", + "S_TRAINPUFFMAKER", + + // Train + "S_TRAINDUST", + "S_TRAINSTEAM", // Flame jet "S_FLAMEJETSTND", @@ -5189,36 +5836,13 @@ static const char *const STATE_LIST[] = { // array length left dynamic for sanit // Spinning flame jets "S_FJSPINAXISA1", // Counter-clockwise "S_FJSPINAXISA2", - "S_FJSPINAXISA3", - "S_FJSPINAXISA4", - "S_FJSPINAXISA5", - "S_FJSPINAXISA6", - "S_FJSPINAXISA7", - "S_FJSPINAXISA8", - "S_FJSPINAXISA9", - "S_FJSPINHELPERA1", - "S_FJSPINHELPERA2", - "S_FJSPINHELPERA3", "S_FJSPINAXISB1", // Clockwise "S_FJSPINAXISB2", - "S_FJSPINAXISB3", - "S_FJSPINAXISB4", - "S_FJSPINAXISB5", - "S_FJSPINAXISB6", - "S_FJSPINAXISB7", - "S_FJSPINAXISB8", - "S_FJSPINAXISB9", - "S_FJSPINHELPERB1", - "S_FJSPINHELPERB2", - "S_FJSPINHELPERB3", // Blade's flame "S_FLAMEJETFLAMEB1", "S_FLAMEJETFLAMEB2", "S_FLAMEJETFLAMEB3", - "S_FLAMEJETFLAMEB4", - "S_FLAMEJETFLAMEB5", - "S_FLAMEJETFLAMEB6", // Trapgoyles "S_TRAPGOYLE", @@ -5266,7 +5890,63 @@ static const char *const STATE_LIST[] = { // array length left dynamic for sanit // Xmas-specific stuff "S_XMASPOLE", "S_CANDYCANE", - "S_SNOWMAN", + "S_SNOWMAN", // normal + "S_SNOWMANHAT", // with hat + scarf + "S_LAMPPOST1", // normal + "S_LAMPPOST2", // with snow + "S_HANGSTAR", + // Xmas GFZ bushes + "S_XMASBLUEBERRYBUSH", + "S_XMASBERRYBUSH", + "S_XMASBUSH", + // FHZ + "S_FHZICE1", + "S_FHZICE2", + + // Halloween Scenery + // Pumpkins + "S_JACKO1", + "S_JACKO1OVERLAY_1", + "S_JACKO1OVERLAY_2", + "S_JACKO1OVERLAY_3", + "S_JACKO1OVERLAY_4", + "S_JACKO2", + "S_JACKO2OVERLAY_1", + "S_JACKO2OVERLAY_2", + "S_JACKO2OVERLAY_3", + "S_JACKO2OVERLAY_4", + "S_JACKO3", + "S_JACKO3OVERLAY_1", + "S_JACKO3OVERLAY_2", + "S_JACKO3OVERLAY_3", + "S_JACKO3OVERLAY_4", + // Dr Seuss Trees + "S_HHZTREE_TOP", + "S_HHZTREE_TRUNK", + "S_HHZTREE_LEAF", + // Mushroom + "S_HHZSHROOM_1", + "S_HHZSHROOM_2", + "S_HHZSHROOM_3", + "S_HHZSHROOM_4", + "S_HHZSHROOM_5", + "S_HHZSHROOM_6", + "S_HHZSHROOM_7", + "S_HHZSHROOM_8", + "S_HHZSHROOM_9", + "S_HHZSHROOM_10", + "S_HHZSHROOM_11", + "S_HHZSHROOM_12", + "S_HHZSHROOM_13", + "S_HHZSHROOM_14", + "S_HHZSHROOM_15", + "S_HHZSHROOM_16", + // Misc + "S_HHZGRASS", + "S_HHZTENT1", + "S_HHZTENT2", + "S_HHZSTALAGMITE_TALL", + "S_HHZSTALAGMITE_SHORT", // Botanic Serenity's loads of scenery states "S_BSZTALLFLOWER_RED", @@ -5313,8 +5993,10 @@ static const char *const STATE_LIST[] = { // array length left dynamic for sanit "S_BSZVINE_ORANGE", "S_BSZSHRUB", "S_BSZCLOVER", - "S_BSZFISH", - "S_BSZSUNFLOWER", + "S_BIG_PALMTREE_TRUNK", + "S_BIG_PALMTREE_TOP", + "S_PALMTREE_TRUNK", + "S_PALMTREE_TOP", "S_DBALL1", "S_DBALL2", @@ -5358,6 +6040,22 @@ static const char *const STATE_LIST[] = { // array length left dynamic for sanit "S_ARMF14", "S_ARMF15", "S_ARMF16", + "S_ARMF17", + "S_ARMF18", + "S_ARMF19", + "S_ARMF20", + "S_ARMF21", + "S_ARMF22", + "S_ARMF23", + "S_ARMF24", + "S_ARMF25", + "S_ARMF26", + "S_ARMF27", + "S_ARMF28", + "S_ARMF29", + "S_ARMF30", + "S_ARMF31", + "S_ARMF32", "S_ARMB1", "S_ARMB2", @@ -5375,6 +6073,22 @@ static const char *const STATE_LIST[] = { // array length left dynamic for sanit "S_ARMB14", "S_ARMB15", "S_ARMB16", + "S_ARMB17", + "S_ARMB18", + "S_ARMB19", + "S_ARMB20", + "S_ARMB21", + "S_ARMB22", + "S_ARMB23", + "S_ARMB24", + "S_ARMB25", + "S_ARMB26", + "S_ARMB27", + "S_ARMB28", + "S_ARMB29", + "S_ARMB30", + "S_ARMB31", + "S_ARMB32", "S_WIND1", "S_WIND2", @@ -5397,6 +6111,7 @@ static const char *const STATE_LIST[] = { // array length left dynamic for sanit "S_MAGN10", "S_MAGN11", "S_MAGN12", + "S_MAGN13", "S_FORC1", "S_FORC2", @@ -5420,6 +6135,8 @@ static const char *const STATE_LIST[] = { // array length left dynamic for sanit "S_FORC19", "S_FORC20", + "S_FORC21", + "S_ELEM1", "S_ELEM2", "S_ELEM3", @@ -5433,6 +6150,9 @@ static const char *const STATE_LIST[] = { // array length left dynamic for sanit "S_ELEM11", "S_ELEM12", + "S_ELEM13", + "S_ELEM14", + "S_ELEMF1", "S_ELEMF2", "S_ELEMF3", @@ -5441,6 +6161,8 @@ static const char *const STATE_LIST[] = { // array length left dynamic for sanit "S_ELEMF6", "S_ELEMF7", "S_ELEMF8", + "S_ELEMF9", + "S_ELEMF10", "S_PITY1", "S_PITY2", @@ -5448,10 +6170,84 @@ static const char *const STATE_LIST[] = { // array length left dynamic for sanit "S_PITY4", "S_PITY5", "S_PITY6", - "S_PITY7", - "S_PITY8", - "S_PITY9", - "S_PITY10", + + "S_FIRS1", + "S_FIRS2", + "S_FIRS3", + "S_FIRS4", + "S_FIRS5", + "S_FIRS6", + "S_FIRS7", + "S_FIRS8", + "S_FIRS9", + + "S_FIRS10", + "S_FIRS11", + + "S_FIRSB1", + "S_FIRSB2", + "S_FIRSB3", + "S_FIRSB4", + "S_FIRSB5", + "S_FIRSB6", + "S_FIRSB7", + "S_FIRSB8", + "S_FIRSB9", + + "S_FIRSB10", + + "S_BUBS1", + "S_BUBS2", + "S_BUBS3", + "S_BUBS4", + "S_BUBS5", + "S_BUBS6", + "S_BUBS7", + "S_BUBS8", + "S_BUBS9", + + "S_BUBS10", + "S_BUBS11", + + "S_BUBSB1", + "S_BUBSB2", + "S_BUBSB3", + "S_BUBSB4", + + "S_BUBSB5", + "S_BUBSB6", + + "S_ZAPS1", + "S_ZAPS2", + "S_ZAPS3", + "S_ZAPS4", + "S_ZAPS5", + "S_ZAPS6", + "S_ZAPS7", + "S_ZAPS8", + "S_ZAPS9", + "S_ZAPS10", + "S_ZAPS11", + "S_ZAPS12", + "S_ZAPS13", // blank frame + "S_ZAPS14", + "S_ZAPS15", + "S_ZAPS16", + + "S_ZAPSB1", // blank frame + "S_ZAPSB2", + "S_ZAPSB3", + "S_ZAPSB4", + "S_ZAPSB5", + "S_ZAPSB6", + "S_ZAPSB7", + "S_ZAPSB8", + "S_ZAPSB9", + "S_ZAPSB10", + "S_ZAPSB11", // blank frame + + // Thunder spark + "S_THUNDERCOIN_SPARK", // Invincibility Sparkles "S_IVSP", @@ -5463,57 +6259,228 @@ static const char *const STATE_LIST[] = { // array length left dynamic for sanit "S_SSPK4", "S_SSPK5", - // Freed Birdie - "S_BIRD1", - "S_BIRD2", - "S_BIRD3", + // Flicky-sized bubble + "S_FLICKY_BUBBLE", - // Freed Bunny - "S_BUNNY1", - "S_BUNNY2", - "S_BUNNY3", - "S_BUNNY4", - "S_BUNNY5", - "S_BUNNY6", - "S_BUNNY7", - "S_BUNNY8", - "S_BUNNY9", - "S_BUNNY10", + // Bluebird + "S_FLICKY_01_OUT", + "S_FLICKY_01_FLAP1", + "S_FLICKY_01_FLAP2", + "S_FLICKY_01_FLAP3", + "S_FLICKY_01_STAND", + "S_FLICKY_01_CENTER", - // Freed Mouse - "S_MOUSE1", - "S_MOUSE2", + // Rabbit + "S_FLICKY_02_OUT", + "S_FLICKY_02_AIM", + "S_FLICKY_02_HOP", + "S_FLICKY_02_UP", + "S_FLICKY_02_DOWN", + "S_FLICKY_02_STAND", + "S_FLICKY_02_CENTER", - // Freed Chicken - "S_CHICKEN1", - "S_CHICKENHOP", - "S_CHICKENFLY1", - "S_CHICKENFLY2", + // Chicken + "S_FLICKY_03_OUT", + "S_FLICKY_03_AIM", + "S_FLICKY_03_HOP", + "S_FLICKY_03_UP", + "S_FLICKY_03_FLAP1", + "S_FLICKY_03_FLAP2", + "S_FLICKY_03_STAND", + "S_FLICKY_03_CENTER", - // Freed Cow - "S_COW1", - "S_COW2", - "S_COW3", - "S_COW4", + // Seal + "S_FLICKY_04_OUT", + "S_FLICKY_04_AIM", + "S_FLICKY_04_HOP", + "S_FLICKY_04_UP", + "S_FLICKY_04_DOWN", + "S_FLICKY_04_SWIM1", + "S_FLICKY_04_SWIM2", + "S_FLICKY_04_SWIM3", + "S_FLICKY_04_SWIM4", + "S_FLICKY_04_STAND", + "S_FLICKY_04_CENTER", - // Red Birdie in Bubble - "S_RBIRD1", - "S_RBIRD2", - "S_RBIRD3", + // Pig + "S_FLICKY_05_OUT", + "S_FLICKY_05_AIM", + "S_FLICKY_05_HOP", + "S_FLICKY_05_UP", + "S_FLICKY_05_DOWN", + "S_FLICKY_05_STAND", + "S_FLICKY_05_CENTER", + // Chipmunk + "S_FLICKY_06_OUT", + "S_FLICKY_06_AIM", + "S_FLICKY_06_HOP", + "S_FLICKY_06_UP", + "S_FLICKY_06_DOWN", + "S_FLICKY_06_STAND", + "S_FLICKY_06_CENTER", + + // Penguin + "S_FLICKY_07_OUT", + "S_FLICKY_07_AIML", + "S_FLICKY_07_HOPL", + "S_FLICKY_07_UPL", + "S_FLICKY_07_DOWNL", + "S_FLICKY_07_AIMR", + "S_FLICKY_07_HOPR", + "S_FLICKY_07_UPR", + "S_FLICKY_07_DOWNR", + "S_FLICKY_07_SWIM1", + "S_FLICKY_07_SWIM2", + "S_FLICKY_07_SWIM3", + "S_FLICKY_07_STAND", + "S_FLICKY_07_CENTER", + + // Fish + "S_FLICKY_08_OUT", + "S_FLICKY_08_AIM", + "S_FLICKY_08_HOP", + "S_FLICKY_08_FLAP1", + "S_FLICKY_08_FLAP2", + "S_FLICKY_08_FLAP3", + "S_FLICKY_08_FLAP4", + "S_FLICKY_08_SWIM1", + "S_FLICKY_08_SWIM2", + "S_FLICKY_08_SWIM3", + "S_FLICKY_08_SWIM4", + "S_FLICKY_08_STAND", + "S_FLICKY_08_CENTER", + + // Ram + "S_FLICKY_09_OUT", + "S_FLICKY_09_AIM", + "S_FLICKY_09_HOP", + "S_FLICKY_09_UP", + "S_FLICKY_09_DOWN", + "S_FLICKY_09_STAND", + "S_FLICKY_09_CENTER", + + // Puffin + "S_FLICKY_10_OUT", + "S_FLICKY_10_FLAP1", + "S_FLICKY_10_FLAP2", + "S_FLICKY_10_STAND", + "S_FLICKY_10_CENTER", + + // Cow + "S_FLICKY_11_OUT", + "S_FLICKY_11_AIM", + "S_FLICKY_11_RUN1", + "S_FLICKY_11_RUN2", + "S_FLICKY_11_RUN3", + "S_FLICKY_11_STAND", + "S_FLICKY_11_CENTER", + + // Rat + "S_FLICKY_12_OUT", + "S_FLICKY_12_AIM", + "S_FLICKY_12_RUN1", + "S_FLICKY_12_RUN2", + "S_FLICKY_12_RUN3", + "S_FLICKY_12_STAND", + "S_FLICKY_12_CENTER", + + // Bear + "S_FLICKY_13_OUT", + "S_FLICKY_13_AIM", + "S_FLICKY_13_HOP", + "S_FLICKY_13_UP", + "S_FLICKY_13_DOWN", + "S_FLICKY_13_STAND", + "S_FLICKY_13_CENTER", + + // Dove + "S_FLICKY_14_OUT", + "S_FLICKY_14_FLAP1", + "S_FLICKY_14_FLAP2", + "S_FLICKY_14_FLAP3", + "S_FLICKY_14_STAND", + "S_FLICKY_14_CENTER", + + // Cat + "S_FLICKY_15_OUT", + "S_FLICKY_15_AIM", + "S_FLICKY_15_HOP", + "S_FLICKY_15_UP", + "S_FLICKY_15_DOWN", + "S_FLICKY_15_STAND", + "S_FLICKY_15_CENTER", + + // Canary + "S_FLICKY_16_OUT", + "S_FLICKY_16_FLAP1", + "S_FLICKY_16_FLAP2", + "S_FLICKY_16_FLAP3", + "S_FLICKY_16_STAND", + "S_FLICKY_16_CENTER", + + // Spider + "S_SECRETFLICKY_01_OUT", + "S_SECRETFLICKY_01_AIM", + "S_SECRETFLICKY_01_HOP", + "S_SECRETFLICKY_01_UP", + "S_SECRETFLICKY_01_DOWN", + "S_SECRETFLICKY_01_STAND", + "S_SECRETFLICKY_01_CENTER", + + // Bat + "S_SECRETFLICKY_02_OUT", + "S_SECRETFLICKY_02_FLAP1", + "S_SECRETFLICKY_02_FLAP2", + "S_SECRETFLICKY_02_FLAP3", + "S_SECRETFLICKY_02_STAND", + "S_SECRETFLICKY_02_CENTER", + + // Fan + "S_FAN", + "S_FAN2", + "S_FAN3", + "S_FAN4", + "S_FAN5", + + // Steam Riser + "S_STEAM1", + "S_STEAM2", + "S_STEAM3", + "S_STEAM4", + "S_STEAM5", + "S_STEAM6", + "S_STEAM7", + "S_STEAM8", + + // Bumpers + "S_BUMPER", + "S_BUMPERHIT", + + // Balloons + "S_BALLOON", + "S_BALLOONPOP1", + "S_BALLOONPOP2", + "S_BALLOONPOP3", + "S_BALLOONPOP4", + "S_BALLOONPOP5", + "S_BALLOONPOP6", + + // Yellow Spring "S_YELLOWSPRING", "S_YELLOWSPRING2", "S_YELLOWSPRING3", "S_YELLOWSPRING4", "S_YELLOWSPRING5", + // Red Spring "S_REDSPRING", "S_REDSPRING2", "S_REDSPRING3", "S_REDSPRING4", "S_REDSPRING5", - // Blue Springs + // Blue Spring "S_BLUESPRING", "S_BLUESPRING2", "S_BLUESPRING3", @@ -5540,6 +6507,46 @@ static const char *const STATE_LIST[] = { // array length left dynamic for sanit "S_RDIAG7", "S_RDIAG8", + // Blue Diagonal Spring + "S_BDIAG1", + "S_BDIAG2", + "S_BDIAG3", + "S_BDIAG4", + "S_BDIAG5", + "S_BDIAG6", + "S_BDIAG7", + "S_BDIAG8", + + // Yellow Side Spring + "S_YHORIZ1", + "S_YHORIZ2", + "S_YHORIZ3", + "S_YHORIZ4", + "S_YHORIZ5", + "S_YHORIZ6", + "S_YHORIZ7", + "S_YHORIZ8", + + // Red Side Spring + "S_RHORIZ1", + "S_RHORIZ2", + "S_RHORIZ3", + "S_RHORIZ4", + "S_RHORIZ5", + "S_RHORIZ6", + "S_RHORIZ7", + "S_RHORIZ8", + + // Blue Side Spring + "S_BHORIZ1", + "S_BHORIZ2", + "S_BHORIZ3", + "S_BHORIZ4", + "S_BHORIZ5", + "S_BHORIZ6", + "S_BHORIZ7", + "S_BHORIZ8", + // Rain "S_RAIN1", "S_RAINRETURN", @@ -5574,14 +6581,29 @@ static const char *const STATE_LIST[] = { // array length left dynamic for sanit // Bubbles "S_SMALLBUBBLE", - "S_SMALLBUBBLE1", "S_MEDIUMBUBBLE", - "S_MEDIUMBUBBLE1", - "S_LARGEBUBBLE", + "S_LARGEBUBBLE1", + "S_LARGEBUBBLE2", "S_EXTRALARGEBUBBLE", // breathable "S_POP1", // Extra Large bubble goes POP! + "S_WATERZAP", + + // Spindash dust + "S_SPINDUST1", + "S_SPINDUST2", + "S_SPINDUST3", + "S_SPINDUST4", + "S_SPINDUST_BUBBLE1", + "S_SPINDUST_BUBBLE2", + "S_SPINDUST_BUBBLE3", + "S_SPINDUST_BUBBLE4", + "S_SPINDUST_FIRE1", + "S_SPINDUST_FIRE2", + "S_SPINDUST_FIRE3", + "S_SPINDUST_FIRE4", + "S_FOG1", "S_FOG2", "S_FOG3", @@ -5600,7 +6622,6 @@ static const char *const STATE_LIST[] = { // array length left dynamic for sanit "S_SEED", "S_PARTICLE", - "S_PARTICLEGEN", // Score Logos "S_SCRA", // 100 @@ -5614,6 +6635,7 @@ static const char *const STATE_LIST[] = { // array length left dynamic for sanit "S_SCRI", // 4000 (mario) "S_SCRJ", // 8000 (mario) "S_SCRK", // 1UP (mario) + "S_SCRL", // 10 // Drowning Timer Numbers "S_ZERO1", @@ -5623,14 +6645,23 @@ static const char *const STATE_LIST[] = { // array length left dynamic for sanit "S_FOUR1", "S_FIVE1", + "S_ZERO2", + "S_ONE2", + "S_TWO2", + "S_THREE2", + "S_FOUR2", + "S_FIVE2", + + "S_LOCKON1", + "S_LOCKON2", + // Tag Sign - "S_TTAG1", + "S_TTAG", // Got Flag Sign - "S_GOTFLAG1", - "S_GOTFLAG2", - "S_GOTFLAG3", - "S_GOTFLAG4", + "S_GOTFLAG", + + "S_CORK", // Red Ring "S_RRNG1", @@ -5805,20 +6836,19 @@ static const char *const STATE_LIST[] = { // array length left dynamic for sanit "S_FIREBALLEXP2", "S_FIREBALLEXP3", "S_SHELL", - "S_SHELL1", - "S_SHELL2", - "S_SHELL3", - "S_SHELL4", - "S_PUMA1", - "S_PUMA2", - "S_PUMA3", - "S_PUMA4", - "S_PUMA5", - "S_PUMA6", - "S_HAMMER1", - "S_HAMMER2", - "S_HAMMER3", - "S_HAMMER4", + "S_PUMA_START1", + "S_PUMA_START2", + "S_PUMA_UP1", + "S_PUMA_UP2", + "S_PUMA_UP3", + "S_PUMA_DOWN1", + "S_PUMA_DOWN2", + "S_PUMA_DOWN3", + "S_PUMATRAIL1", + "S_PUMATRAIL2", + "S_PUMATRAIL3", + "S_PUMATRAIL4", + "S_HAMMER", "S_KOOPA1", "S_KOOPA2", "S_KOOPAFLAME1", @@ -5832,8 +6862,8 @@ static const char *const STATE_LIST[] = { // array length left dynamic for sanit "S_TOAD", // Nights-specific stuff - "S_NIGHTSDRONE1", - "S_NIGHTSDRONE2", + "S_NIGHTSDRONE_MAN1", + "S_NIGHTSDRONE_MAN2", "S_NIGHTSDRONE_SPARKLING1", "S_NIGHTSDRONE_SPARKLING2", "S_NIGHTSDRONE_SPARKLING3", @@ -5850,97 +6880,10 @@ static const char *const STATE_LIST[] = { // array length left dynamic for sanit "S_NIGHTSDRONE_SPARKLING14", "S_NIGHTSDRONE_SPARKLING15", "S_NIGHTSDRONE_SPARKLING16", - "S_NIGHTSGOAL1", - "S_NIGHTSGOAL2", - "S_NIGHTSGOAL3", - "S_NIGHTSGOAL4", - - "S_NIGHTSFLY1A", - "S_NIGHTSFLY1B", - "S_NIGHTSDRILL1A", - "S_NIGHTSDRILL1B", - "S_NIGHTSDRILL1C", - "S_NIGHTSDRILL1D", - "S_NIGHTSFLY2A", - "S_NIGHTSFLY2B", - "S_NIGHTSDRILL2A", - "S_NIGHTSDRILL2B", - "S_NIGHTSDRILL2C", - "S_NIGHTSDRILL2D", - "S_NIGHTSFLY3A", - "S_NIGHTSFLY3B", - "S_NIGHTSDRILL3A", - "S_NIGHTSDRILL3B", - "S_NIGHTSDRILL3C", - "S_NIGHTSDRILL3D", - "S_NIGHTSFLY4A", - "S_NIGHTSFLY4B", - "S_NIGHTSDRILL4A", - "S_NIGHTSDRILL4B", - "S_NIGHTSDRILL4C", - "S_NIGHTSDRILL4D", - "S_NIGHTSFLY5A", - "S_NIGHTSFLY5B", - "S_NIGHTSDRILL5A", - "S_NIGHTSDRILL5B", - "S_NIGHTSDRILL5C", - "S_NIGHTSDRILL5D", - "S_NIGHTSFLY6A", - "S_NIGHTSFLY6B", - "S_NIGHTSDRILL6A", - "S_NIGHTSDRILL6B", - "S_NIGHTSDRILL6C", - "S_NIGHTSDRILL6D", - "S_NIGHTSFLY7A", - "S_NIGHTSFLY7B", - "S_NIGHTSDRILL7A", - "S_NIGHTSDRILL7B", - "S_NIGHTSDRILL7C", - "S_NIGHTSDRILL7D", - "S_NIGHTSFLY8A", - "S_NIGHTSFLY8B", - "S_NIGHTSDRILL8A", - "S_NIGHTSDRILL8B", - "S_NIGHTSDRILL8C", - "S_NIGHTSDRILL8D", - "S_NIGHTSFLY9A", - "S_NIGHTSFLY9B", - "S_NIGHTSDRILL9A", - "S_NIGHTSDRILL9B", - "S_NIGHTSDRILL9C", - "S_NIGHTSDRILL9D", - "S_NIGHTSHURT1", - "S_NIGHTSHURT2", - "S_NIGHTSHURT3", - "S_NIGHTSHURT4", - "S_NIGHTSHURT5", - "S_NIGHTSHURT6", - "S_NIGHTSHURT7", - "S_NIGHTSHURT8", - "S_NIGHTSHURT9", - "S_NIGHTSHURT10", - "S_NIGHTSHURT11", - "S_NIGHTSHURT12", - "S_NIGHTSHURT13", - "S_NIGHTSHURT14", - "S_NIGHTSHURT15", - "S_NIGHTSHURT16", - "S_NIGHTSHURT17", - "S_NIGHTSHURT18", - "S_NIGHTSHURT19", - "S_NIGHTSHURT20", - "S_NIGHTSHURT21", - "S_NIGHTSHURT22", - "S_NIGHTSHURT23", - "S_NIGHTSHURT24", - "S_NIGHTSHURT25", - "S_NIGHTSHURT26", - "S_NIGHTSHURT27", - "S_NIGHTSHURT28", - "S_NIGHTSHURT29", - "S_NIGHTSHURT30", - "S_NIGHTSHURT31", - "S_NIGHTSHURT32", + "S_NIGHTSDRONE_GOAL1", + "S_NIGHTSDRONE_GOAL2", + "S_NIGHTSDRONE_GOAL3", + "S_NIGHTSDRONE_GOAL4", "S_NIGHTSPARKLE1", "S_NIGHTSPARKLE2", @@ -5991,20 +6934,12 @@ static const char *const STATE_LIST[] = { // array length left dynamic for sanit "S_NIGHTSCORE90_2", "S_NIGHTSCORE100_2", - "S_NIGHTSWING", - "S_NIGHTSWING_XMAS", - // NiGHTS Paraloop Powerups - "S_NIGHTSPOWERUP1", - "S_NIGHTSPOWERUP2", - "S_NIGHTSPOWERUP3", - "S_NIGHTSPOWERUP4", - "S_NIGHTSPOWERUP5", - "S_NIGHTSPOWERUP6", - "S_NIGHTSPOWERUP7", - "S_NIGHTSPOWERUP8", - "S_NIGHTSPOWERUP9", - "S_NIGHTSPOWERUP10", + "S_NIGHTSSUPERLOOP", + "S_NIGHTSDRILLREFILL", + "S_NIGHTSHELPER", + "S_NIGHTSEXTRATIME", + "S_NIGHTSLINKFREEZE", "S_EGGCAPSULE", // Orbiting Chaos Emeralds @@ -6016,14 +6951,11 @@ static const char *const STATE_LIST[] = { // array length left dynamic for sanit "S_ORBITEM6", "S_ORBITEM7", "S_ORBITEM8", - "S_ORBITEM9", - "S_ORBITEM10", - "S_ORBITEM11", - "S_ORBITEM12", - "S_ORBITEM13", - "S_ORBITEM14", - "S_ORBITEM15", - "S_ORBITEM16", + "S_ORBIDYA1", + "S_ORBIDYA2", + "S_ORBIDYA3", + "S_ORBIDYA4", + "S_ORBIDYA5", // "Flicky" helper "S_NIGHTOPIANHELPER1", @@ -6034,20 +6966,146 @@ static const char *const STATE_LIST[] = { // array length left dynamic for sanit "S_NIGHTOPIANHELPER6", "S_NIGHTOPIANHELPER7", "S_NIGHTOPIANHELPER8", + "S_NIGHTOPIANHELPER9", + + // Nightopian + "S_PIAN0", + "S_PIAN1", + "S_PIAN2", + "S_PIAN3", + "S_PIAN4", + "S_PIAN5", + "S_PIAN6", + "S_PIANSING", + + // Shleep + "S_SHLEEP1", + "S_SHLEEP2", + "S_SHLEEP3", + "S_SHLEEP4", + "S_SHLEEPBOUNCE1", + "S_SHLEEPBOUNCE2", + "S_SHLEEPBOUNCE3", + + // Secret badniks and hazards, shhhh + "S_PENGUINATOR_LOOK", + "S_PENGUINATOR_WADDLE1", + "S_PENGUINATOR_WADDLE2", + "S_PENGUINATOR_WADDLE3", + "S_PENGUINATOR_WADDLE4", + "S_PENGUINATOR_SLIDE1", + "S_PENGUINATOR_SLIDE2", + "S_PENGUINATOR_SLIDE3", + "S_PENGUINATOR_SLIDE4", + "S_PENGUINATOR_SLIDE5", + + "S_POPHAT_LOOK", + "S_POPHAT_SHOOT1", + "S_POPHAT_SHOOT2", + "S_POPHAT_SHOOT3", + + "S_HIVEELEMENTAL_LOOK", + "S_HIVEELEMENTAL_PREPARE1", + "S_HIVEELEMENTAL_PREPARE2", + "S_HIVEELEMENTAL_SHOOT1", + "S_HIVEELEMENTAL_SHOOT2", + "S_HIVEELEMENTAL_DORMANT", + "S_HIVEELEMENTAL_PAIN", + "S_HIVEELEMENTAL_DIE1", + "S_HIVEELEMENTAL_DIE2", + "S_HIVEELEMENTAL_DIE3", + + "S_BUMBLEBORE_SPAWN", + "S_BUMBLEBORE_LOOK1", + "S_BUMBLEBORE_LOOK2", + "S_BUMBLEBORE_FLY1", + "S_BUMBLEBORE_FLY2", + "S_BUMBLEBORE_RAISE", + "S_BUMBLEBORE_FALL1", + "S_BUMBLEBORE_FALL2", + "S_BUMBLEBORE_STUCK1", + "S_BUMBLEBORE_STUCK2", + "S_BUMBLEBORE_DIE", + + "S_BBUZZFLY1", + "S_BBUZZFLY2", + + "S_SMASHSPIKE_FLOAT", + "S_SMASHSPIKE_EASE1", + "S_SMASHSPIKE_EASE2", + "S_SMASHSPIKE_FALL", + "S_SMASHSPIKE_STOMP1", + "S_SMASHSPIKE_STOMP2", + "S_SMASHSPIKE_RISE1", + "S_SMASHSPIKE_RISE2", + + "S_CACO_LOOK", + "S_CACO_WAKE1", + "S_CACO_WAKE2", + "S_CACO_WAKE3", + "S_CACO_WAKE4", + "S_CACO_ROAR", + "S_CACO_CHASE", + "S_CACO_CHASE_REPEAT", + "S_CACO_RANDOM", + "S_CACO_PREPARE_SOUND", + "S_CACO_PREPARE1", + "S_CACO_PREPARE2", + "S_CACO_PREPARE3", + "S_CACO_SHOOT_SOUND", + "S_CACO_SHOOT1", + "S_CACO_SHOOT2", + "S_CACO_CLOSE", + "S_CACO_DIE_FLAGS", + "S_CACO_DIE_GIB1", + "S_CACO_DIE_GIB2", + "S_CACO_DIE_SCREAM", + "S_CACO_DIE_SHATTER", + "S_CACO_DIE_FALL", + "S_CACOSHARD_RANDOMIZE", + "S_CACOSHARD1_1", + "S_CACOSHARD1_2", + "S_CACOSHARD2_1", + "S_CACOSHARD2_2", + "S_CACOFIRE1", + "S_CACOFIRE2", + "S_CACOFIRE3", + "S_CACOFIRE_EXPLODE1", + "S_CACOFIRE_EXPLODE2", + "S_CACOFIRE_EXPLODE3", + "S_CACOFIRE_EXPLODE4", + + "S_SPINBOBERT_MOVE_FLIPUP", + "S_SPINBOBERT_MOVE_UP", + "S_SPINBOBERT_MOVE_FLIPDOWN", + "S_SPINBOBERT_MOVE_DOWN", + "S_SPINBOBERT_FIRE_MOVE", + "S_SPINBOBERT_FIRE_GHOST", + "S_SPINBOBERT_FIRE_TRAIL1", + "S_SPINBOBERT_FIRE_TRAIL2", + "S_SPINBOBERT_FIRE_TRAIL3", + + "S_HANGSTER_LOOK", + "S_HANGSTER_SWOOP1", + "S_HANGSTER_SWOOP2", + "S_HANGSTER_ARC1", + "S_HANGSTER_ARC2", + "S_HANGSTER_ARC3", + "S_HANGSTER_FLY1", + "S_HANGSTER_FLY2", + "S_HANGSTER_FLY3", + "S_HANGSTER_FLY4", + "S_HANGSTER_FLYREPEAT", + "S_HANGSTER_ARCUP1", + "S_HANGSTER_ARCUP2", + "S_HANGSTER_ARCUP3", + "S_HANGSTER_RETURN1", + "S_HANGSTER_RETURN2", + "S_HANGSTER_RETURN3", "S_CRUMBLE1", "S_CRUMBLE2", - "S_SUPERTRANS1", - "S_SUPERTRANS2", - "S_SUPERTRANS3", - "S_SUPERTRANS4", - "S_SUPERTRANS5", - "S_SUPERTRANS6", - "S_SUPERTRANS7", - "S_SUPERTRANS8", - "S_SUPERTRANS9", - // Spark "S_SPRK1", "S_SPRK2", @@ -6067,10 +7125,14 @@ static const char *const STATE_LIST[] = { // array length left dynamic for sanit "S_SPRK16", // Robot Explosion + "S_XPLD_FLICKY", "S_XPLD1", "S_XPLD2", "S_XPLD3", "S_XPLD4", + "S_XPLD5", + "S_XPLD6", + "S_XPLD_EGGTRAP", // Underwater Explosion "S_WPLD1", @@ -6080,6 +7142,13 @@ static const char *const STATE_LIST[] = { // array length left dynamic for sanit "S_WPLD5", "S_WPLD6", + "S_DUST1", + "S_DUST2", + "S_DUST3", + "S_DUST4", + + "S_WOODDEBRIS", + "S_ROCKSPAWN", "S_ROCKCRUMBLEA", @@ -6099,70 +7168,6 @@ static const char *const STATE_LIST[] = { // array length left dynamic for sanit "S_ROCKCRUMBLEO", "S_ROCKCRUMBLEP", - "S_SRB1_CRAWLA1", - "S_SRB1_CRAWLA2", - "S_SRB1_CRAWLA3", - "S_SRB1_CRAWLA4", - - "S_SRB1_BAT1", - "S_SRB1_BAT2", - "S_SRB1_BAT3", - "S_SRB1_BAT4", - - "S_SRB1_ROBOFISH1", - "S_SRB1_ROBOFISH2", - "S_SRB1_ROBOFISH3", - - "S_SRB1_VOLCANOGUY1", - "S_SRB1_VOLCANOGUY2", - - "S_SRB1_HOPPY1", - "S_SRB1_HOPPY2", - - "S_SRB1_HOPPYWATER1", - "S_SRB1_HOPPYWATER2", - - "S_SRB1_HOPPYSKYLAB1", - - "S_SRB1_MMZFLYING1", - "S_SRB1_MMZFLYING2", - "S_SRB1_MMZFLYING3", - "S_SRB1_MMZFLYING4", - "S_SRB1_MMZFLYING5", - - "S_SRB1_UFO1", - "S_SRB1_UFO2", - - "S_SRB1_GRAYBOT1", - "S_SRB1_GRAYBOT2", - "S_SRB1_GRAYBOT3", - "S_SRB1_GRAYBOT4", - "S_SRB1_GRAYBOT5", - "S_SRB1_GRAYBOT6", - - "S_SRB1_ROBOTOPOLIS1", - "S_SRB1_ROBOTOPOLIS2", - - "S_SRB1_RBZBUZZ1", - "S_SRB1_RBZBUZZ2", - - "S_SRB1_RBZSPIKES1", - "S_SRB1_RBZSPIKES2", - - "S_SRB1_METALSONIC1", - "S_SRB1_METALSONIC2", - "S_SRB1_METALSONIC3", - - "S_SRB1_GOLDBOT1", - "S_SRB1_GOLDBOT2", - "S_SRB1_GOLDBOT3", - "S_SRB1_GOLDBOT4", - "S_SRB1_GOLDBOT5", - "S_SRB1_GOLDBOT6", - - "S_SRB1_GENREX1", - "S_SRB1_GENREX2", - #ifdef SEENAMES "S_NAMECHECK", #endif @@ -6177,37 +7182,46 @@ static const char *const MOBJTYPE_LIST[] = { // array length left dynamic for s "MT_THOK", // Thok! mobj "MT_PLAYER", + "MT_TAILSOVERLAY", // c: // Enemies - "MT_BLUECRAWLA", - "MT_REDCRAWLA", - "MT_GFZFISH", // Greenflower Fish - "MT_GOLDBUZZ", - "MT_REDBUZZ", - "MT_AQUABUZZ", + "MT_BLUECRAWLA", // Crawla (Blue) + "MT_REDCRAWLA", // Crawla (Red) + "MT_GFZFISH", // SDURF + "MT_GOLDBUZZ", // Buzz (Gold) + "MT_REDBUZZ", // Buzz (Red) "MT_JETTBOMBER", // Jetty-Syn Bomber "MT_JETTGUNNER", // Jetty-Syn Gunner "MT_CRAWLACOMMANDER", // Crawla Commander "MT_DETON", // Deton "MT_SKIM", // Skim mine dropper - "MT_TURRET", - "MT_POPUPTURRET", - "MT_SHARP", // Sharp + "MT_TURRET", // Industrial Turret + "MT_POPUPTURRET", // Pop-Up Turret + "MT_SPINCUSHION", // Spincushion + "MT_CRUSHSTACEAN", // Crushstacean + "MT_CRUSHCLAW", // Big meaty claw + "MT_CRUSHCHAIN", // Chain "MT_JETJAW", // Jet Jaw "MT_SNAILER", // Snailer - "MT_VULTURE", // Vulture + "MT_VULTURE", // BASH "MT_POINTY", // Pointy "MT_POINTYBALL", // Pointy Ball "MT_ROBOHOOD", // Robo-Hood - "MT_FACESTABBER", // CastleBot FaceStabber + "MT_FACESTABBER", // Castlebot Facestabber + "MT_FACESTABBERSPEAR", // Castlebot Facestabber spear aura "MT_EGGGUARD", // Egg Guard - "MT_EGGSHIELD", // Egg Shield for Egg Guard + "MT_EGGSHIELD", // Egg Guard's shield "MT_GSNAPPER", // Green Snapper + "MT_SNAPPER_LEG", // Green Snapper leg + "MT_SNAPPER_HEAD", // Green Snapper head "MT_MINUS", // Minus - "MT_SPRINGSHELL", // Spring Shell (no drop) + "MT_MINUSDIRT", // Minus dirt + "MT_SPRINGSHELL", // Spring Shell "MT_YELLOWSHELL", // Spring Shell (yellow) "MT_UNIDUS", // Unidus "MT_UNIBALL", // Unidus Ball + "MT_CANARIVORE", // Canarivore + "MT_CANARIVORE_GAS", // Canarivore gas // Generic Boss Items "MT_BOSSEXPLODE", @@ -6231,6 +7245,7 @@ static const char *const MOBJTYPE_LIST[] = { // array length left dynamic for s "MT_BOSSTANK2", "MT_BOSSSPIGOT", "MT_GOOP", + "MT_GOOPTRAIL", // Boss 3 "MT_EGGMOBILE3", @@ -6242,6 +7257,14 @@ static const char *const MOBJTYPE_LIST[] = { // array length left dynamic for s "MT_EGGMOBILE4_MACE", "MT_JETFLAME", + // Boss 5 + "MT_FANG", + "MT_FBOMB", + "MT_TNTDUST", // also used by barrel + "MT_FSGNA", + "MT_FSGNB", + "MT_FANGWAYPOINT", + // Black Eggman (Boss 7) "MT_BLACKEGGMAN", "MT_BLACKEGGMAN_HELPER", @@ -6270,11 +7293,12 @@ static const char *const MOBJTYPE_LIST[] = { // array length left dynamic for s // Collectible Items "MT_RING", "MT_FLINGRING", // Lost ring - "MT_BLUEBALL", // Blue sphere replacement for special stages + "MT_BLUESPHERE", // Blue sphere for special stages + "MT_FLINGBLUESPHERE", // Lost blue sphere + "MT_BOMBSPHERE", "MT_REDTEAMRING", //Rings collectable by red team. "MT_BLUETEAMRING", //Rings collectable by blue team. - "MT_EMMY", // emerald token for special stage - "MT_TOKEN", // Special Stage Token (uncollectible part) + "MT_TOKEN", // Special Stage Token "MT_REDFLAG", // Red CTF Flag "MT_BLUEFLAG", // Blue CTF Flag "MT_EMBLEM", @@ -6291,66 +7315,97 @@ static const char *const MOBJTYPE_LIST[] = { // array length left dynamic for s // Springs and others "MT_FAN", - "MT_STEAM", // Steam riser - "MT_BLUESPRING", + "MT_STEAM", + "MT_BUMPER", + "MT_BALLOON", + "MT_YELLOWSPRING", "MT_REDSPRING", - "MT_YELLOWDIAG", // Yellow Diagonal Spring - "MT_REDDIAG", // Red Diagonal Spring + "MT_BLUESPRING", + "MT_YELLOWDIAG", + "MT_REDDIAG", + "MT_BLUEDIAG", + "MT_YELLOWHORIZ", + "MT_REDHORIZ", + "MT_BLUEHORIZ", // Interactive Objects "MT_BUBBLES", // Bubble source "MT_SIGN", // Level end sign "MT_SPIKEBALL", // Spike Ball - "MT_SPECIALSPIKEBALL", "MT_SPINFIRE", "MT_SPIKE", + "MT_WALLSPIKE", + "MT_WALLSPIKEBASE", "MT_STARPOST", "MT_BIGMINE", - "MT_BIGAIRMINE", + "MT_BLASTEXECUTOR", "MT_CANNONLAUNCHER", - // Monitor Boxes - "MT_SUPERRINGBOX", - "MT_REDRINGBOX", - "MT_BLUERINGBOX", - "MT_SNEAKERTV", - "MT_INV", - "MT_PRUP", // 1up Box - "MT_YELLOWTV", // Attract shield TV - "MT_BLUETV", // Force shield TV - "MT_BLACKTV", // Bomb shield TV - "MT_WHITETV", // Jump shield TV - "MT_GREENTV", // Elemental shield TV - "MT_PITYTV", // Pity shield TV - "MT_EGGMANBOX", - "MT_MIXUPBOX", - "MT_RECYCLETV", - "MT_RECYCLEICO", - "MT_QUESTIONBOX", - "MT_GRAVITYBOX", - "MT_SCORETVSMALL", - "MT_SCORETVLARGE", - // Monitor miscellany - "MT_MONITOREXPLOSION", - "MT_REDMONITOREXPLOSION", - "MT_BLUEMONITOREXPLOSION", - "MT_RINGICO", - "MT_SHOESICO", - "MT_INVCICO", - "MT_1UPICO", - "MT_YSHIELDICO", - "MT_BSHIELDICO", - "MT_KSHIELDICO", - "MT_WSHIELDICO", - "MT_GSHIELDICO", - "MT_PITYSHIELDICO", - "MT_EGGMANICO", - "MT_MIXUPICO", - "MT_GRAVITYICO", - "MT_SCOREICOSMALL", - "MT_SCOREICOLARGE", + "MT_BOXSPARKLE", + + // Monitor boxes -- regular + "MT_RING_BOX", + "MT_PITY_BOX", + "MT_ATTRACT_BOX", + "MT_FORCE_BOX", + "MT_ARMAGEDDON_BOX", + "MT_WHIRLWIND_BOX", + "MT_ELEMENTAL_BOX", + "MT_SNEAKERS_BOX", + "MT_INVULN_BOX", + "MT_1UP_BOX", + "MT_EGGMAN_BOX", + "MT_MIXUP_BOX", + "MT_MYSTERY_BOX", + "MT_GRAVITY_BOX", + "MT_RECYCLER_BOX", + "MT_SCORE1K_BOX", + "MT_SCORE10K_BOX", + "MT_FLAMEAURA_BOX", + "MT_BUBBLEWRAP_BOX", + "MT_THUNDERCOIN_BOX", + + // Monitor boxes -- repeating (big) boxes + "MT_PITY_GOLDBOX", + "MT_ATTRACT_GOLDBOX", + "MT_FORCE_GOLDBOX", + "MT_ARMAGEDDON_GOLDBOX", + "MT_WHIRLWIND_GOLDBOX", + "MT_ELEMENTAL_GOLDBOX", + "MT_SNEAKERS_GOLDBOX", + "MT_INVULN_GOLDBOX", + "MT_EGGMAN_GOLDBOX", + "MT_GRAVITY_GOLDBOX", + "MT_FLAMEAURA_GOLDBOX", + "MT_BUBBLEWRAP_GOLDBOX", + "MT_THUNDERCOIN_GOLDBOX", + + // Monitor boxes -- special + "MT_RING_REDBOX", + "MT_RING_BLUEBOX", + + // Monitor icons + "MT_RING_ICON", + "MT_PITY_ICON", + "MT_ATTRACT_ICON", + "MT_FORCE_ICON", + "MT_ARMAGEDDON_ICON", + "MT_WHIRLWIND_ICON", + "MT_ELEMENTAL_ICON", + "MT_SNEAKERS_ICON", + "MT_INVULN_ICON", + "MT_1UP_ICON", + "MT_EGGMAN_ICON", + "MT_MIXUP_ICON", + "MT_GRAVITY_ICON", + "MT_RECYCLER_ICON", + "MT_SCORE1K_ICON", + "MT_SCORE10K_ICON", + "MT_FLAMEAURA_ICON", + "MT_BUBBLEWRAP_ICON", + "MT_THUNDERCOIN_ICON", // Projectiles "MT_ROCKET", @@ -6370,15 +7425,35 @@ static const char *const MOBJTYPE_LIST[] = { // array length left dynamic for s "MT_GFZFLOWER1", "MT_GFZFLOWER2", "MT_GFZFLOWER3", + + "MT_BLUEBERRYBUSH", "MT_BERRYBUSH", "MT_BUSH", + // Trees (both GFZ and misc) + "MT_GFZTREE", + "MT_GFZBERRYTREE", + "MT_GFZCHERRYTREE", + "MT_CHECKERTREE", + "MT_CHECKERSUNSETTREE", + "MT_FHZTREE", // Frozen Hillside + "MT_FHZPINKTREE", + "MT_POLYGONTREE", + "MT_BUSHTREE", + "MT_BUSHREDTREE", + "MT_SPRINGTREE", + // Techno Hill Scenery - "MT_THZPLANT", // THZ Plant + "MT_THZFLOWER1", + "MT_THZFLOWER2", + "MT_THZFLOWER3", + "MT_THZTREE", // Steam whistle tree/bush + "MT_THZTREEBRANCH", // branch of said tree "MT_ALARM", // Deep Sea Scenery "MT_GARGOYLE", // Deep Sea Gargoyle + "MT_BIGGARGOYLE", // Deep Sea Gargoyle (Big) "MT_SEAWEED", // DSZ Seaweed "MT_WATERDRIP", // Dripping Water source "MT_WATERDROP", // Water drop from dripping water @@ -6386,21 +7461,49 @@ static const char *const MOBJTYPE_LIST[] = { // array length left dynamic for s "MT_CORAL2", // Coral 2 "MT_CORAL3", // Coral 3 "MT_BLUECRYSTAL", // Blue Crystal + "MT_KELP", // Kelp + "MT_DSZSTALAGMITE", // Deep Sea 1 Stalagmite + "MT_DSZ2STALAGMITE", // Deep Sea 2 Stalagmite + "MT_LIGHTBEAM", // DSZ Light beam // Castle Eggman Scenery "MT_CHAIN", // CEZ Chain "MT_FLAME", // Flame (has corona) + "MT_FLAMEPARTICLE", "MT_EGGSTATUE", // Eggman Statue "MT_MACEPOINT", // Mace rotation point - "MT_SWINGMACEPOINT", // Mace swinging point - "MT_HANGMACEPOINT", // Hangable mace chain - "MT_SPINMACEPOINT", // Spin/Controllable mace chain + "MT_CHAINMACEPOINT", // Combination of chains and maces point + "MT_SPRINGBALLPOINT", // Spring ball point + "MT_CHAINPOINT", // Mace chain "MT_HIDDEN_SLING", // Spin mace chain (activatable) + "MT_FIREBARPOINT", // Firebar + "MT_CUSTOMMACEPOINT", // Custom mace "MT_SMALLMACECHAIN", // Small Mace Chain "MT_BIGMACECHAIN", // Big Mace Chain "MT_SMALLMACE", // Small Mace "MT_BIGMACE", // Big Mace - "MT_CEZFLOWER", + "MT_SMALLGRABCHAIN", // Small Grab Chain + "MT_BIGGRABCHAIN", // Big Grab Chain + "MT_YELLOWSPRINGBALL", // Yellow spring on a ball + "MT_REDSPRINGBALL", // Red spring on a ball + "MT_SMALLFIREBAR", // Small Firebar + "MT_BIGFIREBAR", // Big Firebar + "MT_CEZFLOWER", // Flower + "MT_CEZPOLE", // Pole + "MT_CEZBANNER", // Banner + "MT_PINETREE", // Pine Tree + "MT_CEZBUSH1", // Bush 1 + "MT_CEZBUSH2", // Bush 2 + "MT_CANDLE", // Candle + "MT_CANDLEPRICKET", // Candle pricket + "MT_FLAMEHOLDER", // Flame holder + "MT_FIRETORCH", // Fire torch + "MT_WAVINGFLAG", // Waving flag + "MT_WAVINGFLAGSEG", // Waving flag segment + "MT_CRAWLASTATUE", // Crawla statue + "MT_FACESTABBERSTATUE", // Facestabber statue + "MT_SUSPICIOUSFACESTABBERSTATUE", // :eggthinking: + "MT_BRAMBLES", // Brambles // Arid Canyon Scenery "MT_BIGTUMBLEWEED", @@ -6409,6 +7512,34 @@ static const char *const MOBJTYPE_LIST[] = { // array length left dynamic for s "MT_CACTI2", "MT_CACTI3", "MT_CACTI4", + "MT_CACTI5", + "MT_CACTI6", + "MT_CACTI7", + "MT_CACTI8", + "MT_CACTI9", + "MT_ARIDSIGN_CAUTION", + "MT_ARIDSIGN_CACTI", + "MT_ARIDSIGN_SHARPTURN", + "MT_OILLAMP", + "MT_TNTBARREL", + "MT_PROXIMITYTNT", + "MT_DUSTDEVIL", + "MT_DUSTLAYER", + "MT_ARIDDUST", + "MT_MINECART", + "MT_MINECARTSEG", + "MT_MINECARTSPAWNER", + "MT_MINECARTEND", + "MT_MINECARTENDSOLID", + "MT_MINECARTSIDEMARK", + "MT_MINECARTSPARK", + "MT_SALOONDOOR", + "MT_SALOONDOORTHINKER", + "MT_TRAINCAMEOSPAWNER", + "MT_TRAINSEG", + "MT_TRAINDUSTSPAWNER", + "MT_TRAINSTEAMSPAWNER", + "MT_MINECARTSWITCHPOINT", // Red Volcano Scenery "MT_FLAMEJET", @@ -6416,9 +7547,7 @@ static const char *const MOBJTYPE_LIST[] = { // array length left dynamic for s "MT_FLAMEJETFLAME", "MT_FJSPINAXISA", // Counter-clockwise - "MT_FJSPINHELPERA", "MT_FJSPINAXISB", // Clockwise - "MT_FJSPINHELPERB", "MT_FLAMEJETFLAMEB", // Blade's flame @@ -6448,7 +7577,34 @@ static const char *const MOBJTYPE_LIST[] = { // array length left dynamic for s // Christmas Scenery "MT_XMASPOLE", "MT_CANDYCANE", - "MT_SNOWMAN", + "MT_SNOWMAN", // normal + "MT_SNOWMANHAT", // with hat + scarf + "MT_LAMPPOST1", // normal + "MT_LAMPPOST2", // with snow + "MT_HANGSTAR", + // Xmas GFZ bushes + "MT_XMASBLUEBERRYBUSH", + "MT_XMASBERRYBUSH", + "MT_XMASBUSH", + // FHZ + "MT_FHZICE1", + "MT_FHZICE2", + + // Halloween Scenery + // Pumpkins + "MT_JACKO1", + "MT_JACKO2", + "MT_JACKO3", + // Dr Seuss Trees + "MT_HHZTREE_TOP", + "MT_HHZTREE_PART", + // Misc + "MT_HHZSHROOM", + "MT_HHZGRASS", + "MT_HHZTENTACLE1", + "MT_HHZTENTACLE2", + "MT_HHZSTALAGMITE_TALL", + "MT_HHZSTALAGMITE_SHORT", // Botanic Serenity "MT_BSZTALLFLOWER_RED", @@ -6495,30 +7651,67 @@ static const char *const MOBJTYPE_LIST[] = { // array length left dynamic for s "MT_BSZVINE_ORANGE", "MT_BSZSHRUB", "MT_BSZCLOVER", - "MT_BSZFISH", - "MT_BSZSUNFLOWER", + "MT_BIG_PALMTREE_TRUNK", + "MT_BIG_PALMTREE_TOP", + "MT_PALMTREE_TRUNK", + "MT_PALMTREE_TOP", // Misc scenery "MT_DBALL", "MT_EGGSTATUE2", // Powerup Indicators - "MT_GREENORB", // Elemental shield mobj - "MT_YELLOWORB", // Attract shield mobj - "MT_BLUEORB", // Force shield mobj - "MT_BLACKORB", // Armageddon shield mobj - "MT_WHITEORB", // Whirlwind shield mobj - "MT_PITYORB", // Pity shield mobj - "MT_IVSP", // invincibility sparkles + "MT_ELEMENTAL_ORB", // Elemental shield mobj + "MT_ATTRACT_ORB", // Attract shield mobj + "MT_FORCE_ORB", // Force shield mobj + "MT_ARMAGEDDON_ORB", // Armageddon shield mobj + "MT_WHIRLWIND_ORB", // Whirlwind shield mobj + "MT_PITY_ORB", // Pity shield mobj + "MT_FLAMEAURA_ORB", // Flame shield mobj + "MT_BUBBLEWRAP_ORB", // Bubble shield mobj + "MT_THUNDERCOIN_ORB", // Thunder shield mobj + "MT_THUNDERCOIN_SPARK", // Thunder spark + "MT_IVSP", // Invincibility sparkles "MT_SUPERSPARK", // Super Sonic Spark - // Freed Animals - "MT_BIRD", // Birdie freed! - "MT_BUNNY", // Bunny freed! - "MT_MOUSE", // Mouse - "MT_CHICKEN", // Chicken - "MT_COW", // Cow - "MT_REDBIRD", // Red Birdie in Bubble + // Flickies + "MT_FLICKY_01", // Bluebird + "MT_FLICKY_01_CENTER", + "MT_FLICKY_02", // Rabbit + "MT_FLICKY_02_CENTER", + "MT_FLICKY_03", // Chicken + "MT_FLICKY_03_CENTER", + "MT_FLICKY_04", // Seal + "MT_FLICKY_04_CENTER", + "MT_FLICKY_05", // Pig + "MT_FLICKY_05_CENTER", + "MT_FLICKY_06", // Chipmunk + "MT_FLICKY_06_CENTER", + "MT_FLICKY_07", // Penguin + "MT_FLICKY_07_CENTER", + "MT_FLICKY_08", // Fish + "MT_FLICKY_08_CENTER", + "MT_FLICKY_09", // Ram + "MT_FLICKY_09_CENTER", + "MT_FLICKY_10", // Puffin + "MT_FLICKY_10_CENTER", + "MT_FLICKY_11", // Cow + "MT_FLICKY_11_CENTER", + "MT_FLICKY_12", // Rat + "MT_FLICKY_12_CENTER", + "MT_FLICKY_13", // Bear + "MT_FLICKY_13_CENTER", + "MT_FLICKY_14", // Dove + "MT_FLICKY_14_CENTER", + "MT_FLICKY_15", // Cat + "MT_FLICKY_15_CENTER", + "MT_FLICKY_16", // Canary + "MT_FLICKY_16_CENTER", + "MT_SECRETFLICKY_01", // Spider + "MT_SECRETFLICKY_01_CENTER", + "MT_SECRETFLICKY_02", // Bat + "MT_SECRETFLICKY_02_CENTER", + "MT_SEED", // Environmental Effects "MT_RAIN", // Rain @@ -6528,8 +7721,9 @@ static const char *const MOBJTYPE_LIST[] = { // array length left dynamic for s "MT_SMALLBUBBLE", // small bubble "MT_MEDIUMBUBBLE", // medium bubble "MT_EXTRALARGEBUBBLE", // extra large bubble + "MT_WATERZAP", + "MT_SPINDUST", // Spindash dust "MT_TFOG", - "MT_SEED", "MT_PARTICLE", "MT_PARTICLEGEN", // For fans, etc. @@ -6537,9 +7731,9 @@ static const char *const MOBJTYPE_LIST[] = { // array length left dynamic for s "MT_SCORE", // score logo "MT_DROWNNUMBERS", // Drowning Timer "MT_GOTEMERALD", // Chaos Emerald (intangible) + "MT_LOCKON", // Target "MT_TAG", // Tag Sign "MT_GOTFLAG", // Got Flag sign - "MT_GOTFLAG2", // Got Flag sign // Ambient Sounds "MT_AWATERA", // Ambient Water Sound 1 @@ -6552,6 +7746,9 @@ static const char *const MOBJTYPE_LIST[] = { // array length left dynamic for s "MT_AWATERH", // Ambient Water Sound 8 "MT_RANDOMAMBIENT", "MT_RANDOMAMBIENT2", + "MT_MACHINEAMBIENCE", + + "MT_CORK", // Ring Weapons "MT_REDRING", @@ -6586,6 +7783,7 @@ static const char *const MOBJTYPE_LIST[] = { // array length left dynamic for s "MT_FIREBALL", "MT_SHELL", "MT_PUMA", + "MT_PUMATRAIL", "MT_HAMMER", "MT_KOOPA", "MT_KOOPAFLAME", @@ -6599,8 +7797,9 @@ static const char *const MOBJTYPE_LIST[] = { // array length left dynamic for s "MT_AXISTRANSFER", "MT_AXISTRANSFERLINE", "MT_NIGHTSDRONE", - "MT_NIGHTSGOAL", - "MT_NIGHTSCHAR", + "MT_NIGHTSDRONE_MAN", + "MT_NIGHTSDRONE_SPARKLING", + "MT_NIGHTSDRONE_GOAL", "MT_NIGHTSPARKLE", "MT_NIGHTSLOOPHELPER", "MT_NIGHTSBUMPER", // NiGHTS Bumper @@ -6608,14 +7807,38 @@ static const char *const MOBJTYPE_LIST[] = { // array length left dynamic for s "MT_HOOPCOLLIDE", // Collision detection for NiGHTS hoops "MT_HOOPCENTER", // Center of a hoop "MT_NIGHTSCORE", - "MT_NIGHTSWING", + "MT_NIGHTSCHIP", // NiGHTS Chip + "MT_FLINGNIGHTSCHIP", // Lost NiGHTS Chip + "MT_NIGHTSSTAR", // NiGHTS Star "MT_NIGHTSSUPERLOOP", "MT_NIGHTSDRILLREFILL", "MT_NIGHTSHELPER", "MT_NIGHTSEXTRATIME", "MT_NIGHTSLINKFREEZE", "MT_EGGCAPSULE", + "MT_IDEYAANCHOR", "MT_NIGHTOPIANHELPER", // the actual helper object that orbits you + "MT_PIAN", // decorative singing friend + "MT_SHLEEP", // almost-decorative sleeping enemy + + // Secret badniks and hazards, shhhh + "MT_PENGUINATOR", + "MT_POPHAT", + "MT_POPSHOT", + + "MT_HIVEELEMENTAL", + "MT_BUMBLEBORE", + + "MT_BUBBLEBUZZ", + + "MT_SMASHINGSPIKEBALL", + "MT_CACOLANTERN", + "MT_CACOSHARD", + "MT_CACOFIRE", + "MT_SPINBOBERT", + "MT_SPINBOBERT_FIRE1", + "MT_SPINBOBERT_FIRE2", + "MT_HANGSTER", // Utility Objects "MT_TELEPORTMAN", @@ -6626,6 +7849,7 @@ static const char *const MOBJTYPE_LIST[] = { // array length left dynamic for s "MT_PULL", "MT_GHOST", "MT_OVERLAY", + "MT_ANGLEMAN", "MT_POLYANCHOR", "MT_POLYSPAWN", "MT_POLYSPAWNCRUSH", @@ -6637,6 +7861,8 @@ static const char *const MOBJTYPE_LIST[] = { // array length left dynamic for s "MT_SPARK", //spark "MT_EXPLODE", // Robot Explosion "MT_UWEXPLODE", // Underwater Explosion + "MT_DUST", + "MT_WOODDEBRIS", "MT_ROCKSPAWNER", "MT_FALLINGROCK", "MT_ROCKCRUMBLE1", @@ -6656,22 +7882,6 @@ static const char *const MOBJTYPE_LIST[] = { // array length left dynamic for s "MT_ROCKCRUMBLE15", "MT_ROCKCRUMBLE16", - "MT_SRB1_CRAWLA", - "MT_SRB1_BAT", - "MT_SRB1_ROBOFISH", - "MT_SRB1_VOLCANOGUY", - "MT_SRB1_HOPPY", - "MT_SRB1_HOPPYWATER", - "MT_SRB1_HOPPYSKYLAB", - "MT_SRB1_MMZFLYING", - "MT_SRB1_UFO", - "MT_SRB1_GRAYBOT", - "MT_SRB1_ROBOTOPOLIS", - "MT_SRB1_RBZBUZZ", - "MT_SRB1_RBZSPIKES", - "MT_SRB1_METALSONIC", - "MT_SRB1_GOLDBOT", - "MT_SRB1_GENREX", #ifdef SEENAMES "MT_NAMECHECK", #endif @@ -6683,7 +7893,7 @@ static const char *const MOBJFLAG_LIST[] = { "SHOOTABLE", "NOSECTOR", "NOBLOCKMAP", - "AMBUSH", + "PAPERCOLLISION", "PUSHABLE", "BOSS", "SPAWNCEILING", @@ -6713,34 +7923,36 @@ static const char *const MOBJFLAG_LIST[] = { // \tMF2_(\S+).*// (.+) --> \t"\1", // \2 static const char *const MOBJFLAG2_LIST[] = { - "AXIS", // It's a NiGHTS axis! (For faster checking) - "TWOD", // Moves like it's in a 2D level - "DONTRESPAWN", // Don't respawn this object! - "DONTDRAW", // Don't generate a vissprite - "AUTOMATIC", // Thrown ring has automatic properties - "RAILRING", // Thrown ring has rail properties - "BOUNCERING", // Thrown ring has bounce properties - "EXPLOSION", // Thrown ring has explosive properties - "SCATTER", // Thrown ring has scatter properties - "BEYONDTHEGRAVE",// Source of this missile has died and has since respawned. - "PUSHED", // Mobj was already pushed this tic - "SLIDEPUSH", // MF_PUSHABLE that pushes continuously. - "CLASSICPUSH", // Drops straight down when object has negative Z. - "STANDONME", // While not pushable, stand on me anyway. - "INFLOAT", // Floating to a height for a move, don't auto float to target's height. - "DEBRIS", // Splash ring from explosion ring - "NIGHTSPULL", // Attracted from a paraloop - "JUSTATTACKED", // can be pushed by other moving mobjs - "FIRING", // turret fire - "SUPERFIRE", // Firing something with Super Sonic-stopping properties. Or, if mobj has MF_MISSILE, this is the actual fire from it. - "SHADOW", // Fuzzy draw, makes targeting harder. - "STRONGBOX", // Flag used for "strong" random monitors. - "OBJECTFLIP", // Flag for objects that always have flipped gravity. - "SKULLFLY", // Special handling: skull in flight. - "FRET", // Flashing from a previous hit - "BOSSNOTRAP", // No Egg Trap after boss - "BOSSFLEE", // Boss is fleeing! - "BOSSDEAD", // Boss is dead! (Not necessarily fleeing, if a fleeing point doesn't exist.) + "AXIS", // It's a NiGHTS axis! (For faster checking) + "TWOD", // Moves like it's in a 2D level + "DONTRESPAWN", // Don't respawn this object! + "DONTDRAW", // Don't generate a vissprite + "AUTOMATIC", // Thrown ring has automatic properties + "RAILRING", // Thrown ring has rail properties + "BOUNCERING", // Thrown ring has bounce properties + "EXPLOSION", // Thrown ring has explosive properties + "SCATTER", // Thrown ring has scatter properties + "BEYONDTHEGRAVE", // Source of this missile has died and has since respawned. + "SLIDEPUSH", // MF_PUSHABLE that pushes continuously. + "CLASSICPUSH", // Drops straight down when object has negative momz. + "INVERTAIMABLE", // Flips whether it's targetable by A_LookForEnemies (enemies no, decoys yes) + "INFLOAT", // Floating to a height for a move, don't auto float to target's height. + "DEBRIS", // Splash ring from explosion ring + "NIGHTSPULL", // Attracted from a paraloop + "JUSTATTACKED", // can be pushed by other moving mobjs + "FIRING", // turret fire + "SUPERFIRE", // Firing something with Super Sonic-stopping properties. Or, if mobj has MF_MISSILE, this is the actual fire from it. + "SHADOW", // Fuzzy draw, makes targeting harder. + "STRONGBOX", // Flag used for "strong" random monitors. + "OBJECTFLIP", // Flag for objects that always have flipped gravity. + "SKULLFLY", // Special handling: skull in flight. + "FRET", // Flashing from a previous hit + "BOSSNOTRAP", // No Egg Trap after boss + "BOSSFLEE", // Boss is fleeing! + "BOSSDEAD", // Boss is dead! (Not necessarily fleeing, if a fleeing point doesn't exist.) + "AMBUSH", // Alternate behaviour typically set by MTF_AMBUSH + "LINKDRAW", // Draw vissprite of mobj immediately before/after tracer's vissprite (dependent on dispoffset and position) + "SHIELD", // Thinker calls P_AddShield/P_ShieldLook (must be partnered with MF_SCENERY to use) NULL }; @@ -6752,7 +7964,7 @@ static const char *const MOBJEFLAG_LIST[] = { "JUSTSTEPPEDDOWN", // used for ramp sectors "VERTICALFLIP", // Vertically flip sprite/allow upside-down physics "GOOWATER", // Goo water - "\x01", // free: 1<<7 (name un-matchable) + "PUSHED", // Mobj was already pushed this tic "SPRUNG", // Mobj was already sprung this tic "APPLYPMOMZ", // Platform movement NULL @@ -6768,8 +7980,12 @@ static const char *const MAPTHINGFLAG_LIST[4] = { #endif static const char *const PLAYERFLAG_LIST[] = { - // Flip camera angle with gravity flip prefrence. - "FLIPCAM", + + // Cvars + "FLIPCAM", // Flip camera angle with gravity flip prefrence. + "ANALOGMODE", // Analog mode? + "DIRECTIONCHAR", // Directional character sprites? + "AUTOBRAKE", // Autobrake? // Cheats "GODMODE", @@ -6787,53 +8003,36 @@ static const char *const PLAYERFLAG_LIST[] = { "JUMPSTASIS", // and that includes jumping. // (we don't include FULLSTASIS here I guess because it's just those two together...?) - // Did you get a time-over? - "TIMEOVER", - - // Ready for Super? - "SUPERREADY", + // Applying autobrake? + "APPLYAUTOBRAKE", // Character action status + "STARTJUMP", "JUMPED", + "NOJUMPDAMAGE", + "SPINNING", "STARTDASH", + "THOKKED", - - // Are you gliding? + "SHIELDABILITY", "GLIDING", - - // Tails pickup! - "CARRIED", + "BOUNCING", // Sliding (usually in water) like Labyrinth/Oil Ocean "SLIDING", - // Hanging on a rope - "ROPEHANG", - - // Hanging on an item of some kind - zipline, chain, etc. (->tracer) - "ITEMHANG", - - // On the mace chain spinning around (->tracer) - "MACESPIN", - - /*** NIGHTS STUFF ***/ - // Is the player in NiGHTS mode? - "NIGHTSMODE", + // NiGHTS stuff "TRANSFERTOCLOSEST", - - // Spill rings after falling - "NIGHTSFALL", "DRILLING", - "SKIDDOWN", - /*** TAG STUFF ***/ - "TAGGED", // Player has been tagged and awaits the next round in hide and seek. + // Gametype-specific stuff + "GAMETYPEOVER", // Race time over, or H&S out-of-game "TAGIT", // The player is it! For Tag Mode /*** misc ***/ "FORCESTRAFE", // Translate turn inputs into strafe inputs - "ANALOGMODE", // Analog mode? + "CANCARRY", // Can carry? NULL // stop loop here. }; @@ -6863,50 +8062,130 @@ static const char *const ML_LIST[16] = { // This DOES differ from r_draw's Color_Names, unfortunately. // Also includes Super colors static const char *COLOR_ENUMS[] = { - "NONE", // SKINCOLOR_NONE - "WHITE", // SKINCOLOR_WHITE - "SILVER", // SKINCOLOR_SILVER - "GREY", // SKINCOLOR_GREY - "BLACK", // SKINCOLOR_BLACK - "CYAN", // SKINCOLOR_CYAN - "TEAL", // SKINCOLOR_TEAL - "STEELBLUE", // SKINCOLOR_STEELBLUE - "BLUE", // SKINCOLOR_BLUE - "PEACH", // SKINCOLOR_PEACH - "TAN", // SKINCOLOR_TAN - "PINK", // SKINCOLOR_PINK - "LAVENDER", // SKINCOLOR_LAVENDER - "PURPLE", // SKINCOLOR_PURPLE - "ORANGE", // SKINCOLOR_ORANGE - "ROSEWOOD", // SKINCOLOR_ROSEWOOD - "BEIGE", // SKINCOLOR_BEIGE - "BROWN", // SKINCOLOR_BROWN - "RED", // SKINCOLOR_RED - "DARKRED", // SKINCOLOR_DARKRED - "NEONGREEN", // SKINCOLOR_NEONGREEN - "GREEN", // SKINCOLOR_GREEN - "ZIM", // SKINCOLOR_ZIM - "OLIVE", // SKINCOLOR_OLIVE - "YELLOW", // SKINCOLOR_YELLOW - "GOLD", // SKINCOLOR_GOLD + "NONE", // SKINCOLOR_NONE, + + // Greyscale ranges + "WHITE", // SKINCOLOR_WHITE, + "BONE", // SKINCOLOR_BONE, + "CLOUDY", // SKINCOLOR_CLOUDY, + "GREY", // SKINCOLOR_GREY, + "SILVER", // SKINCOLOR_SILVER, + "CARBON", // SKINCOLOR_CARBON, + "JET", // SKINCOLOR_JET, + "BLACK", // SKINCOLOR_BLACK, + + // Desaturated + "AETHER", // SKINCOLOR_AETHER, + "SLATE", // SKINCOLOR_SLATE, + "PINK", // SKINCOLOR_PINK, + "YOGURT", // SKINCOLOR_YOGURT, + "BROWN", // SKINCOLOR_BROWN, + "TAN", // SKINCOLOR_TAN, + "BEIGE", // SKINCOLOR_BEIGE, + "MOSS", // SKINCOLOR_MOSS, + "AZURE", // SKINCOLOR_AZURE, + "LAVENDER", // SKINCOLOR_LAVENDER, + + // Viv's vivid colours (toast 21/07/17) + "RUBY", // SKINCOLOR_RUBY, + "SALMON", // SKINCOLOR_SALMON, + "RED", // SKINCOLOR_RED, + "CRIMSON", // SKINCOLOR_CRIMSON, + "FLAME", // SKINCOLOR_FLAME, + "PEACHY", // SKINCOLOR_PEACHY, + "QUAIL", // SKINCOLOR_QUAIL, + "SUNSET", // SKINCOLOR_SUNSET, + "APRICOT", // SKINCOLOR_APRICOT, + "ORANGE", // SKINCOLOR_ORANGE, + "RUST", // SKINCOLOR_RUST, + "GOLD", // SKINCOLOR_GOLD, + "SANDY", // SKINCOLOR_SANDY, + "YELLOW", // SKINCOLOR_YELLOW, + "OLIVE", // SKINCOLOR_OLIVE, + "LIME", // SKINCOLOR_LIME, + "PERIDOT", // SKINCOLOR_PERIDOT, + "GREEN", // SKINCOLOR_GREEN, + "FOREST", // SKINCOLOR_FOREST, + "EMERALD", // SKINCOLOR_EMERALD, + "MINT", // SKINCOLOR_MINT, + "SEAFOAM", // SKINCOLOR_SEAFOAM, + "AQUA", // SKINCOLOR_AQUA, + "TEAL", // SKINCOLOR_TEAL, + "WAVE", // SKINCOLOR_WAVE, + "CYAN", // SKINCOLOR_CYAN, + "SKY", // SKINCOLOR_SKY, + "CERULEAN", // SKINCOLOR_CERULEAN, + "ICY", // SKINCOLOR_ICY, + "SAPPHIRE", // SKINCOLOR_SAPPHIRE, + "CORNFLOWER", // SKINCOLOR_CORNFLOWER, + "BLUE", // SKINCOLOR_BLUE, + "COBALT", // SKINCOLOR_COBALT, + "VAPOR", // SKINCOLOR_VAPOR, + "DUSK", // SKINCOLOR_DUSK, + "PASTEL", // SKINCOLOR_PASTEL, + "PURPLE", // SKINCOLOR_PURPLE, + "BUBBLEGUM", // SKINCOLOR_BUBBLEGUM, + "MAGENTA", // SKINCOLOR_MAGENTA, + "NEON", // SKINCOLOR_NEON, + "VIOLET", // SKINCOLOR_VIOLET, + "LILAC", // SKINCOLOR_LILAC, + "PLUM", // SKINCOLOR_PLUM, + "ROSY", // SKINCOLOR_ROSY, + // Super special awesome Super flashing colors! - "SUPER1", // SKINCOLOR_SUPER1 - "SUPER2", // SKINCOLOR_SUPER2, - "SUPER3", // SKINCOLOR_SUPER3, - "SUPER4", // SKINCOLOR_SUPER4, - "SUPER5", // SKINCOLOR_SUPER5, - // Super Tails - "TSUPER1", // SKINCOLOR_TSUPER1, - "TSUPER2", // SKINCOLOR_TSUPER2, - "TSUPER3", // SKINCOLOR_TSUPER3, - "TSUPER4", // SKINCOLOR_TSUPER4, - "TSUPER5", // SKINCOLOR_TSUPER5, - // Super Knuckles - "KSUPER1", // SKINCOLOR_KSUPER1, - "KSUPER2", // SKINCOLOR_KSUPER2, - "KSUPER3", // SKINCOLOR_KSUPER3, - "KSUPER4", // SKINCOLOR_KSUPER4, - "KSUPER5" // SKINCOLOR_KSUPER5, + "SUPERSILVER1", // SKINCOLOR_SUPERSILVER1 + "SUPERSILVER2", // SKINCOLOR_SUPERSILVER2, + "SUPERSILVER3", // SKINCOLOR_SUPERSILVER3, + "SUPERSILVER4", // SKINCOLOR_SUPERSILVER4, + "SUPERSILVER5", // SKINCOLOR_SUPERSILVER5, + + "SUPERRED1", // SKINCOLOR_SUPERRED1 + "SUPERRED2", // SKINCOLOR_SUPERRED2, + "SUPERRED3", // SKINCOLOR_SUPERRED3, + "SUPERRED4", // SKINCOLOR_SUPERRED4, + "SUPERRED5", // SKINCOLOR_SUPERRED5, + + "SUPERORANGE1", // SKINCOLOR_SUPERORANGE1 + "SUPERORANGE2", // SKINCOLOR_SUPERORANGE2, + "SUPERORANGE3", // SKINCOLOR_SUPERORANGE3, + "SUPERORANGE4", // SKINCOLOR_SUPERORANGE4, + "SUPERORANGE5", // SKINCOLOR_SUPERORANGE5, + + "SUPERGOLD1", // SKINCOLOR_SUPERGOLD1 + "SUPERGOLD2", // SKINCOLOR_SUPERGOLD2, + "SUPERGOLD3", // SKINCOLOR_SUPERGOLD3, + "SUPERGOLD4", // SKINCOLOR_SUPERGOLD4, + "SUPERGOLD5", // SKINCOLOR_SUPERGOLD5, + + "SUPERPERIDOT1", // SKINCOLOR_SUPERPERIDOT1 + "SUPERPERIDOT2", // SKINCOLOR_SUPERPERIDOT2, + "SUPERPERIDOT3", // SKINCOLOR_SUPERPERIDOT3, + "SUPERPERIDOT4", // SKINCOLOR_SUPERPERIDOT4, + "SUPERPERIDOT5", // SKINCOLOR_SUPERPERIDOT5, + + "SUPERSKY1", // SKINCOLOR_SUPERSKY1 + "SUPERSKY2", // SKINCOLOR_SUPERSKY2, + "SUPERSKY3", // SKINCOLOR_SUPERSKY3, + "SUPERSKY4", // SKINCOLOR_SUPERSKY4, + "SUPERSKY5", // SKINCOLOR_SUPERSKY5, + + "SUPERPURPLE1", // SKINCOLOR_SUPERPURPLE1, + "SUPERPURPLE2", // SKINCOLOR_SUPERPURPLE2, + "SUPERPURPLE3", // SKINCOLOR_SUPERPURPLE3, + "SUPERPURPLE4", // SKINCOLOR_SUPERPURPLE4, + "SUPERPURPLE5", // SKINCOLOR_SUPERPURPLE5, + + "SUPERRUST1", // SKINCOLOR_SUPERRUST1 + "SUPERRUST2", // SKINCOLOR_SUPERRUST2, + "SUPERRUST3", // SKINCOLOR_SUPERRUST3, + "SUPERRUST4", // SKINCOLOR_SUPERRUST4, + "SUPERRUST5", // SKINCOLOR_SUPERRUST5, + + "SUPERTAN1", // SKINCOLOR_SUPERTAN1 + "SUPERTAN2", // SKINCOLOR_SUPERTAN2, + "SUPERTAN3", // SKINCOLOR_SUPERTAN3, + "SUPERTAN4", // SKINCOLOR_SUPERTAN4, + "SUPERTAN5" // SKINCOLOR_SUPERTAN5, }; static const char *const POWERS_LIST[] = { @@ -6914,10 +8193,12 @@ static const char *const POWERS_LIST[] = { "SNEAKERS", "FLASHING", "SHIELD", + "CARRY", "TAILSFLY", // tails flying "UNDERWATER", // underwater timer "SPACETIME", // In space, no one can hear you spin! "EXTRALIFE", // Extra Life timer + "PUSHING", "SUPER", // Are you super? "GRAVITYBOOTS", // gravity boots @@ -6940,37 +8221,26 @@ static const char *const POWERS_LIST[] = { "NIGHTS_LINKFREEZE", //for linedef exec 427 - "NOCONTROL", - "INGOOP" // In goop + "NOCONTROL" }; static const char *const HUDITEMS_LIST[] = { - "LIVESNAME", - "LIVESPIC", - "LIVESNUM", - "LIVESX", + "LIVES", "RINGS", - "RINGSSPLIT", "RINGSNUM", - "RINGSNUMSPLIT", "SCORE", "SCORENUM", "TIME", - "TIMESPLIT", "MINUTES", - "MINUTESSPLIT", "TIMECOLON", - "TIMECOLONSPLIT", "SECONDS", - "SECONDSSPLIT", "TIMETICCOLON", "TICS", "SS_TOTALRINGS", - "SS_TOTALRINGS_SPLIT", "GETRINGS", "GETRINGSNUM", @@ -6978,10 +8248,100 @@ static const char *const HUDITEMS_LIST[] = { "TIMELEFTNUM", "TIMEUP", "HUNTPICS", - "GRAVBOOTSICO", + "POWERUPS", "LAP" }; +static const char *const MENUTYPES_LIST[] = { + "NONE", + + "MAIN", + + // Single Player + "SP_MAIN", + + "SP_LOAD", + "SP_PLAYER", + + "SP_LEVELSELECT", + "SP_LEVELSTATS", + + "SP_TIMEATTACK", + "SP_TIMEATTACK_LEVELSELECT", + "SP_GUESTREPLAY", + "SP_REPLAY", + "SP_GHOST", + + "SP_NIGHTSATTACK", + "SP_NIGHTS_LEVELSELECT", + "SP_NIGHTS_GUESTREPLAY", + "SP_NIGHTS_REPLAY", + "SP_NIGHTS_GHOST", + + // Multiplayer + "MP_MAIN", + "MP_SPLITSCREEN", // SplitServer + "MP_SERVER", + "MP_CONNECT", + "MP_ROOM", + "MP_PLAYERSETUP", // MP_PlayerSetupDef shared with SPLITSCREEN if #defined NONET + + // Options + "OP_MAIN", + + "OP_P1CONTROLS", + "OP_CHANGECONTROLS", // OP_ChangeControlsDef shared with P2 + "OP_P1MOUSE", + "OP_P1JOYSTICK", + "OP_JOYSTICKSET", // OP_JoystickSetDef shared with P2 + + "OP_P2CONTROLS", + "OP_P2MOUSE", + "OP_P2JOYSTICK", + + "OP_VIDEO", + "OP_VIDEOMODE", + "OP_COLOR", + "OP_OPENGL", + "OP_OPENGL_LIGHTING", + "OP_OPENGL_FOG", + "OP_OPENGL_COLOR", + + "OP_SOUND", + + "OP_SERVER", + "OP_MONITORTOGGLE", + + "OP_DATA", + "OP_ADDONS", + "OP_SCREENSHOTS", + "OP_ERASEDATA", + + // Secrets + "SR_MAIN", + "SR_PANDORA", + "SR_LEVELSELECT", + "SR_UNLOCKCHECKLIST", + "SR_EMBLEMHINT", + + // Addons (Part of MISC, but let's make it our own) + "AD_MAIN", + + // MISC + // "MESSAGE", + // "SPAUSE", + + // "MPAUSE", + // "SCRAMBLETEAM", + // "CHANGETEAM", + // "CHANGELEVEL", + + // "MAPAUSE", + // "HELP", + + "SPECIAL" +}; + struct { const char *n; // has to be able to hold both fixed_t and angle_t, so drastic measure!! @@ -7022,6 +8382,8 @@ struct { {"CODEBASE",CODEBASE}, // or what release of SRB2 this is. {"VERSION",VERSION}, // Grab the game's version! {"SUBVERSION",SUBVERSION}, // more precise version number + {"NEWTICRATE",NEWTICRATE}, // TICRATE*NEWTICRATERATIO + {"NEWTICRATERATIO",NEWTICRATERATIO}, // Special linedef executor tag numbers! {"LE_PINCHPHASE",LE_PINCHPHASE}, // A boss entered pinch phase (and, in most cases, is preparing their pinch phase attack!) @@ -7029,13 +8391,28 @@ struct { {"LE_BOSSDEAD",LE_BOSSDEAD}, // A boss in the map died (Chaos mode boss tally) {"LE_BOSS4DROP",LE_BOSS4DROP}, // CEZ boss dropped its cage {"LE_BRAKVILEATACK",LE_BRAKVILEATACK}, // Brak's doing his LOS attack, oh noes + {"LE_TURRET",LE_TURRET}, // THZ turret + {"LE_BRAKPLATFORM",LE_BRAKPLATFORM}, // v2.0 Black Eggman destroys platform + {"LE_CAPSULE2",LE_CAPSULE2}, // Egg Capsule + {"LE_CAPSULE1",LE_CAPSULE1}, // Egg Capsule + {"LE_CAPSULE0",LE_CAPSULE0}, // Egg Capsule + {"LE_KOOPA",LE_KOOPA}, // Distant cousin to Gay Bowser + {"LE_AXE",LE_AXE}, // MKB Axe object + {"LE_PARAMWIDTH",LE_PARAMWIDTH}, // If an object that calls LinedefExecute has a nonzero parameter value, this times the parameter will be subtracted. (Mostly for the purpose of coexisting bosses...) /// \todo Get all this stuff into its own sections, maybe. Maybe. // Frame settings {"FF_FRAMEMASK",FF_FRAMEMASK}, + {"FF_SPR2SUPER",FF_SPR2SUPER}, + {"FF_SPR2ENDSTATE",FF_SPR2ENDSTATE}, + {"FF_SPR2MIDSTART",FF_SPR2MIDSTART}, {"FF_ANIMATE",FF_ANIMATE}, + {"FF_RANDOMANIM",FF_RANDOMANIM}, + {"FF_GLOBALANIM",FF_GLOBALANIM}, {"FF_FULLBRIGHT",FF_FULLBRIGHT}, + {"FF_VERTICALFLIP",FF_VERTICALFLIP}, + {"FF_PAPERSPRITE",FF_PAPERSPRITE}, {"FF_TRANSMASK",FF_TRANSMASK}, {"FF_TRANSSHIFT",FF_TRANSSHIFT}, // new preshifted translucency (used in source) @@ -7092,17 +8469,15 @@ struct { {"LF_NOSSMUSIC",LF_NOSSMUSIC}, {"LF_NORELOAD",LF_NORELOAD}, {"LF_NOZONE",LF_NOZONE}, + {"LF_SAVEGAME",LF_SAVEGAME}, + {"LF_MIXNIGHTSCOUNTDOWN",LF_MIXNIGHTSCOUNTDOWN}, // And map flags {"LF2_HIDEINMENU",LF2_HIDEINMENU}, {"LF2_HIDEINSTATS",LF2_HIDEINSTATS}, {"LF2_RECORDATTACK",LF2_RECORDATTACK}, {"LF2_NIGHTSATTACK",LF2_NIGHTSATTACK}, {"LF2_NOVISITNEEDED",LF2_NOVISITNEEDED}, - - // Save override - {"SAVE_NEVER",SAVE_NEVER}, - {"SAVE_DEFAULT",SAVE_DEFAULT}, - {"SAVE_ALWAYS",SAVE_ALWAYS}, + {"LF2_WIDEICON",LF2_WIDEICON}, // NiGHTS grades {"GRADE_F",GRADE_F}, @@ -7136,23 +8511,43 @@ struct { {"PRECIP_STORM_NOSTRIKES",PRECIP_STORM_NOSTRIKES}, // Shields - // These ones use the lower 8 bits {"SH_NONE",SH_NONE}, - {"SH_JUMP",SH_JUMP}, + // Shield flags + {"SH_PROTECTFIRE",SH_PROTECTFIRE}, + {"SH_PROTECTWATER",SH_PROTECTWATER}, + {"SH_PROTECTELECTRIC",SH_PROTECTELECTRIC}, + {"SH_PROTECTSPIKE",SH_PROTECTSPIKE}, + // Indivisible shields + {"SH_PITY",SH_PITY}, + {"SH_WHIRLWIND",SH_WHIRLWIND}, + {"SH_ARMAGEDDON",SH_ARMAGEDDON}, + // normal shields that use flags {"SH_ATTRACT",SH_ATTRACT}, {"SH_ELEMENTAL",SH_ELEMENTAL}, - {"SH_BOMB",SH_BOMB}, + // Sonic 3 shields + {"SH_FLAMEAURA",SH_FLAMEAURA}, {"SH_BUBBLEWRAP",SH_BUBBLEWRAP}, {"SH_THUNDERCOIN",SH_THUNDERCOIN}, - {"SH_FLAMEAURA",SH_FLAMEAURA}, - {"SH_PITY",SH_PITY}, - // These ones are special and use the upper bits - {"SH_FIREFLOWER",SH_FIREFLOWER}, // Lower bits are a normal shield stacked on top of the fire flower - {"SH_FORCE",SH_FORCE}, // Lower bits are how many hits left, 0 is the last hit - // Stack masks + // The force shield uses the lower 8 bits to count how many extra hits are left. + {"SH_FORCE",SH_FORCE}, + {"SH_FORCEHP",SH_FORCEHP}, // to be used as a bitmask only + // Mostly for use with Mario mode. + {"SH_FIREFLOWER", SH_FIREFLOWER}, {"SH_STACK",SH_STACK}, {"SH_NOSTACK",SH_NOSTACK}, + // Carrying + {"CR_NONE",CR_NONE}, + {"CR_GENERIC",CR_GENERIC}, + {"CR_PLAYER",CR_PLAYER}, + {"CR_NIGHTSMODE",CR_NIGHTSMODE}, + {"CR_NIGHTSFALL",CR_NIGHTSFALL}, + {"CR_BRAKGOOP",CR_BRAKGOOP}, + {"CR_ZOOMTUBE",CR_ZOOMTUBE}, + {"CR_ROPEHANG",CR_ROPEHANG}, + {"CR_MACESPIN",CR_MACESPIN}, + {"CR_MINECART",CR_MINECART}, + // Ring weapons (ringweapons_t) // Useful for A_GiveWeapon {"RW_AUTO",RW_AUTO}, @@ -7164,12 +8559,20 @@ struct { // Character flags (skinflags_t) {"SF_SUPER",SF_SUPER}, - {"SF_SUPERANIMS",SF_SUPERANIMS}, - {"SF_SUPERSPIN",SF_SUPERSPIN}, + {"SF_NOSUPERSPIN",SF_NOSUPERSPIN}, + {"SF_NOSPINDASHDUST",SF_NOSPINDASHDUST}, {"SF_HIRES",SF_HIRES}, {"SF_NOSKID",SF_NOSKID}, {"SF_NOSPEEDADJUST",SF_NOSPEEDADJUST}, {"SF_RUNONWATER",SF_RUNONWATER}, + {"SF_NOJUMPSPIN",SF_NOJUMPSPIN}, + {"SF_NOJUMPDAMAGE",SF_NOJUMPDAMAGE}, + {"SF_STOMPDAMAGE",SF_STOMPDAMAGE}, + {"SF_MARIODAMAGE",SF_MARIODAMAGE}, + {"SF_MACHINE",SF_MACHINE}, + {"SF_DASHMODE",SF_DASHMODE}, + {"SF_FASTEDGE",SF_FASTEDGE}, + {"SF_MULTIABILITY",SF_MULTIABILITY}, // Character abilities! // Primary @@ -7187,10 +8590,13 @@ struct { {"CA_JUMPBOOST",CA_JUMPBOOST}, {"CA_AIRDRILL",CA_AIRDRILL}, {"CA_JUMPTHOK",CA_JUMPTHOK}, + {"CA_BOUNCE",CA_BOUNCE}, + {"CA_TWINSPIN",CA_TWINSPIN}, // Secondary {"CA2_NONE",CA2_NONE}, // now slot 0! {"CA2_SPINDASH",CA2_SPINDASH}, - {"CA2_MULTIABILITY",CA2_MULTIABILITY}, + {"CA2_GUNSLINGER",CA2_GUNSLINGER}, + {"CA2_MELEE",CA2_MELEE}, // Sound flags {"SF_TOTALLYSINGLE",SF_TOTALLYSINGLE}, @@ -7201,6 +8607,15 @@ struct { {"SF_NOINTERRUPT",SF_NOINTERRUPT}, {"SF_X2AWAYSOUND",SF_X2AWAYSOUND}, + // Global emblem var flags + {"GE_NIGHTSPULL",GE_NIGHTSPULL}, + {"GE_NIGHTSITEM",GE_NIGHTSITEM}, + + // Map emblem var flags + {"ME_ALLEMERALDS",ME_ALLEMERALDS}, + {"ME_ULTIMATE",ME_ULTIMATE}, + {"ME_PERFECT",ME_PERFECT}, + #ifdef HAVE_BLUA // p_local.h constants {"FLOATSPEED",FLOATSPEED}, @@ -7215,6 +8630,23 @@ struct { {"PAL_MIXUP",PAL_MIXUP}, {"PAL_RECYCLE",PAL_RECYCLE}, {"PAL_NUKE",PAL_NUKE}, + // for P_DamageMobj + //// Damage types + {"DMG_WATER",DMG_WATER}, + {"DMG_FIRE",DMG_FIRE}, + {"DMG_ELECTRIC",DMG_ELECTRIC}, + {"DMG_SPIKE",DMG_SPIKE}, + {"DMG_NUKE",DMG_NUKE}, + //// Death types + {"DMG_INSTAKILL",DMG_INSTAKILL}, + {"DMG_DROWNED",DMG_DROWNED}, + {"DMG_SPACEDROWN",DMG_SPACEDROWN}, + {"DMG_DEATHPIT",DMG_DEATHPIT}, + {"DMG_CRUSHED",DMG_CRUSHED}, + {"DMG_SPECTATOR",DMG_SPECTATOR}, + //// Masks + {"DMG_CANHURTSELF",DMG_CANHURTSELF}, + {"DMG_DEATHMASK",DMG_DEATHMASK}, // Gametypes, for use with global var "gametype" {"GT_COOP",GT_COOP}, @@ -7234,11 +8666,18 @@ struct { // Player animation (panim_t) {"PA_ETC",PA_ETC}, {"PA_IDLE",PA_IDLE}, + {"PA_EDGE",PA_EDGE}, {"PA_WALK",PA_WALK}, {"PA_RUN",PA_RUN}, + {"PA_DASH",PA_DASH}, + {"PA_PAIN",PA_PAIN}, {"PA_ROLL",PA_ROLL}, + {"PA_JUMP",PA_JUMP}, + {"PA_SPRING",PA_SPRING}, {"PA_FALL",PA_FALL}, {"PA_ABILITY",PA_ABILITY}, + {"PA_ABILITY2",PA_ABILITY2}, + {"PA_RIDE",PA_RIDE}, // Current weapon {"WEP_AUTO",WEP_AUTO}, @@ -7249,6 +8688,9 @@ struct { {"WEP_RAIL",WEP_RAIL}, {"NUM_WEAPONS",NUM_WEAPONS}, + // Value for infinite lives + {"INFLIVES", INFLIVES}, + // Got Flags, for player->gotflag! // Used to be MF_ for some stupid reason, now they're GF_ to stop them looking like mobjflags {"GF_REDFLAG",GF_REDFLAG}, @@ -7316,6 +8758,10 @@ struct { {"FF_COLORMAPONLY",FF_COLORMAPONLY}, ///< Only copy the colormap, not the lightlevel {"FF_GOOWATER",FF_GOOWATER}, ///< Used with ::FF_SWIMMABLE. Makes thick bouncey goop. +#ifdef HAVE_LUA_SEGS + // Node flags + {"NF_SUBSECTOR",NF_SUBSECTOR}, // Indicate a leaf. +#endif #ifdef ESLOPE // Slope flags {"SL_NOPHYSICS",SL_NOPHYSICS}, // Don't do momentum adjustment with this slope @@ -7405,13 +8851,23 @@ struct { {"V_6WIDTHSPACE",V_6WIDTHSPACE}, {"V_OLDSPACING",V_OLDSPACING}, {"V_MONOSPACE",V_MONOSPACE}, - {"V_PURPLEMAP",V_PURPLEMAP}, + + {"V_MAGENTAMAP",V_MAGENTAMAP}, {"V_YELLOWMAP",V_YELLOWMAP}, {"V_GREENMAP",V_GREENMAP}, {"V_BLUEMAP",V_BLUEMAP}, {"V_REDMAP",V_REDMAP}, {"V_GRAYMAP",V_GRAYMAP}, {"V_ORANGEMAP",V_ORANGEMAP}, + {"V_SKYMAP",V_SKYMAP}, + {"V_PURPLEMAP",V_PURPLEMAP}, + {"V_AQUAMAP",V_AQUAMAP}, + {"V_PERIDOTMAP",V_PERIDOTMAP}, + {"V_AZUREMAP",V_AZUREMAP}, + {"V_BROWNMAP",V_BROWNMAP}, + {"V_ROSYMAP",V_ROSYMAP}, + {"V_INVERTMAP",V_INVERTMAP}, + {"V_TRANSLUCENT",V_TRANSLUCENT}, {"V_10TRANS",V_10TRANS}, {"V_20TRANS",V_20TRANS}, @@ -7437,7 +8893,7 @@ struct { {"V_WRAPX",V_WRAPX}, {"V_WRAPY",V_WRAPY}, {"V_NOSCALESTART",V_NOSCALESTART}, - {"V_SPLITSCREEN",V_SPLITSCREEN}, + {"V_PERPLAYER",V_PERPLAYER}, {"V_PARAMMASK",V_PARAMMASK}, {"V_SCALEPATCHMASK",V_SCALEPATCHMASK}, @@ -7477,7 +8933,7 @@ static mobjtype_t get_mobjtype(const char *word) if (fastcmp(word, MOBJTYPE_LIST[i]+3)) return i; deh_warning("Couldn't find mobjtype named 'MT_%s'",word); - return MT_BLUECRAWLA; + return MT_NULL; } static statenum_t get_state(const char *word) @@ -7514,6 +8970,20 @@ static spritenum_t get_sprite(const char *word) return SPR_NULL; } +static playersprite_t get_sprite2(const char *word) +{ // Returns the value of SPR2_ enumerations + playersprite_t i; + if (*word >= '0' && *word <= '9') + return atoi(word); + if (fastncmp("SPR2_",word,5)) + word += 5; // take off the SPR2_ + for (i = 0; i < NUMPLAYERSPRITES; i++) + if (!spr2names[i][4] && memcmp(word,spr2names[i],4)==0) + return i; + deh_warning("Couldn't find sprite named 'SPR2_%s'",word); + return SPR2_STND; +} + static sfxenum_t get_sfx(const char *word) { // Returns the value of SFX_ enumerations sfxenum_t i; @@ -7581,7 +9051,21 @@ static hudnum_t get_huditem(const char *word) if (fastcmp(word, HUDITEMS_LIST[i])) return i; deh_warning("Couldn't find huditem named 'HUD_%s'",word); - return HUD_LIVESNAME; + return HUD_LIVES; +} + +static menutype_t get_menutype(const char *word) +{ // Returns the value of MN_ enumerations + menutype_t i; + if (*word >= '0' && *word <= '9') + return atoi(word); + if (fastncmp("MN_",word,3)) + word += 3; // take off the MN_ + for (i = 0; i < NUMMENUTYPES; i++) + if (fastcmp(word, MENUTYPES_LIST[i])) + return i; + deh_warning("Couldn't find menutype named 'MN_%s'",word); + return MN_NONE; } #ifndef HAVE_BLUA @@ -7780,6 +9264,11 @@ static fixed_t find_const(const char **rword) free(word); return r; } + else if (fastncmp("MN_",word,4)) { + r = get_menutype(word); + free(word); + return r; + } else if (fastncmp("HUD_",word,4)) { r = get_huditem(word); free(word); @@ -7864,11 +9353,14 @@ void DEH_Check(void) static inline int lib_freeslot(lua_State *L) { int n = lua_gettop(L); - int r = 0; // args returned + int r = 0; // args returned char *s, *type,*word; - while (n-- > 0) - { + if (!lua_lumploading) + return luaL_error(L, "This function cannot be called from within a hook or coroutine!"); + + while (n-- > 0) + { s = Z_StrDup(luaL_checkstring(L,1)); type = strtok(s, "_"); if (type) @@ -7894,7 +9386,7 @@ static inline int lib_freeslot(lua_State *L) lua_pushinteger(L, sfx); r++; } else - return r; + CONS_Alert(CONS_WARNING, "Ran out of free SFX slots!\n"); } else if (fastcmp(type, "SPR")) { @@ -7921,7 +9413,7 @@ static inline int lib_freeslot(lua_State *L) break; } if (j > SPR_LASTFREESLOT) - return r; + CONS_Alert(CONS_WARNING, "Ran out of free sprite slots!\n"); } else if (fastcmp(type, "S")) { @@ -7936,7 +9428,7 @@ static inline int lib_freeslot(lua_State *L) break; } if (i == NUMSTATEFREESLOTS) - return r; + CONS_Alert(CONS_WARNING, "Ran out of free State slots!\n"); } else if (fastcmp(type, "MT")) { @@ -7951,7 +9443,26 @@ static inline int lib_freeslot(lua_State *L) break; } if (i == NUMMOBJFREESLOTS) - return r; + CONS_Alert(CONS_WARNING, "Ran out of free MobjType slots!\n"); + } + else if (fastcmp(type, "SPR2")) + { + // Search if we already have an SPR2 by that name... + playersprite_t i; + for (i = SPR2_FIRSTFREESLOT; i < free_spr2; i++) + if (memcmp(spr2names[i],word,4) == 0) + break; + // We don't, so allocate a new one. + if (i >= free_spr2) { + if (free_spr2 < NUMPLAYERSPRITES) + { + CONS_Printf("Sprite SPR2_%s allocated.\n",word); + strncpy(spr2names[free_spr2],word,4); + spr2names[free_spr2++][4] = 0; + } else + CONS_Alert(CONS_WARNING, "Ran out of free SPR2 slots!\n"); + } + r++; } Z_Free(s); lua_remove(L, 1); @@ -7961,14 +9472,14 @@ static inline int lib_freeslot(lua_State *L) } // Wrapper for ALL A_Action functions. -// Upvalue: actionf_t to represent // Arguments: mobj_t actor, int var1, int var2 -static inline int lib_action(lua_State *L) +static int action_call(lua_State *L) { - actionf_t *action = lua_touserdata(L,lua_upvalueindex(1)); - mobj_t *actor = *((mobj_t **)luaL_checkudata(L,1,META_MOBJ)); - var1 = (INT32)luaL_optinteger(L,2,0); - var2 = (INT32)luaL_optinteger(L,3,0); + //actionf_t *action = lua_touserdata(L,lua_upvalueindex(1)); + actionf_t *action = *((actionf_t **)luaL_checkudata(L, 1, META_ACTION)); + mobj_t *actor = *((mobj_t **)luaL_checkudata(L, 2, META_MOBJ)); + var1 = (INT32)luaL_optinteger(L, 3, 0); + var2 = (INT32)luaL_optinteger(L, 4, 0); if (!actor) return LUA_ErrInvalid(L, "mobj_t"); action->acp1(actor); @@ -8116,6 +9627,27 @@ static inline int lib_getenum(lua_State *L) if (mathlib) return luaL_error(L, "sprite '%s' could not be found.\n", word); return 0; } + else if (fastncmp("SPR2_",word,5)) { + p = word+5; + for (i = 0; i < (fixed_t)free_spr2; i++) + if (!spr2names[i][4]) + { + // special 3-char cases, e.g. SPR2_RUN + // the spr2names entry will have "_" on the end, as in "RUN_" + if (spr2names[i][3] == '_' && !p[3]) { + if (fastncmp(p,spr2names[i],3)) { + lua_pushinteger(L, i); + return 1; + } + } + else if (fastncmp(p,spr2names[i],4)) { + lua_pushinteger(L, i); + return 1; + } + } + if (mathlib) return luaL_error(L, "player sprite '%s' could not be found.\n", word); + return 0; + } else if (!mathlib && fastncmp("sfx_",word,4)) { p = word+4; for (i = 0; i < NUMSFX; i++) @@ -8205,6 +9737,16 @@ static inline int lib_getenum(lua_State *L) if (mathlib) return luaL_error(L, "skincolor '%s' could not be found.\n", word); return 0; } + else if (fastncmp("MN_",word,3)) { + p = word+3; + for (i = 0; i < NUMMENUTYPES; i++) + if (fastcmp(p, MENUTYPES_LIST[i])) { + lua_pushinteger(L, i); + return 1; + } + if (mathlib) return luaL_error(L, "menutype '%s' could not be found.\n", word); + return 0; + } else if (!mathlib && fastncmp("A_",word,2)) { char *caps; // Try to get a Lua action first. @@ -8224,9 +9766,8 @@ static inline int lib_getenum(lua_State *L) // Retrieving them from this metatable allows them to be case-insensitive! for (i = 0; actionpointers[i].name; i++) if (fasticmp(word, actionpointers[i].name)) { - // push lib_action as a C closure with the actionf_t* as an upvalue. - lua_pushlightuserdata(L, &actionpointers[i].action); - lua_pushcclosure(L, lib_action, 1); + // We push the actionf_t* itself as userdata! + LUA_PushUserdata(L, &actionpointers[i].action, META_ACTION); return 1; } return 0; @@ -8240,8 +9781,7 @@ static inline int lib_getenum(lua_State *L) } for (i = 0; actionpointers[i].name; i++) if (fasticmp(superactions[superstack-1], actionpointers[i].name)) { - lua_pushlightuserdata(L, &actionpointers[i].action); - lua_pushcclosure(L, lib_action, 1); + LUA_PushUserdata(L, &actionpointers[i].action, META_ACTION); return 1; } return 0; @@ -8303,6 +9843,12 @@ static inline int lib_getenum(lua_State *L) } else if (fastcmp(word,"paused")) { lua_pushboolean(L, paused); return 1; + } else if (fastcmp(word,"titlemap")) { + lua_pushinteger(L, titlemap); + return 1; + } else if (fastcmp(word,"titlemapinaction")) { + lua_pushboolean(L, (titlemapinaction != TITLEMAP_OFF)); + return 1; } else if (fastcmp(word,"gametype")) { lua_pushinteger(L, gametype); return 1; @@ -8371,9 +9917,66 @@ int LUA_EnumLib(lua_State *L) return 0; } +// getActionName(action) -> return action's string name +static int lib_getActionName(lua_State *L) +{ + if (lua_isuserdata(L, 1)) // arg 1 is built-in action, expect action userdata + { + actionf_t *action = *((actionf_t **)luaL_checkudata(L, 1, META_ACTION)); + const char *name = NULL; + if (!action) + return luaL_error(L, "not a valid action?"); + name = LUA_GetActionName(action); + if (!name) // that can't be right? + return luaL_error(L, "no name string could be found for this action"); + lua_pushstring(L, name); + return 1; + } + else if (lua_isfunction(L, 1)) // arg 1 is a function (either C or Lua) + { + lua_settop(L, 1); // set top of stack to 1 (removing any extra args, which there shouldn't be) + // get the name for this action, if possible. + lua_getfield(L, LUA_REGISTRYINDEX, LREG_ACTIONS); + lua_pushnil(L); + // Lua stack at this point: + // 1 ... -2 -1 + // arg ... LREG_ACTIONS nil + while (lua_next(L, -2)) + { + // Lua stack at this point: + // 1 ... -3 -2 -1 + // arg ... LREG_ACTIONS "A_ACTION" function + if (lua_rawequal(L, -1, 1)) // is this the same as the arg? + { + // make sure the key (i.e. "A_ACTION") is a string first + // (note: we don't use lua_isstring because it also returns true for numbers) + if (lua_type(L, -2) == LUA_TSTRING) + { + lua_pushvalue(L, -2); // push "A_ACTION" string to top of stack + return 1; + } + lua_pop(L, 2); // pop the name and function + break; // probably should have succeeded but we didn't, so end the loop + } + lua_pop(L, 1); + } + lua_pop(L, 1); // pop LREG_ACTIONS + return 0; // return nothing (don't error) + } + + return luaL_typerror(L, 1, "action userdata or Lua function"); +} + int LUA_SOCLib(lua_State *L) { lua_register(L,"freeslot",lib_freeslot); + lua_register(L,"getActionName",lib_getActionName); + + luaL_newmetatable(L, META_ACTION); + lua_pushcfunction(L, action_call); + lua_setfield(L, -2, "__call"); + lua_pop(L, 1); + return 0; } diff --git a/src/dehacked.h b/src/dehacked.h index 411cb6c1b..31f7f220d 100644 --- a/src/dehacked.h +++ b/src/dehacked.h @@ -27,15 +27,8 @@ typedef enum UNDO_DONE = 0, } undotype_f; -#ifdef DELFILE -void DEH_WriteUndoline(const char *value, const char *data, undotype_f flags); -void DEH_UnloadDehackedWad(UINT16 wad); -#else // null the undo lines -#define DEH_WriteUndoline(a,b,c) -#endif - void DEH_LoadDehackedLump(lumpnum_t lumpnum); -void DEH_LoadDehackedLumpPwad(UINT16 wad, UINT16 lump); +void DEH_LoadDehackedLumpPwad(UINT16 wad, UINT16 lump, boolean mainfile); void DEH_Check(void); diff --git a/src/djgppdos/i_video.c b/src/djgppdos/i_video.c index 612c72215..6a7641174 100644 --- a/src/djgppdos/i_video.c +++ b/src/djgppdos/i_video.c @@ -90,6 +90,10 @@ static unsigned long nombre = NEWTICRATE*10; static void I_BlitScreenVesa1(void); //see later void I_FinishUpdate (void) { + // draw captions if enabled + if (cv_closedcaptioning.value) + SCR_ClosedCaptions(); + // draw FPS if enabled if (cv_ticrate.value) SCR_DisplayTicRate(); diff --git a/src/doomdata.h b/src/doomdata.h index ff025e99c..2b9472569 100644 --- a/src/doomdata.h +++ b/src/doomdata.h @@ -46,6 +46,9 @@ enum ML_BLOCKMAP, // LUT, motion clipping, walls/grid element }; +// Extra flag for objects. +#define MTF_EXTRA 1 + // Reverse gravity flag for objects. #define MTF_OBJECTFLIP 2 @@ -207,8 +210,9 @@ typedef struct #define ZSHIFT 4 -extern const char *Color_Names[MAXSKINCOLORS]; -extern const UINT8 Color_Opposite[MAXSKINCOLORS*2]; +extern const UINT8 Color_Index[MAXTRANSLATIONS-1][16]; +extern const char *Color_Names[MAXSKINCOLORS + NUMSUPERCOLORS]; +extern const UINT8 Color_Opposite[(MAXSKINCOLORS - 1)*2]; #define NUMMAPS 1035 diff --git a/src/doomdef.h b/src/doomdef.h index 6b6afbf1b..475328918 100644 --- a/src/doomdef.h +++ b/src/doomdef.h @@ -28,13 +28,11 @@ // Use Mixer interface? #ifdef HAVE_MIXER - //#if !defined(DC) && !defined(_WIN32_WCE) && !defined(_XBOX) && !defined(GP2X) #define SOUND SOUND_MIXER #define NOHS // No HW3SOUND #ifdef HW3SOUND #undef HW3SOUND #endif - //#endif #endif // Use generic SDL interface. @@ -70,7 +68,7 @@ #endif #endif -#if defined (_WIN32) || defined (_WIN32_WCE) +#ifdef _WIN32 #define ASMCALL __cdecl #else #define ASMCALL @@ -87,13 +85,6 @@ // warning C4152: nonstandard extension, function/data pointer conversion in expression // warning C4213: nonstandard extension used : cast on l-value -#if defined (_WIN32_WCE) && defined (DEBUG) && defined (ARM) -#if defined (ARMV4) || defined (ARMV4I) -//#pragma warning(disable : 1166) -// warning LNK1166: cannot adjust code at offset= -#endif -#endif - #include "doomtype.h" @@ -110,13 +101,11 @@ #include #endif -#if !defined (_WIN32_WCE) #include #include -#endif #include -#if ((defined (_WIN32) && !defined (_WIN32_WCE)) || defined (__DJGPP__)) && !defined (_XBOX) +#if defined (_WIN32) || defined (__DJGPP__) #include #endif @@ -140,7 +129,7 @@ extern FILE *logstream; #endif -//#define DEVELOP // Disable this for release builds to remove excessive cheat commands and enable MD5 checking and stuff, all in one go. :3 +#define DEVELOP // Disable this for release builds to remove excessive cheat commands and enable MD5 checking and stuff, all in one go. :3 #ifdef DEVELOP #define VERSION 0 // Game version #define SUBVERSION 0 // more precise version number @@ -149,10 +138,10 @@ extern FILE *logstream; // most interface strings are ignored in development mode. // we use comprevision and compbranch instead. #else -#define VERSION 201 // Game version -#define SUBVERSION 24 // more precise version number -#define VERSIONSTRING "v2.1.24" -#define VERSIONSTRINGW L"v2.1.24" +#define VERSION 202 // Game version +#define SUBVERSION 0 // more precise version number +#define VERSIONSTRING "v2.2" +#define VERSIONSTRINGW L"v2.2" // Hey! If you change this, add 1 to the MODVERSION below! // Otherwise we can't force updates! #endif @@ -206,7 +195,7 @@ extern FILE *logstream; // and should not be changed unless you have merged changes between versions of SRB2 // (such as 2.0.4 to 2.0.5, etc) into your working copy. // Will always resemble the versionstring, 205 = 2.0.5, 210 = 2.1, etc. -#define CODEBASE 210 +#define CODEBASE 220 // The Modification ID; must be obtained from Rob ( https://mb.srb2.org/private.php?do=newpm&u=546 ). // DO NOT try to set this otherwise, or your modification will be unplayable through the Master Server. @@ -217,7 +206,7 @@ extern FILE *logstream; // it's only for detection of the version the player is using so the MS can alert them of an update. // Only set it higher, not lower, obviously. // Note that we use this to help keep internal testing in check; this is why v2.1.0 is not version "1". -#define MODVERSION 29 +#define MODVERSION 28 // To version config.cfg, MAJOREXECVERSION is set equal to MODVERSION automatically. // Increment MINOREXECVERSION whenever a config change is needed that does not correspond @@ -239,64 +228,143 @@ extern FILE *logstream; // NOTE: it needs more than this to increase the number of players... #define MAXPLAYERS 32 -#define MAXSKINS MAXPLAYERS +#define MAXSKINS 32 #define PLAYERSMASK (MAXPLAYERS-1) #define MAXPLAYERNAME 21 typedef enum { SKINCOLOR_NONE = 0, - SKINCOLOR_WHITE, - SKINCOLOR_SILVER, - SKINCOLOR_GREY, - SKINCOLOR_BLACK, - SKINCOLOR_CYAN, - SKINCOLOR_TEAL, - SKINCOLOR_STEELBLUE, - SKINCOLOR_BLUE, - SKINCOLOR_PEACH, - SKINCOLOR_TAN, - SKINCOLOR_PINK, - SKINCOLOR_LAVENDER, - SKINCOLOR_PURPLE, - SKINCOLOR_ORANGE, - SKINCOLOR_ROSEWOOD, - SKINCOLOR_BEIGE, - SKINCOLOR_BROWN, - SKINCOLOR_RED, - SKINCOLOR_DARKRED, - SKINCOLOR_NEONGREEN, - SKINCOLOR_GREEN, - SKINCOLOR_ZIM, - SKINCOLOR_OLIVE, - SKINCOLOR_YELLOW, - SKINCOLOR_GOLD, - // Careful! MAXSKINCOLORS cannot be greater than 0x20! + // Greyscale ranges + SKINCOLOR_WHITE, + SKINCOLOR_BONE, + SKINCOLOR_CLOUDY, + SKINCOLOR_GREY, + SKINCOLOR_SILVER, + SKINCOLOR_CARBON, + SKINCOLOR_JET, + SKINCOLOR_BLACK, + + // Desaturated + SKINCOLOR_AETHER, + SKINCOLOR_SLATE, + SKINCOLOR_PINK, + SKINCOLOR_YOGURT, + SKINCOLOR_BROWN, + SKINCOLOR_TAN, + SKINCOLOR_BEIGE, + SKINCOLOR_MOSS, + SKINCOLOR_AZURE, + SKINCOLOR_LAVENDER, + + // Viv's vivid colours (toast 21/07/17) + SKINCOLOR_RUBY, + SKINCOLOR_SALMON, + SKINCOLOR_RED, + SKINCOLOR_CRIMSON, + SKINCOLOR_FLAME, + SKINCOLOR_PEACHY, + SKINCOLOR_QUAIL, + SKINCOLOR_SUNSET, + SKINCOLOR_APRICOT, + SKINCOLOR_ORANGE, + SKINCOLOR_RUST, + SKINCOLOR_GOLD, + SKINCOLOR_SANDY, + SKINCOLOR_YELLOW, + SKINCOLOR_OLIVE, + SKINCOLOR_LIME, + SKINCOLOR_PERIDOT, + SKINCOLOR_GREEN, + SKINCOLOR_FOREST, + SKINCOLOR_EMERALD, + SKINCOLOR_MINT, + SKINCOLOR_SEAFOAM, + SKINCOLOR_AQUA, + SKINCOLOR_TEAL, + SKINCOLOR_WAVE, + SKINCOLOR_CYAN, + SKINCOLOR_SKY, + SKINCOLOR_CERULEAN, + SKINCOLOR_ICY, + SKINCOLOR_SAPPHIRE, // sweet mother, i cannot weave – slender aphrodite has overcome me with longing for a girl + SKINCOLOR_CORNFLOWER, + SKINCOLOR_BLUE, + SKINCOLOR_COBALT, + SKINCOLOR_VAPOR, + SKINCOLOR_DUSK, + SKINCOLOR_PASTEL, + SKINCOLOR_PURPLE, + SKINCOLOR_BUBBLEGUM, + SKINCOLOR_MAGENTA, + SKINCOLOR_NEON, + SKINCOLOR_VIOLET, + SKINCOLOR_LILAC, + SKINCOLOR_PLUM, + SKINCOLOR_ROSY, + + // SKINCOLOR_? - one left before we bump up against 0x39, which isn't a HARD limit anymore but would be excessive + MAXSKINCOLORS, // Super special awesome Super flashing colors! - SKINCOLOR_SUPER1 = MAXSKINCOLORS, - SKINCOLOR_SUPER2, - SKINCOLOR_SUPER3, - SKINCOLOR_SUPER4, - SKINCOLOR_SUPER5, + SKINCOLOR_SUPERSILVER1 = MAXSKINCOLORS, + SKINCOLOR_SUPERSILVER2, + SKINCOLOR_SUPERSILVER3, + SKINCOLOR_SUPERSILVER4, + SKINCOLOR_SUPERSILVER5, - // Super Tails - SKINCOLOR_TSUPER1, - SKINCOLOR_TSUPER2, - SKINCOLOR_TSUPER3, - SKINCOLOR_TSUPER4, - SKINCOLOR_TSUPER5, + SKINCOLOR_SUPERRED1, + SKINCOLOR_SUPERRED2, + SKINCOLOR_SUPERRED3, + SKINCOLOR_SUPERRED4, + SKINCOLOR_SUPERRED5, - // Super Knuckles - SKINCOLOR_KSUPER1, - SKINCOLOR_KSUPER2, - SKINCOLOR_KSUPER3, - SKINCOLOR_KSUPER4, - SKINCOLOR_KSUPER5, + SKINCOLOR_SUPERORANGE1, + SKINCOLOR_SUPERORANGE2, + SKINCOLOR_SUPERORANGE3, + SKINCOLOR_SUPERORANGE4, + SKINCOLOR_SUPERORANGE5, - MAXTRANSLATIONS + SKINCOLOR_SUPERGOLD1, + SKINCOLOR_SUPERGOLD2, + SKINCOLOR_SUPERGOLD3, + SKINCOLOR_SUPERGOLD4, + SKINCOLOR_SUPERGOLD5, + + SKINCOLOR_SUPERPERIDOT1, + SKINCOLOR_SUPERPERIDOT2, + SKINCOLOR_SUPERPERIDOT3, + SKINCOLOR_SUPERPERIDOT4, + SKINCOLOR_SUPERPERIDOT5, + + SKINCOLOR_SUPERSKY1, + SKINCOLOR_SUPERSKY2, + SKINCOLOR_SUPERSKY3, + SKINCOLOR_SUPERSKY4, + SKINCOLOR_SUPERSKY5, + + SKINCOLOR_SUPERPURPLE1, + SKINCOLOR_SUPERPURPLE2, + SKINCOLOR_SUPERPURPLE3, + SKINCOLOR_SUPERPURPLE4, + SKINCOLOR_SUPERPURPLE5, + + SKINCOLOR_SUPERRUST1, + SKINCOLOR_SUPERRUST2, + SKINCOLOR_SUPERRUST3, + SKINCOLOR_SUPERRUST4, + SKINCOLOR_SUPERRUST5, + + SKINCOLOR_SUPERTAN1, + SKINCOLOR_SUPERTAN2, + SKINCOLOR_SUPERTAN3, + SKINCOLOR_SUPERTAN4, + SKINCOLOR_SUPERTAN5, + + MAXTRANSLATIONS, + NUMSUPERCOLORS = ((MAXTRANSLATIONS - MAXSKINCOLORS)/5) } skincolors_t; // State updates, number of tics / second. @@ -313,21 +381,27 @@ typedef enum // Special linedef executor tag numbers! enum { - LE_PINCHPHASE = -2, // A boss entered pinch phase (and, in most cases, is preparing their pinch phase attack!) - LE_ALLBOSSESDEAD = -3, // All bosses in the map are dead (Egg capsule raise) - LE_BOSSDEAD = -4, // A boss in the map died (Chaos mode boss tally) - LE_BOSS4DROP = -5, // CEZ boss dropped its cage - LE_BRAKVILEATACK = -6 // Brak's doing his LOS attack, oh noes + LE_PINCHPHASE = -2, // A boss entered pinch phase (and, in most cases, is preparing their pinch phase attack!) + LE_ALLBOSSESDEAD = -3, // All bosses in the map are dead (Egg capsule raise) + LE_BOSSDEAD = -4, // A boss in the map died (Chaos mode boss tally) + LE_BOSS4DROP = -5, // CEZ boss dropped its cage + LE_BRAKVILEATACK = -6, // Brak's doing his LOS attack, oh noes + LE_TURRET = 32000, // THZ turret + LE_BRAKPLATFORM = 4200, // v2.0 Black Eggman destroys platform + LE_CAPSULE2 = 682, // Egg Capsule + LE_CAPSULE1 = 681, // Egg Capsule + LE_CAPSULE0 = 680, // Egg Capsule + LE_KOOPA = 650, // Distant cousin to Gay Bowser + LE_AXE = 649, // MKB Axe object + LE_PARAMWIDTH = -100 // If an object that calls LinedefExecute has a nonzero parameter value, this times the parameter will be subtracted. (Mostly for the purpose of coexisting bosses...) }; // Name of local directory for config files and savegames -#if !defined(_arch_dreamcast) && !defined(_WIN32_WCE) && !defined(GP2X) && !defined(_WII) && !defined(_PS3) #if (((defined (__unix__) && !defined (MSDOS)) || defined (UNIXCOMMON)) && !defined (__CYGWIN__)) && !defined (__APPLE__) #define DEFAULTDIR ".srb2" #else #define DEFAULTDIR "srb2" #endif -#endif #include "g_state.h" @@ -385,6 +459,7 @@ void M_StartupLocale(void); extern void *(*M_Memcpy)(void* dest, const void* src, size_t n) FUNCNONNULL; char *va(const char *format, ...) FUNCPRINTF; char *M_GetToken(const char *inputString); +void M_UnGetToken(void); char *sizeu1(size_t num); char *sizeu2(size_t num); char *sizeu3(size_t num); @@ -398,7 +473,7 @@ extern INT32 cv_debug; #define DBG_BASIC 0x0001 #define DBG_DETAILED 0x0002 -#define DBG_RANDOMIZER 0x0004 +#define DBG_PLAYER 0x0004 #define DBG_RENDER 0x0008 #define DBG_NIGHTSBASIC 0x0010 #define DBG_NIGHTS 0x0020 @@ -408,6 +483,7 @@ extern INT32 cv_debug; #define DBG_MEMORY 0x0200 #define DBG_SETUP 0x0400 #define DBG_LUA 0x0800 +#define DBG_RANDOMIZER 0x1000 // ======================= // Misc stuff for later... @@ -470,10 +546,6 @@ extern const char *compdate, *comptime, *comprevision, *compbranch; #define ESLOPE_TYPESHIM #endif -/// Delete file while the game is running. -/// \note EXTREMELY buggy, tends to crash game. -//#define DELFILE - /// Allows the use of devmode in multiplayer. AKA "fishcake" //#define NETGAME_DEVMODE @@ -501,19 +573,15 @@ extern const char *compdate, *comptime, *comprevision, *compbranch; /// Most modifications should probably enable this. //#define SAVEGAME_OTHERVERSIONS -#if !defined (_NDS) && !defined (_PSP) /// Shuffle's incomplete OpenGL sorting code. #define SHUFFLE // This has nothing to do with sorting, why was it disabled? -#endif -#if !defined (_NDS) && !defined (_PSP) /// Allow the use of the SOC RESETINFO command. /// \note Builds that are tight on memory should disable this. /// This stops the game from storing backups of the states, sprites, and mobjinfo tables. /// Though this info is compressed under normal circumstances, it's still a lot of extra /// memory that never gets touched. #define ALLOW_RESETDATA -#endif #ifndef NONET /// Display a connection screen on join attempts. @@ -527,9 +595,19 @@ extern const char *compdate, *comptime, *comprevision, *compbranch; /// \note You should leave this enabled unless you're working with a future SRB2 version. #define MUSICSLOT_COMPATIBILITY +/// Experimental attempts at preventing MF_PAPERCOLLISION objects from getting stuck in walls. +//#define PAPER_COLLISIONCORRECTION + +/// FINALLY some real clipping that doesn't make walls dissappear AND speeds the game up +/// (that was the original comment from SRB2CB, sadly it is a lie and actually slows game down) +/// on the bright side it fixes some weird issues with translucent walls +/// \note SRB2CB port. +/// SRB2CB itself ported this from PrBoom+ +#define NEWCLIP + /// Handle touching sector specials in P_PlayerAfterThink instead of P_PlayerThink. /// \note Required for proper collision with moving sloped surfaces that have sector specials on them. -//#define SECTORSPECIALSAFTERTHINK +#define SECTORSPECIALSAFTERTHINK /// FINALLY some real clipping that doesn't make walls dissappear AND speeds the game up /// (that was the original comment from SRB2CB, sadly it is a lie and actually slows game down) diff --git a/src/doomstat.h b/src/doomstat.h index 7f8b5fd6e..87b98ab40 100644 --- a/src/doomstat.h +++ b/src/doomstat.h @@ -43,9 +43,14 @@ extern INT16 maptol; extern UINT8 globalweather; extern INT32 curWeather; extern INT32 cursaveslot; -extern INT16 lastmapsaved; +//extern INT16 lastmapsaved; +extern INT16 lastmaploaded; extern boolean gamecomplete; +#define maxgameovers 13 +extern UINT8 numgameovers; +extern SINT8 startinglivesbalance[maxgameovers+1]; + #define PRECIP_NONE 0 #define PRECIP_STORM 1 #define PRECIP_SNOW 2 @@ -120,11 +125,21 @@ extern INT32 secondarydisplayplayer; // for splitscreen // Maps of special importance extern INT16 spstage_start; -extern INT16 sstage_start; -extern INT16 sstage_end; +extern INT16 sstage_start, sstage_end, smpstage_start, smpstage_end; + +extern INT16 titlemap; +extern boolean hidetitlepics; +extern INT16 bootmap; //bootmap for loading a map on startup + +extern INT16 tutorialmap; // map to load for tutorial +extern boolean tutorialmode; // are we in a tutorial right now? +extern INT32 tutorialgcs; // which control scheme is loaded? +extern INT32 tutorialusemouse; // store cv_usemouse user value +extern INT32 tutorialfreelook; // store cv_alwaysfreelook user value +extern INT32 tutorialmousemove; // store cv_mousemove user value +extern INT32 tutorialanalog; // store cv_analog user value extern boolean looptitle; -extern boolean useNightsSS; // CTF colors. extern UINT8 skincolor_redteam, skincolor_blueteam, skincolor_redring, skincolor_bluering; @@ -163,11 +178,65 @@ typedef struct extern cutscene_t *cutscenes[128]; +// Reserve prompt space for tutorials +#define TUTORIAL_PROMPT 201 // one-based +#define TUTORIAL_AREAS 6 +#define TUTORIAL_AREA_PROMPTS 5 +#define MAX_PROMPTS (TUTORIAL_PROMPT+TUTORIAL_AREAS*TUTORIAL_AREA_PROMPTS*3) // 3 control modes +#define MAX_PAGES 128 + +#define PROMPT_PIC_PERSIST 0 +#define PROMPT_PIC_LOOP 1 +#define PROMPT_PIC_DESTROY 2 +#define MAX_PROMPT_PICS 8 +typedef struct +{ + UINT8 numpics; + UINT8 picmode; // sequence mode after displaying last pic, 0 = persist, 1 = loop, 2 = destroy + UINT8 pictoloop; // if picmode == loop, which pic to loop to? + UINT8 pictostart; // initial pic number to show + char picname[MAX_PROMPT_PICS][8]; + UINT8 pichires[MAX_PROMPT_PICS]; + UINT16 xcoord[MAX_PROMPT_PICS]; // gfx + UINT16 ycoord[MAX_PROMPT_PICS]; // gfx + UINT16 picduration[MAX_PROMPT_PICS]; + + char musswitch[7]; + UINT16 musswitchflags; + UINT8 musicloop; + + char tag[33]; // page tag + char name[34]; // narrator name, extra char for color + char iconname[8]; // narrator icon lump + boolean rightside; // narrator side, false = left, true = right + boolean iconflip; // narrator flip icon horizontally + UINT8 hidehud; // hide hud, 0 = show all, 1 = hide depending on prompt position (top/bottom), 2 = hide all + UINT8 lines; // # of lines to show. If name is specified, name takes one of the lines. If 0, defaults to 4. + INT32 backcolor; // see CON_SetupBackColormap: 0-11, INT32_MAX for user-defined (CONS_BACKCOLOR) + UINT8 align; // text alignment, 0 = left, 1 = right, 2 = center + UINT8 verticalalign; // vertical text alignment, 0 = top, 1 = bottom, 2 = middle + UINT8 textspeed; // text speed, delay in tics between characters. + sfxenum_t textsfx; // sfx_ id for printing text + UINT8 nextprompt; // next prompt to jump to, one-based. 0 = current prompt + UINT8 nextpage; // next page to jump to, one-based. 0 = next page within prompt->numpages + char nexttag[33]; // next tag to jump to. If set, this overrides nextprompt and nextpage. + INT32 timetonext; // time in tics to jump to next page automatically. 0 = don't jump automatically + char *text; +} textpage_t; + +typedef struct +{ + textpage_t page[MAX_PAGES]; + INT32 numpages; // Number of pages in this prompt +} textprompt_t; + +extern textprompt_t *textprompts[MAX_PROMPTS]; + // For the Custom Exit linedef. extern INT16 nextmapoverride; extern boolean skipstats; -extern UINT32 totalrings; // Total # of rings in a level +extern UINT32 ssspheres; // Total # of spheres in a level // Fun extra stuff extern INT16 lastmap; // Last level you were at (returning from special stages). @@ -239,11 +308,18 @@ typedef struct SINT8 unlockrequired; ///< Is an unlockable required to play this level? -1 if no. UINT8 levelselect; ///< Is this map available in the level select? If so, which map list is it available in? SINT8 bonustype; ///< What type of bonus does this level have? (-1 for null.) - SINT8 saveoverride; ///< Set how the game is allowed to save (1 for always, -1 for never, 0 is 2.1 default) + SINT8 maxbonuslives; ///< How many bonus lives to award at Intermission? (-1 for unlimited.) - UINT8 levelflags; ///< LF_flags: merged eight booleans into one UINT8 for space, see below + UINT8 levelflags; ///< LF_flags: merged booleans into one UINT8 for space, see below UINT8 menuflags; ///< LF2_flags: options that affect record attack / nights mode menus + char selectheading[22]; ///< Level select heading. Allows for controllable grouping. + UINT16 startrings; ///< Number of rings players start with. + + // Freed animals stuff. + UINT8 numFlickies; ///< Internal. For freed flicky support. + mobjtype_t *flickies; ///< List of freeable flickies in this level. Allocated dynamically for space reasons. Be careful. + // NiGHTS stuff. UINT8 numGradedMares; ///< Internal. For grade support. nightsgrades_t *grades; ///< NiGHTS grades. Allocated dynamically for space reasons. Be careful. @@ -264,17 +340,15 @@ typedef struct #define LF_NOSSMUSIC 4 ///< Disable Super Sonic music #define LF_NORELOAD 8 ///< Don't reload level on death #define LF_NOZONE 16 ///< Don't include "ZONE" on level title +#define LF_SAVEGAME 32 ///< Save the game upon loading this level +#define LF_MIXNIGHTSCOUNTDOWN 64 ///< Play sfx_timeup instead of music change for NiGHTS countdown #define LF2_HIDEINMENU 1 ///< Hide in the multiplayer menu #define LF2_HIDEINSTATS 2 ///< Hide in the statistics screen #define LF2_RECORDATTACK 4 ///< Show this map in Time Attack #define LF2_NIGHTSATTACK 8 ///< Show this map in NiGHTS mode menu #define LF2_NOVISITNEEDED 16 ///< Available in time attack/nights mode without visiting the level - -// Save override -#define SAVE_NEVER -1 -#define SAVE_DEFAULT 0 -#define SAVE_ALWAYS 1 +#define LF2_WIDEICON 32 ///< If you're in a circumstance where it fits, use a wide map icon extern mapheader_t* mapheaderinfo[NUMMAPS]; @@ -319,7 +393,7 @@ enum GameType NUMGAMETYPES }; -// If you alter this list, update dehacked.c, and Gametype_Names in g_game.c +// If you alter this list, update dehacked.c, MISC_ChangeGameTypeMenu in m_menu.c, and Gametype_Names in g_game.c // String names for gametypes extern const char *Gametype_Names[NUMGAMETYPES]; @@ -380,6 +454,7 @@ extern recorddata_t *mainrecords[NUMMAPS]; #define MV_ULTIMATE 8 #define MV_PERFECT 16 #define MV_MAX 31 // used in gamedata check +#define MV_MP 128 extern UINT8 mapvisited[NUMMAPS]; // Temporary holding place for nights data for the current map @@ -387,6 +462,7 @@ nightsdata_t ntemprecords; extern UINT32 token; ///< Number of tokens collected in a level extern UINT32 tokenlist; ///< List of tokens collected +extern boolean gottoken; ///< Did you get a token? Used for end of act extern INT32 tokenbits; ///< Used for setting token bits extern INT32 sstimer; ///< Time allotted in the special stage extern UINT32 bluescore; ///< Blue Team Scores @@ -408,6 +484,7 @@ extern UINT16 tailsflytics; extern UINT16 underwatertics; extern UINT16 spacetimetics; extern UINT16 extralifetics; +extern UINT16 nightslinktics; extern UINT8 introtoplay; extern UINT8 creditscutscene; @@ -480,6 +557,8 @@ extern boolean precache; // wipegamestate can be set to -1 // to force a wipe on the next draw extern gamestate_t wipegamestate; +extern INT16 wipetypepre; +extern INT16 wipetypepost; // debug flag to cancel adaptiveness extern boolean singletics; @@ -491,6 +570,8 @@ extern boolean singletics; #include "d_clisrv.h" extern consvar_t cv_timetic; // display high resolution timer +extern consvar_t cv_powerupdisplay; // display powerups +extern consvar_t cv_showinputjoy; // display joystick in time attack extern consvar_t cv_forceskin; // force clients to use the server's skin extern consvar_t cv_downloading; // allow clients to downloading WADs. extern ticcmd_t netcmds[BACKUPTICS][MAXPLAYERS]; diff --git a/src/doomtype.h b/src/doomtype.h index dd4268cdf..5f60e21b5 100644 --- a/src/doomtype.h +++ b/src/doomtype.h @@ -17,18 +17,20 @@ #ifndef __DOOMTYPE__ #define __DOOMTYPE__ -#if (defined (_WIN32) && !defined (_XBOX)) || (defined (_WIN32_WCE) && !defined (__GNUC__)) +#ifdef _WIN32 //#define WIN32_LEAN_AND_MEAN #define RPC_NO_WINDOWS_H #include #endif -#ifdef _NDS -#include -#endif - /* 7.18.1.1 Exact-width integer types */ #ifdef _MSC_VER +// libopenmpt.h will include stdint.h later; +// include it now so that INT8_MAX etc. don't get redefined +#ifdef HAVE_OPENMPT +#include +#endif + #define UINT8 unsigned __int8 #define SINT8 signed __int8 @@ -52,19 +54,6 @@ typedef long ssize_t; #define PDWORD_PTR PDWORD #endif #endif -#elif defined (_arch_dreamcast) // KOS Dreamcast -#include - -#define UINT8 unsigned char -#define SINT8 signed char - -#define UINT16 uint16 -#define INT16 int16 - -#define INT32 int -#define UINT32 unsigned int -#define INT64 int64 -#define UINT64 uint64 #elif defined (__DJGPP__) #define UINT8 unsigned char #define SINT8 signed char @@ -100,15 +89,13 @@ typedef long ssize_t; /* Strings and some misc platform specific stuff */ -#if defined (_MSC_VER) || defined (__OS2__) - // Microsoft VisualC++ #ifdef _MSC_VER + // Microsoft VisualC++ #if (_MSC_VER <= 1800) // MSVC 2013 and back #define snprintf _snprintf #if (_MSC_VER <= 1200) // MSVC 6.0 and back #define vsnprintf _vsnprintf #endif -#endif #endif #define strncasecmp strnicmp #define strcasecmp stricmp @@ -121,23 +108,12 @@ typedef long ssize_t; #define strncasecmp strnicmp #define strcasecmp strcmpi #endif -#ifdef _PSP - #include -#elif (defined (__unix__) && !defined (MSDOS)) || defined(__APPLE__) || defined (UNIXCOMMON) +#if (defined (__unix__) && !defined (MSDOS)) || defined(__APPLE__) || defined (UNIXCOMMON) #undef stricmp #define stricmp(x,y) strcasecmp(x,y) #undef strnicmp #define strnicmp(x,y,n) strncasecmp(x,y,n) #endif -#ifdef _WIN32_WCE -#ifndef __GNUC__ - #define stricmp(x,y) _stricmp(x,y) - #define strnicmp _strnicmp -#endif - #define strdup _strdup - #define strupr _strupr - #define strlwr _strlwr -#endif #if defined (macintosh) //|| defined (__APPLE__) //skip all boolean/Boolean crap #define true 1 @@ -157,7 +133,7 @@ typedef long ssize_t; #endif #endif //macintosh -#if defined (PC_DOS) || defined (_WIN32) || defined (_WII) || defined (_PSP) || defined (_arch_dreamcast) || defined (__HAIKU__) || defined(_NDS) || defined(_PS3) +#if defined (PC_DOS) || defined (_WIN32) || defined (__HAIKU__) #define HAVE_DOSSTR_FUNCS #endif @@ -191,21 +167,17 @@ size_t strlcpy(char *dst, const char *src, size_t siz); //faB: clean that up !! #if defined( _MSC_VER) && (_MSC_VER >= 1800) // MSVC 2013 and forward #include "stdbool.h" - #elif (defined (_WIN32) || (defined (_WIN32_WCE) && !defined (__GNUC__))) && !defined (_XBOX) + #elif defined (_WIN32) #define false FALSE // use windows types #define true TRUE #define boolean BOOL - #elif defined(_NDS) - #define boolean bool - #elif defined(_PS3) // defined(__GNUC__)? - #include //_bool_true_false_are_defined? - #define boolean bool #else typedef enum {false, true} boolean; #endif #endif // __BYTEBOOL__ /* 7.18.2.1 Limits of exact-width integer types */ + #ifndef INT8_MIN #define INT8_MIN (-128) #endif @@ -298,12 +270,6 @@ size_t strlcpy(char *dst, const char *src, size_t siz); #endif #define ATTRUNUSED __attribute__((unused)) - - // Xbox-only macros - #ifdef _XBOX - #define FILESTAMP I_OutputMsg("%s:%d\n",__FILE__,__LINE__); - #define XBOXSTATIC static - #endif #elif defined (_MSC_VER) #define ATTRNORETURN __declspec(noreturn) #define ATTRINLINE __forceinline @@ -357,12 +323,6 @@ size_t strlcpy(char *dst, const char *src, size_t siz); #ifndef ATTRNOINLINE #define ATTRNOINLINE #endif -#ifndef XBOXSTATIC -#define XBOXSTATIC -#endif -#ifndef FILESTAMP -#define FILESTAMP -#endif /* Miscellaneous types that don't fit anywhere else (Can this be changed?) */ diff --git a/src/f_finale.c b/src/f_finale.c index 63221fc23..a0fa3658a 100644 --- a/src/f_finale.c +++ b/src/f_finale.c @@ -29,18 +29,30 @@ #include "g_input.h" #include "console.h" #include "m_random.h" +#include "m_misc.h" // moviemode functionality #include "y_inter.h" #include "m_cond.h" +#include "p_local.h" +#include "p_setup.h" +#include "st_stuff.h" // hud hiding +#include "fastcmp.h" + +#ifdef HAVE_BLUA +#include "lua_hud.h" +#endif // Stage of animation: // 0 = text, 1 = art screen static INT32 finalecount; -INT32 titlescrollspeed = 80; +INT32 titlescrollxspeed = 80; +INT32 titlescrollyspeed = 0; +UINT8 titlemapinaction = TITLEMAP_OFF; static INT32 timetonext; // Delay between screen changes static INT32 continuetime; // Short delay when continuing static tic_t animtimer; // Used for some animation timings +static INT16 skullAnimCounter; // Prompts: Chevron animation static INT32 roidtics; // Asteroid spinning static INT32 deplete; @@ -49,6 +61,20 @@ static tic_t stoptimer; static boolean keypressed = false; // (no longer) De-Demo'd Title Screen +static tic_t xscrolltimer; +static tic_t yscrolltimer; +static INT32 menuanimtimer; // Title screen: background animation timing +mobj_t *titlemapcameraref = NULL; + +// menu presentation state +char curbgname[8]; +SINT8 curfadevalue; +boolean curhidepics; +INT32 curbgcolor; +INT32 curbgxspeed; +INT32 curbgyspeed; +boolean curbghide; + static UINT8 curDemo = 0; static UINT32 demoDelayLeft; static UINT32 demoIdleLeft; @@ -69,7 +95,17 @@ static patch_t *ttspop5; static patch_t *ttspop6; static patch_t *ttspop7; -static void F_SkyScroll(INT32 scrollspeed); +// +// PROMPT STATE +// +static boolean promptactive = false; +static mobj_t *promptmo; +static INT16 promptpostexectag; +static boolean promptblockcontrols; +static char *promptpagetext = NULL; +static INT32 callpromptnum = INT32_MAX; +static INT32 callpagenum = INT32_MAX; +static INT32 callplayer = INT32_MAX; // // CUTSCENE TEXT WRITING @@ -159,99 +195,6 @@ static void F_NewCutscene(const char *basetext) cutscene_textcount = TICRATE/2; } -// -// F_DrawPatchCol -// -static void F_DrawPatchCol(INT32 x, patch_t *patch, INT32 col) -{ - const column_t *column; - const UINT8 *source; - UINT8 *desttop, *dest = NULL; - const UINT8 *deststop, *destbottom; - size_t count; - - desttop = screens[0] + x*vid.dupx; - deststop = screens[0] + vid.rowbytes * vid.height; - destbottom = desttop + vid.height*vid.width; - - do { - INT32 topdelta, prevdelta = -1; - column = (column_t *)((UINT8 *)patch + LONG(patch->columnofs[col])); - - // step through the posts in a column - while (column->topdelta != 0xff) - { - topdelta = column->topdelta; - if (topdelta <= prevdelta) - topdelta += prevdelta; - prevdelta = topdelta; - source = (const UINT8 *)column + 3; - dest = desttop + topdelta*vid.width; - count = column->length; - - while (count--) - { - INT32 dupycount = vid.dupy; - - while (dupycount-- && dest < destbottom) - { - INT32 dupxcount = vid.dupx; - while (dupxcount-- && dest <= deststop) - *dest++ = *source; - - dest += (vid.width - vid.dupx); - } - source++; - } - column = (const column_t *)((const UINT8 *)column + column->length + 4); - } - - desttop += SHORT(patch->height)*vid.dupy*vid.width; - } while(dest < destbottom); -} - -// -// F_SkyScroll -// -static void F_SkyScroll(INT32 scrollspeed) -{ - INT32 scrolled, x, mx, fakedwidth; - patch_t *pat; - - pat = W_CachePatchName("TITLESKY", PU_CACHE); - - animtimer = ((finalecount*scrollspeed)/16) % SHORT(pat->width); - - fakedwidth = vid.width / vid.dupx; - - if (rendermode == render_soft) - { // if only hardware rendering could be this elegant and complete - scrolled = (SHORT(pat->width) - animtimer) - 1; - for (x = 0, mx = scrolled; x < fakedwidth; x++, mx = (mx+1)%SHORT(pat->width)) - F_DrawPatchCol(x, pat, mx); - } -#ifdef HWRENDER - else if (rendermode != render_none) - { // if only software rendering could be this simple and retarded - INT32 dupz = (vid.dupx < vid.dupy ? vid.dupx : vid.dupy); - INT32 y, pw = SHORT(pat->width) * dupz, ph = SHORT(pat->height) * dupz; - scrolled = animtimer * dupz; - for (x = 0; x < vid.width; x += pw) - { - for (y = 0; y < vid.height; y += ph) - { - if (scrolled > 0) - V_DrawScaledPatch(scrolled - pw, y, V_NOSCALESTART, pat); - - V_DrawScaledPatch(x + scrolled, y, V_NOSCALESTART, pat); - } - } - } -#endif - - W_UnlockCachedPatch(pat); -} - // ============= // INTRO SCENE // ============= @@ -286,6 +229,8 @@ void F_StartCustomCutscene(INT32 cutscenenum, boolean precutscene, boolean reset void F_StartIntro(void) { + S_StopMusic(); + if (introtoplay) { if (!cutscenes[introtoplay - 1]) @@ -305,7 +250,7 @@ void F_StartIntro(void) introtext[2] = M_GetText( "As it was about to drain the rings\n" "away from the planet, Sonic burst into\n" - "the Satellite and for what he thought\n" + "the control room and for what he thought\n" "would be the last time,\xB4 defeated\n" "Dr. Eggman.\n#"); @@ -315,11 +260,11 @@ void F_StartIntro(void) "return,\xB8 bringing an all new threat.\n#"); introtext[4] = M_GetText( - "\xA8""About once every year, a strange asteroid\n" + "\xA8""About every five years, a strange asteroid\n" "hovers around the planet.\xBF It suddenly\n" "appears from nowhere, circles around, and\n" "\xB6- just as mysteriously as it arrives -\xB6\n" - "vanishes after about two months.\xBF\n" + "vanishes after only one week.\xBF\n" "No one knows why it appears, or how.\n#"); introtext[5] = M_GetText( @@ -331,11 +276,11 @@ void F_StartIntro(void) "the screen, and just shrugged it off.\n#"); introtext[6] = M_GetText( - "It was only later\n" + "It was hours later\n" "that he had an\n" "idea. \xBF\xA7\"The Black\n" - "Rock usually has a\n" - "lot of energy\n" + "Rock has a large\n" + "amount of energy\n" "within it\xAC...\xA7\xBF\n" "If I can somehow\n" "harness this,\xB8 I\n" @@ -353,37 +298,37 @@ void F_StartIntro(void) "a reunion party...\n#"); introtext[8] = M_GetText( - "\xA5\"We're\xB6 ready\xB6 to\xB4 fire\xB6 in\xB6 15\xB6 seconds!\"\xA8\xB8\n" - "The robot said, his voice crackling a\n" - "little down the com-link. \xBF\xA7\"Good!\"\xA8\xB8\n" - "Eggman sat back in his Egg-Mobile and\n" + "\xA5\"PRE-""\xB6""PARING-""\xB6""TO-""\xB4""FIRE-\xB6IN-""\xB6""15-""\xB6""SECONDS!\"\xA8\xB8\n" + "his targeting system crackled\n" + "robotically down the com-link. \xBF\xA7\"Good!\"\xA8\xB8\n" + "Eggman sat back in his eggmobile and\n" "began to count down as he saw the\n" - "GreenFlower city on the main monitor.\n#"); + "Greenflower mountain on the monitor.\n#"); introtext[9] = M_GetText( "\xA5\"10...\xD2""9...\xD2""8...\"\xA8\xD2\n" "Meanwhile, Sonic was tearing across the\n" "zones. Everything became a blur as he\n" - "ran around loops, skimmed over water,\n" + "ran up slopes, skimmed over water,\n" "and catapulted himself off rocks with\n" "his phenomenal speed.\n#"); introtext[10] = M_GetText( "\xA5\"6...\xD2""5...\xD2""4...\"\xA8\xD2\n" "Sonic knew he was getting closer to the\n" - "City, and pushed himself harder.\xB4 Finally,\n" - "the city appeared in the horizon.\xD2\xD2\n" + "zone, and pushed himself harder.\xB4 Finally,\n" + "the mountain appeared on the horizon.\xD2\xD2\n" "\xA5\"3...\xD2""2...\xD2""1...\xD2""Zero.\"\n#"); introtext[11] = M_GetText( - "GreenFlower City was gone.\xC4\n" + "Greenflower Mountain was no more.\xC4\n" "Sonic arrived just in time to see what\n" "little of the 'ruins' were left.\n" - "Everyone and everything in the city\n" + "The natural beauty of the zone\n" "had been obliterated.\n#"); introtext[12] = M_GetText( - "\xA7\"You're not quite as dead as we thought,\n" + "\xA7\"You're not quite as gone as we thought,\n" "huh?\xBF Are you going to tell us your plan as\n" "usual or will I \xA8\xB4'have to work it out'\xA7 or\n" "something?\"\xD2\xD2\n" @@ -397,8 +342,8 @@ void F_StartIntro(void) "leaving Sonic\n" "and Tails behind.\xB6\n" "Tails looked at\n" - "the ruins of the\n" - "Greenflower City\n" + "the once-perfect\n" + "mountainside\n" "with a grim face\n" "and sighed.\xC6\n" "\xA7\"Now\xB6 what do we\n" @@ -447,7 +392,7 @@ void F_StartIntro(void) F_NewCutscene(introtext[0]); intro_scenenum = 0; - finalecount = animtimer = stoptimer = 0; + finalecount = animtimer = skullAnimCounter = stoptimer = 0; roidtics = BASEVIDWIDTH - 64; timetonext = introscenetime[intro_scenenum]; } @@ -565,7 +510,7 @@ static void F_IntroDrawScene(void) if (finalecount < 4) S_StopMusic(); if (finalecount == 4) - S_ChangeMusicInternal("stjr", false); + S_ChangeMusicInternal("_stjr", false); x = (BASEVIDWIDTH< I_GetTime()) + tic_t nowtime, quittime, lasttime; + nowtime = lasttime = I_GetTime(); + quittime = nowtime + NEWTICRATE*2; // Shortened the quit time, used to be 2 seconds + while (quittime > nowtime) { + while (!((nowtime = I_GetTime()) - lasttime)) + I_Sleep(); + lasttime = nowtime; + I_OsPolling(); I_UpdateNoBlit(); M_Drawer(); // menu is drawn even on top of wipes I_FinishUpdate(); // Update the screen with the image Tails 06-19-2001 + + if (moviemode) // make sure we save frames for the white hold too + M_SaveFrame(); } } D_StartTitle(); + wipegamestate = GS_INTRO; return; } F_NewCutscene(introtext[++intro_scenenum]); @@ -1017,6 +971,7 @@ static const char *credits[] = { "Jim \"MotorRoach\" DeMello", "Desmond \"Blade\" DesJardins", "Sherman \"CoatRack\" DesJardins", + "Vivian \"toaster\" Grannell", "Andrew \"Senku Niola\" Moran", "David \"Instant Sonic\" Spencer Jr.", "\"SSNTails\"", @@ -1051,6 +1006,7 @@ static const char *credits[] = { "Sherman \"CoatRack\" DesJardins", "Ben \"Mystic\" Geyer", "Nathan \"Jazz\" Giroux", + "Vivian \"toaster\" Grannell", "Dan \"Blitzzo\" Hagerstrand", "Kepa \"Nev3r\" Iceta", "Thomas \"Shadow Hog\" Igoe", @@ -1133,7 +1089,7 @@ void F_StartCredits(void) M_ClearMenus(true); // Save the second we enter the credits - if ((!modifiedgame || savemoddata) && !(netgame || multiplayer) && cursaveslot >= 0) + if ((!modifiedgame || savemoddata) && !(netgame || multiplayer) && cursaveslot > 0) G_SaveGame((UINT32)cursaveslot); if (creditscutscene) @@ -1147,7 +1103,7 @@ void F_StartCredits(void) CON_ToggleOff(); S_StopMusic(); - S_ChangeMusicInternal("credit", false); + S_ChangeMusicInternal("_creds", false); finalecount = 0; animtimer = 0; @@ -1166,7 +1122,7 @@ void F_CreditDrawer(void) V_DrawSciencePatch(credits_pics[i].x<>1); // Dim the background - V_DrawFadeScreen(); + V_DrawFadeScreen(0xFF00, 16); // Draw credits text on top for (i = 0; credits[i]; i++) @@ -1291,7 +1247,7 @@ static boolean drawemblem = false, drawchaosemblem = false; void F_StartGameEvaluation(void) { // Credits option in secrets menu - if (cursaveslot == -2) + if (cursaveslot == -1) { F_StartGameEnd(); return; @@ -1305,7 +1261,7 @@ void F_StartGameEvaluation(void) // Save the second we enter the evaluation // We need to do this again! Remember, it's possible a mod designed skipped // the credits sequence! - if ((!modifiedgame || savemoddata) && !(netgame || multiplayer) && cursaveslot >= 0) + if ((!modifiedgame || savemoddata) && !(netgame || multiplayer) && cursaveslot > 0) G_SaveGame((UINT32)cursaveslot); gameaction = ga_nothing; @@ -1364,7 +1320,7 @@ void F_GameEvaluationDrawer(void) ++timesBeatenUltimate; if (M_UpdateUnlockablesAndExtraEmblems()) - S_StartSound(NULL, sfx_ncitem); + S_StartSound(NULL, sfx_s3k68); G_SaveGameData(); } @@ -1451,20 +1407,172 @@ void F_GameEndTicker(void) // ============== // TITLE SCREEN // ============== + +void F_InitMenuPresValues(void) +{ + menuanimtimer = 0; + prevMenuId = 0; + activeMenuId = MainDef.menuid; + + // Set defaults for presentation values + strncpy(curbgname, "TITLESKY", 8); + curfadevalue = 16; + curhidepics = hidetitlepics; + curbgcolor = -1; + curbgxspeed = titlescrollxspeed; + curbgyspeed = titlescrollyspeed; + curbghide = true; + + // Find current presentation values + M_SetMenuCurBackground((gamestate == GS_TIMEATTACK) ? "SRB2BACK" : "TITLESKY"); + M_SetMenuCurFadeValue(16); + M_SetMenuCurHideTitlePics(); +} + +// +// F_SkyScroll +// +void F_SkyScroll(INT32 scrollxspeed, INT32 scrollyspeed, const char *patchname) +{ + INT32 xscrolled, x, xneg = (scrollxspeed > 0) - (scrollxspeed < 0), tilex; + INT32 yscrolled, y, yneg = (scrollyspeed > 0) - (scrollyspeed < 0), tiley; + boolean xispos = (scrollxspeed >= 0), yispos = (scrollyspeed >= 0); + INT32 dupz = (vid.dupx < vid.dupy ? vid.dupx : vid.dupy); + INT16 patwidth, patheight; + INT32 pw, ph; // scaled by dupz + patch_t *pat; + INT32 i, j; + + if (rendermode == render_none) + return; + + if (!patchname || !patchname[0]) + { + V_DrawFill(0, 0, vid.width, vid.height, 31); + return; + } + + if (!scrollxspeed && !scrollyspeed) + { + V_DrawPatchFill(W_CachePatchName(patchname, PU_CACHE)); + return; + } + + pat = W_CachePatchName(patchname, PU_CACHE); + + patwidth = SHORT(pat->width); + patheight = SHORT(pat->height); + pw = patwidth * dupz; + ph = patheight * dupz; + + tilex = max(FixedCeil(FixedDiv(vid.width, pw)) >> FRACBITS, 1)+2; // one tile on both sides of center + tiley = max(FixedCeil(FixedDiv(vid.height, ph)) >> FRACBITS, 1)+2; + + xscrolltimer = ((menuanimtimer*scrollxspeed)/16 + patwidth*xneg) % (patwidth); + yscrolltimer = ((menuanimtimer*scrollyspeed)/16 + patheight*yneg) % (patheight); + + // coordinate offsets + xscrolled = xscrolltimer * dupz; + yscrolled = yscrolltimer * dupz; + + for (x = (xispos) ? -pw*(tilex-1)+pw : 0, i = 0; + i < tilex; + x += pw, i++) + { + for (y = (yispos) ? -ph*(tiley-1)+ph : 0, j = 0; + j < tiley; + y += ph, j++) + { + V_DrawScaledPatch( + (xispos) ? xscrolled - x : x + xscrolled, + (yispos) ? yscrolled - y : y + yscrolled, + V_NOSCALESTART, pat); + } + } + + W_UnlockCachedPatch(pat); +} + void F_StartTitleScreen(void) { + if (menupres[MN_MAIN].musname[0]) + S_ChangeMusic(menupres[MN_MAIN].musname, menupres[MN_MAIN].mustrack, menupres[MN_MAIN].muslooping); + else + S_ChangeMusicInternal("_title", looptitle); + if (gamestate != GS_TITLESCREEN && gamestate != GS_WAITINGPLAYERS) + { finalecount = 0; + wipetypepost = menupres[MN_MAIN].enterwipe; + } else wipegamestate = GS_TITLESCREEN; + + if (titlemap) + { + mapthing_t *startpos; + + gamestate_t prevwipegamestate = wipegamestate; + titlemapinaction = TITLEMAP_LOADING; + titlemapcameraref = NULL; + gamemap = titlemap; + + if (!mapheaderinfo[gamemap-1]) + P_AllocMapHeader(gamemap-1); + + maptol = mapheaderinfo[gamemap-1]->typeoflevel; + globalweather = mapheaderinfo[gamemap-1]->weather; + + G_DoLoadLevel(true); + if (!titlemap) + return; + + players[displayplayer].playerstate = PST_DEAD; // Don't spawn the player in dummy (I'm still a filthy cheater) + + // Set Default Position + if (playerstarts[0]) + startpos = playerstarts[0]; + else if (deathmatchstarts[0]) + startpos = deathmatchstarts[0]; + else + startpos = NULL; + + if (startpos) + { + camera.x = startpos->x << FRACBITS; + camera.y = startpos->y << FRACBITS; + camera.subsector = R_PointInSubsector(camera.x, camera.y); + camera.z = camera.subsector->sector->floorheight + ((startpos->options >> ZSHIFT) << FRACBITS); + camera.angle = (startpos->angle % 360)*ANG1; + camera.aiming = 0; + } + else + { + camera.x = camera.y = camera.z = camera.angle = camera.aiming = 0; + camera.subsector = NULL; // toast is filthy too + } + + camera.chase = true; + camera.height = 0; + + // Run enter linedef exec for MN_MAIN, since this is where we start + if (menupres[MN_MAIN].entertag) + P_LinedefExecute(menupres[MN_MAIN].entertag, players[displayplayer].mo, NULL); + + wipegamestate = prevwipegamestate; + } + else + { + titlemapinaction = TITLEMAP_OFF; + gamemap = 1; // g_game.c + CON_ClearHUD(); + } + G_SetGamestate(GS_TITLESCREEN); - CON_ClearHUD(); // IWAD dependent stuff. - S_ChangeMusicInternal("titles", looptitle); - - animtimer = 0; + animtimer = skullAnimCounter = 0; demoDelayLeft = demoDelayTime; demoIdleLeft = demoIdleTime; @@ -1489,16 +1597,30 @@ void F_StartTitleScreen(void) // (no longer) De-Demo'd Title Screen void F_TitleScreenDrawer(void) { + boolean hidepics; + if (modeattacking) return; // We likely came here from retrying. Don't do a damn thing. // Draw that sky! - F_SkyScroll(titlescrollspeed); + if (curbgcolor >= 0) + V_DrawFill(0, 0, BASEVIDWIDTH, BASEVIDHEIGHT, curbgcolor); + else if (!curbghide || !titlemapinaction || gamestate == GS_WAITINGPLAYERS) + F_SkyScroll(curbgxspeed, curbgyspeed, curbgname); - // Don't draw outside of the title screewn, or if the patch isn't there. + // Don't draw outside of the title screen, or if the patch isn't there. if (!ttwing || (gamestate != GS_TITLESCREEN && gamestate != GS_WAITINGPLAYERS)) return; + // rei|miru: use title pics? + hidepics = curhidepics; + if (hidepics) +#ifdef HAVE_BLUA + goto luahook; +#else + return; +#endif + V_DrawScaledPatch(30, 14, 0, ttwing); if (finalecount < 57) @@ -1535,6 +1657,19 @@ void F_TitleScreenDrawer(void) } V_DrawScaledPatch(48, 142, 0,ttbanner); + +#ifdef HAVE_BLUA +luahook: + LUAh_TitleHUD(); +#endif +} + +// separate animation timer for backgrounds, since we also count +// during GS_TIMEATTACK +void F_MenuPresTicker(boolean run) +{ + if (run) + menuanimtimer++; } // (no longer) De-Demo'd Title Screen @@ -1547,6 +1682,52 @@ void F_TitleScreenTicker(boolean run) if (gameaction != ga_nothing || gamestate != GS_TITLESCREEN) return; + // Execute the titlemap camera settings + if (titlemapinaction) + { + thinker_t *th; + mobj_t *mo2; + mobj_t *cameraref = NULL; + + // If there's a Line 422 Switch Cut-Away view, don't force us. + if (!titlemapcameraref || titlemapcameraref->type != MT_ALTVIEWMAN) + { + for (th = thinkercap.next; th != &thinkercap; th = th->next) + { + if (th->function.acp1 != (actionf_p1)P_MobjThinker) // Not a mobj thinker + continue; + + mo2 = (mobj_t *)th; + + if (!mo2) + continue; + + if (mo2->type != MT_ALTVIEWMAN) + continue; + + cameraref = titlemapcameraref = mo2; + break; + } + } + else + cameraref = titlemapcameraref; + + if (cameraref) + { + camera.x = cameraref->x; + camera.y = cameraref->y; + camera.z = cameraref->z; + camera.angle = cameraref->angle; + camera.aiming = cameraref->cusval; + camera.subsector = cameraref->subsector; + } + else + { + // Default behavior: Do a lil' camera spin if a title map is loaded; + camera.angle += titlescrollxspeed*ANG1/64; + } + } + // no demos to play? or, are they disabled? if (!cv_rollingdemos.value || !numDemos) return; @@ -1626,7 +1807,7 @@ void F_StartContinue(void) // In case menus are still up?!! M_ClearMenus(true); - S_ChangeMusicInternal("contsc", false); + S_ChangeMusicInternal("_conti", false); S_StopSounds(); timetonext = TICRATE*11; @@ -1718,7 +1899,7 @@ boolean F_ContinueResponder(event_t *event) // CUSTOM CUTSCENES // ================== static INT32 scenenum, cutnum; -static INT32 picxpos, picypos, picnum, pictime; +static INT32 picxpos, picypos, picnum, pictime, picmode, numpics, pictoloop; static INT32 textxpos, textypos; static boolean dofadenow = false, cutsceneover = false; static boolean runningprecutscene = false, precutresetplayer = false; @@ -1787,6 +1968,9 @@ void F_StartCustomCutscene(INT32 cutscenenum, boolean precutscene, boolean reset G_SetGamestate(GS_CUTSCENE); + if (wipegamestate == GS_CUTSCENE) + wipegamestate = -1; + gameaction = ga_nothing; paused = false; CON_ToggleOff(); @@ -1925,3 +2109,617 @@ boolean F_CutsceneResponder(event_t *event) return false; } + +// ================== +// TEXT PROMPTS +// ================== + +static void F_GetPageTextGeometry(UINT8 *pagelines, boolean *rightside, INT32 *boxh, INT32 *texth, INT32 *texty, INT32 *namey, INT32 *chevrony, INT32 *textx, INT32 *textr) +{ + // reuse: + // cutnum -> promptnum + // scenenum -> pagenum + lumpnum_t iconlump = W_CheckNumForName(textprompts[cutnum]->page[scenenum].iconname); + + *pagelines = textprompts[cutnum]->page[scenenum].lines ? textprompts[cutnum]->page[scenenum].lines : 4; + *rightside = (iconlump != LUMPERROR && textprompts[cutnum]->page[scenenum].rightside); + + // Vertical calculations + *boxh = *pagelines*2; + *texth = textprompts[cutnum]->page[scenenum].name[0] ? (*pagelines-1)*2 : *pagelines*2; // name takes up first line if it exists + *texty = BASEVIDHEIGHT - ((*texth * 4) + (*texth/2)*4); + *namey = BASEVIDHEIGHT - ((*boxh * 4) + (*boxh/2)*4); + *chevrony = BASEVIDHEIGHT - (((1*2) * 4) + ((1*2)/2)*4); // force on last line + + // Horizontal calculations + // Shift text to the right if we have a character icon on the left side + // Add 4 margin against icon + *textx = (iconlump != LUMPERROR && !*rightside) ? ((*boxh * 4) + (*boxh/2)*4) + 4 : 4; + *textr = *rightside ? BASEVIDWIDTH - (((*boxh * 4) + (*boxh/2)*4) + 4) : BASEVIDWIDTH-4; +} + +static fixed_t F_GetPromptHideHudBound(void) +{ + UINT8 pagelines; + boolean rightside; + INT32 boxh, texth, texty, namey, chevrony; + INT32 textx, textr; + + if (cutnum == INT32_MAX || scenenum == INT32_MAX || !textprompts[cutnum] || scenenum >= textprompts[cutnum]->numpages || + !textprompts[cutnum]->page[scenenum].hidehud || + (splitscreen && textprompts[cutnum]->page[scenenum].hidehud != 2)) // don't hide on splitscreen, unless hide all is forced + return 0; + else if (textprompts[cutnum]->page[scenenum].hidehud == 2) // hide all + return BASEVIDHEIGHT; + + F_GetPageTextGeometry(&pagelines, &rightside, &boxh, &texth, &texty, &namey, &chevrony, &textx, &textr); + + // calc boxheight (see V_DrawPromptBack) + boxh *= vid.dupy; + boxh = (boxh * 4) + (boxh/2)*5; // 4 lines of space plus gaps between and some leeway + + // return a coordinate to check + // if negative: don't show hud elements below this coordinate (visually) + // if positive: don't show hud elements above this coordinate (visually) + return 0 - boxh; // \todo: if prompt at top of screen (someday), make this return positive +} + +boolean F_GetPromptHideHudAll(void) +{ + if (cutnum == INT32_MAX || scenenum == INT32_MAX || !textprompts[cutnum] || scenenum >= textprompts[cutnum]->numpages || + !textprompts[cutnum]->page[scenenum].hidehud || + (splitscreen && textprompts[cutnum]->page[scenenum].hidehud != 2)) // don't hide on splitscreen, unless hide all is forced + return false; + else if (textprompts[cutnum]->page[scenenum].hidehud == 2) // hide all + return true; + else + return false; +} + +boolean F_GetPromptHideHud(fixed_t y) +{ + INT32 ybound; + boolean fromtop; + fixed_t ytest; + + if (!promptactive) + return false; + + ybound = F_GetPromptHideHudBound(); + fromtop = (ybound >= 0); + ytest = (fromtop ? ybound : BASEVIDHEIGHT + ybound); + + return (fromtop ? y < ytest : y >= ytest); // true means hide +} + +static void F_PreparePageText(char *pagetext) +{ + UINT8 pagelines; + boolean rightside; + INT32 boxh, texth, texty, namey, chevrony; + INT32 textx, textr; + + F_GetPageTextGeometry(&pagelines, &rightside, &boxh, &texth, &texty, &namey, &chevrony, &textx, &textr); + + if (promptpagetext) + Z_Free(promptpagetext); + promptpagetext = (pagetext && pagetext[0]) ? V_WordWrap(textx, textr, 0, pagetext) : Z_StrDup(""); + + F_NewCutscene(promptpagetext); + cutscene_textspeed = textprompts[cutnum]->page[scenenum].textspeed ? textprompts[cutnum]->page[scenenum].textspeed : TICRATE/5; + cutscene_textcount = 0; // no delay in beginning + cutscene_boostspeed = 0; // don't print 8 characters to start + + // \todo update control hot strings on re-config + // and somehow don't reset cutscene text counters +} + +static void F_AdvanceToNextPage(void) +{ + INT32 nextprompt = textprompts[cutnum]->page[scenenum].nextprompt ? textprompts[cutnum]->page[scenenum].nextprompt - 1 : INT32_MAX, + nextpage = textprompts[cutnum]->page[scenenum].nextpage ? textprompts[cutnum]->page[scenenum].nextpage - 1 : INT32_MAX, + oldcutnum = cutnum; + + if (textprompts[cutnum]->page[scenenum].nexttag[0]) + F_GetPromptPageByNamedTag(textprompts[cutnum]->page[scenenum].nexttag, &nextprompt, &nextpage); + + // determine next prompt + if (nextprompt != INT32_MAX) + { + if (nextprompt <= MAX_PROMPTS && textprompts[nextprompt]) + cutnum = nextprompt; + else + cutnum = INT32_MAX; + } + + // determine next page + if (nextpage != INT32_MAX) + { + if (cutnum != INT32_MAX) + { + scenenum = nextpage; + if (scenenum >= MAX_PAGES || scenenum > textprompts[cutnum]->numpages-1) + scenenum = INT32_MAX; + } + } + else + { + if (cutnum != oldcutnum) + scenenum = 0; + else if (scenenum + 1 < MAX_PAGES && scenenum < textprompts[cutnum]->numpages-1) + scenenum++; + else + scenenum = INT32_MAX; + } + + // close the prompt if either num is invalid + if (cutnum == INT32_MAX || scenenum == INT32_MAX) + F_EndTextPrompt(false, false); + else + { + // on page mode, number of tics before allowing boost + // on timer mode, number of tics until page advances + timetonext = textprompts[cutnum]->page[scenenum].timetonext ? textprompts[cutnum]->page[scenenum].timetonext : TICRATE/10; + F_PreparePageText(textprompts[cutnum]->page[scenenum].text); + + // gfx + picnum = textprompts[cutnum]->page[scenenum].pictostart; + numpics = textprompts[cutnum]->page[scenenum].numpics; + picmode = textprompts[cutnum]->page[scenenum].picmode; + pictoloop = textprompts[cutnum]->page[scenenum].pictoloop > 0 ? textprompts[cutnum]->page[scenenum].pictoloop - 1 : 0; + picxpos = textprompts[cutnum]->page[scenenum].xcoord[picnum]; + picypos = textprompts[cutnum]->page[scenenum].ycoord[picnum]; + animtimer = pictime = textprompts[cutnum]->page[scenenum].picduration[picnum]; + + // music change + if (textprompts[cutnum]->page[scenenum].musswitch[0]) + S_ChangeMusic(textprompts[cutnum]->page[scenenum].musswitch, + textprompts[cutnum]->page[scenenum].musswitchflags, + textprompts[cutnum]->page[scenenum].musicloop); + } +} + +void F_EndTextPrompt(boolean forceexec, boolean noexec) +{ + boolean promptwasactive = promptactive; + promptactive = false; + callpromptnum = callpagenum = callplayer = INT32_MAX; + + if (promptwasactive) + { + if (promptmo && promptmo->player && promptblockcontrols) + promptmo->reactiontime = TICRATE/4; // prevent jumping right away // \todo account freeze realtime for this) + // \todo reset frozen realtime? + } + + // \todo net safety, maybe loop all player thinkers? + if ((promptwasactive || forceexec) && !noexec && promptpostexectag) + { + if (tmthing) // edge case where starting an invalid prompt immediately on level load will make P_MapStart fail + P_LinedefExecute(promptpostexectag, promptmo, NULL); + else + { + P_MapStart(); + P_LinedefExecute(promptpostexectag, promptmo, NULL); + P_MapEnd(); + } + } +} + +void F_StartTextPrompt(INT32 promptnum, INT32 pagenum, mobj_t *mo, UINT16 postexectag, boolean blockcontrols, boolean freezerealtime) +{ + INT32 i; + + // if splitscreen and we already have a prompt active, ignore. + // \todo Proper per-player splitscreen support (individual prompts) + if (promptactive && splitscreen && promptnum == callpromptnum && pagenum == callpagenum) + return; + + // \todo proper netgame support + if (netgame) + { + F_EndTextPrompt(true, false); // run the post-effects immediately + return; + } + + // We share vars, so no starting text prompts over cutscenes or title screens! + keypressed = false; + finalecount = 0; + timetonext = 0; + animtimer = 0; + stoptimer = 0; + skullAnimCounter = 0; + + // Set up state + promptmo = mo; + promptpostexectag = postexectag; + promptblockcontrols = blockcontrols; + (void)freezerealtime; // \todo freeze player->realtime, maybe this needs to cycle through player thinkers + + // Initialize current prompt and scene + callpromptnum = promptnum; + callpagenum = pagenum; + cutnum = (promptnum < MAX_PROMPTS && textprompts[promptnum]) ? promptnum : INT32_MAX; + scenenum = (cutnum != INT32_MAX && pagenum < MAX_PAGES && pagenum <= textprompts[cutnum]->numpages-1) ? pagenum : INT32_MAX; + promptactive = (cutnum != INT32_MAX && scenenum != INT32_MAX); + + if (promptactive) + { + // on page mode, number of tics before allowing boost + // on timer mode, number of tics until page advances + timetonext = textprompts[cutnum]->page[scenenum].timetonext ? textprompts[cutnum]->page[scenenum].timetonext : TICRATE/10; + F_PreparePageText(textprompts[cutnum]->page[scenenum].text); + + // gfx + picnum = textprompts[cutnum]->page[scenenum].pictostart; + numpics = textprompts[cutnum]->page[scenenum].numpics; + picmode = textprompts[cutnum]->page[scenenum].picmode; + pictoloop = textprompts[cutnum]->page[scenenum].pictoloop > 0 ? textprompts[cutnum]->page[scenenum].pictoloop - 1 : 0; + picxpos = textprompts[cutnum]->page[scenenum].xcoord[picnum]; + picypos = textprompts[cutnum]->page[scenenum].ycoord[picnum]; + animtimer = pictime = textprompts[cutnum]->page[scenenum].picduration[picnum]; + + // music change + if (textprompts[cutnum]->page[scenenum].musswitch[0]) + S_ChangeMusic(textprompts[cutnum]->page[scenenum].musswitch, + textprompts[cutnum]->page[scenenum].musswitchflags, + textprompts[cutnum]->page[scenenum].musicloop); + + // get the calling player + if (promptblockcontrols && mo && mo->player) + { + for (i = 0; i < MAXPLAYERS; i++) + { + if (players[i].mo == mo) + { + callplayer = i; + break; + } + } + } + } + else + F_EndTextPrompt(true, false); // run the post-effects immediately +} + +static boolean F_GetTextPromptTutorialTag(char *tag, INT32 length) +{ + INT32 gcs = gcs_custom; + boolean suffixed = true; + + if (!tag || !tag[0] || !tutorialmode) + return false; + + if (!strncmp(tag, "TAM", 3)) // Movement + gcs = G_GetControlScheme(gamecontrol, gcl_movement, num_gcl_movement); + else if (!strncmp(tag, "TAC", 3)) // Camera + { + // Check for gcl_movement so we can differentiate between FPS and Platform schemes. + gcs = G_GetControlScheme(gamecontrol, gcl_movement, num_gcl_movement); + if (gcs == gcs_custom) // try again, maybe we'll get a match + gcs = G_GetControlScheme(gamecontrol, gcl_camera, num_gcl_camera); + if (gcs == gcs_fps && !cv_usemouse.value) + gcs = gcs_platform; // Platform (arrow) scheme is stand-in for no mouse + } + else if (!strncmp(tag, "TAD", 3)) // Movement and Camera + gcs = G_GetControlScheme(gamecontrol, gcl_movement_camera, num_gcl_movement_camera); + else if (!strncmp(tag, "TAJ", 3)) // Jump + gcs = G_GetControlScheme(gamecontrol, gcl_jump, num_gcl_jump); + else if (!strncmp(tag, "TAS", 3)) // Spin + gcs = G_GetControlScheme(gamecontrol, gcl_use, num_gcl_use); + else if (!strncmp(tag, "TAA", 3)) // Char ability + gcs = G_GetControlScheme(gamecontrol, gcl_jump, num_gcl_jump); + else if (!strncmp(tag, "TAW", 3)) // Shield ability + gcs = G_GetControlScheme(gamecontrol, gcl_jump_use, num_gcl_jump_use); + else + gcs = G_GetControlScheme(gamecontrol, gcl_tutorial_used, num_gcl_tutorial_used); + + switch (gcs) + { + case gcs_fps: + // strncat(tag, "FPS", length); + suffixed = false; + break; + + case gcs_platform: + strncat(tag, "PLATFORM", length); + break; + + default: + strncat(tag, "CUSTOM", length); + break; + } + + return suffixed; +} + +void F_GetPromptPageByNamedTag(const char *tag, INT32 *promptnum, INT32 *pagenum) +{ + INT32 nosuffixpromptnum = INT32_MAX, nosuffixpagenum = INT32_MAX; + INT32 tutorialpromptnum = (tutorialmode) ? TUTORIAL_PROMPT-1 : 0; + boolean suffixed = false, found = false; + char suffixedtag[33]; + + *promptnum = *pagenum = INT32_MAX; + + if (!tag || !tag[0]) + return; + + strncpy(suffixedtag, tag, 33); + suffixedtag[32] = 0; + + if (tutorialmode) + suffixed = F_GetTextPromptTutorialTag(suffixedtag, 33); + + for (*promptnum = 0 + tutorialpromptnum; *promptnum < MAX_PROMPTS; (*promptnum)++) + { + if (!textprompts[*promptnum]) + continue; + + for (*pagenum = 0; *pagenum < textprompts[*promptnum]->numpages && *pagenum < MAX_PAGES; (*pagenum)++) + { + if (suffixed && fastcmp(suffixedtag, textprompts[*promptnum]->page[*pagenum].tag)) + { + // this goes first because fastcmp ends early if first string is shorter + found = true; + break; + } + else if (nosuffixpromptnum == INT32_MAX && nosuffixpagenum == INT32_MAX && fastcmp(tag, textprompts[*promptnum]->page[*pagenum].tag)) + { + if (suffixed) + { + nosuffixpromptnum = *promptnum; + nosuffixpagenum = *pagenum; + // continue searching for the suffixed tag + } + else + { + found = true; + break; + } + } + } + + if (found) + break; + } + + if (suffixed && !found && nosuffixpromptnum != INT32_MAX && nosuffixpagenum != INT32_MAX) + { + found = true; + *promptnum = nosuffixpromptnum; + *pagenum = nosuffixpagenum; + } + + if (!found) + CONS_Debug(DBG_GAMELOGIC, "Text prompt: Can't find a page with named tag %s or suffixed tag %s\n", tag, suffixedtag); +} + +void F_TextPromptDrawer(void) +{ + // reuse: + // cutnum -> promptnum + // scenenum -> pagenum + lumpnum_t iconlump; + UINT8 pagelines; + boolean rightside; + INT32 boxh, texth, texty, namey, chevrony; + INT32 textx, textr; + + // Data + patch_t *patch; + + if (!promptactive) + return; + + iconlump = W_CheckNumForName(textprompts[cutnum]->page[scenenum].iconname); + F_GetPageTextGeometry(&pagelines, &rightside, &boxh, &texth, &texty, &namey, &chevrony, &textx, &textr); + + // Draw gfx first + if (picnum >= 0 && picnum < numpics && textprompts[cutnum]->page[scenenum].picname[picnum][0] != '\0') + { + if (textprompts[cutnum]->page[scenenum].pichires[picnum]) + V_DrawSmallScaledPatch(picxpos, picypos, 0, + W_CachePatchName(textprompts[cutnum]->page[scenenum].picname[picnum], PU_CACHE)); + else + V_DrawScaledPatch(picxpos,picypos, 0, + W_CachePatchName(textprompts[cutnum]->page[scenenum].picname[picnum], PU_CACHE)); + } + + // Draw background + V_DrawPromptBack(boxh, textprompts[cutnum]->page[scenenum].backcolor); + + // Draw narrator icon + if (iconlump != LUMPERROR) + { + INT32 iconx, icony, scale, scaledsize; + patch = W_CachePatchName(textprompts[cutnum]->page[scenenum].iconname, PU_CACHE); + + // scale and center + if (patch->width > patch->height) + { + scale = FixedDiv(((boxh * 4) + (boxh/2)*4) - 4, patch->width); + scaledsize = FixedMul(patch->height, scale); + iconx = (rightside ? BASEVIDWIDTH - (((boxh * 4) + (boxh/2)*4)) : 4) << FRACBITS; + icony = ((namey-4) << FRACBITS) + FixedDiv(BASEVIDHEIGHT - namey + 4 - scaledsize, 2); // account for 4 margin + } + else if (patch->height > patch->width) + { + scale = FixedDiv(((boxh * 4) + (boxh/2)*4) - 4, patch->height); + scaledsize = FixedMul(patch->width, scale); + iconx = (rightside ? BASEVIDWIDTH - (((boxh * 4) + (boxh/2)*4)) : 4) << FRACBITS; + icony = namey << FRACBITS; + iconx += FixedDiv(FixedMul(patch->height, scale) - scaledsize, 2); + } + else + { + scale = FixedDiv(((boxh * 4) + (boxh/2)*4) - 4, patch->width); + iconx = (rightside ? BASEVIDWIDTH - (((boxh * 4) + (boxh/2)*4)) : 4) << FRACBITS; + icony = namey << FRACBITS; + } + + if (textprompts[cutnum]->page[scenenum].iconflip) + iconx += FixedMul(patch->width, scale) << FRACBITS; + + V_DrawFixedPatch(iconx, icony, scale, (V_SNAPTOBOTTOM|(textprompts[cutnum]->page[scenenum].iconflip ? V_FLIP : 0)), patch, NULL); + W_UnlockCachedPatch(patch); + } + + // Draw text + V_DrawString(textx, texty, (V_SNAPTOBOTTOM|V_ALLOWLOWERCASE), cutscene_disptext); + + // Draw name + // Don't use V_YELLOWMAP here so that the name color can be changed with control codes + if (textprompts[cutnum]->page[scenenum].name[0]) + V_DrawString(textx, namey, (V_SNAPTOBOTTOM|V_ALLOWLOWERCASE), textprompts[cutnum]->page[scenenum].name); + + // Draw chevron + if (promptblockcontrols && !timetonext) + V_DrawString(textr-8, chevrony + (skullAnimCounter/5), (V_SNAPTOBOTTOM|V_YELLOWMAP), "\x1B"); // down arrow +} + +void F_TextPromptTicker(void) +{ + INT32 i; + + if (!promptactive || paused || P_AutoPause()) + return; + + // advance animation + finalecount++; + cutscene_boostspeed = 0; + + // for the chevron + if (--skullAnimCounter <= 0) + skullAnimCounter = 8; + + // button handling + if (textprompts[cutnum]->page[scenenum].timetonext) + { + if (promptblockcontrols) // same procedure as below, just without the button handling + { + for (i = 0; i < MAXPLAYERS; i++) + { + if (netgame && i != serverplayer && !IsPlayerAdmin(i)) + continue; + else if (splitscreen) { + // Both players' controls are locked, + // But only consoleplayer can advance the prompt. + // \todo Proper per-player splitscreen support (individual prompts) + if (i == consoleplayer || i == secondarydisplayplayer) + players[i].powers[pw_nocontrol] = 1; + } + else if (i == consoleplayer) + players[i].powers[pw_nocontrol] = 1; + + if (!splitscreen) + break; + } + } + + if (timetonext >= 1) + timetonext--; + + if (!timetonext) + F_AdvanceToNextPage(); + + F_WriteText(); + } + else + { + if (promptblockcontrols) + { + for (i = 0; i < MAXPLAYERS; i++) + { + if (netgame && i != serverplayer && !IsPlayerAdmin(i)) + continue; + else if (splitscreen) { + // Both players' controls are locked, + // But only the triggering player can advance the prompt. + if (i == consoleplayer || i == secondarydisplayplayer) + { + players[i].powers[pw_nocontrol] = 1; + + if (callplayer == consoleplayer || callplayer == secondarydisplayplayer) + { + if (i != callplayer) + continue; + } + else if (i != consoleplayer) + continue; + } + else + continue; + } + else if (i == consoleplayer) + players[i].powers[pw_nocontrol] = 1; + else + continue; + + if ((players[i].cmd.buttons & BT_USE) || (players[i].cmd.buttons & BT_JUMP)) + { + if (timetonext > 1) + timetonext--; + else if (cutscene_baseptr) // don't set boost if we just reset the string + cutscene_boostspeed = 1; // only after a slight delay + + if (keypressed) + { + if (!splitscreen) + break; + else + continue; + } + + if (!timetonext) // is 0 when finished generating text + { + F_AdvanceToNextPage(); + if (promptactive) + S_StartSound(NULL, sfx_menu1); + } + keypressed = true; // prevent repeat events + } + else if (!(players[i].cmd.buttons & BT_USE) && !(players[i].cmd.buttons & BT_JUMP)) + keypressed = false; + + if (!splitscreen) + break; + } + } + + // generate letter-by-letter text + if (scenenum >= MAX_PAGES || + !textprompts[cutnum]->page[scenenum].text || + !textprompts[cutnum]->page[scenenum].text[0] || + !F_WriteText()) + timetonext = !promptblockcontrols; // never show the chevron if we can't toggle pages + } + + // gfx + if (picnum >= 0 && picnum < numpics) + { + if (animtimer <= 0) + { + boolean persistanimtimer = false; + + if (picnum < numpics-1 && textprompts[cutnum]->page[scenenum].picname[picnum+1][0] != '\0') + picnum++; + else if (picmode == PROMPT_PIC_LOOP) + picnum = pictoloop; + else if (picmode == PROMPT_PIC_DESTROY) + picnum = -1; + else // if (picmode == PROMPT_PIC_PERSIST) + persistanimtimer = true; + + if (!persistanimtimer && picnum >= 0) + { + picxpos = textprompts[cutnum]->page[scenenum].xcoord[picnum]; + picypos = textprompts[cutnum]->page[scenenum].ycoord[picnum]; + pictime = textprompts[cutnum]->page[scenenum].picduration[picnum]; + animtimer = pictime; + } + } + else + animtimer--; + } +} diff --git a/src/f_finale.h b/src/f_finale.h index efab71698..c0c6360c3 100644 --- a/src/f_finale.h +++ b/src/f_finale.h @@ -17,6 +17,7 @@ #include "doomtype.h" #include "d_event.h" +#include "p_mobj.h" // // FINALE @@ -33,11 +34,13 @@ void F_IntroTicker(void); void F_TitleScreenTicker(boolean run); void F_CutsceneTicker(void); void F_TitleDemoTicker(void); +void F_TextPromptTicker(void); // Called by main loop. void F_GameEndDrawer(void); void F_IntroDrawer(void); void F_TitleScreenDrawer(void); +void F_SkyScroll(INT32 scrollxspeed, INT32 scrollyspeed, const char *patchname); void F_GameEvaluationDrawer(void); void F_StartGameEvaluation(void); @@ -50,6 +53,13 @@ void F_StartCustomCutscene(INT32 cutscenenum, boolean precutscene, boolean reset void F_CutsceneDrawer(void); void F_EndCutScene(void); +void F_StartTextPrompt(INT32 promptnum, INT32 pagenum, mobj_t *mo, UINT16 postexectag, boolean blockcontrols, boolean freezerealtime); +void F_GetPromptPageByNamedTag(const char *tag, INT32 *promptnum, INT32 *pagenum); +void F_TextPromptDrawer(void); +void F_EndTextPrompt(boolean forceexec, boolean noexec); +boolean F_GetPromptHideHudAll(void); +boolean F_GetPromptHideHud(fixed_t y); + void F_StartGameEnd(void); void F_StartIntro(void); void F_StartTitleScreen(void); @@ -60,17 +70,48 @@ void F_StartContinue(void); void F_ContinueTicker(void); void F_ContinueDrawer(void); -extern INT32 titlescrollspeed; +extern INT32 titlescrollxspeed; +extern INT32 titlescrollyspeed; + +typedef enum +{ + TITLEMAP_OFF = 0, + TITLEMAP_LOADING, + TITLEMAP_RUNNING +} titlemap_enum; + +// Current menu parameters + +extern UINT8 titlemapinaction; +extern mobj_t *titlemapcameraref; +extern char curbgname[8]; +extern SINT8 curfadevalue; +extern boolean curhidepics; +extern INT32 curbgcolor; +extern INT32 curbgxspeed; +extern INT32 curbgyspeed; +extern boolean curbghide; + +#define TITLEBACKGROUNDACTIVE (curfadevalue >= 0 || curbgname[0]) + +void F_InitMenuPresValues(void); +void F_MenuPresTicker(boolean run); // // WIPE // +// HACK for menu fading while titlemapinaction; skips the level check +#define FORCEWIPE -3 +#define FORCEWIPEOFF -2 + extern boolean WipeInAction; extern INT32 lastwipetic; void F_WipeStartScreen(void); void F_WipeEndScreen(void); void F_RunWipe(UINT8 wipetype, boolean drawMenu); +tic_t F_GetWipeLength(UINT8 wipetype); +boolean F_WipeExists(UINT8 wipetype); enum { diff --git a/src/f_wipe.c b/src/f_wipe.c index 95dd5bbde..26c65ad91 100644 --- a/src/f_wipe.c +++ b/src/f_wipe.c @@ -86,7 +86,7 @@ INT32 lastwipetic = 0; static UINT8 *wipe_scr_start; //screen 3 static UINT8 *wipe_scr_end; //screen 4 static UINT8 *wipe_scr; //screen 0 (main drawing) -static fixed_t paldiv; +static fixed_t paldiv = 0; /** Create fademask_t from lump * @@ -145,7 +145,7 @@ static fademask_t *F_GetFadeMask(UINT8 masknum, UINT8 scrnnum) { while (lsize--) { // Determine pixel to use from fademask - pcolor = &pLocalPalette[*lump++]; + pcolor = &pMasterPalette[*lump++]; *mask++ = FixedDiv((pcolor->s.red+1)<>FRACBITS; } @@ -337,7 +337,8 @@ void F_RunWipe(UINT8 wipetype, boolean drawMenu) UINT8 wipeframe = 0; fademask_t *fmask; - paldiv = FixedDiv(257< 99) + return 0; + + for (wipeframe = 0; wipeframe < 100; wipeframe++) + { + sprintf(&lumpname[4], "%.2hu%.2hu", (UINT16)wipetype, (UINT16)wipeframe); + + lumpnum = W_CheckNumForName(lumpname); + if (lumpnum == LUMPERROR) + return --wipeframe; + } + return --wipeframe; +#endif +} + +boolean F_WipeExists(UINT8 wipetype) +{ +#ifdef NOWIPE + return false; +#else + static char lumpname[10] = "FADEmm00"; + lumpnum_t lumpnum; + + if (wipetype > 99) + return false; + + sprintf(&lumpname[4], "%.2hu00", (UINT16)wipetype); + + lumpnum = W_CheckNumForName(lumpname); + return !(lumpnum == LUMPERROR); +#endif +} diff --git a/src/filesrch.c b/src/filesrch.c index 0276e1c90..8f157bdd5 100644 --- a/src/filesrch.c +++ b/src/filesrch.c @@ -16,16 +16,12 @@ #ifdef __GNUC__ #include #endif -#if defined (_WIN32) && !defined (_XBOX) +#ifdef _WIN32 //#define WIN32_LEAN_AND_MEAN #define RPC_NO_WINDOWS_H #include #endif -#ifdef _WIN32_WCE -#include "sdl12/SRB2CE/cehelp.h" -#else #include -#endif #include #include "filesrch.h" @@ -34,7 +30,7 @@ #include "z_zone.h" #include "m_menu.h" // Addons_option_Onchange -#if (defined (_WIN32) && !defined (_WIN32_WCE)) && defined (_MSC_VER) && !defined (_XBOX) +#if defined (_WIN32) && defined (_MSC_VER) #include #include @@ -344,107 +340,6 @@ char *refreshdirname = NULL; size_t packetsizetally = 0; size_t mainwadstally = 0; -#if defined (_XBOX) && defined (_MSC_VER) -filestatus_t filesearch(char *filename, const char *startpath, const UINT8 *wantedmd5sum, - boolean completepath, int maxsearchdepth) -{ -//NONE? - startpath = filename = NULL; - wantedmd5sum = NULL; - maxsearchdepth = 0; - completepath = false; - return FS_NOTFOUND; -} - -void closefilemenu(boolean validsize) -{ - (void)validsize; - return; -} - -void searchfilemenu(char *tempname) -{ - (void)tempname; - return; -} - -boolean preparefilemenu(boolean samedepth) -{ - (void)samedepth; - return false; -} - -#elif defined (_WIN32_WCE) -filestatus_t filesearch(char *filename, const char *startpath, const UINT8 *wantedmd5sum, - boolean completepath, int maxsearchdepth) -{ -#ifdef __GNUC__ -//NONE? - startpath = filename = NULL; - wantedmd5sum = NULL; - maxsearchdepth = 0; - completepath = false; -#else - WIN32_FIND_DATA dta; - HANDLE searchhandle = INVALID_HANDLE_VALUE; - const wchar_t wm[4] = L"*.*"; - - //if (startpath) SetCurrentDirectory(startpath); - if (FIL_ReadFileOK(filename)) - { - // checkfilemd5 returns an FS_* value, either FS_FOUND or FS_MD5SUMBAD - return checkfilemd5(filename, wantedmd5sum); - } - ZeroMemory(&dta,sizeof (dta)); - if (maxsearchdepth) - searchhandle = FindFirstFile(wm,&dta); - if (searchhandle != INVALID_HANDLE_VALUE) - { - do - { - if ((dta.cFileName[0]!='.') && (dta.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)) - { - //if (SetCurrentDirectory(dta.cFileName)) - { // can fail if we haven't the right - filestatus_t found; - found = filesearch(filename,NULL,wantedmd5sum,completepath,maxsearchdepth-1); - //SetCurrentDirectory(".."); - if (found == FS_FOUND || found == FS_MD5SUMBAD) - { - if (completepath) - strcatbf(filename,(char *)dta.cFileName,"\\"); - FindClose(searchhandle); - return found; - } - } - } - } while (FindNextFile(searchhandle,&dta)==0); - FindClose(searchhandle); - } -#endif - return FS_NOTFOUND; -} - -void closefilemenu(boolean validsize) -{ - (void)validsize; - return; -} - -void searchfilemenu(char *tempname) -{ - (void)tempname; - return; -} - -boolean preparefilemenu(boolean samedepth) -{ - (void)samedepth; - return false; -} - -#else - filestatus_t filesearch(char *filename, const char *startpath, const UINT8 *wantedmd5sum, boolean completepath, int maxsearchdepth) { filestatus_t retval = FS_NOTFOUND; @@ -473,9 +368,9 @@ filestatus_t filesearch(char *filename, const char *startpath, const UINT8 *want return FS_NOTFOUND; } - if (searchpath[searchpathindex[depthleft]-2] != '/') + if (searchpath[searchpathindex[depthleft]-2] != PATHSEP[0]) { - searchpath[searchpathindex[depthleft]-1] = '/'; + searchpath[searchpathindex[depthleft]-1] = PATHSEP[0]; searchpath[searchpathindex[depthleft]] = 0; } else @@ -517,7 +412,7 @@ filestatus_t filesearch(char *filename, const char *startpath, const UINT8 *want depthleft++; } - searchpath[searchpathindex[depthleft]-1]='/'; + searchpath[searchpathindex[depthleft]-1]=PATHSEP[0]; searchpath[searchpathindex[depthleft]]=0; } else if (!strcasecmp(searchname, dent->d_name)) @@ -906,5 +801,3 @@ boolean preparefilemenu(boolean samedepth) return true; } - -#endif diff --git a/src/g_game.c b/src/g_game.c index b28ab7752..85d21e8e1 100644 --- a/src/g_game.c +++ b/src/g_game.c @@ -78,10 +78,14 @@ INT16 gamemap = 1; INT16 maptol; UINT8 globalweather = 0; INT32 curWeather = PRECIP_NONE; -INT32 cursaveslot = -1; // Auto-save 1p savegame slot -INT16 lastmapsaved = 0; // Last map we auto-saved at +INT32 cursaveslot = 0; // Auto-save 1p savegame slot +//INT16 lastmapsaved = 0; // Last map we auto-saved at +INT16 lastmaploaded = 0; // Last map the game loaded boolean gamecomplete = false; +UINT8 numgameovers = 0; // for startinglives balance +SINT8 startinglivesbalance[maxgameovers+1] = {3, 5, 7, 9, 12, 15, 20, 25, 30, 40, 50, 75, 99, 0x7F}; + UINT16 mainwads = 0; boolean modifiedgame; // Set if homebrew PWAD stuff has been added. boolean savemoddata = false; @@ -90,6 +94,7 @@ UINT8 modeattacking = ATTACKING_NONE; boolean disableSpeedAdjust = false; boolean imcontinuing = false; boolean runemeraldmanager = false; +UINT16 emeraldspawndelay = 60*TICRATE; // menu demo things UINT8 numDemos = 3; @@ -113,27 +118,38 @@ INT32 secondarydisplayplayer; // for splitscreen tic_t gametic; tic_t levelstarttic; // gametic at level start -UINT32 totalrings; // for intermission +UINT32 ssspheres; // old special stage INT16 lastmap; // last level you were at (returning from special stages) tic_t timeinmap; // Ticker for time spent in level (used for levelcard display) INT16 spstage_start; -INT16 sstage_start; -INT16 sstage_end; +INT16 sstage_start, sstage_end, smpstage_start, smpstage_end; + +INT16 titlemap = 0; +boolean hidetitlepics = false; +INT16 bootmap; //bootmap for loading a map on startup + +INT16 tutorialmap = 0; // map to load for tutorial +boolean tutorialmode = false; // are we in a tutorial right now? +INT32 tutorialgcs = gcs_custom; // which control scheme is loaded? +INT32 tutorialusemouse = 0; // store cv_usemouse user value +INT32 tutorialfreelook = 0; // store cv_alwaysfreelook user value +INT32 tutorialmousemove = 0; // store cv_mousemove user value +INT32 tutorialanalog = 0; // store cv_analog user value boolean looptitle = false; -boolean useNightsSS = false; UINT8 skincolor_redteam = SKINCOLOR_RED; UINT8 skincolor_blueteam = SKINCOLOR_BLUE; -UINT8 skincolor_redring = SKINCOLOR_RED; -UINT8 skincolor_bluering = SKINCOLOR_STEELBLUE; +UINT8 skincolor_redring = SKINCOLOR_SALMON; +UINT8 skincolor_bluering = SKINCOLOR_CORNFLOWER; tic_t countdowntimer = 0; boolean countdowntimeup = false; boolean exitfadestarted = false; cutscene_t *cutscenes[128]; +textprompt_t *textprompts[MAX_PROMPTS]; INT16 nextmapoverride; boolean skipstats; @@ -158,6 +174,7 @@ UINT8 stagefailed; // Used for GEMS BONUS? Also to see if you beat the stage. UINT16 emeralds; UINT32 token; // Number of tokens collected in a level UINT32 tokenlist; // List of tokens collected +boolean gottoken; // Did you get a token? Used for end of act INT32 tokenbits; // Used for setting token bits // Old Special Stage @@ -196,6 +213,7 @@ UINT16 tailsflytics = 8*TICRATE; UINT16 underwatertics = 30*TICRATE; UINT16 spacetimetics = 11*TICRATE + (TICRATE/2); UINT16 extralifetics = 4*TICRATE; +UINT16 nightslinktics = 2*TICRATE; INT32 gameovertics = 15*TICRATE; @@ -241,7 +259,7 @@ static UINT8 demoflags; static UINT16 demoversion; boolean singledemo; // quit after playing a demo from cmdline boolean demo_start; // don't start playing demo right away -static boolean demosynced = true; // console warning message +boolean demosynced = true; // console warning message boolean metalrecording; // recording as metal sonic mobj_t *metalplayback; @@ -286,48 +304,16 @@ static void UserAnalog_OnChange(void); static void UserAnalog2_OnChange(void); static void Analog_OnChange(void); static void Analog2_OnChange(void); +static void DirectionChar_OnChange(void); +static void DirectionChar2_OnChange(void); +static void AutoBrake_OnChange(void); +static void AutoBrake2_OnChange(void); void SendWeaponPref(void); void SendWeaponPref2(void); static CV_PossibleValue_t crosshair_cons_t[] = {{0, "Off"}, {1, "Cross"}, {2, "Angle"}, {3, "Point"}, {0, NULL}}; static CV_PossibleValue_t joyaxis_cons_t[] = {{0, "None"}, -#ifdef _WII -{1, "LStick.X"}, {2, "LStick.Y"}, {-1, "LStick.X-"}, {-2, "LStick.Y-"}, -#if JOYAXISSET > 1 -{3, "RStick.X"}, {4, "RStick.Y"}, {-3, "RStick.X-"}, {-4, "RStick.Y-"}, -#endif -#if JOYAXISSET > 2 -{5, "RTrigger"}, {6, "LTrigger"}, {-5, "RTrigger-"}, {-6, "LTrigger-"}, -#endif -#if JOYAXISSET > 3 -{7, "Pitch"}, {8, "Roll"}, {-7, "Pitch-"}, {-8, "Roll-"}, -#endif -#if JOYAXISSET > 4 -{7, "Yaw"}, {8, "Dummy"}, {-7, "Yaw-"}, {-8, "Dummy-"}, -#endif -#if JOYAXISSET > 4 -{9, "LAnalog"}, {10, "RAnalog"}, {-9, "LAnalog-"}, {-10, "RAnalog-"}, -#endif -#elif defined (WMINPUT) -{1, "LStick.X"}, {2, "LStick.Y"}, {-1, "LStick.X-"}, {-2, "LStick.Y-"}, -#if JOYAXISSET > 1 -{3, "RStick.X"}, {4, "RStick.Y"}, {-3, "RStick.X-"}, {-4, "RStick.Y-"}, -#endif -#if JOYAXISSET > 2 -{5, "NStick.X"}, {6, "NStick.Y"}, {-5, "NStick.X-"}, {-6, "NStick.Y-"}, -#endif -#if JOYAXISSET > 3 -{7, "LAnalog"}, {8, "RAnalog"}, {-7, "LAnalog-"}, {-8, "RAnalog-"}, -#endif -#else {1, "X-Axis"}, {2, "Y-Axis"}, {-1, "X-Axis-"}, {-2, "Y-Axis-"}, -#ifdef _arch_dreamcast -{3, "R-Trig"}, {4, "L-Trig"}, {-3, "R-Trig-"}, {-4, "L-Trig-"}, -{5, "Alt X-Axis"}, {6, "Alt Y-Axis"}, {-5, "Alt X-Axis-"}, {-6, "Alt Y-Axis-"}, -{7, "Triggers"}, {-7,"Triggers-"}, -#elif defined (_XBOX) -{3, "Alt X-Axis"}, {4, "Alt Y-Axis"}, {-3, "Alt X-Axis-"}, {-4, "Alt Y-Axis-"}, -#else #if JOYAXISSET > 1 {3, "Z-Axis"}, {4, "X-Rudder"}, {-3, "Z-Axis-"}, {-4, "X-Rudder-"}, #endif @@ -336,19 +322,11 @@ static CV_PossibleValue_t joyaxis_cons_t[] = {{0, "None"}, #endif #if JOYAXISSET > 3 {7, "U-Axis"}, {8, "V-Axis"}, {-7, "U-Axis-"}, {-8, "V-Axis-"}, -#endif -#endif #endif {0, NULL}}; -#ifdef _WII -#if JOYAXISSET > 5 -"More Axis Sets" -#endif -#else #if JOYAXISSET > 4 "More Axis Sets" #endif -#endif // don't mind me putting these here, I was lazy to figure out where else I could put those without blowing up the compiler. @@ -384,22 +362,27 @@ consvar_t cv_consolechat = {"chatmode", "Window", CV_SAVE, consolechat_cons_t, N consvar_t cv_crosshair = {"crosshair", "Cross", CV_SAVE, crosshair_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL}; consvar_t cv_crosshair2 = {"crosshair2", "Cross", CV_SAVE, crosshair_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL}; consvar_t cv_invertmouse = {"invertmouse", "Off", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL}; -consvar_t cv_invertmouse2 = {"invertmouse2", "Off", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL}; consvar_t cv_alwaysfreelook = {"alwaysmlook", "On", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL}; +consvar_t cv_invertmouse2 = {"invertmouse2", "Off", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL}; consvar_t cv_alwaysfreelook2 = {"alwaysmlook2", "On", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL}; consvar_t cv_chasefreelook = {"chasemlook", "Off", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL}; consvar_t cv_chasefreelook2 = {"chasemlook2", "Off", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL}; consvar_t cv_mousemove = {"mousemove", "Off", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL}; consvar_t cv_mousemove2 = {"mousemove2", "Off", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL}; -consvar_t cv_analog = {"analog", "Off", CV_CALL, CV_OnOff, Analog_OnChange, 0, NULL, NULL, 0, 0, NULL}; -consvar_t cv_analog2 = {"analog2", "Off", CV_CALL, CV_OnOff, Analog2_OnChange, 0, NULL, NULL, 0, 0, NULL}; -#ifdef DC -consvar_t cv_useranalog = {"useranalog", "On", CV_SAVE|CV_CALL, CV_OnOff, UserAnalog_OnChange, 0, NULL, NULL, 0, 0, NULL}; -consvar_t cv_useranalog2 = {"useranalog2", "On", CV_SAVE|CV_CALL, CV_OnOff, UserAnalog2_OnChange, 0, NULL, NULL, 0, 0, NULL}; -#else -consvar_t cv_useranalog = {"useranalog", "Off", CV_SAVE|CV_CALL, CV_OnOff, UserAnalog_OnChange, 0, NULL, NULL, 0, 0, NULL}; -consvar_t cv_useranalog2 = {"useranalog2", "Off", CV_SAVE|CV_CALL, CV_OnOff, UserAnalog2_OnChange, 0, NULL, NULL, 0, 0, NULL}; -#endif + +// previously "analog", "analog2", "useranalog", and "useranalog2", invalidating 2.1-era copies of config.cfg +// changed because it'd be nice to see people try out our actually good controls with gamepads now autobrake exists +consvar_t cv_analog = {"sessionanalog", "Off", CV_CALL|CV_NOSHOWHELP, CV_OnOff, Analog_OnChange, 0, NULL, NULL, 0, 0, NULL}; +consvar_t cv_analog2 = {"sessionanalog2", "Off", CV_CALL|CV_NOSHOWHELP, CV_OnOff, Analog2_OnChange, 0, NULL, NULL, 0, 0, NULL}; +consvar_t cv_useranalog = {"configanalog", "Off", CV_SAVE|CV_CALL|CV_NOSHOWHELP, CV_OnOff, UserAnalog_OnChange, 0, NULL, NULL, 0, 0, NULL}; +consvar_t cv_useranalog2 = {"configanalog2", "Off", CV_SAVE|CV_CALL|CV_NOSHOWHELP, CV_OnOff, UserAnalog2_OnChange, 0, NULL, NULL, 0, 0, NULL}; + +// deez New User eXperiences +static CV_PossibleValue_t directionchar_cons_t[] = {{0, "Camera"}, {1, "Movement"}, {0, NULL}}; +consvar_t cv_directionchar = {"directionchar", "Movement", CV_SAVE|CV_CALL, directionchar_cons_t, DirectionChar_OnChange, 0, NULL, NULL, 0, 0, NULL}; +consvar_t cv_directionchar2 = {"directionchar2", "Movement", CV_SAVE|CV_CALL, directionchar_cons_t, DirectionChar2_OnChange, 0, NULL, NULL, 0, 0, NULL}; +consvar_t cv_autobrake = {"autobrake", "On", CV_SAVE|CV_CALL, CV_OnOff, AutoBrake_OnChange, 0, NULL, NULL, 0, 0, NULL}; +consvar_t cv_autobrake2 = {"autobrake2", "On", CV_SAVE|CV_CALL, CV_OnOff, AutoBrake2_OnChange, 0, NULL, NULL, 0, 0, NULL}; typedef enum { @@ -415,76 +398,23 @@ typedef enum AXISFIRENORMAL, } axis_input_e; -#if defined (_WII) || defined (WMINPUT) -consvar_t cv_turnaxis = {"joyaxis_turn", "LStick.X", CV_SAVE, joyaxis_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL}; -consvar_t cv_moveaxis = {"joyaxis_move", "LStick.Y", CV_SAVE, joyaxis_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL}; -consvar_t cv_sideaxis = {"joyaxis_side", "RStick.X", CV_SAVE, joyaxis_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL}; -consvar_t cv_lookaxis = {"joyaxis_look", "RStick.Y", CV_SAVE, joyaxis_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL}; -consvar_t cv_jumpaxis = {"joyaxis_jump", "None", CV_SAVE, joyaxis_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL}; -consvar_t cv_spinaxis = {"joyaxis_spin", "None", CV_SAVE, joyaxis_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL}; -consvar_t cv_fireaxis = {"joyaxis_fire", "LAnalog", CV_SAVE, joyaxis_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL}; -consvar_t cv_firenaxis = {"joyaxis_firenormal", "RAnalog", CV_SAVE, joyaxis_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL}; -#else consvar_t cv_turnaxis = {"joyaxis_turn", "X-Rudder", CV_SAVE, joyaxis_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL}; -#ifdef PSP -consvar_t cv_moveaxis = {"joyaxis_move", "None", CV_SAVE, joyaxis_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL}; -#else consvar_t cv_moveaxis = {"joyaxis_move", "Y-Axis", CV_SAVE, joyaxis_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL}; -#endif -#ifdef _arch_dreamcast -consvar_t cv_sideaxis = {"joyaxis_side", "Triggers", CV_SAVE, joyaxis_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL}; -#elif defined (_XBOX) -consvar_t cv_sideaxis = {"joyaxis_side", "Alt X-Axis", CV_SAVE, joyaxis_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL}; -consvar_t cv_lookaxis = {"joyaxis_look", "Alt Y-Axis", CV_SAVE, joyaxis_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL}; -#elif defined (PSP) -consvar_t cv_sideaxis = {"joyaxis_side", "None", CV_SAVE, joyaxis_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL}; -#else consvar_t cv_sideaxis = {"joyaxis_side", "X-Axis", CV_SAVE, joyaxis_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL}; -#endif -#ifndef _XBOX -#ifdef PSP -consvar_t cv_lookaxis = {"joyaxis_look", "Y-Axis", CV_SAVE, joyaxis_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL}; -#else consvar_t cv_lookaxis = {"joyaxis_look", "Y-Rudder-", CV_SAVE, joyaxis_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL}; -#endif -#endif consvar_t cv_jumpaxis = {"joyaxis_jump", "None", CV_SAVE, joyaxis_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL}; consvar_t cv_spinaxis = {"joyaxis_spin", "None", CV_SAVE, joyaxis_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL}; consvar_t cv_fireaxis = {"joyaxis_fire", "Z-Axis-", CV_SAVE, joyaxis_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL}; consvar_t cv_firenaxis = {"joyaxis_firenormal", "Z-Axis", CV_SAVE, joyaxis_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL}; -#endif -#if defined (_WII) || defined (WMINPUT) -consvar_t cv_turnaxis2 = {"joyaxis2_turn", "LStick.X", CV_SAVE, joyaxis_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL}; -consvar_t cv_moveaxis2 = {"joyaxis2_move", "LStick.Y", CV_SAVE, joyaxis_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL}; -consvar_t cv_sideaxis2 = {"joyaxis2_side", "RStick.X", CV_SAVE, joyaxis_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL}; -consvar_t cv_lookaxis2 = {"joyaxis2_look", "RStick.Y", CV_SAVE, joyaxis_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL}; -consvar_t cv_jumpaxis2 = {"joyaxis2_jump", "None", CV_SAVE, joyaxis_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL}; -consvar_t cv_spinaxis2 = {"joyaxis2_spin", "None", CV_SAVE, joyaxis_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL}; -consvar_t cv_fireaxis2 = {"joyaxis2_fire", "LAnalog", CV_SAVE, joyaxis_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL}; -consvar_t cv_firenaxis2 = {"joyaxis2_firenormal", "RAnalog", CV_SAVE, joyaxis_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL}; -#else consvar_t cv_turnaxis2 = {"joyaxis2_turn", "X-Rudder", CV_SAVE, joyaxis_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL}; consvar_t cv_moveaxis2 = {"joyaxis2_move", "Y-Axis", CV_SAVE, joyaxis_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL}; -#ifdef _arch_dreamcast -consvar_t cv_sideaxis2 = {"joyaxis2_side", "Triggers", CV_SAVE, joyaxis_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL}; -#elif defined (_XBOX) -consvar_t cv_sideaxis2 = {"joyaxis2_side", "Alt X-Axis", CV_SAVE, joyaxis_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL}; -consvar_t cv_lookaxis2 = {"joyaxis2_look", "Alt Y-Axis", CV_SAVE, joyaxis_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL}; -#elif defined (_PSP) -consvar_t cv_sideaxis2 = {"joyaxis2_side", "None", CV_SAVE, joyaxis_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL}; -#else consvar_t cv_sideaxis2 = {"joyaxis2_side", "X-Axis", CV_SAVE, joyaxis_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL}; -#endif -#ifndef _XBOX consvar_t cv_lookaxis2 = {"joyaxis2_look", "Y-Rudder-", CV_SAVE, joyaxis_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL}; -#endif consvar_t cv_jumpaxis2 = {"joyaxis2_jump", "None", CV_SAVE, joyaxis_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL}; consvar_t cv_spinaxis2 = {"joyaxis2_spin", "None", CV_SAVE, joyaxis_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL}; consvar_t cv_fireaxis2 = {"joyaxis2_fire", "Z-Axis-", CV_SAVE, joyaxis_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL}; consvar_t cv_firenaxis2 = {"joyaxis2_firenormal", "Z-Axis", CV_SAVE, joyaxis_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL}; -#endif - #if MAXPLAYERS > 32 #error "please update player_name table using the new value for MAXPLAYERS" @@ -742,8 +672,7 @@ void G_SetNightsRecords(void) free(gpath); // If the mare count changed, this will update the score display - CV_AddValue(&cv_nextmap, 1); - CV_AddValue(&cv_nextmap, -1); + Nextmap_OnChange(); } // for consistency among messages: this modifies the game and removes savemoddata. @@ -869,14 +798,6 @@ static INT32 JoyAxis(axis_input_e axissel) axisval = -axisval; flp = true; } -#ifdef _arch_dreamcast - if (axisval == 7) // special case - { - retaxis = joyxmove[1] - joyymove[1]; - goto skipDC; - } - else -#endif if (axisval > JOYAXISSET*2 || axisval == 0) //not there in array or None return 0; @@ -892,10 +813,6 @@ static INT32 JoyAxis(axis_input_e axissel) retaxis = joyymove[axisval]; } -#ifdef _arch_dreamcast - skipDC: -#endif - if (retaxis < (-JOYAXISRANGE)) retaxis = -JOYAXISRANGE; if (retaxis > (+JOYAXISRANGE)) @@ -953,14 +870,7 @@ static INT32 Joy2Axis(axis_input_e axissel) axisval = -axisval; flp = true; } -#ifdef _arch_dreamcast - if (axisval == 7) // special case - { - retaxis = joy2xmove[1] - joy2ymove[1]; - goto skipDC; - } - else -#endif + if (axisval > JOYAXISSET*2 || axisval == 0) //not there in array or None return 0; @@ -976,10 +886,6 @@ static INT32 Joy2Axis(axis_input_e axissel) retaxis = joy2ymove[axisval]; } -#ifdef _arch_dreamcast - skipDC: -#endif - if (retaxis < (-JOYAXISRANGE)) retaxis = -JOYAXISRANGE; if (retaxis > (+JOYAXISRANGE)) @@ -1016,7 +922,7 @@ void G_BuildTiccmd(ticcmd_t *cmd, INT32 realtics) INT32 tspeed, forward, side, axis, altaxis, i; const INT32 speed = 1; // these ones used for multiple conditions - boolean turnleft, turnright, mouseaiming, analogjoystickmove, gamepadjoystickmove, thisjoyaiming; + boolean turnleft, turnright, strafelkey, straferkey, movefkey, movebkey, mouseaiming, analogjoystickmove, gamepadjoystickmove, thisjoyaiming; player_t *player = &players[consoleplayer]; camera_t *thiscam = &camera; @@ -1029,7 +935,9 @@ void G_BuildTiccmd(ticcmd_t *cmd, INT32 realtics) // why build a ticcmd if we're paused? // Or, for that matter, if we're being reborn. - if (paused || P_AutoPause() || (gamestate == GS_LEVEL && player->playerstate == PST_REBORN)) + // ...OR if we're blindfolded. No looking into the floor. + if (paused || P_AutoPause() || (gamestate == GS_LEVEL && (player->playerstate == PST_REBORN || ((gametype == GT_TAG || gametype == GT_HIDEANDSEEK) + && (leveltime < hidetime * TICRATE) && (player->pflags & PF_TAGIT))))) { cmd->angleturn = (INT16)(localangle >> 16); cmd->aiming = G_ClipAimingPitch(&localaiming); @@ -1038,6 +946,12 @@ void G_BuildTiccmd(ticcmd_t *cmd, INT32 realtics) turnright = PLAYER1INPUTDOWN(gc_turnright); turnleft = PLAYER1INPUTDOWN(gc_turnleft); + + straferkey = PLAYER1INPUTDOWN(gc_straferight); + strafelkey = PLAYER1INPUTDOWN(gc_strafeleft); + movefkey = PLAYER1INPUTDOWN(gc_forward); + movebkey = PLAYER1INPUTDOWN(gc_backward); + mouseaiming = (PLAYER1INPUTDOWN(gc_mouseaiming)) ^ (cv_chasecam.value ? cv_chasefreelook.value : cv_alwaysfreelook.value); analogjoystickmove = cv_usejoystick.value && !Joystick.bGamepadStyle; @@ -1078,14 +992,13 @@ void G_BuildTiccmd(ticcmd_t *cmd, INT32 realtics) if (turnleft) cmd->angleturn = (INT16)(cmd->angleturn + angleturn[tspeed]); } - if (cv_analog.value || twodlevel + if (twodlevel || (player->mo && (player->mo->flags2 & MF2_TWOD)) || (!demoplayback && (player->climbing - || (player->pflags & PF_NIGHTSMODE) - || (player->pflags & PF_SLIDING) - || (player->pflags & PF_FORCESTRAFE)))) // Analog + || (player->powers[pw_carry] == CR_NIGHTSMODE) + || (player->pflags & (PF_SLIDING|PF_FORCESTRAFE))))) // Analog forcestrafe = true; - if (forcestrafe) // Analog + if (forcestrafe) { if (turnright) side += sidemove[speed]; @@ -1098,6 +1011,13 @@ void G_BuildTiccmd(ticcmd_t *cmd, INT32 realtics) side += ((axis * sidemove[1]) >> 10); } } + else if (cv_analog.value) // Analog + { + if (turnright) + cmd->buttons |= BT_CAMRIGHT; + if (turnleft) + cmd->buttons |= BT_CAMLEFT; + } else { if (turnright) @@ -1129,12 +1049,12 @@ void G_BuildTiccmd(ticcmd_t *cmd, INT32 realtics) // forward with key or button axis = JoyAxis(AXISMOVE); altaxis = JoyAxis(AXISLOOK); - if (PLAYER1INPUTDOWN(gc_forward) || (gamepadjoystickmove && axis < 0) - || ((player->pflags & PF_NIGHTSMODE) + if (movefkey || (gamepadjoystickmove && axis < 0) + || ((player->powers[pw_carry] == CR_NIGHTSMODE) && (PLAYER1INPUTDOWN(gc_lookup) || (gamepadjoystickmove && altaxis < 0)))) forward = forwardmove[speed]; - if (PLAYER1INPUTDOWN(gc_backward) || (gamepadjoystickmove && axis > 0) - || ((player->pflags & PF_NIGHTSMODE) + if (movebkey || (gamepadjoystickmove && axis > 0) + || ((player->powers[pw_carry] == CR_NIGHTSMODE) && (PLAYER1INPUTDOWN(gc_lookdown) || (gamepadjoystickmove && altaxis > 0)))) forward -= forwardmove[speed]; @@ -1143,9 +1063,9 @@ void G_BuildTiccmd(ticcmd_t *cmd, INT32 realtics) // some people strafe left & right with mouse buttons // those people are weird - if (PLAYER1INPUTDOWN(gc_straferight)) + if (straferkey) side += sidemove[speed]; - if (PLAYER1INPUTDOWN(gc_strafeleft)) + if (strafelkey) side -= sidemove[speed]; if (PLAYER1INPUTDOWN(gc_weaponnext)) @@ -1191,15 +1111,6 @@ void G_BuildTiccmd(ticcmd_t *cmd, INT32 realtics) if (PLAYER1INPUTDOWN(gc_use) || (cv_usejoystick.value && axis > 0)) cmd->buttons |= BT_USE; - // Camera Controls - if (cv_debug || cv_analog.value || demoplayback || objectplacing || player->pflags & PF_NIGHTSMODE) - { - if (PLAYER1INPUTDOWN(gc_camleft)) - cmd->buttons |= BT_CAMLEFT; - if (PLAYER1INPUTDOWN(gc_camright)) - cmd->buttons |= BT_CAMRIGHT; - } - if (PLAYER1INPUTDOWN(gc_camreset)) { if (camera.chase && !resetdown) @@ -1239,7 +1150,7 @@ void G_BuildTiccmd(ticcmd_t *cmd, INT32 realtics) if (!keyboard_look && cv_lookaxis.value == 0 && !joyaiming && !mouseaiming) localaiming = 0; - if (!(player->pflags & PF_NIGHTSMODE)) + if (!(player->powers[pw_carry] == CR_NIGHTSMODE)) { if (PLAYER1INPUTDOWN(gc_lookup) || (gamepadjoystickmove && axis < 0)) { @@ -1265,10 +1176,19 @@ void G_BuildTiccmd(ticcmd_t *cmd, INT32 realtics) if (!mouseaiming && cv_mousemove.value) forward += mousey; - if (cv_analog.value || - (!demoplayback && (player->climbing + if ((!demoplayback && (player->climbing || (player->pflags & PF_SLIDING)))) // Analog for mouse side += mousex*2; + else if (cv_analog.value) + { + if (mousex) + { + if (mousex > 0) + cmd->buttons |= BT_CAMRIGHT; + else + cmd->buttons |= BT_CAMLEFT; + } + } else cmd->angleturn = (INT16)(cmd->angleturn - (mousex*8)); @@ -1285,7 +1205,8 @@ void G_BuildTiccmd(ticcmd_t *cmd, INT32 realtics) // No additional acceleration when moving forward/backward and strafing simultaneously. // do this AFTER we cap to MAXPLMOVE so people can't find ways to cheese around this. - if (!forcestrafe && forward && side) + // 9-18-2017: ALSO, only do this when using keys to move. Gamepad analog sticks get severely gimped by this + if (!forcestrafe && (((movefkey || movebkey) && side) || ((strafelkey || straferkey) && forward))) { forward = FixedMul(forward, 3*FRACUNIT/4); side = FixedMul(side, 3*FRACUNIT/4); @@ -1303,9 +1224,10 @@ void G_BuildTiccmd(ticcmd_t *cmd, INT32 realtics) cmd->sidemove = (SINT8)(cmd->sidemove + side); if (cv_analog.value) { - cmd->angleturn = (INT16)(thiscam->angle >> 16); if (player->awayviewtics) cmd->angleturn = (INT16)(player->awayviewmobj->angle >> 16); + else + cmd->angleturn = (INT16)(thiscam->angle >> 16); } else { @@ -1326,7 +1248,7 @@ void G_BuildTiccmd2(ticcmd_t *cmd, INT32 realtics) INT32 tspeed, forward, side, axis, altaxis, i; const INT32 speed = 1; // these ones used for multiple conditions - boolean turnleft, turnright, mouseaiming, analogjoystickmove, gamepadjoystickmove, thisjoyaiming; + boolean turnleft, turnright, strafelkey, straferkey, movefkey, movebkey, mouseaiming, analogjoystickmove, gamepadjoystickmove, thisjoyaiming; player_t *player = &players[secondarydisplayplayer]; camera_t *thiscam = (player->bot == 2 ? &camera : &camera2); @@ -1348,6 +1270,12 @@ void G_BuildTiccmd2(ticcmd_t *cmd, INT32 realtics) turnright = PLAYER2INPUTDOWN(gc_turnright); turnleft = PLAYER2INPUTDOWN(gc_turnleft); + + straferkey = PLAYER2INPUTDOWN(gc_straferight); + strafelkey = PLAYER2INPUTDOWN(gc_strafeleft); + movefkey = PLAYER2INPUTDOWN(gc_forward); + movebkey = PLAYER2INPUTDOWN(gc_backward); + mouseaiming = (PLAYER2INPUTDOWN(gc_mouseaiming)) ^ (cv_chasecam2.value ? cv_chasefreelook2.value : cv_alwaysfreelook2.value); analogjoystickmove = cv_usejoystick2.value && !Joystick2.bGamepadStyle; @@ -1388,12 +1316,11 @@ void G_BuildTiccmd2(ticcmd_t *cmd, INT32 realtics) if (turnleft) cmd->angleturn = (INT16)(cmd->angleturn + angleturn[tspeed]); } - if (cv_analog2.value || twodlevel + if (twodlevel || (player->mo && (player->mo->flags2 & MF2_TWOD)) || player->climbing - || (player->pflags & PF_NIGHTSMODE) - || (player->pflags & PF_SLIDING) - || (player->pflags & PF_FORCESTRAFE)) // Analog + || (player->powers[pw_carry] == CR_NIGHTSMODE) + || (player->pflags & (PF_SLIDING|PF_FORCESTRAFE))) // Analog forcestrafe = true; if (forcestrafe) // Analog { @@ -1408,6 +1335,13 @@ void G_BuildTiccmd2(ticcmd_t *cmd, INT32 realtics) side += ((axis * sidemove[1]) >> 10); } } + else if (cv_analog2.value) // Analog + { + if (turnright) + cmd->buttons |= BT_CAMRIGHT; + if (turnleft) + cmd->buttons |= BT_CAMLEFT; + } else { if (turnright) @@ -1439,12 +1373,12 @@ void G_BuildTiccmd2(ticcmd_t *cmd, INT32 realtics) // forward with key or button axis = Joy2Axis(AXISMOVE); altaxis = Joy2Axis(AXISLOOK); - if (PLAYER2INPUTDOWN(gc_forward) || (gamepadjoystickmove && axis < 0) - || ((player->pflags & PF_NIGHTSMODE) + if (movefkey || (gamepadjoystickmove && axis < 0) + || ((player->powers[pw_carry] == CR_NIGHTSMODE) && (PLAYER2INPUTDOWN(gc_lookup) || (gamepadjoystickmove && altaxis < 0)))) forward = forwardmove[speed]; - if (PLAYER2INPUTDOWN(gc_backward) || (gamepadjoystickmove && axis > 0) - || ((player->pflags & PF_NIGHTSMODE) + if (movebkey || (gamepadjoystickmove && axis > 0) + || ((player->powers[pw_carry] == CR_NIGHTSMODE) && (PLAYER2INPUTDOWN(gc_lookdown) || (gamepadjoystickmove && altaxis > 0)))) forward -= forwardmove[speed]; @@ -1453,9 +1387,9 @@ void G_BuildTiccmd2(ticcmd_t *cmd, INT32 realtics) // some people strafe left & right with mouse buttons // those people are (still) weird - if (PLAYER2INPUTDOWN(gc_straferight)) + if (straferkey) side += sidemove[speed]; - if (PLAYER2INPUTDOWN(gc_strafeleft)) + if (strafelkey) side -= sidemove[speed]; if (PLAYER2INPUTDOWN(gc_weaponnext)) @@ -1498,15 +1432,6 @@ void G_BuildTiccmd2(ticcmd_t *cmd, INT32 realtics) if (PLAYER2INPUTDOWN(gc_use) || (cv_usejoystick2.value && axis > 0)) cmd->buttons |= BT_USE; - // Camera Controls - if (cv_debug || cv_analog2.value || player->pflags & PF_NIGHTSMODE) - { - if (PLAYER2INPUTDOWN(gc_camleft)) - cmd->buttons |= BT_CAMLEFT; - if (PLAYER2INPUTDOWN(gc_camright)) - cmd->buttons |= BT_CAMRIGHT; - } - if (PLAYER2INPUTDOWN(gc_camreset)) { if (camera2.chase && !resetdown) @@ -1546,7 +1471,7 @@ void G_BuildTiccmd2(ticcmd_t *cmd, INT32 realtics) if (!keyboard_look && cv_lookaxis2.value == 0 && !joyaiming && !mouseaiming) localaiming2 = 0; - if (!(player->pflags & PF_NIGHTSMODE)) + if (!(player->powers[pw_carry] == CR_NIGHTSMODE)) { if (PLAYER2INPUTDOWN(gc_lookup) || (gamepadjoystickmove && axis < 0)) { @@ -1572,9 +1497,19 @@ void G_BuildTiccmd2(ticcmd_t *cmd, INT32 realtics) if (!mouseaiming && cv_mousemove2.value) forward += mouse2y; - if (cv_analog2.value || player->climbing + if (player->climbing || (player->pflags & PF_SLIDING)) // Analog for mouse side += mouse2x*2; + else if (cv_analog2.value) + { + if (mouse2x) + { + if (mouse2x > 0) + cmd->buttons |= BT_CAMRIGHT; + else + cmd->buttons |= BT_CAMLEFT; + } + } else cmd->angleturn = (INT16)(cmd->angleturn - (mouse2x*8)); @@ -1591,7 +1526,8 @@ void G_BuildTiccmd2(ticcmd_t *cmd, INT32 realtics) // No additional acceleration when moving forward/backward and strafing simultaneously. // do this AFTER we cap to MAXPLMOVE so people can't find ways to cheese around this. - if (!forcestrafe && forward && side) + // 9-18-2017: ALSO, only do this when using keys to move. Gamepad analog sticks get severely gimped by this + if (!forcestrafe && (((movefkey || movebkey) && side) || ((strafelkey || straferkey) && forward))) { forward = FixedMul(forward, 3*FRACUNIT/4); side = FixedMul(side, 3*FRACUNIT/4); @@ -1622,9 +1558,10 @@ void G_BuildTiccmd2(ticcmd_t *cmd, INT32 realtics) } if (cv_analog2.value) { - cmd->angleturn = (INT16)(thiscam->angle >> 16); if (player->awayviewtics) cmd->angleturn = (INT16)(player->awayviewmobj->angle >> 16); + else + cmd->angleturn = (INT16)(thiscam->angle >> 16); } else { @@ -1684,6 +1621,26 @@ static void Analog2_OnChange(void) SendWeaponPref2(); } +static void DirectionChar_OnChange(void) +{ + SendWeaponPref(); +} + +static void DirectionChar2_OnChange(void) +{ + SendWeaponPref2(); +} + +static void AutoBrake_OnChange(void) +{ + SendWeaponPref(); +} + +static void AutoBrake2_OnChange(void) +{ + SendWeaponPref2(); +} + // // G_DoLoadLevel // @@ -1693,6 +1650,7 @@ void G_DoLoadLevel(boolean resetplayer) // Make sure objectplace is OFF when you first start the level! OP_ResetObjectplace(); + demosynced = true; levelstarttic = gametic; // for time calculation @@ -1702,6 +1660,21 @@ void G_DoLoadLevel(boolean resetplayer) if (gamestate == GS_INTERMISSION) Y_EndIntermission(); + // cleanup + if (titlemapinaction == TITLEMAP_LOADING) + { + if (W_CheckNumForName(G_BuildMapName(gamemap)) == LUMPERROR) + { + titlemap = 0; // let's not infinite recursion ok + Command_ExitGame_f(); + return; + } + + titlemapinaction = TITLEMAP_RUNNING; + } + else + titlemapinaction = TITLEMAP_OFF; + G_SetGamestate(GS_LEVEL); for (i = 0; i < MAXPLAYERS; i++) @@ -1711,7 +1684,7 @@ void G_DoLoadLevel(boolean resetplayer) } // Setup the level. - if (!P_SetupLevel(false)) + if (!P_SetupLevel(false)) // this never returns false? { // fail so reset game stuff Command_ExitGame_f(); @@ -1749,7 +1722,8 @@ void G_DoLoadLevel(boolean resetplayer) CON_ClearHUD(); } -static INT32 pausedelay = 0; +INT32 pausedelay = 0; +boolean pausebreakkey = false; static INT32 camtoggledelay, camtoggledelay2 = 0; // @@ -1868,7 +1842,6 @@ boolean G_Responder(event_t *ev) return true; } } - else if (gamestate == GS_CREDITS) { if (HU_Responder(ev)) @@ -1882,17 +1855,15 @@ boolean G_Responder(event_t *ev) return true; } } - else if (gamestate == GS_CONTINUING) { if (F_ContinueResponder(ev)) return true; } // Demo End - else if (gamestate == GS_GAMEEND || gamestate == GS_EVALUATION || gamestate == GS_CREDITS) + else if (gamestate == GS_GAMEEND) return true; - - else if (gamestate == GS_INTERMISSION) + else if (gamestate == GS_INTERMISSION || gamestate == GS_EVALUATION) if (HU_Responder(ev)) return true; // chat ate the event @@ -1906,17 +1877,32 @@ boolean G_Responder(event_t *ev) || ev->data1 == gamecontrol[gc_pause][1] || ev->data1 == KEY_PAUSE) { - if (!pausedelay) + if (modeattacking && !demoplayback && (gamestate == GS_LEVEL)) { - // don't let busy scripts prevent pausing - pausedelay = NEWTICRATE/7; + pausebreakkey = (ev->data1 == KEY_PAUSE); + if (menuactive || pausedelay < 0 || leveltime < 2) + return true; - // command will handle all the checks for us - COM_ImmedExecute("pause"); - return true; + if (pausedelay < 1+(NEWTICRATE/2)) + pausedelay = 1+(NEWTICRATE/2); + else if (++pausedelay > 1+(NEWTICRATE/2)+(NEWTICRATE/3)) + { + G_SetRetryFlag(); + return true; + } + pausedelay++; // counteract subsequent subtraction this frame } else - pausedelay = NEWTICRATE/7; + { + INT32 oldpausedelay = pausedelay; + pausedelay = (NEWTICRATE/7); + if (!oldpausedelay) + { + // command will handle all the checks for us + COM_ImmedExecute("pause"); + return true; + } + } } if (ev->data1 == gamecontrol[gc_camtoggle][0] || ev->data1 == gamecontrol[gc_camtoggle][1]) @@ -1976,11 +1962,19 @@ void G_Ticker(boolean run) { G_ClearRetryFlag(); - // Costs a life to retry ... unless the player in question is dead already. - if (G_GametypeUsesLives() && players[consoleplayer].playerstate == PST_LIVE) - players[consoleplayer].lives -= 1; + if (modeattacking) + { + pausedelay = INT32_MIN; + M_ModeAttackRetry(0); + } + else + { + // Costs a life to retry ... unless the player in question is dead already. + if (G_GametypeUsesLives() && players[consoleplayer].playerstate == PST_LIVE && players[consoleplayer].lives != INFLIVES) + players[consoleplayer].lives -= 1; - G_DoReborn(consoleplayer); + G_DoReborn(consoleplayer); + } } for (i = 0; i < MAXPLAYERS; i++) @@ -2018,6 +2012,7 @@ void G_Ticker(boolean run) F_TitleDemoTicker(); P_Ticker(run); // tic the game ST_Ticker(); + F_TextPromptTicker(); AM_Ticker(); HU_Ticker(); break; @@ -2029,6 +2024,7 @@ void G_Ticker(boolean run) break; case GS_TIMEATTACK: + F_MenuPresTicker(run); break; case GS_INTRO: @@ -2050,6 +2046,7 @@ void G_Ticker(boolean run) case GS_EVALUATION: if (run) F_GameEvaluationTicker(); + HU_Ticker(); break; case GS_CONTINUING: @@ -2064,7 +2061,10 @@ void G_Ticker(boolean run) break; case GS_TITLESCREEN: + if (titlemapinaction) P_Ticker(run); // then intentionally fall through + /* FALLTHRU */ case GS_WAITINGPLAYERS: + F_MenuPresTicker(run); F_TitleScreenTicker(run); break; @@ -2075,8 +2075,13 @@ void G_Ticker(boolean run) if (run) { - if (pausedelay) - pausedelay--; + if (pausedelay && pausedelay != INT32_MIN) + { + if (pausedelay > 0) + pausedelay--; + else + pausedelay++; + } if (camtoggledelay) camtoggledelay--; @@ -2127,6 +2132,8 @@ void G_PlayerReborn(INT32 player) INT32 score; INT32 lives; INT32 continues; + fixed_t camerascale; + fixed_t shieldscale; UINT8 charability; UINT8 charability2; fixed_t normalspeed; @@ -2139,6 +2146,7 @@ void G_PlayerReborn(INT32 player) UINT32 thokitem; UINT32 spinitem; UINT32 revitem; + UINT32 followitem; fixed_t actionspd; fixed_t mindash; fixed_t maxdash; @@ -2150,6 +2158,8 @@ void G_PlayerReborn(INT32 player) INT32 starpostnum; INT32 starpostangle; fixed_t jumpfactor; + fixed_t height; + fixed_t spinheight; INT32 exiting; INT16 numboxes; INT16 totalring; @@ -2157,8 +2167,10 @@ void G_PlayerReborn(INT32 player) UINT8 mare; UINT8 skincolor; INT32 skin; + UINT32 availabilities; tic_t jointime; boolean spectator; + boolean outofcoop; INT16 bot; SINT8 pity; @@ -2169,7 +2181,8 @@ void G_PlayerReborn(INT32 player) exiting = players[player].exiting; jointime = players[player].jointime; spectator = players[player].spectator; - pflags = (players[player].pflags & (PF_TIMEOVER|PF_FLIPCAM|PF_TAGIT|PF_TAGGED|PF_ANALOGMODE)); + outofcoop = players[player].outofcoop; + pflags = (players[player].pflags & (PF_FLIPCAM|PF_ANALOGMODE|PF_DIRECTIONCHAR|PF_AUTOBRAKE|PF_TAGIT|PF_GAMETYPEOVER)); // As long as we're not in multiplayer, carry over cheatcodes from map to map if (!(netgame || multiplayer)) @@ -2181,6 +2194,9 @@ void G_PlayerReborn(INT32 player) skincolor = players[player].skincolor; skin = players[player].skin; + availabilities = players[player].availabilities; + camerascale = players[player].camerascale; + shieldscale = players[player].shieldscale; charability = players[player].charability; charability2 = players[player].charability2; normalspeed = players[player].normalspeed; @@ -2197,9 +2213,12 @@ void G_PlayerReborn(INT32 player) starpostnum = players[player].starpostnum; starpostangle = players[player].starpostangle; jumpfactor = players[player].jumpfactor; + height = players[player].height; + spinheight = players[player].spinheight; thokitem = players[player].thokitem; spinitem = players[player].spinitem; revitem = players[player].revitem; + followitem = players[player].followitem; actionspd = players[player].actionspd; mindash = players[player].mindash; maxdash = players[player].maxdash; @@ -2218,10 +2237,14 @@ void G_PlayerReborn(INT32 player) p->ctfteam = ctfteam; p->jointime = jointime; p->spectator = spectator; + p->outofcoop = outofcoop; // save player config truth reborn p->skincolor = skincolor; p->skin = skin; + p->availabilities = availabilities; + p->camerascale = camerascale; + p->shieldscale = shieldscale; p->charability = charability; p->charability2 = charability2; p->normalspeed = normalspeed; @@ -2233,6 +2256,7 @@ void G_PlayerReborn(INT32 player) p->thokitem = thokitem; p->spinitem = spinitem; p->revitem = revitem; + p->followitem = followitem; p->actionspd = actionspd; p->mindash = mindash; p->maxdash = maxdash; @@ -2244,6 +2268,8 @@ void G_PlayerReborn(INT32 player) p->starpostnum = starpostnum; p->starpostangle = starpostangle; p->jumpfactor = jumpfactor; + p->height = height; + p->spinheight = spinheight; p->exiting = exiting; p->numboxes = numboxes; @@ -2261,11 +2287,11 @@ void G_PlayerReborn(INT32 player) p->pflags |= PF_JUMPDOWN; p->playerstate = PST_LIVE; - p->health = 1; // 0 rings + p->rings = p->spheres = 0; // 0 rings p->panim = PA_IDLE; // standing animation - if ((netgame || multiplayer) && !p->spectator) - p->powers[pw_flashing] = flashingtics-1; // Babysitting deterrent + //if ((netgame || multiplayer) && !p->spectator) -- moved into P_SpawnPlayer to account for forced changes there + //p->powers[pw_flashing] = flashingtics-1; // Babysitting deterrent if (p-players == consoleplayer) { @@ -2297,6 +2323,8 @@ void G_PlayerReborn(INT32 player) if (p->mare == 255) p->mare = 0; + p->marelap = p->marebonuslap = 0; + // Check to make sure their color didn't change somehow... if (G_GametypeHasTeams()) { @@ -2370,6 +2398,8 @@ void G_SpawnPlayer(INT32 playernum, boolean starpost) P_SpawnPlayer(playernum); + players[playernum].rings = mapheaderinfo[gamemap-1]->startrings; + if (starpost) //Don't even bother with looking for a place to spawn. { P_MovePlayerToStarpost(playernum); @@ -2559,7 +2589,8 @@ void G_ChangePlayerReferences(mobj_t *oldmo, mobj_t *newmo) void G_DoReborn(INT32 playernum) { player_t *player = &players[playernum]; - boolean starpost = false; + boolean resetlevel = false; + INT32 i; if (modeattacking) { @@ -2585,35 +2616,98 @@ void G_DoReborn(INT32 playernum) B_RespawnBot(playernum); if (oldmo) G_ChangePlayerReferences(oldmo, players[playernum].mo); + + return; } - else if (countdowntimeup || (!multiplayer && gametype == GT_COOP)) + + if (countdowntimeup || (!(netgame || multiplayer) && gametype == GT_COOP)) + resetlevel = true; + else if (gametype == GT_COOP && (netgame || multiplayer)) + { + boolean notgameover = true; + + if (cv_cooplives.value != 0 && player->lives <= 0) // consider game over first + { + for (i = 0; i < MAXPLAYERS; i++) + { + if (!playeringame[i]) + continue; + if (players[i].exiting || players[i].lives > 0) + break; + } + + if (i == MAXPLAYERS) + { + notgameover = false; + if (!countdown2) + { + // They're dead, Jim. + //nextmapoverride = spstage_start; + nextmapoverride = gamemap; + countdown2 = TICRATE; + skipstats = true; + + for (i = 0; i < MAXPLAYERS; i++) + { + if (playeringame[i]) + players[i].score = 0; + } + + //emeralds = 0; + tokenbits = 0; + tokenlist = 0; + token = 0; + } + } + } + + if (notgameover && cv_coopstarposts.value == 2) + { + for (i = 0; i < MAXPLAYERS; i++) + { + if (!playeringame[i]) + continue; + + if (players[i].playerstate != PST_DEAD && !players[i].spectator && players[i].mo && players[i].mo->health) + break; + } + if (i == MAXPLAYERS) + resetlevel = true; + } + } + + if (resetlevel) { // reload the level from scratch if (countdowntimeup) { - player->starpostangle = 0; - player->starposttime = 0; - player->starpostx = 0; - player->starposty = 0; - player->starpostz = 0; - player->starpostnum = 0; + for (i = 0; i < MAXPLAYERS; i++) + { + if (!playeringame[i]) + continue; + players[i].starpostangle = 0; + players[i].starposttime = 0; + players[i].starpostx = 0; + players[i].starposty = 0; + players[i].starpostz = 0; + players[i].starpostnum = 0; + } } if (!countdowntimeup && (mapheaderinfo[gamemap-1]->levelflags & LF_NORELOAD)) { - INT32 i; - - player->playerstate = PST_REBORN; - P_LoadThingsOnly(); - P_ClearStarPost(player->starpostnum); + for (i = 0; i < MAXPLAYERS; i++) + { + if (!playeringame[i]) + continue; + players[i].playerstate = PST_REBORN; + P_ClearStarPost(players[i].starpostnum); + } // Do a wipe wipegamestate = -1; - if (player->starposttime) - starpost = true; - if (camera.chase) P_ResetCamera(&players[displayplayer], &camera); if (camera2.chase && splitscreen) @@ -2621,7 +2715,7 @@ void G_DoReborn(INT32 playernum) // clear cmd building stuff memset(gamekeydown, 0, sizeof (gamekeydown)); - for (i = 0;i < JOYAXISSET; i++) + for (i = 0; i < JOYAXISSET; i++) { joyxmove[i] = joyymove[i] = 0; joy2xmove[i] = joy2ymove[i] = 0; @@ -2633,12 +2727,24 @@ void G_DoReborn(INT32 playernum) CON_ClearHUD(); // Starpost support - G_SpawnPlayer(playernum, starpost); + for (i = 0; i < MAXPLAYERS; i++) + { + if (!playeringame[i]) + continue; + G_SpawnPlayer(i, (players[i].starposttime)); + } - if (botingame) - { // Bots respawn next to their master. - players[secondarydisplayplayer].playerstate = PST_REBORN; - G_SpawnPlayer(secondarydisplayplayer, false); + // restore time in netgame (see also p_setup.c) + if ((netgame || multiplayer) && gametype == GT_COOP && cv_coopstarposts.value == 2) + { + // is this a hack? maybe + tic_t maxstarposttime = 0; + for (i = 0; i < MAXPLAYERS; i++) + { + if (playeringame[i] && players[i].starposttime > maxstarposttime) + maxstarposttime = players[i].starposttime; + } + leveltime = maxstarposttime; } } else @@ -2647,6 +2753,7 @@ void G_DoReborn(INT32 playernum) LUAh_MapChange(gamemap); #endif G_DoLoadLevel(true); + return; } } else @@ -2654,8 +2761,11 @@ void G_DoReborn(INT32 playernum) // respawn at the start mobj_t *oldmo = NULL; - if (player->starposttime) - starpost = true; + // Not resetting map, so return to level music + if (!countdown2 + && player->lives <= 0 + && cv_cooplives.value == 1) // not allowed for life steal because no way to come back from zero group lives without addons, which should call this anyways + P_RestoreMultiMusic(player); // first dissasociate the corpse if (player->mo) @@ -2665,7 +2775,7 @@ void G_DoReborn(INT32 playernum) P_RemoveMobj(player->mo); } - G_SpawnPlayer(playernum, starpost); + G_SpawnPlayer(playernum, (player->starposttime)); if (oldmo) G_ChangePlayerReferences(oldmo, players[playernum].mo); } @@ -2673,10 +2783,49 @@ void G_DoReborn(INT32 playernum) void G_AddPlayer(INT32 playernum) { + INT32 countplayers = 0, notexiting = 0; + player_t *p = &players[playernum]; + // Go through the current players and make sure you have the latest starpost set + if (G_PlatformGametype() && (netgame || multiplayer)) + { + INT32 i; + for (i = 0; i < MAXPLAYERS; i++) + { + if (!playeringame[i]) + continue; + + if (players[i].bot) // ignore dumb, stupid tails + continue; + + countplayers++; + + if (!players->exiting) + notexiting++; + + if (!(cv_coopstarposts.value && (gametype == GT_COOP) && (p->starpostnum < players[i].starpostnum))) + continue; + + p->starposttime = players[i].starposttime; + p->starpostx = players[i].starpostx; + p->starposty = players[i].starposty; + p->starpostz = players[i].starpostz; + p->starpostangle = players[i].starpostangle; + p->starpostnum = players[i].starpostnum; + } + } + p->jointime = 0; p->playerstate = PST_REBORN; + + p->height = mobjinfo[MT_PLAYER].height; + + if (G_GametypeUsesLives() || ((netgame || multiplayer) && gametype == GT_COOP)) + p->lives = cv_startinglives.value; + + if (countplayers && !notexiting) + P_DoPlayerExit(p); } void G_ExitLevel(void) @@ -2717,7 +2866,7 @@ const char *Gametype_Names[NUMGAMETYPES] = "Team Match", // GT_TEAMMATCH "Tag", // GT_TAG - "Hide and Seek", // GT_HIDEANDSEEK + "Hide & Seek", // GT_HIDEANDSEEK "CTF" // GT_CTF }; @@ -2746,7 +2895,11 @@ INT32 G_GetGametypeByName(const char *gametypestr) // boolean G_IsSpecialStage(INT32 mapnum) { - if (gametype == GT_COOP && modeattacking != ATTACKING_RECORD && mapnum >= sstage_start && mapnum <= sstage_end) + if (gametype != GT_COOP || modeattacking == ATTACKING_RECORD) + return false; + if (mapnum >= sstage_start && mapnum <= sstage_end) + return true; + if (mapnum >= smpstage_start && mapnum <= smpstage_end) return true; return false; @@ -2882,10 +3035,12 @@ static INT16 RandMap(INT16 tolflags, INT16 pprevmap) static void G_DoCompleted(void) { INT32 i; - boolean gottoken = false; tokenlist = 0; // Reset the list + if (modeattacking && pausedelay) + pausedelay = 0; + gameaction = ga_nothing; if (metalplayback) @@ -2968,26 +3123,18 @@ static void G_DoCompleted(void) if (nextmap >= 1100-1 && nextmap <= 1102-1 && (gametype == GT_RACE || gametype == GT_COMPETITION)) nextmap = (INT16)(spstage_start-1); - if (gametype == GT_COOP && token) + if ((gottoken = (gametype == GT_COOP && token))) { token--; - gottoken = true; - if (!(emeralds & EMERALD1)) - nextmap = (INT16)(sstage_start - 1); // Special Stage 1 - else if (!(emeralds & EMERALD2)) - nextmap = (INT16)(sstage_start); // Special Stage 2 - else if (!(emeralds & EMERALD3)) - nextmap = (INT16)(sstage_start + 1); // Special Stage 3 - else if (!(emeralds & EMERALD4)) - nextmap = (INT16)(sstage_start + 2); // Special Stage 4 - else if (!(emeralds & EMERALD5)) - nextmap = (INT16)(sstage_start + 3); // Special Stage 5 - else if (!(emeralds & EMERALD6)) - nextmap = (INT16)(sstage_start + 4); // Special Stage 6 - else if (!(emeralds & EMERALD7)) - nextmap = (INT16)(sstage_start + 5); // Special Stage 7 - else + for (i = 0; i < 7; i++) + if (!(emeralds & (1< 0) + G_SaveGameOver((UINT32)cursaveslot, true); + // Reset # of lives - pl->lives = (ultimatemode) ? 1 : 3; + pl->lives = (ultimatemode) ? 1 : startinglivesbalance[numgameovers]; D_MapChange(gamemap, gametype, ultimatemode, false, 0, false, false); @@ -3156,9 +3306,9 @@ void G_LoadGameSettings(void) { // defaults spstage_start = 1; - sstage_start = 50; - sstage_end = 57; // 8 special stages in vanilla SRB2 - useNightsSS = false; //true; + sstage_start = smpstage_start = 50; + sstage_end = smpstage_end = 56; // 7 special stages in vanilla SRB2 + sstage_end++; // plus one weirdo // initialize free sfx slots for skin sounds S_InitRuntimeSounds(); @@ -3363,7 +3513,7 @@ void G_SaveGameData(void) // TODO put another cipher on these things? meh, I don't care... for (i = 0; i < NUMMAPS; i++) - WRITEUINT8(save_p, mapvisited[i]); + WRITEUINT8(save_p, (mapvisited[i] & MV_MAX)); // To save space, use one bit per collected/achieved/unlocked flag for (i = 0; i < MAXEMBLEMS;) @@ -3448,59 +3598,6 @@ void G_SaveGameData(void) #define VERSIONSIZE 16 -#ifdef SAVEGAMES_OTHERVERSIONS -static INT16 startonmapnum = 0; - -// -// User wants to load a savegame from a different version? -// -static void M_ForceLoadGameResponse(INT32 ch) -{ - if (ch != 'y' && ch != KEY_ENTER) - { - //refused - Z_Free(savebuffer); - save_p = savebuffer = NULL; - startonmapnum = 0; - M_SetupNextMenu(&SP_LoadDef); - return; - } - - // pick up where we left off. - save_p += VERSIONSIZE; - if (!P_LoadGame(startonmapnum)) - { - M_ClearMenus(true); // so ESC backs out to title - M_StartMessage(M_GetText("Savegame file corrupted\n\nPress ESC\n"), NULL, MM_NOTHING); - Command_ExitGame_f(); - Z_Free(savebuffer); - save_p = savebuffer = NULL; - startonmapnum = 0; - - // no cheating! - memset(&savedata, 0, sizeof(savedata)); - return; - } - - // done - Z_Free(savebuffer); - save_p = savebuffer = NULL; - startonmapnum = 0; - - //set cursaveslot to -1 so nothing gets saved. - cursaveslot = -1; - - displayplayer = consoleplayer; - multiplayer = splitscreen = false; - - if (setsizeneeded) - R_ExecuteSetViewSize(); - - M_ClearMenus(true); - CON_ToggleOff(); -} -#endif - // // G_InitFromSavegame // Can be called by the startup code or the menu task. @@ -3593,13 +3690,13 @@ void G_LoadGame(UINT32 slot, INT16 mapoverride) // G_SaveGame // Saves your game. // -void G_SaveGame(UINT32 savegameslot) +void G_SaveGame(UINT32 slot) { boolean saved; char savename[256] = ""; const char *backup; - sprintf(savename, savegamename, savegameslot); + sprintf(savename, savegamename, slot); backup = va("%s",savename); // save during evaluation or credits? game's over, folks! @@ -3635,9 +3732,91 @@ void G_SaveGame(UINT32 savegameslot) if (cv_debug && saved) CONS_Printf(M_GetText("Game saved.\n")); else if (!saved) - CONS_Alert(CONS_ERROR, M_GetText("Error while writing to %s for save slot %u, base: %s\n"), backup, savegameslot, savegamename); + CONS_Alert(CONS_ERROR, M_GetText("Error while writing to %s for save slot %u, base: %s\n"), backup, slot, savegamename); } +#define BADSAVE goto cleanup; +#define CHECKPOS if (save_p >= end_p) BADSAVE +void G_SaveGameOver(UINT32 slot, boolean modifylives) +{ + boolean saved = false; + size_t length; + char vcheck[VERSIONSIZE]; + char savename[255]; + const char *backup; + + sprintf(savename, savegamename, slot); + backup = va("%s",savename); + + length = FIL_ReadFile(savename, &savebuffer); + if (!length) + { + CONS_Printf(M_GetText("Couldn't read file %s\n"), savename); + return; + } + + { + char temp[sizeof(timeattackfolder)]; + UINT8 *end_p = savebuffer + length; + UINT8 *lives_p; + SINT8 pllives; + + save_p = savebuffer; + // Version check + memset(vcheck, 0, sizeof (vcheck)); + sprintf(vcheck, "version %d", VERSION); + if (strcmp((const char *)save_p, (const char *)vcheck)) BADSAVE + save_p += VERSIONSIZE; + + // P_UnArchiveMisc() + (void)READINT16(save_p); + CHECKPOS + (void)READUINT16(save_p); // emeralds + CHECKPOS + READSTRINGN(save_p, temp, sizeof(temp)); // mod it belongs to + if (strcmp(temp, timeattackfolder)) BADSAVE + + // P_UnArchivePlayer() + CHECKPOS + (void)READUINT16(save_p); + CHECKPOS + + WRITEUINT8(save_p, numgameovers); + CHECKPOS + + lives_p = save_p; + pllives = READSINT8(save_p); // lives + CHECKPOS + if (modifylives && pllives < startinglivesbalance[numgameovers]) + { + pllives = startinglivesbalance[numgameovers]; + WRITESINT8(lives_p, pllives); + } + + (void)READINT32(save_p); // Score + CHECKPOS + (void)READINT32(save_p); // continues + + // File end marker check + CHECKPOS + if (READUINT8(save_p) != 0x1d) BADSAVE; + + // done + saved = FIL_WriteFile(backup, savebuffer, length); + } + +cleanup: + if (cv_debug && saved) + CONS_Printf(M_GetText("Game saved.\n")); + else if (!saved) + CONS_Alert(CONS_ERROR, M_GetText("Error while writing to %s for save slot %u, base: %s\n"), backup, slot, savegamename); + Z_Free(savebuffer); + save_p = savebuffer = NULL; + +} +#undef CHECKPOS +#undef BADSAVE + // // G_DeferedInitNew // Can be called by the startup code or the menu task, @@ -3645,7 +3824,7 @@ void G_SaveGame(UINT32 savegameslot) // void G_DeferedInitNew(boolean pultmode, const char *mapname, INT32 pickedchar, boolean SSSG, boolean FLS) { - UINT8 color = 0; + UINT8 color = skins[pickedchar].prefcolor; paused = false; if (demoplayback) @@ -3657,10 +3836,8 @@ void G_DeferedInitNew(boolean pultmode, const char *mapname, INT32 pickedchar, b if (savedata.lives > 0) { - color = savedata.skincolor; - botskin = savedata.botskin; - botcolor = savedata.botcolor; - botingame = (botskin != 0); + if ((botingame = ((botskin = savedata.botskin) != 0))) + botcolor = skins[botskin-1].prefcolor; } else if (splitscreen != SSSG) { @@ -3668,8 +3845,7 @@ void G_DeferedInitNew(boolean pultmode, const char *mapname, INT32 pickedchar, b SplitScreen_OnChange(); } - if (!color) - color = skins[pickedchar].prefcolor; + color = skins[pickedchar].prefcolor; SetPlayerSkinByNum(consoleplayer, pickedchar); CV_StealthSet(&cv_skin, skins[pickedchar].name); CV_StealthSetValue(&cv_playercolor, color); @@ -3682,7 +3858,7 @@ void G_DeferedInitNew(boolean pultmode, const char *mapname, INT32 pickedchar, b // This is the map command interpretation something like Command_Map_f // // called at: map cmd execution, doloadgame, doplaydemo -void G_InitNew(UINT8 pultmode, const char *mapname, boolean resetplayer, boolean skipprecutscene) +void G_InitNew(UINT8 pultmode, const char *mapname, boolean resetplayer, boolean skipprecutscene, boolean FLS) { INT32 i; @@ -3701,7 +3877,7 @@ void G_InitNew(UINT8 pultmode, const char *mapname, boolean resetplayer, boolean if (resetplayer) { // Clear a bunch of variables - tokenlist = token = sstimer = redscore = bluescore = lastmap = 0; + numgameovers = tokenlist = token = sstimer = redscore = bluescore = lastmap = 0; countdown = countdown2 = exitfadestarted = 0; for (i = 0; i < MAXPLAYERS; i++) @@ -3712,27 +3888,26 @@ void G_InitNew(UINT8 pultmode, const char *mapname, boolean resetplayer, boolean if (netgame || multiplayer) { - players[i].lives = cv_startinglives.value; - players[i].continues = 0; - } - else if (pultmode) - { - players[i].lives = 1; + if (!FLS || (players[i].lives < 1)) + players[i].lives = cv_startinglives.value; players[i].continues = 0; } else { - players[i].lives = 3; - players[i].continues = 1; + players[i].lives = (pultmode) ? 1 : startinglivesbalance[0]; + players[i].continues = (pultmode) ? 0 : 1; } + if (!((netgame || multiplayer) && (FLS))) + players[i].score = 0; + // The latter two should clear by themselves, but just in case - players[i].pflags &= ~(PF_TAGIT|PF_TAGGED|PF_FULLSTASIS); + players[i].pflags &= ~(PF_TAGIT|PF_GAMETYPEOVER|PF_FULLSTASIS); // Clear cheatcodes too, just in case. players[i].pflags &= ~(PF_GODMODE|PF_NOCLIP|PF_INVIS); - players[i].score = players[i].xtralife = 0; + players[i].xtralife = 0; } // Reset unlockable triggers @@ -3794,6 +3969,9 @@ char *G_BuildMapTitle(INT32 mapnum) { char *title = NULL; + if (!mapheaderinfo[mapnum-1]) + P_AllocMapHeader(mapnum-1); + if (strcmp(mapheaderinfo[mapnum-1]->lvlttl, "")) { size_t len = 1; @@ -3823,7 +4001,7 @@ char *G_BuildMapTitle(INT32 mapnum) // DEMO RECORDING // -#define DEMOVERSION 0x0009 +#define DEMOVERSION 0x000a #define DEMOHEADER "\xF0" "SRB2Replay" "\x0F" #define DF_GHOST 0x01 // This demo contains ghost data too! @@ -3848,9 +4026,10 @@ static ticcmd_t oldcmd; #define GZT_MOMZ 0x04 #define GZT_ANGLE 0x08 // Not used for Metal Sonic -#define GZT_SPRITE 0x10 // Animation frame -#define GZT_EXTRA 0x20 -#define GZT_NIGHTS 0x40 // NiGHTS Mode stuff! +#define GZT_FRAME 0x10 // Animation frame +#define GZT_SPR2 0x20 // Player animations +#define GZT_EXTRA 0x40 +#define GZT_FOLLOW 0x80 // Followmobj // GZT_EXTRA flags #define EZT_THOK 0x01 // Spawned a thok object @@ -3862,6 +4041,7 @@ static ticcmd_t oldcmd; #define EZT_SCALE 0x10 // Changed size #define EZT_HIT 0x20 // Damaged a mobj #define EZT_SPRITE 0x40 // Changed sprite set completely out of PLAY (NiGHTS, SOCs, whatever) +// spare EZT slot 0x80 static mobj_t oldmetal, oldghost; @@ -4054,21 +4234,12 @@ void G_WriteGhostTic(mobj_t *ghost) char ziptic = 0; UINT8 *ziptic_p; UINT32 i; - UINT8 sprite; - UINT8 frame; if (!demo_p) return; if (!(demoflags & DF_GHOST)) return; // No ghost data to write. - if (ghost->player && ghost->player->pflags & PF_NIGHTSMODE && ghost->tracer) - { - // We're talking about the NiGHTS thing, not the normal platforming thing! - ziptic |= GZT_NIGHTS; - ghost = ghost->tracer; - } - ziptic_p = demo_p++; // the ziptic, written at the end of this function #define MAXMOM (0xFFFF<<8) @@ -4122,27 +4293,33 @@ void G_WriteGhostTic(mobj_t *ghost) // Only store the 8 most relevant bits of angle // because exact values aren't too easy to discern to begin with when only 8 angles have different sprites // and it does not affect this mode of movement at all anyway. - if (ghost->angle>>24 != oldghost.angle) + if (ghost->player && ghost->player->drawangle>>24 != oldghost.angle) { - oldghost.angle = ghost->angle>>24; + oldghost.angle = ghost->player->drawangle>>24; ziptic |= GZT_ANGLE; WRITEUINT8(demo_p,oldghost.angle); } // Store the sprite frame. - frame = ghost->frame & 0xFF; - if (frame != oldghost.frame) + if ((ghost->frame & FF_FRAMEMASK) != oldghost.frame) { - oldghost.frame = frame; - ziptic |= GZT_SPRITE; + oldghost.frame = (ghost->frame & FF_FRAMEMASK); + ziptic |= GZT_FRAME; WRITEUINT8(demo_p,oldghost.frame); } - // Check for sprite set changes - sprite = ghost->sprite; - if (sprite != oldghost.sprite) + if (ghost->sprite == SPR_PLAY + && ghost->sprite2 != oldghost.sprite2) { - oldghost.sprite = sprite; + oldghost.sprite2 = ghost->sprite2; + ziptic |= GZT_SPR2; + WRITEUINT8(demo_p,oldghost.sprite2); + } + + // Check for sprite set changes + if (ghost->sprite != oldghost.sprite) + { + oldghost.sprite = ghost->sprite; ghostext.flags |= EZT_SPRITE; } @@ -4172,7 +4349,7 @@ void G_WriteGhostTic(mobj_t *ghost) for (i = 0; i < ghostext.hits; i++) { mobj_t *mo = ghostext.hitlist[i]; - WRITEUINT32(demo_p,UINT32_MAX); // reserved for some method of determining exactly which mobj this is. (mobjnum doesn't work here.) + //WRITEUINT32(demo_p,UINT32_MAX); // reserved for some method of determining exactly which mobj this is. (mobjnum doesn't work here.) WRITEUINT32(demo_p,mo->type); WRITEUINT16(demo_p,(UINT16)mo->health); WRITEFIXED(demo_p,mo->x); @@ -4185,15 +4362,32 @@ void G_WriteGhostTic(mobj_t *ghost) ghostext.hitlist = NULL; } if (ghostext.flags & EZT_SPRITE) - WRITEUINT8(demo_p,sprite); + WRITEUINT8(demo_p,oldghost.sprite); ghostext.flags = 0; } + if (ghost->player && ghost->player->followmobj) + { + INT16 temp; + + ziptic |= GZT_FOLLOW; + + temp = (INT16)((ghost->player->followmobj->x-ghost->x)>>8); + WRITEINT16(demo_p,temp); + temp = (INT16)((ghost->player->followmobj->y-ghost->y)>>8); + WRITEINT16(demo_p,temp); + temp = (INT16)((ghost->player->followmobj->z-ghost->z)>>8); + WRITEINT16(demo_p,temp); + WRITEUINT8(demo_p,ghost->player->followmobj->sprite); + WRITEUINT8(demo_p,ghost->player->followmobj->sprite2); + WRITEUINT8(demo_p,(ghost->player->followmobj->frame & FF_FRAMEMASK)); + } + *ziptic_p = ziptic; // attention here for the ticcmd size! // latest demos with mouse aiming byte in ticcmd - if (demo_p >= demoend - (13 + 9)) + if (demo_p >= demoend - (13 + 9 + 9)) { G_CheckDemoStatus(); // no more space return; @@ -4207,7 +4401,6 @@ void G_ConsGhostTic(void) UINT8 ziptic; UINT16 px,py,pz,gx,gy,gz; mobj_t *testmo; - boolean nightsfail = false; if (!demo_p || !demo_start) return; @@ -4239,23 +4432,19 @@ void G_ConsGhostTic(void) } if (ziptic & GZT_ANGLE) demo_p++; - if (ziptic & GZT_SPRITE) + if (ziptic & GZT_FRAME) + demo_p++; + if (ziptic & GZT_SPR2) demo_p++; - if(ziptic & GZT_NIGHTS) { - if (!testmo->player || !(testmo->player->pflags & PF_NIGHTSMODE) || !testmo->tracer) - nightsfail = true; - else - testmo = testmo->tracer; - } if (ziptic & GZT_EXTRA) { // But wait, there's more! - ziptic = READUINT8(demo_p); - if (ziptic & EZT_COLOR) + UINT8 xziptic = READUINT8(demo_p); + if (xziptic & EZT_COLOR) demo_p++; - if (ziptic & EZT_SCALE) + if (xziptic & EZT_SCALE) demo_p += sizeof(fixed_t); - if (ziptic & EZT_HIT) + if (xziptic & EZT_HIT) { // Resync mob damage. UINT16 i, count = READUINT16(demo_p); thinker_t *th; @@ -4269,7 +4458,7 @@ void G_ConsGhostTic(void) for (i = 0; i < count; i++) { - demo_p += 4; // reserved. + //demo_p += 4; // reserved. type = READUINT32(demo_p); health = READUINT16(demo_p); x = READFIXED(demo_p); @@ -4292,14 +4481,24 @@ void G_ConsGhostTic(void) if (demosynced) CONS_Alert(CONS_WARNING, M_GetText("Demo playback has desynced!\n")); demosynced = false; - P_DamageMobj(mobj, players[0].mo, players[0].mo, 1); + P_DamageMobj(mobj, players[0].mo, players[0].mo, 1, 0); } } } - if (ziptic & EZT_SPRITE) + if (xziptic & EZT_SPRITE) demo_p++; } + if (ziptic & GZT_FOLLOW) + { // Even more... + demo_p += sizeof(INT16); + demo_p += sizeof(INT16); + demo_p += sizeof(INT16); + demo_p++; + demo_p++; + demo_p++; + } + // Re-synchronise px = testmo->x>>FRACBITS; py = testmo->y>>FRACBITS; @@ -4308,7 +4507,7 @@ void G_ConsGhostTic(void) gy = oldghost.y>>FRACBITS; gz = oldghost.z>>FRACBITS; - if (nightsfail || px != gx || py != gy || pz != gz) + if (px != gx || py != gy || pz != gz) { if (demosynced) CONS_Alert(CONS_WARNING, M_GetText("Demo playback has desynced!\n")); @@ -4336,6 +4535,7 @@ void G_GhostTicker(void) { // Skip normal demo data. UINT8 ziptic = READUINT8(g->p); + UINT8 xziptic = 0; if (ziptic & ZT_FWD) g->p++; if (ziptic & ZT_SIDE) @@ -4369,9 +4569,11 @@ void G_GhostTicker(void) g->oldmo.z += g->oldmo.momz; } if (ziptic & GZT_ANGLE) - g->oldmo.angle = READUINT8(g->p)<<24; - if (ziptic & GZT_SPRITE) + g->mo->angle = READUINT8(g->p)<<24; + if (ziptic & GZT_FRAME) g->oldmo.frame = READUINT8(g->p); + if (ziptic & GZT_SPR2) + g->oldmo.sprite2 = READUINT8(g->p); // Update ghost P_UnsetThingPosition(g->mo); @@ -4379,13 +4581,13 @@ void G_GhostTicker(void) g->mo->y = g->oldmo.y; g->mo->z = g->oldmo.z; P_SetThingPosition(g->mo); - g->mo->angle = g->oldmo.angle; g->mo->frame = g->oldmo.frame | tr_trans30<mo->sprite2 = g->oldmo.sprite2; if (ziptic & GZT_EXTRA) { // But wait, there's more! - ziptic = READUINT8(g->p); - if (ziptic & EZT_COLOR) + xziptic = READUINT8(g->p); + if (xziptic & EZT_COLOR) { g->color = READUINT8(g->p); switch(g->color) @@ -4403,22 +4605,22 @@ void G_GhostTicker(void) break; } } - if (ziptic & EZT_FLIP) + if (xziptic & EZT_FLIP) g->mo->eflags ^= MFE_VERTICALFLIP; - if (ziptic & EZT_SCALE) + if (xziptic & EZT_SCALE) { g->mo->destscale = READFIXED(g->p); if (g->mo->destscale != g->mo->scale) P_SetScale(g->mo, g->mo->destscale); } - if (ziptic & EZT_THOKMASK) + if (xziptic & EZT_THOKMASK) { // Let's only spawn ONE of these per frame, thanks. mobj_t *mobj; INT32 type = -1; if (g->mo->skin) { skin_t *skin = (skin_t *)g->mo->skin; - switch (ziptic & EZT_THOKMASK) + switch (xziptic & EZT_THOKMASK) { case EZT_THOK: type = skin->thokitem < 0 ? (UINT32)mobjinfo[MT_PLAYER].painchance : (UINT32)skin->thokitem; @@ -4459,7 +4661,7 @@ void G_GhostTicker(void) mobj->fuse = 8; P_SetTarget(&mobj->target, g->mo); } - if (ziptic & EZT_HIT) + if (xziptic & EZT_HIT) { // Spawn hit poofs for killing things! UINT16 i, count = READUINT16(g->p), health; UINT32 type; @@ -4468,7 +4670,7 @@ void G_GhostTicker(void) mobj_t *poof; for (i = 0; i < count; i++) { - g->p += 4; // reserved + //g->p += 4; // reserved type = READUINT32(g->p); health = READUINT16(g->p); x = READFIXED(g->p); @@ -4486,24 +4688,78 @@ void G_GhostTicker(void) P_SetMobjStateNF(poof, S_XPLD1); } } - if (ziptic & EZT_SPRITE) + if (xziptic & EZT_SPRITE) g->mo->sprite = READUINT8(g->p); } // Tick ghost colors (Super and Mario Invincibility flashing) switch(g->color) { - case GHC_SUPER: // Super Sonic (P_DoSuperStuff) - g->mo->color = SKINCOLOR_SUPER1; + case GHC_SUPER: // Super (P_DoSuperStuff) + if (g->mo->skin) + { + skin_t *skin = (skin_t *)g->mo->skin; + g->mo->color = skin->supercolor; + } + else + g->mo->color = SKINCOLOR_SUPERGOLD1; g->mo->color += abs( ( (signed)( (unsigned)leveltime >> 1 ) % 9) - 4); break; case GHC_INVINCIBLE: // Mario invincibility (P_CheckInvincibilityTimer) - g->mo->color = (UINT8)(leveltime % MAXSKINCOLORS); + g->mo->color = (UINT8)(SKINCOLOR_RUBY + (leveltime % (MAXSKINCOLORS - SKINCOLOR_RUBY))); // Passes through all saturated colours break; default: break; } +#define follow g->mo->tracer + if (ziptic & GZT_FOLLOW) + { // Even more... + if (!follow) + { + mobj_t *newmo = P_SpawnMobj(g->mo->x, g->mo->y, g->mo->z, MT_GHOST); + P_SetTarget(&g->mo->tracer, newmo); + P_SetTarget(&newmo->tracer, g->mo); + newmo->skin = g->mo->skin; + newmo->tics = -1; + newmo->flags2 |= MF2_LINKDRAW; + + follow->eflags = (follow->eflags & ~MFE_VERTICALFLIP)|(g->mo->eflags & MFE_VERTICALFLIP); + follow->destscale = g->mo->destscale; + if (follow->destscale != follow->scale) + P_SetScale(follow, follow->destscale); + } + else + { + if (xziptic & EZT_FLIP) + g->mo->eflags ^= MFE_VERTICALFLIP; + if (xziptic & EZT_SCALE) + { + follow->destscale = g->mo->destscale; + if (follow->destscale != follow->scale) + P_SetScale(follow, follow->destscale); + } + } + + P_UnsetThingPosition(follow); + follow->x = g->mo->x + (READINT16(g->p)<<8); + follow->y = g->mo->y + (READINT16(g->p)<<8); + follow->z = g->mo->z + (READINT16(g->p)<<8); + P_SetThingPosition(follow); + follow->sprite = READUINT8(g->p); + follow->sprite2 = READUINT8(g->p); + follow->frame = (READUINT8(g->p)) | tr_trans30<angle = g->mo->angle; + follow->color = g->mo->color; + } + else if (follow) + { + P_RemoveMobj(follow); + P_SetTarget(&follow, NULL); + } +#undef follow + // Demo ends after ghost data. if (*g->p == DEMOMARKER) { @@ -4551,9 +4807,11 @@ void G_ReadMetalTic(mobj_t *metal) oldmetal.z += oldmetal.momz; } if (ziptic & GZT_ANGLE) - oldmetal.angle = READUINT8(metal_p)<<24; - if (ziptic & GZT_SPRITE) + metal->angle = READUINT8(metal_p)<<24; + if (ziptic & GZT_FRAME) metal_p++; // Currently unused. (Metal Sonic figures out what he's doing his own damn self.) + if (ziptic & GZT_SPR2) + metal_p++; // Set movement, position, and angle // oldmetal contains where you're supposed to be. @@ -4565,7 +4823,6 @@ void G_ReadMetalTic(mobj_t *metal) metal->y = oldmetal.y; metal->z = oldmetal.z; P_SetThingPosition(metal); - metal->angle = oldmetal.angle; if (ziptic & GZT_EXTRA) { // But wait, there's more! @@ -4680,11 +4937,11 @@ void G_WriteMetalTic(mobj_t *metal) // Only store the 8 most relevant bits of angle // because exact values aren't too easy to discern to begin with when only 8 angles have different sprites // and it does not affect movement at all anyway. - if (metal->angle>>24 != oldmetal.angle) + if (metal->player && metal->player->drawangle>>24 != oldmetal.angle) { - oldmetal.angle = metal->angle>>24; - WRITEUINT8(demo_p,oldmetal.angle); + oldmetal.angle = metal->player->drawangle>>24; ziptic |= GZT_ANGLE; + WRITEUINT8(demo_p,oldmetal.angle); } // Metal Sonic does not need our state changes. @@ -4843,12 +5100,37 @@ void G_BeginRecording(void) WRITEUINT8(demo_p,player->thrustfactor); WRITEUINT8(demo_p,player->accelstart); WRITEUINT8(demo_p,player->acceleration); + WRITEUINT8(demo_p,player->height>>FRACBITS); + WRITEUINT8(demo_p,player->spinheight>>FRACBITS); + WRITEUINT8(demo_p,player->camerascale>>FRACBITS); + WRITEUINT8(demo_p,player->shieldscale>>FRACBITS); // Trying to convert it back to % causes demo desync due to precision loss. // Don't do it. WRITEFIXED(demo_p, player->jumpfactor); - // Save netvar data (SONICCD, etc) + // And mobjtype_t is best with UINT32 too... + WRITEUINT32(demo_p, player->followitem); + + // Save pflag data + { + UINT8 buf = 0; + if (player->pflags & PF_FLIPCAM) + buf |= 0x01; + if (player->pflags & PF_ANALOGMODE) + buf |= 0x02; + if (player->pflags & PF_DIRECTIONCHAR) + buf |= 0x04; + if (player->pflags & PF_AUTOBRAKE) + buf |= 0x08; + if (cv_usejoystick.value) + buf |= 0x10; + CV_SetValue(&cv_showinputjoy, !!(cv_usejoystick.value)); + + WRITEUINT8(demo_p,buf); + } + + // Save netvar data CV_SaveNetVars(&demo_p); memset(&oldcmd,0,sizeof(oldcmd)); @@ -4862,7 +5144,7 @@ void G_BeginRecording(void) oldghost.x = player->mo->x; oldghost.y = player->mo->y; oldghost.z = player->mo->z; - oldghost.angle = player->mo->angle; + oldghost.angle = player->mo->angle>>24; // preticker started us gravity flipped if (player->mo->eflags & MFE_VERTICALFLIP) @@ -4895,7 +5177,7 @@ void G_BeginMetal(void) oldmetal.x = mo->x; oldmetal.y = mo->y; oldmetal.z = mo->z; - oldmetal.angle = mo->angle; + oldmetal.angle = mo->angle>>24; } void G_SetDemoTime(UINT32 ptime, UINT32 pscore, UINT16 prings) @@ -4995,8 +5277,6 @@ UINT8 G_CmpDemoTime(char *oldname, char *newname) switch(oldversion) // demoversion { case DEMOVERSION: // latest always supported - // compatibility available? - case 0x0008: break; // too old, cannot support. default: @@ -5072,8 +5352,9 @@ void G_DoPlayDemo(char *defdemoname) lumpnum_t l; char skin[17],color[17],*n,*pdemoname; UINT8 version,subversion,charability,charability2,thrustfactor,accelstart,acceleration; - UINT32 randseed; - fixed_t actionspd,mindash,maxdash,normalspeed,runspeed,jumpfactor; + pflags_t pflags; + UINT32 randseed, followitem; + fixed_t camerascale,shieldscale,actionspd,mindash,maxdash,normalspeed,runspeed,jumpfactor,height,spinheight; char msg[1024]; skin[16] = '\0'; @@ -5135,8 +5416,6 @@ void G_DoPlayDemo(char *defdemoname) switch(demoversion) { case DEMOVERSION: // latest always supported - // compatibility available? - case 0x0008: break; // too old, cannot support. default: @@ -5162,10 +5441,7 @@ void G_DoPlayDemo(char *defdemoname) return; } demo_p += 4; // "PLAY" - if (demoversion <= 0x0008) - gamemap = READUINT8(demo_p); - else - gamemap = READINT16(demo_p); + gamemap = READINT16(demo_p); demo_p += 16; // mapmd5 demoflags = READUINT8(demo_p); @@ -5219,7 +5495,27 @@ void G_DoPlayDemo(char *defdemoname) thrustfactor = READUINT8(demo_p); accelstart = READUINT8(demo_p); acceleration = READUINT8(demo_p); + height = (fixed_t)READUINT8(demo_p)<mo->z = z; } - gh->mo->state = states+S_PLAY_STND; - gh->mo->sprite = gh->mo->state->sprite; - gh->mo->frame = (gh->mo->state->frame & FF_FRAMEMASK) | tr_trans20<mo->tics = -1; gh->oldmo.x = gh->mo->x; gh->oldmo.y = gh->mo->y; @@ -5517,6 +5817,12 @@ void G_AddGhost(char *defdemoname) } gh->oldmo.color = gh->mo->color; + gh->mo->state = states+S_PLAY_STND; + gh->mo->sprite = gh->mo->state->sprite; + gh->mo->sprite2 = (gh->mo->state->frame & FF_FRAMEMASK); + gh->mo->frame = tr_trans20<mo->tics = -1; + CONS_Printf(M_GetText("Added ghost %s from %s\n"), name, pdemoname); Z_Free(pdemoname); } @@ -5563,8 +5869,10 @@ void G_DoPlayMetal(void) continue; mo = (mobj_t *)th; - if (mo->type == MT_METALSONIC_RACE) - break; + if (mo->type != MT_METALSONIC_RACE) + continue; + + break; } if (!mo) { @@ -5581,8 +5889,6 @@ void G_DoPlayMetal(void) switch(metalversion) { case DEMOVERSION: // latest always supported - // compatibility available? - case 0x0008: break; // too old, cannot support. default: @@ -5603,7 +5909,6 @@ void G_DoPlayMetal(void) oldmetal.x = mo->x; oldmetal.y = mo->y; oldmetal.z = mo->z; - oldmetal.angle = mo->angle; metalplayback = mo; } diff --git a/src/g_game.h b/src/g_game.h index 9e360f882..56682084e 100644 --- a/src/g_game.h +++ b/src/g_game.h @@ -42,6 +42,7 @@ extern tic_t demostarttime; // Quit after playing a demo from cmdline. extern boolean singledemo; extern boolean demo_start; +extern boolean demosynced; extern mobj_t *metalplayback; @@ -53,14 +54,19 @@ extern INT16 prevmap, nextmap; extern INT32 gameovertics; extern tic_t timeinmap; // Ticker for time spent in level (used for levelcard display) extern INT16 rw_maximums[NUM_WEAPONS]; +extern INT32 pausedelay; +extern boolean pausebreakkey; // used in game menu +extern consvar_t cv_tutorialprompt; extern consvar_t cv_chatwidth, cv_chatnotifications, cv_chatheight, cv_chattime, cv_consolechat, cv_chatbacktint, cv_chatspamprotection, cv_compactscoreboard; extern consvar_t cv_crosshair, cv_crosshair2; extern consvar_t cv_invertmouse, cv_alwaysfreelook, cv_chasefreelook, cv_mousemove; extern consvar_t cv_invertmouse2, cv_alwaysfreelook2, cv_chasefreelook2, cv_mousemove2; extern consvar_t cv_useranalog, cv_useranalog2; extern consvar_t cv_analog, cv_analog2; +extern consvar_t cv_directionchar, cv_directionchar2; +extern consvar_t cv_autobrake, cv_autobrake2; extern consvar_t cv_sideaxis,cv_turnaxis,cv_moveaxis,cv_lookaxis,cv_jumpaxis,cv_spinaxis,cv_fireaxis,cv_firenaxis; extern consvar_t cv_sideaxis2,cv_turnaxis2,cv_moveaxis2,cv_lookaxis2,cv_jumpaxis2,cv_spinaxis2,cv_fireaxis2,cv_firenaxis2; extern consvar_t cv_ghost_bestscore, cv_ghost_besttime, cv_ghost_bestrings, cv_ghost_last, cv_ghost_guest; @@ -94,7 +100,7 @@ void G_ChangePlayerReferences(mobj_t *oldmo, mobj_t *newmo); void G_DoReborn(INT32 playernum); void G_PlayerReborn(INT32 player); void G_InitNew(UINT8 pultmode, const char *mapname, boolean resetplayer, - boolean skipprecutscene); + boolean skipprecutscene, boolean FLS); char *G_BuildMapTitle(INT32 mapnum); // XMOD spawning @@ -118,6 +124,8 @@ void G_SaveGameData(void); void G_SaveGame(UINT32 slot); +void G_SaveGameOver(UINT32 slot, boolean modifylives); + // Only called by startup code. void G_RecordDemo(const char *name); void G_RecordMetal(void); diff --git a/src/g_input.c b/src/g_input.c index 796235559..45c517e1a 100644 --- a/src/g_input.c +++ b/src/g_input.c @@ -45,6 +45,48 @@ UINT8 gamekeydown[NUMINPUTS]; // two key codes (or virtual key) per game control INT32 gamecontrol[num_gamecontrols][2]; INT32 gamecontrolbis[num_gamecontrols][2]; // secondary splitscreen player +INT32 gamecontroldefault[num_gamecontrolschemes][num_gamecontrols][2]; // default control storage, use 0 (gcs_custom) for memory retention +INT32 gamecontrolbisdefault[num_gamecontrolschemes][num_gamecontrols][2]; + +// lists of GC codes for selective operation +const INT32 gcl_tutorial_check[num_gcl_tutorial_check] = { + gc_forward, gc_backward, gc_strafeleft, gc_straferight, + gc_turnleft, gc_turnright +}; + +const INT32 gcl_tutorial_used[num_gcl_tutorial_used] = { + gc_forward, gc_backward, gc_strafeleft, gc_straferight, + gc_turnleft, gc_turnright, + gc_jump, gc_use +}; + +const INT32 gcl_tutorial_full[num_gcl_tutorial_full] = { + gc_forward, gc_backward, gc_strafeleft, gc_straferight, + gc_lookup, gc_lookdown, gc_turnleft, gc_turnright, gc_centerview, + gc_jump, gc_use, + gc_fire, gc_firenormal +}; + +const INT32 gcl_movement[num_gcl_movement] = { + gc_forward, gc_backward, gc_strafeleft, gc_straferight +}; + +const INT32 gcl_camera[num_gcl_camera] = { + gc_turnleft, gc_turnright +}; + +const INT32 gcl_movement_camera[num_gcl_movement_camera] = { + gc_forward, gc_backward, gc_strafeleft, gc_straferight, + gc_turnleft, gc_turnright +}; + +const INT32 gcl_jump[num_gcl_jump] = { gc_jump }; + +const INT32 gcl_use[num_gcl_use] = { gc_use }; + +const INT32 gcl_jump_use[num_gcl_jump_use] = { + gc_jump, gc_use +}; typedef struct { @@ -208,11 +250,9 @@ static keyname_t keynames[] = {KEY_SCROLLLOCK, "SCROLLLOCK"}, // bill gates keys -#ifndef _arch_dreamcast {KEY_LEFTWIN, "LEFTWIN"}, {KEY_RIGHTWIN, "RIGHTWIN"}, {KEY_MENU, "MENU"}, -#endif {KEY_LSHIFT, "LSHIFT"}, {KEY_RSHIFT, "RSHIFT"}, @@ -274,140 +314,24 @@ static keyname_t keynames[] = {KEY_MOUSE1+0,"MOUSE1"}, {KEY_MOUSE1+1,"MOUSE2"}, {KEY_MOUSE1+2,"MOUSE3"}, -#if !defined (_arch_dreamcast) && !defined (_XBOX) && !defined (_PSP) && !defined (_WII) {KEY_MOUSE1+3,"MOUSE4"}, {KEY_MOUSE1+4,"MOUSE5"}, {KEY_MOUSE1+5,"MOUSE6"}, {KEY_MOUSE1+6,"MOUSE7"}, {KEY_MOUSE1+7,"MOUSE8"}, -#endif {KEY_2MOUSE1+0,"SEC_MOUSE2"}, // BP: sorry my mouse handler swap button 1 and 2 {KEY_2MOUSE1+1,"SEC_MOUSE1"}, {KEY_2MOUSE1+2,"SEC_MOUSE3"}, -#if !defined (_arch_dreamcast) && !defined (_XBOX) && !defined (_PSP) && !defined (_WII) {KEY_2MOUSE1+3,"SEC_MOUSE4"}, {KEY_2MOUSE1+4,"SEC_MOUSE5"}, {KEY_2MOUSE1+5,"SEC_MOUSE6"}, {KEY_2MOUSE1+6,"SEC_MOUSE7"}, {KEY_2MOUSE1+7,"SEC_MOUSE8"}, -#endif {KEY_MOUSEWHEELUP, "Wheel 1 UP"}, {KEY_MOUSEWHEELDOWN, "Wheel 1 Down"}, {KEY_2MOUSEWHEELUP, "Wheel 2 UP"}, {KEY_2MOUSEWHEELDOWN, "Wheel 2 Down"}, -#ifdef DC - {KEY_JOY1+0, "JOYC"}, - {KEY_JOY1+1, "JOYB"}, - {KEY_JOY1+2, "JOYA"}, - {KEY_JOY1+3, "JOYS"}, - {KEY_JOY1+4, "JOYZ"}, - {KEY_JOY1+5, "JOYY"}, - {KEY_JOY1+6, "JOYX"}, - {KEY_JOY1+7, "JOYD"}, -#elif defined (_XBOX) - {KEY_JOY1+0, "JOYA"}, - {KEY_JOY1+1, "JOYB"}, - {KEY_JOY1+2, "JOYX"}, - {KEY_JOY1+3, "JOYY"}, - {KEY_JOY1+4, "JOYG"}, - {KEY_JOY1+5, "JOYW"}, - {KEY_JOY1+6, "JOYL"}, - {KEY_JOY1+7, "JOYR"}, - {KEY_JOY1+8, "JOYS"}, - {KEY_JOY1+9, "JOYN"}, - {KEY_JOY1+10,"JOYW"}, - {KEY_JOY1+11,"JOYE"}, -#define NOMOREJOYBTN_1S -#elif defined (_PSP) - {KEY_JOY1+0, "TRIANGLE"}, - {KEY_JOY1+1, "CIRCLE" }, - {KEY_JOY1+2, "CROSS" }, - {KEY_JOY1+3, "SQUARE" }, - {KEY_JOY1+4, "LTRIGGER"}, - {KEY_JOY1+5, "RTRIGGER"}, - {KEY_JOY1+6, "SELECT" }, - {KEY_JOY1+7, "START" }, - {KEY_JOY1+8, "HOME" }, - {KEY_JOY1+9, "HOLD" }, -#define NOMOREJOYBTN_1S -#elif defined (GP2X) - {KEY_JOY1+0, "JOYA"}, - {KEY_JOY1+1, "JOYY"}, - {KEY_JOY1+2, "JOYB"}, - {KEY_JOY1+3, "JOYX"}, - {KEY_JOY1+4, "JOYL"}, - {KEY_JOY1+5, "JOYR"}, - {KEY_JOY1+6, "JOYVOLUP"}, - {KEY_JOY1+7, "JOYVOLDOWN"}, - {KEY_JOY1+8, "JOYSELECT"}, -#elif defined (_NDS) - {KEY_JOY1+0, "JOYA"}, - {KEY_JOY1+1, "JOYB"}, - {KEY_JOY1+2, "JOYX"}, - {KEY_JOY1+3, "JOYY"}, - {KEY_JOY1+4, "JOYL"}, - {KEY_JOY1+5, "JOYR"}, - {KEY_JOY1+6, "JOYSTART"}, - {KEY_JOY1+7, "JOYSELECT"}, -#define NOMOREJOYBTN_1S -#elif defined (WMINPUT) - {KEY_JOY1+0, "JOYB"}, - {KEY_JOY1+1, "JOYA"}, - {KEY_JOY1+2, "JOYUP"}, - {KEY_JOY1+3, "JOYDOWN"}, - {KEY_JOY1+4, "JOYLEFT"}, - {KEY_JOY1+5, "JOYRIGHT"}, - {KEY_JOY1+6, "JOYAA"}, - {KEY_JOY1+7, "JOYBB"}, - {KEY_JOY1+8, "JOYCC"}, - {KEY_JOY1+9, "JOYXX"}, - {KEY_JOY1+10, "JOYYY"}, - {KEY_JOY1+11, "JOYZZ"}, - {KEY_JOY1+12, "JOYL"}, - {KEY_JOY1+13, "JOYR"}, - {KEY_JOY1+14, "JOYZL"}, - {KEY_JOY1+15, "JOYZR"}, - {KEY_JOY1+16, "JOYSELECT"}, - {KEY_JOY1+17, "JOYSTART"}, - {KEY_JOY1+18, "JOYHOME"}, - {KEY_JOY1+19, "JOYMINUS"}, - {KEY_JOY1+20, "JOYPLUS"}, - {KEY_JOY1+21, "JOY_1"}, - {KEY_JOY1+22, "JOY_2"}, - {KEY_JOY1+23, "JOY24"}, - {KEY_JOY1+24, "JOY25"}, - {KEY_JOY1+25, "JOY26"}, - {KEY_JOY1+26, "JOY27"}, - {KEY_JOY1+27, "JOY28"}, - {KEY_JOY1+28, "JOY29"}, - {KEY_JOY1+29, "JOY30"}, - {KEY_JOY1+30, "JOY31"}, - {KEY_JOY1+31, "JOY32"}, -#define NOMOREJOYBTN_1S -#elif defined (_WII) - {KEY_JOY1+0, "JOYA"}, - {KEY_JOY1+1, "JOYB"}, - {KEY_JOY1+2, "JOY1"}, - {KEY_JOY1+3, "JOY2"}, - {KEY_JOY1+4, "JOYMINUS"}, - {KEY_JOY1+5, "JOYPLUS"}, - {KEY_JOY1+6, "JOYHOME"}, - {KEY_JOY1+7, "JOYZ"}, - {KEY_JOY1+8, "JOYC"}, - {KEY_JOY1+9, "JOYA_CC"}, - {KEY_JOY1+10, "JOYB_CC"}, - {KEY_JOY1+11, "JOYX"}, - {KEY_JOY1+12, "JOYY"}, - {KEY_JOY1+13, "JOYL"}, - {KEY_JOY1+14, "JOYR"}, - {KEY_JOY1+15, "JOYZL"}, - {KEY_JOY1+16, "JOYZR"}, - {KEY_JOY1+17, "JOYMINUS_CC"}, - {KEY_JOY1+18, "JOYHPLUS_CC"}, - {KEY_JOY1+19, "JOYMHOME_CC"}, -#define NOMOREJOYBTN_1S -#else {KEY_JOY1+0, "JOY1"}, {KEY_JOY1+1, "JOY2"}, {KEY_JOY1+2, "JOY3"}, @@ -417,8 +341,7 @@ static keyname_t keynames[] = {KEY_JOY1+6, "JOY7"}, {KEY_JOY1+7, "JOY8"}, {KEY_JOY1+8, "JOY9"}, -#endif -#if !defined (_arch_dreamcast) && !defined (NOMOREJOYBTN_1S) +#if !defined (NOMOREJOYBTN_1S) // we use up to 32 buttons in DirectInput {KEY_JOY1+9, "JOY10"}, {KEY_JOY1+10, "JOY11"}, @@ -449,12 +372,10 @@ static keyname_t keynames[] = {KEY_HAT1+1, "HATDOWN"}, {KEY_HAT1+2, "HATLEFT"}, {KEY_HAT1+3, "HATRIGHT"}, -#if !defined (_XBOX) && !defined (_PSP) && !defined (_WII) {KEY_HAT1+4, "HATUP2"}, {KEY_HAT1+5, "HATDOWN2"}, {KEY_HAT1+6, "HATLEFT2"}, {KEY_HAT1+7, "HATRIGHT2"}, -#ifndef _arch_dreamcast {KEY_HAT1+8, "HATUP3"}, {KEY_HAT1+9, "HATDOWN3"}, {KEY_HAT1+10, "HATLEFT3"}, @@ -463,142 +384,24 @@ static keyname_t keynames[] = {KEY_HAT1+13, "HATDOWN4"}, {KEY_HAT1+14, "HATLEFT4"}, {KEY_HAT1+15, "HATRIGHT4"}, -#endif -#endif {KEY_DBLMOUSE1+0, "DBLMOUSE1"}, {KEY_DBLMOUSE1+1, "DBLMOUSE2"}, {KEY_DBLMOUSE1+2, "DBLMOUSE3"}, -#if !defined (_arch_dreamcast) && !defined (_XBOX) && !defined (_PSP) && !defined (_WII) {KEY_DBLMOUSE1+3, "DBLMOUSE4"}, {KEY_DBLMOUSE1+4, "DBLMOUSE5"}, {KEY_DBLMOUSE1+5, "DBLMOUSE6"}, {KEY_DBLMOUSE1+6, "DBLMOUSE7"}, {KEY_DBLMOUSE1+7, "DBLMOUSE8"}, -#endif {KEY_DBL2MOUSE1+0, "DBLSEC_MOUSE2"}, // BP: sorry my mouse handler swap button 1 and 2 {KEY_DBL2MOUSE1+1, "DBLSEC_MOUSE1"}, {KEY_DBL2MOUSE1+2, "DBLSEC_MOUSE3"}, -#if !defined (_arch_dreamcast) && !defined (_XBOX) && !defined (_PSP) && !defined (_WII) {KEY_DBL2MOUSE1+3, "DBLSEC_MOUSE4"}, {KEY_DBL2MOUSE1+4, "DBLSEC_MOUSE5"}, {KEY_DBL2MOUSE1+5, "DBLSEC_MOUSE6"}, {KEY_DBL2MOUSE1+6, "DBLSEC_MOUSE7"}, {KEY_DBL2MOUSE1+7, "DBLSEC_MOUSE8"}, -#endif -#ifdef DC - {KEY_DBLJOY1+0, "DBLJOYC"}, - {KEY_DBLJOY1+1, "DBLJOYB"}, - {KEY_DBLJOY1+2, "DBLJOYA"}, - {KEY_DBLJOY1+3, "DBLJOYS"}, - {KEY_DBLJOY1+4, "DBLJOYZ"}, - {KEY_DBLJOY1+5, "DBLJOYY"}, - {KEY_DBLJOY1+6, "DBLJOYX"}, - {KEY_DBLJOY1+7, "DBLJOYD"}, -#elif defined (_XBOX) - {KEY_DBLJOY1+0, "DBLJOYA"}, - {KEY_DBLJOY1+1, "DBLJOYB"}, - {KEY_DBLJOY1+2, "DBLJOYX"}, - {KEY_DBLJOY1+3, "DBLJOYY"}, - {KEY_DBLJOY1+4, "DBLJOYG"}, - {KEY_DBLJOY1+5, "DBLJOYW"}, - {KEY_DBLJOY1+6, "DBLJOYL"}, - {KEY_DBLJOY1+7, "DBLJOYR"}, - {KEY_DBLJOY1+8, "DBLJOYS"}, - {KEY_DBLJOY1+9, "DBLJOYN"}, - {KEY_DBLJOY1+10,"DBLJOYW"}, - {KEY_DBLJOY1+11,"DBLJOYE"}, -#define NOMOREJOYBTN_1DBL -#elif defined (_PSP) - {KEY_DBLJOY1+0, "DBLTRIANGLE"}, - {KEY_DBLJOY1+1, "DBLCIRCLE" }, - {KEY_DBLJOY1+2, "DBLCROSS" }, - {KEY_DBLJOY1+3, "DBLSQUARE" }, - {KEY_DBLJOY1+4, "DBLLTRIGGER"}, - {KEY_DBLJOY1+5, "DBLRTRIGGER"}, - {KEY_DBLJOY1+6, "DBLSELECT" }, - {KEY_DBLJOY1+7, "DBLSTART" }, - {KEY_DBLJOY1+8, "DBLHOME" }, - {KEY_DBLJOY1+9, "DBLHOLD" }, -#elif defined (GP2X) - {KEY_DBLJOY1+0, "DBLJOYA"}, - {KEY_DBLJOY1+1, "DBLJOYY"}, - {KEY_DBLJOY1+2, "DBLJOYB"}, - {KEY_DBLJOY1+3, "DBLJOYX"}, - {KEY_DBLJOY1+4, "DBLJOYL"}, - {KEY_DBLJOY1+5, "DBLJOYR"}, - {KEY_DBLJOY1+6, "DBLJOYVOLUP"}, - {KEY_DBLJOY1+7, "DBLJOYVOLDOWN"}, - {KEY_DBLJOY1+8, "DBLJOYSELECT"}, -#define NOMOREJOYBTN_1DBL -#elif defined (_NDS) - {KEY_DBLJOY1+0, "DBLJOYA"}, - {KEY_DBLJOY1+1, "DBLJOYB"}, - {KEY_DBLJOY1+2, "DBLJOYX"}, - {KEY_DBLJOY1+3, "DBLJOYY"}, - {KEY_DBLJOY1+4, "DBLJOYL"}, - {KEY_DBLJOY1+5, "DBLJOYR"}, - {KEY_DBLJOY1+6, "DBLJOYSTART"}, - {KEY_DBLJOY1+7, "DBLJOYSELECT"}, -#define NOMOREJOYBTN_1DBL -#elif defined (WMINPUT) - {KEY_DBLJOY1+0, "DBLJOYB"}, - {KEY_DBLJOY1+1, "DBLJOYA"}, - {KEY_DBLJOY1+2, "DBLJOYUP"}, - {KEY_DBLJOY1+3, "DBLJOYDOWN"}, - {KEY_DBLJOY1+4, "DBLJOYLEFT"}, - {KEY_DBLJOY1+5, "DBLJOYRIGHT"}, - {KEY_DBLJOY1+6, "DBLJOYAA"}, - {KEY_DBLJOY1+7, "DBLJOYBB"}, - {KEY_DBLJOY1+8, "DBLJOYCC"}, - {KEY_DBLJOY1+9, "DBLJOYXX"}, - {KEY_DBLJOY1+10, "DBLJOYYY"}, - {KEY_DBLJOY1+11, "DBLJOYZZ"}, - {KEY_DBLJOY1+12, "DBLJOYL"}, - {KEY_DBLJOY1+13, "DBLJOYR"}, - {KEY_DBLJOY1+14, "DBLJOYZL"}, - {KEY_DBLJOY1+15, "DBLJOYZR"}, - {KEY_DBLJOY1+16, "DBLJOYSELECT"}, - {KEY_DBLJOY1+17, "DBLJOYSTART"}, - {KEY_DBLJOY1+18, "DBLJOYHOME"}, - {KEY_DBLJOY1+19, "DBLJOYMINUS"}, - {KEY_DBLJOY1+20, "DBLJOYPLUS"}, - {KEY_DBLJOY1+21, "DBLJOY_1"}, - {KEY_DBLJOY1+22, "DBLJOY_2"}, - {KEY_DBLJOY1+23, "DBLJOY24"}, - {KEY_DBLJOY1+24, "DBLJOY25"}, - {KEY_DBLJOY1+25, "DBLJOY26"}, - {KEY_DBLJOY1+26, "DBLJOY27"}, - {KEY_DBLJOY1+27, "DBLJOY28"}, - {KEY_DBLJOY1+28, "DBLJOY29"}, - {KEY_DBLJOY1+29, "DBLJOY30"}, - {KEY_DBLJOY1+30, "DBLJOY31"}, - {KEY_DBLJOY1+31, "DBLJOY32"}, -#define NOMOREJOYBTN_1DBL -#elif defined (_WII) - {KEY_DBLJOY1+0, "DBLJOYA"}, - {KEY_DBLJOY1+1, "DBLJOYB"}, - {KEY_DBLJOY1+2, "DBLJOY1"}, - {KEY_DBLJOY1+3, "DBLJOY2"}, - {KEY_DBLJOY1+4, "DBLJOYMINUS"}, - {KEY_DBLJOY1+5, "DBLJOYPLUS"}, - {KEY_DBLJOY1+6, "DBLJOYHOME"}, - {KEY_DBLJOY1+7, "DBLJOYZ"}, - {KEY_DBLJOY1+8, "DBLJOYC"}, - {KEY_DBLJOY1+9, "DBLJOYA_CC"}, - {KEY_DBLJOY1+10, "DBLJOYB_CC"}, - {KEY_DBLJOY1+11, "DBLJOYX"}, - {KEY_DBLJOY1+12, "DBLJOYY"}, - {KEY_DBLJOY1+13, "DBLJOYL"}, - {KEY_DBLJOY1+14, "DBLJOYR"}, - {KEY_DBLJOY1+15, "DBLJOYZL"}, - {KEY_DBLJOY1+16, "DBLJOYZR"}, - {KEY_DBLJOY1+17, "DBLJOYMINUS_CC"}, - {KEY_DBLJOY1+18, "DBLJOYHPLUS_CC"}, - {KEY_DBLJOY1+19, "DBLJOYMHOME_CC"}, -#define NOMOREJOYBTN_1DBL -#else {KEY_DBLJOY1+0, "DBLJOY1"}, {KEY_DBLJOY1+1, "DBLJOY2"}, {KEY_DBLJOY1+2, "DBLJOY3"}, @@ -607,8 +410,7 @@ static keyname_t keynames[] = {KEY_DBLJOY1+5, "DBLJOY6"}, {KEY_DBLJOY1+6, "DBLJOY7"}, {KEY_DBLJOY1+7, "DBLJOY8"}, -#endif -#if !defined (_arch_dreamcast) && !defined (NOMOREJOYBTN_1DBL) +#if !defined (NOMOREJOYBTN_1DBL) {KEY_DBLJOY1+8, "DBLJOY9"}, {KEY_DBLJOY1+9, "DBLJOY10"}, {KEY_DBLJOY1+10, "DBLJOY11"}, @@ -638,12 +440,10 @@ static keyname_t keynames[] = {KEY_DBLHAT1+1, "DBLHATDOWN"}, {KEY_DBLHAT1+2, "DBLHATLEFT"}, {KEY_DBLHAT1+3, "DBLHATRIGHT"}, -#if !defined (_XBOX) && !defined (_PSP) && !defined (_WII) {KEY_DBLHAT1+4, "DBLHATUP2"}, {KEY_DBLHAT1+5, "DBLHATDOWN2"}, {KEY_DBLHAT1+6, "DBLHATLEFT2"}, {KEY_DBLHAT1+7, "DBLHATRIGHT2"}, -#ifndef _arch_dreamcast {KEY_DBLHAT1+8, "DBLHATUP3"}, {KEY_DBLHAT1+9, "DBLHATDOWN3"}, {KEY_DBLHAT1+10, "DBLHATLEFT3"}, @@ -652,101 +452,7 @@ static keyname_t keynames[] = {KEY_DBLHAT1+13, "DBLHATDOWN4"}, {KEY_DBLHAT1+14, "DBLHATLEFT4"}, {KEY_DBLHAT1+15, "DBLHATRIGHT4"}, -#endif -#endif -#ifdef DC - {KEY_2JOY1+0, "SEC_JOYC"}, - {KEY_2JOY1+1, "SEC_JOYB"}, - {KEY_2JOY1+2, "SEC_JOYA"}, - {KEY_2JOY1+3, "SEC_JOYS"}, - {KEY_2JOY1+4, "SEC_JOYZ"}, - {KEY_2JOY1+5, "SEC_JOYY"}, - {KEY_2JOY1+6, "SEC_JOYX"}, - {KEY_2JOY1+7, "SEC_JOYD"}, -#elif defined (_XBOX) - {KEY_2JOY1+0, "SEC_JOYA"}, - {KEY_2JOY1+1, "SEC_JOYB"}, - {KEY_2JOY1+2, "SEC_JOYX"}, - {KEY_2JOY1+3, "SEC_JOYY"}, - {KEY_2JOY1+4, "SEC_JOYG"}, - {KEY_2JOY1+5, "SEC_JOYW"}, - {KEY_2JOY1+6, "SEC_JOYL"}, - {KEY_2JOY1+7, "SEC_JOYR"}, - {KEY_2JOY1+8, "SEC_JOYS"}, - {KEY_2JOY1+9, "SEC_JOYN"}, - {KEY_2JOY1+10,"SEC_JOYW"}, - {KEY_2JOY1+11,"SEC_JOYE"}, -#define NOMOREJOYBTN_2S -#elif defined (_PSP) - {KEY_2JOY1+0, "SEC_TRIANGLE"}, - {KEY_2JOY1+1, "SEC_CIRCLE" }, - {KEY_2JOY1+2, "SEC_CROSS" }, - {KEY_2JOY1+3, "SEC_SQUARE" }, - {KEY_2JOY1+4, "SEC_LTRIGGER"}, - {KEY_2JOY1+5, "SEC_RTRIGGER"}, - {KEY_2JOY1+6, "SEC_SELECT" }, - {KEY_2JOY1+7, "SEC_START" }, - {KEY_2JOY1+8, "SEC_HOME" }, - {KEY_2JOY1+9, "SEC_HOLD" }, -#define NOMOREJOYBTN_2S -#elif defined (WMINPUT) - {KEY_2JOY1+0, "SEC_JOYB"}, - {KEY_2JOY1+1, "SEC_JOYA"}, - {KEY_2JOY1+2, "SEC_JOYUP"}, - {KEY_2JOY1+3, "SEC_JOYDOWN"}, - {KEY_2JOY1+4, "SEC_JOYLEFT"}, - {KEY_2JOY1+5, "SEC_JOYRIGHT"}, - {KEY_2JOY1+6, "SEC_JOYAA"}, - {KEY_2JOY1+7, "SEC_JOYBB"}, - {KEY_2JOY1+8, "SEC_JOYCC"}, - {KEY_2JOY1+9, "SEC_JOYXX"}, - {KEY_2JOY1+10, "SEC_JOYYY"}, - {KEY_2JOY1+11, "SEC_JOYZZ"}, - {KEY_2JOY1+12, "SEC_JOYL"}, - {KEY_2JOY1+13, "SEC_JOYR"}, - {KEY_2JOY1+14, "SEC_JOYZL"}, - {KEY_2JOY1+15, "SEC_JOYZR"}, - {KEY_2JOY1+16, "SEC_JOYSELECT"}, - {KEY_2JOY1+17, "SEC_JOYSTART"}, - {KEY_2JOY1+18, "SEC_JOYHOME"}, - {KEY_2JOY1+19, "SEC_JOYMINUS"}, - {KEY_2JOY1+20, "SEC_JOYPLUS"}, - {KEY_2JOY1+21, "SEC_JOY_1"}, - {KEY_2JOY1+22, "SEC_JOY_2"}, - {KEY_2JOY1+23, "SEC_JOY24"}, - {KEY_2JOY1+24, "SEC_JOY25"}, - {KEY_2JOY1+25, "SEC_JOY26"}, - {KEY_2JOY1+26, "SEC_JOY27"}, - {KEY_2JOY1+27, "SEC_JOY28"}, - {KEY_2JOY1+28, "SEC_JOY29"}, - {KEY_2JOY1+29, "SEC_JOY30"}, - {KEY_2JOY1+30, "SEC_JOY31"}, - {KEY_2JOY1+31, "SEC_JOY32"}, -#define NOMOREJOYBTN_2S -#elif defined (_WII) - {KEY_2JOY1+0, "SEC_JOYA"}, - {KEY_2JOY1+1, "SEC_JOYB"}, - {KEY_2JOY1+2, "SEC_JOY1"}, - {KEY_2JOY1+3, "SEC_JOY2"}, - {KEY_2JOY1+4, "SEC_JOYMINUS"}, - {KEY_2JOY1+5, "SEC_JOYPLUS"}, - {KEY_2JOY1+6, "SEC_JOYHOME"}, - {KEY_2JOY1+7, "SEC_JOYZ"}, - {KEY_2JOY1+8, "SEC_JOYC"}, - {KEY_2JOY1+9, "SEC_JOYA_CC"}, - {KEY_2JOY1+10, "SEC_JOYB_CC"}, - {KEY_2JOY1+11, "SEC_JOYX"}, - {KEY_2JOY1+12, "SEC_JOYY"}, - {KEY_2JOY1+13, "SEC_JOYL"}, - {KEY_2JOY1+14, "SEC_JOYR"}, - {KEY_2JOY1+15, "SEC_JOYZL"}, - {KEY_2JOY1+16, "SEC_JOYZR"}, - {KEY_2JOY1+17, "SEC_JOYMINUS_CC"}, - {KEY_2JOY1+18, "SEC_JOYHPLUS_CC"}, - {KEY_2JOY1+19, "SEC_JOYMHOME_CC"}, -#define NOMOREJOYBTN_2S -#else {KEY_2JOY1+0, "SEC_JOY1"}, {KEY_2JOY1+1, "SEC_JOY2"}, {KEY_2JOY1+2, "SEC_JOY3"}, @@ -755,8 +461,7 @@ static keyname_t keynames[] = {KEY_2JOY1+5, "SEC_JOY6"}, {KEY_2JOY1+6, "SEC_JOY7"}, {KEY_2JOY1+7, "SEC_JOY8"}, -#endif -#if !defined (_arch_dreamcast) && !defined (NOMOREJOYBTN_2S) +#if !defined (NOMOREJOYBTN_2S) // we use up to 32 buttons in DirectInput {KEY_2JOY1+8, "SEC_JOY9"}, {KEY_2JOY1+9, "SEC_JOY10"}, @@ -788,12 +493,10 @@ static keyname_t keynames[] = {KEY_2HAT1+1, "SEC_HATDOWN"}, {KEY_2HAT1+2, "SEC_HATLEFT"}, {KEY_2HAT1+3, "SEC_HATRIGHT"}, -#if !defined (_XBOX) && !defined (_PSP) && !defined (_WII) {KEY_2HAT1+4, "SEC_HATUP2"}, {KEY_2HAT1+5, "SEC_HATDOWN2"}, {KEY_2HAT1+6, "SEC_HATLEFT2"}, {KEY_2HAT1+7, "SEC_HATRIGHT2"}, -#ifndef _arch_dreamcast {KEY_2HAT1+8, "SEC_HATUP3"}, {KEY_2HAT1+9, "SEC_HATDOWN3"}, {KEY_2HAT1+10, "SEC_HATLEFT3"}, @@ -802,101 +505,7 @@ static keyname_t keynames[] = {KEY_2HAT1+13, "SEC_HATDOWN4"}, {KEY_2HAT1+14, "SEC_HATLEFT4"}, {KEY_2HAT1+15, "SEC_HATRIGHT4"}, -#endif -#endif -#ifdef DC - {KEY_DBL2JOY1+0, "DBLSEC_JOYC"}, - {KEY_DBL2JOY1+1, "DBLSEC_JOYB"}, - {KEY_DBL2JOY1+2, "DBLSEC_JOYA"}, - {KEY_DBL2JOY1+3, "DBLSEC_JOYS"}, - {KEY_DBL2JOY1+4, "DBLSEC_JOYZ"}, - {KEY_DBL2JOY1+5, "DBLSEC_JOYY"}, - {KEY_DBL2JOY1+6, "DBLSEC_JOYX"}, - {KEY_DBL2JOY1+7, "DBLSEC_JOYD"}, -#elif defined (_XBOX) - {KEY_DBL2JOY1+0, "DBLSEC_JOYA"}, - {KEY_DBL2JOY1+1, "DBLSEC_JOYB"}, - {KEY_DBL2JOY1+2, "DBLSEC_JOYX"}, - {KEY_DBL2JOY1+3, "DBLSEC_JOYY"}, - {KEY_DBL2JOY1+4, "DBLSEC_JOYG"}, - {KEY_DBL2JOY1+5, "DBLSEC_JOYW"}, - {KEY_DBL2JOY1+6, "DBLSEC_JOYL"}, - {KEY_DBL2JOY1+7, "DBLSEC_JOYR"}, - {KEY_DBL2JOY1+8, "DBLSEC_JOYS"}, - {KEY_DBL2JOY1+9, "DBLSEC_JOYN"}, - {KEY_DBL2JOY1+10,"DBLSEC_JOYW"}, - {KEY_DBL2JOY1+11,"DBLSEC_JOYE"}, -#define NOMOREJOYBTN_2DBL -#elif defined (_PSP) - {KEY_DBL2JOY1+0, "DBLSEC_TRIANGLE"}, - {KEY_DBL2JOY1+1, "DBLSEC_CIRCLE" }, - {KEY_DBL2JOY1+2, "DBLSEC_CROSS" }, - {KEY_DBL2JOY1+3, "DBLSEC_SQUARE" }, - {KEY_DBL2JOY1+4, "DBLSEC_LTRIGGER"}, - {KEY_DBL2JOY1+5, "DBLSEC_RTRIGGER"}, - {KEY_DBL2JOY1+6, "DBLSEC_SELECT" }, - {KEY_DBL2JOY1+7, "DBLSEC_START" }, - {KEY_DBL2JOY1+8, "DBLSEC_HOME" }, - {KEY_DBL2JOY1+9, "DBLSEC_HOLD" }, -#define NOMOREJOYBTN_2DBL -#elif defined (WMINPUT) - {KEY_DBL2JOY1+0, "DBLSEC_JOYB"}, - {KEY_DBL2JOY1+1, "DBLSEC_JOYA"}, - {KEY_DBL2JOY1+2, "DBLSEC_JOYUP"}, - {KEY_DBL2JOY1+3, "DBLSEC_JOYDOWN"}, - {KEY_DBL2JOY1+4, "DBLSEC_JOYLEFT"}, - {KEY_DBL2JOY1+5, "DBLSEC_JOYRIGHT"}, - {KEY_DBL2JOY1+6, "DBLSEC_JOYAA"}, - {KEY_DBL2JOY1+7, "DBLSEC_JOYBB"}, - {KEY_DBL2JOY1+8, "DBLSEC_JOYCC"}, - {KEY_DBL2JOY1+9, "DBLSEC_JOYXX"}, - {KEY_DBL2JOY1+10, "DBLSEC_JOYYY"}, - {KEY_DBL2JOY1+11, "DBLSEC_JOYZZ"}, - {KEY_DBL2JOY1+12, "DBLSEC_JOYL"}, - {KEY_DBL2JOY1+13, "DBLSEC_JOYR"}, - {KEY_DBL2JOY1+14, "DBLSEC_JOYZL"}, - {KEY_DBL2JOY1+15, "DBLSEC_JOYZR"}, - {KEY_DBL2JOY1+16, "DBLSEC_JOYSELECT"}, - {KEY_DBL2JOY1+17, "DBLSEC_JOYSTART"}, - {KEY_DBL2JOY1+18, "DBLSEC_JOYHOME"}, - {KEY_DBL2JOY1+19, "DBLSEC_JOYMINUS"}, - {KEY_DBL2JOY1+20, "DBLSEC_JOYPLUS"}, - {KEY_DBL2JOY1+21, "DBLSEC_JOY_1"}, - {KEY_DBL2JOY1+22, "DBLSEC_JOY_2"}, - {KEY_DBL2JOY1+23, "DBLSEC_JOY24"}, - {KEY_DBL2JOY1+24, "DBLSEC_JOY25"}, - {KEY_DBL2JOY1+25, "DBLSEC_JOY26"}, - {KEY_DBL2JOY1+26, "DBLSEC_JOY27"}, - {KEY_DBL2JOY1+27, "DBLSEC_JOY28"}, - {KEY_DBL2JOY1+28, "DBLSEC_JOY29"}, - {KEY_DBL2JOY1+29, "DBLSEC_JOY30"}, - {KEY_DBL2JOY1+30, "DBLSEC_JOY31"}, - {KEY_DBL2JOY1+31, "DBLSEC_JOY32"}, -#define NOMOREJOYBTN_2SDBL -#elif defined (_WII) - {KEY_DBL2JOY1+0, "DBLSEC_JOYA"}, - {KEY_DBL2JOY1+1, "DBLSEC_JOYB"}, - {KEY_DBL2JOY1+2, "DBLSEC_JOY1"}, - {KEY_DBL2JOY1+3, "DBLSEC_JOY2"}, - {KEY_DBL2JOY1+4, "DBLSEC_JOYMINUS"}, - {KEY_DBL2JOY1+5, "DBLSEC_JOYPLUS"}, - {KEY_DBL2JOY1+6, "DBLSEC_JOYHOME"}, - {KEY_DBL2JOY1+7, "DBLSEC_JOYZ"}, - {KEY_DBL2JOY1+8, "DBLSEC_JOYC"}, - {KEY_DBL2JOY1+9, "DBLSEC_JOYA_CC"}, - {KEY_DBL2JOY1+10, "DBLSEC_JOYB_CC"}, - {KEY_DBL2JOY1+11, "DBLSEC_JOYX"}, - {KEY_DBL2JOY1+12, "DBLSEC_JOYY"}, - {KEY_DBL2JOY1+13, "DBLSEC_JOYL"}, - {KEY_DBL2JOY1+14, "DBLSEC_JOYR"}, - {KEY_DBL2JOY1+15, "DBLSEC_JOYZL"}, - {KEY_DBL2JOY1+16, "DBLSEC_JOYZR"}, - {KEY_DBL2JOY1+17, "DBLSEC_JOYMINUS_CC"}, - {KEY_DBL2JOY1+18, "DBLSEC_JOYHPLUS_CC"}, - {KEY_DBL2JOY1+19, "DBLSEC_JOYMHOME_CC"}, -#define NOMOREJOYBTN_2DBL -#else {KEY_DBL2JOY1+0, "DBLSEC_JOY1"}, {KEY_DBL2JOY1+1, "DBLSEC_JOY2"}, {KEY_DBL2JOY1+2, "DBLSEC_JOY3"}, @@ -905,8 +514,7 @@ static keyname_t keynames[] = {KEY_DBL2JOY1+5, "DBLSEC_JOY6"}, {KEY_DBL2JOY1+6, "DBLSEC_JOY7"}, {KEY_DBL2JOY1+7, "DBLSEC_JOY8"}, -#endif -#if !defined (_arch_dreamcast) && !defined (NOMOREJOYBTN_2DBL) +#if !defined (NOMOREJOYBTN_2DBL) {KEY_DBL2JOY1+8, "DBLSEC_JOY9"}, {KEY_DBL2JOY1+9, "DBLSEC_JOY10"}, {KEY_DBL2JOY1+10, "DBLSEC_JOY11"}, @@ -936,12 +544,10 @@ static keyname_t keynames[] = {KEY_DBL2HAT1+1, "DBLSEC_HATDOWN"}, {KEY_DBL2HAT1+2, "DBLSEC_HATLEFT"}, {KEY_DBL2HAT1+3, "DBLSEC_HATRIGHT"}, -#if !defined (_XBOX) && !defined (_PSP) && !defined (_WII) {KEY_DBL2HAT1+4, "DBLSEC_HATUP2"}, {KEY_DBL2HAT1+5, "DBLSEC_HATDOWN2"}, {KEY_DBL2HAT1+6, "DBLSEC_HATLEFT2"}, {KEY_DBL2HAT1+7, "DBLSEC_HATRIGHT2"}, -#ifndef _arch_dreamcast {KEY_DBL2HAT1+8, "DBLSEC_HATUP3"}, {KEY_DBL2HAT1+9, "DBLSEC_HATDOWN3"}, {KEY_DBL2HAT1+10, "DBLSEC_HATLEFT3"}, @@ -950,8 +556,6 @@ static keyname_t keynames[] = {KEY_DBL2HAT1+13, "DBLSEC_HATDOWN4"}, {KEY_DBL2HAT1+14, "DBLSEC_HATLEFT4"}, {KEY_DBL2HAT1+15, "DBLSEC_HATRIGHT4"}, -#endif -#endif }; @@ -981,8 +585,6 @@ static const char *gamecontrolname[num_gamecontrols] = "tossflag", "use", "camtoggle", - "camleft", - "camright", "camreset", "lookup", "lookdown", @@ -1069,260 +671,150 @@ INT32 G_KeyStringtoNum(const char *keystr) return 0; } -#ifdef DC -void G_Controldefault(void) +void G_DefineDefaultControls(void) { - gamecontrol[gc_forward ][0] = KEY_HAT1+0; //Up - gamecontrol[gc_forward ][1] = KEY_UPARROW; - gamecontrol[gc_backward ][0] = KEY_HAT1+1; //Down - gamecontrol[gc_backward ][1] = KEY_DOWNARROW; - //gamecontrol[gc_straferight][0] = '['; - //gamecontrol[gc_strafeleft ][0] = ']'; - gamecontrol[gc_turnleft ][0] = KEY_HAT1+2; //Left - gamecontrol[gc_turnleft ][1] = KEY_LEFTARROW; - gamecontrol[gc_turnright ][0] = KEY_HAT1+3; //Right - gamecontrol[gc_turnright ][1] = KEY_RIGHTARROW; - gamecontrol[gc_weaponnext ][0] = ']'; - gamecontrol[gc_weaponprev ][0] = '['; - gamecontrol[gc_fire ][0] = KEY_JOY1+6; //X - gamecontrol[gc_fire ][1] = KEY_RCTRL; - gamecontrol[gc_firenormal ][0] = KEY_JOY1+5; //Y - gamecontrol[gc_firenormal ][1] = ';'; - gamecontrol[gc_tossflag ][0] = '\''; - gamecontrol[gc_use ][0] = KEY_JOY1+1; //B - gamecontrol[gc_use ][1] = '.'; - gamecontrol[gc_camtoggle ][1] = ','; - gamecontrol[gc_camleft ][0] = 'o'; - gamecontrol[gc_camright ][0] = 'p'; - gamecontrol[gc_camreset ][0] = 'c'; - gamecontrol[gc_lookup ][0] = KEY_PGUP; - gamecontrol[gc_lookdown ][0] = KEY_PGDN; - gamecontrol[gc_centerview ][0] = KEY_END; - gamecontrol[gc_mouseaiming][0] = 's'; - gamecontrol[gc_talkkey ][0] = 't'; - gamecontrol[gc_teamkey ][0] = 'y'; - gamecontrol[gc_scores ][0] = KEY_TAB; - gamecontrol[gc_jump ][0] = KEY_JOY1+2; //A - gamecontrol[gc_jump ][1] = '/'; - gamecontrol[gc_console ][0] = KEY_CONSOLE; - gamecontrol[gc_console ][1] = KEY_F5; - //gamecontrolbis - gamecontrolbis[gc_forward ][0] = KEY_2HAT1+0; - gamecontrolbis[gc_forward ][1] = 'w'; - gamecontrolbis[gc_backward ][0] = KEY_2HAT1+1; - gamecontrolbis[gc_backward ][1] = 's'; - gamecontrolbis[gc_turnleft ][0] = KEY_2HAT1+2; - gamecontrolbis[gc_turnleft ][1] = 'a'; - gamecontrolbis[gc_turnright ][0] = KEY_2HAT1+3; - gamecontrolbis[gc_turnright ][1] = 'd'; - gamecontrolbis[gc_weaponnext][0] = 't'; - gamecontrolbis[gc_weaponprev][0] = 'r'; - gamecontrolbis[gc_fire ][0] = KEY_2JOY1+6; //X - gamecontrolbis[gc_firenormal][0] = KEY_2JOY1+5; //Y - gamecontrolbis[gc_use ][0] = KEY_2JOY1+1; //B - gamecontrolbis[gc_jump ][0] = KEY_2JOY1+2; //A - //gamecontrolbis[gc_straferight][0] = 'x'; - //gamecontrolbis[gc_strafeleft ][0] = 'z'; -} -#elif defined (_PSP) -void G_Controldefault(void) -{ - gamecontrol[gc_forward ][0] = KEY_HAT1+0; // Up - gamecontrol[gc_backward ][0] = KEY_HAT1+1; // Down - gamecontrol[gc_turnleft ][0] = KEY_HAT1+2; // Left - gamecontrol[gc_turnright ][0] = KEY_HAT1+3; // Right - gamecontrol[gc_strafeleft ][0] = KEY_JOY1+4; // L - gamecontrol[gc_straferight][0] = KEY_JOY1+5; // R - gamecontrol[gc_tossflag ][0] = KEY_JOY1+0; // Triangle - gamecontrol[gc_use ][0] = KEY_JOY1+1; // Circle - gamecontrol[gc_camtoggle ][0] = KEY_JOY1+6; // Select - gamecontrol[gc_camreset ][0] = KEY_JOY1+3; // Square - gamecontrol[gc_centerview ][0] = KEY_JOY1+9; // Hold - gamecontrol[gc_pause ][0] = KEY_JOY1+8; // Start - gamecontrol[gc_jump ][0] = KEY_JOY1+2; // Cross -} -#elif defined (GP2X) -void G_Controldefault(void) -{ - gamecontrol[gc_fire ][0] = KEY_JOY1+0; //A - gamecontrol[gc_forward ][0] = KEY_JOY1+1; //Y - gamecontrol[gc_jump ][0] = KEY_JOY1+2; //B - gamecontrol[gc_use ][0] = KEY_JOY1+3; //X - gamecontrol[gc_strafeleft ][0] = KEY_JOY1+4; //L - gamecontrol[gc_straferight][0] = KEY_JOY1+5; //R - gamecontrol[gc_lookup ][0] = KEY_JOY1+6; //U - gamecontrol[gc_lookdown ][0] = KEY_JOY1+7; //D - gamecontrol[gc_pause ][0] = KEY_JOY1+8; //S -} -#elif defined (_NDS) -void G_Controldefault(void) -{ - gamecontrol[gc_fire ][0] = KEY_JOY1+2; //X - gamecontrol[gc_forward ][0] = KEY_UPARROW; - gamecontrol[gc_backward ][0] = KEY_DOWNARROW; - gamecontrol[gc_jump ][0] = KEY_JOY1+0; //A - gamecontrol[gc_use ][0] = KEY_JOY1+3; //Y - gamecontrol[gc_strafeleft ][0] = KEY_JOY1+4; //L - gamecontrol[gc_straferight][0] = KEY_JOY1+5; //R - gamecontrol[gc_turnleft ][0] = KEY_LEFTARROW; - gamecontrol[gc_turnright ][0] = KEY_RIGHTARROW; - gamecontrol[gc_pause ][0] = KEY_JOY1+6; //Start - gamecontrol[gc_weaponnext ][0] = KEY_JOY1+7; //Select -} -#else -void G_Controldefault(void) -{ - gamecontrol[gc_forward ][0] = 'w'; - gamecontrol[gc_backward ][0] = 's'; - gamecontrol[gc_strafeleft ][0] = 'a'; - gamecontrol[gc_straferight][0] = 'd'; - gamecontrol[gc_turnleft ][0] = KEY_LEFTARROW; - gamecontrol[gc_turnright ][0] = KEY_RIGHTARROW; - gamecontrol[gc_weaponnext ][0] = 'e'; - gamecontrol[gc_weaponnext ][1] = KEY_JOY1+1; // B - gamecontrol[gc_weaponprev ][0] = 'q'; - gamecontrol[gc_weaponprev ][1] = KEY_JOY1+2; // X - gamecontrol[gc_wepslot1 ][0] = '1'; - gamecontrol[gc_wepslot2 ][0] = '2'; - gamecontrol[gc_wepslot3 ][0] = '3'; - gamecontrol[gc_wepslot4 ][0] = '4'; - gamecontrol[gc_wepslot5 ][0] = '5'; - gamecontrol[gc_wepslot6 ][0] = '6'; - gamecontrol[gc_wepslot7 ][0] = '7'; - gamecontrol[gc_wepslot8 ][0] = '8'; - gamecontrol[gc_wepslot9 ][0] = '9'; - gamecontrol[gc_wepslot10 ][0] = '0'; - gamecontrol[gc_fire ][0] = KEY_RCTRL; - gamecontrol[gc_fire ][1] = KEY_MOUSE1+0; - gamecontrol[gc_firenormal ][0] = 'c'; - gamecontrol[gc_tossflag ][0] = '\''; - gamecontrol[gc_tossflag ][1] = KEY_JOY1+0; // A - gamecontrol[gc_use ][0] = KEY_LSHIFT; - gamecontrol[gc_use ][1] = KEY_JOY1+4; // LB - gamecontrol[gc_camtoggle ][0] = 'v'; - gamecontrol[gc_camtoggle ][1] = KEY_HAT1+0; // D-Pad Up - gamecontrol[gc_camleft ][0] = '['; - gamecontrol[gc_camright ][0] = ']'; - gamecontrol[gc_camreset ][0] = 'r'; - gamecontrol[gc_camreset ][1] = KEY_JOY1+3; // Y - gamecontrol[gc_lookup ][0] = KEY_UPARROW; - gamecontrol[gc_lookdown ][0] = KEY_DOWNARROW; - gamecontrol[gc_centerview ][0] = KEY_END; - gamecontrol[gc_centerview ][1] = KEY_JOY1+9; // Right Stick - gamecontrol[gc_talkkey ][0] = 't'; - gamecontrol[gc_talkkey ][1] = KEY_HAT1+2; // D-Pad Left - gamecontrol[gc_teamkey ][0] = 'y'; - gamecontrol[gc_scores ][0] = KEY_TAB; - gamecontrol[gc_scores ][1] = KEY_HAT1+3; // D-Pad Right - gamecontrol[gc_jump ][0] = KEY_SPACE; - gamecontrol[gc_jump ][1] = KEY_JOY1+5; // RB - gamecontrol[gc_console ][0] = KEY_CONSOLE; - gamecontrol[gc_pause ][0] = 'p'; - gamecontrol[gc_pause ][1] = KEY_JOY1+6; // Back - gamecontrol[gc_screenshot ][0] = KEY_F8; - gamecontrol[gc_screenshot ][1] = KEY_HAT1+1; // D-Pad Down - gamecontrol[gc_recordgif ][0] = KEY_F9; - gamecontrol[gc_viewpoint ][0] = KEY_F12; - gamecontrol[gc_systemmenu ][0] = KEY_JOY1+7; // Start - gamecontrolbis[gc_weaponnext][0] = KEY_2JOY1+1; // B - gamecontrolbis[gc_weaponprev][0] = KEY_2JOY1+2; // X - gamecontrolbis[gc_tossflag ][0] = KEY_2JOY1+0; // A - gamecontrolbis[gc_use ][0] = KEY_2JOY1+4; // LB - gamecontrolbis[gc_camreset ][0] = KEY_2JOY1+3; // Y - gamecontrolbis[gc_centerview][0] = KEY_2JOY1+9; // Right Stick - gamecontrolbis[gc_jump ][0] = KEY_2JOY1+5; // RB - //gamecontrolbis[gc_pause ][0] = KEY_2JOY1+6; // Back - //gamecontrolbis[gc_systemmenu][0] = KEY_2JOY1+7; // Start - gamecontrolbis[gc_camtoggle ][0] = KEY_2HAT1+0; // D-Pad Up - gamecontrolbis[gc_screenshot][0] = KEY_2HAT1+1; // D-Pad Down - //gamecontrolbis[gc_talkkey ][0] = KEY_2HAT1+2; // D-Pad Left - //gamecontrolbis[gc_scores ][0] = KEY_2HAT1+3; // D-Pad Right -#ifdef WMINPUT - gamecontrol[gc_forward ][0] = KEY_JOY1+02; //UP - gamecontrol[gc_backward ][0] = KEY_JOY1+03; //DOWN - gamecontrol[gc_turnleft ][0] = KEY_JOY1+04; //LEFT - gamecontrol[gc_turnright ][0] = KEY_JOY1+05; //RIGHT - gamecontrol[gc_weaponnext ][0] = KEY_JOY1+10; //y - gamecontrol[gc_weaponprev ][0] = KEY_JOY1+9; //x - gamecontrol[gc_fire ][0] = KEY_JOY1+12; //L - gamecontrol[gc_firenormal ][0] = KEY_JOY1+13; //R - gamecontrol[gc_use ][0] = KEY_JOY1+00; //B - gamecontrol[gc_use ][1] = KEY_JOY1+07; //b - gamecontrol[gc_jump ][0] = KEY_JOY1+01; //A - gamecontrol[gc_jump ][1] = KEY_JOY1+06; //a - gamecontrol[gc_pause ][0] = KEY_JOY1+18; //Home - gamecontrolbis[gc_forward ][0] = KEY_2JOY1+02; //UP - gamecontrolbis[gc_backward ][0] = KEY_2JOY1+03; //DOWN - gamecontrolbis[gc_turnleft ][0] = KEY_2JOY1+04; //LEFT - gamecontrolbis[gc_turnright ][0] = KEY_2JOY1+05; //RIGHT - gamecontrolbis[gc_weaponnext ][0] = KEY_2JOY1+10; //y - gamecontrolbis[gc_weaponprev ][0] = KEY_2JOY1+9; //x - gamecontrolbis[gc_fire ][0] = KEY_2JOY1+12; //L - gamecontrolbis[gc_firenormal ][0] = KEY_2JOY1+13; //R - gamecontrolbis[gc_use ][0] = KEY_2JOY1+00; //B - gamecontrolbis[gc_use ][1] = KEY_2JOY1+07; //b - gamecontrolbis[gc_jump ][0] = KEY_2JOY1+01; //A - gamecontrolbis[gc_jump ][1] = KEY_2JOY1+06; //a - gamecontrolbis[gc_pause ][0] = KEY_2JOY1+18; //Home -#endif -#ifdef _WII - gamecontrol[gc_forward ][1] = KEY_HAT1+00; //UP - gamecontrol[gc_backward ][1] = KEY_HAT1+01; //DOWN - gamecontrol[gc_straferight][1] = KEY_JOY1+16; //ZR - gamecontrol[gc_strafeleft ][1] = KEY_JOY1+15; //ZL - gamecontrol[gc_turnleft ][1] = KEY_HAT1+02; //LEFT - gamecontrol[gc_turnright ][1] = KEY_HAT1+03; //RIGHT - gamecontrol[gc_weaponnext ][1] = KEY_JOY1+11; //x - gamecontrol[gc_fire ][0] = KEY_JOY1+12; //y - gamecontrol[gc_fire ][1] = KEY_JOY1+01; //B - gamecontrol[gc_firenormal ][0] = KEY_JOY1+13; //L - gamecontrol[gc_firenormal ][1] = KEY_JOY1+00; //A - gamecontrol[gc_tossflag ][1] = KEY_JOY1+17; //Plus CC - gamecontrol[gc_use ][0] = KEY_JOY1+9; //a - gamecontrol[gc_use ][1] = KEY_JOY1+02; //1 - gamecontrol[gc_centerview ][1] = KEY_JOY1+14; //R - gamecontrol[gc_scores ][0] = KEY_JOY1+04; //Minus - gamecontrol[gc_scores ][1] = KEY_JOY1+18; //Minus - gamecontrol[gc_jump ][0] = KEY_JOY1+10; //b - gamecontrol[gc_jump ][1] = KEY_JOY1+3; //2 - gamecontrol[gc_pause ][0] = KEY_JOY1+06; //Home - gamecontrol[gc_pause ][1] = KEY_JOY1+19; //Home - gamecontrolbis[gc_forward ][1] = KEY_2HAT1+00; //UP - gamecontrolbis[gc_backward ][1] = KEY_2HAT1+01; //DOWN - gamecontrolbis[gc_straferight][1] = KEY_2JOY1+16; //ZR - gamecontrolbis[gc_strafeleft ][1] = KEY_2JOY1+15; //ZL - gamecontrolbis[gc_turnleft ][1] = KEY_2HAT1+02; //LEFT - gamecontrolbis[gc_turnright ][1] = KEY_2HAT1+03; //RIGHT - gamecontrolbis[gc_weaponnext ][1] = KEY_2JOY1+11; //x - gamecontrolbis[gc_fire ][0] = KEY_2JOY1+12; //y - gamecontrolbis[gc_fire ][1] = KEY_2JOY1+01; //B - gamecontrolbis[gc_firenormal ][0] = KEY_2JOY1+13; //L - gamecontrolbis[gc_firenormal ][1] = KEY_2JOY1+00; //A - gamecontrolbis[gc_tossflag ][1] = KEY_2JOY1+17; //Plus CC - gamecontrolbis[gc_use ][0] = KEY_2JOY1+9; //a - gamecontrolbis[gc_use ][1] = KEY_2JOY1+02; //1 - gamecontrolbis[gc_centerview ][1] = KEY_2JOY1+14; //R - gamecontrolbis[gc_scores ][0] = KEY_2JOY1+04; //Minus - gamecontrolbis[gc_scores ][1] = KEY_2JOY1+18; //Minus - gamecontrolbis[gc_jump ][0] = KEY_2JOY1+10; //b - gamecontrolbis[gc_jump ][1] = KEY_2JOY1+3; //2 - gamecontrolbis[gc_pause ][0] = KEY_2JOY1+06; //Home - gamecontrolbis[gc_pause ][1] = KEY_2JOY1+19; //Home -#endif -} -#endif + INT32 i; -void G_SaveKeySetting(FILE *f) + // FPS game controls (WASD) + gamecontroldefault[gcs_fps][gc_forward ][0] = 'w'; + gamecontroldefault[gcs_fps][gc_backward ][0] = 's'; + gamecontroldefault[gcs_fps][gc_strafeleft ][0] = 'a'; + gamecontroldefault[gcs_fps][gc_straferight][0] = 'd'; + gamecontroldefault[gcs_fps][gc_lookup ][0] = KEY_UPARROW; + gamecontroldefault[gcs_fps][gc_lookdown ][0] = KEY_DOWNARROW; + gamecontroldefault[gcs_fps][gc_turnleft ][0] = KEY_LEFTARROW; + gamecontroldefault[gcs_fps][gc_turnright ][0] = KEY_RIGHTARROW; + gamecontroldefault[gcs_fps][gc_centerview ][0] = KEY_END; + gamecontroldefault[gcs_fps][gc_jump ][0] = KEY_SPACE; + gamecontroldefault[gcs_fps][gc_use ][0] = KEY_LSHIFT; + gamecontroldefault[gcs_fps][gc_fire ][0] = KEY_RCTRL; + gamecontroldefault[gcs_fps][gc_fire ][1] = KEY_MOUSE1+0; + gamecontroldefault[gcs_fps][gc_firenormal ][0] = 'c'; + + // Platform game controls (arrow keys) + gamecontroldefault[gcs_platform][gc_forward ][0] = KEY_UPARROW; + gamecontroldefault[gcs_platform][gc_backward ][0] = KEY_DOWNARROW; + gamecontroldefault[gcs_platform][gc_strafeleft ][0] = 'a'; + gamecontroldefault[gcs_platform][gc_straferight][0] = 'd'; + gamecontroldefault[gcs_platform][gc_lookup ][0] = KEY_PGUP; + gamecontroldefault[gcs_platform][gc_lookdown ][0] = KEY_PGDN; + gamecontroldefault[gcs_platform][gc_turnleft ][0] = KEY_LEFTARROW; + gamecontroldefault[gcs_platform][gc_turnright ][0] = KEY_RIGHTARROW; + gamecontroldefault[gcs_platform][gc_centerview ][0] = KEY_END; + gamecontroldefault[gcs_platform][gc_jump ][0] = KEY_SPACE; + gamecontroldefault[gcs_platform][gc_use ][0] = KEY_LSHIFT; + gamecontroldefault[gcs_platform][gc_fire ][0] = 's'; + gamecontroldefault[gcs_platform][gc_fire ][1] = KEY_MOUSE1+0; + gamecontroldefault[gcs_platform][gc_firenormal ][0] = 'w'; + + for (i = 1; i < num_gamecontrolschemes; i++) // skip gcs_custom (0) + { + gamecontroldefault[i][gc_weaponnext ][0] = 'e'; + gamecontroldefault[i][gc_weaponprev ][0] = 'q'; + gamecontroldefault[i][gc_wepslot1 ][0] = '1'; + gamecontroldefault[i][gc_wepslot2 ][0] = '2'; + gamecontroldefault[i][gc_wepslot3 ][0] = '3'; + gamecontroldefault[i][gc_wepslot4 ][0] = '4'; + gamecontroldefault[i][gc_wepslot5 ][0] = '5'; + gamecontroldefault[i][gc_wepslot6 ][0] = '6'; + gamecontroldefault[i][gc_wepslot7 ][0] = '7'; + gamecontroldefault[i][gc_wepslot8 ][0] = '8'; + gamecontroldefault[i][gc_wepslot9 ][0] = '9'; + gamecontroldefault[i][gc_wepslot10 ][0] = '0'; + gamecontroldefault[i][gc_tossflag ][0] = '\''; + gamecontroldefault[i][gc_camtoggle ][0] = 'v'; + gamecontroldefault[i][gc_camreset ][0] = 'r'; + gamecontroldefault[i][gc_talkkey ][0] = 't'; + gamecontroldefault[i][gc_teamkey ][0] = 'y'; + gamecontroldefault[i][gc_scores ][0] = KEY_TAB; + gamecontroldefault[i][gc_console ][0] = KEY_CONSOLE; + gamecontroldefault[i][gc_pause ][0] = 'p'; + gamecontroldefault[i][gc_screenshot ][0] = KEY_F8; + gamecontroldefault[i][gc_recordgif ][0] = KEY_F9; + gamecontroldefault[i][gc_viewpoint ][0] = KEY_F12; + + // Gamepad controls -- same for both schemes + gamecontroldefault[i][gc_weaponnext ][1] = KEY_JOY1+1; // B + gamecontroldefault[i][gc_weaponprev ][1] = KEY_JOY1+2; // X + gamecontroldefault[i][gc_tossflag ][1] = KEY_JOY1+0; // A + gamecontroldefault[i][gc_use ][1] = KEY_JOY1+4; // LB + gamecontroldefault[i][gc_camtoggle ][1] = KEY_HAT1+0; // D-Pad Up + gamecontroldefault[i][gc_camreset ][1] = KEY_JOY1+3; // Y + gamecontroldefault[i][gc_centerview ][1] = KEY_JOY1+9; // Right Stick + gamecontroldefault[i][gc_talkkey ][1] = KEY_HAT1+2; // D-Pad Left + gamecontroldefault[i][gc_scores ][1] = KEY_HAT1+3; // D-Pad Right + gamecontroldefault[i][gc_jump ][1] = KEY_JOY1+5; // RB + gamecontroldefault[i][gc_pause ][1] = KEY_JOY1+6; // Back + gamecontroldefault[i][gc_screenshot ][1] = KEY_HAT1+1; // D-Pad Down + gamecontroldefault[i][gc_systemmenu ][0] = KEY_JOY1+7; // Start + + // Second player controls only have joypad defaults + gamecontrolbisdefault[i][gc_weaponnext][0] = KEY_2JOY1+1; // B + gamecontrolbisdefault[i][gc_weaponprev][0] = KEY_2JOY1+2; // X + gamecontrolbisdefault[i][gc_tossflag ][0] = KEY_2JOY1+0; // A + gamecontrolbisdefault[i][gc_use ][0] = KEY_2JOY1+4; // LB + gamecontrolbisdefault[i][gc_camreset ][0] = KEY_2JOY1+3; // Y + gamecontrolbisdefault[i][gc_centerview][0] = KEY_2JOY1+9; // Right Stick + gamecontrolbisdefault[i][gc_jump ][0] = KEY_2JOY1+5; // RB + //gamecontrolbisdefault[i][gc_pause ][0] = KEY_2JOY1+6; // Back + //gamecontrolbisdefault[i][gc_systemmenu][0] = KEY_2JOY1+7; // Start + gamecontrolbisdefault[i][gc_camtoggle ][0] = KEY_2HAT1+0; // D-Pad Up + gamecontrolbisdefault[i][gc_screenshot][0] = KEY_2HAT1+1; // D-Pad Down + //gamecontrolbisdefault[i][gc_talkkey ][0] = KEY_2HAT1+2; // D-Pad Left + //gamecontrolbisdefault[i][gc_scores ][0] = KEY_2HAT1+3; // D-Pad Right + } +} + +INT32 G_GetControlScheme(INT32 (*fromcontrols)[2], const INT32 *gclist, INT32 gclen) +{ + INT32 i, j, gc; + boolean skipscheme; + + for (i = 1; i < num_gamecontrolschemes; i++) // skip gcs_custom (0) + { + skipscheme = false; + for (j = 0; j < (gclist && gclen ? gclen : num_gamecontrols); j++) + { + gc = (gclist && gclen) ? gclist[j] : j; + if (((fromcontrols[gc][0] && gamecontroldefault[i][gc][0]) ? fromcontrols[gc][0] != gamecontroldefault[i][gc][0] : true) && + ((fromcontrols[gc][0] && gamecontroldefault[i][gc][1]) ? fromcontrols[gc][0] != gamecontroldefault[i][gc][1] : true) && + ((fromcontrols[gc][1] && gamecontroldefault[i][gc][0]) ? fromcontrols[gc][1] != gamecontroldefault[i][gc][0] : true) && + ((fromcontrols[gc][1] && gamecontroldefault[i][gc][1]) ? fromcontrols[gc][1] != gamecontroldefault[i][gc][1] : true)) + { + skipscheme = true; + break; + } + } + if (!skipscheme) + return i; + } + + return gcs_custom; +} + +void G_CopyControls(INT32 (*setupcontrols)[2], INT32 (*fromcontrols)[2], const INT32 *gclist, INT32 gclen) +{ + INT32 i, gc; + + for (i = 0; i < (gclist && gclen ? gclen : num_gamecontrols); i++) + { + gc = (gclist && gclen) ? gclist[i] : i; + setupcontrols[gc][0] = fromcontrols[gc][0]; + setupcontrols[gc][1] = fromcontrols[gc][1]; + } +} + +void G_SaveKeySetting(FILE *f, INT32 (*fromcontrols)[2], INT32 (*fromcontrolsbis)[2]) { INT32 i; for (i = 1; i < num_gamecontrols; i++) { fprintf(f, "setcontrol \"%s\" \"%s\"", gamecontrolname[i], - G_KeynumToString(gamecontrol[i][0])); + G_KeynumToString(fromcontrols[i][0])); - if (gamecontrol[i][1]) - fprintf(f, " \"%s\"\n", G_KeynumToString(gamecontrol[i][1])); + if (fromcontrols[i][1]) + fprintf(f, " \"%s\"\n", G_KeynumToString(fromcontrols[i][1])); else fprintf(f, "\n"); } @@ -1330,10 +822,10 @@ void G_SaveKeySetting(FILE *f) for (i = 1; i < num_gamecontrols; i++) { fprintf(f, "setcontrol2 \"%s\" \"%s\"", gamecontrolname[i], - G_KeynumToString(gamecontrolbis[i][0])); + G_KeynumToString(fromcontrolsbis[i][0])); - if (gamecontrolbis[i][1]) - fprintf(f, " \"%s\"\n", G_KeynumToString(gamecontrolbis[i][1])); + if (fromcontrolsbis[i][1]) + fprintf(f, " \"%s\"\n", G_KeynumToString(fromcontrolsbis[i][1])); else fprintf(f, "\n"); } @@ -1390,7 +882,6 @@ static INT32 G_FilterKeyByVersion(INT32 numctrl, INT32 keyidx, INT32 player, INT else if (keyidx == 1 && *keynum2 == KEY_PAUSE) return -1; // skip setting control -#if !defined (DC) && !defined (_PSP) && !defined (GP2X) && !defined (_NDS) && !defined(WMINPUT) && !defined(_WII) if (GETMAJOREXECVERSION(cv_execversion.value) < 27 && ( // v2.1.22 numctrl == gc_weaponnext || numctrl == gc_weaponprev || numctrl == gc_tossflag || numctrl == gc_use || numctrl == gc_camreset || numctrl == gc_jump || @@ -1483,7 +974,6 @@ static INT32 G_FilterKeyByVersion(INT32 numctrl, INT32 keyidx, INT32 player, INT else return 0; } -#endif // All's good, so pass the keynum as-is if (keyidx == 1) diff --git a/src/g_input.h b/src/g_input.h index 8f4e9cb09..d3c693781 100644 --- a/src/g_input.h +++ b/src/g_input.h @@ -22,33 +22,10 @@ // keys (mousebuttons and joybuttons becomes keys) #define NUMKEYS 256 - -#ifdef _arch_dreamcast -#define MOUSEBUTTONS 5 -#define JOYBUTTONS 8 // 8 buttons -#define JOYHATS 2 // 2 hats -#define JOYAXISSET 3 // 3 Sets of 2 axises -#elif defined (_XBOX) -#define MOUSEBUTTONS 5 -#define JOYBUTTONS 12 // 12 buttons -#define JOYHATS 1 // 1 hat -#define JOYAXISSET 2 // 2 Sets of 2 axises -#elif defined (_PSP) -#define MOUSEBUTTONS 3 -#define JOYBUTTONS 14 // 10 buttons -#define JOYHATS 1 // 1 hat -#define JOYAXISSET 1 // 1 Set of 2 axises -#elif defined (_WII) -#define MOUSEBUTTONS 3 -#define JOYBUTTONS 20 // 20 buttons -#define JOYHATS 1 // 1 hat -#define JOYAXISSET 5 // 5 Sets of 2 axises -#else #define MOUSEBUTTONS 8 #define JOYBUTTONS 32 // 32 buttons #define JOYHATS 4 // 4 hats #define JOYAXISSET 4 // 4 Sets of 2 axises -#endif // // mouse and joystick buttons are handled as 'virtual' keys @@ -105,8 +82,6 @@ typedef enum gc_tossflag, gc_use, gc_camtoggle, - gc_camleft, - gc_camright, gc_camreset, gc_lookup, gc_lookdown, @@ -128,6 +103,14 @@ typedef enum num_gamecontrols } gamecontrols_e; +typedef enum +{ + gcs_custom, + gcs_fps, + gcs_platform, + num_gamecontrolschemes +} gamecontrolschemes_e; + // mouse values are used once extern consvar_t cv_mousesens, cv_mouseysens; extern consvar_t cv_mousesens2, cv_mouseysens2; @@ -145,9 +128,31 @@ extern UINT8 gamekeydown[NUMINPUTS]; // two key codes (or virtual key) per game control extern INT32 gamecontrol[num_gamecontrols][2]; extern INT32 gamecontrolbis[num_gamecontrols][2]; // secondary splitscreen player +extern INT32 gamecontroldefault[num_gamecontrolschemes][num_gamecontrols][2]; // default control storage, use 0 (gcs_custom) for memory retention +extern INT32 gamecontrolbisdefault[num_gamecontrolschemes][num_gamecontrols][2]; #define PLAYER1INPUTDOWN(gc) (gamekeydown[gamecontrol[gc][0]] || gamekeydown[gamecontrol[gc][1]]) #define PLAYER2INPUTDOWN(gc) (gamekeydown[gamecontrolbis[gc][0]] || gamekeydown[gamecontrolbis[gc][1]]) +#define num_gcl_tutorial_check 6 +#define num_gcl_tutorial_used 8 +#define num_gcl_tutorial_full 13 +#define num_gcl_movement 4 +#define num_gcl_camera 2 +#define num_gcl_movement_camera 6 +#define num_gcl_jump 1 +#define num_gcl_use 1 +#define num_gcl_jump_use 2 + +extern const INT32 gcl_tutorial_check[num_gcl_tutorial_check]; +extern const INT32 gcl_tutorial_used[num_gcl_tutorial_used]; +extern const INT32 gcl_tutorial_full[num_gcl_tutorial_full]; +extern const INT32 gcl_movement[num_gcl_movement]; +extern const INT32 gcl_camera[num_gcl_camera]; +extern const INT32 gcl_movement_camera[num_gcl_movement_camera]; +extern const INT32 gcl_jump[num_gcl_jump]; +extern const INT32 gcl_use[num_gcl_use]; +extern const INT32 gcl_jump_use[num_gcl_jump_use]; + // peace to my little coder fingers! // check a gamecontrol being active or not @@ -163,8 +168,10 @@ void G_ClearControlKeys(INT32 (*setupcontrols)[2], INT32 control); void G_ClearAllControlKeys(void); void Command_Setcontrol_f(void); void Command_Setcontrol2_f(void); -void G_Controldefault(void); -void G_SaveKeySetting(FILE *f); +void G_DefineDefaultControls(void); +INT32 G_GetControlScheme(INT32 (*fromcontrols)[2], const INT32 *gclist, INT32 gclen); +void G_CopyControls(INT32 (*setupcontrols)[2], INT32 (*fromcontrols)[2], const INT32 *gclist, INT32 gclen); +void G_SaveKeySetting(FILE *f, INT32 (*fromcontrols)[2], INT32 (*fromcontrolsbis)[2]); INT32 G_CheckDoubleUsage(INT32 keynum, boolean modify); #endif diff --git a/src/hardware/hw_bsp.c b/src/hardware/hw_bsp.c index 21fd85a33..483932492 100644 --- a/src/hardware/hw_bsp.c +++ b/src/hardware/hw_bsp.c @@ -29,6 +29,7 @@ #include "../m_argv.h" #include "../i_video.h" #include "../w_wad.h" +#include "../p_setup.h" // levelfadecol // -------------------------------------------------------------------------- // This is global data for planes rendering diff --git a/src/hardware/hw_cache.c b/src/hardware/hw_cache.c index d49531bdf..01782164d 100644 --- a/src/hardware/hw_cache.c +++ b/src/hardware/hw_cache.c @@ -41,50 +41,340 @@ static INT32 blocksize, blockwidth, blockheight; INT32 patchformat = GR_TEXFMT_AP_88; // use alpha for holes INT32 textureformat = GR_TEXFMT_P_8; // use chromakey for hole -// sprite, use alpha and chroma key for hole +static const INT32 format2bpp[16] = +{ + 0, //0 + 0, //1 + 1, //2 GR_TEXFMT_ALPHA_8 + 1, //3 GR_TEXFMT_INTENSITY_8 + 1, //4 GR_TEXFMT_ALPHA_INTENSITY_44 + 1, //5 GR_TEXFMT_P_8 + 4, //6 GR_RGBA + 0, //7 + 0, //8 + 0, //9 + 2, //10 GR_TEXFMT_RGB_565 + 2, //11 GR_TEXFMT_ARGB_1555 + 2, //12 GR_TEXFMT_ARGB_4444 + 2, //13 GR_TEXFMT_ALPHA_INTENSITY_88 + 2, //14 GR_TEXFMT_AP_88 +}; + + +// This code was originally placed directly in HWR_DrawPatchInCache. +// It is now split from it for my sanity! (and the sanity of others) +// -- Monster Iestyn (13/02/19) +static void HWR_DrawColumnInCache(const column_t *patchcol, UINT8 *block, GLMipmap_t *mipmap, + INT32 pblockheight, INT32 blockmodulo, + fixed_t yfracstep, fixed_t scale_y, + texpatch_t *originPatch, INT32 patchheight, + INT32 bpp) +{ + fixed_t yfrac, position, count; + UINT8 *dest; + const UINT8 *source; + INT32 topdelta, prevdelta = -1; + INT32 originy = 0; + + // for writing a pixel to dest + RGBA_t colortemp; + UINT8 alpha; + UINT8 texel; + UINT16 texelu16; + + (void)patchheight; // This parameter is unused + + if (originPatch) // originPatch can be NULL here, unlike in the software version + originy = originPatch->originy; + + while (patchcol->topdelta != 0xff) + { + topdelta = patchcol->topdelta; + if (topdelta <= prevdelta) + topdelta += prevdelta; + prevdelta = topdelta; + source = (const UINT8 *)patchcol + 3; + count = ((patchcol->length * scale_y) + (FRACUNIT/2)) >> FRACBITS; + position = originy + topdelta; + + yfrac = 0; + //yfracstep = (patchcol->length << FRACBITS) / count; + if (position < 0) + { + yfrac = -position<> FRACBITS); + position = 0; + } + + position = ((position * scale_y) + (FRACUNIT/2)) >> FRACBITS; + + if (position < 0) + position = 0; + + if (position + count >= pblockheight) + count = pblockheight - position; + + dest = block + (position*blockmodulo); + while (count > 0) + { + count--; + + texel = source[yfrac>>FRACBITS]; + + if (firetranslucent && (transtables[(texel<<8)+0x40000]!=texel)) + alpha = 0x80; + else + alpha = 0xff; + + //Hurdler: not perfect, but better than holes + if (texel == HWR_PATCHES_CHROMAKEY_COLORINDEX && (mipmap->flags & TF_CHROMAKEYED)) + texel = HWR_CHROMAKEY_EQUIVALENTCOLORINDEX; + //Hurdler: 25/04/2000: now support colormap in hardware mode + else if (mipmap->colormap) + texel = mipmap->colormap[texel]; + + // hope compiler will get this switch out of the loops (dreams...) + // gcc do it ! but vcc not ! (why don't use cygwin gcc for win32 ?) + // Alam: SRB2 uses Mingw, HUGS + switch (bpp) + { + case 2 : texelu16 = (UINT16)((alpha<<8) | texel); + memcpy(dest, &texelu16, sizeof(UINT16)); + break; + case 3 : colortemp = V_GetColor(texel); + memcpy(dest, &colortemp, sizeof(RGBA_t)-sizeof(UINT8)); + break; + case 4 : colortemp = V_GetColor(texel); + colortemp.s.alpha = alpha; + memcpy(dest, &colortemp, sizeof(RGBA_t)); + break; + // default is 1 + default: *dest = texel; + break; + } + + dest += blockmodulo; + yfrac += yfracstep; + } + patchcol = (const column_t *)((const UINT8 *)patchcol + patchcol->length + 4); + } +} + +static void HWR_DrawFlippedColumnInCache(const column_t *patchcol, UINT8 *block, GLMipmap_t *mipmap, + INT32 pblockheight, INT32 blockmodulo, + fixed_t yfracstep, fixed_t scale_y, + texpatch_t *originPatch, INT32 patchheight, + INT32 bpp) +{ + fixed_t yfrac, position, count; + UINT8 *dest; + const UINT8 *source; + INT32 topdelta, prevdelta = -1; + INT32 originy = 0; + + // for writing a pixel to dest + RGBA_t colortemp; + UINT8 alpha; + UINT8 texel; + UINT16 texelu16; + + if (originPatch) // originPatch can be NULL here, unlike in the software version + originy = originPatch->originy; + + while (patchcol->topdelta != 0xff) + { + topdelta = patchcol->topdelta; + if (topdelta <= prevdelta) + topdelta += prevdelta; + prevdelta = topdelta; + topdelta = patchheight-patchcol->length-topdelta; + source = (const UINT8 *)patchcol + 3; + count = ((patchcol->length * scale_y) + (FRACUNIT/2)) >> FRACBITS; + position = originy + topdelta; + + yfrac = (patchcol->length-1) << FRACBITS; + + if (position < 0) + { + yfrac += position<> FRACBITS); + position = 0; + } + + position = ((position * scale_y) + (FRACUNIT/2)) >> FRACBITS; + + if (position < 0) + position = 0; + + if (position + count >= pblockheight) + count = pblockheight - position; + + dest = block + (position*blockmodulo); + while (count > 0) + { + count--; + + texel = source[yfrac>>FRACBITS]; + + if (firetranslucent && (transtables[(texel<<8)+0x40000]!=texel)) + alpha = 0x80; + else + alpha = 0xff; + + //Hurdler: not perfect, but better than holes + if (texel == HWR_PATCHES_CHROMAKEY_COLORINDEX && (mipmap->flags & TF_CHROMAKEYED)) + texel = HWR_CHROMAKEY_EQUIVALENTCOLORINDEX; + //Hurdler: 25/04/2000: now support colormap in hardware mode + else if (mipmap->colormap) + texel = mipmap->colormap[texel]; + + // hope compiler will get this switch out of the loops (dreams...) + // gcc do it ! but vcc not ! (why don't use cygwin gcc for win32 ?) + // Alam: SRB2 uses Mingw, HUGS + switch (bpp) + { + case 2 : texelu16 = (UINT16)((alpha<<8) | texel); + memcpy(dest, &texelu16, sizeof(UINT16)); + break; + case 3 : colortemp = V_GetColor(texel); + memcpy(dest, &colortemp, sizeof(RGBA_t)-sizeof(UINT8)); + break; + case 4 : colortemp = V_GetColor(texel); + colortemp.s.alpha = alpha; + memcpy(dest, &colortemp, sizeof(RGBA_t)); + break; + // default is 1 + default: *dest = texel; + break; + } + + dest += blockmodulo; + yfrac -= yfracstep; + } + patchcol = (const column_t *)((const UINT8 *)patchcol + patchcol->length + 4); + } +} + + +// Simplified patch caching function +// for use by sprites and other patches that are not part of a wall texture +// no alpha or flipping should be present since we do not want non-texture graphics to have them +// no offsets are used either +// -- Monster Iestyn (13/02/19) static void HWR_DrawPatchInCache(GLMipmap_t *mipmap, - INT32 pblockwidth, INT32 pblockheight, INT32 blockmodulo, - INT32 ptexturewidth, INT32 ptextureheight, - INT32 originx, INT32 originy, // where to draw patch in surface block - const patch_t *realpatch, INT32 bpp) + INT32 pblockwidth, INT32 pblockheight, + INT32 pwidth, INT32 pheight, + const patch_t *realpatch) +{ + INT32 ncols; + fixed_t xfrac, xfracstep; + fixed_t yfracstep, scale_y; + const column_t *patchcol; + UINT8 *block = mipmap->grInfo.data; + INT32 bpp; + INT32 blockmodulo; + + if (pwidth <= 0 || pheight <= 0) + return; + + ncols = (pwidth * pblockwidth) / pwidth; + + // source advance + xfrac = 0; + xfracstep = (pwidth << FRACBITS) / pblockwidth; + yfracstep = (pheight << FRACBITS) / pblockheight; + scale_y = (pblockheight << FRACBITS) / pheight; + + bpp = format2bpp[mipmap->grInfo.format]; + + if (bpp < 1 || bpp > 4) + I_Error("HWR_DrawPatchInCache: no drawer defined for this bpp (%d)\n",bpp); + + // NOTE: should this actually be pblockwidth*bpp? + blockmodulo = blockwidth*bpp; + + // Draw each column to the block cache + for (; ncols--; block += bpp, xfrac += xfracstep) + { + patchcol = (const column_t *)((const UINT8 *)realpatch + LONG(realpatch->columnofs[xfrac>>FRACBITS])); + + HWR_DrawColumnInCache(patchcol, block, mipmap, + pblockheight, blockmodulo, + yfracstep, scale_y, + NULL, pheight, // not that pheight is going to get used anyway... + bpp); + } +} + +// This function we use for caching patches that belong to textures +static void HWR_DrawTexturePatchInCache(GLMipmap_t *mipmap, + INT32 pblockwidth, INT32 pblockheight, + texture_t *texture, texpatch_t *patch, + const patch_t *realpatch) { INT32 x, x1, x2; INT32 col, ncols; fixed_t xfrac, xfracstep; - fixed_t yfrac, yfracstep, position, count; - fixed_t scale_y; - RGBA_t colortemp; - UINT8 *dest; - const UINT8 *source; + fixed_t yfracstep, scale_y; const column_t *patchcol; - UINT8 alpha; UINT8 *block = mipmap->grInfo.data; - UINT8 texel; - UINT16 texelu16; + INT32 bpp; + INT32 blockmodulo; + INT32 width, height; + // Column drawing function pointer. + static void (*ColumnDrawerPointer)(const column_t *patchcol, UINT8 *block, GLMipmap_t *mipmap, + INT32 pblockheight, INT32 blockmodulo, + fixed_t yfracstep, fixed_t scale_y, + texpatch_t *originPatch, INT32 patchheight, + INT32 bpp); - x1 = originx; - x2 = x1 + SHORT(realpatch->width); + if (texture->width <= 0 || texture->height <= 0) + return; + /*if ((patch->style == AST_TRANSLUCENT) && (patch->alpha <= (10*255/11))) // Alpha style set to translucent? Is the alpha small enough for translucency? + { + if (patch->alpha < 255/11) // Is the patch way too translucent? Don't render then. + continue; + ColumnDrawerPointer = (patch->flip & 2) ? HWR_DrawTransFlippedColumnInCache : HWR_DrawTransColumnInCache; + } + else*/ + { + ColumnDrawerPointer = (patch->flip & 2) ? HWR_DrawFlippedColumnInCache : HWR_DrawColumnInCache; + } + + x1 = patch->originx; + width = SHORT(realpatch->width); + height = SHORT(realpatch->height); + x2 = x1 + width; + + if (x1 > texture->width || x2 < 0) + return; // patch not located within texture's x bounds, ignore + + if (patch->originy > texture->height || (patch->originy + height) < 0) + return; // patch not located within texture's y bounds, ignore + + // patch is actually inside the texture! + // now check if texture is partly off-screen and adjust accordingly + + // left edge if (x1 < 0) x = 0; else x = x1; - if (x2 > ptexturewidth) - x2 = ptexturewidth; + // right edge + if (x2 > texture->width) + x2 = texture->width; - if (!ptexturewidth) - return; - col = x * pblockwidth / ptexturewidth; - ncols = ((x2 - x) * pblockwidth) / ptexturewidth; + col = x * pblockwidth / texture->width; + ncols = ((x2 - x) * pblockwidth) / texture->width; /* - CONS_Debug(DBG_RENDER, "patch %dx%d texture %dx%d block %dx%d\n", SHORT(realpatch->width), - SHORT(realpatch->height), - ptexturewidth, - textureheight, - pblockwidth,pblockheight); + CONS_Debug(DBG_RENDER, "patch %dx%d texture %dx%d block %dx%d\n", + width, height, + texture->width, texture->height, + pblockwidth, pblockheight); CONS_Debug(DBG_RENDER, " col %d ncols %d x %d\n", col, ncols, x); */ @@ -93,90 +383,31 @@ static void HWR_DrawPatchInCache(GLMipmap_t *mipmap, if (x1 < 0) xfrac = -x1<width << FRACBITS) / pblockwidth; + yfracstep = (texture->height<< FRACBITS) / pblockheight; + scale_y = (pblockheight << FRACBITS) / texture->height; + + bpp = format2bpp[mipmap->grInfo.format]; + if (bpp < 1 || bpp > 4) I_Error("HWR_DrawPatchInCache: no drawer defined for this bpp (%d)\n",bpp); + // NOTE: should this actually be pblockwidth*bpp? + blockmodulo = blockwidth*bpp; + + // Draw each column to the block cache for (block += col*bpp; ncols--; block += bpp, xfrac += xfracstep) { - INT32 topdelta, prevdelta = -1; - patchcol = (const column_t *)((const UINT8 *)realpatch - + LONG(realpatch->columnofs[xfrac>>FRACBITS])); + if (patch->flip & 1) + patchcol = (const column_t *)((const UINT8 *)realpatch + LONG(realpatch->columnofs[(width-1)-(xfrac>>FRACBITS)])); + else + patchcol = (const column_t *)((const UINT8 *)realpatch + LONG(realpatch->columnofs[xfrac>>FRACBITS])); - scale_y = (pblockheight << FRACBITS) / ptextureheight; - - while (patchcol->topdelta != 0xff) - { - topdelta = patchcol->topdelta; - if (topdelta <= prevdelta) - topdelta += prevdelta; - prevdelta = topdelta; - source = (const UINT8 *)patchcol + 3; - count = ((patchcol->length * scale_y) + (FRACUNIT/2)) >> FRACBITS; - position = originy + topdelta; - - yfrac = 0; - //yfracstep = (patchcol->length << FRACBITS) / count; - if (position < 0) - { - yfrac = -position<> FRACBITS); - position = 0; - } - - position = ((position * scale_y) + (FRACUNIT/2)) >> FRACBITS; - - if (position < 0) - position = 0; - - if (position + count >= pblockheight) - count = pblockheight - position; - - dest = block + (position*blockmodulo); - while (count > 0) - { - count--; - - texel = source[yfrac>>FRACBITS]; - - if (firetranslucent && (transtables[(texel<<8)+0x40000]!=texel)) - alpha = 0x80; - else - alpha = 0xff; - - //Hurdler: not perfect, but better than holes - if (texel == HWR_PATCHES_CHROMAKEY_COLORINDEX && (mipmap->flags & TF_CHROMAKEYED)) - texel = HWR_CHROMAKEY_EQUIVALENTCOLORINDEX; - //Hurdler: 25/04/2000: now support colormap in hardware mode - else if (mipmap->colormap) - texel = mipmap->colormap[texel]; - - // hope compiler will get this switch out of the loops (dreams...) - // gcc do it ! but vcc not ! (why don't use cygwin gcc for win32 ?) - // Alam: SRB2 uses Mingw, HUGS - switch (bpp) - { - case 2 : texelu16 = (UINT16)((alpha<<8) | texel); - memcpy(dest, &texelu16, sizeof(UINT16)); - break; - case 3 : colortemp = V_GetColor(texel); - memcpy(dest, &colortemp, sizeof(RGBA_t)-sizeof(UINT8)); - break; - case 4 : colortemp = V_GetColor(texel); - colortemp.s.alpha = alpha; - memcpy(dest, &colortemp, sizeof(RGBA_t)); - break; - // default is 1 - default: *dest = texel; - break; - } - - dest += blockmodulo; - yfrac += yfracstep; - } - patchcol = (const column_t *)((const UINT8 *)patchcol + patchcol->length + 4); - } + ColumnDrawerPointer(patchcol, block, mipmap, + pblockheight, blockmodulo, + yfracstep, scale_y, + patch, height, + bpp); } } @@ -300,26 +531,6 @@ static void HWR_ResizeBlock(INT32 originalwidth, INT32 originalheight, //CONS_Debug(DBG_RENDER, "Width is %d, Height is %d\n", blockwidth, blockheight); } - -static const INT32 format2bpp[16] = -{ - 0, //0 - 0, //1 - 1, //2 GR_TEXFMT_ALPHA_8 - 1, //3 GR_TEXFMT_INTENSITY_8 - 1, //4 GR_TEXFMT_ALPHA_INTENSITY_44 - 1, //5 GR_TEXFMT_P_8 - 4, //6 GR_RGBA - 0, //7 - 0, //8 - 0, //9 - 2, //10 GR_TEXFMT_RGB_565 - 2, //11 GR_TEXFMT_ARGB_1555 - 2, //12 GR_TEXFMT_ARGB_4444 - 2, //13 GR_TEXFMT_ALPHA_INTENSITY_88 - 2, //14 GR_TEXFMT_AP_88 -}; - static UINT8 *MakeBlock(GLMipmap_t *grMipmap) { UINT8 *block; @@ -403,13 +614,10 @@ static void HWR_GenerateTexture(INT32 texnum, GLTexture_t *grtex) for (i = 0, patch = texture->patches; i < texture->patchcount; i++, patch++) { realpatch = W_CacheLumpNumPwad(patch->wad, patch->lump, PU_CACHE); - HWR_DrawPatchInCache(&grtex->mipmap, + HWR_DrawTexturePatchInCache(&grtex->mipmap, blockwidth, blockheight, - blockwidth*format2bpp[grtex->mipmap.grInfo.format], - texture->width, texture->height, - patch->originx, patch->originy, - realpatch, - format2bpp[grtex->mipmap.grInfo.format]); + texture, patch, + realpatch); Z_Unlock(realpatch); } //Hurdler: not efficient at all but I don't remember exactly how HWR_DrawPatchInCache works :( @@ -484,11 +692,8 @@ void HWR_MakePatch (const patch_t *patch, GLPatch_t *grPatch, GLMipmap_t *grMipm HWR_DrawPatchInCache(grMipmap, newwidth, newheight, - blockwidth*format2bpp[grMipmap->grInfo.format], grPatch->width, grPatch->height, - 0, 0, - patch, - format2bpp[grMipmap->grInfo.format]); + patch); } grPatch->max_s = (float)newwidth / (float)blockwidth; @@ -532,8 +737,8 @@ void HWR_FreeTextureCache(void) // free all hardware-converted graphics cached in the heap // our gool is only the textures since user of the texture is the texture cache - Z_FreeTags(PU_HWRCACHE, PU_HWRCACHE); - Z_FreeTags(PU_HWRCACHE_UNLOCKED, PU_HWRCACHE_UNLOCKED); + Z_FreeTag(PU_HWRCACHE); + Z_FreeTag(PU_HWRCACHE_UNLOCKED); // Alam: free the Z_Blocks before freeing it's users @@ -580,8 +785,8 @@ void HWR_SetPalette(RGBA_t *palette) // now flush data texture cache so 32 bit texture are recomputed if (patchformat == GR_RGBA || textureformat == GR_RGBA) { - Z_FreeTags(PU_HWRCACHE, PU_HWRCACHE); - Z_FreeTags(PU_HWRCACHE_UNLOCKED, PU_HWRCACHE_UNLOCKED); + Z_FreeTag(PU_HWRCACHE); + Z_FreeTag(PU_HWRCACHE_UNLOCKED); } } diff --git a/src/hardware/hw_data.h b/src/hardware/hw_data.h index 4bbc578ed..44929dd67 100644 --- a/src/hardware/hw_data.h +++ b/src/hardware/hw_data.h @@ -20,7 +20,7 @@ #ifndef _HWR_DATA_ #define _HWR_DATA_ -#if defined (_WIN32) && !defined (__CYGWIN__) && !defined (_XBOX) +#if defined (_WIN32) && !defined (__CYGWIN__) //#define WIN32_LEAN_AND_MEAN #define RPC_NO_WINDOWS_H #include diff --git a/src/hardware/hw_defs.h b/src/hardware/hw_defs.h index df0f39ece..83d601b87 100644 --- a/src/hardware/hw_defs.h +++ b/src/hardware/hw_defs.h @@ -41,14 +41,8 @@ typedef unsigned char FBOOLEAN; // ========================================================================== // byte value for paletted graphics, which represent the transparent color -#ifdef _NDS -// NDS is hardwired to use zero as transparent color -#define HWR_PATCHES_CHROMAKEY_COLORINDEX 0 -#define HWR_CHROMAKEY_EQUIVALENTCOLORINDEX 1 -#else -#define HWR_PATCHES_CHROMAKEY_COLORINDEX 247 -#define HWR_CHROMAKEY_EQUIVALENTCOLORINDEX 220 -#endif +#define HWR_PATCHES_CHROMAKEY_COLORINDEX 255 +#define HWR_CHROMAKEY_EQUIVALENTCOLORINDEX 130 // the chroma key color shows on border sprites, set it to black #define HWR_PATCHES_CHROMAKEY_COLORVALUE (0x00000000) //RGBA format as in grSstWinOpen() diff --git a/src/hardware/hw_dll.h b/src/hardware/hw_dll.h index 6b9f4d538..452e9037c 100644 --- a/src/hardware/hw_dll.h +++ b/src/hardware/hw_dll.h @@ -40,14 +40,14 @@ #define EXPORT #endif #endif - #if defined (_WIN32) && !defined (_XBOX) + #ifdef _WIN32 #define HWRAPI(fn) WINAPI fn #else #define HWRAPI(fn) fn #endif #else // _CREATE_DLL_ #define EXPORT typedef - #if defined (_WIN32) && !defined (_XBOX) + #ifdef _WIN32 #define HWRAPI(fn) (WINAPI *fn) #else #define HWRAPI(fn) (*fn) diff --git a/src/hardware/hw_draw.c b/src/hardware/hw_draw.c index cd2c95237..dd9fa8423 100644 --- a/src/hardware/hw_draw.c +++ b/src/hardware/hw_draw.c @@ -33,6 +33,8 @@ #include "../z_zone.h" #include "../v_video.h" #include "../st_stuff.h" +#include "../p_local.h" // stplyr +#include "../g_game.h" // players #include #include "../i_video.h" // for rendermode != render_glide @@ -147,7 +149,9 @@ void HWR_DrawFixedPatch(GLPatch_t *gpatch, fixed_t x, fixed_t y, fixed_t pscale, // | /| // |/ | // 0--1 - float dupx, dupy, fscale, fwidth, fheight; + float dupx, dupy, fscalew, fscaleh, fwidth, fheight; + + UINT8 perplayershuffle = 0; if (alphalevel >= 10 && alphalevel < 13) return; @@ -177,7 +181,7 @@ void HWR_DrawFixedPatch(GLPatch_t *gpatch, fixed_t x, fixed_t y, fixed_t pscale, } dupx = dupy = (dupx < dupy ? dupx : dupy); - fscale = FIXED_TO_FLOAT(pscale); + fscalew = fscaleh = FIXED_TO_FLOAT(pscale); // See my comments in v_video.c's V_DrawFixedPatch // -- Monster Iestyn 29/10/18 @@ -186,13 +190,13 @@ void HWR_DrawFixedPatch(GLPatch_t *gpatch, fixed_t x, fixed_t y, fixed_t pscale, // left offset if (option & V_FLIP) - offsetx = (float)(SHORT(gpatch->width) - SHORT(gpatch->leftoffset)) * fscale; + offsetx = (float)(SHORT(gpatch->width) - SHORT(gpatch->leftoffset)) * fscalew; else - offsetx = (float)SHORT(gpatch->leftoffset) * fscale; + offsetx = (float)SHORT(gpatch->leftoffset) * fscalew; // top offset // TODO: make some kind of vertical version of V_FLIP, maybe by deprecating V_OFFSET in future?!? - offsety = (float)SHORT(gpatch->topoffset) * fscale; + offsety = (float)SHORT(gpatch->topoffset) * fscaleh; if ((option & (V_NOSCALESTART|V_OFFSET)) == (V_NOSCALESTART|V_OFFSET)) // Multiply by dupx/dupy for crosshairs { @@ -204,8 +208,73 @@ void HWR_DrawFixedPatch(GLPatch_t *gpatch, fixed_t x, fixed_t y, fixed_t pscale, cy -= offsety; } - if (option & V_SPLITSCREEN) + if (splitscreen && (option & V_PERPLAYER)) + { + float adjusty = ((option & V_NOSCALESTART) ? vid.height : BASEVIDHEIGHT)/2.0f; + fscaleh /= 2; cy /= 2; +#ifdef QUADS + if (splitscreen > 1) // 3 or 4 players + { + float adjustx = ((option & V_NOSCALESTART) ? vid.width : BASEVIDWIDTH)/2.0f; + fscalew /= 2; + cx /= 2; + if (stplyr == &players[displayplayer]) + { + if (!(option & (V_SNAPTOTOP|V_SNAPTOBOTTOM))) + perplayershuffle |= 1; + if (!(option & (V_SNAPTOLEFT|V_SNAPTORIGHT))) + perplayershuffle |= 4; + option &= ~V_SNAPTOBOTTOM|V_SNAPTORIGHT; + } + else if (stplyr == &players[secondarydisplayplayer]) + { + if (!(option & (V_SNAPTOTOP|V_SNAPTOBOTTOM))) + perplayershuffle |= 1; + if (!(option & (V_SNAPTOLEFT|V_SNAPTORIGHT))) + perplayershuffle |= 8; + cx += adjustx; + option &= ~V_SNAPTOBOTTOM|V_SNAPTOLEFT; + } + else if (stplyr == &players[thirddisplayplayer]) + { + if (!(option & (V_SNAPTOTOP|V_SNAPTOBOTTOM))) + perplayershuffle |= 2; + if (!(option & (V_SNAPTOLEFT|V_SNAPTORIGHT))) + perplayershuffle |= 4; + cy += adjusty; + option &= ~V_SNAPTOTOP|V_SNAPTORIGHT; + } + else if (stplyr == &players[fourthdisplayplayer]) + { + if (!(option & (V_SNAPTOTOP|V_SNAPTOBOTTOM))) + perplayershuffle |= 2; + if (!(option & (V_SNAPTOLEFT|V_SNAPTORIGHT))) + perplayershuffle |= 8; + cx += adjustx; + cy += adjusty; + option &= ~V_SNAPTOTOP|V_SNAPTOLEFT; + } + } + else +#endif + // 2 players + { + if (stplyr == &players[displayplayer]) + { + if (!(option & (V_SNAPTOTOP|V_SNAPTOBOTTOM))) + perplayershuffle = 1; + option &= ~V_SNAPTOBOTTOM; + } + else //if (stplyr == &players[secondarydisplayplayer]) + { + if (!(option & (V_SNAPTOTOP|V_SNAPTOBOTTOM))) + perplayershuffle = 2; + cy += adjusty; + option &= ~V_SNAPTOTOP; + } + } + } if (!(option & V_NOSCALESTART)) { @@ -233,23 +302,29 @@ void HWR_DrawFixedPatch(GLPatch_t *gpatch, fixed_t x, fixed_t y, fixed_t pscale, cx += ((float)vid.width - ((float)BASEVIDWIDTH * dupx)); else if (!(option & V_SNAPTOLEFT)) cx += ((float)vid.width - ((float)BASEVIDWIDTH * dupx))/2; + if (perplayershuffle & 4) + cx -= ((float)vid.width - ((float)BASEVIDWIDTH * dupx))/4; + else if (perplayershuffle & 8) + cx += ((float)vid.width - ((float)BASEVIDWIDTH * dupx))/4; } if (fabsf((float)vid.height - (float)BASEVIDHEIGHT * dupy) > 1.0E-36f) { - if ((option & (V_SPLITSCREEN|V_SNAPTOBOTTOM)) == (V_SPLITSCREEN|V_SNAPTOBOTTOM)) - cy += ((float)vid.height/2 - ((float)BASEVIDHEIGHT/2 * dupy)); - else if (option & V_SNAPTOBOTTOM) + if (option & V_SNAPTOBOTTOM) cy += ((float)vid.height - ((float)BASEVIDHEIGHT * dupy)); else if (!(option & V_SNAPTOTOP)) cy += ((float)vid.height - ((float)BASEVIDHEIGHT * dupy))/2; + if (perplayershuffle & 1) + cy -= ((float)vid.height - ((float)BASEVIDHEIGHT * dupy))/4; + else if (perplayershuffle & 2) + cy += ((float)vid.height - ((float)BASEVIDHEIGHT * dupy))/4; } } } - if (pscale != FRACUNIT) + if (pscale != FRACUNIT || (splitscreen && option & V_PERPLAYER)) { - fwidth = (float)SHORT(gpatch->width) * fscale * dupx; - fheight = (float)SHORT(gpatch->height) * fscale * dupy; + fwidth = (float)SHORT(gpatch->width) * fscalew * dupx; + fheight = (float)SHORT(gpatch->height) * fscaleh * dupy; } else { @@ -352,6 +427,8 @@ void HWR_DrawCroppedPatch(GLPatch_t *gpatch, fixed_t x, fixed_t y, fixed_t pscal dupx = dupy = (dupx < dupy ? dupx : dupy); fscale = FIXED_TO_FLOAT(pscale); + // fuck it, no GL support for croppedpatch v_perplayer right now. it's not like it's accessible to Lua or anything, and we only use it for menus... + cy -= (float)SHORT(gpatch->topoffset) * fscale; cx -= (float)SHORT(gpatch->leftoffset) * fscale; @@ -384,9 +461,7 @@ void HWR_DrawCroppedPatch(GLPatch_t *gpatch, fixed_t x, fixed_t y, fixed_t pscal } if (fabsf((float)vid.height - (float)BASEVIDHEIGHT * dupy) > 1.0E-36f) { - if ((option & (V_SPLITSCREEN|V_SNAPTOBOTTOM)) == (V_SPLITSCREEN|V_SNAPTOBOTTOM)) - cy += ((float)vid.height/2 - ((float)BASEVIDHEIGHT/2 * dupy)); - else if (option & V_SNAPTOBOTTOM) + if (option & V_SNAPTOBOTTOM) cy += ((float)vid.height - ((float)BASEVIDHEIGHT * dupy)); else if (!(option & V_SNAPTOTOP)) cy += ((float)vid.height - ((float)BASEVIDHEIGHT * dupy))/2; @@ -397,12 +472,6 @@ void HWR_DrawCroppedPatch(GLPatch_t *gpatch, fixed_t x, fixed_t y, fixed_t pscal fwidth = w; fheight = h; - if (fwidth > w - sx) - fwidth = w - sx; - - if (fheight > h - sy) - fheight = h - sy; - if (fwidth > SHORT(gpatch->width)) fwidth = SHORT(gpatch->width); @@ -437,10 +506,17 @@ void HWR_DrawCroppedPatch(GLPatch_t *gpatch, fixed_t x, fixed_t y, fixed_t pscal v[0].z = v[1].z = v[2].z = v[3].z = 1.0f; - v[0].sow = v[3].sow = ((sx)/(float)SHORT(gpatch->width) )*gpatch->max_s; - v[2].sow = v[1].sow = ((w )/(float)SHORT(gpatch->width) )*gpatch->max_s; - v[0].tow = v[1].tow = ((sy)/(float)SHORT(gpatch->height))*gpatch->max_t; - v[2].tow = v[3].tow = ((h )/(float)SHORT(gpatch->height))*gpatch->max_t; + v[0].sow = v[3].sow = ((sx )/(float)SHORT(gpatch->width) )*gpatch->max_s; + if (sx + w > SHORT(gpatch->width)) + v[2].sow = v[1].sow = gpatch->max_s; + else + v[2].sow = v[1].sow = ((sx+w)/(float)SHORT(gpatch->width) )*gpatch->max_s; + + v[0].tow = v[1].tow = ((sy )/(float)SHORT(gpatch->height))*gpatch->max_t; + if (sy + h > SHORT(gpatch->height)) + v[2].tow = v[3].tow = gpatch->max_t; + else + v[2].tow = v[3].tow = ((sy+h)/(float)SHORT(gpatch->height))*gpatch->max_t; flags = BLENDMODE|PF_Clip|PF_NoZClip|PF_NoDepthTest; @@ -584,18 +660,14 @@ void HWR_DrawFlatFill (INT32 x, INT32 y, INT32 w, INT32 h, lumpnum_t flatlumpnum // | /| // |/ | // 0--1 -void HWR_FadeScreenMenuBack(UINT32 color, INT32 height) +void HWR_FadeScreenMenuBack(UINT16 color, UINT8 strength) { FOutVector v[4]; FSurfaceInfo Surf; - // setup some neat-o translucency effect - if (!height) //cool hack 0 height is full height - height = vid.height; - v[0].x = v[3].x = -1.0f; v[2].x = v[1].x = 1.0f; - v[0].y = v[1].y = 1.0f-((height<<1)/(float)vid.height); + v[0].y = v[1].y = -1.0f; v[2].y = v[3].y = 1.0f; v[0].z = v[1].z = v[2].z = v[3].z = 1.0f; @@ -604,8 +676,16 @@ void HWR_FadeScreenMenuBack(UINT32 color, INT32 height) v[0].tow = v[1].tow = 1.0f; v[2].tow = v[3].tow = 0.0f; - Surf.FlatColor.rgba = UINT2RGBA(color); - Surf.FlatColor.s.alpha = (UINT8)((0xff/2) * ((float)height / vid.height)); //calum: varies console alpha + if (color & 0xFF00) // Do COLORMAP fade. + { + Surf.FlatColor.rgba = UINT2RGBA(0x01010160); + Surf.FlatColor.s.alpha = (strength*8); + } + else // Do TRANSMAP** fade. + { + Surf.FlatColor.rgba = pLocalPalette[color].rgba; + Surf.FlatColor.s.alpha = (UINT8)(strength*25.5f); + } HWD.pfnDrawPolygon(&Surf, v, 4, PF_NoTexture|PF_Modulated|PF_Translucent|PF_NoDepthTest); } @@ -636,6 +716,32 @@ void HWR_DrawConsoleBack(UINT32 color, INT32 height) HWD.pfnDrawPolygon(&Surf, v, 4, PF_NoTexture|PF_Modulated|PF_Translucent|PF_NoDepthTest); } +// Very similar to HWR_DrawConsoleBack, except we draw from the middle(-ish) of the screen to the bottom. +void HWR_DrawTutorialBack(UINT32 color, INT32 boxheight) +{ + FOutVector v[4]; + FSurfaceInfo Surf; + INT32 height = (boxheight * 4) + (boxheight/2)*5; // 4 lines of space plus gaps between and some leeway + + // setup some neat-o translucency effect + + v[0].x = v[3].x = -1.0f; + v[2].x = v[1].x = 1.0f; + v[0].y = v[1].y = -1.0f; + v[2].y = v[3].y = -1.0f+((height<<1)/(float)vid.height); + v[0].z = v[1].z = v[2].z = v[3].z = 1.0f; + + v[0].sow = v[3].sow = 0.0f; + v[2].sow = v[1].sow = 1.0f; + v[0].tow = v[1].tow = 1.0f; + v[2].tow = v[3].tow = 0.0f; + + Surf.FlatColor.rgba = UINT2RGBA(color); + Surf.FlatColor.s.alpha = (color == 0 ? 0xC0 : 0x80); // make black darker, like software + + HWD.pfnDrawPolygon(&Surf, v, 4, PF_NoTexture|PF_Modulated|PF_Translucent|PF_NoDepthTest); +} + // ========================================================================== // R_DRAW.C STUFF @@ -904,6 +1010,8 @@ void HWR_DrawFill(INT32 x, INT32 y, INT32 w, INT32 h, INT32 color) FSurfaceInfo Surf; float fx, fy, fw, fh; + UINT8 perplayershuffle = 0; + if (w < 0 || h < 0) return; // consistency w/ software @@ -912,6 +1020,74 @@ void HWR_DrawFill(INT32 x, INT32 y, INT32 w, INT32 h, INT32 color) // |/ | // 0--1 + if (splitscreen && (color & V_PERPLAYER)) + { + fixed_t adjusty = ((color & V_NOSCALESTART) ? vid.height : BASEVIDHEIGHT)/2.0f; + h >>= 1; + y >>= 1; +#ifdef QUADS + if (splitscreen > 1) // 3 or 4 players + { + fixed_t adjustx = ((color & V_NOSCALESTART) ? vid.height : BASEVIDHEIGHT)/2.0f; + w >>= 1; + x >>= 1; + if (stplyr == &players[displayplayer]) + { + if (!(color & (V_SNAPTOTOP|V_SNAPTOBOTTOM))) + perplayershuffle |= 1; + if (!(color & (V_SNAPTOLEFT|V_SNAPTORIGHT))) + perplayershuffle |= 4; + color &= ~V_SNAPTOBOTTOM|V_SNAPTORIGHT; + } + else if (stplyr == &players[secondarydisplayplayer]) + { + if (!(color & (V_SNAPTOTOP|V_SNAPTOBOTTOM))) + perplayershuffle |= 1; + if (!(color & (V_SNAPTOLEFT|V_SNAPTORIGHT))) + perplayershuffle |= 8; + x += adjustx; + color &= ~V_SNAPTOBOTTOM|V_SNAPTOLEFT; + } + else if (stplyr == &players[thirddisplayplayer]) + { + if (!(color & (V_SNAPTOTOP|V_SNAPTOBOTTOM))) + perplayershuffle |= 2; + if (!(color & (V_SNAPTOLEFT|V_SNAPTORIGHT))) + perplayershuffle |= 4; + y += adjusty; + color &= ~V_SNAPTOTOP|V_SNAPTORIGHT; + } + else //if (stplyr == &players[fourthdisplayplayer]) + { + if (!(color & (V_SNAPTOTOP|V_SNAPTOBOTTOM))) + perplayershuffle |= 2; + if (!(color & (V_SNAPTOLEFT|V_SNAPTORIGHT))) + perplayershuffle |= 8; + x += adjustx; + y += adjusty; + color &= ~V_SNAPTOTOP|V_SNAPTOLEFT; + } + } + else +#endif + // 2 players + { + if (stplyr == &players[displayplayer]) + { + if (!(color & (V_SNAPTOTOP|V_SNAPTOBOTTOM))) + perplayershuffle |= 1; + color &= ~V_SNAPTOBOTTOM; + } + else //if (stplyr == &players[secondarydisplayplayer]) + { + if (!(color & (V_SNAPTOTOP|V_SNAPTOBOTTOM))) + perplayershuffle |= 2; + y += adjusty; + color &= ~V_SNAPTOTOP; + } + } + } + fx = (float)x; fy = (float)y; fw = (float)w; @@ -944,6 +1120,10 @@ void HWR_DrawFill(INT32 x, INT32 y, INT32 w, INT32 h, INT32 color) fx += ((float)vid.width - ((float)BASEVIDWIDTH * dupx)); else if (!(color & V_SNAPTOLEFT)) fx += ((float)vid.width - ((float)BASEVIDWIDTH * dupx)) / 2; + if (perplayershuffle & 4) + fx -= ((float)vid.width - ((float)BASEVIDWIDTH * dupx)) / 4; + else if (perplayershuffle & 8) + fx += ((float)vid.width - ((float)BASEVIDWIDTH * dupx)) / 4; } if (fabsf((float)vid.height - (float)BASEVIDHEIGHT * dupy) > 1.0E-36f) { @@ -952,6 +1132,10 @@ void HWR_DrawFill(INT32 x, INT32 y, INT32 w, INT32 h, INT32 color) fy += ((float)vid.height - ((float)BASEVIDHEIGHT * dupy)); else if (!(color & V_SNAPTOTOP)) fy += ((float)vid.height - ((float)BASEVIDHEIGHT * dupy)) / 2; + if (perplayershuffle & 1) + fy -= ((float)vid.height - ((float)BASEVIDHEIGHT * dupy)) / 4; + else if (perplayershuffle & 2) + fy += ((float)vid.height - ((float)BASEVIDHEIGHT * dupy)) / 4; } } diff --git a/src/hardware/hw_glob.h b/src/hardware/hw_glob.h index bdf219464..9656e54e9 100644 --- a/src/hardware/hw_glob.h +++ b/src/hardware/hw_glob.h @@ -71,7 +71,6 @@ typedef struct gr_vissprite_s struct gr_vissprite_s *prev; struct gr_vissprite_s *next; float x1, x2; - float z1, z2; float tz, ty; lumpnum_t patchlumpnum; boolean flip; @@ -82,6 +81,7 @@ typedef struct gr_vissprite_s //Hurdler: 25/04/2000: now support colormap in hardware mode UINT8 *colormap; INT32 dispoffset; // copy of info->dispoffset, affects ordering but not drawing + float z1, z2; } gr_vissprite_t; // -------- diff --git a/src/hardware/hw_light.c b/src/hardware/hw_light.c index a93e96dc3..8baa547af 100644 --- a/src/hardware/hw_light.c +++ b/src/hardware/hw_light.c @@ -62,7 +62,7 @@ static dynlights_t *dynlights = &view_dynlights[0]; light_t lspr[NUMLIGHTS] = { // type offset x, y coronas color, c_size,light color,l_radius, sqr radius computed at init - // UNDEFINED: 0 + // NOLIGHT: 0 { UNDEFINED_SPR, 0.0f, 0.0f, 0x00000000, 24.0f, 0x00000000, 0.0f, 0.0f}, // weapons // RINGSPARK_L @@ -151,10 +151,9 @@ light_t *t_lspr[NUMSPRITES] = &lspr[NOLIGHT], // SPR_POSS &lspr[NOLIGHT], // SPR_SPOS &lspr[NOLIGHT], // SPR_FISH - &lspr[NOLIGHT], // SPR_BUZZ Graue 03-10-2004 - &lspr[NOLIGHT], // SPR_RBUZ Graue 03-10-2004 + &lspr[NOLIGHT], // SPR_BUZZ + &lspr[NOLIGHT], // SPR_RBUZ &lspr[NOLIGHT], // SPR_JETB - &lspr[NOLIGHT], // SPR_JETW &lspr[NOLIGHT], // SPR_JETG &lspr[NOLIGHT], // SPR_CCOM &lspr[NOLIGHT], // SPR_DETN @@ -162,19 +161,25 @@ light_t *t_lspr[NUMSPRITES] = &lspr[NOLIGHT], // SPR_TRET &lspr[NOLIGHT], // SPR_TURR &lspr[NOLIGHT], // SPR_SHRP + &lspr[NOLIGHT], // SPR_CRAB &lspr[NOLIGHT], // SPR_JJAW &lspr[NOLIGHT], // SPR_SNLR &lspr[NOLIGHT], // SPR_VLTR &lspr[NOLIGHT], // SPR_PNTY &lspr[NOLIGHT], // SPR_ARCH &lspr[NOLIGHT], // SPR_CBFS + &lspr[JETLIGHT_L], // SPR_STAB &lspr[NOLIGHT], // SPR_SPSH &lspr[NOLIGHT], // SPR_ESHI &lspr[NOLIGHT], // SPR_GSNP + &lspr[NOLIGHT], // SPR_GSNL + &lspr[NOLIGHT], // SPR_GSNH &lspr[NOLIGHT], // SPR_MNUS + &lspr[NOLIGHT], // SPR_MNUD &lspr[NOLIGHT], // SPR_SSHL &lspr[NOLIGHT], // SPR_UNID - &lspr[NOLIGHT], // SPR_BBUZ + &lspr[NOLIGHT], // SPR_CANA + &lspr[NOLIGHT], // SPR_CANG // Generic Boos Items &lspr[JETLIGHT_L], // SPR_JETF // Boss jet fumes @@ -199,7 +204,11 @@ light_t *t_lspr[NUMSPRITES] = &lspr[REDBALL_L], // SPR_EFIR // Boss 5 (Arid Canyon) - &lspr[NOLIGHT], // SPR_EGGQ + &lspr[NOLIGHT], //SPR_FANG // replaces EGGQ + &lspr[NOLIGHT], //SPR_FBOM + &lspr[NOLIGHT], //SPR_FSGN + &lspr[REDBALL_L], //SPR_BARX // bomb explosion (also used by barrel) + &lspr[NOLIGHT], //SPR_BARD // bomb dust (also used by barrel) // Boss 6 (Red Volcano) &lspr[NOLIGHT], // SPR_EEGR @@ -226,48 +235,55 @@ light_t *t_lspr[NUMSPRITES] = // Collectible Items &lspr[NOLIGHT], // SPR_RING &lspr[NOLIGHT], // SPR_TRNG - &lspr[NOLIGHT], // SPR_EMMY - &lspr[BLUEBALL_L], // SPR_TOKE - &lspr[REDBALL_L], // SPR_RFLG - &lspr[BLUEBALL_L], // SPR_BFLG - &lspr[NOLIGHT], // SPR_NWNG + &lspr[NOLIGHT], // SPR_TOKE + &lspr[REDBALL_L], // SPR_RFLG + &lspr[BLUEBALL_L], // SPR_BFLG + &lspr[NOLIGHT], // SPR_SPHR + &lspr[NOLIGHT], // SPR_NCHP + &lspr[NOLIGHT], // SPR_NSTR &lspr[NOLIGHT], // SPR_EMBM &lspr[NOLIGHT], // SPR_CEMG - &lspr[NOLIGHT], // SPR_EMER + &lspr[NOLIGHT], // SPR_SHRD // Interactive Objects - &lspr[NOLIGHT], // SPR_FANS - &lspr[NOLIGHT], // SPR_BUBL + &lspr[NOLIGHT], // SPR_BBLS &lspr[NOLIGHT], // SPR_SIGN - &lspr[NOLIGHT], // SPR_STEM &lspr[NOLIGHT], // SPR_SPIK &lspr[NOLIGHT], // SPR_SFLM &lspr[NOLIGHT], // SPR_USPK + &lspr[NOLIGHT], // SPR_WSPK + &lspr[NOLIGHT], // SPR_WSPB &lspr[NOLIGHT], // SPR_STPT &lspr[NOLIGHT], // SPR_BMNE // Monitor Boxes - &lspr[NOLIGHT], // SPR_SRBX - &lspr[NOLIGHT], // SPR_RRBX - &lspr[NOLIGHT], // SPR_BRBX - &lspr[NOLIGHT], // SPR_SHTV - &lspr[NOLIGHT], // SPR_PINV - &lspr[NOLIGHT], // SPR_YLTV - &lspr[NOLIGHT], // SPR_BLTV - &lspr[NOLIGHT], // SPR_BKTV - &lspr[NOLIGHT], // SPR_WHTV - &lspr[NOLIGHT], // SPR_GRTV - &lspr[NOLIGHT], // SPR_ELTV - &lspr[NOLIGHT], // SPR_EGGB - &lspr[NOLIGHT], // SPR_MIXU - &lspr[NOLIGHT], // SPR_RECY - &lspr[NOLIGHT], // SPR_QUES - &lspr[NOLIGHT], // SPR_GBTV - &lspr[NOLIGHT], // SPR_PRUP - &lspr[NOLIGHT], // SPR_PTTV + &lspr[NOLIGHT], // SPR_MSTV + &lspr[NOLIGHT], // SPR_XLTV - // Monitor Miscellany - &lspr[NOLIGHT], // SPR_MTEX + &lspr[NOLIGHT], // SPR_TRRI + &lspr[NOLIGHT], // SPR_TBRI + + &lspr[NOLIGHT], // SPR_TVRI + &lspr[NOLIGHT], // SPR_TVPI + &lspr[NOLIGHT], // SPR_TVAT + &lspr[NOLIGHT], // SPR_TVFO + &lspr[NOLIGHT], // SPR_TVAR + &lspr[NOLIGHT], // SPR_TVWW + &lspr[NOLIGHT], // SPR_TVEL + &lspr[NOLIGHT], // SPR_TVSS + &lspr[NOLIGHT], // SPR_TVIV + &lspr[NOLIGHT], // SPR_TV1U + &lspr[NOLIGHT], // SPR_TV1P + &lspr[NOLIGHT], // SPR_TVEG + &lspr[NOLIGHT], // SPR_TVMX + &lspr[NOLIGHT], // SPR_TVMY + &lspr[NOLIGHT], // SPR_TVGV + &lspr[NOLIGHT], // SPR_TVRC + &lspr[NOLIGHT], // SPR_TV1K + &lspr[NOLIGHT], // SPR_TVTK + &lspr[NOLIGHT], // SPR_TVFL + &lspr[NOLIGHT], // SPR_TVBB + &lspr[NOLIGHT], // SPR_TVZP // Projectiles &lspr[NOLIGHT], // SPR_MISL @@ -287,10 +303,19 @@ light_t *t_lspr[NUMSPRITES] = &lspr[NOLIGHT], // SPR_FWR4 &lspr[NOLIGHT], // SPR_BUS1 &lspr[NOLIGHT], // SPR_BUS2 + &lspr[NOLIGHT], // SPR_BUS3 + // Trees (both GFZ and misc) + &lspr[NOLIGHT], // SPR_TRE1 + &lspr[NOLIGHT], // SPR_TRE2 + &lspr[NOLIGHT], // SPR_TRE3 + &lspr[NOLIGHT], // SPR_TRE4 + &lspr[NOLIGHT], // SPR_TRE5 + &lspr[NOLIGHT], // SPR_TRE6 // Techno Hill Scenery &lspr[NOLIGHT], // SPR_THZP - &lspr[REDBALL_L], // SPR_ALRM + &lspr[NOLIGHT], // SPR_FWR5 + &lspr[REDBALL_L], // SPR_ALRM // Deep Sea Scenery &lspr[NOLIGHT], // SPR_GARG @@ -309,11 +334,40 @@ light_t *t_lspr[NUMSPRITES] = &lspr[NOLIGHT], // SPR_BMCH &lspr[NOLIGHT], // SPR_SMCE &lspr[NOLIGHT], // SPR_BMCE + &lspr[NOLIGHT], // SPR_YSPB + &lspr[NOLIGHT], // SPR_RSPB + &lspr[REDBALL_L], // SPR_SFBR + &lspr[REDBALL_L], // SPR_BFBR + &lspr[NOLIGHT], // SPR_BANR + &lspr[NOLIGHT], // SPR_PINE + &lspr[NOLIGHT], // SPR_CEZB + &lspr[REDBALL_L], // SPR_CNDL + &lspr[NOLIGHT], // SPR_FLMH + &lspr[REDBALL_L], // SPR_CTRC + &lspr[NOLIGHT], // SPR_CFLG + &lspr[NOLIGHT], // SPR_CSTA + &lspr[NOLIGHT], // SPR_CBBS // Arid Canyon Scenery &lspr[NOLIGHT], // SPR_BTBL &lspr[NOLIGHT], // SPR_STBL &lspr[NOLIGHT], // SPR_CACT + &lspr[NOLIGHT], // SPR_WWSG + &lspr[NOLIGHT], // SPR_WWS2 + &lspr[NOLIGHT], // SPR_WWS3 + &lspr[NOLIGHT], // SPR_OILL + &lspr[NOLIGHT], // SPR_OILF + &lspr[NOLIGHT], // SPR_BARR + &lspr[NOLIGHT], // SPR_REMT + &lspr[NOLIGHT], // SPR_TAZD + &lspr[NOLIGHT], // SPR_ADST + &lspr[NOLIGHT], // SPR_MCRT + &lspr[NOLIGHT], // SPR_MCSP + &lspr[NOLIGHT], // SPR_NON2 + &lspr[NOLIGHT], // SPR_SALD + &lspr[NOLIGHT], // SPR_TRAE + &lspr[NOLIGHT], // SPR_TRAI + &lspr[NOLIGHT], // SPR_STEA // Red Volcano Scenery &lspr[REDBALL_L], // SPR_FLME @@ -327,24 +381,35 @@ light_t *t_lspr[NUMSPRITES] = &lspr[NOLIGHT], // SPR_XMS1 &lspr[NOLIGHT], // SPR_XMS2 &lspr[NOLIGHT], // SPR_XMS3 + &lspr[NOLIGHT], // SPR_XMS4 + &lspr[NOLIGHT], // SPR_XMS5 + &lspr[NOLIGHT], // SPR_FHZI + + // Halloween Scenery + &lspr[RINGLIGHT_L], // SPR_PUMK + &lspr[NOLIGHT], // SPR_HHPL + &lspr[NOLIGHT], // SPR_SHRM + &lspr[NOLIGHT], // SPR_HHZM // Botanic Serenity Scenery &lspr[NOLIGHT], // SPR_BSZ1 &lspr[NOLIGHT], // SPR_BSZ2 &lspr[NOLIGHT], // SPR_BSZ3 - &lspr[NOLIGHT], // SPR_BSZ4 + //&lspr[NOLIGHT], -- SPR_BSZ4 + &lspr[NOLIGHT], // SPR_BST1 + &lspr[NOLIGHT], // SPR_BST2 + &lspr[NOLIGHT], // SPR_BST3 + &lspr[NOLIGHT], // SPR_BST4 + &lspr[NOLIGHT], // SPR_BST5 + &lspr[NOLIGHT], // SPR_BST6 &lspr[NOLIGHT], // SPR_BSZ5 &lspr[NOLIGHT], // SPR_BSZ6 &lspr[NOLIGHT], // SPR_BSZ7 &lspr[NOLIGHT], // SPR_BSZ8 - // Stalagmites + // Misc Scenery &lspr[NOLIGHT], // SPR_STLG - - // Disco Ball &lspr[NOLIGHT], // SPR_DBAL - - // ATZ Red Crystal &lspr[NOLIGHT], // SPR_RCRY // Powerup Indicators @@ -356,47 +421,73 @@ light_t *t_lspr[NUMSPRITES] = &lspr[NOLIGHT], // SPR_ELEM &lspr[NOLIGHT], // SPR_FORC &lspr[NOLIGHT], // SPR_PITY - &lspr[INVINCIBLE_L], // SPR_IVSP - &lspr[SUPERSPARK_L], // SPR_SSPK + &lspr[NOLIGHT], // SPR_FIRS + &lspr[NOLIGHT], // SPR_BUBS + &lspr[NOLIGHT], // SPR_ZAPS + &lspr[INVINCIBLE_L], // SPR_IVSP + &lspr[SUPERSPARK_L], // SPR_SSPK &lspr[NOLIGHT], // SPR_GOAL - // Freed Animals - &lspr[NOLIGHT], // SPR_BIRD - &lspr[NOLIGHT], // SPR_BUNY - &lspr[NOLIGHT], // SPR_MOUS - &lspr[NOLIGHT], // SPR_CHIC - &lspr[NOLIGHT], // SPR_COWZ - &lspr[NOLIGHT], // SPR_RBRD + // Flickies + &lspr[NOLIGHT], // SPR_FBUB + &lspr[NOLIGHT], // SPR_FL01 + &lspr[NOLIGHT], // SPR_FL02 + &lspr[NOLIGHT], // SPR_FL03 + &lspr[NOLIGHT], // SPR_FL04 + &lspr[NOLIGHT], // SPR_FL05 + &lspr[NOLIGHT], // SPR_FL06 + &lspr[NOLIGHT], // SPR_FL07 + &lspr[NOLIGHT], // SPR_FL08 + &lspr[NOLIGHT], // SPR_FL09 + &lspr[NOLIGHT], // SPR_FL10 + &lspr[NOLIGHT], // SPR_FL11 + &lspr[NOLIGHT], // SPR_FL12 + &lspr[NOLIGHT], // SPR_FL13 + &lspr[NOLIGHT], // SPR_FL14 + &lspr[NOLIGHT], // SPR_FL15 + &lspr[NOLIGHT], // SPR_FL16 + &lspr[NOLIGHT], // SPR_FS01 + &lspr[NOLIGHT], // SPR_FS02 // Springs + &lspr[NOLIGHT], // SPR_FANS + &lspr[NOLIGHT], // SPR_STEM + &lspr[NOLIGHT], // SPR_BUMP + &lspr[NOLIGHT], // SPR_BLON &lspr[NOLIGHT], // SPR_SPRY &lspr[NOLIGHT], // SPR_SPRR - &lspr[NOLIGHT], // SPR_SPRB Graue + &lspr[NOLIGHT], // SPR_SPRB &lspr[NOLIGHT], // SPR_YSPR &lspr[NOLIGHT], // SPR_RSPR + &lspr[NOLIGHT], // SPR_BSPR + &lspr[NOLIGHT], // SPR_SSWY + &lspr[NOLIGHT], // SPR_SSWR + &lspr[NOLIGHT], // SPR_SSWB - // Environmentals Effects + // Environmental Effects &lspr[NOLIGHT], // SPR_RAIN &lspr[NOLIGHT], // SPR_SNO1 &lspr[NOLIGHT], // SPR_SPLH &lspr[NOLIGHT], // SPR_SPLA &lspr[NOLIGHT], // SPR_SMOK - &lspr[NOLIGHT], // SPR_BUBP - &lspr[NOLIGHT], // SPR_BUBO - &lspr[NOLIGHT], // SPR_BUBN - &lspr[NOLIGHT], // SPR_BUBM - &lspr[NOLIGHT], // SPR_POPP + &lspr[NOLIGHT], // SPR_BUBL + &lspr[RINGLIGHT_L], // SPR_WZAP + &lspr[NOLIGHT], // SPR_DUST + &lspr[NOLIGHT], // SPR_FPRT &lspr[SUPERSPARK_L], // SPR_TFOG - &lspr[NIGHTSLIGHT_L], // SPR_SEED // Sonic CD flower seed + &lspr[NIGHTSLIGHT_L], // SPR_SEED &lspr[NOLIGHT], // SPR_PRTL // Game Indicators &lspr[NOLIGHT], // SPR_SCOR &lspr[NOLIGHT], // SPR_DRWN + &lspr[NOLIGHT], // SPR_LCKN &lspr[NOLIGHT], // SPR_TTAG &lspr[NOLIGHT], // SPR_GFLG + &lspr[NOLIGHT], // SPR_CORK + // Ring Weapons &lspr[RINGLIGHT_L], // SPR_RRNG &lspr[RINGLIGHT_L], // SPR_RNGB @@ -424,29 +515,43 @@ light_t *t_lspr[NUMSPRITES] = &lspr[NOLIGHT], // SPR_GOOM &lspr[NOLIGHT], // SPR_BGOM &lspr[REDBALL_L], // SPR_FFWR - &lspr[SMALLREDBALL_L], // SPR_FBLL + &lspr[SMALLREDBALL_L], // SPR_FBLL &lspr[NOLIGHT], // SPR_SHLL - &lspr[REDBALL_L], // SPR_PUMA + &lspr[REDBALL_L], // SPR_PUMA &lspr[NOLIGHT], // SPR_HAMM &lspr[NOLIGHT], // SPR_KOOP - &lspr[REDBALL_L], // SPR_BFLM + &lspr[REDBALL_L], // SPR_BFLM &lspr[NOLIGHT], // SPR_MAXE &lspr[NOLIGHT], // SPR_MUS1 &lspr[NOLIGHT], // SPR_MUS2 &lspr[NOLIGHT], // SPR_TOAD // NiGHTS Stuff - &lspr[SUPERSONIC_L], // SPR_NDRN // NiGHTS drone - &lspr[SUPERSONIC_L], // SPR_SUPE // NiGHTS character flying - &lspr[SUPERSONIC_L], // SPR_SUPZ // NiGHTS hurt - &lspr[SUPERSONIC_L], // SPR_NDRL // NiGHTS character drilling + &lspr[SUPERSONIC_L], // SPR_NDRN // NiGHTS drone &lspr[NOLIGHT], // SPR_NSPK &lspr[NOLIGHT], // SPR_NBMP &lspr[NOLIGHT], // SPR_HOOP &lspr[NOLIGHT], // SPR_HSCR &lspr[NOLIGHT], // SPR_NPRU &lspr[NOLIGHT], // SPR_CAPS - &lspr[SUPERSONIC_L], // SPR_SUPT + &lspr[INVINCIBLE_L], // SPR_IDYA + &lspr[NOLIGHT], // SPR_NTPN + &lspr[NOLIGHT], // SPR_SHLP + + // Secret badniks and hazards, shhhh + &lspr[NOLIGHT], // SPR_PENG + &lspr[NOLIGHT], // SPR_POPH, + &lspr[NOLIGHT], // SPR_HIVE + &lspr[NOLIGHT], // SPR_BUMB, + &lspr[NOLIGHT], // SPR_BBUZ + &lspr[NOLIGHT], // SPR_FMCE, + &lspr[NOLIGHT], // SPR_HMCE, + &lspr[NOLIGHT], // SPR_CACO, + &lspr[BLUEBALL_L], // SPR_BAL2, + &lspr[NOLIGHT], // SPR_SBOB, + &lspr[BLUEBALL_L], // SPR_SBFL, + &lspr[BLUEBALL_L], // SPR_SBSK, + &lspr[NOLIGHT], // SPR_BATT, // Debris &lspr[RINGSPARK_L], // SPR_SPRK @@ -454,6 +559,8 @@ light_t *t_lspr[NUMSPRITES] = &lspr[SUPERSPARK_L], // SPR_BOM2 &lspr[SUPERSPARK_L], // SPR_BOM3 &lspr[NOLIGHT], // SPR_BOM4 + &lspr[REDBALL_L], // SPR_BMNB + &lspr[NOLIGHT], // SPR_WDDB // Crumbly rocks &lspr[NOLIGHT], // SPR_ROIA @@ -473,30 +580,10 @@ light_t *t_lspr[NUMSPRITES] = &lspr[NOLIGHT], // SPR_ROIO &lspr[NOLIGHT], // SPR_ROIP - // Blue Spheres - &lspr[NOLIGHT], // SPR_BBAL - // Gravity Well Objects &lspr[NOLIGHT], // SPR_GWLG &lspr[NOLIGHT], // SPR_GWLR - // SRB1 Sprites - &lspr[NOLIGHT], // SPR_SRBA - &lspr[NOLIGHT], // SPR_SRBB - &lspr[NOLIGHT], // SPR_SRBC - &lspr[NOLIGHT], // SPR_SRBD - &lspr[NOLIGHT], // SPR_SRBE - &lspr[NOLIGHT], // SPR_SRBF - &lspr[NOLIGHT], // SPR_SRBG - &lspr[NOLIGHT], // SPR_SRBH - &lspr[NOLIGHT], // SPR_SRBI - &lspr[NOLIGHT], // SPR_SRBJ - &lspr[NOLIGHT], // SPR_SRBK - &lspr[NOLIGHT], // SPR_SRBL - &lspr[NOLIGHT], // SPR_SRBM - &lspr[NOLIGHT], // SPR_SRBN - &lspr[NOLIGHT], // SPR_SRBO - // Free slots &lspr[NOLIGHT], &lspr[NOLIGHT], diff --git a/src/hardware/hw_main.c b/src/hardware/hw_main.c index 1f3b56e22..d8af96c6f 100644 --- a/src/hardware/hw_main.c +++ b/src/hardware/hw_main.c @@ -641,13 +641,13 @@ static void HWR_RenderPlane(sector_t *sector, extrasubsector_t *xsub, boolean is { scrollx = FIXED_TO_FLOAT(FOFsector->floor_xoffs)/fflatsize; scrolly = FIXED_TO_FLOAT(FOFsector->floor_yoffs)/fflatsize; - angle = FOFsector->floorpic_angle>>ANGLETOFINESHIFT; + angle = FOFsector->floorpic_angle; } else // it's a ceiling { scrollx = FIXED_TO_FLOAT(FOFsector->ceiling_xoffs)/fflatsize; scrolly = FIXED_TO_FLOAT(FOFsector->ceiling_yoffs)/fflatsize; - angle = FOFsector->ceilingpic_angle>>ANGLETOFINESHIFT; + angle = FOFsector->ceilingpic_angle; } } else if (gr_frontsector) @@ -656,25 +656,19 @@ static void HWR_RenderPlane(sector_t *sector, extrasubsector_t *xsub, boolean is { scrollx = FIXED_TO_FLOAT(gr_frontsector->floor_xoffs)/fflatsize; scrolly = FIXED_TO_FLOAT(gr_frontsector->floor_yoffs)/fflatsize; - angle = gr_frontsector->floorpic_angle>>ANGLETOFINESHIFT; + angle = gr_frontsector->floorpic_angle; } else // it's a ceiling { scrollx = FIXED_TO_FLOAT(gr_frontsector->ceiling_xoffs)/fflatsize; scrolly = FIXED_TO_FLOAT(gr_frontsector->ceiling_yoffs)/fflatsize; - angle = gr_frontsector->ceilingpic_angle>>ANGLETOFINESHIFT; + angle = gr_frontsector->ceilingpic_angle; } } if (angle) // Only needs to be done if there's an altered angle { - - // This needs to be done so that it scrolls in a different direction after rotation like software - tempxsow = FLOAT_TO_FIXED(scrollx); - tempytow = FLOAT_TO_FIXED(scrolly); - scrollx = (FIXED_TO_FLOAT(FixedMul(tempxsow, FINECOSINE(angle)) - FixedMul(tempytow, FINESINE(angle)))); - scrolly = (FIXED_TO_FLOAT(FixedMul(tempxsow, FINESINE(angle)) + FixedMul(tempytow, FINECOSINE(angle)))); - + angle = InvAngle(angle)>>ANGLETOFINESHIFT; // This needs to be done so everything aligns after rotation // It would be done so that rotation is done, THEN the translation, but I couldn't get it to rotate AND scroll like software does tempxsow = FLOAT_TO_FIXED(flatxref); @@ -687,7 +681,7 @@ static void HWR_RenderPlane(sector_t *sector, extrasubsector_t *xsub, boolean is { // Hurdler: add scrolling texture on floor/ceiling v3d->sow = (float)((pv->x / fflatsize) - flatxref + scrollx); - v3d->tow = (float)(flatyref - (pv->y / fflatsize) + scrolly); + v3d->tow = (float)(-(pv->y / fflatsize) + flatyref + scrolly); //v3d->sow = (float)(pv->x / fflatsize); //v3d->tow = (float)(pv->y / fflatsize); @@ -698,7 +692,7 @@ static void HWR_RenderPlane(sector_t *sector, extrasubsector_t *xsub, boolean is tempxsow = FLOAT_TO_FIXED(v3d->sow); tempytow = FLOAT_TO_FIXED(v3d->tow); v3d->sow = (FIXED_TO_FLOAT(FixedMul(tempxsow, FINECOSINE(angle)) - FixedMul(tempytow, FINESINE(angle)))); - v3d->tow = (FIXED_TO_FLOAT(-FixedMul(tempxsow, FINESINE(angle)) - FixedMul(tempytow, FINECOSINE(angle)))); + v3d->tow = (FIXED_TO_FLOAT(FixedMul(tempxsow, FINESINE(angle)) + FixedMul(tempytow, FINECOSINE(angle)))); } //v3d->sow = (float)(v3d->sow - flatxref + scrollx); @@ -1132,7 +1126,7 @@ static void HWR_SplitWall(sector_t *sector, wallVert3D *wallVerts, INT32 texnum, else { lightnum = *list[i].lightlevel; - colormap = list[i].extra_colormap; + colormap = *list[i].extra_colormap; } } @@ -1314,9 +1308,9 @@ static void HWR_SplitWall(sector_t *sector, wallVert3D *wallVerts, INT32 texnum, HWR_ProjectWall(wallVerts, Surf, PF_Masked, lightnum, colormap); } -// HWR_DrawSkyWalls +// HWR_DrawSkyWall // Draw walls into the depth buffer so that anything behind is culled properly -static void HWR_DrawSkyWall(wallVert3D *wallVerts, FSurfaceInfo *Surf, fixed_t bottom, fixed_t top) +static void HWR_DrawSkyWall(wallVert3D *wallVerts, FSurfaceInfo *Surf) { HWD.pfnSetTexture(NULL); // no texture @@ -1324,9 +1318,7 @@ static void HWR_DrawSkyWall(wallVert3D *wallVerts, FSurfaceInfo *Surf, fixed_t b wallVerts[0].t = wallVerts[1].t = 0; wallVerts[0].s = wallVerts[3].s = 0; wallVerts[2].s = wallVerts[1].s = 0; - // set top/bottom coords - wallVerts[2].y = wallVerts[3].y = FIXED_TO_FLOAT(top); // No real way to find the correct height of this - wallVerts[0].y = wallVerts[1].y = FIXED_TO_FLOAT(bottom); // worldlow/bottom because it needs to cover up the lower thok barrier wall + // this no longer sets top/bottom coords, this should be done before caling the function HWR_ProjectWall(wallVerts, Surf, PF_Invisible|PF_Clip|PF_NoTexture, 255, NULL); // PF_Invisible so it's not drawn into the colour buffer // PF_NoTexture for no texture @@ -1447,8 +1439,10 @@ static void HWR_StoreWallRange(double startfrac, double endfrac) if (gr_backsector) { - INT32 gr_toptexture, gr_bottomtexture; + INT32 gr_toptexture = 0, gr_bottomtexture = 0; // two sided line + boolean bothceilingssky = false; // turned on if both back and front ceilings are sky + boolean bothfloorssky = false; // likewise, but for floors #ifdef ESLOPE SLOPEPARAMS(gr_backsector->c_slope, worldhigh, worldhighslope, gr_backsector->ceilingheight) @@ -1461,17 +1455,23 @@ static void HWR_StoreWallRange(double startfrac, double endfrac) // hack to allow height changes in outdoor areas // This is what gets rid of the upper textures if there should be sky - if (gr_frontsector->ceilingpic == skyflatnum && - gr_backsector->ceilingpic == skyflatnum) + if (gr_frontsector->ceilingpic == skyflatnum + && gr_backsector->ceilingpic == skyflatnum) { - worldtop = worldhigh; -#ifdef ESLOPE - worldtopslope = worldhighslope; -#endif + bothceilingssky = true; } - gr_toptexture = R_GetTextureNum(gr_sidedef->toptexture); - gr_bottomtexture = R_GetTextureNum(gr_sidedef->bottomtexture); + // likewise, but for floors and upper textures + if (gr_frontsector->floorpic == skyflatnum + && gr_backsector->floorpic == skyflatnum) + { + bothfloorssky = true; + } + + if (!bothceilingssky) + gr_toptexture = R_GetTextureNum(gr_sidedef->toptexture); + if (!bothfloorssky) + gr_bottomtexture = R_GetTextureNum(gr_sidedef->bottomtexture); // check TOP TEXTURE if (( @@ -1912,84 +1912,42 @@ static void HWR_StoreWallRange(double startfrac, double endfrac) }*/ } - // Isn't this just the most lovely mess +#if 1 + // Sky culling + // No longer so much a mess as before! if (!gr_curline->polyseg) // Don't do it for polyobjects { - if (gr_frontsector->ceilingpic == skyflatnum || gr_backsector->ceilingpic == skyflatnum) + if (gr_frontsector->ceilingpic == skyflatnum) { - fixed_t depthwallheight; - - if (!gr_sidedef->toptexture || (gr_frontsector->ceilingpic == skyflatnum && gr_backsector->ceilingpic == skyflatnum)) // when both sectors are sky, the top texture isn't drawn - depthwallheight = gr_frontsector->ceilingheight < gr_backsector->ceilingheight ? gr_frontsector->ceilingheight : gr_backsector->ceilingheight; - else - depthwallheight = gr_frontsector->ceilingheight > gr_backsector->ceilingheight ? gr_frontsector->ceilingheight : gr_backsector->ceilingheight; - - if (gr_frontsector->ceilingheight-gr_frontsector->floorheight <= 0) // current sector is a thok barrier + if (gr_backsector->ceilingpic != skyflatnum) // don't cull if back sector is also sky { - if (gr_backsector->ceilingheight-gr_backsector->floorheight <= 0) // behind sector is also a thok barrier - { - if (!gr_sidedef->bottomtexture) // Only extend further down if there's no texture - HWR_DrawSkyWall(wallVerts, &Surf, worldbottom < worldlow ? worldbottom : worldlow, INT32_MAX); - else - HWR_DrawSkyWall(wallVerts, &Surf, worldbottom > worldlow ? worldbottom : worldlow, INT32_MAX); - } - // behind sector is not a thok barrier - else if (gr_backsector->ceilingheight <= gr_frontsector->ceilingheight) // behind sector ceiling is lower or equal to current sector - HWR_DrawSkyWall(wallVerts, &Surf, depthwallheight, INT32_MAX); - // gr_front/backsector heights need to be used here because of the worldtop being set to worldhigh earlier on - } - else if (gr_backsector->ceilingheight-gr_backsector->floorheight <= 0) // behind sector is a thok barrier, current sector is not - { - if (gr_backsector->ceilingheight >= gr_frontsector->ceilingheight // thok barrier ceiling height is equal to or greater than current sector ceiling height - || gr_backsector->floorheight <= gr_frontsector->floorheight // thok barrier ceiling height is equal to or less than current sector floor height - || gr_backsector->ceilingpic != skyflatnum) // thok barrier is not a sky - HWR_DrawSkyWall(wallVerts, &Surf, depthwallheight, INT32_MAX); - } - else // neither sectors are thok barriers - { - if ((gr_backsector->ceilingheight < gr_frontsector->ceilingheight && !gr_sidedef->toptexture) // no top texture and sector behind is lower - || gr_backsector->ceilingpic != skyflatnum) // behind sector is not a sky - HWR_DrawSkyWall(wallVerts, &Surf, depthwallheight, INT32_MAX); + wallVerts[2].y = wallVerts[3].y = FIXED_TO_FLOAT(INT32_MAX); // draw to top of map space +#ifdef ESLOPE + wallVerts[0].y = FIXED_TO_FLOAT(worldtop); + wallVerts[1].y = FIXED_TO_FLOAT(worldtopslope); +#else + wallVerts[0].y = wallVerts[1].y = FIXED_TO_FLOAT(worldtop); +#endif + HWR_DrawSkyWall(wallVerts, &Surf); } } - // And now for sky floors! - if (gr_frontsector->floorpic == skyflatnum || gr_backsector->floorpic == skyflatnum) + + if (gr_frontsector->floorpic == skyflatnum) { - fixed_t depthwallheight; - - if (!gr_sidedef->bottomtexture) - depthwallheight = worldbottom > worldlow ? worldbottom : worldlow; - else - depthwallheight = worldbottom < worldlow ? worldbottom : worldlow; - - if (gr_frontsector->ceilingheight-gr_frontsector->floorheight <= 0) // current sector is a thok barrier + if (gr_backsector->floorpic != skyflatnum) // don't cull if back sector is also sky { - if (gr_backsector->ceilingheight-gr_backsector->floorheight <= 0) // behind sector is also a thok barrier - { - if (!gr_sidedef->toptexture) // Only extend up if there's no texture - HWR_DrawSkyWall(wallVerts, &Surf, INT32_MIN, worldtop > worldhigh ? worldtop : worldhigh); - else - HWR_DrawSkyWall(wallVerts, &Surf, INT32_MIN, worldtop < worldhigh ? worldtop : worldhigh); - } - // behind sector is not a thok barrier - else if (gr_backsector->floorheight >= gr_frontsector->floorheight) // behind sector floor is greater or equal to current sector - HWR_DrawSkyWall(wallVerts, &Surf, INT32_MIN, depthwallheight); - } - else if (gr_backsector->ceilingheight-gr_backsector->floorheight <= 0) // behind sector is a thok barrier, current sector is not - { - if (gr_backsector->floorheight <= gr_frontsector->floorheight // thok barrier floor height is equal to or less than current sector floor height - || gr_backsector->ceilingheight >= gr_frontsector->ceilingheight // thok barrier floor height is equal to or greater than current sector ceiling height - || gr_backsector->floorpic != skyflatnum) // thok barrier is not a sky - HWR_DrawSkyWall(wallVerts, &Surf, INT32_MIN, depthwallheight); - } - else // neither sectors are thok barriers - { - if ((gr_backsector->floorheight > gr_frontsector->floorheight && !gr_sidedef->bottomtexture) // no bottom texture and sector behind is higher - || gr_backsector->floorpic != skyflatnum) // behind sector is not a sky - HWR_DrawSkyWall(wallVerts, &Surf, INT32_MIN, depthwallheight); +#ifdef ESLOPE + wallVerts[3].y = FIXED_TO_FLOAT(worldbottom); + wallVerts[2].y = FIXED_TO_FLOAT(worldbottomslope); +#else + wallVerts[2].y = wallVerts[3].y = FIXED_TO_FLOAT(worldbottom); +#endif + wallVerts[0].y = wallVerts[1].y = FIXED_TO_FLOAT(INT32_MIN); // draw to bottom of map space + HWR_DrawSkyWall(wallVerts, &Surf); } } } +#endif } else { @@ -2060,9 +2018,27 @@ static void HWR_StoreWallRange(double startfrac, double endfrac) if (!gr_curline->polyseg) { if (gr_frontsector->ceilingpic == skyflatnum) // It's a single-sided line with sky for its sector - HWR_DrawSkyWall(wallVerts, &Surf, worldtop, INT32_MAX); + { + wallVerts[2].y = wallVerts[3].y = FIXED_TO_FLOAT(INT32_MAX); // draw to top of map space +#ifdef ESLOPE + wallVerts[0].y = FIXED_TO_FLOAT(worldtop); + wallVerts[1].y = FIXED_TO_FLOAT(worldtopslope); +#else + wallVerts[0].y = wallVerts[1].y = FIXED_TO_FLOAT(worldtop); +#endif + HWR_DrawSkyWall(wallVerts, &Surf); + } if (gr_frontsector->floorpic == skyflatnum) - HWR_DrawSkyWall(wallVerts, &Surf, INT32_MIN, worldbottom); + { +#ifdef ESLOPE + wallVerts[3].y = FIXED_TO_FLOAT(worldbottom); + wallVerts[2].y = FIXED_TO_FLOAT(worldbottomslope); +#else + wallVerts[2].y = wallVerts[3].y = FIXED_TO_FLOAT(worldbottom); +#endif + wallVerts[0].y = wallVerts[1].y = FIXED_TO_FLOAT(INT32_MIN); // draw to bottom of map space + HWR_DrawSkyWall(wallVerts, &Surf); + } } } @@ -2384,6 +2360,12 @@ static boolean CheckClip(seg_t * seg, sector_t * afrontsector, sector_t * abacks { fixed_t frontf1,frontf2, frontc1, frontc2; // front floor/ceiling ends fixed_t backf1, backf2, backc1, backc2; // back floor ceiling ends + boolean bothceilingssky = false, bothfloorssky = false; + + if (abacksector->ceilingpic == skyflatnum && afrontsector->ceilingpic == skyflatnum) + bothceilingssky = true; + if (abacksector->floorpic == skyflatnum && afrontsector->floorpic == skyflatnum) + bothfloorssky = true; // GZDoom method of sloped line clipping @@ -2416,62 +2398,45 @@ static boolean CheckClip(seg_t * seg, sector_t * afrontsector, sector_t * abacks backf1 = backf2 = abacksector->floorheight; backc1 = backc2 = abacksector->ceilingheight; } - - // now check for closed sectors! - if (backc1 <= frontf1 && backc2 <= frontf2) + // properly render skies (consider door "open" if both ceilings are sky) + // same for floors + if (!bothceilingssky && !bothfloorssky) { - checkforemptylines = false; - if (!seg->sidedef->toptexture) - return false; - - if (abacksector->ceilingpic == skyflatnum && afrontsector->ceilingpic == skyflatnum) - return false; - - return true; - } - - if (backf1 >= frontc1 && backf2 >= frontc2) - { - checkforemptylines = false; - if (!seg->sidedef->bottomtexture) - return false; - - // properly render skies (consider door "open" if both floors are sky): - if (abacksector->ceilingpic == skyflatnum && afrontsector->ceilingpic == skyflatnum) - return false; - - return true; - } - - if (backc1 <= backf1 && backc2 <= backf2) - { - checkforemptylines = false; - // preserve a kind of transparent door/lift special effect: - if (backc1 < frontc1 || backc2 < frontc2) + // now check for closed sectors! + if ((backc1 <= frontf1 && backc2 <= frontf2) + || (backf1 >= frontc1 && backf2 >= frontc2)) { - if (!seg->sidedef->toptexture) - return false; + checkforemptylines = false; + return true; } - if (backf1 > frontf1 || backf2 > frontf2) + + if (backc1 <= backf1 && backc2 <= backf2) { - if (!seg->sidedef->bottomtexture) - return false; + // preserve a kind of transparent door/lift special effect: + if (((backc1 >= frontc1 && backc2 >= frontc2) || seg->sidedef->toptexture) + && ((backf1 <= frontf1 && backf2 <= frontf2) || seg->sidedef->bottomtexture)) + { + checkforemptylines = false; + return true; + } } - if (abacksector->ceilingpic == skyflatnum && afrontsector->ceilingpic == skyflatnum) - return false; - - if (abacksector->floorpic == skyflatnum && afrontsector->floorpic == skyflatnum) - return false; - - return true; } - if (backc1 != frontc1 || backc2 != frontc2 - || backf1 != frontf1 || backf2 != frontf2) + if (!bothceilingssky) { + if (backc1 != frontc1 || backc2 != frontc2) { checkforemptylines = false; return false; } + } + + if (!bothfloorssky) { + if (backf1 != frontf1 || backf2 != frontf2) + { + checkforemptylines = false; + return false; + } + } return false; } @@ -2774,6 +2739,7 @@ static void HWR_AddLine(seg_t * line) #ifndef NEWCLIP INT32 x1, x2; angle_t span, tspan; + boolean bothceilingssky = false, bothfloorssky = false; #endif // SoM: Backsector needs to be run through R_FakeFlat @@ -2899,7 +2865,30 @@ static void HWR_AddLine(seg_t * line) } else { + boolean bothceilingssky = false, bothfloorssky = false; + gr_backsector = R_FakeFlat(gr_backsector, &tempsec, NULL, NULL, true); + + if (gr_backsector->ceilingpic == skyflatnum && gr_frontsector->ceilingpic == skyflatnum) + bothceilingssky = true; + if (gr_backsector->floorpic == skyflatnum && gr_frontsector->floorpic == skyflatnum) + bothfloorssky = true; + + if (bothceilingssky && bothfloorssky) // everything's sky? let's save us a bit of time then + { + if ( +#ifdef POLYOBJECTS + !line->polyseg && +#endif + !line->sidedef->midtexture + && ((!gr_frontsector->ffloors && !gr_backsector->ffloors) + || (gr_frontsector->tag == gr_backsector->tag))) + return; // line is empty, don't even bother + // treat like wide open window instead + HWR_ProcessSeg(); // Doesn't need arguments because they're defined globally :D + return; + } + if (CheckClip(line, gr_frontsector, gr_backsector)) { gld_clipper_SafeAddClipRange(angle2, angle1); @@ -2922,6 +2911,25 @@ static void HWR_AddLine(seg_t * line) gr_backsector = R_FakeFlat(gr_backsector, &tempsec, NULL, NULL, true); + if (gr_backsector->ceilingpic == skyflatnum && gr_frontsector->ceilingpic == skyflatnum) + bothceilingssky = true; + if (gr_backsector->floorpic == skyflatnum && gr_frontsector->floorpic == skyflatnum) + bothfloorssky = true; + + if (bothceilingssky && bothfloorssky) // everything's sky? let's save us a bit of time then + { + if ( +#ifdef POLYOBJECTS + !line->polyseg && +#endif + !line->sidedef->midtexture + && ((!gr_frontsector->ffloors && !gr_backsector->ffloors) + || (gr_frontsector->tag == gr_backsector->tag))) + return; // line is empty, don't even bother + + goto clippass; // treat like wide open window instead + } + #ifdef ESLOPE if (gr_frontsector->f_slope || gr_frontsector->c_slope || gr_backsector->f_slope || gr_backsector->c_slope) { @@ -2940,47 +2948,58 @@ static void HWR_AddLine(seg_t * line) SLOPEPARAMS( gr_backsector->f_slope, backf1, backf2, gr_backsector->floorheight) SLOPEPARAMS( gr_backsector->c_slope, backc1, backc2, gr_backsector->ceilingheight) #undef SLOPEPARAMS - - // Closed door. - if ((backc1 <= frontf1 && backc2 <= frontf2) - || (backf1 >= frontc1 && backf2 >= frontc2)) + // if both ceilings are skies, consider it always "open" + // same for floors + if (!bothceilingssky && !bothfloorssky) { - goto clipsolid; - } + // Closed door. + if ((backc1 <= frontf1 && backc2 <= frontf2) + || (backf1 >= frontc1 && backf2 >= frontc2)) + { + goto clipsolid; + } - // Check for automap fix. - if (backc1 <= backf1 && backc2 <= backf2 - && ((backc1 >= frontc1 && backc2 >= frontc2) || gr_curline->sidedef->toptexture) - && ((backf1 <= frontf1 && backf2 >= frontf2) || gr_curline->sidedef->bottomtexture) - && (gr_backsector->ceilingpic != skyflatnum || gr_frontsector->ceilingpic != skyflatnum)) - goto clipsolid; + // Check for automap fix. + if (backc1 <= backf1 && backc2 <= backf2 + && ((backc1 >= frontc1 && backc2 >= frontc2) || gr_curline->sidedef->toptexture) + && ((backf1 <= frontf1 && backf2 >= frontf2) || gr_curline->sidedef->bottomtexture)) + goto clipsolid; + } // Window. - if (backc1 != frontc1 || backc2 != frontc2 - || backf1 != frontf1 || backf2 != frontf2) - { - goto clippass; - } + if (!bothceilingssky) // ceilings are always the "same" when sky + if (backc1 != frontc1 || backc2 != frontc2) + goto clippass; + if (!bothfloorssky) // floors are always the "same" when sky + if (backf1 != frontf1 || backf2 != frontf2) + goto clippass; } else #endif { - // Closed door. - if (gr_backsector->ceilingheight <= gr_frontsector->floorheight || - gr_backsector->floorheight >= gr_frontsector->ceilingheight) - goto clipsolid; + // if both ceilings are skies, consider it always "open" + // same for floors + if (!bothceilingssky && !bothfloorssky) + { + // Closed door. + if (gr_backsector->ceilingheight <= gr_frontsector->floorheight || + gr_backsector->floorheight >= gr_frontsector->ceilingheight) + goto clipsolid; - // Check for automap fix. - if (gr_backsector->ceilingheight <= gr_backsector->floorheight - && ((gr_backsector->ceilingheight >= gr_frontsector->ceilingheight) || gr_curline->sidedef->toptexture) - && ((gr_backsector->floorheight <= gr_backsector->floorheight) || gr_curline->sidedef->bottomtexture) - && (gr_backsector->ceilingpic != skyflatnum || gr_frontsector->ceilingpic != skyflatnum)) - goto clipsolid; + // Check for automap fix. + if (gr_backsector->ceilingheight <= gr_backsector->floorheight + && ((gr_backsector->ceilingheight >= gr_frontsector->ceilingheight) || gr_curline->sidedef->toptexture) + && ((gr_backsector->floorheight <= gr_backsector->floorheight) || gr_curline->sidedef->bottomtexture)) + goto clipsolid; + } // Window. - if (gr_backsector->ceilingheight != gr_frontsector->ceilingheight || - gr_backsector->floorheight != gr_frontsector->floorheight) - goto clippass; + if (!bothceilingssky) // ceilings are always the "same" when sky + if (gr_backsector->ceilingheight != gr_frontsector->ceilingheight) + goto clippass; + if (!bothfloorssky) // floors are always the "same" when sky + if (gr_backsector->floorheight != gr_frontsector->floorheight) + goto clippass; } // Reject empty lines used for triggers and special events. @@ -3497,12 +3516,12 @@ static void HWR_Subsector(size_t num) light = R_GetPlaneLight(gr_frontsector, locFloorHeight, false); if (gr_frontsector->floorlightsec == -1) floorlightlevel = *gr_frontsector->lightlist[light].lightlevel; - floorcolormap = gr_frontsector->lightlist[light].extra_colormap; + floorcolormap = *gr_frontsector->lightlist[light].extra_colormap; light = R_GetPlaneLight(gr_frontsector, locCeilingHeight, false); if (gr_frontsector->ceilinglightsec == -1) ceilinglightlevel = *gr_frontsector->lightlist[light].lightlevel; - ceilingcolormap = gr_frontsector->lightlist[light].extra_colormap; + ceilingcolormap = *gr_frontsector->lightlist[light].extra_colormap; } sub->sector->extra_colormap = gr_frontsector->extra_colormap; @@ -3626,7 +3645,7 @@ static void HWR_Subsector(size_t num) *rover->bottomheight, *gr_frontsector->lightlist[light].lightlevel, rover->alpha-1 > 255 ? 255 : rover->alpha-1, rover->master->frontsector, PF_Translucent, - false, gr_frontsector->lightlist[light].extra_colormap); + false, *gr_frontsector->lightlist[light].extra_colormap); #endif } else @@ -3634,7 +3653,7 @@ static void HWR_Subsector(size_t num) HWR_GetFlat(levelflats[*rover->bottompic].lumpnum); light = R_GetPlaneLight(gr_frontsector, centerHeight, dup_viewz < cullHeight ? true : false); HWR_RenderPlane(NULL, &extrasubsectors[num], false, *rover->bottomheight, PF_Occlude, *gr_frontsector->lightlist[light].lightlevel, levelflats[*rover->bottompic].lumpnum, - rover->master->frontsector, 255, false, gr_frontsector->lightlist[light].extra_colormap); + rover->master->frontsector, 255, false, *gr_frontsector->lightlist[light].extra_colormap); } } @@ -3689,7 +3708,7 @@ static void HWR_Subsector(size_t num) *rover->topheight, *gr_frontsector->lightlist[light].lightlevel, rover->alpha-1 > 255 ? 255 : rover->alpha-1, rover->master->frontsector, PF_Translucent, - false, gr_frontsector->lightlist[light].extra_colormap); + false, *gr_frontsector->lightlist[light].extra_colormap); #endif } @@ -3698,7 +3717,7 @@ static void HWR_Subsector(size_t num) HWR_GetFlat(levelflats[*rover->toppic].lumpnum); light = R_GetPlaneLight(gr_frontsector, centerHeight, dup_viewz < cullHeight ? true : false); HWR_RenderPlane(NULL, &extrasubsectors[num], true, *rover->topheight, PF_Occlude, *gr_frontsector->lightlist[light].lightlevel, levelflats[*rover->toppic].lumpnum, - rover->master->frontsector, 255, false, gr_frontsector->lightlist[light].extra_colormap); + rover->master->frontsector, 255, false, *gr_frontsector->lightlist[light].extra_colormap); } } } @@ -4209,8 +4228,8 @@ static void HWR_DrawSpriteShadow(gr_vissprite_t *spr, GLPatch_t *gpatch, float t if (!(spr->mobj->frame & FF_FULLBRIGHT)) lightlevel = *sector->lightlist[light].lightlevel; - if (sector->lightlist[light].extra_colormap) - colormap = sector->lightlist[light].extra_colormap; + if (*sector->lightlist[light].extra_colormap) + colormap = *sector->lightlist[light].extra_colormap; } else { @@ -4249,7 +4268,9 @@ static void HWR_DrawSpriteShadow(gr_vissprite_t *spr, GLPatch_t *gpatch, float t // This is expecting a pointer to an array containing 4 wallVerts for a sprite static void HWR_RotateSpritePolyToAim(gr_vissprite_t *spr, FOutVector *wallVerts) { - if (cv_grspritebillboarding.value && spr && spr->mobj && wallVerts) + if (cv_grspritebillboarding.value + && spr && spr->mobj && !(spr->mobj->frame & FF_PAPERSPRITE) + && wallVerts) { float basey = FIXED_TO_FLOAT(spr->mobj->z); float lowy = wallVerts[0].y; @@ -4428,7 +4449,7 @@ static void HWR_SplitSprite(gr_vissprite_t *spr) // Start with the lightlevel and colormap from the top of the sprite lightlevel = *list[sector->numlights - 1].lightlevel; - colormap = list[sector->numlights - 1].extra_colormap; + colormap = *list[sector->numlights - 1].extra_colormap; i = 0; temp = FLOAT_TO_FIXED(realtop); @@ -4444,7 +4465,7 @@ static void HWR_SplitSprite(gr_vissprite_t *spr) { if (!(spr->mobj->frame & FF_FULLBRIGHT)) lightlevel = *list[i-1].lightlevel; - colormap = list[i-1].extra_colormap; + colormap = *list[i-1].extra_colormap; break; } } @@ -4452,7 +4473,7 @@ static void HWR_SplitSprite(gr_vissprite_t *spr) i = R_GetPlaneLight(sector, temp, false); if (!(spr->mobj->frame & FF_FULLBRIGHT)) lightlevel = *list[i].lightlevel; - colormap = list[i].extra_colormap; + colormap = *list[i].extra_colormap; #endif for (i = 0; i < sector->numlights; i++) @@ -4468,7 +4489,7 @@ static void HWR_SplitSprite(gr_vissprite_t *spr) { if (!(spr->mobj->frame & FF_FULLBRIGHT)) lightlevel = *list[i].lightlevel; - colormap = list[i].extra_colormap; + colormap = *list[i].extra_colormap; } #ifdef ESLOPE @@ -4530,7 +4551,8 @@ static void HWR_SplitSprite(gr_vissprite_t *spr) wallVerts[1].y = endbot; // The x and y only need to be adjusted in the case that it's not a papersprite - if (cv_grspritebillboarding.value && spr->mobj) + if (cv_grspritebillboarding.value + && spr->mobj && !(spr->mobj->frame & FF_PAPERSPRITE)) { // Get the x and z of the vertices so billboarding draws correctly realheight = realbot - realtop; @@ -4559,7 +4581,8 @@ static void HWR_SplitSprite(gr_vissprite_t *spr) wallVerts[0].y = wallVerts[1].y = bot; // The x and y only need to be adjusted in the case that it's not a papersprite - if (cv_grspritebillboarding.value && spr->mobj) + if (cv_grspritebillboarding.value + && spr->mobj && !(spr->mobj->frame & FF_PAPERSPRITE)) { // Get the x and z of the vertices so billboarding draws correctly realheight = realbot - realtop; @@ -4641,6 +4664,7 @@ static void HWR_DrawSprite(gr_vissprite_t *spr) GLPatch_t *gpatch; // sprite patch converted to hardware FSurfaceInfo Surf; const boolean hires = (spr->mobj && spr->mobj->skin && ((skin_t *)spr->mobj->skin)->flags & SF_HIRES); + //const boolean papersprite = (spr->mobj && (spr->mobj->frame & FF_PAPERSPRITE)); if (spr->mobj) this_scale = FIXED_TO_FLOAT(spr->mobj->scale); if (hires) @@ -4856,8 +4880,8 @@ static inline void HWR_DrawPrecipitationSprite(gr_vissprite_t *spr) if (!(spr->mobj->frame & FF_FULLBRIGHT)) lightlevel = *sector->lightlist[light].lightlevel; - if (sector->lightlist[light].extra_colormap) - colormap = sector->lightlist[light].extra_colormap; + if (*sector->lightlist[light].extra_colormap) + colormap = *sector->lightlist[light].extra_colormap; } else { @@ -5052,8 +5076,6 @@ static polyplaneinfo_t *polyplaneinfo = NULL; #ifndef SORTING size_t numfloors = 0; #else -//static floorinfo_t *floorinfo = NULL; -//static size_t numfloors = 0; //Hurdler: 3D water sutffs typedef struct gr_drawnode_s { @@ -5409,7 +5431,7 @@ static void HWR_AddSprites(sector_t *sec) } #ifdef HWPRECIP - // Someone seriously wants infinite draw distance for precipitation? + // no, no infinite draw distance for precipitation. this option at zero is supposed to turn it off if ((limit_dist = (fixed_t)cv_drawdist_precip.value << FRACBITS)) { for (precipthing = sec->preciplist; precipthing; precipthing = precipthing->snext) @@ -5425,13 +5447,6 @@ static void HWR_AddSprites(sector_t *sec) HWR_ProjectPrecipitationSprite(precipthing); } } - else - { - // Draw everything in sector, no checks - for (precipthing = sec->preciplist; precipthing; precipthing = precipthing->snext) - if (!(precipthing->precipflags & PCF_INVISIBLE)) - HWR_ProjectPrecipitationSprite(precipthing); - } #endif } @@ -5446,7 +5461,6 @@ static void HWR_ProjectSprite(mobj_t *thing) float tr_x, tr_y; float tz; float x1, x2; - float z1, z2; float rightsin, rightcos; float this_scale; float gz, gzt; @@ -5455,8 +5469,13 @@ static void HWR_ProjectSprite(mobj_t *thing) size_t lumpoff; unsigned rot; UINT8 flip; + boolean vflip = (!(thing->eflags & MFE_VERTICALFLIP) != !(thing->frame & FF_VERTICALFLIP)); + angle_t ang; INT32 heightsec, phs; + const boolean papersprite = (thing->frame & FF_PAPERSPRITE); + angle_t mobjangle = (thing->player ? thing->player->drawangle : thing->angle); + float z1, z2; if (!thing) return; @@ -5471,7 +5490,7 @@ static void HWR_ProjectSprite(mobj_t *thing) tz = (tr_x * gr_viewcos) + (tr_y * gr_viewsin); // thing is behind view plane? - if (tz < ZCLIP_PLANE && (!cv_grmdls.value || md2_models[thing->sprite].notfound == true)) //Yellow: Only MD2's dont disappear + if (tz < ZCLIP_PLANE && !papersprite && (!cv_grmdls.value || md2_models[thing->sprite].notfound == true)) //Yellow: Only MD2's dont disappear return; // The above can stay as it works for cutting sprites that are too close @@ -5488,7 +5507,7 @@ static void HWR_ProjectSprite(mobj_t *thing) //Fab : 02-08-98: 'skin' override spritedef currently used for skin if (thing->skin && thing->sprite == SPR_PLAY) - sprdef = &((skin_t *)thing->skin)->spritedef; + sprdef = &((skin_t *)thing->skin)->sprites[thing->sprite2]; else sprdef = &sprites[thing->sprite]; @@ -5511,28 +5530,60 @@ static void HWR_ProjectSprite(mobj_t *thing) I_Error("sprframes NULL for sprite %d\n", thing->sprite); #endif - if (sprframe->rotate) - { - // choose a different rotation based on player view - ang = R_PointToAngle(thing->x, thing->y); // uses viewx,viewy - rot = (ang-thing->angle+ANGLE_202h)>>29; - //Fab: lumpid is the index for spritewidth,spriteoffset... tables - lumpoff = sprframe->lumpid[rot]; - flip = sprframe->flip & (1<x, thing->y) - mobjangle; + + if (sprframe->rotate == SRF_SINGLE) { // use single rotation for all views rot = 0; //Fab: for vis->patch below lumpoff = sprframe->lumpid[0]; //Fab: see note above flip = sprframe->flip; // Will only be 0x00 or 0xFF + + if (papersprite && ang < ANGLE_180) + { + if (flip) + flip = 0; + else + flip = 255; + } + } + else + { + // choose a different rotation based on player view + if ((sprframe->rotate & SRF_RIGHT) && (ang < ANGLE_180)) // See from right + rot = 6; // F7 slot + else if ((sprframe->rotate & SRF_LEFT) && (ang >= ANGLE_180)) // See from left + rot = 2; // F3 slot + else // Normal behaviour + rot = (ang+ANGLE_202h)>>29; + + //Fab: lumpid is the index for spritewidth,spriteoffset... tables + lumpoff = sprframe->lumpid[rot]; + flip = sprframe->flip & (1<skin && ((skin_t *)thing->skin)->flags & SF_HIRES) this_scale = this_scale * FIXED_TO_FLOAT(((skin_t *)thing->skin)->highresscale); - rightsin = FIXED_TO_FLOAT(FINESINE((viewangle + ANGLE_90)>>ANGLETOFINESHIFT)); - rightcos = FIXED_TO_FLOAT(FINECOSINE((viewangle + ANGLE_90)>>ANGLETOFINESHIFT)); + if (papersprite) + { + rightsin = FIXED_TO_FLOAT(FINESINE((mobjangle)>>ANGLETOFINESHIFT)); + rightcos = FIXED_TO_FLOAT(FINECOSINE((mobjangle)>>ANGLETOFINESHIFT)); + } + else + { + rightsin = FIXED_TO_FLOAT(FINESINE((viewangle + ANGLE_90)>>ANGLETOFINESHIFT)); + rightcos = FIXED_TO_FLOAT(FINECOSINE((viewangle + ANGLE_90)>>ANGLETOFINESHIFT)); + } + if (flip) { x1 = (FIXED_TO_FLOAT(spritecachedinfo[lumpoff].width - spritecachedinfo[lumpoff].offset) * this_scale); @@ -5544,12 +5595,24 @@ static void HWR_ProjectSprite(mobj_t *thing) x2 = (FIXED_TO_FLOAT(spritecachedinfo[lumpoff].width - spritecachedinfo[lumpoff].offset) * this_scale); } + // test if too close +/* + if (papersprite) + { + z1 = tz - x1 * angle_scalez; + z2 = tz + x2 * angle_scalez; + + if (max(z1, z2) < ZCLIP_PLANE) + return; + } +*/ + z1 = tr_y + x1 * rightsin; z2 = tr_y - x2 * rightsin; x1 = tr_x + x1 * rightcos; x2 = tr_x - x2 * rightcos; - if (thing->eflags & MFE_VERTICALFLIP) + if (vflip) { gz = FIXED_TO_FLOAT(thing->z+thing->height) - FIXED_TO_FLOAT(spritecachedinfo[lumpoff].topoffset) * this_scale; gzt = gz + FIXED_TO_FLOAT(spritecachedinfo[lumpoff].height) * this_scale; @@ -5588,13 +5651,13 @@ static void HWR_ProjectSprite(mobj_t *thing) vis = HWR_NewVisSprite(); vis->x1 = x1; vis->x2 = x2; - vis->z1 = z1; - vis->z2 = z2; vis->tz = tz; // Keep tz for the simple sprite sorting that happens vis->dispoffset = thing->info->dispoffset; // Monster Iestyn: 23/11/15: HARDWARE SUPPORT AT LAST vis->patchlumpnum = sprframe->lumppat[rot]; vis->flip = flip; vis->mobj = thing; + vis->z1 = z1; + vis->z2 = z2; //Hurdler: 25/04/2000: now support colormap in hardware mode if ((vis->mobj->flags & MF_BOSS) && (vis->mobj->flags2 & MF2_FRET) && (leveltime & 1)) // Bosses "flash" @@ -5626,10 +5689,7 @@ static void HWR_ProjectSprite(mobj_t *thing) //CONS_Debug(DBG_RENDER, "------------------\nH: sprite : %d\nH: frame : %x\nH: type : %d\nH: sname : %s\n\n", // thing->sprite, thing->frame, thing->type, sprnames[thing->sprite]); - if (thing->eflags & MFE_VERTICALFLIP) - vis->vflip = true; - else - vis->vflip = false; + vis->vflip = vflip; vis->precip = false; } @@ -5707,16 +5767,6 @@ static void HWR_ProjectPrecipitationSprite(precipmobj_t *thing) x1 = tr_x + x1 * rightcos; x2 = tr_x - x2 * rightcos; - // okay, we can't return now... this is a hack, but weather isn't networked, so it should be ok - if (!(thing->precipflags & PCF_THUNK)) - { - if (thing->precipflags & PCF_RAIN) - P_RainThinker(thing); - else - P_SnowThinker(thing); - thing->precipflags |= PCF_THUNK; - } - // // store information in a vissprite // @@ -5737,6 +5787,16 @@ static void HWR_ProjectPrecipitationSprite(precipmobj_t *thing) vis->ty = FIXED_TO_FLOAT(thing->z + spritecachedinfo[lumpoff].topoffset); vis->precip = true; + + // okay... this is a hack, but weather isn't networked, so it should be ok + if (!(thing->precipflags & PCF_THUNK)) + { + if (thing->precipflags & PCF_RAIN) + P_RainThinker(thing); + else + P_SnowThinker(thing); + thing->precipflags |= PCF_THUNK; + } } #endif @@ -5751,7 +5811,7 @@ static void HWR_DrawSkyBackground(void) float aspectratio; float angleturn; - HWR_GetTexture(skytexture); + HWR_GetTexture(texturetranslation[skytexture]); aspectratio = (float)vid.width/(float)vid.height; //Hurdler: the sky is the only texture who need 4.0f instead of 1.0 @@ -5777,14 +5837,16 @@ static void HWR_DrawSkyBackground(void) // The only time this will probably be an issue is when a sky wider than 1024 is used as a sky AND a regular wall texture angle = (dup_viewangle + gr_xtoviewangle[0]); - dimensionmultiply = ((float)textures[skytexture]->width/256.0f); - v[0].sow = v[3].sow = ((float) angle / ((ANGLE_90-1)*dimensionmultiply)); - v[2].sow = v[1].sow = (-1.0f/dimensionmultiply)+((float) angle / ((ANGLE_90-1)*dimensionmultiply)); + dimensionmultiply = ((float)textures[texturetranslation[skytexture]]->width/256.0f); + + v[0].sow = v[3].sow = (-1.0f * angle) / ((ANGLE_90-1)*dimensionmultiply); // left + v[2].sow = v[1].sow = v[0].sow + (1.0f/dimensionmultiply); // right (or left + 1.0f) + // use +angle and -1.0f above instead if you wanted old backwards behavior // Y angle = aimingangle; - dimensionmultiply = ((float)textures[skytexture]->height/(128.0f*aspectratio)); + dimensionmultiply = ((float)textures[texturetranslation[skytexture]]->height/(128.0f*aspectratio)); if (splitscreen) { @@ -5797,13 +5859,13 @@ static void HWR_DrawSkyBackground(void) if (atransform.flip) { // During vertical flip the sky should be flipped and it's y movement should also be flipped obviously - v[3].tow = v[2].tow = -(0.5f-(0.5f/dimensionmultiply)); - v[0].tow = v[1].tow = (-1.0f/dimensionmultiply)-(0.5f-(0.5f/dimensionmultiply)); + v[3].tow = v[2].tow = -(0.5f-(0.5f/dimensionmultiply)); // top + v[0].tow = v[1].tow = v[3].tow - (1.0f/dimensionmultiply); // bottom (or top - 1.0f) } else { - v[3].tow = v[2].tow = (-1.0f/dimensionmultiply)-(0.5f-(0.5f/dimensionmultiply)); - v[0].tow = v[1].tow = -(0.5f-(0.5f/dimensionmultiply)); + v[0].tow = v[1].tow = -(0.5f-(0.5f/dimensionmultiply)); // bottom + v[3].tow = v[2].tow = v[0].tow - (1.0f/dimensionmultiply); // top (or bottom - 1.0f) } angleturn = (((float)ANGLE_45-1.0f)*aspectratio)*dimensionmultiply; @@ -6125,7 +6187,7 @@ void HWR_RenderPlayerView(INT32 viewnumber, player_t *player) } // note: sets viewangle, viewx, viewy, viewz - R_SetupFrame(player, false); // This can stay false because it is only used to set viewsky in r_main.c, which isn't used here + R_SetupFrame(player); framecount++; // timedemo // copy view cam position for local use @@ -6437,12 +6499,7 @@ void HWR_Startup(void) } if (rendermode == render_opengl) - textureformat = patchformat = -#ifdef _NDS - GR_TEXFMT_P_8; -#else - GR_RGBA; -#endif + textureformat = patchformat = GR_RGBA; startupdone = true; } diff --git a/src/hardware/hw_main.h b/src/hardware/hw_main.h index 98229c752..cd4e13ef5 100644 --- a/src/hardware/hw_main.h +++ b/src/hardware/hw_main.h @@ -32,8 +32,9 @@ void HWR_Startup(void); void HWR_Shutdown(void); void HWR_drawAMline(const fline_t *fl, INT32 color); -void HWR_FadeScreenMenuBack(UINT32 color, INT32 height); +void HWR_FadeScreenMenuBack(UINT16 color, UINT8 strength); void HWR_DrawConsoleBack(UINT32 color, INT32 height); +void HWR_DrawTutorialBack(UINT32 color, INT32 boxheight); void HWR_RenderSkyboxView(INT32 viewnumber, player_t *player); void HWR_RenderPlayerView(INT32 viewnumber, player_t *player); void HWR_DrawViewBorder(INT32 clearlines); @@ -43,8 +44,7 @@ void HWR_SetViewSize(void); void HWR_DrawPatch(GLPatch_t *gpatch, INT32 x, INT32 y, INT32 option); void HWR_DrawFixedPatch(GLPatch_t *gpatch, fixed_t x, fixed_t y, fixed_t scale, INT32 option, const UINT8 *colormap); void HWR_DrawCroppedPatch(GLPatch_t *gpatch, fixed_t x, fixed_t y, fixed_t scale, INT32 option, fixed_t sx, fixed_t sy, fixed_t w, fixed_t h); -void HWR_DrawCroppedPatch(GLPatch_t *gpatch, fixed_t x, fixed_t y, INT32 option, fixed_t scale, fixed_t sx, fixed_t sy, fixed_t w, fixed_t h); -void HWR_MakePatch (const patch_t *patch, GLPatch_t *grPatch, GLMipmap_t *grMipmap, boolean makebitmap); +void HWR_MakePatch(const patch_t *patch, GLPatch_t *grPatch, GLMipmap_t *grMipmap, boolean makebitmap); void HWR_CreatePlanePolygons(INT32 bspnum); void HWR_CreateStaticLightmaps(INT32 bspnum); void HWR_PrepLevelCache(size_t pnumtextures); @@ -104,13 +104,4 @@ extern float gr_viewwindowx, gr_basewindowcentery; extern fixed_t *hwbbox; extern FTransform atransform; -typedef struct -{ - wallVert3D floorVerts[4]; - FSurfaceInfo Surf; - INT32 texnum; - INT32 blend; - INT32 drawcount; -} floorinfo_t; - #endif diff --git a/src/hardware/hw_md2.c b/src/hardware/hw_md2.c index 4bb86cdf1..f0783bfe4 100644 --- a/src/hardware/hw_md2.c +++ b/src/hardware/hw_md2.c @@ -28,12 +28,12 @@ #include "../doomdef.h" #include "../doomstat.h" +#include "../fastcmp.h" #ifdef HWRENDER #include "hw_drv.h" #include "hw_light.h" #include "hw_md2.h" -#include "../d_main.h" #include "../r_bsp.h" #include "../r_main.h" #include "../m_misc.h" @@ -647,135 +647,10 @@ static void HWR_CreateBlendedTexture(GLPatch_t *gpatch, GLPatch_t *blendgpatch, image = gpatch->mipmap.grInfo.data; blendimage = blendgpatch->mipmap.grInfo.data; - switch (color) - { - case SKINCOLOR_WHITE: - blendcolor = V_GetColor(3); - break; - case SKINCOLOR_SILVER: - blendcolor = V_GetColor(10); - break; - case SKINCOLOR_GREY: - blendcolor = V_GetColor(15); - break; - case SKINCOLOR_BLACK: - blendcolor = V_GetColor(27); - break; - case SKINCOLOR_CYAN: - blendcolor = V_GetColor(215); - break; - case SKINCOLOR_TEAL: - blendcolor = V_GetColor(221); - break; - case SKINCOLOR_STEELBLUE: - blendcolor = V_GetColor(203); - break; - case SKINCOLOR_BLUE: - blendcolor = V_GetColor(232); - break; - case SKINCOLOR_PEACH: - blendcolor = V_GetColor(71); - break; - case SKINCOLOR_TAN: - blendcolor = V_GetColor(79); - break; - case SKINCOLOR_PINK: - blendcolor = V_GetColor(147); - break; - case SKINCOLOR_LAVENDER: - blendcolor = V_GetColor(251); - break; - case SKINCOLOR_PURPLE: - blendcolor = V_GetColor(195); - break; - case SKINCOLOR_ORANGE: - blendcolor = V_GetColor(87); - break; - case SKINCOLOR_ROSEWOOD: - blendcolor = V_GetColor(94); - break; - case SKINCOLOR_BEIGE: - blendcolor = V_GetColor(40); - break; - case SKINCOLOR_BROWN: - blendcolor = V_GetColor(57); - break; - case SKINCOLOR_RED: - blendcolor = V_GetColor(130); - break; - case SKINCOLOR_DARKRED: - blendcolor = V_GetColor(139); - break; - case SKINCOLOR_NEONGREEN: - blendcolor = V_GetColor(184); - break; - case SKINCOLOR_GREEN: - blendcolor = V_GetColor(166); - break; - case SKINCOLOR_ZIM: - blendcolor = V_GetColor(180); - break; - case SKINCOLOR_OLIVE: - blendcolor = V_GetColor(108); - break; - case SKINCOLOR_YELLOW: - blendcolor = V_GetColor(104); - break; - case SKINCOLOR_GOLD: - blendcolor = V_GetColor(115); - break; - - case SKINCOLOR_SUPER1: - blendcolor = V_GetColor(97); - break; - case SKINCOLOR_SUPER2: - blendcolor = V_GetColor(100); - break; - case SKINCOLOR_SUPER3: - blendcolor = V_GetColor(103); - break; - case SKINCOLOR_SUPER4: - blendcolor = V_GetColor(113); - break; - case SKINCOLOR_SUPER5: - blendcolor = V_GetColor(116); - break; - - case SKINCOLOR_TSUPER1: - blendcolor = V_GetColor(81); - break; - case SKINCOLOR_TSUPER2: - blendcolor = V_GetColor(82); - break; - case SKINCOLOR_TSUPER3: - blendcolor = V_GetColor(84); - break; - case SKINCOLOR_TSUPER4: - blendcolor = V_GetColor(85); - break; - case SKINCOLOR_TSUPER5: - blendcolor = V_GetColor(87); - break; - - case SKINCOLOR_KSUPER1: - blendcolor = V_GetColor(122); - break; - case SKINCOLOR_KSUPER2: - blendcolor = V_GetColor(123); - break; - case SKINCOLOR_KSUPER3: - blendcolor = V_GetColor(124); - break; - case SKINCOLOR_KSUPER4: - blendcolor = V_GetColor(125); - break; - case SKINCOLOR_KSUPER5: - blendcolor = V_GetColor(126); - break; - default: - blendcolor = V_GetColor(247); - break; - } + if (color == SKINCOLOR_NONE || color >= MAXTRANSLATIONS) + blendcolor = V_GetColor(0xff); + else + blendcolor = V_GetColor(Color_Index[color-1][4]); while (size--) { @@ -882,6 +757,51 @@ static void HWR_GetBlendedTexture(GLPatch_t *gpatch, GLPatch_t *blendgpatch, con res? run? */ + +static UINT8 P_GetModelSprite2(md2_t *md2, skin_t *skin, UINT8 spr2, player_t *player) +{ + UINT8 super = 0, i = 0; + + if (!md2 || !skin) + return 0; + + while (!(md2->model->spr2frames[spr2*2 + 1]) + && spr2 != SPR2_STND + && ++i != 32) // recursion limiter + { + if (spr2 & FF_SPR2SUPER) + { + super = FF_SPR2SUPER; + spr2 &= ~FF_SPR2SUPER; + continue; + } + + switch(spr2) + { + + // Normal special cases. + case SPR2_JUMP: + spr2 = ((player + ? player->charflags + : skin->flags) + & SF_NOJUMPSPIN) ? SPR2_SPNG : SPR2_ROLL; + break; + case SPR2_TIRE: + spr2 = (player && player->charability == CA_SWIM) ? SPR2_SWIM : SPR2_FLY; + break; + + // Use the handy list, that's what it's there for! + default: + spr2 = spr2defaults[spr2]; + break; + } + + spr2 |= super; + } + + return spr2; +} + #define NORMALFOG 0x00000000 #define FADEFOG 0x19000000 void HWR_DrawMD2(gr_vissprite_t *spr) @@ -917,8 +837,8 @@ void HWR_DrawMD2(gr_vissprite_t *spr) if (!(spr->mobj->frame & FF_FULLBRIGHT)) lightlevel = *sector->lightlist[light].lightlevel; - if (sector->lightlist[light].extra_colormap) - colormap = sector->lightlist[light].extra_colormap; + if (*sector->lightlist[light].extra_colormap) + colormap = *sector->lightlist[light].extra_colormap; } else { @@ -940,8 +860,13 @@ void HWR_DrawMD2(gr_vissprite_t *spr) GLPatch_t *gpatch; INT32 durs = spr->mobj->state->tics; INT32 tics = spr->mobj->tics; +<<<<<<< HEAD //mdlframe_t *next = NULL; const UINT8 flip = (UINT8)((spr->mobj->eflags & MFE_VERTICALFLIP) == MFE_VERTICALFLIP); +======= + md2_frame_t *curr, *next = NULL; + const UINT8 flip = (UINT8)(!(spr->mobj->eflags & MFE_VERTICALFLIP) != !(spr->mobj->frame & FF_VERTICALFLIP)); +>>>>>>> origin/master spritedef_t *sprdef; spriteframe_t *sprframe; float finalscale; @@ -1030,44 +955,104 @@ void HWR_DrawMD2(gr_vissprite_t *spr) tics = spr->mobj->anim_duration; } +<<<<<<< HEAD //FIXME: this is not yet correct frame = (spr->mobj->frame & FF_FRAMEMASK) % md2->model->meshes[0].numFrames; #ifdef USE_MODEL_NEXTFRAME if (cv_grmdls.value == 1 && tics <= durs) +======= +#define INTERPOLERATION_LIMIT TICRATE/4 + + if (spr->mobj->skin && spr->mobj->sprite == SPR_PLAY && md2->model->spr2frames) +>>>>>>> origin/master { - // frames are handled differently for states with FF_ANIMATE, so get the next frame differently for the interpolation - if (spr->mobj->frame & FF_ANIMATE) + UINT8 spr2 = P_GetModelSprite2(md2, spr->mobj->skin, spr->mobj->sprite2, spr->mobj->player); + UINT8 mod = md2->model->spr2frames[spr2*2 + 1] ? md2->model->spr2frames[spr2*2 + 1] : md2->model->header.numFrames; + if (mod > ((skin_t *)spr->mobj->skin)->sprites[spr2].numframes) + mod = ((skin_t *)spr->mobj->skin)->sprites[spr2].numframes; + //FIXME: this is not yet correct + frame = (spr->mobj->frame & FF_FRAMEMASK); + if (frame >= mod) + frame = 0; + buff = md2->model->glCommandBuffer; + curr = &md2->model->frames[md2->model->spr2frames[spr2*2] + frame]; + if (cv_grmd2.value == 1 && tics <= durs && tics <= INTERPOLERATION_LIMIT) { +<<<<<<< HEAD nextFrame = (spr->mobj->frame & FF_FRAMEMASK) + 1; if (nextFrame >= spr->mobj->state->var1) nextFrame = (spr->mobj->state->frame & FF_FRAMEMASK); nextFrame %= md2->model->meshes[0].numFrames; //next = &md2->model->meshes[0].frames[nextFrame]; - } - else - { - if (spr->mobj->state->nextstate != S_NULL && states[spr->mobj->state->nextstate].sprite != SPR_NULL - && !(spr->mobj->player && (spr->mobj->state->nextstate == S_PLAY_TAP1 || spr->mobj->state->nextstate == S_PLAY_TAP2) && spr->mobj->state == &states[S_PLAY_STND])) +======= + if (durs > INTERPOLERATION_LIMIT) + durs = INTERPOLERATION_LIMIT; + + if (spr->mobj->frame & FF_ANIMATE + || (spr->mobj->state->nextstate != S_NULL + && states[spr->mobj->state->nextstate].sprite == spr->mobj->sprite + && (states[spr->mobj->state->nextstate].frame & FF_FRAMEMASK) == spr->mobj->sprite2)) { + if (++frame >= mod) + frame = 0; + if (frame || !(spr->mobj->state->frame & FF_SPR2ENDSTATE)) + next = &md2->model->frames[md2->model->spr2frames[spr2*2] + frame]; + } +>>>>>>> origin/master + } + } + else + { + //FIXME: this is not yet correct + frame = (spr->mobj->frame & FF_FRAMEMASK) % md2->model->header.numFrames; + buff = md2->model->glCommandBuffer; + curr = &md2->model->frames[frame]; + if (cv_grmd2.value == 1 && tics <= durs && tics <= INTERPOLERATION_LIMIT) + { + if (durs > INTERPOLERATION_LIMIT) + durs = INTERPOLERATION_LIMIT; + + // frames are handled differently for states with FF_ANIMATE, so get the next frame differently for the interpolation + if (spr->mobj->frame & FF_ANIMATE) + { +<<<<<<< HEAD nextFrame = (states[spr->mobj->state->nextstate].frame & FF_FRAMEMASK) % md2->model->meshes[0].numFrames; //next = &md2->model->meshes[0].frames[nextFrame]; +======= + UINT32 nextframe = (spr->mobj->frame & FF_FRAMEMASK) + 1; + if (nextframe >= (UINT32)spr->mobj->state->var1) + nextframe = (spr->mobj->state->frame & FF_FRAMEMASK); + nextframe %= md2->model->header.numFrames; + next = &md2->model->frames[nextframe]; +>>>>>>> origin/master + } + else + { + if (spr->mobj->state->nextstate != S_NULL + && states[spr->mobj->state->nextstate].sprite == spr->mobj->sprite) + { + const UINT32 nextframe = (states[spr->mobj->state->nextstate].frame & FF_FRAMEMASK) % md2->model->header.numFrames; + next = &md2->model->frames[nextframe]; + } } } } #endif +#undef INTERPOLERATION_LIMIT + //Hurdler: it seems there is still a small problem with mobj angle p.x = FIXED_TO_FLOAT(spr->mobj->x); p.y = FIXED_TO_FLOAT(spr->mobj->y)+md2->offset; - if (spr->mobj->eflags & MFE_VERTICALFLIP) + if (flip) p.z = FIXED_TO_FLOAT(spr->mobj->z + spr->mobj->height); else p.z = FIXED_TO_FLOAT(spr->mobj->z); if (spr->mobj->skin && spr->mobj->sprite == SPR_PLAY) - sprdef = &((skin_t *)spr->mobj->skin)->spritedef; + sprdef = &((skin_t *)spr->mobj->skin)->sprites[spr->mobj->sprite2]; else sprdef = &sprites[spr->mobj->sprite]; @@ -1075,14 +1060,7 @@ void HWR_DrawMD2(gr_vissprite_t *spr) if (sprframe->rotate) { - fixed_t anglef = AngleFixed(spr->mobj->angle); - // \todo adapt for 2.2 directionchar? The below code is from Kart -#if 0 - if (spr->mobj->player) - anglef = AngleFixed(spr->mobj->player->frameangle); - else - anglef = AngleFixed(spr->mobj->angle); -#endif + const fixed_t anglef = AngleFixed((spr->mobj->player ? spr->mobj->player->drawangle : spr->mobj->angle)); p.angley = FIXED_TO_FLOAT(anglef); } else diff --git a/src/hardware/hws_data.h b/src/hardware/hws_data.h index 9e2d0547e..b890d976b 100644 --- a/src/hardware/hws_data.h +++ b/src/hardware/hws_data.h @@ -114,7 +114,7 @@ typedef struct snddev_s size_t numsfxs; // Windows specific data -#if defined (_WIN32) && !defined (_XBOX) +#ifdef _WIN32 UINT32 cooplevel; HWND hWnd; #endif diff --git a/src/hardware/r_minigl/r_minigl.c b/src/hardware/r_minigl/r_minigl.c deleted file mode 100644 index b2482a552..000000000 --- a/src/hardware/r_minigl/r_minigl.c +++ /dev/null @@ -1,33 +0,0 @@ -// Emacs style mode select -*- C++ -*- -//----------------------------------------------------------------------------- -// -// Copyright (C) 1998-2000 by DooM Legacy Team. -// -// This program is free software; you can redistribute it and/or -// modify it under the terms of the GNU General Public License -// as published by the Free Software Foundation; either version 2 -// of the License, or (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -//----------------------------------------------------------------------------- -/// \file -/// \brief MiniGL API for Doom Legacy - - -// tell r_opengl.cpp to compile for MiniGL Drivers -#define MINI_GL_COMPATIBILITY - -// tell r_opengl.cpp to compile for ATI Rage Pro OpenGL driver -//#define ATI_RAGE_PRO_COMPATIBILITY - -#define DRIVER_STRING "HWRAPI Init(): SRB2 MiniGL renderer" - -// Include this at end -#include "../r_opengl/r_opengl.c" -#include "../r_opengl/ogl_win.c" - -// That's all ;-) -// Just, be sure to do the right changes in r_opengl.cpp diff --git a/src/hardware/r_minigl/r_minigl.dev b/src/hardware/r_minigl/r_minigl.dev deleted file mode 100644 index edf725ac5..000000000 --- a/src/hardware/r_minigl/r_minigl.dev +++ /dev/null @@ -1,89 +0,0 @@ -[Project] -FileName=r_minigl.dev -Name=r_minigl -Ver=1 -IsCpp=1 -Type=3 -Compiler=-D_M_IX86=500_@@_-Wall_@@_-D_WINDOWS_@@_-DUSE_WGL_SWAP_@@_-Os_@@_-fomit-frame-pointer_@@_ -CppCompiler= -Includes= -Linker=--def ../r_mingw.def_@@_-lgdi32_@@_ -Libs= -UnitCount=4 -Folders= -ObjFiles= -PrivateResource= -ResourceIncludes= -MakeIncludes= -Icon= -ExeOutput=C:\srb2demo2 -ObjectOutput=..\..\..\objs\Mingw\r_minigl -OverrideOutput=1 -OverrideOutputName=r_minigl.dll -HostApplication= -CommandLine= -IncludeVersionInfo=0 -SupportXPThemes=0 -CompilerSet=0 -CompilerSettings=00000000000000000111d0 -UseCustomMakefile=0 -CustomMakefile= - -[Unit1] -FileName=..\r_opengl\ogl_win.c -Folder= -Compile=0 -CompileCpp=0 -Link=0 -Priority=1000 -OverrideBuildCmd=0 -BuildCmd=$(CC) -c ogl_win.c -o ../../../objs/Mingw/r_minigl/ogl_win.o $(CFLAGS) - -[Unit2] -FileName=..\r_opengl\r_opengl.c -Folder= -Compile=0 -CompileCpp=0 -Link=0 -Priority=1000 -OverrideBuildCmd=0 -BuildCmd=$(CC) -c r_opengl.c -o ../../../objs/Mingw/r_minigl/r_opengl.o $(CFLAGS) - -[Unit3] -FileName=..\r_opengl\r_opengl.h -Folder= -Compile=1 -CompileCpp=1 -Link=1 -Priority=1000 -OverrideBuildCmd=0 -BuildCmd= - -[VersionInfo] -Major=0 -Minor=1 -Release=1 -Build=1 -LanguageID=1033 -CharsetID=1252 -CompanyName= -FileVersion=0.1 -FileDescription=Developed using the Dev-C++ IDE -InternalName= -LegalCopyright= -LegalTrademarks= -OriginalFilename=r_opengl.exe -ProductName=r_opengl -ProductVersion=0.1 -AutoIncBuildNr=0 - -[Unit4] -FileName=r_minigl.c -CompileCpp=0 -Folder=r_minigl -Compile=1 -Link=1 -Priority=1000 -OverrideBuildCmd=0 -BuildCmd=$(CC) -c r_minigl.c -o ../../../objs/Mingw/r_minigl/r_minigl.o $(CFLAGS) - diff --git a/src/hardware/r_minigl/r_minigl.dsp b/src/hardware/r_minigl/r_minigl.dsp deleted file mode 100644 index 686ca35a3..000000000 --- a/src/hardware/r_minigl/r_minigl.dsp +++ /dev/null @@ -1,103 +0,0 @@ -# Microsoft Developer Studio Project File - Name="r_minigl" - Package Owner=<4> -# Microsoft Developer Studio Generated Build File, Format Version 6.00 -# ** DO NOT EDIT ** - -# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102 - -CFG=r_minigl - Win32 Debug -!MESSAGE This is not a valid makefile. To build this project using NMAKE, -!MESSAGE use the Export Makefile command and run -!MESSAGE -!MESSAGE NMAKE /f "r_minigl.mak". -!MESSAGE -!MESSAGE You can specify a configuration when running NMAKE -!MESSAGE by defining the macro CFG on the command line. For example: -!MESSAGE -!MESSAGE NMAKE /f "r_minigl.mak" CFG="r_minigl - Win32 Debug" -!MESSAGE -!MESSAGE Possible choices for configuration are: -!MESSAGE -!MESSAGE "r_minigl - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library") -!MESSAGE "r_minigl - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library") -!MESSAGE - -# Begin Project -# PROP AllowPerConfigDependencies 0 -# PROP Scc_ProjName "" -# PROP Scc_LocalPath "" -CPP=cl.exe -MTL=midl.exe -RSC=rc.exe - -!IF "$(CFG)" == "r_minigl - Win32 Release" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 0 -# PROP BASE Output_Dir "..\..\..\objs\Release" -# PROP BASE Intermediate_Dir "..\..\..\objs\Release" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 0 -# PROP Output_Dir "..\..\..\bin\VC\Release\r_minigl" -# PROP Intermediate_Dir "..\..\..\objs\VC\Release\r_minigl" -# PROP Ignore_Export_Lib 1 -# PROP Target_Dir "" -# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "R_MINIGL_EXPORTS" /YX /FD /c -# ADD CPP /nologo /G5 /MT /W3 /GX /Zi /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "__WIN32__" /D "__MSC__" /FR /FD /c -# SUBTRACT CPP /YX -# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32 -# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32 -# ADD BASE RSC /l 0x80c /d "NDEBUG" -# ADD RSC /l 0x40c /d "NDEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386 -# ADD LINK32 user32.lib gdi32.lib /nologo /dll /pdb:"..\..\..\bin\VC\Release\r_minigl.pdb" /machine:I386 /out:"..\..\..\bin\VC\Release\r_minigl.dll" -# SUBTRACT LINK32 /pdb:none /debug - -!ELSEIF "$(CFG)" == "r_minigl - Win32 Debug" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 1 -# PROP BASE Output_Dir "..\..\..\objs\Debug" -# PROP BASE Intermediate_Dir "..\..\..\objs\Debug" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 1 -# PROP Output_Dir "..\..\..\bin\VC\Debug\r_minigl" -# PROP Intermediate_Dir "..\..\..\objs\VC\Debug\r_minigl" -# PROP Ignore_Export_Lib 1 -# PROP Target_Dir "" -# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "R_MINIGL_EXPORTS" /YX /FD /GZ /c -# ADD CPP /nologo /MTd /W4 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "__WIN32__" /D "__MSC__" /D "_MBCS" /D "_USRDLL" /D "R_MINIGL_EXPORTS" /FR /FD /GZ /c -# SUBTRACT CPP /YX -# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32 -# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32 -# ADD BASE RSC /l 0x80c /d "_DEBUG" -# ADD RSC /l 0x40c /d "_DEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /pdbtype:sept -# ADD LINK32 ouser32.lib gdi32.lib /nologo /dll /pdb:"..\..\..\bin\VC\Debug\r_minigl.pdb" /debug /machine:I386 /out:"..\..\..\bin\VC\Debug\r_minigl.dll" /pdbtype:sept -# SUBTRACT LINK32 /pdb:none - -!ENDIF - -# Begin Target - -# Name "r_minigl - Win32 Release" -# Name "r_minigl - Win32 Debug" -# Begin Source File - -SOURCE=.\r_minigl.c -# End Source File -# Begin Source File - -SOURCE=..\r_opengl\r_opengl.h -# End Source File -# End Target -# End Project diff --git a/src/hardware/r_opengl/r_opengl.c b/src/hardware/r_opengl/r_opengl.c index 816c4758c..415e6648f 100644 --- a/src/hardware/r_opengl/r_opengl.c +++ b/src/hardware/r_opengl/r_opengl.c @@ -945,9 +945,7 @@ EXPORT void HWRAPI(Draw2DLine) (F2DCoord * v1, static void Clamp2D(GLenum pname) { pglTexParameteri(GL_TEXTURE_2D, pname, GL_CLAMP); // fallback clamp -#ifdef GL_CLAMP_TO_EDGE pglTexParameteri(GL_TEXTURE_2D, pname, GL_CLAMP_TO_EDGE); -#endif } @@ -1002,7 +1000,6 @@ EXPORT void HWRAPI(SetBlend) (FBITFIELD PolyFlags) break; } } - if (Xor & PF_NoAlphaTest) { if (PolyFlags & PF_NoAlphaTest) @@ -1231,15 +1228,11 @@ EXPORT void HWRAPI(SetTexture) (FTextureInfo *pTexInfo) if (MipMap) { pgluBuild2DMipmaps(GL_TEXTURE_2D, GL_LUMINANCE_ALPHA, w, h, GL_RGBA, GL_UNSIGNED_BYTE, ptex); -#ifdef GL_TEXTURE_MIN_LOD pglTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_LOD, 0); -#endif -#ifdef GL_TEXTURE_MAX_LOD if (pTexInfo->flags & TF_TRANSPARENT) pglTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAX_LOD, 0); // No mippmaps on transparent stuff else pglTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAX_LOD, 4); -#endif //pglTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_LINEAR_MIPMAP_LINEAR); } else @@ -1251,15 +1244,11 @@ EXPORT void HWRAPI(SetTexture) (FTextureInfo *pTexInfo) if (MipMap) { pgluBuild2DMipmaps(GL_TEXTURE_2D, GL_ALPHA, w, h, GL_RGBA, GL_UNSIGNED_BYTE, ptex); -#ifdef GL_TEXTURE_MIN_LOD pglTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_LOD, 0); -#endif -#ifdef GL_TEXTURE_MAX_LOD if (pTexInfo->flags & TF_TRANSPARENT) pglTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAX_LOD, 0); // No mippmaps on transparent stuff else pglTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAX_LOD, 4); -#endif //pglTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_LINEAR_MIPMAP_LINEAR); } else @@ -1271,15 +1260,11 @@ EXPORT void HWRAPI(SetTexture) (FTextureInfo *pTexInfo) { pgluBuild2DMipmaps(GL_TEXTURE_2D, textureformatGL, w, h, GL_RGBA, GL_UNSIGNED_BYTE, ptex); // Control the mipmap level of detail -#ifdef GL_TEXTURE_MIN_LOD pglTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_LOD, 0); // the lower the number, the higer the detail -#endif -#ifdef GL_TEXTURE_MAX_LOD if (pTexInfo->flags & TF_TRANSPARENT) pglTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAX_LOD, 0); // No mippmaps on transparent stuff else pglTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAX_LOD, 5); -#endif } else pglTexImage2D(GL_TEXTURE_2D, 0, textureformatGL, w, h, 0, GL_RGBA, GL_UNSIGNED_BYTE, ptex); diff --git a/src/hu_stuff.c b/src/hu_stuff.c index a9a2b7504..f86100e27 100644 --- a/src/hu_stuff.c +++ b/src/hu_stuff.c @@ -69,6 +69,7 @@ patch_t *nightsnum[10]; // 0-9 // Level title and credits fonts patch_t *lt_font[LT_FONTSIZE]; patch_t *cred_font[CRED_FONTSIZE]; +patch_t *ttlnum[20]; // act numbers (0-19) static player_t *plr; boolean chat_on; // entering a chat message? @@ -84,15 +85,16 @@ patch_t *rmatcico; patch_t *bmatcico; patch_t *tagico; patch_t *tallminus; +patch_t *tallinfin; //------------------------------------------- // coop hud //------------------------------------------- -patch_t *emeraldpics[7]; -patch_t *tinyemeraldpics[7]; +patch_t *emeraldpics[3][8]; // 0 = normal, 1 = tiny, 2 = coinbox static patch_t *emblemicon; -static patch_t *tokenicon; +patch_t *tokenicon; +static patch_t *exiticon; //------------------------------------------- // misc vars @@ -199,21 +201,6 @@ void HU_LoadGraphics(void) tny_font[i] = (patch_t *)W_CachePatchName(buffer, PU_HUDGFX); } - // cache the level title font for entire game execution - lt_font[0] = (patch_t *)W_CachePatchName("LTFNT039", PU_HUDGFX); /// \note fake start hack - - // Number support - lt_font[9] = (patch_t *)W_CachePatchName("LTFNT048", PU_HUDGFX); - lt_font[10] = (patch_t *)W_CachePatchName("LTFNT049", PU_HUDGFX); - lt_font[11] = (patch_t *)W_CachePatchName("LTFNT050", PU_HUDGFX); - lt_font[12] = (patch_t *)W_CachePatchName("LTFNT051", PU_HUDGFX); - lt_font[13] = (patch_t *)W_CachePatchName("LTFNT052", PU_HUDGFX); - lt_font[14] = (patch_t *)W_CachePatchName("LTFNT053", PU_HUDGFX); - lt_font[15] = (patch_t *)W_CachePatchName("LTFNT054", PU_HUDGFX); - lt_font[16] = (patch_t *)W_CachePatchName("LTFNT055", PU_HUDGFX); - lt_font[17] = (patch_t *)W_CachePatchName("LTFNT056", PU_HUDGFX); - lt_font[18] = (patch_t *)W_CachePatchName("LTFNT057", PU_HUDGFX); - j = LT_FONTSTART; for (i = 0; i < LT_FONTSIZE; i++) { @@ -250,6 +237,14 @@ void HU_LoadGraphics(void) // minus for negative tallnums tallminus = (patch_t *)W_CachePatchName("STTMINUS", PU_HUDGFX); + tallinfin = (patch_t *)W_CachePatchName("STTINFIN", PU_HUDGFX); + + // cache act numbers for level titles + for (i = 0; i < 20; i++) + { + sprintf(buffer, "TTL%.2d", i); + ttlnum[i] = (patch_t *)W_CachePatchName(buffer, PU_HUDGFX); + } // cache the crosshairs, don't bother to know which one is being used, // just cache all 3, they're so small anyway. @@ -261,21 +256,34 @@ void HU_LoadGraphics(void) emblemicon = W_CachePatchName("EMBLICON", PU_HUDGFX); tokenicon = W_CachePatchName("TOKNICON", PU_HUDGFX); + exiticon = W_CachePatchName("EXITICON", PU_HUDGFX); - emeraldpics[0] = W_CachePatchName("CHAOS1", PU_HUDGFX); - emeraldpics[1] = W_CachePatchName("CHAOS2", PU_HUDGFX); - emeraldpics[2] = W_CachePatchName("CHAOS3", PU_HUDGFX); - emeraldpics[3] = W_CachePatchName("CHAOS4", PU_HUDGFX); - emeraldpics[4] = W_CachePatchName("CHAOS5", PU_HUDGFX); - emeraldpics[5] = W_CachePatchName("CHAOS6", PU_HUDGFX); - emeraldpics[6] = W_CachePatchName("CHAOS7", PU_HUDGFX); - tinyemeraldpics[0] = W_CachePatchName("TEMER1", PU_HUDGFX); - tinyemeraldpics[1] = W_CachePatchName("TEMER2", PU_HUDGFX); - tinyemeraldpics[2] = W_CachePatchName("TEMER3", PU_HUDGFX); - tinyemeraldpics[3] = W_CachePatchName("TEMER4", PU_HUDGFX); - tinyemeraldpics[4] = W_CachePatchName("TEMER5", PU_HUDGFX); - tinyemeraldpics[5] = W_CachePatchName("TEMER6", PU_HUDGFX); - tinyemeraldpics[6] = W_CachePatchName("TEMER7", PU_HUDGFX); + emeraldpics[0][0] = W_CachePatchName("CHAOS1", PU_HUDGFX); + emeraldpics[0][1] = W_CachePatchName("CHAOS2", PU_HUDGFX); + emeraldpics[0][2] = W_CachePatchName("CHAOS3", PU_HUDGFX); + emeraldpics[0][3] = W_CachePatchName("CHAOS4", PU_HUDGFX); + emeraldpics[0][4] = W_CachePatchName("CHAOS5", PU_HUDGFX); + emeraldpics[0][5] = W_CachePatchName("CHAOS6", PU_HUDGFX); + emeraldpics[0][6] = W_CachePatchName("CHAOS7", PU_HUDGFX); + emeraldpics[0][7] = W_CachePatchName("CHAOS8", PU_HUDGFX); + + emeraldpics[1][0] = W_CachePatchName("TEMER1", PU_HUDGFX); + emeraldpics[1][1] = W_CachePatchName("TEMER2", PU_HUDGFX); + emeraldpics[1][2] = W_CachePatchName("TEMER3", PU_HUDGFX); + emeraldpics[1][3] = W_CachePatchName("TEMER4", PU_HUDGFX); + emeraldpics[1][4] = W_CachePatchName("TEMER5", PU_HUDGFX); + emeraldpics[1][5] = W_CachePatchName("TEMER6", PU_HUDGFX); + emeraldpics[1][6] = W_CachePatchName("TEMER7", PU_HUDGFX); + //emeraldpics[1][7] = W_CachePatchName("TEMER8", PU_HUDGFX); -- unused + + emeraldpics[2][0] = W_CachePatchName("EMBOX1", PU_HUDGFX); + emeraldpics[2][1] = W_CachePatchName("EMBOX2", PU_HUDGFX); + emeraldpics[2][2] = W_CachePatchName("EMBOX3", PU_HUDGFX); + emeraldpics[2][3] = W_CachePatchName("EMBOX4", PU_HUDGFX); + emeraldpics[2][4] = W_CachePatchName("EMBOX5", PU_HUDGFX); + emeraldpics[2][5] = W_CachePatchName("EMBOX6", PU_HUDGFX); + emeraldpics[2][6] = W_CachePatchName("EMBOX7", PU_HUDGFX); + //emeraldpics[2][7] = W_CachePatchName("EMBOX8", PU_HUDGFX); -- unused } // Initialise Heads up @@ -424,7 +432,7 @@ void HU_AddChatText(const char *text, boolean playsound) static void DoSayCommand(SINT8 target, size_t usedargs, UINT8 flags) { - XBOXSTATIC char buf[254]; + char buf[254]; size_t numwords, ix; char *msg = &buf[2]; const size_t msgspace = sizeof buf - 2; @@ -622,7 +630,7 @@ static void Got_Saycmd(UINT8 **p, INT32 playernum) player_names[playernum]); if (server) { - XBOXSTATIC UINT8 buf[2]; + UINT8 buf[2]; buf[0] = (UINT8)playernum; buf[1] = KICK_MSG_CON_FAIL; @@ -642,7 +650,7 @@ static void Got_Saycmd(UINT8 **p, INT32 playernum) CONS_Alert(CONS_WARNING, M_GetText("Illegal say command received from %s containing invalid characters\n"), player_names[playernum]); if (server) { - XBOXSTATIC char buf[2]; + char buf[2]; buf[0] = (char)playernum; buf[1] = KICK_MSG_CON_FAIL; @@ -742,26 +750,103 @@ static void Got_Saycmd(UINT8 **p, INT32 playernum) cstart = "\x83"; - if (color <= SKINCOLOR_SILVER) - cstart = "\x80"; // White - else if (color <= SKINCOLOR_BLACK) - cstart = "\x86"; // Grey - else if (color <= SKINCOLOR_BLUE) - cstart = "\x84"; // Blue - else if (color <= SKINCOLOR_PEACH) - cstart = "\x87"; //... Orange??? - else if (color == SKINCOLOR_PINK) - cstart = "\x85"; // Red. - else if (color <= SKINCOLOR_PURPLE) - cstart = "\x81"; // Purple - else if (color <= SKINCOLOR_ROSEWOOD) - cstart = "\x87"; // Orange - else if (color <= SKINCOLOR_DARKRED) - cstart = "\x85"; // Red - else if (color <= SKINCOLOR_OLIVE) - cstart = "\x83"; // green - else if (color <= SKINCOLOR_GOLD) - cstart = "\x82"; // Yellow + // Follow palette order at r_draw.c Color_Names + switch (color) + { + default: + case SKINCOLOR_WHITE: + case SKINCOLOR_BONE: + case SKINCOLOR_CLOUDY: + case SKINCOLOR_GREY: + case SKINCOLOR_SILVER: + case SKINCOLOR_AETHER: + case SKINCOLOR_SLATE: + cstart = "\x80"; // white + break; + case SKINCOLOR_CARBON: + case SKINCOLOR_JET: + case SKINCOLOR_BLACK: + cstart = "\x86"; // V_GRAYMAP + break; + case SKINCOLOR_PINK: + case SKINCOLOR_RUBY: + case SKINCOLOR_SALMON: + case SKINCOLOR_RED: + case SKINCOLOR_CRIMSON: + case SKINCOLOR_FLAME: + cstart = "\x85"; // V_REDMAP + break; + case SKINCOLOR_YOGURT: + case SKINCOLOR_BROWN: + case SKINCOLOR_TAN: + case SKINCOLOR_BEIGE: + case SKINCOLOR_QUAIL: + cstart = "\x8d"; // V_BROWNMAP + break; + case SKINCOLOR_MOSS: + case SKINCOLOR_GREEN: + case SKINCOLOR_FOREST: + case SKINCOLOR_EMERALD: + case SKINCOLOR_MINT: + cstart = "\x83"; // V_GREENMAP + break; + case SKINCOLOR_AZURE: + cstart = "\x8c"; // V_AZUREMAP + break; + case SKINCOLOR_LAVENDER: + case SKINCOLOR_PASTEL: + case SKINCOLOR_PURPLE: + cstart = "\x89"; // V_PURPLEMAP + break; + case SKINCOLOR_PEACHY: + case SKINCOLOR_LILAC: + case SKINCOLOR_PLUM: + case SKINCOLOR_ROSY: + cstart = "\x8e"; // V_ROSYMAP + break; + case SKINCOLOR_SUNSET: + case SKINCOLOR_APRICOT: + case SKINCOLOR_ORANGE: + case SKINCOLOR_RUST: + cstart = "\x87"; // V_ORANGEMAP + break; + case SKINCOLOR_GOLD: + case SKINCOLOR_SANDY: + case SKINCOLOR_YELLOW: + case SKINCOLOR_OLIVE: + cstart = "\x82"; // V_YELLOWMAP + break; + case SKINCOLOR_LIME: + case SKINCOLOR_PERIDOT: + cstart = "\x8b"; // V_PERIDOTMAP + break; + case SKINCOLOR_SEAFOAM: + case SKINCOLOR_AQUA: + cstart = "\x8a"; // V_AQUAMAP + break; + case SKINCOLOR_TEAL: + case SKINCOLOR_WAVE: + case SKINCOLOR_CYAN: + case SKINCOLOR_SKY: + case SKINCOLOR_CERULEAN: + case SKINCOLOR_ICY: + case SKINCOLOR_SAPPHIRE: + case SKINCOLOR_VAPOR: + cstart = "\x88"; // V_SKYMAP + break; + case SKINCOLOR_CORNFLOWER: + case SKINCOLOR_BLUE: + case SKINCOLOR_COBALT: + case SKINCOLOR_DUSK: + cstart = "\x84"; // V_BLUEMAP + break; + case SKINCOLOR_BUBBLEGUM: + case SKINCOLOR_MAGENTA: + case SKINCOLOR_NEON: + case SKINCOLOR_VIOLET: + cstart = "\x81"; // V_MAGENTAMAP + break; + } } prefix = cstart; @@ -1304,7 +1389,7 @@ static char *CHAT_WordWrap(INT32 x, INT32 w, INT32 option, const char *string) // 30/7/18: chaty is now the distance at which the lowest point of the chat will be drawn if that makes any sense. -INT16 chatx = 13, chaty = 169; // let's use this as our coordinates, shh +INT16 chatx = 13, chaty = 169; // let's use this as our coordinates // chat stuff by VincyTM LOL XD! @@ -1383,7 +1468,6 @@ static void HU_drawMiniChat(void) if (splitscreen > 1) y += 16; }*/ - y -= (G_RingSlingerGametype() ? 16 : 0); dx = 0; dy = 0; @@ -1479,12 +1563,10 @@ static void HU_drawChatLog(INT32 offset) if (splitscreen) { y -= BASEVIDHEIGHT/2; - if (splitscreen > 1) - y += 16; + //if (splitscreen > 1) + //y += 16; } #endif - y -= (G_RingSlingerGametype() ? 16 : 0); - chat_topy = y + chat_scroll*charheight; chat_bottomy = chat_topy + boxh*charheight; @@ -1556,10 +1638,11 @@ static void HU_drawChatLog(INT32 offset) chat_scroll = chat_maxscroll; // draw arrows to indicate that we can (or not) scroll. + // account for Y = -1 offset in tinyfont if (chat_scroll > 0) - V_DrawThinString(chatx-8, ((justscrolledup) ? (chat_topy-1) : (chat_topy)), V_SNAPTOBOTTOM | V_SNAPTOLEFT | V_YELLOWMAP, "\x1A"); // up arrow + V_DrawThinString(chatx-8, ((justscrolledup) ? (chat_topy-1) : (chat_topy)) - 1, V_SNAPTOBOTTOM | V_SNAPTOLEFT | V_YELLOWMAP, "\x1A"); // up arrow if (chat_scroll < chat_maxscroll) - V_DrawThinString(chatx-8, chat_bottomy-((justscrolleddown) ? 5 : 6), V_SNAPTOBOTTOM | V_SNAPTOLEFT | V_YELLOWMAP, "\x1B"); // down arrow + V_DrawThinString(chatx-8, chat_bottomy-((justscrolleddown) ? 5 : 6) - 1, V_SNAPTOBOTTOM | V_SNAPTOLEFT | V_YELLOWMAP, "\x1B"); // down arrow justscrolleddown = false; justscrolledup = false; @@ -1593,7 +1676,6 @@ static void HU_DrawChat(void) } } #endif - y -= (G_RingSlingerGametype() ? 16 : 0); if (teamtalk) { @@ -1686,7 +1768,6 @@ static void HU_DrawChat(void) p_dispy += 16; } #endif - p_dispy -= (G_RingSlingerGametype() ? 16 : 0); i = 0; for(i=0; (iwidth) * con_scalefactor; - V_DrawCharacter(HU_INPUTX + c, y, talk[i++] | cv_constextsize.value | V_NOSCALESTART, !cv_allcaps.value); + V_DrawCharacter(HU_INPUTX + c, y, talk[i++] | cv_constextsize.value | V_NOSCALESTART, true); } c += charwidth; } @@ -1815,7 +1896,7 @@ static void HU_DrawChat_Old(void) else { //charwidth = SHORT(hu_font[w_chat[i]-HU_FONTSTART]->width) * con_scalefactor; - V_DrawCharacter(HU_INPUTX + c, y, w_chat[i++] | cv_constextsize.value | V_NOSCALESTART | t, !cv_allcaps.value); + V_DrawCharacter(HU_INPUTX + c, y, w_chat[i++] | cv_constextsize.value | V_NOSCALESTART | t, true); } c += charwidth; @@ -1825,6 +1906,9 @@ static void HU_DrawChat_Old(void) y += charheight; } } + + if (hu_tick < 4) + V_DrawCharacter(HU_INPUTX + c, y, '_' | cv_constextsize.value |V_NOSCALESTART|t, true); } #endif @@ -1890,7 +1974,7 @@ static void HU_DrawCEcho(void) INT32 y = (BASEVIDHEIGHT/2)-4; INT32 pnumlines = 0; - UINT32 realflags = cechoflags; + UINT32 realflags = cechoflags|V_PERPLAYER; // requested as part of splitscreen's stuff INT32 realalpha = (INT32)((cechoflags & V_ALPHAMASK) >> V_ALPHASHIFT); char *line; @@ -1933,6 +2017,12 @@ static void HU_DrawCEcho(void) *line = '\0'; V_DrawCenteredString(BASEVIDWIDTH/2, y, realflags, echoptr); + if (splitscreen) + { + stplyr = ((stplyr == &players[displayplayer]) ? &players[secondarydisplayplayer] : &players[displayplayer]); + V_DrawCenteredString(BASEVIDWIDTH/2, y, realflags, echoptr); + stplyr = ((stplyr == &players[displayplayer]) ? &players[secondarydisplayplayer] : &players[displayplayer]); + } y += ((realflags & V_RETURN8) ? 8 : 12); echoptr = line; @@ -1966,25 +2056,29 @@ UINT16 hu_demorings; static void HU_DrawDemoInfo(void) { - V_DrawString(4, 188-24, V_YELLOWMAP, va(M_GetText("%s's replay"), player_names[0])); + INT32 h = 188; + if (modeattacking == ATTACKING_NIGHTS) + h -= 12; + + V_DrawString(4, h-24, V_YELLOWMAP|V_ALLOWLOWERCASE, va(M_GetText("%s's replay"), player_names[0])); if (modeattacking) { - V_DrawString(4, 188-16, V_YELLOWMAP|V_MONOSPACE, "SCORE:"); - V_DrawRightAlignedString(120, 188-16, V_MONOSPACE, va("%d", hu_demoscore)); + V_DrawString(4, h-16, V_YELLOWMAP|V_MONOSPACE, "SCORE:"); + V_DrawRightAlignedString(120, h-16, V_MONOSPACE, va("%d", hu_demoscore)); - V_DrawString(4, 188- 8, V_YELLOWMAP|V_MONOSPACE, "TIME:"); + V_DrawString(4, h-8, V_YELLOWMAP|V_MONOSPACE, "TIME:"); if (hu_demotime != UINT32_MAX) - V_DrawRightAlignedString(120, 188- 8, V_MONOSPACE, va("%i:%02i.%02i", + V_DrawRightAlignedString(120, h-8, V_MONOSPACE, va("%i:%02i.%02i", G_TicsToMinutes(hu_demotime,true), G_TicsToSeconds(hu_demotime), G_TicsToCentiseconds(hu_demotime))); else - V_DrawRightAlignedString(120, 188- 8, V_MONOSPACE, "--:--.--"); + V_DrawRightAlignedString(120, h-8, V_MONOSPACE, "--:--.--"); if (modeattacking == ATTACKING_RECORD) { - V_DrawString(4, 188 , V_YELLOWMAP|V_MONOSPACE, "RINGS:"); - V_DrawRightAlignedString(120, 188 , V_MONOSPACE, va("%d", hu_demorings)); + V_DrawString(4, h, V_YELLOWMAP|V_MONOSPACE, "RINGS:"); + V_DrawRightAlignedString(120, h, V_MONOSPACE, va("%d", hu_demorings)); } } } @@ -2091,6 +2185,31 @@ void HU_Drawer(void) V_DrawCenteredString(BASEVIDWIDTH/2, 180, V_YELLOWMAP | V_ALLOWLOWERCASE, resynch_text); } + + if (modeattacking && pausedelay > 0 && !pausebreakkey) + { + INT32 strength = ((pausedelay - 1 - NEWTICRATE/2)*10)/(NEWTICRATE/3); + INT32 y = hudinfo[HUD_LIVES].y - 13; + + if (players[consoleplayer].powers[pw_carry] == CR_NIGHTSMODE) + y -= 16; + else + { + if (players[consoleplayer].pflags & PF_AUTOBRAKE) + y -= 8; + if (players[consoleplayer].pflags & PF_ANALOGMODE) + y -= 8; + } + + V_DrawThinString(hudinfo[HUD_LIVES].x-2, y, + hudinfo[HUD_LIVES].f|((leveltime & 4) ? V_SKYMAP : V_BLUEMAP), + "HOLD TO RETRY..."); + + if (strength > 9) + V_DrawFill(0, 0, BASEVIDWIDTH, BASEVIDHEIGHT, 0); + else if (strength > 0) + V_DrawFadeScreen(0, strength); + } } //====================================================================== @@ -2167,13 +2286,16 @@ void HU_Erase(void) // IN-LEVEL MULTIPLAYER RANKINGS //====================================================================== +#define supercheckdef ((players[tab[i].num].powers[pw_super] && players[tab[i].num].mo && (players[tab[i].num].mo->state < &states[S_PLAY_SUPER_TRANS1] || players[tab[i].num].mo->state >= &states[S_PLAY_SUPER_TRANS6])) || (players[tab[i].num].powers[pw_carry] == CR_NIGHTSMODE && skins[players[tab[i].num].skin].flags & SF_SUPER)) +#define greycheckdef (players[tab[i].num].spectator || players[tab[i].num].playerstate == PST_DEAD || (G_IsSpecialStage(gamemap) && players[tab[i].num].exiting)) + // // HU_drawPing // void HU_drawPing(INT32 x, INT32 y, INT32 ping, boolean notext) { UINT8 numbars = 1; // how many ping bars do we draw? - UINT8 barcolor = 128; // color we use for the bars (green, yellow or red) + UINT8 barcolor = 35; // color we use for the bars (green, yellow or red) SINT8 i = 0; SINT8 yoffset = 6; INT32 dx = x+1 - (V_SmallStringWidth(va("%dms", ping), V_ALLOWLOWERCASE)/2); @@ -2181,12 +2303,12 @@ void HU_drawPing(INT32 x, INT32 y, INT32 ping, boolean notext) if (ping < 128) { numbars = 3; - barcolor = 184; + barcolor = 112; } else if (ping < 256) { numbars = 2; // Apparently ternaries w/ multiple statements don't look good in C so I decided against it. - barcolor = 103; + barcolor = 73; } if (!notext || vid.width >= 640) // how sad, we're using a shit resolution. @@ -2209,6 +2331,7 @@ void HU_DrawTabRankings(INT32 x, INT32 y, playersort_t *tab, INT32 scorelines, I { INT32 i; const UINT8 *colormap; + boolean greycheck, supercheck; //this function is designed for 9 or less score lines only I_Assert(scorelines <= 9); @@ -2217,9 +2340,12 @@ void HU_DrawTabRankings(INT32 x, INT32 y, playersort_t *tab, INT32 scorelines, I for (i = 0; i < scorelines; i++) { - if (players[tab[i].num].spectator) + if (players[tab[i].num].spectator && gametype != GT_COOP) continue; //ignore them. + greycheck = greycheckdef; + supercheck = supercheckdef; + if (!splitscreen) // don't draw it on splitscreen, { if (!(tab[i].num == serverplayer)) @@ -2230,17 +2356,19 @@ void HU_DrawTabRankings(INT32 x, INT32 y, playersort_t *tab, INT32 scorelines, I V_DrawString(x + 20, y, ((tab[i].num == whiteplayer) ? V_YELLOWMAP : 0) - | ((players[tab[i].num].health > 0) ? 0 : V_60TRANS) + | (greycheck ? V_60TRANS : 0) | V_ALLOWLOWERCASE, tab[i].name); // Draw emeralds - if (!players[tab[i].num].powers[pw_super] + if (players[tab[i].num].powers[pw_invulnerability] && (players[tab[i].num].powers[pw_invulnerability] == players[tab[i].num].powers[pw_sneakers]) && ((leveltime/7) & 1)) + HU_DrawEmeralds(x-12,y+2,255); + else if (!players[tab[i].num].powers[pw_super] || ((leveltime/7) & 1)) { HU_DrawEmeralds(x-12,y+2,tab[i].emeralds); } - if (players[tab[i].num].health <= 0) + if (greycheck) V_DrawSmallTranslucentPatch (x, y-4, V_80TRANS, livesback); else V_DrawSmallScaledPatch (x, y-4, 0, livesback); @@ -2248,11 +2376,11 @@ void HU_DrawTabRankings(INT32 x, INT32 y, playersort_t *tab, INT32 scorelines, I if (tab[i].color == 0) { colormap = colormaps; - if (players[tab[i].num].powers[pw_super]) + if (supercheck) V_DrawSmallScaledPatch(x, y-4, 0, superprefix[players[tab[i].num].skin]); else { - if (players[tab[i].num].health <= 0) + if (greycheck) V_DrawSmallTranslucentPatch(x, y-4, V_80TRANS, faceprefix[players[tab[i].num].skin]); else V_DrawSmallScaledPatch(x, y-4, 0, faceprefix[players[tab[i].num].skin]); @@ -2260,31 +2388,34 @@ void HU_DrawTabRankings(INT32 x, INT32 y, playersort_t *tab, INT32 scorelines, I } else { - if (players[tab[i].num].powers[pw_super]) + if (supercheck) { - colormap = R_GetTranslationColormap(players[tab[i].num].skin, players[tab[i].num].mo ? players[tab[i].num].mo->color : tab[i].color, GTC_CACHE); + colormap = R_GetTranslationColormap(players[tab[i].num].skin, players[tab[i].num].mo->color, GTC_CACHE); V_DrawSmallMappedPatch (x, y-4, 0, superprefix[players[tab[i].num].skin], colormap); } else { colormap = R_GetTranslationColormap(players[tab[i].num].skin, players[tab[i].num].mo ? players[tab[i].num].mo->color : tab[i].color, GTC_CACHE); - if (players[tab[i].num].health <= 0) + if (greycheck) V_DrawSmallTranslucentMappedPatch (x, y-4, V_80TRANS, faceprefix[players[tab[i].num].skin], colormap); else V_DrawSmallMappedPatch (x, y-4, 0, faceprefix[players[tab[i].num].skin], colormap); } } - if (G_GametypeUsesLives()) //show lives - V_DrawRightAlignedString(x, y+4, V_ALLOWLOWERCASE|((players[tab[i].num].health > 0) ? 0 : V_60TRANS), va("%dx", players[tab[i].num].lives)); + if (G_GametypeUsesLives() && !(gametype == GT_COOP && (cv_cooplives.value == 0 || cv_cooplives.value == 3)) && (players[tab[i].num].lives != INFLIVES)) //show lives + V_DrawRightAlignedString(x, y+4, V_ALLOWLOWERCASE|(greycheck ? V_60TRANS : 0), va("%dx", players[tab[i].num].lives)); else if (G_TagGametype() && players[tab[i].num].pflags & PF_TAGIT) { - if (players[tab[i].num].health <= 0) + if (greycheck) V_DrawSmallTranslucentPatch(x-32, y-4, V_60TRANS, tagico); else V_DrawSmallScaledPatch(x-32, y-4, 0, tagico); } + if (players[tab[i].num].exiting) + V_DrawSmallScaledPatch(x - SHORT(exiticon->width)/2 - 1, y-3, 0, exiticon); + if (gametype == GT_RACE) { if (circuitmap) @@ -2292,13 +2423,13 @@ void HU_DrawTabRankings(INT32 x, INT32 y, playersort_t *tab, INT32 scorelines, I if (players[tab[i].num].exiting) V_DrawRightAlignedString(x+240, y, 0, va("%i:%02i.%02i", G_TicsToMinutes(players[tab[i].num].realtime,true), G_TicsToSeconds(players[tab[i].num].realtime), G_TicsToCentiseconds(players[tab[i].num].realtime))); else - V_DrawRightAlignedString(x+240, y, ((players[tab[i].num].health > 0) ? 0 : V_60TRANS), va("%u", tab[i].count)); + V_DrawRightAlignedString(x+240, y, (greycheck ? V_60TRANS : 0), va("%u", tab[i].count)); } else - V_DrawRightAlignedString(x+240, y, ((players[tab[i].num].health > 0) ? 0 : V_60TRANS), va("%i:%02i.%02i", G_TicsToMinutes(tab[i].count,true), G_TicsToSeconds(tab[i].count), G_TicsToCentiseconds(tab[i].count))); + V_DrawRightAlignedString(x+240, y, (greycheck ? V_60TRANS : 0), va("%i:%02i.%02i", G_TicsToMinutes(tab[i].count,true), G_TicsToSeconds(tab[i].count), G_TicsToCentiseconds(tab[i].count))); } else - V_DrawRightAlignedString(x+240, y, ((players[tab[i].num].health > 0) ? 0 : V_60TRANS), va("%u", tab[i].count)); + V_DrawRightAlignedString(x+240, y, (greycheck ? V_60TRANS : 0), va("%u", tab[i].count)); y += 16; } @@ -2311,25 +2442,25 @@ static void HU_Draw32Emeralds(INT32 x, INT32 y, INT32 pemeralds) { //Draw the emeralds, in the CORRECT order, using tiny emerald sprites. if (pemeralds & EMERALD1) - V_DrawSmallScaledPatch(x , y, 0, tinyemeraldpics[0]); + V_DrawSmallScaledPatch(x , y, 0, emeraldpics[1][0]); if (pemeralds & EMERALD2) - V_DrawSmallScaledPatch(x+4, y, 0, tinyemeraldpics[1]); + V_DrawSmallScaledPatch(x+4, y, 0, emeraldpics[1][1]); if (pemeralds & EMERALD3) - V_DrawSmallScaledPatch(x+8, y, 0, tinyemeraldpics[2]); + V_DrawSmallScaledPatch(x+8, y, 0, emeraldpics[1][2]); if (pemeralds & EMERALD4) - V_DrawSmallScaledPatch(x+12 , y, 0, tinyemeraldpics[3]); + V_DrawSmallScaledPatch(x+12 , y, 0, emeraldpics[1][3]); if (pemeralds & EMERALD5) - V_DrawSmallScaledPatch(x+16, y, 0, tinyemeraldpics[4]); + V_DrawSmallScaledPatch(x+16, y, 0, emeraldpics[1][4]); if (pemeralds & EMERALD6) - V_DrawSmallScaledPatch(x+20, y, 0, tinyemeraldpics[5]); + V_DrawSmallScaledPatch(x+20, y, 0, emeraldpics[1][5]); if (pemeralds & EMERALD7) - V_DrawSmallScaledPatch(x+24, y, 0, tinyemeraldpics[6]); + V_DrawSmallScaledPatch(x+24, y, 0, emeraldpics[1][6]); } // @@ -2341,6 +2472,7 @@ static void HU_Draw32TeamTabRankings(playersort_t *tab, INT32 whiteplayer) INT32 redplayers = 0, blueplayers = 0; const UINT8 *colormap; char name[MAXPLAYERNAME+1]; + boolean greycheck, supercheck; V_DrawFill(160, 26, 1, 154, 0); //Draw a vertical line to separate the two teams. V_DrawFill(1, 26, 318, 1, 0); //And a horizontal line to make a T. @@ -2351,6 +2483,9 @@ static void HU_Draw32TeamTabRankings(playersort_t *tab, INT32 whiteplayer) if (players[tab[i].num].spectator) continue; //ignore them. + greycheck = greycheckdef; + supercheck = supercheckdef; + if (tab[i].color == skincolor_redteam) //red { redplayers++; @@ -2366,10 +2501,13 @@ static void HU_Draw32TeamTabRankings(playersort_t *tab, INT32 whiteplayer) else //er? not on red or blue, so ignore them continue; + greycheck = greycheckdef; + supercheck = supercheckdef; + strlcpy(name, tab[i].name, 8); V_DrawString(x + 10, y, ((tab[i].num == whiteplayer) ? V_YELLOWMAP : 0) - | ((players[tab[i].num].health > 0) ? 0 : V_TRANSLUCENT) + | (greycheck ? 0 : V_TRANSLUCENT) | V_ALLOWLOWERCASE, name); if (gametype == GT_CTF) @@ -2381,13 +2519,19 @@ static void HU_Draw32TeamTabRankings(playersort_t *tab, INT32 whiteplayer) } // Draw emeralds - if (!players[tab[i].num].powers[pw_super] + if (players[tab[i].num].powers[pw_invulnerability] && (players[tab[i].num].powers[pw_invulnerability] == players[tab[i].num].powers[pw_sneakers]) && ((leveltime/7) & 1)) + { + HU_Draw32Emeralds(x+60, y+2, 255); + //HU_DrawEmeralds(x-12,y+2,255); + } + else if (!players[tab[i].num].powers[pw_super] || ((leveltime/7) & 1)) { HU_Draw32Emeralds(x+60, y+2, tab[i].emeralds); + //HU_DrawEmeralds(x-12,y+2,tab[i].emeralds); } - if (players[tab[i].num].powers[pw_super]) + if (supercheck) { colormap = R_GetTranslationColormap(players[tab[i].num].skin, players[tab[i].num].mo ? players[tab[i].num].mo->color : tab[i].color, GTC_CACHE); V_DrawFixedPatch(x*FRACUNIT, y*FRACUNIT, FRACUNIT/4, 0, superprefix[players[tab[i].num].skin], colormap); @@ -2395,12 +2539,12 @@ static void HU_Draw32TeamTabRankings(playersort_t *tab, INT32 whiteplayer) else { colormap = R_GetTranslationColormap(players[tab[i].num].skin, players[tab[i].num].mo ? players[tab[i].num].mo->color : tab[i].color, GTC_CACHE); - if (players[tab[i].num].health <= 0) + if (players[tab[i].num].spectator || players[tab[i].num].playerstate == PST_DEAD) V_DrawFixedPatch(x*FRACUNIT, y*FRACUNIT, FRACUNIT/4, V_HUDTRANSHALF, faceprefix[players[tab[i].num].skin], colormap); else V_DrawFixedPatch(x*FRACUNIT, y*FRACUNIT, FRACUNIT/4, 0, faceprefix[players[tab[i].num].skin], colormap); } - V_DrawRightAlignedThinString(x+128, y, ((players[tab[i].num].health > 0) ? 0 : V_TRANSLUCENT), va("%u", tab[i].count)); + V_DrawRightAlignedThinString(x+128, y, ((players[tab[i].num].spectator || players[tab[i].num].playerstate == PST_DEAD) ? 0 : V_TRANSLUCENT), va("%u", tab[i].count)); if (!splitscreen) { if (!(tab[i].num == serverplayer)) @@ -2421,6 +2565,7 @@ void HU_DrawTeamTabRankings(playersort_t *tab, INT32 whiteplayer) boolean smol = false; const UINT8 *colormap; char name[MAXPLAYERNAME+1]; + boolean greycheck, supercheck; // before we draw, we must count how many players are in each team. It makes an additional loop, but we need to know if we have to draw a big or a small ranking. for (i = 0; i < MAXPLAYERS; i++) @@ -2484,10 +2629,13 @@ void HU_DrawTeamTabRankings(playersort_t *tab, INT32 whiteplayer) else //er? not on red or blue, so ignore them continue; + greycheck = greycheckdef; + supercheck = supercheckdef; + strlcpy(name, tab[i].name, 7); V_DrawString(x + 20, y, ((tab[i].num == whiteplayer) ? V_YELLOWMAP : 0) - | ((players[tab[i].num].health > 0) ? 0 : V_TRANSLUCENT) + | (greycheck ? V_TRANSLUCENT : 0) | V_ALLOWLOWERCASE, name); if (gametype == GT_CTF) @@ -2499,13 +2647,15 @@ void HU_DrawTeamTabRankings(playersort_t *tab, INT32 whiteplayer) } // Draw emeralds - if (!players[tab[i].num].powers[pw_super] + if (players[tab[i].num].powers[pw_invulnerability] && (players[tab[i].num].powers[pw_invulnerability] == players[tab[i].num].powers[pw_sneakers]) && ((leveltime/7) & 1)) + HU_DrawEmeralds(x-12,y+2,255); + else if (!players[tab[i].num].powers[pw_super] || ((leveltime/7) & 1)) { HU_DrawEmeralds(x-12,y+2,tab[i].emeralds); } - if (players[tab[i].num].powers[pw_super]) + if (supercheck) { colormap = R_GetTranslationColormap(players[tab[i].num].skin, players[tab[i].num].mo ? players[tab[i].num].mo->color : tab[i].color, GTC_CACHE); V_DrawSmallMappedPatch (x, y-4, 0, superprefix[players[tab[i].num].skin], colormap); @@ -2513,12 +2663,12 @@ void HU_DrawTeamTabRankings(playersort_t *tab, INT32 whiteplayer) else { colormap = R_GetTranslationColormap(players[tab[i].num].skin, players[tab[i].num].mo ? players[tab[i].num].mo->color : tab[i].color, GTC_CACHE); - if (players[tab[i].num].health <= 0) - V_DrawSmallTranslucentMappedPatch (x, y-4, 0, faceprefix[players[tab[i].num].skin], colormap); + if (greycheck) + V_DrawSmallTranslucentMappedPatch (x, y-4, V_80TRANS, faceprefix[players[tab[i].num].skin], colormap); else V_DrawSmallMappedPatch (x, y-4, 0, faceprefix[players[tab[i].num].skin], colormap); } - V_DrawRightAlignedThinString(x+100, y, ((players[tab[i].num].health > 0) ? 0 : V_TRANSLUCENT), va("%u", tab[i].count)); + V_DrawRightAlignedThinString(x+100, y, (greycheck ? V_TRANSLUCENT : 0), va("%u", tab[i].count)); if (!splitscreen) { if (!(tab[i].num == serverplayer)) @@ -2537,6 +2687,7 @@ void HU_DrawDualTabRankings(INT32 x, INT32 y, playersort_t *tab, INT32 scoreline INT32 i; const UINT8 *colormap; char name[MAXPLAYERNAME+1]; + boolean greycheck, supercheck; V_DrawFill(160, 26, 1, 154, 0); //Draw a vertical line to separate the two sides. V_DrawFill(1, 26, 318, 1, 0); //And a horizontal line to make a T. @@ -2544,9 +2695,12 @@ void HU_DrawDualTabRankings(INT32 x, INT32 y, playersort_t *tab, INT32 scoreline for (i = 0; i < scorelines; i++) { - if (players[tab[i].num].spectator) + if (players[tab[i].num].spectator && gametype != GT_COOP) continue; //ignore them. + greycheck = greycheckdef; + supercheck = supercheckdef; + strlcpy(name, tab[i].name, 7); if (!(tab[i].num == serverplayer)) HU_drawPing(x+ 113, y+2, playerpingtable[tab[i].num], false); @@ -2555,16 +2709,21 @@ void HU_DrawDualTabRankings(INT32 x, INT32 y, playersort_t *tab, INT32 scoreline V_DrawString(x + 20, y, ((tab[i].num == whiteplayer) ? V_YELLOWMAP : 0) - | ((players[tab[i].num].health > 0) ? 0 : V_TRANSLUCENT) + | (greycheck ? V_TRANSLUCENT : 0) | V_ALLOWLOWERCASE, name); - if (G_GametypeUsesLives()) //show lives + if (G_GametypeUsesLives() && !(gametype == GT_COOP && (cv_cooplives.value == 0 || cv_cooplives.value == 3)) && (players[tab[i].num].lives != INFLIVES)) //show lives V_DrawRightAlignedString(x, y+4, V_ALLOWLOWERCASE, va("%dx", players[tab[i].num].lives)); else if (G_TagGametype() && players[tab[i].num].pflags & PF_TAGIT) V_DrawSmallScaledPatch(x-28, y-4, 0, tagico); + if (players[tab[i].num].exiting) + V_DrawSmallScaledPatch(x - SHORT(exiticon->width)/2 - 1, y-3, 0, exiticon); + // Draw emeralds - if (!players[tab[i].num].powers[pw_super] + if (players[tab[i].num].powers[pw_invulnerability] && (players[tab[i].num].powers[pw_invulnerability] == players[tab[i].num].powers[pw_sneakers]) && ((leveltime/7) & 1)) + HU_DrawEmeralds(x-12,y+2,255); + else if (!players[tab[i].num].powers[pw_super] || ((leveltime/7) & 1)) { HU_DrawEmeralds(x-12,y+2,tab[i].emeralds); @@ -2574,19 +2733,19 @@ void HU_DrawDualTabRankings(INT32 x, INT32 y, playersort_t *tab, INT32 scoreline if (tab[i].color == 0) { colormap = colormaps; - if (players[tab[i].num].powers[pw_super]) + if (supercheck) V_DrawSmallScaledPatch (x, y-4, 0, superprefix[players[tab[i].num].skin]); else { - if (players[tab[i].num].health <= 0) - V_DrawSmallTranslucentPatch (x, y-4, 0, faceprefix[players[tab[i].num].skin]); + if (greycheck) + V_DrawSmallTranslucentPatch (x, y-4, V_80TRANS, faceprefix[players[tab[i].num].skin]); else V_DrawSmallScaledPatch (x, y-4, 0, faceprefix[players[tab[i].num].skin]); } } else { - if (players[tab[i].num].powers[pw_super]) + if (supercheck) { colormap = R_GetTranslationColormap(players[tab[i].num].skin, players[tab[i].num].mo ? players[tab[i].num].mo->color : tab[i].color, GTC_CACHE); V_DrawSmallMappedPatch (x, y-4, 0, superprefix[players[tab[i].num].skin], colormap); @@ -2594,8 +2753,8 @@ void HU_DrawDualTabRankings(INT32 x, INT32 y, playersort_t *tab, INT32 scoreline else { colormap = R_GetTranslationColormap(players[tab[i].num].skin, players[tab[i].num].mo ? players[tab[i].num].mo->color : tab[i].color, GTC_CACHE); - if (players[tab[i].num].health <= 0) - V_DrawSmallTranslucentMappedPatch (x, y-4, 0, faceprefix[players[tab[i].num].skin], colormap); + if (greycheck) + V_DrawSmallTranslucentMappedPatch (x, y-4, V_80TRANS, faceprefix[players[tab[i].num].skin], colormap); else V_DrawSmallMappedPatch (x, y-4, 0, faceprefix[players[tab[i].num].skin], colormap); } @@ -2609,13 +2768,13 @@ void HU_DrawDualTabRankings(INT32 x, INT32 y, playersort_t *tab, INT32 scoreline if (players[tab[i].num].exiting) V_DrawRightAlignedThinString(x+146, y, 0, va("%i:%02i.%02i", G_TicsToMinutes(players[tab[i].num].realtime,true), G_TicsToSeconds(players[tab[i].num].realtime), G_TicsToCentiseconds(players[tab[i].num].realtime))); else - V_DrawRightAlignedThinString(x+146, y, ((players[tab[i].num].health > 0) ? 0 : V_TRANSLUCENT), va("%u", tab[i].count)); + V_DrawRightAlignedThinString(x+146, y, (greycheck ? V_TRANSLUCENT : 0), va("%u", tab[i].count)); } else - V_DrawRightAlignedThinString(x+146, y, ((players[tab[i].num].health > 0) ? 0 : V_TRANSLUCENT), va("%i:%02i.%02i", G_TicsToMinutes(tab[i].count,true), G_TicsToSeconds(tab[i].count), G_TicsToCentiseconds(tab[i].count))); + V_DrawRightAlignedThinString(x+146, y, (greycheck ? V_TRANSLUCENT : 0), va("%i:%02i.%02i", G_TicsToMinutes(tab[i].count,true), G_TicsToSeconds(tab[i].count), G_TicsToCentiseconds(tab[i].count))); } else - V_DrawRightAlignedThinString(x+100, y, ((players[tab[i].num].health > 0) ? 0 : V_TRANSLUCENT), va("%u", tab[i].count)); + V_DrawRightAlignedThinString(x+100, y, (greycheck ? V_TRANSLUCENT : 0), va("%u", tab[i].count)); y += 16; if (y > 160) @@ -2634,6 +2793,7 @@ static void HU_Draw32TabRankings(INT32 x, INT32 y, playersort_t *tab, INT32 scor INT32 i; const UINT8 *colormap; char name[MAXPLAYERNAME+1]; + boolean greycheck, supercheck; V_DrawFill(160, 26, 1, 154, 0); //Draw a vertical line to separate the two sides. V_DrawFill(1, 26, 318, 1, 0); //And a horizontal line to make a T. @@ -2641,9 +2801,12 @@ static void HU_Draw32TabRankings(INT32 x, INT32 y, playersort_t *tab, INT32 scor for (i = 0; i < scorelines; i++) { - if (players[tab[i].num].spectator) + if (players[tab[i].num].spectator && gametype != GT_COOP) continue; //ignore them. + greycheck = greycheckdef; + supercheck = supercheckdef; + strlcpy(name, tab[i].name, 7); if (!splitscreen) // don't draw it on splitscreen, { @@ -2655,7 +2818,7 @@ static void HU_Draw32TabRankings(INT32 x, INT32 y, playersort_t *tab, INT32 scor V_DrawString(x + 10, y, ((tab[i].num == whiteplayer) ? V_YELLOWMAP : 0) - | ((players[tab[i].num].health > 0) ? 0 : V_TRANSLUCENT) + | (greycheck ? 0 : V_TRANSLUCENT) | V_ALLOWLOWERCASE, name); if (G_GametypeUsesLives()) //show lives @@ -2664,7 +2827,12 @@ static void HU_Draw32TabRankings(INT32 x, INT32 y, playersort_t *tab, INT32 scor V_DrawFixedPatch((x-10)*FRACUNIT, (y)*FRACUNIT, FRACUNIT/4, 0, tagico, 0); // Draw emeralds - if (!players[tab[i].num].powers[pw_super] + if (players[tab[i].num].powers[pw_invulnerability] && (players[tab[i].num].powers[pw_invulnerability] == players[tab[i].num].powers[pw_sneakers]) && ((leveltime/7) & 1)) + { + HU_Draw32Emeralds(x+60, y+2, 255); + //HU_DrawEmeralds(x-12,y+2,255); + } + else if (!players[tab[i].num].powers[pw_super] || ((leveltime/7) & 1)) { HU_Draw32Emeralds(x+60, y+2, tab[i].emeralds); @@ -2679,7 +2847,7 @@ static void HU_Draw32TabRankings(INT32 x, INT32 y, playersort_t *tab, INT32 scor V_DrawFixedPatch(x*FRACUNIT, y*FRACUNIT, FRACUNIT/4, 0, superprefix[players[tab[i].num].skin], 0); else { - if (players[tab[i].num].health <= 0) + if (greycheck) V_DrawFixedPatch(x*FRACUNIT, (y)*FRACUNIT, FRACUNIT/4, V_HUDTRANSHALF, faceprefix[players[tab[i].num].skin], 0); else V_DrawFixedPatch(x*FRACUNIT, (y)*FRACUNIT, FRACUNIT/4, 0, faceprefix[players[tab[i].num].skin], 0); @@ -2687,7 +2855,7 @@ static void HU_Draw32TabRankings(INT32 x, INT32 y, playersort_t *tab, INT32 scor } else { - if (players[tab[i].num].powers[pw_super]) + if (supercheck) { colormap = R_GetTranslationColormap(players[tab[i].num].skin, players[tab[i].num].mo ? players[tab[i].num].mo->color : tab[i].color, GTC_CACHE); V_DrawFixedPatch(x*FRACUNIT, y*FRACUNIT, FRACUNIT/4, 0, superprefix[players[tab[i].num].skin], colormap); @@ -2695,7 +2863,7 @@ static void HU_Draw32TabRankings(INT32 x, INT32 y, playersort_t *tab, INT32 scor else { colormap = R_GetTranslationColormap(players[tab[i].num].skin, players[tab[i].num].mo ? players[tab[i].num].mo->color : tab[i].color, GTC_CACHE); - if (players[tab[i].num].health <= 0) + if (greycheck) V_DrawFixedPatch(x*FRACUNIT, (y)*FRACUNIT, FRACUNIT/4, V_HUDTRANSHALF, faceprefix[players[tab[i].num].skin], colormap); else V_DrawFixedPatch(x*FRACUNIT, (y)*FRACUNIT, FRACUNIT/4, 0, faceprefix[players[tab[i].num].skin], colormap); @@ -2710,13 +2878,13 @@ static void HU_Draw32TabRankings(INT32 x, INT32 y, playersort_t *tab, INT32 scor if (players[tab[i].num].exiting) V_DrawRightAlignedThinString(x+128, y, 0, va("%i:%02i.%02i", G_TicsToMinutes(players[tab[i].num].realtime,true), G_TicsToSeconds(players[tab[i].num].realtime), G_TicsToCentiseconds(players[tab[i].num].realtime))); else - V_DrawRightAlignedThinString(x+128, y, ((players[tab[i].num].health > 0) ? 0 : V_TRANSLUCENT), va("%u", tab[i].count)); + V_DrawRightAlignedThinString(x+128, y, (greycheck ? 0 : V_TRANSLUCENT), va("%u", tab[i].count)); } else - V_DrawRightAlignedThinString(x+128, y, ((players[tab[i].num].health > 0) ? 0 : V_TRANSLUCENT), va("%i:%02i.%02i", G_TicsToMinutes(tab[i].count,true), G_TicsToSeconds(tab[i].count), G_TicsToCentiseconds(tab[i].count))); + V_DrawRightAlignedThinString(x+128, y, (greycheck ? 0 : V_TRANSLUCENT), va("%i:%02i.%02i", G_TicsToMinutes(tab[i].count,true), G_TicsToSeconds(tab[i].count), G_TicsToCentiseconds(tab[i].count))); } else - V_DrawRightAlignedThinString(x+128, y, ((players[tab[i].num].health > 0) ? 0 : V_TRANSLUCENT), va("%u", tab[i].count)); + V_DrawRightAlignedThinString(x+128, y, (greycheck ? 0 : V_TRANSLUCENT), va("%u", tab[i].count)); y += 9; if (i == 16) @@ -2734,25 +2902,25 @@ void HU_DrawEmeralds(INT32 x, INT32 y, INT32 pemeralds) { //Draw the emeralds, in the CORRECT order, using tiny emerald sprites. if (pemeralds & EMERALD1) - V_DrawSmallScaledPatch(x , y-6, 0, tinyemeraldpics[0]); + V_DrawSmallScaledPatch(x , y-6, 0, emeraldpics[1][0]); if (pemeralds & EMERALD2) - V_DrawSmallScaledPatch(x+4, y-3, 0, tinyemeraldpics[1]); + V_DrawSmallScaledPatch(x+4, y-3, 0, emeraldpics[1][1]); if (pemeralds & EMERALD3) - V_DrawSmallScaledPatch(x+4, y+3, 0, tinyemeraldpics[2]); + V_DrawSmallScaledPatch(x+4, y+3, 0, emeraldpics[1][2]); if (pemeralds & EMERALD4) - V_DrawSmallScaledPatch(x , y+6, 0, tinyemeraldpics[3]); + V_DrawSmallScaledPatch(x , y+6, 0, emeraldpics[1][3]); if (pemeralds & EMERALD5) - V_DrawSmallScaledPatch(x-4, y+3, 0, tinyemeraldpics[4]); + V_DrawSmallScaledPatch(x-4, y+3, 0, emeraldpics[1][4]); if (pemeralds & EMERALD6) - V_DrawSmallScaledPatch(x-4, y-3, 0, tinyemeraldpics[5]); + V_DrawSmallScaledPatch(x-4, y-3, 0, emeraldpics[1][5]); if (pemeralds & EMERALD7) - V_DrawSmallScaledPatch(x, y, 0, tinyemeraldpics[6]); + V_DrawSmallScaledPatch(x, y, 0, emeraldpics[1][6]); } // @@ -2807,7 +2975,7 @@ static inline void HU_DrawSpectatorTicker(void) templength = length; } - V_DrawString(templength, height + 8, V_TRANSLUCENT, current); + V_DrawString(templength, height + 8, V_TRANSLUCENT|V_ALLOWLOWERCASE, current); } length += (signed)strlen(player_names[i]) * 8 + 16; @@ -2819,7 +2987,6 @@ static inline void HU_DrawSpectatorTicker(void) // static void HU_DrawRankings(void) { - patch_t *p; playersort_t tab[MAXPLAYERS]; INT32 i, j, scorelines; boolean completed[MAXPLAYERS]; @@ -2828,43 +2995,12 @@ static void HU_DrawRankings(void) // draw the current gametype in the lower right HU_drawGametype(); - if (G_GametypeHasTeams()) - { - if (gametype == GT_CTF) - p = bflagico; - else - p = bmatcico; - - V_DrawSmallScaledPatch(128 - SHORT(p->width)/4, 4, 0, p); - V_DrawCenteredString(128, 16, 0, va("%u", bluescore)); - - if (gametype == GT_CTF) - p = rflagico; - else - p = rmatcico; - - V_DrawSmallScaledPatch(192 - SHORT(p->width)/4, 4, 0, p); - V_DrawCenteredString(192, 16, 0, va("%u", redscore)); - } - if (gametype != GT_RACE && gametype != GT_COMPETITION && gametype != GT_COOP) { if (cv_timelimit.value && timelimitintics > 0) { - INT32 timeval = (timelimitintics+1-leveltime)/TICRATE; - - if (leveltime <= timelimitintics) - { - V_DrawCenteredString(64, 8, 0, "TIME LEFT"); - V_DrawCenteredString(64, 16, 0, va("%u", timeval)); - } - - // overtime - if ((leveltime > (timelimitintics + TICRATE/2)) && cv_overtime.value) - { - V_DrawCenteredString(64, 8, 0, "TIME LEFT"); - V_DrawCenteredString(64, 16, 0, "OVERTIME"); - } + V_DrawCenteredString(64, 8, 0, "TIME"); + V_DrawCenteredString(64, 16, 0, va("%i:%02i", G_TicsToMinutes(stplyr->realtime, true), G_TicsToSeconds(stplyr->realtime))); } if (cv_pointlimit.value > 0) @@ -2913,61 +3049,67 @@ static void HU_DrawRankings(void) for (j = 0; j < MAXPLAYERS; j++) { - if (!playeringame[j] || players[j].spectator) + if (!playeringame[j]) + continue; + + if (gametype != GT_COOP && players[j].spectator) continue; for (i = 0; i < MAXPLAYERS; i++) { - if (playeringame[i] && !players[i].spectator) + if (!playeringame[i]) + continue; + + if (gametype != GT_COOP && players[i].spectator) + continue; + + if (gametype == GT_RACE) { - if (gametype == GT_RACE) + if (circuitmap) { - if (circuitmap) + if ((unsigned)players[i].laps+1 >= tab[scorelines].count && completed[i] == false) { - if ((unsigned)players[i].laps+1 >= tab[scorelines].count && completed[i] == false) - { - tab[scorelines].count = players[i].laps+1; - tab[scorelines].num = i; - tab[scorelines].color = players[i].skincolor; - tab[scorelines].name = player_names[i]; - } - } - else - { - if (players[i].realtime <= tab[scorelines].count && completed[i] == false) - { - tab[scorelines].count = players[i].realtime; - tab[scorelines].num = i; - tab[scorelines].color = players[i].skincolor; - tab[scorelines].name = player_names[i]; - } - } - } - else if (gametype == GT_COMPETITION) - { - // todo put something more fitting for the gametype here, such as current - // number of categories led - if (players[i].score >= tab[scorelines].count && completed[i] == false) - { - tab[scorelines].count = players[i].score; + tab[scorelines].count = players[i].laps+1; tab[scorelines].num = i; tab[scorelines].color = players[i].skincolor; tab[scorelines].name = player_names[i]; - tab[scorelines].emeralds = players[i].powers[pw_emeralds]; } } else { - if (players[i].score >= tab[scorelines].count && completed[i] == false) + if (players[i].realtime <= tab[scorelines].count && completed[i] == false) { - tab[scorelines].count = players[i].score; + tab[scorelines].count = players[i].realtime; tab[scorelines].num = i; tab[scorelines].color = players[i].skincolor; tab[scorelines].name = player_names[i]; - tab[scorelines].emeralds = players[i].powers[pw_emeralds]; } } } + else if (gametype == GT_COMPETITION) + { + // todo put something more fitting for the gametype here, such as current + // number of categories led + if (players[i].score >= tab[scorelines].count && completed[i] == false) + { + tab[scorelines].count = players[i].score; + tab[scorelines].num = i; + tab[scorelines].color = players[i].skincolor; + tab[scorelines].name = player_names[i]; + tab[scorelines].emeralds = players[i].powers[pw_emeralds]; + } + } + else + { + if (players[i].score >= tab[scorelines].count && completed[i] == false) + { + tab[scorelines].count = players[i].score; + tab[scorelines].num = i; + tab[scorelines].color = players[i].skincolor; + tab[scorelines].name = player_names[i]; + tab[scorelines].emeralds = players[i].powers[pw_emeralds]; + } + } } completed[tab[scorelines].num] = true; scorelines++; @@ -2978,7 +3120,7 @@ static void HU_DrawRankings(void) // shush, we'll do it anyway. if (G_GametypeHasTeams()) - HU_DrawTeamTabRankings(tab, whiteplayer); //separate function for Spazzo's silly request + HU_DrawTeamTabRankings(tab, whiteplayer); else if (scorelines <= 9 && !cv_compactscoreboard.value) HU_DrawTabRankings(40, 32, tab, scorelines, whiteplayer); else if (scorelines <= 20 && !cv_compactscoreboard.value) @@ -3018,25 +3160,35 @@ static void HU_DrawCoopOverlay(void) #endif if (emeralds & EMERALD1) - V_DrawScaledPatch((BASEVIDWIDTH/2)-8 , (BASEVIDHEIGHT/3)-32, 0, emeraldpics[0]); + V_DrawScaledPatch((BASEVIDWIDTH/2)-8 , (BASEVIDHEIGHT/3)-32, 0, emeraldpics[0][0]); if (emeralds & EMERALD2) - V_DrawScaledPatch((BASEVIDWIDTH/2)-8+24, (BASEVIDHEIGHT/3)-16, 0, emeraldpics[1]); + V_DrawScaledPatch((BASEVIDWIDTH/2)-8+24, (BASEVIDHEIGHT/3)-16, 0, emeraldpics[0][1]); if (emeralds & EMERALD3) - V_DrawScaledPatch((BASEVIDWIDTH/2)-8+24, (BASEVIDHEIGHT/3)+16, 0, emeraldpics[2]); + V_DrawScaledPatch((BASEVIDWIDTH/2)-8+24, (BASEVIDHEIGHT/3)+16, 0, emeraldpics[0][2]); if (emeralds & EMERALD4) - V_DrawScaledPatch((BASEVIDWIDTH/2)-8 , (BASEVIDHEIGHT/3)+32, 0, emeraldpics[3]); + V_DrawScaledPatch((BASEVIDWIDTH/2)-8 , (BASEVIDHEIGHT/3)+32, 0, emeraldpics[0][3]); if (emeralds & EMERALD5) - V_DrawScaledPatch((BASEVIDWIDTH/2)-8-24, (BASEVIDHEIGHT/3)+16, 0, emeraldpics[4]); + V_DrawScaledPatch((BASEVIDWIDTH/2)-8-24, (BASEVIDHEIGHT/3)+16, 0, emeraldpics[0][4]); if (emeralds & EMERALD6) - V_DrawScaledPatch((BASEVIDWIDTH/2)-8-24, (BASEVIDHEIGHT/3)-16, 0, emeraldpics[5]); + V_DrawScaledPatch((BASEVIDWIDTH/2)-8-24, (BASEVIDHEIGHT/3)-16, 0, emeraldpics[0][5]); if (emeralds & EMERALD7) - V_DrawScaledPatch((BASEVIDWIDTH/2)-8 , (BASEVIDHEIGHT/3) , 0, emeraldpics[6]); + V_DrawScaledPatch((BASEVIDWIDTH/2)-8 , (BASEVIDHEIGHT/3) , 0, emeraldpics[0][6]); } static void HU_DrawNetplayCoopOverlay(void) { int i; + if (token +#ifdef HAVE_BLUA + && LUA_HudEnabled(hud_tokens) +#endif + ) + { + V_DrawString(168, 10, 0, va("- %d", token)); + V_DrawSmallScaledPatch(148, 6, 0, tokenicon); + } + #ifdef HAVE_BLUA if (!LUA_HudEnabled(hud_coopemeralds)) return; @@ -3045,7 +3197,7 @@ static void HU_DrawNetplayCoopOverlay(void) for (i = 0; i < 7; ++i) { if (emeralds & (1 << i)) - V_DrawScaledPatch(20 + (i * 20), 6, 0, emeraldpics[i]); + V_DrawScaledPatch(20 + (i * 10), 9, 0, emeraldpics[1][i]); } } diff --git a/src/hu_stuff.h b/src/hu_stuff.h index b1d391828..ab77e67b6 100644 --- a/src/hu_stuff.h +++ b/src/hu_stuff.h @@ -77,14 +77,16 @@ extern patch_t *tallnum[10]; extern patch_t *nightsnum[10]; extern patch_t *lt_font[LT_FONTSIZE]; extern patch_t *cred_font[CRED_FONTSIZE]; -extern patch_t *emeraldpics[7]; -extern patch_t *tinyemeraldpics[7]; +extern patch_t *ttlnum[20]; +extern patch_t *emeraldpics[3][8]; extern patch_t *rflagico; extern patch_t *bflagico; extern patch_t *rmatcico; extern patch_t *bmatcico; extern patch_t *tagico; extern patch_t *tallminus; +extern patch_t *tallinfin; +extern patch_t *tokenicon; // set true whenever the tab rankings are being shown for any reason extern boolean hu_showscores; diff --git a/src/i_addrinfo.c b/src/i_addrinfo.c index 03edf732d..375fd4845 100644 --- a/src/i_addrinfo.c +++ b/src/i_addrinfo.c @@ -20,17 +20,11 @@ #else #include #endif -#elif !defined (__DJGPP__) && !defined(_WII) +#elif !defined (__DJGPP__) #include -#ifndef _NDS #include -#endif -#ifdef _PS3 -#include -#elif ! defined (_arch_dreamcast) #include #endif -#endif #include "i_addrinfo.h" @@ -262,9 +256,6 @@ int I_getaddrinfo(const char *node, const char *service, for (i = 0, j = 0; i < ailen; i++, j++) { ai = *res+i; -#ifdef _PS3 - addr[i].sin_len = famsize; -#endif addr[i].sin_port = htons((UINT16)sockport); if (nodename) { diff --git a/src/i_addrinfo.h b/src/i_addrinfo.h index 1b8ce9153..7c3afc614 100644 --- a/src/i_addrinfo.h +++ b/src/i_addrinfo.h @@ -39,17 +39,7 @@ #define EAI_NONAME -2 #endif -#ifdef _PS3 // PSL1GHT v2 -struct my_addrinfo { - int ai_flags; - int ai_family; - int ai_socktype; - int ai_protocol; - size_t ai_addrlen; - struct sockaddr *ai_addr; - struct my_addrinfo *ai_next; -}; -#elif defined (_WIN32) // already use the stub for Win32 +#ifdef _WIN32 // already use the stub for Win32 // w32api, ws2tcpip.h, r1.12 struct my_addrinfo { int ai_flags; diff --git a/src/i_sound.h b/src/i_sound.h index 9a5c2930a..d427881d2 100644 --- a/src/i_sound.h +++ b/src/i_sound.h @@ -30,7 +30,8 @@ typedef enum { MU_MP3_MAD_UNUSED, // use MU_MP3 instead MU_FLAC, MU_MODPLUG_UNUSED, // use MU_MOD instead - MU_GME + MU_GME, + MU_MOD_EX // libopenmpt } musictype_t; /** \brief Sound subsystem runing and waiting diff --git a/src/i_tcp.c b/src/i_tcp.c index 11a84ceba..f2b4336dc 100644 --- a/src/i_tcp.c +++ b/src/i_tcp.c @@ -18,20 +18,12 @@ #ifdef __GNUC__ #include #endif -#ifdef __OS2__ -#include -#include -#endif // __OS2__ - -#ifdef _PS3 -#define NO_IPV6 // PSL1GHT v2 do not have IPv6 support -#endif #ifndef NO_IPV6 #define HAVE_IPV6 #endif -#if defined (_WIN32) || defined (_WIN32_WCE) +#ifdef _WIN32 #define USE_WINSOCK #if defined (_WIN64) || defined (HAVE_IPV6) #define USE_WINSOCK2 @@ -40,12 +32,6 @@ #endif #endif //WIN32 OS -#ifdef _XBOX // XBox have on WinSock API? -#undef USE_WINSOCK -#undef USE_WINSOCK1 -#undef USE_WINSOCK2 -#endif - #ifdef USE_WINSOCK2 #include #endif @@ -61,17 +47,12 @@ #else #ifdef USE_WINSOCK1 #include -#elif !defined (SCOUW2) && !defined (SCOUW7) && !defined (__OS2__) -#ifdef HAVE_LWIP -#include -#elif !defined (USE_WINSOCK) +#elif !defined (SCOUW2) && !defined (SCOUW7) +#ifndef USE_WINSOCK #include #endif //normal BSD API -#ifdef HAVE_LWIP -#include -#define ioctl lwip_ioctl -#elif !defined (USE_WINSOCK) //!HAVE_LWIP +#ifndef USE_WINSOCK #ifdef __APPLE_CC__ #ifndef _BSD_SOCKLEN_T_ #define _BSD_SOCKLEN_T_ @@ -81,14 +62,7 @@ #include #endif //normal BSD API -#if defined(_arch_dreamcast) && !defined(HAVE_LWIP) -#include -#elif defined(HAVE_LWIP) -#include -#elif defined (_PS3) -#include -#include -#elif !defined(USE_WINSOCK) //!HAVE_LWIP +#ifndef USE_WINSOCK #include #include #endif //normal BSD API @@ -96,10 +70,6 @@ #include #include -#ifdef _arch_dreamcast -#include "sdl12/SRB2DC/dchelp.h" -#endif - #if (defined (__unix__) && !defined (MSDOS)) || defined(__APPLE__) || defined (UNIXCOMMON) #include #endif // UNIXCOMMON @@ -190,11 +160,6 @@ static UINT8 UPNP_support = TRUE; // winsock stuff (in winsock a socket is not a file) #define ioctl ioctlsocket #define close closesocket - - #ifdef _WIN32_WCE - #include "sdl12/SRB2CE/cehelp.h" - #endif - #endif #include "i_addrinfo.h" @@ -205,9 +170,7 @@ static UINT8 UPNP_support = TRUE; #define SELECTTEST #endif -#elif defined(HAVE_LWIP) -#define SELECTTEST -#elif !defined( _arch_dreamcast) +#else #define SELECTTEST #endif @@ -217,7 +180,7 @@ static UINT8 UPNP_support = TRUE; typedef SOCKET SOCKET_TYPE; #define ERRSOCKET (SOCKET_ERROR) #else -#if (defined (__unix__) && !defined (MSDOS)) || defined (__APPLE__) || defined (__HAIKU__) || defined(_PS3) +#if (defined (__unix__) && !defined (MSDOS)) || defined (__APPLE__) || defined (__HAIKU__) typedef int SOCKET_TYPE; #else typedef unsigned long SOCKET_TYPE; @@ -1177,12 +1140,6 @@ boolean I_InitTcpDriver(void) CONS_Debug(DBG_NETPLAY, "WinSock description: %s\n",WSAData.szDescription); CONS_Debug(DBG_NETPLAY, "WinSock System Status: %s\n",WSAData.szSystemStatus); #endif -#ifdef HAVE_LWIP - lwip_kos_init(); -#elif defined(_arch_dreamcast) - //return; - net_init(); -#endif #ifdef __DJGPP__ #ifdef WATTCP // Alam_GBC: survive bootp, dhcp, rarp and wattcp/pktdrv from failing to load survive_eth = 1; // would be needed to not exit if pkt_eth_init() fails @@ -1235,9 +1192,6 @@ boolean I_InitTcpDriver(void) CONS_Debug(DBG_NETPLAY, "No TCP/IP driver detected\n"); #endif // libsocket #endif // __DJGPP__ -#ifdef _PS3 - netInitialize(); -#endif #ifndef __DJGPP__ init_tcp_driver = true; #endif @@ -1285,11 +1239,6 @@ void I_ShutdownTcpDriver(void) WS_addrinfocleanup(); WSACleanup(); #endif -#ifdef HAVE_LWIP - lwip_kos_shutdown(); -#elif defined(_arch_dreamcast) - net_shutdown(); -#endif #ifdef __DJGPP__ #ifdef WATTCP // wattcp //_outch = NULL; @@ -1298,9 +1247,6 @@ void I_ShutdownTcpDriver(void) __lsck_uninit(); #endif // libsocket #endif // __DJGPP__ -#ifdef _PS3 - netDeinitialize(); -#endif CONS_Printf("shut down\n"); init_tcp_driver = false; #endif diff --git a/src/info.c b/src/info.c index 08470d4cd..074e31ba2 100644 --- a/src/info.c +++ b/src/info.c @@ -16,6 +16,7 @@ #include "doomstat.h" #include "sounds.h" #include "p_mobj.h" +#include "p_local.h" // DMG_ constants #include "m_misc.h" #include "z_zone.h" #include "d_player.h" @@ -25,43 +26,658 @@ #endif // Hey, moron! If you change this table, don't forget about the sprite enum in info.h and the sprite lights in hw_light.c! +// For the sake of constant merge conflicts, let's spread this out char sprnames[NUMSPRITES + 1][5] = { - "NULL","UNKN","THOK","PLAY","POSS","SPOS","FISH","BUZZ","RBUZ","JETB", - "JETW","JETG","CCOM","DETN","SKIM","TRET","TURR","SHRP","JJAW","SNLR", - "VLTR","PNTY","ARCH","CBFS","SPSH","ESHI","GSNP","MNUS","SSHL","UNID", - "BBUZ","JETF","EGGM","EGGN","TNKA","TNKB","SPNK","GOOP","EGGO","PRPL", - "FAKE","EGGP","EFIR","EGGQ","EGGR","BRAK","BGOO","BMSL","EGGT","RCKT", - "ELEC","TARG","NPLM","MNPL","METL","MSCF","MSCB","RING","TRNG","EMMY", - "TOKE","RFLG","BFLG","NWNG","EMBM","CEMG","EMER","FANS","BUBL","SIGN", - "STEM","SPIK","SFLM","USPK","STPT","BMNE","SRBX","RRBX","BRBX","SHTV", - "PINV","YLTV","BLTV","BKTV","WHTV","GRTV","ELTV","EGGB","MIXU","RECY", - "QUES","GBTV","PRUP","PTTV","MTEX","MISL","TORP","ENRG","MINE","JBUL", - "TRLS","CBLL","AROW","CFIR","FWR1","FWR2","FWR3","FWR4","BUS1","BUS2", - "THZP","ALRM","GARG","SEWE","DRIP","CRL1","CRL2","CRL3","BCRY","CHAN", - "FLAM","ESTA","SMCH","BMCH","SMCE","BMCE","BTBL","STBL","CACT","FLME", - "DFLM","XMS1","XMS2","XMS3","BSZ1","BSZ2","BSZ3","BSZ4","BSZ5","BSZ6", - "BSZ7","BSZ8","STLG","DBAL","RCRY","ARMA","ARMF","ARMB","WIND","MAGN", - "ELEM","FORC","PITY","IVSP","SSPK","GOAL","BIRD","BUNY","MOUS","CHIC", - "COWZ","RBRD","SPRY","SPRR","SPRB","YSPR","RSPR","RAIN","SNO1","SPLH", - "SPLA","SMOK","BUBP","BUBO","BUBN","BUBM","POPP","TFOG","SEED","PRTL", - "SCOR","DRWN","TTAG","GFLG","RRNG","RNGB","RNGR","RNGI","RNGA","RNGE", - "RNGS","RNGG","PIKB","PIKR","PIKA","PIKE","PIKS","PIKG","TAUT","TGRE", - "TSCR","COIN","CPRK","GOOM","BGOM","FFWR","FBLL","SHLL","PUMA","HAMM", - "KOOP","BFLM","MAXE","MUS1","MUS2","TOAD","NDRN","SUPE","SUPZ","NDRL", - "NSPK","NBMP","HOOP","NSCR","NPRU","CAPS","SUPT","SPRK","BOM1","BOM2", - "BOM3","BOM4","ROIA","ROIB","ROIC","ROID","ROIE","ROIF","ROIG","ROIH", - "ROII","ROIJ","ROIK","ROIL","ROIM","ROIN","ROIO","ROIP","BBAL","GWLG", - "GWLR","SRBA","SRBB","SRBC","SRBD","SRBE","SRBF","SRBG","SRBH","SRBI", - "SRBJ","SRBK","SRBL","SRBM","SRBN","SRBO", + "NULL", // invisible object + "UNKN", + + "THOK", // Thok! mobj + "PLAY", + + // Enemies + "POSS", // Crawla (Blue) + "SPOS", // Crawla (Red) + "FISH", // SDURF + "BUZZ", // Buzz (Gold) + "RBUZ", // Buzz (Red) + "JETB", // Jetty-Syn Bomber + "JETG", // Jetty-Syn Gunner + "CCOM", // Crawla Commander + "DETN", // Deton + "SKIM", // Skim mine dropper + "TRET", // Industrial Turret + "TURR", // Pop-Up Turret + "SHRP", // Sharp + "CRAB", // Crushstacean + "JJAW", // Jet Jaw + "SNLR", // Snailer + "VLTR", // BASH + "PNTY", // Pointy + "ARCH", // Robo-Hood + "CBFS", // Castlebot Facestabber + "STAB", // Castlebot Facestabber spear aura + "SPSH", // Egg Guard + "ESHI", // Egg Guard's shield + "GSNP", // Green Snapper + "GSNL", // Green Snapper leg + "GSNH", // Green Snapper head + "MNUS", // Minus + "MNUD", // Minus dirt + "SSHL", // Spring Shell + "UNID", // Unidus + "CANA", // Canarivore + "CANG", // Canarivore gas + + // Generic Boss Items + "JETF", // Boss jet fumes + + // Boss 1 (Greenflower) + "EGGM", + + // Boss 2 (Techno Hill) + "EGGN", // Boss 2 + "TNKA", // Boss 2 Tank 1 + "TNKB", // Boss 2 Tank 2 + "SPNK", // Boss 2 Spigot + "GOOP", // Boss 2 Goop + + // Boss 3 (Deep Sea) + "EGGO", // Boss 3 + "PRPL", // Boss 3 Propeller + "FAKE", // Boss 3 Fakemobile + + // Boss 4 (Castle Eggman) + "EGGP", + "EFIR", // Boss 4 jet flame + + // Boss 5 (Arid Canyon) + "FANG", // replaces EGGQ + "FBOM", + "FSGN", + "BARX", // bomb explosion (also used by barrel) + "BARD", // bomb dust (also used by barrel) + + // Boss 6 (Red Volcano) + "EGGR", + + // Boss 7 (Dark City) + "BRAK", + "BGOO", // Goop + "BMSL", + + // Boss 8 (Egg Rock) + "EGGT", + + // Cy-Brak-Demon; uses "BRAK" as well, but has some extras + "RCKT", // Rockets! + "ELEC", // Electricity! + "TARG", // Targeting reticules! + "NPLM", // Big napalm bombs! + "MNPL", // Mini napalm bombs! + + // Metal Sonic + "METL", + "MSCF", + "MSCB", + + // Collectible Items + "RING", + "TRNG", // Team Rings + "TOKE", // Special Stage Token + "RFLG", // Red CTF Flag + "BFLG", // Blue CTF Flag + "SPHR", // Sphere + "NCHP", // NiGHTS chip + "NSTR", // NiGHTS star + "EMBM", // Emblem + "CEMG", // Chaos Emeralds + "SHRD", // Emerald hunt shards + + // Interactive Objects + "BBLS", // water bubble source + "SIGN", // Level end sign + "SPIK", // Spike Ball + "SFLM", // Spin fire + "USPK", // Floor spike + "WSPK", // Wall spike + "WSPB", // Wall spike base + "STPT", // Starpost + "BMNE", // Big floating mine + + // Monitor Boxes + "MSTV", // MiSc TV sprites + "XLTV", // eXtra Large TV sprites + + "TRRI", // Red team: 10 RIngs + "TBRI", // Blue team: 10 RIngs + + "TVRI", // 10 RIng + "TVPI", // PIty shield + "TVAT", // ATtraction shield + "TVFO", // FOrce shield + "TVAR", // ARmageddon shield + "TVWW", // WhirlWind shield + "TVEL", // ELemental shield + "TVSS", // Super Sneakers + "TVIV", // InVincibility + "TV1U", // 1Up + "TV1P", // 1uP (textless) + "TVEG", // EGgman + "TVMX", // MiXup + "TVMY", // MYstery + "TVGV", // GraVity boots + "TVRC", // ReCycler + "TV1K", // 1,000 points (1 K) + "TVTK", // 10,000 points (Ten K) + "TVFL", // FLame shield + "TVBB", // BuBble shield + "TVZP", // Thunder shield (ZaP) + + // Projectiles + "MISL", + "TORP", // Torpedo + "ENRG", // Energy ball + "MINE", // Skim mine + "JBUL", // Jetty-Syn Bullet + "TRLS", + "CBLL", // Cannonball + "AROW", // Arrow + "CFIR", // Colored fire of various sorts + + // Greenflower Scenery + "FWR1", + "FWR2", // GFZ Sunflower + "FWR3", // GFZ budding flower + "FWR4", + "BUS1", // GFZ Bush w/ berries + "BUS2", // GFZ Bush w/o berries + "BUS3", // GFZ Bush w/ BLUE berries + // Trees (both GFZ and misc) + "TRE1", // GFZ + "TRE2", // Checker + "TRE3", // Frozen Hillside + "TRE4", // Polygon + "TRE5", // Bush tree + "TRE6", // Spring tree + + // Techno Hill Scenery + "THZP", // THZ1 Steam Flower + "FWR5", // THZ1 Spin flower (red) + "FWR6", // THZ1 Spin flower (yellow) + "THZT", // Steam Whistle tree/bush + "ALRM", // THZ2 Alarm + + // Deep Sea Scenery + "GARG", // Deep Sea Gargoyle + "SEWE", // Deep Sea Seaweed + "DRIP", // Dripping water + "CRL1", // Coral 1 + "CRL2", // Coral 2 + "CRL3", // Coral 3 + "BCRY", // Blue Crystal + "KELP", // Kelp + "DSTG", // DSZ Stalagmites + "LIBE", // DSZ Light beam + + // Castle Eggman Scenery + "CHAN", // CEZ Chain + "FLAM", // Flame + "ESTA", // Eggman esta una estatua! + "SMCH", // Small Mace Chain + "BMCH", // Big Mace Chain + "SMCE", // Small Mace + "BMCE", // Big Mace + "YSPB", // Yellow spring on a ball + "RSPB", // Red spring on a ball + "SFBR", // Small Firebar + "BFBR", // Big Firebar + "BANR", // Banner + "PINE", // Pine Tree + "CEZB", // Bush + "CNDL", // Candle/pricket + "FLMH", // Flame holder + "CTRC", // Fire torch + "CFLG", // Waving flag/segment + "CSTA", // Crawla statue + "CBBS", // Facestabber statue + "CABR", // Brambles + + // Arid Canyon Scenery + "BTBL", // Big tumbleweed + "STBL", // Small tumbleweed + "CACT", // Cacti sprites + "WWSG", // Caution Sign + "WWS2", // Cacti Sign + "WWS3", // Sharp Turn Sign + "OILL", // Oil lamp + "OILF", // Oil lamp flare + "BARR", // TNT barrel + "REMT", // TNT proximity shell + "TAZD", // Dust devil + "ADST", // Arid dust + "MCRT", // Minecart + "MCSP", // Minecart spark + "NON2", // Saloon door thinker + "SALD", // Saloon door + "TRAE", // Train cameo locomotive + "TRAI", // Train cameo wagon + "STEA", // Train steam + + // Red Volcano Scenery + "FLME", // Flame jet + "DFLM", // Blade's flame + + // Dark City Scenery + + // Egg Rock Scenery + + // Christmas Scenery + "XMS1", // Christmas Pole + "XMS2", // Candy Cane + "XMS3", // Snowman + "XMS4", // Lamppost + "XMS5", // Hanging Star + "FHZI", // FHZ ice + + // Halloween Scenery + "PUMK", // Pumpkins + "HHPL", // Dr Seuss Trees + "SHRM", // Mushroom + "HHZM", // Misc + + // Botanic Serenity Scenery + "BSZ1", // Tall flowers + "BSZ2", // Medium flowers + "BSZ3", // Small flowers + //"BSZ4", -- Tulips + "BST1", // Red tulip + "BST2", // Purple tulip + "BST3", // Blue tulip + "BST4", // Cyan tulip + "BST5", // Yellow tulip + "BST6", // Orange tulip + "BSZ5", // Cluster of Tulips + "BSZ6", // Bush + "BSZ7", // Vine + "BSZ8", // Misc things + + // Misc Scenery + "STLG", // Stalagmites + "DBAL", // Disco + "RCRY", // ATZ Red Crystal (Target) + + // Powerup Indicators + "ARMA", // Armageddon Shield Orb + "ARMF", // Armageddon Shield Ring, Front + "ARMB", // Armageddon Shield Ring, Back + "WIND", // Whirlwind Shield Orb + "MAGN", // Attract Shield Orb + "ELEM", // Elemental Shield Orb and Fire + "FORC", // Force Shield Orb + "PITY", // Pity Shield Orb + "FIRS", // Flame Shield Orb + "BUBS", // Bubble Shield Orb + "ZAPS", // Thunder Shield Orb + "IVSP", // invincibility sparkles + "SSPK", // Super Sonic Spark + + "GOAL", // Special Stage goal (here because lol NiGHTS) + + // Flickies + "FBUB", // Flicky-sized bubble + "FL01", // Bluebird + "FL02", // Rabbit + "FL03", // Chicken + "FL04", // Seal + "FL05", // Pig + "FL06", // Chipmunk + "FL07", // Penguin + "FL08", // Fish + "FL09", // Ram + "FL10", // Puffin + "FL11", // Cow + "FL12", // Rat + "FL13", // Bear + "FL14", // Dove + "FL15", // Cat + "FL16", // Canary + "FS01", // Spider + "FS02", // Bat + + // Springs + "FANS", // Fan + "STEM", // Steam riser + "BUMP", // Bumpers + "BLON", // Balloons + "SPRY", // Yellow spring + "SPRR", // Red spring + "SPRB", // Blue spring + "YSPR", // Yellow Diagonal Spring + "RSPR", // Red Diagonal Spring + "BSPR", // Blue Diagonal Spring + "SSWY", // Yellow Side Spring + "SSWR", // Red Side Spring + "SSWB", // Blue Side Spring + + // Environmental Effects + "RAIN", // Rain + "SNO1", // Snowflake + "SPLH", // Water Splish + "SPLA", // Water Splash + "SMOK", + "BUBL", // Bubble + "WZAP", + "DUST", // Spindash dust + "FPRT", // Spindash dust (flame) + "TFOG", // Teleport Fog + "SEED", // Sonic CD flower seed + "PRTL", // Particle (for fans, etc.) + + // Game Indicators + "SCOR", // Score logo + "DRWN", // Drowning Timer + "LCKN", // Target + "TTAG", // Tag Sign + "GFLG", // Got Flag sign + + "CORK", + + // Ring Weapons + "RRNG", // Red Ring + "RNGB", // Bounce Ring + "RNGR", // Rail Ring + "RNGI", // Infinity Ring + "RNGA", // Automatic Ring + "RNGE", // Explosion Ring + "RNGS", // Scatter Ring + "RNGG", // Grenade Ring + + "PIKB", // Bounce Ring Pickup + "PIKR", // Rail Ring Pickup + "PIKA", // Automatic Ring Pickup + "PIKE", // Explosion Ring Pickup + "PIKS", // Scatter Ring Pickup + "PIKG", // Grenade Ring Pickup + + "TAUT", // Thrown Automatic Ring + "TGRE", // Thrown Grenade Ring + "TSCR", // Thrown Scatter Ring + + // Mario-specific stuff + "COIN", + "CPRK", + "GOOM", + "BGOM", + "FFWR", + "FBLL", + "SHLL", + "PUMA", + "HAMM", + "KOOP", + "BFLM", + "MAXE", + "MUS1", + "MUS2", + "TOAD", + + // NiGHTS Stuff + "NDRN", // NiGHTS drone + "NSPK", // NiGHTS sparkle + "NBMP", // NiGHTS Bumper + "HOOP", // NiGHTS hoop sprite + "NSCR", // NiGHTS score sprite + "NPRU", // Nights Powerups + "CAPS", // Capsule thingy for NiGHTS + "IDYA", // Ideya + "NTPN", // Nightopian + "SHLP", // Shleep + + // Secret badniks and hazards, shhhh + "PENG", + "POPH", + "HIVE", + "BUMB", + "BBUZ", + "FMCE", + "HMCE", + "CACO", + "BAL2", + "SBOB", + "SBFL", + "SBSK", + "HBAT", + + // Debris + "SPRK", // Sparkle + "BOM1", // Robot Explosion + "BOM2", // Boss Explosion 1 + "BOM3", // Boss Explosion 2 + "BOM4", // Underwater Explosion + "BMNB", // Mine Explosion + "WDDB", // Wood Debris + + // Crumbly rocks + "ROIA", + "ROIB", + "ROIC", + "ROID", + "ROIE", + "ROIF", + "ROIG", + "ROIH", + "ROII", + "ROIJ", + "ROIK", + "ROIL", + "ROIM", + "ROIN", + "ROIO", + "ROIP", + + // Gravity Well Objects + "GWLG", + "GWLR", +}; + +char spr2names[NUMPLAYERSPRITES][5] = +{ + "STND", + "WAIT", + "WALK", + "SKID", + "RUN_", + "DASH", + "PAIN", + "STUN", + "DEAD", + "DRWN", + "ROLL", + "GASP", + "JUMP", + "SPNG", + "FALL", + "EDGE", + "RIDE", + + "SPIN", + + "FLY_", + "SWIM", + "TIRE", + + "GLID", + "CLNG", + "CLMB", + + "FLT_", + "FRUN", + + "BNCE", + "BLND", + + "FIRE", + + "TWIN", + + "MLEE", + "MLEL", + + "TRNS", + + "NSTD", + "NFLT", + "NSTN", + "NPUL", + "NATK", + + "NGT0", + "NGT1", + "NGT2", + "NGT3", + "NGT4", + "NGT5", + "NGT6", + "NGT7", + "NGT8", + "NGT9", + "NGTA", + "NGTB", + "NGTC", + + "DRL0", + "DRL1", + "DRL2", + "DRL3", + "DRL4", + "DRL5", + "DRL6", + "DRL7", + "DRL8", + "DRL9", + "DRLA", + "DRLB", + "DRLC", + + "TAL0", + "TAL1", + "TAL2", + "TAL3", + "TAL4", + "TAL5", + "TAL6", + "TAL7", + "TAL8", + "TAL9", + "TALA", + "TALB", + + "SIGN", + "LIFE" +}; +playersprite_t free_spr2 = SPR2_FIRSTFREESLOT; + +playersprite_t spr2defaults[NUMPLAYERSPRITES] = { + 0, // SPR2_STND, + 0, // SPR2_WAIT, + 0, // SPR2_WALK, + SPR2_WALK, // SPR2_SKID, + SPR2_WALK, // SPR2_RUN , + SPR2_FRUN, // SPR2_DASH, + 0, // SPR2_PAIN, + SPR2_PAIN, // SPR2_STUN, + SPR2_PAIN, // SPR2_DEAD, + SPR2_DEAD, // SPR2_DRWN, + 0, // SPR2_ROLL, + SPR2_SPNG, // SPR2_GASP, + 0, // SPR2_JUMP, (conditional) + SPR2_FALL, // SPR2_SPNG, + SPR2_WALK, // SPR2_FALL, + 0, // SPR2_EDGE, + SPR2_FALL, // SPR2_RIDE, + + SPR2_ROLL, // SPR2_SPIN, + + SPR2_SPNG, // SPR2_FLY , + SPR2_FLY , // SPR2_SWIM, + 0, // SPR2_TIRE, (conditional) + + SPR2_FLY , // SPR2_GLID, + SPR2_CLMB, // SPR2_CLNG, + SPR2_ROLL, // SPR2_CLMB, + + SPR2_WALK, // SPR2_FLT , + SPR2_RUN , // SPR2_FRUN, + + SPR2_FALL, // SPR2_BNCE, + SPR2_ROLL, // SPR2_BLND, + + 0, // SPR2_FIRE, + + SPR2_ROLL, // SPR2_TWIN, + + SPR2_TWIN, // SPR2_MLEE, + 0, // SPR2_MLEL, + + 0, // SPR2_TRNS, + + FF_SPR2SUPER|SPR2_STND, // SPR2_NSTD, + FF_SPR2SUPER|SPR2_FLT , // SPR2_NFLT, + FF_SPR2SUPER|SPR2_STUN, // SPR2_NSTN, + SPR2_NSTN, // SPR2_NPUL, + FF_SPR2SUPER|SPR2_ROLL, // SPR2_NATK, + + 0, // SPR2_NGT0, (should never be referenced) + SPR2_NGT0, // SPR2_NGT1, + SPR2_NGT1, // SPR2_NGT2, + SPR2_NGT2, // SPR2_NGT3, + SPR2_NGT3, // SPR2_NGT4, + SPR2_NGT4, // SPR2_NGT5, + SPR2_NGT5, // SPR2_NGT6, + SPR2_NGT0, // SPR2_NGT7, + SPR2_NGT7, // SPR2_NGT8, + SPR2_NGT8, // SPR2_NGT9, + SPR2_NGT9, // SPR2_NGTA, + SPR2_NGTA, // SPR2_NGTB, + SPR2_NGTB, // SPR2_NGTC, + + SPR2_NGT0, // SPR2_DRL0, + SPR2_NGT1, // SPR2_DRL1, + SPR2_NGT2, // SPR2_DRL2, + SPR2_NGT3, // SPR2_DRL3, + SPR2_NGT4, // SPR2_DRL4, + SPR2_NGT5, // SPR2_DRL5, + SPR2_NGT6, // SPR2_DRL6, + SPR2_NGT7, // SPR2_DRL7, + SPR2_NGT8, // SPR2_DRL8, + SPR2_NGT9, // SPR2_DRL9, + SPR2_NGTA, // SPR2_DRLA, + SPR2_NGTB, // SPR2_DRLB, + SPR2_NGTC, // SPR2_DRLC, + + 0, // SPR2_TAL0, + SPR2_TAL0, // SPR2_TAL1, + SPR2_TAL1, // SPR2_TAL2, + SPR2_TAL2, // SPR2_TAL3, + SPR2_TAL1, // SPR2_TAL4, + SPR2_TAL4, // SPR2_TAL5, + SPR2_TAL0, // SPR2_TAL6, + SPR2_TAL3, // SPR2_TAL7, + SPR2_TAL7, // SPR2_TAL8, + SPR2_TAL0, // SPR2_TAL9, + SPR2_TAL9, // SPR2_TALA, + SPR2_TAL0, // SPR2_TALB, + + 0, // SPR2_SIGN, + 0, // SPR2_LIFE, }; // Doesn't work with g++, needs actionf_p1 (don't modify this comment) state_t states[NUMSTATES] = { // frame is masked through FF_FRAMEMASK - // FF_ANIMATE (0x4000) makes simple state animations (var1 #frames, var2 tic delay) - // FF_FULLBRIGHT (0x8000) activates the fullbright colormap + // FF_ANIMATE makes simple state animations (var1 #frames, var2 tic delay) + // FF_FULLBRIGHT activates the fullbright colormap // use FF_TRANS10 - FF_TRANS90 for easy translucency // (or tr_trans10< "player_t" +// or players[0].powers -> "player_t.powers" +static int lib_userdataType(lua_State *L) +{ + lua_settop(L, 1); // pop everything except arg 1 (in case somebody decided to add more) + luaL_checktype(L, 1, LUA_TUSERDATA); + lua_pushstring(L, GetUserdataUType(L)); return 1; } @@ -199,15 +275,7 @@ static int lib_pRandomRange(lua_State *L) return 1; } -// Deprecated, macros, etc. -static int lib_pRandom(lua_State *L) -{ - NOHUD - LUA_Deprecated(L, "P_Random", "P_RandomByte"); - lua_pushinteger(L, P_RandomByte()); - return 1; -} - +// Macros. static int lib_pSignedRandom(lua_State *L) { NOHUD @@ -274,6 +342,41 @@ static int lib_pClosestPointOnLine(lua_State *L) return 2; } +static int lib_pPointOnLineSide(lua_State *L) +{ + int n = lua_gettop(L); + fixed_t x = luaL_checkfixed(L, 1); + fixed_t y = luaL_checkfixed(L, 2); + //HUDSAFE + if (lua_isuserdata(L, 3)) // use a real linedef to get our points + { + line_t *line = *((line_t **)luaL_checkudata(L, 3, META_LINE)); + if (!line) + return LUA_ErrInvalid(L, "line_t"); + lua_pushinteger(L, P_PointOnLineSide(x, y, line)); + } + else // use custom coordinates of our own! + { + vertex_t v1, v2; // fake vertexes + line_t junk; // fake linedef + + if (n < 6) + return luaL_error(L, "arguments 3 to 6 not all given (expected 4 fixed-point integers)"); + + v1.x = luaL_checkfixed(L, 3); + v1.y = luaL_checkfixed(L, 4); + v2.x = luaL_checkfixed(L, 5); + v2.y = luaL_checkfixed(L, 6); + + junk.v1 = &v1; + junk.v2 = &v2; + junk.dx = v2.x - v1.x; + junk.dy = v2.y - v1.y; + lua_pushinteger(L, P_PointOnLineSide(x, y, &junk)); + } + return 1; +} + // P_ENEMY ///////////// @@ -281,6 +384,7 @@ static int lib_pCheckMeleeRange(lua_State *L) { mobj_t *actor = *((mobj_t **)luaL_checkudata(L, 1, META_MOBJ)); NOHUD + INLEVEL if (!actor) return LUA_ErrInvalid(L, "mobj_t"); lua_pushboolean(L, P_CheckMeleeRange(actor)); @@ -291,6 +395,7 @@ static int lib_pJetbCheckMeleeRange(lua_State *L) { mobj_t *actor = *((mobj_t **)luaL_checkudata(L, 1, META_MOBJ)); NOHUD + INLEVEL if (!actor) return LUA_ErrInvalid(L, "mobj_t"); lua_pushboolean(L, P_JetbCheckMeleeRange(actor)); @@ -301,6 +406,7 @@ static int lib_pFaceStabCheckMeleeRange(lua_State *L) { mobj_t *actor = *((mobj_t **)luaL_checkudata(L, 1, META_MOBJ)); NOHUD + INLEVEL if (!actor) return LUA_ErrInvalid(L, "mobj_t"); lua_pushboolean(L, P_FaceStabCheckMeleeRange(actor)); @@ -311,6 +417,7 @@ static int lib_pSkimCheckMeleeRange(lua_State *L) { mobj_t *actor = *((mobj_t **)luaL_checkudata(L, 1, META_MOBJ)); NOHUD + INLEVEL if (!actor) return LUA_ErrInvalid(L, "mobj_t"); lua_pushboolean(L, P_SkimCheckMeleeRange(actor)); @@ -321,6 +428,7 @@ static int lib_pCheckMissileRange(lua_State *L) { mobj_t *actor = *((mobj_t **)luaL_checkudata(L, 1, META_MOBJ)); NOHUD + INLEVEL if (!actor) return LUA_ErrInvalid(L, "mobj_t"); lua_pushboolean(L, P_CheckMissileRange(actor)); @@ -331,6 +439,7 @@ static int lib_pNewChaseDir(lua_State *L) { mobj_t *actor = *((mobj_t **)luaL_checkudata(L, 1, META_MOBJ)); NOHUD + INLEVEL if (!actor) return LUA_ErrInvalid(L, "mobj_t"); P_NewChaseDir(actor); @@ -344,6 +453,7 @@ static int lib_pLookForPlayers(lua_State *L) boolean allaround = lua_optboolean(L, 3); boolean tracer = lua_optboolean(L, 4); NOHUD + INLEVEL if (!actor) return LUA_ErrInvalid(L, "mobj_t"); lua_pushboolean(L, P_LookForPlayers(actor, allaround, tracer, dist)); @@ -360,16 +470,35 @@ static int lib_pSpawnMobj(lua_State *L) fixed_t z = luaL_checkfixed(L, 3); mobjtype_t type = luaL_checkinteger(L, 4); NOHUD + INLEVEL if (type >= NUMMOBJTYPES) return luaL_error(L, "mobj type %d out of range (0 - %d)", type, NUMMOBJTYPES-1); LUA_PushUserdata(L, P_SpawnMobj(x, y, z, type), META_MOBJ); return 1; } +static int lib_pSpawnMobjFromMobj(lua_State *L) +{ + mobj_t *actor = *((mobj_t **)luaL_checkudata(L, 1, META_MOBJ)); + fixed_t x = luaL_checkfixed(L, 2); + fixed_t y = luaL_checkfixed(L, 3); + fixed_t z = luaL_checkfixed(L, 4); + mobjtype_t type = luaL_checkinteger(L, 5); + NOHUD + INLEVEL + if (!actor) + return LUA_ErrInvalid(L, "mobj_t"); + if (type >= NUMMOBJTYPES) + return luaL_error(L, "mobj type %d out of range (0 - %d)", type, NUMMOBJTYPES-1); + LUA_PushUserdata(L, P_SpawnMobjFromMobj(actor, x, y, z, type), META_MOBJ); + return 1; +} + static int lib_pRemoveMobj(lua_State *L) { mobj_t *th = *((mobj_t **)luaL_checkudata(L, 1, META_MOBJ)); NOHUD + INLEVEL if (!th) return LUA_ErrInvalid(L, "mobj_t"); if (th->player) @@ -378,12 +507,51 @@ static int lib_pRemoveMobj(lua_State *L) return 0; } +// P_IsValidSprite2 technically doesn't exist, and probably never should... but too much would need to be exposed to allow this to be checked by other methods. + +static int lib_pIsValidSprite2(lua_State *L) +{ + mobj_t *mobj = *((mobj_t **)luaL_checkudata(L, 1, META_MOBJ)); + UINT8 spr2 = (UINT8)luaL_checkinteger(L, 2); + //HUDSAFE + INLEVEL + if (!mobj) + return LUA_ErrInvalid(L, "mobj_t"); + lua_pushboolean(L, (mobj->skin && (((skin_t *)mobj->skin)->sprites[spr2].numframes))); + return 1; +} + +// P_SpawnLockOn doesn't exist either, but we want to expose making a local mobj without encouraging hacks. + +static int lib_pSpawnLockOn(lua_State *L) +{ + player_t *player = *((player_t **)luaL_checkudata(L, 1, META_PLAYER)); + mobj_t *lockon = *((mobj_t **)luaL_checkudata(L, 2, META_MOBJ)); + statenum_t state = luaL_checkinteger(L, 3); + NOHUD + INLEVEL + if (!lockon) + return LUA_ErrInvalid(L, "mobj_t"); + if (!player) + return LUA_ErrInvalid(L, "player_t"); + if (state >= NUMSTATES) + return luaL_error(L, "state %d out of range (0 - %d)", state, NUMSTATES-1); + if (P_IsLocalPlayer(player)) // Only display it on your own view. + { + mobj_t *visual = P_SpawnMobj(lockon->x, lockon->y, lockon->z, MT_LOCKON); // positioning, flip handled in P_SceneryThinker + visual->target = lockon; + P_SetMobjStateNF(visual, state); + } + return 0; +} + static int lib_pSpawnMissile(lua_State *L) { mobj_t *source = *((mobj_t **)luaL_checkudata(L, 1, META_MOBJ)); mobj_t *dest = *((mobj_t **)luaL_checkudata(L, 2, META_MOBJ)); mobjtype_t type = luaL_checkinteger(L, 3); NOHUD + INLEVEL if (!source || !dest) return LUA_ErrInvalid(L, "mobj_t"); if (type >= NUMMOBJTYPES) @@ -401,6 +569,7 @@ static int lib_pSpawnXYZMissile(lua_State *L) fixed_t y = luaL_checkfixed(L, 5); fixed_t z = luaL_checkfixed(L, 6); NOHUD + INLEVEL if (!source || !dest) return LUA_ErrInvalid(L, "mobj_t"); if (type >= NUMMOBJTYPES) @@ -420,6 +589,7 @@ static int lib_pSpawnPointMissile(lua_State *L) fixed_t y = luaL_checkfixed(L, 7); fixed_t z = luaL_checkfixed(L, 8); NOHUD + INLEVEL if (!source) return LUA_ErrInvalid(L, "mobj_t"); if (type >= NUMMOBJTYPES) @@ -437,6 +607,7 @@ static int lib_pSpawnAlteredDirectionMissile(lua_State *L) fixed_t z = luaL_checkfixed(L, 5); INT32 shiftingAngle = (INT32)luaL_checkinteger(L, 5); NOHUD + INLEVEL if (!source) return LUA_ErrInvalid(L, "mobj_t"); if (type >= NUMMOBJTYPES) @@ -450,6 +621,7 @@ static int lib_pColorTeamMissile(lua_State *L) mobj_t *missile = *((mobj_t **)luaL_checkudata(L, 1, META_MOBJ)); player_t *source = *((player_t **)luaL_checkudata(L, 2, META_PLAYER)); NOHUD + INLEVEL if (!missile) return LUA_ErrInvalid(L, "mobj_t"); if (!source) @@ -466,6 +638,7 @@ static int lib_pSPMAngle(lua_State *L) UINT8 allowaim = (UINT8)luaL_optinteger(L, 4, 0); UINT32 flags2 = (UINT32)luaL_optinteger(L, 5, 0); NOHUD + INLEVEL if (!source) return LUA_ErrInvalid(L, "mobj_t"); if (type >= NUMMOBJTYPES) @@ -480,6 +653,7 @@ static int lib_pSpawnPlayerMissile(lua_State *L) mobjtype_t type = luaL_checkinteger(L, 2); UINT32 flags2 = (UINT32)luaL_optinteger(L, 3, 0); NOHUD + INLEVEL if (!source) return LUA_ErrInvalid(L, "mobj_t"); if (type >= NUMMOBJTYPES) @@ -492,6 +666,7 @@ static int lib_pMobjFlip(lua_State *L) { mobj_t *mobj = *((mobj_t **)luaL_checkudata(L, 1, META_MOBJ)); //HUDSAFE + INLEVEL if (!mobj) return LUA_ErrInvalid(L, "mobj_t"); lua_pushinteger(L, P_MobjFlip(mobj)); @@ -502,6 +677,7 @@ static int lib_pGetMobjGravity(lua_State *L) { mobj_t *mobj = *((mobj_t **)luaL_checkudata(L, 1, META_MOBJ)); //HUDSAFE + INLEVEL if (!mobj) return LUA_ErrInvalid(L, "mobj_t"); lua_pushfixed(L, P_GetMobjGravity(mobj)); @@ -524,6 +700,7 @@ static int lib_pFlashPal(lua_State *L) UINT16 type = (UINT16)luaL_checkinteger(L, 2); UINT16 duration = (UINT16)luaL_checkinteger(L, 3); NOHUD + INLEVEL if (!pl) return LUA_ErrInvalid(L, "player_t"); P_FlashPal(pl, type, duration); @@ -534,6 +711,7 @@ static int lib_pGetClosestAxis(lua_State *L) { mobj_t *source = *((mobj_t **)luaL_checkudata(L, 1, META_MOBJ)); //HUDSAFE + INLEVEL if (!source) return LUA_ErrInvalid(L, "mobj_t"); LUA_PushUserdata(L, P_GetClosestAxis(source), META_MOBJ); @@ -552,6 +730,7 @@ static int lib_pSpawnParaloop(lua_State *L) statenum_t nstate = luaL_optinteger(L, 8, S_NULL); boolean spawncenter = lua_optboolean(L, 9); NOHUD + INLEVEL if (type >= NUMMOBJTYPES) return luaL_error(L, "mobj type %d out of range (0 - %d)", type, NUMMOBJTYPES-1); if (nstate >= NUMSTATES) @@ -565,6 +744,7 @@ static int lib_pBossTargetPlayer(lua_State *L) mobj_t *actor = *((mobj_t **)luaL_checkudata(L, 1, META_MOBJ)); boolean closest = lua_optboolean(L, 2); NOHUD + INLEVEL if (!actor) return LUA_ErrInvalid(L, "mobj_t"); lua_pushboolean(L, P_BossTargetPlayer(actor, closest)); @@ -575,6 +755,7 @@ static int lib_pSupermanLook4Players(lua_State *L) { mobj_t *actor = *((mobj_t **)luaL_checkudata(L, 1, META_MOBJ)); NOHUD + INLEVEL if (!actor) return LUA_ErrInvalid(L, "mobj_t"); lua_pushboolean(L, P_SupermanLook4Players(actor)); @@ -586,6 +767,7 @@ static int lib_pSetScale(lua_State *L) mobj_t *mobj = *((mobj_t **)luaL_checkudata(L, 1, META_MOBJ)); fixed_t newscale = luaL_checkfixed(L, 2); NOHUD + INLEVEL if (!mobj) return LUA_ErrInvalid(L, "mobj_t"); if (newscale < FRACUNIT/100) @@ -599,6 +781,7 @@ static int lib_pInsideANonSolidFFloor(lua_State *L) mobj_t *mobj = *((mobj_t **)luaL_checkudata(L, 1, META_MOBJ)); ffloor_t *rover = *((ffloor_t **)luaL_checkudata(L, 2, META_FFLOOR)); //HUDSAFE + INLEVEL if (!mobj) return LUA_ErrInvalid(L, "mobj_t"); if (!rover) @@ -611,6 +794,7 @@ static int lib_pCheckDeathPitCollide(lua_State *L) { mobj_t *mo = *((mobj_t **)luaL_checkudata(L, 1, META_MOBJ)); //HUDSAFE + INLEVEL if (!mo) return LUA_ErrInvalid(L, "mobj_t"); lua_pushboolean(L, P_CheckDeathPitCollide(mo)); @@ -622,6 +806,7 @@ static int lib_pCheckSolidLava(lua_State *L) mobj_t *mo = *((mobj_t **)luaL_checkudata(L, 1, META_MOBJ)); ffloor_t *rover = *((ffloor_t **)luaL_checkudata(L, 2, META_FFLOOR)); //HUDSAFE + INLEVEL if (!mo) return LUA_ErrInvalid(L, "mobj_t"); if (!rover) @@ -635,6 +820,7 @@ static int lib_pCanRunOnWater(lua_State *L) player_t *player = *((player_t **)luaL_checkudata(L, 1, META_PLAYER)); ffloor_t *rover = *((ffloor_t **)luaL_checkudata(L, 2, META_FFLOOR)); //HUDSAFE + INLEVEL if (!player) return LUA_ErrInvalid(L, "player_t"); if (!rover) @@ -643,6 +829,19 @@ static int lib_pCanRunOnWater(lua_State *L) return 1; } +static int lib_pMaceRotate(lua_State *L) +{ + mobj_t *center = *((mobj_t **)luaL_checkudata(L, 1, META_MOBJ)); + INT32 baserot = luaL_checkinteger(L, 2); + INT32 baseprevrot = luaL_checkinteger(L, 3); + NOHUD + INLEVEL + if (!center) + return LUA_ErrInvalid(L, "mobj_t"); + P_MaceRotate(center, baserot, baseprevrot); + return 0; +} + // P_USER //////////// @@ -650,6 +849,7 @@ static int lib_pGetPlayerHeight(lua_State *L) { player_t *player = *((player_t **)luaL_checkudata(L, 1, META_PLAYER)); //HUDSAFE + INLEVEL if (!player) return LUA_ErrInvalid(L, "player_t"); lua_pushfixed(L, P_GetPlayerHeight(player)); @@ -660,6 +860,7 @@ static int lib_pGetPlayerSpinHeight(lua_State *L) { player_t *player = *((player_t **)luaL_checkudata(L, 1, META_PLAYER)); //HUDSAFE + INLEVEL if (!player) return LUA_ErrInvalid(L, "player_t"); lua_pushfixed(L, P_GetPlayerSpinHeight(player)); @@ -670,6 +871,7 @@ static int lib_pGetPlayerControlDirection(lua_State *L) { player_t *player = *((player_t **)luaL_checkudata(L, 1, META_PLAYER)); //HUDSAFE + INLEVEL if (!player) return LUA_ErrInvalid(L, "player_t"); lua_pushinteger(L, P_GetPlayerControlDirection(player)); @@ -681,16 +883,41 @@ static int lib_pAddPlayerScore(lua_State *L) player_t *player = *((player_t **)luaL_checkudata(L, 1, META_PLAYER)); UINT32 amount = (UINT32)luaL_checkinteger(L, 2); NOHUD + INLEVEL if (!player) return LUA_ErrInvalid(L, "player_t"); P_AddPlayerScore(player, amount); return 0; } +static int lib_pStealPlayerScore(lua_State *L) +{ + player_t *player = *((player_t **)luaL_checkudata(L, 1, META_PLAYER)); + UINT32 amount = (UINT32)luaL_checkinteger(L, 2); + NOHUD + INLEVEL + if (!player) + return LUA_ErrInvalid(L, "player_t"); + P_StealPlayerScore(player, amount); + return 0; +} + +static int lib_pGetJumpFlags(lua_State *L) +{ + player_t *player = *((player_t **)luaL_checkudata(L, 1, META_PLAYER)); + NOHUD + INLEVEL + if (!player) + return LUA_ErrInvalid(L, "player_t"); + lua_pushinteger(L, P_GetJumpFlags(player)); + return 1; +} + static int lib_pPlayerInPain(lua_State *L) { player_t *player = *((player_t **)luaL_checkudata(L, 1, META_PLAYER)); //HUDSAFE + INLEVEL if (!player) return LUA_ErrInvalid(L, "player_t"); lua_pushboolean(L, P_PlayerInPain(player)); @@ -702,6 +929,7 @@ static int lib_pDoPlayerPain(lua_State *L) player_t *player = *((player_t **)luaL_checkudata(L, 1, META_PLAYER)); mobj_t *source = NULL, *inflictor = NULL; NOHUD + INLEVEL if (!player) return LUA_ErrInvalid(L, "player_t"); if (!lua_isnone(L, 2) && lua_isuserdata(L, 2)) @@ -716,6 +944,7 @@ static int lib_pResetPlayer(lua_State *L) { player_t *player = *((player_t **)luaL_checkudata(L, 1, META_PLAYER)); NOHUD + INLEVEL if (!player) return LUA_ErrInvalid(L, "player_t"); P_ResetPlayer(player); @@ -726,6 +955,7 @@ static int lib_pIsObjectInGoop(lua_State *L) { mobj_t *mo = *((mobj_t **)luaL_checkudata(L, 1, META_MOBJ)); //HUDSAFE + INLEVEL if (!mo) return LUA_ErrInvalid(L, "mobj_t"); lua_pushboolean(L, P_IsObjectInGoop(mo)); @@ -736,6 +966,7 @@ static int lib_pIsObjectOnGround(lua_State *L) { mobj_t *mo = *((mobj_t **)luaL_checkudata(L, 1, META_MOBJ)); //HUDSAFE + INLEVEL if (!mo) return LUA_ErrInvalid(L, "mobj_t"); lua_pushboolean(L, P_IsObjectOnGround(mo)); @@ -746,6 +977,7 @@ static int lib_pInSpaceSector(lua_State *L) { mobj_t *mo = *((mobj_t **)luaL_checkudata(L, 1, META_MOBJ)); //HUDSAFE + INLEVEL if (!mo) return LUA_ErrInvalid(L, "mobj_t"); lua_pushboolean(L, P_InSpaceSector(mo)); @@ -756,6 +988,7 @@ static int lib_pInQuicksand(lua_State *L) { mobj_t *mo = *((mobj_t **)luaL_checkudata(L, 1, META_MOBJ)); //HUDSAFE + INLEVEL if (!mo) return LUA_ErrInvalid(L, "mobj_t"); lua_pushboolean(L, P_InQuicksand(mo)); @@ -768,6 +1001,7 @@ static int lib_pSetObjectMomZ(lua_State *L) fixed_t value = luaL_checkfixed(L, 2); boolean relative = lua_optboolean(L, 3); NOHUD + INLEVEL if (!mo) return LUA_ErrInvalid(L, "mobj_t"); P_SetObjectMomZ(mo, value, relative); @@ -778,6 +1012,7 @@ static int lib_pRestoreMusic(lua_State *L) { player_t *player = *((player_t **)luaL_checkudata(L, 1, META_PLAYER)); NOHUD + INLEVEL if (!player) return LUA_ErrInvalid(L, "player_t"); if (P_IsLocalPlayer(player)) @@ -789,6 +1024,7 @@ static int lib_pSpawnShieldOrb(lua_State *L) { player_t *player = *((player_t **)luaL_checkudata(L, 1, META_PLAYER)); NOHUD + INLEVEL if (!player) return LUA_ErrInvalid(L, "player_t"); P_SpawnShieldOrb(player); @@ -799,6 +1035,7 @@ static int lib_pSpawnGhostMobj(lua_State *L) { mobj_t *mobj = *((mobj_t **)luaL_checkudata(L, 1, META_MOBJ)); NOHUD + INLEVEL if (!mobj) return LUA_ErrInvalid(L, "mobj_t"); LUA_PushUserdata(L, P_SpawnGhostMobj(mobj), META_MOBJ); @@ -810,6 +1047,7 @@ static int lib_pGivePlayerRings(lua_State *L) player_t *player = *((player_t **)luaL_checkudata(L, 1, META_PLAYER)); INT32 num_rings = (INT32)luaL_checkinteger(L, 2); NOHUD + INLEVEL if (!player) return LUA_ErrInvalid(L, "player_t"); P_GivePlayerRings(player, num_rings); @@ -821,16 +1059,31 @@ static int lib_pGivePlayerLives(lua_State *L) player_t *player = *((player_t **)luaL_checkudata(L, 1, META_PLAYER)); INT32 numlives = (INT32)luaL_checkinteger(L, 2); NOHUD + INLEVEL if (!player) return LUA_ErrInvalid(L, "player_t"); P_GivePlayerLives(player, numlives); return 0; } +static int lib_pGiveCoopLives(lua_State *L) +{ + player_t *player = *((player_t **)luaL_checkudata(L, 1, META_PLAYER)); + INT32 numlives = (INT32)luaL_checkinteger(L, 2); + boolean sound = (boolean)lua_opttrueboolean(L, 3); + NOHUD + INLEVEL + if (!player) + return LUA_ErrInvalid(L, "player_t"); + P_GiveCoopLives(player, numlives, sound); + return 0; +} + static int lib_pResetScore(lua_State *L) { player_t *player = *((player_t **)luaL_checkudata(L, 1, META_PLAYER)); NOHUD + INLEVEL if (!player) return LUA_ErrInvalid(L, "player_t"); P_ResetScore(player); @@ -841,29 +1094,44 @@ static int lib_pDoJumpShield(lua_State *L) { player_t *player = *((player_t **)luaL_checkudata(L, 1, META_PLAYER)); NOHUD + INLEVEL if (!player) return LUA_ErrInvalid(L, "player_t"); P_DoJumpShield(player); return 0; } +static int lib_pDoBubbleBounce(lua_State *L) +{ + player_t *player = *((player_t **)luaL_checkudata(L, 1, META_PLAYER)); + NOHUD + INLEVEL + if (!player) + return LUA_ErrInvalid(L, "player_t"); + P_DoBubbleBounce(player); + return 0; +} + static int lib_pBlackOw(lua_State *L) { player_t *player = *((player_t **)luaL_checkudata(L, 1, META_PLAYER)); NOHUD + INLEVEL if (!player) return LUA_ErrInvalid(L, "player_t"); P_BlackOw(player); return 0; } -static int lib_pElementalFireTrail(lua_State *L) +static int lib_pElementalFire(lua_State *L) { player_t *player = *((player_t **)luaL_checkudata(L, 1, META_PLAYER)); + boolean cropcircle = lua_optboolean(L, 2); NOHUD + INLEVEL if (!player) return LUA_ErrInvalid(L, "player_t"); - P_ElementalFireTrail(player); + P_ElementalFire(player, cropcircle); return 0; } @@ -871,6 +1139,7 @@ static int lib_pDoPlayerExit(lua_State *L) { player_t *player = *((player_t **)luaL_checkudata(L, 1, META_PLAYER)); NOHUD + INLEVEL if (!player) return LUA_ErrInvalid(L, "player_t"); P_DoPlayerExit(player); @@ -883,6 +1152,7 @@ static int lib_pInstaThrust(lua_State *L) angle_t angle = luaL_checkangle(L, 2); fixed_t move = luaL_checkfixed(L, 3); NOHUD + INLEVEL if (!mo) return LUA_ErrInvalid(L, "mobj_t"); P_InstaThrust(mo, angle, move); @@ -918,10 +1188,13 @@ static int lib_pReturnThrustY(lua_State *L) static int lib_pLookForEnemies(lua_State *L) { player_t *player = *((player_t **)luaL_checkudata(L, 1, META_PLAYER)); + boolean nonenemies = lua_opttrueboolean(L, 2); + boolean bullet = lua_optboolean(L, 3); NOHUD + INLEVEL if (!player) return LUA_ErrInvalid(L, "player_t"); - lua_pushboolean(L, P_LookForEnemies(player)); + LUA_PushUserdata(L, P_LookForEnemies(player, nonenemies, bullet), META_MOBJ); return 1; } @@ -931,6 +1204,7 @@ static int lib_pNukeEnemies(lua_State *L) mobj_t *source = *((mobj_t **)luaL_checkudata(L, 2, META_MOBJ)); fixed_t radius = luaL_checkfixed(L, 3); NOHUD + INLEVEL if (!inflictor || !source) return LUA_ErrInvalid(L, "mobj_t"); P_NukeEnemies(inflictor, source, radius); @@ -942,6 +1216,7 @@ static int lib_pHomingAttack(lua_State *L) mobj_t *source = *((mobj_t **)luaL_checkudata(L, 1, META_MOBJ)); mobj_t *enemy = *((mobj_t **)luaL_checkudata(L, 2, META_MOBJ)); NOHUD + INLEVEL if (!source || !enemy) return LUA_ErrInvalid(L, "mobj_t"); P_HomingAttack(source, enemy); @@ -952,6 +1227,7 @@ static int lib_pSuperReady(lua_State *L) { player_t *player = *((player_t **)luaL_checkudata(L, 1, META_PLAYER)); //HUDSAFE + INLEVEL if (!player) return LUA_ErrInvalid(L, "player_t"); lua_pushboolean(L, P_SuperReady(player)); @@ -963,6 +1239,7 @@ static int lib_pDoJump(lua_State *L) player_t *player = *((player_t **)luaL_checkudata(L, 1, META_PLAYER)); boolean soundandstate = (boolean)lua_opttrueboolean(L, 2); NOHUD + INLEVEL if (!player) return LUA_ErrInvalid(L, "player_t"); P_DoJump(player, soundandstate); @@ -973,6 +1250,7 @@ static int lib_pSpawnThokMobj(lua_State *L) { player_t *player = *((player_t **)luaL_checkudata(L, 1, META_PLAYER)); NOHUD + INLEVEL if (!player) return LUA_ErrInvalid(L, "player_t"); P_SpawnThokMobj(player); @@ -984,6 +1262,7 @@ static int lib_pSpawnSpinMobj(lua_State *L) player_t *player = *((player_t **)luaL_checkudata(L, 1, META_PLAYER)); mobjtype_t type = luaL_checkinteger(L, 2); NOHUD + INLEVEL if (!player) return LUA_ErrInvalid(L, "player_t"); if (type >= NUMMOBJTYPES) @@ -998,12 +1277,25 @@ static int lib_pTelekinesis(lua_State *L) fixed_t thrust = luaL_checkfixed(L, 2); fixed_t range = luaL_checkfixed(L, 3); NOHUD + INLEVEL if (!player) return LUA_ErrInvalid(L, "player_t"); P_Telekinesis(player, thrust, range); return 0; } +static int lib_pSwitchShield(lua_State *L) +{ + player_t *player = *((player_t **)luaL_checkudata(L, 1, META_PLAYER)); + UINT16 shield = luaL_checkinteger(L, 2); + NOHUD + INLEVEL + if (!player) + return LUA_ErrInvalid(L, "player_t"); + P_SwitchShield(player, shield); + return 0; +} + // P_MAP /////////// @@ -1014,6 +1306,7 @@ static int lib_pCheckPosition(lua_State *L) fixed_t x = luaL_checkfixed(L, 2); fixed_t y = luaL_checkfixed(L, 3); NOHUD + INLEVEL if (!thing) return LUA_ErrInvalid(L, "mobj_t"); lua_pushboolean(L, P_CheckPosition(thing, x, y)); @@ -1030,6 +1323,7 @@ static int lib_pTryMove(lua_State *L) fixed_t y = luaL_checkfixed(L, 3); boolean allowdropoff = lua_optboolean(L, 4); NOHUD + INLEVEL if (!thing) return LUA_ErrInvalid(L, "mobj_t"); lua_pushboolean(L, P_TryMove(thing, x, y, allowdropoff)); @@ -1044,6 +1338,7 @@ static int lib_pMove(lua_State *L) mobj_t *actor = *((mobj_t **)luaL_checkudata(L, 1, META_MOBJ)); fixed_t speed = luaL_checkfixed(L, 2); NOHUD + INLEVEL if (!actor) return LUA_ErrInvalid(L, "mobj_t"); lua_pushboolean(L, P_Move(actor, speed)); @@ -1060,6 +1355,7 @@ static int lib_pTeleportMove(lua_State *L) fixed_t y = luaL_checkfixed(L, 3); fixed_t z = luaL_checkfixed(L, 4); NOHUD + INLEVEL if (!thing) return LUA_ErrInvalid(L, "mobj_t"); lua_pushboolean(L, P_TeleportMove(thing, x, y, z)); @@ -1072,6 +1368,7 @@ static int lib_pSlideMove(lua_State *L) { mobj_t *mo = *((mobj_t **)luaL_checkudata(L, 1, META_MOBJ)); NOHUD + INLEVEL if (!mo) return LUA_ErrInvalid(L, "mobj_t"); P_SlideMove(mo); @@ -1082,6 +1379,7 @@ static int lib_pBounceMove(lua_State *L) { mobj_t *mo = *((mobj_t **)luaL_checkudata(L, 1, META_MOBJ)); NOHUD + INLEVEL if (!mo) return LUA_ErrInvalid(L, "mobj_t"); P_BounceMove(mo); @@ -1093,6 +1391,7 @@ static int lib_pCheckSight(lua_State *L) mobj_t *t1 = *((mobj_t **)luaL_checkudata(L, 1, META_MOBJ)); mobj_t *t2 = *((mobj_t **)luaL_checkudata(L, 2, META_MOBJ)); //HUDSAFE? + INLEVEL if (!t1 || !t2) return LUA_ErrInvalid(L, "mobj_t"); lua_pushboolean(L, P_CheckSight(t1, t2)); @@ -1107,6 +1406,7 @@ static int lib_pCheckHoopPosition(lua_State *L) fixed_t z = luaL_checkfixed(L, 4); fixed_t radius = luaL_checkfixed(L, 5); NOHUD + INLEVEL if (!hoopthing) return LUA_ErrInvalid(L, "mobj_t"); P_CheckHoopPosition(hoopthing, x, y, z, radius); @@ -1118,10 +1418,12 @@ static int lib_pRadiusAttack(lua_State *L) mobj_t *spot = *((mobj_t **)luaL_checkudata(L, 1, META_MOBJ)); mobj_t *source = *((mobj_t **)luaL_checkudata(L, 2, META_MOBJ)); fixed_t damagedist = luaL_checkfixed(L, 3); + UINT8 damagetype = luaL_optinteger(L, 4, 0); NOHUD + INLEVEL if (!spot || !source) return LUA_ErrInvalid(L, "mobj_t"); - P_RadiusAttack(spot, source, damagedist); + P_RadiusAttack(spot, source, damagedist, damagetype); return 0; } @@ -1132,6 +1434,7 @@ static int lib_pFloorzAtPos(lua_State *L) fixed_t z = luaL_checkfixed(L, 3); fixed_t height = luaL_checkfixed(L, 4); //HUDSAFE + INLEVEL lua_pushfixed(L, P_FloorzAtPos(x, y, z, height)); return 1; } @@ -1141,6 +1444,7 @@ static int lib_pDoSpring(lua_State *L) mobj_t *spring = *((mobj_t **)luaL_checkudata(L, 1, META_MOBJ)); mobj_t *object = *((mobj_t **)luaL_checkudata(L, 2, META_MOBJ)); NOHUD + INLEVEL if (!spring || !object) return LUA_ErrInvalid(L, "mobj_t"); lua_pushboolean(L, P_DoSpring(spring, object)); @@ -1154,6 +1458,7 @@ static int lib_pRemoveShield(lua_State *L) { player_t *player = *((player_t **)luaL_checkudata(L, 1, META_PLAYER)); NOHUD + INLEVEL if (!player) return LUA_ErrInvalid(L, "player_t"); P_RemoveShield(player); @@ -1164,7 +1469,9 @@ static int lib_pDamageMobj(lua_State *L) { mobj_t *target = *((mobj_t **)luaL_checkudata(L, 1, META_MOBJ)), *inflictor = NULL, *source = NULL; INT32 damage; + UINT8 damagetype; NOHUD + INLEVEL if (!target) return LUA_ErrInvalid(L, "mobj_t"); if (!lua_isnone(L, 2) && lua_isuserdata(L, 2)) @@ -1172,21 +1479,25 @@ static int lib_pDamageMobj(lua_State *L) if (!lua_isnone(L, 3) && lua_isuserdata(L, 3)) source = *((mobj_t **)luaL_checkudata(L, 3, META_MOBJ)); damage = (INT32)luaL_optinteger(L, 4, 1); - lua_pushboolean(L, P_DamageMobj(target, inflictor, source, damage)); + damagetype = (UINT8)luaL_optinteger(L, 5, 0); + lua_pushboolean(L, P_DamageMobj(target, inflictor, source, damage, damagetype)); return 1; } static int lib_pKillMobj(lua_State *L) { mobj_t *target = *((mobj_t **)luaL_checkudata(L, 1, META_MOBJ)), *inflictor = NULL, *source = NULL; + UINT8 damagetype; NOHUD + INLEVEL if (!target) return LUA_ErrInvalid(L, "mobj_t"); if (!lua_isnone(L, 2) && lua_isuserdata(L, 2)) inflictor = *((mobj_t **)luaL_checkudata(L, 2, META_MOBJ)); if (!lua_isnone(L, 3) && lua_isuserdata(L, 3)) source = *((mobj_t **)luaL_checkudata(L, 3, META_MOBJ)); - P_KillMobj(target, inflictor, source); + damagetype = (UINT8)luaL_optinteger(L, 4, 0); + P_KillMobj(target, inflictor, source, damagetype); return 0; } @@ -1195,10 +1506,11 @@ static int lib_pPlayerRingBurst(lua_State *L) player_t *player = *((player_t **)luaL_checkudata(L, 1, META_PLAYER)); INT32 num_rings = (INT32)luaL_optinteger(L, 2, -1); NOHUD + INLEVEL if (!player) return LUA_ErrInvalid(L, "player_t"); if (num_rings == -1) - num_rings = player->health - 1; + num_rings = player->rings; P_PlayerRingBurst(player, num_rings); return 0; } @@ -1207,6 +1519,7 @@ static int lib_pPlayerWeaponPanelBurst(lua_State *L) { player_t *player = *((player_t **)luaL_checkudata(L, 1, META_PLAYER)); NOHUD + INLEVEL if (!player) return LUA_ErrInvalid(L, "player_t"); P_PlayerWeaponPanelBurst(player); @@ -1217,17 +1530,30 @@ static int lib_pPlayerWeaponAmmoBurst(lua_State *L) { player_t *player = *((player_t **)luaL_checkudata(L, 1, META_PLAYER)); NOHUD + INLEVEL if (!player) return LUA_ErrInvalid(L, "player_t"); P_PlayerWeaponAmmoBurst(player); return 0; } +static int lib_pPlayerWeaponPanelOrAmmoBurst(lua_State *L) +{ + player_t *player = *((player_t **)luaL_checkudata(L, 1, META_PLAYER)); + NOHUD + INLEVEL + if (!player) + return LUA_ErrInvalid(L, "player_t"); + P_PlayerWeaponPanelOrAmmoBurst(player); + return 0; +} + static int lib_pPlayerEmeraldBurst(lua_State *L) { player_t *player = *((player_t **)luaL_checkudata(L, 1, META_PLAYER)); boolean toss = lua_optboolean(L, 2); NOHUD + INLEVEL if (!player) return LUA_ErrInvalid(L, "player_t"); P_PlayerEmeraldBurst(player, toss); @@ -1239,6 +1565,7 @@ static int lib_pPlayerFlagBurst(lua_State *L) player_t *player = *((player_t **)luaL_checkudata(L, 1, META_PLAYER)); boolean toss = lua_optboolean(L, 2); NOHUD + INLEVEL if (!player) return LUA_ErrInvalid(L, "player_t"); P_PlayerFlagBurst(player, toss); @@ -1250,6 +1577,7 @@ static int lib_pPlayRinglossSound(lua_State *L) mobj_t *source = *((mobj_t **)luaL_checkudata(L, 1, META_MOBJ)); player_t *player = NULL; NOHUD + INLEVEL if (!source) return LUA_ErrInvalid(L, "mobj_t"); if (!lua_isnone(L, 2) && lua_isuserdata(L, 2)) @@ -1268,6 +1596,7 @@ static int lib_pPlayDeathSound(lua_State *L) mobj_t *source = *((mobj_t **)luaL_checkudata(L, 1, META_MOBJ)); player_t *player = NULL; NOHUD + INLEVEL if (!source) return LUA_ErrInvalid(L, "mobj_t"); if (!lua_isnone(L, 2) && lua_isuserdata(L, 2)) @@ -1286,6 +1615,7 @@ static int lib_pPlayVictorySound(lua_State *L) mobj_t *source = *((mobj_t **)luaL_checkudata(L, 1, META_MOBJ)); player_t *player = NULL; NOHUD + INLEVEL if (!source) return LUA_ErrInvalid(L, "mobj_t"); if (!lua_isnone(L, 2) && lua_isuserdata(L, 2)) @@ -1303,6 +1633,7 @@ static int lib_pPlayLivesJingle(lua_State *L) { player_t *player = *((player_t **)luaL_checkudata(L, 1, META_PLAYER)); NOHUD + INLEVEL if (!player) return LUA_ErrInvalid(L, "player_t"); P_PlayLivesJingle(player); @@ -1314,6 +1645,7 @@ static int lib_pCanPickupItem(lua_State *L) player_t *player = *((player_t **)luaL_checkudata(L, 1, META_PLAYER)); boolean weapon = lua_optboolean(L, 2); //HUDSAFE + INLEVEL if (!player) return LUA_ErrInvalid(L, "player_t"); lua_pushboolean(L, P_CanPickupItem(player, weapon)); @@ -1324,12 +1656,24 @@ static int lib_pDoNightsScore(lua_State *L) { player_t *player = *((player_t **)luaL_checkudata(L, 1, META_PLAYER)); NOHUD + INLEVEL if (!player) return LUA_ErrInvalid(L, "player_t"); P_DoNightsScore(player); return 0; } +static int lib_pDoMatchSuper(lua_State *L) +{ + player_t *player = *((player_t **)luaL_checkudata(L, 1, META_PLAYER)); + NOHUD + INLEVEL + if (!player) + return LUA_ErrInvalid(L, "player_t"); + P_DoMatchSuper(player); + return 0; +} + // P_SPEC //////////// @@ -1339,6 +1683,7 @@ static int lib_pThrust(lua_State *L) angle_t angle = luaL_checkangle(L, 2); fixed_t move = luaL_checkfixed(L, 3); NOHUD + INLEVEL if (!mo) return LUA_ErrInvalid(L, "mobj_t"); P_Thrust(mo, angle, move); @@ -1350,6 +1695,7 @@ static int lib_pSetMobjStateNF(lua_State *L) mobj_t *mobj = *((mobj_t **)luaL_checkudata(L, 1, META_MOBJ)); statenum_t state = luaL_checkinteger(L, 2); NOHUD + INLEVEL if (!mobj) return LUA_ErrInvalid(L, "mobj_t"); if (state >= NUMSTATES) @@ -1365,6 +1711,7 @@ static int lib_pDoSuperTransformation(lua_State *L) player_t *player = *((player_t **)luaL_checkudata(L, 1, META_PLAYER)); boolean giverings = lua_optboolean(L, 2); NOHUD + INLEVEL if (!player) return LUA_ErrInvalid(L, "player_t"); P_DoSuperTransformation(player, giverings); @@ -1375,6 +1722,7 @@ static int lib_pExplodeMissile(lua_State *L) { mobj_t *mo = *((mobj_t **)luaL_checkudata(L, 1, META_MOBJ)); NOHUD + INLEVEL if (!mo) return LUA_ErrInvalid(L, "mobj_t"); P_ExplodeMissile(mo); @@ -1387,18 +1735,92 @@ static int lib_pPlayerTouchingSectorSpecial(lua_State *L) INT32 section = (INT32)luaL_checkinteger(L, 2); INT32 number = (INT32)luaL_checkinteger(L, 3); //HUDSAFE + INLEVEL if (!player) return LUA_ErrInvalid(L, "player_t"); LUA_PushUserdata(L, P_PlayerTouchingSectorSpecial(player, section, number), META_SECTOR); return 1; } +static int lib_pFindLowestFloorSurrounding(lua_State *L) +{ + sector_t *sector = *((sector_t **)luaL_checkudata(L, 1, META_SECTOR)); + //HUDSAFE + INLEVEL + if (!sector) + return LUA_ErrInvalid(L, "sector_t"); + lua_pushfixed(L, P_FindLowestFloorSurrounding(sector)); + return 1; +} + +static int lib_pFindHighestFloorSurrounding(lua_State *L) +{ + sector_t *sector = *((sector_t **)luaL_checkudata(L, 1, META_SECTOR)); + //HUDSAFE + INLEVEL + if (!sector) + return LUA_ErrInvalid(L, "sector_t"); + lua_pushfixed(L, P_FindHighestFloorSurrounding(sector)); + return 1; +} + +static int lib_pFindNextHighestFloor(lua_State *L) +{ + sector_t *sector = *((sector_t **)luaL_checkudata(L, 1, META_SECTOR)); + fixed_t currentheight; + //HUDSAFE + INLEVEL + if (!sector) + return LUA_ErrInvalid(L, "sector_t"); + // defaults to floorheight of sector arg + currentheight = (fixed_t)luaL_optinteger(L, 2, sector->floorheight); + lua_pushfixed(L, P_FindNextHighestFloor(sector, currentheight)); + return 1; +} + +static int lib_pFindNextLowestFloor(lua_State *L) +{ + sector_t *sector = *((sector_t **)luaL_checkudata(L, 1, META_SECTOR)); + fixed_t currentheight; + //HUDSAFE + INLEVEL + if (!sector) + return LUA_ErrInvalid(L, "sector_t"); + // defaults to floorheight of sector arg + currentheight = (fixed_t)luaL_optinteger(L, 2, sector->floorheight); + lua_pushfixed(L, P_FindNextLowestFloor(sector, currentheight)); + return 1; +} + +static int lib_pFindLowestCeilingSurrounding(lua_State *L) +{ + sector_t *sector = *((sector_t **)luaL_checkudata(L, 1, META_SECTOR)); + //HUDSAFE + INLEVEL + if (!sector) + return LUA_ErrInvalid(L, "sector_t"); + lua_pushfixed(L, P_FindLowestCeilingSurrounding(sector)); + return 1; +} + +static int lib_pFindHighestCeilingSurrounding(lua_State *L) +{ + sector_t *sector = *((sector_t **)luaL_checkudata(L, 1, META_SECTOR)); + //HUDSAFE + INLEVEL + if (!sector) + return LUA_ErrInvalid(L, "sector_t"); + lua_pushfixed(L, P_FindHighestCeilingSurrounding(sector)); + return 1; +} + static int lib_pFindSpecialLineFromTag(lua_State *L) { INT16 special = (INT16)luaL_checkinteger(L, 1); INT16 line = (INT16)luaL_checkinteger(L, 2); INT32 start = (INT32)luaL_optinteger(L, 3, -1); NOHUD + INLEVEL lua_pushinteger(L, P_FindSpecialLineFromTag(special, line, start)); return 1; } @@ -1408,6 +1830,7 @@ static int lib_pSwitchWeather(lua_State *L) INT32 weathernum = (INT32)luaL_checkinteger(L, 1); player_t *user = NULL; NOHUD + INLEVEL if (!lua_isnone(L, 2) && lua_isuserdata(L, 2)) // if a player, setup weather for only the player, otherwise setup weather for all players user = *((player_t **)luaL_checkudata(L, 2, META_PLAYER)); if (!user) // global @@ -1423,6 +1846,7 @@ static int lib_pLinedefExecute(lua_State *L) mobj_t *actor = NULL; sector_t *caller = NULL; NOHUD + INLEVEL if (!lua_isnone(L, 2) && lua_isuserdata(L, 2)) actor = *((mobj_t **)luaL_checkudata(L, 2, META_MOBJ)); if (!lua_isnone(L, 3) && lua_isuserdata(L, 3)) @@ -1435,6 +1859,7 @@ static int lib_pSpawnLightningFlash(lua_State *L) { sector_t *sector = *((sector_t **)luaL_checkudata(L, 1, META_SECTOR)); NOHUD + INLEVEL if (!sector) return LUA_ErrInvalid(L, "sector_t"); P_SpawnLightningFlash(sector); @@ -1446,8 +1871,11 @@ static int lib_pFadeLight(lua_State *L) INT16 tag = (INT16)luaL_checkinteger(L, 1); INT32 destvalue = (INT32)luaL_checkinteger(L, 2); INT32 speed = (INT32)luaL_checkinteger(L, 3); + boolean ticbased = lua_optboolean(L, 4); + boolean force = lua_optboolean(L, 5); NOHUD - P_FadeLight(tag, destvalue, speed); + INLEVEL + P_FadeLight(tag, destvalue, speed, ticbased, force); return 0; } @@ -1455,6 +1883,7 @@ static int lib_pThingOnSpecial3DFloor(lua_State *L) { mobj_t *mo = *((mobj_t **)luaL_checkudata(L, 1, META_MOBJ)); NOHUD + INLEVEL if (!mo) return LUA_ErrInvalid(L, "mobj_t"); LUA_PushUserdata(L, P_ThingOnSpecial3DFloor(mo), META_SECTOR); @@ -1465,6 +1894,7 @@ static int lib_pIsFlagAtBase(lua_State *L) { mobjtype_t flag = luaL_checkinteger(L, 1); NOHUD + INLEVEL if (flag >= NUMMOBJTYPES) return luaL_error(L, "mobj type %d out of range (0 - %d)", flag, NUMMOBJTYPES-1); lua_pushboolean(L, P_IsFlagAtBase(flag)); @@ -1476,6 +1906,7 @@ static int lib_pSetupLevelSky(lua_State *L) INT32 skynum = (INT32)luaL_checkinteger(L, 1); player_t *user = NULL; NOHUD + INLEVEL if (!lua_isnone(L, 2) && lua_isuserdata(L, 2)) // if a player, setup sky for only the player, otherwise setup sky for all players user = *((player_t **)luaL_checkudata(L, 2, META_PLAYER)); if (!user) // global @@ -1494,6 +1925,7 @@ static int lib_pSetSkyboxMobj(lua_State *L) int w = 0; NOHUD + INLEVEL if (!lua_isnil(L,1)) // nil leaves mo as NULL to remove the skybox rendering. { mo = *((mobj_t **)luaL_checkudata(L, 1, META_MOBJ)); // otherwise it is a skybox mobj. @@ -1540,6 +1972,7 @@ static int lib_pStartQuake(lua_State *L) static mappoint_t q_epicenter = {0,0,0}; NOHUD + INLEVEL // While technically we don't support epicenter and radius, // we get their values anyway if they exist. @@ -1601,6 +2034,7 @@ static int lib_evCrumbleChain(lua_State *L) sector_t *sec = *((sector_t **)luaL_checkudata(L, 1, META_SECTOR)); ffloor_t *rover = *((ffloor_t **)luaL_checkudata(L, 2, META_FFLOOR)); NOHUD + INLEVEL if (!sec) return LUA_ErrInvalid(L, "sector_t"); if (!rover) @@ -1609,6 +2043,33 @@ static int lib_evCrumbleChain(lua_State *L) return 0; } +static int lib_evStartCrumble(lua_State *L) +{ + sector_t *sec = *((sector_t **)luaL_checkudata(L, 1, META_SECTOR)); + ffloor_t *rover = *((ffloor_t **)luaL_checkudata(L, 2, META_FFLOOR)); + boolean floating = lua_optboolean(L, 3); + player_t *player = NULL; + fixed_t origalpha; + boolean crumblereturn = lua_optboolean(L, 6); + NOHUD + if (!sec) + return LUA_ErrInvalid(L, "sector_t"); + if (!rover) + return LUA_ErrInvalid(L, "ffloor_t"); + if (!lua_isnone(L, 4) && lua_isuserdata(L, 4)) + { + player = *((player_t **)luaL_checkudata(L, 4, META_PLAYER)); + if (!player) + return LUA_ErrInvalid(L, "player_t"); + } + if (!lua_isnone(L,5)) + origalpha = luaL_checkfixed(L, 5); + else + origalpha = rover->alpha; + lua_pushboolean(L, EV_StartCrumble(sec, rover, floating, player, origalpha, crumblereturn) != 0); + return 0; +} + #ifdef ESLOPE // P_SLOPES //////////// @@ -1675,6 +2136,7 @@ static int lib_rPointInSubsector(lua_State *L) fixed_t x = luaL_checkfixed(L, 1); fixed_t y = luaL_checkfixed(L, 2); //HUDSAFE + INLEVEL LUA_PushUserdata(L, R_PointInSubsector(x, y), META_SUBSECTOR); return 1; } @@ -1709,6 +2171,7 @@ static int lib_rSetPlayerSkin(lua_State *L) { player_t *player = *((player_t **)luaL_checkudata(L, 1, META_PLAYER)); NOHUD + INLEVEL if (!player) return LUA_ErrInvalid(L, "player_t"); if (lua_isnoneornil(L, 2)) @@ -2022,6 +2485,7 @@ static int lib_sOriginPlaying(lua_State *L) { void *origin = *((mobj_t **)luaL_checkudata(L, 1, META_MOBJ)); NOHUD + INLEVEL if (!origin) return LUA_ErrInvalid(L, "mobj_t"); lua_pushboolean(L, S_OriginPlaying(origin)); @@ -2043,6 +2507,7 @@ static int lib_sSoundPlaying(lua_State *L) void *origin = *((mobj_t **)luaL_checkudata(L, 1, META_MOBJ)); sfxenum_t id = luaL_checkinteger(L, 2); NOHUD + INLEVEL if (!origin) return LUA_ErrInvalid(L, "mobj_t"); if (id >= NUMSFX) @@ -2051,6 +2516,31 @@ static int lib_sSoundPlaying(lua_State *L) return 1; } +// This doesn't really exist, but we're providing it as a handy netgame-safe wrapper for stuff that should be locally handled. + +static int lib_sStartMusicCaption(lua_State *L) +{ + player_t *player = NULL; + const char *caption = luaL_checkstring(L, 1); + UINT16 lifespan = (UINT16)luaL_checkinteger(L, 2); + //HUDSAFE + INLEVEL + + if (!lua_isnone(L, 3) && lua_isuserdata(L, 3)) + { + player = *((player_t **)luaL_checkudata(L, 3, META_PLAYER)); + if (!player) + return LUA_ErrInvalid(L, "player_t"); + } + + if (lifespan && (!player || P_IsLocalPlayer(player))) + { + strlcpy(S_sfx[sfx_None].caption, caption, sizeof(S_sfx[sfx_None].caption)); + S_StartCaption(sfx_None, -1, lifespan); + } + return 0; +} + // G_GAME //////////// @@ -2058,6 +2548,7 @@ static int lib_gBuildMapName(lua_State *L) { INT32 map = luaL_optinteger(L, 1, gamemap); //HUDSAFE + INLEVEL lua_pushstring(L, G_BuildMapName(map)); return 1; } @@ -2066,6 +2557,7 @@ static int lib_gDoReborn(lua_State *L) { INT32 playernum = luaL_checkinteger(L, 1); NOHUD + INLEVEL if (playernum >= MAXPLAYERS) return luaL_error(L, "playernum %d out of range (0 - %d)", playernum, MAXPLAYERS-1); G_DoReborn(playernum); @@ -2078,6 +2570,7 @@ static int lib_gSetCustomExitVars(lua_State *L) { int n = lua_gettop(L); // Num arguments NOHUD + INLEVEL // LUA EXTENSION: Custom exit like support // Supported: @@ -2119,6 +2612,7 @@ static int lib_gIsSpecialStage(lua_State *L) { INT32 mapnum = luaL_optinteger(L, 1, gamemap); //HUDSAFE + INLEVEL lua_pushboolean(L, G_IsSpecialStage(mapnum)); return 1; } @@ -2126,6 +2620,7 @@ static int lib_gIsSpecialStage(lua_State *L) static int lib_gGametypeUsesLives(lua_State *L) { //HUDSAFE + INLEVEL lua_pushboolean(L, G_GametypeUsesLives()); return 1; } @@ -2133,6 +2628,7 @@ static int lib_gGametypeUsesLives(lua_State *L) static int lib_gGametypeHasTeams(lua_State *L) { //HUDSAFE + INLEVEL lua_pushboolean(L, G_GametypeHasTeams()); return 1; } @@ -2140,6 +2636,7 @@ static int lib_gGametypeHasTeams(lua_State *L) static int lib_gGametypeHasSpectators(lua_State *L) { //HUDSAFE + INLEVEL lua_pushboolean(L, G_GametypeHasSpectators()); return 1; } @@ -2147,6 +2644,7 @@ static int lib_gGametypeHasSpectators(lua_State *L) static int lib_gRingSlingerGametype(lua_State *L) { //HUDSAFE + INLEVEL lua_pushboolean(L, G_RingSlingerGametype()); return 1; } @@ -2154,6 +2652,7 @@ static int lib_gRingSlingerGametype(lua_State *L) static int lib_gPlatformGametype(lua_State *L) { //HUDSAFE + INLEVEL lua_pushboolean(L, G_PlatformGametype()); return 1; } @@ -2161,6 +2660,7 @@ static int lib_gPlatformGametype(lua_State *L) static int lib_gTagGametype(lua_State *L) { //HUDSAFE + INLEVEL lua_pushboolean(L, G_TagGametype()); return 1; } @@ -2210,7 +2710,7 @@ static luaL_Reg lib[] = { {"print", lib_print}, {"chatprint", lib_chatprint}, {"chatprintf", lib_chatprintf}, - {"EvalMath", lib_evalMath}, + {"userdataType", lib_userdataType}, {"IsPlayerAdmin", lib_isPlayerAdmin}, // m_random @@ -2218,13 +2718,13 @@ static luaL_Reg lib[] = { {"P_RandomByte",lib_pRandomByte}, {"P_RandomKey",lib_pRandomKey}, {"P_RandomRange",lib_pRandomRange}, - {"P_Random",lib_pRandom}, // DEPRECATED {"P_SignedRandom",lib_pSignedRandom}, // MACRO {"P_RandomChance",lib_pRandomChance}, // MACRO // p_maputil {"P_AproxDistance",lib_pAproxDistance}, {"P_ClosestPointOnLine",lib_pClosestPointOnLine}, + {"P_PointOnLineSide",lib_pPointOnLineSide}, // p_enemy {"P_CheckMeleeRange", lib_pCheckMeleeRange}, @@ -2238,7 +2738,10 @@ static luaL_Reg lib[] = { // p_mobj // don't add P_SetMobjState or P_SetPlayerMobjState, use "mobj.state = S_NEWSTATE" instead. {"P_SpawnMobj",lib_pSpawnMobj}, + {"P_SpawnMobjFromMobj",lib_pSpawnMobjFromMobj}, {"P_RemoveMobj",lib_pRemoveMobj}, + {"P_IsValidSprite2", lib_pIsValidSprite2}, + {"P_SpawnLockOn", lib_pSpawnLockOn}, {"P_SpawnMissile",lib_pSpawnMissile}, {"P_SpawnXYZMissile",lib_pSpawnXYZMissile}, {"P_SpawnPointMissile",lib_pSpawnPointMissile}, @@ -2259,12 +2762,15 @@ static luaL_Reg lib[] = { {"P_CheckDeathPitCollide",lib_pCheckDeathPitCollide}, {"P_CheckSolidLava",lib_pCheckSolidLava}, {"P_CanRunOnWater",lib_pCanRunOnWater}, + {"P_MaceRotate",lib_pMaceRotate}, // p_user {"P_GetPlayerHeight",lib_pGetPlayerHeight}, {"P_GetPlayerSpinHeight",lib_pGetPlayerSpinHeight}, {"P_GetPlayerControlDirection",lib_pGetPlayerControlDirection}, {"P_AddPlayerScore",lib_pAddPlayerScore}, + {"P_StealPlayerScore",lib_pStealPlayerScore}, + {"P_GetJumpFlags",lib_pGetJumpFlags}, {"P_PlayerInPain",lib_pPlayerInPain}, {"P_DoPlayerPain",lib_pDoPlayerPain}, {"P_ResetPlayer",lib_pResetPlayer}, @@ -2278,10 +2784,12 @@ static luaL_Reg lib[] = { {"P_SpawnGhostMobj",lib_pSpawnGhostMobj}, {"P_GivePlayerRings",lib_pGivePlayerRings}, {"P_GivePlayerLives",lib_pGivePlayerLives}, + {"P_GiveCoopLives",lib_pGiveCoopLives}, {"P_ResetScore",lib_pResetScore}, {"P_DoJumpShield",lib_pDoJumpShield}, + {"P_DoBubbleBounce",lib_pDoBubbleBounce}, {"P_BlackOw",lib_pBlackOw}, - {"P_ElementalFireTrail",lib_pElementalFireTrail}, + {"P_ElementalFire",lib_pElementalFire}, {"P_DoPlayerExit",lib_pDoPlayerExit}, {"P_InstaThrust",lib_pInstaThrust}, {"P_ReturnThrustX",lib_pReturnThrustX}, @@ -2294,6 +2802,7 @@ static luaL_Reg lib[] = { {"P_SpawnThokMobj",lib_pSpawnThokMobj}, {"P_SpawnSpinMobj",lib_pSpawnSpinMobj}, {"P_Telekinesis",lib_pTelekinesis}, + {"P_SwitchShield",lib_pSwitchShield}, // p_map {"P_CheckPosition",lib_pCheckPosition}, @@ -2315,6 +2824,7 @@ static luaL_Reg lib[] = { {"P_PlayerRingBurst",lib_pPlayerRingBurst}, {"P_PlayerWeaponPanelBurst",lib_pPlayerWeaponPanelBurst}, {"P_PlayerWeaponAmmoBurst",lib_pPlayerWeaponAmmoBurst}, + {"P_PlayerWeaponPanelOrAmmoBurst", lib_pPlayerWeaponPanelOrAmmoBurst}, {"P_PlayerEmeraldBurst",lib_pPlayerEmeraldBurst}, {"P_PlayerFlagBurst",lib_pPlayerFlagBurst}, {"P_PlayRinglossSound",lib_pPlayRinglossSound}, @@ -2323,6 +2833,7 @@ static luaL_Reg lib[] = { {"P_PlayLivesJingle",lib_pPlayLivesJingle}, {"P_CanPickupItem",lib_pCanPickupItem}, {"P_DoNightsScore",lib_pDoNightsScore}, + {"P_DoMatchSuper",lib_pDoMatchSuper}, // p_spec {"P_Thrust",lib_pThrust}, @@ -2330,6 +2841,12 @@ static luaL_Reg lib[] = { {"P_DoSuperTransformation",lib_pDoSuperTransformation}, {"P_ExplodeMissile",lib_pExplodeMissile}, {"P_PlayerTouchingSectorSpecial",lib_pPlayerTouchingSectorSpecial}, + {"P_FindLowestFloorSurrounding",lib_pFindLowestFloorSurrounding}, + {"P_FindHighestFloorSurrounding",lib_pFindHighestFloorSurrounding}, + {"P_FindNextHighestFloor",lib_pFindNextHighestFloor}, + {"P_FindNextLowestFloor",lib_pFindNextLowestFloor}, + {"P_FindLowestCeilingSurrounding",lib_pFindLowestCeilingSurrounding}, + {"P_FindHighestCeilingSurrounding",lib_pFindHighestCeilingSurrounding}, {"P_FindSpecialLineFromTag",lib_pFindSpecialLineFromTag}, {"P_SwitchWeather",lib_pSwitchWeather}, {"P_LinedefExecute",lib_pLinedefExecute}, @@ -2341,6 +2858,7 @@ static luaL_Reg lib[] = { {"P_SetSkyboxMobj",lib_pSetSkyboxMobj}, {"P_StartQuake",lib_pStartQuake}, {"EV_CrumbleChain",lib_evCrumbleChain}, + {"EV_StartCrumble",lib_evStartCrumble}, #ifdef ESLOPE // p_slopes @@ -2377,6 +2895,7 @@ static luaL_Reg lib[] = { {"S_OriginPlaying",lib_sOriginPlaying}, {"S_IdPlaying",lib_sIdPlaying}, {"S_SoundPlaying",lib_sSoundPlaying}, + {"S_StartMusicCaption", lib_sStartMusicCaption}, // g_game {"G_BuildMapName",lib_gBuildMapName}, diff --git a/src/lua_consolelib.c b/src/lua_consolelib.c index dced4e43c..98d18d8db 100644 --- a/src/lua_consolelib.c +++ b/src/lua_consolelib.c @@ -22,7 +22,15 @@ #include "lua_libs.h" #include "lua_hud.h" // hud_running errors -#define NOHUD if (hud_running) return luaL_error(L, "HUD rendering code should not call this function!"); +// for functions not allowed in hud.add hooks +#define NOHUD if (hud_running)\ +return luaL_error(L, "HUD rendering code should not call this function!"); +// for functions not allowed in hooks or coroutines (supercedes above) +#define NOHOOK if (!lua_lumploading)\ + return luaL_error(L, "This function cannot be called from within a hook or coroutine!"); +// for functions only allowed within a level +#define INLEVEL if (gamestate != GS_LEVEL)\ +return luaL_error(L, "This function can only be used in a level!"); static const char *cvname = NULL; @@ -83,7 +91,7 @@ deny: CONS_Alert(CONS_WARNING, M_GetText("Illegal lua command received from %s\n"), player_names[playernum]); if (server) { - XBOXSTATIC UINT8 bufn[2]; + UINT8 bufn[2]; bufn[0] = (UINT8)playernum; bufn[1] = KICK_MSG_CON_FAIL; @@ -183,7 +191,7 @@ static int lib_comAddCommand(lua_State *L) strlwr(name); luaL_checktype(L, 2, LUA_TFUNCTION); - NOHUD + NOHOOK if (lua_gettop(L) >= 3) { // For the third argument, only take a boolean or a number. lua_settop(L, 3); @@ -295,7 +303,7 @@ static int lib_cvRegisterVar(lua_State *L) consvar_t *cvar; luaL_checktype(L, 1, LUA_TTABLE); lua_settop(L, 1); // Clear out all other possible arguments, leaving only the first one. - NOHUD + NOHOOK cvar = lua_newuserdata(L, sizeof(consvar_t)); luaL_getmetatable(L, META_CVAR); lua_setmetatable(L, -2); @@ -423,6 +431,7 @@ static int lib_consPrintf(lua_State *L) if (n < 2) return luaL_error(L, "CONS_Printf requires at least two arguments: player and text."); //HUDSAFE + INLEVEL plr = *((player_t **)luaL_checkudata(L, 1, META_PLAYER)); if (!plr) return LUA_ErrInvalid(L, "player_t"); diff --git a/src/lua_hook.h b/src/lua_hook.h index 252960edf..9fcc36594 100644 --- a/src/lua_hook.h +++ b/src/lua_hook.h @@ -43,6 +43,11 @@ enum hook { hook_PlayerMsg, hook_HurtMsg, hook_PlayerSpawn, + hook_ShieldSpawn, + hook_ShieldSpecial, + hook_MobjMoveBlocked, + hook_MapThingSpawn, + hook_FollowMobj, hook_PlayerQuit, hook_MAX // last hook @@ -63,21 +68,26 @@ boolean LUAh_TouchSpecial(mobj_t *special, mobj_t *toucher); // Hook for P_Touch #define LUAh_MobjFuse(mo) LUAh_MobjHook(mo, hook_MobjFuse) // Hook for mobj->fuse == 0 by mobj type boolean LUAh_MobjThinker(mobj_t *mo); // Hook for P_MobjThinker or P_SceneryThinker by mobj type #define LUAh_BossThinker(mo) LUAh_MobjHook(mo, hook_BossThinker) // Hook for P_GenericBossThinker by mobj type -UINT8 LUAh_ShouldDamage(mobj_t *target, mobj_t *inflictor, mobj_t *source, INT32 damage); // Hook for P_DamageMobj by mobj type (Should mobj take damage?) -boolean LUAh_MobjDamage(mobj_t *target, mobj_t *inflictor, mobj_t *source, INT32 damage); // Hook for P_DamageMobj by mobj type (Mobj actually takes damage!) -boolean LUAh_MobjDeath(mobj_t *target, mobj_t *inflictor, mobj_t *source); // Hook for P_KillMobj by mobj type +UINT8 LUAh_ShouldDamage(mobj_t *target, mobj_t *inflictor, mobj_t *source, INT32 damage, UINT8 damagetype); // Hook for P_DamageMobj by mobj type (Should mobj take damage?) +boolean LUAh_MobjDamage(mobj_t *target, mobj_t *inflictor, mobj_t *source, INT32 damage, UINT8 damagetype); // Hook for P_DamageMobj by mobj type (Mobj actually takes damage!) +boolean LUAh_MobjDeath(mobj_t *target, mobj_t *inflictor, mobj_t *source, UINT8 damagetype); // Hook for P_KillMobj by mobj type #define LUAh_BossDeath(mo) LUAh_MobjHook(mo, hook_BossDeath) // Hook for A_BossDeath by mobj type #define LUAh_MobjRemoved(mo) LUAh_MobjHook(mo, hook_MobjRemoved) // Hook for P_RemoveMobj by mobj type #define LUAh_JumpSpecial(player) LUAh_PlayerHook(player, hook_JumpSpecial) // Hook for P_DoJumpStuff (Any-jumping) #define LUAh_AbilitySpecial(player) LUAh_PlayerHook(player, hook_AbilitySpecial) // Hook for P_DoJumpStuff (Double-jumping) -#define LUAh_SpinSpecial(player) LUAh_PlayerHook(player, hook_SpinSpecial) // Hook for P_DoSpinDash (Spin button effect) +#define LUAh_SpinSpecial(player) LUAh_PlayerHook(player, hook_SpinSpecial) // Hook for P_DoSpinAbility (Spin button effect) #define LUAh_JumpSpinSpecial(player) LUAh_PlayerHook(player, hook_JumpSpinSpecial) // Hook for P_DoJumpStuff (Spin button effect (mid-air)) boolean LUAh_BotTiccmd(player_t *bot, ticcmd_t *cmd); // Hook for B_BuildTiccmd boolean LUAh_BotAI(mobj_t *sonic, mobj_t *tails, ticcmd_t *cmd); // Hook for B_BuildTailsTiccmd by skin name boolean LUAh_LinedefExecute(line_t *line, mobj_t *mo, sector_t *sector); // Hook for linedef executors boolean LUAh_PlayerMsg(int source, int target, int flags, char *msg); // Hook for chat messages -boolean LUAh_HurtMsg(player_t *player, mobj_t *inflictor, mobj_t *source); // Hook for hurt messages +boolean LUAh_HurtMsg(player_t *player, mobj_t *inflictor, mobj_t *source, UINT8 damagetype); // Hook for hurt messages #define LUAh_PlayerSpawn(player) LUAh_PlayerHook(player, hook_PlayerSpawn) // Hook for G_SpawnPlayer +#define LUAh_ShieldSpawn(player) LUAh_PlayerHook(player, hook_ShieldSpawn) // Hook for P_SpawnShieldOrb +#define LUAh_ShieldSpecial(player) LUAh_PlayerHook(player, hook_ShieldSpecial) // Hook for shield abilities +#define LUAh_MobjMoveBlocked(mo) LUAh_MobjHook(mo, hook_MobjMoveBlocked) // Hook for P_XYMovement (when movement is blocked) +boolean LUAh_MapThingSpawn(mobj_t *mo, mapthing_t *mthing); // Hook for P_SpawnMapThing by mobj type +boolean LUAh_FollowMobj(player_t *player, mobj_t *mo); // Hook for P_PlayerAfterThink Smiles mobj-following void LUAh_PlayerQuit(player_t *plr, int reason); // Hook for player quitting #endif diff --git a/src/lua_hooklib.c b/src/lua_hooklib.c index 948eca84c..d605499e2 100644 --- a/src/lua_hooklib.c +++ b/src/lua_hooklib.c @@ -54,6 +54,11 @@ const char *const hookNames[hook_MAX+1] = { "PlayerMsg", "HurtMsg", "PlayerSpawn", + "ShieldSpawn", + "ShieldSpecial", + "MobjMoveBlocked", + "MapThingSpawn", + "FollowMobj", "PlayerQuit", NULL }; @@ -106,8 +111,8 @@ static int lib_addHook(lua_State *L) luaL_checktype(L, 1, LUA_TFUNCTION); - if (hud_running) - return luaL_error(L, "HUD rendering code should not call this function!"); + if (!lua_lumploading) + return luaL_error(L, "This function cannot be called from within a hook or coroutine!"); switch(hook.type) { @@ -125,6 +130,8 @@ static int lib_addHook(lua_State *L) case hook_BossDeath: case hook_MobjRemoved: case hook_HurtMsg: + case hook_MobjMoveBlocked: + case hook_MapThingSpawn: hook.s.mt = MT_NULL; if (lua_isnumber(L, 2)) hook.s.mt = lua_tonumber(L, 2); @@ -183,6 +190,8 @@ static int lib_addHook(lua_State *L) case hook_MobjDeath: case hook_BossDeath: case hook_MobjRemoved: + case hook_MobjMoveBlocked: + case hook_MapThingSpawn: lastp = &mobjhooks[hook.s.mt]; break; case hook_JumpSpecial: @@ -190,6 +199,9 @@ static int lib_addHook(lua_State *L) case hook_SpinSpecial: case hook_JumpSpinSpecial: case hook_PlayerSpawn: + case hook_FollowMobj: + case hook_ShieldSpawn: + case hook_ShieldSpecial: lastp = &playerhooks; break; case hook_LinedefExecute: @@ -597,7 +609,7 @@ boolean LUAh_TouchSpecial(mobj_t *special, mobj_t *toucher) } // Hook for P_DamageMobj by mobj type (Should mobj take damage?) -UINT8 LUAh_ShouldDamage(mobj_t *target, mobj_t *inflictor, mobj_t *source, INT32 damage) +UINT8 LUAh_ShouldDamage(mobj_t *target, mobj_t *inflictor, mobj_t *source, INT32 damage, UINT8 damagetype) { hook_p hookp; UINT8 shouldDamage = 0; // 0 = default, 1 = force yes, 2 = force no. @@ -651,14 +663,16 @@ UINT8 LUAh_ShouldDamage(mobj_t *target, mobj_t *inflictor, mobj_t *source, INT32 LUA_PushUserdata(gL, inflictor, META_MOBJ); LUA_PushUserdata(gL, source, META_MOBJ); lua_pushinteger(gL, damage); + lua_pushinteger(gL, damagetype); } lua_pushfstring(gL, FMT_HOOKID, hookp->id); lua_gettable(gL, LUA_REGISTRYINDEX); - lua_pushvalue(gL, -5); - lua_pushvalue(gL, -5); - lua_pushvalue(gL, -5); - lua_pushvalue(gL, -5); - if (lua_pcall(gL, 4, 1, 0)) { + lua_pushvalue(gL, -6); + lua_pushvalue(gL, -6); + lua_pushvalue(gL, -6); + lua_pushvalue(gL, -6); + lua_pushvalue(gL, -6); + if (lua_pcall(gL, 5, 1, 0)) { if (!hookp->error || cv_debug & DBG_LUA) CONS_Alert(CONS_WARNING,"%s\n",lua_tostring(gL, -1)); lua_pop(gL, 1); @@ -680,7 +694,7 @@ UINT8 LUAh_ShouldDamage(mobj_t *target, mobj_t *inflictor, mobj_t *source, INT32 } // Hook for P_DamageMobj by mobj type (Mobj actually takes damage!) -boolean LUAh_MobjDamage(mobj_t *target, mobj_t *inflictor, mobj_t *source, INT32 damage) +boolean LUAh_MobjDamage(mobj_t *target, mobj_t *inflictor, mobj_t *source, INT32 damage, UINT8 damagetype) { hook_p hookp; boolean hooked = false; @@ -729,14 +743,16 @@ boolean LUAh_MobjDamage(mobj_t *target, mobj_t *inflictor, mobj_t *source, INT32 LUA_PushUserdata(gL, inflictor, META_MOBJ); LUA_PushUserdata(gL, source, META_MOBJ); lua_pushinteger(gL, damage); + lua_pushinteger(gL, damagetype); } lua_pushfstring(gL, FMT_HOOKID, hookp->id); lua_gettable(gL, LUA_REGISTRYINDEX); - lua_pushvalue(gL, -5); - lua_pushvalue(gL, -5); - lua_pushvalue(gL, -5); - lua_pushvalue(gL, -5); - if (lua_pcall(gL, 4, 1, 0)) { + lua_pushvalue(gL, -6); + lua_pushvalue(gL, -6); + lua_pushvalue(gL, -6); + lua_pushvalue(gL, -6); + lua_pushvalue(gL, -6); + if (lua_pcall(gL, 5, 1, 0)) { if (!hookp->error || cv_debug & DBG_LUA) CONS_Alert(CONS_WARNING,"%s\n",lua_tostring(gL, -1)); lua_pop(gL, 1); @@ -753,7 +769,7 @@ boolean LUAh_MobjDamage(mobj_t *target, mobj_t *inflictor, mobj_t *source, INT32 } // Hook for P_KillMobj by mobj type -boolean LUAh_MobjDeath(mobj_t *target, mobj_t *inflictor, mobj_t *source) +boolean LUAh_MobjDeath(mobj_t *target, mobj_t *inflictor, mobj_t *source, UINT8 damagetype) { hook_p hookp; boolean hooked = false; @@ -799,13 +815,15 @@ boolean LUAh_MobjDeath(mobj_t *target, mobj_t *inflictor, mobj_t *source) LUA_PushUserdata(gL, target, META_MOBJ); LUA_PushUserdata(gL, inflictor, META_MOBJ); LUA_PushUserdata(gL, source, META_MOBJ); + lua_pushinteger(gL, damagetype); } lua_pushfstring(gL, FMT_HOOKID, hookp->id); lua_gettable(gL, LUA_REGISTRYINDEX); - lua_pushvalue(gL, -4); - lua_pushvalue(gL, -4); - lua_pushvalue(gL, -4); - if (lua_pcall(gL, 3, 1, 0)) { + lua_pushvalue(gL, -5); + lua_pushvalue(gL, -5); + lua_pushvalue(gL, -5); + lua_pushvalue(gL, -5); + if (lua_pcall(gL, 4, 1, 0)) { if (!hookp->error || cv_debug & DBG_LUA) CONS_Alert(CONS_WARNING,"%s\n",lua_tostring(gL, -1)); lua_pop(gL, 1); @@ -1007,7 +1025,7 @@ boolean LUAh_PlayerMsg(int source, int target, int flags, char *msg) // Hook for hurt messages -boolean LUAh_HurtMsg(player_t *player, mobj_t *inflictor, mobj_t *source) +boolean LUAh_HurtMsg(player_t *player, mobj_t *inflictor, mobj_t *source, UINT8 damagetype) { hook_p hookp; boolean hooked = false; @@ -1025,13 +1043,15 @@ boolean LUAh_HurtMsg(player_t *player, mobj_t *inflictor, mobj_t *source) LUA_PushUserdata(gL, player, META_PLAYER); LUA_PushUserdata(gL, inflictor, META_MOBJ); LUA_PushUserdata(gL, source, META_MOBJ); + lua_pushinteger(gL, damagetype); } lua_pushfstring(gL, FMT_HOOKID, hookp->id); lua_gettable(gL, LUA_REGISTRYINDEX); - lua_pushvalue(gL, -4); - lua_pushvalue(gL, -4); - lua_pushvalue(gL, -4); - if (lua_pcall(gL, 3, 1, 0)) { + lua_pushvalue(gL, -5); + lua_pushvalue(gL, -5); + lua_pushvalue(gL, -5); + lua_pushvalue(gL, -5); + if (lua_pcall(gL, 4, 1, 0)) { if (!hookp->error || cv_debug & DBG_LUA) CONS_Alert(CONS_WARNING,"%s\n",lua_tostring(gL, -1)); lua_pop(gL, 1); @@ -1076,6 +1096,106 @@ void LUAh_NetArchiveHook(lua_CFunction archFunc) // stack: tables } +boolean LUAh_MapThingSpawn(mobj_t *mo, mapthing_t *mthing) +{ + hook_p hookp; + boolean hooked = false; + if (!gL || !(hooksAvailable[hook_MapThingSpawn/8] & (1<<(hook_MapThingSpawn%8)))) + return false; + + lua_settop(gL, 0); + + // Look for all generic mobj map thing spawn hooks + for (hookp = mobjhooks[MT_NULL]; hookp; hookp = hookp->next) + if (hookp->type == hook_MapThingSpawn) + { + if (lua_gettop(gL) == 0) + { + LUA_PushUserdata(gL, mo, META_MOBJ); + LUA_PushUserdata(gL, mthing, META_MAPTHING); + } + lua_pushfstring(gL, FMT_HOOKID, hookp->id); + lua_gettable(gL, LUA_REGISTRYINDEX); + lua_pushvalue(gL, -3); + lua_pushvalue(gL, -3); + if (lua_pcall(gL, 2, 1, 0)) { + if (!hookp->error || cv_debug & DBG_LUA) + CONS_Alert(CONS_WARNING,"%s\n",lua_tostring(gL, -1)); + lua_pop(gL, 1); + hookp->error = true; + continue; + } + if (lua_toboolean(gL, -1)) + hooked = true; + lua_pop(gL, 1); + } + + for (hookp = mobjhooks[mo->type]; hookp; hookp = hookp->next) + if (hookp->type == hook_MapThingSpawn) + { + if (lua_gettop(gL) == 0) + { + LUA_PushUserdata(gL, mo, META_MOBJ); + LUA_PushUserdata(gL, mthing, META_MAPTHING); + } + lua_pushfstring(gL, FMT_HOOKID, hookp->id); + lua_gettable(gL, LUA_REGISTRYINDEX); + lua_pushvalue(gL, -3); + lua_pushvalue(gL, -3); + if (lua_pcall(gL, 2, 1, 0)) { + if (!hookp->error || cv_debug & DBG_LUA) + CONS_Alert(CONS_WARNING,"%s\n",lua_tostring(gL, -1)); + lua_pop(gL, 1); + hookp->error = true; + continue; + } + if (lua_toboolean(gL, -1)) + hooked = true; + lua_pop(gL, 1); + } + + lua_settop(gL, 0); + return hooked; +} + +// Hook for P_PlayerAfterThink Smiles mobj-following +boolean LUAh_FollowMobj(player_t *player, mobj_t *mobj) +{ + hook_p hookp; + boolean hooked = false; + if (!gL || !(hooksAvailable[hook_FollowMobj/8] & (1<<(hook_FollowMobj%8)))) + return 0; + + lua_settop(gL, 0); + + for (hookp = playerhooks; hookp; hookp = hookp->next) + if (hookp->type == hook_FollowMobj) + { + if (lua_gettop(gL) == 0) + { + LUA_PushUserdata(gL, player, META_PLAYER); + LUA_PushUserdata(gL, mobj, META_MOBJ); + } + lua_pushfstring(gL, FMT_HOOKID, hookp->id); + lua_gettable(gL, LUA_REGISTRYINDEX); + lua_pushvalue(gL, -3); + lua_pushvalue(gL, -3); + if (lua_pcall(gL, 2, 1, 0)) { + if (!hookp->error || cv_debug & DBG_LUA) + CONS_Alert(CONS_WARNING,"%s\n",lua_tostring(gL, -1)); + lua_pop(gL, 1); + hookp->error = true; + continue; + } + if (lua_toboolean(gL, -1)) + hooked = true; + lua_pop(gL, 1); + } + + lua_settop(gL, 0); + return hooked; +} + void LUAh_PlayerQuit(player_t *plr, int reason) { hook_p hookp; diff --git a/src/lua_hud.h b/src/lua_hud.h index f96618e07..7f928f7c4 100644 --- a/src/lua_hud.h +++ b/src/lua_hud.h @@ -24,7 +24,7 @@ enum hud { // NiGHTS mode hud_nightslink, hud_nightsdrill, - hud_nightsrings, + hud_nightsspheres, hud_nightsscore, hud_nightstime, hud_nightsrecords, @@ -42,3 +42,4 @@ boolean LUA_HudEnabled(enum hud option); void LUAh_GameHUD(player_t *stplyr); void LUAh_ScoresHUD(void); +void LUAh_TitleHUD(void); diff --git a/src/lua_hudlib.c b/src/lua_hudlib.c index b16125395..f3a1ba210 100644 --- a/src/lua_hudlib.c +++ b/src/lua_hudlib.c @@ -12,6 +12,7 @@ #include "doomdef.h" #ifdef HAVE_BLUA +#include "fastcmp.h" #include "r_defs.h" #include "r_local.h" #include "st_stuff.h" // hudinfo[] @@ -19,6 +20,7 @@ #include "i_video.h" // rendermode #include "p_local.h" // camera_t #include "screen.h" // screen width/height +#include "m_random.h" // m_random #include "v_video.h" #include "w_wad.h" #include "z_zone.h" @@ -62,12 +64,14 @@ static const char *const hud_disable_options[] = { enum hudinfo { hudinfo_x = 0, - hudinfo_y + hudinfo_y, + hudinfo_f }; static const char *const hudinfo_opt[] = { "x", "y", + "f", NULL}; enum patch { @@ -87,11 +91,13 @@ static const char *const patch_opt[] = { enum hudhook { hudhook_game = 0, - hudhook_scores + hudhook_scores, + hudhook_title }; static const char *const hudhook_opt[] = { "game", "scores", + "title", NULL}; // alignment types for v.drawString @@ -195,6 +201,9 @@ static int hudinfo_get(lua_State *L) case hudinfo_y: lua_pushinteger(L, info->y); break; + case hudinfo_f: + lua_pushinteger(L, info->f); + break; } return 1; } @@ -213,6 +222,9 @@ static int hudinfo_set(lua_State *L) case hudinfo_y: info->y = (INT32)luaL_checkinteger(L, 3); break; + case hudinfo_f: + info->f = (INT32)luaL_checkinteger(L, 3); + break; } return 0; } @@ -226,7 +238,12 @@ static int hudinfo_num(lua_State *L) static int colormap_get(lua_State *L) { - return luaL_error(L, "colormap is not a struct."); + const UINT8 *colormap = *((UINT8 **)luaL_checkudata(L, 1, META_COLORMAP)); + UINT32 i = luaL_checkinteger(L, 2); + if (i >= 256) + return luaL_error(L, "colormap index %d out of range (0 - %d)", i, 255); + lua_pushinteger(L, colormap[i]); + return 1; } static int patch_get(lua_State *L) @@ -338,6 +355,158 @@ static int libd_cachePatch(lua_State *L) return 1; } +// v.getSpritePatch(sprite, [frame, [angle]]) +static int libd_getSpritePatch(lua_State *L) +{ + UINT32 i; // sprite prefix + UINT32 frame = 0; // 'A' + UINT8 angle = 0; + spritedef_t *sprdef; + spriteframe_t *sprframe; + HUDONLY + + if (lua_isnumber(L, 1)) // sprite number given, e.g. SPR_THOK + { + i = lua_tonumber(L, 1); + if (i >= NUMSPRITES) + return 0; + } + else if (lua_isstring(L, 1)) // sprite prefix name given, e.g. "THOK" + { + const char *name = lua_tostring(L, 1); + for (i = 0; i < NUMSPRITES; i++) + if (fastcmp(name, sprnames[i])) + break; + if (i >= NUMSPRITES) + return 0; + } + else + return 0; + + if (i == SPR_PLAY) // Use getSprite2Patch instead! + return 0; + + sprdef = &sprites[i]; + + // set frame number + frame = luaL_optinteger(L, 2, 0); + frame &= FF_FRAMEMASK; // ignore any bits that are not the actual frame, just in case + if (frame >= sprdef->numframes) + return 0; + // set angle number + sprframe = &sprdef->spriteframes[frame]; + angle = luaL_optinteger(L, 3, 1); + + // convert WAD editor angle numbers (1-8) to internal angle numbers (0-7) + // keep 0 the same since we'll make it default to angle 1 (which is internally 0) + // in case somebody didn't know that angle 0 really just maps all 8 angles to the same patch + if (angle != 0) + angle--; + + if (angle >= 8) // out of range? + return 0; + + // push both the patch and it's "flip" value + LUA_PushUserdata(L, W_CachePatchNum(sprframe->lumppat[angle], PU_STATIC), META_PATCH); + lua_pushboolean(L, (sprframe->flip & (1<= MAXSKINS) + return luaL_error(L, "skin number %d out of range (0 - %d)", i, MAXSKINS-1); + if (i >= numskins) + return 0; + } + else // find skin by name + { + const char *name = luaL_checkstring(L, 1); + for (i = 0; i < numskins; i++) + if (fastcmp(skins[i].name, name)) + break; + if (i >= numskins) + return 0; + } + + lua_remove(L, 1); // remove skin now + + if (lua_isnumber(L, 1)) // sprite number given, e.g. SPR2_STND + { + j = lua_tonumber(L, 1); + if (j & FF_SPR2SUPER) // e.g. SPR2_STND|FF_SPR2SUPER + { + super = true; + j &= ~FF_SPR2SUPER; // remove flag so the next check doesn't fail + } + if (j >= free_spr2) + return 0; + } + else if (lua_isstring(L, 1)) // sprite prefix name given, e.g. "STND" + { + const char *name = lua_tostring(L, 1); + for (j = 0; j < free_spr2; j++) + if (fastcmp(name, spr2names[j])) + break; + // if you want super flags you'll have to use the optional boolean following this + if (j >= free_spr2) + return 0; + } + else + return 0; + + if (lua_isboolean(L, 2)) // optional boolean for superness + { + super = lua_toboolean(L, 2); // note: this can override FF_SPR2SUPER from sprite number + lua_remove(L, 2); // remove + } + // if it's not boolean then just assume it's the frame number + + if (super) + j |= FF_SPR2SUPER; + + j = P_GetSkinSprite2(&skins[i], j, NULL); // feed skin and current sprite2 through to change sprite2 used if necessary + + sprdef = &skins[i].sprites[j]; + + // set frame number + frame = luaL_optinteger(L, 2, 0); + frame &= FF_FRAMEMASK; // ignore any bits that are not the actual frame, just in case + if (frame >= sprdef->numframes) + return 0; + // set angle number + sprframe = &sprdef->spriteframes[frame]; + angle = luaL_optinteger(L, 3, 1); + + // convert WAD editor angle numbers (1-8) to internal angle numbers (0-7) + // keep 0 the same since we'll make it default to angle 1 (which is internally 0) + // in case somebody didn't know that angle 0 really just maps all 8 angles to the same patch + if (angle != 0) + angle--; + + if (angle >= 8) // out of range? + return 0; + + // push both the patch and it's "flip" value + LUA_PushUserdata(L, W_CachePatchNum(sprframe->lumppat[angle], PU_STATIC), META_PATCH); + lua_pushboolean(L, (sprframe->flip & (1< maxstrength) + return luaL_error(L, "%s fade strength %d out of range (0 - %d)", ((color & 0xFF00) ? "COLORMAP" : "TRANSMAP"), strength, maxstrength); + + if (strength == maxstrength) // Allow as a shortcut for drawfill... + { + V_DrawFill(0, 0, BASEVIDWIDTH, BASEVIDHEIGHT, ((color & 0xFF00) ? 31 : color)); + return 0; + } + + V_DrawFadeScreen(color, strength); + return 0; +} + static int libd_width(lua_State *L) { HUDONLY @@ -560,6 +753,67 @@ static int libd_renderer(lua_State *L) return 1; } +// M_RANDOM +////////////// + +static int libd_RandomFixed(lua_State *L) +{ + HUDONLY + lua_pushfixed(L, M_RandomFixed()); + return 1; +} + +static int libd_RandomByte(lua_State *L) +{ + HUDONLY + lua_pushinteger(L, M_RandomByte()); + return 1; +} + +static int libd_RandomKey(lua_State *L) +{ + INT32 a = (INT32)luaL_checkinteger(L, 1); + + HUDONLY + if (a > 65536) + LUA_UsageWarning(L, "v.RandomKey: range > 65536 is undefined behavior"); + lua_pushinteger(L, M_RandomKey(a)); + return 1; +} + +static int libd_RandomRange(lua_State *L) +{ + INT32 a = (INT32)luaL_checkinteger(L, 1); + INT32 b = (INT32)luaL_checkinteger(L, 2); + + HUDONLY + if (b < a) { + INT32 c = a; + a = b; + b = c; + } + if ((b-a+1) > 65536) + LUA_UsageWarning(L, "v.RandomRange: range > 65536 is undefined behavior"); + lua_pushinteger(L, M_RandomRange(a, b)); + return 1; +} + +// Macros. +static int libd_SignedRandom(lua_State *L) +{ + HUDONLY + lua_pushinteger(L, M_SignedRandom()); + return 1; +} + +static int libd_RandomChance(lua_State *L) +{ + fixed_t p = luaL_checkfixed(L, 1); + HUDONLY + lua_pushboolean(L, M_RandomChance(p)); + return 1; +} + // 30/10/18 Lat': Get cv_translucenthud's value for HUD rendering as a normal V_xxTRANS int // Could as well be thrown in global vars for ease of access but I guess it makes sense for it to be a HUD fn static int libd_getlocaltransflag(lua_State *L) @@ -570,16 +824,30 @@ static int libd_getlocaltransflag(lua_State *L) } static luaL_Reg lib_draw[] = { + // cache {"patchExists", libd_patchExists}, {"cachePatch", libd_cachePatch}, + {"getSpritePatch", libd_getSpritePatch}, + {"getSprite2Patch", libd_getSprite2Patch}, + {"getColormap", libd_getColormap}, + // drawing {"draw", libd_draw}, {"drawScaled", libd_drawScaled}, {"drawNum", libd_drawNum}, {"drawPaddedNum", libd_drawPaddedNum}, {"drawFill", libd_drawFill}, {"drawString", libd_drawString}, + {"fadeScreen", libd_fadeScreen}, + // misc {"stringWidth", libd_stringWidth}, - {"getColormap", libd_getColormap}, + // m_random + {"RandomFixed",libd_RandomFixed}, + {"RandomByte",libd_RandomByte}, + {"RandomKey",libd_RandomKey}, + {"RandomRange",libd_RandomRange}, + {"SignedRandom",libd_SignedRandom}, // MACRO + {"RandomChance",libd_RandomChance}, // MACRO + // properties {"width", libd_width}, {"height", libd_height}, {"dupx", libd_dupx}, @@ -630,6 +898,9 @@ static int lib_hudadd(lua_State *L) luaL_checktype(L, 1, LUA_TFUNCTION); field = luaL_checkoption(L, 2, "game", hudhook_opt); + if (!lua_lumploading) + return luaL_error(L, "This function cannot be called from within a hook or coroutine!"); + lua_getfield(L, LUA_REGISTRYINDEX, "HUD"); I_Assert(lua_istable(L, -1)); lua_rawgeti(L, -1, field+2); // HUD[2+] @@ -669,6 +940,9 @@ int LUA_HudLib(lua_State *L) lua_newtable(L); lua_rawseti(L, -2, 3); // HUD[2] = scores rendering functions array + + lua_newtable(L); + lua_rawseti(L, -2, 4); // HUD[3] = title rendering functions array lua_setfield(L, LUA_REGISTRYINDEX, "HUD"); luaL_newmetatable(L, META_HUDINFO); @@ -781,4 +1055,29 @@ void LUAh_ScoresHUD(void) hud_running = false; } +void LUAh_TitleHUD(void) +{ + if (!gL || !(hudAvailable & (1<= free_spr2) + return 0; + lua_pushlstring(L, spr2names[i], 4); + return 1; + } + else if (lua_isstring(L, 1)) + { + const char *name = lua_tostring(L, 1); + for (i = 0; i < free_spr2; i++) + if (fastcmp(name, spr2names[i])) + { + lua_pushinteger(L, i); + return 1; + } + } + return 0; +} + +static int lib_getSpr2default(lua_State *L) +{ + playersprite_t i; + + lua_remove(L, 1); // don't care about spr2defaults[] dummy userdata. + + if (lua_isnumber(L, 1)) + i = lua_tonumber(L, 1); + else if (lua_isstring(L, 1)) + { + const char *name = lua_tostring(L, 1); + for (i = 0; i < free_spr2; i++) + if (fastcmp(name, spr2names[i])) + break; + } + else + return luaL_error(L, "spr2defaults[] invalid index"); + + if (i >= free_spr2) + return 0; + + lua_pushinteger(L, spr2defaults[i]); + return 1; +} + +static int lib_setSpr2default(lua_State *L) +{ + playersprite_t i; + UINT8 j = 0; + + lua_remove(L, 1); // don't care about spr2defaults[] dummy userdata. + + if (lua_isnumber(L, 1)) + i = lua_tonumber(L, 1); + else if (lua_isstring(L, 1)) + { + const char *name = lua_tostring(L, 1); + for (i = 0; i < free_spr2; i++) + { + if (fastcmp(name, spr2names[i])) + break; + } + if (i == free_spr2) + return luaL_error(L, "spr2defaults[] invalid index"); + } + else + return luaL_error(L, "spr2defaults[] invalid index"); + + if (i < SPR2_FIRSTFREESLOT || i >= free_spr2) + return luaL_error(L, "spr2defaults[] index %d out of range (%d - %d)", i, SPR2_FIRSTFREESLOT, free_spr2-1); + + if (lua_isnumber(L, 2)) + j = lua_tonumber(L, 2); + else if (lua_isstring(L, 2)) + { + const char *name = lua_tostring(L, 2); + for (j = 0; j < free_spr2; j++) + { + if (fastcmp(name, spr2names[j])) + break; + } + if (j == free_spr2) + return luaL_error(L, "spr2defaults[] invalid index"); + } + + if (j >= free_spr2) + j = 0; // return luaL_error(L, "spr2defaults[] set %d out of range (%d - %d)", j, 0, free_spr2-1); + + spr2defaults[i] = j; + return 0; +} + +static int lib_spr2namelen(lua_State *L) +{ + lua_pushinteger(L, free_spr2); + return 1; +} + //////////////// // STATE INFO // //////////////// @@ -202,6 +316,18 @@ static int lib_setState(lua_State *L) case LUA_TSTRING: // It's a string, expect the name of a built-in action LUA_SetActionByName(state, lua_tostring(L, 3)); break; + case LUA_TUSERDATA: // It's a userdata, expect META_ACTION of a built-in action + { + actionf_t *action = *((actionf_t **)luaL_checkudata(L, 3, META_ACTION)); + + if (!action) + return luaL_error(L, "not a valid action?"); + + state->action = *action; + state->action.acv = action->acv; + state->action.acp1 = action->acp1; + break; + } case LUA_TFUNCTION: // It's a function (a Lua function or a C function? either way!) lua_getfield(L, LUA_REGISTRYINDEX, LREG_STATEACTION); I_Assert(lua_istable(L, -1)); @@ -351,9 +477,8 @@ static int state_get(lua_State *L) return 0; // Just what is this?? // get the function from the global // because the metatable will trigger. - lua_getglobal(L, name); // actually gets from LREG_ACTIONS if applicable, and pushes a new C closure if not. - lua_pushstring(L, name); // push the name we found. - return 2; // return both the function and its name, in case somebody wanted to do a comparison by name or something? + lua_getglobal(L, name); // actually gets from LREG_ACTIONS if applicable, and pushes a META_ACTION userdata if not. + return 1; // return just the function } else if (fastcmp(field,"var1")) number = st->var1; else if (fastcmp(field,"var2")) @@ -397,6 +522,18 @@ static int state_set(lua_State *L) case LUA_TSTRING: // It's a string, expect the name of a built-in action LUA_SetActionByName(st, lua_tostring(L, 3)); break; + case LUA_TUSERDATA: // It's a userdata, expect META_ACTION of a built-in action + { + actionf_t *action = *((actionf_t **)luaL_checkudata(L, 3, META_ACTION)); + + if (!action) + return luaL_error(L, "not a valid action?"); + + st->action = *action; + st->action.acv = action->acv; + st->action.acp1 = action->acp1; + break; + } case LUA_TFUNCTION: // It's a function (a Lua function or a C function? either way!) lua_getfield(L, LUA_REGISTRYINDEX, LREG_STATEACTION); I_Assert(lua_istable(L, -1)); @@ -731,8 +868,8 @@ static int lib_getSfxInfo(lua_State *L) lua_remove(L, 1); i = luaL_checkinteger(L, 1); - if (i >= NUMSFX) - return luaL_error(L, "sfxinfo[] index %d out of range (0 - %d)", i, NUMSFX-1); + if (i == 0 || i >= NUMSFX) + return luaL_error(L, "sfxinfo[] index %d out of range (1 - %d)", i, NUMSFX-1); LUA_PushUserdata(L, &S_sfx[i], META_SFXINFO); return 1; } @@ -745,9 +882,9 @@ static int lib_setSfxInfo(lua_State *L) lua_remove(L, 1); { UINT32 i = luaL_checkinteger(L, 1); - if (i >= NUMSFX) - return luaL_error(L, "sfxinfo[] index %d out of range (0 - %d)", i, NUMSFX-1); - info = &S_sfx[i]; // get the mobjinfo to assign to. + if (i == 0 || i >= NUMSFX) + return luaL_error(L, "sfxinfo[] index %d out of range (1 - %d)", i, NUMSFX-1); + info = &S_sfx[i]; // get the sfxinfo to assign to. } luaL_checktype(L, 2, LUA_TTABLE); // check that we've been passed a table. lua_remove(L, 1); // pop mobjtype num, don't need it any more. @@ -776,6 +913,9 @@ static int lib_setSfxInfo(lua_State *L) case sfxinfow_flags: info->pitch = (INT32)luaL_checkinteger(L, 3); break; + case sfxinfow_caption: + strlcpy(info->caption, luaL_checkstring(L, 3), sizeof(info->caption)); + break; default: break; } @@ -813,11 +953,14 @@ static int sfxinfo_get(lua_State *L) case sfxinfor_flags: lua_pushinteger(L, sfx->pitch); return 1; + case sfxinfor_caption: + lua_pushstring(L, sfx->caption); + return 1; case sfxinfor_skinsound: lua_pushinteger(L, sfx->skinsound); return 1; default: - return luaL_error(L, "impossible error"); + return luaL_error(L, "Field does not exist in sfxinfo_t"); } return 0; } @@ -848,8 +991,11 @@ static int sfxinfo_set(lua_State *L) case sfxinfow_flags: sfx->pitch = luaL_checkinteger(L, 1); break; + case sfxinfow_caption: + strlcpy(sfx->caption, luaL_checkstring(L, 1), sizeof(sfx->caption)); + break; default: - return luaL_error(L, "impossible error"); + return luaL_error(L, "Field does not exist in sfxinfo_t"); } return 0; } @@ -923,6 +1069,29 @@ int LUA_InfoLib(lua_State *L) lua_setmetatable(L, -2); lua_setglobal(L, "sprnames"); + lua_newuserdata(L, 0); + lua_createtable(L, 0, 2); + lua_pushcfunction(L, lib_getSpr2name); + lua_setfield(L, -2, "__index"); + + lua_pushcfunction(L, lib_spr2namelen); + lua_setfield(L, -2, "__len"); + lua_setmetatable(L, -2); + lua_setglobal(L, "spr2names"); + + lua_newuserdata(L, 0); + lua_createtable(L, 0, 2); + lua_pushcfunction(L, lib_getSpr2default); + lua_setfield(L, -2, "__index"); + + lua_pushcfunction(L, lib_setSpr2default); + lua_setfield(L, -2, "__newindex"); + + lua_pushcfunction(L, lib_spr2namelen); + lua_setfield(L, -2, "__len"); + lua_setmetatable(L, -2); + lua_setglobal(L, "spr2defaults"); + lua_newuserdata(L, 0); lua_createtable(L, 0, 2); lua_pushcfunction(L, lib_getState); diff --git a/src/lua_libs.h b/src/lua_libs.h index 9c6050bea..827c1d798 100644 --- a/src/lua_libs.h +++ b/src/lua_libs.h @@ -38,6 +38,10 @@ extern lua_State *gL; #define META_SUBSECTOR "SUBSECTOR_T*" #define META_SECTOR "SECTOR_T*" #define META_FFLOOR "FFLOOR_T*" +#ifdef HAVE_LUA_SEGS +#define META_SEG "SEG_T*" +#define META_NODE "NODE_T*" +#endif #ifdef ESLOPE #define META_SLOPE "PSLOPE_T*" #define META_VECTOR2 "VECTOR2_T" @@ -49,12 +53,20 @@ extern lua_State *gL; #define META_SECTORLINES "SECTOR_T*LINES" #define META_SIDENUM "LINE_T*SIDENUM" +#ifdef HAVE_LUA_SEGS +#define META_NODEBBOX "NODE_T*BBOX" +#define META_NODECHILDREN "NODE_T*CHILDREN" +#endif + +#define META_BBOX "BOUNDING_BOX" #define META_HUDINFO "HUDINFO_T*" #define META_PATCH "PATCH_T*" #define META_COLORMAP "COLORMAP" #define META_CAMERA "CAMERA_T*" +#define META_ACTION "ACTIONF_T*" + boolean luaL_checkboolean(lua_State *L, int narg); int LUA_EnumLib(lua_State *L); diff --git a/src/lua_maplib.c b/src/lua_maplib.c index 35542fdce..c5555009f 100644 --- a/src/lua_maplib.c +++ b/src/lua_maplib.c @@ -207,6 +207,82 @@ static const char *const ffloor_opt[] = { "alpha", NULL}; +#ifdef HAVE_LUA_SEGS +enum seg_e { + seg_valid = 0, + seg_v1, + seg_v2, + seg_side, + seg_offset, + seg_angle, + seg_sidedef, + seg_linedef, + seg_frontsector, + seg_backsector, +}; + +static const char *const seg_opt[] = { + "valid", + "v1", + "v2", + "side", + "offset", + "angle", + "sidedef", + "linedef", + "frontsector", + "backsector", + NULL}; + +enum node_e { + node_valid = 0, + node_x, + node_y, + node_dx, + node_dy, + node_bbox, + node_children, +}; + +static const char *const node_opt[] = { + "valid", + "x", + "y", + "dx", + "dy", + "bbox", + "children", + NULL}; + +enum nodechild_e { + nodechild_valid = 0, + nodechild_right, + nodechild_left, +}; + +static const char *const nodechild_opt[] = { + "valid", + "right", + "left", + NULL}; +#endif + +enum bbox_e { + bbox_valid = 0, + bbox_top, + bbox_bottom, + bbox_left, + bbox_right, +}; + +static const char *const bbox_opt[] = { + "valid", + "top", + "bottom", + "left", + "right", + NULL}; + #ifdef ESLOPE enum slope_e { slope_valid = 0, @@ -251,12 +327,19 @@ static const char *const vector_opt[] = { static const char *const array_opt[] ={"iterate",NULL}; static const char *const valid_opt[] ={"valid",NULL}; +/////////////////////////////////// +// sector list iterate functions // +/////////////////////////////////// + // iterates through a sector's thinglist! static int lib_iterateSectorThinglist(lua_State *L) { mobj_t *state = NULL; mobj_t *thing = NULL; + if (gamestate != GS_LEVEL) + return luaL_error(L, "This function can only be used in a level!"); + if (lua_gettop(L) < 2) return luaL_error(L, "Don't call sector.thinglist() directly, use it as 'for rover in sector.thinglist do end'."); @@ -290,6 +373,9 @@ static int lib_iterateSectorFFloors(lua_State *L) ffloor_t *state = NULL; ffloor_t *ffloor = NULL; + if (gamestate != GS_LEVEL) + return luaL_error(L, "This function can only be used in a level!"); + if (lua_gettop(L) < 2) return luaL_error(L, "Don't call sector.ffloors() directly, use it as 'for rover in sector.ffloors do end'."); @@ -325,6 +411,10 @@ static int sector_iterate(lua_State *L) return 3; } +//////////////////// +// sector.lines[] // +//////////////////// + // sector.lines, i -> sector.lines[i] // sector.lines.valid, for validity checking static int sectorlines_get(lua_State *L) @@ -386,6 +476,10 @@ static int sectorlines_num(lua_State *L) return 1; } +////////////// +// sector_t // +////////////// + static int sector_get(lua_State *L) { sector_t *sector = *((sector_t **)luaL_checkudata(L, 1, META_SECTOR)); @@ -552,6 +646,10 @@ static int sector_num(lua_State *L) return 1; } +///////////////// +// subsector_t // +///////////////// + static int subsector_get(lua_State *L) { subsector_t *subsector = *((subsector_t **)luaL_checkudata(L, 1, META_SUBSECTOR)); @@ -591,6 +689,10 @@ static int subsector_num(lua_State *L) return 1; } +//////////// +// line_t // +//////////// + static int line_get(lua_State *L) { line_t *line = *((line_t **)luaL_checkudata(L, 1, META_LINE)); @@ -688,6 +790,10 @@ static int line_num(lua_State *L) return 1; } +//////////////////// +// line.sidenum[] // +//////////////////// + static int sidenum_get(lua_State *L) { UINT16 *sidenum = *((UINT16 **)luaL_checkudata(L, 1, META_SIDENUM)); @@ -716,6 +822,10 @@ static int sidenum_get(lua_State *L) return 1; } +//////////// +// side_t // +//////////// + static int side_get(lua_State *L) { side_t *side = *((side_t **)luaL_checkudata(L, 1, META_SIDE)); @@ -817,6 +927,10 @@ static int side_num(lua_State *L) return 1; } +////////////// +// vertex_t // +////////////// + static int vertex_get(lua_State *L) { vertex_t *vertex = *((vertex_t **)luaL_checkudata(L, 1, META_VERTEX)); @@ -856,9 +970,293 @@ static int vertex_num(lua_State *L) return 1; } +#ifdef HAVE_LUA_SEGS + +/////////// +// seg_t // +/////////// + +static int seg_get(lua_State *L) +{ + seg_t *seg = *((seg_t **)luaL_checkudata(L, 1, META_SEG)); + enum seg_e field = luaL_checkoption(L, 2, seg_opt[0], seg_opt); + + if (!seg) + { + if (field == seg_valid) { + lua_pushboolean(L, 0); + return 1; + } + return luaL_error(L, "accessed seg_t doesn't exist anymore."); + } + + switch(field) + { + case seg_valid: // valid + lua_pushboolean(L, 1); + return 1; + case seg_v1: + LUA_PushUserdata(L, seg->v1, META_VERTEX); + return 1; + case seg_v2: + LUA_PushUserdata(L, seg->v2, META_VERTEX); + return 1; + case seg_side: + lua_pushinteger(L, seg->side); + return 1; + case seg_offset: + lua_pushfixed(L, seg->offset); + return 1; + case seg_angle: + lua_pushangle(L, seg->angle); + return 1; + case seg_sidedef: + LUA_PushUserdata(L, seg->sidedef, META_SIDE); + return 1; + case seg_linedef: + LUA_PushUserdata(L, seg->linedef, META_LINE); + return 1; + case seg_frontsector: + LUA_PushUserdata(L, seg->frontsector, META_SECTOR); + return 1; + case seg_backsector: + LUA_PushUserdata(L, seg->backsector, META_SECTOR); + return 1; + } + return 0; +} + +static int seg_num(lua_State *L) +{ + seg_t *seg = *((seg_t **)luaL_checkudata(L, 1, META_SEG)); + lua_pushinteger(L, seg-segs); + return 1; +} + +//////////// +// node_t // +//////////// + +static int node_get(lua_State *L) +{ + node_t *node = *((node_t **)luaL_checkudata(L, 1, META_NODE)); + enum node_e field = luaL_checkoption(L, 2, node_opt[0], node_opt); + + if (!node) + { + if (field == node_valid) { + lua_pushboolean(L, 0); + return 1; + } + return luaL_error(L, "accessed node_t doesn't exist anymore."); + } + + switch(field) + { + case node_valid: // valid + lua_pushboolean(L, 1); + return 1; + case node_x: + lua_pushfixed(L, node->x); + return 1; + case node_y: + lua_pushfixed(L, node->y); + return 1; + case node_dx: + lua_pushfixed(L, node->x); + return 1; + case node_dy: + lua_pushfixed(L, node->x); + return 1; + case node_bbox: + LUA_PushUserdata(L, node->bbox, META_NODEBBOX); + return 1; + case node_children: + LUA_PushUserdata(L, node->children, META_NODECHILDREN); + return 1; + } + return 0; +} + +static int node_num(lua_State *L) +{ + node_t *node = *((node_t **)luaL_checkudata(L, 1, META_NODE)); + lua_pushinteger(L, node-nodes); + return 1; +} + +/////////////// +// node.bbox // +/////////////// + +/* +// node.bbox[i][j]: i = 0 or 1, j = 0 1 2 or 3 +// NOTE: 2D arrays are NOT double pointers, +// the second bbox will be directly after the first in memory (hence the way the bbox is pushed here) +// this function handles the [i] part, bbox_get handles the [j] part +static int nodebbox_get(lua_State *L) +{ + fixed_t *bbox = *((fixed_t **)luaL_checkudata(L, 1, META_NODEBBOX)); + int i; + lua_settop(L, 2); + if (!lua_isnumber(L, 2)) + { + int field = luaL_checkoption(L, 2, NULL, valid_opt); + if (!bbox) + { + if (field == 0) { + lua_pushboolean(L, 0); + return 1; + } + return luaL_error(L, "accessed node_t doesn't exist anymore."); + } else if (field == 0) { + lua_pushboolean(L, 1); + return 1; + } + } + + i = lua_tointeger(L, 2); + if (i < 0 || i > 1) + return 0; + LUA_PushUserdata(L, bbox + i*4*sizeof(fixed_t), META_BBOX); + return 1; +} +*/ +static int nodebbox_call(lua_State *L) +{ + fixed_t *bbox = *((fixed_t **)luaL_checkudata(L, 1, META_NODEBBOX)); + int i, j; + int n = lua_gettop(L); + + if (!bbox) + return luaL_error(L, "accessed node bbox doesn't exist anymore."); + if (n < 3) + return luaL_error(L, "arguments 2 and/or 3 not given (expected node.bbox(child, coord))"); + // get child + if (!lua_isnumber(L, 2)) { + enum nodechild_e field = luaL_checkoption(L, 2, nodechild_opt[0], nodechild_opt); + switch (field) { + case nodechild_right: i = 0; break; + case nodechild_left: i = 1; break; + default: + return luaL_error(L, "invalid node child \"%s\".", lua_tostring(L, 2)); + } + } + else { + i = lua_tointeger(L, 2); + if (i < 0 || i > 1) + return 0; + } + // get bbox coord + if (!lua_isnumber(L, 3)) { + enum bbox_e field = luaL_checkoption(L, 3, bbox_opt[0], bbox_opt); + switch (field) { + case bbox_top: j = BOXTOP; break; + case bbox_bottom: j = BOXBOTTOM; break; + case bbox_left: j = BOXLEFT; break; + case bbox_right: j = BOXRIGHT; break; + default: + return luaL_error(L, "invalid bbox coordinate \"%s\".", lua_tostring(L, 3)); + } + } + else { + j = lua_tointeger(L, 3); + if (j < 0 || j > 3) + return 0; + } + lua_pushinteger(L, bbox[i*4 + j]); + return 1; +} + +///////////////////// +// node.children[] // +///////////////////// + +// node.children[i]: i = 0 or 1 +static int nodechildren_get(lua_State *L) +{ + UINT16 *children = *((UINT16 **)luaL_checkudata(L, 1, META_NODECHILDREN)); + int i; + lua_settop(L, 2); + if (!lua_isnumber(L, 2)) + { + enum nodechild_e field = luaL_checkoption(L, 2, nodechild_opt[0], nodechild_opt); + if (!children) + { + if (field == nodechild_valid) { + lua_pushboolean(L, 0); + return 1; + } + return luaL_error(L, "accessed node_t doesn't exist anymore."); + } else if (field == nodechild_valid) { + lua_pushboolean(L, 1); + return 1; + } else switch (field) { + case nodechild_right: i = 0; break; + case nodechild_left: i = 1; break; + default: return 0; + } + } + else { + i = lua_tointeger(L, 2); + if (i < 0 || i > 1) + return 0; + } + lua_pushinteger(L, children[i]); + return 1; +} +#endif + +////////// +// bbox // +////////// + +// bounding box (aka fixed_t array with four elements) +// NOTE: may be useful for polyobjects or other things later +static int bbox_get(lua_State *L) +{ + fixed_t *bbox = *((fixed_t **)luaL_checkudata(L, 1, META_BBOX)); + int i; + lua_settop(L, 2); + if (!lua_isnumber(L, 2)) + { + enum bbox_e field = luaL_checkoption(L, 2, bbox_opt[0], bbox_opt); + if (!bbox) + { + if (field == bbox_valid) { + lua_pushboolean(L, 0); + return 1; + } + return luaL_error(L, "accessed bbox doesn't exist anymore."); + } else if (field == bbox_valid) { + lua_pushboolean(L, 1); + return 1; + } else switch (field) { + case bbox_top: i = BOXTOP; break; + case bbox_bottom: i = BOXBOTTOM; break; + case bbox_left: i = BOXLEFT; break; + case bbox_right: i = BOXRIGHT; break; + default: return 0; + } + } + else { + i = lua_tointeger(L, 2); + if (i < 0 || i > 3) + return 0; + } + lua_pushinteger(L, bbox[i]); + return 1; +} + +/////////////// +// sectors[] // +/////////////// + static int lib_iterateSectors(lua_State *L) { size_t i = 0; + if (gamestate != GS_LEVEL) + return luaL_error(L, "This function can only be used in a level!"); if (lua_gettop(L) < 2) return luaL_error(L, "Don't call sectors.iterate() directly, use it as 'for sector in sectors.iterate do end'."); lua_settop(L, 2); @@ -876,6 +1274,8 @@ static int lib_iterateSectors(lua_State *L) static int lib_getSector(lua_State *L) { int field; + if (gamestate != GS_LEVEL) + return luaL_error(L, "You cannot access this outside of a level!"); lua_settop(L, 2); lua_remove(L, 1); // dummy userdata table is unused. if (lua_isnumber(L, 1)) @@ -902,9 +1302,15 @@ static int lib_numsectors(lua_State *L) return 1; } +////////////////// +// subsectors[] // +////////////////// + static int lib_iterateSubsectors(lua_State *L) { size_t i = 0; + if (gamestate != GS_LEVEL) + return luaL_error(L, "This function can only be used in a level!"); if (lua_gettop(L) < 2) return luaL_error(L, "Don't call subsectors.iterate() directly, use it as 'for subsector in subsectors.iterate do end'."); lua_settop(L, 2); @@ -922,6 +1328,8 @@ static int lib_iterateSubsectors(lua_State *L) static int lib_getSubsector(lua_State *L) { int field; + if (gamestate != GS_LEVEL) + return luaL_error(L, "You cannot access this outside of a level!"); lua_settop(L, 2); lua_remove(L, 1); // dummy userdata table is unused. if (lua_isnumber(L, 1)) @@ -948,9 +1356,15 @@ static int lib_numsubsectors(lua_State *L) return 1; } +///////////// +// lines[] // +///////////// + static int lib_iterateLines(lua_State *L) { size_t i = 0; + if (gamestate != GS_LEVEL) + return luaL_error(L, "This function can only be used in a level!"); if (lua_gettop(L) < 2) return luaL_error(L, "Don't call lines.iterate() directly, use it as 'for line in lines.iterate do end'."); lua_settop(L, 2); @@ -968,6 +1382,8 @@ static int lib_iterateLines(lua_State *L) static int lib_getLine(lua_State *L) { int field; + if (gamestate != GS_LEVEL) + return luaL_error(L, "You cannot access this outside of a level!"); lua_settop(L, 2); lua_remove(L, 1); // dummy userdata table is unused. if (lua_isnumber(L, 1)) @@ -994,9 +1410,15 @@ static int lib_numlines(lua_State *L) return 1; } +///////////// +// sides[] // +///////////// + static int lib_iterateSides(lua_State *L) { size_t i = 0; + if (gamestate != GS_LEVEL) + return luaL_error(L, "This function can only be used in a level!"); if (lua_gettop(L) < 2) return luaL_error(L, "Don't call sides.iterate() directly, use it as 'for side in sides.iterate do end'."); lua_settop(L, 2); @@ -1014,6 +1436,8 @@ static int lib_iterateSides(lua_State *L) static int lib_getSide(lua_State *L) { int field; + if (gamestate != GS_LEVEL) + return luaL_error(L, "You cannot access this outside of a level!"); lua_settop(L, 2); lua_remove(L, 1); // dummy userdata table is unused. if (lua_isnumber(L, 1)) @@ -1040,9 +1464,15 @@ static int lib_numsides(lua_State *L) return 1; } +//////////////// +// vertexes[] // +//////////////// + static int lib_iterateVertexes(lua_State *L) { size_t i = 0; + if (gamestate != GS_LEVEL) + return luaL_error(L, "This function can only be used in a level!"); if (lua_gettop(L) < 2) return luaL_error(L, "Don't call vertexes.iterate() directly, use it as 'for vertex in vertexes.iterate do end'."); lua_settop(L, 2); @@ -1060,6 +1490,8 @@ static int lib_iterateVertexes(lua_State *L) static int lib_getVertex(lua_State *L) { int field; + if (gamestate != GS_LEVEL) + return luaL_error(L, "You cannot access this outside of a level!"); lua_settop(L, 2); lua_remove(L, 1); // dummy userdata table is unused. if (lua_isnumber(L, 1)) @@ -1086,6 +1518,121 @@ static int lib_numvertexes(lua_State *L) return 1; } +#ifdef HAVE_LUA_SEGS + +//////////// +// segs[] // +//////////// + +static int lib_iterateSegs(lua_State *L) +{ + size_t i = 0; + if (gamestate != GS_LEVEL) + return luaL_error(L, "This function can only be used in a level!"); + if (lua_gettop(L) < 2) + return luaL_error(L, "Don't call segs.iterate() directly, use it as 'for seg in segs.iterate do end'."); + lua_settop(L, 2); + lua_remove(L, 1); // state is unused. + if (!lua_isnil(L, 1)) + i = (size_t)(*((seg_t **)luaL_checkudata(L, 1, META_SEG)) - segs)+1; + if (i < numsegs) + { + LUA_PushUserdata(L, &segs[i], META_SEG); + return 1; + } + return 0; +} + +static int lib_getSeg(lua_State *L) +{ + int field; + if (gamestate != GS_LEVEL) + return luaL_error(L, "You cannot access this outside of a level!"); + lua_settop(L, 2); + lua_remove(L, 1); // dummy userdata table is unused. + if (lua_isnumber(L, 1)) + { + size_t i = lua_tointeger(L, 1); + if (i >= numsegs) + return 0; + LUA_PushUserdata(L, &segs[i], META_SEG); + return 1; + } + field = luaL_checkoption(L, 1, NULL, array_opt); + switch(field) + { + case 0: // iterate + lua_pushcfunction(L, lib_iterateSegs); + return 1; + } + return 0; +} + +static int lib_numsegs(lua_State *L) +{ + lua_pushinteger(L, numsegs); + return 1; +} + +///////////// +// nodes[] // +///////////// + +static int lib_iterateNodes(lua_State *L) +{ + size_t i = 0; + if (gamestate != GS_LEVEL) + return luaL_error(L, "This function can only be used in a level!"); + if (lua_gettop(L) < 2) + return luaL_error(L, "Don't call nodes.iterate() directly, use it as 'for node in nodes.iterate do end'."); + lua_settop(L, 2); + lua_remove(L, 1); // state is unused. + if (!lua_isnil(L, 1)) + i = (size_t)(*((node_t **)luaL_checkudata(L, 1, META_NODE)) - nodes)+1; + if (i < numsegs) + { + LUA_PushUserdata(L, &nodes[i], META_NODE); + return 1; + } + return 0; +} + +static int lib_getNode(lua_State *L) +{ + int field; + if (gamestate != GS_LEVEL) + return luaL_error(L, "You cannot access this outside of a level!"); + lua_settop(L, 2); + lua_remove(L, 1); // dummy userdata table is unused. + if (lua_isnumber(L, 1)) + { + size_t i = lua_tointeger(L, 1); + if (i >= numnodes) + return 0; + LUA_PushUserdata(L, &nodes[i], META_NODE); + return 1; + } + field = luaL_checkoption(L, 1, NULL, array_opt); + switch(field) + { + case 0: // iterate + lua_pushcfunction(L, lib_iterateNodes); + return 1; + } + return 0; +} + +static int lib_numnodes(lua_State *L) +{ + lua_pushinteger(L, numnodes); + return 1; +} +#endif + +////////////// +// ffloor_t // +////////////// + static int ffloor_get(lua_State *L) { ffloor_t *ffloor = *((ffloor_t **)luaL_checkudata(L, 1, META_FFLOOR)); @@ -1243,6 +1790,10 @@ static int ffloor_set(lua_State *L) } #ifdef ESLOPE +////////////// +// pslope_t // +////////////// + static int slope_get(lua_State *L) { pslope_t *slope = *((pslope_t **)luaL_checkudata(L, 1, META_SLOPE)); @@ -1379,6 +1930,10 @@ static int slope_set(lua_State *L) return 0; } +/////////////// +// vector*_t // +/////////////// + static int vector2_get(lua_State *L) { vector2_t *vec = *((vector2_t **)luaL_checkudata(L, 1, META_VECTOR2)); @@ -1417,6 +1972,10 @@ static int vector3_get(lua_State *L) } #endif +///////////////////// +// mapheaderinfo[] // +///////////////////// + static int lib_getMapheaderinfo(lua_State *L) { // i -> mapheaderinfo[i-1] @@ -1449,6 +2008,10 @@ static int lib_nummapheaders(lua_State *L) return 1; } +///////////////// +// mapheader_t // +///////////////// + static int mapheaderinfo_get(lua_State *L) { mapheader_t *header = *((mapheader_t **)luaL_checkudata(L, 1, META_MAPHEADER)); @@ -1511,12 +2074,14 @@ static int mapheaderinfo_get(lua_State *L) lua_pushinteger(L, header->levelselect); else if (fastcmp(field,"bonustype")) lua_pushinteger(L, header->bonustype); - else if (fastcmp(field,"saveoverride")) - lua_pushinteger(L, header->saveoverride); + else if (fastcmp(field,"maxbonuslives")) + lua_pushinteger(L, header->maxbonuslives); else if (fastcmp(field,"levelflags")) lua_pushinteger(L, header->levelflags); else if (fastcmp(field,"menuflags")) lua_pushinteger(L, header->menuflags); + else if (fastcmp(field,"startrings")) + lua_pushinteger(L, header->startrings); // TODO add support for reading numGradedMares and grades else { // Read custom vars now @@ -1601,6 +2166,41 @@ int LUA_MapLib(lua_State *L) lua_setfield(L, -2, "__newindex"); lua_pop(L, 1); +#ifdef HAVE_LUA_SEGS + luaL_newmetatable(L, META_SEG); + lua_pushcfunction(L, seg_get); + lua_setfield(L, -2, "__index"); + + lua_pushcfunction(L, seg_num); + lua_setfield(L, -2, "__len"); + lua_pop(L, 1); + + luaL_newmetatable(L, META_NODE); + lua_pushcfunction(L, node_get); + lua_setfield(L, -2, "__index"); + + lua_pushcfunction(L, node_num); + lua_setfield(L, -2, "__len"); + lua_pop(L, 1); + + luaL_newmetatable(L, META_NODEBBOX); + //lua_pushcfunction(L, nodebbox_get); + //lua_setfield(L, -2, "__index"); + lua_pushcfunction(L, nodebbox_call); + lua_setfield(L, -2, "__call"); + lua_pop(L, 1); + + luaL_newmetatable(L, META_NODECHILDREN); + lua_pushcfunction(L, nodechildren_get); + lua_setfield(L, -2, "__index"); + lua_pop(L, 1); +#endif + + luaL_newmetatable(L, META_BBOX); + lua_pushcfunction(L, bbox_get); + lua_setfield(L, -2, "__index"); + lua_pop(L, 1); + #ifdef ESLOPE luaL_newmetatable(L, META_SLOPE); lua_pushcfunction(L, slope_get); @@ -1679,6 +2279,28 @@ int LUA_MapLib(lua_State *L) lua_setmetatable(L, -2); lua_setglobal(L, "vertexes"); +#ifdef HAVE_LUA_SEGS + lua_newuserdata(L, 0); + lua_createtable(L, 0, 2); + lua_pushcfunction(L, lib_getSeg); + lua_setfield(L, -2, "__index"); + + lua_pushcfunction(L, lib_numsegs); + lua_setfield(L, -2, "__len"); + lua_setmetatable(L, -2); + lua_setglobal(L, "segs"); + + lua_newuserdata(L, 0); + lua_createtable(L, 0, 2); + lua_pushcfunction(L, lib_getNode); + lua_setfield(L, -2, "__index"); + + lua_pushcfunction(L, lib_numnodes); + lua_setfield(L, -2, "__len"); + lua_setmetatable(L, -2); + lua_setglobal(L, "nodes"); +#endif + lua_newuserdata(L, 0); lua_createtable(L, 0, 2); lua_pushcfunction(L, lib_getMapheaderinfo); diff --git a/src/lua_mathlib.c b/src/lua_mathlib.c index 6cc8c0077..1f0d6e287 100644 --- a/src/lua_mathlib.c +++ b/src/lua_mathlib.c @@ -81,20 +81,9 @@ static int lib_finecosine(lua_State *L) static int lib_finetangent(lua_State *L) { - // 2.1.15 ONLY HACK: optional boolean argument, only add ANGLE_90 if true - boolean newtan = lua_optboolean(L, 2); - - if (newtan) - { - // HACK: add ANGLE_90 to make tan() in Lua start at 0 like it should - // use & 4095 instead of & FINEMASK (8191), so it doesn't go out of the array's bounds - lua_pushfixed(L, FINETANGENT(((luaL_checkangle(L, 1)+ANGLE_90)>>ANGLETOFINESHIFT) & 4095)); - } - else - { - LUA_Deprecated(L, "tan(angle)", "tan(angle, true)"); - lua_pushfixed(L, FINETANGENT((luaL_checkangle(L, 1)>>ANGLETOFINESHIFT) & 4095)); - } + // HACK: add ANGLE_90 to make tan() in Lua start at 0 like it should + // use & 4095 instead of & FINEMASK (8191), so it doesn't go out of the array's bounds + lua_pushfixed(L, FINETANGENT(((luaL_checkangle(L, 1)+ANGLE_90)>>ANGLETOFINESHIFT) & 4095)); return 1; } diff --git a/src/lua_mobjlib.c b/src/lua_mobjlib.c index aca501221..0835e5cc0 100644 --- a/src/lua_mobjlib.c +++ b/src/lua_mobjlib.c @@ -34,11 +34,14 @@ enum mobj_e { mobj_angle, mobj_sprite, mobj_frame, + mobj_sprite2, mobj_anim_duration, mobj_touching_sectorlist, mobj_subsector, mobj_floorz, mobj_ceilingz, + mobj_floorrover, + mobj_ceilingrover, mobj_radius, mobj_height, mobj_momx, @@ -98,11 +101,14 @@ static const char *const mobj_opt[] = { "angle", "sprite", "frame", + "sprite2", "anim_duration", "touching_sectorlist", "subsector", "floorz", "ceilingz", + "floorrover", + "ceilingrover", "radius", "height", "momx", @@ -197,6 +203,9 @@ static int mobj_get(lua_State *L) case mobj_frame: lua_pushinteger(L, mo->frame); break; + case mobj_sprite2: + lua_pushinteger(L, mo->sprite2); + break; case mobj_anim_duration: lua_pushinteger(L, mo->anim_duration); break; @@ -211,6 +220,12 @@ static int mobj_get(lua_State *L) case mobj_ceilingz: lua_pushfixed(L, mo->ceilingz); break; + case mobj_floorrover: + LUA_PushUserdata(L, mo->floorrover, META_FFLOOR); + break; + case mobj_ceilingrover: + LUA_PushUserdata(L, mo->ceilingrover, META_FFLOOR); + break; case mobj_radius: lua_pushfixed(L, mo->radius); break; @@ -404,6 +419,8 @@ static int mobj_set(lua_State *L) P_CheckPosition(mo, mo->x, mo->y); mo->floorz = tmfloorz; mo->ceilingz = tmceilingz; + mo->floorrover = tmfloorrover; + mo->ceilingrover = tmceilingrover; P_SetTarget(&tmthing, ptmthing); break; } @@ -424,6 +441,9 @@ static int mobj_set(lua_State *L) case mobj_frame: mo->frame = (UINT32)luaL_checkinteger(L, 3); break; + case mobj_sprite2: + mo->sprite2 = P_GetSkinSprite2(((skin_t *)mo->skin), (UINT8)luaL_checkinteger(L, 3), mo->player); + break; case mobj_anim_duration: mo->anim_duration = (UINT16)luaL_checkinteger(L, 3); break; @@ -435,6 +455,10 @@ static int mobj_set(lua_State *L) return NOSETPOS; case mobj_ceilingz: return NOSETPOS; + case mobj_floorrover: + return NOSET; + case mobj_ceilingrover: + return NOSET; case mobj_radius: { mobj_t *ptmthing = tmthing; @@ -444,6 +468,8 @@ static int mobj_set(lua_State *L) P_CheckPosition(mo, mo->x, mo->y); mo->floorz = tmfloorz; mo->ceilingz = tmceilingz; + mo->floorrover = tmfloorrover; + mo->ceilingrover = tmceilingrover; P_SetTarget(&tmthing, ptmthing); break; } @@ -456,6 +482,8 @@ static int mobj_set(lua_State *L) P_CheckPosition(mo, mo->x, mo->y); mo->floorz = tmfloorz; mo->ceilingz = tmceilingz; + mo->floorrover = tmfloorrover; + mo->ceilingrover = tmceilingrover; P_SetTarget(&tmthing, ptmthing); break; } @@ -516,7 +544,8 @@ static int mobj_set(lua_State *L) for (i = 0; i < numskins; i++) if (fastcmp(skins[i].name, skin)) { - mo->skin = &skins[i]; + if (!mo->player || R_SkinUsable(mo->player-players, i)) + mo->skin = &skins[i]; return 0; } return luaL_error(L, "mobj.skin '%s' not found!", skin); @@ -534,10 +563,22 @@ static int mobj_set(lua_State *L) case mobj_bprev: return UNIMPLEMENTED; case mobj_hnext: - mo->hnext = luaL_checkudata(L, 3, META_MOBJ); + if (lua_isnil(L, 3)) + P_SetTarget(&mo->hnext, NULL); + else + { + mobj_t *hnext = *((mobj_t **)luaL_checkudata(L, 3, META_MOBJ)); + P_SetTarget(&mo->hnext, hnext); + } break; case mobj_hprev: - mo->hprev = luaL_checkudata(L, 3, META_MOBJ); + if (lua_isnil(L, 3)) + P_SetTarget(&mo->hprev, NULL); + else + { + mobj_t *hprev = *((mobj_t **)luaL_checkudata(L, 3, META_MOBJ)); + P_SetTarget(&mo->hprev, hprev); + } break; case mobj_type: // yeah sure, we'll let you change the mobj's type. { @@ -760,6 +801,8 @@ static int mapthing_set(lua_State *L) static int lib_iterateMapthings(lua_State *L) { size_t i = 0; + if (gamestate != GS_LEVEL) + return luaL_error(L, "This function can only be used in a level!"); if (lua_gettop(L) < 2) return luaL_error(L, "Don't call mapthings.iterate() directly, use it as 'for mapthing in mapthings.iterate do end'."); lua_settop(L, 2); @@ -777,6 +820,8 @@ static int lib_iterateMapthings(lua_State *L) static int lib_getMapthing(lua_State *L) { int field; + if (gamestate != GS_LEVEL) + return luaL_error(L, "You cannot access this outside of a level!"); lua_settop(L, 2); lua_remove(L, 1); // dummy userdata table is unused. if (lua_isnumber(L, 1)) diff --git a/src/lua_playerlib.c b/src/lua_playerlib.c index dd7439321..f3eb978f6 100644 --- a/src/lua_playerlib.c +++ b/src/lua_playerlib.c @@ -25,6 +25,8 @@ static int lib_iteratePlayers(lua_State *L) { INT32 i = -1; + if (gamestate != GS_LEVEL) + return luaL_error(L, "This function can only be used in a level!"); if (lua_gettop(L) < 2) { //return luaL_error(L, "Don't call players.iterate() directly, use it as 'for player in players.iterate do end'."); @@ -51,6 +53,8 @@ static int lib_getPlayer(lua_State *L) { const char *field; // i -> players[i] + if (gamestate != GS_LEVEL) + return luaL_error(L, "You cannot access this outside of a level!"); if (lua_type(L, 2) == LUA_TNUMBER) { lua_Integer i = luaL_checkinteger(L, 2); @@ -108,6 +112,10 @@ static int player_get(lua_State *L) LUA_PushUserdata(L, &plr->cmd, META_TICCMD); else if (fastcmp(field,"playerstate")) lua_pushinteger(L, plr->playerstate); + else if (fastcmp(field,"camerascale")) + lua_pushfixed(L, plr->camerascale); + else if (fastcmp(field,"shieldscale")) + lua_pushfixed(L, plr->shieldscale); else if (fastcmp(field,"viewz")) lua_pushfixed(L, plr->viewz); else if (fastcmp(field,"viewheight")) @@ -118,8 +126,12 @@ static int player_get(lua_State *L) lua_pushfixed(L, plr->bob); else if (fastcmp(field,"aiming")) lua_pushangle(L, plr->aiming); - else if (fastcmp(field,"health")) - lua_pushinteger(L, plr->health); + else if (fastcmp(field,"drawangle")) + lua_pushangle(L, plr->drawangle); + else if (fastcmp(field,"rings")) + lua_pushinteger(L, plr->rings); + else if (fastcmp(field,"spheres")) + lua_pushinteger(L, plr->spheres); else if (fastcmp(field,"pity")) lua_pushinteger(L, plr->pity); else if (fastcmp(field,"currentweapon")) @@ -142,8 +154,6 @@ static int player_get(lua_State *L) lua_pushinteger(L, plr->score); else if (fastcmp(field,"dashspeed")) lua_pushfixed(L, plr->dashspeed); - else if (fastcmp(field,"dashtime")) - lua_pushinteger(L, plr->dashtime); else if (fastcmp(field,"normalspeed")) lua_pushfixed(L, plr->normalspeed); else if (fastcmp(field,"runspeed")) @@ -166,6 +176,10 @@ static int player_get(lua_State *L) lua_pushinteger(L, plr->spinitem); else if (fastcmp(field,"revitem")) lua_pushinteger(L, plr->revitem); + else if (fastcmp(field,"followitem")) + lua_pushinteger(L, plr->followitem); + else if (fastcmp(field,"followmobj")) + LUA_PushUserdata(L, plr->followmobj, META_MOBJ); else if (fastcmp(field,"actionspd")) lua_pushfixed(L, plr->actionspd); else if (fastcmp(field,"mindash")) @@ -174,6 +188,10 @@ static int player_get(lua_State *L) lua_pushfixed(L, plr->maxdash); else if (fastcmp(field,"jumpfactor")) lua_pushfixed(L, plr->jumpfactor); + else if (fastcmp(field,"height")) + lua_pushfixed(L, plr->height); + else if (fastcmp(field,"spinheight")) + lua_pushfixed(L, plr->spinheight); else if (fastcmp(field,"lives")) lua_pushinteger(L, plr->lives); else if (fastcmp(field,"continues")) @@ -184,8 +202,6 @@ static int player_get(lua_State *L) lua_pushinteger(L, plr->gotcontinue); else if (fastcmp(field,"speed")) lua_pushfixed(L, plr->speed); - else if (fastcmp(field,"jumping")) - lua_pushboolean(L, plr->jumping); else if (fastcmp(field,"secondjump")) lua_pushinteger(L, plr->secondjump); else if (fastcmp(field,"fly1")) @@ -202,6 +218,8 @@ static int player_get(lua_State *L) lua_pushinteger(L, plr->exiting); else if (fastcmp(field,"homing")) lua_pushinteger(L, plr->homing); + else if (fastcmp(field,"dashmode")) + lua_pushinteger(L, plr->dashmode); else if (fastcmp(field,"skidtime")) lua_pushinteger(L, plr->skidtime); else if (fastcmp(field,"cmomx")) @@ -270,22 +288,46 @@ static int player_get(lua_State *L) lua_pushboolean(L, plr->bonustime); else if (fastcmp(field,"capsule")) LUA_PushUserdata(L, plr->capsule, META_MOBJ); + else if (fastcmp(field,"drone")) + LUA_PushUserdata(L, plr->drone, META_MOBJ); + else if (fastcmp(field,"oldscale")) + lua_pushfixed(L, plr->oldscale); else if (fastcmp(field,"mare")) lua_pushinteger(L, plr->mare); + else if (fastcmp(field,"marelap")) + lua_pushinteger(L, plr->marelap); + else if (fastcmp(field,"marebonuslap")) + lua_pushinteger(L, plr->marebonuslap); else if (fastcmp(field,"marebegunat")) lua_pushinteger(L, plr->marebegunat); else if (fastcmp(field,"startedtime")) lua_pushinteger(L, plr->startedtime); else if (fastcmp(field,"finishedtime")) lua_pushinteger(L, plr->finishedtime); + else if (fastcmp(field,"lapbegunat")) + lua_pushinteger(L, plr->lapbegunat); + else if (fastcmp(field,"lapstartedtime")) + lua_pushinteger(L, plr->lapstartedtime); + else if (fastcmp(field,"finishedspheres")) + lua_pushinteger(L, plr->finishedspheres); else if (fastcmp(field,"finishedrings")) lua_pushinteger(L, plr->finishedrings); else if (fastcmp(field,"marescore")) lua_pushinteger(L, plr->marescore); else if (fastcmp(field,"lastmarescore")) lua_pushinteger(L, plr->lastmarescore); + else if (fastcmp(field,"totalmarescore")) + lua_pushinteger(L, plr->totalmarescore); else if (fastcmp(field,"lastmare")) lua_pushinteger(L, plr->lastmare); + else if (fastcmp(field,"lastmarelap")) + lua_pushinteger(L, plr->lastmarelap); + else if (fastcmp(field,"lastmarebonuslap")) + lua_pushinteger(L, plr->lastmarebonuslap); + else if (fastcmp(field,"totalmarelap")) + lua_pushinteger(L, plr->totalmarelap); + else if (fastcmp(field,"totalmarebonuslap")) + lua_pushinteger(L, plr->totalmarebonuslap); else if (fastcmp(field,"maxlink")) lua_pushinteger(L, plr->maxlink); else if (fastcmp(field,"texttimer")) @@ -310,6 +352,8 @@ static int player_get(lua_State *L) lua_pushangle(L, plr->awayviewaiming); else if (fastcmp(field,"spectator")) lua_pushboolean(L, plr->spectator); + else if (fastcmp(field,"outofcoop")) + lua_pushboolean(L, plr->outofcoop); else if (fastcmp(field,"bot")) lua_pushinteger(L, plr->bot); else if (fastcmp(field,"jointime")) @@ -355,6 +399,10 @@ static int player_set(lua_State *L) return NOSET; else if (fastcmp(field,"playerstate")) plr->playerstate = luaL_checkinteger(L, 3); + else if (fastcmp(field,"camerascale")) + plr->camerascale = luaL_checkfixed(L, 3); + else if (fastcmp(field,"shieldscale")) + plr->shieldscale = luaL_checkfixed(L, 3); else if (fastcmp(field,"viewz")) plr->viewz = luaL_checkfixed(L, 3); else if (fastcmp(field,"viewheight")) @@ -370,8 +418,12 @@ static int player_set(lua_State *L) else if (plr == &players[secondarydisplayplayer]) localaiming2 = plr->aiming; } - else if (fastcmp(field,"health")) - plr->health = (INT32)luaL_checkinteger(L, 3); + else if (fastcmp(field,"drawangle")) + plr->drawangle = luaL_checkangle(L, 3); + else if (fastcmp(field,"rings")) + plr->rings = (INT32)luaL_checkinteger(L, 3); + else if (fastcmp(field,"spheres")) + plr->spheres = (INT32)luaL_checkinteger(L, 3); else if (fastcmp(field,"pity")) plr->pity = (SINT8)luaL_checkinteger(L, 3); else if (fastcmp(field,"currentweapon")) @@ -399,8 +451,6 @@ static int player_set(lua_State *L) plr->score = (UINT32)luaL_checkinteger(L, 3); else if (fastcmp(field,"dashspeed")) plr->dashspeed = luaL_checkfixed(L, 3); - else if (fastcmp(field,"dashtime")) - plr->dashtime = (INT32)luaL_checkinteger(L, 3); else if (fastcmp(field,"normalspeed")) plr->normalspeed = luaL_checkfixed(L, 3); else if (fastcmp(field,"runspeed")) @@ -423,6 +473,10 @@ static int player_set(lua_State *L) plr->spinitem = luaL_checkinteger(L, 3); else if (fastcmp(field,"revitem")) plr->revitem = luaL_checkinteger(L, 3); + else if (fastcmp(field,"followitem")) + plr->followitem = luaL_checkinteger(L, 3); + else if (fastcmp(field,"followmobj")) + P_SetTarget(&plr->followmobj, *((mobj_t **)luaL_checkudata(L, 3, META_MOBJ))); else if (fastcmp(field,"actionspd")) plr->actionspd = (INT32)luaL_checkinteger(L, 3); else if (fastcmp(field,"mindash")) @@ -431,6 +485,10 @@ static int player_set(lua_State *L) plr->maxdash = (INT32)luaL_checkinteger(L, 3); else if (fastcmp(field,"jumpfactor")) plr->jumpfactor = (INT32)luaL_checkinteger(L, 3); + else if (fastcmp(field,"height")) + plr->height = luaL_checkfixed(L, 3); + else if (fastcmp(field,"spinheight")) + plr->spinheight = luaL_checkfixed(L, 3); else if (fastcmp(field,"lives")) plr->lives = (SINT8)luaL_checkinteger(L, 3); else if (fastcmp(field,"continues")) @@ -441,8 +499,6 @@ static int player_set(lua_State *L) plr->gotcontinue = (UINT8)luaL_checkinteger(L, 3); else if (fastcmp(field,"speed")) plr->speed = luaL_checkfixed(L, 3); - else if (fastcmp(field,"jumping")) - plr->jumping = luaL_checkboolean(L, 3); else if (fastcmp(field,"secondjump")) plr->secondjump = (UINT8)luaL_checkinteger(L, 3); else if (fastcmp(field,"fly1")) @@ -459,6 +515,8 @@ static int player_set(lua_State *L) plr->exiting = (tic_t)luaL_checkinteger(L, 3); else if (fastcmp(field,"homing")) plr->homing = (UINT8)luaL_checkinteger(L, 3); + else if (fastcmp(field,"dashmode")) + plr->dashmode = (tic_t)luaL_checkinteger(L, 3); else if (fastcmp(field,"skidtime")) plr->skidtime = (tic_t)luaL_checkinteger(L, 3); else if (fastcmp(field,"cmomx")) @@ -532,22 +590,51 @@ static int player_set(lua_State *L) mo = *((mobj_t **)luaL_checkudata(L, 3, META_MOBJ)); P_SetTarget(&plr->capsule, mo); } + else if (fastcmp(field,"drone")) + { + mobj_t *mo = NULL; + if (!lua_isnil(L, 3)) + mo = *((mobj_t **)luaL_checkudata(L, 3, META_MOBJ)); + P_SetTarget(&plr->drone, mo); + } + else if (fastcmp(field,"oldscale")) + plr->oldscale = luaL_checkfixed(L, 3); else if (fastcmp(field,"mare")) plr->mare = (UINT8)luaL_checkinteger(L, 3); + else if (fastcmp(field,"marelap")) + plr->marelap = (UINT8)luaL_checkinteger(L, 3); + else if (fastcmp(field,"marebonuslap")) + plr->marebonuslap = (UINT8)luaL_checkinteger(L, 3); else if (fastcmp(field,"marebegunat")) plr->marebegunat = (tic_t)luaL_checkinteger(L, 3); else if (fastcmp(field,"startedtime")) plr->startedtime = (tic_t)luaL_checkinteger(L, 3); else if (fastcmp(field,"finishedtime")) plr->finishedtime = (tic_t)luaL_checkinteger(L, 3); + else if (fastcmp(field,"lapbegunat")) + plr->lapbegunat = (tic_t)luaL_checkinteger(L, 3); + else if (fastcmp(field,"lapstartedtime")) + plr->lapstartedtime = (tic_t)luaL_checkinteger(L, 3); + else if (fastcmp(field,"finishedspheres")) + plr->finishedspheres = (INT16)luaL_checkinteger(L, 3); else if (fastcmp(field,"finishedrings")) plr->finishedrings = (INT16)luaL_checkinteger(L, 3); else if (fastcmp(field,"marescore")) plr->marescore = (UINT32)luaL_checkinteger(L, 3); else if (fastcmp(field,"lastmarescore")) plr->lastmarescore = (UINT32)luaL_checkinteger(L, 3); + else if (fastcmp(field,"totalmarescore")) + plr->totalmarescore = (UINT32)luaL_checkinteger(L, 3); else if (fastcmp(field,"lastmare")) plr->lastmare = (UINT8)luaL_checkinteger(L, 3); + else if (fastcmp(field,"lastmarelap")) + plr->lastmarelap = (UINT8)luaL_checkinteger(L, 3); + else if (fastcmp(field,"lastmarebonuslap")) + plr->lastmarebonuslap = (UINT8)luaL_checkinteger(L, 3); + else if (fastcmp(field,"totalmarelap")) + plr->totalmarelap = (UINT8)luaL_checkinteger(L, 3); + else if (fastcmp(field,"totalmarebonuslap")) + plr->totalmarebonuslap = (UINT8)luaL_checkinteger(L, 3); else if (fastcmp(field,"maxlink")) plr->maxlink = (INT32)luaL_checkinteger(L, 3); else if (fastcmp(field,"texttimer")) @@ -581,6 +668,8 @@ static int player_set(lua_State *L) plr->awayviewaiming = luaL_checkangle(L, 3); else if (fastcmp(field,"spectator")) plr->spectator = lua_toboolean(L, 3); + else if (fastcmp(field,"outofcoop")) + plr->outofcoop = lua_toboolean(L, 3); else if (fastcmp(field,"bot")) return NOSET; else if (fastcmp(field,"jointime")) diff --git a/src/lua_script.c b/src/lua_script.c index edf8ac3c5..04aa55cf0 100644 --- a/src/lua_script.c +++ b/src/lua_script.c @@ -164,6 +164,11 @@ void LUA_ClearExtVars(void) } #endif +// Use this variable to prevent certain functions from running +// if they were not called on lump load +// (i.e. they were called in hooks or coroutines etc) +boolean lua_lumploading = false; + // Load a script from a MYFILE static inline void LUA_LoadFile(MYFILE *f, char *name) { @@ -175,11 +180,15 @@ static inline void LUA_LoadFile(MYFILE *f, char *name) lua_pushinteger(gL, f->wad); lua_setfield(gL, LUA_REGISTRYINDEX, "WAD"); + lua_lumploading = true; // turn on loading flag + if (luaL_loadbuffer(gL, f->data, f->size, va("@%s",name)) || lua_pcall(gL, 0, 0, 0)) { CONS_Alert(CONS_WARNING,"%s\n",lua_tostring(gL,-1)); lua_pop(gL,1); } lua_gc(gL, LUA_GCCOLLECT, 0); + + lua_lumploading = false; // turn off again } // Load a script from a lump @@ -408,6 +417,7 @@ void LUA_InvalidateLevel(void) { thinker_t *th; size_t i; + ffloor_t *rover = NULL; if (!gL) return; @@ -419,7 +429,15 @@ void LUA_InvalidateLevel(void) for (i = 0; i < numsubsectors; i++) LUA_InvalidateUserdata(&subsectors[i]); for (i = 0; i < numsectors; i++) + { LUA_InvalidateUserdata(§ors[i]); + LUA_InvalidateUserdata(sectors[i].lines); + if (sectors[i].ffloors) + { + for (rover = sectors[i].ffloors; rover; rover = rover->next) + LUA_InvalidateUserdata(rover); + } + } for (i = 0; i < numlines; i++) { LUA_InvalidateUserdata(&lines[i]); @@ -429,6 +447,16 @@ void LUA_InvalidateLevel(void) LUA_InvalidateUserdata(&sides[i]); for (i = 0; i < numvertexes; i++) LUA_InvalidateUserdata(&vertexes[i]); +#ifdef HAVE_LUA_SEGS + for (i = 0; i < numsegs; i++) + LUA_InvalidateUserdata(&segs[i]); + for (i = 0; i < numnodes; i++) + { + LUA_InvalidateUserdata(&nodes[i]); + LUA_InvalidateUserdata(nodes[i].bbox); + LUA_InvalidateUserdata(nodes[i].children); + } +#endif } void LUA_InvalidateMapthings(void) @@ -468,6 +496,11 @@ enum ARCH_SIDE, ARCH_SUBSECTOR, ARCH_SECTOR, +#ifdef HAVE_LUA_SEGS + ARCH_SEG, + ARCH_NODE, +#endif + ARCH_FFLOOR, #ifdef ESLOPE ARCH_SLOPE, #endif @@ -490,6 +523,11 @@ static const struct { {META_SIDE, ARCH_SIDE}, {META_SUBSECTOR,ARCH_SUBSECTOR}, {META_SECTOR, ARCH_SECTOR}, +#ifdef HAVE_LUA_SEGS + {META_SEG, ARCH_SEG}, + {META_NODE, ARCH_NODE}, +#endif + {META_FFLOOR, ARCH_FFLOOR}, #ifdef ESLOPE {META_SLOPE, ARCH_SLOPE}, #endif @@ -697,6 +735,56 @@ static UINT8 ArchiveValue(int TABLESINDEX, int myindex) } break; } +#ifdef HAVE_LUA_SEGS + case ARCH_SEG: + { + seg_t *seg = *((seg_t **)lua_touserdata(gL, myindex)); + if (!seg) + WRITEUINT8(save_p, ARCH_NULL); + else { + WRITEUINT8(save_p, ARCH_SEG); + WRITEUINT16(save_p, seg - segs); + } + break; + } + case ARCH_NODE: + { + node_t *node = *((node_t **)lua_touserdata(gL, myindex)); + if (!node) + WRITEUINT8(save_p, ARCH_NULL); + else { + WRITEUINT8(save_p, ARCH_NODE); + WRITEUINT16(save_p, node - nodes); + } + break; + } +#endif + case ARCH_FFLOOR: + { + ffloor_t *rover = *((ffloor_t **)lua_touserdata(gL, myindex)); + if (!rover) + WRITEUINT8(save_p, ARCH_NULL); + else { + ffloor_t *r2; + UINT16 i = 0; + // search for id + for (r2 = rover->target->ffloors; r2; r2 = r2->next) + { + if (r2 == rover) + break; + i++; + } + if (!r2) + WRITEUINT8(save_p, ARCH_NULL); + else + { + WRITEUINT8(save_p, ARCH_FFLOOR); + WRITEUINT16(save_p, rover->target - sectors); + WRITEUINT16(save_p, i); + } + } + break; + } #ifdef ESLOPE case ARCH_SLOPE: { @@ -914,6 +1002,23 @@ static UINT8 UnArchiveValue(int TABLESINDEX) case ARCH_SECTOR: LUA_PushUserdata(gL, §ors[READUINT16(save_p)], META_SECTOR); break; +#ifdef HAVE_LUA_SEGS + case ARCH_SEG: + LUA_PushUserdata(gL, &segs[READUINT16(save_p)], META_SEG); + break; + case ARCH_NODE: + LUA_PushUserdata(gL, &nodes[READUINT16(save_p)], META_NODE); + break; +#endif + case ARCH_FFLOOR: + { + sector_t *sector = §ors[READUINT16(save_p)]; + UINT16 id = READUINT16(save_p); + ffloor_t *rover = P_GetFFloorByID(sector, id); + if (rover) + LUA_PushUserdata(gL, rover, META_FFLOOR); + break; + } #ifdef ESLOPE case ARCH_SLOPE: LUA_PushUserdata(gL, P_SlopeById(READUINT16(save_p)), META_SLOPE); diff --git a/src/lua_script.h b/src/lua_script.h index f944149d7..b690e4fa7 100644 --- a/src/lua_script.h +++ b/src/lua_script.h @@ -38,6 +38,8 @@ void LUA_ClearExtVars(void); #endif +extern boolean lua_lumploading; // is LUA_LoadLump being called? + void LUA_LoadLump(UINT16 wad, UINT16 lump); #ifdef LUA_ALLOW_BYTECODE void LUA_DumpFile(const char *filename); @@ -92,4 +94,7 @@ void COM_Lua_f(void); }\ } +// uncomment if you want seg_t/node_t in Lua +// #define HAVE_LUA_SEGS + #endif diff --git a/src/lua_skinlib.c b/src/lua_skinlib.c index 0fbcb2fd3..a8f785c5a 100644 --- a/src/lua_skinlib.c +++ b/src/lua_skinlib.c @@ -35,6 +35,7 @@ enum skin { skin_thokitem, skin_spinitem, skin_revitem, + skin_followitem, skin_actionspd, skin_mindash, skin_maxdash, @@ -44,10 +45,18 @@ enum skin { skin_accelstart, skin_acceleration, skin_jumpfactor, + skin_radius, + skin_height, + skin_spinheight, + skin_shieldscale, + skin_camerascale, skin_starttranscolor, skin_prefcolor, + skin_supercolor, + skin_prefoppositecolor, skin_highresscale, - skin_soundsid + skin_soundsid, + skin_availability }; static const char *const skin_opt[] = { "valid", @@ -65,6 +74,7 @@ static const char *const skin_opt[] = { "thokitem", "spinitem", "revitem", + "followitem", "actionspd", "mindash", "maxdash", @@ -74,10 +84,18 @@ static const char *const skin_opt[] = { "accelstart", "acceleration", "jumpfactor", + "radius", + "height", + "spinheight", + "shieldscale", + "camerascale", "starttranscolor", "prefcolor", + "supercolor", + "prefoppositecolor", "highresscale", "soundsid", + "availability", NULL}; #define UNIMPLEMENTED luaL_error(L, LUA_QL("skin_t") " field " LUA_QS " is not implemented for Lua and cannot be accessed.", skin_opt[field]) @@ -146,6 +164,9 @@ static int skin_get(lua_State *L) case skin_revitem: lua_pushinteger(L, skin->revitem); break; + case skin_followitem: + lua_pushinteger(L, skin->followitem); + break; case skin_actionspd: lua_pushfixed(L, skin->actionspd); break; @@ -173,18 +194,42 @@ static int skin_get(lua_State *L) case skin_jumpfactor: lua_pushfixed(L, skin->jumpfactor); break; + case skin_radius: + lua_pushfixed(L, skin->radius); + break; + case skin_height: + lua_pushfixed(L, skin->height); + break; + case skin_spinheight: + lua_pushfixed(L, skin->spinheight); + break; + case skin_shieldscale: + lua_pushfixed(L, skin->shieldscale); + break; + case skin_camerascale: + lua_pushfixed(L, skin->camerascale); + break; case skin_starttranscolor: lua_pushinteger(L, skin->starttranscolor); break; case skin_prefcolor: lua_pushinteger(L, skin->prefcolor); break; + case skin_supercolor: + lua_pushinteger(L, skin->supercolor); + break; + case skin_prefoppositecolor: + lua_pushinteger(L, skin->prefoppositecolor); + break; case skin_highresscale: lua_pushinteger(L, skin->highresscale); break; case skin_soundsid: LUA_PushUserdata(L, skin->soundsid, META_SOUNDSID); break; + case skin_availability: + lua_pushinteger(L, skin->availability); + break; } return 1; } diff --git a/src/lua_thinkerlib.c b/src/lua_thinkerlib.c index ae859d46e..ae648613a 100644 --- a/src/lua_thinkerlib.c +++ b/src/lua_thinkerlib.c @@ -54,7 +54,13 @@ static int iterationState_gc(lua_State *L) static int lib_iterateThinkers(lua_State *L) { thinker_t *th = NULL, *next = NULL; - struct iterationState *it = luaL_checkudata(L, 1, META_ITERATIONSTATE); + struct iterationState *it; + + if (gamestate != GS_LEVEL) + return luaL_error(L, "This function can only be used in a level!"); + + it = luaL_checkudata(L, 1, META_ITERATIONSTATE); + lua_settop(L, 2); if (lua_isnil(L, 2)) @@ -106,6 +112,9 @@ static int lib_startIterate(lua_State *L) { struct iterationState *it; + if (gamestate != GS_LEVEL) + return luaL_error(L, "This function can only be used in a level!"); + lua_pushvalue(L, lua_upvalueindex(1)); it = lua_newuserdata(L, sizeof(struct iterationState)); luaL_getmetatable(L, META_ITERATIONSTATE); diff --git a/src/lzf.c b/src/lzf.c index 272174f30..f81c3ee0a 100644 --- a/src/lzf.c +++ b/src/lzf.c @@ -119,9 +119,7 @@ /*****************************************************************************/ /* nothing should be changed below */ -#ifndef _NDS typedef unsigned char u8; -#endif typedef const u8 *LZF_STATE[1 << (HLOG)]; @@ -159,7 +157,7 @@ typedef const u8 *LZF_STATE[1 << (HLOG)]; * lzfP.h ends here. lzf_d.c follows. */ -#if AVOID_ERRNO || defined(_WIN32_WCE) +#if AVOID_ERRNO # define SET_ERRNO(n) #else # include diff --git a/src/m_anigif.c b/src/m_anigif.c index 4e68819bc..901927fa1 100644 --- a/src/m_anigif.c +++ b/src/m_anigif.c @@ -18,6 +18,7 @@ #include "z_zone.h" #include "v_video.h" #include "i_video.h" +#include "m_misc.h" // GIFs are always little-endian #include "byteptr.h" @@ -396,7 +397,6 @@ static void GIF_headwrite(void) { UINT8 *gifhead = Z_Malloc(800, PU_STATIC, NULL); UINT8 *p = gifhead; - RGBA_t *c; INT32 i; UINT16 rwidth, rheight; @@ -427,12 +427,17 @@ static void GIF_headwrite(void) WRITEUINT8(p, 0x00); // write color table - for (i = 0; i < 256; ++i) { - c = &pLocalPalette[i]; - WRITEUINT8(p, c->s.red); - WRITEUINT8(p, c->s.green); - WRITEUINT8(p, c->s.blue); + RGBA_t *pal = ((cv_screenshot_colorprofile.value) + ? pLocalPalette + : pMasterPalette); + + for (i = 0; i < 256; i++) + { + WRITEUINT8(p, pal[i].s.red); + WRITEUINT8(p, pal[i].s.green); + WRITEUINT8(p, pal[i].s.blue); + } } // write extension block diff --git a/src/m_argv.c b/src/m_argv.c index e8bfdd3db..117ec7833 100644 --- a/src/m_argv.c +++ b/src/m_argv.c @@ -127,12 +127,7 @@ void M_PushSpecialParameters(void) } /// \brief max args - -#if defined (_arch_dreamcast) || defined (_XBOX) || defined (_WII) -#define MAXARGVS 1 -#else #define MAXARGVS 256 -#endif /** \brief the M_FindResponseFile function Find a response file diff --git a/src/m_cheat.c b/src/m_cheat.c index 6fa3ea113..bee60087f 100644 --- a/src/m_cheat.c +++ b/src/m_cheat.c @@ -61,7 +61,7 @@ static UINT8 cheatf_ultimate(void) if (menuactive && (currentMenu != &MainDef && currentMenu != &SP_LoadDef)) return 0; // Only on the main menu, or the save select! - S_StartSound(0, sfx_itemup); + BwehHehHe(); ultimate_selectable = (!ultimate_selectable); // If on the save select, move to what is now Ultimate Mode! @@ -70,6 +70,7 @@ static UINT8 cheatf_ultimate(void) return 1; } +#ifdef REDXVI static UINT8 cheatf_warp(void) { if (modifiedgame) @@ -91,6 +92,7 @@ static UINT8 cheatf_warp(void) M_StartControlPanel(); return 1; } +#endif #ifdef DEVELOP static UINT8 cheatf_devmode(void) @@ -109,7 +111,7 @@ static UINT8 cheatf_devmode(void) G_SetGameModified(false); for (i = 0; i < MAXUNLOCKABLES; i++) unlockables[i].unlocked = true; - devparm = TRUE; + devparm = true; cv_debug |= 0x8000; // Refresh secrets menu existing. @@ -131,6 +133,7 @@ static cheatseq_t cheat_ultimate_joy = { SCRAMBLE(KEY_ENTER), 0xff } }; +#ifdef REDXVI static cheatseq_t cheat_warp = { 0, cheatf_warp, { SCRAMBLE('r'), SCRAMBLE('e'), SCRAMBLE('d'), SCRAMBLE('x'), SCRAMBLE('v'), SCRAMBLE('i'), 0xff } @@ -143,6 +146,7 @@ static cheatseq_t cheat_warp_joy = { SCRAMBLE(KEY_LEFTARROW), SCRAMBLE(KEY_UPARROW), SCRAMBLE(KEY_ENTER), 0xff } }; +#endif #ifdef DEVELOP static cheatseq_t cheat_devmode = { @@ -235,8 +239,10 @@ boolean cht_Responder(event_t *ev) ret += cht_CheckCheat(&cheat_ultimate, (char)ch); ret += cht_CheckCheat(&cheat_ultimate_joy, (char)ch); +#ifdef REDXVI ret += cht_CheckCheat(&cheat_warp, (char)ch); ret += cht_CheckCheat(&cheat_warp_joy, (char)ch); +#endif #ifdef DEVELOP ret += cht_CheckCheat(&cheat_devmode, (char)ch); #endif @@ -353,7 +359,7 @@ void Command_Hurtme_f(void) return; } - P_DamageMobj(players[consoleplayer].mo, NULL, NULL, atoi(COM_Argv(1))); + P_DamageMobj(players[consoleplayer].mo, NULL, NULL, atoi(COM_Argv(1)), 0); } // Moves the NiGHTS player to another axis within the current mare @@ -493,56 +499,211 @@ void Command_Teleport_f(void) REQUIRE_INLEVEL; REQUIRE_SINGLEPLAYER; - if (COM_Argc() < 3 || COM_Argc() > 7) + if (COM_Argc() < 3 || COM_Argc() > 11) { - CONS_Printf(M_GetText("teleport -x -y -z : teleport to a location\n")); + CONS_Printf(M_GetText("teleport -x -y -z -ang -aim : teleport to a location\nteleport -sp : teleport to specified checkpoint\n")); return; } if (!p->mo) return; - i = COM_CheckParm("-x"); - if (i) - intx = atoi(COM_Argv(i + 1)); - else - { - CONS_Alert(CONS_NOTICE, M_GetText("%s value not specified\n"), "X"); - return; - } - - i = COM_CheckParm("-y"); - if (i) - inty = atoi(COM_Argv(i + 1)); - else - { - CONS_Alert(CONS_NOTICE, M_GetText("%s value not specified\n"), "Y"); - return; - } - - ss = R_PointInSubsector(intx*FRACUNIT, inty*FRACUNIT); - if (!ss || ss->sector->ceilingheight - ss->sector->floorheight < p->mo->height) - { - CONS_Alert(CONS_NOTICE, M_GetText("Not a valid location.\n")); - return; - } - i = COM_CheckParm("-z"); + i = COM_CheckParm("-sp"); if (i) { - intz = atoi(COM_Argv(i + 1)); - intz <<= FRACBITS; - if (intz < ss->sector->floorheight) - intz = ss->sector->floorheight; - if (intz > ss->sector->ceilingheight - p->mo->height) - intz = ss->sector->ceilingheight - p->mo->height; + INT32 starpostnum = atoi(COM_Argv(i + 1)); // starpost number + INT32 starpostpath = atoi(COM_Argv(i + 2)); // quick, dirty way to distinguish between paths + + if (starpostnum < 0 || starpostpath < 0) + { + CONS_Alert(CONS_NOTICE, M_GetText("Negative starpost indexing is not valid.\n")); + return; + } + + if (!starpostnum) // spawnpoints... + { + mapthing_t *mt; + + if (starpostpath >= numcoopstarts) + { + CONS_Alert(CONS_NOTICE, M_GetText("Player %d spawnpoint not found (%d max).\n"), starpostpath+1, numcoopstarts-1); + return; + } + + mt = playerstarts[starpostpath]; // Given above check, should never be NULL. + intx = mt->x<y<sector->ceilingheight - ss->sector->floorheight < p->mo->height) + { + CONS_Alert(CONS_NOTICE, M_GetText("Spawnpoint not in a valid location.\n")); + return; + } + + // Flagging a player's ambush will make them start on the ceiling + // Objectflip inverts + if (!!(mt->options & MTF_AMBUSH) ^ !!(mt->options & MTF_OBJECTFLIP)) + { + intz = ss->sector->ceilingheight - p->mo->height; + if (mt->options >> ZSHIFT) + intz -= ((mt->options >> ZSHIFT) << FRACBITS); + } + else + { + intz = ss->sector->floorheight; + if (mt->options >> ZSHIFT) + intz += ((mt->options >> ZSHIFT) << FRACBITS); + } + + if (mt->options & MTF_OBJECTFLIP) // flip the player! + { + p->mo->eflags |= MFE_VERTICALFLIP; + p->mo->flags2 |= MF2_OBJECTFLIP; + } + else + { + p->mo->eflags &= ~MFE_VERTICALFLIP; + p->mo->flags2 &= ~MF2_OBJECTFLIP; + } + + localangle = p->mo->angle = p->drawangle = FixedAngle(mt->angle<next) + { + if (th->function.acp1 != (actionf_p1)P_MobjThinker) + continue; + + mo2 = (mobj_t *)th; + + if (mo2->type != MT_STARPOST) + continue; + + if (mo2->health != starpostnum) + { + if (mo2->health > starpostmax) + starpostmax = mo2->health; + continue; + } + + if (intz--) + continue; + + break; + } + + if (th == &thinkercap) + { + if (intz == starpostpath) + CONS_Alert(CONS_NOTICE, M_GetText("No starpost of position %d found (%d max).\n"), starpostnum, starpostmax); + else + CONS_Alert(CONS_NOTICE, M_GetText("Starpost of position %d, %d not found (%d, %d max).\n"), starpostnum, starpostpath, starpostmax, (starpostpath-intz)-1); + return; + } + + ss = R_IsPointInSubsector(mo2->x, mo2->y); + if (!ss || ss->sector->ceilingheight - ss->sector->floorheight < p->mo->height) + { + CONS_Alert(CONS_NOTICE, M_GetText("Starpost not in a valid location.\n")); + return; + } + + intx = mo2->x; + inty = mo2->y; + intz = mo2->z; + + if (mo2->flags2 & MF2_OBJECTFLIP) // flip the player! + { + p->mo->eflags |= MFE_VERTICALFLIP; + p->mo->flags2 |= MF2_OBJECTFLIP; + } + else + { + p->mo->eflags &= ~MFE_VERTICALFLIP; + p->mo->flags2 &= ~MF2_OBJECTFLIP; + } + + localangle = p->mo->angle = p->drawangle = mo2->angle; + } + + CONS_Printf(M_GetText("Teleporting to checkpoint %d, %d...\n"), starpostnum, starpostpath); } else - intz = ss->sector->floorheight; + { + i = COM_CheckParm("-nop"); // undocumented stupid addition to allow pivoting on the spot with -ang and -aim + if (i) + { + intx = p->mo->x; + inty = p->mo->y; + } + else + { + i = COM_CheckParm("-x"); + if (i) + intx = atoi(COM_Argv(i + 1))<sector->ceilingheight - ss->sector->floorheight < p->mo->height) + { + CONS_Alert(CONS_NOTICE, M_GetText("Not a valid location.\n")); + return; + } + i = COM_CheckParm("-z"); + if (i) + { + intz = atoi(COM_Argv(i + 1))<sector->floorheight) + intz = ss->sector->floorheight; + if (intz > ss->sector->ceilingheight - p->mo->height) + intz = ss->sector->ceilingheight - p->mo->height; + } + else + intz = ((p->mo->eflags & MFE_VERTICALFLIP) ? ss->sector->ceilingheight : ss->sector->floorheight); + + i = COM_CheckParm("-ang"); + if (i) + localangle = p->drawangle = p->mo->angle = FixedAngle(atoi(COM_Argv(i + 1))<= ANGLE_90 && aim <= ANGLE_270) + { + CONS_Alert(CONS_NOTICE, M_GetText("Not a valid aiming angle (between +/-90).\n")); + return; + } + localaiming = p->aiming = aim; + } + + CONS_Printf(M_GetText("Teleporting to %d, %d, %d...\n"), FixedInt(intx), FixedInt(inty), FixedInt(intz)); + } P_MapStart(); - if (!P_TeleportMove(p->mo, intx*FRACUNIT, inty*FRACUNIT, intz)) + if (!P_TeleportMove(p->mo, intx, inty, intz)) CONS_Alert(CONS_WARNING, M_GetText("Unable to teleport to that spot!\n")); else S_StartSound(p->mo, sfx_mixup); @@ -606,7 +767,7 @@ void Command_CauseCfail_f(void) players[consoleplayer].mo->y = 123311; //cfail cansuled kthxbye players[consoleplayer].mo->z = 123311; players[consoleplayer].score = 1337; - players[consoleplayer].health = 1337; + players[consoleplayer].rings = 1337; players[consoleplayer].mo->destscale = 25; P_SetThingPosition(players[consoleplayer].mo); @@ -719,11 +880,19 @@ void Command_Setrings_f(void) if (COM_Argc() > 1) { - // P_GivePlayerRings does value clamping - players[consoleplayer].health = players[consoleplayer].mo->health = 1; - P_GivePlayerRings(&players[consoleplayer], atoi(COM_Argv(1))); - if (!G_IsSpecialStage(gamemap) || !useNightsSS) + if (!(maptol & TOL_NIGHTS)) + { + // P_GivePlayerRings does value clamping + players[consoleplayer].rings = 0; + P_GivePlayerRings(&players[consoleplayer], atoi(COM_Argv(1))); players[consoleplayer].totalring -= atoi(COM_Argv(1)); //undo totalring addition done in P_GivePlayerRings + } + else + { + players[consoleplayer].spheres = 0; + P_GivePlayerSpheres(&players[consoleplayer], atoi(COM_Argv(1))); + // no totalsphere addition to revert + } G_SetGameModified(multiplayer); } @@ -738,9 +907,15 @@ void Command_Setlives_f(void) if (COM_Argc() > 1) { - // P_GivePlayerLives does value clamping - players[consoleplayer].lives = 0; - P_GivePlayerLives(&players[consoleplayer], atoi(COM_Argv(1))); + SINT8 lives = atoi(COM_Argv(1)); + if (lives == -1) + players[consoleplayer].lives = INFLIVES; // infinity! + else + { + // P_GivePlayerLives does value clamping + players[consoleplayer].lives = 0; + P_GivePlayerLives(&players[consoleplayer], atoi(COM_Argv(1))); + } G_SetGameModified(multiplayer); } @@ -773,10 +948,12 @@ void Command_Setcontinues_f(void) static CV_PossibleValue_t op_mapthing_t[] = {{0, "MIN"}, {4095, "MAX"}, {0, NULL}}; static CV_PossibleValue_t op_speed_t[] = {{1, "MIN"}, {128, "MAX"}, {0, NULL}}; static CV_PossibleValue_t op_flags_t[] = {{0, "MIN"}, {15, "MAX"}, {0, NULL}}; +static CV_PossibleValue_t op_hoopflags_t[] = {{0, "MIN"}, {15, "MAX"}, {0, NULL}}; consvar_t cv_mapthingnum = {"op_mapthingnum", "0", CV_NOTINNET, op_mapthing_t, NULL, 0, NULL, NULL, 0, 0, NULL}; consvar_t cv_speed = {"op_speed", "16", CV_NOTINNET, op_speed_t, NULL, 0, NULL, NULL, 0, 0, NULL}; consvar_t cv_opflags = {"op_flags", "0", CV_NOTINNET, op_flags_t, NULL, 0, NULL, NULL, 0, 0, NULL}; +consvar_t cv_ophoopflags = {"op_hoopflags", "4", CV_NOTINNET, op_hoopflags_t, NULL, 0, NULL, NULL, 0, 0, NULL}; boolean objectplacing = false; mobjtype_t op_currentthing = 0; // For the object placement mode @@ -942,7 +1119,7 @@ boolean OP_FreezeObjectplace(void) if (!objectplacing) return false; - if ((maptol & TOL_NIGHTS) && (players[consoleplayer].pflags & PF_NIGHTSMODE)) + if ((maptol & TOL_NIGHTS) && (players[consoleplayer].powers[pw_carry] == CR_NIGHTSMODE)) return false; return true; @@ -968,7 +1145,7 @@ void OP_NightsObjectplace(player_t *player) if (player->pflags & PF_ATTACKDOWN) { // Are ANY objectplace buttons pressed? If no, remove flag. - if (!(cmd->buttons & (BT_ATTACK|BT_TOSSFLAG|BT_USE|BT_CAMRIGHT|BT_CAMLEFT))) + if (!(cmd->buttons & (BT_ATTACK|BT_TOSSFLAG|BT_USE|BT_WEAPONNEXT|BT_WEAPONPREV))) player->pflags &= ~PF_ATTACKDOWN; // Do nothing. @@ -980,17 +1157,10 @@ void OP_NightsObjectplace(player_t *player) { UINT16 angle = (UINT16)(player->anotherflyangle % 360); INT16 temp = (INT16)FixedInt(AngleFixed(player->mo->angle)); // Traditional 2D Angle - sector_t *sec = player->mo->subsector->sector; -#ifdef ESLOPE - fixed_t fheight = sec->f_slope ? P_GetZAt(sec->f_slope, player->mo->x & 0xFFFF0000, player->mo->y & 0xFFFF0000) : sec->floorheight; -#else - fixed_t fheight = sec->floorheight; -#endif - player->pflags |= PF_ATTACKDOWN; - mt = OP_CreateNewMapThing(player, 1705, false); + mt = OP_CreateNewMapThing(player, 1713, false); // Tilt mt->angle = (INT16)FixedInt(FixedDiv(angle*FRACUNIT, 360*(FRACUNIT/256))); @@ -1001,43 +1171,84 @@ void OP_NightsObjectplace(player_t *player) temp += 90; temp %= 360; - mt->options = (UINT16)((player->mo->z - fheight)>>FRACBITS); + mt->options = (mt->options & ~(UINT16)cv_opflags.value) | (UINT16)cv_ophoopflags.value; mt->angle = (INT16)(mt->angle+(INT16)((FixedInt(FixedDiv(temp*FRACUNIT, 360*(FRACUNIT/256))))<<8)); - P_SpawnHoopsAndRings(mt); + P_SpawnHoopsAndRings(mt, false); } // This places a bumper! if (cmd->buttons & BT_TOSSFLAG) { + UINT16 vertangle = (UINT16)(player->anotherflyangle % 360); + UINT16 newflags, newz; + player->pflags |= PF_ATTACKDOWN; if (!OP_HeightOkay(player, false)) return; mt = OP_CreateNewMapThing(player, (UINT16)mobjinfo[MT_NIGHTSBUMPER].doomednum, false); + newz = min((mt->options >> ZSHIFT) - (mobjinfo[MT_NIGHTSBUMPER].height/4), 0); + // height offset: from P_TouchSpecialThing case MT_NIGHTSBUMPER + + // clockwise + if (vertangle >= 75 && vertangle < 105) // up + newflags = 3; + else if (vertangle >= 105 && vertangle < 135) // 60 upward tilt + newflags = 2; + else if (vertangle >= 135 && vertangle < 165) // 30 upward tilt + newflags = 1; + //else if (vertangle >= 165 && vertangle < 195) // forward, see else case + // newflags = 0; + else if (vertangle >= 195 && vertangle < 225) // 30 downward tilt + newflags = 11; + else if (vertangle >= 225 && vertangle < 255) // 60 downward tilt + newflags = 10; + else if (vertangle >= 255 && vertangle < 285) // down + newflags = 9; + else if (vertangle >= 285 && vertangle < 315) // 60 downward tilt backwards + newflags = 8; + else if (vertangle >= 315 && vertangle < 345) // 30 downward tilt backwards + newflags = 7; + else if (vertangle >= 345 || vertangle < 15) // backwards + newflags = 6; + else if (vertangle >= 15 && vertangle < 45) // 30 upward tilt backwards + newflags = 5; + else if (vertangle >= 45 && vertangle < 75) // 60 upward tilt backwards + newflags = 4; + else // forward + newflags = 0; + + mt->options = (newz << ZSHIFT) | newflags; + + // if NiGHTS is facing backwards, orient the Thing angle forwards so that the sprite angle + // displays correctly. Backwards movement via the Thing flags is unaffected. + if (vertangle < 90 || vertangle > 270) + mt->angle = (mt->angle + 180) % 360; + P_SpawnMapThing(mt); } + // This places a sphere! + if (cmd->buttons & BT_WEAPONNEXT) + { + player->pflags |= PF_ATTACKDOWN; + if (!OP_HeightOkay(player, false)) + return; + + mt = OP_CreateNewMapThing(player, (UINT16)mobjinfo[MT_BLUESPHERE].doomednum, false); + P_SpawnHoopsAndRings(mt, false); + } + // This places a ring! - if (cmd->buttons & BT_CAMRIGHT) + if (cmd->buttons & BT_WEAPONPREV) { player->pflags |= PF_ATTACKDOWN; if (!OP_HeightOkay(player, false)) return; mt = OP_CreateNewMapThing(player, (UINT16)mobjinfo[MT_RING].doomednum, false); - P_SpawnHoopsAndRings(mt); - } - - // This places a wing item! - if (cmd->buttons & BT_CAMLEFT) - { - player->pflags |= PF_ATTACKDOWN; - if (!OP_HeightOkay(player, false)) - return; - - mt = OP_CreateNewMapThing(player, (UINT16)mobjinfo[MT_NIGHTSWING].doomednum, false); - P_SpawnHoopsAndRings(mt); + P_SpawnHoopsAndRings(mt, false); } // This places a custom object as defined in the console cv_mapthingnum. @@ -1054,7 +1265,7 @@ void OP_NightsObjectplace(player_t *player) if (!OP_HeightOkay(player, false)) return; - if (player->mo->target->flags & MF_AMBUSH) + if (player->mo->target->flags2 & MF2_AMBUSH) angle = (UINT16)player->anotherflyangle; else { @@ -1071,12 +1282,12 @@ void OP_NightsObjectplace(player_t *player) if (mt->type == 300 // Ring || mt->type == 308 || mt->type == 309 // Team Rings - || mt->type == 1706 // Nights Wing + || mt->type == 1706 // Sphere || (mt->type >= 600 && mt->type <= 609) // Placement patterns || mt->type == 1705 || mt->type == 1713 // NiGHTS Hoops || mt->type == 1800) // Mario Coin { - P_SpawnHoopsAndRings(mt); + P_SpawnHoopsAndRings(mt, false); } else P_SpawnMapThing(mt); @@ -1093,7 +1304,7 @@ void OP_ObjectplaceMovement(player_t *player) ticcmd_t *cmd = &player->cmd; if (!player->climbing && (netgame || !cv_analog.value || (player->pflags & PF_SPINNING))) - player->mo->angle = (cmd->angleturn<<16 /* not FRACBITS */); + player->drawangle = player->mo->angle = (cmd->angleturn<<16 /* not FRACBITS */); ticruned++; if (!(cmd->angleturn & TICCMD_RECEIVED)) @@ -1129,7 +1340,7 @@ void OP_ObjectplaceMovement(player_t *player) // make sure viewz follows player if in 1st person mode player->deltaviewheight = 0; - player->viewheight = FixedMul(cv_viewheight.value << FRACBITS, player->mo->scale); + player->viewheight = FixedMul(41*player->height/48, player->mo->scale); if (player->mo->eflags & MFE_VERTICALFLIP) player->viewz = player->mo->z + player->mo->height - player->viewheight; else @@ -1165,19 +1376,20 @@ void OP_ObjectplaceMovement(player_t *player) if (player->pflags & PF_ATTACKDOWN) { // Are ANY objectplace buttons pressed? If no, remove flag. - if (!(cmd->buttons & (BT_ATTACK|BT_TOSSFLAG|BT_CAMRIGHT|BT_CAMLEFT))) + if (!(cmd->buttons & (BT_ATTACK|BT_TOSSFLAG|BT_WEAPONNEXT|BT_WEAPONPREV))) player->pflags &= ~PF_ATTACKDOWN; // Do nothing. return; } - if (cmd->buttons & BT_CAMLEFT) + if (cmd->buttons & BT_WEAPONPREV) { OP_CycleThings(-1); player->pflags |= PF_ATTACKDOWN; } - else if (cmd->buttons & BT_CAMRIGHT) + + if (cmd->buttons & BT_WEAPONNEXT) { OP_CycleThings(1); player->pflags |= PF_ATTACKDOWN; @@ -1220,7 +1432,7 @@ void OP_ObjectplaceMovement(player_t *player) || mt->type == 1705 || mt->type == 1713 // NiGHTS Hoops || mt->type == 1800) // Mario Coin { - P_SpawnHoopsAndRings(mt); + P_SpawnHoopsAndRings(mt, false); } else P_SpawnMapThing(mt); @@ -1254,20 +1466,20 @@ void Command_ObjectPlace_f(void) { objectplacing = true; - if ((players[0].pflags & PF_NIGHTSMODE)) + if (players[0].powers[pw_carry] == CR_NIGHTSMODE) return; if (!COM_CheckParm("-silent")) { - HU_SetCEchoFlags(V_RETURN8|V_MONOSPACE); + HU_SetCEchoFlags(V_RETURN8|V_MONOSPACE|V_AUTOFADEOUT); HU_SetCEchoDuration(10); HU_DoCEcho(va(M_GetText( "\\\\\\\\\\\\\\\\\\\\\\\\\x82" " Objectplace Controls: \x80\\\\" - "Camera L/R: Cycle mapthings\\" - " Jump: Float up \\" - " Spin: Float down \\" - " Fire Ring: Place object \\"))); + "Weapon Next/Prev: Cycle mapthings\\" + " Jump: Float up \\" + " Spin: Float down \\" + " Fire Ring: Place object \\"))); } // Save all the player's data. @@ -1297,7 +1509,7 @@ void Command_ObjectPlace_f(void) // Like the classics, recover from death by entering objectplace if (players[0].mo->health <= 0) { - players[0].mo->health = players[0].health = 1; + players[0].mo->health = 1; players[0].deadtimer = 0; op_oldflags1 = mobjinfo[MT_PLAYER].flags; ++players[0].lives; @@ -1325,7 +1537,7 @@ void Command_ObjectPlace_f(void) // Don't touch the NiGHTS Objectplace stuff. // ... or if the mo mysteriously vanished. - if (!players[0].mo || (players[0].pflags & PF_NIGHTSMODE)) + if (!players[0].mo || (players[0].powers[pw_carry] == CR_NIGHTSMODE)) return; // If still in dummy state, get out of it. diff --git a/src/m_cheat.h b/src/m_cheat.h index bb901af74..aa9b0bfeb 100644 --- a/src/m_cheat.h +++ b/src/m_cheat.h @@ -28,7 +28,7 @@ void cht_Init(void); void Command_ObjectPlace_f(void); void Command_Writethings_f(void); -extern consvar_t cv_opflags, cv_mapthingnum, cv_speed; +extern consvar_t cv_opflags, cv_ophoopflags, cv_mapthingnum, cv_speed; //extern consvar_t cv_snapto, cv_grid; extern boolean objectplacing; diff --git a/src/m_cond.c b/src/m_cond.c index 4c824b180..e03542bf3 100644 --- a/src/m_cond.c +++ b/src/m_cond.c @@ -28,652 +28,18 @@ UINT32 unlocktriggers; // The meat of this system lies in condition sets conditionset_t conditionSets[MAXCONDITIONSETS]; -// Default Emblem locations -emblem_t emblemlocations[MAXEMBLEMS] = -{ - // GREEN FLOWER 1 - // --- - {0, 8156, 6936, 129, 1, 'A', SKINCOLOR_BLUE, 0, - "Go get your feet wet\n" - "to find this, the first emblem.\n" - "Yes, it's very deep.", 0}, - {0, 3184, 1812, 928, 1, 'B', SKINCOLOR_LAVENDER, 0, - "There are many rings,\n" - "but this one's not what you think.\n" - "There lies the emblem.", 0}, - {0, 9024, 6716, 769, 1, 'C', SKINCOLOR_RED, 0, - "Right next to a lake,\n" - "a ledge has been constructed.\n" - "Near there is the goal.", 0}, - {0, 2080, -384, 512, 1, 'D', SKINCOLOR_ORANGE, 0, - "Streams come to an end\n" - "where they can no longer fall.\n" - "But if you went up...", 0}, - {0, -336, 2064, 195, 1, 'E', SKINCOLOR_NEONGREEN, 0, - "This one's in plain sight.\n" - "Why haven't you claimed it?\n" - "Surely you saw it.", 0}, +// Emblem locations +emblem_t emblemlocations[MAXEMBLEMS]; - {ET_SCORE, 0,0,0, 1, 'S', SKINCOLOR_BROWN, 125000, "", 0}, - {ET_TIME, 0,0,0, 1, 'T', SKINCOLOR_GREY, 20*TICRATE, "", 0}, - {ET_RINGS, 0,0,0, 1, 'R', SKINCOLOR_GOLD, 200, "", 0}, +// Extra emblems +extraemblem_t extraemblems[MAXEXTRAEMBLEMS]; +// Unlockables +unlockable_t unlockables[MAXUNLOCKABLES]; - // GREEN FLOWER 2 - // --- - {0, 2624, -6816, 1332, 2, 'A', SKINCOLOR_BLUE, 0, - "Near the giant lake\n" - "lies a cave with a 1-Up.\n" - "An emblem's there, too!", 0}, - {0, -5728, -2848, 2848, 2, 'B', SKINCOLOR_LAVENDER, 0, - "Near the final lake,\n" - "a higher lake falls on in.\n" - "Three platforms await.", 0}, - {0, 3648, 6464, 2576, 2, 'C', SKINCOLOR_RED, 0, - "Near the level's start,\n" - "a bridge crosses a river.\n" - "What's that river's source?", 0}, - {0, -2032,-10048, 986, 2, 'D', SKINCOLOR_ORANGE, 0, - "Near the level's end,\n" - "another bridge spans a lake.\n" - "What could be under...?", 0}, - {0, -170, 491, 3821, 2, 'E', SKINCOLOR_NEONGREEN, 0, - "An ivied tunnel\n" - "has a corner that's sunlit.\n" - "Go reach for the sky!", 0}, - - {ET_SCORE, 0,0,0, 2, 'S', SKINCOLOR_BROWN, 150000, "", 0}, - {ET_TIME, 0,0,0, 2, 'T', SKINCOLOR_GREY, 40*TICRATE, "", 0}, - {ET_RINGS, 0,0,0, 2, 'R', SKINCOLOR_GOLD, 200, "", 0}, - - - // GREEN FLOWER 3 - // --- - {ET_TIME, 0,0,0, 3, 'T', SKINCOLOR_GREY, 30*TICRATE, "", 0}, - - - // TECHNO HILL 1 - // --- - {0, -5664, -5072, 2396, 4, 'A', SKINCOLOR_BLUE, 0, - "Three pipes reside near\n" - "where our heroes' paths split off.\n" - "You'll have to look up!", 0}, - {0, -784,-13968, 2888, 4, 'B', SKINCOLOR_LAVENDER, 0, - "Climbing yields great range.\n" - "Yet, on a path for climbers,\n" - "flying is the key.", 0}, - {0, 4160, -5824, 3776, 4, 'C', SKINCOLOR_RED, 0, - "That's sure lots of slime.\n" - "Say, do you ever wonder\n" - "what's dumping it all?", 0}, - {0, 6400, -8352, 1764, 4, 'D', SKINCOLOR_ORANGE, 0, - "Spinning through small gaps\n" - "can slip you into a cave.\n" - "In that cave's first stretch...", 0}, - {0, 2848, -9088, 488, 4, 'E', SKINCOLOR_NEONGREEN, 0, - "The slime lake is deep,\n" - "but reaching the floor takes height.\n" - "Scream \"Geronimo!\"...", 0}, - - {ET_SCORE, 0,0,0, 4, 'S', SKINCOLOR_BROWN, 75000, "", 0}, - {ET_TIME, 0,0,0, 4, 'T', SKINCOLOR_GREY, 75*TICRATE, "", 0}, - {ET_RINGS, 0,0,0, 4, 'R', SKINCOLOR_GOLD, 300, "", 0}, - - - // TECHNO HILL 2 - // --- - {0,-19138, -2692, 688, 5, 'A', SKINCOLOR_BLUE, 0, - "Near the first checkpoint,\n" - "a bridge crosses a slime pool.\n" - "(Sensing a pattern?)", 0}, - {0,-13120, 8062, 1248, 5, 'B', SKINCOLOR_LAVENDER, 0, - "Behind the windows,\n" - "near crushers, ever smashing\n" - "a conveyor belt.", 0}, - {0, 580, 4552, 1344, 5, 'C', SKINCOLOR_RED, 0, - "A pipe drops onto\n" - "a half-outdoors conveyor.\n" - "But is it empty?", 0}, - {0, 192, -8768, 24, 5, 'D', SKINCOLOR_ORANGE, 0, - "There is a hallway\n" - "that a button floods with slime.\n" - "Go through it again!", 0}, - {0, -2468,-12128, 1312, 5, 'E', SKINCOLOR_NEONGREEN, 0, - "Jumping on turtles\n" - "will send you springing skyward.\n" - "Now, do that six times...", 0}, - - {ET_SCORE, 0,0,0, 5, 'S', SKINCOLOR_BROWN, 100000, "", 0}, - {ET_TIME, 0,0,0, 5, 'T', SKINCOLOR_GREY, 120*TICRATE, "", 0}, - {ET_RINGS, 0,0,0, 5, 'R', SKINCOLOR_GOLD, 600, "", 0}, - - - // TECHNO HILL 3 - // --- - {ET_TIME, 0,0,0, 6, 'T', SKINCOLOR_GREY, 40*TICRATE, "", 0}, - - - // DEEP SEA 1 - // --- - {0,-16224, -2880, 3530, 7, 'A', SKINCOLOR_BLUE, 0, - "Climb up two maze walls.\n" - "Break the roof, then a corner.\n" - "There, glide, but stay dry.", 0}, - {0, -8224, 896, 1056, 7, 'B', SKINCOLOR_LAVENDER, 0, - "Follow the left path.\n" - "A square green button lurks deep.\n" - "Weight it down, somehow.", 0}, - {0, 4992, -5072, 4136, 7, 'C', SKINCOLOR_RED, 0, - "A certain path holds\n" - "many gargoyle puzzles.\n" - "Victors reach a \"V\".", 0}, - {0, 4576, 5168, 2660, 7, 'D', SKINCOLOR_ORANGE, 0, - "A caved-in hallway?\n" - "The floor falls; the path goes down.\n" - "But those rocks looked weak...", 0}, - {0, 12576, 16096, -992, 7, 'E', SKINCOLOR_NEONGREEN, 0, - "The end is quite dry.\n" - "Some rocks dam the water in.\n" - "Knuckles can fix that...", 0}, - - {ET_SCORE, 0,0,0, 7, 'S', SKINCOLOR_BROWN, 75000, "", 0}, - {ET_TIME, 0,0,0, 7, 'T', SKINCOLOR_GREY, 120*TICRATE, "", 0}, - {ET_RINGS, 0,0,0, 7, 'R', SKINCOLOR_GOLD, 400, "", 0}, - - - // DEEP SEA 2 - // --- - {0,-15040, 6976, 2016, 8, 'A', SKINCOLOR_BLUE, 0, - "A waterfall lands\n" - "near a starpost in a cave.\n" - "It's dark up there, but...", 0}, - {0, 4288, 2912, 544, 8, 'B', SKINCOLOR_LAVENDER, 0, - "So many blocks here!\n" - "Take five; bathe in the fountain.\n" - "Hmmm? A hidden path...?", 0}, - {0, -5696, 16992, 791, 8, 'C', SKINCOLOR_RED, 0, - "An ornate dragon\n" - "faces a secret passage.\n" - "Knuckles! Don't get crushed!", 0}, - {0,-13344, 18688, 1034, 8, 'D', SKINCOLOR_ORANGE, 0, - "In the current maze\n" - "hides a dark room of columns.\n" - "Find it, then look up.", 0}, - {0, 3104, 16192, 2408, 8, 'E', SKINCOLOR_NEONGREEN, 0, - "That same dragon's eye\n" - "hides another secret room.\n" - "There, solve its riddle.", 0}, - - {ET_SCORE, 0,0,0, 8, 'S', SKINCOLOR_BROWN, 50000, "", 0}, - {ET_TIME, 0,0,0, 8, 'T', SKINCOLOR_GREY, 150*TICRATE, "", 0}, - {ET_RINGS, 0,0,0, 8, 'R', SKINCOLOR_GOLD, 250, "", 0}, - - - // DEEP SEA 3 - // --- - {ET_TIME, 0,0,0, 9, 'T', SKINCOLOR_GREY, 90*TICRATE, "", 0}, - - - // CASTLE EGGMAN 1 - // --- - {0, -6176, -5184, -128, 10, 'A', SKINCOLOR_BLUE, 0, - "A drain feeds the lake.\n" - "Water rushes quickly through.\n" - "Go against the flow.", 0}, - {0, 3648,-15296, -992, 10, 'B', SKINCOLOR_LAVENDER, 0, - "The left starting path\n" - "goes atop a large wood deck.\n" - "Checked underneath yet?", 0}, - {0, 11712, 21312, 5472, 10, 'C', SKINCOLOR_RED, 0, - "At last, the castle!\n" - "Hold up! Don't just barge right in!\n" - "What's the facade hold...?", 0}, - {0, 20224, 13344, 3104, 10, 'D', SKINCOLOR_ORANGE, 0, - "The final approach!\n" - "A tower holds the emblem\n" - "near a ring arrow.", 0}, - {0, 9472, -5890, 710, 10, 'E', SKINCOLOR_NEONGREEN, 0, - "The right starting path\n" - "hides this near a canopy,\n" - "high, where two trees meet.", 0}, - - {ET_SCORE, 0,0,0, 10, 'S', SKINCOLOR_BROWN, 50000, "", 0}, - {ET_TIME, 0,0,0, 10, 'T', SKINCOLOR_GREY, 120*TICRATE, "", 0}, - {ET_RINGS, 0,0,0, 10, 'R', SKINCOLOR_GOLD, 200, "", 0}, - - - // CASTLE EGGMAN 2 - // --- - {0, 832,-15168, 7808, 11, 'A', SKINCOLOR_BLUE, 0, - "Find a trick bookcase\n" - "that hides a darkened hallway.\n" - "There, climb a tower.", 0}, - {0,-18460,-22180, 2416, 11, 'B', SKINCOLOR_LAVENDER, 0, - "Down in the dungeon,\n" - "a cracked wall hides secret paths.\n" - "Echidnas only!", 0}, - {0, -6144,-11792, 3232, 11, 'C', SKINCOLOR_RED, 0, - "A room you can flood!\n" - "A brown grate's near its exit.\n" - "Knuckles can break it...", 0}, - {0, 4608, -7024, 4256, 11, 'D', SKINCOLOR_ORANGE, 0, - "Some of these bookshelves\n" - "are not flush against the walls.\n" - "Wonder why that is?", 0}, - {0, 12708,-13536, 4768, 11, 'E', SKINCOLOR_NEONGREEN, 0, - "The ending's towers\n" - "are hiding a small alcove.\n" - "Check around outside.", 0}, - - {ET_SCORE, 0,0,0, 11, 'S', SKINCOLOR_BROWN, 400000, "", 0}, - {ET_TIME, 0,0,0, 11, 'T', SKINCOLOR_GREY, 210*TICRATE, "", 0}, - {ET_RINGS, 0,0,0, 11, 'R', SKINCOLOR_GOLD, 600, "", 0}, - - - // CASTLE EGGMAN 3 - // --- - {ET_TIME, 0,0,0, 12, 'T', SKINCOLOR_GREY, 120*TICRATE, "", 0}, - - - // ARID CANYON 1 - // --- - {0, 3488, 2208, 3072, 13, 'A', SKINCOLOR_BLUE, 0, - "A rather large gap\n" - "must be crossed by way of tram.\n" - "At its end, jump left.", 0}, - {0, -7552, 10464, 4094, 13, 'B', SKINCOLOR_LAVENDER, 0, - "Crushers that go up!\n" - "Mind your step; if they're triggered,\n" - "they'll block this emblem.", 0}, - {0,-12093, 14575, 5752, 13, 'C', SKINCOLOR_RED, 0, - "There's an oil lake\n" - "that you can sink deep into.\n" - "Drain it, and explore.", 0}, - {0, 512, -7136, 4640, 13, 'D', SKINCOLOR_ORANGE, 0, - "Not far from the start,\n" - "if you climb toward the sky,\n" - "the cliffs hide something.", 0}, - {0, 12504, 6848, 3424, 13, 'E', SKINCOLOR_NEONGREEN, 0, - "Right by the exit,\n" - "an emblem lies on a cliff.\n" - "Ride ropes to reach it.", 0}, - - {ET_SCORE, 0,0,0, 13, 'S', SKINCOLOR_BROWN, 50000, "", 0}, - {ET_TIME, 0,0,0, 13, 'T', SKINCOLOR_GREY, 120*TICRATE, "", 0}, - {ET_RINGS, 0,0,0, 13, 'R', SKINCOLOR_GOLD, 300, "", 0}, - - - // RED VOLCANO 1 - // --- - {0,-13184, 11424, 3080, 16, 'A', SKINCOLOR_BLUE, 0, - "Look around the room,\n" - "just before you clear the stage;\n" - "something's hidden there!", 0}, - {0, -2816, 3120, 3044, 16, 'B', SKINCOLOR_LAVENDER, 0, - "Ever look upwards\n" - "when you're traversing across\n" - "collapsing platforms?", 0}, - {0, 6720, 6784, 1452, 16, 'C', SKINCOLOR_RED, 0, - "Check out a corner\n" - "of a lake of magma near\n" - "spinning jets of flame.", 0}, - {0, -5504, 9824, 800, 16, 'D', SKINCOLOR_ORANGE, 0, - "Where once a bridge stood,\n" - "now magma falls from above.\n" - "The bridge dropped something...", 0}, - {0, 8287,-11043, 1328, 16, 'E', SKINCOLOR_NEONGREEN, 0, - "A lake of magma\n" - "ebbs and flows unendingly.\n" - "Wait for its nadir.", 0}, - - {ET_SCORE, 0,0,0, 16, 'S', SKINCOLOR_BROWN, 30000, "", 0}, - {ET_TIME, 0,0,0, 16, 'T', SKINCOLOR_GREY, 120*TICRATE, "", 0}, - {ET_RINGS, 0,0,0, 16, 'R', SKINCOLOR_GOLD, 100, "", 0}, - - - // EGG ROCK 1 - // --- - {0,-10976, -7328, 1584, 22, 'A', SKINCOLOR_BLUE, 0, - "Vanishing platforms,\n" - "then collapsing ones herald\n" - "a last-second jump.", 0}, - {0, -6592,-11200, 2208, 22, 'B', SKINCOLOR_LAVENDER, 0, - "What is this red stuff?\n" - "You can't breathe it in, but look!\n" - "It can't reach up there...", 0}, - {0, 6816, 832, 936, 22, 'C', SKINCOLOR_RED, 0, - "The team's paths diverge.\n" - "Should Tails run the crusher path?\n" - "No! Fly outside it!", 0}, - {0, 6942, -8902, 2080, 22, 'D', SKINCOLOR_ORANGE, 0, - "Don't jump too high here!\n" - "No conveyor will catch you;\n" - "you'd fall to your death.", 0}, - {0, -6432, -6192, 584, 22, 'E', SKINCOLOR_NEONGREEN, 0, - "Conveyors! Magma!\n" - "What an intense room this is!\n" - "But, what brought you here?", 0}, - - {ET_SCORE, 0,0,0, 22, 'S', SKINCOLOR_BROWN, 25000, "", 0}, - {ET_TIME, 0,0,0, 22, 'T', SKINCOLOR_GREY, 120*TICRATE, "", 0}, - {ET_RINGS, 0,0,0, 22, 'R', SKINCOLOR_GOLD, 150, "", 0}, - - - // EGG ROCK 2 - // --- - {0, -6672, 7792, 352, 23, 'A', SKINCOLOR_BLUE, 0, - "Walk on the ceiling;\n" - "resist the urge to flip back!\n" - "Find the cyan path...", 0}, - {0,-12256, 15136, -288, 23, 'B', SKINCOLOR_LAVENDER, 0, - "X marks the spot? Nope!\n" - "Try standing further away\n" - "when the timer flips.", 0}, - {0, 1536, 16224, 1144, 23, 'C', SKINCOLOR_RED, 0, - "There is more than one\n" - "elevator inside the\n" - "elevator shaft...", 0}, - {0,-15968, 14192, 3152, 23, 'D', SKINCOLOR_ORANGE, 0, - "Gears with missing teeth\n" - "can hide a clever secret!\n" - "Think Green Hill Zone boss.", 0}, - {0, 1920, 20608, 1064, 23, 'E', SKINCOLOR_NEONGREEN, 0, - "Just before you reach\n" - "the defective cargo bay,\n" - "fly under a bridge.", 0}, - - {ET_SCORE, 0,0,0, 23, 'S', SKINCOLOR_BROWN, 60000, "", 0}, - {ET_TIME, 0,0,0, 23, 'T', SKINCOLOR_GREY, 300*TICRATE, "", 0}, - {ET_RINGS, 0,0,0, 23, 'R', SKINCOLOR_GOLD, 250, "", 0}, - - - // EGG ROCK 3 - // --- -/* Just in case, I'll leave these here in the source. - {0, 848, -3584, 592, 24, 'A', SKINCOLOR_BLUE, 0, - "[PH] Hiding at the end of the first hallway.", 0}, - {0,-10368, -2816, 144, 24, 'B', SKINCOLOR_LAVENDER, 0, - "Directions are meaningless.", 0}, - {0, -8160, -5952, 560, 24, 'C', SKINCOLOR_RED, 0, - "[PH] In the ceiling of the conveyor belt + laser hallway.", 0}, - {0,-13728,-13728, 1552, 24, 'D', SKINCOLOR_ORANGE, 0, - "[PH] On top of the platform with rows of spikes in reverse gravity.", 0}, - {0,-14944, 768, 1232, 24, 'E', SKINCOLOR_NEONGREEN, 0, - "Follow the leader.", 0}, -*/ - - {ET_SCORE, 0,0,0, 24, 'S', SKINCOLOR_BROWN, 14000, "", 0}, - {ET_TIME, 0,0,0, 24, 'T', SKINCOLOR_GREY, 210*TICRATE, "", 0}, - {ET_RINGS, 0,0,0, 24, 'R', SKINCOLOR_GOLD, 100, "", 0}, - - - // EGG ROCK CORE - // --- - {ET_TIME, 0,0,0, 25, 'T', SKINCOLOR_GREY, 100*TICRATE, "", 0}, - - - // PIPE TOWERS - // --- - {0, 3182, 5040, 3008, 30, 'A', SKINCOLOR_BLUE, 0, - "A pipe in the roof\n" - "eternally drops water.\n" - "Something's stuck up there.", 0}, - {0, -2400, 5984, 2752, 30, 'B', SKINCOLOR_LAVENDER, 0, - "Pushing a red switch\n" - "raises the water level;\n" - "from there, can't miss it.", 0}, - {0, 6112, 7008, 4032, 30, 'C', SKINCOLOR_RED, 0, - "A high-up passage\n" - "hides near the second checkpoint.\n" - "Climb in; then, climb more.", 0}, - {0, 11424, -4832, 1376, 30, 'D', SKINCOLOR_ORANGE, 0, - "The underground room\n" - "with platforms that fall and rise\n" - "only LOOKS empty...", 0}, - {0 , 4960, -6112, 1312, 30, 'E', SKINCOLOR_NEONGREEN, 0, - "This one's straightforward.\n" - "What comes to mind when I say:\n" - "\"WELCOME TO WARP ZONE!\"?", 0}, - - {ET_SCORE, 0,0,0, 30, 'S', SKINCOLOR_BROWN, 75000, "", 0}, - {ET_TIME, 0,0,0, 30, 'T', SKINCOLOR_GREY, 100*TICRATE, "", 0}, - {ET_RINGS, 0,0,0, 30, 'R', SKINCOLOR_GOLD, 300, "", 0}, - - - // AERIAL GARDEN - // --- - {0, 10176,-14304, 1796, 40, 'A', SKINCOLOR_BLUE, 0, - "A central tower,\n" - "one with many waterfalls,\n" - "hides a secret room.", 0}, - {0, 480, 17696, 6496, 40, 'B', SKINCOLOR_LAVENDER, 0, - "Hidden off the path\n" - "lies a skyscraping tower.\n" - "A lake's at the top.", 0}, - {0, -8896, 13248, 3362, 40, 'C', SKINCOLOR_RED, 0, - "Find all four buttons\n" - "that sink when you stand on them.\n" - "They'll open a door...", 0}, - {0, -8896, -9952, 2480, 40, 'D', SKINCOLOR_ORANGE, 0, - "Much like the last one,\n" - "you need to find some switches.\n" - "Only two, this time.", 0}, - {0, 13184, 18880, 6672, 40, 'E', SKINCOLOR_NEONGREEN, 0, - "The inner sanctum!\n" - "Teleport to its switches;\n" - "then, check near the goal.", 0}, - - {ET_SCORE, 0,0,0, 40, 'S', SKINCOLOR_BROWN, 300000, "", 0}, - {ET_TIME, 0,0,0, 40, 'T', SKINCOLOR_GREY, 240*TICRATE, "", 0}, - {ET_RINGS, 0,0,0, 40, 'R', SKINCOLOR_GOLD, 1200, "", 0}, - - - // AZURE TEMPLE - // --- - {0, -2400, 7552, 1120, 41, 'A', SKINCOLOR_BLUE, 0, - "For those who can swim,\n" - "a long tunnel hides rewards.\n" - "Do mind the Buzzes!", 0}, - {0, -64, 14016, 2072, 41, 'B', SKINCOLOR_LAVENDER, 0, - "So many skylights!\n" - "A markedly large one hides\n" - "behind a starpost...", 0}, - {0, 2976, 13920, -32, 41, 'C', SKINCOLOR_RED, 0, - "When you reach gauntlets\n" - "of diagonal fire,\n" - "check out the corners.", 0}, - {0, 2176, 22592, 1376, 41, 'D', SKINCOLOR_ORANGE, 0, - "A room of currents;\n" - "most of them are marked by spikes.\n" - "This one? A corner.", 0}, - {0, -4128, 21344, 1120, 41, 'E', SKINCOLOR_NEONGREEN, 0, - "The only way to hit\n" - "all those gems at once is with\n" - "a radial blast.", 0}, - - {ET_SCORE, 0,0,0, 41, 'S', SKINCOLOR_BROWN, 425000, "", 0}, - {ET_TIME, 0,0,0, 41, 'T', SKINCOLOR_GREY, 240*TICRATE, "", 0}, - {ET_RINGS, 0,0,0, 41, 'R', SKINCOLOR_GOLD, 300, "", 0}, - - - // FLORAL FIELD - // --- - {0, 5394, -996, 160, 50, 'N', SKINCOLOR_ROSEWOOD, 0, "", 0}, - {ET_NGRADE, 0,0,0, 50, 'Q', SKINCOLOR_TEAL, GRADE_A, "", 0}, - {ET_NTIME, 0,0,0, 50, 'T', SKINCOLOR_GREY, 40*TICRATE, "", 0}, - - - // TOXIC PLATEAU - // --- - {0, 780, -1664, 32, 51, 'N', SKINCOLOR_ROSEWOOD, 0, "", 0}, - {ET_NGRADE, 0,0,0, 51, 'Q', SKINCOLOR_TEAL, GRADE_A, "", 0}, - {ET_NTIME, 0,0,0, 51, 'T', SKINCOLOR_GREY, 50*TICRATE, "", 0}, - - - // FLOODED COVE - // --- - {0, 1824, -1888, 2448, 52, 'N', SKINCOLOR_ROSEWOOD, 0, "", 0}, - {ET_NGRADE, 0,0,0, 52, 'Q', SKINCOLOR_TEAL, GRADE_A, "", 0}, - {ET_NTIME, 0,0,0, 52, 'T', SKINCOLOR_GREY, 90*TICRATE, "", 0}, - - - // CAVERN FORTRESS - // --- - {0, -3089, -431, 1328, 53, 'N', SKINCOLOR_ROSEWOOD, 0, "", 0}, - {ET_NGRADE, 0,0,0, 53, 'Q', SKINCOLOR_TEAL, GRADE_A, "", 0}, - {ET_NTIME, 0,0,0, 53, 'T', SKINCOLOR_GREY, 75*TICRATE, "", 0}, - - - // DUSTY WASTELAND - // --- - {0, 957, 924, 2956, 54, 'N', SKINCOLOR_ROSEWOOD, 0, "", 0}, - {ET_NGRADE, 0,0,0, 54, 'Q', SKINCOLOR_TEAL, GRADE_A, "", 0}, - {ET_NTIME, 0,0,0, 54, 'T', SKINCOLOR_GREY, 65*TICRATE, "", 0}, - - - // MAGMA CAVES - // --- - {0, -2752, 3104, 1800, 55, 'N', SKINCOLOR_ROSEWOOD, 0, "", 0}, - {ET_NGRADE, 0,0,0, 55, 'Q', SKINCOLOR_TEAL, GRADE_A, "", 0}, - {ET_NTIME, 0,0,0, 55, 'T', SKINCOLOR_GREY, 80*TICRATE, "", 0}, - - - // EGG SATELLITE - // --- - {0, 5334, -609, 3426, 56, 'N', SKINCOLOR_ROSEWOOD, 0, "", 0}, - {ET_NGRADE, 0,0,0, 56, 'Q', SKINCOLOR_TEAL, GRADE_A, "", 0}, - {ET_NTIME, 0,0,0, 56, 'T', SKINCOLOR_GREY, 120*TICRATE, "", 0}, - - - // BLACK HOLE - // --- - {0, 2108, 3776, 32, 57, 'N', SKINCOLOR_ROSEWOOD, 0, "", 0}, - {ET_NGRADE, 0,0,0, 57, 'Q', SKINCOLOR_TEAL, GRADE_A, "", 0}, - {ET_NTIME, 0,0,0, 57, 'T', SKINCOLOR_GREY, 150*TICRATE, "", 0}, - - - // SPRING HILL - // --- - {0, -1840, -1024, 1644, 58, 'N', SKINCOLOR_ROSEWOOD, 0, "", 0}, - {ET_NGRADE, 0,0,0, 58, 'Q', SKINCOLOR_TEAL, GRADE_A, "", 0}, - {ET_NTIME, 0,0,0, 58, 'T', SKINCOLOR_GREY, 60*TICRATE, "", 0}, -}; - -// Default Extra Emblems -extraemblem_t extraemblems[MAXEXTRAEMBLEMS] = -{ - {"Game Complete", "Complete 1P Mode", 10, 'X', SKINCOLOR_BLUE, 0}, - {"All Emeralds", "Complete 1P Mode with all Emeralds", 11, 'V', SKINCOLOR_GREY, 0}, - {"Perfect Bonus", "Perfect Bonus on a non-secret stage", 30, 'P', SKINCOLOR_GOLD, 0}, - {"SRB1 Remake", "Complete SRB1 Remake", 21, 'O', SKINCOLOR_ROSEWOOD, 0}, - {"NiGHTS Mastery", "Show your mastery of NiGHTS!", 22, 'W', SKINCOLOR_TEAL, 0}, -}; - -// Default Unlockables -unlockable_t unlockables[MAXUNLOCKABLES] = -{ - // Name, Objective, Menu Height, ConditionSet, Unlock Type, Variable, NoCecho, NoChecklist - /* 01 */ {"Record Attack", "Complete Greenflower Zone, Act 1", 0, 1, SECRET_RECORDATTACK, 0, true, true, 0}, - /* 02 */ {"NiGHTS Mode", "Complete Floral Field", 0, 2, SECRET_NIGHTSMODE, 0, true, true, 0}, - - /* 03 */ {"Play Credits", "Complete 1P Mode", 30, 10, SECRET_CREDITS, 0, true, true, 0}, - /* 04 */ {"Sound Test", "Complete 1P Mode", 40, 10, SECRET_SOUNDTEST, 0, false, false, 0}, - - /* 05 */ {"EXTRA LEVELS", "", 60, 0, SECRET_HEADER, 0, true, true, 0}, - - /* 06 */ {"Aerial Garden Zone", "Complete 1P Mode w/ all emeralds", 70, 11, SECRET_WARP, 40, false, false, 0}, - /* 07 */ {"Azure Temple Zone", "Complete Aerial Garden Zone", 80, 20, SECRET_WARP, 41, false, false, 0}, - - /* 08 */ {"BONUS LEVELS", "", 100, 0, SECRET_HEADER, 0, true, true, 0}, - - /* 09 */ {"SRB1 Remake", "Collect 20 Emblems", 130, 40, SECRET_WARP, 101, false, false, 0}, - /* 10 */ {"Mario Koopa Blast", "Collect 60 Emblems", 110, 42, SECRET_WARP, 30, false, false, 0}, - /* 11 */ {"SRB1 Level Select", "Complete SRB1 Remake", 140, 21, SECRET_LEVELSELECT, 2, false, true, 0}, - - /* 12 */ {"Spring Hill Zone", "Collect 100 Emblems", 0, 44, SECRET_NONE, 0, false, false, 0}, - /* 13 */ {"Black Hole", "A Rank in all Special Stages", 0, 50, SECRET_NONE, 0, false, true, 0}, - - /* 14 */ {"Emblem Hints", "Collect 40 Emblems", 0, 41, SECRET_EMBLEMHINTS, 0, false, true, 0}, - /* 15 */ {"Emblem Radar", "Collect 80 Emblems", 0, 43, SECRET_ITEMFINDER, 0, false, true, 0}, - - /* 16 */ {"Pandora's Box", "Collect All Emblems", 0, 45, SECRET_PANDORA, 0, false, false, 0}, - /* 17 */ {"Level Select", "Collect All Emblems", 20, 45, SECRET_LEVELSELECT, 1, false, true, 0}, -}; - -// Default number of emblems and extra emblems -INT32 numemblems = 155; -INT32 numextraemblems = 5; - -// DEFAULT CONDITION SETS FOR SRB2 2.1: -void M_SetupDefaultConditionSets(void) -{ - memset(conditionSets, 0, sizeof(conditionSets)); - - // -- 1: Complete GFZ1 - M_AddRawCondition(1, 1, UC_MAPBEATEN, 1, 0, 0); - - // -- 2: Complete SS1 - M_AddRawCondition(2, 1, UC_MAPBEATEN, 50, 0, 0); - - // -- 10: Complete the game - M_AddRawCondition(10, 1, UC_GAMECLEAR, 1, 0, 0); - - // -- 11: Complete the game with all emeralds - M_AddRawCondition(11, 1, UC_ALLEMERALDS, 1, 0, 0); - - // -- 20: Beat AGZ - M_AddRawCondition(20, 1, UC_MAPBEATEN, 40, 0, 0); - - // -- 21: Beat SRB1 Remake - M_AddRawCondition(21, 1, UC_MAPBEATEN, 132, 0, 0); - - // -- 22: Beat Black Hole - M_AddRawCondition(22, 1, UC_MAPBEATEN, 57, 0, 0); - - // -- 30: Perfect Bonus - M_AddRawCondition(30, 1, UC_MAPPERFECT, 1, 0, 0); - M_AddRawCondition(30, 2, UC_MAPPERFECT, 2, 0, 0); - M_AddRawCondition(30, 3, UC_MAPPERFECT, 4, 0, 0); - M_AddRawCondition(30, 4, UC_MAPPERFECT, 5, 0, 0); - M_AddRawCondition(30, 5, UC_MAPPERFECT, 7, 0, 0); - M_AddRawCondition(30, 6, UC_MAPPERFECT, 8, 0, 0); - M_AddRawCondition(30, 7, UC_MAPPERFECT, 10, 0, 0); - M_AddRawCondition(30, 8, UC_MAPPERFECT, 11, 0, 0); - M_AddRawCondition(30, 9, UC_MAPPERFECT, 13, 0, 0); - M_AddRawCondition(30, 10, UC_MAPPERFECT, 16, 0, 0); - M_AddRawCondition(30, 11, UC_MAPPERFECT, 22, 0, 0); - M_AddRawCondition(30, 12, UC_MAPPERFECT, 23, 0, 0); - M_AddRawCondition(30, 13, UC_MAPPERFECT, 24, 0, 0); - M_AddRawCondition(30, 14, UC_MAPPERFECT, 40, 0, 0); - M_AddRawCondition(30, 15, UC_MAPPERFECT, 41, 0, 0); - - // -- 40: Find 20 emblems - M_AddRawCondition(40, 1, UC_TOTALEMBLEMS, 20, 0, 0); - - // -- 41: Find 40 emblems - M_AddRawCondition(41, 1, UC_TOTALEMBLEMS, 40, 0, 0); - - // -- 42: Find 60 emblems - M_AddRawCondition(42, 1, UC_TOTALEMBLEMS, 60, 0, 0); - - // -- 43: Find 80 emblems - M_AddRawCondition(43, 1, UC_TOTALEMBLEMS, 80, 0, 0); - - // -- 44: Find 100 emblems - M_AddRawCondition(44, 1, UC_TOTALEMBLEMS, 100, 0, 0); - - // -- 45: Find 160 (all) emblems - M_AddRawCondition(45, 1, UC_TOTALEMBLEMS, 160, 0, 0); - - // -- 50: A rank all NiGHTS special stages - M_AddRawCondition(50, 1, UC_NIGHTSGRADE, GRADE_A, 50, 0); - M_AddRawCondition(50, 1, UC_NIGHTSGRADE, GRADE_A, 51, 0); - M_AddRawCondition(50, 1, UC_NIGHTSGRADE, GRADE_A, 52, 0); - M_AddRawCondition(50, 1, UC_NIGHTSGRADE, GRADE_A, 53, 0); - M_AddRawCondition(50, 1, UC_NIGHTSGRADE, GRADE_A, 54, 0); - M_AddRawCondition(50, 1, UC_NIGHTSGRADE, GRADE_A, 55, 0); - M_AddRawCondition(50, 1, UC_NIGHTSGRADE, GRADE_A, 56, 0); -} +// Number of emblems and extra emblems +INT32 numemblems = 0; +INT32 numextraemblems = 0; void M_AddRawCondition(UINT8 set, UINT8 id, conditiontype_t c, INT32 r, INT16 x1, INT16 x2) { @@ -932,7 +298,7 @@ UINT8 M_CheckLevelEmblems(void) // Update Score, Time, Rings emblems for (i = 0; i < numemblems; ++i) { - if (emblemlocations[i].type <= ET_SKIN || emblemlocations[i].collected) + if (emblemlocations[i].type <= ET_SKIN || emblemlocations[i].type == ET_MAP || emblemlocations[i].collected) continue; levelnum = emblemlocations[i].level; @@ -966,6 +332,42 @@ UINT8 M_CheckLevelEmblems(void) return somethingUnlocked; } +UINT8 M_CompletionEmblems(void) // Bah! Duplication sucks, but it's for a separate print when awarding emblems and it's sorta different enough. +{ + INT32 i; + INT32 embtype; + INT16 levelnum; + UINT8 res; + UINT8 somethingUnlocked = 0; + UINT8 flags; + + for (i = 0; i < numemblems; ++i) + { + if (emblemlocations[i].type != ET_MAP || emblemlocations[i].collected) + continue; + + levelnum = emblemlocations[i].level; + embtype = emblemlocations[i].var; + flags = MV_BEATEN; + + if (embtype & ME_ALLEMERALDS) + flags |= MV_ALLEMERALDS; + + if (embtype & ME_ULTIMATE) + flags |= MV_ULTIMATE; + + if (embtype & ME_PERFECT) + flags |= MV_PERFECT; + + res = ((mapvisited[levelnum - 1] & flags) == flags); + + emblemlocations[i].collected = res; + if (res) + ++somethingUnlocked; + } + return somethingUnlocked; +} + // ------------------- // Quick unlock checks // ------------------- diff --git a/src/m_cond.h b/src/m_cond.h index 351704064..f82e49372 100644 --- a/src/m_cond.h +++ b/src/m_cond.h @@ -66,20 +66,28 @@ typedef struct } conditionset_t; // Emblem information -#define ET_GLOBAL 0 // Global map emblem, var == color -#define ET_SKIN 1 // Skin specific emblem, var == skin -#define ET_SCORE 2 -#define ET_TIME 3 -#define ET_RINGS 4 -#define ET_NGRADE 5 -#define ET_NTIME 6 +#define ET_GLOBAL 0 // Emblem with a position in space +#define ET_SKIN 1 // Skin specific emblem with a position in space, var == skin +#define ET_MAP 2 // Beat the map +#define ET_SCORE 3 // Get the score +#define ET_TIME 4 // Get the time +#define ET_RINGS 5 // Get the rings +#define ET_NGRADE 6 // Get the grade +#define ET_NTIME 7 // Get the time (NiGHTS mode) + +// Global emblem flags +#define GE_NIGHTSPULL 1 // sun off the nights track - loop it +#define GE_NIGHTSITEM 2 // moon on the nights track - find it + +// Map emblem flags +#define ME_ALLEMERALDS 1 +#define ME_ULTIMATE 2 +#define ME_PERFECT 4 typedef struct { UINT8 type; ///< Emblem type - INT16 x; ///< X coordinate. - INT16 y; ///< Y coordinate. - INT16 z; ///< Z coordinate. + INT16 tag; ///< Tag of emblem mapthing INT16 level; ///< Level on which this emblem can be found. UINT8 sprite; ///< emblem sprite to use, 0 - 25 UINT8 color; ///< skincolor to use @@ -140,8 +148,7 @@ extern INT32 numextraemblems; extern UINT32 unlocktriggers; -// Condition Set Setup -void M_SetupDefaultConditionSets(void); +// Condition set setup void M_AddRawCondition(UINT8 set, UINT8 id, conditiontype_t c, INT32 r, INT16 x1, INT16 x2); // Clearing secrets @@ -153,6 +160,7 @@ void M_CheckUnlockConditions(void); UINT8 M_UpdateUnlockablesAndExtraEmblems(void); void M_SilentUpdateUnlockablesAndEmblems(void); UINT8 M_CheckLevelEmblems(void); +UINT8 M_CompletionEmblems(void); // Checking unlockable status UINT8 M_AnySecretUnlocked(void); diff --git a/src/m_fixed.h b/src/m_fixed.h index 8145a6917..370633c1f 100644 --- a/src/m_fixed.h +++ b/src/m_fixed.h @@ -20,11 +20,6 @@ #include #endif -// Was this just for the #define USEASM? -//#ifdef _WIN32_WCE -//#include "sdl12/SRB2CE/cehelp.h" -//#endif - /*! \brief bits of the fraction */ diff --git a/src/m_menu.c b/src/m_menu.c index a833ace21..cebdd1bbd 100644 --- a/src/m_menu.c +++ b/src/m_menu.c @@ -56,6 +56,7 @@ #include "byteptr.h" #include "st_stuff.h" #include "i_sound.h" +#include "fastcmp.h" #include "i_joy.h" // for joystick menu controls @@ -71,13 +72,17 @@ int snprintf(char *str, size_t n, const char *fmt, ...); //int vsnprintf(char *str, size_t n, const char *fmt, va_list ap); #endif +#if defined (__GNUC__) && (__GNUC__ >= 4) +#define FIXUPO0 +#endif + #define SKULLXOFF -32 #define LINEHEIGHT 16 #define STRINGHEIGHT 8 #define FONTBHEIGHT 20 #define SMALLLINEHEIGHT 8 -#define SLIDER_RANGE 10 -#define SLIDER_WIDTH (8*SLIDER_RANGE+6) +#define SLIDER_RANGE 9 +#define SLIDER_WIDTH 78 #define SERVERS_PER_PAGE 11 typedef enum @@ -113,7 +118,7 @@ const char *quitmsg[NUM_QUITMESSAGES]; // Stuff for customizing the player select screen Tails 09-22-2003 description_t description[MAXSKINS]; - +INT16 char_on = -1, startchar = 1; static char *char_notes = NULL; static fixed_t char_scroll = 0; @@ -136,7 +141,9 @@ static char joystickInfo[8][29]; static UINT32 serverlistpage; #endif -static saveinfo_t savegameinfo[MAXSAVEGAMES]; // Extra info about the save games. +static UINT8 numsaves = 0; +static saveinfo_t* savegameinfo = NULL; // Extra info about the save games. +static patch_t *savselp[7]; INT16 startmap; // Mario, NiGHTS, or just a plain old normal game? @@ -157,6 +164,7 @@ static INT32 vidm_column_size; // PROTOTYPES // +static void M_GoBack(INT32 choice); static void M_StopMessage(INT32 choice); #ifndef NONET @@ -174,21 +182,43 @@ menu_t MessageDef; menu_t SPauseDef; +// Level Select +static levelselect_t levelselect = {0, NULL}; +static UINT8 levelselectselect[3]; +static patch_t *levselp[2][3]; +static INT32 lsoffs[2]; + +#define lsrow levelselectselect[0] +#define lscol levelselectselect[1] +#define lshli levelselectselect[2] + +#define lshseperation 101 +#define lsbasevseperation (62*vid.height)/(BASEVIDHEIGHT*vid.dupy) //62 #define lsheadingheight 16 +#define getheadingoffset(row) (levelselect.rows[row].header[0] ? lsheadingheight : 0) +#define lsvseperation(row) lsbasevseperation + getheadingoffset(row) +#define lswide(row) levelselect.rows[row].mapavailable[3] + +#define lsbasex 19 +#define lsbasey 59+lsheadingheight // Sky Room static void M_CustomLevelSelect(INT32 choice); static void M_CustomWarp(INT32 choice); FUNCNORETURN static ATTRNORETURN void M_UltimateCheat(INT32 choice); static void M_LoadGameLevelSelect(INT32 choice); +static void M_AllowSuper(INT32 choice); static void M_GetAllEmeralds(INT32 choice); static void M_DestroyRobots(INT32 choice); static void M_LevelSelectWarp(INT32 choice); static void M_Credits(INT32 choice); static void M_PandorasBox(INT32 choice); static void M_EmblemHints(INT32 choice); +static void M_HandleChecklist(INT32 choice); menu_t SR_MainDef, SR_UnlockChecklistDef; +static UINT8 check_on; + // Misc. Main Menu static void M_SinglePlayerMenu(INT32 choice); static void M_Options(INT32 choice); @@ -204,46 +234,48 @@ static void M_ConfirmTeamChange(INT32 choice); static void M_SecretsMenu(INT32 choice); static void M_SetupChoosePlayer(INT32 choice); static void M_QuitSRB2(INT32 choice); -menu_t SP_MainDef, MP_MainDef, OP_MainDef; +menu_t SP_MainDef, OP_MainDef; menu_t MISC_ScrambleTeamDef, MISC_ChangeTeamDef; // Single Player +static void M_StartTutorial(INT32 choice); static void M_LoadGame(INT32 choice); +static void M_TimeAttackLevelSelect(INT32 choice); static void M_TimeAttack(INT32 choice); +static void M_NightsAttackLevelSelect(INT32 choice); static void M_NightsAttack(INT32 choice); static void M_Statistics(INT32 choice); static void M_ReplayTimeAttack(INT32 choice); static void M_ChooseTimeAttack(INT32 choice); static void M_ChooseNightsAttack(INT32 choice); -static void M_ModeAttackRetry(INT32 choice); static void M_ModeAttackEndGame(INT32 choice); static void M_SetGuestReplay(INT32 choice); +static void M_HandleChoosePlayerMenu(INT32 choice); static void M_ChoosePlayer(INT32 choice); -menu_t SP_GameStatsDef, SP_LevelStatsDef; +menu_t SP_LevelStatsDef; static menu_t SP_TimeAttackDef, SP_ReplayDef, SP_GuestReplayDef, SP_GhostDef; static menu_t SP_NightsAttackDef, SP_NightsReplayDef, SP_NightsGuestReplayDef, SP_NightsGhostDef; // Multiplayer +static void M_SetupMultiPlayer(INT32 choice); +static void M_SetupMultiPlayer2(INT32 choice); +static void M_StartSplitServerMenu(INT32 choice); +static void M_StartServer(INT32 choice); +static void M_ServerOptions(INT32 choice); #ifndef NONET static void M_StartServerMenu(INT32 choice); static void M_ConnectMenu(INT32 choice); -static void M_ConnectIPMenu(INT32 choice); -#endif -static void M_StartSplitServerMenu(INT32 choice); -static void M_StartServer(INT32 choice); -#ifndef NONET static void M_Refresh(INT32 choice); static void M_Connect(INT32 choice); static void M_ChooseRoom(INT32 choice); +menu_t MP_MainDef; #endif -static void M_SetupMultiPlayer(INT32 choice); -static void M_SetupMultiPlayer2(INT32 choice); // Options // Split into multiple parts due to size // Controls -menu_t OP_ControlsDef, OP_ControlListDef, OP_MoveControlsDef; -menu_t OP_MPControlsDef, OP_MiscControlsDef; +menu_t OP_ChangeControlsDef; +menu_t OP_MPControlsDef, OP_CameraControlsDef, OP_MiscControlsDef; menu_t OP_P1ControlsDef, OP_P2ControlsDef, OP_MouseOptionsDef; menu_t OP_Mouse2OptionsDef, OP_Joystick1Def, OP_Joystick2Def; static void M_VideoModeMenu(INT32 choice); @@ -255,7 +287,7 @@ static void M_AssignJoystick(INT32 choice); static void M_ChangeControl(INT32 choice); // Video & Sound -menu_t OP_VideoOptionsDef, OP_VideoModeDef; +menu_t OP_VideoOptionsDef, OP_VideoModeDef, OP_ColorOptionsDef; #ifdef HWRENDER menu_t OP_OpenGLOptionsDef, OP_OpenGLFogDef, OP_OpenGLColorDef; #endif @@ -263,8 +295,7 @@ menu_t OP_SoundOptionsDef; //Misc menu_t OP_DataOptionsDef, OP_ScreenshotOptionsDef, OP_EraseDataDef; -menu_t OP_GameOptionsDef, OP_ChatOptionsDef, OP_ServerOptionsDef; -menu_t OP_NetgameOptionsDef, OP_GametypeOptionsDef; +menu_t OP_ServerOptionsDef; menu_t OP_MonitorToggleDef; static void M_ScreenshotOptions(INT32 choice); static void M_EraseData(INT32 choice); @@ -275,8 +306,11 @@ static patch_t *addonsp[NUM_EXT+5]; #define numaddonsshown 4 +static void M_DrawLevelPlatterHeader(INT32 y, const char *header, boolean headerhighlight, boolean allowlowercase); + // Drawing functions static void M_DrawGenericMenu(void); +static void M_DrawGenericScrollMenu(void); static void M_DrawCenteredMenu(void); static void M_DrawAddons(void); static void M_DrawSkyRoom(void); @@ -284,42 +318,43 @@ static void M_DrawChecklist(void); static void M_DrawEmblemHints(void); static void M_DrawPauseMenu(void); static void M_DrawServerMenu(void); -static void M_DrawLevelSelectMenu(void); +static void M_DrawLevelPlatterMenu(void); static void M_DrawImageDef(void); static void M_DrawLoad(void); static void M_DrawLevelStats(void); -static void M_DrawGameStats(void); static void M_DrawTimeAttackMenu(void); static void M_DrawNightsAttackMenu(void); static void M_DrawSetupChoosePlayerMenu(void); static void M_DrawControl(void); +static void M_DrawMainVideoMenu(void); static void M_DrawVideoMode(void); +static void M_DrawColorMenu(void); +static void M_DrawScreenshotMenu(void); static void M_DrawMonitorToggles(void); #ifdef HWRENDER static void M_OGL_DrawFogMenu(void); static void M_OGL_DrawColorMenu(void); #endif #ifndef NONET +static void M_DrawScreenshotMenu(void); static void M_DrawConnectMenu(void); -static void M_DrawConnectIPMenu(void); +static void M_DrawMPMainMenu(void); static void M_DrawRoomMenu(void); #endif static void M_DrawJoystick(void); static void M_DrawSetupMultiPlayerMenu(void); // Handling functions -#ifndef NONET -static boolean M_CancelConnect(void); -#endif static boolean M_ExitPandorasBox(void); static boolean M_QuitMultiPlayerMenu(void); static void M_HandleAddons(INT32 choice); +static void M_HandleLevelPlatter(INT32 choice); static void M_HandleSoundTest(INT32 choice); static void M_HandleImageDef(INT32 choice); static void M_HandleLoadSave(INT32 choice); -static void M_HandleGameStats(INT32 choice); static void M_HandleLevelStats(INT32 choice); #ifndef NONET +static boolean M_CancelConnect(void); static void M_HandleConnectIP(INT32 choice); #endif static void M_HandleSetupMultiPlayer(INT32 choice); @@ -328,8 +363,9 @@ static void M_HandleFogColor(INT32 choice); #endif static void M_HandleVideoMode(INT32 choice); +static void M_ResetCvars(void); + // Consvar onchange functions -static void Nextmap_OnChange(void); static void Newgametype_OnChange(void); static void Dummymares_OnChange(void); @@ -363,6 +399,9 @@ static CV_PossibleValue_t serversort_cons_t[] = { }; consvar_t cv_serversort = {"serversort", "Ping", CV_HIDEN | CV_CALL, serversort_cons_t, M_SortServerList, 0, NULL, NULL, 0, 0, NULL}; +// first time memory +consvar_t cv_tutorialprompt = {"tutorialprompt", "On", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL}; + // autorecord demos for time attack static consvar_t cv_autorecord = {"autorecord", "Yes", 0, CV_YesNo, NULL, 0, NULL, NULL, 0, 0, NULL}; @@ -381,7 +420,7 @@ consvar_t cv_ghost_guest = {"ghost_guest", "Show", CV_SAVE, ghost2_cons_ static CV_PossibleValue_t dummyteam_cons_t[] = {{0, "Spectator"}, {1, "Red"}, {2, "Blue"}, {0, NULL}}; static CV_PossibleValue_t dummyscramble_cons_t[] = {{0, "Random"}, {1, "Points"}, {0, NULL}}; static CV_PossibleValue_t ringlimit_cons_t[] = {{0, "MIN"}, {9999, "MAX"}, {0, NULL}}; -static CV_PossibleValue_t liveslimit_cons_t[] = {{0, "MIN"}, {99, "MAX"}, {0, NULL}}; +static CV_PossibleValue_t liveslimit_cons_t[] = {{-1, "MIN"}, {99, "MAX"}, {0, NULL}}; static CV_PossibleValue_t dummymares_cons_t[] = { {-1, "END"}, {0,"Overall"}, {1,"Mare 1"}, {2,"Mare 2"}, {3,"Mare 3"}, {4,"Mare 4"}, {5,"Mare 5"}, {6,"Mare 6"}, {7,"Mare 7"}, {8,"Mare 8"}, {0,NULL} }; @@ -407,12 +446,16 @@ static consvar_t cv_dummymares = {"dummymares", "Overall", CV_HIDEN|CV_CALL, dum // --------- static menuitem_t MainMenu[] = { - {IT_CALL |IT_STRING, NULL, "Secrets", M_SecretsMenu, 76}, - {IT_CALL |IT_STRING, NULL, "1 player", M_SinglePlayerMenu, 84}, - {IT_SUBMENU|IT_STRING, NULL, "multiplayer", &MP_MainDef, 92}, - {IT_CALL |IT_STRING, NULL, "options", M_Options, 100}, - {IT_CALL |IT_STRING, NULL, "Addons", M_Addons, 108}, - {IT_CALL |IT_STRING, NULL, "quit game", M_QuitSRB2, 116}, + {IT_STRING|IT_CALL, NULL, "Secrets", M_SecretsMenu, 76}, + {IT_STRING|IT_CALL, NULL, "1 player", M_SinglePlayerMenu, 84}, +#ifndef NONET + {IT_STRING|IT_SUBMENU, NULL, "multiplayer", &MP_MainDef, 92}, +#else + {IT_STRING|IT_CALL, NULL, "multiplayer", M_StartSplitServerMenu, 92}, +#endif + {IT_STRING|IT_CALL, NULL, "options", M_Options, 100}, + {IT_CALL |IT_STRING, NULL, "addons", M_Addons, 108}, + {IT_STRING|IT_CALL, NULL, "quit game", M_QuitSRB2, 116}, }; typedef enum @@ -452,22 +495,22 @@ typedef enum // --------------------- static menuitem_t MPauseMenu[] = { - {IT_STRING | IT_CALL, NULL, "Add-ons...", M_Addons, 8}, - {IT_STRING | IT_SUBMENU, NULL, "Scramble Teams...", &MISC_ScrambleTeamDef, 16}, - {IT_STRING | IT_CALL, NULL, "Switch Map..." , M_MapChange, 24}, + {IT_STRING | IT_CALL, NULL, "Add-ons...", M_Addons, 8}, + {IT_STRING | IT_SUBMENU, NULL, "Scramble Teams...", &MISC_ScrambleTeamDef, 16}, + {IT_STRING | IT_CALL, NULL, "Switch Gametype/Level...", M_MapChange, 24}, - {IT_CALL | IT_STRING, NULL, "Continue", M_SelectableClearMenus,40}, - {IT_CALL | IT_STRING, NULL, "Player 1 Setup", M_SetupMultiPlayer, 48}, // splitscreen - {IT_CALL | IT_STRING, NULL, "Player 2 Setup", M_SetupMultiPlayer2, 56}, // splitscreen + {IT_STRING | IT_CALL, NULL, "Continue", M_SelectableClearMenus,40}, + {IT_STRING | IT_CALL, NULL, "Player 1 Setup", M_SetupMultiPlayer, 48}, // splitscreen + {IT_STRING | IT_CALL, NULL, "Player 2 Setup", M_SetupMultiPlayer2, 56}, // splitscreen - {IT_STRING | IT_CALL, NULL, "Spectate", M_ConfirmSpectate, 48}, - {IT_STRING | IT_CALL, NULL, "Enter Game", M_ConfirmEnterGame, 48}, - {IT_STRING | IT_SUBMENU, NULL, "Switch Team...", &MISC_ChangeTeamDef, 48}, - {IT_CALL | IT_STRING, NULL, "Player Setup", M_SetupMultiPlayer, 56}, // alone - {IT_CALL | IT_STRING, NULL, "Options", M_Options, 64}, + {IT_STRING | IT_CALL, NULL, "Spectate", M_ConfirmSpectate, 48}, + {IT_STRING | IT_CALL, NULL, "Enter Game", M_ConfirmEnterGame, 48}, + {IT_STRING | IT_SUBMENU, NULL, "Switch Team...", &MISC_ChangeTeamDef, 48}, + {IT_STRING | IT_CALL, NULL, "Player Setup", M_SetupMultiPlayer, 56}, // alone + {IT_STRING | IT_CALL, NULL, "Options", M_Options, 64}, - {IT_CALL | IT_STRING, NULL, "Return to Title", M_EndGame, 80}, - {IT_CALL | IT_STRING, NULL, "Quit Game", M_QuitSRB2, 88}, + {IT_STRING | IT_CALL, NULL, "Return to Title", M_EndGame, 80}, + {IT_STRING | IT_CALL, NULL, "Quit Game", M_QuitSRB2, 88}, }; typedef enum @@ -516,6 +559,7 @@ typedef enum spause_continue, spause_retry, spause_options, + spause_title, spause_quit } spause_e; @@ -536,11 +580,21 @@ static menuitem_t MISC_ChangeTeamMenu[] = {IT_WHITESTRING|IT_CALL, NULL, "Confirm", M_ConfirmTeamChange, 90}, }; +static const gtdesc_t gametypedesc[] = +{ + {{ 54, 54}, "Play through the single-player campaign with your friends, teaming up to beat Dr Eggman's nefarious challenges!"}, + {{103, 103}, "Speed your way through the main acts, competing in several different categories to see who's the best."}, + {{190, 190}, "There's not much to it - zoom through the level faster than everyone else."}, + {{ 66, 66}, "Sling rings at your foes in a free-for-all battle. Use the special weapon rings to your advantage!"}, + {{153, 37}, "Sling rings at your foes in a color-coded battle. Use the special weapon rings to your advantage!"}, + {{123, 123}, "Whoever's IT has to hunt down everyone else. If you get caught, you have to turn on your former friends!"}, + {{150, 150}, "Try and find a good hiding place in these maps - we dare you."}, + {{ 37, 153}, "Steal the flag from the enemy's base and bring it back to your own, but watch out - they could just as easily steal yours!"}, +}; + static menuitem_t MISC_ChangeLevelMenu[] = { - {IT_STRING|IT_CVAR, NULL, "Game Type", &cv_newgametype, 30}, - {IT_STRING|IT_CVAR, NULL, "Level", &cv_nextmap, 60}, - {IT_WHITESTRING|IT_CALL, NULL, "Change Level", M_ChangeLevel, 120}, + {IT_KEYHANDLER | IT_NOTHING, NULL, "", M_HandleLevelPlatter, 0}, // dummy menuitem for the control func }; static menuitem_t MISC_HelpMenu[] = @@ -560,17 +614,20 @@ static menuitem_t MISC_HelpMenu[] = // Pause Menu Pandora's Box Options static menuitem_t SR_PandorasBox[] = { - {IT_STRING | IT_CVAR, NULL, "Rings", &cv_dummyrings, 20}, - {IT_STRING | IT_CVAR, NULL, "Lives", &cv_dummylives, 30}, - {IT_STRING | IT_CVAR, NULL, "Continues", &cv_dummycontinues, 40}, + {IT_STRING | IT_CALL, NULL, "Mid-game add-ons...", M_Addons, 0}, - {IT_STRING | IT_CVAR, NULL, "Gravity", &cv_gravity, 60}, - {IT_STRING | IT_CVAR, NULL, "Throw Rings", &cv_ringslinger, 70}, + {IT_STRING | IT_CVAR, NULL, "Rings", &cv_dummyrings, 20}, + {IT_STRING | IT_CVAR, NULL, "Lives", &cv_dummylives, 30}, + {IT_STRING | IT_CVAR, NULL, "Continues", &cv_dummycontinues, 40}, - {IT_STRING | IT_CALL, NULL, "Get All Emeralds", M_GetAllEmeralds, 90}, - {IT_STRING | IT_CALL, NULL, "Destroy All Robots", M_DestroyRobots, 100}, + {IT_STRING | IT_CVAR, NULL, "Gravity", &cv_gravity, 60}, + {IT_STRING | IT_CVAR, NULL, "Throw Rings", &cv_ringslinger, 70}, - {IT_STRING | IT_CALL, NULL, "Ultimate Cheat", M_UltimateCheat, 130}, + {IT_STRING | IT_CALL, NULL, "Enable Super form", M_AllowSuper, 90}, + {IT_STRING | IT_CALL, NULL, "Get All Emeralds", M_GetAllEmeralds, 100}, + {IT_STRING | IT_CALL, NULL, "Destroy All Robots", M_DestroyRobots, 110}, + + {IT_STRING | IT_CALL, NULL, "Ultimate Cheat", M_UltimateCheat, 130}, }; // Sky Room Custom Unlocks @@ -614,14 +671,12 @@ static menuitem_t SR_MainMenu[] = static menuitem_t SR_LevelSelectMenu[] = { - {IT_STRING|IT_CVAR, NULL, "Level", &cv_nextmap, 60}, - - {IT_WHITESTRING|IT_CALL, NULL, "Start", M_LevelSelectWarp, 120}, + {IT_KEYHANDLER | IT_NOTHING, NULL, "", M_HandleLevelPlatter, 0}, // dummy menuitem for the control func }; static menuitem_t SR_UnlockChecklistMenu[] = { - {IT_SUBMENU | IT_STRING, NULL, "NEXT", &SR_MainDef, 192}, + {IT_KEYHANDLER | IT_STRING, NULL, "", M_HandleChecklist, 0}, }; static menuitem_t SR_EmblemHintMenu[] = @@ -638,14 +693,16 @@ static menuitem_t SR_EmblemHintMenu[] = // Single Player Main static menuitem_t SP_MainMenu[] = { - {IT_CALL | IT_STRING, NULL, "Start Game", M_LoadGame, 92}, - {IT_SECRET, NULL, "Record Attack", M_TimeAttack, 100}, - {IT_SECRET, NULL, "NiGHTS Mode", M_NightsAttack, 108}, - {IT_CALL | IT_STRING | IT_CALL_NOTMODIFIED, NULL, "Statistics", M_Statistics, 116}, + {IT_CALL | IT_STRING, NULL, "Tutorial", M_StartTutorial, 84}, + {IT_CALL | IT_STRING, NULL, "Start Game", M_LoadGame, 92}, + {IT_SECRET, NULL, "Record Attack", M_TimeAttack, 100}, + {IT_SECRET, NULL, "NiGHTS Mode", M_NightsAttack, 108}, + {IT_CALL | IT_STRING | IT_CALL_NOTMODIFIED, NULL, "Statistics", M_Statistics, 116}, }; enum { + sptutorial, sploadgame, sprecordattack, spnightsmode, @@ -655,26 +712,30 @@ enum // Single Player Load Game static menuitem_t SP_LoadGameMenu[] = { - {IT_KEYHANDLER | IT_NOTHING, NULL, "", M_HandleLoadSave, '\0'}, // dummy menuitem for the control func + {IT_KEYHANDLER | IT_NOTHING, NULL, "", M_HandleLoadSave, 0}, // dummy menuitem for the control func }; // Single Player Level Select static menuitem_t SP_LevelSelectMenu[] = { - {IT_STRING|IT_CVAR, NULL, "Level", &cv_nextmap, 60}, + {IT_KEYHANDLER | IT_NOTHING, NULL, "", M_HandleLevelPlatter, 0}, // dummy menuitem for the control func +}; - {IT_WHITESTRING|IT_CALL, NULL, "Start", M_LevelSelectWarp, 120}, +// Single Player Time Attack Level Select +static menuitem_t SP_TimeAttackLevelSelectMenu[] = +{ + {IT_KEYHANDLER | IT_NOTHING, NULL, "", M_HandleLevelPlatter, 0}, // dummy menuitem for the control func }; // Single Player Time Attack static menuitem_t SP_TimeAttackMenu[] = { - {IT_STRING|IT_CVAR, NULL, "Level", &cv_nextmap, 52}, - {IT_STRING|IT_CVAR, NULL, "Player", &cv_chooseskin, 62}, + {IT_STRING|IT_CALL, NULL, "Level Select...", &M_TimeAttackLevelSelect, 52}, + {IT_STRING|IT_CVAR, NULL, "Character", &cv_chooseskin, 62}, {IT_DISABLED, NULL, "Guest Option...", &SP_GuestReplayDef, 100}, - {IT_DISABLED, NULL, "Replay...", &SP_ReplayDef, 110}, - {IT_DISABLED, NULL, "Ghosts...", &SP_GhostDef, 120}, + {IT_DISABLED, NULL, "Replay...", &SP_ReplayDef, 110}, + {IT_DISABLED, NULL, "Ghosts...", &SP_GhostDef, 120}, {IT_WHITESTRING|IT_CALL|IT_CALL_NOTMODIFIED, NULL, "Start", M_ChooseTimeAttack, 130}, }; @@ -758,16 +819,22 @@ static menuitem_t SP_NightsGhostMenu[] = {IT_WHITESTRING|IT_SUBMENU, NULL, "Back", &SP_NightsAttackDef, 50} }; +// Single Player Nights Attack Level Select +static menuitem_t SP_NightsAttackLevelSelectMenu[] = +{ + {IT_KEYHANDLER | IT_NOTHING, NULL, "", M_HandleLevelPlatter, 0}, // dummy menuitem for the control func +}; + // Single Player Nights Attack static menuitem_t SP_NightsAttackMenu[] = { - {IT_STRING|IT_CVAR, NULL, "Level", &cv_nextmap, 44}, - {IT_STRING|IT_CVAR, NULL, "Show Records For", &cv_dummymares, 54}, + {IT_STRING|IT_CALL, NULL, "Level Select...", &M_NightsAttackLevelSelect, 52}, + {IT_STRING|IT_CVAR, NULL, "Show Records For", &cv_dummymares, 62}, - {IT_DISABLED, NULL, "Guest Option...", &SP_NightsGuestReplayDef, 108}, - {IT_DISABLED, NULL, "Replay...", &SP_NightsReplayDef, 118}, - {IT_DISABLED, NULL, "Ghosts...", &SP_NightsGhostDef, 128}, - {IT_WHITESTRING|IT_CALL|IT_CALL_NOTMODIFIED, NULL, "Start", M_ChooseNightsAttack, 138}, + {IT_DISABLED, NULL, "Guest Option...", &SP_NightsGuestReplayDef, 100}, + {IT_DISABLED, NULL, "Replay...", &SP_NightsReplayDef, 110}, + {IT_DISABLED, NULL, "Ghosts...", &SP_NightsGhostDef, 120}, + {IT_WHITESTRING|IT_CALL|IT_CALL_NOTMODIFIED, NULL, "Start", M_ChooseNightsAttack, 130}, }; enum @@ -782,63 +849,71 @@ enum }; // Statistics -static menuitem_t SP_GameStatsMenu[] = -{ - {IT_KEYHANDLER | IT_NOTHING, NULL, "", M_HandleGameStats, '\0'}, // dummy menuitem for the control func -}; - static menuitem_t SP_LevelStatsMenu[] = { - {IT_KEYHANDLER | IT_NOTHING, NULL, "", M_HandleLevelStats, '\0'}, // dummy menuitem for the control func + {IT_KEYHANDLER | IT_NOTHING, NULL, "", M_HandleLevelStats, 0}, // dummy menuitem for the control func }; -// A rare case. -// External files modify this menu, so we can't call it static. -// And I'm too lazy to go through and rename it everywhere. ARRGH! -menuitem_t PlayerMenu[MAXSKINS]; +// Player menu dummy +static menuitem_t SP_PlayerMenu[] = +{ + {IT_NOTHING | IT_KEYHANDLER, NULL, "", M_HandleChoosePlayerMenu, 0}, // dummy menuitem for the control func +}; // ----------------------------------- // Multiplayer and all of its submenus // ----------------------------------- // Prefix: MP_ + +// Separated splitscreen and normal servers. +static menuitem_t MP_SplitServerMenu[] = +{ + {IT_STRING|IT_CALL, NULL, "Select Gametype/Level...", M_MapChange, 100}, +#ifdef NONET // In order to keep player setup accessible. + {IT_STRING|IT_CALL, NULL, "Player 1 setup...", M_SetupMultiPlayer, 110}, + {IT_STRING|IT_CALL, NULL, "Player 2 setup...", M_SetupMultiPlayer2, 120}, +#endif + {IT_STRING|IT_CALL, NULL, "More Options...", M_ServerOptions, 130}, + {IT_WHITESTRING|IT_CALL, NULL, "Start", M_StartServer, 140}, +}; + +#ifndef NONET + static menuitem_t MP_MainMenu[] = { -#ifndef NONET - {IT_CALL | IT_STRING, NULL, "HOST GAME", M_StartServerMenu, 10}, - {IT_CALL | IT_STRING, NULL, "JOIN GAME (Search)", M_ConnectMenu, 30}, - {IT_CALL | IT_STRING, NULL, "JOIN GAME (Specify IP)", M_ConnectIPMenu, 40}, -#endif - {IT_CALL | IT_STRING, NULL, "TWO PLAYER GAME", M_StartSplitServerMenu, 60}, - - {IT_CALL | IT_STRING, NULL, "SETUP PLAYER 1", M_SetupMultiPlayer, 80}, - {IT_CALL | IT_STRING, NULL, "SETUP PLAYER 2", M_SetupMultiPlayer2, 90}, + {IT_HEADER, NULL, "Host a game", NULL, 0}, + {IT_STRING|IT_CALL, NULL, "Internet/LAN...", M_StartServerMenu, 12}, + {IT_STRING|IT_CALL, NULL, "Splitscreen...", M_StartSplitServerMenu, 22}, + {IT_HEADER, NULL, "Join a game", NULL, 40}, + {IT_STRING|IT_CALL, NULL, "Server browser...", M_ConnectMenu, 52}, + {IT_STRING|IT_KEYHANDLER, NULL, "Specify IPv4 address:", M_HandleConnectIP, 62}, + {IT_HEADER, NULL, "Player setup", NULL, 94}, + {IT_STRING|IT_CALL, NULL, "Player 1...", M_SetupMultiPlayer, 106}, + {IT_STRING|IT_CALL, NULL, "Player 2... ", M_SetupMultiPlayer2, 116}, }; static menuitem_t MP_ServerMenu[] = { - {IT_STRING|IT_CVAR, NULL, "Game Type", &cv_newgametype, 10}, -#ifndef NONET - {IT_STRING|IT_CALL, NULL, "Room...", M_RoomMenu, 20}, - {IT_STRING|IT_CVAR|IT_CV_STRING, NULL, "Server Name", &cv_servername, 30}, -#endif - - {IT_STRING|IT_CVAR, NULL, "Level", &cv_nextmap, 80}, - - {IT_WHITESTRING|IT_CALL, NULL, "Start", M_StartServer, 130}, + {IT_STRING|IT_CALL, NULL, "Room...", M_RoomMenu, 10}, + {IT_STRING|IT_CVAR|IT_CV_STRING, NULL, "Server Name", &cv_servername, 20}, + {IT_STRING|IT_CVAR, NULL, "Max Players", &cv_maxplayers, 46}, + {IT_STRING|IT_CVAR, NULL, "Allow Add-on Downloading", &cv_downloading, 56}, + {IT_STRING|IT_CALL, NULL, "Select Gametype/Level...", M_MapChange, 100}, + {IT_STRING|IT_CALL, NULL, "More Options...", M_ServerOptions, 130}, + {IT_WHITESTRING|IT_CALL, NULL, "Start", M_StartServer, 140}, }; enum { - mp_server_gametype = 0, -#ifndef NONET - mp_server_room, + mp_server_room = 0, mp_server_name, -#endif - mp_server_level, + mp_server_maxpl, + mp_server_waddl, + mp_server_levelgt, + mp_server_options, mp_server_start }; -#ifndef NONET static menuitem_t MP_ConnectMenu[] = { {IT_STRING | IT_CALL, NULL, "Room...", M_RoomMenu, 4}, @@ -890,25 +965,14 @@ static menuitem_t MP_RoomMenu[] = {IT_DISABLED, NULL, "", M_ChooseRoom, 162}, }; -static menuitem_t MP_ConnectIPMenu[] = -{ - {IT_KEYHANDLER | IT_STRING, NULL, " IP Address:", M_HandleConnectIP, 0}, -}; #endif -// Separated splitscreen and normal servers. -static menuitem_t MP_SplitServerMenu[] = -{ - {IT_STRING|IT_CVAR, NULL, "Game Type", &cv_newgametype, 10}, - {IT_STRING|IT_CVAR, NULL, "Level", &cv_nextmap, 80}, - {IT_WHITESTRING|IT_CALL, NULL, "Start", M_StartServer, 130}, -}; - static menuitem_t MP_PlayerSetupMenu[] = { - {IT_KEYHANDLER | IT_STRING, NULL, "Your name", M_HandleSetupMultiPlayer, 0}, - {IT_KEYHANDLER | IT_STRING, NULL, "Your color", M_HandleSetupMultiPlayer, 16}, - {IT_KEYHANDLER | IT_STRING, NULL, "Your player", M_HandleSetupMultiPlayer, 96}, // Tails 01-18-2001 + {IT_KEYHANDLER, NULL, "", M_HandleSetupMultiPlayer, 0}, // name + {IT_KEYHANDLER, NULL, "", M_HandleSetupMultiPlayer, 0}, // skin + {IT_KEYHANDLER, NULL, "", M_HandleSetupMultiPlayer, 0}, // colour + {IT_KEYHANDLER, NULL, "", M_HandleSetupMultiPlayer, 0}, // default }; // ------------------------------------ @@ -917,123 +981,114 @@ static menuitem_t MP_PlayerSetupMenu[] = // Prefix: OP_ static menuitem_t OP_MainMenu[] = { - {IT_SUBMENU | IT_STRING, NULL, "Setup Controls...", &OP_ControlsDef, 10}, + {IT_SUBMENU | IT_STRING, NULL, "Player 1 Controls...", &OP_P1ControlsDef, 10}, + {IT_SUBMENU | IT_STRING, NULL, "Player 2 Controls...", &OP_P2ControlsDef, 20}, + {IT_CVAR | IT_STRING, NULL, "Controls per key", &cv_controlperkey, 30}, - {IT_SUBMENU | IT_STRING, NULL, "Video Options...", &OP_VideoOptionsDef, 30}, - {IT_SUBMENU | IT_STRING, NULL, "Sound Options...", &OP_SoundOptionsDef, 40}, - {IT_SUBMENU | IT_STRING, NULL, "Data Options...", &OP_DataOptionsDef, 50}, + {IT_SUBMENU | IT_STRING, NULL, "Video Options...", &OP_VideoOptionsDef, 50}, + {IT_SUBMENU | IT_STRING, NULL, "Sound Options...", &OP_SoundOptionsDef, 60}, - {IT_SUBMENU | IT_STRING, NULL, "Game Options...", &OP_GameOptionsDef, 70}, - {IT_SUBMENU | IT_STRING, NULL, "Server Options...", &OP_ServerOptionsDef, 80}, - {IT_STRING | IT_CALL, NULL, "Add-on Options...", M_AddonsOptions, 90}, -}; + {IT_CALL | IT_STRING, NULL, "Server Options...", M_ServerOptions, 80}, -static menuitem_t OP_ControlsMenu[] = -{ - {IT_SUBMENU | IT_STRING, NULL, "Player 1 Controls...", &OP_P1ControlsDef, 10}, - {IT_SUBMENU | IT_STRING, NULL, "Player 2 Controls...", &OP_P2ControlsDef, 20}, - - {IT_STRING | IT_CVAR, NULL, "Controls per key", &cv_controlperkey, 40}, + {IT_SUBMENU | IT_STRING, NULL, "Data Options...", &OP_DataOptionsDef, 100}, }; static menuitem_t OP_P1ControlsMenu[] = { {IT_CALL | IT_STRING, NULL, "Control Configuration...", M_Setup1PControlsMenu, 10}, {IT_SUBMENU | IT_STRING, NULL, "Mouse Options...", &OP_MouseOptionsDef, 20}, - {IT_SUBMENU | IT_STRING, NULL, "Joystick Options...", &OP_Joystick1Def , 30}, + {IT_SUBMENU | IT_STRING, NULL, "Gamepad Options...", &OP_Joystick1Def , 30}, - {IT_STRING | IT_CVAR, NULL, "Camera" , &cv_chasecam , 50}, - {IT_STRING | IT_CVAR, NULL, "Crosshair", &cv_crosshair , 60}, + {IT_STRING | IT_CVAR, NULL, "Third-person Camera" , &cv_chasecam , 50}, + {IT_STRING | IT_CVAR, NULL, "Flip Camera with Gravity" , &cv_flipcam , 60}, + {IT_STRING | IT_CVAR, NULL, "Crosshair", &cv_crosshair, 70}, - {IT_STRING | IT_CVAR, NULL, "Analog Control", &cv_useranalog, 80}, + //{IT_STRING | IT_CVAR, NULL, "Analog Control", &cv_useranalog, 90}, + {IT_STRING | IT_CVAR, NULL, "Character angle", &cv_directionchar, 90}, + {IT_STRING | IT_CVAR, NULL, "Automatic braking", &cv_autobrake, 100}, }; static menuitem_t OP_P2ControlsMenu[] = { {IT_CALL | IT_STRING, NULL, "Control Configuration...", M_Setup2PControlsMenu, 10}, {IT_SUBMENU | IT_STRING, NULL, "Second Mouse Options...", &OP_Mouse2OptionsDef, 20}, - {IT_SUBMENU | IT_STRING, NULL, "Second Joystick Options...", &OP_Joystick2Def , 30}, + {IT_SUBMENU | IT_STRING, NULL, "Second Gamepad Options...", &OP_Joystick2Def , 30}, - {IT_STRING | IT_CVAR, NULL, "Camera" , &cv_chasecam2 , 50}, - {IT_STRING | IT_CVAR, NULL, "Crosshair", &cv_crosshair2, 60}, + {IT_STRING | IT_CVAR, NULL, "Third-person Camera" , &cv_chasecam2 , 50}, + {IT_STRING | IT_CVAR, NULL, "Flip Camera with Gravity" , &cv_flipcam2 , 60}, + {IT_STRING | IT_CVAR, NULL, "Crosshair", &cv_crosshair2, 70}, - {IT_STRING | IT_CVAR, NULL, "Analog Control", &cv_useranalog2, 80}, + //{IT_STRING | IT_CVAR, NULL, "Analog Control", &cv_useranalog2, 90}, + {IT_STRING | IT_CVAR, NULL, "Character angle", &cv_directionchar2, 90}, + {IT_STRING | IT_CVAR, NULL, "Automatic braking", &cv_autobrake2, 100}, }; -static menuitem_t OP_ControlListMenu[] = +static menuitem_t OP_ChangeControlsMenu[] = { - {IT_SUBMENU | IT_STRING, NULL, "Movement Controls...", &OP_MoveControlsDef, 10}, - {IT_SUBMENU | IT_STRING, NULL, "Multiplayer Controls...", &OP_MPControlsDef, 20}, - {IT_SUBMENU | IT_STRING, NULL, "Miscellaneous Controls...", &OP_MiscControlsDef, 30}, -}; - -static menuitem_t OP_MoveControlsMenu[] = -{ - {IT_HEADER, NULL, " Movement", NULL, 0}, + {IT_HEADER, NULL, "Movement", NULL, 0}, + {IT_SPACE, NULL, NULL, NULL, 0}, // padding {IT_CALL | IT_STRING2, NULL, "Move Forward", M_ChangeControl, gc_forward }, {IT_CALL | IT_STRING2, NULL, "Move Backward", M_ChangeControl, gc_backward }, {IT_CALL | IT_STRING2, NULL, "Move Left", M_ChangeControl, gc_strafeleft }, {IT_CALL | IT_STRING2, NULL, "Move Right", M_ChangeControl, gc_straferight }, {IT_CALL | IT_STRING2, NULL, "Jump", M_ChangeControl, gc_jump }, {IT_CALL | IT_STRING2, NULL, "Spin", M_ChangeControl, gc_use }, - {IT_HEADER, NULL, " Camera", NULL, 0}, + {IT_HEADER, NULL, "Camera", NULL, 0}, + {IT_SPACE, NULL, NULL, NULL, 0}, // padding {IT_CALL | IT_STRING2, NULL, "Look Up", M_ChangeControl, gc_lookup }, {IT_CALL | IT_STRING2, NULL, "Look Down", M_ChangeControl, gc_lookdown }, - {IT_CALL | IT_STRING2, NULL, "Turn Left", M_ChangeControl, gc_turnleft }, - {IT_CALL | IT_STRING2, NULL, "Turn Right", M_ChangeControl, gc_turnright }, + {IT_CALL | IT_STRING2, NULL, "Look Left", M_ChangeControl, gc_turnleft }, + {IT_CALL | IT_STRING2, NULL, "Look Right", M_ChangeControl, gc_turnright }, {IT_CALL | IT_STRING2, NULL, "Center View", M_ChangeControl, gc_centerview }, {IT_CALL | IT_STRING2, NULL, "Toggle Mouselook", M_ChangeControl, gc_mouseaiming }, {IT_CALL | IT_STRING2, NULL, "Toggle Third-Person", M_ChangeControl, gc_camtoggle}, {IT_CALL | IT_STRING2, NULL, "Reset Camera", M_ChangeControl, gc_camreset }, - {IT_HEADER, NULL, " Advanced", NULL, 0}, - {IT_CALL | IT_STRING2, NULL, "Rotate Camera L", M_ChangeControl, gc_camleft }, - {IT_CALL | IT_STRING2, NULL, "Rotate Camera R", M_ChangeControl, gc_camright }, -}; - -static menuitem_t OP_MPControlsMenu[] = -{ - {IT_CALL | IT_STRING2, NULL, "Talk key", M_ChangeControl, gc_talkkey }, - {IT_CALL | IT_STRING2, NULL, "Team-Talk key", M_ChangeControl, gc_teamkey }, - {IT_CALL | IT_STRING2, NULL, "Rankings/Scores", M_ChangeControl, gc_scores }, - {IT_CALL | IT_STRING2, NULL, "Toss Flag", M_ChangeControl, gc_tossflag }, - {IT_CALL | IT_STRING2, NULL, "Next Weapon", M_ChangeControl, gc_weaponnext }, - {IT_CALL | IT_STRING2, NULL, "Prev Weapon", M_ChangeControl, gc_weaponprev }, - {IT_CALL | IT_STRING2, NULL, "Weapon Slot 1", M_ChangeControl, gc_wepslot1 }, - {IT_CALL | IT_STRING2, NULL, "Weapon Slot 2", M_ChangeControl, gc_wepslot2 }, - {IT_CALL | IT_STRING2, NULL, "Weapon Slot 3", M_ChangeControl, gc_wepslot3 }, - {IT_CALL | IT_STRING2, NULL, "Weapon Slot 4", M_ChangeControl, gc_wepslot4 }, - {IT_CALL | IT_STRING2, NULL, "Weapon Slot 5", M_ChangeControl, gc_wepslot5 }, - {IT_CALL | IT_STRING2, NULL, "Weapon Slot 6", M_ChangeControl, gc_wepslot6 }, - {IT_CALL | IT_STRING2, NULL, "Weapon Slot 7", M_ChangeControl, gc_wepslot7 }, - {IT_CALL | IT_STRING2, NULL, "Ring Toss", M_ChangeControl, gc_fire }, - {IT_CALL | IT_STRING2, NULL, "Ring Toss Normal", M_ChangeControl, gc_firenormal }, -}; - -static menuitem_t OP_MiscControlsMenu[] = -{ - {IT_CALL | IT_STRING2, NULL, "Custom Action 1", M_ChangeControl, gc_custom1 }, - {IT_CALL | IT_STRING2, NULL, "Custom Action 2", M_ChangeControl, gc_custom2 }, - {IT_CALL | IT_STRING2, NULL, "Custom Action 3", M_ChangeControl, gc_custom3 }, - - {IT_CALL | IT_STRING2, NULL, "Pause", M_ChangeControl, gc_pause }, + {IT_HEADER, NULL, "Meta", NULL, 0}, + {IT_SPACE, NULL, NULL, NULL, 0}, // padding + {IT_CALL | IT_STRING2, NULL, "Game Status", + M_ChangeControl, gc_scores }, + {IT_CALL | IT_STRING2, NULL, "Pause / Run Retry", M_ChangeControl, gc_pause }, {IT_CALL | IT_STRING2, NULL, "Screenshot", M_ChangeControl, gc_screenshot }, {IT_CALL | IT_STRING2, NULL, "Toggle GIF Recording", M_ChangeControl, gc_recordgif }, {IT_CALL | IT_STRING2, NULL, "Open/Close Menu (ESC)", M_ChangeControl, gc_systemmenu }, {IT_CALL | IT_STRING2, NULL, "Change Viewpoint", M_ChangeControl, gc_viewpoint }, - {IT_CALL | IT_STRING2, NULL, "Console", M_ChangeControl, gc_console }, + {IT_CALL | IT_STRING2, NULL, "Console", M_ChangeControl, gc_console }, + {IT_HEADER, NULL, "Multiplayer", NULL, 0}, + {IT_SPACE, NULL, NULL, NULL, 0}, // padding + {IT_CALL | IT_STRING2, NULL, "Talk", M_ChangeControl, gc_talkkey }, + {IT_CALL | IT_STRING2, NULL, "Talk (Team only)", M_ChangeControl, gc_teamkey }, + {IT_HEADER, NULL, "Ringslinger (Match, CTF, Tag, H&S)", NULL, 0}, + {IT_SPACE, NULL, NULL, NULL, 0}, // padding + {IT_CALL | IT_STRING2, NULL, "Fire", M_ChangeControl, gc_fire }, + {IT_CALL | IT_STRING2, NULL, "Fire Normal", M_ChangeControl, gc_firenormal }, + {IT_CALL | IT_STRING2, NULL, "Toss Flag", M_ChangeControl, gc_tossflag }, + {IT_CALL | IT_STRING2, NULL, "Next Weapon", M_ChangeControl, gc_weaponnext }, + {IT_CALL | IT_STRING2, NULL, "Prev Weapon", M_ChangeControl, gc_weaponprev }, + {IT_CALL | IT_STRING2, NULL, "Normal / Infinity", M_ChangeControl, gc_wepslot1 }, + {IT_CALL | IT_STRING2, NULL, "Automatic", M_ChangeControl, gc_wepslot2 }, + {IT_CALL | IT_STRING2, NULL, "Bounce", M_ChangeControl, gc_wepslot3 }, + {IT_CALL | IT_STRING2, NULL, "Scatter", M_ChangeControl, gc_wepslot4 }, + {IT_CALL | IT_STRING2, NULL, "Grenade", M_ChangeControl, gc_wepslot5 }, + {IT_CALL | IT_STRING2, NULL, "Explosion", M_ChangeControl, gc_wepslot6 }, + {IT_CALL | IT_STRING2, NULL, "Rail", M_ChangeControl, gc_wepslot7 }, + {IT_HEADER, NULL, "Add-ons", NULL, 0}, + {IT_SPACE, NULL, NULL, NULL, 0}, // padding + {IT_CALL | IT_STRING2, NULL, "Custom Action 1", M_ChangeControl, gc_custom1 }, + {IT_CALL | IT_STRING2, NULL, "Custom Action 2", M_ChangeControl, gc_custom2 }, + {IT_CALL | IT_STRING2, NULL, "Custom Action 3", M_ChangeControl, gc_custom3 }, }; static menuitem_t OP_Joystick1Menu[] = { - {IT_STRING | IT_CALL, NULL, "Select Joystick...", M_Setup1PJoystickMenu, 10}, - {IT_STRING | IT_CVAR, NULL, "Axis For Turning" , &cv_turnaxis , 30}, - {IT_STRING | IT_CVAR, NULL, "Axis For Moving" , &cv_moveaxis , 40}, - {IT_STRING | IT_CVAR, NULL, "Axis For Strafe" , &cv_sideaxis , 50}, - {IT_STRING | IT_CVAR, NULL, "Axis For Looking" , &cv_lookaxis , 60}, - {IT_STRING | IT_CVAR, NULL, "Axis For Jumping" , &cv_jumpaxis , 70}, - {IT_STRING | IT_CVAR, NULL, "Axis For Spinning" , &cv_spinaxis , 80}, - {IT_STRING | IT_CVAR, NULL, "Axis For Firing" , &cv_fireaxis , 90}, - {IT_STRING | IT_CVAR, NULL, "Axis For NFiring" , &cv_firenaxis , 100}, + {IT_STRING | IT_CALL, NULL, "Select Gamepad...", M_Setup1PJoystickMenu, 10}, + {IT_STRING | IT_CVAR, NULL, "Move \x17 Axis" , &cv_moveaxis , 30}, + {IT_STRING | IT_CVAR, NULL, "Move \x18 Axis" , &cv_sideaxis , 40}, + {IT_STRING | IT_CVAR, NULL, "Camera \x17 Axis" , &cv_lookaxis , 50}, + {IT_STRING | IT_CVAR, NULL, "Camera \x18 Axis" , &cv_turnaxis , 60}, + {IT_STRING | IT_CVAR, NULL, "Jump Axis" , &cv_jumpaxis , 70}, + {IT_STRING | IT_CVAR, NULL, "Spin Axis" , &cv_spinaxis , 80}, + {IT_STRING | IT_CVAR, NULL, "Fire Axis" , &cv_fireaxis , 90}, + {IT_STRING | IT_CVAR, NULL, "Fire Normal Axis" , &cv_firenaxis ,100}, {IT_STRING | IT_CVAR, NULL, "First-Person Vert-Look", &cv_alwaysfreelook, 120}, {IT_STRING | IT_CVAR, NULL, "Third-Person Vert-Look", &cv_chasefreelook, 130}, @@ -1041,15 +1096,15 @@ static menuitem_t OP_Joystick1Menu[] = static menuitem_t OP_Joystick2Menu[] = { - {IT_STRING | IT_CALL, NULL, "Select Joystick...", M_Setup2PJoystickMenu, 10}, - {IT_STRING | IT_CVAR, NULL, "Axis For Turning" , &cv_turnaxis2 , 30}, - {IT_STRING | IT_CVAR, NULL, "Axis For Moving" , &cv_moveaxis2 , 40}, - {IT_STRING | IT_CVAR, NULL, "Axis For Strafe" , &cv_sideaxis2 , 50}, - {IT_STRING | IT_CVAR, NULL, "Axis For Looking" , &cv_lookaxis2 , 60}, - {IT_STRING | IT_CVAR, NULL, "Axis For Jumping" , &cv_jumpaxis2 , 70}, - {IT_STRING | IT_CVAR, NULL, "Axis For Spinning" , &cv_spinaxis2 , 80}, - {IT_STRING | IT_CVAR, NULL, "Axis For Firing" , &cv_fireaxis2 , 90}, - {IT_STRING | IT_CVAR, NULL, "Axis For NFiring" , &cv_firenaxis2 , 100}, + {IT_STRING | IT_CALL, NULL, "Select Gamepad...", M_Setup2PJoystickMenu, 10}, + {IT_STRING | IT_CVAR, NULL, "Move \x17 Axis" , &cv_moveaxis2 , 30}, + {IT_STRING | IT_CVAR, NULL, "Move \x18 Axis" , &cv_sideaxis2 , 40}, + {IT_STRING | IT_CVAR, NULL, "Camera \x17 Axis" , &cv_lookaxis2 , 50}, + {IT_STRING | IT_CVAR, NULL, "Camera \x18 Axis" , &cv_turnaxis2 , 60}, + {IT_STRING | IT_CVAR, NULL, "Jump Axis" , &cv_jumpaxis2 , 70}, + {IT_STRING | IT_CVAR, NULL, "Spin Axis" , &cv_spinaxis2 , 80}, + {IT_STRING | IT_CVAR, NULL, "Fire Axis" , &cv_fireaxis2 , 90}, + {IT_STRING | IT_CVAR, NULL, "Fire Normal Axis" , &cv_firenaxis2 ,100}, {IT_STRING | IT_CVAR, NULL, "First-Person Vert-Look", &cv_alwaysfreelook2,120}, {IT_STRING | IT_CVAR, NULL, "Third-Person Vert-Look", &cv_chasefreelook2, 130}, @@ -1062,8 +1117,6 @@ static menuitem_t OP_JoystickSetMenu[] = {IT_CALL | IT_NOTHING, "", NULL, M_AssignJoystick, '2'}, {IT_CALL | IT_NOTHING, "", NULL, M_AssignJoystick, '3'}, {IT_CALL | IT_NOTHING, "", NULL, M_AssignJoystick, '4'}, - {IT_CALL | IT_NOTHING, "", NULL, M_AssignJoystick, '5'}, - {IT_CALL | IT_NOTHING, "", NULL, M_AssignJoystick, '6'}, }; static menuitem_t OP_MouseOptionsMenu[] = @@ -1074,11 +1127,11 @@ static menuitem_t OP_MouseOptionsMenu[] = {IT_STRING | IT_CVAR, NULL, "First-Person MouseLook", &cv_alwaysfreelook, 30}, {IT_STRING | IT_CVAR, NULL, "Third-Person MouseLook", &cv_chasefreelook, 40}, {IT_STRING | IT_CVAR, NULL, "Mouse Move", &cv_mousemove, 50}, - {IT_STRING | IT_CVAR, NULL, "Invert Mouse", &cv_invertmouse, 60}, + {IT_STRING | IT_CVAR, NULL, "Invert Y Axis", &cv_invertmouse, 60}, {IT_STRING | IT_CVAR | IT_CV_SLIDER, - NULL, "Mouse X Speed", &cv_mousesens, 70}, + NULL, "Mouse X Sensitivity", &cv_mousesens, 70}, {IT_STRING | IT_CVAR | IT_CV_SLIDER, - NULL, "Mouse Y Speed", &cv_mouseysens, 80}, + NULL, "Mouse Y Sensitivity", &cv_mouseysens, 80}, }; static menuitem_t OP_Mouse2OptionsMenu[] = @@ -1089,40 +1142,109 @@ static menuitem_t OP_Mouse2OptionsMenu[] = {IT_STRING | IT_CVAR, NULL, "First-Person MouseLook", &cv_alwaysfreelook2, 30}, {IT_STRING | IT_CVAR, NULL, "Third-Person MouseLook", &cv_chasefreelook2, 40}, {IT_STRING | IT_CVAR, NULL, "Mouse Move", &cv_mousemove2, 50}, - {IT_STRING | IT_CVAR, NULL, "Invert Mouse", &cv_invertmouse2, 60}, + {IT_STRING | IT_CVAR, NULL, "Invert Y Axis", &cv_invertmouse2, 60}, {IT_STRING | IT_CVAR | IT_CV_SLIDER, - NULL, "Mouse X Speed", &cv_mousesens2, 70}, + NULL, "Mouse X Sensitivity", &cv_mousesens2, 70}, {IT_STRING | IT_CVAR | IT_CV_SLIDER, - NULL, "Mouse Y Speed", &cv_mouseysens2, 80}, + NULL, "Mouse Y Sensitivity", &cv_mouseysens2, 80}, }; static menuitem_t OP_VideoOptionsMenu[] = { - {IT_STRING | IT_CALL, NULL, "Video Modes...", M_VideoModeMenu, 10}, - -#ifdef HWRENDER - {IT_SUBMENU|IT_STRING, NULL, "3D Card Options...", &OP_OpenGLOptionsDef, 20}, -#endif + {IT_HEADER, NULL, "Screen", NULL, 0}, + {IT_STRING | IT_CALL, NULL, "Set Resolution...", M_VideoModeMenu, 6}, #if (defined (__unix__) && !defined (MSDOS)) || defined (UNIXCOMMON) || defined (HAVE_SDL) - {IT_STRING|IT_CVAR, NULL, "Fullscreen", &cv_fullscreen, 30}, + {IT_STRING|IT_CVAR, NULL, "Fullscreen", &cv_fullscreen, 11}, +#endif + {IT_STRING | IT_CVAR, NULL, "Vertical Sync", &cv_vidwait, 16}, + +#ifdef HWRENDER + {IT_SUBMENU|IT_STRING, NULL, "OpenGL Options...", &OP_OpenGLOptionsDef, 21}, #endif - {IT_STRING | IT_CVAR | IT_CV_SLIDER, - NULL, "Brightness", &cv_usegamma, 50}, - {IT_STRING | IT_CVAR, NULL, "Draw Distance", &cv_drawdist, 60}, - {IT_STRING | IT_CVAR, NULL, "NiGHTS Draw Dist", &cv_drawdist_nights, 70}, - {IT_STRING | IT_CVAR, NULL, "Precip Draw Dist", &cv_drawdist_precip, 80}, - {IT_STRING | IT_CVAR, NULL, "Precip Density", &cv_precipdensity, 90}, + {IT_HEADER, NULL, "Color Profile", NULL, 30}, + {IT_STRING | IT_CVAR | IT_CV_SLIDER, NULL, "Brightness (F11)", &cv_globalgamma,36}, + {IT_STRING | IT_CVAR | IT_CV_SLIDER, NULL, "Saturation", &cv_globalsaturation, 41}, + {IT_SUBMENU|IT_STRING, NULL, "Advanced Settings...", &OP_ColorOptionsDef, 46}, - {IT_STRING | IT_CVAR, NULL, "Show FPS", &cv_ticrate, 110}, - {IT_STRING | IT_CVAR, NULL, "Clear Before Redraw", &cv_homremoval, 120}, - {IT_STRING | IT_CVAR, NULL, "Vertical Sync", &cv_vidwait, 130}, + {IT_HEADER, NULL, "Heads-Up Display", NULL, 55}, + {IT_STRING | IT_CVAR, NULL, "Show HUD", &cv_showhud, 61}, + {IT_STRING | IT_CVAR | IT_CV_SLIDER, + NULL, "HUD Transparency", &cv_translucenthud, 66}, + {IT_STRING | IT_CVAR, NULL, "Score/Time/Rings", &cv_timetic, 71}, + {IT_STRING | IT_CVAR, NULL, "Show Powerups", &cv_powerupdisplay, 76}, +#ifdef SEENAMES + {IT_STRING | IT_CVAR, NULL, "Show player names", &cv_seenames, 81}, +#endif + + {IT_HEADER, NULL, "Console", NULL, 90}, + {IT_STRING | IT_CVAR, NULL, "Background color", &cons_backcolor, 96}, + {IT_STRING | IT_CVAR, NULL, "Text Size", &cv_constextsize, 101}, + + {IT_HEADER, NULL, "Chat", NULL, 110}, + {IT_STRING | IT_CVAR, NULL, "Chat Mode", &cv_consolechat, 116}, + {IT_STRING | IT_CVAR | IT_CV_SLIDER, NULL, "Chat Box Width", &cv_chatwidth, 121}, + {IT_STRING | IT_CVAR | IT_CV_SLIDER, NULL, "Chat Box Height", &cv_chatheight, 126}, + {IT_STRING | IT_CVAR, NULL, "Message Fadeout Time", &cv_chattime, 131}, + {IT_STRING | IT_CVAR, NULL, "Chat Notifications", &cv_chatnotifications, 136}, + {IT_STRING | IT_CVAR, NULL, "Spam Protection", &cv_chatspamprotection, 141}, + {IT_STRING | IT_CVAR, NULL, "Chat background tint", &cv_chatbacktint, 146}, + + {IT_HEADER, NULL, "Level", NULL, 155}, + {IT_STRING | IT_CVAR, NULL, "Draw Distance", &cv_drawdist, 161}, + {IT_STRING | IT_CVAR, NULL, "Weather Draw Dist.", &cv_drawdist_precip, 166}, + {IT_STRING | IT_CVAR, NULL, "NiGHTS mode Draw Dist.", &cv_drawdist_nights, 171}, + + {IT_HEADER, NULL, "Diagnostic", NULL, 180}, + {IT_STRING | IT_CVAR, NULL, "Show FPS", &cv_ticrate, 186}, + {IT_STRING | IT_CVAR, NULL, "Clear Before Redraw", &cv_homremoval, 191}, }; static menuitem_t OP_VideoModeMenu[] = { - {IT_KEYHANDLER | IT_NOTHING, NULL, "", M_HandleVideoMode, '\0'}, // dummy menuitem for the control func + {IT_KEYHANDLER | IT_NOTHING, NULL, "", M_HandleVideoMode, 0}, // dummy menuitem for the control func +}; + +static menuitem_t OP_ColorOptionsMenu[] = +{ + {IT_STRING | IT_CALL, NULL, "Reset to defaults", M_ResetCvars, 0}, + + {IT_HEADER, NULL, "Red", NULL, 9}, + {IT_DISABLED, NULL, NULL, NULL, 35}, + {IT_STRING | IT_CVAR | IT_CV_SLIDER, NULL, "Hue", &cv_rhue, 15}, + {IT_STRING | IT_CVAR | IT_CV_SLIDER, NULL, "Saturation", &cv_rsaturation, 20}, + {IT_STRING | IT_CVAR | IT_CV_SLIDER, NULL, "Brightness", &cv_rgamma, 25}, + + {IT_HEADER, NULL, "Yellow", NULL, 34}, + {IT_DISABLED, NULL, NULL, NULL, 73}, + {IT_STRING | IT_CVAR | IT_CV_SLIDER, NULL, "Hue", &cv_yhue, 40}, + {IT_STRING | IT_CVAR | IT_CV_SLIDER, NULL, "Saturation", &cv_ysaturation, 45}, + {IT_STRING | IT_CVAR | IT_CV_SLIDER, NULL, "Brightness", &cv_ygamma, 50}, + + {IT_HEADER, NULL, "Green", NULL, 59}, + {IT_DISABLED, NULL, NULL, NULL, 112}, + {IT_STRING | IT_CVAR | IT_CV_SLIDER, NULL, "Hue", &cv_ghue, 65}, + {IT_STRING | IT_CVAR | IT_CV_SLIDER, NULL, "Saturation", &cv_gsaturation, 70}, + {IT_STRING | IT_CVAR | IT_CV_SLIDER, NULL, "Brightness", &cv_ggamma, 75}, + + {IT_HEADER, NULL, "Cyan", NULL, 84}, + {IT_DISABLED, NULL, NULL, NULL, 255}, + {IT_STRING | IT_CVAR | IT_CV_SLIDER, NULL, "Hue", &cv_chue, 90}, + {IT_STRING | IT_CVAR | IT_CV_SLIDER, NULL, "Saturation", &cv_csaturation, 95}, + {IT_STRING | IT_CVAR | IT_CV_SLIDER, NULL, "Brightness", &cv_cgamma, 100}, + + {IT_HEADER, NULL, "Blue", NULL, 109}, + {IT_DISABLED, NULL, NULL, NULL, 152}, + {IT_STRING | IT_CVAR | IT_CV_SLIDER, NULL, "Hue", &cv_bhue, 115}, + {IT_STRING | IT_CVAR | IT_CV_SLIDER, NULL, "Saturation", &cv_bsaturation, 120}, + {IT_STRING | IT_CVAR | IT_CV_SLIDER, NULL, "Brightness", &cv_bgamma, 125}, + + {IT_HEADER, NULL, "Magenta", NULL, 134}, + {IT_DISABLED, NULL, NULL, NULL, 181}, + {IT_STRING | IT_CVAR | IT_CV_SLIDER, NULL, "Hue", &cv_mhue, 140}, + {IT_STRING | IT_CVAR | IT_CV_SLIDER, NULL, "Saturation", &cv_msaturation, 145}, + {IT_STRING | IT_CVAR | IT_CV_SLIDER, NULL, "Brightness", &cv_mgamma, 150}, }; #ifdef HWRENDER @@ -1132,7 +1254,7 @@ static menuitem_t OP_OpenGLOptionsMenu[] = {IT_STRING|IT_CVAR, NULL, "Quality", &cv_scr_depth, 20}, {IT_STRING|IT_CVAR, NULL, "Texture Filter", &cv_grfiltermode, 30}, {IT_STRING|IT_CVAR, NULL, "Anisotropic", &cv_granisotropicmode,40}, -#ifdef _WINDOWS +#if defined (_WINDOWS) && (!((defined (__unix__) && !defined (MSDOS)) || defined (UNIXCOMMON) || defined (HAVE_SDL))) {IT_STRING|IT_CVAR, NULL, "Fullscreen", &cv_fullscreen, 50}, #endif #ifdef ALAM_LIGHTING @@ -1170,60 +1292,67 @@ static menuitem_t OP_OpenGLColorMenu[] = static menuitem_t OP_SoundOptionsMenu[] = { - {IT_STRING | IT_CVAR | IT_CV_SLIDER, - NULL, "Sound Volume" , &cv_soundvolume, 10}, - {IT_STRING | IT_CVAR | IT_CV_SLIDER, - NULL, "Music Volume" , &cv_digmusicvolume, 20}, - {IT_STRING | IT_CVAR | IT_CV_SLIDER, - NULL, "MIDI Volume" , &cv_midimusicvolume, 30}, -#ifdef PC_DOS - {IT_STRING | IT_CVAR | IT_CV_SLIDER, - NULL, "CD Volume" , &cd_volume, 40}, -#endif + {IT_HEADER, NULL, "Game Audio", NULL, 0}, // 0 // ScrollMenu offsets + {IT_STRING | IT_CVAR, NULL, "Sound Effects", &cv_gamesounds, 13}, // 6 + {IT_STRING | IT_CVAR | IT_CV_SLIDER, NULL, "Sound Volume", &cv_soundvolume, 23}, // 11 - {IT_STRING | IT_CVAR, NULL, "SFX" , &cv_gamesounds, 50}, - {IT_STRING | IT_CVAR, NULL, "Digital Music", &cv_gamedigimusic, 60}, - {IT_STRING | IT_CVAR, NULL, "MIDI Music", &cv_gamemidimusic, 70}, + {IT_STRING | IT_CVAR, NULL, "Digital Music", &cv_gamedigimusic, 43}, // 21 + {IT_STRING | IT_CVAR | IT_CV_SLIDER, NULL, "Digital Music Volume", &cv_digmusicvolume, 53}, // 26 + + {IT_STRING | IT_CVAR, NULL, "MIDI Music", &cv_gamemidimusic, 73}, // 36 + {IT_STRING | IT_CVAR | IT_CV_SLIDER, NULL, "MIDI Music Volume", &cv_midimusicvolume, 83}, // 41 + + {IT_HEADER, NULL, "Advanced", NULL, 103}, // 50 + {IT_STRING | IT_CVAR, NULL, "Closed Captioning", &cv_closedcaptioning, 115}, // 56 + +#ifdef HAVE_OPENMPT + {IT_HEADER, NULL, "OpenMPT Settings", NULL, 133}, + {IT_STRING | IT_CVAR, NULL, "Instrument Filter", &cv_modfilter, 145} +#endif }; static menuitem_t OP_DataOptionsMenu[] = { - {IT_STRING | IT_CALL, NULL, "Screenshot Options...", M_ScreenshotOptions, 10}, + {IT_STRING | IT_CALL, NULL, "Add-on Options...", M_AddonsOptions, 10}, + {IT_STRING | IT_CALL, NULL, "Screenshot Options...", M_ScreenshotOptions, 20}, - {IT_STRING | IT_SUBMENU, NULL, "Erase Data...", &OP_EraseDataDef, 30}, + {IT_STRING | IT_SUBMENU, NULL, "\x85" "Erase Data...", &OP_EraseDataDef, 40}, }; static menuitem_t OP_ScreenshotOptionsMenu[] = { - {IT_STRING|IT_CVAR, NULL, "Storage Location", &cv_screenshot_option, 10}, - {IT_STRING|IT_CVAR|IT_CV_STRING, NULL, "Custom Folder", &cv_screenshot_folder, 20}, + {IT_HEADER, NULL, "General", NULL, 0}, + {IT_STRING|IT_CVAR, NULL, "Use color profile", &cv_screenshot_colorprofile, 6}, + {IT_STRING|IT_CVAR, NULL, "Storage Location", &cv_screenshot_option, 11}, + {IT_STRING|IT_CVAR|IT_CV_STRING, NULL, "Custom Folder", &cv_screenshot_folder, 16}, - {IT_HEADER, NULL, "Screenshots (F8)", NULL, 50}, - {IT_STRING|IT_CVAR, NULL, "Memory Level", &cv_zlib_memory, 60}, - {IT_STRING|IT_CVAR, NULL, "Compression Level", &cv_zlib_level, 70}, - {IT_STRING|IT_CVAR, NULL, "Strategy", &cv_zlib_strategy, 80}, - {IT_STRING|IT_CVAR, NULL, "Window Size", &cv_zlib_window_bits, 90}, + {IT_HEADER, NULL, "Screenshots (F8)", NULL, 30}, + {IT_STRING|IT_CVAR, NULL, "Memory Level", &cv_zlib_memory, 36}, + {IT_STRING|IT_CVAR, NULL, "Compression Level", &cv_zlib_level, 41}, + {IT_STRING|IT_CVAR, NULL, "Strategy", &cv_zlib_strategy, 46}, + {IT_STRING|IT_CVAR, NULL, "Window Size", &cv_zlib_window_bits, 51}, - {IT_HEADER, NULL, "Movie Mode (F9)", NULL, 105}, - {IT_STRING|IT_CVAR, NULL, "Capture Mode", &cv_moviemode, 115}, + {IT_HEADER, NULL, "Movie Mode (F9)", NULL, 60}, + {IT_STRING|IT_CVAR, NULL, "Capture Mode", &cv_moviemode, 66}, - {IT_STRING|IT_CVAR, NULL, "Region Optimizing", &cv_gif_optimize, 125}, - {IT_STRING|IT_CVAR, NULL, "Downscaling", &cv_gif_downscale, 135}, + {IT_STRING|IT_CVAR, NULL, "Region Optimizing", &cv_gif_optimize, 71}, + {IT_STRING|IT_CVAR, NULL, "Downscaling", &cv_gif_downscale, 76}, - {IT_STRING|IT_CVAR, NULL, "Memory Level", &cv_zlib_memorya, 125}, - {IT_STRING|IT_CVAR, NULL, "Compression Level", &cv_zlib_levela, 135}, - {IT_STRING|IT_CVAR, NULL, "Strategy", &cv_zlib_strategya, 145}, - {IT_STRING|IT_CVAR, NULL, "Window Size", &cv_zlib_window_bitsa, 155}, + {IT_STRING|IT_CVAR, NULL, "Memory Level", &cv_zlib_memorya, 71}, + {IT_STRING|IT_CVAR, NULL, "Compression Level", &cv_zlib_levela, 76}, + {IT_STRING|IT_CVAR, NULL, "Strategy", &cv_zlib_strategya, 81}, + {IT_STRING|IT_CVAR, NULL, "Window Size", &cv_zlib_window_bitsa, 86}, }; enum { - op_screenshot_folder = 1, - op_screenshot_capture = 8, - op_screenshot_gif_start = 9, - op_screenshot_gif_end = 10, - op_screenshot_apng_start = 11, - op_screenshot_apng_end = 14, + op_screenshot_colorprofile = 1, + op_screenshot_folder = 3, + op_screenshot_capture = 10, + op_screenshot_gif_start = 11, + op_screenshot_gif_end = 12, + op_screenshot_apng_start = 13, + op_screenshot_apng_end = 16, }; static menuitem_t OP_EraseDataMenu[] = @@ -1236,15 +1365,15 @@ static menuitem_t OP_EraseDataMenu[] = static menuitem_t OP_AddonsOptionsMenu[] = { - {IT_HEADER, NULL, "Menu", NULL, 0}, - {IT_STRING|IT_CVAR, NULL, "Location", &cv_addons_option, 10}, - {IT_STRING|IT_CVAR|IT_CV_STRING, NULL, "Custom Folder", &cv_addons_folder, 20}, - {IT_STRING|IT_CVAR, NULL, "Identify add-ons via", &cv_addons_md5, 48}, - {IT_STRING|IT_CVAR, NULL, "Show unsupported file types", &cv_addons_showall, 58}, + {IT_HEADER, NULL, "Menu", NULL, 0}, + {IT_STRING|IT_CVAR, NULL, "Location", &cv_addons_option, 12}, + {IT_STRING|IT_CVAR|IT_CV_STRING, NULL, "Custom Folder", &cv_addons_folder, 22}, + {IT_STRING|IT_CVAR, NULL, "Identify add-ons via", &cv_addons_md5, 50}, + {IT_STRING|IT_CVAR, NULL, "Show unsupported file types", &cv_addons_showall, 60}, - {IT_HEADER, NULL, "Search", NULL, 76}, - {IT_STRING|IT_CVAR, NULL, "Matching", &cv_addons_search_type, 86}, - {IT_STRING|IT_CVAR, NULL, "Case-sensitive", &cv_addons_search_case, 96}, + {IT_HEADER, NULL, "Search", NULL, 78}, + {IT_STRING|IT_CVAR, NULL, "Matching", &cv_addons_search_type, 90}, + {IT_STRING|IT_CVAR, NULL, "Case-sensitive", &cv_addons_search_case, 100}, }; enum @@ -1252,125 +1381,76 @@ enum op_addons_folder = 2, }; -static menuitem_t OP_GameOptionsMenu[] = -{ -#ifndef NONET - {IT_STRING | IT_CVAR | IT_CV_STRING, - NULL, "Master server", &cv_masterserver, 10}, - {IT_STRING | IT_SUBMENU, NULL, "Chat Options...", &OP_ChatOptionsDef, 40}, -#endif - {IT_STRING | IT_CVAR, NULL, "Show HUD", &cv_showhud, 50}, - {IT_STRING | IT_CVAR | IT_CV_SLIDER, - NULL, "HUD Visibility", &cv_translucenthud, 60}, - {IT_STRING | IT_CVAR, NULL, "Timer Display", &cv_timetic, 70}, - {IT_STRING | IT_CVAR, NULL, "Always Compact Rankings", &cv_compactscoreboard, 80}, -#ifdef SEENAMES - {IT_STRING | IT_CVAR, NULL, "HUD Player Names", &cv_seenames, 90}, -#endif - {IT_STRING | IT_CVAR, NULL, "Log Hazard Damage", &cv_hazardlog, 100}, - - {IT_STRING | IT_CVAR, NULL, "Console Back Color", &cons_backcolor, 110}, - {IT_STRING | IT_CVAR, NULL, "Console Text Size", &cv_constextsize,120}, - {IT_STRING | IT_CVAR, NULL, "Uppercase Console", &cv_allcaps, 130}, - - {IT_STRING | IT_CVAR, NULL, "Title Screen Demos", &cv_rollingdemos, 140}, -}; - -static menuitem_t OP_ChatOptionsMenu[] = -{ - {IT_STRING | IT_CVAR, NULL, "Chat Mode", &cv_consolechat, 10}, - - {IT_STRING | IT_CVAR | IT_CV_SLIDER, NULL, "Chat Box Width", &cv_chatwidth, 30}, - {IT_STRING | IT_CVAR | IT_CV_SLIDER, NULL, "Chat Box Height", &cv_chatheight, 40}, - {IT_STRING | IT_CVAR, NULL, "Message Fadeout Time", &cv_chattime, 50}, - {IT_STRING | IT_CVAR, NULL, "Chat Notifications", &cv_chatnotifications, 60}, - {IT_STRING | IT_CVAR, NULL, "Spam Protection", &cv_chatspamprotection, 70}, - {IT_STRING | IT_CVAR, NULL, "Chat background tint", &cv_chatbacktint, 80}, -}; - static menuitem_t OP_ServerOptionsMenu[] = { - {IT_STRING | IT_SUBMENU, NULL, "General netgame options...", &OP_NetgameOptionsDef, 10}, - {IT_STRING | IT_SUBMENU, NULL, "Gametype options...", &OP_GametypeOptionsDef, 20}, - {IT_STRING | IT_SUBMENU, NULL, "Random Monitor Toggles...", &OP_MonitorToggleDef, 30}, - + {IT_HEADER, NULL, "General", NULL, 0}, #ifndef NONET {IT_STRING | IT_CVAR | IT_CV_STRING, - NULL, "Server name", &cv_servername, 50}, + NULL, "Server name", &cv_servername, 7}, + {IT_STRING | IT_CVAR, NULL, "Max Players", &cv_maxplayers, 21}, + {IT_STRING | IT_CVAR, NULL, "Allow Add-on Downloading", &cv_downloading, 26}, + {IT_STRING | IT_CVAR, NULL, "Allow players to join", &cv_allownewplayer, 31}, #endif + {IT_STRING | IT_CVAR, NULL, "Map progression", &cv_advancemap, 36}, + {IT_STRING | IT_CVAR, NULL, "Intermission Timer", &cv_inttime, 41}, - {IT_STRING | IT_CVAR, NULL, "Intermission Timer", &cv_inttime, 80}, - {IT_STRING | IT_CVAR, NULL, "Advance to next map", &cv_advancemap, 90}, + {IT_HEADER, NULL, "Characters", NULL, 50}, + {IT_STRING | IT_CVAR, NULL, "Force a character", &cv_forceskin, 56}, + {IT_STRING | IT_CVAR, NULL, "Restrict character changes", &cv_restrictskinchange, 61}, + + {IT_HEADER, NULL, "Items", NULL, 70}, + {IT_STRING | IT_CVAR, NULL, "Item respawn delay", &cv_itemrespawntime, 76}, + {IT_STRING | IT_SUBMENU, NULL, "Mystery Item Monitor Toggles...", &OP_MonitorToggleDef, 81}, + + {IT_HEADER, NULL, "Cooperative", NULL, 90}, + {IT_STRING | IT_CVAR, NULL, "Players required for exit", &cv_playersforexit, 96}, + {IT_STRING | IT_CVAR, NULL, "Starposts", &cv_coopstarposts, 101}, + {IT_STRING | IT_CVAR, NULL, "Life sharing", &cv_cooplives, 106}, + + {IT_HEADER, NULL, "Race, Competition", NULL, 115}, + {IT_STRING | IT_CVAR, NULL, "Level completion countdown", &cv_countdowntime, 121}, + {IT_STRING | IT_CVAR, NULL, "Item Monitors", &cv_competitionboxes, 126}, + + {IT_HEADER, NULL, "Ringslinger (Match, CTF, Tag, H&S)", NULL, 135}, + {IT_STRING | IT_CVAR, NULL, "Time Limit", &cv_timelimit, 141}, + {IT_STRING | IT_CVAR, NULL, "Score Limit", &cv_pointlimit, 146}, + {IT_STRING | IT_CVAR, NULL, "Overtime on Tie", &cv_overtime, 151}, + {IT_STRING | IT_CVAR, NULL, "Player respawn delay", &cv_respawntime, 156}, + + {IT_STRING | IT_CVAR, NULL, "Item Monitors", &cv_matchboxes, 166}, + {IT_STRING | IT_CVAR, NULL, "Weapon Rings", &cv_specialrings, 171}, + {IT_STRING | IT_CVAR, NULL, "Power Stones", &cv_powerstones, 176}, + + {IT_STRING | IT_CVAR, NULL, "Flag respawn delay", &cv_flagtime, 186}, + {IT_STRING | IT_CVAR, NULL, "Hiding time", &cv_hidetime, 191}, + + {IT_HEADER, NULL, "Teams", NULL, 200}, + {IT_STRING | IT_CVAR, NULL, "Autobalance sizes", &cv_autobalance, 206}, + {IT_STRING | IT_CVAR, NULL, "Scramble on Map Change", &cv_scrambleonchange, 211}, #ifndef NONET - {IT_STRING | IT_CVAR, NULL, "Max Players", &cv_maxplayers, 110}, - {IT_STRING | IT_CVAR, NULL, "Allow players to join", &cv_allownewplayer, 120}, - {IT_STRING | IT_CVAR, NULL, "Allow WAD Downloading", &cv_downloading, 130}, - {IT_STRING | IT_CVAR, NULL, "Attempts to Resynch", &cv_resynchattempts, 140}, + {IT_HEADER, NULL, "Advanced", NULL, 220}, + {IT_STRING | IT_CVAR | IT_CV_STRING, NULL, "Master server", &cv_masterserver, 226}, + {IT_STRING | IT_CVAR, NULL, "Attempts to resynchronise", &cv_resynchattempts, 240}, #endif }; -static menuitem_t OP_NetgameOptionsMenu[] = -{ - {IT_STRING | IT_CVAR, NULL, "Time Limit", &cv_timelimit, 10}, - {IT_STRING | IT_CVAR, NULL, "Point Limit", &cv_pointlimit, 18}, - {IT_STRING | IT_CVAR, NULL, "Overtime Tie-Breaker", &cv_overtime, 26}, - - {IT_STRING | IT_CVAR, NULL, "Special Ring Weapons", &cv_specialrings, 42}, - {IT_STRING | IT_CVAR, NULL, "Emeralds", &cv_powerstones, 50}, - {IT_STRING | IT_CVAR, NULL, "Item Boxes", &cv_matchboxes, 58}, - {IT_STRING | IT_CVAR, NULL, "Item Respawn", &cv_itemrespawn, 66}, - {IT_STRING | IT_CVAR, NULL, "Item Respawn time", &cv_itemrespawntime, 74}, - - {IT_STRING | IT_CVAR, NULL, "Sudden Death", &cv_suddendeath, 90}, - {IT_STRING | IT_CVAR, NULL, "Player respawn delay", &cv_respawntime, 98}, - - {IT_STRING | IT_CVAR, NULL, "Force Skin #", &cv_forceskin, 114}, - {IT_STRING | IT_CVAR, NULL, "Restrict skin changes", &cv_restrictskinchange, 122}, - - {IT_STRING | IT_CVAR, NULL, "Autobalance Teams", &cv_autobalance, 138}, - {IT_STRING | IT_CVAR, NULL, "Scramble Teams on Map Change", &cv_scrambleonchange, 146}, -}; - -static menuitem_t OP_GametypeOptionsMenu[] = -{ - {IT_HEADER, NULL, "CO-OP", NULL, 2}, - {IT_STRING | IT_CVAR, NULL, "Players for exit", &cv_playersforexit, 10}, - {IT_STRING | IT_CVAR, NULL, "Starting Lives", &cv_startinglives, 18}, - - {IT_HEADER, NULL, "COMPETITION", NULL, 34}, - {IT_STRING | IT_CVAR, NULL, "Item Boxes", &cv_competitionboxes, 42}, - {IT_STRING | IT_CVAR, NULL, "Countdown Time", &cv_countdowntime, 50}, - - {IT_HEADER, NULL, "RACE", NULL, 66}, - {IT_STRING | IT_CVAR, NULL, "Number of Laps", &cv_numlaps, 74}, - {IT_STRING | IT_CVAR, NULL, "Use Map Lap Counts", &cv_usemapnumlaps, 82}, - - {IT_HEADER, NULL, "MATCH", NULL, 98}, - {IT_STRING | IT_CVAR, NULL, "Scoring Type", &cv_match_scoring, 106}, - - {IT_HEADER, NULL, "TAG", NULL, 122}, - {IT_STRING | IT_CVAR, NULL, "Hide Time", &cv_hidetime, 130}, - - {IT_HEADER, NULL, "CTF", NULL, 146}, - {IT_STRING | IT_CVAR, NULL, "Flag Respawn Time", &cv_flagtime, 154}, -}; - static menuitem_t OP_MonitorToggleMenu[] = { // Printing handled by drawing function - {IT_STRING|IT_CVAR|IT_CV_INVISSLIDER, NULL, "Recycler", &cv_recycler, 20}, - {IT_STRING|IT_CVAR|IT_CV_INVISSLIDER, NULL, "Teleporters", &cv_teleporters, 30}, - {IT_STRING|IT_CVAR|IT_CV_INVISSLIDER, NULL, "Super Ring", &cv_superring, 40}, - {IT_STRING|IT_CVAR|IT_CV_INVISSLIDER, NULL, "Super Sneakers", &cv_supersneakers, 50}, - {IT_STRING|IT_CVAR|IT_CV_INVISSLIDER, NULL, "Invincibility", &cv_invincibility, 60}, - {IT_STRING|IT_CVAR|IT_CV_INVISSLIDER, NULL, "Jump Shield", &cv_jumpshield, 70}, - {IT_STRING|IT_CVAR|IT_CV_INVISSLIDER, NULL, "Elemental Shield", &cv_watershield, 80}, - {IT_STRING|IT_CVAR|IT_CV_INVISSLIDER, NULL, "Attraction Shield", &cv_ringshield, 90}, - {IT_STRING|IT_CVAR|IT_CV_INVISSLIDER, NULL, "Force Shield", &cv_forceshield, 100}, - {IT_STRING|IT_CVAR|IT_CV_INVISSLIDER, NULL, "Armageddon Shield", &cv_bombshield, 110}, - {IT_STRING|IT_CVAR|IT_CV_INVISSLIDER, NULL, "1 Up", &cv_1up, 120}, - {IT_STRING|IT_CVAR|IT_CV_INVISSLIDER, NULL, "Eggman Box", &cv_eggmanbox, 130}, + {IT_STRING|IT_CALL, NULL, "Reset to defaults", M_ResetCvars, 15}, + {IT_STRING|IT_CVAR|IT_CV_INVISSLIDER, NULL, "Recycler", &cv_recycler, 30}, + {IT_STRING|IT_CVAR|IT_CV_INVISSLIDER, NULL, "Teleport", &cv_teleporters, 40}, + {IT_STRING|IT_CVAR|IT_CV_INVISSLIDER, NULL, "Super Ring", &cv_superring, 50}, + {IT_STRING|IT_CVAR|IT_CV_INVISSLIDER, NULL, "Super Sneakers", &cv_supersneakers, 60}, + {IT_STRING|IT_CVAR|IT_CV_INVISSLIDER, NULL, "Invincibility", &cv_invincibility, 70}, + {IT_STRING|IT_CVAR|IT_CV_INVISSLIDER, NULL, "Whirlwind Shield", &cv_jumpshield, 80}, + {IT_STRING|IT_CVAR|IT_CV_INVISSLIDER, NULL, "Elemental Shield", &cv_watershield, 90}, + {IT_STRING|IT_CVAR|IT_CV_INVISSLIDER, NULL, "Attraction Shield", &cv_ringshield, 100}, + {IT_STRING|IT_CVAR|IT_CV_INVISSLIDER, NULL, "Force Shield", &cv_forceshield, 110}, + {IT_STRING|IT_CVAR|IT_CV_INVISSLIDER, NULL, "Armageddon Shield", &cv_bombshield, 120}, + {IT_STRING|IT_CVAR|IT_CV_INVISSLIDER, NULL, "1 Up", &cv_1up, 130}, + {IT_STRING|IT_CVAR|IT_CV_INVISSLIDER, NULL, "Eggman Box", &cv_eggmanbox, 140}, }; // ========================================================================== @@ -1378,10 +1458,11 @@ static menuitem_t OP_MonitorToggleMenu[] = // ========================================================================== // Main Menu and related -menu_t MainDef = CENTERMENUSTYLE(NULL, MainMenu, NULL, 72); +menu_t MainDef = CENTERMENUSTYLE(MN_MAIN, NULL, MainMenu, NULL, 72); menu_t MISC_AddonsDef = { + MN_AD_MAIN, NULL, sizeof (MISC_AddonsMenu)/sizeof (menuitem_t), &MainDef, @@ -1397,9 +1478,23 @@ menu_t SPauseDef = PAUSEMENUSTYLE(SPauseMenu, 40, 72); menu_t MPauseDef = PAUSEMENUSTYLE(MPauseMenu, 40, 72); // Misc Main Menu -menu_t MISC_ScrambleTeamDef = DEFAULTMENUSTYLE(NULL, MISC_ScrambleTeamMenu, &MPauseDef, 27, 40); -menu_t MISC_ChangeTeamDef = DEFAULTMENUSTYLE(NULL, MISC_ChangeTeamMenu, &MPauseDef, 27, 40); -menu_t MISC_ChangeLevelDef = MAPICONMENUSTYLE(NULL, MISC_ChangeLevelMenu, &MPauseDef); +menu_t MISC_ScrambleTeamDef = DEFAULTMENUSTYLE(MN_SPECIAL, NULL, MISC_ScrambleTeamMenu, &MPauseDef, 27, 40); +menu_t MISC_ChangeTeamDef = DEFAULTMENUSTYLE(MN_SPECIAL, NULL, MISC_ChangeTeamMenu, &MPauseDef, 27, 40); + +// MP Gametype and map change menu +menu_t MISC_ChangeLevelDef = +{ + MN_SPECIAL, + NULL, + sizeof (MISC_ChangeLevelMenu)/sizeof (menuitem_t), + &MainDef, // Doesn't matter. + MISC_ChangeLevelMenu, + M_DrawLevelPlatterMenu, + 0, 0, + 0, + NULL +}; + menu_t MISC_HelpDef = IMAGEDEF(MISC_HelpMenu); static INT32 highlightflags, recommendedflags, warningflags; @@ -1408,17 +1503,19 @@ static INT32 highlightflags, recommendedflags, warningflags; // Sky Room menu_t SR_PandoraDef = { + MN_SR_MAIN + (MN_SR_PANDORA << 6), "M_PANDRA", sizeof (SR_PandorasBox)/sizeof (menuitem_t), &SPauseDef, SR_PandorasBox, M_DrawGenericMenu, - 60, 40, + 60, 30, 0, M_ExitPandorasBox }; menu_t SR_MainDef = { + MN_SR_MAIN, "M_SECRET", sizeof (SR_MainMenu)/sizeof (menuitem_t), &MainDef, @@ -1428,30 +1525,26 @@ menu_t SR_MainDef = 0, NULL }; -menu_t SR_LevelSelectDef = -{ - 0, - sizeof (SR_LevelSelectMenu)/sizeof (menuitem_t), - &SR_MainDef, - SR_LevelSelectMenu, - M_DrawLevelSelectMenu, - 40, 40, - 0, - NULL -}; + +menu_t SR_LevelSelectDef = MAPPLATTERMENUSTYLE( + MN_SR_MAIN + (MN_SR_LEVELSELECT << 6), + NULL, SR_LevelSelectMenu); + menu_t SR_UnlockChecklistDef = { - NULL, + MN_SR_MAIN + (MN_SR_UNLOCKCHECKLIST << 6), + "M_SECRET", 1, &SR_MainDef, SR_UnlockChecklistMenu, M_DrawChecklist, - 280, 185, + 30, 30, 0, NULL }; menu_t SR_EmblemHintDef = { + MN_SR_MAIN + (MN_SR_EMBLEMHINT << 6), NULL, sizeof (SR_EmblemHintMenu)/sizeof (menuitem_t), &SPauseDef, @@ -1463,9 +1556,22 @@ menu_t SR_EmblemHintDef = }; // Single Player -menu_t SP_MainDef = CENTERMENUSTYLE(NULL, SP_MainMenu, &MainDef, 72); +menu_t SP_MainDef = //CENTERMENUSTYLE(NULL, SP_MainMenu, &MainDef, 72); +{ + MN_SP_MAIN, + NULL, + sizeof(SP_MainMenu)/sizeof(menuitem_t), + &MainDef, + SP_MainMenu, + M_DrawCenteredMenu, + BASEVIDWIDTH/2, 72, + 1, // start at "Start Game" on first entry + NULL +}; + menu_t SP_LoadDef = { + MN_SP_MAIN + (MN_SP_LOAD << 6), "M_PICKG", 1, &SP_MainDef, @@ -1475,21 +1581,14 @@ menu_t SP_LoadDef = 0, NULL }; -menu_t SP_LevelSelectDef = MAPICONMENUSTYLE(NULL, SP_LevelSelectMenu, &SP_LoadDef); -menu_t SP_GameStatsDef = -{ - "M_STATS", - 1, - &SP_MainDef, - SP_GameStatsMenu, - M_DrawGameStats, - 280, 185, - 0, - NULL -}; +menu_t SP_LevelSelectDef = MAPPLATTERMENUSTYLE( + MN_SP_MAIN + (MN_SP_LOAD << 6) + (MN_SP_PLAYER << 12) + (MN_SP_LEVELSELECT << 18), + NULL, SP_LevelSelectMenu); + menu_t SP_LevelStatsDef = { + MN_SP_MAIN + (MN_SP_LEVELSTATS << 6), "M_STATS", 1, &SP_MainDef, @@ -1500,8 +1599,13 @@ menu_t SP_LevelStatsDef = NULL }; +menu_t SP_TimeAttackLevelSelectDef = MAPPLATTERMENUSTYLE( + MN_SP_MAIN + (MN_SP_TIMEATTACK << 6) + (MN_SP_TIMEATTACK_LEVELSELECT << 12), + "M_ATTACK", SP_TimeAttackLevelSelectMenu); + static menu_t SP_TimeAttackDef = { + MN_SP_MAIN + (MN_SP_TIMEATTACK << 6), "M_ATTACK", sizeof (SP_TimeAttackMenu)/sizeof (menuitem_t), &MainDef, // Doesn't matter. @@ -1513,6 +1617,7 @@ static menu_t SP_TimeAttackDef = }; static menu_t SP_ReplayDef = { + MN_SP_MAIN + (MN_SP_TIMEATTACK << 6) + (MN_SP_REPLAY << 12), "M_ATTACK", sizeof(SP_ReplayMenu)/sizeof(menuitem_t), &SP_TimeAttackDef, @@ -1524,6 +1629,7 @@ static menu_t SP_ReplayDef = }; static menu_t SP_GuestReplayDef = { + MN_SP_MAIN + (MN_SP_TIMEATTACK << 6) + (MN_SP_GUESTREPLAY << 12), "M_ATTACK", sizeof(SP_GuestReplayMenu)/sizeof(menuitem_t), &SP_TimeAttackDef, @@ -1535,6 +1641,7 @@ static menu_t SP_GuestReplayDef = }; static menu_t SP_GhostDef = { + MN_SP_MAIN + (MN_SP_TIMEATTACK << 6) + (MN_SP_GHOST << 12), "M_ATTACK", sizeof(SP_GhostMenu)/sizeof(menuitem_t), &SP_TimeAttackDef, @@ -1545,8 +1652,13 @@ static menu_t SP_GhostDef = NULL }; +menu_t SP_NightsAttackLevelSelectDef = MAPPLATTERMENUSTYLE( + MN_SP_MAIN + (MN_SP_NIGHTSATTACK << 6) + (MN_SP_NIGHTS_LEVELSELECT << 12), + "M_NIGHTS", SP_NightsAttackLevelSelectMenu); + static menu_t SP_NightsAttackDef = { + MN_SP_MAIN + (MN_SP_NIGHTSATTACK << 6), "M_NIGHTS", sizeof (SP_NightsAttackMenu)/sizeof (menuitem_t), &MainDef, // Doesn't matter. @@ -1558,6 +1670,7 @@ static menu_t SP_NightsAttackDef = }; static menu_t SP_NightsReplayDef = { + MN_SP_MAIN + (MN_SP_NIGHTSATTACK << 6) + (MN_SP_NIGHTS_REPLAY << 12), "M_NIGHTS", sizeof(SP_NightsReplayMenu)/sizeof(menuitem_t), &SP_NightsAttackDef, @@ -1569,6 +1682,7 @@ static menu_t SP_NightsReplayDef = }; static menu_t SP_NightsGuestReplayDef = { + MN_SP_MAIN + (MN_SP_NIGHTSATTACK << 6) + (MN_SP_NIGHTS_GUESTREPLAY << 12), "M_NIGHTS", sizeof(SP_NightsGuestReplayMenu)/sizeof(menuitem_t), &SP_NightsAttackDef, @@ -1580,6 +1694,7 @@ static menu_t SP_NightsGuestReplayDef = }; static menu_t SP_NightsGhostDef = { + MN_SP_MAIN + (MN_SP_NIGHTSATTACK << 6) + (MN_SP_NIGHTS_GHOST << 12), "M_NIGHTS", sizeof(SP_NightsGhostMenu)/sizeof(menuitem_t), &SP_NightsAttackDef, @@ -1593,10 +1708,11 @@ static menu_t SP_NightsGhostDef = menu_t SP_PlayerDef = { + MN_SP_MAIN + (MN_SP_LOAD << 6) + (MN_SP_PLAYER << 12), "M_PICKP", - sizeof (PlayerMenu)/sizeof (menuitem_t),//player_end, + sizeof (SP_PlayerMenu)/sizeof (menuitem_t), &SP_MainDef, - PlayerMenu, + SP_PlayerMenu, M_DrawSetupChoosePlayerMenu, 24, 32, 0, @@ -1604,11 +1720,55 @@ menu_t SP_PlayerDef = }; // Multiplayer -menu_t MP_MainDef = DEFAULTMENUSTYLE("M_MULTI", MP_MainMenu, &MainDef, 60, 40); -menu_t MP_ServerDef = MAPICONMENUSTYLE("M_MULTI", MP_ServerMenu, &MP_MainDef); + +menu_t MP_SplitServerDef = +{ + MN_MP_MAIN + (MN_MP_SPLITSCREEN << 6), + "M_MULTI", + sizeof (MP_SplitServerMenu)/sizeof (menuitem_t), #ifndef NONET + &MP_MainDef, +#else + &MainDef, +#endif + MP_SplitServerMenu, + M_DrawServerMenu, + 27, 30 - 50, + 0, + NULL +}; + +#ifndef NONET + +menu_t MP_MainDef = +{ + MN_MP_MAIN, + "M_MULTI", + sizeof (MP_MainMenu)/sizeof (menuitem_t), + &MainDef, + MP_MainMenu, + M_DrawMPMainMenu, + 27, 40, + 0, + M_CancelConnect +}; + +menu_t MP_ServerDef = +{ + MN_MP_MAIN + (MN_MP_SERVER << 6), + "M_MULTI", + sizeof (MP_ServerMenu)/sizeof (menuitem_t), + &MP_MainDef, + MP_ServerMenu, + M_DrawServerMenu, + 27, 30, + 0, + NULL +}; + menu_t MP_ConnectDef = { + MN_MP_MAIN + (MN_MP_CONNECT << 6), "M_MULTI", sizeof (MP_ConnectMenu)/sizeof (menuitem_t), &MP_MainDef, @@ -1618,19 +1778,10 @@ menu_t MP_ConnectDef = 0, M_CancelConnect }; -menu_t MP_ConnectIPDef = -{ - "M_MULTI", - sizeof (MP_ConnectIPMenu)/sizeof (menuitem_t), - &MP_MainDef, - MP_ConnectIPMenu, - M_DrawConnectIPMenu, - 27,40, - 0, - M_CancelConnect -}; + menu_t MP_RoomDef = { + MN_MP_MAIN + (MN_MP_ROOM << 6), "M_MULTI", sizeof (MP_RoomMenu)/sizeof (menuitem_t), &MP_ConnectDef, @@ -1641,47 +1792,77 @@ menu_t MP_RoomDef = NULL }; #endif -menu_t MP_SplitServerDef = MAPICONMENUSTYLE("M_MULTI", MP_SplitServerMenu, &MP_MainDef); + menu_t MP_PlayerSetupDef = { +#ifdef NONET + MN_MP_MAIN + (MN_MP_PLAYERSETUP << 6), +#else + MN_MP_MAIN + (MN_MP_SPLITSCREEN << 6) + (MN_MP_PLAYERSETUP << 12), +#endif "M_SPLAYR", sizeof (MP_PlayerSetupMenu)/sizeof (menuitem_t), - &MP_MainDef, + &MainDef, // doesn't matter MP_PlayerSetupMenu, M_DrawSetupMultiPlayerMenu, - 27, 40, + 19, 22, 0, M_QuitMultiPlayerMenu }; // Options -menu_t OP_MainDef = DEFAULTMENUSTYLE("M_OPTTTL", OP_MainMenu, &MainDef, 60, 30); -menu_t OP_ControlsDef = DEFAULTMENUSTYLE("M_CONTRO", OP_ControlsMenu, &OP_MainDef, 60, 30); -menu_t OP_ControlListDef = DEFAULTMENUSTYLE("M_CONTRO", OP_ControlListMenu, &OP_ControlsDef, 60, 30); -menu_t OP_MoveControlsDef = CONTROLMENUSTYLE(OP_MoveControlsMenu, &OP_ControlListDef); -menu_t OP_MPControlsDef = CONTROLMENUSTYLE(OP_MPControlsMenu, &OP_ControlListDef); -menu_t OP_MiscControlsDef = CONTROLMENUSTYLE(OP_MiscControlsMenu, &OP_ControlListDef); -menu_t OP_P1ControlsDef = DEFAULTMENUSTYLE("M_CONTRO", OP_P1ControlsMenu, &OP_ControlsDef, 60, 30); -menu_t OP_P2ControlsDef = DEFAULTMENUSTYLE("M_CONTRO", OP_P2ControlsMenu, &OP_ControlsDef, 60, 30); -menu_t OP_MouseOptionsDef = DEFAULTMENUSTYLE("M_CONTRO", OP_MouseOptionsMenu, &OP_P1ControlsDef, 60, 30); -menu_t OP_Mouse2OptionsDef = DEFAULTMENUSTYLE("M_CONTRO", OP_Mouse2OptionsMenu, &OP_P2ControlsDef, 60, 30); -menu_t OP_Joystick1Def = DEFAULTMENUSTYLE("M_CONTRO", OP_Joystick1Menu, &OP_P1ControlsDef, 60, 30); -menu_t OP_Joystick2Def = DEFAULTMENUSTYLE("M_CONTRO", OP_Joystick2Menu, &OP_P2ControlsDef, 60, 30); +menu_t OP_MainDef = DEFAULTMENUSTYLE( + MN_OP_MAIN, + "M_OPTTTL", OP_MainMenu, &MainDef, 50, 30); +menu_t OP_ChangeControlsDef = CONTROLMENUSTYLE( + MN_OP_MAIN + (MN_OP_CHANGECONTROLS << 12), // second level (<<6) set on runtime + OP_ChangeControlsMenu, &OP_MainDef); +menu_t OP_P1ControlsDef = DEFAULTMENUSTYLE( + MN_OP_MAIN + (MN_OP_P1CONTROLS << 6), + "M_CONTRO", OP_P1ControlsMenu, &OP_MainDef, 50, 30); +menu_t OP_P2ControlsDef = DEFAULTMENUSTYLE( + MN_OP_MAIN + (MN_OP_P2CONTROLS << 6), + "M_CONTRO", OP_P2ControlsMenu, &OP_MainDef, 50, 30); +menu_t OP_MouseOptionsDef = DEFAULTMENUSTYLE( + MN_OP_MAIN + (MN_OP_P1CONTROLS << 6) + (MN_OP_P1MOUSE << 12), + "M_CONTRO", OP_MouseOptionsMenu, &OP_P1ControlsDef, 35, 30); +menu_t OP_Mouse2OptionsDef = DEFAULTMENUSTYLE( + MN_OP_MAIN + (MN_OP_P2CONTROLS << 6) + (MN_OP_P2MOUSE << 12), + "M_CONTRO", OP_Mouse2OptionsMenu, &OP_P2ControlsDef, 35, 30); +menu_t OP_Joystick1Def = DEFAULTMENUSTYLE( + MN_OP_MAIN + (MN_OP_P1CONTROLS << 6) + (MN_OP_P1JOYSTICK << 12), + "M_CONTRO", OP_Joystick1Menu, &OP_P1ControlsDef, 50, 30); +menu_t OP_Joystick2Def = DEFAULTMENUSTYLE( + MN_OP_MAIN + (MN_OP_P2CONTROLS << 6) + (MN_OP_P2JOYSTICK << 12), + "M_CONTRO", OP_Joystick2Menu, &OP_P2ControlsDef, 50, 30); menu_t OP_JoystickSetDef = { + MN_OP_MAIN + (MN_OP_JOYSTICKSET << MENUBITS*3), // second (<<6) and third level (<<12) set on runtime "M_CONTRO", sizeof (OP_JoystickSetMenu)/sizeof (menuitem_t), &OP_Joystick1Def, OP_JoystickSetMenu, M_DrawJoystick, - 50, 40, + 60, 40, 0, NULL }; -menu_t OP_VideoOptionsDef = DEFAULTMENUSTYLE("M_VIDEO", OP_VideoOptionsMenu, &OP_MainDef, 60, 30); +menu_t OP_VideoOptionsDef = +{ + MN_OP_MAIN + (MN_OP_VIDEO << 6), + "M_VIDEO", + sizeof (OP_VideoOptionsMenu)/sizeof (menuitem_t), + &OP_MainDef, + OP_VideoOptionsMenu, + M_DrawMainVideoMenu, + 30, 30, + 0, + NULL +}; menu_t OP_VideoModeDef = { + MN_OP_MAIN + (MN_OP_VIDEO << 6) + (MN_OP_VIDEOMODE << 12), "M_VIDEO", 1, &OP_VideoOptionsDef, @@ -1691,15 +1872,38 @@ menu_t OP_VideoModeDef = 0, NULL }; -menu_t OP_SoundOptionsDef = DEFAULTMENUSTYLE("M_SOUND", OP_SoundOptionsMenu, &OP_MainDef, 60, 30); -menu_t OP_GameOptionsDef = DEFAULTMENUSTYLE("M_GAME", OP_GameOptionsMenu, &OP_MainDef, 30, 30); -menu_t OP_ServerOptionsDef = DEFAULTMENUSTYLE("M_SERVER", OP_ServerOptionsMenu, &OP_MainDef, 30, 30); +menu_t OP_ColorOptionsDef = +{ + MN_OP_MAIN + (MN_OP_VIDEO << 6) + (MN_OP_COLOR << 12), + "M_VIDEO", + sizeof (OP_ColorOptionsMenu)/sizeof (menuitem_t), + &OP_VideoOptionsDef, + OP_ColorOptionsMenu, + M_DrawColorMenu, + 30, 30, + 0, + NULL +}; +menu_t OP_SoundOptionsDef = +{ + MN_OP_MAIN + (MN_OP_SOUND << 6), + "M_SOUND", + sizeof (OP_SoundOptionsMenu)/sizeof (menuitem_t), + &OP_MainDef, + OP_SoundOptionsMenu, + M_DrawGenericMenu, + 30, 30, + 0, + NULL +}; + +menu_t OP_ServerOptionsDef = DEFAULTSCROLLMENUSTYLE( + MN_OP_MAIN + (MN_OP_SERVER << 6), + "M_SERVER", OP_ServerOptionsMenu, &OP_MainDef, 30, 30); -menu_t OP_NetgameOptionsDef = DEFAULTMENUSTYLE("M_SERVER", OP_NetgameOptionsMenu, &OP_ServerOptionsDef, 30, 30); -menu_t OP_GametypeOptionsDef = DEFAULTMENUSTYLE("M_SERVER", OP_GametypeOptionsMenu, &OP_ServerOptionsDef, 30, 30); -menu_t OP_ChatOptionsDef = DEFAULTMENUSTYLE("M_GAME", OP_ChatOptionsMenu, &OP_GameOptionsDef, 30, 30); menu_t OP_MonitorToggleDef = { + MN_OP_MAIN + (MN_OP_SERVER << 6) + (MN_OP_MONITORTOGGLE << 12), "M_SERVER", sizeof (OP_MonitorToggleMenu)/sizeof (menuitem_t), &OP_ServerOptionsDef, @@ -1711,12 +1915,17 @@ menu_t OP_MonitorToggleDef = }; #ifdef HWRENDER -menu_t OP_OpenGLOptionsDef = DEFAULTMENUSTYLE("M_VIDEO", OP_OpenGLOptionsMenu, &OP_VideoOptionsDef, 30, 30); +menu_t OP_OpenGLOptionsDef = DEFAULTMENUSTYLE( + MN_OP_MAIN + (MN_OP_VIDEO << 6) + (MN_OP_OPENGL << 12), + "M_VIDEO", OP_OpenGLOptionsMenu, &OP_VideoOptionsDef, 30, 30); #ifdef ALAM_LIGHTING -menu_t OP_OpenGLLightingDef = DEFAULTMENUSTYLE("M_VIDEO", OP_OpenGLLightingMenu, &OP_OpenGLOptionsDef, 60, 40); +menu_t OP_OpenGLLightingDef = DEFAULTMENUSTYLE( + MN_OP_MAIN + (MN_OP_VIDEO << 6) + (MN_OP_OPENGL << 12) + (MN_OP_OPENGL_LIGHTING << 18), + "M_VIDEO", OP_OpenGLLightingMenu, &OP_OpenGLOptionsDef, 60, 40); #endif menu_t OP_OpenGLFogDef = { + MN_OP_MAIN + (MN_OP_VIDEO << 6) + (MN_OP_OPENGL << 12) + (MN_OP_OPENGL_FOG << 18), "M_VIDEO", sizeof (OP_OpenGLFogMenu)/sizeof (menuitem_t), &OP_OpenGLOptionsDef, @@ -1728,6 +1937,7 @@ menu_t OP_OpenGLFogDef = }; menu_t OP_OpenGLColorDef = { + MN_OP_MAIN + (MN_OP_VIDEO << 6) + (MN_OP_OPENGL << 12) + (MN_OP_OPENGL_COLOR << 18), "M_VIDEO", sizeof (OP_OpenGLColorMenu)/sizeof (menuitem_t), &OP_OpenGLOptionsDef, @@ -1738,10 +1948,30 @@ menu_t OP_OpenGLColorDef = NULL }; #endif -menu_t OP_DataOptionsDef = DEFAULTMENUSTYLE("M_DATA", OP_DataOptionsMenu, &OP_MainDef, 60, 30); -menu_t OP_ScreenshotOptionsDef = DEFAULTMENUSTYLE("M_DATA", OP_ScreenshotOptionsMenu, &OP_DataOptionsDef, 30, 30); -menu_t OP_AddonsOptionsDef = DEFAULTMENUSTYLE("M_ADDONS", OP_AddonsOptionsMenu, &OP_MainDef, 30, 30); -menu_t OP_EraseDataDef = DEFAULTMENUSTYLE("M_DATA", OP_EraseDataMenu, &OP_DataOptionsDef, 60, 30); +menu_t OP_DataOptionsDef = DEFAULTMENUSTYLE( + MN_OP_MAIN + (MN_OP_DATA << 6), + "M_DATA", OP_DataOptionsMenu, &OP_MainDef, 60, 30); + +menu_t OP_ScreenshotOptionsDef = +{ + MN_OP_MAIN + (MN_OP_DATA << 6) + (MN_OP_SCREENSHOTS << 12), + "M_DATA", + sizeof (OP_ScreenshotOptionsMenu)/sizeof (menuitem_t), + &OP_DataOptionsDef, + OP_ScreenshotOptionsMenu, + M_DrawScreenshotMenu, + 30, 30, + 0, + NULL +}; + +menu_t OP_AddonsOptionsDef = DEFAULTMENUSTYLE( + MN_OP_MAIN + (MN_OP_DATA << 6) + (MN_OP_ADDONS << 12), + "M_ADDONS", OP_AddonsOptionsMenu, &OP_DataOptionsDef, 30, 30); + +menu_t OP_EraseDataDef = DEFAULTMENUSTYLE( + MN_OP_MAIN + (MN_OP_DATA << 6) + (MN_OP_ERASEDATA << 12), + "M_DATA", OP_EraseDataMenu, &OP_DataOptionsDef, 60, 30); // ========================================================================== // CVAR ONCHANGE EVENTS GO HERE @@ -1749,11 +1979,11 @@ menu_t OP_EraseDataDef = DEFAULTMENUSTYLE("M_DATA", OP_EraseDataMenu, &OP_DataOp // (there's only a couple anyway) // Prototypes -static INT32 M_FindFirstMap(INT32 gtype); -static INT32 M_GetFirstLevelInList(void); +static INT32 M_GetFirstLevelInList(INT32 gt); +static boolean M_CanShowLevelOnPlatter(INT32 mapnum, INT32 gt); -// Nextmap. Used for Time Attack. -static void Nextmap_OnChange(void) +// Nextmap. Used for Level select. +void Nextmap_OnChange(void) { char *leveltitle; char tabase[256]; @@ -1825,7 +2055,7 @@ static void Nextmap_OnChange(void) SP_TimeAttackMenu[taghost].status = IT_DISABLED; // Check if file exists, if not, disable REPLAY option - sprintf(tabase,"%s"PATHSEP"replay"PATHSEP"%s"PATHSEP"%s-%s",srb2home, timeattackfolder, G_BuildMapName(cv_nextmap.value), cv_chooseskin.string); + sprintf(tabase,"%s"PATHSEP"replay"PATHSEP"%s"PATHSEP"%s-%s",srb2home, timeattackfolder, G_BuildMapName(cv_nextmap.value), skins[cv_chooseskin.value-1].name); for (i = 0; i < 5; i++) { SP_ReplayMenu[i].status = IT_DISABLED; SP_GuestReplayMenu[i].status = IT_DISABLED; @@ -1897,43 +2127,8 @@ static void Newgametype_OnChange(void) if(!mapheaderinfo[cv_nextmap.value-1]) P_AllocMapHeader((INT16)(cv_nextmap.value-1)); - if ((cv_newgametype.value == GT_COOP && !(mapheaderinfo[cv_nextmap.value-1]->typeoflevel & TOL_COOP)) || - (cv_newgametype.value == GT_COMPETITION && !(mapheaderinfo[cv_nextmap.value-1]->typeoflevel & TOL_COMPETITION)) || - (cv_newgametype.value == GT_RACE && !(mapheaderinfo[cv_nextmap.value-1]->typeoflevel & TOL_RACE)) || - ((cv_newgametype.value == GT_MATCH || cv_newgametype.value == GT_TEAMMATCH) && !(mapheaderinfo[cv_nextmap.value-1]->typeoflevel & TOL_MATCH)) || - ((cv_newgametype.value == GT_TAG || cv_newgametype.value == GT_HIDEANDSEEK) && !(mapheaderinfo[cv_nextmap.value-1]->typeoflevel & TOL_TAG)) || - (cv_newgametype.value == GT_CTF && !(mapheaderinfo[cv_nextmap.value-1]->typeoflevel & TOL_CTF))) - { - INT32 value = 0; - - switch (cv_newgametype.value) - { - case GT_COOP: - value = TOL_COOP; - break; - case GT_COMPETITION: - value = TOL_COMPETITION; - break; - case GT_RACE: - value = TOL_RACE; - break; - case GT_MATCH: - case GT_TEAMMATCH: - value = TOL_MATCH; - break; - case GT_TAG: - case GT_HIDEANDSEEK: - value = TOL_TAG; - break; - case GT_CTF: - value = TOL_CTF; - break; - } - - CV_SetValue(&cv_nextmap, M_FindFirstMap(value)); - CV_AddValue(&cv_nextmap, -1); - CV_AddValue(&cv_nextmap, 1); - } + if (!M_CanShowLevelOnPlatter(cv_nextmap.value-1, cv_newgametype.value)) + CV_SetValue(&cv_nextmap, M_GetFirstLevelInList(cv_newgametype.value)); } } @@ -1979,36 +2174,546 @@ void Addons_option_Onchange(void) // current menudef menu_t *currentMenu = &MainDef; +// ========================================================================= +// MENU PRESENTATION PARAMETER HANDLING (BACKGROUNDS) +// ========================================================================= + +// menu IDs are equal to current/prevMenu in most cases, except MN_SPECIAL when we don't want to operate on Message, Pause, etc. +UINT32 prevMenuId = 0; +UINT32 activeMenuId = 0; + +menupres_t menupres[NUMMENUTYPES]; + +void M_InitMenuPresTables(void) +{ + INT32 i; + + // Called in d_main before SOC can get to the tables + // Set menupres defaults + for (i = 0; i < NUMMENUTYPES; i++) + { + // so-called "undefined" + menupres[i].fadestrength = -1; + menupres[i].hidetitlepics = -1; // inherits global hidetitlepics + menupres[i].enterwipe = -1; + menupres[i].exitwipe = -1; + menupres[i].bgcolor = -1; + menupres[i].titlescrollxspeed = INT32_MAX; + menupres[i].titlescrollyspeed = INT32_MAX; + menupres[i].bghide = true; + // default true + menupres[i].enterbubble = true; + menupres[i].exitbubble = true; + + if (i != MN_MAIN) + { + menupres[i].muslooping = true; + } + if (i == MN_SP_TIMEATTACK || i == MN_SP_NIGHTSATTACK) + strncpy(menupres[i].musname, "_inter", 7); + else if (i == MN_SP_PLAYER) + strncpy(menupres[i].musname, "_chsel", 7); + } +} + +// ==================================== +// TREE ITERATION +// ==================================== + +// UINT32 menutype - current menutype_t +// INT32 level - current level up the tree, higher means younger +// INT32 *retval - Return value +// void *input - Pointer to input of any type +// +// return true - stop iterating +// return false - continue +typedef boolean (*menutree_iterator)(UINT32, INT32, INT32 *, void **, boolean fromoldest); + +// HACK: Used in the ChangeMusic iterator because we only allow +// a single input. Maybe someday use this struct program-wide. +typedef struct +{ + char musname[7]; + UINT16 mustrack; + boolean muslooping; +} menupresmusic_t; + +static INT32 M_IterateMenuTree(menutree_iterator itfunc, void *input) +{ + INT32 i, retval = 0; + UINT32 bitmask, menutype; + + for (i = NUMMENULEVELS; i >= 0; i--) + { + bitmask = ((1 << MENUBITS) - 1) << (MENUBITS*i); + menutype = (activeMenuId & bitmask) >> (MENUBITS*i); + if (itfunc(menutype, i, &retval, &input, false)) + break; + } + + return retval; +} + +// ==================================== +// ITERATORS +// ==================================== + +static boolean MIT_GetMenuAtLevel(UINT32 menutype, INT32 level, INT32 *retval, void **input, boolean fromoldest) +{ + INT32 *inputptr = (INT32*)*input; + INT32 targetlevel = *inputptr; + if (menutype) + { + if (level == targetlevel || targetlevel < 0) + { + *retval = menutype; + return true; + } + } + else if (targetlevel >= 0) + { + // offset targetlevel by failed attempts; this should only happen in beginning of iteration + if (fromoldest) + (*inputptr)++; + else + (*inputptr)--; // iterating backwards, so count from highest + } + return false; +} + +static boolean MIT_SetCurBackground(UINT32 menutype, INT32 level, INT32 *retval, void **input, boolean fromoldest) +{ + char *defaultname = (char*)*input; + + (void)retval; + (void)fromoldest; + + if (menupres[menutype].bgcolor >= 0) + { + curbgcolor = menupres[menutype].bgcolor; + return true; + } + else if (menupres[menutype].bgname[0] && (!menupres[menutype].bghide || !titlemapinaction)) + { + strncpy(curbgname, menupres[menutype].bgname, 8); + curbgxspeed = menupres[menutype].titlescrollxspeed != INT32_MAX ? menupres[menutype].titlescrollxspeed : titlescrollxspeed; + curbgyspeed = menupres[menutype].titlescrollyspeed != INT32_MAX ? menupres[menutype].titlescrollyspeed : titlescrollyspeed; + return true; + } + else if (menupres[menutype].bghide && titlemapinaction) // hide the background + { + curbghide = true; + return true; + } + else if (!level) + { + if (M_GetYoungestChildMenu() == MN_SP_PLAYER || !defaultname || !defaultname[0]) + curbgcolor = 31; + else if (titlemapinaction) // hide the background by default in titlemap + curbghide = true; + else + { + strncpy(curbgname, defaultname, 8); + curbgxspeed = (gamestate == GS_TIMEATTACK) ? 0 : titlescrollxspeed; + curbgyspeed = (gamestate == GS_TIMEATTACK) ? 0 : titlescrollyspeed; + } + } + return false; +} + +static boolean MIT_ChangeMusic(UINT32 menutype, INT32 level, INT32 *retval, void **input, boolean fromoldest) +{ + menupresmusic_t *defaultmusic = (menupresmusic_t*)*input; + + (void)retval; + (void)fromoldest; + + if (menupres[menutype].musname[0]) + { + S_ChangeMusic(menupres[menutype].musname, menupres[menutype].mustrack, menupres[menutype].muslooping); + return true; + } + else if (menupres[menutype].musstop) + { + S_StopMusic(); + return true; + } + else if (menupres[menutype].musignore) + return true; + else if (!level && defaultmusic && defaultmusic->musname[0]) + S_ChangeMusic(defaultmusic->musname, defaultmusic->mustrack, defaultmusic->muslooping); + return false; +} + +static boolean MIT_SetCurFadeValue(UINT32 menutype, INT32 level, INT32 *retval, void **input, boolean fromoldest) +{ + UINT8 defaultvalue = *(UINT8*)*input; + + (void)retval; + (void)fromoldest; + + if (menupres[menutype].fadestrength >= 0) + { + curfadevalue = (menupres[menutype].fadestrength % 32); + return true; + } + else if (!level) + curfadevalue = (gamestate == GS_TIMEATTACK) ? 0 : (defaultvalue % 32); + return false; +} + +static boolean MIT_SetCurHideTitlePics(UINT32 menutype, INT32 level, INT32 *retval, void **input, boolean fromoldest) +{ + (void)input; + (void)retval; + (void)fromoldest; + + if (menupres[menutype].hidetitlepics >= 0) + { + curhidepics = menupres[menutype].hidetitlepics; + return true; + } + else if (!level) + curhidepics = hidetitlepics; + return false; +} + +// ==================================== +// TREE RETRIEVAL +// ==================================== + +UINT8 M_GetYoungestChildMenu(void) // aka the active menu +{ + INT32 targetlevel = -1; + return M_IterateMenuTree(MIT_GetMenuAtLevel, &targetlevel); +} + +// ==================================== +// EFFECTS +// ==================================== + +void M_ChangeMenuMusic(const char *defaultmusname, boolean defaultmuslooping) +{ + menupresmusic_t defaultmusic; + + if (!defaultmusname) + defaultmusname = ""; + + strncpy(defaultmusic.musname, defaultmusname, 7); + defaultmusic.musname[6] = 0; + defaultmusic.mustrack = 0; + defaultmusic.muslooping = defaultmuslooping; + + M_IterateMenuTree(MIT_ChangeMusic, &defaultmusic); +} + +void M_SetMenuCurBackground(const char *defaultname) +{ + char name[8]; + strncpy(name, defaultname, 8); + M_IterateMenuTree(MIT_SetCurBackground, &name); +} + +void M_SetMenuCurFadeValue(UINT8 defaultvalue) +{ + M_IterateMenuTree(MIT_SetCurFadeValue, &defaultvalue); +} + +void M_SetMenuCurHideTitlePics(void) +{ + M_IterateMenuTree(MIT_SetCurHideTitlePics, NULL); +} + +// ==================================== +// MENU STATE +// ==================================== + +static INT32 exitlevel, enterlevel, anceslevel; +static INT16 exittype, entertype; +static INT16 exitwipe, enterwipe; +static boolean exitbubble, enterbubble; +static INT16 exittag, entertag; + +static void M_HandleMenuPresState(menu_t *newMenu) +{ + INT32 i; + UINT32 bitmask; + SINT8 prevtype, activetype, menutype; + + if (!newMenu) + return; + + // Look for MN_SPECIAL here, because our iterators can't look at new menu IDs + for (i = 0; i <= NUMMENULEVELS; i++) + { + bitmask = ((1 << MENUBITS) - 1) << (MENUBITS*i); + menutype = (newMenu->menuid & bitmask) >> (MENUBITS*i); + prevtype = (currentMenu->menuid & bitmask) >> (MENUBITS*i); + if (menutype == MN_SPECIAL || prevtype == MN_SPECIAL) + return; + } + + if (currentMenu && newMenu && currentMenu->menuid == newMenu->menuid) // same menu? + return; + + exittype = entertype = exitlevel = enterlevel = anceslevel = exitwipe = enterwipe = -1; + exitbubble = enterbubble = true; + + prevMenuId = currentMenu ? currentMenu->menuid : 0; + activeMenuId = newMenu ? newMenu->menuid : 0; + + // Set defaults for presentation values + strncpy(curbgname, "TITLESKY", 8); + curfadevalue = 16; + curhidepics = hidetitlepics; + curbgcolor = -1; + curbgxspeed = titlescrollxspeed; + curbgyspeed = titlescrollyspeed; + curbghide = true; + + // don't do the below during the in-game menus + if (gamestate != GS_TITLESCREEN && gamestate != GS_TIMEATTACK) + return; + + // Find current presentation values + M_SetMenuCurBackground((gamestate == GS_TIMEATTACK) ? "SRB2BACK" : "TITLESKY"); + M_SetMenuCurFadeValue(16); + M_SetMenuCurHideTitlePics(); + + // Loop through both menu IDs in parallel and look for type changes + // The youngest child in activeMenuId is the entered menu + // The youngest child in prevMenuId is the exited menu + + // 0. Get the type and level of each menu, and level of common ancestor + // 1. Get the wipes for both, then run the exit wipe + // 2. Change music (so that execs can change it again later) + // 3. Run each exit exec on the prevMenuId up to the common ancestor (UNLESS NoBubbleExecs) + // 4. Run each entrance exec on the activeMenuId down from the common ancestor (UNLESS NoBubbleExecs) + // 5. Run the entrance wipe + + // Get the parameters for each menu + for (i = NUMMENULEVELS; i >= 0; i--) + { + bitmask = ((1 << MENUBITS) - 1) << (MENUBITS*i); + prevtype = (prevMenuId & bitmask) >> (MENUBITS*i); + activetype = (activeMenuId & bitmask) >> (MENUBITS*i); + + if (prevtype && (exittype < 0)) + { + exittype = prevtype; + exitlevel = i; + exitwipe = menupres[exittype].exitwipe; + exitbubble = menupres[exittype].exitbubble; + exittag = menupres[exittype].exittag; + } + + if (activetype && (entertype < 0)) + { + entertype = activetype; + enterlevel = i; + enterwipe = menupres[entertype].enterwipe; + enterbubble = menupres[entertype].enterbubble; + entertag = menupres[entertype].entertag; + } + + if (prevtype && activetype && prevtype == activetype && anceslevel < 0) + { + anceslevel = i; + break; + } + } + + // if no common ancestor (top menu), force a wipe. Look for a specified wipe first. + // Don't force a wipe if you're actually going to/from the main menu + if (anceslevel < 0 && exitwipe < 0 && newMenu != &MainDef && currentMenu != &MainDef) + { + for (i = NUMMENULEVELS; i >= 0; i--) + { + bitmask = ((1 << MENUBITS) - 1) << (MENUBITS*i); + prevtype = (prevMenuId & bitmask) >> (MENUBITS*i); + + if (menupres[prevtype].exitwipe >= 0) + { + exitwipe = menupres[prevtype].exitwipe; + break; + } + } + + if (exitwipe < 0) + exitwipe = menupres[MN_MAIN].exitwipe; + } + + // do the same for enter wipe + if (anceslevel < 0 && enterwipe < 0 && newMenu != &MainDef && currentMenu != &MainDef) + { + for (i = NUMMENULEVELS; i >= 0; i--) + { + bitmask = ((1 << MENUBITS) - 1) << (MENUBITS*i); + activetype = (activeMenuId & bitmask) >> (MENUBITS*i); + + if (menupres[activetype].enterwipe >= 0) + { + exitwipe = menupres[activetype].enterwipe; + break; + } + } + + if (enterwipe < 0) + enterwipe = menupres[MN_MAIN].enterwipe; + } + + // Change the music + M_ChangeMenuMusic("_title", false); + + // Run the linedef execs + if (titlemapinaction) + { + // Run the exit tags + if (enterlevel <= exitlevel) // equals is an edge case + { + if (exitbubble) + { + for (i = exitlevel; i > anceslevel; i--) // don't run the common ancestor's exit tag + { + bitmask = ((1 << MENUBITS) - 1) << (MENUBITS*i); + menutype = (prevMenuId & bitmask) >> (MENUBITS*i); + if (menupres[menutype].exittag) + P_LinedefExecute(menupres[menutype].exittag, players[displayplayer].mo, NULL); + } + } + else if (exittag) + P_LinedefExecute(exittag, players[displayplayer].mo, NULL); + } + + // Run the enter tags + if (enterlevel >= exitlevel) // equals is an edge case + { + if (enterbubble) + { + for (i = anceslevel+1; i <= enterlevel; i++) // don't run the common ancestor's enter tag + { + bitmask = ((1 << MENUBITS) - 1) << (MENUBITS*i); + menutype = (activeMenuId & bitmask) >> (MENUBITS*i); + if (menupres[menutype].entertag) + P_LinedefExecute(menupres[menutype].entertag, players[displayplayer].mo, NULL); + } + } + else if (entertag) + P_LinedefExecute(entertag, players[displayplayer].mo, NULL); + } + } + + + // Set the wipes for next frame + if ( + (exitwipe >= 0 && enterlevel <= exitlevel) || + (enterwipe >= 0 && enterlevel >= exitlevel) || + (anceslevel < 0 && newMenu != &MainDef && currentMenu != &MainDef) + ) + { + if (gamestate == GS_TIMEATTACK) + wipetypepre = ((exitwipe && enterlevel <= exitlevel) || anceslevel < 0) ? exitwipe : -1; // force default + else + // HACK: INT16_MAX signals to not wipe + // because 0 is a valid index and -1 means default + wipetypepre = ((exitwipe && enterlevel <= exitlevel) || anceslevel < 0) ? exitwipe : INT16_MAX; + wipetypepost = ((enterwipe && enterlevel >= exitlevel) || anceslevel < 0) ? enterwipe : INT16_MAX; + wipegamestate = FORCEWIPE; + + // If just one of the above is a force not-wipe, + // mirror the other wipe. + if (wipetypepre != INT16_MAX && wipetypepost == INT16_MAX) + wipetypepost = wipetypepre; + else if (wipetypepost != INT16_MAX && wipetypepre == INT16_MAX) + wipetypepre = wipetypepost; + + // D_Display runs the next step of processing + } +} + // ========================================================================= // BASIC MENU HANDLING // ========================================================================= +static void M_GoBack(INT32 choice) +{ + (void)choice; + + if (currentMenu->prevMenu) + { + //If we entered the game search menu, but didn't enter a game, + //make sure the game doesn't still think we're in a netgame. + if (!Playing() && netgame && multiplayer) + { + MSCloseUDPSocket(); // Clean up so we can re-open the connection later. + netgame = multiplayer = false; + } + + if ((currentMenu->prevMenu == &MainDef) && (currentMenu == &SP_TimeAttackDef || currentMenu == &SP_NightsAttackDef)) + { + // D_StartTitle does its own wipe, since GS_TIMEATTACK is now a complete gamestate. + + if (levelselect.rows) + { + Z_Free(levelselect.rows); + levelselect.rows = NULL; + } + + menuactive = false; + wipetypepre = menupres[M_GetYoungestChildMenu()].exitwipe; + D_StartTitle(); + } + else + M_SetupNextMenu(currentMenu->prevMenu); + } + else + M_ClearMenus(true); +} + static void M_ChangeCvar(INT32 choice) { consvar_t *cv = (consvar_t *)currentMenu->menuitems[itemOn].itemaction; + if (choice == -1) + { + if (cv == &cv_playercolor) + { + SINT8 skinno = R_SkinAvailable(cv_chooseskin.string); + if (skinno != -1) + CV_SetValue(cv,skins[skinno].prefcolor); + return; + } + CV_Set(cv,cv->defaultvalue); + return; + } + + choice = (choice<<1) - 1; + if (((currentMenu->menuitems[itemOn].status & IT_CVARTYPE) == IT_CV_SLIDER) ||((currentMenu->menuitems[itemOn].status & IT_CVARTYPE) == IT_CV_INVISSLIDER) ||((currentMenu->menuitems[itemOn].status & IT_CVARTYPE) == IT_CV_NOMOD)) { - CV_SetValue(cv,cv->value+(choice*2-1)); + CV_SetValue(cv,cv->value+(choice)); } else if (cv->flags & CV_FLOAT) { char s[20]; - sprintf(s,"%f",FIXED_TO_FLOAT(cv->value)+(choice*2-1)*(1.0f/16.0f)); + sprintf(s,"%f",FIXED_TO_FLOAT(cv->value)+(choice)*(1.0f/16.0f)); CV_Set(cv,s); } else - CV_AddValue(cv,choice*2-1); + CV_AddValue(cv,choice); } static boolean M_ChangeStringCvar(INT32 choice) { consvar_t *cv = (consvar_t *)currentMenu->menuitems[itemOn].itemaction; - char buf[255]; + char buf[MAXSTRINGLENGTH]; size_t len; + if (shiftdown && choice >= 32 && choice <= 127) + choice = shiftxform[choice]; + switch (choice) { case KEY_BACKSPACE: @@ -2038,10 +2743,22 @@ static boolean M_ChangeStringCvar(INT32 choice) return false; } +// resets all cvars on a menu - assumes that all that have itemactions are cvars +static void M_ResetCvars(void) +{ + INT32 i; + consvar_t *cv; + for (i = 0; i < currentMenu->numitems; i++) + { + if (!(currentMenu->menuitems[i].status & IT_CVAR) || !(cv = (consvar_t *)currentMenu->menuitems[i].itemaction)) + continue; + CV_SetValue(cv, atoi(cv->defaultvalue)); + } +} + static void M_NextOpt(void) { INT16 oldItemOn = itemOn; // prevent infinite loop - do { if (itemOn + 1 > currentMenu->numitems - 1) @@ -2054,7 +2771,6 @@ static void M_NextOpt(void) static void M_PrevOpt(void) { INT16 oldItemOn = itemOn; // prevent infinite loop - do { if (!itemOn) @@ -2241,7 +2957,6 @@ boolean M_Responder(event_t *ev) itemOn = 0; return true; -#ifndef DC case KEY_F5: // Video Mode if (modeattacking) return true; @@ -2249,7 +2964,6 @@ boolean M_Responder(event_t *ev) M_Options(0); M_VideoModeMenu(0); return true; -#endif case KEY_F6: // Empty return true; @@ -2270,7 +2984,7 @@ boolean M_Responder(event_t *ev) return true; case KEY_F11: // Gamma Level - CV_AddValue(&cv_usegamma, 1); + CV_AddValue(&cv_globalgamma, 1); return true; // Spymode on F12 handled in game logic @@ -2334,8 +3048,6 @@ boolean M_Responder(event_t *ev) { if ((currentMenu->menuitems[itemOn].status & IT_CVARTYPE) == IT_CV_STRING) { - if (shiftdown && ch >= 32 && ch <= 127) - ch = shiftxform[ch]; if (M_ChangeStringCvar(ch)) return true; else @@ -2351,29 +3063,18 @@ boolean M_Responder(event_t *ev) case KEY_DOWNARROW: M_NextOpt(); S_StartSound(NULL, sfx_menu1); - if (currentMenu == &SP_PlayerDef) - { - Z_Free(char_notes); - char_notes = NULL; - } return true; case KEY_UPARROW: M_PrevOpt(); S_StartSound(NULL, sfx_menu1); - if (currentMenu == &SP_PlayerDef) - { - Z_Free(char_notes); - char_notes = NULL; - } return true; case KEY_LEFTARROW: if (routine && ((currentMenu->menuitems[itemOn].status & IT_TYPE) == IT_ARROWS || (currentMenu->menuitems[itemOn].status & IT_TYPE) == IT_CVAR)) { - if (currentMenu != &OP_SoundOptionsDef) - S_StartSound(NULL, sfx_menu1); + S_StartSound(NULL, sfx_menu1); routine(0); } return true; @@ -2382,8 +3083,7 @@ boolean M_Responder(event_t *ev) if (routine && ((currentMenu->menuitems[itemOn].status & IT_TYPE) == IT_ARROWS || (currentMenu->menuitems[itemOn].status & IT_TYPE) == IT_CVAR)) { - if (currentMenu != &OP_SoundOptionsDef) - S_StartSound(NULL, sfx_menu1); + S_StartSound(NULL, sfx_menu1); routine(1); } return true; @@ -2399,7 +3099,7 @@ boolean M_Responder(event_t *ev) { if (((currentMenu->menuitems[itemOn].status & IT_CALLTYPE) & IT_CALL_NOTMODIFIED) && modifiedgame && !savemoddata) { - S_StartSound(NULL, sfx_menu1); + S_StartSound(NULL, sfx_skid); M_StartMessage(M_GetText("This cannot be done in a modified game.\n\n(Press a key)\n"), NULL, MM_NOTHING); return true; } @@ -2425,28 +3125,8 @@ boolean M_Responder(event_t *ev) case KEY_ESCAPE: noFurtherInput = true; currentMenu->lastOn = itemOn; - if (currentMenu->prevMenu) - { - //If we entered the game search menu, but didn't enter a game, - //make sure the game doesn't still think we're in a netgame. - if (!Playing() && netgame && multiplayer) - { - MSCloseUDPSocket(); // Clean up so we can re-open the connection later. - netgame = false; - multiplayer = false; - } - if (currentMenu == &SP_TimeAttackDef || currentMenu == &SP_NightsAttackDef) - { - // D_StartTitle does its own wipe, since GS_TIMEATTACK is now a complete gamestate. - menuactive = false; - D_StartTitle(); - } - else - M_SetupNextMenu(currentMenu->prevMenu); - } - else - M_ClearMenus(true); + M_GoBack(0); return true; @@ -2455,8 +3135,26 @@ boolean M_Responder(event_t *ev) { // detach any keys associated with the game control G_ClearControlKeys(setupcontrols, currentMenu->menuitems[itemOn].alphaKey); + S_StartSound(NULL, sfx_shldls); return true; } + + if (routine && ((currentMenu->menuitems[itemOn].status & IT_TYPE) == IT_ARROWS + || (currentMenu->menuitems[itemOn].status & IT_TYPE) == IT_CVAR)) + { + consvar_t *cv = (consvar_t *)currentMenu->menuitems[itemOn].itemaction; + + if (cv == &cv_chooseskin + || cv == &cv_nextmap + || cv == &cv_newgametype) + return true; + + if (currentMenu != &OP_SoundOptionsDef || itemOn > 3) + S_StartSound(NULL, sfx_menu1); + routine(-1); + return true; + } + // Why _does_ backspace go back anyway? //currentMenu->lastOn = itemOn; //if (currentMenu->prevMenu) @@ -2483,8 +3181,8 @@ void M_Drawer(void) if (menuactive) { // now that's more readable with a faded background (yeah like Quake...) - if (!WipeInAction) - V_DrawFadeScreen(); + if (!WipeInAction && (curfadevalue || (gamestate != GS_TITLESCREEN && gamestate != GS_TIMEATTACK))) + V_DrawFadeScreen(0xFF00, (gamestate != GS_TITLESCREEN && gamestate != GS_TIMEATTACK) ? 16 : curfadevalue); if (currentMenu->drawroutine) currentMenu->drawroutine(); // call current menu Draw routine @@ -2620,10 +3318,14 @@ void M_StartControlPanel(void) } if (splitscreen) + { MPauseMenu[mpause_psetupsplit].status = MPauseMenu[mpause_psetupsplit2].status = IT_STRING | IT_CALL; + MPauseMenu[mpause_psetup].text = "Player 1 Setup"; + } else { MPauseMenu[mpause_psetup].status = IT_STRING | IT_CALL; + MPauseMenu[mpause_psetup].text = "Player Setup"; if (G_GametypeHasTeams()) MPauseMenu[mpause_switchteam].status = IT_STRING | IT_SUBMENU; @@ -2656,9 +3358,8 @@ void M_ClearMenus(boolean callexitmenufunc) if (currentMenu->quitroutine && callexitmenufunc && !currentMenu->quitroutine()) return; // we can't quit this menu (also used to set parameter from the menu) -#ifndef DC // Save the config file. I'm sick of crashing the game later and losing all my changes! + // Save the config file. I'm sick of crashing the game later and losing all my changes! COM_BufAddText(va("saveconfig \"%s\" -silent\n", configfile)); -#endif //Alam: But not on the Dreamcast's VMUs if (currentMenu == &MessageDef) // Oh sod off! currentMenu = &MainDef; // Not like it matters @@ -2678,6 +3379,9 @@ void M_SetupNextMenu(menu_t *menudef) if (currentMenu != menudef && !currentMenu->quitroutine()) return; // we can't quit this menu (also used to set parameter from the menu) } + + M_HandleMenuPresState(menudef); + currentMenu = menudef; itemOn = currentMenu->lastOn; @@ -2772,63 +3476,28 @@ void M_Init(void) #ifdef HWRENDER // Permanently hide some options based on render mode if (rendermode == render_soft) - OP_VideoOptionsMenu[1].status = IT_DISABLED; + OP_VideoOptionsMenu[4].status = IT_DISABLED; + else if (rendermode == render_opengl) + OP_ScreenshotOptionsMenu[op_screenshot_colorprofile].status = IT_GRAYEDOUT; #endif #ifndef NONET CV_RegisterVar(&cv_serversort); #endif - - //todo put this somewhere better... - CV_RegisterVar(&cv_allcaps); } void M_InitCharacterTables(void) { UINT8 i; - // Setup PlayerMenu table - for (i = 0; i < MAXSKINS; i++) - { - PlayerMenu[i].status = (i < 4 ? IT_CALL : IT_DISABLED); - PlayerMenu[i].patch = PlayerMenu[i].text = NULL; - PlayerMenu[i].itemaction = M_ChoosePlayer; - PlayerMenu[i].alphaKey = 0; - } - // Setup description table for (i = 0; i < MAXSKINS; i++) { - if (i == 0) - { - strcpy(description[i].notes, "\x82Sonic\x80 is the fastest of the three, but also the hardest to control. Beginners beware, but experts will find Sonic very powerful.\n\n\x82""Ability:\x80 Speed Thok\nDouble jump to zoom forward with a huge burst of speed.\n\n\x82Tip:\x80 Simply letting go of forward does not slow down in SRB2. To slow down, hold the opposite direction."); - strcpy(description[i].picname, ""); - strcpy(description[i].skinname, "sonic"); - } - else if (i == 1) - { - strcpy(description[i].notes, "\x82Tails\x80 is the most mobile of the three, but has the slowest speed. Because of his mobility, he's well-\nsuited to beginners.\n\n\x82""Ability:\x80 Fly\nDouble jump to start flying for a limited time. Repetitively hit the jump button to ascend.\n\n\x82Tip:\x80 To quickly descend while flying, hit the spin button."); - strcpy(description[i].picname, ""); - strcpy(description[i].skinname, "tails"); - } - else if (i == 2) - { - strcpy(description[i].notes, "\x82Knuckles\x80 is well-\nrounded and can destroy breakable walls simply by touching them, but he can't jump as high as the other two.\n\n\x82""Ability:\x80 Glide & Climb\nDouble jump to glide in the air as long as jump is held. Glide into a wall to climb it.\n\n\x82Tip:\x80 Press spin while climbing to jump off the wall; press jump instead to jump off\nand face away from\nthe wall."); - strcpy(description[i].picname, ""); - strcpy(description[i].skinname, "knuckles"); - } - else if (i == 3) - { - strcpy(description[i].notes, "\x82Sonic & Tails\x80 team up to take on Dr. Eggman!\nControl Sonic while Tails desperately struggles to keep up.\n\nPlayer 2 can control Tails directly by setting the controls in the options menu.\nTails's directional controls are relative to Player 1's camera.\n\nTails can pick up Sonic while flying and carry him around."); - strcpy(description[i].picname, "CHRS&T"); - strcpy(description[i].skinname, "sonic&tails"); - } - else - { - strcpy(description[i].notes, "???"); - strcpy(description[i].picname, ""); - strcpy(description[i].skinname, ""); - } + description[i].used = false; + strcpy(description[i].notes, "???"); + strcpy(description[i].picname, ""); + strcpy(description[i].skinname, ""); + description[i].prev = description[i].next = 0; } } @@ -2888,36 +3557,58 @@ static void M_DrawThermo(INT32 x, INT32 y, consvar_t *cv) } // A smaller 'Thermo', with range given as percents (0-100) -static void M_DrawSlider(INT32 x, INT32 y, const consvar_t *cv) +static void M_DrawSlider(INT32 x, INT32 y, const consvar_t *cv, boolean ontop) { INT32 i; INT32 range; patch_t *p; + x = BASEVIDWIDTH - x - SLIDER_WIDTH; + + V_DrawScaledPatch(x, y, 0, W_CachePatchName("M_SLIDEL", PU_CACHE)); + + p = W_CachePatchName("M_SLIDEM", PU_CACHE); + for (i = 1; i < SLIDER_RANGE; i++) + V_DrawScaledPatch (x+i*8, y, 0,p); + + if (ontop) + { + V_DrawCharacter(x - 6 - (skullAnimCounter/5), y, + '\x1C' | V_YELLOWMAP, false); + V_DrawCharacter(x+i*8 + 8 + (skullAnimCounter/5), y, + '\x1D' | V_YELLOWMAP, false); + } + + p = W_CachePatchName("M_SLIDER", PU_CACHE); + V_DrawScaledPatch(x+i*8, y, 0, p); + + // draw the slider cursor + p = W_CachePatchName("M_SLIDEC", PU_CACHE); + for (i = 0; cv->PossibleValue[i+1].strvalue; i++); + if ((range = atoi(cv->defaultvalue)) != cv->value) + { + range = ((range - cv->PossibleValue[0].value) * 100 / + (cv->PossibleValue[i].value - cv->PossibleValue[0].value)); + + if (range < 0) + range = 0; + else if (range > 100) + range = 100; + + V_DrawMappedPatch(x + 2 + (SLIDER_RANGE*8*range)/100, y, V_TRANSLUCENT, p, yellowmap); + } + range = ((cv->value - cv->PossibleValue[0].value) * 100 / (cv->PossibleValue[i].value - cv->PossibleValue[0].value)); if (range < 0) range = 0; - if (range > 100) + else if (range > 100) range = 100; - x = BASEVIDWIDTH - x - SLIDER_WIDTH; - - V_DrawScaledPatch(x - 8, y, 0, W_CachePatchName("M_SLIDEL", PU_CACHE)); - - p = W_CachePatchName("M_SLIDEM", PU_CACHE); - for (i = 0; i < SLIDER_RANGE; i++) - V_DrawScaledPatch (x+i*8, y, 0,p); - - p = W_CachePatchName("M_SLIDER", PU_CACHE); - V_DrawScaledPatch(x+SLIDER_RANGE*8, y, 0, p); - - // draw the slider cursor - p = W_CachePatchName("M_SLIDEC", PU_CACHE); - V_DrawMappedPatch(x + ((SLIDER_RANGE-1)*8*range)/100, y, 0, p, yellowmap); + V_DrawMappedPatch(x + 2 + (SLIDER_RANGE*8*range)/100, y, 0, p, yellowmap); } // @@ -2927,7 +3618,7 @@ static void M_DrawSlider(INT32 x, INT32 y, const consvar_t *cv) void M_DrawTextBox(INT32 x, INT32 y, INT32 width, INT32 boxlines) { // Solid color textbox. - V_DrawFill(x+5, y+5, width*8+6, boxlines*8+6, 239); + V_DrawFill(x+5, y+5, width*8+6, boxlines*8+6, 159); //V_DrawFill(x+8, y+8, width*8, boxlines*8, 31); /* patch_t *p; @@ -2977,9 +3668,38 @@ void M_DrawTextBox(INT32 x, INT32 y, INT32 width, INT32 boxlines) */ } +static fixed_t staticalong = 0; + +static void M_DrawStaticBox(fixed_t x, fixed_t y, INT32 flags, fixed_t w, fixed_t h) +{ + patch_t *patch; + fixed_t sw, pw; + + patch = W_CachePatchName("LSSTATIC", PU_CACHE); + pw = SHORT(patch->width) - (sw = w*2); //FixedDiv(w, scale); -- for scale FRACUNIT/2 + + /*if (pw > 0) -- model code for modders providing weird LSSTATIC + { + if (staticalong > pw) + staticalong -= pw; + } + else + staticalong = 0;*/ + + if (staticalong > pw) // simplified for base LSSTATIC + staticalong -= pw; + + V_DrawCroppedPatch(x<menuitems[i].status & IT_CVARTYPE) { case IT_CV_SLIDER: - M_DrawSlider(x, y, cv); + M_DrawSlider(x, y, cv, (i == itemOn)); case IT_CV_NOPRINT: // color use this case IT_CV_INVISSLIDER: // monitor toggles use this break; @@ -3149,8 +3872,15 @@ static void M_DrawGenericMenu(void) y += 16; break; default: - V_DrawString(BASEVIDWIDTH - x - V_StringWidth(cv->string, 0), y, + V_DrawRightAlignedString(BASEVIDWIDTH - x, y, ((cv->flags & CV_CHEAT) && !CV_IsSetToDefault(cv) ? V_REDMAP : V_YELLOWMAP), cv->string); + if (i == itemOn) + { + V_DrawCharacter(BASEVIDWIDTH - x - 10 - V_StringWidth(cv->string, 0) - (skullAnimCounter/5), y, + '\x1C' | V_YELLOWMAP, false); + V_DrawCharacter(BASEVIDWIDTH - x + 2 + (skullAnimCounter/5), y, + '\x1D' | V_YELLOWMAP, false); + } break; } break; @@ -3188,7 +3918,8 @@ static void M_DrawGenericMenu(void) if (currentMenu->menuitems[i].alphaKey) y = currentMenu->y+currentMenu->menuitems[i].alphaKey; - V_DrawString(x-16, y, V_YELLOWMAP, currentMenu->menuitems[i].text); + //V_DrawString(x-16, y, V_YELLOWMAP, currentMenu->menuitems[i].text); + M_DrawLevelPlatterHeader(y - (lsheadingheight - 12), currentMenu->menuitems[i].text, true, false); y += SMALLLINEHEIGHT; break; } @@ -3209,6 +3940,142 @@ static void M_DrawGenericMenu(void) } } +#define scrollareaheight 72 + +// note that alphakey is multiplied by 2 for scrolling menus to allow greater usage in UINT8 range. +static void M_DrawGenericScrollMenu(void) +{ + INT32 x, y, i, max, bottom, tempcentery, cursory = 0; + + // DRAW MENU + x = currentMenu->x; + y = currentMenu->y; + + if ((currentMenu->menuitems[itemOn].alphaKey*2 - currentMenu->menuitems[0].alphaKey*2) <= scrollareaheight) + tempcentery = currentMenu->y - currentMenu->menuitems[0].alphaKey*2; + else if ((currentMenu->menuitems[currentMenu->numitems-1].alphaKey*2 - currentMenu->menuitems[itemOn].alphaKey*2) <= scrollareaheight) + tempcentery = currentMenu->y - currentMenu->menuitems[currentMenu->numitems-1].alphaKey*2 + 2*scrollareaheight; + else + tempcentery = currentMenu->y - currentMenu->menuitems[itemOn].alphaKey*2 + scrollareaheight; + + for (i = 0; i < currentMenu->numitems; i++) + { + if (currentMenu->menuitems[i].status != IT_DISABLED && currentMenu->menuitems[i].alphaKey*2 + tempcentery >= currentMenu->y) + break; + } + + for (bottom = currentMenu->numitems; bottom > 0; bottom--) + { + if (currentMenu->menuitems[bottom-1].status != IT_DISABLED) + break; + } + + for (max = bottom; max > 0; max--) + { + if (currentMenu->menuitems[max-1].status != IT_DISABLED && currentMenu->menuitems[max-1].alphaKey*2 + tempcentery <= (currentMenu->y + 2*scrollareaheight)) + break; + } + + if (i) + V_DrawString(currentMenu->x - 20, currentMenu->y - (skullAnimCounter/5), V_YELLOWMAP, "\x1A"); // up arrow + if (max != bottom) + V_DrawString(currentMenu->x - 20, currentMenu->y + 2*scrollareaheight + (skullAnimCounter/5), V_YELLOWMAP, "\x1B"); // down arrow + + // draw title (or big pic) + M_DrawMenuTitle(); + + for (; i < max; i++) + { + y = currentMenu->menuitems[i].alphaKey*2 + tempcentery; + if (i == itemOn) + cursory = y; + switch (currentMenu->menuitems[i].status & IT_DISPLAY) + { + case IT_PATCH: + case IT_DYBIGSPACE: + case IT_BIGSLIDER: + case IT_STRING2: + case IT_DYLITLSPACE: + case IT_GRAYPATCH: + case IT_TRANSTEXT2: + // unsupported + break; + case IT_NOTHING: + break; + case IT_STRING: + case IT_WHITESTRING: + if (i != itemOn && (currentMenu->menuitems[i].status & IT_DISPLAY)==IT_STRING) + V_DrawString(x, y, 0, currentMenu->menuitems[i].text); + else + V_DrawString(x, y, V_YELLOWMAP, currentMenu->menuitems[i].text); + + // Cvar specific handling + switch (currentMenu->menuitems[i].status & IT_TYPE) + case IT_CVAR: + { + consvar_t *cv = (consvar_t *)currentMenu->menuitems[i].itemaction; + switch (currentMenu->menuitems[i].status & IT_CVARTYPE) + { + case IT_CV_SLIDER: + M_DrawSlider(x, y, cv, (i == itemOn)); + case IT_CV_NOPRINT: // color use this + case IT_CV_INVISSLIDER: // monitor toggles use this + break; + case IT_CV_STRING: +#if 1 + if (y + 12 > (currentMenu->y + 2*scrollareaheight)) + break; + M_DrawTextBox(x, y + 4, MAXSTRINGLENGTH, 1); + V_DrawString(x + 8, y + 12, V_ALLOWLOWERCASE, cv->string); + if (skullAnimCounter < 4 && i == itemOn) + V_DrawCharacter(x + 8 + V_StringWidth(cv->string, 0), y + 12, + '_' | 0x80, false); +#else // cool new string type stuff, not ready for limelight + if (i == itemOn) + { + V_DrawFill(x-2, y-1, MAXSTRINGLENGTH*8 + 4, 8+3, 159); + V_DrawString(x, y, V_ALLOWLOWERCASE, cv->string); + if (skullAnimCounter < 4) + V_DrawCharacter(x + V_StringWidth(cv->string, 0), y, '_' | 0x80, false); + } + else + V_DrawRightAlignedString(BASEVIDWIDTH - x, y, + V_YELLOWMAP|V_ALLOWLOWERCASE, cv->string); +#endif + break; + default: + V_DrawRightAlignedString(BASEVIDWIDTH - x, y, + ((cv->flags & CV_CHEAT) && !CV_IsSetToDefault(cv) ? V_REDMAP : V_YELLOWMAP), cv->string); + if (i == itemOn) + { + V_DrawCharacter(BASEVIDWIDTH - x - 10 - V_StringWidth(cv->string, 0) - (skullAnimCounter/5), y, + '\x1C' | V_YELLOWMAP, false); + V_DrawCharacter(BASEVIDWIDTH - x + 2 + (skullAnimCounter/5), y, + '\x1D' | V_YELLOWMAP, false); + } + break; + } + break; + } + break; + case IT_TRANSTEXT: + V_DrawString(x, y, V_TRANSLUCENT, currentMenu->menuitems[i].text); + break; + case IT_QUESTIONMARKS: + V_DrawString(x, y, V_TRANSLUCENT|V_OLDSPACING, M_CreateSecretMenuOption(currentMenu->menuitems[i].text)); + break; + case IT_HEADERTEXT: + //V_DrawString(x-16, y, V_YELLOWMAP, currentMenu->menuitems[i].text); + M_DrawLevelPlatterHeader(y - (lsheadingheight - 12), currentMenu->menuitems[i].text, true, false); + break; + } + } + + // DRAW THE SKULL CURSOR + V_DrawScaledPatch(currentMenu->x - 24, cursory, 0, + W_CachePatchName("M_CURSOR", PU_CACHE)); +} + static void M_DrawPauseMenu(void) { if (!netgame && !multiplayer && (gamestate == GS_LEVEL || gamestate == GS_INTERMISSION)) @@ -3414,7 +4281,7 @@ static void M_DrawCenteredMenu(void) switch(currentMenu->menuitems[i].status & IT_CVARTYPE) { case IT_CV_SLIDER: - M_DrawSlider(x, y, cv); + M_DrawSlider(x, y, cv, (i == itemOn)); case IT_CV_NOPRINT: // color use this break; case IT_CV_STRING: @@ -3428,6 +4295,13 @@ static void M_DrawCenteredMenu(void) default: V_DrawString(BASEVIDWIDTH - x - V_StringWidth(cv->string, 0), y, ((cv->flags & CV_CHEAT) && !CV_IsSetToDefault(cv) ? V_REDMAP : V_YELLOWMAP), cv->string); + if (i == itemOn) + { + V_DrawCharacter(BASEVIDWIDTH - x - 10 - V_StringWidth(cv->string, 0) - (skullAnimCounter/5), y, + '\x1C' | V_YELLOWMAP, false); + V_DrawCharacter(BASEVIDWIDTH - x + 2 + (skullAnimCounter/5), y, + '\x1D' | V_YELLOWMAP, false); + } break; } break; @@ -3504,9 +4378,9 @@ static void M_PatchSkinNameTable(void) for (j = 0; j < MAXSKINS; j++) { - if (skins[j].name[0] != '\0') + if (skins[j].name[0] != '\0' && R_SkinUsable(-1, j)) { - skins_cons_t[j].strvalue = skins[j].name; + skins_cons_t[j].strvalue = skins[j].realname; skins_cons_t[j].value = j+1; } else @@ -3516,31 +4390,60 @@ static void M_PatchSkinNameTable(void) } } - CV_SetValue(&cv_chooseskin, cv_chooseskin.value); // This causes crash sometimes?! - CV_SetValue(&cv_chooseskin, 1); - CV_AddValue(&cv_chooseskin, -1); - CV_AddValue(&cv_chooseskin, 1); + Nextmap_OnChange(); return; } -// Call before showing any level-select menus -static void M_PrepareLevelSelect(void) +// +// M_LevelAvailableOnPlatter +// +// Okay, you know that the level SHOULD show up on the platter already. +// The only question is whether it should be as a question mark, +// (hinting as to its existence), or as its pure, unfettered self. +// +static boolean M_LevelAvailableOnPlatter(INT32 mapnum) { - if (levellistmode != LLM_CREATESERVER) - CV_SetValue(&cv_nextmap, M_GetFirstLevelInList()); - else - Newgametype_OnChange(); // Make sure to start on an appropriate map if wads have been added + if (M_MapLocked(mapnum+1)) + return false; // not unlocked + + switch (levellistmode) + { + case LLM_CREATESERVER: + if (!(mapheaderinfo[mapnum]->typeoflevel & TOL_COOP)) + return true; + + if (mapvisited[mapnum]) // MV_MP + return true; + + if (mapnum+1 == spstage_start) + return true; + + /* FALLTHRU */ + case LLM_RECORDATTACK: + case LLM_NIGHTSATTACK: + if (mapvisited[mapnum] & MV_MAX) + return true; + + if (mapheaderinfo[mapnum]->menuflags & LF2_NOVISITNEEDED) + return true; + + return false; + case LLM_LEVELSELECT: + default: + return true; + } + return true; } // -// M_CanShowLevelInList +// M_CanShowLevelOnPlatter // // Determines whether to show a given map in the various level-select lists. // Set gt = -1 to ignore gametype. // -boolean M_CanShowLevelInList(INT32 mapnum, INT32 gt) +static boolean M_CanShowLevelOnPlatter(INT32 mapnum, INT32 gt) { // Does the map exist? if (!mapheaderinfo[mapnum]) @@ -3550,6 +4453,9 @@ boolean M_CanShowLevelInList(INT32 mapnum, INT32 gt) if (!mapheaderinfo[mapnum]->lvlttl[0]) return false; + /*if (M_MapLocked(mapnum+1)) + return false; // not unlocked*/ + switch (levellistmode) { case LLM_CREATESERVER: @@ -3557,9 +4463,6 @@ boolean M_CanShowLevelInList(INT32 mapnum, INT32 gt) if (mapheaderinfo[mapnum]->menuflags & LF2_HIDEINMENU) return false; - if (M_MapLocked(mapnum+1)) - return false; // not unlocked - if (gt == GT_COOP && (mapheaderinfo[mapnum]->typeoflevel & TOL_COOP)) return true; @@ -3581,40 +4484,19 @@ boolean M_CanShowLevelInList(INT32 mapnum, INT32 gt) return false; case LLM_LEVELSELECT: - if (mapheaderinfo[mapnum]->levelselect != maplistoption) + if (!(mapheaderinfo[mapnum]->levelselect & maplistoption)) return false; - if (M_MapLocked(mapnum+1)) - return false; // not unlocked - return true; case LLM_RECORDATTACK: if (!(mapheaderinfo[mapnum]->menuflags & LF2_RECORDATTACK)) return false; - if (M_MapLocked(mapnum+1)) - return false; // not unlocked - - if (mapheaderinfo[mapnum]->menuflags & LF2_NOVISITNEEDED) - return true; - - if (!mapvisited[mapnum]) - return false; - return true; case LLM_NIGHTSATTACK: if (!(mapheaderinfo[mapnum]->menuflags & LF2_NIGHTSATTACK)) return false; - if (M_MapLocked(mapnum+1)) - return false; // not unlocked - - if (mapheaderinfo[mapnum]->menuflags & LF2_NOVISITNEEDED) - return true; - - if (!mapvisited[mapnum]) - return false; - return true; } @@ -3622,23 +4504,607 @@ boolean M_CanShowLevelInList(INT32 mapnum, INT32 gt) return false; } -static INT32 M_CountLevelsToShowInList(void) +#if 0 +static INT32 M_CountLevelsToShowOnPlatter(INT32 gt) { INT32 mapnum, count = 0; for (mapnum = 0; mapnum < NUMMAPS; mapnum++) - if (M_CanShowLevelInList(mapnum, -1)) + if (M_CanShowLevelOnPlatter(mapnum, gt)) count++; return count; } +#endif -static INT32 M_GetFirstLevelInList(void) +#if 0 +static boolean M_SetNextMapOnPlatter(void) +{ + INT32 row, col = 0; + while (col < 3) + { + row = 0; + while (row < levelselect.numrows) + { + if (levelselect.rows[row].maplist[col] == cv_nextmap.value) + { + lsrow = row; + lscol = col; + return true; + } + row++; + } + col++; + } + return true; +} +#endif + +static INT32 M_CountRowsToShowOnPlatter(INT32 gt) +{ + INT32 mapnum = 0, prevmapnum = 0, col = 0, rows = 0; + + while (mapnum < NUMMAPS) + { + if (M_CanShowLevelOnPlatter(mapnum, gt)) + { + if (rows == 0) + rows++; + else + { + if (col == 2 + || (mapheaderinfo[prevmapnum]->menuflags & LF2_WIDEICON) + || (mapheaderinfo[mapnum]->menuflags & LF2_WIDEICON) + || !(fastcmp(mapheaderinfo[mapnum]->selectheading, mapheaderinfo[prevmapnum]->selectheading))) + { + col = 0; + rows++; + } + else + col++; + } + prevmapnum = mapnum; + } + mapnum++; + } + + if (levellistmode == LLM_CREATESERVER) + rows++; + + return rows; +} + +// +// M_PrepareLevelPlatter +// +// Prepares a tasty dish of zones and acts! +// Call before any attempt to access a level platter. +// +static boolean M_PrepareLevelPlatter(INT32 gt, boolean nextmappick) +{ + INT32 numrows = M_CountRowsToShowOnPlatter(gt); + INT32 mapnum = 0, prevmapnum = 0, col = 0, row = 0, startrow = 0; + + if (!numrows) + return false; + + if (levelselect.rows) + Z_Free(levelselect.rows); + levelselect.rows = NULL; + + levelselect.numrows = numrows; + levelselect.rows = Z_Realloc(levelselect.rows, numrows*sizeof(levelselectrow_t), PU_STATIC, NULL); + if (!levelselect.rows) + I_Error("Insufficient memory to prepare level platter"); + + // done here so lsrow and lscol can be set if cv_nextmap is on the platter + lsrow = lscol = lshli = lsoffs[0] = lsoffs[1] = 0; + + if (levellistmode == LLM_CREATESERVER) + { + sprintf(levelselect.rows[0].header, "Gametype"); + lswide(0) = true; + levelselect.rows[row].mapavailable[2] = levelselect.rows[row].mapavailable[1] = levelselect.rows[row].mapavailable[0] = false; + startrow = row = 1; + + Z_Free(char_notes); + char_notes = NULL; + } + + while (mapnum < NUMMAPS) + { + if (M_CanShowLevelOnPlatter(mapnum, gt)) + { + const INT32 actnum = mapheaderinfo[mapnum]->actnum; + const boolean headingisname = (fastcmp(mapheaderinfo[mapnum]->selectheading, mapheaderinfo[mapnum]->lvlttl)); + const boolean wide = (mapheaderinfo[mapnum]->menuflags & LF2_WIDEICON); + + // preparing next position to drop mapnum into + if (levelselect.rows[startrow].maplist[0]) + { + if (col == 2 // no more space on the row? + || wide + || (mapheaderinfo[prevmapnum]->menuflags & LF2_WIDEICON) + || !(fastcmp(mapheaderinfo[mapnum]->selectheading, mapheaderinfo[prevmapnum]->selectheading))) // a new heading is starting? + { + col = 0; + row++; + } + else + col++; + } + + levelselect.rows[row].maplist[col] = mapnum+1; // putting the map on the platter + levelselect.rows[row].mapavailable[col] = M_LevelAvailableOnPlatter(mapnum); + + if ((lswide(row) = wide)) // intentionally assignment + { + levelselect.rows[row].maplist[2] = levelselect.rows[row].maplist[1] = levelselect.rows[row].maplist[0]; + levelselect.rows[row].mapavailable[2] = levelselect.rows[row].mapavailable[1] = levelselect.rows[row].mapavailable[0]; + } + + if (nextmappick && cv_nextmap.value == mapnum+1) // A little quality of life improvement. + { + lsrow = row; + lscol = col; + } + + // individual map name + if (levelselect.rows[row].mapavailable[col]) + { + if (headingisname) + { + if (actnum) + sprintf(levelselect.rows[row].mapnames[col], "ACT %d", actnum); + else + sprintf(levelselect.rows[row].mapnames[col], "THE ACT"); + } + else if (wide) + { + // Yes, with LF2_WIDEICON it'll continue on over into the next 17+1 char block. That's alright; col is always zero, the string is contiguous, and the maximum length is lvlttl[22] + ' ' + ZONE + ' ' + INT32, which is about 39 or so - barely crossing into the third column. + char* mapname = G_BuildMapTitle(mapnum+1); + strcpy(levelselect.rows[row].mapnames[col], (const char *)mapname); + Z_Free(mapname); + } + else + { + char mapname[22+1+11]; // lvlttl[22] + ' ' + INT32 + + if (actnum) + sprintf(mapname, "%s %d", mapheaderinfo[mapnum]->lvlttl, actnum); + else + strcpy(mapname, mapheaderinfo[mapnum]->lvlttl); + + if (strlen(mapname) >= 17) + strcpy(mapname+17-3, "..."); + + strcpy(levelselect.rows[row].mapnames[col], (const char *)mapname); + } + } + else + sprintf(levelselect.rows[row].mapnames[col], "???"); + + // creating header text + if (!col && ((row == startrow) || !(fastcmp(mapheaderinfo[mapnum]->selectheading, mapheaderinfo[levelselect.rows[row-1].maplist[0]-1]->selectheading)))) + { + if (!levelselect.rows[row].mapavailable[col]) + sprintf(levelselect.rows[row].header, "???"); + else + { + sprintf(levelselect.rows[row].header, "%s", mapheaderinfo[mapnum]->selectheading); + if (!(mapheaderinfo[mapnum]->levelflags & LF_NOZONE) && headingisname) + { + sprintf(levelselect.rows[row].header + strlen(levelselect.rows[row].header), " ZONE"); + } + } + } + + prevmapnum = mapnum; + } + + mapnum++; + } + +#ifdef SYMMETRICAL_PLATTER + // horizontally space out rows with missing right sides + for (; row >= 0; row--) + { + if (!levelselect.rows[row].maplist[2] // no right side + && levelselect.rows[row].maplist[0] && levelselect.rows[row].maplist[1]) // all the left filled in + { + levelselect.rows[row].maplist[2] = levelselect.rows[row].maplist[1]; + STRBUFCPY(levelselect.rows[row].mapnames[2], levelselect.rows[row].mapnames[1]); + levelselect.rows[row].mapavailable[2] = levelselect.rows[row].mapavailable[1]; + + levelselect.rows[row].maplist[1] = -1; // diamond + levelselect.rows[row].mapnames[1][0] = '\0'; + levelselect.rows[row].mapavailable[1] = false; + } + } +#endif + + if (levselp[0][0]) // never going to have some provided but not all, saves individually checking + { + W_UnlockCachedPatch(levselp[0][0]); + W_UnlockCachedPatch(levselp[0][1]); + W_UnlockCachedPatch(levselp[0][2]); + + W_UnlockCachedPatch(levselp[1][0]); + W_UnlockCachedPatch(levselp[1][1]); + W_UnlockCachedPatch(levselp[1][2]); + } + + levselp[0][0] = W_CachePatchName("SLCT1LVL", PU_STATIC); + levselp[0][1] = W_CachePatchName("SLCT2LVL", PU_STATIC); + levselp[0][2] = W_CachePatchName("BLANKLVL", PU_STATIC); + + levselp[1][0] = W_CachePatchName("SLCT1LVW", PU_STATIC); + levselp[1][1] = W_CachePatchName("SLCT2LVW", PU_STATIC); + levselp[1][2] = W_CachePatchName("BLANKLVW", PU_STATIC); + + return true; +} + +#define ifselectvalnextmapnobrace(column) if ((selectval = levelselect.rows[lsrow].maplist[column]) && levelselect.rows[lsrow].mapavailable[column])\ + {\ + CV_SetValue(&cv_nextmap, selectval); + +#define ifselectvalnextmap(column) ifselectvalnextmapnobrace(column)} + +// +// M_HandleLevelPlatter +// +// Reacts to your key inputs. Basically a mini menu thinker. +// +static void M_HandleLevelPlatter(INT32 choice) +{ + boolean exitmenu = false; // exit to previous menu + INT32 selectval; + + switch (choice) + { + case KEY_DOWNARROW: + lsrow++; + if (lsrow == levelselect.numrows) + lsrow = 0; + + lsoffs[0] = lsvseperation(lsrow); + + if (levelselect.rows[lsrow].header[0]) + lshli = lsrow; + // no else needed - headerless lines associate upwards, so moving down to a row without a header is identity + + S_StartSound(NULL,sfx_s3kb7); + + ifselectvalnextmap(lscol) else ifselectvalnextmap(0) + break; + + case KEY_UPARROW: + lsoffs[0] = -lsvseperation(lsrow); + + lsrow--; + if (lsrow == UINT8_MAX) + lsrow = levelselect.numrows-1; + + if (levelselect.rows[lsrow].header[0]) + lshli = lsrow; + else + { + UINT8 iter = lsrow; + do + iter = ((iter == 0) ? levelselect.numrows-1 : iter-1); + while ((iter != lsrow) && !(levelselect.rows[iter].header[0])); + lshli = iter; + } + + S_StartSound(NULL,sfx_s3kb7); + + ifselectvalnextmap(lscol) else ifselectvalnextmap(0) + break; + + case KEY_ENTER: + if (!(levellistmode == LLM_CREATESERVER && !lsrow)) + { + ifselectvalnextmapnobrace(lscol) + lsoffs[0] = lsoffs[1] = 0; + S_StartSound(NULL,sfx_menu1); + if (gamestate == GS_TIMEATTACK) + M_SetupNextMenu(currentMenu->prevMenu); + else if (currentMenu == &MISC_ChangeLevelDef) + { + if (currentMenu->prevMenu && currentMenu->prevMenu != &MPauseDef) + M_SetupNextMenu(currentMenu->prevMenu); + else + M_ChangeLevel(0); + Z_Free(levelselect.rows); + levelselect.rows = NULL; + } + else + M_LevelSelectWarp(0); + Nextmap_OnChange(); + } + else if (!lsoffs[0]) // prevent sound spam + { + lsoffs[0] = -8; + S_StartSound(NULL,sfx_s3kb2); + } + break; + } + /* FALLTHRU */ + case KEY_RIGHTARROW: + if (levellistmode == LLM_CREATESERVER && !lsrow) + { + CV_AddValue(&cv_newgametype, 1); + S_StartSound(NULL,sfx_menu1); + lscol = 0; + + Z_Free(char_notes); + char_notes = NULL; + + if (!M_PrepareLevelPlatter(cv_newgametype.value, false)) + I_Error("Unidentified level platter failure!"); + } + else if (lscol < 2) + { + lscol++; + + lsoffs[1] = (lswide(lsrow) ? 8 : -lshseperation); + S_StartSound(NULL,sfx_s3kb7); + + ifselectvalnextmap(lscol) else ifselectvalnextmap(0) + } + else if (!lsoffs[1]) // prevent sound spam + { + lsoffs[1] = 8; + S_StartSound(NULL,sfx_s3kb7); + } + break; + + case KEY_LEFTARROW: + if (levellistmode == LLM_CREATESERVER && !lsrow) + { + CV_AddValue(&cv_newgametype, -1); + S_StartSound(NULL,sfx_menu1); + lscol = 0; + + Z_Free(char_notes); + char_notes = NULL; + + if (!M_PrepareLevelPlatter(cv_newgametype.value, false)) + I_Error("Unidentified level platter failure!"); + } + else if (lscol > 0) + { + lscol--; + + lsoffs[1] = (lswide(lsrow) ? -8 : lshseperation); + S_StartSound(NULL,sfx_s3kb7); + + ifselectvalnextmap(lscol) else ifselectvalnextmap(0) + } + else if (!lsoffs[1]) // prevent sound spam + { + lsoffs[1] = -8; + S_StartSound(NULL,sfx_s3kb7); + } + break; + + case KEY_ESCAPE: + exitmenu = true; + break; + + default: + break; + } + + if (exitmenu) + { + if (gamestate != GS_TIMEATTACK) + { + Z_Free(levelselect.rows); + levelselect.rows = NULL; + } + + if (currentMenu->prevMenu) + { + M_SetupNextMenu(currentMenu->prevMenu); + Nextmap_OnChange(); + } + else + M_ClearMenus(true); + + Z_Free(char_notes); + char_notes = NULL; + } +} + +void M_DrawLevelPlatterHeader(INT32 y, const char *header, boolean headerhighlight, boolean allowlowercase) +{ + y += lsheadingheight - 12; + V_DrawString(19, y, (headerhighlight ? V_YELLOWMAP : 0)|(allowlowercase ? V_ALLOWLOWERCASE : 0), header); + y += 9; + V_DrawFill(19, y, 281, 1, (headerhighlight ? yellowmap[3] : 3)); + V_DrawFill(300, y, 1, 1, 26); + y++; + V_DrawFill(19, y, 282, 1, 26); +} + +static void M_DrawLevelPlatterWideMap(UINT8 row, UINT8 col, INT32 x, INT32 y, boolean highlight) +{ + patch_t *patch; + + INT32 map = levelselect.rows[row].maplist[col]; + if (map <= 0) + return; + + // A 564x100 image of the level as entry MAPxxW + if (!(levelselect.rows[row].mapavailable[col])) + { + V_DrawSmallScaledPatch(x, y, 0, levselp[1][2]); + M_DrawStaticBox(x, y, V_80TRANS, 282, 50); + } + else + { + if (W_CheckNumForName(va("%sW", G_BuildMapName(map))) != LUMPERROR) + patch = W_CachePatchName(va("%sW", G_BuildMapName(map)), PU_CACHE); + else + patch = levselp[1][2]; // don't static to indicate that it's just a normal level + + V_DrawSmallScaledPatch(x, y, 0, patch); + } + + V_DrawFill(x, y+50, 282, 8, + ((mapheaderinfo[map-1]->unlockrequired < 0) + ? 159 : 63)); + + V_DrawString(x, y+50, (highlight ? V_YELLOWMAP : 0), levelselect.rows[row].mapnames[col]); +} + +static void M_DrawLevelPlatterMap(UINT8 row, UINT8 col, INT32 x, INT32 y, boolean highlight) +{ + patch_t *patch; + + INT32 map = levelselect.rows[row].maplist[col]; + if (map <= 0) + return; + + // A 160x100 image of the level as entry MAPxxP + if (!(levelselect.rows[row].mapavailable[col])) + { + V_DrawSmallScaledPatch(x, y, 0, levselp[0][2]); + M_DrawStaticBox(x, y, V_80TRANS, 80, 50); + } + else + { + if (W_CheckNumForName(va("%sP", G_BuildMapName(map))) != LUMPERROR) + patch = W_CachePatchName(va("%sP", G_BuildMapName(map)), PU_CACHE); + else + patch = levselp[0][2]; // don't static to indicate that it's just a normal level + + V_DrawSmallScaledPatch(x, y, 0, patch); + } + + V_DrawFill(x, y+50, 80, 8, + ((mapheaderinfo[map-1]->unlockrequired < 0) + ? 159 : 63)); + + if (strlen(levelselect.rows[row].mapnames[col]) > 6) // "AERIAL GARDEN" vs "ACT 18" - "THE ACT" intentionally compressed + V_DrawThinString(x, y+50, (highlight ? V_YELLOWMAP : 0), levelselect.rows[row].mapnames[col]); + else + V_DrawString(x, y+50, (highlight ? V_YELLOWMAP : 0), levelselect.rows[row].mapnames[col]); +} + +static void M_DrawLevelPlatterRow(UINT8 row, INT32 y) +{ + UINT8 col; + const boolean rowhighlight = (row == lsrow); + if (levelselect.rows[row].header[0]) + { + M_DrawLevelPlatterHeader(y, levelselect.rows[row].header, (rowhighlight || (row == lshli)), false); + y += lsheadingheight; + } + + if (levellistmode == LLM_CREATESERVER && !row) + { + if (!char_notes) + char_notes = V_WordWrap(0, 282 - 8, V_ALLOWLOWERCASE, gametypedesc[cv_newgametype.value].notes); + + V_DrawFill(lsbasex, y, 282, 50, 27); + V_DrawString(lsbasex + 4, y + 4, V_RETURN8|V_ALLOWLOWERCASE, char_notes); + + V_DrawFill(lsbasex, y+50, 141, 8, gametypedesc[cv_newgametype.value].col[0]); + V_DrawFill(lsbasex+141, y+50, 141, 8, gametypedesc[cv_newgametype.value].col[1]); + + V_DrawString(lsbasex, y+50, 0, gametype_cons_t[cv_newgametype.value].strvalue); + + if (!lsrow) + { + V_DrawCharacter(lsbasex - 10 - (skullAnimCounter/5), y+25, + '\x1C' | V_YELLOWMAP, false); + V_DrawCharacter(lsbasex+282 + 2 + (skullAnimCounter/5), y+25, + '\x1D' | V_YELLOWMAP, false); + } + } + else if (lswide(row)) + M_DrawLevelPlatterWideMap(row, 0, lsbasex, y, rowhighlight); + else + { + for (col = 0; col < 3; col++) + M_DrawLevelPlatterMap(row, col, lsbasex+(col*lshseperation), y, (rowhighlight && (col == lscol))); + } +} + +static void M_DrawLevelPlatterMenu(void) +{ + UINT8 iter = lsrow, sizeselect = (lswide(lsrow) ? 1 : 0); + INT32 y = lsbasey + lsoffs[0] - getheadingoffset(lsrow); + const INT32 cursorx = (sizeselect ? 0 : (lscol*lshseperation)); + + if (gamestate == GS_TIMEATTACK) + { + if (curbgcolor >= 0) + V_DrawFill(0, 0, BASEVIDWIDTH, BASEVIDHEIGHT, curbgcolor); + else if (!curbghide || !titlemapinaction) + F_SkyScroll(curbgxspeed, curbgyspeed, curbgname); + if (curfadevalue) + V_DrawFadeScreen(0xFF00, curfadevalue); + } + + // finds row at top of the screen + while (y > -8) + { + iter = ((iter == 0) ? levelselect.numrows-1 : iter-1); + y -= lsvseperation(iter); + } + + // draw from top to bottom + while (y < (vid.height/vid.dupy)) + { + M_DrawLevelPlatterRow(iter, y); + y += lsvseperation(iter); + iter = ((iter == levelselect.numrows-1) ? 0 : iter+1); + } + + // draw cursor box + if (levellistmode != LLM_CREATESERVER || lsrow) + V_DrawSmallScaledPatch(lsbasex + cursorx + lsoffs[1], lsbasey+lsoffs[0], 0, (levselp[sizeselect][((skullAnimCounter/4) ? 1 : 0)])); + +#if 0 + if (levelselect.rows[lsrow].maplist[lscol] > 0) + V_DrawScaledPatch(lsbasex + cursorx-17, lsbasey+50+lsoffs[0], 0, W_CachePatchName("M_CURSOR", PU_CACHE)); +#endif + + // handle movement of cursor box + if (lsoffs[0] > 1 || lsoffs[0] < -1) + lsoffs[0] = 2*lsoffs[0]/3; + else + lsoffs[0] = 0; + + if (lsoffs[1] > 1 || lsoffs[1] < -1) + lsoffs[1] = 2*lsoffs[1]/3; + else + lsoffs[1] = 0; + + M_DrawMenuTitle(); +} + +// +// M_CanShowLevelInList +// +// Determines whether to show a given map in level-select lists where you don't want to see locked levels. +// Set gt = -1 to ignore gametype. +// +boolean M_CanShowLevelInList(INT32 mapnum, INT32 gt) +{ + return (M_CanShowLevelOnPlatter(mapnum, gt) && M_LevelAvailableOnPlatter(mapnum)); +} + +static INT32 M_GetFirstLevelInList(INT32 gt) { INT32 mapnum; for (mapnum = 0; mapnum < NUMMAPS; mapnum++) - if (M_CanShowLevelInList(mapnum, -1)) + if (M_CanShowLevelInList(mapnum, gt)) return mapnum + 1; return 1; @@ -3658,6 +5124,7 @@ static menuitem_t MessageMenu[] = menu_t MessageDef = { + MN_SPECIAL, NULL, // title 1, // # of menu items NULL, // previous menu (TO HACK) @@ -3783,7 +5250,14 @@ static void M_DrawMessageMenu(void) // hack: draw RA background in RA menus if (gamestate == GS_TIMEATTACK) - V_DrawPatchFill(W_CachePatchName("SRB2BACK", PU_CACHE)); + { + if (curbgcolor >= 0) + V_DrawFill(0, 0, BASEVIDWIDTH, BASEVIDHEIGHT, curbgcolor); + else if (!curbghide || !titlemapinaction) + F_SkyScroll(curbgxspeed, curbgyspeed, curbgname); + if (curfadevalue) + V_DrawFadeScreen(0xFF00, curfadevalue); + } M_DrawTextBox(currentMenu->x, y - 8, (max+7)>>3, mlines); @@ -4005,21 +5479,21 @@ static void M_DrawTemperature(INT32 x, fixed_t t) t = (FixedMul(h<>FRACBITS); // border - V_DrawFill(x - 1, vpadding, 1, h, 120); - V_DrawFill(x + width, vpadding, 1, h, 120); - V_DrawFill(x - 1, vpadding-1, width+2, 1, 120); - V_DrawFill(x - 1, vpadding+h, width+2, 1, 120); + V_DrawFill(x - 1, vpadding, 1, h, 3); + V_DrawFill(x + width, vpadding, 1, h, 3); + V_DrawFill(x - 1, vpadding-1, width+2, 1, 3); + V_DrawFill(x - 1, vpadding+h, width+2, 1, 3); // bar itself y = h; if (t) for (t = h - t; y > 0; y--) { - UINT8 colours[NUMCOLOURS] = {135, 133, 92, 77, 114, 178, 161, 162}; + UINT8 colours[NUMCOLOURS] = {42, 40, 58, 222, 65, 90, 97, 98}; UINT8 c; if (y <= t) break; if (y+vpadding >= BASEVIDHEIGHT/2) - c = 185; + c = 113; else c = colours[(NUMCOLOURS*(y-1))/(h/2)]; V_DrawFill(x, y-1 + vpadding, width, 1, c); @@ -4027,7 +5501,7 @@ static void M_DrawTemperature(INT32 x, fixed_t t) // fill the rest of the backing if (y) - V_DrawFill(x, vpadding, width, y, 30); + V_DrawFill(x, vpadding, width, y, 27); } #undef width #undef vpadding @@ -4145,14 +5619,15 @@ static void M_DrawAddons(void) x = currentMenu->x; y = currentMenu->y + 1; - hilicol = V_GetStringColormap(highlightflags)[120]; + hilicol = 0; // white V_DrawString(x-21, (y - 16) + (lsheadingheight - 12), highlightflags|V_ALLOWLOWERCASE, M_AddonsHeaderPath()); V_DrawFill(x-21, (y - 16) + (lsheadingheight - 3), MAXSTRINGLENGTH*8+6, 1, hilicol); V_DrawFill(x-21, (y - 16) + (lsheadingheight - 2), MAXSTRINGLENGTH*8+6, 1, 30); m = (BASEVIDHEIGHT - currentMenu->y + 2) - (y - 1); - V_DrawFill(x - 21, y - 1, MAXSTRINGLENGTH*8+6, m, 239); + // addons menu back color + V_DrawFill(x - 21, y - 1, MAXSTRINGLENGTH*8+6, m, 159); // scrollbar! if (sizedirmenu <= (2*numaddonsshown + 1)) @@ -4406,7 +5881,7 @@ static void M_HandleAddons(INT32 choice) M_StartMessage(va("%c%s\x80\nThis copy of SRB2 was compiled\nwithout support for .lua files.\n\n(Press a key)\n", ('\x80' + (highlightflags>>V_CHARCOLORSHIFT)), dirmenu[dir_on[menudepthleft]]+DIR_STRING),NULL,MM_NOTHING); break; #endif - // else intentional fallthrough + /* FALLTHRU */ case EXT_SOC: case EXT_WAD: #ifdef USE_KART @@ -4435,7 +5910,7 @@ static void M_HandleAddons(INT32 choice) { closefilemenu(true); - // Secret menu! + // secrets disabled by addfile... MainMenu[secrets].status = (M_AnySecretUnlocked()) ? (IT_STRING | IT_CALL) : (IT_DISABLED); if (currentMenu->prevMenu) @@ -4448,16 +5923,33 @@ static void M_HandleAddons(INT32 choice) static void M_PandorasBox(INT32 choice) { (void)choice; - CV_StealthSetValue(&cv_dummyrings, max(players[consoleplayer].health - 1, 0)); - CV_StealthSetValue(&cv_dummylives, players[consoleplayer].lives); + if (maptol & TOL_NIGHTS) + CV_StealthSetValue(&cv_dummyrings, max(players[consoleplayer].spheres, 0)); + else + CV_StealthSetValue(&cv_dummyrings, max(players[consoleplayer].rings, 0)); + if (players[consoleplayer].lives == INFLIVES) + CV_StealthSetValue(&cv_dummylives, -1); + else + CV_StealthSetValue(&cv_dummylives, players[consoleplayer].lives); CV_StealthSetValue(&cv_dummycontinues, players[consoleplayer].continues); + SR_PandorasBox[6].status = ((players[consoleplayer].charflags & SF_SUPER) +#ifndef DEVELOP + || cv_skin.value == 1 +#endif + ) ? (IT_GRAYEDOUT) : (IT_STRING | IT_CALL); + SR_PandorasBox[7].status = (emeralds == ((EMERALD7)*2)-1) ? (IT_GRAYEDOUT) : (IT_STRING | IT_CALL); M_SetupNextMenu(&SR_PandoraDef); } static boolean M_ExitPandorasBox(void) { - if (cv_dummyrings.value != max(players[consoleplayer].health - 1, 0)) - COM_ImmedExecute(va("setrings %d", cv_dummyrings.value)); + if (cv_dummyrings.value != max(players[consoleplayer].rings, 0)) + { + if (maptol & TOL_NIGHTS) + COM_ImmedExecute(va("setspheres %d", cv_dummyrings.value)); + else + COM_ImmedExecute(va("setrings %d", cv_dummyrings.value)); + } if (cv_dummylives.value != players[consoleplayer].lives) COM_ImmedExecute(va("setlives %d", cv_dummylives.value)); if (cv_dummycontinues.value != players[consoleplayer].continues) @@ -4544,10 +6036,10 @@ static void M_Options(INT32 choice) (void)choice; // if the player is not admin or server, disable server options - OP_MainMenu[5].status = (Playing() && !(server || IsPlayerAdmin(consoleplayer))) ? (IT_GRAYEDOUT) : (IT_STRING|IT_SUBMENU); + OP_MainMenu[5].status = (Playing() && !(server || IsPlayerAdmin(consoleplayer))) ? (IT_GRAYEDOUT) : (IT_STRING|IT_CALL); // if the player is playing _at all_, disable the erase data options - OP_DataOptionsMenu[1].status = (Playing()) ? (IT_GRAYEDOUT) : (IT_STRING|IT_SUBMENU); + OP_DataOptionsMenu[2].status = (Playing()) ? (IT_GRAYEDOUT) : (IT_STRING|IT_SUBMENU); OP_MainDef.prevMenu = currentMenu; M_SetupNextMenu(&OP_MainDef); @@ -4587,12 +6079,24 @@ static void M_UltimateCheat(INT32 choice) I_Quit(); } +static void M_AllowSuper(INT32 choice) +{ + (void)choice; + + players[consoleplayer].charflags |= SF_SUPER; + M_StartMessage(M_GetText("You are now capable of turning super.\nRemember to get all the emeralds!\n"),NULL,MM_NOTHING); + SR_PandorasBox[6].status = IT_GRAYEDOUT; + + G_SetGameModified(multiplayer); +} + static void M_GetAllEmeralds(INT32 choice) { (void)choice; emeralds = ((EMERALD7)*2)-1; M_StartMessage(M_GetText("You now have all 7 emeralds.\nUse them wisely.\nWith great power comes great ring drain.\n"),NULL,MM_NOTHING); + SR_PandorasBox[7].status = IT_GRAYEDOUT; G_SetGameModified(multiplayer); } @@ -4635,7 +6139,7 @@ static void M_LevelSelectWarp(INT32 choice) G_LoadGame((UINT32)cursaveslot, startmap); else { - cursaveslot = -1; + cursaveslot = 0; M_SetupChoosePlayer(0); } } @@ -4646,28 +6150,341 @@ static void M_LevelSelectWarp(INT32 choice) UINT8 skyRoomMenuTranslations[MAXUNLOCKABLES]; -#define NUMCHECKLIST 8 +static boolean checklist_cangodown; // uuuueeerggghhhh HACK + +static void M_HandleChecklist(INT32 choice) +{ + INT32 j; + switch (choice) + { + case KEY_DOWNARROW: + S_StartSound(NULL, sfx_menu1); + if ((check_on != MAXUNLOCKABLES) && checklist_cangodown) + { + for (j = check_on+1; j < MAXUNLOCKABLES; j++) + { + if (!unlockables[j].name[0]) + continue; + // if (unlockables[j].nochecklist) + // continue; + if (!unlockables[j].conditionset) + continue; + if (unlockables[j].conditionset > MAXCONDITIONSETS) + continue; + if (unlockables[j].conditionset == unlockables[check_on].conditionset) + continue; + break; + } + if (j != MAXUNLOCKABLES) + check_on = j; + } + return; + + case KEY_UPARROW: + S_StartSound(NULL, sfx_menu1); + if (check_on) + { + for (j = check_on-1; j > -1; j--) + { + if (!unlockables[j].name[0]) + continue; + // if (unlockables[j].nochecklist) + // continue; + if (!unlockables[j].conditionset) + continue; + if (unlockables[j].conditionset > MAXCONDITIONSETS) + continue; + if (j && unlockables[j].conditionset == unlockables[j-1].conditionset) + continue; + break; + } + if (j != -1) + check_on = j; + } + return; + + case KEY_ESCAPE: + if (currentMenu->prevMenu) + M_SetupNextMenu(currentMenu->prevMenu); + else + M_ClearMenus(true); + return; + default: + break; + } +} + +#define addy(add) { y += add; if ((y - currentMenu->y) > (scrollareaheight*2)) goto finishchecklist; } + static void M_DrawChecklist(void) { - INT32 i, j = 0; + INT32 i = check_on, j = 0, y = currentMenu->y; + UINT32 condnum, previd, maxcond; + condition_t *cond; - for (i = 0; i < MAXUNLOCKABLES; i++) + // draw title (or big pic) + M_DrawMenuTitle(); + + if (check_on) + V_DrawString(10, y-(skullAnimCounter/5), V_YELLOWMAP, "\x1A"); + + while (i < MAXUNLOCKABLES) { - if (unlockables[i].name[0] == 0 || unlockables[i].nochecklist + if (unlockables[i].name[0] == 0 //|| unlockables[i].nochecklist || !unlockables[i].conditionset || unlockables[i].conditionset > MAXCONDITIONSETS) continue; - V_DrawString(8, 8+(24*j), V_RETURN8, unlockables[i].name); - V_DrawString(160, 8+(24*j), V_RETURN8, V_WordWrap(160, 292, 0, unlockables[i].objective)); + V_DrawString(currentMenu->x, y, ((unlockables[i].unlocked) ? V_GREENMAP : V_TRANSLUCENT), ((unlockables[i].unlocked || !unlockables[i].nochecklist) ? unlockables[i].name : M_CreateSecretMenuOption(unlockables[i].name))); + + for (j = i+1; j < MAXUNLOCKABLES; j++) + { + if (!(unlockables[j].name[0] == 0 //|| unlockables[j].nochecklist + || !unlockables[j].conditionset || unlockables[j].conditionset > MAXCONDITIONSETS)) + break; + } + if ((j != MAXUNLOCKABLES) && (unlockables[i].conditionset == unlockables[j].conditionset)) + addy(8) + else + { + if ((maxcond = conditionSets[unlockables[i].conditionset-1].numconditions)) + { + cond = conditionSets[unlockables[i].conditionset-1].condition; + previd = cond[0].id; + addy(2); + + if (unlockables[i].objective[0] != '/') + { + addy(8); + V_DrawString(currentMenu->x, y, + V_ALLOWLOWERCASE, + va("\x1E %s", unlockables[i].objective)); + } + else + { + for (condnum = 0; condnum < maxcond; condnum++) + { + const char *beat = "!"; + + if (cond[condnum].id != previd) + { + addy(8); + V_DrawString(currentMenu->x + 4, y, V_YELLOWMAP, "OR"); + } + + addy(8); + + switch (cond[condnum].type) + { + case UC_PLAYTIME: + { + UINT32 hours = G_TicsToHours(cond[condnum].requirement); + UINT32 minutes = G_TicsToMinutes(cond[condnum].requirement, false); + UINT32 seconds = G_TicsToSeconds(cond[condnum].requirement); + +#define getplural(field) ((field == 1) ? "" : "s") + if (hours) + { + if (minutes) + beat = va("Play the game for %d hour%s %d minute%s", hours, getplural(hours), minutes, getplural(minutes)); + else + beat = va("Play the game for %d hour%s", hours, getplural(hours)); + } + else + { + if (minutes && seconds) + beat = va("Play the game for %d minute%s %d second%s", minutes, getplural(minutes), seconds, getplural(seconds)); + else if (minutes) + beat = va("Play the game for %d minute%s", minutes, getplural(minutes)); + else + beat = va("Play the game for %d second%s", seconds, getplural(seconds)); + } +#undef getplural + } + break; + case UC_MAPVISITED: + case UC_MAPBEATEN: + case UC_MAPALLEMERALDS: + case UC_MAPULTIMATE: + case UC_MAPPERFECT: + { + char *title = G_BuildMapTitle(cond[condnum].requirement); + + if (title) + { + const char *level = ((M_MapLocked(cond[condnum].requirement) || !((mapheaderinfo[cond[condnum].requirement-1]->menuflags & LF2_NOVISITNEEDED) || (mapvisited[cond[condnum].requirement-1] & MV_MAX))) ? M_CreateSecretMenuOption(title) : title); + + switch (cond[condnum].type) + { + case UC_MAPVISITED: + beat = va("Visit %s", level); + break; + case UC_MAPALLEMERALDS: + beat = va("Beat %s with all emeralds", level); + break; + case UC_MAPULTIMATE: + beat = va("Beat %s in Ultimate mode", level); + break; + case UC_MAPPERFECT: + beat = va("Get all rings in %s", level); + break; + case UC_MAPBEATEN: + default: + beat = va("Beat %s", level); + break; + } + Z_Free(title); + } + } + break; + case UC_MAPSCORE: + case UC_MAPTIME: + case UC_MAPRINGS: + { + char *title = G_BuildMapTitle(cond[condnum].extrainfo1); + + if (title) + { + const char *level = ((M_MapLocked(cond[condnum].extrainfo1) || !((mapheaderinfo[cond[condnum].extrainfo1-1]->menuflags & LF2_NOVISITNEEDED) || (mapvisited[cond[condnum].extrainfo1-1] & MV_MAX))) ? M_CreateSecretMenuOption(title) : title); + + switch (cond[condnum].type) + { + case UC_MAPSCORE: + beat = va("Get %d points in %s", cond[condnum].requirement, level); + break; + case UC_MAPTIME: + beat = va("Beat %s in %d:%02d.%02d", level, + G_TicsToMinutes(cond[condnum].requirement, true), + G_TicsToSeconds(cond[condnum].requirement), + G_TicsToCentiseconds(cond[condnum].requirement)); + break; + case UC_MAPRINGS: + beat = va("Get %d rings in %s", cond[condnum].requirement, level); + break; + default: + break; + } + Z_Free(title); + } + } + break; + case UC_OVERALLSCORE: + case UC_OVERALLTIME: + case UC_OVERALLRINGS: + { + switch (cond[condnum].type) + { + case UC_OVERALLSCORE: + beat = va("Get %d points over all maps", cond[condnum].requirement); + break; + case UC_OVERALLTIME: + beat = va("Get a total time of less than %d:%02d.%02d", + G_TicsToMinutes(cond[condnum].requirement, true), + G_TicsToSeconds(cond[condnum].requirement), + G_TicsToCentiseconds(cond[condnum].requirement)); + break; + case UC_OVERALLRINGS: + beat = va("Get %d rings over all maps", cond[condnum].requirement); + break; + default: + break; + } + } + break; + case UC_GAMECLEAR: + case UC_ALLEMERALDS: + { + const char *emeraldtext = ((cond[condnum].type == UC_ALLEMERALDS) ? " with all emeralds" : ""); + if (cond[condnum].requirement != 1) + beat = va("Beat the game %d times%s", + cond[condnum].requirement, emeraldtext); + else + beat = va("Beat the game%s", + emeraldtext); + } + break; + case UC_TOTALEMBLEMS: + beat = va("Collect %s%d emblems", ((numemblems+numextraemblems == cond[condnum].requirement) ? "all " : ""), cond[condnum].requirement); + break; + case UC_NIGHTSTIME: + case UC_NIGHTSSCORE: + case UC_NIGHTSGRADE: + { + char *title = G_BuildMapTitle(cond[condnum].extrainfo1); + + if (title) + { + const char *level = ((M_MapLocked(cond[condnum].extrainfo1) || !((mapheaderinfo[cond[condnum].extrainfo1-1]->menuflags & LF2_NOVISITNEEDED) || (mapvisited[cond[condnum].extrainfo1-1] & MV_MAX))) ? M_CreateSecretMenuOption(title) : title); + + switch (cond[condnum].type) + { + case UC_NIGHTSSCORE: + if (cond[condnum].extrainfo2) + beat = va("Get %d points in %s, mare %d", cond[condnum].requirement, level, cond[condnum].extrainfo2); + else + beat = va("Get %d points in %s", cond[condnum].requirement, level); + break; + case UC_NIGHTSTIME: + if (cond[condnum].extrainfo2) + beat = va("Beat %s, mare %d in %d:%02d.%02d", level, cond[condnum].extrainfo2, + G_TicsToMinutes(cond[condnum].requirement, true), + G_TicsToSeconds(cond[condnum].requirement), + G_TicsToCentiseconds(cond[condnum].requirement)); + else + beat = va("Beat %s in %d:%02d.%02d", + level, + G_TicsToMinutes(cond[condnum].requirement, true), + G_TicsToSeconds(cond[condnum].requirement), + G_TicsToCentiseconds(cond[condnum].requirement)); + break; + case UC_NIGHTSGRADE: + { + char grade = ('F' - (char)cond[condnum].requirement); + if (grade < 'A') + grade = 'A'; + if (cond[condnum].extrainfo2) + beat = va("Get grade %c in %s, mare %d", grade, level, cond[condnum].extrainfo2); + else + beat = va("Get grade %c in %s", grade, level); + } + break; + default: + break; + } + Z_Free(title); + } + } + break; + case UC_TRIGGER: + case UC_EMBLEM: + case UC_CONDITIONSET: + default: + y -= 8; // Nope, not showing this. + break; + } + if (beat[0] != '!') + { + V_DrawString(currentMenu->x, y, 0, "\x1E"); + V_DrawString(currentMenu->x+12, y, V_ALLOWLOWERCASE, beat); + } + previd = cond[condnum].id; + } + } + } + addy(12); + } + i = j; + + /*V_DrawString(160, 8+(24*j), V_RETURN8, V_WordWrap(160, 292, 0, unlockables[i].objective)); if (unlockables[i].unlocked) V_DrawString(308, 8+(24*j), V_YELLOWMAP, "Y"); else - V_DrawString(308, 8+(24*j), V_YELLOWMAP, "N"); - - if (++j >= NUMCHECKLIST) - break; + V_DrawString(308, 8+(24*j), V_YELLOWMAP, "N");*/ } + +finishchecklist: + if ((checklist_cangodown = ((y - currentMenu->y) > (scrollareaheight*2)))) // haaaaaaacks. + V_DrawString(10, currentMenu->y+(scrollareaheight*2)+(skullAnimCounter/5), V_YELLOWMAP, "\x1B"); } #define NUMHINTS 5 @@ -4720,27 +6537,6 @@ static void M_DrawEmblemHints(void) M_DrawGenericMenu(); } -static void M_DrawLevelSelectMenu(void) -{ - M_DrawGenericMenu(); - - if (cv_nextmap.value) - { - lumpnum_t lumpnum; - patch_t *PictureOfLevel; - - // A 160x100 image of the level as entry MAPxxP - lumpnum = W_CheckNumForName(va("%sP", G_BuildMapName(cv_nextmap.value))); - - if (lumpnum != LUMPERROR) - PictureOfLevel = W_CachePatchName(va("%sP", G_BuildMapName(cv_nextmap.value)), PU_CACHE); - else - PictureOfLevel = W_CachePatchName("BLANKLVL", PU_CACHE); - - V_DrawSmallScaledPatch(200, 110, 0, PictureOfLevel); - } -} - static void M_DrawSkyRoom(void) { INT32 i, y = 0; @@ -4759,6 +6555,13 @@ static void M_DrawSkyRoom(void) return; V_DrawRightAlignedString(BASEVIDWIDTH - currentMenu->x, currentMenu->y + y, V_YELLOWMAP, cv_soundtest.string); + if (i == itemOn) + { + V_DrawCharacter(BASEVIDWIDTH - currentMenu->x - 10 - V_StringWidth(cv_soundtest.string, 0) - (skullAnimCounter/5), currentMenu->y + y, + '\x1C' | V_YELLOWMAP, false); + V_DrawCharacter(BASEVIDWIDTH - currentMenu->x + 2 + (skullAnimCounter/5), currentMenu->y + y, + '\x1D' | V_YELLOWMAP, false); + } if (cv_soundtest.value) V_DrawRightAlignedString(BASEVIDWIDTH - currentMenu->x, currentMenu->y + y + 8, V_YELLOWMAP, S_sfx[cv_soundtest.value].name); } @@ -4911,7 +6714,7 @@ static void M_CustomWarp(INT32 choice) static void M_Credits(INT32 choice) { (void)choice; - cursaveslot = -2; + cursaveslot = -1; M_ClearMenus(true); F_StartCredits(); } @@ -4923,13 +6726,13 @@ static void M_CustomLevelSelect(INT32 choice) SR_LevelSelectDef.prevMenu = currentMenu; levellistmode = LLM_LEVELSELECT; maplistoption = (UINT8)(unlockables[ul].variable); - if (M_CountLevelsToShowInList() == 0) + + if (!M_PrepareLevelPlatter(-1, true)) { M_StartMessage(M_GetText("No selectable levels found.\n"),NULL,MM_NOTHING); return; } - M_PrepareLevelSelect(); M_SetupNextMenu(&SR_LevelSelectDef); } @@ -4940,6 +6743,8 @@ static void M_CustomLevelSelect(INT32 choice) static void M_SinglePlayerMenu(INT32 choice) { (void)choice; + SP_MainMenu[sptutorial].status = + tutorialmap ? IT_CALL|IT_STRING : IT_NOTHING|IT_DISABLED; SP_MainMenu[sprecordattack].status = (M_SecretUnlocked(SECRET_RECORDATTACK)) ? IT_CALL|IT_STRING : IT_SECRET; SP_MainMenu[spnightsmode].status = @@ -4951,167 +6756,379 @@ static void M_SinglePlayerMenu(INT32 choice) static void M_LoadGameLevelSelect(INT32 choice) { (void)choice; + + SP_LevelSelectDef.prevMenu = currentMenu; levellistmode = LLM_LEVELSELECT; - maplistoption = 1; - if (M_CountLevelsToShowInList() == 0) + maplistoption = 1+2; + + if (!M_PrepareLevelPlatter(-1, true)) { M_StartMessage(M_GetText("No selectable levels found.\n"),NULL,MM_NOTHING); return; } - SP_LevelSelectDef.prevMenu = currentMenu; - - M_PrepareLevelSelect(); M_SetupNextMenu(&SP_LevelSelectDef); } +void M_TutorialSaveControlResponse(INT32 ch) +{ + if (ch == 'y' || ch == KEY_ENTER) + { + G_CopyControls(gamecontrol, gamecontroldefault[tutorialgcs], gcl_tutorial_full, num_gcl_tutorial_full); + CV_Set(&cv_usemouse, cv_usemouse.defaultvalue); + CV_Set(&cv_alwaysfreelook, cv_alwaysfreelook.defaultvalue); + CV_Set(&cv_mousemove, cv_mousemove.defaultvalue); + CV_Set(&cv_analog, cv_analog.defaultvalue); + S_StartSound(NULL, sfx_itemup); + } + else + S_StartSound(NULL, sfx_menu1); +} + +static void M_TutorialControlResponse(INT32 ch) +{ + if (ch != KEY_ESCAPE) + { + G_CopyControls(gamecontroldefault[gcs_custom], gamecontrol, NULL, 0); // using gcs_custom as temp storage for old controls + if (ch == 'y' || ch == KEY_ENTER) + { + tutorialgcs = gcs_fps; + tutorialusemouse = cv_usemouse.value; + tutorialfreelook = cv_alwaysfreelook.value; + tutorialmousemove = cv_mousemove.value; + tutorialanalog = cv_analog.value; + + G_CopyControls(gamecontrol, gamecontroldefault[tutorialgcs], gcl_tutorial_full, num_gcl_tutorial_full); + CV_Set(&cv_usemouse, cv_usemouse.defaultvalue); + CV_Set(&cv_alwaysfreelook, cv_alwaysfreelook.defaultvalue); + CV_Set(&cv_mousemove, cv_mousemove.defaultvalue); + CV_Set(&cv_analog, cv_analog.defaultvalue); + + //S_StartSound(NULL, sfx_itemup); + } + else + { + tutorialgcs = gcs_custom; + S_StartSound(NULL, sfx_menu1); + } + M_StartTutorial(INT32_MAX); + } + else + S_StartSound(NULL, sfx_menu1); + + MessageDef.prevMenu = &SP_MainDef; // if FirstPrompt -> ControlsPrompt -> ESC, we would go to the main menu unless we force this +} + +// Starts up the tutorial immediately (tbh I wasn't sure where else to put this) +static void M_StartTutorial(INT32 choice) +{ + if (!tutorialmap) + return; // no map to go to, don't bother + + if (choice != INT32_MAX && G_GetControlScheme(gamecontrol, gcl_tutorial_check, num_gcl_tutorial_check) != gcs_fps) + { + M_StartMessage("Do you want to try the \202recommended \202movement controls\x80?\n\nWe will set them just for this tutorial.\n\nPress 'Y' or 'Enter' to confirm\nPress 'N' or any key to keep \nyour current controls.\n",M_TutorialControlResponse,MM_YESNO); + return; + } + else if (choice != INT32_MAX) + tutorialgcs = gcs_custom; + + CV_SetValue(&cv_tutorialprompt, 0); // first-time prompt + + tutorialmode = true; // turn on tutorial mode + + emeralds = 0; + M_ClearMenus(true); + gamecomplete = false; + cursaveslot = 0; + G_DeferedInitNew(false, G_BuildMapName(tutorialmap), 0, false, false); +} + // ============== // LOAD GAME MENU // ============== -static INT32 saveSlotSelected = 0; -static short menumovedir = 0; +static INT32 saveSlotSelected = 1; +static INT32 loadgamescroll = 0; +static UINT8 loadgameoffset = 0; static void M_DrawLoadGameData(void) { - INT32 ecks; - INT32 i; + INT32 i, savetodraw, x, y, hsep = 90; + skin_t *charskin = NULL; - ecks = SP_LoadDef.x + 24; - M_DrawTextBox(SP_LoadDef.x-12,144, 24, 4); + if (vid.width != BASEVIDWIDTH*vid.dupx) + hsep = (hsep*vid.width)/(BASEVIDWIDTH*vid.dupx); - if (saveSlotSelected == NOSAVESLOT) // last slot is play without saving + for (i = -2; i <= 2; i++) { - if (ultimate_selectable) + savetodraw = (saveSlotSelected + i + numsaves)%numsaves; + x = (BASEVIDWIDTH/2 - 42 + loadgamescroll) + (i*hsep); + y = 33 + 9; + { - V_DrawCenteredString(ecks + 68, 144, V_ORANGEMAP, "ULTIMATE MODE"); - V_DrawCenteredString(ecks + 68, 156, 0, "NO RINGS, NO ONE-UPS,"); - V_DrawCenteredString(ecks + 68, 164, 0, "NO CONTINUES, ONE LIFE,"); - V_DrawCenteredString(ecks + 68, 172, 0, "FINAL DESTINATION."); + INT32 diff = x - (BASEVIDWIDTH/2 - 42); + if (diff < 0) + diff = -diff; + diff = (42 - diff)/3 - loadgameoffset; + if (diff < 0) + diff = 0; + y -= diff; } - else - { - V_DrawCenteredString(ecks + 68, 144, V_ORANGEMAP, "PLAY WITHOUT SAVING"); - V_DrawCenteredString(ecks + 68, 156, 0, "THIS GAME WILL NOT BE"); - V_DrawCenteredString(ecks + 68, 164, 0, "SAVED, BUT YOU CAN STILL"); - V_DrawCenteredString(ecks + 68, 172, 0, "GET EMBLEMS AND SECRETS."); - } - return; - } - - if (savegameinfo[saveSlotSelected].lives == -42) // Empty - { - V_DrawCenteredString(ecks + 68, 160, 0, "NO DATA"); - return; - } - - if (savegameinfo[saveSlotSelected].lives == -666) // savegame is bad - { - V_DrawCenteredString(ecks + 68, 144, V_REDMAP, "CORRUPT SAVE FILE"); - V_DrawCenteredString(ecks + 68, 156, 0, "THIS SAVE FILE"); - V_DrawCenteredString(ecks + 68, 164, 0, "CAN NOT BE LOADED."); - V_DrawCenteredString(ecks + 68, 172, 0, "DELETE USING BACKSPACE."); - return; - } - - // Draw the back sprite, it looks ugly if we don't - V_DrawScaledPatch(SP_LoadDef.x, 144+8, 0, livesback); - if (savegameinfo[saveSlotSelected].skincolor == 0) - V_DrawScaledPatch(SP_LoadDef.x,144+8,0,W_CachePatchName(skins[savegameinfo[saveSlotSelected].skinnum].face, PU_CACHE)); - else - { - UINT8 *colormap = R_GetTranslationColormap(savegameinfo[saveSlotSelected].skinnum, savegameinfo[saveSlotSelected].skincolor, 0); - V_DrawMappedPatch(SP_LoadDef.x,144+8,0,W_CachePatchName(skins[savegameinfo[saveSlotSelected].skinnum].face, PU_CACHE), colormap); - } - - V_DrawString(ecks + 12, 152, 0, savegameinfo[saveSlotSelected].playername); - -#ifdef SAVEGAMES_OTHERVERSIONS - if (savegameinfo[saveSlotSelected].gamemap & 16384) - V_DrawCenteredString(ecks + 68, 144, V_REDMAP, "OUTDATED SAVE FILE!"); -#endif - - if (savegameinfo[saveSlotSelected].gamemap & 8192) - V_DrawString(ecks + 12, 160, V_GREENMAP, "CLEAR!"); - else - V_DrawString(ecks + 12, 160, 0, va("%s", savegameinfo[saveSlotSelected].levelname)); - - // Use the big face pic for lives, duh. :3 - V_DrawScaledPatch(ecks + 12, 175, 0, W_CachePatchName("STLIVEX", PU_HUDGFX)); - V_DrawTallNum(ecks + 40, 172, 0, savegameinfo[saveSlotSelected].lives); - - // Absolute ridiculousness, condensed into another function. - V_DrawContinueIcon(ecks + 58, 182, 0, savegameinfo[saveSlotSelected].skinnum, savegameinfo[saveSlotSelected].skincolor); - V_DrawScaledPatch(ecks + 68, 175, 0, W_CachePatchName("STLIVEX", PU_HUDGFX)); - V_DrawTallNum(ecks + 96, 172, 0, savegameinfo[saveSlotSelected].continues); - - for (i = 0; i < 7; ++i) - { - if (savegameinfo[saveSlotSelected].numemeralds & (1 << i)) - V_DrawScaledPatch(ecks + 104 + (i * 8), 172, 0, tinyemeraldpics[i]); - } -} - -#define LOADBARHEIGHT SP_LoadDef.y + (LINEHEIGHT * (j+1)) + ymod -#define CURSORHEIGHT SP_LoadDef.y + (LINEHEIGHT*3) - 1 -static void M_DrawLoad(void) -{ - INT32 i, j; - INT32 ymod = 0, offset = 0; - - M_DrawMenuTitle(); - - if (menumovedir != 0) //movement illusion - { - ymod = (-(LINEHEIGHT/4))*menumovedir; - offset = ((menumovedir > 0) ? -1 : 1); - } - - V_DrawCenteredString(BASEVIDWIDTH/2, 40, 0, "Press backspace to delete a save."); - - for (i = MAXSAVEGAMES + saveSlotSelected - 2 + offset, j = 0;i <= MAXSAVEGAMES + saveSlotSelected + 2 + offset; i++, j++) - { - if ((menumovedir < 0 && j == 4) || (menumovedir > 0 && j == 0)) - continue; //this helps give the illusion of movement - - M_DrawSaveLoadBorder(SP_LoadDef.x, LOADBARHEIGHT); - - if ((i%MAXSAVEGAMES) == NOSAVESLOT) // play without saving + + if (savetodraw == 0) { + V_DrawSmallScaledPatch(x, y, 0, + savselp[((ultimate_selectable) ? 2 : 1)]); + x += 2; + y += 1; + V_DrawString(x, y, + ((savetodraw == saveSlotSelected) ? V_YELLOWMAP : 0), + "NO FILE"); + if (savetodraw == saveSlotSelected) + V_DrawFill(x, y+9, 80, 1, yellowmap[3]); + y += 11; + V_DrawSmallScaledPatch(x, y, 0, savselp[4]); + M_DrawStaticBox(x, y, V_80TRANS, 80, 50); + y += 41; if (ultimate_selectable) - V_DrawCenteredString(SP_LoadDef.x+92, LOADBARHEIGHT - 1, V_ORANGEMAP, "ULTIMATE MODE"); + V_DrawRightAlignedThinString(x + 79, y, V_REDMAP, "ULTIMATE."); else - V_DrawCenteredString(SP_LoadDef.x+92, LOADBARHEIGHT - 1, V_ORANGEMAP, "PLAY WITHOUT SAVING"); + V_DrawRightAlignedThinString(x + 79, y, V_GRAYMAP, "DON'T SAVE!"); + continue; } - if (savegameinfo[i%MAXSAVEGAMES].lives == -42) - V_DrawString(SP_LoadDef.x-6, LOADBARHEIGHT - 1, V_TRANSLUCENT, "NO DATA"); - else if (savegameinfo[i%MAXSAVEGAMES].lives == -666) - V_DrawString(SP_LoadDef.x-6, LOADBARHEIGHT - 1, V_REDMAP, "CORRUPT SAVE FILE"); - else if (savegameinfo[i%MAXSAVEGAMES].gamemap & 8192) - V_DrawString(SP_LoadDef.x-6, LOADBARHEIGHT - 1, V_GREENMAP, "CLEAR!"); - else - V_DrawString(SP_LoadDef.x-6, LOADBARHEIGHT - 1, 0, va("%s", savegameinfo[i%MAXSAVEGAMES].levelname)); + savetodraw--; - //Draw the save slot number on the right side - V_DrawRightAlignedString(SP_LoadDef.x+192, LOADBARHEIGHT - 1, 0, va("%d",(i%MAXSAVEGAMES) + 1)); + if (savegameinfo[savetodraw].lives > 0) + charskin = &skins[savegameinfo[savetodraw].skinnum]; + + // signpost background + { + UINT8 col; + if (savegameinfo[savetodraw].lives == -666) + { + V_DrawSmallScaledPatch(x+2, y+64, 0, savselp[5]); + } +#ifdef PERFECTSAVE // disabled on request + else if ((savegameinfo[savetodraw].skinnum == 1) + && (savegameinfo[savetodraw].lives == 99) + && (savegameinfo[savetodraw].gamemap & 8192) + && (savegameinfo[savetodraw].numgameovers == 0) + && (savegameinfo[savetodraw].numemeralds == ((1<<7) - 1))) // perfect save + { + V_DrawFill(x+6, y+64, 72, 50, 134); + V_DrawFill(x+6, y+74, 72, 30, 201); + V_DrawFill(x+6, y+84, 72, 10, 1); + } +#endif + else + { + if (savegameinfo[savetodraw].lives == -42) + col = 26; + else if (savegameinfo[savetodraw].botskin == 3) // & knuckles + col = 105; + else if (savegameinfo[savetodraw].botskin) // tailsbot or custom + col = 134; + else + { + col = (charskin->prefcolor - 1)*2; + col = Color_Index[Color_Opposite[col]-1][Color_Opposite[col+1]]; + } + + V_DrawFill(x+6, y+64, 72, 50, col); + } + } + + V_DrawSmallScaledPatch(x, y, 0, savselp[0]); + x += 2; + y += 1; + V_DrawString(x, y, + ((savetodraw == saveSlotSelected-1) ? V_YELLOWMAP : 0), + va("FILE %d", savetodraw+1)); + if (savetodraw == saveSlotSelected-1) + V_DrawFill(x, y+9, 80, 1, yellowmap[3]); + y += 11; + + // level image area + { + if ((savegameinfo[savetodraw].lives == -42) + || (savegameinfo[savetodraw].lives == -666)) + { + V_DrawFill(x, y, 80, 50, 31); + M_DrawStaticBox(x, y, V_80TRANS, 80, 50); + } + else + { + patch_t *patch; + if (savegameinfo[savetodraw].gamemap & 8192) + patch = savselp[3]; + else + { + lumpnum_t lumpnum = W_CheckNumForName(va("%sP", G_BuildMapName((savegameinfo[savetodraw].gamemap) & 8191))); + if (lumpnum != LUMPERROR) + patch = W_CachePatchNum(lumpnum, PU_CACHE); + else + patch = savselp[5]; + } + V_DrawSmallScaledPatch(x, y, 0, patch); + } + + y += 41; + + if (savegameinfo[savetodraw].lives == -42) + V_DrawRightAlignedThinString(x + 79, y, V_GRAYMAP, "NEW GAME"); + else if (savegameinfo[savetodraw].lives == -666) + V_DrawRightAlignedThinString(x + 79, y, V_REDMAP, "CAN'T LOAD!"); + else if (savegameinfo[savetodraw].gamemap & 8192) + V_DrawRightAlignedThinString(x + 79, y, V_GREENMAP, "CLEAR!"); + else + V_DrawRightAlignedThinString(x + 79, y, V_YELLOWMAP, savegameinfo[savetodraw].levelname); + } + + if ((savegameinfo[savetodraw].lives == -42) + || (savegameinfo[savetodraw].lives == -666)) + continue; + + y += 64; + + // tiny emeralds + { + INT32 j, workx = x + 6; + for (j = 0; j < 7; ++j) + { + if (savegameinfo[savetodraw].numemeralds & (1 << j)) + V_DrawScaledPatch(workx, y, 0, emeraldpics[1][j]); + workx += 10; + } + } + + y -= 13; + + // character heads, lives, and continues + { + spritedef_t *sprdef; + spriteframe_t *sprframe; + patch_t *patch; + UINT8 *colormap = NULL; + + INT32 tempx = (x+40)<sprites[SPR2_SIGN]; + if (!sprdef->numframes) + goto skipbot; + colormap = R_GetTranslationColormap(savegameinfo[savetodraw].botskin, charbotskin->prefcolor, 0); + sprframe = &sprdef->spriteframes[0]; + patch = W_CachePatchNum(sprframe->lumppat[0], PU_CACHE); + + V_DrawFixedPatch( + tempx + (18<highresscale, + 0, patch, colormap); + + Z_Free(colormap); + + tempx -= (15<sprites[SPR2_SIGN]; + colormap = R_GetTranslationColormap(savegameinfo[savetodraw].skinnum, charskin->prefcolor, 0); + if (!sprdef->numframes) + goto skipsign; + sprframe = &sprdef->spriteframes[0]; + patch = W_CachePatchNum(sprframe->lumppat[0], PU_CACHE); + if ((calc = SHORT(patch->topoffset) - 42) > 0) + tempy += ((4+calc)<highresscale, + flip, patch, colormap); + +skipsign: + y += 25; + + tempx = x + 10; + if (savegameinfo[savetodraw].lives != INFLIVES + && savegameinfo[savetodraw].lives > 9) + tempx -= 4; + + if (!charskin) // shut up compiler + goto skiplife; + + // lives + sprdef = &charskin->sprites[SPR2_LIFE]; + if (!sprdef->numframes) + goto skiplife; + sprframe = &sprdef->spriteframes[0]; + patch = W_CachePatchNum(sprframe->lumppat[0], PU_CACHE); + + V_DrawFixedPatch( + (tempx + 4)<highresscale/2, + 0, patch, colormap); +skiplife: + if (colormap) + Z_Free(colormap); + + patch = W_CachePatchName("STLIVEX", PU_CACHE); + + V_DrawScaledPatch(tempx + 9, y + 2, 0, patch); + tempx += 16; + if (savegameinfo[savetodraw].lives == INFLIVES) + V_DrawCharacter(tempx, y + 1, '\x16', false); + else + V_DrawString(tempx, y, 0, va("%d", savegameinfo[savetodraw].lives)); + + tempx = x + 47; + if (savegameinfo[savetodraw].continues > 9) + tempx -= 4; + + // continues + if (savegameinfo[savetodraw].continues > 0) + { + V_DrawSmallScaledPatch(tempx, y, 0, W_CachePatchName("CONTSAVE", PU_CACHE)); + V_DrawScaledPatch(tempx + 9, y + 2, 0, patch); + V_DrawString(tempx + 16, y, 0, va("%d", savegameinfo[savetodraw].continues)); + } + else + { + V_DrawSmallScaledPatch(tempx, y, 0, W_CachePatchName("CONTNONE", PU_CACHE)); + V_DrawScaledPatch(tempx + 9, y + 2, 0, W_CachePatchName("STNONEX", PU_CACHE)); + V_DrawString(tempx + 16, y, V_GRAYMAP, "0"); + } + } } +} - //Draw cursors on both sides. - V_DrawScaledPatch( 32, CURSORHEIGHT, 0, W_CachePatchName("M_CURSOR", PU_CACHE)); - V_DrawScaledPatch(274, CURSORHEIGHT, 0, W_CachePatchName("M_CURSOR", PU_CACHE)); +static void M_DrawLoad(void) +{ + M_DrawMenuTitle(); + + if (loadgamescroll > 1 || loadgamescroll < -1) + loadgamescroll = 2*loadgamescroll/3; + else + loadgamescroll = 0; + + if (loadgameoffset > 1) + loadgameoffset = 2*loadgameoffset/3; + else + loadgameoffset = 0; M_DrawLoadGameData(); - - //finishing the movement illusion - if (menumovedir) - menumovedir += ((menumovedir > 0) ? 1 : -1); - if (abs(menumovedir) > 3) - menumovedir = 0; } -#undef LOADBARHEIGHT -#undef CURSORHEIGHT // // User wants to load this game @@ -5123,7 +7140,7 @@ static void M_LoadSelect(INT32 choice) if (saveSlotSelected == NOSAVESLOT) //last slot is play without saving { M_NewGame(); - cursaveslot = -1; + cursaveslot = 0; return; } @@ -5132,8 +7149,8 @@ static void M_LoadSelect(INT32 choice) // This slot is empty, so start a new game here. M_NewGame(); } - else if (savegameinfo[saveSlotSelected].gamemap & 8192) // Completed - M_LoadGameLevelSelect(saveSlotSelected + 1); + else if (savegameinfo[saveSlotSelected-1].gamemap & 8192) // Completed + M_LoadGameLevelSelect(0); else G_LoadGame((UINT32)saveSlotSelected, 0); @@ -5155,12 +7172,11 @@ static void M_ReadSavegameInfo(UINT32 slot) INT32 fake; // Dummy variable char temp[sizeof(timeattackfolder)]; char vcheck[VERSIONSIZE]; -#ifdef SAVEGAMES_OTHERVERSIONS - boolean oldversion = false; -#endif sprintf(savename, savegamename, slot); + slot--; + length = FIL_ReadFile(savename, &savebuffer); if (length == 0) { @@ -5176,14 +7192,7 @@ static void M_ReadSavegameInfo(UINT32 slot) // Version check memset(vcheck, 0, sizeof (vcheck)); sprintf(vcheck, "version %d", VERSION); - if (strcmp((const char *)save_p, (const char *)vcheck)) - { -#ifdef SAVEGAMES_OTHERVERSIONS - oldversion = true; -#else - BADSAVE // Incompatible versions? -#endif - } + if (strcmp((const char *)save_p, (const char *)vcheck)) BADSAVE save_p += VERSIONSIZE; // dearchive all the modifications @@ -5195,30 +7204,19 @@ static void M_ReadSavegameInfo(UINT32 slot) if (((fake-1) & 8191) >= NUMMAPS) BADSAVE if(!mapheaderinfo[(fake-1) & 8191]) - { savegameinfo[slot].levelname[0] = '\0'; - savegameinfo[slot].actnum = 0; - } else { - strcpy(savegameinfo[slot].levelname, mapheaderinfo[(fake-1) & 8191]->lvlttl); - savegameinfo[slot].actnum = mapheaderinfo[(fake-1) & 8191]->actnum; + strlcpy(savegameinfo[slot].levelname, mapheaderinfo[(fake-1) & 8191]->lvlttl, 17+1); + + if (strlen(mapheaderinfo[(fake-1) & 8191]->lvlttl) >= 17) + strcpy(savegameinfo[slot].levelname+17-3, "..."); } -#ifdef SAVEGAMES_OTHERVERSIONS - if (oldversion) - { - if (fake == 24) //meh, let's count old Clear! saves too - fake |= 8192; - fake |= 16384; // marker for outdated version - } -#endif savegameinfo[slot].gamemap = fake; CHECKPOS - fake = READUINT16(save_p)-357; // emeralds - - savegameinfo[slot].numemeralds = (UINT8)fake; + savegameinfo[slot].numemeralds = READUINT16(save_p)-357; // emeralds CHECKPOS READSTRINGN(save_p, temp, sizeof(temp)); // mod it belongs to @@ -5227,39 +7225,25 @@ static void M_ReadSavegameInfo(UINT32 slot) // P_UnArchivePlayer() CHECKPOS - savegameinfo[slot].skincolor = READUINT8(save_p); - CHECKPOS - savegameinfo[slot].skinnum = READUINT8(save_p); + fake = READUINT16(save_p); + savegameinfo[slot].skinnum = fake & ((1<<5) - 1); + if (savegameinfo[slot].skinnum >= numskins + || !R_SkinUsable(-1, savegameinfo[slot].skinnum)) + BADSAVE + savegameinfo[slot].botskin = fake >> 5; + if (savegameinfo[slot].botskin-1 >= numskins + || !R_SkinUsable(-1, savegameinfo[slot].botskin-1)) + BADSAVE + CHECKPOS + savegameinfo[slot].numgameovers = READUINT8(save_p); // numgameovers + CHECKPOS + savegameinfo[slot].lives = READSINT8(save_p); // lives CHECKPOS (void)READINT32(save_p); // Score - - CHECKPOS - savegameinfo[slot].lives = READINT32(save_p); // lives CHECKPOS savegameinfo[slot].continues = READINT32(save_p); // continues - if (fake & (1<<10)) - { - CHECKPOS - savegameinfo[slot].botskin = READUINT8(save_p); - if (savegameinfo[slot].botskin-1 >= numskins) - savegameinfo[slot].botskin = 0; - CHECKPOS - savegameinfo[slot].botcolor = READUINT8(save_p); // because why not. - } - else - savegameinfo[slot].botskin = 0; - - if (savegameinfo[slot].botskin) - snprintf(savegameinfo[slot].playername, 36, "%s & %s", - skins[savegameinfo[slot].skinnum].realname, - skins[savegameinfo[slot].botskin-1].realname); - else - strcpy(savegameinfo[slot].playername, skins[savegameinfo[slot].skinnum].realname); - - savegameinfo[slot].playername[31] = 0; - // File end marker check CHECKPOS if (READUINT8(save_p) != 0x1d) BADSAVE; @@ -5278,23 +7262,78 @@ static void M_ReadSavegameInfo(UINT32 slot) static void M_ReadSaveStrings(void) { FILE *handle; - UINT32 i; + SINT8 i; char name[256]; + boolean nofile[MAXSAVEGAMES-1]; + SINT8 tolerance = 3; // empty slots at any time + UINT8 lastseen = 0; - for (i = 0; i < MAXSAVEGAMES; i++) + loadgamescroll = 0; + loadgameoffset = 14; + + for (i = 1; (i < MAXSAVEGAMES); i++) // slot 0 is no save { snprintf(name, sizeof name, savegamename, i); name[sizeof name - 1] = '\0'; handle = fopen(name, "rb"); - if (handle == NULL) + if ((nofile[i-1] = (handle == NULL))) + continue; + fclose(handle); + lastseen = i; + } + + if (savegameinfo) + Z_Free(savegameinfo); + savegameinfo = NULL; + + if (lastseen < saveSlotSelected) + lastseen = saveSlotSelected; + + i = lastseen; + + for (; (lastseen > 0 && tolerance); lastseen--) + { + if (nofile[lastseen-1]) + tolerance--; + } + + if ((i += tolerance+1) > MAXSAVEGAMES) // show 3 empty slots at minimum + i = MAXSAVEGAMES; + + numsaves = i; + savegameinfo = Z_Realloc(savegameinfo, numsaves*sizeof(saveinfo_t), PU_STATIC, NULL); + if (!savegameinfo) + I_Error("Insufficient memory to prepare save platter"); + + for (; i > 0; i--) + { + if (nofile[i-1] == true) { - savegameinfo[i].lives = -42; + savegameinfo[i-1].lives = -42; continue; } - fclose(handle); M_ReadSavegameInfo(i); } + + if (savselp[0]) // never going to have some provided but not all, saves individually checking + { + W_UnlockCachedPatch(savselp[0]); + W_UnlockCachedPatch(savselp[1]); + W_UnlockCachedPatch(savselp[2]); + + W_UnlockCachedPatch(savselp[3]); + W_UnlockCachedPatch(savselp[4]); + W_UnlockCachedPatch(savselp[5]); + } + + savselp[0] = W_CachePatchName("SAVEBACK", PU_STATIC); + savselp[1] = W_CachePatchName("SAVENONE", PU_STATIC); + savselp[2] = W_CachePatchName("ULTIMATE", PU_STATIC); + + savselp[3] = W_CachePatchName("GAMEDONE", PU_STATIC); + savselp[4] = W_CachePatchName("BLACXLVL", PU_STATIC); + savselp[5] = W_CachePatchName("BLANKLVL", PU_STATIC); } // @@ -5312,8 +7351,19 @@ static void M_SaveGameDeleteResponse(INT32 ch) name[sizeof name - 1] = '\0'; remove(name); - // Refresh savegame menu info - M_ReadSaveStrings(); + BwehHehHe(); + M_ReadSaveStrings(); // reload the menu +} + +static void M_SaveGameUltimateResponse(INT32 ch) +{ + if (ch != 'y' && ch != KEY_ENTER) + return; + + S_StartSound(NULL, sfx_menu1); + M_LoadSelect(saveSlotSelected); + SP_PlayerDef.prevMenu = MessageDef.prevMenu; + MessageDef.prevMenu = &SP_PlayerDef; } static void M_HandleLoadSave(INT32 choice) @@ -5322,26 +7372,46 @@ static void M_HandleLoadSave(INT32 choice) switch (choice) { - case KEY_DOWNARROW: - S_StartSound(NULL, sfx_menu1); + case KEY_RIGHTARROW: + S_StartSound(NULL, sfx_s3kb7); ++saveSlotSelected; - if (saveSlotSelected >= MAXSAVEGAMES) - saveSlotSelected -= MAXSAVEGAMES; - menumovedir = 1; + if (saveSlotSelected >= numsaves) + saveSlotSelected -= numsaves; + loadgamescroll = 90; break; - case KEY_UPARROW: - S_StartSound(NULL, sfx_menu1); + case KEY_LEFTARROW: + S_StartSound(NULL, sfx_s3kb7); --saveSlotSelected; if (saveSlotSelected < 0) - saveSlotSelected += MAXSAVEGAMES; - menumovedir = -1; + saveSlotSelected += numsaves; + loadgamescroll = -90; break; case KEY_ENTER: - S_StartSound(NULL, sfx_menu1); - if (savegameinfo[saveSlotSelected].lives != -666) // don't allow loading of "bad saves" + if (ultimate_selectable && saveSlotSelected == NOSAVESLOT) + { + loadgamescroll = 0; + S_StartSound(NULL, sfx_skid); + M_StartMessage("Are you sure you want to play\n\x85ultimate mode\x80? It isn't remotely fair,\nand you don't even get an emblem for it.\n\n(Press 'Y' to confirm)\n",M_SaveGameUltimateResponse,MM_YESNO); + } + else if (saveSlotSelected != NOSAVESLOT && savegameinfo[saveSlotSelected-1].lives == -42 && !(!modifiedgame || savemoddata)) + { + loadgamescroll = 0; + S_StartSound(NULL, sfx_skid); + M_StartMessage(M_GetText("This cannot be done in a modified game.\n\n(Press a key)\n"), NULL, MM_NOTHING); + } + else if (saveSlotSelected == NOSAVESLOT || savegameinfo[saveSlotSelected-1].lives != -666) // don't allow loading of "bad saves" + { + loadgamescroll = 0; + S_StartSound(NULL, sfx_menu1); M_LoadSelect(saveSlotSelected); + } + else if (!loadgameoffset) + { + S_StartSound(NULL, sfx_lose); + loadgameoffset = 14; + } break; case KEY_ESCAPE: @@ -5349,11 +7419,25 @@ static void M_HandleLoadSave(INT32 choice) break; case KEY_BACKSPACE: - S_StartSound(NULL, sfx_menu1); // Don't allow people to 'delete' "Play without Saving." // Nor allow people to 'delete' slots with no saves in them. - if (saveSlotSelected != NOSAVESLOT && savegameinfo[saveSlotSelected].lives != -42) - M_StartMessage(M_GetText("Are you sure you want to delete\nthis save game?\n\n(Press 'Y' to confirm)\n"),M_SaveGameDeleteResponse,MM_YESNO); + if (saveSlotSelected != NOSAVESLOT && savegameinfo[saveSlotSelected-1].lives != -42) + { + loadgamescroll = 0; + S_StartSound(NULL, sfx_skid); + M_StartMessage(va("Are you sure you want to delete\nsave file %d?\n\n(Press 'Y' to confirm)\n", saveSlotSelected),M_SaveGameDeleteResponse,MM_YESNO); + } + else if (!loadgameoffset) + { + if (saveSlotSelected == NOSAVESLOT && ultimate_selectable) + { + ultimate_selectable = false; + S_StartSound(NULL, sfx_strpst); + } + else + S_StartSound(NULL, sfx_lose); + loadgameoffset = 14; + } break; } if (exitmenu) @@ -5362,6 +7446,28 @@ static void M_HandleLoadSave(INT32 choice) M_SetupNextMenu(currentMenu->prevMenu); else M_ClearMenus(true); + Z_Free(savegameinfo); + savegameinfo = NULL; + } +} + +static void M_FirstTimeResponse(INT32 ch) +{ + S_StartSound(NULL, sfx_menu1); + + if (ch == KEY_ESCAPE) + return; + + if (ch != 'y' && ch != KEY_ENTER) + { + CV_SetValue(&cv_tutorialprompt, 0); + M_ReadSaveStrings(); + MessageDef.prevMenu = &SP_LoadDef; // calls M_SetupNextMenu + } + else + { + M_StartTutorial(0); + MessageDef.prevMenu = &MessageDef; // otherwise, the controls prompt won't fire } } @@ -5372,6 +7478,13 @@ static void M_LoadGame(INT32 choice) { (void)choice; + if (tutorialmap && cv_tutorialprompt.value) + { + M_StartMessage("Do you want to \x82play a brief Tutorial\x80?\n\nWe highly recommend this because \nthe controls are slightly different \nfrom other games.\n\nPress 'Y' or 'Enter' to go\nPress 'N' or any key to skip\n", + M_FirstTimeResponse, MM_YESNO); + return; + } + M_ReadSaveStrings(); M_SetupNextMenu(&SP_LoadDef); } @@ -5381,14 +7494,15 @@ static void M_LoadGame(INT32 choice) // void M_ForceSaveSlotSelected(INT32 sslot) { - // Already there? Out of bounds? Whatever, then! - if (sslot == saveSlotSelected || sslot >= MAXSAVEGAMES) + loadgameoffset = 14; + + // Already there? Whatever, then! + if (sslot == saveSlotSelected) return; - // Figure out whether to display up movement or down movement - menumovedir = (saveSlotSelected - sslot) > 0 ? -1 : 1; - if (abs(saveSlotSelected - sslot) > (MAXSAVEGAMES>>1)) - menumovedir *= -1; + loadgamescroll = 90; + if (saveSlotSelected <= numsaves/2) + loadgamescroll = -loadgamescroll; saveSlotSelected = sslot; } @@ -5399,25 +7513,145 @@ void M_ForceSaveSlotSelected(INT32 sslot) static void M_SetupChoosePlayer(INT32 choice) { + INT32 skinnum; + UINT8 i; + UINT8 firstvalid = 255; + UINT8 lastvalid = 0; + boolean allowed = false; + char *name; (void)choice; - if (mapheaderinfo[startmap-1] && mapheaderinfo[startmap-1]->forcecharacter[0] != '\0') + SP_PlayerMenu[0].status &= ~IT_DYBIGSPACE; // Correcting a hack that may be made below. + + for (i = 0; i < 32; i++) // Handle charsels, availability, and unlocks. { - M_ChoosePlayer(0); //oh for crying out loud just get STARTED, it doesn't matter! + if (description[i].used) // If the character's disabled through SOC, there's nothing we can do for it. + { + name = strtok(Z_StrDup(description[i].skinname), "&"); + skinnum = R_SkinAvailable(name); + if ((skinnum != -1) && (R_SkinUsable(-1, skinnum))) + { + // Handling order. + if (firstvalid == 255) + firstvalid = i; + else + { + description[i].prev = lastvalid; + description[lastvalid].next = i; + } + lastvalid = i; + + if (i == char_on) + allowed = true; + + if (description[i].picname[0] == '\0') + strncpy(description[i].picname, skins[skinnum].charsel, 8); + } + // else -- Technically, character select icons without corresponding skins get bundled away behind this too. Sucks to be them. + Z_Free(name); + } + } + + if ((firstvalid != 255) + && !(mapheaderinfo[startmap-1] + && (mapheaderinfo[startmap-1]->forcecharacter[0] != '\0') + ) + ) + { // One last bit of order we can't do in the iteration above. + description[firstvalid].prev = lastvalid; + description[lastvalid].next = firstvalid; + } + else // We're being forced into a specific character, so might as well. + { + SP_PlayerMenu[0].status |= IT_DYBIGSPACE; // This is a dummy flag hack to make a non-IT_CALL character in slot 0 not softlock the game. + M_ChoosePlayer(0); return; } if (Playing() == false) - { - S_StopMusic(); - S_ChangeMusicInternal("chrsel", true); - } + M_ChangeMenuMusic("_chsel", true); SP_PlayerDef.prevMenu = currentMenu; M_SetupNextMenu(&SP_PlayerDef); - char_scroll = itemOn*128*FRACUNIT; // finish scrolling the menu + if (!allowed) + { + char_on = firstvalid; + if (startchar > 0 && startchar < 32) + { + INT16 workchar = startchar; + while (workchar--) + char_on = description[char_on].next; + } + } + char_scroll = 0; // finish scrolling the menu Z_Free(char_notes); - char_notes = NULL; + char_notes = V_WordWrap(0, 21*8, V_ALLOWLOWERCASE, description[char_on].notes); +} + +// +// M_HandleChoosePlayerMenu +// +// Reacts to your key inputs. Basically a mini menu thinker. +// +static void M_HandleChoosePlayerMenu(INT32 choice) +{ + boolean exitmenu = false; // exit to previous menu + INT32 selectval; + + switch (choice) + { + case KEY_DOWNARROW: + if ((selectval = description[char_on].next) != char_on) + { + S_StartSound(NULL,sfx_s3kb7); + char_on = selectval; + char_scroll = -128*FRACUNIT; + Z_Free(char_notes); + char_notes = V_WordWrap(0, 21*8, V_ALLOWLOWERCASE, description[char_on].notes); + } + else if (!char_scroll) + { + S_StartSound(NULL,sfx_s3kb7); + char_scroll = 16*FRACUNIT; + } + break; + + case KEY_UPARROW: + if ((selectval = description[char_on].prev) != char_on) + { + S_StartSound(NULL,sfx_s3kb7); + char_on = selectval; + char_scroll = 128*FRACUNIT; + Z_Free(char_notes); + char_notes = V_WordWrap(0, 21*8, V_ALLOWLOWERCASE, description[char_on].notes); + } + else if (!char_scroll) + { + S_StartSound(NULL,sfx_s3kb7); + char_scroll = -16*FRACUNIT; + } + break; + + case KEY_ENTER: + S_StartSound(NULL, sfx_menu1); + M_ChoosePlayer(char_on); + break; + + case KEY_ESCAPE: + exitmenu = true; + break; + + default: + break; + } + + if (exitmenu) + { + if (currentMenu->prevMenu) + M_SetupNextMenu(currentMenu->prevMenu); + else + M_ClearMenus(true); + } } // Draw the choose player setup menu, had some fun with player anim @@ -5425,125 +7659,88 @@ static void M_DrawSetupChoosePlayerMenu(void) { const INT32 my = 24; patch_t *patch; - INT32 i, o, j; - char *picname; + INT32 i, o; + UINT8 prev, next; // Black BG - V_DrawFill(0, 0, BASEVIDWIDTH, BASEVIDHEIGHT, 31); - //V_DrawPatchFill(W_CachePatchName("SRB2BACK", PU_CACHE)); + if (curbgcolor >= 0) + V_DrawFill(0, 0, BASEVIDWIDTH, BASEVIDHEIGHT, curbgcolor); + else if (!curbghide || !titlemapinaction) + F_SkyScroll(curbgxspeed, curbgyspeed, curbgname); + if (curfadevalue) + V_DrawFadeScreen(0xFF00, curfadevalue); // Character select profile images!1 M_DrawTextBox(0, my, 16, 20); - if (abs(itemOn*128*FRACUNIT - char_scroll) > 256*FRACUNIT) - char_scroll = itemOn*128*FRACUNIT; - else if (itemOn*128*FRACUNIT - char_scroll > 128*FRACUNIT) - char_scroll += 48*FRACUNIT; - else if (itemOn*128*FRACUNIT - char_scroll < -128*FRACUNIT) - char_scroll -= 48*FRACUNIT; - else if (itemOn*128*FRACUNIT > char_scroll+16*FRACUNIT) - char_scroll += 16*FRACUNIT; - else if (itemOn*128*FRACUNIT < char_scroll-16*FRACUNIT) - char_scroll -= 16*FRACUNIT; + if (abs(char_scroll) > FRACUNIT) + char_scroll -= (char_scroll>>2); else // close enough. - char_scroll = itemOn*128*FRACUNIT; // just be exact now. - i = (char_scroll+16*FRACUNIT)/(128*FRACUNIT); - o = ((char_scroll/FRACUNIT)+16)%128; + char_scroll = 0; // just be exact now. - // prev character - if (i-1 >= 0 && PlayerMenu[i-1].status != IT_DISABLED - && o < 32) + o = (char_scroll >> FRACBITS) + 16; + + if (o < 0) // A little hacky... { - picname = description[i-1].picname; - if (picname[0] == '\0') - { - picname = strtok(Z_StrDup(description[i-1].skinname), "&"); - for (j = 0; j < numskins; j++) - if (stricmp(skins[j].name, picname) == 0) - { - Z_Free(picname); - picname = skins[j].charsel; - break; - } - if (j == numskins) // AAAAAAAAAA - picname = skins[0].charsel; - } - patch = W_CachePatchName(picname, PU_CACHE); - if (SHORT(patch->width) >= 256) - V_DrawCroppedPatch(8<height) - 64 + o*2, SHORT(patch->width), SHORT(patch->height)); - else - V_DrawCroppedPatch(8<height) - 32 + o, SHORT(patch->width), SHORT(patch->height)); - W_UnlockCachedPatch(patch); + i = description[char_on].prev; + o += 128; } + else + i = char_on; - // next character - if (i+1 < currentMenu->numitems && PlayerMenu[i+1].status != IT_DISABLED - && o < 128) - { - picname = description[i+1].picname; - if (picname[0] == '\0') - { - picname = strtok(Z_StrDup(description[i+1].skinname), "&"); - for (j = 0; j < numskins; j++) - if (stricmp(skins[j].name, picname) == 0) - { - Z_Free(picname); - picname = skins[j].charsel; - break; - } - if (j == numskins) // AAAAAAAAAA - picname = skins[0].charsel; - } - patch = W_CachePatchName(picname, PU_CACHE); - if (SHORT(patch->width) >= 256) - V_DrawCroppedPatch(8<width), o*2); - else - V_DrawCroppedPatch(8<width), o); - W_UnlockCachedPatch(patch); - } + // Get prev character... + prev = description[i].prev; - // current character - if (i < currentMenu->numitems && PlayerMenu[i].status != IT_DISABLED) + if (prev != i) // If there's more than one character available... { - picname = description[i].picname; - if (picname[0] == '\0') - { - picname = strtok(Z_StrDup(description[i].skinname), "&"); - for (j = 0; j < numskins; j++) - if (stricmp(skins[j].name, picname) == 0) - { - Z_Free(picname); - picname = skins[j].charsel; - break; - } - if (j == numskins) // AAAAAAAAAA - picname = skins[0].charsel; - } - patch = W_CachePatchName(picname, PU_CACHE); - if (o >= 0 && o <= 32) + // Let's get the next character now. + next = description[i].next; + + // Draw prev character if it's visible and its number isn't greater than the current one or there's more than two + if (o < 32) { + patch = W_CachePatchName(description[prev].picname, PU_CACHE); if (SHORT(patch->width) >= 256) - V_DrawSmallScaledPatch(8, my + 40 - o, 0, patch); + V_DrawCroppedPatch(8<height) + 2*(o-32), SHORT(patch->width), 64 - 2*o); else - V_DrawScaledPatch(8, my + 40 - o, 0, patch); + V_DrawCroppedPatch(8<height) + o - 32, SHORT(patch->width), 32 - o); + W_UnlockCachedPatch(patch); } - else + + // Draw next character if it's visible and its number isn't less than the current one or there's more than two + if (o < 128) // (next != i) was previously a part of this, but it's implicitly true if (prev != i) is true. { + patch = W_CachePatchName(description[next].picname, PU_CACHE); if (SHORT(patch->width) >= 256) - V_DrawCroppedPatch(8<width), SHORT(patch->height)); + V_DrawCroppedPatch(8<width), 2*o); else - V_DrawCroppedPatch(8<width), SHORT(patch->height)); + V_DrawCroppedPatch(8<width), o); + W_UnlockCachedPatch(patch); } - W_UnlockCachedPatch(patch); } + patch = W_CachePatchName(description[i].picname, PU_CACHE); + if (o >= 0 && o <= 32) + { + if (SHORT(patch->width) >= 256) + V_DrawSmallScaledPatch(8, my + 40 - o, 0, patch); + else + V_DrawScaledPatch(8, my + 40 - o, 0, patch); + } + else + { + if (SHORT(patch->width) >= 256) + V_DrawCroppedPatch(8<width), SHORT(patch->height) - 2*(o-32)); + else + V_DrawCroppedPatch(8<width), SHORT(patch->height) - (o-32)); + } + W_UnlockCachedPatch(patch); + // draw title (or big pic) M_DrawMenuTitle(); // Character description M_DrawTextBox(136, my, 21, 20); - if (!char_notes) - char_notes = V_WordWrap(0, 21*8, V_ALLOWLOWERCASE, description[itemOn].notes); V_DrawString(146, my + 9, V_RETURN8|V_ALLOWLOWERCASE, char_notes); } @@ -5554,11 +7751,11 @@ static void M_ChoosePlayer(INT32 choice) INT32 skinnum; boolean ultmode = (ultimate_selectable && SP_PlayerDef.prevMenu == &SP_LoadDef && saveSlotSelected == NOSAVESLOT); - // skip this if forcecharacter - if (mapheaderinfo[startmap-1] && mapheaderinfo[startmap-1]->forcecharacter[0] == '\0') + // skip this if forcecharacter or no characters available + if (!(SP_PlayerMenu[0].status & IT_DYBIGSPACE)) { // M_SetupChoosePlayer didn't call us directly, that means we've been properly set up. - char_scroll = itemOn*128*FRACUNIT; // finish scrolling the menu + char_scroll = 0; // finish scrolling the menu M_DrawSetupChoosePlayerMenu(); // draw the finally selected character one last time for the fadeout } M_ClearMenus(true); @@ -5584,13 +7781,21 @@ static void M_ChoosePlayer(INT32 choice) } if (startmap != spstage_start) - cursaveslot = -1; + cursaveslot = 0; - lastmapsaved = 0; + //lastmapsaved = 0; gamecomplete = false; G_DeferedInitNew(ultmode, G_BuildMapName(startmap), (UINT8)skinnum, false, fromlevelselect); COM_BufAddText("dummyconsvar 1\n"); // G_DeferedInitNew doesn't do this + + if (levelselect.rows) + Z_Free(levelselect.rows); + levelselect.rows = NULL; + + if (savegameinfo) + Z_Free(savegameinfo); + savegameinfo = NULL; } // =============== @@ -5617,29 +7822,30 @@ static void M_Statistics(INT32 choice) if (!(mapheaderinfo[i]->typeoflevel & TOL_SP) || (mapheaderinfo[i]->menuflags & LF2_HIDEINSTATS)) continue; - if (!mapvisited[i]) + if (!(mapvisited[i] & MV_MAX)) continue; statsMapList[j++] = i; } statsMapList[j] = -1; - statsMax = j - 13 + numextraemblems; + statsMax = j - 11 + numextraemblems; statsLocation = 0; if (statsMax < 0) statsMax = 0; - M_SetupNextMenu(&SP_GameStatsDef); + M_SetupNextMenu(&SP_LevelStatsDef); } static void M_DrawStatsMaps(int location) { - INT32 y = 76, i = -1; + INT32 y = 80, i = -1; INT16 mnum; extraemblem_t *exemblem; + boolean dotopname = true, dobottomarrow = (location < statsMax); - V_DrawString(20, y-12, 0, "LEVEL NAME"); - V_DrawString(248, y-12, 0, "EMBLEMS"); + if (location) + V_DrawString(10, y-(skullAnimCounter/5), V_YELLOWMAP, "\x1A"); while (statsMapList[++i] != -1) { @@ -5648,6 +7854,13 @@ static void M_DrawStatsMaps(int location) --location; continue; } + else if (dotopname) + { + V_DrawString(20, y, V_GREENMAP, "LEVEL NAME"); + V_DrawString(248, y, V_GREENMAP, "EMBLEMS"); + y += 8; + dotopname = false; + } mnum = statsMapList[i]; M_DrawMapEmblems(mnum+1, 292, y); @@ -5660,21 +7873,36 @@ static void M_DrawStatsMaps(int location) y += 8; if (y >= BASEVIDHEIGHT-8) - return; + goto bottomarrow; } + if (dotopname && !location) + { + V_DrawString(20, y, V_GREENMAP, "LEVEL NAME"); + V_DrawString(248, y, V_GREENMAP, "EMBLEMS"); + y += 8; + } + else if (location) + --location; // Extra Emblems for (i = -2; i < numextraemblems; ++i) { + if (i == -1) + { + V_DrawString(20, y, V_GREENMAP, "EXTRA EMBLEMS"); + if (location) + { + y += 8; + location++; + } + } if (location) { --location; continue; } - if (i == -1) - V_DrawString(20, y, V_GREENMAP, "EXTRA EMBLEMS"); - else if (i >= 0) + if (i >= 0) { exemblem = &extraemblems[i]; @@ -5690,17 +7918,87 @@ static void M_DrawStatsMaps(int location) y += 8; if (y >= BASEVIDHEIGHT-8) - return; + goto bottomarrow; } +bottomarrow: + if (dobottomarrow) + V_DrawString(10, y-8 + (skullAnimCounter/5), V_YELLOWMAP, "\x1B"); } static void M_DrawLevelStats(void) { - M_DrawMenuTitle(); - V_DrawCenteredString(BASEVIDWIDTH/2, 24, V_YELLOWMAP, "PAGE 2 OF 2"); + char beststr[40]; - V_DrawString(72, 48, 0, va("x %d/%d", M_CountEmblems(), numemblems+numextraemblems)); - V_DrawScaledPatch(40, 48-4, 0, W_CachePatchName("EMBLICON", PU_STATIC)); + tic_t besttime = 0; + UINT32 bestscore = 0; + UINT32 bestrings = 0; + + INT32 i; + INT32 mapsunfinished = 0; + boolean bestunfinished[3] = {false, false, false}; + + M_DrawMenuTitle(); + + V_DrawString(20, 24, V_YELLOWMAP, "Total Play Time:"); + V_DrawCenteredString(BASEVIDWIDTH/2, 32, 0, va("%i hours, %i minutes, %i seconds", + G_TicsToHours(totalplaytime), + G_TicsToMinutes(totalplaytime, false), + G_TicsToSeconds(totalplaytime))); + + for (i = 0; i < NUMMAPS; i++) + { + boolean mapunfinished = false; + + if (!mapheaderinfo[i] || !(mapheaderinfo[i]->menuflags & LF2_RECORDATTACK)) + continue; + + if (!mainrecords[i]) + { + mapsunfinished++; + bestunfinished[0] = bestunfinished[1] = bestunfinished[2] = true; + continue; + } + + if (mainrecords[i]->score > 0) + bestscore += mainrecords[i]->score; + else + mapunfinished = bestunfinished[0] = true; + + if (mainrecords[i]->time > 0) + besttime += mainrecords[i]->time; + else + mapunfinished = bestunfinished[1] = true; + + if (mainrecords[i]->rings > 0) + bestrings += mainrecords[i]->rings; + else + mapunfinished = bestunfinished[2] = true; + + if (mapunfinished) + mapsunfinished++; + } + + V_DrawString(20, 48, 0, "Combined records:"); + + if (mapsunfinished) + V_DrawString(20, 56, V_REDMAP, va("(%d unfinished)", mapsunfinished)); + else + V_DrawString(20, 56, V_GREENMAP, "(complete)"); + + V_DrawString(36, 64, 0, va("x %d/%d", M_CountEmblems(), numemblems+numextraemblems)); + V_DrawSmallScaledPatch(20, 64, 0, W_CachePatchName("EMBLICON", PU_STATIC)); + + sprintf(beststr, "%u", bestscore); + V_DrawString(BASEVIDWIDTH/2, 48, V_YELLOWMAP, "SCORE:"); + V_DrawRightAlignedString(BASEVIDWIDTH-16, 48, (bestunfinished[0] ? V_REDMAP : 0), beststr); + + sprintf(beststr, "%i:%02i:%02i.%02i", G_TicsToHours(besttime), G_TicsToMinutes(besttime, false), G_TicsToSeconds(besttime), G_TicsToCentiseconds(besttime)); + V_DrawString(BASEVIDWIDTH/2, 56, V_YELLOWMAP, "TIME:"); + V_DrawRightAlignedString(BASEVIDWIDTH-16, 56, (bestunfinished[1] ? V_REDMAP : 0), beststr); + + sprintf(beststr, "%u", bestrings); + V_DrawString(BASEVIDWIDTH/2, 64, V_YELLOWMAP, "RINGS:"); + V_DrawRightAlignedString(BASEVIDWIDTH-16, 64, (bestunfinished[2] ? V_REDMAP : 0), beststr); M_DrawStatsMaps(statsLocation); } @@ -5724,120 +8022,19 @@ static void M_HandleLevelStats(INT32 choice) --statsLocation; break; - case KEY_RIGHTARROW: + case KEY_PGDN: S_StartSound(NULL, sfx_menu1); - statsLocation += (statsLocation+15 >= statsMax) ? statsMax-statsLocation : 15; + statsLocation += (statsLocation+13 >= statsMax) ? statsMax-statsLocation : 13; break; - case KEY_LEFTARROW: + case KEY_PGUP: S_StartSound(NULL, sfx_menu1); - statsLocation -= (statsLocation < 15) ? statsLocation : 15; + statsLocation -= (statsLocation < 13) ? statsLocation : 13; break; case KEY_ESCAPE: exitmenu = true; break; - - case KEY_ENTER: - S_StartSound(NULL, sfx_menu1); - M_SetupNextMenu(&SP_GameStatsDef); - break; - } - if (exitmenu) - { - if (currentMenu->prevMenu) - M_SetupNextMenu(currentMenu->prevMenu); - else - M_ClearMenus(true); - } -} - -// Handle GAME statistics. -static void M_DrawGameStats(void) -{ - char beststr[40]; - - tic_t besttime = 0; - UINT32 bestscore = 0; - UINT32 bestrings = 0; - - INT32 i; - INT32 mapsunfinished[3] = {0, 0, 0}; - - M_DrawMenuTitle(); - V_DrawCenteredString(BASEVIDWIDTH/2, 24, V_YELLOWMAP, "PAGE 1 OF 2"); - - V_DrawString(32, 60, V_YELLOWMAP, "Total Play Time:"); - V_DrawRightAlignedString(BASEVIDWIDTH-32, 70, 0, va("%i hours, %i minutes, %i seconds", - G_TicsToHours(totalplaytime), - G_TicsToMinutes(totalplaytime, false), - G_TicsToSeconds(totalplaytime))); - - for (i = 0; i < NUMMAPS; i++) - { - if (!mapheaderinfo[i] || !(mapheaderinfo[i]->menuflags & LF2_RECORDATTACK)) - continue; - - if (!mainrecords[i]) - { - mapsunfinished[0]++; - mapsunfinished[1]++; - mapsunfinished[2]++; - continue; - } - - if (mainrecords[i]->score > 0) - bestscore += mainrecords[i]->score; - else - mapsunfinished[0]++; - - if (mainrecords[i]->time > 0) - besttime += mainrecords[i]->time; - else - mapsunfinished[1]++; - - if (mainrecords[i]->rings > 0) - bestrings += mainrecords[i]->rings; - else - mapsunfinished[2]++; - - } - - V_DrawCenteredString(BASEVIDWIDTH/2, 90, 0, "* COMBINED RECORDS *"); - - sprintf(beststr, "%u", bestscore); - V_DrawString(32, 100, V_YELLOWMAP, "SCORE:"); - V_DrawRightAlignedString(BASEVIDWIDTH-32, 100, 0, beststr); - if (mapsunfinished[0]) - V_DrawRightAlignedString(BASEVIDWIDTH-32, 108, V_REDMAP, va("(%d unfinished)", mapsunfinished[0])); - - sprintf(beststr, "%i:%02i:%02i.%02i", G_TicsToHours(besttime), G_TicsToMinutes(besttime, false), G_TicsToSeconds(besttime), G_TicsToCentiseconds(besttime)); - V_DrawString(32, 120, V_YELLOWMAP, "TIME:"); - V_DrawRightAlignedString(BASEVIDWIDTH-32, 120, 0, beststr); - if (mapsunfinished[1]) - V_DrawRightAlignedString(BASEVIDWIDTH-32, 128, V_REDMAP, va("(%d unfinished)", mapsunfinished[1])); - - sprintf(beststr, "%u", bestrings); - V_DrawString(32, 140, V_YELLOWMAP, "RINGS:"); - V_DrawRightAlignedString(BASEVIDWIDTH-32, 140, 0, beststr); - if (mapsunfinished[2]) - V_DrawRightAlignedString(BASEVIDWIDTH-32, 148, V_REDMAP, va("(%d unfinished)", mapsunfinished[2])); -} - -static void M_HandleGameStats(INT32 choice) -{ - boolean exitmenu = false; // exit to previous menu - - switch (choice) - { - case KEY_ESCAPE: - exitmenu = true; - break; - - case KEY_ENTER: - S_StartSound(NULL, sfx_menu1); - M_SetupNextMenu(&SP_LevelStatsDef); - break; } if (exitmenu) { @@ -5857,13 +8054,16 @@ void M_DrawTimeAttackMenu(void) { INT32 i, x, y, cursory = 0; UINT16 dispstatus; - patch_t *PictureOfLevel, *PictureOfUrFace; - lumpnum_t lumpnum; - char beststr[40]; + patch_t *PictureOfUrFace; - S_ChangeMusicInternal("racent", true); // Eww, but needed for when user hits escape during demo playback + M_ChangeMenuMusic("_inter", true); // Eww, but needed for when user hits escape during demo playback - V_DrawPatchFill(W_CachePatchName("SRB2BACK", PU_CACHE)); + if (curbgcolor >= 0) + V_DrawFill(0, 0, BASEVIDWIDTH, BASEVIDHEIGHT, curbgcolor); + else if (!curbghide || !titlemapinaction) + F_SkyScroll(curbgxspeed, curbgyspeed, curbgname); + if (curfadevalue) + V_DrawFadeScreen(0xFF00, curfadevalue); M_DrawMenuTitle(); @@ -5896,6 +8096,13 @@ void M_DrawTimeAttackMenu(void) // Should see nothing but strings V_DrawString(BASEVIDWIDTH - x - soffset - V_StringWidth(cv->string, 0), y, V_YELLOWMAP, cv->string); + if (i == itemOn) + { + V_DrawCharacter(BASEVIDWIDTH - x - soffset - 10 - V_StringWidth(cv->string, 0) - (skullAnimCounter/5), y, + '\x1C' | V_YELLOWMAP, false); + V_DrawCharacter(BASEVIDWIDTH - x - soffset + 2 + (skullAnimCounter/5), y, + '\x1D' | V_YELLOWMAP, false); + } } } @@ -5903,16 +8110,6 @@ void M_DrawTimeAttackMenu(void) V_DrawScaledPatch(currentMenu->x - 24, cursory, 0, W_CachePatchName("M_CURSOR", PU_CACHE)); V_DrawString(currentMenu->x, cursory, V_YELLOWMAP, currentMenu->menuitems[itemOn].text); - // A 160x100 image of the level as entry MAPxxP - lumpnum = W_CheckNumForName(va("%sP", G_BuildMapName(cv_nextmap.value))); - - if (lumpnum != LUMPERROR) - PictureOfLevel = W_CachePatchName(va("%sP", G_BuildMapName(cv_nextmap.value)), PU_CACHE); - else - PictureOfLevel = W_CachePatchName("BLANKLVL", PU_CACHE); - - V_DrawSmallScaledPatch(208, 32, 0, PictureOfLevel); - // Character face! if (W_CheckNumForName(skins[cv_chooseskin.value-1].charsel) != LUMPERROR) { @@ -5928,16 +8125,31 @@ void M_DrawTimeAttackMenu(void) { emblem_t *em; INT32 yHeight; + patch_t *PictureOfLevel; + lumpnum_t lumpnum; + char beststr[40]; - V_DrawCenteredString(104, 32, 0, "* LEVEL RECORDS *"); + M_DrawLevelPlatterHeader(32-lsheadingheight/2, cv_nextmap.string, true, false); + + // A 160x100 image of the level as entry MAPxxP + lumpnum = W_CheckNumForName(va("%sP", G_BuildMapName(cv_nextmap.value))); + + if (lumpnum != LUMPERROR) + PictureOfLevel = W_CachePatchName(va("%sP", G_BuildMapName(cv_nextmap.value)), PU_CACHE); + else + PictureOfLevel = W_CachePatchName("BLANKLVL", PU_CACHE); + + V_DrawSmallScaledPatch(208, 32+lsheadingheight, 0, PictureOfLevel); + + V_DrawString(104 - 72, 32+lsheadingheight/2, 0, "* LEVEL RECORDS *"); if (!mainrecords[cv_nextmap.value-1] || !mainrecords[cv_nextmap.value-1]->score) sprintf(beststr, "(none)"); else sprintf(beststr, "%u", mainrecords[cv_nextmap.value-1]->score); - V_DrawString(104-72, 48, V_YELLOWMAP, "SCORE:"); - V_DrawRightAlignedString(104+72, 48, V_ALLOWLOWERCASE, beststr); + V_DrawString(104-72, 48+lsheadingheight/2, V_YELLOWMAP, "SCORE:"); + V_DrawRightAlignedString(104+72, 48+lsheadingheight/2, V_ALLOWLOWERCASE, beststr); if (!mainrecords[cv_nextmap.value-1] || !mainrecords[cv_nextmap.value-1]->time) sprintf(beststr, "(none)"); @@ -5946,16 +8158,16 @@ void M_DrawTimeAttackMenu(void) G_TicsToSeconds(mainrecords[cv_nextmap.value-1]->time), G_TicsToCentiseconds(mainrecords[cv_nextmap.value-1]->time)); - V_DrawString(104-72, 58, V_YELLOWMAP, "TIME:"); - V_DrawRightAlignedString(104+72, 58, V_ALLOWLOWERCASE, beststr); + V_DrawString(104-72, 58+lsheadingheight/2, V_YELLOWMAP, "TIME:"); + V_DrawRightAlignedString(104+72, 58+lsheadingheight/2, V_ALLOWLOWERCASE, beststr); if (!mainrecords[cv_nextmap.value-1] || !mainrecords[cv_nextmap.value-1]->rings) sprintf(beststr, "(none)"); else sprintf(beststr, "%hu", mainrecords[cv_nextmap.value-1]->rings); - V_DrawString(104-72, 68, V_YELLOWMAP, "RINGS:"); - V_DrawRightAlignedString(104+72, 68, V_ALLOWLOWERCASE, beststr); + V_DrawString(104-72, 68+lsheadingheight/2, V_YELLOWMAP, "RINGS:"); + V_DrawRightAlignedString(104+72, 68+lsheadingheight/2, V_ALLOWLOWERCASE, beststr); // Draw record emblems. em = M_GetLevelEmblems(cv_nextmap.value); @@ -5971,17 +8183,17 @@ void M_DrawTimeAttackMenu(void) } if (em->collected) - V_DrawSmallMappedPatch(104+76, yHeight, 0, W_CachePatchName(M_GetEmblemPatch(em), PU_CACHE), + V_DrawSmallMappedPatch(104+76, yHeight+lsheadingheight/2, 0, W_CachePatchName(M_GetEmblemPatch(em), PU_CACHE), R_GetTranslationColormap(TC_DEFAULT, M_GetEmblemColor(em), GTC_CACHE)); else - V_DrawSmallScaledPatch(104+76, yHeight, 0, W_CachePatchName("NEEDIT", PU_CACHE)); + V_DrawSmallScaledPatch(104+76, yHeight+lsheadingheight/2, 0, W_CachePatchName("NEEDIT", PU_CACHE)); skipThisOne: em = M_GetLevelEmblems(-1); } } - // ALWAYS DRAW level name and skin even when not on this menu! + // ALWAYS DRAW level and skin even when not on this menu! if (currentMenu != &SP_TimeAttackDef) { consvar_t *ncv; @@ -5989,27 +8201,30 @@ void M_DrawTimeAttackMenu(void) x = SP_TimeAttackDef.x; y = SP_TimeAttackDef.y; - for (i = 0; i < 2; ++i) - { - ncv = (consvar_t *)SP_TimeAttackMenu[i].itemaction; + V_DrawString(x, y + SP_TimeAttackMenu[talevel].alphaKey, V_TRANSLUCENT, SP_TimeAttackMenu[talevel].text); - V_DrawString(x, y + SP_TimeAttackMenu[i].alphaKey, V_TRANSLUCENT, SP_TimeAttackMenu[i].text); - V_DrawString(BASEVIDWIDTH - x - V_StringWidth(ncv->string, 0), - y + SP_TimeAttackMenu[i].alphaKey, V_YELLOWMAP|V_TRANSLUCENT, ncv->string); - } + ncv = (consvar_t *)SP_TimeAttackMenu[taplayer].itemaction; + V_DrawString(x, y + SP_TimeAttackMenu[taplayer].alphaKey, V_TRANSLUCENT, SP_TimeAttackMenu[taplayer].text); + V_DrawString(BASEVIDWIDTH - x - V_StringWidth(ncv->string, 0), y + SP_TimeAttackMenu[taplayer].alphaKey, V_YELLOWMAP|V_TRANSLUCENT, ncv->string); } } +static void M_TimeAttackLevelSelect(INT32 choice) +{ + (void)choice; + SP_TimeAttackLevelSelectDef.prevMenu = currentMenu; + M_SetupNextMenu(&SP_TimeAttackLevelSelectDef); +} + // Going to Time Attack menu... static void M_TimeAttack(INT32 choice) { (void)choice; - memset(skins_cons_t, 0, sizeof (skins_cons_t)); - + SP_TimeAttackDef.prevMenu = &MainDef; levellistmode = LLM_RECORDATTACK; // Don't be dependent on cv_newgametype - if (M_CountLevelsToShowInList() == 0) + if (!M_PrepareLevelPlatter(-1, true)) { M_StartMessage(M_GetText("No record-attackable levels found.\n"),NULL,MM_NOTHING); return; @@ -6017,119 +8232,168 @@ static void M_TimeAttack(INT32 choice) M_PatchSkinNameTable(); - M_PrepareLevelSelect(); + G_SetGamestate(GS_TIMEATTACK); // do this before M_SetupNextMenu so that menu meta state knows that we're switching M_SetupNextMenu(&SP_TimeAttackDef); - Nextmap_OnChange(); + if (!M_CanShowLevelInList(cv_nextmap.value-1, -1) && levelselect.rows[0].maplist[0]) + CV_SetValue(&cv_nextmap, levelselect.rows[0].maplist[0]); + else + Nextmap_OnChange(); itemOn = tastart; // "Start" is selected. - - G_SetGamestate(GS_TIMEATTACK); - S_ChangeMusicInternal("racent", true); } // Drawing function for Nights Attack void M_DrawNightsAttackMenu(void) { - patch_t *PictureOfLevel; - lumpnum_t lumpnum; - char beststr[40]; + INT32 i, x, y, cursory = 0; + UINT16 dispstatus; - S_ChangeMusicInternal("racent", true); // Eww, but needed for when user hits escape during demo playback + M_ChangeMenuMusic("_inter", true); // Eww, but needed for when user hits escape during demo playback - V_DrawPatchFill(W_CachePatchName("SRB2BACK", PU_CACHE)); + if (curbgcolor >= 0) + V_DrawFill(0, 0, BASEVIDWIDTH, BASEVIDHEIGHT, curbgcolor); + else if (!curbghide || !titlemapinaction) + F_SkyScroll(curbgxspeed, curbgyspeed, curbgname); + if (curfadevalue) + V_DrawFadeScreen(0xFF00, curfadevalue); + + M_DrawMenuTitle(); // draw menu (everything else goes on top of it) - M_DrawGenericMenu(); + // Sadly we can't just use generic mode menus because we need some extra hacks + x = currentMenu->x; + y = currentMenu->y; - // A 160x100 image of the level as entry MAPxxP - lumpnum = W_CheckNumForName(va("%sP", G_BuildMapName(cv_nextmap.value))); + for (i = 0; i < currentMenu->numitems; ++i) + { + dispstatus = (currentMenu->menuitems[i].status & IT_DISPLAY); + if (dispstatus != IT_STRING && dispstatus != IT_WHITESTRING) + continue; - if (lumpnum != LUMPERROR) - PictureOfLevel = W_CachePatchName(va("%sP", G_BuildMapName(cv_nextmap.value)), PU_CACHE); - else - PictureOfLevel = W_CachePatchName("BLANKLVL", PU_CACHE); + y = currentMenu->y+currentMenu->menuitems[i].alphaKey; + if (i == itemOn) + cursory = y; - V_DrawSmallScaledPatch(90, 28, 0, PictureOfLevel); + V_DrawString(x, y, (dispstatus == IT_WHITESTRING) ? V_YELLOWMAP : 0 , currentMenu->menuitems[i].text); + + // Cvar specific handling + if ((currentMenu->menuitems[i].status & IT_TYPE) == IT_CVAR) + { + consvar_t *cv = (consvar_t *)currentMenu->menuitems[i].itemaction; + INT32 soffset = 0; + + // hack to keep the menu from overlapping the overall grade icon + if (currentMenu != &SP_NightsAttackDef) + soffset = 80; + + // Should see nothing but strings + V_DrawString(BASEVIDWIDTH - x - soffset - V_StringWidth(cv->string, 0), y, V_YELLOWMAP, cv->string); + if (i == itemOn) + { + V_DrawCharacter(BASEVIDWIDTH - x - soffset - 10 - V_StringWidth(cv->string, 0) - (skullAnimCounter/5), y, + '\x1C' | V_YELLOWMAP, false); + V_DrawCharacter(BASEVIDWIDTH - x - soffset + 2 + (skullAnimCounter/5), y, + '\x1D' | V_YELLOWMAP, false); + } + } + } + + // DRAW THE SKULL CURSOR + V_DrawScaledPatch(currentMenu->x - 24, cursory, 0, W_CachePatchName("M_CURSOR", PU_CACHE)); + V_DrawString(currentMenu->x, cursory, V_YELLOWMAP, currentMenu->menuitems[itemOn].text); // Level record list if (cv_nextmap.value) { emblem_t *em; INT32 yHeight; + patch_t *PictureOfLevel; + lumpnum_t lumpnum; + char beststr[40]; UINT8 bestoverall = G_GetBestNightsGrade(cv_nextmap.value, 0); UINT8 bestgrade = G_GetBestNightsGrade(cv_nextmap.value, cv_dummymares.value); UINT32 bestscore = G_GetBestNightsScore(cv_nextmap.value, cv_dummymares.value); tic_t besttime = G_GetBestNightsTime(cv_nextmap.value, cv_dummymares.value); - if (P_HasGrades(cv_nextmap.value, 0)) - V_DrawScaledPatch(200, 28 + 8, 0, ngradeletters[bestoverall]); + M_DrawLevelPlatterHeader(32-lsheadingheight/2, cv_nextmap.string, true, false); - if (currentMenu == &SP_NightsAttackDef) - { - if (P_HasGrades(cv_nextmap.value, cv_dummymares.value)) - { - V_DrawString(160-88, 112, V_YELLOWMAP, "BEST GRADE:"); - V_DrawSmallScaledPatch(160 + 86 - (ngradeletters[bestgrade]->width/2), - 112 + 8 - (ngradeletters[bestgrade]->height/2), - 0, ngradeletters[bestgrade]); - } + // A 160x100 image of the level as entry MAPxxP + lumpnum = W_CheckNumForName(va("%sP", G_BuildMapName(cv_nextmap.value))); - if (!bestscore) - sprintf(beststr, "(none)"); - else - sprintf(beststr, "%u", bestscore); - - V_DrawString(160 - 88, 122, V_YELLOWMAP, "BEST SCORE:"); - V_DrawRightAlignedString(160 + 88, 122, V_ALLOWLOWERCASE, beststr); - - if (besttime == UINT32_MAX) - sprintf(beststr, "(none)"); - else - sprintf(beststr, "%i:%02i.%02i", G_TicsToMinutes(besttime, true), - G_TicsToSeconds(besttime), - G_TicsToCentiseconds(besttime)); - - V_DrawString(160-88, 132, V_YELLOWMAP, "BEST TIME:"); - V_DrawRightAlignedString(160+88, 132, V_ALLOWLOWERCASE, beststr); - - if (cv_dummymares.value == 0) { - // Draw record emblems. - em = M_GetLevelEmblems(cv_nextmap.value); - while (em) - { - switch (em->type) - { - case ET_NGRADE: yHeight = 112; break; - case ET_NTIME: yHeight = 132; break; - default: - goto skipThisOne; - } - - if (em->collected) - V_DrawSmallMappedPatch(160+88, yHeight, 0, W_CachePatchName(M_GetEmblemPatch(em), PU_CACHE), - R_GetTranslationColormap(TC_DEFAULT, M_GetEmblemColor(em), GTC_CACHE)); - else - V_DrawSmallScaledPatch(160+88, yHeight, 0, W_CachePatchName("NEEDIT", PU_CACHE)); - - skipThisOne: - em = M_GetLevelEmblems(-1); - } - } - } - // ALWAYS DRAW level name even when not on this menu! + if (lumpnum != LUMPERROR) + PictureOfLevel = W_CachePatchName(va("%sP", G_BuildMapName(cv_nextmap.value)), PU_CACHE); else - { - consvar_t *ncv; - INT32 x = SP_NightsAttackDef.x; - INT32 y = SP_NightsAttackDef.y; + PictureOfLevel = W_CachePatchName("BLANKLVL", PU_CACHE); - ncv = (consvar_t *)SP_NightsAttackMenu[0].itemaction; - V_DrawString(x, y + SP_NightsAttackMenu[0].alphaKey, V_TRANSLUCENT, SP_NightsAttackMenu[0].text); - V_DrawString(BASEVIDWIDTH - x - V_StringWidth(ncv->string, 0), - y + SP_NightsAttackMenu[0].alphaKey, V_YELLOWMAP|V_TRANSLUCENT, ncv->string); + V_DrawSmallScaledPatch(208, 32+lsheadingheight, 0, PictureOfLevel); + + V_DrawString(104 - 72, 32+lsheadingheight/2, 0, "* LEVEL RECORDS *"); + + if (P_HasGrades(cv_nextmap.value, 0)) + V_DrawScaledPatch(235, 135, 0, ngradeletters[bestoverall]); + + if (P_HasGrades(cv_nextmap.value, cv_dummymares.value)) + {//make bigger again + V_DrawString(104 - 72, 48+lsheadingheight/2, V_YELLOWMAP, "BEST GRADE:"); + V_DrawSmallScaledPatch(104 + 72 - (ngradeletters[bestgrade]->width/2), + 48+lsheadingheight/2 + 8 - (ngradeletters[bestgrade]->height/2), + 0, ngradeletters[bestgrade]); + } + + if (!bestscore) + sprintf(beststr, "(none)"); + else + sprintf(beststr, "%u", bestscore); + + V_DrawString(104 - 72, 58+lsheadingheight/2, V_YELLOWMAP, "BEST SCORE:"); + V_DrawRightAlignedString(104 + 72, 58+lsheadingheight/2, V_ALLOWLOWERCASE, beststr); + + if (besttime == UINT32_MAX) + sprintf(beststr, "(none)"); + else + sprintf(beststr, "%i:%02i.%02i", G_TicsToMinutes(besttime, true), + G_TicsToSeconds(besttime), + G_TicsToCentiseconds(besttime)); + + V_DrawString(104 - 72, 68+lsheadingheight/2, V_YELLOWMAP, "BEST TIME:"); + V_DrawRightAlignedString(104 + 72, 68+lsheadingheight/2, V_ALLOWLOWERCASE, beststr); + + if (cv_dummymares.value == 0) { + // Draw record emblems. + em = M_GetLevelEmblems(cv_nextmap.value); + while (em) + { + switch (em->type) + { + case ET_NGRADE: yHeight = 48; break; + case ET_NTIME: yHeight = 68; break; + default: + goto skipThisOne; + } + + if (em->collected) + V_DrawSmallMappedPatch(104+76, yHeight+lsheadingheight/2, 0, W_CachePatchName(M_GetEmblemPatch(em), PU_CACHE), + R_GetTranslationColormap(TC_DEFAULT, M_GetEmblemColor(em), GTC_CACHE)); + else + V_DrawSmallScaledPatch(104+76, yHeight+lsheadingheight/2, 0, W_CachePatchName("NEEDIT", PU_CACHE)); + + skipThisOne: + em = M_GetLevelEmblems(-1); + } } } + + // ALWAYS DRAW level even when not on this menu! + if (currentMenu != &SP_NightsAttackDef) + V_DrawString(SP_NightsAttackDef.x, SP_NightsAttackDef.y + SP_TimeAttackMenu[nalevel].alphaKey, V_TRANSLUCENT, SP_NightsAttackMenu[nalevel].text); +} + +static void M_NightsAttackLevelSelect(INT32 choice) +{ + (void)choice; + SP_NightsAttackLevelSelectDef.prevMenu = currentMenu; + M_SetupNextMenu(&SP_NightsAttackLevelSelectDef); } // Going to Nights Attack menu... @@ -6137,27 +8401,25 @@ static void M_NightsAttack(INT32 choice) { (void)choice; - memset(skins_cons_t, 0, sizeof (skins_cons_t)); - + SP_NightsAttackDef.prevMenu = &MainDef; levellistmode = LLM_NIGHTSATTACK; // Don't be dependent on cv_newgametype - if (M_CountLevelsToShowInList() == 0) + if (!M_PrepareLevelPlatter(-1, true)) { M_StartMessage(M_GetText("No NiGHTS-attackable levels found.\n"),NULL,MM_NOTHING); return; } - // This is really just to make sure Sonic is the played character, just in case M_PatchSkinNameTable(); - M_PrepareLevelSelect(); + G_SetGamestate(GS_TIMEATTACK); // do this before M_SetupNextMenu so that menu meta state knows that we're switching M_SetupNextMenu(&SP_NightsAttackDef); - Nextmap_OnChange(); + if (!M_CanShowLevelInList(cv_nextmap.value-1, -1) && levelselect.rows[0].maplist[0]) + CV_SetValue(&cv_nextmap, levelselect.rows[0].maplist[0]); + else + Nextmap_OnChange(); itemOn = nastart; // "Start" is selected. - - G_SetGamestate(GS_TIMEATTACK); - S_ChangeMusicInternal("racent", true); } // Player has selected the "START" from the nights attack screen @@ -6200,7 +8462,7 @@ static void M_ChooseTimeAttack(INT32 choice) I_Error("Out of memory for replay filepath\n"); sprintf(gpath,"replay"PATHSEP"%s"PATHSEP"%s", timeattackfolder, G_BuildMapName(cv_nextmap.value)); - snprintf(nameofdemo, sizeof nameofdemo, "%s-%s-last", gpath, cv_chooseskin.string); + snprintf(nameofdemo, sizeof nameofdemo, "%s-%s-last", gpath, skins[cv_chooseskin.value-1].name); if (!cv_autorecord.value) remove(va("%s"PATHSEP"%s.lmp", srb2home, nameofdemo)); @@ -6239,7 +8501,7 @@ static void M_ReplayTimeAttack(INT32 choice) return; } // srb2/replay/main/map01-sonic-time-best.lmp - G_DoPlayDemo(va("%s"PATHSEP"replay"PATHSEP"%s"PATHSEP"%s-%s-%s.lmp", srb2home, timeattackfolder, G_BuildMapName(cv_nextmap.value), cv_chooseskin.string, which)); + G_DoPlayDemo(va("%s"PATHSEP"replay"PATHSEP"%s"PATHSEP"%s-%s-%s.lmp", srb2home, timeattackfolder, G_BuildMapName(cv_nextmap.value), skins[cv_chooseskin.value-1].name, which)); } else if (currentMenu == &SP_NightsReplayDef) { @@ -6273,8 +8535,7 @@ static void M_EraseGuest(INT32 choice) M_SetupNextMenu(&SP_NightsAttackDef); else M_SetupNextMenu(&SP_TimeAttackDef); - CV_AddValue(&cv_nextmap, -1); - CV_AddValue(&cv_nextmap, 1); + Nextmap_OnChange(); M_StartMessage(M_GetText("Guest replay data erased.\n"),NULL,MM_NOTHING); } @@ -6284,7 +8545,7 @@ static void M_OverwriteGuest(const char *which, boolean nights) UINT8 *buf; size_t len; if (!nights) - len = FIL_ReadFile(va("%s"PATHSEP"replay"PATHSEP"%s"PATHSEP"%s-%s-%s.lmp", srb2home, timeattackfolder, G_BuildMapName(cv_nextmap.value), cv_chooseskin.string, which), &buf); + len = FIL_ReadFile(va("%s"PATHSEP"replay"PATHSEP"%s"PATHSEP"%s-%s-%s.lmp", srb2home, timeattackfolder, G_BuildMapName(cv_nextmap.value), skins[cv_chooseskin.value-1].name, which), &buf); else len = FIL_ReadFile(va("%s"PATHSEP"replay"PATHSEP"%s"PATHSEP"%s-%s.lmp", srb2home, timeattackfolder, G_BuildMapName(cv_nextmap.value), which), &buf); if (!len) { @@ -6300,8 +8561,7 @@ static void M_OverwriteGuest(const char *which, boolean nights) M_SetupNextMenu(&SP_NightsAttackDef); else M_SetupNextMenu(&SP_TimeAttackDef); - CV_AddValue(&cv_nextmap, -1); - CV_AddValue(&cv_nextmap, 1); + Nextmap_OnChange(); M_StartMessage(M_GetText("Guest replay data saved.\n"),NULL,MM_NOTHING); } @@ -6359,9 +8619,10 @@ static void M_SetGuestReplay(INT32 choice) which(0); } -static void M_ModeAttackRetry(INT32 choice) +void M_ModeAttackRetry(INT32 choice) { (void)choice; + // todo -- maybe seperate this out and G_SetRetryFlag() here instead? is just calling this from the menu 100% safe? G_CheckDemoStatus(); // Cancel recording if (modeattacking == ATTACKING_RECORD) M_ChooseTimeAttack(0); @@ -6383,18 +8644,18 @@ static void M_ModeAttackEndGame(INT32 choice) default: case ATTACKING_RECORD: currentMenu = &SP_TimeAttackDef; + wipetypepost = menupres[MN_SP_TIMEATTACK].enterwipe; break; case ATTACKING_NIGHTS: currentMenu = &SP_NightsAttackDef; + wipetypepost = menupres[MN_SP_NIGHTSATTACK].enterwipe; break; } itemOn = currentMenu->lastOn; G_SetGamestate(GS_TIMEATTACK); modeattacking = ATTACKING_NONE; - S_ChangeMusicInternal("racent", true); - // Update replay availability. - CV_AddValue(&cv_nextmap, 1); - CV_AddValue(&cv_nextmap, -1); + M_ChangeMenuMusic("_title", true); + Nextmap_OnChange(); } // ======== @@ -6763,25 +9024,6 @@ static void M_ChooseRoom(INT32 choice) // Start Server Menu //=========================================================================== -// -// FindFirstMap -// -// Finds the first map of a particular gametype -// Defaults to 1 if nothing found. -// -static INT32 M_FindFirstMap(INT32 gtype) -{ - INT32 i; - - for (i = 0; i < NUMMAPS; i++) - { - if (mapheaderinfo[i] && (mapheaderinfo[i]->typeoflevel & gtype)) - return i + 1; - } - - return 1; -} - static void M_StartServer(INT32 choice) { boolean StartSplitScreenGame = (currentMenu == &MP_SplitServerDef); @@ -6822,15 +9064,13 @@ static void M_StartServer(INT32 choice) static void M_DrawServerMenu(void) { - lumpnum_t lumpnum; - patch_t *PictureOfLevel; - M_DrawGenericMenu(); #ifndef NONET // Room name if (currentMenu == &MP_ServerDef) { + M_DrawLevelPlatterHeader(currentMenu->y - lsheadingheight/2, "Server settings", true, false); if (ms_RoomId < 0) V_DrawRightAlignedString(BASEVIDWIDTH - currentMenu->x, currentMenu->y + MP_ServerMenu[mp_server_room].alphaKey, V_YELLOWMAP, (itemOn == mp_server_room) ? "