diff --git a/.circleci/config.yml b/.circleci/config.yml index ca9105685..61e508e4d 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -3,7 +3,7 @@ jobs: build: working_directory: /root/SRB2 docker: - - image: debian:jessie + - image: debian:stretch environment: CC: ccache gcc -m32 PKG_CONFIG_LIBDIR: /usr/lib/i386-linux-gnu/pkgconfig @@ -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,14 +43,21 @@ jobs: - v1-SRB2-APT - run: name: Install SDK - command: apt-get -qq -y install git build-essential nasm libpng12-dev:i386 libsdl2-mixer-dev:i386 libgme-dev:i386 gettext ccache wget gcc-multilib upx + 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: - /var/cache/apt/archives - checkout - run: - name: Clean build + name: Compile without network support and BLUA + command: make -C src LINUX=1 ERRORMODE=1 -k NONET=1 NO_LUA=1 + - run: + name: wipe build + command: make -C src LINUX=1 cleandep + - run: + name: rebuild depend command: make -C src LINUX=1 clean - restore_cache: keys: @@ -57,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/.gitignore b/.gitignore index 922fac4aa..3090417dd 100644 --- a/.gitignore +++ b/.gitignore @@ -19,3 +19,5 @@ Win32_LIB_ASM_Release *.db *.opendb /.vs +/debian +/assets/debian diff --git a/.travis.yml b/.travis.yml index 3166ed783..f2ed43000 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,53 +1,323 @@ +# Travis-CI Config +# +# You may use the Deployer to upload packages and builds to external servers. +# See deployer/travis/deployer_defaults.sh for environment variables to configure. + language: c sudo: required dist: trusty matrix: include: +################################ +# Test Buildbots +# Deployer does not operate on these. See Deployer Buildbots, below. +# These bots are disabled when a deployment is triggered by 'deployer' branch name AND DPL_TERMINATE_TESTS=1. +# These bots remain enabled when a deployment is triggered by release tag. +################################ - 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 + env: GCC44=1 + if: env(DPL_ENABLED) != "1" OR env(DPL_TERMINATE_TESTS) != "1" OR NOT branch =~ /^.*deployer.*$/ #gcc-4.4 (Ubuntu/Linaro 4.4.7-8ubuntu1) 4.4.7 - 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 + env: GCC46=1 + if: env(DPL_ENABLED) != "1" OR env(DPL_TERMINATE_TESTS) != "1" OR NOT branch =~ /^.*deployer.*$/ #gcc-4.6 (Ubuntu/Linaro 4.6.4-6ubuntu2) 4.6.4 - 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 + env: GCC47=1 + if: env(DPL_ENABLED) != "1" OR env(DPL_TERMINATE_TESTS) != "1" OR NOT branch =~ /^.*deployer.*$/ #gcc-4.7 - os: linux compiler: gcc + env: GCC48=1 + if: env(DPL_ENABLED) != "1" OR env(DPL_TERMINATE_TESTS) != "1" OR NOT branch =~ /^.*deployer.*$/ #gcc (Ubuntu 4.8.4-2ubuntu1~14.04) 4.8.4 - os: linux addons: 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 + env: GCC48=1 + if: env(DPL_ENABLED) != "1" OR env(DPL_TERMINATE_TESTS) != "1" OR NOT branch =~ /^.*deployer.*$/ + #gcc-4.8 (Ubuntu 4.8.5-2ubuntu1~14.04.1) 4.8.5 + - os: linux + addons: + 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 + env: WFLAGS="-Wno-tautological-compare -Wno-error=implicit-fallthrough -Wno-implicit-fallthrough" GCC72=1 + if: env(DPL_ENABLED) != "1" OR env(DPL_TERMINATE_TESTS) != "1" OR NOT branch =~ /^.*deployer.*$/ + #gcc-7 (Ubuntu 7.2.0-1ubuntu1~14.04) 7.2.0 20170802 + - os: linux + addons: + 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 + env: WFLAGS="-Wno-tautological-compare -Wno-error=implicit-fallthrough -Wno-implicit-fallthrough -Wno-error=format-overflow -Wno-error=format-truncation" GCC81=1 + if: env(DPL_ENABLED) != "1" OR env(DPL_TERMINATE_TESTS) != "1" OR NOT branch =~ /^.*deployer.*$/ + #gcc-8 (Ubuntu 7.2.0-1ubuntu1~14.04) 8.1.0 + - os: linux + compiler: clang + if: env(DPL_ENABLED) != "1" OR env(DPL_TERMINATE_TESTS) != "1" OR NOT branch =~ /^.*deployer.*$/ + #clang version 3.5.0 (tags/RELEASE_350/final) + - os: linux + addons: + 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 + if: env(DPL_ENABLED) != "1" OR env(DPL_TERMINATE_TESTS) != "1" OR NOT branch =~ /^.*deployer.*$/ + #Ubuntu clang version 3.5.0-4ubuntu2~trusty2 (tags/RELEASE_350/final) (based on LLVM 3.5.0) + - os: linux + addons: + apt: + 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 + if: env(DPL_ENABLED) != "1" OR env(DPL_TERMINATE_TESTS) != "1" OR NOT branch =~ /^.*deployer.*$/ + #Ubuntu clang version 3.6.2-svn240577-1~exp1 (branches/release_36) (based on LLVM 3.6.2) + - os: linux + addons: + apt: + 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 + if: env(DPL_ENABLED) != "1" OR env(DPL_TERMINATE_TESTS) != "1" OR NOT branch =~ /^.*deployer.*$/ + #Ubuntu clang version 3.7.1-svn253571-1~exp1 (branches/release_37) (based on LLVM 3.7.1) + - os: linux + addons: + apt: + 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 + if: env(DPL_ENABLED) != "1" OR env(DPL_TERMINATE_TESTS) != "1" OR NOT branch =~ /^.*deployer.*$/ + #clang version 3.8.1-svn271127-1~exp1 (branches/release_38) + - os: linux + addons: + apt: + 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 + if: env(DPL_ENABLED) != "1" OR env(DPL_TERMINATE_TESTS) != "1" OR NOT branch =~ /^.*deployer.*$/ + #clang version 3.9.X +# - os: linux +# addons: +# apt: +# 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 +# if: env(DPL_ENABLED) != "1" OR env(DPL_TERMINATE_TESTS) != "1" OR NOT branch =~ /^.*deployer.*$/ +# #clang version 4.0.X +# - os: linux +# addons: +# apt: +# 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 +# if: env(DPL_ENABLED) != "1" OR env(DPL_TERMINATE_TESTS) != "1" OR NOT branch =~ /^.*deployer.*$/ +# #clang version 5.0.X +# - os: osx +# osx_image: beta-xcode6.1 +# if: env(DPL_ENABLED) != "1" OR env(DPL_TERMINATE_TESTS) != "1" OR NOT branch =~ /^.*deployer.*$/ +# #Apple LLVM version 6.0 (clang-600.0.54) (based on LLVM 3.5svn) +# - os: osx +# osx_image: beta-xcode6.2 +# compiler: gcc +# if: env(DPL_ENABLED) != "1" OR env(DPL_TERMINATE_TESTS) != "1" OR NOT branch =~ /^.*deployer.*$/ +# #Apple LLVM version 6.0 (clang-600.0.57) (based on LLVM 3.5svn) +## - os: osx +## osx_image: beta-xcode6.3 +## if: env(DPL_ENABLED) != "1" OR env(DPL_TERMINATE_TESTS) != "1" OR NOT branch =~ /^.*deployer.*$/ +## #I think xcode.6.3 VM is broken, it does not boot +# - os: osx +# osx_image: xcode6.4 +# if: env(DPL_ENABLED) != "1" OR env(DPL_TERMINATE_TESTS) != "1" OR NOT branch =~ /^.*deployer.*$/ +# #Apple LLVM version 6.1.0 (clang-602.0.53) (based on LLVM 3.6.0svn) +# - os: osx +# osx_image: xcode7 +# if: env(DPL_ENABLED) != "1" OR env(DPL_TERMINATE_TESTS) != "1" OR NOT branch =~ /^.*deployer.*$/ +# #Apple LLVM version 7.0.0 (clang-700.0.72) +# - os: osx +# osx_image: xcode7.1 +# if: env(DPL_ENABLED) != "1" OR env(DPL_TERMINATE_TESTS) != "1" OR NOT branch =~ /^.*deployer.*$/ +# #Apple LLVM version 7.0.0 (clang-700.1.76) +# - os: osx +# osx_image: xcode7.2 +# if: env(DPL_ENABLED) != "1" OR env(DPL_TERMINATE_TESTS) != "1" OR NOT branch =~ /^.*deployer.*$/ +# #Apple LLVM version 7.0.2 (clang-700.1.81) +# - os: osx +# osx_image: xcode7.3 +# #Apple LLVM version 7.3.0 (clang-703.0.31) +# - os: osx +# osx_image: xcode7.3 +# #Apple LLVM version 7.3.0 (clang-703.0.31) + - os: osx + if: env(DPL_ENABLED) != "1" OR env(DPL_TERMINATE_TESTS) != "1" OR NOT branch =~ /^.*deployer.*$/ + #Default: macOS 10.13 and Xcode 9.4.1 + + +################################ +# Deployer Buildbots - OSX +################################ + - os: osx + if: env(DPL_ENABLED) = "1" AND (env(_DPL_JOB_ENABLED) = "1" OR env(DPL_JOB_ENABLE_ALL) = "1") + AND (branch =~ /^.*deployer.*$/ OR (tag IS present AND env(DPL_TAG_ENABLED) = "1")) + AND env(DPL_TERMINATE_MAIN) != "1" + env: + - _DPL_JOB_ENABLED=1 + - _DPL_JOB_NAME=osx + - _DPL_FTP_TARGET=1 + - _DPL_PACKAGE_BINARY=1 + #Apple LLVM version 7.3.0 (clang-703.0.31) + + +################################ +# Deployer Buildbots - Linux assets +# Set DPL_TERMINATE_ASSETS to disable all of these +# List Ubuntu LTS next, newest to oldest +# Then list non-LTS, newest to oldest +################################ + - os: linux + addons: + apt: packages: - libsdl2-mixer-dev - libpng-dev @@ -56,169 +326,251 @@ matrix: - p7zip-full - gcc-4.8 compiler: gcc-4.8 + dist: xenial + if: env(DPL_ENABLED) = "1" AND (env(_DPL_JOB_ENABLED) = "1" OR env(DPL_JOB_ENABLE_ALL) = "1") + AND (branch =~ /^.*deployer.*$/ OR (tag IS present AND env(DPL_TAG_ENABLED) = "1")) + AND env(DPL_TERMINATE_ASSETS) != "1" + env: + - _DPL_JOB_ENABLED=1 + - _DPL_JOB_NAME=bionic-asset + - _DPL_DPUT_TARGET=1 + - _DPL_PACKAGE_SOURCE=1 + - _DPL_PACKAGE_MAIN=0 + - _DPL_PACKAGE_ASSET=1 + - PACKAGE_DISTRO=bionic + #- PACKAGE_SUBVERSION=~18.04bionic + #gcc-4.8 (Ubuntu 4.8.5-2ubuntu1~14.04.1) 4.8.5 + + ################################ + # The below asset bots produce packages that occupy too much space. + # It would be nice if the asset files were not included in the source package itself, + # so these can deploy to each Ubuntu target without manual intervention. + # + # Currently, to get around Launchpad's space limitation, + # copy the packages from *one* bot and the space usage is not increased. + ################################ + # - os: linux + # addons: + # apt: + # packages: + # - libsdl2-mixer-dev + # - libpng-dev + # - libgl1-mesa-dev + # - libgme-dev + # - p7zip-full + # - gcc-4.8 + # compiler: gcc-4.8 + # dist: trusty + # if: env(DPL_ENABLED) = "1" AND (env(_DPL_JOB_ENABLED) = "1" OR env(DPL_JOB_ENABLE_ALL) = "1") + # AND (branch =~ /^.*deployer.*$/ OR (tag IS present AND env(DPL_TAG_ENABLED) = "1")) + # AND env(DPL_TERMINATE_ASSETS) != "1" + # env: + # - _DPL_JOB_ENABLED=1 + # - _DPL_JOB_NAME=trusty-asset + # - _DPL_DPUT_TARGET=1 + # - _DPL_PACKAGE_SOURCE=1 + # - _DPL_PACKAGE_MAIN=0 + # - _DPL_PACKAGE_ASSET=1 + # - PACKAGE_DISTRO=trusty + # #- PACKAGE_SUBVERSION=~14.04trusty + # #gcc-4.8 (Ubuntu 4.8.5-2ubuntu1~14.04.1) 4.8.5 + # - os: linux + # addons: + # apt: + # packages: + # - libsdl2-mixer-dev + # - libpng-dev + # - libgl1-mesa-dev + # - libgme-dev + # - p7zip-full + # - gcc-4.8 + # compiler: gcc-4.8 + # dist: xenial + # if: env(DPL_ENABLED) = "1" AND (env(_DPL_JOB_ENABLED) = "1" OR env(DPL_JOB_ENABLE_ALL) = "1") + # AND (branch =~ /^.*deployer.*$/ OR (tag IS present AND env(DPL_TAG_ENABLED) = "1")) + # AND env(DPL_TERMINATE_ASSETS) != "1" + # env: + # - _DPL_JOB_ENABLED=1 + # - _DPL_JOB_NAME=disco-asset + # - _DPL_DPUT_TARGET=1 + # - _DPL_PACKAGE_SOURCE=1 + # - _DPL_PACKAGE_MAIN=0 + # - _DPL_PACKAGE_ASSET=1 + # - PACKAGE_DISTRO=disco + # #- PACKAGE_SUBVERSION=~19.04disco + # #gcc-4.8 (Ubuntu 4.8.5-2ubuntu1~14.04.1) 4.8.5 + # - os: linux + # addons: + # apt: + # packages: + # - libsdl2-mixer-dev + # - libpng-dev + # - libgl1-mesa-dev + # - libgme-dev + # - p7zip-full + # - gcc-4.8 + # compiler: gcc-4.8 + # dist: xenial + # if: env(DPL_ENABLED) = "1" AND (env(_DPL_JOB_ENABLED) = "1" OR env(DPL_JOB_ENABLE_ALL) = "1") + # AND (branch =~ /^.*deployer.*$/ OR (tag IS present AND env(DPL_TAG_ENABLED) = "1")) + # AND env(DPL_TERMINATE_ASSETS) != "1" + # env: + # - _DPL_JOB_ENABLED=1 + # - _DPL_JOB_NAME=cosmic-asset + # - _DPL_DPUT_TARGET=1 + # - _DPL_PACKAGE_SOURCE=1 + # - _DPL_PACKAGE_MAIN=0 + # - _DPL_PACKAGE_ASSET=1 + # - PACKAGE_DISTRO=cosmic + # #- PACKAGE_SUBVERSION=~18.10cosmic + # #gcc-4.8 (Ubuntu 4.8.5-2ubuntu1~14.04.1) 4.8.5 + # - os: linux + # addons: + # apt: + # packages: + # - libsdl2-mixer-dev + # - libpng-dev + # - libgl1-mesa-dev + # - libgme-dev + # - p7zip-full + # - gcc-4.8 + # compiler: gcc-4.8 + # dist: xenial + # if: env(DPL_ENABLED) = "1" AND (env(_DPL_JOB_ENABLED) = "1" OR env(DPL_JOB_ENABLE_ALL) = "1") + # AND (branch =~ /^.*deployer.*$/ OR (tag IS present AND env(DPL_TAG_ENABLED) = "1")) + # AND env(DPL_TERMINATE_ASSETS) != "1" + # env: + # - _DPL_JOB_ENABLED=1 + # - _DPL_JOB_NAME=xenial-asset + # - _DPL_DPUT_TARGET=1 + # - _DPL_PACKAGE_SOURCE=1 + # - _DPL_PACKAGE_MAIN=0 + # - _DPL_PACKAGE_ASSET=1 + # - PACKAGE_DISTRO=xenial + # #- PACKAGE_SUBVERSION=~16.04xenial + # #gcc-4.8 (Ubuntu 4.8.5-2ubuntu1~14.04.1) 4.8.5 + + +################################ +# Deployer Buildbots - Linux binaries +# List Ubuntu LTS, newest to oldest +# Then list non-LTS, newest to oldest +################################ + - os: linux + addons: + apt: + packages: + - libsdl2-mixer-dev + - libpng-dev + - libgl1-mesa-dev + - libgme-dev + - p7zip-full + - gcc-4.8 + compiler: gcc-4.8 + dist: xenial + if: env(DPL_ENABLED) = "1" AND (env(_DPL_JOB_ENABLED) = "1" OR env(DPL_JOB_ENABLE_ALL) = "1") + AND (branch =~ /^.*deployer.*$/ OR (tag IS present AND env(DPL_TAG_ENABLED) = "1")) + AND env(DPL_TERMINATE_MAIN) != "1" + env: + - _DPL_JOB_ENABLED=1 + - _DPL_JOB_NAME=bionic + - _DPL_DPUT_TARGET=1 + - _DPL_PACKAGE_SOURCE=1 + - PACKAGE_DISTRO=bionic + - PACKAGE_SUBVERSION=~18.04bionic #gcc-4.8 (Ubuntu 4.8.5-2ubuntu1~14.04.1) 4.8.5 - os: linux addons: apt: - sources: - - ubuntu-toolchain-r-test packages: - libsdl2-mixer-dev - libpng-dev - libgl1-mesa-dev - libgme-dev - p7zip-full - - gcc-7 - compiler: gcc-7 - env: WFLAGS="-Wno-tautological-compare -Wno-error=implicit-fallthrough -Wno-implicit-fallthrough" - #gcc-7 (Ubuntu 7.2.0-1ubuntu1~14.04) 7.2.0 20170802 + - gcc-4.8 + compiler: gcc-4.8 + dist: trusty + if: env(DPL_ENABLED) = "1" AND (env(_DPL_JOB_ENABLED) = "1" OR env(DPL_JOB_ENABLE_ALL) = "1") + AND (branch =~ /^.*deployer.*$/ OR (tag IS present AND env(DPL_TAG_ENABLED) = "1")) + AND env(DPL_TERMINATE_MAIN) != "1" + env: + - _DPL_JOB_ENABLED=1 + - _DPL_JOB_NAME=trusty + - _DPL_DPUT_TARGET=1 + - _DPL_PACKAGE_SOURCE=1 + - PACKAGE_DISTRO=trusty + - PACKAGE_SUBVERSION=~14.04trusty + #gcc-4.8 (Ubuntu 4.8.5-2ubuntu1~14.04.1) 4.8.5 - os: linux addons: apt: - sources: - - ubuntu-toolchain-r-test packages: - libsdl2-mixer-dev - libpng-dev - libgl1-mesa-dev - libgme-dev - p7zip-full - - gcc-8 - compiler: gcc-8 - env: WFLAGS="-Wno-tautological-compare -Wno-error=implicit-fallthrough -Wno-implicit-fallthrough -Wno-error=format-overflow" - #gcc-8 (Ubuntu 7.2.0-1ubuntu1~14.04) 8.1.0 - - os: linux - compiler: clang - #clang version 3.5.0 (tags/RELEASE_350/final) + - gcc-4.8 + compiler: gcc-4.8 + dist: xenial + if: env(DPL_ENABLED) = "1" AND (env(_DPL_JOB_ENABLED) = "1" OR env(DPL_JOB_ENABLE_ALL) = "1") + AND (branch =~ /^.*deployer.*$/ OR (tag IS present AND env(DPL_TAG_ENABLED) = "1")) + AND env(DPL_TERMINATE_MAIN) != "1" + env: + - _DPL_JOB_ENABLED=1 + - _DPL_JOB_NAME=disco + - _DPL_DPUT_TARGET=1 + - _DPL_PACKAGE_SOURCE=1 + - PACKAGE_DISTRO=disco + - PACKAGE_SUBVERSION=~19.04disco + #gcc-4.8 (Ubuntu 4.8.5-2ubuntu1~14.04.1) 4.8.5 - os: linux addons: apt: - sources: - - llvm-toolchain-precise-3.5 packages: - libsdl2-mixer-dev - libpng-dev - libgl1-mesa-dev - libgme-dev - p7zip-full - - clang-3.5 - compiler: clang-3.5 - #Ubuntu clang version 3.5.0-4ubuntu2~trusty2 (tags/RELEASE_350/final) (based on LLVM 3.5.0) + - gcc-4.8 + compiler: gcc-4.8 + dist: xenial + if: env(DPL_ENABLED) = "1" AND (env(_DPL_JOB_ENABLED) = "1" OR env(DPL_JOB_ENABLE_ALL) = "1") + AND (branch =~ /^.*deployer.*$/ OR (tag IS present AND env(DPL_TAG_ENABLED) = "1")) + AND env(DPL_TERMINATE_MAIN) != "1" + env: + - _DPL_JOB_ENABLED=1 + - _DPL_JOB_NAME=cosmic + - _DPL_DPUT_TARGET=1 + - _DPL_PACKAGE_SOURCE=1 + - PACKAGE_DISTRO=cosmic + - PACKAGE_SUBVERSION=~18.10cosmic + #gcc-4.8 (Ubuntu 4.8.5-2ubuntu1~14.04.1) 4.8.5 - os: linux addons: apt: - sources: - - llvm-toolchain-precise-3.6 - - ubuntu-toolchain-r-test packages: - libsdl2-mixer-dev - libpng-dev - libgl1-mesa-dev - libgme-dev - p7zip-full - - clang-3.6 - compiler: clang-3.6 - #Ubuntu clang version 3.6.2-svn240577-1~exp1 (branches/release_36) (based on LLVM 3.6.2) - - os: linux - addons: - apt: - sources: - - llvm-toolchain-precise-3.7 - - ubuntu-toolchain-r-test - packages: - - libsdl2-mixer-dev - - libpng-dev - - libgl1-mesa-dev - - libgme-dev - - p7zip-full - - clang-3.7 - compiler: clang-3.7 - #Ubuntu clang version 3.7.1-svn253571-1~exp1 (branches/release_37) (based on LLVM 3.7.1) - - os: linux - addons: - apt: - sources: - - llvm-toolchain-precise-3.8 - - ubuntu-toolchain-r-test - packages: - - libsdl2-mixer-dev - - libpng-dev - - libgl1-mesa-dev - - libgme-dev - - p7zip-full - - clang-3.8 - compiler: clang-3.8 - #clang version 3.8.1-svn271127-1~exp1 (branches/release_38) - - os: linux - addons: - apt: - sources: - - llvm-toolchain-precise-3.9 - - ubuntu-toolchain-r-test - packages: - - libsdl2-mixer-dev - - libpng-dev - - libgl1-mesa-dev - - libgme-dev - - p7zip-full - - clang-3.9 - compiler: clang-3.9 - #clang version 3.9.X -# - os: linux -# addons: -# apt: -# sources: -# - llvm-toolchain-precise-4.0 -# - ubuntu-toolchain-r-test -# packages: -# - libsdl2-mixer-dev -# - libpng-dev -# - libgl1-mesa-dev -# - libgme-dev -# - p7zip-full -# - clang-4.0 -# compiler: clang-4.0 -# #clang version 4.0.X -# - os: linux -# addons: -# apt: -# sources: -# - llvm-toolchain-precise-5.0 -# - ubuntu-toolchain-r-test -# packages: -# - libsdl2-mixer-dev -# - libpng-dev -# - libgl1-mesa-dev -# - libgme-dev -# - p7zip-full -# - clang-5.0 -# compiler: clang-5.0 -# #clang version 5.0.X -# - os: osx -# osx_image: beta-xcode6.1 -# #Apple LLVM version 6.0 (clang-600.0.54) (based on LLVM 3.5svn) -# - os: osx -# osx_image: beta-xcode6.2 -# compiler: gcc -# #Apple LLVM version 6.0 (clang-600.0.57) (based on LLVM 3.5svn) -## - os: osx -## osx_image: beta-xcode6.3 -## #I think xcode.6.3 VM is broken, it does not boot -# - os: osx -# osx_image: xcode6.4 -# #Apple LLVM version 6.1.0 (clang-602.0.53) (based on LLVM 3.6.0svn) -# - os: osx -# osx_image: xcode7 -# #Apple LLVM version 7.0.0 (clang-700.0.72) -# - os: osx -# osx_image: xcode7.1 -# #Apple LLVM version 7.0.0 (clang-700.1.76) -# - os: osx -# osx_image: xcode7.2 -# #Apple LLVM version 7.0.2 (clang-700.1.81) - - os: osx - osx_image: xcode7.3 - #Apple LLVM version 7.3.0 (clang-703.0.31) + - gcc-4.8 + compiler: gcc-4.8 + dist: xenial + if: env(DPL_ENABLED) = "1" AND (env(_DPL_JOB_ENABLED) = "1" OR env(DPL_JOB_ENABLE_ALL) = "1") + AND (branch =~ /^.*deployer.*$/ OR (tag IS present AND env(DPL_TAG_ENABLED) = "1")) + AND env(DPL_TERMINATE_MAIN) != "1" + env: + - _DPL_JOB_ENABLED=1 + - _DPL_JOB_NAME=xenial + - _DPL_DPUT_TARGET=1 + - _DPL_PACKAGE_SOURCE=1 + - PACKAGE_DISTRO=xenial + - PACKAGE_SUBVERSION=~16.04xenial + #gcc-4.8 (Ubuntu 4.8.5-2ubuntu1~14.04.1) 4.8.5 allow_failures: - compiler: clang-3.5 - compiler: clang-3.6 @@ -227,7 +579,7 @@ matrix: - compiler: clang-3.9 - compiler: clang-4.0 - compiler: clang-5.0 - - compiler: gcc-8 + cache: apt: true @@ -235,30 +587,140 @@ cache: directories: - $HOME/srb2_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: + - mazmazz/srb2 + packages: + - sdl2_mixer + - game-music-emu + - p7zip + - libopenmpt + - cmake + update: true + -before_script: - - wget --verbose --server-response -c http://rosenthalcastle.org/srb2/SRB2-v2115-assets-2.7z -O $HOME/srb2_cache/SRB2-v2115-assets-2.7z - - 7z x $HOME/srb2_cache/SRB2-v2115-assets-2.7z -oassets - - mkdir build - - cd build - - export CFLAGS="-Wall -W -Werror $WFLAGS" - - export CCACHE_COMPRESS=true - - cmake .. -DCMAKE_BUILD_TYPE=Release before_install: - - if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then brew update ; fi - - if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then brew install sdl2 sdl2_mixer game-music-emu p7zip; fi - - if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then brew install cmake||true; fi - - if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then curl -O -L https://www.libsdl.org/release/SDL2-2.0.6.dmg; hdiutil attach SDL2-2.0.6.dmg; sudo cp -a /Volumes/SDL2/SDL2.framework /Library/Frameworks/; fi - - if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then curl -O -L https://www.libsdl.org/projects/SDL_mixer/release/SDL2_mixer-2.0.1.dmg; hdiutil attach SDL2_mixer-2.0.1.dmg; sudo cp -a /Volumes/SDL2_mixer/SDL2_mixer.framework /Library/Frameworks/; fi + # Initialize Deployer defaults + - . ./deployer/travis/deployer_defaults.sh + + # Initialize Deployer; check if Deployer is enabled + # This needs to be run in the current shell so that $__DPL_ACTIVE is set for this session + - . ./deployer/travis/deployer.sh + + # Also check if we should now terminate -- see `deployer.sh` for conditions. + # This should never happen on non-release buildbots when Deployer is not triggered. + - if [[ "$__DPL_TRY_TERMINATE_EARLY" == "1" ]]; then + if [[ "$__DPL_ACTIVE" != "1" ]]; then + echo "Exiting early because this job is not deploying."; + exit; + fi; + fi + + # If we're triggered by release tag, force ASSET_FILES_OPTIONAL_GET=1 + - if [[ "$__DPL_TAG_ELIGIBLE" = "1" ]]; then + ASSET_FILES_OPTIONAL_GET=1; + fi; + + +install: + # Install OS X library dependencies via Homebrew + # Do this differently for release buildbots: + # * `brew install --build-bottle` builds libraries for x86_64's lowest common denominator CPU, core2 + # * `sdl2_mixer` requires options from the formula tap https://github.com/mazmazz/homebrew-srb2 + # * `brew postinstall` runs post-install scripts after building a bottle + - if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then + if [[ "$__DPL_ACTIVE" == "1" ]]; then + brew install --build-bottle sdl2 game-music-emu; + brew install --build-bottle mazmazz/srb2/sdl2_mixer --with-flac --with-mpg123; + brew postinstall sdl2 game-music-emu mazmazz/srb2/sdl2_mixer; + fi; + fi - mkdir -p $HOME/srb2_cache -script: make -k + +before_script: + # OLDPWD is root repo folder + - OLDPWD=$PWD + - __ASSET_DIRECTORY="$OLDPWD/assets/installer" + - mkdir -p "$__ASSET_DIRECTORY" + - cd "$HOME/srb2_cache" + + # Get stat command so we know what the cached archive date is. + # stat is different for OSX + - if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then + STATCMD="stat -f %m"; + else + STATCMD="stat -c %y"; + fi + + # Get asset files (required for MD5) + # See `deployer_defaults.sh` for asset download path + - if [[ "$ASSET_ARCHIVE_PATH" != "" ]]; then + if [ -f "$(basename $ASSET_ARCHIVE_PATH)" ]; then + echo "$(basename $ASSET_ARCHIVE_PATH) cache date -- $($STATCMD $(basename $ASSET_ARCHIVE_PATH))"; + fi; + wget --verbose --server-response -N "$ASSET_ARCHIVE_PATH"; + 7z x "$(basename $ASSET_ARCHIVE_PATH)" -o"$__ASSET_DIRECTORY" -aos; + fi; + + # Get optional files too + - if [[ "$__DPL_ACTIVE" == "1" ]] && [[ "$ASSET_FILES_OPTIONAL_GET" == "1" ]] && [[ "$ASSET_ARCHIVE_OPTIONAL_PATH" != "" ]]; then + if [ -f "$(basename $ASSET_ARCHIVE_OPTIONAL_PATH)" ]; then + echo "$(basename $ASSET_ARCHIVE_OPTIONAL_PATH) cache date -- $($STATCMD $(basename $ASSET_ARCHIVE_OPTIONAL_PATH))"; + fi; + wget --verbose --server-response -N "$ASSET_ARCHIVE_OPTIONAL_PATH"; + 7z x "$(basename $ASSET_ARCHIVE_OPTIONAL_PATH)" -o"$__ASSET_DIRECTORY" -aos; + fi; + + # Go back to root repo folder + - cd "$OLDPWD" + + # Prepare CMake asset lists + - SRB2_ASSET_HASHED=$(echo ${ASSET_FILES_HASHED// /\;}) + - SRB2_ASSET_DOCS=$(echo ${ASSET_FILES_DOCS// /\;}) + - SRB2_ASSET_DIRECTORY="$__ASSET_DIRECTORY" + + # Prepare CMake + - mkdir build + - cd build + - mkdir package + - export CFLAGS="-Wall -W -Werror $WFLAGS" + - export CCACHE_COMPRESS=true + # If OS X, set -march=core2 to build compatible binaries with old Macs + - if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then + export CFLAGS="${CFLAGS} -march=core2"; + fi; + - cmake .. -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=$PWD/bin -DCPACK_PACKAGE_DIRECTORY=$PWD/package + -DSRB2_ASSET_HASHED="${SRB2_ASSET_HASHED}" -DSRB2_ASSET_DOCS="${SRB2_ASSET_DOCS}" + -DSRB2_ASSET_DIRECTORY="${SRB2_ASSET_DIRECTORY}" + -DCPACK_PACKAGE_DESCRIPTION_SUMMARY="${PROGRAM_NAME}" + -DCPACK_PACKAGE_VENDOR="${PROGRAM_VENDOR}" + -DSRB2_SDL2_EXE_NAME="${PROGRAM_FILENAME}" + +script: + # Build our Makefile from Cmake! + - if [[ "$__DPL_ACTIVE" == "1" ]]; then + . ../deployer/travis/deployer_build.sh; + else + make -k; + fi; + +after_success: + # Run the upload scripts + # These do nothing if Deployer is not triggered + - . ../deployer/travis/deployer_ftp.sh + - . ../deployer/travis/deployer_dput.sh diff --git a/CMakeLists.txt b/CMakeLists.txt index ec96b7030..96e32a06d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,6 +1,8 @@ cmake_minimum_required(VERSION 3.0) +# DO NOT CHANGE THIS SRB2 STRING! Some variable names depend on this string. +# Version change is fine. project(SRB2 - VERSION 2.1.21 + VERSION 2.1.25 LANGUAGES C) if(${PROJECT_SOURCE_DIR} MATCHES ${PROJECT_BINARY_DIR}) @@ -54,13 +56,19 @@ macro(copy_files_to_build_dir target dlllist_var) endif() endmacro() -# 64-bit check -if(${CMAKE_SIZEOF_VOID_P} EQUAL 8) +# bitness check +set(SRB2_SYSTEM_BITS 0) +if(CMAKE_SIZEOF_VOID_P EQUAL 8) message(STATUS "Target is 64-bit") set(SRB2_SYSTEM_BITS 64) -else() +endif() +if(CMAKE_SIZEOF_VOID_P EQUAL 4) + message(STATUS "Target is 32-bit") set(SRB2_SYSTEM_BITS 32) endif() +if(${SRB2_SYSTEM_BITS} EQUAL 0) + message(STATUS "Target bitness is unknown") +endif() # OS macros if (UNIX) @@ -86,8 +94,8 @@ set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/bin") set(CMAKE_PDB_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/bin") # Set EXE names so the assets CMakeLists can refer to its target -set(SRB2_SDL2_EXE_NAME srb2) -set(SRB2_WIN_EXE_NAME srb2dd) +set(SRB2_SDL2_EXE_NAME srb2 CACHE STRING "Executable binary output name") +set(SRB2_WIN_EXE_NAME srb2dd CACHE STRING "Executable binary output name for DirectDraw build") include_directories(${CMAKE_CURRENT_BINARY_DIR}/src) @@ -116,8 +124,8 @@ if(${CMAKE_SYSTEM} MATCHES "Darwin") set(CPACK_GENERATOR "DragNDrop") endif() -set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "Sonic Robo Blast 2") -set(CPACK_PACKAGE_VENDOR "Sonic Team Jr.") +set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "Sonic Robo Blast 2" CACHE STRING "Program name for display purposes") +set(CPACK_PACKAGE_VENDOR "Sonic Team Jr." CACHE STRING "Vendor name for display purposes") #set(CPACK_PACKAGE_DESCRIPTION_FILE ) set(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_CURRENT_SOURCE_DIR}/LICENSE") set(CPACK_PACKAGE_VERSION_MAJOR ${SRB2_VERSION_MAJOR}) 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/SRB2_Debug.props b/SRB2_Debug.props index 8be11c58a..74177c6ef 100644 --- a/SRB2_Debug.props +++ b/SRB2_Debug.props @@ -22,6 +22,7 @@ Debug + true diff --git a/SRB2_Release.props b/SRB2_Release.props index a216ea45a..905dfdcf9 100644 --- a/SRB2_Release.props +++ b/SRB2_Release.props @@ -24,6 +24,7 @@ DebugFastLink true true + true diff --git a/SRB2_common.props b/SRB2_common.props index 2fb2eb8c6..0f80ceb17 100644 --- a/SRB2_common.props +++ b/SRB2_common.props @@ -18,7 +18,7 @@ 4244;4267 - ws2_32.lib;%(AdditionalDependencies) + advapi32.lib;ws2_32.lib;%(AdditionalDependencies) Windows false true diff --git a/appveyor.yml b/appveyor.yml index 061613c4d..d58976fd5 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -1,11 +1,15 @@ -version: 2.1.21.{branch}-{build} +version: 2.1.25.{branch}-{build} os: MinGW environment: CC: ccache CCACHE_CC: i686-w64-mingw32-gcc + CCACHE_CC_64: x86_64-w64-mingw32-gcc WINDRES: windres + # c:\mingw-w64 i686 has gcc 6.3.0, so use c:\msys64 7.3.0 instead MINGW_SDK: c:\msys64\mingw32 + # c:\msys64 x86_64 has gcc 8.2.0, so use c:\mingw-w64 7.3.0 instead + MINGW_SDK_64: C:\mingw-w64\x86_64-7.3.0-posix-seh-rt_v5-rev0\mingw64 CFLAGS: -Wall -W -Werror -Wno-error=implicit-fallthrough -Wimplicit-fallthrough=3 -Wno-tautological-compare -Wno-error=suggest-attribute=noreturn NASM_ZIP: nasm-2.12.01 NASM_URL: http://www.nasm.us/pub/nasm/releasebuilds/2.12.01/win64/nasm-2.12.01-win64.zip @@ -15,65 +19,114 @@ environment: CCACHE_URL: http://alam.srb2.org/ccache.exe CCACHE_COMPRESS: true CCACHE_DIR: C:\Users\appveyor\.ccache + # Disable UPX by default. The user can override this in their Appveyor project settings + NOUPX: 1 + ############################## + # DEPLOYER VARIABLES + # DPL_ENABLED=1 builds installers for branch names starting with `deployer`. + # DPL_TAG_ENABLED=1 will also build installers for release tags. DPL_ENABLED=1 must also be set. + # Set these in the Appveyor project settings + ############################## + DPL_ENABLED: 0 + DPL_TAG_ENABLED: 0 + DPL_INSTALLER_NAME: SRB2-v2123 + # Asset handling is barebones vs. Travis Deployer. We operate on 7z only. + # Include the README files and the OpenGL batch in the main and patch archives. + # The x86/x64 archives contain the DLL binaries. + ASSET_ARCHIVE_PATH: https://github.com/mazmazz/SRB2/releases/download/SRB2_assets/SRB2-v2122-assets.7z + ASSET_ARCHIVE_PATCH_PATH: https://github.com/mazmazz/SRB2/releases/download/SRB2_assets/SRB2-v2122-patch-assets.7z + ASSET_ARCHIVE_X86_PATH: https://github.com/mazmazz/SRB2/releases/download/SRB2_assets/SRB2-v2122-x86-assets.7z + ASSET_ARCHIVE_X64_PATH: https://github.com/mazmazz/SRB2/releases/download/SRB2_assets/SRB2-v2122-x64-assets.7z + ASSET_ARCHIVE_OPTIONAL_PATH: https://github.com/mazmazz/SRB2/releases/download/SRB2_assets/SRB2-v2122-optional-assets.7z + # This is overridden to 1 for release tag builds + ASSET_FILES_OPTIONAL_GET: 0 + # For patches, also include the X86/X64 DLLs. + PACKAGE_PATCH_DLL_GET: 0 + # Delete all asset downloads so they can be redownloaded + ASSET_CLEAN: 0 cache: - nasm-2.12.01.zip - upx391w.zip - ccache.exe - C:\Users\appveyor\.ccache +- C:\Users\appveyor\srb2_cache install: +- if [%CONFIGURATION%] == [SDL64] ( set "X86_64=1" ) +- if [%CONFIGURATION%] == [SDL64] ( set "CONFIGURATION=SDL" ) +- if [%CONFIGURATION%] == [DD64] ( set "X86_64=1" ) +- if [%CONFIGURATION%] == [DD64] ( set "CONFIGURATION=DD" ) +- if [%X86_64%] == [1] ( set "MINGW_SDK=%MINGW_SDK_64%" ) +- if [%X86_64%] == [1] ( set "CCACHE_CC=%CCACHE_CC_64%" ) + - if not exist "%NASM_ZIP%.zip" appveyor DownloadFile "%NASM_URL%" -FileName "%NASM_ZIP%.zip" - 7z x -y "%NASM_ZIP%.zip" -o%TMP% >null -- robocopy /S /xx /ns /nc /nfl /ndl /np /njh /njs %TMP%\%NASM_ZIP% %MINGW_SDK%\bin nasm.exe || exit 0 +- robocopy /S /xx /ns /nc /nfl /ndl /np /njh /njs "%TMP%\%NASM_ZIP%" "%MINGW_SDK%\bin" nasm.exe || exit 0 - if not exist "%UPX_ZIP%.zip" appveyor DownloadFile "%UPX_URL%" -FileName "%UPX_ZIP%.zip" - 7z x -y "%UPX_ZIP%.zip" -o%TMP% >null -- robocopy /S /xx /ns /nc /nfl /ndl /np /njh /njs %TMP%\%UPX_ZIP% %MINGW_SDK%\bin upx.exe || exit 0 +- robocopy /S /xx /ns /nc /nfl /ndl /np /njh /njs "%TMP%\%UPX_ZIP%" "%MINGW_SDK%\bin" upx.exe || exit 0 - if not exist "%CCACHE_EXE%" appveyor DownloadFile "%CCACHE_URL%" -FileName "%CCACHE_EXE%" - ccache -M 99M -- xcopy /Y /V /I ccache.exe %MINGW_SDK%\bin +- xcopy /Y /V /I ccache.exe "%MINGW_SDK%\bin" configuration: - SDL +- SDL64 - DD +- DD64 matrix: allow_failures: - configuration: DD + - configuration: DD64 before_build: -- set Path=%MINGW_SDK%\bin;%Path% -- i686-w64-mingw32-gcc --version +- set "Path=%MINGW_SDK%\bin;%Path%" +- if [%X86_64%] == [1] ( x86_64-w64-mingw32-gcc --version ) else ( i686-w64-mingw32-gcc --version ) - mingw32-make --version -- nasm -v -- upx -V +- if not [%X86_64%] == [1] ( nasm -v ) +- if not [%NOUPX%] == [1] ( upx -V ) - ccache -V - ccache -s -- set SRB2_MFLAGS=-C src MINGW=1 WARNINGMODE=1 GCC72=1 CCACHE=1 NOOBJDUMP=1 +- if [%NOUPX%] == [1] ( set "NOUPX=NOUPX=1" ) else ( set "NOUPX=" ) +- set "SRB2_MFLAGS=-C src WARNINGMODE=1 CCACHE=1 GCC73=1 NOOBJDUMP=1 %NOUPX%" +- if [%X86_64%] == [1] ( set "MINGW_FLAGS=MINGW64=1 X86_64=1" ) else ( set "MINGW_FLAGS=MINGW=1 GCC91=1" ) +- set "SRB2_MFLAGS=%SRB2_MFLAGS% %MINGW_FLAGS% %CONFIGURATION%=1" build_script: -- cmd: mingw32-make.exe %SRB2_MFLAGS% %CONFIGURATION%=1 clean -- cmd: mingw32-make.exe %SRB2_MFLAGS% %CONFIGURATION%=1 ERRORMODE=1 -k +- cmd: mingw32-make.exe %SRB2_MFLAGS% clean +- cmd: mingw32-make.exe %SRB2_MFLAGS% ERRORMODE=1 -k after_build: +- if [%X86_64%] == [1] ( + set "BUILD_PATH=bin\Mingw64\Release" + ) else ( + set "BUILD_PATH=bin\Mingw\Release" + ) +- if [%X86_64%] == [1] ( set "CONFIGURATION=%CONFIGURATION%64" ) - ccache -s - cmd: git rev-parse --short %APPVEYOR_REPO_COMMIT%>%TMP%/gitshort.txt - cmd: set /P GITSHORT=<%TMP%/gitshort.txt - set BUILD_ARCHIVE=%APPVEYOR_REPO_BRANCH%-%GITSHORT%-%CONFIGURATION%.7z - set BUILDSARCHIVE=%APPVEYOR_REPO_BRANCH%-%CONFIGURATION%.7z -- cmd: 7z a %BUILD_ARCHIVE% bin\Mingw\Release -xr!.gitignore +- cmd: 7z a %BUILD_ARCHIVE% %BUILD_PATH% -xr!.gitignore - appveyor PushArtifact %BUILD_ARCHIVE% - cmd: copy %BUILD_ARCHIVE% %BUILDSARCHIVE% - appveyor PushArtifact %BUILDSARCHIVE% +############################## +# DEPLOYER SCRIPT +############################## +- if [%DPL_ENABLED%] == [1] ( call "deployer\appveyor\deployer.bat" ) test: off #deploy: # - provider: FTP # protocol: ftps -# host: +# host: # secure: NsLJEPIBvmwCOj8Tg8RoRQ== # username: # secure: ejxi5mvk7oLYu7QtbYojajEPigMy0mokaKhuEVuDZcA= diff --git a/assets/.gitignore b/assets/.gitignore index 9ed61ca1a..d6e46a75b 100644 --- a/assets/.gitignore +++ b/assets/.gitignore @@ -1,5 +1,10 @@ -* -*.* +*.srb +*.pk3 +*.dta +*.wad +*.txt !README.txt !LICENSE.txt -!LICENSE-3RD-PARTY.txt \ No newline at end of file +!LICENSE-3RD-PARTY.txt +!CMakeLists.txt +!debian-template/* diff --git a/assets/CMakeLists.txt b/assets/CMakeLists.txt index 6edb3df13..68ff0fdf9 100644 --- a/assets/CMakeLists.txt +++ b/assets/CMakeLists.txt @@ -1,40 +1,58 @@ ## Assets Target Configuration ## -# MD5 generation -set(SRB2_ASSET_ALL - ${CMAKE_CURRENT_SOURCE_DIR}/srb2.srb - ${CMAKE_CURRENT_SOURCE_DIR}/player.dta - ${CMAKE_CURRENT_SOURCE_DIR}/rings.dta - ${CMAKE_CURRENT_SOURCE_DIR}/zones.dta - ${CMAKE_CURRENT_SOURCE_DIR}/patch.dta - ${CMAKE_CURRENT_SOURCE_DIR}/music.dta - ${CMAKE_CURRENT_SOURCE_DIR}/README.txt - ${CMAKE_CURRENT_SOURCE_DIR}/LICENSE.txt - ${CMAKE_CURRENT_SOURCE_DIR}/LICENSE-3RD-PARTY.txt -) +# For prepending the current source path, later +FUNCTION(PREPEND var prefix) + SET(listVar "") + FOREACH(f ${ARGN}) + LIST(APPEND listVar "${prefix}/${f}") + ENDFOREACH(f) + SET(${var} "${listVar}" PARENT_SCOPE) +ENDFUNCTION(PREPEND) + +set(SRB2_ASSET_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/installer" + CACHE STRING "Path to directory that contains all asset files for the installer.") set(SRB2_ASSET_HASHED - srb2.srb - player.dta - rings.dta - zones.dta - patch.dta +"srb2.srb;\ +player.dta;\ +rings.dta;\ +zones.dta;\ +patch.dta" + CACHE STRING "Asset filenames to apply MD5 checks. No spaces between entries!" ) +set(SRB2_ASSET_DOCS +"README.txt;\ +LICENSE.txt;\ +LICENSE-3RD-PARTY.txt" + CACHE STRING "Documentation filenames. In OS X, these are packaged separately from other assets. No spaces between entries!" +) + +PREPEND(SRB2_ASSET_DOCS ${SRB2_ASSET_DIRECTORY} ${SRB2_ASSET_DOCS}) + foreach(SRB2_ASSET ${SRB2_ASSET_HASHED}) - file(MD5 ${CMAKE_CURRENT_SOURCE_DIR}/${SRB2_ASSET} "SRB2_ASSET_${SRB2_ASSET}_HASH") + file(MD5 ${SRB2_ASSET_DIRECTORY}/${SRB2_ASSET} "SRB2_ASSET_${SRB2_ASSET}_HASH") set(SRB2_ASSET_${SRB2_ASSET}_HASH ${SRB2_ASSET_${SRB2_ASSET}_HASH} PARENT_SCOPE) endforeach() # Installation -if(CLANG) +if(${CMAKE_SYSTEM} MATCHES Darwin) get_target_property(outname SRB2SDL2 OUTPUT_NAME) - install(FILES ${SRB2_ASSET_ALL} + install(DIRECTORY "${SRB2_ASSET_DIRECTORY}/" DESTINATION "${outname}.app/Contents/Resources" ) + install(FILES ${SRB2_ASSET_DOCS} + DESTINATION . + OPTIONAL + ) else() - install(FILES ${SRB2_ASSET_ALL} + install(DIRECTORY "${SRB2_ASSET_DIRECTORY}/" DESTINATION . ) + # Docs are assumed to be located in SRB2_ASSET_DIRECTORY, so don't install again + #install(FILES ${SRB2_ASSET_DOCS} + # DESTINATION . + # OPTIONAL + #) endif() diff --git a/assets/debian/README.Debian b/assets/debian-template/README.Debian similarity index 59% rename from assets/debian/README.Debian rename to assets/debian-template/README.Debian index 68c952a4e..f3fe90030 100644 --- a/assets/debian/README.Debian +++ b/assets/debian-template/README.Debian @@ -12,9 +12,39 @@ with apt-key add. Thanks! -- Callum Dickinson Fri, 26 Nov 2010 18:25:31 +1300 +--------------- + + +Templating + +Note that you MUST run [repo-root]/debian_template.sh before running debuild +on these scripts! debian_template.sh fills these template files with working values. + +You should also set PACKAGE_NAME_EMAIL="John Doe " to match +the identity of the key you will use to sign the package. + + +Building for Launchpad PPA + +Run this step first: + + 1. source [repo-root]/debian_template.sh + * Initializes defaults for the package variables and fills in templates. + +Use these steps to prepare building a source package for Launchpad: + + 1. cd [repo-root]/assets/ + 2. debuild -T clean-all (optional; if you already have asset files, this clears them) + +Build the source package: + + 1. debuild -T build (this downloads the asset files from srb2.org if necessary) + 2. debuild -S (builds the source package for Launchpad, including the asset files) + + Signing for Launchpad PPA -First, follow the above instructions to generate a GnuPG key with your identity. You will need +First, follow Callum's instructions to generate a GnuPG key with your identity. You will need to publish the fingerprint of that key to Ubuntu's key server. https://help.ubuntu.com/community/GnuPrivacyGuardHowto#Uploading_the_key_to_Ubuntu_keyserver @@ -26,22 +56,18 @@ upload signed source packages and publish them onto your PPA. IF YOU UPLOAD A PACKAGE and Launchpad does NOT send you a confirmation or rejection email, that means your key is not set up correctly with your Launchpad account. +Finally, if your packages have not already been signed, follow these steps: -Building for Launchpad PPA + 1. cd .. + * Packages are located in the parent folder of where debuild was called + 2. debsign "srb2-data_[version]_source.changes" + * You may need to specify -k [key-fingerprint] -Use these steps to prepare building a source package for Launchpad: - 1. Highly recommend copying the assets/ folder to outside your repo folder, or else the asset - files may be included in the main source package, when you build that. - 2. cd [wherever-your-assets-folder-is]/assets/ - 3. debuild -T clean (optional, if you already have asset files) +Uploading for Launchpad PPA -Building the source package is a two-step process: - - 1. debuild -T build (this downloads the asset files from srb2.org if necessary) - 2. debuild -S (builds the source package for Launchpad, including the asset files) - -Then follow the instructions at to upload +Follow the instructions at to upload to your PPA and have Launchpad build your binary deb packages. + -- Marco Zafra Mon, 26 Nov 2018 21:13:00 -0500 diff --git a/assets/debian/README.source b/assets/debian-template/README.source similarity index 100% rename from assets/debian/README.source rename to assets/debian-template/README.source diff --git a/assets/debian-template/changelog b/assets/debian-template/changelog new file mode 100644 index 000000000..64562e2a3 --- /dev/null +++ b/assets/debian-template/changelog @@ -0,0 +1,5 @@ +${PACKAGE_NAME}-data (${PACKAGE_VERSION}${PACKAGE_SUBVERSION}${PACKAGE_REVISION}) ${PACKAGE_DISTRO}; urgency=${PACKAGE_URGENCY} + + * ${PROGRAM_NAME} v${PROGRAM_VERSION} asset data + + -- ${PACKAGE_NAME_EMAIL} ${__PACKAGE_DATETIME} diff --git a/assets/debian/compat b/assets/debian-template/compat similarity index 100% rename from assets/debian/compat rename to assets/debian-template/compat diff --git a/assets/debian/control b/assets/debian-template/control similarity index 84% rename from assets/debian/control rename to assets/debian-template/control index 22d9643ee..ae5c0ce67 100644 --- a/assets/debian/control +++ b/assets/debian-template/control @@ -1,15 +1,15 @@ # SRB2-data Debian package control file. -Source: srb2-data +Source: ${PACKAGE_NAME}-data Section: games Priority: extra -Maintainer: Sonic Team Junior +Maintainer: ${PACKAGE_GROUP_NAME_EMAIL} Build-Depends: debhelper (>= 7.0.50~), wget Standards-Version: 3.8.4 -Homepage: http://www.srb2.org +Homepage: ${PACKAGE_WEBSITE} -Package: srb2-data +Package: ${PACKAGE_NAME}-data Architecture: all Description: A cross-platform 3D Sonic fangame Sonic Robo Blast 2 is a 3D open-source Sonic the Hedgehog diff --git a/debian/copyright b/assets/debian-template/copyright similarity index 57% rename from debian/copyright rename to assets/debian-template/copyright index 97d606b0f..cc47c453b 100644 --- a/debian/copyright +++ b/assets/debian-template/copyright @@ -1,18 +1,18 @@ This work was packaged for Debian by: - Marco Zafra Mon, 26 Nov 2018 14:31:00 -0500 + ${PACKAGE_NAME_EMAIL} ${__PACKAGE_DATETIME} It was downloaded from: - + ${PACKAGE_WEBSITE} Upstream Author(s): - Sonic Team Junior + ${PACKAGE_GROUP_NAME_EMAIL} Copyright: - Copyright (C) 1998-2018 Sonic Team Junior + Copyright (C) 1998-2018 by Sonic Team Junior License: @@ -21,7 +21,7 @@ License: The Debian packaging is: Copyright (C) 2010 Callum Dickinson - Copyright (C) 2010-2018 Sonic Team Junior + Copyright (C) 2010-2018 by Sonic Team Junior and is licensed under the GPL version 2, see "/usr/share/common-licenses/GPL-2". diff --git a/assets/debian/rules b/assets/debian-template/rules old mode 100755 new mode 100644 similarity index 70% rename from assets/debian/rules rename to assets/debian-template/rules index a34a3393f..c2d19922d --- a/assets/debian/rules +++ b/assets/debian-template/rules @@ -23,6 +23,16 @@ # ############################################################################# +############################################################################# +# +# !!!!!!!!!! DEPLOYER NOTE !!!!!!!!!! +# +# Variables to be templated are curly-braced ${PACKAGE_INSTALL_PATH} +# Variables used by the rules script are parenthese'd $(DATADIR) +# See [repo-root]/debian_template.sh +# +############################################################################# + # Uncomment this to turn on verbose mode. #export DH_VERBOSE=1 @@ -37,30 +47,32 @@ RM := rm -rf DIR := $(shell pwd) PACKAGE := $(shell cat $(DIR)/debian/control | grep 'Package:' | sed -e 's/Package: //g') -DATAFILES := srb2.srb zones.dta player.dta rings.dta music.dta patch.dta README.txt LICENSE.txt LICENSE-3RD-PARTY.txt +ARCHIVEPATH := ${ASSET_ARCHIVE_PATH} +ARCHIVEOPTIONALPATH := ${ASSET_ARCHIVE_OPTIONAL_PATH} +GETOPTIONALFILES := ${ASSET_FILES_OPTIONAL_GET} -DATADIR := usr/games/SRB2 +DATADIR := $(shell echo "${PACKAGE_INSTALL_PATH}" | sed -e 's/^\///') RESOURCEDIR := . +STAGINGDIR := $(RESOURCEDIR)/installer WGET := wget -P $(RESOURCEDIR) -c -nc build: $(MKDIR) $(DIR)/debian/tmp/$(DATADIR) > $(DIR)/debian/source/include-binaries - # This will need to be updated every time SRB2 official version is # Copy data files to their install locations, and add data files to include-binaries - for file in $(DATAFILES); do \ - if [ ! -f $(RESOURCEDIR)/$$file ]; then \ - $(WGET) http://alam.srb2.org/SRB2/2.1.21-Final/Resources/$$file; \ + if [ ! -d $(STAGINGDIR) ]; then \ + mkdir -p "$(STAGINGDIR)"; \ + $(WGET) $(ARCHIVEPATH); \ + 7z x "$(RESOURCEDIR)/$(shell basename $(ARCHIVEPATH))" -aos; \ + if [ "$(GETOPTIONALFILES)" = "1" ]; then \ + $(WGET) $(ARCHIVEOPTIONALPATH); \ + 7z x "$(RESOURCEDIR)/$(shell basename $(ARCHIVEOPTIONALPATH))" -aos; \ fi; \ - if [ -f $(RESOURCEDIR)/$$file ]; then \ - $(INSTALL) $(RESOURCEDIR)/$$file $(DIR)/debian/tmp/$(DATADIR)/$$file; \ - echo $(RESOURCEDIR)/$$file >> $(DIR)/debian/source/include-binaries; \ - fi; \ - if [ ! -f $(DIR)/debian/tmp/$(DATADIR)/$$file ]; then \ - echo $(DIR)/debian/tmp/$(DATADIR)/$$file not found and could not be downloaded!; \ - return 1; \ - fi; \ - done + fi + # Install asset directory and add asset file to include-binaries + cp -vr "$(STAGINGDIR)/." "$(DIR)/debian/tmp/$(DATADIR)" + find "$(STAGINGDIR)" >> $(DIR)/debian/source/include-binaries + binary-indep: # Generate install folder file diff --git a/assets/debian/source/format b/assets/debian-template/source/format similarity index 100% rename from assets/debian/source/format rename to assets/debian-template/source/format diff --git a/assets/debian/source/options b/assets/debian-template/source/options similarity index 100% rename from assets/debian/source/options rename to assets/debian-template/source/options diff --git a/assets/debian/changelog b/assets/debian/changelog deleted file mode 100644 index f3a92e1cd..000000000 --- a/assets/debian/changelog +++ /dev/null @@ -1,19 +0,0 @@ -srb2-data (2.1.21~7) trusty; urgency=high - - * Updated for SRB2 v2.1.21 - - -- Marco Zafra Mon, 26 Nov 2018 14:31:00 -0500 - - -srb2-data (2.1.14~1) unstable; urgency=low - - * Updated for SRB2 v2.1.14 - - -- Alam Arias Sat, 6 Jan 2016 11:00:00 -0500 - - -srb2-data (2.0.6-2) maverick; urgency=high - - * Initial proper release.. - - -- Callum Dickinson Sat, 29 Jan 2011 01:18:42 +1300 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/debian/README.Debian b/debian-template/README.Debian similarity index 62% rename from debian/README.Debian rename to debian-template/README.Debian index 4b724816e..3aa52787e 100644 --- a/debian/README.Debian +++ b/debian-template/README.Debian @@ -10,10 +10,38 @@ and give them to your users to install with apt-key add. Thanks! -- Callum Dickinson Fri, 26 Nov 2010 18:25:31 +1300 +--------------- + + +Templating + +Note that you MUST run [repo-root]/debian_template.sh before running debuild +on these scripts! debian_template.sh fills these template files with working values. + +You should also set PACKAGE_NAME_EMAIL="John Doe " to match +the identity of the key you will use to sign the package. + + +Building for Launchpad PPA + +Use these steps to prepare building a source package for Launchpad: + + 1. cd [repo-root] + 2. git reset --hard; git clean -fd; git clean -fx; + * Resets your repo folder to a committed state and removes untracked files + * If you built srb2-data in the assets/ folder, MAKE SURE THAT FOLDER DOES NOT HAVE ASSETS, + OR THEY MAY BE INCLUDED IN THE MAIN SOURCE PACKAGE! + +Build the source package: + + 1. source [repo-root]/debian_template.sh + * Initializes defaults for the package variables and fills in templates. + 2. debuild -S (builds the source package for Launchpad) + Signing for Launchpad PPA -First, follow the above instructions to generate a GnuPG key with your identity. You will need +First, follow Callum's instructions to generate a GnuPG key with your identity. You will need to publish the fingerprint of that key to Ubuntu's key server. https://help.ubuntu.com/community/GnuPrivacyGuardHowto#Uploading_the_key_to_Ubuntu_keyserver @@ -25,22 +53,18 @@ upload signed source packages and publish them onto your PPA. IF YOU UPLOAD A PACKAGE and Launchpad does NOT send you a confirmation or rejection email, that means your key is not set up correctly with your Launchpad account. +Finally, if your packages have not already been signed, follow these steps: -Building for Launchpad PPA + 1. cd .. + * Packages are located in the parent folder of where debuild was called + 2. debsign "srb2_[version]_source.changes" + * You may need to specify -k [key-fingerprint] -Use these steps to prepare building a source package for Launchpad: - 1. cd [srb2repo] - 2. git reset --hard; git clean -fd; git clean -fx; - * Resets your repo folder to a committed state and removes untracked files - * If you built srb2-data in the assets/ folder, MAKE SURE THAT FOLDER DOES NOT HAVE ASSETS, - OR THEY MAY BE INCLUDED IN THE MAIN SOURCE PACKAGE! +Uploading for Launchpad PPA -Building the source package takes just one step: - - 1. debuild -S (builds the source package for Launchpad) - -Then follow the instructions at to upload +Follow the instructions at to upload to your PPA and have Launchpad build your binary deb packages. + -- Marco Zafra Mon, 26 Nov 2018 21:13:00 -0500 diff --git a/debian/README.source b/debian-template/README.source similarity index 100% rename from debian/README.source rename to debian-template/README.source diff --git a/debian-template/changelog b/debian-template/changelog new file mode 100644 index 000000000..fb08908cd --- /dev/null +++ b/debian-template/changelog @@ -0,0 +1,5 @@ +${PACKAGE_NAME} (${PACKAGE_VERSION}${PACKAGE_SUBVERSION}${PACKAGE_REVISION}) ${PACKAGE_DISTRO}; urgency=${PACKAGE_URGENCY} + + * ${PROGRAM_NAME} v${PROGRAM_VERSION} program build + + -- ${PACKAGE_NAME_EMAIL} ${__PACKAGE_DATETIME} diff --git a/debian/compat b/debian-template/compat similarity index 100% rename from debian/compat rename to debian-template/compat diff --git a/debian/control b/debian-template/control similarity index 65% rename from debian/control rename to debian-template/control index ce3b33fbd..e1348d704 100644 --- a/debian/control +++ b/debian-template/control @@ -1,24 +1,30 @@ # SRB2 Debian package control file. -Source: srb2 +Source: ${PACKAGE_NAME} Section: games Priority: extra -Maintainer: Sonic Team Junior +Maintainer: ${PACKAGE_GROUP_NAME_EMAIL} Build-Depends: debhelper (>= 7.0.50~), libsdl2-dev, libsdl2-mixer-dev, - libpng12-dev (>= 1.2.7) | libpng-dev, + libpng-dev | libpng16-dev | libpng12-dev (>= 1.2.7), zlib1g-dev, libgme-dev, libglu1-dev | libglu-dev, libosmesa6-dev | libgl-dev, nasm [i386] Standards-Version: 3.8.4 -Homepage: http://www.srb2.org +Homepage: ${PACKAGE_WEBSITE} -Package: srb2 +Package: ${PACKAGE_NAME} Architecture: any -Depends: ${shlibs:Depends}, ${misc:Depends}, srb2-data (>= 2.1.15), srb2-data (<= 2.1.21) +Depends: ${SHLIBS_DEPENDS}, ${MISC_DEPENDS}, + ${PACKAGE_NAME}-data (>> ${PACKAGE_ASSET_MINVERSION}), ${PACKAGE_NAME}-data (<< ${PACKAGE_ASSET_MAXVERSION}), + libsdl2-2.0-0, + libsdl2-mixer-2.0-0, + zlib1g, + libgme0, + libpng | libpng16-16 | libpng12-0 Description: A cross-platform 3D Sonic fangame Sonic Robo Blast 2 is a 3D open-source Sonic the Hedgehog fangame built using a modified version of the Doom Legacy @@ -28,10 +34,10 @@ Description: A cross-platform 3D Sonic fangame and quite a lot of the fun that the original Sonic games provided. -Package: srb2-dbg +Package: ${PACKAGE_NAME}-dbg Architecture: any -# FIXME: should be Depends: ${shlibs:Depends}, ${misc:Depends}, srb2-data (= 2.1.14), srb2 but dh_shlibdeps is being an asshat -Depends: libc6, ${misc:Depends}, srb2-data (>= 2.1.15), srb2-data (<= 2.1.21), srb2 +# FIXME: should be Depends: ${SHLIBS_DEPENDS}, ${MISC_DEPENDS}, srb2-data (= 2.1.14), srb2 but dh_shlibdeps is being an asshat +Depends: libc6, ${MISC_DEPENDS}, ${PACKAGE_NAME}-data (>> ${PACKAGE_ASSET_MINVERSION}), ${PACKAGE_NAME}-data (<< ${PACKAGE_ASSET_MAXVERSION}), ${PACKAGE_NAME} Description: A cross-platform 3D Sonic fangame Sonic Robo Blast 2 is a 3D open-source Sonic the Hedgehog fangame built using a modified version of the Doom Legacy diff --git a/assets/debian/copyright b/debian-template/copyright similarity index 57% rename from assets/debian/copyright rename to debian-template/copyright index 97d606b0f..cc47c453b 100644 --- a/assets/debian/copyright +++ b/debian-template/copyright @@ -1,18 +1,18 @@ This work was packaged for Debian by: - Marco Zafra Mon, 26 Nov 2018 14:31:00 -0500 + ${PACKAGE_NAME_EMAIL} ${__PACKAGE_DATETIME} It was downloaded from: - + ${PACKAGE_WEBSITE} Upstream Author(s): - Sonic Team Junior + ${PACKAGE_GROUP_NAME_EMAIL} Copyright: - Copyright (C) 1998-2018 Sonic Team Junior + Copyright (C) 1998-2018 by Sonic Team Junior License: @@ -21,7 +21,7 @@ License: The Debian packaging is: Copyright (C) 2010 Callum Dickinson - Copyright (C) 2010-2018 Sonic Team Junior + Copyright (C) 2010-2018 by Sonic Team Junior and is licensed under the GPL version 2, see "/usr/share/common-licenses/GPL-2". diff --git a/debian/docs b/debian-template/docs similarity index 100% rename from debian/docs rename to debian-template/docs diff --git a/debian/rules b/debian-template/rules old mode 100755 new mode 100644 similarity index 86% rename from debian/rules rename to debian-template/rules index 02e3dc78e..0a77624cb --- a/debian/rules +++ b/debian-template/rules @@ -23,6 +23,16 @@ # ############################################################################# +############################################################################# +# +# !!!!!!!!!! DEPLOYER NOTE !!!!!!!!!! +# +# Variables to be templated are curly-braced ${PACKAGE_INSTALL_PATH} +# Variables used by the rules script are parenthese'd $(PKGDIR) +# See [repo-root]/debian_template.sh +# +############################################################################# + # Uncomment this to turn on verbose mode. #export DH_VERBOSE=1 @@ -50,15 +60,16 @@ DIR := $(shell pwd) # FIXME: hate hate hate head/tail hack :( CONTROLF = $(DIR)/debian/control -PACKAGE = srb2 -DBGPKG = $(PACKAGE)-dbg -TITLE = Sonic Robo Blast 2 +PACKAGE = ${PACKAGE_NAME} +DBGPKG = ${PACKAGE}-dbg +TITLE = ${PROGRAM_NAME} SECTION = Games/Action -EXENAME = srb2 +EXENAME = ${PROGRAM_FILENAME} DBGNAME = debug/$(EXENAME) -PKGDIR = usr/games/SRB2 +PKGDIR = $(shell echo "${PACKAGE_INSTALL_PATH}" | sed -e 's/^\///') DBGDIR = usr/lib/debug/$(PKGDIR) +LINKDIR = $(shell echo "${PACKAGE_LINK_PATH}" | sed -e 's/^\///') PIXMAPS_DIR = usr/share/pixmaps DESKTOP_DIR = usr/share/applications PREFIX = $(shell test "$(CROSS_COMPILE_BUILD)" != "$(CROSS_COMPILE_HOST)" && echo "PREFIX=$(CROSS_COMPILE_HOST)") @@ -101,8 +112,8 @@ binary-arch: $(INSTALL) $(BINDIR)/$(EXENAME) $(DIR)/debian/tmp/$(PKGDIR)/$(PACKAGE) $(INSTALL) $(BINDIR)/$(DBGNAME) $(DIR)/debian/tmp/$(DBGDIR)/$(PACKAGE) # Install desktop file and banner image - $(INSTALL) $(DIR)/srb2.png $(DIR)/debian/tmp/usr/share/pixmaps - $(INSTALL) $(DIR)/debian/srb2.desktop $(DIR)/debian/tmp/usr/share/applications + $(INSTALL) $(DIR)/srb2.png $(DIR)/debian/tmp/usr/share/pixmaps/${PROGRAM_FILENAME}.png + $(INSTALL) $(DIR)/debian/srb2.desktop $(DIR)/debian/tmp/usr/share/applications/${PROGRAM_FILENAME}.desktop # add compiled binaries to include-binaries echo $(BINDIR)/$(EXENAME) >> $(DIR)/debian/source/include-binaries echo $(BINDIR)/$(EXENAME) >> $(DIR)/debian/source/include-binaries @@ -133,7 +144,7 @@ binary-arch: # dh_installcron # dh_installinfo # dh_installman - # dh_link + dh_link $(PKGDIR)/$(EXENAME) $(LINKDIR)/$(EXENAME) dh_compress dh_fixperms # dh_perl diff --git a/debian/source/format b/debian-template/source/format similarity index 100% rename from debian/source/format rename to debian-template/source/format diff --git a/debian/source/options b/debian-template/source/options similarity index 81% rename from debian/source/options rename to debian-template/source/options index 841c65a6f..1ef771ddf 100644 --- a/debian/source/options +++ b/debian-template/source/options @@ -2,7 +2,7 @@ tar-ignore = "assets/*.srb" tar-ignore = "assets/*.pk3" tar-ignore = "assets/*.dta" tar-ignore = "assets/*.wad" -tar-ignore = "assets/debian/srb2-data/*" +tar-ignore = "assets/debian/${PACKAGE_NAME}-data/*" tar-ignore = "assets/debian/tmp/*" tar-ignore = "*.obj" tar-ignore = "*.dep" diff --git a/debian-template/srb2.desktop b/debian-template/srb2.desktop new file mode 100644 index 000000000..07c7906e0 --- /dev/null +++ b/debian-template/srb2.desktop @@ -0,0 +1,10 @@ +[Desktop Entry] +Name=${PROGRAM_NAME} +Comment=${PROGRAM_DESCRIPTION} +Encoding=UTF-8 +Exec=${PACKAGE_INSTALL_PATH}/${PROGRAM_FILENAME} +Icon=/usr/share/pixmaps/${PROGRAM_FILENAME}.png +Terminal=false +Type=Application +StartupNotify=false +Categories=Application;Game; diff --git a/debian/changelog b/debian/changelog deleted file mode 100644 index 855c1c1b3..000000000 --- a/debian/changelog +++ /dev/null @@ -1,12 +0,0 @@ -srb2 (2.1.21~9) trusty; urgency=high - - * SRB2 v2.1.21 release - - -- Marco Zafra Mon, 27 Nov 2018 16:45:00 -0500 - - -srb2 (2.0.6-5) maverick; urgency=high - - * Initial proper release.. - - -- Callum Dickinson Sat, 29 Jan 2011 01:18:42 +1300 diff --git a/debian/srb2.desktop b/debian/srb2.desktop deleted file mode 100644 index 3a1cac9f6..000000000 --- a/debian/srb2.desktop +++ /dev/null @@ -1,10 +0,0 @@ -[Desktop Entry] -Name=Sonic Robo Blast 2 -Comment=A free 3D Sonic the Hedgehog fangame closely inspired by the original Sonic games on the Sega Genesis. -Encoding=UTF-8 -Exec=/usr/games/SRB2/srb2 -Icon=/usr/share/pixmaps/srb2.png -Terminal=false -Type=Application -StartupNotify=false -Categories=Application;Game; diff --git a/debian_template.sh b/debian_template.sh new file mode 100644 index 000000000..c1af3c19f --- /dev/null +++ b/debian_template.sh @@ -0,0 +1,166 @@ +#!/bin/bash + +# Deployer for Travis-CI +# Debian package templating +# +# Call this script BEFORE running debuild! +# source ./debian_template.sh [clean] [main/asset] +# +# Before running this script, +# you should also set PACKAGE_NAME_EMAIL="John Doe " to match +# the identity of the key you will use to sign the package. +# + +# Get script's actual path +DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null && pwd )" + +# Recursive function for directory crawling +# $1 = Directory root to crawl +# $2 = Code to eval on file +# $3 = Code to eval on directory +# Exposes $dirtails, $dirlevel, and $dirtailname +dirlevel=0 # initialize +dirtails=() + +# Utility function to make dira/dirb/dirc string +makedirtailname () { + dirtailname="" + for tail in $dirtails; do + if [[ "$dirtailname" == "" ]]; then + dirtailname="/$tail"; + else + dirtailname="$dirtailname/$tail"; + fi; + done; +} + +evaldirectory () { + if [ -d "$1" ]; then + # Set contextual variables + # dirtails is an array of directory basenames after the crawl root + if (( $dirlevel > 0 )); then + dirtails+=( "$(basename $1)" ); + else + dirtails=(); + fi; + dirlevel=$((dirlevel+1)); + + # Generate directory path after the crawl root + makedirtailname; + + # Eval our directory with the latest contextual info + # Don't eval on root + if (( $dirlevel > 1 )) && [[ "$3" != "" ]]; then + eval "$3"; + fi; + + # Iterate entries + for name in $1/*; do + if [ -d "$name" ]; then + # Name is a directory, but don't eval yet + # Recurse so our vars are updated + evaldirectory "$name" "$2" "$3"; + + # Decrement our directory level and remove a dirtail + unset 'dirtails[ ${#dirtails[@]}-1 ]'; + dirlevel=$((dirlevel-1)); + makedirtailname; + else + # Name is a file + if [ -f "$name" ] && [[ "$2" != "" ]]; then + eval "$2"; + fi; + fi; + done; + + # Reset our variables; we're done iterating + if (( $dirlevel == 1 )); then + dirlevel=0; + fi; + fi; +} + +# +# Initialize package parameter defaults +# +if [[ "$__DEBIAN_PARAMETERS_INITIALIZED" != "1" ]]; then + . ${DIR}/deployer/travis/deployer_defaults.sh; +fi; + +# Clean up after ourselves; we only expect to run this script once +# during buildboting +__DEBIAN_PARAMETERS_INITIALIZED=0 + +# for envsubst +export __PACKAGE_DATETIME="$(date '+%a, %d %b %Y %H:%M:%S %z')" +export __PACKAGE_DATETIME_DIGIT="$(date -u '+%Y%m%d%H%M%S')" + +if [[ "$PACKAGE_REVISION" == "" ]]; then + PACKAGE_REVISION="-$__PACKAGE_DATETIME_DIGIT"; + __PACKAGE_REVISION_BY_DATE=1; + export PACKAGE_REVISION=${PACKAGE_REVISION}; # for envsubst +fi; + +# +# Clean the old debian/ directories +# +if [[ "$1" == "clean" ]]; then + toclean=$2; +else + toclean=$1; +fi; + +if [[ "$toclean" == "" ]] || [[ "$toclean" == "main" ]]; then + echo "Cleaning main package scripts"; + if [[ ! -f ${DIR}/debian ]]; then + rm -rf ${DIR}/debian; + fi; +fi; +if [[ "$toclean" == "" ]] || [[ "$toclean" == "asset" ]]; then + echo "Cleaning asset package scripts"; + if [[ ! -f ${DIR}/assets/debian ]]; then + rm -rf ${DIR}/assets/debian; + fi; +fi; + +# +# Make new templates +# +if [[ "$1" != "clean" ]]; then + totemplate=$1; + + # HACK: ${shlibs:Depends} in the templates make the templating fail + # So just define replacemment variables + export SHLIBS_DEPENDS=${SHLIBS_DEPENDS}; + export MISC_DEPENDS=${MISC_DEPENDS}; + export DEBFILEVAR='$$file'; # used in assets/debian/rules + + # Package parameters are exported for envsubst in deployer_defaults.sh + + if [[ "$totemplate" == "" ]] || [[ "$totemplate" == "main" ]]; then + echo "Generating main package scripts"; + fromroot=${DIR}/debian-template; + toroot=${DIR}/debian; + mkdir ${toroot}; + + evaldirectory ${fromroot} \ + "cat \$name | envsubst > ${toroot}\${dirtailname}/\$( basename \$name )" \ + "mkdir \"${toroot}\${dirtailname}\""; + fi; + + if [[ "$totemplate" == "" ]] || [[ "$totemplate" == "asset" ]]; then + echo "Generating asset package scripts"; + fromroot=${DIR}/assets/debian-template; + toroot=${DIR}/assets/debian; + mkdir ${toroot}; + + # Root dir to crawl; file eval; directory eval + evaldirectory ${fromroot} \ + "cat \$name | envsubst > ${toroot}\${dirtailname}/\$( basename \$name )" \ + "mkdir \"${toroot}\${dirtailname}\""; + fi; +fi; + +if [[ "$__DPL_ACTIVE" != "1" ]] && [[ "$__PACKAGE_REVISION_BY_DATE" == "1" ]]; then + unset PACKAGE_REVISION; # so we can reset the date on subsequent runs +fi; diff --git a/deployer/appveyor/deployer.bat b/deployer/appveyor/deployer.bat new file mode 100644 index 000000000..fae388590 --- /dev/null +++ b/deployer/appveyor/deployer.bat @@ -0,0 +1,195 @@ +@setlocal enableextensions enabledelayedexpansion + +:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: +: Appveyor Deployer +: See appveyor.yml for default variables +:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: + +:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: +: Evaluate whether we should be deploying +:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: + +if not [%DPL_ENABLED%] == [1] ( + echo Deployer is not enabled... + exit /b +) + +: Don't do DD installs because fmodex DLL handling is not implemented. +if [%CONFIGURATION%] == [DD] ( + echo Deployer does not support DD builds... + exit /b +) + +if [%CONFIGURATION%] == [DD64] ( + echo Deployer does not support DD builds... + exit /b +) + +: Substring match from https://stackoverflow.com/questions/7005951/batch-file-find-if-substring-is-in-string-not-in-a-file +: The below line says "if deployer is NOT in string" +: Note that APPVEYOR_REPO_BRANCH for pull request builds is the BASE branch that PR is merging INTO +if x%APPVEYOR_REPO_BRANCH:deployer=%==x%APPVEYOR_REPO_BRANCH% ( + if not [%APPVEYOR_REPO_TAG%] == [true] ( + echo Deployer is enabled but we are not in a release tag or a 'deployer' branch... + exit /b + ) else ( + if not [%DPL_TAG_ENABLED%] == [1] ( + echo Deployer is not enabled for release tags... + exit /b + ) + ) +) + +: Release tags always get optional assets (music.dta) +if [%APPVEYOR_REPO_TAG%] == [true] ( + set "ASSET_FILES_OPTIONAL_GET=1" +) + +:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: +: Get asset archives +:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: + +if exist "C:\Users\appveyor\srb2_cache\archives\" ( + if [%ASSET_CLEAN%] == [1] ( + echo Cleaning asset archives... + rmdir /s /q "C:\Users\appveyor\srb2_cache\archives" + ) +) + +if not exist "C:\Users\appveyor\srb2_cache\archives\" mkdir "C:\Users\appveyor\srb2_cache\archives" + +goto EXTRACT_ARCHIVES + +:::::::::::::::::::::::::::::::: +: ARCHIVE_NAME_PARTS +: Call this like a function. %archivepath% is the path to extract parts from. +:::::::::::::::::::::::::::::::: + +for %%a in (%archivepath%) do ( + set "file=%%~fa" + set "filepath=%%~dpa" + set "filename=%%~nxa" +) + +set "localarchivepath=C:\Users\appveyor\srb2_cache\archives\%filename%" + +goto EOF + +:::::::::::::::::::::::::::::::: +: EXTRACT_ARCHIVES +:::::::::::::::::::::::::::::::: + +set "archivepath=%ASSET_ARCHIVE_PATH%" +call :ARCHIVE_NAME_PARTS +set "ASSET_ARCHIVE_PATH_LOCAL=%localarchivepath%" +if not exist "%localarchivepath%" appveyor DownloadFile "%ASSET_ARCHIVE_PATH%" -FileName "%localarchivepath%" + +set "archivepath=%ASSET_ARCHIVE_PATCH_PATH%" +call :ARCHIVE_NAME_PARTS +set "ASSET_ARCHIVE_PATCH_PATH_LOCAL=%localarchivepath%" +if not exist "%localarchivepath%" appveyor DownloadFile "%ASSET_ARCHIVE_PATCH_PATH%" -FileName "%localarchivepath%" + +if not [%X86_64%] == [1] ( + set "archivepath=%ASSET_ARCHIVE_X86_PATH%" + call :ARCHIVE_NAME_PARTS + set "ASSET_ARCHIVE_X86_PATH_LOCAL=!localarchivepath!" + if not exist "!localarchivepath!" appveyor DownloadFile "%ASSET_ARCHIVE_X86_PATH%" -FileName "!localarchivepath!" +) + +if [%X86_64%] == [1] ( + set "archivepath=%ASSET_ARCHIVE_X64_PATH%" + call :ARCHIVE_NAME_PARTS + set "ASSET_ARCHIVE_X64_PATH_LOCAL=!localarchivepath!" + if not exist "!localarchivepath!" appveyor DownloadFile "%ASSET_ARCHIVE_X64_PATH%" -FileName "!localarchivepath!" +) + +if [%ASSET_FILES_OPTIONAL_GET%] == [1] ( + set "archivepath=%ASSET_ARCHIVE_OPTIONAL_PATH%" + call :ARCHIVE_NAME_PARTS + set "ASSET_ARCHIVE_OPTIONAL_PATH_LOCAL=!localarchivepath!" + if not exist "!localarchivepath!" appveyor DownloadFile "%ASSET_ARCHIVE_OPTIONAL_PATH%" -FileName "!localarchivepath!" +) + +:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: +: Build the installers +:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: + +mkdir "assets\installer" +mkdir "assets\patch" + +7z x -y "%ASSET_ARCHIVE_PATH_LOCAL%" -o"assets\installer" >null +7z x -y "%ASSET_ARCHIVE_PATCH_PATH_LOCAL%" -o"assets\patch" >null + +: Copy optional files to full installer (music.dta) +if [%ASSET_FILES_OPTIONAL_GET%] == [1] ( + 7z x -y "%ASSET_ARCHIVE_OPTIONAL_PATH_LOCAL%" -o"assets\installer" >null +) + +: Copy EXE -- BUILD_PATH is from appveyor.yml +robocopy /S /ns /nc /nfl /ndl /np /njh /njs "%BUILD_PATH%" "assets\installer" /XF "*.debug" ".gitignore" +robocopy /S /ns /nc /nfl /ndl /np /njh /njs "%BUILD_PATH%" "assets\patch" /XF "*.debug" ".gitignore" + +: Are we building DD? (we were supposed to exit earlier!) +if [%CONFIGURATION%] == [DD] ( set "DPL_INSTALLER_NAME=%DPL_INSTALLER_NAME%-DD" ) +if [%CONFIGURATION%] == [DD64] ( set "DPL_INSTALLER_NAME=%DPL_INSTALLER_NAME%-DD" ) + +: If we are not a release tag, suffix the filename +if not [%APPVEYOR_REPO_TAG%] == [true] ( + set "INSTALLER_SUFFIX=-%APPVEYOR_REPO_BRANCH%-%GITSHORT%-%CONFIGURATION%" +) else ( + set "INSTALLER_SUFFIX=" +) + +if not [%X86_64%] == [1] ( goto X86_INSTALL ) + +:::::::::::::::::::::::::::::::: +: X64_INSTALL +:::::::::::::::::::::::::::::::: + +: Extract DLL binaries +7z x -y "%ASSET_ARCHIVE_X64_PATH_LOCAL%" -o"assets\installer" >null +if [%PACKAGE_PATCH_DLL_GET%] == [1] ( + 7z x -y "!ASSET_ARCHIVE_X64_PATH_LOCAL!" -o"assets\patch" >null +) + +: Build the installer +7z a -sfx7z.sfx "%DPL_INSTALLER_NAME%-x64-Installer%INSTALLER_SUFFIX%.exe" .\assets\installer\* + +: Build the patch +7z a "%DPL_INSTALLER_NAME%-x64-Patch%INSTALLER_SUFFIX%.zip" .\assets\patch\* + +: Upload artifacts +appveyor PushArtifact "%DPL_INSTALLER_NAME%-x64-Installer%INSTALLER_SUFFIX%.exe" +appveyor PushArtifact "%DPL_INSTALLER_NAME%-x64-Patch%INSTALLER_SUFFIX%.zip" + +: We only do x86 OR x64, one at a time, so exit now. +goto EOF + +:::::::::::::::::::::::::::::::: +: X86_INSTALL +:::::::::::::::::::::::::::::::: + +: Extract DLL binaries +7z x -y "%ASSET_ARCHIVE_X86_PATH_LOCAL%" -o"assets\installer" >null +if [%PACKAGE_PATCH_DLL_GET%] == [1] ( + 7z x -y "!ASSET_ARCHIVE_X86_PATH_LOCAL!" -o"assets\patch" >null +) + +: Build the installer +7z a -sfx7z.sfx "%DPL_INSTALLER_NAME%-Installer%INSTALLER_SUFFIX%.exe" .\assets\installer\* + +: Build the patch +7z a "%DPL_INSTALLER_NAME%-Patch%INSTALLER_SUFFIX%.zip" .\assets\patch\* + +: Upload artifacts +appveyor PushArtifact "%DPL_INSTALLER_NAME%-Installer%INSTALLER_SUFFIX%.exe" +appveyor PushArtifact "%DPL_INSTALLER_NAME%-Patch%INSTALLER_SUFFIX%.zip" + +: We only do x86 OR x64, one at a time, so exit now +goto EOF + +:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: +: EOF +:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: + +endlocal diff --git a/deployer/travis/deployer.sh b/deployer/travis/deployer.sh new file mode 100644 index 000000000..c88155d21 --- /dev/null +++ b/deployer/travis/deployer.sh @@ -0,0 +1,157 @@ +#!/bin/bash + +# Deployer for Travis-CI +# Initialization +# +# Performs validity checks to ensure that Deployer is allowed to run +# e.g., is an FTP hostname specified? Are we whitelisted by OSNAMES and BRANCHES? +# +# Set these environment variables in your Travis-CI settings, where they are stored securely. +# See other shell scripts for more options. +# +# DPL_ENABLED = 1 (leave blank to disable) +# DPL_TAG_ENABLED = 1 (run Deployer on all tags) +# DPL_JOB_ENABLE_ALL = 1 (run Deployer on all jobs; leave blank to act on specific jobs, see below) +# DPL_JOBNAMES = name1,name2 (whitelist of job names to allow uploading; leave blank to upload from all jobs) +# DPL_OSNAMES = osx (whitelist of OS names to allow uploading; leave blank to upload from all OSes) +# DPL_BRANCHES = master,branch1,branch2 (whitelist of branches to upload; leave blank to upload all branches) +# +# To enable Deployer on specific jobs, set _DPL_JOB_ENABLED=1 for that job. Example: +# - matrix: +# - os: osx +# env: +# - _DPL_JOB_ENABLED=1 +# +# DO NOT set __DPL_ACTIVE, because that would bypass these validity checks. + +# Validate Deployer state +if [[ "$DPL_ENABLED" == "1" ]] && [[ "$TRAVIS_PULL_REQUEST" == "false" ]]; then + # Test for base eligibility: + # Are we in a deployer branch? Or + # Are we in a release tag AND DPL_TAG_ENABLED=1? + if [[ $TRAVIS_BRANCH == *"deployer"* ]]; then + __DPL_BASE_ELIGIBLE=1; + __DPL_TERMINATE_EARLY_ELIGIBLE=1; + fi; + + if [[ "$TRAVIS_TAG" != "" ]] && [[ "$DPL_TAG_ENABLED" == "1" ]]; then + __DPL_BASE_ELIGIBLE=1; + __DPL_TAG_ELIGIBLE=1; + __DPL_TERMINATE_EARLY_ELIGIBLE=1; + fi; + + # Logging message for trigger word + if [[ "$__DPL_TAG_ELIGIBLE" != "1" ]] && [[ "$DPL_TRIGGER" != "" ]]; then + echo "Testing for trigger $DPL_TRIGGER, commit message: $TRAVIS_COMMIT_MESSAGE"; + echo "[${DPL_TRIGGER}]"; + echo "[${DPL_TRIGGER}-${_DPL_JOB_NAME}]"; + echo "[${DPL_TRIGGER}-${TRAVIS_OS_NAME}]"; + fi; + + # + # Search for the trigger word + # Force enable if release tags are eligible + # + if [[ "$__DPL_TAG_ELIGIBLE" == "1" ]] || [[ "$DPL_TRIGGER" == "" ]] \ + || [[ $TRAVIS_COMMIT_MESSAGE == *"[$DPL_TRIGGER]"* ]] \ + || [[ $TRAVIS_COMMIT_MESSAGE == *"[${DPL_TRIGGER}-${_DPL_JOB_NAME}]"* ]] \ + || [[ $TRAVIS_COMMIT_MESSAGE == *"[${DPL_TRIGGER}-${TRAVIS_OS_NAME}]"* ]]; then + # + # Whitelist by branch name + # Force enable if release tags are eligible + # + if [[ "$__DPL_TAG_ELIGIBLE" == "1" ]] || [[ "$DPL_BRANCHES" == "" ]] || [[ $DPL_BRANCHES == *"$TRAVIS_BRANCH"* ]]; then + # Set this so we only early-terminate builds when we are specifically deploying + # Trigger string and branch are encompassing conditions; the rest are job-specific + # This check only matters for deployer branches and when DPL_TERMINATE_TESTS=1, + # because we're filtering non-deployer jobs. + # + # __DPL_TRY_TERMINATE_EARLY is invalidated in .travis.yml if __DPL_ACTIVE=1 + if [[ "$__DPL_TERMINATE_EARLY_ELIGIBLE" == "1" ]] && [[ "$DPL_TERMINATE_TESTS" == "1" ]]; then + __DPL_TRY_TERMINATE_EARLY=1; + fi; + + # + # Is the job enabled for deployment? + # + if [[ "$DPL_JOB_ENABLE_ALL" == "1" ]] || [[ "$_DPL_JOB_ENABLED" == "1" ]]; then + # + # Whitelist by job names + # + if [[ "$DPL_JOBNAMES" == "" ]] || [[ "$_DPL_JOB_NAME" == "" ]] || [[ $DPL_JOBNAMES == *"$_DPL_JOB_NAME"* ]]; then + # + # Whitelist by OS names + # + if [[ "$DPL_OSNAMES" == "" ]] || [[ $DPL_OSNAMES == *"$TRAVIS_OS_NAME"* ]]; then + # Base Deployer is eligible for becoming active + + # Are we building for Linux? + if [[ "$_DPL_PACKAGE_BINARY" == "1" ]] || [[ "$_DPL_PACKAGE_SOURCE" == "1" ]]; then + if [[ "$_DPL_PACKAGE_MAIN" == "1" ]] || [[ "$_DPL_PACKAGE_ASSET" == "1" ]]; then + if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then + __DPL_DEBIAN_ACTIVE=1; + fi; + fi; + fi; + + # Now check for deployment targets + if [[ "$_DPL_FTP_TARGET" == "1" ]] && [[ "$DPL_FTP_HOSTNAME" != "" ]]; then + if [[ "$TRAVIS_OS_HOST" == "linux" ]] && [[ "$DPL_FTP_PROTOCOL" == "ftp" ]]; then + echo "Non-secure FTP will not work on Linux Travis-CI jobs!"; + echo "Try SFTP or another target. Details:"; + echo "https://blog.travis-ci.com/2018-07-23-the-tale-of-ftp-at-travis-ci"; + else + if [[ "$__DPL_DEBIAN_ACTIVE" == "1" ]] || [[ "$_DPL_PACKAGE_BINARY" == "1" ]] || [[ "$_DPL_BINARY" == "1" ]]; then + echo "Deployer FTP target is enabled"; + __DPL_FTP_ACTIVE=1; + else + echo "Deployer FTP target cannot be enabled: You must specify _DPL_PACKAGE_BINARY=1,"; + echo "and/or _DPL_BINARY=1 in your job's environment variables."; + fi; + fi; + fi; + + if [[ "$_DPL_DPUT_TARGET" == "1" ]] && [[ "$__DPL_DEBIAN_ACTIVE" == "1" ]] \ + && [[ "$DPL_DPUT_INCOMING" != "" ]]; then + if [[ "$DPL_DPUT_METHOD" == "ftp" ]]; then + echo "DPUT will not work with non-secure FTP on Linux Travis-CI jobs!"; + echo "Try SFTP or another method for DPUT. Details:"; + echo "https://blog.travis-ci.com/2018-07-23-the-tale-of-ftp-at-travis-ci"; + else + echo "Deployer DPUT target is enabled"; + __DPL_DPUT_ACTIVE=1; + fi; + fi; + + # If any deployment targets are active, then so is the Deployer at large + if [[ "$__DPL_FTP_ACTIVE" == "1" ]] || [[ "$__DPL_DPUT_ACTIVE" == "1" ]]; then + __DPL_ACTIVE=1; + fi; + fi; + fi; + fi; + fi; + else + if [[ "$DPL_TRIGGER" != "" ]]; then + echo "Testing for global trigger [$DPL_TRIGGER, commit message: $TRAVIS_COMMIT_MESSAGE"; + fi; + if [[ "$DPL_TRIGGER" != "" ]] && [[ $TRAVIS_COMMIT_MESSAGE == *"[$DPL_TRIGGER"* ]]; then + if [[ "$__DPL_TAG_ELIGIBLE" == "1" ]] || [[ "$DPL_BRANCHES" == "" ]] || [[ $DPL_BRANCHES == *"$TRAVIS_BRANCH"* ]]; then + # This check only matters for deployer branches and when DPL_TERMINATE_TESTS=1, + # because we're filtering non-deployer jobs. + if [[ "$__DPL_TERMINATE_EARLY_ELIGIBLE" == "1" ]] && [[ "$DPL_TERMINATE_TESTS" == "1" ]]; then + # Assume that some job received the trigger, so mark this for early termination + __DPL_TRY_TERMINATE_EARLY=1; + fi; + fi; + fi; + fi; +fi; + +if [[ "$__DPL_TRY_TERMINATE_EARLY" == "1" ]] && [[ "$__DPL_ACTIVE" != "1" ]]; then + echo "Deployer is active in another job"; +fi; + +if [[ "$__DPL_TRY_TERMINATE_EARLY" != "1" ]] && [[ "$__DPL_ACTIVE" != "1" ]]; then + echo "Deployer is not active"; +fi; diff --git a/deployer/travis/deployer_build.sh b/deployer/travis/deployer_build.sh new file mode 100644 index 000000000..3817f025d --- /dev/null +++ b/deployer/travis/deployer_build.sh @@ -0,0 +1,190 @@ +#!/bin/bash + +# Deployer for Travis-CI +# Build Script +# +# Builds the required targets depending on which sub-modules are enabled + +if [[ "$__DPL_FTP_ACTIVE" == "1" ]] || [[ "$__DPL_DPUT_ACTIVE" == "1" ]]; then + if [[ "$__DPL_DEBIAN_ACTIVE" == "1" ]]; then + echo "Building Debian package(s)" + + sudo apt-get install devscripts debhelper fakeroot secure-delete expect; + + # Build source packages first, since they zip up the entire source folder, + # binaries and all + if [[ "$_DPL_PACKAGE_MAIN" == "1" ]]; then + . ../debian_template.sh main; + OLDPWD=$PWD; # [repo]/build + cd ..; # repo root + + if [[ "$_DPL_PACKAGE_SOURCE" == "1" ]]; then + echo "Building main source Debian package"; + expect <(cat < key.asc; + echo "$DPL_PGP_KEY_PASSPHRASE" > phrase.txt; + gpg --import key.asc; + + if [[ "$_DPL_PACKAGE_MAIN" == "1" ]]; then + echo "Signing main package(s)"; + + PACKAGEFILENAME=${PACKAGE_NAME}_${PACKAGE_VERSION}${PACKAGE_SUBVERSION}${PACKAGE_REVISION}; + PACKAGEDBGFILENAME=${PACKAGE_NAME}-dbg_${PACKAGE_VERSION}${PACKAGE_SUBVERSION}${PACKAGE_REVISION}; + #PACKAGENIGHTLYFILENAME=${PACKAGE_NAME}-nightly_${PACKAGE_VERSION}${PACKAGE_SUBVERSION}${PACKAGE_REVISION}; + #PACKAGENIGHTLYDBGFILENAME=${PACKAGE_NAME}-nightly-dbg_${PACKAGE_VERSION}${PACKAGE_SUBVERSION}${PACKAGE_REVISION}; + #PACKAGEPATCHFILENAME=${PACKAGE_NAME}-patch_${PACKAGE_VERSION}${PACKAGE_SUBVERSION}${PACKAGE_REVISION}; + #PACKAGEPATCHDBGFILENAME=${PACKAGE_NAME}-patch-dbg_${PACKAGE_VERSION}${PACKAGE_SUBVERSION}${PACKAGE_REVISION}; + #PACKAGEPATCHNIGHTLYFILENAME=${PACKAGE_NAME}-patch-nightly_${PACKAGE_VERSION}${PACKAGE_SUBVERSION}${PACKAGE_REVISION}; + #PACKAGEPATCHNIGHTLYDBGFILENAME=${PACKAGE_NAME}-patch-nightly-dbg_${PACKAGE_VERSION}${PACKAGE_SUBVERSION}${PACKAGE_REVISION}; + + PACKAGEFILENAMES=( + $PACKAGEFILENAME + $PACKAGEDBGFILENAME + #$PACKAGENIGHTLYFILENAME + #$PACKAGENIGHTLYDBGFILENAME + #$PACKAGEPATCHFILENAME + #$PACKAGEPATCHDBGFILENAME + #$PACKAGEPATCHNIGHTLYFILENAME + #$PACKAGEPATCHNIGHTLYDBGFILENAME + ); + + # Main packages are in parent of root repo folder + OLDPWD=$PWD; # [repo]/build + cd ../..; # parent of repo root + + for n in ${PACKAGEFILENAMES}; do + for f in ./$n*.changes; do + debsign --no-re-sign -p"gpg --passphrase-file $OLDPWD/phrase.txt --batch" "$f"; + done; + done; + + cd $OLDPWD; + fi; + + if [[ "$_DPL_PACKAGE_ASSET" == "1" ]]; then + echo "Signing asset package(s)"; + + PACKAGEFILENAME=${PACKAGE_NAME}-data_${PACKAGE_VERSION}${PACKAGE_SUBVERSION}${PACKAGE_REVISION}; + #PACKAGENIGHTLYFILENAME=${PACKAGE_NAME}-nightly-data_${PACKAGE_VERSION}${PACKAGE_SUBVERSION}${PACKAGE_REVISION}; + #PACKAGEPATCHFILENAME=${PACKAGE_NAME}-patch-data_${PACKAGE_VERSION}${PACKAGE_SUBVERSION}${PACKAGE_REVISION}; + #PACKAGEPATCHNIGHTLYFILENAME=${PACKAGE_NAME}-patch-nightly-data_${PACKAGE_VERSION}${PACKAGE_SUBVERSION}${PACKAGE_REVISION}; + + PACKAGEFILENAMES=( + $PACKAGEFILENAME + #$PACKAGENIGHTLYFILENAME + #$PACKAGEPATCHFILENAME + #$PACKAGEPATCHNIGHTLYFILENAME + ) + + # Asset packages are in root repo folder + OLDPWD=$PWD; # [repo]/build + cd ..; # repo root + + for n in ${PACKAGEFILENAMES}; do + for f in ./$n*.changes; do + debsign --no-re-sign -p"gpg --passphrase-file $OLDPWD/phrase.txt --batch" "$f"; + done; + done; + + cd $OLDPWD; + fi; + + # Delete the keys :eyes: + srm key.asc; + srm phrase.txt; + fi; + fi; + + # all other OSes + if [[ "$TRAVIS_OS_NAME" != "linux" ]]; then + # + # Check for binary building + # + if [[ "$_DPL_BINARY" == "1" ]]; then + echo "Building a Binary"; + make -k; + fi; + + # + # Check for package building + # + if [[ "$_DPL_PACKAGE_BINARY" == "1" ]]; then + echo "Building a Package"; + + # Make an OSX package; superuser is required for library bundling + # + # HACK: OSX packaging can't write libraries to .app package unless we're superuser + # because the original library files don't have WRITE permission + # Bug may be sidestepped by using CHMOD_BUNDLE_ITEMS=TRUE + # But I don't know where this is set. Not `cmake -D...` because this var is ignored. + # https://cmake.org/Bug/view.php?id=9284 + if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then + sudo make -k package; + else + # Some day, when Windows is supported, we'll just make a standard package + make -k package; + fi; + fi; + fi; +fi; diff --git a/deployer/travis/deployer_defaults.sh b/deployer/travis/deployer_defaults.sh new file mode 100644 index 000000000..bccb7409a --- /dev/null +++ b/deployer/travis/deployer_defaults.sh @@ -0,0 +1,105 @@ +#!/bin/bash + +# Deployer for Travis-CI +# Default Variables +# +# Here are all of the user-set variables used by Deployer. +# See the "Cross-platform deployment" page on SRB2 Wiki for documentation. + +# Core Parameters +: ${DPL_ENABLED} # Enable Deployer behavior; must be set for any deployment activity +: ${DPL_TAG_ENABLED} # Trigger Deployer for all tag releases +: ${DPL_JOB_ENABLE_ALL} # Enable all jobs for deployment +: ${DPL_TERMINATE_TESTS} # Terminate all build test jobs (used in .travis.yml) +: ${DPL_TRIGGER} # Use a [word] in the commit message to trigger Deployer +: ${DPL_JOBNAMES} # Trigger Deployer by job name +: ${DPL_OSNAMES} # Trigger Deployer by OS name (osx,linux) +: ${DPL_BRANCHES} # Trigger Deployer by git branch name + +# Job Parameters +: ${_DPL_JOB_ENABLED} # Enable Deployer for this specific job. DPL_ENABLED must be set too. +: ${_DPL_JOB_NAME} # Identifier for the job, used for logging and trigger word matching +: ${_DPL_FTP_TARGET} # Deploy to FTP +: ${_DPL_DPUT_TARGET} # Deploy to DPUT +: ${_DPL_PACKAGE_SOURCE} # Build packages into a Source distribution. Linux only. +: ${_DPL_PACKAGE_BINARY} # Build packages into a Binary distribution. +: ${_DPL_PACKAGE_MAIN:=1} # Build main installation package. Linux only; OS X assumes this. +: ${_DPL_PACKAGE_ASSET} # Build asset installation package. Linux only. + +# Asset File Parameters +: ${ASSET_ARCHIVE_PATH:=https://github.com/mazmazz/SRB2/releases/download/SRB2_assets/SRB2-v2122-assets.7z} +: ${ASSET_ARCHIVE_OPTIONAL_PATH:=https://github.com/mazmazz/SRB2/releases/download/SRB2_assets/SRB2-v2122-optional-assets.7z} +: ${ASSET_FILES_HASHED:=srb2.srb zones.dta player.dta rings.dta patch.dta} +: ${ASSET_FILES_DOCS:=README.txt LICENSE.txt LICENSE-3RD-PARTY.txt} +: ${ASSET_FILES_OPTIONAL_GET:=0} + +# FTP Parameters +: ${DPL_FTP_PROTOCOL} +: ${DPL_FTP_USER} +: ${DPL_FTP_PASS} +: ${DPL_FTP_HOSTNAME} +: ${DPL_FTP_PORT} +: ${DPL_FTP_PATH} + +# DPUT Parameters +: ${DPL_DPUT_DOMAIN:=ppa.launchpad.net} +: ${DPL_DPUT_METHOD:=sftp} +: ${DPL_DPUT_INCOMING} +: ${DPL_DPUT_LOGIN:=anonymous} +: ${DPL_SSH_KEY_PRIVATE} # Base64-encoded private key file. Used to sign repository uploads +: ${DPL_SSH_KEY_PASSPHRASE} # Decodes the private key file. + +# Package Parameters +: ${PACKAGE_NAME:=srb2} +: ${PACKAGE_VERSION:=2.1.23} +: ${PACKAGE_SUBVERSION} # Highly recommended to set this to reflect the distro series target (e.g., ~18.04bionic) +: ${PACKAGE_REVISION} # Defaults to UTC timestamp +: ${PACKAGE_INSTALL_PATH:=/usr/games/SRB2} +: ${PACKAGE_LINK_PATH:=/usr/games} +: ${PACKAGE_DISTRO:=trusty} +: ${PACKAGE_URGENCY:=high} +: ${PACKAGE_NAME_EMAIL:=Sonic Team Junior } +: ${PACKAGE_GROUP_NAME_EMAIL:=Sonic Team Junior } +: ${PACKAGE_WEBSITE:=} + +: ${PACKAGE_ASSET_MINVERSION:=2.1.21} # Number this the version BEFORE the actual required version, because we do a > check +: ${PACKAGE_ASSET_MAXVERSION:=2.1.24} # Number this the version AFTER the actual required version, because we do a < check + +: ${PROGRAM_NAME:=Sonic Robo Blast 2} +: ${PROGRAM_VENDOR:=Sonic Team Junior} +: ${PROGRAM_VERSION:=2.1.23} +: ${PROGRAM_DESCRIPTION:=A free 3D Sonic the Hedgehog fangame closely inspired by the original Sonic games on the Sega Genesis.} +: ${PROGRAM_FILENAME:=srb2} + +: ${DPL_PGP_KEY_PRIVATE} # Base64-encoded private key file. Used to sign Debian packages +: ${DPL_PGP_KEY_PASSPHRASE} # Decodes the private key file. + +# Export Asset and Package Parameters for envsubst templating + +export ASSET_ARCHIVE_PATH="${ASSET_ARCHIVE_PATH}" +export ASSET_ARCHIVE_OPTIONAL_PATH="${ASSET_ARCHIVE_OPTIONAL_PATH}" +export ASSET_FILES_HASHED="${ASSET_FILES_HASHED}" +export ASSET_FILES_DOCS="${ASSET_FILES_DOCS}" +export ASSET_FILES_OPTIONAL_GET="${ASSET_FILES_OPTIONAL_GET}" + +export PACKAGE_NAME="${PACKAGE_NAME}" +export PACKAGE_VERSION="${PACKAGE_VERSION}" +export PACKAGE_SUBVERSION="${PACKAGE_SUBVERSION}" # in case we have this +export PACKAGE_REVISION="${PACKAGE_REVISION}" +export PACKAGE_ASSET_MINVERSION="${PACKAGE_ASSET_MINVERSION}" +export PACKAGE_ASSET_MAXVERSION="${PACKAGE_ASSET_MAXVERSION}" +export PACKAGE_INSTALL_PATH="${PACKAGE_INSTALL_PATH}" +export PACKAGE_LINK_PATH="${PACKAGE_LINK_PATH}" +export PACKAGE_DISTRO="${PACKAGE_DISTRO}" +export PACKAGE_URGENCY="${PACKAGE_URGENCY}" +export PACKAGE_NAME_EMAIL="${PACKAGE_NAME_EMAIL}" +export PACKAGE_GROUP_NAME_EMAIL="${PACKAGE_GROUP_NAME_EMAIL}" +export PACKAGE_WEBSITE="${PACKAGE_WEBSITE}" + +export PROGRAM_NAME="${PROGRAM_NAME}" +export PROGRAM_VERSION="${PROGRAM_VERSION}" +export PROGRAM_DESCRIPTION="${PROGRAM_DESCRIPTION}" +export PROGRAM_FILENAME="${PROGRAM_FILENAME}" + +# This file is called in debian_template.sh, so mark our completion so we don't run it again +__DEBIAN_PARAMETERS_INITIALIZED=1 diff --git a/deployer/travis/deployer_dput.sh b/deployer/travis/deployer_dput.sh new file mode 100644 index 000000000..863a928cd --- /dev/null +++ b/deployer/travis/deployer_dput.sh @@ -0,0 +1,133 @@ +#!/bin/bash + +# Deployer for Travis-CI +# DPUT uploader (e.g., Launchpad PPA) +# + +if [[ "$__DPL_DPUT_ACTIVE" == "1" ]]; then + # Install APT dependencies + # paramiko required for ssh + sudo apt-get install python-paramiko expect dput; # python-pip + #pip install paramiko; + + # Output the DPUT config + # Dput only works if you're using secure FTP, so that's what we default to. + cat > "./dput.cf" << EOM +[deployer] +fqdn = ${DPL_DPUT_DOMAIN} +method = ${DPL_DPUT_METHOD} +incoming = ${DPL_DPUT_INCOMING} +login = ${DPL_DPUT_LOGIN} +allow_unsigned_uploads = 0 +EOM + + # Output SSH config + # Don't let SSH prompt us for untrusted hosts + cat >> "./ssh_config" << EOM + +Host * + StrictHostKeyChecking no + UserKnownHostsFile=/dev/null + PubKeyAuthentication yes + IdentityFile ${PWD}/key.private + IdentitiesOnly yes +EOM + sudo sh -c "cat < ${PWD}/ssh_config >> /etc/ssh/ssh_config"; + + # Get the private key + echo "$DPL_SSH_KEY_PRIVATE" | base64 --decode > key.private; + chmod 700 ./key.private; + + if [[ "$_DPL_PACKAGE_MAIN" == "1" ]]; then + PACKAGEFILENAME=${PACKAGE_NAME}_${PACKAGE_VERSION}${PACKAGE_SUBVERSION}${PACKAGE_REVISION}; + PACKAGEDBGFILENAME=${PACKAGE_NAME}-dbg_${PACKAGE_VERSION}${PACKAGE_SUBVERSION}${PACKAGE_REVISION}; + #PACKAGENIGHTLYFILENAME=${PACKAGE_NAME}-nightly_${PACKAGE_VERSION}${PACKAGE_SUBVERSION}${PACKAGE_REVISION}; + #PACKAGENIGHTLYDBGFILENAME=${PACKAGE_NAME}-nightly-dbg_${PACKAGE_VERSION}${PACKAGE_SUBVERSION}${PACKAGE_REVISION}; + #PACKAGEPATCHFILENAME=${PACKAGE_NAME}-patch_${PACKAGE_VERSION}${PACKAGE_SUBVERSION}${PACKAGE_REVISION}; + #PACKAGEPATCHDBGFILENAME=${PACKAGE_NAME}-patch-dbg_${PACKAGE_VERSION}${PACKAGE_SUBVERSION}${PACKAGE_REVISION}; + #PACKAGEPATCHNIGHTLYFILENAME=${PACKAGE_NAME}-patch-nightly_${PACKAGE_VERSION}${PACKAGE_SUBVERSION}${PACKAGE_REVISION}; + #PACKAGEPATCHNIGHTLYDBGFILENAME=${PACKAGE_NAME}-patch-nightly-dbg_${PACKAGE_VERSION}${PACKAGE_SUBVERSION}${PACKAGE_REVISION}; + + PACKAGEFILENAMES=( + $PACKAGEFILENAME + $PACKAGEDBGFILENAME + #$PACKAGENIGHTLYFILENAME + #$PACKAGENIGHTLYDBGFILENAME + #$PACKAGEPATCHFILENAME + #$PACKAGEPATCHDBGFILENAME + #$PACKAGEPATCHNIGHTLYFILENAME + #$PACKAGEPATCHNIGHTLYDBGFILENAME + ); + + # Main packages are in parent of root repo folder + OLDPWD=$PWD; # [repo]/build + cd ../..; + + # Enter passphrase if required + for n in ${PACKAGEFILENAMES}; do + for f in $n*.changes; do + # Binary builds also generate source builds, so exclude the source + # builds if desired + if [[ "$_DPL_PACKAGE_SOURCE" != "1" ]]; then + if [[ "$f" == *"_source"* ]] || [[ "$f" == *".tar.xz"* ]]; then + continue; + fi; + fi; + + expect <(cat < "commit.txt"; + echo "Job ID $TRAVIS_JOB_ID" >> "commit.txt"; + echo "" >> "commit.txt"; + echo "Commit $TRAVIS_COMMIT" >> "commit.txt"; + echo "$TRAVIS_COMMIT_MESSAGE" >> "commit.txt"; + echo "" >> "commit.txt"; + + # Initialize FTP parameters + if [[ "$DPL_FTP_PORT" == "" ]]; then + DPL_FTP_PORT=21; + fi; + if [[ "$DPL_FTP_PROTOCOL" == "" ]]; then + DPL_FTP_PROTOCOL=ftp; + fi; + __DPL_FTP_LOCATION=$DPL_FTP_PROTOCOL://$DPL_FTP_HOSTNAME:$DPL_FTP_PORT/$DPL_FTP_PATH/$TRAVIS_REPO_SLUG/$TRAVIS_BRANCH/$TRAVIS_JOB_ID-$TRAVIS_JOB_NUMBER-$JOBNAME; + + # Upload to FTP! + echo "Uploading to FTP..."; + curl --ftp-create-dirs -T "commit.txt" -u $DPL_FTP_USER:$DPL_FTP_PASS "$__DPL_FTP_LOCATION/commit.txt"; + + if [[ "$__DPL_DEBIAN_ACTIVE" == "1" ]]; then + if [[ "$_DPL_PACKAGE_MAIN" == "1" ]]; then + PACKAGEFILENAME=${PACKAGE_NAME}_${PACKAGE_VERSION}${PACKAGE_SUBVERSION}${PACKAGE_REVISION}; + PACKAGEDBGFILENAME=${PACKAGE_NAME}-dbg_${PACKAGE_VERSION}${PACKAGE_SUBVERSION}${PACKAGE_REVISION}; + #PACKAGENIGHTLYFILENAME=${PACKAGE_NAME}-nightly_${PACKAGE_VERSION}${PACKAGE_SUBVERSION}${PACKAGE_REVISION}; + #PACKAGENIGHTLYDBGFILENAME=${PACKAGE_NAME}-nightly-dbg_${PACKAGE_VERSION}${PACKAGE_SUBVERSION}${PACKAGE_REVISION}; + #PACKAGEPATCHFILENAME=${PACKAGE_NAME}-patch_${PACKAGE_VERSION}${PACKAGE_SUBVERSION}${PACKAGE_REVISION}; + #PACKAGEPATCHDBGFILENAME=${PACKAGE_NAME}-patch-dbg_${PACKAGE_VERSION}${PACKAGE_SUBVERSION}${PACKAGE_REVISION}; + #PACKAGEPATCHNIGHTLYFILENAME=${PACKAGE_NAME}-patch-nightly_${PACKAGE_VERSION}${PACKAGE_SUBVERSION}${PACKAGE_REVISION}; + #PACKAGEPATCHNIGHTLYDBGFILENAME=${PACKAGE_NAME}-patch-nightly-dbg_${PACKAGE_VERSION}${PACKAGE_SUBVERSION}${PACKAGE_REVISION}; + + PACKAGEFILENAMES=( + $PACKAGEFILENAME + $PACKAGEDBGFILENAME + #$PACKAGENIGHTLYFILENAME + #$PACKAGENIGHTLYDBGFILENAME + #$PACKAGEPATCHFILENAME + #$PACKAGEPATCHDBGFILENAME + #$PACKAGEPATCHNIGHTLYFILENAME + #$PACKAGEPATCHNIGHTLYDBGFILENAME + ); + + # Main packages are in parent of root repo folder + OLDPWD=$PWD; # [repo]/build + cd ../..; + + for n in ${PACKAGEFILENAMES}; do + for f in ./$n*; do + # Binary builds also generate source builds, so exclude the source + # builds if desired + if [[ "$_DPL_PACKAGE_SOURCE" != "1" ]]; then + if [[ "$f" == *"_source"* ]] || [[ "$f" == *".tar.xz"* ]]; then + continue; + fi; + fi; + curl --ftp-create-dirs -T "$f" -u $DPL_FTP_USER:$DPL_FTP_PASS "$__DPL_FTP_LOCATION/package/main/$f"; + done; + done; + + # Go back to [repo]/build folder + cd $OLDPWD; + fi; + + if [[ "$_DPL_PACKAGE_ASSET" == "1" ]]; then + PACKAGEFILENAME=${PACKAGE_NAME}-data_${PACKAGE_VERSION}${PACKAGE_SUBVERSION}${PACKAGE_REVISION}; + #PACKAGENIGHTLYFILENAME=${PACKAGE_NAME}-nightly-data_${PACKAGE_VERSION}${PACKAGE_SUBVERSION}${PACKAGE_REVISION}; + #PACKAGEPATCHFILENAME=${PACKAGE_NAME}-patch-data_${PACKAGE_VERSION}${PACKAGE_SUBVERSION}${PACKAGE_REVISION}; + #PACKAGEPATCHNIGHTLYFILENAME=${PACKAGE_NAME}-patch-nightly-data_${PACKAGE_VERSION}${PACKAGE_SUBVERSION}${PACKAGE_REVISION}; + + PACKAGEFILENAMES=( + $PACKAGEFILENAME + #$PACKAGENIGHTLYFILENAME + #$PACKAGEPATCHFILENAME + #$PACKAGEPATCHNIGHTLYFILENAME + ) + + # Asset packages are in root repo folder + OLDPWD=$PWD; # [repo]/build + cd ..; + + for n in ${PACKAGEFILENAMES}; do + for f in ./$n*; do + # Binary builds also generate source builds, so exclude the source + # builds if desired + if [[ "$_DPL_PACKAGE_SOURCE" != "1" ]]; then + if [[ "$f" == *"_source"* ]] || [[ "$f" == *".tar.xz"* ]]; then + continue; + fi; + fi; + curl --ftp-create-dirs -T "$f" -u $DPL_FTP_USER:$DPL_FTP_PASS "$__DPL_FTP_LOCATION/package/asset/$f"; + done; + done; + + # Go back to [repo]/build folder + cd $OLDPWD; + fi; + else + if [[ "$_DPL_BINARY" == "1" ]]; then + find bin -type f -exec curl -u $DPL_FTP_USER:$DPL_FTP_PASS --ftp-create-dirs -T {} $__DPL_FTP_LOCATION/{} \;; + fi; + + if [[ "$_DPL_PACKAGE_BINARY" == "1" ]]; then + sudo rm -r package/_CPack_Packages + find package -type f -exec curl -u $DPL_FTP_USER:$DPL_FTP_PASS --ftp-create-dirs -T {} $__DPL_FTP_LOCATION/{} \;; + fi; + fi; +fi 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/SDL2/lib/ARM/SDL2.lib b/libs/SDL2/lib/ARM/SDL2.lib new file mode 100644 index 000000000..be9d86949 Binary files /dev/null and b/libs/SDL2/lib/ARM/SDL2.lib differ diff --git a/libs/SDL2/lib/ARM64/SDL2.dll b/libs/SDL2/lib/ARM64/SDL2.dll new file mode 100644 index 000000000..f9eac1c0b Binary files /dev/null and b/libs/SDL2/lib/ARM64/SDL2.dll differ diff --git a/libs/SDL2/lib/ARM64/SDL2.lib b/libs/SDL2/lib/ARM64/SDL2.lib new file mode 100644 index 000000000..40904c308 Binary files /dev/null and b/libs/SDL2/lib/ARM64/SDL2.lib differ diff --git a/libs/SDL2_mixer/lib/ARM/SDL2_mixer.lib b/libs/SDL2_mixer/lib/ARM/SDL2_mixer.lib new file mode 100644 index 000000000..3886f3aa9 Binary files /dev/null and b/libs/SDL2_mixer/lib/ARM/SDL2_mixer.lib differ diff --git a/libs/SDL2_mixer/lib/ARM64/SDL2_mixer.dll b/libs/SDL2_mixer/lib/ARM64/SDL2_mixer.dll new file mode 100644 index 000000000..d5650b0d2 Binary files /dev/null and b/libs/SDL2_mixer/lib/ARM64/SDL2_mixer.dll differ diff --git a/libs/SDL2_mixer/lib/ARM64/SDL2_mixer.lib b/libs/SDL2_mixer/lib/ARM64/SDL2_mixer.lib new file mode 100644 index 000000000..58c3e6966 Binary files /dev/null and b/libs/SDL2_mixer/lib/ARM64/SDL2_mixer.lib differ diff --git a/libs/SDLMixerX/CHANGES.X.txt b/libs/SDLMixerX/CHANGES.X.txt new file mode 100644 index 000000000..17b43d9af --- /dev/null +++ b/libs/SDLMixerX/CHANGES.X.txt @@ -0,0 +1,48 @@ +2.1.0: +Vitaly Novichkov - Sat, Jan 20, 2018 18:06:00 + * SDL Mixer X has been re-created from original again as official SDL Mixer had a big and incompatible rework + * Custom resampler is no more needed as SDL2 now finally uses new better resampler + * Added CMake build + * Added an ability to toggle MIDI playing libraries (NativeMidi, Timidity or FluidSynth) + * Added a full seekability with "tell" and "length" commands + * Added a basic support for Meta-Tags to show Title, Artist, Album and Copyright captured from music files. + * Added an extra arguments in music path string to support song individual settings per some codecs (for example, play different MIDI files with different MIDI playing libraries) + * Timidity: Added ability to set a config search pach, for example, inside of application directory API. + * Added OPNMIDI MIDI sequencer based on YM2612 chip emulation. Includes a complete General-MIDI embedded bank. + * Added functions to use custom bank files for ADL/OPN-MIDI sequencers (WOPL for ADLMIDI and WOPN for OPNMIDI) + * WAVE: Added support for PCM24, PCM32, Float32, Float64m, ALAW, and MULAW sample formats, + * AIFF: Added support for AIFF-C, also support for PCM24, PCM32, Float32, Float64, ALAW, and MULAW formats + * WAVE & AIFF: Added full seekability support (seek, tell, length) + * MP3: More accurate MP3 file detection as some weird MP3 files are can't be detected by existing code; Added usage lf libID3tag library to fetch ID3 tags and also detect begin offset inside of MP3 files as some MP3 files are causing libMAD play ID3 data as actual encoded sound data that causes weird playback and later crash. To avoid this, ID3 parse is needed to detect actual begin of audio data. + * Fixed: SMPEG: Fix a broken build + * Fixed: OGG: Fixed support for pre-defined count of loops when loop tags are presented + * Warning fixes + * Some C90 compatibility fixes + * Internally: Added MIX_UNUSED() macro to mute warnings on various compilers + +1.0.3: +Vitaly Novichkov - 2016 + * Implemented own resampler to don't use buggy SDL Audio's resampler + * Added support of path arguments to allow dynamic configuring of GME and MIDI playing per every file + * ModPlug now is part of SDL Mixer X in same project + * Link all dependent libraries (libOGG, libVorbis, libFLAC, libMAD) statically + +1.0.2: +Vitaly Novichkov - 2015 + * Added ADLMIDI MIDI sequencer which is completely independent MIDI sequencer which requires no extra bank files to play MIDI. + * Added ability to dynamically switch MIDI device (ADLMIDI, Timidity, Native MIDI, FluidSynth) + * Added meta-tag getting functions: Mix_GetMusicTitle, Mix_GetMusicTitleTag, Mix_GetMusicArtistTag, Mix_GetMusicAlbumTag, Mix_GetMusicCopyrightTag. + * Added ability to build VB6-Compatible version to use it as standalone audio library + +1.0.1: +Vitaly Novichkov - 2015 + * Added GME library to support many game music formats + * Added support of loop tags for OGG Vorbis files (based on vorbis comments "LOOPSTART" and "LOOPEND" (also supported "LOOPLENGTH" for RPG-Maker compatibility)) + * Added MIX_Timidity_addToPathList(const char *path) to customize Timidity path + +1.0.0: +Vitaly Novichkov - 2015 + * Added support of SPC playback + * Attempt to fix resampling + * Using QMake instead of autotools to build library + diff --git a/libs/SDLMixerX/CHANGES.txt b/libs/SDLMixerX/CHANGES.txt new file mode 100644 index 000000000..50c0fee0b --- /dev/null +++ b/libs/SDLMixerX/CHANGES.txt @@ -0,0 +1,184 @@ +2.0.3: +Sam Lantinga - Thu, Mar 1, 2018 9:06:58 AM + * Fixed regression where Mix_Init() would return 0 for available music formats + +2.0.2: +Sam Lantinga - Fri Oct 20 22:04:50 PDT 2017 + * Implemented 24-bit and surround sound support for FLAC audio files +Sam Lantinga - Thu Oct 12 21:32:44 PDT 2017 + * Updated external libraries flac-1.3.2, libmodplug-0.8.9.0, libogg-1.3.2 and libvorbis-1.3.5 +Ryan Gordon - Thu Oct 12 21:29:59 PDT 2017 + * Updated for SDL 2.0.6 and newer +Franc[e]sco - Thu Jul 20 22:03:19 2017 +0200 + * Added support for MP3 playback using mpg123 +David Ludwig - Sun Apr 10 22:35:38 2016 + * Added support for UWP / Windows 10 apps +Juha Kuikka - Fri Jan 29 12:44:01 PST 2016 + * Added Mix_OpenAudioDevice() so you can specify the audio device to open + +2.0.1: +Sam Lantinga - Tue Jul 7 11:40:33 PDT 2015 + * Added support for 'smpl' format loop points in music WAV files +Sam Lantinga - Sat Aug 23 10:57:26 2014 + * Fixed floating point exception in Mix_Volume() +David Ludwig - Mon Apr 14 22:15:36 2014 + * Added support for building for Windows RT and Windows Phone +Isaac Burns - Sun Sep 15 21:50:27 PDT 2013 + * Added support for loading MP3 files as sound chunks + +2.0.0: +Sam Lantinga - Sun Jun 9 14:45:30 PDT 2013 + * Made libmodplug the default MOD player as it is now in the public domain +Sam Lantinga - Sat Jun 1 19:11:08 PDT 2013 + * Updated for SDL 2.0 release + * SDL_LoadMUS_RW() now takes an argument telling whether or not the data source should be freed when done. + +1.2.13: +Paul P Komkoff Jr - Sun Jul 22 16:12:28 PDT 2012 + * Fixed malloc/free mismatch in the MikMod driver + +1.2.12: +Sam Lantinga - Sat Jan 14 22:00:29 2012 -0500 + * Fixed seek offset with SMPEG (was relative, should be absolute) +Sam Lantinga - Fri Jan 13 03:04:27 EST 2012 + * Fixed memory crash loading Ogg Vorbis files on Windows +Sam Lantinga - Thu Jan 05 22:51:54 2012 -0500 + * Added an Xcode project for iOS +Nikos Chantziaras - 2012-01-02 17:37:36 PST + * Added Mix_LoadMUSType_RW() so you can tell SDL_mixer what type the music is +Sam Lantinga - Sun Jan 01 16:45:58 2012 -0500 + * Fixed looping native MIDI on Mac OS X and Windows +Sam Lantinga - Sun Jan 01 01:00:51 2012 -0500 + * Added /usr/local/share/timidity to the timidity data path +Sam Lantinga - Sat Dec 31 21:26:46 2011 -0500 + * Fixed timidity loading of some MIDI files +Sam Lantinga - Sat Dec 31 19:11:59 EST 2011 + * Fixed dropping audio in the FLAC audio decoding +Sam Lantinga - Sat Dec 31 18:32:05 EST 2011 + * Fixed memory leak in SDL_LoadMUS() +Sam Lantinga - Sat Dec 31 10:22:05 EST 2011 + * Removed GPL native MIDI code for new licensing +Sam Lantinga - Sat Dec 31 10:22:05 EST 2011 + * SDL_mixer is now under the zlib license +Manuel Montezelo - 2011-12-28 11:42:44 PST + * Fixed drums playing on MIDI channel 16 with timidity +Ryan C. Gordon - Wed Jun 15 03:41:31 2011 -0400 + * The music-finished hook can start a track immediately +James Le Cuirot - Mon Mar 21 16:54:11 PDT 2011 + * Added support for FluidSynth +Egor Suvorov - Tue Jan 18 11:06:47 PST 2011 + * Added support for native MIDI on Haiku +Sam Lantinga - Tue Jan 11 01:29:19 2011 -0800 + * Added Android.mk to build on the Android platform +Jon Atkins - Sat Nov 14 13:00:18 PST 2009 + * Added support for libmodplug (disabled by default) + +1.2.11: +Sam Lantinga - Sat Nov 14 12:38:01 PST 2009 + * Fixed initialization error and crashes if MikMod library isn't available +Sam Lantinga - Sat Nov 14 11:22:14 PST 2009 + * Fixed bug loading multiple music files + +1.2.10: +Sam Lantinga - Sun Nov 8 08:34:48 PST 2009 + * Added Mix_Init()/Mix_Quit() to prevent constantly loading and unloading DLLs +Mike Frysinger - 2009-11-05 09:11:43 PST + * Check for fork/vfork on any platform, don't just assume it on UNIX +Jon Atkins - Thu Nov 5 00:02:50 2009 UTC + * Fixed export of Mix_GetNumChunkDecoders() and Mix_GetNumMusicDecoders() +C.W. Betts - 2009-11-02 00:16:21 PST + * Use newer MIDI API on Mac OS X 10.5+ + +1.2.9: +Ryan Gordon - Sun Oct 18 11:42:31 PDT 2009 + * Updated native MIDI support on Mac OS X for 10.6 +Ryan Gordon - Sun Oct 11 05:29:55 2009 UTC + * Reset channel volumes after a fade out interrupts a fade in. +Ryan Gordon - Sun Oct 11 02:59:12 2009 UTC + * Fixed crash race condition with position audio functions +Ryan Gordon - Sat Oct 10 17:05:45 2009 UTC + * Fixed stereo panning in 8-bit mode +Sam Lantinga - Sat Oct 10 11:07:15 2009 UTC + * Added /usr/share/timidity to the default timidity.cfg locations +Sam Lantinga - Sat Oct 3 13:33:36 PDT 2009 + * MOD support uses libmikmod and is dynamically loaded by default + * A patched version of libmikmod is included in libmikmod-3.1.12.zip + * The libmikmod patches fix security issues CVE-2007-6720 and CVE-2009-0179. +Sam Lantinga - Sat Oct 3 02:49:41 PDT 2009 + * Added TIMIDITY_CFG environment variable to fully locate timidity.cfg +Sam Lantinga - Fri Oct 2 07:15:35 PDT 2009 + * Implemented seamless looping for music playback +Forrest Voight - 2009-06-13 20:31:38 PDT + * ID3 files are now recognized as MP3 format +Steven Noonan - 2008-05-13 13:31:36 PDT + * Fixed native MIDI crash on 64-bit Windows +Ryan Gordon - Fri Jun 5 16:07:08 2009 UTC + * Added decoder enumeration API: + Mix_GetNumChunkDecoders(), Mix_GetChunkDecoder(), + Mix_GetNumMusicDecoders(), Mix_GetMusicDecoder() +Austen Dicken - Tue Feb 26 23:28:27 PST 2008 + * Added support for FLAC audio both as chunks and streaming +Tilman Sauerbeck - Tue Feb 26 03:44:47 PST 2008 + * Added support for streaming WAV files with Mix_LoadMUS_RW() +Ryan Gordon - Mon Feb 4 17:10:08 UTC 2008 + * Fixed crash caused by not resetting position_channels + +1.2.8: +Sam Lantinga - Wed Jul 18 09:45:54 PDT 2007 + * Improved detection of Ogg Vorbis and Tremor libraries +Ryan Gordon - Sun Jul 15 12:03:54 EDT 2007 + * Fixed memory leaks in Effects API. +David Rose - Sat Jul 14 22:16:09 PDT 2007 + * Added support for MP3 playback with libmad (for GPL projects only!) +Sam Lantinga - Sat Jul 14 21:39:30 PDT 2007 + * Fixed the final loop of audio samples of a certain size +Sam Lantinga - Sat Jul 14 21:05:09 PDT 2007 + * Fixed opening Ogg Vorbis files using different C runtimes on Windows +Philippe Simons - Sat Jul 14 20:33:17 PDT 2007 + * Added support for Ogg Vorbis playback with Tremor (an integer decoder) +Sam Lantinga - Sat Jul 14 07:02:09 PDT 2007 + * Fixed memory corruption in timidity resampling code +Ryan Gordon - Tue Jul 3 10:44:29 2007 UTC + * Fixed building SDL_mixer with SDL 1.3 pre-release +Ryan Gordon - Tue Feb 13 08:11:54 2007 UTC + * Fixed compiling both timidity and native midi in the same build +Hans de Goede - Sun Aug 20 23:25:46 2006 UTC + * Added volume control to playmus +Jonathan Atkins - Thu Aug 10 15:06:40 2006 UTC + * Fixed linking with system libmikmod +David Ergo - Fri Jun 23 09:07:19 2006 UTC + * Corrected no-op conditions in SetDistance(), SetPanning() and SetPosition() + * Fixed copy/paste errors in channel amplitudes + +1.2.7: +Sam Lantinga - Fri May 12 00:04:32 PDT 2006 + * Added support for dynamically loading SMPEG library +Sam Lantinga - Thu May 11 22:22:43 PDT 2006 + * Added support for dynamically loading Ogg Vorbis library +Sam Lantinga - Sun Apr 30 09:01:44 PDT 2006 + * Removed automake dependency, to allow Universal binaries on Mac OS X + * Added gcc-fat.sh for generating Universal binaries on Mac OS X +Sam Lantinga - Sun Apr 30 01:48:40 PDT 2006 + * Updated libtool support to version 1.5.22 +Patrice Mandin - Sat Jul 16 16:43:24 UTC 2005 + * Use SDL_RWops also for native midi mac and win32 +Patrice Mandin - Sat Jul 9 14:40:09 UTC 2005 + * Use SDL_RWops also for native midi gpl (todo: mac and win32) +Ryan C. Gordon - Sat Jul 9 01:54:03 EDT 2005 + * Tweaked Mix_Chunk's definition to make predeclaration easier. +Patrice Mandin - Mon Jul 4 19:45:40 UTC 2005 + * Search timidity.cfg also in /etc + * Fix memory leaks in timidity player + * Use also SDL_RWops to read midifiles for timidity +Ryan C. Gordon - Mon Jun 13 18:18:12 EDT 2005 + * Patch from Eric Wing to fix native midi compiling on MacOS/x86. +Sam Lantinga - Wed Dec 22 17:14:32 PST 2004 + * Disabled support for the system version of libmikmod by default +Sam Lantinga - Tue Dec 21 09:51:29 PST 2004 + * Fixed building mikmod support on UNIX + * Always build SDL_RWops music support + * Added SDL_RWops support for reading MP3 files + +1.2.6: +Jonathan Atkins - Wed, 15 Sep 2004 23:26:42 -0500 + * Added support for using the system version of libmikmod diff --git a/libs/SDLMixerX/CMakeLists.txt b/libs/SDLMixerX/CMakeLists.txt new file mode 100644 index 000000000..af55b0265 --- /dev/null +++ b/libs/SDLMixerX/CMakeLists.txt @@ -0,0 +1,818 @@ +cmake_minimum_required (VERSION 2.8.11) +project(SDLMixerX C) + +include(FindPkgConfig) +include(CheckIncludeFiles) +include(CheckFunctionExists) +include(CheckLibraryExists) +#include(CheckCSourceRuns) +#include(CheckCCompilerFlag) + +if(NOT CMAKE_VERSION VERSION_LESS 2.8.12) + set(CMAKE_MACOSX_RPATH 0) +endif() + +if(NOT CMAKE_BUILD_TYPE) + set(CMAKE_BUILD_TYPE "Release" CACHE STRING "Choose the type of build, options are: Debug Release RelWithDebInfo MinSizeRel." FORCE) + message("== Using default build configuration which is a Release!") +endif() + +if(CMAKE_BUILD_TYPE STREQUAL "Debug") + set(MIX_DEBUG_SUFFIX "d") +else() + set(MIX_DEBUG_SUFFIX "") +endif() + +if(WIN32) + set(CMAKE_SHARED_LIBRARY_PREFIX "") +endif() + +if(POLICY CMP0058) + cmake_policy(SET CMP0058 NEW) +endif() + +option(SSEMATH "Allow GCC to use SSE floating point math" ${OPT_DEF_SSEMATH}) +option(MMX "Use MMX assembly routines" ${OPT_DEF_ASM}) +option(3DNOW "Use 3Dnow! MMX assembly routines" ${OPT_DEF_ASM}) +option(SSE "Use SSE assembly routines" ${OPT_DEF_ASM}) +option(SSE2 "Use SSE2 assembly routines" ${OPT_DEF_SSEMATH}) +option(SSE3 "Use SSE3 assembly routines" ${OPT_DEF_SSEMATH}) + +# Settings +option(SDL_MIXER_X_STATIC "Build static library of SDL Mixer X" ON) +option(SDL_MIXER_X_SHARED "Build shared library of SDL Mixer X" ON) + +option(DOWNLOAD_AUDIO_CODECS_DEPENDENCY "Downloads and compiles AudioCodecs dependencies pack directly" OFF) +set(AUDIO_CODECS_REPO_PATH "" CACHE PATH "Path to the AudioCodecs dependencies pack") +set(AUDIO_CODECS_INSTALL_PATH "" CACHE PATH "Path to installed AudioCodecs prefix") + +if(CMAKE_COMPILER_IS_GNUCC OR CMAKE_COMPILER_IS_GNUCXX) + # Turn on warnings and legacy C/C++ standards to support more compilers + set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -std=c90") + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -pedantic -std=c++98") + # Deny undefined symbols + if(NOT APPLE) + set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -Wl,--no-undefined" ) + set(CMAKE_MODULE_LINKER_FLAGS "${CMAKE_MODULE_LINKER_FLAGS} -Wl,--no-undefined" ) + endif() +endif() + +set(SDL_MIXER_INCLUDE_PATHS) + +if(NOT AUDIO_CODECS_REPO_PATH AND NOT AUDIO_CODECS_INSTALL_PATH) + # Try to resolve sqlite dependency + if(DOWNLOAD_AUDIO_CODECS_DEPENDENCY) + # Download and configure AudioCodecs dependency + set(SDL2_REPO_PATH ${CMAKE_INSTALL_PREFIX}) + set(SDL2_INCLUDE_PATH ${CMAKE_INSTALL_PREFIX}/include/SDL2) + set(SDL2_LIBS_PATH ${CMAKE_INSTALL_PREFIX}/lib) + include(cmake/DownloadAudioCodecs.cmake) + set(AUDIO_CODECS_REPO_PATH ${AUDIO_CODECS_REPOSITORY_PATH}) + set(AUDIO_CODECS_INSTALL_PATH ${AUDIO_CODECS_INSTALL_DIR}) + endif() +endif() + +set(FIND_PREFER_STATIC + "-static${MIX_DEBUG_SUFFIX}.a" + "-static${MIX_DEBUG_SUFFIX}.lib" + "${MIX_DEBUG_SUFFIX}.a" + "${MIX_DEBUG_SUFFIX}.lib" + "-static.a" + "-static.lib" + ".a" + ".lib" + "${MIX_DEBUG_SUFFIX}.dll.a" + "${MIX_DEBUG_SUFFIX}.dll.lib" + ".dll.a" + ".dll.lib" + "${MIX_DEBUG_SUFFIX}.so" + "${MIX_DEBUG_SUFFIX}.dylib" + ".so" + ".dylib" +) + +set(FIND_PREFER_SHARED + "${MIX_DEBUG_SUFFIX}.dll.a" + "${MIX_DEBUG_SUFFIX}.dll.lib" + ".dll.a" + ".dll.lib" + "${MIX_DEBUG_SUFFIX}.so" + "${MIX_DEBUG_SUFFIX}.dylib" + ".so" + ".dylib" + "-static${MIX_DEBUG_SUFFIX}.a" + "-static${MIX_DEBUG_SUFFIX}.lib" + "${MIX_DEBUG_SUFFIX}.a" + "${MIX_DEBUG_SUFFIX}.lib" + "-static.a" + "-static.lib" + ".a" + ".lib" +) + +if(AUDIO_CODECS_REPO_PATH OR AUDIO_CODECS_INSTALL_PATH) + set(AUDIO_CODECS_PATH ${AUDIO_CODECS_REPO_PATH}) + set(AUDIO_CODECS_INSTALL_DIR ${AUDIO_CODECS_INSTALL_PATH}) + set(SDL2_REPO_PATH ${AUDIO_CODECS_INSTALL_DIR}) + set(SDL2_INCLUDE_PATH ${AUDIO_CODECS_INSTALL_DIR}/include/SDL2) + link_directories(${AUDIO_CODECS_INSTALL_DIR}/lib) + list(APPEND SDL_MIXER_INCLUDE_PATHS ${AUDIO_CODECS_INSTALL_DIR}/include ${SDL2_INCLUDE_PATH}) + message("AudioCodecs will be used. No needed extra libraries installed in the system.") + set(USE_SYSTEM_AUDIO_LIBRARIES 0) + set(CMAKE_FIND_LIBRARY_SUFFIXES ${FIND_PREFER_STATIC}) +else() + message("AudioCodecs will NOT be used. Libraries will be recognized in the system.") + set(USE_SYSTEM_AUDIO_LIBRARIES 1) +endif() + +add_definitions(-DHAVE_INTTYPES_H -DHAVE_SETENV -DHAVE_SINF) +add_definitions(-Dmain=SDL_main -DPIC -D_REENTRANT -D_USE_MATH_DEFINES) + +set(SDLMixerX_SOURCES) +set(SDLMixerX_LINK_LIBS) + +# Recognize SDL2 library from the system +if(USE_SYSTEM_AUDIO_LIBRARIES) + find_package(PkgConfig) + pkg_check_modules(SDL2 REQUIRED sdl2) + list(APPEND SDL_MIXER_INCLUDE_PATHS ${SDL2_INCLUDE_DIRS}) + list(APPEND SDLMixerX_LINK_LIBS ${SDL2_LIBRARIES}) + message("== SDL2: ${SDL2_INCLUDE_DIRS} ${SDL2_LIBRARIES} ==") +endif() + +option(USE_WAV "Build with WAV codec" ON) +if(USE_WAV) + add_definitions(-DMUSIC_WAV) + list(APPEND SDLMixerX_SOURCES + ${SDLMixerX_SOURCE_DIR}/src/codecs/load_aiff.c + ${SDLMixerX_SOURCE_DIR}/src/codecs/load_voc.c + ${SDLMixerX_SOURCE_DIR}/src/codecs/music_wav.c) +endif() + +option(USE_OGG_VORBIS "Build with OGG Vorbis codec" ON) +if(USE_OGG_VORBIS) + if(USE_SYSTEM_AUDIO_LIBRARIES) + check_library_exists(vorbisfile ov_open "vorbis/vorbisfile.h" FOUND_VORBIS) + find_path(LIBVORBIS_INCLUDE_DIR vorbis/codec.h) + find_library(LIBVORBISFILE_LIB NAMES vorbisfile) + find_library(LIBVORBIS_LIB NAMES vorbis) + message("Vorbis: ${LIBVORBIS_INCLUDE_DIR} ${LIBVORBIS_LIB}") + else() + set(FOUND_VORBIS 1) + if(DOWNLOAD_AUDIO_CODECS_DEPENDENCY) + set(LIBVORBISFILE_LIB vorbisfile) + set(LIBVORBIS_LIB vorbis) + else() + find_library(LIBVORBISFILE_LIB NAMES vorbisfile + HINTS "${AUDIO_CODECS_INSTALL_PATH}/lib") + find_library(LIBVORBIS_LIB NAMES vorbis + HINTS "${AUDIO_CODECS_INSTALL_PATH}/lib") + endif() + endif() + if(FOUND_VORBIS) + message("== using Vorbis ==") + add_definitions(-DMUSIC_OGG) + list(APPEND SDL_MIXER_INCLUDE_PATHS + ${AUDIO_CODECS_PATH}/libogg/include + ${AUDIO_CODECS_PATH}/libvorbis/include + ) + list(APPEND SDLMixerX_LINK_LIBS ${LIBVORBISFILE_LIB} ${LIBVORBIS_LIB}) + set(LIBOGG_NEEDED ON) + list(APPEND SDLMixerX_SOURCES + ${SDLMixerX_SOURCE_DIR}/src/codecs/music_ogg.c) + endif() +endif() + +option(USE_OPUS "Build with OPUS codec" ON) +if(USE_OPUS) + if(USE_SYSTEM_AUDIO_LIBRARIES) + check_library_exists(opusfile op_open_file "opus/opusfile.h" FOUND_OPUS) + find_path(LIBOPUS_INCLUDE_DIR opus/opusfile.h) + find_library(LIBOPUSFILE_LIB NAMES opusfile) + find_library(LIBOPUS_LIB NAMES opusfile) + message("Opus: ${LIBOPUS_INCLUDE_DIR} ${LIBOPUSFILE_LIB} ${LIBOPUS_LIB}") + else() + set(FOUND_OPUS 1) + if(DOWNLOAD_AUDIO_CODECS_DEPENDENCY) + set(LIBOPUSFILE_LIB opusfile) + set(LIBOPUS_LIB opus) + else() + find_library(LIBOPUSFILE_LIB NAMES opusfile + HINTS "${AUDIO_CODECS_INSTALL_PATH}/lib") + find_library(LIBOPUS_LIB NAMES opus + HINTS "${AUDIO_CODECS_INSTALL_PATH}/lib") + endif() + endif() + if(FOUND_OPUS) + message("== using Opus ==") + add_definitions(-DMUSIC_OPUS) + if(AUDIO_CODECS_REPO_PATH) + list(APPEND SDL_MIXER_INCLUDE_PATHS + ${AUDIO_CODECS_PATH}/libogg/include + ${AUDIO_CODECS_PATH}/libopus/include + ${AUDIO_CODECS_PATH}/libopusfile/include + ) + endif() + if(AUDIO_CODECS_INSTALL_DIR) + list(APPEND SDL_MIXER_INCLUDE_PATHS ${AUDIO_CODECS_INSTALL_DIR}/include/opus) + endif() + list(APPEND SDLMixerX_LINK_LIBS ${LIBOPUSFILE_LIB} ${LIBOPUS_LIB}) + set(LIBOGG_NEEDED ON) + list(APPEND SDLMixerX_SOURCES + ${SDLMixerX_SOURCE_DIR}/src/codecs/music_opus.c) + endif() +endif() + +option(USE_FLAC "Build with FLAC codec" ON) +if(USE_FLAC) + if(USE_SYSTEM_AUDIO_LIBRARIES) + check_library_exists(FLAC FLAC__format_sample_rate_is_valid "FLAC/format.h" FOUND_FLAC) + find_path(LIBFLAC_INCLUDE_DIR "FLAC/all.h") + find_library(LIBFLAC_LIB NAMES FLAC) + message("FLAC: ${LIBFLAC_INCLUDE_DIR} ${LIBFLAC_LIB}") + else() + set(FOUND_FLAC 1) + if(DOWNLOAD_AUDIO_CODECS_DEPENDENCY) + set(LIBFLAC_LIB FLAC) + else() + find_library(LIBFLAC_LIB NAMES FLAC + HINTS "${AUDIO_CODECS_INSTALL_PATH}/lib") + endif() + endif() + if(FOUND_FLAC) + message("== using FLAC ==") + add_definitions(-DMUSIC_FLAC -DFLAC__NO_DLL) + if(AUDIO_CODECS_REPO_PATH) + list(APPEND SDL_MIXER_INCLUDE_PATHS + ${AUDIO_CODECS_PATH}/libogg/include + ${AUDIO_CODECS_PATH}/libFLAC/include + ) + endif() + set(LIBOGG_NEEDED ON) + list(APPEND SDLMixerX_LINK_LIBS ${LIBFLAC_LIB}) + list(APPEND SDLMixerX_SOURCES + ${SDLMixerX_SOURCE_DIR}/src/codecs/music_flac.c) + endif() +endif() + +if(LIBOGG_NEEDED) + if(USE_SYSTEM_AUDIO_LIBRARIES) + find_library(LIBOGG_LIB NAMES ogg) + else() + if(DOWNLOAD_AUDIO_CODECS_DEPENDENCY) + set(LIBOGG_LIB ogg) + else() + find_library(LIBOGG_LIB NAMES ogg + HINTS "${AUDIO_CODECS_INSTALL_PATH}/lib") + endif() + endif() + list(APPEND SDLMixerX_LINK_LIBS ${LIBOGG_LIB}) +endif() + +option(USE_MP3_ID3TAG "Build with MP3 Meta tags support provided by libID3Tag library" ON) +if(USE_MP3_ID3TAG AND NOT USE_SYSTEM_AUDIO_LIBRARIES) + message("== using ID3Tag (custom) ==") + add_definitions(-DMUSIC_MP3_ID3TAG) + if(AUDIO_CODECS_REPO_PATH) + list(APPEND SDL_MIXER_INCLUDE_PATHS ${AUDIO_CODECS_PATH}/libid3tag/include) + endif() + if(DOWNLOAD_AUDIO_CODECS_DEPENDENCY) + set(LIBID3TAG_LIB id3tag) + else() + find_library(LIBID3TAG_LIB NAMES id3tag + HINTS "${AUDIO_CODECS_INSTALL_PATH}/lib") + endif() + list(APPEND SDLMixerX_LINK_LIBS ${LIBID3TAG_LIB}) +endif() + +option(USE_MP3_MAD "Build with MAD MP3 codec" ON) +option(USE_MP3_MAD_GPL_DITHERING "Enable GPL-Licensed dithering functions for MAD library" ON) +if(USE_MP3_MAD) + if(USE_SYSTEM_AUDIO_LIBRARIES) + check_library_exists(mad mad_frame_init "mad.h" FOUND_MAD) + find_path(LIBMAD_INCLUDE_DIR "FLAC/all.h") + find_library(LIBMAD_LIB NAMES mad) + message("MAD: ${LIBMAD_INCLUDE_DIR} ${LIBMAD_LIB}") + else() + set(FOUND_MAD 1) + if(DOWNLOAD_AUDIO_CODECS_DEPENDENCY) + set(LIBMAD_LIB mad) + else() + find_library(LIBMAD_LIB NAMES mad + HINTS "${AUDIO_CODECS_INSTALL_PATH}/lib") + endif() + endif() + if(FOUND_MAD) + message("== using MAD ==") + add_definitions(-DMUSIC_MP3_MAD) + if(USE_MP3_MAD_GPL_DITHERING) + add_definitions(-DMUSIC_MP3_MAD_GPL_DITHERING) + endif() + list(APPEND SDLMixerX_LINK_LIBS ${LIBMAD_LIB}) + if(AUDIO_CODECS_REPO_PATH) + list(APPEND SDL_MIXER_INCLUDE_PATHS ${AUDIO_CODECS_PATH}/libmad/include) + endif() + list(APPEND SDLMixerX_SOURCES + ${SDLMixerX_SOURCE_DIR}/src/codecs/music_mad.c) + endif() +endif() + +option(USE_MP3_SMPEG "Build with SMPEG MP3 codec" OFF) +if(USE_MP3_SMPEG) + if(USE_SYSTEM_AUDIO_LIBRARIES) + check_library_exists(smpeg SMPEG_new "smpeg/smpeg.h" FOUND_SMPEG) + find_path(LIBSMPEG_INCLUDE_DIR "smpeg/smpeg.h") + find_library(LIBSMPEG_LIB NAMES smpeg) + message("SMPEG: ${LIBSMPEG_INCLUDE_DIR} ${LIBSMPEG_LIB}") + else() + set(FOUND_SMPEG 1) + if(DOWNLOAD_AUDIO_CODECS_DEPENDENCY) + set(LIBSMPEG_LIB smpeg) + else() + find_library(LIBSMPEG_LIB NAMES smpeg + HINTS "${AUDIO_CODECS_INSTALL_PATH}/lib") + endif() + endif() + if(FOUND_SMPEG) + message("== using SMPEG ==") + add_definitions(-DMUSIC_MP3_SMPEG) + list(APPEND SDLMixerX_LINK_LIBS ${LIBSMPEG_LIB}) + if(AUDIO_CODECS_REPO_PATH) + list(APPEND SDL_MIXER_INCLUDE_PATHS ${AUDIO_CODECS_PATH}/smpeg/include) + endif() + list(APPEND SDLMixerX_SOURCES + ${SDLMixerX_SOURCE_DIR}/src/codecs/music_smpeg.c) + endif() +endif() + +option(USE_MP3_MPG123 "[WIP, DON'T USE IT] Build with MPG123 MP3 codec" OFF) +if(USE_MP3_MPG123) + add_definitions(-DMUSIC_MP3_MPG123) + + message(WARNING "MPG123 SUPPORT IS WIP, DON'T USE IT IN PRODUCTION!!!") + # ======= Until AudioCodecs will receive buildable mpg123, detect it externally ======= + include(cmake/FindMpg123.cmake) + + if(NOT MPG123_FOUND) + message(FATAL_ERROR "MPG123 is not found!") + else() + message("MPG123 found in ${MPG123_INCLUDE_DIR} folder") + endif() + + list(APPEND SDL_MIXER_INCLUDE_PATHS ${MPG123_INCLUDE_DIRS}) + set(LIBS ${LIBS} ${MPG123_LIBRARIES}) + list(APPEND SDLMixerX_LINK_LIBS mpg123) + list(APPEND SDLMixerX_SOURCES + ${SDLMixerX_SOURCE_DIR}/src/codecs/music_mpg123.c) +endif() + +if(USE_MP3_MAD OR USE_MP3_MPG123 OR USE_MP3_SMPEG) + list(APPEND SDLMixerX_SOURCES + ${SDLMixerX_SOURCE_DIR}/src/codecs/music_id3tag.c) +endif() + +option(USE_MODPLUG "Build with ModPlug library" ON) +if(USE_MODPLUG) + if(USE_SYSTEM_AUDIO_LIBRARIES) + check_library_exists(modplug ModPlug_Load "libmodplug/modplug.h" FOUND_MODPLUG) + find_path(LIBMODPLUG_INCLUDE_DIR libmodplug/modplug.h) + find_library(LIBMODPLUG_LIB NAMES modplug) + message("ModPlug: ${LIBMODPLUG_INCLUDE_DIR} ${LIBMODPLUG_LIB}") + else() + set(FOUND_MODPLUG 1) + if(DOWNLOAD_AUDIO_CODECS_DEPENDENCY) + set(LIBMODPLUG_LIB modplug) + else() + find_library(LIBMODPLUG_LIB NAMES modplug + HINTS "${AUDIO_CODECS_INSTALL_PATH}/lib") + endif() + endif() + if(FOUND_MODPLUG) + message("== using libModPlug ==") + add_definitions(-DMUSIC_MOD_MODPLUG -DMODPLUG_STATIC) + if(AUDIO_CODECS_REPO_PATH) + list(APPEND SDL_MIXER_INCLUDE_PATHS ${AUDIO_CODECS_PATH}/libmodplug/include) + endif() + list(APPEND SDLMixerX_LINK_LIBS ${LIBMODPLUG_LIB}) + list(APPEND SDLMixerX_SOURCES + ${SDLMixerX_SOURCE_DIR}/src/codecs/music_modplug.c) + endif() +endif() + +option(USE_MIKMOD "Build with MikMod library" OFF) +if(USE_MIKMOD) + if(USE_SYSTEM_AUDIO_LIBRARIES) + check_library_exists(mikmod Player_Load "mikmod.h" FOUND_MIKMOD) + find_path(LIBMIKMOD_INCLUDE_DIR "mikmod.h") + find_library(LIBMIKMOD_LIB NAMES mikmod) + message("MikMod: ${LIBMIKMOD_INCLUDE_DIR} ${LIBMIKMOD_LIB}") + else() + set(FOUND_MIKMOD 1) + if(DOWNLOAD_AUDIO_CODECS_DEPENDENCY) + set(LIBMIKMOD_LIB mikmod) + else() + find_library(LIBMIKMOD_LIB NAMES mikmod + HINTS "${AUDIO_CODECS_INSTALL_PATH}/lib") + endif() + endif() + if(FOUND_MIKMOD) + message("== using MikMod ==") + add_definitions(-DMUSIC_MOD_MIKMOD) + if(AUDIO_CODECS_REPO_PATH) + list(APPEND SDL_MIXER_INCLUDE_PATHS ${AUDIO_CODECS_PATH}/libmikmod/include) + endif() + list(APPEND SDLMixerX_LINK_LIBS ${LIBMIKMOD_LIB}) + list(APPEND SDLMixerX_SOURCES + ${SDLMixerX_SOURCE_DIR}/src/codecs/music_mikmod.c) + endif() +endif() + +option(USE_GME "Build with Game Music Emulators library" ON) +if(USE_GME) + if(USE_SYSTEM_AUDIO_LIBRARIES) + check_library_exists(gme gme_load_file "gme.h" FOUND_GME) + find_path(LIBGME_INCLUDE_DIR "gme.h") + find_library(LIBGME_LIB NAMES gme) + find_library(LIBZLIB_LIB NAMES z zlib) + message("GME: ${LIBGME_INCLUDE_DIR} ${LIBGME_LIB}") + else() + set(FOUND_GME 1) + if(DOWNLOAD_AUDIO_CODECS_DEPENDENCY) + set(LIBGME_LIB gme) + set(LIBZLIB_LIB zlib) + else() + find_library(LIBGME_LIB NAMES gme + HINTS "${AUDIO_CODECS_INSTALL_PATH}/lib") + find_library(LIBZLIB_LIB NAMES zlib z + HINTS "${AUDIO_CODECS_INSTALL_PATH}/lib") + endif() + endif() + if(FOUND_GME) + message("== using GME ==") + add_definitions(-DMUSIC_GME) + if(AUDIO_CODECS_REPO_PATH) + list(APPEND SDL_MIXER_INCLUDE_PATHS ${AUDIO_CODECS_PATH}/libgme/include) + list(APPEND SDL_MIXER_INCLUDE_PATHS ${AUDIO_CODECS_PATH}/zlib/include) + endif() + list(APPEND SDLMixerX_LINK_LIBS ${LIBGME_LIB} ${LIBZLIB_LIB}) + list(APPEND SDLMixerX_SOURCES + ${SDLMixerX_SOURCE_DIR}/src/codecs/music_gme.c) + endif() +endif() + +if(NOT WIN32) # CMD Music is not supported on Windows + option(USE_CMD "Build with CMD music player support" ON) + if(USE_CMD) + message("== using CMD Music ==") + add_definitions(-DMUSIC_CMD -D_POSIX_C_SOURCE=1) + CHECK_FUNCTION_EXISTS(fork HAVE_FORK) + if(HAVE_FORK) + add_definitions(-DHAVE_FORK) + endif() + list(APPEND SDLMixerX_SOURCES + ${SDLMixerX_SOURCE_DIR}/src/codecs/music_cmd.c) + endif() +endif() + +option(USE_MIDI "Build with MIDI support" ON) +if(USE_MIDI) + + option(USE_MIDI_ADLMIDI "Build with libADLMIDI OPL3 Emulator based MIDI sequencer support" ON) + if(USE_MIDI_ADLMIDI) + if(USE_SYSTEM_AUDIO_LIBRARIES) + check_library_exists(ADLMIDI adl_init "adlmidi.h" FOUND_ADLMIDI) + find_path(LIBADLMIDI_INCLUDE_DIR "adlmidi.h") + find_library(LIBADLMIDI_LIB NAMES ADLMIDI) + message("ADLMIDI: ${LIBADLMIDI_INCLUDE_DIR} ${LIBADLMIDI_LIB}") + else() + set(FOUND_ADLMIDI 1) + if(DOWNLOAD_AUDIO_CODECS_DEPENDENCY) + set(LIBADLMIDI_LIB ADLMIDI) + else() + find_library(LIBADLMIDI_LIB NAMES ADLMIDI + HINTS "${AUDIO_CODECS_INSTALL_PATH}/lib") + endif() + endif() + if(FOUND_ADLMIDI) + message("== using ADLMIDI ==") + add_definitions(-DMUSIC_MID_ADLMIDI) + if(AUDIO_CODECS_REPO_PATH) + list(APPEND SDL_MIXER_INCLUDE_PATHS ${AUDIO_CODECS_PATH}/libADLMIDI/include) + endif() + set(LIBMATH_NEEDED 1) + list(APPEND SDLMixerX_LINK_LIBS ${LIBADLMIDI_LIB}) + list(APPEND SDLMixerX_SOURCES + ${SDLMixerX_SOURCE_DIR}/src/codecs/music_midi_adl.c) + endif() + endif() + + option(USE_MIDI_OPNMIDI "Build with libOPNMIDI OPN2 Emulator based MIDI sequencer support" ON) + if(USE_MIDI_OPNMIDI) + if(USE_SYSTEM_AUDIO_LIBRARIES) + check_library_exists(OPNMIDI opn_init "opnmidi.h" FOUND_OPNMIDI) + find_path(LIBOPNMIDI_INCLUDE_DIR "opnmidi.h") + find_library(LIBOPNMIDI_LIB NAMES OPNMIDI) + message("OPNMIDI: ${LIBOPNMIDI_INCLUDE_DIR} ${LIBOPNMIDI_LIB}") + else() + set(FOUND_OPNMIDI 1) + if(DOWNLOAD_AUDIO_CODECS_DEPENDENCY) + set(LIBOPNMIDI_LIB OPNMIDI) + else() + find_library(LIBOPNMIDI_LIB NAMES OPNMIDI + HINTS "${AUDIO_CODECS_INSTALL_PATH}/lib") + endif() + endif() + if(FOUND_OPNMIDI) + message("== using OPNMIDI ==") + add_definitions(-DMUSIC_MID_OPNMIDI) + if(AUDIO_CODECS_REPO_PATH) + list(APPEND SDL_MIXER_INCLUDE_PATHS ${AUDIO_CODECS_PATH}/libOPNMIDI/include) + endif() + set(LIBMATH_NEEDED 1) + list(APPEND SDLMixerX_LINK_LIBS ${LIBOPNMIDI_LIB}) + list(APPEND SDLMixerX_SOURCES + ${SDLMixerX_SOURCE_DIR}/src/codecs/music_midi_opn.c) + endif() + endif() + + option(USE_MIDI_TIMIDITY "Build with Timidity wave table MIDI sequencer support" ON) + if(USE_MIDI_TIMIDITY AND NOT USE_SYSTEM_AUDIO_LIBRARIES) + message("== using Timidity (custom) ==") + add_definitions(-DMUSIC_MID_TIMIDITY) + if(AUDIO_CODECS_REPO_PATH) + list(APPEND SDL_MIXER_INCLUDE_PATHS ${AUDIO_CODECS_PATH}/libtimidity/include) + endif() + if(DOWNLOAD_AUDIO_CODECS_DEPENDENCY) + set(LIBTIMIDITY_LIB timidity) + else() + find_library(LIBTIMIDITY_LIB NAMES timidity + HINTS "${AUDIO_CODECS_INSTALL_PATH}/lib") + endif() + list(APPEND SDLMixerX_LINK_LIBS ${LIBTIMIDITY_LIB}) + list(APPEND SDLMixerX_SOURCES + ${SDLMixerX_SOURCE_DIR}/src/codecs/music_timidity.c) + endif() + + option(USE_MIDI_FLUIDSYNTH "Build with FluidSynth wave table MIDI sequencer support" OFF) + if(USE_MIDI_FLUIDSYNTH) + if(USE_SYSTEM_AUDIO_LIBRARIES) + check_library_exists(fluidsynth new_fluid_midi_router "fluidsynth.h" FOUND_FLUIDSYNTH) + find_path(LIBFLUIDSYNTH_INCLUDE_DIR "fluidsynth.h") + find_library(LIBFLUIDSYNTH_LIB NAMES fluidsynth) + message("FluidSynth: ${LIBFLUIDSYNTH_INCLUDE_DIR} ${LIBFLUIDSYNTH_LIB}") + else() + set(FOUND_FLUIDSYNTH 1) + if(DOWNLOAD_AUDIO_CODECS_DEPENDENCY) + set(LIBFLUIDSYNTH_LIB fluidsynth) + else() + find_library(LIBFLUIDSYNTH_LIB NAMES fluidsynth + HINTS "${AUDIO_CODECS_INSTALL_PATH}/lib") + endif() + endif() + if(FOUND_FLUIDSYNTH) + message("== using FluidSynth ==") + add_definitions(-DMUSIC_MID_FLUIDSYNTH) + if(AUDIO_CODECS_REPO_PATH) + list(APPEND SDL_MIXER_INCLUDE_PATHS ${AUDIO_CODECS_PATH}/FluidLite/include) + endif() + list(APPEND SDLMixerX_LINK_LIBS ${LIBFLUIDSYNTH_LIB}) + list(APPEND SDLMixerX_SOURCES + ${SDLMixerX_SOURCE_DIR}/src/codecs/music_fluidsynth.c) + endif() + endif() + + # Native MIDI correctly works on Windows and macOS only. + if(WIN32 OR APPLE) + set(NATIVE_MIDI_SUPPORTED ON) + else() + set(NATIVE_MIDI_SUPPORTED OFF) + endif() + + option(USE_MIDI_NATIVE "Build with operating system native MIDI output support" ${NATIVE_MIDI_SUPPORTED}) + if(USE_MIDI_NATIVE) + add_definitions(-DMUSIC_MID_NATIVE) + list(APPEND SDLMixerX_SOURCES + ${SDLMixerX_SOURCE_DIR}/src/codecs/music_nativemidi.c + ${SDLMixerX_SOURCE_DIR}/src/codecs/native_midi/native_midi_common.c) + if(WIN32) + list(APPEND SDLMixerX_SOURCES + ${SDLMixerX_SOURCE_DIR}/src/codecs/native_midi/native_midi_win32.c) + list(APPEND SDLMixerX_LINK_LIBS winmm) + endif() + if(APPLE) + list(APPEND SDLMixerX_SOURCES + ${SDLMixerX_SOURCE_DIR}/src/codecs/native_midi/native_midi_macosx.c) + endif() + endif() + if(NOT USE_MIDI_ADLMIDI AND + NOT USE_MIDI_OPNMIDI AND + NOT USE_MIDI_TIMIDITY AND + NOT USE_MIDI_FLUIDSYNTH AND + NOT USE_MIDI_NATIVE) + message_error("To have MIDI support you must enable at least one MIDI sequencer library") + endif() + +endif() + +if(USE_SYSTEM_AUDIO_LIBRARIES) + find_library(LIBSDL2CUSTOM_LIB NAMES SDL2) +else() + if(DOWNLOAD_AUDIO_CODECS_DEPENDENCY) + set(LIBSDL2CUSTOM_LIB SDL2$<$:d>) + else() + set(CMAKE_FIND_LIBRARY_SUFFIXES ${FIND_PREFER_SHARED}) + find_library(LIBSDL2CUSTOM_LIB NAMES SDL2 + HINTS "${AUDIO_CODECS_INSTALL_PATH}/lib") + endif() +endif() +list(APPEND SDLMixerX_LINK_LIBS ${LIBSDL2CUSTOM_LIB}) + +if(LIBMATH_NEEDED AND NOT MSVC) + list(APPEND SDLMixerX_LINK_LIBS m) +endif() + +if(WIN32) + option(BUILD_AS_VB6_BINDING "Compile library into solid module compatible with VisualBasic 6" OFF) + if(BUILD_AS_VB6_BINDING) + message("== SDL Mixer X will be built as solid module that is ready for MS-VB6 binding! ==") + list(APPEND SDLMixerX_SOURCES ${SDLMixerX_SOURCE_DIR}/src/vb6_binding/vb6_sdl_binds.c) + list(REMOVE_ITEM SDLMixerX_LINK_LIBS SDL2) + list(REMOVE_ITEM SDLMixerX_LINK_LIBS SDL2$<$:d>) + list(APPEND SDLMixerX_LINK_LIBS + SDL2-static + uuid winmm ole32 imm32 version oleaut32 user32 gdi32) + if(NOT MSVC) + list(APPEND SDLMixerX_LINK_LIBS stdc++ gcc pthread) + endif() + endif() +endif() + +if(APPLE) + find_library(APPLE_CORE_AUDIO CoreAudio) + find_library(APPLE_IOKIT IOKit) + find_library(APPLE_COCOA Cocoa) + find_library(APPLE_AUDIOTOOLBOX AudioToolbox) + find_library(APPLE_CORE_VIDEO CoreVideo) + find_library(APPLE_CORE_FOUNDATION CoreFoundation) + find_library(APPLE_CARBON Carbon) + find_library(APPLE_FORCE_FEEDBACK ForceFeedback) + find_library(ICONV_LIB iconv) + list(APPEND SDLMixerX_LINK_LIBS + ${APPLE_CORE_AUDIO} + ${APPLE_COCOA} + ${APPLE_CORE_VIDEO} + ${APPLE_CORE_FOUNDATION} + ${APPLE_FORCE_FEEDBACK} + ${APPLE_IOKIT} + ${APPLE_CARBON} + ${APPLE_AUDIOTOOLBOX} + ${ICONV_LIB}) + list(APPEND SDLMixerX_LINK_LIBS objc) +endif() + +if(NOT MSVC) + list(APPEND SDLMixerX_LINK_LIBS stdc++) +endif() + +list(APPEND SDLMixerX_SOURCES + ${SDLMixerX_SOURCE_DIR}/src/effect_position.c + ${SDLMixerX_SOURCE_DIR}/src/effects_internal.c + ${SDLMixerX_SOURCE_DIR}/src/effect_stereoreverse.c + ${SDLMixerX_SOURCE_DIR}/src/mixer.c + ${SDLMixerX_SOURCE_DIR}/src/music.c + ${SDLMixerX_SOURCE_DIR}/src/mixer_x_deprecated.c + ) + +file(GLOB SDLMixerX_SOURCES ${SDLMixerX_SOURCES}) + +set(SDLMixerX_INSTALLS) + +if(SDL_MIXER_X_STATIC AND NOT BUILD_AS_VB6_BINDING) + add_library(SDL2_mixer_ext_Static STATIC ${SDLMixerX_SOURCES}) + if(WIN32) + set_target_properties(SDL2_mixer_ext_Static PROPERTIES OUTPUT_NAME SDL2_mixer_ext-static) + else() + set_target_properties(SDL2_mixer_ext_Static PROPERTIES OUTPUT_NAME SDL2_mixer_ext) + endif() + target_include_directories(SDL2_mixer_ext_Static PRIVATE + ${SDLMixerX_SOURCE_DIR}/include/SDL_mixer_ext + ${SDLMixerX_SOURCE_DIR}/src + ${SDLMixerX_SOURCE_DIR}/src/codecs + ${AUDIO_CODECS_INSTALL_DIR}/include/SDL2 + ) + target_include_directories(SDL2_mixer_ext_Static PUBLIC + ${SDLMixerX_SOURCE_DIR}/include + ${SDL_MIXER_INCLUDE_PATHS} + ) + if(DOWNLOAD_AUDIO_CODECS_DEPENDENCY AND AUDIO_CODECS_INSTALL_PATH) + add_dependencies(SDL2_mixer_ext_Static AudioCodecs) + endif() + set_target_properties(SDL2_mixer_ext_Static + PROPERTIES + ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/lib" + LIBRARY_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/lib" + RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/bin" + ) + if(DOWNLOAD_AUDIO_CODECS_DEPENDENCY) + add_custom_command( + TARGET SDL2_mixer_ext_Static POST_BUILD + COMMAND ${CMAKE_COMMAND} -E copy + ${CMAKE_SOURCE_DIR}/include/SDL_mixer_ext/SDL_mixer_ext.h + ${AUDIO_CODECS_INSTALL_DIR}/include/SDL2) + endif() + list(APPEND SDLMixerX_INSTALLS SDL2_mixer_ext_Static) +endif() + +if(WIN32) + list(APPEND SDLMixerX_SOURCES ${SDLMixerX_SOURCE_DIR}/version.rc) +endif() + +if(SDL_MIXER_X_SHARED AND NOT BUILD_AS_VB6_BINDING) + add_library(SDL2_mixer_ext SHARED ${SDLMixerX_SOURCES}) + target_link_libraries(SDL2_mixer_ext ${SDLMixerX_LINK_LIBS}) + target_include_directories(SDL2_mixer_ext PRIVATE + ${SDLMixerX_SOURCE_DIR}/include/SDL_mixer_ext + ${SDLMixerX_SOURCE_DIR}/src + ${SDLMixerX_SOURCE_DIR}/src/codecs + ${AUDIO_CODECS_INSTALL_DIR}/include/SDL2 + ) + target_include_directories(SDL2_mixer_ext PUBLIC + ${SDLMixerX_SOURCE_DIR}/include + ${SDL_MIXER_INCLUDE_PATHS} + ) + if(DOWNLOAD_AUDIO_CODECS_DEPENDENCY AND AUDIO_CODECS_INSTALL_PATH) + add_dependencies(SDL2_mixer_ext AudioCodecs) + endif() + set_target_properties(SDL2_mixer_ext + PROPERTIES + ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/lib" + LIBRARY_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/lib" + RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/bin" + ) + if(DOWNLOAD_AUDIO_CODECS_DEPENDENCY) + add_custom_command( + TARGET SDL2_mixer_ext POST_BUILD + COMMAND ${CMAKE_COMMAND} -E copy + ${CMAKE_SOURCE_DIR}/include/SDL_mixer_ext/SDL_mixer_ext.h + ${AUDIO_CODECS_INSTALL_DIR}/include/SDL2) + endif() + list(APPEND SDLMixerX_INSTALLS SDL2_mixer_ext) +endif() + +if(BUILD_AS_VB6_BINDING) + add_library(SDL2_mixer_ext_VB6 MODULE ${SDLMixerX_SOURCES}) + set_target_properties(SDL2_mixer_ext_VB6 PROPERTIES OUTPUT_NAME SDL2MixerVB) + set_target_properties(SDL2_mixer_ext_VB6 PROPERTIES PREFIX "") + target_compile_definitions(SDL2_mixer_ext_VB6 PRIVATE -DFORCE_STDCALLS) + target_link_libraries(SDL2_mixer_ext_VB6 ${SDLMixerX_LINK_LIBS}) + target_include_directories(SDL2_mixer_ext_VB6 PUBLIC + ${SDLMixerX_SOURCE_DIR}/include/SDL_mixer_ext + ${SDLMixerX_SOURCE_DIR}/src + ${SDLMixerX_SOURCE_DIR}/src/codecs + ${AUDIO_CODECS_INSTALL_DIR}/include/SDL2 + ) + target_include_directories(SDL2_mixer_ext_VB6 PUBLIC + ${SDLMixerX_SOURCE_DIR}/include + ${SDL_MIXER_INCLUDE_PATHS} + ) + set_target_properties(SDL2_mixer_ext_VB6 PROPERTIES LINK_FLAGS + "-Wl,--add-stdcall-alias -static-libgcc -static-libstdc++ -static -lpthread") + if(DOWNLOAD_AUDIO_CODECS_DEPENDENCY AND AUDIO_CODECS_INSTALL_PATH) + add_dependencies(SDL2_mixer_ext_VB6 AudioCodecs) + endif() + set_target_properties(SDL2_mixer_ext_VB6 + PROPERTIES + ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/sdl-mixer-vb6" + LIBRARY_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/sdl-mixer-vb6" + RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/sdl-mixer-vb6" + ) + add_custom_command( + TARGET SDL2_mixer_ext_VB6 POST_BUILD + COMMAND ${CMAKE_COMMAND} -E copy + ${CMAKE_SOURCE_DIR}/VB6_Wrapper/modSDL2_mixer_ext_vb6.bas + ${CMAKE_BINARY_DIR}/sdl-mixer-vb6) + list(APPEND SDLMixerX_INSTALLS SDL2_mixer_ext_VB6) +endif() + +install(TARGETS ${SDLMixerX_INSTALLS} + RUNTIME DESTINATION "bin" + LIBRARY DESTINATION "lib" + ARCHIVE DESTINATION "lib" + FRAMEWORK DESTINATION "lib" + INCLUDES DESTINATION "include") + +if(DOWNLOAD_AUDIO_CODECS_DEPENDENCY) + install(DIRECTORY ${AUDIO_CODECS_INSTALL_DIR}/bin + DESTINATION .) + install(DIRECTORY ${AUDIO_CODECS_INSTALL_DIR}/lib + DESTINATION .) + install(DIRECTORY ${AUDIO_CODECS_INSTALL_DIR}/include + DESTINATION .) +endif() + +install(FILES + include/SDL_mixer_ext/begin_code.h + include/SDL_mixer_ext/close_code.h + include/SDL_mixer_ext/SDL_mixer_ext.h + DESTINATION include/SDL2) + diff --git a/libs/SDLMixerX/COPYING.txt b/libs/SDLMixerX/COPYING.txt new file mode 100644 index 000000000..e8f8643f2 --- /dev/null +++ b/libs/SDLMixerX/COPYING.txt @@ -0,0 +1,24 @@ +/* + SDL Mixer X: An extended audio mixer library, forked from SDL_mixer + Copyright (C) 2014-2018 Vitaly Novichkov + + SDL_mixer: An audio mixer library based on the SDL library + Copyright (C) 1997-2018 Sam Lantinga + + 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. + +*/ diff --git a/libs/SDLMixerX/GPLv2.txt b/libs/SDLMixerX/GPLv2.txt new file mode 100644 index 000000000..1f963da0d --- /dev/null +++ b/libs/SDLMixerX/GPLv2.txt @@ -0,0 +1,340 @@ + 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 + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +convey the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + + Copyright (C) + + 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. + + You should have received a copy of the GNU General Public License along + with this program; if not, write to the Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + +Also add information on how to contact you by electronic and paper mail. + +If the program is interactive, make it output a short notice like this +when it starts in an interactive mode: + + Gnomovision version 69, Copyright (C) year name of author + Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, the commands you use may +be called something other than `show w' and `show c'; they could even be +mouse-clicks or menu items--whatever suits your program. + +You should also get your employer (if you work as a programmer) or your +school, if any, to sign a "copyright disclaimer" for the program, if +necessary. Here is a sample; alter the names: + + Yoyodyne, Inc., hereby disclaims all copyright interest in the program + `Gnomovision' (which makes passes at compilers) written by James Hacker. + + , 1 April 1989 + Ty Coon, President of Vice + +This General Public License does not permit incorporating your program into +proprietary programs. If your program is a subroutine library, you may +consider it more useful to permit linking proprietary applications with the +library. If this is what you want to do, use the GNU Lesser General +Public License instead of this License. + diff --git a/libs/SDLMixerX/GPLv3.txt b/libs/SDLMixerX/GPLv3.txt new file mode 100644 index 000000000..10926e87f --- /dev/null +++ b/libs/SDLMixerX/GPLv3.txt @@ -0,0 +1,675 @@ + GNU GENERAL PUBLIC LICENSE + Version 3, 29 June 2007 + + Copyright (C) 2007 Free Software Foundation, Inc. + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The GNU General Public License is a free, copyleft license for +software and other kinds of works. + + The licenses for most software and other practical works are designed +to take away your freedom to share and change the works. By contrast, +the GNU General Public License is intended to guarantee your freedom to +share and change all versions of a program--to make sure it remains free +software for all its users. We, the Free Software Foundation, use the +GNU General Public License for most of our software; it applies also to +any other work released this way by its authors. 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 +them 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 prevent others from denying you +these rights or asking you to surrender the rights. Therefore, you have +certain responsibilities if you distribute copies of the software, or if +you modify it: responsibilities to respect the freedom of others. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must pass on to the recipients the same +freedoms that you received. 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. + + Developers that use the GNU GPL protect your rights with two steps: +(1) assert copyright on the software, and (2) offer you this License +giving you legal permission to copy, distribute and/or modify it. + + For the developers' and authors' protection, the GPL clearly explains +that there is no warranty for this free software. For both users' and +authors' sake, the GPL requires that modified versions be marked as +changed, so that their problems will not be attributed erroneously to +authors of previous versions. + + Some devices are designed to deny users access to install or run +modified versions of the software inside them, although the manufacturer +can do so. This is fundamentally incompatible with the aim of +protecting users' freedom to change the software. The systematic +pattern of such abuse occurs in the area of products for individuals to +use, which is precisely where it is most unacceptable. Therefore, we +have designed this version of the GPL to prohibit the practice for those +products. If such problems arise substantially in other domains, we +stand ready to extend this provision to those domains in future versions +of the GPL, as needed to protect the freedom of users. + + Finally, every program is threatened constantly by software patents. +States should not allow patents to restrict development and use of +software on general-purpose computers, but in those that do, we wish to +avoid the special danger that patents applied to a free program could +make it effectively proprietary. To prevent this, the GPL assures that +patents cannot be used to render the program non-free. + + The precise terms and conditions for copying, distribution and +modification follow. + + TERMS AND CONDITIONS + + 0. Definitions. + + "This License" refers to version 3 of the GNU General Public License. + + "Copyright" also means copyright-like laws that apply to other kinds of +works, such as semiconductor masks. + + "The Program" refers to any copyrightable work licensed under this +License. Each licensee is addressed as "you". "Licensees" and +"recipients" may be individuals or organizations. + + To "modify" a work means to copy from or adapt all or part of the work +in a fashion requiring copyright permission, other than the making of an +exact copy. The resulting work is called a "modified version" of the +earlier work or a work "based on" the earlier work. + + A "covered work" means either the unmodified Program or a work based +on the Program. + + To "propagate" a work means to do anything with it that, without +permission, would make you directly or secondarily liable for +infringement under applicable copyright law, except executing it on a +computer or modifying a private copy. Propagation includes copying, +distribution (with or without modification), making available to the +public, and in some countries other activities as well. + + To "convey" a work means any kind of propagation that enables other +parties to make or receive copies. Mere interaction with a user through +a computer network, with no transfer of a copy, is not conveying. + + An interactive user interface displays "Appropriate Legal Notices" +to the extent that it includes a convenient and prominently visible +feature that (1) displays an appropriate copyright notice, and (2) +tells the user that there is no warranty for the work (except to the +extent that warranties are provided), that licensees may convey the +work under this License, and how to view a copy of this License. If +the interface presents a list of user commands or options, such as a +menu, a prominent item in the list meets this criterion. + + 1. Source Code. + + The "source code" for a work means the preferred form of the work +for making modifications to it. "Object code" means any non-source +form of a work. + + A "Standard Interface" means an interface that either is an official +standard defined by a recognized standards body, or, in the case of +interfaces specified for a particular programming language, one that +is widely used among developers working in that language. + + The "System Libraries" of an executable work include anything, other +than the work as a whole, that (a) is included in the normal form of +packaging a Major Component, but which is not part of that Major +Component, and (b) serves only to enable use of the work with that +Major Component, or to implement a Standard Interface for which an +implementation is available to the public in source code form. A +"Major Component", in this context, means a major essential component +(kernel, window system, and so on) of the specific operating system +(if any) on which the executable work runs, or a compiler used to +produce the work, or an object code interpreter used to run it. + + The "Corresponding Source" for a work in object code form means all +the source code needed to generate, install, and (for an executable +work) run the object code and to modify the work, including scripts to +control those activities. However, it does not include the work's +System Libraries, or general-purpose tools or generally available free +programs which are used unmodified in performing those activities but +which are not part of the work. For example, Corresponding Source +includes interface definition files associated with source files for +the work, and the source code for shared libraries and dynamically +linked subprograms that the work is specifically designed to require, +such as by intimate data communication or control flow between those +subprograms and other parts of the work. + + The Corresponding Source need not include anything that users +can regenerate automatically from other parts of the Corresponding +Source. + + The Corresponding Source for a work in source code form is that +same work. + + 2. Basic Permissions. + + All rights granted under this License are granted for the term of +copyright on the Program, and are irrevocable provided the stated +conditions are met. This License explicitly affirms your unlimited +permission to run the unmodified Program. The output from running a +covered work is covered by this License only if the output, given its +content, constitutes a covered work. This License acknowledges your +rights of fair use or other equivalent, as provided by copyright law. + + You may make, run and propagate covered works that you do not +convey, without conditions so long as your license otherwise remains +in force. You may convey covered works to others for the sole purpose +of having them make modifications exclusively for you, or provide you +with facilities for running those works, provided that you comply with +the terms of this License in conveying all material for which you do +not control copyright. Those thus making or running the covered works +for you must do so exclusively on your behalf, under your direction +and control, on terms that prohibit them from making any copies of +your copyrighted material outside their relationship with you. + + Conveying under any other circumstances is permitted solely under +the conditions stated below. Sublicensing is not allowed; section 10 +makes it unnecessary. + + 3. Protecting Users' Legal Rights From Anti-Circumvention Law. + + No covered work shall be deemed part of an effective technological +measure under any applicable law fulfilling obligations under article +11 of the WIPO copyright treaty adopted on 20 December 1996, or +similar laws prohibiting or restricting circumvention of such +measures. + + When you convey a covered work, you waive any legal power to forbid +circumvention of technological measures to the extent such circumvention +is effected by exercising rights under this License with respect to +the covered work, and you disclaim any intention to limit operation or +modification of the work as a means of enforcing, against the work's +users, your or third parties' legal rights to forbid circumvention of +technological measures. + + 4. Conveying Verbatim Copies. + + You may convey 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; +keep intact all notices stating that this License and any +non-permissive terms added in accord with section 7 apply to the code; +keep intact all notices of the absence of any warranty; and give all +recipients a copy of this License along with the Program. + + You may charge any price or no price for each copy that you convey, +and you may offer support or warranty protection for a fee. + + 5. Conveying Modified Source Versions. + + You may convey a work based on the Program, or the modifications to +produce it from the Program, in the form of source code under the +terms of section 4, provided that you also meet all of these conditions: + + a) The work must carry prominent notices stating that you modified + it, and giving a relevant date. + + b) The work must carry prominent notices stating that it is + released under this License and any conditions added under section + 7. This requirement modifies the requirement in section 4 to + "keep intact all notices". + + c) You must license the entire work, as a whole, under this + License to anyone who comes into possession of a copy. This + License will therefore apply, along with any applicable section 7 + additional terms, to the whole of the work, and all its parts, + regardless of how they are packaged. This License gives no + permission to license the work in any other way, but it does not + invalidate such permission if you have separately received it. + + d) If the work has interactive user interfaces, each must display + Appropriate Legal Notices; however, if the Program has interactive + interfaces that do not display Appropriate Legal Notices, your + work need not make them do so. + + A compilation of a covered work with other separate and independent +works, which are not by their nature extensions of the covered work, +and which are not combined with it such as to form a larger program, +in or on a volume of a storage or distribution medium, is called an +"aggregate" if the compilation and its resulting copyright are not +used to limit the access or legal rights of the compilation's users +beyond what the individual works permit. Inclusion of a covered work +in an aggregate does not cause this License to apply to the other +parts of the aggregate. + + 6. Conveying Non-Source Forms. + + You may convey a covered work in object code form under the terms +of sections 4 and 5, provided that you also convey the +machine-readable Corresponding Source under the terms of this License, +in one of these ways: + + a) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by the + Corresponding Source fixed on a durable physical medium + customarily used for software interchange. + + b) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by a + written offer, valid for at least three years and valid for as + long as you offer spare parts or customer support for that product + model, to give anyone who possesses the object code either (1) a + copy of the Corresponding Source for all the software in the + product that is covered by this License, on a durable physical + medium customarily used for software interchange, for a price no + more than your reasonable cost of physically performing this + conveying of source, or (2) access to copy the + Corresponding Source from a network server at no charge. + + c) Convey individual copies of the object code with a copy of the + written offer to provide the Corresponding Source. This + alternative is allowed only occasionally and noncommercially, and + only if you received the object code with such an offer, in accord + with subsection 6b. + + d) Convey the object code by offering access from a designated + place (gratis or for a charge), and offer equivalent access to the + Corresponding Source in the same way through the same place at no + further charge. You need not require recipients to copy the + Corresponding Source along with the object code. If the place to + copy the object code is a network server, the Corresponding Source + may be on a different server (operated by you or a third party) + that supports equivalent copying facilities, provided you maintain + clear directions next to the object code saying where to find the + Corresponding Source. Regardless of what server hosts the + Corresponding Source, you remain obligated to ensure that it is + available for as long as needed to satisfy these requirements. + + e) Convey the object code using peer-to-peer transmission, provided + you inform other peers where the object code and Corresponding + Source of the work are being offered to the general public at no + charge under subsection 6d. + + A separable portion of the object code, whose source code is excluded +from the Corresponding Source as a System Library, need not be +included in conveying the object code work. + + A "User Product" is either (1) a "consumer product", which means any +tangible personal property which is normally used for personal, family, +or household purposes, or (2) anything designed or sold for incorporation +into a dwelling. In determining whether a product is a consumer product, +doubtful cases shall be resolved in favor of coverage. For a particular +product received by a particular user, "normally used" refers to a +typical or common use of that class of product, regardless of the status +of the particular user or of the way in which the particular user +actually uses, or expects or is expected to use, the product. A product +is a consumer product regardless of whether the product has substantial +commercial, industrial or non-consumer uses, unless such uses represent +the only significant mode of use of the product. + + "Installation Information" for a User Product means any methods, +procedures, authorization keys, or other information required to install +and execute modified versions of a covered work in that User Product from +a modified version of its Corresponding Source. The information must +suffice to ensure that the continued functioning of the modified object +code is in no case prevented or interfered with solely because +modification has been made. + + If you convey an object code work under this section in, or with, or +specifically for use in, a User Product, and the conveying occurs as +part of a transaction in which the right of possession and use of the +User Product is transferred to the recipient in perpetuity or for a +fixed term (regardless of how the transaction is characterized), the +Corresponding Source conveyed under this section must be accompanied +by the Installation Information. But this requirement does not apply +if neither you nor any third party retains the ability to install +modified object code on the User Product (for example, the work has +been installed in ROM). + + The requirement to provide Installation Information does not include a +requirement to continue to provide support service, warranty, or updates +for a work that has been modified or installed by the recipient, or for +the User Product in which it has been modified or installed. Access to a +network may be denied when the modification itself materially and +adversely affects the operation of the network or violates the rules and +protocols for communication across the network. + + Corresponding Source conveyed, and Installation Information provided, +in accord with this section must be in a format that is publicly +documented (and with an implementation available to the public in +source code form), and must require no special password or key for +unpacking, reading or copying. + + 7. Additional Terms. + + "Additional permissions" are terms that supplement the terms of this +License by making exceptions from one or more of its conditions. +Additional permissions that are applicable to the entire Program shall +be treated as though they were included in this License, to the extent +that they are valid under applicable law. If additional permissions +apply only to part of the Program, that part may be used separately +under those permissions, but the entire Program remains governed by +this License without regard to the additional permissions. + + When you convey a copy of a covered work, you may at your option +remove any additional permissions from that copy, or from any part of +it. (Additional permissions may be written to require their own +removal in certain cases when you modify the work.) You may place +additional permissions on material, added by you to a covered work, +for which you have or can give appropriate copyright permission. + + Notwithstanding any other provision of this License, for material you +add to a covered work, you may (if authorized by the copyright holders of +that material) supplement the terms of this License with terms: + + a) Disclaiming warranty or limiting liability differently from the + terms of sections 15 and 16 of this License; or + + b) Requiring preservation of specified reasonable legal notices or + author attributions in that material or in the Appropriate Legal + Notices displayed by works containing it; or + + c) Prohibiting misrepresentation of the origin of that material, or + requiring that modified versions of such material be marked in + reasonable ways as different from the original version; or + + d) Limiting the use for publicity purposes of names of licensors or + authors of the material; or + + e) Declining to grant rights under trademark law for use of some + trade names, trademarks, or service marks; or + + f) Requiring indemnification of licensors and authors of that + material by anyone who conveys the material (or modified versions of + it) with contractual assumptions of liability to the recipient, for + any liability that these contractual assumptions directly impose on + those licensors and authors. + + All other non-permissive additional terms are considered "further +restrictions" within the meaning of section 10. If the Program as you +received it, or any part of it, contains a notice stating that it is +governed by this License along with a term that is a further +restriction, you may remove that term. If a license document contains +a further restriction but permits relicensing or conveying under this +License, you may add to a covered work material governed by the terms +of that license document, provided that the further restriction does +not survive such relicensing or conveying. + + If you add terms to a covered work in accord with this section, you +must place, in the relevant source files, a statement of the +additional terms that apply to those files, or a notice indicating +where to find the applicable terms. + + Additional terms, permissive or non-permissive, may be stated in the +form of a separately written license, or stated as exceptions; +the above requirements apply either way. + + 8. Termination. + + You may not propagate or modify a covered work except as expressly +provided under this License. Any attempt otherwise to propagate or +modify it is void, and will automatically terminate your rights under +this License (including any patent licenses granted under the third +paragraph of section 11). + + However, if you cease all violation of this License, then your +license from a particular copyright holder is reinstated (a) +provisionally, unless and until the copyright holder explicitly and +finally terminates your license, and (b) permanently, if the copyright +holder fails to notify you of the violation by some reasonable means +prior to 60 days after the cessation. + + Moreover, your license from a particular copyright holder is +reinstated permanently if the copyright holder notifies you of the +violation by some reasonable means, this is the first time you have +received notice of violation of this License (for any work) from that +copyright holder, and you cure the violation prior to 30 days after +your receipt of the notice. + + Termination of your rights under this section does not terminate the +licenses of parties who have received copies or rights from you under +this License. If your rights have been terminated and not permanently +reinstated, you do not qualify to receive new licenses for the same +material under section 10. + + 9. Acceptance Not Required for Having Copies. + + You are not required to accept this License in order to receive or +run a copy of the Program. Ancillary propagation of a covered work +occurring solely as a consequence of using peer-to-peer transmission +to receive a copy likewise does not require acceptance. However, +nothing other than this License grants you permission to propagate or +modify any covered work. These actions infringe copyright if you do +not accept this License. Therefore, by modifying or propagating a +covered work, you indicate your acceptance of this License to do so. + + 10. Automatic Licensing of Downstream Recipients. + + Each time you convey a covered work, the recipient automatically +receives a license from the original licensors, to run, modify and +propagate that work, subject to this License. You are not responsible +for enforcing compliance by third parties with this License. + + An "entity transaction" is a transaction transferring control of an +organization, or substantially all assets of one, or subdividing an +organization, or merging organizations. If propagation of a covered +work results from an entity transaction, each party to that +transaction who receives a copy of the work also receives whatever +licenses to the work the party's predecessor in interest had or could +give under the previous paragraph, plus a right to possession of the +Corresponding Source of the work from the predecessor in interest, if +the predecessor has it or can get it with reasonable efforts. + + You may not impose any further restrictions on the exercise of the +rights granted or affirmed under this License. For example, you may +not impose a license fee, royalty, or other charge for exercise of +rights granted under this License, and you may not initiate litigation +(including a cross-claim or counterclaim in a lawsuit) alleging that +any patent claim is infringed by making, using, selling, offering for +sale, or importing the Program or any portion of it. + + 11. Patents. + + A "contributor" is a copyright holder who authorizes use under this +License of the Program or a work on which the Program is based. The +work thus licensed is called the contributor's "contributor version". + + A contributor's "essential patent claims" are all patent claims +owned or controlled by the contributor, whether already acquired or +hereafter acquired, that would be infringed by some manner, permitted +by this License, of making, using, or selling its contributor version, +but do not include claims that would be infringed only as a +consequence of further modification of the contributor version. For +purposes of this definition, "control" includes the right to grant +patent sublicenses in a manner consistent with the requirements of +this License. + + Each contributor grants you a non-exclusive, worldwide, royalty-free +patent license under the contributor's essential patent claims, to +make, use, sell, offer for sale, import and otherwise run, modify and +propagate the contents of its contributor version. + + In the following three paragraphs, a "patent license" is any express +agreement or commitment, however denominated, not to enforce a patent +(such as an express permission to practice a patent or covenant not to +sue for patent infringement). To "grant" such a patent license to a +party means to make such an agreement or commitment not to enforce a +patent against the party. + + If you convey a covered work, knowingly relying on a patent license, +and the Corresponding Source of the work is not available for anyone +to copy, free of charge and under the terms of this License, through a +publicly available network server or other readily accessible means, +then you must either (1) cause the Corresponding Source to be so +available, or (2) arrange to deprive yourself of the benefit of the +patent license for this particular work, or (3) arrange, in a manner +consistent with the requirements of this License, to extend the patent +license to downstream recipients. "Knowingly relying" means you have +actual knowledge that, but for the patent license, your conveying the +covered work in a country, or your recipient's use of the covered work +in a country, would infringe one or more identifiable patents in that +country that you have reason to believe are valid. + + If, pursuant to or in connection with a single transaction or +arrangement, you convey, or propagate by procuring conveyance of, a +covered work, and grant a patent license to some of the parties +receiving the covered work authorizing them to use, propagate, modify +or convey a specific copy of the covered work, then the patent license +you grant is automatically extended to all recipients of the covered +work and works based on it. + + A patent license is "discriminatory" if it does not include within +the scope of its coverage, prohibits the exercise of, or is +conditioned on the non-exercise of one or more of the rights that are +specifically granted under this License. You may not convey a covered +work if you are a party to an arrangement with a third party that is +in the business of distributing software, under which you make payment +to the third party based on the extent of your activity of conveying +the work, and under which the third party grants, to any of the +parties who would receive the covered work from you, a discriminatory +patent license (a) in connection with copies of the covered work +conveyed by you (or copies made from those copies), or (b) primarily +for and in connection with specific products or compilations that +contain the covered work, unless you entered into that arrangement, +or that patent license was granted, prior to 28 March 2007. + + Nothing in this License shall be construed as excluding or limiting +any implied license or other defenses to infringement that may +otherwise be available to you under applicable patent law. + + 12. No Surrender of Others' Freedom. + + If 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 convey a +covered work so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you may +not convey it at all. For example, if you agree to terms that obligate you +to collect a royalty for further conveying from those to whom you convey +the Program, the only way you could satisfy both those terms and this +License would be to refrain entirely from conveying the Program. + + 13. Use with the GNU Affero General Public License. + + Notwithstanding any other provision of this License, you have +permission to link or combine any covered work with a work licensed +under version 3 of the GNU Affero General Public License into a single +combined work, and to convey the resulting work. The terms of this +License will continue to apply to the part which is the covered work, +but the special requirements of the GNU Affero General Public License, +section 13, concerning interaction through a network will apply to the +combination as such. + + 14. Revised Versions of this License. + + The Free Software Foundation may publish revised and/or new versions of +the GNU 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 that a certain numbered version of the GNU General +Public License "or any later version" applies to it, you have the +option of following the terms and conditions either of that numbered +version or of any later version published by the Free Software +Foundation. If the Program does not specify a version number of the +GNU General Public License, you may choose any version ever published +by the Free Software Foundation. + + If the Program specifies that a proxy can decide which future +versions of the GNU General Public License can be used, that proxy's +public statement of acceptance of a version permanently authorizes you +to choose that version for the Program. + + Later license versions may give you additional or different +permissions. However, no additional obligations are imposed on any +author or copyright holder as a result of your choosing to follow a +later version. + + 15. Disclaimer of Warranty. + + 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. + + 16. Limitation of Liability. + + IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS +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. + + 17. Interpretation of Sections 15 and 16. + + If the disclaimer of warranty and limitation of liability provided +above cannot be given local legal effect according to their terms, +reviewing courts shall apply local law that most closely approximates +an absolute waiver of all civil liability in connection with the +Program, unless a warranty or assumption of liability accompanies a +copy of the Program in return for a fee. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +state the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + + Copyright (C) + + 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 3 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. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . + +Also add information on how to contact you by electronic and paper mail. + + If the program does terminal interaction, make it output a short +notice like this when it starts in an interactive mode: + + Copyright (C) + This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, your program's commands +might be different; for a GUI interface, you would use an "about box". + + You should also get your employer (if you work as a programmer) or school, +if any, to sign a "copyright disclaimer" for the program, if necessary. +For more information on this, and how to apply and follow the GNU GPL, see +. + + The GNU General Public License does not permit incorporating your program +into proprietary programs. If your program is a subroutine library, you +may consider it more useful to permit linking proprietary applications with +the library. If this is what you want to do, use the GNU Lesser General +Public License instead of this License. But first, please read +. + diff --git a/libs/SDLMixerX/README.txt b/libs/SDLMixerX/README.txt new file mode 100644 index 000000000..998e0d9d3 --- /dev/null +++ b/libs/SDLMixerX/README.txt @@ -0,0 +1,248 @@ +SDL Mixer X (aka SDL Mixer 2.0 Modded or SDL_mixer_ext), +by Vitaly Novichkov , +forked from SDL Mixer 2.0 by Sam Lantinga + +vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv +WARNING: The licenses for libmad, ADLMIDI, OPNMIDI, and GME is GPL, + which means that in order to use it your application must + also be GPL! +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +The latest original version of this library is available from: +http://www.libsdl.org/projects/SDL_mixer/ + +Sources of modified library version is available in the PGE Project's sources: +https://github.com/Wohlhabend-Networks/PGE-Project/ + in the folder: _Libs/SDL2_mixer_modified/ +or: +https://bitbucket.org/Wohlstand/pge-project + in the folder: _Libs/SDL2_mixer_modified/ + +============================================================================= +Difference between original and this library: +----------------------------------------------------------------------------- ++ Added new codecs: + - Game Music Emulators (LGPL v2.1) which adds support of chip tunes + like NSF, VGM, SPC, HES, etc. + - libADLMIDI (GPL v3, LGPL v3) (remake from ADLMIDI) to play MIDI with + emulated OPL3 synthesiser, also supports loop points + "loopStart" and "loopEnd" + - libOPNMIDI (GPL v3, LGPL v3) to play MIDI with + emulated OPN2 synthesiser, also supports loop points + "loopStart" and "loopEnd" ++ Added some new functions ++ Added support of loop points for OGG files (via "LOOPSTART" and "LOOPEND" + (or "LOOPLENGTH" to be compatible with RPG Maker) vorbis comments) ++ Reorganized music codecs processing system ++ Added support to get current position and track lenght for a seekable codecs + +vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv +IMPORTANT: To choice a track number of NSF, GBM, HES, etc file, + you must append "|xxx" to end of file path for + Mix_LoadMUS function. + Where xxx - actual number of chip track, (from 0 to N-1) + Examples: "file.nsf|12", "file.hes|2" +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv +Arguments are passing like argument for a GME-based files (NSF, HES, etc.): +Syntax for MIDI is: + myfile.mid|xyy;xyy;xyy;...; + where x - parameter type + where y - value (every value must be ended with semicolon!) + +available parameters: + s - use a specific synthesiser + 0 - ADLMIDI + 1 - Native MIDI [Win32/OSX/Haiku only] + 2 - Timidity + 3 - Fluidsynth + b - value from 0 to 66 - number of ADLMIDI bank + t - (0 or 1) enable deep tremolo on ADLMIDI + v - (0 or 1) enable deep vibrato on ADLMIDI + m - (0 or 1) enable scalable modulation on ADLMIDI + a - (0 or 1) enable AdLib mode of percussion on ADLMIDI +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +============================================================================= +Added music codecs: +----------------------------------------------------------------------------- +General: +- MUS_GME - Game Music Emulatirs + +MIDI Playing: +- ADLMIDI - A software synthesizer is based on Yamaha OPL3 (YMF262) chip emulator +- OPNMIDI - A software synthesizer is based on Yamaha OPL3 (YM2612) chip emulator + +============================================================================= +Added functions: +----------------------------------------------------------------------------- +/* + Allows you to set up custom path for Timidify patches +*/ +void MIX_Timidity_addToPathList(const char *path); + +/* + Get music title from meta-tag if possible. If title tag is empty, filename will be returned +*/ +const char* Mix_GetMusicTitle(const Mix_Music *music); + +/* + Get music title from meta-tag if possible +*/ +const char* Mix_GetMusicTitleTag(const Mix_Music *music); + +/* + Get music artist from meta-tag if possible +*/ +const char* Mix_GetMusicArtistTag(const Mix_Music *music); + +/* + Get music album from meta-tag if possible +*/ +const char* Mix_GetMusicAlbumTag(const Mix_Music *music); + +/* + Get music copyright from meta-tag if possible +*/ +const char* Mix_GetMusicCopyrightTag(const Mix_Music *music); + +/* + Load music from memory with passing of extra arguments +*/ +Mix_Music * SDLCALLCC Mix_LoadMUS_RW_ARG(SDL_RWops *src, int freesrc, char *args) + +/* + Load music from memory with passing NSF/HES/etc. track number (accepts integer unlike SDLCALLCC Mix_LoadMUS_RW_ARG) +*/ +Mix_Music * SDLCALLCC Mix_LoadMUS_RW_GME(SDL_RWops *src, int freesrc, int trackID) + +typedef enum +{ + MIDI_ADLMIDI, + MIDI_Native, + MIDI_Timidity, + MIDI_OPNMIDI, + MIDI_Fluidsynth, + MIDI_KnuwnDevices /* Count of MIDI device types */ +} Mix_MIDI_Device; + +/* + Allows you to toggle MIDI Devices! + (change will be applied on re-opening of MIDI file) + Attempt to toggle unsupported MIDI device takes no effect + (for case when library built without linking of required library) +*/ +int Mix_SetMidiDevice(int device); + +/* + Returns current ADLMIDI bank number +*/ +int MIX_ADLMIDI_getBankID(); + +/* + Changes ADLMIDI bank number (changes applying on MIDI file reopen) +*/ +void MIX_ADLMIDI_setBankID(int bnk); + +/* + Returns current state of ADLMIDI deep tremolo flag +*/ +int MIX_ADLMIDI_getTremolo(); + +/* + Changes ADLMIDI deep tremolo flag (changes applying on MIDI file reopen) +*/ +void MIX_ADLMIDI_setTremolo(int tr); + +/* + Returns current state of ADLMIDI deep vibrato flag +*/ +int MIX_ADLMIDI_getVibrato(); + +/* + Changes ADLMIDI deep vibrato flag (changes applying on MIDI file reopen) +*/ +void MIX_ADLMIDI_setVibrato(int vib); + +/* + Returns current state of ADLMIDI deep scaling modulation flag +*/ +int MIX_ADLMIDI_getScaleMod(); + +/* + Changes ADLMIDI scaling modulation flag (changes applying on MIDI file reopen) +*/ +void MIX_ADLMIDI_setScaleMod(int sc); + +/* + Resets ADLMIDI flags and settings to default state +*/ +void MIX_ADLMIDI_setSetDefaults(); + +/* + Get the time current position of music stream + returns -1.0 if this feature is not supported for some codec +*/ +double Mix_GetMusicPosition(Mix_Music *music); +/* + Get the total time length of music stream + returns -1.0 if this feature is not supported for some codec + */ +double Mix_GetMusicTotalTime(Mix_Music *music); + +/* + Get the loop start time position of music stream + returns -1.0 if this feature is not used for this music or not supported for some codec +*/ +double Mix_GetMusicLoopStartTime(Mix_Music *music); +/* + Get the loop end time position of music stream + returns -1.0 if this feature is not used for this music or not supported for some codec +*/ +double Mix_GetMusicLoopEndTime(Mix_Music *music); +/* + Get the loop time length of music stream + returns -1.0 if this feature is not used for this music or not supported for some codec +*/ +double Mix_GetMusicLoopLengthTime(Mix_Music *music); + +============================================================================= + +Due to popular demand, here is a simple multi-channel audio mixer. +It supports 8 channels of 16 bit stereo audio, plus a single channel +of music, mixed by the Modplug MOD, Timidity MIDI, ADLMIDI, GME +and LibMAD MP3 libraries. + +See the header file SDL_mixer_ext.h for documentation on this mixer library. + +The mixer can currently load Microsoft WAVE files and Creative Labs VOC +files as audio samples, and can load MIDI files via Timidity and the +following music formats via MikMod: .MOD .S3M .IT .XM. It can load +Ogg Vorbis streams as music if built with Ogg Vorbis or Tremor libraries, +and finally it can load MP3 music using the SMPEG or libmad libraries. + +Tremor decoding is disabled by default; you can enable it by passing + --enable-music-ogg-tremor +to configure, or by defining OGG_MUSIC and OGG_USE_TREMOR. + +libmad decoding is disabled by default; you can enable it by passing + --enable-music-mp3-mad +to configure, or by defining MP3_MAD_MUSIC +vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv +WARNING: The license for libmad is GPL, which means that in order to + use it your application must also be GPL! +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +The process of mixing MIDI files to wave output is very CPU intensive, +so if playing regular WAVE files sound great, but playing MIDI files +sound choppy on slow computers, try using 8-bit audio, mono audio, +or lower frequencies. + +To play MIDI files via Timidity, you'll need to get a complete set of GUS patches +from: +http://www.libsdl.org/projects/mixer/timidity/timidity.tar.gz +and unpack them in /usr/local/lib under UNIX, and C:\ under Win32. + +This library is under the zlib license, see the file "COPYING.txt" for details. + + + diff --git a/libs/SDLMixerX/SDL2_mixer_ext.License.txt b/libs/SDLMixerX/SDL2_mixer_ext.License.txt new file mode 100644 index 000000000..58806358d --- /dev/null +++ b/libs/SDLMixerX/SDL2_mixer_ext.License.txt @@ -0,0 +1,104 @@ +======================================================================== +SDL_mixer_ext {aka SDL Mixer X, SDL Mixer 2.0 Modded}, by Vitaly Novichkov +forked from SDL Mixer 2.0 by Sam Lantinga +======================================================================== + +SDL_mixer_ext: An extended audio mixer library, forked from SDL_mixer +Copyright (C) 2014-2018 Vitaly Novichkov + +SDL_mixer: An audio mixer library based on the SDL library +Copyright (C) 1997-2018 Sam Lantinga + +Sources of modified library version is available on GitHub: +https://github.com/WohlSoft/SDL-Mixer-X + +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. + +======================================================================== +Statically linked libraries: +======================================================================== +------------------------------------------------------------------------ +libADLMIDI: is a free MIDI to WAV conversion library with OPL3 emulation + +Original ADLMIDI code: Copyright (c) 2010-2014 Joel Yliluoma +ADLMIDI Library API: Copyright (c) 2015-2018 Vitaly Novichkov + +Library is based on the ADLMIDI, a MIDI player for Linux and Windows +with OPL3 emulation: +http://iki.fi/bisqwit/source/adlmidi.html + +Source code: https://github.com/Wohlstand/libADLMIDI + +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 3 of the License, or +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. + +You should have received a copy of the GNU General Public License +along with this program. If not, see . + +------------------------------------------------------------------------ + +Game Music Emulators: is a free chuptunes to WAV conversion library. + +Source code: https://bitbucket.org/mpyne/game-music-emu + +Copyright (C) 2003-2006 Shay Green. + +This module is free software; you can redistribute it and/or modify +it under the terms of the GNU Lesser General Public License as published +by the Free Software Foundation; either version 2.1 of the License, +or (at your option) any later version. + +This module 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 Lesser General Public License for more details. + +You should have received a copy of the GNU Lesser General Public +License along with this module; +If not, see . + +------------------------------------------------------------------------ + +libmad: MPEG audio decoder library + +Copyright (C) 2000-2004 Underbit Technologies, Inc. + +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. + +You should have received a copy of the GNU General Public License +along with this program; if not, write to the Free Software +Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +If you would like to negotiate alternate licensing terms, you may do +so by contacting: Underbit Technologies, Inc. + +------------------------------------------------------------------------ diff --git a/libs/SDLMixerX/SRB2Note.txt b/libs/SDLMixerX/SRB2Note.txt new file mode 100644 index 000000000..6036d394e --- /dev/null +++ b/libs/SDLMixerX/SRB2Note.txt @@ -0,0 +1,7 @@ +i686-w64-mingw32/bin/libfluidsynth-2.dll was grabbed from GZDoom v3.5.1, because this build does not have glib, gthread, or sndfile external dependencies. + +sdl_mixer_ext2.dll requires libgcc and libstdc++ external dependencies. While passing to the linker "-Bstatic -lgcc" works fine, adding "-lstdc++" to -Bstatic generates linker errors. + +Hence, libstdc++ needs to be bundled as DLL (and consequently, libgcc.) + +If you try to build yourself, make sure -lstdc++ does not follow -Bdynamic in the linker flags, because otherwise it will link to the DLL. diff --git a/libs/SDLMixerX/SRB2Note_cmakeflags.png b/libs/SDLMixerX/SRB2Note_cmakeflags.png new file mode 100644 index 000000000..ffcf269a4 Binary files /dev/null and b/libs/SDLMixerX/SRB2Note_cmakeflags.png differ diff --git a/libs/SDLMixerX/i686-w64-mingw32/bin/SDL2_mixer_ext.dll b/libs/SDLMixerX/i686-w64-mingw32/bin/SDL2_mixer_ext.dll new file mode 100644 index 000000000..158aad8c3 Binary files /dev/null and b/libs/SDLMixerX/i686-w64-mingw32/bin/SDL2_mixer_ext.dll differ diff --git a/libs/SDLMixerX/i686-w64-mingw32/bin/libfluidsynth-2.dll b/libs/SDLMixerX/i686-w64-mingw32/bin/libfluidsynth-2.dll new file mode 100644 index 000000000..1b768a6c1 Binary files /dev/null and b/libs/SDLMixerX/i686-w64-mingw32/bin/libfluidsynth-2.dll differ diff --git a/libs/SDLMixerX/i686-w64-mingw32/bin/libgcc_s_sjlj-1.dll b/libs/SDLMixerX/i686-w64-mingw32/bin/libgcc_s_sjlj-1.dll new file mode 100644 index 000000000..0a62946cb Binary files /dev/null and b/libs/SDLMixerX/i686-w64-mingw32/bin/libgcc_s_sjlj-1.dll differ diff --git a/libs/SDLMixerX/i686-w64-mingw32/bin/libstdc++-6.dll b/libs/SDLMixerX/i686-w64-mingw32/bin/libstdc++-6.dll new file mode 100644 index 000000000..e9feebaaa Binary files /dev/null and b/libs/SDLMixerX/i686-w64-mingw32/bin/libstdc++-6.dll differ diff --git a/libs/SDLMixerX/i686-w64-mingw32/include/SDL2/SDL_mixer_ext.h b/libs/SDLMixerX/i686-w64-mingw32/include/SDL2/SDL_mixer_ext.h new file mode 100644 index 000000000..3a6b91b50 --- /dev/null +++ b/libs/SDLMixerX/i686-w64-mingw32/include/SDL2/SDL_mixer_ext.h @@ -0,0 +1,867 @@ +/* + SDL Mixer X: An extended audio mixer library, forked from SDL_mixer + Copyright (C) 2014-2018 Vitaly Novichkov + + SDL_mixer: An audio mixer library based on the SDL library + Copyright (C) 1997-2018 Sam Lantinga + + 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. +*/ + +#ifndef SDL_MIXER_H_ +#define SDL_MIXER_H_ + +#include "SDL_stdinc.h" +#include "SDL_rwops.h" +#include "SDL_audio.h" +#include "SDL_endian.h" +#include "SDL_version.h" +#include "begin_code.h" + +/* Let applications recogonize which SDL Mixer edition is in use: Official or Extended fork by Wohlstand */ +#define SDL_MIXER_X 1 + +#define MIXSDLCALL + +#if defined(FORCE_STDCALLS) && defined(_WIN32) +#ifdef SDLCALL +#undef SDLCALL +#endif +#define SDLCALL __stdcall +#define SDLCALLCC __stdcall +#else +#define SDLCALLCC +#endif + +#ifndef DEPRECATED +#ifdef __GNUC__ +#define DEPRECATED(func) func __attribute__ ((deprecated)) +#elif defined(_MSC_VER) +#define DEPRECATED(func) __declspec(deprecated) func +#else +#pragma message("WARNING: You need to implement DEPRECATED for this compiler") +#define DEPRECATED(func) func +#endif +#endif + +/* Set up for C function definitions, even when using C++ */ +#ifdef __cplusplus +extern "C" { +#endif + +/* Printable format: "%d.%d.%d", MAJOR, MINOR, PATCHLEVEL +*/ +#define SDL_MIXER_MAJOR_VERSION 2 +#define SDL_MIXER_MINOR_VERSION 2 +#define SDL_MIXER_PATCHLEVEL 0 + +/* This macro can be used to fill a version structure with the compile-time + * version of the SDL_mixer library. + */ +#define SDL_MIXER_VERSION(X) \ +{ \ + (X)->major = SDL_MIXER_MAJOR_VERSION; \ + (X)->minor = SDL_MIXER_MINOR_VERSION; \ + (X)->patch = SDL_MIXER_PATCHLEVEL; \ +} + +/* Backwards compatibility */ +#define MIX_MAJOR_VERSION SDL_MIXER_MAJOR_VERSION +#define MIX_MINOR_VERSION SDL_MIXER_MINOR_VERSION +#define MIX_PATCHLEVEL SDL_MIXER_PATCHLEVEL +#define MIX_VERSION(X) SDL_MIXER_VERSION(X) + +/** + * This is the version number macro for the current SDL_mixer version. + */ +#define SDL_MIXER_COMPILEDVERSION \ + SDL_VERSIONNUM(SDL_MIXER_MAJOR_VERSION, SDL_MIXER_MINOR_VERSION, SDL_MIXER_PATCHLEVEL) + +/** + * This macro will evaluate to true if compiled with SDL_mixer at least X.Y.Z. + */ +#define SDL_MIXER_VERSION_ATLEAST(X, Y, Z) \ + (SDL_MIXER_COMPILEDVERSION >= SDL_VERSIONNUM(X, Y, Z)) + +/* This function gets the version of the dynamically linked SDL_mixer library. + it should NOT be used to fill a version structure, instead you should + use the SDL_MIXER_VERSION() macro. + */ +extern DECLSPEC const SDL_version * SDLCALL Mix_Linked_Version(void); + +typedef enum +{ + MIX_INIT_FLAC = 0x00000001, + MIX_INIT_MOD = 0x00000002, + MIX_INIT_MP3 = 0x00000008, + MIX_INIT_OGG = 0x00000010, + MIX_INIT_MID = 0x00000020, + MIX_INIT_OPUS = 0x00000040 +} MIX_InitFlags; + +/* Loads dynamic libraries and prepares them for use. Flags should be + one or more flags from MIX_InitFlags OR'd together. + It returns the flags successfully initialized, or 0 on failure. + */ +extern DECLSPEC int SDLCALL Mix_Init(int flags); + +/* Unloads libraries loaded with Mix_Init */ +extern DECLSPEC void SDLCALL Mix_Quit(void); + + +/* The default mixer has 8 simultaneous mixing channels */ +#ifndef MIX_CHANNELS +#define MIX_CHANNELS 8 +#endif + +/* Good default values for a PC soundcard */ +#define MIX_DEFAULT_FREQUENCY 44100 +#if SDL_BYTEORDER == SDL_LIL_ENDIAN +#define MIX_DEFAULT_FORMAT AUDIO_S16LSB +#else +#define MIX_DEFAULT_FORMAT AUDIO_S16MSB +#endif +#define MIX_DEFAULT_CHANNELS 2 +#define MIX_MAX_VOLUME SDL_MIX_MAXVOLUME /* Volume of a chunk */ + +/* The internal format for an audio chunk */ +typedef struct Mix_Chunk { + int allocated; + Uint8 *abuf; + Uint32 alen; + Uint8 volume; /* Per-sample volume, 0-128 */ +} Mix_Chunk; + +/* The different fading types supported */ +typedef enum { + MIX_NO_FADING, + MIX_FADING_OUT, + MIX_FADING_IN +} Mix_Fading; + +/* These are types of music files (not libraries used to load them) */ +typedef enum { + MUS_NONE, + MUS_CMD, + MUS_WAV, + MUS_MOD, + MUS_MID, + MUS_OGG, + MUS_MP3, + MUS_MP3_MAD_UNUSED, + MUS_FLAC, + MUS_MODPLUG_UNUSED, + MUS_OPUS, + MUS_GME, + MUS_ADLMIDI/*Use ADLMIDI coded for super-special formats like IMF, MUS or XMI are can't be played without ADLMIDI*/ +} Mix_MusicType; + +typedef enum { + MIDI_ADLMIDI, + MIDI_Native, + MIDI_Timidity, + MIDI_OPNMIDI, + MIDI_Fluidsynth, + MIDI_ANY, + MIDI_KnuwnDevices /* Count of MIDI device types */ +} Mix_MIDI_Device; + +/* Volume model type in the ADLMIDI */ +typedef enum { + ADLMIDI_VM_AUTO, + ADLMIDI_VM_GENERIC, + ADLMIDI_VM_CMF, + ADLMIDI_VM_DMX, + ADLMIDI_VM_APOGEE, + ADLMIDI_VM_9X +} Mix_ADLMIDI_VolumeModel; + +/* OPL3 chip emulators for ADLMIDI */ +typedef enum { + ADLMIDI_OPL3_EMU_DEFAULT = -1, + ADLMIDI_OPL3_EMU_NUKED = 0, + ADLMIDI_OPL3_EMU_NUKED_1_7_4, + ADLMIDI_OPL3_EMU_DOSBOX, +} Mix_ADLMIDI_Emulator; + +/* OPN2 chip emulators for OPNMIDI */ +typedef enum { + OPNMIDI_OPN2_EMU_DEFAULT = -1, + OPNMIDI_OPN2_EMU_MIME = 0, + OPNMIDI_OPN2_EMU_NUKED, + OPNMIDI_OPN2_EMU_GENS, +} Mix_OPNMIDI_Emulator; + +/* The internal format for a music chunk interpreted via mikmod */ +typedef struct _Mix_Music Mix_Music; + +/* Open the mixer with a certain audio format */ +extern DECLSPEC int SDLCALL Mix_OpenAudio(int frequency, Uint16 format, int channels, int chunksize); + +/* Open the mixer with specific device and certain audio format */ +extern DECLSPEC int SDLCALL Mix_OpenAudioDevice(int frequency, Uint16 format, int channels, int chunksize, const char* device, int allowed_changes); + +/* Dynamically change the number of channels managed by the mixer. + If decreasing the number of channels, the upper channels are + stopped. + This function returns the new number of allocated channels. + */ +extern DECLSPEC int SDLCALL Mix_AllocateChannels(int numchans); + +/* Find out what the actual audio device parameters are. + This function returns 1 if the audio has been opened, 0 otherwise. + */ +extern DECLSPEC int SDLCALL Mix_QuerySpec(int *frequency,Uint16 *format,int *channels); + +/* Load a wave file or a music (.mod .s3m .it .xm) file + IMPORTANT: To choice a track number of NSF, GBM, HES, etc file, + you must append "|xxx" to end of file path for + Mix_LoadMUS function. + Where xxx - actual number of chip track, (from 0 to N-1) + Examples: "file.nsf|12", "file.hes|2" +*/ +extern DECLSPEC Mix_Chunk * SDLCALL Mix_LoadWAV_RW(SDL_RWops *src, int freesrc); +#define Mix_LoadWAV(file) Mix_LoadWAV_RW(SDL_RWFromFile(file, "rb"), 1) +extern DECLSPEC Mix_Music * SDLCALL Mix_LoadMUS(const char *file); + +/* Load a music file from an SDL_RWop object + * Matt Campbell (matt@campbellhome.dhs.org) April 2000 */ +extern DECLSPEC Mix_Music * SDLCALL Mix_LoadMUS_RW(SDL_RWops *src, int freesrc); + +/* Load a music file from an SDL_RWop object with custom arguments (trackID for GME or settings for a MIDI playing) + * Arguments are taking no effect for file formats which are not supports extra arguments. + */ +extern DECLSPEC Mix_Music *SDLCALL Mix_LoadMUS_RW_ARG(SDL_RWops *src, int freesrc, const char *args); + +/* Load a music file from an SDL_RWop object with custom trackID for GME. + * trackID argument takes no effect for non-NSF,HES,GBM,etc. file formats. + * Default value should be 0 + */ +extern DECLSPEC Mix_Music *SDLCALL Mix_LoadMUS_RW_GME(SDL_RWops *src, int freesrc, int trackID); + +/* Load a music file from an SDL_RWop object assuming a specific format */ +extern DECLSPEC Mix_Music * SDLCALL Mix_LoadMUSType_RW(SDL_RWops *src, Mix_MusicType type, int freesrc); + +/* Load a music file from an SDL_RWop object assuming a specific format + with custom arguments (trackID for GME or settings for a MIDI playing) */ +extern DECLSPEC Mix_Music * SDLCALL Mix_LoadMUSType_RW_ARG(SDL_RWops *src, Mix_MusicType type, int freesrc, const char *args); + +/* Load a wave file of the mixer format from a memory buffer */ +extern DECLSPEC Mix_Chunk * SDLCALL Mix_QuickLoad_WAV(Uint8 *mem); + +/* Load raw audio data of the mixer format from a memory buffer */ +extern DECLSPEC Mix_Chunk * SDLCALL Mix_QuickLoad_RAW(Uint8 *mem, Uint32 len); + +/* Free an audio chunk previously loaded */ +extern DECLSPEC void SDLCALL Mix_FreeChunk(Mix_Chunk *chunk); +extern DECLSPEC void SDLCALL Mix_FreeMusic(Mix_Music *music); + +/* Get a list of chunk/music decoders that this build of SDL_mixer provides. + This list can change between builds AND runs of the program, if external + libraries that add functionality become available. + You must successfully call Mix_OpenAudio() before calling these functions. + This API is only available in SDL_mixer 1.2.9 and later. + + // usage... + int i; + const int total = Mix_GetNumChunkDecoders(); + for (i = 0; i < total; i++) + printf("Supported chunk decoder: [%s]\n", Mix_GetChunkDecoder(i)); + + Appearing in this list doesn't promise your specific audio file will + decode...but it's handy to know if you have, say, a functioning Timidity + install. + + These return values are static, read-only data; do not modify or free it. + The pointers remain valid until you call Mix_CloseAudio(). +*/ +extern DECLSPEC int SDLCALL Mix_GetNumChunkDecoders(void); +extern DECLSPEC const char * SDLCALL Mix_GetChunkDecoder(int index); +extern DECLSPEC SDL_bool SDLCALL Mix_HasChunkDecoder(const char *name); +extern DECLSPEC int SDLCALL Mix_GetNumMusicDecoders(void); +extern DECLSPEC const char * SDLCALL Mix_GetMusicDecoder(int index); +extern DECLSPEC SDL_bool SDLCALL Mix_HasMusicDecoder(const char *name); + +/* Find out the music format of a mixer music, or the currently playing + music, if 'music' is NULL. +*/ +extern DECLSPEC Mix_MusicType SDLCALL Mix_GetMusicType(const Mix_Music *music); + +/* Get music title from meta-tag if possible. If title tag is empty, filename will be returned */ +extern DECLSPEC const char *SDLCALL Mix_GetMusicTitle(const Mix_Music *music); +/* Get music title from meta-tag if possible */ +extern DECLSPEC const char *SDLCALL Mix_GetMusicTitleTag(const Mix_Music *music); +/* Get music artist from meta-tag if possible */ +extern DECLSPEC const char *SDLCALL Mix_GetMusicArtistTag(const Mix_Music *music); +/* Get music album from meta-tag if possible */ +extern DECLSPEC const char *SDLCALL Mix_GetMusicAlbumTag(const Mix_Music *music); +/* Get music copyright from meta-tag if possible */ +extern DECLSPEC const char *SDLCALL Mix_GetMusicCopyrightTag(const Mix_Music *music); + +/* Set a function that is called after all mixing is performed. + This can be used to provide real-time visual display of the audio stream + or add a custom mixer filter for the stream data. +*/ +extern DECLSPEC void SDLCALL Mix_SetPostMix(void (SDLCALL *mix_func)(void *udata, Uint8 *stream, int len), void *arg); + +/* Add your own music player or additional mixer function. + If 'mix_func' is NULL, the default music player is re-enabled. + */ +extern DECLSPEC void SDLCALL Mix_HookMusic(void (SDLCALL *mix_func)(void *udata, Uint8 *stream, int len), void *arg); + +/* Add your own callback for when the music has finished playing or when it is + * stopped from a call to Mix_HaltMusic. + */ +extern DECLSPEC void SDLCALL Mix_HookMusicFinished(void (SDLCALL *music_finished)(void)); + +/* Get a pointer to the user data for the current music hook */ +extern DECLSPEC void * SDLCALL Mix_GetMusicHookData(void); + +/* + * Add your own callback when a channel has finished playing. NULL + * to disable callback. The callback may be called from the mixer's audio + * callback or it could be called as a result of Mix_HaltChannel(), etc. + * do not call SDL_LockAudio() from this callback; you will either be + * inside the audio callback, or SDL_mixer will explicitly lock the audio + * before calling your callback. + */ +extern DECLSPEC void SDLCALL Mix_ChannelFinished(void (SDLCALL *channel_finished)(int channel)); + + +/* Special Effects API by ryan c. gordon. (icculus@icculus.org) */ + +#define MIX_CHANNEL_POST -2 + +/* This is the format of a special effect callback: + * + * myeffect(int chan, void *stream, int len, void *udata); + * + * (chan) is the channel number that your effect is affecting. (stream) is + * the buffer of data to work upon. (len) is the size of (stream), and + * (udata) is a user-defined bit of data, which you pass as the last arg of + * Mix_RegisterEffect(), and is passed back unmolested to your callback. + * Your effect changes the contents of (stream) based on whatever parameters + * are significant, or just leaves it be, if you prefer. You can do whatever + * you like to the buffer, though, and it will continue in its changed state + * down the mixing pipeline, through any other effect functions, then finally + * to be mixed with the rest of the channels and music for the final output + * stream. + * + * DO NOT EVER call SDL_LockAudio() from your callback function! + */ +typedef void (SDLCALL *Mix_EffectFunc_t)(int chan, void *stream, int len, void *udata); + +/* + * This is a callback that signifies that a channel has finished all its + * loops and has completed playback. This gets called if the buffer + * plays out normally, or if you call Mix_HaltChannel(), implicitly stop + * a channel via Mix_AllocateChannels(), or unregister a callback while + * it's still playing. + * + * DO NOT EVER call SDL_LockAudio() from your callback function! + */ +typedef void (SDLCALL *Mix_EffectDone_t)(int chan, void *udata); + + +/* Register a special effect function. At mixing time, the channel data is + * copied into a buffer and passed through each registered effect function. + * After it passes through all the functions, it is mixed into the final + * output stream. The copy to buffer is performed once, then each effect + * function performs on the output of the previous effect. Understand that + * this extra copy to a buffer is not performed if there are no effects + * registered for a given chunk, which saves CPU cycles, and any given + * effect will be extra cycles, too, so it is crucial that your code run + * fast. Also note that the data that your function is given is in the + * format of the sound device, and not the format you gave to Mix_OpenAudio(), + * although they may in reality be the same. This is an unfortunate but + * necessary speed concern. Use Mix_QuerySpec() to determine if you can + * handle the data before you register your effect, and take appropriate + * actions. + * You may also specify a callback (Mix_EffectDone_t) that is called when + * the channel finishes playing. This gives you a more fine-grained control + * than Mix_ChannelFinished(), in case you need to free effect-specific + * resources, etc. If you don't need this, you can specify NULL. + * You may set the callbacks before or after calling Mix_PlayChannel(). + * Things like Mix_SetPanning() are just internal special effect functions, + * so if you are using that, you've already incurred the overhead of a copy + * to a separate buffer, and that these effects will be in the queue with + * any functions you've registered. The list of registered effects for a + * channel is reset when a chunk finishes playing, so you need to explicitly + * set them with each call to Mix_PlayChannel*(). + * You may also register a special effect function that is to be run after + * final mixing occurs. The rules for these callbacks are identical to those + * in Mix_RegisterEffect, but they are run after all the channels and the + * music have been mixed into a single stream, whereas channel-specific + * effects run on a given channel before any other mixing occurs. These + * global effect callbacks are call "posteffects". Posteffects only have + * their Mix_EffectDone_t function called when they are unregistered (since + * the main output stream is never "done" in the same sense as a channel). + * You must unregister them manually when you've had enough. Your callback + * will be told that the channel being mixed is (MIX_CHANNEL_POST) if the + * processing is considered a posteffect. + * + * After all these effects have finished processing, the callback registered + * through Mix_SetPostMix() runs, and then the stream goes to the audio + * device. + * + * DO NOT EVER call SDL_LockAudio() from your callback function! + * + * returns zero if error (no such channel), nonzero if added. + * Error messages can be retrieved from Mix_GetError(). + */ +extern DECLSPEC int SDLCALL Mix_RegisterEffect(int chan, Mix_EffectFunc_t f, Mix_EffectDone_t d, void *arg); + + +/* You may not need to call this explicitly, unless you need to stop an + * effect from processing in the middle of a chunk's playback. + * Posteffects are never implicitly unregistered as they are for channels, + * but they may be explicitly unregistered through this function by + * specifying MIX_CHANNEL_POST for a channel. + * returns zero if error (no such channel or effect), nonzero if removed. + * Error messages can be retrieved from Mix_GetError(). + */ +extern DECLSPEC int SDLCALL Mix_UnregisterEffect(int channel, Mix_EffectFunc_t f); + + +/* You may not need to call this explicitly, unless you need to stop all + * effects from processing in the middle of a chunk's playback. Note that + * this will also shut off some internal effect processing, since + * Mix_SetPanning() and others may use this API under the hood. This is + * called internally when a channel completes playback. + * Posteffects are never implicitly unregistered as they are for channels, + * but they may be explicitly unregistered through this function by + * specifying MIX_CHANNEL_POST for a channel. + * returns zero if error (no such channel), nonzero if all effects removed. + * Error messages can be retrieved from Mix_GetError(). + */ +extern DECLSPEC int SDLCALL Mix_UnregisterAllEffects(int channel); + + +#define MIX_EFFECTSMAXSPEED "MIX_EFFECTSMAXSPEED" + +/* + * These are the internally-defined mixing effects. They use the same API that + * effects defined in the application use, but are provided here as a + * convenience. Some effects can reduce their quality or use more memory in + * the name of speed; to enable this, make sure the environment variable + * MIX_EFFECTSMAXSPEED (see above) is defined before you call + * Mix_OpenAudio(). + */ + + +/* Set the panning of a channel. The left and right channels are specified + * as integers between 0 and 255, quietest to loudest, respectively. + * + * Technically, this is just individual volume control for a sample with + * two (stereo) channels, so it can be used for more than just panning. + * If you want real panning, call it like this: + * + * Mix_SetPanning(channel, left, 255 - left); + * + * ...which isn't so hard. + * + * Setting (channel) to MIX_CHANNEL_POST registers this as a posteffect, and + * the panning will be done to the final mixed stream before passing it on + * to the audio device. + * + * This uses the Mix_RegisterEffect() API internally, and returns without + * registering the effect function if the audio device is not configured + * for stereo output. Setting both (left) and (right) to 255 causes this + * effect to be unregistered, since that is the data's normal state. + * + * returns zero if error (no such channel or Mix_RegisterEffect() fails), + * nonzero if panning effect enabled. Note that an audio device in mono + * mode is a no-op, but this call will return successful in that case. + * Error messages can be retrieved from Mix_GetError(). + */ +extern DECLSPEC int SDLCALL Mix_SetPanning(int channel, Uint8 left, Uint8 right); + + +/* Set the position of a channel. (angle) is an integer from 0 to 360, that + * specifies the location of the sound in relation to the listener. (angle) + * will be reduced as neccesary (540 becomes 180 degrees, -100 becomes 260). + * Angle 0 is due north, and rotates clockwise as the value increases. + * For efficiency, the precision of this effect may be limited (angles 1 + * through 7 might all produce the same effect, 8 through 15 are equal, etc). + * (distance) is an integer between 0 and 255 that specifies the space + * between the sound and the listener. The larger the number, the further + * away the sound is. Using 255 does not guarantee that the channel will be + * culled from the mixing process or be completely silent. For efficiency, + * the precision of this effect may be limited (distance 0 through 5 might + * all produce the same effect, 6 through 10 are equal, etc). Setting (angle) + * and (distance) to 0 unregisters this effect, since the data would be + * unchanged. + * + * If you need more precise positional audio, consider using OpenAL for + * spatialized effects instead of SDL_mixer. This is only meant to be a + * basic effect for simple "3D" games. + * + * If the audio device is configured for mono output, then you won't get + * any effectiveness from the angle; however, distance attenuation on the + * channel will still occur. While this effect will function with stereo + * voices, it makes more sense to use voices with only one channel of sound, + * so when they are mixed through this effect, the positioning will sound + * correct. You can convert them to mono through SDL before giving them to + * the mixer in the first place if you like. + * + * Setting (channel) to MIX_CHANNEL_POST registers this as a posteffect, and + * the positioning will be done to the final mixed stream before passing it + * on to the audio device. + * + * This is a convenience wrapper over Mix_SetDistance() and Mix_SetPanning(). + * + * returns zero if error (no such channel or Mix_RegisterEffect() fails), + * nonzero if position effect is enabled. + * Error messages can be retrieved from Mix_GetError(). + */ +extern DECLSPEC int SDLCALL Mix_SetPosition(int channel, Sint16 angle, Uint8 distance); + + +/* Set the "distance" of a channel. (distance) is an integer from 0 to 255 + * that specifies the location of the sound in relation to the listener. + * Distance 0 is overlapping the listener, and 255 is as far away as possible + * A distance of 255 does not guarantee silence; in such a case, you might + * want to try changing the chunk's volume, or just cull the sample from the + * mixing process with Mix_HaltChannel(). + * For efficiency, the precision of this effect may be limited (distances 1 + * through 7 might all produce the same effect, 8 through 15 are equal, etc). + * (distance) is an integer between 0 and 255 that specifies the space + * between the sound and the listener. The larger the number, the further + * away the sound is. + * Setting (distance) to 0 unregisters this effect, since the data would be + * unchanged. + * If you need more precise positional audio, consider using OpenAL for + * spatialized effects instead of SDL_mixer. This is only meant to be a + * basic effect for simple "3D" games. + * + * Setting (channel) to MIX_CHANNEL_POST registers this as a posteffect, and + * the distance attenuation will be done to the final mixed stream before + * passing it on to the audio device. + * + * This uses the Mix_RegisterEffect() API internally. + * + * returns zero if error (no such channel or Mix_RegisterEffect() fails), + * nonzero if position effect is enabled. + * Error messages can be retrieved from Mix_GetError(). + */ +extern DECLSPEC int SDLCALL Mix_SetDistance(int channel, Uint8 distance); + + +/* + * !!! FIXME : Haven't implemented, since the effect goes past the + * end of the sound buffer. Will have to think about this. + * --ryan. + */ +#if 0 +/* Causes an echo effect to be mixed into a sound. (echo) is the amount + * of echo to mix. 0 is no echo, 255 is infinite (and probably not + * what you want). + * + * Setting (channel) to MIX_CHANNEL_POST registers this as a posteffect, and + * the reverbing will be done to the final mixed stream before passing it on + * to the audio device. + * + * This uses the Mix_RegisterEffect() API internally. If you specify an echo + * of zero, the effect is unregistered, as the data is already in that state. + * + * returns zero if error (no such channel or Mix_RegisterEffect() fails), + * nonzero if reversing effect is enabled. + * Error messages can be retrieved from Mix_GetError(). + */ +extern no_parse_DECLSPEC int SDLCALL Mix_SetReverb(int channel, Uint8 echo); +#endif + +/* Causes a channel to reverse its stereo. This is handy if the user has his + * speakers hooked up backwards, or you would like to have a minor bit of + * psychedelia in your sound code. :) Calling this function with (flip) + * set to non-zero reverses the chunks's usual channels. If (flip) is zero, + * the effect is unregistered. + * + * This uses the Mix_RegisterEffect() API internally, and thus is probably + * more CPU intensive than having the user just plug in his speakers + * correctly. Mix_SetReverseStereo() returns without registering the effect + * function if the audio device is not configured for stereo output. + * + * If you specify MIX_CHANNEL_POST for (channel), then this the effect is used + * on the final mixed stream before sending it on to the audio device (a + * posteffect). + * + * returns zero if error (no such channel or Mix_RegisterEffect() fails), + * nonzero if reversing effect is enabled. Note that an audio device in mono + * mode is a no-op, but this call will return successful in that case. + * Error messages can be retrieved from Mix_GetError(). + */ +extern DECLSPEC int SDLCALL Mix_SetReverseStereo(int channel, int flip); + +/* end of effects API. --ryan. */ + + +/* Reserve the first channels (0 -> n-1) for the application, i.e. don't allocate + them dynamically to the next sample if requested with a -1 value below. + Returns the number of reserved channels. + */ +extern DECLSPEC int SDLCALL Mix_ReserveChannels(int num); + +/* Channel grouping functions */ + +/* Attach a tag to a channel. A tag can be assigned to several mixer + channels, to form groups of channels. + If 'tag' is -1, the tag is removed (actually -1 is the tag used to + represent the group of all the channels). + Returns true if everything was OK. + */ +extern DECLSPEC int SDLCALL Mix_GroupChannel(int which, int tag); +/* Assign several consecutive channels to a group */ +extern DECLSPEC int SDLCALL Mix_GroupChannels(int from, int to, int tag); +/* Finds the first available channel in a group of channels, + returning -1 if none are available. + */ +extern DECLSPEC int SDLCALL Mix_GroupAvailable(int tag); +/* Returns the number of channels in a group. This is also a subtle + way to get the total number of channels when 'tag' is -1 + */ +extern DECLSPEC int SDLCALL Mix_GroupCount(int tag); +/* Finds the "oldest" sample playing in a group of channels */ +extern DECLSPEC int SDLCALL Mix_GroupOldest(int tag); +/* Finds the "most recent" (i.e. last) sample playing in a group of channels */ +extern DECLSPEC int SDLCALL Mix_GroupNewer(int tag); + +/* Play an audio chunk on a specific channel. + If the specified channel is -1, play on the first free channel. + If 'loops' is greater than zero, loop the sound that many times. + If 'loops' is -1, loop inifinitely (~65000 times). + Returns which channel was used to play the sound. +*/ +#define Mix_PlayChannel(channel,chunk,loops) Mix_PlayChannelTimed(channel,chunk,loops,-1) +/* The same as above, but the sound is played at most 'ticks' milliseconds */ +extern DECLSPEC int SDLCALL Mix_PlayChannelTimed(int channel, Mix_Chunk *chunk, int loops, int ticks); +extern DECLSPEC int SDLCALL Mix_PlayMusic(Mix_Music *music, int loops); +#define Mix_PlayChannelVol(channel,chunk,loops,vol) Mix_PlayChannelTimedVolume(channel,chunk,loops,-1,vol)/*MIXER-X*/ +extern DECLSPEC int SDLCALL Mix_PlayChannelTimedVolume(int which, Mix_Chunk *chunk, int loops, int ticks, int volume);/*MIXER-X*/ + +/* Fade in music or a channel over "ms" milliseconds, same semantics as the "Play" functions */ +extern DECLSPEC int SDLCALL Mix_FadeInMusic(Mix_Music *music, int loops, int ms); +extern DECLSPEC int SDLCALL Mix_FadeInMusicPos(Mix_Music *music, int loops, int ms, double position); +#define Mix_FadeInChannel(channel,chunk,loops,ms) Mix_FadeInChannelTimed(channel,chunk,loops,ms,-1) +extern DECLSPEC int SDLCALL Mix_FadeInChannelTimed(int channel, Mix_Chunk *chunk, int loops, int ms, int ticks); +#define Mix_FadeInChannelVolume(channel,chunk,loops,ms,vol) Mix_FadeInChannelTimed(channel,chunk,loops,ms,-1,vol)/*MIXER-X*/ +extern DECLSPEC int SDLCALL Mix_FadeInChannelTimedVolume(int which, Mix_Chunk *chunk, int loops, int ms, int ticks, int volume);/*MIXER-X*/ + + +/* Set the volume in the range of 0-128 of a specific channel or chunk. + If the specified channel is -1, set volume for all channels. + Returns the original volume. + If the specified volume is -1, just return the current volume. +*/ +extern DECLSPEC int SDLCALL Mix_Volume(int channel, int volume); +extern DECLSPEC int SDLCALL Mix_VolumeChunk(Mix_Chunk *chunk, int volume); +extern DECLSPEC int SDLCALL Mix_VolumeMusic(int volume); + +/* Halt playing of a particular channel */ +extern DECLSPEC int SDLCALL Mix_HaltChannel(int channel); +extern DECLSPEC int SDLCALL Mix_HaltGroup(int tag); +extern DECLSPEC int SDLCALL Mix_HaltMusic(void); + +/* Change the expiration delay for a particular channel. + The sample will stop playing after the 'ticks' milliseconds have elapsed, + or remove the expiration if 'ticks' is -1 +*/ +extern DECLSPEC int SDLCALL Mix_ExpireChannel(int channel, int ticks); + +/* Halt a channel, fading it out progressively till it's silent + The ms parameter indicates the number of milliseconds the fading + will take. + */ +extern DECLSPEC int SDLCALL Mix_FadeOutChannel(int which, int ms); +extern DECLSPEC int SDLCALL Mix_FadeOutGroup(int tag, int ms); +extern DECLSPEC int SDLCALL Mix_FadeOutMusic(int ms); + +/* Query the fading status of a channel */ +extern DECLSPEC Mix_Fading SDLCALL Mix_FadingMusic(void); +extern DECLSPEC Mix_Fading SDLCALL Mix_FadingChannel(int which); + +/* Pause/Resume a particular channel */ +extern DECLSPEC void SDLCALL Mix_Pause(int channel); +extern DECLSPEC void SDLCALL Mix_Resume(int channel); +extern DECLSPEC int SDLCALL Mix_Paused(int channel); + +/* Pause/Resume the music stream */ +extern DECLSPEC void SDLCALL Mix_PauseMusic(void); +extern DECLSPEC void SDLCALL Mix_ResumeMusic(void); +extern DECLSPEC void SDLCALL Mix_RewindMusic(void); +extern DECLSPEC int SDLCALL Mix_PausedMusic(void); + +/* Set the current position in the music stream. + This returns 0 if successful, or -1 if it failed or isn't implemented. + This function is only implemented for MOD music formats (set pattern + order number) and for WAV, OGG, FLAC, MP3_MAD, MP3_MPG, and MODPLUG music + (set position in seconds), at the moment. +*/ +extern DECLSPEC int SDLCALL Mix_SetMusicPosition(double position); +/* + Get the time current position of music stream + returns -1.0 if this feature is not supported for some codec + */ +extern DECLSPEC double SDLCALL Mix_GetMusicPosition(Mix_Music *music); +/* + Get the total time length of music stream + returns -1.0 if this feature is not supported for some codec + */ +extern DECLSPEC double SDLCALL Mix_GetMusicTotalTime(Mix_Music *music); + +/* + Get the loop start time position of music stream + returns -1.0 if this feature is not used for this music or not supported for some codec + */ +extern DECLSPEC double SDLCALL Mix_GetMusicLoopStartTime(Mix_Music *music); +/* + Get the loop end time position of music stream + returns -1.0 if this feature is not used for this music or not supported for some codec + */ +extern DECLSPEC double SDLCALL Mix_GetMusicLoopEndTime(Mix_Music *music); +/* + Get the loop time length of music stream + returns -1.0 if this feature is not used for this music or not supported for some codec + */ +extern DECLSPEC double SDLCALL Mix_GetMusicLoopLengthTime(Mix_Music *music); + + +/* Check the status of a specific channel. + If the specified channel is -1, check all channels. +*/ +extern DECLSPEC int SDLCALL Mix_Playing(int channel); +extern DECLSPEC int SDLCALL Mix_PlayingMusic(void); + +/* Stop music and set external music playback command */ +extern DECLSPEC int SDLCALL Mix_SetMusicCMD(const char *command); + +/* Synchro value is set by MikMod from modules while playing */ +extern DECLSPEC int SDLCALL Mix_SetSynchroValue(int value); +extern DECLSPEC int SDLCALL Mix_GetSynchroValue(void); + +/* Set/Get/Iterate SoundFonts paths to use by supported MIDI backends */ +extern DECLSPEC int SDLCALL Mix_SetSoundFonts(const char *paths); +extern DECLSPEC const char* SDLCALL Mix_GetSoundFonts(void); +extern DECLSPEC int SDLCALL Mix_EachSoundFont(int (SDLCALL *function)(const char*, void*), void *data); + +/* Get the Mix_Chunk currently associated with a mixer channel + Returns NULL if it's an invalid channel, or there's no chunk associated. +*/ +extern DECLSPEC Mix_Chunk * SDLCALL Mix_GetChunk(int channel); + +/* Close the mixer, halting all playing audio */ +extern DECLSPEC void SDLCALL Mix_CloseAudio(void); + +/* Add additional Timidity bank path */ +extern DECLSPEC void SDLCALL Mix_Timidity_addToPathList(const char *path); + +/* ADLMIDI Setup functions */ +/* Get count of available hardcoded banks */ +extern DECLSPEC int SDLCALL Mix_ADLMIDI_getTotalBanks(void); +/* Get array of the bank names */ +extern DECLSPEC const char *const *SDLCALL Mix_ADLMIDI_getBankNames(void); +/* Get bank ID */ +extern DECLSPEC int SDLCALL Mix_ADLMIDI_getBankID(void); +/* Set bank ID (Applying on stop/play) */ +extern DECLSPEC void SDLCALL Mix_ADLMIDI_setBankID(int bnk); +/* Get state of deep vibrato */ +extern DECLSPEC int SDLCALL Mix_ADLMIDI_getTremolo(void); +/* Set deep tremolo mode (0 off, 1 on) (Applying on stop/play) */ +extern DECLSPEC void SDLCALL Mix_ADLMIDI_setTremolo(int tr); +/* Get state of deep vibrato */ +extern DECLSPEC int SDLCALL Mix_ADLMIDI_getVibrato(void); +/* Set deep vibrato mode (0 off, 1 on) (Applying on stop/play) */ +extern DECLSPEC void SDLCALL Mix_ADLMIDI_setVibrato(int vib); +/* Get state of scalable modulation mode */ +extern DECLSPEC int SDLCALL Mix_ADLMIDI_getScaleMod(void); +/* Set scalable modulation mode (0 off, 1 on) (Applying on stop/play) */ +extern DECLSPEC void SDLCALL Mix_ADLMIDI_setScaleMod(int sc); +/* Get state of adlib drums mode */ +extern DECLSPEC int SDLCALL Mix_ADLMIDI_getAdLibMode(void); +/* Set adlib drums mode mode (0 off, 1 on) (Applying on stop/play) */ +extern DECLSPEC void SDLCALL Mix_ADLMIDI_setAdLibMode(int tr); +/* Get state of logarithmic mode */ +extern DECLSPEC int SDLCALL Mix_ADLMIDI_getLogarithmicVolumes(void); +/* Set logarithmic volumes mode in the generic/CMF volume models (0 off, 1 on) (Applying on stop/play) */ +extern DECLSPEC void SDLCALL Mix_ADLMIDI_setLogarithmicVolumes(int lv); +/* Get current volume model ID */ +extern DECLSPEC int SDLCALL Mix_ADLMIDI_getVolumeModel(void); +/* Change current volumes model (Applying on stop/play) */ +extern DECLSPEC void SDLCALL Mix_ADLMIDI_setVolumeModel(int vm); +/* Get full range mode for CC74-Brightness controller */ +extern DECLSPEC int SDLCALL Mix_ADLMIDI_getFullRangeBrightness(void); +/* Set full range mode for CC74-Brightness controller */ +extern DECLSPEC void SDLCALL Mix_ADLMIDI_setFullRangeBrightness(int frb); +/* Get the current OPL3 Emulator for ADLMIDI */ +extern DECLSPEC int SDLCALL Mix_ADLMIDI_getEmulator(void); +/* Select the OPL3 Emulator for ADLMIDI */ +extern DECLSPEC void SDLCALL Mix_ADLMIDI_setEmulator(int emu); +/* Reset all ADLMIDI properties to default state */ +extern DECLSPEC void SDLCALL Mix_ADLMIDI_setSetDefaults(void); + +/* Sets WOPL bank file for ADLMIDI playing device, affects on MIDI file reopen */ +extern DECLSPEC void SDLCALL Mix_ADLMIDI_setCustomBankFile(const char *bank_wonl_path); + +/* Reset all OPNMIDI properties to default state */ +extern DECLSPEC void SDLCALL Mix_OPNMIDI_setSetDefaults(void); +/* Get full range mode for CC74-Brightness controller */ +extern DECLSPEC int SDLCALL Mix_OPNMIDI_getFullRangeBrightness(void); +/* Set full range mode for CC74-Brightness controller */ +extern DECLSPEC void SDLCALL Mix_OPNMIDI_setFullRangeBrightness(int frb); +/* Get the OPN2 Emulator for OPNMIDI */ +extern DECLSPEC int SDLCALL Mix_OPNMIDI_getEmulator(void); +/* Select the OPN2 Emulator for OPNMIDI */ +extern DECLSPEC void SDLCALL Mix_OPNMIDI_setEmulator(int emu); +/* Sets WOPN bank file for OPNMIDI playing device, affects on MIDI file reopen */ +extern DECLSPEC void SDLCALL Mix_OPNMIDI_setCustomBankFile(const char *bank_wonp_path); + +/* Get type of MIDI player library currently in use */ +extern DECLSPEC int SDLCALL Mix_GetMidiPlayer(void); + +/* Get type of MIDI player library prepared for next opening of MIDI file */ +extern DECLSPEC int SDLCALL Mix_GetNextMidiPlayer(void); + +/* Set the MIDI playing library (ADLMIDI, Timidity, Native MIDI (if available) and FluidSynth) */ +extern DECLSPEC int SDLCALL Mix_SetMidiPlayer(int player); + +/* Disables support of MIDI file arguments */ +extern DECLSPEC void SDLCALL Mix_SetLockMIDIArgs(int lock_midiargs); + +/* DEPRECATED NAMES for new-added SDL Mixer X functions + Those names are made with mistake - beginning with "MIX_" than "Mix_" + which makes confusion when you looking for Mix_ function in your IDE + because some applications are still use them, to don't break ABI we will keep those + aliases until we will remove all usages of them from applications and libraries are used them +*/ +DEPRECATED(extern DECLSPEC int SDLCALL Mix_GetMidiDevice(void)); +DEPRECATED(extern DECLSPEC int SDLCALL Mix_GetNextMidiDevice(void)); +DEPRECATED(extern DECLSPEC int SDLCALL Mix_SetMidiDevice(int player)); + +/* We'll use SDL for reporting errors */ +#define Mix_SetError SDL_SetError +#define Mix_GetError SDL_GetError +#define Mix_ClearError SDL_ClearError + +/* Ends C function definitions when using C++ */ +#ifdef __cplusplus +} +#endif +#include "close_code.h" + +#endif /* SDL_MIXER_H_ */ + +/* vi: set ts=4 sw=4 expandtab: */ diff --git a/libs/SDLMixerX/i686-w64-mingw32/include/SDL2/begin_code.h b/libs/SDLMixerX/i686-w64-mingw32/include/SDL2/begin_code.h new file mode 100644 index 000000000..6c2106246 --- /dev/null +++ b/libs/SDLMixerX/i686-w64-mingw32/include/SDL2/begin_code.h @@ -0,0 +1,167 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2018 Sam Lantinga + + 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. +*/ + +/** + * \file begin_code.h + * + * This file sets things up for C dynamic library function definitions, + * static inlined functions, and structures aligned at 4-byte alignment. + * If you don't like ugly C preprocessor code, don't look at this file. :) + */ + +/* This shouldn't be nested -- included it around code only. */ +#ifdef _begin_code_h +#error Nested inclusion of begin_code.h +#endif +#define _begin_code_h + +#ifndef SDL_DEPRECATED +# if (__GNUC__ >= 4) /* technically, this arrived in gcc 3.1, but oh well. */ +# define SDL_DEPRECATED __attribute__((deprecated)) +# else +# define SDL_DEPRECATED +# endif +#endif + +#ifndef SDL_UNUSED +# ifdef __GNUC__ +# define SDL_UNUSED __attribute__((unused)) +# else +# define SDL_UNUSED +# endif +#endif + +/* Some compilers use a special export keyword */ +#ifndef DECLSPEC +# if defined(__WIN32__) || defined(__WINRT__) +# ifdef __BORLANDC__ +# ifdef BUILD_SDL +# define DECLSPEC +# else +# define DECLSPEC __declspec(dllimport) +# endif +# else +# define DECLSPEC __declspec(dllexport) +# endif +# elif defined(__OS2__) +# ifdef BUILD_SDL +# define DECLSPEC __declspec(dllexport) +# else +# define DECLSPEC +# endif +# else +# if defined(__GNUC__) && __GNUC__ >= 4 +# define DECLSPEC __attribute__ ((visibility("default"))) +# else +# define DECLSPEC +# endif +# endif +#endif + +/* By default SDL uses the C calling convention */ +#ifndef SDLCALL +#if (defined(__WIN32__) || defined(__WINRT__)) && !defined(__GNUC__) +#define SDLCALL __cdecl +#elif defined(__OS2__) || defined(__EMX__) +#define SDLCALL _System +# if defined (__GNUC__) && !defined(_System) +# define _System /* for old EMX/GCC compat. */ +# endif +#else +#define SDLCALL +#endif +#endif /* SDLCALL */ + +/* Removed DECLSPEC on Symbian OS because SDL cannot be a DLL in EPOC */ +#ifdef __SYMBIAN32__ +#undef DECLSPEC +#define DECLSPEC +#endif /* __SYMBIAN32__ */ + +/* Force structure packing at 4 byte alignment. + This is necessary if the header is included in code which has structure + packing set to an alternate value, say for loading structures from disk. + The packing is reset to the previous value in close_code.h + */ +#if defined(_MSC_VER) || defined(__MWERKS__) || defined(__BORLANDC__) +#ifdef _MSC_VER +#pragma warning(disable: 4103) +#endif +#ifdef __BORLANDC__ +#pragma nopackwarning +#endif +#ifdef _M_X64 +/* Use 8-byte alignment on 64-bit architectures, so pointers are aligned */ +#pragma pack(push,8) +#else +#pragma pack(push,4) +#endif +#endif /* Compiler needs structure packing set */ + +#ifndef SDL_INLINE +#if defined(__GNUC__) +#define SDL_INLINE __inline__ +#elif defined(_MSC_VER) || defined(__BORLANDC__) || \ + defined(__DMC__) || defined(__SC__) || \ + defined(__WATCOMC__) || defined(__LCC__) || \ + defined(__DECC) || defined(__CC_ARM) +#define SDL_INLINE __inline +#ifndef __inline__ +#define __inline__ __inline +#endif +#else +#define SDL_INLINE inline +#ifndef __inline__ +#define __inline__ inline +#endif +#endif +#endif /* SDL_INLINE not defined */ + +#ifndef SDL_FORCE_INLINE +#if defined(_MSC_VER) +#define SDL_FORCE_INLINE __forceinline +#elif ( (defined(__GNUC__) && (__GNUC__ >= 4)) || defined(__clang__) ) +#define SDL_FORCE_INLINE __attribute__((always_inline)) static __inline__ +#else +#define SDL_FORCE_INLINE static SDL_INLINE +#endif +#endif /* SDL_FORCE_INLINE not defined */ + +#ifndef SDL_NORETURN +#if defined(__GNUC__) +#define SDL_NORETURN __attribute__((noreturn)) +#elif defined(_MSC_VER) +#define SDL_NORETURN __declspec(noreturn) +#else +#define SDL_NORETURN +#endif +#endif /* SDL_NORETURN not defined */ + +/* Apparently this is needed by several Windows compilers */ +#if !defined(__MACH__) +#ifndef NULL +#ifdef __cplusplus +#define NULL 0 +#else +#define NULL ((void *)0) +#endif +#endif /* NULL */ +#endif /* ! Mac OS X - breaks precompiled headers */ diff --git a/libs/SDLMixerX/i686-w64-mingw32/include/SDL2/close_code.h b/libs/SDLMixerX/i686-w64-mingw32/include/SDL2/close_code.h new file mode 100644 index 000000000..b3b70a4c8 --- /dev/null +++ b/libs/SDLMixerX/i686-w64-mingw32/include/SDL2/close_code.h @@ -0,0 +1,37 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2018 Sam Lantinga + + 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. +*/ + +/** + * \file close_code.h + * + * This file reverses the effects of begin_code.h and should be included + * after you finish any function and structure declarations in your headers + */ + +#undef _begin_code_h + +/* Reset structure packing at previous byte alignment */ +#if defined(_MSC_VER) || defined(__MWERKS__) || defined(__BORLANDC__) +#ifdef __BORLANDC__ +#pragma nopackwarning +#endif +#pragma pack(pop) +#endif /* Compiler needs structure packing set */ diff --git a/libs/SDLMixerX/i686-w64-mingw32/lib/libSDL2_mixer_ext-static.a b/libs/SDLMixerX/i686-w64-mingw32/lib/libSDL2_mixer_ext-static.a new file mode 100644 index 000000000..8a59b5a61 Binary files /dev/null and b/libs/SDLMixerX/i686-w64-mingw32/lib/libSDL2_mixer_ext-static.a differ diff --git a/libs/SDLMixerX/i686-w64-mingw32/lib/libSDL2_mixer_ext.dll.a b/libs/SDLMixerX/i686-w64-mingw32/lib/libSDL2_mixer_ext.dll.a new file mode 100644 index 000000000..b5e43ef62 Binary files /dev/null and b/libs/SDLMixerX/i686-w64-mingw32/lib/libSDL2_mixer_ext.dll.a differ diff --git a/libs/SDLMixerX/x86_64-w64-mingw32/bin/SDL2_mixer_ext.dll b/libs/SDLMixerX/x86_64-w64-mingw32/bin/SDL2_mixer_ext.dll new file mode 100644 index 000000000..7762d5e8d Binary files /dev/null and b/libs/SDLMixerX/x86_64-w64-mingw32/bin/SDL2_mixer_ext.dll differ diff --git a/libs/SDLMixerX/x86_64-w64-mingw32/bin/libfluidsynth-2.dll b/libs/SDLMixerX/x86_64-w64-mingw32/bin/libfluidsynth-2.dll new file mode 100644 index 000000000..5dbcac34a Binary files /dev/null and b/libs/SDLMixerX/x86_64-w64-mingw32/bin/libfluidsynth-2.dll differ diff --git a/libs/SDLMixerX/x86_64-w64-mingw32/bin/libgcc_s_sjlj-1.dll b/libs/SDLMixerX/x86_64-w64-mingw32/bin/libgcc_s_sjlj-1.dll new file mode 100644 index 000000000..9684a2155 Binary files /dev/null and b/libs/SDLMixerX/x86_64-w64-mingw32/bin/libgcc_s_sjlj-1.dll differ diff --git a/libs/SDLMixerX/x86_64-w64-mingw32/bin/libstdc++-6.dll b/libs/SDLMixerX/x86_64-w64-mingw32/bin/libstdc++-6.dll new file mode 100644 index 000000000..220099c40 Binary files /dev/null and b/libs/SDLMixerX/x86_64-w64-mingw32/bin/libstdc++-6.dll differ diff --git a/libs/SDLMixerX/x86_64-w64-mingw32/include/SDL2/SDL_mixer_ext.h b/libs/SDLMixerX/x86_64-w64-mingw32/include/SDL2/SDL_mixer_ext.h new file mode 100644 index 000000000..3a6b91b50 --- /dev/null +++ b/libs/SDLMixerX/x86_64-w64-mingw32/include/SDL2/SDL_mixer_ext.h @@ -0,0 +1,867 @@ +/* + SDL Mixer X: An extended audio mixer library, forked from SDL_mixer + Copyright (C) 2014-2018 Vitaly Novichkov + + SDL_mixer: An audio mixer library based on the SDL library + Copyright (C) 1997-2018 Sam Lantinga + + 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. +*/ + +#ifndef SDL_MIXER_H_ +#define SDL_MIXER_H_ + +#include "SDL_stdinc.h" +#include "SDL_rwops.h" +#include "SDL_audio.h" +#include "SDL_endian.h" +#include "SDL_version.h" +#include "begin_code.h" + +/* Let applications recogonize which SDL Mixer edition is in use: Official or Extended fork by Wohlstand */ +#define SDL_MIXER_X 1 + +#define MIXSDLCALL + +#if defined(FORCE_STDCALLS) && defined(_WIN32) +#ifdef SDLCALL +#undef SDLCALL +#endif +#define SDLCALL __stdcall +#define SDLCALLCC __stdcall +#else +#define SDLCALLCC +#endif + +#ifndef DEPRECATED +#ifdef __GNUC__ +#define DEPRECATED(func) func __attribute__ ((deprecated)) +#elif defined(_MSC_VER) +#define DEPRECATED(func) __declspec(deprecated) func +#else +#pragma message("WARNING: You need to implement DEPRECATED for this compiler") +#define DEPRECATED(func) func +#endif +#endif + +/* Set up for C function definitions, even when using C++ */ +#ifdef __cplusplus +extern "C" { +#endif + +/* Printable format: "%d.%d.%d", MAJOR, MINOR, PATCHLEVEL +*/ +#define SDL_MIXER_MAJOR_VERSION 2 +#define SDL_MIXER_MINOR_VERSION 2 +#define SDL_MIXER_PATCHLEVEL 0 + +/* This macro can be used to fill a version structure with the compile-time + * version of the SDL_mixer library. + */ +#define SDL_MIXER_VERSION(X) \ +{ \ + (X)->major = SDL_MIXER_MAJOR_VERSION; \ + (X)->minor = SDL_MIXER_MINOR_VERSION; \ + (X)->patch = SDL_MIXER_PATCHLEVEL; \ +} + +/* Backwards compatibility */ +#define MIX_MAJOR_VERSION SDL_MIXER_MAJOR_VERSION +#define MIX_MINOR_VERSION SDL_MIXER_MINOR_VERSION +#define MIX_PATCHLEVEL SDL_MIXER_PATCHLEVEL +#define MIX_VERSION(X) SDL_MIXER_VERSION(X) + +/** + * This is the version number macro for the current SDL_mixer version. + */ +#define SDL_MIXER_COMPILEDVERSION \ + SDL_VERSIONNUM(SDL_MIXER_MAJOR_VERSION, SDL_MIXER_MINOR_VERSION, SDL_MIXER_PATCHLEVEL) + +/** + * This macro will evaluate to true if compiled with SDL_mixer at least X.Y.Z. + */ +#define SDL_MIXER_VERSION_ATLEAST(X, Y, Z) \ + (SDL_MIXER_COMPILEDVERSION >= SDL_VERSIONNUM(X, Y, Z)) + +/* This function gets the version of the dynamically linked SDL_mixer library. + it should NOT be used to fill a version structure, instead you should + use the SDL_MIXER_VERSION() macro. + */ +extern DECLSPEC const SDL_version * SDLCALL Mix_Linked_Version(void); + +typedef enum +{ + MIX_INIT_FLAC = 0x00000001, + MIX_INIT_MOD = 0x00000002, + MIX_INIT_MP3 = 0x00000008, + MIX_INIT_OGG = 0x00000010, + MIX_INIT_MID = 0x00000020, + MIX_INIT_OPUS = 0x00000040 +} MIX_InitFlags; + +/* Loads dynamic libraries and prepares them for use. Flags should be + one or more flags from MIX_InitFlags OR'd together. + It returns the flags successfully initialized, or 0 on failure. + */ +extern DECLSPEC int SDLCALL Mix_Init(int flags); + +/* Unloads libraries loaded with Mix_Init */ +extern DECLSPEC void SDLCALL Mix_Quit(void); + + +/* The default mixer has 8 simultaneous mixing channels */ +#ifndef MIX_CHANNELS +#define MIX_CHANNELS 8 +#endif + +/* Good default values for a PC soundcard */ +#define MIX_DEFAULT_FREQUENCY 44100 +#if SDL_BYTEORDER == SDL_LIL_ENDIAN +#define MIX_DEFAULT_FORMAT AUDIO_S16LSB +#else +#define MIX_DEFAULT_FORMAT AUDIO_S16MSB +#endif +#define MIX_DEFAULT_CHANNELS 2 +#define MIX_MAX_VOLUME SDL_MIX_MAXVOLUME /* Volume of a chunk */ + +/* The internal format for an audio chunk */ +typedef struct Mix_Chunk { + int allocated; + Uint8 *abuf; + Uint32 alen; + Uint8 volume; /* Per-sample volume, 0-128 */ +} Mix_Chunk; + +/* The different fading types supported */ +typedef enum { + MIX_NO_FADING, + MIX_FADING_OUT, + MIX_FADING_IN +} Mix_Fading; + +/* These are types of music files (not libraries used to load them) */ +typedef enum { + MUS_NONE, + MUS_CMD, + MUS_WAV, + MUS_MOD, + MUS_MID, + MUS_OGG, + MUS_MP3, + MUS_MP3_MAD_UNUSED, + MUS_FLAC, + MUS_MODPLUG_UNUSED, + MUS_OPUS, + MUS_GME, + MUS_ADLMIDI/*Use ADLMIDI coded for super-special formats like IMF, MUS or XMI are can't be played without ADLMIDI*/ +} Mix_MusicType; + +typedef enum { + MIDI_ADLMIDI, + MIDI_Native, + MIDI_Timidity, + MIDI_OPNMIDI, + MIDI_Fluidsynth, + MIDI_ANY, + MIDI_KnuwnDevices /* Count of MIDI device types */ +} Mix_MIDI_Device; + +/* Volume model type in the ADLMIDI */ +typedef enum { + ADLMIDI_VM_AUTO, + ADLMIDI_VM_GENERIC, + ADLMIDI_VM_CMF, + ADLMIDI_VM_DMX, + ADLMIDI_VM_APOGEE, + ADLMIDI_VM_9X +} Mix_ADLMIDI_VolumeModel; + +/* OPL3 chip emulators for ADLMIDI */ +typedef enum { + ADLMIDI_OPL3_EMU_DEFAULT = -1, + ADLMIDI_OPL3_EMU_NUKED = 0, + ADLMIDI_OPL3_EMU_NUKED_1_7_4, + ADLMIDI_OPL3_EMU_DOSBOX, +} Mix_ADLMIDI_Emulator; + +/* OPN2 chip emulators for OPNMIDI */ +typedef enum { + OPNMIDI_OPN2_EMU_DEFAULT = -1, + OPNMIDI_OPN2_EMU_MIME = 0, + OPNMIDI_OPN2_EMU_NUKED, + OPNMIDI_OPN2_EMU_GENS, +} Mix_OPNMIDI_Emulator; + +/* The internal format for a music chunk interpreted via mikmod */ +typedef struct _Mix_Music Mix_Music; + +/* Open the mixer with a certain audio format */ +extern DECLSPEC int SDLCALL Mix_OpenAudio(int frequency, Uint16 format, int channels, int chunksize); + +/* Open the mixer with specific device and certain audio format */ +extern DECLSPEC int SDLCALL Mix_OpenAudioDevice(int frequency, Uint16 format, int channels, int chunksize, const char* device, int allowed_changes); + +/* Dynamically change the number of channels managed by the mixer. + If decreasing the number of channels, the upper channels are + stopped. + This function returns the new number of allocated channels. + */ +extern DECLSPEC int SDLCALL Mix_AllocateChannels(int numchans); + +/* Find out what the actual audio device parameters are. + This function returns 1 if the audio has been opened, 0 otherwise. + */ +extern DECLSPEC int SDLCALL Mix_QuerySpec(int *frequency,Uint16 *format,int *channels); + +/* Load a wave file or a music (.mod .s3m .it .xm) file + IMPORTANT: To choice a track number of NSF, GBM, HES, etc file, + you must append "|xxx" to end of file path for + Mix_LoadMUS function. + Where xxx - actual number of chip track, (from 0 to N-1) + Examples: "file.nsf|12", "file.hes|2" +*/ +extern DECLSPEC Mix_Chunk * SDLCALL Mix_LoadWAV_RW(SDL_RWops *src, int freesrc); +#define Mix_LoadWAV(file) Mix_LoadWAV_RW(SDL_RWFromFile(file, "rb"), 1) +extern DECLSPEC Mix_Music * SDLCALL Mix_LoadMUS(const char *file); + +/* Load a music file from an SDL_RWop object + * Matt Campbell (matt@campbellhome.dhs.org) April 2000 */ +extern DECLSPEC Mix_Music * SDLCALL Mix_LoadMUS_RW(SDL_RWops *src, int freesrc); + +/* Load a music file from an SDL_RWop object with custom arguments (trackID for GME or settings for a MIDI playing) + * Arguments are taking no effect for file formats which are not supports extra arguments. + */ +extern DECLSPEC Mix_Music *SDLCALL Mix_LoadMUS_RW_ARG(SDL_RWops *src, int freesrc, const char *args); + +/* Load a music file from an SDL_RWop object with custom trackID for GME. + * trackID argument takes no effect for non-NSF,HES,GBM,etc. file formats. + * Default value should be 0 + */ +extern DECLSPEC Mix_Music *SDLCALL Mix_LoadMUS_RW_GME(SDL_RWops *src, int freesrc, int trackID); + +/* Load a music file from an SDL_RWop object assuming a specific format */ +extern DECLSPEC Mix_Music * SDLCALL Mix_LoadMUSType_RW(SDL_RWops *src, Mix_MusicType type, int freesrc); + +/* Load a music file from an SDL_RWop object assuming a specific format + with custom arguments (trackID for GME or settings for a MIDI playing) */ +extern DECLSPEC Mix_Music * SDLCALL Mix_LoadMUSType_RW_ARG(SDL_RWops *src, Mix_MusicType type, int freesrc, const char *args); + +/* Load a wave file of the mixer format from a memory buffer */ +extern DECLSPEC Mix_Chunk * SDLCALL Mix_QuickLoad_WAV(Uint8 *mem); + +/* Load raw audio data of the mixer format from a memory buffer */ +extern DECLSPEC Mix_Chunk * SDLCALL Mix_QuickLoad_RAW(Uint8 *mem, Uint32 len); + +/* Free an audio chunk previously loaded */ +extern DECLSPEC void SDLCALL Mix_FreeChunk(Mix_Chunk *chunk); +extern DECLSPEC void SDLCALL Mix_FreeMusic(Mix_Music *music); + +/* Get a list of chunk/music decoders that this build of SDL_mixer provides. + This list can change between builds AND runs of the program, if external + libraries that add functionality become available. + You must successfully call Mix_OpenAudio() before calling these functions. + This API is only available in SDL_mixer 1.2.9 and later. + + // usage... + int i; + const int total = Mix_GetNumChunkDecoders(); + for (i = 0; i < total; i++) + printf("Supported chunk decoder: [%s]\n", Mix_GetChunkDecoder(i)); + + Appearing in this list doesn't promise your specific audio file will + decode...but it's handy to know if you have, say, a functioning Timidity + install. + + These return values are static, read-only data; do not modify or free it. + The pointers remain valid until you call Mix_CloseAudio(). +*/ +extern DECLSPEC int SDLCALL Mix_GetNumChunkDecoders(void); +extern DECLSPEC const char * SDLCALL Mix_GetChunkDecoder(int index); +extern DECLSPEC SDL_bool SDLCALL Mix_HasChunkDecoder(const char *name); +extern DECLSPEC int SDLCALL Mix_GetNumMusicDecoders(void); +extern DECLSPEC const char * SDLCALL Mix_GetMusicDecoder(int index); +extern DECLSPEC SDL_bool SDLCALL Mix_HasMusicDecoder(const char *name); + +/* Find out the music format of a mixer music, or the currently playing + music, if 'music' is NULL. +*/ +extern DECLSPEC Mix_MusicType SDLCALL Mix_GetMusicType(const Mix_Music *music); + +/* Get music title from meta-tag if possible. If title tag is empty, filename will be returned */ +extern DECLSPEC const char *SDLCALL Mix_GetMusicTitle(const Mix_Music *music); +/* Get music title from meta-tag if possible */ +extern DECLSPEC const char *SDLCALL Mix_GetMusicTitleTag(const Mix_Music *music); +/* Get music artist from meta-tag if possible */ +extern DECLSPEC const char *SDLCALL Mix_GetMusicArtistTag(const Mix_Music *music); +/* Get music album from meta-tag if possible */ +extern DECLSPEC const char *SDLCALL Mix_GetMusicAlbumTag(const Mix_Music *music); +/* Get music copyright from meta-tag if possible */ +extern DECLSPEC const char *SDLCALL Mix_GetMusicCopyrightTag(const Mix_Music *music); + +/* Set a function that is called after all mixing is performed. + This can be used to provide real-time visual display of the audio stream + or add a custom mixer filter for the stream data. +*/ +extern DECLSPEC void SDLCALL Mix_SetPostMix(void (SDLCALL *mix_func)(void *udata, Uint8 *stream, int len), void *arg); + +/* Add your own music player or additional mixer function. + If 'mix_func' is NULL, the default music player is re-enabled. + */ +extern DECLSPEC void SDLCALL Mix_HookMusic(void (SDLCALL *mix_func)(void *udata, Uint8 *stream, int len), void *arg); + +/* Add your own callback for when the music has finished playing or when it is + * stopped from a call to Mix_HaltMusic. + */ +extern DECLSPEC void SDLCALL Mix_HookMusicFinished(void (SDLCALL *music_finished)(void)); + +/* Get a pointer to the user data for the current music hook */ +extern DECLSPEC void * SDLCALL Mix_GetMusicHookData(void); + +/* + * Add your own callback when a channel has finished playing. NULL + * to disable callback. The callback may be called from the mixer's audio + * callback or it could be called as a result of Mix_HaltChannel(), etc. + * do not call SDL_LockAudio() from this callback; you will either be + * inside the audio callback, or SDL_mixer will explicitly lock the audio + * before calling your callback. + */ +extern DECLSPEC void SDLCALL Mix_ChannelFinished(void (SDLCALL *channel_finished)(int channel)); + + +/* Special Effects API by ryan c. gordon. (icculus@icculus.org) */ + +#define MIX_CHANNEL_POST -2 + +/* This is the format of a special effect callback: + * + * myeffect(int chan, void *stream, int len, void *udata); + * + * (chan) is the channel number that your effect is affecting. (stream) is + * the buffer of data to work upon. (len) is the size of (stream), and + * (udata) is a user-defined bit of data, which you pass as the last arg of + * Mix_RegisterEffect(), and is passed back unmolested to your callback. + * Your effect changes the contents of (stream) based on whatever parameters + * are significant, or just leaves it be, if you prefer. You can do whatever + * you like to the buffer, though, and it will continue in its changed state + * down the mixing pipeline, through any other effect functions, then finally + * to be mixed with the rest of the channels and music for the final output + * stream. + * + * DO NOT EVER call SDL_LockAudio() from your callback function! + */ +typedef void (SDLCALL *Mix_EffectFunc_t)(int chan, void *stream, int len, void *udata); + +/* + * This is a callback that signifies that a channel has finished all its + * loops and has completed playback. This gets called if the buffer + * plays out normally, or if you call Mix_HaltChannel(), implicitly stop + * a channel via Mix_AllocateChannels(), or unregister a callback while + * it's still playing. + * + * DO NOT EVER call SDL_LockAudio() from your callback function! + */ +typedef void (SDLCALL *Mix_EffectDone_t)(int chan, void *udata); + + +/* Register a special effect function. At mixing time, the channel data is + * copied into a buffer and passed through each registered effect function. + * After it passes through all the functions, it is mixed into the final + * output stream. The copy to buffer is performed once, then each effect + * function performs on the output of the previous effect. Understand that + * this extra copy to a buffer is not performed if there are no effects + * registered for a given chunk, which saves CPU cycles, and any given + * effect will be extra cycles, too, so it is crucial that your code run + * fast. Also note that the data that your function is given is in the + * format of the sound device, and not the format you gave to Mix_OpenAudio(), + * although they may in reality be the same. This is an unfortunate but + * necessary speed concern. Use Mix_QuerySpec() to determine if you can + * handle the data before you register your effect, and take appropriate + * actions. + * You may also specify a callback (Mix_EffectDone_t) that is called when + * the channel finishes playing. This gives you a more fine-grained control + * than Mix_ChannelFinished(), in case you need to free effect-specific + * resources, etc. If you don't need this, you can specify NULL. + * You may set the callbacks before or after calling Mix_PlayChannel(). + * Things like Mix_SetPanning() are just internal special effect functions, + * so if you are using that, you've already incurred the overhead of a copy + * to a separate buffer, and that these effects will be in the queue with + * any functions you've registered. The list of registered effects for a + * channel is reset when a chunk finishes playing, so you need to explicitly + * set them with each call to Mix_PlayChannel*(). + * You may also register a special effect function that is to be run after + * final mixing occurs. The rules for these callbacks are identical to those + * in Mix_RegisterEffect, but they are run after all the channels and the + * music have been mixed into a single stream, whereas channel-specific + * effects run on a given channel before any other mixing occurs. These + * global effect callbacks are call "posteffects". Posteffects only have + * their Mix_EffectDone_t function called when they are unregistered (since + * the main output stream is never "done" in the same sense as a channel). + * You must unregister them manually when you've had enough. Your callback + * will be told that the channel being mixed is (MIX_CHANNEL_POST) if the + * processing is considered a posteffect. + * + * After all these effects have finished processing, the callback registered + * through Mix_SetPostMix() runs, and then the stream goes to the audio + * device. + * + * DO NOT EVER call SDL_LockAudio() from your callback function! + * + * returns zero if error (no such channel), nonzero if added. + * Error messages can be retrieved from Mix_GetError(). + */ +extern DECLSPEC int SDLCALL Mix_RegisterEffect(int chan, Mix_EffectFunc_t f, Mix_EffectDone_t d, void *arg); + + +/* You may not need to call this explicitly, unless you need to stop an + * effect from processing in the middle of a chunk's playback. + * Posteffects are never implicitly unregistered as they are for channels, + * but they may be explicitly unregistered through this function by + * specifying MIX_CHANNEL_POST for a channel. + * returns zero if error (no such channel or effect), nonzero if removed. + * Error messages can be retrieved from Mix_GetError(). + */ +extern DECLSPEC int SDLCALL Mix_UnregisterEffect(int channel, Mix_EffectFunc_t f); + + +/* You may not need to call this explicitly, unless you need to stop all + * effects from processing in the middle of a chunk's playback. Note that + * this will also shut off some internal effect processing, since + * Mix_SetPanning() and others may use this API under the hood. This is + * called internally when a channel completes playback. + * Posteffects are never implicitly unregistered as they are for channels, + * but they may be explicitly unregistered through this function by + * specifying MIX_CHANNEL_POST for a channel. + * returns zero if error (no such channel), nonzero if all effects removed. + * Error messages can be retrieved from Mix_GetError(). + */ +extern DECLSPEC int SDLCALL Mix_UnregisterAllEffects(int channel); + + +#define MIX_EFFECTSMAXSPEED "MIX_EFFECTSMAXSPEED" + +/* + * These are the internally-defined mixing effects. They use the same API that + * effects defined in the application use, but are provided here as a + * convenience. Some effects can reduce their quality or use more memory in + * the name of speed; to enable this, make sure the environment variable + * MIX_EFFECTSMAXSPEED (see above) is defined before you call + * Mix_OpenAudio(). + */ + + +/* Set the panning of a channel. The left and right channels are specified + * as integers between 0 and 255, quietest to loudest, respectively. + * + * Technically, this is just individual volume control for a sample with + * two (stereo) channels, so it can be used for more than just panning. + * If you want real panning, call it like this: + * + * Mix_SetPanning(channel, left, 255 - left); + * + * ...which isn't so hard. + * + * Setting (channel) to MIX_CHANNEL_POST registers this as a posteffect, and + * the panning will be done to the final mixed stream before passing it on + * to the audio device. + * + * This uses the Mix_RegisterEffect() API internally, and returns without + * registering the effect function if the audio device is not configured + * for stereo output. Setting both (left) and (right) to 255 causes this + * effect to be unregistered, since that is the data's normal state. + * + * returns zero if error (no such channel or Mix_RegisterEffect() fails), + * nonzero if panning effect enabled. Note that an audio device in mono + * mode is a no-op, but this call will return successful in that case. + * Error messages can be retrieved from Mix_GetError(). + */ +extern DECLSPEC int SDLCALL Mix_SetPanning(int channel, Uint8 left, Uint8 right); + + +/* Set the position of a channel. (angle) is an integer from 0 to 360, that + * specifies the location of the sound in relation to the listener. (angle) + * will be reduced as neccesary (540 becomes 180 degrees, -100 becomes 260). + * Angle 0 is due north, and rotates clockwise as the value increases. + * For efficiency, the precision of this effect may be limited (angles 1 + * through 7 might all produce the same effect, 8 through 15 are equal, etc). + * (distance) is an integer between 0 and 255 that specifies the space + * between the sound and the listener. The larger the number, the further + * away the sound is. Using 255 does not guarantee that the channel will be + * culled from the mixing process or be completely silent. For efficiency, + * the precision of this effect may be limited (distance 0 through 5 might + * all produce the same effect, 6 through 10 are equal, etc). Setting (angle) + * and (distance) to 0 unregisters this effect, since the data would be + * unchanged. + * + * If you need more precise positional audio, consider using OpenAL for + * spatialized effects instead of SDL_mixer. This is only meant to be a + * basic effect for simple "3D" games. + * + * If the audio device is configured for mono output, then you won't get + * any effectiveness from the angle; however, distance attenuation on the + * channel will still occur. While this effect will function with stereo + * voices, it makes more sense to use voices with only one channel of sound, + * so when they are mixed through this effect, the positioning will sound + * correct. You can convert them to mono through SDL before giving them to + * the mixer in the first place if you like. + * + * Setting (channel) to MIX_CHANNEL_POST registers this as a posteffect, and + * the positioning will be done to the final mixed stream before passing it + * on to the audio device. + * + * This is a convenience wrapper over Mix_SetDistance() and Mix_SetPanning(). + * + * returns zero if error (no such channel or Mix_RegisterEffect() fails), + * nonzero if position effect is enabled. + * Error messages can be retrieved from Mix_GetError(). + */ +extern DECLSPEC int SDLCALL Mix_SetPosition(int channel, Sint16 angle, Uint8 distance); + + +/* Set the "distance" of a channel. (distance) is an integer from 0 to 255 + * that specifies the location of the sound in relation to the listener. + * Distance 0 is overlapping the listener, and 255 is as far away as possible + * A distance of 255 does not guarantee silence; in such a case, you might + * want to try changing the chunk's volume, or just cull the sample from the + * mixing process with Mix_HaltChannel(). + * For efficiency, the precision of this effect may be limited (distances 1 + * through 7 might all produce the same effect, 8 through 15 are equal, etc). + * (distance) is an integer between 0 and 255 that specifies the space + * between the sound and the listener. The larger the number, the further + * away the sound is. + * Setting (distance) to 0 unregisters this effect, since the data would be + * unchanged. + * If you need more precise positional audio, consider using OpenAL for + * spatialized effects instead of SDL_mixer. This is only meant to be a + * basic effect for simple "3D" games. + * + * Setting (channel) to MIX_CHANNEL_POST registers this as a posteffect, and + * the distance attenuation will be done to the final mixed stream before + * passing it on to the audio device. + * + * This uses the Mix_RegisterEffect() API internally. + * + * returns zero if error (no such channel or Mix_RegisterEffect() fails), + * nonzero if position effect is enabled. + * Error messages can be retrieved from Mix_GetError(). + */ +extern DECLSPEC int SDLCALL Mix_SetDistance(int channel, Uint8 distance); + + +/* + * !!! FIXME : Haven't implemented, since the effect goes past the + * end of the sound buffer. Will have to think about this. + * --ryan. + */ +#if 0 +/* Causes an echo effect to be mixed into a sound. (echo) is the amount + * of echo to mix. 0 is no echo, 255 is infinite (and probably not + * what you want). + * + * Setting (channel) to MIX_CHANNEL_POST registers this as a posteffect, and + * the reverbing will be done to the final mixed stream before passing it on + * to the audio device. + * + * This uses the Mix_RegisterEffect() API internally. If you specify an echo + * of zero, the effect is unregistered, as the data is already in that state. + * + * returns zero if error (no such channel or Mix_RegisterEffect() fails), + * nonzero if reversing effect is enabled. + * Error messages can be retrieved from Mix_GetError(). + */ +extern no_parse_DECLSPEC int SDLCALL Mix_SetReverb(int channel, Uint8 echo); +#endif + +/* Causes a channel to reverse its stereo. This is handy if the user has his + * speakers hooked up backwards, or you would like to have a minor bit of + * psychedelia in your sound code. :) Calling this function with (flip) + * set to non-zero reverses the chunks's usual channels. If (flip) is zero, + * the effect is unregistered. + * + * This uses the Mix_RegisterEffect() API internally, and thus is probably + * more CPU intensive than having the user just plug in his speakers + * correctly. Mix_SetReverseStereo() returns without registering the effect + * function if the audio device is not configured for stereo output. + * + * If you specify MIX_CHANNEL_POST for (channel), then this the effect is used + * on the final mixed stream before sending it on to the audio device (a + * posteffect). + * + * returns zero if error (no such channel or Mix_RegisterEffect() fails), + * nonzero if reversing effect is enabled. Note that an audio device in mono + * mode is a no-op, but this call will return successful in that case. + * Error messages can be retrieved from Mix_GetError(). + */ +extern DECLSPEC int SDLCALL Mix_SetReverseStereo(int channel, int flip); + +/* end of effects API. --ryan. */ + + +/* Reserve the first channels (0 -> n-1) for the application, i.e. don't allocate + them dynamically to the next sample if requested with a -1 value below. + Returns the number of reserved channels. + */ +extern DECLSPEC int SDLCALL Mix_ReserveChannels(int num); + +/* Channel grouping functions */ + +/* Attach a tag to a channel. A tag can be assigned to several mixer + channels, to form groups of channels. + If 'tag' is -1, the tag is removed (actually -1 is the tag used to + represent the group of all the channels). + Returns true if everything was OK. + */ +extern DECLSPEC int SDLCALL Mix_GroupChannel(int which, int tag); +/* Assign several consecutive channels to a group */ +extern DECLSPEC int SDLCALL Mix_GroupChannels(int from, int to, int tag); +/* Finds the first available channel in a group of channels, + returning -1 if none are available. + */ +extern DECLSPEC int SDLCALL Mix_GroupAvailable(int tag); +/* Returns the number of channels in a group. This is also a subtle + way to get the total number of channels when 'tag' is -1 + */ +extern DECLSPEC int SDLCALL Mix_GroupCount(int tag); +/* Finds the "oldest" sample playing in a group of channels */ +extern DECLSPEC int SDLCALL Mix_GroupOldest(int tag); +/* Finds the "most recent" (i.e. last) sample playing in a group of channels */ +extern DECLSPEC int SDLCALL Mix_GroupNewer(int tag); + +/* Play an audio chunk on a specific channel. + If the specified channel is -1, play on the first free channel. + If 'loops' is greater than zero, loop the sound that many times. + If 'loops' is -1, loop inifinitely (~65000 times). + Returns which channel was used to play the sound. +*/ +#define Mix_PlayChannel(channel,chunk,loops) Mix_PlayChannelTimed(channel,chunk,loops,-1) +/* The same as above, but the sound is played at most 'ticks' milliseconds */ +extern DECLSPEC int SDLCALL Mix_PlayChannelTimed(int channel, Mix_Chunk *chunk, int loops, int ticks); +extern DECLSPEC int SDLCALL Mix_PlayMusic(Mix_Music *music, int loops); +#define Mix_PlayChannelVol(channel,chunk,loops,vol) Mix_PlayChannelTimedVolume(channel,chunk,loops,-1,vol)/*MIXER-X*/ +extern DECLSPEC int SDLCALL Mix_PlayChannelTimedVolume(int which, Mix_Chunk *chunk, int loops, int ticks, int volume);/*MIXER-X*/ + +/* Fade in music or a channel over "ms" milliseconds, same semantics as the "Play" functions */ +extern DECLSPEC int SDLCALL Mix_FadeInMusic(Mix_Music *music, int loops, int ms); +extern DECLSPEC int SDLCALL Mix_FadeInMusicPos(Mix_Music *music, int loops, int ms, double position); +#define Mix_FadeInChannel(channel,chunk,loops,ms) Mix_FadeInChannelTimed(channel,chunk,loops,ms,-1) +extern DECLSPEC int SDLCALL Mix_FadeInChannelTimed(int channel, Mix_Chunk *chunk, int loops, int ms, int ticks); +#define Mix_FadeInChannelVolume(channel,chunk,loops,ms,vol) Mix_FadeInChannelTimed(channel,chunk,loops,ms,-1,vol)/*MIXER-X*/ +extern DECLSPEC int SDLCALL Mix_FadeInChannelTimedVolume(int which, Mix_Chunk *chunk, int loops, int ms, int ticks, int volume);/*MIXER-X*/ + + +/* Set the volume in the range of 0-128 of a specific channel or chunk. + If the specified channel is -1, set volume for all channels. + Returns the original volume. + If the specified volume is -1, just return the current volume. +*/ +extern DECLSPEC int SDLCALL Mix_Volume(int channel, int volume); +extern DECLSPEC int SDLCALL Mix_VolumeChunk(Mix_Chunk *chunk, int volume); +extern DECLSPEC int SDLCALL Mix_VolumeMusic(int volume); + +/* Halt playing of a particular channel */ +extern DECLSPEC int SDLCALL Mix_HaltChannel(int channel); +extern DECLSPEC int SDLCALL Mix_HaltGroup(int tag); +extern DECLSPEC int SDLCALL Mix_HaltMusic(void); + +/* Change the expiration delay for a particular channel. + The sample will stop playing after the 'ticks' milliseconds have elapsed, + or remove the expiration if 'ticks' is -1 +*/ +extern DECLSPEC int SDLCALL Mix_ExpireChannel(int channel, int ticks); + +/* Halt a channel, fading it out progressively till it's silent + The ms parameter indicates the number of milliseconds the fading + will take. + */ +extern DECLSPEC int SDLCALL Mix_FadeOutChannel(int which, int ms); +extern DECLSPEC int SDLCALL Mix_FadeOutGroup(int tag, int ms); +extern DECLSPEC int SDLCALL Mix_FadeOutMusic(int ms); + +/* Query the fading status of a channel */ +extern DECLSPEC Mix_Fading SDLCALL Mix_FadingMusic(void); +extern DECLSPEC Mix_Fading SDLCALL Mix_FadingChannel(int which); + +/* Pause/Resume a particular channel */ +extern DECLSPEC void SDLCALL Mix_Pause(int channel); +extern DECLSPEC void SDLCALL Mix_Resume(int channel); +extern DECLSPEC int SDLCALL Mix_Paused(int channel); + +/* Pause/Resume the music stream */ +extern DECLSPEC void SDLCALL Mix_PauseMusic(void); +extern DECLSPEC void SDLCALL Mix_ResumeMusic(void); +extern DECLSPEC void SDLCALL Mix_RewindMusic(void); +extern DECLSPEC int SDLCALL Mix_PausedMusic(void); + +/* Set the current position in the music stream. + This returns 0 if successful, or -1 if it failed or isn't implemented. + This function is only implemented for MOD music formats (set pattern + order number) and for WAV, OGG, FLAC, MP3_MAD, MP3_MPG, and MODPLUG music + (set position in seconds), at the moment. +*/ +extern DECLSPEC int SDLCALL Mix_SetMusicPosition(double position); +/* + Get the time current position of music stream + returns -1.0 if this feature is not supported for some codec + */ +extern DECLSPEC double SDLCALL Mix_GetMusicPosition(Mix_Music *music); +/* + Get the total time length of music stream + returns -1.0 if this feature is not supported for some codec + */ +extern DECLSPEC double SDLCALL Mix_GetMusicTotalTime(Mix_Music *music); + +/* + Get the loop start time position of music stream + returns -1.0 if this feature is not used for this music or not supported for some codec + */ +extern DECLSPEC double SDLCALL Mix_GetMusicLoopStartTime(Mix_Music *music); +/* + Get the loop end time position of music stream + returns -1.0 if this feature is not used for this music or not supported for some codec + */ +extern DECLSPEC double SDLCALL Mix_GetMusicLoopEndTime(Mix_Music *music); +/* + Get the loop time length of music stream + returns -1.0 if this feature is not used for this music or not supported for some codec + */ +extern DECLSPEC double SDLCALL Mix_GetMusicLoopLengthTime(Mix_Music *music); + + +/* Check the status of a specific channel. + If the specified channel is -1, check all channels. +*/ +extern DECLSPEC int SDLCALL Mix_Playing(int channel); +extern DECLSPEC int SDLCALL Mix_PlayingMusic(void); + +/* Stop music and set external music playback command */ +extern DECLSPEC int SDLCALL Mix_SetMusicCMD(const char *command); + +/* Synchro value is set by MikMod from modules while playing */ +extern DECLSPEC int SDLCALL Mix_SetSynchroValue(int value); +extern DECLSPEC int SDLCALL Mix_GetSynchroValue(void); + +/* Set/Get/Iterate SoundFonts paths to use by supported MIDI backends */ +extern DECLSPEC int SDLCALL Mix_SetSoundFonts(const char *paths); +extern DECLSPEC const char* SDLCALL Mix_GetSoundFonts(void); +extern DECLSPEC int SDLCALL Mix_EachSoundFont(int (SDLCALL *function)(const char*, void*), void *data); + +/* Get the Mix_Chunk currently associated with a mixer channel + Returns NULL if it's an invalid channel, or there's no chunk associated. +*/ +extern DECLSPEC Mix_Chunk * SDLCALL Mix_GetChunk(int channel); + +/* Close the mixer, halting all playing audio */ +extern DECLSPEC void SDLCALL Mix_CloseAudio(void); + +/* Add additional Timidity bank path */ +extern DECLSPEC void SDLCALL Mix_Timidity_addToPathList(const char *path); + +/* ADLMIDI Setup functions */ +/* Get count of available hardcoded banks */ +extern DECLSPEC int SDLCALL Mix_ADLMIDI_getTotalBanks(void); +/* Get array of the bank names */ +extern DECLSPEC const char *const *SDLCALL Mix_ADLMIDI_getBankNames(void); +/* Get bank ID */ +extern DECLSPEC int SDLCALL Mix_ADLMIDI_getBankID(void); +/* Set bank ID (Applying on stop/play) */ +extern DECLSPEC void SDLCALL Mix_ADLMIDI_setBankID(int bnk); +/* Get state of deep vibrato */ +extern DECLSPEC int SDLCALL Mix_ADLMIDI_getTremolo(void); +/* Set deep tremolo mode (0 off, 1 on) (Applying on stop/play) */ +extern DECLSPEC void SDLCALL Mix_ADLMIDI_setTremolo(int tr); +/* Get state of deep vibrato */ +extern DECLSPEC int SDLCALL Mix_ADLMIDI_getVibrato(void); +/* Set deep vibrato mode (0 off, 1 on) (Applying on stop/play) */ +extern DECLSPEC void SDLCALL Mix_ADLMIDI_setVibrato(int vib); +/* Get state of scalable modulation mode */ +extern DECLSPEC int SDLCALL Mix_ADLMIDI_getScaleMod(void); +/* Set scalable modulation mode (0 off, 1 on) (Applying on stop/play) */ +extern DECLSPEC void SDLCALL Mix_ADLMIDI_setScaleMod(int sc); +/* Get state of adlib drums mode */ +extern DECLSPEC int SDLCALL Mix_ADLMIDI_getAdLibMode(void); +/* Set adlib drums mode mode (0 off, 1 on) (Applying on stop/play) */ +extern DECLSPEC void SDLCALL Mix_ADLMIDI_setAdLibMode(int tr); +/* Get state of logarithmic mode */ +extern DECLSPEC int SDLCALL Mix_ADLMIDI_getLogarithmicVolumes(void); +/* Set logarithmic volumes mode in the generic/CMF volume models (0 off, 1 on) (Applying on stop/play) */ +extern DECLSPEC void SDLCALL Mix_ADLMIDI_setLogarithmicVolumes(int lv); +/* Get current volume model ID */ +extern DECLSPEC int SDLCALL Mix_ADLMIDI_getVolumeModel(void); +/* Change current volumes model (Applying on stop/play) */ +extern DECLSPEC void SDLCALL Mix_ADLMIDI_setVolumeModel(int vm); +/* Get full range mode for CC74-Brightness controller */ +extern DECLSPEC int SDLCALL Mix_ADLMIDI_getFullRangeBrightness(void); +/* Set full range mode for CC74-Brightness controller */ +extern DECLSPEC void SDLCALL Mix_ADLMIDI_setFullRangeBrightness(int frb); +/* Get the current OPL3 Emulator for ADLMIDI */ +extern DECLSPEC int SDLCALL Mix_ADLMIDI_getEmulator(void); +/* Select the OPL3 Emulator for ADLMIDI */ +extern DECLSPEC void SDLCALL Mix_ADLMIDI_setEmulator(int emu); +/* Reset all ADLMIDI properties to default state */ +extern DECLSPEC void SDLCALL Mix_ADLMIDI_setSetDefaults(void); + +/* Sets WOPL bank file for ADLMIDI playing device, affects on MIDI file reopen */ +extern DECLSPEC void SDLCALL Mix_ADLMIDI_setCustomBankFile(const char *bank_wonl_path); + +/* Reset all OPNMIDI properties to default state */ +extern DECLSPEC void SDLCALL Mix_OPNMIDI_setSetDefaults(void); +/* Get full range mode for CC74-Brightness controller */ +extern DECLSPEC int SDLCALL Mix_OPNMIDI_getFullRangeBrightness(void); +/* Set full range mode for CC74-Brightness controller */ +extern DECLSPEC void SDLCALL Mix_OPNMIDI_setFullRangeBrightness(int frb); +/* Get the OPN2 Emulator for OPNMIDI */ +extern DECLSPEC int SDLCALL Mix_OPNMIDI_getEmulator(void); +/* Select the OPN2 Emulator for OPNMIDI */ +extern DECLSPEC void SDLCALL Mix_OPNMIDI_setEmulator(int emu); +/* Sets WOPN bank file for OPNMIDI playing device, affects on MIDI file reopen */ +extern DECLSPEC void SDLCALL Mix_OPNMIDI_setCustomBankFile(const char *bank_wonp_path); + +/* Get type of MIDI player library currently in use */ +extern DECLSPEC int SDLCALL Mix_GetMidiPlayer(void); + +/* Get type of MIDI player library prepared for next opening of MIDI file */ +extern DECLSPEC int SDLCALL Mix_GetNextMidiPlayer(void); + +/* Set the MIDI playing library (ADLMIDI, Timidity, Native MIDI (if available) and FluidSynth) */ +extern DECLSPEC int SDLCALL Mix_SetMidiPlayer(int player); + +/* Disables support of MIDI file arguments */ +extern DECLSPEC void SDLCALL Mix_SetLockMIDIArgs(int lock_midiargs); + +/* DEPRECATED NAMES for new-added SDL Mixer X functions + Those names are made with mistake - beginning with "MIX_" than "Mix_" + which makes confusion when you looking for Mix_ function in your IDE + because some applications are still use them, to don't break ABI we will keep those + aliases until we will remove all usages of them from applications and libraries are used them +*/ +DEPRECATED(extern DECLSPEC int SDLCALL Mix_GetMidiDevice(void)); +DEPRECATED(extern DECLSPEC int SDLCALL Mix_GetNextMidiDevice(void)); +DEPRECATED(extern DECLSPEC int SDLCALL Mix_SetMidiDevice(int player)); + +/* We'll use SDL for reporting errors */ +#define Mix_SetError SDL_SetError +#define Mix_GetError SDL_GetError +#define Mix_ClearError SDL_ClearError + +/* Ends C function definitions when using C++ */ +#ifdef __cplusplus +} +#endif +#include "close_code.h" + +#endif /* SDL_MIXER_H_ */ + +/* vi: set ts=4 sw=4 expandtab: */ diff --git a/libs/SDLMixerX/x86_64-w64-mingw32/include/SDL2/begin_code.h b/libs/SDLMixerX/x86_64-w64-mingw32/include/SDL2/begin_code.h new file mode 100644 index 000000000..6c2106246 --- /dev/null +++ b/libs/SDLMixerX/x86_64-w64-mingw32/include/SDL2/begin_code.h @@ -0,0 +1,167 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2018 Sam Lantinga + + 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. +*/ + +/** + * \file begin_code.h + * + * This file sets things up for C dynamic library function definitions, + * static inlined functions, and structures aligned at 4-byte alignment. + * If you don't like ugly C preprocessor code, don't look at this file. :) + */ + +/* This shouldn't be nested -- included it around code only. */ +#ifdef _begin_code_h +#error Nested inclusion of begin_code.h +#endif +#define _begin_code_h + +#ifndef SDL_DEPRECATED +# if (__GNUC__ >= 4) /* technically, this arrived in gcc 3.1, but oh well. */ +# define SDL_DEPRECATED __attribute__((deprecated)) +# else +# define SDL_DEPRECATED +# endif +#endif + +#ifndef SDL_UNUSED +# ifdef __GNUC__ +# define SDL_UNUSED __attribute__((unused)) +# else +# define SDL_UNUSED +# endif +#endif + +/* Some compilers use a special export keyword */ +#ifndef DECLSPEC +# if defined(__WIN32__) || defined(__WINRT__) +# ifdef __BORLANDC__ +# ifdef BUILD_SDL +# define DECLSPEC +# else +# define DECLSPEC __declspec(dllimport) +# endif +# else +# define DECLSPEC __declspec(dllexport) +# endif +# elif defined(__OS2__) +# ifdef BUILD_SDL +# define DECLSPEC __declspec(dllexport) +# else +# define DECLSPEC +# endif +# else +# if defined(__GNUC__) && __GNUC__ >= 4 +# define DECLSPEC __attribute__ ((visibility("default"))) +# else +# define DECLSPEC +# endif +# endif +#endif + +/* By default SDL uses the C calling convention */ +#ifndef SDLCALL +#if (defined(__WIN32__) || defined(__WINRT__)) && !defined(__GNUC__) +#define SDLCALL __cdecl +#elif defined(__OS2__) || defined(__EMX__) +#define SDLCALL _System +# if defined (__GNUC__) && !defined(_System) +# define _System /* for old EMX/GCC compat. */ +# endif +#else +#define SDLCALL +#endif +#endif /* SDLCALL */ + +/* Removed DECLSPEC on Symbian OS because SDL cannot be a DLL in EPOC */ +#ifdef __SYMBIAN32__ +#undef DECLSPEC +#define DECLSPEC +#endif /* __SYMBIAN32__ */ + +/* Force structure packing at 4 byte alignment. + This is necessary if the header is included in code which has structure + packing set to an alternate value, say for loading structures from disk. + The packing is reset to the previous value in close_code.h + */ +#if defined(_MSC_VER) || defined(__MWERKS__) || defined(__BORLANDC__) +#ifdef _MSC_VER +#pragma warning(disable: 4103) +#endif +#ifdef __BORLANDC__ +#pragma nopackwarning +#endif +#ifdef _M_X64 +/* Use 8-byte alignment on 64-bit architectures, so pointers are aligned */ +#pragma pack(push,8) +#else +#pragma pack(push,4) +#endif +#endif /* Compiler needs structure packing set */ + +#ifndef SDL_INLINE +#if defined(__GNUC__) +#define SDL_INLINE __inline__ +#elif defined(_MSC_VER) || defined(__BORLANDC__) || \ + defined(__DMC__) || defined(__SC__) || \ + defined(__WATCOMC__) || defined(__LCC__) || \ + defined(__DECC) || defined(__CC_ARM) +#define SDL_INLINE __inline +#ifndef __inline__ +#define __inline__ __inline +#endif +#else +#define SDL_INLINE inline +#ifndef __inline__ +#define __inline__ inline +#endif +#endif +#endif /* SDL_INLINE not defined */ + +#ifndef SDL_FORCE_INLINE +#if defined(_MSC_VER) +#define SDL_FORCE_INLINE __forceinline +#elif ( (defined(__GNUC__) && (__GNUC__ >= 4)) || defined(__clang__) ) +#define SDL_FORCE_INLINE __attribute__((always_inline)) static __inline__ +#else +#define SDL_FORCE_INLINE static SDL_INLINE +#endif +#endif /* SDL_FORCE_INLINE not defined */ + +#ifndef SDL_NORETURN +#if defined(__GNUC__) +#define SDL_NORETURN __attribute__((noreturn)) +#elif defined(_MSC_VER) +#define SDL_NORETURN __declspec(noreturn) +#else +#define SDL_NORETURN +#endif +#endif /* SDL_NORETURN not defined */ + +/* Apparently this is needed by several Windows compilers */ +#if !defined(__MACH__) +#ifndef NULL +#ifdef __cplusplus +#define NULL 0 +#else +#define NULL ((void *)0) +#endif +#endif /* NULL */ +#endif /* ! Mac OS X - breaks precompiled headers */ diff --git a/libs/SDLMixerX/x86_64-w64-mingw32/include/SDL2/close_code.h b/libs/SDLMixerX/x86_64-w64-mingw32/include/SDL2/close_code.h new file mode 100644 index 000000000..b3b70a4c8 --- /dev/null +++ b/libs/SDLMixerX/x86_64-w64-mingw32/include/SDL2/close_code.h @@ -0,0 +1,37 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2018 Sam Lantinga + + 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. +*/ + +/** + * \file close_code.h + * + * This file reverses the effects of begin_code.h and should be included + * after you finish any function and structure declarations in your headers + */ + +#undef _begin_code_h + +/* Reset structure packing at previous byte alignment */ +#if defined(_MSC_VER) || defined(__MWERKS__) || defined(__BORLANDC__) +#ifdef __BORLANDC__ +#pragma nopackwarning +#endif +#pragma pack(pop) +#endif /* Compiler needs structure packing set */ diff --git a/libs/SDLMixerX/x86_64-w64-mingw32/lib/libSDL2_mixer_ext.dll.a b/libs/SDLMixerX/x86_64-w64-mingw32/lib/libSDL2_mixer_ext.dll.a new file mode 100644 index 000000000..c1cede98d Binary files /dev/null and b/libs/SDLMixerX/x86_64-w64-mingw32/lib/libSDL2_mixer_ext.dll.a differ diff --git a/libs/dll-binaries/i686/libgme.dll b/libs/dll-binaries/i686/libgme.dll index ddf8b0d82..9a31bc4d2 100644 Binary files a/libs/dll-binaries/i686/libgme.dll and b/libs/dll-binaries/i686/libgme.dll differ diff --git a/libs/dll-binaries/x86_64/libgme.dll b/libs/dll-binaries/x86_64/libgme.dll index 2ba99450f..598c2d71c 100644 Binary files a/libs/dll-binaries/x86_64/libgme.dll and b/libs/dll-binaries/x86_64/libgme.dll differ diff --git a/libs/gme/CMakeLists.txt b/libs/gme/CMakeLists.txt index 8beee872f..392b01856 100644 --- a/libs/gme/CMakeLists.txt +++ b/libs/gme/CMakeLists.txt @@ -4,7 +4,7 @@ project(libgme) include (CheckCXXCompilerFlag) # When version is changed, also change the one in gme/gme.h to match -set(GME_VERSION 0.6.0 CACHE INTERNAL "libgme Version") +set(GME_VERSION 0.6.2 CACHE INTERNAL "libgme Version") # 2.6+ always assumes FATAL_ERROR, but 2.4 and below don't. # Of course, 2.4 might work, in which case you're welcome to drop @@ -57,6 +57,8 @@ if (USE_GME_NSFE AND NOT USE_GME_NSF) SET(USE_GME_NSF 1 CACHE BOOL "Enable NES NSF music emulation" FORCE) endif() +option(BUILD_SHARED_LIBS "Build shared library (set to OFF for static library)" ON) + # Check for GCC "visibility" support. if (CMAKE_COMPILER_IS_GNUCXX) check_cxx_compiler_flag (-fvisibility=hidden __LIBGME_TEST_VISIBILITY) @@ -79,10 +81,10 @@ if (CMAKE_COMPILER_IS_GNUCXX) endif() endif() endif() # test visibility -endif (CMAKE_COMPILER_IS_GNUCXX) -# Cache this result -set( LIBGME_HAVE_GCC_VISIBILITY ${ENABLE_VISIBILITY} CACHE BOOL "GCC support for hidden visibility") + # Cache this result + set( LIBGME_HAVE_GCC_VISIBILITY ${ENABLE_VISIBILITY} CACHE BOOL "GCC support for hidden visibility") +endif (CMAKE_COMPILER_IS_GNUCXX) # Shared library defined here add_subdirectory(gme) diff --git a/libs/gme/changes.txt b/libs/gme/changes.txt index 62391ebb5..034ba4821 100644 --- a/libs/gme/changes.txt +++ b/libs/gme/changes.txt @@ -1,262 +1,5 @@ Game_Music_Emu Change Log ------------------------- -Game_Music_Emu 0.6.0 --------------------- - -- Note: A 0.5.6 release was referenced but never tagged or packaged. - -- SPC improvements: - - Switched to newer snes_spc 0.9.0 for SPC emulation. Uses fast DSP. - - Fixed Spc_Emu::gain(). - - Fixed support for files <0x10200 bytes. - -- Other bugfixes: - - Fixed a couple of GBS bugs, one involving access of memory after - realloc. - - Blip_Buffer works on systems where 'double' is a single-precision - floating-point type. - - Fix uninitialized buffer size in dual_resampler. - - Compilation warnings squashed out as of clang 3.3-pre and gcc 4.7.2. - -- API changes/additions: - - Removed documentation of C++ interface, as the C interface in gme.h is - the only supported one. - - Added gme_enable_accuracy() for enabling more accurate sound emulation - options (currently affects SPC only). - -- Build system improvements: - - Add pkg_config support. - - Fix build on case-insensitive systems. - - Allow for install on Cygwin. - - Fix install on multilib systems, such as many 64-bit distros (CMake must - be able to figure out your system's libsuffix, if any). - - C++ implementation symbols are not leaked into the resultant library - file (requires symbol visibility support). - -- Sample player improvements: - - Can toggle fast/accurate emulation (with the 'A' key). - -Game_Music_Emu 0.5.5 --------------------- -- CMake build support has been added. You can build Game_Music_Emu as -a shared library and install it so that you do not have to include your -own copy if you know libgme will be present on your target system. -Requires CMake 2.6 or higher. - - -Game_Music_Emu 0.5.2 --------------------- -- *TONS* of changes and improvements. You should re-read the new header -files and documentation as the changes will allow you to simplify your -code a lot (it might even be simpler to just rewrite it). Existing code -should continue to work without changes in most cases (see Deprecated -features in gme.txt). - -- New file formats: AY, HES, KSS, SAP, NSFE - -- All-new comprehensive C interface (also usable from C++). Simplifies -many things, especially file loading, and brings everything together in -one header file (gme.h). - -- Information tags and track names and times can be accessed for all -game music formats - -- New features supported by all emulators: end of track fading, -automatic silence detection, adjustable song tempo, seek to new time in -track - -- Updated mini player example to support track names and times, echo, -tempo, and channel muting, and added visual waveform display - -- Improved configuration to use blargg_config.h, which you can modify -and keep when you update to a newer libary version. Includes flag for -library to automatically handle gzipped files using zlib (so you don't -need to use Gzip_File_Reader anymore). - -- GBS: Fixed wave channel to not reset waveform when APU is powered off -(affected Garfield). Also improved invalid bank selection (affected Game -& Watch and others). - -- VGM: Added support for alternate noise shifter register -configurations, used by other systems like the BBC Micro. - -- SPC: Removed IPL ROM dump from emulator, as none of the SPC files I -scanned needed it, and an SPC file can include a copy if necessary. Also -re-enabled supposed clamping in gaussian interpolation between the third -and fourth lookups, though I don't know whether it matters - -- Added Music_Emu::load_mem() to use music data already in memory -(without copying it) - -- Added Music_Emu::warning(), which reports minor problems when loading -and playing a music file - -- Added Music_Emu::set_gain() for uniform adjustment of gain. Can only -be set during initialization, so not useful as a general volume control. - -- Added custom operator new to ensure that no exceptions are thrown in -the library (I'd use std::nothrow if it were part of pre-ISO (ARM) C++) - -- Added BLIP_BUFFER_FAST flag to blargg_config.h to use a lower quality -bandlimited synthesis in "classic" emulators, which might help -performance on ancient processors (measure first!). Don't use this -unless absolutely necessary, as quality suffers. - -- Improved performance a bit for x86 platforms - -- Text files now in DOS newline format so they will open in Notepad -properly - -- Removed requirement that file header structures not have any padding -added to the end - -- Fixed common bug in all CPU emulators where negative program counter -could crash emulator (occurred during a negative branch from the -beginning of memory). Also fixed related bug in Z80 emulator for -IX/IY+displacement mode. - -- Eliminated all warnings when compiling on gcc 4.0. The following -generates no diagnostics: - - gcc -S gme/*.cpp -o /dev/null -ansi -fno-gnu-keywords - -fno-nonansi-builtins -pedantic -W -Wabi -Wall -Wcast-align - -Wcast-qual -Wchar-subscripts -Wdisabled-optimization -Werror - -Winline -Wlong-long -Wmultichar -Winvalid-offsetof - -Wnon-virtual-dtor -Woverloaded-virtual -Wparentheses - -Wpointer-arith -Wredundant-decls -Wreorder -Wsign-compare - -Wsign-promo -Wunknown-pragmas -Wwrite-strings - - -Game_Music_Emu 0.3.0 --------------------- -- Added more demos, including music player using the SDL multimedia -library for sound, and improved documentation - -- All: Improved interface to emulators to allow simpler setup and -loading. Instead of various init() functions, all now support -set_sample_rate( long rate ) and load( const char* file_path ). - -- All: Removed error return from start_track() and play(), and added -error_count() to get the total number of emulation errors since the -track was last started. See demos for examples of new usage. - -- All: Fixed mute_voices() muting to be preserved after loading files -and starting tracks, instead of being cleared as it was whenever a track -was started - -- VGM: Rewrote Vgm_Emu to support Sega Genesis/Mega Drive FM sound at -any sample rate with optional FM oversampling, support for alternate -YM2612 sound cores, and support for optional YM2413 - -- VGM: Added tempo control, useful for slowing 60Hz NTSC Sega Genesis -music to 50Hz PAL - -- VGM: Removed Vgm_Emu::track_data(), since I realized that this -information is already present in the VGM header (oops!) - -- GYM: Changed Gym_Emu::track_length() operation (see Gym_Emu.h) - -- NSF: Added support for Sunsoft FME-7 sound chip used by Gimmick -soundtrack - -- NSF: Fixed Namco 106 problems with Final Lap and others - -- Moved library sources to gme/ directory to reduce clutter, and merged -boost/ functionality into blargg_common.h - -- Added Gzip_File_Reader for transparently using gzipped files - - -Game_Music_Emu 0.2.4 --------------------- -- Created a discussion forum for problems and feedback: -http://groups-beta.google.com/group/blargg-sound-libs - -- Changed error return value of Blip_Buffer::sample_rate() (also for -Stereo_Buffer, Effects_Buffer, etc.) to blargg_err_t (defined in -blargg_common.h), to make error reporting consistent with other -functions. This means the "no error" return value is the opposite of -what it was before, which will break current code which checks the error -return value: - - // current code (broken) - if ( !buf.sample_rate( samples_per_sec ) ) - out_of_memory(); - - // quick-and-dirty fix (just remove the ! operation) - if ( buf.sample_rate( samples_per_sec ) ) - out_of_memory(); - - // proper fix - blargg_err_t error = buf.sample_rate( samples_per_sec ); - if ( error ) - report_error( error ); - -- Implemented workaround for MSVC++ 6 compiler limitations, allowing it -to work on that compiler again - -- Added sample clamping to avoid wrap-around at high volumes, allowing -higher volume with little distortion - -- Added to-do list and design notes - -- Added Music_Emu::skip( long sample_count ) to skip ahead in current -track - -- Added Gym_Emu::track_length() and Vgm_Emu::track_length() for -determining the length of non-looped GYM and VGM files - -- Partially implemented DMC non-linearity when its value is directly set -using $4011, which reduces previously over-emphasized "popping" of -percussion on some games (TMNT II in particular) - -- Fixed Fir_Resampler, used for SPC and GYM playback (was incorrectly -using abs() instead of fabs()...argh) - -- Fixed SPC emulation bugs: eliminated clicks in Plok! soundtrack and -now stops sample slightly earlier than the end, as the SNES does. Fixed -a totally broken CPU addressing mode. - -- Fixed Konami VRC6 saw wave (was very broken before). Now VRC6 music -sounds decent - -- Fixed a minor GBS emulation bug - -- Fixed GYM loop point bug when track was restarted before loop point -had been reached - -- Made default GBS frequency equalization less muffled - -- Added pseudo-surround effect removal for SPC files - -- Added Music_Emu::voice_names() which returns names for each voice. - -- Added BLARGG_SOURCE_BEGIN which allows custom compiler options to be -easily set for library sources - -- Changed assignment of expansion sound chips in Nsf_Emu to be spread -more evenly when using Effects_Buffer - -- Changed 'size_t' values in Blip_Buffer interface to 'long' - -- Changed demo to generate a WAVE sound file rather than an AIFF file - - -Game_Music_Emu 0.2.0 --------------------- -- Redid framework and rewrote/cleaned up emulators - -- Changed licensing to GNU Lesser General Public License (LGPL) - -- Added Sega Genesis GYM and Super Nintendo SPC emulators - -- Added Namco-106 and Konami VRC6 sound chip support to NSF emulator - -- Eliminated use of static mutable data in emulators, allowing -multi-instance safety - - -Game_Music_Emu 0.1.0 --------------------- -- First release +Please see the git version history (e.g. git shortlog tags/0.6.0..tags/0.6.1) +for the accurate change log. diff --git a/libs/gme/demo/basics.c b/libs/gme/demo/basics.c index 551782518..741574afe 100644 --- a/libs/gme/demo/basics.c +++ b/libs/gme/demo/basics.c @@ -1,7 +1,5 @@ /* C example that opens a game music file and records 10 seconds to "out.wav" */ -static char filename [] = "test.nsf"; /* opens this file (can be any music type) */ - #include "gme/gme.h" #include "Wave_Writer.h" /* wave_ functions for writing sound file */ @@ -10,10 +8,15 @@ static char filename [] = "test.nsf"; /* opens this file (can be any music type) void handle_error( const char* str ); -int main() +int main(int argc, char *argv[]) { + const char *filename = "test.nsf"; /* Default file to open */ + if ( argc >= 2 ) + filename = argv[1]; + long sample_rate = 44100; /* number of samples per second */ - int track = 0; /* index of track to play (0 = first) */ + /* index of track to play (0 = first) */ + int track = argc >= 3 ? atoi(argv[2]) : 0; /* Open music file in new emulator */ Music_Emu* emu; diff --git a/libs/gme/demo/cpp_basics.cpp b/libs/gme/demo/cpp_basics.cpp index 53fab4186..5222fe271 100644 --- a/libs/gme/demo/cpp_basics.cpp +++ b/libs/gme/demo/cpp_basics.cpp @@ -1,7 +1,5 @@ // C++ example that opens a game music file and records 10 seconds to "out.wav" -static char filename [] = "test.nsf"; /* opens this file (can be any music type) */ - #include "gme/Music_Emu.h" #include "Wave_Writer.h" @@ -10,10 +8,15 @@ static char filename [] = "test.nsf"; /* opens this file (can be any music type) void handle_error( const char* str ); -int main() +int main(int argc, char *argv[]) { + const char *filename = "test.nsf"; /* Default file to open */ + if ( argc >= 2 ) + filename = argv[1]; + long sample_rate = 44100; // number of samples per second - int track = 0; // index of track to play (0 = first) + // index of track to play (0 = first) + int track = argc >= 3 ? atoi(argv[2]) : 0; // Determine file type gme_type_t file_type; diff --git a/libs/gme/gme.txt b/libs/gme/gme.txt index d9a2452c7..5a7d2f560 100644 --- a/libs/gme/gme.txt +++ b/libs/gme/gme.txt @@ -1,10 +1,10 @@ -Game_Music_Emu 0.6.0 +Game_Music_Emu 0.6.2 -------------------- -Author : Shay Green -Website: http://www.slack.net/~ant/libs/ -Forum : http://groups.google.com/group/blargg-sound-libs -Source : https://code.google.com/p/game-music-emu/ -License: GNU Lesser General Public License (LGPL) +Author : Shay Green +Maintainer : Michael Pyne +Website : https://bitbucket.org/mpyne/game-music-emu/ +Source : https://bitbucket.org/mpyne/game-music-emu/ +License : GNU Lesser General Public License (LGPL), see LICENSE.txt Contents -------- diff --git a/libs/gme/gme/CMakeLists.txt b/libs/gme/gme/CMakeLists.txt index 3c6464fc7..534be8a85 100644 --- a/libs/gme/gme/CMakeLists.txt +++ b/libs/gme/gme/CMakeLists.txt @@ -143,7 +143,7 @@ add_definitions(-DBLARGG_BUILD_DLL) include_directories(${CMAKE_CURRENT_BINARY_DIR}) # Add library to be compiled. -add_library(gme SHARED ${libgme_SRCS}) +add_library(gme ${libgme_SRCS}) # The version is the release. The "soversion" is the API version. As long # as only build fixes are performed (i.e. no backwards-incompatible changes @@ -159,4 +159,4 @@ install(TARGETS gme LIBRARY DESTINATION lib${LIB_SUFFIX} ARCHIVE DESTINATION lib) # DLL platforms install(FILES ${EXPORTED_HEADERS} DESTINATION include/gme) -install(FILES ${CMAKE_CURRENT_BINARY_DIR}/libgme.pc DESTINATION lib/pkgconfig) +install(FILES ${CMAKE_CURRENT_BINARY_DIR}/libgme.pc DESTINATION lib${LIB_SUFFIX}/pkgconfig) diff --git a/libs/gme/gme/Data_Reader.cpp b/libs/gme/gme/Data_Reader.cpp index 5bbfbf551..f18928f4b 100644 --- a/libs/gme/gme/Data_Reader.cpp +++ b/libs/gme/gme/Data_Reader.cpp @@ -22,8 +22,13 @@ Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ const char Data_Reader::eof_error [] = "Unexpected end of file"; +#define RETURN_VALIDITY_CHECK( cond ) \ + do { if ( unlikely( !(cond) ) ) return "Corrupt file"; } while(0) + blargg_err_t Data_Reader::read( void* p, long s ) { + RETURN_VALIDITY_CHECK( s > 0 ); + long result = read_avail( p, s ); if ( result != s ) { @@ -38,6 +43,8 @@ blargg_err_t Data_Reader::read( void* p, long s ) blargg_err_t Data_Reader::skip( long count ) { + RETURN_VALIDITY_CHECK( count >= 0 ); + char buf [512]; while ( count ) { @@ -54,7 +61,8 @@ long File_Reader::remain() const { return size() - tell(); } blargg_err_t File_Reader::skip( long n ) { - assert( n >= 0 ); + RETURN_VALIDITY_CHECK( n >= 0 ); + if ( !n ) return 0; return seek( tell() + n ); @@ -67,13 +75,14 @@ Subset_Reader::Subset_Reader( Data_Reader* dr, long size ) in = dr; remain_ = dr->remain(); if ( remain_ > size ) - remain_ = size; + remain_ = max( 0l, size ); } long Subset_Reader::remain() const { return remain_; } long Subset_Reader::read_avail( void* p, long s ) { + s = max( 0l, s ); if ( s > remain_ ) s = remain_; remain_ -= s; @@ -85,7 +94,7 @@ long Subset_Reader::read_avail( void* p, long s ) Remaining_Reader::Remaining_Reader( void const* h, long size, Data_Reader* r ) { header = (char const*) h; - header_end = header + size; + header_end = header + max( 0l, size ); in = r; } @@ -93,6 +102,7 @@ long Remaining_Reader::remain() const { return header_end - header + in->remain( long Remaining_Reader::read_first( void* out, long count ) { + count = max( 0l, count ); long first = header_end - header; if ( first ) { @@ -107,8 +117,9 @@ long Remaining_Reader::read_first( void* out, long count ) long Remaining_Reader::read_avail( void* out, long count ) { + count = max( 0l, count ); long first = read_first( out, count ); - long second = count - first; + long second = max( 0l, count - first ); if ( second ) { second = in->read_avail( (char*) out + first, second ); @@ -120,8 +131,9 @@ long Remaining_Reader::read_avail( void* out, long count ) blargg_err_t Remaining_Reader::read( void* out, long count ) { + count = max( 0l, count ); long first = read_first( out, count ); - long second = count - first; + long second = max( 0l, count - first ); if ( !second ) return 0; return in->read( (char*) out + first, second ); @@ -131,7 +143,7 @@ blargg_err_t Remaining_Reader::read( void* out, long count ) Mem_File_Reader::Mem_File_Reader( const void* p, long s ) : begin( (const char*) p ), - size_( s ) + size_( max( 0l, s ) ) { pos = 0; } @@ -141,6 +153,7 @@ long Mem_File_Reader::size() const { return size_; } long Mem_File_Reader::read_avail( void* p, long s ) { long r = remain(); + s = max( 0l, s ); if ( s > r ) s = r; memcpy( p, begin + pos, s ); @@ -152,6 +165,7 @@ long Mem_File_Reader::tell() const { return pos; } blargg_err_t Mem_File_Reader::seek( long n ) { + RETURN_VALIDITY_CHECK( n >= 0 ); if ( n > size_ ) return eof_error; pos = n; @@ -164,7 +178,7 @@ Callback_Reader::Callback_Reader( callback_t c, long size, void* d ) : callback( c ), data( d ) { - remain_ = size; + remain_ = max( 0l, size ); } long Callback_Reader::remain() const { return remain_; } @@ -173,13 +187,14 @@ long Callback_Reader::read_avail( void* out, long count ) { if ( count > remain_ ) count = remain_; - if ( Callback_Reader::read( out, count ) ) + if ( count < 0 || Callback_Reader::read( out, count ) ) count = -1; return count; } blargg_err_t Callback_Reader::read( void* out, long count ) { + RETURN_VALIDITY_CHECK( count >= 0 ); if ( count > remain_ ) return eof_error; return callback( data, out, count ); @@ -210,11 +225,12 @@ long Std_File_Reader::size() const long Std_File_Reader::read_avail( void* p, long s ) { - return fread( p, 1, s, (FILE*) file_ ); + return fread( p, 1, max( 0l, s ), (FILE*) file_ ); } blargg_err_t Std_File_Reader::read( void* p, long s ) { + RETURN_VALIDITY_CHECK( s > 0 ); if ( s == (long) fread( p, 1, s, (FILE*) file_ ) ) return 0; if ( feof( (FILE*) file_ ) ) diff --git a/libs/gme/gme/Data_Reader.h b/libs/gme/gme/Data_Reader.h index acf571f67..6c22b678e 100644 --- a/libs/gme/gme/Data_Reader.h +++ b/libs/gme/gme/Data_Reader.h @@ -129,6 +129,8 @@ private: }; #ifdef HAVE_ZLIB_H +#include + // Gzip compressed file reader class Gzip_File_Reader : public File_Reader { public: @@ -143,7 +145,7 @@ public: long tell() const; blargg_err_t seek( long ); private: - void* file_; + gzFile file_; long size_; }; #endif diff --git a/libs/gme/gme/Music_Emu.cpp b/libs/gme/gme/Music_Emu.cpp index 30b25dcfc..942e86e27 100644 --- a/libs/gme/gme/Music_Emu.cpp +++ b/libs/gme/gme/Music_Emu.cpp @@ -178,6 +178,11 @@ blargg_long Music_Emu::msec_to_samples( blargg_long msec ) const return (sec * sample_rate() + msec * sample_rate() / 1000) * stereo; } +long Music_Emu::tell_samples() const +{ + return out_time; +} + long Music_Emu::tell() const { blargg_long rate = sample_rate() * stereo; @@ -185,14 +190,18 @@ long Music_Emu::tell() const return sec * 1000 + (out_time - sec * rate) * 1000 / rate; } -blargg_err_t Music_Emu::seek( long msec ) +blargg_err_t Music_Emu::seek_samples( long time ) { - blargg_long time = msec_to_samples( msec ); if ( time < out_time ) RETURN_ERR( start_track( current_track_ ) ); return skip( time - out_time ); } +blargg_err_t Music_Emu::seek( long msec ) +{ + return seek_samples( msec_to_samples( msec ) ); +} + blargg_err_t Music_Emu::skip( long count ) { require( current_track() >= 0 ); // start_track() must have been called already diff --git a/libs/gme/gme/Music_Emu.h b/libs/gme/gme/Music_Emu.h index b96f4b611..d98f7ce7e 100644 --- a/libs/gme/gme/Music_Emu.h +++ b/libs/gme/gme/Music_Emu.h @@ -41,9 +41,15 @@ public: // Number of milliseconds (1000 msec = 1 second) played since beginning of track long tell() const; + // Number of samples generated since beginning of track + long tell_samples() const; + // Seek to new time in track. Seeking backwards or far forward can take a while. blargg_err_t seek( long msec ); + // Equivalent to restarting track then skipping n samples + blargg_err_t seek_samples( long n ); + // Skip n samples blargg_err_t skip( long n ); diff --git a/libs/gme/gme/Nsfe_Emu.cpp b/libs/gme/gme/Nsfe_Emu.cpp index 824a1a240..55ac4688f 100644 --- a/libs/gme/gme/Nsfe_Emu.cpp +++ b/libs/gme/gme/Nsfe_Emu.cpp @@ -134,6 +134,9 @@ blargg_err_t Nsfe_Info::load( Data_Reader& in, Nsf_Emu* nsf_emu ) RETURN_ERR( in.read( block_header, sizeof block_header ) ); blargg_long size = get_le32( block_header [0] ); blargg_long tag = get_le32( block_header [1] ); + + if ( size <= 0 ) + return "Corrupt file"; //debug_printf( "tag: %c%c%c%c\n", char(tag), char(tag>>8), char(tag>>16), char(tag>>24) ); diff --git a/libs/gme/gme/Spc_Cpu.cpp b/libs/gme/gme/Spc_Cpu.cpp index 90f60ed29..19aae1135 100644 --- a/libs/gme/gme/Spc_Cpu.cpp +++ b/libs/gme/gme/Spc_Cpu.cpp @@ -433,9 +433,7 @@ void Snes_Spc::cpu_write( int data, int addr, rel_time_t time ) #endif // Registers other than $F2 and $F4-$F7 - //if ( reg != 2 && reg != 4 && reg != 5 && reg != 6 && reg != 7 ) - // TODO: this is a bit on the fragile side - if ( ((~0x2F00 << (bits_in_int - 16)) << reg) < 0 ) // 36% + if ( reg != 2 && (reg < 4 || reg > 7) ) // 36% cpu_write_smp_reg( data, time, reg ); } // High mem/address wrap-around diff --git a/libs/gme/gme/Spc_Cpu.h b/libs/gme/gme/Spc_Cpu.h index 4742e0990..10c245090 100644 --- a/libs/gme/gme/Spc_Cpu.h +++ b/libs/gme/gme/Spc_Cpu.h @@ -76,8 +76,8 @@ Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ // TODO: remove non-wrapping versions? #define SPC_NO_SP_WRAPAROUND 0 -#define SET_SP( v ) (sp = ram + 0x101 + (v)) -#define GET_SP() (sp - 0x101 - ram) +#define SET_SP( v ) (sp = ram + 0x101 + ((uint8_t) v)) +#define GET_SP() (uint8_t (sp - 0x101 - ram)) #if SPC_NO_SP_WRAPAROUND #define PUSH16( v ) (sp -= 2, SET_LE16( sp, v )) @@ -485,7 +485,7 @@ loop: case 0xAF: // MOV (X)+,A WRITE_DP( 0, x, a + no_read_before_write ); - x++; + x = (uint8_t) (x + 1); goto loop; // 5. 8-BIT LOGIC OPERATION COMMANDS @@ -808,7 +808,7 @@ loop: unsigned temp = y * a; a = (uint8_t) temp; nz = ((temp >> 1) | temp) & 0x7F; - y = temp >> 8; + y = (uint8_t) (temp >> 8); nz |= y; goto loop; } @@ -838,6 +838,7 @@ loop: nz = (uint8_t) a; a = (uint8_t) a; + y = (uint8_t) y; goto loop; } @@ -1004,7 +1005,7 @@ loop: case 0x7F: // RET1 temp = *sp; SET_PC( GET_LE16( sp + 1 ) ); - sp += 3; + SET_SP( GET_SP() + 3 ); goto set_psw; case 0x8E: // POP PSW POP( temp ); diff --git a/libs/gme/gme/blargg_source.h b/libs/gme/gme/blargg_source.h index b011777ad..b65afd30b 100644 --- a/libs/gme/gme/blargg_source.h +++ b/libs/gme/gme/blargg_source.h @@ -18,6 +18,19 @@ all other #include lines. */ #undef require #define require( expr ) assert( expr ) +// Use to provide hints to compiler for optimized code layout in situations where we +// can almost always expect a conditional to go one way or the other. Should only be +// used in situations where an unexpected branch is truly exceptional though! +#undef likely +#undef unlikely +#ifdef __GNUC__ + #define likely( x ) __builtin_expect(x, 1) + #define unlikely( x ) __builtin_expect(x, 0) +#else + #define likely( x ) (x) + #define unlikely( x ) (x) +#endif + // Like printf() except output goes to debug log file. Might be defined to do // nothing (not even evaluate its arguments). // void debug_printf( const char* format, ... ); diff --git a/libs/gme/gme/gme.cpp b/libs/gme/gme/gme.cpp index c05f25eb4..47709840a 100644 --- a/libs/gme/gme/gme.cpp +++ b/libs/gme/gme/gme.cpp @@ -337,7 +337,9 @@ BLARGG_EXPORT gme_err_t gme_play ( Music_Emu* me, int n, short* p ) BLARGG_EXPORT void gme_set_fade ( Music_Emu* me, int start_msec ) { me->set_fade( start_msec ); } BLARGG_EXPORT int gme_track_ended ( Music_Emu const* me ) { return me->track_ended(); } BLARGG_EXPORT int gme_tell ( Music_Emu const* me ) { return me->tell(); } +BLARGG_EXPORT int gme_tell_samples ( Music_Emu const* me ) { return me->tell_samples(); } BLARGG_EXPORT gme_err_t gme_seek ( Music_Emu* me, int msec ) { return me->seek( msec ); } +BLARGG_EXPORT gme_err_t gme_seek_samples ( Music_Emu* me, int n ) { return me->seek_samples( n ); } BLARGG_EXPORT int gme_voice_count ( Music_Emu const* me ) { return me->voice_count(); } BLARGG_EXPORT void gme_ignore_silence ( Music_Emu* me, int disable ) { me->ignore_silence( disable != 0 ); } BLARGG_EXPORT void gme_set_tempo ( Music_Emu* me, double t ) { me->set_tempo( t ); } diff --git a/libs/gme/gme/gme.h b/libs/gme/gme/gme.h index 1f2a2d150..cb07061b4 100644 --- a/libs/gme/gme/gme.h +++ b/libs/gme/gme/gme.h @@ -1,6 +1,6 @@ /* Game music emulator library C interface (also usable from C++) */ -/* Game_Music_Emu 0.6.0 */ +/* Game_Music_Emu 0.6.1 */ #ifndef GME_H #define GME_H @@ -8,7 +8,7 @@ extern "C" { #endif -#define GME_VERSION 0x000600 /* 1 byte major, 1 byte minor, 1 byte patch-level */ +#define GME_VERSION 0x000601 /* 1 byte major, 1 byte minor, 1 byte patch-level */ /* Error string returned by library functions, or NULL if no error (success) */ typedef const char* gme_err_t; @@ -47,9 +47,15 @@ int gme_track_ended( Music_Emu const* ); /* Number of milliseconds (1000 = one second) played since beginning of track */ int gme_tell( Music_Emu const* ); +/* Number of samples generated since beginning of track */ +int gme_tell_samples( Music_Emu const* ); + /* Seek to new time in track. Seeking backwards or far forward can take a while. */ gme_err_t gme_seek( Music_Emu*, int msec ); +/* Equivalent to restarting track then skipping n samples */ +gme_err_t gme_seek_samples( Music_Emu*, int n ); + /******** Informational ********/ diff --git a/libs/gme/gme/libgme.pc.in b/libs/gme/gme/libgme.pc.in index 4f420d9ed..49fd5b1df 100644 --- a/libs/gme/gme/libgme.pc.in +++ b/libs/gme/gme/libgme.pc.in @@ -3,7 +3,7 @@ # later are used by pkg-config. prefix=@CMAKE_INSTALL_PREFIX@ exec_prefix=${prefix} -lib_suffix= +lib_suffix=@LIB_SUFFIX@ libdir=${exec_prefix}/lib${lib_suffix} includedir=${prefix}/include @@ -13,3 +13,4 @@ URL: http://code.google.com/p/game-music-emu/ Version: @GME_VERSION@ Cflags: -I${includedir} Libs: -L${libdir} -lgme +Libs.private: -lstdc++ diff --git a/libs/gme/include/gme/gme.h b/libs/gme/include/gme/gme.h index 1f2a2d150..cb07061b4 100644 --- a/libs/gme/include/gme/gme.h +++ b/libs/gme/include/gme/gme.h @@ -1,6 +1,6 @@ /* Game music emulator library C interface (also usable from C++) */ -/* Game_Music_Emu 0.6.0 */ +/* Game_Music_Emu 0.6.1 */ #ifndef GME_H #define GME_H @@ -8,7 +8,7 @@ extern "C" { #endif -#define GME_VERSION 0x000600 /* 1 byte major, 1 byte minor, 1 byte patch-level */ +#define GME_VERSION 0x000601 /* 1 byte major, 1 byte minor, 1 byte patch-level */ /* Error string returned by library functions, or NULL if no error (success) */ typedef const char* gme_err_t; @@ -47,9 +47,15 @@ int gme_track_ended( Music_Emu const* ); /* Number of milliseconds (1000 = one second) played since beginning of track */ int gme_tell( Music_Emu const* ); +/* Number of samples generated since beginning of track */ +int gme_tell_samples( Music_Emu const* ); + /* Seek to new time in track. Seeking backwards or far forward can take a while. */ gme_err_t gme_seek( Music_Emu*, int msec ); +/* Equivalent to restarting track then skipping n samples */ +gme_err_t gme_seek_samples( Music_Emu*, int n ); + /******** Informational ********/ diff --git a/libs/gme/readme.txt b/libs/gme/readme.txt index 82a501dbd..4cfe5e7a8 100644 --- a/libs/gme/readme.txt +++ b/libs/gme/readme.txt @@ -1,4 +1,4 @@ -Game_Music_Emu 0.6.0: Game Music Emulators +Game_Music_Emu 0.6.2: Game Music Emulators ------------------------------------------ Game_Music_Emu is a collection of video game music file emulators that support the following formats and systems: @@ -34,30 +34,45 @@ several architectures, Mac OS, MorphOS, Xbox, PlayStation Portable, GP2X, and Nintendo DS. Author : Shay Green -Website: http://www.slack.net/~ant/ -Forum : http://groups.google.com/group/blargg-sound-libs +Website: https://bitbucket.org/mpyne/game-music-emu/wiki/Home License: GNU Lesser General Public License (LGPL) +Current Maintainer: Michael Pyne Getting Started --------------- Build a program consisting of demo/basics.c, demo/Wave_Writer.cpp, and -all source files in gme/. If you have CMake 2.6 or later, execute +all source files in gme/. - run cmake - cd demo - run make +Or, if you have CMake 2.6 or later, execute at a command prompt (from the +extracted source directory): -Be sure "test.nsf" is in the same directory as the program. Running it + mkdir build + cd build + cmake ../ # <-- Pass any needed CMake flags here + make # To build the library + cd demo + make # To build the demo itself + +Be sure "test.nsf" is in the same directory as the demo program. Running it should generate the recording "out.wav". +You can use "make install" to install the library. To choose where to install +the library to, use the CMake argument "-DCMAKE_INSTALL_PREFIX=/usr/local" +(and replace /usr/local with the base path you wish to use). Alternately, you +can specify the base path to install to when you run "make install" by passing +'DESTDIR=/usr/local' on the make install command line (again, replace +/usr/local as appropriate). + +To build a static library instead of shared (the default), pass +-DBUILD_SHARED_LIBS=OFF to the cmake command when running cmake. + A slightly more extensive demo application is available in the player/ directory. It requires SDL to build. Read gme.txt for more information. Post to the discussion forum for assistance. - Files ----- gme.txt General notes about the library diff --git a/libs/gme/win32/libgme.dll.a b/libs/gme/win32/libgme.dll.a index d56d87396..2c5e95853 100644 Binary files a/libs/gme/win32/libgme.dll.a and b/libs/gme/win32/libgme.dll.a differ diff --git a/libs/gme/win64/libgme.dll.a b/libs/gme/win64/libgme.dll.a index 38079dc2a..8348f12de 100644 Binary files a/libs/gme/win64/libgme.dll.a and b/libs/gme/win64/libgme.dll.a differ diff --git a/libs/libgme.props b/libs/libgme.props new file mode 100644 index 000000000..209f6b9a8 --- /dev/null +++ b/libs/libgme.props @@ -0,0 +1,16 @@ + + + + + + $(SolutionDir)libs\gme\include;$(IncludePath) + $(SolutionDir)libs\gme\win32;$(LibraryPath) + $(SolutionDir)libs\gme\win64;$(LibraryPath) + + + + libgme.dll.a;%(AdditionalDependencies) + + + + \ No newline at end of file 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/libs/libpng-src/projects/visualc10/.gitignore b/libs/libpng-src/projects/visualc10/.gitignore index 118a15cbb..e1bec81fc 100644 --- a/libs/libpng-src/projects/visualc10/.gitignore +++ b/libs/libpng-src/projects/visualc10/.gitignore @@ -1,3 +1,5 @@ /Win32 /x64 /libpng.vcproj.*.*.user +/ARM +/ARM64 diff --git a/libs/libpng-src/projects/visualc10/libpng.vcxproj b/libs/libpng-src/projects/visualc10/libpng.vcxproj index fb53826ec..eaa3d4ffb 100644 --- a/libs/libpng-src/projects/visualc10/libpng.vcxproj +++ b/libs/libpng-src/projects/visualc10/libpng.vcxproj @@ -1,6 +1,14 @@  + + Debug + ARM + + + Debug + ARM64 + Debug Win32 @@ -9,6 +17,14 @@ Debug x64 + + Release + ARM + + + Release + ARM64 + Release Win32 @@ -21,7 +37,7 @@ {72B01ACA-7A1A-4F7B-ACEF-2607299CF052} libpng - 8.1 + 10.0.16299.0 @@ -29,21 +45,45 @@ false v140 + + StaticLibrary + false + v141 + true + StaticLibrary false v140 + + StaticLibrary + false + v141 + true + StaticLibrary false v140 + + StaticLibrary + false + v141 + true + StaticLibrary false v140 + + StaticLibrary + false + v141 + true + @@ -51,29 +91,53 @@ + + + + + + + + + + + + + + + + <_ProjectFileVersion>10.0.30319.1 $(ProjectDir)$(Platform)\$(Configuration)\ + $(ProjectDir)$(Platform)\$(Configuration)\ $(ProjectDir)$(Platform)\$(Configuration)\ + $(ProjectDir)$(Platform)\$(Configuration)\ $(ProjectDir)$(Platform)\$(Configuration)\ + $(ProjectDir)$(Platform)\$(Configuration)\ $(ProjectDir)$(Platform)\$(Configuration)\ + $(ProjectDir)$(Platform)\$(Configuration)\ $(ProjectDir)$(Platform)\$(Configuration)\ + $(ProjectDir)$(Platform)\$(Configuration)\ $(ProjectDir)$(Platform)\$(Configuration)\ + $(ProjectDir)$(Platform)\$(Configuration)\ $(ProjectDir)$(Platform)\$(Configuration)\ + $(ProjectDir)$(Platform)\$(Configuration)\ $(ProjectDir)$(Platform)\$(Configuration)\ + $(ProjectDir)$(Platform)\$(Configuration)\ @@ -107,6 +171,38 @@ $(ProjectDir)$(PlatformName)\$(ConfigurationName)\libpng.bsc + + + MaxSpeed + OnlyExplicitInline + ..\..;..\..\..\zlib;%(AdditionalIncludeDirectories) + WIN32;NDEBUG;PNG_USE_PNGVCRD;PNG_LIBPNG_SPECIALBUILD;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) + true + MultiThreadedDLL + true + $(ProjectDir)$(Platform)\$(Configuration)\ + $(ProjectDir)$(Platform)\$(Configuration)\ + $(ProjectDir)$(Platform)\$(Configuration)\ + Level3 + true + CompileAsC + true + + + NDEBUG;%(PreprocessorDefinitions) + 0x0409 + ..\..;%(AdditionalIncludeDirectories) + + + $(ProjectDir)$(Platform)\$(Configuration)\libpng.lib + true + MachineARM + + + true + $(ProjectDir)$(PlatformName)\$(ConfigurationName)\libpng.bsc + + X64 @@ -143,6 +239,40 @@ $(ProjectDir)$(PlatformName)\$(ConfigurationName)\libpng.bsc + + + + MaxSpeed + OnlyExplicitInline + ..\..;..\..\..\zlib;%(AdditionalIncludeDirectories) + WIN32;NDEBUG;PNG_USE_PNGVCRD;PNG_LIBPNG_SPECIALBUILD;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) + true + MultiThreadedDLL + true + $(ProjectDir)$(Platform)\$(Configuration)\ + $(ProjectDir)$(Platform)\$(Configuration)\ + $(ProjectDir)$(Platform)\$(Configuration)\ + Level3 + true + CompileAsC + 4267;%(DisableSpecificWarnings) + true + + + NDEBUG;%(PreprocessorDefinitions) + 0x0409 + ..\..;%(AdditionalIncludeDirectories) + + + $(ProjectDir)$(Platform)\$(Configuration)\libpng.lib + true + MachineARM64 + + + true + $(ProjectDir)$(PlatformName)\$(ConfigurationName)\libpng.bsc + + Disabled @@ -174,6 +304,36 @@ $(ProjectDir)$(PlatformName)\$(ConfigurationName)\libpng.bsc + + + Disabled + ..\..;..\..\..\zlib;%(AdditionalIncludeDirectories) + WIN32;_DEBUG;DEBUG;PNG_DEBUG=1;PNG_USE_PNGVCRD;PNG_LIBPNG_SPECIALBUILD;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) + EnableFastChecks + MultiThreadedDebugDLL + $(ProjectDir)$(Platform)\$(Configuration)\ + $(ProjectDir)$(Platform)\$(Configuration)\ + $(ProjectDir)$(Platform)\$(Configuration)\ + Level3 + true + ProgramDatabase + CompileAsC + false + + + _DEBUG;%(PreprocessorDefinitions) + 0x0409 + + + $(ProjectDir)$(Platform)\$(Configuration)\libpng.lib + true + MachineARM + + + true + $(ProjectDir)$(PlatformName)\$(ConfigurationName)\libpng.bsc + + X64 @@ -209,164 +369,320 @@ $(ProjectDir)$(PlatformName)\$(ConfigurationName)\libpng.bsc + + + + Disabled + ..\..;..\..\..\zlib;%(AdditionalIncludeDirectories) + WIN32;_DEBUG;DEBUG;PNG_DEBUG=1;PNG_USE_PNGVCRD;PNG_LIBPNG_SPECIALBUILD;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) + EnableFastChecks + MultiThreadedDebugDLL + $(ProjectDir)$(Platform)\$(Configuration)\ + $(ProjectDir)$(Platform)\$(Configuration)\ + $(ProjectDir)$(Platform)\$(Configuration)\ + Level3 + true + ProgramDatabase + CompileAsC + 4267;%(DisableSpecificWarnings) + false + + + _DEBUG;%(PreprocessorDefinitions) + 0x0409 + + + $(ProjectDir)$(Platform)\$(Configuration)\libpng.lib + true + MachineARM64 + + + true + $(ProjectDir)$(PlatformName)\$(ConfigurationName)\libpng.bsc + + %(AdditionalIncludeDirectories) + %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) + %(PreprocessorDefinitions) %(AdditionalIncludeDirectories) + %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) + %(PreprocessorDefinitions) %(AdditionalIncludeDirectories) + %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) + %(PreprocessorDefinitions) %(AdditionalIncludeDirectories) + %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) + %(PreprocessorDefinitions) %(AdditionalIncludeDirectories) + %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) + %(PreprocessorDefinitions) %(AdditionalIncludeDirectories) + %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) + %(PreprocessorDefinitions) %(AdditionalIncludeDirectories) + %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) + %(PreprocessorDefinitions) %(AdditionalIncludeDirectories) + %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) + %(PreprocessorDefinitions) %(AdditionalIncludeDirectories) + %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) + %(PreprocessorDefinitions) %(AdditionalIncludeDirectories) + %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) + %(PreprocessorDefinitions) %(AdditionalIncludeDirectories) + %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) + %(PreprocessorDefinitions) %(AdditionalIncludeDirectories) + %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) + %(PreprocessorDefinitions) %(AdditionalIncludeDirectories) + %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) + %(PreprocessorDefinitions) %(AdditionalIncludeDirectories) + %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) + %(PreprocessorDefinitions) %(AdditionalIncludeDirectories) + %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) + %(PreprocessorDefinitions) %(AdditionalIncludeDirectories) + %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) + %(PreprocessorDefinitions) %(AdditionalIncludeDirectories) + %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) + %(PreprocessorDefinitions) %(AdditionalIncludeDirectories) + %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) + %(PreprocessorDefinitions) %(AdditionalIncludeDirectories) + %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) + %(PreprocessorDefinitions) %(AdditionalIncludeDirectories) + %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) + %(PreprocessorDefinitions) %(AdditionalIncludeDirectories) + %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) + %(PreprocessorDefinitions) %(AdditionalIncludeDirectories) + %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) + %(PreprocessorDefinitions) %(AdditionalIncludeDirectories) + %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) + %(PreprocessorDefinitions) %(AdditionalIncludeDirectories) + %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) + %(PreprocessorDefinitions) %(AdditionalIncludeDirectories) + %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) + %(PreprocessorDefinitions) %(AdditionalIncludeDirectories) + %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) + %(PreprocessorDefinitions) %(AdditionalIncludeDirectories) + %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) + %(PreprocessorDefinitions) %(AdditionalIncludeDirectories) + %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) + %(PreprocessorDefinitions) %(AdditionalIncludeDirectories) + %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) + %(PreprocessorDefinitions) %(AdditionalIncludeDirectories) + %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) + %(PreprocessorDefinitions) %(AdditionalIncludeDirectories) + %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) + %(PreprocessorDefinitions) %(AdditionalIncludeDirectories) + %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) + %(PreprocessorDefinitions) %(AdditionalIncludeDirectories) + %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) + %(PreprocessorDefinitions) %(AdditionalIncludeDirectories) + %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) + %(PreprocessorDefinitions) %(AdditionalIncludeDirectories) + %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) + %(PreprocessorDefinitions) %(AdditionalIncludeDirectories) + %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) + %(PreprocessorDefinitions) %(AdditionalIncludeDirectories) + %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) + %(PreprocessorDefinitions) %(AdditionalIncludeDirectories) + %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) + %(PreprocessorDefinitions) %(AdditionalIncludeDirectories) + %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) + %(PreprocessorDefinitions) %(AdditionalIncludeDirectories) + %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) + %(PreprocessorDefinitions) %(AdditionalIncludeDirectories) + %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) + %(PreprocessorDefinitions) %(AdditionalIncludeDirectories) + %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) + %(PreprocessorDefinitions) %(AdditionalIncludeDirectories) + %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) + %(PreprocessorDefinitions) %(AdditionalIncludeDirectories) + %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) + %(PreprocessorDefinitions) %(AdditionalIncludeDirectories) + %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) + %(PreprocessorDefinitions) %(AdditionalIncludeDirectories) + %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) + %(PreprocessorDefinitions) %(AdditionalIncludeDirectories) + %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) + %(PreprocessorDefinitions) %(AdditionalIncludeDirectories) + %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) + %(PreprocessorDefinitions) %(AdditionalIncludeDirectories) + %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) + %(PreprocessorDefinitions) %(AdditionalIncludeDirectories) + %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) + %(PreprocessorDefinitions) %(AdditionalIncludeDirectories) + %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) + %(PreprocessorDefinitions) %(AdditionalIncludeDirectories) + %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) + %(PreprocessorDefinitions) %(AdditionalIncludeDirectories) + %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) + %(PreprocessorDefinitions) %(AdditionalIncludeDirectories) + %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) + %(PreprocessorDefinitions) %(AdditionalIncludeDirectories) + %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) + %(PreprocessorDefinitions) %(AdditionalIncludeDirectories) + %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) + %(PreprocessorDefinitions) %(AdditionalIncludeDirectories) + %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) + %(PreprocessorDefinitions) %(AdditionalIncludeDirectories) + %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) + %(PreprocessorDefinitions) %(AdditionalIncludeDirectories) + %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) + %(PreprocessorDefinitions) %(AdditionalIncludeDirectories) + %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) + %(PreprocessorDefinitions) true + true true + true true + true true + true @@ -377,17 +693,29 @@ true + true %(PreprocessorDefinitions) + %(PreprocessorDefinitions) \Oogaland\Projects\orospakr.ca\srb2\tools\libpng-src\scripts;%(AdditionalIncludeDirectories) + \Oogaland\Projects\orospakr.ca\srb2\tools\libpng-src\scripts;%(AdditionalIncludeDirectories) true + true %(PreprocessorDefinitions) + %(PreprocessorDefinitions) \Oogaland\Projects\orospakr.ca\srb2\tools\libpng-src\scripts;%(AdditionalIncludeDirectories) + \Oogaland\Projects\orospakr.ca\srb2\tools\libpng-src\scripts;%(AdditionalIncludeDirectories) true + true %(PreprocessorDefinitions) + %(PreprocessorDefinitions) \Oogaland\Projects\orospakr.ca\srb2\tools\libpng-src\scripts;%(AdditionalIncludeDirectories) + \Oogaland\Projects\orospakr.ca\srb2\tools\libpng-src\scripts;%(AdditionalIncludeDirectories) true + true %(PreprocessorDefinitions) + %(PreprocessorDefinitions) \Oogaland\Projects\orospakr.ca\srb2\tools\libpng-src\scripts;%(AdditionalIncludeDirectories) + \Oogaland\Projects\orospakr.ca\srb2\tools\libpng-src\scripts;%(AdditionalIncludeDirectories) diff --git a/libs/zlib/projects/visualc10/.gitignore b/libs/zlib/projects/visualc10/.gitignore index 488a5428b..1c5340cd4 100644 --- a/libs/zlib/projects/visualc10/.gitignore +++ b/libs/zlib/projects/visualc10/.gitignore @@ -1,3 +1,5 @@ /Win32 /x64 /zlib.vcproj.*.*.user +/ARM +/ARM64 diff --git a/libs/zlib/projects/visualc10/zlib.vcxproj b/libs/zlib/projects/visualc10/zlib.vcxproj index 814641d34..a7055ddb8 100644 --- a/libs/zlib/projects/visualc10/zlib.vcxproj +++ b/libs/zlib/projects/visualc10/zlib.vcxproj @@ -1,6 +1,14 @@  + + Debug + ARM + + + Debug + ARM64 + Debug Win32 @@ -9,6 +17,14 @@ Debug x64 + + Release + ARM + + + Release + ARM64 + Release Win32 @@ -21,7 +37,7 @@ {73A5729C-7323-41D4-AB48-8A03C9F81603} zlib - 8.1 + 10.0.16299.0 @@ -29,21 +45,45 @@ false v140 + + StaticLibrary + false + v141 + true + StaticLibrary false v140 + + StaticLibrary + false + v141 + true + StaticLibrary false v140 + true + + + StaticLibrary + false + v141 StaticLibrary false v140 + + StaticLibrary + false + v141 + true + @@ -52,29 +92,53 @@ + + + + + + + + + + + + + + + + <_ProjectFileVersion>10.0.30319.1 $(ProjectDir)$(Platform)\$(Configuration)\ + $(ProjectDir)$(Platform)\$(Configuration)\ $(ProjectDir)$(Platform)\$(Configuration)\ + $(ProjectDir)$(Platform)\$(Configuration)\ $(ProjectDir)$(Platform)\$(Configuration)\ + $(ProjectDir)$(Platform)\$(Configuration)\ $(ProjectDir)$(Platform)\$(Configuration)\ + $(ProjectDir)$(Platform)\$(Configuration)\ $(ProjectDir)$(Platform)\$(Configuration)\ + $(ProjectDir)$(Platform)\$(Configuration)\ $(ProjectDir)$(Platform)\$(Configuration)\ + $(ProjectDir)$(Platform)\$(Configuration)\ $(ProjectDir)$(Platform)\$(Configuration)\ + $(ProjectDir)$(Platform)\$(Configuration)\ $(ProjectDir)$(Platform)\$(Configuration)\ + $(ProjectDir)$(Platform)\$(Configuration)\ @@ -106,6 +170,36 @@ $(ProjectDir)$(PlatformName)\$(ConfigurationName)\zlib.bsc + + + Disabled + WIN32;_DEBUG;ASMV;ASMINF;_CRT_SECURE_NO_WARNINGS;_CRT_NONSTDC_NO_WARNINGS;%(PreprocessorDefinitions) + Default + MultiThreadedDebugDLL + $(ProjectDir)$(Platform)\$(Configuration)\ + $(ProjectDir)$(Platform)\$(Configuration)\ + $(ProjectDir)$(Platform)\$(Configuration)\ + Level3 + true + ProgramDatabase + CompileAsC + false + ASMV;ASMINF + + + _DEBUG;%(PreprocessorDefinitions) + 0x0409 + + + $(ProjectDir)$(Platform)\$(Configuration)\zlib.lib + true + MachineARM + + + true + $(ProjectDir)$(PlatformName)\$(ConfigurationName)\zlib.bsc + + X64 @@ -139,6 +233,36 @@ $(ProjectDir)$(PlatformName)\$(ConfigurationName)\zlib.bsc + + + + Disabled + WIN32;_DEBUG;_CRT_SECURE_NO_WARNINGS;_CRT_NONSTDC_NO_WARNINGS;%(PreprocessorDefinitions) + EnableFastChecks + MultiThreadedDebugDLL + $(ProjectDir)$(Platform)\$(Configuration)\ + $(ProjectDir)$(Platform)\$(Configuration)\ + $(ProjectDir)$(Platform)\$(Configuration)\ + Level3 + true + ProgramDatabase + CompileAsC + false + + + _DEBUG;%(PreprocessorDefinitions) + 0x0409 + + + $(ProjectDir)$(Platform)\$(Configuration)\zlib.lib + true + MachineARM64 + + + true + $(ProjectDir)$(PlatformName)\$(ConfigurationName)\zlib.bsc + + MaxSpeed @@ -169,6 +293,37 @@ $(ProjectDir)$(PlatformName)\$(ConfigurationName)\zlib.bsc + + + MaxSpeed + OnlyExplicitInline + WIN32;NDEBUG;ASMV;ASMINF;_CRT_SECURE_NO_WARNINGS;_CRT_NONSTDC_NO_WARNINGS;%(PreprocessorDefinitions) + true + MultiThreadedDLL + true + $(ProjectDir)$(Platform)\$(Configuration)\ + $(ProjectDir)$(Platform)\$(Configuration)\ + $(ProjectDir)$(Platform)\$(Configuration)\ + Level3 + true + CompileAsC + true + ASMV;ASMINF + + + NDEBUG;%(PreprocessorDefinitions) + 0x0409 + + + $(ProjectDir)$(Platform)\$(Configuration)\zlib.lib + true + MachineARM + + + true + $(ProjectDir)$(PlatformName)\$(ConfigurationName)\zlib.bsc + + X64 @@ -202,30 +357,77 @@ $(ProjectDir)$(PlatformName)\$(ConfigurationName)\zlib.bsc + + + + MaxSpeed + OnlyExplicitInline + WIN32;NDEBUG;_CRT_SECURE_NO_WARNINGS;_CRT_NONSTDC_NO_WARNINGS;%(PreprocessorDefinitions) + true + MultiThreadedDLL + true + $(ProjectDir)$(Platform)\$(Configuration)\ + $(ProjectDir)$(Platform)\$(Configuration)\ + $(ProjectDir)$(Platform)\$(Configuration)\ + Level3 + true + CompileAsC + true + + + NDEBUG;%(PreprocessorDefinitions) + 0x0409 + + + $(ProjectDir)$(Platform)\$(Configuration)\zlib.lib + true + MachineARM64 + + + true + $(ProjectDir)$(PlatformName)\$(ConfigurationName)\zlib.bsc + + %(PreprocessorDefinitions) + %(PreprocessorDefinitions) %(PreprocessorDefinitions) + %(PreprocessorDefinitions) %(PreprocessorDefinitions) + %(PreprocessorDefinitions) %(PreprocessorDefinitions) + %(PreprocessorDefinitions) %(PreprocessorDefinitions) + %(PreprocessorDefinitions) %(PreprocessorDefinitions) + %(PreprocessorDefinitions) %(PreprocessorDefinitions) + %(PreprocessorDefinitions) %(PreprocessorDefinitions) + %(PreprocessorDefinitions) %(PreprocessorDefinitions) + %(PreprocessorDefinitions) %(PreprocessorDefinitions) + %(PreprocessorDefinitions) %(PreprocessorDefinitions) + %(PreprocessorDefinitions) %(PreprocessorDefinitions) + %(PreprocessorDefinitions) %(PreprocessorDefinitions) + %(PreprocessorDefinitions) %(PreprocessorDefinitions) + %(PreprocessorDefinitions) %(PreprocessorDefinitions) + %(PreprocessorDefinitions) %(PreprocessorDefinitions) + %(PreprocessorDefinitions) @@ -233,60 +435,97 @@ %(PreprocessorDefinitions) + %(PreprocessorDefinitions) %(PreprocessorDefinitions) + %(PreprocessorDefinitions) %(PreprocessorDefinitions) + %(PreprocessorDefinitions) %(PreprocessorDefinitions) + %(PreprocessorDefinitions) %(PreprocessorDefinitions) + %(PreprocessorDefinitions) %(PreprocessorDefinitions) + %(PreprocessorDefinitions) %(PreprocessorDefinitions) + %(PreprocessorDefinitions) %(PreprocessorDefinitions) + %(PreprocessorDefinitions) %(PreprocessorDefinitions) + %(PreprocessorDefinitions) %(PreprocessorDefinitions) + %(PreprocessorDefinitions) %(PreprocessorDefinitions) + %(PreprocessorDefinitions) %(PreprocessorDefinitions) + %(PreprocessorDefinitions) %(PreprocessorDefinitions) + %(PreprocessorDefinitions) %(PreprocessorDefinitions) + %(PreprocessorDefinitions) %(PreprocessorDefinitions) + %(PreprocessorDefinitions) %(PreprocessorDefinitions) + %(PreprocessorDefinitions) %(PreprocessorDefinitions) + %(PreprocessorDefinitions) %(PreprocessorDefinitions) + %(PreprocessorDefinitions) %(PreprocessorDefinitions) + %(PreprocessorDefinitions) %(PreprocessorDefinitions) + %(PreprocessorDefinitions) %(PreprocessorDefinitions) + %(PreprocessorDefinitions) %(PreprocessorDefinitions) + %(PreprocessorDefinitions) %(PreprocessorDefinitions) + %(PreprocessorDefinitions) %(PreprocessorDefinitions) + %(PreprocessorDefinitions) %(PreprocessorDefinitions) + %(PreprocessorDefinitions) %(PreprocessorDefinitions) + %(PreprocessorDefinitions) %(PreprocessorDefinitions) + %(PreprocessorDefinitions) %(PreprocessorDefinitions) + %(PreprocessorDefinitions) true + true ../;%(AdditionalIncludeDirectories) + ../;%(AdditionalIncludeDirectories) ../..;%(AdditionalIncludeDirectories) + ../..;%(AdditionalIncludeDirectories) true + true ../..;%(AdditionalIncludeDirectories) + ../..;%(AdditionalIncludeDirectories) true + true true + true true + true true + true @@ -306,39 +545,67 @@ %(PreprocessorDefinitions) + %(PreprocessorDefinitions) \Oogaland\Projects\orospakr.ca\srb2\tools\zlib\win32;%(AdditionalIncludeDirectories) + \Oogaland\Projects\orospakr.ca\srb2\tools\zlib\win32;%(AdditionalIncludeDirectories) %(PreprocessorDefinitions) + %(PreprocessorDefinitions) \Oogaland\Projects\orospakr.ca\srb2\tools\zlib\win32;%(AdditionalIncludeDirectories) + \Oogaland\Projects\orospakr.ca\srb2\tools\zlib\win32;%(AdditionalIncludeDirectories) %(PreprocessorDefinitions) + %(PreprocessorDefinitions) \Oogaland\Projects\orospakr.ca\srb2\tools\zlib\win32;%(AdditionalIncludeDirectories) + \Oogaland\Projects\orospakr.ca\srb2\tools\zlib\win32;%(AdditionalIncludeDirectories) %(PreprocessorDefinitions) + %(PreprocessorDefinitions) \Oogaland\Projects\orospakr.ca\srb2\tools\zlib\win32;%(AdditionalIncludeDirectories) + \Oogaland\Projects\orospakr.ca\srb2\tools\zlib\win32;%(AdditionalIncludeDirectories) true + true true + true + true + true true + true true + true + true + true true + true true + true true + true true + true true + true true + true true + true true + true true + true true + true true + true true + true 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/srb2-vc10.sln b/srb2-vc10.sln index ecceafd56..b4415bfc0 100644 --- a/srb2-vc10.sln +++ b/srb2-vc10.sln @@ -1,9 +1,9 @@  Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio 14 -VisualStudioVersion = 14.0.25123.0 +# Visual Studio 15 +VisualStudioVersion = 15.0.28307.136 MinimumVisualStudioVersion = 10.0.40219.1 -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Srb2win", "src\win32\Srb2win-vc10.vcxproj", "{0F554F1D-ED49-4D65-A9A7-F63C57F277BE}" +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Srb2DD", "src\win32\Srb2win-vc10.vcxproj", "{0F554F1D-ED49-4D65-A9A7-F63C57F277BE}" EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libpng", "libs\libpng-src\projects\visualc10\libpng.vcxproj", "{72B01ACA-7A1A-4F7B-ACEF-2607299CF052}" EndProject @@ -13,56 +13,104 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "zlib", "libs\zlib\projects\ EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "s_openal", "src\hardware\s_openal\s_openal-vc10.vcxproj", "{E662D0B3-412D-4D55-A5EC-8CBD680DDCBE}" EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Srb2SDL", "src\sdl\Srb2SDL-vc10.vcxproj", "{61BA7D3C-F77D-4D31-B718-1177FE482CF2}" +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Srb2Win", "src\sdl\Srb2SDL-vc10.vcxproj", "{61BA7D3C-F77D-4D31-B718-1177FE482CF2}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|ARM = Debug|ARM + Debug|ARM64 = Debug|ARM64 Debug|Win32 = Debug|Win32 Debug|x64 = Debug|x64 + Release|ARM = Release|ARM + Release|ARM64 = Release|ARM64 Release|Win32 = Release|Win32 Release|x64 = Release|x64 EndGlobalSection GlobalSection(ProjectConfigurationPlatforms) = postSolution + {0F554F1D-ED49-4D65-A9A7-F63C57F277BE}.Debug|ARM.ActiveCfg = Debug|ARM + {0F554F1D-ED49-4D65-A9A7-F63C57F277BE}.Debug|ARM.Build.0 = Debug|ARM + {0F554F1D-ED49-4D65-A9A7-F63C57F277BE}.Debug|ARM64.ActiveCfg = Debug|ARM64 + {0F554F1D-ED49-4D65-A9A7-F63C57F277BE}.Debug|ARM64.Build.0 = Debug|ARM64 {0F554F1D-ED49-4D65-A9A7-F63C57F277BE}.Debug|Win32.ActiveCfg = Debug|Win32 {0F554F1D-ED49-4D65-A9A7-F63C57F277BE}.Debug|Win32.Build.0 = Debug|Win32 {0F554F1D-ED49-4D65-A9A7-F63C57F277BE}.Debug|x64.ActiveCfg = Debug|x64 {0F554F1D-ED49-4D65-A9A7-F63C57F277BE}.Debug|x64.Build.0 = Debug|x64 + {0F554F1D-ED49-4D65-A9A7-F63C57F277BE}.Release|ARM.ActiveCfg = Release|ARM + {0F554F1D-ED49-4D65-A9A7-F63C57F277BE}.Release|ARM.Build.0 = Release|ARM + {0F554F1D-ED49-4D65-A9A7-F63C57F277BE}.Release|ARM64.ActiveCfg = Release|ARM64 + {0F554F1D-ED49-4D65-A9A7-F63C57F277BE}.Release|ARM64.Build.0 = Release|ARM64 {0F554F1D-ED49-4D65-A9A7-F63C57F277BE}.Release|Win32.ActiveCfg = Release|Win32 {0F554F1D-ED49-4D65-A9A7-F63C57F277BE}.Release|Win32.Build.0 = Release|Win32 {0F554F1D-ED49-4D65-A9A7-F63C57F277BE}.Release|x64.ActiveCfg = Release|x64 {0F554F1D-ED49-4D65-A9A7-F63C57F277BE}.Release|x64.Build.0 = Release|x64 + {72B01ACA-7A1A-4F7B-ACEF-2607299CF052}.Debug|ARM.ActiveCfg = Debug|ARM + {72B01ACA-7A1A-4F7B-ACEF-2607299CF052}.Debug|ARM.Build.0 = Debug|ARM + {72B01ACA-7A1A-4F7B-ACEF-2607299CF052}.Debug|ARM64.ActiveCfg = Debug|ARM64 + {72B01ACA-7A1A-4F7B-ACEF-2607299CF052}.Debug|ARM64.Build.0 = Debug|ARM64 {72B01ACA-7A1A-4F7B-ACEF-2607299CF052}.Debug|Win32.ActiveCfg = Debug|Win32 {72B01ACA-7A1A-4F7B-ACEF-2607299CF052}.Debug|Win32.Build.0 = Debug|Win32 {72B01ACA-7A1A-4F7B-ACEF-2607299CF052}.Debug|x64.ActiveCfg = Debug|x64 {72B01ACA-7A1A-4F7B-ACEF-2607299CF052}.Debug|x64.Build.0 = Debug|x64 + {72B01ACA-7A1A-4F7B-ACEF-2607299CF052}.Release|ARM.ActiveCfg = Release|ARM + {72B01ACA-7A1A-4F7B-ACEF-2607299CF052}.Release|ARM.Build.0 = Release|ARM + {72B01ACA-7A1A-4F7B-ACEF-2607299CF052}.Release|ARM64.ActiveCfg = Release|ARM64 + {72B01ACA-7A1A-4F7B-ACEF-2607299CF052}.Release|ARM64.Build.0 = Release|ARM64 {72B01ACA-7A1A-4F7B-ACEF-2607299CF052}.Release|Win32.ActiveCfg = Release|Win32 {72B01ACA-7A1A-4F7B-ACEF-2607299CF052}.Release|Win32.Build.0 = Release|Win32 {72B01ACA-7A1A-4F7B-ACEF-2607299CF052}.Release|x64.ActiveCfg = Release|x64 {72B01ACA-7A1A-4F7B-ACEF-2607299CF052}.Release|x64.Build.0 = Release|x64 + {51137D5C-4E81-4955-AACF-EA3092006051}.Debug|ARM.ActiveCfg = Debug|ARM + {51137D5C-4E81-4955-AACF-EA3092006051}.Debug|ARM.Build.0 = Debug|ARM + {51137D5C-4E81-4955-AACF-EA3092006051}.Debug|ARM64.ActiveCfg = Debug|ARM64 + {51137D5C-4E81-4955-AACF-EA3092006051}.Debug|ARM64.Build.0 = Debug|ARM64 {51137D5C-4E81-4955-AACF-EA3092006051}.Debug|Win32.ActiveCfg = Debug|Win32 {51137D5C-4E81-4955-AACF-EA3092006051}.Debug|Win32.Build.0 = Debug|Win32 {51137D5C-4E81-4955-AACF-EA3092006051}.Debug|x64.ActiveCfg = Debug|x64 {51137D5C-4E81-4955-AACF-EA3092006051}.Debug|x64.Build.0 = Debug|x64 + {51137D5C-4E81-4955-AACF-EA3092006051}.Release|ARM.ActiveCfg = Release|ARM + {51137D5C-4E81-4955-AACF-EA3092006051}.Release|ARM.Build.0 = Release|ARM + {51137D5C-4E81-4955-AACF-EA3092006051}.Release|ARM64.ActiveCfg = Release|ARM64 + {51137D5C-4E81-4955-AACF-EA3092006051}.Release|ARM64.Build.0 = Release|ARM64 {51137D5C-4E81-4955-AACF-EA3092006051}.Release|Win32.ActiveCfg = Release|Win32 {51137D5C-4E81-4955-AACF-EA3092006051}.Release|Win32.Build.0 = Release|Win32 {51137D5C-4E81-4955-AACF-EA3092006051}.Release|x64.ActiveCfg = Release|x64 {51137D5C-4E81-4955-AACF-EA3092006051}.Release|x64.Build.0 = Release|x64 + {73A5729C-7323-41D4-AB48-8A03C9F81603}.Debug|ARM.ActiveCfg = Debug|ARM + {73A5729C-7323-41D4-AB48-8A03C9F81603}.Debug|ARM.Build.0 = Debug|ARM + {73A5729C-7323-41D4-AB48-8A03C9F81603}.Debug|ARM64.ActiveCfg = Debug|ARM64 + {73A5729C-7323-41D4-AB48-8A03C9F81603}.Debug|ARM64.Build.0 = Debug|ARM64 {73A5729C-7323-41D4-AB48-8A03C9F81603}.Debug|Win32.ActiveCfg = Debug|Win32 {73A5729C-7323-41D4-AB48-8A03C9F81603}.Debug|Win32.Build.0 = Debug|Win32 {73A5729C-7323-41D4-AB48-8A03C9F81603}.Debug|x64.ActiveCfg = Debug|x64 {73A5729C-7323-41D4-AB48-8A03C9F81603}.Debug|x64.Build.0 = Debug|x64 + {73A5729C-7323-41D4-AB48-8A03C9F81603}.Release|ARM.ActiveCfg = Release|ARM + {73A5729C-7323-41D4-AB48-8A03C9F81603}.Release|ARM.Build.0 = Release|ARM + {73A5729C-7323-41D4-AB48-8A03C9F81603}.Release|ARM64.ActiveCfg = Release|ARM64 + {73A5729C-7323-41D4-AB48-8A03C9F81603}.Release|ARM64.Build.0 = Release|ARM64 {73A5729C-7323-41D4-AB48-8A03C9F81603}.Release|Win32.ActiveCfg = Release|Win32 {73A5729C-7323-41D4-AB48-8A03C9F81603}.Release|Win32.Build.0 = Release|Win32 {73A5729C-7323-41D4-AB48-8A03C9F81603}.Release|x64.ActiveCfg = Release|x64 {73A5729C-7323-41D4-AB48-8A03C9F81603}.Release|x64.Build.0 = Release|x64 + {E662D0B3-412D-4D55-A5EC-8CBD680DDCBE}.Debug|ARM.ActiveCfg = Debug|ARM + {E662D0B3-412D-4D55-A5EC-8CBD680DDCBE}.Debug|ARM64.ActiveCfg = Debug|ARM64 {E662D0B3-412D-4D55-A5EC-8CBD680DDCBE}.Debug|Win32.ActiveCfg = Debug|Win32 {E662D0B3-412D-4D55-A5EC-8CBD680DDCBE}.Debug|x64.ActiveCfg = Debug|x64 + {E662D0B3-412D-4D55-A5EC-8CBD680DDCBE}.Release|ARM.ActiveCfg = Release|ARM + {E662D0B3-412D-4D55-A5EC-8CBD680DDCBE}.Release|ARM64.ActiveCfg = Release|ARM64 {E662D0B3-412D-4D55-A5EC-8CBD680DDCBE}.Release|Win32.ActiveCfg = Release|Win32 {E662D0B3-412D-4D55-A5EC-8CBD680DDCBE}.Release|x64.ActiveCfg = Release|x64 + {61BA7D3C-F77D-4D31-B718-1177FE482CF2}.Debug|ARM.ActiveCfg = Debug|ARM + {61BA7D3C-F77D-4D31-B718-1177FE482CF2}.Debug|ARM.Build.0 = Debug|ARM + {61BA7D3C-F77D-4D31-B718-1177FE482CF2}.Debug|ARM64.ActiveCfg = Debug|ARM64 + {61BA7D3C-F77D-4D31-B718-1177FE482CF2}.Debug|ARM64.Build.0 = Debug|ARM64 {61BA7D3C-F77D-4D31-B718-1177FE482CF2}.Debug|Win32.ActiveCfg = Debug|Win32 {61BA7D3C-F77D-4D31-B718-1177FE482CF2}.Debug|Win32.Build.0 = Debug|Win32 {61BA7D3C-F77D-4D31-B718-1177FE482CF2}.Debug|x64.ActiveCfg = Debug|x64 {61BA7D3C-F77D-4D31-B718-1177FE482CF2}.Debug|x64.Build.0 = Debug|x64 + {61BA7D3C-F77D-4D31-B718-1177FE482CF2}.Release|ARM.ActiveCfg = Release|ARM + {61BA7D3C-F77D-4D31-B718-1177FE482CF2}.Release|ARM.Build.0 = Release|ARM + {61BA7D3C-F77D-4D31-B718-1177FE482CF2}.Release|ARM64.ActiveCfg = Release|ARM64 + {61BA7D3C-F77D-4D31-B718-1177FE482CF2}.Release|ARM64.Build.0 = Release|ARM64 {61BA7D3C-F77D-4D31-B718-1177FE482CF2}.Release|Win32.ActiveCfg = Release|Win32 {61BA7D3C-F77D-4D31-B718-1177FE482CF2}.Release|Win32.Build.0 = Release|Win32 {61BA7D3C-F77D-4D31-B718-1177FE482CF2}.Release|x64.ActiveCfg = Release|x64 @@ -71,4 +119,7 @@ Global GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {8C0B5F99-D9B8-4CB2-BA67-5D350E71C6FC} + EndGlobalSection EndGlobal diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 4a9ef5ba8..723407d86 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) @@ -377,6 +401,12 @@ if(${SRB2_CONFIG_HAVE_PNG} AND ${SRB2_CONFIG_HAVE_ZLIB}) set(SRB2_HAVE_PNG ON) add_definitions(-DHAVE_PNG) add_definitions(-D_LARGEFILE64_SOURCE) + set(SRB2_PNG_SOURCES apng.c) + set(SRB2_PNG_HEADERS apng.h) + prepend_sources(SRB2_PNG_SOURCES) + prepend_sources(SRB2_PNG_HEADERS) + source_group("Main" FILES ${SRB2_CORE_SOURCES} ${SRB2_CORE_HEADERS} + ${SRB2_PNG_SOURCES} ${SRB2_PNG_HEADERS}) else() message(WARNING "You have specified that PNG is available but it was not found. SRB2 may not compile correctly.") endif() diff --git a/src/Makefile b/src/Makefile index fbf75f26c..3015aa5d6 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 @@ -71,9 +69,12 @@ # Addon for SDL: # To Cross-Compile, add 'SDL_CONFIG=/usr/*/bin/sdl-config' # Compile without SDL_Mixer, add 'NOMIXER=1' +# Compile without SDL_Mixer_X, add 'NOMIXERX=1' (Win32 only) +# Compile without GME, add 'NOGME=1' # 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 +84,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 +94,6 @@ D_FILES=$(D_DIR)/srb2.srb \ PKG_CONFIG?=pkg-config -ifdef WIILINUX -LINUX=1 -endif - ifdef PANDORA LINUX=1 endif @@ -104,18 +101,22 @@ endif ifdef LINUX64 LINUX=1 NONX86=1 +# LINUX64 does not imply X86_64=1; could mean ARM64 or Itanium endif +ifdef MINGW64 +MINGW=1 +NONX86=1 +NOASM=1 +# MINGW64 should not necessarily imply X86_64=1, but we make that assumption elsewhere +# Once that changes, remove this +X86_64=1 +endif #ifdef MINGW64 + 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 @@ -142,45 +143,24 @@ 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 -ifdef MINGW64 -MINGW=1 -include win32/Makefile.cfg -endif #ifdef MINGW64 - ifdef UNIX UNIXCOMMON=1 endif @@ -204,27 +184,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 @@ -246,11 +207,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) @@ -268,10 +225,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 @@ -288,11 +243,13 @@ OPTS += -DCOMPVERSION ifndef NONX86 ifndef GCC29 - M5=-march=pentium - M4=-march=i486 + ARCHOPTS?=-march=pentium else - M5=-mpentium - M4=-m486 + ARCHOPTS?=-mpentium +endif +else +ifdef X86_64 + ARCHOPTS?=-march=nocona endif endif @@ -331,6 +288,8 @@ endif LIBS+=$(PNG_LDFLAGS) CFLAGS+=$(PNG_CFLAGS) + +OBJS+=$(OBJDIR)/apng.o endif ifdef HAVE_LIBGME @@ -344,6 +303,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 @@ -382,14 +352,6 @@ else OBJS:=$(OBJDIR)/md5.o $(OBJS) endif -ifdef FAKEDC - OPTS+=-DDC -endif - -ifdef FAKEPSP - OPTS+=-DPSP -endif - ifdef NOPOSTPROCESSING OPTS+=-DNOPOSTPROCESSING endif @@ -421,7 +383,7 @@ else WINDRESFLAGS = -DNDEBUG CFLAGS+=-O3 endif - CFLAGS+=-g $(OPTS) $(M5) $(WINDRESFLAGS) + CFLAGS+=-g $(OPTS) $(ARCHOPTS) $(WINDRESFLAGS) ifdef YASM ifdef STABS @@ -511,6 +473,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 \ @@ -542,49 +505,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) @@ -638,12 +572,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 @@ -668,7 +600,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 @@ -679,12 +611,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... @@ -762,16 +688,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 $@ @@ -813,70 +729,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 @@ -896,28 +748,20 @@ $(OBJDIR)/ogl_win.o: hardware/r_opengl/ogl_win.c hardware/r_opengl/r_opengl.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 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 $(OBJDIR)/s_ds3d.o: hardware/s_ds3d/s_ds3d.c hardware/hw3dsdrv.h \ hardware/hw_dll.h - $(CC) $(M5) -Os -o $(OBJDIR)/s_ds3d.o $(WFLAGS) -D_WINDOWS -mwindows -c hardware/s_ds3d/s_ds3d.c + $(CC) $(ARCHOPTS) -Os -o $(OBJDIR)/s_ds3d.o $(WFLAGS) -D_WINDOWS -mwindows -c hardware/s_ds3d/s_ds3d.c $(OBJDIR)/s_fmod.o: hardware/s_openal/s_openal.c hardware/hw3dsdrv.h \ hardware/hw_dll.h - $(CC) $(M5) -Os -o $(OBJDIR)/s_fmod.o $(WFLAGS) -D_WINDOWS -mwindows -c hardware/s_fmod/s_fmod.c + $(CC) $(ARCHOPTS) -Os -o $(OBJDIR)/s_fmod.o $(WFLAGS) -D_WINDOWS -mwindows -c hardware/s_fmod/s_fmod.c $(OBJDIR)/s_openal.o: hardware/s_openal/s_openal.c hardware/hw3dsdrv.h \ hardware/hw_dll.h - $(CC) $(M5) -Os -o $(OBJDIR)/s_openal.o $(WFLAGS) -D_WINDOWS -mwindows -c hardware/s_openal/s_openal.c + $(CC) $(ARCHOPTS) -Os -o $(OBJDIR)/s_openal.o $(WFLAGS) -D_WINDOWS -mwindows -c hardware/s_openal/s_openal.c endif endif endif @@ -947,30 +791,11 @@ else $(OBJDIR)/s_fmod.o: hardware/s_fmod/s_fmod.c hardware/hw3dsdrv.h \ hardware/hw_dll.h - $(CC) $(M5) -Os -o $(OBJDIR)/s_fmod.o -DHW3SOUND -DUNIXCOMMON -shared -nostartfiles -c hardware/s_fmod/s_fmod.c + $(CC) $(ARCHOPTS) -Os -o $(OBJDIR)/s_fmod.o -DHW3SOUND -DUNIXCOMMON -shared -nostartfiles -c hardware/s_fmod/s_fmod.c $(OBJDIR)/s_openal.o: hardware/s_openal/s_openal.c hardware/hw3dsdrv.h \ hardware/hw_dll.h - $(CC) $(M5) -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 $@ + $(CC) $(ARCHOPTS) -Os -o $(OBJDIR)/s_openal.o -DHW3SOUND -DUNIXCOMMON -shared -nostartfiles -c hardware/s_openal/s_openal.c endif endif diff --git a/src/Makefile.cfg b/src/Makefile.cfg index cdd4c3c73..409cc4f22 100644 --- a/src/Makefile.cfg +++ b/src/Makefile.cfg @@ -7,7 +7,19 @@ # and other things # -ifdef GCC80 +ifdef GCC91 +GCC83=1 +endif + +ifdef GCC83 +GCC82=1 +endif + +ifdef GCC82 +GCC81=1 +endif + +ifdef GCC81 GCC72=1 endif @@ -92,10 +104,6 @@ ifdef GCC295 GCC29=1 endif -ifdef DC -NOCASTALIGNWARN=1 -endif - OLDWFLAGS:=$(WFLAGS) # -W -Wno-unused WFLAGS=-Wall @@ -112,12 +120,11 @@ ifndef GCC295 WFLAGS+=-Wno-div-by-zero endif #WFLAGS+=-Wsystem-headers -ifndef ERRORMODE -#WFLAGS+=-Wfloat-equal -endif +WFLAGS+=-Wfloat-equal #WFLAGS+=-Wtraditional ifdef VCHELP WFLAGS+=-Wdeclaration-after-statement + WFLAGS+=-Wno-error=declaration-after-statement endif WFLAGS+=-Wundef ifndef GCC295 @@ -143,6 +150,9 @@ ifdef GCC43 endif endif WFLAGS+=-Wsign-compare +ifdef GCC91 + WFLAGS+=-Wno-error=address-of-packed-member +endif ifdef GCC45 WFLAGS+=-Wlogical-op endif @@ -156,15 +166,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 @@ -183,6 +189,9 @@ ifndef GCC295 endif endif WFLAGS+=-Wformat-y2k +ifdef GCC71 +WFLAGS+=-Wno-error=format-overflow=2 +endif WFLAGS+=-Wformat-security ifndef GCC29 #WFLAGS+=-Winit-self @@ -191,12 +200,6 @@ ifdef GCC46 WFLAGS+=-Wno-suggest-attribute=noreturn endif -ifndef MINGW -ifdef GCC45 -WFLAGS+=-Wunsuffixed-float-constants -endif -endif - ifdef NOLDWARNING LDFLAGS+=-Wl,--as-needed endif @@ -210,6 +213,9 @@ WFLAGS+=$(OLDWFLAGS) ifdef GCC43 #WFLAGS+=-Wno-error=clobbered endif +ifdef GCC44 + WFLAGS+=-Wno-error=array-bounds +endif ifdef GCC46 WFLAGS+=-Wno-error=suggest-attribute=noreturn endif @@ -220,33 +226,26 @@ ifdef GCC61 WFLAGS+=-Wno-tautological-compare -Wno-error=tautological-compare endif ifdef GCC71 - WFLAGS+=-Wno-error=implicit-fallthrough - WFLAGS+=-Wno-implicit-fallthrough + WFLAGS+=-Wimplicit-fallthrough=4 endif -ifdef GCC80 +ifdef GCC81 WFLAGS+=-Wno-error=format-overflow WFLAGS+=-Wno-error=stringop-truncation WFLAGS+=-Wno-error=stringop-overflow WFLAGS+=-Wno-format-overflow WFLAGS+=-Wno-stringop-truncation WFLAGS+=-Wno-stringop-overflow + WFLAGS+=-Wno-error=multistatement-macros 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 @@ -256,13 +255,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 @@ -280,10 +272,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 @@ -350,79 +339,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 @@ -431,19 +352,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) @@ -478,13 +386,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 6b97dd282..6d7042f1c 100644 --- a/src/am_map.c +++ b/src/am_map.c @@ -11,8 +11,8 @@ /// \file am_map.c /// \brief Code for the 'automap', former Doom feature used for DEVMODE testing -#include "g_game.h" #include "am_map.h" +#include "g_game.h" #include "g_input.h" #include "p_local.h" #include "p_slopes.h" @@ -33,7 +33,6 @@ static const UINT8 GRAYSRANGE = 16; static const UINT8 BROWNS = (3*16); static const UINT8 YELLOWS = (7*16); static const UINT8 GREENS = (10*16); -static const UINT8 GREENRANGE = 16; static const UINT8 DBLACK = 31; static const UINT8 DWHITE = 0; @@ -44,14 +43,8 @@ static const UINT8 NOCLIMBBROWNS = (2*16); static const UINT8 NOCLIMBYELLOWS = (11*16); -#ifdef _NDS -#undef BACKGROUND -#endif - // Automap colors #define BACKGROUND DBLACK -#define YOURCOLORS DWHITE -#define YOURRANGE 0 #define WALLCOLORS (REDS + REDRANGE/2) #define WALLRANGE (REDRANGE/2) #define NOCLIMBWALLCOLORS (NOCLIMBREDS + NOCLIMBREDRANGE/2) @@ -68,31 +61,23 @@ static const UINT8 NOCLIMBYELLOWS = (11*16); #define CDWALLCOLORS YELLOWS #define NOCLIMBCDWALLCOLORS NOCLIMBYELLOWS #define THINGCOLORS GREENS -#define THINGRANGE GREENRANGE -#define SECRETWALLCOLORS WALLCOLORS -#define SECRETWALLRANGE WALLRANGE #define GRIDCOLORS (GRAYS + GRAYSRANGE/2) -#define GRIDRANGE 0 #define XHAIRCOLORS GRAYS -// drawing stuff -#define FB 0 - -#define AM_PANDOWNKEY KEY_DOWNARROW +// controls #define AM_PANUPKEY KEY_UPARROW -#define AM_PANRIGHTKEY KEY_RIGHTARROW +#define AM_PANDOWNKEY KEY_DOWNARROW #define AM_PANLEFTKEY KEY_LEFTARROW +#define AM_PANRIGHTKEY KEY_RIGHTARROW + #define AM_ZOOMINKEY '=' #define AM_ZOOMOUTKEY '-' -#define AM_STARTKEY KEY_TAB -#define AM_ENDKEY KEY_TAB #define AM_GOBIGKEY '0' + #define AM_FOLLOWKEY 'f' #define AM_GRIDKEY 'g' -#define AM_MARKKEY 'm' -#define AM_CLEARMARKKEY 'c' -#define AM_NUMMARKPOINTS 10 +#define AM_TOGGLEKEY KEY_TAB // scale on entry #define INITSCALEMTOF (FRACUNIT/5) @@ -113,6 +98,9 @@ static const UINT8 NOCLIMBYELLOWS = (11*16); #define CXMTOF(x) (f_x + MTOF((x)-m_x)) #define CYMTOF(y) (f_y + (f_h - MTOF((y)-m_y))) +#define MAPBITS (FRACBITS-4) +#define FRACTOMAPBITS (FRACBITS-MAPBITS) + typedef struct { fixed_t x, y; @@ -133,7 +121,10 @@ typedef struct // A line drawing of the player pointing right, // starting from the middle. // + +#define PLAYERRADIUS (16*(1< @@ -166,27 +157,15 @@ static const mline_t thintriangle_guy[] = { #undef R #define NUMTHINTRIANGLEGUYLINES (sizeof (thintriangle_guy)/sizeof (mline_t)) -static INT32 bigstate; //added : 24-01-98 : moved here, toggle between - // user view and large view (full map view) - -static INT32 grid = 0; - -static INT32 leveljuststarted = 1; // kluge until AM_LevelInit() is called +static boolean bigstate; // user view and large view (full map view) +static boolean draw_grid = false; boolean automapactive = false; boolean am_recalc = false; //added : 05-02-98 : true when screen size changes +static boolean am_stopped = true; -// location of window on screen -static INT32 f_x; -static INT32 f_y; - -// size of window on screen -static INT32 f_w; -static INT32 f_h; - -static INT32 lightlev; // used for funky strobing effect -static UINT8 *fb; // pseudo-frame buffer -static INT32 amclock; +static INT32 f_x, f_y; // location of window on screen (always zero for both) +static INT32 f_w, f_h; // size of window on screen (always the screen width and height respectively) static mpoint_t m_paninc; // how far the window pans each tic (map coords) static fixed_t mtof_zoommul; // how far the window zooms in each tic (map coords) @@ -210,11 +189,6 @@ static fixed_t max_y; static fixed_t max_w; // max_x-min_x, static fixed_t max_h; // max_y-min_y -// based on player size -static fixed_t min_w; -static fixed_t min_h; - - static fixed_t min_scale_mtof; // used to tell when to stop zooming out static fixed_t max_scale_mtof; // used to tell when to stop zooming in @@ -232,13 +206,7 @@ static fixed_t scale_ftom; static player_t *plr; // the player represented by an arrow -static patch_t *marknums[10]; // numbers used for marking by the automap -static mpoint_t markpoints[AM_NUMMARKPOINTS]; // where the points are -static INT32 markpointnum = 0; // next point to be assigned - -static INT32 followplayer = 1; // specifies whether to follow the player around - -static boolean stopped = true; +static INT32 followplayer = true; // specifies whether to follow the player around // function for drawing lines, depends on rendermode typedef void (*AMDRAWFLINEFUNC) (const fline_t *fl, INT32 color); @@ -277,8 +245,8 @@ static inline void AM_restoreScaleAndLoc(void) } else { - m_x = plr->mo->x - m_w/2; - m_y = plr->mo->y - m_h/2; + m_x = (plr->mo->x >> FRACTOMAPBITS) - m_w/2; + m_y = (plr->mo->y >> FRACTOMAPBITS) - m_h/2; } m_x2 = m_x + m_w; m_y2 = m_y + m_h; @@ -288,15 +256,6 @@ static inline void AM_restoreScaleAndLoc(void) scale_ftom = FixedDiv(FRACUNIT, scale_mtof); } -/** Adds a marker at the current location. - */ -static inline void AM_addMark(void) -{ - markpoints[markpointnum].x = m_x + m_w/2; - markpoints[markpointnum].y = m_y + m_h/2; - markpointnum = (markpointnum + 1) % AM_NUMMARKPOINTS; -} - /** Determines the bounding box around all vertices. * This is used to set global variables controlling the zoom range. */ @@ -322,11 +281,8 @@ static void AM_findMinMaxBoundaries(void) max_y = vertexes[i].y; } - max_w = max_x - min_x; - max_h = max_y - min_y; - - min_w = 2*PLAYERRADIUS; // const? never changed? - min_h = 2*PLAYERRADIUS; + max_w = (max_x >>= FRACTOMAPBITS) - (min_x >>= FRACTOMAPBITS); + max_h = (max_y >>= FRACTOMAPBITS) - (min_y >>= FRACTOMAPBITS); a = FixedDiv(f_w<mo->x - m_w/2; - m_y = plr->mo->y - m_h/2; + if (plr != NULL && plr->mo != NULL) + { + m_x = (plr->mo->x >> FRACTOMAPBITS) - m_w/2; + m_y = (plr->mo->y >> FRACTOMAPBITS) - m_h/2; + } AM_changeWindowLoc(); // for saving & restoring @@ -396,41 +351,21 @@ static void AM_initVariables(void) old_m_h = m_h; } -static const UINT8 *maplump; // pointer to the raw data for the automap background. - -/** Clears all map markers. - */ -static void AM_clearMarks(void) -{ - INT32 i; - - for (i = 0; i < AM_NUMMARKPOINTS; i++) - markpoints[i].x = -1; // means empty - markpointnum = 0; -} - // // should be called at the start of every level // right now, i figure it out myself // static void AM_LevelInit(void) { - leveljuststarted = 0; - f_x = f_y = 0; f_w = vid.width; f_h = vid.height; - if (rendermode == render_soft) - AM_drawFline = AM_drawFline_soft; -#ifdef HWRENDER // not win32 only 19990829 by Kin - else if (rendermode != render_none) + AM_drawFline = AM_drawFline_soft; +#ifdef HWRENDER + if (rendermode == render_opengl) AM_drawFline = HWR_drawAMline; #endif - else - I_Error("Automap can't run without a render system"); - - AM_clearMarks(); AM_findMinMaxBoundaries(); scale_mtof = FixedDiv(min_scale_mtof*10, 7*FRACUNIT); @@ -446,7 +381,7 @@ static void AM_LevelInit(void) void AM_Stop(void) { automapactive = false; - stopped = true; + am_stopped = true; } /** Enables automap. @@ -457,15 +392,14 @@ static inline void AM_Start(void) { static INT32 lastlevel = -1; - if (!stopped) + if (!am_stopped) AM_Stop(); - stopped = false; + am_stopped = false; if (lastlevel != gamemap || am_recalc) // screen size changed { - am_recalc = false; - AM_LevelInit(); lastlevel = gamemap; + am_recalc = false; } AM_initVariables(); } @@ -503,7 +437,7 @@ boolean AM_Responder(event_t *ev) { if (!automapactive) { - if (ev->type == ev_keydown && ev->data1 == AM_STARTKEY) + if (ev->type == ev_keydown && ev->data1 == AM_TOGGLEKEY) { //faB: prevent alt-tab in win32 version to activate automap just before // minimizing the app; doesn't do any harm to the DOS version @@ -515,10 +449,8 @@ boolean AM_Responder(event_t *ev) } } } - else if (ev->type == ev_keydown) { - rc = true; switch (ev->data1) { @@ -554,7 +486,7 @@ boolean AM_Responder(event_t *ev) mtof_zoommul = M_ZOOMIN; ftom_zoommul = M_ZOOMOUT; break; - case AM_ENDKEY: + case AM_TOGGLEKEY: AM_Stop(); break; case AM_GOBIGKEY: @@ -572,13 +504,7 @@ boolean AM_Responder(event_t *ev) f_oldloc.x = INT32_MAX; break; case AM_GRIDKEY: - grid = !grid; - break; - case AM_MARKKEY: - AM_addMark(); - break; - case AM_CLEARMARKKEY: - AM_clearMarks(); + draw_grid = !draw_grid; break; default: rc = false; @@ -632,8 +558,8 @@ static inline void AM_doFollowPlayer(void) { if (f_oldloc.x != plr->mo->x || f_oldloc.y != plr->mo->y) { - m_x = FTOM(MTOF(plr->mo->x)) - m_w/2; - m_y = FTOM(MTOF(plr->mo->y)) - m_h/2; + m_x = FTOM(MTOF(plr->mo->x >> FRACTOMAPBITS)) - m_w/2; + m_y = FTOM(MTOF(plr->mo->y >> FRACTOMAPBITS)) - m_h/2; m_x2 = m_x + m_w; m_y2 = m_y + m_h; f_oldloc.x = plr->mo->x; @@ -651,8 +577,6 @@ void AM_Ticker(void) if (dedicated || !automapactive) return; - amclock++; - if (followplayer) AM_doFollowPlayer(); @@ -671,72 +595,7 @@ void AM_Ticker(void) */ static void AM_clearFB(INT32 color) { -#ifdef HWRENDER - if (rendermode != render_soft && rendermode != render_none) - { - HWR_clearAutomap(); - return; - } -#endif - - if (!maplump) - memset(fb, color, f_w*f_h*vid.bpp); - else - { - INT32 dmapx, dmapy, i, y; - static INT32 mapxstart, mapystart; - UINT8 *dest = screens[0]; - const UINT8 *src; -#define MAPLUMPHEIGHT (200 - 42) - - if (followplayer) - { - static vertex_t oldplr; - - dmapx = MTOF(plr->mo->x) - MTOF(oldplr.x); //fixed point - dmapy = MTOF(oldplr.y) - MTOF(plr->mo->y); - - oldplr.x = plr->mo->x; - oldplr.y = plr->mo->y; - mapxstart += dmapx>>1; - mapystart += dmapy>>1; - - while (mapxstart >= BASEVIDWIDTH) - mapxstart -= BASEVIDWIDTH; - while (mapxstart < 0) - mapxstart += BASEVIDWIDTH; - while (mapystart >= MAPLUMPHEIGHT) - mapystart -= MAPLUMPHEIGHT; - while (mapystart < 0) - mapystart += MAPLUMPHEIGHT; - } - else - { - mapxstart += (MTOF(m_paninc.x)>>1); - mapystart -= (MTOF(m_paninc.y)>>1); - if (mapxstart >= BASEVIDWIDTH) - mapxstart -= BASEVIDWIDTH; - if (mapxstart < 0) - mapxstart += BASEVIDWIDTH; - if (mapystart >= MAPLUMPHEIGHT) - mapystart -= MAPLUMPHEIGHT; - if (mapystart < 0) - mapystart += MAPLUMPHEIGHT; - } - - //blit the automap background to the screen. - for (y = 0; y < f_h; y++) - { - src = maplump + mapxstart + (y + mapystart)*BASEVIDWIDTH; - for (i = 0; i < BASEVIDWIDTH*vid.dupx; i++) - { - while (src > maplump + BASEVIDWIDTH*MAPLUMPHEIGHT) - src -= BASEVIDWIDTH*MAPLUMPHEIGHT; - *dest++ = *src++; - } - dest += vid.width - vid.dupx*BASEVIDWIDTH; - } - } + V_DrawFill(f_x, f_y, f_w, f_h, color|V_NOSCALESTART); } /** Performs automap clipping of lines. @@ -871,7 +730,7 @@ static boolean AM_clipMline(const mline_t *ml, fline_t *fl) // static void AM_drawFline_soft(const fline_t *fl, INT32 color) { - register INT32 x, y, dx, dy, sx, sy, ax, ay, d; + INT32 x, y, dx, dy, sx, sy, ax, ay, d; #ifdef _DEBUG static INT32 num = 0; @@ -887,7 +746,7 @@ static void AM_drawFline_soft(const fline_t *fl, INT32 color) } #endif -#define PUTDOT(xx,yy,cc) fb[(yy)*f_w + (xx)]=(UINT8)(cc) + #define PUTDOT(xx,yy,cc) V_DrawFill(xx,yy,1,1,cc|V_NOSCALESTART); dx = fl->b.x - fl->a.x; ax = 2 * (dx < 0 ? -dx : dx); @@ -905,7 +764,7 @@ static void AM_drawFline_soft(const fline_t *fl, INT32 color) d = ay - ax/2; for (;;) { - PUTDOT(x, y, color); + PUTDOT(x, y, color) if (x == fl->b.x) return; if (d >= 0) @@ -922,7 +781,7 @@ static void AM_drawFline_soft(const fline_t *fl, INT32 color) d = ax - ay/2; for (;;) { - PUTDOT(x, y, color); + PUTDOT(x, y, color) if (y == fl->b.y) return; if (d >= 0) @@ -934,6 +793,8 @@ static void AM_drawFline_soft(const fline_t *fl, INT32 color) d += ax; } } + + #undef PUTDOT } // @@ -1004,15 +865,15 @@ static inline void AM_drawWalls(void) for (i = 0; i < numlines; i++) { - l.a.x = lines[i].v1->x; - l.a.y = lines[i].v1->y; - l.b.x = lines[i].v2->x; - l.b.y = lines[i].v2->y; + l.a.x = lines[i].v1->x >> FRACTOMAPBITS; + l.a.y = lines[i].v1->y >> FRACTOMAPBITS; + l.b.x = lines[i].v2->x >> FRACTOMAPBITS; + l.b.y = lines[i].v2->y >> FRACTOMAPBITS; #ifdef ESLOPE #define SLOPEPARAMS(slope, end1, end2, normalheight) \ if (slope) { \ - end1 = P_GetZAt(slope, l.a.x, l.a.y); \ - end2 = P_GetZAt(slope, l.b.x, l.b.y); \ + end1 = P_GetZAt(slope, lines[i].v1->x, lines[i].v1->y); \ + end2 = P_GetZAt(slope, lines[i].v2->x, lines[i].v2->y); \ } else \ end1 = end2 = normalheight; @@ -1025,17 +886,12 @@ static inline void AM_drawWalls(void) #undef SLOPEPARAMS #endif -// AM_drawMline(&l, GRAYS + 3); // Old, everything-is-gray automap if (!lines[i].backsector) // 1-sided { if (lines[i].flags & ML_NOCLIMB) - { - AM_drawMline(&l, NOCLIMBWALLCOLORS+lightlev); - } + AM_drawMline(&l, NOCLIMBWALLCOLORS); else - { - AM_drawMline(&l, WALLCOLORS+lightlev); - } + AM_drawMline(&l, WALLCOLORS); } #ifdef ESLOPE else if ((backf1 == backc1 && backf2 == backc2) // Back is thok barrier @@ -1052,24 +908,16 @@ static inline void AM_drawWalls(void) #endif { if (lines[i].flags & ML_NOCLIMB) - { - AM_drawMline(&l, NOCLIMBTSWALLCOLORS+lightlev); - } + AM_drawMline(&l, NOCLIMBTSWALLCOLORS); else - { - AM_drawMline(&l, TSWALLCOLORS+lightlev); - } + AM_drawMline(&l, TSWALLCOLORS); } else { if (lines[i].flags & ML_NOCLIMB) - { - AM_drawMline(&l, NOCLIMBTHOKWALLCOLORS+lightlev); - } + AM_drawMline(&l, NOCLIMBTHOKWALLCOLORS); else - { - AM_drawMline(&l, THOKWALLCOLORS+lightlev); - } + AM_drawMline(&l, THOKWALLCOLORS); } } else @@ -1081,7 +929,7 @@ static inline void AM_drawWalls(void) if (lines[i].backsector->floorheight != lines[i].frontsector->floorheight) { #endif - AM_drawMline(&l, NOCLIMBFDWALLCOLORS + lightlev); // floor level change + AM_drawMline(&l, NOCLIMBFDWALLCOLORS); // floor level change } #ifdef ESLOPE else if (backc1 != frontc1 || backc2 != frontc2) { @@ -1089,11 +937,10 @@ static inline void AM_drawWalls(void) else if (lines[i].backsector->ceilingheight != lines[i].frontsector->ceilingheight) { #endif - AM_drawMline(&l, NOCLIMBCDWALLCOLORS+lightlev); // ceiling level change - } - else { - AM_drawMline(&l, NOCLIMBTSWALLCOLORS+lightlev); + AM_drawMline(&l, NOCLIMBCDWALLCOLORS); // ceiling level change } + else + AM_drawMline(&l, NOCLIMBTSWALLCOLORS); } else { @@ -1103,7 +950,7 @@ static inline void AM_drawWalls(void) if (lines[i].backsector->floorheight != lines[i].frontsector->floorheight) { #endif - AM_drawMline(&l, FDWALLCOLORS + lightlev); // floor level change + AM_drawMline(&l, FDWALLCOLORS); // floor level change } #ifdef ESLOPE else if (backc1 != frontc1 || backc2 != frontc2) { @@ -1111,11 +958,10 @@ static inline void AM_drawWalls(void) else if (lines[i].backsector->ceilingheight != lines[i].frontsector->ceilingheight) { #endif - AM_drawMline(&l, CDWALLCOLORS+lightlev); // ceiling level change - } - else { - AM_drawMline(&l, TSWALLCOLORS+lightlev); + AM_drawMline(&l, CDWALLCOLORS); // ceiling level change } + else + AM_drawMline(&l, TSWALLCOLORS); } } } @@ -1176,6 +1022,11 @@ static void AM_drawLineCharacter(const mline_t *lineguy, size_t lineguylines, fi l.b.x += x; l.b.y += y; + l.a.x >>= FRACTOMAPBITS; + l.a.y >>= FRACTOMAPBITS; + l.b.x >>= FRACTOMAPBITS; + l.b.y >>= FRACTOMAPBITS; + AM_drawMline(&l, color); } } @@ -1184,83 +1035,51 @@ static inline void AM_drawPlayers(void) { INT32 i; player_t *p; - INT32 color; + INT32 color = GREENS; if (!multiplayer) { - AM_drawLineCharacter(player_arrow, NUMPLYRLINES, 0, - plr->mo->angle, DWHITE, plr->mo->x, plr->mo->y); + AM_drawLineCharacter(player_arrow, NUMPLYRLINES, 0, plr->mo->angle, DWHITE, plr->mo->x, plr->mo->y); return; } - // multiplayer + // multiplayer (how??) for (i = 0; i < MAXPLAYERS; i++) { if (!playeringame[i] || players[i].spectator) continue; p = &players[i]; - if (p->skincolor == 0) - color = GREENS; - else + if (p->skincolor > 0) color = R_GetTranslationColormap(TC_DEFAULT, p->skincolor, GTC_CACHE)[GREENS + 8]; - AM_drawLineCharacter(player_arrow, NUMPLYRLINES, 0, p->mo->angle, - color, p->mo->x, p->mo->y); + AM_drawLineCharacter(player_arrow, NUMPLYRLINES, 0, p->mo->angle, color, p->mo->x, p->mo->y); } } -static inline void AM_drawThings(INT32 colors, INT32 colorrange) +static inline void AM_drawThings(UINT8 colors) { size_t i; mobj_t *t; - (void)colorrange; for (i = 0; i < numsectors; i++) { t = sectors[i].thinglist; while (t) { - AM_drawLineCharacter(thintriangle_guy, NUMTHINTRIANGLEGUYLINES, - 16<angle, colors + lightlev, t->x, t->y); + AM_drawLineCharacter(thintriangle_guy, NUMTHINTRIANGLEGUYLINES, 16<angle, colors, t->x, t->y); t = t->snext; } } } -static inline void AM_drawMarks(void) -{ - INT32 i, fx, fy, w, h; - - for (i = 0; i < AM_NUMMARKPOINTS; i++) - { - if (markpoints[i].x != -1 && marknums[i]) - { - // w = SHORT(marknums[i]->width); - // h = SHORT(marknums[i]->height); - w = 5; // because something's wrong with the wad, i guess - h = 6; // because something's wrong with the wad, i guess - fx = CXMTOF(markpoints[i].x); - fy = CYMTOF(markpoints[i].y); - if (fx >= f_x && fx <= f_w - w && fy >= f_y && fy <= f_h - h) - V_DrawPatch(fx, fy, FB, marknums[i]); - } - } -} - /** Draws the crosshair, actually just a dot in software mode. * * \param color Color for the crosshair. */ -static inline void AM_drawCrosshair(INT32 color) +static inline void AM_drawCrosshair(UINT8 color) { - if (rendermode != render_soft) - return; // BP: should be putpixel here - - if (scr_bpp == 1) - fb[(f_w*(f_h + 1))/2] = (UINT8)color; // single point for now - else - *((INT16 *)(void *)fb + (f_w*(f_h + 1))/2) = (INT16)color; + V_DrawFill(f_w/2 + f_x, f_h/2 + f_y, 1, 1, color|V_NOSCALESTART); } /** Draws the automap. @@ -1271,13 +1090,10 @@ void AM_Drawer(void) return; AM_clearFB(BACKGROUND); - if (grid) - AM_drawGrid(GRIDCOLORS); + if (draw_grid) AM_drawGrid(GRIDCOLORS); AM_drawWalls(); AM_drawPlayers(); - AM_drawThings(THINGCOLORS, THINGRANGE); + AM_drawThings(THINGCOLORS); AM_drawCrosshair(XHAIRCOLORS); - - AM_drawMarks(); } diff --git a/src/android/i_sound.c b/src/android/i_sound.c index 2bb304424..b5a1c3646 100644 --- a/src/android/i_sound.c +++ b/src/android/i_sound.c @@ -96,6 +96,37 @@ boolean I_SetSongSpeed(float speed) return false; } +/// ------------------------ +// MUSIC SEEKING +/// ------------------------ + +UINT32 I_GetSongLength(void) +{ + return 0; +} + +boolean I_SetSongLoopPoint(UINT32 looppoint) +{ + (void)looppoint; + return false; +} + +UINT32 I_GetSongLoopPoint(void) +{ + return 0; +} + +boolean I_SetSongPosition(UINT32 position) +{ + (void)position; + return false; +} + +UINT32 I_GetSongPosition(void) +{ + return 0; +} + /// ------------------------ // MUSIC PLAYBACK /// ------------------------ @@ -140,3 +171,44 @@ void I_SetMusicVolume(INT32 volume) { (void)volume; } + +/// ------------------------ +// MUSIC FADING +/// ------------------------ + +void I_SetInternalMusicVolume(UINT8 volume) +{ + (void)volume; +} + +void I_StopFadingSong(void) +{ +} + +boolean I_FadeSongFromVolume(UINT8 target_volume, UINT8 source_volume, UINT32 ms, void (*callback)(void)); +{ + (void)target_volume; + (void)source_volume; + (void)ms; + return false; +} + +boolean I_FadeSong(UINT8 target_volume, UINT32 ms, void (*callback)(void)); +{ + (void)target_volume; + (void)ms; + return false; +} + +boolean I_FadeOutStopSong(UINT32 ms) +{ + (void)ms; + return false; +} + +boolean I_FadeInPlaySong(UINT32 ms, boolean looping) +{ + (void)ms; + (void)looping; + return false; +} diff --git a/src/apng.c b/src/apng.c new file mode 100644 index 000000000..694b3d1e8 --- /dev/null +++ b/src/apng.c @@ -0,0 +1,289 @@ +/* +Copyright 2019, James R. +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + +1. Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + +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 COPYRIGHT OWNER 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. +*/ + +#include +#include + +#include "apng.h" + +#define APNG_INFO_acTL 0x20000U + +#define APNG_WROTE_acTL 0x10000U + +struct apng_info_def +{ + png_uint_32 mode; + png_uint_32 valid; + + png_uint_32 num_frames; + png_uint_32 num_plays; + + long start_acTL;/* acTL is written here */ + + png_flush_ptr output_flush_fn; + apng_seek_ptr output_seek_fn; + apng_tell_ptr output_tell_fn; + + apng_set_acTL_ptr set_acTL_fn; +}; + +/* PROTOS (FUCK COMPILER) */ +void apng_seek (png_structp, apng_const_infop, size_t); +size_t apng_tell (png_structp, apng_const_infop); +#ifdef PNG_WRITE_FLUSH_SUPPORTED +void apng_flush (png_structp, apng_infop); +#ifdef PNG_STDIO_SUPPORTED +void apng_default_flush (png_structp); +#endif/* PNG_STDIO_SUPPORTED */ +#endif/* PNG_WRITE_FLUSH_SUPPORTED */ +#ifdef PNG_STDIO_SUPPORTED +void apng_default_seek (png_structp, size_t); +size_t apng_default_tell (png_structp); +#endif/* PNG_STDIO_SUPPORTED */ +void apng_write_IEND (png_structp); +void apng_write_acTL (png_structp, png_uint_32, png_uint_32); +#ifndef PNG_WRITE_APNG_SUPPORTED +png_uint_32 apng_set_acTL_dummy (png_structp, png_infop, + png_uint_32, png_uint_32); +#endif/* PNG_WRITE_APNG_SUPPORTED */ + +apng_infop +apng_create_info_struct (png_structp pngp) +{ + apng_infop ainfop; + (void)pngp; + if (( ainfop = calloc(sizeof (apng_info),1) )) + { + apng_set_write_fn(pngp, ainfop, 0, 0, 0, 0, 0); + apng_set_set_acTL_fn(pngp, ainfop, 0); + } + return ainfop; +} + +void +apng_destroy_info_struct (png_structp pngp, apng_infopp ainfopp) +{ + (void)pngp; + if (!( pngp && ainfopp )) + return; + + free((*ainfopp)); +} + +void +apng_seek (png_structp pngp, apng_const_infop ainfop, size_t l) +{ + (*(ainfop->output_seek_fn))(pngp, l); +} + +size_t +apng_tell (png_structp pngp, apng_const_infop ainfop) +{ + return (*(ainfop->output_tell_fn))(pngp); +} + +#ifdef PNG_WRITE_FLUSH_SUPPORTED +void +apng_flush (png_structp pngp, apng_infop ainfop) +{ + if (ainfop->output_flush_fn) + (*(ainfop->output_flush_fn))(pngp); +} + +#ifdef PNG_STDIO_SUPPORTED +void +apng_default_flush (png_structp pngp) +{ + if (!( pngp )) + return; + + fflush((png_FILE_p)png_get_io_ptr); +} +#endif/* PNG_STDIO_SUPPORTED */ +#endif/* PNG_WRITE_FLUSH_SUPPORTED */ + +#ifdef PNG_STDIO_SUPPORTED +void +apng_default_seek (png_structp pngp, size_t l) +{ + if (!( pngp )) + return; + + if (fseek((png_FILE_p)png_get_io_ptr(pngp), (long)l, SEEK_SET) == -1) + png_error(pngp, "Seek Error"); +} + +size_t +apng_default_tell (png_structp pngp) +{ + long l; + + if (!( pngp )) + { + png_error(pngp, "Call to apng_default_tell with NULL pngp failed"); + } + + if (( l = ftell((png_FILE_p)png_get_io_ptr(pngp)) ) == -1) + png_error(pngp, "Tell Error"); + + return (size_t)l; +} +#endif/* PNG_STDIO_SUPPORTED */ + +void +apng_set_write_fn (png_structp pngp, apng_infop ainfop, png_voidp iop, + png_rw_ptr write_f, png_flush_ptr flush_f, + apng_seek_ptr seek_f, apng_tell_ptr tell_f) +{ + if (!( pngp && ainfop )) + return; + + png_set_write_fn(pngp, iop, write_f, flush_f); + +#ifdef PNG_WRITE_FLUSH_SUPPORTED +#ifdef PNG_STDIO_SUPPORTED + if (!flush_f) + ainfop->output_flush_fn = &apng_default_flush; + else +#endif/* PNG_STDIO_SUPPORTED */ + ainfop->output_flush_fn = flush_f; +#endif/* PNG_WRITE_FLUSH_SUPPORTED */ +#ifdef PNG_STDIO_SUPPORTED + if (!seek_f) + ainfop->output_seek_fn = &apng_default_seek; + else +#endif/* PNG_STDIO_SUPPORTED */ + ainfop->output_seek_fn = seek_f; +#ifdef PNG_STDIO_SUPPORTED + if (!seek_f) + ainfop->output_tell_fn = apng_default_tell; + else +#endif/* PNG_STDIO_SUPPORTED */ + ainfop->output_tell_fn = tell_f; +} + +void +apng_write_IEND (png_structp pngp) +{ + png_byte chunkc[] = "IEND"; + png_write_chunk(pngp, chunkc, 0, 0); +} + +void +apng_write_acTL (png_structp pngp, png_uint_32 frames, png_uint_32 plays) +{ + png_byte chunkc[] = "acTL"; + png_byte buf[8]; + png_save_uint_32(buf, frames); + png_save_uint_32(buf + 4, plays); + png_write_chunk(pngp, chunkc, buf, 8); +} + +png_uint_32 +apng_set_acTL (png_structp pngp, png_infop infop, apng_infop ainfop, + png_uint_32 frames, png_uint_32 plays) +{ + (void)pngp; + (void)infop; + if (!( pngp && infop && ainfop )) + return 0; + + ainfop->num_frames = frames; + ainfop->num_plays = plays; + + ainfop->valid |= APNG_INFO_acTL; + + return 1; +} + +void +apng_write_info_before_PLTE (png_structp pngp, png_infop infop, + apng_infop ainfop) +{ + if (!( pngp && infop && ainfop )) + return; + + png_write_info_before_PLTE(pngp, infop); + + if (( ainfop->valid & APNG_INFO_acTL )&&!( ainfop->mode & APNG_WROTE_acTL )) + { + ainfop->start_acTL = apng_tell(pngp, ainfop); + + apng_write_acTL(pngp, 0, 0); + /* modified for runtime dynamic linking */ + (*(ainfop->set_acTL_fn))(pngp, infop, PNG_UINT_31_MAX, 0); + + ainfop->mode |= APNG_WROTE_acTL; + } +} + +void +apng_write_info (png_structp pngp, png_infop infop, + apng_infop ainfop) +{ + apng_write_info_before_PLTE(pngp, infop, ainfop); + png_write_info(pngp, infop); +} + +void +apng_write_end (png_structp pngp, png_infop infop, apng_infop ainfop) +{ + (void)infop; + apng_write_IEND(pngp); + apng_seek(pngp, ainfop, ainfop->start_acTL); + apng_write_acTL(pngp, ainfop->num_frames, ainfop->num_plays); + +#ifdef PNG_WRITE_FLUSH_SUPPORTED +#ifdef PNG_WRITE_FLUSH_AFTER_IEND_SUPPORTED + apng_flush(pngp, infop); +#endif/* PNG_WRITE_FLUSH_SUPPORTED */ +#endif/* PNG_WRITE_FLUSH_AFTER_IEND_SUPPORTED */ +} + +#ifndef PNG_WRITE_APNG_SUPPORTED +png_uint_32 +apng_set_acTL_dummy (png_structp pngp, png_infop infop, + png_uint_32 frames, png_uint_32 plays) +{ + (void)pngp; + (void)infop; + (void)frames; + (void)plays; + return 0; +} +#endif/* PNG_WRITE_APNG_SUPPORTED */ + +/* Dynamic runtime linking capable! (Hopefully.) */ +void +apng_set_set_acTL_fn (png_structp pngp, apng_infop ainfop, + apng_set_acTL_ptr set_acTL_f) +{ + (void)pngp; + if (!ainfop->set_acTL_fn) +#ifndef PNG_WRITE_APNG_SUPPORTED + ainfop->set_acTL_fn = &apng_set_acTL_dummy; +#else + ainfop->set_acTL_fn = &png_set_acTL; +#endif/* PNG_WRITE_APNG_SUPPORTED */ + else + ainfop->set_acTL_fn = set_acTL_f; +} diff --git a/src/apng.h b/src/apng.h new file mode 100644 index 000000000..0f22dca6d --- /dev/null +++ b/src/apng.h @@ -0,0 +1,80 @@ +/* +Copyright 2019, James R. +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + +1. Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + +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 COPYRIGHT OWNER 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. +*/ + +#ifndef APNG_H +#define APNG_H + +#ifndef _MSC_VER +#ifndef _LARGEFILE64_SOURCE +#define _LARGEFILE64_SOURCE +#endif +#endif + +#ifndef _LFS64_LARGEFILE +#define _LFS64_LARGEFILE +#endif + +#ifndef _FILE_OFFSET_BITS +#define _FILE_OFFSET_BITS 0 +#endif + +#include + +typedef struct apng_info_def apng_info; +typedef apng_info * apng_infop; +typedef const apng_info * apng_const_infop; +typedef apng_info * * apng_infopp; + +typedef void (*apng_seek_ptr)(png_structp, size_t); +typedef size_t (*apng_tell_ptr)(png_structp); + +typedef png_uint_32 (*apng_set_acTL_ptr)(png_structp, png_infop, + png_uint_32, png_uint_32); + +apng_infop apng_create_info_struct (png_structp png_ptr); + +void apng_destroy_info_struct (png_structp png_ptr, + apng_infopp info_ptr_ptr); + +/* Call the following functions in place of the libpng counterparts. */ + +png_uint_32 apng_set_acTL (png_structp png_ptr, png_infop info_ptr, + apng_infop ainfo_ptr, + png_uint_32 num_frames, png_uint_32 num_plays); + +void apng_write_info_before_PLTE (png_structp png_ptr, png_infop info_ptr, + apng_infop ainfo_ptr); +void apng_write_info (png_structp png_ptr, png_infop info_ptr, + apng_infop ainfo_ptr); + +void apng_write_end (png_structp png_ptr, png_infop info_ptr, + apng_infop ainfo_ptr); + +void apng_set_write_fn (png_structp png_ptr, apng_infop ainfo_ptr, + png_voidp io_ptr, + png_rw_ptr write_data_fn, png_flush_ptr output_flush_fn, + apng_seek_ptr output_seek_fn, apng_tell_ptr output_tell_fn); + +void apng_set_set_acTL_fn (png_structp png_ptr, apng_infop ainfo_ptr, + apng_set_acTL_ptr set_acTL_fn); + +#endif/* APNG_H */ 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 47c6d2e5f..cfb36f02f 100644 --- a/src/command.c +++ b/src/command.c @@ -32,6 +32,7 @@ #include "hu_stuff.h" #include "p_setup.h" #include "lua_script.h" +#include "d_netfil.h" // findfile //======== // protos. @@ -49,6 +50,7 @@ static void COM_Wait_f(void); static void COM_Help_f(void); static void COM_Toggle_f(void); +static void CV_EnforceExecVersion(void); static boolean CV_FilterVarByVersion(consvar_t *v, const char *valstr); static boolean CV_Command(void); static consvar_t *CV_FindVar(const char *name); @@ -63,10 +65,11 @@ CV_PossibleValue_t CV_YesNo[] = {{0, "No"}, {1, "Yes"}, {0, NULL}}; CV_PossibleValue_t CV_Unsigned[] = {{0, "MIN"}, {999999999, "MAX"}, {0, NULL}}; CV_PossibleValue_t CV_Natural[] = {{1, "MIN"}, {999999999, "MAX"}, {0, NULL}}; -// Filter consvars by MODVERSION +// Filter consvars by EXECVERSION // First implementation is 26 (2.1.21), so earlier configs default at 25 (2.1.20) // Also set CV_HIDEN during runtime, after config is loaded -consvar_t cv_execversion = {"execversion","25",0,CV_Unsigned, NULL, 0, NULL, NULL, 0, 0, NULL}; +static boolean execversion_enabled = false; +consvar_t cv_execversion = {"execversion","25",CV_CALL,CV_Unsigned, CV_EnforceExecVersion, 0, NULL, NULL, 0, 0, NULL}; // for default joyaxis detection static boolean joyaxis_default = false; @@ -145,6 +148,20 @@ void COM_BufInsertText(const char *ptext) } } +/** Progress the wait timer and flush waiting console commands when ready. + */ +void +COM_BufTicker(void) +{ + if (com_wait) + { + com_wait--; + return; + } + + COM_BufExecute(); +} + /** Flushes (executes) console commands in the buffer. */ void COM_BufExecute(void) @@ -154,12 +171,6 @@ void COM_BufExecute(void) char line[1024] = ""; INT32 quotes; - if (com_wait) - { - com_wait--; - return; - } - while (com_text.cursize) { // find a '\n' or; line break @@ -511,7 +522,6 @@ static void COM_ExecuteString(char *ptext) { if (!stricmp(com_argv[0], cmd->name)) //case insensitive now that we have lower and uppercase! { - recursion = 0; cmd->function(); return; } @@ -523,19 +533,17 @@ static void COM_ExecuteString(char *ptext) if (!stricmp(com_argv[0], a->name)) { if (recursion > MAX_ALIAS_RECURSION) - { CONS_Alert(CONS_WARNING, M_GetText("Alias recursion cycle detected!\n")); - recursion = 0; - return; + else + { // Monster Iestyn: keep track of how many levels of recursion we're in + recursion++; + COM_BufInsertText(a->value); + recursion--; } - recursion++; - COM_BufInsertText(a->value); return; } } - recursion = 0; - // check cvars // Hurdler: added at Ebola's request ;) // (don't flood the console in software mode with bad gr_xxx command) @@ -641,6 +649,7 @@ static void COM_CEchoDuration_f(void) static void COM_Exec_f(void) { UINT8 *buf = NULL; + char filename[256]; if (COM_Argc() < 2 || COM_Argc() > 3) { @@ -649,13 +658,23 @@ static void COM_Exec_f(void) } // load file + // Try with Argv passed verbatim first, for back compat FIL_ReadFile(COM_Argv(1), &buf); if (!buf) { - if (!COM_CheckParm("-noerror")) - CONS_Printf(M_GetText("couldn't execute file %s\n"), COM_Argv(1)); - return; + // Now try by searching the file path + // filename is modified with the full found path + strcpy(filename, COM_Argv(1)); + if (findfile(filename, NULL, true) != FS_NOTFOUND) + FIL_ReadFile(filename, &buf); + + if (!buf) + { + if (!COM_CheckParm("-noerror")) + CONS_Printf(M_GetText("couldn't execute file %s\n"), COM_Argv(1)); + return; + } } if (!COM_CheckParm("-silent")) @@ -1090,7 +1109,7 @@ static void Setvalue(consvar_t *var, const char *valstr, boolean stealth) if (var->flags & CV_FLOAT) { double d = atof(valstr); - if (!d && valstr[0] != '0') + if (fpclassify(d) == FP_ZERO && valstr[0] != '0') v = INT32_MIN; else v = (INT32)(d * FRACUNIT); @@ -1185,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. @@ -1251,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; @@ -1270,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); @@ -1371,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)))) { @@ -1379,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) { @@ -1412,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. * @@ -1421,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() @@ -1442,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. @@ -1465,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) { @@ -1535,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) @@ -1586,14 +1648,24 @@ void CV_InitFilterVar(void) joyaxis_count = joyaxis2_count = 0; } +void CV_ToggleExecVersion(boolean enable) +{ + execversion_enabled = enable; +} + +static void CV_EnforceExecVersion(void) +{ + if (!execversion_enabled) + CV_StealthSetValue(&cv_execversion, EXECVERSION); +} + static boolean CV_FilterJoyAxisVars(consvar_t *v, const char *valstr) { // If ALL axis settings are previous defaults, set them to the new defaults - // MODVERSION < 26 (2.1.21) + // EXECVERSION < 26 (2.1.21) if (joyaxis_default) { -#if !defined (_WII) && !defined (WMINPUT) if (!stricmp(v->name, "joyaxis_turn")) { if (joyaxis_count > 6) return false; @@ -1603,7 +1675,6 @@ static boolean CV_FilterJoyAxisVars(consvar_t *v, const char *valstr) if (!stricmp(valstr, "X-Axis")) joyaxis_count++; else joyaxis_default = false; } -#if !defined (PSP) if (!stricmp(v->name, "joyaxis_move")) { if (joyaxis_count > 6) return false; @@ -1612,8 +1683,6 @@ static boolean CV_FilterJoyAxisVars(consvar_t *v, const char *valstr) if (!stricmp(valstr, "Y-Axis")) joyaxis_count++; else joyaxis_default = false; } -#endif -#if !defined (_arch_dreamcast) && !defined (_XBOX) && !defined (PSP) if (!stricmp(v->name, "joyaxis_side")) { if (joyaxis_count > 6) return false; @@ -1622,8 +1691,6 @@ static boolean CV_FilterJoyAxisVars(consvar_t *v, const char *valstr) if (!stricmp(valstr, "Z-Axis")) joyaxis_count++; else joyaxis_default = false; } -#endif -#if !defined (_XBOX) && !defined (PSP) if (!stricmp(v->name, "joyaxis_look")) { if (joyaxis_count > 6) return false; @@ -1632,7 +1699,6 @@ static boolean CV_FilterJoyAxisVars(consvar_t *v, const char *valstr) if (!stricmp(valstr, "None")) joyaxis_count++; else joyaxis_default = false; } -#endif if (!stricmp(v->name, "joyaxis_fire") || !stricmp(v->name, "joyaxis_firenormal")) { @@ -1642,7 +1708,6 @@ static boolean CV_FilterJoyAxisVars(consvar_t *v, const char *valstr) if (!stricmp(valstr, "None")) joyaxis_count++; else joyaxis_default = false; } -#endif // reset all axis settings to defaults if (joyaxis_count == 6) { @@ -1659,7 +1724,6 @@ static boolean CV_FilterJoyAxisVars(consvar_t *v, const char *valstr) if (joyaxis2_default) { -#if !defined (_WII) && !defined (WMINPUT) if (!stricmp(v->name, "joyaxis2_turn")) { if (joyaxis2_count > 6) return false; @@ -1669,7 +1733,6 @@ static boolean CV_FilterJoyAxisVars(consvar_t *v, const char *valstr) if (!stricmp(valstr, "X-Axis")) joyaxis2_count++; else joyaxis2_default = false; } -// #if !defined (PSP) if (!stricmp(v->name, "joyaxis2_move")) { if (joyaxis2_count > 6) return false; @@ -1678,8 +1741,6 @@ static boolean CV_FilterJoyAxisVars(consvar_t *v, const char *valstr) if (!stricmp(valstr, "Y-Axis")) joyaxis2_count++; else joyaxis2_default = false; } -// #endif -#if !defined (_arch_dreamcast) && !defined (_XBOX) && !defined (PSP) if (!stricmp(v->name, "joyaxis2_side")) { if (joyaxis2_count > 6) return false; @@ -1688,8 +1749,6 @@ static boolean CV_FilterJoyAxisVars(consvar_t *v, const char *valstr) if (!stricmp(valstr, "Z-Axis")) joyaxis2_count++; else joyaxis2_default = false; } -#endif -#if !defined (_XBOX) // && !defined (PSP) if (!stricmp(v->name, "joyaxis2_look")) { if (joyaxis2_count > 6) return false; @@ -1698,7 +1757,6 @@ static boolean CV_FilterJoyAxisVars(consvar_t *v, const char *valstr) if (!stricmp(valstr, "None")) joyaxis2_count++; else joyaxis2_default = false; } -#endif if (!stricmp(v->name, "joyaxis2_fire") || !stricmp(v->name, "joyaxis2_firenormal")) { @@ -1708,7 +1766,6 @@ static boolean CV_FilterJoyAxisVars(consvar_t *v, const char *valstr) if (!stricmp(valstr, "None")) joyaxis2_count++; else joyaxis2_default = false; } -#endif // reset all axis settings to defaults if (joyaxis2_count == 6) @@ -1737,8 +1794,7 @@ static boolean CV_FilterVarByVersion(consvar_t *v, const char *valstr) if (!(v->flags & CV_SAVE)) return true; - // We go by MODVERSION here - if (cv_execversion.value < 26) // 26 = 2.1.21 + if (GETMAJOREXECVERSION(cv_execversion.value) < 26) // 26 = 2.1.21 { // MOUSE SETTINGS // alwaysfreelook split between first and third person (chasefreelook) diff --git a/src/command.h b/src/command.h index 8dee1174c..4682ba4a4 100644 --- a/src/command.h +++ b/src/command.h @@ -45,6 +45,9 @@ void COM_ImmedExecute(const char *ptext); // Execute commands in buffer, flush them void COM_BufExecute(void); +// As above; and progress the wait timer. +void COM_BufTicker(void); + // setup command buffer, at game tartup void COM_Init(void); @@ -130,6 +133,7 @@ extern CV_PossibleValue_t CV_Natural[]; extern consvar_t cv_execversion; void CV_InitFilterVar(void); +void CV_ToggleExecVersion(boolean enable); // register a variable for use at the console void CV_RegisterVar(consvar_t *variable); diff --git a/src/config.h.in b/src/config.h.in index 7452ec80c..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}" @@ -27,14 +26,14 @@ #else /* Manually defined asset hashes for non-CMake builds - * Last updated 2015 / 05 / 03 + * Last updated 2015 / 05 / 03 - v2.1.15 - main assets + * 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 "dbbf8bc6121618ee3be2d5b14650429b" +#define ASSET_HASH_PATCH_PK3 "dbbf8bc6121618ee3be2d5b14650429b" #endif #endif diff --git a/src/console.c b/src/console.c index 2c148bc69..09a6cab45 100644 --- a/src/console.c +++ b/src/console.c @@ -12,9 +12,6 @@ #ifdef __GNUC__ #include -#ifdef _XBOX -#include -#endif #endif #include "doomdef.h" @@ -33,6 +30,7 @@ #include "i_system.h" #include "d_main.h" #include "m_menu.h" +#include "filesrch.h" #ifdef _WINDOWS #include "win32/win_main.h" @@ -58,10 +56,7 @@ static boolean consoleready; // console prompt is ready INT32 con_destlines; // vid lines used by console at final position static INT32 con_curlines; // vid lines currently used by console - INT32 con_clipviewtop; // clip value for planes & sprites, so that the - // part of the view covered by the console is not - // drawn when not needed, this must be -1 when - // console is off + INT32 con_clipviewtop; // (useless) static INT32 con_hudlines; // number of console heads up message lines static INT32 con_hudtime[MAXHUDLINES]; // remaining time of display for hud msg lines @@ -98,6 +93,7 @@ static size_t input_len; // length of current line, used to bound cursor and suc // protos. static void CON_InputInit(void); static void CON_RecalcSize(void); +static void CON_ChangeHeight(void); static void CONS_hudlines_Change(void); static void CONS_backcolor_Change(void); @@ -131,10 +127,16 @@ static CV_PossibleValue_t backpic_cons_t[] = {{0, "translucent"}, {1, "picture"} // whether to use console background picture, or translucent mode static consvar_t cons_backpic = {"con_backpic", "translucent", CV_SAVE, backpic_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL}; -static CV_PossibleValue_t backcolor_cons_t[] = {{0, "White"}, {1, "Gray"}, {2, "Brown"}, - {3, "Red"}, {4, "Orange"}, {5, "Yellow"}, - {6, "Green"}, {7, "Blue"}, {8, "Cyan"}, +static CV_PossibleValue_t backcolor_cons_t[] = {{0, "White"}, {1, "Black"}, {2, "Sepia"}, + {3, "Brown"}, {4, "Pink"}, {5, "Raspberry"}, + {6, "Red"}, {7, "Creamsicle"}, {8, "Orange"}, + {9, "Gold"}, {10,"Yellow"}, {11,"Emerald"}, + {12,"Green"}, {13,"Cyan"}, {14,"Steel"}, + {15,"Periwinkle"}, {16,"Blue"}, {17,"Purple"}, + {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); @@ -225,96 +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 = 63; break; // Brown - case 3: palindex = 143; break; // Red - case 4: palindex = 95; break; // Orange - case 5: palindex = 111; break; // Yellow - case 6: palindex = 175; break; // Green - case 7: palindex = 239; break; // Blue - case 8: palindex = 219; break; // Cyan + case 0: palindex = 15; break; // White + 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]) >> 6; - consolebgmap[j] = (UINT8)(palindex - palsum); + palsum = (pal[i] + pal[i+1] + pal[i+2]) >> shift; + 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(); @@ -322,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; @@ -432,6 +472,12 @@ static void CON_RecalcSize(void) con_destlines = vid.height; } + if (con_destlines > 0) // Resize console if already open + { + CON_ChangeHeight(); + con_curlines = con_destlines; + } + // check for change of video width if (conw == con_width) return; // didn't change @@ -481,6 +527,20 @@ static void CON_RecalcSize(void) Z_Free(tmp_buffer); } +static void CON_ChangeHeight(void) +{ + INT32 minheight = 20 * con_scalefactor; // 20 = 8+8+4 + + // toggle console in + con_destlines = (cons_height.value*vid.height)/100; + if (con_destlines < minheight) + con_destlines = minheight; + else if (con_destlines > vid.height) + con_destlines = vid.height; + + con_destlines &= ~0x3; // multiple of text row height +} + // Handles Console moves in/out of screen (per frame) // static void CON_MoveConsole(void) @@ -569,16 +629,7 @@ void CON_Ticker(void) CON_ClearHUD(); } else - { - // toggle console in - con_destlines = (cons_height.value*vid.height)/100; - if (con_destlines < minheight) - con_destlines = minheight; - else if (con_destlines > vid.height) - con_destlines = vid.height; - - con_destlines &= ~0x3; // multiple of text row height - } + CON_ChangeHeight(); } // console movement @@ -842,7 +893,7 @@ boolean CON_Responder(event_t *ev) // ...why shouldn't it eat the key? if it doesn't, it just means you // can control Sonic from the console, which is silly - return true; //return false; + return true;//return false; } // command completion forward (tab) and backward (shift-tab) @@ -1026,25 +1077,30 @@ 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]; } else if (key == KEY_KPADSLASH) key = '/'; - if (shiftdown) + if (key >= 'a' && key <= 'z') + { + if (capslock ^ shiftdown) + key = shiftxform[key]; + } + else if (shiftdown) key = shiftxform[key]; // enter a char into the command prompt if (key < 32 || key > 127) - return true; // even if key can't be printed, eat it anyway + return true; // add key to cmd line here - if (key >= 'A' && key <= 'Z' && !shiftdown) //this is only really necessary for dedicated servers + if (key >= 'A' && key <= 'Z' && !(shiftdown ^ capslock)) //this is only really necessary for dedicated servers key = key + 'a' - 'A'; if (input_sel != input_cur) @@ -1076,6 +1132,7 @@ static void CON_Print(char *msg) { size_t l; INT32 controlchars = 0; // for color changing + char color = '\x80'; // keep color across lines if (msg == NULL) return; @@ -1101,7 +1158,7 @@ static void CON_Print(char *msg) { if (*msg & 0x80) { - con_line[con_cx++] = *(msg++); + color = con_line[con_cx++] = *(msg++); controlchars++; continue; } @@ -1109,12 +1166,14 @@ static void CON_Print(char *msg) { con_cy--; CON_Linefeed(); + color = '\x80'; controlchars = 0; } else if (*msg == '\n') // linefeed { CON_Linefeed(); - controlchars = 0; + con_line[con_cx++] = color; + controlchars = 1; } else if (*msg == ' ') // space { @@ -1122,7 +1181,8 @@ static void CON_Print(char *msg) if (con_cx - controlchars >= con_width-11) { CON_Linefeed(); - controlchars = 0; + con_line[con_cx++] = color; + controlchars = 1; } } else if (*msg == '\t') @@ -1137,7 +1197,8 @@ static void CON_Print(char *msg) if (con_cx - controlchars >= con_width-11) { CON_Linefeed(); - controlchars = 0; + con_line[con_cx++] = color; + controlchars = 1; } } msg++; @@ -1154,7 +1215,8 @@ static void CON_Print(char *msg) if ((con_cx - controlchars) + l > con_width-11) { CON_Linefeed(); - controlchars = 0; + con_line[con_cx++] = color; + controlchars = 1; } // a word at a time @@ -1165,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++) @@ -1201,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); @@ -1230,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 @@ -1261,12 +1318,15 @@ void CONS_Alert(alerttype_t level, const char *fmt, ...) switch (level) { case CONS_NOTICE: + // no notice for notices, hehe CONS_Printf("\x83" "%s" "\x80 ", M_GetText("NOTICE:")); break; case CONS_WARNING: + refreshdirmenu |= REFRESHDIR_WARNING; CONS_Printf("\x82" "%s" "\x80 ", M_GetText("WARNING:")); break; case CONS_ERROR: + refreshdirmenu |= REFRESHDIR_ERROR; CONS_Printf("\x85" "%s" "\x80 ", M_GetText("ERROR:")); break; } @@ -1378,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); } } @@ -1422,8 +1482,8 @@ static void CON_DrawHudlines(void) if (con_hudlines <= 0) return; - if (chat_on) - y = charheight; // leave place for chat input in the first row of text + if (chat_on && OLDCHAT) + y = charheight; // leave place for chat input in the first row of text (only do it if consolechat is on.) else y = 0; @@ -1451,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; } @@ -1506,8 +1566,7 @@ static void CON_DrawConsole(void) i = con_cy - con_scrollup; // skip the last empty line due to the cursor being at the start of a new line - if (!con_scrollup && !con_cx) - i--; + i--; i -= (con_curlines - minheight) / charheight; @@ -1527,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); } } @@ -1548,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_ENDING || 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 cd8367af8..01e94485d 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 @@ -44,6 +42,7 @@ #include "lzf.h" #include "lua_script.h" #include "lua_hook.h" +#include "md5.h" #ifdef CLIENT_LOADINGSCREEN // cl loading screen @@ -51,10 +50,6 @@ #include "f_finale.h" #endif -#ifdef _XBOX -#include "sdl12/SRB2XBOX/xboxhelp.h" -#endif - // // NETWORKING // @@ -116,6 +111,9 @@ static UINT8 resynch_local_inprogress = false; // WE are desynched and getting p static UINT8 player_joining = false; UINT8 hu_resynching = 0; +UINT8 adminpassmd5[16]; +boolean adminpasswordset = false; + // Client specific static ticcmd_t localcmds; static ticcmd_t localcmds2; @@ -394,7 +392,7 @@ static void ExtraDataTicker(void) { if (server) { - XBOXSTATIC UINT8 buf[3]; + UINT8 buf[3]; buf[0] = (UINT8)i; buf[1] = KICK_MSG_CON_FAIL; @@ -515,11 +513,16 @@ static inline void resynch_write_player(resynch_pak *rsp, const size_t i) rsp->currentweapon = LONG(players[i].currentweapon); rsp->ringweapons = LONG(players[i].ringweapons); + rsp->ammoremoval = (UINT16)SHORT(players[i].ammoremoval); + rsp->ammoremovaltimer = (tic_t)LONG(players[i].ammoremovaltimer); + rsp->ammoremovalweapon = LONG(players[i].ammoremovalweapon); + for (j = 0; j < NUMPOWERS; ++j) 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 +531,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 +547,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 +563,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 +582,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 +610,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); @@ -641,11 +648,16 @@ static void resynch_read_player(resynch_pak *rsp) players[i].currentweapon = LONG(rsp->currentweapon); players[i].ringweapons = LONG(rsp->ringweapons); + players[i].ammoremoval = (UINT16)SHORT(rsp->ammoremoval); + players[i].ammoremovaltimer = (tic_t)LONG(rsp->ammoremovaltimer); + players[i].ammoremovalweapon = LONG(rsp->ammoremovalweapon); + for (j = 0; j < NUMPOWERS; ++j) 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 +666,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 +682,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 +698,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 +717,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 +778,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 +901,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 +918,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 +936,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 +1037,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 +1139,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 +1149,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 +1196,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 +1358,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 +1402,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 +1414,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 +1532,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 +1574,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 +2015,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 +2048,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 @@ -2056,17 +2090,11 @@ static void CL_ConnectToServer(boolean viams) if (i != -1) { - INT32 j; + UINT8 num = serverlist[i].info.gametype; const char *gametypestr = NULL; CONS_Printf(M_GetText("Connecting to: %s\n"), serverlist[i].info.servername); - for (j = 0; gametype_cons_t[j].strvalue; j++) - { - if (gametype_cons_t[j].value == serverlist[i].info.gametype) - { - gametypestr = gametype_cons_t[j].strvalue; - break; - } - } + if (num < NUMGAMETYPES) + gametypestr = Gametype_Names[num]; if (gametypestr) CONS_Printf(M_GetText("Gametype: %s\n"), gametypestr); CONS_Printf(M_GetText("Version: %d.%d.%u\n"), serverlist[i].info.version/100, @@ -2265,7 +2293,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; } @@ -2279,7 +2308,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; @@ -2288,6 +2317,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")) @@ -2311,10 +2341,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")); @@ -2344,12 +2377,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)); } @@ -2383,11 +2411,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++) { @@ -2396,25 +2424,27 @@ 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; } } } #ifdef HAVE_BLUA LUAh_PlayerQuit(&players[playernum], reason); // Lua hook for player quitting +#else + (void)reason; #endif // Reset player data @@ -2577,7 +2607,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]; @@ -2596,7 +2626,10 @@ static void Command_Ban(void) else { if (server) // only the server is allowed to do this right now + { Ban_Add(COM_Argv(2)); + D_SaveBan(); // save the ban list + } if (COM_Argc() == 2) { @@ -2627,6 +2660,42 @@ static void Command_Ban(void) } +static void Command_BanIP(void) +{ + if (COM_Argc() < 2) + { + CONS_Printf(M_GetText("banip : ban an ip address\n")); + return; + } + + if (server) // Only the server can use this, otherwise does nothing. + { + const char *address = (COM_Argv(1)); + const char *reason; + + if (COM_Argc() == 2) + reason = NULL; + else + reason = COM_Argv(2); + + + if (I_SetBanAddress && I_SetBanAddress(address, NULL)) + { + if (reason) + CONS_Printf("Banned IP address %s for: %s\n", address, reason); + else + CONS_Printf("Banned IP address %s\n", address); + + Ban_Add(reason); + D_SaveBan(); + } + else + { + return; + } + } +} + static void Command_Kick(void) { if (COM_Argc() < 2) @@ -2643,7 +2712,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)); @@ -2695,7 +2764,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; @@ -2762,7 +2831,7 @@ static void Got_KickCmd(UINT8 **p, INT32 playernum) msg = KICK_MSG_CON_FAIL; } - CONS_Printf("\x82%s ", player_names[pnum]); + //CONS_Printf("\x82%s ", player_names[pnum]); // If a verified admin banned someone, the server needs to know about it. // If the playernum isn't zero (the server) then the server needs to record the ban. @@ -2779,17 +2848,17 @@ static void Got_KickCmd(UINT8 **p, INT32 playernum) switch (msg) { case KICK_MSG_GO_AWAY: - CONS_Printf(M_GetText("has been kicked (Go away)\n")); + HU_AddChatText(va("\x82*%s has been kicked (Go away)", player_names[pnum]), false); kickreason = KR_KICK; break; #ifdef NEWPING case KICK_MSG_PING_HIGH: - CONS_Printf(M_GetText("left the game (Broke ping limit)\n")); + HU_AddChatText(va("\x82*%s left the game (Broke ping limit)", player_names[pnum]), false); kickreason = KR_PINGLIMIT; break; #endif case KICK_MSG_CON_FAIL: - CONS_Printf(M_GetText("left the game (Synch failure)\n")); + HU_AddChatText(va("\x82*%s left the game (Synch Failure)", player_names[pnum]), false); kickreason = KR_SYNCH; if (M_CheckParm("-consisdump")) // Helps debugging some problems @@ -2826,26 +2895,26 @@ static void Got_KickCmd(UINT8 **p, INT32 playernum) } break; case KICK_MSG_TIMEOUT: - CONS_Printf(M_GetText("left the game (Connection timeout)\n")); + HU_AddChatText(va("\x82*%s left the game (Connection timeout)", player_names[pnum]), false); kickreason = KR_TIMEOUT; break; case KICK_MSG_PLAYER_QUIT: if (netgame) // not splitscreen/bots - CONS_Printf(M_GetText("left the game\n")); + HU_AddChatText(va("\x82*%s left the game", player_names[pnum]), false); kickreason = KR_LEAVE; break; case KICK_MSG_BANNED: - CONS_Printf(M_GetText("has been banned (Don't come back)\n")); + HU_AddChatText(va("\x82*%s has been banned (Don't come back)", player_names[pnum]), false); kickreason = KR_BAN; break; case KICK_MSG_CUSTOM_KICK: READSTRINGN(*p, reason, MAX_REASONLENGTH+1); - CONS_Printf(M_GetText("has been kicked (%s)\n"), reason); + HU_AddChatText(va("\x82*%s has been kicked (%s)", player_names[pnum], reason), false); kickreason = KR_KICK; break; case KICK_MSG_CUSTOM_BAN: READSTRINGN(*p, reason, MAX_REASONLENGTH+1); - CONS_Printf(M_GetText("has been banned (%s)\n"), reason); + HU_AddChatText(va("\x82*%s has been banned (%s)", player_names[pnum], reason), false); kickreason = KR_BAN; break; } @@ -2906,6 +2975,7 @@ void D_ClientServerInit(void) COM_AddCommand("getplayernum", Command_GetPlayerNum); COM_AddCommand("kick", Command_Kick); COM_AddCommand("ban", Command_Ban); + COM_AddCommand("banip", Command_BanIP); COM_AddCommand("clearbans", Command_ClearBans); COM_AddCommand("showbanlist", Command_ShowBan); COM_AddCommand("reloadbans", Command_ReloadBan); @@ -3096,7 +3166,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; @@ -3119,9 +3189,6 @@ static void Got_AddPlayer(UINT8 **p, INT32 playernum) if (newplayernum+1 > doomcom->numslots) doomcom->numslots = (INT16)(newplayernum+1); - if (netgame) - CONS_Printf(M_GetText("Player %d has joined the game (node %d)\n"), newplayernum+1, node); - // the server is creating my player if (node == mynode) { @@ -3143,11 +3210,17 @@ static void Got_AddPlayer(UINT8 **p, INT32 playernum) D_SendPlayerConfig(); addedtogame = true; } - else if (server && netgame && cv_showjoinaddress.value) + + if (netgame) { - const char *address; - if (I_GetNodeAddress && (address = I_GetNodeAddress(node)) != NULL) - CONS_Printf(M_GetText("Player Address is %s\n"), address); + if (server && cv_showjoinaddress.value) + { + const char *address; + if (I_GetNodeAddress && (address = I_GetNodeAddress(node)) != NULL) + HU_AddChatText(va("\x82*Player %d has joined the game (node %d) (%s)", newplayernum+1, node, address), false); // merge join notification + IP to avoid clogging console/chat. + } + else + HU_AddChatText(va("\x82*Player %d has joined the game (node %d)", newplayernum+1, node), false); // if you don't wanna see the join address. } if (server && multiplayer && motd[0] != '\0') @@ -3161,7 +3234,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? @@ -3274,7 +3347,7 @@ void CL_AddSplitscreenPlayer(void) void CL_RemoveSplitscreenPlayer(void) { - XBOXSTATIC UINT8 buf[2]; + UINT8 buf[2]; if (cl_mode != CL_CONNECTED) return; @@ -3639,10 +3712,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]; } @@ -3717,11 +3792,11 @@ 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; + UINT8 finalmd5[16];/* Well, it's the cool thing to do? */ txtpak = NULL; @@ -3795,7 +3870,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); @@ -3838,7 +3913,7 @@ FILESTAMP } else { - XBOXSTATIC UINT8 buf[3]; + UINT8 buf[3]; buf[0] = (UINT8)netconsole; buf[1] = KICK_MSG_CON_FAIL; @@ -3919,6 +3994,32 @@ FILESTAMP textcmd[0] += (UINT8)netbuffer->u.textcmd[0]; } break; + case PT_LOGIN: + if (client) + break; + +#ifndef NOMD5 + if (doomcom->datalength < 16)/* ignore partial sends */ + break; + + if (!adminpasswordset) + { + CONS_Printf(M_GetText("Password from %s failed (no password set).\n"), player_names[netconsole]); + break; + } + + // Do the final pass to compare with the sent md5 + D_MD5PasswordPass(adminpassmd5, 16, va("PNUM%02d", netconsole), &finalmd5); + + if (!memcmp(netbuffer->u.md5sum, finalmd5, 16)) + { + CONS_Printf(M_GetText("%s passed authentication.\n"), player_names[netconsole]); + COM_BufInsertText(va("promote %d\n", netconsole)); // do this immediately + } + else + CONS_Printf(M_GetText("Password from %s failed.\n"), player_names[netconsole]); +#endif + break; case PT_NODETIMEOUT: case PT_CLIENTQUIT: if (client) @@ -3929,7 +4030,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; @@ -3957,7 +4058,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); @@ -3982,7 +4083,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); @@ -4049,7 +4150,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); @@ -4069,7 +4170,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); @@ -4099,7 +4200,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); @@ -4122,9 +4223,8 @@ FILESTAMP * */ static void GetPackets(void) -{FILESTAMP - XBOXSTATIC SINT8 node; // The packet sender -FILESTAMP +{ + SINT8 node; // The packet sender player_joining = false; @@ -4209,14 +4309,9 @@ static INT16 Consistancy(void) ret += P_GetRandSeed(); #ifdef MOBJCONSISTANCY - if (!thinkercap.next) + for (th = thlist[THINK_MOBJ].next; th != &thlist[THINK_MOBJ]; th = th->next) { - DEBFILE(va("Consistancy = %u\n", ret)); - return ret; - } - for (th = thinkercap.next; th != &thinkercap; th = th->next) - { - if (th->function.acp1 != (actionf_p1)P_MobjThinker) + if (th->function.acp1 == (actionf_p1)P_RemoveThinkerDelayed) continue; mo = (mobj_t *)th; @@ -4558,7 +4653,7 @@ void TryRunTics(tic_t realtics) if (realtics >= 1) { - COM_BufExecute(); + COM_BufTicker(); if (mapchangepending) D_MapChange(-1, 0, ultimatemode, false, 2, false, fromlevelselect); // finish the map change } @@ -4639,7 +4734,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; @@ -4711,9 +4806,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 @@ -4802,3 +4897,29 @@ tic_t GetLag(INT32 node) { return gametic - nettics[node]; } + +void D_MD5PasswordPass(const UINT8 *buffer, size_t len, const char *salt, void *dest) +{ +#ifdef NOMD5 + (void)buffer; + (void)len; + (void)salt; + memset(dest, 0, 16); +#else + char tmpbuf[256]; + const size_t sl = strlen(salt); + + if (len > 256-sl) + len = 256-sl; + + memcpy(tmpbuf, buffer, len); + memmove(&tmpbuf[len], salt, sl); + //strcpy(&tmpbuf[len], salt); + len += strlen(salt); + if (len < 256) + memset(&tmpbuf[len],0,256-len); + + // Yes, we intentionally md5 the ENTIRE buffer regardless of size... + md5_buffer(tmpbuf, 256, dest); +#endif +} diff --git a/src/d_clisrv.h b/src/d_clisrv.h index a906758fd..a2f140f33 100644 --- a/src/d_clisrv.h +++ b/src/d_clisrv.h @@ -70,6 +70,9 @@ typedef enum PT_NODETIMEOUT, // Packet sent to self if the connection times out. PT_RESYNCHING, // Packet sent to resync players. // Blocks game advance until synched. + + PT_LOGIN, // Login attempt from the client. + #ifdef NEWPING PT_PING, // Packet sent to tell clients the other client's latency to server. #endif @@ -136,6 +139,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 @@ -160,10 +164,14 @@ typedef struct angle_t aiming; INT32 currentweapon; INT32 ringweapons; + UINT16 ammoremoval; + tic_t ammoremovaltimer; + INT32 ammoremovalweapon; 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 +180,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 +196,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 +212,7 @@ typedef struct INT32 deadtimer; tic_t exiting; UINT8 homing; + tic_t dashmode; tic_t skidtime; fixed_t cmomx; fixed_t cmomy; @@ -217,7 +231,6 @@ typedef struct INT32 maxlink; fixed_t dashspeed; - INT32 dashtime; angle_t angle_pos; angle_t old_angle_pos; tic_t bumpertime; @@ -240,6 +253,7 @@ typedef struct //player->mo stuff UINT8 hasmo; // Boolean + INT32 health; angle_t angle; fixed_t x; fixed_t y; @@ -279,6 +293,7 @@ typedef struct // 0xFF == not in game; else player skin num UINT8 playerskins[MAXPLAYERS]; UINT8 playercolor[MAXPLAYERS]; + UINT32 playeravailabilities[MAXPLAYERS]; UINT8 gametype; UINT8 modifiedgame; @@ -309,6 +324,7 @@ typedef struct } ATTRPACK clientconfig_pak; #define MAXSERVERNAME 32 +#define MAXFILENEEDED 915 // This packet is too large typedef struct { @@ -330,7 +346,7 @@ typedef struct unsigned char mapmd5[16]; UINT8 actnum; UINT8 iszone; - UINT8 fileneeded[915]; // is filled with writexxx (byteptr.h) + UINT8 fileneeded[MAXFILENEEDED]; // is filled with writexxx (byteptr.h) } ATTRPACK serverinfo_pak; typedef struct @@ -397,6 +413,7 @@ typedef struct UINT8 textcmd[MAXTEXTCMD+1]; // 66049 bytes (wut??? 64k??? More like 257 bytes...) filetx_pak filetxpak; // 139 bytes clientconfig_pak clientcfg; // 136 bytes + UINT8 md5sum[16]; serverinfo_pak serverinfo; // 1024 bytes serverrefuse_pak serverrefuse; // 65025 bytes (somehow I feel like those values are garbage...) askinfo_pak askinfo; // 61 bytes @@ -429,9 +446,9 @@ extern doomdata_t *netbuffer; extern consvar_t cv_playbackspeed; -#define BASEPACKETSIZE ((size_t)&(((doomdata_t *)0)->u)) -#define FILETXHEADER ((size_t)((filetx_pak *)0)->data) -#define BASESERVERTICSSIZE ((size_t)&(((doomdata_t *)0)->u.serverpak.cmds[0])) +#define BASEPACKETSIZE offsetof(doomdata_t, u) +#define FILETXHEADER offsetof(filetx_pak, data) +#define BASESERVERTICSSIZE offsetof(doomdata_t, u.serverpak.cmds[0]) #define KICK_MSG_GO_AWAY 1 #define KICK_MSG_CON_FAIL 2 @@ -525,5 +542,10 @@ void D_ResetTiccmds(void); tic_t GetLag(INT32 node); UINT8 GetFreeXCmdSize(void); +void D_MD5PasswordPass(const UINT8 *buffer, size_t len, const char *salt, void *dest); + extern UINT8 hu_resynching; + +extern UINT8 adminpassmd5[16]; +extern boolean adminpasswordset; #endif diff --git a/src/d_main.c b/src/d_main.c index 23835136a..eaeae4b10 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" @@ -74,6 +70,8 @@ int snprintf(char *str, size_t n, const char *fmt, ...); #include "m_cond.h" // condition initialization #include "fastcmp.h" #include "keys.h" +#include "filesrch.h" // refreshdirmenu, mainwadstally +#include "g_input.h" // tutorial mode control scheming #ifdef CMAKECONFIG #include "config.h" @@ -81,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 @@ -107,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 @@ -121,30 +113,20 @@ INT32 postimgparam; postimg_t postimgtype2 = postimg_none; INT32 postimgparam2; -// These variables are only true if +// These variables are in effect // 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"; @@ -175,36 +157,11 @@ void D_PostEvent_end(void) {}; #endif // modifier keys +// Now handled in I_OsPolling UINT8 shiftdown = 0; // 0x1 left, 0x2 right UINT8 ctrldown = 0; // 0x1 left, 0x2 right UINT8 altdown = 0; // 0x1 left, 0x2 right -// -// D_ModifierKeyResponder -// Sets global shift/ctrl/alt variables, never actually eats events -// -static inline void D_ModifierKeyResponder(event_t *ev) -{ - if (ev->type == ev_keydown || ev->type == ev_console) switch (ev->data1) - { - case KEY_LSHIFT: shiftdown |= 0x1; return; - case KEY_RSHIFT: shiftdown |= 0x2; return; - case KEY_LCTRL: ctrldown |= 0x1; return; - case KEY_RCTRL: ctrldown |= 0x2; return; - case KEY_LALT: altdown |= 0x1; return; - case KEY_RALT: altdown |= 0x2; return; - default: return; - } - else if (ev->type == ev_keyup) switch (ev->data1) - { - case KEY_LSHIFT: shiftdown &= ~0x1; return; - case KEY_RSHIFT: shiftdown &= ~0x2; return; - case KEY_LCTRL: ctrldown &= ~0x1; return; - case KEY_RCTRL: ctrldown &= ~0x2; return; - case KEY_LALT: altdown &= ~0x1; return; - case KEY_RALT: altdown &= ~0x2; return; - default: return; - } -} +boolean capslock = 0; // gee i wonder what this does. // // D_ProcessEvents @@ -218,9 +175,6 @@ void D_ProcessEvents(void) { ev = &events[eventtail]; - // Set global shift/ctrl/alt down variables - D_ModifierKeyResponder(ev); // never eats events - // Screenshots over everything so that they can be taken anywhere. if (M_ScreenshotResponder(ev)) continue; // ate the event @@ -251,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) { @@ -284,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 @@ -296,31 +253,46 @@ 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; HU_Erase(); - if (automapactive) - AM_Drawer(); + AM_Drawer(); break; case GS_INTERMISSION: @@ -338,6 +310,12 @@ static void D_Display(void) wipe = true; break; + case GS_ENDING: + F_EndingDrawer(); + HU_Erase(); + HU_Drawer(); + break; + case GS_CUTSCENE: F_CutsceneDrawer(); HU_Erase(); @@ -350,6 +328,7 @@ static void D_Display(void) case GS_EVALUATION: F_GameEvaluationDrawer(); + HU_Erase(); HU_Drawer(); break; @@ -363,10 +342,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: @@ -374,83 +349,96 @@ static void D_Display(void) break; } - // clean up border stuff - // see if the border needs to be initially drawn - if (gamestate == GS_LEVEL) + // STUPID race condition... + if (wipegamestate == GS_INTRO && gamestate == GS_TITLESCREEN) + wipegamestate = FORCEWIPEOFF; + else { - // draw the view directly - if (!automapactive && !dedicated && cv_renderview.value) + 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) @@ -459,6 +447,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... @@ -474,18 +467,25 @@ 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); } + + wipetypepost = -1; } + else + wipetypepost = -1; NetUpdate(); // send out any new accumulation @@ -586,6 +586,8 @@ void D_SRB2Loop(void) realtics = entertic - oldentertics; oldentertics = entertic; + refreshdirmenu = 0; // not sure where to put this, here as good as any? + #ifdef DEBUGFILE if (!realtics) if (debugload) @@ -676,6 +678,9 @@ void D_AdvanceDemo(void) void D_StartTitle(void) { INT32 i; + + S_StopMusic(); + if (netgame) { if (gametype == GT_COOP) @@ -711,6 +716,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 @@ -719,18 +725,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(); - CON_ToggleOff(); + + 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; } // @@ -770,11 +798,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 @@ -785,17 +813,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 } } @@ -805,31 +827,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 @@ -840,52 +855,35 @@ 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) { -#if defined (DC) && 0 - const char *musicfile = "music_dc.dta"; -#else - const char *musicfile = "music.dta"; +#define MUSICTEST(str) \ + {\ + const char *musicpath = va(pandf,srb2waddir,str);\ + int ms = W_VerifyNMUSlumps(musicpath); \ + if (ms == 1) \ + D_AddFile(musicpath); \ + else if (ms == 0) \ + I_Error("File "str" has been modified with non-music/sound lumps"); \ + } + + MUSICTEST("music.dta") +#ifdef DEVELOP // remove when music_new.dta is merged into music.dta + MUSICTEST("music_new.dta") #endif - const char *musicpath = va(pandf,srb2waddir,musicfile); - int ms = W_VerifyNMUSlumps(musicpath); // Don't forget the music! - if (ms == 1) - D_AddFile(musicpath); - else if (ms == 0) - I_Error("File %s has been modified with non-music lumps",musicfile); } #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. @@ -914,6 +912,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 @@ -921,8 +944,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; @@ -942,7 +963,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 @@ -964,11 +985,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; @@ -979,20 +1000,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) @@ -1006,13 +1015,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); @@ -1049,10 +1053,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 @@ -1114,6 +1114,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 @@ -1123,12 +1130,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 @@ -1136,25 +1170,11 @@ void D_SRB2Main(void) #endif D_CleanFile(); -#ifndef DEVELOP // md5s last updated 12/14/14 - - // Check MD5s of autoloaded files - W_VerifyFileMD5(0, ASSET_HASH_SRB2_SRB); // srb2.srb/srb2.wad - W_VerifyFileMD5(1, ASSET_HASH_ZONES_DTA); // zones.dta - W_VerifyFileMD5(2, ASSET_HASH_PLAYER_DTA); // player.dta - W_VerifyFileMD5(3, ASSET_HASH_RINGS_DTA); // rings.dta -#ifdef USE_PATCH_DTA - W_VerifyFileMD5(4, 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. #endif //ifndef DEVELOP - mainwads = 4; // there are 4 wads not to unload -#ifdef USE_PATCH_DTA - ++mainwads; // patch.dta adds one more -#endif + mainwadstally = packetsizetally; + + mainwadstally = packetsizetally; cht_Init(); @@ -1173,12 +1193,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 @@ -1326,6 +1341,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; @@ -1343,13 +1371,9 @@ void D_SRB2Main(void) INT16 newgametype = -1; const char *sgametype = M_GetNextParm(); - for (j = 0; gametype_cons_t[j].strvalue; j++) - if (!strcasecmp(gametype_cons_t[j].strvalue, sgametype)) - { - newgametype = (INT16)gametype_cons_t[j].value; - break; - } - if (!gametype_cons_t[j].strvalue) // reached end of the list with no match + newgametype = G_GetGametypeByName(sgametype); + + if (newgametype == -1) // reached end of the list with no match { j = atoi(sgametype); // assume they gave us a gametype number, which is okay too if (j >= 0 && j < NUMGAMETYPES) @@ -1376,21 +1400,23 @@ 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")) { - CON_ToggleOff(); - CON_ClearHUD(); + F_InitMenuPresValues(); F_StartTitleScreen(); } else F_StartIntro(); // Tails 03-03-2002 + CON_ToggleOff(); + if (dedicated && server) { - pagename = "TITLESKY"; levelstarttic = gametic; G_SetGamestate(GS_LEVEL); if (!P_SetupLevel(false)) @@ -1405,26 +1431,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 82c60e4ae..9f68c187c 100644 --- a/src/d_net.c +++ b/src/d_net.c @@ -27,6 +27,7 @@ #include "d_clisrv.h" #include "z_zone.h" #include "i_tcp.h" +#include "d_main.h" // srb2home // // NETWORKING @@ -1359,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]; @@ -1374,14 +1370,13 @@ boolean D_CheckNetGame(void) { k++; sprintf(filename, "debug%d.txt", k); - debugfile = fopen(filename, "w"); + debugfile = fopen(va("%s" PATHSEP "%s", srb2home, filename), "w"); } if (debugfile) - CONS_Printf(M_GetText("debug output to: %s\n"), filename); + CONS_Printf(M_GetText("debug output to: %s\n"), va("%s" PATHSEP "%s", srb2home, filename)); else - CONS_Alert(CONS_WARNING, M_GetText("cannot debug output to file %s!\n"), filename); + 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_net.h b/src/d_net.h index 55ea308b3..3d1058702 100644 --- a/src/d_net.h +++ b/src/d_net.h @@ -19,9 +19,10 @@ #define __D_NET__ // Max computers in a game -#define MAXNETNODES 32 +#define MAXNETNODES (MAXPLAYERS+4) #define BROADCASTADDR MAXNETNODES #define MAXSPLITSCREENPLAYERS 2 // Max number of players on a single computer +//#define NETSPLITSCREEN // Kart's splitscreen netgame feature #define STATLENGTH (TICRATE*2) diff --git a/src/d_netcmd.c b/src/d_netcmd.c index 8abfb8709..590543f00 100644 --- a/src/d_netcmd.c +++ b/src/d_netcmd.c @@ -34,17 +34,19 @@ #include "p_spec.h" #include "m_cheat.h" #include "d_clisrv.h" +#include "d_net.h" #include "v_video.h" #include "d_main.h" #include "m_random.h" #include "f_finale.h" +#include "filesrch.h" #include "mserv.h" -#include "md5.h" #include "z_zone.h" #include "lua_script.h" #include "lua_hook.h" #include "m_cond.h" #include "m_anigif.h" +#include "md5.h" #ifdef NETGAME_DEVMODE #define CV_RESTRICT CV_NETVAR @@ -61,9 +63,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); @@ -85,6 +84,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); @@ -112,9 +114,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); @@ -142,7 +141,6 @@ static void Command_Clearscores_f(void); // Remote Administration static void Command_Changepassword_f(void); static void Command_Login_f(void); -static void Got_Login(UINT8 **cp, INT32 playernum); static void Got_Verification(UINT8 **cp, INT32 playernum); static void Got_Removal(UINT8 **cp, INT32 playernum); static void Command_Verify_f(void); @@ -186,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}; @@ -217,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}}; @@ -225,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}; @@ -235,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; @@ -242,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}; @@ -305,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}; @@ -313,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}; @@ -333,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}; @@ -349,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}; @@ -388,7 +390,7 @@ const char *netxcmdnames[MAXNETXCMD - 1] = "RANDOMSEED", "RUNSOC", "REQADDFILE", - "DELFILE", + "DELFILE", // replace next time we add an XD "SETMOTD", "SUICIDE", #ifdef HAVE_BLUA @@ -408,15 +410,22 @@ const char *netxcmdnames[MAXNETXCMD - 1] = */ void D_RegisterServerCommands(void) { + INT32 i; + + for (i = 0; i < NUMGAMETYPES; i++) + { + gametype_cons_t[i].value = i; + gametype_cons_t[i].strvalue = Gametype_Names[i]; + } + gametype_cons_t[NUMGAMETYPES].value = 0; + gametype_cons_t[NUMGAMETYPES].strvalue = NULL; + RegisterNetXCmd(XD_NAMEANDCOLOR, Got_NameAndColor); RegisterNetXCmd(XD_WEAPONPREF, Got_WeaponPref); RegisterNetXCmd(XD_MAP, Got_Mapcmd); 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); @@ -426,7 +435,6 @@ void D_RegisterServerCommands(void) // Remote Administration COM_AddCommand("password", Command_Changepassword_f); - RegisterNetXCmd(XD_LOGIN, Got_Login); COM_AddCommand("login", Command_Login_f); // useful in dedicated to kick off remote admin COM_AddCommand("promote", Command_Verify_f); RegisterNetXCmd(XD_VERIFIED, Got_Verification); @@ -452,9 +460,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); @@ -487,7 +492,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); @@ -512,6 +516,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); @@ -535,7 +542,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); @@ -592,6 +598,11 @@ void D_RegisterClientCommands(void) Color_cons_t[MAXSKINCOLORS].value = 0; Color_cons_t[MAXSKINCOLORS].strvalue = NULL; + // Set default player names + // Monster Iestyn (12/08/19): not sure where else I could have actually put this, but oh well + for (i = 0; i < MAXPLAYERS; i++) + sprintf(player_names[i], "Player %d", i); + if (dedicated) return; @@ -617,6 +628,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); @@ -645,6 +657,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); @@ -658,7 +677,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); @@ -670,15 +691,46 @@ 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); + CV_RegisterVar(&cv_chatheight); + CV_RegisterVar(&cv_chatwidth); + CV_RegisterVar(&cv_chattime); + CV_RegisterVar(&cv_chatspamprotection); + CV_RegisterVar(&cv_chatbacktint); + CV_RegisterVar(&cv_consolechat); + CV_RegisterVar(&cv_chatnotifications); CV_RegisterVar(&cv_crosshair); CV_RegisterVar(&cv_crosshair2); CV_RegisterVar(&cv_alwaysfreelook); CV_RegisterVar(&cv_alwaysfreelook2); CV_RegisterVar(&cv_chasefreelook); CV_RegisterVar(&cv_chasefreelook2); + CV_RegisterVar(&cv_tutorialprompt); // g_input.c CV_RegisterVar(&cv_sideaxis); @@ -689,11 +741,23 @@ void D_RegisterClientCommands(void) CV_RegisterVar(&cv_moveaxis2); CV_RegisterVar(&cv_lookaxis); CV_RegisterVar(&cv_lookaxis2); + CV_RegisterVar(&cv_jumpaxis); + CV_RegisterVar(&cv_jumpaxis2); + CV_RegisterVar(&cv_spinaxis); + CV_RegisterVar(&cv_spinaxis2); CV_RegisterVar(&cv_fireaxis); CV_RegisterVar(&cv_fireaxis2); CV_RegisterVar(&cv_firenaxis); CV_RegisterVar(&cv_firenaxis2); + // filesrch.c + CV_RegisterVar(&cv_addons_option); + CV_RegisterVar(&cv_addons_folder); + CV_RegisterVar(&cv_addons_md5); + CV_RegisterVar(&cv_addons_showall); + CV_RegisterVar(&cv_addons_search_type); + CV_RegisterVar(&cv_addons_search_case); + // WARNING: the order is important when initialising mouse2 // we need the mouse2port CV_RegisterVar(&cv_mouse2port); @@ -728,8 +792,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); @@ -752,6 +823,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); @@ -777,6 +849,7 @@ void D_RegisterClientCommands(void) COM_AddCommand("rteleport", Command_RTeleport_f); COM_AddCommand("skynum", Command_Skynum_f); COM_AddCommand("weather", Command_Weather_f); + COM_AddCommand("toggletwod", Command_Toggletwod_f); #ifdef _DEBUG COM_AddCommand("causecfail", Command_CauseCfail_f); #endif @@ -984,8 +1057,8 @@ static void SetPlayerName(INT32 playernum, char *newname) if (strcasecmp(newname, player_names[playernum]) != 0) { if (netgame) - CONS_Printf(M_GetText("%s renamed to %s\n"), - player_names[playernum], newname); + HU_AddChatText(va("\x82*%s renamed to %s", player_names[playernum], newname), false); + strcpy(player_names[playernum], newname); } } @@ -994,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; @@ -1010,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. @@ -1074,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; @@ -1108,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) { @@ -1126,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; @@ -1141,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; @@ -1173,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; @@ -1181,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); @@ -1223,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) { @@ -1251,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; @@ -1265,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; @@ -1306,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); @@ -1322,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()) @@ -1336,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; @@ -1365,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); } @@ -1391,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) @@ -1532,23 +1634,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; @@ -1618,7 +1717,7 @@ static void Command_Map_f(void) { const char *mapname; size_t i; - INT32 j, newmapnum; + INT32 newmapnum; boolean newresetplayers; INT32 newgametype = gametype; @@ -1686,52 +1785,16 @@ static void Command_Map_f(void) return; } - for (j = 0; gametype_cons_t[j].strvalue; j++) - if (!strcasecmp(gametype_cons_t[j].strvalue, COM_Argv(i+1))) - { - // Don't do any variable setting here. Wait until you get your - // map packet first to avoid sending the same info twice! - newgametype = gametype_cons_t[j].value; + newgametype = G_GetGametypeByName(COM_Argv(i+1)); - break; - } - - if (!gametype_cons_t[j].strvalue) // reached end of the list with no match + if (newgametype == -1) // reached end of the list with no match { - // assume they gave us a gametype number, which is okay too - for (j = 0; gametype_cons_t[j].strvalue != NULL; j++) - { - if (atoi(COM_Argv(i+1)) == gametype_cons_t[j].value) - { - newgametype = gametype_cons_t[j].value; - break; - } - } + INT32 j = atoi(COM_Argv(i+1)); // assume they gave us a gametype number, which is okay too + if (j >= 0 && j < NUMGAMETYPES) + newgametype = (INT16)j; } } - // 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. - // 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] - || !(mapheaderinfo[newmapnum-1]->typeoflevel & G_TOLFlag(newgametype))) - { - char gametypestring[32] = "Single Player"; - - if (multiplayer) - for (i = 0; gametype_cons_t[i].strvalue != NULL; i++) - if (gametype_cons_t[i].value == newgametype) - { - strcpy(gametypestring, gametype_cons_t[i].strvalue); - break; - } - - CONS_Alert(CONS_WARNING, M_GetText("%s doesn't support %s mode!\n(Use -force to override)\n"), mapname, gametypestring); - return; - } - // 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 @@ -1742,8 +1805,40 @@ static void Command_Map_f(void) return; } - fromlevelselect = false; - D_MapChange(newmapnum, newgametype, false, newresetplayers, 0, false, false); + // don't use a gametype the map doesn't support + if (cv_debug || COM_CheckParm("-force") || cv_skipmapcheck.value) + 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] + || !(mapheaderinfo[newmapnum-1]->typeoflevel & G_TOLFlag(newgametype))) + { + char gametypestring[32] = "Single Player"; + + if (multiplayer) + { + if (newgametype >= 0 && newgametype < NUMGAMETYPES + && Gametype_Names[newgametype]) + strcpy(gametypestring, Gametype_Names[newgametype]); + } + + 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))); + + 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); + } + tutorialmode = false; // warping takes us out of tutorial mode + + D_MapChange(newmapnum, newgametype, false, newresetplayers, 0, false, fromlevelselect); } /** Receives a map command and changes the map. @@ -1768,7 +1863,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; @@ -1810,16 +1905,17 @@ static void Got_Mapcmd(UINT8 **cp, INT32 playernum) CONS_Printf(M_GetText("Speeding off to level...\n")); } - CON_ToggleOff(); - CON_ClearHUD(); - 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 @@ -1827,22 +1923,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, @@ -1852,7 +1938,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) @@ -1888,7 +1974,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; @@ -1931,7 +2017,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); @@ -1968,7 +2054,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; @@ -1978,7 +2064,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. @@ -2037,7 +2123,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; @@ -2390,7 +2476,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; @@ -2405,7 +2491,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; @@ -2444,7 +2530,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; @@ -2497,7 +2583,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; @@ -2509,7 +2595,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); @@ -2528,12 +2614,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; @@ -2624,8 +2710,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; } @@ -2639,35 +2724,7 @@ static void Got_Teamchange(UINT8 **cp, INT32 playernum) // Attempts to make password system a little sane without // rewriting the entire goddamn XD_file system // -#include "md5.h" -static void D_MD5PasswordPass(const UINT8 *buffer, size_t len, const char *salt, void *dest) -{ -#ifdef NOMD5 - (void)buffer; - (void)len; - (void)salt; - memset(dest, 0, 16); -#else - XBOXSTATIC char tmpbuf[256]; - const size_t sl = strlen(salt); - - if (len > 256-sl) - len = 256-sl; - memcpy(tmpbuf, buffer, len); - memmove(&tmpbuf[len], salt, sl); - //strcpy(&tmpbuf[len], salt); - len += strlen(salt); - if (len < 256) - memset(&tmpbuf[len],0,256-len); - - // Yes, we intentionally md5 the ENTIRE buffer regardless of size... - md5_buffer(tmpbuf, 256, dest); -#endif -} - #define BASESALT "basepasswordstorage" -static UINT8 adminpassmd5[16]; -static boolean adminpasswordset = false; void D_SetPassword(const char *pw) { @@ -2705,7 +2762,6 @@ 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]; const char *pw; if (!netgame) @@ -2725,47 +2781,15 @@ static void Command_Login_f(void) pw = COM_Argv(1); // Do the base pass to get what the server has (or should?) - D_MD5PasswordPass((const UINT8 *)pw, strlen(pw), BASESALT, &finalmd5); + D_MD5PasswordPass((const UINT8 *)pw, strlen(pw), BASESALT, &netbuffer->u.md5sum); // Do the final pass to get the comparison the server will come up with - D_MD5PasswordPass(finalmd5, 16, va("PNUM%02d", consoleplayer), &finalmd5); + D_MD5PasswordPass(netbuffer->u.md5sum, 16, va("PNUM%02d", consoleplayer), &netbuffer->u.md5sum); CONS_Printf(M_GetText("Sending login... (Notice only given if password is correct.)\n")); - SendNetXCmd(XD_LOGIN, finalmd5, 16); -#endif -} - -static void Got_Login(UINT8 **cp, INT32 playernum) -{ -#ifdef NOMD5 - // If we have no MD5 support then completely disable XD_LOGIN responses for security. - (void)cp; - (void)playernum; -#else - UINT8 sentmd5[16], finalmd5[16]; - - READMEM(*cp, sentmd5, 16); - - if (client) - return; - - if (!adminpasswordset) - { - CONS_Printf(M_GetText("Password from %s failed (no password set).\n"), player_names[playernum]); - return; - } - - // Do the final pass to compare with the sent md5 - D_MD5PasswordPass(adminpassmd5, 16, va("PNUM%02d", playernum), &finalmd5); - - if (!memcmp(sentmd5, finalmd5, 16)) - { - CONS_Printf(M_GetText("%s passed authentication.\n"), player_names[playernum]); - COM_BufInsertText(va("promote %d\n", playernum)); // do this immediately - } - else - CONS_Printf(M_GetText("Password from %s failed.\n"), player_names[playernum]); + netbuffer->packettype = PT_LOGIN; + HSendPacket(servernode, true, 0, 16); #endif } @@ -2814,7 +2838,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; @@ -2857,7 +2881,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; @@ -2876,7 +2900,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; @@ -2913,7 +2937,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; @@ -2993,7 +3017,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; @@ -3014,7 +3038,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) @@ -3056,7 +3080,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; @@ -3099,7 +3123,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 @@ -3142,26 +3166,14 @@ 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) + || ((packetsizetally + nameonlylength(fn) + 22) > MAXFILENEEDED*sizeof(UINT8))) { - size_t packetsize = 0; - serverinfo_pak *dummycheck = NULL; - - // Shut the compiler up. - (void)dummycheck; - - // See W_LoadWadFile in w_wad.c - for (i = 0; i < numwadfiles; i++) - packetsize += nameonlylength(wadfiles[i]->filename) + 22; - - packetsize += nameonlylength(fn) + 22; - - if ((numwadfiles >= MAX_WADFILES) - || (packetsize > sizeof(dummycheck->fileneeded))) - { - CONS_Alert(CONS_ERROR, M_GetText("Too many files loaded to add %s\n"), fn); - return; - } + CONS_Alert(CONS_ERROR, M_GetText("Too many files loaded to add %s\n"), fn); + return; } WRITESTRINGN(buf_p,p,240); @@ -3203,42 +3215,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]; @@ -3247,7 +3223,6 @@ static void Got_RequestAddfilecmd(UINT8 **cp, INT32 playernum) boolean kick = false; boolean toomany = false; INT32 i,j; - size_t packetsize = 0; serverinfo_pak *dummycheck = NULL; // Shut the compiler up. @@ -3267,7 +3242,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]); @@ -3278,13 +3253,8 @@ static void Got_RequestAddfilecmd(UINT8 **cp, INT32 playernum) } // See W_LoadWadFile in w_wad.c - for (i = 0; i < numwadfiles; i++) - packetsize += nameonlylength(wadfiles[i]->filename) + 22; - - packetsize += nameonlylength(filename) + 22; - if ((numwadfiles >= MAX_WADFILES) - || (packetsize > sizeof(dummycheck->fileneeded))) + || ((packetsizetally + nameonlylength(filename) + 22) > MAXFILENEEDED*sizeof(UINT8))) toomany = true; else ncs = findfile(filename,md5sum,true); @@ -3314,33 +3284,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]; @@ -3355,7 +3298,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; @@ -3407,6 +3350,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); } @@ -3440,7 +3385,7 @@ static void Command_Version_f(void) #elif defined(__linux__) CONS_Printf("Linux "); #elif defined(MACOSX) - CONS_Printf("macOS" ); + CONS_Printf("macOS "); #elif defined(UNIXCOMMON) CONS_Printf("Unix (Common) "); #else @@ -3465,6 +3410,11 @@ static void Command_Version_f(void) CONS_Printf("\x85" "DEBUG " "\x80"); #endif + // DEVELOP build +#ifdef DEVELOP + CONS_Printf("\x87" "DEVELOP " "\x80"); +#endif + CONS_Printf("\n"); } @@ -3479,7 +3429,6 @@ static void Command_ModDetails_f(void) // static void Command_ShowGametype_f(void) { - INT32 j; const char *gametypestr = NULL; if (!(netgame || multiplayer)) // print "Single player" instead of "Co-op" @@ -3487,15 +3436,11 @@ static void Command_ShowGametype_f(void) CONS_Printf(M_GetText("Current gametype is %s\n"), M_GetText("Single player")); return; } - // find name string for current gametype - for (j = 0; gametype_cons_t[j].strvalue; j++) - { - if (gametype_cons_t[j].value == gametype) - { - gametypestr = gametype_cons_t[j].strvalue; - break; - } - } + + // get name string for current gametype + if (gametype >= 0 && gametype < NUMGAMETYPES) + gametypestr = Gametype_Names[gametype]; + if (gametypestr) CONS_Printf(M_GetText("Current gametype is %s\n"), gametypestr); else // string for current gametype was not found above (should never happen) @@ -3509,6 +3454,9 @@ static void Command_Playintro_f(void) if (netgame) return; + if (dirmenu) + closefilemenu(true); + F_StartIntro(); } @@ -3587,6 +3535,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. @@ -3634,15 +3678,13 @@ void D_GameTypeChanged(INT32 lastgametype) { if (netgame) { - INT32 j; const char *oldgt = NULL, *newgt = NULL; - for (j = 0; gametype_cons_t[j].strvalue; j++) - { - if (gametype_cons_t[j].value == lastgametype) - oldgt = gametype_cons_t[j].strvalue; - if (gametype_cons_t[j].value == gametype) - newgt = gametype_cons_t[j].strvalue; - } + + if (lastgametype >= 0 && lastgametype < NUMGAMETYPES) + oldgt = Gametype_Names[lastgametype]; + if (gametype >= 0 && lastgametype < NUMGAMETYPES) + newgt = Gametype_Names[gametype]; + if (oldgt && newgt) CONS_Printf(M_GetText("Gametype was changed from %s to %s\n"), oldgt, newgt); } @@ -3877,7 +3919,7 @@ retryscramble: { if (red == maxcomposition) newteam = 2; - else if (blue == maxcomposition) + else //if (blue == maxcomposition) newteam = 1; repick = false; @@ -3918,14 +3960,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; @@ -4005,7 +4044,7 @@ static void Command_ExitLevel_f(void) CONS_Printf(M_GetText("This only works in a netgame.\n")); else if (!(server || (IsPlayerAdmin(consoleplayer)))) CONS_Printf(M_GetText("Only the server or a remote admin can use this.\n")); - else if (gamestate != GS_LEVEL || demoplayback) + else if (( gamestate != GS_LEVEL && gamestate != GS_CREDITS ) || demoplayback) CONS_Printf(M_GetText("You must be in a level to use this.\n")); else SendNetXCmd(XD_EXITLEVEL, NULL, 0); @@ -4024,7 +4063,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; @@ -4066,6 +4105,9 @@ void Command_ExitGame_f(void) cv_debug = 0; emeralds = 0; + if (dirmenu) + closefilemenu(true); + if (!modeattacking) D_StartTitle(); } @@ -4162,8 +4204,8 @@ static void Command_Archivetest_f(void) // assign mobjnum i = 1; - for (th = thinkercap.next; th != &thinkercap; th = th->next) - if (th->function.acp1 == (actionf_p1)P_MobjThinker) + for (th = thlist[THINK_MOBJ].next; th != &thlist[THINK_MOBJ]; th = th->next) + if (th->function.acp1 != (actionf_p1)P_RemoveThinkerDelayed) ((mobj_t *)th)->mobjnum = i++; // allocate buffer diff --git a/src/d_netcmd.h b/src/d_netcmd.h index b82065c82..5076c8afa 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; @@ -125,12 +129,12 @@ typedef enum XD_ADDPLAYER, // 10 XD_TEAMCHANGE, // 11 XD_CLEARSCORES, // 12 - XD_LOGIN, // 13 - XD_VERIFIED, // 14 + // UNUSED 13 (Because I don't want to change these comments) + XD_VERIFIED = 14,//14 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 f73712418..ed2d11138 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,6 +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 handled via W_LoadWadFile in w_wad.c * */ UINT8 *PutFileNeeded(void) @@ -112,29 +106,22 @@ UINT8 *PutFileNeeded(void) UINT8 *p = netbuffer->u.serverinfo.fileneeded; char wadfilename[MAX_WADPATH] = ""; UINT8 filestatus; - size_t bytesused = 0; for (i = 0; i < numwadfiles; i++) { - // If it has only music/sound lumps, mark it as unimportant - if (W_VerifyNMUSlumps(wadfiles[i]->filename)) - filestatus = 0; - else - filestatus = 1; // Important + // If it has only music/sound lumps, don't put it in the list + if (!wadfiles[i]->important) + continue; + + filestatus = 1; // Importance - not really used any more, holds 1 by default for backwards compat with MS // Store in the upper four bits if (!cv_downloading.value) filestatus += (2 << 4); // Won't send - else if ((wadfiles[i]->filesize > (UINT32)cv_maxsend.value * 1024)) - filestatus += (0 << 4); // Won't send - else + else if ((wadfiles[i]->filesize <= (UINT32)cv_maxsend.value * 1024)) filestatus += (1 << 4); // Will send if requested - - bytesused += (nameonlylength(wadfilename) + 22); - - // Don't write too far... - if (bytesused > sizeof(netbuffer->u.serverinfo.fileneeded)) - I_Error("Too many wad files added to host a game. (%s, stopped on %s)\n", sizeu1(bytesused), wadfilename); + // else + // filestatus += (0 << 4); -- Won't send, too big WRITEUINT8(p, filestatus); @@ -167,7 +154,6 @@ void D_ParseFileneeded(INT32 fileneedednum_parm, UINT8 *fileneededstr) { fileneeded[i].status = FS_NOTFOUND; // We haven't even started looking for the file yet filestatus = READUINT8(p); // The first byte is the file status - fileneeded[i].important = (UINT8)(filestatus & 3); fileneeded[i].willsend = (UINT8)(filestatus >> 4); fileneeded[i].totalsize = READUINT32(p); // The four next bytes are the file size fileneeded[i].file = NULL; // The file isn't open yet @@ -197,7 +183,7 @@ boolean CL_CheckDownloadable(void) UINT8 i,dlstatus = 0; for (i = 0; i < fileneedednum; i++) - if (fileneeded[i].status != FS_FOUND && fileneeded[i].status != FS_OPEN && fileneeded[i].important) + if (fileneeded[i].status != FS_FOUND && fileneeded[i].status != FS_OPEN) { if (fileneeded[i].willsend == 1) continue; @@ -218,7 +204,7 @@ boolean CL_CheckDownloadable(void) // not downloadable, put reason in console CONS_Alert(CONS_NOTICE, M_GetText("You need additional files to connect to this server:\n")); for (i = 0; i < fileneedednum; i++) - if (fileneeded[i].status != FS_FOUND && fileneeded[i].status != FS_OPEN && fileneeded[i].important) + if (fileneeded[i].status != FS_FOUND && fileneeded[i].status != FS_OPEN) { CONS_Printf(" * \"%s\" (%dK)", fileneeded[i].filename, fileneeded[i].totalsize >> 10); @@ -271,7 +257,7 @@ boolean CL_SendRequestFile(void) for (i = 0; i < fileneedednum; i++) if (fileneeded[i].status != FS_FOUND && fileneeded[i].status != FS_OPEN - && fileneeded[i].important && (fileneeded[i].willsend == 0 || fileneeded[i].willsend == 2)) + && (fileneeded[i].willsend == 0 || fileneeded[i].willsend == 2)) { I_Error("Attempted to download files that were not sendable"); } @@ -280,8 +266,7 @@ boolean CL_SendRequestFile(void) netbuffer->packettype = PT_REQUESTFILE; p = (char *)netbuffer->u.textcmd; for (i = 0; i < fileneedednum; i++) - if ((fileneeded[i].status == FS_NOTFOUND || fileneeded[i].status == FS_MD5SUMBAD) - && fileneeded[i].important) + if ((fileneeded[i].status == FS_NOTFOUND || fileneeded[i].status == FS_MD5SUMBAD)) { totalfreespaceneeded += fileneeded[i].totalsize; nameonly(fileneeded[i].filename); @@ -339,16 +324,12 @@ INT32 CL_CheckFiles(void) INT32 ret = 1; size_t packetsize = 0; size_t filestoget = 0; - serverinfo_pak *dummycheck = NULL; - - // Shut the compiler up. - (void)dummycheck; // if (M_CheckParm("-nofiles")) // 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; @@ -360,15 +341,9 @@ INT32 CL_CheckFiles(void) CONS_Debug(DBG_NETPLAY, "game is modified; only doing basic checks\n"); for (i = 1, j = 1; i < fileneedednum || j < numwadfiles;) { - if (i < fileneedednum && !fileneeded[i].important) + if (j < numwadfiles && !wadfiles[j]->important) { - // Eh whatever, don't care - ++i; - continue; - } - if (j < numwadfiles && W_VerifyNMUSlumps(wadfiles[j]->filename)) - { - // Unimportant on our side. still don't care. + // Unimportant on our side. ++j; continue; } @@ -392,8 +367,7 @@ INT32 CL_CheckFiles(void) } // See W_LoadWadFile in w_wad.c - for (i = 0; i < numwadfiles; i++) - packetsize += nameonlylength(wadfiles[i]->filename) + 22; + packetsize = packetsizetally; for (i = 1; i < fileneedednum; i++) { @@ -411,13 +385,13 @@ INT32 CL_CheckFiles(void) break; } } - if (fileneeded[i].status != FS_NOTFOUND || !fileneeded[i].important) + if (fileneeded[i].status != FS_NOTFOUND) continue; packetsize += nameonlylength(fileneeded[i].filename) + 22; if ((numwadfiles+filestoget >= MAX_WADFILES) - || (packetsize > sizeof(dummycheck->fileneeded))) + || (packetsize > MAXFILENEEDED*sizeof(UINT8))) return 3; filestoget++; @@ -449,27 +423,8 @@ void CL_LoadServerFiles(void) fileneeded[i].status = FS_OPEN; } else if (fileneeded[i].status == FS_MD5SUMBAD) - { - // If the file is marked important, don't even bother proceeding. - if (fileneeded[i].important) - I_Error("Wrong version of important file %s", fileneeded[i].filename); - - // If it isn't, no need to worry the user with a console message, - // although it can't hurt to put something in the debug file. - - // ...but wait a second. What if the local version is "important"? - if (!W_VerifyNMUSlumps(fileneeded[i].filename)) - I_Error("File %s should only contain music and sound effects!", - fileneeded[i].filename); - - // Okay, NOW we know it's safe. Whew. - P_AddWadFile(fileneeded[i].filename); - if (fileneeded[i].important) - G_SetGameModified(true); - fileneeded[i].status = FS_OPEN; - DEBFILE(va("File %s found but with different md5sum\n", fileneeded[i].filename)); - } - else if (fileneeded[i].important) + I_Error("Wrong version of file %s", fileneeded[i].filename); + else { const char *s; switch(fileneeded[i].status) @@ -790,19 +745,24 @@ void Got_Filetxpak(void) { INT32 filenum = netbuffer->u.filetxpak.fileid; fileneeded_t *file = &fileneeded[filenum]; - char *filename = file->filename; + char *filename; static INT32 filetime = 0; - if (!(strcmp(filename, "srb2.srb") + filename = va("%s", file->filename); + nameonly(filename); + + 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") )) I_Error("Tried to download \"%s\"", filename); + filename = file->filename; + if (filenum >= fileneedednum) { DEBFILE(va("fileframent not needed %d>%d\n", filenum, fileneedednum)); @@ -939,10 +899,11 @@ void nameonly(char *s) { ns = &(s[j+1]); len = strlen(ns); - if (false) - M_Memcpy(s, ns, len+1); - else - memmove(s, ns, len+1); +#if 0 + M_Memcpy(s, ns, len+1); +#else + memmove(s, ns, len+1); +#endif return; } } @@ -965,7 +926,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 @@ -1017,11 +978,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_netfil.h b/src/d_netfil.h index a7b692931..3d7c2ed59 100644 --- a/src/d_netfil.h +++ b/src/d_netfil.h @@ -35,7 +35,6 @@ typedef enum typedef struct { - UINT8 important; UINT8 willsend; // Is the server willing to send it? char filename[MAX_WADPATH]; UINT8 md5sum[16]; diff --git a/src/d_player.h b/src/d_player.h index 7c5ac6890..5860cf1de 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,83 @@ 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, + SH_PINK, // PITY IN PINK! + + // 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 +244,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 +271,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 +307,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,15 +322,21 @@ 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. INT32 ringweapons; // weapons currently obtained. + UINT16 ammoremoval; // amount of ammo removed for the current weapon. + tic_t ammoremovaltimer; // flashing counter for ammo used. + INT32 ammoremovalweapon; // weapon from which the ammo was removed. + // Power ups. invinc and invis are tic counters. UINT16 powers[NUMPOWERS]; @@ -301,10 +355,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 +376,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 +385,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 +405,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 +461,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 +499,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 +508,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 edc4e01d3..5db61a5b5 100644 --- a/src/dehacked.c +++ b/src/dehacked.c @@ -28,6 +28,7 @@ #include "p_local.h" // for var1 and var2, and some constants #include "p_setup.h" #include "r_data.h" +#include "r_draw.h" #include "r_sky.h" #include "fastcmp.h" #include "lua_script.h" @@ -66,11 +67,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 +82,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 +168,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 +292,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 +303,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 < 32 && PlayerMenu[*num].status != IT_DISABLED) + while (*num < MAXSKINS && (description[*num].used)) *num = *num+1; // No more free slots. :( - if (*num >= 32) + 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 +329,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 +348,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 +393,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 +428,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 +506,24 @@ 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) { + CONS_Printf("Sprite SPR2_%s allocated.\n",word); + strncpy(spr2names[free_spr2],word,4); + spr2defaults[free_spr2] = 0; + 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 +567,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 +702,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 +772,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 +783,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 +859,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 +899,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 +988,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 +1081,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")) { @@ -1142,6 +1110,7 @@ static void readlevelheader(MYFILE *f, INT32 num) if (fastcmp(word2, "TITLE")) i = 1100; else if (fastcmp(word2, "EVALUATION")) i = 1101; else if (fastcmp(word2, "CREDITS")) i = 1102; + else if (fastcmp(word2, "ENDING")) i = 1103; else // Support using the actual map name, // i.e., Nextlevel = AB, Nextlevel = FZ, etc. @@ -1196,6 +1165,22 @@ static void readlevelheader(MYFILE *f, INT32 num) #endif else if (fastcmp(word, "MUSICTRACK")) mapheaderinfo[num-1]->mustrack = ((UINT16)i - 1); + else if (fastcmp(word, "MUSICPOS")) + mapheaderinfo[num-1]->muspos = (UINT32)get_number(word2); + else if (fastcmp(word, "MUSICINTERFADEOUT")) + mapheaderinfo[num-1]->musinterfadeout = (UINT32)get_number(word2); + else if (fastcmp(word, "MUSICINTER")) + deh_strlcpy(mapheaderinfo[num-1]->musintername, word2, + sizeof(mapheaderinfo[num-1]->musintername), va("Level header %d: intermission music", num)); + else if (fastcmp(word, "MUSICPOSTBOSS")) + deh_strlcpy(mapheaderinfo[num-1]->muspostbossname, word2, + sizeof(mapheaderinfo[num-1]->muspostbossname), va("Level header %d: post-boss music", num)); + else if (fastcmp(word, "MUSICPOSTBOSSTRACK")) + mapheaderinfo[num-1]->muspostbosstrack = ((UINT16)i - 1); + else if (fastcmp(word, "MUSICPOSTBOSSPOS")) + mapheaderinfo[num-1]->muspostbosspos = (UINT32)get_number(word2); + else if (fastcmp(word, "MUSICPOSTBOSSFADEIN")) + mapheaderinfo[num-1]->muspostbossfadein = (UINT32)get_number(word2); else if (fastcmp(word, "FORCECHARACTER")) { strlcpy(mapheaderinfo[num-1]->forcecharacter, word2, SKINNAMESIZE+1); @@ -1241,13 +1226,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, "MAXBONUSLIVES")) + mapheaderinfo[num-1]->maxbonuslives = (SINT8)i; else if (fastcmp(word, "LEVELFLAGS")) mapheaderinfo[num-1]->levelflags = (UINT8)i; else if (fastcmp(word, "MENUFLAGS")) @@ -1289,6 +1278,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")) @@ -1326,6 +1329,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); } @@ -1334,6 +1346,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); @@ -1343,8 +1357,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)) @@ -1421,7 +1433,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)) @@ -1436,27 +1447,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 @@ -1464,14 +1470,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)); @@ -1484,37 +1488,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")) + { + 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 @@ -1532,9 +1533,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]) @@ -1577,8 +1575,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); @@ -1592,6 +1588,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); @@ -1634,14 +2152,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); } @@ -1670,192 +2190,248 @@ 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"}, + {{A_ModuloToState}, "A_MODULOTOSTATE"}, + {{NULL}, "NONE"}, // This NULL entry must be the last in the list {{NULL}, NULL}, @@ -1897,39 +2473,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)); @@ -1947,10 +2517,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; @@ -1982,10 +2549,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; @@ -1999,8 +2567,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) @@ -2008,43 +2576,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. @@ -2075,11 +2638,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; } @@ -2092,17 +2651,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 @@ -2157,6 +2705,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")) @@ -2164,12 +2714,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, @@ -2239,13 +2785,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 @@ -2323,17 +2862,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 { @@ -2681,190 +3211,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); @@ -2919,7 +3265,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")) @@ -2933,97 +3278,123 @@ 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 = (UINT8)(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, "AMMOREMOVALTICS")) + { + ammoremovaltics = 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 = (boolean)(value || word2[0] == 'T' || word2[0] == 'Y'); + 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) @@ -3031,32 +3402,29 @@ static void readmaincfg(MYFILE *f) } else if (fastcmp(word, "DISABLESPEEDADJUST")) { - DEH_WriteUndoline(word, va("%d", disableSpeedAdjust), UNDO_NONE); - disableSpeedAdjust = (UINT8)get_number(word2); + 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); } @@ -3070,7 +3438,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; @@ -3080,22 +3447,55 @@ static void readmaincfg(MYFILE *f) strncpy(timeattackfolder, gamedatafilename, min(filenamelen, sizeof (timeattackfolder))); timeattackfolder[min(filenamelen, sizeof (timeattackfolder) - 1)] = '\0'; - strncpy(savegamename, timeattackfolder, strlen(timeattackfolder)); + strcpy(savegamename, timeattackfolder); strlcat(savegamename, "%u.ssg", sizeof(savegamename)); // can't use sprintf since there is %u in savegamename 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); @@ -3283,38 +3683,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; @@ -3348,25 +3735,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 @@ -3374,47 +3760,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); @@ -3423,24 +3851,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, @@ -3457,7 +3881,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")) { @@ -3468,7 +3891,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")) { @@ -3481,63 +3913,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 @@ -3549,51 +3937,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); @@ -3605,11 +3965,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); @@ -3621,25 +3980,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; @@ -3679,6 +4039,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) { @@ -3696,89 +4070,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?? @@ -3806,61 +4115,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", @@ -3875,6 +4188,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", @@ -3911,10 +4279,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", @@ -3951,7 +4315,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", @@ -3993,14 +4356,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", @@ -4033,15 +4422,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", @@ -4049,11 +4433,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", @@ -4066,6 +4451,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", @@ -4083,17 +4473,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", @@ -4112,6 +4519,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", @@ -4139,14 +4555,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", @@ -4188,25 +4620,12 @@ static const char *const STATE_LIST[] = { // array length left dynamic for sanit "S_EGGMOBILE_PANIC5", "S_EGGMOBILE_PANIC6", "S_EGGMOBILE_PANIC7", - "S_EGGMOBILE_PANIC8", - "S_EGGMOBILE_PANIC9", - "S_EGGMOBILE_PANIC10", "S_EGGMOBILE_PAIN", "S_EGGMOBILE_PAIN2", "S_EGGMOBILE_DIE1", "S_EGGMOBILE_DIE2", "S_EGGMOBILE_DIE3", "S_EGGMOBILE_DIE4", - "S_EGGMOBILE_DIE5", - "S_EGGMOBILE_DIE6", - "S_EGGMOBILE_DIE7", - "S_EGGMOBILE_DIE8", - "S_EGGMOBILE_DIE9", - "S_EGGMOBILE_DIE10", - "S_EGGMOBILE_DIE11", - "S_EGGMOBILE_DIE12", - "S_EGGMOBILE_DIE13", - "S_EGGMOBILE_DIE14", "S_EGGMOBILE_FLEE1", "S_EGGMOBILE_FLEE2", "S_EGGMOBILE_BALL", @@ -4227,16 +4646,6 @@ static const char *const STATE_LIST[] = { // array length left dynamic for sanit "S_EGGMOBILE2_DIE2", "S_EGGMOBILE2_DIE3", "S_EGGMOBILE2_DIE4", - "S_EGGMOBILE2_DIE5", - "S_EGGMOBILE2_DIE6", - "S_EGGMOBILE2_DIE7", - "S_EGGMOBILE2_DIE8", - "S_EGGMOBILE2_DIE9", - "S_EGGMOBILE2_DIE10", - "S_EGGMOBILE2_DIE11", - "S_EGGMOBILE2_DIE12", - "S_EGGMOBILE2_DIE13", - "S_EGGMOBILE2_DIE14", "S_EGGMOBILE2_FLEE1", "S_EGGMOBILE2_FLEE2", @@ -4248,9 +4657,15 @@ 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", + "S_EGGMOBILE3_LAUGH1", + "S_EGGMOBILE3_LAUGH2", + "S_EGGMOBILE3_LAUGH3", + "S_EGGMOBILE3_LAUGH4", + "S_EGGMOBILE3_LAUGH5", "S_EGGMOBILE3_ATK1", "S_EGGMOBILE3_ATK2", "S_EGGMOBILE3_ATK3A", @@ -4259,11 +4674,6 @@ static const char *const STATE_LIST[] = { // array length left dynamic for sanit "S_EGGMOBILE3_ATK3D", "S_EGGMOBILE3_ATK4", "S_EGGMOBILE3_ATK5", - "S_EGGMOBILE3_LAUGH1", - "S_EGGMOBILE3_LAUGH2", - "S_EGGMOBILE3_LAUGH3", - "S_EGGMOBILE3_LAUGH4", - "S_EGGMOBILE3_LAUGH5", "S_EGGMOBILE3_LAUGH6", "S_EGGMOBILE3_LAUGH7", "S_EGGMOBILE3_LAUGH8", @@ -4285,16 +4695,6 @@ static const char *const STATE_LIST[] = { // array length left dynamic for sanit "S_EGGMOBILE3_DIE2", "S_EGGMOBILE3_DIE3", "S_EGGMOBILE3_DIE4", - "S_EGGMOBILE3_DIE5", - "S_EGGMOBILE3_DIE6", - "S_EGGMOBILE3_DIE7", - "S_EGGMOBILE3_DIE8", - "S_EGGMOBILE3_DIE9", - "S_EGGMOBILE3_DIE10", - "S_EGGMOBILE3_DIE11", - "S_EGGMOBILE3_DIE12", - "S_EGGMOBILE3_DIE13", - "S_EGGMOBILE3_DIE14", "S_EGGMOBILE3_FLEE1", "S_EGGMOBILE3_FLEE2", @@ -4316,8 +4716,8 @@ static const char *const STATE_LIST[] = { // array length left dynamic for sanit "S_FAKEMOBILE_ATK3B", "S_FAKEMOBILE_ATK3C", "S_FAKEMOBILE_ATK3D", - "S_FAKEMOBILE_ATK4", - "S_FAKEMOBILE_ATK5", + "S_FAKEMOBILE_DIE1", + "S_FAKEMOBILE_DIE2", // Boss 4 "S_EGGMOBILE4_STND", @@ -4335,36 +4735,122 @@ static const char *const STATE_LIST[] = { // array length left dynamic for sanit "S_EGGMOBILE4_RATK6", "S_EGGMOBILE4_RAISE1", "S_EGGMOBILE4_RAISE2", - "S_EGGMOBILE4_RAISE3", - "S_EGGMOBILE4_RAISE4", - "S_EGGMOBILE4_RAISE5", - "S_EGGMOBILE4_RAISE6", - "S_EGGMOBILE4_RAISE7", - "S_EGGMOBILE4_RAISE8", - "S_EGGMOBILE4_RAISE9", - "S_EGGMOBILE4_RAISE10", - "S_EGGMOBILE4_PAIN", + "S_EGGMOBILE4_PAIN1", + "S_EGGMOBILE4_PAIN2", "S_EGGMOBILE4_DIE1", "S_EGGMOBILE4_DIE2", "S_EGGMOBILE4_DIE3", "S_EGGMOBILE4_DIE4", - "S_EGGMOBILE4_DIE5", - "S_EGGMOBILE4_DIE6", - "S_EGGMOBILE4_DIE7", - "S_EGGMOBILE4_DIE8", - "S_EGGMOBILE4_DIE9", - "S_EGGMOBILE4_DIE10", - "S_EGGMOBILE4_DIE11", - "S_EGGMOBILE4_DIE12", - "S_EGGMOBILE4_DIE13", - "S_EGGMOBILE4_DIE14", "S_EGGMOBILE4_FLEE1", "S_EGGMOBILE4_FLEE2", "S_EGGMOBILE4_MACE", + "S_EGGMOBILE4_MACE_DIE1", + "S_EGGMOBILE4_MACE_DIE2", + "S_EGGMOBILE4_MACE_DIE3", // Boss 4 jet flame - "S_JETFLAME1", - "S_JETFLAME2", + "S_JETFLAME", + + // Boss 4 Spectator Eggrobo + "S_EGGROBO1_IDLE", + "S_EGGROBO1_BSLAP1", + "S_EGGROBO2_BSLAP2", + "S_EGGROBO1_PISSED", + + // Boss 4 Spectator Eggrobo jet flame + "S_EGGROBOJET", + + // 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_LOBSHOT0", + "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_PINCHLOBSHOT0", + "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", @@ -4602,7 +5088,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", @@ -4620,18 +5106,19 @@ 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", + "S_METALSONIC_DEATH1", + "S_METALSONIC_DEATH2", + "S_METALSONIC_DEATH3", + "S_METALSONIC_DEATH4", "S_METALSONIC_FLEE1", "S_METALSONIC_FLEE2", - "S_METALSONIC_FLEE3", - "S_METALSONIC_FLEE4", "S_MSSHIELD_F1", "S_MSSHIELD_F2", @@ -4650,27 +5137,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", @@ -4713,18 +5206,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", @@ -4781,16 +5272,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", @@ -4801,7 +5282,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", @@ -4819,190 +5300,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", @@ -5033,39 +5493,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", @@ -5096,14 +5577,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", @@ -5112,19 +5613,84 @@ 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_CEZBANNER1", + "S_CEZBANNER2", + "S_PINETREE", + "S_CEZBUSH1", + "S_CEZBUSH2", + "S_CANDLE", + "S_CANDLEPRICKET", + "S_FLAMEHOLDER", + "S_FIRETORCH", + "S_WAVINGFLAG", + "S_WAVINGFLAGSEG1", + "S_WAVINGFLAGSEG2", + "S_CRAWLASTATUE", + "S_FACESTABBERSTATUE", + "S_SUSPICIOUSFACESTABBERSTATUE_WAIT", + "S_SUSPICIOUSFACESTABBERSTATUE_BURST1", + "S_SUSPICIOUSFACESTABBERSTATUE_BURST2", + "S_BRAMBLES", // Big Tumbleweed "S_BIGTUMBLEWEED", @@ -5153,6 +5719,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", @@ -5165,36 +5820,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", @@ -5242,7 +5874,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", @@ -5289,8 +5977,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", @@ -5334,6 +6024,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", @@ -5351,6 +6057,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", @@ -5373,6 +6095,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", @@ -5396,6 +6119,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", @@ -5409,6 +6134,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", @@ -5417,6 +6145,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", @@ -5428,6 +6158,86 @@ static const char *const STATE_LIST[] = { // array length left dynamic for sanit "S_PITY8", "S_PITY9", "S_PITY10", + "S_PITY11", + "S_PITY12", + + "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", @@ -5439,57 +6249,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", @@ -5516,6 +6497,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", @@ -5550,14 +6571,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", @@ -5576,7 +6612,6 @@ static const char *const STATE_LIST[] = { // array length left dynamic for sanit "S_SEED", "S_PARTICLE", - "S_PARTICLEGEN", // Score Logos "S_SCRA", // 100 @@ -5590,6 +6625,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", @@ -5599,14 +6635,30 @@ 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", + "S_LOCKON3", + "S_LOCKON4", + "S_LOCKONINF1", + "S_LOCKONINF2", + "S_LOCKONINF3", + "S_LOCKONINF4", + // Tag Sign - "S_TTAG1", + "S_TTAG", // Got Flag Sign - "S_GOTFLAG1", - "S_GOTFLAG2", - "S_GOTFLAG3", - "S_GOTFLAG4", + "S_GOTFLAG", + + "S_CORK", + "S_LHRT", // Red Ring "S_RRNG1", @@ -5781,20 +6833,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", @@ -5808,8 +6859,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", @@ -5826,97 +6877,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", @@ -5967,20 +6931,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 @@ -5992,14 +6948,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", @@ -6010,43 +6963,160 @@ 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", "S_SPRK3", - "S_SPRK4", - "S_SPRK5", - "S_SPRK6", - "S_SPRK7", - "S_SPRK8", - "S_SPRK9", - "S_SPRK10", - "S_SPRK11", - "S_SPRK12", - "S_SPRK13", - "S_SPRK14", - "S_SPRK15", - "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", @@ -6056,6 +7126,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", @@ -6074,70 +7151,7 @@ static const char *const STATE_LIST[] = { // array length left dynamic for sanit "S_ROCKCRUMBLEN", "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", + "S_BRICKDEBRIS", #ifdef SEENAMES "S_NAMECHECK", @@ -6153,37 +7167,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", @@ -6207,16 +7230,28 @@ static const char *const MOBJTYPE_LIST[] = { // array length left dynamic for s "MT_BOSSTANK2", "MT_BOSSSPIGOT", "MT_GOOP", + "MT_GOOPTRAIL", // Boss 3 "MT_EGGMOBILE3", "MT_PROPELLER", "MT_FAKEMOBILE", + "MT_SHOCK", // Boss 4 "MT_EGGMOBILE4", "MT_EGGMOBILE4_MACE", "MT_JETFLAME", + "MT_EGGROBO1", + "MT_EGGROBO1JET", + + // Boss 5 + "MT_FANG", + "MT_FBOMB", + "MT_TNTDUST", // also used by barrel + "MT_FSGNA", + "MT_FSGNB", + "MT_FANGWAYPOINT", // Black Eggman (Boss 7) "MT_BLACKEGGMAN", @@ -6246,11 +7281,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", @@ -6267,66 +7303,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", @@ -6346,15 +7413,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 @@ -6362,21 +7449,53 @@ 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_CEZPOLE1", // Pole (with red banner) + "MT_CEZPOLE2", // Pole (with blue banner) + "MT_CEZBANNER1", // Banner (red) + "MT_CEZBANNER2", // Banner (blue) + "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_WAVINGFLAG1", // Waving flag (red) + "MT_WAVINGFLAG2", // Waving flag (blue) + "MT_WAVINGFLAGSEG1", // Waving flag segment (red) + "MT_WAVINGFLAGSEG2", // Waving flag segment (blue) + "MT_CRAWLASTATUE", // Crawla statue + "MT_FACESTABBERSTATUE", // Facestabber statue + "MT_SUSPICIOUSFACESTABBERSTATUE", // :eggthinking: + "MT_BRAMBLES", // Brambles // Arid Canyon Scenery "MT_BIGTUMBLEWEED", @@ -6385,6 +7504,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", @@ -6392,9 +7539,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 @@ -6424,7 +7569,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", @@ -6471,30 +7643,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 @@ -6504,8 +7713,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. @@ -6513,9 +7723,10 @@ 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_LOCKONINF", // In-level Target "MT_TAG", // Tag Sign "MT_GOTFLAG", // Got Flag sign - "MT_GOTFLAG2", // Got Flag sign // Ambient Sounds "MT_AWATERA", // Ambient Water Sound 1 @@ -6528,6 +7739,10 @@ 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", + "MT_LHRT", // Ring Weapons "MT_REDRING", @@ -6562,6 +7777,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", @@ -6575,8 +7791,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 @@ -6584,14 +7801,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", @@ -6602,6 +7843,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", @@ -6613,6 +7855,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", @@ -6631,23 +7875,8 @@ static const char *const MOBJTYPE_LIST[] = { // array length left dynamic for s "MT_ROCKCRUMBLE14", "MT_ROCKCRUMBLE15", "MT_ROCKCRUMBLE16", + "MT_BRICKDEBRIS", - "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 @@ -6659,7 +7888,7 @@ static const char *const MOBJFLAG_LIST[] = { "SHOOTABLE", "NOSECTOR", "NOBLOCKMAP", - "AMBUSH", + "PAPERCOLLISION", "PUSHABLE", "BOSS", "SPAWNCEILING", @@ -6689,34 +7918,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 }; @@ -6728,7 +7959,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 @@ -6744,8 +7975,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", @@ -6763,53 +7998,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. }; @@ -6839,50 +8057,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[] = { @@ -6890,10 +8188,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 @@ -6916,37 +8216,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", @@ -6954,10 +8243,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!! @@ -6991,12 +8370,15 @@ struct { // doomdef.h constants {"TICRATE",TICRATE}, + {"MUSICRATE",MUSICRATE}, {"RING_DIST",RING_DIST}, {"PUSHACCEL",PUSHACCEL}, {"MODID",MODID}, // I don't know, I just thought it would be cool for a wad to potentially know what mod it was loaded into. {"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!) @@ -7004,13 +8386,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) @@ -7067,12 +8464,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}, + {"LF2_WIDEICON",LF2_WIDEICON}, // NiGHTS grades {"GRADE_F",GRADE_F}, @@ -7106,23 +8506,44 @@ 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}, + {"SH_PINK",SH_PINK}, + // 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}, @@ -7134,12 +8555,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 @@ -7157,10 +8586,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}, @@ -7171,6 +8603,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}, @@ -7185,6 +8626,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}, @@ -7196,6 +8654,23 @@ struct { {"GT_HIDEANDSEEK",GT_HIDEANDSEEK}, {"GT_CTF",GT_CTF}, + // Jingles (jingletype_t) + {"JT_NONE",JT_NONE}, + {"JT_OTHER",JT_OTHER}, + {"JT_MASTER",JT_MASTER}, + {"JT_1UP",JT_1UP}, + {"JT_SHOES",JT_SHOES}, + {"JT_INV",JT_INV}, + {"JT_MINV",JT_MINV}, + {"JT_DROWN",JT_DROWN}, + {"JT_SUPER",JT_SUPER}, + {"JT_GOVER",JT_GOVER}, + {"JT_NIGHTSTIMEOUT",JT_NIGHTSTIMEOUT}, + {"JT_SSTIMEOUT",JT_SSTIMEOUT}, + // {"JT_LCLEAR",JT_LCLEAR}, + // {"JT_RACENT",JT_RACENT}, + // {"JT_CONTSC",JT_CONTSC}, + // Player state (playerstate_t) {"PST_LIVE",PST_LIVE}, // Playing or camping. {"PST_DEAD",PST_DEAD}, // Dead on the ground, view follows killer. @@ -7204,11 +8679,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}, @@ -7219,6 +8701,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}, @@ -7286,12 +8771,14 @@ 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 - {"SL_NODYNAMIC",SL_NODYNAMIC}, // Slope will never need to move during the level, so don't fuss with recalculating it - {"SL_ANCHORVERTEX",SL_ANCHORVERTEX},// Slope is using a Slope Vertex Thing to anchor its position - {"SL_VERTEXSLOPE",SL_VERTEXSLOPE}, // Slope is built from three Slope Vertex Things + {"SL_NOPHYSICS",SL_NOPHYSICS}, + {"SL_DYNAMIC",SL_DYNAMIC}, #endif // Angles @@ -7375,13 +8862,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}, @@ -7407,7 +8904,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}, @@ -7425,6 +8922,14 @@ struct { {"KR_TIMEOUT",KR_TIMEOUT}, {"KR_BAN",KR_BAN}, {"KR_LEAVE",KR_LEAVE}, + + // translation colormaps + {"TC_DEFAULT",TC_DEFAULT}, + {"TC_BOSS",TC_BOSS}, + {"TC_METALSONIC",TC_METALSONIC}, + {"TC_ALLWHITE",TC_ALLWHITE}, + {"TC_RAINBOW",TC_RAINBOW}, + {"TC_BLINK",TC_BLINK}, #endif {NULL,0} @@ -7447,7 +8952,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) @@ -7484,6 +8989,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; @@ -7551,7 +9070,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 @@ -7750,6 +9283,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); @@ -7834,11 +9372,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) @@ -7864,7 +9405,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")) { @@ -7891,7 +9432,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")) { @@ -7906,7 +9447,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")) { @@ -7921,7 +9462,27 @@ 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); + spr2defaults[free_spr2] = 0; + 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); @@ -7931,14 +9492,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); @@ -8034,11 +9595,6 @@ static inline int lib_getenum(lua_State *L) lua_pushinteger(L, ((lua_Integer)1< 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_sound.c b/src/djgppdos/i_sound.c index 52c90aac2..847853a89 100644 --- a/src/djgppdos/i_sound.c +++ b/src/djgppdos/i_sound.c @@ -438,6 +438,37 @@ boolean I_SetSongSpeed(float speed) return false; } +/// ------------------------ +// MUSIC SEEKING +/// ------------------------ + +UINT32 I_GetSongLength(void) +{ + return 0; +} + +boolean I_SetSongLoopPoint(UINT32 looppoint) +{ + (void)looppoint; + return false; +} + +UINT32 I_GetSongLoopPoint(void) +{ + return 0; +} + +boolean I_SetSongPosition(UINT32 position) +{ + (void)position; + return false; +} + +UINT32 I_GetSongPosition(void) +{ + return 0; +} + /// ------------------------ // MUSIC PLAYBACK /// ------------------------ @@ -519,6 +550,7 @@ void I_ResumeSong (INT32 handle) songpaused = false; } + void I_SetMusicVolume(INT32 volume) { if (midi_disabled) @@ -545,3 +577,44 @@ int I_QrySongPlaying(int handle) return (midi_pos==-1); } #endif + +/// ------------------------ +// MUSIC FADING +/// ------------------------ + +void I_SetInternalMusicVolume(UINT8 volume) +{ + (void)volume; +} + +void I_StopFadingSong(void) +{ +} + +boolean I_FadeSongFromVolume(UINT8 target_volume, UINT8 source_volume, UINT32 ms, void (*callback)(void)); +{ + (void)target_volume; + (void)source_volume; + (void)ms; + return false; +} + +boolean I_FadeSong(UINT8 target_volume, UINT32 ms, void (*callback)(void)); +{ + (void)target_volume; + (void)ms; + return false; +} + +boolean I_FadeOutStopSong(UINT32 ms) +{ + (void)ms; + return false; +} + +boolean I_FadeInPlaySong(UINT32 ms, boolean looping) +{ + (void)ms; + (void)looping; + return false; +} 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..b4142463c 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 @@ -127,11 +130,9 @@ typedef struct #define ML_EFFECT4 512 #define ML_EFFECT5 1024 -// New ones to disable lines for characters -#define ML_NOSONIC 2048 -#define ML_NOTAILS 4096 -#define ML_NOKNUX 8192 -#define ML_NETONLY 14336 // all of the above +#define ML_NETONLY 2048 // Apply effect only in netgames +#define ML_NONET 4096 // Apply effect only in single player games +#define ML_EFFECT6 8192 // Bounce off walls! #define ML_BOUNCY 16384 @@ -207,8 +208,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 796221c91..6e7db2143 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,17 +138,20 @@ 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 21 // more precise version number -#define VERSIONSTRING "v2.1.21" -#define VERSIONSTRINGW L"v2.1.21" +#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 // Does this version require an added patch file? // Comment or uncomment this as necessary. -#define USE_PATCH_DTA +//#define USE_PATCH_DTA + +// Use .kart extension addons +//#define USE_KART // Modification options // If you want to take advantage of the Master Server's ability to force clients to update @@ -203,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. @@ -214,7 +206,21 @@ 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 26 +#define MODVERSION 30 + +// To version config.cfg, MAJOREXECVERSION is set equal to MODVERSION automatically. +// Increment MINOREXECVERSION whenever a config change is needed that does not correspond +// to an increment in MODVERSION. This might never happen in practice. +// If MODVERSION increases, set MINOREXECVERSION to 0. +#define MAJOREXECVERSION MODVERSION +#define MINOREXECVERSION 0 +// (It would have been nice to use VERSION and SUBVERSION but those are zero'd out for DEVELOP builds) + +// Macros +#define GETMAJOREXECVERSION(v) (v & 0xFFFF) +#define GETMINOREXECVERSION(v) (v >> 16) +#define GETEXECVERSION(major,minor) (major + (minor << 16)) +#define EXECVERSION GETEXECVERSION(MAJOREXECVERSION, MINOREXECVERSION) // ========================================================================= @@ -222,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. @@ -288,27 +373,35 @@ typedef enum #define NEWTICRATERATIO 1 // try 4 for 140 fps :) #define NEWTICRATE (TICRATE*NEWTICRATERATIO) +#define MUSICRATE 1000 // sound timing is calculated by milliseconds + #define RING_DIST 512*FRACUNIT // how close you need to be to a ring to attract it #define PUSHACCEL (2*FRACUNIT) // Acceleration for MF2_SLIDEPUSH items. // 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 (also subtract the number of hitpoints it's lost) + 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" @@ -366,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); @@ -379,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 @@ -389,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... @@ -396,6 +491,7 @@ extern INT32 cv_debug; // Modifier key variables, accessible anywhere extern UINT8 shiftdown, ctrldown, altdown; +extern boolean capslock; // if we ever make our alloc stuff... #define ZZ_Alloc(x) Z_Malloc(x, PU_STATIC, NULL) @@ -410,6 +506,15 @@ INT32 I_GetKey(void); #define max(x, y) (((x) > (y)) ? (x) : (y)) #endif +// Floating point comparison epsilons from float.h +#ifndef FLT_EPSILON +#define FLT_EPSILON 1.1920928955078125e-7f +#endif + +#ifndef DBL_EPSILON +#define DBL_EPSILON 2.2204460492503131e-16 +#endif + // An assert-type mechanism. #ifdef PARANOIA #define I_Assert(e) ((e) ? (void)0 : I_Error("assert failed: %s, file %s, line %d", #e, __FILE__, __LINE__)) @@ -441,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 @@ -472,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. @@ -498,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 7b4aa2644..b6c376d1c 100644 --- a/src/doomstat.h +++ b/src/doomstat.h @@ -33,17 +33,24 @@ extern INT16 gamemap; extern char mapmusname[7]; extern UINT16 mapmusflags; +extern UINT32 mapmusposition; #define MUSIC_TRACKMASK 0x0FFF // ----************ #define MUSIC_RELOADRESET 0x8000 // *--------------- +#define MUSIC_FORCERESET 0x4000 // -*-------------- // Use other bits if necessary. 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 @@ -118,17 +125,28 @@ 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; extern tic_t countdowntimer; extern boolean countdowntimeup; +extern boolean exitfadestarted; typedef struct { @@ -145,6 +163,7 @@ typedef struct char musswitch[7]; UINT16 musswitchflags; + UINT32 musswitchposition; UINT8 fadecolor; // Color number for fade, 0 means don't do the first fade UINT8 fadeinid; // ID of the first fade, to a color -- ignored if fadecolor is 0 @@ -159,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 UINT8 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). @@ -215,6 +288,7 @@ typedef struct INT16 nextlevel; ///< Map number of next level, or 1100-1102 to end. char musname[7]; ///< Music track to play. "" for no music. UINT16 mustrack; ///< Subsong to play. Only really relevant for music modules and specific formats supported by GME. 0 to ignore. + UINT32 muspos; ///< Music position to jump to. char forcecharacter[17]; ///< (SKINNAMESIZE+1) Skin to switch to or "" to disable. UINT8 weather; ///< 0 = sunny day, 1 = storm, 2 = snow, 3 = rain, 4 = blank, 5 = thunder w/o rain, 6 = rain w/o lightning, 7 = heat wave. INT16 skynum; ///< Sky number to use. @@ -234,14 +308,31 @@ 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 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. + // Music stuff. + UINT32 musinterfadeout; ///< Fade out level music on intermission screen in milliseconds + char musintername[7]; ///< Intermission screen music. + + char muspostbossname[7]; ///< Post-bossdeath music. + UINT16 muspostbosstrack; ///< Post-bossdeath track. + UINT32 muspostbosspos; ///< Post-bossdeath position + UINT32 muspostbossfadein; ///< Post-bossdeath fade-in milliseconds. + // Lua stuff. // (This is not ifdeffed so the map header structure can stay identical, just in case.) UINT8 numCustomOptions; ///< Internal. For Lua custom value support. @@ -254,12 +345,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 +#define LF2_WIDEICON 32 ///< If you're in a circumstance where it fits, use a wide map icon extern mapheader_t* mapheaderinfo[NUMMAPS]; @@ -304,7 +398,10 @@ enum GameType NUMGAMETYPES }; -// If you alter this list, update gametype_cons_t in m_menu.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]; extern tic_t totalplaytime; @@ -362,6 +459,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 @@ -369,6 +467,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 @@ -390,6 +489,7 @@ extern UINT16 tailsflytics; extern UINT16 underwatertics; extern UINT16 spacetimetics; extern UINT16 extralifetics; +extern UINT16 nightslinktics; extern UINT8 introtoplay; extern UINT8 creditscutscene; @@ -462,6 +562,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; @@ -473,6 +575,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 b44e32e46..7acdde966 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/dummy/i_sound.c b/src/dummy/i_sound.c index 7275bb1ae..f09158e01 100644 --- a/src/dummy/i_sound.c +++ b/src/dummy/i_sound.c @@ -95,6 +95,37 @@ boolean I_SetSongSpeed(float speed) return false; } +/// ------------------------ +// MUSIC SEEKING +/// ------------------------ + +UINT32 I_GetSongLength(void) +{ + return 0; +} + +boolean I_SetSongLoopPoint(UINT32 looppoint) +{ + (void)looppoint; + return false; +} + +UINT32 I_GetSongLoopPoint(void) +{ + return 0; +} + +boolean I_SetSongPosition(UINT32 position) +{ + (void)position; + return false; +} + +UINT32 I_GetSongPosition(void) +{ + return 0; +} + /// ------------------------ // MUSIC PLAYBACK /// ------------------------ @@ -142,4 +173,45 @@ boolean I_SetSongTrack(int track) { (void)track; return false; -} \ No newline at end of file +} + +/// ------------------------ +// MUSIC FADING +/// ------------------------ + +void I_SetInternalMusicVolume(UINT8 volume) +{ + (void)volume; +} + +void I_StopFadingSong(void) +{ +} + +boolean I_FadeSongFromVolume(UINT8 target_volume, UINT8 source_volume, UINT32 ms, void (*callback)(void)); +{ + (void)target_volume; + (void)source_volume; + (void)ms; + return false; +} + +boolean I_FadeSong(UINT8 target_volume, UINT32 ms, void (*callback)(void)); +{ + (void)target_volume; + (void)ms; + return false; +} + +boolean I_FadeOutStopSong(UINT32 ms) +{ + (void)ms; + return false; +} + +boolean I_FadeInPlaySong(UINT32 ms, boolean looping) +{ + (void)ms; + (void)looping; + return false; +} diff --git a/src/f_finale.c b/src/f_finale.c index 484a0afe6..da042abeb 100644 --- a/src/f_finale.c +++ b/src/f_finale.c @@ -14,6 +14,7 @@ #include "doomdef.h" #include "doomstat.h" #include "d_main.h" +#include "d_netcmd.h" #include "f_finale.h" #include "g_game.h" #include "hu_stuff.h" @@ -29,19 +30,31 @@ #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" +#include "console.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 = 20; +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 INT32 roidtics; // Asteroid spinning +static INT16 skullAnimCounter; // Prompts: Chevron animation static INT32 deplete; static tic_t stoptimer; @@ -49,6 +62,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[9]; +SINT8 curfadevalue; +boolean curhidepics; +INT32 curbgcolor; +INT32 curbgxspeed; +INT32 curbgyspeed; +boolean curbghide; + static UINT8 curDemo = 0; static UINT32 demoDelayLeft; static UINT32 demoIdleLeft; @@ -69,7 +96,29 @@ static patch_t *ttspop5; static patch_t *ttspop6; static patch_t *ttspop7; -static void F_SkyScroll(INT32 scrollspeed); +static boolean goodending; +static patch_t *endbrdr[2]; // border - blue, white, pink - where have i seen those colours before? +static patch_t *endbgsp[3]; // nebula, sun, planet +static patch_t *endegrk[2]; // eggrock - replaced midway through good ending +static patch_t *endfwrk[3]; // firework - replaced with skin when good ending +static patch_t *endspkl[3]; // sparkle +static patch_t *endglow[2]; // glow aura - replaced with black rock's midway through good ending +static patch_t *endxpld[4]; // mini explosion +static patch_t *endescp[5]; // escape pod + flame +static INT32 sparkloffs[3][2]; // eggrock explosions/blackrock sparkles +static INT32 sparklloop; + +// +// PROMPT STATE +// +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 +208,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 +242,9 @@ void F_StartCustomCutscene(INT32 cutscenenum, boolean precutscene, boolean reset void F_StartIntro(void) { + S_StopMusic(); + S_StopSounds(); + if (introtoplay) { if (!cutscenes[introtoplay - 1]) @@ -305,7 +264,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 +274,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 +290,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 +312,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 +356,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" @@ -444,12 +403,10 @@ void F_StartIntro(void) gameaction = ga_nothing; paused = false; CON_ToggleOff(); - CON_ClearHUD(); F_NewCutscene(introtext[0]); intro_scenenum = 0; - finalecount = animtimer = stoptimer = 0; - roidtics = BASEVIDWIDTH - 64; + finalecount = animtimer = skullAnimCounter = stoptimer = 0; timetonext = introscenetime[intro_scenenum]; } @@ -566,7 +523,7 @@ static void F_IntroDrawScene(void) if (finalecount < 4) S_StopMusic(); if (finalecount == 4) - S_ChangeMusicInternal("stjr", false); + S_ChangeMusicInternal("_stjr", false); x = (BASEVIDWIDTH<= 0) + if (intro_curtime > 1) { - V_DrawScaledPatch(roidtics, 24, 0, - (patch = W_CachePatchName(va("ROID00%.2d", intro_curtime%35), PU_CACHE))); - W_UnlockCachedPatch(patch); + INT32 worktics = intro_curtime - 1; + INT32 scale = FRACUNIT; + patch_t *rockpat; + UINT8 *colormap = NULL; + patch_t *glow; + INT32 trans = 0; + + INT32 x = ((BASEVIDWIDTH - 64)<= 5) + trans = (worktics-5)>>1; + if (trans < 10) + V_DrawFixedPatch(x, y, scale, trans< 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]); @@ -896,9 +891,6 @@ void F_IntroTicker(void) // advance animation finalecount++; - if (finalecount % 3 == 0) - roidtics--; - timetonext--; F_WriteText(); @@ -994,28 +986,33 @@ static const char *credits[] = { "\1Assistance", "\"chi.miru\"", // helped port slope drawing code from ZDoom "Andrew \"orospakr\" Clunis", + "Sally \"TehRealSalt\" Cochenour", "Gregor \"Oogaland\" Dick", "Louis-Antoine \"LJSonic\" de Moulins", // for fixing 2.1's netcode (de Rochefort doesn't quite fit on the screen sorry lol) + "Victor \"Steel Titanium\" Fuentes", "Julio \"Chaos Zero 64\" Guir", + "\"Jimita\"", "\"Kalaron\"", // Coded some of Sryder13's collection of OpenGL fixes, especially fog + "\"Lat'\"", // SRB2-CHAT, the chat window from Kart "Matthew \"Shuffle\" Marsalko", "Steven \"StroggOnMeth\" McGranahan", "\"Morph\"", // For SRB2Morphed stuff "Colin \"Sonict\" Pfaff", "Sean \"Sryder13\" Ryder", "Tasos \"tatokis\" Sahanidis", // Corrected C FixedMul, making 64-bit builds netplay compatible - "\"Steel Titanium\"", "Ben \"Cue\" Woodford", - // Git contributors with 5+ approved merges, at least a few of substantive quality, may be named - // Everyone else is acknowledged here - "STJr Git Contributors", + // Git contributors with 5+ approved merges of substantive quality, + // or contributors with at least one groundbreaking merge, may be named. + // Everyone else is acknowledged under "Special Thanks > SRB2 Community Contributors". "", "\1Sprite Artists", - "Odi \"Iceman404\" Atunzu", + "\"Iceman404\"", "Victor \"VAdaPEGA\" Ara\x1Fjo", // Araújo -- sorry for our limited font! D: + "Sally \"TehRealSalt\" Cochenour", "Jim \"MotorRoach\" DeMello", "Desmond \"Blade\" DesJardins", "Sherman \"CoatRack\" DesJardins", + "Vivian \"toaster\" Grannell", "Andrew \"Senku Niola\" Moran", "David \"Instant Sonic\" Spencer Jr.", "\"SSNTails\"", @@ -1050,21 +1047,23 @@ 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", - "Erik \"Torgo\" Nielsen", "\"Kaito Sinclaire\"", "Wessel \"sphere\" Smit", "\"Spazzo\"", "\"SSNTails\"", "Rob Tisdell", + "\"Torgo\"", "Jarrett \"JEV3\" Voight", "Johnny \"Sonikku\" Wallbank", "Marco \"mazmazz\" Zafra", "", "\1Boss Design", "Ben \"Mystic\" Geyer", + "Vivian \"toaster\" Grannell", "Thomas \"Shadow Hog\" Igoe", "John \"JTE\" Muniz", "Samuel \"Prime 2.0\" Peters", @@ -1082,11 +1081,20 @@ static const char *credits[] = { "Bill \"Tets\" Reed", "", "\1Special Thanks", - "Doom Legacy Project", "iD Software", - "Alex \"MistaED\" Fuller", + "Doom Legacy Project", "FreeDoom Project", // Used some of the mancubus and rocket launcher sprites for Brak + "Alex \"MistaED\" Fuller", + "Pascal \"CodeImp\" vd Heiden", // Doom Builder developer "Randi Heit ()", // For their MSPaint sprite that we nicked + "Simon \"sirjuddington\" Judd", // SLADE developer + // Acknowledged here are the following: + // Minor merge request authors, see guideline above + // - Golden - Expanded thin font + // Creators of small quantities of sprite/texture assets + // - Arietty - New Green Hill-styled textures + // - Scizor300 - the only other contributor to the 2.0 SRB2 Asset Pack + "SRB2 Community Contributors", "", "\1Produced By", "Sonic Team Junior", @@ -1126,7 +1134,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) @@ -1138,10 +1146,10 @@ void F_StartCredits(void) gameaction = ga_nothing; paused = false; CON_ToggleOff(); - CON_ClearHUD(); S_StopMusic(); + S_StopSounds(); - S_ChangeMusicInternal("credit", false); + S_ChangeMusicInternal("_creds", false); finalecount = 0; animtimer = 0; @@ -1160,7 +1168,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++) @@ -1184,16 +1192,34 @@ void F_CreditDrawer(void) if (FixedMul(y,vid.dupy) > vid.height) break; } +} +void F_CreditTicker(void) +{ + // "Simulate" the drawing of the credits so that dedicated mode doesn't get stuck + UINT16 i; + fixed_t y = (80< vid.height) + break; + } + + // Do this here rather than in the drawer you doofus! (this is why dedicated mode broke at credits) if (!credits[i] && y <= 120<type != ev_keydown) @@ -1259,15 +1285,13 @@ boolean F_CreditResponder(event_t *event) // ============ // EVALUATION // ============ -#define INTERVAL 50 -#define TRANSLEVEL V_80TRANS -static INT32 eemeralds_start; -static boolean drawemblem = false, drawchaosemblem = false; + +#define SPARKLLOOPTIME 7 // must be odd void F_StartGameEvaluation(void) { // Credits option in secrets menu - if (cursaveslot == -2) + if (cursaveslot == -1) { F_StartGameEnd(); return; @@ -1281,80 +1305,125 @@ 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); + goodending = (ALL7EMERALDS(emeralds)); + gameaction = ga_nothing; paused = false; CON_ToggleOff(); - CON_ClearHUD(); - finalecount = 0; + finalecount = -1; + sparklloop = 0; } void F_GameEvaluationDrawer(void) { INT32 x, y, i; - const fixed_t radius = 48*FRACUNIT; angle_t fa; INT32 eemeralds_cur; char patchname[7] = "CEMGx0"; + const char* endingtext = (goodending ? "CONGRATULATIONS!" : "TRY AGAIN..."); V_DrawFill(0, 0, BASEVIDWIDTH, BASEVIDHEIGHT, 31); // Draw all the good crap here. - if (ALL7EMERALDS(emeralds)) - V_DrawString(114, 16, 0, "GOT THEM ALL!"); - else - V_DrawString(124, 16, 0, "TRY AGAIN!"); - eemeralds_start++; - eemeralds_cur = eemeralds_start; - - for (i = 0; i < 7; ++i) + if (finalecount > 0) { - fa = (FixedAngle(eemeralds_cur*FRACUNIT)>>ANGLETOFINESHIFT) & FINEMASK; - x = 160 + FixedInt(FixedMul(FINECOSINE(fa),radius)); - y = 100 + FixedInt(FixedMul(FINESINE(fa),radius)); + INT32 scale = FRACUNIT; + patch_t *rockpat; + UINT8 *colormap[2] = {NULL, NULL}; + patch_t *glow; + INT32 trans = 0; - patchname[4] = 'A'+(char)i; - if (emeralds & (1<= 360) - eemeralds_start -= 360; - - if (finalecount == 5*TICRATE) - { - if ((!modifiedgame || savemoddata) && !(netgame || multiplayer)) + if (finalecount < 5) { - ++timesBeaten; + scale = (finalecount<<(FRACBITS-2)); + x += (30*(FRACUNIT-scale)); + y += (30*(FRACUNIT-scale)); + } - if (ALL7EMERALDS(emeralds)) - ++timesBeatenWithEmeralds; + if (goodending) + { + rockpat = W_CachePatchName(va("ROID00%.2d", 34 - (finalecount % 35)), PU_LEVEL); + glow = W_CachePatchName(va("ENDGLOW%.1d", 2+(finalecount & 1)), PU_LEVEL); + x -= FRACUNIT; + } + else + { + rockpat = W_CachePatchName("ROID0000", PU_LEVEL); + glow = W_CachePatchName(va("ENDGLOW%.1d", (finalecount & 1)), PU_LEVEL); + } - if (ultimatemode) - ++timesBeatenUltimate; + if (finalecount >= 5) + trans = (finalecount-5)>>1; + if (trans < 10) + V_DrawFixedPatch(x, y, scale, trans< (finalecount/SPARKLLOOPTIME)) + j = (finalecount/SPARKLLOOPTIME); + while (j) + { + if (j > 1 || sparklloop >= 2) + { + // if j == 0 - alternate between 0 and 1 + // 1 - 1 and 2 + // 2 - 2 and not rendered + V_DrawFixedPatch(x+sparkloffs[j-1][0], y+sparkloffs[j-1][1], FRACUNIT, 0, W_CachePatchName(va("ENDSPKL%.1d", (j - ((sparklloop & 1) ? 0 : 1))), PU_LEVEL), R_GetTranslationColormap(TC_DEFAULT, SKINCOLOR_AQUA, GTC_CACHE)); + } + j--; + } + } + else + { + patch_t *eggrock = W_CachePatchName("ENDEGRK5", PU_LEVEL); + V_DrawFixedPatch(x, y, scale, 0, eggrock, colormap[0]); + if (trans < 10) + V_DrawFixedPatch(x, y, scale, trans<>ANGLETOFINESHIFT) & FINEMASK; + x = (BASEVIDWIDTH<<(FRACBITS-1)) + (60*FINECOSINE(fa)); + y = ((BASEVIDHEIGHT+16)<<(FRACBITS-1)) + (60*FINESINE(fa)); + eemeralds_cur += (360<= 5*TICRATE) { - if (drawemblem) - V_DrawScaledPatch(120, 192, 0, W_CachePatchName("NWNGA0", PU_CACHE)); - - if (drawchaosemblem) - V_DrawScaledPatch(200, 192, 0, W_CachePatchName("NWNGA0", PU_CACHE)); - V_DrawString(8, 16, V_YELLOWMAP, "Unlocked:"); if (!(netgame) && (!modifiedgame || savemoddata)) @@ -1377,16 +1446,603 @@ void F_GameEvaluationDrawer(void) else V_DrawString(8, 96, V_YELLOWMAP, "Prizes not\nawarded in\nmodified games!"); } +#endif } void F_GameEvaluationTicker(void) { - finalecount++; - - if (finalecount > 10*TICRATE) + if (++finalecount > 10*TICRATE) + { F_StartGameEnd(); + return; + } + + if (!goodending) + { + if (sparklloop) + sparklloop--; + + if (finalecount == (5*TICRATE)/2 + || finalecount == (7*TICRATE)/2 + || finalecount == ((7*TICRATE)/2)+5) + { + S_StartSound(NULL, sfx_s3k5c); + sparklloop = 10; + } + } + else if (++sparklloop == SPARKLLOOPTIME) // time to roll the randomisation again + { + angle_t workingangle = FixedAngle((M_RandomKey(360))<>ANGLETOFINESHIFT; + fixed_t workingradius = M_RandomKey(26); + + sparkloffs[2][0] = sparkloffs[1][0]; + sparkloffs[2][1] = sparkloffs[1][1]; + sparkloffs[1][0] = sparkloffs[0][0]; + sparkloffs[1][1] = sparkloffs[0][1]; + + sparkloffs[0][0] = (30< 0) + G_SaveGame((UINT32)cursaveslot); + + gameaction = ga_nothing; + paused = false; + CON_ToggleOff(); + S_StopMusic(); // todo: placeholder + S_StopSounds(); + + finalecount = -10; // what? this totally isn't a hack. why are you asking? + + memset(sparkloffs, 0, sizeof(INT32)*3*2); + sparklloop = 0; + + endbrdr[1] = W_CachePatchName("ENDBRDR1", PU_LEVEL); + + endegrk[0] = W_CachePatchName("ENDEGRK0", PU_LEVEL); + endegrk[1] = W_CachePatchName("ENDEGRK1", PU_LEVEL); + + endglow[0] = W_CachePatchName("ENDGLOW0", PU_LEVEL); + endglow[1] = W_CachePatchName("ENDGLOW1", PU_LEVEL); + + endbgsp[0] = W_CachePatchName("ENDBGSP0", PU_LEVEL); + endbgsp[1] = W_CachePatchName("ENDBGSP1", PU_LEVEL); + endbgsp[2] = W_CachePatchName("ENDBGSP2", PU_LEVEL); + + endspkl[0] = W_CachePatchName("ENDSPKL0", PU_LEVEL); + endspkl[1] = W_CachePatchName("ENDSPKL1", PU_LEVEL); + endspkl[2] = W_CachePatchName("ENDSPKL2", PU_LEVEL); + + endxpld[0] = W_CachePatchName("ENDXPLD0", PU_LEVEL); + endxpld[1] = W_CachePatchName("ENDXPLD1", PU_LEVEL); + endxpld[2] = W_CachePatchName("ENDXPLD2", PU_LEVEL); + endxpld[3] = W_CachePatchName("ENDXPLD3", PU_LEVEL); + + endescp[0] = W_CachePatchName("ENDESCP0", PU_LEVEL); + endescp[1] = W_CachePatchName("ENDESCP1", PU_LEVEL); + endescp[2] = W_CachePatchName("ENDESCP2", PU_LEVEL); + endescp[3] = W_CachePatchName("ENDESCP3", PU_LEVEL); + endescp[4] = W_CachePatchName("ENDESCP4", PU_LEVEL); + + // so we only need to check once + if ((goodending = ALL7EMERALDS(emeralds))) + { + UINT8 skinnum = players[consoleplayer].skin; + spritedef_t *sprdef; + spriteframe_t *sprframe; + if (skins[skinnum].sprites[SPR2_XTRA].numframes >= 5) + { + sprdef = &skins[skinnum].sprites[SPR2_XTRA]; + // character head, skin specific + sprframe = &sprdef->spriteframes[2]; + endfwrk[0] = W_CachePatchNum(sprframe->lumppat[0], PU_LEVEL); + sprframe = &sprdef->spriteframes[3]; + endfwrk[1] = W_CachePatchNum(sprframe->lumppat[0], PU_LEVEL); + sprframe = &sprdef->spriteframes[4]; + endfwrk[2] = W_CachePatchNum(sprframe->lumppat[0], PU_LEVEL); + } + else // eh, yknow what? too lazy to put MISSINGs here. eggman wins if you don't give your character an ending firework display. + { + endfwrk[0] = W_CachePatchName("ENDFWRK0", PU_LEVEL); + endfwrk[1] = W_CachePatchName("ENDFWRK1", PU_LEVEL); + endfwrk[2] = W_CachePatchName("ENDFWRK2", PU_LEVEL); + } + + endbrdr[0] = W_CachePatchName("ENDBRDR2", PU_LEVEL); + } + else + { + // eggman, skin nonspecific + endfwrk[0] = W_CachePatchName("ENDFWRK0", PU_LEVEL); + endfwrk[1] = W_CachePatchName("ENDFWRK1", PU_LEVEL); + endfwrk[2] = W_CachePatchName("ENDFWRK2", PU_LEVEL); + + endbrdr[0] = W_CachePatchName("ENDBRDR0", PU_LEVEL); + } +} + +void F_EndingTicker(void) +{ + if (++finalecount > INFLECTIONPOINT*2) + { + F_StartCredits(); + wipetypepre = INT16_MAX; + return; + } + + if (goodending && finalecount == INFLECTIONPOINT) // time to swap some assets + { + endegrk[0] = W_CachePatchName("ENDEGRK2", PU_LEVEL); + endegrk[1] = W_CachePatchName("ENDEGRK3", PU_LEVEL); + + endglow[0] = W_CachePatchName("ENDGLOW2", PU_LEVEL); + endglow[1] = W_CachePatchName("ENDGLOW3", PU_LEVEL); + + endxpld[0] = W_CachePatchName("ENDEGRK4", PU_LEVEL); + } + + if (++sparklloop == SPARKLLOOPTIME) // time to roll the randomisation again + { + angle_t workingangle = FixedAngle((M_RandomRange(-170, 80))<>ANGLETOFINESHIFT; + fixed_t workingradius = M_RandomKey(26); + + sparkloffs[0][0] = (30< -19) + { + INT32 trans = (-parallaxticker)>>1; + if (trans < 0) + trans = 0; + V_DrawFixedPatch((200< 0) // gunchedrock + { + INT32 scale = FRACUNIT + ((parallaxticker-10)<<7); + INT32 trans = parallaxticker>>2; + UINT8 *colormap = R_GetTranslationColormap(TC_RAINBOW, SKINCOLOR_JET, GTC_CACHE); + + if (parallaxticker < 10) + { + tweakx = parallaxticker< 0) + { + i -= (3+(tweakx<<1)); + j += tweaky<<2; + } + + if (parallaxticker <= 70) // eggrock/blackrock + { + INT32 trans; + fixed_t scale = FRACUNIT; + UINT8 *colormap[2] = {NULL, NULL}; + + x += i; + y += j; + + if (parallaxticker > 66) + { + scale = ((70 - parallaxticker)<<(FRACBITS-2)); + x += (30*(FRACUNIT-scale)); + y += (30*(FRACUNIT-scale)); + } + else if ((parallaxticker > 60) || (goodending && parallaxticker > 0)) + ; + else + { + doexplosions = true; + if (!sparklloop) + { + x += ((sparkloffs[0][0] < 30< INFLECTIONPOINT) + parallaxticker -= 40; + + if ((-parallaxticker/4) < 5) + { + trans = (-parallaxticker/4) + 5; + if (trans < 0) + trans = 0; + V_DrawFixedPatch(x, y, scale, trans< INFLECTIONPOINT) + { + if (finalecount < INFLECTIONPOINT+10) + V_DrawFadeFill(24, 24, BASEVIDWIDTH-48, BASEVIDHEIGHT-48, 0, 0, INFLECTIONPOINT+10-finalecount); + parallaxticker -= 30; + } + + if ((parallaxticker/2) > -15) + colormap[0] = R_GetTranslationColormap(TC_ALLWHITE, 0, GTC_CACHE); + V_DrawFixedPatch(x, y, scale, 0, rockpat, colormap[0]); + if ((parallaxticker/2) > -25) + { + trans = (parallaxticker/2) + 15; + if (trans < 0) + trans = -trans; + if (trans < 10) + V_DrawFixedPatch(x, y, scale, trans< INFLECTIONPOINT) + { + if (finalecount < INFLECTIONPOINT+10) + V_DrawFixedPatch(x, y, scale, (finalecount-INFLECTIONPOINT)<= 3 && doexplosions) + { + INT32 boomtime = parallaxticker - sparklloop; + + x = ((((BASEVIDWIDTH-82)/2)+11)< INFLECTIONPOINT && finalecount < INFLECTIONPOINT+10) + V_DrawScaledPatch(BASEVIDWIDTH/2, BASEVIDHEIGHT/2, (finalecount-INFLECTIONPOINT)<= TICRATE && finalecount < INFLECTIONPOINT) + { + INT32 workingtime = finalecount - TICRATE; + fixed_t radius = ((vid.width/vid.dupx)*(INFLECTIONPOINT - TICRATE - workingtime))/(INFLECTIONPOINT - TICRATE); + angle_t fa; + INT32 eemeralds_cur[4]; + char patchname[7] = "CEMGx0"; + + radius <<= FRACBITS; + + for (i = 0; i < 4; ++i) + { + if (i == 1) + workingtime -= sparklloop; + else if (i) + workingtime -= SPARKLLOOPTIME; + eemeralds_cur[i] = (workingtime % 360)<>ANGLETOFINESHIFT) & FINEMASK; + x = (BASEVIDWIDTH<<(FRACBITS-1)) + FixedMul(FINECOSINE(fa),radius); + y = (BASEVIDHEIGHT<<(FRACBITS-1)) + FixedMul(FINESINE(fa),radius); + eemeralds_cur[j] += (360<>ANGLETOFINESHIFT) & FINEMASK; + x = (BASEVIDWIDTH<<(FRACBITS-1)) + FixedMul(FINECOSINE(fa),radius); + y = ((BASEVIDHEIGHT+16)<<(FRACBITS-1)) + FixedMul(FINESINE(fa),radius); + eemeralds_cur[0] += (360< 20) + + // look, i make an ending for you last-minute, the least you could do is let me have this + if (cv_soundtest.value == 413) + { + INT32 trans = 0; + boolean donttouch = false; + const char *str; + if (goodending) + str = va("[S] %s: Engage.", skins[players[consoleplayer].skin].realname); + else + str = "[S] Eggman: Abscond."; + + if (finalecount < 10) + trans = (10-finalecount)/2; + else if (finalecount > (2*INFLECTIONPOINT) - 20) + { + trans = 10 + (finalecount/2) - INFLECTIONPOINT; + donttouch = true; + } + + if (trans != 10) + { + //colset(linkmap, 164, 165, 169); -- the ideal purple colour to represent a clicked in-game link, but not worth it just for a soundtest-controlled secret + V_DrawCenteredString(BASEVIDWIDTH/2, 8, V_ALLOWLOWERCASE|(trans<'|(trans<= (2*INFLECTIONPOINT)-TICRATE) ? V_PURPLEMAP : V_BLUEMAP)|(trans<"); + } + + if (finalecount > (2*INFLECTIONPOINT)-(20+(2*TICRATE))) + { + INT32 trans2 = abs((5*FINECOSINE((FixedAngle((finalecount*5)<>ANGLETOFINESHIFT & FINEMASK)))>>FRACBITS)+2; + if (!donttouch) + { + trans = 10 + ((2*INFLECTIONPOINT)-(20+(2*TICRATE))) - finalecount; + if (trans > trans2) + trans2 = trans; + } + else + trans2 += 2*trans; + if (trans2 < 10) + V_DrawCharacter(26, BASEVIDHEIGHT-33, '\x1C'|(trans2< 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; @@ -1467,16 +2275,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) @@ -1513,6 +2335,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 @@ -1525,6 +2360,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 = thlist[THINK_MOBJ].next; th != &thlist[THINK_MOBJ]; th = th->next) + { + if (th->function.acp1 == (actionf_p1)P_RemoveThinkerDelayed) + 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; @@ -1600,12 +2481,11 @@ void F_StartContinue(void) keypressed = false; paused = false; CON_ToggleOff(); - CON_ClearHUD(); // In case menus are still up?!! M_ClearMenus(true); - S_ChangeMusicInternal("contsc", false); + S_ChangeMusicInternal("_conti", false); S_StopSounds(); timetonext = TICRATE*11; @@ -1689,7 +2569,7 @@ boolean F_ContinueResponder(event_t *event) keypressed = true; imcontinuing = true; continuetime = TICRATE; - S_StartSound(0, sfx_itemup); + S_StartSound(NULL, sfx_itemup); return true; } @@ -1697,7 +2577,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; @@ -1720,9 +2600,10 @@ static void F_AdvanceToNextScene(void) picypos = cutscenes[cutnum]->scene[scenenum].ycoord[picnum]; if (cutscenes[cutnum]->scene[scenenum].musswitch[0]) - S_ChangeMusic(cutscenes[cutnum]->scene[scenenum].musswitch, + S_ChangeMusicEx(cutscenes[cutnum]->scene[scenenum].musswitch, cutscenes[cutnum]->scene[scenenum].musswitchflags, - cutscenes[cutnum]->scene[scenenum].musicloop); + cutscenes[cutnum]->scene[scenenum].musicloop, + cutscenes[cutnum]->scene[scenenum].musswitchposition, 0, 0); // Fade to the next dofadenow = true; @@ -1765,14 +2646,15 @@ 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(); F_NewCutscene(cutscenes[cutscenenum]->scene[0].text); - CON_ClearHUD(); - cutsceneover = false; runningprecutscene = precutscene; precutresetplayer = resetplayer; @@ -1793,11 +2675,13 @@ void F_StartCustomCutscene(INT32 cutscenenum, boolean precutscene, boolean reset stoptimer = 0; if (cutscenes[cutnum]->scene[0].musswitch[0]) - S_ChangeMusic(cutscenes[cutnum]->scene[0].musswitch, + S_ChangeMusicEx(cutscenes[cutnum]->scene[0].musswitch, cutscenes[cutnum]->scene[0].musswitchflags, - cutscenes[cutnum]->scene[0].musicloop); + cutscenes[cutnum]->scene[0].musicloop, + cutscenes[cutnum]->scene[scenenum].musswitchposition, 0, 0); else S_StopMusic(); + S_StopSounds(); } // @@ -1838,7 +2722,7 @@ void F_CutsceneDrawer(void) F_RunWipe(cutscenes[cutnum]->scene[scenenum].fadeoutid, true); } - V_DrawString(textxpos, textypos, 0, cutscene_disptext); + V_DrawString(textxpos, textypos, V_ALLOWLOWERCASE, cutscene_disptext); } void F_CutsceneTicker(void) @@ -1904,3 +2788,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..d640abc8a 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,16 +34,21 @@ 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); void F_GameEvaluationTicker(void); +void F_EndingTicker(void); +void F_EndingDrawer(void); + void F_CreditTicker(void); void F_CreditDrawer(void); @@ -50,9 +56,17 @@ 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); +void F_StartEnding(void); void F_StartCredits(void); boolean F_ContinueResponder(event_t *event); @@ -60,17 +74,47 @@ 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 mobj_t *titlemapcameraref; +extern char curbgname[9]; +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 { @@ -85,6 +129,7 @@ enum wipe_evaluation_toblack, wipe_gameend_toblack, wipe_intro_toblack, + wipe_ending_toblack, wipe_cutscene_toblack, // custom intermissions @@ -101,15 +146,16 @@ enum wipe_evaluation_final, wipe_gameend_final, wipe_intro_final, + wipe_ending_final, wipe_cutscene_final, // custom intermissions wipe_specinter_final, wipe_multinter_final, - NUMWIPEDEFS + NUMWIPEDEFS, + WIPEFINALSHIFT = (wipe_level_final-wipe_level_toblack) }; -#define WIPEFINALSHIFT 13 extern UINT8 wipedefs[NUMWIPEDEFS]; #endif diff --git a/src/f_wipe.c b/src/f_wipe.c index 95dd5bbde..05229f844 100644 --- a/src/f_wipe.c +++ b/src/f_wipe.c @@ -54,6 +54,7 @@ UINT8 wipedefs[NUMWIPEDEFS] = { 0, // wipe_evaluation_toblack 0, // wipe_gameend_toblack 99, // wipe_intro_toblack (hardcoded) + 0, // wipe_ending_toblack 99, // wipe_cutscene_toblack (hardcoded) 0, // wipe_specinter_toblack @@ -69,6 +70,7 @@ UINT8 wipedefs[NUMWIPEDEFS] = { 0, // wipe_evaluation_final 0, // wipe_gameend_final 99, // wipe_intro_final (hardcoded) + 0, // wipe_ending_final 99, // wipe_cutscene_final (hardcoded) 0, // wipe_specinter_final @@ -86,7 +88,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 +147,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 +339,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 2463e7178..8f157bdd5 100644 --- a/src/filesrch.c +++ b/src/filesrch.c @@ -16,23 +16,21 @@ #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" #include "d_netfil.h" #include "m_misc.h" +#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 @@ -255,6 +253,28 @@ readdir (DIR * dirp) return (struct dirent *) 0; } +/* + * rewinddir + * + * Makes the next readdir start from the beginning. + */ +int +rewinddir (DIR * dirp) +{ + errno = 0; + + /* Check for valid DIR struct. */ + if (!dirp) + { + errno = EFAULT; + return -1; + } + + dirp->dd_stat = 0; + + return 0; +} + /* * closedir * @@ -285,68 +305,41 @@ closedir (DIR * dirp) return rc; } #endif -#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; -} -#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); - } +static CV_PossibleValue_t addons_cons_t[] = {{0, "Default"}, +#if 1 + {1, "HOME"}, {2, "SRB2"}, #endif - return FS_NOTFOUND; -} -#else + {3, "CUSTOM"}, {0, NULL}}; + +consvar_t cv_addons_option = {"addons_option", "Default", CV_SAVE|CV_CALL, addons_cons_t, Addons_option_Onchange, 0, NULL, NULL, 0, 0, NULL}; +consvar_t cv_addons_folder = {"addons_folder", "", CV_SAVE, NULL, NULL, 0, NULL, NULL, 0, 0, NULL}; + +static CV_PossibleValue_t addons_md5_cons_t[] = {{0, "Name"}, {1, "Contents"}, {0, NULL}}; +consvar_t cv_addons_md5 = {"addons_md5", "Name", CV_SAVE, addons_md5_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL}; + +consvar_t cv_addons_showall = {"addons_showall", "No", CV_SAVE, CV_YesNo, NULL, 0, NULL, NULL, 0, 0, NULL}; + +consvar_t cv_addons_search_case = {"addons_search_case", "No", CV_SAVE, CV_YesNo, NULL, 0, NULL, NULL, 0, 0, NULL}; + +static CV_PossibleValue_t addons_search_type_cons_t[] = {{0, "Start"}, {1, "Anywhere"}, {0, NULL}}; +consvar_t cv_addons_search_type = {"addons_search_type", "Anywhere", CV_SAVE, addons_search_type_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL}; + +char menupath[1024]; +size_t menupathindex[menudepth]; +size_t menudepthleft = menudepth; + +char menusearch[MAXSTRINGLENGTH+1]; + +char **dirmenu, **coredirmenu; // core only local for this file +size_t sizedirmenu, sizecoredirmenu; // ditto +size_t dir_on[menudepth]; +UINT8 refreshdirmenu = 0; +char *refreshdirname = NULL; + +size_t packetsizetally = 0; +size_t mainwadstally = 0; + filestatus_t filesearch(char *filename, const char *startpath, const UINT8 *wantedmd5sum, boolean completepath, int maxsearchdepth) { filestatus_t retval = FS_NOTFOUND; @@ -375,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 @@ -387,25 +380,29 @@ filestatus_t filesearch(char *filename, const char *startpath, const UINT8 *want { searchpath[searchpathindex[depthleft]]=0; dent = readdir(dirhandle[depthleft]); - if (dent) - strcpy(&searchpath[searchpathindex[depthleft]],dent->d_name); if (!dent) + { closedir(dirhandle[depthleft++]); - else if (dent->d_name[0]=='.' && + continue; + } + + if (dent->d_name[0]=='.' && (dent->d_name[1]=='\0' || (dent->d_name[1]=='.' && dent->d_name[2]=='\0'))) { // we don't want to scan uptree + continue; } - else if (stat(searchpath,&fsstat) < 0) // do we want to follow symlinks? if not: change it to lstat - { - // was the file (re)moved? can't stat it - } + + // okay, now we actually want searchpath to incorporate d_name + strcpy(&searchpath[searchpathindex[depthleft]],dent->d_name); + + if (stat(searchpath,&fsstat) < 0) // do we want to follow symlinks? if not: change it to lstat + ; // was the file (re)moved? can't stat it else if (S_ISDIR(fsstat.st_mode) && depthleft) { - strcpy(&searchpath[searchpathindex[depthleft]],dent->d_name); searchpathindex[--depthleft] = strlen(searchpath) + 1; dirhandle[depthleft] = opendir(searchpath); if (!dirhandle[depthleft]) @@ -415,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)) @@ -444,6 +441,363 @@ filestatus_t filesearch(char *filename, const char *startpath, const UINT8 *want free(searchname); free(searchpathindex); free(dirhandle); + return retval; } + +char exttable[NUM_EXT_TABLE][7] = { // maximum extension length (currently 4) plus 3 (null terminator, stop, and length including previous two) + "\5.txt", "\5.cfg", // exec + "\5.wad", +#ifdef USE_KART + "\6.kart", #endif + "\5.pk3", "\5.soc", "\5.lua"}; // addfile + +char filenamebuf[MAX_WADFILES][MAX_WADPATH]; + + +static boolean filemenucmp(char *haystack, char *needle) +{ + static char localhaystack[128]; + strlcpy(localhaystack, haystack, 128); + if (!cv_addons_search_case.value) + strupr(localhaystack); + if (cv_addons_search_type.value) + return (strstr(localhaystack, needle) != 0); + return (!strncmp(localhaystack, needle, menusearch[0])); +} + +void closefilemenu(boolean validsize) +{ + // search + if (dirmenu) + { + if (dirmenu != coredirmenu) + { + if (dirmenu[0] && ((UINT8)(dirmenu[0][DIR_TYPE]) == EXT_NORESULTS)) + { + Z_Free(dirmenu[0]); + dirmenu[0] = NULL; + } + Z_Free(dirmenu); + } + dirmenu = NULL; + sizedirmenu = 0; + } + + if (coredirmenu) + { + // core + if (validsize) + { + for (; sizecoredirmenu > 0; sizecoredirmenu--) + { + Z_Free(coredirmenu[sizecoredirmenu-1]); + coredirmenu[sizecoredirmenu-1] = NULL; + } + } + else + sizecoredirmenu = 0; + + Z_Free(coredirmenu); + coredirmenu = NULL; + } + + if (refreshdirname) + Z_Free(refreshdirname); + refreshdirname = NULL; +} + +void searchfilemenu(char *tempname) +{ + size_t i, first; + char localmenusearch[MAXSTRINGLENGTH] = ""; + + if (dirmenu) + { + if (dirmenu != coredirmenu) + { + if (dirmenu[0] && ((UINT8)(dirmenu[0][DIR_TYPE]) == EXT_NORESULTS)) + { + Z_Free(dirmenu[0]); + dirmenu[0] = NULL; + } + //Z_Free(dirmenu); -- Z_Realloc later tho... + } + else + dirmenu = NULL; + } + + first = (((UINT8)(coredirmenu[0][DIR_TYPE]) == EXT_UP) ? 1 : 0); // skip UP... + + if (!menusearch[0]) + { + if (dirmenu) + Z_Free(dirmenu); + dirmenu = coredirmenu; + sizedirmenu = sizecoredirmenu; + + if (tempname) + { + for (i = first; i < sizedirmenu; i++) + { + if (!strcmp(dirmenu[i]+DIR_STRING, tempname)) + { + dir_on[menudepthleft] = i; + break; + } + } + + if (i == sizedirmenu) + dir_on[menudepthleft] = first; + + Z_Free(tempname); + } + + return; + } + + strcpy(localmenusearch, menusearch+1); + if (!cv_addons_search_case.value) + strupr(localmenusearch); + + sizedirmenu = 0; + for (i = first; i < sizecoredirmenu; i++) + { + if (filemenucmp(coredirmenu[i]+DIR_STRING, localmenusearch)) + sizedirmenu++; + } + + if (!sizedirmenu) // no results... + { + if ((!(dirmenu = Z_Realloc(dirmenu, sizeof(char *), PU_STATIC, NULL))) + || !(dirmenu[0] = Z_StrDup(va("%c\13No results...", EXT_NORESULTS)))) + I_Error("searchfilemenu(): could not create \"No results...\"."); + sizedirmenu = 1; + dir_on[menudepthleft] = 0; + if (tempname) + Z_Free(tempname); + return; + } + + if (!(dirmenu = Z_Realloc(dirmenu, sizedirmenu*sizeof(char *), PU_STATIC, NULL))) + I_Error("searchfilemenu(): could not reallocate dirmenu."); + + sizedirmenu = 0; + for (i = first; i < sizecoredirmenu; i++) + { + if (filemenucmp(coredirmenu[i]+DIR_STRING, localmenusearch)) + { + if (tempname && !strcmp(coredirmenu[i]+DIR_STRING, tempname)) + { + dir_on[menudepthleft] = sizedirmenu; + Z_Free(tempname); + tempname = NULL; + } + dirmenu[sizedirmenu++] = coredirmenu[i]; // pointer reuse + } + } + + if (tempname) + { + dir_on[menudepthleft] = 0; //first; -- can't be first, causes problems + Z_Free(tempname); + } +} + +boolean preparefilemenu(boolean samedepth) +{ + DIR *dirhandle; + struct dirent *dent; + struct stat fsstat; + size_t pos = 0, folderpos = 0, numfolders = 0; + char *tempname = NULL; + + if (samedepth) + { + if (dirmenu && dirmenu[dir_on[menudepthleft]]) + tempname = Z_StrDup(dirmenu[dir_on[menudepthleft]]+DIR_STRING); // don't need to I_Error if can't make - not important, just QoL + } + else + menusearch[0] = menusearch[1] = 0; // clear search + + if (!(dirhandle = opendir(menupath))) // get directory + { + closefilemenu(true); + return false; + } + + for (; sizecoredirmenu > 0; sizecoredirmenu--) // clear out existing items + { + Z_Free(coredirmenu[sizecoredirmenu-1]); + coredirmenu[sizecoredirmenu-1] = NULL; + } + + while (true) + { + menupath[menupathindex[menudepthleft]] = 0; + dent = readdir(dirhandle); + + if (!dent) + break; + else if (dent->d_name[0]=='.' && + (dent->d_name[1]=='\0' || + (dent->d_name[1]=='.' && + dent->d_name[2]=='\0'))) + continue; // we don't want to scan uptree + + strcpy(&menupath[menupathindex[menudepthleft]],dent->d_name); + + if (stat(menupath,&fsstat) < 0) // do we want to follow symlinks? if not: change it to lstat + ; // was the file (re)moved? can't stat it + else // is a file or directory + { + if (!S_ISDIR(fsstat.st_mode)) // file + { + if (!cv_addons_showall.value) + { + size_t len = strlen(dent->d_name)+1; + UINT8 ext; + for (ext = 0; ext < NUM_EXT_TABLE; ext++) + if (!strcasecmp(exttable[ext]+1, dent->d_name+len-(exttable[ext][0]))) break; // extension comparison + if (ext == NUM_EXT_TABLE) continue; // not an addfile-able (or exec-able) file + } + } + else // directory + numfolders++; + + sizecoredirmenu++; + } + } + + if (!sizecoredirmenu) + { + closedir(dirhandle); + closefilemenu(false); + if (tempname) + Z_Free(tempname); + return false; + } + + if (menudepthleft != menudepth-1) // Make room for UP... + { + sizecoredirmenu++; + numfolders++; + folderpos++; + } + + if (dirmenu && dirmenu == coredirmenu) + dirmenu = NULL; + + if (!(coredirmenu = Z_Realloc(coredirmenu, sizecoredirmenu*sizeof(char *), PU_STATIC, NULL))) + { + closedir(dirhandle); // just in case + I_Error("preparefilemenu(): could not reallocate coredirmenu."); + } + + rewinddir(dirhandle); + + while ((pos+folderpos) < sizecoredirmenu) + { + menupath[menupathindex[menudepthleft]] = 0; + dent = readdir(dirhandle); + + if (!dent) + break; + else if (dent->d_name[0]=='.' && + (dent->d_name[1]=='\0' || + (dent->d_name[1]=='.' && + dent->d_name[2]=='\0'))) + continue; // we don't want to scan uptree + + strcpy(&menupath[menupathindex[menudepthleft]],dent->d_name); + + if (stat(menupath,&fsstat) < 0) // do we want to follow symlinks? if not: change it to lstat + ; // was the file (re)moved? can't stat it + else // is a file or directory + { + char *temp; + size_t len = strlen(dent->d_name)+1; + UINT8 ext = EXT_FOLDER; + UINT8 folder; + + if (!S_ISDIR(fsstat.st_mode)) // file + { + if (!((numfolders+pos) < sizecoredirmenu)) continue; // crash prevention + for (; ext < NUM_EXT_TABLE; ext++) + if (!strcasecmp(exttable[ext]+1, dent->d_name+len-(exttable[ext][0]))) break; // extension comparison + if (ext == NUM_EXT_TABLE && !cv_addons_showall.value) continue; // not an addfile-able (or exec-able) file + ext += EXT_START; // moving to be appropriate position + + if (ext >= EXT_LOADSTART) + { + size_t i; + for (i = 0; i < numwadfiles; i++) + { + if (!filenamebuf[i][0]) + { + strncpy(filenamebuf[i], wadfiles[i]->filename, MAX_WADPATH); + filenamebuf[i][MAX_WADPATH - 1] = '\0'; + nameonly(filenamebuf[i]); + } + + if (strcmp(dent->d_name, filenamebuf[i])) + continue; + if (cv_addons_md5.value && !checkfilemd5(menupath, wadfiles[i]->md5sum)) + continue; + + ext |= EXT_LOADED; + } + } + else if (ext == EXT_TXT) + { + if (!strcmp(dent->d_name, "log.txt") || !strcmp(dent->d_name, "errorlog.txt")) + ext |= EXT_LOADED; + } + + if (!strcmp(dent->d_name, configfile)) + ext |= EXT_LOADED; + + folder = 0; + } + else // directory + len += (folder = 1); + + if (len > 255) + len = 255; + + if (!(temp = Z_Malloc((len+DIR_STRING+folder) * sizeof (char), PU_STATIC, NULL))) + I_Error("preparefilemenu(): could not create file entry."); + temp[DIR_TYPE] = ext; + temp[DIR_LEN] = (UINT8)(len); + strlcpy(temp+DIR_STRING, dent->d_name, len); + if (folder) + { + strcpy(temp+len, PATHSEP); + coredirmenu[folderpos++] = temp; + } + else + coredirmenu[numfolders + pos++] = temp; + } + } + + closedir(dirhandle); + + if ((menudepthleft != menudepth-1) // now for UP... entry + && !(coredirmenu[0] = Z_StrDup(va("%c\5UP...", EXT_UP)))) + I_Error("preparefilemenu(): could not create \"UP...\"."); + + menupath[menupathindex[menudepthleft]] = 0; + sizecoredirmenu = (numfolders+pos); // just in case things shrink between opening and rewind + + if (!sizecoredirmenu) + { + dir_on[menudepthleft] = 0; + closefilemenu(false); + return false; + } + + searchfilemenu(tempname); + + return true; +} diff --git a/src/filesrch.h b/src/filesrch.h index 33b148d4b..4186271b0 100644 --- a/src/filesrch.h +++ b/src/filesrch.h @@ -6,6 +6,9 @@ #include "doomdef.h" #include "d_netfil.h" +#include "m_menu.h" // MAXSTRINGLENGTH + +extern consvar_t cv_addons_option, cv_addons_folder, cv_addons_md5, cv_addons_showall, cv_addons_search_case, cv_addons_search_type; /** \brief The filesearch function @@ -25,4 +28,71 @@ filestatus_t filesearch(char *filename, const char *startpath, const UINT8 *wantedmd5sum, boolean completepath, int maxsearchdepth); +#define menudepth 20 + +extern char menupath[1024]; +extern size_t menupathindex[menudepth]; +extern size_t menudepthleft; + +extern char menusearch[MAXSTRINGLENGTH+1]; + +extern char **dirmenu; +extern size_t sizedirmenu; +extern size_t dir_on[menudepth]; +extern UINT8 refreshdirmenu; +extern char *refreshdirname; + +extern size_t packetsizetally; +extern size_t mainwadstally; + +typedef enum +{ + EXT_FOLDER = 0, + EXT_UP, + EXT_NORESULTS, + EXT_START, + EXT_TXT = EXT_START, + EXT_CFG, + EXT_LOADSTART, + EXT_WAD = EXT_LOADSTART, +#ifdef USE_KART + EXT_KART, +#endif + EXT_PK3, + EXT_SOC, + EXT_LUA, // allowed even if not HAVE_BLUA so that we can yell on load attempt + NUM_EXT, + NUM_EXT_TABLE = NUM_EXT-EXT_START, + EXT_LOADED = 0x80 + /* + obviously there can only be 0x7F supported extensions in + addons menu because we're cramming this into a char out of + laziness/easy memory allocation (what's the difference?) + and have stolen a bit to show whether it's loaded or not + in practice the size of the data type is probably overkill + toast 02/05/17 + */ +} ext_enum; + +typedef enum +{ + DIR_TYPE = 0, + DIR_LEN, + DIR_STRING +} dirname_enum; + +typedef enum +{ + REFRESHDIR_NORMAL = 1, + REFRESHDIR_ADDFILE = 2, + REFRESHDIR_WARNING = 4, + REFRESHDIR_ERROR = 8, + REFRESHDIR_NOTLOADED = 16, + REFRESHDIR_MAX = 32 +} refreshdir_enum; + +void closefilemenu(boolean validsize); +void searchfilemenu(char *tempname); +boolean preparefilemenu(boolean samedepth); + #endif // __FILESRCH_H__ diff --git a/src/g_game.c b/src/g_game.c index 5cc78d4b6..d5faf6846 100644 --- a/src/g_game.c +++ b/src/g_game.c @@ -15,6 +15,7 @@ #include "console.h" #include "d_main.h" #include "d_player.h" +#include "d_clisrv.h" #include "f_finale.h" #include "p_setup.h" #include "p_saveg.h" @@ -71,15 +72,20 @@ static void G_DoWorldDone(void); char mapmusname[7]; // Music name UINT16 mapmusflags; // Track and reset bit +UINT32 mapmusposition; // Position to jump to 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; @@ -88,9 +94,10 @@ UINT8 modeattacking = ATTACKING_NONE; boolean disableSpeedAdjust = false; boolean imcontinuing = false; boolean runemeraldmanager = false; +UINT16 emeraldspawndelay = 60*TICRATE; // menu demo things -UINT8 numDemos = 3; +UINT8 numDemos = 0; UINT32 demoDelayTime = 15*TICRATE; UINT32 demoIdleTime = 3*TICRATE; @@ -111,29 +118,41 @@ 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; +UINT8 skipstats; // Pointers to each CTF flag mobj_t *redflag; @@ -155,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 @@ -193,9 +213,12 @@ 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; +UINT8 ammoremovaltics = 2*TICRATE; + UINT8 use1upSound = 0; UINT8 maxXtraLife = 2; // Max extra lives from rings @@ -238,7 +261,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; @@ -283,48 +306,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 @@ -333,39 +324,67 @@ 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. + +// it automatically becomes compact with 20+ players, but if you like it, I guess you can turn that on! +consvar_t cv_compactscoreboard= {"compactscoreboard", "Off", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL}; + +// chat timer thingy +static CV_PossibleValue_t chattime_cons_t[] = {{5, "MIN"}, {999, "MAX"}, {0, NULL}}; +consvar_t cv_chattime = {"chattime", "8", CV_SAVE, chattime_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL}; + +// chatwidth +static CV_PossibleValue_t chatwidth_cons_t[] = {{64, "MIN"}, {150, "MAX"}, {0, NULL}}; +consvar_t cv_chatwidth = {"chatwidth", "128", CV_SAVE, chatwidth_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL}; + +// chatheight +static CV_PossibleValue_t chatheight_cons_t[] = {{6, "MIN"}, {22, "MAX"}, {0, NULL}}; +consvar_t cv_chatheight= {"chatheight", "8", CV_SAVE, chatheight_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL}; + +// chat notifications (do you want to hear beeps? I'd understand if you didn't.) +consvar_t cv_chatnotifications= {"chatnotifications", "On", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL}; + +// chat spam protection (why would you want to disable that???) +consvar_t cv_chatspamprotection= {"chatspamprotection", "On", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL}; + +// minichat text background +consvar_t cv_chatbacktint = {"chatbacktint", "On", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL}; + +// old shit console chat. (mostly exists for stuff like terminal, not because I cared if anyone liked the old chat.) +static CV_PossibleValue_t consolechat_cons_t[] = {{0, "Window"}, {1, "Console"}, {2, "Window (Hidden)"}, {0, NULL}}; +consvar_t cv_consolechat = {"chatmode", "Window", CV_SAVE, consolechat_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL}; + 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 { @@ -375,116 +394,37 @@ typedef enum AXISLOOK, AXISSTRAFE, AXISDEAD, //Axises that don't want deadzones + AXISJUMP, + AXISSPIN, AXISFIRE, 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_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_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" -#endif #ifdef SEENAMES player_t *seenplayer; // player we're aiming at right now #endif -char player_names[MAXPLAYERS][MAXPLAYERNAME+1] = -{ - "Player 1", - "Player 2", - "Player 3", - "Player 4", - "Player 5", - "Player 6", - "Player 7", - "Player 8", - "Player 9", - "Player 10", - "Player 11", - "Player 12", - "Player 13", - "Player 14", - "Player 15", - "Player 16", - "Player 17", - "Player 18", - "Player 19", - "Player 20", - "Player 21", - "Player 22", - "Player 23", - "Player 24", - "Player 25", - "Player 26", - "Player 27", - "Player 28", - "Player 29", - "Player 30", - "Player 31", - "Player 32" -}; +// now automatically allocated in D_RegisterClientCommands +// so that it doesn't have to be updated depending on the value of MAXPLAYERS +char player_names[MAXPLAYERS][MAXPLAYERNAME+1]; INT16 rw_maximums[NUM_WEAPONS] = { @@ -698,8 +638,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. @@ -804,6 +743,12 @@ static INT32 JoyAxis(axis_input_e axissel) case AXISSTRAFE: axisval = cv_sideaxis.value; break; + case AXISJUMP: + axisval = cv_jumpaxis.value; + break; + case AXISSPIN: + axisval = cv_spinaxis.value; + break; case AXISFIRE: axisval = cv_fireaxis.value; break; @@ -819,14 +764,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; @@ -842,10 +779,6 @@ static INT32 JoyAxis(axis_input_e axissel) retaxis = joyymove[axisval]; } -#ifdef _arch_dreamcast - skipDC: -#endif - if (retaxis < (-JOYAXISRANGE)) retaxis = -JOYAXISRANGE; if (retaxis > (+JOYAXISRANGE)) @@ -881,6 +814,12 @@ static INT32 Joy2Axis(axis_input_e axissel) case AXISSTRAFE: axisval = cv_sideaxis2.value; break; + case AXISJUMP: + axisval = cv_jumpaxis2.value; + break; + case AXISSPIN: + axisval = cv_spinaxis2.value; + break; case AXISFIRE: axisval = cv_fireaxis2.value; break; @@ -897,14 +836,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; @@ -920,10 +852,6 @@ static INT32 Joy2Axis(axis_input_e axissel) retaxis = joy2ymove[axisval]; } -#ifdef _arch_dreamcast - skipDC: -#endif - if (retaxis < (-JOYAXISRANGE)) retaxis = -JOYAXISRANGE; if (retaxis > (+JOYAXISRANGE)) @@ -957,10 +885,10 @@ static fixed_t angleturn[3] = {640, 1280, 320}; // + slow turn void G_BuildTiccmd(ticcmd_t *cmd, INT32 realtics) { boolean forcestrafe = false; - INT32 tspeed, forward, side, axis, i; + 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; @@ -973,7 +901,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); @@ -982,6 +912,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; @@ -1022,14 +958,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]; @@ -1042,6 +977,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) @@ -1072,9 +1014,14 @@ void G_BuildTiccmd(ticcmd_t *cmd, INT32 realtics) // forward with key or button axis = JoyAxis(AXISMOVE); - if (PLAYER1INPUTDOWN(gc_forward) || (gamepadjoystickmove && axis < 0)) + altaxis = JoyAxis(AXISLOOK); + 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)) + if (movebkey || (gamepadjoystickmove && axis > 0) + || ((player->powers[pw_carry] == CR_NIGHTSMODE) + && (PLAYER1INPUTDOWN(gc_lookdown) || (gamepadjoystickmove && altaxis > 0)))) forward -= forwardmove[speed]; if (analogjoystickmove && axis != 0) @@ -1082,9 +1029,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)) @@ -1126,18 +1073,10 @@ void G_BuildTiccmd(ticcmd_t *cmd, INT32 realtics) cmd->buttons |= BT_CUSTOM3; // use with any button/key - if (PLAYER1INPUTDOWN(gc_use)) + axis = JoyAxis(AXISSPIN); + 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) @@ -1148,7 +1087,8 @@ void G_BuildTiccmd(ticcmd_t *cmd, INT32 realtics) resetdown = false; // jump button - if (PLAYER1INPUTDOWN(gc_jump)) + axis = JoyAxis(AXISJUMP); + if (PLAYER1INPUTDOWN(gc_jump) || (cv_usejoystick.value && axis > 0)) cmd->buttons |= BT_JUMP; // player aiming shit, ahhhh... @@ -1176,18 +1116,21 @@ void G_BuildTiccmd(ticcmd_t *cmd, INT32 realtics) if (!keyboard_look && cv_lookaxis.value == 0 && !joyaiming && !mouseaiming) localaiming = 0; - if (PLAYER1INPUTDOWN(gc_lookup) || (gamepadjoystickmove && axis < 0)) + if (!(player->powers[pw_carry] == CR_NIGHTSMODE)) { - localaiming += KB_LOOKSPEED * screen_invert; - keyboard_look = true; + if (PLAYER1INPUTDOWN(gc_lookup) || (gamepadjoystickmove && axis < 0)) + { + localaiming += KB_LOOKSPEED * screen_invert; + keyboard_look = true; + } + else if (PLAYER1INPUTDOWN(gc_lookdown) || (gamepadjoystickmove && axis > 0)) + { + localaiming -= KB_LOOKSPEED * screen_invert; + keyboard_look = true; + } + else if (PLAYER1INPUTDOWN(gc_centerview)) + localaiming = 0; } - else if (PLAYER1INPUTDOWN(gc_lookdown) || (gamepadjoystickmove && axis > 0)) - { - localaiming -= KB_LOOKSPEED * screen_invert; - keyboard_look = true; - } - else if (PLAYER1INPUTDOWN(gc_centerview)) - localaiming = 0; // accept no mlook for network games if (!cv_allowmlook.value) @@ -1199,10 +1142,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)); @@ -1219,7 +1171,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); @@ -1237,9 +1190,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 { @@ -1257,10 +1211,10 @@ void G_BuildTiccmd(ticcmd_t *cmd, INT32 realtics) void G_BuildTiccmd2(ticcmd_t *cmd, INT32 realtics) { boolean forcestrafe = false; - INT32 tspeed, forward, side, axis, i; + 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); @@ -1282,6 +1236,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; @@ -1322,12 +1282,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 { @@ -1342,6 +1301,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) @@ -1372,9 +1338,14 @@ void G_BuildTiccmd2(ticcmd_t *cmd, INT32 realtics) // forward with key or button axis = Joy2Axis(AXISMOVE); - if (PLAYER2INPUTDOWN(gc_forward) || (gamepadjoystickmove && axis < 0)) + altaxis = Joy2Axis(AXISLOOK); + 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)) + if (movebkey || (gamepadjoystickmove && axis > 0) + || ((player->powers[pw_carry] == CR_NIGHTSMODE) + && (PLAYER2INPUTDOWN(gc_lookdown) || (gamepadjoystickmove && altaxis > 0)))) forward -= forwardmove[speed]; if (analogjoystickmove && axis != 0) @@ -1382,9 +1353,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)) @@ -1423,18 +1394,10 @@ void G_BuildTiccmd2(ticcmd_t *cmd, INT32 realtics) cmd->buttons |= BT_CUSTOM3; // use with any button/key - if (PLAYER2INPUTDOWN(gc_use)) + axis = Joy2Axis(AXISSPIN); + 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) @@ -1445,7 +1408,8 @@ void G_BuildTiccmd2(ticcmd_t *cmd, INT32 realtics) resetdown = false; // jump button - if (PLAYER2INPUTDOWN(gc_jump)) + axis = Joy2Axis(AXISJUMP); + if (PLAYER2INPUTDOWN(gc_jump) || (cv_usejoystick2.value && axis > 0)) cmd->buttons |= BT_JUMP; // player aiming shit, ahhhh... @@ -1473,18 +1437,21 @@ void G_BuildTiccmd2(ticcmd_t *cmd, INT32 realtics) if (!keyboard_look && cv_lookaxis2.value == 0 && !joyaiming && !mouseaiming) localaiming2 = 0; - if (PLAYER2INPUTDOWN(gc_lookup) || (gamepadjoystickmove && axis < 0)) + if (!(player->powers[pw_carry] == CR_NIGHTSMODE)) { - localaiming2 += KB_LOOKSPEED * screen_invert; - keyboard_look = true; + if (PLAYER2INPUTDOWN(gc_lookup) || (gamepadjoystickmove && axis < 0)) + { + localaiming2 += KB_LOOKSPEED * screen_invert; + keyboard_look = true; + } + else if (PLAYER2INPUTDOWN(gc_lookdown) || (gamepadjoystickmove && axis > 0)) + { + localaiming2 -= KB_LOOKSPEED * screen_invert; + keyboard_look = true; + } + else if (PLAYER2INPUTDOWN(gc_centerview)) + localaiming2 = 0; } - else if (PLAYER2INPUTDOWN(gc_lookdown) || (gamepadjoystickmove && axis > 0)) - { - localaiming2 -= KB_LOOKSPEED * screen_invert; - keyboard_look = true; - } - else if (PLAYER2INPUTDOWN(gc_centerview)) - localaiming2 = 0; // accept no mlook for network games if (!cv_allowmlook.value) @@ -1496,9 +1463,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)); @@ -1515,7 +1492,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); @@ -1546,9 +1524,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 { @@ -1585,11 +1564,6 @@ static void Analog_OnChange(void) // cameras are not initialized at this point - if (leveltime > 1) - CV_SetValue(&cv_cam_dist, 128); - if (cv_analog.value || demoplayback) - CV_SetValue(&cv_cam_dist, 192); - if (!cv_chasecam.value && cv_analog.value) { CV_SetValue(&cv_analog, 0); return; @@ -1605,11 +1579,6 @@ static void Analog2_OnChange(void) // cameras are not initialized at this point - if (leveltime > 1) - CV_SetValue(&cv_cam2_dist, 128); - if (cv_analog2.value) - CV_SetValue(&cv_cam2_dist, 192); - if (!cv_chasecam2.value && cv_analog2.value) { CV_SetValue(&cv_analog2, 0); return; @@ -1618,6 +1587,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 // @@ -1627,6 +1616,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 @@ -1636,6 +1626,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++) @@ -1645,7 +1650,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(); @@ -1683,7 +1688,8 @@ void G_DoLoadLevel(boolean resetplayer) CON_ClearHUD(); } -static INT32 pausedelay = 0; +INT32 pausedelay = 0; +boolean pausebreakkey = false; static INT32 camtoggledelay, camtoggledelay2 = 0; // @@ -1802,29 +1808,28 @@ boolean G_Responder(event_t *ev) return true; } } - - else if (gamestate == GS_CREDITS) + else if (gamestate == GS_CREDITS || gamestate == GS_ENDING) // todo: keep ending here? { if (HU_Responder(ev)) return true; // chat ate the event if (F_CreditResponder(ev)) { - F_StartGameEvaluation(); + // Skip credits for everyone + if (!netgame || server || IsPlayerAdmin(consoleplayer)) + SendNetXCmd(XD_EXITLEVEL, NULL, 0); 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 @@ -1838,17 +1843,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]) @@ -1908,11 +1928,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++) @@ -1950,6 +1978,7 @@ void G_Ticker(boolean run) F_TitleDemoTicker(); P_Ticker(run); // tic the game ST_Ticker(); + F_TextPromptTicker(); AM_Ticker(); HU_Ticker(); break; @@ -1961,6 +1990,7 @@ void G_Ticker(boolean run) break; case GS_TIMEATTACK: + F_MenuPresTicker(run); break; case GS_INTRO: @@ -1968,6 +1998,12 @@ void G_Ticker(boolean run) F_IntroTicker(); break; + case GS_ENDING: + if (run) + F_EndingTicker(); + HU_Ticker(); + break; + case GS_CUTSCENE: if (run) F_CutsceneTicker(); @@ -1982,6 +2018,7 @@ void G_Ticker(boolean run) case GS_EVALUATION: if (run) F_GameEvaluationTicker(); + HU_Ticker(); break; case GS_CONTINUING: @@ -1996,7 +2033,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; @@ -2007,8 +2047,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--; @@ -2059,6 +2104,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; @@ -2071,6 +2118,7 @@ void G_PlayerReborn(INT32 player) UINT32 thokitem; UINT32 spinitem; UINT32 revitem; + UINT32 followitem; fixed_t actionspd; fixed_t mindash; fixed_t maxdash; @@ -2082,6 +2130,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; @@ -2089,8 +2139,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; @@ -2101,7 +2153,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)) @@ -2113,6 +2166,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; @@ -2129,9 +2185,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; @@ -2150,10 +2209,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; @@ -2165,6 +2228,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; @@ -2176,6 +2240,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; @@ -2193,11 +2259,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) { @@ -2205,9 +2271,14 @@ void G_PlayerReborn(INT32 player) { strncpy(mapmusname, mapheaderinfo[gamemap-1]->musname, 7); mapmusname[6] = 0; - mapmusflags = mapheaderinfo[gamemap-1]->mustrack & MUSIC_TRACKMASK; + mapmusflags = (mapheaderinfo[gamemap-1]->mustrack & MUSIC_TRACKMASK); + mapmusposition = mapheaderinfo[gamemap-1]->muspos; } - S_ChangeMusic(mapmusname, mapmusflags, true); + + // This is in S_Start, but this was not here previously. + // if (cv_resetmusic.value) + // S_StopMusic(); + S_ChangeMusicEx(mapmusname, mapmusflags, true, mapmusposition, 0, 0); } if (gametype == GT_COOP) @@ -2224,6 +2295,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()) { @@ -2297,6 +2370,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); @@ -2462,9 +2537,9 @@ void G_ChangePlayerReferences(mobj_t *oldmo, mobj_t *newmo) I_Assert((oldmo != NULL) && (newmo != NULL)); // scan all thinkers - for (th = thinkercap.next; th != &thinkercap; th = th->next) + for (th = thlist[THINK_MOBJ].next; th != &thlist[THINK_MOBJ]; th = th->next) { - if (th->function.acp1 != (actionf_p1)P_MobjThinker) + if (th->function.acp1 == (actionf_p1)P_RemoveThinkerDelayed) continue; mo2 = (mobj_t *)th; @@ -2486,7 +2561,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) { @@ -2512,35 +2588,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 = 2; + + 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) @@ -2548,7 +2687,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; @@ -2560,12 +2699,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 @@ -2574,6 +2725,7 @@ void G_DoReborn(INT32 playernum) LUAh_MapChange(gamemap); #endif G_DoLoadLevel(true); + return; } } else @@ -2581,8 +2733,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) @@ -2592,7 +2747,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); } @@ -2600,10 +2755,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) @@ -2627,6 +2821,46 @@ void G_ExitLevel(void) // Remove CEcho text on round end. HU_ClearCEcho(); } + else if (gamestate == GS_ENDING) + { + F_StartCredits(); + } + else if (gamestate == GS_CREDITS) + { + F_StartGameEvaluation(); + } +} + +// See also the enum GameType in doomstat.h +const char *Gametype_Names[NUMGAMETYPES] = +{ + "Co-op", // GT_COOP + "Competition", // GT_COMPETITION + "Race", // GT_RACE + + "Match", // GT_MATCH + "Team Match", // GT_TEAMMATCH + + "Tag", // GT_TAG + "Hide & Seek", // GT_HIDEANDSEEK + + "CTF" // GT_CTF +}; + +// +// G_GetGametypeByName +// +// Returns the number for the given gametype name string, or -1 if not valid. +// +INT32 G_GetGametypeByName(const char *gametypestr) +{ + INT32 i; + + for (i = 0; i < NUMGAMETYPES; i++) + if (!stricmp(gametypestr, Gametype_Names[i])) + return i; + + return -1; // unknown gametype } // @@ -2637,7 +2871,11 @@ void G_ExitLevel(void) // 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; @@ -2773,10 +3011,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) @@ -2852,33 +3092,25 @@ static void G_DoCompleted(void) nextmap = cm; } - if (nextmap < 0 || (nextmap >= NUMMAPS && nextmap < 1100-1) || nextmap > 1102-1) + if (nextmap < 0 || (nextmap >= NUMMAPS && nextmap < 1100-1) || nextmap > 1103-1) I_Error("Followed map %d to invalid map %d\n", prevmap + 1, nextmap + 1); // wrap around in race 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<cutscenenum && !modeattacking) // Start a custom cutscene. + if (mapheaderinfo[gamemap-1]->cutscenenum && !modeattacking && skipstats <= 1) // Start a custom cutscene. F_StartCustomCutscene(mapheaderinfo[gamemap-1]->cutscenenum-1, false, false); else { @@ -2999,8 +3231,11 @@ static void G_DoContinued(void) tokenlist = 0; token = 0; + if (!(netgame || multiplayer || demoplayback || demorecording || metalrecording || modeattacking) && (!modifiedgame || savemoddata) && cursaveslot > 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); @@ -3023,6 +3258,11 @@ void G_EndGame(void) // Only do evaluation and credits in coop games. if (gametype == GT_COOP) { + if (nextmap == 1103-1) // end game with ending + { + F_StartEnding(); + return; + } if (nextmap == 1102-1) // end game with credits { F_StartCredits(); @@ -3048,8 +3288,10 @@ void G_LoadGameSettings(void) // defaults spstage_start = 1; sstage_start = 50; - sstage_end = 57; // 8 special stages in vanilla SRB2 - useNightsSS = false; //true; + sstage_end = 56; // 7 special stages in vanilla SRB2 + sstage_end++; // plus one weirdo + smpstage_start = 60; + smpstage_end = 66; // 7 multiplayer special stages too // initialize free sfx slots for skin sounds S_InitRuntimeSounds(); @@ -3254,7 +3496,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;) @@ -3339,59 +3581,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. @@ -3484,17 +3673,17 @@ 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! - if (gamestate == GS_CREDITS || gamestate == GS_EVALUATION) + if (gamestate == GS_ENDING || gamestate == GS_CREDITS || gamestate == GS_EVALUATION) gamecomplete = true; gameaction = ga_nothing; @@ -3526,9 +3715,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, @@ -3536,7 +3807,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) @@ -3548,10 +3819,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) { @@ -3559,8 +3828,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); @@ -3573,7 +3841,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; @@ -3592,8 +3860,8 @@ 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; - countdown = countdown2 = 0; + numgameovers = tokenlist = token = sstimer = redscore = bluescore = lastmap = 0; + countdown = countdown2 = exitfadestarted = 0; for (i = 0; i < MAXPLAYERS; i++) { @@ -3603,34 +3871,33 @@ 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 unlocktriggers = 0; // clear itemfinder, just in case - if (!dedicated) // except in dedicated servers, where it is not registered and can actually I_Error debug builds + if (!dedicated) // except in dedicated servers, where it is not registered and can actually I_Error debug builds CV_StealthSetValue(&cv_itemfinder, 0); } @@ -3685,6 +3952,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; @@ -3714,7 +3984,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! @@ -3739,9 +4009,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 @@ -3753,6 +4024,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; @@ -3945,21 +4217,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) @@ -4013,27 +4276,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; } @@ -4063,7 +4332,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); @@ -4076,15 +4345,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) // bloats tails runs but what can ya do + { + 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; @@ -4098,7 +4384,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; @@ -4130,23 +4415,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; @@ -4160,7 +4441,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); @@ -4169,28 +4450,37 @@ void G_ConsGhostTic(void) demo_p += sizeof(angle_t); // angle, unnecessary for cons. mobj = NULL; - for (th = thinkercap.next; th != &thinkercap; th = th->next) + for (th = thlist[THINK_MOBJ].next; th != &thlist[THINK_MOBJ]; th = th->next) { - if (th->function.acp1 != (actionf_p1)P_MobjThinker) + if (th->function.acp1 == (actionf_p1)P_RemoveThinkerDelayed) continue; mobj = (mobj_t *)th; if (mobj->type == (mobjtype_t)type && mobj->x == x && mobj->y == y && mobj->z == z) break; - mobj = NULL; // wasn't this one, keep searching. } - if (mobj && mobj->health != health) // Wasn't damaged?! This is desync! Fix it! + if (th != &thlist[THINK_MOBJ] && mobj->health != health) // Wasn't damaged?! This is desync! Fix it! { 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; @@ -4199,7 +4489,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")); @@ -4227,6 +4517,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) @@ -4260,9 +4551,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); @@ -4270,18 +4563,21 @@ 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) { default: + case GHC_RETURNSKIN: + g->mo->skin = g->oldmo.skin; + // fallthru case GHC_NORMAL: // Go back to skin color g->mo->color = g->oldmo.color; break; @@ -4292,24 +4588,27 @@ void G_GhostTicker(void) case GHC_FIREFLOWER: // Fireflower g->mo->color = SKINCOLOR_WHITE; break; + case GHC_NIGHTSSKIN: // not actually a colour + g->mo->skin = &skins[DEFAULTNIGHTSSKIN]; + 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; @@ -4350,7 +4649,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; @@ -4359,7 +4658,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); @@ -4377,24 +4676,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) { @@ -4442,9 +4795,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. @@ -4456,7 +4811,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! @@ -4571,11 +4925,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. @@ -4734,12 +5088,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)); @@ -4753,7 +5132,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) @@ -4786,7 +5165,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) @@ -4886,8 +5265,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: @@ -4963,8 +5340,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'; @@ -5026,8 +5404,6 @@ void G_DoPlayDemo(char *defdemoname) switch(demoversion) { case DEMOVERSION: // latest always supported - // compatibility available? - case 0x0008: break; // too old, cannot support. default: @@ -5053,10 +5429,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); @@ -5110,7 +5483,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; @@ -5408,6 +5805,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); } @@ -5448,16 +5851,18 @@ void G_DoPlayMetal(void) metalbuffer = metal_p = W_CacheLumpNum(l, PU_STATIC); // find metal sonic - for (th = thinkercap.next; th != &thinkercap; th = th->next) + for (th = thlist[THINK_MOBJ].next; th != &thlist[THINK_MOBJ]; th = th->next) { - if (th->function.acp1 != (actionf_p1)P_MobjThinker) + if (th->function.acp1 == (actionf_p1)P_RemoveThinkerDelayed) continue; mo = (mobj_t *)th; - if (mo->type == MT_METALSONIC_RACE) - break; + if (mo->type != MT_METALSONIC_RACE) + continue; + + break; } - if (!mo) + if (th == &thlist[THINK_MOBJ]) { CONS_Alert(CONS_ERROR, M_GetText("Failed to find bot entity.\n")); Z_Free(metalbuffer); @@ -5472,8 +5877,6 @@ void G_DoPlayMetal(void) switch(metalversion) { case DEMOVERSION: // latest always supported - // compatibility available? - case 0x0008: break; // too old, cannot support. default: @@ -5494,7 +5897,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 891e7b3ee..e161bc8ed 100644 --- a/src/g_game.h +++ b/src/g_game.h @@ -41,6 +41,7 @@ extern boolean demoplayback, titledemo, demorecording, timingdemo; // Quit after playing a demo from cmdline. extern boolean singledemo; extern boolean demo_start; +extern boolean demosynced; extern mobj_t *metalplayback; @@ -50,17 +51,26 @@ extern tic_t levelstarttic; // for modding? extern INT16 prevmap, nextmap; extern INT32 gameovertics; +extern UINT8 ammoremovaltics; 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; + +extern boolean promptactive; // 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_sideaxis,cv_turnaxis,cv_moveaxis,cv_lookaxis,cv_fireaxis,cv_firenaxis; -extern consvar_t cv_sideaxis2,cv_turnaxis2,cv_moveaxis2,cv_lookaxis2,cv_fireaxis2,cv_firenaxis2; +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; // mouseaiming (looking up/down with the mouse or keyboard) @@ -92,7 +102,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 @@ -116,6 +126,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); @@ -131,7 +143,9 @@ typedef enum GHC_NORMAL = 0, GHC_SUPER, GHC_FIREFLOWER, - GHC_INVINCIBLE + GHC_INVINCIBLE, + GHC_NIGHTSSKIN, // not actually a colour + GHC_RETURNSKIN // ditto } ghostcolor_t; // Record/playback tics @@ -162,6 +176,7 @@ ATTRNORETURN void FUNCNORETURN G_StopMetalRecording(void); void G_StopDemo(void); boolean G_CheckDemoStatus(void); +INT32 G_GetGametypeByName(const char *gametypestr); boolean G_IsSpecialStage(INT32 mapnum); boolean G_GametypeUsesLives(void); boolean G_GametypeHasTeams(void); diff --git a/src/g_input.c b/src/g_input.c index 44d9f2b28..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 { @@ -98,6 +140,8 @@ void G_MapEventsToControls(event_t *ev) break; case ev_mouse: // buttons are virtual keys + if (menuactive || CON_Ready() || chat_on) + break; mousex = (INT32)(ev->data2*((cv_mousesens.value*cv_mousesens.value)/110.0f + 0.1f)); mousey = (INT32)(ev->data3*((cv_mousesens.value*cv_mousesens.value)/110.0f + 0.1f)); mlooky = (INT32)(ev->data3*((cv_mouseysens.value*cv_mousesens.value)/110.0f + 0.1f)); @@ -105,7 +149,7 @@ void G_MapEventsToControls(event_t *ev) case ev_joystick: // buttons are virtual keys i = ev->data1; - if (i >= JOYAXISSET) + if (i >= JOYAXISSET || menuactive || CON_Ready() || chat_on) break; if (ev->data2 != INT32_MAX) joyxmove[i] = ev->data2; if (ev->data3 != INT32_MAX) joyymove[i] = ev->data3; @@ -113,13 +157,15 @@ void G_MapEventsToControls(event_t *ev) case ev_joystick2: // buttons are virtual keys i = ev->data1; - if (i >= JOYAXISSET) + if (i >= JOYAXISSET || menuactive || CON_Ready() || chat_on) break; if (ev->data2 != INT32_MAX) joy2xmove[i] = ev->data2; if (ev->data3 != INT32_MAX) joy2ymove[i] = ev->data3; break; case ev_mouse2: // buttons are virtual keys + if (menuactive || CON_Ready() || chat_on) + break; mouse2x = (INT32)(ev->data2*((cv_mousesens2.value*cv_mousesens2.value)/110.0f + 0.1f)); mouse2y = (INT32)(ev->data3*((cv_mousesens2.value*cv_mousesens2.value)/110.0f + 0.1f)); mlook2y = (INT32)(ev->data3*((cv_mouseysens2.value*cv_mousesens2.value)/110.0f + 0.1f)); @@ -204,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"}, @@ -270,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"}, @@ -413,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"}, @@ -445,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"}, @@ -459,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"}, @@ -603,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"}, @@ -634,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"}, @@ -648,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"}, @@ -751,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"}, @@ -784,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"}, @@ -798,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"}, @@ -901,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"}, @@ -932,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"}, @@ -946,8 +556,6 @@ static keyname_t keynames[] = {KEY_DBL2HAT1+13, "DBLSEC_HATDOWN4"}, {KEY_DBL2HAT1+14, "DBLSEC_HATLEFT4"}, {KEY_DBL2HAT1+15, "DBLSEC_HATRIGHT4"}, -#endif -#endif }; @@ -977,8 +585,6 @@ static const char *gamecontrolname[num_gamecontrols] = "tossflag", "use", "camtoggle", - "camleft", - "camright", "camreset", "lookup", "lookdown", @@ -1010,6 +616,16 @@ void G_ClearControlKeys(INT32 (*setupcontrols)[2], INT32 control) setupcontrols[control][1] = KEY_NULL; } +void G_ClearAllControlKeys(void) +{ + INT32 i; + for (i = 0; i < num_gamecontrols; i++) + { + G_ClearControlKeys(gamecontrol, i); + G_ClearControlKeys(gamecontrolbis, i); + } +} + // // Returns the name of a key (or virtual key for mouse and joy) // the input value being an keynum @@ -1055,235 +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_weaponprev ][0] = 'q'; - 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_use ][0] = KEY_LSHIFT; - gamecontrol[gc_camtoggle ][0] = 'v'; - gamecontrol[gc_camleft ][0] = '['; - gamecontrol[gc_camright ][0] = ']'; - gamecontrol[gc_camreset ][0] = 'r'; - gamecontrol[gc_lookup ][0] = KEY_UPARROW; - gamecontrol[gc_lookdown ][0] = KEY_DOWNARROW; - gamecontrol[gc_centerview ][0] = KEY_END; - gamecontrol[gc_talkkey ][0] = 't'; - gamecontrol[gc_teamkey ][0] = 'y'; - gamecontrol[gc_scores ][0] = KEY_TAB; - gamecontrol[gc_jump ][0] = KEY_SPACE; - gamecontrol[gc_console ][0] = KEY_CONSOLE; - gamecontrol[gc_pause ][0] = 'p'; - gamecontrol[gc_screenshot ][0] = KEY_F8; - gamecontrol[gc_recordgif ][0] = KEY_F9; - gamecontrol[gc_viewpoint ][0] = KEY_F12; - gamecontrol[gc_systemmenu ][0] = KEY_JOY1+7; // Start -#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"); } @@ -1291,39 +822,173 @@ 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"); } } -void G_CheckDoubleUsage(INT32 keynum) +INT32 G_CheckDoubleUsage(INT32 keynum, boolean modify) { + INT32 result = gc_null; if (cv_controlperkey.value == 1) { INT32 i; for (i = 0; i < num_gamecontrols; i++) { if (gamecontrol[i][0] == keynum) - gamecontrol[i][0] = KEY_NULL; + { + result = i; + if (modify) gamecontrol[i][0] = KEY_NULL; + } if (gamecontrol[i][1] == keynum) - gamecontrol[i][1] = KEY_NULL; + { + result = i; + if (modify) gamecontrol[i][1] = KEY_NULL; + } if (gamecontrolbis[i][0] == keynum) - gamecontrolbis[i][0] = KEY_NULL; + { + result = i; + if (modify) gamecontrolbis[i][0] = KEY_NULL; + } if (gamecontrolbis[i][1] == keynum) - gamecontrolbis[i][1] = KEY_NULL; + { + result = i; + if (modify) gamecontrolbis[i][1] = KEY_NULL; + } + if (result && !modify) + return result; } } + return result; } -static void setcontrol(INT32 (*gc)[2], INT32 na) +static INT32 G_FilterKeyByVersion(INT32 numctrl, INT32 keyidx, INT32 player, INT32 *keynum1, INT32 *keynum2, boolean *nestedoverride) +{ + // Special case: ignore KEY_PAUSE because it's hardcoded + if (keyidx == 0 && *keynum1 == KEY_PAUSE) + { + if (*keynum2 != KEY_PAUSE) + { + *keynum1 = *keynum2; // shift down keynum2 and continue + *keynum2 = 0; + } + else + return -1; // skip setting control + } + else if (keyidx == 1 && *keynum2 == KEY_PAUSE) + return -1; // skip setting control + + 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 || + numctrl == gc_pause || numctrl == gc_systemmenu || numctrl == gc_camtoggle || + numctrl == gc_screenshot || numctrl == gc_talkkey || numctrl == gc_scores || + numctrl == gc_centerview + )) + { + INT32 keynum = 0, existingctrl = 0; + INT32 defaultkey; + boolean defaultoverride = false; + + // get the default gamecontrol + if (player == 0 && numctrl == gc_systemmenu) + defaultkey = gamecontrol[numctrl][0]; + else + defaultkey = (player == 1 ? gamecontrolbis[numctrl][0] : gamecontrol[numctrl][1]); + + // Assign joypad button defaults if there is an open slot. + // At this point, gamecontrol/bis should have the default controls + // (unless LOADCONFIG is being run) + // + // If the player runs SETCONTROL in-game, this block should not be reached + // because EXECVERSION is locked onto the latest version. + if (keyidx == 0 && !*keynum1) + { + if (*keynum2) // push keynum2 down; this is an edge case + { + *keynum1 = *keynum2; + *keynum2 = 0; + keynum = *keynum1; + } + else + { + keynum = defaultkey; + defaultoverride = true; + } + } + else if (keyidx == 1 && (!*keynum2 || (!*keynum1 && *keynum2))) // last one is the same edge case as above + { + keynum = defaultkey; + defaultoverride = true; + } + else // default to the specified keynum + keynum = (keyidx == 1 ? *keynum2 : *keynum1); + + // Did our last call override keynum2? + if (*nestedoverride) + { + defaultoverride = true; + *nestedoverride = false; + } + + // Fill keynum2 with the default control + if (keyidx == 0 && !*keynum2) + { + *keynum2 = defaultkey; + // Tell the next call that this is an override + *nestedoverride = true; + + // if keynum2 already matches keynum1, we probably recursed + // so unset it + if (*keynum1 == *keynum2) + { + *keynum2 = 0; + *nestedoverride = false; + } + } + + // check if the key is being used somewhere else before passing it + // pass it through if it's the same numctrl. This is an edge case -- when using + // LOADCONFIG, gamecontrol is not reset with default. + // + // Also, only check if we're actually overriding, to preserve behavior where + // config'd keys overwrite default keys. + if (defaultoverride) + existingctrl = G_CheckDoubleUsage(keynum, false); + + if (keynum && (!existingctrl || existingctrl == numctrl)) + return keynum; + else if (keyidx == 0 && *keynum2) + { + // try it again and push down keynum2 + *keynum1 = *keynum2; + *keynum2 = 0; + return G_FilterKeyByVersion(numctrl, keyidx, player, keynum1, keynum2, nestedoverride); + // recursion *should* be safe because we only assign keynum2 to a joy default + // and then clear it if we find that keynum1 already has the joy default. + } + else + return 0; + } + + // All's good, so pass the keynum as-is + if (keyidx == 1) + return *keynum2; + else //if (keyidx == 0) + return *keynum1; +} + +static void setcontrol(INT32 (*gc)[2]) { INT32 numctrl; const char *namectrl; - INT32 keynum; + INT32 keynum, keynum1, keynum2; + INT32 player = ((void*)gc == (void*)&gamecontrolbis ? 1 : 0); + boolean nestedoverride = false; namectrl = COM_Argv(1); for (numctrl = 0; numctrl < num_gamecontrols && stricmp(namectrl, gamecontrolname[numctrl]); @@ -1334,31 +999,38 @@ static void setcontrol(INT32 (*gc)[2], INT32 na) CONS_Printf(M_GetText("Control '%s' unknown\n"), namectrl); return; } - keynum = G_KeyStringtoNum(COM_Argv(2)); + keynum1 = G_KeyStringtoNum(COM_Argv(2)); + keynum2 = G_KeyStringtoNum(COM_Argv(3)); + keynum = G_FilterKeyByVersion(numctrl, 0, player, &keynum1, &keynum2, &nestedoverride); - if (keynum == KEY_PAUSE) // fail silently; pause is hardcoded + if (keynum >= 0) { - if (na == 4) + (void)G_CheckDoubleUsage(keynum, true); + + // if keynum was rejected, try it again with keynum2 + if (!keynum && keynum2) { - na--; - keynum = G_KeyStringtoNum(COM_Argv(3)); - if (keynum == KEY_PAUSE) - return; + keynum1 = keynum2; // push down keynum2 + keynum2 = 0; + keynum = G_FilterKeyByVersion(numctrl, 0, player, &keynum1, &keynum2, &nestedoverride); + if (keynum >= 0) + (void)G_CheckDoubleUsage(keynum, true); } - else - return; } - G_CheckDoubleUsage(keynum); - gc[numctrl][0] = keynum; + if (keynum >= 0) + gc[numctrl][0] = keynum; - if (na == 4) + if (keynum2) { - keynum = G_KeyStringtoNum(COM_Argv(3)); - if (keynum != KEY_PAUSE) - gc[numctrl][1] = keynum; - else - gc[numctrl][1] = 0; + keynum = G_FilterKeyByVersion(numctrl, 1, player, &keynum1, &keynum2, &nestedoverride); + if (keynum >= 0) + { + if (keynum != gc[numctrl][0]) + gc[numctrl][1] = keynum; + else + gc[numctrl][1] = 0; + } } else gc[numctrl][1] = 0; @@ -1376,7 +1048,7 @@ void Command_Setcontrol_f(void) return; } - setcontrol(gamecontrol, na); + setcontrol(gamecontrol); } void Command_Setcontrol2_f(void) @@ -1391,5 +1063,5 @@ void Command_Setcontrol2_f(void) return; } - setcontrol(gamecontrolbis, na); + setcontrol(gamecontrolbis); } diff --git a/src/g_input.h b/src/g_input.h index 557fb3bf3..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 @@ -160,10 +165,13 @@ INT32 G_KeyStringtoNum(const char *keystr); // detach any keys associated to the given game control 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_CheckDoubleUsage(INT32 keynum); +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/g_state.h b/src/g_state.h index 76c9bd16f..9d34da6a9 100644 --- a/src/g_state.h +++ b/src/g_state.h @@ -27,12 +27,14 @@ typedef enum GS_TITLESCREEN, // title screen GS_TIMEATTACK, // time attack menu + GS_CREDITS, // credit sequence GS_EVALUATION, // Evaluation at the end of a game. - GS_GAMEEND, // game end sequence + GS_GAMEEND, // game end sequence - "did you get all those chaos emeralds?" // Hardcoded fades or other fading methods GS_INTRO, // introduction + GS_ENDING, // currently shared between bad and good endings GS_CUTSCENE, // custom cutscene // Not fadable @@ -50,6 +52,7 @@ typedef enum } gameaction_t; extern gamestate_t gamestate; +extern UINT8 titlemapinaction; extern UINT8 ultimatemode; // was sk_insane extern gameaction_t gameaction; diff --git a/src/hardware/hw_bsp.c b/src/hardware/hw_bsp.c index a180697d5..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 @@ -193,14 +194,14 @@ static polyvertex_t *fracdivline(fdivline_t *bsp, polyvertex_t *v1, v2dy = bsp->dy; den = v2dy*v1dx - v2dx*v1dy; - if (den == 0) + if (fabsf((float)den) < 1.0E-36f) // avoid checking exactly for 0.0 return NULL; // parallel // first check the frac along the polygon segment, // (do not accept hit with the extensions) num = (v2x - v1x)*v2dy + (v1y - v2y)*v2dx; frac = num / den; - if (frac < 0 || frac > 1) + if (frac < 0.0 || frac > 1.0) return NULL; // now get the frac along the BSP line @@ -217,29 +218,6 @@ static polyvertex_t *fracdivline(fdivline_t *bsp, polyvertex_t *v1, return &pt; } -#if 0 -//Hurdler: it's not used anymore -static boolean NearVertice (polyvertex_t *p1, polyvertex_t *p2) -{ -#if 1 - float diff; - diff = p2->x - p1->x; - if (diff < -1.5f || diff > 1.5f) - return false; - diff = p2->y - p1->y; - if (diff < -1.5f || diff > 1.5f) - return false; -#else - if (p1->x != p2->x) - return false; - if (p1->y != p2->y) - return false; -#endif - // p1 and p2 are considered the same vertex - return true; -} -#endif - // if two vertice coords have a x and/or y difference // of less or equal than 1 FRACUNIT, they are considered the same // point. Note: hardcoded value, 1.0f could be anything else. @@ -253,11 +231,23 @@ static boolean SameVertice (polyvertex_t *p1, polyvertex_t *p2) diff = p2->y - p1->y; if (diff < -1.5f || diff > 1.5f) return false; -#else +#elif 0 if (p1->x != p2->x) return false; if (p1->y != p2->y) return false; +#elif 0 + if (fabsf( p2->x - p1->x ) > 1.0E-36f ) + return false; + if (fabsf( p2->y - p1->y ) > 1.0E-36f ) + return false; +#else +#define DIVLINE_VERTEX_DIFF 0.45f + float ep = DIVLINE_VERTEX_DIFF; + if (fabsf( p2->x - p1->x ) > ep ) + return false; + if (fabsf( p2->y - p1->y ) > ep ) + return false; #endif // p1 and p2 are considered the same vertex return true; @@ -294,57 +284,57 @@ static void SplitPoly (fdivline_t *bsp, //splitting parametric line // start & end points pv = fracdivline(bsp, &poly->pts[i], &poly->pts[j]); - if (pv) + if (pv == NULL) + continue; + + if (ps < 0) { - if (ps < 0) + // first point + ps = i; + vs = *pv; + fracs = bspfrac; + } + else + { + //the partition line traverse a junction between two segments + // or the two points are so close, they can be considered as one + // thus, don't accept, since split 2 must be another vertex + if (SameVertice(pv, &lastpv)) { - // first point - ps = i; - vs = *pv; - fracs = bspfrac; - } - else - { - //the partition line traverse a junction between two segments - // or the two points are so close, they can be considered as one - // thus, don't accept, since split 2 must be another vertex - if (SameVertice(pv, &lastpv)) + if (pe < 0) { - if (pe < 0) - { - ps = i; - psonline = 1; - } - else - { - pe = i; - peonline = 1; - } + ps = i; + psonline = 1; } else { - if (pe < 0) - { - pe = i; - ve = *pv; - frace = bspfrac; - } - else - { - // a frac, not same vertice as last one - // we already got pt2 so pt 2 is not on the line, - // so we probably got back to the start point - // which is on the line - if (SameVertice(pv, &vs)) - psonline = 1; - break; - } + pe = i; + peonline = 1; + } + } + else + { + if (pe < 0) + { + pe = i; + ve = *pv; + frace = bspfrac; + } + else + { + // a frac, not same vertice as last one + // we already got pt2 so pt 2 is not on the line, + // so we probably got back to the start point + // which is on the line + if (SameVertice(pv, &vs)) + psonline = 1; + break; } } - - // remember last point intercept to detect identical points - lastpv = *pv; } + + // remember last point intercept to detect identical points + lastpv = *pv; } // no split: the partition line is either parallel and @@ -368,7 +358,7 @@ static void SplitPoly (fdivline_t *bsp, //splitting parametric line return; } - if (ps >= 0 && pe < 0) + if (pe < 0) { //I_Error("SplitPoly: only one point for split line (%d %d)", ps, pe); *frontpoly = poly; @@ -387,7 +377,7 @@ static void SplitPoly (fdivline_t *bsp, //splitting parametric line *backpoly = HWR_AllocPoly(2 + nptback); else *backpoly = NULL; - if (nptfront) + if (nptfront > 0) *frontpoly = HWR_AllocPoly(2 + nptfront); else *frontpoly = NULL; @@ -482,42 +472,42 @@ static poly_t *CutOutSubsecPoly(seg_t *lseg, INT32 count, poly_t *poly) pv = fracdivline(&cutseg, &poly->pts[i], &poly->pts[j]); - if (pv) + if (pv == NULL) + continue; + + if (ps < 0) { - if (ps < 0) + ps = i; + vs = *pv; + fracs = bspfrac; + } + else + { + //frac 1 on previous segment, + // 0 on the next, + //the split line goes through one of the convex poly + // vertices, happens quite often since the convex + // poly is already adjacent to the subsector segs + // on most borders + if (SameVertice(pv, &vs)) + continue; + + if (fracs <= bspfrac) { + nump = 2 + poly->numpts - (i-ps); + pe = ps; ps = i; - vs = *pv; - fracs = bspfrac; + ve = *pv; } else { - //frac 1 on previous segment, - // 0 on the next, - //the split line goes through one of the convex poly - // vertices, happens quite often since the convex - // poly is already adjacent to the subsector segs - // on most borders - if (SameVertice(pv, &vs)) - continue; - - if (fracs <= bspfrac) - { - nump = 2 + poly->numpts - (i-ps); - pe = ps; - ps = i; - ve = *pv; - } - else - { - nump = 2 + (i-ps); - pe = i; - ve = vs; - vs = *pv; - } - //found 2nd point - break; + nump = 2 + (i-ps); + pe = i; + ve = vs; + vs = *pv; } + //found 2nd point + break; } } @@ -581,18 +571,42 @@ static inline void HWR_SubsecPoly(INT32 num, poly_t *poly) // search for the segs source of this divline static inline void SearchDivline(node_t *bsp, fdivline_t *divline) { -#if 0 // MAR - If you don't use the same partition line that the BSP uses, the front/back polys won't match the subsectors in the BSP! -#endif divline->x = FIXED_TO_FLOAT(bsp->x); divline->y = FIXED_TO_FLOAT(bsp->y); divline->dx = FIXED_TO_FLOAT(bsp->dx); divline->dy = FIXED_TO_FLOAT(bsp->dy); } +#ifdef HWR_LOADING_SCREEN //Hurdler: implement a loading status static size_t ls_count = 0; static UINT8 ls_percent = 0; +static void loading_status(void) +{ + char s[16]; + int x, y; + + I_OsPolling(); + CON_Drawer(); + sprintf(s, "%d%%", (++ls_percent)<<1); + x = BASEVIDWIDTH/2; + y = BASEVIDHEIGHT/2; + V_DrawFill(0, 0, BASEVIDWIDTH, BASEVIDHEIGHT, 31); // Black background to match fade in effect + //V_DrawPatchFill(W_CachePatchName("SRB2BACK",PU_CACHE)); // SRB2 background, ehhh too bright. + M_DrawTextBox(x-58, y-8, 13, 1); + V_DrawString(x-50, y, V_YELLOWMAP, "Loading..."); + V_DrawRightAlignedString(x+50, y, V_YELLOWMAP, s); + + // Is this really necessary at this point..? + V_DrawCenteredString(BASEVIDWIDTH/2, 40, V_YELLOWMAP, "OPENGL MODE IS INCOMPLETE AND MAY"); + V_DrawCenteredString(BASEVIDWIDTH/2, 50, V_YELLOWMAP, "NOT DISPLAY SOME SURFACES."); + V_DrawCenteredString(BASEVIDWIDTH/2, 70, V_YELLOWMAP, "USE AT SONIC'S RISK."); + + I_UpdateNoVsync(); +} +#endif + // poly : the convex polygon that encloses all child subsectors static void WalkBSPNode(INT32 bspnum, poly_t *poly, UINT16 *leafnode, fixed_t *bbox) { @@ -630,38 +644,19 @@ static void WalkBSPNode(INT32 bspnum, poly_t *poly, UINT16 *leafnode, fixed_t *b } else { - HWR_SubsecPoly(bspnum&(~NF_SUBSECTOR), poly); - //Hurdler: implement a loading status + HWR_SubsecPoly(bspnum & ~NF_SUBSECTOR, poly); + //Hurdler: implement a loading status #ifdef HWR_LOADING_SCREEN if (ls_count-- <= 0) { - char s[16]; - int x, y; - - I_OsPolling(); ls_count = numsubsectors/50; - CON_Drawer(); - sprintf(s, "%d%%", (++ls_percent)<<1); - x = BASEVIDWIDTH/2; - y = BASEVIDHEIGHT/2; - V_DrawFill(0, 0, BASEVIDWIDTH, BASEVIDHEIGHT, 31); // Black background to match fade in effect - //V_DrawPatchFill(W_CachePatchName("SRB2BACK",PU_CACHE)); // SRB2 background, ehhh too bright. - M_DrawTextBox(x-58, y-8, 13, 1); - V_DrawString(x-50, y, V_YELLOWMAP, "Loading..."); - V_DrawRightAlignedString(x+50, y, V_YELLOWMAP, s); - - // Is this really necessary at this point..? - V_DrawCenteredString(BASEVIDWIDTH/2, 40, V_YELLOWMAP, "OPENGL MODE IS INCOMPLETE AND MAY"); - V_DrawCenteredString(BASEVIDWIDTH/2, 50, V_YELLOWMAP, "NOT DISPLAY SOME SURFACES."); - V_DrawCenteredString(BASEVIDWIDTH/2, 70, V_YELLOWMAP, "USE AT SONIC'S RISK."); - - I_UpdateNoVsync(); + loading_status(); } #endif } M_ClearBox(bbox); - poly = extrasubsectors[bspnum&~NF_SUBSECTOR].planepoly; + poly = extrasubsectors[bspnum & ~NF_SUBSECTOR].planepoly; for (i = 0, pt = poly->pts; i < poly->numpts; i++,pt++) M_AddToBox(bbox, FLOAT_TO_FIXED(pt->x), FLOAT_TO_FIXED(pt->y)); @@ -693,14 +688,13 @@ static void WalkBSPNode(INT32 bspnum, poly_t *poly, UINT16 *leafnode, fixed_t *b if (backpoly) { // Correct back bbox to include floor/ceiling convex polygon - WalkBSPNode(bsp->children[1], backpoly, &bsp->children[1], - bsp->bbox[1]); + WalkBSPNode(bsp->children[1], backpoly, &bsp->children[1], bsp->bbox[1]); - // enlarge bbox with seconde child + // enlarge bbox with second child M_AddToBox(bbox, bsp->bbox[1][BOXLEFT ], - bsp->bbox[1][BOXTOP ]); + bsp->bbox[1][BOXTOP ]); M_AddToBox(bbox, bsp->bbox[1][BOXRIGHT ], - bsp->bbox[1][BOXBOTTOM]); + bsp->bbox[1][BOXBOTTOM]); } } @@ -780,9 +774,9 @@ static void SearchSegInBSP(INT32 bspnum,polyvertex_t *p,poly_t *poly) if (bspnum & NF_SUBSECTOR) { - if (bspnum!=-1) + if (bspnum != -1) { - bspnum&=~NF_SUBSECTOR; + bspnum &= ~NF_SUBSECTOR; q = extrasubsectors[bspnum].planepoly; if (poly == q || !q) return; @@ -968,7 +962,9 @@ void HWR_CreatePlanePolygons(INT32 bspnum) fixed_t rootbbox[4]; CONS_Debug(DBG_RENDER, "Creating polygons, please wait...\n"); +#ifdef HWR_LOADING_SCREEN ls_count = ls_percent = 0; // reset the loading status +#endif CON_Drawer(); //let the user know what we are doing I_FinishUpdate(); // page flip or blit buffer diff --git a/src/hardware/hw_cache.c b/src/hardware/hw_cache.c index 78fc31afc..6bc2c712e 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); } } @@ -337,26 +568,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; @@ -440,13 +651,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 :( @@ -533,11 +741,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; @@ -581,8 +786,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 @@ -629,8 +834,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 c05ff3e79..5dcead77c 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 75523f3d2..d9e688c0a 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)) { @@ -214,7 +283,7 @@ void HWR_DrawFixedPatch(GLPatch_t *gpatch, fixed_t x, fixed_t y, fixed_t pscale, if (!(option & V_SCALEPATCHMASK)) { - // if it's meant to cover the whole screen, black out the rest + // if it's meant to cover the whole screen, black out the rest (ONLY IF TOP LEFT ISN'T TRANSPARENT) // cx and cy are possibly *slightly* off from float maths // This is done before here compared to software because we directly alter cx and cy to centre if (cx >= -0.1f && cx <= 0.1f && SHORT(gpatch->width) == BASEVIDWIDTH && cy >= -0.1f && cy <= 0.1f && SHORT(gpatch->height) == BASEVIDHEIGHT) @@ -222,34 +291,43 @@ void HWR_DrawFixedPatch(GLPatch_t *gpatch, fixed_t x, fixed_t y, fixed_t pscale, // Need to temporarily cache the real patch to get the colour of the top left pixel patch_t *realpatch = W_CacheLumpNumPwad(gpatch->wadnum, gpatch->lumpnum, PU_STATIC); const column_t *column = (const column_t *)((const UINT8 *)(realpatch) + LONG((realpatch)->columnofs[0])); - const UINT8 *source = (const UINT8 *)(column) + 3; - HWR_DrawFill(0, 0, BASEVIDWIDTH, BASEVIDHEIGHT, (column->topdelta == 0xff ? 31 : source[0])); + if (!column->topdelta) + { + const UINT8 *source = (const UINT8 *)(column) + 3; + HWR_DrawFill(0, 0, BASEVIDWIDTH, BASEVIDHEIGHT, (column->topdelta == 0xff ? 31 : source[0])); + } Z_Free(realpatch); } // centre screen - if ((float)vid.width != (float)BASEVIDWIDTH * dupx) + if (fabsf((float)vid.width - (float)BASEVIDWIDTH * dupx) > 1.0E-36f) { if (option & V_SNAPTORIGHT) 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 ((float)vid.height != (float)BASEVIDHEIGHT * dupy) + 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 +430,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; @@ -362,7 +442,7 @@ void HWR_DrawCroppedPatch(GLPatch_t *gpatch, fixed_t x, fixed_t y, fixed_t pscal if (!(option & V_SCALEPATCHMASK)) { - // if it's meant to cover the whole screen, black out the rest + // if it's meant to cover the whole screen, black out the rest (ONLY IF TOP LEFT ISN'T TRANSPARENT) // cx and cy are possibly *slightly* off from float maths // This is done before here compared to software because we directly alter cx and cy to centre if (cx >= -0.1f && cx <= 0.1f && SHORT(gpatch->width) == BASEVIDWIDTH && cy >= -0.1f && cy <= 0.1f && SHORT(gpatch->height) == BASEVIDHEIGHT) @@ -370,23 +450,24 @@ void HWR_DrawCroppedPatch(GLPatch_t *gpatch, fixed_t x, fixed_t y, fixed_t pscal // Need to temporarily cache the real patch to get the colour of the top left pixel patch_t *realpatch = W_CacheLumpNumPwad(gpatch->wadnum, gpatch->lumpnum, PU_STATIC); const column_t *column = (const column_t *)((const UINT8 *)(realpatch) + LONG((realpatch)->columnofs[0])); - const UINT8 *source = (const UINT8 *)(column) + 3; - HWR_DrawFill(0, 0, BASEVIDWIDTH, BASEVIDHEIGHT, (column->topdelta == 0xff ? 31 : source[0])); + if (!column->topdelta) + { + const UINT8 *source = (const UINT8 *)(column) + 3; + HWR_DrawFill(0, 0, BASEVIDWIDTH, BASEVIDHEIGHT, (column->topdelta == 0xff ? 31 : source[0])); + } Z_Free(realpatch); } // centre screen - if ((float)vid.width != (float)BASEVIDWIDTH * dupx) + if (fabsf((float)vid.width - (float)BASEVIDWIDTH * dupx) > 1.0E-36f) { if (option & V_SNAPTORIGHT) cx += ((float)vid.width - ((float)BASEVIDWIDTH * dupx)); else if (!(option & V_SNAPTOLEFT)) cx += ((float)vid.width - ((float)BASEVIDWIDTH * dupx))/2; } - if ((float)vid.height != (float)BASEVIDHEIGHT * dupy) + 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 +478,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 +512,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 +666,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 +682,191 @@ 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 = V_GetColor(color).rgba; + Surf.FlatColor.s.alpha = softwaretranstogl[strength]; + } + HWD.pfnDrawPolygon(&Surf, v, 4, PF_NoTexture|PF_Modulated|PF_Translucent|PF_NoDepthTest); +} + +// -----------------+ +// HWR_DrawFadeFill : draw flat coloured rectangle, with transparency +// -----------------+ +void HWR_DrawFadeFill(INT32 x, INT32 y, INT32 w, INT32 h, INT32 color, UINT16 actualcolor, UINT8 strength) +{ + FOutVector v[4]; + FSurfaceInfo Surf; + float fx, fy, fw, fh; + + UINT8 perplayershuffle = 0; + +// 3--2 +// | /| +// |/ | +// 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; + fh = (float)h; + + if (!(color & V_NOSCALESTART)) + { + float dupx = (float)vid.dupx, dupy = (float)vid.dupy; + + fx *= dupx; + fy *= dupy; + fw *= dupx; + fh *= dupy; + + if (fabsf((float)vid.width - (float)BASEVIDWIDTH * dupx) > 1.0E-36f) + { + if (color & V_SNAPTORIGHT) + 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) + { + // same thing here + if (color & V_SNAPTOBOTTOM) + 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; + } + } + + if (fx >= vid.width || fy >= vid.height) + return; + if (fx < 0) + { + fw += fx; + fx = 0; + } + if (fy < 0) + { + fh += fy; + fy = 0; + } + + if (fw <= 0 || fh <= 0) + return; + if (fx + fw > vid.width) + fw = (float)vid.width - fx; + if (fy + fh > vid.height) + fh = (float)vid.height - fy; + + fx = -1 + fx / (vid.width / 2); + fy = 1 - fy / (vid.height / 2); + fw = fw / (vid.width / 2); + fh = fh / (vid.height / 2); + + v[0].x = v[3].x = fx; + v[2].x = v[1].x = fx + fw; + v[0].y = v[1].y = fy; + v[2].y = v[3].y = fy - fh; + + //Hurdler: do we still use this argb color? if not, we should remove it + v[0].argb = v[1].argb = v[2].argb = v[3].argb = 0xff00ff00; //; + 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 = 0.0f; + v[2].tow = v[3].tow = 1.0f; + + if (actualcolor & 0xFF00) // Do COLORMAP fade. + { + Surf.FlatColor.rgba = UINT2RGBA(0x01010160); + Surf.FlatColor.s.alpha = (strength*8); + } + else // Do TRANSMAP** fade. + { + Surf.FlatColor.rgba = V_GetColor(actualcolor).rgba; + Surf.FlatColor.s.alpha = softwaretranstogl[strength]; + } HWD.pfnDrawPolygon(&Surf, v, 4, PF_NoTexture|PF_Modulated|PF_Translucent|PF_NoDepthTest); } @@ -636,6 +897,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 @@ -770,18 +1057,6 @@ void HWR_DrawViewBorder(INT32 clearlines) // AM_MAP.C DRAWING STUFF // ========================================================================== -// Clear the automap part of the screen -void HWR_clearAutomap(void) -{ - FRGBAFloat fColor = {0, 0, 0, 1}; - - // minx,miny,maxx,maxy - HWD.pfnGClipRect(0, 0, vid.width, vid.height, NZCLIP_PLANE); - HWD.pfnClearBuffer(true, true, &fColor); - HWD.pfnGClipRect(0, 0, vid.width, vid.height, NZCLIP_PLANE); -} - - // -----------------+ // HWR_drawAMline : draw a line of the automap (the clipping is already done in automap code) // Arg : color is a RGB 888 value @@ -802,6 +1077,173 @@ void HWR_drawAMline(const fline_t *fl, INT32 color) HWD.pfnDraw2DLine(&v1, &v2, color_rgba); } +// -------------------+ +// HWR_DrawConsoleFill : draw flat coloured transparent rectangle because that's cool, and hw sucks less than sw for that. +// -------------------+ +void HWR_DrawConsoleFill(INT32 x, INT32 y, INT32 w, INT32 h, INT32 color, UINT32 actualcolor) +{ + FOutVector v[4]; + FSurfaceInfo Surf; + float fx, fy, fw, fh; + + UINT8 perplayershuffle = 0; + +// 3--2 +// | /| +// |/ | +// 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; + fh = (float)h; + + if (!(color & V_NOSCALESTART)) + { + float dupx = (float)vid.dupx, dupy = (float)vid.dupy; + + fx *= dupx; + fy *= dupy; + fw *= dupx; + fh *= dupy; + + if (fabsf((float)vid.width - (float)BASEVIDWIDTH * dupx) > 1.0E-36f) + { + if (color & V_SNAPTORIGHT) + 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) + { + // same thing here + if (color & V_SNAPTOBOTTOM) + 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; + } + } + + if (fx >= vid.width || fy >= vid.height) + return; + if (fx < 0) + { + fw += fx; + fx = 0; + } + if (fy < 0) + { + fh += fy; + fy = 0; + } + + if (fw <= 0 || fh <= 0) + return; + if (fx + fw > vid.width) + fw = (float)vid.width - fx; + if (fy + fh > vid.height) + fh = (float)vid.height - fy; + + fx = -1 + fx / (vid.width / 2); + fy = 1 - fy / (vid.height / 2); + fw = fw / (vid.width / 2); + fh = fh / (vid.height / 2); + + v[0].x = v[3].x = fx; + v[2].x = v[1].x = fx + fw; + v[0].y = v[1].y = fy; + v[2].y = v[3].y = fy - fh; + + //Hurdler: do we still use this argb color? if not, we should remove it + v[0].argb = v[1].argb = v[2].argb = v[3].argb = 0xff00ff00; //; + 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 = 0.0f; + v[2].tow = v[3].tow = 1.0f; + + Surf.FlatColor.rgba = UINT2RGBA(actualcolor); + Surf.FlatColor.s.alpha = 0x80; + + HWD.pfnDrawPolygon(&Surf, v, 4, PF_NoTexture|PF_Modulated|PF_Translucent|PF_NoDepthTest); +} // -----------------+ // HWR_DrawFill : draw flat coloured rectangle, with no texture @@ -812,14 +1254,81 @@ void HWR_DrawFill(INT32 x, INT32 y, INT32 w, INT32 h, INT32 color) FSurfaceInfo Surf; float fx, fy, fw, fh; - if (w < 0 || h < 0) - return; // consistency w/ software + UINT8 perplayershuffle = 0; // 3--2 // | /| // |/ | // 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; @@ -846,20 +1355,28 @@ void HWR_DrawFill(INT32 x, INT32 y, INT32 w, INT32 h, INT32 color) fw *= dupx; fh *= dupy; - if ((float)vid.width != (float)BASEVIDWIDTH * dupx) + if (fabsf((float)vid.width - (float)BASEVIDWIDTH * dupx) > 1.0E-36f) { if (color & V_SNAPTORIGHT) 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 ((float)vid.height != (float)BASEVIDHEIGHT * dupy) + if (fabsf((float)vid.height - (float)BASEVIDHEIGHT * dupy) > 1.0E-36f) { // same thing here if (color & V_SNAPTOBOTTOM) 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; } } @@ -990,21 +1507,24 @@ UINT8 *HWR_GetScreenshot(void) return buf; } -boolean HWR_Screenshot(const char *lbmname) +boolean HWR_Screenshot(const char *pathname) { boolean ret; UINT8 *buf = malloc(vid.width * vid.height * 3 * sizeof (*buf)); if (!buf) + { + CONS_Debug(DBG_RENDER, "HWR_Screenshot: Failed to allocate memory\n"); return false; + } // returns 24bit 888 RGB HWD.pfnReadRect(0, 0, vid.width, vid.height, vid.width * 3, (void *)buf); #ifdef USE_PNG - ret = M_SavePNG(lbmname, buf, vid.width, vid.height, NULL); + ret = M_SavePNG(pathname, buf, vid.width, vid.height, NULL); #else - ret = saveTGA(lbmname, buf, vid.width, vid.height); + ret = saveTGA(pathname, buf, vid.width, vid.height); #endif free(buf); return ret; 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..a52d72869 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 @@ -197,9 +202,14 @@ light_t *t_lspr[NUMSPRITES] = // Boss 4 (Castle Eggman) &lspr[NOLIGHT], // SPR_EGGP &lspr[REDBALL_L], // SPR_EFIR + &lspr[NOLIGHT], // SPR_EGR1 // 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 +236,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 +304,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 +335,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 +382,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 +422,74 @@ 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 + &lspr[NOLIGHT], // SPR_LHRT + // Ring Weapons &lspr[RINGLIGHT_L], // SPR_RRNG &lspr[RINGLIGHT_L], // SPR_RNGB @@ -424,29 +517,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 +561,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 +582,13 @@ light_t *t_lspr[NUMSPRITES] = &lspr[NOLIGHT], // SPR_ROIO &lspr[NOLIGHT], // SPR_ROIP - // Blue Spheres - &lspr[NOLIGHT], // SPR_BBAL + // Bricks + &lspr[NOLIGHT], // SPR_BRIC // 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], @@ -712,6 +804,14 @@ void HWR_WallLighting(FOutVector *wlVerts) FSurfaceInfo Surf; float dist_p2d, d[4], s; + if (!dynlights->mo[j]) + continue; + if (P_MobjWasRemoved(dynlights->mo[j])) + { + P_SetTarget(&dynlights->mo[j], NULL); + continue; + } + // check bounding box first if (SphereTouchBBox3D(&wlVerts[2], &wlVerts[0], &LIGHT_POS(j), DL_RADIUS(j))==false) continue; @@ -762,8 +862,6 @@ void HWR_WallLighting(FOutVector *wlVerts) #ifdef DL_HIGH_QUALITY Surf.FlatColor.s.alpha = (UINT8)((1-dist_p2d/DL_SQRRADIUS(j))*Surf.FlatColor.s.alpha); #endif - if (!dynlights->mo[j]->state) - return; // next state is null so fade out with alpha if (dynlights->mo[j]->state->nextstate == S_NULL) Surf.FlatColor.s.alpha = (UINT8)(((float)dynlights->mo[j]->tics/(float)dynlights->mo[j]->state->tics)*Surf.FlatColor.s.alpha); @@ -794,6 +892,14 @@ void HWR_PlaneLighting(FOutVector *clVerts, int nrClipVerts) FSurfaceInfo Surf; float dist_p2d, s; + if (!dynlights->mo[j]) + continue; + if (P_MobjWasRemoved(dynlights->mo[j])) + { + P_SetTarget(&dynlights->mo[j], NULL); + continue; + } + // BP: The kickass Optimization: check if light touch bounding box if (SphereTouchBBox3D(&p1, &p2, &dynlights->position[j], DL_RADIUS(j))==false) continue; @@ -825,8 +931,6 @@ void HWR_PlaneLighting(FOutVector *clVerts, int nrClipVerts) #ifdef DL_HIGH_QUALITY Surf.FlatColor.s.alpha = (unsigned char)((1 - dist_p2d/DL_SQRRADIUS(j))*Surf.FlatColor.s.alpha); #endif - if (!dynlights->mo[j]->state) - return; // next state is null so fade out with alpha if ((dynlights->mo[j]->state->nextstate == S_NULL)) Surf.FlatColor.s.alpha = (unsigned char)(((float)dynlights->mo[j]->tics/(float)dynlights->mo[j]->state->tics)*Surf.FlatColor.s.alpha); @@ -957,6 +1061,14 @@ void HWR_DrawCoronas(void) if (!(p_lspr->type & CORONA_SPR)) continue; + if (!dynlights->mo[j]) + continue; + if (P_MobjWasRemoved(dynlights->mo[j])) + { + P_SetTarget(&dynlights->mo[j], NULL); + continue; + } + transform(&cx,&cy,&cz); // more realistique corona ! @@ -1018,7 +1130,8 @@ void HWR_DrawCoronas(void) // -------------------------------------------------------------------------- void HWR_ResetLights(void) { - dynlights->nb = 0; + while (dynlights->nb) + P_SetTarget(&dynlights->mo[--dynlights->nb], NULL); } // -------------------------------------------------------------------------- @@ -1049,24 +1162,25 @@ void HWR_DL_AddLight(gr_vissprite_t *spr, GLPatch_t *patch) return; #endif + if (dynlights->nb >= DL_MAX_LIGHT) + return; + // check if sprite contain dynamic light p_lspr = t_lspr[spr->mobj->sprite]; - if ((p_lspr->type&DYNLIGHT_SPR) - && ((p_lspr->type != LIGHT_SPR) || cv_grstaticlighting.value) - && (dynlights->nb < DL_MAX_LIGHT) + if (!(p_lspr->type & DYNLIGHT_SPR)) + return; + if ((p_lspr->type != LIGHT_SPR) || cv_grstaticlighting.value) + return; - && spr->mobj->state) - { - LIGHT_POS(dynlights->nb).x = FIXED_TO_FLOAT(spr->mobj->x); - LIGHT_POS(dynlights->nb).y = FIXED_TO_FLOAT(spr->mobj->z)+FIXED_TO_FLOAT(spr->mobj->height>>1)+p_lspr->light_yoffset; - LIGHT_POS(dynlights->nb).z = FIXED_TO_FLOAT(spr->mobj->y); + LIGHT_POS(dynlights->nb).x = FIXED_TO_FLOAT(spr->mobj->x); + LIGHT_POS(dynlights->nb).y = FIXED_TO_FLOAT(spr->mobj->z)+FIXED_TO_FLOAT(spr->mobj->height>>1)+p_lspr->light_yoffset; + LIGHT_POS(dynlights->nb).z = FIXED_TO_FLOAT(spr->mobj->y); - P_SetTarget(&dynlights->mo[dynlights->nb], spr->mobj); + P_SetTarget(&dynlights->mo[dynlights->nb], spr->mobj); - dynlights->p_lspr[dynlights->nb] = p_lspr; + dynlights->p_lspr[dynlights->nb] = p_lspr; - dynlights->nb++; - } + dynlights->nb++; } static GLPatch_t lightmappatch; @@ -1220,6 +1334,14 @@ static void HWR_CheckSubsector(size_t num, fixed_t *bbox) // if (CircleTouchBBox(&p1, &p2, &LIGHT_POS(lightnum), DL_RADIUS(lightnum))==false) // continue; + if (!dynlights->mo[lightnum]) + continue; + if (P_MobjWasRemoved(dynlights->mo[lightnum])) + { + P_SetTarget(&dynlights->mo[lightnum], NULL); + continue; + } + count = sub->numlines; // how many linedefs line = &segs[sub->firstline]; // first line seg while (count--) @@ -1237,18 +1359,20 @@ static void HWR_CheckSubsector(size_t num, fixed_t *bbox) // -------------------------------------------------------------------------- static void HWR_AddMobjLights(mobj_t *thing) { - if (t_lspr[thing->sprite]->type & CORONA_SPR) - { - LIGHT_POS(dynlights->nb).x = FIXED_TO_FLOAT(thing->x); - LIGHT_POS(dynlights->nb).y = FIXED_TO_FLOAT(thing->z) + t_lspr[thing->sprite]->light_yoffset; - LIGHT_POS(dynlights->nb).z = FIXED_TO_FLOAT(thing->y); + if (dynlights->nb >= DL_MAX_LIGHT) + return; + if (!(t_lspr[thing->sprite]->type & CORONA_SPR)) + return; - dynlights->p_lspr[dynlights->nb] = t_lspr[thing->sprite]; + LIGHT_POS(dynlights->nb).x = FIXED_TO_FLOAT(thing->x); + LIGHT_POS(dynlights->nb).y = FIXED_TO_FLOAT(thing->z) + t_lspr[thing->sprite]->light_yoffset; + LIGHT_POS(dynlights->nb).z = FIXED_TO_FLOAT(thing->y); - dynlights->nb++; - if (dynlights->nb > DL_MAX_LIGHT) - dynlights->nb = DL_MAX_LIGHT; - } + P_SetTarget(&dynlights->mo[dynlights->nb], thing); + + dynlights->p_lspr[dynlights->nb] = t_lspr[thing->sprite]; + + dynlights->nb++; } //Hurdler: The goal of this function is to walk through all the bsp starting @@ -1274,12 +1398,9 @@ static void HWR_SearchLightsInMobjs(void) //mobj_t * mobj; // search in the list of thinkers - for (th = thinkercap.next; th != &thinkercap; th = th->next) - { - // a mobj ? - if (th->function.acp1 == (actionf_p1)P_MobjThinker) + for (th = thlist[THINK_MOBJ].next; th != &thlist[THINK_MOBJ]; th = th->next) + if (th->function.acp1 != (actionf_p1)P_RemoveThinkerDelayed) HWR_AddMobjLights((mobj_t *)th); - } } #endif @@ -1291,7 +1412,7 @@ void HWR_CreateStaticLightmaps(int bspnum) #ifdef STATICLIGHT CONS_Debug(DBG_RENDER, "HWR_CreateStaticLightmaps\n"); - dynlights->nb = 0; + HWR_ResetLights(); // First: Searching for lights // BP: if i was you, I will make it in create mobj since mobj can be create @@ -1302,8 +1423,6 @@ void HWR_CreateStaticLightmaps(int bspnum) // Second: Build all lightmap for walls covered by lights validcount++; // to be sure HWR_ComputeLightMapsInBSPNode(bspnum, NULL); - - dynlights->nb = 0; #else (void)bspnum; #endif diff --git a/src/hardware/hw_main.c b/src/hardware/hw_main.c index fb5e2a716..c600800fd 100644 --- a/src/hardware/hw_main.c +++ b/src/hardware/hw_main.c @@ -580,7 +580,7 @@ static void HWR_RenderPlane(sector_t *sector, extrasubsector_t *xsub, boolean is if (nrPlaneVerts < 3) //not even a triangle ? return; - if (nrPlaneVerts > UINT16_MAX) // FIXME: exceeds plVerts size + if (nrPlaneVerts > (INT32)UINT16_MAX) // FIXME: exceeds plVerts size { CONS_Debug(DBG_RENDER, "polygon size of %d exceeds max value of %d vertices\n", nrPlaneVerts, UINT16_MAX); return; @@ -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. @@ -3171,7 +3190,7 @@ static void HWR_RenderPolyObjectPlane(polyobj_t *polysector, boolean isceiling, if (nrPlaneVerts < 3) //not even a triangle ? return; - if (nrPlaneVerts > UINT16_MAX) // FIXME: exceeds plVerts size + if (nrPlaneVerts > (size_t)UINT16_MAX) // FIXME: exceeds plVerts size { CONS_Debug(DBG_RENDER, "polygon size of %s exceeds max value of %d vertices\n", sizeu1(nrPlaneVerts), UINT16_MAX); return; @@ -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); } } } @@ -4137,7 +4156,7 @@ static void HWR_DrawSpriteShadow(gr_vissprite_t *spr, GLPatch_t *gpatch, float t swallVerts[0].z = swallVerts[3].z = spr->z1; swallVerts[2].z = swallVerts[1].z = spr->z2; - if (spr->mobj && this_scale != 1.0f) + if (spr->mobj && fabsf(this_scale - 1.0f) > 1.0E-36f) { // Always a pixel above the floor, perfectly flat. swallVerts[0].y = swallVerts[1].y = swallVerts[2].y = swallVerts[3].y = spr->ty - gpatch->topoffset * this_scale - (floorheight+3); @@ -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 { @@ -4246,10 +4265,45 @@ 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 && !(spr->mobj->frame & FF_PAPERSPRITE) + && wallVerts) + { + float basey = FIXED_TO_FLOAT(spr->mobj->z); + float lowy = wallVerts[0].y; + if (P_MobjFlip(spr->mobj) == -1) + { + basey = FIXED_TO_FLOAT(spr->mobj->z + spr->mobj->height); + } + // Rotate sprites to fully billboard with the camera + // X, Y, AND Z need to be manipulated for the polys to rotate around the + // origin, because of how the origin setting works I believe that should + // be mobj->z or mobj->z + mobj->height + wallVerts[2].y = wallVerts[3].y = (spr->ty - basey) * gr_viewludsin + basey; + wallVerts[0].y = wallVerts[1].y = (lowy - basey) * gr_viewludsin + basey; + // translate back to be around 0 before translating back + wallVerts[3].x += ((spr->ty - basey) * gr_viewludcos) * gr_viewcos; + wallVerts[2].x += ((spr->ty - basey) * gr_viewludcos) * gr_viewcos; + + wallVerts[0].x += ((lowy - basey) * gr_viewludcos) * gr_viewcos; + wallVerts[1].x += ((lowy - basey) * gr_viewludcos) * gr_viewcos; + + wallVerts[3].z += ((spr->ty - basey) * gr_viewludcos) * gr_viewsin; + wallVerts[2].z += ((spr->ty - basey) * gr_viewludcos) * gr_viewsin; + + wallVerts[0].z += ((lowy - basey) * gr_viewludcos) * gr_viewsin; + wallVerts[1].z += ((lowy - basey) * gr_viewludcos) * gr_viewsin; + } +} + static void HWR_SplitSprite(gr_vissprite_t *spr) { float this_scale = 1.0f; FOutVector wallVerts[4]; + FOutVector baseWallVerts[4]; // This is what the verts should end up as GLPatch_t *gpatch; FSurfaceInfo Surf; const boolean hires = (spr->mobj && spr->mobj->skin && ((skin_t *)spr->mobj->skin)->flags & SF_HIRES); @@ -4262,11 +4316,13 @@ static void HWR_SplitSprite(gr_vissprite_t *spr) float realtop, realbot, top, bot; float towtop, towbot, towmult; float bheight; + float realheight, heightmult; const sector_t *sector = spr->mobj->subsector->sector; const lightlist_t *list = sector->lightlist; #ifdef ESLOPE float endrealtop, endrealbot, endtop, endbot; float endbheight; + float endrealheight; fixed_t temp; fixed_t v1x, v1y, v2x, v2y; #endif @@ -4299,16 +4355,16 @@ static void HWR_SplitSprite(gr_vissprite_t *spr) HWR_DrawSpriteShadow(spr, gpatch, this_scale); } - wallVerts[0].x = wallVerts[3].x = spr->x1; - wallVerts[2].x = wallVerts[1].x = spr->x2; - wallVerts[0].z = wallVerts[3].z = spr->z1; - wallVerts[1].z = wallVerts[2].z = spr->z2; + baseWallVerts[0].x = baseWallVerts[3].x = spr->x1; + baseWallVerts[2].x = baseWallVerts[1].x = spr->x2; + baseWallVerts[0].z = baseWallVerts[3].z = spr->z1; + baseWallVerts[1].z = baseWallVerts[2].z = spr->z2; - wallVerts[2].y = wallVerts[3].y = spr->ty; - if (spr->mobj && this_scale != 1.0f) - wallVerts[0].y = wallVerts[1].y = spr->ty - gpatch->height * this_scale; + baseWallVerts[2].y = baseWallVerts[3].y = spr->ty; + if (spr->mobj && fabsf(this_scale - 1.0f) > 1.0E-36f) + baseWallVerts[0].y = baseWallVerts[1].y = spr->ty - gpatch->height * this_scale; else - wallVerts[0].y = wallVerts[1].y = spr->ty - gpatch->height; + baseWallVerts[0].y = baseWallVerts[1].y = spr->ty - gpatch->height; v1x = FLOAT_TO_FIXED(spr->x1); v1y = FLOAT_TO_FIXED(spr->z1); @@ -4317,34 +4373,56 @@ static void HWR_SplitSprite(gr_vissprite_t *spr) if (spr->flip) { - wallVerts[0].sow = wallVerts[3].sow = gpatch->max_s; - wallVerts[2].sow = wallVerts[1].sow = 0; - }else{ - wallVerts[0].sow = wallVerts[3].sow = 0; - wallVerts[2].sow = wallVerts[1].sow = gpatch->max_s; + baseWallVerts[0].sow = baseWallVerts[3].sow = gpatch->max_s; + baseWallVerts[2].sow = baseWallVerts[1].sow = 0; + } + else + { + baseWallVerts[0].sow = baseWallVerts[3].sow = 0; + baseWallVerts[2].sow = baseWallVerts[1].sow = gpatch->max_s; } // flip the texture coords (look familiar?) if (spr->vflip) { - wallVerts[3].tow = wallVerts[2].tow = gpatch->max_t; - wallVerts[0].tow = wallVerts[1].tow = 0; - }else{ - wallVerts[3].tow = wallVerts[2].tow = 0; - wallVerts[0].tow = wallVerts[1].tow = gpatch->max_t; + baseWallVerts[3].tow = baseWallVerts[2].tow = gpatch->max_t; + baseWallVerts[0].tow = baseWallVerts[1].tow = 0; + } + else + { + baseWallVerts[3].tow = baseWallVerts[2].tow = 0; + baseWallVerts[0].tow = baseWallVerts[1].tow = gpatch->max_t; } - realtop = top = wallVerts[3].y; - realbot = bot = wallVerts[0].y; - towtop = wallVerts[3].tow; - towbot = wallVerts[0].tow; + // if it has a dispoffset, push it a little towards the camera + if (spr->dispoffset) { + float co = -gr_viewcos*(0.05f*spr->dispoffset); + float si = -gr_viewsin*(0.05f*spr->dispoffset); + baseWallVerts[0].z = baseWallVerts[3].z = baseWallVerts[0].z+si; + baseWallVerts[1].z = baseWallVerts[2].z = baseWallVerts[1].z+si; + baseWallVerts[0].x = baseWallVerts[3].x = baseWallVerts[0].x+co; + baseWallVerts[1].x = baseWallVerts[2].x = baseWallVerts[1].x+co; + } + + // Let dispoffset work first since this adjust each vertex + HWR_RotateSpritePolyToAim(spr, baseWallVerts); + + realtop = top = baseWallVerts[3].y; + realbot = bot = baseWallVerts[0].y; + towtop = baseWallVerts[3].tow; + towbot = baseWallVerts[0].tow; towmult = (towbot - towtop) / (top - bot); #ifdef ESLOPE - endrealtop = endtop = wallVerts[2].y; - endrealbot = endbot = wallVerts[1].y; + endrealtop = endtop = baseWallVerts[2].y; + endrealbot = endbot = baseWallVerts[1].y; #endif + // copy the contents of baseWallVerts into the drawn wallVerts array + // baseWallVerts is used to know the final shape to easily get the vertex + // co-ordinates + memcpy(wallVerts, baseWallVerts, sizeof(baseWallVerts)); + if (!cv_translucency.value) // translucency disabled { Surf.FlatColor.s.alpha = 0xFF; @@ -4371,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); @@ -4387,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; } } @@ -4395,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++) @@ -4411,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 @@ -4471,12 +4549,55 @@ static void HWR_SplitSprite(gr_vissprite_t *spr) wallVerts[2].y = endtop; wallVerts[0].y = bot; 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 && !(spr->mobj->frame & FF_PAPERSPRITE)) + { + // Get the x and z of the vertices so billboarding draws correctly + realheight = realbot - realtop; + endrealheight = endrealbot - endrealtop; + heightmult = (realtop - top) / realheight; + wallVerts[3].x = baseWallVerts[3].x + (baseWallVerts[3].x - baseWallVerts[0].x) * heightmult; + wallVerts[3].z = baseWallVerts[3].z + (baseWallVerts[3].z - baseWallVerts[0].z) * heightmult; + + heightmult = (endrealtop - endtop) / endrealheight; + wallVerts[2].x = baseWallVerts[2].x + (baseWallVerts[2].x - baseWallVerts[1].x) * heightmult; + wallVerts[2].z = baseWallVerts[2].z + (baseWallVerts[2].z - baseWallVerts[1].z) * heightmult; + + heightmult = (realtop - bot) / realheight; + wallVerts[0].x = baseWallVerts[3].x + (baseWallVerts[3].x - baseWallVerts[0].x) * heightmult; + wallVerts[0].z = baseWallVerts[3].z + (baseWallVerts[3].z - baseWallVerts[0].z) * heightmult; + + heightmult = (endrealtop - endbot) / endrealheight; + wallVerts[1].x = baseWallVerts[2].x + (baseWallVerts[2].x - baseWallVerts[1].x) * heightmult; + wallVerts[1].z = baseWallVerts[2].z + (baseWallVerts[2].z - baseWallVerts[1].z) * heightmult; + } #else wallVerts[3].tow = wallVerts[2].tow = towtop + ((realtop - top) * towmult); wallVerts[0].tow = wallVerts[1].tow = towtop + ((realtop - bot) * towmult); wallVerts[2].y = wallVerts[3].y = top; 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 && !(spr->mobj->frame & FF_PAPERSPRITE)) + { + // Get the x and z of the vertices so billboarding draws correctly + realheight = realbot - realtop; + heightmult = (realtop - top) / realheight; + wallVerts[3].x = baseWallVerts[3].x + (baseWallVerts[3].x - baseWallVerts[0].x) * heightmult; + wallVerts[3].z = baseWallVerts[3].z + (baseWallVerts[3].z - baseWallVerts[0].z) * heightmult; + wallVerts[2].x = baseWallVerts[2].x + (baseWallVerts[2].x - baseWallVerts[1].x) * heightmult; + wallVerts[2].z = baseWallVerts[2].z + (baseWallVerts[2].z - baseWallVerts[1].z) * heightmult; + + heightmult = (realtop - bot) / realheight; + wallVerts[0].x = baseWallVerts[3].x + (baseWallVerts[3].x - baseWallVerts[0].x) * heightmult; + wallVerts[0].z = baseWallVerts[3].z + (baseWallVerts[3].z - baseWallVerts[0].z) * heightmult; + wallVerts[1].x = baseWallVerts[2].x + (baseWallVerts[2].x - baseWallVerts[1].x) * heightmult; + wallVerts[1].z = baseWallVerts[2].z + (baseWallVerts[2].z - baseWallVerts[1].z) * heightmult; + } #endif if (colormap) @@ -4543,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) @@ -4585,7 +4707,7 @@ static void HWR_DrawSprite(gr_vissprite_t *spr) wallVerts[0].x = wallVerts[3].x = spr->x1; wallVerts[2].x = wallVerts[1].x = spr->x2; wallVerts[2].y = wallVerts[3].y = spr->ty; - if (spr->mobj && this_scale != 1.0f) + if (spr->mobj && fabsf(this_scale - 1.0f) > 1.0E-36f) wallVerts[0].y = wallVerts[1].y = spr->ty - gpatch->height * this_scale; else wallVerts[0].y = wallVerts[1].y = spr->ty - gpatch->height; @@ -4635,6 +4757,19 @@ static void HWR_DrawSprite(gr_vissprite_t *spr) HWR_DrawSpriteShadow(spr, gpatch, this_scale); } + // if it has a dispoffset, push it a little towards the camera + if (spr->dispoffset) { + float co = -gr_viewcos*(0.05f*spr->dispoffset); + float si = -gr_viewsin*(0.05f*spr->dispoffset); + wallVerts[0].z = wallVerts[3].z = wallVerts[0].z+si; + wallVerts[1].z = wallVerts[2].z = wallVerts[1].z+si; + wallVerts[0].x = wallVerts[3].x = wallVerts[0].x+co; + wallVerts[1].x = wallVerts[2].x = wallVerts[1].x+co; + } + + // Let dispoffset work first since this adjust each vertex + HWR_RotateSpritePolyToAim(spr, wallVerts); + // This needs to be AFTER the shadows so that the regular sprites aren't drawn completely black. // sprite lighting by modulating the RGB components /// \todo coloured @@ -4716,6 +4851,9 @@ static inline void HWR_DrawPrecipitationSprite(gr_vissprite_t *spr) wallVerts[0].z = wallVerts[3].z = spr->z1; wallVerts[1].z = wallVerts[2].z = spr->z2; + // Let dispoffset work first since this adjust each vertex + HWR_RotateSpritePolyToAim(spr, wallVerts); + wallVerts[0].sow = wallVerts[3].sow = 0; wallVerts[2].sow = wallVerts[1].sow = gpatch->max_s; @@ -4742,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 { @@ -4831,7 +4969,7 @@ static void HWR_SortVisSprites(void) best = ds; } // order visprites of same scale by dispoffset, smallest first - else if (ds->tz == bestdist && ds->dispoffset < bestdispoffset) + else if (fabsf(ds->tz - bestdist) < 1.0E-36f && ds->dispoffset < bestdispoffset) { bestdispoffset = ds->dispoffset; best = ds; @@ -4938,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 { @@ -5295,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) @@ -5311,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 } @@ -5332,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; @@ -5341,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; @@ -5357,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_grmd2.value || md2_models[thing->sprite].notfound == true)) //Yellow: Only MD2's dont disappear + if (tz < ZCLIP_PLANE && !papersprite && (!cv_grmd2.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 @@ -5374,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]; @@ -5397,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); @@ -5430,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; @@ -5474,18 +5651,18 @@ 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" + if ((vis->mobj->flags & MF_BOSS) && (vis->mobj->flags2 & MF2_FRET) && !(vis->mobj->flags & MF_GRENADEBOUNCE) && (leveltime & 1)) // Bosses "flash" { - if (vis->mobj->type == MT_CYBRAKDEMON) + if (vis->mobj->type == MT_CYBRAKDEMON || vis->mobj->colorized) vis->colormap = R_GetTranslationColormap(TC_ALLWHITE, 0, GTC_CACHE); else if (vis->mobj->type == MT_METALSONIC_BATTLE) vis->colormap = R_GetTranslationColormap(TC_METALSONIC, 0, GTC_CACHE); @@ -5495,7 +5672,9 @@ static void HWR_ProjectSprite(mobj_t *thing) else if (thing->color) { // New colormap stuff for skins Tails 06-07-2002 - if (thing->skin && thing->sprite == SPR_PLAY) // This thing is a player! + if (thing->colorized) + vis->colormap = R_GetTranslationColormap(TC_RAINBOW, thing->color, GTC_CACHE); + else if (thing->skin && thing->sprite == SPR_PLAY) // This thing is a player! { size_t skinnum = (skin_t*)thing->skin-skins; vis->colormap = R_GetTranslationColormap((INT32)skinnum, thing->color, GTC_CACHE); @@ -5512,10 +5691,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; } @@ -5593,16 +5769,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 // @@ -5623,6 +5789,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 @@ -5637,7 +5813,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 @@ -5663,14 +5839,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) { @@ -5683,13 +5861,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; @@ -5752,7 +5930,7 @@ void HWR_SetViewSize(void) gr_viewwindowx = (vid.width - gr_viewwidth) / 2; gr_windowcenterx = (float)(vid.width / 2); - if (gr_viewwidth == vid.width) + if (fabsf(gr_viewwidth - vid.width) < 1.0E-36f) { gr_baseviewwindowy = 0; gr_basewindowcentery = gr_viewheight / 2; // window top left corner at 0,0 @@ -6011,7 +6189,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); // copy view cam position for local use dup_viewx = viewx; @@ -6322,12 +6500,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 b0a14d3b5..f8524990f 100644 --- a/src/hardware/hw_main.h +++ b/src/hardware/hw_main.h @@ -31,29 +31,31 @@ void HWR_Startup(void); void HWR_Shutdown(void); -void HWR_clearAutomap(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); void HWR_DrawFlatFill(INT32 x, INT32 y, INT32 w, INT32 h, lumpnum_t flatlumpnum); -UINT8 *HWR_GetScreenshot(void); -boolean HWR_Screenshot(const char *lbmname); void HWR_InitTextureMapping(void); 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); void HWR_DrawFill(INT32 x, INT32 y, INT32 w, INT32 h, INT32 color); +void HWR_DrawFadeFill(INT32 x, INT32 y, INT32 w, INT32 h, INT32 color, UINT16 actualcolor, UINT8 strength); +void HWR_DrawConsoleFill(INT32 x, INT32 y, INT32 w, INT32 h, INT32 color, UINT32 actualcolor); // Lat: separate flags from color since color needs to be an uint to work right. void HWR_DrawPic(INT32 x,INT32 y,lumpnum_t lumpnum); +UINT8 *HWR_GetScreenshot(void); +boolean HWR_Screenshot(const char *pathname); + void HWR_AddCommands(void); void HWR_CorrectSWTricks(void); void transform(float *cx, float *cy, float *cz); @@ -95,6 +97,7 @@ extern consvar_t cv_grcorrecttricks; extern consvar_t cv_voodoocompatibility; extern consvar_t cv_grfovchange; extern consvar_t cv_grsolvetjoin; +extern consvar_t cv_grspritebillboarding; extern float gr_viewwidth, gr_viewheight, gr_baseviewwindowy; @@ -104,13 +107,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 cb33562d8..d4728315a 100644 --- a/src/hardware/hw_md2.c +++ b/src/hardware/hw_md2.c @@ -28,18 +28,20 @@ #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" #include "../w_wad.h" #include "../z_zone.h" #include "../r_things.h" +#include "../r_draw.h" +#include "../p_tick.h" #include "hw_main.h" #include "../v_video.h" @@ -68,10 +70,6 @@ #endif #endif -#ifndef errno -#include "errno.h" -#endif - #define NUMVERTEXNORMALS 162 float avertexnormals[NUMVERTEXNORMALS][3] = { {-0.525731f, 0.000000f, 0.850651f}, @@ -270,6 +268,9 @@ static void md2_freeModel (md2_model_t *model) free(model->frames); } + if (model->spr2frames) + free(model->spr2frames); + if (model->glCommandBuffer) free(model->glCommandBuffer); @@ -293,8 +294,7 @@ static md2_model_t *md2_readModel(const char *filename) if (model == NULL) return 0; - //Filename checking fixed ~Monster Iestyn and Golden - file = fopen(va("%s"PATHSEP"%s", srb2home, filename), "rb"); + file = fopen(filename, "rb"); if (!file) { free(model); @@ -401,6 +401,39 @@ static md2_model_t *md2_readModel(const char *filename) } strcpy(model->frames[i].name, frame->name); + if (frame->name[0] == 'S') + { + boolean super; + if ((super = (fastncmp("UPER", frame->name+1, 4))) // SUPER + || fastncmp("PR2_", frame->name+1, 4)) // SPR2_ + { + UINT8 spr2; + for (spr2 = 0; spr2 < free_spr2; spr2++) + if (fastncmp(frame->name+5,spr2names[spr2],3) + && ((frame->name[8] == spr2names[spr2][3]) + || (frame->name[8] == '.' && spr2names[spr2][3] == '_'))) + break; + + if (spr2 < free_spr2) + { + if (!model->spr2frames) + { + model->spr2frames = calloc(sizeof (size_t), 2*NUMPLAYERSPRITES*2); + if (!model->spr2frames) + { + md2_freeModel (model); + fclose(file); + return 0; + } + } + if (super) + spr2 |= FF_SPR2SUPER; + if (model->spr2frames[spr2*2 + 1]++ == 0) // numspr2frames + model->spr2frames[spr2*2] = i; // starting frame + CONS_Debug(DBG_RENDER, "frame %s, sprite2 %s - starting frame %s, number of frames %s\n", frame->name, spr2names[spr2 & ~FF_SPR2SUPER], sizeu1(model->spr2frames[spr2*2]), sizeu2(model->spr2frames[spr2*2 + 1])); + } + } + } for (j = 0; j < model->header.numVertices; j++) { model->frames[i].vertices[j].vertex[0] = (float) ((INT32) frame->alias_vertices[j].vertex[0]) * frame->scale[0] + frame->translate[0]; @@ -490,8 +523,7 @@ static GrTextureFormat_t PNG_Load(const char *filename, int *w, int *h, GLPatch_ #endif #endif png_FILE_p png_FILE; - //Filename checking fixed ~Monster Iestyn and Golden - char *pngfilename = va("%s"PATHSEP"md2"PATHSEP"%s", srb2home, filename); + char *pngfilename = va("md2/%s", filename); FIL_ForceExtension(pngfilename, ".png"); png_FILE = fopen(pngfilename, "rb"); @@ -619,8 +651,7 @@ static GrTextureFormat_t PCX_Load(const char *filename, int *w, int *h, size_t pw, ph, size, ptr = 0; INT32 ch, rep; FILE *file; - //Filename checking fixed ~Monster Iestyn and Golden - char *pcxfilename = va("%s"PATHSEP"md2"PATHSEP"%s", srb2home, filename); + char *pcxfilename = va("md2/%s", filename); FIL_ForceExtension(pcxfilename, ".pcx"); file = fopen(pcxfilename, "rb"); @@ -810,12 +841,11 @@ void HWR_InitMD2(void) } // read the md2.dat file - //Filename checking fixed ~Monster Iestyn and Golden - f = fopen(va("%s"PATHSEP"%s", srb2home, "md2.dat"), "rt"); + f = fopen("md2.dat", "rt"); if (!f) { - CONS_Printf("%s %s\n", M_GetText("Error while loading md2.dat:"), strerror(errno)); + CONS_Printf("%s", M_GetText("Error while loading md2.dat\n")); nomd2s = true; return; } @@ -877,8 +907,7 @@ void HWR_AddPlayerMD2(int skin) // For MD2's that were added after startup CONS_Printf("AddPlayerMD2()...\n"); // read the md2.dat file - //Filename checking fixed ~Monster Iestyn and Golden - f = fopen(va("%s"PATHSEP"%s", srb2home, "md2.dat"), "rt"); + f = fopen("md2.dat", "rt"); if (!f) { @@ -923,8 +952,7 @@ void HWR_AddSpriteMD2(size_t spritenum) // For MD2s that were added after startu return; // Read the md2.dat file - //Filename checking fixed ~Monster Iestyn and Golden - f = fopen(va("%s"PATHSEP"%s", srb2home, "md2.dat"), "rt"); + f = fopen("md2.dat", "rt"); if (!f) { @@ -952,8 +980,18 @@ spritemd2found: fclose(f); } -static void HWR_CreateBlendedTexture(GLPatch_t *gpatch, GLPatch_t *blendgpatch, GLMipmap_t *grmip, skincolors_t color) +// Define for getting accurate color brightness readings according to how the human eye sees them. +// https://en.wikipedia.org/wiki/Relative_luminance +// 0.2126 to red +// 0.7152 to green +// 0.0722 to blue +// (See this same define in k_kart.c!) +#define SETBRIGHTNESS(brightness,r,g,b) \ + brightness = (UINT8)(((1063*((UINT16)r)/5000) + (3576*((UINT16)g)/5000) + (361*((UINT16)b)/5000)) / 3) + +static void HWR_CreateBlendedTexture(GLPatch_t *gpatch, GLPatch_t *blendgpatch, GLMipmap_t *grmip, INT32 skinnum, skincolors_t color) { + UINT8 i; UINT16 w = gpatch->width, h = gpatch->height; UINT32 size = w*h; RGBA_t *image, *blendimage, *cur, blendcolor; @@ -979,175 +1017,112 @@ static void HWR_CreateBlendedTexture(GLPatch_t *gpatch, GLPatch_t *blendgpatch, image = gpatch->mipmap.grInfo.data; blendimage = blendgpatch->mipmap.grInfo.data; - switch (color) + // Average all of the translation's colors + if (color == SKINCOLOR_NONE || color >= MAXTRANSLATIONS) + blendcolor = V_GetColor(0xff); + else { - 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; + const UINT8 div = 6; + const UINT8 start = 4; + UINT32 r, g, b; - 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; + blendcolor = V_GetColor(Color_Index[color-1][start]); + r = (UINT32)(blendcolor.s.red*blendcolor.s.red); + g = (UINT32)(blendcolor.s.green*blendcolor.s.green); + b = (UINT32)(blendcolor.s.blue*blendcolor.s.blue); - 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; + for (i = 1; i < div; i++) + { + RGBA_t nextcolor = V_GetColor(Color_Index[color-1][start+i]); + r += (UINT32)(nextcolor.s.red*nextcolor.s.red); + g += (UINT32)(nextcolor.s.green*nextcolor.s.green); + b += (UINT32)(nextcolor.s.blue*nextcolor.s.blue); + } - 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; + blendcolor.s.red = (UINT8)(FixedSqrt((r/div)<>FRACBITS); + blendcolor.s.green = (UINT8)(FixedSqrt((g/div)<>FRACBITS); + blendcolor.s.blue = (UINT8)(FixedSqrt((b/div)<>FRACBITS); } - while (size--) + // rainbow support, could theoretically support boss ones too + if (skinnum == TC_RAINBOW) { - if (blendimage->s.alpha == 0) + while (size--) { - // Don't bother with blending the pixel if the alpha of the blend pixel is 0 - cur->rgba = image->rgba; + if (image->s.alpha == 0 && blendimage->s.alpha == 0) + { + // Don't bother with blending the pixel if the alpha of the blend pixel is 0 + cur->rgba = image->rgba; + } + else + { + UINT32 tempcolor; + UINT16 imagebright, blendbright, finalbright, colorbright; + SETBRIGHTNESS(imagebright,image->s.red,image->s.green,image->s.blue); + SETBRIGHTNESS(blendbright,blendimage->s.red,blendimage->s.green,blendimage->s.blue); + // slightly dumb average between the blend image color and base image colour, usually one or the other will be fully opaque anyway + finalbright = (imagebright*(255-blendimage->s.alpha))/255 + (blendbright*blendimage->s.alpha)/255; + SETBRIGHTNESS(colorbright,blendcolor.s.red,blendcolor.s.green,blendcolor.s.blue); + + tempcolor = (finalbright*blendcolor.s.red)/colorbright; + tempcolor = min(255, tempcolor); + cur->s.red = (UINT8)tempcolor; + tempcolor = (finalbright*blendcolor.s.green)/colorbright; + tempcolor = min(255, tempcolor); + cur->s.green = (UINT8)tempcolor; + tempcolor = (finalbright*blendcolor.s.blue)/colorbright; + tempcolor = min(255, tempcolor); + cur->s.blue = (UINT8)tempcolor; + cur->s.alpha = image->s.alpha; + } + + cur++; image++; blendimage++; } - else + } + else + { + while (size--) { - INT32 tempcolor; - INT16 tempmult, tempalpha; - tempalpha = -(abs(blendimage->s.red-127)-127)*2; - if (tempalpha > 255) - tempalpha = 255; - else if (tempalpha < 0) - tempalpha = 0; + if (blendimage->s.alpha == 0) + { + // Don't bother with blending the pixel if the alpha of the blend pixel is 0 + cur->rgba = image->rgba; + } + else + { + INT32 tempcolor; + INT16 tempmult, tempalpha; + tempalpha = -(abs(blendimage->s.red-127)-127)*2; + if (tempalpha > 255) + tempalpha = 255; + else if (tempalpha < 0) + tempalpha = 0; - tempmult = (blendimage->s.red-127)*2; - if (tempmult > 255) - tempmult = 255; - else if (tempmult < 0) - tempmult = 0; + tempmult = (blendimage->s.red-127)*2; + if (tempmult > 255) + tempmult = 255; + else if (tempmult < 0) + tempmult = 0; - tempcolor = (image->s.red*(255-blendimage->s.alpha))/255 + ((tempmult + ((tempalpha*blendcolor.s.red)/255)) * blendimage->s.alpha)/255; - cur->s.red = (UINT8)tempcolor; - tempcolor = (image->s.green*(255-blendimage->s.alpha))/255 + ((tempmult + ((tempalpha*blendcolor.s.green)/255)) * blendimage->s.alpha)/255; - cur->s.green = (UINT8)tempcolor; - tempcolor = (image->s.blue*(255-blendimage->s.alpha))/255 + ((tempmult + ((tempalpha*blendcolor.s.blue)/255)) * blendimage->s.alpha)/255; - cur->s.blue = (UINT8)tempcolor; - cur->s.alpha = image->s.alpha; + tempcolor = (image->s.red*(255-blendimage->s.alpha))/255 + ((tempmult + ((tempalpha*blendcolor.s.red)/255)) * blendimage->s.alpha)/255; + cur->s.red = (UINT8)tempcolor; + tempcolor = (image->s.green*(255-blendimage->s.alpha))/255 + ((tempmult + ((tempalpha*blendcolor.s.green)/255)) * blendimage->s.alpha)/255; + cur->s.green = (UINT8)tempcolor; + tempcolor = (image->s.blue*(255-blendimage->s.alpha))/255 + ((tempmult + ((tempalpha*blendcolor.s.blue)/255)) * blendimage->s.alpha)/255; + cur->s.blue = (UINT8)tempcolor; + cur->s.alpha = image->s.alpha; + } + + cur++; image++; blendimage++; } - - cur++; image++; blendimage++; } return; } -static void HWR_GetBlendedTexture(GLPatch_t *gpatch, GLPatch_t *blendgpatch, const UINT8 *colormap, skincolors_t color) +#undef SETBRIGHTNESS + +static void HWR_GetBlendedTexture(GLPatch_t *gpatch, GLPatch_t *blendgpatch, INT32 skinnum, const UINT8 *colormap, skincolors_t color) { // mostly copied from HWR_GetMappedPatch, hence the similarities and comment GLMipmap_t *grmip, *newmip; @@ -1188,13 +1163,14 @@ static void HWR_GetBlendedTexture(GLPatch_t *gpatch, GLPatch_t *blendgpatch, con grmip->nextcolormap = newmip; newmip->colormap = colormap; - HWR_CreateBlendedTexture(gpatch, blendgpatch, newmip, color); + HWR_CreateBlendedTexture(gpatch, blendgpatch, newmip, skinnum, color); HWD.pfnSetTexture(newmip); Z_ChangeTag(newmip->grInfo.data, PU_HWRCACHE_UNLOCKED); } + // -----------------+ // HWR_DrawMD2 : Draw MD2 // : (monsters, bonuses, weapons, lights, ...) @@ -1214,6 +1190,58 @@ 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; + + if ((unsigned)(spr2 & ~FF_SPR2SUPER) >= free_spr2) + 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 + : skin->ability) + == 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; + } + + if (i >= 32) // probably an infinite loop... + return 0; + + return spr2; +} + #define NORMALFOG 0x00000000 #define FADEFOG 0x19000000 void HWR_DrawMD2(gr_vissprite_t *spr) @@ -1248,8 +1276,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 { @@ -1273,7 +1301,7 @@ void HWR_DrawMD2(gr_vissprite_t *spr) INT32 durs = spr->mobj->state->tics; INT32 tics = spr->mobj->tics; md2_frame_t *curr, *next = NULL; - const UINT8 flip = (UINT8)((spr->mobj->eflags & MFE_VERTICALFLIP) == MFE_VERTICALFLIP); + const UINT8 flip = (UINT8)(!(spr->mobj->eflags & MFE_VERTICALFLIP) != !(spr->mobj->frame & FF_VERTICALFLIP)); spritedef_t *sprdef; spriteframe_t *sprframe; float finalscale; @@ -1339,7 +1367,30 @@ void HWR_DrawMD2(gr_vissprite_t *spr) md2->blendgrpatch && ((GLPatch_t *)md2->blendgrpatch)->mipmap.grInfo.format && gpatch->width == ((GLPatch_t *)md2->blendgrpatch)->width && gpatch->height == ((GLPatch_t *)md2->blendgrpatch)->height) { - HWR_GetBlendedTexture(gpatch, (GLPatch_t *)md2->blendgrpatch, spr->colormap, (skincolors_t)spr->mobj->color); + INT32 skinnum = TC_DEFAULT; + if ((spr->mobj->flags & (MF_ENEMY|MF_BOSS)) && (spr->mobj->flags2 & MF2_FRET) && !(spr->mobj->flags & MF_GRENADEBOUNCE) && (leveltime & 1)) // Bosses "flash" + { + if (spr->mobj->type == MT_CYBRAKDEMON || spr->mobj->colorized) + skinnum = TC_ALLWHITE; + else if (spr->mobj->type == MT_METALSONIC_BATTLE) + skinnum = TC_METALSONIC; + else + skinnum = TC_BOSS; + } + else if (spr->mobj->color) + { + if (spr->mobj->skin && spr->mobj->sprite == SPR_PLAY) + { + if (spr->mobj->colorized) + skinnum = TC_RAINBOW; + else + { + skinnum = (INT32)((skin_t*)spr->mobj->skin-skins); + } + } + else skinnum = TC_DEFAULT; + } + HWR_GetBlendedTexture(gpatch, (GLPatch_t *)md2->blendgrpatch, skinnum, spr->colormap, (skincolors_t)spr->mobj->color); } else { @@ -1361,43 +1412,82 @@ void HWR_DrawMD2(gr_vissprite_t *spr) tics = spr->mobj->anim_duration; } - //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) +#define INTERPOLERATION_LIMIT TICRATE/4 + + if (spr->mobj->skin && spr->mobj->sprite == SPR_PLAY && md2->model->spr2frames) { - // 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) { - 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]; - } - 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)) { - const UINT32 nextframe = (states[spr->mobj->state->nextstate].frame & FF_FRAMEMASK) % md2->model->header.numFrames; - next = &md2->model->frames[nextframe]; + if (++frame >= mod) + frame = 0; + if (frame || !(spr->mobj->state->frame & FF_SPR2ENDSTATE)) + next = &md2->model->frames[md2->model->spr2frames[spr2*2] + frame]; } } } + 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) + { + 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]; + } + 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]; + } + } + } + } + +#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]; @@ -1405,7 +1495,7 @@ void HWR_DrawMD2(gr_vissprite_t *spr) if (sprframe->rotate) { - const fixed_t anglef = AngleFixed(spr->mobj->angle); + 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/hw_md2.h b/src/hardware/hw_md2.h index 299d12400..24a563933 100644 --- a/src/hardware/hw_md2.h +++ b/src/hardware/hw_md2.h @@ -22,6 +22,12 @@ #define _HW_MD2_H_ #include "hw_glob.h" +#include "../info.h" + +// magic number "IDP2" or 844121161 +#define MD2_IDENT (INT32)(('2' << 24) + ('P' << 16) + ('D' << 8) + 'I') +// model version +#define MD2_VERSION 8 // magic number "IDP2" or 844121161 #define MD2_IDENT (INT32)(('2' << 24) + ('P' << 16) + ('D' << 8) + 'I') @@ -111,7 +117,8 @@ typedef struct md2_textureCoordinate_t *texCoords; md2_triangle_t *triangles; md2_frame_t *frames; - INT32 *glCommandBuffer; + size_t *spr2frames; // size_t spr2frames[2*NUMPLAYERSPRITES][2]; + INT32 *glCommandBuffer; } ATTRPACK md2_model_t; #if defined(_MSC_VER) 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-vc10.vcxproj b/src/hardware/r_opengl/r_opengl-vc10.vcxproj index f04ae320b..d1f856e96 100644 --- a/src/hardware/r_opengl/r_opengl-vc10.vcxproj +++ b/src/hardware/r_opengl/r_opengl-vc10.vcxproj @@ -1,6 +1,14 @@  + + Debug + ARM + + + Debug + ARM64 + Debug Win32 @@ -9,6 +17,14 @@ Debug x64 + + Release + ARM + + + Release + ARM64 + Release Win32 @@ -22,7 +38,7 @@ r_opengl {51137D5C-4E81-4955-AACF-EA3092006051} r_opengl - 8.1 + 10.0.16299.0 @@ -30,21 +46,45 @@ false v140 + + DynamicLibrary + false + v141 + true + DynamicLibrary false v140 + + DynamicLibrary + false + v141 + true + DynamicLibrary false v140 + + DynamicLibrary + false + v141 + true + DynamicLibrary false v140 + + DynamicLibrary + false + v141 + true + @@ -52,37 +92,69 @@ + + + + + + + + + + + + + + + + <_ProjectFileVersion>10.0.30319.1 .\..\..\..\bin\VC10\$(Platform)\$(Configuration)\ + .\..\..\..\bin\VC10\$(Platform)\$(Configuration)\ .\..\..\..\objs\VC10\$(Platform)\$(Configuration)\r_opengl\ + .\..\..\..\objs\VC10\$(Platform)\$(Configuration)\r_opengl\ true + true true + true .\..\..\..\bin\VC10\$(Platform)\$(Configuration)\ + .\..\..\..\bin\VC10\$(Platform)\$(Configuration)\ .\..\..\..\objs\VC10\$(Platform)\$(Configuration)\r_opengl\ + .\..\..\..\objs\VC10\$(Platform)\$(Configuration)\r_opengl\ true + true true + true .\..\..\..\bin\VC10\$(Platform)\$(Configuration)\ + .\..\..\..\bin\VC10\$(Platform)\$(Configuration)\ .\..\..\..\objs\VC10\$(Platform)\$(Configuration)\r_opengl\ + .\..\..\..\objs\VC10\$(Platform)\$(Configuration)\r_opengl\ true + true false + false .\..\..\..\bin\VC10\$(Platform)\$(Configuration)\ + .\..\..\..\bin\VC10\$(Platform)\$(Configuration)\ .\..\..\..\objs\VC10\$(Platform)\$(Configuration)\r_opengl\ + .\..\..\..\objs\VC10\$(Platform)\$(Configuration)\r_opengl\ true + true false + false @@ -123,6 +195,49 @@ $(IntDir)r_opengl.lib MachineX86 Windows + gdi32.lib;%(AdditionalDependencies) + + + true + $(OutDir)r_opengl.bsc + + + + + _DEBUG;%(PreprocessorDefinitions) + true + true + .\..\..\..\bin\VC10\$(Platform)\$(Configuration)\r_opengl\r_opengl.tlb + + + + + Disabled + _DEBUG;WIN32;_WINDOWS;__WIN32__;__MSC__;USE_WGL_SWAP;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) + EnableFastChecks + MultiThreadedDebug + $(IntDir) + $(IntDir)r_opengl.pdb + true + Level4 + true + ProgramDatabase + CompileAsC + + + _DEBUG;%(PreprocessorDefinitions) + 0x0409 + + + $(OutDir)r_opengl.dll + true + true + $(OutDir)r_opengl.pdb + + + $(IntDir)r_opengl.lib + Windows + gdi32.lib;%(AdditionalDependencies) true @@ -168,6 +283,49 @@ $(IntDir)r_opengl.lib MachineX64 Windows + gdi32.lib;%(AdditionalDependencies) + + + true + $(OutDir)r_opengl.bsc + + + + + _DEBUG;%(PreprocessorDefinitions) + true + true + .\..\..\..\bin\VC10\$(Platform)\$(Configuration)\r_opengl\r_opengl.tlb + + + + + Disabled + _DEBUG;WIN32;_WINDOWS;__WIN32__;__MSC__;USE_WGL_SWAP;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) + EnableFastChecks + MultiThreadedDebug + $(IntDir) + $(IntDir)r_opengl.pdb + true + Level4 + true + ProgramDatabase + CompileAsC + + + _DEBUG;%(PreprocessorDefinitions) + 0x0409 + + + $(OutDir)r_opengl.dll + true + true + $(OutDir)r_opengl.pdb + + + $(IntDir)r_opengl.lib + Windows + gdi32.lib;%(AdditionalDependencies) true @@ -215,6 +373,52 @@ $(IntDir)r_opengl.lib MachineX86 Windows + gdi32.lib;%(AdditionalDependencies) + + + true + $(OutDir)r_opengl.bsc + + + + + NDEBUG;%(PreprocessorDefinitions) + true + true + .\..\..\..\bin\VC10\$(Platform)\$(Configuration)\r_opengl\r_opengl.tlb + + + + + /MP %(AdditionalOptions) + MaxSpeed + OnlyExplicitInline + NDEBUG;WIN32;_WINDOWS;__WIN32__;__MSC__;USE_WGL_SWAP;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) + true + MultiThreaded + true + $(IntDir) + $(IntDir)r_opengl.pdb + true + Level3 + true + ProgramDatabase + CompileAsC + + + NDEBUG;%(PreprocessorDefinitions) + 0x0409 + + + $(OutDir)r_opengl.dll + true + true + $(OutDir)r_opengl.pdb + + + $(IntDir)r_opengl.lib + Windows + gdi32.lib;%(AdditionalDependencies) true @@ -262,6 +466,52 @@ $(IntDir)r_opengl.lib MachineX64 Windows + gdi32.lib;%(AdditionalDependencies) + + + true + $(OutDir)r_opengl.bsc + + + + + NDEBUG;%(PreprocessorDefinitions) + true + true + .\..\..\..\bin\VC10\$(Platform)\$(Configuration)\r_opengl\r_opengl.tlb + + + + + /MP %(AdditionalOptions) + MaxSpeed + OnlyExplicitInline + NDEBUG;WIN32;_WINDOWS;__WIN32__;__MSC__;USE_WGL_SWAP;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) + true + MultiThreaded + true + $(IntDir) + $(IntDir)r_opengl.pdb + true + Level3 + true + ProgramDatabase + CompileAsC + + + NDEBUG;%(PreprocessorDefinitions) + 0x0409 + + + $(OutDir)r_opengl.dll + true + true + $(OutDir)r_opengl.pdb + + + $(IntDir)r_opengl.lib + Windows + gdi32.lib;%(AdditionalDependencies) true @@ -271,15 +521,23 @@ %(PreprocessorDefinitions) + %(PreprocessorDefinitions) %(PreprocessorDefinitions) + %(PreprocessorDefinitions) %(PreprocessorDefinitions) + %(PreprocessorDefinitions) %(PreprocessorDefinitions) + %(PreprocessorDefinitions) %(PreprocessorDefinitions) + %(PreprocessorDefinitions) %(PreprocessorDefinitions) + %(PreprocessorDefinitions) %(PreprocessorDefinitions) + %(PreprocessorDefinitions) %(PreprocessorDefinitions) + %(PreprocessorDefinitions) diff --git a/src/hardware/r_opengl/r_opengl.c b/src/hardware/r_opengl/r_opengl.c index 2d9f42192..dfee19857 100644 --- a/src/hardware/r_opengl/r_opengl.c +++ b/src/hardware/r_opengl/r_opengl.c @@ -30,10 +30,8 @@ #include #include #ifndef SHUFFLE -#ifndef KOS_GL_COMPATIBILITY #define SHUFFLE #endif -#endif #include "r_opengl.h" #if defined (HWRENDER) && !defined (NOROPENGL) @@ -83,9 +81,7 @@ GLint screen_height = 0; GLbyte screen_depth = 0; GLint textureformatGL = 0; GLint maximumAnisotropy = 0; -#ifndef KOS_GL_COMPATIBILITY static GLboolean MipMap = GL_FALSE; -#endif static GLint min_filter = GL_LINEAR; static GLint mag_filter = GL_LINEAR; static GLint anisotropic_filter = 0; @@ -94,11 +90,9 @@ static FTransform md2_transform; const GLubyte *gl_extensions = NULL; //Hurdler: 04/10/2000: added for the kick ass coronas as Boris wanted;-) -#ifndef MINI_GL_COMPATIBILITY static GLdouble modelMatrix[16]; static GLdouble projMatrix[16]; static GLint viewport[4]; -#endif #ifdef USE_PALETTED_TEXTURE @@ -167,9 +161,7 @@ float byteasfloat(UINT8 fbyte) static I_Error_t I_Error_GL = NULL; -#ifndef MINI_GL_COMPATIBILITY static boolean gl13 = false; // whether we can use opengl 1.3 functions -#endif // -----------------+ @@ -207,14 +199,9 @@ FUNCPRINTF void DBG_Printf(const char *lpFmt, ...) #define pglScissor glScissor #define pglEnable glEnable #define pglDisable glDisable -#ifndef MINI_GL_COMPATIBILITY #define pglGetDoublev glGetDoublev -#endif //glGetIntegerv //glGetString -#ifdef KOS_GL_COMPATIBILITY -#define pglHint glHint -#endif /* Depth Buffer */ #define pglClearDepth glClearDepth @@ -228,11 +215,7 @@ FUNCPRINTF void DBG_Printf(const char *lpFmt, ...) #define pglPushMatrix glPushMatrix #define pglPopMatrix glPopMatrix #define pglLoadIdentity glLoadIdentity -#ifdef MINI_GL_COMPATIBILITY -#define pglMultMatrixf glMultMatrixf -#else #define pglMultMatrixd glMultMatrixd -#endif #define pglRotatef glRotatef #define pglScalef glScalef #define pglTranslatef glTranslatef @@ -270,10 +253,8 @@ FUNCPRINTF void DBG_Printf(const char *lpFmt, ...) #define pglDeleteTextures glDeleteTextures #define pglBindTexture glBindTexture /* texture mapping */ //GL_EXT_copy_texture -#ifndef KOS_GL_COMPATIBILITY #define pglCopyTexImage2D glCopyTexImage2D #define pglCopyTexSubImage2D glCopyTexSubImage2D -#endif #else //!STATIC_OPENGL @@ -300,10 +281,8 @@ typedef void (APIENTRY * PFNglEnable) (GLenum cap); static PFNglEnable pglEnable; typedef void (APIENTRY * PFNglDisable) (GLenum cap); static PFNglDisable pglDisable; -#ifndef MINI_GL_COMPATIBILITY typedef void (APIENTRY * PFNglGetDoublev) (GLenum pname, GLdouble *params); static PFNglGetDoublev pglGetDoublev; -#endif //glGetIntegerv //glGetString @@ -328,13 +307,8 @@ typedef void (APIENTRY * PFNglPopMatrix) (void); static PFNglPopMatrix pglPopMatrix; typedef void (APIENTRY * PFNglLoadIdentity) (void); static PFNglLoadIdentity pglLoadIdentity; -#ifdef MINI_GL_COMPATIBILITY -typedef void (APIENTRY * PFNglMultMatrixf) (const GLfloat *m); -static PFNglMultMatrixf pglMultMatrixf; -#else typedef void (APIENTRY * PFNglMultMatrixd) (const GLdouble *m); static PFNglMultMatrixd pglMultMatrixd; -#endif typedef void (APIENTRY * PFNglRotatef) (GLfloat angle, GLfloat x, GLfloat y, GLfloat z); static PFNglRotatef pglRotatef; typedef void (APIENTRY * PFNglScalef) (GLfloat x, GLfloat y, GLfloat z); @@ -404,15 +378,12 @@ static PFNglCopyTexSubImage2D pglCopyTexSubImage2D; typedef GLint (APIENTRY * PFNgluBuild2DMipmaps) (GLenum target, GLint internalFormat, GLsizei width, GLsizei height, GLenum format, GLenum type, const void *data); static PFNgluBuild2DMipmaps pgluBuild2DMipmaps; -#ifndef MINI_GL_COMPATIBILITY /* 1.3 functions for multitexturing */ typedef void (APIENTRY *PFNglActiveTexture) (GLenum); static PFNglActiveTexture pglActiveTexture; typedef void (APIENTRY *PFNglMultiTexCoord2f) (GLenum, GLfloat, GLfloat); static PFNglMultiTexCoord2f pglMultiTexCoord2f; -#endif -#ifndef MINI_GL_COMPATIBILITY /* 1.2 Parms */ /* GL_CLAMP_TO_EDGE_EXT */ #ifndef GL_CLAMP_TO_EDGE @@ -433,14 +404,6 @@ static PFNglMultiTexCoord2f pglMultiTexCoord2f; #define GL_TEXTURE1 0x84C1 #endif -#endif - -#ifdef MINI_GL_COMPATIBILITY -#undef GL_CLAMP_TO_EDGE -#undef GL_TEXTURE_MIN_LOD -#undef GL_TEXTURE_MAX_LOD -#endif - boolean SetupGLfunc(void) { #ifndef STATIC_OPENGL @@ -463,9 +426,7 @@ boolean SetupGLfunc(void) GETOPENGLFUNC(pglScissor , glScissor) GETOPENGLFUNC(pglEnable , glEnable) GETOPENGLFUNC(pglDisable , glDisable) -#ifndef MINI_GL_COMPATIBILITY GETOPENGLFUNC(pglGetDoublev , glGetDoublev) -#endif GETOPENGLFUNC(pglGetIntegerv , glGetIntegerv) GETOPENGLFUNC(pglGetString , glGetString) @@ -479,11 +440,7 @@ boolean SetupGLfunc(void) GETOPENGLFUNC(pglPushMatrix , glPushMatrix) GETOPENGLFUNC(pglPopMatrix , glPopMatrix) GETOPENGLFUNC(pglLoadIdentity , glLoadIdentity) -#ifdef MINI_GL_COMPATIBILITY - GETOPENGLFUNC(pglMultMatrixf , glMultMatrixf) -#else GETOPENGLFUNC(pglMultMatrixd , glMultMatrixd) -#endif GETOPENGLFUNC(pglRotatef , glRotatef) GETOPENGLFUNC(pglScalef , glScalef) GETOPENGLFUNC(pglTranslatef , glTranslatef) @@ -528,9 +485,6 @@ boolean SetupGLfunc(void) // This has to be done after the context is created so the version number can be obtained boolean SetupGLFunc13(void) { -#ifdef MINI_GL_COMPATIBILITY - return false; -#else const GLubyte *version = pglGetString(GL_VERSION); int glmajor, glminor; @@ -566,7 +520,6 @@ boolean SetupGLFunc13(void) else DBG_Printf("GL_ARB_multitexture support: disabled\n"); return true; -#endif } // -----------------+ @@ -584,11 +537,7 @@ static void SetNoTexture(void) static void GLPerspective(GLdouble fovy, GLdouble aspect) { -#ifdef MINI_GL_COMPATIBILITY - GLfloat m[4][4] = -#else GLdouble m[4][4] = -#endif { { 1.0f, 0.0f, 0.0f, 0.0f}, { 0.0f, 1.0f, 0.0f, 0.0f}, @@ -602,7 +551,8 @@ static void GLPerspective(GLdouble fovy, GLdouble aspect) const GLdouble deltaZ = zFar - zNear; GLdouble cotangent; - if ((deltaZ == 0.0f) || (sine == 0.0f) || (aspect == 0.0f)) { + if ((fabsf((float)deltaZ) < 1.0E-36f) || fpclassify(sine) == FP_ZERO || fpclassify(aspect) == FP_ZERO) + { return; } cotangent = cos(radians) / sine; @@ -611,14 +561,9 @@ static void GLPerspective(GLdouble fovy, GLdouble aspect) m[1][1] = cotangent; m[2][2] = -(zFar + zNear) / deltaZ; m[3][2] = -2.0f * zNear * zFar / deltaZ; -#ifdef MINI_GL_COMPATIBILITY - pglMultMatrixf(&m[0][0]); -#else pglMultMatrixd(&m[0][0]); -#endif } -#ifndef MINI_GL_COMPATIBILITY static void GLProject(GLdouble objX, GLdouble objY, GLdouble objZ, GLdouble* winX, GLdouble* winY, GLdouble* winZ) { @@ -641,7 +586,7 @@ static void GLProject(GLdouble objX, GLdouble objY, GLdouble objZ, out[2] * projMatrix[2*4+i] + out[3] * projMatrix[3*4+i]; } - if (in[3] == 0.0f) return; + if (fpclassify(in[3]) == FP_ZERO) return; in[0] /= in[3]; in[1] /= in[3]; in[2] /= in[3]; @@ -658,7 +603,6 @@ static void GLProject(GLdouble objX, GLdouble objY, GLdouble objZ, *winY=in[1]; *winZ=in[2]; } -#endif // -----------------+ // SetModelView : @@ -689,10 +633,8 @@ void SetModelView(GLint w, GLint h) //pglScalef(1.0f, 320.0f/200.0f, 1.0f); // gr_scalefrustum (ORIGINAL_ASPECT) // added for new coronas' code (without depth buffer) -#ifndef MINI_GL_COMPATIBILITY pglGetIntegerv(GL_VIEWPORT, viewport); pglGetDoublev(GL_PROJECTION_MATRIX, projMatrix); -#endif } @@ -717,17 +659,13 @@ void SetStates(void) //pglShadeModel(GL_FLAT); pglEnable(GL_TEXTURE_2D); // two-dimensional texturing -#ifndef KOS_GL_COMPATIBILITY pglTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE); pglAlphaFunc(GL_NOTEQUAL, 0.0f); -#endif //pglBlendFunc(GL_ONE, GL_ZERO); // copy pixel to frame buffer (opaque) pglEnable(GL_BLEND); // enable color blending -#ifndef KOS_GL_COMPATIBILITY pglColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE); -#endif //pglDisable(GL_DITHER); // faB: ??? (undocumented in OpenGL 1.1) // Hurdler: yes, it is! @@ -752,9 +690,7 @@ void SetStates(void) //tex_downloaded = NOTEXTURE_NUM; //pglTexImage2D(GL_TEXTURE_2D, 0, 4, 8, 8, 0, GL_RGBA, GL_UNSIGNED_BYTE, Data); -#ifndef KOS_GL_COMPATIBILITY pglPolygonOffset(-1.0f, -1.0f); -#endif //pglEnable(GL_CULL_FACE); //pglCullFace(GL_FRONT); @@ -775,9 +711,7 @@ void SetStates(void) // bp : when no t&l :) pglLoadIdentity(); pglScalef(1.0f, 1.0f, -1.0f); -#ifndef MINI_GL_COMPATIBILITY pglGetDoublev(GL_MODELVIEW_MATRIX, modelMatrix); // added for new coronas' code (without depth buffer) -#endif } @@ -881,14 +815,6 @@ EXPORT void HWRAPI(ClearMipMapCache) (void) EXPORT void HWRAPI(ReadRect) (INT32 x, INT32 y, INT32 width, INT32 height, INT32 dst_stride, UINT16 * dst_data) { -#ifdef KOS_GL_COMPATIBILITY - (void)x; - (void)y; - (void)width; - (void)height; - (void)dst_stride; - (void)dst_data; -#else INT32 i; // DBG_Printf ("ReadRect()\n"); if (dst_stride == width*3) @@ -930,7 +856,6 @@ EXPORT void HWRAPI(ReadRect) (INT32 x, INT32 y, INT32 width, INT32 height, } free(image); } -#endif } @@ -951,10 +876,8 @@ EXPORT void HWRAPI(GClipRect) (INT32 minx, INT32 miny, INT32 maxx, INT32 maxy, f pglMatrixMode(GL_MODELVIEW); // added for new coronas' code (without depth buffer) -#ifndef MINI_GL_COMPATIBILITY pglGetIntegerv(GL_VIEWPORT, viewport); pglGetDoublev(GL_PROJECTION_MATRIX, projMatrix); -#endif } @@ -1001,12 +924,6 @@ EXPORT void HWRAPI(Draw2DLine) (F2DCoord * v1, GLRGBAFloat c; // DBG_Printf ("DrawLine() (%f %f %f) %d\n", v1->x, -v1->y, -v1->z, v1->argb); -#ifdef MINI_GL_COMPATIBILITY - GLfloat px1, px2, px3, px4; - GLfloat py1, py2, py3, py4; - GLfloat dx, dy; - GLfloat angle; -#endif // BP: we should reflect the new state in our variable //SetBlend(PF_Modulated|PF_NoTexture); @@ -1018,33 +935,11 @@ EXPORT void HWRAPI(Draw2DLine) (F2DCoord * v1, c.blue = byte2float[Color.s.blue]; c.alpha = byte2float[Color.s.alpha]; -#ifndef MINI_GL_COMPATIBILITY pglColor4fv(&c.red); // is in RGBA float format pglBegin(GL_LINES); pglVertex3f(v1->x, -v1->y, 1.0f); pglVertex3f(v2->x, -v2->y, 1.0f); pglEnd(); -#else - if (v2->x != v1->x) - angle = (float)atan((v2->y-v1->y)/(v2->x-v1->x)); - else - angle = N_PI_DEMI; - dx = (float)sin(angle) / (float)screen_width; - dy = (float)cos(angle) / (float)screen_height; - - px1 = v1->x - dx; py1 = v1->y + dy; - px2 = v2->x - dx; py2 = v2->y + dy; - px3 = v2->x + dx; py3 = v2->y - dy; - px4 = v1->x + dx; py4 = v1->y - dy; - - pglColor4f(c.red, c.green, c.blue, c.alpha); - pglBegin(GL_TRIANGLE_FAN); - pglVertex3f(px1, -py1, 1); - pglVertex3f(px2, -py2, 1); - pglVertex3f(px3, -py3, 1); - pglVertex3f(px4, -py4, 1); - pglEnd(); -#endif pglEnable(GL_TEXTURE_2D); } @@ -1052,9 +947,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 } @@ -1074,60 +967,41 @@ EXPORT void HWRAPI(SetBlend) (FBITFIELD PolyFlags) switch (PolyFlags & PF_Blending) { case PF_Translucent & PF_Blending: pglBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); // alpha = level of transparency -#ifndef KOS_GL_COMPATIBILITY pglAlphaFunc(GL_NOTEQUAL, 0.0f); -#endif break; case PF_Masked & PF_Blending: // Hurdler: does that mean lighting is only made by alpha src? // it sounds ok, but not for polygonsmooth pglBlendFunc(GL_SRC_ALPHA, GL_ZERO); // 0 alpha = holes in texture -#ifndef KOS_GL_COMPATIBILITY pglAlphaFunc(GL_GREATER, 0.5f); -#endif break; case PF_Additive & PF_Blending: -#ifdef ATI_RAGE_PRO_COMPATIBILITY - pglBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); // alpha = level of transparency -#else pglBlendFunc(GL_SRC_ALPHA, GL_ONE); // src * alpha + dest -#endif -#ifndef KOS_GL_COMPATIBILITY pglAlphaFunc(GL_NOTEQUAL, 0.0f); -#endif break; case PF_Environment & PF_Blending: pglBlendFunc(GL_ONE, GL_ONE_MINUS_SRC_ALPHA); -#ifndef KOS_GL_COMPATIBILITY pglAlphaFunc(GL_NOTEQUAL, 0.0f); -#endif break; case PF_Substractive & PF_Blending: // good for shadow // not realy but what else ? pglBlendFunc(GL_ZERO, GL_ONE_MINUS_SRC_COLOR); -#ifndef KOS_GL_COMPATIBILITY pglAlphaFunc(GL_NOTEQUAL, 0.0f); -#endif break; case PF_Fog & PF_Fog: // Sryder: Fog // multiplies input colour by input alpha, and destination colour by input colour, then adds them pglBlendFunc(GL_SRC_ALPHA, GL_SRC_COLOR); -#ifndef KOS_GL_COMPATIBILITY pglAlphaFunc(GL_NOTEQUAL, 0.0f); -#endif break; default : // must be 0, otherwise it's an error // No blending pglBlendFunc(GL_ONE, GL_ZERO); // the same as no blending -#ifndef KOS_GL_COMPATIBILITY pglAlphaFunc(GL_GREATER, 0.5f); -#endif break; } } -#ifndef KOS_GL_COMPATIBILITY if (Xor & PF_NoAlphaTest) { if (PolyFlags & PF_NoAlphaTest) @@ -1143,7 +1017,7 @@ EXPORT void HWRAPI(SetBlend) (FBITFIELD PolyFlags) else pglDisable(GL_POLYGON_OFFSET_FILL); } -#endif + if (Xor&PF_NoDepthTest) { if (PolyFlags & PF_NoDepthTest) @@ -1170,10 +1044,6 @@ EXPORT void HWRAPI(SetBlend) (FBITFIELD PolyFlags) pglTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT); } -#ifdef KOS_GL_COMPATIBILITY - if (Xor&PF_Modulated && !(PolyFlags & PF_Modulated)) - pglColor4f(1.0f, 1.0f, 1.0f, 1.0f); -#else if (Xor&PF_Modulated) { #if defined (__unix__) || defined (UNIXCOMMON) @@ -1193,7 +1063,6 @@ EXPORT void HWRAPI(SetBlend) (FBITFIELD PolyFlags) pglTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE); } } -#endif if (Xor & PF_Occlude) // depth test but (no) depth write { @@ -1247,11 +1116,7 @@ EXPORT void HWRAPI(SetTexture) (FTextureInfo *pTexInfo) else { // Download a mipmap -#ifdef KOS_GL_COMPATIBILITY - static GLushort tex[2048*2048]; -#else static RGBA_t tex[2048*2048]; -#endif const GLvoid *ptex = tex; INT32 w, h; @@ -1266,106 +1131,9 @@ EXPORT void HWRAPI(SetTexture) (FTextureInfo *pTexInfo) !(pTexInfo->flags & TF_CHROMAKEYED)) { // do nothing here. - // Not a problem with MiniGL since we don't use paletted texture } else #endif -#ifdef KOS_GL_COMPATIBILITY - if ((pTexInfo->grInfo.format == GR_TEXFMT_P_8) || - (pTexInfo->grInfo.format == GR_TEXFMT_AP_88)) - { - const GLubyte *pImgData = (const GLubyte *)pTexInfo->grInfo.data; - INT32 i, j; - - for (j = 0; j < h; j++) - { - for (i = 0; i < w; i++) - { - if ((*pImgData == HWR_PATCHES_CHROMAKEY_COLORINDEX) && - (pTexInfo->flags & TF_CHROMAKEYED)) - { - tex[w*j+i] = 0; - } - else - { - if (pTexInfo->grInfo.format == GR_TEXFMT_AP_88 && !(pTexInfo->flags & TF_CHROMAKEYED)) - tex[w*j+i] = 0; - else - tex[w*j+i] = (myPaletteData[*pImgData].s.alpha>>4)<<12; - - tex[w*j+i] |= (myPaletteData[*pImgData].s.red >>4)<<8; - tex[w*j+i] |= (myPaletteData[*pImgData].s.green>>4)<<4; - tex[w*j+i] |= (myPaletteData[*pImgData].s.blue >>4); - } - - pImgData++; - - if (pTexInfo->grInfo.format == GR_TEXFMT_AP_88) - { - if (!(pTexInfo->flags & TF_CHROMAKEYED)) - tex[w*j+i] |= ((*pImgData)>>4)<<12; - pImgData++; - } - - } - } - } - else if (pTexInfo->grInfo.format == GR_RGBA) - { - // corona test : passed as ARGB 8888, which is not in glide formats - // Hurdler: not used for coronas anymore, just for dynamic lighting - const RGBA_t *pImgData = (const RGBA_t *)pTexInfo->grInfo.data; - INT32 i, j; - - for (j = 0; j < h; j++) - { - for (i = 0; i < w; i++) - { - tex[w*j+i] = (pImgData->s.alpha>>4)<<12; - tex[w*j+i] |= (pImgData->s.red >>4)<<8; - tex[w*j+i] |= (pImgData->s.green>>4)<<4; - tex[w*j+i] |= (pImgData->s.blue >>4); - pImgData++; - } - } - } - else if (pTexInfo->grInfo.format == GR_TEXFMT_ALPHA_INTENSITY_88) - { - const GLubyte *pImgData = (const GLubyte *)pTexInfo->grInfo.data; - INT32 i, j; - - for (j = 0; j < h; j++) - { - for (i = 0; i < w; i++) - { - const GLubyte sID = (*pImgData)>>4; - tex[w*j+i] = sID<<8 | sID<<4 | sID; - pImgData++; - tex[w*j+i] |= ((*pImgData)>>4)<<12; - pImgData++; - } - } - } - else if (pTexInfo->grInfo.format == GR_TEXFMT_ALPHA_8) // Used for fade masks - { - const GLubyte *pImgData = (const GLubyte *)pTexInfo->grInfo.data; - INT32 i, j; - - for (j = 0; j < h; j++) - { - for (i = 0; i < w; i++) - { - tex[w*j+i] = (pImgData>>4)<<12; - tex[w*j+i] |= (255>>4)<<8; - tex[w*j+i] |= (255>>4)<<4; - tex[w*j+i] |= (255>>4); - pImgData++; - } - } - } - else - DBG_Printf ("SetTexture(bad format) %ld\n", pTexInfo->grInfo.format); -#else if ((pTexInfo->grInfo.format == GR_TEXFMT_P_8) || (pTexInfo->grInfo.format == GR_TEXFMT_AP_88)) { @@ -1448,7 +1216,6 @@ EXPORT void HWRAPI(SetTexture) (FTextureInfo *pTexInfo) } else DBG_Printf ("SetTexture(bad format) %ld\n", pTexInfo->grInfo.format); -#endif pTexInfo->downloaded = NextTexAvail++; tex_downloaded = pTexInfo->downloaded; @@ -1457,13 +1224,8 @@ EXPORT void HWRAPI(SetTexture) (FTextureInfo *pTexInfo) // disable texture filtering on any texture that has holes so there's no dumb borders or blending issues if (pTexInfo->flags & TF_TRANSPARENT) { -#ifdef KOS_GL_COMPATIBILITY - pglTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NONE); - pglTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NONE); -#else pglTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); pglTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); -#endif } else { @@ -1471,18 +1233,6 @@ EXPORT void HWRAPI(SetTexture) (FTextureInfo *pTexInfo) pglTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, min_filter); } -#ifdef KOS_GL_COMPATIBILITY - pglTexImage2D(GL_TEXTURE_2D, 0, GL_ARGB4444, w, h, 0, GL_ARGB4444, GL_UNSIGNED_BYTE, ptex); -#else -#ifdef MINI_GL_COMPATIBILITY - //if (pTexInfo->grInfo.format == GR_TEXFMT_ALPHA_INTENSITY_88) - //pglTexImage2D(GL_TEXTURE_2D, 0, GL_LUMINANCE_ALPHA, w, h, 0, GL_RGBA, GL_UNSIGNED_BYTE, ptex); - //else - if (MipMap) - pgluBuild2DMipmaps(GL_TEXTURE_2D, 0, w, h, GL_RGBA, GL_UNSIGNED_BYTE, ptex); - else - pglTexImage2D(GL_TEXTURE_2D, 0, 4, w, h, 0, GL_RGBA, GL_UNSIGNED_BYTE, ptex); -#else #ifdef USE_PALETTED_TEXTURE //Hurdler: not really supported and not tested recently if (glColorTableEXT && @@ -1500,15 +1250,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 @@ -1520,15 +1266,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 @@ -1540,21 +1282,15 @@ 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); } -#endif -#endif if (pTexInfo->flags & TF_WRAPX) pglTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT); @@ -1578,19 +1314,6 @@ EXPORT void HWRAPI(SetTexture) (FTextureInfo *pTexInfo) else // initialisation de la liste gr_cachetail = gr_cachehead = pTexInfo; } -#ifdef MINI_GL_COMPATIBILITY - switch (pTexInfo->flags) - { - case 0 : - pglTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP); - pglTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP); - break; - default: - pglTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT); - pglTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT); - break; - } -#endif } @@ -1604,18 +1327,11 @@ EXPORT void HWRAPI(DrawPolygon) (FSurfaceInfo *pSurf, FBITFIELD PolyFlags) { FUINT i; -#ifndef MINI_GL_COMPATIBILITY FUINT j; -#endif GLRGBAFloat c = {0,0,0,0}; -#ifdef MINI_GL_COMPATIBILITY - if (PolyFlags & PF_Corona) - PolyFlags &= ~PF_NoDepthTest; -#else if ((PolyFlags & PF_Corona) && (oglflags & GLF_NOZBUFREAD)) PolyFlags &= ~(PF_NoDepthTest|PF_Corona); -#endif SetBlend(PolyFlags); //TODO: inline (#pragma..) @@ -1637,16 +1353,11 @@ EXPORT void HWRAPI(DrawPolygon) (FSurfaceInfo *pSurf, c.alpha = byte2float[pSurf->FlatColor.s.alpha]; } -#ifdef MINI_GL_COMPATIBILITY - pglColor4f(c.red, c.green, c.blue, c.alpha); -#else pglColor4fv(&c.red); // is in RGBA float format -#endif } // this test is added for new coronas' code (without depth buffer) // I think I should do a separate function for drawing coronas, so it will be a little faster -#ifndef MINI_GL_COMPATIBILITY if (PolyFlags & PF_Corona) // check to see if we need to draw the corona { //rem: all 8 (or 8.0f) values are hard coded: it can be changed to a higher value @@ -1693,7 +1404,6 @@ EXPORT void HWRAPI(DrawPolygon) (FSurfaceInfo *pSurf, c.alpha *= scalef; // change the alpha value (it seems better than changing the size of the corona) pglColor4fv(&c.red); } -#endif if (PolyFlags & PF_MD2) return; @@ -1787,41 +1497,15 @@ EXPORT void HWRAPI(SetSpecialState) (hwdspecialstate_t IdState, INT32 Value) break; case HWD_SET_POLYGON_SMOOTH: -#ifdef KOS_GL_COMPATIBILITY // GL_POLYGON_SMOOTH_HINT - if (Value) - pglHint(GL_POLYGON_SMOOTH_HINT,GL_NICEST); - else - pglHint(GL_POLYGON_SMOOTH_HINT,GL_FASTEST); -#else if (Value) pglEnable(GL_POLYGON_SMOOTH); else pglDisable(GL_POLYGON_SMOOTH); -#endif break; case HWD_SET_TEXTUREFILTERMODE: switch (Value) { -#ifdef KOS_GL_COMPATIBILITY - case HWD_SET_TEXTUREFILTER_TRILINEAR: - case HWD_SET_TEXTUREFILTER_BILINEAR: - min_filter = mag_filter = GL_FILTER_BILINEAR; - break; - case HWD_SET_TEXTUREFILTER_POINTSAMPLED: - min_filter = mag_filter = GL_FILTER_NONE; - case HWD_SET_TEXTUREFILTER_MIXED1: - min_filter = GL_FILTER_NONE; - mag_filter = GL_LINEAR; - case HWD_SET_TEXTUREFILTER_MIXED2: - min_filter = GL_LINEAR; - mag_filter = GL_FILTER_NONE; - break; - case HWD_SET_TEXTUREFILTER_MIXED3: - min_filter = GL_FILTER_BILINEAR; - mag_filter = GL_FILTER_NONE; - break; -#elif !defined (MINI_GL_COMPATIBILITY) case HWD_SET_TEXTUREFILTER_TRILINEAR: min_filter = GL_LINEAR_MIPMAP_LINEAR; mag_filter = GL_LINEAR; @@ -1850,14 +1534,9 @@ EXPORT void HWRAPI(SetSpecialState) (hwdspecialstate_t IdState, INT32 Value) mag_filter = GL_NEAREST; MipMap = GL_TRUE; break; -#endif default: -#ifdef KOS_GL_COMPATIBILITY - min_filter = mag_filter = GL_FILTER_NONE; -#else mag_filter = GL_LINEAR; min_filter = GL_NEAREST; -#endif } if (!pgluBuild2DMipmaps) { @@ -1889,9 +1568,7 @@ static void DrawMD2Ex(INT32 *gl_cmd_buffer, md2_frame_t *frame, INT32 duration, float scalex = scale, scaley = scale, scalez = scale; // Because Otherwise, scaling the screen negatively vertically breaks the lighting -#ifndef KOS_GL_COMPATIBILITY GLfloat LightPos[] = {0.0f, 1.0f, 0.0f, 0.0f}; -#endif if (duration != 0 && duration != -1 && tics != -1) // don't interpolate if instantaneous or infinite in length { @@ -1937,9 +1614,7 @@ static void DrawMD2Ex(INT32 *gl_cmd_buffer, md2_frame_t *frame, INT32 duration, pglCullFace(GL_BACK); } -#ifndef KOS_GL_COMPATIBILITY pglLightfv(GL_LIGHT0, GL_POSITION, LightPos); -#endif pglShadeModel(GL_SMOOTH); if (color) @@ -1986,7 +1661,7 @@ static void DrawMD2Ex(INT32 *gl_cmd_buffer, md2_frame_t *frame, INT32 duration, pglTexCoord2f(s, t); - if (!nextframe || pol == 0.0f) + if (!nextframe || fpclassify(pol) == FP_ZERO) { pglNormal3f(frame->vertices[pindex].normal[0], frame->vertices[pindex].normal[1], @@ -2055,6 +1730,7 @@ EXPORT void HWRAPI(SetTransform) (FTransform *stransform) pglLoadIdentity(); if (stransform) { + boolean fovx90; // keep a trace of the transformation for md2 memcpy(&md2_transform, stransform, sizeof (md2_transform)); @@ -2069,14 +1745,13 @@ EXPORT void HWRAPI(SetTransform) (FTransform *stransform) pglMatrixMode(GL_PROJECTION); pglLoadIdentity(); - special_splitscreen = (stransform->splitscreen && stransform->fovxangle == 90.0f); + fovx90 = stransform->fovxangle > 0.0f && fabsf(stransform->fovxangle - 90.0f) < 0.5f; + special_splitscreen = (stransform->splitscreen && fovx90); if (special_splitscreen) GLPerspective(53.13l, 2*ASPECT_RATIO); // 53.13 = 2*atan(0.5) else GLPerspective(stransform->fovxangle, ASPECT_RATIO); -#ifndef MINI_GL_COMPATIBILITY pglGetDoublev(GL_PROJECTION_MATRIX, projMatrix); // added for new coronas' code (without depth buffer) -#endif pglMatrixMode(GL_MODELVIEW); } else @@ -2090,15 +1765,11 @@ EXPORT void HWRAPI(SetTransform) (FTransform *stransform) else //Hurdler: is "fov" correct? GLPerspective(fov, ASPECT_RATIO); -#ifndef MINI_GL_COMPATIBILITY pglGetDoublev(GL_PROJECTION_MATRIX, projMatrix); // added for new coronas' code (without depth buffer) -#endif pglMatrixMode(GL_MODELVIEW); } -#ifndef MINI_GL_COMPATIBILITY pglGetDoublev(GL_MODELVIEW_MATRIX, modelMatrix); // added for new coronas' code (without depth buffer) -#endif } EXPORT INT32 HWRAPI(GetTextureUsed) (void) @@ -2214,23 +1885,14 @@ EXPORT void HWRAPI(StartScreenWipe) (void) if (firstTime) { -#ifdef KOS_GL_COMPATIBILITY - pglTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_FILTER_NONE); - pglTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_FILTER_NONE); -#else pglTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); pglTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); -#endif Clamp2D(GL_TEXTURE_WRAP_S); Clamp2D(GL_TEXTURE_WRAP_T); -#ifndef KOS_GL_COMPATIBILITY pglCopyTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, 0, 0, texsize, texsize, 0); -#endif } else -#ifndef KOS_GL_COMPATIBILITY pglCopyTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, 0, 0, texsize, texsize); -#endif tex_downloaded = startScreenWipe; } @@ -2254,24 +1916,14 @@ EXPORT void HWRAPI(EndScreenWipe)(void) if (firstTime) { -#ifdef KOS_GL_COMPATIBILITY - pglTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_FILTER_NONE); - pglTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_FILTER_NONE); -#else pglTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); pglTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); -#endif Clamp2D(GL_TEXTURE_WRAP_S); Clamp2D(GL_TEXTURE_WRAP_T); -#ifndef KOS_GL_COMPATIBILITY pglCopyTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, 0, 0, texsize, texsize, 0); -#endif } else -#ifndef KOS_GL_COMPATIBILITY pglCopyTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, 0, 0, texsize, texsize); -#endif - tex_downloaded = endScreenWipe; } @@ -2324,9 +1976,7 @@ EXPORT void HWRAPI(DoScreenWipe)(float alpha) INT32 texsize = 2048; float xfix, yfix; -#ifndef MINI_GL_COMPATIBILITY INT32 fademaskdownloaded = tex_downloaded; // the fade mask that has been set -#endif // Use a power of two texture, dammit if(screen_width <= 1024) @@ -2366,7 +2016,6 @@ EXPORT void HWRAPI(DoScreenWipe)(float alpha) SetBlend(PF_Modulated|PF_Translucent|PF_NoDepthTest|PF_Clip|PF_NoZClip); -#ifndef MINI_GL_COMPATIBILITY if (gl13) { // Draw the end screen that fades in @@ -2410,32 +2059,29 @@ EXPORT void HWRAPI(DoScreenWipe)(float alpha) } else { -#endif - // Draw the end screen that fades in - pglBindTexture(GL_TEXTURE_2D, endScreenWipe); - pglBegin(GL_QUADS); - pglColor4f(1.0f, 1.0f, 1.0f, alpha); + // Draw the end screen that fades in + pglBindTexture(GL_TEXTURE_2D, endScreenWipe); + pglBegin(GL_QUADS); + pglColor4f(1.0f, 1.0f, 1.0f, alpha); - // Bottom left - pglTexCoord2f(0.0f, 0.0f); - pglVertex3f(-1.0f, -1.0f, 1.0f); + // Bottom left + pglTexCoord2f(0.0f, 0.0f); + pglVertex3f(-1.0f, -1.0f, 1.0f); - // Top left - pglTexCoord2f(0.0f, yfix); - pglVertex3f(-1.0f, 1.0f, 1.0f); + // Top left + pglTexCoord2f(0.0f, yfix); + pglVertex3f(-1.0f, 1.0f, 1.0f); - // Top right - pglTexCoord2f(xfix, yfix); - pglVertex3f(1.0f, 1.0f, 1.0f); + // Top right + pglTexCoord2f(xfix, yfix); + pglVertex3f(1.0f, 1.0f, 1.0f); - // Bottom right - pglTexCoord2f(xfix, 0.0f); - pglVertex3f(1.0f, -1.0f, 1.0f); - pglEnd(); - tex_downloaded = endScreenWipe; -#ifndef MINI_GL_COMPATIBILITY + // Bottom right + pglTexCoord2f(xfix, 0.0f); + pglVertex3f(1.0f, -1.0f, 1.0f); + pglEnd(); + tex_downloaded = endScreenWipe; } -#endif } @@ -2458,23 +2104,14 @@ EXPORT void HWRAPI(MakeScreenTexture) (void) if (firstTime) { -#ifdef KOS_GL_COMPATIBILITY - pglTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_FILTER_NONE); - pglTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_FILTER_NONE); -#else pglTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); pglTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); -#endif Clamp2D(GL_TEXTURE_WRAP_S); Clamp2D(GL_TEXTURE_WRAP_T); -#ifndef KOS_GL_COMPATIBILITY pglCopyTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, 0, 0, texsize, texsize, 0); -#endif } else -#ifndef KOS_GL_COMPATIBILITY pglCopyTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, 0, 0, texsize, texsize); -#endif tex_downloaded = screentexture; } @@ -2497,23 +2134,14 @@ EXPORT void HWRAPI(MakeScreenFinalTexture) (void) if (firstTime) { -#ifdef KOS_GL_COMPATIBILITY - pglTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_FILTER_NONE); - pglTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_FILTER_NONE); -#else pglTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); pglTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); -#endif Clamp2D(GL_TEXTURE_WRAP_S); Clamp2D(GL_TEXTURE_WRAP_T); -#ifndef KOS_GL_COMPATIBILITY pglCopyTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, 0, 0, texsize, texsize, 0); -#endif } else -#ifndef KOS_GL_COMPATIBILITY pglCopyTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, 0, 0, texsize, texsize); -#endif tex_downloaded = finalScreenTexture; diff --git a/src/hardware/r_opengl/r_opengl.h b/src/hardware/r_opengl/r_opengl.h index 6a2eba1df..e6cf164bb 100644 --- a/src/hardware/r_opengl/r_opengl.h +++ b/src/hardware/r_opengl/r_opengl.h @@ -37,13 +37,11 @@ #include #include -#ifndef MINI_GL_COMPATIBILITY #ifdef STATIC_OPENGL // Because of the 1.3 functions, you'll need GLext to compile it if static #define GL_GLEXT_PROTOTYPES #include #endif #endif -#endif #define _CREATE_DLL_ // necessary for Unix AND Windows #include "../../doomdef.h" diff --git a/src/hardware/s_openal/s_openal-vc10.vcxproj b/src/hardware/s_openal/s_openal-vc10.vcxproj index 8b4f6cbbe..5039cd006 100644 --- a/src/hardware/s_openal/s_openal-vc10.vcxproj +++ b/src/hardware/s_openal/s_openal-vc10.vcxproj @@ -1,6 +1,14 @@  + + Debug + ARM + + + Debug + ARM64 + Debug Win32 @@ -9,6 +17,14 @@ Debug x64 + + Release + ARM + + + Release + ARM64 + Release Win32 @@ -22,7 +38,7 @@ s_openal {E662D0B3-412D-4D55-A5EC-8CBD680DDCBE} s_openal - 8.1 + 10.0.16299.0 @@ -31,22 +47,44 @@ MultiByte v140 + + DynamicLibrary + false + MultiByte + v141 + DynamicLibrary false v140 + + DynamicLibrary + false + v141 + DynamicLibrary false MultiByte v140 + + DynamicLibrary + false + MultiByte + v141 + DynamicLibrary false v140 + + DynamicLibrary + false + v141 + @@ -54,37 +92,69 @@ + + + + + + + + + + + + + + + + <_ProjectFileVersion>10.0.30319.1 .\..\..\..\bin\VC10\$(Platform)\$(Configuration)\ + .\..\..\..\bin\VC10\$(Platform)\$(Configuration)\ .\..\..\..\objs\VC10\$(Platform)\$(Configuration)\s_openal\ + .\..\..\..\objs\VC10\$(Platform)\$(Configuration)\s_openal\ true + true false + false .\..\..\..\bin\VC10\$(Platform)\$(Configuration)\ + .\..\..\..\bin\VC10\$(Platform)\$(Configuration)\ .\..\..\..\objs\VC10\$(Platform)\$(Configuration)\s_openal\ + .\..\..\..\objs\VC10\$(Platform)\$(Configuration)\s_openal\ true + true false + false .\..\..\..\bin\VC10\$(Platform)\$(Configuration)\ + .\..\..\..\bin\VC10\$(Platform)\$(Configuration)\ .\..\..\..\objs\VC10\$(Platform)\$(Configuration)\s_openal\ + .\..\..\..\objs\VC10\$(Platform)\$(Configuration)\s_openal\ true + true true + true .\..\..\..\bin\VC10\$(Platform)\$(Configuration)\ + .\..\..\..\bin\VC10\$(Platform)\$(Configuration)\ .\..\..\..\objs\VC10\$(Platform)\$(Configuration)\s_openal\ + .\..\..\..\objs\VC10\$(Platform)\$(Configuration)\s_openal\ true + true true + true @@ -132,6 +202,50 @@ $(OutDir)s_openal.bsc + + + NDEBUG;%(PreprocessorDefinitions) + true + .\..\..\..\bin\VC10\$(Platform)\$(Configuration)\s_openal\s_openal.tlb + + + + + /MP %(AdditionalOptions) + MaxSpeed + OnlyExplicitInline + WIN32;NDEBUG;_WINDOWS;__WIN32__;__MSC__;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) + true + MultiThreaded + true + $(IntDir) + $(IntDir)s_openal.pdb + true + Level3 + true + CompileAsC + + + NDEBUG;%(PreprocessorDefinitions) + 0x0409 + + + OpenAL32.lib;%(AdditionalDependencies) + $(OutDir)s_openal.dll + true + true + $(OutDir)s_openal.pdb + false + + + $(IntDir)s_openal.lib + Windows + + + true + $(OutDir)s_openal.bsc + + NDEBUG;%(PreprocessorDefinitions) @@ -178,6 +292,50 @@ $(OutDir)s_openal.bsc + + + NDEBUG;%(PreprocessorDefinitions) + true + .\..\..\..\bin\VC10\$(Platform)\$(Configuration)\s_openal\s_openal.tlb + + + + + /MP %(AdditionalOptions) + MaxSpeed + OnlyExplicitInline + WIN32;NDEBUG;_WINDOWS;__WIN32__;__MSC__;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) + true + MultiThreaded + true + $(IntDir) + $(IntDir)s_openal.pdb + true + Level3 + true + CompileAsC + + + NDEBUG;%(PreprocessorDefinitions) + 0x0409 + + + OpenAL32.lib;%(AdditionalDependencies) + $(OutDir)s_openal.dll + true + true + $(OutDir)s_openal.pdb + false + + + $(IntDir)s_openal.lib + Windows + + + true + $(OutDir)s_openal.bsc + + _DEBUG;%(PreprocessorDefinitions) @@ -225,6 +383,50 @@ $(OutDir)s_openal.bsc + + + _DEBUG;%(PreprocessorDefinitions) + true + true + .\..\..\..\bin\VC10\$(Platform)\$(Configuration)\s_openal\s_openal.tlb + + + + + /MP /SAFESEH:OFF %(AdditionalOptions) + Disabled + WIN32;_DEBUG;_WINDOWS;__WIN32__;__MSC__;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) + EnableFastChecks + MultiThreadedDebug + $(IntDir) + $(IntDir)s_openal.pdb + true + Level4 + true + ProgramDatabase + CompileAsC + + + _DEBUG;%(PreprocessorDefinitions) + 0x0409 + + + OpenAL32.lib;%(AdditionalDependencies) + $(OutDir)s_openal.dll + true + true + $(OutDir)s_openal.pdb + false + + + $(IntDir)s_openal.lib + Windows + + + true + $(OutDir)s_openal.bsc + + _DEBUG;%(PreprocessorDefinitions) @@ -272,12 +474,60 @@ $(OutDir)s_openal.bsc + + + _DEBUG;%(PreprocessorDefinitions) + true + true + .\..\..\..\bin\VC10\$(Platform)\$(Configuration)\s_openal\s_openal.tlb + + + + + Disabled + WIN32;_DEBUG;_WINDOWS;__WIN32__;__MSC__;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) + EnableFastChecks + MultiThreadedDebug + $(IntDir) + $(IntDir)s_openal.pdb + true + Level4 + true + ProgramDatabase + CompileAsC + /MP /SAFESEH:OFF %(AdditionalOptions) + + + _DEBUG;%(PreprocessorDefinitions) + 0x0409 + + + OpenAL32.lib;%(AdditionalDependencies) + $(OutDir)s_openal.dll + true + true + $(OutDir)s_openal.pdb + false + + + $(IntDir)s_openal.lib + Windows + + + true + $(OutDir)s_openal.bsc + + %(PreprocessorDefinitions) + %(PreprocessorDefinitions) %(PreprocessorDefinitions) + %(PreprocessorDefinitions) %(PreprocessorDefinitions) + %(PreprocessorDefinitions) %(PreprocessorDefinitions) + %(PreprocessorDefinitions) diff --git a/src/hu_stuff.c b/src/hu_stuff.c index c6f95613f..3bc643c3c 100644 --- a/src/hu_stuff.c +++ b/src/hu_stuff.c @@ -69,10 +69,12 @@ 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? static char w_chat[HU_MAXMSGLEN]; +static size_t c_input = 0; // let's try to make the chat input less shitty. static boolean headsupactive = false; boolean hu_showscores; // draw rankings static char hu_tick; @@ -83,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 @@ -198,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++) { @@ -249,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. @@ -260,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 @@ -319,6 +328,88 @@ void HU_Start(void) //====================================================================== #ifndef NONET + +// EVERY CHANGE IN THIS SCRIPT IS LOL XD! BY VINCYTM + +static UINT32 chat_nummsg_log = 0; +static UINT32 chat_nummsg_min = 0; +static UINT32 chat_scroll = 0; +static tic_t chat_scrolltime = 0; + +static UINT32 chat_maxscroll = 0; // how far can we scroll? + +//static chatmsg_t chat_mini[CHAT_BUFSIZE]; // Display the last few messages sent. +//static chatmsg_t chat_log[CHAT_BUFSIZE]; // Keep every message sent to us in memory so we can scroll n shit, it's cool. + +static char chat_log[CHAT_BUFSIZE][255]; // hold the last 48 or so messages in that log. +static char chat_mini[8][255]; // display up to 8 messages that will fade away / get overwritten +static tic_t chat_timers[8]; + +static boolean chat_scrollmedown = false; // force instant scroll down on the chat log. Happens when you open it / send a message. + +// remove text from minichat table + +static INT16 addy = 0; // use this to make the messages scroll smoothly when one fades away + +static void HU_removeChatText_Mini(void) +{ + // MPC: Don't create new arrays, just iterate through an existing one + size_t i; + for(i=0;i