diff --git a/.gitignore b/.gitignore
index 922fac4a..3090417d 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 a9f4ddfb..e9c8d0d7 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -1,9 +1,20 @@
+# 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:
@@ -15,6 +26,7 @@ matrix:
- p7zip-full
- gcc-4.4
compiler: gcc-4.4
+ 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:
@@ -27,6 +39,7 @@ matrix:
- p7zip-full
- gcc-4.6
compiler: gcc-4.6
+ 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:
@@ -39,9 +52,11 @@ matrix:
- p7zip-full
- gcc-4.7
compiler: gcc-4.7
+ if: env(DPL_ENABLED) != "1" OR env(DPL_TERMINATE_TESTS) != "1" OR NOT branch =~ /^.*deployer.*$/
#gcc-4.7
- os: linux
compiler: gcc
+ 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:
@@ -56,6 +71,7 @@ matrix:
- p7zip-full
- gcc-4.8
compiler: gcc-4.8
+ 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:
@@ -70,10 +86,28 @@ matrix:
- p7zip-full
- gcc-7
compiler: gcc-7
- env: WFLAGS="-Wno-tautological-compare -Wno-error=implicit-fallthrough -Wimplicit-fallthrough=3"
+ env: WFLAGS="-Wno-tautological-compare -Wno-error=implicit-fallthrough -Wno-implicit-fallthrough"
+ 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
+ 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"
+ 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:
@@ -88,6 +122,7 @@ matrix:
- 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:
@@ -103,6 +138,7 @@ matrix:
- 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:
@@ -118,6 +154,7 @@ matrix:
- 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:
@@ -133,6 +170,7 @@ matrix:
- 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:
@@ -148,6 +186,7 @@ matrix:
- 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:
@@ -163,6 +202,7 @@ matrix:
# - 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:
@@ -178,32 +218,321 @@ matrix:
# - 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
+ if: env(DPL_ENABLED) != "1" OR env(DPL_TERMINATE_TESTS) != "1" OR NOT branch =~ /^.*deployer.*$/
#Apple LLVM version 7.3.0 (clang-703.0.31)
+
+
+################################
+# Deployer Buildbots - OSX
+################################
+ - os: osx
+ osx_image: xcode7.3
+ 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
+ - 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=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:
+ 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_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:
+ 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=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:
+ 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=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:
+ 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=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
@@ -213,12 +542,14 @@ matrix:
- compiler: clang-4.0
- compiler: clang-5.0
+
cache:
apt: true
ccache: true
directories:
- $HOME/srb2_cache
+
addons:
apt:
packages:
@@ -226,23 +557,127 @@ addons:
- libpng-dev
- libgl1-mesa-dev
- libgme-dev
+ - zlib1g-dev
- p7zip-full
-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
+ brew update;
+ brew tap mazmazz/srb2;
+ fi;
+ - if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then
+ if [[ "$__DPL_ACTIVE" != "1" ]]; then
+ brew install sdl2 sdl2_mixer game-music-emu p7zip;
+ brew install cmake||true;
+ else
+ brew install --build-bottle sdl2 game-music-emu p7zip;
+ brew install --build-bottle mazmazz/srb2/sdl2_mixer --with-flac --with-mpg123;
+ brew postinstall sdl2 game-music-emu p7zip mazmazz/srb2/sdl2_mixer;
+ brew install cmake||true;
+ 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 eb91866f..43142386 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.20
+ VERSION 1.0.2
LANGUAGES C)
if(${PROJECT_SOURCE_DIR} MATCHES ${PROJECT_BINARY_DIR})
@@ -86,8 +88,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 srb2kart CACHE STRING "Executable binary output name")
+set(SRB2_WIN_EXE_NAME srb2kartdd CACHE STRING "Executable binary output name for DirectDraw build")
include_directories(${CMAKE_CURRENT_BINARY_DIR}/src)
@@ -98,10 +100,10 @@ add_subdirectory(assets)
## config.h generation
set(GIT_EXECUTABLE "git" CACHE FILEPATH "Path to git binary")
include(GitUtilities)
-git_describe(SRB2_GIT_DESCRIBE "${CMAKE_SOURCE_DIR}")
+git_latest_commit(SRB2_COMP_COMMIT "${CMAKE_SOURCE_DIR}")
git_current_branch(SRB2_GIT_BRANCH "${CMAKE_SOURCE_DIR}")
set(SRB2_COMP_BRANCH "${SRB2_GIT_BRANCH}")
-set(SRB2_COMP_REVISION "${SRB2_GIT_DESCRIBE}")
+set(SRB2_COMP_REVISION "${SRB2_COMP_COMMIT}")
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/src/config.h.in ${CMAKE_CURRENT_BINARY_DIR}/src/config.h)
##### PACKAGE CONFIGURATION #####
@@ -116,8 +118,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 Kart" CACHE STRING "Program name for display purposes")
+set(CPACK_PACKAGE_VENDOR "Kart Krew" 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/SRB2.cbp b/SRB2.cbp
index 5aa623fa..acdc61c7 100644
--- a/SRB2.cbp
+++ b/SRB2.cbp
@@ -1545,10 +1545,17 @@ HW3SOUND for 3D hardware sound support
+
+
+
+
+
+
+
diff --git a/SRB2_Debug.props b/SRB2_Debug.props
index 8be11c58..74177c6e 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 a216ea45..905dfdcf 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 2fb2eb8c..0f80ceb1 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 69913cfc..e7ce1b2f 100644
--- a/appveyor.yml
+++ b/appveyor.yml
@@ -1,11 +1,15 @@
-version: 2.1.20.{branch}-{build}
+version: 1.0.2.{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: srb2kart-v102
+ # 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/Kart-Public/releases/download/kart_assets/srb2kart-v102-assets.7z
+ ASSET_ARCHIVE_PATCH_PATH: https://github.com/mazmazz/Kart-Public/releases/download/kart_assets/srb2kart-v102-patch-assets.7z
+ ASSET_ARCHIVE_X86_PATH: https://github.com/mazmazz/Kart-Public/releases/download/kart_assets/srb2kart-v102-x86-assets.7z
+ ASSET_ARCHIVE_X64_PATH: https://github.com/mazmazz/Kart-Public/releases/download/kart_assets/srb2kart-v102-x64-assets.7z
+ ASSET_ARCHIVE_OPTIONAL_PATH: https://github.com/mazmazz/Kart-Public/releases/download/kart_assets/srb2kart-v102-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
-- DD
+- 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 GCC72=1 NOOBJDUMP=1 %NOUPX%"
+- if [%X86_64%] == [1] ( set "MINGW_FLAGS=MINGW64=1 X86_64=1" ) else ( set "MINGW_FLAGS=MINGW=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 37bb465d..b9dc7c70 100644
--- a/assets/.gitignore
+++ b/assets/.gitignore
@@ -1,2 +1,12 @@
-*
-*.*
+*.srb
+*.pk3
+*.dta
+*.wad
+*.txt
+*.kart
+!README.txt
+!HISTORY.txt
+!LICENSE.txt
+!LICENSE-3RD-PARTY.txt
+!CMakeLists.txt
+!debian-template/*
diff --git a/assets/CMakeLists.txt b/assets/CMakeLists.txt
index a24c29ea..1eab62cc 100644
--- a/assets/CMakeLists.txt
+++ b/assets/CMakeLists.txt
@@ -1,41 +1,60 @@
## Assets Target Configuration ##
-# MD5 generation
-set(SRB2_ASSET_ALL
- ${CMAKE_CURRENT_SOURCE_DIR}/srb2.srb
- ${CMAKE_CURRENT_SOURCE_DIR}/patch.dta
- ${CMAKE_CURRENT_SOURCE_DIR}/gfx.kart
- ${CMAKE_CURRENT_SOURCE_DIR}/textures.kart
- ${CMAKE_CURRENT_SOURCE_DIR}/chars.kart
- ${CMAKE_CURRENT_SOURCE_DIR}/maps.kart
- ${CMAKE_CURRENT_SOURCE_DIR}/sounds.kart
- #${CMAKE_CURRENT_SOURCE_DIR}/music.dta
- ${CMAKE_CURRENT_SOURCE_DIR}/music.kart
-)
+# 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
- patch.dta
- gfx.kart
- textures.kart
- chars.kart
- maps.kart
+"srb2.srb;\
+patch.kart;\
+gfx.kart;\
+textures.kart;\
+chars.kart;\
+maps.kart"
+ CACHE STRING "Asset filenames to apply MD5 checks. No spaces between entries!"
)
+set(SRB2_ASSET_DOCS
+"README.txt;\
+HISTORY.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/HISTORY.txt b/assets/HISTORY.txt
new file mode 100644
index 00000000..dfa06f2c
--- /dev/null
+++ b/assets/HISTORY.txt
@@ -0,0 +1,202 @@
+KartKrew: Chapter 1.0 - Who Would Actually Read All This???? [LIVE DOC]
+
+
+-beep-
+
+
+[Chromatian dual-wields onto the interview set, stage left, and takes a seat next to VelocitOni. Oni stands up to look at the confused camera-men before opening a binder to stoically show both of his redone Tails sprites for Kart 1.0 and Vanilla 2.2. He closes it and sits back down, the three sofa cushions being Sryder, toaster, and Lat’s limp timezone’d bodies respectively; throwing arm over the side of the Fooruman pillow]
+
+Chrome: Uh…......anyway Chaos Zero 64, a Vanilla SRB2 Developer at the time, during the “heyday” of Sonic Riders started working on his own side project of recreating that game in SRB2 v1.09.4. After programming a functional recreation, he went a step further and threw together a new race mode for all of the characters in the playable exe. After THAT, he took it another step further and made a Mario Kart game type as well. A bunch of young mappers (Including current KartKrew™ dev members Blade & I) tossed him a few maps and he called it a complete exe.
+
+ While fully functional, it was as barebones as you could get. Character stats were altered Vanilla stats (lowered jump, speed, no spindash, and no drifting!) weapon rings reskinned into mario items, and a bunch of checkpoints that you had to hit to count as a lap around the course. It was pretty jank, but seeing all of those dents in the core gameplay is what gave way to the inspiration to push it further than what it initially was.
+
+Oni: There’s only one way to describe how I found it in 1.09.4, and the phrasing kinda caught on (to my pleasure), “ghetto footrace”. It was definitely an absolute MIRACLE at the time to even have SRB2 do anything different from it’s main gameplay scheme, bare ass open maps with collapsing FOFs; and the entire community as a whole was younger… so we all ate it up anyways. Standards were lower, times were simpler, we still really appreciate CZ for trying something ‘new’. When you pulled the wool off though, it was just ghetto footrace with reskinned buttons and totally unique…but also totally random weapon panels.
+
+
+
+[FlareBlade pops out of loose pipe in the room for some reason and hits his head on a kitchen sink.]
+
+
+
+Blade: While most of the maps back then harkened back to the simpler style of the 1.09.4 era; and were scrapped as SRB2 as a whole improved, Pipe Speedway has survived all the way to the present, although with a heavy style change, including a new name! (Now Daytona Speedway)
+
+Oni: [laughs] You really like that map, don’t you?
+
+Random Audience Member:[shouting] PICK, PICK STARDUST!!
+
+[The audience member is immediately shot through the heart with striking accuracy... the vote-screen SFX of a map being picked and Palmtree Panic Zone kids screaming "Yeah!" sounds. Cut to SeventhSentinel who just logged into the middle of the room with a shocked expression, smoking quality-controlling Desert Eagle in hand. The audience member's mask falls off, turning out to be Stardust Speedway Battle himself, now dead from the rotation.]
+
+Sev: Why would Blade do this…?
+
+
+Chrome: Pipe Speedway opened the PIPES for Kart’s 2.0 development, you could say. [laughs]
+
+Blade: Well, it WAS the first one to be slope-ified! Mostly as a proof-of-concept to show what could be done. (the rest of you lot were too busy with that “TD” thing…) And then you all went and upstaged it anyway with some of the other maps. [chuckles] //shade
+
+Oni: Yeah, while we finished ANOTHER full fledged mod, you actually got about 54% done with Pipe Speedway after 4 years! I was impressed. ////clapback
+
+Chrome: Still, Blade kept the campfire lit while we went in search of food, that takes some dedication.
+
+Oni: No. That was Blitz-T who continued making entire maps the whole time--
+
+Blade --Thank you. Overall though, the original kart was more-or-less a side feature of Riders. Never really the main focus of the mod, but without a doubt the most popular part of it. The other two modes never really caught on. (Though we did have that ill-fated “Rivals” mod…) =P
+
+
+
+Oni: [Holding a knife up to the two] The “what” mod?? Anywho, I was a frequent player of 1.09.4 but never really in the community much until 2.0. It wasn’t until CZ ported his mod to be up to date, that I jumped in with the idea that I actually had enough of a brain to contribute to things… the problem was that my standards from the get-go were way way too high, and my skill as a spriter and general design experience were a lot lower. Nevertheless, when SRB2Riders hype died down, I approached him in DMs with all my expectations and ideas for his mod...and… surprisingly he didn’t laugh me out! I guess he’d never had anyone directly tell him they’d help outright before (besides Ground The Fox), but he was a bit noticeably bummed that I only cared for what he’d considered the minor Mario mod within the mod.
+
+ This is what kickstarted the chain of events. All my plans that I bugged CZ for every other day in PMs never came to fruition, he actually lost interest and began to slowly fade out of the SRB2 community as a whole. Instead out of LITERALLY nowhere, D00D64 decided to revive the SRB2Riders mod himself by releasing a pretty expansive mod...of a mod within a mod OF a mod himself. Naturally, everyone jumped onto this, it exploded in popularity pretty much right away, because there were finally more than just a few mediocre maps to play “kart mode” on. There were PORTS, glorious glorious ports. Of course, I flocked to D00D to help out.
+
+
+
+Blade: Flat, boring, ports. Though the crazy item spam helped. Also we FINALLY got DRIFTING! Separating the characters from the bloat of the other 2 modes also made making custom racers easier to make.
+
+
+
+Oni: ...yeah, the truth is, once the “D00DKart” era started, it didn’t help that there were so many more por-- er, maps to play kart-mode on that people realized the formula for a kart racer was just inherently more exciting than what CZ’d pulled off with the Riders half of it. I remember a LOT of content for kart, and then like 2 maps for the more fleshed out and polished main focus of the thing. Everyone just sorta... forgot about Riders mode, sadly. It didn’t help that someone else also exploded onto the scene in a siamese feedback loop once D00D churned out enough maps a day to actually make a full game out of; ZarroTsu, who also saw opportunity too.
+
+ D00DKart and “Super SRB2Kart Z”, a continuation of ChaosZero’s mod, combined into one super project. A ‘team’ just kinda assembled naturally out of this, and more original content started to, slowly but surely, get made by a wider variety of people. The train continued to accelerate, lots of familiar faces coming into play. All the basics you’d expect out of a Mario Kart clone were coded by Zarro, basically updates every single day, stuff just kept getting done by this specific group of people.
+
+
+
+Chrome: That’s about when things for kart started to die down. D00DKart kept the entire game afloat, but Kart was always a sideline to Vanilla. Once D00DKart finally got comfortable, people moved back to Vanilla to see what else they could do with that. Servers stopped popping up as quickly as they used to, and eventually Super SRB2 Kart Z fell into obscurity. It was at this point that the small group still excited for the game tried to push for an even better project.
+
+
+
+Oni: Yep. When steam on this makeshift game finally died, Zarro lost interest too, and outright just vanished for a year or two(?) and when then, when he returned, he had very little momentum to continue. So in the meanwhile we kinda came closer together under the team “Kart Krew”, and in his place Sryder took the helm. Zarro’s vision was always to be a Mario clone, so when he was absent I wanted to push my idea of getting rid of most if not all references to Mario pronto, going for a Sonic aesthetic instead. The idea was that we’ll never be as good as a Nintendo game, and comparisons will always be drawn, so why not do something more unique?
+
+ Progress boomed again, but in private this time. 2013 ended up being the “2.0 indev” period. Standards kept increasing and increasing internally, because no one was satisfied with “ghetto footrace” anymore, we grew out of it and wanted an actual game this time… not play-pretend with all the instathrust hacks and poor game design decisions we were left with. Like shields.
+
+NOBODY liked those shields. We just couldn’t force Zarro to do what he didn’t want with his mod of a mod in a mod of a mod.
+
+
+
+Chrome: [laughs] Whirlwind was just a bit too broken for everyone.
+
+
+
+Oni: Using a Whirlwind Shield felt like playing a game of fucking Twister with my fingers just to reach the convoluted buttons, and you’re rewarded with the equivalent of bomb-jumping into the sky, except your kart is a runaway shower tub on pig grease. Awful. But good going, you ruined the entire race! Your slap on the wrist is now an unavoidable Armageddon Shield to the entire server by that Brazilian player who accidentally somehow made it to Lap 2 by RNG.
+
+ Mechanics were being edited, handling changed a bit, sprites were getting updated (notably the karts themselves), videos were being released from each of our channels, maps were bloating, notorious bug fixes at light speed. Unfortunately, literally at the same time, the new “Kart Krew” decided to sink their teeth into the Top Down experiment (we were on a high of too much confidence from all the progress) WHILE the release of Vanilla 2.1 invalidated all thre-- BOTH of our projects in one fell swoop. These were the dark ages, and it only got worse when I decided to disappear TOO before TD even got done. The story behind that development cycle (Top Down took all our Kart focus away when it was in progress) is known by now, but the real unexpected meat happened when we finally pushed that abortion out the door.
+
+
+
+Chrome: You probably should have listened to Blade and stuck with our guns on Kart, and not take a “break” for a new experiment. [laughs]
+
+
+
+[A silhouette outside the window in the rain can be seen with glowing cones, waving. Before anyone can process it, American Airlines smashes through the studio. For some reason Charybdizs walks out of the left-frontmost hatch]
+
+
+Charyb: For the record, Top Down wasn't bad by any means! People are just jumping on it because its dev cycle was complicated and a big learning experience for everyone. There were numerous members who poured their hearts into it! I’m proud of them! But yeah… the dev cycle…
+
+[wolfs can be seen frantically searching for a point in this interview to be relevant, unscheduled anime forcing him to miss most of it]
+
+
+wolfs: Oh man, TD’s dev cycle. What a shitshow. You’d either get a response in 3 seconds or 3 days depending on who was around. Motivation was at an all-time low back then. I felt like I was talking into a vacuum sometime--
+
+Oni: Why the fuck would you interrupt THIS moment, talking about 3 day responses when you’ll be “online” and won’t say anything until Kony’s live fucking body is found. Get outta here.
+
+wolfs: says the guy who disappeared for two years
+
+Oni: 'ey fuk you mane
+
+[Oni can be seen across the room from the plane, his TD_PTSD.td filled breathing into a brown paper bag]
+
+Oni: No, if Top Down were bad it wouldn’t have made half the hype of what Kart is doing now by ITSELF and manage to make it on Retro’s front page. But the dev cycle was purgatory, a big explosion at the start that dwindled to a candlefire, put out by the rain of inactivity...and then reignited by the power of Discord Chat. The actual product itself was pretty decent, and another fresh multiplayer experience not ever done in SRB2. It had hype.
+
+
+Blade: ...When you say the karts were updated, you mean “Oni nit-picked them to death and redid them like 10 times”.
+
+Oni: I wish he were joking about that number.
+
+
+
+Chrome: It all worked out for the better though. That (rather lengthy!) experiment taught us a lot about time management and what not to do for the far more important modification. Discord got popular around this time, and Top Down hopped into that plane, and quickly parachuted out into the community. This gathered a few new, very important members into KartKrew™. TehRealSalt, host of the Sugoi series, Seventh Sentinel, a new mapper with a fresh take on level design, and toaster, a Vanilla dev programmer with a fire for Kart so hot keeping up with her pace is a job in itself. Seriously, without these three members, Kart wouldn’t have the polish it does now.
+
+ It’s around this time that the pioneer in Kart level design returned, Blitz-T. Every map he made for 2.0 indev kart was a jawdropper to everyone on the team, and his attention to the small details were more than impressive. On top of all of this, SRB2 version 2.1 supported sloped planes, something that was as unbelievable for this game as cell phones were back in the 50s.
+ This is where 2.1 Kart really started to shine, Zarro ported the entire game in the span of a few weeks, Blitz-T took his old maps and revamped them with slopes to nearly unrecognizable new iterations, TehRealSalt made the entire Battle mode in the span of a *single* night, and Seventh Sentinel finally gave us looped music and consistent sound quality.
+
+
+
+Blade: Yeah, they really picked up the slack of some of the older members that lost steam, such as myself.
+
+
+
+Oni: Sev, Sal, and toast were the most unexpected things to ever happen to this thing. This shit was literally overnight. It’s really crazy how new blood can help bring a new perspective and vision to the game, along with skills you didn’t know the team was lacking. SO much pressure was taken off of Sryder as Sal and toaster literally slapped the exe until it cried, like frame-perfect Ice Climber handoffs into a 300% wobble. EVERYONE was overwhelmed. I saw the chance and took it, so we decided to go with my vision while Zarro took a backseat. Most, if not all the remaining broken code was just thrown out the window at this point, the game was rapidly feeling cleaner in just nights.
+
+ If you took your eyes off of it for a few hours, something changed massively. The physics went from instathrust to momentum based, Zarro coded new acceleration code, toaster put in 2.2 friction physics as a test that turned out overwhelmingly positive...and also divisive with the previous vision of the mod. These changes were all happening so fast, despite being in kinda stored with me idea-wise for years, that it caused a bit of a rift in what this game was supposed to be. Zarro decided to take a step back and dip because it’d changed so much in just the span of 4 months, he took one good look at 4-Player Splitscreen… a never seen before feat, and just breathed. It didn’t feel like his mod anymore, his personal connection with it felt lost…
+
+[Oni wiping sweat off his brow] Things only got more drastically revamped… very very rapidly.
+
+ The Mario aesthetic was entirely tossed out, as Sal was willing to work with me night and day on redoing most of everything about items… and then sounds. My power level for sprites massively jumped during TD development, so I decided to take it upon myself to do almost everything. They’re such friendly and cooperative coders that I can’t help but push a little harder than I used to (I was WAY lazier before they got here) to keep up.
+
+
+
+
+Chrome: Those kart sprites took a good 6 months longer than they needed to for sure! [laughs]
+
+
+
+
+Oni: [laughs in Latin] It’s not as easy as sloping a single sector in Misty Maze, that’s for sure!
+
+ The mappers went bonkers, especially Blitz-T and TyrannoChao aka “Ezo” (previously ChaoticChao) who’s content probably makes up half the game combined. The creative freedom and supportive style/mentality of how the team is led pretty much went to an unstoppable feedback loop of content AND polish, surprisingly. We got to a point where we could not only lay any remaining ChaosZero64 code that might’ve seeped to rest, but also throw out almost every direct Mario port or reference right down to the sounds. It became a Sonic game, in one year.
+
+
+Blade: Stuff was added so rapidly, even right up to release it always felt like there was something new being added. Bonuschars alone got 2 extra characters added in the week before release!
+
+Oni: Really, if you asked me, I’d say that most of kart just happened since TD released til now, and the rest was just a confused fever dream of passing torches until it all just got thrown out and re-done anyway. That’s why a changelog is pretty pointless, it’s like going to a shop...sitting down…and getting a recommendation for your vehicle; but the paper’s blank and just reads “get new car”. Honestly, playing this and playing the old 2.0 public builds that people like Super Chris still host for some reason is like aging backwards, except you’re really just amputating your skeleton to appear small and young again, it’s HORRIBLE. So if they all liked that… hopefully they’ll like an actually good game...even more??
+
+[Sounds of an angry midnight release crowd erupting outside, muffled. D00D64 can be seen at the forefront...slapping yet another unnaturally high quality gif meme onto the glass window. The camera pans out, there’s hundreds of gif memes all over the outer walls]
+
+Oni: Is it midnight?? I told them to fuck off, there’s no midnight release! @Chromatian FIND SOMETHING TO SAY AFTER ME TO CLOSE THIS UP ALREADY
+
+Chrome: [this shitty Iwata Asks atmosphere cracking at the seams of its own immersion, reality warping his professional and calm demeanor, but he laughs regardless...shakily] You just don’t know when to stop!!
+
+[TehRealSalt struggles trying to get into the room through the tiny doggy door for 5 awkward minutes, before giving up and just opening the door] … [she doesn’t know what to say.]
+
+Oni: EZO
+
+[The towering dinosaur just nonchalantly sits in his chair on-stage, legs crossed, resting his head on his hand]
+
+Ezo: Sticky Kart was a shitshow. [referring to the old controls/physics]
+
+Oni: holy shit YOU CAN’T SAY THAT ZARRO MIGHT BE READING
+
+Ezo: I have no regretties. Except for maybe Arid S--wait, that’s a secret, isn’t it? Hm. Anyway, yeah, working on this was fun. Usually. Learning to sprite was annoying but it paid off since I got to cram Wonder Boy in everyone’s faces like the scaly fucko I am. Though Gamma’s pretty cool too. I hope you all enjoy my Sonic Adventure references and that you all suffer an appropriately huge amount in Egg Quarters and Spotlight Syndicate.
+
+Oni: THIS IS A NON FURRY DOCUMENT :boi:
+
+Ezo: Speciesism UwU
+
+
+
+Boinciel: [screaming from a speaker contained offstage] HI MY NAME IS BOINCIEL I DESIGNED KART MAPS TO DESTROY YOUR EYES AND/OR YOUR SOUL OKAY BYE I HAVE TO DO MY JOB NOW
+
+
+Oni: With a map like Kodachrome…..clearly...
+
+[Off in the corner, a lone wooden coat rack stands, although upon further inspection... It turns out to be, well, CoatRack in a disguise!]
+
+[The entire server pauses for Coat to come up with something]
+
+Coat: You know, these guys all did an awesome job. The controls, the graphics, music too! I just, uh… Had an engine stall on my map, sad how many times I ran out of fuel at a petroleum refinery when making it. Huh. But as one of the more outside members of the krew, just ask anyone, I could be placed under the decorative ornament members with how rarely I dropped in. But each time I did I was blown away by the leaps and bounds, filling me with joy to see this racer come to life. Even if I am a living example of why inanimate objects shouldn’t drive!
+
+[The entire Krew stares at the literal coat rack, smiling wholesomely until Blade opens his mouth]
+
+Blade: Whatever. Enough talking, LET’S GO AWAY!!!!!!!! DAYTONNNAAAAAAAAAAAAAAAA
+
+
+[...the .txt file itself cringes to a halt.]
+
+
+
+
+
+
+
+
+
+
+doot
diff --git a/assets/LICENSE-3RD-PARTY.txt b/assets/LICENSE-3RD-PARTY.txt
new file mode 100644
index 00000000..42ea20e9
--- /dev/null
+++ b/assets/LICENSE-3RD-PARTY.txt
@@ -0,0 +1,1710 @@
+--------------------------------------------------------------------------------
+ 3-Clause BSD License
+ applies to:
+ - MiniUPnPc
+ Copyright (c) 2005-2011, Thomas BERNARD
+ All rights reserved.
+ http://miniupnp.free.fr
+--------------------------------------------------------------------------------
+
+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.
+ * The name of the author may not 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 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.
+
+--------------------------------------------------------------------------------
+ curl License
+ applies to:
+ - curl
+ Copyright (c) 1996 - 2018, Daniel Stenberg, daniel@haxx.se,
+ and many contributors, see the THANKS file.
+ https://curl.haxx.se
+--------------------------------------------------------------------------------
+
+All rights reserved.
+
+Permission to use, copy, modify, and distribute this software for any purpose
+with or without fee is hereby granted, provided that the above copyright notice
+and this permission notice appear in all copies.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF THIRD PARTY RIGHTS. IN
+NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
+DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
+OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE
+OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of a copyright holder shall not be
+used in advertising or otherwise to promote the sale, use or other dealings in
+this Software without prior written authorization of the copyright holder.
+
+--------------------------------------------------------------------------------
+ FMOD End User License Agreement
+ applies to:
+ - FMOD Ex
+ Copyright (c), Firelight Technologies Pty, Ltd. 2004-2018.
+ https://www.fmod.com
+--------------------------------------------------------------------------------
+
+This FMOD End User Licence Agreement (EULA) is a legal agreement between you and Firelight
+Technologies Pty Ltd (ACN 099 182 448) (us or we) and governs your use of FMOD Studio and FMOD
+Engine software (FMOD).
+
+1. GRANT OF LICENCE
+This EULA grants you the right to use FMOD, in a software application (Product), for
+personal (hobbyist), educational (students and teachers) or Non-Commercial use only,
+subject to the following:
+i) Non-Commercial use does not involve any form of monetisation, sponsorship
+or promotion.
+ii) FMOD is distributed as integrated into a Product only;
+iii) FMOD is not distributed as part of any Commercial Product or service;
+iv) FMOD is not distributed as part of a game engine or tool set;
+v) FMOD is not used in any Commercial enterprise or for any Commercial
+production or subcontracting, except for the purposes of Evaluation or
+Development of a Commercial Product;
+vi) Product includes attribution in accordance with Clause 3;
+
+2. OTHER USE
+For all Commercial use, and any Non Commercial use not permitted by this license, a
+separate license is required. Refer to www.fmod.com/licensing for information.
+
+3. CREDITS AND LOGO
+All Products require an in game credit line which must include the words "FMOD" or
+"FMOD Studio" (if applicable) and "Firelight Technologies Pty Ltd". This is non
+negotiable. Refer to www.fmod.com/licensing for examples. All products require a
+logo to be presented during start up of the application, before encountering any
+menus or interactivity. See www.fmod.com/licensing for logo information. The user
+has the option to 'buy out' the requirement to have a logo at the start of the
+product.
+
+4. INTELLECTUAL PROPERTY RIGHTS
+a) We are and remain at all times the owner of FMOD (including all intellectual
+property rights in or to the Software). For the avoidance of doubt, nothing in
+this EULA may be deemed to grant or assign to you any proprietary or ownership
+interest or intellectual property rights in or to FMOD other than the rights
+licensed pursuant to clause 1.
+b) You acknowledge and agree that you have no right, title or interest in and to the
+intellectual property rights in FMOD.
+
+5. SECURITY AND RISK
+You are responsible for protecting FMOD and any related materials at all times from
+unauthorised access, use or damage.
+
+6. WARRANTY AND LIMITATION OF LIABILITY
+a) FMOD is provided by us "as is" and, to the maximum extent permitted by law,
+any express or implied warranties of any kind, including (but not limited to) all
+implied warranties of merchantability and fitness for a particular purpose are
+disclaimed.
+b) In no event shall we (and our employees, contractors and subcontractors),
+developers and contributors be liable for any direct, special, indirect or
+consequential damages whatsoever resulting from loss of use of data or profits,
+whether in an action of contract, negligence or other tortious conduct, arising
+out of or in connection with the use or performance FMOD.
+
+7. OGG VORBIS CODEC
+a) FMOD uses the Ogg Vorbis codec.
+b) (c) 2002, Xiph.Org Foundation
+c) Redistribution and use in source and binary forms, with or without modification,
+are permitted provided that the following conditions are met:
+i) Redistributions of source code must retain the above copyright notice, the
+list of conditions and the following disclaimer.
+ii) Redistributions in binary form must reproduce the above copyright notice,
+this list of conditions and the following disclaimer in the documentation
+and/or other material provided with the distribution.
+iii) 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.
+d) 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, INCIDENTIAL, 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
+NEGLIENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
+IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+8. GOOGLE VR (GVR)
+FMOD includes Google VR, licensed under the Apache Licence, Version 2.0 (the Licence);
+you may not use this file except in compliance with the License. You may obtain a copy of
+the License at:
+http://www.apache.org/licenses/LICENSE-2.0
+Unless required by applicable law or agreed to in writing, software distributed under the
+License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
+either express or implied. See the License for the specific language governing permissions
+and limitations under the License.
+
+9. ANDROID PLATFORM CODE
+Copyright (C) 2010 The Android Open Source Project 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.
+
+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.
+
+10. AUDIOGAMING AUDIOMOTORS DEMO CONTENT
+AudioGaming AudioMotors Demo Engine.agp is provided for evaluation purposes
+only and is not to be redistributed. To create your own engine content, you
+will need AudioMotors V2 Pro. A trial version be found at
+http://store.audiogaming.net/content/audiomotors-v2-pro-trial. For access to
+the full version, contact sales@fmod.com.
+
+© 2018 Firelight Technologies Pty Ltd.
+
+--------------------------------------------------------------------------------
+ GCC Runtime Library Exception, Version 3.1
+ applies to:
+ - GCC Runtime Library
+ Copyright (C) Free Software Foundation, Inc.
+ https://www.gnu.org/software/gcc/
+--------------------------------------------------------------------------------
+
+GCC RUNTIME LIBRARY EXCEPTION Version 3.1, 31 March 2009
+
+Copyright © 2009 Free Software Foundation, Inc.
+
+Everyone is permitted to copy and distribute verbatim copies of this license
+document, but changing it is not allowed.
+
+This GCC Runtime Library Exception ("Exception") is an additional permission
+under section 7 of the GNU General Public License, version 3 ("GPLv3"). It
+applies to a given file (the "Runtime Library") that bears a notice placed by
+the copyright holder of the file stating that the file is governed by GPLv3
+along with this Exception.
+
+When you use GCC to compile a program, GCC may combine portions of certain GCC
+header files and runtime libraries with the compiled program. The purpose of
+this Exception is to allow compilation of non-GPL (including proprietary)
+programs to use, in this way, the header files and runtime libraries covered by
+this Exception.
+
+0. Definitions. A file is an "Independent Module" if it either requires the
+Runtime Library for execution after a Compilation Process, or makes use of an
+interface provided by the Runtime Library, but is not otherwise based on the
+Runtime Library.
+
+"GCC" means a version of the GNU Compiler Collection, with or without
+modifications, governed by version 3 (or a specified later version) of the GNU
+General Public License (GPL) with the option of using any subsequent versions
+published by the FSF.
+
+"GPL-compatible Software" is software whose conditions of propagation,
+modification and use would permit combination with GCC in accord with the
+license of GCC.
+
+"Target Code" refers to output from any compiler for a real or virtual target
+processor architecture, in executable form or suitable for input to an
+assembler, loader, linker and/or execution phase. Notwithstanding that, Target
+Code does not include data in any format that is used as a compiler
+intermediate representation, or used for producing a compiler intermediate
+representation.
+
+The "Compilation Process" transforms code entirely represented in
+non-intermediate languages designed for human-written code, and/or in Java
+Virtual Machine byte code, into Target Code. Thus, for example, use of source
+code generators and preprocessors need not be considered part of the
+Compilation Process, since the Compilation Process can be understood as
+starting with the output of the generators or preprocessors.
+
+A Compilation Process is "Eligible" if it is done using GCC, alone or with
+other GPL-compatible software, or if it is done without using any work based on
+GCC. For example, using non-GPL-compatible Software to optimize any GCC
+intermediate representations would not qualify as an Eligible Compilation
+Process.
+
+1. Grant of Additional Permission. You have permission to propagate a work of
+Target Code formed by combining the Runtime Library with Independent Modules,
+even if such propagation would otherwise violate the terms of GPLv3, provided
+that all Target Code was generated by Eligible Compilation Processes. You may
+then convey such a combination under terms of your choice, consistent with the
+licensing of the Independent Modules.
+
+2. No Weakening of GCC Copyleft. The availability of this Exception does not
+imply any general presumption that third-party software is unaffected by the
+copyleft requirements of the license of GCC.
+
+--------------------------------------------------------------------------------
+ GNU General Public License, Version 3
+ applies to:
+ - GCC Runtime Library
+ Copyright (C) Free Software Foundation, Inc.
+ https://www.gnu.org/software/gcc/
+--------------------------------------------------------------------------------
+
+ 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
+.
+
+--------------------------------------------------------------------------------
+ GNU Lesser General Public License, Version 2.1
+ applies to:
+ - Game_Music_Emu
+ Shay Green
+ http://www.slack.net/~ant/
+
+ - libintl
+ Copyright (C) 1995-2018 Free Software Foundation, Inc.
+ https://www.gnu.org/software/gettext/
+
+ - mpg123
+ Copyright (c) 1995-2013 by Michael Hipp and others,
+ free software under the terms of the LGPL v2.1
+ https://www.mpg123.de
+--------------------------------------------------------------------------------
+
+ 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
+
+ How to Apply These Terms to Your New Libraries
+
+ If you develop a new library, and you want it to be of the greatest
+possible use to the public, we recommend making it free software that
+everyone can redistribute and change. You can do so by permitting
+redistribution under these terms (or, alternatively, under the terms of the
+ordinary General Public License).
+
+ To apply these terms, attach the following notices to the library. 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 library 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 library 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 library; 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.
+
+You should also get your employer (if you work as a programmer) or your
+school, if any, to sign a "copyright disclaimer" for the library, if
+necessary. Here is a sample; alter the names:
+
+ Yoyodyne, Inc., hereby disclaims all copyright interest in the
+ library `Frob' (a library for tweaking knobs) written by James Random Hacker.
+
+ , 1 April 1990
+ Ty Coon, President of Vice
+
+That's all there is to it!
+
+--------------------------------------------------------------------------------
+ libpng License
+ applies to:
+ - libpng
+ Copyright (c) 2000-2002, 2004, 2006-2018 Glenn Randers-Pehrson
+ http://www.libpng.org/pub/png/libpng.html
+--------------------------------------------------------------------------------
+
+This copy of the libpng notices is provided for your convenience. In case of
+any discrepancy between this copy and the notices in the file png.h that is
+included in the libpng distribution, the latter shall prevail.
+
+COPYRIGHT NOTICE, DISCLAIMER, and LICENSE:
+
+If you modify libpng you may insert additional notices immediately following
+this sentence.
+
+This code is released under the libpng license.
+
+libpng versions 1.0.7, July 1, 2000 through 1.6.35, July 15, 2018 are
+Copyright (c) 2000-2002, 2004, 2006-2018 Glenn Randers-Pehrson, are
+derived from libpng-1.0.6, and are distributed according to the same
+disclaimer and license as libpng-1.0.6 with the following individuals
+added to the list of Contributing Authors:
+
+ Simon-Pierre Cadieux
+ Eric S. Raymond
+ Mans Rullgard
+ Cosmin Truta
+ Gilles Vollant
+ James Yu
+ Mandar Sahastrabuddhe
+ Google Inc.
+ Vadim Barkov
+
+and with the following additions to the disclaimer:
+
+ There is no warranty against interference with your enjoyment of the
+ library or against infringement. There is no warranty that our
+ efforts or the library will fulfill any of your particular purposes
+ or needs. This library is provided with all faults, and the entire
+ risk of satisfactory quality, performance, accuracy, and effort is with
+ the user.
+
+Some files in the "contrib" directory and some configure-generated
+files that are distributed with libpng have other copyright owners and
+are released under other open source licenses.
+
+libpng versions 0.97, January 1998, through 1.0.6, March 20, 2000, are
+Copyright (c) 1998-2000 Glenn Randers-Pehrson, are derived from
+libpng-0.96, and are distributed according to the same disclaimer and
+license as libpng-0.96, with the following individuals added to the list
+of Contributing Authors:
+
+ Tom Lane
+ Glenn Randers-Pehrson
+ Willem van Schaik
+
+libpng versions 0.89, June 1996, through 0.96, May 1997, are
+Copyright (c) 1996-1997 Andreas Dilger, are derived from libpng-0.88,
+and are distributed according to the same disclaimer and license as
+libpng-0.88, with the following individuals added to the list of
+Contributing Authors:
+
+ John Bowler
+ Kevin Bracey
+ Sam Bushell
+ Magnus Holmgren
+ Greg Roelofs
+ Tom Tanner
+
+Some files in the "scripts" directory have other copyright owners
+but are released under this license.
+
+libpng versions 0.5, May 1995, through 0.88, January 1996, are
+Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc.
+
+For the purposes of this copyright and license, "Contributing Authors"
+is defined as the following set of individuals:
+
+ Andreas Dilger
+ Dave Martindale
+ Guy Eric Schalnat
+ Paul Schmidt
+ Tim Wegner
+
+The PNG Reference Library is supplied "AS IS". The Contributing Authors
+and Group 42, Inc. disclaim all warranties, expressed or implied,
+including, without limitation, the warranties of merchantability and of
+fitness for any purpose. The Contributing Authors and Group 42, Inc.
+assume no liability for direct, indirect, incidental, special, exemplary,
+or consequential damages, which may result from the use of the PNG
+Reference Library, even if advised of the possibility of such damage.
+
+Permission is hereby granted to use, copy, modify, and distribute this
+source code, or portions hereof, for any purpose, without fee, subject
+to the following restrictions:
+
+ 1. The origin of this source code must not be misrepresented.
+
+ 2. Altered versions must be plainly marked as such and must not
+ be misrepresented as being the original source.
+
+ 3. This Copyright notice may not be removed or altered from any
+ source or altered source distribution.
+
+The Contributing Authors and Group 42, Inc. specifically permit, without
+fee, and encourage the use of this source code as a component to
+supporting the PNG file format in commercial products. If you use this
+source code in a product, acknowledgment is not required but would be
+appreciated.
+
+END OF COPYRIGHT NOTICE, DISCLAIMER, and LICENSE.
+
+TRADEMARK:
+
+The name "libpng" has not been registered by the Copyright owner
+as a trademark in any jurisdiction. However, because libpng has
+been distributed and maintained world-wide, continually since 1995,
+the Copyright owner claims "common-law trademark protection" in any
+jurisdiction where common-law trademark is recognized.
+
+OSI CERTIFICATION:
+
+Libpng is OSI Certified Open Source Software. OSI Certified Open Source is
+a certification mark of the Open Source Initiative. OSI has not addressed
+the additional disclaimers inserted at version 1.0.7.
+
+EXPORT CONTROL:
+
+The Copyright owner believes that the Export Control Classification
+Number (ECCN) for libpng is EAR99, which means not subject to export
+controls or International Traffic in Arms Regulations (ITAR) because
+it is open source, publicly available software, that does not contain
+any encryption software. See the EAR, paragraphs 734.3(b)(3) and
+734.7(b).
+
+Glenn Randers-Pehrson
+glennrp at users.sourceforge.net
+July 15, 2018
+
+--------------------------------------------------------------------------------
+ New BSD License
+ applies to:
+ - FLAC
+ Copyright (C) 2000-2009 Josh Coalson
+ Copyright (C) 2011-2016 Xiph.Org Foundation
+ https://xiph.org/flac/api/
+
+ - Vorbis
+ Copyright (c) 2002-2008 Xiph.org Foundation
+ https://xiph.org/vorbis/
+
+ - Opus
+ Copyright 2001-2011 Xiph.Org, Skype Limited, Octasic,
+ Jean-Marc Valin, Timothy B. Terriberry,
+ CSIRO, Gregory Maxwell, Mark Borgerding,
+ Erik de Castro Lopo
+ https://opus-codec.org
+
+ - Opus File
+ Copyright (c) 1994-2013 Xiph.Org Foundation and contributors
+ https://opus-codec.org
+--------------------------------------------------------------------------------
+
+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.
+
+[ For FLAC, Vorbis, and Opus File
+- 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.
+]
+
+[ For Opus
+- Neither the name of Internet Society, IETF or IETF Trust, nor the
+names of specific 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.
+
+--------------------------------------------------------------------------------
+ Public Domain
+ applies to:
+ - win_iconv
+ Yukihiro Nakadaira
+ win_iconv is placed in the public domain.
+ https://github.com/win-iconv/win-iconv
+
+ - libmodplug
+ ModPlug-XMMS and libmodplug are now in the public domain.
+ http://modplug-xmms.sourceforge.net
+--------------------------------------------------------------------------------
+
+--------------------------------------------------------------------------------
+ zlib License
+ applies to:
+ - Simple DirectMedia Layer
+ Copyright (C) 1997-2018 Sam Lantinga
+ https://www.libsdl.org/hg.php
+
+ - SDL_mixer: An audio mixer library based on the SDL library
+ Copyright (C) 1997-2018 Sam Lantinga
+ https://www.libsdl.org/projects/SDL_mixer/
+
+ - zlib
+ Copyright (C) 1995-2017 Jean-loup Gailly and Mark Adler
+ https://zlib.net
+--------------------------------------------------------------------------------
+
+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/assets/LICENSE.txt b/assets/LICENSE.txt
new file mode 100644
index 00000000..d159169d
--- /dev/null
+++ b/assets/LICENSE.txt
@@ -0,0 +1,339 @@
+ 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/assets/README.txt b/assets/README.txt
new file mode 100644
index 00000000..e8e21a84
--- /dev/null
+++ b/assets/README.txt
@@ -0,0 +1,65 @@
+SONIC ROBO BLAST 2 KART
+
+SRB2Kart is a kart racer based on SRB2, the 3D Sonic the Hedgehog
+fangame based on a modified version of Doom Legacy.
+
+LICENSE
+
+The source code for SRB2 & SRB2Kart is licensed under the GNU General
+Public License, Version 2. See LICENSE.txt for the full text of this
+license.
+
+SRB2 & SRB2Kart uses various third-party libraries, including SDL, SDL
+Mixer, and their dependencies. See LICENSE-3RD-PARTY.txt for the
+licenses of these libraries.
+
+SOURCE CODE
+
+You may obtain the source code for SRB2Kart, including the source code
+for specific version releases, at the following web site:
+
+STJr GitLab:
+https://git.magicalgirl.moe/KartKrew/Kart-Public
+
+You may obtain the source code for the parent game, SRB2, at the
+following web sites:
+
+STJr GitLab:
+https://git.magicalgirl.moe/STJr/SRB2
+
+GitHub:
+https://github.com/STJr/SRB2
+
+CONTACT
+
+You may contact Kart Krew via the following web site:
+
+Kart Krew Official Discord:
+https://discord.gg/WJmqDtN
+
+You may contact Sonic Team Junior via the following web sites:
+
+SRB2.ORG:
+https://www.srb2.org
+
+SRB2 Message Board:
+https://mb.srb2.org
+
+SRB2 Official Discord:
+https://discord.gg/pYDXzpX
+
+COPYRIGHT AND DISCLAIMER
+
+Design and content on SRB2Kart is copyright 2018 by Kart Krew.
+Design and content on SRB2 is copyright 1998-2018 by Sonic Team Junior.
+All non-original material on SRB2.ORG is copyrighted by their
+respective owners, and no copyright infringement is intended. The owner
+of the SRB2.ORG domain is only acting as an ISP, and is therefore not
+responsible for any content on SRB2.ORG under the 1998 DMCA. This
+site, its webmaster, and its staff make no profit whatsoever (in fact,
+we lose money). Sonic Team Junior assumes no responsibility for the
+content on any Sonic Team Junior fan sites.
+
+Kart Krew nor Sonic Team Junior is in no way affiliated with SEGA or
+Sonic Team. We do not claim ownership of any of SEGA's intellectual
+property used in SRB2 or SRB2Kart.
diff --git a/assets/debian-template/README.Debian b/assets/debian-template/README.Debian
new file mode 100644
index 00000000..f3fe9003
--- /dev/null
+++ b/assets/debian-template/README.Debian
@@ -0,0 +1,73 @@
+srb2 for Debian
+---------------
+
+SRB2 Debian package!
+Hi there, to rebuild this package just use the SRB2 Makefile system, or, optionally, run
+dpkg-buildpackage in the in /assets directory. You can build these with or without a key
+if you want, but if you want to put these on a repo, generate your own GnuPG key as per the
+https://help.ubuntu.com/community/GnuPrivacyGuardHowto instructions and pass the -k
+command to debuild. Make sure you export the key footprint 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
+
+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 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
+
+Next, you will have to add that key fingerprint to your Launchpad account. Go to your Launchpad
+profile and click the yellow Edit button next to "OpenPGP keys". Once you add the key, you can
+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:
+
+ 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]
+
+
+Uploading for Launchpad PPA
+
+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 00000000..64562e2a
--- /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 54%
rename from assets/debian/control
rename to assets/debian-template/control
index 123b5842..ae5c0ce6 100644
--- a/assets/debian/control
+++ b/assets/debian-template/control
@@ -1,22 +1,22 @@
# SRB2-data Debian package control file.
-Source: srb2-data
+Source: ${PACKAGE_NAME}-data
Section: games
Priority: extra
-Maintainer: Callum Dickinson
-Build-Depends: debhelper (>= 7.0.50~)
+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
fangame built using a modified version of the Doom Legacy
port of Doom. SRB2 is closely inspired by the original
Sonic games from the Sega Genesis, and attempts to recreate
- the design in 3D. While SRB2 isn't fully completed, it already
- features tons of levels, enemies, speed, and quite a lot
- of the fun that the original Sonic games provided.
+ the design in 3D. It features tons of levels, enemies, speed,
+ and quite a lot of the fun that the original Sonic games provided.
This is the data package that provides the data files that
- SRB2 requires to run, it will not work without it.
+ SRB2 requires to run; it will not work without it.
diff --git a/debian/copyright b/assets/debian-template/copyright
similarity index 60%
rename from debian/copyright
rename to assets/debian-template/copyright
index 8a870519..cc47c453 100644
--- a/debian/copyright
+++ b/assets/debian-template/copyright
@@ -1,18 +1,18 @@
This work was packaged for Debian by:
- Callum Dickinson on Fri, 26 Nov 2010 15:19:16 +1300
+ ${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-2010 Sonic Team Junior
+ Copyright (C) 1998-2018 by Sonic Team Junior
License:
@@ -21,6 +21,7 @@ License:
The Debian packaging is:
Copyright (C) 2010 Callum Dickinson
+ 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 59%
rename from assets/debian/rules
rename to assets/debian-template/rules
index d86f92af..c2d19922
--- 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,25 +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
+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)
- # This will need to be updated every time SRB2 official version is
+ > $(DIR)/debian/source/include-binaries
# Copy data files to their install locations, and add data files to include-binaries
- for file in $(DATAFILES); do \
- $(WGET) http://alam.srb2.org/SRB2/2.1.14-Final/Resources/$$file; \
- if test "$$file" = "srb2.wad"; then \
- $(INSTALL) $(RESOURCEDIR)/$$file $(DIR)/debian/tmp/$(DATADIR)/srb2.srb; \
- else \
- $(INSTALL) $(RESOURCEDIR)/$$file $(DIR)/debian/tmp/$(DATADIR)/$$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; \
- echo $(RESOURCEDIR)/$$file >> $(DIR)/debian/source/include-binaries; \
- 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
@@ -95,15 +112,18 @@ binary: binary-indep
dh_builddeb
clean:
- $(RM) $(RESOURCEDIR)/*.wad
- $(RM) $(RESOURCEDIR)/*.dta
- $(RM) $(RESOURCEDIR)/*.plr
- $(RM) $(RESOURCEDIR)/*.wpn
- $(RM) $(RESOURCEDIR)/*.srb
- $(RM) $(RESOURCEDIR)/*.dll
- $(RM) $(DIR)/debian/tmp/*
- $(RM) $(DIR)/debian/$(PACKAGE).install
- $(RM) $(DIR)/debian/files
- $(RM) $(DIR)/debian/source/include-binaries
+ $(RM) $(DIR)/debian/tmp/*; \
+ $(RM) $(DIR)/debian/$(PACKAGE).install; \
+ $(RM) $(DIR)/debian/files; \
+
+clean-all: clean
+ $(RM) $(RESOURCEDIR)/*.wad; \
+ $(RM) $(RESOURCEDIR)/*.dta; \
+ $(RM) $(RESOURCEDIR)/*.plr; \
+ $(RM) $(RESOURCEDIR)/*.wpn; \
+ $(RM) $(RESOURCEDIR)/*.srb; \
+ $(RM) $(RESOURCEDIR)/*.dll; \
+ $(RM) $(RESOURCEDIR)/*.txt; \
+ $(RM) $(DIR)/debian/source/include-binaries; \
.PHONY: all clean binary binary-arch binary-indep build
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-template/source/options b/assets/debian-template/source/options
new file mode 100644
index 00000000..8b331485
--- /dev/null
+++ b/assets/debian-template/source/options
@@ -0,0 +1 @@
+tar-ignore = "tmp/*"
diff --git a/assets/debian/README.Debian b/assets/debian/README.Debian
deleted file mode 100644
index 4d9f067a..00000000
--- a/assets/debian/README.Debian
+++ /dev/null
@@ -1,12 +0,0 @@
-srb2 for Debian
----------------
-
-SRB2 Debian package!
-Hi there, to rebuild this package just use the SRB2 Makefile system, or, optionally, run
-dpkg-buildpackage in the in /bin/Resources directory. You can build these with or without a key
-if you want, but if you want to put these on a repo, generate your own GnuPG key as per the
-https://help.ubuntu.com/community/GnuPrivacyGuardHowto instructions and pass the -k
-command to debuild. Make sure you export the key footprint and give them to your users to install
-with apt-key add. Thanks!
-
- -- Callum Dickinson Fri, 26 Nov 2010 18:25:31 +1300
diff --git a/assets/debian/changelog b/assets/debian/changelog
deleted file mode 100644
index a316b7df..00000000
--- a/assets/debian/changelog
+++ /dev/null
@@ -1,12 +0,0 @@
-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/Resources/exchndl.dll b/bin/Resources/exchndl.dll
deleted file mode 100644
index d836a676..00000000
Binary files a/bin/Resources/exchndl.dll and /dev/null differ
diff --git a/cmake/Modules/GitUtilities.cmake b/cmake/Modules/GitUtilities.cmake
index 683cf9b6..d29e6b50 100644
--- a/cmake/Modules/GitUtilities.cmake
+++ b/cmake/Modules/GitUtilities.cmake
@@ -27,5 +27,17 @@ function(git_current_branch variable path)
OUTPUT_STRIP_TRAILING_WHITESPACE
)
+ set(${variable} "${output}" PARENT_SCOPE)
+endfunction()
+
+function(git_latest_commit variable path)
+ execute_process(COMMAND ${GIT_EXECUTABLE} "rev-parse" "--short" "HEAD"
+ WORKING_DIRECTORY "${path}"
+ RESULT_VARIABLE result
+ OUTPUT_VARIABLE output
+ ERROR_QUIET
+ OUTPUT_STRIP_TRAILING_WHITESPACE
+ )
+
set(${variable} "${output}" PARENT_SCOPE)
endfunction()
\ No newline at end of file
diff --git a/debian-template/README.Debian b/debian-template/README.Debian
new file mode 100644
index 00000000..3aa52787
--- /dev/null
+++ b/debian-template/README.Debian
@@ -0,0 +1,70 @@
+srb2 for Debian
+---------------
+
+SRB2 Debian package!
+Hi there, to rebuild these packages just use debuild in the root source directory (not /src!).
+You can build these with or without a key if you want, but if you want to put these on a repo,
+generate your own GnuPG key as per the https://help.ubuntu.com/community/GnuPrivacyGuardHowto
+instructions and pass the -k command to debuild. Make sure you export the key footprint
+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 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
+
+Next, you will have to add that key fingerprint to your Launchpad account. Go to your Launchpad
+profile and click the yellow Edit button next to "OpenPGP keys". Once you add the key, you can
+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:
+
+ 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]
+
+
+Uploading for Launchpad PPA
+
+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 92%
rename from debian/README.source
rename to debian-template/README.source
index ff2dddd4..f63a42ca 100644
--- a/debian/README.source
+++ b/debian-template/README.source
@@ -22,6 +22,10 @@ Build instructions:
make -C src LINUX=1
+Build instructions for non-X86 devices (such as X64):
+
+make -C src LINUX=1 NONX86=1
+
Build instructions to build for Wii Linux/SRB2Wii on a PowerPC system,
follow cross-compiling instructions for cross-compiling on a x86 system:
diff --git a/debian-template/changelog b/debian-template/changelog
new file mode 100644
index 00000000..fb08908c
--- /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-template/control b/debian-template/control
new file mode 100644
index 00000000..e1348d70
--- /dev/null
+++ b/debian-template/control
@@ -0,0 +1,49 @@
+# SRB2 Debian package control file.
+
+Source: ${PACKAGE_NAME}
+Section: games
+Priority: extra
+Maintainer: ${PACKAGE_GROUP_NAME_EMAIL}
+Build-Depends: debhelper (>= 7.0.50~),
+ libsdl2-dev,
+ libsdl2-mixer-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: ${PACKAGE_WEBSITE}
+
+Package: ${PACKAGE_NAME}
+Architecture: any
+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
+ port of Doom. SRB2 is closely inspired by the original
+ Sonic games from the Sega Genesis, and attempts to recreate
+ the design in 3D. It features tons of levels, enemies, speed,
+ and quite a lot of the fun that the original Sonic games provided.
+
+
+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}, ${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
+ port of Doom. SRB2 is closely inspired by the original
+ Sonic games from the Sega Genesis, and attempts to recreate
+ the design in 3D. It features tons of levels, enemies, speed,
+ and quite a lot of the fun that the original Sonic games provided.
+ This is a debug binary; its symbols will be loaded by gdb
+ when the user starts the game with gdb for debugging.
diff --git a/assets/debian/copyright b/debian-template/copyright
similarity index 60%
rename from assets/debian/copyright
rename to debian-template/copyright
index 8a870519..cc47c453 100644
--- a/assets/debian/copyright
+++ b/debian-template/copyright
@@ -1,18 +1,18 @@
This work was packaged for Debian by:
- Callum Dickinson on Fri, 26 Nov 2010 15:19:16 +1300
+ ${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-2010 Sonic Team Junior
+ Copyright (C) 1998-2018 by Sonic Team Junior
License:
@@ -21,6 +21,7 @@ License:
The Debian packaging is:
Copyright (C) 2010 Callum Dickinson
+ 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-template/docs b/debian-template/docs
new file mode 100644
index 00000000..dba2cd4c
--- /dev/null
+++ b/debian-template/docs
@@ -0,0 +1,4 @@
+README.md
+assets/README.txt
+assets/LICENSE.txt
+assets/LICENSE-3RD-PARTY.txt
diff --git a/debian/rules b/debian-template/rules
old mode 100755
new mode 100644
similarity index 76%
rename from debian/rules
rename to debian-template/rules
index e49784a0..0a77624c
--- 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,28 +60,40 @@ 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
+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)")
OS = LINUX=1
NONX86 = $(shell test "`echo $(CROSS_COMPILE_HOST) | grep 'i[3-6]86'`" || echo "NONX86=1")
-MAKEARGS = $(OS) $(NONX86) $(PREFIX) EXENAME=$(EXENAME) DBGNAME=$(DBGNAME) SDL_PKGCONFIG=sdl2 PNG_PKGCONFIG=libpng NOOBJDUMP=1
+MAKEARGS = $(OS) $(NONX86) $(PREFIX) EXENAME=$(EXENAME) DBGNAME=$(DBGNAME) NOOBJDUMP=1 # SDL_PKGCONFIG=sdl2 PNG_PKGCONFIG=libpng
MENUFILE1 = ?package($(PACKAGE)):needs="X11" section="$(SECTION)"
MENUFILE2 = title="$(TITLE)" command="/$(PKGDIR)/$(PACKAGE)"
-# FIXME pkg-config dir hacks
-export PKG_CONFIG_LIBDIR = /usr/lib/$(CROSS_COMPILE_HOST)/pkgconfig
BINDIR := $(DIR)/bin/Linux/Release
+
+# FIXME pkg-config dir hacks
+# Launchpad doesn't need this; it actually makes i386 builds fail due to cross-compile
+# export PKG_CONFIG_LIBDIR = /usr/lib/$(CROSS_COMPILE_HOST)/pkgconfig
LDFLAGS += "-Wl,-rpath=/usr/lib/$(CROSS_COMPILE_HOST)"
+# Some libgme-dev packages don't use pkg-config yet, so include the linker flag ourselves
+PKG_CONFIG?=pkg-config
+LIBGME_PKGCONFIG?=libgme
+LIBGME_LDFLAGS?=$(shell $(PKG_CONFIG) $(LIBGME_PKGCONFIG) --libs)
+
+ifeq ($(LIBGME_LDFLAGS),)
+MAKEARGS += LIBGME_LDFLAGS=-lgme
+endif
+
build:
$(MKDIR) $(BINDIR)/debug
$(MAKE) -C $(DIR)/src $(MAKEARGS)
@@ -90,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
@@ -100,8 +122,8 @@ binary-arch:
echo $(DESKTOP_DIR) >> $(DIR)/debian/$(PACKAGE).install
echo $(PIXMAPS_DIR) >> $(DIR)/debian/$(PACKAGE).install
echo $(DBGDIR) > $(DIR)/debian/$(DBGPKG).install
-
-binary: binary-arch
+# Launchpad only calls binary-arch, so just move everything up
+#binary: binary-arch
# Generate .desktop specifications
echo "`echo '$(MENUFILE1)\\'`" > $(DIR)/debian/menu
echo " `echo '$(MENUFILE2)'`" >> $(DIR)/debian/menu
@@ -122,7 +144,7 @@ binary: binary-arch
# dh_installcron
# dh_installinfo
# dh_installman
- # dh_link
+ dh_link $(PKGDIR)/$(EXENAME) $(LINKDIR)/$(EXENAME)
dh_compress
dh_fixperms
# dh_perl
@@ -133,6 +155,8 @@ binary: binary-arch
dh_md5sums
dh_builddeb
+binary: binary-arch
+
clean:
$(MAKE) -C $(DIR)/src $(MAKEARGS) clean cleandep
$(RM) $(BINDIR)/*
@@ -145,4 +169,4 @@ clean:
$(RM) $(DIR)/debian/files
$(RM) $(DIR)/debian/source/include-binaries
-.PHONY: all clean binary binary-arch binary-indep build
+.PHONY: all clean binary binary-indep build
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-template/source/options b/debian-template/source/options
new file mode 100644
index 00000000..9532ff20
--- /dev/null
+++ b/debian-template/source/options
@@ -0,0 +1,11 @@
+tar-ignore = "assets/*.srb"
+tar-ignore = "assets/*.pk3"
+tar-ignore = "assets/*.dta"
+tar-ignore = "assets/*.wad"
+tar-ignore = "assets/*.kart"
+tar-ignore = "assets/debian/${PACKAGE_NAME}-data/*"
+tar-ignore = "assets/debian/tmp/*"
+tar-ignore = "*.obj"
+tar-ignore = "*.dep"
+tar-ignore = ".git/*"
+tar-ignore = ".git*"
diff --git a/debian-template/srb2.desktop b/debian-template/srb2.desktop
new file mode 100644
index 00000000..07c7906e
--- /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/README.Debian b/debian/README.Debian
deleted file mode 100644
index bbc306b1..00000000
--- a/debian/README.Debian
+++ /dev/null
@@ -1,11 +0,0 @@
-srb2 for Debian
----------------
-
-SRB2 Debian package!
-Hi there, to rebuild these packages just use debuild in the root source directory (not /src!).
-You can build these with or without a key if you want, but if you want to put these on a repo,
-generate your own GnuPG key as per the https://help.ubuntu.com/community/GnuPrivacyGuardHowto
-instructions and pass the -k command to debuild. Make sure you export the key footprint
-and give them to your users to install with apt-key add. Thanks!
-
- -- Callum Dickinson Fri, 26 Nov 2010 18:25:31 +1300
diff --git a/debian/changelog b/debian/changelog
deleted file mode 100644
index b454b1ab..00000000
--- a/debian/changelog
+++ /dev/null
@@ -1,5 +0,0 @@
-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/control b/debian/control
deleted file mode 100644
index 63b075f1..00000000
--- a/debian/control
+++ /dev/null
@@ -1,42 +0,0 @@
-# SRB2 Debian package control file.
-
-Source: srb2
-Section: games
-Priority: extra
-Maintainer: Callum Dickinson
-Build-Depends: debhelper (>= 7.0.50~),
- libsdl2-dev,
- libsdl2-mixer-dev,
- libpng12-dev (>= 1.2.7),
- libglu1-dev | libglu-dev,
- libosmesa6-dev | libgl-dev,
- nasm [i386]
-Standards-Version: 3.8.4
-Homepage: http://www.srb2.org
-
-Package: srb2
-Architecture: any
-Depends: ${shlibs:Depends}, ${misc:Depends}, srb2-data (= 2.1.14)
-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
- port of Doom. SRB2 is closely inspired by the original
- Sonic games from the Sega Genesis, and attempts to recreate
- the design in 3D. While SRB2 isn't fully completed, it already
- features tons of levels, enemies, speed, and quite a lot
- of the fun that the original Sonic games provided.
-
-Package: srb2-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.14), srb2
-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
- port of Doom. SRB2 is closely inspired by the original
- Sonic games from the Sega Genesis, and attempts to recreate
- the design in 3D. While SRB2 isn't fully completed, it already
- features tons of levels, enemies, speed, and quite a lot
- of the fun that the original Sonic games provided.
- This is a debug binary, its symbols will be loaded by gdb
- when the user starts the game with gdb for debugging.
diff --git a/debian/docs b/debian/docs
deleted file mode 100644
index b43bf86b..00000000
--- a/debian/docs
+++ /dev/null
@@ -1 +0,0 @@
-README.md
diff --git a/debian/srb2.desktop b/debian/srb2.desktop
deleted file mode 100644
index 661832b9..00000000
--- a/debian/srb2.desktop
+++ /dev/null
@@ -1,10 +0,0 @@
-[Desktop Entry]
-Name=Sonic Robo Blast 2
-Comment=A free 3D Sonic the Hedgehog fan-game built using a modified ver. of the Doom Legacy source port
-Encoding=UTF-8
-Exec=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 00000000..c1af3c19
--- /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 00000000..fae38859
--- /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 00000000..c88155d2
--- /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 00000000..3817f025
--- /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 00000000..9b853a80
--- /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/Kart-Public/releases/download/kart_assets/srb2kart-v102-assets.7z}
+: ${ASSET_ARCHIVE_OPTIONAL_PATH:=https://github.com/mazmazz/Kart-Public/releases/download/kart_assets/srb2kart-v102-optional-assets.7z}
+: ${ASSET_FILES_HASHED:=srb2.srb patch.kart gfx.kart textures.kart chars.kart maps.kart}
+: ${ASSET_FILES_DOCS:=README.txt HISTORY.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:=srb2kart}
+: ${PACKAGE_VERSION:=1.0.2}
+: ${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/SRB2Kart}
+: ${PACKAGE_LINK_PATH:=/usr/games}
+: ${PACKAGE_DISTRO:=trusty}
+: ${PACKAGE_URGENCY:=high}
+: ${PACKAGE_NAME_EMAIL:=Kart Krew }
+: ${PACKAGE_GROUP_NAME_EMAIL:=Kart Krew }
+: ${PACKAGE_WEBSITE:=}
+
+: ${PACKAGE_ASSET_MINVERSION:=1.0.1} # Number this the version BEFORE the actual required version, because we do a > check
+: ${PACKAGE_ASSET_MAXVERSION:=1.0.3} # Number this the version AFTER the actual required version, because we do a < check
+
+: ${PROGRAM_NAME:=Sonic Robo Blast 2 Kart}
+: ${PROGRAM_VENDOR:=Kart Krew}
+: ${PROGRAM_VERSION:=1.0.2}
+: ${PROGRAM_DESCRIPTION:=A kart racing mod based on the 3D Sonic the Hedgehog fangame Sonic Robo Blast 2.}
+: ${PROGRAM_FILENAME:=srb2kart}
+
+: ${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 00000000..863a928c
--- /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
new file mode 100644
index 00000000..06fae127
--- /dev/null
+++ b/libs/DLL-README.txt
@@ -0,0 +1,43 @@
+# SRB2Kart - Which DLLs do I need to bundle?
+
+Updated 12/4/2018 (v2.1.21)
+
+Here are the required DLLs, per build. For each architecture, copy all the binaries from these folders:
+
+* libs\dll-binaries\[i686/x86_64]
+* libs\SDL2\[i686/x86_64]...\bin
+* libs\SDL2_mixer\[i686/x86_64]...\bin
+
+and don't forget to build r_opengl.dll for srb2dd.
+
+## srb2kart, 32-bit
+
+* libs\dll-binaries\i686\exchndl.dll
+* libs\dll-binaries\i686\libgme.dll
+* 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)
+
+## srb2kart, 64-bit
+
+* libs\dll-binaries\x86_64\exchndl.dll
+* libs\dll-binaries\x86_64\libgme.dll
+* 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)
+
+## srb2kartdd, 32-bit
+
+* libs\dll-binaries\i686\exchndl.dll
+* libs\dll-binaries\i686\fmodex.dll
+* libs\dll-binaries\i686\libgme.dll
+* libs\dll-binaries\i686\mgwhelp.dll (depend for exchndl.dll)
+* r_opengl.dll (build this from make)
+
+## srb2kartdd, 64-bit
+
+* libs\dll-binaries\x86_64\exchndl.dll
+* libs\dll-binaries\x86_64\fmodex.dll
+* libs\dll-binaries\x86_64\libgme.dll
+* libs\dll-binaries\x86_64\mgwhelp.dll (depend for exchndl.dll)
+* r_opengl.dll (build this from make)
diff --git a/libs/SDL2/lib/ARM/SDL2.lib b/libs/SDL2/lib/ARM/SDL2.lib
new file mode 100644
index 00000000..be9d8694
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 00000000..f9eac1c0
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 00000000..40904c30
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 00000000..3886f3aa
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 00000000..d5650b0d
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 00000000..58c3e696
Binary files /dev/null and b/libs/SDL2_mixer/lib/ARM64/SDL2_mixer.lib differ
diff --git a/bin/Resources/fmod.dll b/libs/dll-binaries/i686/Old/fmod.dll
similarity index 100%
rename from bin/Resources/fmod.dll
rename to libs/dll-binaries/i686/Old/fmod.dll
diff --git a/bin/Resources/fmodexL.dll b/libs/dll-binaries/i686/Old/fmodexL.dll
similarity index 100%
rename from bin/Resources/fmodexL.dll
rename to libs/dll-binaries/i686/Old/fmodexL.dll
diff --git a/bin/Resources/libgcc_s_dw2-1.dll b/libs/dll-binaries/i686/Old/libgcc_s_dw2-1.dll
similarity index 100%
rename from bin/Resources/libgcc_s_dw2-1.dll
rename to libs/dll-binaries/i686/Old/libgcc_s_dw2-1.dll
diff --git a/bin/Resources/libintl-8.dll b/libs/dll-binaries/i686/Old/libintl-8.dll
similarity index 100%
rename from bin/Resources/libintl-8.dll
rename to libs/dll-binaries/i686/Old/libintl-8.dll
diff --git a/libs/dll-binaries/i686/exchndl.dll b/libs/dll-binaries/i686/exchndl.dll
new file mode 100644
index 00000000..d6beb764
Binary files /dev/null and b/libs/dll-binaries/i686/exchndl.dll differ
diff --git a/bin/Resources/fmodex.dll b/libs/dll-binaries/i686/fmodex.dll
similarity index 100%
rename from bin/Resources/fmodex.dll
rename to libs/dll-binaries/i686/fmodex.dll
diff --git a/bin/Resources/libgme.dll b/libs/dll-binaries/i686/libgme.dll
similarity index 100%
rename from bin/Resources/libgme.dll
rename to libs/dll-binaries/i686/libgme.dll
diff --git a/libs/dll-binaries/i686/mgwhelp.dll b/libs/dll-binaries/i686/mgwhelp.dll
new file mode 100644
index 00000000..3cf97424
Binary files /dev/null and b/libs/dll-binaries/i686/mgwhelp.dll differ
diff --git a/bin/Resources/fmod64.dll b/libs/dll-binaries/x86_64/Old/fmod64.dll
similarity index 100%
rename from bin/Resources/fmod64.dll
rename to libs/dll-binaries/x86_64/Old/fmod64.dll
diff --git a/bin/Resources/fmodexL64.dll b/libs/dll-binaries/x86_64/Old/fmodexL64.dll
similarity index 100%
rename from bin/Resources/fmodexL64.dll
rename to libs/dll-binaries/x86_64/Old/fmodexL64.dll
diff --git a/libs/dll-binaries/x86_64/exchndl.dll b/libs/dll-binaries/x86_64/exchndl.dll
new file mode 100644
index 00000000..747d7a3d
Binary files /dev/null and b/libs/dll-binaries/x86_64/exchndl.dll differ
diff --git a/bin/Resources/fmodex64.dll b/libs/dll-binaries/x86_64/fmodex64.dll
similarity index 100%
rename from bin/Resources/fmodex64.dll
rename to libs/dll-binaries/x86_64/fmodex64.dll
diff --git a/libs/dll-binaries/x86_64/libgme.dll b/libs/dll-binaries/x86_64/libgme.dll
new file mode 100644
index 00000000..2ba99450
Binary files /dev/null and b/libs/dll-binaries/x86_64/libgme.dll differ
diff --git a/libs/dll-binaries/x86_64/mgwhelp.dll b/libs/dll-binaries/x86_64/mgwhelp.dll
new file mode 100644
index 00000000..4e30e140
Binary files /dev/null and b/libs/dll-binaries/x86_64/mgwhelp.dll differ
diff --git a/libs/gme/win64/libgme.dll.a b/libs/gme/win64/libgme.dll.a
new file mode 100644
index 00000000..38079dc2
Binary files /dev/null and b/libs/gme/win64/libgme.dll.a differ
diff --git a/libs/libpng-src/projects/visualc10/.gitignore b/libs/libpng-src/projects/visualc10/.gitignore
index 118a15cb..e1bec81f 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 fb53826e..eaa3d4ff 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 488a5428..1c5340cd 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 814641d3..a7055ddb 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/srb2-vc10.sln b/srb2-vc10.sln
index ecceafd5..b4415bfc 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/srb2.png b/srb2.png
index 9c13eae9..fccde9c3 100644
Binary files a/srb2.png and b/srb2.png differ
diff --git a/srb2banner.png b/srb2banner.png
new file mode 100644
index 00000000..9c13eae9
Binary files /dev/null and b/srb2banner.png differ
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 26583e55..faa860d4 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -229,10 +229,17 @@ set(SRB2_CONFIG_YASM OFF CACHE BOOL
set(SRB2_CONFIG_STATIC_OPENGL OFF CACHE BOOL
"Use statically linked OpenGL. NOT RECOMMENDED.")
+### 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).")
+endif()
+
if(${SRB2_CONFIG_HAVE_BLUA})
add_definitions(-DHAVE_BLUA)
set(SRB2_LUA_SOURCES
lua_baselib.c
+ lua_blockmaplib.c
lua_consolelib.c
lua_hooklib.c
lua_hudlib.c
@@ -316,7 +323,17 @@ if(${SRB2_CONFIG_HAVE_BLUA})
endif()
if(${SRB2_CONFIG_HAVE_GME})
- find_package(GME)
+ if(${SRB2_CONFIG_USE_INTERNAL_LIBRARIES})
+ set(GME_FOUND ON)
+ set(GME_INCLUDE_DIRS ${CMAKE_SOURCE_DIR}/libs/gme/include)
+ if(${SRB2_SYSTEM_BITS} EQUAL 64)
+ set(GME_LIBRARIES "-L${CMAKE_SOURCE_DIR}/libs/gme/win64 -lgme")
+ else() # 32-bit
+ set(GME_LIBRARIES "-L${CMAKE_SOURCE_DIR}/libs/gme/win32 -lgme")
+ endif()
+ else()
+ find_package(GME)
+ endif()
if(${GME_FOUND})
set(SRB2_HAVE_GME ON)
add_definitions(-DHAVE_LIBGME)
@@ -326,23 +343,44 @@ if(${SRB2_CONFIG_HAVE_GME})
endif()
if(${SRB2_CONFIG_HAVE_ZLIB})
- find_package(ZLIB)
+ if(${SRB2_CONFIG_USE_INTERNAL_LIBRARIES})
+ set(ZLIB_FOUND ON)
+ set(ZLIB_INCLUDE_DIRS ${CMAKE_SOURCE_DIR}/libs/zlib)
+ if(${SRB2_SYSTEM_BITS} EQUAL 64)
+ set(ZLIB_LIBRARIES "-L${CMAKE_SOURCE_DIR}/libs/zlib/win32 -lz64")
+ else() # 32-bit
+ set(ZLIB_LIBRARIES "-L${CMAKE_SOURCE_DIR}/libs/zlib/win32 -lz32")
+ endif()
+ else()
+ find_package(ZLIB)
+ endif()
if(${ZLIB_FOUND})
set(SRB2_HAVE_ZLIB ON)
+ add_definitions(-DHAVE_ZLIB)
else()
- message(WARNING "You have specified that ZLIB is available but it was not found. SRB2 may not compile correctly.")
+ message(WARNING "You have specified that ZLIB is available but it was not found. SRB2Kart may not compile correctly.")
endif()
endif()
if(${SRB2_CONFIG_HAVE_PNG} AND ${SRB2_CONFIG_HAVE_ZLIB})
if (${ZLIB_FOUND})
- find_package(PNG)
+ if(${SRB2_CONFIG_USE_INTERNAL_LIBRARIES})
+ set(PNG_FOUND ON)
+ set(PNG_INCLUDE_DIRS ${CMAKE_SOURCE_DIR}/libs/libpng-src)
+ if(${SRB2_SYSTEM_BITS} EQUAL 64)
+ set(PNG_LIBRARIES "-L${CMAKE_SOURCE_DIR}/libs/libpng-src/projects -lpng64")
+ else() # 32-bit
+ set(PNG_LIBRARIES "-L${CMAKE_SOURCE_DIR}/libs/libpng-src/projects -lpng32")
+ endif()
+ else()
+ find_package(PNG)
+ endif()
if(${PNG_FOUND})
set(SRB2_HAVE_PNG ON)
add_definitions(-DHAVE_PNG)
add_definitions(-D_LARGEFILE64_SOURCE)
else()
- message(WARNING "You have specified that PNG is available but it was not found. SRB2 may not compile correctly.")
+ message(WARNING "You have specified that PNG is available but it was not found. SRB2Kart may not compile correctly.")
endif()
endif()
endif()
@@ -447,5 +485,5 @@ if(${CMAKE_SYSTEM} MATCHES Windows)
endif()
if(NOT ${SRB2_SDL2_AVAILABLE} AND NOT ${SRB2_WIN32_AVAILABLE})
- message(FATAL_ERROR "There are no targets available to build an SRB2 executable. :(")
+ message(FATAL_ERROR "There are no targets available to build an SRB2Kart executable. :(")
endif()
diff --git a/src/Makefile b/src/Makefile
index 012de5be..6c686c2d 100644
--- a/src/Makefile
+++ b/src/Makefile
@@ -2,7 +2,7 @@
# GNU Make makefile for SRB2
#############################################################################
# Copyright (C) 1998-2000 by DooM Legacy Team.
-# Copyright (C) 2003-2014 by Sonic Team Junior.
+# Copyright (C) 2003-2018 by Sonic Team Junior.
#
# This program is free software distributed under the
# terms of the GNU General Public License, version 2.
@@ -107,8 +107,18 @@ 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
@@ -286,11 +296,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
@@ -419,7 +431,7 @@ else
WINDRESFLAGS = -DNDEBUG
CFLAGS+=-O3
endif
- CFLAGS+=-g $(OPTS) $(M5) $(WINDRESFLAGS)
+ CFLAGS+=-g $(OPTS) $(ARCHOPTS) $(WINDRESFLAGS)
ifdef YASM
ifdef STABS
@@ -719,7 +731,6 @@ $(BIN)/s_openal.so: $(OBJDIR)/s_openal.o
-$(MKDIR) $(BIN)
@echo Linking S_OpenAL.so...
$(CC) --shared $^ -o $@ -g --nostartfiles -lm -lopenal
-
endif
else
@@ -914,15 +925,15 @@ 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
@@ -952,11 +963,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
+ $(CC) $(ARCHOPTS) -Os -o $(OBJDIR)/s_openal.o -DHW3SOUND -DUNIXCOMMON -shared -nostartfiles -c hardware/s_openal/s_openal.c
endif
ifdef FILTERS
diff --git a/src/Makefile.cfg b/src/Makefile.cfg
index 68cced81..1238050b 100644
--- a/src/Makefile.cfg
+++ b/src/Makefile.cfg
@@ -20,7 +20,7 @@ GCC64=1
endif
ifdef GCC64
-GCC64=1
+GCC63=1
endif
ifdef GCC63
@@ -112,9 +112,7 @@ 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
@@ -190,9 +188,6 @@ endif
ifdef GCC46
WFLAGS+=-Wno-suggest-attribute=noreturn
endif
-ifdef GCC71
-WFLAGS+=-Wno-error=implicit-fallthrough -Wimplicit-fallthrough=3
-endif
ifndef MINGW
ifdef GCC45
@@ -222,6 +217,18 @@ endif
ifdef GCC61
WFLAGS+=-Wno-tautological-compare -Wno-error=tautological-compare
endif
+ifdef GCC71
+ WFLAGS+=-Wno-error=implicit-fallthrough
+ WFLAGS+=-Wno-implicit-fallthrough
+endif
+ifdef GCC80
+ 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
+endif
#indicate platform and what interface use with
@@ -235,6 +242,7 @@ ifndef LINUX
ifndef FREEBSD
ifndef CYGWIN32
ifndef MINGW
+ifndef MINGW64
ifndef SDL
ifndef NDS
ifndef DUMMY
@@ -252,6 +260,7 @@ endif
endif
endif
endif
+endif
#determine the interface directory (where you put all i_*.c)
i_cdmus_o=$(OBJDIR)/i_cdmus.o
diff --git a/src/am_map.c b/src/am_map.c
index b28cecf1..5e73d2ec 100644
--- a/src/am_map.c
+++ b/src/am_map.c
@@ -2,7 +2,7 @@
//-----------------------------------------------------------------------------
// Copyright (C) 1993-1996 by id Software, Inc.
// Copyright (C) 1998-2000 by DooM Legacy Team.
-// Copyright (C) 1999-2016 by Sonic Team Junior.
+// Copyright (C) 1999-2018 by Sonic Team Junior.
//
// This program is free software distributed under the
// terms of the GNU General Public License, version 2.
@@ -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;
@@ -50,8 +49,6 @@ static const UINT8 NOCLIMBYELLOWS = (11*16);
// 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 +65,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 +102,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 +125,10 @@ typedef struct
// A line drawing of the player pointing right,
// starting from the middle.
//
+
+#define PLAYERRADIUS (16*(1<
@@ -166,27 +161,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 +193,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 +210,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 +249,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 +260,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 +285,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 +355,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 +385,7 @@ static void AM_LevelInit(void)
void AM_Stop(void)
{
automapactive = false;
- stopped = true;
+ am_stopped = true;
}
/** Enables automap.
@@ -457,15 +396,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 +441,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 +453,8 @@ boolean AM_Responder(event_t *ev)
}
}
}
-
else if (ev->type == ev_keydown)
{
-
rc = true;
switch (ev->data1)
{
@@ -554,7 +490,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 +508,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 +562,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 +581,6 @@ void AM_Ticker(void)
if (dedicated || !automapactive)
return;
- amclock++;
-
if (followplayer)
AM_doFollowPlayer();
@@ -671,72 +599,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 +734,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 +750,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 +768,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 +785,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 +797,8 @@ static void AM_drawFline_soft(const fline_t *fl, INT32 color)
d += ax;
}
}
+
+ #undef PUTDOT
}
//
@@ -1004,15 +869,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 +890,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 +912,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 +933,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 +941,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 +954,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 +962,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 +1026,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 +1039,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 +1094,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/am_map.h b/src/am_map.h
index df145848..4e8c782a 100644
--- a/src/am_map.h
+++ b/src/am_map.h
@@ -2,7 +2,7 @@
//-----------------------------------------------------------------------------
// Copyright (C) 1993-1996 by id Software, Inc.
// Copyright (C) 1998-2000 by DooM Legacy Team.
-// Copyright (C) 1999-2016 by Sonic Team Junior.
+// Copyright (C) 1999-2018 by Sonic Team Junior.
//
// This program is free software distributed under the
// terms of the GNU General Public License, version 2.
diff --git a/src/asm_defs.inc b/src/asm_defs.inc
index db59d2c6..e494a676 100644
--- a/src/asm_defs.inc
+++ b/src/asm_defs.inc
@@ -1,7 +1,7 @@
// SONIC ROBO BLAST 2
//-----------------------------------------------------------------------------
// Copyright (C) 1998-2000 by DooM Legacy Team.
-// Copyright (C) 1999-2014 by Sonic Team Junior.
+// Copyright (C) 1999-2018 by Sonic Team Junior.
//
// This program is free software distributed under the
// terms of the GNU General Public License, version 2.
diff --git a/src/b_bot.c b/src/b_bot.c
index ca48a98b..b84db288 100644
--- a/src/b_bot.c
+++ b/src/b_bot.c
@@ -1,7 +1,7 @@
// SONIC ROBO BLAST 2
//-----------------------------------------------------------------------------
// Copyright (C) 2007-2016 by John "JTE" Muniz.
-// Copyright (C) 2011-2016 by Sonic Team Junior.
+// Copyright (C) 2011-2018 by Sonic Team Junior.
//
// This program is free software distributed under the
// terms of the GNU General Public License, version 2.
diff --git a/src/b_bot.h b/src/b_bot.h
index 259405f3..20b2803b 100644
--- a/src/b_bot.h
+++ b/src/b_bot.h
@@ -1,7 +1,7 @@
// SONIC ROBO BLAST 2
//-----------------------------------------------------------------------------
// Copyright (C) 2007-2016 by John "JTE" Muniz.
-// Copyright (C) 2012-2016 by Sonic Team Junior.
+// Copyright (C) 2012-2018 by Sonic Team Junior.
//
// This program is free software distributed under the
// terms of the GNU General Public License, version 2.
diff --git a/src/blua/Makefile.cfg b/src/blua/Makefile.cfg
index e3fb3df4..b1131eac 100644
--- a/src/blua/Makefile.cfg
+++ b/src/blua/Makefile.cfg
@@ -39,6 +39,7 @@ 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 \
diff --git a/src/byteptr.h b/src/byteptr.h
index 364e6520..aa09d6be 100644
--- a/src/byteptr.h
+++ b/src/byteptr.h
@@ -1,7 +1,7 @@
// SONIC ROBO BLAST 2
//-----------------------------------------------------------------------------
// Copyright (C) 1998-2000 by DooM Legacy Team.
-// Copyright (C) 1999-2016 by Sonic Team Junior.
+// Copyright (C) 1999-2018 by Sonic Team Junior.
//
// This program is free software distributed under the
// terms of the GNU General Public License, version 2.
diff --git a/src/command.c b/src/command.c
index 53508667..bb2ea86e 100644
--- a/src/command.c
+++ b/src/command.c
@@ -1,7 +1,7 @@
// SONIC ROBO BLAST 2
//-----------------------------------------------------------------------------
// Copyright (C) 1998-2000 by DooM Legacy Team.
-// Copyright (C) 1999-2016 by Sonic Team Junior.
+// Copyright (C) 1999-2018 by Sonic Team Junior.
//
// This program is free software distributed under the
// terms of the GNU General Public License, version 2.
@@ -33,6 +33,7 @@
#include "hu_stuff.h"
#include "p_setup.h"
#include "lua_script.h"
+#include "d_netfil.h" // findfile
//========
// protos.
@@ -50,6 +51,9 @@ 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);
static const char *CV_StringValue(const char *var_name);
@@ -68,6 +72,19 @@ CV_PossibleValue_t kartspeed_cons_t[] = {
{0, "Easy"}, {1, "Normal"}, {2, "Hard"},
{0, NULL}};
+// Filter consvars by EXECVERSION
+// First implementation is 2 (1.0.2), so earlier configs default at 1 (1.0.0)
+// Also set CV_HIDEN during runtime, after config is loaded
+
+static boolean execversion_enabled = false;
+consvar_t cv_execversion = {"execversion","1",CV_CALL,CV_Unsigned, CV_EnforceExecVersion, 0, NULL, NULL, 0, 0, NULL};
+
+// for default joyaxis detection
+#if 0
+static boolean joyaxis_default[4] = {false,false,false,false};
+static INT32 joyaxis_count[4] = {0,0,0,0};
+#endif
+
#define COM_BUF_SIZE 8192 // command buffer size
#define MAX_ALIAS_RECURSION 100 // max recursion allowed for aliases
@@ -635,6 +652,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)
{
@@ -643,13 +661,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"))
@@ -1129,7 +1157,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);
@@ -1698,6 +1726,108 @@ void CV_AddValue(consvar_t *var, INT32 increment)
var->changed = 1; // user has changed it now
}
+void CV_InitFilterVar(void)
+{
+#if 0
+ UINT8 i;
+ for (i = 0; i < 4; i++)
+ {
+ joyaxis_default[i] = true;
+ joyaxis_count[i] = 0;
+ }
+#endif
+}
+
+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 1
+ // We don't have changed axis defaults yet
+ (void)v;
+ (void)valstr;
+#else
+ UINT8 i;
+
+ // If ALL axis settings are previous defaults, set them to the new defaults
+ // EXECVERSION < 26 (2.1.21)
+
+ for (i = 0; i < 4; i++)
+ {
+ if (joyaxis_default[i])
+ {
+ if (!stricmp(v->name, "joyaxis_fire"))
+ {
+ if (joyaxis_count[i] > 7) return false;
+ else if (joyaxis_count[i] == 7) return true;
+
+ if (!stricmp(valstr, "None")) joyaxis_count[i]++;
+ else joyaxis_default[i] = false;
+ }
+ // reset all axis settings to defaults
+ if (joyaxis_count[i] == 7)
+ {
+ switch (i)
+ {
+ default:
+ COM_BufInsertText(va("%s \"%s\"\n", cv_turnaxis.name, cv_turnaxis.defaultvalue));
+ COM_BufInsertText(va("%s \"%s\"\n", cv_moveaxis.name, cv_moveaxis.defaultvalue));
+ COM_BufInsertText(va("%s \"%s\"\n", cv_brakeaxis.name, cv_brakeaxis.defaultvalue));
+ COM_BufInsertText(va("%s \"%s\"\n", cv_aimaxis.name, cv_aimaxis.defaultvalue));
+ COM_BufInsertText(va("%s \"%s\"\n", cv_lookaxis.name, cv_lookaxis.defaultvalue));
+ COM_BufInsertText(va("%s \"%s\"\n", cv_fireaxis.name, cv_fireaxis.defaultvalue));
+ COM_BufInsertText(va("%s \"%s\"\n", cv_driftaxis.name, cv_driftaxis.defaultvalue));
+ break;
+ }
+ joyaxis_count[i]++;
+ return false;
+ }
+ }
+ }
+#endif
+
+ // we haven't reached our counts yet, or we're not default
+ return true;
+}
+
+static boolean CV_FilterVarByVersion(consvar_t *v, const char *valstr)
+{
+ // True means allow the CV change, False means block it
+
+ // We only care about CV_SAVE because this filters the user's config files
+ // We do this same check in CV_Command
+ if (!(v->flags & CV_SAVE))
+ return true;
+
+ if (GETMAJOREXECVERSION(cv_execversion.value) < 2) // 2 = 1.0.2
+ {
+#if 0
+ // We don't have changed saved cvars yet
+ if (!stricmp(v->name, "alwaysmlook")
+ || !stricmp(v->name, "alwaysmlook2")
+ || !stricmp(v->name, "mousemove")
+ || !stricmp(v->name, "mousemove2"))
+ return false;
+#endif
+
+ // axis defaults were changed to be friendly to 360 controllers
+ // if ALL axis settings are defaults, then change them to new values
+ if (!CV_FilterJoyAxisVars(v, valstr))
+ return false;
+ }
+
+ return true;
+}
+
/** Displays or changes a variable from the console.
* Since the user is presumed to have been directly responsible
* for this change, the variable is marked as changed this game.
@@ -1722,8 +1852,11 @@ static boolean CV_Command(void)
return true;
}
- CV_Set(v, COM_Argv(1));
- v->changed = 1; // now it's been changed by (presumably) the user
+ if (!(v->flags & CV_SAVE) || CV_FilterVarByVersion(v, COM_Argv(1)))
+ {
+ CV_Set(v, COM_Argv(1));
+ v->changed = 1; // now it's been changed by (presumably) the user
+ }
return true;
}
diff --git a/src/command.h b/src/command.h
index dbac8bd8..82dfaf8a 100644
--- a/src/command.h
+++ b/src/command.h
@@ -1,7 +1,7 @@
// SONIC ROBO BLAST 2
//-----------------------------------------------------------------------------
// Copyright (C) 1998-2000 by DooM Legacy Team.
-// Copyright (C) 1999-2016 by Sonic Team Junior.
+// Copyright (C) 1999-2018 by Sonic Team Junior.
//
// This program is free software distributed under the
// terms of the GNU General Public License, version 2.
@@ -129,6 +129,11 @@ extern CV_PossibleValue_t CV_Natural[];
// SRB2kart
extern CV_PossibleValue_t kartspeed_cons_t[];
+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 ae401f8b..cb343d06 100644
--- a/src/config.h.in
+++ b/src/config.h.in
@@ -28,31 +28,31 @@
#define SRB2_COMP_REVISION "${SRB2_COMP_REVISION}"
#define SRB2_COMP_BRANCH "${SRB2_COMP_BRANCH}"
-#define SRB2_GIT_DESCRIBE "${SRB2_GIT_DESCRIBE}"
-#define SRB2_GIT_BRANCH "${SRB2_GIT_BRANCH}"
#define CMAKE_ASSETS_DIR "${CMAKE_SOURCE_DIR}/assets"
#else
/* Manually defined asset hashes for non-CMake builds
- * YYYY MM DD
- * Last updated 2018 / 11 / 14
+ * Last updated 2015 / 05 / 03 - SRB2 v2.1.15 - srb2.srb
+ * Last updated 2018 / 12 / 23 - SRB2 v2.1.22 - patch.dta
+ * Last updated 2019 / 01 / 18 - Kart v1.0.2 - Main assets
+ * Last updated 2019 / 01 / 15 - Kart v1.0.2 - patch.kart
*/
// Base SRB2 hashes
#define ASSET_HASH_SRB2_SRB "c1b9577687f8a795104aef4600720ea7"
#ifdef USE_PATCH_DTA
-#define ASSET_HASH_PATCH_DTA "dbbf8bc6121618ee3be2d5b14650429b"
+#define ASSET_HASH_PATCH_DTA "b04fd9624bfd94dc96dcf4f400f7deb4"
#endif
// SRB2Kart-specific hashes
#define ASSET_HASH_GFX_KART "99c39f223d84ebc78e67ab68f3bead95"
#define ASSET_HASH_TEXTURES_KART "ec8e9b7535cf585afe72ef277b08f490"
-#define ASSET_HASH_CHARS_KART "784ee9177b01c8cb26edff43eaf93d87"
-#define ASSET_HASH_MAPS_KART "84018d9b35d181ca9fcc2be5a9d43a45"
+#define ASSET_HASH_CHARS_KART "e2c428347dde52858a3dacd29fc5b964"
+#define ASSET_HASH_MAPS_KART "1335cd064656aedca359cfbb5233ac4a"
#ifdef USE_PATCH_KART
-#define ASSET_HASH_PATCH_KART "bb055c2cbbe1547f44606d394df1e068"
+#define ASSET_HASH_PATCH_KART "899aee1b63e731b7e2098406c85608b4"
#endif
#endif
diff --git a/src/console.c b/src/console.c
index 54c70841..a10d73e7 100644
--- a/src/console.c
+++ b/src/console.c
@@ -1,7 +1,7 @@
// SONIC ROBO BLAST 2
//-----------------------------------------------------------------------------
// Copyright (C) 1998-2000 by DooM Legacy Team.
-// Copyright (C) 1999-2016 by Sonic Team Junior.
+// Copyright (C) 1999-2018 by Sonic Team Junior.
//
// This program is free software distributed under the
// terms of the GNU General Public License, version 2.
@@ -59,10 +59,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
@@ -102,8 +99,6 @@ static void CON_RecalcSize(void);
static void CONS_hudlines_Change(void);
static void CONS_backcolor_Change(void);
-static void CON_DrawBackpic(patch_t *pic, INT32 startx, INT32 destwidth);
-//static void CON_DrawBackpic2(pic_t *pic, INT32 startx, INT32 destwidth);
//======================================================================
// CONSOLE VARS AND COMMANDS
@@ -287,6 +282,7 @@ void CON_SetupBackColormap(void)
case 18: palindex = 255; shift = 7; break; // Lavender
// Default green
default: palindex = 175; break;
+
}
// setup background colormap
@@ -894,7 +890,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)
@@ -1112,7 +1108,7 @@ boolean CON_Responder(event_t *ev)
// 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 ^ capslock)) //this is only really necessary for dedicated servers
@@ -1302,24 +1298,15 @@ void CONS_Printf(const char *fmt, ...)
if (con_startup)
{
#if (defined (_WINDOWS)) || (defined (__OS2__) && !defined (HAVE_SDL))
- static lumpnum_t con_backpic_lumpnum = UINT32_MAX;
- patch_t *con_backpic;
+ patch_t *con_backpic = W_CachePatchName("KARTKREW", PU_CACHE);
- if (con_backpic_lumpnum == UINT32_MAX)
- con_backpic_lumpnum = W_GetNumForName("KARTKREW");
+ // Jimita: CON_DrawBackpic just called V_DrawScaledPatch
+ V_DrawFixedPatch(0, 0, FRACUNIT/2, 0, con_backpic, NULL);
- // We load the raw lump, even in hardware mode
- con_backpic = (patch_t*)W_CacheLumpNum(con_backpic_lumpnum, PU_CACHE);
-
- // show startup screen and message using only 'software' graphics
- // (rendermode may be hardware accelerated, but the video mode is not set yet)
- CON_DrawBackpic(con_backpic, 0, vid.width); // put console background
- I_LoadingScreen(txt);
-
- Z_Unlock(con_backpic);
+ W_UnlockCachedPatch(con_backpic);
+ I_LoadingScreen(txt); // Win32/OS2 only
#else
- // here we display the console background and console text
- // (no hardware accelerated support for these versions)
+ // here we display the console text
CON_Drawer();
I_FinishUpdate(); // page flip or blit buffer
#endif
@@ -1506,7 +1493,7 @@ static void CON_DrawHudlines(void)
return;
if (chat_on && OLDCHAT)
- y = charheight; // leave place for chat input in the first row of text
+ y = charheight; // leave place for chat input in the first row of text (only do it if consolechat is on.)
else
y = 0;
@@ -1546,64 +1533,6 @@ static void CON_DrawHudlines(void)
con_clearlines = y; // this is handled by HU_Erase();
}
-// Scale a pic_t at 'startx' pos, to 'destwidth' columns.
-// startx, destwidth is resolution dependent
-// Used to draw console borders, console background.
-// The pic must be sized BASEVIDHEIGHT height.
-static void CON_DrawBackpic(patch_t *pic, INT32 startx, INT32 destwidth)
-{
- (void)startx;
- (void)destwidth;
- V_DrawFixedPatch(0, 0, FRACUNIT/2, 0, pic, NULL);
-}
-
-#if 0
-static inline void CON_DrawBackpic2(pic_t *pic, INT32 startx, INT32 destwidth)
-{
- INT32 x, y;
- INT32 v;
- UINT8 *src, *dest;
- const UINT8 *deststop;
- INT32 frac, fracstep;
-
- dest = screens[0]+startx;
- deststop = screens[0] + vid.rowbytes * vid.height;
-
- for (y = 0; y < con_curlines; y++, dest += vid.width)
- {
- // scale the picture to the resolution
- v = SHORT(pic->height) - ((con_curlines - y) * (BASEVIDHEIGHT-1) / vid.height) - 1;
-
- src = pic->data + v*SHORT(pic->width);
-
- // in case of the console backpic, simplify
- if (SHORT(pic->width) == destwidth)
- M_Memcpy(dest, src, destwidth);
- else
- {
- // scale pic to screen width
- frac = 0;
- fracstep = (SHORT(pic->width)<<16)/destwidth;
- for (x = 0; x < destwidth; x += 4)
- {
- if (dest+x > deststop) break;
- dest[x] = src[frac>>FRACBITS];
- frac += fracstep;
- if (dest+x+1 > deststop) break;
- dest[x+1] = src[frac>>FRACBITS];
- frac += fracstep;
- if (dest+x+2 > deststop) break;
- dest[x+2] = src[frac>>FRACBITS];
- frac += fracstep;
- if (dest+x+3 > deststop) break;
- dest[x+3] = src[frac>>FRACBITS];
- frac += fracstep;
- }
- }
- }
-}
-#endif
-
// draw the console background, text, and prompt if enough place
//
static void CON_DrawConsole(void)
@@ -1626,18 +1555,10 @@ static void CON_DrawConsole(void)
// draw console background
if (cons_backpic.value || con_forcepic)
{
- static lumpnum_t con_backpic_lumpnum = UINT32_MAX;
- patch_t *con_backpic;
+ patch_t *con_backpic = W_CachePatchName("KARTKREW", PU_CACHE);
- if (con_backpic_lumpnum == UINT32_MAX)
- con_backpic_lumpnum = W_GetNumForName("KARTKREW");
-
- con_backpic = (patch_t*)W_CachePatchNum(con_backpic_lumpnum, PU_CACHE);
-
- if (rendermode != render_soft)
- V_DrawFixedPatch(0, 0, FRACUNIT/2, 0, con_backpic, NULL);
- else if (rendermode != render_none)
- CON_DrawBackpic(con_backpic, 0, vid.width); // picture as background
+ // Jimita: CON_DrawBackpic just called V_DrawScaledPatch
+ V_DrawFixedPatch(0, 0, FRACUNIT/2, 0, con_backpic, NULL);
W_UnlockCachedPatch(con_backpic);
}
diff --git a/src/console.h b/src/console.h
index e4f01c8e..98df6ee2 100644
--- a/src/console.h
+++ b/src/console.h
@@ -1,7 +1,7 @@
// SONIC ROBO BLAST 2
//-----------------------------------------------------------------------------
// Copyright (C) 1998-2000 by DooM Legacy Team.
-// Copyright (C) 1999-2016 by Sonic Team Junior.
+// Copyright (C) 1999-2018 by Sonic Team Junior.
//
// This program is free software distributed under the
// terms of the GNU General Public License, version 2.
diff --git a/src/d_clisrv.c b/src/d_clisrv.c
index d3503971..c84faa72 100644
--- a/src/d_clisrv.c
+++ b/src/d_clisrv.c
@@ -1,7 +1,7 @@
// SONIC ROBO BLAST 2
//-----------------------------------------------------------------------------
// Copyright (C) 1998-2000 by DooM Legacy Team.
-// Copyright (C) 1999-2016 by Sonic Team Junior.
+// Copyright (C) 1999-2018 by Sonic Team Junior.
//
// This program is free software distributed under the
// terms of the GNU General Public License, version 2.
@@ -25,6 +25,7 @@
#include "g_game.h"
#include "hu_stuff.h"
#include "keys.h"
+#include "g_input.h" // JOY1
#include "m_menu.h"
#include "console.h"
#include "d_netfil.h"
@@ -84,7 +85,7 @@ UINT8 playernode[MAXPLAYERS];
// Minimum timeout for sending the savegame
// The actual timeout will be longer depending on the savegame length
-tic_t jointimeout = (10*TICRATE);
+tic_t jointimeout = (3*TICRATE);
static boolean sendingsavegame[MAXNETNODES]; // Are we sending the savegame?
static tic_t freezetimeout[MAXNETNODES]; // Until when can this node freeze the server before getting a timeout?
@@ -163,7 +164,7 @@ ticcmd_t netcmds[BACKUPTICS][MAXPLAYERS];
static textcmdtic_t *textcmds[TEXTCMD_HASH_SIZE] = {NULL};
-static consvar_t cv_showjoinaddress = {"showjoinaddress", "On", 0, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL};
+consvar_t cv_showjoinaddress = {"showjoinaddress", "On", 0, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL};
static CV_PossibleValue_t playbackspeed_cons_t[] = {{1, "MIN"}, {10, "MAX"}, {0, NULL}};
consvar_t cv_playbackspeed = {"playbackspeed", "1", 0, playbackspeed_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
@@ -619,7 +620,6 @@ static inline void resynch_write_player(resynch_pak *rsp, const size_t i)
rsp->starposty = SHORT(players[i].starposty);
rsp->starpostz = SHORT(players[i].starpostz);
rsp->starpostnum = LONG(players[i].starpostnum);
- rsp->starpostcount = LONG(players[i].starpostcount);
rsp->starposttime = (tic_t)LONG(players[i].starposttime);
rsp->starpostangle = (angle_t)LONG(players[i].starpostangle);
@@ -755,7 +755,6 @@ static void resynch_read_player(resynch_pak *rsp)
players[i].starposty = SHORT(rsp->starposty);
players[i].starpostz = SHORT(rsp->starpostz);
players[i].starpostnum = LONG(rsp->starpostnum);
- players[i].starpostcount = LONG(rsp->starpostcount);
players[i].starposttime = (tic_t)LONG(rsp->starposttime);
players[i].starpostangle = (angle_t)LONG(rsp->starpostangle);
@@ -1304,7 +1303,7 @@ static void SV_SendServerInfo(INT32 node, tic_t servertime)
netbuffer->u.serverinfo.leveltime = (tic_t)LONG(leveltime);
netbuffer->u.serverinfo.numberofplayer = (UINT8)D_NumPlayers();
- netbuffer->u.serverinfo.maxplayer = (UINT8)cv_maxplayers.value;
+ netbuffer->u.serverinfo.maxplayer = (UINT8)(min((dedicated ? MAXPLAYERS-1 : MAXPLAYERS), cv_maxplayers.value));
netbuffer->u.serverinfo.gametype = (UINT8)(G_BattleGametype() ? VANILLA_GT_MATCH : VANILLA_GT_RACE); // SRB2Kart: Vanilla's gametype constants for MS support
netbuffer->u.serverinfo.modifiedgame = (UINT8)modifiedgame;
netbuffer->u.serverinfo.cheatsenabled = CV_CheatsEnabled();
@@ -1488,9 +1487,11 @@ static boolean SV_SendServerConfig(INT32 node)
for (i = 0; i < MAXPLAYERS; i++)
{
+ netbuffer->u.servercfg.adminplayers[i] = (SINT8)adminplayers[i];
+
if (!playeringame[i])
continue;
- netbuffer->u.servercfg.adminplayers[i] = (SINT8)adminplayers[i];
+
netbuffer->u.servercfg.playerskins[i] = (UINT8)players[i].skin;
netbuffer->u.servercfg.playercolor[i] = (UINT8)players[i].skincolor;
}
@@ -1739,6 +1740,8 @@ static void SendAskInfo(INT32 node, boolean viams)
serverelem_t serverlist[MAXSERVERLIST];
UINT32 serverlistcount = 0;
+#define FORCECLOSE 0x8000
+
static void SL_ClearServerList(INT32 connectedserver)
{
UINT32 i;
@@ -1746,7 +1749,7 @@ static void SL_ClearServerList(INT32 connectedserver)
for (i = 0; i < serverlistcount; i++)
if (connectedserver != serverlist[i].node)
{
- Net_CloseConnection(serverlist[i].node);
+ Net_CloseConnection(serverlist[i].node|FORCECLOSE);
serverlist[i].node = 0;
}
serverlistcount = 0;
@@ -1828,12 +1831,25 @@ void CL_UpdateServerList(boolean internetsearch, INT32 room)
// Make sure MS version matches our own, to
// thwart nefarious servers who lie to the MS.
- if(strcmp(version, server_list[i].version) == 0)
+ if (strcmp(version, server_list[i].version) == 0)
{
INT32 node = I_NetMakeNodewPort(server_list[i].ip, server_list[i].port);
if (node == -1)
break; // no more node free
SendAskInfo(node, true);
+ // Force close the connection so that servers can't eat
+ // up nodes forever if we never get a reply back from them
+ // (usually when they've not forwarded their ports).
+ //
+ // Don't worry, we'll get in contact with the working
+ // servers again when they send SERVERINFO to us later!
+ //
+ // (Note: as a side effect this probably means every
+ // server in the list will probably be using the same node (e.g. node 1),
+ // not that it matters which nodes they use when
+ // the connections are closed afterwards anyway)
+ // -- Monster Iestyn 12/11/18
+ Net_CloseConnection(node|FORCECLOSE);
}
}
}
@@ -1903,7 +1919,7 @@ static boolean CL_ServerConnectionSearchTicker(boolean viams, tic_t *asksent)
M_StartMessage(M_GetText(
"You have too many WAD files loaded\n"
"to add ones the server is using.\n"
- "Please restart SRB2 before connecting.\n\n"
+ "Please restart SRB2Kart before connecting.\n\n"
"Press ESC\n"
), NULL, MM_NOTHING);
return false;
@@ -2060,7 +2076,8 @@ static boolean CL_ServerConnectionTicker(boolean viams, const char *tmpsave, tic
I_OsPolling();
key = I_GetKey();
- if (key == KEY_ESCAPE)
+ // Only ESC and non-keyboard keys abort connection
+ if (key == KEY_ESCAPE || key >= KEY_MOUSE1)
{
CONS_Printf(M_GetText("Network game synchronization aborted.\n"));
// M_StartMessage(M_GetText("Network game synchronization aborted.\n\nPress ESC\n"), NULL, MM_NOTHING);
@@ -2760,13 +2777,16 @@ static void Command_Kick(void)
if (pn == -1 || pn == 0)
return;
- // Special case if we are trying to kick a player who is downloading the game state:
- // trigger a timeout instead of kicking them, because a kick would only
- // take effect after they have finished downloading
- if (sendingsavegame[playernode[pn]])
+ if (server)
{
- Net_ConnectionTimeout(playernode[pn]);
- return;
+ // Special case if we are trying to kick a player who is downloading the game state:
+ // trigger a timeout instead of kicking them, because a kick would only
+ // take effect after they have finished downloading
+ if (sendingsavegame[playernode[pn]])
+ {
+ Net_ConnectionTimeout(playernode[pn]);
+ return;
+ }
}
WRITESINT8(p, pn);
@@ -2820,7 +2840,9 @@ static void Got_KickCmd(UINT8 **p, INT32 playernum)
}
// Is playernum authorized to make this kick?
- if (playernum != serverplayer && !IsPlayerAdmin(playernum))
+ if (playernum != serverplayer && !IsPlayerAdmin(playernum)
+ /*&& !(playerpernode[playernode[playernum]] == 2
+ //&& nodetoplayer2[playernode[playernum]] == pnum)*/)
{
// We received a kick command from someone who isn't the
// server or admin, and who isn't in splitscreen removing
@@ -3003,6 +3025,9 @@ static void Got_KickCmd(UINT8 **p, INT32 playernum)
}
}
+static CV_PossibleValue_t netticbuffer_cons_t[] = {{0, "MIN"}, {3, "MAX"}, {0, NULL}};
+consvar_t cv_netticbuffer = {"netticbuffer", "1", CV_SAVE, netticbuffer_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
+
consvar_t cv_allownewplayer = {"allowjoin", "On", CV_NETVAR, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL };
#ifdef VANILLAJOINNEXTROUND
consvar_t cv_joinnextround = {"joinnextround", "Off", CV_NETVAR, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL}; /// \todo not done
@@ -3010,7 +3035,7 @@ consvar_t cv_joinnextround = {"joinnextround", "Off", CV_NETVAR, CV_OnOff, NULL,
static CV_PossibleValue_t maxplayers_cons_t[] = {{2, "MIN"}, {MAXPLAYERS, "MAX"}, {0, NULL}};
consvar_t cv_maxplayers = {"maxplayers", "8", CV_SAVE, maxplayers_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
static CV_PossibleValue_t resynchattempts_cons_t[] = {{0, "MIN"}, {20, "MAX"}, {0, NULL}};
-consvar_t cv_resynchattempts = {"resynchattempts", "10", 0, resynchattempts_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL };
+consvar_t cv_resynchattempts = {"resynchattempts", "5", CV_SAVE, resynchattempts_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL };
consvar_t cv_blamecfail = {"blamecfail", "Off", 0, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL };
// max file size to send to a player (in kilobytes)
@@ -3058,7 +3083,6 @@ void D_ClientServerInit(void)
CV_RegisterVar(&cv_joinnextround);
#endif
CV_RegisterVar(&cv_showjoinaddress);
- CV_RegisterVar(&cv_resynchattempts);
CV_RegisterVar(&cv_blamecfail);
#ifdef DUMPCONSISTENCY
CV_RegisterVar(&cv_dumpconsistency);
@@ -3292,14 +3316,14 @@ static void Got_AddPlayer(UINT8 **p, INT32 playernum)
if (netgame)
{
- if (server && netgame && cv_showjoinaddress.value)
+ 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);
+ 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')
@@ -3343,6 +3367,7 @@ static boolean SV_AddWaitingPlayers(void)
UINT8 newplayernum = 0;
// What is the reason for this? Why can't newplayernum always be 0?
+ // Sal: Because the dedicated player is stupidly forced into players[0].....
if (dedicated)
newplayernum = 1;
@@ -3529,17 +3554,22 @@ static size_t TotalTextCmdPerTic(tic_t tic)
*/
static void HandleConnect(SINT8 node)
{
+ // Sal: Dedicated mode is INCREDIBLY hacked together.
+ // If a server filled out, then it'd overwrite the host and turn everyone into weird husks.....
+ // It's too much effort to legimately fix right now. Just prevent it from reaching that state.
+ UINT8 maxplayers = min((dedicated ? MAXPLAYERS-1 : MAXPLAYERS), cv_maxplayers.value);
+
if (bannednode && bannednode[node])
SV_SendRefuse(node, M_GetText("You have been banned\nfrom the server"));
else if (netbuffer->u.clientcfg.version != VERSION
|| netbuffer->u.clientcfg.subversion != SUBVERSION)
- SV_SendRefuse(node, va(M_GetText("Different SRB2 versions cannot\nplay a netgame!\n(server version %d.%d.%d)"), VERSION/100, VERSION%100, SUBVERSION));
+ SV_SendRefuse(node, va(M_GetText("Different SRB2Kart versions cannot\nplay a netgame!\n(server version %d.%d.%d)"), VERSION/100, VERSION%100, SUBVERSION));
else if (!cv_allownewplayer.value && node)
SV_SendRefuse(node, M_GetText("The server is not accepting\njoins for the moment"));
- else if (D_NumPlayers() >= cv_maxplayers.value)
- SV_SendRefuse(node, va(M_GetText("Maximum players reached: %d"), cv_maxplayers.value));
- else if (netgame && D_NumPlayers() + netbuffer->u.clientcfg.localplayers > cv_maxplayers.value)
- SV_SendRefuse(node, va(M_GetText("Number of local players\nwould exceed maximum: %d"), cv_maxplayers.value));
+ else if (D_NumPlayers() >= maxplayers)
+ SV_SendRefuse(node, va(M_GetText("Maximum players reached: %d"), maxplayers));
+ else if (netgame && D_NumPlayers() + netbuffer->u.clientcfg.localplayers > maxplayers)
+ SV_SendRefuse(node, va(M_GetText("Number of local players\nwould exceed maximum: %d"), maxplayers));
else if (netgame && netbuffer->u.clientcfg.localplayers > 4) // Hacked client?
SV_SendRefuse(node, M_GetText("Too many players from\nthis node."));
else if (netgame && !netbuffer->u.clientcfg.localplayers) // Stealth join?
@@ -3855,6 +3885,32 @@ static void HandlePacketFromAwayNode(SINT8 node)
#undef SERVERONLY
}
+/** Checks ticcmd for "speed hacks"
+ *
+ * \param p Which player
+ * \return True if player is hacking
+ * \sa HandlePacketFromPlayer
+ *
+ */
+static boolean CheckForSpeedHacks(UINT8 p)
+{
+ if (netcmds[maketic%BACKUPTICS][p].forwardmove > MAXPLMOVE || netcmds[maketic%BACKUPTICS][p].forwardmove < -MAXPLMOVE
+ || netcmds[maketic%BACKUPTICS][p].sidemove > MAXPLMOVE || netcmds[maketic%BACKUPTICS][p].sidemove < -MAXPLMOVE
+ || netcmds[maketic%BACKUPTICS][p].driftturn > KART_FULLTURN || netcmds[maketic%BACKUPTICS][p].driftturn < -KART_FULLTURN)
+ {
+ XBOXSTATIC char buf[2];
+ CONS_Alert(CONS_WARNING, M_GetText("Illegal movement value received from node %d\n"), playernode[p]);
+ //D_Clearticcmd(k);
+
+ buf[0] = (char)p;
+ buf[1] = KICK_MSG_CON_FAIL;
+ SendNetXCmd(XD_KICK, &buf, 2);
+ return true;
+ }
+
+ return false;
+}
+
/** Handles a packet received from a node that is in game
*
* \param node The packet sender
@@ -3949,18 +4005,8 @@ FILESTAMP
G_MoveTiccmd(&netcmds[maketic%BACKUPTICS][netconsole], &netbuffer->u.clientpak.cmd, 1);
// Check ticcmd for "speed hacks"
- 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];
- CONS_Alert(CONS_WARNING, M_GetText("Illegal movement value received from node %d\n"), netconsole);
- //D_Clearticcmd(k);
-
- buf[0] = (char)netconsole;
- buf[1] = KICK_MSG_CON_FAIL;
- SendNetXCmd(XD_KICK, &buf, 2);
+ if (CheckForSpeedHacks((UINT8)netconsole))
break;
- }
// Splitscreen cmd
if (((netbuffer->packettype == PT_CLIENT2CMD || netbuffer->packettype == PT_CLIENT2MIS)
@@ -3970,6 +4016,9 @@ FILESTAMP
{
G_MoveTiccmd(&netcmds[maketic%BACKUPTICS][(UINT8)nodetoplayer2[node]],
&netbuffer->u.client2pak.cmd2, 1);
+
+ if (CheckForSpeedHacks((UINT8)nodetoplayer2[node]))
+ break;
}
if (((netbuffer->packettype == PT_CLIENT3CMD || netbuffer->packettype == PT_CLIENT3MIS)
@@ -3978,6 +4027,9 @@ FILESTAMP
{
G_MoveTiccmd(&netcmds[maketic%BACKUPTICS][(UINT8)nodetoplayer3[node]],
&netbuffer->u.client3pak.cmd3, 1);
+
+ if (CheckForSpeedHacks((UINT8)nodetoplayer3[node]))
+ break;
}
if ((netbuffer->packettype == PT_CLIENT4CMD || netbuffer->packettype == PT_CLIENT4MIS)
@@ -3985,6 +4037,9 @@ FILESTAMP
{
G_MoveTiccmd(&netcmds[maketic%BACKUPTICS][(UINT8)nodetoplayer4[node]],
&netbuffer->u.client4pak.cmd4, 1);
+
+ if (CheckForSpeedHacks((UINT8)nodetoplayer4[node]))
+ break;
}
// A delay before we check resynching
@@ -4557,31 +4612,30 @@ static void CL_SendClientCmd(void)
}
else if (gamestate != GS_NULL)
{
+ packetsize = sizeof (clientcmd_pak);
G_MoveTiccmd(&netbuffer->u.clientpak.cmd, &localcmds, 1);
netbuffer->u.clientpak.consistancy = SHORT(consistancy[gametic%BACKUPTICS]);
if (splitscreen || botingame) // Send a special packet with 2 cmd for splitscreen
{
netbuffer->packettype = (mis ? PT_CLIENT2MIS : PT_CLIENT2CMD);
+ packetsize = sizeof (client2cmd_pak);
G_MoveTiccmd(&netbuffer->u.client2pak.cmd2, &localcmds2, 1);
+
if (splitscreen > 1)
{
netbuffer->packettype = (mis ? PT_CLIENT3MIS : PT_CLIENT3CMD);
+ packetsize = sizeof (client3cmd_pak);
G_MoveTiccmd(&netbuffer->u.client3pak.cmd3, &localcmds3, 1);
+
if (splitscreen > 2)
{
netbuffer->packettype = (mis ? PT_CLIENT4MIS : PT_CLIENT4CMD);
- G_MoveTiccmd(&netbuffer->u.client4pak.cmd4, &localcmds4, 1);
packetsize = sizeof (client4cmd_pak);
+ G_MoveTiccmd(&netbuffer->u.client4pak.cmd4, &localcmds4, 1);
}
- else
- packetsize = sizeof (client3cmd_pak);
}
- else
- packetsize = sizeof (client2cmd_pak);
}
- else
- packetsize = sizeof (clientcmd_pak);
HSendPacket(servernode, false, 0, packetsize);
}
@@ -4906,6 +4960,10 @@ void TryRunTics(tic_t realtics)
ExtraDataTicker();
gametic++;
consistancy[gametic%BACKUPTICS] = Consistancy();
+
+ // Leave a certain amount of tics present in the net buffer as long as we've ran at least one tic this frame.
+ if (client && gamestate == GS_LEVEL && leveltime > 3 && neededtic <= gametic + cv_netticbuffer.value)
+ break;
}
}
else
diff --git a/src/d_clisrv.h b/src/d_clisrv.h
index a3fcfde0..39cb8c4d 100644
--- a/src/d_clisrv.h
+++ b/src/d_clisrv.h
@@ -1,7 +1,7 @@
// SONIC ROBO BLAST 2
//-----------------------------------------------------------------------------
// Copyright (C) 1998-2000 by DooM Legacy Team.
-// Copyright (C) 1999-2016 by Sonic Team Junior.
+// Copyright (C) 1999-2018 by Sonic Team Junior.
//
// This program is free software distributed under the
// terms of the GNU General Public License, version 2.
@@ -26,7 +26,11 @@
// SOME numpty changed all the gametype constants and it fell out of sync with vanilla and now we have to pretend to be vanilla when talking to the master server...
#define VANILLA_GT_RACE 2
+#if VERSION < 210
+#define VANILLA_GT_MATCH 1
+#else
#define VANILLA_GT_MATCH 3
+#endif
// Networking and tick handling related.
#define BACKUPTICS 32
@@ -251,7 +255,6 @@ typedef struct
INT16 starposty;
INT16 starpostz;
INT32 starpostnum;
- INT32 starpostcount;
tic_t starposttime;
angle_t starpostangle;
@@ -430,10 +433,10 @@ typedef struct
UINT8 reserved; // Padding
union
{
- clientcmd_pak clientpak; // 144 bytes
- client2cmd_pak client2pak; // 200 bytes
- client3cmd_pak client3pak; // 256 bytes(?)
- client4cmd_pak client4pak; // 312 bytes(?)
+ clientcmd_pak clientpak; // 145 bytes
+ client2cmd_pak client2pak; // 202 bytes
+ client3cmd_pak client3pak; // 258 bytes(?)
+ client4cmd_pak client4pak; // 316 bytes(?)
servertics_pak serverpak; // 132495 bytes (more around 360, no?)
serverconfig_pak servercfg; // 773 bytes
resynchend_pak resynchend; //
@@ -472,11 +475,12 @@ extern INT32 mapchangepending;
// Points inside doomcom
extern doomdata_t *netbuffer;
+extern consvar_t cv_showjoinaddress;
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
@@ -520,7 +524,7 @@ extern consvar_t
#ifdef VANILLAJOINNEXTROUND
cv_joinnextround,
#endif
- cv_allownewplayer, cv_maxplayers, cv_resynchattempts, cv_blamecfail, cv_maxsend, cv_noticedownload, cv_downloadspeed;
+ cv_netticbuffer, cv_allownewplayer, cv_maxplayers, cv_resynchattempts, cv_blamecfail, cv_maxsend, cv_noticedownload, cv_downloadspeed;
// Used in d_net, the only dependence
tic_t ExpandTics(INT32 low);
diff --git a/src/d_event.h b/src/d_event.h
index 09ff167b..8cbf8560 100644
--- a/src/d_event.h
+++ b/src/d_event.h
@@ -2,7 +2,7 @@
//-----------------------------------------------------------------------------
// Copyright (C) 1993-1996 by id Software, Inc.
// Copyright (C) 1998-2000 by DooM Legacy Team.
-// Copyright (C) 1999-2016 by Sonic Team Junior.
+// Copyright (C) 1999-2018 by Sonic Team Junior.
//
// This program is free software distributed under the
// terms of the GNU General Public License, version 2.
diff --git a/src/d_main.c b/src/d_main.c
index 01839014..29a91686 100644
--- a/src/d_main.c
+++ b/src/d_main.c
@@ -2,7 +2,7 @@
//-----------------------------------------------------------------------------
// Copyright (C) 1993-1996 by id Software, Inc.
// Copyright (C) 1998-2000 by DooM Legacy Team.
-// Copyright (C) 1999-2016 by Sonic Team Junior.
+// Copyright (C) 1999-2018 by Sonic Team Junior.
//
// This program is free software distributed under the
// terms of the GNU General Public License, version 2.
@@ -188,7 +188,7 @@ void D_PostEvent_end(void) {};
UINT8 shiftdown = 0; // 0x1 left, 0x2 right
UINT8 ctrldown = 0; // 0x1 left, 0x2 right
UINT8 altdown = 0; // 0x1 left, 0x2 right
-boolean capslock = 0; // jeez i wonder what this does.
+boolean capslock = 0; // gee i wonder what this does.
//
// D_ModifierKeyResponder
// Sets global shift/ctrl/alt variables, never actually eats events
@@ -321,7 +321,7 @@ static void D_Display(void)
F_RunWipe(wipedefs[wipedefindex], gamestate != GS_TIMEATTACK);
}
- if (wipegamestate == GS_LEVEL && rendermode != render_none)
+ if (gamestate != GS_LEVEL && rendermode != render_none)
{
V_SetPaletteLump("PLAYPAL"); // Reset the palette
R_ReInitColormaps(0, LUMPERROR);
@@ -338,8 +338,7 @@ static void D_Display(void)
if (!gametic)
break;
HU_Erase();
- if (automapactive)
- AM_Drawer();
+ AM_Drawer();
break;
case GS_INTERMISSION:
@@ -412,12 +411,10 @@ static void D_Display(void)
break;
}
- // clean up border stuff
- // see if the border needs to be initially drawn
if (gamestate == GS_LEVEL)
{
// draw the view directly
- if (!automapactive && !dedicated && cv_renderview.value)
+ if (cv_renderview.value && !automapactive)
{
if (players[displayplayer].mo || players[displayplayer].playerstate == PST_DEAD)
{
@@ -536,7 +533,6 @@ static void D_Display(void)
}
ST_Drawer();
-
HU_Drawer();
}
@@ -662,7 +658,6 @@ void D_SRB2Loop(void)
"===========================================================================\n"
" We hope you enjoy this game as\n"
" much as we did making it!\n"
- " ...wait. =P\n"
"===========================================================================\n");
// hack to start on a nice clear console screen.
@@ -917,7 +912,7 @@ static void IdentifyVersion(void)
else if (srb2wad1 != NULL && FIL_ReadFileOK(srb2wad1))
D_AddFile(srb2wad1);
else
- I_Error("SRB2.SRB/SRB2.WAD not found! Expected in %s, ss files: %s and %s\n", srb2waddir, srb2wad1, srb2wad2);
+ I_Error("SRB2.SRB/SRB2.WAD not found! Expected in %s, ss files: %s or %s\n", srb2waddir, srb2wad1, srb2wad2);
if (srb2wad1)
free(srb2wad1);
@@ -927,20 +922,20 @@ static void IdentifyVersion(void)
// if you change the ordering of this or add/remove a file, be sure to update the md5
// checking in D_SRB2Main
- // Add the maps
- //D_AddFile(va(pandf,srb2waddir,"zones.dta"));
-
- // 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"));
#endif
+ D_AddFile(va(pandf,srb2waddir,"gfx.kart"));
+ D_AddFile(va(pandf,srb2waddir,"textures.kart"));
+ D_AddFile(va(pandf,srb2waddir,"chars.kart"));
+ D_AddFile(va(pandf,srb2waddir,"maps.kart"));
+#ifdef USE_PATCH_KART
+ D_AddFile(va(pandf,srb2waddir,"patch.kart"));
+#endif
+
+#if !defined (HAVE_SDL) || defined (HAVE_MIXER)
#define MUSICTEST(str) \
{\
const char *musicpath = va(pandf,srb2waddir,str);\
@@ -950,21 +945,10 @@ static void IdentifyVersion(void)
else if (ms == 0) \
I_Error("File "str" has been modified with non-music/sound lumps"); \
}
-
- // SRB2kart - Add graphics (temp) // The command for md5 checks is "W_VerifyFileMD5" - looks for ASSET_HASH_SRB2_SRB in config.h.in
- D_AddFile(va(pandf,srb2waddir,"gfx.kart"));
- D_AddFile(va(pandf,srb2waddir,"textures.kart"));
- D_AddFile(va(pandf,srb2waddir,"chars.kart"));
- D_AddFile(va(pandf,srb2waddir,"maps.kart"));
- //D_AddFile(va(pandf,srb2waddir,"sounds.kart"));
MUSICTEST("sounds.kart")
-
-#ifdef USE_PATCH_KART
- D_AddFile(va(pandf,srb2waddir,"patch.kart"));
-#endif
-
- //MUSICTEST("music.dta")
MUSICTEST("music.kart")
+#undef MUSICTEST
+#endif
}
/* ======================================================================== */
@@ -1029,6 +1013,20 @@ void D_SRB2Main(void)
INT32 pstartmap = 1;
boolean autostart = false;
+ // Print GPL notice for our console users (Linux)
+ CONS_Printf(
+ "\n\nSonic Robo Blast 2 Kart\n"
+ "Copyright (C) 1998-2018 by Kart Krew & STJr\n\n"
+ "This program comes with ABSOLUTELY NO WARRANTY.\n\n"
+ "This is free software, and you are welcome to redistribute it\n"
+ "and/or modify it under the terms of the GNU General Public License\n"
+ "as published by the Free Software Foundation; either version 2 of\n"
+ "the License, or (at your option) any later version.\n"
+ "See the 'LICENSE.txt' file for details.\n\n"
+ "Sonic the Hedgehog and related characters are trademarks of SEGA.\n"
+ "We do not claim ownership of SEGA's intellectual property used\n"
+ "in this program.\n\n");
+
// keep error messages until the final flush(stderr)
#if !defined (PC_DOS) && !defined (_WIN32_WCE) && !defined(NOTERMIOS)
if (setvbuf(stderr, NULL, _IOFBF, 1000))
@@ -1226,25 +1224,20 @@ void D_SRB2Main(void)
mainwads = 0;
-#ifndef DEVELOP // md5s last updated 12/14/14
-
+#ifndef DEVELOP
// Check MD5s of autoloaded files
- W_VerifyFileMD5(mainwads, ASSET_HASH_SRB2_SRB); // srb2.srb/srb2.wad
+ // Note: Do not add any files that ignore MD5!
+ W_VerifyFileMD5(mainwads, ASSET_HASH_SRB2_SRB); // srb2.srb/srb2.wad
#ifdef USE_PATCH_DTA
- mainwads++; W_VerifyFileMD5(mainwads, ASSET_HASH_PATCH_DTA); // patch.dta
+ mainwads++; W_VerifyFileMD5(mainwads, ASSET_HASH_PATCH_DTA); // patch.dta
#endif
- mainwads++; W_VerifyFileMD5(mainwads, ASSET_HASH_GFX_KART); // gfx.kart
- mainwads++; W_VerifyFileMD5(mainwads, ASSET_HASH_TEXTURES_KART); // textures.kart
- mainwads++; W_VerifyFileMD5(mainwads, ASSET_HASH_CHARS_KART); // chars.kart
- mainwads++; W_VerifyFileMD5(mainwads, ASSET_HASH_MAPS_KART); // maps.kart
- mainwads++; //W_VerifyFileMD5(5, ASSET_HASH_SOUNDS_KART); -- sounds.kart - doesn't trigger modifiedgame, doesn't need an MD5...?
+ mainwads++; W_VerifyFileMD5(mainwads, ASSET_HASH_GFX_KART); // gfx.kart
+ mainwads++; W_VerifyFileMD5(mainwads, ASSET_HASH_TEXTURES_KART); // textures.kart
+ mainwads++; W_VerifyFileMD5(mainwads, ASSET_HASH_CHARS_KART); // chars.kart
+ mainwads++; W_VerifyFileMD5(mainwads, ASSET_HASH_MAPS_KART); // maps.kart
#ifdef USE_PATCH_KART
- mainwads++; W_VerifyFileMD5(mainwads, ASSET_HASH_PATCH_KART); // patch.kart
+ mainwads++; W_VerifyFileMD5(mainwads, ASSET_HASH_PATCH_KART); // patch.kart
#endif
- //mainwads++; // music.dta
- mainwads++; // music.kart
- // don't check music.dta or kart 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.
#else
#ifdef USE_PATCH_DTA
mainwads++; // patch.dta
@@ -1253,12 +1246,10 @@ void D_SRB2Main(void)
mainwads++; // textures.kart
mainwads++; // chars.kart
mainwads++; // maps.kart
- mainwads++; // sounds.kart
#ifdef USE_PATCH_KART
mainwads++; // patch.kart
#endif
- //mainwads++; // music.dta
- mainwads++; // music.kart
+
#endif //ifndef DEVELOP
mainwadstally = packetsizetally;
@@ -1359,6 +1350,7 @@ void D_SRB2Main(void)
I_StartupSound();
I_InitMusic();
S_InitSfxChannels(cv_soundvolume.value);
+ S_InitMusicDefs();
CONS_Printf("ST_Init(): Init status bar.\n");
ST_Init();
diff --git a/src/d_main.h b/src/d_main.h
index 4c9c99ea..d67a5bb4 100644
--- a/src/d_main.h
+++ b/src/d_main.h
@@ -2,7 +2,7 @@
//-----------------------------------------------------------------------------
// Copyright (C) 1993-1996 by id Software, Inc.
// Copyright (C) 1998-2000 by DooM Legacy Team.
-// Copyright (C) 1999-2016 by Sonic Team Junior.
+// Copyright (C) 1999-2018 by Sonic Team Junior.
//
// This program is free software distributed under the
// terms of the GNU General Public License, version 2.
diff --git a/src/d_net.c b/src/d_net.c
index eca301f0..62301dc1 100644
--- a/src/d_net.c
+++ b/src/d_net.c
@@ -2,7 +2,7 @@
//-----------------------------------------------------------------------------
// Copyright (C) 1993-1996 by id Software, Inc.
// Copyright (C) 1998-2000 by DooM Legacy Team.
-// Copyright (C) 1999-2016 by Sonic Team Junior.
+// Copyright (C) 1999-2018 by Sonic Team Junior.
//
// This program is free software distributed under the
// terms of the GNU General Public License, version 2.
@@ -27,6 +27,7 @@
#include "d_clisrv.h"
#include "z_zone.h"
#include "i_tcp.h"
+#include "d_main.h" // srb2home
//
// NETWORKING
@@ -1386,12 +1387,12 @@ 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
diff --git a/src/d_net.h b/src/d_net.h
index f6544ab2..9cc1bbd2 100644
--- a/src/d_net.h
+++ b/src/d_net.h
@@ -2,7 +2,7 @@
//-----------------------------------------------------------------------------
// Copyright (C) 1993-1996 by id Software, Inc.
// Copyright (C) 1998-2000 by DooM Legacy Team.
-// Copyright (C) 1999-2016 by Sonic Team Junior.
+// Copyright (C) 1999-2018 by Sonic Team Junior.
//
// This program is free software distributed under the
// terms of the GNU General Public License, version 2.
@@ -22,6 +22,7 @@
#define MAXNETNODES 16
#define BROADCASTADDR MAXNETNODES
#define MAXSPLITSCREENPLAYERS 4 // 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 2dc94a45..41f88ab9 100644
--- a/src/d_netcmd.c
+++ b/src/d_netcmd.c
@@ -1,7 +1,7 @@
// SONIC ROBO BLAST 2
//-----------------------------------------------------------------------------
// Copyright (C) 1998-2000 by DooM Legacy Team.
-// Copyright (C) 1999-2016 by Sonic Team Junior.
+// Copyright (C) 1999-2018 by Sonic Team Junior.
//
// This program is free software distributed under the
// terms of the GNU General Public License, version 2.
@@ -272,6 +272,7 @@ INT32 cv_debug;
consvar_t cv_usemouse = {"use_mouse", "Off", 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,
@@ -280,6 +281,7 @@ consvar_t cv_usejoystick3 = {"use_joystick3", "3", CV_SAVE|CV_CALL, usejoystick_
I_InitJoystick3, 0, NULL, NULL, 0, 0, NULL};
consvar_t cv_usejoystick4 = {"use_joystick4", "4", CV_SAVE|CV_CALL, usejoystick_cons_t,
I_InitJoystick4, 0, NULL, NULL, 0, 0, NULL};
+#endif
#if (defined (LJOYSTICK) || defined (HAVE_SDL))
#ifdef LJOYSTICK
@@ -355,7 +357,7 @@ consvar_t cv_kartfrantic = {"kartfrantic", "Off", CV_NETVAR|CV_CHEAT|CV_CALL|CV_
consvar_t cv_kartcomeback = {"kartcomeback", "On", CV_NETVAR|CV_CHEAT|CV_CALL|CV_NOINIT, CV_OnOff, KartComeback_OnChange, 0, NULL, NULL, 0, 0, NULL};
consvar_t cv_kartencore = {"kartencore", "Off", CV_NETVAR|CV_CALL|CV_NOINIT, CV_OnOff, KartEncore_OnChange, 0, NULL, NULL, 0, 0, NULL};
static CV_PossibleValue_t kartvoterulechanges_cons_t[] = {{0, "Never"}, {1, "Sometimes"}, {2, "Frequent"}, {3, "Always"}, {0, NULL}};
-consvar_t cv_kartvoterulechanges = {"kartvoterulechanges", "Sometimes", CV_NETVAR, kartvoterulechanges_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
+consvar_t cv_kartvoterulechanges = {"kartvoterulechanges", "Frequent", CV_NETVAR, kartvoterulechanges_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
static CV_PossibleValue_t kartspeedometer_cons_t[] = {{0, "Off"}, {1, "Kilometers"}, {2, "Miles"}, {3, "Fracunits"}, {0, NULL}};
consvar_t cv_kartspeedometer = {"kartdisplayspeed", "Off", CV_SAVE, kartspeedometer_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL}; // use tics in display
static CV_PossibleValue_t kartvoices_cons_t[] = {{0, "Never"}, {1, "Tasteful"}, {2, "Meme"}, {0, NULL}};
@@ -424,11 +426,12 @@ consvar_t cv_killingdead = {"killingdead", "Off", CV_NETVAR|CV_NOSHOWHELP, CV_On
consvar_t cv_netstat = {"netstat", "Off", 0, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL}; // show bandwidth statistics
static CV_PossibleValue_t nettimeout_cons_t[] = {{TICRATE/7, "MIN"}, {60*TICRATE, "MAX"}, {0, NULL}};
-consvar_t cv_nettimeout = {"nettimeout", "350", CV_CALL|CV_SAVE, nettimeout_cons_t, NetTimeout_OnChange, 0, NULL, NULL, 0, 0, NULL};
-static CV_PossibleValue_t jointimeout_cons_t[] = {{5*TICRATE, "MIN"}, {60*TICRATE, "MAX"}, {0, NULL}};
-consvar_t cv_jointimeout = {"jointimeout", "350", CV_CALL|CV_SAVE, jointimeout_cons_t, JoinTimeout_OnChange, 0, NULL, NULL, 0, 0, NULL};
+consvar_t cv_nettimeout = {"nettimeout", "105", CV_CALL|CV_SAVE, nettimeout_cons_t, NetTimeout_OnChange, 0, NULL, NULL, 0, 0, NULL};
+//static CV_PossibleValue_t jointimeout_cons_t[] = {{5*TICRATE, "MIN"}, {60*TICRATE, "MAX"}, {0, NULL}};
+consvar_t cv_jointimeout = {"jointimeout", "105", CV_CALL|CV_SAVE, nettimeout_cons_t, JoinTimeout_OnChange, 0, NULL, NULL, 0, 0, NULL};
#ifdef NEWPING
-consvar_t cv_maxping = {"maxping", "0", CV_SAVE, CV_Unsigned, NULL, 0, NULL, NULL, 0, 0, NULL};
+static CV_PossibleValue_t maxping_cons_t[] = {{0, "MIN"}, {1000, "MAX"}, {0, NULL}};
+consvar_t cv_maxping = {"maxping", "800", CV_SAVE, maxping_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
#endif
// Intermission time Tails 04-19-2002
static CV_PossibleValue_t inttime_cons_t[] = {{0, "MIN"}, {3600, "MAX"}, {0, NULL}};
@@ -480,6 +483,7 @@ const char *netxcmdnames[MAXNETXCMD - 1] =
"SETUPVOTE",
"MODIFYVOTE",
"PICKVOTE",
+ "REMOVEPLAYER",
#ifdef HAVE_BLUA
"LUACMD",
"LUAVAR"
@@ -521,9 +525,9 @@ void D_RegisterServerCommands(void)
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("giveadmin", Command_Verify_f);
+ COM_AddCommand("promote", Command_Verify_f);
RegisterNetXCmd(XD_VERIFIED, Got_Verification);
- COM_AddCommand("removeadmin", Command_RemoveAdmin_f);
+ COM_AddCommand("demote", Command_RemoveAdmin_f);
RegisterNetXCmd(XD_DEMOTED, Got_Removal);
COM_AddCommand("motd", Command_MotD_f);
@@ -643,6 +647,7 @@ void D_RegisterServerCommands(void)
// d_clisrv
CV_RegisterVar(&cv_maxplayers);
+ CV_RegisterVar(&cv_resynchattempts);
CV_RegisterVar(&cv_maxsend);
CV_RegisterVar(&cv_noticedownload);
CV_RegisterVar(&cv_downloadspeed);
@@ -758,6 +763,7 @@ void D_RegisterClientCommands(void)
#endif
CV_RegisterVar(&cv_rollingdemos);
CV_RegisterVar(&cv_netstat);
+ CV_RegisterVar(&cv_netticbuffer);
#ifdef NETGAME_DEVMODE
CV_RegisterVar(&cv_fishcake);
@@ -780,6 +786,7 @@ void D_RegisterClientCommands(void)
CV_RegisterVar(&cv_usegamma);
// m_menu.c
+ //CV_RegisterVar(&cv_compactscoreboard);
CV_RegisterVar(&cv_chatheight);
CV_RegisterVar(&cv_chatwidth);
CV_RegisterVar(&cv_chattime);
@@ -787,12 +794,15 @@ void D_RegisterClientCommands(void)
CV_RegisterVar(&cv_consolechat);
CV_RegisterVar(&cv_chatnotifications);
CV_RegisterVar(&cv_chatbacktint);
+ CV_RegisterVar(&cv_songcredits);
//CV_RegisterVar(&cv_crosshair);
//CV_RegisterVar(&cv_crosshair2);
//CV_RegisterVar(&cv_crosshair3);
//CV_RegisterVar(&cv_crosshair4);
//CV_RegisterVar(&cv_alwaysfreelook);
//CV_RegisterVar(&cv_alwaysfreelook2);
+ //CV_RegisterVar(&cv_chasefreelook);
+ //CV_RegisterVar(&cv_chasefreelook2);
// g_input.c
CV_RegisterVar(&cv_turnaxis);
@@ -1206,7 +1216,7 @@ static void ForceAllSkins(INT32 forcedskin)
SetPlayerSkinByNum(i, forcedskin);
- // If it's me (or my brother), set appropriate skin value in cv_skin/cv_skin2
+ // If it's me (or my brother (or my sister (or my trusty pet dog))), set appropriate skin value in cv_skin
if (!dedicated) // But don't do this for dedicated servers, of course.
{
if (i == consoleplayer)
@@ -2076,6 +2086,7 @@ void D_SetupVote(void)
UINT8 *p = buf;
INT32 i;
UINT8 secondgt = G_SometimesGetDifferentGametype();
+ INT16 votebuffer[3] = {-1,-1,-1};
if (cv_kartencore.value && G_RaceGametype())
WRITEUINT8(p, (gametype|0x80));
@@ -2086,12 +2097,16 @@ void D_SetupVote(void)
for (i = 0; i < 5; i++)
{
+ UINT16 m;
if (i == 2) // sometimes a different gametype
- WRITEUINT16(p, G_RandMap(G_TOLFlag(secondgt), prevmap, false, false, 0, true));
+ m = G_RandMap(G_TOLFlag(secondgt), prevmap, false, 0, true, votebuffer);
else if (i >= 3) // unknown-random and force-unknown MAP HELL
- WRITEUINT16(p, G_RandMap(G_TOLFlag(gametype), prevmap, true, false, (i-2), (i < 4)));
+ m = G_RandMap(G_TOLFlag(gametype), prevmap, false, (i-2), (i < 4), votebuffer);
else
- WRITEUINT16(p, G_RandMap(G_TOLFlag(gametype), prevmap, false, false, 0, true));
+ m = G_RandMap(G_TOLFlag(gametype), prevmap, false, 0, true, votebuffer);
+ if (i < 3)
+ votebuffer[min(i, 2)] = m; // min() is a dumb workaround for gcc 4.4 array-bounds error
+ WRITEUINT16(p, m);
}
SendNetXCmd(XD_SETUPVOTE, buf, p - buf);
@@ -2302,6 +2317,9 @@ static void Got_Mapcmd(UINT8 **cp, INT32 playernum)
INT32 resetplayer = 1, lastgametype;
UINT8 skipprecutscene, FLS;
boolean pencoremode;
+/*#ifdef HAVE_BLUA
+ INT16 mapnumber;
+#endif*/
forceresetplayers = deferencoremode = false;
@@ -2352,6 +2370,10 @@ static void Got_Mapcmd(UINT8 **cp, INT32 playernum)
mapname, resetplayer, lastgametype, gametype, chmappending));
CON_LogMessage(M_GetText("Speeding off to level...\n"));
}
+
+ CON_ToggleOff();
+ CON_ClearHUD();
+
if (demoplayback && !timingdemo)
precache = false;
@@ -2364,14 +2386,14 @@ static void Got_Mapcmd(UINT8 **cp, INT32 playernum)
if (modeattacking) // i remember moving this here in internal fixed a heisenbug so
SetPlayerSkinByNum(0, cv_chooseskin.value-1);
-#ifdef HAVE_BLUA
- LUAh_MapChange();
-#endif
+/*#ifdef HAVE_BLUA
+ mapnumber = M_MapNumber(mapname[3], mapname[4]);
+ LUAh_MapChange(mapnumber);
+#endif*/
G_InitNew(pencoremode, mapname, resetplayer, skipprecutscene);
if (demoplayback && !timingdemo)
precache = true;
- CON_ToggleOff();
if (timingdemo)
G_DoneLevelLoad();
@@ -3487,7 +3509,7 @@ static void Got_Login(UINT8 **cp, INT32 playernum)
if (!memcmp(sentmd5, finalmd5, 16))
{
CONS_Printf(M_GetText("%s passed authentication.\n"), player_names[playernum]);
- COM_BufInsertText(va("giveadmin %d\n", playernum)); // do this immediately
+ COM_BufInsertText(va("promote %d\n", playernum)); // do this immediately
}
else
CONS_Printf(M_GetText("Password from %s failed.\n"), player_names[playernum]);
@@ -3517,12 +3539,6 @@ void SetAdminPlayer(INT32 playernum)
adminplayers[i] = playernum; // Set the player to a free spot
break; // End the loop now. If it keeps going, the same player might get assigned to two slots.
}
-
- /*if (i == 3 && adminplayers[i] != -1) // End of the loop and all slots are full
- {
- adminplayers[0] = playernum; // Overwrite the first slot
- break;
- }*/
}
}
@@ -3561,7 +3577,7 @@ static void Command_Verify_f(void)
if (COM_Argc() != 2)
{
- CONS_Printf(M_GetText("giveadmin : give admin privileges to a node\n"));
+ CONS_Printf(M_GetText("promote : give admin privileges to a node\n"));
return;
}
@@ -3617,7 +3633,7 @@ static void Command_RemoveAdmin_f(void)
if (COM_Argc() != 2)
{
- CONS_Printf(M_GetText("removeadmin : remove admin privileges from a node\n"));
+ CONS_Printf(M_GetText("demote : remove admin privileges from a node\n"));
return;
}
@@ -3694,7 +3710,7 @@ static void Command_MotD_f(void)
}
if ((netgame || multiplayer) && client)
- SendNetXCmd(XD_SETMOTD, mymotd, sizeof(motd));
+ SendNetXCmd(XD_SETMOTD, mymotd, i); // send the actual size of the motd string, not the full buffer's size
else
{
strcpy(motd, mymotd);
@@ -3862,7 +3878,7 @@ static void Command_Addfile(void)
// Add file on your client directly if it is trivial, or you aren't in a netgame.
if (!(netgame || multiplayer) || musiconly)
{
- P_AddWadFile(fn, NULL);
+ P_AddWadFile(fn);
return;
}
@@ -3963,6 +3979,10 @@ static void Got_RequestAddfilecmd(UINT8 **cp, INT32 playernum)
boolean kick = false;
boolean toomany = false;
INT32 i,j;
+ serverinfo_pak *dummycheck = NULL;
+
+ // Shut the compiler up.
+ (void)dummycheck;
READSTRINGN(*cp, filename, 240);
READMEM(*cp, md5sum, 16);
@@ -4072,7 +4092,7 @@ static void Got_Addfilecmd(UINT8 **cp, INT32 playernum)
ncs = findfile(filename,md5sum,true);
- if (ncs != FS_FOUND || !P_AddWadFile(filename, NULL))
+ if (ncs != FS_FOUND || !P_AddWadFile(filename))
{
Command_ExitGame_f();
if (ncs == FS_FOUND)
@@ -4131,6 +4151,52 @@ static void Command_Version_f(void)
#else
CONS_Printf("SRB2Kart %s (%s %s %s)\n", VERSIONSTRING, compdate, comptime, comprevision);
#endif
+
+ // Base library
+#if defined( HAVE_SDL)
+ CONS_Printf("SDL ");
+#elif defined(_WINDOWS)
+ CONS_Printf("DD ");
+#endif
+
+ // OS
+ // Would be nice to use SDL_GetPlatform for this
+#if defined (_WIN32) || defined (_WIN64)
+ CONS_Printf("Windows ");
+#elif defined(__linux__)
+ CONS_Printf("Linux ");
+#elif defined(MACOSX)
+ CONS_Printf("macOS ");
+#elif defined(UNIXCOMMON)
+ CONS_Printf("Unix (Common) ");
+#else
+ CONS_Printf("Other OS ");
+#endif
+
+ // Bitness
+ if (sizeof(void*) == 4)
+ CONS_Printf("32-bit ");
+ else if (sizeof(void*) == 8)
+ CONS_Printf("64-bit ");
+ else // 16-bit? 128-bit?
+ CONS_Printf("Bits Unknown ");
+
+ // No ASM?
+#ifdef NOASM
+ CONS_Printf("\x85" "NOASM " "\x80");
+#endif
+
+ // Debug build
+#ifdef _DEBUG
+ CONS_Printf("\x85" "DEBUG " "\x80");
+#endif
+
+ // DEVELOP build
+#ifdef DEVELOP
+ CONS_Printf("\x87" "DEVELOP " "\x80");
+#endif
+
+ CONS_Printf("\n");
}
#ifdef UPDATE_ALERT
@@ -4225,9 +4291,17 @@ static void PointLimit_OnChange(void)
static void NumLaps_OnChange(void)
{
+ if (!G_RaceGametype() || (modeattacking || demoplayback))
+ return;
+
+ if (server && Playing()
+ && (netgame || multiplayer)
+ && (mapheaderinfo[gamemap - 1]->levelflags & LF_SECTIONRACE)
+ && (cv_numlaps.value > mapheaderinfo[gamemap - 1]->numlaps))
+ CV_StealthSetValue(&cv_numlaps, mapheaderinfo[gamemap - 1]->numlaps);
+
// Just don't be verbose
- if (G_RaceGametype() && !(modeattacking || demoplayback))
- CONS_Printf(M_GetText("Number of laps set to %d\n"), cv_numlaps.value);
+ CONS_Printf(M_GetText("Number of laps set to %d\n"), cv_numlaps.value);
}
static void NetTimeout_OnChange(void)
diff --git a/src/d_netcmd.h b/src/d_netcmd.h
index 67793f0f..2269996f 100644
--- a/src/d_netcmd.h
+++ b/src/d_netcmd.h
@@ -1,7 +1,7 @@
// SONIC ROBO BLAST 2
//-----------------------------------------------------------------------------
// Copyright (C) 1998-2000 by DooM Legacy Team.
-// Copyright (C) 1999-2016 by Sonic Team Junior.
+// Copyright (C) 1999-2018 by Sonic Team Junior.
//
// This program is free software distributed under the
// terms of the GNU General Public License, version 2.
@@ -33,6 +33,8 @@ extern consvar_t cv_skin3;
extern consvar_t cv_playername4;
extern consvar_t cv_playercolor4;
extern consvar_t cv_skin4;
+// preferred number of players
+extern consvar_t cv_splitplayers;
#ifdef SEENAMES
extern consvar_t cv_seenames, cv_allowseenames;
diff --git a/src/d_netfil.c b/src/d_netfil.c
index 9889ad12..c7cfdbc1 100644
--- a/src/d_netfil.c
+++ b/src/d_netfil.c
@@ -1,7 +1,7 @@
// SONIC ROBO BLAST 2
//-----------------------------------------------------------------------------
// Copyright (C) 1998-2000 by DooM Legacy Team.
-// Copyright (C) 1999-2016 by Sonic Team Junior.
+// Copyright (C) 1999-2018 by Sonic Team Junior.
//
// This program is free software distributed under the
// terms of the GNU General Public License, version 2.
@@ -94,7 +94,7 @@ static filetran_t transfer[MAXNETNODES];
// Receiver structure
INT32 fileneedednum; // Number of files needed to join the server
fileneeded_t fileneeded[MAX_WADFILES]; // List of needed files
-char downloaddir[256] = "DOWNLOAD";
+char downloaddir[512] = "DOWNLOAD";
#ifdef CLIENT_LOADINGSCREEN
// for cl loading screen
@@ -425,7 +425,7 @@ void CL_LoadServerFiles(void)
continue; // Already loaded
else if (fileneeded[i].status == FS_FOUND)
{
- P_AddWadFile(fileneeded[i].filename, NULL);
+ P_AddWadFile(fileneeded[i].filename);
G_SetGameModified(true);
fileneeded[i].status = FS_OPEN;
}
diff --git a/src/d_netfil.h b/src/d_netfil.h
index 6fdd0a8a..3d7c2ed5 100644
--- a/src/d_netfil.h
+++ b/src/d_netfil.h
@@ -1,7 +1,7 @@
// SONIC ROBO BLAST 2
//-----------------------------------------------------------------------------
// Copyright (C) 1998-2000 by DooM Legacy Team.
-// Copyright (C) 1999-2016 by Sonic Team Junior.
+// Copyright (C) 1999-2018 by Sonic Team Junior.
//
// This program is free software distributed under the
// terms of the GNU General Public License, version 2.
@@ -47,7 +47,7 @@ typedef struct
extern INT32 fileneedednum;
extern fileneeded_t fileneeded[MAX_WADFILES];
-extern char downloaddir[256];
+extern char downloaddir[512];
#ifdef CLIENT_LOADINGSCREEN
extern INT32 lastfilenum;
diff --git a/src/d_player.h b/src/d_player.h
index a5907646..27fdef8d 100644
--- a/src/d_player.h
+++ b/src/d_player.h
@@ -2,7 +2,7 @@
//-----------------------------------------------------------------------------
// Copyright (C) 1993-1996 by id Software, Inc.
// Copyright (C) 1998-2000 by DooM Legacy Team.
-// Copyright (C) 1999-2016 by Sonic Team Junior.
+// Copyright (C) 1999-2018 by Sonic Team Junior.
//
// This program is free software distributed under the
// terms of the GNU General Public License, version 2.
@@ -348,6 +348,11 @@ typedef enum
k_wanted, // Timer for determining WANTED status, lowers when hitting people, prevents the game turning into Camp Lazlo
k_yougotem, // "You Got Em" gfx when hitting someone as a karma player via a method that gets you back in the game instantly
+ // v1.0.2 vars
+ k_itemblink, // Item flashing after roulette, prevents Hyudoro stealing AND serves as a mashing indicator
+ k_itemblinkmode, // Type of flashing: 0 = white (normal), 1 = red (mashing), 2 = rainbow (enhanced items)
+ k_getsparks, // Disable drift sparks at low speed, JUST enough to give acceleration the actual headstart above speed
+
NUMKARTSTUFF
} kartstufftype_t;
//}
@@ -411,6 +416,8 @@ typedef struct player_s
// SRB2kart stuff
INT32 kartstuff[NUMKARTSTUFF];
angle_t frameangle; // for the player add the ability to have the sprite only face other angles
+ INT16 lturn_max[MAXPREDICTTICS]; // What's the expected turn value for full-left for a number of frames back (to account for netgame latency)?
+ INT16 rturn_max[MAXPREDICTTICS]; // Ditto but for full-right
// Bit flags.
// See pflags_t, above.
@@ -511,7 +518,6 @@ typedef struct player_s
INT16 starposty;
INT16 starpostz;
INT32 starpostnum; // The number of the last starpost you hit
- INT32 starpostcount; // SRB2kart: how many did you hit?
tic_t starposttime; // Your time when you hit the starpost
angle_t starpostangle; // Angle that the starpost is facing - you respawn facing this way
diff --git a/src/d_think.h b/src/d_think.h
index 2831b9f2..b907c17f 100644
--- a/src/d_think.h
+++ b/src/d_think.h
@@ -2,7 +2,7 @@
//-----------------------------------------------------------------------------
// Copyright (C) 1993-1996 by id Software, Inc.
// Copyright (C) 1998-2000 by DooM Legacy Team.
-// Copyright (C) 1999-2016 by Sonic Team Junior.
+// Copyright (C) 1999-2018 by Sonic Team Junior.
//
// This program is free software distributed under the
// terms of the GNU General Public License, version 2.
diff --git a/src/d_ticcmd.h b/src/d_ticcmd.h
index afb052ce..dab758f8 100644
--- a/src/d_ticcmd.h
+++ b/src/d_ticcmd.h
@@ -2,7 +2,7 @@
//-----------------------------------------------------------------------------
// Copyright (C) 1993-1996 by id Software, Inc.
// Copyright (C) 1998-2000 by DooM Legacy Team.
-// Copyright (C) 1999-2016 by Sonic Team Junior.
+// Copyright (C) 1999-2018 by Sonic Team Junior.
//
// This program is free software distributed under the
// terms of the GNU General Public License, version 2.
@@ -21,6 +21,8 @@
#pragma interface
#endif
+#define MAXPREDICTTICS 12
+
// Button/action code definitions.
typedef enum
{
@@ -60,6 +62,7 @@ typedef struct
INT16 aiming; // vertical aiming, see G_BuildTicCmd
UINT16 buttons;
INT16 driftturn; // SRB2Kart: Used for getting drift turn speed
+ UINT8 latency; // Netgames: how many tics ago was this ticcmd generated from this player's end?
} ATTRPACK ticcmd_t;
#if defined(_MSC_VER)
diff --git a/src/dehacked.c b/src/dehacked.c
index c943dbfe..b9e29bc4 100644
--- a/src/dehacked.c
+++ b/src/dehacked.c
@@ -1,7 +1,7 @@
// SONIC ROBO BLAST 2
//-----------------------------------------------------------------------------
// Copyright (C) 1998-2000 by DooM Legacy Team.
-// Copyright (C) 1999-2016 by Sonic Team Junior.
+// Copyright (C) 1999-2018 by Sonic Team Junior.
//
// This program is free software distributed under the
// terms of the GNU General Public License, version 2.
@@ -38,6 +38,7 @@
#ifdef HAVE_BLUA
#include "v_video.h" // video flags (for lua)
+#include "r_draw.h" // translation colormap consts (for lua)
#endif
#ifdef HWRENDER
@@ -435,11 +436,11 @@ static void readAnimTex(MYFILE *f, INT32 num)
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 && PlayerMenu[*num].status != IT_DISABLED)
*num = *num+1;
// No more free slots. :(
- if (*num >= 32)
+ if (*num >= MAXSKINS)
return false;
// Found one! ^_^
@@ -1260,6 +1261,18 @@ static void readlevelheader(MYFILE *f, INT32 num)
deh_warning("Level header %d: invalid bonus type number %d", num, i);
}
+ else if (fastcmp(word, "SAVEOVERRIDE"))
+ {
+ if (fastcmp(word2, "DEFAULT")) i = SAVE_DEFAULT;
+ else if (fastcmp(word2, "ALWAYS")) i = SAVE_ALWAYS;
+ else if (fastcmp(word2, "NEVER")) i = SAVE_NEVER;
+
+ if (i >= SAVE_NEVER && i <= SAVE_ALWAYS)
+ mapheaderinfo[num-1]->saveoverride = (SINT8)i;
+ else
+ deh_warning("Level header %d: invalid save override number %d", num, i);
+ }
+
else if (fastcmp(word, "LEVELFLAGS"))
mapheaderinfo[num-1]->levelflags = get_number(word2);
else if (fastcmp(word, "MENUFLAGS"))
@@ -2992,7 +3005,7 @@ static void readmaincfg(MYFILE *f)
else if (fastcmp(word, "USENIGHTSSS"))
{
DEH_WriteUndoline(word, va("%d", useNightsSS), UNDO_NONE);
- useNightsSS = (UINT8)(value || word2[0] == 'T' || word2[0] == 'Y');
+ useNightsSS = (value || word2[0] == 'T' || word2[0] == 'Y');
}
else if (fastcmp(word, "REDTEAM"))
{
@@ -3066,7 +3079,7 @@ static void readmaincfg(MYFILE *f)
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');
}
else if (fastcmp(word, "TITLESCROLLSPEED"))
{
@@ -3084,7 +3097,7 @@ 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"))
{
@@ -3133,7 +3146,7 @@ static void readmaincfg(MYFILE *f)
strncpy(timeattackfolder, gamedatafilename, filenamelen);
timeattackfolder[min(filenamelen, sizeof (timeattackfolder) - 1)] = '\0';
- strncpy(savegamename, timeattackfolder, filenamelen);
+ strcpy(savegamename, timeattackfolder);
strlcat(savegamename, "%u.ssg", sizeof(savegamename));
// can't use sprintf since there is %u in savegamename
strcatbf(savegamename, srb2home, PATHSEP);
@@ -3233,9 +3246,9 @@ static void readwipes(MYFILE *f)
else if (fastcmp(pword, "FINAL"))
wipeoffset = wipe_specinter_final;
}
- else if (fastncmp(word, "VOTING_", 10))
+ else if (fastncmp(word, "VOTING_", 7))
{
- pword = word + 10;
+ pword = word + 7;
if (fastcmp(pword, "TOBLACK"))
wipeoffset = wipe_specinter_toblack;
else if (fastcmp(pword, "FINAL"))
@@ -3685,13 +3698,18 @@ static void DEH_LoadDehackedFile(MYFILE *f, UINT16 wad)
// no undo support for this insanity yet
//DEH_WriteUndoline(word, word2, UNDO_HEADER);
}
- else if (fastcmp(word, "SRB2"))
+ else if (fastcmp(word, "SRB2KART"))
{
INT32 ver = searchvalue(strtok(NULL, "\n"));
if (ver != PATCHVERSION)
deh_warning("Patch is for SRB2Kart version %d,\nonly version %d is supported", ver, PATCHVERSION);
//DEH_WriteUndoline(word, va("%d", ver), UNDO_NONE);
}
+ else if (fastcmp(word, "SRB2"))
+ {
+ if (mainwads) // srb2.srb triggers this warning otherwise
+ deh_warning("Patch is only compatible with base SRB2.");
+ }
// Clear all data in certain locations (mostly for unlocks)
// Unless you REALLY want to piss people off,
// define a custom gamedata /before/ doing this!!
@@ -6933,7 +6951,7 @@ static const char *const STATE_LIST[] = { // array length left dynamic for sanit
"S_GARU1",
"S_GARU2",
"S_GARU3",
- "S_TGARU",
+ "S_TGARU",
"S_TGARU1",
"S_TGARU2",
"S_TGARU3", // Wind attack used by Roaming Shadows on Players.
@@ -7092,6 +7110,12 @@ static const char *const STATE_LIST[] = { // array length left dynamic for sanit
"S_LIZARDMAN",
"S_LIONMAN",
+ "S_KARMAFIREWORK1",
+ "S_KARMAFIREWORK2",
+ "S_KARMAFIREWORK3",
+ "S_KARMAFIREWORK4",
+ "S_KARMAFIREWORKTRAIL",
+
#ifdef SEENAMES
"S_NAMECHECK",
#endif
@@ -7877,6 +7901,8 @@ static const char *const MOBJTYPE_LIST[] = { // array length left dynamic for s
"MT_LIZARDMAN",
"MT_LIONMAN",
+ "MT_KARMAFIREWORK",
+
#ifdef SEENAMES
"MT_NAMECHECK",
#endif
@@ -8270,6 +8296,10 @@ static const char *const KARTSTUFF_LIST[] = {
"COMEBACKMODE",
"WANTED",
"YOUGOTEM",
+
+ "ITEMBLINK",
+ "ITEMBLINKMODE",
+ "GETSPARKS"
};
static const char *const HUDITEMS_LIST[] = {
@@ -8429,6 +8459,11 @@ struct {
{"LF2_NIGHTSATTACK",LF2_NIGHTSATTACK},
{"LF2_NOVISITNEEDED",LF2_NOVISITNEEDED},
+ // Save override
+ {"SAVE_NEVER",SAVE_NEVER},
+ {"SAVE_DEFAULT",SAVE_DEFAULT},
+ {"SAVE_ALWAYS",SAVE_ALWAYS},
+
// NiGHTS grades
{"GRADE_F",GRADE_F},
{"GRADE_E",GRADE_E},
@@ -8819,6 +8854,14 @@ struct {
{"KRITEM_QUADORBINAUT",KRITEM_QUADORBINAUT},
{"KRITEM_DUALJAWZ",KRITEM_DUALJAWZ},
{"NUMKARTRESULTS",NUMKARTRESULTS},
+
+ // 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}
@@ -9163,7 +9206,7 @@ static fixed_t find_const(const char **rword)
free(word);
return r;
}
- else if (fastncmp("SKINCOLOR_",word,20)) {
+ else if (fastncmp("SKINCOLOR_",word,10)) {
char *p = word+10;
for (i = 0; i < MAXTRANSLATIONS; i++)
if (fastcmp(p, COLOR_ENUMS[i])) {
@@ -9595,7 +9638,7 @@ static inline int lib_getenum(lua_State *L)
if (mathlib) return luaL_error(L, "huditem '%s' could not be found.\n", word);
return 0;
}
- else if (fastncmp("SKINCOLOR_",word,20)) {
+ else if (fastncmp("SKINCOLOR_",word,10)) {
p = word+10;
for (i = 0; i < MAXTRANSLATIONS; i++)
if (fastcmp(p, COLOR_ENUMS[i])) {
@@ -9732,10 +9775,11 @@ static inline int lib_getenum(lua_State *L)
return 0;
LUA_PushUserdata(L, &players[serverplayer], META_PLAYER);
return 1;
- /*} else if (fastcmp(word,"admin")) { // Replaced with IsPlayerAdmin
- if (!playeringame[adminplayer] || IsPlayerAdmin(serverplayer))
+ /*} else if (fastcmp(word,"admin")) {
+ LUA_Deprecated(L, "admin", "IsPlayerAdmin(player)");
+ if (!playeringame[adminplayers[0]] || IsPlayerAdmin(serverplayer))
return 0;
- LUA_PushUserdata(L, &players[adminplayer], META_PLAYER);
+ LUA_PushUserdata(L, &players[adminplayers[0]], META_PLAYER);
return 1;*/
} else if (fastcmp(word,"emeralds")) {
lua_pushinteger(L, emeralds);
@@ -9770,8 +9814,13 @@ static inline int lib_getenum(lua_State *L)
} else if (fastcmp(word,"thwompsactive")) {
lua_pushboolean(L, thwompsactive);
return 1;
+ } else if (fastcmp(word,"spbplace")) {
+ lua_pushinteger(L, spbplace);
+ return 1;
+ } else if (fastcmp(word,"mapobjectscale")) {
+ lua_pushinteger(L, mapobjectscale);
+ return 1;
}
-
return 0;
}
diff --git a/src/dehacked.h b/src/dehacked.h
index 8832216b..683fe7d9 100644
--- a/src/dehacked.h
+++ b/src/dehacked.h
@@ -1,7 +1,7 @@
// SONIC ROBO BLAST 2
//-----------------------------------------------------------------------------
// Copyright (C) 1998-2000 by DooM Legacy Team.
-// Copyright (C) 1999-2016 by Sonic Team Junior.
+// Copyright (C) 1999-2018 by Sonic Team Junior.
//
// This program is free software distributed under the
// terms of the GNU General Public License, version 2.
@@ -54,7 +54,7 @@ extern const char *superactions[MAXRECURSION];
extern UINT8 superstack;
// If the dehacked patch does not match this version, we throw a warning
-#define PATCHVERSION 210
+#define PATCHVERSION 1
#define MAXLINELEN 1024
diff --git a/src/djgppdos/rdb-s.h b/src/djgppdos/rdb-s.h
index 6202dacf..7a6d8be3 100644
--- a/src/djgppdos/rdb-s.h
+++ b/src/djgppdos/rdb-s.h
@@ -1,7 +1,7 @@
// Emacs style mode select -*- C++ -*-
//-----------------------------------------------------------------------------
//
-// Copyright (C) 2005 by Sonic Team Jr.
+// Copyright (C) 2005-2018 by Sonic Team Jr.
//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
diff --git a/src/doomdata.h b/src/doomdata.h
index 1b91c94d..6319238b 100644
--- a/src/doomdata.h
+++ b/src/doomdata.h
@@ -2,7 +2,7 @@
//-----------------------------------------------------------------------------
// Copyright (C) 1993-1996 by id Software, Inc.
// Copyright (C) 1998-2000 by DooM Legacy Team.
-// Copyright (C) 1999-2016 by Sonic Team Junior.
+// Copyright (C) 1999-2018 by Sonic Team Junior.
//
// This program is free software distributed under the
// terms of the GNU General Public License, version 2.
diff --git a/src/doomdef.h b/src/doomdef.h
index af56c22e..70e521b1 100644
--- a/src/doomdef.h
+++ b/src/doomdef.h
@@ -2,7 +2,7 @@
//-----------------------------------------------------------------------------
// Copyright (C) 1993-1996 by id Software, Inc.
// Copyright (C) 1998-2000 by DooM Legacy Team.
-// Copyright (C) 1999-2016 by Sonic Team Junior.
+// Copyright (C) 1999-2018 by Sonic Team Junior.
//
// This program is free software distributed under the
// terms of the GNU General Public License, version 2.
@@ -150,9 +150,9 @@ extern FILE *logstream;
// we use comprevision and compbranch instead.
#else
#define VERSION 100 // Game version
-#define SUBVERSION 1 // more precise version number
-#define VERSIONSTRING "v1.0.1"
-#define VERSIONSTRINGW L"v1.0.1"
+#define SUBVERSION 2 // more precise version number
+#define VERSIONSTRING "v1.0.2"
+#define VERSIONSTRINGW L"v1.0.2"
// Hey! If you change this, add 1 to the MODVERSION below!
// Otherwise we can't force updates!
#endif
@@ -164,6 +164,9 @@ extern FILE *logstream;
// Kart has it's own, as well.
#define USE_PATCH_KART
+// 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
// to the latest version, fill these out. Otherwise, just comment out UPDATE_ALERT and leave
@@ -218,7 +221,22 @@ 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 1
+#define MODVERSION 2
+
+// Filter consvars by version
+// 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)
// =========================================================================
@@ -226,7 +244,7 @@ extern FILE *logstream;
// NOTE: it needs more than this to increase the number of players...
#define MAXPLAYERS 16
-#define MAXSKINS 32
+#define MAXSKINS 64
#define PLAYERSMASK (MAXPLAYERS-1)
#define MAXPLAYERNAME 21
@@ -286,7 +304,7 @@ typedef enum
SKINCOLOR_SLATE,
SKINCOLOR_STEEL,
SKINCOLOR_JET,
- SKINCOLOR_SAPPHIRE, // sweet mother, i cannot weave – slender aphrodite has overcome me with longing for a girl
+ SKINCOLOR_SAPPHIRE, // sweet mother, i cannot weave - slender aphrodite has overcome me with longing for a girl
SKINCOLOR_PERIWINKLE,
SKINCOLOR_BLUE,
SKINCOLOR_BLUEBERRY,
@@ -346,9 +364,9 @@ enum {
// 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"
+#define DEFAULTDIR ".srb2kart"
#else
-#define DEFAULTDIR "srb2"
+#define DEFAULTDIR "srb2kart"
#endif
#endif
@@ -453,6 +471,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__))
diff --git a/src/doomstat.h b/src/doomstat.h
index 34456b32..6d710e28 100644
--- a/src/doomstat.h
+++ b/src/doomstat.h
@@ -2,7 +2,7 @@
//-----------------------------------------------------------------------------
// Copyright (C) 1993-1996 by id Software, Inc.
// Copyright (C) 1998-2000 by DooM Legacy Team.
-// Copyright (C) 1999-2016 by Sonic Team Junior.
+// Copyright (C) 1999-2018 by Sonic Team Junior.
//
// This program is free software distributed under the
// terms of the GNU General Public License, version 2.
@@ -247,6 +247,7 @@ typedef struct
SINT8 unlockrequired; ///< Is an unlockable required to play this level? -1 if no.
UINT8 levelselect; ///< Is this map available in the level select? If so, which map list is it available in?
SINT8 bonustype; ///< What type of bonus does this level have? (-1 for null.)
+ SINT8 saveoverride; ///< Set how the game is allowed to save (1 for always, -1 for never, 0 is 2.1 default)
UINT8 levelflags; ///< LF_flags: merged eight booleans into one UINT8 for space, see below
UINT8 menuflags; ///< LF2_flags: options that affect record attack / nights mode menus
@@ -279,6 +280,11 @@ typedef struct
#define LF2_NIGHTSATTACK 8 ///< Show this map in NiGHTS mode menu
#define LF2_NOVISITNEEDED 16 ///< Available in time attack/nights mode without visiting the level
+// Save override
+#define SAVE_NEVER -1
+#define SAVE_DEFAULT 0
+#define SAVE_ALWAYS 1
+
extern mapheader_t* mapheaderinfo[NUMMAPS];
enum TypeOfLevel
@@ -438,6 +444,7 @@ extern mobj_t *hunt1, *hunt2, *hunt3; // Emerald hunt locations
extern UINT32 countdown, countdown2;
extern fixed_t gravity;
+extern fixed_t mapobjectscale;
//for CTF balancing
extern INT16 autobalance;
@@ -461,6 +468,7 @@ extern tic_t indirectitemcooldown;
extern tic_t mapreset;
extern UINT8 nospectategrief;
extern boolean thwompsactive;
+extern SINT8 spbplace;
extern boolean legitimateexit;
extern boolean comebackshowninfo;
@@ -530,6 +538,11 @@ extern boolean singletics;
extern consvar_t cv_timetic; // display high resolution timer
extern consvar_t cv_forceskin; // force clients to use the server's skin
extern consvar_t cv_downloading; // allow clients to downloading WADs.
+extern consvar_t cv_nettimeout; // SRB2Kart: Advanced server options menu
+extern consvar_t cv_jointimeout;
+#ifdef NEWPING
+extern consvar_t cv_maxping;
+#endif
extern ticcmd_t netcmds[BACKUPTICS][MAXPLAYERS];
extern INT32 serverplayer;
extern INT32 adminplayers[MAXPLAYERS];
diff --git a/src/doomtype.h b/src/doomtype.h
index c8499df2..5d643484 100644
--- a/src/doomtype.h
+++ b/src/doomtype.h
@@ -2,7 +2,7 @@
//-----------------------------------------------------------------------------
// Copyright (C) 1993-1996 by id Software, Inc.
// Copyright (C) 1998-2000 by DooM Legacy Team.
-// Copyright (C) 1999-2016 by Sonic Team Junior.
+// Copyright (C) 1999-2018 by Sonic Team Junior.
//
// This program is free software distributed under the
// terms of the GNU General Public License, version 2.
diff --git a/src/endian.h b/src/endian.h
index 2b876e7c..d3c1cb18 100644
--- a/src/endian.h
+++ b/src/endian.h
@@ -1,6 +1,6 @@
// SONIC ROBO BLAST 2
//-----------------------------------------------------------------------------
-// Copyright (C) 2014-2016 by Sonic Team Junior.
+// Copyright (C) 2014-2018 by Sonic Team Junior.
//
// This program is free software distributed under the
// terms of the GNU General Public License, version 2.
diff --git a/src/f_finale.c b/src/f_finale.c
index ea89b2b7..0fe13a8c 100644
--- a/src/f_finale.c
+++ b/src/f_finale.c
@@ -2,7 +2,7 @@
//-----------------------------------------------------------------------------
// Copyright (C) 1993-1996 by id Software, Inc.
// Copyright (C) 1998-2000 by DooM Legacy Team.
-// Copyright (C) 1999-2016 by Sonic Team Junior.
+// Copyright (C) 1999-2018 by Sonic Team Junior.
//
// This program is free software distributed under the
// terms of the GNU General Public License, version 2.
@@ -175,7 +175,7 @@ static void F_SkyScroll(INT32 scrollspeed)
{
V_DrawFill(0, 0, BASEVIDWIDTH, BASEVIDHEIGHT, 120);
- x = -animtimer;
+ x = -((INT32)animtimer);
y = 0;
while (x < w)
{
@@ -438,7 +438,7 @@ static const char *credits[] = {
"\"ZarroTsu\"",
"",
"\1Support Programming",
- "\"fickle\"",
+ "Colette \"fickleheart\" Bordelon",
"\"Lat\'\"",
"\"Monster Iestyn\"",
"\"Shuffle\"",
@@ -450,10 +450,12 @@ static const char *credits[] = {
"\1Support Artists",
"Sally \"TehRealSalt\" Cochenour",
"Sherman \"CoatRack\" DesJardins",
+ "\"DrTapeworm\"",
"Jesse \"Jeck Jims\" Emerick",
"Wesley \"Charyb\" Gillebaard",
"Vivian \"toaster\" Grannell",
"James \"SeventhSentinel\" Hall",
+ "\"Lat\'\"",
"\"Tyrannosaur Chao\"",
"\"ZarroTsu\"",
"",
@@ -465,8 +467,11 @@ static const char *credits[] = {
"\"Ritz\"",
"\"Rob\"",
"\"SmithyGNC\"",
+ "\"Snu\"",
"\"Spherallic\"",
"\"VAdaPEGA\"",
+ "\"Virt\"",
+ "\"zxyspku\"",
"",
"\1Sound Design",
"James \"SeventhSentinel\" Hall",
@@ -474,40 +479,10 @@ static const char *credits[] = {
"\"VAdaPEGA\"",
"\"VelocitOni\"",
"",
- "\1Music", // Can't list song names here, so we're listing artists
- "\"Arrow\"",
- "Jonny Atma",
- "Moot Booxle", // Booxlé, add the accent char later?
- "Malcolm Brown",
- "Karl Brueggemann",
+ "\1Music",
"\"DrTapeworm\"",
- "\"Elwood\"",
"Wesley \"Charyb\" Gillebaard",
- "\"gxf4c3\"",
"James \"SeventhSentinel\" Hall",
- "Chris Holland",
- "Johnny \"J\"",
- "Masato Kouda",
- "Fumie Kumatani",
- "Luke Kwing",
- "James Landino",
- "\"Lange\"",
- "Takenobu Mitsuyoshi",
- "\"Nib Roc\"",
- "Tomoya Ohtani",
- "Vincent Rubinetti",
- "Jun Senoue",
- "\"SSNTails\"",
- "Michael \"MaxieDaMan\" Staple",
- "Simon Stalenhag", // Stålenhag, add the accent char later?
- "\"Synthescissor\"",
- "Yuko Takehara",
- "Tony Thai",
- "\"The8BitDrummer\"",
- "Kenichi Tokoi",
- "\"Tokyo Active NEETs\"",
- "\"xaki\"",
- "Michiru Yamane",
"",
"\1Lead Level Design",
"\"Blitz-T\"",
@@ -581,7 +556,7 @@ static struct {
// This Tyler52 gag is troublesome
// Alignment should be ((spaces+1 * 100) + (headers+1 * 38) + (lines * 15))
// Current max image spacing: (200*17)
- {112, (15*100)+(17*38)+(97*15), "TYLER52", SKINCOLOR_NONE},
+ {112, (15*100)+(17*38)+(72*15), "TYLER52", SKINCOLOR_NONE},
{0, 0, NULL, SKINCOLOR_NONE}
};
@@ -643,6 +618,9 @@ void F_CreditDrawer(void)
V_DrawFixedPatch(credits_pics[i].x< 16
@@ -779,7 +790,7 @@ const char *G_BuildMapName(INT32 map)
map = gamemap-1;
else
map = prevmap;
- map = G_RandMap(G_TOLFlag(cv_newgametype.value), map, false, false, 0, false)+1;
+ map = G_RandMap(G_TOLFlag(cv_newgametype.value), map, false, 0, false, NULL)+1;
}
if (map < 100)
@@ -1108,7 +1119,6 @@ static INT32 Joy4Axis(axis_input_e axissel)
return 0;
}
-
if (axisval < 0) //odd -axises
{
axisval = -axisval;
@@ -1199,14 +1209,15 @@ boolean camspin, camspin2, camspin3, camspin4;
static fixed_t forwardmove[2] = {25<>16, 50<>16};
static fixed_t sidemove[2] = {2<>16, 4<>16};
-static fixed_t angleturn[3] = {400, 800, 200}; // + slow turn
+static fixed_t angleturn[3] = {KART_FULLTURN/2, KART_FULLTURN, KART_FULLTURN/4}; // + slow turn
void G_BuildTiccmd(ticcmd_t *cmd, INT32 realtics, UINT8 ssplayer)
{
INT32 laim, th, tspeed, forward, side, axis; //i
const INT32 speed = 1;
// these ones used for multiple conditions
- boolean turnleft, turnright, invertmouse, mouseaiming, lookaxis, usejoystick, analogjoystickmove, gamepadjoystickmove, kbl, rd;
+ boolean turnleft, turnright, mouseaiming, analogjoystickmove, gamepadjoystickmove;
+ boolean invertmouse, lookaxis, usejoystick, kbl, rd;
player_t *player;
camera_t *thiscam;
angle_t lang;
@@ -1341,47 +1352,38 @@ void G_BuildTiccmd(ticcmd_t *cmd, INT32 realtics, UINT8 ssplayer)
// let movement keys cancel each other out
if (turnright && !(turnleft))
{
- cmd->angleturn = (INT16)(cmd->angleturn - angleturn[tspeed]);
- cmd->driftturn = (INT16)(cmd->driftturn - angleturn[tspeed]);
+ cmd->angleturn = (INT16)(cmd->angleturn - (angleturn[tspeed]));
+ cmd->driftturn = (INT16)(cmd->driftturn - (angleturn[tspeed]));
+ side += sidemove[1];
}
else if (turnleft && !(turnright))
{
- cmd->angleturn = (INT16)(cmd->angleturn + angleturn[tspeed]);
- cmd->driftturn = (INT16)(cmd->driftturn + angleturn[tspeed]);
+ cmd->angleturn = (INT16)(cmd->angleturn + (angleturn[tspeed]));
+ cmd->driftturn = (INT16)(cmd->driftturn + (angleturn[tspeed]));
+ side -= sidemove[1];
}
if (analogjoystickmove && axis != 0)
{
// JOYAXISRANGE should be 1023 (divide by 1024)
- cmd->angleturn = (INT16)(cmd->angleturn - ((axis * angleturn[1]) >> 10)); // ANALOG!
- cmd->driftturn = (INT16)(cmd->driftturn - ((axis * angleturn[1]) >> 10));
+ cmd->angleturn = (INT16)(cmd->angleturn - (((axis * angleturn[1]) >> 10))); // ANALOG!
+ cmd->driftturn = (INT16)(cmd->driftturn - (((axis * angleturn[1]) >> 10)));
+ side += ((axis * sidemove[0]) >> 10);
}
// Specator mouse turning
if (player->spectator)
{
- cmd->angleturn = (INT16)(cmd->angleturn - (mousex*(encoremode ? -1 : 1)*8));
- cmd->driftturn = (INT16)(cmd->driftturn - (mousex*(encoremode ? -1 : 1)*8));
- }
-
- // Speed bump strafing
- if (!demoplayback && ((player->pflags & PF_FORCESTRAFE) || (player->kartstuff[k_pogospring])))
- {
- if (turnright)
- side += sidemove[1];
- if (turnleft)
- side -= sidemove[1];
- if (analogjoystickmove && axis != 0)
- {
- // JOYAXISRANGE is supposed to be 1023 (divide by 1024)
- side += ((axis * sidemove[0]) >> 10);
- }
+ cmd->angleturn = (INT16)(cmd->angleturn - ((mousex*(encoremode ? -1 : 1)*8)));
+ cmd->driftturn = (INT16)(cmd->driftturn - ((mousex*(encoremode ? -1 : 1)*8)));
}
if (player->spectator || objectplacing) // SRB2Kart: spectators need special controls
{
+ axis = JoyAxis(AXISMOVE, ssplayer);
if (InputDown(gc_accelerate, ssplayer) || (usejoystick && axis > 0))
cmd->buttons |= BT_ACCELERATE;
+ axis = JoyAxis(AXISBRAKE, ssplayer);
if (InputDown(gc_brake, ssplayer) || (usejoystick && axis > 0))
cmd->buttons |= BT_BRAKE;
axis = JoyAxis(AXISAIM, ssplayer);
@@ -1518,15 +1520,6 @@ void G_BuildTiccmd(ticcmd_t *cmd, INT32 realtics, UINT8 ssplayer)
else if (side < -MAXPLMOVE)
side = -MAXPLMOVE;
- // 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.
- // SRB2Kart: We don't need this; we WANT bounce strafing to plain stack on top of normal movement.
- /*if (!bouncestrafe && forward && side)
- {
- forward = FixedMul(forward, 3*FRACUNIT/4);
- side = FixedMul(side, 3*FRACUNIT/4);
- }*/
-
if (forward || side)
{
cmd->forwardmove = (SINT8)(cmd->forwardmove + forward);
@@ -1536,27 +1529,31 @@ void G_BuildTiccmd(ticcmd_t *cmd, INT32 realtics, UINT8 ssplayer)
//{ SRB2kart - Drift support
// Not grouped with the rest of turn stuff because it needs to know what buttons you're pressing for rubber-burn turn
// limit turning to angleturn[1] to stop mouselook letting you look too fast
- if (cmd->angleturn > angleturn[1])
- cmd->angleturn = angleturn[1];
- else if (cmd->angleturn < -angleturn[1])
- cmd->angleturn = -angleturn[1];
+ if (cmd->angleturn > (angleturn[1]))
+ cmd->angleturn = (angleturn[1]);
+ else if (cmd->angleturn < (-angleturn[1]))
+ cmd->angleturn = (-angleturn[1]);
- if (cmd->driftturn > angleturn[1])
- cmd->driftturn = angleturn[1];
- else if (cmd->driftturn < -angleturn[1])
- cmd->driftturn = -angleturn[1];
+ if (cmd->driftturn > (angleturn[1]))
+ cmd->driftturn = (angleturn[1]);
+ else if (cmd->driftturn < (-angleturn[1]))
+ cmd->driftturn = (-angleturn[1]);
if (player->mo)
cmd->angleturn = K_GetKartTurnValue(player, cmd->angleturn);
+ cmd->angleturn *= realtics;
+
// SRB2kart - no additional angle if not moving
if (((player->mo && player->speed > 0) // Moving
|| (leveltime > starttime && (cmd->buttons & BT_ACCELERATE && cmd->buttons & BT_BRAKE)) // Rubber-burn turn
+ || (player->kartstuff[k_respawn]) // Respawning
|| (player->spectator || objectplacing)) // Not a physical player
&& !(player->kartstuff[k_spinouttimer] && player->kartstuff[k_sneakertimer])) // Spinning and boosting cancels out turning
lang += (cmd->angleturn<<16);
cmd->angleturn = (INT16)(lang >> 16);
+ cmd->latency = modeattacking ? 0 : (leveltime & 0xFF); // Send leveltime when this tic was generated to the server for control lag calculations
if (!hu_stopped)
{
@@ -1652,10 +1649,12 @@ static void Analog_OnChange(void)
// cameras are not initialized at this point
- /*if (!cv_chasecam.value && cv_analog.value) {
+ /*
+ if (!cv_chasecam.value && cv_analog.value) {
CV_SetValue(&cv_analog, 0);
return;
- }*/
+ }
+ */
SendWeaponPref();
}
@@ -1667,10 +1666,12 @@ static void Analog2_OnChange(void)
// cameras are not initialized at this point
- /*if (!cv_chasecam2.value && cv_analog2.value) {
+ /*
+ if (!cv_chasecam2.value && cv_analog2.value) {
CV_SetValue(&cv_analog2, 0);
return;
- }*/
+ }
+ */
SendWeaponPref2();
}
@@ -1682,10 +1683,12 @@ static void Analog3_OnChange(void)
// cameras are not initialized at this point
- /*if (!cv_chasecam3.value && cv_analog3.value) {
+ /*
+ if (!cv_chasecam3.value && cv_analog3.value) {
CV_SetValue(&cv_analog3, 0);
return;
- }*/
+ }
+ */
SendWeaponPref3();
}
@@ -1697,10 +1700,12 @@ static void Analog4_OnChange(void)
// cameras are not initialized at this point
- /*if (!cv_chasecam4.value && cv_analog4.value) {
+ /*
+ if (!cv_chasecam4.value && cv_analog4.value) {
CV_SetValue(&cv_analog4, 0);
return;
- }*/
+ }
+ */
SendWeaponPref4();
}
@@ -1794,7 +1799,7 @@ boolean G_Responder(event_t *ev)
{
// allow spy mode changes even during the demo
if (gamestate == GS_LEVEL && ev->type == ev_keydown
- && (ev->data1 == gamecontrol[gc_viewpoint][0] || ev->data1 == gamecontrol[gc_viewpoint][1]))
+ && (ev->data1 == KEY_F12 || ev->data1 == gamecontrol[gc_viewpoint][0] || ev->data1 == gamecontrol[gc_viewpoint][1]))
{
if (splitscreen || !netgame)
displayplayer = consoleplayer;
@@ -1950,7 +1955,8 @@ boolean G_Responder(event_t *ev)
{
case ev_keydown:
if (ev->data1 == gamecontrol[gc_pause][0]
- || ev->data1 == gamecontrol[gc_pause][1])
+ || ev->data1 == gamecontrol[gc_pause][1]
+ || ev->data1 == KEY_PAUSE)
{
if (!pausedelay)
{
@@ -2131,6 +2137,9 @@ void G_Ticker(boolean run)
players[i].kartstuff[k_throwdir] = 0;
G_CopyTiccmd(cmd, &netcmds[buf][i], 1);
+
+ // Use the leveltime sent in the player's ticcmd to determine control lag
+ cmd->latency = modeattacking ? 0 : min((leveltime & 0xFF) - cmd->latency, MAXPREDICTTICS-1); //@TODO add a cvar to allow setting this max
}
}
@@ -2264,7 +2273,6 @@ static inline void G_PlayerFinishLevel(INT32 player)
p->starposty = 0;
p->starpostz = 0;
p->starpostnum = 0;
- p->starpostcount = 0;
// SRB2kart: Increment the "matches played" counter.
if (player == consoleplayer)
@@ -2316,7 +2324,6 @@ void G_PlayerReborn(INT32 player)
INT16 starposty;
INT16 starpostz;
INT32 starpostnum;
- INT32 starpostcount;
INT32 starpostangle;
fixed_t jumpfactor;
INT32 exiting;
@@ -2341,6 +2348,7 @@ void G_PlayerReborn(INT32 player)
INT32 bumper;
INT32 comebackpoints;
INT32 wanted;
+ boolean songcredit = false;
score = players[player].score;
marescore = players[player].marescore;
@@ -2380,7 +2388,6 @@ void G_PlayerReborn(INT32 player)
starposty = players[player].starposty;
starpostz = players[player].starpostz;
starpostnum = players[player].starpostnum;
- starpostcount = players[player].starpostcount;
starpostangle = players[player].starpostangle;
jumpfactor = players[player].jumpfactor;
thokitem = players[player].thokitem;
@@ -2426,7 +2433,10 @@ void G_PlayerReborn(INT32 player)
}
// Keep Shrink status, remove Grow status
- growshrinktimer = min(players[player].kartstuff[k_growshrinktimer], 0);
+ if (players[player].kartstuff[k_growshrinktimer] < 0)
+ growshrinktimer = players[player].kartstuff[k_growshrinktimer];
+ else
+ growshrinktimer = 0;
bumper = players[player].kartstuff[k_bumper];
comebackpoints = players[player].kartstuff[k_comebackpoints];
@@ -2472,7 +2482,6 @@ void G_PlayerReborn(INT32 player)
p->starposty = starposty;
p->starpostz = starpostz;
p->starpostnum = starpostnum;
- p->starpostcount = starpostcount;
p->starpostangle = starpostangle;
p->jumpfactor = jumpfactor;
p->exiting = exiting;
@@ -2518,10 +2527,13 @@ void G_PlayerReborn(INT32 player)
strncpy(mapmusname, mapheaderinfo[gamemap-1]->musname, 7);
mapmusname[6] = 0;
mapmusflags = mapheaderinfo[gamemap-1]->mustrack & MUSIC_TRACKMASK;
+ songcredit = true;
}
}
P_RestoreMusic(p);
+ if (songcredit)
+ S_ShowMusicCredit();
if (leveltime > (starttime + (TICRATE/2)) && !p->spectator)
p->kartstuff[k_respawn] = 48; // Respawn effect
@@ -2936,7 +2948,6 @@ void G_DoReborn(INT32 playernum)
player->starposty = 0;
player->starpostz = 0;
player->starpostnum = 0;
- player->starpostcount = 0;
}
if (!countdowntimeup && (mapheaderinfo[gamemap-1]->levelflags & LF_NORELOAD))
{
@@ -2986,21 +2997,19 @@ void G_DoReborn(INT32 playernum)
}
}
else
-#ifdef HAVE_BLUA
{
- LUAh_MapChange();
+#ifdef HAVE_BLUA
+ LUAh_MapChange(gamemap);
#endif
G_DoLoadLevel(true);
-#ifdef HAVE_BLUA
}
-#endif
}*/
else
{
// respawn at the start
mobj_t *oldmo = NULL;
- if (player->starpostnum) // SRB2kart
+ if (player->starpostnum || ((mapheaderinfo[gamemap - 1]->levelflags & LF_SECTIONRACE) && player->laps)) // SRB2kart
starpost = true;
// first dissasociate the corpse
@@ -3137,8 +3146,7 @@ INT16 G_SometimesGetDifferentGametype(void)
if (randmapbuffer[NUMMAPS] > 0 && (encorepossible || cv_kartvoterulechanges.value != 3))
{
- if (cv_kartvoterulechanges.value != 1)
- randmapbuffer[NUMMAPS]--;
+ randmapbuffer[NUMMAPS]--;
if (encorepossible)
{
switch (cv_kartvoterulechanges.value)
@@ -3151,7 +3159,7 @@ INT16 G_SometimesGetDifferentGametype(void)
break;
case 1: // sometimes
default:
- encorepossible = M_RandomChance(FRACUNIT>>3);
+ encorepossible = M_RandomChance(FRACUNIT>>2);
break;
}
if (encorepossible != (boolean)cv_kartencore.value)
@@ -3166,10 +3174,12 @@ INT16 G_SometimesGetDifferentGametype(void)
randmapbuffer[NUMMAPS] = 1; // every other vote (or always if !encorepossible)
break;
case 1: // sometimes
+ randmapbuffer[NUMMAPS] = 5; // per "cup"
+ break;
default:
// fallthrough - happens when clearing buffer, but needs a reasonable countdown if cvar is modified
case 2: // frequent
- randmapbuffer[NUMMAPS] = 5; // per "cup"
+ randmapbuffer[NUMMAPS] = 2; // ...every 1/2th-ish cup?
break;
}
@@ -3239,7 +3249,6 @@ INT16 G_TOLFlag(INT32 pgametype)
return INT16_MAX;
}
-#ifdef FLUSHMAPBUFFEREARLY
static INT32 TOLMaps(INT16 tolflags)
{
INT32 num = 0;
@@ -3250,14 +3259,14 @@ static INT32 TOLMaps(INT16 tolflags)
{
if (!mapheaderinfo[i])
continue;
-
+ if (mapheaderinfo[i]->menuflags & LF2_HIDEINMENU) // Don't include Map Hell
+ continue;
if ((mapheaderinfo[i]->typeoflevel & tolflags) == tolflags)
num++;
}
return num;
}
-#endif
/** Select a random map with the given typeoflevel flags.
* If no map has those flags, this arbitrarily gives you map 1.
@@ -3268,16 +3277,28 @@ static INT32 TOLMaps(INT16 tolflags)
* \author Graue
*/
static INT16 *okmaps = NULL;
-INT16 G_RandMap(INT16 tolflags, INT16 pprevmap, boolean dontadd, boolean ignorebuffer, UINT8 maphell, boolean callagainsoon)
+INT16 G_RandMap(INT16 tolflags, INT16 pprevmap, boolean ignorebuffer, UINT8 maphell, boolean callagainsoon, INT16 *extbuffer)
{
INT32 numokmaps = 0;
INT16 ix, bufx;
+ UINT16 extbufsize = 0;
+ boolean usehellmaps; // Only consider Hell maps in this pick
if (!okmaps)
okmaps = Z_Malloc(NUMMAPS * sizeof(INT16), PU_STATIC, NULL);
+ if (extbuffer != NULL)
+ {
+ bufx = 0;
+ while (extbuffer[bufx]) {
+ extbufsize++; bufx++;
+ }
+ }
+
tryagain:
+ usehellmaps = (maphell == 0 ? false : (maphell == 2 || M_RandomChance(FRACUNIT/100))); // 1% chance of Hell
+
// Find all the maps that are ok and and put them in an array.
for (ix = 0; ix < NUMMAPS; ix++)
{
@@ -3289,12 +3310,28 @@ tryagain:
if ((mapheaderinfo[ix]->typeoflevel & tolflags) != tolflags
|| ix == pprevmap
|| (!dedicated && M_MapLocked(ix+1))
- || (!maphell && (mapheaderinfo[ix]->menuflags & LF2_HIDEINMENU)) // this is bad
- || ((maphell == 2) && !(mapheaderinfo[ix]->menuflags & LF2_HIDEINMENU))) // gasp
+ || (usehellmaps != (mapheaderinfo[ix]->menuflags & LF2_HIDEINMENU))) // this is bad
continue; //isokmap = false;
if (!ignorebuffer)
{
+ if (extbufsize > 0)
+ {
+ for (bufx = 0; bufx < extbufsize; bufx++)
+ {
+ if (extbuffer[bufx] == -1) // Rest of buffer SHOULD be empty
+ break;
+ if (ix == extbuffer[bufx])
+ {
+ isokmap = false;
+ break;
+ }
+ }
+
+ if (!isokmap)
+ continue;
+ }
+
for (bufx = 0; bufx < (maphell ? 3 : NUMMAPS); bufx++)
{
if (randmapbuffer[bufx] == -1) // Rest of buffer SHOULD be empty
@@ -3305,12 +3342,12 @@ tryagain:
break;
}
}
+
+ if (!isokmap)
+ continue;
}
- if (!isokmap)
- continue;
-
- if (pprevmap == -2) // title demos
+ if (pprevmap == -2) // title demo hack
{
lumpnum_t l;
if ((l = W_CheckNumForName(va("%sS01",G_BuildMapName(ix+1)))) == LUMPERROR)
@@ -3327,20 +3364,18 @@ tryagain:
if (randmapbuffer[3] == -1) // Is the buffer basically empty?
{
ignorebuffer = true; // This will probably only help in situations where there's very few maps, but it's folly not to at least try it
- goto tryagain; //return G_RandMap(tolflags, pprevmap, dontadd, true, maphell, callagainsoon);
+ goto tryagain;
}
for (bufx = 3; bufx < NUMMAPS; bufx++) // Let's clear all but the three most recent maps...
randmapbuffer[bufx] = -1;
- if (cv_kartvoterulechanges.value == 1) // sometimes
- randmapbuffer[NUMMAPS] = 0;
- goto tryagain; //return G_RandMap(tolflags, pprevmap, dontadd, ignorebuffer, maphell, callagainsoon);
+ goto tryagain;
}
if (maphell) // Any wiggle room to loosen our restrictions here?
{
maphell--;
- goto tryagain; //return G_RandMap(tolflags, pprevmap, dontadd, true, maphell-1, callagainsoon);
+ goto tryagain;
}
ix = 0; // Sorry, none match. You get MAP01.
@@ -3348,15 +3383,7 @@ tryagain:
randmapbuffer[bufx] = -1; // if we're having trouble finding a map we should probably clear it
}
else
- {
ix = okmaps[M_RandomKey(numokmaps)];
- if (!dontadd)
- {
- for (bufx = NUMMAPS-1; bufx > 0; bufx--)
- randmapbuffer[bufx] = randmapbuffer[bufx-1];
- randmapbuffer[0] = ix;
- }
- }
if (!callagainsoon)
{
@@ -3367,6 +3394,25 @@ tryagain:
return ix;
}
+void G_AddMapToBuffer(INT16 map)
+{
+ INT16 bufx, refreshnum = (TOLMaps(G_TOLFlag(gametype)) / 2) + 1;
+
+ // Add the map to the buffer.
+ for (bufx = NUMMAPS-1; bufx > 0; bufx--)
+ randmapbuffer[bufx] = randmapbuffer[bufx-1];
+ randmapbuffer[0] = map;
+
+ // We're getting pretty full, so lets flush this for future usage.
+ if (randmapbuffer[refreshnum] != -1)
+ {
+ // Clear all but the five most recent maps.
+ for (bufx = 5; bufx < NUMMAPS; bufx++) // bufx < refreshnum? Might not handle everything for gametype switches, though.
+ randmapbuffer[bufx] = -1;
+ //CONS_Printf("Random map buffer has been flushed.\n");
+ }
+}
+
//
// G_DoCompleted
//
@@ -3502,22 +3548,12 @@ static void G_DoCompleted(void)
automapactive = false;
-#ifdef FLUSHMAPBUFFEREARLY
- if (randmapbuffer[TOLMaps(G_TOLFlag(gametype))-5] != -1) // We're getting pretty full, so! -- no need for this, handled in G_RandMap
- {
- for (i = 3; i < NUMMAPS; i++) // Let's clear all but the three most recent maps...
- randmapbuffer[i] = -1;
- if (cv_kartvoterulechanges.value == 1) // sometimes
- randmapbuffer[NUMMAPS] = 0;
- }
-#endif
-
if (gametype != GT_COOP)
{
if (cv_advancemap.value == 0) // Stay on same map.
nextmap = prevmap;
else if (cv_advancemap.value == 2) // Go to random map.
- nextmap = G_RandMap(G_TOLFlag(gametype), prevmap, false, false, 0, false);
+ nextmap = G_RandMap(G_TOLFlag(gametype), prevmap, false, 0, false, NULL);
}
// We are committed to this map now.
@@ -4297,7 +4333,6 @@ void G_InitNew(UINT8 pencoremode, const char *mapname, boolean resetplayer, bool
players[i].playerstate = PST_REBORN;
players[i].starpostangle = players[i].starpostnum = players[i].starposttime = 0;
players[i].starpostx = players[i].starposty = players[i].starpostz = 0;
- players[i].starpostcount = 0; // srb2kart
#if 0
if (netgame || multiplayer)
@@ -4339,7 +4374,7 @@ void G_InitNew(UINT8 pencoremode, const char *mapname, boolean resetplayer, bool
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);
}
@@ -4372,7 +4407,12 @@ void G_InitNew(UINT8 pencoremode, const char *mapname, boolean resetplayer, bool
if (!skipprecutscene && mapheaderinfo[gamemap-1]->precutscenenum && !modeattacking) // Start a custom cutscene.
F_StartCustomCutscene(mapheaderinfo[gamemap-1]->precutscenenum-1, true, resetplayer);
else
+ {
+#ifdef HAVE_BLUA
+ LUAh_MapChange(gamemap);
+#endif
G_DoLoadLevel(resetplayer);
+ }
if (netgame)
{
@@ -4507,6 +4547,7 @@ ticcmd_t *G_MoveTiccmd(ticcmd_t* dest, const ticcmd_t* src, const size_t n)
dest[i].aiming = (INT16)SHORT(src[i].aiming);
dest[i].buttons = (UINT16)SHORT(src[i].buttons);
dest[i].driftturn = (INT16)SHORT(src[i].driftturn);
+ dest[i].latency = (INT16)SHORT(src[i].latency);
}
return dest;
}
@@ -4538,6 +4579,7 @@ void G_ReadDemoTiccmd(ticcmd_t *cmd, INT32 playernum)
// SRB2kart: Copy-pasted from ticcmd building, removes that crappy demo cam
if (((players[displayplayer].mo && players[displayplayer].speed > 0) // Moving
|| (leveltime > starttime && (cmd->buttons & BT_ACCELERATE && cmd->buttons & BT_BRAKE)) // Rubber-burn turn
+ || (players[displayplayer].kartstuff[k_respawn]) // Respawning
|| (players[displayplayer].spectator || objectplacing)) // Not a physical player
&& !(players[displayplayer].kartstuff[k_spinouttimer] && players[displayplayer].kartstuff[k_sneakertimer])) // Spinning and boosting cancels out spinout
localangle += (cmd->angleturn<<16);
@@ -5885,9 +5927,9 @@ void G_DoPlayDemo(char *defdemoname)
// didn't start recording right away.
demo_start = false;
-#ifdef HAVE_BLUA
- LUAh_MapChange();
-#endif
+/*#ifdef HAVE_BLUA
+ LUAh_MapChange(gamemap);
+#endif*/
displayplayer = consoleplayer = 0;
memset(playeringame,0,sizeof(playeringame));
playeringame[0] = true;
diff --git a/src/g_game.h b/src/g_game.h
index 621da3f8..6d11a4a0 100644
--- a/src/g_game.h
+++ b/src/g_game.h
@@ -2,7 +2,7 @@
//-----------------------------------------------------------------------------
// Copyright (C) 1993-1996 by id Software, Inc.
// Copyright (C) 1998-2000 by DooM Legacy Team.
-// Copyright (C) 1999-2016 by Sonic Team Junior.
+// Copyright (C) 1999-2018 by Sonic Team Junior.
//
// This program is free software distributed under the
// terms of the GNU General Public License, version 2.
@@ -54,10 +54,11 @@ extern tic_t timeinmap; // Ticker for time spent in level (used for levelcard di
extern INT16 rw_maximums[NUM_WEAPONS];
// used in game menu
-extern consvar_t cv_chatwidth, cv_chatnotifications, cv_chatheight, cv_chattime, cv_consolechat, cv_chatspamprotection, cv_chatbacktint;
+extern consvar_t cv_chatwidth, cv_chatnotifications, cv_chatheight, cv_chattime, cv_consolechat, cv_chatbacktint, cv_chatspamprotection/*, cv_compactscoreboard*/;
+extern consvar_t cv_songcredits;
//extern consvar_t cv_crosshair, cv_crosshair2, cv_crosshair3, cv_crosshair4;
-extern consvar_t cv_invertmouse, cv_alwaysfreelook, cv_mousemove;
-extern consvar_t cv_invertmouse2, cv_alwaysfreelook2, cv_mousemove2;
+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, cv_useranalog3, cv_useranalog4;
extern consvar_t cv_analog, cv_analog2, cv_analog3, cv_analog4;
extern consvar_t cv_turnaxis,cv_moveaxis,cv_brakeaxis,cv_aimaxis,cv_lookaxis,cv_fireaxis,cv_driftaxis;
@@ -65,7 +66,6 @@ extern consvar_t cv_turnaxis2,cv_moveaxis2,cv_brakeaxis2,cv_aimaxis2,cv_lookaxis
extern consvar_t cv_turnaxis3,cv_moveaxis3,cv_brakeaxis3,cv_aimaxis3,cv_lookaxis3,cv_fireaxis3,cv_driftaxis3;
extern consvar_t cv_turnaxis4,cv_moveaxis4,cv_brakeaxis4,cv_aimaxis4,cv_lookaxis4,cv_fireaxis4,cv_driftaxis4;
extern consvar_t cv_ghost_besttime, cv_ghost_bestlap, cv_ghost_last, cv_ghost_guest, cv_ghost_staff;
-extern consvar_t cv_splitplayers;
typedef enum
{
@@ -255,6 +255,7 @@ FUNCMATH INT32 G_TicsToMilliseconds(tic_t tics);
// Don't split up TOL handling
INT16 G_TOLFlag(INT32 pgametype);
-INT16 G_RandMap(INT16 tolflags, INT16 pprevmap, boolean dontadd, boolean ignorebuffer, UINT8 maphell, boolean callagainsoon);
+INT16 G_RandMap(INT16 tolflags, INT16 pprevmap, boolean ignorebuffer, UINT8 maphell, boolean callagainsoon, INT16 *extbuffer);
+void G_AddMapToBuffer(INT16 map);
#endif
diff --git a/src/g_input.c b/src/g_input.c
index d671ec57..871c1e60 100644
--- a/src/g_input.c
+++ b/src/g_input.c
@@ -1,7 +1,7 @@
// SONIC ROBO BLAST 2
//-----------------------------------------------------------------------------
// Copyright (C) 1998-2000 by DooM Legacy Team.
-// Copyright (C) 1999-2016 by Sonic Team Junior.
+// Copyright (C) 1999-2018 by Sonic Team Junior.
//
// This program is free software distributed under the
// terms of the GNU General Public License, version 2.
@@ -25,11 +25,11 @@ static CV_PossibleValue_t mousesens_cons_t[] = {{1, "MIN"}, {MAXMOUSESENSITIVITY
static CV_PossibleValue_t onecontrolperkey_cons_t[] = {{1, "One"}, {2, "Several"}, {0, NULL}};
// mouse values are used once
-consvar_t cv_mousesens = {"mousesens", "35", CV_SAVE, mousesens_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
-consvar_t cv_mousesens2 = {"mousesens2", "35", CV_SAVE, mousesens_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
-consvar_t cv_mouseysens = {"mouseysens", "35", CV_SAVE, mousesens_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
-consvar_t cv_mouseysens2 = {"mouseysens2", "35", CV_SAVE, mousesens_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
-consvar_t cv_controlperkey = {"controlperkey", "Several", CV_SAVE, onecontrolperkey_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
+consvar_t cv_mousesens = {"mousesens", "20", CV_SAVE, mousesens_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
+consvar_t cv_mousesens2 = {"mousesens2", "20", CV_SAVE, mousesens_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
+consvar_t cv_mouseysens = {"mouseysens", "20", CV_SAVE, mousesens_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
+consvar_t cv_mouseysens2 = {"mouseysens2", "20", CV_SAVE, mousesens_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
+consvar_t cv_controlperkey = {"controlperkey", "One", CV_SAVE, onecontrolperkey_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
INT32 mousex, mousey;
INT32 mlooky; // like mousey but with a custom sensitivity for mlook
@@ -103,6 +103,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));
@@ -110,7 +112,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;
@@ -118,7 +120,7 @@ void G_MapEventsToControls(event_t *ev)
case ev_joystick2: // buttons are virtual keys
i = ev->data1;
- if (i >= JOYAXISSET)
+ if (i >= JOYAXISSET || menuactive)
break;
if (ev->data2 != INT32_MAX) joy2xmove[i] = ev->data2;
if (ev->data3 != INT32_MAX) joy2ymove[i] = ev->data3;
@@ -141,6 +143,8 @@ void G_MapEventsToControls(event_t *ev)
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));
@@ -1228,6 +1232,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
@@ -1274,71 +1288,82 @@ INT32 G_KeyStringtoNum(const char *keystr)
}
// SRB2Kart
-void G_Controldefault(void)
+void G_Controldefault(UINT8 player)
{
- // Main controls
- gamecontrol[gc_aimforward ][0] = KEY_UPARROW;
- gamecontrol[gc_aimbackward][0] = KEY_DOWNARROW;
- gamecontrol[gc_turnleft ][0] = KEY_LEFTARROW;
- gamecontrol[gc_turnright ][0] = KEY_RIGHTARROW;
- gamecontrol[gc_accelerate ][0] = 'a';
- gamecontrol[gc_drift ][0] = 's';
- gamecontrol[gc_brake ][0] = 'd';
- gamecontrol[gc_fire ][0] = KEY_SPACE;
- gamecontrol[gc_lookback ][0] = KEY_LSHIFT;
+ if (player == 0 || player == 1)
+ {
+ // Main controls
+ gamecontrol[gc_aimforward ][0] = KEY_UPARROW;
+ gamecontrol[gc_aimbackward][0] = KEY_DOWNARROW;
+ gamecontrol[gc_turnleft ][0] = KEY_LEFTARROW;
+ gamecontrol[gc_turnright ][0] = KEY_RIGHTARROW;
+ gamecontrol[gc_accelerate ][0] = 'a';
+ gamecontrol[gc_drift ][0] = 's';
+ gamecontrol[gc_brake ][0] = 'd';
+ gamecontrol[gc_fire ][0] = KEY_SPACE;
+ gamecontrol[gc_lookback ][0] = KEY_LSHIFT;
- gamecontrol[gc_accelerate ][1] = KEY_JOY1+0; // A
- gamecontrol[gc_lookback ][1] = KEY_JOY1+2; // X
- gamecontrol[gc_brake ][1] = KEY_JOY1+1; // B
- gamecontrol[gc_fire ][1] = KEY_JOY1+4; // LB
- gamecontrol[gc_drift ][1] = KEY_JOY1+5; // RB
-
- // Extra controls
- gamecontrol[gc_pause ][0] = KEY_PAUSE;
- gamecontrol[gc_console ][0] = KEY_CONSOLE;
- gamecontrol[gc_screenshot ][0] = KEY_F8;
- gamecontrol[gc_recordgif ][0] = KEY_F9;
- gamecontrol[gc_viewpoint ][0] = KEY_F12;
- gamecontrol[gc_talkkey ][0] = 't';
- //gamecontrol[gc_teamkey ][0] = 'y';
- gamecontrol[gc_scores ][0] = KEY_TAB;
- gamecontrol[gc_spectate ][0] = '\'';
- gamecontrol[gc_lookup ][0] = KEY_PGUP;
- gamecontrol[gc_lookdown ][0] = KEY_PGDN;
- gamecontrol[gc_centerview ][0] = KEY_END;
- gamecontrol[gc_camreset ][0] = KEY_HOME;
- gamecontrol[gc_camtoggle ][0] = KEY_BACKSPACE;
+ gamecontrol[gc_accelerate ][1] = KEY_JOY1+0; // A
+ gamecontrol[gc_lookback ][1] = KEY_JOY1+2; // X
+ gamecontrol[gc_brake ][1] = KEY_JOY1+1; // B
+ gamecontrol[gc_fire ][1] = KEY_JOY1+4; // LB
+ gamecontrol[gc_drift ][1] = KEY_JOY1+5; // RB
+
+ // Extra controls
+ gamecontrol[gc_pause ][0] = KEY_PAUSE;
+ gamecontrol[gc_console ][0] = KEY_CONSOLE;
+ gamecontrol[gc_screenshot ][0] = KEY_F8;
+ gamecontrol[gc_recordgif ][0] = KEY_F9;
+ gamecontrol[gc_viewpoint ][0] = KEY_F12;
+ gamecontrol[gc_talkkey ][0] = 't';
+ //gamecontrol[gc_teamkey ][0] = 'y';
+ gamecontrol[gc_scores ][0] = KEY_TAB;
+ gamecontrol[gc_spectate ][0] = '\'';
+ gamecontrol[gc_lookup ][0] = KEY_PGUP;
+ gamecontrol[gc_lookdown ][0] = KEY_PGDN;
+ gamecontrol[gc_centerview ][0] = KEY_END;
+ gamecontrol[gc_camreset ][0] = KEY_HOME;
+ gamecontrol[gc_camtoggle ][0] = KEY_BACKSPACE;
- gamecontrol[gc_viewpoint ][1] = KEY_JOY1+3; // Y
- gamecontrol[gc_pause ][1] = KEY_JOY1+6; // Back
- gamecontrol[gc_systemmenu ][0] = KEY_JOY1+7; // Start
- gamecontrol[gc_camtoggle ][1] = KEY_HAT1+0; // D-Pad Up
- gamecontrol[gc_screenshot ][1] = KEY_HAT1+1; // D-Pad Down
- gamecontrol[gc_talkkey ][1] = KEY_HAT1+2; // D-Pad Left
- gamecontrol[gc_scores ][1] = KEY_HAT1+3; // D-Pad Right
+ gamecontrol[gc_viewpoint ][1] = KEY_JOY1+3; // Y
+ gamecontrol[gc_pause ][1] = KEY_JOY1+6; // Back
+ gamecontrol[gc_systemmenu ][0] = KEY_JOY1+7; // Start
+ //gamecontrol[gc_camtoggle ][1] = KEY_HAT1+0; // D-Pad Up
+ //gamecontrol[gc_screenshot ][1] = KEY_HAT1+1; // D-Pad Down // absolutely fucking NOT
+ gamecontrol[gc_talkkey ][1] = KEY_HAT1+1; // D-Pad Down
+ gamecontrol[gc_scores ][1] = KEY_HAT1+0; // D-Pad Up
+ }
- // Player 2 controls
- gamecontrolbis[gc_accelerate ][0] = KEY_2JOY1+0; // A
- gamecontrolbis[gc_lookback ][0] = KEY_2JOY1+2; // X
- gamecontrolbis[gc_brake ][0] = KEY_2JOY1+1; // B
- gamecontrolbis[gc_fire ][0] = KEY_2JOY1+4; // LB
- gamecontrolbis[gc_drift ][0] = KEY_2JOY1+5; // RB
+ if (player == 0 || player == 2)
+ {
+ // Player 2 controls
+ gamecontrolbis[gc_accelerate ][0] = KEY_2JOY1+0; // A
+ gamecontrolbis[gc_lookback ][0] = KEY_2JOY1+2; // X
+ gamecontrolbis[gc_brake ][0] = KEY_2JOY1+1; // B
+ gamecontrolbis[gc_fire ][0] = KEY_2JOY1+4; // LB
+ gamecontrolbis[gc_drift ][0] = KEY_2JOY1+5; // RB
+ }
- // Player 3 controls
- gamecontrol3[gc_accelerate ][0] = KEY_3JOY1+0; // A
- gamecontrol3[gc_lookback ][0] = KEY_3JOY1+2; // X
- gamecontrol3[gc_brake ][0] = KEY_3JOY1+1; // B
- gamecontrol3[gc_fire ][0] = KEY_3JOY1+4; // LB
- gamecontrol3[gc_drift ][0] = KEY_3JOY1+5; // RB
+ if (player == 0 || player == 3)
+ {
+ // Player 3 controls
+ gamecontrol3[gc_accelerate ][0] = KEY_3JOY1+0; // A
+ gamecontrol3[gc_lookback ][0] = KEY_3JOY1+2; // X
+ gamecontrol3[gc_brake ][0] = KEY_3JOY1+1; // B
+ gamecontrol3[gc_fire ][0] = KEY_3JOY1+4; // LB
+ gamecontrol3[gc_drift ][0] = KEY_3JOY1+5; // RB
+ }
- // Player 4 controls
- gamecontrol4[gc_accelerate ][0] = KEY_4JOY1+0; // A
- gamecontrol4[gc_lookback ][0] = KEY_4JOY1+2; // X
- gamecontrol4[gc_brake ][0] = KEY_4JOY1+1; // B
- gamecontrol4[gc_fire ][0] = KEY_4JOY1+4; // LB
- gamecontrol4[gc_drift ][0] = KEY_4JOY1+5; // RB
+ if (player == 0 || player == 4)
+ {
+ // Player 4 controls
+ gamecontrol4[gc_accelerate ][0] = KEY_4JOY1+0; // A
+ gamecontrol4[gc_lookback ][0] = KEY_4JOY1+2; // X
+ gamecontrol4[gc_brake ][0] = KEY_4JOY1+1; // B
+ gamecontrol4[gc_fire ][0] = KEY_4JOY1+4; // LB
+ gamecontrol4[gc_drift ][0] = KEY_4JOY1+5; // RB
+ }
}
-//#endif
void G_SaveKeySetting(FILE *f)
{
@@ -1389,38 +1414,181 @@ void G_SaveKeySetting(FILE *f)
}
}
-void G_CheckDoubleUsage(INT32 keynum)
+INT32 G_CheckDoubleUsage(INT32 keynum, boolean modify)
{
+ INT32 result = gc_null;
if (cv_controlperkey.value == 1)
{
- INT32 i;
+ INT32 i, j;
for (i = 0; i < num_gamecontrols; i++)
{
- if (gamecontrol[i][0] == keynum)
- gamecontrol[i][0] = KEY_NULL;
- if (gamecontrol[i][1] == keynum)
- gamecontrol[i][1] = KEY_NULL;
- if (gamecontrolbis[i][0] == keynum)
- gamecontrolbis[i][0] = KEY_NULL;
- if (gamecontrolbis[i][1] == keynum)
- gamecontrolbis[i][1] = KEY_NULL;
- if (gamecontrol3[i][0] == keynum)
- gamecontrol3[i][0] = KEY_NULL;
- if (gamecontrol3[i][1] == keynum)
- gamecontrol3[i][1] = KEY_NULL;
- if (gamecontrol4[i][0] == keynum)
- gamecontrol4[i][0] = KEY_NULL;
- if (gamecontrol4[i][1] == keynum)
- gamecontrol4[i][1] = KEY_NULL;
+ for (j = 0; j < 2; j++)
+ {
+ if (gamecontrol[i][j] == keynum) {
+ result = i;
+ if (modify) gamecontrol[i][j] = KEY_NULL;
+ }
+ if (gamecontrolbis[i][j] == keynum) {
+ result = i;
+ if (modify) gamecontrolbis[i][j] = KEY_NULL;
+ }
+ if (gamecontrol3[i][j] == keynum) {
+ result = i;
+ if (modify) gamecontrol3[i][j] = KEY_NULL;
+ }
+ if (gamecontrol4[i][j] == keynum) {
+ result = i;
+ if (modify) gamecontrol4[i][j] = 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 1
+ // We don't have changed control defaults yet
+ (void)numctrl;
+ (void)player;
+ (void)nestedoverride;
+#else
+#if !defined (DC) && !defined (_PSP) && !defined (GP2X) && !defined (_NDS) && !defined(WMINPUT) && !defined(_WII)
+ if (GETMAJOREXECVERSION(cv_execversion.value) < 27 && ( // v2.1.22
+ numctrl == gc_weaponnext || numctrl == gc_weaponprev || numctrl == gc_tossflag ||
+ numctrl == gc_use || numctrl == gc_camreset || numctrl == gc_jump ||
+ 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;
+ }
+#endif
+#endif
+
+ // 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;
+ boolean nestedoverride = false;
+
+ if ((void*)gc == (void*)&gamecontrol4)
+ player = 3;
+ else if ((void*)gc == (void*)&gamecontrol3)
+ player = 2;
+ else if ((void*)gc == (void*)&gamecontrolbis)
+ player = 1;
+ else
+ player = 0;
namectrl = COM_Argv(1);
for (numctrl = 0; numctrl < num_gamecontrols && stricmp(namectrl, gamecontrolname[numctrl]);
@@ -1431,12 +1599,39 @@ static void setcontrol(INT32 (*gc)[2], INT32 na)
CONS_Printf(M_GetText("Control '%s' unknown\n"), namectrl);
return;
}
- keynum = G_KeyStringtoNum(COM_Argv(2));
- G_CheckDoubleUsage(keynum);
- gc[numctrl][0] = keynum;
+ keynum1 = G_KeyStringtoNum(COM_Argv(2));
+ keynum2 = G_KeyStringtoNum(COM_Argv(3));
+ keynum = G_FilterKeyByVersion(numctrl, 0, player, &keynum1, &keynum2, &nestedoverride);
- if (na == 4)
- gc[numctrl][1] = G_KeyStringtoNum(COM_Argv(3));
+ if (keynum >= 0)
+ {
+ (void)G_CheckDoubleUsage(keynum, true);
+
+ // if keynum was rejected, try it again with keynum2
+ if (!keynum && keynum2)
+ {
+ keynum1 = keynum2; // push down keynum2
+ keynum2 = 0;
+ keynum = G_FilterKeyByVersion(numctrl, 0, player, &keynum1, &keynum2, &nestedoverride);
+ if (keynum >= 0)
+ (void)G_CheckDoubleUsage(keynum, true);
+ }
+ }
+
+ if (keynum >= 0)
+ gc[numctrl][0] = keynum;
+
+ if (keynum2)
+ {
+ 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;
}
@@ -1453,7 +1648,7 @@ void Command_Setcontrol_f(void)
return;
}
- setcontrol(gamecontrol, na);
+ setcontrol(gamecontrol);
}
void Command_Setcontrol2_f(void)
@@ -1468,7 +1663,7 @@ void Command_Setcontrol2_f(void)
return;
}
- setcontrol(gamecontrolbis, na);
+ setcontrol(gamecontrolbis);
}
void Command_Setcontrol3_f(void)
@@ -1483,7 +1678,7 @@ void Command_Setcontrol3_f(void)
return;
}
- setcontrol(gamecontrol3, na);
+ setcontrol(gamecontrol3);
}
void Command_Setcontrol4_f(void)
@@ -1498,5 +1693,5 @@ void Command_Setcontrol4_f(void)
return;
}
- setcontrol(gamecontrol4, na);
-}
\ No newline at end of file
+ setcontrol(gamecontrol4);
+}
diff --git a/src/g_input.h b/src/g_input.h
index c12f28aa..6d0c7e2c 100644
--- a/src/g_input.h
+++ b/src/g_input.h
@@ -1,7 +1,7 @@
// SONIC ROBO BLAST 2
//-----------------------------------------------------------------------------
// Copyright (C) 1998-2000 by DooM Legacy Team.
-// Copyright (C) 1999-2016 by Sonic Team Junior.
+// Copyright (C) 1999-2018 by Sonic Team Junior.
//
// This program is free software distributed under the
// terms of the GNU General Public License, version 2.
@@ -161,12 +161,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 Command_Setcontrol3_f(void);
void Command_Setcontrol4_f(void);
-void G_Controldefault(void);
+void G_Controldefault(UINT8 player);
void G_SaveKeySetting(FILE *f);
-void G_CheckDoubleUsage(INT32 keynum);
+INT32 G_CheckDoubleUsage(INT32 keynum, boolean modify);
#endif
diff --git a/src/g_state.h b/src/g_state.h
index 38ad4145..f9f1babd 100644
--- a/src/g_state.h
+++ b/src/g_state.h
@@ -1,7 +1,7 @@
// SONIC ROBO BLAST 2
//-----------------------------------------------------------------------------
// Copyright (C) 1998-2000 by DooM Legacy Team.
-// Copyright (C) 1999-2016 by Sonic Team Junior.
+// Copyright (C) 1999-2018 by Sonic Team Junior.
//
// This program is free software distributed under the
// terms of the GNU General Public License, version 2.
diff --git a/src/hardware/hw_bsp.c b/src/hardware/hw_bsp.c
index 9378a22c..48393249 100644
--- a/src/hardware/hw_bsp.c
+++ b/src/hardware/hw_bsp.c
@@ -194,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
@@ -218,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.
@@ -254,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;
@@ -295,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
@@ -369,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;
@@ -388,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;
@@ -483,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;
}
}
@@ -582,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)
{
@@ -631,36 +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, levelfadecol); // White 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));
@@ -692,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]);
}
}
@@ -779,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;
@@ -967,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_defs.h b/src/hardware/hw_defs.h
index 2d346878..ece627d3 100644
--- a/src/hardware/hw_defs.h
+++ b/src/hardware/hw_defs.h
@@ -104,7 +104,7 @@ typedef struct
typedef struct
{
FLOAT x,y,z; // position
- FLOAT anglex,angley; // aimingangle / viewangle
+ FLOAT anglex,angley,anglez; // aimingangle / viewangle
FLOAT scalex,scaley,scalez;
FLOAT fovxangle, fovyangle;
UINT8 splitscreen;
diff --git a/src/hardware/hw_draw.c b/src/hardware/hw_draw.c
index aeb41492..b39103ee 100644
--- a/src/hardware/hw_draw.c
+++ b/src/hardware/hw_draw.c
@@ -230,14 +230,14 @@ void HWR_DrawFixedPatch(GLPatch_t *gpatch, fixed_t x, fixed_t y, fixed_t pscale,
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));
@@ -378,14 +378,14 @@ void HWR_DrawCroppedPatch(GLPatch_t *gpatch, fixed_t x, fixed_t y, fixed_t pscal
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));
@@ -777,18 +777,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
@@ -809,7 +797,6 @@ void HWR_drawAMline(const fline_t *fl, INT32 color)
HWD.pfnDraw2DLine(&v1, &v2, color_rgba);
}
-
// -----------------+
// HWR_DrawFill : draw flat coloured rectangle, with no texture
// -----------------+
@@ -853,14 +840,14 @@ 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 ((float)vid.height != (float)BASEVIDHEIGHT * dupy)
+ if (fabsf((float)vid.height - (float)BASEVIDHEIGHT * dupy) > 1.0E-36f)
{
// same thing here
if (color & V_SNAPTOBOTTOM)
@@ -963,14 +950,14 @@ void HWR_DrawConsoleFill(INT32 x, INT32 y, INT32 w, INT32 h, UINT32 color, INT32
fw *= dupx;
fh *= dupy;
- if (vid.width != BASEVIDWIDTH * vid.dupx)
+ if (fabsf((float)vid.width - ((float)BASEVIDWIDTH * dupx)) > 1.0E-36f)
{
if (options & V_SNAPTORIGHT)
fx += ((float)vid.width - ((float)BASEVIDWIDTH * dupx));
else if (!(options & V_SNAPTOLEFT))
fx += ((float)vid.width - ((float)BASEVIDWIDTH * dupx)) / 2;
}
- if (vid.height != BASEVIDHEIGHT * dupy)
+ if (fabsf((float)vid.height - ((float)BASEVIDHEIGHT * dupy)) > 1.0E-36f)
{
// same thing here
if (options & V_SNAPTOBOTTOM)
@@ -1022,7 +1009,7 @@ void HWR_DrawConsoleFill(INT32 x, INT32 y, INT32 w, INT32 h, UINT32 color, INT32
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(color);
Surf.FlatColor.s.alpha = 0x80;
@@ -1059,14 +1046,14 @@ void HWR_DrawDiag(INT32 x, INT32 y, INT32 wh, INT32 color)
fw *= dupx;
fh *= dupy;
- if (vid.width != BASEVIDWIDTH * vid.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 (vid.height != BASEVIDHEIGHT * dupy)
+ if (fabsf((float)vid.height - ((float)BASEVIDHEIGHT * dupy)) > 1.0E-36f)
{
// same thing here
if (color & V_SNAPTOBOTTOM)
diff --git a/src/hardware/hw_glob.h b/src/hardware/hw_glob.h
index 5d1a81d4..9656e54e 100644
--- a/src/hardware/hw_glob.h
+++ b/src/hardware/hw_glob.h
@@ -27,6 +27,9 @@
// the original aspect ratio of Doom graphics isn't square
#define ORIGINAL_ASPECT (320.0f/200.0f)
+// Uncomment this to enable the OpenGL loading screen
+//#define HWR_LOADING_SCREEN
+
// -----------
// structures
// -----------
diff --git a/src/hardware/hw_main.c b/src/hardware/hw_main.c
index 68915e97..c45814bb 100644
--- a/src/hardware/hw_main.c
+++ b/src/hardware/hw_main.c
@@ -3569,9 +3569,7 @@ static void HWR_Subsector(size_t num, UINT8 ssplayer)
#ifndef POLYSKY
// Moved here because before, when above the ceiling and the floor does not have the sky flat, it doesn't draw the sky
if (gr_frontsector->ceilingpic == skyflatnum || gr_frontsector->floorpic == skyflatnum)
- {
drawsky = true;
- }
#endif
#ifdef R_FAKEFLOORS
@@ -4155,7 +4153,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);
@@ -4323,7 +4321,7 @@ static void HWR_SplitSprite(gr_vissprite_t *spr)
wallVerts[1].z = wallVerts[2].z = spr->z2;
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;
@@ -4352,6 +4350,16 @@ static void HWR_SplitSprite(gr_vissprite_t *spr)
wallVerts[0].tow = wallVerts[1].tow = gpatch->max_t;
}
+ // 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;
+ }
+
realtop = top = wallVerts[3].y;
realbot = bot = wallVerts[0].y;
towtop = wallVerts[3].tow;
@@ -4604,7 +4612,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;
@@ -4654,6 +4662,16 @@ 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;
+ }
+
// 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
@@ -4850,7 +4868,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;
@@ -5245,7 +5263,8 @@ static void HWR_DrawSprites(void)
#endif
if (spr->mobj && spr->mobj->skin && spr->mobj->sprite == SPR_PLAY)
{
- if (!cv_grmd2.value || md2_playermodels[(skin_t*)spr->mobj->skin-skins].notfound || md2_playermodels[(skin_t*)spr->mobj->skin-skins].scale < 0.0f)
+ // 8/1/19: Only don't display player models if no default SPR_PLAY is found.
+ if (!cv_grmd2.value || ((md2_playermodels[(skin_t*)spr->mobj->skin-skins].notfound || md2_playermodels[(skin_t*)spr->mobj->skin-skins].scale < 0.0f) && (md2_models[SPR_PLAY].notfound || md2_models[SPR_PLAY].scale < 0.0f)))
HWR_DrawSprite(spr);
else
HWR_DrawMD2(spr);
@@ -5740,7 +5759,7 @@ static void HWR_ProjectPrecipitationSprite(precipmobj_t *thing)
// ==========================================================================
//
// ==========================================================================
-static void HWR_DrawSkyBackground(player_t *player)
+static void HWR_DrawSkyBackground(void)
{
FOutVector v[4];
angle_t angle;
@@ -5748,18 +5767,18 @@ static void HWR_DrawSkyBackground(player_t *player)
float aspectratio;
float angleturn;
-// 3--2
-// | /|
-// |/ |
-// 0--1
-
- (void)player;
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
// because it's called just after clearing the screen
// and thus, the near clipping plane is set to 3.99
// Sryder: Just use the near clipping plane value then
+
+ // 3--2
+ // | /|
+ // |/ |
+ // 0--1
v[0].x = v[3].x = -ZCLIP_PLANE-1;
v[1].x = v[2].x = ZCLIP_PLANE+1;
v[0].y = v[1].y = -ZCLIP_PLANE-1;
@@ -5788,9 +5807,13 @@ static void HWR_DrawSkyBackground(player_t *player)
// Y
angle = aimingangle;
- aspectratio = (float)vid.width/(float)vid.height;
dimensionmultiply = ((float)textures[texturetranslation[skytexture]]->height/(128.0f*aspectratio));
- angleturn = (((float)ANGLE_45-1.0f)*aspectratio)*dimensionmultiply;
+
+ if (splitscreen == 1)
+ {
+ dimensionmultiply *= 2;
+ angle *= 2;
+ }
// Middle of the sky should always be at angle 0
// need to keep correct aspect ratio with X
@@ -5806,6 +5829,8 @@ static void HWR_DrawSkyBackground(player_t *player)
v[0].tow = v[1].tow = -(0.5f-(0.5f/dimensionmultiply));
}
+ angleturn = (((float)ANGLE_45-1.0f)*aspectratio)*dimensionmultiply;
+
if (angle > ANGLE_180) // Do this because we don't want the sky to suddenly teleport when crossing over 0 to 360 and vice versa
{
angle = InvAngle(angle);
@@ -5968,6 +5993,7 @@ void HWR_RenderSkyboxView(INT32 viewnumber, player_t *player)
// It should replace all other gr_viewxxx when finished
atransform.anglex = (float)(aimingangle>>ANGLETOFINESHIFT)*(360.0f/(float)FINEANGLES);
atransform.angley = (float)(viewangle>>ANGLETOFINESHIFT)*(360.0f/(float)FINEANGLES);
+ atransform.anglez = 0.0f;
if (*type == postimg_flip)
atransform.flip = true;
@@ -6002,12 +6028,8 @@ if (0)
HWD.pfnSetSpecialState(HWD_SET_FOG_MODE, 0); // Turn it off
}
-#ifndef _NDS
if (drawsky)
- HWR_DrawSkyBackground(player);
-#else
- (void)HWR_DrawSkyBackground;
-#endif
+ HWR_DrawSkyBackground();
//Hurdler: it doesn't work in splitscreen mode
drawsky = splitscreen;
@@ -6230,6 +6252,7 @@ void HWR_RenderPlayerView(INT32 viewnumber, player_t *player)
// It should replace all other gr_viewxxx when finished
atransform.anglex = (float)(aimingangle>>ANGLETOFINESHIFT)*(360.0f/(float)FINEANGLES);
atransform.angley = (float)(viewangle>>ANGLETOFINESHIFT)*(360.0f/(float)FINEANGLES);
+ atransform.anglez = 0.0f;
if (*type == postimg_flip)
atransform.flip = true;
@@ -6264,12 +6287,8 @@ if (0)
HWD.pfnSetSpecialState(HWD_SET_FOG_MODE, 0); // Turn it off
}
-#ifndef _NDS
if (!skybox && drawsky) // Don't draw the regular sky if there's a skybox
- HWR_DrawSkyBackground(player);
-#else
- (void)HWR_DrawSkyBackground;
-#endif
+ HWR_DrawSkyBackground();
//Hurdler: it doesn't work in splitscreen mode
drawsky = splitscreen;
diff --git a/src/hardware/hw_main.h b/src/hardware/hw_main.h
index f74814f0..198780f9 100644
--- a/src/hardware/hw_main.h
+++ b/src/hardware/hw_main.h
@@ -31,7 +31,6 @@
void HWR_Startup(void);
void HWR_Shutdown(void);
-void HWR_clearAutomap(void);
void HWR_drawAMline(const fline_t *fl, INT32 color);
void HWR_FadeScreenMenuBack(UINT16 color, UINT8 strength);
void HWR_DrawConsoleBack(UINT32 color, INT32 height);
diff --git a/src/hardware/hw_md2.c b/src/hardware/hw_md2.c
index c545cb80..e50c1365 100644
--- a/src/hardware/hw_md2.c
+++ b/src/hardware/hw_md2.c
@@ -300,8 +300,12 @@ static md2_model_t *md2_readModel(const char *filename)
file = fopen(va("%s"PATHSEP"%s", srb2home, filename), "rb");
if (!file)
{
- free(model);
- return 0;
+ file = fopen(va("%s"PATHSEP"%s", srb2path, filename), "rb");
+ if (!file)
+ {
+ free(model);
+ return 0;
+ }
}
// initialize model and read header
@@ -492,7 +496,7 @@ static GrTextureFormat_t PNG_Load(const char *filename, int *w, int *h, GLPatch_
jmp_buf jmpbuf;
#endif
#endif
- png_FILE_p png_FILE;
+ volatile png_FILE_p png_FILE;
//Filename checking fixed ~Monster Iestyn and Golden
char *pngfilename = va("%s"PATHSEP"md2"PATHSEP"%s", srb2home, filename);
@@ -500,8 +504,12 @@ static GrTextureFormat_t PNG_Load(const char *filename, int *w, int *h, GLPatch_
png_FILE = fopen(pngfilename, "rb");
if (!png_FILE)
{
+ pngfilename = va("%s"PATHSEP"md2"PATHSEP"%s", srb2path, filename);
+ FIL_ForceExtension(pngfilename, ".png");
+ png_FILE = fopen(pngfilename, "rb");
//CONS_Debug(DBG_RENDER, "M_SavePNG: Error on opening %s for loading\n", filename);
- return 0;
+ if (!png_FILE)
+ return 0;
}
png_ptr = png_create_read_struct(PNG_LIBPNG_VER_STRING, NULL,
@@ -628,7 +636,13 @@ static GrTextureFormat_t PCX_Load(const char *filename, int *w, int *h,
FIL_ForceExtension(pcxfilename, ".pcx");
file = fopen(pcxfilename, "rb");
if (!file)
- return 0;
+ {
+ pcxfilename = va("%s"PATHSEP"md2"PATHSEP"%s", srb2path, filename);
+ FIL_ForceExtension(pcxfilename, ".pcx");
+ file = fopen(pcxfilename, "rb");
+ if (!file)
+ return 0;
+ }
if (fread(&header, sizeof (PcxHeader), 1, file) != 1)
{
@@ -818,17 +832,22 @@ void HWR_InitMD2(void)
if (!f)
{
- CONS_Printf("%s %s\n", M_GetText("Error while loading kmd2.dat:"), strerror(errno));
- nomd2s = true;
- return;
+ f = fopen(va("%s"PATHSEP"%s", srb2path, "kmd2.dat"), "rt");
+ if (!f)
+ {
+ CONS_Printf("%s %s\n", M_GetText("Error while loading kmd2.dat:"), strerror(errno));
+ nomd2s = true;
+ return;
+ }
}
while (fscanf(f, "%19s %31s %f %f", name, filename, &scale, &offset) == 4)
{
- if (stricmp(name, "PLAY") == 0)
+ /*if (stricmp(name, "PLAY") == 0)
{
CONS_Printf("MD2 for sprite PLAY detected in kmd2.dat, use a player skin instead!\n");
continue;
- }
+ }*/
+ // 8/1/19: Allow PLAY to load for default MD2.
for (i = 0; i < NUMSPRITES; i++)
{
@@ -885,9 +904,13 @@ void HWR_AddPlayerMD2(int skin) // For MD2's that were added after startup
if (!f)
{
- CONS_Printf("Error while loading kmd2.dat\n");
- nomd2s = true;
- return;
+ f = fopen(va("%s"PATHSEP"%s", srb2path, "kmd2.dat"), "rt");
+ if (!f)
+ {
+ CONS_Printf("%s %s\n", M_GetText("Error while loading kmd2.dat:"), strerror(errno));
+ nomd2s = true;
+ return;
+ }
}
// Check for any MD2s that match the names of player skins!
@@ -931,9 +954,13 @@ void HWR_AddSpriteMD2(size_t spritenum) // For MD2s that were added after startu
if (!f)
{
- CONS_Printf("Error while loading kmd2.dat\n");
- nomd2s = true;
- return;
+ f = fopen(va("%s"PATHSEP"%s", srb2path, "kmd2.dat"), "rt");
+ if (!f)
+ {
+ CONS_Printf("%s %s\n", M_GetText("Error while loading kmd2.dat:"), strerror(errno));
+ nomd2s = true;
+ return;
+ }
}
// Check for any MD2s that match the names of player skins!
@@ -963,7 +990,7 @@ spritemd2found:
// (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;
@@ -1181,6 +1208,7 @@ void HWR_DrawMD2(gr_vissprite_t *spr)
// MD2 colormap fix
// colormap test
+ if (spr->mobj->subsector)
{
sector_t *sector = spr->mobj->subsector->sector;
UINT8 lightlevel = 255;
@@ -1212,6 +1240,10 @@ void HWR_DrawMD2(gr_vissprite_t *spr)
else
Surf.FlatColor.rgba = HWR_Lighting(lightlevel, NORMALFOG, FADEFOG, false, false);
}
+ else
+ {
+ Surf.FlatColor.rgba = 0xFFFFFFFF;
+ }
// Look at HWR_ProjectSprite for more
{
@@ -1241,19 +1273,19 @@ void HWR_DrawMD2(gr_vissprite_t *spr)
// 1. load model+texture if not already loaded
// 2. draw model with correct position, rotation,...
- if (spr->mobj->skin && spr->mobj->sprite == SPR_PLAY) // Use the player MD2 list if the mobj has a skin and is using the player sprites
+ if (spr->mobj->skin && spr->mobj->sprite == SPR_PLAY && !md2_playermodels[(skin_t*)spr->mobj->skin-skins].notfound) // Use the player MD2 list if the mobj has a skin and is using the player sprites
{
md2 = &md2_playermodels[(skin_t*)spr->mobj->skin-skins];
md2->skin = (skin_t*)spr->mobj->skin-skins;
}
- else
+ else // if we can't find the player md2, use SPR_PLAY's MD2.
md2 = &md2_models[spr->mobj->sprite];
if (md2->error)
return; // we already failed loading this before :(
if (!md2->model)
{
- //CONS_Debug(DBG_RENDER, "Loading MD2... (%s)", sprnames[spr->mobj->sprite]);
+ CONS_Debug(DBG_RENDER, "Loading MD2... (%s, %s)", sprnames[spr->mobj->sprite], md2->filename);
sprintf(filename, "md2/%s", md2->filename);
md2->model = md2_readModel(filename);
@@ -1286,7 +1318,7 @@ 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)
{
- INT32 skinnum;
+ INT32 skinnum = TC_DEFAULT;
if ((spr->mobj->flags & MF_BOSS) && (spr->mobj->flags2 & MF2_FRET) && (leveltime & 1)) // Bosses "flash"
{
if (spr->mobj->type == MT_CYBRAKDEMON)
@@ -1389,6 +1421,18 @@ void HWR_DrawMD2(gr_vissprite_t *spr)
p.angley = FIXED_TO_FLOAT(anglef);
}
p.anglex = 0.0f;
+ p.anglez = 0.0f;
+ if (spr->mobj->standingslope)
+ {
+ fixed_t tempz = spr->mobj->standingslope->normal.z;
+ fixed_t tempy = spr->mobj->standingslope->normal.y;
+ fixed_t tempx = spr->mobj->standingslope->normal.x;
+ fixed_t tempangle = AngleFixed(R_PointToAngle2(0, 0, FixedSqrt(FixedMul(tempy, tempy) + FixedMul(tempz, tempz)), tempx));
+ p.anglez = FIXED_TO_FLOAT(tempangle);
+ tempangle = -AngleFixed(R_PointToAngle2(0, 0, tempz, tempy));
+ p.anglex = FIXED_TO_FLOAT(tempangle);
+ }
+
color[0] = Surf.FlatColor.s.red;
color[1] = Surf.FlatColor.s.green;
diff --git a/src/hardware/r_opengl/r_opengl-vc10.vcxproj b/src/hardware/r_opengl/r_opengl-vc10.vcxproj
index f04ae320..d1f856e9 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 179dbaad..84835389 100644
--- a/src/hardware/r_opengl/r_opengl.c
+++ b/src/hardware/r_opengl/r_opengl.c
@@ -1,7 +1,7 @@
// Emacs style mode select -*- C++ -*-
//-----------------------------------------------------------------------------
//
-// Copyright (C) 1998-2006 by Sonic Team Junior.
+// Copyright (C) 1998-2018 by Sonic Team Junior.
//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
@@ -112,10 +112,10 @@ static GLint viewport[4];
// These need to start at 0 and be set to their number, and be reset to 0 when deleted so that intel GPUs
// can know when the textures aren't there, as textures are always considered resident in their virtual memory
// TODO: Store them in a more normal way
-#define SCRTEX_SCREENTEXTURE 4294967295
-#define SCRTEX_STARTSCREENWIPE 4294967294
-#define SCRTEX_ENDSCREENWIPE 4294967293
-#define SCRTEX_FINALSCREENTEXTURE 4294967292
+#define SCRTEX_SCREENTEXTURE 4294967295U
+#define SCRTEX_STARTSCREENWIPE 4294967294U
+#define SCRTEX_ENDSCREENWIPE 4294967293U
+#define SCRTEX_FINALSCREENTEXTURE 4294967292U
static GLuint screentexture = 0;
static GLuint startScreenWipe = 0;
static GLuint endScreenWipe = 0;
@@ -602,7 +602,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;
@@ -641,7 +642,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];
@@ -1962,8 +1963,9 @@ static void DrawMD2Ex(INT32 *gl_cmd_buffer, md2_frame_t *frame, INT32 duration,
pglTranslatef(pos->x, pos->z, pos->y);
if (flipped)
scaley = -scaley;
- pglRotatef(pos->angley, 0.0f, -1.0f, 0.0f);
+ pglRotatef(pos->anglez, 0.0f, 0.0f, -1.0f);
pglRotatef(pos->anglex, -1.0f, 0.0f, 0.0f);
+ pglRotatef(pos->angley, 0.0f, -1.0f, 0.0f);
val = *gl_cmd_buffer++;
@@ -1988,7 +1990,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],
@@ -2057,6 +2059,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));
@@ -2073,7 +2076,8 @@ EXPORT void HWRAPI(SetTransform) (FTransform *stransform)
pglMatrixMode(GL_PROJECTION);
pglLoadIdentity();
- special_splitscreen = (stransform->splitscreen == 1 && stransform->fovxangle == 90.0f);
+ fovx90 = stransform->fovxangle > 0.0f && fabsf(stransform->fovxangle - 90.0f) < 0.5f;
+ special_splitscreen = (stransform->splitscreen == 1 && fovx90);
if (special_splitscreen)
GLPerspective(53.13l, 2*ASPECT_RATIO); // 53.13 = 2*atan(0.5)
else
diff --git a/src/hardware/s_openal/s_openal-vc10.vcxproj b/src/hardware/s_openal/s_openal-vc10.vcxproj
index 8b4f6cbb..5039cd00 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 88027c66..a308dfc2 100644
--- a/src/hu_stuff.c
+++ b/src/hu_stuff.c
@@ -2,7 +2,7 @@
//-----------------------------------------------------------------------------
// Copyright (C) 1993-1996 by id Software, Inc.
// Copyright (C) 1998-2000 by DooM Legacy Team.
-// Copyright (C) 1999-2016 by Sonic Team Junior.
+// Copyright (C) 1999-2018 by Sonic Team Junior.
//
// This program is free software distributed under the
// terms of the GNU General Public License, version 2.
@@ -51,6 +51,7 @@
#include "lua_hook.h"
#endif
+#include "s_sound.h" // song credits
#include "k_kart.h"
// coords are scaled
@@ -76,7 +77,7 @@ patch_t *cred_font[CRED_FONTSIZE];
static player_t *plr;
boolean chat_on; // entering a chat message?
static char w_chat[HU_MAXMSGLEN];
-static UINT32 c_input = 0; // let's try to make the chat input less shitty.
+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;
@@ -103,6 +104,8 @@ static patch_t *tokenicon;
// crosshair 0 = off, 1 = cross, 2 = angle, 3 = point, see m_menu.c
static patch_t *crosshair[HU_CROSSHAIRS]; // 3 precached crosshair graphics
+// song credits
+static patch_t *songcreditbg;
// -------
// protos.
@@ -290,6 +293,8 @@ void HU_LoadGraphics(void)
tinyemeraldpics[4] = W_CachePatchName("TEMER5", PU_HUDGFX);
tinyemeraldpics[5] = W_CachePatchName("TEMER6", PU_HUDGFX);
tinyemeraldpics[6] = W_CachePatchName("TEMER7", PU_HUDGFX);
+
+ songcreditbg = W_CachePatchName("K_SONGCR", PU_HUDGFX);
}
// Initialise Heads up
@@ -342,30 +347,30 @@ 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 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 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 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.
+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 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
- UINT32 i;
+ size_t i;
for(i=0;i= CHAT_BUFSIZE)
+ if (chat_nummsg_log >= CHAT_BUFSIZE) // too many messages!
HU_removeChatText_Log();
strcpy(chat_log[chat_nummsg_log], text);
@@ -402,12 +409,18 @@ void HU_AddChatText(const char *text, boolean playsound)
chat_timers[chat_nummsg_min] = TICRATE*cv_chattime.value;
chat_nummsg_min++;
- if (OLDCHAT) // if we're using oldchat, print directly in console
+ if (OLDCHAT) // if we're using oldchat, print directly in console
CONS_Printf("%s\n", text);
else // if we aren't, still save the message to log.txt
CON_LogMessage(va("%s\n", text));
+#else
+ (void)playsound;
+ CONS_Printf("%s\n", text);
+#endif
}
+#ifndef NONET
+
/** Runs a say command, sending an ::XD_SAY message.
* A say command consists of a signed 8-bit integer for the target, an
* unsigned 8-bit flag variable, and then the message itself.
@@ -426,6 +439,7 @@ void HU_AddChatText(const char *text, boolean playsound)
* \sa Command_Say_f, Command_Sayteam_f, Command_Sayto_f, Got_Saycmd
* \author Graue
*/
+
static void DoSayCommand(SINT8 target, size_t usedargs, UINT8 flags)
{
XBOXSTATIC char buf[254];
@@ -436,7 +450,7 @@ static void DoSayCommand(SINT8 target, size_t usedargs, UINT8 flags)
numwords = COM_Argc() - usedargs;
I_Assert(numwords > 0);
- if (CHAT_MUTE) // TODO: Per Player mute.
+ if (CHAT_MUTE) // TODO: Per Player mute.
{
HU_AddChatText(va("%s>ERROR: The chat is muted. You can't say anything.", "\x85"), false);
return;
@@ -462,14 +476,14 @@ static void DoSayCommand(SINT8 target, size_t usedargs, UINT8 flags)
strlcat(msg, COM_Argv(ix + usedargs), msgspace);
}
- if (strlen(msg) > 4 && strnicmp(msg, "/pm", 3) == 0) // used /pm
+ if (strlen(msg) > 4 && strnicmp(msg, "/pm", 3) == 0) // used /pm
{
// what we're gonna do now is check if the node exists
// with that logic, characters 4 and 5 are our numbers:
const char *newmsg;
- int spc = 1; // used if nodenum[1] is a space.
+ INT32 spc = 1; // used if nodenum[1] is a space.
char *nodenum = (char*) malloc(3);
- strncpy(nodenum, msg+3, 5);
+ strncpy(nodenum, msg+3, 3);
// check for undesirable characters in our "number"
if (((nodenum[0] < '0') || (nodenum[0] > '9')) || ((nodenum[1] < '0') || (nodenum[1] > '9')))
{
@@ -480,6 +494,7 @@ static void DoSayCommand(SINT8 target, size_t usedargs, UINT8 flags)
else
{
HU_AddChatText("\x82NOTICE: \x80Invalid command format. Correct format is \'/pm \'.", false);
+ free(nodenum);
return;
}
}
@@ -489,24 +504,26 @@ static void DoSayCommand(SINT8 target, size_t usedargs, UINT8 flags)
if (msg[5] != ' ')
{
HU_AddChatText("\x82NOTICE: \x80Invalid command format. Correct format is \'/pm \'.", false);
+ free(nodenum);
return;
}
}
- target = atoi((const char*) nodenum); // turn that into a number
+ target = atoi((const char*) nodenum); // turn that into a number
+ free(nodenum);
//CONS_Printf("%d\n", target);
// check for target player, if it doesn't exist then we can't send the message!
- if (playeringame[target]) // player exists
- target++; // even though playernums are from 0 to 31, target is 1 to 32, so up that by 1 to have it work!
+ if (target < MAXPLAYERS && playeringame[target]) // player exists
+ target++; // even though playernums are from 0 to 31, target is 1 to 32, so up that by 1 to have it work!
else
{
- HU_AddChatText(va("\x82NOTICE: \x80Player %d does not exist.", target), false); // same
+ HU_AddChatText(va("\x82NOTICE: \x80Player %d does not exist.", target), false); // same
return;
}
buf[0] = target;
newmsg = msg+5+spc;
- memcpy(msg, newmsg, 252);
+ strlcpy(msg, newmsg, 252);
}
SendNetXCmd(XD_SAY, buf, strlen(msg) + 1 + msg-buf);
@@ -595,7 +612,7 @@ static void Command_CSay_f(void)
DoSayCommand(0, 1, HU_CSAY);
}
-static tic_t stop_spamming_you_cunt[MAXPLAYERS];
+static tic_t stop_spamming[MAXPLAYERS];
/** Receives a message, processing an ::XD_SAY command.
* \sa DoSayCommand
@@ -609,7 +626,7 @@ static void Got_Saycmd(UINT8 **p, INT32 playernum)
char *msg;
boolean action = false;
char *ptr;
- int spam_eatmsg = 0;
+ INT32 spam_eatmsg = 0;
CONS_Debug(DBG_NETPLAY,"Received SAY cmd from Player %d (%s)\n", playernum+1, player_names[playernum]);
@@ -658,15 +675,15 @@ static void Got_Saycmd(UINT8 **p, INT32 playernum)
// before we do anything, let's verify the guy isn't spamming, get this easier on us.
- //if (stop_spamming_you_cunt[playernum] != 0 && cv_chatspamprotection.value && !(flags & HU_CSAY))
- if (stop_spamming_you_cunt[playernum] != 0 && consoleplayer != playernum && cv_chatspamprotection.value && !(flags & HU_CSAY))
+ //if (stop_spamming[playernum] != 0 && cv_chatspamprotection.value && !(flags & HU_CSAY))
+ if (stop_spamming[playernum] != 0 && consoleplayer != playernum && cv_chatspamprotection.value && !(flags & HU_CSAY))
{
CONS_Debug(DBG_NETPLAY,"Received SAY cmd too quickly from Player %d (%s), assuming as spam and blocking message.\n", playernum+1, player_names[playernum]);
- stop_spamming_you_cunt[playernum] = 4;
+ stop_spamming[playernum] = 4;
spam_eatmsg = 1;
}
else
- stop_spamming_you_cunt[playernum] = 4; // you can hold off for 4 tics, can you?
+ stop_spamming[playernum] = 4; // you can hold off for 4 tics, can you?
// run the lua hook even if we were supposed to eat the msg, netgame consistency goes first.
@@ -676,7 +693,7 @@ static void Got_Saycmd(UINT8 **p, INT32 playernum)
#endif
if (spam_eatmsg)
- return; // don't proceed if we were supposed to eat the message.
+ return; // don't proceed if we were supposed to eat the message.
// If it's a CSAY, just CECHO and be done with it.
if (flags & HU_CSAY)
@@ -726,7 +743,7 @@ static void Got_Saycmd(UINT8 **p, INT32 playernum)
cstart = "\x86"; // grey name
textcolor = "\x86";
}
- else if (target == -1) // say team
+ else if (target == -1) // say team
{
if (players[playernum].ctfteam == 1) // red
{
@@ -742,6 +759,9 @@ static void Got_Saycmd(UINT8 **p, INT32 playernum)
else
{
const UINT8 color = players[playernum].skincolor;
+
+ cstart = "\x83";
+
if (color <= SKINCOLOR_SILVER || color == SKINCOLOR_SLATE)
cstart = "\x80"; // white
else if (color <= SKINCOLOR_BLACK || color == SKINCOLOR_JET)
@@ -823,9 +843,8 @@ static void Got_Saycmd(UINT8 **p, INT32 playernum)
else if (players[playernum].ctfteam == 2) // blue
prefix = "\x84[TEAM]";
else
- prefix = "\x83"; // makes sure this doesn't implode if you sayteam on non-team gamemodes
+ prefix = "\x83"; // makes sure this doesn't implode if you sayteam on non-team gamemodes
- fmt = "\3%s<%s%s>\x80%s %s%s\n";
fmt2 = "%s<%s%s>\x80%s %s%s";
}*/
@@ -843,7 +862,6 @@ static void Got_Saycmd(UINT8 **p, INT32 playernum)
CONS_Printf("Dropped chat: %d %d %s\n", playernum, target, msg);
#endif
}
-#endif
// Handles key input and string input
//
@@ -857,25 +875,24 @@ static inline boolean HU_keyInChatString(char *s, char ch)
l = strlen(s);
if (l < HU_MAXMSGLEN - 1)
{
- if (c_input >= strlen(s)) // don't do anything complicated
+ if (c_input >= strlen(s)) // don't do anything complicated
{
s[l++] = ch;
s[l]=0;
}
else
{
-
// move everything past c_input for new characters:
- UINT32 m = HU_MAXMSGLEN-1;
- for (;(m>=c_input);m--)
+ size_t m = HU_MAXMSGLEN-1;
+ while (m>=c_input)
{
if (s[m])
s[m+1] = (s[m]);
-
- if (m < 1)
- break; // fix the chat going ham if your replace the first character. (For whatever reason this didn't happen in vanilla????)
+ if (m == 0) // prevent overflow
+ break;
+ m--;
}
- s[c_input] = ch; // and replace this.
+ s[c_input] = ch; // and replace this.
}
c_input++;
return true;
@@ -884,10 +901,11 @@ static inline boolean HU_keyInChatString(char *s, char ch)
}
else if (ch == KEY_BACKSPACE)
{
- size_t i;
+ size_t i = c_input;
+
if (c_input <= 0)
return false;
- i = c_input;
+
if (!s[i-1])
return false;
@@ -910,6 +928,8 @@ static inline boolean HU_keyInChatString(char *s, char ch)
return true; // ate the key
}
+#endif
+
//
//
void HU_Ticker(void)
@@ -926,10 +946,34 @@ void HU_Ticker(void)
hu_showscores = false;
}
+#ifndef NONET
static boolean teamtalk = false;
+/*static char chatchars[QUEUESIZE];
+static INT32 head = 0, tail = 0;*/
// WHY DO YOU OVERCOMPLICATE EVERYTHING?????????
+// Clear spaces so we don't end up with messages only made out of emptiness
+static boolean HU_clearChatSpaces(void)
+{
+ size_t i = 0; // Used to just check our message
+ char c; // current character we're iterating.
+ boolean nothingbutspaces = true;
+
+ for (; i < strlen(w_chat); i++) // iterate through message and eradicate all spaces that don't belong.
+ {
+ c = w_chat[i];
+ if (!c)
+ break; // if there's nothing, it's safe to assume our message has ended, so let's not waste any more time here.
+
+ if (c != ' ') // Isn't a space
+ {
+ nothingbutspaces = false;
+ }
+ }
+ return nothingbutspaces;
+}
+
//
//
static void HU_queueChatChar(INT32 c)
@@ -938,10 +982,14 @@ static void HU_queueChatChar(INT32 c)
if (c == KEY_ENTER)
{
char buf[2+256];
- size_t ci = 2;
char *msg = &buf[2];
size_t i;
+ size_t ci = 2;
INT32 target = 0;
+
+ if (HU_clearChatSpaces()) // Avoids being able to send empty messages, or something.
+ return; // If this returns true, that means our message was NOTHING but spaces, so don't send it period.
+
do {
c = w_chat[-2+ci++];
if (!c || (c >= ' ' && !(c & 0x80))) // copy printable characters and terminating '\0' only.
@@ -953,6 +1001,11 @@ static void HU_queueChatChar(INT32 c)
c_input = 0;
+ for (;(i 4 && strnicmp(msg, "/pm", 3) == 0) // used /pm
+ if (strlen(msg) > 4 && strnicmp(msg, "/pm", 3) == 0) // used /pm
{
- int spc;
- char *nodenum;
+ INT32 spc = 1; // used if nodenum[1] is a space.
+ char *nodenum = (char*) malloc(3);
const char *newmsg;
+
// what we're gonna do now is check if the node exists
// with that logic, characters 4 and 5 are our numbers:
@@ -975,9 +1029,8 @@ static void HU_queueChatChar(INT32 c)
return;
}
- spc = 1; // used if nodenum[1] is a space.
- nodenum = (char*) malloc(3);
- strncpy(nodenum, msg+3, 5);
+ strncpy(nodenum, msg+3, 3);
+
// check for undesirable characters in our "number"
if (((nodenum[0] < '0') || (nodenum[0] > '9')) || ((nodenum[1] < '0') || (nodenum[1] > '9')))
{
@@ -988,6 +1041,7 @@ static void HU_queueChatChar(INT32 c)
else
{
HU_AddChatText("\x82NOTICE: \x80Invalid command format. Correct format is \'/pm \'.", false);
+ free(nodenum);
return;
}
}
@@ -997,24 +1051,27 @@ static void HU_queueChatChar(INT32 c)
if (msg[5] != ' ')
{
HU_AddChatText("\x82NOTICE: \x80Invalid command format. Correct format is \'/pm \'.", false);
+ free(nodenum);
return;
}
}
- target = atoi((const char*) nodenum); // turn that into a number
+ target = atoi((const char*) nodenum); // turn that into a number
+ free(nodenum);
//CONS_Printf("%d\n", target);
// check for target player, if it doesn't exist then we can't send the message!
- if (playeringame[target]) // player exists
- target++; // even though playernums are from 0 to 31, target is 1 to 32, so up that by 1 to have it work!
+ if (target < MAXPLAYERS && playeringame[target]) // player exists
+ target++; // even though playernums are from 0 to 31, target is 1 to 32, so up that by 1 to have it work!
else
{
- HU_AddChatText(va("\x82NOTICE: \x80Player %d does not exist.", target), false); // same
+ HU_AddChatText(va("\x82NOTICE: \x80Player %d does not exist.", target), false); // same
return;
}
+
// we need to get rid of the /pm
newmsg = msg+5+spc;
- memcpy(msg, newmsg, 255);
+ strlcpy(msg, newmsg, 255);
}
if (ci > 3) // don't send target+flags+empty message.
{
@@ -1029,18 +1086,23 @@ static void HU_queueChatChar(INT32 c)
return;
}
}
+#endif
void HU_clearChatChars(void)
{
size_t i = 0;
for (;idata1;
// capslock (now handled outside of chat on so that it works everytime......)
- if (c && c == KEY_CAPSLOCK) // it's a toggle.
+ if (c && c == KEY_CAPSLOCK) // it's a toggle.
{
if (capslock)
capslock = false;
@@ -1086,16 +1148,18 @@ boolean HU_Responder(event_t *ev)
return true;
}
+#ifndef NONET
if (!chat_on)
{
// enter chat mode
if ((ev->data1 == gamecontrol[gc_talkkey][0] || ev->data1 == gamecontrol[gc_talkkey][1])
- && netgame && !OLD_MUTE) // check for old chat mute, still let the players open the chat incase they want to scroll otherwise.
+ && netgame && !OLD_MUTE) // check for old chat mute, still let the players open the chat incase they want to scroll otherwise.
{
chat_on = true;
w_chat[0] = 0;
teamtalk = false;
chat_scrollmedown = true;
+ typelines = 1;
return true;
}
if ((ev->data1 == gamecontrol[gc_teamkey][0] || ev->data1 == gamecontrol[gc_teamkey][1])
@@ -1105,6 +1169,7 @@ boolean HU_Responder(event_t *ev)
w_chat[0] = 0;
teamtalk = G_GametypeHasTeams(); // Don't teamtalk if we don't have teams.
chat_scrollmedown = true;
+ typelines = 1;
return true;
}
}
@@ -1119,6 +1184,12 @@ boolean HU_Responder(event_t *ev)
|| ev->data1 == KEY_LALT || ev->data1 == KEY_RALT)
return true;
+ // Ignore non-keyboard keys, except when the talk key is bound
+ if (ev->data1 >= KEY_MOUSE1
+ && (ev->data1 != gamecontrol[gc_talkkey][0]
+ && ev->data1 != gamecontrol[gc_talkkey][1]))
+ return false;
+
c = (INT32)ev->data1;
// I know this looks very messy but this works. If it ain't broke, don't fix it!
@@ -1151,27 +1222,29 @@ boolean HU_Responder(event_t *ev)
if (chatlen+pastelen > HU_MAXMSGLEN)
return true; // we can't paste this!!
- if (c_input >= strlen(w_chat)) // add it at the end of the string.
+ if (c_input >= strlen(w_chat)) // add it at the end of the string.
{
- memcpy(&w_chat[chatlen], paste, pastelen); // copy all of that.
+ memcpy(&w_chat[chatlen], paste, pastelen); // copy all of that.
c_input += pastelen;
/*size_t i = 0;
for (;i=c_input;i--)
+ while (i >= c_input)
{
if (w_chat[i])
w_chat[i+pastelen] = w_chat[i];
-
+ if (i == 0) // prevent overflow
+ break;
+ i--;
}
- memcpy(&w_chat[c_input], paste, pastelen); // copy all of that.
+ memcpy(&w_chat[c_input], paste, pastelen); // copy all of that.
c_input += pastelen;
return true;
}
@@ -1184,7 +1257,7 @@ boolean HU_Responder(event_t *ev)
if (c == KEY_ENTER)
{
chat_on = false;
- c_input = 0; // reset input cursor
+ c_input = 0; // reset input cursor
chat_scrollmedown = true; // you hit enter, so you might wanna autoscroll to see what you just sent. :)
}
else if (c == KEY_ESCAPE
@@ -1193,9 +1266,9 @@ boolean HU_Responder(event_t *ev)
&& c >= KEY_MOUSE1)) // If it's not a keyboard key, then the chat button is used as a toggle.
{
chat_on = false;
- c_input = 0; // reset input cursor
+ c_input = 0; // reset input cursor
}
- else if ((c == KEY_UPARROW || c == KEY_MOUSEWHEELUP) && chat_scroll > 0 && !OLDCHAT) // CHAT SCROLLING YAYS!
+ else if ((c == KEY_UPARROW || c == KEY_MOUSEWHEELUP) && chat_scroll > 0 && !OLDCHAT) // CHAT SCROLLING YAYS!
{
chat_scroll--;
justscrolledup = true;
@@ -1207,12 +1280,14 @@ boolean HU_Responder(event_t *ev)
justscrolleddown = true;
chat_scrolltime = 4;
}
- else if (c == KEY_LEFTARROW && c_input != 0 && !OLDCHAT) // i said go back
+ else if (c == KEY_LEFTARROW && c_input != 0 && !OLDCHAT) // i said go back
c_input--;
- else if (c == KEY_RIGHTARROW && c_input < strlen(w_chat) && !OLDCHAT) // don't need to check for admin or w/e here since the chat won't ever contain anything if it's muted.
+ else if (c == KEY_RIGHTARROW && c_input < strlen(w_chat) && !OLDCHAT) // don't need to check for admin or w/e here since the chat won't ever contain anything if it's muted.
c_input++;
return true;
}
+#endif
+
return false;
}
@@ -1220,17 +1295,19 @@ boolean HU_Responder(event_t *ev)
// HEADS UP DRAWING
//======================================================================
+#ifndef NONET
+
// Precompile a wordwrapped string to any given width.
// This is a muuuch better method than V_WORDWRAP.
// again stolen and modified a bit from video.c, don't mind me, will need to rearrange this one day.
// this one is simplified for the chat drawer.
static char *CHAT_WordWrap(INT32 x, INT32 w, INT32 option, const char *string)
{
- int c;
+ INT32 c;
size_t chw, i, lastusablespace = 0;
size_t slen;
char *newstring = Z_StrDup(string);
- INT32 charwidth = 4;
+ INT32 spacewidth = (vid.width < 640) ? 8 : 4, charwidth = (vid.width < 640) ? 8 : 4;
slen = strlen(string);
x = 0;
@@ -1254,7 +1331,7 @@ static char *CHAT_WordWrap(INT32 x, INT32 w, INT32 option, const char *string)
if (c < 0 || c >= HU_FONTSIZE || !hu_font[c])
{
- chw = charwidth;
+ chw = spacewidth;
lastusablespace = i;
}
else
@@ -1274,9 +1351,10 @@ static char *CHAT_WordWrap(INT32 x, INT32 w, INT32 option, const char *string)
return newstring;
}
+
// 30/7/18: chaty is now the distance at which the lowest point of the chat will be drawn if that makes any sense.
-INT16 chatx = 13, chaty = 169; // let's use this as our coordinates, shh
+INT16 chatx = 13, chaty = 169; // let's use this as our coordinates, shh
// chat stuff by VincyTM LOL XD!
@@ -1289,14 +1367,14 @@ static void HU_drawMiniChat(void)
INT32 boxw = cv_chatwidth.value;
INT32 dx = 0, dy = 0;
size_t i = chat_nummsg_min;
- boolean prev_linereturn = false; // a hack to prevent double \n while I have no idea why they happen in the first place.
+ boolean prev_linereturn = false; // a hack to prevent double \n while I have no idea why they happen in the first place.
INT32 msglines = 0;
// process all messages once without rendering anything or doing anything fancy so that we know how many lines each message has...
INT32 y;
if (!chat_nummsg_min)
- return; // needless to say it's useless to do anything if we don't have anything to draw.
+ return; // needless to say it's useless to do anything if we don't have anything to draw.
if (splitscreen > 1)
boxw = max(64, boxw/2);
@@ -1307,11 +1385,11 @@ static void HU_drawMiniChat(void)
size_t j = 0;
INT32 linescount = 0;
- while(msg[j]) // iterate through msg
+ while(msg[j]) // iterate through msg
{
- if (msg[j] < HU_FONTSTART) // don't draw
+ if (msg[j] < HU_FONTSTART) // don't draw
{
- if (msg[j] == '\n') // get back down.
+ if (msg[j] == '\n') // get back down.
{
++j;
if (!prev_linereturn)
@@ -1349,6 +1427,7 @@ static void HU_drawMiniChat(void)
y = chaty - charheight*(msglines+1);
+#ifdef NETSPLITSCREEN
if (splitscreen)
{
y -= BASEVIDHEIGHT/2;
@@ -1356,6 +1435,7 @@ static void HU_drawMiniChat(void)
y += 16;
}
else
+#endif
y -= (cv_kartspeedometer.value ? 16 : 0);
dx = 0;
@@ -1363,20 +1443,20 @@ static void HU_drawMiniChat(void)
i = 0;
prev_linereturn = false;
- for (; i<=(chat_nummsg_min-1); i++) // iterate through our hot messages
+ for (; i<=(chat_nummsg_min-1); i++) // iterate through our hot messages
{
INT32 clrflag = 0;
- INT32 timer = ((cv_chattime.value*TICRATE)-chat_timers[i]) - cv_chattime.value*TICRATE+9; // see below...
- INT32 transflag = (timer >= 0 && timer <= 9) ? (timer*V_10TRANS) : 0; // you can make bad jokes out of this one.
+ INT32 timer = ((cv_chattime.value*TICRATE)-chat_timers[i]) - cv_chattime.value*TICRATE+9; // see below...
+ INT32 transflag = (timer >= 0 && timer <= 9) ? (timer*V_10TRANS) : 0; // you can make bad jokes out of this one.
size_t j = 0;
- const char *msg = CHAT_WordWrap(x+2, boxw-(charwidth*2), V_SNAPTOBOTTOM|V_SNAPTOLEFT|V_ALLOWLOWERCASE, chat_mini[i]); // get the current message, and word wrap it.
+ const char *msg = CHAT_WordWrap(x+2, boxw-(charwidth*2), V_SNAPTOBOTTOM|V_SNAPTOLEFT|V_ALLOWLOWERCASE, chat_mini[i]); // get the current message, and word wrap it.
UINT8 *colormap = NULL;
- while(msg[j]) // iterate through msg
+ while(msg[j]) // iterate through msg
{
- if (msg[j] < HU_FONTSTART) // don't draw
+ if (msg[j] < HU_FONTSTART) // don't draw
{
- if (msg[j] == '\n') // get back down.
+ if (msg[j] == '\n') // get back down.
{
++j;
if (!prev_linereturn)
@@ -1399,7 +1479,7 @@ static void HU_drawMiniChat(void)
}
else
{
- if (cv_chatbacktint.value) // on request of wolfy
+ if (cv_chatbacktint.value) // on request of wolfy
V_DrawFillConsoleMap(x + dx + 2, y+dy, charwidth, charheight, 239|V_SNAPTOBOTTOM|V_SNAPTOLEFT);
V_DrawChatCharacter(x + dx + 2, y+dy, msg[j++] |V_SNAPTOBOTTOM|V_SNAPTOLEFT|transflag, !cv_allcaps.value, colormap);
@@ -1423,7 +1503,6 @@ static void HU_drawMiniChat(void)
}
// HU_DrawChatLog
-// TODO: fix dumb word wrapping issues
static void HU_drawChatLog(INT32 offset)
{
@@ -1439,15 +1518,18 @@ static void HU_drawChatLog(INT32 offset)
if (chat_scroll > chat_maxscroll)
chat_scroll = chat_maxscroll;
+#ifdef NETSPLITSCREEN
if (splitscreen)
{
boxh = max(6, boxh/2);
if (splitscreen > 1)
boxw = max(64, boxw/2);
}
+#endif
y = chaty - offset*charheight - (chat_scroll*charheight) - boxh*charheight - 12;
+#ifdef NETSPLITSCREEN
if (splitscreen)
{
y -= BASEVIDHEIGHT/2;
@@ -1455,24 +1537,26 @@ static void HU_drawChatLog(INT32 offset)
y += 16;
}
else
+#endif
y -= (cv_kartspeedometer.value ? 16 : 0);
+
chat_topy = y + chat_scroll*charheight;
chat_bottomy = chat_topy + boxh*charheight;
- V_DrawFillConsoleMap(chatx, chat_topy, boxw, boxh*charheight +2, 239|V_SNAPTOBOTTOM|V_SNAPTOLEFT); // log box
+ V_DrawFillConsoleMap(chatx, chat_topy, boxw, boxh*charheight +2, 239|V_SNAPTOBOTTOM|V_SNAPTOLEFT); // log box
- for (i=0; i= chat_topy) && (y+dy < (chat_bottomy)))
V_DrawChatCharacter(x + dx + 2, y+dy+2, msg[j++] |V_SNAPTOBOTTOM|V_SNAPTOLEFT, !cv_allcaps.value, colormap);
else
- j++; // don't forget to increment this or we'll get stuck in the limbo.
+ j++; // don't forget to increment this or we'll get stuck in the limbo.
}
dx += charwidth;
@@ -1508,14 +1592,15 @@ static void HU_drawChatLog(INT32 offset)
dx = 0;
}
- if (((chat_scroll >= chat_maxscroll) || (chat_scrollmedown)) && !(justscrolleddown || justscrolledup || chat_scrolltime)) // was already at the bottom of the page before new maxscroll calculation and was NOT scrolling.
+
+ if (((chat_scroll >= chat_maxscroll) || (chat_scrollmedown)) && !(justscrolleddown || justscrolledup || chat_scrolltime)) // was already at the bottom of the page before new maxscroll calculation and was NOT scrolling.
{
- atbottom = true; // we should scroll
+ atbottom = true; // we should scroll
}
chat_scrollmedown = false;
// getmaxscroll through a lazy hack. We do all these loops, so let's not do more loops that are gonna lag the game more. :P
- chat_maxscroll = (dy/charheight); // welcome to C, we don't know what min() and max() are.
+ chat_maxscroll = (dy/charheight); // welcome to C, we don't know what min() and max() are.
if (chat_maxscroll <= (UINT32)boxh)
chat_maxscroll = 0;
else
@@ -1526,17 +1611,10 @@ static void HU_drawChatLog(INT32 offset)
chat_scroll = chat_maxscroll;
// draw arrows to indicate that we can (or not) scroll.
-
if (chat_scroll > 0)
- {
- V_DrawCharacter(chatx-9, ((justscrolledup) ? (chat_topy-1) : (chat_topy)),
- '\x1A' | V_SNAPTOBOTTOM | V_SNAPTOLEFT | highlight, false); // up arrow
- }
+ V_DrawThinString(chatx-9, ((justscrolledup) ? (chat_topy-1) : (chat_topy)), V_SNAPTOBOTTOM | V_SNAPTOLEFT | highlight, "\x1A"); // up arrow
if (chat_scroll < chat_maxscroll)
- {
- V_DrawCharacter(chatx-9, chat_bottomy-((justscrolleddown) ? 5 : 6),
- '\x1B' | V_SNAPTOBOTTOM | V_SNAPTOLEFT | highlight, false); // down arrow
- }
+ V_DrawThinString(chatx-9, chat_bottomy-((justscrolleddown) ? 5 : 6), V_SNAPTOBOTTOM | V_SNAPTOLEFT | highlight, "\x1B"); // down arrow
justscrolleddown = false;
justscrolledup = false;
@@ -1548,18 +1626,18 @@ static void HU_drawChatLog(INT32 offset)
// Draw chat input
//
-static INT16 typelines = 1; // number of drawfill lines we need. it's some weird hack and might be one frame off but I'm lazy to make another loop.
static void HU_DrawChat(void)
{
INT32 charwidth = 4, charheight = 6;
INT32 boxw = cv_chatwidth.value;
INT32 t = 0, c = 0, y = chaty - (typelines*charheight);
- UINT32 i = 0, saylen = strlen(w_chat); // You learn new things everyday!
+ UINT32 i = 0, saylen = strlen(w_chat); // You learn new things everyday!
INT32 cflag = 0;
const char *ntalk = "Say: ", *ttalk = "Team: ";
const char *talk = ntalk;
const char *mute = "Chat has been muted.";
+#ifdef NETSPLITSCREEN
if (splitscreen)
{
y -= BASEVIDHEIGHT/2;
@@ -1570,6 +1648,7 @@ static void HU_DrawChat(void)
}
}
else
+#endif
y -= (cv_kartspeedometer.value ? 16 : 0);
if (teamtalk)
@@ -1587,7 +1666,7 @@ static void HU_DrawChat(void)
{
talk = mute;
typelines = 1;
- cflag = V_GRAYMAP; // set text in gray if chat is muted.
+ cflag = V_GRAYMAP; // set text in gray if chat is muted.
}
V_DrawFillConsoleMap(chatx, y-1, boxw, (typelines*charheight), 239 | V_SNAPTOBOTTOM | V_SNAPTOLEFT);
@@ -1605,7 +1684,7 @@ static void HU_DrawChat(void)
c += charwidth;
}
- // if chat is muted, just draw the log and get it over with:
+ // if chat is muted, just draw the log and get it over with, no need to draw anything else.
if (CHAT_MUTE)
{
HU_drawChatLog(0);
@@ -1623,17 +1702,16 @@ static void HU_DrawChat(void)
boolean skippedline = false;
if (c_input == (i+1))
{
- int cursorx = (c+charwidth < boxw-charwidth) ? (chatx + 2 + c+charwidth) : (chatx+1); // we may have to go down.
- int cursory = (cursorx != chatx+1) ? (y) : (y+charheight);
+ INT32 cursorx = (c+charwidth < boxw-charwidth) ? (chatx + 2 + c+charwidth) : (chatx+1); // we may have to go down.
+ INT32 cursory = (cursorx != chatx+1) ? (y) : (y+charheight);
if (hu_tick < 4)
V_DrawChatCharacter(cursorx, cursory+1, '_' |V_SNAPTOBOTTOM|V_SNAPTOLEFT|t, !cv_allcaps.value, NULL);
- if (cursorx == chatx+1 && saylen == i) // a weirdo hack
+ if (cursorx == chatx+1 && saylen == i) // a weirdo hack
{
typelines += 1;
skippedline = true;
}
-
}
//Hurdler: isn't it better like that?
@@ -1651,11 +1729,12 @@ static void HU_DrawChat(void)
}
}
- // handle /pm list.
- if (strnicmp(w_chat, "/pm", 3) == 0 && vid.width >= 400 && !teamtalk) // 320x200 unsupported kthxbai
+ // handle /pm list. It's messy, horrible and I don't care.
+ if (strnicmp(w_chat, "/pm", 3) == 0 && vid.width >= 400 && !teamtalk) // 320x200 unsupported kthxbai
{
INT32 count = 0;
INT32 p_dispy = chaty - charheight -1;
+#ifdef NETSPLITSCREEN
if (splitscreen)
{
p_dispy -= BASEVIDHEIGHT/2;
@@ -1663,7 +1742,9 @@ static void HU_DrawChat(void)
p_dispy += 16;
}
else
+#endif
p_dispy -= (cv_kartspeedometer.value ? 16 : 0);
+
i = 0;
for(i=0; (isource);
+ len = V_ThinStringWidth(str, V_ALLOWLOWERCASE|V_6WIDTHSPACE);
+ destx = (len+7);
+
+ if (cursongcredit.anim)
+ {
+ if (cursongcredit.trans > 0)
+ cursongcredit.trans--;
+ if (cursongcredit.x < destx)
+ cursongcredit.x += (destx - cursongcredit.x) / 2;
+ if (cursongcredit.x > destx)
+ cursongcredit.x = destx;
+ cursongcredit.anim--;
+ }
+ else
+ {
+ if (cursongcredit.trans < NUMTRANSMAPS)
+ cursongcredit.trans++;
+ if (cursongcredit.x > 0)
+ cursongcredit.x /= 2;
+ if (cursongcredit.x < 0)
+ cursongcredit.x = 0;
+ }
+
+ bgt = (NUMTRANSMAPS/2)+(cursongcredit.trans/2);
+ if (bgt < NUMTRANSMAPS)
+ V_DrawScaledPatch(cursongcredit.x, y-2, V_SNAPTOLEFT|(bgt< 0)
- stop_spamming_you_cunt[i]--;
+ if (stop_spamming[i] > 0)
+ stop_spamming[i]--;
}
// handle chat timers
@@ -2096,6 +2222,7 @@ void HU_Drawer(void)
HU_removeChatText_Mini();
}
}
+#endif
if (cechotimer)
HU_DrawCEcho();
@@ -2144,6 +2271,10 @@ void HU_Drawer(void)
HU_DrawCrosshair4();
}*/
+ // draw song credits
+ if (cv_songcredits.value)
+ HU_DrawSongCredits();
+
// draw desynch text
if (hu_resynching)
{
@@ -2197,9 +2328,9 @@ void HU_Erase(void)
// clear the message lines that go away, so use _oldclearlines_
bottomline = oldclearlines;
oldclearlines = con_clearlines;
- if (chat_on)
+ if (chat_on && OLDCHAT)
if (bottomline < 8)
- bottomline = 8;
+ bottomline = 8; // only do it for consolechat. consolechat is gay.
if (automapactive || viewwindowx == 0) // hud msgs don't need to be cleared
return;
@@ -2240,11 +2371,12 @@ void HU_Erase(void)
//
void HU_drawPing(INT32 x, INT32 y, INT32 ping, boolean notext)
{
- UINT8 numbars = 1; // how many ping bars do we draw?
- UINT8 barcolor = 128; // color we use for the bars (green, yellow or red)
+ UINT8 numbars = 1; // how many ping bars do we draw?
+ UINT8 barcolor = 128; // color we use for the bars (green, yellow or red)
SINT8 i = 0;
SINT8 yoffset = 6;
- INT32 dx;
+ INT32 dx = x+1 - (V_SmallStringWidth(va("%dms", ping), V_ALLOWLOWERCASE)/2);
+
if (ping < 128)
{
numbars = 3;
@@ -2252,15 +2384,14 @@ void HU_drawPing(INT32 x, INT32 y, INT32 ping, boolean notext)
}
else if (ping < 256)
{
- numbars = 2; // Apparently ternaries w/ multiple statements don't look good in C so I decided against it.
+ numbars = 2; // Apparently ternaries w/ multiple statements don't look good in C so I decided against it.
barcolor = 103;
}
- dx = x+1 - (V_SmallStringWidth(va("%dms", ping), V_ALLOWLOWERCASE)/2);
- if (!notext || vid.width >= 640) // how sad, we're using a shit resolution.
+ if (!notext || vid.width >= 640) // how sad, we're using a shit resolution.
V_DrawSmallString(dx, y+4, V_ALLOWLOWERCASE, va("%dms", ping));
- for (i=0; (i<3); i++) // Draw the ping bar
+ for (i=0; (i<3); i++) // Draw the ping bar
{
V_DrawFill(x+2 *(i-1), y+yoffset-4, 2, 8-yoffset, 31);
if (i < numbars)
@@ -2281,13 +2412,50 @@ void HU_drawPing(INT32 x, INT32 y, INT32 ping, boolean notext)
{
INT32 i,x,y;
INT32 redplayers = 0, blueplayers = 0;
+ boolean smol = false;
const UINT8 *colormap;
char name[MAXPLAYERNAME+1];
+ // before we draw, we must count how many players are in each team. It makes an additional loop, but we need to know if we have to draw a big or a small ranking.
+ for (i = 0; i < MAXPLAYERS; i++)
+ {
+ if (players[tab[i].num].spectator)
+ continue; //ignore them.
+
+ if (tab[i].color == skincolor_redteam) //red
+ {
+ if (redplayers++ > 8)
+ {
+ smol = true;
+ break; // don't make more loops than we need to.
+ }
+ }
+ else if (tab[i].color == skincolor_blueteam) //blue
+ {
+ if (blueplayers++ > 8)
+ {
+ smol = true;
+ break;
+ }
+ }
+ else //er? not on red or blue, so ignore them
+ continue;
+
+ }
+
+ // I'll be blunt with you, this may add more lines, but I'm not adding weird cases for this, so we're executing a separate function.
+ if (smol == true || cv_compactscoreboard.value)
+ {
+ HU_Draw32TeamTabRankings(tab, whiteplayer);
+ return;
+ }
+
V_DrawFill(160, 26, 1, 154, 0); //Draw a vertical line to separate the two teams.
V_DrawFill(1, 26, 318, 1, 0); //And a horizontal line to make a T.
V_DrawFill(1, 180, 318, 1, 0); //And a horizontal line near the bottom.
+ i=0, redplayers=0, blueplayers=0;
+
for (i = 0; i < MAXPLAYERS; i++)
{
if (players[tab[i].num].spectator)
@@ -2310,7 +2478,7 @@ void HU_drawPing(INT32 x, INT32 y, INT32 ping, boolean notext)
else //er? not on red or blue, so ignore them
continue;
- strlcpy(name, tab[i].name, 9);
+ strlcpy(name, tab[i].name, 7);
V_DrawString(x + 20, y,
((tab[i].num == whiteplayer) ? V_YELLOWMAP : 0)
| ((players[tab[i].num].health > 0) ? 0 : V_TRANSLUCENT)
@@ -2350,6 +2518,14 @@ void HU_drawPing(INT32 x, INT32 y, INT32 ping, boolean notext)
if (!(tab[i].num == serverplayer))
HU_drawPing(x+ 113, y+2, playerpingtable[tab[i].num], false);
}
+ V_DrawRightAlignedThinString(x+100, y, ((players[tab[i].num].health > 0) ? 0 : V_TRANSLUCENT), va("%u", tab[i].count));
+ if (!splitscreen)
+ {
+ if (!(tab[i].num == serverplayer))
+ HU_drawPing(x+ 113, y+2, playerpingtable[tab[i].num], false);
+ //else
+ // V_DrawSmallString(x+ 94, y+4, V_YELLOWMAP, "SERVER");
+ }
}
}
@@ -2371,9 +2547,12 @@ void HU_DrawDualTabRankings(INT32 x, INT32 y, playersort_t *tab, INT32 scoreline
if (players[tab[i].num].spectator)
continue; //ignore them.
- strlcpy(name, tab[i].name, 9);
+ strlcpy(name, tab[i].name, 7);
if (!(tab[i].num == serverplayer))
HU_drawPing(x+ 113, y+2, playerpingtable[tab[i].num], false);
+ //else
+ // V_DrawSmallString(x+ 94, y+4, V_YELLOWMAP, "SERVER");
+
V_DrawString(x + 20, y,
((tab[i].num == whiteplayer) ? V_YELLOWMAP : 0)
| ((players[tab[i].num].health > 0) ? 0 : V_TRANSLUCENT)
@@ -2428,15 +2607,15 @@ void HU_DrawDualTabRankings(INT32 x, INT32 y, playersort_t *tab, INT32 scoreline
if (circuitmap)
{
if (players[tab[i].num].exiting)
- V_DrawRightAlignedThinString(x+156, y-1, 0, va("%i:%02i.%02i", G_TicsToMinutes(players[tab[i].num].realtime,true), G_TicsToSeconds(players[tab[i].num].realtime), G_TicsToCentiseconds(players[tab[i].num].realtime)));
+ V_DrawRightAlignedThinString(x+146, y, 0, va("%i:%02i.%02i", G_TicsToMinutes(players[tab[i].num].realtime,true), G_TicsToSeconds(players[tab[i].num].realtime), G_TicsToCentiseconds(players[tab[i].num].realtime)));
else
- V_DrawRightAlignedThinString(x+156, y-1, ((players[tab[i].num].health > 0) ? 0 : V_TRANSLUCENT), va("%u", tab[i].count));
+ V_DrawRightAlignedThinString(x+146, y, ((players[tab[i].num].health > 0) ? 0 : V_TRANSLUCENT), va("%u", tab[i].count));
}
else
- V_DrawRightAlignedThinString(x+156, y-1, ((players[tab[i].num].health > 0) ? 0 : V_TRANSLUCENT), va("%i:%02i.%02i", G_TicsToMinutes(tab[i].count,true), G_TicsToSeconds(tab[i].count), G_TicsToCentiseconds(tab[i].count)));
+ V_DrawRightAlignedThinString(x+146, y, ((players[tab[i].num].health > 0) ? 0 : V_TRANSLUCENT), va("%i:%02i.%02i", G_TicsToMinutes(tab[i].count,true), G_TicsToSeconds(tab[i].count), G_TicsToCentiseconds(tab[i].count)));
}
else
- V_DrawRightAlignedThinString(x+120, y-1, ((players[tab[i].num].health > 0) ? 0 : V_TRANSLUCENT), va("%u", tab[i].count));
+ V_DrawRightAlignedThinString(x+100, y, ((players[tab[i].num].health > 0) ? 0 : V_TRANSLUCENT), va("%u", tab[i].count));
y += 16;
if (y > 160)
@@ -2445,7 +2624,108 @@ void HU_DrawDualTabRankings(INT32 x, INT32 y, playersort_t *tab, INT32 scoreline
x += BASEVIDWIDTH/2;
}
}
-}*/
+}
+
+//
+// HU_Draw32TabRankings
+//
+static void HU_Draw32TabRankings(INT32 x, INT32 y, playersort_t *tab, INT32 scorelines, INT32 whiteplayer)
+{
+ INT32 i;
+ const UINT8 *colormap;
+ char name[MAXPLAYERNAME+1];
+
+ V_DrawFill(160, 26, 1, 154, 0); //Draw a vertical line to separate the two sides.
+ V_DrawFill(1, 26, 318, 1, 0); //And a horizontal line to make a T.
+ V_DrawFill(1, 180, 318, 1, 0); //And a horizontal line near the bottom.
+
+ for (i = 0; i < scorelines; i++)
+ {
+ if (players[tab[i].num].spectator)
+ continue; //ignore them.
+
+ strlcpy(name, tab[i].name, 7);
+ if (!splitscreen) // don't draw it on splitscreen,
+ {
+ if (!(tab[i].num == serverplayer))
+ HU_drawPing(x+ 135, y+3, playerpingtable[tab[i].num], true);
+ //else
+ // V_DrawSmallString(x+ 129, y+4, V_YELLOWMAP, "HOST");
+ }
+
+ V_DrawString(x + 10, y,
+ ((tab[i].num == whiteplayer) ? V_YELLOWMAP : 0)
+ | ((players[tab[i].num].health > 0) ? 0 : V_TRANSLUCENT)
+ | V_ALLOWLOWERCASE, name);
+
+ if (G_GametypeUsesLives()) //show lives
+ V_DrawRightAlignedThinString(x-1, y, V_ALLOWLOWERCASE, va("%d", players[tab[i].num].lives));
+ else if (G_TagGametype() && players[tab[i].num].pflags & PF_TAGIT)
+ V_DrawFixedPatch((x-10)*FRACUNIT, (y)*FRACUNIT, FRACUNIT/4, 0, tagico, 0);
+
+ // Draw emeralds
+ if (!players[tab[i].num].powers[pw_super]
+ || ((leveltime/7) & 1))
+ {
+ HU_Draw32Emeralds(x+60, y+2, tab[i].emeralds);
+ //HU_DrawEmeralds(x-12,y+2,tab[i].emeralds);
+ }
+
+ //V_DrawSmallScaledPatch (x, y-4, 0, livesback);
+ if (tab[i].color == 0)
+ {
+ colormap = colormaps;
+ if (players[tab[i].num].powers[pw_super])
+ V_DrawFixedPatch(x*FRACUNIT, y*FRACUNIT, FRACUNIT/4, 0, superprefix[players[tab[i].num].skin], 0);
+ else
+ {
+ if (players[tab[i].num].health <= 0)
+ V_DrawFixedPatch(x*FRACUNIT, (y)*FRACUNIT, FRACUNIT/4, V_HUDTRANSHALF, faceprefix[players[tab[i].num].skin], 0);
+ else
+ V_DrawFixedPatch(x*FRACUNIT, (y)*FRACUNIT, FRACUNIT/4, 0, faceprefix[players[tab[i].num].skin], 0);
+ }
+ }
+ else
+ {
+ if (players[tab[i].num].powers[pw_super])
+ {
+ colormap = R_GetTranslationColormap(players[tab[i].num].skin, players[tab[i].num].mo ? players[tab[i].num].mo->color : tab[i].color, GTC_CACHE);
+ V_DrawFixedPatch(x*FRACUNIT, y*FRACUNIT, FRACUNIT/4, 0, superprefix[players[tab[i].num].skin], colormap);
+ }
+ else
+ {
+ colormap = R_GetTranslationColormap(players[tab[i].num].skin, players[tab[i].num].mo ? players[tab[i].num].mo->color : tab[i].color, GTC_CACHE);
+ if (players[tab[i].num].health <= 0)
+ V_DrawFixedPatch(x*FRACUNIT, (y)*FRACUNIT, FRACUNIT/4, V_HUDTRANSHALF, faceprefix[players[tab[i].num].skin], colormap);
+ else
+ V_DrawFixedPatch(x*FRACUNIT, (y)*FRACUNIT, FRACUNIT/4, 0, faceprefix[players[tab[i].num].skin], colormap);
+ }
+ }
+
+ // All data drawn with thin string for space.
+ if (gametype == GT_RACE)
+ {
+ if (circuitmap)
+ {
+ if (players[tab[i].num].exiting)
+ V_DrawRightAlignedThinString(x+128, y, 0, va("%i:%02i.%02i", G_TicsToMinutes(players[tab[i].num].realtime,true), G_TicsToSeconds(players[tab[i].num].realtime), G_TicsToCentiseconds(players[tab[i].num].realtime)));
+ else
+ V_DrawRightAlignedThinString(x+128, y, ((players[tab[i].num].health > 0) ? 0 : V_TRANSLUCENT), va("%u", tab[i].count));
+ }
+ else
+ V_DrawRightAlignedThinString(x+128, y, ((players[tab[i].num].health > 0) ? 0 : V_TRANSLUCENT), va("%i:%02i.%02i", G_TicsToMinutes(tab[i].count,true), G_TicsToSeconds(tab[i].count), G_TicsToCentiseconds(tab[i].count)));
+ }
+ else
+ V_DrawRightAlignedThinString(x+128, y, ((players[tab[i].num].health > 0) ? 0 : V_TRANSLUCENT), va("%u", tab[i].count));
+
+ y += 9;
+ if (i == 16)
+ {
+ y = 32;
+ x += BASEVIDWIDTH/2;
+ }
+ }
+}
//
// HU_DrawEmeralds
@@ -2473,7 +2753,7 @@ void HU_DrawEmeralds(INT32 x, INT32 y, INT32 pemeralds)
if (pemeralds & EMERALD7)
V_DrawSmallScaledPatch(x, y, 0, tinyemeraldpics[6]);
-}
+}*/
//
// HU_DrawSpectatorTicker
diff --git a/src/hu_stuff.h b/src/hu_stuff.h
index a9194975..f1ecb2ff 100644
--- a/src/hu_stuff.h
+++ b/src/hu_stuff.h
@@ -2,7 +2,7 @@
//-----------------------------------------------------------------------------
// Copyright (C) 1993-1996 by id Software, Inc.
// Copyright (C) 1998-2000 by DooM Legacy Team.
-// Copyright (C) 1999-2016 by Sonic Team Junior.
+// Copyright (C) 1999-2018 by Sonic Team Junior.
//
// This program is free software distributed under the
// terms of the GNU General Public License, version 2.
@@ -21,7 +21,7 @@
//------------------------------------
// heads up font
//------------------------------------
-#define HU_FONTSTART '\x19' // the first font character
+#define HU_FONTSTART '\x16' // the first font character
#define HU_FONTEND '~'
#define HU_FONTSIZE (HU_FONTEND - HU_FONTSTART + 1)
@@ -62,6 +62,21 @@ typedef struct
// chat stuff
//------------------------------------
#define HU_MAXMSGLEN 224
+#define CHAT_BUFSIZE 64 // that's enough messages, right? We'll delete the older ones when that gets out of hand.
+#define NETSPLITSCREEN // why the hell WOULDN'T we want this?
+#ifdef NETSPLITSCREEN
+#define OLDCHAT (cv_consolechat.value == 1 || dedicated || vid.width < 640)
+#else
+#define OLDCHAT (cv_consolechat.value == 1 || dedicated || vid.width < 640)
+#endif
+#define CHAT_MUTE (cv_mute.value && !(server || IsPlayerAdmin(consoleplayer))) // this still allows to open the chat but not to type. That's used for scrolling and whatnot.
+#define OLD_MUTE (OLDCHAT && cv_mute.value && !(server || IsPlayerAdmin(consoleplayer))) // this is used to prevent oldchat from opening when muted.
+
+// some functions
+void HU_AddChatText(const char *text, boolean playsound);
+
+// set true when entering a chat message
+extern boolean chat_on;
extern patch_t *hu_font[HU_FONTSIZE], *kart_font[KART_FONTSIZE], *tny_font[HU_FONTSIZE]; // SRB2kart
extern patch_t *tallnum[10];
@@ -77,18 +92,6 @@ extern patch_t *bmatcico;
extern patch_t *tagico;
extern patch_t *tallminus;
-#define CHAT_BUFSIZE 64 // that's enough messages, right? We'll delete the older ones when that gets out of hand.
-
-#define OLDCHAT (cv_consolechat.value == 1 || dedicated || vid.width < 640)
-#define CHAT_MUTE (cv_mute.value && !(server || IsPlayerAdmin(consoleplayer))) // this still allows to open the chat but not to type. That's used for scrolling and whatnot.
-#define OLD_MUTE (OLDCHAT && cv_mute.value && !(server || IsPlayerAdmin(consoleplayer))) // this is used to prevent oldchat from opening when muted.
-
-// some functions
-void HU_AddChatText(const char *text, boolean playsound);
-
-// set true when entering a chat message
-extern boolean chat_on;
-
// set true whenever the tab rankings are being shown for any reason
extern boolean hu_showscores;
@@ -101,18 +104,15 @@ void HU_LoadGraphics(void);
void HU_Start(void);
boolean HU_Responder(event_t *ev);
-
void HU_Ticker(void);
void HU_Drawer(void);
char HU_dequeueChatChar(void);
void HU_Erase(void);
void HU_clearChatChars(void);
void HU_drawPing(INT32 x, INT32 y, INT32 ping, boolean notext); // Lat': Ping drawer for scoreboard.
-void HU_DrawTeamTabRankings(playersort_t *tab, INT32 whiteplayer);
-void HU_DrawDualTabRankings(INT32 x, INT32 y, playersort_t *tab, INT32 scorelines, INT32 whiteplayer);
-void HU_DrawTabRankings(INT32 x, INT32 y, playersort_t *tab, INT32 scorelines, INT32 whiteplayer, INT32 hilicol);
//void HU_DrawTeamTabRankings(playersort_t *tab, INT32 whiteplayer);
//void HU_DrawDualTabRankings(INT32 x, INT32 y, playersort_t *tab, INT32 scorelines, INT32 whiteplayer);
+void HU_DrawTabRankings(INT32 x, INT32 y, playersort_t *tab, INT32 scorelines, INT32 whiteplayer, INT32 hilicol);
void HU_DrawEmeralds(INT32 x, INT32 y, INT32 pemeralds);
INT32 HU_CreateTeamScoresTbl(playersort_t *tab, UINT32 dmtotals[]);
diff --git a/src/i_addrinfo.c b/src/i_addrinfo.c
index 4dafd8f8..20766275 100644
--- a/src/i_addrinfo.c
+++ b/src/i_addrinfo.c
@@ -1,6 +1,6 @@
// SONIC ROBO BLAST 2
//-----------------------------------------------------------------------------
-// Copyright (C) 2011-2016 by Sonic Team Junior.
+// Copyright (C) 2011-2018 by Sonic Team Junior.
//
// This program is free software distributed under the
// terms of the GNU General Public License, version 2.
diff --git a/src/i_addrinfo.h b/src/i_addrinfo.h
index 744ea0cf..1b8ce915 100644
--- a/src/i_addrinfo.h
+++ b/src/i_addrinfo.h
@@ -1,6 +1,6 @@
// SONIC ROBO BLAST 2
//-----------------------------------------------------------------------------
-// Copyright (C) 2011-2016 by Sonic Team Junior.
+// Copyright (C) 2011-2018 by Sonic Team Junior.
//
// This program is free software distributed under the
// terms of the GNU General Public License, version 2.
diff --git a/src/i_joy.h b/src/i_joy.h
index 00302eb0..f780d801 100644
--- a/src/i_joy.h
+++ b/src/i_joy.h
@@ -1,7 +1,7 @@
// SONIC ROBO BLAST 2
//-----------------------------------------------------------------------------
// Copyright (C) 1998-2000 by DooM Legacy Team.
-// Copyright (C) 1999-2016 by Sonic Team Junior.
+// Copyright (C) 1999-2018 by Sonic Team Junior.
//
// This program is free software distributed under the
// terms of the GNU General Public License, version 2.
diff --git a/src/i_net.h b/src/i_net.h
index 2bfa5eac..0e17077b 100644
--- a/src/i_net.h
+++ b/src/i_net.h
@@ -2,7 +2,7 @@
//-----------------------------------------------------------------------------
// Copyright (C) 1993-1996 by id Software, Inc.
// Copyright (C) 1998-2000 by DooM Legacy Team.
-// Copyright (C) 1999-2016 by Sonic Team Junior.
+// Copyright (C) 1999-2018 by Sonic Team Junior.
//
// This program is free software distributed under the
// terms of the GNU General Public License, version 2.
diff --git a/src/i_sound.h b/src/i_sound.h
index bc9829fd..fd73d145 100644
--- a/src/i_sound.h
+++ b/src/i_sound.h
@@ -2,7 +2,7 @@
//-----------------------------------------------------------------------------
// Copyright (C) 1993-1996 by id Software, Inc.
// Copyright (C) 1998-2000 by DooM Legacy Team.
-// Copyright (C) 1999-2016 by Sonic Team Junior.
+// Copyright (C) 1999-2018 by Sonic Team Junior.
//
// This program is free software distributed under the
// terms of the GNU General Public License, version 2.
diff --git a/src/i_system.h b/src/i_system.h
index 447e5934..d1708fe5 100644
--- a/src/i_system.h
+++ b/src/i_system.h
@@ -2,7 +2,7 @@
//-----------------------------------------------------------------------------
// Copyright (C) 1993-1996 by id Software, Inc.
// Copyright (C) 1998-2000 by DooM Legacy Team.
-// Copyright (C) 1999-2016 by Sonic Team Junior.
+// Copyright (C) 1999-2018 by Sonic Team Junior.
//
// This program is free software distributed under the
// terms of the GNU General Public License, version 2.
diff --git a/src/i_tcp.c b/src/i_tcp.c
index 9227865e..f8a65b75 100644
--- a/src/i_tcp.c
+++ b/src/i_tcp.c
@@ -1,7 +1,7 @@
// SONIC ROBO BLAST 2
//-----------------------------------------------------------------------------
// Copyright (C) 1998-2000 by DooM Legacy Team.
-// Copyright (C) 1999-2016 by Sonic Team Junior.
+// Copyright (C) 1999-2018 by Sonic Team Junior.
//
// This program is free software distributed under the
// terms of the GNU General Public License, version 2.
@@ -1310,7 +1310,7 @@ void I_ShutdownTcpDriver(void)
static SINT8 SOCK_NetMakeNodewPort(const char *address, const char *port)
{
SINT8 newnode = -1;
- struct my_addrinfo *ai, *runp, hints;
+ struct my_addrinfo *ai = NULL, *runp, hints;
int gaie;
if (!port || !port[0])
diff --git a/src/i_tcp.h b/src/i_tcp.h
index a084abb8..06680cd9 100644
--- a/src/i_tcp.h
+++ b/src/i_tcp.h
@@ -1,7 +1,7 @@
// SONIC ROBO BLAST 2
//-----------------------------------------------------------------------------
// Copyright (C) 1998-2000 by DooM Legacy Team.
-// Copyright (C) 1999-2016 by Sonic Team Junior.
+// Copyright (C) 1999-2018 by Sonic Team Junior.
//
// This program is free software distributed under the
// terms of the GNU General Public License, version 2.
diff --git a/src/i_video.h b/src/i_video.h
index 7ee07f00..4bb2c582 100644
--- a/src/i_video.h
+++ b/src/i_video.h
@@ -2,7 +2,7 @@
//-----------------------------------------------------------------------------
// Copyright (C) 1993-1996 by id Software, Inc.
// Copyright (C) 1998-2000 by DooM Legacy Team.
-// Copyright (C) 1999-2016 by Sonic Team Junior.
+// Copyright (C) 1999-2018 by Sonic Team Junior.
//
// This program is free software distributed under the
// terms of the GNU General Public License, version 2.
diff --git a/src/info.c b/src/info.c
index fa241ad7..ea9eac9d 100644
--- a/src/info.c
+++ b/src/info.c
@@ -2,7 +2,7 @@
//-----------------------------------------------------------------------------
// Copyright (C) 1993-1996 by id Software, Inc.
// Copyright (C) 1998-2000 by DooM Legacy Team.
-// Copyright (C) 1999-2016 by Sonic Team Junior.
+// Copyright (C) 1999-2018 by Sonic Team Junior.
//
// This program is free software distributed under the
// terms of the GNU General Public License, version 2.
@@ -68,8 +68,8 @@ char sprnames[NUMSPRITES + 1][5] =
"FROG","CBRA","HOLE","BBRA","EGFG","SMKP","MTYM","THWP","SNOB","ICEB",
"CNDL","DOCH","DUCK","GTRE","CHES","CHIM","DRGN","LZMN","PGSS","ZTCH",
"MKMA","MKMP","RTCH","BOWL","BOWH","BRRL","BRRR","HRSE","TOAH","BFRT",
- "OFRT","RFRT","PFRT","ASPK","HBST","HBSO","HBSF","WBLZ","WBLN","XMS4",
- "XMS5","VIEW"
+ "OFRT","RFRT","PFRT","ASPK","HBST","HBSO","HBSF","WBLZ","WBLN","FWRK",
+ "XMS4","XMS5","VIEW"
};
// Doesn't work with g++, needs actionf_p1 (don't modify this comment)
@@ -3293,100 +3293,106 @@ state_t states[NUMSTATES] =
{SPR_ICEB, 3, 10, {NULL}, 0, 0, S_NULL}, // S_SMK_ICEBLOCK_DEBRIS2
// Ezo's maps
- {SPR_CNDL, FF_FULLBRIGHT|FF_TRANS50, 3, {NULL}, 0, 0, S_BLUEFIRE2}, // S_BLUEFIRE1
- {SPR_CNDL, 1|FF_FULLBRIGHT|FF_TRANS50, 3, {NULL}, 0, 0, S_BLUEFIRE3}, // S_BLUEFIRE2
- {SPR_CNDL, 2|FF_FULLBRIGHT|FF_TRANS50, 3, {NULL}, 0, 0, S_BLUEFIRE4}, // S_BLUEFIRE3
- {SPR_CNDL, 3|FF_FULLBRIGHT|FF_TRANS50, 3, {NULL}, 0, 0, S_BLUEFIRE1}, // S_BLUEFIRE4
+ {SPR_CNDL, FF_FULLBRIGHT|FF_TRANS50, 3, {NULL}, 0, 0, S_BLUEFIRE2}, // S_BLUEFIRE1
+ {SPR_CNDL, 1|FF_FULLBRIGHT|FF_TRANS50, 3, {NULL}, 0, 0, S_BLUEFIRE3}, // S_BLUEFIRE2
+ {SPR_CNDL, 2|FF_FULLBRIGHT|FF_TRANS50, 3, {NULL}, 0, 0, S_BLUEFIRE4}, // S_BLUEFIRE3
+ {SPR_CNDL, 3|FF_FULLBRIGHT|FF_TRANS50, 3, {NULL}, 0, 0, S_BLUEFIRE1}, // S_BLUEFIRE4
- {SPR_CNDL, 4|FF_FULLBRIGHT|FF_TRANS50, 3, {NULL}, 0, 0, S_GREENFIRE2}, // S_GREENFIRE1
- {SPR_CNDL, 5|FF_FULLBRIGHT|FF_TRANS50, 3, {NULL}, 0, 0, S_GREENFIRE3}, // S_GREENFIRE2
- {SPR_CNDL, 6|FF_FULLBRIGHT|FF_TRANS50, 3, {NULL}, 0, 0, S_GREENFIRE4}, // S_GREENFIRE3
- {SPR_CNDL, 7|FF_FULLBRIGHT|FF_TRANS50, 3, {NULL}, 0, 0, S_GREENFIRE1}, // S_GREENFIRE4
+ {SPR_CNDL, 4|FF_FULLBRIGHT|FF_TRANS50, 3, {NULL}, 0, 0, S_GREENFIRE2}, // S_GREENFIRE1
+ {SPR_CNDL, 5|FF_FULLBRIGHT|FF_TRANS50, 3, {NULL}, 0, 0, S_GREENFIRE3}, // S_GREENFIRE2
+ {SPR_CNDL, 6|FF_FULLBRIGHT|FF_TRANS50, 3, {NULL}, 0, 0, S_GREENFIRE4}, // S_GREENFIRE3
+ {SPR_CNDL, 7|FF_FULLBRIGHT|FF_TRANS50, 3, {NULL}, 0, 0, S_GREENFIRE1}, // S_GREENFIRE4
- {SPR_CHES, 0, -1, {NULL}, 0, 0, S_NULL}, // S_REGALCHEST
- {SPR_CHIM, FF_FULLBRIGHT, -1, {NULL}, 0, 0, S_NULL}, // S_CHIMERASTATUE
- {SPR_DRGN, FF_FULLBRIGHT, -1, {NULL}, 0, 0, S_NULL}, // S_DRAGONSTATUE
- {SPR_LZMN, FF_FULLBRIGHT, -1, {NULL}, 0, 0, S_NULL}, // S_LIZARDMANSTATUE
- {SPR_PGSS, FF_FULLBRIGHT, -1, {NULL}, 0, 0, S_NULL}, // S_PEGASUSSTATUE
+ {SPR_CHES, 0, -1, {NULL}, 0, 0, S_NULL}, // S_REGALCHEST
+ {SPR_CHIM, FF_FULLBRIGHT, -1, {NULL}, 0, 0, S_NULL}, // S_CHIMERASTATUE
+ {SPR_DRGN, FF_FULLBRIGHT, -1, {NULL}, 0, 0, S_NULL}, // S_DRAGONSTATUE
+ {SPR_LZMN, FF_FULLBRIGHT, -1, {NULL}, 0, 0, S_NULL}, // S_LIZARDMANSTATUE
+ {SPR_PGSS, FF_FULLBRIGHT, -1, {NULL}, 0, 0, S_NULL}, // S_PEGASUSSTATUE
- {SPR_ZTCH, FF_FULLBRIGHT|FF_TRANS50, 3, {NULL}, 0, 0, S_ZELDAFIRE2}, // S_ZELDAFIRE1
- {SPR_ZTCH, 1|FF_FULLBRIGHT|FF_TRANS50, 3, {NULL}, 0, 0, S_ZELDAFIRE3}, // S_ZELDAFIRE2
- {SPR_ZTCH, 2|FF_FULLBRIGHT|FF_TRANS50, 3, {NULL}, 0, 0, S_ZELDAFIRE4}, // S_ZELDAFIRE3
- {SPR_ZTCH, 3|FF_FULLBRIGHT|FF_TRANS50, 3, {NULL}, 0, 0, S_ZELDAFIRE1}, // S_ZELDAFIRE4
+ {SPR_ZTCH, FF_FULLBRIGHT|FF_TRANS50, 3, {NULL}, 0, 0, S_ZELDAFIRE2}, // S_ZELDAFIRE1
+ {SPR_ZTCH, 1|FF_FULLBRIGHT|FF_TRANS50, 3, {NULL}, 0, 0, S_ZELDAFIRE3}, // S_ZELDAFIRE2
+ {SPR_ZTCH, 2|FF_FULLBRIGHT|FF_TRANS50, 3, {NULL}, 0, 0, S_ZELDAFIRE4}, // S_ZELDAFIRE3
+ {SPR_ZTCH, 3|FF_FULLBRIGHT|FF_TRANS50, 3, {NULL}, 0, 0, S_ZELDAFIRE1}, // S_ZELDAFIRE4
- {SPR_DOCH, 0, -1, {NULL}, 0, 0, S_NULL}, // S_GANBARETHING
- {SPR_DUCK, 0, -1, {NULL}, 0, 0, S_NULL}, // S_GANBAREDUCK
- {SPR_GTRE, 0, -1, {NULL}, 0, 0, S_NULL}, // S_GANBARETREE
+ {SPR_DOCH, 0, -1, {NULL}, 0, 0, S_NULL}, // S_GANBARETHING
+ {SPR_DUCK, 0, -1, {NULL}, 0, 0, S_NULL}, // S_GANBAREDUCK
+ {SPR_GTRE, 0, -1, {NULL}, 0, 0, S_NULL}, // S_GANBARETREE
- {SPR_MKMA, 1, 2, {A_Look}, (256<<16)|1, 0, S_MONOIDLE}, // S_MONOIDLE
- {SPR_MKMA, 0, 3, {A_Chase}, 3, 0, S_MONOCHASE2}, // S_MONOCHASE1
- {SPR_MKMA, 1, 3, {A_Chase}, 3, 0, S_MONOCHASE3}, // S_MONOCHASE2
- {SPR_MKMA, 2, 3, {A_Chase}, 3, 0, S_MONOCHASE4}, // S_MONOCHASE3
- {SPR_MKMA, 3, 3, {A_Chase}, 3, 0, S_MONOCHASE1}, // S_MONOCHASE4
- {SPR_MKMP, 0, 24, {A_Pain}, 3, 0, S_MONOIDLE}, // S_MONOPAIN
+ {SPR_MKMA, 1, 2, {A_Look}, (256<<16)|1, 0, S_MONOIDLE}, // S_MONOIDLE
+ {SPR_MKMA, 0, 3, {A_Chase}, 3, 0, S_MONOCHASE2}, // S_MONOCHASE1
+ {SPR_MKMA, 1, 3, {A_Chase}, 3, 0, S_MONOCHASE3}, // S_MONOCHASE2
+ {SPR_MKMA, 2, 3, {A_Chase}, 3, 0, S_MONOCHASE4}, // S_MONOCHASE3
+ {SPR_MKMA, 3, 3, {A_Chase}, 3, 0, S_MONOCHASE1}, // S_MONOCHASE4
+ {SPR_MKMP, 0, 24, {A_Pain}, 3, 0, S_MONOIDLE}, // S_MONOPAIN
- {SPR_RTCH, FF_FULLBRIGHT|FF_TRANS50, 3, {NULL}, 0, 0, S_REDZELDAFIRE2}, // S_REDZELDAFIRE1
- {SPR_RTCH, 1|FF_FULLBRIGHT|FF_TRANS50, 3, {NULL}, 0, 0, S_REDZELDAFIRE3}, // S_REDZELDAFIRE2
- {SPR_RTCH, 2|FF_FULLBRIGHT|FF_TRANS50, 3, {NULL}, 0, 0, S_REDZELDAFIRE4}, // S_REDZELDAFIRE3
- {SPR_RTCH, 3|FF_FULLBRIGHT|FF_TRANS50, 3, {NULL}, 0, 0, S_REDZELDAFIRE1}, // S_REDZELDAFIRE4
+ {SPR_RTCH, FF_FULLBRIGHT|FF_TRANS50, 3, {NULL}, 0, 0, S_REDZELDAFIRE2}, // S_REDZELDAFIRE1
+ {SPR_RTCH, 1|FF_FULLBRIGHT|FF_TRANS50, 3, {NULL}, 0, 0, S_REDZELDAFIRE3}, // S_REDZELDAFIRE2
+ {SPR_RTCH, 2|FF_FULLBRIGHT|FF_TRANS50, 3, {NULL}, 0, 0, S_REDZELDAFIRE4}, // S_REDZELDAFIRE3
+ {SPR_RTCH, 3|FF_FULLBRIGHT|FF_TRANS50, 3, {NULL}, 0, 0, S_REDZELDAFIRE1}, // S_REDZELDAFIRE4
- {SPR_BOWL, 0, -1, {NULL}, 0, 0, S_NULL}, // S_BOWLINGPIN
- {SPR_BOWH, 0, 4, {A_BunnyHop}, 5, 20, S_BOWLINGHIT2}, // S_BOWLINGHIT1
- {SPR_BOWH, 1, 2, {NULL}, 0, 0, S_BOWLINGHIT3}, // S_BOWLINGHIT2
- {SPR_BOWH, 2, 2, {NULL}, 0, 0, S_BOWLINGHIT4}, // S_BOWLINGHIT3
- {SPR_BOWH, 3, 2, {NULL}, 0, 0, S_NULL}, // S_BOWLINGHIT4
+ {SPR_BOWL, 0, -1, {NULL}, 0, 0, S_NULL}, // S_BOWLINGPIN
+ {SPR_BOWH, 0, 4, {A_BunnyHop}, 5, 20, S_BOWLINGHIT2}, // S_BOWLINGHIT1
+ {SPR_BOWH, 1, 2, {NULL}, 0, 0, S_BOWLINGHIT3}, // S_BOWLINGHIT2
+ {SPR_BOWH, 2, 2, {NULL}, 0, 0, S_BOWLINGHIT4}, // S_BOWLINGHIT3
+ {SPR_BOWH, 3, 2, {NULL}, 0, 0, S_NULL}, // S_BOWLINGHIT4
- {SPR_TOAD, 0, -1, {NULL}, 0, 0, S_NULL}, // S_ARIDTOAD
- {SPR_TOAH, 0, 4, {A_BunnyHop}, 10, 60, S_TOADHIT2}, // S_TOADHIT1
- {SPR_TOAH, 1, 3, {NULL}, 0, 0, S_TOADHIT3}, // S_TOADHIT2
- {SPR_TOAH, 2, 3, {NULL}, 0, 0, S_TOADHIT4}, // S_TOADHIT3
- {SPR_TOAH, 3, 3, {NULL}, 0, 0, S_EBARREL18}, // S_TOADHIT4
+ {SPR_TOAD, 0, -1, {NULL}, 0, 0, S_NULL}, // S_ARIDTOAD
+ {SPR_TOAH, 0, 4, {A_BunnyHop}, 10, 60, S_TOADHIT2}, // S_TOADHIT1
+ {SPR_TOAH, 1, 3, {NULL}, 0, 0, S_TOADHIT3}, // S_TOADHIT2
+ {SPR_TOAH, 2, 3, {NULL}, 0, 0, S_TOADHIT4}, // S_TOADHIT3
+ {SPR_TOAH, 3, 3, {NULL}, 0, 0, S_EBARREL18}, // S_TOADHIT4
- {SPR_BRRL, 0, 1, {A_Look}, (96<<16)|1, 0, S_EBARRELIDLE}, // S_EBARRELIDLE
- {SPR_BRRR, 0, 4, {NULL}, 0, 0, S_EBARREL2}, // S_EBARREL1
- {SPR_BRRR, 1, 4, {NULL}, 0, 0, S_EBARREL3}, // S_EBARREL2
- {SPR_BRRR, 2, 4, {NULL}, 0, 0, S_EBARREL4}, // S_EBARREL3
- {SPR_BRRR, 3, 4, {NULL}, 0, 0, S_EBARREL5}, // S_EBARREL4
- {SPR_BRRR, 4, 4, {NULL}, 0, 0, S_EBARREL6}, // S_EBARREL5
- {SPR_BRRR, 5, 4, {NULL}, 0, 0, S_EBARREL7}, // S_EBARREL6
- {SPR_BRRR, 6, 4, {NULL}, 0, 0, S_EBARREL8}, // S_EBARREL7
- {SPR_BRRR, 7, 4, {NULL}, 0, 0, S_EBARREL9}, // S_EBARREL8
- {SPR_BRRR, 8, 4, {NULL}, 0, 0, S_EBARREL10}, // S_EBARREL9
- {SPR_BRRR, 9, 4, {NULL}, 0, 0, S_EBARREL11}, // S_EBARREL10
- {SPR_BRRR, 10, 4, {NULL}, 0, 0, S_EBARREL12}, // S_EBARREL11
- {SPR_BRRR, 11, 4, {NULL}, 0, 0, S_EBARREL13}, // S_EBARREL12
- {SPR_BRRR, 12, 4, {NULL}, 0, 0, S_EBARREL14}, // S_EBARREL13
- {SPR_BRRR, 13, 4, {NULL}, 0, 0, S_EBARREL15}, // S_EBARREL14
- {SPR_BRRR, 14, 4, {NULL}, 0, 0, S_EBARREL16}, // S_EBARREL15
- {SPR_BRRR, 15, 4, {NULL}, 0, 0, S_EBARREL17}, // S_EBARREL16
- {SPR_BRRR, 16, 4, {NULL}, 0, 0, S_EBARREL18}, // S_EBARREL17
- {SPR_BRRR, 16, 0, {A_MineExplode}, MT_MINEEXPLOSION, 0, S_NULL}, // S_EBARREL18
+ {SPR_BRRL, 0, 1, {A_Look}, (96<<16)|1, 0, S_EBARRELIDLE}, // S_EBARRELIDLE
+ {SPR_BRRR, 0, 4, {NULL}, 0, 0, S_EBARREL2}, // S_EBARREL1
+ {SPR_BRRR, 1, 4, {NULL}, 0, 0, S_EBARREL3}, // S_EBARREL2
+ {SPR_BRRR, 2, 4, {NULL}, 0, 0, S_EBARREL4}, // S_EBARREL3
+ {SPR_BRRR, 3, 4, {NULL}, 0, 0, S_EBARREL5}, // S_EBARREL4
+ {SPR_BRRR, 4, 4, {NULL}, 0, 0, S_EBARREL6}, // S_EBARREL5
+ {SPR_BRRR, 5, 4, {NULL}, 0, 0, S_EBARREL7}, // S_EBARREL6
+ {SPR_BRRR, 6, 4, {NULL}, 0, 0, S_EBARREL8}, // S_EBARREL7
+ {SPR_BRRR, 7, 4, {NULL}, 0, 0, S_EBARREL9}, // S_EBARREL8
+ {SPR_BRRR, 8, 4, {NULL}, 0, 0, S_EBARREL10}, // S_EBARREL9
+ {SPR_BRRR, 9, 4, {NULL}, 0, 0, S_EBARREL11}, // S_EBARREL10
+ {SPR_BRRR, 10, 4, {NULL}, 0, 0, S_EBARREL12}, // S_EBARREL11
+ {SPR_BRRR, 11, 4, {NULL}, 0, 0, S_EBARREL13}, // S_EBARREL12
+ {SPR_BRRR, 12, 4, {NULL}, 0, 0, S_EBARREL14}, // S_EBARREL13
+ {SPR_BRRR, 13, 4, {NULL}, 0, 0, S_EBARREL15}, // S_EBARREL14
+ {SPR_BRRR, 14, 4, {NULL}, 0, 0, S_EBARREL16}, // S_EBARREL15
+ {SPR_BRRR, 15, 4, {NULL}, 0, 0, S_EBARREL17}, // S_EBARREL16
+ {SPR_BRRR, 16, 4, {NULL}, 0, 0, S_EBARREL18}, // S_EBARREL17
+ {SPR_BRRR, 16, 0, {A_MineExplode}, MT_MINEEXPLOSION, 0, S_NULL}, // S_EBARREL18
- {SPR_HRSE, 0, 230, {A_PlaySeeSound}, 0, 0, S_MERRYHORSE}, // S_MERRYHORSE
+ {SPR_HRSE, 0, 230, {A_PlaySeeSound}, 0, 0, S_MERRYHORSE}, // S_MERRYHORSE
- {SPR_BFRT, 0, -1, {NULL}, 0, 0, S_NULL}, // S_BLUEFRUIT
- {SPR_OFRT, 0, -1, {NULL}, 0, 0, S_NULL}, // S_ORANGEFRUIT
- {SPR_RFRT, 0, -1, {NULL}, 0, 0, S_NULL}, // S_REDFRUIT
- {SPR_PFRT, 0, -1, {NULL}, 0, 0, S_NULL}, // S_PINKFRUIT
+ {SPR_BFRT, 0, -1, {NULL}, 0, 0, S_NULL}, // S_BLUEFRUIT
+ {SPR_OFRT, 0, -1, {NULL}, 0, 0, S_NULL}, // S_ORANGEFRUIT
+ {SPR_RFRT, 0, -1, {NULL}, 0, 0, S_NULL}, // S_REDFRUIT
+ {SPR_PFRT, 0, -1, {NULL}, 0, 0, S_NULL}, // S_PINKFRUIT
- {SPR_ASPK, 0, 50, {A_PlayAttackSound}, 0, 0, S_ADVENTURESPIKEA2}, // S_ADVENTURESPIKEA1
- {SPR_ASPK, 0, 50, {A_BunnyHop}, 20, 0, S_ADVENTURESPIKEA1}, // S_ADVENTURESPIKEA2
- {SPR_ASPK, 0, 50, {A_PlayAttackSound}, 0, 0, S_ADVENTURESPIKEB2}, // S_ADVENTURESPIKEB1
- {SPR_ASPK, 0, 35, {A_BunnyHop}, 15, 0, S_ADVENTURESPIKEB1}, // S_ADVENTURESPIKEB2
- {SPR_ASPK, 0, 50, {A_PlayAttackSound}, 0, 0, S_ADVENTURESPIKEC2}, // S_ADVENTURESPIKEC1
- {SPR_ASPK, 0, 65, {A_BunnyHop}, 25, 0, S_ADVENTURESPIKEC1}, // S_ADVENTURESPIKEC1
+ {SPR_ASPK, 0, 50, {A_PlayAttackSound}, 0, 0, S_ADVENTURESPIKEA2}, // S_ADVENTURESPIKEA1
+ {SPR_ASPK, 0, 50, {A_BunnyHop}, 20, 0, S_ADVENTURESPIKEA1}, // S_ADVENTURESPIKEA2
+ {SPR_ASPK, 0, 50, {A_PlayAttackSound}, 0, 0, S_ADVENTURESPIKEB2}, // S_ADVENTURESPIKEB1
+ {SPR_ASPK, 0, 35, {A_BunnyHop}, 15, 0, S_ADVENTURESPIKEB1}, // S_ADVENTURESPIKEB2
+ {SPR_ASPK, 0, 50, {A_PlayAttackSound}, 0, 0, S_ADVENTURESPIKEC2}, // S_ADVENTURESPIKEC1
+ {SPR_ASPK, 0, 65, {A_BunnyHop}, 25, 0, S_ADVENTURESPIKEC1}, // S_ADVENTURESPIKEC1
- {SPR_HBST, FF_FULLBRIGHT, 5, {NULL}, 0, 0, S_BOOSTPROMPT2}, // S_BOOSTPROMPT1
- {SPR_HBST, 1|FF_FULLBRIGHT, 5, {NULL}, 0, 0, S_BOOSTPROMPT1}, // S_BOOSTPROMPT2
+ {SPR_HBST, FF_FULLBRIGHT, 5, {NULL}, 0, 0, S_BOOSTPROMPT2}, // S_BOOSTPROMPT1
+ {SPR_HBST, 1|FF_FULLBRIGHT, 5, {NULL}, 0, 0, S_BOOSTPROMPT1}, // S_BOOSTPROMPT2
- {SPR_HBSF, FF_FULLBRIGHT, 5, {NULL}, 0, 0, S_BOOSTOFF2}, // S_BOOSTOFF1
- {SPR_HBSF, 1|FF_FULLBRIGHT, 5, {NULL}, 0, 0, S_BOOSTOFF1}, // S_BOOSTOFF2
+ {SPR_HBSF, FF_FULLBRIGHT, 5, {NULL}, 0, 0, S_BOOSTOFF2}, // S_BOOSTOFF1
+ {SPR_HBSF, 1|FF_FULLBRIGHT, 5, {NULL}, 0, 0, S_BOOSTOFF1}, // S_BOOSTOFF2
- {SPR_HBSO, FF_FULLBRIGHT, 5, {NULL}, 0, 0, S_BOOSTON2}, // S_BOOSTON1
- {SPR_HBSO, 1|FF_FULLBRIGHT, 5, {NULL}, 0, 0, S_BOOSTON1}, // S_BOOSTON2
+ {SPR_HBSO, FF_FULLBRIGHT, 5, {NULL}, 0, 0, S_BOOSTON2}, // S_BOOSTON1
+ {SPR_HBSO, 1|FF_FULLBRIGHT, 5, {NULL}, 0, 0, S_BOOSTON1}, // S_BOOSTON2
- {SPR_WBLZ, 0, -1, {NULL}, 0, 0, S_NULL}, // S_LIZARDMAN
- {SPR_WBLN, 0, -1, {NULL}, 0, 0, S_NULL}, // S_LIONMAN
+ {SPR_WBLZ, 0, -1, {NULL}, 0, 0, S_NULL}, // S_LIZARDMAN
+ {SPR_WBLN, 0, -1, {NULL}, 0, 0, S_NULL}, // S_LIONMAN
+
+ {SPR_FWRK, FF_FULLBRIGHT, 2, {NULL}, 0, 0, S_KARMAFIREWORK2}, // S_KARMAFIREWORK1
+ {SPR_FWRK, 1|FF_FULLBRIGHT, 2, {NULL}, 0, 0, S_KARMAFIREWORK3}, // S_KARMAFIREWORK2
+ {SPR_FWRK, 2|FF_FULLBRIGHT, 2, {NULL}, 0, 0, S_KARMAFIREWORK4}, // S_KARMAFIREWORK3
+ {SPR_FWRK, 3|FF_FULLBRIGHT, 2, {NULL}, 0, 0, S_KARMAFIREWORK1}, // S_KARMAFIREWORK4
+ {SPR_FWRK, 4|FF_FULLBRIGHT, TICRATE, {NULL}, 0, 0, S_NULL}, // S_KARMAFIREWORKTRAIL
#ifdef SEENAMES
{SPR_NULL, 0, 1, {NULL}, 0, 0, S_NULL}, // S_NAMECHECK
@@ -13747,7 +13753,7 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] =
10, // mass
0, // damage
sfx_None, // activesound
- MF_NOTHINK|MF_NOBLOCKMAP|MF_NOGRAVITY, // flags
+ MF_SCENERY|MF_NOBLOCKMAP|MF_NOGRAVITY, // flags
S_NULL // raisestate
},
@@ -14850,8 +14856,8 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] =
S_NULL, // xdeathstate
sfx_kc2e, // deathsound
60*FRACUNIT, // speed
- 36*FRACUNIT, // radius
- 36*FRACUNIT, // height
+ 48*FRACUNIT, // radius
+ 48*FRACUNIT, // height
0, // display offset
100, // mass
MT_RANDOMITEMPOP, // damage
@@ -14904,8 +14910,8 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] =
S_NULL, // xdeathstate
sfx_itpick, // deathsound
0, // speed
- 24*FRACUNIT, // radius
- 24*FRACUNIT, // height
+ 32*FRACUNIT, // radius
+ 32*FRACUNIT, // height
0, // display offset
100, // mass
0, // damage
@@ -15470,7 +15476,7 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] =
S_JAWZ_DEAD1, // deathstate
S_JAWZ_DEAD2, // xdeathstate
sfx_s3k5d, // deathsound
- 7*FRACUNIT, // speed
+ 64*FRACUNIT, // speed
16*FRACUNIT, // radius
32*FRACUNIT, // height
0, // display offset
@@ -15497,7 +15503,7 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] =
S_JAWZ_DEAD1, // deathstate
S_JAWZ_DEAD2, // xdeathstate
sfx_s3k5d, // deathsound
- 56*FRACUNIT, // speed
+ 64*FRACUNIT, // speed
16*FRACUNIT, // radius
32*FRACUNIT, // height
0, // display offset
@@ -15571,7 +15577,7 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] =
6*TICRATE, // reactiontime
sfx_None, // attacksound
S_NULL, // painstate
- 288*FRACUNIT, // painchance
+ 192*FRACUNIT, // painchance
sfx_None, // painsound
S_NULL, // meleestate
S_NULL, // missilestate
@@ -15598,7 +15604,7 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] =
8, // reactiontime
sfx_None, // attacksound
S_NULL, // painstate
- 288*FRACUNIT, // painchance
+ 192*FRACUNIT, // painchance
sfx_None, // painsound
S_NULL, // meleestate
S_NULL, // missilestate
@@ -15767,7 +15773,7 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] =
S_BALLHOG_DEAD, // deathstate
S_NULL, // xdeathstate
sfx_hogbom, // deathsound
- 0, // speed
+ 64*FRACUNIT, // speed
16*FRACUNIT, // radius
32*FRACUNIT, // height
0, // display offset
@@ -15841,7 +15847,7 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] =
8, // reactiontime
sfx_None, // attacksound
S_NULL, // painstate
- 288*FRACUNIT, // painchance
+ 192*FRACUNIT, // painchance
sfx_None, // painsound
S_NULL, // meleestate
S_NULL, // missilestate
@@ -15855,7 +15861,7 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] =
100, // mass
1, // damage
sfx_None, // activesound
- MF_BOUNCE|MF_FLOAT|MF_NOCLIPTHING|MF_MISSILE|MF_SHOOTABLE|MF_DONTENCOREMAP, // flags
+ MF_NOGRAVITY|MF_NOCLIP|MF_NOCLIPHEIGHT|MF_NOCLIPTHING|MF_DONTENCOREMAP, // flags
S_NULL // raisestate
},
@@ -17282,7 +17288,7 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] =
8, // speed
36*FRACUNIT, // radius
37*FRACUNIT, // height
- 0, // display offset
+ -2, // display offset
16, // mass
0, // damage
sfx_None, // activesound
@@ -17309,7 +17315,7 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] =
8, // speed
36*FRACUNIT, // radius
37*FRACUNIT, // height
- 0, // display offset
+ -2, // display offset
16, // mass
0, // damage
sfx_None, // activesound
@@ -17363,7 +17369,7 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] =
0, // speed
8*FRACUNIT, // radius
16*FRACUNIT, // height
- 0, // display offset
+ -1, // display offset
0, // mass
0, // damage
sfx_None, // activesound
@@ -19623,7 +19629,7 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] =
0, // reactiontime
sfx_None, // attacksound
S_NULL, // painstate
- 288*FRACUNIT, // painchance
+ 192*FRACUNIT, // painchance
sfx_None, // painsound
S_NULL, // meleestate
S_NULL, // missilestate
@@ -20019,6 +20025,33 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] =
S_NULL // raisestate
},
+ { // MT_KARMAFIREWORK
+ -1, // doomednum
+ S_KARMAFIREWORK1, // spawnstate
+ 1000, // spawnhealth
+ S_NULL, // seestate
+ sfx_None, // seesound
+ 8, // reactiontime
+ sfx_None, // attacksound
+ S_NULL, // painstate
+ 0, // painchance
+ sfx_None, // painsound
+ S_NULL, // meleestate
+ S_NULL, // missilestate
+ S_NULL, // deathstate
+ S_NULL, // xdeathstate
+ sfx_None, // deathsound
+ 0, // speed
+ 8<kartstuff[k_itemtype] = KITEM_JAWZ;
player->kartstuff[k_itemamount] = 2;
break;
+ case KITEM_SPB:
+ case KITEM_SHRINK: // Indirect items
+ indirectitemcooldown = 20*TICRATE;
+ /* FALLTHRU */
default:
if (getitem <= 0 || getitem >= NUMKARTRESULTS) // Sad (Fallback)
{
@@ -664,7 +677,7 @@ static INT32 K_KartGetItemOdds(UINT8 pos, SINT8 item, fixed_t mashed)
{
secondist = P_AproxDistance(P_AproxDistance(players[first].mo->x - players[second].mo->x,
players[first].mo->y - players[second].mo->y),
- players[first].mo->z - players[second].mo->z) / mapheaderinfo[gamemap-1]->mobj_scale;
+ players[first].mo->z - players[second].mo->z) / mapobjectscale;
if (franticitems)
secondist = (15 * secondist) / 14;
secondist = ((28 + (8-pingame)) * secondist) / 28;
@@ -672,6 +685,7 @@ static INT32 K_KartGetItemOdds(UINT8 pos, SINT8 item, fixed_t mashed)
// POWERITEMODDS handles all of the "frantic item" related functionality, for all of our powerful items.
// First, it multiplies it by 2 if franticitems is true; easy-peasy.
+ // Next, it multiplies it again if it's in SPB mode and 2nd needs to apply pressure to 1st.
// Then, it multiplies it further if there's less than 5 players in game.
// This is done to make low player count races more fair & interesting. (2P normal would be about halfway between 8P normal and 8P frantic)
// Lastly, it *divides* it by your mashed value, which was determined in K_KartItemRoulette, to punish those who are impatient.
@@ -705,7 +719,8 @@ static INT32 K_KartGetItemOdds(UINT8 pos, SINT8 item, fixed_t mashed)
break;
case KITEM_SPB:
//POWERITEMODDS(newodds);
- if ((indirectitemcooldown > 0) || (pexiting > 0) || (secondist/distvar < 5))
+ if (((indirectitemcooldown > 0) || (pexiting > 0) || (secondist/distvar < 3))
+ && (pos != 9)) // Force SPB
newodds = 0;
else
newodds *= min((secondist/distvar)-4, 3);
@@ -726,16 +741,16 @@ static INT32 K_KartGetItemOdds(UINT8 pos, SINT8 item, fixed_t mashed)
//{ SRB2kart Roulette Code - Distance Based, no waypoints
-static INT32 K_FindUseodds(player_t *player, fixed_t mashed, INT32 pingame, INT32 bestbumper)
+static INT32 K_FindUseodds(player_t *player, fixed_t mashed, INT32 pingame, INT32 bestbumper, boolean spbrush, boolean dontforcespb)
{
const INT32 distvar = (64*14);
INT32 i;
INT32 pdis = 0, useodds = 0;
UINT8 disttable[14];
UINT8 distlen = 0;
- boolean oddsvalid[9];
+ boolean oddsvalid[10];
- for (i = 0; i < 9; i++)
+ for (i = 0; i < 10; i++)
{
INT32 j;
boolean available = false;
@@ -764,9 +779,9 @@ static INT32 K_FindUseodds(player_t *player, fixed_t mashed, INT32 pingame, INT3
&& players[i].kartstuff[k_position] < player->kartstuff[k_position])
pdis += P_AproxDistance(P_AproxDistance(players[i].mo->x - player->mo->x,
players[i].mo->y - player->mo->y),
- players[i].mo->z - player->mo->z) / mapheaderinfo[gamemap-1]->mobj_scale
+ players[i].mo->z - player->mo->z) / mapobjectscale
* (pingame - players[i].kartstuff[k_position])
- / ((pingame - 1) * (pingame + 1) / 3);
+ / max(1, ((pingame - 1) * (pingame + 1) / 3));
}
#define SETUPDISTTABLE(odds, num) \
@@ -807,12 +822,20 @@ static INT32 K_FindUseodds(player_t *player, fixed_t mashed, INT32 pingame, INT3
if (franticitems) // Frantic items make the distances between everyone artifically higher, for crazier items
pdis = (15 * pdis) / 14;
+
+ if (spbrush) // SPB Rush Mode: It's 2nd place's job to catch-up items and make 1st place's job hell
+ pdis = (3 * pdis) / 2;
+
pdis = ((28 + (8-pingame)) * pdis) / 28;
if (pingame == 1 && oddsvalid[0]) // Record Attack, or just alone
useodds = 0;
- else if (pdis <= 0) // (64*14) * 0 = 0
+ else if (pdis <= 0) // (64*14) * 0 = 0
useodds = disttable[0];
+ else if (player->kartstuff[k_position] == 2 && pdis > (distvar*6)
+ && spbplace == -1 && !indirectitemcooldown && !dontforcespb
+ && oddsvalid[9]) // Force SPB in 2nd
+ useodds = 9;
else if (pdis > distvar * ((12 * distlen) / 14)) // (64*14) * 12 = 10752
useodds = disttable[distlen-1];
else
@@ -845,6 +868,7 @@ static void K_KartItemRoulette(player_t *player, ticcmd_t *cmd)
INT32 chance = 0, numchoices = 0;
INT32 bestbumper = 0;
fixed_t mashed = 0;
+ boolean dontforcespb = false;
// This makes the roulette cycle through items - if this is 0, you shouldn't be here.
if (player->kartstuff[k_itemroulette])
@@ -858,6 +882,8 @@ static void K_KartItemRoulette(player_t *player, ticcmd_t *cmd)
if (!playeringame[i] || players[i].spectator)
continue;
pingame++;
+ if (players[i].exiting)
+ dontforcespb = true;
if (players[i].kartstuff[k_bumper] > bestbumper)
bestbumper = players[i].kartstuff[k_bumper];
}
@@ -913,6 +939,8 @@ static void K_KartItemRoulette(player_t *player, ticcmd_t *cmd)
if (player->kartstuff[k_roulettetype] == 2) // Fake items
{
player->kartstuff[k_eggmanexplode] = 4*TICRATE;
+ //player->kartstuff[k_itemblink] = TICRATE;
+ //player->kartstuff[k_itemblinkmode] = 1;
player->kartstuff[k_itemroulette] = 0;
player->kartstuff[k_roulettetype] = 0;
if (P_IsLocalPlayer(player))
@@ -924,6 +952,8 @@ static void K_KartItemRoulette(player_t *player, ticcmd_t *cmd)
{
K_KartGetItemResult(player, cv_kartdebugitem.value);
player->kartstuff[k_itemamount] = cv_kartdebugamount.value;
+ player->kartstuff[k_itemblink] = TICRATE;
+ player->kartstuff[k_itemblinkmode] = 2;
player->kartstuff[k_itemroulette] = 0;
player->kartstuff[k_roulettetype] = 0;
if (P_IsLocalPlayer(player))
@@ -936,7 +966,7 @@ static void K_KartItemRoulette(player_t *player, ticcmd_t *cmd)
spawnchance[i] = 0;
// Split into another function for a debug function below
- useodds = K_FindUseodds(player, mashed, pingame, bestbumper);
+ useodds = K_FindUseodds(player, mashed, pingame, bestbumper, (spbplace != -1 && player->kartstuff[k_position] == spbplace+1), dontforcespb);
#define SETITEMRESULT(itemnum) \
for (chance = 0; chance < K_KartGetItemOdds(useodds, itemnum, mashed); chance++) \
@@ -956,11 +986,14 @@ static void K_KartItemRoulette(player_t *player, ticcmd_t *cmd)
player->kartstuff[k_itemamount] = 1;
}
+ if (P_IsLocalPlayer(player))
+ S_StartSound(NULL, ((player->kartstuff[k_roulettetype] == 1) ? sfx_itrolk : (mashed ? sfx_itrolm : sfx_itrolf)));
+
+ player->kartstuff[k_itemblink] = TICRATE;
+ player->kartstuff[k_itemblinkmode] = ((player->kartstuff[k_roulettetype] == 1) ? 2 : (mashed ? 1 : 0));
+
player->kartstuff[k_itemroulette] = 0; // Since we're done, clear the roulette number
player->kartstuff[k_roulettetype] = 0; // This too
-
- if (P_IsLocalPlayer(player))
- S_StartSound(NULL, sfx_itrolf);
}
//}
@@ -1059,13 +1092,13 @@ void K_KartBouncing(mobj_t *mobj1, mobj_t *mobj2, boolean bounce, boolean solid)
momdify = mobj1->momy - mobj2->momy;
// if the speed difference is less than this let's assume they're going proportionately faster from each other
- if (P_AproxDistance(momdifx, momdify) < (25*mapheaderinfo[gamemap-1]->mobj_scale))
+ if (P_AproxDistance(momdifx, momdify) < (25*mapobjectscale))
{
fixed_t momdiflength = P_AproxDistance(momdifx, momdify);
fixed_t normalisedx = FixedDiv(momdifx, momdiflength);
fixed_t normalisedy = FixedDiv(momdify, momdiflength);
- momdifx = FixedMul((25*mapheaderinfo[gamemap-1]->mobj_scale), normalisedx);
- momdify = FixedMul((25*mapheaderinfo[gamemap-1]->mobj_scale), normalisedy);
+ momdifx = FixedMul((25*mapobjectscale), normalisedx);
+ momdify = FixedMul((25*mapobjectscale), normalisedy);
}
// Adds the OTHER player's momentum, so that it reduces the chance of you being "inside" the other object
@@ -1226,8 +1259,6 @@ static void K_UpdateOffroad(player_t *player)
if (player->kartstuff[k_offroad] > 0)
{
- if (kartweight < 1) { kartweight = 1; } if (kartweight > 9) { kartweight = 9; } // Safety Net
-
// 1872 is the magic number - 35 frames adds up to approximately 65536. 1872/4 = 468/3 = 156
// A higher kart weight means you can stay offroad for longer without losing speed
offroad = (1872 + 5*156 - kartweight*156)*offroadstrength;
@@ -1373,10 +1404,10 @@ void K_RespawnChecker(player_t *player)
{
if (player->kartstuff[k_growshrinktimer] < 0)
{
- player->mo->scalespeed = mapheaderinfo[gamemap-1]->mobj_scale/TICRATE;
- player->mo->destscale = 6*(mapheaderinfo[gamemap-1]->mobj_scale)/8;
+ player->mo->scalespeed = mapobjectscale/TICRATE;
+ player->mo->destscale = (6*mapobjectscale)/8;
if (cv_kartdebugshrink.value && !modeattacking && !player->bot)
- player->mo->destscale = 6*player->mo->destscale/8;
+ player->mo->destscale = (6*player->mo->destscale)/8;
}
if (!P_IsObjectOnGround(player->mo) && !mapreset)
@@ -1595,7 +1626,10 @@ static void K_GetKartBoostPower(player_t *player)
boostpower = 4*boostpower/5;
// Banana drag/offroad dust
- if (boostpower < FRACUNIT)
+ if (boostpower < FRACUNIT
+ && player->mo && P_IsObjectOnGround(player->mo)
+ && player->speed > 0
+ && !player->spectator)
{
K_SpawnWipeoutTrail(player->mo, true);
if (leveltime % 6 == 0)
@@ -1665,7 +1699,7 @@ fixed_t K_GetKartSpeed(player_t *player, boolean doboostpower)
fixed_t finalspeed;
if (doboostpower && !player->kartstuff[k_pogospring] && !P_IsObjectOnGround(player->mo))
- return (75*mapheaderinfo[gamemap-1]->mobj_scale); // air speed cap
+ return (75*mapobjectscale); // air speed cap
switch (gamespeed)
{
@@ -1730,7 +1764,7 @@ fixed_t K_3dKartMovement(player_t *player, boolean onground, fixed_t forwardmove
if (player->kartstuff[k_pogospring]) // Pogo Spring minimum/maximum thrust
{
- const fixed_t hscale = mapheaderinfo[gamemap-1]->mobj_scale /*+ (mapheaderinfo[gamemap-1]->mobj_scale - player->mo->scale)*/;
+ const fixed_t hscale = mapobjectscale /*+ (mapobjectscale - player->mo->scale)*/;
const fixed_t minspeed = 24*hscale;
const fixed_t maxspeed = 28*hscale;
@@ -1806,9 +1840,25 @@ void K_SpawnBattlePoints(player_t *source, player_t *victim, UINT8 amount)
pt->color = source->skincolor;
}
-void K_SpinPlayer(player_t *player, mobj_t *source, INT32 type, boolean trapitem)
+void K_SpinPlayer(player_t *player, mobj_t *source, INT32 type, mobj_t *inflictor, boolean trapitem)
{
UINT8 scoremultiply = 1;
+ // PS: Inflictor is unused for all purposes here and is actually only ever relevant to Lua. It may be nil too.
+#ifdef HAVE_BLUA
+ boolean force = false; // Used to check if Lua ShouldSpin should get us damaged reguardless of flashtics or heck knows what.
+ UINT8 shouldForce = LUAh_ShouldSpin(player, inflictor, source);
+ if (P_MobjWasRemoved(player->mo))
+ return; // mobj was removed (in theory that shouldn't happen)
+ if (shouldForce == 1)
+ force = true;
+ else if (shouldForce == 2)
+ return;
+#else
+ static const boolean force = false;
+ (void)inflictor; // in case some weirdo doesn't want Lua.
+#endif
+
+
if (!trapitem && G_BattleGametype())
{
if (K_IsPlayerWanted(player))
@@ -1824,16 +1874,26 @@ void K_SpinPlayer(player_t *player, mobj_t *source, INT32 type, boolean trapitem
|| player->kartstuff[k_invincibilitytimer] > 0 || player->kartstuff[k_growshrinktimer] > 0 || player->kartstuff[k_hyudorotimer] > 0
|| (G_BattleGametype() && ((player->kartstuff[k_bumper] <= 0 && player->kartstuff[k_comebacktimer]) || player->kartstuff[k_comebackmode] == 1)))
{
- K_DoInstashield(player);
- return;
+ if (!force) // if shoulddamage force, we go THROUGH that.
+ {
+ K_DoInstashield(player);
+ return;
+ }
}
+ if (LUAh_PlayerSpin(player, inflictor, source)) // Let Lua do its thing or overwrite if it wants to. Make sure to let any possible instashield happen because we didn't get "damaged" in this case.
+ return;
+
if (source && source != player->mo && source->player)
K_PlayHitEmSound(source);
//player->kartstuff[k_sneakertimer] = 0;
player->kartstuff[k_driftboost] = 0;
+ player->kartstuff[k_drift] = 0;
+ player->kartstuff[k_driftcharge] = 0;
+ player->kartstuff[k_pogospring] = 0;
+
if (G_BattleGametype())
{
if (source && source->player && player != source->player)
@@ -1900,9 +1960,36 @@ void K_SpinPlayer(player_t *player, mobj_t *source, INT32 type, boolean trapitem
return;
}
-void K_SquishPlayer(player_t *player, mobj_t *source)
+static void K_RemoveGrowShrink(player_t *player)
+{
+ player->kartstuff[k_growshrinktimer] = 0;
+ if (player->kartstuff[k_invincibilitytimer] == 0)
+ player->mo->color = player->skincolor;
+ player->mo->scalespeed = mapobjectscale/TICRATE;
+ player->mo->destscale = mapobjectscale;
+ if (cv_kartdebugshrink.value && !modeattacking && !player->bot)
+ player->mo->destscale = (6*player->mo->destscale)/8;
+ P_RestoreMusic(player);
+}
+
+void K_SquishPlayer(player_t *player, mobj_t *source, mobj_t *inflictor)
{
UINT8 scoremultiply = 1;
+ // PS: Inflictor is unused for all purposes here and is actually only ever relevant to Lua. It may be nil too.
+#ifdef HAVE_BLUA
+ boolean force = false; // Used to check if Lua ShouldSquish should get us damaged reguardless of flashtics or heck knows what.
+ UINT8 shouldForce = LUAh_ShouldSquish(player, inflictor, source);
+ if (P_MobjWasRemoved(player->mo))
+ return; // mobj was removed (in theory that shouldn't happen)
+ if (shouldForce == 1)
+ force = true;
+ else if (shouldForce == 2)
+ return;
+#else
+ static const boolean force = false;
+ (void)inflictor; // Please stop forgetting to put inflictor in yer functions thank -Lat'
+#endif
+
if (G_BattleGametype())
{
if (K_IsPlayerWanted(player))
@@ -1918,13 +2005,23 @@ void K_SquishPlayer(player_t *player, mobj_t *source)
|| player->kartstuff[k_growshrinktimer] > 0 || player->kartstuff[k_hyudorotimer] > 0
|| (G_BattleGametype() && ((player->kartstuff[k_bumper] <= 0 && player->kartstuff[k_comebacktimer]) || player->kartstuff[k_comebackmode] == 1)))
{
- K_DoInstashield(player);
- return;
+ if (!force) // You know the drill by now.
+ {
+ K_DoInstashield(player);
+ return;
+ }
}
+ if (LUAh_PlayerSquish(player, inflictor, source)) // Let Lua do its thing or overwrite if it wants to. Make sure to let any possible instashield happen because we didn't get "damaged" in this case.
+ return;
+
player->kartstuff[k_sneakertimer] = 0;
player->kartstuff[k_driftboost] = 0;
+ player->kartstuff[k_drift] = 0;
+ player->kartstuff[k_driftcharge] = 0;
+ player->kartstuff[k_pogospring] = 0;
+
if (G_BattleGametype())
{
if (source && source->player && player != source->player)
@@ -1966,6 +2063,14 @@ void K_SquishPlayer(player_t *player, mobj_t *source)
player->kartstuff[k_squishedtimer] = TICRATE;
+ // Reduce Shrink timer
+ if (player->kartstuff[k_growshrinktimer] < 0)
+ {
+ player->kartstuff[k_growshrinktimer] += TICRATE;
+ if (player->kartstuff[k_growshrinktimer] >= 0)
+ K_RemoveGrowShrink(player);
+ }
+
player->powers[pw_flashing] = K_GetKartFlashing(player);
player->mo->flags |= MF_NOCLIP;
@@ -1986,6 +2091,19 @@ void K_SquishPlayer(player_t *player, mobj_t *source)
void K_ExplodePlayer(player_t *player, mobj_t *source, mobj_t *inflictor) // A bit of a hack, we just throw the player up higher here and extend their spinout timer
{
UINT8 scoremultiply = 1;
+#ifdef HAVE_BLUA
+ boolean force = false; // Used to check if Lua ShouldExplode should get us damaged reguardless of flashtics or heck knows what.
+ UINT8 shouldForce = LUAh_ShouldExplode(player, inflictor, source);
+ if (P_MobjWasRemoved(player->mo))
+ return; // mobj was removed (in theory that shouldn't happen)
+ if (shouldForce == 1)
+ force = true;
+ else if (shouldForce == 2)
+ return;
+
+#else
+ static const boolean force = false;
+#endif
if (G_BattleGametype())
{
if (K_IsPlayerWanted(player))
@@ -2001,19 +2119,29 @@ void K_ExplodePlayer(player_t *player, mobj_t *source, mobj_t *inflictor) // A b
||*/player->kartstuff[k_invincibilitytimer] > 0 || player->kartstuff[k_growshrinktimer] > 0 || player->kartstuff[k_hyudorotimer] > 0
|| (G_BattleGametype() && ((player->kartstuff[k_bumper] <= 0 && player->kartstuff[k_comebacktimer]) || player->kartstuff[k_comebackmode] == 1)))
{
- K_DoInstashield(player);
- return;
+ if (!force) // ShouldDamage can bypass that, again.
+ {
+ K_DoInstashield(player);
+ return;
+ }
}
+ if (LUAh_PlayerExplode(player, inflictor, source)) // Same thing. Also make sure to let Instashield happen blah blah
+ return;
+
if (source && source != player->mo && source->player)
K_PlayHitEmSound(source);
- player->mo->momz = 18*(mapheaderinfo[gamemap-1]->mobj_scale);
+ player->mo->momz = 18*mapobjectscale;
player->mo->momx = player->mo->momy = 0;
player->kartstuff[k_sneakertimer] = 0;
player->kartstuff[k_driftboost] = 0;
+ player->kartstuff[k_drift] = 0;
+ player->kartstuff[k_driftcharge] = 0;
+ player->kartstuff[k_pogospring] = 0;
+
// This is the only part that SHOULDN'T combo :VVVVV
if (G_BattleGametype() && !(player->powers[pw_flashing] > 0 || player->kartstuff[k_squishedtimer] > 0 || player->kartstuff[k_spinouttimer] > 0))
{
@@ -2307,25 +2435,25 @@ void K_SpawnMineExplosion(mobj_t *source, UINT8 color)
}
}
-static mobj_t *K_SpawnKartMissile(mobj_t *source, mobjtype_t type, angle_t angle, INT32 flags2, fixed_t speed)
+static mobj_t *K_SpawnKartMissile(mobj_t *source, mobjtype_t type, angle_t an, INT32 flags2, fixed_t speed)
{
mobj_t *th;
- angle_t an;
fixed_t x, y, z;
fixed_t finalspeed = speed;
mobj_t *throwmo;
- //INT32 dir;
-
- // angle at which you fire, is player angle
- an = angle;
-
- //if (source->player->kartstuff[k_throwdir] != 0)
- // dir = source->player->kartstuff[k_throwdir];
- //else
- // dir = 1;
if (source->player && source->player->speed > K_GetKartSpeed(source->player, false))
- finalspeed = FixedMul(speed, FixedDiv(source->player->speed, K_GetKartSpeed(source->player, false)));
+ {
+ angle_t input = source->angle - an;
+ boolean invert = (input > ANGLE_180);
+ if (invert)
+ input = InvAngle(input);
+
+ finalspeed = max(speed, FixedMul(speed, FixedMul(
+ FixedDiv(source->player->speed, K_GetKartSpeed(source->player, false)), // Multiply speed to be proportional to your own, boosted maxspeed.
+ (((180<x + source->momx + FixedMul(finalspeed, FINECOSINE(an>>ANGLETOFINESHIFT));
y = source->y + source->momy + FixedMul(finalspeed, FINESINE(an>>ANGLETOFINESHIFT));
@@ -2342,15 +2470,8 @@ static mobj_t *K_SpawnKartMissile(mobj_t *source, mobjtype_t type, angle_t angle
th->threshold = 10;
-#ifdef WEAPON_SFX
- //Since rail and bounce have no thrown objects, this hack is necessary.
- //Is creating thrown objects for rail and bounce more or less desirable than this?
- if (th->info->seesound && !(th->flags2 & MF2_RAILRING) && !(th->flags2 & MF2_SCATTER))
- S_StartSound(source, th->info->seesound);
-#else
if (th->info->seesound)
S_StartSound(source, th->info->seesound);
-#endif
P_SetTarget(&th->target, source);
@@ -2380,6 +2501,7 @@ static mobj_t *K_SpawnKartMissile(mobj_t *source, mobjtype_t type, angle_t angle
th->color = source->player->skincolor;
else
th->color = SKINCOLOR_GREY;
+ th->movefactor = finalspeed;
break;
case MT_JAWZ:
if (source && source->player)
@@ -2389,6 +2511,9 @@ static mobj_t *K_SpawnKartMissile(mobj_t *source, mobjtype_t type, angle_t angle
/* FALLTHRU */
case MT_JAWZ_DUD:
S_StartSound(th, th->info->activesound);
+ /* FALLTHRU */
+ case MT_SPB:
+ th->movefactor = finalspeed;
break;
default:
break;
@@ -2629,6 +2754,13 @@ void K_SpawnWipeoutTrail(mobj_t *mo, boolean translucent)
P_SetScale(dust, mo->scale);
dust->eflags = (dust->eflags & ~MFE_VERTICALFLIP)|(mo->eflags & MFE_VERTICALFLIP); // not K_MatchGenericExtraFlags because hyudoro shouldn't be able to wipeout
+ if (translucent) // offroad effect
+ {
+ dust->momx = mo->momx/2;
+ dust->momy = mo->momy/2;
+ dust->momz = mo->momz/2;
+ }
+
if (translucent)
dust->flags2 |= MF2_SHADOW;
}
@@ -2731,17 +2863,29 @@ static mobj_t *K_ThrowKartItem(player_t *player, boolean missile, mobjtype_t map
return NULL;
// Figure out projectile speed by game speed
- switch (gamespeed)
+ if (missile && mapthing != MT_BALLHOG) // Trying to keep compatability...
{
- case 0:
- PROJSPEED = 68*(mapheaderinfo[gamemap-1]->mobj_scale); // Avg Speed is 34
- break;
- case 2:
- PROJSPEED = 96*(mapheaderinfo[gamemap-1]->mobj_scale); // Avg Speed is 48
- break;
- default:
- PROJSPEED = 82*(mapheaderinfo[gamemap-1]->mobj_scale); // Avg Speed is 41
- break;
+ PROJSPEED = mobjinfo[mapthing].speed;
+ if (gamespeed == 0)
+ PROJSPEED = FixedMul(PROJSPEED, FRACUNIT-FRACUNIT/4);
+ else if (gamespeed == 2)
+ PROJSPEED = FixedMul(PROJSPEED, FRACUNIT+FRACUNIT/4);
+ PROJSPEED = FixedMul(PROJSPEED, mapobjectscale);
+ }
+ else
+ {
+ switch (gamespeed)
+ {
+ case 0:
+ PROJSPEED = 68*mapobjectscale; // Avg Speed is 34
+ break;
+ case 2:
+ PROJSPEED = 96*mapobjectscale; // Avg Speed is 48
+ break;
+ default:
+ PROJSPEED = 82*mapobjectscale; // Avg Speed is 41
+ break;
+ }
}
if (altthrow)
@@ -2801,7 +2945,7 @@ static mobj_t *K_ThrowKartItem(player_t *player, boolean missile, mobjtype_t map
if (dir == -1 && mapthing != MT_SPB)
{
// Shoot backward
- mo = K_SpawnKartMissile(player->mo, mapthing, player->mo->angle + ANGLE_180, 0, PROJSPEED/4);
+ mo = K_SpawnKartMissile(player->mo, mapthing, player->mo->angle + ANGLE_180, 0, PROJSPEED/2);
}
else
{
@@ -2827,7 +2971,7 @@ static mobj_t *K_ThrowKartItem(player_t *player, boolean missile, mobjtype_t map
if (mo)
{
angle_t fa = player->mo->angle>>ANGLETOFINESHIFT;
- INT32 HEIGHT = (20 + (dir*10))*(mapheaderinfo[gamemap-1]->mobj_scale) + player->mo->momz;
+ INT32 HEIGHT = (20 + (dir*10))*mapobjectscale + player->mo->momz;
mo->momx = player->mo->momx + FixedMul(FINECOSINE(fa), (altthrow == 2 ? 2*PROJSPEED/3 : PROJSPEED));
mo->momy = player->mo->momy + FixedMul(FINESINE(fa), (altthrow == 2 ? 2*PROJSPEED/3 : PROJSPEED));
@@ -2978,7 +3122,8 @@ static void K_DoHyudoroSteal(player_t *player)
// Has an item
&& (players[i].kartstuff[k_itemtype]
&& players[i].kartstuff[k_itemamount]
- && !players[i].kartstuff[k_itemheld]))
+ && !players[i].kartstuff[k_itemheld]
+ && !players[i].kartstuff[k_itemblink]))
{
playerswappable[numplayers] = i;
numplayers++;
@@ -3094,65 +3239,49 @@ void K_DoSneaker(player_t *player, INT32 type)
}
}
-static void K_DoShrink(player_t *player)
+static void K_DoShrink(player_t *user)
{
INT32 i;
- S_StartSound(player->mo, sfx_kc46); // Sound the BANG!
- player->pflags |= PF_ATTACKDOWN;
+ S_StartSound(user->mo, sfx_kc46); // Sound the BANG!
+ user->pflags |= PF_ATTACKDOWN;
for (i = 0; i < MAXPLAYERS; i++)
{
- if (!playeringame[i] || player->spectator || !players[i].mo)
+ if (!playeringame[i] || players[i].spectator || !players[i].mo)
continue;
- if (&players[i] == player)
+ if (&players[i] == user)
continue;
- if (players[i].kartstuff[k_position] < player->kartstuff[k_position])
+ if (players[i].kartstuff[k_position] < user->kartstuff[k_position])
{
- //P_FlashPal(&players[i], PAL_NUKE, 10);
-
- if (!player->kartstuff[k_invincibilitytimer] // Don't hit while invulnerable!
- && player->kartstuff[k_growshrinktimer] <= 0)
+ // Don't hit while invulnerable!
+ if (!players[i].kartstuff[k_invincibilitytimer]
+ && players[i].kartstuff[k_growshrinktimer] <= 0
+ && !players[i].kartstuff[k_hyudorotimer])
{
// Start shrinking!
- players[i].mo->scalespeed = mapheaderinfo[gamemap-1]->mobj_scale/TICRATE;
- players[i].mo->destscale = 6*(mapheaderinfo[gamemap-1]->mobj_scale)/8;
- if (cv_kartdebugshrink.value && !modeattacking && !players[i].bot)
- players[i].mo->destscale = 6*players[i].mo->destscale/8;
-
- // Wipeout
K_DropItems(&players[i]);
- K_SpinPlayer(&players[i], player->mo, 1, false);
-
- // P_RingDamage
- P_DoPlayerPain(&players[i], player->mo, player->mo);
- P_ForceFeed(&players[i], 40, 10, TICRATE, 40 + min((players[i].mo->health-1), 100)*2);
- P_PlayRinglossSound(players[i].mo); // Ringledingle!
-
- P_PlayerRingBurst(&players[i], 5);
- players[i].mo->momx = players[i].mo->momy = 0;
- if (P_IsLocalPlayer(&players[i]))
- {
- quake.intensity = 32*FRACUNIT;
- quake.time = 5;
- }
-
- players[i].kartstuff[k_growshrinktimer] -= (200+(40*(16-players[i].kartstuff[k_position])));
- players[i].kartstuff[k_sneakertimer] = 0;
+ players[i].mo->scalespeed = mapobjectscale/TICRATE;
+ players[i].mo->destscale = (6*mapobjectscale)/8;
+ if (cv_kartdebugshrink.value && !modeattacking && !players[i].bot)
+ players[i].mo->destscale = (6*players[i].mo->destscale)/8;
+ players[i].kartstuff[k_growshrinktimer] = -(200+(40*(MAXPLAYERS-players[i].kartstuff[k_position])));
}
// Grow should get taken away.
if (players[i].kartstuff[k_growshrinktimer] > 0)
- players[i].kartstuff[k_growshrinktimer] = 2;
+ K_RemoveGrowShrink(&players[i]);
+ //P_FlashPal(&players[i], PAL_NUKE, 10);
S_StartSound(players[i].mo, sfx_kc59);
}
}
}
+
void K_DoPogoSpring(mobj_t *mo, fixed_t vertispeed, UINT8 sound)
{
- const fixed_t vscale = mapheaderinfo[gamemap-1]->mobj_scale + (mo->scale - mapheaderinfo[gamemap-1]->mobj_scale);
+ const fixed_t vscale = mapobjectscale + (mo->scale - mapobjectscale);
if (mo->player && mo->player->spectator)
return;
@@ -3350,8 +3479,8 @@ void K_DropHnextList(player_t *player)
dropwork->z += flip;
dropwork->momx = player->mo->momx>>1;
dropwork->momy = player->mo->momy>>1;
- dropwork->momz = 3*flip*mapheaderinfo[gamemap-1]->mobj_scale;
- P_Thrust(dropwork, work->angle - ANGLE_90, 6*(mapheaderinfo[gamemap-1]->mobj_scale));
+ dropwork->momz = 3*flip*mapobjectscale;
+ P_Thrust(dropwork, work->angle - ANGLE_90, 6*mapobjectscale);
dropwork->movecount = 2;
dropwork->movedir = work->angle - ANGLE_90;
P_SetMobjState(dropwork, dropwork->info->deathstate);
@@ -3407,8 +3536,8 @@ void K_DropItems(player_t *player)
drop->angle = player->mo->angle + ANGLE_90;
P_Thrust(drop,
FixedAngle(P_RandomFixed()*180) + player->mo->angle + ANGLE_90,
- 16*(mapheaderinfo[gamemap-1]->mobj_scale));
- drop->momz = P_MobjFlip(player->mo)*3*(mapheaderinfo[gamemap-1]->mobj_scale);
+ 16*mapobjectscale);
+ drop->momz = P_MobjFlip(player->mo)*3*mapobjectscale;
drop->threshold = (thunderhack ? KITEM_THUNDERSHIELD : player->kartstuff[k_itemtype]);
drop->movecount = player->kartstuff[k_itemamount];
@@ -3830,12 +3959,24 @@ player_t *K_FindJawzTarget(mobj_t *actor, player_t *source)
static void K_UpdateEngineSounds(player_t *player, ticcmd_t *cmd)
{
const INT32 numsnds = 13;
- INT32 class = ((player->kartspeed-1)/3) + (3*((player->kartweight-1)/3)); // engine class number
+ INT32 class, s, w; // engine class number
UINT8 volume = 255;
fixed_t volumedampen = 0;
INT32 targetsnd = 0;
INT32 i;
+ s = (player->kartspeed-1)/3;
+ w = (player->kartweight-1)/3;
+
+#define LOCKSTAT(stat) \
+ if (stat < 0) { stat = 0; } \
+ if (stat > 2) { stat = 2; }
+ LOCKSTAT(s);
+ LOCKSTAT(w);
+#undef LOCKSTAT
+
+ class = s+(3*w);
+
// Silence the engines
if (leveltime < 8 || player->spectator || player->exiting)
{
@@ -3853,7 +3994,7 @@ static void K_UpdateEngineSounds(player_t *player, ticcmd_t *cmd)
if ((leveltime >= starttime-(2*TICRATE) && leveltime <= starttime) || (player->kartstuff[k_respawn] == 1)) // Startup boosts
targetsnd = ((cmd->buttons & BT_ACCELERATE) ? 12 : 0);
else
- targetsnd = (((6*cmd->forwardmove)/25) + ((player->speed / mapheaderinfo[gamemap-1]->mobj_scale)/5))/2;
+ targetsnd = (((6*cmd->forwardmove)/25) + ((player->speed / mapobjectscale)/5))/2;
if (targetsnd < 0)
targetsnd = 0;
@@ -3890,6 +4031,8 @@ static void K_UpdateEngineSounds(player_t *player, ticcmd_t *cmd)
dist = P_AproxDistance(P_AproxDistance(player->mo->x-players[i].mo->x,
player->mo->y-players[i].mo->y), player->mo->z-players[i].mo->z) / 2;
+ dist = FixedDiv(dist, mapobjectscale);
+
if (dist > 1536<kartstuff[k_lapanimation])
+ player->kartstuff[k_lapanimation]--;
+
+ if (player->kartstuff[k_yougotem])
+ player->kartstuff[k_yougotem]--;
+
+ if (G_BattleGametype() && (player->exiting || player->kartstuff[k_comebacktimer]))
+ {
+ if (player->exiting)
+ {
+ if (player->exiting < 6*TICRATE)
+ player->kartstuff[k_cardanimation] += ((164-player->kartstuff[k_cardanimation])/8)+1;
+ else if (player->exiting == 6*TICRATE)
+ player->kartstuff[k_cardanimation] = 0;
+ else if (player->kartstuff[k_cardanimation] < 2*TICRATE)
+ player->kartstuff[k_cardanimation]++;
+ }
+ else
+ {
+ if (player->kartstuff[k_comebacktimer] < 6*TICRATE)
+ player->kartstuff[k_cardanimation] -= ((164-player->kartstuff[k_cardanimation])/8)+1;
+ else if (player->kartstuff[k_comebacktimer] < 9*TICRATE)
+ player->kartstuff[k_cardanimation] += ((164-player->kartstuff[k_cardanimation])/8)+1;
+ }
+
+ if (player->kartstuff[k_cardanimation] > 164)
+ player->kartstuff[k_cardanimation] = 164;
+ if (player->kartstuff[k_cardanimation] < 0)
+ player->kartstuff[k_cardanimation] = 0;
+ }
+ else if (G_RaceGametype() && player->exiting)
+ {
+ if (player->kartstuff[k_cardanimation] < 2*TICRATE)
+ player->kartstuff[k_cardanimation]++;
+ }
+ else
+ player->kartstuff[k_cardanimation] = 0;
+}
+
/** \brief Decreases various kart timers and powers per frame. Called in P_PlayerThink in p_user.c
\param player player object passed from P_PlayerThink
@@ -4117,22 +4301,16 @@ void K_KartPlayerThink(player_t *player, ticcmd_t *cmd)
if (player->kartstuff[k_invincibilitytimer])
player->kartstuff[k_invincibilitytimer]--;
- if (!player->kartstuff[k_respawn])
+ if (!player->kartstuff[k_respawn] && player->kartstuff[k_growshrinktimer] != 0)
{
if (player->kartstuff[k_growshrinktimer] > 0)
player->kartstuff[k_growshrinktimer]--;
if (player->kartstuff[k_growshrinktimer] < 0)
player->kartstuff[k_growshrinktimer]++;
- }
- if (player->kartstuff[k_growshrinktimer] == 1 || player->kartstuff[k_growshrinktimer] == -1)
- {
- if (player->kartstuff[k_invincibilitytimer] == 0)
- player->mo->color = player->skincolor;
- player->mo->destscale = mapheaderinfo[gamemap-1]->mobj_scale;
- if (cv_kartdebugshrink.value && !modeattacking && !player->bot)
- player->mo->destscale = 6*player->mo->destscale/8;
- P_RestoreMusic(player);
+ // Back to normal
+ if (player->kartstuff[k_growshrinktimer] == 0)
+ K_RemoveGrowShrink(player);
}
if (player->kartstuff[k_stealingtimer] == 0 && player->kartstuff[k_stolentimer] == 0
@@ -4157,43 +4335,14 @@ void K_KartPlayerThink(player_t *player, ticcmd_t *cmd)
if (player->kartstuff[k_justbumped])
player->kartstuff[k_justbumped]--;
- if (player->kartstuff[k_lapanimation])
- player->kartstuff[k_lapanimation]--;
-
- if (player->kartstuff[k_yougotem])
- player->kartstuff[k_yougotem]--;
-
- if (G_BattleGametype() && (player->exiting || player->kartstuff[k_comebacktimer]))
+ // This doesn't go in HUD update because it has potential gameplay ramifications
+ if (player->kartstuff[k_itemblink] && player->kartstuff[k_itemblink]-- <= 0)
{
- if (player->exiting)
- {
- if (player->exiting < 6*TICRATE)
- player->kartstuff[k_cardanimation] += ((164-player->kartstuff[k_cardanimation])/8)+1;
- else if (player->exiting == 6*TICRATE)
- player->kartstuff[k_cardanimation] = 0;
- else if (player->kartstuff[k_cardanimation] < 2*TICRATE)
- player->kartstuff[k_cardanimation]++;
- }
- else
- {
- if (player->kartstuff[k_comebacktimer] < 6*TICRATE)
- player->kartstuff[k_cardanimation] -= ((164-player->kartstuff[k_cardanimation])/8)+1;
- else if (player->kartstuff[k_comebacktimer] < 9*TICRATE)
- player->kartstuff[k_cardanimation] += ((164-player->kartstuff[k_cardanimation])/8)+1;
- }
+ player->kartstuff[k_itemblinkmode] = 0;
+ player->kartstuff[k_itemblink] = 0;
+ }
- if (player->kartstuff[k_cardanimation] > 164)
- player->kartstuff[k_cardanimation] = 164;
- if (player->kartstuff[k_cardanimation] < 0)
- player->kartstuff[k_cardanimation] = 0;
- }
- else if (G_RaceGametype() && player->exiting)
- {
- if (player->kartstuff[k_cardanimation] < 2*TICRATE)
- player->kartstuff[k_cardanimation]++;
- }
- else
- player->kartstuff[k_cardanimation] = 0;
+ K_KartPlayerHUDUpdate(player);
if (player->kartstuff[k_voices])
player->kartstuff[k_voices]--;
@@ -4266,7 +4415,10 @@ void K_KartPlayerThink(player_t *player, ticcmd_t *cmd)
// Plays the music after the starting countdown.
if (P_IsLocalPlayer(player) && leveltime == (starttime + (TICRATE/2)))
- S_ChangeMusicInternal(mapmusname, true);
+ {
+ S_ChangeMusic(mapmusname, mapmusflags, true);
+ S_ShowMusicCredit();
+ }
}
void K_KartPlayerAfterThink(player_t *player)
@@ -4407,6 +4559,7 @@ INT32 K_GetKartDriftSparkValue(player_t *player)
static void K_KartDrift(player_t *player, boolean onground)
{
+ fixed_t minspeed = (10 * player->mo->scale);
INT32 dsone = K_GetKartDriftSparkValue(player);
INT32 dstwo = dsone*2;
INT32 dsthree = dstwo*2;
@@ -4457,14 +4610,14 @@ static void K_KartDrift(player_t *player, boolean onground)
}
// Drifting: left or right?
- if ((player->cmd.driftturn > 0) && player->speed > FixedMul(10<<16, player->mo->scale) && player->kartstuff[k_jmp] == 1
+ if ((player->cmd.driftturn > 0) && player->speed > minspeed && player->kartstuff[k_jmp] == 1
&& (player->kartstuff[k_drift] == 0 || player->kartstuff[k_driftend] == 1)) // && player->kartstuff[k_drift] != 1)
{
// Starting left drift
player->kartstuff[k_drift] = 1;
player->kartstuff[k_driftend] = player->kartstuff[k_driftcharge] = 0;
}
- else if ((player->cmd.driftturn < 0) && player->speed > FixedMul(10<<16, player->mo->scale) && player->kartstuff[k_jmp] == 1
+ else if ((player->cmd.driftturn < 0) && player->speed > minspeed && player->kartstuff[k_jmp] == 1
&& (player->kartstuff[k_drift] == 0 || player->kartstuff[k_driftend] == 1)) // && player->kartstuff[k_drift] != -1)
{
// Starting right drift
@@ -4488,6 +4641,8 @@ static void K_KartDrift(player_t *player, boolean onground)
player->kartstuff[k_driftend] = 0;
}
+
+
// Incease/decrease the drift value to continue drifting in that direction
if (player->kartstuff[k_spinouttimer] == 0 && player->kartstuff[k_jmp] == 1 && onground && player->kartstuff[k_drift] != 0)
{
@@ -4516,6 +4671,12 @@ static void K_KartDrift(player_t *player, boolean onground)
driftadditive -= abs(player->cmd.driftturn)/75;
}
+ // Disable drift-sparks until you're going fast enough
+ if (player->kartstuff[k_getsparks] == 0)
+ driftadditive = 0;
+ if (player->speed > minspeed*2)
+ player->kartstuff[k_getsparks] = 1;
+
// This spawns the drift sparks
if (player->kartstuff[k_driftcharge] + driftadditive >= dsone)
K_SpawnDriftSparks(player);
@@ -4535,11 +4696,11 @@ static void K_KartDrift(player_t *player, boolean onground)
}
// Stop drifting
- if (player->kartstuff[k_spinouttimer] > 0 // banana peel
- || player->speed < FixedMul(10<<16, player->mo->scale)) // you're too slow!
+ if (player->kartstuff[k_spinouttimer] > 0 || player->speed < minspeed)
{
player->kartstuff[k_drift] = player->kartstuff[k_driftcharge] = 0;
player->kartstuff[k_aizdriftstrat] = player->kartstuff[k_brakedrift] = 0;
+ player->kartstuff[k_getsparks] = 0;
}
if ((!player->kartstuff[k_sneakertimer])
@@ -4569,7 +4730,7 @@ static void K_KartDrift(player_t *player, boolean onground)
//
// K_KartUpdatePosition
//
-static void K_KartUpdatePosition(player_t *player)
+void K_KartUpdatePosition(player_t *player)
{
fixed_t position = 1;
fixed_t oldposition = player->kartstuff[k_position];
@@ -4608,22 +4769,22 @@ static void K_KartUpdatePosition(player_t *player)
mo->y - players[i].mo->y),
mo->z - players[i].mo->z) / FRACUNIT;
- if (mo->health == player->starpostnum)
+ if (mo->health == player->starpostnum && (!mo->movecount || mo->movecount == player->laps+1))
{
player->kartstuff[k_prevcheck] += pmo;
ppcd++;
}
- if (mo->health == (player->starpostnum + 1))
+ if (mo->health == (player->starpostnum + 1) && (!mo->movecount || mo->movecount == player->laps+1))
{
player->kartstuff[k_nextcheck] += pmo;
pncd++;
}
- if (mo->health == players[i].starpostnum)
+ if (mo->health == players[i].starpostnum && (!mo->movecount || mo->movecount == players[i].laps+1))
{
players[i].kartstuff[k_prevcheck] += imo;
ipcd++;
}
- if (mo->health == (players[i].starpostnum + 1))
+ if (mo->health == (players[i].starpostnum + 1) && (!mo->movecount || mo->movecount == players[i].laps+1))
{
players[i].kartstuff[k_nextcheck] += imo;
incd++;
@@ -4716,10 +4877,7 @@ void K_StripOther(player_t *player)
player->kartstuff[k_roulettetype] = 0;
player->kartstuff[k_invincibilitytimer] = 0;
- if (player->kartstuff[k_growshrinktimer] > 0)
- player->kartstuff[k_growshrinktimer] = 2;
- else if (player->kartstuff[k_growshrinktimer] < 0)
- player->kartstuff[k_growshrinktimer] = -2;
+ K_RemoveGrowShrink(player);
if (player->kartstuff[k_eggmanexplode])
{
@@ -5073,10 +5231,10 @@ void K_MoveKartPlayer(player_t *player, boolean onground)
&& player->kartstuff[k_growshrinktimer] <= 0) // Grow holds the item box hostage
{
K_PlayPowerGloatSound(player->mo);
- player->mo->scalespeed = mapheaderinfo[gamemap-1]->mobj_scale/TICRATE;
- player->mo->destscale = 3*(mapheaderinfo[gamemap-1]->mobj_scale)/2;
+ player->mo->scalespeed = mapobjectscale/TICRATE;
+ player->mo->destscale = (3*mapobjectscale)/2;
if (cv_kartdebugshrink.value && !modeattacking && !player->bot)
- player->mo->destscale = 6*player->mo->destscale/8;
+ player->mo->destscale = (6*player->mo->destscale)/8;
player->kartstuff[k_growshrinktimer] = itemtime+(4*TICRATE); // 12 seconds
P_RestoreMusic(player);
if (!P_IsLocalPlayer(player))
@@ -5312,7 +5470,12 @@ void K_MoveKartPlayer(player_t *player, boolean onground)
if (leveltime >= starttime-(2*TICRATE) && leveltime <= starttime)
{
if (cmd->buttons & BT_ACCELERATE)
+ {
+ if (player->kartstuff[k_boostcharge] == 0)
+ player->kartstuff[k_boostcharge] = cmd->latency;
+
player->kartstuff[k_boostcharge]++;
+ }
else
player->kartstuff[k_boostcharge] = 0;
}
@@ -5320,9 +5483,10 @@ void K_MoveKartPlayer(player_t *player, boolean onground)
// Increase your size while charging your engine.
if (leveltime < starttime+10)
{
- player->mo->destscale = (mapheaderinfo[gamemap-1]->mobj_scale) + (player->kartstuff[k_boostcharge]*131);
+ player->mo->scalespeed = mapobjectscale/12;
+ player->mo->destscale = mapobjectscale + (player->kartstuff[k_boostcharge]*131);
if (cv_kartdebugshrink.value && !modeattacking && !player->bot)
- player->mo->destscale = 6*player->mo->destscale/8;
+ player->mo->destscale = (6*player->mo->destscale)/8;
}
// Determine the outcome of your charge.
@@ -5640,6 +5804,8 @@ static patch_t *kp_battlelose;
static patch_t *kp_battlewait;
static patch_t *kp_battleinfo;
static patch_t *kp_wanted;
+static patch_t *kp_wantedsplit;
+static patch_t *kp_wantedreticle;
static patch_t *kp_itembg[4];
static patch_t *kp_itemtimer[2];
@@ -5779,6 +5945,8 @@ void K_LoadKartHUDGraphics(void)
kp_battlewait = W_CachePatchName("K_BWAIT", PU_HUDGFX);
kp_battleinfo = W_CachePatchName("K_BINFO", PU_HUDGFX);
kp_wanted = W_CachePatchName("K_WANTED", PU_HUDGFX);
+ kp_wantedsplit = W_CachePatchName("4PWANTED", PU_HUDGFX);
+ kp_wantedreticle = W_CachePatchName("MMAPWANT", PU_HUDGFX);
// Kart Item Windows
kp_itembg[0] = W_CachePatchName("K_ITBG", PU_HUDGFX);
@@ -5990,6 +6158,12 @@ INT32 CHEK_Y; // CHECK graphic
INT32 MINI_X, MINI_Y; // Minimap
INT32 WANT_X, WANT_Y; // Battle WANTED poster
+// This is for the P2 and P4 side of splitscreen. Then we'll flip P1's and P2's to the bottom with V_SPLITSCREEN.
+INT32 ITEM2_X, ITEM2_Y;
+INT32 LAPS2_X, LAPS2_Y;
+INT32 POSI2_X, POSI2_Y;
+
+
static void K_initKartHUD(void)
{
/*
@@ -6070,26 +6244,35 @@ static void K_initKartHUD(void)
MINI_Y = (BASEVIDHEIGHT/2);
- WANT_X = BASEVIDWIDTH-8;
- WANT_Y = (BASEVIDHEIGHT/2)-12;
-
if (splitscreen > 1) // 3P/4P Small Splitscreen
{
+ // 1P (top left)
ITEM_X = -9;
ITEM_Y = -8;
LAPS_X = 3;
LAPS_Y = (BASEVIDHEIGHT/2)-13;
- POSI_X = (BASEVIDWIDTH/2)-3;
+ POSI_X = 24;
+ POSI_Y = (BASEVIDHEIGHT/2)- 16;
+
+ // 2P (top right)
+ ITEM2_X = BASEVIDWIDTH-39;
+ ITEM2_Y = -8;
+
+ LAPS2_X = BASEVIDWIDTH-40;
+ LAPS2_Y = (BASEVIDHEIGHT/2)-13;
+
+ POSI2_X = BASEVIDWIDTH -4;
+ POSI2_Y = (BASEVIDHEIGHT/2)- 16;
+
+ // Reminder that 3P and 4P are just 1P and 2P splitscreen'd to the bottom.
STCD_X = BASEVIDWIDTH/4;
MINI_X = (3*BASEVIDWIDTH/4);
MINI_Y = (3*BASEVIDHEIGHT/4);
- WANT_X = (BASEVIDWIDTH/2)-8;
-
if (splitscreen > 2) // 4P-only
{
MINI_X = (BASEVIDWIDTH/2);
@@ -6155,32 +6338,89 @@ static void K_drawKartItem(void)
patch_t *localpatch = kp_nodraw;
patch_t *localbg = ((offset) ? kp_itembg[2] : kp_itembg[0]);
patch_t *localinv = ((offset) ? kp_invincibility[((leveltime % (6*3)) / 3) + 7] : kp_invincibility[(leveltime % (7*3)) / 3]);
- INT32 splitflags = K_calcSplitFlags(V_SNAPTOTOP|V_SNAPTOLEFT);
+ INT32 fx = 0, fy = 0, fflags = 0; // final coords for hud and flags...
+ //INT32 splitflags = K_calcSplitFlags(V_SNAPTOTOP|V_SNAPTOLEFT);
const INT32 numberdisplaymin = ((!offset && stplyr->kartstuff[k_itemtype] == KITEM_ORBINAUT) ? 5 : 2);
INT32 itembar = 0;
+ UINT8 localcolor = SKINCOLOR_NONE;
+ SINT8 colormode = TC_RAINBOW;
+ UINT8 *colmap = NULL;
+ boolean flipamount = false; // Used for 3P/4P splitscreen to flip item amount stuff
if (stplyr->kartstuff[k_itemroulette])
{
- switch((stplyr->kartstuff[k_itemroulette] % (13*3)) / 3)
+ if (stplyr->skincolor)
+ localcolor = stplyr->skincolor;
+
+ switch((stplyr->kartstuff[k_itemroulette] % (14*3)) / 3)
{
// Each case is handled in threes, to give three frames of in-game time to see the item on the roulette
- case 0: localpatch = kp_sneaker[offset]; break; // Sneaker
- case 1: localpatch = kp_banana[offset]; break; // Banana
- case 2: localpatch = kp_orbinaut[3+offset]; break; // Orbinaut
- case 3: localpatch = kp_mine[offset]; break; // Mine
- case 4: localpatch = kp_grow[offset]; break; // Grow
- case 5: localpatch = kp_hyudoro[offset]; break; // Hyudoro
- case 6: localpatch = kp_rocketsneaker[offset]; break; // Rocket Sneaker
- case 7: localpatch = kp_jawz[offset]; break; // Jawz
- case 8: localpatch = kp_selfpropelledbomb[offset]; break; // Self-Propelled Bomb
- case 9: localpatch = kp_shrink[offset]; break; // Shrink
- case 10: localpatch = localinv; break; // Invincibility
- case 11: localpatch = kp_eggman[offset]; break; // Eggman Monitor
- case 12: localpatch = kp_ballhog[offset]; break; // Ballhog
- case 13: localpatch = kp_thundershield[offset]; break; // Thunder Shield
- //case 14: localpatch = kp_pogospring[offset]; break; // Pogo Spring
- //case 15: localpatch = kp_kitchensink[offset]; break; // Kitchen Sink
- default: break;
+ case 0: // Sneaker
+ localpatch = kp_sneaker[offset];
+ //localcolor = SKINCOLOR_RASPBERRY;
+ break;
+ case 1: // Banana
+ localpatch = kp_banana[offset];
+ //localcolor = SKINCOLOR_YELLOW;
+ break;
+ case 2: // Orbinaut
+ localpatch = kp_orbinaut[3+offset];
+ //localcolor = SKINCOLOR_STEEL;
+ break;
+ case 3: // Mine
+ localpatch = kp_mine[offset];
+ //localcolor = SKINCOLOR_JET;
+ break;
+ case 4: // Grow
+ localpatch = kp_grow[offset];
+ //localcolor = SKINCOLOR_TEAL;
+ break;
+ case 5: // Hyudoro
+ localpatch = kp_hyudoro[offset];
+ //localcolor = SKINCOLOR_STEEL;
+ break;
+ case 6: // Rocket Sneaker
+ localpatch = kp_rocketsneaker[offset];
+ //localcolor = SKINCOLOR_TANGERINE;
+ break;
+ case 7: // Jawz
+ localpatch = kp_jawz[offset];
+ //localcolor = SKINCOLOR_JAWZ;
+ break;
+ case 8: // Self-Propelled Bomb
+ localpatch = kp_selfpropelledbomb[offset];
+ //localcolor = SKINCOLOR_JET;
+ break;
+ case 9: // Shrink
+ localpatch = kp_shrink[offset];
+ //localcolor = SKINCOLOR_ORANGE;
+ break;
+ case 10: // Invincibility
+ localpatch = localinv;
+ //localcolor = SKINCOLOR_GREY;
+ break;
+ case 11: // Eggman Monitor
+ localpatch = kp_eggman[offset];
+ //localcolor = SKINCOLOR_ROSE;
+ break;
+ case 12: // Ballhog
+ localpatch = kp_ballhog[offset];
+ //localcolor = SKINCOLOR_LILAC;
+ break;
+ case 13: // Thunder Shield
+ localpatch = kp_thundershield[offset];
+ //localcolor = SKINCOLOR_CYAN;
+ break;
+ /*case 14: // Pogo Spring
+ localpatch = kp_pogospring[offset];
+ localcolor = SKINCOLOR_TANGERINE;
+ break;
+ case 15: // Kitchen Sink
+ localpatch = kp_kitchensink[offset];
+ localcolor = SKINCOLOR_STEEL;
+ break;*/
+ default:
+ break;
}
}
else
@@ -6215,7 +6455,7 @@ static void K_drawKartItem(void)
else
localpatch = kp_nodraw;
}
- else if (stplyr->kartstuff[k_growshrinktimer] > 1)
+ else if (stplyr->kartstuff[k_growshrinktimer] > 0)
{
if (leveltime & 1)
localpatch = kp_grow[offset];
@@ -6236,51 +6476,134 @@ static void K_drawKartItem(void)
switch(stplyr->kartstuff[k_itemtype])
{
- case KITEM_SNEAKER: localpatch = kp_sneaker[offset]; break;
- case KITEM_ROCKETSNEAKER: localpatch = kp_rocketsneaker[offset]; break;
- case KITEM_INVINCIBILITY: localpatch = localinv; localbg = kp_itembg[offset+1]; break;
- case KITEM_BANANA: localpatch = kp_banana[offset]; break;
- case KITEM_EGGMAN: localpatch = kp_eggman[offset]; break;
- case KITEM_ORBINAUT:
- localpatch = kp_orbinaut[(offset ? 4
- : min(stplyr->kartstuff[k_itemamount]-1, 3))];
+ case KITEM_SNEAKER:
+ localpatch = kp_sneaker[offset];
break;
- case KITEM_JAWZ: localpatch = kp_jawz[offset]; break;
- case KITEM_MINE: localpatch = kp_mine[offset]; break;
- case KITEM_BALLHOG: localpatch = kp_ballhog[offset]; break;
- case KITEM_SPB: localpatch = kp_selfpropelledbomb[offset]; localbg = kp_itembg[offset+1]; break;
- case KITEM_GROW: localpatch = kp_grow[offset]; break;
- case KITEM_SHRINK: localpatch = kp_shrink[offset]; break;
- case KITEM_THUNDERSHIELD: localpatch = kp_thundershield[offset]; localbg = kp_itembg[offset+1]; break;
- case KITEM_HYUDORO: localpatch = kp_hyudoro[offset]; break;
- case KITEM_POGOSPRING: localpatch = kp_pogospring[offset]; break;
- case KITEM_KITCHENSINK: localpatch = kp_kitchensink[offset]; break;
- case KITEM_SAD: localpatch = kp_sadface[offset]; break;
- default: return;
+ case KITEM_ROCKETSNEAKER:
+ localpatch = kp_rocketsneaker[offset];
+ break;
+ case KITEM_INVINCIBILITY:
+ localpatch = localinv;
+ localbg = kp_itembg[offset+1];
+ break;
+ case KITEM_BANANA:
+ localpatch = kp_banana[offset];
+ break;
+ case KITEM_EGGMAN:
+ localpatch = kp_eggman[offset];
+ break;
+ case KITEM_ORBINAUT:
+ localpatch = kp_orbinaut[(offset ? 4 : min(stplyr->kartstuff[k_itemamount]-1, 3))];
+ break;
+ case KITEM_JAWZ:
+ localpatch = kp_jawz[offset];
+ break;
+ case KITEM_MINE:
+ localpatch = kp_mine[offset];
+ break;
+ case KITEM_BALLHOG:
+ localpatch = kp_ballhog[offset];
+ break;
+ case KITEM_SPB:
+ localpatch = kp_selfpropelledbomb[offset];
+ localbg = kp_itembg[offset+1];
+ break;
+ case KITEM_GROW:
+ localpatch = kp_grow[offset];
+ break;
+ case KITEM_SHRINK:
+ localpatch = kp_shrink[offset];
+ break;
+ case KITEM_THUNDERSHIELD:
+ localpatch = kp_thundershield[offset];
+ localbg = kp_itembg[offset+1];
+ break;
+ case KITEM_HYUDORO:
+ localpatch = kp_hyudoro[offset];
+ break;
+ case KITEM_POGOSPRING:
+ localpatch = kp_pogospring[offset];
+ break;
+ case KITEM_KITCHENSINK:
+ localpatch = kp_kitchensink[offset];
+ break;
+ case KITEM_SAD:
+ localpatch = kp_sadface[offset];
+ break;
+ default:
+ return;
}
if (stplyr->kartstuff[k_itemheld] && !(leveltime & 1))
localpatch = kp_nodraw;
}
+
+ if (stplyr->kartstuff[k_itemblink] && (leveltime & 1))
+ {
+ colormode = TC_BLINK;
+
+ switch (stplyr->kartstuff[k_itemblinkmode])
+ {
+ case 2:
+ localcolor = (UINT8)(1 + (leveltime % (MAXSKINCOLORS-1)));
+ break;
+ case 1:
+ localcolor = SKINCOLOR_RED;
+ break;
+ default:
+ localcolor = SKINCOLOR_WHITE;
+ break;
+ }
+ }
}
- V_DrawScaledPatch(ITEM_X, ITEM_Y, V_HUDTRANS|splitflags, localbg);
+ // pain and suffering defined below
+ if (splitscreen < 2) // don't change shit for THIS splitscreen.
+ {
+ fx = ITEM_X;
+ fy = ITEM_Y;
+ fflags = K_calcSplitFlags(V_SNAPTOTOP|V_SNAPTOLEFT);
+ }
+ else // now we're having a fun game.
+ {
+ if (stplyr == &players[displayplayer] || stplyr == &players[thirddisplayplayer]) // If we are P1 or P3...
+ {
+ fx = ITEM_X;
+ fy = ITEM_Y;
+ fflags = V_SNAPTOLEFT|((stplyr == &players[thirddisplayplayer]) ? V_SPLITSCREEN : V_SNAPTOTOP); // flip P3 to the bottom.
+ }
+ else // else, that means we're P2 or P4.
+ {
+ fx = ITEM2_X;
+ fy = ITEM2_Y;
+ fflags = V_SNAPTORIGHT|((stplyr == &players[fourthdisplayplayer]) ? V_SPLITSCREEN : V_SNAPTOTOP); // flip P4 to the bottom
+ flipamount = true;
+ }
+ }
+
+ if (localcolor != SKINCOLOR_NONE)
+ colmap = R_GetTranslationColormap(colormode, localcolor, 0);
+
+ V_DrawScaledPatch(fx, fy, V_HUDTRANS|fflags, localbg);
// Then, the numbers:
if (stplyr->kartstuff[k_itemamount] >= numberdisplaymin && !stplyr->kartstuff[k_itemroulette])
{
- V_DrawScaledPatch(ITEM_X, ITEM_Y, V_HUDTRANS|splitflags, kp_itemmulsticker[offset]);
- V_DrawScaledPatch(ITEM_X, ITEM_Y, V_HUDTRANS|splitflags, localpatch);
+ V_DrawScaledPatch(fx + (flipamount ? 48 : 0), fy, V_HUDTRANS|fflags|(flipamount ? V_FLIP : 0), kp_itemmulsticker[offset]); // flip this graphic for p2 and p4 in split and shift it.
+ V_DrawFixedPatch(fx<kartstuff[k_itemamount]));
+ if (flipamount) // reminder that this is for 3/4p's right end of the screen.
+ V_DrawString(fx+2, fy+31, V_ALLOWLOWERCASE|V_HUDTRANS|fflags, va("x%d", stplyr->kartstuff[k_itemamount]));
+ else
+ V_DrawString(fx+24, fy+31, V_ALLOWLOWERCASE|V_HUDTRANS|fflags, va("x%d", stplyr->kartstuff[k_itemamount]));
else
{
- V_DrawScaledPatch(ITEM_X+28, ITEM_Y+41, V_HUDTRANS|splitflags, kp_itemx);
- V_DrawKartString(ITEM_X+38, ITEM_Y+36, V_HUDTRANS|splitflags, va("%d", stplyr->kartstuff[k_itemamount]));
+ V_DrawScaledPatch(fy+28, fy+41, V_HUDTRANS|fflags, kp_itemx);
+ V_DrawKartString(fx+38, fy+36, V_HUDTRANS|fflags, va("%d", stplyr->kartstuff[k_itemamount]));
}
}
else
- V_DrawScaledPatch(ITEM_X, ITEM_Y, V_HUDTRANS|splitflags, localpatch);
+ V_DrawFixedPatch(fx< 2)
{
- V_DrawFill(ITEM_X+x+length, ITEM_Y+y+1, 1, height, 12|splitflags); // the right one
+ V_DrawFill(fx+x+length, fy+y+1, 1, height, 12|fflags); // the right one
if (height == 2)
- V_DrawFill(ITEM_X+x+2, ITEM_Y+y+2, length-2, 1, 8|splitflags); // the dulled underside
- V_DrawFill(ITEM_X+x+2, ITEM_Y+y+1, length-2, 1, 120|splitflags); // the shine
+ V_DrawFill(fx+x+2, fy+y+2, length-2, 1, 8|fflags); // the dulled underside
+ V_DrawFill(fx+x+2, fy+y+1, length-2, 1, 120|fflags); // the shine
}
}
// Quick Eggman numbers
if (stplyr->kartstuff[k_eggmanexplode] > 1 /*&& stplyr->kartstuff[k_eggmanexplode] <= 3*TICRATE*/)
- V_DrawScaledPatch(ITEM_X+17, ITEM_Y+13-offset, V_HUDTRANS|splitflags, kp_eggnum[min(3, G_TicsToSeconds(stplyr->kartstuff[k_eggmanexplode]))]);
+ V_DrawScaledPatch(fx+17, fy+13-offset, V_HUDTRANS|fflags, kp_eggnum[min(3, G_TicsToSeconds(stplyr->kartstuff[k_eggmanexplode]))]);
+
}
void K_drawKartTimestamp(tic_t drawtime, INT32 TX, INT32 TY, INT16 emblemmap, UINT8 mode)
@@ -6467,23 +6791,72 @@ static void K_DrawKartPositionNum(INT32 num)
// POSI_Y = BASEVIDHEIGHT- 64; // 136
boolean win = (stplyr->exiting && num == 1);
- INT32 X = POSI_X;
+ //INT32 X = POSI_X;
INT32 W = SHORT(kp_positionnum[0][0]->width);
fixed_t scale = FRACUNIT;
patch_t *localpatch = kp_positionnum[0][0];
- INT32 splitflags = K_calcSplitFlags(V_SNAPTOBOTTOM|V_SNAPTORIGHT);
+ //INT32 splitflags = K_calcSplitFlags(V_SNAPTOBOTTOM|V_SNAPTORIGHT);
+ INT32 fx = 0, fy = 0, fflags = 0;
+ boolean flipdraw = false; // flip the order we draw it in for MORE splitscreen bs. fun.
+ boolean flipvdraw = false; // used only for 2p splitscreen so overtaking doesn't make 1P's position fly off the screen.
+ boolean overtake = false;
if (stplyr->kartstuff[k_positiondelay] || stplyr->exiting)
+ {
scale *= 2;
+ overtake = true; // this is used for splitscreen stuff in conjunction with flipdraw.
+ }
if (splitscreen)
scale /= 2;
W = FixedMul(W<>FRACBITS;
+ // pain and suffering defined below
+ if (!splitscreen)
+ {
+ fx = POSI_X;
+ fy = BASEVIDHEIGHT - 8;
+ fflags = V_SNAPTOBOTTOM|V_SNAPTORIGHT;
+ }
+ else if (splitscreen == 1) // for this splitscreen, we'll use case by case because it's a bit different.
+ {
+ fx = POSI_X;
+ if (stplyr == &players[displayplayer]) // for player 1: display this at the top right, above the minimap.
+ {
+ fy = 30;
+ fflags = V_SNAPTOTOP|V_SNAPTORIGHT;
+ if (overtake)
+ flipvdraw = true; // make sure overtaking doesn't explode us
+ }
+ else // if we're not p1, that means we're p2. display this at the bottom right, below the minimap.
+ {
+ fy = BASEVIDHEIGHT - 8;
+ fflags = V_SNAPTOBOTTOM|V_SNAPTORIGHT;
+ }
+ }
+ else
+ {
+ if (stplyr == &players[displayplayer] || stplyr == &players[thirddisplayplayer]) // If we are P1 or P3...
+ {
+ fx = POSI_X;
+ fy = POSI_Y;
+ fflags = V_SNAPTOLEFT|((stplyr == &players[thirddisplayplayer]) ? V_SPLITSCREEN|V_SNAPTOBOTTOM : 0); // flip P3 to the bottom.
+ flipdraw = true;
+ if (num && num >= 10)
+ fx += W; // this seems dumb, but we need to do this in order for positions above 10 going off screen.
+ }
+ else // else, that means we're P2 or P4.
+ {
+ fx = POSI2_X;
+ fy = POSI2_Y;
+ fflags = V_SNAPTORIGHT|((stplyr == &players[fourthdisplayplayer]) ? V_SPLITSCREEN|V_SNAPTOBOTTOM : 0); // flip P4 to the bottom
+ }
+ }
+
// Special case for 0
if (!num)
{
- V_DrawFixedPatch(X<width)*scale/2) : 0), (fy<height)*scale/2) : 0), scale, V_HUDTRANSHALF|fflags, localpatch, NULL);
+ // ^ if we overtake as p1 or p3 in splitscren, we shift it so that it doesn't go off screen.
+ // ^ if we overtake as p1 in 2p splits, shift vertically so that this doesn't happen either.
- X -= W;
+ fx -= W;
num /= 10;
}
}
@@ -6768,15 +7143,57 @@ void HU_DrawTabRankings(INT32 x, INT32 y, playersort_t *tab, INT32 scorelines, I
static void K_drawKartLaps(void)
{
INT32 splitflags = K_calcSplitFlags(V_SNAPTOBOTTOM|V_SNAPTOLEFT);
+ INT32 fx = 0, fy = 0, fflags = 0; // stuff for 3p / 4p splitscreen.
+ boolean flipstring = false; // used for 3p or 4p
+ INT32 stringw = 0; // used with the above
if (splitscreen > 1)
{
- V_DrawScaledPatch(LAPS_X, LAPS_Y, V_HUDTRANS|splitflags, kp_splitlapflag);
- if (stplyr->exiting)
- V_DrawString(LAPS_X+13, LAPS_Y+1, V_HUDTRANS|splitflags, "FIN");
+ // pain and suffering defined below
+ if (splitscreen < 2) // don't change shit for THIS splitscreen.
+ {
+ fx = LAPS_X;
+ fy = LAPS_Y;
+ fflags = splitflags;
+ }
else
- V_DrawString(LAPS_X+13, LAPS_Y+1, V_HUDTRANS|splitflags, va("%d/%d", stplyr->laps+1, cv_numlaps.value));
+ {
+ if (stplyr == &players[displayplayer] || stplyr == &players[thirddisplayplayer]) // If we are P1 or P3...
+ {
+ fx = LAPS_X;
+ fy = LAPS_Y;
+ fflags = V_SNAPTOLEFT|((stplyr == &players[thirddisplayplayer]) ? V_SPLITSCREEN|V_SNAPTOBOTTOM : 0); // flip P3 to the bottom.
+ }
+ else // else, that means we're P2 or P4.
+ {
+ fx = LAPS2_X;
+ fy = LAPS2_Y;
+ fflags = V_SNAPTORIGHT|((stplyr == &players[fourthdisplayplayer]) ? V_SPLITSCREEN|V_SNAPTOBOTTOM : 0); // flip P4 to the bottom
+ flipstring = true; // make the string right aligned and other shit
+ }
+ }
+
+
+
+ if (stplyr->exiting) // draw stuff as god intended.
+ {
+ V_DrawScaledPatch(fx, fy, V_HUDTRANS|fflags, kp_splitlapflag);
+ V_DrawString(fx+13, fy+1, V_HUDTRANS|fflags, "FIN");
+ }
+ else // take flipstring into account here since we may have more laps than just 10
+ if (flipstring)
+ {
+ stringw = V_StringWidth(va("%d/%d", stplyr->laps+1, cv_numlaps.value), 0);
+
+ V_DrawScaledPatch(BASEVIDWIDTH-stringw-16, fy, V_HUDTRANS|fflags, kp_splitlapflag);
+ V_DrawRightAlignedString(BASEVIDWIDTH-3, fy+1, V_HUDTRANS|fflags, va("%d/%d", stplyr->laps+1, cv_numlaps.value));
+ }
+ else // draw stuff NORMALLY.
+ {
+ V_DrawScaledPatch(fx, fy, V_HUDTRANS|fflags, kp_splitlapflag);
+ V_DrawString(fx+13, fy+1, V_HUDTRANS|fflags, va("%d/%d", stplyr->laps+1, cv_numlaps.value));
+ }
}
else
{
@@ -6796,17 +7213,17 @@ static void K_drawKartSpeedometer(void)
if (cv_kartspeedometer.value == 1) // Kilometers
{
- convSpeed = FixedDiv(FixedMul(stplyr->speed, 142371), mapheaderinfo[gamemap-1]->mobj_scale)/FRACUNIT; // 2.172409058
+ convSpeed = FixedDiv(FixedMul(stplyr->speed, 142371), mapobjectscale)/FRACUNIT; // 2.172409058
V_DrawKartString(SPDM_X, SPDM_Y, V_HUDTRANS|splitflags, va("%3d km/h", convSpeed));
}
else if (cv_kartspeedometer.value == 2) // Miles
{
- convSpeed = FixedDiv(FixedMul(stplyr->speed, 88465), mapheaderinfo[gamemap-1]->mobj_scale)/FRACUNIT; // 1.349868774
+ convSpeed = FixedDiv(FixedMul(stplyr->speed, 88465), mapobjectscale)/FRACUNIT; // 1.349868774
V_DrawKartString(SPDM_X, SPDM_Y, V_HUDTRANS|splitflags, va("%3d mph", convSpeed));
}
else if (cv_kartspeedometer.value == 3) // Fracunits
{
- convSpeed = FixedDiv(stplyr->speed, mapheaderinfo[gamemap-1]->mobj_scale)/FRACUNIT;
+ convSpeed = FixedDiv(stplyr->speed, mapobjectscale)/FRACUNIT;
V_DrawKartString(SPDM_X, SPDM_Y, V_HUDTRANS|splitflags, va("%3d fu/t", convSpeed));
}
}
@@ -6815,18 +7232,48 @@ static void K_drawKartBumpersOrKarma(void)
{
UINT8 *colormap = R_GetTranslationColormap(TC_DEFAULT, stplyr->skincolor, 0);
INT32 splitflags = K_calcSplitFlags(V_SNAPTOBOTTOM|V_SNAPTOLEFT);
+ INT32 fx = 0, fy = 0, fflags = 0;
+ boolean flipstring = false; // same as laps, used for splitscreen
+ INT32 stringw = 0; // used with the above
if (splitscreen > 1)
{
+
+ // we will reuse lap coords here since it's essentially the same shit.
+
+ if (stplyr == &players[displayplayer] || stplyr == &players[thirddisplayplayer]) // If we are P1 or P3...
+ {
+ fx = LAPS_X;
+ fy = LAPS_Y;
+ fflags = V_SNAPTOLEFT|((stplyr == &players[thirddisplayplayer]) ? V_SPLITSCREEN|V_SNAPTOBOTTOM : 0); // flip P3 to the bottom.
+ }
+ else // else, that means we're P2 or P4.
+ {
+ fx = LAPS2_X;
+ fy = LAPS2_Y;
+ fflags = V_SNAPTORIGHT|((stplyr == &players[fourthdisplayplayer]) ? V_SPLITSCREEN|V_SNAPTOBOTTOM : 0); // flip P4 to the bottom
+ flipstring = true;
+ }
+
if (stplyr->kartstuff[k_bumper] <= 0)
{
- V_DrawMappedPatch(LAPS_X, LAPS_Y-1, V_HUDTRANS|splitflags, kp_splitkarmabomb, colormap);
- V_DrawString(LAPS_X+13, LAPS_Y+1, V_HUDTRANS|splitflags, va("%d/2", stplyr->kartstuff[k_comebackpoints]));
+ V_DrawMappedPatch(fx, fy-1, V_HUDTRANS|fflags, kp_splitkarmabomb, colormap);
+ V_DrawString(fx+13, fy+1, V_HUDTRANS|fflags, va("%d/2", stplyr->kartstuff[k_comebackpoints]));
}
- else
+ else // the above doesn't need to account for weird stuff since the max amount of karma necessary is always 2 ^^^^
{
- V_DrawMappedPatch(LAPS_X, LAPS_Y-1, V_HUDTRANS|splitflags, kp_rankbumper, colormap);
- V_DrawString(LAPS_X+13, LAPS_Y+1, V_HUDTRANS|splitflags, va("%d/%d", stplyr->kartstuff[k_bumper], cv_kartbumpers.value));
+ if (flipstring) // for p2 and p4, assume we can have more than 10 bumpers. It's retarded but who knows.
+ {
+ stringw = V_StringWidth(va("%d/%d", stplyr->kartstuff[k_bumper], cv_kartbumpers.value), 0);
+
+ V_DrawMappedPatch(BASEVIDWIDTH-stringw-16, fy-1, V_HUDTRANS|fflags, kp_rankbumper, colormap);
+ V_DrawRightAlignedString(BASEVIDWIDTH-3, fy+1, V_HUDTRANS|fflags, va("%d/%d", stplyr->kartstuff[k_bumper], cv_kartbumpers.value));
+ }
+ else // draw bumpers normally.
+ {
+ V_DrawMappedPatch(fx, fy-1, V_HUDTRANS|fflags, kp_rankbumper, colormap);
+ V_DrawString(fx+13, fy+1, V_HUDTRANS|fflags, va("%d/%d", stplyr->kartstuff[k_bumper], cv_kartbumpers.value));
+ }
}
}
else
@@ -6879,13 +7326,10 @@ static void K_drawKartWanted(void)
{
UINT8 i, numwanted = 0;
UINT8 *colormap = NULL;
+ INT32 basex = 0, basey = 0;
- if (splitscreen) // Can't fit the poster on screen, sadly
- {
- if (K_IsPlayerWanted(stplyr) && leveltime % 10 > 3)
- V_DrawRightAlignedString(WANT_X, WANT_Y, K_calcSplitFlags(V_SNAPTOBOTTOM|V_SNAPTORIGHT|V_HUDTRANS|V_ORANGEMAP), "WANTED");
+ if (stplyr != &players[displayplayer])
return;
- }
for (i = 0; i < 4; i++)
{
@@ -6897,13 +7341,33 @@ static void K_drawKartWanted(void)
if (numwanted <= 0)
return;
+ // set X/Y coords depending on splitscreen.
+ if (splitscreen < 3) // 1P and 2P use the same code.
+ {
+ basex = WANT_X;
+ basey = WANT_Y;
+ if (splitscreen == 2)
+ {
+ basey += 16; // slight adjust for 3P
+ basex -= 6;
+ }
+ }
+ else if (splitscreen == 3) // 4P splitscreen...
+ {
+ basex = BASEVIDWIDTH/2 - (SHORT(kp_wantedsplit->width)/2); // center on screen
+ basey = BASEVIDHEIGHT - 55;
+ //basey2 = 4;
+ }
+
if (battlewanted[0] != -1)
colormap = R_GetTranslationColormap(0, players[battlewanted[0]].skincolor, GTC_CACHE);
- V_DrawFixedPatch(WANT_X< 1 ? kp_wantedsplit : kp_wanted), colormap);
+ /*if (basey2)
+ V_DrawFixedPatch(basex< 1 ? 13 : 8), y = basey+(splitscreen > 1 ? 16 : 21);
fixed_t scale = FRACUNIT/2;
player_t *p = &players[battlewanted[i]];
@@ -6923,7 +7387,9 @@ static void K_drawKartWanted(void)
if (players[battlewanted[i]].skincolor)
{
colormap = R_GetTranslationColormap(TC_RAINBOW, p->skincolor, GTC_CACHE);
- V_DrawFixedPatch(x<skin] : facerankprefix[p->skin]), colormap);
+ V_DrawFixedPatch(x<skin] : facerankprefix[p->skin]), colormap);
+ /*if (basey2) // again with 4p stuff
+ V_DrawFixedPatch(x<skin] : facerankprefix[p->skin]), colormap);*/
}
}
}
@@ -7064,6 +7530,8 @@ static void K_drawKartMinimapHead(mobj_t *mo, INT32 x, INT32 y, INT32 flags, pat
else
colormap = R_GetTranslationColormap(skin, mo->color, GTC_CACHE);
V_DrawFixedPatch(amxpos, amypos, FRACUNIT, flags, facemmapprefix[skin], colormap);
+ if (mo->player && K_IsPlayerWanted(mo->player))
+ V_DrawFixedPatch(amxpos - (4< 105)
{
- minimaptrans = (splitscreen ? 10 : cv_kartminimap.value);
+ minimaptrans = cv_kartminimap.value;
if (timeinmap <= 113)
minimaptrans = ((((INT32)timeinmap) - 105)*minimaptrans)/(113-105);
if (!minimaptrans)
@@ -7113,7 +7582,7 @@ static void K_drawKartMinimap(void)
else
V_DrawScaledPatch(x, y, splitflags, AutomapPic);
- if (!splitscreen)
+ if (!(splitscreen == 2))
{
splitflags &= ~minimaptrans;
splitflags |= V_HUDTRANSHALF;
@@ -7126,6 +7595,10 @@ static void K_drawKartMinimap(void)
x -= SHORT(AutomapPic->leftoffset);
y -= SHORT(AutomapPic->topoffset);
+ // initialize
+ for (i = 0; i < 4; i++)
+ localplayers[i] = -1;
+
// Player's tiny icons on the Automap. (drawn opposite direction so player 1 is drawn last in splitscreen)
if (ghosts)
{
@@ -7135,9 +7608,12 @@ static void K_drawKartMinimap(void)
K_drawKartMinimapHead(g->mo, x, y, splitflags, AutomapPic);
g = g->next;
}
+
if (!stplyr->mo || stplyr->spectator) // do we need the latter..?
return;
- dop1later = true;
+
+ localplayers[numlocalplayers] = stplyr-players;
+ numlocalplayers++;
}
else
{
@@ -7148,32 +7624,42 @@ static void K_drawKartMinimap(void)
if (!players[i].mo || players[i].spectator)
continue;
- if (!splitscreen && i == displayplayer)
+ if (i != displayplayer || splitscreen)
{
- dop1later = true; // Do displayplayer later
- continue;
+ if (G_BattleGametype() && players[i].kartstuff[k_bumper] <= 0)
+ continue;
+
+ if (players[i].kartstuff[k_hyudorotimer] > 0)
+ {
+ if (!((players[i].kartstuff[k_hyudorotimer] < 1*TICRATE/2
+ || players[i].kartstuff[k_hyudorotimer] > hyudorotime-(1*TICRATE/2))
+ && !(leveltime & 1)))
+ continue;
+ }
}
- if (G_BattleGametype() && players[i].kartstuff[k_bumper] <= 0)
- continue;
- if (players[i].kartstuff[k_hyudorotimer] > 0)
+ if (i == displayplayer || i == secondarydisplayplayer || i == thirddisplayplayer || i == fourthdisplayplayer)
{
- if (!((players[i].kartstuff[k_hyudorotimer] < 1*TICRATE/2
- || players[i].kartstuff[k_hyudorotimer] > hyudorotime-(1*TICRATE/2))
- && !(leveltime & 1)))
- continue;
+ // Draw display players on top of everything else
+ localplayers[numlocalplayers] = i;
+ numlocalplayers++;
+ continue;
}
K_drawKartMinimapHead(players[i].mo, x, y, splitflags, AutomapPic);
}
}
- if (!dop1later)
- return; // Don't need this
-
+ // draw our local players here, opaque.
splitflags &= ~V_HUDTRANSHALF;
splitflags |= V_HUDTRANS;
- K_drawKartMinimapHead(stplyr->mo, x, y, splitflags, AutomapPic);
+
+ for (i = 0; i < numlocalplayers; i++)
+ {
+ if (i == -1)
+ continue; // this doesn't interest us
+ K_drawKartMinimapHead(players[localplayers[i]].mo, x, y, splitflags, AutomapPic);
+ }
}
static void K_drawKartStartCountdown(void)
@@ -7279,7 +7765,7 @@ static void K_drawBattleFullscreen(void)
{
if (stplyr == &players[displayplayer])
V_DrawFadeScreen(0xFF00, 16);
- if (stplyr->exiting < 6*TICRATE)
+ if (stplyr->exiting < 6*TICRATE && !stplyr->spectator)
{
if (stplyr->kartstuff[k_position] == 1)
V_DrawFixedPatch(x<kartstuff[k_bumper] <= 0 && stplyr->kartstuff[k_comebacktimer] && comeback)
+ else if (stplyr->kartstuff[k_bumper] <= 0 && stplyr->kartstuff[k_comebacktimer] && comeback && !stplyr->spectator)
{
UINT16 t = stplyr->kartstuff[k_comebacktimer]/(10*TICRATE);
INT32 txoff, adjust = (splitscreen > 1) ? 4 : 6; // normal string is 8, kart string is 12, half of that for ease
@@ -7622,7 +8108,7 @@ static void K_drawLapStartAnim(void)
V_DrawFixedPatch((BASEVIDWIDTH/2 + (32*max(0, stplyr->kartstuff[k_lapanimation]-76)))*FRACUNIT,
(48 - (32*max(0, progress-76)))*FRACUNIT,
- FRACUNIT, V_HUDTRANS,
+ FRACUNIT, V_SNAPTOTOP|V_HUDTRANS,
(modeattacking ? kp_lapanim_emblem[1] : kp_lapanim_emblem[0]), colormap);
if (stplyr->kartstuff[k_laphand] >= 1 && stplyr->kartstuff[k_laphand] <= 3)
@@ -7630,7 +8116,7 @@ static void K_drawLapStartAnim(void)
V_DrawFixedPatch((BASEVIDWIDTH/2 + (32*max(0, stplyr->kartstuff[k_lapanimation]-76)))*FRACUNIT,
(48 - (32*max(0, progress-76))
+ 4 - abs((signed)((leveltime % 8) - 4)))*FRACUNIT,
- FRACUNIT, V_HUDTRANS,
+ FRACUNIT, V_SNAPTOTOP|V_HUDTRANS,
kp_lapanim_hand[stplyr->kartstuff[k_laphand]-1], NULL);
}
@@ -7638,14 +8124,14 @@ static void K_drawLapStartAnim(void)
{
V_DrawFixedPatch((62 - (32*max(0, progress-76)))*FRACUNIT, // 27
30*FRACUNIT, // 24
- FRACUNIT, V_HUDTRANS,
+ FRACUNIT, V_SNAPTOTOP|V_HUDTRANS,
kp_lapanim_final[min(progress/2, 10)], NULL);
if (progress/2-12 >= 0)
{
V_DrawFixedPatch((188 + (32*max(0, progress-76)))*FRACUNIT, // 194
30*FRACUNIT, // 24
- FRACUNIT, V_HUDTRANS,
+ FRACUNIT, V_SNAPTOTOP|V_HUDTRANS,
kp_lapanim_lap[min(progress/2-12, 6)], NULL);
}
}
@@ -7653,21 +8139,21 @@ static void K_drawLapStartAnim(void)
{
V_DrawFixedPatch((82 - (32*max(0, progress-76)))*FRACUNIT, // 61
30*FRACUNIT, // 24
- FRACUNIT, V_HUDTRANS,
+ FRACUNIT, V_SNAPTOTOP|V_HUDTRANS,
kp_lapanim_lap[min(progress/2, 6)], NULL);
if (progress/2-8 >= 0)
{
V_DrawFixedPatch((188 + (32*max(0, progress-76)))*FRACUNIT, // 194
30*FRACUNIT, // 24
- FRACUNIT, V_HUDTRANS,
+ FRACUNIT, V_SNAPTOTOP|V_HUDTRANS,
kp_lapanim_number[(((UINT32)stplyr->laps+1) / 10)][min(progress/2-8, 2)], NULL);
if (progress/2-10 >= 0)
{
V_DrawFixedPatch((208 + (32*max(0, progress-76)))*FRACUNIT, // 221
30*FRACUNIT, // 24
- FRACUNIT, V_HUDTRANS,
+ FRACUNIT, V_SNAPTOTOP|V_HUDTRANS,
kp_lapanim_number[(((UINT32)stplyr->laps+1) % 10)][min(progress/2-10, 2)], NULL);
}
}
@@ -7717,6 +8203,7 @@ static void K_drawDistributionDebugger(void)
INT32 pingame = 0, bestbumper = 0;
INT32 i;
INT32 x = -9, y = -9;
+ boolean dontforcespb = false;
if (stplyr != &players[displayplayer]) // only for p1
return;
@@ -7727,11 +8214,13 @@ static void K_drawDistributionDebugger(void)
if (!playeringame[i] || players[i].spectator)
continue;
pingame++;
+ if (players[i].exiting)
+ dontforcespb = true;
if (players[i].kartstuff[k_bumper] > bestbumper)
bestbumper = players[i].kartstuff[k_bumper];
}
- useodds = K_FindUseodds(stplyr, 0, pingame, bestbumper);
+ useodds = K_FindUseodds(stplyr, 0, pingame, bestbumper, (spbplace != -1 && stplyr->kartstuff[k_position] == spbplace+1), dontforcespb);
for (i = 1; i < NUMKARTRESULTS; i++)
{
@@ -7780,10 +8269,10 @@ static void K_drawCheckpointDebugger(void)
if (stplyr != &players[displayplayer]) // only for p1
return;
- if ((numstarposts/2 + stplyr->starpostnum) >= numstarposts)
+ if (stplyr->starpostnum >= (numstarposts - (numstarposts/2)))
V_DrawString(8, 184, 0, va("Checkpoint: %d / %d (Can finish)", stplyr->starpostnum, numstarposts));
else
- V_DrawString(8, 184, 0, va("Checkpoint: %d / %d (Skip: %d)", stplyr->starpostnum, numstarposts, (numstarposts/2 + stplyr->starpostnum)));
+ V_DrawString(8, 184, 0, va("Checkpoint: %d / %d (Skip: %d)", stplyr->starpostnum, numstarposts, ((numstarposts/2) + stplyr->starpostnum)));
V_DrawString(8, 192, 0, va("Waypoint dist: Prev %d, Next %d", stplyr->kartstuff[k_prevcheck], stplyr->kartstuff[k_nextcheck]));
}
@@ -7802,13 +8291,13 @@ void K_drawKartHUD(void)
|| ((splitscreen > 2 && stplyr == &players[fourthdisplayplayer]) && !camera4.chase))
K_drawKartFirstPerson();
- if (splitscreen == 2) // Player 4 in 3P is the minimap :p
+/* if (splitscreen == 2) // Player 4 in 3P is the minimap :p
{
#ifdef HAVE_BLUA
if (LUA_HudEnabled(hud_minimap))
#endif
K_drawKartMinimap();
- }
+ }*/
// Draw full screen stuff that turns off the rest of the HUD
if (mapreset && stplyr == &players[displayplayer])
@@ -7832,7 +8321,16 @@ void K_drawKartHUD(void)
if (cv_kartcheck.value && !splitscreen && !players[displayplayer].exiting)
K_drawKartPlayerCheck();
- if (splitscreen == 0 && cv_kartminimap.value && !titledemo)
+ // Draw WANTED status
+ if (G_BattleGametype())
+ {
+#ifdef HAVE_BLUA
+ if (LUA_HudEnabled(hud_wanted))
+#endif
+ K_drawKartWanted();
+ }
+
+ if (cv_kartminimap.value && !titledemo)
{
#ifdef HAVE_BLUA
if (LUA_HudEnabled(hud_minimap))
@@ -7847,15 +8345,6 @@ void K_drawKartHUD(void)
#endif
K_drawKartItem();
- // Draw WANTED status
- if (G_BattleGametype())
- {
-#ifdef HAVE_BLUA
- if (LUA_HudEnabled(hud_wanted))
-#endif
- K_drawKartWanted();
- }
-
// If not splitscreen, draw...
if (!splitscreen && !titledemo)
{
@@ -7973,7 +8462,7 @@ void K_drawKartHUD(void)
{
UINT8 p;
for (p = 0; p < MAXPLAYERS; p++)
- V_DrawString(8, 64+(8*p), V_YELLOWMAP, va("%d - %d", p, playernode[p]));
+ V_DrawString(8, 64+(8*p), V_YELLOWMAP, va("%d - %d (%dl)", p, playernode[p], players[p].cmd.latency));
}
}
diff --git a/src/k_kart.h b/src/k_kart.h
index 8f8cd100..3f712091 100644
--- a/src/k_kart.h
+++ b/src/k_kart.h
@@ -9,6 +9,8 @@
#include "doomdef.h"
#include "d_player.h" // Need for player_t
+#define KART_FULLTURN 800
+
UINT8 colortranslations[MAXSKINCOLORS][16];
extern const char *KartColor_Names[MAXSKINCOLORS];
extern const UINT8 KartColor_Opposite[MAXSKINCOLORS*2];
@@ -24,12 +26,13 @@ void K_KartBouncing(mobj_t *mobj1, mobj_t *mobj2, boolean bounce, boolean solid)
void K_MatchGenericExtraFlags(mobj_t *mo, mobj_t *master);
void K_RespawnChecker(player_t *player);
void K_KartMoveAnimation(player_t *player);
+void K_KartPlayerHUDUpdate(player_t *player);
void K_KartPlayerThink(player_t *player, ticcmd_t *cmd);
void K_KartPlayerAfterThink(player_t *player);
void K_DoInstashield(player_t *player);
void K_SpawnBattlePoints(player_t *source, player_t *victim, UINT8 amount);
-void K_SpinPlayer(player_t *player, mobj_t *source, INT32 type, boolean trapitem);
-void K_SquishPlayer(player_t *player, mobj_t *source);
+void K_SpinPlayer(player_t *player, mobj_t *source, INT32 type, mobj_t *inflictor, boolean trapitem);
+void K_SquishPlayer(player_t *player, mobj_t *source, mobj_t *inflictor);
void K_ExplodePlayer(player_t *player, mobj_t *source, mobj_t *inflictor);
void K_StealBumper(player_t *player, player_t *victim, boolean force);
void K_SpawnKartExplosion(fixed_t x, fixed_t y, fixed_t z, fixed_t radius, INT32 number, mobjtype_t type, angle_t rotangle, boolean spawncenter, boolean ghostit, mobj_t *source);
@@ -48,6 +51,7 @@ player_t *K_FindJawzTarget(mobj_t *actor, player_t *source);
boolean K_CheckPlayersRespawnColliding(INT32 playernum, fixed_t x, fixed_t y);
INT16 K_GetKartTurnValue(player_t *player, INT16 turnvalue);
INT32 K_GetKartDriftSparkValue(player_t *player);
+void K_KartUpdatePosition(player_t *player);
void K_DropItems(player_t *player);
void K_StripItems(player_t *player);
void K_StripOther(player_t *player);
diff --git a/src/keys.h b/src/keys.h
index 654aa1d9..cf3a0d06 100644
--- a/src/keys.h
+++ b/src/keys.h
@@ -1,7 +1,7 @@
// SONIC ROBO BLAST 2
//-----------------------------------------------------------------------------
// Copyright (C) 1998-2000 by DooM Legacy Team.
-// Copyright (C) 1999-2016 by Sonic Team Junior.
+// Copyright (C) 1999-2018 by Sonic Team Junior.
//
// This program is free software distributed under the
// terms of the GNU General Public License, version 2.
diff --git a/src/locale/en.po b/src/locale/en.po
index 2665082a..ce451080 100644
--- a/src/locale/en.po
+++ b/src/locale/en.po
@@ -3629,7 +3629,7 @@ msgid "another castle!"
msgstr ""
#: st_stuff.c:2328 st_stuff.c:2334 st_stuff.c:2356
-msgid "Press F12 to watch another player."
+msgid "Press Viewpoint Key to watch a player."
msgstr ""
#: st_stuff.c:2333
diff --git a/src/locale/srb2.pot b/src/locale/srb2.pot
index 37d14f8b..c61cbcc9 100644
--- a/src/locale/srb2.pot
+++ b/src/locale/srb2.pot
@@ -3820,7 +3820,7 @@ msgid "another castle!"
msgstr ""
#: st_stuff.c:2092 st_stuff.c:2098 st_stuff.c:2120
-msgid "Press F12 to watch another player."
+msgid "Press Viewpoint Key to watch a player."
msgstr ""
#: st_stuff.c:2097
diff --git a/src/lua_baselib.c b/src/lua_baselib.c
index 1c14093c..dd241f41 100644
--- a/src/lua_baselib.c
+++ b/src/lua_baselib.c
@@ -1,7 +1,7 @@
// SONIC ROBO BLAST 2
//-----------------------------------------------------------------------------
// Copyright (C) 2012-2016 by John "JTE" Muniz.
-// Copyright (C) 2012-2016 by Sonic Team Junior.
+// Copyright (C) 2012-2018 by Sonic Team Junior.
//
// This program is free software distributed under the
// terms of the GNU General Public License, version 2.
@@ -23,7 +23,7 @@
#include "m_random.h"
#include "s_sound.h"
#include "g_game.h"
-#include "hu_stuff.h"
+#include "hu_stuff.h" // HU_AddChatText
#include "console.h"
#include "k_kart.h" // SRB2Kart
#include "d_netcmd.h" // IsPlayerAdmin
@@ -96,16 +96,16 @@ static int lib_print(lua_State *L)
static int lib_chatprint(lua_State *L)
{
const char *str = luaL_checkstring(L, 1); // retrieve string
- boolean sound = luaL_checkboolean(L, 2); // retrieve sound boolean
- int len;
+ boolean sound = lua_optboolean(L, 2); // retrieve sound boolean
+ int len = strlen(str);
+
if (str == NULL) // error if we don't have a string!
return luaL_error(L, LUA_QL("tostring") " must return a string to " LUA_QL("chatprint"));
- len = strlen(str);
+
if (len > 255) // string is too long!!!
return luaL_error(L, "String exceeds the 255 characters limit of the chat buffer.");
HU_AddChatText(str, sound);
-
return 0;
}
@@ -113,10 +113,11 @@ static int lib_chatprint(lua_State *L)
static int lib_chatprintf(lua_State *L)
{
int n = lua_gettop(L); /* number of arguments */
+ const char *str = luaL_checkstring(L, 2); // retrieve string
+ boolean sound = lua_optboolean(L, 3); // sound?
+ int len = strlen(str);
player_t *plr;
- const char *str;
- boolean sound = luaL_checkboolean(L, 3);
- int len;
+
if (n < 2)
return luaL_error(L, "chatprintf requires at least two arguments: player and text.");
@@ -126,15 +127,13 @@ static int lib_chatprintf(lua_State *L)
if (plr != &players[consoleplayer])
return 0;
- str = luaL_checkstring(L, 2); // retrieve string
if (str == NULL) // error if we don't have a string!
return luaL_error(L, LUA_QL("tostring") " must return a string to " LUA_QL("chatprintf"));
- len = strlen(str);
+
if (len > 255) // string is too long!!!
return luaL_error(L, "String exceeds the 255 characters limit of the chat buffer.");
HU_AddChatText(str, sound);
-
return 0;
}
@@ -678,16 +677,6 @@ static int lib_pGetPlayerSpinHeight(lua_State *L)
return 1;
}
-static int lib_pGetPlayerControlDirection(lua_State *L)
-{
- player_t *player = *((player_t **)luaL_checkudata(L, 1, META_PLAYER));
- //HUDSAFE
- if (!player)
- return LUA_ErrInvalid(L, "player_t");
- lua_pushinteger(L, P_GetPlayerControlDirection(player));
- return 1;
-}
-
static int lib_pAddPlayerScore(lua_State *L)
{
player_t *player = *((player_t **)luaL_checkudata(L, 1, META_PLAYER));
@@ -1767,7 +1756,7 @@ static int lib_sStartSound(lua_State *L)
const void *origin = NULL;
sfxenum_t sound_id = luaL_checkinteger(L, 2);
player_t *player = NULL;
- NOHUD
+ //NOHUD // kys @whoever did this.
if (sound_id >= NUMSFX)
return luaL_error(L, "sfx %d out of range (0 - %d)", sound_id, NUMSFX-1);
if (!lua_isnil(L, 1))
@@ -1783,7 +1772,12 @@ static int lib_sStartSound(lua_State *L)
return LUA_ErrInvalid(L, "player_t");
}
if (!player || P_IsLocalPlayer(player))
+ {
+ if (hud_running)
+ origin = NULL; // HUD rendering startsound shouldn't have an origin, just remove it instead of having a retarded error.
+
S_StartSound(origin, sound_id);
+ }
return 0;
}
@@ -1835,6 +1829,21 @@ static int lib_sStopSoundByID(lua_State *L)
return 0;
}
+static int lib_sShowMusicCredit(lua_State *L)
+{
+ player_t *player = NULL;
+ //HUDSAFE
+ if (!lua_isnone(L, 1) && lua_isuserdata(L, 1))
+ {
+ player = *((player_t **)luaL_checkudata(L, 1, META_PLAYER));
+ if (!player)
+ return LUA_ErrInvalid(L, "player_t");
+ }
+ if (!player || P_IsLocalPlayer(player))
+ S_ShowMusicCredit();
+ return 0;
+}
+
static int lib_sChangeMusic(lua_State *L)
{
#ifdef MUSICSLOT_COMPATIBILITY
@@ -1985,28 +1994,45 @@ static int lib_gDoReborn(lua_State *L)
return 0;
}
-static int lib_gExitLevel(lua_State *L)
+// Another Lua function that doesn't actually exist!
+// Sets nextmapoverride & skipstats without instantly ending the level, for instances where other sources should be exiting the level, like normal signposts.
+static int lib_gSetCustomExitVars(lua_State *L)
{
int n = lua_gettop(L); // Num arguments
NOHUD
// LUA EXTENSION: Custom exit like support
// Supported:
- // G_ExitLevel(); [no modifications]
- // G_ExitLevel(int) [nextmap override only]
- // G_ExitLevel(bool) [skipstats only]
- // G_ExitLevel(int, bool) [both of the above]
+ // G_SetCustomExitVars(); [reset to defaults]
+ // G_SetCustomExitVars(int) [nextmap override only]
+ // G_SetCustomExitVars(bool) [skipstats only]
+ // G_SetCustomExitVars(int, bool) [both of the above]
if (n >= 1)
{
if (lua_isnumber(L, 1) || n >= 2)
{
nextmapoverride = (INT16)luaL_checknumber(L, 1);
- lua_pop(L, 1); // pop nextmapoverride; skipstats now 1 if available
+ lua_remove(L, 1); // remove nextmapoverride; skipstats now 1 if available
}
skipstats = lua_optboolean(L, 1);
}
+ else
+ {
+ nextmapoverride = 0;
+ skipstats = false;
+ }
// ---
+ return 0;
+}
+
+static int lib_gExitLevel(lua_State *L)
+{
+ int n = lua_gettop(L); // Num arguments
+ NOHUD
+ // Moved this bit to G_SetCustomExitVars
+ if (n >= 1) // Don't run the reset to defaults option
+ lib_gSetCustomExitVars(L);
G_ExitLevel();
return 0;
}
@@ -2190,13 +2216,16 @@ static int lib_kSpinPlayer(lua_State *L)
player_t *player = *((player_t **)luaL_checkudata(L, 1, META_PLAYER));
mobj_t *source = NULL;
INT32 type = (INT32)luaL_optinteger(L, 3, 0);
- boolean trapitem = lua_optboolean(L, 4);
+ mobj_t *inflictor = NULL;
+ boolean trapitem = lua_optboolean(L, 5);
NOHUD
if (!player)
return LUA_ErrInvalid(L, "player_t");
if (!lua_isnone(L, 2) && lua_isuserdata(L, 2))
source = *((mobj_t **)luaL_checkudata(L, 2, META_MOBJ));
- K_SpinPlayer(player, source, type, trapitem);
+ if (!lua_isnone(L, 4) && lua_isuserdata(L, 4))
+ inflictor = *((mobj_t **)luaL_checkudata(L, 4, META_MOBJ));
+ K_SpinPlayer(player, source, type, inflictor, trapitem);
return 0;
}
@@ -2204,12 +2233,15 @@ static int lib_kSquishPlayer(lua_State *L)
{
player_t *player = *((player_t **)luaL_checkudata(L, 1, META_PLAYER));
mobj_t *source = NULL;
+ mobj_t *inflictor = NULL;
NOHUD
if (!player)
return LUA_ErrInvalid(L, "player_t");
if (!lua_isnone(L, 2) && lua_isuserdata(L, 2))
source = *((mobj_t **)luaL_checkudata(L, 2, META_MOBJ));
- K_SquishPlayer(player, source);
+ if (!lua_isnone(L, 2) && lua_isuserdata(L, 2))
+ inflictor = *((mobj_t **)luaL_checkudata(L, 2, META_MOBJ));
+ K_SquishPlayer(player, source, inflictor);
return 0;
}
@@ -2248,7 +2280,7 @@ static int lib_kSpawnKartExplosion(lua_State *L)
fixed_t x = luaL_checkfixed(L, 1);
fixed_t y = luaL_checkfixed(L, 2);
fixed_t z = luaL_checkfixed(L, 3);
- fixed_t radius = (fixed_t)luaL_optinteger(L, 4, 32*FRACUNIT);
+ fixed_t radius = (fixed_t)luaL_optinteger(L, 4, 32*FRACUNIT);
INT32 number = (INT32)luaL_optinteger(L, 5, 32);
mobjtype_t type = luaL_optinteger(L, 6, MT_MINEEXPLOSION);
angle_t rotangle = luaL_optinteger(L, 7, 0);
@@ -2386,6 +2418,16 @@ static int lib_kGetKartDriftSparkValue(lua_State *L)
return 1;
}
+static int lib_kKartUpdatePosition(lua_State *L)
+{
+ player_t *player = *((player_t **)luaL_checkudata(L, 1, META_PLAYER));
+ NOHUD
+ if (!player)
+ return LUA_ErrInvalid(L, "player_t");
+ K_KartUpdatePosition(player);
+ return 0;
+}
+
static int lib_kDropItems(lua_State *L)
{
player_t *player = *((player_t **)luaL_checkudata(L, 1, META_PLAYER));
@@ -2524,7 +2566,6 @@ static luaL_Reg lib[] = {
// p_user
{"P_GetPlayerHeight",lib_pGetPlayerHeight},
{"P_GetPlayerSpinHeight",lib_pGetPlayerSpinHeight},
- {"P_GetPlayerControlDirection",lib_pGetPlayerControlDirection},
{"P_AddPlayerScore",lib_pAddPlayerScore},
{"P_PlayerInPain",lib_pPlayerInPain},
{"P_DoPlayerPain",lib_pDoPlayerPain},
@@ -2629,6 +2670,7 @@ static luaL_Reg lib[] = {
{"S_StartSoundAtVolume",lib_sStartSoundAtVolume},
{"S_StopSound",lib_sStopSound},
{"S_StopSoundByID",lib_sStopSoundByID},
+ {"S_ShowMusicCredit",lib_sShowMusicCredit},
{"S_ChangeMusic",lib_sChangeMusic},
{"S_SpeedMusic",lib_sSpeedMusic},
{"S_StopMusic",lib_sStopMusic},
@@ -2639,6 +2681,7 @@ static luaL_Reg lib[] = {
// g_game
{"G_BuildMapName",lib_gBuildMapName},
{"G_DoReborn",lib_gDoReborn},
+ {"G_SetCustomExitVars",lib_gSetCustomExitVars},
{"G_ExitLevel",lib_gExitLevel},
{"G_IsSpecialStage",lib_gIsSpecialStage},
{"G_GametypeUsesLives",lib_gGametypeUsesLives},
@@ -2677,6 +2720,7 @@ static luaL_Reg lib[] = {
{"K_RepairOrbitChain",lib_kRepairOrbitChain},
{"K_FindJawzTarget",lib_kFindJawzTarget},
{"K_GetKartDriftSparkValue",lib_kGetKartDriftSparkValue},
+ {"K_KartUpdatePosition",lib_kKartUpdatePosition},
{"K_DropItems",lib_kDropItems},
{"K_StripItems",lib_kStripItems},
{"K_StripOther",lib_kStripOther},
diff --git a/src/lua_blockmaplib.c b/src/lua_blockmaplib.c
new file mode 100644
index 00000000..dabbdd9f
--- /dev/null
+++ b/src/lua_blockmaplib.c
@@ -0,0 +1,266 @@
+// SONIC ROBO BLAST 2
+//-----------------------------------------------------------------------------
+// Copyright (C) 2016 by Iestyn "Monster Iestyn" Jealous.
+// Copyright (C) 2016 by Sonic Team Junior.
+//
+// This program is free software distributed under the
+// terms of the GNU General Public License, version 2.
+// See the 'LICENSE' file for more details.
+//-----------------------------------------------------------------------------
+/// \file lua_blockmaplib.c
+/// \brief blockmap library for Lua scripting
+
+#include "doomdef.h"
+#ifdef HAVE_BLUA
+#include "p_local.h"
+#include "r_main.h" // validcount
+#include "lua_script.h"
+#include "lua_libs.h"
+//#include "lua_hud.h" // hud_running errors
+
+static const char *const search_opt[] = {
+ "objects",
+ "lines",
+ NULL};
+
+// a quickly-made function pointer typedef used by lib_searchBlockmap...
+// return values:
+// 0 - normal, no interruptions
+// 1 - stop search through current block
+// 2 - stop search completely
+typedef UINT8 (*blockmap_func)(lua_State *, INT32, INT32, mobj_t *);
+
+static boolean blockfuncerror = false; // errors should only print once per search blockmap call
+
+// Helper function for "objects" search
+static UINT8 lib_searchBlockmap_Objects(lua_State *L, INT32 x, INT32 y, mobj_t *thing)
+{
+ mobj_t *mobj, *bnext = NULL;
+
+ if (x < 0 || y < 0 || x >= bmapwidth || y >= bmapheight)
+ return 0;
+
+ // Check interaction with the objects in the blockmap.
+ for (mobj = blocklinks[y*bmapwidth + x]; mobj; mobj = bnext)
+ {
+ P_SetTarget(&bnext, mobj->bnext); // We want to note our reference to bnext here incase it is MF_NOTHINK and gets removed!
+ if (mobj == thing)
+ continue; // our thing just found itself, so move on
+ lua_pushvalue(L, 1); // push function
+ LUA_PushUserdata(L, thing, META_MOBJ);
+ LUA_PushUserdata(L, mobj, META_MOBJ);
+ if (lua_pcall(gL, 2, 1, 0)) {
+ if (!blockfuncerror || cv_debug & DBG_LUA)
+ CONS_Alert(CONS_WARNING,"%s\n",lua_tostring(gL, -1));
+ lua_pop(gL, 1);
+ blockfuncerror = true;
+ return 0; // *shrugs*
+ }
+ if (!lua_isnil(gL, -1))
+ { // if nil, continue
+ if (lua_toboolean(gL, -1))
+ return 2; // stop whole search
+ else
+ return 1; // stop block search
+ }
+ lua_pop(gL, 1);
+ if (P_MobjWasRemoved(thing) // func just popped our thing, cannot continue.
+ || (bnext && P_MobjWasRemoved(bnext))) // func just broke blockmap chain, cannot continue.
+ {
+ P_SetTarget(&bnext, NULL);
+ return (P_MobjWasRemoved(thing)) ? 2 : 1;
+ }
+ }
+ return 0;
+}
+
+// Helper function for "lines" search
+static UINT8 lib_searchBlockmap_Lines(lua_State *L, INT32 x, INT32 y, mobj_t *thing)
+{
+ INT32 offset;
+ const INT32 *list; // Big blockmap
+#ifdef POLYOBJECTS
+ polymaplink_t *plink; // haleyjd 02/22/06
+#endif
+ line_t *ld;
+
+ if (x < 0 || y < 0 || x >= bmapwidth || y >= bmapheight)
+ return 0;
+
+ offset = y*bmapwidth + x;
+
+#ifdef POLYOBJECTS
+ // haleyjd 02/22/06: consider polyobject lines
+ plink = polyblocklinks[offset];
+
+ while (plink)
+ {
+ polyobj_t *po = plink->po;
+
+ if (po->validcount != validcount) // if polyobj hasn't been checked
+ {
+ size_t i;
+ po->validcount = validcount;
+
+ for (i = 0; i < po->numLines; ++i)
+ {
+ if (po->lines[i]->validcount == validcount) // line has been checked
+ continue;
+ po->lines[i]->validcount = validcount;
+
+ lua_pushvalue(L, 1);
+ LUA_PushUserdata(L, thing, META_MOBJ);
+ LUA_PushUserdata(L, po->lines[i], META_LINE);
+ if (lua_pcall(gL, 2, 1, 0)) {
+ if (!blockfuncerror || cv_debug & DBG_LUA)
+ CONS_Alert(CONS_WARNING,"%s\n",lua_tostring(gL, -1));
+ lua_pop(gL, 1);
+ blockfuncerror = true;
+ return 0; // *shrugs*
+ }
+ if (!lua_isnil(gL, -1))
+ { // if nil, continue
+ if (lua_toboolean(gL, -1))
+ return 2; // stop whole search
+ else
+ return 1; // stop block search
+ }
+ lua_pop(gL, 1);
+ if (P_MobjWasRemoved(thing))
+ return 2;
+ }
+ }
+ plink = (polymaplink_t *)(plink->link.next);
+ }
+#endif
+
+ offset = *(blockmap + offset); // offset = blockmap[y*bmapwidth+x];
+
+ // First index is really empty, so +1 it.
+ for (list = blockmaplump + offset + 1; *list != -1; list++)
+ {
+ ld = &lines[*list];
+
+ if (ld->validcount == validcount)
+ continue; // Line has already been checked.
+
+ ld->validcount = validcount;
+
+ lua_pushvalue(L, 1);
+ LUA_PushUserdata(L, thing, META_MOBJ);
+ LUA_PushUserdata(L, ld, META_LINE);
+ if (lua_pcall(gL, 2, 1, 0)) {
+ if (!blockfuncerror || cv_debug & DBG_LUA)
+ CONS_Alert(CONS_WARNING,"%s\n",lua_tostring(gL, -1));
+ lua_pop(gL, 1);
+ blockfuncerror = true;
+ return 0; // *shrugs*
+ }
+ if (!lua_isnil(gL, -1))
+ { // if nil, continue
+ if (lua_toboolean(gL, -1))
+ return 2; // stop whole search
+ else
+ return 1; // stop block search
+ }
+ lua_pop(gL, 1);
+ if (P_MobjWasRemoved(thing))
+ return 2;
+ }
+ return 0; // Everything was checked.
+}
+
+// The searchBlockmap function
+// arguments: searchBlockmap(searchtype, function, mobj, [x1, x2, y1, y2])
+// return value:
+// true = search completely uninteruppted,
+// false = searching of at least one block stopped mid-way (including if the whole search was stopped)
+static int lib_searchBlockmap(lua_State *L)
+{
+ int searchtype = luaL_checkoption(L, 1, "objects", search_opt);
+ int n;
+ mobj_t *mobj;
+ INT32 xl, xh, yl, yh, bx, by;
+ fixed_t x1, x2, y1, y2;
+ boolean retval = true;
+ UINT8 funcret = 0;
+ blockmap_func searchFunc;
+
+ lua_remove(L, 1); // remove searchtype, stack is now function, mobj, [x1, x2, y1, y2]
+ luaL_checktype(L, 1, LUA_TFUNCTION);
+
+ switch (searchtype)
+ {
+ case 0: // "objects"
+ default:
+ searchFunc = lib_searchBlockmap_Objects;
+ break;
+ case 1: // "lines"
+ searchFunc = lib_searchBlockmap_Lines;
+ break;
+ }
+
+ // the mobj we are searching around, the "calling" mobj we could say
+ mobj = *((mobj_t **)luaL_checkudata(L, 2, META_MOBJ));
+ if (!mobj)
+ return LUA_ErrInvalid(L, "mobj_t");
+
+ n = lua_gettop(L);
+
+ if (n > 2) // specific x/y ranges have been supplied
+ {
+ if (n < 6)
+ return luaL_error(L, "arguments 4 to 6 not all given (expected 4 fixed-point integers)");
+
+ x1 = luaL_checkfixed(L, 3);
+ x2 = luaL_checkfixed(L, 4);
+ y1 = luaL_checkfixed(L, 5);
+ y2 = luaL_checkfixed(L, 6);
+ }
+ else // mobj and function only - search around mobj's radius by default
+ {
+ fixed_t radius = mobj->radius + MAXRADIUS;
+ x1 = mobj->x - radius;
+ x2 = mobj->x + radius;
+ y1 = mobj->y - radius;
+ y2 = mobj->y + radius;
+ }
+ lua_settop(L, 2); // pop everything except function, mobj
+
+ xl = (unsigned)(x1 - bmaporgx)>>MAPBLOCKSHIFT;
+ xh = (unsigned)(x2 - bmaporgx)>>MAPBLOCKSHIFT;
+ yl = (unsigned)(y1 - bmaporgy)>>MAPBLOCKSHIFT;
+ yh = (unsigned)(y2 - bmaporgy)>>MAPBLOCKSHIFT;
+
+ BMBOUNDFIX(xl, xh, yl, yh);
+
+ blockfuncerror = false; // reset
+ validcount++;
+ for (bx = xl; bx <= xh; bx++)
+ for (by = yl; by <= yh; by++)
+ {
+ funcret = searchFunc(L, bx, by, mobj);
+ // return value of searchFunc determines searchFunc's return value and/or when to stop
+ if (funcret == 2){ // stop whole search
+ lua_pushboolean(L, false); // return false
+ return 1;
+ }
+ else if (funcret == 1) // search was interrupted for this block
+ retval = false; // this changes the return value, but doesn't stop the whole search
+ // else don't do anything, continue as normal
+ if (P_MobjWasRemoved(mobj)){ // ...unless the original object was removed
+ lua_pushboolean(L, false); // in which case we have to stop now regardless
+ return 1;
+ }
+ }
+ lua_pushboolean(L, retval);
+ return 1;
+}
+
+int LUA_BlockmapLib(lua_State *L)
+{
+ lua_register(L, "searchBlockmap", lib_searchBlockmap);
+ return 0;
+}
+
+#endif
diff --git a/src/lua_consolelib.c b/src/lua_consolelib.c
index 366f0917..0ea0c809 100644
--- a/src/lua_consolelib.c
+++ b/src/lua_consolelib.c
@@ -1,7 +1,7 @@
// SONIC ROBO BLAST 2
//-----------------------------------------------------------------------------
// Copyright (C) 2012-2016 by John "JTE" Muniz.
-// Copyright (C) 2012-2016 by Sonic Team Junior.
+// Copyright (C) 2012-2018 by Sonic Team Junior.
//
// This program is free software distributed under the
// terms of the GNU General Public License, version 2.
diff --git a/src/lua_hook.h b/src/lua_hook.h
index 26b70570..2c9cd346 100644
--- a/src/lua_hook.h
+++ b/src/lua_hook.h
@@ -1,7 +1,7 @@
// SONIC ROBO BLAST 2
//-----------------------------------------------------------------------------
// Copyright (C) 2012-2016 by John "JTE" Muniz.
-// Copyright (C) 2012-2016 by Sonic Team Junior.
+// Copyright (C) 2012-2018 by Sonic Team Junior.
//
// This program is free software distributed under the
// terms of the GNU General Public License, version 2.
@@ -44,12 +44,18 @@ enum hook {
hook_HurtMsg,
hook_PlayerSpawn,
hook_PlayerQuit,
+ hook_ShouldSpin, //SRB2KART
+ hook_ShouldExplode, //SRB2KART
+ hook_ShouldSquish, //SRB2KART
+ hook_PlayerSpin, //SRB2KART
+ hook_PlayerExplode, //SRB2KART
+ hook_PlayerSquish, //SRB2KART
hook_MAX // last hook
};
extern const char *const hookNames[];
-void LUAh_MapChange(void); // Hook for map change (before load)
+void LUAh_MapChange(INT16 mapnumber); // Hook for map change (before load)
void LUAh_MapLoad(void); // Hook for map load
void LUAh_PlayerJoin(int playernum); // Hook for Got_AddPlayer
void LUAh_ThinkFrame(void); // Hook for frame (after mobj and player thinkers)
@@ -80,4 +86,11 @@ boolean LUAh_HurtMsg(player_t *player, mobj_t *inflictor, mobj_t *source); // Ho
#define LUAh_PlayerSpawn(player) LUAh_PlayerHook(player, hook_PlayerSpawn) // Hook for G_SpawnPlayer
void LUAh_PlayerQuit(player_t *plr, int reason); // Hook for player quitting
+UINT8 LUAh_ShouldSpin(player_t *player, mobj_t *inflictor, mobj_t *source); // SRB2KART: Should player be spun out?
+UINT8 LUAh_ShouldExplode(player_t *player, mobj_t *inflictor, mobj_t *source); // SRB2KART: Should player be exploded?
+UINT8 LUAh_ShouldSquish(player_t *player, mobj_t *inflictor, mobj_t *source); // SRB2KART: Should player be squished?
+
+boolean LUAh_PlayerSpin(player_t *player, mobj_t *inflictor, mobj_t *source); // SRB2KART: Hook for K_SpinPlayer. Allows Lua to execute code and/or overwrite its behavior.
+boolean LUAh_PlayerExplode(player_t *player, mobj_t *inflictor, mobj_t *source); // SRB2KART: Hook for K_ExplodePlayer. Allows Lua to execute code and/or overwrite its behavior.
+boolean LUAh_PlayerSquish(player_t *player, mobj_t *inflictor, mobj_t *source); // SRB2KART: Hook for K_SquishPlayer. Allows Lua to execute code and/or overwrite its behavior.
#endif
diff --git a/src/lua_hooklib.c b/src/lua_hooklib.c
index f06e28cd..13ad03d3 100644
--- a/src/lua_hooklib.c
+++ b/src/lua_hooklib.c
@@ -1,7 +1,7 @@
// SONIC ROBO BLAST 2
//-----------------------------------------------------------------------------
// Copyright (C) 2012-2016 by John "JTE" Muniz.
-// Copyright (C) 2012-2016 by Sonic Team Junior.
+// Copyright (C) 2012-2018 by Sonic Team Junior.
//
// This program is free software distributed under the
// terms of the GNU General Public License, version 2.
@@ -55,6 +55,12 @@ const char *const hookNames[hook_MAX+1] = {
"HurtMsg",
"PlayerSpawn",
"PlayerQuit",
+ "ShouldSpin",
+ "ShouldExplode",
+ "ShouldSquish",
+ "PlayerSpin",
+ "PlayerExplode",
+ "PlayerSquish",
NULL
};
@@ -154,6 +160,12 @@ static int lib_addHook(lua_State *L)
*p = 0;
}
break;
+ case hook_ShouldSpin:
+ case hook_ShouldExplode:
+ case hook_ShouldSquish:
+ case hook_PlayerSpin:
+ case hook_PlayerExplode:
+ case hook_PlayerSquish:
default:
break;
}
@@ -195,6 +207,12 @@ static int lib_addHook(lua_State *L)
case hook_LinedefExecute:
lastp = &linedefexecutorhooks;
break;
+ case hook_ShouldSpin:
+ case hook_ShouldExplode:
+ case hook_ShouldSquish:
+ case hook_PlayerSpin:
+ case hook_PlayerExplode:
+ case hook_PlayerSquish:
default:
lastp = &roothook;
break;
@@ -315,14 +333,14 @@ boolean LUAh_PlayerHook(player_t *plr, enum hook which)
}
// Hook for map change (before load)
-void LUAh_MapChange(void)
+void LUAh_MapChange(INT16 mapnumber)
{
hook_p hookp;
if (!gL || !(hooksAvailable[hook_MapChange/8] & (1<<(hook_MapChange%8))))
return;
lua_settop(gL, 0);
- lua_pushinteger(gL, gamemap);
+ lua_pushinteger(gL, mapnumber);
for (hookp = roothook; hookp; hookp = hookp->next)
if (hookp->type == hook_MapChange)
@@ -953,7 +971,7 @@ boolean LUAh_LinedefExecute(line_t *line, mobj_t *mo, sector_t *sector)
}
// Hook for player chat
-// Added the "mute" field. It's set to true if the message was supposed to be eaten by spam protection.
+// Added the "mute" field. It's set to true if the message was supposed to be eaten by spam protection.
// But for netgame consistency purposes, this hook is ran first reguardless, so this boolean allows for modders to adapt if they so desire.
boolean LUAh_PlayerMsg(int source, int target, int flags, char *msg, int mute)
{
@@ -987,7 +1005,7 @@ boolean LUAh_PlayerMsg(int source, int target, int flags, char *msg, int mute)
if (mute)
lua_pushboolean(gL, true); // the message was supposed to be eaten by spamprotecc.
else
- lua_pushboolean(gL, false);
+ lua_pushboolean(gL, false);
}
lua_pushfstring(gL, FMT_HOOKID, hookp->id);
lua_gettable(gL, LUA_REGISTRYINDEX);
@@ -1108,4 +1126,268 @@ void LUAh_PlayerQuit(player_t *plr, int reason)
lua_settop(gL, 0);
}
+// Hook for K_SpinPlayer. Determines if yes or no we should get damaged reguardless of circumstances.
+UINT8 LUAh_ShouldSpin(player_t *player, mobj_t *inflictor, mobj_t *source)
+{
+ hook_p hookp;
+ UINT8 shouldDamage = 0; // 0 = default, 1 = force yes, 2 = force no.
+ if (!gL || !(hooksAvailable[hook_ShouldSpin/8] & (1<<(hook_ShouldSpin%8))))
+ return 0;
+
+ lua_settop(gL, 0);
+
+ // We can afford not to check for mobj type because it will always be MT_PLAYER in this case.
+
+ for (hookp = roothook; hookp; hookp = hookp->next)
+ if (hookp->type == hook_ShouldSpin)
+ {
+ if (lua_gettop(gL) == 0)
+ {
+ LUA_PushUserdata(gL, player, META_PLAYER);
+ LUA_PushUserdata(gL, inflictor, META_MOBJ);
+ LUA_PushUserdata(gL, source, META_MOBJ);
+ }
+ lua_pushfstring(gL, FMT_HOOKID, hookp->id);
+ lua_gettable(gL, LUA_REGISTRYINDEX);
+ lua_pushvalue(gL, -4);
+ lua_pushvalue(gL, -4);
+ lua_pushvalue(gL, -4);
+ if (lua_pcall(gL, 3, 1, 0)) {
+ if (!hookp->error || cv_debug & DBG_LUA)
+ CONS_Alert(CONS_WARNING,"%s\n",lua_tostring(gL, -1));
+ lua_pop(gL, 1);
+ hookp->error = true;
+ continue;
+ }
+ if (!lua_isnil(gL, -1))
+ {
+ if (lua_toboolean(gL, -1))
+ shouldDamage = 1; // Force yes
+ else
+ shouldDamage = 2; // Force no
+ }
+ lua_pop(gL, 1);
+ }
+
+ lua_settop(gL, 0);
+ return shouldDamage;
+}
+
+// Hook for K_ExplodePlayer. Determines if yes or no we should get damaged reguardless of circumstances.
+UINT8 LUAh_ShouldExplode(player_t *player, mobj_t *inflictor, mobj_t *source)
+{
+ hook_p hookp;
+ UINT8 shouldDamage = 0; // 0 = default, 1 = force yes, 2 = force no.
+ if (!gL || !(hooksAvailable[hook_ShouldExplode/8] & (1<<(hook_ShouldExplode%8))))
+ return 0;
+
+ lua_settop(gL, 0);
+
+ // We can afford not to check for mobj type because it will always be MT_PLAYER in this case.
+
+ for (hookp = roothook; hookp; hookp = hookp->next)
+ if (hookp->type == hook_ShouldExplode)
+ {
+ if (lua_gettop(gL) == 0)
+ {
+ LUA_PushUserdata(gL, player, META_PLAYER);
+ LUA_PushUserdata(gL, inflictor, META_MOBJ);
+ LUA_PushUserdata(gL, source, META_MOBJ);
+ }
+ lua_pushfstring(gL, FMT_HOOKID, hookp->id);
+ lua_gettable(gL, LUA_REGISTRYINDEX);
+ lua_pushvalue(gL, -4);
+ lua_pushvalue(gL, -4);
+ lua_pushvalue(gL, -4);
+ if (lua_pcall(gL, 3, 1, 0)) {
+ if (!hookp->error || cv_debug & DBG_LUA)
+ CONS_Alert(CONS_WARNING,"%s\n",lua_tostring(gL, -1));
+ lua_pop(gL, 1);
+ hookp->error = true;
+ continue;
+ }
+ if (!lua_isnil(gL, -1))
+ {
+ if (lua_toboolean(gL, -1))
+ shouldDamage = 1; // Force yes
+ else
+ shouldDamage = 2; // Force no
+ }
+ lua_pop(gL, 1);
+ }
+
+ lua_settop(gL, 0);
+ return shouldDamage;
+}
+
+// Hook for K_SquishPlayer. Determines if yes or no we should get damaged reguardless of circumstances.
+UINT8 LUAh_ShouldSquish(player_t *player, mobj_t *inflictor, mobj_t *source)
+{
+ hook_p hookp;
+ UINT8 shouldDamage = 0; // 0 = default, 1 = force yes, 2 = force no.
+ if (!gL || !(hooksAvailable[hook_ShouldSquish/8] & (1<<(hook_ShouldSquish%8))))
+ return 0;
+
+ lua_settop(gL, 0);
+
+ // We can afford not to check for mobj type because it will always be MT_PLAYER in this case.
+
+ for (hookp = roothook; hookp; hookp = hookp->next)
+ if (hookp->type == hook_ShouldSquish)
+ {
+ if (lua_gettop(gL) == 0)
+ {
+ LUA_PushUserdata(gL, player, META_PLAYER);
+ LUA_PushUserdata(gL, inflictor, META_MOBJ);
+ LUA_PushUserdata(gL, source, META_MOBJ);
+ }
+ lua_pushfstring(gL, FMT_HOOKID, hookp->id);
+ lua_gettable(gL, LUA_REGISTRYINDEX);
+ lua_pushvalue(gL, -4);
+ lua_pushvalue(gL, -4);
+ lua_pushvalue(gL, -4);
+ if (lua_pcall(gL, 3, 1, 0)) {
+ if (!hookp->error || cv_debug & DBG_LUA)
+ CONS_Alert(CONS_WARNING,"%s\n",lua_tostring(gL, -1));
+ lua_pop(gL, 1);
+ hookp->error = true;
+ continue;
+ }
+ if (!lua_isnil(gL, -1))
+ {
+ if (lua_toboolean(gL, -1))
+ shouldDamage = 1; // Force yes
+ else
+ shouldDamage = 2; // Force no
+ }
+ lua_pop(gL, 1);
+ }
+
+ lua_settop(gL, 0);
+ return shouldDamage;
+}
+
+// Hook for K_SpinPlayer. This is used when the player has actually been spun out, but before anything has actually been done. This allows Lua to overwrite the behavior or to just perform actions.
+boolean LUAh_PlayerSpin(player_t *player, mobj_t *inflictor, mobj_t *source)
+{
+ hook_p hookp;
+ boolean hooked = false;
+ if (!gL || !(hooksAvailable[hook_PlayerSpin/8] & (1<<(hook_PlayerSpin%8))))
+ return 0;
+
+ lua_settop(gL, 0);
+
+ // We can afford not to look for target->type because it will always be MT_PLAYER.
+
+ for (hookp = roothook; hookp; hookp = hookp->next)
+ if (hookp->type == hook_PlayerSpin)
+ {
+ if (lua_gettop(gL) == 0)
+ {
+ LUA_PushUserdata(gL, player, META_PLAYER);
+ LUA_PushUserdata(gL, inflictor, META_MOBJ);
+ LUA_PushUserdata(gL, source, META_MOBJ);
+ }
+ lua_pushfstring(gL, FMT_HOOKID, hookp->id);
+ lua_gettable(gL, LUA_REGISTRYINDEX);
+ lua_pushvalue(gL, -4);
+ lua_pushvalue(gL, -4);
+ lua_pushvalue(gL, -4);
+ if (lua_pcall(gL, 3, 1, 0)) {
+ if (!hookp->error || cv_debug & DBG_LUA)
+ CONS_Alert(CONS_WARNING,"%s\n",lua_tostring(gL, -1));
+ lua_pop(gL, 1);
+ hookp->error = true;
+ continue;
+ }
+ if (lua_toboolean(gL, -1))
+ hooked = true;
+ lua_pop(gL, 1);
+ }
+ lua_settop(gL, 0);
+ return hooked;
+}
+
+// Hook for K_SquishPlayer. This is used when the player has actually been spun out, but before anything has actually been done. This allows Lua to overwrite the behavior or to just perform actions.
+boolean LUAh_PlayerSquish(player_t *player, mobj_t *inflictor, mobj_t *source)
+{
+ hook_p hookp;
+ boolean hooked = false;
+ if (!gL || !(hooksAvailable[hook_PlayerSquish/8] & (1<<(hook_PlayerSquish%8))))
+ return 0;
+
+ lua_settop(gL, 0);
+
+ // We can afford not to look for target->type because it will always be MT_PLAYER.
+
+ for (hookp = roothook; hookp; hookp = hookp->next)
+ if (hookp->type == hook_PlayerSquish)
+ {
+ if (lua_gettop(gL) == 0)
+ {
+ LUA_PushUserdata(gL, player, META_PLAYER);
+ LUA_PushUserdata(gL, inflictor, META_MOBJ);
+ LUA_PushUserdata(gL, source, META_MOBJ);
+ }
+ lua_pushfstring(gL, FMT_HOOKID, hookp->id);
+ lua_gettable(gL, LUA_REGISTRYINDEX);
+ lua_pushvalue(gL, -4);
+ lua_pushvalue(gL, -4);
+ lua_pushvalue(gL, -4);
+ if (lua_pcall(gL, 3, 1, 0)) {
+ if (!hookp->error || cv_debug & DBG_LUA)
+ CONS_Alert(CONS_WARNING,"%s\n",lua_tostring(gL, -1));
+ lua_pop(gL, 1);
+ hookp->error = true;
+ continue;
+ }
+ if (lua_toboolean(gL, -1))
+ hooked = true;
+ lua_pop(gL, 1);
+ }
+ lua_settop(gL, 0);
+ return hooked;
+}
+
+// Hook for K_ExplodePlayer. This is used when the player has actually been spun out, but before anything has actually been done. This allows Lua to overwrite the behavior or to just perform actions.
+boolean LUAh_PlayerExplode(player_t *player, mobj_t *inflictor, mobj_t *source)
+{
+ hook_p hookp;
+ boolean hooked = false;
+ if (!gL || !(hooksAvailable[hook_PlayerExplode/8] & (1<<(hook_PlayerExplode%8))))
+ return 0;
+
+ lua_settop(gL, 0);
+
+ // We can afford not to look for target->type because it will always be MT_PLAYER.
+
+ for (hookp = roothook; hookp; hookp = hookp->next)
+ if (hookp->type == hook_PlayerExplode)
+ {
+ if (lua_gettop(gL) == 0)
+ {
+ LUA_PushUserdata(gL, player, META_PLAYER);
+ LUA_PushUserdata(gL, inflictor, META_MOBJ);
+ LUA_PushUserdata(gL, source, META_MOBJ);
+ }
+ lua_pushfstring(gL, FMT_HOOKID, hookp->id);
+ lua_gettable(gL, LUA_REGISTRYINDEX);
+ lua_pushvalue(gL, -4);
+ lua_pushvalue(gL, -4);
+ lua_pushvalue(gL, -4);
+ if (lua_pcall(gL, 3, 1, 0)) {
+ if (!hookp->error || cv_debug & DBG_LUA)
+ CONS_Alert(CONS_WARNING,"%s\n",lua_tostring(gL, -1));
+ lua_pop(gL, 1);
+ hookp->error = true;
+ continue;
+ }
+ if (lua_toboolean(gL, -1))
+ hooked = true;
+ lua_pop(gL, 1);
+ }
+ lua_settop(gL, 0);
+ return hooked;
+}
+
#endif
diff --git a/src/lua_hud.h b/src/lua_hud.h
index 17281b4e..3216ab15 100644
--- a/src/lua_hud.h
+++ b/src/lua_hud.h
@@ -1,7 +1,7 @@
// SONIC ROBO BLAST 2
//-----------------------------------------------------------------------------
// Copyright (C) 2014-2016 by John "JTE" Muniz.
-// Copyright (C) 2014-2016 by Sonic Team Junior.
+// Copyright (C) 2014-2018 by Sonic Team Junior.
//
// This program is free software distributed under the
// terms of the GNU General Public License, version 2.
diff --git a/src/lua_hudlib.c b/src/lua_hudlib.c
index f042e8f5..353aebb2 100644
--- a/src/lua_hudlib.c
+++ b/src/lua_hudlib.c
@@ -1,7 +1,7 @@
// SONIC ROBO BLAST 2
//-----------------------------------------------------------------------------
// Copyright (C) 2014-2016 by John "JTE" Muniz.
-// Copyright (C) 2014-2016 by Sonic Team Junior.
+// Copyright (C) 2014-2018 by Sonic Team Junior.
//
// This program is free software distributed under the
// terms of the GNU General Public License, version 2.
@@ -515,8 +515,8 @@ static int libd_getColormap(lua_State *L)
else if (lua_type(L, 1) == LUA_TNUMBER) // skin number
{
skinnum = (INT32)luaL_checkinteger(L, 1);
- if (skinnum < TC_ALLWHITE || skinnum >= MAXSKINS)
- return luaL_error(L, "skin number %d is out of range (%d - %d)", skinnum, TC_ALLWHITE, MAXSKINS-1);
+ if (skinnum < TC_BLINK || skinnum >= MAXSKINS)
+ return luaL_error(L, "skin number %d is out of range (%d - %d)", skinnum, TC_BLINK, MAXSKINS-1);
}
else // skin name
{
diff --git a/src/lua_infolib.c b/src/lua_infolib.c
index f6bb7d30..9b22170f 100644
--- a/src/lua_infolib.c
+++ b/src/lua_infolib.c
@@ -1,7 +1,7 @@
// SONIC ROBO BLAST 2
//-----------------------------------------------------------------------------
// Copyright (C) 2012-2016 by John "JTE" Muniz.
-// Copyright (C) 2012-2016 by Sonic Team Junior.
+// Copyright (C) 2012-2018 by Sonic Team Junior.
//
// This program is free software distributed under the
// terms of the GNU General Public License, version 2.
diff --git a/src/lua_libs.h b/src/lua_libs.h
index 01345ee1..cb1cb49c 100644
--- a/src/lua_libs.h
+++ b/src/lua_libs.h
@@ -1,7 +1,7 @@
// SONIC ROBO BLAST 2
//-----------------------------------------------------------------------------
// Copyright (C) 2012-2016 by John "JTE" Muniz.
-// Copyright (C) 2012-2016 by Sonic Team Junior.
+// Copyright (C) 2012-2018 by Sonic Team Junior.
//
// This program is free software distributed under the
// terms of the GNU General Public License, version 2.
@@ -71,6 +71,7 @@ int LUA_PlayerLib(lua_State *L);
int LUA_SkinLib(lua_State *L);
int LUA_ThinkerLib(lua_State *L);
int LUA_MapLib(lua_State *L);
+int LUA_BlockmapLib(lua_State *L);
int LUA_HudLib(lua_State *L);
#endif
diff --git a/src/lua_maplib.c b/src/lua_maplib.c
index 655165e6..7599b261 100644
--- a/src/lua_maplib.c
+++ b/src/lua_maplib.c
@@ -1,7 +1,7 @@
// SONIC ROBO BLAST 2
//-----------------------------------------------------------------------------
// Copyright (C) 2012-2016 by John "JTE" Muniz.
-// Copyright (C) 2012-2016 by Sonic Team Junior.
+// Copyright (C) 2012-2018 by Sonic Team Junior.
//
// This program is free software distributed under the
// terms of the GNU General Public License, version 2.
@@ -1090,6 +1090,7 @@ static int ffloor_get(lua_State *L)
{
ffloor_t *ffloor = *((ffloor_t **)luaL_checkudata(L, 1, META_FFLOOR));
enum ffloor_e field = luaL_checkoption(L, 2, ffloor_opt[0], ffloor_opt);
+ INT16 i;
if (!ffloor)
{
@@ -1109,11 +1110,11 @@ static int ffloor_get(lua_State *L)
lua_pushfixed(L, *ffloor->topheight);
return 1;
case ffloor_toppic: { // toppic
- levelflat_t *levelflat;
- INT16 i;
- for (i = 0, levelflat = levelflats; i != *ffloor->toppic; i++, levelflat++)
- ;
- lua_pushlstring(L, levelflat->name, 8);
+ levelflat_t *levelflat = &levelflats[*ffloor->toppic];
+ for (i = 0; i < 8; i++)
+ if (!levelflat->name[i])
+ break;
+ lua_pushlstring(L, levelflat->name, i);
return 1;
}
case ffloor_toplightlevel:
@@ -1123,11 +1124,11 @@ static int ffloor_get(lua_State *L)
lua_pushfixed(L, *ffloor->bottomheight);
return 1;
case ffloor_bottompic: { // bottompic
- levelflat_t *levelflat;
- INT16 i;
- for (i = 0, levelflat = levelflats; i != *ffloor->bottompic; i++, levelflat++)
- ;
- lua_pushlstring(L, levelflat->name, 8);
+ levelflat_t *levelflat = &levelflats[*ffloor->bottompic];
+ for (i = 0; i < 8; i++)
+ if (!levelflat->name[i])
+ break;
+ lua_pushlstring(L, levelflat->name, i);
return 1;
}
#ifdef ESLOPE
@@ -1506,6 +1507,8 @@ static int mapheaderinfo_get(lua_State *L)
lua_pushinteger(L, header->levelselect);
else if (fastcmp(field,"bonustype"))
lua_pushinteger(L, header->bonustype);
+ else if (fastcmp(field,"saveoverride"))
+ lua_pushinteger(L, header->saveoverride);
else if (fastcmp(field,"levelflags"))
lua_pushinteger(L, header->levelflags);
else if (fastcmp(field,"menuflags"))
diff --git a/src/lua_mathlib.c b/src/lua_mathlib.c
index 50a194c8..8c9d1006 100644
--- a/src/lua_mathlib.c
+++ b/src/lua_mathlib.c
@@ -1,7 +1,7 @@
// SONIC ROBO BLAST 2
//-----------------------------------------------------------------------------
// Copyright (C) 2012-2016 by John "JTE" Muniz.
-// Copyright (C) 2012-2016 by Sonic Team Junior.
+// Copyright (C) 2012-2018 by Sonic Team Junior.
//
// This program is free software distributed under the
// terms of the GNU General Public License, version 2.
diff --git a/src/lua_mobjlib.c b/src/lua_mobjlib.c
index 71bef8c7..34aba0a3 100644
--- a/src/lua_mobjlib.c
+++ b/src/lua_mobjlib.c
@@ -1,7 +1,7 @@
// SONIC ROBO BLAST 2
//-----------------------------------------------------------------------------
// Copyright (C) 2012-2016 by John "JTE" Muniz.
-// Copyright (C) 2012-2016 by Sonic Team Junior.
+// Copyright (C) 2012-2018 by Sonic Team Junior.
//
// This program is free software distributed under the
// terms of the GNU General Public License, version 2.
diff --git a/src/lua_playerlib.c b/src/lua_playerlib.c
index 1eed10b0..067124ba 100644
--- a/src/lua_playerlib.c
+++ b/src/lua_playerlib.c
@@ -1,7 +1,7 @@
// SONIC ROBO BLAST 2
//-----------------------------------------------------------------------------
// Copyright (C) 2012-2016 by John "JTE" Muniz.
-// Copyright (C) 2012-2016 by Sonic Team Junior.
+// Copyright (C) 2012-2018 by Sonic Team Junior.
//
// This program is free software distributed under the
// terms of the GNU General Public License, version 2.
@@ -246,8 +246,6 @@ static int player_get(lua_State *L)
lua_pushinteger(L, plr->starpostz);
else if (fastcmp(field,"starpostnum"))
lua_pushinteger(L, plr->starpostnum);
- else if (fastcmp(field,"starpostcount"))
- lua_pushinteger(L, plr->starpostcount);
else if (fastcmp(field,"starposttime"))
lua_pushinteger(L, plr->starposttime);
else if (fastcmp(field,"starpostangle"))
@@ -519,8 +517,6 @@ static int player_set(lua_State *L)
plr->starpostz = (INT16)luaL_checkinteger(L, 3);
else if (fastcmp(field,"starpostnum"))
plr->starpostnum = (INT32)luaL_checkinteger(L, 3);
- else if (fastcmp(field,"starpostcount"))
- plr->starpostcount = (INT32)luaL_checkinteger(L, 3);
else if (fastcmp(field,"starposttime"))
plr->starposttime = (tic_t)luaL_checkinteger(L, 3);
else if (fastcmp(field,"starpostangle"))
diff --git a/src/lua_script.c b/src/lua_script.c
index 0f5c64a5..34a26052 100644
--- a/src/lua_script.c
+++ b/src/lua_script.c
@@ -1,7 +1,7 @@
// SONIC ROBO BLAST 2
//-----------------------------------------------------------------------------
// Copyright (C) 2012-2016 by John "JTE" Muniz.
-// Copyright (C) 2012-2016 by Sonic Team Junior.
+// Copyright (C) 2012-2018 by Sonic Team Junior.
//
// This program is free software distributed under the
// terms of the GNU General Public License, version 2.
@@ -51,6 +51,7 @@ static lua_CFunction liblist[] = {
LUA_SkinLib, // skin_t, skins[]
LUA_ThinkerLib, // thinker_t
LUA_MapLib, // line_t, side_t, sector_t, subsector_t
+ LUA_BlockmapLib, // blockmap stuff
LUA_HudLib, // HUD stuff
NULL
};
@@ -173,6 +174,7 @@ static inline void LUA_LoadFile(MYFILE *f, char *name)
LUA_ClearState();
lua_pushinteger(gL, f->wad);
lua_setfield(gL, LUA_REGISTRYINDEX, "WAD");
+
if (luaL_loadbuffer(gL, f->data, f->size, va("@%s",name)) || lua_pcall(gL, 0, 0, 0)) {
CONS_Alert(CONS_WARNING,"%s\n",lua_tostring(gL,-1));
lua_pop(gL,1);
@@ -192,17 +194,23 @@ void LUA_LoadLump(UINT16 wad, UINT16 lump)
W_ReadLumpPwad(wad, lump, f.data);
f.curpos = f.data;
- len = strlen(wadfiles[wad]->filename);
- name = malloc(len+10);
- strcpy(name, wadfiles[wad]->filename);
- if (!fasticmp(&name[len - 4], ".lua")) {
- // If it's not a .lua file, copy the lump name in too.
- name[len] = '|';
- M_Memcpy(name+len+1, wadfiles[wad]->lumpinfo[lump].name, 8);
- name[len+9] = '\0';
+ len = strlen(wadfiles[wad]->filename); // length of file name
+
+ if (wadfiles[wad]->type == RET_LUA)
+ {
+ name = malloc(len+1);
+ strcpy(name, wadfiles[wad]->filename);
+ }
+ else // If it's not a .lua file, copy the lump name in too.
+ {
+ lumpinfo_t *lump_p = &wadfiles[wad]->lumpinfo[lump];
+ len += 1 + strlen(lump_p->name2); // length of file name, '|', and lump name
+ name = malloc(len+1);
+ sprintf(name, "%s|%s", wadfiles[wad]->filename, lump_p->name2);
+ name[len] = '\0';
}
- LUA_LoadFile(&f, name);
+ LUA_LoadFile(&f, name); // actually load file!
free(name);
Z_Free(f.data);
diff --git a/src/lua_script.h b/src/lua_script.h
index 3b159234..f944149d 100644
--- a/src/lua_script.h
+++ b/src/lua_script.h
@@ -1,7 +1,7 @@
// SONIC ROBO BLAST 2
//-----------------------------------------------------------------------------
// Copyright (C) 2012-2016 by John "JTE" Muniz.
-// Copyright (C) 2012-2016 by Sonic Team Junior.
+// Copyright (C) 2012-2018 by Sonic Team Junior.
//
// This program is free software distributed under the
// terms of the GNU General Public License, version 2.
diff --git a/src/lua_skinlib.c b/src/lua_skinlib.c
index 7223e8db..8fdd92a5 100644
--- a/src/lua_skinlib.c
+++ b/src/lua_skinlib.c
@@ -1,7 +1,7 @@
// SONIC ROBO BLAST 2
//-----------------------------------------------------------------------------
// Copyright (C) 2014-2016 by John "JTE" Muniz.
-// Copyright (C) 2014-2016 by Sonic Team Junior.
+// Copyright (C) 2014-2018 by Sonic Team Junior.
//
// This program is free software distributed under the
// terms of the GNU General Public License, version 2.
diff --git a/src/lua_thinkerlib.c b/src/lua_thinkerlib.c
index aaa8435e..ae859d46 100644
--- a/src/lua_thinkerlib.c
+++ b/src/lua_thinkerlib.c
@@ -1,7 +1,7 @@
// SONIC ROBO BLAST 2
//-----------------------------------------------------------------------------
// Copyright (C) 2012-2016 by John "JTE" Muniz.
-// Copyright (C) 2012-2016 by Sonic Team Junior.
+// Copyright (C) 2012-2018 by Sonic Team Junior.
//
// This program is free software distributed under the
// terms of the GNU General Public License, version 2.
diff --git a/src/m_aatree.c b/src/m_aatree.c
index 6cb3a32c..f19fa1dc 100644
--- a/src/m_aatree.c
+++ b/src/m_aatree.c
@@ -2,7 +2,7 @@
//-----------------------------------------------------------------------------
// Copyright (C) 1993-1996 by id Software, Inc.
// Copyright (C) 1998-2000 by DooM Legacy Team.
-// Copyright (C) 1999-2016 by Sonic Team Junior.
+// Copyright (C) 1999-2018 by Sonic Team Junior.
//
// This program is free software distributed under the
// terms of the GNU General Public License, version 2.
diff --git a/src/m_aatree.h b/src/m_aatree.h
index eeaebca3..e7f1eba0 100644
--- a/src/m_aatree.h
+++ b/src/m_aatree.h
@@ -2,7 +2,7 @@
//-----------------------------------------------------------------------------
// Copyright (C) 1993-1996 by id Software, Inc.
// Copyright (C) 1998-2000 by DooM Legacy Team.
-// Copyright (C) 1999-2016 by Sonic Team Junior.
+// Copyright (C) 1999-2018 by Sonic Team Junior.
//
// This program is free software distributed under the
// terms of the GNU General Public License, version 2.
diff --git a/src/m_anigif.c b/src/m_anigif.c
index edb41f6a..4e68819b 100644
--- a/src/m_anigif.c
+++ b/src/m_anigif.c
@@ -2,7 +2,7 @@
//-----------------------------------------------------------------------------
// Copyright (C) 2013-2016 by Matthew "Inuyasha" Walsh.
// Copyright (C) 2013 by "Ninji".
-// Copyright (C) 2013-2016 by Sonic Team Junior.
+// Copyright (C) 2013-2018 by Sonic Team Junior.
//
// This program is free software distributed under the
// terms of the GNU General Public License, version 2.
diff --git a/src/m_anigif.h b/src/m_anigif.h
index dbf7b10a..6d94ecf8 100644
--- a/src/m_anigif.h
+++ b/src/m_anigif.h
@@ -1,7 +1,7 @@
// SONIC ROBO BLAST 2
//-----------------------------------------------------------------------------
// Copyright (C) 2013-2016 by Matthew "Inuyasha" Walsh.
-// Copyright (C) 2013-2016 by Sonic Team Junior.
+// Copyright (C) 2013-2018 by Sonic Team Junior.
//
// This program is free software distributed under the
// terms of the GNU General Public License, version 2.
diff --git a/src/m_argv.c b/src/m_argv.c
index 859fc902..e8bfdd3d 100644
--- a/src/m_argv.c
+++ b/src/m_argv.c
@@ -2,7 +2,7 @@
//-----------------------------------------------------------------------------
// Copyright (C) 1993-1996 by id Software, Inc.
// Copyright (C) 1998-2000 by DooM Legacy Team.
-// Copyright (C) 1999-2016 by Sonic Team Junior.
+// Copyright (C) 1999-2018 by Sonic Team Junior.
//
// This program is free software distributed under the
// terms of the GNU General Public License, version 2.
@@ -25,6 +25,10 @@ INT32 myargc;
*/
char **myargv;
+/** \brief did we alloc myargv ourselves?
+*/
+boolean myargmalloc = false;
+
/** \brief founded the parm
*/
static INT32 found;
@@ -176,6 +180,7 @@ void M_FindResponseFile(void)
free(file);
I_Error("Not enough memory to read response file");
}
+ myargmalloc = true; // mark as having been allocated by us
memset(myargv, 0, sizeof (char *) * MAXARGVS);
myargv[0] = firstargv;
@@ -198,14 +203,12 @@ void M_FindResponseFile(void)
k++;
} while (k < size);
- free(file);
-
for (k = 0; k < pindex; k++)
myargv[indexinfile++] = moreargs[k];
myargc = indexinfile;
// display arguments
- CONS_Printf(M_GetText("%d command-line args:\n"), myargc);
+ CONS_Printf(M_GetText("%d command-line args:\n"), myargc-1); // -1 so @ don't actually get counted for
for (k = 1; k < myargc; k++)
CONS_Printf("%s\n", myargv[k]);
diff --git a/src/m_argv.h b/src/m_argv.h
index 46ef9a2c..d654dcc1 100644
--- a/src/m_argv.h
+++ b/src/m_argv.h
@@ -2,7 +2,7 @@
//-----------------------------------------------------------------------------
// Copyright (C) 1993-1996 by id Software, Inc.
// Copyright (C) 1998-2000 by DooM Legacy Team.
-// Copyright (C) 1999-2016 by Sonic Team Junior.
+// Copyright (C) 1999-2018 by Sonic Team Junior.
//
// This program is free software distributed under the
// terms of the GNU General Public License, version 2.
@@ -19,6 +19,7 @@
//
extern INT32 myargc;
extern char **myargv;
+extern boolean myargmalloc;
// Returns the position of the given parameter in the arg list (0 if not found).
INT32 M_CheckParm(const char *check);
diff --git a/src/m_bbox.c b/src/m_bbox.c
index fb44b853..0c57de43 100644
--- a/src/m_bbox.c
+++ b/src/m_bbox.c
@@ -2,7 +2,7 @@
//-----------------------------------------------------------------------------
// Copyright (C) 1993-1996 by id Software, Inc.
// Copyright (C) 1998-2000 by DooM Legacy Team.
-// Copyright (C) 1999-2016 by Sonic Team Junior.
+// Copyright (C) 1999-2018 by Sonic Team Junior.
//
// This program is free software distributed under the
// terms of the GNU General Public License, version 2.
diff --git a/src/m_bbox.h b/src/m_bbox.h
index a11257b8..db5c2b4a 100644
--- a/src/m_bbox.h
+++ b/src/m_bbox.h
@@ -2,7 +2,7 @@
//-----------------------------------------------------------------------------
// Copyright (C) 1993-1996 by id Software, Inc.
// Copyright (C) 1998-2000 by DooM Legacy Team.
-// Copyright (C) 1999-2016 by Sonic Team Junior.
+// Copyright (C) 1999-2018 by Sonic Team Junior.
//
// This program is free software distributed under the
// terms of the GNU General Public License, version 2.
diff --git a/src/m_cheat.c b/src/m_cheat.c
index e57a85ae..38d8cc7a 100644
--- a/src/m_cheat.c
+++ b/src/m_cheat.c
@@ -2,7 +2,7 @@
//-----------------------------------------------------------------------------
// Copyright (C) 1993-1996 by id Software, Inc.
// Copyright (C) 1998-2000 by DooM Legacy Team.
-// Copyright (C) 1999-2016 by Sonic Team Junior.
+// Copyright (C) 1999-2018 by Sonic Team Junior.
//
// This program is free software distributed under the
// terms of the GNU General Public License, version 2.
@@ -97,7 +97,7 @@ static UINT8 cheatf_warp(void)
if (success)
{
- G_SetGameModified(false);
+ G_SaveGameData(true); //G_SetGameModified(false);
S_StartSound(0, sfx_kc42);
}
@@ -1130,12 +1130,12 @@ void OP_ObjectplaceMovement(player_t *player)
P_TeleportMove(player->mo, player->mo->x+player->mo->momx, player->mo->y+player->mo->momy, player->mo->z);
player->mo->momx = player->mo->momy = 0;
}
- if (cmd->sidemove != 0)
+ /*if (cmd->sidemove != 0) -- was disabled in practice anyways, since sidemove was suppressed
{
P_Thrust(player->mo, player->mo->angle-ANGLE_90, (cmd->sidemove*FRACUNIT/MAXPLMOVE)*cv_speed.value);
P_TeleportMove(player->mo, player->mo->x+player->mo->momx, player->mo->y+player->mo->momy, player->mo->z);
player->mo->momx = player->mo->momy = 0;
- }
+ }*/
if (player->mo->z > player->mo->ceilingz - player->mo->height)
player->mo->z = player->mo->ceilingz - player->mo->height;
diff --git a/src/m_cheat.h b/src/m_cheat.h
index 3b5a1d0f..95c0060d 100644
--- a/src/m_cheat.h
+++ b/src/m_cheat.h
@@ -2,7 +2,7 @@
//-----------------------------------------------------------------------------
// Copyright (C) 1993-1996 by id Software, Inc.
// Copyright (C) 1998-2000 by DooM Legacy Team.
-// Copyright (C) 1999-2016 by Sonic Team Junior.
+// Copyright (C) 1999-2018 by Sonic Team Junior.
//
// This program is free software distributed under the
// terms of the GNU General Public License, version 2.
diff --git a/src/m_cond.c b/src/m_cond.c
index 5a9d4f2a..35eccd1c 100644
--- a/src/m_cond.c
+++ b/src/m_cond.c
@@ -1,7 +1,7 @@
// SONIC ROBO BLAST 2
//-----------------------------------------------------------------------------
// Copyright (C) 2012-2016 by Matthew "Inuyasha" Walsh.
-// Copyright (C) 2012-2016 by Sonic Team Junior.
+// Copyright (C) 2012-2018 by Sonic Team Junior.
//
// This program is free software distributed under the
// terms of the GNU General Public License, version 2.
@@ -535,6 +535,12 @@ UINT8 M_AnySecretUnlocked(void)
UINT8 M_SecretUnlocked(INT32 type)
{
INT32 i;
+
+#if 1
+ if (dedicated)
+ return true;
+#endif
+
for (i = 0; i < MAXUNLOCKABLES; ++i)
{
if (unlockables[i].type == type && unlockables[i].unlocked)
diff --git a/src/m_cond.h b/src/m_cond.h
index f48e6fbe..07e4480d 100644
--- a/src/m_cond.h
+++ b/src/m_cond.h
@@ -1,7 +1,7 @@
// SONIC ROBO BLAST 2
//-----------------------------------------------------------------------------
// Copyright (C) 2012-2016 by Matthew "Inuyasha" Walsh.
-// Copyright (C) 2012-2016 by Sonic Team Junior.
+// Copyright (C) 2012-2018 by Sonic Team Junior.
//
// This program is free software distributed under the
// terms of the GNU General Public License, version 2.
diff --git a/src/m_dllist.h b/src/m_dllist.h
index f19659cc..18f35114 100644
--- a/src/m_dllist.h
+++ b/src/m_dllist.h
@@ -1,7 +1,7 @@
// SONIC ROBO BLAST 2
//-----------------------------------------------------------------------------
// Copyright (C) 2005 by James Haley
-// Copyright (C) 2005-2016 by Sonic Team Junior.
+// Copyright (C) 2005-2018 by Sonic Team Junior.
//
// This program is free software distributed under the
// terms of the GNU General Public License, version 2.
diff --git a/src/m_fixed.c b/src/m_fixed.c
index 01445738..d45bb70b 100644
--- a/src/m_fixed.c
+++ b/src/m_fixed.c
@@ -2,7 +2,7 @@
//-----------------------------------------------------------------------------
// Copyright (C) 1993-1996 by id Software, Inc.
// Copyright (C) 1998-2000 by DooM Legacy Team.
-// Copyright (C) 1999-2016 by Sonic Team Junior.
+// Copyright (C) 1999-2018 by Sonic Team Junior.
//
// This program is free software distributed under the
// terms of the GNU General Public License, version 2.
@@ -432,7 +432,7 @@ vector3_t *FV3_Cross(const vector3_t *a_1, const vector3_t *a_2, vector3_t *a_o)
//
vector3_t *FV3_ClosestPointOnLine(const vector3_t *Line, const vector3_t *p, vector3_t *out)
{
- // Determine t (the length of the vector from Line[0] to p)
+ // Determine t (the length of the vector from �Line[0]� to �p�)
vector3_t c, V;
fixed_t t, d = 0;
FV3_SubEx(p, &Line[0], &c);
@@ -442,7 +442,7 @@ vector3_t *FV3_ClosestPointOnLine(const vector3_t *Line, const vector3_t *p, vec
d = FV3_Distance(&Line[0], &Line[1]);
t = FV3_Dot(&V, &c);
- // Check to see if t is beyond the extents of the line segment
+ // Check to see if �t� is beyond the extents of the line segment
if (t < 0)
{
return FV3_Copy(out, &Line[0]);
@@ -452,7 +452,7 @@ vector3_t *FV3_ClosestPointOnLine(const vector3_t *Line, const vector3_t *p, vec
return FV3_Copy(out, &Line[1]);
}
- // Return the point between Line[0] and Line[1]
+ // Return the point between �Line[0]� and �Line[1]�
FV3_Mul(&V, t);
return FV3_AddEx(&Line[0], &V, out);
diff --git a/src/m_fixed.h b/src/m_fixed.h
index 77382398..4609913b 100644
--- a/src/m_fixed.h
+++ b/src/m_fixed.h
@@ -2,7 +2,7 @@
//-----------------------------------------------------------------------------
// Copyright (C) 1993-1996 by id Software, Inc.
// Copyright (C) 1998-2000 by DooM Legacy Team.
-// Copyright (C) 1999-2016 by Sonic Team Junior.
+// Copyright (C) 1999-2018 by Sonic Team Junior.
//
// This program is free software distributed under the
// terms of the GNU General Public License, version 2.
@@ -75,7 +75,7 @@ typedef INT32 fixed_t;
:"=a" (ret) // eax is always the result and the first operand (%0,%1)
:"0" (a), "r" (b) // and %2 is what we use imull on with what in %1
, "I" (FRACBITS) // %3 holds FRACBITS (normally 16)
- :"%cc", "%edx" // edx and condition codes clobbered
+ :"cc", "%edx" // edx and condition codes clobbered
);
return ret;
}
diff --git a/src/m_menu.c b/src/m_menu.c
index 7d7c1fbf..f0831a17 100644
--- a/src/m_menu.c
+++ b/src/m_menu.c
@@ -3,7 +3,7 @@
// Copyright (C) 1993-1996 by id Software, Inc.
// Copyright (C) 1998-2000 by DooM Legacy Team.
// Copyright (C) 2011-2016 by Matthew "Inuyasha" Walsh.
-// Copyright (C) 1999-2016 by Sonic Team Junior.
+// Copyright (C) 1999-2018 by Sonic Team Junior.
//
// This program is free software distributed under the
// terms of the GNU General Public License, version 2.
@@ -59,22 +59,27 @@
#include "k_kart.h" // SRB2kart
#include "d_player.h" // KITEM_ constants
+#include "i_joy.h" // for joystick menu controls
+
// Condition Sets
#include "m_cond.h"
// And just some randomness for the exits.
#include "m_random.h"
+#if defined(HAVE_SDL)
+#include "SDL.h"
+#if SDL_VERSION_ATLEAST(2,0,0)
+#include "sdl/sdlmain.h" // JOYSTICK_HOTPLUG
+#endif
+#endif
+
#ifdef PC_DOS
#include // for snprintf
int snprintf(char *str, size_t n, const char *fmt, ...);
//int vsnprintf(char *str, size_t n, const char *fmt, va_list ap);
#endif
-#if defined (__GNUC__) && (__GNUC__ >= 4)
-#define FIXUPO0
-#endif
-
#define SKULLXOFF -32
#define LINEHEIGHT 16
#define STRINGHEIGHT 8
@@ -168,7 +173,7 @@ typedef enum
levellist_mode_t levellistmode = LLM_CREATESERVER;
UINT8 maplistoption = 0;
-static char joystickInfo[8][25];
+static char joystickInfo[8][29];
#ifndef NONET
static UINT32 serverlistpage;
#endif
@@ -180,9 +185,7 @@ INT16 startmap; // Mario, NiGHTS, or just a plain old normal game?
static INT16 itemOn = 1; // menu item skull is on, Hack by Tails 09-18-2002
static INT16 skullAnimCounter = 10; // skull animation counter
-static boolean setupcontrols_secondaryplayer;
-static boolean setupcontrols_thirdplayer;
-static boolean setupcontrols_fourthplayer;
+static UINT8 setupcontrolplayer;
static INT32 (*setupcontrols)[2]; // pointer to the gamecontrols of the player being edited
// shhh... what am I doing... nooooo!
@@ -304,6 +307,7 @@ static void M_Setup4PJoystickMenu(INT32 choice);
static void M_AssignJoystick(INT32 choice);
static void M_ChangeControl(INT32 choice);
+static void M_ResetControls(INT32 choice);
// Video & Sound
menu_t OP_VideoOptionsDef, OP_VideoModeDef;
@@ -311,17 +315,15 @@ menu_t OP_VideoOptionsDef, OP_VideoModeDef;
menu_t OP_OpenGLOptionsDef, OP_OpenGLFogDef, OP_OpenGLColorDef;
#endif
menu_t OP_SoundOptionsDef;
-static void M_ToggleSFX(INT32 choice);
-static void M_ToggleDigital(INT32 choice);
-#ifndef NO_MIDI
-static void M_ToggleMIDI(INT32 choice);
-#endif
//static void M_RestartAudio(void);
//Misc
menu_t /*OP_DataOptionsDef,*/ OP_ScreenshotOptionsDef, OP_EraseDataDef;
menu_t OP_HUDOptionsDef, OP_ChatOptionsDef;
menu_t OP_GameOptionsDef, OP_ServerOptionsDef;
+#ifndef NONET
+menu_t OP_AdvServerOptionsDef;
+#endif
//menu_t OP_NetgameOptionsDef, OP_GametypeOptionsDef;
menu_t OP_MonitorToggleDef;
static void M_ScreenshotOptions(INT32 choice);
@@ -542,26 +544,26 @@ typedef enum
// ---------------------
static menuitem_t MPauseMenu[] =
{
- {IT_STRING | IT_CALL, NULL, "Add-ons...", M_Addons, 8},
- {IT_STRING | IT_SUBMENU, NULL, "Scramble Teams...", &MISC_ScrambleTeamDef, 16},
- {IT_STRING | IT_CALL, NULL, "Switch Map..." , M_MapChange, 24},
+ {IT_STRING | IT_CALL, NULL, "Add-ons...", M_Addons, 8},
+ {IT_STRING | IT_SUBMENU, NULL, "Scramble Teams...", &MISC_ScrambleTeamDef, 16},
+ {IT_STRING | IT_CALL, NULL, "Switch Map..." , M_MapChange, 24},
- {IT_CALL | IT_STRING, NULL, "Continue", M_SelectableClearMenus,40},
- {IT_CALL | IT_STRING, NULL, "P1 Setup...", M_SetupMultiPlayer, 48}, // splitscreen
- {IT_CALL | IT_STRING, NULL, "P2 Setup...", M_SetupMultiPlayer2, 56}, // splitscreen
- {IT_CALL | IT_STRING, NULL, "P3 Setup...", M_SetupMultiPlayer3, 64}, // splitscreen
- {IT_CALL | IT_STRING, NULL, "P4 Setup...", M_SetupMultiPlayer4, 72}, // splitscreen
+ {IT_CALL | IT_STRING, NULL, "Continue", M_SelectableClearMenus, 40},
+ {IT_CALL | IT_STRING, NULL, "P1 Setup...", M_SetupMultiPlayer, 48}, // splitscreen
+ {IT_CALL | IT_STRING, NULL, "P2 Setup...", M_SetupMultiPlayer2, 56}, // splitscreen
+ {IT_CALL | IT_STRING, NULL, "P3 Setup...", M_SetupMultiPlayer3, 64}, // splitscreen
+ {IT_CALL | IT_STRING, NULL, "P4 Setup...", M_SetupMultiPlayer4, 72}, // splitscreen
- {IT_STRING | IT_CALL, NULL, "Spectate", M_ConfirmSpectate, 48}, // alone
- {IT_STRING | IT_CALL, NULL, "Enter Game", M_ConfirmEnterGame, 48}, // alone
- {IT_STRING | IT_CALL, NULL, "Cancel Join", M_ConfirmSpectate, 48}, // alone
- {IT_STRING | IT_SUBMENU, NULL, "Switch Team...", &MISC_ChangeTeamDef, 48},
- {IT_STRING | IT_SUBMENU, NULL, "Enter/Spectate...", &MISC_ChangeSpectateDef,48},
- {IT_CALL | IT_STRING, NULL, "Player Setup...", M_SetupMultiPlayer, 56}, // alone
- {IT_CALL | IT_STRING, NULL, "Options", M_Options, 64},
+ {IT_STRING | IT_CALL, NULL, "Spectate", M_ConfirmSpectate, 48}, // alone
+ {IT_STRING | IT_CALL, NULL, "Enter Game", M_ConfirmEnterGame, 48}, // alone
+ {IT_STRING | IT_CALL, NULL, "Cancel Join", M_ConfirmSpectate, 48}, // alone
+ {IT_STRING | IT_SUBMENU, NULL, "Switch Team...", &MISC_ChangeTeamDef, 48},
+ {IT_STRING | IT_SUBMENU, NULL, "Enter/Spectate...", &MISC_ChangeSpectateDef,48},
+ {IT_CALL | IT_STRING, NULL, "Player Setup...", M_SetupMultiPlayer, 56}, // alone
+ {IT_CALL | IT_STRING, NULL, "Options", M_Options, 64},
- {IT_CALL | IT_STRING, NULL, "Return to Title", M_EndGame, 80},
- {IT_CALL | IT_STRING, NULL, "Quit Game", M_QuitSRB2, 88},
+ {IT_CALL | IT_STRING, NULL, "Return to Title", M_EndGame, 80},
+ {IT_CALL | IT_STRING, NULL, "Quit Game", M_QuitSRB2, 88},
};
typedef enum
@@ -909,41 +911,7 @@ static menuitem_t SP_LevelStatsMenu[] =
// External files modify this menu, so we can't call it static.
// And I'm too lazy to go through and rename it everywhere. ARRGH!
#define M_ChoosePlayer NULL
-menuitem_t PlayerMenu[32] =
-{
- {IT_CALL, NULL, NULL, M_ChoosePlayer, 0},
- {IT_DISABLED, NULL, NULL, M_ChoosePlayer, 0},
- {IT_DISABLED, NULL, NULL, M_ChoosePlayer, 0},
- {IT_DISABLED, NULL, NULL, M_ChoosePlayer, 0},
- {IT_DISABLED, NULL, NULL, M_ChoosePlayer, 0},
- {IT_DISABLED, NULL, NULL, M_ChoosePlayer, 0},
- {IT_DISABLED, NULL, NULL, M_ChoosePlayer, 0},
- {IT_DISABLED, NULL, NULL, M_ChoosePlayer, 0},
- {IT_DISABLED, NULL, NULL, M_ChoosePlayer, 0},
- {IT_DISABLED, NULL, NULL, M_ChoosePlayer, 0},
- {IT_DISABLED, NULL, NULL, M_ChoosePlayer, 0},
- {IT_DISABLED, NULL, NULL, M_ChoosePlayer, 0},
- {IT_DISABLED, NULL, NULL, M_ChoosePlayer, 0},
- {IT_DISABLED, NULL, NULL, M_ChoosePlayer, 0},
- {IT_DISABLED, NULL, NULL, M_ChoosePlayer, 0},
- {IT_DISABLED, NULL, NULL, M_ChoosePlayer, 0},
- {IT_DISABLED, NULL, NULL, M_ChoosePlayer, 0},
- {IT_DISABLED, NULL, NULL, M_ChoosePlayer, 0},
- {IT_DISABLED, NULL, NULL, M_ChoosePlayer, 0},
- {IT_DISABLED, NULL, NULL, M_ChoosePlayer, 0},
- {IT_DISABLED, NULL, NULL, M_ChoosePlayer, 0},
- {IT_DISABLED, NULL, NULL, M_ChoosePlayer, 0},
- {IT_DISABLED, NULL, NULL, M_ChoosePlayer, 0},
- {IT_DISABLED, NULL, NULL, M_ChoosePlayer, 0},
- {IT_DISABLED, NULL, NULL, M_ChoosePlayer, 0},
- {IT_DISABLED, NULL, NULL, M_ChoosePlayer, 0},
- {IT_DISABLED, NULL, NULL, M_ChoosePlayer, 0},
- {IT_DISABLED, NULL, NULL, M_ChoosePlayer, 0},
- {IT_DISABLED, NULL, NULL, M_ChoosePlayer, 0},
- {IT_DISABLED, NULL, NULL, M_ChoosePlayer, 0},
- {IT_DISABLED, NULL, NULL, M_ChoosePlayer, 0},
- {IT_DISABLED, NULL, NULL, M_ChoosePlayer, 0}
-};
+menuitem_t PlayerMenu[MAXSKINS];
// -----------------------------------
// Multiplayer and all of its submenus
@@ -1093,12 +1061,13 @@ static menuitem_t OP_ControlsMenu[] =
{IT_CALL | IT_STRING, NULL, "Player 3 Controls...", &M_Setup3PControlsMenu, 30},
{IT_CALL | IT_STRING, NULL, "Player 4 Controls...", &M_Setup4PControlsMenu, 40},
- {IT_STRING | IT_CVAR, NULL, "Controls per key", &cv_controlperkey, 60},
+ {IT_STRING | IT_CVAR, NULL, "Controls per key", &cv_controlperkey, 60},
};
static menuitem_t OP_AllControlsMenu[] =
{
{IT_SUBMENU|IT_STRING, NULL, "Gamepad Options...", &OP_Joystick1Def, 0},
+ {IT_CALL|IT_STRING, NULL, "Reset to defaults", M_ResetControls, 8},
//{IT_SPACE, NULL, NULL, NULL, 0},
{IT_HEADER, NULL, "Gameplay Controls", NULL, 0},
{IT_SPACE, NULL, NULL, NULL, 0},
@@ -1202,13 +1171,14 @@ static menuitem_t OP_JoystickSetMenu[] =
{IT_STRING | IT_CVAR, NULL, "Use Mouse", &cv_usemouse, 10},
- {IT_STRING | IT_CVAR, NULL, "Always MouseLook", &cv_alwaysfreelook, 30},
- {IT_STRING | IT_CVAR, NULL, "Mouse Move", &cv_mousemove, 40},
- {IT_STRING | IT_CVAR, NULL, "Invert Mouse", &cv_invertmouse, 50},
+ {IT_STRING | IT_CVAR, NULL, "First-Person MouseLook", &cv_alwaysfreelook, 30},
+ {IT_STRING | IT_CVAR, NULL, "Third-Person MouseLook", &cv_chasefreelook, 40},
+ {IT_STRING | IT_CVAR, NULL, "Mouse Move", &cv_mousemove, 50},
+ {IT_STRING | IT_CVAR, NULL, "Invert Mouse", &cv_invertmouse, 60},
{IT_STRING | IT_CVAR | IT_CV_SLIDER,
- NULL, "Mouse X Speed", &cv_mousesens, 60},
+ NULL, "Mouse X Speed", &cv_mousesens, 70},
{IT_STRING | IT_CVAR | IT_CV_SLIDER,
- NULL, "Mouse Y Speed", &cv_mouseysens, 70},
+ NULL, "Mouse Y Speed", &cv_mouseysens, 80},
};
static menuitem_t OP_Mouse2OptionsMenu[] =
@@ -1216,13 +1186,14 @@ static menuitem_t OP_Mouse2OptionsMenu[] =
{IT_STRING | IT_CVAR, NULL, "Use Mouse 2", &cv_usemouse2, 10},
{IT_STRING | IT_CVAR, NULL, "Second Mouse Serial Port",
&cv_mouse2port, 20},
- {IT_STRING | IT_CVAR, NULL, "Always MouseLook", &cv_alwaysfreelook2, 30},
- {IT_STRING | IT_CVAR, NULL, "Mouse Move", &cv_mousemove2, 40},
- {IT_STRING | IT_CVAR, NULL, "Invert Mouse", &cv_invertmouse2, 50},
+ {IT_STRING | IT_CVAR, NULL, "First-Person MouseLook", &cv_alwaysfreelook2, 30},
+ {IT_STRING | IT_CVAR, NULL, "Third-Person MouseLook", &cv_chasefreelook2, 40},
+ {IT_STRING | IT_CVAR, NULL, "Mouse Move", &cv_mousemove2, 50},
+ {IT_STRING | IT_CVAR, NULL, "Invert Mouse", &cv_invertmouse2, 60},
{IT_STRING | IT_CVAR | IT_CV_SLIDER,
- NULL, "Mouse X Speed", &cv_mousesens2, 60},
+ NULL, "Mouse X Speed", &cv_mousesens2, 70},
{IT_STRING | IT_CVAR | IT_CV_SLIDER,
- NULL, "Mouse Y Speed", &cv_mouseysens2, 70},
+ NULL, "Mouse Y Speed", &cv_mouseysens2, 80},
};*/
static menuitem_t OP_VideoOptionsMenu[] =
@@ -1319,16 +1290,16 @@ static menuitem_t OP_OpenGLColorMenu[] =
static menuitem_t OP_SoundOptionsMenu[] =
{
- {IT_KEYHANDLER|IT_STRING, NULL, "SFX", M_ToggleSFX, 10},
+ {IT_STRING|IT_CVAR, NULL, "SFX", &cv_gamesounds, 10},
{IT_STRING|IT_CVAR|IT_CV_SLIDER,
- NULL, "SFX Volume", &cv_soundvolume, 18},
+ NULL, "SFX Volume", &cv_soundvolume, 18},
- {IT_KEYHANDLER|IT_STRING, NULL, "Music", M_ToggleDigital, 30},
+ {IT_STRING|IT_CVAR, NULL, "Music", &cv_gamedigimusic, 30},
{IT_STRING|IT_CVAR|IT_CV_SLIDER,
NULL, "Music Volume", &cv_digmusicvolume, 38},
/* -- :nonnathisshit:
- {IT_KEYHANDLER|IT_STRING, NULL, "MIDI", M_ToggleMIDI, 50},
+ {IT_STRING|IT_CVAR, NULL, "MIDI", &cv_gamemidimusic, 50},
{IT_STRING|IT_CVAR|IT_CV_SLIDER,
NULL, "MIDI Volume", &cv_midimusicvolume, 58},
#ifdef PC_DOS
@@ -1341,11 +1312,11 @@ static menuitem_t OP_SoundOptionsMenu[] =
{IT_STRING|IT_CVAR, NULL, "Reverse L/R Channels", &stereoreverse, 50},
{IT_STRING|IT_CVAR, NULL, "Surround Sound", &surround, 60},
- {IT_STRING|IT_CVAR, NULL, "Chat sounds", &cv_chatnotifications, 75},
+ {IT_STRING|IT_CVAR, NULL, "Chat Notifications", &cv_chatnotifications, 75},
{IT_STRING|IT_CVAR, NULL, "Character voices", &cv_kartvoices, 85},
{IT_STRING|IT_CVAR, NULL, "Powerup Warning", &cv_kartinvinsfx, 95},
- {IT_KEYHANDLER|IT_STRING, NULL, "Sound Test", M_HandleSoundTest, 110},
+ {IT_KEYHANDLER|IT_STRING, NULL, "Sound Test", M_HandleSoundTest, 110},
};
/*static menuitem_t OP_DataOptionsMenu[] =
@@ -1437,13 +1408,16 @@ static menuitem_t OP_HUDOptionsMenu[] =
static menuitem_t OP_ChatOptionsMenu[] =
{
// will ANYONE who doesn't know how to use the console want to touch this one?
- {IT_STRING | IT_CVAR, NULL, "Chat mode", &cv_consolechat, 10}, // nonetheless...
+ {IT_STRING | IT_CVAR, NULL, "Chat Mode", &cv_consolechat, 10}, // nonetheless...
+
{IT_STRING | IT_CVAR | IT_CV_SLIDER,
- NULL, "Window width", &cv_chatwidth, 25},
+ NULL, "Chat Box Width", &cv_chatwidth, 25},
{IT_STRING | IT_CVAR | IT_CV_SLIDER,
- NULL, "Window height", &cv_chatheight, 35},
- {IT_STRING | IT_CVAR, NULL, "Message fadeout time", &cv_chattime, 50},
- {IT_STRING | IT_CVAR, NULL, "Show tint behind messages",&cv_chatbacktint, 60},
+ NULL, "Chat Box Height", &cv_chatheight, 35},
+
+ {IT_STRING | IT_CVAR, NULL, "Chat Background Tint", &cv_chatbacktint, 50},
+ {IT_STRING | IT_CVAR, NULL, "Message Fadeout Time", &cv_chattime, 60},
+ {IT_STRING | IT_CVAR, NULL, "Spam Protection", &cv_chatspamprotection, 70},
};
static menuitem_t OP_GameOptionsMenu[] =
@@ -1457,12 +1431,12 @@ static menuitem_t OP_GameOptionsMenu[] =
{IT_STRING | IT_CVAR, NULL, "Number of Laps", &cv_basenumlaps, 70},
{IT_STRING | IT_CVAR, NULL, "Exit Countdown Timer", &cv_countdowntime, 80},
- //{IT_STRING | IT_CVAR, NULL, "Time Limit", &cv_timelimit, 100},
- {IT_STRING | IT_CVAR, NULL, "Starting Bumpers", &cv_kartbumpers, 100},
- {IT_STRING | IT_CVAR, NULL, "Karma Comeback", &cv_kartcomeback, 110},
+ {IT_STRING | IT_CVAR, NULL, "Time Limit", &cv_timelimit, 100},
+ {IT_STRING | IT_CVAR, NULL, "Starting Bumpers", &cv_kartbumpers, 110},
+ {IT_STRING | IT_CVAR, NULL, "Karma Comeback", &cv_kartcomeback, 120},
- {IT_STRING | IT_CVAR, NULL, "Force Character #", &cv_forceskin, 130},
- {IT_STRING | IT_CVAR, NULL, "Restrict Character Changes", &cv_restrictskinchange, 140},
+ {IT_STRING | IT_CVAR, NULL, "Force Character", &cv_forceskin, 140},
+ {IT_STRING | IT_CVAR, NULL, "Restrict Character Changes", &cv_restrictskinchange, 150},
};
static menuitem_t OP_ServerOptionsMenu[] =
@@ -1480,15 +1454,34 @@ static menuitem_t OP_ServerOptionsMenu[] =
#ifndef NONET
{IT_STRING | IT_CVAR, NULL, "Max. Player Count", &cv_maxplayers, 90},
{IT_STRING | IT_CVAR, NULL, "Allow Players to Join", &cv_allownewplayer, 100},
-#ifdef VANILLAJOINNEXTROUND
- {IT_STRING | IT_CVAR, NULL, "Join on Map Change", &cv_joinnextround, 110},
-#endif
+ {IT_STRING | IT_CVAR, NULL, "Allow Add-on Downloading", &cv_downloading, 110},
+ {IT_STRING | IT_CVAR, NULL, "Pause Permission", &cv_pause, 120},
+ {IT_STRING | IT_CVAR, NULL, "Mute All Chat", &cv_mute, 130},
- {IT_STRING | IT_CVAR, NULL, "Allow WAD Downloading", &cv_downloading, 110},
- {IT_STRING | IT_CVAR, NULL, "Attempts to resynchronise", &cv_resynchattempts, 120},
+ {IT_SUBMENU|IT_STRING, NULL, "Advanced Options...", &OP_AdvServerOptionsDef,150},
#endif
};
+#ifndef NONET
+static menuitem_t OP_AdvServerOptionsMenu[] =
+{
+ {IT_STRING | IT_CVAR | IT_CV_STRING,
+ NULL, "Server Browser Address", &cv_masterserver, 10},
+
+ {IT_STRING | IT_CVAR, NULL, "Attempts to resynchronise", &cv_resynchattempts, 40},
+ {IT_STRING | IT_CVAR, NULL, "Ping limit (ms)", &cv_maxping, 50},
+ {IT_STRING | IT_CVAR, NULL, "Connection timeout (tics)", &cv_nettimeout, 60},
+ {IT_STRING | IT_CVAR, NULL, "Join timeout (tics)", &cv_jointimeout, 70},
+
+ {IT_STRING | IT_CVAR, NULL, "Max. file transfer send (KB)", &cv_maxsend, 90},
+ {IT_STRING | IT_CVAR, NULL, "File transfer packet rate", &cv_downloadspeed, 100},
+
+ {IT_STRING | IT_CVAR, NULL, "Log join addresses", &cv_showjoinaddress, 120},
+ {IT_STRING | IT_CVAR, NULL, "Log resyncs", &cv_blamecfail, 130},
+ {IT_STRING | IT_CVAR, NULL, "Log file transfers", &cv_noticedownload, 140},
+};
+#endif
+
/*static menuitem_t OP_NetgameOptionsMenu[] =
{
{IT_STRING | IT_CVAR, NULL, "Time Limit", &cv_timelimit, 10},
@@ -1973,9 +1966,13 @@ menu_t OP_ChatOptionsDef = DEFAULTMENUSTYLE("M_HUD", OP_ChatOptionsMenu, &OP_HUD
menu_t OP_GameOptionsDef = DEFAULTMENUSTYLE("M_GAME", OP_GameOptionsMenu, &OP_MainDef, 30, 30);
menu_t OP_ServerOptionsDef = DEFAULTMENUSTYLE("M_SERVER", OP_ServerOptionsMenu, &OP_MainDef, 24, 30);
+#ifndef NONET
+menu_t OP_AdvServerOptionsDef = DEFAULTMENUSTYLE("M_SERVER", OP_AdvServerOptionsMenu, &OP_ServerOptionsDef, 24, 30);
+#endif
//menu_t OP_NetgameOptionsDef = DEFAULTMENUSTYLE("M_SERVER", OP_NetgameOptionsMenu, &OP_ServerOptionsDef, 30, 30);
//menu_t OP_GametypeOptionsDef = DEFAULTMENUSTYLE("M_SERVER", OP_GametypeOptionsMenu, &OP_ServerOptionsDef, 30, 30);
+//menu_t OP_ChatOptionsDef = DEFAULTMENUSTYLE("M_GAME", OP_ChatOptionsMenu, &OP_GameOptionsDef, 30, 30);
menu_t OP_MonitorToggleDef =
{
"M_GAME",
@@ -2312,7 +2309,19 @@ static void M_ChangeCvar(INT32 choice)
CV_Set(cv,s);
}
else
+ {
+#ifndef NONET
+ if (cv == &cv_nettimeout || cv == &cv_jointimeout)
+ choice *= (TICRATE/7);
+ else if (cv == &cv_maxsend)
+ choice *= 512;
+#ifdef NEWPING
+ else if (cv == &cv_maxping)
+ choice *= 50;
+#endif
+#endif
CV_AddValue(cv,choice);
+ }
}
static boolean M_ChangeStringCvar(INT32 choice)
@@ -2409,6 +2418,7 @@ boolean M_Responder(event_t *ev)
INT32 ch = -1;
// INT32 i;
static tic_t joywait = 0, mousewait = 0;
+ static INT32 pjoyx = 0, pjoyy = 0;
static INT32 pmousex = 0, pmousey = 0;
static INT32 lastx = 0, lasty = 0;
void (*routine)(INT32 choice); // for some casting problem
@@ -2432,15 +2442,15 @@ boolean M_Responder(event_t *ev)
switch (ch)
{
case KEY_MOUSE1:
- case KEY_JOY1:
- case KEY_JOY1 + 2:
+ //case KEY_JOY1:
+ //case KEY_JOY1 + 2:
ch = KEY_ENTER;
break;
- case KEY_JOY1 + 3:
- ch = 'n';
- break;
+ /*case KEY_JOY1 + 3: // Brake can function as 'n' for message boxes now.
+ ch = 'n';
+ break;*/
case KEY_MOUSE1 + 1:
- case KEY_JOY1 + 1:
+ //case KEY_JOY1 + 1:
ch = KEY_BACKSPACE;
break;
case KEY_HAT1:
@@ -2461,26 +2471,45 @@ boolean M_Responder(event_t *ev)
{
if (ev->type == ev_joystick && ev->data1 == 0 && joywait < I_GetTime())
{
- if (ev->data3 == -1)
+ const INT32 jdeadzone = JOYAXISRANGE/4;
+ if (ev->data3 != INT32_MAX)
{
- ch = KEY_UPARROW;
- joywait = I_GetTime() + NEWTICRATE/7;
- }
- else if (ev->data3 == 1)
- {
- ch = KEY_DOWNARROW;
- joywait = I_GetTime() + NEWTICRATE/7;
+ if (Joystick.bGamepadStyle || abs(ev->data3) > jdeadzone)
+ {
+ if (ev->data3 < 0 && pjoyy >= 0)
+ {
+ ch = KEY_UPARROW;
+ joywait = I_GetTime() + NEWTICRATE/7;
+ }
+ else if (ev->data3 > 0 && pjoyy <= 0)
+ {
+ ch = KEY_DOWNARROW;
+ joywait = I_GetTime() + NEWTICRATE/7;
+ }
+ pjoyy = ev->data3;
+ }
+ else
+ pjoyy = 0;
}
- if (ev->data2 == -1)
+ if (ev->data2 != INT32_MAX)
{
- ch = KEY_LEFTARROW;
- joywait = I_GetTime() + NEWTICRATE/17;
- }
- else if (ev->data2 == 1)
- {
- ch = KEY_RIGHTARROW;
- joywait = I_GetTime() + NEWTICRATE/17;
+ if (Joystick.bGamepadStyle || abs(ev->data2) > jdeadzone)
+ {
+ if (ev->data2 < 0 && pjoyx >= 0)
+ {
+ ch = KEY_LEFTARROW;
+ joywait = I_GetTime() + NEWTICRATE/17;
+ }
+ else if (ev->data2 > 0 && pjoyx <= 0)
+ {
+ ch = KEY_RIGHTARROW;
+ joywait = I_GetTime() + NEWTICRATE/17;
+ }
+ pjoyx = ev->data2;
+ }
+ else
+ pjoyx = 0;
}
}
else if (ev->type == ev_mouse && mousewait < I_GetTime())
@@ -2514,11 +2543,15 @@ boolean M_Responder(event_t *ev)
}
}
}
+ else if (ev->type == ev_keydown) // Preserve event for other responders
+ ch = ev->data1;
if (ch == -1)
return false;
else if (ch == gamecontrol[gc_systemmenu][0] || ch == gamecontrol[gc_systemmenu][1]) // allow remappable ESC key
ch = KEY_ESCAPE;
+ else if ((ch == gamecontrol[gc_accelerate][0] || ch == gamecontrol[gc_accelerate][1]) && ch >= KEY_MOUSE1)
+ ch = KEY_ENTER;
// F-Keys
if (!menuactive)
@@ -2595,6 +2628,9 @@ boolean M_Responder(event_t *ev)
return false;
}
+ if ((ch == gamecontrol[gc_brake][0] || ch == gamecontrol[gc_brake][1]) && ch >= KEY_MOUSE1) // do this here, otherwise brake opens the menu mid-game
+ ch = KEY_ESCAPE;
+
routine = currentMenu->menuitems[itemOn].itemaction;
// Handle menuitems which need a specific key handling
@@ -2729,6 +2765,7 @@ boolean M_Responder(event_t *ev)
return true;
case KEY_ESCAPE:
+ //case KEY_JOY1 + 2:
noFurtherInput = true;
currentMenu->lastOn = itemOn;
if (currentMenu->prevMenu)
@@ -3117,6 +3154,8 @@ void M_Ticker(void)
//
void M_Init(void)
{
+ UINT8 i;
+
COM_AddCommand("manual", Command_Manual_f);
CV_RegisterVar(&cv_nextmap);
@@ -3128,7 +3167,6 @@ void M_Init(void)
return;
// Menu hacks
- CV_RegisterVar(&cv_splitplayers);
CV_RegisterVar(&cv_dummymenuplayer);
CV_RegisterVar(&cv_dummyteam);
CV_RegisterVar(&cv_dummyspectate);
@@ -3164,6 +3202,15 @@ void M_Init(void)
quitmsg[QUIT3MSG5] = M_GetText("You'll be back to play soon, though...\n...right?\n\n(Press 'Y' to quit)");
quitmsg[QUIT3MSG6] = M_GetText("Aww, is Eggman's Nightclub too\ndifficult for you?\n\n(Press 'Y' to quit)");
+ // Setup PlayerMenu table
+ for (i = 0; i < MAXSKINS; i++)
+ {
+ PlayerMenu[i].status = (i == 0 ? IT_CALL : IT_DISABLED);
+ PlayerMenu[i].patch = PlayerMenu[i].text = NULL;
+ PlayerMenu[i].itemaction = M_ChoosePlayer;
+ PlayerMenu[i].alphaKey = 0;
+ }
+
#ifdef HWRENDER
// Permanently hide some options based on render mode
if (rendermode == render_soft)
@@ -3349,7 +3396,7 @@ void M_DrawTextBox(INT32 x, INT32 y, INT32 width, INT32 boxlines)
//
// Draw border for the savegame description
//
-static void M_DrawSaveLoadBorder(INT32 x,INT32 y)
+/*static void M_DrawSaveLoadBorder(INT32 x,INT32 y)
{
INT32 i;
@@ -3362,7 +3409,7 @@ static void M_DrawSaveLoadBorder(INT32 x,INT32 y)
}
V_DrawScaledPatch (x,y+7,0,W_CachePatchName("M_LSRGHT",PU_CACHE));
-}
+}*/
// horizontally centered text
static void M_CentreText(INT32 y, const char *string)
@@ -4391,8 +4438,10 @@ static void M_Addons(INT32 choice)
addonsp[EXT_TXT] = W_CachePatchName("M_FTXT", PU_STATIC);
addonsp[EXT_CFG] = W_CachePatchName("M_FCFG", PU_STATIC);
addonsp[EXT_WAD] = W_CachePatchName("M_FWAD", PU_STATIC);
+#ifdef USE_KART
addonsp[EXT_KART] = W_CachePatchName("M_FKART", PU_STATIC);
- //addonsp[EXT_PK3] = W_CachePatchName("M_FPK3", PU_STATIC);
+#endif
+ addonsp[EXT_PK3] = W_CachePatchName("M_FPK3", PU_STATIC);
addonsp[EXT_SOC] = W_CachePatchName("M_FSOC", PU_STATIC);
addonsp[EXT_LUA] = W_CachePatchName("M_FLUA", PU_STATIC);
addonsp[NUM_EXT] = W_CachePatchName("M_FUNKN", PU_STATIC);
@@ -4524,10 +4573,6 @@ static boolean M_AddonsRefresh(void)
return false;
}
-#ifdef FIXUPO0
-#pragma GCC optimize ("0")
-#endif
-
static void M_DrawAddons(void)
{
INT32 x, y;
@@ -4598,16 +4643,14 @@ static void M_DrawAddons(void)
if (m > (ssize_t)sizedirmenu)
m = sizedirmenu;
- // then top...
- i = m - (2*numaddonsshown + 1);
-
- // then adjust!
- if (i < 0)
+ // then compute top and adjust bottom if needed!
+ if (m < (2*numaddonsshown + 1))
{
- if ((m -= i) > (ssize_t)sizedirmenu)
- m = sizedirmenu;
+ m = min(sizedirmenu, 2*numaddonsshown + 1);
i = 0;
}
+ else
+ i = m - (2*numaddonsshown + 1);
if (i != 0)
V_DrawString(19, y+4 - (skullAnimCounter/5), highlightflags, "\x1A");
@@ -4672,10 +4715,6 @@ static void M_DrawAddons(void)
V_DrawSmallScaledPatch(x, y + 4, 0, addonsp[NUM_EXT+2]);
}
-#ifdef FIXUPO0
-#pragma GCC reset_options
-#endif
-
static void M_AddonExec(INT32 ch)
{
if (ch != 'y' && ch != KEY_ENTER)
@@ -4831,14 +4870,16 @@ static void M_HandleAddons(INT32 choice)
case EXT_LUA:
#ifndef HAVE_BLUA
S_StartSound(NULL, sfx_s26d);
- M_StartMessage(va("%c%s\x80\nThis copy of SRB2 was compiled\nwithout support for .lua files.\n\n(Press a key)\n", ('\x80' + (highlightflags>>V_CHARCOLORSHIFT)), dirmenu[dir_on[menudepthleft]]+DIR_STRING),NULL,MM_NOTHING);
+ M_StartMessage(va("%c%s\x80\nThis version of SRB2Kart does not\nhave support for .lua files.\n\n(Press a key)\n", ('\x80' + (highlightflags>>V_CHARCOLORSHIFT)), dirmenu[dir_on[menudepthleft]]+DIR_STRING),NULL,MM_NOTHING);
break;
#endif
// else intentional fallthrough
case EXT_SOC:
case EXT_WAD:
+#ifdef USE_KART
case EXT_KART:
- //case EXT_PK3:
+#endif
+ case EXT_PK3:
COM_BufAddText(va("addfile \"%s%s\"", menupath, dirmenu[dir_on[menudepthleft]]+DIR_STRING));
break;
default:
@@ -7316,7 +7357,7 @@ void M_SortServerList(void)
#ifndef NONET
#ifdef UPDATE_ALERT
-static int M_CheckMODVersion(void)
+static boolean M_CheckMODVersion(void)
{
char updatestring[500];
const char *updatecheck = GetMODVersion();
@@ -7454,7 +7495,7 @@ static void M_StartServer(INT32 choice)
G_StopMetalDemo();
if (!cv_nextmap.value)
- CV_SetValue(&cv_nextmap, G_RandMap(G_TOLFlag(cv_newgametype.value), -1, false, false, 0, false)+1);
+ CV_SetValue(&cv_nextmap, G_RandMap(G_TOLFlag(cv_newgametype.value), -1, false, 0, false, NULL)+1);
if (cv_maxplayers.value < ssplayers+1)
CV_SetValue(&cv_maxplayers, ssplayers+1);
@@ -7667,7 +7708,7 @@ static void M_StartServerMenu(INT32 choice)
// CONNECT VIA IP
// ==============
-static char setupm_ip[16];
+static char setupm_ip[28];
#endif
static UINT8 setupm_pselect = 1;
@@ -7700,12 +7741,12 @@ Update the maxplayers label...
V_DrawFill(x+5, y+4+5, /*16*8 + 6,*/ BASEVIDWIDTH - 2*(x+5), 8+6, 239);
// draw name string
- V_DrawString(x+8,y+12, V_MONOSPACE, setupm_ip);
+ V_DrawString(x+8,y+12, V_ALLOWLOWERCASE, setupm_ip);
// draw text cursor for name
if (itemOn == 8
&& skullAnimCounter < 4) //blink cursor
- V_DrawCharacter(x+8+V_StringWidth(setupm_ip, V_MONOSPACE),y+12,'_',false);
+ V_DrawCharacter(x+8+V_StringWidth(setupm_ip, V_ALLOWLOWERCASE),y+12,'_',false);
#endif
// character bar, ripped off the color bar :V
@@ -7919,10 +7960,11 @@ static void M_HandleConnectIP(INT32 choice)
default:
l = strlen(setupm_ip);
- if (l >= 16-1)
+ if (l >= 28-1)
break;
- if (choice == 46 || (choice >= 48 && choice <= 57)) // Rudimentary number and period enforcing
+ // Rudimentary number and period enforcing - also allows letters so hostnames can be used instead
+ if ((choice >= '-' && choice <= ':') || (choice >= 'A' && choice <= 'Z') || (choice >= 'a' && choice <= 'z'))
{
S_StartSound(NULL,sfx_menu1); // Tails
setupm_ip[l] = (char)choice;
@@ -7936,7 +7978,6 @@ static void M_HandleConnectIP(INT32 choice)
setupm_ip[l] = (char)choice;
setupm_ip[l+1] = 0;
}
-
break;
}
@@ -8506,43 +8547,86 @@ static void M_ScreenshotOptions(INT32 choice)
static void M_DrawJoystick(void)
{
- INT32 i;
+ INT32 i, compareval4, compareval3, compareval2, compareval;
M_DrawGenericMenu();
for (i = 0; i < 8; i++)
{
- M_DrawSaveLoadBorder(OP_JoystickSetDef.x, OP_JoystickSetDef.y+LINEHEIGHT*i);
+ M_DrawTextBox(OP_JoystickSetDef.x-8, OP_JoystickSetDef.y+LINEHEIGHT*i-12, 28, 1);
+ //M_DrawSaveLoadBorder(OP_JoystickSetDef.x, OP_JoystickSetDef.y+LINEHEIGHT*i);
- if ((setupcontrols_fourthplayer && (i == cv_usejoystick4.value))
- || (setupcontrols_thirdplayer && (i == cv_usejoystick3.value))
- || (setupcontrols_secondaryplayer && (i == cv_usejoystick2.value))
- || (!(setupcontrols_secondaryplayer || setupcontrols_thirdplayer || setupcontrols_fourthplayer) && (i == cv_usejoystick.value)))
- V_DrawString(OP_JoystickSetDef.x, OP_JoystickSetDef.y+LINEHEIGHT*i,recommendedflags,joystickInfo[i]);
+#ifdef JOYSTICK_HOTPLUG
+ if (atoi(cv_usejoystick4.string) > I_NumJoys())
+ compareval4 = atoi(cv_usejoystick4.string);
else
- V_DrawString(OP_JoystickSetDef.x, OP_JoystickSetDef.y+LINEHEIGHT*i,0,joystickInfo[i]);
+ compareval4 = cv_usejoystick4.value;
+
+ if (atoi(cv_usejoystick3.string) > I_NumJoys())
+ compareval3 = atoi(cv_usejoystick3.string);
+ else
+ compareval3 = cv_usejoystick3.value;
+
+ if (atoi(cv_usejoystick2.string) > I_NumJoys())
+ compareval2 = atoi(cv_usejoystick2.string);
+ else
+ compareval2 = cv_usejoystick2.value;
+
+ if (atoi(cv_usejoystick.string) > I_NumJoys())
+ compareval = atoi(cv_usejoystick.string);
+ else
+ compareval = cv_usejoystick.value;
+#else
+ compareval4 = cv_usejoystick4.value;
+ compareval3 = cv_usejoystick3.value;
+ compareval2 = cv_usejoystick2.value;
+ compareval = cv_usejoystick.value
+#endif
+
+ if ((setupcontrolplayer == 4 && (i == compareval4))
+ || (setupcontrolplayer == 3 && (i == compareval3))
+ || (setupcontrolplayer == 2 && (i == compareval2))
+ || (setupcontrolplayer == 1 && (i == compareval)))
+ V_DrawString(OP_JoystickSetDef.x, OP_JoystickSetDef.y+LINEHEIGHT*i-4,V_GREENMAP,joystickInfo[i]);
+ else
+ V_DrawString(OP_JoystickSetDef.x, OP_JoystickSetDef.y+LINEHEIGHT*i-4,0,joystickInfo[i]);
}
}
-static void M_SetupJoystickMenu(INT32 choice)
+void M_SetupJoystickMenu(INT32 choice)
{
INT32 i = 0;
- const char *joyname = "None";
const char *joyNA = "Unavailable";
INT32 n = I_NumJoys();
(void)choice;
- strcpy(joystickInfo[i], joyname);
+ strcpy(joystickInfo[i], "None");
for (i = 1; i < 8; i++)
{
- if (i <= n && (joyname = I_GetJoyName(i)) != NULL)
- {
- strncpy(joystickInfo[i], joyname, 24);
- joystickInfo[i][24] = '\0';
- }
+ if (i <= n && (I_GetJoyName(i)) != NULL)
+ strncpy(joystickInfo[i], I_GetJoyName(i), 28);
else
strcpy(joystickInfo[i], joyNA);
+
+#ifdef JOYSTICK_HOTPLUG
+ // We use cv_usejoystick.string as the USER-SET var
+ // and cv_usejoystick.value as the INTERNAL var
+ //
+ // In practice, if cv_usejoystick.string == 0, this overrides
+ // cv_usejoystick.value and always disables
+ //
+ // Update cv_usejoystick.string here so that the user can
+ // properly change this value.
+ if (i == cv_usejoystick.value)
+ CV_SetValue(&cv_usejoystick, i);
+ if (i == cv_usejoystick2.value)
+ CV_SetValue(&cv_usejoystick2, i);
+ if (i == cv_usejoystick3.value)
+ CV_SetValue(&cv_usejoystick3, i);
+ if (i == cv_usejoystick4.value)
+ CV_SetValue(&cv_usejoystick4, i);
+#endif
}
M_SetupNextMenu(&OP_JoystickSetDef);
@@ -8550,45 +8634,168 @@ static void M_SetupJoystickMenu(INT32 choice)
static void M_Setup1PJoystickMenu(INT32 choice)
{
- setupcontrols_secondaryplayer = setupcontrols_thirdplayer = setupcontrols_fourthplayer = false;
+ setupcontrolplayer = 1;
OP_JoystickSetDef.prevMenu = &OP_Joystick1Def;
M_SetupJoystickMenu(choice);
}
static void M_Setup2PJoystickMenu(INT32 choice)
{
- setupcontrols_secondaryplayer = true;
- setupcontrols_thirdplayer = setupcontrols_fourthplayer = false;
+ setupcontrolplayer = 2;
OP_JoystickSetDef.prevMenu = &OP_Joystick2Def;
M_SetupJoystickMenu(choice);
}
static void M_Setup3PJoystickMenu(INT32 choice)
{
- setupcontrols_thirdplayer = true;
- setupcontrols_secondaryplayer = setupcontrols_fourthplayer = false;
+ setupcontrolplayer = 3;
OP_JoystickSetDef.prevMenu = &OP_Joystick3Def;
M_SetupJoystickMenu(choice);
}
static void M_Setup4PJoystickMenu(INT32 choice)
{
- setupcontrols_fourthplayer = true;
- setupcontrols_secondaryplayer = setupcontrols_thirdplayer = false;
+ setupcontrolplayer = 4;
OP_JoystickSetDef.prevMenu = &OP_Joystick4Def;
M_SetupJoystickMenu(choice);
}
static void M_AssignJoystick(INT32 choice)
{
- if (setupcontrols_fourthplayer)
+#ifdef JOYSTICK_HOTPLUG
+ INT32 oldchoice, oldstringchoice;
+ INT32 numjoys = I_NumJoys();
+
+ if (setupcontrolplayer == 4)
+ {
+ oldchoice = oldstringchoice = atoi(cv_usejoystick4.string) > numjoys ? atoi(cv_usejoystick4.string) : cv_usejoystick4.value;
CV_SetValue(&cv_usejoystick4, choice);
- else if (setupcontrols_thirdplayer)
+
+ // Just in case last-minute changes were made to cv_usejoystick.value,
+ // update the string too
+ // But don't do this if we're intentionally setting higher than numjoys
+ if (choice <= numjoys)
+ {
+ CV_SetValue(&cv_usejoystick4, cv_usejoystick4.value);
+
+ // reset this so the comparison is valid
+ if (oldchoice > numjoys)
+ oldchoice = cv_usejoystick4.value;
+
+ if (oldchoice != choice)
+ {
+ if (choice && oldstringchoice > numjoys) // if we did not select "None", we likely selected a used device
+ CV_SetValue(&cv_usejoystick4, (oldstringchoice > numjoys ? oldstringchoice : oldchoice));
+
+ if (oldstringchoice ==
+ (atoi(cv_usejoystick4.string) > numjoys ? atoi(cv_usejoystick4.string) : cv_usejoystick4.value))
+ M_StartMessage("This joystick is used by another\n"
+ "player. Reset the joystick\n"
+ "for that player first.\n\n"
+ "(Press a key)\n", NULL, MM_NOTHING);
+ }
+ }
+ }
+ else if (setupcontrolplayer == 3)
+ {
+ oldchoice = oldstringchoice = atoi(cv_usejoystick3.string) > numjoys ? atoi(cv_usejoystick3.string) : cv_usejoystick3.value;
CV_SetValue(&cv_usejoystick3, choice);
- else if (setupcontrols_secondaryplayer)
+
+ // Just in case last-minute changes were made to cv_usejoystick.value,
+ // update the string too
+ // But don't do this if we're intentionally setting higher than numjoys
+ if (choice <= numjoys)
+ {
+ CV_SetValue(&cv_usejoystick3, cv_usejoystick3.value);
+
+ // reset this so the comparison is valid
+ if (oldchoice > numjoys)
+ oldchoice = cv_usejoystick3.value;
+
+ if (oldchoice != choice)
+ {
+ if (choice && oldstringchoice > numjoys) // if we did not select "None", we likely selected a used device
+ CV_SetValue(&cv_usejoystick3, (oldstringchoice > numjoys ? oldstringchoice : oldchoice));
+
+ if (oldstringchoice ==
+ (atoi(cv_usejoystick3.string) > numjoys ? atoi(cv_usejoystick3.string) : cv_usejoystick3.value))
+ M_StartMessage("This joystick is used by another\n"
+ "player. Reset the joystick\n"
+ "for that player first.\n\n"
+ "(Press a key)\n", NULL, MM_NOTHING);
+ }
+ }
+ }
+ else if (setupcontrolplayer == 2)
+ {
+ oldchoice = oldstringchoice = atoi(cv_usejoystick2.string) > numjoys ? atoi(cv_usejoystick2.string) : cv_usejoystick2.value;
CV_SetValue(&cv_usejoystick2, choice);
- else
+
+ // Just in case last-minute changes were made to cv_usejoystick.value,
+ // update the string too
+ // But don't do this if we're intentionally setting higher than numjoys
+ if (choice <= numjoys)
+ {
+ CV_SetValue(&cv_usejoystick2, cv_usejoystick2.value);
+
+ // reset this so the comparison is valid
+ if (oldchoice > numjoys)
+ oldchoice = cv_usejoystick2.value;
+
+ if (oldchoice != choice)
+ {
+ if (choice && oldstringchoice > numjoys) // if we did not select "None", we likely selected a used device
+ CV_SetValue(&cv_usejoystick2, (oldstringchoice > numjoys ? oldstringchoice : oldchoice));
+
+ if (oldstringchoice ==
+ (atoi(cv_usejoystick2.string) > numjoys ? atoi(cv_usejoystick2.string) : cv_usejoystick2.value))
+ M_StartMessage("This joystick is used by another\n"
+ "player. Reset the joystick\n"
+ "for that player first.\n\n"
+ "(Press a key)\n", NULL, MM_NOTHING);
+ }
+ }
+ }
+ else if (setupcontrolplayer == 1)
+ {
+ oldchoice = oldstringchoice = atoi(cv_usejoystick.string) > numjoys ? atoi(cv_usejoystick.string) : cv_usejoystick.value;
CV_SetValue(&cv_usejoystick, choice);
+
+ // Just in case last-minute changes were made to cv_usejoystick.value,
+ // update the string too
+ // But don't do this if we're intentionally setting higher than numjoys
+ if (choice <= numjoys)
+ {
+ CV_SetValue(&cv_usejoystick, cv_usejoystick.value);
+
+ // reset this so the comparison is valid
+ if (oldchoice > numjoys)
+ oldchoice = cv_usejoystick.value;
+
+ if (oldchoice != choice)
+ {
+ if (choice && oldstringchoice > numjoys) // if we did not select "None", we likely selected a used device
+ CV_SetValue(&cv_usejoystick, (oldstringchoice > numjoys ? oldstringchoice : oldchoice));
+
+ if (oldstringchoice ==
+ (atoi(cv_usejoystick.string) > numjoys ? atoi(cv_usejoystick.string) : cv_usejoystick.value))
+ M_StartMessage("This joystick is used by another\n"
+ "player. Reset the joystick\n"
+ "for that player first.\n\n"
+ "(Press a key)\n", NULL, MM_NOTHING);
+ }
+ }
+ }
+#else
+ if (setupcontrolplayer == 4)
+ CV_SetValue(&cv_usejoystick4, choice);
+ else if (setupcontrolplayer == 3)
+ CV_SetValue(&cv_usejoystick3, choice);
+ else if (setupcontrolplayer == 2)
+ CV_SetValue(&cv_usejoystick2, choice);
+ else if (setupcontrolplayer == 1)
+ CV_SetValue(&cv_usejoystick, choice);
+#endif
}
// =============
@@ -8598,7 +8805,7 @@ static void M_AssignJoystick(INT32 choice)
static void M_Setup1PControlsMenu(INT32 choice)
{
(void)choice;
- setupcontrols_secondaryplayer = setupcontrols_thirdplayer = setupcontrols_fourthplayer = false;
+ setupcontrolplayer = 1;
setupcontrols = gamecontrol; // was called from main Options (for console player, then)
currentMenu->lastOn = itemOn;
@@ -8606,22 +8813,22 @@ static void M_Setup1PControlsMenu(INT32 choice)
OP_AllControlsMenu[0].itemaction = &OP_Joystick1Def;
// Unhide P1-only controls
- OP_AllControlsMenu[14].status = IT_CONTROL; // Chat
- //OP_AllControlsMenu[15].status = IT_CONTROL; // Team-chat
- OP_AllControlsMenu[15].status = IT_CONTROL; // Rankings
- OP_AllControlsMenu[16].status = IT_CONTROL; // Viewpoint
- // 17 is Reset Camera, 18 is Toggle Chasecam
- OP_AllControlsMenu[19].status = IT_CONTROL; // Pause
- OP_AllControlsMenu[20].status = IT_CONTROL; // Screenshot
- OP_AllControlsMenu[21].status = IT_CONTROL; // GIF
- OP_AllControlsMenu[22].status = IT_CONTROL; // System Menu
- OP_AllControlsMenu[23].status = IT_CONTROL; // Console
- /*OP_AllControlsMenu[24].status = IT_HEADER; // Spectator Controls header
- OP_AllControlsMenu[25].status = IT_SPACE; // Spectator Controls space
- OP_AllControlsMenu[26].status = IT_CONTROL; // Spectate
- OP_AllControlsMenu[27].status = IT_CONTROL; // Look Up
- OP_AllControlsMenu[28].status = IT_CONTROL; // Look Down
- OP_AllControlsMenu[29].status = IT_CONTROL; // Center View
+ OP_AllControlsMenu[15].status = IT_CONTROL; // Chat
+ //OP_AllControlsMenu[16].status = IT_CONTROL; // Team-chat
+ OP_AllControlsMenu[16].status = IT_CONTROL; // Rankings
+ OP_AllControlsMenu[17].status = IT_CONTROL; // Viewpoint
+ // 18 is Reset Camera, 19 is Toggle Chasecam
+ OP_AllControlsMenu[20].status = IT_CONTROL; // Pause
+ OP_AllControlsMenu[21].status = IT_CONTROL; // Screenshot
+ OP_AllControlsMenu[22].status = IT_CONTROL; // GIF
+ OP_AllControlsMenu[23].status = IT_CONTROL; // System Menu
+ OP_AllControlsMenu[24].status = IT_CONTROL; // Console
+ /*OP_AllControlsMenu[25].status = IT_HEADER; // Spectator Controls header
+ OP_AllControlsMenu[26].status = IT_SPACE; // Spectator Controls space
+ OP_AllControlsMenu[27].status = IT_CONTROL; // Spectate
+ OP_AllControlsMenu[28].status = IT_CONTROL; // Look Up
+ OP_AllControlsMenu[29].status = IT_CONTROL; // Look Down
+ OP_AllControlsMenu[30].status = IT_CONTROL; // Center View
*/
M_SetupNextMenu(&OP_AllControlsDef);
@@ -8630,8 +8837,7 @@ static void M_Setup1PControlsMenu(INT32 choice)
static void M_Setup2PControlsMenu(INT32 choice)
{
(void)choice;
- setupcontrols_secondaryplayer = true;
- setupcontrols_thirdplayer = setupcontrols_fourthplayer = false;
+ setupcontrolplayer = 2;
setupcontrols = gamecontrolbis;
currentMenu->lastOn = itemOn;
@@ -8639,22 +8845,22 @@ static void M_Setup2PControlsMenu(INT32 choice)
OP_AllControlsMenu[0].itemaction = &OP_Joystick2Def;
// Hide P1-only controls
- OP_AllControlsMenu[14].status = IT_GRAYEDOUT2; // Chat
- //OP_AllControlsMenu[15].status = IT_GRAYEDOUT2; // Team-chat
- OP_AllControlsMenu[15].status = IT_GRAYEDOUT2; // Rankings
- OP_AllControlsMenu[16].status = IT_GRAYEDOUT2; // Viewpoint
- // 17 is Reset Camera, 18 is Toggle Chasecam
- OP_AllControlsMenu[19].status = IT_GRAYEDOUT2; // Pause
- OP_AllControlsMenu[20].status = IT_GRAYEDOUT2; // Screenshot
- OP_AllControlsMenu[21].status = IT_GRAYEDOUT2; // GIF
- OP_AllControlsMenu[22].status = IT_GRAYEDOUT2; // System Menu
- OP_AllControlsMenu[23].status = IT_GRAYEDOUT2; // Console
- /*OP_AllControlsMenu[24].status = IT_GRAYEDOUT2; // Spectator Controls header
- OP_AllControlsMenu[25].status = IT_GRAYEDOUT2; // Spectator Controls space
- OP_AllControlsMenu[26].status = IT_GRAYEDOUT2; // Spectate
- OP_AllControlsMenu[27].status = IT_GRAYEDOUT2; // Look Up
- OP_AllControlsMenu[28].status = IT_GRAYEDOUT2; // Look Down
- OP_AllControlsMenu[29].status = IT_GRAYEDOUT2; // Center View
+ OP_AllControlsMenu[15].status = IT_GRAYEDOUT2; // Chat
+ //OP_AllControlsMenu[16].status = IT_GRAYEDOUT2; // Team-chat
+ OP_AllControlsMenu[16].status = IT_GRAYEDOUT2; // Rankings
+ OP_AllControlsMenu[17].status = IT_GRAYEDOUT2; // Viewpoint
+ // 18 is Reset Camera, 19 is Toggle Chasecam
+ OP_AllControlsMenu[20].status = IT_GRAYEDOUT2; // Pause
+ OP_AllControlsMenu[21].status = IT_GRAYEDOUT2; // Screenshot
+ OP_AllControlsMenu[22].status = IT_GRAYEDOUT2; // GIF
+ OP_AllControlsMenu[23].status = IT_GRAYEDOUT2; // System Menu
+ OP_AllControlsMenu[24].status = IT_GRAYEDOUT2; // Console
+ /*OP_AllControlsMenu[25].status = IT_GRAYEDOUT2; // Spectator Controls header
+ OP_AllControlsMenu[26].status = IT_GRAYEDOUT2; // Spectator Controls space
+ OP_AllControlsMenu[27].status = IT_GRAYEDOUT2; // Spectate
+ OP_AllControlsMenu[28].status = IT_GRAYEDOUT2; // Look Up
+ OP_AllControlsMenu[29].status = IT_GRAYEDOUT2; // Look Down
+ OP_AllControlsMenu[30].status = IT_GRAYEDOUT2; // Center View
*/
M_SetupNextMenu(&OP_AllControlsDef);
@@ -8663,8 +8869,7 @@ static void M_Setup2PControlsMenu(INT32 choice)
static void M_Setup3PControlsMenu(INT32 choice)
{
(void)choice;
- setupcontrols_thirdplayer = true;
- setupcontrols_secondaryplayer = setupcontrols_fourthplayer = false;
+ setupcontrolplayer = 3;
setupcontrols = gamecontrol3;
currentMenu->lastOn = itemOn;
@@ -8672,22 +8877,22 @@ static void M_Setup3PControlsMenu(INT32 choice)
OP_AllControlsMenu[0].itemaction = &OP_Joystick3Def;
// Hide P1-only controls
- OP_AllControlsMenu[14].status = IT_GRAYEDOUT2; // Chat
- //OP_AllControlsMenu[15].status = IT_GRAYEDOUT2; // Team-chat
- OP_AllControlsMenu[15].status = IT_GRAYEDOUT2; // Rankings
- OP_AllControlsMenu[16].status = IT_GRAYEDOUT2; // Viewpoint
- // 17 is Reset Camera, 18 is Toggle Chasecam
- OP_AllControlsMenu[19].status = IT_GRAYEDOUT2; // Pause
- OP_AllControlsMenu[20].status = IT_GRAYEDOUT2; // Screenshot
- OP_AllControlsMenu[21].status = IT_GRAYEDOUT2; // GIF
- OP_AllControlsMenu[22].status = IT_GRAYEDOUT2; // System Menu
- OP_AllControlsMenu[23].status = IT_GRAYEDOUT2; // Console
- /*OP_AllControlsMenu[24].status = IT_GRAYEDOUT2; // Spectator Controls header
- OP_AllControlsMenu[25].status = IT_GRAYEDOUT2; // Spectator Controls space
- OP_AllControlsMenu[26].status = IT_GRAYEDOUT2; // Spectate
- OP_AllControlsMenu[27].status = IT_GRAYEDOUT2; // Look Up
- OP_AllControlsMenu[28].status = IT_GRAYEDOUT2; // Look Down
- OP_AllControlsMenu[29].status = IT_GRAYEDOUT2; // Center View
+ OP_AllControlsMenu[15].status = IT_GRAYEDOUT2; // Chat
+ //OP_AllControlsMenu[16].status = IT_GRAYEDOUT2; // Team-chat
+ OP_AllControlsMenu[16].status = IT_GRAYEDOUT2; // Rankings
+ OP_AllControlsMenu[17].status = IT_GRAYEDOUT2; // Viewpoint
+ // 18 is Reset Camera, 19 is Toggle Chasecam
+ OP_AllControlsMenu[20].status = IT_GRAYEDOUT2; // Pause
+ OP_AllControlsMenu[21].status = IT_GRAYEDOUT2; // Screenshot
+ OP_AllControlsMenu[22].status = IT_GRAYEDOUT2; // GIF
+ OP_AllControlsMenu[23].status = IT_GRAYEDOUT2; // System Menu
+ OP_AllControlsMenu[24].status = IT_GRAYEDOUT2; // Console
+ /*OP_AllControlsMenu[25].status = IT_GRAYEDOUT2; // Spectator Controls header
+ OP_AllControlsMenu[26].status = IT_GRAYEDOUT2; // Spectator Controls space
+ OP_AllControlsMenu[27].status = IT_GRAYEDOUT2; // Spectate
+ OP_AllControlsMenu[28].status = IT_GRAYEDOUT2; // Look Up
+ OP_AllControlsMenu[29].status = IT_GRAYEDOUT2; // Look Down
+ OP_AllControlsMenu[30].status = IT_GRAYEDOUT2; // Center View
*/
M_SetupNextMenu(&OP_AllControlsDef);
@@ -8696,8 +8901,7 @@ static void M_Setup3PControlsMenu(INT32 choice)
static void M_Setup4PControlsMenu(INT32 choice)
{
(void)choice;
- setupcontrols_fourthplayer = true;
- setupcontrols_secondaryplayer = setupcontrols_thirdplayer = false;
+ setupcontrolplayer = 4;
setupcontrols = gamecontrol4;
currentMenu->lastOn = itemOn;
@@ -8705,22 +8909,22 @@ static void M_Setup4PControlsMenu(INT32 choice)
OP_AllControlsMenu[0].itemaction = &OP_Joystick4Def;
// Hide P1-only controls
- OP_AllControlsMenu[14].status = IT_GRAYEDOUT2; // Chat
- //OP_AllControlsMenu[15].status = IT_GRAYEDOUT2; // Team-chat
- OP_AllControlsMenu[15].status = IT_GRAYEDOUT2; // Rankings
- OP_AllControlsMenu[16].status = IT_GRAYEDOUT2; // Viewpoint
- // 17 is Reset Camera, 18 is Toggle Chasecam
- OP_AllControlsMenu[19].status = IT_GRAYEDOUT2; // Pause
- OP_AllControlsMenu[20].status = IT_GRAYEDOUT2; // Screenshot
- OP_AllControlsMenu[21].status = IT_GRAYEDOUT2; // GIF
- OP_AllControlsMenu[22].status = IT_GRAYEDOUT2; // System Menu
- OP_AllControlsMenu[23].status = IT_GRAYEDOUT2; // Console
- /*OP_AllControlsMenu[24].status = IT_GRAYEDOUT2; // Spectator Controls header
- OP_AllControlsMenu[25].status = IT_GRAYEDOUT2; // Spectator Controls space
- OP_AllControlsMenu[26].status = IT_GRAYEDOUT2; // Spectate
- OP_AllControlsMenu[27].status = IT_GRAYEDOUT2; // Look Up
- OP_AllControlsMenu[28].status = IT_GRAYEDOUT2; // Look Down
- OP_AllControlsMenu[29].status = IT_GRAYEDOUT2; // Center View
+ OP_AllControlsMenu[15].status = IT_GRAYEDOUT2; // Chat
+ //OP_AllControlsMenu[16].status = IT_GRAYEDOUT2; // Team-chat
+ OP_AllControlsMenu[16].status = IT_GRAYEDOUT2; // Rankings
+ OP_AllControlsMenu[17].status = IT_GRAYEDOUT2; // Viewpoint
+ // 18 is Reset Camera, 19 is Toggle Chasecam
+ OP_AllControlsMenu[20].status = IT_GRAYEDOUT2; // Pause
+ OP_AllControlsMenu[21].status = IT_GRAYEDOUT2; // Screenshot
+ OP_AllControlsMenu[22].status = IT_GRAYEDOUT2; // GIF
+ OP_AllControlsMenu[23].status = IT_GRAYEDOUT2; // System Menu
+ OP_AllControlsMenu[24].status = IT_GRAYEDOUT2; // Console
+ /*OP_AllControlsMenu[25].status = IT_GRAYEDOUT2; // Spectator Controls header
+ OP_AllControlsMenu[26].status = IT_GRAYEDOUT2; // Spectator Controls space
+ OP_AllControlsMenu[27].status = IT_GRAYEDOUT2; // Spectate
+ OP_AllControlsMenu[28].status = IT_GRAYEDOUT2; // Look Up
+ OP_AllControlsMenu[29].status = IT_GRAYEDOUT2; // Look Down
+ OP_AllControlsMenu[30].status = IT_GRAYEDOUT2; // Center View
*/
M_SetupNextMenu(&OP_AllControlsDef);
@@ -8783,10 +8987,8 @@ static void M_DrawControl(void)
M_DrawMenuTitle();
M_CentreText(28,
- (setupcontrols_fourthplayer ? "\x86""Set controls for ""\x82""Player 4" :
- (setupcontrols_thirdplayer ? "\x86""Set controls for ""\x82""Player 3" :
- (setupcontrols_secondaryplayer ? "\x86""Set controls for ""\x82""Player 2" :
- "\x86""Press ""\x82""ENTER""\x86"" to change, ""\x82""BACKSPACE""\x86"" to clear"))));
+ (setupcontrolplayer > 1 ? va("\x86""Set controls for ""\x82""Player %d", setupcontrolplayer) :
+ "\x86""Press ""\x82""ENTER""\x86"" to change, ""\x82""BACKSPACE""\x86"" to clear"));
if (i)
V_DrawCharacter(currentMenu->x - 16, y-(skullAnimCounter/5),
@@ -8845,6 +9047,7 @@ static void M_DrawControl(void)
#undef controlheight
static INT32 controltochange;
+static char controltochangetext[33];
static void M_ChangecontrolResponse(event_t *ev)
{
@@ -8852,8 +9055,8 @@ static void M_ChangecontrolResponse(event_t *ev)
INT32 found;
INT32 ch = ev->data1;
- // ESCAPE cancels
- if (ch != KEY_ESCAPE)
+ // ESCAPE cancels; dummy out PAUSE
+ if (ch != KEY_ESCAPE && ch != KEY_PAUSE)
{
switch (ev->type)
@@ -8903,20 +9106,42 @@ static void M_ChangecontrolResponse(event_t *ev)
setupcontrols[control][found] = ch-KEY_4JOY1+KEY_DBL4JOY1;
}
else
- {
- // check if change key1 or key2, or shuffle them along in a queue
- found = 0;
- if (setupcontrols[control][0] != KEY_NULL)
- {
- found++;
- if (setupcontrols[control][1] != KEY_NULL)
- setupcontrols[control][0] = setupcontrols[control][1];
- }
- G_CheckDoubleUsage(ch);
- setupcontrols[control][found] = ch;
- }
+ {
+ // check if change key1 or key2, or replace the two by the new
+ found = 0;
+ if (setupcontrols[control][0] == KEY_NULL)
+ found++;
+ if (setupcontrols[control][1] == KEY_NULL)
+ found++;
+ if (found == 2)
+ {
+ found = 0;
+ setupcontrols[control][1] = KEY_NULL; //replace key 1,clear key2
+ }
+ (void)G_CheckDoubleUsage(ch, true);
+ setupcontrols[control][found] = ch;
+ }
S_StartSound(NULL, sfx_s221);
}
+ else if (ch == KEY_PAUSE)
+ {
+ // This buffer assumes a 125-character message plus a 32-character control name (per controltochangetext buffer size)
+ static char tmp[158];
+ menu_t *prev = currentMenu->prevMenu;
+
+ if (controltochange == gc_pause)
+ sprintf(tmp, M_GetText("The \x82Pause Key \x80is enabled, but \nyou may select another key. \n\nHit another key for\n%s\nESC for Cancel"),
+ controltochangetext);
+ else
+ sprintf(tmp, M_GetText("The \x82Pause Key \x80is enabled, but \nit is not configurable. \n\nHit another key for\n%s\nESC for Cancel"),
+ controltochangetext);
+
+ M_StartMessage(tmp, M_ChangecontrolResponse, MM_EVENTHANDLER);
+ currentMenu->prevMenu = prev;
+
+ S_StartSound(NULL, sfx_s3k42);
+ return;
+ }
else
S_StartSound(NULL, sfx_s224);
@@ -8925,188 +9150,108 @@ static void M_ChangecontrolResponse(event_t *ev)
static void M_ChangeControl(INT32 choice)
{
- static char tmp[55];
+ // This buffer assumes a 35-character message (per below) plus a max control name limit of 32 chars (per controltochangetext)
+ // If you change the below message, then change the size of this buffer!
+ static char tmp[68];
controltochange = currentMenu->menuitems[choice].alphaKey;
sprintf(tmp, M_GetText("Hit the new key for\n%s\nESC for Cancel"),
currentMenu->menuitems[choice].text);
+ strlcpy(controltochangetext, currentMenu->menuitems[choice].text, 33);
M_StartMessage(tmp, M_ChangecontrolResponse, MM_EVENTHANDLER);
}
+static void M_ResetControlsResponse(INT32 ch)
+{
+ INT32 i;
+
+ if (ch != 'y' && ch != KEY_ENTER)
+ return;
+
+ // clear all controls
+ for (i = 0; i < num_gamecontrols; i++)
+ {
+ switch (setupcontrolplayer)
+ {
+ case 4:
+ G_ClearControlKeys(gamecontrol4, i);
+ break;
+ case 3:
+ G_ClearControlKeys(gamecontrol3, i);
+ break;
+ case 2:
+ G_ClearControlKeys(gamecontrolbis, i);
+ break;
+ case 1:
+ default:
+ G_ClearControlKeys(gamecontrol, i);
+ break;
+ }
+ }
+
+ // Setup original defaults
+ G_Controldefault(setupcontrolplayer);
+
+ // Setup gamepad option defaults (yucky)
+ switch (setupcontrolplayer)
+ {
+ case 4:
+ CV_StealthSet(&cv_usejoystick4, cv_usejoystick4.defaultvalue);
+ CV_StealthSet(&cv_turnaxis4, cv_turnaxis4.defaultvalue);
+ CV_StealthSet(&cv_moveaxis4, cv_moveaxis4.defaultvalue);
+ CV_StealthSet(&cv_brakeaxis4, cv_brakeaxis4.defaultvalue);
+ CV_StealthSet(&cv_aimaxis4, cv_aimaxis4.defaultvalue);
+ CV_StealthSet(&cv_lookaxis4, cv_lookaxis4.defaultvalue);
+ CV_StealthSet(&cv_fireaxis4, cv_fireaxis4.defaultvalue);
+ CV_StealthSet(&cv_driftaxis4, cv_driftaxis4.defaultvalue);
+ break;
+ case 3:
+ CV_StealthSet(&cv_usejoystick3, cv_usejoystick3.defaultvalue);
+ CV_StealthSet(&cv_turnaxis3, cv_turnaxis3.defaultvalue);
+ CV_StealthSet(&cv_moveaxis3, cv_moveaxis3.defaultvalue);
+ CV_StealthSet(&cv_brakeaxis3, cv_brakeaxis3.defaultvalue);
+ CV_StealthSet(&cv_aimaxis3, cv_aimaxis3.defaultvalue);
+ CV_StealthSet(&cv_lookaxis3, cv_lookaxis3.defaultvalue);
+ CV_StealthSet(&cv_fireaxis3, cv_fireaxis3.defaultvalue);
+ CV_StealthSet(&cv_driftaxis3, cv_driftaxis3.defaultvalue);
+ break;
+ case 2:
+ CV_StealthSet(&cv_usejoystick2, cv_usejoystick2.defaultvalue);
+ CV_StealthSet(&cv_turnaxis2, cv_turnaxis2.defaultvalue);
+ CV_StealthSet(&cv_moveaxis2, cv_moveaxis2.defaultvalue);
+ CV_StealthSet(&cv_brakeaxis2, cv_brakeaxis2.defaultvalue);
+ CV_StealthSet(&cv_aimaxis2, cv_aimaxis2.defaultvalue);
+ CV_StealthSet(&cv_lookaxis2, cv_lookaxis2.defaultvalue);
+ CV_StealthSet(&cv_fireaxis2, cv_fireaxis2.defaultvalue);
+ CV_StealthSet(&cv_driftaxis2, cv_driftaxis2.defaultvalue);
+ break;
+ case 1:
+ default:
+ CV_StealthSet(&cv_usejoystick, cv_usejoystick.defaultvalue);
+ CV_StealthSet(&cv_turnaxis, cv_turnaxis.defaultvalue);
+ CV_StealthSet(&cv_moveaxis, cv_moveaxis.defaultvalue);
+ CV_StealthSet(&cv_brakeaxis, cv_brakeaxis.defaultvalue);
+ CV_StealthSet(&cv_aimaxis, cv_aimaxis.defaultvalue);
+ CV_StealthSet(&cv_lookaxis, cv_lookaxis.defaultvalue);
+ CV_StealthSet(&cv_fireaxis, cv_fireaxis.defaultvalue);
+ CV_StealthSet(&cv_driftaxis, cv_driftaxis.defaultvalue);
+ break;
+ }
+
+ S_StartSound(NULL, sfx_s224);
+}
+
+static void M_ResetControls(INT32 choice)
+{
+ (void)choice;
+ M_StartMessage(va(M_GetText("Reset Player %d's controls to defaults?\n\n(Press 'Y' to confirm)\n"), setupcontrolplayer), M_ResetControlsResponse, MM_YESNO);
+}
+
// =====
// SOUND
// =====
-// Toggles sound systems in-game.
-static void M_ToggleSFX(INT32 choice)
-{
- switch (choice)
- {
- case KEY_DOWNARROW:
- S_StartSound(NULL, sfx_menu1);
- itemOn++;
- return;
-
- case KEY_UPARROW:
- S_StartSound(NULL, sfx_menu1);
- itemOn = currentMenu->numitems-1;
- return;
-
- case KEY_ESCAPE:
- currentMenu->lastOn = itemOn;
- if (currentMenu->prevMenu)
- M_SetupNextMenu(currentMenu->prevMenu);
- else
- M_ClearMenus(true);
- return;
- default:
- break;
- }
-
- if (sound_disabled)
- {
- sound_disabled = false;
- S_InitSfxChannels(cv_soundvolume.value);
- S_StartSound(NULL, sfx_s221);
- //M_StartMessage(M_GetText("SFX Enabled\n"), NULL, MM_NOTHING);
- }
- else
- {
- sound_disabled = true;
- S_StopSounds();
- //M_StartMessage(M_GetText("SFX Disabled\n"), NULL, MM_NOTHING);
- }
-}
-
-static void M_ToggleDigital(INT32 choice)
-{
- switch (choice)
- {
- case KEY_DOWNARROW:
- S_StartSound(NULL, sfx_menu1);
- itemOn++;
- return;
-
- case KEY_UPARROW:
- S_StartSound(NULL, sfx_menu1);
- itemOn--;
- return;
-
- case KEY_ESCAPE:
- currentMenu->lastOn = itemOn;
- if (currentMenu->prevMenu)
- M_SetupNextMenu(currentMenu->prevMenu);
- else
- M_ClearMenus(true);
- return;
- default:
- break;
- }
-
- if (digital_disabled)
- {
- digital_disabled = false;
- I_InitMusic();
- S_StopMusic();
- if (Playing())
- P_RestoreMusic(&players[consoleplayer]);
- else
- S_ChangeMusicInternal("titles", looptitle);
- //M_StartMessage(M_GetText("Digital Music Enabled\n"), NULL, MM_NOTHING);
- }
- else
- {
- digital_disabled = true;
-#ifndef NO_MIDI
- if (S_MusicType() != MU_MID)
- {
- if (midi_disabled)
- S_StopMusic();
- else
- {
- char mmusic[7];
- UINT16 mflags;
- boolean looping;
-
- if (S_MusicInfo(mmusic, &mflags, &looping) && S_MIDIExists(mmusic))
- {
- S_StopMusic();
- S_ChangeMusic(mmusic, mflags, looping);
- }
- else
- S_StopMusic();
- }
- }
-#else
- S_StopMusic();
-#endif
- //M_StartMessage(M_GetText("Digital Music Disabled\n"), NULL, MM_NOTHING);
- }
-}
-
-#ifndef NO_MIDI
-static void M_ToggleMIDI(INT32 choice)
-{
- switch (choice)
- {
- case KEY_DOWNARROW:
- S_StartSound(NULL, sfx_menu1);
- itemOn++;
- return;
-
- case KEY_UPARROW:
- S_StartSound(NULL, sfx_menu1);
- itemOn--;
- return;
-
- case KEY_ESCAPE:
- if (currentMenu->prevMenu)
- M_SetupNextMenu(currentMenu->prevMenu);
- else
- M_ClearMenus(true);
- return;
- default:
- break;
- }
-
- if (midi_disabled)
- {
- midi_disabled = false;
- I_InitMusic();
- if (Playing())
- P_RestoreMusic(&players[consoleplayer]);
- else
- S_ChangeMusicInternal("titles", looptitle);
- //M_StartMessage(M_GetText("MIDI Music Enabled\n"), NULL, MM_NOTHING);
- }
- else
- {
- midi_disabled = true;
- if (S_MusicType() == MU_MID)
- {
- if (digital_disabled)
- S_StopMusic();
- else
- {
- char mmusic[7];
- UINT16 mflags;
- boolean looping;
-
- if (S_MusicInfo(mmusic, &mflags, &looping) && S_DigExists(mmusic))
- {
- S_StopMusic();
- S_ChangeMusic(mmusic, mflags, looping);
- }
- else
- S_StopMusic();
- }
- }
- //M_StartMessage(M_GetText("MIDI Music Disabled\n"), NULL, MM_NOTHING);
- }
-}
-#endif
-
/*static void M_RestartAudio(void)
{
COM_ImmedExecute("restartaudio");
diff --git a/src/m_menu.h b/src/m_menu.h
index dc99e6bb..864f4cac 100644
--- a/src/m_menu.h
+++ b/src/m_menu.h
@@ -3,7 +3,7 @@
// Copyright (C) 1993-1996 by id Software, Inc.
// Copyright (C) 1998-2000 by DooM Legacy Team.
// Copyright (C) 2011-2016 by Matthew "Inuyasha" Walsh.
-// Copyright (C) 1999-2016 by Sonic Team Junior.
+// Copyright (C) 1999-2018 by Sonic Team Junior.
//
// This program is free software distributed under the
// terms of the GNU General Public License, version 2.
@@ -69,7 +69,6 @@ void M_QuitResponse(INT32 ch);
// Determines whether to show a level in the list
boolean M_CanShowLevelInList(INT32 mapnum, INT32 gt);
-
// flags for items in the menu
// menu handle (what we do when key is pressed
#define IT_TYPE 14 // (2+4+8)
@@ -151,7 +150,7 @@ typedef struct menuitem_s
UINT8 alphaKey;
} menuitem_t;
-extern menuitem_t PlayerMenu[32];
+extern menuitem_t PlayerMenu[MAXSKINS];
typedef struct menu_s
{
@@ -173,6 +172,10 @@ extern menu_t *currentMenu;
extern menu_t MainDef;
extern menu_t SP_LoadDef;
+// Call upon joystick hotplug
+void M_SetupJoystickMenu(INT32 choice);
+extern menu_t OP_JoystickSetDef;
+
// Stuff for customizing the player select screen
typedef struct
{
diff --git a/src/m_misc.c b/src/m_misc.c
index 0d84760f..53b63e75 100644
--- a/src/m_misc.c
+++ b/src/m_misc.c
@@ -2,7 +2,7 @@
//-----------------------------------------------------------------------------
// Copyright (C) 1993-1996 by id Software, Inc.
// Copyright (C) 1998-2000 by DooM Legacy Team.
-// Copyright (C) 1999-2016 by Sonic Team Junior.
+// Copyright (C) 1999-2018 by Sonic Team Junior.
//
// This program is free software distributed under the
// terms of the GNU General Public License, version 2.
@@ -37,6 +37,7 @@
#include "d_main.h"
#include "m_argv.h"
#include "i_system.h"
+#include "command.h" // cv_execversion
#include "m_anigif.h"
@@ -92,7 +93,9 @@ typedef off_t off64_t;
#ifdef PNG_WRITE_SUPPORTED
#define USE_PNG // Only actually use PNG if write is supported.
#if defined (PNG_WRITE_APNG_SUPPORTED) //|| !defined(PNG_STATIC)
- #define USE_APNG
+ #if (PNG_LIBPNG_VER_MAJOR) == 1 && (PNG_LIBPNG_VER_MINOR <= 4) // Supposedly, the current APNG code can't work on newer versions as is
+ #define USE_APNG
+ #endif
#endif
// See hardware/hw_draw.c for a similar check to this one.
#endif
@@ -440,7 +443,22 @@ void Command_LoadConfig_f(void)
strcpy(configfile, COM_Argv(1));
FIL_ForceExtension(configfile, ".cfg");
+
+ // load default control
+ G_ClearAllControlKeys();
+ G_Controldefault(0);
+
+ // temporarily reset execversion to default
+ CV_ToggleExecVersion(true);
+ COM_BufInsertText(va("%s \"%s\"\n", cv_execversion.name, cv_execversion.defaultvalue));
+ CV_InitFilterVar();
+
+ // exec the config
COM_BufInsertText(va("exec \"%s\"\n", configfile));
+
+ // don't filter anymore vars and don't let this convsvar be changed
+ COM_BufInsertText(va("%s \"%d\"\n", cv_execversion.name, EXECVERSION));
+ CV_ToggleExecVersion(false);
}
/** Saves the current configuration and loads another.
@@ -475,12 +493,25 @@ void M_FirstLoadConfig(void)
}
// load default control
- G_Controldefault();
+ G_Controldefault(0);
+
+ // register execversion here before we load any configs
+ CV_RegisterVar(&cv_execversion);
+
+ // temporarily reset execversion to default
+ // we shouldn't need to do this, but JUST in case...
+ CV_ToggleExecVersion(true);
+ COM_BufInsertText(va("%s \"%s\"\n", cv_execversion.name, cv_execversion.defaultvalue));
+ CV_InitFilterVar();
// load config, make sure those commands doesnt require the screen...
COM_BufInsertText(va("exec \"%s\"\n", configfile));
// no COM_BufExecute() needed; that does it right away
+ // don't filter anymore vars and don't let this convsvar be changed
+ COM_BufInsertText(va("%s \"%d\"\n", cv_execversion.name, EXECVERSION));
+ CV_ToggleExecVersion(false);
+
// make sure I_Quit() will write back the correct config
// (do not write back the config if it crash before)
gameconfig_loaded = true;
@@ -493,6 +524,7 @@ void M_FirstLoadConfig(void)
void M_SaveConfig(const char *filename)
{
FILE *f;
+ char *filepath;
// make sure not to write back the config until it's been correctly loaded
if (!gameconfig_loaded)
@@ -507,13 +539,20 @@ void M_SaveConfig(const char *filename)
return;
}
- f = fopen(filename, "w");
+ // append srb2home to beginning of filename
+ // but check if srb2home isn't already there, first
+ if (!strstr(filename, srb2home))
+ filepath = va(pandf,srb2home, filename);
+ else
+ filepath = Z_StrDup(filename);
+
+ f = fopen(filepath, "w");
// change it only if valid
if (f)
- strcpy(configfile, filename);
+ strcpy(configfile, filepath);
else
{
- CONS_Alert(CONS_ERROR, M_GetText("Couldn't save game config file %s\n"), filename);
+ CONS_Alert(CONS_ERROR, M_GetText("Couldn't save game config file %s\n"), filepath);
return;
}
}
@@ -536,6 +575,10 @@ void M_SaveConfig(const char *filename)
// header message
fprintf(f, "// SRB2Kart configuration file.\n");
+ // print execversion FIRST, because subsequent consvars need to be filtered
+ // always print current EXECVERSION
+ fprintf(f, "%s \"%d\"\n", cv_execversion.name, EXECVERSION);
+
// FIXME: save key aliases if ever implemented..
CV_SaveVariables(f);
@@ -1499,9 +1542,9 @@ boolean M_ScreenshotResponder(event_t *ev)
if (ch >= KEY_MOUSE1 && menuactive) // If it's not a keyboard key, then don't allow it in the menus!
return false;
- if (ch == gamecontrol[gc_screenshot][0] || ch == gamecontrol[gc_screenshot][1]) // remappable F8
+ if (ch == KEY_F8 || ch == gamecontrol[gc_screenshot][0] || ch == gamecontrol[gc_screenshot][1]) // remappable F8
M_ScreenShot();
- else if (ch == gamecontrol[gc_recordgif][0] || ch == gamecontrol[gc_recordgif][1]) // remappable F9
+ else if (ch == KEY_F9 || ch == gamecontrol[gc_recordgif][0] || ch == gamecontrol[gc_recordgif][1]) // remappable F9
((moviemode) ? M_StopMovie : M_StartMovie)();
else
return false;
diff --git a/src/m_misc.h b/src/m_misc.h
index ee0daf56..658028b4 100644
--- a/src/m_misc.h
+++ b/src/m_misc.h
@@ -2,7 +2,7 @@
//-----------------------------------------------------------------------------
// Copyright (C) 1993-1996 by id Software, Inc.
// Copyright (C) 1998-2000 by DooM Legacy Team.
-// Copyright (C) 1999-2016 by Sonic Team Junior.
+// Copyright (C) 1999-2018 by Sonic Team Junior.
//
// This program is free software distributed under the
// terms of the GNU General Public License, version 2.
diff --git a/src/m_queue.c b/src/m_queue.c
index daa7d7a2..a3aa0487 100644
--- a/src/m_queue.c
+++ b/src/m_queue.c
@@ -1,7 +1,7 @@
// SONIC ROBO BLAST 2
//-----------------------------------------------------------------------------
// Copyright (C) 2003 by James Haley
-// Copyright (C) 2003-2016 by Sonic Team Junior.
+// Copyright (C) 2003-2018 by Sonic Team Junior.
//
// This program is free software distributed under the
// terms of the GNU General Public License, version 2.
diff --git a/src/m_queue.h b/src/m_queue.h
index 7e0d58d3..eebb2146 100644
--- a/src/m_queue.h
+++ b/src/m_queue.h
@@ -1,7 +1,7 @@
// SONIC ROBO BLAST 2
//-----------------------------------------------------------------------------
// Copyright (C) 2003 by James Haley
-// Copyright (C) 2003-2016 by Sonic Team Junior.
+// Copyright (C) 2003-2018 by Sonic Team Junior.
//
// This program is free software distributed under the
// terms of the GNU General Public License, version 2.
diff --git a/src/m_random.c b/src/m_random.c
index 839b06e4..3d46f76b 100644
--- a/src/m_random.c
+++ b/src/m_random.c
@@ -3,7 +3,7 @@
// Copyright (C) 1993-1996 by id Software, Inc.
// Copyright (C) 1998-2000 by DooM Legacy Team.
// Copyright (C) 2012-2016 by Matthew "Inuyasha" Walsh.
-// Copyright (C) 1999-2016 by Sonic Team Junior.
+// Copyright (C) 1999-2018 by Sonic Team Junior.
//
// This program is free software distributed under the
// terms of the GNU General Public License, version 2.
diff --git a/src/m_random.h b/src/m_random.h
index 76dd9f1d..6187bcf1 100644
--- a/src/m_random.h
+++ b/src/m_random.h
@@ -3,7 +3,7 @@
// Copyright (C) 1993-1996 by id Software, Inc.
// Copyright (C) 1998-2000 by DooM Legacy Team.
// Copyright (C) 2012-2016 by Matthew "Inuyasha" Walsh.
-// Copyright (C) 1999-2016 by Sonic Team Junior.
+// Copyright (C) 1999-2018 by Sonic Team Junior.
//
// This program is free software distributed under the
// terms of the GNU General Public License, version 2.
diff --git a/src/m_swap.h b/src/m_swap.h
index 2352a0b2..2d42f613 100644
--- a/src/m_swap.h
+++ b/src/m_swap.h
@@ -2,7 +2,7 @@
//-----------------------------------------------------------------------------
// Copyright (C) 1993-1996 by id Software, Inc.
// Copyright (C) 1998-2000 by DooM Legacy Team.
-// Copyright (C) 1999-2016 by Sonic Team Junior.
+// Copyright (C) 1999-2018 by Sonic Team Junior.
//
// This program is free software distributed under the
// terms of the GNU General Public License, version 2.
diff --git a/src/mserv.c b/src/mserv.c
index 98849df4..f5c4fa88 100644
--- a/src/mserv.c
+++ b/src/mserv.c
@@ -1,7 +1,7 @@
// SONIC ROBO BLAST 2
//-----------------------------------------------------------------------------
// Copyright (C) 1998-2000 by DooM Legacy Team.
-// Copyright (C) 1999-2016 by Sonic Team Junior.
+// Copyright (C) 1999-2018 by Sonic Team Junior.
//
// This program is free software distributed under the
// terms of the GNU General Public License, version 2.
@@ -206,7 +206,7 @@ static void ServerName_OnChange(void);
#define DEF_PORT "28900"
consvar_t cv_masterserver = {"masterserver", "ms.srb2.org:"DEF_PORT, CV_SAVE, NULL, MasterServer_OnChange, 0, NULL, NULL, 0, 0, NULL};
-consvar_t cv_servername = {"servername", "SRB2Kart server", CV_SAVE, NULL, ServerName_OnChange, 0, NULL, NULL, 0, 0, NULL};
+consvar_t cv_servername = {"servername", "SRB2Kart server", CV_SAVE|CV_CALL|CV_NOINIT, NULL, ServerName_OnChange, 0, NULL, NULL, 0, 0, NULL};
INT16 ms_RoomId = -1;
@@ -557,9 +557,21 @@ const char *GetMODVersion(void)
msg.room = MODID; // Might as well use it for something.
sprintf(msg.buffer,"%d",MODVERSION);
if (MS_Write(&msg) < 0)
+ {
+ CONS_Alert(CONS_ERROR, M_GetText("Could not send to the Master Server\n"));
+ M_StartMessage(M_GetText("Could not send to the Master Server\n"), NULL, MM_NOTHING);
+ CloseConnection();
return NULL;
+ }
+
+ if (MS_Read(&msg) < 0)
+ {
+ CONS_Alert(CONS_ERROR, M_GetText("No reply from the Master Server\n"));
+ M_StartMessage(M_GetText("No reply from the Master Server\n"), NULL, MM_NOTHING);
+ CloseConnection();
+ return NULL;
+ }
- MS_Read(&msg);
CloseConnection();
if(strcmp(msg.buffer,"NULL") != 0)
@@ -587,9 +599,19 @@ void GetMODVersion_Console(void)
msg.room = MODID; // Might as well use it for something.
sprintf(msg.buffer,"%d",MODVERSION);
if (MS_Write(&msg) < 0)
+ {
+ CONS_Alert(CONS_ERROR, M_GetText("Could not send to the Master Server\n"));
+ CloseConnection();
return;
+ }
+
+ if (MS_Read(&msg) < 0)
+ {
+ CONS_Alert(CONS_ERROR, M_GetText("No reply from the Master Server\n"));
+ CloseConnection();
+ return;
+ }
- MS_Read(&msg);
CloseConnection();
if(strcmp(msg.buffer,"NULL") != 0)
@@ -956,8 +978,8 @@ void MasterClient_Ticker(void)
static void ServerName_OnChange(void)
{
- UnregisterServer();
- RegisterServer();
+ if (con_state == MSCS_REGISTERED)
+ AddToMasterServer(false);
}
static void MasterServer_OnChange(void)
diff --git a/src/mserv.h b/src/mserv.h
index c28ece26..09cd4f08 100644
--- a/src/mserv.h
+++ b/src/mserv.h
@@ -1,7 +1,7 @@
// SONIC ROBO BLAST 2
//-----------------------------------------------------------------------------
// Copyright (C) 1998-2000 by DooM Legacy Team.
-// Copyright (C) 1999-2016 by Sonic Team Junior.
+// Copyright (C) 1999-2018 by Sonic Team Junior.
//
// This program is free software distributed under the
// terms of the GNU General Public License, version 2.
diff --git a/src/p_ceilng.c b/src/p_ceilng.c
index 27d73941..757edeba 100644
--- a/src/p_ceilng.c
+++ b/src/p_ceilng.c
@@ -2,7 +2,7 @@
//-----------------------------------------------------------------------------
// Copyright (C) 1993-1996 by id Software, Inc.
// Copyright (C) 1998-2000 by DooM Legacy Team.
-// Copyright (C) 1999-2016 by Sonic Team Junior.
+// Copyright (C) 1999-2018 by Sonic Team Junior.
//
// This program is free software distributed under the
// terms of the GNU General Public License, version 2.
diff --git a/src/p_enemy.c b/src/p_enemy.c
index 2e7df738..8a6d7597 100644
--- a/src/p_enemy.c
+++ b/src/p_enemy.c
@@ -2,7 +2,7 @@
//-----------------------------------------------------------------------------
// Copyright (C) 1993-1996 by id Software, Inc.
// Copyright (C) 1998-2000 by DooM Legacy Team.
-// Copyright (C) 1999-2016 by Sonic Team Junior.
+// Copyright (C) 1999-2018 by Sonic Team Junior.
//
// This program is free software distributed under the
// terms of the GNU General Public License, version 2.
@@ -3971,12 +3971,15 @@ static inline boolean PIT_GrenadeRing(mobj_t *thing)
void A_GrenadeRing(mobj_t *actor)
{
INT32 bx, by, xl, xh, yl, yh;
- explodedist = FixedMul(actor->info->painchance, mapheaderinfo[gamemap-1]->mobj_scale);
+ explodedist = FixedMul(actor->info->painchance, mapobjectscale);
#ifdef HAVE_BLUA
if (LUA_CallAction("A_GrenadeRing", actor))
return;
#endif
+ if (actor->state == &states[S_SSMINE_DEPLOY8])
+ explodedist = (3*explodedist)/2;
+
if (leveltime % 35 == 0)
S_StartSound(actor, actor->info->activesound);
@@ -4036,7 +4039,7 @@ void A_MineExplode(mobj_t *actor)
INT32 d;
INT32 locvar1 = var1;
mobjtype_t type;
- explodedist = FixedMul(actor->info->painchance, mapheaderinfo[gamemap-1]->mobj_scale);
+ explodedist = FixedMul((3*actor->info->painchance)/2, mapobjectscale);
#ifdef HAVE_BLUA
if (LUA_CallAction("A_MineExplode", actor))
return;
@@ -4057,7 +4060,7 @@ void A_MineExplode(mobj_t *actor)
P_BlockThingsIterator(bx, by, PIT_MineExplode);
for (d = 0; d < 16; d++)
- K_SpawnKartExplosion(actor->x, actor->y, actor->z, explodedist + 32*mapheaderinfo[gamemap-1]->mobj_scale, 32, type, d*(ANGLE_45/4), true, false, actor->target); // 32 <-> 64
+ K_SpawnKartExplosion(actor->x, actor->y, actor->z, explodedist + 32*mapobjectscale, 32, type, d*(ANGLE_45/4), true, false, actor->target); // 32 <-> 64
if (actor->target && actor->target->player)
K_SpawnMineExplosion(actor, actor->target->player->skincolor);
@@ -8273,7 +8276,7 @@ void A_JawzChase(mobj_t *actor)
ret->frame |= ((leveltime % 10) / 2) + 5;
ret->color = actor->cvmem;
- P_Thrust(actor, R_PointToAngle2(actor->x, actor->y, actor->tracer->x, actor->tracer->y), actor->info->speed);
+ P_Thrust(actor, R_PointToAngle2(actor->x, actor->y, actor->tracer->x, actor->tracer->y), (7*actor->movefactor)/64);
return;
}
else
@@ -8345,38 +8348,83 @@ void A_SPBChase(mobj_t *actor)
#endif
// Default speed
- wspeed = FixedMul(actor->info->speed, mapheaderinfo[gamemap-1]->mobj_scale);
- if (gamespeed == 0)
- wspeed = FixedMul(wspeed, FRACUNIT-FRACUNIT/4);
- else if (gamespeed == 2)
- wspeed = FixedMul(wspeed, FRACUNIT+FRACUNIT/4);
+ wspeed = actor->movefactor;
if (actor->threshold) // Just fired, go straight.
{
+ actor->lastlook = -1;
+ spbplace = -1;
P_InstaThrust(actor, actor->angle, wspeed);
return;
}
- if (actor->extravalue1) // MODE: TARGETING
+ // Find the player with the best rank
+ for (i = 0; i < MAXPLAYERS; i++)
+ {
+ if (!playeringame[i] || players[i].spectator || players[i].exiting)
+ continue; // not in-game
+
+ /*if (!players[i].mo)
+ continue; // no mobj
+
+ if (players[i].mo->health <= 0)
+ continue; // dead
+
+ if (players[i].kartstuff[k_respawn])
+ continue;*/ // respawning
+
+ if (players[i].kartstuff[k_position] < bestrank)
+ {
+ bestrank = players[i].kartstuff[k_position];
+ player = &players[i];
+ }
+ }
+
+ if (actor->extravalue1 == 1) // MODE: TARGETING
{
if (actor->tracer && actor->tracer->health)
{
fixed_t defspeed = wspeed;
fixed_t range = (160*actor->tracer->scale);
-
- // Maybe we want SPB to target an object later? IDK lol
- if (actor->tracer->player) // 7/8ths max speed for Knuckles, 3/4ths max speed for min accel, exactly max speed for max accel
- {
- if (!P_IsObjectOnGround(actor->tracer) && !actor->tracer->player->kartstuff[k_pogospring])
- defspeed = 7*actor->tracer->player->speed/8; // In the air you have no control; basically don't hit unless you make a near complete stop
- else
- defspeed = ((33 - actor->tracer->player->kartspeed) * K_GetKartSpeed(actor->tracer->player, false)) / 32;
- }
+ fixed_t cx = 0, cy =0;
// Play the intimidating gurgle
if (!S_SoundPlaying(actor, actor->info->activesound))
S_StartSound(actor, actor->info->activesound);
+ // Maybe we want SPB to target an object later? IDK lol
+ if (actor->tracer->player)
+ {
+ UINT8 fracmax = 32;
+ UINT8 spark = ((10-actor->tracer->player->kartspeed) + actor->tracer->player->kartweight) / 2;
+ fixed_t easiness = ((actor->tracer->player->kartspeed + (10-spark)) << FRACBITS) / 2;
+
+ actor->lastlook = actor->tracer->player-players; // Save the player num for death scumming...
+
+ if (!P_IsObjectOnGround(actor->tracer) /*&& !actor->tracer->player->kartstuff[k_pogospring]*/)
+ {
+ // In the air you have no control; basically don't hit unless you make a near complete stop
+ defspeed = (7 * actor->tracer->player->speed) / 8;
+ }
+ else
+ {
+ // 7/8ths max speed for Knuckles, 3/4ths max speed for min accel, exactly max speed for max accel
+ defspeed = FixedMul(((fracmax+1)<tracer->player, false)) / fracmax;
+ }
+
+ // Be fairer on conveyors
+ cx = actor->tracer->player->cmomx;
+ cy = actor->tracer->player->cmomy;
+
+ // Switch targets if you're no longer 1st for long enough
+ if (actor->tracer->player->kartstuff[k_position] <= bestrank)
+ actor->extravalue2 = 7*TICRATE;
+ else if (actor->extravalue2-- <= 0)
+ actor->extravalue1 = 0; // back to SEEKING
+
+ spbplace = actor->tracer->player->kartstuff[k_position];
+ }
+
dist = P_AproxDistance(P_AproxDistance(actor->x-actor->tracer->x, actor->y-actor->tracer->y), actor->z-actor->tracer->z);
wspeed = FixedMul(defspeed, FRACUNIT + FixedDiv(dist-range, range));
@@ -8384,10 +8432,18 @@ void A_SPBChase(mobj_t *actor)
wspeed = defspeed;
if (wspeed > (3*defspeed)/2)
wspeed = (3*defspeed)/2;
+ if (wspeed < 20*actor->tracer->scale)
+ wspeed = 20*actor->tracer->scale;
hang = R_PointToAngle2(actor->x, actor->y, actor->tracer->x, actor->tracer->y);
vang = R_PointToAngle2(0, actor->z, dist, actor->tracer->z);
+ // Modify stored speed
+ if (wspeed > actor->cvmem)
+ actor->cvmem += (wspeed - actor->cvmem) / TICRATE;
+ else
+ actor->cvmem = wspeed;
+
{
// Smoothly rotate horz angle
angle_t input = hang - actor->angle;
@@ -8396,7 +8452,7 @@ void A_SPBChase(mobj_t *actor)
input = InvAngle(input);
// Slow down when turning; it looks better and makes U-turns not unfair
- xyspeed = FixedMul(wspeed, max(0, (((180<cvmem, max(0, (((180<cvmem, max(0, (((180<movedir += input;
}
- actor->momx = FixedMul(FixedMul(xyspeed, FINECOSINE(actor->angle>>ANGLETOFINESHIFT)), FINECOSINE(actor->movedir>>ANGLETOFINESHIFT));
- actor->momy = FixedMul(FixedMul(xyspeed, FINESINE(actor->angle>>ANGLETOFINESHIFT)), FINECOSINE(actor->movedir>>ANGLETOFINESHIFT));
+ actor->momx = cx + FixedMul(FixedMul(xyspeed, FINECOSINE(actor->angle>>ANGLETOFINESHIFT)), FINECOSINE(actor->movedir>>ANGLETOFINESHIFT));
+ actor->momy = cy + FixedMul(FixedMul(xyspeed, FINESINE(actor->angle>>ANGLETOFINESHIFT)), FINECOSINE(actor->movedir>>ANGLETOFINESHIFT));
actor->momz = FixedMul(zspeed, FINESINE(actor->movedir>>ANGLETOFINESHIFT));
// Red speed lines for when it's gaining on its target. A tell for when you're starting to lose too much speed!
@@ -8434,9 +8490,9 @@ void A_SPBChase(mobj_t *actor)
actor->z + (actor->height/2) + (P_RandomRange(-24,24) * actor->scale),
MT_FASTLINE);
fast->angle = R_PointToAngle2(0, 0, actor->momx, actor->momy);
- //fast->momx = 3*actor->momx/4;
- //fast->momy = 3*actor->momy/4;
- //fast->momz = 3*actor->momz/4;
+ //fast->momx = (3*actor->momx)/4;
+ //fast->momy = (3*actor->momy)/4;
+ //fast->momz = (3*actor->momz)/4;
fast->color = SKINCOLOR_RED;
fast->colorized = true;
K_MatchGenericExtraFlags(fast, actor);
@@ -8447,54 +8503,52 @@ void A_SPBChase(mobj_t *actor)
else // Target's gone, return to SEEKING
{
P_SetTarget(&actor->tracer, NULL);
- actor->extravalue1 = 0; // Find someone new next tic
+ actor->extravalue1 = 2; // WAIT...
+ actor->extravalue2 = 52; // Slightly over the respawn timer length
return;
}
}
+ else if (actor->extravalue1 == 2) // MODE: WAIT...
+ {
+ actor->momx = actor->momy = actor->momz = 0; // Stoooop
+
+ if (actor->lastlook != -1
+ && playeringame[actor->lastlook]
+ && !players[actor->lastlook].spectator
+ && !players[actor->lastlook].exiting)
+ {
+ spbplace = players[actor->lastlook].kartstuff[k_position];
+ if (actor->extravalue2-- <= 0 && players[actor->lastlook].mo)
+ {
+ P_SetTarget(&actor->tracer, players[actor->lastlook].mo);
+ actor->extravalue1 = 1; // TARGET ACQUIRED
+ actor->extravalue2 = 7*TICRATE;
+ actor->cvmem = wspeed;
+ }
+ }
+ else
+ {
+ actor->extravalue1 = 0; // SEEKING
+ actor->extravalue2 = 0;
+ spbplace = -1;
+ }
+ }
else // MODE: SEEKING
{
- // Find the player with the best rank
- for (i = 0; i < MAXPLAYERS; i++)
+ actor->lastlook = -1; // Just make sure this is reset
+
+ if (!player || !player->mo || player->mo->health <= 0 || player->kartstuff[k_respawn])
{
- if (!playeringame[i] || players[i].spectator || players[i].exiting)
- continue; // not in-game
-
- if (!players[i].mo)
- continue; // no mobj
-
- if (players[i].mo->health <= 0)
- continue; // dead
-
- if (players[i].kartstuff[k_respawn])
- continue; // respawning
-
- if (players[i].kartstuff[k_position] < bestrank)
- {
- bestrank = players[i].kartstuff[k_position];
- player = &players[i];
- }
- }
-
- // No one there?
- if (player == NULL || !player->mo)
- {
-#if 0
- // SELF-DESTRUCT?
- mobj_t *spbexplode;
-
- S_StopSound(actor); // Don't continue playing the gurgle or the siren
- spbexplode = P_SpawnMobj(actor->x, actor->y, actor->z, MT_SPBEXPLOSION);
- P_SetTarget(&spbexplode->target, actor->target);
-
- P_RemoveMobj(actor);
-#else
+ // No one there? Completely STOP.
actor->momx = actor->momy = actor->momz = 0;
-#endif
+ if (!player)
+ spbplace = -1;
return;
}
// Found someone, now get close enough to initiate the slaughter...
P_SetTarget(&actor->tracer, player->mo);
+ spbplace = bestrank;
dist = P_AproxDistance(P_AproxDistance(actor->x-actor->tracer->x, actor->y-actor->tracer->y), actor->z-actor->tracer->z);
@@ -8541,6 +8595,8 @@ void A_SPBChase(mobj_t *actor)
{
S_StartSound(actor, actor->info->attacksound); // Siren sound; might not need this anymore, but I'm keeping it for now just for debugging.
actor->extravalue1 = 1; // TARGET ACQUIRED
+ actor->extravalue2 = 7*TICRATE;
+ actor->cvmem = wspeed;
}
}
@@ -10341,7 +10397,7 @@ void A_SetScale(mobj_t *actor)
return;
}
- locvar1 = FixedMul(locvar1, mapheaderinfo[gamemap-1]->mobj_scale); // SRB2Kart
+ locvar1 = FixedMul(locvar1, mapobjectscale); // SRB2Kart
target->destscale = locvar1; // destination scale
if (!(locvar2 & 65535))
diff --git a/src/p_floor.c b/src/p_floor.c
index e723765c..e11fe403 100644
--- a/src/p_floor.c
+++ b/src/p_floor.c
@@ -2,7 +2,7 @@
//-----------------------------------------------------------------------------
// Copyright (C) 1993-1996 by id Software, Inc.
// Copyright (C) 1998-2000 by DooM Legacy Team.
-// Copyright (C) 1999-2016 by Sonic Team Junior.
+// Copyright (C) 1999-2018 by Sonic Team Junior.
//
// This program is free software distributed under the
// terms of the GNU General Public License, version 2.
@@ -3009,7 +3009,7 @@ void EV_CrumbleChain(sector_t *sec, ffloor_t *rover)
fixed_t topz;
fixed_t a, b, c;
mobjtype_t type = MT_ROCKCRUMBLE1;
- const fixed_t spacing = 48*mapheaderinfo[gamemap-1]->mobj_scale;
+ const fixed_t spacing = 48*mapobjectscale;
// If the control sector has a special
// of Section3:7-15, use the custom debris.
diff --git a/src/p_inter.c b/src/p_inter.c
index 6a89159b..dd27858f 100644
--- a/src/p_inter.c
+++ b/src/p_inter.c
@@ -2,7 +2,7 @@
//-----------------------------------------------------------------------------
// Copyright (C) 1993-1996 by id Software, Inc.
// Copyright (C) 1998-2000 by DooM Legacy Team.
-// Copyright (C) 1999-2016 by Sonic Team Junior.
+// Copyright (C) 1999-2018 by Sonic Team Junior.
//
// This program is free software distributed under the
// terms of the GNU General Public License, version 2.
@@ -131,8 +131,8 @@ boolean P_CanPickupItem(player_t *player, UINT8 weapon)
else
{
// Item-specific timer going off
- if (player->kartstuff[k_stealingtimer] || player->kartstuff[k_stolentimer]
- || player->kartstuff[k_growshrinktimer] > 0 || player->kartstuff[k_rocketsneakertimer]
+ if (player->kartstuff[k_stealingtimer] || player->kartstuff[k_stolentimer]
+ || player->kartstuff[k_growshrinktimer] > 0 || player->kartstuff[k_rocketsneakertimer]
|| player->kartstuff[k_eggmanexplode])
return false;
@@ -366,7 +366,7 @@ void P_TouchSpecialThing(mobj_t *special, mobj_t *toucher, boolean heightcheck)
P_SetTarget(&special->tracer, toucher);
special->flags2 |= MF2_NIGHTSPULL;
- special->destscale = mapheaderinfo[gamemap-1]->mobj_scale>>4;
+ special->destscale = mapobjectscale>>4;
special->scalespeed <<= 1;
special->flags &= ~MF_SPECIAL;
@@ -497,9 +497,21 @@ void P_TouchSpecialThing(mobj_t *special, mobj_t *toucher, boolean heightcheck)
}
else if (special->target->player->kartstuff[k_comebackmode] == 1 && P_CanPickupItem(player, 1))
{
- mobj_t *poof = P_SpawnMobj(tmthing->x, tmthing->y, tmthing->z, MT_EXPLODE);
+ mobj_t *poof = P_SpawnMobj(special->x, special->y, special->z, MT_EXPLODE);
S_StartSound(poof, special->info->seesound);
+ // Karma fireworks
+ for (i = 0; i < 5; i++)
+ {
+ mobj_t *firework = P_SpawnMobj(special->x, special->y, special->z, MT_KARMAFIREWORK);
+ firework->momx = (special->target->momx + toucher->momx) / 2;
+ firework->momy = (special->target->momy + toucher->momy) / 2;
+ firework->momz = (special->target->momz + toucher->momz) / 2;
+ P_Thrust(firework, FixedAngle((72*i)<scale);
+ P_SetObjectMomZ(firework, P_RandomRange(1,8)*special->scale, false);
+ firework->color = special->target->color;
+ }
+
special->target->player->kartstuff[k_comebackmode] = 0;
special->target->player->kartstuff[k_comebackpoints]++;
@@ -567,30 +579,31 @@ void P_TouchSpecialThing(mobj_t *special, mobj_t *toucher, boolean heightcheck)
if (special->health <= 0 || toucher->health <= 0)
return;
- if (!player->mo || player->spectator)
+ if (player->spectator)
return;
- if (special->tracer && toucher == special->tracer)
+ if (special->tracer && !P_MobjWasRemoved(special->tracer) && toucher == special->tracer)
{
mobj_t *spbexplode;
- S_StopSound(special); // Don't continue playing the gurgle or the siren
-
- if (!player->kartstuff[k_invincibilitytimer] && !player->kartstuff[k_growshrinktimer])
+ if (player->kartstuff[k_invincibilitytimer] > 0 || player->kartstuff[k_growshrinktimer] > 0 || player->kartstuff[k_hyudorotimer] > 0)
{
+ //player->powers[pw_flashing] = 0;
K_DropHnextList(player);
K_StripItems(player);
- //player->powers[pw_flashing] = 0;
}
+ S_StopSound(special); // Don't continue playing the gurgle or the siren
+
spbexplode = P_SpawnMobj(toucher->x, toucher->y, toucher->z, MT_SPBEXPLOSION);
spbexplode->extravalue1 = 1; // Tell K_ExplodePlayer to use extra knockback
- P_SetTarget(&spbexplode->target, special->target);
+ if (special->target && !P_MobjWasRemoved(special->target))
+ P_SetTarget(&spbexplode->target, special->target);
P_RemoveMobj(special);
}
else
- K_SpinPlayer(player, special, 0, false);
+ K_SpinPlayer(player, special->target, 0, special, false);
return;
/*case MT_EERIEFOG:
special->frame &= ~FF_TRANS80;
@@ -629,6 +642,18 @@ void P_TouchSpecialThing(mobj_t *special, mobj_t *toucher, boolean heightcheck)
player->kartstuff[k_itemroulette] = 1;
player->kartstuff[k_roulettetype] = 1;
+ // Karma fireworks
+ for (i = 0; i < 5; i++)
+ {
+ mobj_t *firework = P_SpawnMobj(special->x, special->y, special->z, MT_KARMAFIREWORK);
+ firework->momx = toucher->momx;
+ firework->momy = toucher->momy;
+ firework->momz = toucher->momz;
+ P_Thrust(firework, FixedAngle((72*i)<scale);
+ P_SetObjectMomZ(firework, P_RandomRange(1,8)*special->scale, false);
+ firework->color = toucher->color;
+ }
+
S_StartSound(toucher, sfx_cdfm73); // they don't make this sound in the original game but it's nice to have a "reward" for good play
//special->momx = special->momy = special->momz = 0;
@@ -1416,8 +1441,7 @@ void P_TouchSpecialThing(mobj_t *special, mobj_t *toucher, boolean heightcheck)
}
//
// SRB2kart: make sure the player will have enough checkpoints to touch
- if (circuitmap
- && special->health >= (numstarposts/2 + player->starpostnum))
+ if (circuitmap && special->health >= ((numstarposts/2) + player->starpostnum))
{
// blatant reuse of a variable that's normally unused in circuit
if (!player->tossdelay)
@@ -1444,7 +1468,6 @@ void P_TouchSpecialThing(mobj_t *special, mobj_t *toucher, boolean heightcheck)
player->starpostz = special->z>>FRACBITS;
player->starpostangle = special->angle;
player->starpostnum = special->health;
- player->starpostcount++;
//S_StartSound(toucher, special->info->painsound);
return;
@@ -2033,6 +2056,28 @@ boolean P_CheckRacers(void)
}
}
+ if (!countdown) // Check to see if the winners have finished, to set countdown.
+ {
+ UINT8 numingame = 0, numexiting = 0;
+ UINT8 winningpos = 1;
+
+ for (i = 0; i < MAXPLAYERS; i++)
+ {
+ if (!playeringame[i] || players[i].spectator)
+ continue;
+ numingame++;
+ if (players[i].exiting)
+ numexiting++;
+ }
+
+ winningpos = max(1, numingame/2);
+ if (numingame % 2) // any remainder?
+ winningpos++;
+
+ if (numexiting >= winningpos)
+ countdown = (((netgame || multiplayer) ? cv_countdowntime.value : 30)*TICRATE) + 1; // 30 seconds to finish, get going!
+ }
+
return false;
}
@@ -2907,7 +2952,8 @@ static void P_KillPlayer(player_t *player, mobj_t *source, INT32 damage)
}
}
-static inline void P_SuperDamage(player_t *player, mobj_t *inflictor, mobj_t *source, INT32 damage)
+/*
+static inline void P_SuperDamage(player_t *player, mobj_t *inflictor, mobj_t *source, INT32 damage) // SRB2kart - unused.
{
fixed_t fallbackspeed;
angle_t ang;
@@ -2953,11 +2999,10 @@ static inline void P_SuperDamage(player_t *player, mobj_t *inflictor, mobj_t *so
P_InstaThrust(player->mo, ang, fallbackspeed);
- /* // SRB2kart - This shouldn't be reachable, but this frame is invalid.
- if (player->charflags & SF_SUPERANIMS)
- P_SetPlayerMobjState(player->mo, S_PLAY_SUPERHIT);
- else
- */
+ // SRB2kart - This shouldn't be reachable, but this frame is invalid.
+ //if (player->charflags & SF_SUPERANIMS)
+ // P_SetPlayerMobjState(player->mo, S_PLAY_SUPERHIT);
+ //else
P_SetPlayerMobjState(player->mo, player->mo->info->painstate);
P_ResetPlayer(player);
@@ -2965,6 +3010,7 @@ static inline void P_SuperDamage(player_t *player, mobj_t *inflictor, mobj_t *so
if (player->timeshit != UINT8_MAX)
++player->timeshit;
}
+*/
void P_RemoveShield(player_t *player)
{
@@ -3230,6 +3276,11 @@ boolean P_DamageMobj(mobj_t *target, mobj_t *inflictor, mobj_t *source, INT32 da
return true;
}
+#ifdef HAVE_BLUA // Add this back here for ACTUAL NORMAL DAMAGE. The funny shit is that the player is barely ever "actually" damaged.
+ if (LUAh_MobjDamage(target, inflictor, source, damage))
+ return true;
+#endif
+
if (!force && inflictor && (inflictor->flags & MF_FIRE))
{
if ((player->powers[pw_shield] & SH_NOSTACK) == SH_ELEMENTAL)
@@ -3262,8 +3313,11 @@ boolean P_DamageMobj(mobj_t *target, mobj_t *inflictor, mobj_t *source, INT32 da
P_KillPlayer(player, source, damage);
else if (player->kartstuff[k_invincibilitytimer] > 0 || player->kartstuff[k_growshrinktimer] > 0 || player->powers[pw_flashing])
{
- K_DoInstashield(player);
- return false;
+ if (!force) // shoulddamage bypasses all of that.
+ {
+ K_DoInstashield(player);
+ return false;
+ }
}
else
{
@@ -3272,7 +3326,7 @@ boolean P_DamageMobj(mobj_t *target, mobj_t *inflictor, mobj_t *source, INT32 da
|| inflictor->type == MT_SMK_THWOMP || inflictor->player))
{
player->kartstuff[k_sneakertimer] = 0;
- K_SpinPlayer(player, source, 1, false);
+ K_SpinPlayer(player, source, 1, inflictor, false);
damage = player->mo->health - 1;
P_RingDamage(player, inflictor, source, damage);
P_PlayerRingBurst(player, 5);
@@ -3284,7 +3338,7 @@ boolean P_DamageMobj(mobj_t *target, mobj_t *inflictor, mobj_t *source, INT32 da
}
else
{
- K_SpinPlayer(player, source, 0, false);
+ K_SpinPlayer(player, source, 0, inflictor, false);
}
return true;
}
diff --git a/src/p_lights.c b/src/p_lights.c
index 8aa2eedc..2da38d1d 100644
--- a/src/p_lights.c
+++ b/src/p_lights.c
@@ -2,7 +2,7 @@
//-----------------------------------------------------------------------------
// Copyright (C) 1993-1996 by id Software, Inc.
// Copyright (C) 1998-2000 by DooM Legacy Team.
-// Copyright (C) 1999-2016 by Sonic Team Junior.
+// Copyright (C) 1999-2018 by Sonic Team Junior.
//
// This program is free software distributed under the
// terms of the GNU General Public License, version 2.
diff --git a/src/p_local.h b/src/p_local.h
index a5e10757..cf1387fe 100644
--- a/src/p_local.h
+++ b/src/p_local.h
@@ -2,7 +2,7 @@
//-----------------------------------------------------------------------------
// Copyright (C) 1993-1996 by id Software, Inc.
// Copyright (C) 1998-2000 by DooM Legacy Team.
-// Copyright (C) 1999-2016 by Sonic Team Junior.
+// Copyright (C) 1999-2018 by Sonic Team Junior.
//
// This program is free software distributed under the
// terms of the GNU General Public License, version 2.
@@ -41,9 +41,6 @@
// Convenience macro to fix issue with collision along bottom/left edges of blockmap -Red
#define BMBOUNDFIX(xl, xh, yl, yh) {if (xl > xh) xl = 0; if (yl > yh) yl = 0;}
-// player radius used only in am_map.c
-#define PLAYERRADIUS (16*FRACUNIT)
-
// MAXRADIUS is for precalculated sector block boxes
// the spider demon is larger,
// but we do not have any moving sectors nearby
@@ -131,7 +128,6 @@ extern fixed_t t_cam4_dist, t_cam4_height, t_cam4_rotate;
fixed_t P_GetPlayerHeight(player_t *player);
fixed_t P_GetPlayerSpinHeight(player_t *player);
-INT32 P_GetPlayerControlDirection(player_t *player);
void P_AddPlayerScore(player_t *player, UINT32 amount);
void P_ResetCamera(player_t *player, camera_t *thiscam);
boolean P_TryCameraMove(fixed_t x, fixed_t y, camera_t *thiscam);
diff --git a/src/p_map.c b/src/p_map.c
index aec6a036..c307e572 100644
--- a/src/p_map.c
+++ b/src/p_map.c
@@ -2,7 +2,7 @@
//-----------------------------------------------------------------------------
// Copyright (C) 1993-1996 by id Software, Inc.
// Copyright (C) 1998-2000 by DooM Legacy Team.
-// Copyright (C) 1999-2016 by Sonic Team Junior.
+// Copyright (C) 1999-2018 by Sonic Team Junior.
//
// This program is free software distributed under the
// terms of the GNU General Public License, version 2.
@@ -116,8 +116,8 @@ boolean P_TeleportMove(mobj_t *thing, fixed_t x, fixed_t y, fixed_t z)
boolean P_DoSpring(mobj_t *spring, mobj_t *object)
{
//INT32 pflags;
- const fixed_t hscale = mapheaderinfo[gamemap-1]->mobj_scale + (mapheaderinfo[gamemap-1]->mobj_scale - object->scale);
- const fixed_t vscale = mapheaderinfo[gamemap-1]->mobj_scale + (object->scale - mapheaderinfo[gamemap-1]->mobj_scale);
+ const fixed_t hscale = mapobjectscale + (mapobjectscale - object->scale);
+ const fixed_t vscale = mapobjectscale + (object->scale - mapobjectscale);
fixed_t offx, offy;
fixed_t vertispeed = spring->info->mass;
fixed_t horizspeed = spring->info->damage;
@@ -882,7 +882,7 @@ static boolean PIT_CheckThing(mobj_t *thing)
if (tmthing->state == &states[S_MINEEXPLOSION1])
K_ExplodePlayer(thing->player, tmthing->target, tmthing);
else
- K_SpinPlayer(thing->player, tmthing->target, 0, false);
+ K_SpinPlayer(thing->player, tmthing->target, 0, tmthing, false);
}
return true; // This doesn't collide with anything, but we want it to effect the player anyway.
@@ -915,7 +915,7 @@ static boolean PIT_CheckThing(mobj_t *thing)
if (thing->type == MT_PLAYER)
{
// Player Damage
- K_SpinPlayer(thing->player, tmthing->target, 0, (tmthing->type == MT_BANANA || tmthing->type == MT_BANANA_SHIELD));
+ K_SpinPlayer(thing->player, tmthing->target, 0, tmthing, (tmthing->type == MT_BANANA || tmthing->type == MT_BANANA_SHIELD));
// This Item Damage
if (tmthing->eflags & MFE_VERTICALFLIP)
@@ -1061,7 +1061,7 @@ static boolean PIT_CheckThing(mobj_t *thing)
return true;
// Player Damage
- K_SpinPlayer(tmthing->player, thing->target, 0, (thing->type == MT_BANANA || thing->type == MT_BANANA_SHIELD));
+ K_SpinPlayer(tmthing->player, thing->target, 0, tmthing, (thing->type == MT_BANANA || thing->type == MT_BANANA_SHIELD));
// Other Item Damage
if (thing->eflags & MFE_VERTICALFLIP)
@@ -1091,7 +1091,7 @@ static boolean PIT_CheckThing(mobj_t *thing)
if (thing->state == &states[S_MINEEXPLOSION1])
K_ExplodePlayer(tmthing->player, thing->target, thing);
else
- K_SpinPlayer(tmthing->player, thing->target, 0, false);
+ K_SpinPlayer(tmthing->player, thing->target, 0, tmthing, false);
return true;
}
@@ -1349,14 +1349,14 @@ static boolean PIT_CheckThing(mobj_t *thing)
// not (your direction) xor (stored direction)
// In other words, you can't u-turn and respawn rings near the drone.
if (pl->bonustime && (pl->pflags & PF_NIGHTSMODE) && (INT32)leveltime > droneobj->extravalue2 && (
- !(pl->anotherflyangle >= 90 && pl->anotherflyangle <= 270)
- ^ (droneobj->extravalue1 >= 90 && droneobj->extravalue1 <= 270)
+ !(pl->flyangle > 90 && pl->flyangle < 270)
+ ^ (droneobj->extravalue1 > 90 && droneobj->extravalue1 < 270)
))
{
// Reload all the fancy ring stuff!
P_ReloadRings();
}
- droneobj->extravalue1 = pl->anotherflyangle;
+ droneobj->extravalue1 = pl->flyangle;
droneobj->extravalue2 = (INT32)leveltime + TICRATE;
}*/
@@ -1423,11 +1423,11 @@ static boolean PIT_CheckThing(mobj_t *thing)
// Make sure they aren't able to damage you ANYWHERE along the Z axis, you have to be TOUCHING the person.
&& !(thing->z + thing->height < tmthing->z || thing->z > tmthing->z + tmthing->height))
{
-
- if (tmthing->scale > thing->scale + (FRACUNIT/8)) // SRB2kart - Handle squishes first!
- K_SquishPlayer(thing->player, tmthing);
- else if (thing->scale > tmthing->scale + (FRACUNIT/8))
- K_SquishPlayer(tmthing->player, thing);
+
+ if (tmthing->scale > thing->scale + (mapobjectscale/8)) // SRB2kart - Handle squishes first!
+ K_SquishPlayer(thing->player, tmthing, tmthing);
+ else if (thing->scale > tmthing->scale + (mapobjectscale/8))
+ K_SquishPlayer(tmthing->player, thing, tmthing);
else if (tmthing->player->kartstuff[k_invincibilitytimer] && !thing->player->kartstuff[k_invincibilitytimer]) // SRB2kart - Then invincibility!
P_DamageMobj(thing, tmthing, tmthing, 1);
else if (thing->player->kartstuff[k_invincibilitytimer] && !tmthing->player->kartstuff[k_invincibilitytimer])
@@ -1523,9 +1523,9 @@ static boolean PIT_CheckThing(mobj_t *thing)
return true; // underneath
if (thing->player->kartstuff[k_squishedtimer] || thing->player->kartstuff[k_hyudorotimer]
- || thing->player->kartstuff[k_justbumped] || thing->scale > tmthing->scale + (FRACUNIT/8)
+ || thing->player->kartstuff[k_justbumped] || thing->scale > tmthing->scale + (mapobjectscale/8)
|| tmthing->player->kartstuff[k_squishedtimer] || tmthing->player->kartstuff[k_hyudorotimer]
- || tmthing->player->kartstuff[k_justbumped] || tmthing->scale > thing->scale + (FRACUNIT/8))
+ || tmthing->player->kartstuff[k_justbumped] || tmthing->scale > thing->scale + (mapobjectscale/8))
{
return true;
}
@@ -1543,7 +1543,7 @@ static boolean PIT_CheckThing(mobj_t *thing)
if (G_BattleGametype() && tmthing->player->kartstuff[k_pogospring])
{
K_StealBumper(tmthing->player, thing->player, false);
- K_SpinPlayer(thing->player, tmthing, 0, false);
+ K_SpinPlayer(thing->player, tmthing, 0, tmthing, false);
}
}
else if (P_IsObjectOnGround(tmthing) && thing->momz < 0)
@@ -1552,7 +1552,7 @@ static boolean PIT_CheckThing(mobj_t *thing)
if (G_BattleGametype() && thing->player->kartstuff[k_pogospring])
{
K_StealBumper(thing->player, tmthing->player, false);
- K_SpinPlayer(tmthing->player, thing, 0, false);
+ K_SpinPlayer(tmthing->player, thing, 0, thing, false);
}
}
else
@@ -1563,12 +1563,12 @@ static boolean PIT_CheckThing(mobj_t *thing)
if (thing->player->kartstuff[k_sneakertimer] && !(tmthing->player->kartstuff[k_sneakertimer]))
{
K_StealBumper(thing->player, tmthing->player, false);
- K_SpinPlayer(tmthing->player, thing, 0, false);
+ K_SpinPlayer(tmthing->player, thing, 0, tmthing, false);
}
else if (tmthing->player->kartstuff[k_sneakertimer] && !(thing->player->kartstuff[k_sneakertimer]))
{
K_StealBumper(tmthing->player, thing->player, false);
- K_SpinPlayer(thing->player, tmthing, 0, false);
+ K_SpinPlayer(thing->player, tmthing, 0, thing, false);
}
}
@@ -1664,7 +1664,7 @@ static boolean PIT_CheckThing(mobj_t *thing)
// collide
if (tmthing->z < thing->z && thing->momz < 0)
- K_SquishPlayer(tmthing->player, thing);
+ K_SquishPlayer(tmthing->player, thing, thing);
else
{
if (thing->flags2 & MF2_AMBUSH)
@@ -2469,18 +2469,6 @@ boolean P_CheckCameraPosition(fixed_t x, fixed_t y, camera_t *thiscam)
return true;
}
-//
-// CheckMissileImpact
-//
-static void CheckMissileImpact(mobj_t *mobj)
-{
- if (!(mobj->flags & MF_MISSILE) || !mobj->target)
- return;
-
- if (!mobj->target->player)
- return;
-}
-
// The highest the camera will "step up" onto another floor.
#define MAXCAMERASTEPMOVE MAXSTEPMOVE
@@ -2713,16 +2701,12 @@ boolean P_TryMove(mobj_t *thing, fixed_t x, fixed_t y, boolean allowdropoff)
}
if (!P_CheckPosition(thing, tryx, tryy))
- {
- if (!P_MobjWasRemoved(thing))
- CheckMissileImpact(thing);
return false; // solid wall or thing
- }
if (!(thing->flags & MF_NOCLIP))
{
//All things are affected by their scale.
- fixed_t maxstep = FixedMul(MAXSTEPMOVE, mapheaderinfo[gamemap-1]->mobj_scale);
+ fixed_t maxstep = FixedMul(MAXSTEPMOVE, mapobjectscale);
if (thing->player)
{
@@ -2749,7 +2733,6 @@ boolean P_TryMove(mobj_t *thing, fixed_t x, fixed_t y, boolean allowdropoff)
if (tmceilingz - tmfloorz < thing->height)
{
- CheckMissileImpact(thing);
if (tmfloorthing)
tmhitthing = tmfloorthing;
return false; // doesn't fit
@@ -2760,16 +2743,10 @@ boolean P_TryMove(mobj_t *thing, fixed_t x, fixed_t y, boolean allowdropoff)
if (thing->eflags & MFE_VERTICALFLIP)
{
if (thing->z < tmfloorz)
- {
- CheckMissileImpact(thing);
return false; // mobj must raise itself to fit
- }
}
else if (tmceilingz < thingtop)
- {
- CheckMissileImpact(thing);
return false; // mobj must lower itself to fit
- }
// Ramp test
if (maxstep > 0 && !(
@@ -2817,7 +2794,6 @@ boolean P_TryMove(mobj_t *thing, fixed_t x, fixed_t y, boolean allowdropoff)
{
if (thingtop - tmceilingz > maxstep)
{
- CheckMissileImpact(thing);
if (tmfloorthing)
tmhitthing = tmfloorthing;
return false; // too big a step up
@@ -2825,18 +2801,11 @@ boolean P_TryMove(mobj_t *thing, fixed_t x, fixed_t y, boolean allowdropoff)
}
else if (tmfloorz - thing->z > maxstep)
{
- CheckMissileImpact(thing);
if (tmfloorthing)
tmhitthing = tmfloorthing;
return false; // too big a step up
}
- if (tmfloorz > thing->z)
- {
- if (thing->flags & MF_MISSILE)
- CheckMissileImpact(thing);
- }
-
if (!allowdropoff && !(thing->flags & MF_FLOAT) && thing->type != MT_SKIM && !tmfloorthing)
{
if (thing->eflags & MFE_VERTICALFLIP)
@@ -2940,7 +2909,7 @@ boolean P_SceneryTryMove(mobj_t *thing, fixed_t x, fixed_t y)
if (!(thing->flags & MF_NOCLIP))
{
- const fixed_t maxstep = FixedMul(MAXSTEPMOVE, mapheaderinfo[gamemap-1]->mobj_scale);
+ const fixed_t maxstep = FixedMul(MAXSTEPMOVE, mapobjectscale);
if (tmceilingz - tmfloorz < thing->height)
return false; // doesn't fit
@@ -3164,8 +3133,8 @@ static void P_PlayerHitBounceLine(line_t *ld)
movelen = P_AproxDistance(tmxmove, tmymove);
- if (slidemo->player && movelen < (15*mapheaderinfo[gamemap-1]->mobj_scale))
- movelen = (15*mapheaderinfo[gamemap-1]->mobj_scale);
+ if (slidemo->player && movelen < (15*mapobjectscale))
+ movelen = (15*mapobjectscale);
tmxmove += FixedMul(movelen, FINECOSINE(lineangle));
tmymove += FixedMul(movelen, FINESINE(lineangle));
@@ -3423,7 +3392,7 @@ static boolean PTR_SlideTraverse(intercept_t *in)
if (opentop - slidemo->z < slidemo->height)
goto isblocking; // mobj is too high
- if (openbottom - slidemo->z > FixedMul(MAXSTEPMOVE, mapheaderinfo[gamemap-1]->mobj_scale))
+ if (openbottom - slidemo->z > FixedMul(MAXSTEPMOVE, mapobjectscale))
goto isblocking; // too big a step up
// this line doesn't block movement
@@ -3840,11 +3809,12 @@ void P_BouncePlayerMove(mobj_t *mo)
fixed_t leadx, leady;
fixed_t trailx, traily;
fixed_t mmomx = 0, mmomy = 0;
+ fixed_t oldmomx = mo->momx, oldmomy = mo->momy;
if (!mo->player)
return;
- if ((mo->eflags & MFE_JUSTBOUNCEDWALL) || (mo->player->spectator))
+ if (mo->player->spectator)
{
P_SlideMove(mo, true);
return;
@@ -3855,16 +3825,9 @@ void P_BouncePlayerMove(mobj_t *mo)
mmomx = mo->player->rmomx;
mmomy = mo->player->rmomy;
- if (mo->player->kartstuff[k_drift] != 0) // SRB2kart
- {
- mo->player->kartstuff[k_drift] = 0;
- mo->player->kartstuff[k_driftcharge] = 0;
- }
- else
- {
- mmomx = mo->momx;
- mmomy = mo->momy;
- }
+ mo->player->kartstuff[k_drift] = 0;
+ mo->player->kartstuff[k_driftcharge] = 0;
+ mo->player->kartstuff[k_pogospring] = 0;
// trace along the three leading corners
if (mo->momx > 0)
@@ -3905,8 +3868,16 @@ void P_BouncePlayerMove(mobj_t *mo)
if (bestslidefrac <= 0)
return;
- tmxmove = FixedMul(mmomx, (FRACUNIT - (FRACUNIT>>2) - (FRACUNIT>>3)));
- tmymove = FixedMul(mmomy, (FRACUNIT - (FRACUNIT>>2) - (FRACUNIT>>3)));
+ if (mo->eflags & MFE_JUSTBOUNCEDWALL) // Stronger push-out
+ {
+ tmxmove = mmomx;
+ tmymove = mmomy;
+ }
+ else
+ {
+ tmxmove = FixedMul(mmomx, (FRACUNIT - (FRACUNIT>>2) - (FRACUNIT>>3)));
+ tmymove = FixedMul(mmomy, (FRACUNIT - (FRACUNIT>>2) - (FRACUNIT>>3)));
+ }
{
mobj_t *fx = P_SpawnMobj(mo->x, mo->y, mo->z, MT_BUMP);
@@ -3919,7 +3890,6 @@ void P_BouncePlayerMove(mobj_t *mo)
S_StartSound(mo, sfx_s3k49);
}
- mo->player->kartstuff[k_pogospring] = 0; // Cancel pogo spring effect so you aren't shoved forward back into the wall you just bounced off
P_PlayerHitBounceLine(bestslideline);
mo->eflags |= MFE_JUSTBOUNCEDWALL;
@@ -3928,7 +3898,9 @@ void P_BouncePlayerMove(mobj_t *mo)
mo->player->cmomx = tmxmove;
mo->player->cmomy = tmymove;
- P_TryMove(mo, mo->x + tmxmove, mo->y + tmymove, true);
+ if (!P_TryMove(mo, mo->x + tmxmove, mo->y + tmymove, true)) {
+ P_TryMove(mo, mo->x - oldmomx, mo->y - oldmomy, true);
+ }
}
//
@@ -3944,18 +3916,18 @@ void P_BounceMove(mobj_t *mo)
INT32 hitcount;
fixed_t mmomx = 0, mmomy = 0;
- if (mo->eflags & MFE_JUSTBOUNCEDWALL)
- {
- P_SlideMove(mo, true);
- return;
- }
-
if (mo->player)
{
P_BouncePlayerMove(mo);
return;
}
+ if (mo->eflags & MFE_JUSTBOUNCEDWALL)
+ {
+ P_SlideMove(mo, true);
+ return;
+ }
+
slidemo = mo;
hitcount = 0;
@@ -4270,7 +4242,7 @@ static boolean PIT_ChangeSector(mobj_t *thing, boolean realcrush)
if (!thing->player)
P_DamageMobj(thing, killer, killer, 10000);
else
- K_SquishPlayer(thing->player, killer); // SRB2kart - Squish instead of kill
+ K_SquishPlayer(thing->player, killer, killer); // SRB2kart - Squish instead of kill
}
}
}
diff --git a/src/p_maputl.c b/src/p_maputl.c
index 46b03338..1be57399 100644
--- a/src/p_maputl.c
+++ b/src/p_maputl.c
@@ -2,7 +2,7 @@
//-----------------------------------------------------------------------------
// Copyright (C) 1993-1996 by id Software, Inc.
// Copyright (C) 1998-2000 by DooM Legacy Team.
-// Copyright (C) 1999-2016 by Sonic Team Junior.
+// Copyright (C) 1999-2018 by Sonic Team Junior.
//
// This program is free software distributed under the
// terms of the GNU General Public License, version 2.
diff --git a/src/p_maputl.h b/src/p_maputl.h
index 3d74e927..1fcb68d4 100644
--- a/src/p_maputl.h
+++ b/src/p_maputl.h
@@ -1,7 +1,7 @@
// SONIC ROBO BLAST 2
//-----------------------------------------------------------------------------
// Copyright (C) 1998-2000 by DooM Legacy Team.
-// Copyright (C) 1999-2016 by Sonic Team Junior.
+// Copyright (C) 1999-2018 by Sonic Team Junior.
//
// This program is free software distributed under the
// terms of the GNU General Public License, version 2.
diff --git a/src/p_mobj.c b/src/p_mobj.c
index 585bd016..f71ff209 100644
--- a/src/p_mobj.c
+++ b/src/p_mobj.c
@@ -2,7 +2,7 @@
//-----------------------------------------------------------------------------
// Copyright (C) 1993-1996 by id Software, Inc.
// Copyright (C) 1998-2000 by DooM Legacy Team.
-// Copyright (C) 1999-2016 by Sonic Team Junior.
+// Copyright (C) 1999-2018 by Sonic Team Junior.
//
// This program is free software distributed under the
// terms of the GNU General Public License, version 2.
@@ -1413,6 +1413,9 @@ fixed_t P_GetMobjGravity(mobj_t *mo)
case MT_SIGN:
gravityadd /= 8;
break;
+ case MT_KARMAFIREWORK:
+ gravityadd /= 3;
+ break;
default:
break;
}
@@ -1741,7 +1744,7 @@ void P_XYMovement(mobj_t *mo)
}
else
{
- if (mo->scale < mapheaderinfo[gamemap-1]->mobj_scale/16)
+ if (mo->scale < mapobjectscale/16)
{
P_RemoveMobj(mo);
return;
@@ -1938,7 +1941,9 @@ void P_XYMovement(mobj_t *mo)
FIXED_TO_FLOAT(AngleFixed(newangle)),
FIXED_TO_FLOAT(AngleFixed(oldangle-newangle))
);*/
- } else if (predictedz-mo->z > abs(slopemom.z/2)) { // Now check if we were supposed to stick to this slope
+ // Sryder 2018-11-26: Don't launch here if it's a slope without physics, we stick to those like glue anyway
+ } else if (predictedz-mo->z > abs(slopemom.z/2)
+ && !(mo->standingslope->flags & SL_NOPHYSICS)) { // Now check if we were supposed to stick to this slope
//CONS_Printf("%d-%d > %d\n", (predictedz), (mo->z), (slopemom.z/2));
P_SlopeLaunch(mo);
}
@@ -2523,7 +2528,7 @@ static boolean P_ZMovement(mobj_t *mo)
if (P_MobjFlip(mo)*mom.z < 0)
{
// If going slower than a fracunit, just stop.
- if (abs(mom.z) < FixedMul(FRACUNIT, mo->scale))
+ if (abs(mom.z) < mo->scale)
{
mom.x = mom.y = mom.z = 0;
@@ -3670,7 +3675,7 @@ boolean P_CameraThinker(player_t *player, camera_t *thiscam, boolean resetcalled
postimg = postimg_mirror;
else if (player->pflags & PF_FLIPCAM && !(player->pflags & PF_NIGHTSMODE) && player->mo->eflags & MFE_VERTICALFLIP)
postimg = postimg_flip;
- else if (player->awayviewtics && player->awayviewmobj != NULL) // Camera must obviously exist
+ else if (player->awayviewtics && player->awayviewmobj && !P_MobjWasRemoved(player->awayviewmobj)) // Camera must obviously exist
{
camera_t dummycam;
dummycam.subsector = player->awayviewmobj->subsector;
@@ -6357,7 +6362,7 @@ void P_RunShadows(void)
}
if (mobj->target->type == MT_FLOATINGITEM)
- P_SetScale(mobj, mobj->scale/2);
+ P_SetScale(mobj, mobj->scale/3);
}
P_SetTarget(&shadowcap, NULL);
}
@@ -6832,6 +6837,18 @@ void P_MobjThinker(mobj_t *mobj)
P_SetScale(mobj->tracer, (mobj->tracer->destscale = mobj->scale));
}
+ // Do this in an easy way
+ if (mobj->target->player->kartstuff[k_itemroulette])
+ {
+ mobj->tracer->color = mobj->target->player->skincolor;
+ mobj->tracer->colorized = true;
+ }
+ else
+ {
+ mobj->tracer->color = SKINCOLOR_NONE;
+ mobj->tracer->colorized = false;
+ }
+
if (!(mobj->flags2 & MF2_DONTDRAW))
{
const INT32 numberdisplaymin = ((mobj->target->player->kartstuff[k_itemtype] == KITEM_ORBINAUT) ? 5 : 2);
@@ -7193,23 +7210,24 @@ void P_MobjThinker(mobj_t *mobj)
}
break;
case MT_FIREDITEM:
- {
- fixed_t x, y, z;
- if (mobj->movecount)
+ if (mobj->target && !P_MobjWasRemoved(mobj->target))
{
- x = mobj->target->x + P_ReturnThrustX(mobj->target, mobj->target->angle + mobj->movedir, mobj->target->radius + mobj->radius);
- y = mobj->target->y + P_ReturnThrustY(mobj->target, mobj->target->angle + mobj->movedir, mobj->target->radius + mobj->radius);
- z = mobj->target->z + mobj->target->height/3;
+ fixed_t x, y, z;
+ if (mobj->movecount)
+ {
+ x = mobj->target->x + P_ReturnThrustX(mobj->target, mobj->target->angle + mobj->movedir, mobj->target->radius + mobj->radius);
+ y = mobj->target->y + P_ReturnThrustY(mobj->target, mobj->target->angle + mobj->movedir, mobj->target->radius + mobj->radius);
+ z = mobj->target->z + mobj->target->height/3;
+ }
+ else
+ {
+ x = mobj->target->x;
+ y = mobj->target->y;
+ z = mobj->target->z + (80*mapobjectscale);
+ }
+ P_TeleportMove(mobj, x, y, z);
}
- else
- {
- x = mobj->target->x;
- y = mobj->target->y;
- z = mobj->target->z + 80*(mapheaderinfo[gamemap-1]->mobj_scale);
- }
- P_TeleportMove(mobj, x, y, z);
break;
- }
default:
if (mobj->fuse)
{ // Scenery object fuse! Very basic!
@@ -7423,10 +7441,10 @@ void P_MobjThinker(mobj_t *mobj)
break;
case MT_SSMINE:
case MT_SPBEXPLOSION:
- if (mobj->health > -100)
+ if (mobj->extravalue2 != -100)
{
P_SetMobjState(mobj, mobj->info->deathstate);
- mobj->health = -100;
+ mobj->extravalue2 = -100;
}
else
{
@@ -7872,7 +7890,7 @@ void P_MobjThinker(mobj_t *mobj)
else
{
mobj->flags &= ~MF_NOGRAVITY;
- if (mobj->z > mobj->watertop && mobj->z - mobj->watertop < FixedMul(MAXSTEPMOVE, mapheaderinfo[gamemap-1]->mobj_scale))
+ if (mobj->z > mobj->watertop && mobj->z - mobj->watertop < FixedMul(MAXSTEPMOVE, mapobjectscale))
mobj->z = mobj->watertop;
}
break;
@@ -7922,7 +7940,12 @@ void P_MobjThinker(mobj_t *mobj)
{
if (mobj->flags & MF_NOCLIPTHING)
{
- if (P_IsObjectOnGround(mobj))
+ if (P_CheckDeathPitCollide(mobj))
+ {
+ P_RemoveMobj(mobj);
+ return;
+ }
+ else if (P_IsObjectOnGround(mobj))
{
mobj->momx = 1;
mobj->momy = 0;
@@ -7936,7 +7959,7 @@ void P_MobjThinker(mobj_t *mobj)
if (mobj->flags2 & MF2_NIGHTSPULL)
{
if (!mobj->tracer || !mobj->tracer->health
- || mobj->scale <= mapheaderinfo[gamemap-1]->mobj_scale>>4)
+ || mobj->scale <= mapobjectscale>>4)
{
P_RemoveMobj(mobj);
return;
@@ -7945,7 +7968,7 @@ void P_MobjThinker(mobj_t *mobj)
}
else
{
- fixed_t adj = FixedMul(FRACUNIT - FINECOSINE((mobj->movedir>>ANGLETOFINESHIFT) & FINEMASK), (mapheaderinfo[gamemap-1]->mobj_scale<<3));
+ fixed_t adj = FixedMul(FRACUNIT - FINECOSINE((mobj->movedir>>ANGLETOFINESHIFT) & FINEMASK), (mapobjectscale<<3));
mobj->movedir += 2*ANG2;
if (mobj->eflags & MFE_VERTICALFLIP)
mobj->z = mobj->ceilingz - mobj->height - adj;
@@ -7968,11 +7991,15 @@ void P_MobjThinker(mobj_t *mobj)
mobj->sprite = SPR_ITEM;
mobj->frame = FF_FULLBRIGHT|FF_PAPERSPRITE;
break;
+ case KITEM_SPB:
+ case KITEM_SHRINK:
+ indirectitemcooldown = 20*TICRATE;
+ /* FALLTHRU */
default:
mobj->sprite = SPR_ITEM;
mobj->frame = FF_FULLBRIGHT|FF_PAPERSPRITE|(mobj->threshold);
break;
- }
+ }
break;
}
case MT_ORBINAUT:
@@ -7998,15 +8025,10 @@ void P_MobjThinker(mobj_t *mobj)
}
else
{
- fixed_t finalspeed = mobj->info->speed;
+ fixed_t finalspeed = mobj->movefactor;
P_SpawnGhostMobj(mobj);
- if (gamespeed == 0)
- finalspeed = FixedMul(finalspeed, FRACUNIT-FRACUNIT/4);
- else if (gamespeed == 2)
- finalspeed = FixedMul(finalspeed, FRACUNIT+FRACUNIT/4);
-
mobj->angle = R_PointToAngle2(0, 0, mobj->momx, mobj->momy);
if (mobj->health <= 5)
{
@@ -8014,7 +8036,7 @@ void P_MobjThinker(mobj_t *mobj)
for (i = 5; i >= mobj->health; i--)
finalspeed = FixedMul(finalspeed, FRACUNIT-FRACUNIT/4);
}
- finalspeed = FixedMul(finalspeed, mapheaderinfo[gamemap-1]->mobj_scale);
+
P_InstaThrust(mobj, mobj->angle, finalspeed);
if (grounded)
@@ -8037,8 +8059,8 @@ void P_MobjThinker(mobj_t *mobj)
case MT_JAWZ:
{
sector_t *sec2;
- fixed_t topspeed = 64*FRACUNIT;
- fixed_t distbarrier = 512*FRACUNIT;
+ fixed_t topspeed = mobj->movefactor;
+ fixed_t distbarrier = 512*mapobjectscale;
fixed_t distaway;
P_SpawnGhostMobj(mobj);
@@ -8049,18 +8071,9 @@ void P_MobjThinker(mobj_t *mobj)
S_StartSound(mobj, mobj->info->activesound);
if (gamespeed == 0)
- {
- topspeed = FixedMul(topspeed, FRACUNIT-FRACUNIT/4);
distbarrier = FixedMul(distbarrier, FRACUNIT-FRACUNIT/4);
- }
else if (gamespeed == 2)
- {
- topspeed = FixedMul(topspeed, FRACUNIT+FRACUNIT/4);
distbarrier = FixedMul(distbarrier, FRACUNIT+FRACUNIT/4);
- }
-
- distbarrier = FixedMul(distbarrier, mapheaderinfo[gamemap-1]->mobj_scale);
- topspeed = FixedMul(topspeed, mapheaderinfo[gamemap-1]->mobj_scale);
if (G_RaceGametype() && mobj->tracer)
{
@@ -8119,7 +8132,7 @@ void P_MobjThinker(mobj_t *mobj)
{
P_SpawnGhostMobj(mobj);
mobj->angle = R_PointToAngle2(0, 0, mobj->momx, mobj->momy);
- P_InstaThrust(mobj, mobj->angle, mobj->info->speed);
+ P_InstaThrust(mobj, mobj->angle, mobj->movefactor);
if (grounded)
{
@@ -8463,7 +8476,7 @@ void P_MobjThinker(mobj_t *mobj)
// Give items an item-sized hitbox
if (mobj->target->player->kartstuff[k_comebackmode] == 1)
- mobj->radius = 36*mobj->target->scale;
+ mobj->radius = 48*mobj->target->scale;
else
mobj->radius = 24*mobj->target->scale;
mobj->height = 2*mobj->radius;
@@ -8599,7 +8612,9 @@ void P_MobjThinker(mobj_t *mobj)
if (!S_SoundPlaying(mobj, mobj->info->attacksound))
S_StartSound(mobj, mobj->info->attacksound);
- if (mobj->extravalue2 > 70) // fire + smoke pillar
+ if (mobj->extravalue2 <= 8) // Short delay
+ mobj->extravalue2++; // flametimer
+ else // fire + smoke pillar
{
UINT8 i;
mobj_t *fire = P_SpawnMobj(mobj->x + (P_RandomRange(-32, 32)*mobj->scale), mobj->y + (P_RandomRange(-32, 32)*mobj->scale), mobj->z, MT_THOK);
@@ -8623,20 +8638,6 @@ void P_MobjThinker(mobj_t *mobj)
smoke->scalespeed = mobj->scale/24;
}
}
- else
- {
- mobj->extravalue2++; // flametimer
-
- if (mobj->extravalue2 > 8)
- {
- mobj_t *smoke = P_SpawnMobj(mobj->x + (P_RandomRange(-31, 31)*mobj->scale), mobj->y + (P_RandomRange(-31, 31)*mobj->scale),
- mobj->z + (P_RandomRange(0, 48)*mobj->scale), MT_THOK);
-
- P_SetMobjState(smoke, S_FZEROSMOKE1);
- smoke->tics += P_RandomRange(-3, 4);
- smoke->scale = mobj->scale*2;
- }
- }
break;
case MT_EZZPROPELLER:
if (mobj->hnext)
@@ -8831,7 +8832,7 @@ void P_MobjThinker(mobj_t *mobj)
mobj_t *head = P_SpawnMobj(mobj->x, mobj->y, mobj->z, (blue ? MT_BLUEROBRA_HEAD : MT_ROBRA_HEAD));
P_SetTarget(&mobj->tracer, head);
- mobj->destscale = mapheaderinfo[gamemap-1]->mobj_scale;
+ mobj->destscale = mapobjectscale;
P_SetTarget(&mobj->tracer->target, mobj->target);
P_SetTarget(&mobj->tracer->tracer, mobj);
mobj->tracer->extravalue2 = mobj->extravalue2;
@@ -9081,6 +9082,22 @@ void P_MobjThinker(mobj_t *mobj)
}
}
break;
+ case MT_KARMAFIREWORK:
+ if (mobj->momz == 0)
+ {
+ P_RemoveMobj(mobj);
+ return;
+ }
+ else
+ {
+ mobj_t *trail = P_SpawnMobj(mobj->x, mobj->y, mobj->z, MT_THOK);
+ P_SetMobjState(trail, S_KARMAFIREWORKTRAIL);
+ P_SetScale(trail, mobj->scale);
+ trail->destscale = 1;
+ trail->scalespeed = mobj->scale/12;
+ trail->color = mobj->color;
+ }
+ break;
//}
case MT_TURRET:
P_MobjCheckWater(mobj);
@@ -9265,6 +9282,8 @@ void P_MobjThinker(mobj_t *mobj)
// Assumedly in splitscreen players will be on opposing teams
if (players[consoleplayer].ctfteam == 1 || splitscreen)
S_StartSound(NULL, sfx_hoop1);
+ else if (players[consoleplayer].ctfteam == 2)
+ S_StartSound(NULL, sfx_hoop3);
redflag = flagmo;
}
@@ -9276,6 +9295,8 @@ void P_MobjThinker(mobj_t *mobj)
// Assumedly in splitscreen players will be on opposing teams
if (players[consoleplayer].ctfteam == 2 || splitscreen)
S_StartSound(NULL, sfx_hoop1);
+ else if (players[consoleplayer].ctfteam == 1)
+ S_StartSound(NULL, sfx_hoop3);
blueflag = flagmo;
}
@@ -9741,10 +9762,13 @@ mobj_t *P_SpawnMobj(fixed_t x, fixed_t y, fixed_t z, mobjtype_t type)
// All mobjs are created at 100% scale.
mobj->scale = FRACUNIT;
mobj->destscale = mobj->scale;
- mobj->scalespeed = mapheaderinfo[gamemap-1]->mobj_scale/12;
+ mobj->scalespeed = FRACUNIT/12;
- if (mapheaderinfo[gamemap-1] && mapheaderinfo[gamemap-1]->mobj_scale != FRACUNIT) //&& !(mobj->type == MT_BLACKEGGMAN)
- mobj->destscale = mapheaderinfo[gamemap-1]->mobj_scale;
+ if (mapobjectscale != FRACUNIT) //&& !(mobj->type == MT_BLACKEGGMAN)
+ {
+ mobj->destscale = mapobjectscale;
+ mobj->scalespeed = mapobjectscale/12;
+ }
// set subsector and/or block links
P_SetThingPosition(mobj);
@@ -10188,10 +10212,13 @@ mobj_t *P_SpawnShadowMobj(mobj_t * caster)
// All mobjs are created at 100% scale.
mobj->scale = FRACUNIT;
mobj->destscale = mobj->scale;
- mobj->scalespeed = mapheaderinfo[gamemap-1]->mobj_scale/12;
+ mobj->scalespeed = FRACUNIT/12;
- if (mapheaderinfo[gamemap-1] && mapheaderinfo[gamemap-1]->mobj_scale != FRACUNIT) //&& !(mobj->type == MT_BLACKEGGMAN)
- mobj->destscale = mapheaderinfo[gamemap-1]->mobj_scale;
+ if (mapobjectscale != FRACUNIT) //&& !(mobj->type == MT_BLACKEGGMAN)
+ {
+ mobj->destscale = mapobjectscale;
+ mobj->scalespeed = mapobjectscale/12;
+ }
P_SetScale(mobj, mobj->destscale);
@@ -10378,6 +10405,9 @@ void P_RemoveMobj(mobj_t *mobj)
if (mobj->type == MT_SHADOW)
P_RemoveShadow(mobj);
+ if (mobj->type == MT_SPB)
+ spbplace = -1;
+
mobj->health = 0; // Just because
// unlink from sector and block lists
@@ -11094,7 +11124,7 @@ void P_MovePlayerToSpawn(INT32 playernum, mapthing_t *mthing)
if (mthing->options >> ZSHIFT)
z -= ((mthing->options >> ZSHIFT) << FRACBITS);
if (p->kartstuff[k_respawn])
- z -= 128*FRACUNIT; // Too late for v1, but for later: 128*mapheaderinfo[gamemap-1]->mobj_scale;
+ z -= 128*FRACUNIT; // Too late for v1, but for later: 128*mapobjectscale;
}
else
{
@@ -11102,7 +11132,7 @@ void P_MovePlayerToSpawn(INT32 playernum, mapthing_t *mthing)
if (mthing->options >> ZSHIFT)
z += ((mthing->options >> ZSHIFT) << FRACBITS);
if (p->kartstuff[k_respawn])
- z += 128*FRACUNIT; // Too late for v1, but for later: 128*mapheaderinfo[gamemap-1]->mobj_scale;
+ z += 128*FRACUNIT; // Too late for v1, but for later: 128*mapobjectscale;
}
if (mthing->options & MTF_OBJECTFLIP) // flip the player!
@@ -11876,6 +11906,7 @@ ML_NOCLIMB : Direction not controllable
else if (i == MT_BOSS3WAYPOINT) // SRB2kart 120217 - Used to store checkpoint num
{
mobj->health = mthing->angle;
+ mobj->movecount = mthing->extrainfo;
P_SetTarget(&mobj->tracer, waypointcap);
P_SetTarget(&waypointcap, mobj);
}
diff --git a/src/p_mobj.h b/src/p_mobj.h
index 640b7dbb..dfc8fc73 100644
--- a/src/p_mobj.h
+++ b/src/p_mobj.h
@@ -2,7 +2,7 @@
//-----------------------------------------------------------------------------
// Copyright (C) 1993-1996 by id Software, Inc.
// Copyright (C) 1998-2000 by DooM Legacy Team.
-// Copyright (C) 1999-2016 by Sonic Team Junior.
+// Copyright (C) 1999-2018 by Sonic Team Junior.
//
// This program is free software distributed under the
// terms of the GNU General Public License, version 2.
diff --git a/src/p_polyobj.c b/src/p_polyobj.c
index 9e670ecb..34402f1a 100644
--- a/src/p_polyobj.c
+++ b/src/p_polyobj.c
@@ -1,7 +1,7 @@
// SONIC ROBO BLAST 2
//-----------------------------------------------------------------------------
// Copyright (C) 2006 by James Haley
-// Copyright (C) 2006-2016 by Sonic Team Junior.
+// Copyright (C) 2006-2018 by Sonic Team Junior.
//
// This program is free software distributed under the
// terms of the GNU General Public License, version 2.
@@ -1863,6 +1863,9 @@ void T_PolyObjWaypoint(polywaypoint_t *th)
diffz = po->lines[0]->backsector->floorheight - (target->z - amtz);
po->lines[0]->backsector->floorheight = target->z - amtz;
po->lines[0]->backsector->ceilingheight = target->z + amtz;
+ // Sal: Remember to check your sectors!
+ P_CheckSector(po->lines[0]->frontsector, (boolean)(po->damage));
+ P_CheckSector(po->lines[0]->backsector, (boolean)(po->damage));
// Apply action to mirroring polyobjects as well
start = 0;
while ((po = Polyobj_GetChild(oldpo, &start)))
@@ -1874,6 +1877,9 @@ void T_PolyObjWaypoint(polywaypoint_t *th)
// TODO: use T_MovePlane
po->lines[0]->backsector->floorheight += diffz; // move up/down by same amount as the parent did
po->lines[0]->backsector->ceilingheight += diffz;
+ // Sal: Remember to check your sectors!
+ P_CheckSector(po->lines[0]->frontsector, (boolean)(po->damage));
+ P_CheckSector(po->lines[0]->backsector, (boolean)(po->damage));
}
po = oldpo;
@@ -2034,6 +2040,9 @@ void T_PolyObjWaypoint(polywaypoint_t *th)
// TODO: use T_MovePlane
po->lines[0]->backsector->floorheight += momz;
po->lines[0]->backsector->ceilingheight += momz;
+ // Sal: Remember to check your sectors!
+ P_CheckSector(po->lines[0]->frontsector, (boolean)(po->damage)); // frontsector is NEEDED for crushing
+ P_CheckSector(po->lines[0]->backsector, (boolean)(po->damage)); // backsector may not be necessary, but just in case
// Apply action to mirroring polyobjects as well
start = 0;
@@ -2046,6 +2055,9 @@ void T_PolyObjWaypoint(polywaypoint_t *th)
// TODO: use T_MovePlane
po->lines[0]->backsector->floorheight += momz;
po->lines[0]->backsector->ceilingheight += momz;
+ // Sal: Remember to check your sectors!
+ P_CheckSector(po->lines[0]->frontsector, (boolean)(po->damage));
+ P_CheckSector(po->lines[0]->backsector, (boolean)(po->damage));
}
}
diff --git a/src/p_polyobj.h b/src/p_polyobj.h
index 605215c0..60e996ca 100644
--- a/src/p_polyobj.h
+++ b/src/p_polyobj.h
@@ -1,7 +1,7 @@
// SONIC ROBO BLAST 2
//-----------------------------------------------------------------------------
// Copyright (C) 2006 by James Haley
-// Copyright (C) 2006-2016 by Sonic Team Junior.
+// Copyright (C) 2006-2018 by Sonic Team Junior.
//
// This program is free software distributed under the
// terms of the GNU General Public License, version 2.
diff --git a/src/p_pspr.h b/src/p_pspr.h
index c0064bc3..e7426600 100644
--- a/src/p_pspr.h
+++ b/src/p_pspr.h
@@ -2,7 +2,7 @@
//-----------------------------------------------------------------------------
// Copyright (C) 1993-1996 by id Software, Inc.
// Copyright (C) 1998-2000 by DooM Legacy Team.
-// Copyright (C) 1999-2016 by Sonic Team Junior.
+// Copyright (C) 1999-2018 by Sonic Team Junior.
//
// This program is free software distributed under the
// terms of the GNU General Public License, version 2.
diff --git a/src/p_saveg.c b/src/p_saveg.c
index 1b4314b8..975a4a5d 100644
--- a/src/p_saveg.c
+++ b/src/p_saveg.c
@@ -2,7 +2,7 @@
//-----------------------------------------------------------------------------
// Copyright (C) 1993-1996 by id Software, Inc.
// Copyright (C) 1998-2000 by DooM Legacy Team.
-// Copyright (C) 1999-2016 by Sonic Team Junior.
+// Copyright (C) 1999-2018 by Sonic Team Junior.
//
// This program is free software distributed under the
// terms of the GNU General Public License, version 2.
@@ -198,7 +198,6 @@ static void P_NetArchivePlayers(void)
WRITEINT16(save_p, players[i].starposty);
WRITEINT16(save_p, players[i].starpostz);
WRITEINT32(save_p, players[i].starpostnum);
- WRITEINT32(save_p, players[i].starpostcount);
WRITEANGLE(save_p, players[i].starpostangle);
WRITEANGLE(save_p, players[i].angle_pos);
@@ -283,6 +282,12 @@ static void P_NetArchivePlayers(void)
WRITEUINT8(save_p, players[i].accelstart);
WRITEUINT8(save_p, players[i].acceleration);
WRITEFIXED(save_p, players[i].jumpfactor);
+
+ for (j = 0; j < MAXPREDICTTICS; j++)
+ {
+ WRITEINT16(save_p, players[i].lturn_max[j]);
+ WRITEINT16(save_p, players[i].rturn_max[j]);
+ }
}
}
@@ -382,7 +387,6 @@ static void P_NetUnArchivePlayers(void)
players[i].starposty = READINT16(save_p);
players[i].starpostz = READINT16(save_p);
players[i].starpostnum = READINT32(save_p);
- players[i].starpostcount = READINT32(save_p);
players[i].starpostangle = READANGLE(save_p);
players[i].angle_pos = READANGLE(save_p);
@@ -458,6 +462,12 @@ static void P_NetUnArchivePlayers(void)
players[i].accelstart = READUINT8(save_p);
players[i].acceleration = READUINT8(save_p);
players[i].jumpfactor = READFIXED(save_p);
+
+ for (j = 0; j < MAXPREDICTTICS; j++)
+ {
+ players[i].lturn_max[j] = READINT16(save_p);
+ players[i].rturn_max[j] = READINT16(save_p);
+ }
}
}
@@ -507,16 +517,34 @@ static void P_NetArchiveWorld(void)
UINT8 *put;
// reload the map just to see difference
- const mapsector_t *ms;
- const mapsidedef_t *msd;
- const maplinedef_t *mld;
+ mapsector_t *ms;
+ mapsidedef_t *msd;
+ maplinedef_t *mld;
const sector_t *ss = sectors;
UINT8 diff, diff2;
WRITEUINT32(save_p, ARCHIVEBLOCK_WORLD);
put = save_p;
- ms = W_CacheLumpNum(lastloadedmaplumpnum+ML_SECTORS, PU_CACHE);
+ if (W_IsLumpWad(lastloadedmaplumpnum)) // welp it's a map wad in a pk3
+ { // HACK: Open wad file rather quickly so we can get the data from the relevant lumps
+ UINT8 *wadData = W_CacheLumpNum(lastloadedmaplumpnum, PU_STATIC);
+ filelump_t *fileinfo = (filelump_t *)(wadData + ((wadinfo_t *)wadData)->infotableofs);
+#define retrieve_mapdata(d, f)\
+ d = Z_Malloc((f)->size, PU_CACHE, NULL); \
+ M_Memcpy(d, wadData + (f)->filepos, (f)->size)
+ retrieve_mapdata(ms, fileinfo + ML_SECTORS);
+ retrieve_mapdata(mld, fileinfo + ML_LINEDEFS);
+ retrieve_mapdata(msd, fileinfo + ML_SIDEDEFS);
+#undef retrieve_mapdata
+ Z_Free(wadData); // we're done with this now
+ }
+ else // phew it's just a WAD
+ {
+ ms = W_CacheLumpNum(lastloadedmaplumpnum+ML_SECTORS, PU_CACHE);
+ mld = W_CacheLumpNum(lastloadedmaplumpnum+ML_LINEDEFS, PU_CACHE);
+ msd = W_CacheLumpNum(lastloadedmaplumpnum+ML_SIDEDEFS, PU_CACHE);
+ }
for (i = 0; i < numsectors; i++, ss++, ms++)
{
@@ -1116,7 +1144,7 @@ static void SaveMobjThinker(const thinker_t *th, const UINT8 type)
diff |= MD_SCALE;
if (mobj->destscale != mobj->scale)
diff |= MD_DSCALE;
- if (mobj->scalespeed != mapheaderinfo[gamemap-1]->mobj_scale/12)
+ if (mobj->scalespeed != mapobjectscale/12)
diff2 |= MD2_SCALESPEED;
if (mobj == redflag)
@@ -2123,7 +2151,7 @@ static void LoadMobjThinker(actionf_p1 thinker)
if (diff2 & MD2_SCALESPEED)
mobj->scalespeed = READFIXED(save_p);
else
- mobj->scalespeed = mapheaderinfo[gamemap-1]->mobj_scale/12;
+ mobj->scalespeed = mapobjectscale/12;
if (diff2 & MD2_CUSVAL)
mobj->cusval = READINT32(save_p);
if (diff2 & MD2_CVMEM)
@@ -3266,6 +3294,7 @@ static void P_NetArchiveMisc(void)
WRITEUINT32(save_p, countdown2);
WRITEFIXED(save_p, gravity);
+ WRITEFIXED(save_p, mapobjectscale);
WRITEUINT32(save_p, countdowntimer);
WRITEUINT8(save_p, countdowntimeup);
@@ -3287,6 +3316,7 @@ static void P_NetArchiveMisc(void)
WRITEUINT32(save_p, mapreset);
WRITEUINT8(save_p, nospectategrief);
WRITEUINT8(save_p, thwompsactive);
+ WRITESINT8(save_p, spbplace);
// Is it paused?
if (paused)
@@ -3372,6 +3402,7 @@ static inline boolean P_NetUnArchiveMisc(void)
countdown2 = READUINT32(save_p);
gravity = READFIXED(save_p);
+ mapobjectscale = READFIXED(save_p);
countdowntimer = (tic_t)READUINT32(save_p);
countdowntimeup = (boolean)READUINT8(save_p);
@@ -3393,6 +3424,7 @@ static inline boolean P_NetUnArchiveMisc(void)
mapreset = READUINT32(save_p);
nospectategrief = READUINT8(save_p);
thwompsactive = (boolean)READUINT8(save_p);
+ spbplace = READSINT8(save_p);
// Is it paused?
if (READUINT8(save_p) == 0x2f)
diff --git a/src/p_saveg.h b/src/p_saveg.h
index 3670d350..0992f118 100644
--- a/src/p_saveg.h
+++ b/src/p_saveg.h
@@ -2,7 +2,7 @@
//-----------------------------------------------------------------------------
// Copyright (C) 1993-1996 by id Software, Inc.
// Copyright (C) 1998-2000 by DooM Legacy Team.
-// Copyright (C) 1999-2016 by Sonic Team Junior.
+// Copyright (C) 1999-2018 by Sonic Team Junior.
//
// This program is free software distributed under the
// terms of the GNU General Public License, version 2.
diff --git a/src/p_setup.c b/src/p_setup.c
index 68cdc797..49b22184 100644
--- a/src/p_setup.c
+++ b/src/p_setup.c
@@ -2,7 +2,7 @@
//-----------------------------------------------------------------------------
// Copyright (C) 1993-1996 by id Software, Inc.
// Copyright (C) 1998-2000 by DooM Legacy Team.
-// Copyright (C) 1999-2016 by Sonic Team Junior.
+// Copyright (C) 1999-2018 by Sonic Team Junior.
//
// This program is free software distributed under the
// terms of the GNU General Public License, version 2.
@@ -229,6 +229,8 @@ static void P_ClearSingleMapHeaderInfo(INT16 i)
mapheaderinfo[num]->levelselect = 0;
DEH_WriteUndoline("BONUSTYPE", va("%d", mapheaderinfo[num]->bonustype), UNDO_NONE);
mapheaderinfo[num]->bonustype = 0;
+ DEH_WriteUndoline("SAVEOVERRIDE", va("%d", mapheaderinfo[num]->saveoverride), UNDO_NONE);
+ mapheaderinfo[num]->saveoverride = SAVE_DEFAULT;
DEH_WriteUndoline("LEVELFLAGS", va("%d", mapheaderinfo[num]->levelflags), UNDO_NONE);
mapheaderinfo[num]->levelflags = 0;
DEH_WriteUndoline("MENUFLAGS", va("%d", mapheaderinfo[num]->menuflags), UNDO_NONE);
@@ -363,16 +365,13 @@ UINT32 P_GetScoreForGrade(INT16 map, UINT8 mare, UINT8 grade)
* \param lump VERTEXES lump number.
* \sa ML_VERTEXES
*/
-static inline void P_LoadVertexes(lumpnum_t lumpnum)
+
+static inline void P_LoadRawVertexes(UINT8 *data, size_t i)
{
- UINT8 *data;
- size_t i;
mapvertex_t *ml;
vertex_t *li;
- // Determine number of lumps:
- // total lump length / vertex record length.
- numvertexes = W_LumpLength(lumpnum) / sizeof (mapvertex_t);
+ numvertexes = i / sizeof (mapvertex_t);
if (numvertexes <= 0)
I_Error("Level has no vertices"); // instead of crashing
@@ -380,9 +379,6 @@ static inline void P_LoadVertexes(lumpnum_t lumpnum)
// Allocate zone memory for buffer.
vertexes = Z_Calloc(numvertexes * sizeof (*vertexes), PU_LEVEL, NULL);
- // Load data into cache.
- data = W_CacheLumpNum(lumpnum, PU_STATIC);
-
ml = (mapvertex_t *)data;
li = vertexes;
@@ -392,34 +388,35 @@ static inline void P_LoadVertexes(lumpnum_t lumpnum)
li->x = SHORT(ml->x)<y = SHORT(ml->y)<v2->x - seg->v1->x;
- dy = seg->v2->y - seg->v1->y;
-
- return FixedHypot(dx, dy);
+ INT64 dx = (seg->v2->x - seg->v1->x)>>1;
+ INT64 dy = (seg->v2->y - seg->v1->y)>>1;
+ return FixedHypot(dx, dy)<<1;
}
#ifdef HWRENDER
-static inline float P_SegLengthf(seg_t *seg)
+/** Computes the length of a seg as a float.
+ * This is needed for OpenGL.
+ *
+ * \param seg Seg to compute length for.
+ * \return Length as a float.
+ */
+static inline float P_SegLengthFloat(seg_t *seg)
{
float dx, dy;
@@ -436,20 +433,17 @@ static inline float P_SegLengthf(seg_t *seg)
* \param lump Lump number of the SEGS resource.
* \sa ::ML_SEGS
*/
-static void P_LoadSegs(lumpnum_t lumpnum)
+static void P_LoadRawSegs(UINT8 *data, size_t i)
{
- UINT8 *data;
- size_t i;
INT32 linedef, side;
mapseg_t *ml;
seg_t *li;
line_t *ldef;
- numsegs = W_LumpLength(lumpnum) / sizeof (mapseg_t);
+ numsegs = i / sizeof (mapseg_t);
if (numsegs <= 0)
I_Error("Level has no segs"); // instead of crashing
segs = Z_Calloc(numsegs * sizeof (*segs), PU_LEVEL, NULL);
- data = W_CacheLumpNum(lumpnum, PU_STATIC);
ml = (mapseg_t *)data;
li = segs;
@@ -458,11 +452,11 @@ static void P_LoadSegs(lumpnum_t lumpnum)
li->v1 = &vertexes[SHORT(ml->v1)];
li->v2 = &vertexes[SHORT(ml->v2)];
-#ifdef HWRENDER // not win32 only 19990829 by Kin
- // used for the hardware render
- if (rendermode != render_soft && rendermode != render_none)
+ li->length = P_SegLength(li);
+#ifdef HWRENDER
+ if (rendermode == render_opengl)
{
- li->flength = P_SegLengthf(li);
+ li->flength = P_SegLengthFloat(li);
//Hurdler: 04/12/2000: for now, only used in hardware mode
li->lightmaps = NULL; // list of static lightmap for this seg
}
@@ -485,27 +479,30 @@ static void P_LoadSegs(lumpnum_t lumpnum)
li->numlights = 0;
li->rlights = NULL;
}
+}
+static void P_LoadSegs(lumpnum_t lumpnum)
+{
+ UINT8 *data = W_CacheLumpNum(lumpnum, PU_STATIC);
+ P_LoadRawSegs(data, W_LumpLength(lumpnum));
Z_Free(data);
}
+
/** Loads the SSECTORS resource from a level.
*
* \param lump Lump number of the SSECTORS resource.
* \sa ::ML_SSECTORS
*/
-static inline void P_LoadSubsectors(lumpnum_t lumpnum)
+static inline void P_LoadRawSubsectors(void *data, size_t i)
{
- void *data;
- size_t i;
mapsubsector_t *ms;
subsector_t *ss;
- numsubsectors = W_LumpLength(lumpnum) / sizeof (mapsubsector_t);
+ numsubsectors = i / sizeof (mapsubsector_t);
if (numsubsectors <= 0)
I_Error("Level has no subsectors (did you forget to run it through a nodesbuilder?)");
ss = subsectors = Z_Calloc(numsubsectors * sizeof (*subsectors), PU_LEVEL, NULL);
- data = W_CacheLumpNum(lumpnum,PU_STATIC);
ms = (mapsubsector_t *)data;
@@ -519,7 +516,12 @@ static inline void P_LoadSubsectors(lumpnum_t lumpnum)
#endif
ss->validcount = 0;
}
+}
+static void P_LoadSubsectors(lumpnum_t lumpnum)
+{
+ UINT8 *data = W_CacheLumpNum(lumpnum, PU_STATIC);
+ P_LoadRawSubsectors(data, W_LumpLength(lumpnum));
Z_Free(data);
}
@@ -653,29 +655,31 @@ INT32 P_CheckLevelFlat(const char *flatname)
return (INT32)i;
}
-static void P_LoadSectors(lumpnum_t lumpnum)
+// Sets up the ingame sectors structures.
+// Lumpnum is the lumpnum of a SECTORS lump.
+static void P_LoadRawSectors(UINT8 *data, size_t i)
{
- UINT8 *data;
- size_t i;
mapsector_t *ms;
sector_t *ss;
levelflat_t *foundflats;
- numsectors = W_LumpLength(lumpnum) / sizeof (mapsector_t);
+ // We count how many sectors we got.
+ numsectors = i / sizeof (mapsector_t);
if (numsectors <= 0)
I_Error("Level has no sectors");
+
+ // Allocate as much memory as we need into the global sectors table.
sectors = Z_Calloc(numsectors*sizeof (*sectors), PU_LEVEL, NULL);
- data = W_CacheLumpNum(lumpnum,PU_STATIC);
-
- //Fab : FIXME: allocate for whatever number of flats
- // 512 different flats per level should be plenty
+ // Allocate a big chunk of memory as big as our MAXLEVELFLATS limit.
+ //Fab : FIXME: allocate for whatever number of flats - 512 different flats per level should be plenty
foundflats = calloc(MAXLEVELFLATS, sizeof (*foundflats));
if (foundflats == NULL)
I_Error("Ran out of memory while loading sectors\n");
numlevelflats = 0;
+ // For each counted sector, copy the sector raw data from our cache pointer ms, to the global table pointer ss.
ms = (mapsector_t *)data;
ss = sectors;
for (i = 0; i < numsectors; i++, ss++, ms++)
@@ -683,9 +687,6 @@ static void P_LoadSectors(lumpnum_t lumpnum)
ss->floorheight = SHORT(ms->floorheight)<ceilingheight = SHORT(ms->ceilingheight)<floorpic = P_AddLevelFlat(ms->floorpic, foundflats);
ss->ceilingpic = P_AddLevelFlat(ms->ceilingpic, foundflats);
@@ -750,8 +751,6 @@ static void P_LoadSectors(lumpnum_t lumpnum)
#endif // ----- end special tricks -----
}
- Z_Free(data);
-
// set the sky flat num
skyflatnum = P_AddLevelFlat(SKYFLATNAME, foundflats);
@@ -763,22 +762,26 @@ static void P_LoadSectors(lumpnum_t lumpnum)
P_SetupLevelFlatAnims();
}
+static void P_LoadSectors(lumpnum_t lumpnum)
+{
+ UINT8 *data = W_CacheLumpNum(lumpnum, PU_STATIC);
+ P_LoadRawSectors(data, W_LumpLength(lumpnum));
+ Z_Free(data);
+}
+
//
// P_LoadNodes
//
-static void P_LoadNodes(lumpnum_t lumpnum)
+static void P_LoadRawNodes(UINT8 *data, size_t i)
{
- UINT8 *data;
- size_t i;
UINT8 j, k;
mapnode_t *mn;
node_t *no;
- numnodes = W_LumpLength(lumpnum) / sizeof (mapnode_t);
+ numnodes = i / sizeof (mapnode_t);
if (numnodes <= 0)
I_Error("Level has no nodes");
nodes = Z_Calloc(numnodes * sizeof (*nodes), PU_LEVEL, NULL);
- data = W_CacheLumpNum(lumpnum, PU_STATIC);
mn = (mapnode_t *)data;
no = nodes;
@@ -796,7 +799,12 @@ static void P_LoadNodes(lumpnum_t lumpnum)
no->bbox[j][k] = SHORT(mn->bbox[j][k])<slopetype = ST_VERTICAL;
else if (!ld->dy)
ld->slopetype = ST_HORIZONTAL;
- else if (FixedDiv(ld->dy, ld->dx) > 0)
+ else if ((ld->dy > 0) == (ld->dx > 0))
ld->slopetype = ST_POSITIVE;
else
ld->slopetype = ST_NEGATIVE;
@@ -1236,7 +1241,7 @@ static void P_LoadLineDefs(lumpnum_t lumpnum)
if (ld->sidenum[j] != 0xffff && ld->sidenum[j] >= (UINT16)numsides)
{
ld->sidenum[j] = 0xffff;
- CONS_Debug(DBG_SETUP, "P_LoadLineDefs: linedef %s has out-of-range sidedef number\n", sizeu1(numlines-i-1));
+ CONS_Debug(DBG_SETUP, "P_LoadRawLineDefs: linedef %s has out-of-range sidedef number\n", sizeu1(numlines-i-1));
}
}
}
@@ -1251,14 +1256,14 @@ static void P_LoadLineDefs(lumpnum_t lumpnum)
{
ld->sidenum[0] = 0; // Substitute dummy sidedef for missing right side
// cph - print a warning about the bug
- CONS_Debug(DBG_SETUP, "P_LoadLineDefs: linedef %s missing first sidedef\n", sizeu1(numlines-i-1));
+ CONS_Debug(DBG_SETUP, "P_LoadRawLineDefs: linedef %s missing first sidedef\n", sizeu1(numlines-i-1));
}
if ((ld->sidenum[1] == 0xffff) && (ld->flags & ML_TWOSIDED))
{
ld->flags &= ~ML_TWOSIDED; // Clear 2s flag for missing left side
// cph - print a warning about the bug
- CONS_Debug(DBG_SETUP, "P_LoadLineDefs: linedef %s has two-sided flag set, but no second sidedef\n", sizeu1(numlines-i-1));
+ CONS_Debug(DBG_SETUP, "P_LoadRawLineDefs: linedef %s has two-sided flag set, but no second sidedef\n", sizeu1(numlines-i-1));
}
if (ld->sidenum[0] != 0xffff && ld->special)
@@ -1270,7 +1275,12 @@ static void P_LoadLineDefs(lumpnum_t lumpnum)
ld->polyobj = NULL;
#endif
}
+}
+static void P_LoadLineDefs(lumpnum_t lumpnum)
+{
+ UINT8 *data = W_CacheLumpNum(lumpnum, PU_STATIC);
+ P_LoadRawLineDefs(data, W_LumpLength(lumpnum));
Z_Free(data);
}
@@ -1372,22 +1382,24 @@ static void P_LoadLineDefs2(void)
}
}
-//
-// P_LoadSideDefs
-//
-static inline void P_LoadSideDefs(lumpnum_t lumpnum)
+
+
+static inline void P_LoadRawSideDefs(size_t i)
{
- numsides = W_LumpLength(lumpnum) / sizeof (mapsidedef_t);
+ numsides = i / sizeof (mapsidedef_t);
if (numsides <= 0)
I_Error("Level has no sidedefs");
sides = Z_Calloc(numsides * sizeof (*sides), PU_LEVEL, NULL);
}
-// Delay loading texture names until after loaded linedefs.
-
-static void P_LoadSideDefs2(lumpnum_t lumpnum)
+static inline void P_LoadSideDefs(lumpnum_t lumpnum)
+{
+ P_LoadRawSideDefs(W_LumpLength(lumpnum));
+}
+
+
+static void P_LoadRawSideDefs2(void *data)
{
- UINT8 *data = W_CacheLumpNum(lumpnum, PU_STATIC);
UINT16 i;
INT32 num;
@@ -1405,7 +1417,7 @@ static void P_LoadSideDefs2(lumpnum_t lumpnum)
if (sector_num >= numsectors)
{
- CONS_Debug(DBG_SETUP, "P_LoadSideDefs2: sidedef %u has out-of-range sector num %u\n", i, sector_num);
+ CONS_Debug(DBG_SETUP, "P_LoadRawSideDefs2: sidedef %u has out-of-range sector num %u\n", i, sector_num);
sector_num = 0;
}
sd->sector = sec = §ors[sector_num];
@@ -1547,6 +1559,8 @@ static void P_LoadSideDefs2(lumpnum_t lumpnum)
sd->text[6] = 0;
break;
}
+
+ case 4: // Speed pad parameters
case 414: // Play SFX
{
sd->toptexture = sd->midtexture = sd->bottomtexture = 0;
@@ -1560,6 +1574,9 @@ static void P_LoadSideDefs2(lumpnum_t lumpnum)
break;
}
+ case 9: // Mace parameters
+ case 14: // Bustable block parameters
+ case 15: // Fan particle spawner parameters
case 425: // Calls P_SetMobjState on calling mobj
case 434: // Custom Power
case 442: // Calls P_SetMobjState on mobjs of a given type in the tagged sectors
@@ -1614,11 +1631,18 @@ static void P_LoadSideDefs2(lumpnum_t lumpnum)
break;
}
}
-
- Z_Free(data);
R_ClearTextureNumCache(true);
}
+// Delay loading texture names until after loaded linedefs.
+static void P_LoadSideDefs2(lumpnum_t lumpnum)
+{
+ UINT8 *data = W_CacheLumpNum(lumpnum, PU_STATIC);
+ P_LoadRawSideDefs2(data);
+ Z_Free(data);
+}
+
+
static boolean LineInBlock(fixed_t cx1, fixed_t cy1, fixed_t cx2, fixed_t cy2, fixed_t bx1, fixed_t by1)
{
fixed_t bbox[4];
@@ -1874,6 +1898,30 @@ static void P_CreateBlockMap(void)
}
}
+// Split from P_LoadBlockMap for convenience
+// -- Monster Iestyn 08/01/18
+static void P_ReadBlockMapLump(INT16 *wadblockmaplump, size_t count)
+{
+ size_t i;
+ blockmaplump = Z_Calloc(sizeof (*blockmaplump) * count, PU_LEVEL, NULL);
+
+ // killough 3/1/98: Expand wad blockmap into larger internal one,
+ // by treating all offsets except -1 as unsigned and zero-extending
+ // them. This potentially doubles the size of blockmaps allowed,
+ // because Doom originally considered the offsets as always signed.
+
+ blockmaplump[0] = SHORT(wadblockmaplump[0]);
+ blockmaplump[1] = SHORT(wadblockmaplump[1]);
+ blockmaplump[2] = (INT32)(SHORT(wadblockmaplump[2])) & 0xffff;
+ blockmaplump[3] = (INT32)(SHORT(wadblockmaplump[3])) & 0xffff;
+
+ for (i = 4; i < count; i++)
+ {
+ INT16 t = SHORT(wadblockmaplump[i]); // killough 3/1/98
+ blockmaplump[i] = t == -1 ? (INT32)-1 : (INT32) t & 0xffff;
+ }
+}
+
//
// P_LoadBlockMap
//
@@ -1900,38 +1948,20 @@ static boolean P_LoadBlockMap(lumpnum_t lumpnum)
return false;
{
- size_t i;
INT16 *wadblockmaplump = malloc(count); //INT16 *wadblockmaplump = W_CacheLumpNum (lump, PU_LEVEL);
-
- if (wadblockmaplump) W_ReadLump(lumpnum, wadblockmaplump);
- else return false;
+ if (!wadblockmaplump)
+ return false;
+ W_ReadLump(lumpnum, wadblockmaplump);
count /= 2;
- blockmaplump = Z_Calloc(sizeof (*blockmaplump) * count, PU_LEVEL, 0);
-
- // killough 3/1/98: Expand wad blockmap into larger internal one,
- // by treating all offsets except -1 as unsigned and zero-extending
- // them. This potentially doubles the size of blockmaps allowed,
- // because Doom originally considered the offsets as always signed.
-
- blockmaplump[0] = SHORT(wadblockmaplump[0]);
- blockmaplump[1] = SHORT(wadblockmaplump[1]);
- blockmaplump[2] = (INT32)(SHORT(wadblockmaplump[2])) & 0xffff;
- blockmaplump[3] = (INT32)(SHORT(wadblockmaplump[3])) & 0xffff;
-
- for (i = 4; i < count; i++)
- {
- INT16 t = SHORT(wadblockmaplump[i]); // killough 3/1/98
- blockmaplump[i] = t == -1 ? (INT32)-1 : (INT32) t & 0xffff;
- }
-
+ P_ReadBlockMapLump(wadblockmaplump, count);
free(wadblockmaplump);
-
- bmaporgx = blockmaplump[0]<= 0x20000)
+ return false;
+
+ //CONS_Printf("Reading blockmap lump for pk3...\n");
+
+ // no need to malloc anything, assume the data is uncompressed for now
+ count /= 2;
+ P_ReadBlockMapLump((INT16 *)data, count);
+
+ bmaporgx = blockmaplump[0]<mobj_scale;
// special stage tokens, emeralds, and ring total
tokenbits = 0;
@@ -2201,6 +2304,10 @@ static void P_LevelInitStuff(void)
// earthquake camera
memset(&quake,0,sizeof(struct quake));
+ // song credit init
+ memset(&cursongcredit,0,sizeof(struct cursongcredit));
+ cursongcredit.trans = NUMTRANSMAPS;
+
for (i = 0; i < MAXPLAYERS; i++)
{
#if 0
@@ -2296,7 +2403,16 @@ void P_LoadThingsOnly(void)
P_LevelInitStuff();
- P_PrepareThings(lastloadedmaplumpnum + ML_THINGS);
+ if (W_IsLumpWad(lastloadedmaplumpnum)) // welp it's a map wad in a pk3
+ { // HACK: Open wad file rather quickly so we can use the things lump
+ UINT8 *wadData = W_CacheLumpNum(lastloadedmaplumpnum, PU_STATIC);
+ filelump_t *fileinfo = (filelump_t *)(wadData + ((wadinfo_t *)wadData)->infotableofs);
+ fileinfo += ML_THINGS; // we only need the THINGS lump
+ P_PrepareRawThings(wadData + fileinfo->filepos, fileinfo->size);
+ Z_Free(wadData); // we're done with this now
+ }
+ else // phew it's just a WAD
+ P_PrepareThings(lastloadedmaplumpnum + ML_THINGS);
P_LoadThings();
P_SpawnSecretItems(true);
@@ -2602,6 +2718,32 @@ static void P_SetupCamera(UINT8 pnum, camera_t *cam)
}
}
+static boolean P_CanSave(void)
+{
+#if 0
+ // Saving is completely ignored under these conditions:
+ if ((cursaveslot < 0) // Playing without saving
+ || (modifiedgame && !savemoddata) // Game is modified
+ || (netgame || multiplayer) // Not in single-player
+ || (demoplayback || demorecording || metalrecording) // Currently in demo
+ || (players[consoleplayer].lives <= 0) // Completely dead
+ || (modeattacking || ultimatemode || G_IsSpecialStage(gamemap))) // Specialized instances
+ return false;
+
+ if (mapheaderinfo[gamemap-1]->saveoverride == SAVE_ALWAYS)
+ return true; // Saving should ALWAYS happen!
+ else if (mapheaderinfo[gamemap-1]->saveoverride == SAVE_NEVER)
+ return false; // Saving should NEVER happen!
+
+ // Default condition: In a non-hidden map, at the beginning of a zone or on a completed save-file, and not on save reload.
+ return (!(mapheaderinfo[gamemap-1]->menuflags & LF2_HIDEINMENU)
+ && (mapheaderinfo[gamemap-1]->actnum < 2 || gamecomplete)
+ && (gamemap != lastmapsaved));
+#else
+ return false; // SRB2Kart: no SP, no saving.
+#endif
+}
+
/** Loads a level from a lump or external wad.
*
* \param skipprecip If true, don't spawn precipitation.
@@ -2727,10 +2869,6 @@ boolean P_SetupLevel(boolean skipprecip)
// As oddly named as this is, this handles music only.
// We should be fine starting it here.
S_Start();
- // SRB2 Kart - Yes this is weird, but we don't want the music to start until after the countdown is finished
- // but we do still need the mapmusname to be changed
- if (leveltime < (starttime + (TICRATE/2)))
- S_ChangeMusicInternal((encoremode ? "estart" : "kstart"), false); //S_StopMusic();
levelfadecol = (encoremode && !ranspecialwipe ? 122 : 120);
@@ -2796,7 +2934,12 @@ boolean P_SetupLevel(boolean skipprecip)
}
// internal game map
- lastloadedmaplumpnum = W_GetNumForName(maplumpname = G_BuildMapName(gamemap));
+ maplumpname = G_BuildMapName(gamemap);
+ //lastloadedmaplumpnum = LUMPERROR;
+ lastloadedmaplumpnum = W_CheckNumForName(maplumpname);
+
+ if (lastloadedmaplumpnum == INT16_MAX)
+ I_Error("Map %s not found.\n", maplumpname);
R_ReInitColormaps(mapheaderinfo[gamemap-1]->palette,
(encoremode ? W_CheckNumForName(va("%sE", maplumpname)) : LUMPERROR));
@@ -2807,38 +2950,93 @@ boolean P_SetupLevel(boolean skipprecip)
P_MakeMapMD5(lastloadedmaplumpnum, &mapmd5);
- // note: most of this ordering is important
- loadedbm = P_LoadBlockMap(lastloadedmaplumpnum + ML_BLOCKMAP);
+ // HACK ALERT: Cache the WAD, get the map data into the tables, free memory.
+ // As it is implemented right now, we're assuming an uncompressed WAD.
+ // (As in, a normal PWAD, not ZWAD or anything. The lump itself can be compressed.)
+ // We're not accounting for extra lumps and scrambled lump positions. Any additional data will cause an error.
+ if (W_IsLumpWad(lastloadedmaplumpnum))
+ {
+ // Remember that we're assuming that the WAD will have a specific set of lumps in a specific order.
+ UINT8 *wadData = W_CacheLumpNum(lastloadedmaplumpnum, PU_STATIC);
+ //filelump_t *fileinfo = wadData + ((wadinfo_t *)wadData)->infotableofs;
+ filelump_t *fileinfo = (filelump_t *)(wadData + ((wadinfo_t *)wadData)->infotableofs);
+ UINT32 numlumps = ((wadinfo_t *)wadData)->numlumps;
- P_LoadVertexes(lastloadedmaplumpnum + ML_VERTEXES);
- P_LoadSectors(lastloadedmaplumpnum + ML_SECTORS);
+ if (numlumps < ML_REJECT) // at least 9 lumps should be in the wad for a map to be loaded
+ {
+ I_Error("Bad WAD file for map %s!\n", maplumpname);
+ }
- P_LoadSideDefs(lastloadedmaplumpnum + ML_SIDEDEFS);
+ if (numlumps > ML_BLOCKMAP) // enough room for a BLOCKMAP lump at least
+ {
+ loadedbm = P_LoadRawBlockMap(
+ wadData + (fileinfo + ML_BLOCKMAP)->filepos,
+ (fileinfo + ML_BLOCKMAP)->size,
+ (fileinfo + ML_BLOCKMAP)->name);
+ }
+ P_LoadRawVertexes(wadData + (fileinfo + ML_VERTEXES)->filepos, (fileinfo + ML_VERTEXES)->size);
+ P_LoadRawSectors(wadData + (fileinfo + ML_SECTORS)->filepos, (fileinfo + ML_SECTORS)->size);
+ P_LoadRawSideDefs((fileinfo + ML_SIDEDEFS)->size);
+ P_LoadRawLineDefs(wadData + (fileinfo + ML_LINEDEFS)->filepos, (fileinfo + ML_LINEDEFS)->size);
+ P_LoadRawSideDefs2(wadData + (fileinfo + ML_SIDEDEFS)->filepos);
+ P_LoadRawSubsectors(wadData + (fileinfo + ML_SSECTORS)->filepos, (fileinfo + ML_SSECTORS)->size);
+ P_LoadRawNodes(wadData + (fileinfo + ML_NODES)->filepos, (fileinfo + ML_NODES)->size);
+ P_LoadRawSegs(wadData + (fileinfo + ML_SEGS)->filepos, (fileinfo + ML_SEGS)->size);
+ if (numlumps > ML_REJECT) // enough room for a REJECT lump at least
+ {
+ P_LoadRawReject(
+ wadData + (fileinfo + ML_REJECT)->filepos,
+ (fileinfo + ML_REJECT)->size,
+ (fileinfo + ML_REJECT)->name);
+ }
- P_LoadLineDefs(lastloadedmaplumpnum + ML_LINEDEFS);
- if (!loadedbm)
- P_CreateBlockMap(); // Graue 02-29-2004
- P_LoadSideDefs2(lastloadedmaplumpnum + ML_SIDEDEFS);
+ // Important: take care of the ordering of the next functions.
+ if (!loadedbm)
+ P_CreateBlockMap(); // Graue 02-29-2004
+ P_LoadLineDefs2();
+ P_GroupLines();
+ numdmstarts = numredctfstarts = numbluectfstarts = 0;
- P_LoadLineDefs2();
- P_LoadSubsectors(lastloadedmaplumpnum + ML_SSECTORS);
- P_LoadNodes(lastloadedmaplumpnum + ML_NODES);
- P_LoadSegs(lastloadedmaplumpnum + ML_SEGS);
- P_LoadReject(lastloadedmaplumpnum + ML_REJECT);
- P_GroupLines();
+ // reset the player starts
+ for (i = 0; i < MAXPLAYERS; i++)
+ playerstarts[i] = NULL;
+ for (i = 0; i < 2; i++)
+ skyboxmo[i] = NULL;
+ P_MapStart();
- numdmstarts = numredctfstarts = numbluectfstarts = 0;
+ P_PrepareRawThings(wadData + (fileinfo + ML_THINGS)->filepos, (fileinfo + ML_THINGS)->size);
+ Z_Free(wadData);
+ }
+ else
+ {
+ // Important: take care of the ordering of the next functions.
+ loadedbm = P_LoadBlockMap(lastloadedmaplumpnum + ML_BLOCKMAP);
+ P_LoadVertexes(lastloadedmaplumpnum + ML_VERTEXES);
+ P_LoadSectors(lastloadedmaplumpnum + ML_SECTORS);
+ P_LoadSideDefs(lastloadedmaplumpnum + ML_SIDEDEFS);
+ P_LoadLineDefs(lastloadedmaplumpnum + ML_LINEDEFS);
+ P_LoadSideDefs2(lastloadedmaplumpnum + ML_SIDEDEFS);
+ P_LoadSubsectors(lastloadedmaplumpnum + ML_SSECTORS);
+ P_LoadNodes(lastloadedmaplumpnum + ML_NODES);
+ P_LoadSegs(lastloadedmaplumpnum + ML_SEGS);
+ P_LoadReject(lastloadedmaplumpnum + ML_REJECT);
- // reset the player starts
- for (i = 0; i < MAXPLAYERS; i++)
- playerstarts[i] = NULL;
+ // Important: take care of the ordering of the next functions.
+ if (!loadedbm)
+ P_CreateBlockMap(); // Graue 02-29-2004
- for (i = 0; i < 2; i++)
- skyboxmo[i] = NULL;
+ P_LoadLineDefs2();
+ P_GroupLines();
+ numdmstarts = numredctfstarts = numbluectfstarts = 0;
- P_MapStart();
-
- P_PrepareThings(lastloadedmaplumpnum + ML_THINGS);
+ // reset the player starts
+ for (i = 0; i < MAXPLAYERS; i++)
+ playerstarts[i] = NULL;
+ for (i = 0; i < 2; i++)
+ skyboxmo[i] = NULL;
+ P_MapStart();
+ P_PrepareThings(lastloadedmaplumpnum + ML_THINGS);
+ }
#ifdef ESLOPE
P_ResetDynamicSlopes();
@@ -2982,12 +3180,12 @@ boolean P_SetupLevel(boolean skipprecip)
/*if (!cv_cam_height.changed)
CV_Set(&cv_cam_height, cv_cam_height.defaultvalue);
- if (!cv_cam2_height.changed)
- CV_Set(&cv_cam2_height, cv_cam2_height.defaultvalue);
-
if (!cv_cam_dist.changed)
CV_Set(&cv_cam_dist, cv_cam_dist.defaultvalue);
+ if (!cv_cam2_height.changed)
+ CV_Set(&cv_cam2_height, cv_cam2_height.defaultvalue);
+
if (!cv_cam2_dist.changed)
CV_Set(&cv_cam2_dist, cv_cam2_dist.defaultvalue);*/
@@ -3046,6 +3244,7 @@ boolean P_SetupLevel(boolean skipprecip)
mapreset = 0;
nospectategrief = 0;
thwompsactive = false;
+ spbplace = -1;
// clear special respawning que
iquehead = iquetail = 0;
@@ -3080,10 +3279,7 @@ boolean P_SetupLevel(boolean skipprecip)
P_RunCachedActions();
- if (!(netgame || multiplayer || demoplayback || demorecording || metalrecording || modeattacking || players[consoleplayer].lives <= 0)
- && (!modifiedgame || savemoddata) && cursaveslot >= 0 && !ultimatemode
- && !(mapheaderinfo[gamemap-1]->menuflags & LF2_HIDEINMENU)
- && (!G_IsSpecialStage(gamemap)) && gamemap != lastmapsaved && (/*mapheaderinfo[gamemap-1]->actnum < 2 ||*/ gamecomplete))
+ if (P_CanSave())
G_SaveGame((UINT32)cursaveslot);
if (savedata.lives > 0)
@@ -3113,6 +3309,8 @@ boolean P_SetupLevel(boolean skipprecip)
#endif
}
+ G_AddMapToBuffer(gamemap-1);
+
return true;
}
@@ -3126,7 +3324,7 @@ boolean P_RunSOC(const char *socfilename)
lumpnum_t lump;
if (strstr(socfilename, ".soc") != NULL)
- return P_AddWadFile(socfilename, NULL);
+ return P_AddWadFile(socfilename);
lump = W_CheckNumForName(socfilename);
if (lump == LUMPERROR)
@@ -3142,17 +3340,17 @@ boolean P_RunSOC(const char *socfilename)
// Add a wadfile to the active wad files,
// replace sounds, musics, patches, textures, sprites and maps
//
-boolean P_AddWadFile(const char *wadfilename, char **firstmapname)
+boolean P_AddWadFile(const char *wadfilename)
{
size_t i, j, sreplaces = 0, mreplaces = 0, digmreplaces = 0;
UINT16 numlumps, wadnum;
- INT16 firstmapreplaced = 0, num;
char *name;
lumpinfo_t *lumpinfo;
boolean texturechange = false;
+ boolean mapsadded = false;
boolean replacedcurrentmap = false;
- if ((numlumps = W_LoadWadFile(wadfilename)) == INT16_MAX)
+ if ((numlumps = W_InitFile(wadfilename)) == INT16_MAX)
{
refreshdirmenu |= REFRESHDIR_NOTLOADED;
CONS_Printf(M_GetText("Errors occurred while loading %s; not added.\n"), wadfilename);
@@ -3209,6 +3407,7 @@ boolean P_AddWadFile(const char *wadfilename, char **firstmapname)
if (!devparm && digmreplaces)
CONS_Printf(M_GetText("%s digital musics replaced\n"), sizeu1(digmreplaces));
+
//
// search for sprite replacements
//
@@ -3236,6 +3435,11 @@ boolean P_AddWadFile(const char *wadfilename, char **firstmapname)
//
R_AddSkins(wadnum); // faB: wadfile index in wadfiles[]
+ //
+ // edit music defs
+ //
+ S_LoadMusicDefs(wadnum);
+
//
// search for maps
//
@@ -3243,10 +3447,10 @@ boolean P_AddWadFile(const char *wadfilename, char **firstmapname)
for (i = 0; i < numlumps; i++, lumpinfo++)
{
name = lumpinfo->name;
- num = firstmapreplaced;
if (name[0] == 'M' && name[1] == 'A' && name[2] == 'P') // Ignore the headers
{
+ INT16 num;
if (name[5]!='\0')
continue;
num = (INT16)M_MapNumber(name[3], name[4]);
@@ -3256,16 +3460,10 @@ boolean P_AddWadFile(const char *wadfilename, char **firstmapname)
replacedcurrentmap = true;
CONS_Printf("%s\n", name);
- }
-
- if (num && (num < firstmapreplaced || !firstmapreplaced))
- {
- firstmapreplaced = num;
- if (firstmapname)
- *firstmapname = name;
+ mapsadded = true;
}
}
- if (!firstmapreplaced)
+ if (!mapsadded)
CONS_Printf(M_GetText("No maps added\n"));
// reload status bar (warning should have valid player!)
diff --git a/src/p_setup.h b/src/p_setup.h
index c3c206a5..c4a3aab9 100644
--- a/src/p_setup.h
+++ b/src/p_setup.h
@@ -2,7 +2,7 @@
//-----------------------------------------------------------------------------
// Copyright (C) 1993-1996 by id Software, Inc.
// Copyright (C) 1998-2000 by DooM Legacy Team.
-// Copyright (C) 1999-2016 by Sonic Team Junior.
+// Copyright (C) 1999-2018 by Sonic Team Junior.
//
// This program is free software distributed under the
// terms of the GNU General Public License, version 2.
@@ -60,7 +60,7 @@ void P_ScanThings(INT16 mapnum, INT16 wadnum, INT16 lumpnum);
#endif
void P_LoadThingsOnly(void);
boolean P_SetupLevel(boolean skipprecip);
-boolean P_AddWadFile(const char *wadfilename, char **firstmapname);
+boolean P_AddWadFile(const char *wadfilename);
#ifdef DELFILE
boolean P_DelWadFile(void);
#endif
diff --git a/src/p_sight.c b/src/p_sight.c
index bd6ab4d7..626f8bbe 100644
--- a/src/p_sight.c
+++ b/src/p_sight.c
@@ -2,7 +2,7 @@
//-----------------------------------------------------------------------------
// Copyright (C) 1993-1996 by id Software, Inc.
// Copyright (C) 1998-2000 by DooM Legacy Team.
-// Copyright (C) 1999-2016 by Sonic Team Junior.
+// Copyright (C) 1999-2018 by Sonic Team Junior.
//
// This program is free software distributed under the
// terms of the GNU General Public License, version 2.
diff --git a/src/p_slopes.c b/src/p_slopes.c
index 9513cac0..c6416b75 100644
--- a/src/p_slopes.c
+++ b/src/p_slopes.c
@@ -1,7 +1,7 @@
// SONIC ROBO BLAST 2
//-----------------------------------------------------------------------------
// Copyright (C) 2004 by Stephen McGranahan
-// Copyright (C) 2015-2016 by Sonic Team Junior.
+// Copyright (C) 2015-2018 by Sonic Team Junior.
//
// This program is free software distributed under the
// terms of the GNU General Public License, version 2.
@@ -31,8 +31,8 @@ static UINT16 slopecount = 0;
// Calculate line normal
void P_CalculateSlopeNormal(pslope_t *slope) {
slope->normal.z = FINECOSINE(slope->zangle>>ANGLETOFINESHIFT);
- slope->normal.x = -FixedMul(FINESINE(slope->zangle>>ANGLETOFINESHIFT), slope->d.x);
- slope->normal.y = -FixedMul(FINESINE(slope->zangle>>ANGLETOFINESHIFT), slope->d.y);
+ slope->normal.x = -FixedMul(FINESINE(slope->zangle>>ANGLETOFINESHIFT), -slope->d.x);
+ slope->normal.y = -FixedMul(FINESINE(slope->zangle>>ANGLETOFINESHIFT), -slope->d.y);
}
// With a vertex slope that has its vertices set, configure relevant slope info
@@ -801,8 +801,8 @@ void P_SlopeLaunch(mobj_t *mo)
#ifdef GROWNEVERMISSES
{
- const fixed_t xyscale = mapheaderinfo[gamemap-1]->mobj_scale + (mapheaderinfo[gamemap-1]->mobj_scale - mo->scale);
- const fixed_t zscale = mapheaderinfo[gamemap-1]->mobj_scale + (mapheaderinfo[gamemap-1]->mobj_scale - mo->scale);
+ const fixed_t xyscale = mapobjectscale + (mapobjectscale - mo->scale);
+ const fixed_t zscale = mapobjectscale + (mapobjectscale - mo->scale);
mo->momx = FixedMul(slopemom.x, xyscale);
mo->momy = FixedMul(slopemom.y, xyscale);
mo->momz = FixedMul(slopemom.z, zscale);
diff --git a/src/p_slopes.h b/src/p_slopes.h
index 2ff77505..708a9107 100644
--- a/src/p_slopes.h
+++ b/src/p_slopes.h
@@ -1,7 +1,7 @@
// SONIC ROBO BLAST 2
//-----------------------------------------------------------------------------
// Copyright (C) 2004 by Stephen McGranahan
-// Copyright (C) 2015-2016 by Sonic Team Junior.
+// Copyright (C) 2015-2018 by Sonic Team Junior.
//
// This program is free software distributed under the
// terms of the GNU General Public License, version 2.
diff --git a/src/p_spec.c b/src/p_spec.c
index ce58948d..ca4967ce 100644
--- a/src/p_spec.c
+++ b/src/p_spec.c
@@ -2,7 +2,7 @@
//-----------------------------------------------------------------------------
// Copyright (C) 1993-1996 by id Software, Inc.
// Copyright (C) 1998-2000 by DooM Legacy Team.
-// Copyright (C) 1999-2016 by Sonic Team Junior.
+// Copyright (C) 1999-2018 by Sonic Team Junior.
//
// This program is free software distributed under the
// terms of the GNU General Public License, version 2.
@@ -285,10 +285,13 @@ void P_InitPicAnims(void)
Z_Free(animatedLump);
}
- // Now find ANIMDEFS
+ // Find ANIMDEFS lump in the WAD
animdefsLumpNum = W_CheckNumForNamePwad("ANIMDEFS", w, 0);
- if (animdefsLumpNum != INT16_MAX)
+ while (animdefsLumpNum != INT16_MAX)
+ {
P_ParseANIMDEFSLump(w, animdefsLumpNum);
+ animdefsLumpNum = W_CheckNumForNamePwad("ANIMDEFS", (UINT16)w, animdefsLumpNum + 1);
+ }
}
// Define the last one
animdefs[maxanims].istexture = -1;
@@ -2447,6 +2450,8 @@ static void P_ProcessLineSpecial(line_t *line, mobj_t *mo, sector_t *callsec)
mapmusflags |= MUSIC_RELOADRESET;
S_ChangeMusic(mapmusname, mapmusflags, !(line->flags & ML_EFFECT4));
+ if (!(line->flags & ML_EFFECT3))
+ S_ShowMusicCredit();
// Except, you can use the ML_BLOCKMONSTERS flag to change this behavior.
// if (mapmusflags & MUSIC_RELOADRESET) then it will reset the music in G_PlayerReborn.
@@ -3259,7 +3264,7 @@ void P_SetupSignExit(player_t *player)
// SRB2Kart: FINALLY, add in an alternative if no place is found
if (player->mo)
{
- mobj_t *sign = P_SpawnMobj(player->mo->x, player->mo->y, player->mo->z + (768*mapheaderinfo[gamemap-1]->mobj_scale), MT_SIGN);
+ mobj_t *sign = P_SpawnMobj(player->mo->x, player->mo->y, player->mo->z + (768*mapobjectscale), MT_SIGN);
P_SetTarget(&sign->target, player->mo);
P_SetMobjState(sign, S_SIGN1);
@@ -3767,7 +3772,7 @@ DoneSection2:
case 1: // SRB2kart: Spring Panel
if (roversector || P_MobjReadyToTrigger(player->mo, sector))
{
- const fixed_t hscale = mapheaderinfo[gamemap-1]->mobj_scale + (mapheaderinfo[gamemap-1]->mobj_scale - player->mo->scale);
+ const fixed_t hscale = mapobjectscale + (mapobjectscale - player->mo->scale);
const fixed_t minspeed = 24*hscale;
if (player->mo->eflags & MFE_SPRUNG)
@@ -3787,7 +3792,7 @@ DoneSection2:
case 3: // SRB2kart: Spring Panel (capped speed)
if (roversector || P_MobjReadyToTrigger(player->mo, sector))
{
- const fixed_t hscale = mapheaderinfo[gamemap-1]->mobj_scale + (mapheaderinfo[gamemap-1]->mobj_scale - player->mo->scale);
+ const fixed_t hscale = mapobjectscale + (mapobjectscale - player->mo->scale);
const fixed_t minspeed = 24*hscale;
const fixed_t maxspeed = 28*hscale;
@@ -3826,8 +3831,8 @@ DoneSection2:
// SRB2Kart: Scale the speed you get from them!
// This is scaled differently from other horizontal speed boosts from stuff like springs, because of how this is used for some ramp jumps.
- if (player->mo->scale > mapheaderinfo[gamemap-1]->mobj_scale)
- linespeed = FixedMul(linespeed, mapheaderinfo[gamemap-1]->mobj_scale + (player->mo->scale - mapheaderinfo[gamemap-1]->mobj_scale));
+ if (player->mo->scale > mapobjectscale)
+ linespeed = FixedMul(linespeed, mapobjectscale + (player->mo->scale - mapobjectscale));
if (!demoplayback || P_AnalogMove(player))
{
@@ -3868,6 +3873,9 @@ DoneSection2:
}*/
player->kartstuff[k_dashpadcooldown] = TICRATE/3;
+ player->kartstuff[k_drift] = 0;
+ player->kartstuff[k_driftcharge] = 0;
+ player->kartstuff[k_pogospring] = 0;
S_StartSound(player->mo, sfx_spdpad);
{
@@ -4027,10 +4035,10 @@ DoneSection2:
}
break;
- case 7: // SRB2kart 190117 - Oil Slick
+ case 7: // SRB2kart 190117 - Oil Slick (deprecated)
if (roversector || P_MobjReadyToTrigger(player->mo, sector))
{
- K_SpinPlayer(player, NULL, 0, false);
+ K_SpinPlayer(player, NULL, 0, NULL, false);
}
break;
@@ -4095,7 +4103,6 @@ DoneSection2:
P_SetTarget(&player->mo->tracer, waypoint);
player->speed = speed;
player->pflags &= ~PF_SPINNING; // SRB2kart 200117
- player->pflags |= PF_SPINNING;
player->pflags &= ~PF_JUMPED;
player->pflags &= ~PF_GLIDING;
player->climbing = 0;
@@ -4173,7 +4180,6 @@ DoneSection2:
P_SetTarget(&player->mo->tracer, waypoint);
player->speed = speed;
player->pflags &= ~PF_SPINNING; // SRB2kart 200117
- player->pflags |= PF_SPINNING;
player->pflags &= ~PF_JUMPED;
if (!(player->mo->state >= &states[S_KART_RUN1] && player->mo->state <= &states[S_KART_RUN2]))
@@ -4189,12 +4195,12 @@ DoneSection2:
case 10: // Finish Line
// SRB2kart - 150117
- if (G_RaceGametype() && (player->starpostcount >= numstarposts/2 || player->exiting))
+ if (G_RaceGametype() && (player->starpostnum >= (numstarposts - (numstarposts/2)) || player->exiting))
player->kartstuff[k_starpostwp] = player->kartstuff[k_waypoint] = 0;
//
if (G_RaceGametype() && !player->exiting)
{
- if (player->starpostcount >= numstarposts/2) // srb2kart: must have touched *enough* starposts (was originally "(player->starpostnum == numstarposts)")
+ if (player->starpostnum >= (numstarposts - (numstarposts/2))) // srb2kart: must have touched *enough* starposts (was originally "(player->starpostnum == numstarposts)")
{
UINT8 nump = 0;
@@ -4239,13 +4245,24 @@ DoneSection2:
curlap = 0;
}
- // Reset starposts (checkpoints) info
- // SRB2kart 200117
- player->starpostangle = player->starpostnum = 0;
- player->starpostx = player->starposty = player->starpostz = 0;
- player->starpostcount = 0;
- //except the time!
player->starposttime = player->realtime;
+ player->starpostnum = 0;
+
+ if (mapheaderinfo[gamemap - 1]->levelflags & LF_SECTIONRACE)
+ {
+ // SRB2Kart 281118
+ // Save the player's time and position.
+ player->starpostx = player->mo->x>>FRACBITS;
+ player->starposty = player->mo->y>>FRACBITS;
+ player->starpostz = player->mo->floorz>>FRACBITS;
+ player->starpostangle = player->mo->angle; //R_PointToAngle2(0, 0, player->mo->momx, player->mo->momy); torn; a momentum-based guess is less likely to be wrong in general, but when it IS wrong, it fucks you over entirely...
+ }
+ else
+ {
+ // SRB2kart 200117
+ // Reset starposts (checkpoints) info
+ player->starpostangle = player->starpostx = player->starposty = player->starpostz = 0;
+ }
if (P_IsLocalPlayer(player))
{
@@ -6404,9 +6421,21 @@ void P_SpawnSpecials(INT32 fromnetsave)
case 259: // Make-Your-Own FOF!
if (lines[i].sidenum[1] != 0xffff)
{
- UINT8 *data = W_CacheLumpNum(lastloadedmaplumpnum + ML_SIDEDEFS,PU_STATIC);
+ UINT8 *data;
UINT16 b;
+ if (W_IsLumpWad(lastloadedmaplumpnum)) // welp it's a map wad in a pk3
+ { // HACK: Open wad file rather quickly so we can get the data from the sidedefs lump
+ UINT8 *wadData = W_CacheLumpNum(lastloadedmaplumpnum, PU_STATIC);
+ filelump_t *fileinfo = (filelump_t *)(wadData + ((wadinfo_t *)wadData)->infotableofs);
+ fileinfo += ML_SIDEDEFS; // we only need the SIDEDEFS lump
+ data = Z_Malloc(fileinfo->size, PU_STATIC, NULL);
+ M_Memcpy(data, wadData + fileinfo->filepos, fileinfo->size); // copy data
+ Z_Free(wadData); // we're done with this now
+ }
+ else // phew it's just a WAD
+ data = W_CacheLumpNum(lastloadedmaplumpnum + ML_SIDEDEFS,PU_STATIC);
+
for (b = 0; b < (INT16)numsides; b++)
{
register mapsidedef_t *msd = (mapsidedef_t *)data + b;
diff --git a/src/p_spec.h b/src/p_spec.h
index ad705727..1231aeda 100644
--- a/src/p_spec.h
+++ b/src/p_spec.h
@@ -2,7 +2,7 @@
//-----------------------------------------------------------------------------
// Copyright (C) 1993-1996 by id Software, Inc.
// Copyright (C) 1998-2000 by DooM Legacy Team.
-// Copyright (C) 1999-2016 by Sonic Team Junior.
+// Copyright (C) 1999-2018 by Sonic Team Junior.
//
// This program is free software distributed under the
// terms of the GNU General Public License, version 2.
diff --git a/src/p_telept.c b/src/p_telept.c
index 89a28ddc..24e201fc 100644
--- a/src/p_telept.c
+++ b/src/p_telept.c
@@ -2,7 +2,7 @@
//-----------------------------------------------------------------------------
// Copyright (C) 1993-1996 by id Software, Inc.
// Copyright (C) 1998-2000 by DooM Legacy Team.
-// Copyright (C) 1999-2016 by Sonic Team Junior.
+// Copyright (C) 1999-2018 by Sonic Team Junior.
//
// This program is free software distributed under the
// terms of the GNU General Public License, version 2.
diff --git a/src/p_tick.c b/src/p_tick.c
index e2a1bb4b..b46b248b 100644
--- a/src/p_tick.c
+++ b/src/p_tick.c
@@ -2,7 +2,7 @@
//-----------------------------------------------------------------------------
// Copyright (C) 1993-1996 by id Software, Inc.
// Copyright (C) 1998-2000 by DooM Legacy Team.
-// Copyright (C) 1999-2016 by Sonic Team Junior.
+// Copyright (C) 1999-2018 by Sonic Team Junior.
//
// This program is free software distributed under the
// terms of the GNU General Public License, version 2.
diff --git a/src/p_tick.h b/src/p_tick.h
index 75868fdd..169c54c8 100644
--- a/src/p_tick.h
+++ b/src/p_tick.h
@@ -2,7 +2,7 @@
//-----------------------------------------------------------------------------
// Copyright (C) 1993-1996 by id Software, Inc.
// Copyright (C) 1998-2000 by DooM Legacy Team.
-// Copyright (C) 1999-2016 by Sonic Team Junior.
+// Copyright (C) 1999-2018 by Sonic Team Junior.
//
// This program is free software distributed under the
// terms of the GNU General Public License, version 2.
diff --git a/src/p_user.c b/src/p_user.c
index b71f39c0..d7423d80 100644
--- a/src/p_user.c
+++ b/src/p_user.c
@@ -2,7 +2,7 @@
//-----------------------------------------------------------------------------
// Copyright (C) 1993-1996 by id Software, Inc.
// Copyright (C) 1998-2000 by DooM Legacy Team.
-// Copyright (C) 1999-2016 by Sonic Team Junior.
+// Copyright (C) 1999-2018 by Sonic Team Junior.
//
// This program is free software distributed under the
// terms of the GNU General Public License, version 2.
@@ -1778,22 +1778,8 @@ void P_DoPlayerExit(player_t *player)
if (G_RaceGametype()) // If in Race Mode, allow
{
- if (!countdown)
- {
- UINT8 i;
-
- for (i = 0; i < MAXPLAYERS; i++)
- {
- if (!playeringame[i] || players[i].spectator)
- continue;
- if (players[i].exiting || K_IsPlayerLosing(&players[i])) // Only start countdown when all winners are declared
- continue;
- break;
- }
-
- if (i == MAXPLAYERS)
- countdown = (((netgame || multiplayer) ? cv_countdowntime.value : 30)*TICRATE) + 1; // 30 seconds to finish, get going!
- }
+ player->exiting = raceexittime+2;
+ K_KartUpdatePosition(player);
if (cv_kartvoices.value)
{
@@ -1815,8 +1801,6 @@ void P_DoPlayerExit(player_t *player)
}
}
- player->exiting = raceexittime+2;
-
if (cv_inttime.value > 0)
P_EndingMusic(player);
@@ -3049,7 +3033,7 @@ static fixed_t teeteryl, teeteryh;
static boolean PIT_CheckSolidsTeeter(mobj_t *thing) // SRB2kart - unused.
{
fixed_t blockdist;
- fixed_t tiptop = FixedMul(MAXSTEPMOVE, mapheaderinfo[gamemap-1]->mobj_scale);
+ fixed_t tiptop = FixedMul(MAXSTEPMOVE, mapobjectscale);
fixed_t thingtop = thing->z + thing->height;
fixed_t teeterertop = teeterer->z + teeterer->height;
@@ -3166,7 +3150,7 @@ static void P_DoTeeter(player_t *player) // SRB2kart - unused.
boolean roverfloor; // solid 3d floors?
fixed_t floorheight, ceilingheight;
fixed_t topheight, bottomheight; // for 3d floor usage
- const fixed_t tiptop = FixedMul(MAXSTEPMOVE, mapheaderinfo[gamemap-1]->mobj_scale); // Distance you have to be above the ground in order to teeter.
+ const fixed_t tiptop = FixedMul(MAXSTEPMOVE, mapobjectscale); // Distance you have to be above the ground in order to teeter.
if (player->mo->standingslope && player->mo->standingslope->zdelta >= (FRACUNIT/2)) // Always teeter if the slope is too steep.
teeter = true;
@@ -4525,7 +4509,7 @@ boolean P_AnalogMove(player_t *player)
// 1 = pressing in the direction of movement
// 2 = pressing in the opposite direction of movement
//
-INT32 P_GetPlayerControlDirection(player_t *player)
+/*INT32 P_GetPlayerControlDirection(player_t *player)
{
ticcmd_t *cmd = &player->cmd;
angle_t controllerdirection, controlplayerdirection;
@@ -4600,7 +4584,7 @@ INT32 P_GetPlayerControlDirection(player_t *player)
}
// Control scheme for 2d levels.
-/*static void P_2dMovement(player_t *player)
+static void P_2dMovement(player_t *player)
{
ticcmd_t *cmd;
INT32 topspeed, acceleration, thrustfactor;
@@ -4810,24 +4794,11 @@ static void P_3dMovement(player_t *player)
cmd->forwardmove = cmd->sidemove = 0;
if (player->kartstuff[k_sneakertimer])
cmd->forwardmove = 50;
- if (player->pflags & PF_GLIDING)
- {
- if (!player->skidtime)
- player->pflags &= ~PF_GLIDING;
- else if (player->exiting || mapreset)
- {
- player->pflags &= ~PF_GLIDING;
- P_SetPlayerMobjState(player->mo, S_KART_WALK1); // SRB2kart - was S_PLAY_RUN1
- player->skidtime = 0;
- }
- }
- if (player->pflags & PF_SPINNING && !(player->exiting || mapreset))
- {
- player->pflags &= ~PF_SPINNING;
- P_SetPlayerMobjState(player->mo, S_KART_STND1); // SRB2kart - was S_PLAY_STND
- }
}
+ if (!(player->pflags & PF_FORCESTRAFE) && !player->kartstuff[k_pogospring])
+ cmd->sidemove = 0;
+
if (analogmove)
{
movepushangle = (cmd->angleturn<<16 /* not FRACBITS */);
@@ -4835,9 +4806,7 @@ static void P_3dMovement(player_t *player)
else
{
if (player->kartstuff[k_drift] != 0)
- {
movepushangle = player->mo->angle-(ANGLE_45/5)*player->kartstuff[k_drift];
- }
else
movepushangle = player->mo->angle;
}
@@ -5039,9 +5008,9 @@ static void P_SpectatorMovement(player_t *player)
player->mo->z = player->mo->floorz;
if (cmd->buttons & BT_ACCELERATE)
- player->mo->z += 32*mapheaderinfo[gamemap-1]->mobj_scale;
+ player->mo->z += 32*mapobjectscale;
else if (cmd->buttons & BT_BRAKE)
- player->mo->z -= 32*mapheaderinfo[gamemap-1]->mobj_scale;
+ player->mo->z -= 32*mapobjectscale;
// Aiming needed for SEENAMES, etc.
// We may not need to fire as a spectator, but this is still handy!
@@ -5050,15 +5019,15 @@ static void P_SpectatorMovement(player_t *player)
player->mo->momx = player->mo->momy = player->mo->momz = 0;
if (cmd->forwardmove != 0)
{
- P_Thrust(player->mo, player->mo->angle, cmd->forwardmove*(mapheaderinfo[gamemap-1]->mobj_scale));
+ P_Thrust(player->mo, player->mo->angle, cmd->forwardmove*mapobjectscale);
// Quake-style flying spectators :D
- player->mo->momz += FixedMul(cmd->forwardmove*(mapheaderinfo[gamemap-1]->mobj_scale), AIMINGTOSLOPE(player->aiming));
+ player->mo->momz += FixedMul(cmd->forwardmove*mapobjectscale, AIMINGTOSLOPE(player->aiming));
}
- if (cmd->sidemove != 0)
+ /*if (cmd->sidemove != 0) -- was disabled in practice anyways, since sidemove was suppressed
{
- P_Thrust(player->mo, player->mo->angle-ANGLE_90, cmd->sidemove*(mapheaderinfo[gamemap-1]->mobj_scale));
- }
+ P_Thrust(player->mo, player->mo->angle-ANGLE_90, cmd->sidemove*mapobjectscale);
+ }*/
}
//
@@ -6649,8 +6618,53 @@ static void P_MovePlayer(player_t *player)
P_2dMovement(player);
else*/
{
- if (!player->climbing && (!P_AnalogMove(player)))
- player->mo->angle = (cmd->angleturn<<16 /* not FRACBITS */);
+ INT16 angle_diff, max_left_turn, max_right_turn;
+ boolean add_delta = true;
+
+ // Kart: store the current turn range for later use
+ if (((player->mo && player->speed > 0) // Moving
+ || (leveltime > starttime && (cmd->buttons & BT_ACCELERATE && cmd->buttons & BT_BRAKE)) // Rubber-burn turn
+ || (player->kartstuff[k_respawn]) // Respawning
+ || (player->spectator || objectplacing)) // Not a physical player
+ && !(player->kartstuff[k_spinouttimer] && player->kartstuff[k_sneakertimer])) // Spinning and boosting cancels out turning
+ {
+ player->lturn_max[leveltime%MAXPREDICTTICS] = K_GetKartTurnValue(player, KART_FULLTURN)+1;
+ player->rturn_max[leveltime%MAXPREDICTTICS] = K_GetKartTurnValue(player, -KART_FULLTURN)-1;
+ } else {
+ player->lturn_max[leveltime%MAXPREDICTTICS] = player->rturn_max[leveltime%MAXPREDICTTICS] = 0;
+ }
+
+ if (leveltime >= starttime)
+ {
+ // KART: Don't directly apply angleturn! It may have been either A) forged by a malicious client, or B) not be a smooth turn due to a player dropping frames.
+ // Instead, turn the player only up to the amount they're supposed to turn accounting for latency. Allow exactly 1 extra turn unit to try to keep old replays synced.
+ angle_diff = cmd->angleturn - (player->mo->angle>>16);
+ max_left_turn = player->lturn_max[(leveltime + MAXPREDICTTICS - cmd->latency) % MAXPREDICTTICS];
+ max_right_turn = player->rturn_max[(leveltime + MAXPREDICTTICS - cmd->latency) % MAXPREDICTTICS];
+
+ //CONS_Printf("----------------\nangle diff: %d - turning options: %d to %d - ", angle_diff, max_left_turn, max_right_turn);
+
+ if (angle_diff > max_left_turn)
+ angle_diff = max_left_turn;
+ else if (angle_diff < max_right_turn)
+ angle_diff = max_right_turn;
+ else
+ {
+ // Try to keep normal turning as accurate to 1.0.1 as possible to reduce replay desyncs.
+ player->mo->angle = cmd->angleturn<<16;
+ add_delta = false;
+ }
+ //CONS_Printf("applied turn: %d\n", angle_diff);
+
+ if (add_delta) {
+ player->mo->angle += angle_diff<<16;
+ player->mo->angle &= ~0xFFFF; // Try to keep the turning somewhat similar to how it was before?
+ //CONS_Printf("leftover turn (%s): %5d or %4d%%\n",
+ // player_names[player-players],
+ // (INT16) (cmd->angleturn - (player->mo->angle>>16)),
+ // (INT16) (cmd->angleturn - (player->mo->angle>>16)) * 100 / (angle_diff ?: 1));
+ }
+ }
ticruned++;
if ((cmd->angleturn & TICCMD_RECEIVED) == 0)
@@ -7048,6 +7062,7 @@ static void P_MovePlayer(player_t *player)
//ANALOG CONTROL//
//////////////////
+#if 0
// This really looks like it should be moved to P_3dMovement. -Red
if (P_AnalogMove(player)
&& (cmd->forwardmove != 0 || cmd->sidemove != 0) && !player->climbing && !twodlevel && !(player->mo->flags2 & MF2_TWOD))
@@ -7104,6 +7119,7 @@ static void P_MovePlayer(player_t *player)
else if (player == &players[fourthdisplayplayer])
localangle4 = player->mo->angle;
}
+#endif
///////////////////////////
//BOMB SHIELD ACTIVATION,//
@@ -7259,7 +7275,7 @@ static void P_MovePlayer(player_t *player)
P_DamageMobj(player->mo, NULL, NULL, 42000); // Respawn crushed spectators
else
{
- K_SquishPlayer(player, NULL); // SRB2kart - we don't kill when squished, we squish when squished.
+ K_SquishPlayer(player, NULL, NULL); // SRB2kart - we don't kill when squished, we squish when squished.
/*
mobj_t *killer = P_SpawnMobj(player->mo->x, player->mo->y, player->mo->z, MT_NULL);
killer->threshold = 44; // Special flag that it was crushing which killed you.
@@ -7775,13 +7791,16 @@ void P_NukeEnemies(mobj_t *inflictor, mobj_t *source, fixed_t radius)
}
if (mo->type == MT_SPB) // If you destroy a SPB, you don't get the luxury of a cooldown.
+ {
+ spbplace = -1;
indirectitemcooldown = 0;
+ }
if (mo == inflictor) // Don't nuke yourself, dummy!
continue;
if (mo->type == MT_PLAYER) // Players wipe out in Kart
- K_SpinPlayer(mo->player, source, 0, false);
+ K_SpinPlayer(mo->player, source, 0, inflictor, false);
//}
else
P_DamageMobj(mo, inflictor, source, 1000);
@@ -7824,8 +7843,8 @@ boolean P_LookForEnemies(player_t *player)
if (mo->type == MT_DETON) // Don't be STUPID, Sonic!
continue;
- if (((mo->z > player->mo->z+FixedMul(MAXSTEPMOVE, mapheaderinfo[gamemap-1]->mobj_scale)) && !(player->mo->eflags & MFE_VERTICALFLIP))
- || ((mo->z+mo->height < player->mo->z+player->mo->height-FixedMul(MAXSTEPMOVE, mapheaderinfo[gamemap-1]->mobj_scale)) && (player->mo->eflags & MFE_VERTICALFLIP))) // Reverse gravity check - Flame.
+ if (((mo->z > player->mo->z+FixedMul(MAXSTEPMOVE, mapobjectscale)) && !(player->mo->eflags & MFE_VERTICALFLIP))
+ || ((mo->z+mo->height < player->mo->z+player->mo->height-FixedMul(MAXSTEPMOVE, mapobjectscale)) && (player->mo->eflags & MFE_VERTICALFLIP))) // Reverse gravity check - Flame.
continue; // Don't home upwards!
if (P_AproxDistance(P_AproxDistance(player->mo->x-mo->x, player->mo->y-mo->y),
@@ -7951,6 +7970,15 @@ void P_FindEmerald(void)
//
static void P_DeathThink(player_t *player)
{
+ //ticcmd_t *cmd = &player->cmd;
+ //player->deltaviewheight = 0;
+
+ if (player->deadtimer < INT32_MAX)
+ player->deadtimer++;
+
+ if (player->bot) // don't allow bots to do any of the below, B_CheckRespawn does all they need for respawning already
+ goto notrealplayer;
+
if (player->pflags & PF_TIMEOVER)
{
player->kartstuff[k_timeovercam]++;
@@ -7963,8 +7991,7 @@ static void P_DeathThink(player_t *player)
else
player->kartstuff[k_timeovercam] = 0;
- if (player->deadtimer < INT32_MAX)
- player->deadtimer++;
+ K_KartPlayerHUDUpdate(player);
// Force respawn if idle for more than 30 seconds in shooter modes.
if (player->lives > 0 /*&& leveltime >= starttime*/) // *could* you respawn?
@@ -7998,9 +8025,14 @@ static void P_DeathThink(player_t *player)
}
}
+notrealplayer:
+
if (!player->mo)
return;
+ player->mo->colorized = false;
+ player->mo->color = player->skincolor;
+
P_CalcHeight(player);
}
@@ -8052,18 +8084,21 @@ consvar_t cv_cam_still = {"cam_still", "Off", 0, CV_OnOff, NULL, 0, NULL, NULL,
consvar_t cv_cam_speed = {"cam_speed", "0.4", CV_FLOAT|CV_SAVE, CV_CamSpeed, NULL, 0, NULL, NULL, 0, 0, NULL};
consvar_t cv_cam_rotate = {"cam_rotate", "0", CV_CALL|CV_NOINIT, CV_CamRotate, CV_CamRotate_OnChange, 0, NULL, NULL, 0, 0, NULL};
consvar_t cv_cam_rotspeed = {"cam_rotspeed", "10", CV_SAVE, rotation_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
+
consvar_t cv_cam2_dist = {"cam2_dist", "160", CV_FLOAT|CV_SAVE, NULL, NULL, 0, NULL, NULL, 0, 0, NULL};
consvar_t cv_cam2_height = {"cam2_height", "50", CV_FLOAT|CV_SAVE, NULL, NULL, 0, NULL, NULL, 0, 0, NULL};
consvar_t cv_cam2_still = {"cam2_still", "Off", 0, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL};
consvar_t cv_cam2_speed = {"cam2_speed", "0.4", CV_FLOAT|CV_SAVE, CV_CamSpeed, NULL, 0, NULL, NULL, 0, 0, NULL};
consvar_t cv_cam2_rotate = {"cam2_rotate", "0", CV_CALL|CV_NOINIT, CV_CamRotate, CV_CamRotate2_OnChange, 0, NULL, NULL, 0, 0, NULL};
consvar_t cv_cam2_rotspeed = {"cam2_rotspeed", "10", CV_SAVE, rotation_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
+
consvar_t cv_cam3_dist = {"cam3_dist", "160", CV_FLOAT|CV_SAVE, NULL, NULL, 0, NULL, NULL, 0, 0, NULL};
consvar_t cv_cam3_height = {"cam3_height", "50", CV_FLOAT|CV_SAVE, NULL, NULL, 0, NULL, NULL, 0, 0, NULL};
consvar_t cv_cam3_still = {"cam3_still", "Off", 0, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL};
consvar_t cv_cam3_speed = {"cam3_speed", "0.4", CV_FLOAT|CV_SAVE, CV_CamSpeed, NULL, 0, NULL, NULL, 0, 0, NULL};
consvar_t cv_cam3_rotate = {"cam3_rotate", "0", CV_CALL|CV_NOINIT, CV_CamRotate, CV_CamRotate3_OnChange, 0, NULL, NULL, 0, 0, NULL};
consvar_t cv_cam3_rotspeed = {"cam3_rotspeed", "10", CV_SAVE, rotation_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
+
consvar_t cv_cam4_dist = {"cam4_dist", "160", CV_FLOAT|CV_SAVE, NULL, NULL, 0, NULL, NULL, 0, 0, NULL};
consvar_t cv_cam4_height = {"cam4_height", "50", CV_FLOAT|CV_SAVE, NULL, NULL, 0, NULL, NULL, 0, 0, NULL};
consvar_t cv_cam4_still = {"cam4_still", "Off", 0, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL};
@@ -8214,8 +8249,8 @@ boolean P_MoveChaseCamera(player_t *player, camera_t *thiscam, boolean resetcall
return true;
}
- thiscam->radius = FixedMul(20*FRACUNIT, mapheaderinfo[gamemap-1]->mobj_scale);
- thiscam->height = FixedMul(16*FRACUNIT, mapheaderinfo[gamemap-1]->mobj_scale);
+ thiscam->radius = 20*mapobjectscale;
+ thiscam->height = 16*mapobjectscale;
// Don't run while respawning from a starpost
// Inu 4/8/13 Why not?!
@@ -8261,8 +8296,8 @@ boolean P_MoveChaseCamera(player_t *player, camera_t *thiscam, boolean resetcall
camspeed = cv_cam_speed.value;
camstill = cv_cam_still.value;
camrotate = cv_cam_rotate.value;
- camdist = FixedMul(cv_cam_dist.value, mapheaderinfo[gamemap-1]->mobj_scale);
- camheight = FixedMul(cv_cam_height.value, mapheaderinfo[gamemap-1]->mobj_scale);
+ camdist = FixedMul(cv_cam_dist.value, mapobjectscale);
+ camheight = FixedMul(cv_cam_height.value, mapobjectscale);
lookback = camspin;
}
else if (thiscam == &camera2) // Camera 2
@@ -8270,8 +8305,8 @@ boolean P_MoveChaseCamera(player_t *player, camera_t *thiscam, boolean resetcall
camspeed = cv_cam2_speed.value;
camstill = cv_cam2_still.value;
camrotate = cv_cam2_rotate.value;
- camdist = FixedMul(cv_cam2_dist.value, mapheaderinfo[gamemap-1]->mobj_scale);
- camheight = FixedMul(cv_cam2_height.value, mapheaderinfo[gamemap-1]->mobj_scale);
+ camdist = FixedMul(cv_cam2_dist.value, mapobjectscale);
+ camheight = FixedMul(cv_cam2_height.value, mapobjectscale);
lookback = camspin2;
}
else if (thiscam == &camera3) // Camera 3
@@ -8279,8 +8314,8 @@ boolean P_MoveChaseCamera(player_t *player, camera_t *thiscam, boolean resetcall
camspeed = cv_cam3_speed.value;
camstill = cv_cam3_still.value;
camrotate = cv_cam3_rotate.value;
- camdist = FixedMul(cv_cam3_dist.value, mapheaderinfo[gamemap-1]->mobj_scale);
- camheight = FixedMul(cv_cam3_height.value, mapheaderinfo[gamemap-1]->mobj_scale);
+ camdist = FixedMul(cv_cam3_dist.value, mapobjectscale);
+ camheight = FixedMul(cv_cam3_height.value, mapobjectscale);
lookback = camspin3;
}
else // Camera 4
@@ -8288,8 +8323,8 @@ boolean P_MoveChaseCamera(player_t *player, camera_t *thiscam, boolean resetcall
camspeed = cv_cam4_speed.value;
camstill = cv_cam4_still.value;
camrotate = cv_cam4_rotate.value;
- camdist = FixedMul(cv_cam4_dist.value, mapheaderinfo[gamemap-1]->mobj_scale);
- camheight = FixedMul(cv_cam4_height.value, mapheaderinfo[gamemap-1]->mobj_scale);
+ camdist = FixedMul(cv_cam4_dist.value, mapobjectscale);
+ camheight = FixedMul(cv_cam4_height.value, mapobjectscale);
lookback = camspin4;
}
@@ -8302,8 +8337,8 @@ boolean P_MoveChaseCamera(player_t *player, camera_t *thiscam, boolean resetcall
{
const INT32 introcam = (introtime - leveltime);
camrotate += introcam*5;
- camdist += (introcam * mapheaderinfo[gamemap-1]->mobj_scale)*3;
- camheight += (introcam * mapheaderinfo[gamemap-1]->mobj_scale)*2;
+ camdist += (introcam * mapobjectscale)*3;
+ camheight += (introcam * mapobjectscale)*2;
}
else if (player->exiting) // SRB2Kart: Leave the camera behind while exiting, for dramatic effect!
camstill = true;
@@ -8611,7 +8646,7 @@ boolean P_MoveChaseCamera(player_t *player, camera_t *thiscam, boolean resetcall
// point viewed by the camera
// this point is just 64 unit forward the player
- dist = 64*mapheaderinfo[gamemap-1]->mobj_scale;
+ dist = 64*mapobjectscale;
viewpointx = mo->x + FixedMul(FINECOSINE((angle>>ANGLETOFINESHIFT) & FINEMASK), dist) + xpan;
viewpointy = mo->y + FixedMul(FINESINE((angle>>ANGLETOFINESHIFT) & FINEMASK), dist) + ypan;
@@ -8776,7 +8811,7 @@ static void P_CalcPostImg(player_t *player)
else
pviewheight = player->mo->z + player->viewheight;
- if (player->awayviewtics)
+ if (player->awayviewtics && player->awayviewmobj && !P_MobjWasRemoved(player->awayviewmobj))
{
sector = player->awayviewmobj->subsector->sector;
pviewheight = player->awayviewmobj->z + 20*FRACUNIT;
@@ -8984,6 +9019,13 @@ void P_PlayerThink(player_t *player)
}
}
#endif
+
+ if (player->awayviewmobj && P_MobjWasRemoved(player->awayviewmobj))
+ {
+ P_SetTarget(&player->awayviewmobj, NULL); // remove awayviewmobj asap if invalid
+ player->awayviewtics = 0; // reset to zero
+ }
+
/*
if (player->pflags & PF_GLIDING)
{
@@ -8997,9 +9039,14 @@ void P_PlayerThink(player_t *player)
if (player->flashcount)
player->flashcount--;
- // By the time P_MoveChaseCamera is called, this might be zero. Do not do it here.
- //if (player->awayviewtics)
- // player->awayviewtics--;
+ // Re-fixed by Jimita (11-12-2018)
+ if (player->awayviewtics)
+ {
+ player->awayviewtics--;
+ if (!player->awayviewtics)
+ player->awayviewtics = -1;
+ // The timer might've reached zero, but we'll run the remote view camera anyway by setting it to -1.
+ }
/// \note do this in the cheat code
if (player->pflags & PF_NOCLIP)
@@ -9115,7 +9162,10 @@ void P_PlayerThink(player_t *player)
if (player->playerstate == PST_DEAD)
{
- player->mo->flags2 &= ~MF2_SHADOW;
+ if (player->spectator)
+ player->mo->flags2 |= MF2_SHADOW;
+ else
+ player->mo->flags2 &= ~MF2_SHADOW;
P_DeathThink(player);
return;
@@ -9811,8 +9861,8 @@ void P_PlayerAfterThink(player_t *player)
}
}
- if (player->awayviewtics)
- player->awayviewtics--;
+ if (player->awayviewtics < 0)
+ player->awayviewtics = 0;
// spectator invisibility and nogravity.
if ((netgame || multiplayer) && player->spectator)
diff --git a/src/r_bsp.c b/src/r_bsp.c
index 68e6a1ab..b819735e 100644
--- a/src/r_bsp.c
+++ b/src/r_bsp.c
@@ -2,7 +2,7 @@
//-----------------------------------------------------------------------------
// Copyright (C) 1993-1996 by id Software, Inc.
// Copyright (C) 1998-2000 by DooM Legacy Team.
-// Copyright (C) 1999-2016 by Sonic Team Junior.
+// Copyright (C) 1999-2018 by Sonic Team Junior.
//
// This program is free software distributed under the
// terms of the GNU General Public License, version 2.
@@ -403,17 +403,17 @@ static void R_AddLine(seg_t *line)
{
INT32 x1, x2;
angle_t angle1, angle2, span, tspan;
- static sector_t tempsec; // ceiling/water hack
+ static sector_t tempsec;
+
+ portalline = false;
if (line->polyseg && !(line->polyseg->flags & POF_RENDERSIDES))
return;
+ // big room fix
+ angle1 = R_PointToAngleEx(viewx, viewy, line->v1->x, line->v1->y);
+ angle2 = R_PointToAngleEx(viewx, viewy, line->v2->x, line->v2->y);
curline = line;
- portalline = false;
-
- // OPTIMIZE: quickly reject orthogonal back sides.
- angle1 = R_PointToAngle(line->v1->x, line->v1->y);
- angle2 = R_PointToAngle(line->v2->x, line->v2->y);
// Clip to view edges.
span = angle1 - angle2;
@@ -602,69 +602,35 @@ INT32 checkcoord[12][4] =
{2, 1, 3, 0}
};
-static boolean R_CheckBBox(fixed_t *bspcoord)
+static boolean R_CheckBBox(const fixed_t *bspcoord)
{
- INT32 boxpos, sx1, sx2;
- fixed_t px1, py1, px2, py2;
- angle_t angle1, angle2, span, tspan;
+ angle_t angle1, angle2;
+ INT32 sx1, sx2, boxpos;
+ const INT32* check;
cliprange_t *start;
// Find the corners of the box that define the edges from current viewpoint.
- if (viewx <= bspcoord[BOXLEFT])
- boxpos = 0;
- else if (viewx < bspcoord[BOXRIGHT])
- boxpos = 1;
- else
- boxpos = 2;
-
- if (viewy >= bspcoord[BOXTOP])
- boxpos |= 0;
- else if (viewy > bspcoord[BOXBOTTOM])
- boxpos |= 1<<2;
- else
- boxpos |= 2<<2;
-
- if (boxpos == 5)
+ if ((boxpos = (viewx <= bspcoord[BOXLEFT] ? 0 : viewx < bspcoord[BOXRIGHT] ? 1 : 2) + (viewy >= bspcoord[BOXTOP] ? 0 : viewy > bspcoord[BOXBOTTOM] ? 4 : 8)) == 5)
return true;
- px1 = bspcoord[checkcoord[boxpos][0]];
- py1 = bspcoord[checkcoord[boxpos][1]];
- px2 = bspcoord[checkcoord[boxpos][2]];
- py2 = bspcoord[checkcoord[boxpos][3]];
+ check = checkcoord[boxpos];
- // check clip list for an open space
- angle1 = R_PointToAngle2(viewx>>1, viewy>>1, px1>>1, py1>>1) - viewangle;
- angle2 = R_PointToAngle2(viewx>>1, viewy>>1, px2>>1, py2>>1) - viewangle;
+ // big room fix
+ angle1 = R_PointToAngleEx(viewx, viewy, bspcoord[check[0]], bspcoord[check[1]]) - viewangle;
+ angle2 = R_PointToAngleEx(viewx, viewy, bspcoord[check[2]], bspcoord[check[3]]) - viewangle;
- span = angle1 - angle2;
-
- // Sitting on a line?
- if (span >= ANGLE_180)
- return true;
-
- tspan = angle1 + clipangle;
-
- if (tspan > doubleclipangle)
+ if ((signed)angle1 < (signed)angle2)
{
- tspan -= doubleclipangle;
-
- // Totally off the left edge?
- if (tspan >= span)
- return false;
-
- angle1 = clipangle;
+ if ((angle1 >= ANGLE_180) && (angle1 < ANGLE_270))
+ angle1 = ANGLE_180-1;
+ else
+ angle2 = ANGLE_180;
}
- tspan = clipangle - angle2;
- if (tspan > doubleclipangle)
- {
- tspan -= doubleclipangle;
- // Totally off the left edge?
- if (tspan >= span)
- return false;
-
- angle2 = -(signed)clipangle;
- }
+ if ((signed)angle2 >= (signed)clipangle) return false;
+ if ((signed)angle1 <= -(signed)clipangle) return false;
+ if ((signed)angle1 >= (signed)clipangle) angle1 = clipangle;
+ if ((signed)angle2 <= -(signed)clipangle) angle2 = 0-clipangle;
// Find the first clippost that touches the source post (adjacent pixels are touching).
angle1 = (angle1+ANGLE_90)>>ANGLETOFINESHIFT;
@@ -673,9 +639,7 @@ static boolean R_CheckBBox(fixed_t *bspcoord)
sx2 = viewangletox[angle2];
// Does not cross a pixel.
- if (sx1 == sx2)
- return false;
- sx2--;
+ if (sx1 >= sx2) return false;
start = solidsegs;
while (start->last < sx2)
@@ -1115,7 +1079,6 @@ static void R_Subsector(size_t num, UINT8 viewnumber)
&& (viewz < polysec->floorheight))
{
light = R_GetPlaneLight(frontsector, polysec->floorheight, viewz < polysec->floorheight);
- light = 0;
ffloor[numffloors].plane = R_FindPlane(polysec->floorheight, polysec->floorpic,
polysec->lightlevel, polysec->floor_xoffs, polysec->floor_yoffs,
polysec->floorpic_angle-po->angle,
@@ -1145,7 +1108,6 @@ static void R_Subsector(size_t num, UINT8 viewnumber)
&& (viewz > polysec->ceilingheight))
{
light = R_GetPlaneLight(frontsector, polysec->ceilingheight, viewz < polysec->ceilingheight);
- light = 0;
ffloor[numffloors].plane = R_FindPlane(polysec->ceilingheight, polysec->ceilingpic,
polysec->lightlevel, polysec->ceiling_xoffs, polysec->ceiling_yoffs,
polysec->ceilingpic_angle-po->angle,
diff --git a/src/r_bsp.h b/src/r_bsp.h
index 07cad27c..7810c9b5 100644
--- a/src/r_bsp.h
+++ b/src/r_bsp.h
@@ -2,7 +2,7 @@
//-----------------------------------------------------------------------------
// Copyright (C) 1993-1996 by id Software, Inc.
// Copyright (C) 1998-2000 by DooM Legacy Team.
-// Copyright (C) 1999-2016 by Sonic Team Junior.
+// Copyright (C) 1999-2018 by Sonic Team Junior.
//
// This program is free software distributed under the
// terms of the GNU General Public License, version 2.
diff --git a/src/r_data.c b/src/r_data.c
index 13b4957b..1a74f733 100644
--- a/src/r_data.c
+++ b/src/r_data.c
@@ -2,7 +2,7 @@
//-----------------------------------------------------------------------------
// Copyright (C) 1993-1996 by id Software, Inc.
// Copyright (C) 1998-2000 by DooM Legacy Team.
-// Copyright (C) 1999-2016 by Sonic Team Junior.
+// Copyright (C) 1999-2018 by Sonic Team Junior.
//
// This program is free software distributed under the
// terms of the GNU General Public License, version 2.
@@ -369,8 +369,8 @@ void R_FlushTextureCache(void)
}
// Need these prototypes for later; defining them here instead of r_data.h so they're "private"
-int R_CountTexturesInTEXTURESLump(UINT16 wadNum);
-void R_ParseTEXTURESLump(UINT16 wadNum, INT32 *index);
+int R_CountTexturesInTEXTURESLump(UINT16 wadNum, UINT16 lumpNum);
+void R_ParseTEXTURESLump(UINT16 wadNum, UINT16 lumpNum, INT32 *index);
//
// R_LoadTextures
@@ -408,13 +408,22 @@ void R_LoadTextures(void)
// but the alternative is to spend a ton of time checking and re-checking all previous entries just to skip any potentially patched textures.
for (w = 0, numtextures = 0; w < numwadfiles; w++)
{
- texstart = W_CheckNumForNamePwad(TX_START, (UINT16)w, 0) + 1;
- texend = W_CheckNumForNamePwad(TX_END, (UINT16)w, 0);
- texturesLumpPos = W_CheckNumForNamePwad("TEXTURES", (UINT16)w, 0);
-
- if (texturesLumpPos != INT16_MAX)
+ if (wadfiles[w]->type == RET_PK3)
{
- numtextures += R_CountTexturesInTEXTURESLump((UINT16)w);
+ texstart = W_CheckNumForFolderStartPK3("textures/", (UINT16)w, 0);
+ texend = W_CheckNumForFolderEndPK3("textures/", (UINT16)w, texstart);
+ }
+ else
+ {
+ texstart = W_CheckNumForNamePwad(TX_START, (UINT16)w, 0) + 1;
+ texend = W_CheckNumForNamePwad(TX_END, (UINT16)w, 0);
+ }
+
+ texturesLumpPos = W_CheckNumForNamePwad("TEXTURES", (UINT16)w, 0);
+ while (texturesLumpPos != INT16_MAX)
+ {
+ numtextures += R_CountTexturesInTEXTURESLump((UINT16)w, (UINT16)texturesLumpPos);
+ texturesLumpPos = W_CheckNumForNamePwad("TEXTURES", (UINT16)w, texturesLumpPos + 1);
}
// Add all the textures between TX_START and TX_END
@@ -451,12 +460,25 @@ void R_LoadTextures(void)
for (i = 0, w = 0; w < numwadfiles; w++)
{
// Get the lump numbers for the markers in the WAD, if they exist.
- texstart = W_CheckNumForNamePwad(TX_START, (UINT16)w, 0) + 1;
- texend = W_CheckNumForNamePwad(TX_END, (UINT16)w, 0);
- texturesLumpPos = W_CheckNumForNamePwad("TEXTURES", (UINT16)w, 0);
-
- if (texturesLumpPos != INT16_MAX)
- R_ParseTEXTURESLump(w,&i);
+ if (wadfiles[w]->type == RET_PK3)
+ {
+ texstart = W_CheckNumForFolderStartPK3("textures/", (UINT16)w, 0);
+ texend = W_CheckNumForFolderEndPK3("textures/", (UINT16)w, texstart);
+ texturesLumpPos = W_CheckNumForNamePwad("TEXTURES", (UINT16)w, 0);
+ while (texturesLumpPos != INT16_MAX)
+ {
+ R_ParseTEXTURESLump(w, texturesLumpPos, &i);
+ texturesLumpPos = W_CheckNumForNamePwad("TEXTURES", (UINT16)w, texturesLumpPos + 1);
+ }
+ }
+ else
+ {
+ texstart = W_CheckNumForNamePwad(TX_START, (UINT16)w, 0) + 1;
+ texend = W_CheckNumForNamePwad(TX_END, (UINT16)w, 0);
+ texturesLumpPos = W_CheckNumForNamePwad("TEXTURES", (UINT16)w, 0);
+ if (texturesLumpPos != INT16_MAX)
+ R_ParseTEXTURESLump(w, texturesLumpPos, &i);
+ }
if (texstart == INT16_MAX || texend == INT16_MAX)
continue;
@@ -803,7 +825,7 @@ static texture_t *R_ParseTexture(boolean actuallyLoadTexture)
}
// Parses the TEXTURES lump... but just to count the number of textures.
-int R_CountTexturesInTEXTURESLump(UINT16 wadNum)
+int R_CountTexturesInTEXTURESLump(UINT16 wadNum, UINT16 lumpNum)
{
char *texturesLump;
size_t texturesLumpLength;
@@ -814,11 +836,11 @@ int R_CountTexturesInTEXTURESLump(UINT16 wadNum)
// Since lumps AREN'T \0-terminated like I'd assumed they should be, I'll
// need to make a space of memory where I can ensure that it will terminate
// correctly. Start by loading the relevant data from the WAD.
- texturesLump = (char *)W_CacheLumpNumPwad(wadNum,W_CheckNumForNamePwad("TEXTURES", wadNum, 0),PU_STATIC);
+ texturesLump = (char *)W_CacheLumpNumPwad(wadNum, lumpNum, PU_STATIC);
// If that didn't exist, we have nothing to do here.
if (texturesLump == NULL) return 0;
// If we're still here, then it DOES exist; figure out how long it is, and allot memory accordingly.
- texturesLumpLength = W_LumpLengthPwad(wadNum,W_CheckNumForNamePwad("TEXTURES",wadNum,0));
+ texturesLumpLength = W_LumpLengthPwad(wadNum, lumpNum);
texturesText = (char *)Z_Malloc((texturesLumpLength+1)*sizeof(char),PU_STATIC,NULL);
// Now move the contents of the lump into this new location.
memmove(texturesText,texturesLump,texturesLumpLength);
@@ -850,7 +872,7 @@ int R_CountTexturesInTEXTURESLump(UINT16 wadNum)
}
// Parses the TEXTURES lump... for real, this time.
-void R_ParseTEXTURESLump(UINT16 wadNum, INT32 *texindex)
+void R_ParseTEXTURESLump(UINT16 wadNum, UINT16 lumpNum, INT32 *texindex)
{
char *texturesLump;
size_t texturesLumpLength;
@@ -863,11 +885,11 @@ void R_ParseTEXTURESLump(UINT16 wadNum, INT32 *texindex)
// Since lumps AREN'T \0-terminated like I'd assumed they should be, I'll
// need to make a space of memory where I can ensure that it will terminate
// correctly. Start by loading the relevant data from the WAD.
- texturesLump = (char *)W_CacheLumpNumPwad(wadNum,W_CheckNumForNamePwad("TEXTURES", wadNum, 0),PU_STATIC);
+ texturesLump = (char *)W_CacheLumpNumPwad(wadNum, lumpNum, PU_STATIC);
// If that didn't exist, we have nothing to do here.
if (texturesLump == NULL) return;
// If we're still here, then it DOES exist; figure out how long it is, and allot memory accordingly.
- texturesLumpLength = W_LumpLengthPwad(wadNum,W_CheckNumForNamePwad("TEXTURES",wadNum,0));
+ texturesLumpLength = W_LumpLengthPwad(wadNum, lumpNum);
texturesText = (char *)Z_Malloc((texturesLumpLength+1)*sizeof(char),PU_STATIC,NULL);
// Now move the contents of the lump into this new location.
memmove(texturesText,texturesLump,texturesLumpLength);
@@ -902,7 +924,8 @@ void R_ParseTEXTURESLump(UINT16 wadNum, INT32 *texindex)
Z_Free((void *)texturesText);
}
-static inline lumpnum_t R_CheckNumForNameList(const char *name, lumplist_t *list, size_t listsize)
+/*
+static inline lumpnum_t R_CheckNumForNameList(const char *name, lumplist_t *list, size_t listsize) // SRB2kart - unused.
{
size_t i;
UINT16 lump;
@@ -917,6 +940,7 @@ static inline lumpnum_t R_CheckNumForNameList(const char *name, lumplist_t *list
}
return LUMPERROR;
}
+*/
/*static lumplist_t *colormaplumps = NULL; ///\todo free leak
static size_t numcolormaplumps = 0;
@@ -954,12 +978,51 @@ static void R_InitExtraColormaps(void)
CONS_Printf(M_GetText("Number of Extra Colormaps: %s\n"), sizeu1(numcolormaplumps));
}*/
-// 12/14/14 -- only take flats in F_START/F_END
+// Search for flat name.
lumpnum_t R_GetFlatNumForName(const char *name)
{
- lumpnum_t lump = W_CheckNumForNameInBlock(name, "F_START", "F_END");
- if (lump == LUMPERROR)
- lump = W_CheckNumForNameInBlock(name, "FF_START", "FF_END"); // deutex, some other old things
+ INT32 i;
+ lumpnum_t lump;
+ lumpnum_t start;
+ lumpnum_t end;
+
+ // Scan wad files backwards so patched flats take preference.
+ for (i = numwadfiles - 1; i >= 0; i--)
+ {
+ switch (wadfiles[i]->type)
+ {
+ case RET_WAD:
+ if ((start = W_CheckNumForNamePwad("F_START", (UINT16)i, 0)) == INT16_MAX)
+ {
+ if ((start = W_CheckNumForNamePwad("FF_START", (UINT16)i, 0)) == INT16_MAX)
+ continue;
+ else if ((end = W_CheckNumForNamePwad("FF_END", (UINT16)i, start)) == INT16_MAX)
+ continue;
+ }
+ else
+ if ((end = W_CheckNumForNamePwad("F_END", (UINT16)i, start)) == INT16_MAX)
+ continue;
+ break;
+ case RET_PK3:
+ if ((start = W_CheckNumForFolderStartPK3("Flats/", i, 0)) == INT16_MAX)
+ continue;
+ if ((end = W_CheckNumForFolderEndPK3("Flats/", i, start)) == INT16_MAX)
+ continue;
+ break;
+ default:
+ continue;
+ }
+
+ // Now find lump with specified name in that range.
+ lump = W_CheckNumForNamePwad(name, (UINT16)i, start);
+ if (lump < end)
+ {
+ lump += (i<<16); // found it, in our constraints
+ break;
+ }
+ lump = LUMPERROR;
+ }
+
if (lump == LUMPERROR)
{
if (strcmp(name, SKYFLATNAME))
@@ -1224,7 +1287,7 @@ INT32 R_CreateColormap(char *p1, char *p2, char *p3)
continue;
if (maskcolor == extra_colormaps[i].maskcolor
&& fadecolor == extra_colormaps[i].fadecolor
- && (float)maskamt == (float)extra_colormaps[i].maskamt
+ && fabs(maskamt - extra_colormaps[i].maskamt) < DBL_EPSILON
&& fadestart == extra_colormaps[i].fadestart
&& fadeend == extra_colormaps[i].fadeend
&& fog == extra_colormaps[i].fog)
diff --git a/src/r_data.h b/src/r_data.h
index e31484f6..640b3030 100644
--- a/src/r_data.h
+++ b/src/r_data.h
@@ -2,7 +2,7 @@
//-----------------------------------------------------------------------------
// Copyright (C) 1993-1996 by id Software, Inc.
// Copyright (C) 1998-2000 by DooM Legacy Team.
-// Copyright (C) 1999-2016 by Sonic Team Junior.
+// Copyright (C) 1999-2018 by Sonic Team Junior.
//
// This program is free software distributed under the
// terms of the GNU General Public License, version 2.
diff --git a/src/r_defs.h b/src/r_defs.h
index 25092ccc..52a3be80 100644
--- a/src/r_defs.h
+++ b/src/r_defs.h
@@ -2,7 +2,7 @@
//-----------------------------------------------------------------------------
// Copyright (C) 1993-1996 by id Software, Inc.
// Copyright (C) 1998-2000 by DooM Legacy Team.
-// Copyright (C) 1999-2016 by Sonic Team Junior.
+// Copyright (C) 1999-2018 by Sonic Team Junior.
//
// This program is free software distributed under the
// terms of the GNU General Public License, version 2.
@@ -573,6 +573,7 @@ typedef struct seg_s
sector_t *frontsector;
sector_t *backsector;
+ fixed_t length; // precalculated seg length
#ifdef HWRENDER
// new pointers so that AdjustSegs doesn't mess with v1/v2
void *pv1; // polyvertex_t
diff --git a/src/r_draw.c b/src/r_draw.c
index 60927434..02a91215 100644
--- a/src/r_draw.c
+++ b/src/r_draw.c
@@ -2,7 +2,7 @@
//-----------------------------------------------------------------------------
// Copyright (C) 1993-1996 by id Software, Inc.
// Copyright (C) 1998-2000 by DooM Legacy Team.
-// Copyright (C) 1999-2016 by Sonic Team Junior.
+// Copyright (C) 1999-2018 by Sonic Team Junior.
//
// This program is free software distributed under the
// terms of the GNU General Public License, version 2.
@@ -136,11 +136,13 @@ UINT32 nflatxshift, nflatyshift, nflatshiftup, nflatmask;
#define METALSONIC_TT_CACHE_INDEX (MAXSKINS + 2)
#define ALLWHITE_TT_CACHE_INDEX (MAXSKINS + 3)
#define RAINBOW_TT_CACHE_INDEX (MAXSKINS + 4)
+#define BLINK_TT_CACHE_INDEX (MAXSKINS + 5)
+#define TT_CACHE_SIZE (MAXSKINS + 6)
#define SKIN_RAMP_LENGTH 16
#define DEFAULT_STARTTRANSCOLOR 160
#define NUM_PALETTE_ENTRIES 256
-static UINT8** translationtablecache[MAXSKINS + 5] = {NULL};
+static UINT8** translationtablecache[TT_CACHE_SIZE] = {NULL};
// See also the enum skincolors_t
@@ -530,6 +532,7 @@ UINT8* R_GetTranslationColormap(INT32 skinnum, skincolors_t color, UINT8 flags)
else if (skinnum == TC_METALSONIC) skintableindex = METALSONIC_TT_CACHE_INDEX;
else if (skinnum == TC_ALLWHITE) skintableindex = ALLWHITE_TT_CACHE_INDEX;
else if (skinnum == TC_RAINBOW) skintableindex = RAINBOW_TT_CACHE_INDEX;
+ else if (skinnum == TC_BLINK) skintableindex = BLINK_TT_CACHE_INDEX;
else skintableindex = skinnum;
if (flags & GTC_CACHE)
diff --git a/src/r_draw.h b/src/r_draw.h
index 0ff19bc7..9a81a7f5 100644
--- a/src/r_draw.h
+++ b/src/r_draw.h
@@ -2,7 +2,7 @@
//-----------------------------------------------------------------------------
// Copyright (C) 1993-1996 by id Software, Inc.
// Copyright (C) 1998-2000 by DooM Legacy Team.
-// Copyright (C) 1999-2016 by Sonic Team Junior.
+// Copyright (C) 1999-2018 by Sonic Team Junior.
//
// This program is free software distributed under the
// terms of the GNU General Public License, version 2.
@@ -108,6 +108,7 @@ extern lumpnum_t viewborderlump[8];
#define TC_METALSONIC -3 // For Metal Sonic battle
#define TC_ALLWHITE -4 // For Cy-Brak-demon
#define TC_RAINBOW -5 // For invincibility power
+#define TC_BLINK -6 // For item blinking
// Initialize color translation tables, for player rendering etc.
void R_InitTranslationTables(void);
diff --git a/src/r_draw16.c b/src/r_draw16.c
index a922f4d0..918dd356 100644
--- a/src/r_draw16.c
+++ b/src/r_draw16.c
@@ -1,7 +1,7 @@
// SONIC ROBO BLAST 2
//-----------------------------------------------------------------------------
// Copyright (C) 1998-2000 by DooM Legacy Team.
-// Copyright (C) 1999-2016 by Sonic Team Junior.
+// Copyright (C) 1999-2018 by Sonic Team Junior.
//
// This program is free software distributed under the
// terms of the GNU General Public License, version 2.
diff --git a/src/r_draw8.c b/src/r_draw8.c
index 2fb2a8bd..634ae707 100644
--- a/src/r_draw8.c
+++ b/src/r_draw8.c
@@ -1,7 +1,7 @@
// SONIC ROBO BLAST 2
//-----------------------------------------------------------------------------
// Copyright (C) 1998-2000 by DooM Legacy Team.
-// Copyright (C) 1999-2016 by Sonic Team Junior.
+// Copyright (C) 1999-2018 by Sonic Team Junior.
//
// This program is free software distributed under the
// terms of the GNU General Public License, version 2.
diff --git a/src/r_local.h b/src/r_local.h
index a3dfe7df..1d318775 100644
--- a/src/r_local.h
+++ b/src/r_local.h
@@ -2,7 +2,7 @@
//-----------------------------------------------------------------------------
// Copyright (C) 1993-1996 by id Software, Inc.
// Copyright (C) 1998-2000 by DooM Legacy Team.
-// Copyright (C) 1999-2016 by Sonic Team Junior.
+// Copyright (C) 1999-2018 by Sonic Team Junior.
//
// This program is free software distributed under the
// terms of the GNU General Public License, version 2.
diff --git a/src/r_main.c b/src/r_main.c
index ff0f65ec..8b070e9e 100644
--- a/src/r_main.c
+++ b/src/r_main.c
@@ -2,7 +2,7 @@
//-----------------------------------------------------------------------------
// Copyright (C) 1993-1996 by id Software, Inc.
// Copyright (C) 1998-2000 by DooM Legacy Team.
-// Copyright (C) 1999-2016 by Sonic Team Junior.
+// Copyright (C) 1999-2018 by Sonic Team Junior.
//
// This program is free software distributed under the
// terms of the GNU General Public License, version 2.
@@ -408,6 +408,29 @@ fixed_t R_PointToDist(fixed_t x, fixed_t y)
return R_PointToDist2(viewx, viewy, x, y);
}
+angle_t R_PointToAngleEx(INT32 x2, INT32 y2, INT32 x1, INT32 y1)
+{
+ INT64 dx = x1-x2;
+ INT64 dy = y1-y2;
+ if (dx < INT32_MIN || dx > INT32_MAX || dy < INT32_MIN || dy > INT32_MAX)
+ {
+ x1 = (int)(dx / 2 + x2);
+ y1 = (int)(dy / 2 + y2);
+ }
+ return (y1 -= y2, (x1 -= x2) || y1) ?
+ x1 >= 0 ?
+ y1 >= 0 ?
+ (x1 > y1) ? tantoangle[SlopeDivEx(y1,x1)] : // octant 0
+ ANGLE_90-tantoangle[SlopeDivEx(x1,y1)] : // octant 1
+ x1 > (y1 = -y1) ? 0-tantoangle[SlopeDivEx(y1,x1)] : // octant 8
+ ANGLE_270+tantoangle[SlopeDivEx(x1,y1)] : // octant 7
+ y1 >= 0 ? (x1 = -x1) > y1 ? ANGLE_180-tantoangle[SlopeDivEx(y1,x1)] : // octant 3
+ ANGLE_90 + tantoangle[SlopeDivEx(x1,y1)] : // octant 2
+ (x1 = -x1) > (y1 = -y1) ? ANGLE_180+tantoangle[SlopeDivEx(y1,x1)] : // octant 4
+ ANGLE_270-tantoangle[SlopeDivEx(x1,y1)] : // octant 5
+ 0;
+}
+
//
// R_ScaleFromGlobalAngle
// Returns the texture mapping scale for the current line (horizontal span)
@@ -604,13 +627,11 @@ void R_SetViewSize(void)
//
void R_ExecuteSetViewSize(void)
{
- fixed_t cosadj;
fixed_t dy;
INT32 i;
INT32 j;
INT32 level;
INT32 startmapl;
- INT32 aspectx; //added : 02-02-98 : for aspect ratio calc. below...
setsizeneeded = false;
@@ -656,31 +677,22 @@ void R_ExecuteSetViewSize(void)
for (i = 0; i < viewwidth; i++)
screenheightarray[i] = (INT16)viewheight;
- // setup sky scaling (uses pspriteyscale)
+ // setup sky scaling
R_SetSkyScale();
// planes
- //aspectx = (((vid.height*centerx*BASEVIDWIDTH)/BASEVIDHEIGHT)/vid.width);
- aspectx = centerx;
-
if (rendermode == render_soft)
{
// this is only used for planes rendering in software mode
- j = viewheight*4;
+ j = viewheight*16;
for (i = 0; i < j; i++)
{
- dy = ((i - viewheight*2)<>ANGLETOFINESHIFT));
- distscale[i] = FixedDiv(FRACUNIT, cosadj);
- }
-
memset(scalelight, 0xFF, sizeof(scalelight));
// Calculate the light levels to use for each level/scale combination.
@@ -793,9 +805,28 @@ static mobj_t *viewmobj;
// WARNING: a should be unsigned but to add with 2048, it isn't!
#define AIMINGTODY(a) ((FINETANGENT((2048+(((INT32)a)>>ANGLETOFINESHIFT)) & FINEMASK)*160)>>FRACBITS)
-void R_SkyboxFrame(player_t *player)
+// recalc necessary stuff for mouseaiming
+// slopes are already calculated for the full possible view (which is 4*viewheight).
+// 18/08/18: (No it's actually 16*viewheight, thanks Jimita for finding this out)
+static void R_SetupFreelook(void)
{
INT32 dy = 0;
+ if (rendermode == render_soft)
+ {
+ // clip it in the case we are looking a hardware 90 degrees full aiming
+ // (lmps, network and use F12...)
+ G_SoftwareClipAimingPitch((INT32 *)&aimingangle);
+ dy = AIMINGTODY(aimingangle) * viewwidth/BASEVIDWIDTH;
+ yslope = &yslopetab[viewheight*8 - (viewheight/2 + dy)];
+ }
+ centery = (viewheight/2) + dy;
+ centeryfrac = centery< 2 && player == &players[fourthdisplayplayer])
@@ -1022,26 +1053,11 @@ void R_SkyboxFrame(player_t *player)
viewsin = FINESINE(viewangle>>ANGLETOFINESHIFT);
viewcos = FINECOSINE(viewangle>>ANGLETOFINESHIFT);
- // recalc necessary stuff for mouseaiming
- // slopes are already calculated for the full possible view (which is 4*viewheight).
-
- if (rendermode == render_soft)
- {
- // clip it in the case we are looking a hardware 90 degrees full aiming
- // (lmps, network and use F12...)
- G_SoftwareClipAimingPitch((INT32 *)&aimingangle);
-
- dy = AIMINGTODY(aimingangle) * viewwidth/BASEVIDWIDTH;
-
- yslope = &yslopetab[(3*viewheight/2) - dy];
- }
- centery = (viewheight/2) + dy;
- centeryfrac = centery<>ANGLETOFINESHIFT);
viewcos = FINECOSINE(viewangle>>ANGLETOFINESHIFT);
- // recalc necessary stuff for mouseaiming
- // slopes are already calculated for the full possible view (which is 4*viewheight).
-
- if (rendermode == render_soft)
- {
- // clip it in the case we are looking a hardware 90 degrees full aiming
- // (lmps, network and use F12...)
- G_SoftwareClipAimingPitch((INT32 *)&aimingangle);
-
- dy = AIMINGTODY(aimingangle) * viewwidth/BASEVIDWIDTH;
-
- yslope = &yslopetab[(3*viewheight/2) - dy];
- }
- centery = (viewheight/2) + dy;
- centeryfrac = centery<= vid.width) x1 = vid.width - 1;
+ angle = (currentplane->viewangle + currentplane->plangle)>>ANGLETOFINESHIFT;
+ planecos = FINECOSINE(angle);
+ planesin = FINESINE(angle);
+
if (planeheight != cachedheight[y])
{
cachedheight[y] = planeheight;
distance = cacheddistance[y] = FixedMul(planeheight, yslope[y]);
ds_xstep = cachedxstep[y] = FixedMul(distance, basexscale);
ds_ystep = cachedystep[y] = FixedMul(distance, baseyscale);
+
+ if ((span = abs(centery-y)))
+ {
+ ds_xstep = cachedxstep[y] = FixedMul(planesin, planeheight) / span;
+ ds_ystep = cachedystep[y] = FixedMul(planecos, planeheight) / span;
+ }
}
else
{
@@ -301,13 +296,8 @@ void R_MapPlane(INT32 y, INT32 x1, INT32 x2)
ds_ystep = cachedystep[y];
}
- length = FixedMul (distance,distscale[x1]);
- angle = (currentplane->viewangle + currentplane->plangle + xtoviewangle[x1])>>ANGLETOFINESHIFT;
- /// \note Wouldn't it be faster just to add viewx and viewy
- // to the plane's x/yoffs anyway??
-
- ds_xfrac = FixedMul(FINECOSINE(angle), length) + xoffs;
- ds_yfrac = yoffs - FixedMul(FINESINE(angle), length);
+ ds_xfrac = xoffs + FixedMul(planecos, distance) + (x1 - centerx) * ds_xstep;
+ ds_yfrac = yoffs - FixedMul(planesin, distance) + (x1 - centerx) * ds_ystep;
#ifndef NOWATER
if (itswater)
@@ -315,8 +305,9 @@ void R_MapPlane(INT32 y, INT32 x1, INT32 x2)
const INT32 yay = (wtofs + (distance>>9) ) & 8191;
// ripples da water texture
bgofs = FixedDiv(FINESINE(yay), (1<<12) + (distance>>11))>>FRACBITS;
+ angle = (currentplane->viewangle + currentplane->plangle + xtoviewangle[x1])>>ANGLETOFINESHIFT;
- angle = (angle + 2048) & 8191; //90�
+ angle = (angle + 2048) & 8191; // 90 degrees
ds_xfrac += FixedMul(FINECOSINE(angle), (bgofs<> LIGHTZSHIFT;
-
if (pindex >= MAXLIGHTZ)
pindex = MAXLIGHTZ - 1;
@@ -367,8 +357,6 @@ void R_MapPlane(INT32 y, INT32 x1, INT32 x2)
// R_ClearPlanes
// At begining of frame.
//
-// NOTE: Uses con_clipviewtop, so that when console is on,
-// we don't draw the part of the view hidden under the console.
void R_ClearPlanes(void)
{
INT32 i, p;
@@ -378,12 +366,12 @@ void R_ClearPlanes(void)
for (i = 0; i < viewwidth; i++)
{
floorclip[i] = (INT16)viewheight;
- ceilingclip[i] = (INT16)con_clipviewtop;
+ ceilingclip[i] = -1;
frontscale[i] = INT32_MAX;
for (p = 0; p < MAXFFLOORS; p++)
{
ffloor[p].f_clip[i] = (INT16)viewheight;
- ffloor[p].c_clip[i] = (INT16)con_clipviewtop;
+ ffloor[p].c_clip[i] = -1;
}
}
diff --git a/src/r_plane.h b/src/r_plane.h
index 9b25c65e..8f5a6073 100644
--- a/src/r_plane.h
+++ b/src/r_plane.h
@@ -2,7 +2,7 @@
//-----------------------------------------------------------------------------
// Copyright (C) 1993-1996 by id Software, Inc.
// Copyright (C) 1998-2000 by DooM Legacy Team.
-// Copyright (C) 1999-2016 by Sonic Team Junior.
+// Copyright (C) 1999-2018 by Sonic Team Junior.
//
// This program is free software distributed under the
// terms of the GNU General Public License, version 2.
@@ -21,7 +21,6 @@
//
// Now what is a visplane, anyway?
// Simple: kinda floor/ceiling polygon optimised for SRB2 rendering.
-// 7764 bytes! (for win32, anyway)
//
typedef struct visplane_s
{
@@ -39,25 +38,12 @@ typedef struct visplane_s
extracolormap_t *extra_colormap;
// leave pads for [minx-1]/[maxx+1]
-
- // words sucks .. should get rid of that.. but eats memory
- // THIS IS UNSIGNED! VERY IMPORTANT!!
- UINT16 pad1;
- UINT16 top[MAXVIDWIDTH];
- UINT16 pad2;
- UINT16 pad3;
- UINT16 bottom[MAXVIDWIDTH];
- UINT16 pad4;
-
+ UINT16 padtopstart, top[MAXVIDWIDTH], padtopend;
+ UINT16 padbottomstart, bottom[MAXVIDWIDTH], padbottomend;
INT32 high, low; // R_PlaneBounds should set these.
fixed_t xoffs, yoffs; // Scrolling flats.
- // SoM: frontscale should be stored in the first seg of the subsector
- // where the planes themselves are stored. I'm doing this now because
- // the old way caused trouble with the drawseg array was re-sized.
- INT32 scaleseg;
-
struct ffloor_s *ffloor;
#ifdef POLYOBJECTS_PLANES
polyobj_t *polyobj;
@@ -77,17 +63,15 @@ extern INT16 *lastopening, *openings;
extern size_t maxopenings;
extern INT16 floorclip[MAXVIDWIDTH], ceilingclip[MAXVIDWIDTH];
-extern fixed_t frontscale[MAXVIDWIDTH], yslopetab[MAXVIDHEIGHT*4];
+extern fixed_t frontscale[MAXVIDWIDTH], yslopetab[MAXVIDHEIGHT*16];
extern fixed_t cachedheight[MAXVIDHEIGHT];
extern fixed_t cacheddistance[MAXVIDHEIGHT];
extern fixed_t cachedxstep[MAXVIDHEIGHT];
extern fixed_t cachedystep[MAXVIDHEIGHT];
extern fixed_t basexscale, baseyscale;
-extern lighttable_t **planezlight;
-
extern fixed_t *yslope;
-extern fixed_t distscale[MAXVIDWIDTH];
+extern lighttable_t **planezlight;
void R_InitPlanes(void);
void R_PortalStoreClipValues(INT32 start, INT32 end, INT16 *ceil, INT16 *floor, fixed_t *scale);
@@ -136,8 +120,8 @@ typedef struct planemgr_s
#ifdef POLYOBJECTS_PLANES
polyobj_t *polyobj;
#endif
-} planemgr_t;
+} visffloor_t;
-extern planemgr_t ffloor[MAXFFLOORS];
+extern visffloor_t ffloor[MAXFFLOORS];
extern INT32 numffloors;
#endif
diff --git a/src/r_segs.c b/src/r_segs.c
index b85f6bc1..62c0523d 100644
--- a/src/r_segs.c
+++ b/src/r_segs.c
@@ -2,7 +2,7 @@
//-----------------------------------------------------------------------------
// Copyright (C) 1993-1996 by id Software, Inc.
// Copyright (C) 1998-2000 by DooM Legacy Team.
-// Copyright (C) 1999-2016 by Sonic Team Junior.
+// Copyright (C) 1999-2018 by Sonic Team Junior.
//
// This program is free software distributed under the
// terms of the GNU General Public License, version 2.
@@ -594,8 +594,8 @@ void R_RenderMaskedSegRange(drawseg_t *ds, INT32 x1, INT32 x2)
else
rlight->rcolormap = xwalllights[pindex];
- rlight->height += rlight->heightstep;
height = rlight->height;
+ rlight->height += rlight->heightstep;
if (height <= windowtop)
{
@@ -843,26 +843,21 @@ void R_RenderThickSideRange(drawseg_t *ds, INT32 x1, INT32 x2, ffloor_t *pfloor)
light = &frontsector->lightlist[i];
rlight = &dc_lightlist[p];
#ifdef ESLOPE
- if (light->slope) {
- leftheight = P_GetZAt(light->slope, ds->leftpos.x, ds->leftpos.y);
- rightheight = P_GetZAt(light->slope, ds->rightpos.x, ds->rightpos.y);
- } else
- leftheight = rightheight = light->height;
- if (*pfloor->b_slope) {
- pfloorleft = P_GetZAt(*pfloor->b_slope, ds->leftpos.x, ds->leftpos.y);
- pfloorright = P_GetZAt(*pfloor->b_slope, ds->rightpos.x, ds->rightpos.y);
- } else
- pfloorleft = pfloorright = *pfloor->bottomheight;
+#define SLOPEPARAMS(slope, end1, end2, normalheight) \
+ if (slope) { \
+ end1 = P_GetZAt(slope, ds->leftpos.x, ds->leftpos.y); \
+ end2 = P_GetZAt(slope, ds->rightpos.x, ds->rightpos.y); \
+ } else \
+ end1 = end2 = normalheight;
+
+ SLOPEPARAMS(light->slope, leftheight, rightheight, light->height)
+ SLOPEPARAMS(*pfloor->b_slope, pfloorleft, pfloorright, *pfloor->bottomheight)
if (leftheight < pfloorleft && rightheight < pfloorright)
continue;
- if (*pfloor->t_slope) {
- pfloorleft = P_GetZAt(*pfloor->t_slope, ds->leftpos.x, ds->leftpos.y);
- pfloorright = P_GetZAt(*pfloor->t_slope, ds->rightpos.x, ds->rightpos.y);
- } else
- pfloorleft = pfloorright = *pfloor->topheight;
+ SLOPEPARAMS(*pfloor->t_slope, pfloorleft, pfloorright, *pfloor->topheight)
if (leftheight > pfloorleft && rightheight > pfloorright && i+1 < dc_numlights)
{
@@ -875,17 +870,17 @@ void R_RenderThickSideRange(drawseg_t *ds, INT32 x1, INT32 x2, ffloor_t *pfloor)
leftheight -= viewz;
rightheight -= viewz;
- overflow_test = (INT64)centeryfrac - (((INT64)leftheight*ds->scale1)>>FRACBITS);
- if (overflow_test < 0) overflow_test = -overflow_test;
- if ((UINT64)overflow_test&0xFFFFFFFF80000000ULL) continue;
- overflow_test = (INT64)centeryfrac - (((INT64)rightheight*ds->scale2)>>FRACBITS);
- if (overflow_test < 0) overflow_test = -overflow_test;
- if ((UINT64)overflow_test&0xFFFFFFFF80000000ULL) continue;
+#define OVERFLOWTEST(height, scale) \
+ overflow_test = (INT64)centeryfrac - (((INT64)height*scale)>>FRACBITS); \
+ if (overflow_test < 0) overflow_test = -overflow_test; \
+ if ((UINT64)overflow_test&0xFFFFFFFF80000000ULL) continue;
+
+ OVERFLOWTEST(leftheight, ds->scale1)
+ OVERFLOWTEST(rightheight, ds->scale2)
rlight->height = (centeryfrac) - FixedMul(leftheight, ds->scale1);
rlight->heightstep = (centeryfrac) - FixedMul(rightheight, ds->scale2);
rlight->heightstep = (rlight->heightstep-rlight->height)/(range);
- rlight->height -= rlight->heightstep;
#else
if (light->height < *pfloor->bottomheight)
continue;
@@ -895,36 +890,28 @@ void R_RenderThickSideRange(drawseg_t *ds, INT32 x1, INT32 x2, ffloor_t *pfloor)
lheight = light->height;// > *pfloor->topheight ? *pfloor->topheight + FRACUNIT : light->height;
rlight->heightstep = -FixedMul (rw_scalestep, (lheight - viewz));
- rlight->height = (centeryfrac) - FixedMul((lheight - viewz), spryscale) - rlight->heightstep;
+ rlight->height = (centeryfrac) - FixedMul((lheight - viewz), spryscale);
#endif
rlight->flags = light->flags;
if (light->flags & FF_CUTLEVEL)
{
#ifdef ESLOPE
- if (*light->caster->b_slope) {
- leftheight = P_GetZAt(*light->caster->b_slope, ds->leftpos.x, ds->leftpos.y);
- rightheight = P_GetZAt(*light->caster->b_slope, ds->rightpos.x, ds->rightpos.y);
- } else
- leftheight = rightheight = *light->caster->bottomheight;
-
+ SLOPEPARAMS(*light->caster->b_slope, leftheight, rightheight, *light->caster->bottomheight)
+#undef SLOPEPARAMS
leftheight -= viewz;
rightheight -= viewz;
- overflow_test = (INT64)centeryfrac - (((INT64)leftheight*ds->scale1)>>FRACBITS);
- if (overflow_test < 0) overflow_test = -overflow_test;
- if ((UINT64)overflow_test&0xFFFFFFFF80000000ULL) continue;
- overflow_test = (INT64)centeryfrac - (((INT64)rightheight*ds->scale2)>>FRACBITS);
- if (overflow_test < 0) overflow_test = -overflow_test;
- if ((UINT64)overflow_test&0xFFFFFFFF80000000ULL) continue;
+ OVERFLOWTEST(leftheight, ds->scale1)
+ OVERFLOWTEST(rightheight, ds->scale2)
+#undef OVERFLOWTEST
rlight->botheight = (centeryfrac) - FixedMul(leftheight, ds->scale1);
rlight->botheightstep = (centeryfrac) - FixedMul(rightheight, ds->scale2);
rlight->botheightstep = (rlight->botheightstep-rlight->botheight)/(range);
- rlight->botheight -= rlight->botheightstep;
#else
lheight = *light->caster->bottomheight;// > *pfloor->topheight ? *pfloor->topheight + FRACUNIT : *light->caster->bottomheight;
rlight->botheightstep = -FixedMul (rw_scalestep, (lheight - viewz));
- rlight->botheight = (centeryfrac) - FixedMul((lheight - viewz), spryscale) - rlight->botheightstep;
+ rlight->botheight = (centeryfrac) - FixedMul((lheight - viewz), spryscale);
#endif
}
@@ -1107,6 +1094,46 @@ void R_RenderThickSideRange(drawseg_t *ds, INT32 x1, INT32 x2, ffloor_t *pfloor)
oldx = dc_x;
}
#endif
+ // Calculate bounds
+ // clamp the values if necessary to avoid overflows and rendering glitches caused by them
+
+#ifdef ESLOPE
+ if (top_frac > (INT64)CLAMPMAX) sprtopscreen = windowtop = CLAMPMAX;
+ else if (top_frac > (INT64)CLAMPMIN) sprtopscreen = windowtop = (fixed_t)top_frac;
+ else sprtopscreen = windowtop = CLAMPMIN;
+ if (bottom_frac > (INT64)CLAMPMAX) sprbotscreen = windowbottom = CLAMPMAX;
+ else if (bottom_frac > (INT64)CLAMPMIN) sprbotscreen = windowbottom = (fixed_t)bottom_frac;
+ else sprbotscreen = windowbottom = CLAMPMIN;
+
+ top_frac += top_step;
+ bottom_frac += bottom_step;
+#else
+ sprtopscreen = windowtop = (centeryfrac - FixedMul((dc_texturemid - offsetvalue), spryscale));
+ sprbotscreen = windowbottom = FixedMul(*pfloor->topheight - *pfloor->bottomheight, spryscale) + sprtopscreen;
+#endif
+
+ // SoM: If column is out of range, why bother with it??
+ if (windowbottom < topbounds || windowtop > bottombounds)
+ {
+ if (dc_numlights)
+ {
+ for (i = 0; i < dc_numlights; i++)
+ {
+ rlight = &dc_lightlist[i];
+ rlight->height += rlight->heightstep;
+ if (rlight->flags & FF_CUTLEVEL)
+ rlight->botheight += rlight->botheightstep;
+ }
+ }
+ spryscale += rw_scalestep;
+ continue;
+ }
+
+ dc_iscale = 0xffffffffu / (unsigned)spryscale;
+
+ // Get data for the column
+ col = (column_t *)((UINT8 *)R_GetColumn(texnum,maskedtexturecol[dc_x]) - 3);
+
// SoM: New code does not rely on R_DrawColumnShadowed_8 which
// will (hopefully) put less strain on the stack.
if (dc_numlights)
@@ -1117,40 +1144,6 @@ void R_RenderThickSideRange(drawseg_t *ds, INT32 x1, INT32 x2, ffloor_t *pfloor)
INT32 solid = 0;
INT32 lighteffect = 0;
-#ifdef ESLOPE
- if (top_frac > (INT64)CLAMPMAX) sprtopscreen = windowtop = CLAMPMAX;
- else if (top_frac > (INT64)CLAMPMIN) sprtopscreen = windowtop = (fixed_t)top_frac;
- else sprtopscreen = windowtop = CLAMPMIN;
- if (bottom_frac > (INT64)CLAMPMAX) sprbotscreen = windowbottom = CLAMPMAX;
- else if (bottom_frac > (INT64)CLAMPMIN) sprbotscreen = windowbottom = (fixed_t)bottom_frac;
- else sprbotscreen = windowbottom = CLAMPMIN;
-
- top_frac += top_step;
- bottom_frac += bottom_step;
-#else
- sprtopscreen = windowtop = (centeryfrac - FixedMul((dc_texturemid - offsetvalue), spryscale));
- sprbotscreen = windowbottom = FixedMul(*pfloor->topheight - *pfloor->bottomheight, spryscale) + sprtopscreen;
-#endif
-
- // SoM: If column is out of range, why bother with it??
- if (windowbottom < topbounds || windowtop > bottombounds)
- {
- for (i = 0; i < dc_numlights; i++)
- {
- rlight = &dc_lightlist[i];
- rlight->height += rlight->heightstep;
- if (rlight->flags & FF_CUTLEVEL)
- rlight->botheight += rlight->botheightstep;
- }
- spryscale += rw_scalestep;
- continue;
- }
-
- dc_iscale = 0xffffffffu / (unsigned)spryscale;
-
- // draw the texture
- col = (column_t *)((UINT8 *)R_GetColumn(texnum,maskedtexturecol[dc_x]) - 3);
-
for (i = 0; i < dc_numlights; i++)
{
// Check if the current light effects the colormap/lightlevel
@@ -1169,7 +1162,7 @@ void R_RenderThickSideRange(drawseg_t *ds, INT32 x1, INT32 x2, ffloor_t *pfloor)
pindex = FixedMul(spryscale, FixedDiv(640, vid.width))>>LIGHTSCALESHIFT;
- if (pindex >= MAXLIGHTSCALE)
+ if (pindex >= MAXLIGHTSCALE)
pindex = MAXLIGHTSCALE-1;
if (pfloor->flags & FF_FOG)
@@ -1208,13 +1201,13 @@ void R_RenderThickSideRange(drawseg_t *ds, INT32 x1, INT32 x2, ffloor_t *pfloor)
else
solid = 0;
- rlight->height += rlight->heightstep;
height = rlight->height;
+ rlight->height += rlight->heightstep;
if (solid)
{
- rlight->botheight += rlight->botheightstep;
bheight = rlight->botheight - (FRACUNIT >> 1);
+ rlight->botheight += rlight->botheightstep;
}
if (height <= windowtop)
@@ -1234,6 +1227,7 @@ void R_RenderThickSideRange(drawseg_t *ds, INT32 x1, INT32 x2, ffloor_t *pfloor)
if (windowbottom >= sprbotscreen)
{
windowbottom = sprbotscreen;
+ // draw the texture
colfunc_2s (col);
for (i++; i < dc_numlights; i++)
{
@@ -1244,6 +1238,7 @@ void R_RenderThickSideRange(drawseg_t *ds, INT32 x1, INT32 x2, ffloor_t *pfloor)
}
continue;
}
+ // draw the texture
colfunc_2s (col);
if (solid)
windowtop = bheight;
@@ -1257,6 +1252,7 @@ void R_RenderThickSideRange(drawseg_t *ds, INT32 x1, INT32 x2, ffloor_t *pfloor)
}
}
windowbottom = sprbotscreen;
+ // draw the texture, if there is any space left
if (windowtop < windowbottom)
colfunc_2s (col);
@@ -1271,33 +1267,16 @@ void R_RenderThickSideRange(drawseg_t *ds, INT32 x1, INT32 x2, ffloor_t *pfloor)
pindex = MAXLIGHTSCALE - 1;
dc_colormap = walllights[pindex];
+
if (encoremap && !(curline->linedef->flags & ML_TFERLINE))
dc_colormap += (256*32);
- if (frontsector->extra_colormap)
- dc_colormap = frontsector->extra_colormap->colormap + (dc_colormap - colormaps);
+
if (pfloor->flags & FF_FOG && pfloor->master->frontsector->extra_colormap)
dc_colormap = pfloor->master->frontsector->extra_colormap->colormap + (dc_colormap - colormaps);
-
-#ifdef ESLOPE
- if (top_frac > (INT64)CLAMPMAX) sprtopscreen = windowtop = CLAMPMAX;
- else if (top_frac > (INT64)CLAMPMIN) sprtopscreen = windowtop = (fixed_t)top_frac;
- else sprtopscreen = windowtop = CLAMPMIN;
- if (bottom_frac > (INT64)CLAMPMAX) sprbotscreen = windowbottom = CLAMPMAX;
- else if (bottom_frac > (INT64)CLAMPMIN) sprbotscreen = windowbottom = (fixed_t)bottom_frac;
- else sprbotscreen = windowbottom = CLAMPMIN;
-
- top_frac += top_step;
- bottom_frac += bottom_step;
-#else
- sprtopscreen = windowtop = (centeryfrac - FixedMul((dc_texturemid - offsetvalue), spryscale));
- sprbotscreen = windowbottom = FixedMul(*pfloor->topheight - *pfloor->bottomheight, spryscale) + sprtopscreen;
-#endif
-
- dc_iscale = 0xffffffffu / (unsigned)spryscale;
+ else if (frontsector->extra_colormap)
+ dc_colormap = frontsector->extra_colormap->colormap + (dc_colormap - colormaps);
// draw the texture
- col = (column_t *)((UINT8 *)R_GetColumn(texnum,maskedtexturecol[dc_x]) - 3);
-
colfunc_2s (col);
spryscale += rw_scalestep;
}
@@ -1384,24 +1363,12 @@ static void R_RenderSegLoop (void)
if (markfloor)
{
-#if 0 // Old Doom Legacy code
- bottom = floorclip[rw_x]-1;
- if (top <= ceilingclip[rw_x])
- top = ceilingclip[rw_x]+1;
- if (top <= bottom && floorplane)
- {
- floorplane->top[rw_x] = (INT16)top;
- floorplane->bottom[rw_x] = (INT16)bottom;
- }
-#else // Spiffy new PRBoom code
- top = yh < ceilingclip[rw_x] ? ceilingclip[rw_x] : yh;
-
+ top = yh < ceilingclip[rw_x] ? ceilingclip[rw_x] : yh;
if (++top <= bottom && floorplane)
{
floorplane->top[rw_x] = (INT16)top;
floorplane->bottom[rw_x] = (INT16)bottom;
}
-#endif
}
if (numffloors)
@@ -1687,26 +1654,11 @@ static void R_RenderSegLoop (void)
}
for (i = 0; i < numffloors; i++)
- {
-#ifdef POLYOBJECTS_PLANES
- if (ffloor[i].polyobj && (!curline->polyseg || ffloor[i].polyobj != curline->polyseg))
- continue;
-#endif
-
ffloor[i].f_frac += ffloor[i].f_step;
- }
for (i = 0; i < numbackffloors; i++)
{
- INT32 y_w;
-
-#ifdef POLYOBJECTS_PLANES
- if (ffloor[i].polyobj && (!curline->polyseg || ffloor[i].polyobj != curline->polyseg))
- continue;
-#endif
- y_w = ffloor[i].b_frac >> HEIGHTBITS;
-
- ffloor[i].f_clip[rw_x] = ffloor[i].c_clip[rw_x] = (INT16)(y_w & 0xFFFF);
+ ffloor[i].f_clip[rw_x] = ffloor[i].c_clip[rw_x] = (INT16)((ffloor[i].b_frac >> HEIGHTBITS) & 0xFFFF);
ffloor[i].b_frac += ffloor[i].b_step;
}
@@ -1716,6 +1668,23 @@ static void R_RenderSegLoop (void)
}
}
+// Uses precalculated seg->length
+static INT64 R_CalcSegDist(seg_t* seg, INT64 x2, INT64 y2)
+{
+ if (!seg->linedef->dy)
+ return llabs(y2 - seg->v1->y);
+ else if (!seg->linedef->dx)
+ return llabs(x2 - seg->v1->x);
+ else
+ {
+ INT64 dx = (seg->v2->x)-(seg->v1->x);
+ INT64 dy = (seg->v2->y)-(seg->v1->y);
+ INT64 vdx = x2-(seg->v1->x);
+ INT64 vdy = y2-(seg->v1->y);
+ return ((dy*vdx)-(dx*vdy))/(seg->length);
+ }
+}
+
//
// R_StoreWallRange
// A wall segment will be drawn
@@ -1726,6 +1695,7 @@ void R_StoreWallRange(INT32 start, INT32 stop)
fixed_t hyp;
fixed_t sineval;
angle_t distangle, offsetangle;
+ boolean longboi;
#ifndef ESLOPE
fixed_t vtop;
#endif
@@ -1771,10 +1741,15 @@ void R_StoreWallRange(INT32 start, INT32 stop)
offsetangle = ANGLE_90;
distangle = ANGLE_90 - offsetangle;
- hyp = R_PointToDist (curline->v1->x, curline->v1->y);
sineval = FINESINE(distangle>>ANGLETOFINESHIFT);
- rw_distance = FixedMul (hyp, sineval);
+ hyp = R_PointToDist(curline->v1->x, curline->v1->y);
+ rw_distance = FixedMul(hyp, sineval);
+ longboi = (hyp >= INT32_MAX);
+
+ // big room fix
+ if (longboi)
+ rw_distance = (fixed_t)R_CalcSegDist(curline,viewx,viewy);
ds_p->x1 = rw_x = start;
ds_p->x2 = stop;
@@ -2634,8 +2609,18 @@ void R_StoreWallRange(INT32 start, INT32 stop)
if (offsetangle > ANGLE_90)
offsetangle = ANGLE_90;
- sineval = FINESINE(offsetangle >>ANGLETOFINESHIFT);
- rw_offset = FixedMul (hyp, sineval);
+ sineval = FINESINE(offsetangle>>ANGLETOFINESHIFT);
+ rw_offset = FixedMul(hyp, sineval);
+
+ // big room fix
+ if (longboi)
+ {
+ INT64 dx = (curline->v2->x)-(curline->v1->x);
+ INT64 dy = (curline->v2->y)-(curline->v1->y);
+ INT64 vdx = viewx-(curline->v1->x);
+ INT64 vdy = viewy-(curline->v1->y);
+ rw_offset = ((dx*vdx-dy*vdy))/(curline->length);
+ }
if (rw_normalangle-rw_angle1 < ANGLE_180)
rw_offset = -rw_offset;
@@ -2826,11 +2811,6 @@ void R_StoreWallRange(INT32 start, INT32 stop)
{
for (i = 0; i < numffloors; i++)
{
-#ifdef POLYOBJECTS_PLANES
- if (ffloor[i].polyobj && (!curline->polyseg || ffloor[i].polyobj != curline->polyseg))
- continue;
-#endif
-
ffloor[i].f_pos >>= 4;
#ifdef ESLOPE
ffloor[i].f_pos_slope >>= 4;
@@ -3111,7 +3091,12 @@ void R_StoreWallRange(INT32 start, INT32 stop)
if (ceilingplane) //SoM: 3/29/2000: Check for null ceiling planes
ceilingplane = R_CheckPlane (ceilingplane, rw_x, rw_stopx-1);
else
- markceiling = 0;
+ markceiling = false;
+
+ // Don't mark ceiling flat lines for polys unless this line has an upper texture, otherwise we get flat leakage pulling downward
+ // (If it DOES have an upper texture and we do this, the ceiling won't render at all)
+ if (curline->polyseg && !curline->sidedef->toptexture)
+ markceiling = false;
}
// get a new or use the same visplane
@@ -3120,7 +3105,12 @@ void R_StoreWallRange(INT32 start, INT32 stop)
if (floorplane) //SoM: 3/29/2000: Check for null planes
floorplane = R_CheckPlane (floorplane, rw_x, rw_stopx-1);
else
- markfloor = 0;
+ markfloor = false;
+
+ // Don't mark floor flat lines for polys unless this line has a lower texture, otherwise we get flat leakage pulling upward
+ // (If it DOES have a lower texture and we do this, the floor won't render at all)
+ if (curline->polyseg && !curline->sidedef->bottomtexture)
+ markfloor = false;
}
ds_p->numffloorplanes = 0;
diff --git a/src/r_segs.h b/src/r_segs.h
index 4187d36e..92d0100e 100644
--- a/src/r_segs.h
+++ b/src/r_segs.h
@@ -2,7 +2,7 @@
//-----------------------------------------------------------------------------
// Copyright (C) 1993-1996 by id Software, Inc.
// Copyright (C) 1998-2000 by DooM Legacy Team.
-// Copyright (C) 1999-2016 by Sonic Team Junior.
+// Copyright (C) 1999-2018 by Sonic Team Junior.
//
// This program is free software distributed under the
// terms of the GNU General Public License, version 2.
diff --git a/src/r_sky.c b/src/r_sky.c
index ede1df04..fe1630e9 100644
--- a/src/r_sky.c
+++ b/src/r_sky.c
@@ -2,7 +2,7 @@
//-----------------------------------------------------------------------------
// Copyright (C) 1993-1996 by id Software, Inc.
// Copyright (C) 1998-2000 by DooM Legacy Team.
-// Copyright (C) 1999-2016 by Sonic Team Junior.
+// Copyright (C) 1999-2018 by Sonic Team Junior.
//
// This program is free software distributed under the
// terms of the GNU General Public License, version 2.
diff --git a/src/r_sky.h b/src/r_sky.h
index aa4bda37..86b61559 100644
--- a/src/r_sky.h
+++ b/src/r_sky.h
@@ -2,7 +2,7 @@
//-----------------------------------------------------------------------------
// Copyright (C) 1993-1996 by id Software, Inc.
// Copyright (C) 1998-2000 by DooM Legacy Team.
-// Copyright (C) 1999-2016 by Sonic Team Junior.
+// Copyright (C) 1999-2018 by Sonic Team Junior.
//
// This program is free software distributed under the
// terms of the GNU General Public License, version 2.
diff --git a/src/r_splats.c b/src/r_splats.c
index f6d7e78f..9ab67127 100644
--- a/src/r_splats.c
+++ b/src/r_splats.c
@@ -1,7 +1,7 @@
// SONIC ROBO BLAST 2
//-----------------------------------------------------------------------------
// Copyright (C) 1998-2000 by DooM Legacy Team.
-// Copyright (C) 1999-2016 by Sonic Team Junior.
+// Copyright (C) 1999-2018 by Sonic Team Junior.
//
// This program is free software distributed under the
// terms of the GNU General Public License, version 2.
@@ -365,9 +365,8 @@ static void R_RenderFloorSplat(floorsplat_t *pSplat, vertex_t *verts, UINT8 *pTe
#else
lighttable_t **planezlight;
fixed_t planeheight;
- angle_t angle;
- fixed_t distance;
- fixed_t length;
+ angle_t angle, planecos, planesin;
+ fixed_t distance, span;
size_t indexr;
INT32 light;
#endif
@@ -473,12 +472,22 @@ static void R_RenderFloorSplat(floorsplat_t *pSplat, vertex_t *verts, UINT8 *pTe
if (x2 >= vid.width)
x2 = vid.width - 1;
+ angle = (currentplane->viewangle + currentplane->plangle)>>ANGLETOFINESHIFT;
+ planecos = FINECOSINE(angle);
+ planesin = FINESINE(angle);
+
if (planeheight != cachedheight[y])
{
cachedheight[y] = planeheight;
distance = cacheddistance[y] = FixedMul(planeheight, yslope[y]);
ds_xstep = cachedxstep[y] = FixedMul(distance,basexscale);
ds_ystep = cachedystep[y] = FixedMul(distance,baseyscale);
+
+ if ((span = abs(centery-y)))
+ {
+ ds_xstep = cachedxstep[y] = FixedMul(planesin, planeheight) / span;
+ ds_ystep = cachedystep[y] = FixedMul(planecos, planeheight) / span;
+ }
}
else
{
@@ -486,10 +495,9 @@ static void R_RenderFloorSplat(floorsplat_t *pSplat, vertex_t *verts, UINT8 *pTe
ds_xstep = cachedxstep[y];
ds_ystep = cachedystep[y];
}
- length = FixedMul(distance, distscale[x1]);
- angle = (viewangle + xtoviewangle[x1])>>ANGLETOFINESHIFT;
- ds_xfrac = viewx + FixedMul(FINECOSINE(angle), length);
- ds_yfrac = -viewy - FixedMul(FINESINE(angle), length);
+
+ ds_xfrac = xoffs + FixedMul(planecos, distance) + (x1 - centerx) * ds_xstep;
+ ds_yfrac = yoffs - FixedMul(planesin, distance) + (x1 - centerx) * ds_ystep;
ds_xfrac -= offsetx;
ds_yfrac += offsety;
diff --git a/src/r_splats.h b/src/r_splats.h
index 349d8fa7..387b2958 100644
--- a/src/r_splats.h
+++ b/src/r_splats.h
@@ -1,7 +1,7 @@
// SONIC ROBO BLAST 2
//-----------------------------------------------------------------------------
// Copyright (C) 1998-2000 by DooM Legacy Team.
-// Copyright (C) 1999-2016 by Sonic Team Junior.
+// Copyright (C) 1999-2018 by Sonic Team Junior.
//
// This program is free software distributed under the
// terms of the GNU General Public License, version 2.
diff --git a/src/r_state.h b/src/r_state.h
index b2929237..d6d123e9 100644
--- a/src/r_state.h
+++ b/src/r_state.h
@@ -2,7 +2,7 @@
//-----------------------------------------------------------------------------
// Copyright (C) 1993-1996 by id Software, Inc.
// Copyright (C) 1998-2000 by DooM Legacy Team.
-// Copyright (C) 1999-2016 by Sonic Team Junior.
+// Copyright (C) 1999-2018 by Sonic Team Junior.
//
// This program is free software distributed under the
// terms of the GNU General Public License, version 2.
diff --git a/src/r_things.c b/src/r_things.c
index 54b20e17..d6234d4b 100644
--- a/src/r_things.c
+++ b/src/r_things.c
@@ -2,7 +2,7 @@
//-----------------------------------------------------------------------------
// Copyright (C) 1993-1996 by id Software, Inc.
// Copyright (C) 1998-2000 by DooM Legacy Team.
-// Copyright (C) 1999-2016 by Sonic Team Junior.
+// Copyright (C) 1999-2018 by Sonic Team Junior.
//
// This program is free software distributed under the
// terms of the GNU General Public License, version 2.
@@ -375,21 +375,28 @@ void R_AddSpriteDefs(UINT16 wadnum)
UINT16 start, end;
char wadname[MAX_WADPATH];
- // find the sprites section in this pwad
- // we need at least the S_END
- // (not really, but for speedup)
+ switch (wadfiles[wadnum]->type)
+ {
+ case RET_WAD:
+ start = W_CheckNumForNamePwad("S_START", wadnum, 0);
+ if (start == INT16_MAX)
+ start = W_CheckNumForNamePwad("SS_START", wadnum, 0); //deutex compatib.
+ if (start == INT16_MAX)
+ start = 0; //let say S_START is lump 0
+ else
+ start++; // just after S_START
+ end = W_CheckNumForNamePwad("S_END",wadnum,start);
+ if (end == INT16_MAX)
+ end = W_CheckNumForNamePwad("SS_END",wadnum,start); //deutex compatib.
+ break;
+ case RET_PK3:
+ start = W_CheckNumForFolderStartPK3("Sprites/", wadnum, 0);
+ end = W_CheckNumForFolderEndPK3("Sprites/", wadnum, start);
+ break;
+ default:
+ return;
+ }
- start = W_CheckNumForNamePwad("S_START", wadnum, 0);
- if (start == INT16_MAX)
- start = W_CheckNumForNamePwad("SS_START", wadnum, 0); //deutex compatib.
- if (start == INT16_MAX)
- start = 0; //let say S_START is lump 0
- else
- start++; // just after S_START
-
- end = W_CheckNumForNamePwad("S_END",wadnum,start);
- if (end == INT16_MAX)
- end = W_CheckNumForNamePwad("SS_END",wadnum,start); //deutex compatib.
if (end == INT16_MAX)
{
CONS_Debug(DBG_SETUP, "no sprites in pwad %d\n", wadnum);
@@ -1920,7 +1927,7 @@ static void R_CreateDrawNodes(void)
plane = ds->curline->polyseg->visplane;
R_PlaneBounds(plane);
- if (plane->low < con_clipviewtop || plane->high > vid.height || plane->high > plane->low)
+ if (plane->low < 0 || plane->high > vid.height || plane->high > plane->low)
;
else {
// Put it in!
@@ -1949,7 +1956,7 @@ static void R_CreateDrawNodes(void)
plane = ds->ffloorplanes[p];
R_PlaneBounds(plane);
- if (plane->low < con_clipviewtop || plane->high > vid.height || plane->high > plane->low || plane->polyobj)
+ if (plane->low < 0 || plane->high > vid.height || plane->high > plane->low || plane->polyobj)
{
ds->ffloorplanes[p] = NULL;
continue;
@@ -1986,7 +1993,7 @@ static void R_CreateDrawNodes(void)
plane = PolyObjects[i].visplane;
R_PlaneBounds(plane);
- if (plane->low < con_clipviewtop || plane->high > vid.height || plane->high > plane->low)
+ if (plane->low < 0 || plane->high > vid.height || plane->high > plane->low)
{
PolyObjects[i].visplane = NULL;
continue;
@@ -2493,7 +2500,7 @@ void R_DrawMasked(void)
// ==========================================================================
INT32 numskins = 0;
-skin_t skins[MAXSKINS+1];
+skin_t skins[MAXSKINS];
// FIXTHIS: don't work because it must be inistilised before the config load
//#define SKINVALUES
#ifdef SKINVALUES
@@ -2680,13 +2687,6 @@ void SetPlayerSkinByNum(INT32 playernum, INT32 skinnum)
// SRB2kart
player->kartspeed = skin->kartspeed;
player->kartweight = skin->kartweight;
-
- // Cheat Checks
- if (player->kartspeed < 1) player->kartspeed = 1;
- if (player->kartspeed > 9) player->kartspeed = 9;
- if (player->kartweight < 1) player->kartweight = 1;
- if (player->kartweight > 9) player->kartweight = 9;
- //
player->normalspeed = skin->normalspeed;
player->runspeed = skin->runspeed;
@@ -2771,7 +2771,7 @@ void R_AddSkins(UINT16 wadnum)
// advance by default
lastlump = lump + 1;
- if (numskins > MAXSKINS)
+ if (numskins >= MAXSKINS)
{
CONS_Debug(DBG_RENDER, "ignored skin (%d skins maximum)\n", MAXSKINS);
continue; // so we know how many skins couldn't be added
@@ -2911,15 +2911,22 @@ void R_AddSkins(UINT16 wadnum)
#undef GETSPEED
#define GETINT(field) else if (!stricmp(stoken, #field)) skin->field = atoi(value);
- // SRB2kart
- GETINT(kartspeed)
- GETINT(kartweight)
- //
GETINT(thrustfactor)
GETINT(accelstart)
GETINT(acceleration)
#undef GETINT
+#define GETKARTSTAT(field) \
+ else if (!stricmp(stoken, #field)) \
+ { \
+ skin->field = atoi(value); \
+ if (skin->field < 1) skin->field = 1; \
+ if (skin->field > 9) skin->field = 9; \
+ }
+ GETKARTSTAT(kartspeed)
+ GETKARTSTAT(kartweight)
+#undef GETKARTSTAT
+
// custom translation table
else if (!stricmp(stoken, "startcolor"))
skin->starttranscolor = atoi(value);
diff --git a/src/r_things.h b/src/r_things.h
index a7542e2f..53784415 100644
--- a/src/r_things.h
+++ b/src/r_things.h
@@ -2,7 +2,7 @@
//-----------------------------------------------------------------------------
// Copyright (C) 1993-1996 by id Software, Inc.
// Copyright (C) 1998-2000 by DooM Legacy Team.
-// Copyright (C) 1999-2016 by Sonic Team Junior.
+// Copyright (C) 1999-2018 by Sonic Team Junior.
//
// This program is free software distributed under the
// terms of the GNU General Public License, version 2.
@@ -192,7 +192,7 @@ typedef struct drawnode_s
} drawnode_t;
extern INT32 numskins;
-extern skin_t skins[MAXSKINS + 1];
+extern skin_t skins[MAXSKINS];
void SetPlayerSkin(INT32 playernum,const char *skinname);
void SetPlayerSkinByNum(INT32 playernum,INT32 skinnum); // Tails 03-16-2002
@@ -231,6 +231,7 @@ FUNCMATH FUNCINLINE static ATTRINLINE char R_Frame2Char(UINT8 frame)
FUNCMATH FUNCINLINE static ATTRINLINE UINT8 R_Char2Frame(char cn)
{
#if 1 // 2.1 compat
+ if (cn == '+') return '\\' - 'A'; // PK3 can't use backslash, so use + instead
return cn - 'A';
#else
if (cn >= 'A' && cn <= 'Z') return cn - 'A';
diff --git a/src/s_sound.c b/src/s_sound.c
index 422a00a1..856aa045 100644
--- a/src/s_sound.c
+++ b/src/s_sound.c
@@ -2,7 +2,7 @@
//-----------------------------------------------------------------------------
// Copyright (C) 1993-1996 by id Software, Inc.
// Copyright (C) 1998-2000 by DooM Legacy Team.
-// Copyright (C) 1999-2016 by Sonic Team Junior.
+// Copyright (C) 1999-2018 by Sonic Team Junior.
//
// This program is free software distributed under the
// terms of the GNU General Public License, version 2.
@@ -50,6 +50,13 @@ static void SetChannelsNum(void);
static void Command_Tunes_f(void);
static void Command_RestartAudio_f(void);
+// Sound system toggles
+#ifndef NO_MIDI
+static void GameMIDIMusic_OnChange(void);
+#endif
+static void GameSounds_OnChange(void);
+static void GameDigiMusic_OnChange(void);
+
// commands for music and sound servers
#ifdef MUSSERV
consvar_t musserver_cmd = {"musserver_cmd", "musserver", CV_SAVE, NULL, NULL, 0, NULL, NULL, 0, 0, NULL};
@@ -94,7 +101,14 @@ consvar_t cv_numChannels = {"snd_channels", "64", CV_SAVE|CV_CALL, CV_Unsigned,
#endif
consvar_t surround = {"surround", "Off", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL};
-consvar_t cv_resetmusic = {"resetmusic", "No", CV_SAVE|CV_NOSHOWHELP, CV_YesNo, NULL, 0, NULL, NULL, 0, 0, NULL};
+//consvar_t cv_resetmusic = {"resetmusic", "No", CV_SAVE|CV_NOSHOWHELP, CV_YesNo, NULL, 0, NULL, NULL, 0, 0, NULL};
+
+// Sound system toggles, saved into the config
+consvar_t cv_gamedigimusic = {"digimusic", "On", CV_SAVE|CV_CALL|CV_NOINIT, CV_OnOff, GameDigiMusic_OnChange, 0, NULL, NULL, 0, 0, NULL};
+#ifndef NO_MIDI
+consvar_t cv_gamemidimusic = {"midimusic", "On", CV_SAVE|CV_CALL|CV_NOINIT, CV_OnOff, GameMIDIMusic_OnChange, 0, NULL, NULL, 0, 0, NULL};
+#endif
+consvar_t cv_gamesounds = {"sounds", "On", CV_SAVE|CV_CALL|CV_NOINIT, CV_OnOff, GameSounds_OnChange, 0, NULL, NULL, 0, 0, NULL};
#define S_MAX_VOLUME 127
@@ -249,7 +263,12 @@ void S_RegisterSoundStuff(void)
#endif
CV_RegisterVar(&surround);
CV_RegisterVar(&cv_samplerate);
- CV_RegisterVar(&cv_resetmusic);
+ //CV_RegisterVar(&cv_resetmusic);
+ CV_RegisterVar(&cv_gamesounds);
+ CV_RegisterVar(&cv_gamedigimusic);
+#ifndef NO_MIDI
+ CV_RegisterVar(&cv_gamemidimusic);
+#endif
COM_AddCommand("tunes", Command_Tunes_f);
COM_AddCommand("restartaudio", Command_RestartAudio_f);
@@ -1199,7 +1218,7 @@ fixed_t S_CalculateSoundDistance(fixed_t sx1, fixed_t sy1, fixed_t sz1, fixed_t
approx_dist <<= FRACBITS;
- return approx_dist;
+ return FixedDiv(approx_dist, mapobjectscale); // approx_dist
}
//
@@ -1522,6 +1541,210 @@ static void *music_data;
static UINT16 music_flags;
static boolean music_looping;
+/// ------------------------
+/// Music Definitions
+/// ------------------------
+
+musicdef_t *musicdefstart = NULL; // First music definition
+struct cursongcredit cursongcredit; // Currently displayed song credit info
+
+//
+// search for music definition in wad
+//
+static UINT16 W_CheckForMusicDefInPwad(UINT16 wadid)
+{
+ UINT16 i;
+ lumpinfo_t *lump_p;
+
+ lump_p = wadfiles[wadid]->lumpinfo;
+ for (i = 0; i < wadfiles[wadid]->numlumps; i++, lump_p++)
+ if (memcmp(lump_p->name, "MUSICDEF", 8) == 0)
+ return i;
+
+ return INT16_MAX; // not found
+}
+
+void S_LoadMusicDefs(UINT16 wadnum)
+{
+ UINT16 lump;
+ char *buf;
+ char *buf2;
+ char *stoken;
+ char *value;
+ size_t size;
+ musicdef_t *def, *prev;
+ UINT16 line = 1; // for better error msgs
+
+ lump = W_CheckForMusicDefInPwad(wadnum);
+ if (lump == INT16_MAX)
+ return;
+
+ buf = W_CacheLumpNumPwad(wadnum, lump, PU_CACHE);
+ size = W_LumpLengthPwad(wadnum, lump);
+
+ // for strtok
+ buf2 = malloc(size+1);
+ if (!buf2)
+ I_Error("S_LoadMusicDefs: No more free memory\n");
+ M_Memcpy(buf2,buf,size);
+ buf2[size] = '\0';
+
+ def = prev = NULL;
+
+ stoken = strtok (buf2, "\r\n ");
+ // Find music def
+ while (stoken)
+ {
+ /*if ((stoken[0] == '/' && stoken[1] == '/')
+ || (stoken[0] == '#')) // skip comments
+ {
+ stoken = strtok(NULL, "\r\n"); // skip end of line
+ if (def)
+ stoken = strtok(NULL, "\r\n= ");
+ else
+ stoken = strtok(NULL, "\r\n ");
+ line++;
+ }
+ else*/ if (!stricmp(stoken, "lump"))
+ {
+ value = strtok(NULL, "\r\n ");
+
+ if (!value)
+ {
+ CONS_Alert(CONS_WARNING, "MUSICDEF: Lump '%s' is missing name. (file %s, line %d)\n", stoken, wadfiles[wadnum]->filename, line);
+ stoken = strtok(NULL, "\r\n"); // skip end of line
+ goto skip_lump;
+ }
+
+ // No existing musicdefs
+ if (!musicdefstart)
+ {
+ musicdefstart = Z_Calloc(sizeof (musicdef_t), PU_STATIC, NULL);
+ STRBUFCPY(musicdefstart->name, value);
+ strlwr(musicdefstart->name);
+ def = musicdefstart;
+ //CONS_Printf("S_LoadMusicDefs: Initialized musicdef w/ song '%s'\n", def->name);
+ }
+ else
+ {
+ def = musicdefstart;
+
+ // Search if this is a replacement
+ //CONS_Printf("S_LoadMusicDefs: Searching for song replacement...\n");
+ while (def)
+ {
+ if (!stricmp(def->name, value))
+ {
+ //CONS_Printf("S_LoadMusicDefs: Found song replacement '%s'\n", def->name);
+ break;
+ }
+
+ prev = def;
+ def = def->next;
+ }
+
+ // Nothing found, add to the end.
+ if (!def)
+ {
+ def = Z_Calloc(sizeof (musicdef_t), PU_STATIC, NULL);
+ STRBUFCPY(def->name, value);
+ strlwr(def->name);
+ if (prev != NULL)
+ prev->next = def;
+ //CONS_Printf("S_LoadMusicDefs: Added song '%s'\n", def->name);
+ }
+ }
+
+skip_lump:
+ stoken = strtok(NULL, "\r\n ");
+ line++;
+ }
+ else
+ {
+ value = strtok(NULL, "\r\n= ");
+
+ if (!value)
+ {
+ CONS_Alert(CONS_WARNING, "MUSICDEF: Field '%s' is missing value. (file %s, line %d)\n", stoken, wadfiles[wadnum]->filename, line);
+ stoken = strtok(NULL, "\r\n"); // skip end of line
+ goto skip_field;
+ }
+
+ if (!def)
+ {
+ CONS_Alert(CONS_ERROR, "MUSICDEF: No music definition before field '%s'. (file %s, line %d)\n", stoken, wadfiles[wadnum]->filename, line);
+ free(buf2);
+ return;
+ }
+
+ if (!stricmp(stoken, "usage")) {
+#if 0 // Ignore for now
+ STRBUFCPY(def->usage, value);
+ for (value = def->usage; *value; value++)
+ if (*value == '_') *value = ' '; // turn _ into spaces.
+ //CONS_Printf("S_LoadMusicDefs: Set usage to '%s'\n", def->usage);
+#endif
+ } else if (!stricmp(stoken, "source")) {
+ STRBUFCPY(def->source, value);
+ for (value = def->source; *value; value++)
+ if (*value == '_') *value = ' '; // turn _ into spaces.
+ //CONS_Printf("S_LoadMusicDefs: Set source to '%s'\n", def->source);
+ } else {
+ CONS_Alert(CONS_WARNING, "MUSICDEF: Invalid field '%s'. (file %s, line %d)\n", stoken, wadfiles[wadnum]->filename, line);
+ }
+
+skip_field:
+ stoken = strtok(NULL, "\r\n= ");
+ line++;
+ }
+ }
+
+ free(buf2);
+ return;
+}
+
+//
+// S_InitMusicDefs
+//
+// Simply load music defs in all wads.
+//
+void S_InitMusicDefs(void)
+{
+ UINT16 i;
+ for (i = 0; i < numwadfiles; i++)
+ S_LoadMusicDefs(i);
+}
+
+//
+// S_ShowMusicCredit
+//
+// Display current song's credit on screen
+//
+void S_ShowMusicCredit(void)
+{
+ musicdef_t *def = musicdefstart;
+
+ if (!cv_songcredits.value)
+ return;
+
+ if (!def) // No definitions
+ return;
+
+ while (def)
+ {
+ if (!stricmp(def->name, music_name))
+ {
+ cursongcredit.def = def;
+ cursongcredit.anim = 5*TICRATE;
+ cursongcredit.x = 0;
+ cursongcredit.trans = NUMTRANSMAPS;
+ return;
+ }
+ else
+ def = def->next;
+ }
+}
+
/// ------------------------
/// Music Status
/// ------------------------
@@ -1820,9 +2043,13 @@ void S_Start(void)
mapmusflags = (mapheaderinfo[gamemap-1]->mustrack & MUSIC_TRACKMASK);
}
- if (cv_resetmusic.value)
+ //if (cv_resetmusic.value) // Starting ambience should always be restarted
S_StopMusic();
- S_ChangeMusic(mapmusname, mapmusflags, true);
+
+ if (leveltime < (starttime + (TICRATE/2))) // SRB2Kart
+ S_ChangeMusic((encoremode ? "estart" : "kstart"), 0, false);
+ else
+ S_ChangeMusic(mapmusname, mapmusflags, true);
}
static void Command_Tunes_f(void)
@@ -1921,3 +2148,106 @@ static void Command_RestartAudio_f(void)
else
S_ChangeMusicInternal("titles", looptitle);
}
+
+void GameSounds_OnChange(void)
+{
+ if (M_CheckParm("-nosound"))
+ return;
+
+ if (sound_disabled)
+ {
+ sound_disabled = false;
+ S_InitSfxChannels(cv_soundvolume.value);
+ S_StartSound(NULL, sfx_strpst);
+ }
+ else
+ {
+ sound_disabled = true;
+ S_StopSounds();
+ }
+}
+
+void GameDigiMusic_OnChange(void)
+{
+ if (M_CheckParm("-nomusic"))
+ return;
+ else if (M_CheckParm("-nodigmusic"))
+ return;
+
+ if (digital_disabled)
+ {
+ digital_disabled = false;
+ I_InitMusic();
+ S_StopMusic();
+ if (Playing())
+ P_RestoreMusic(&players[consoleplayer]);
+ else
+ S_ChangeMusicInternal("titles", looptitle);
+ }
+ else
+ {
+ digital_disabled = true;
+ if (S_MusicType() != MU_MID)
+ {
+ if (midi_disabled)
+ S_StopMusic();
+ else
+ {
+ char mmusic[7];
+ UINT16 mflags;
+ boolean looping;
+
+ if (S_MusicInfo(mmusic, &mflags, &looping) && S_MIDIExists(mmusic))
+ {
+ S_StopMusic();
+ S_ChangeMusic(mmusic, mflags, looping);
+ }
+ else
+ S_StopMusic();
+ }
+ }
+ }
+}
+
+#ifndef NO_MIDI
+void GameMIDIMusic_OnChange(void)
+{
+ if (M_CheckParm("-nomusic"))
+ return;
+ else if (M_CheckParm("-nomidimusic"))
+ return;
+
+ if (midi_disabled)
+ {
+ midi_disabled = false;
+ I_InitMusic();
+ if (Playing())
+ P_RestoreMusic(&players[consoleplayer]);
+ else
+ S_ChangeMusicInternal("titles", looptitle);
+ }
+ else
+ {
+ midi_disabled = true;
+ if (S_MusicType() == MU_MID)
+ {
+ if (digital_disabled)
+ S_StopMusic();
+ else
+ {
+ char mmusic[7];
+ UINT16 mflags;
+ boolean looping;
+
+ if (S_MusicInfo(mmusic, &mflags, &looping) && S_DigExists(mmusic))
+ {
+ S_StopMusic();
+ S_ChangeMusic(mmusic, mflags, looping);
+ }
+ else
+ S_StopMusic();
+ }
+ }
+ }
+}
+#endif
diff --git a/src/s_sound.h b/src/s_sound.h
index 7f46366d..1ad519c2 100644
--- a/src/s_sound.h
+++ b/src/s_sound.h
@@ -2,7 +2,7 @@
//-----------------------------------------------------------------------------
// Copyright (C) 1993-1996 by id Software, Inc.
// Copyright (C) 1998-2000 by DooM Legacy Team.
-// Copyright (C) 1999-2016 by Sonic Team Junior.
+// Copyright (C) 1999-2018 by Sonic Team Junior.
//
// This program is free software distributed under the
// terms of the GNU General Public License, version 2.
@@ -27,7 +27,12 @@ extern consvar_t stereoreverse;
extern consvar_t cv_soundvolume, cv_digmusicvolume;//, cv_midimusicvolume;
extern consvar_t cv_numChannels;
extern consvar_t surround;
-extern consvar_t cv_resetmusic;
+//extern consvar_t cv_resetmusic;
+extern consvar_t cv_gamedigimusic;
+#ifndef NO_MIDI
+extern consvar_t cv_gamemidimusic;
+#endif
+extern consvar_t cv_gamesounds;
#ifdef SNDSERV
extern consvar_t sndserver_cmd, sndserver_arg;
@@ -123,6 +128,29 @@ boolean S_MusicExists(const char *mname, boolean checkMIDI, boolean checkDigi);
// Set Speed of Music
boolean S_SpeedMusic(float speed);
+// Music credits
+typedef struct musicdef_s
+{
+ char name[7];
+ //char usage[256];
+ char source[256];
+ struct musicdef_s *next;
+} musicdef_t;
+
+extern struct cursongcredit
+{
+ musicdef_t *def;
+ UINT16 anim;
+ INT32 x;
+ UINT8 trans;
+} cursongcredit;
+
+extern musicdef_t *musicdefstart;
+
+void S_LoadMusicDefs(UINT16 wadnum);
+void S_InitMusicDefs(void);
+void S_ShowMusicCredit(void);
+
//
// Music Routines
//
diff --git a/src/screen.c b/src/screen.c
index ada9af7c..af6aed03 100644
--- a/src/screen.c
+++ b/src/screen.c
@@ -1,7 +1,7 @@
// SONIC ROBO BLAST 2
//-----------------------------------------------------------------------------
// Copyright (C) 1998-2000 by DooM Legacy Team.
-// Copyright (C) 1999-2016 by Sonic Team Junior.
+// Copyright (C) 1999-2018 by Sonic Team Junior.
//
// This program is free software distributed under the
// terms of the GNU General Public License, version 2.
@@ -309,14 +309,6 @@ void SCR_Recalc(void)
if (automapactive)
AM_Stop();
- // r_plane stuff: visplanes, openings, floorclip, ceilingclip, spanstart,
- // spanstop, yslope, distscale, cachedheight, cacheddistance,
- // cachedxstep, cachedystep
- // -> allocated at the maximum vidsize, static.
-
- // r_main: xtoviewangle, allocated at the maximum size.
- // r_things: negonearray, screenheightarray allocated max. size.
-
// set the screen[x] ptrs on the new vidbuffers
V_Init();
diff --git a/src/screen.h b/src/screen.h
index a61de7f9..9ad254d3 100644
--- a/src/screen.h
+++ b/src/screen.h
@@ -1,7 +1,7 @@
// SONIC ROBO BLAST 2
//-----------------------------------------------------------------------------
// Copyright (C) 1998-2000 by DooM Legacy Team.
-// Copyright (C) 1999-2016 by Sonic Team Junior.
+// Copyright (C) 1999-2018 by Sonic Team Junior.
//
// This program is free software distributed under the
// terms of the GNU General Public License, version 2.
diff --git a/src/sdl/CMakeLists.txt b/src/sdl/CMakeLists.txt
index 7f677126..ec5d63ac 100644
--- a/src/sdl/CMakeLists.txt
+++ b/src/sdl/CMakeLists.txt
@@ -3,7 +3,18 @@
set(SRB2_CONFIG_SDL2_USEMIXER ON CACHE BOOL "Use SDL2_mixer or regular sdl sound")
if(${SRB2_CONFIG_SDL2_USEMIXER})
- find_package(SDL2_mixer)
+ if(${SRB2_CONFIG_USE_INTERNAL_LIBRARIES})
+ set(SDL2_MIXER_FOUND ON)
+ if(${SRB2_SYSTEM_BITS} EQUAL 64)
+ set(SDL2_MIXER_INCLUDE_DIRS ${CMAKE_SOURCE_DIR}/libs/SDL2_mixer/x86_64-w64-mingw32/include/SDL2)
+ set(SDL2_MIXER_LIBRARIES "-L${CMAKE_SOURCE_DIR}/libs/SDL2_mixer/x86_64-w64-mingw32/lib -lSDL2_mixer")
+ else() # 32-bit
+ set(SDL2_MIXER_INCLUDE_DIRS ${CMAKE_SOURCE_DIR}/libs/SDL2_mixer/i686-w64-mingw32/include/SDL2)
+ set(SDL2_MIXER_LIBRARIES "-L${CMAKE_SOURCE_DIR}/libs/SDL2_mixer/i686-w64-mingw32/lib -lSDL2_mixer")
+ endif()
+ else()
+ find_package(SDL2_mixer)
+ endif()
if(${SDL2_MIXER_FOUND})
set(SRB2_HAVE_MIXER ON)
set(SRB2_SDL2_SOUNDIMPL mixer_sound.c)
@@ -42,7 +53,18 @@ set(SRB2_SDL2_HEADERS
source_group("Interface Code" FILES ${SRB2_SDL2_SOURCES} ${SRB2_SDL2_HEADERS})
# Dependency
-find_package(SDL2)
+if(${SRB2_CONFIG_USE_INTERNAL_LIBRARIES})
+ set(SDL2_FOUND ON)
+ if(${SRB2_SYSTEM_BITS} EQUAL 64)
+ set(SDL2_INCLUDE_DIRS ${CMAKE_SOURCE_DIR}/libs/SDL2/x86_64-w64-mingw32/include/SDL2)
+ set(SDL2_LIBRARIES "-L${CMAKE_SOURCE_DIR}/libs/SDL2/x86_64-w64-mingw32/lib -lSDL2")
+ else() # 32-bit
+ set(SDL2_INCLUDE_DIRS ${CMAKE_SOURCE_DIR}/libs/SDL2/i686-w64-mingw32/include/SDL2)
+ set(SDL2_LIBRARIES "-L${CMAKE_SOURCE_DIR}/libs/SDL2/i686-w64-mingw32/lib -lSDL2")
+ endif()
+else()
+ find_package(SDL2)
+endif()
if(${SDL2_FOUND})
set(SRB2_SDL2_TOTAL_SOURCES
@@ -128,7 +150,7 @@ if(${SDL2_FOUND})
${ZLIB_LIBRARIES}
${OPENGL_LIBRARIES}
)
- set_target_properties(SRB2SDL2 PROPERTIES OUTPUT_NAME "Sonic Robo Blast 2")
+ set_target_properties(SRB2SDL2 PROPERTIES OUTPUT_NAME "${CPACK_PACKAGE_DESCRIPTION_SUMMARY}")
else()
target_link_libraries(SRB2SDL2 PRIVATE
${SDL2_LIBRARIES}
@@ -185,7 +207,18 @@ if(${SDL2_FOUND})
endif()
if(MSVC)
- find_package(SDL2_MAIN REQUIRED)
+ if(${SRB2_CONFIG_USE_INTERNAL_LIBRARIES})
+ set(SDL2_MAIN_FOUND ON)
+ if(${SRB2_SYSTEM_BITS} EQUAL 64)
+ set(SDL2_MAIN_INCLUDE_DIRS ${CMAKE_SOURCE_DIR}/libs/SDL2/x86_64-w64-mingw32/include/SDL2)
+ set(SDL2_MAIN_LIBRARIES "-L${CMAKE_SOURCE_DIR}/libs/SDL2/x86_64-w64-mingw32/lib -lSDL2main")
+ else() # 32-bit
+ set(SDL2_MAIN_INCLUDE_DIRS ${CMAKE_SOURCE_DIR}/libs/SDL2/i686-w64-mingw32/include/SDL2)
+ set(SDL2_MAIN_LIBRARIES "-L${CMAKE_SOURCE_DIR}/libs/SDL2/i686-w64-mingw32/lib -lSDL2main")
+ endif()
+ else()
+ find_package(SDL2_MAIN REQUIRED)
+ endif()
target_link_libraries(SRB2SDL2 PRIVATE
${SDL2_MAIN_LIBRARIES}
)
@@ -241,17 +274,49 @@ if(${SDL2_FOUND})
if(${CMAKE_SYSTEM} MATCHES Windows)
set(win_extra_dll_list "")
macro(getwinlib dllname defaultname)
- find_library(SRB2_SDL2_DLL_${dllname} "${defaultname}")
- list(APPEND win_extra_dll_list ${SRB2_SDL2_DLL_${dllname}})
+ if(${SRB2_CONFIG_USE_INTERNAL_LIBRARIES})
+ if (${CMAKE_GENERATOR} STREQUAL "MinGW Makefiles")
+ if(${SRB2_SYSTEM_BITS} EQUAL 64)
+ find_library(SRB2_SDL2_DLL_${dllname} "${defaultname}"
+ HINTS ${CMAKE_SOURCE_DIR}/libs/dll-binaries/x86_64
+ HINTS ${CMAKE_SOURCE_DIR}/libs/SDL2/x86_64-w64-mingw32/bin
+ HINTS ${CMAKE_SOURCE_DIR}/libs/SDL2_mixer/x86_64-w64-mingw32/bin
+ )
+ else()
+ find_library(SRB2_SDL2_DLL_${dllname} "${defaultname}"
+ HINTS ${CMAKE_SOURCE_DIR}/libs/dll-binaries/i686
+ HINTS ${CMAKE_SOURCE_DIR}/libs/SDL2/i686-w64-mingw32/bin
+ HINTS ${CMAKE_SOURCE_DIR}/libs/SDL2_mixer/i686-w64-mingw32/bin
+ )
+ endif()
+ else()
+ if(${SRB2_SYSTEM_BITS} EQUAL 64)
+ find_library(SRB2_SDL2_DLL_${dllname} "${defaultname}"
+ HINTS ${CMAKE_SOURCE_DIR}/libs/dll-binaries/x86_64
+ HINTS ${CMAKE_SOURCE_DIR}/libs/SDL2/lib/x64
+ HINTS ${CMAKE_SOURCE_DIR}/libs/SDL2_mixer/lib/x64
+ )
+ else()
+ find_library(SRB2_SDL2_DLL_${dllname} "${defaultname}"
+ HINTS ${CMAKE_SOURCE_DIR}/libs/dll-binaries/i686
+ HINTS ${CMAKE_SOURCE_DIR}/libs/SDL2/lib/x86
+ HINTS ${CMAKE_SOURCE_DIR}/libs/SDL2_mixer/lib/x86
+ )
+ endif()
+ endif()
+
+ list(APPEND win_extra_dll_list ${SRB2_SDL2_DLL_${dllname}})
+ else()
+ find_library(SRB2_SDL2_DLL_${dllname} "${defaultname}")
+ list(APPEND win_extra_dll_list ${SRB2_SDL2_DLL_${dllname}})
+ endif()
endmacro()
getwinlib(SDL2 "SDL2.dll")
if(${SRB2_CONFIG_SDL2_USEMIXER})
getwinlib(SDL2_mixer "SDL2_mixer.dll")
- getwinlib(libmikmod-2 "libmikmod-2.dll")
getwinlib(libogg_0 "libogg-0.dll")
getwinlib(libvorbis_0 "libvorbis-0.dll")
getwinlib(libvorbisfile_3 "libvorbisfile-3.dll")
- getwinlib(smpeg2 "smpeg2.dll")
endif()
if(${SRB2_CONFIG_HAVE_GME})
getwinlib(libgme "libgme.dll")
@@ -269,10 +334,19 @@ if(${SDL2_FOUND})
# Mac bundle fixup
+ # HACK: THIS IS IMPORTANT! See the escaped \${CMAKE_INSTALL_PREFIX}? This
+ # makes it so that var is evaluated LATER during cpack, not right now!
+ # This fixes the quirk where the bundled libraries don't land in the final package
+ # https://cmake.org/pipermail/cmake/2011-March/043532.html
+ #
+ # HOWEVER: ${CPACK_PACKAGE_DESCRIPTION_SUMMARY} is NOT escaped, because that var
+ # is only available to us at this step. Read the link: ${CMAKE_INSTALL_PREFIX} at
+ # this current step points to the CMAKE build folder, NOT the folder that CPACK uses.
+ # Therefore, it makes sense to escape that var, but not the other.
if(${CMAKE_SYSTEM} MATCHES Darwin)
install(CODE "
include(BundleUtilities)
- fixup_bundle(\"${CMAKE_INSTALL_PREFIX}/Sonic Robo Blast 2.app\"
+ fixup_bundle(\"\${CMAKE_INSTALL_PREFIX}/${CPACK_PACKAGE_DESCRIPTION_SUMMARY}.app\"
\"\"
/Library/Frameworks
)"
diff --git a/src/sdl/Srb2SDL-vc10.vcxproj b/src/sdl/Srb2SDL-vc10.vcxproj
index 83851ba3..bd964259 100644
--- a/src/sdl/Srb2SDL-vc10.vcxproj
+++ b/src/sdl/Srb2SDL-vc10.vcxproj
@@ -1,10 +1,26 @@
+
+ Debug
+ ARM
+
+
+ Debug
+ ARM64
+
Debug
Win32
+
+ Release
+ ARM
+
+
+ Release
+ ARM64
+
Release
Win32
@@ -19,31 +35,54 @@
- Srb2Win
+ srb2kart
{61BA7D3C-F77D-4D31-B718-1177FE482CF2}
Win32Proj
Srb2SDL
+ 10.0.16299.0
srb2kart
- 8.1
-
- v140
-
+ v140
true
+
+ v141
+ true
+ true
+
+ v140
false
true
+
+ v141
+ false
+ true
+ true
+
+ v140
true
+
+ v141
+ true
+ true
+
+ v140
false
true
+
+ v141
+ false
+ true
+ true
+
@@ -60,27 +99,58 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
<_ProjectFileVersion>10.0.30319.1
false
-
+
- false
+ ProgramDatabase
+ false
+
+ setupapi.lib;winmm.lib;imm32.lib;version.lib;ole32.lib;advapi32.lib;shell32.lib;gdi32.lib;oleaut32.lib;uuid.lib;%(AdditionalDependencies)
+
+
+
+
+ ProgramDatabase
+ false
+
+
+
+
+ setupapi.lib;winmm.lib;imm32.lib;version.lib;ole32.lib;advapi32.lib;shell32.lib;gdi32.lib;oleaut32.lib;uuid.lib;%(AdditionalDependencies)
+
@@ -304,6 +374,7 @@
+
diff --git a/src/sdl/Srb2SDL-vc10.vcxproj.filters b/src/sdl/Srb2SDL-vc10.vcxproj.filters
index d30478db..09287436 100644
--- a/src/sdl/Srb2SDL-vc10.vcxproj.filters
+++ b/src/sdl/Srb2SDL-vc10.vcxproj.filters
@@ -642,6 +642,9 @@
LUA
+
+ LUA
+
LUA
diff --git a/src/sdl/Srb2SDL.ico b/src/sdl/Srb2SDL.ico
index 6e667b61..4e3f8133 100644
Binary files a/src/sdl/Srb2SDL.ico and b/src/sdl/Srb2SDL.ico differ
diff --git a/src/sdl/i_system.c b/src/sdl/i_system.c
index 03543c30..2154a070 100644
--- a/src/sdl/i_system.c
+++ b/src/sdl/i_system.c
@@ -133,16 +133,16 @@ typedef LPVOID (WINAPI *p_MapViewOfFile) (HANDLE, DWORD, DWORD, DWORD, SIZE_T);
// Locations for searching the srb2.srb
#if defined (__unix__) || defined(__APPLE__) || defined (UNIXCOMMON)
-#define DEFAULTWADLOCATION1 "/usr/local/share/games/SRB2"
-#define DEFAULTWADLOCATION2 "/usr/local/games/SRB2"
-#define DEFAULTWADLOCATION3 "/usr/share/games/SRB2"
-#define DEFAULTWADLOCATION4 "/usr/games/SRB2"
+#define DEFAULTWADLOCATION1 "/usr/local/share/games/SRB2Kart"
+#define DEFAULTWADLOCATION2 "/usr/local/games/SRB2Kart"
+#define DEFAULTWADLOCATION3 "/usr/share/games/SRB2Kart"
+#define DEFAULTWADLOCATION4 "/usr/games/SRB2Kart"
#define DEFAULTSEARCHPATH1 "/usr/local/games"
#define DEFAULTSEARCHPATH2 "/usr/games"
#define DEFAULTSEARCHPATH3 "/usr/local"
#elif defined (_WIN32)
-#define DEFAULTWADLOCATION1 "c:\\games\\srb2"
-#define DEFAULTWADLOCATION2 "\\games\\srb2"
+#define DEFAULTWADLOCATION1 "c:\\games\\srb2kart"
+#define DEFAULTWADLOCATION2 "\\games\\srb2kart"
#define DEFAULTSEARCHPATH1 "c:\\games"
#define DEFAULTSEARCHPATH2 "\\games"
#endif
@@ -856,6 +856,220 @@ void I_JoyScale4(void)
JoyInfo4.scale = Joystick4.bGamepadStyle?1:cv_joyscale4.value;
}
+// Cheat to get the device index for a joystick handle
+INT32 I_GetJoystickDeviceIndex(SDL_Joystick *dev)
+{
+ INT32 i, count = SDL_NumJoysticks();
+
+ for (i = 0; dev && i < count; i++)
+ {
+ SDL_Joystick *test = SDL_JoystickOpen(i);
+ if (test && test == dev)
+ return i;
+ else if (JoyInfo.dev != test && JoyInfo2.dev != test && JoyInfo3.dev != test && JoyInfo4.dev != test)
+ SDL_JoystickClose(test);
+ }
+
+ return -1;
+}
+
+// Misleading function: updates device indices for all players BUT the one specified.
+// Necessary for SDL_JOYDEVICEADDED events
+void I_UpdateJoystickDeviceIndices(INT32 player)
+{
+ if (player != 1) // This is a fucking mess.
+ {
+ //////////////////////////////
+ // update joystick 1's device index
+ //////////////////////////////
+
+ if (JoyInfo.dev)
+ cv_usejoystick.value = I_GetJoystickDeviceIndex(JoyInfo.dev) + 1;
+ // is cv_usejoystick used?
+ else if (// don't check JoyInfo or cv_usejoystick; we're currently operating on those
+ atoi(cv_usejoystick.string) != JoyInfo2.oldjoy
+ && atoi(cv_usejoystick.string) != cv_usejoystick2.value
+ && atoi(cv_usejoystick.string) != JoyInfo3.oldjoy
+ && atoi(cv_usejoystick.string) != cv_usejoystick3.value
+ && atoi(cv_usejoystick.string) != JoyInfo4.oldjoy
+ && atoi(cv_usejoystick.string) != cv_usejoystick4.value)
+ cv_usejoystick.value = atoi(cv_usejoystick.string);
+ // is cv_usejoystick2 used?
+ else if ( // don't check JoyInfo or cv_usejoystick; we're currently operating on those
+ atoi(cv_usejoystick2.string) != JoyInfo2.oldjoy
+ && atoi(cv_usejoystick2.string) != cv_usejoystick2.value
+ && atoi(cv_usejoystick2.string) != JoyInfo3.oldjoy
+ && atoi(cv_usejoystick2.string) != cv_usejoystick3.value
+ && atoi(cv_usejoystick2.string) != JoyInfo4.oldjoy
+ && atoi(cv_usejoystick2.string) != cv_usejoystick4.value)
+ cv_usejoystick.value = atoi(cv_usejoystick2.string);
+ // is cv_usejoystick3 used?
+ else if (// don't check JoyInfo or cv_usejoystick; we're currently operating on those
+ atoi(cv_usejoystick3.string) != JoyInfo2.oldjoy
+ && atoi(cv_usejoystick3.string) != cv_usejoystick2.value
+ && atoi(cv_usejoystick3.string) != JoyInfo3.oldjoy
+ && atoi(cv_usejoystick3.string) != cv_usejoystick3.value
+ && atoi(cv_usejoystick3.string) != JoyInfo4.oldjoy
+ && atoi(cv_usejoystick3.string) != cv_usejoystick4.value)
+ cv_usejoystick.value = atoi(cv_usejoystick3.string);
+ // is cv_usejoystick4 used?
+ else if (// don't check JoyInfo or cv_usejoystick; we're currently operating on those
+ atoi(cv_usejoystick4.string) != JoyInfo2.oldjoy
+ && atoi(cv_usejoystick4.string) != cv_usejoystick2.value
+ && atoi(cv_usejoystick4.string) != JoyInfo3.oldjoy
+ && atoi(cv_usejoystick4.string) != cv_usejoystick3.value
+ && atoi(cv_usejoystick4.string) != JoyInfo4.oldjoy
+ && atoi(cv_usejoystick4.string) != cv_usejoystick4.value)
+ cv_usejoystick.value = atoi(cv_usejoystick4.string);
+ else // we tried...
+ cv_usejoystick.value = 0;
+ }
+
+ if (player != 2)
+ {
+ //////////////////////////////
+ // update joystick 2's device index
+ //////////////////////////////
+
+ if (JoyInfo2.dev)
+ cv_usejoystick2.value = I_GetJoystickDeviceIndex(JoyInfo2.dev) + 1;
+ // is cv_usejoystick2 used?
+ else if (atoi(cv_usejoystick2.string) != JoyInfo.oldjoy
+ && atoi(cv_usejoystick2.string) != cv_usejoystick.value
+ // don't check JoyInfo2 or cv_usejoystick2; we're currently operating on those
+ && atoi(cv_usejoystick2.string) != JoyInfo3.oldjoy
+ && atoi(cv_usejoystick2.string) != cv_usejoystick3.value
+ && atoi(cv_usejoystick2.string) != JoyInfo4.oldjoy
+ && atoi(cv_usejoystick2.string) != cv_usejoystick4.value)
+ cv_usejoystick2.value = atoi(cv_usejoystick2.string);
+ // is cv_usejoystick used?
+ else if (atoi(cv_usejoystick.string) != JoyInfo.oldjoy
+ && atoi(cv_usejoystick.string) != cv_usejoystick.value
+ // don't check JoyInfo2 or cv_usejoystick2; we're currently operating on those
+ && atoi(cv_usejoystick.string) != JoyInfo3.oldjoy
+ && atoi(cv_usejoystick.string) != cv_usejoystick3.value
+ && atoi(cv_usejoystick.string) != JoyInfo4.oldjoy
+ && atoi(cv_usejoystick.string) != cv_usejoystick4.value)
+ cv_usejoystick2.value = atoi(cv_usejoystick.string);
+ // is cv_usejoystick3 used?
+ else if (atoi(cv_usejoystick3.string) != JoyInfo.oldjoy
+ && atoi(cv_usejoystick3.string) != cv_usejoystick.value
+ // don't check JoyInfo2 or cv_usejoystick2; we're currently operating on those
+ && atoi(cv_usejoystick3.string) != JoyInfo3.oldjoy
+ && atoi(cv_usejoystick3.string) != cv_usejoystick3.value
+ && atoi(cv_usejoystick3.string) != JoyInfo4.oldjoy
+ && atoi(cv_usejoystick3.string) != cv_usejoystick4.value)
+ cv_usejoystick2.value = atoi(cv_usejoystick3.string);
+ // is cv_usejoystick4 used?
+ else if (atoi(cv_usejoystick4.string) != JoyInfo.oldjoy
+ && atoi(cv_usejoystick4.string) != cv_usejoystick.value
+ // don't check JoyInfo2 or cv_usejoystick2; we're currently operating on those
+ && atoi(cv_usejoystick4.string) != JoyInfo3.oldjoy
+ && atoi(cv_usejoystick4.string) != cv_usejoystick3.value
+ && atoi(cv_usejoystick4.string) != JoyInfo4.oldjoy
+ && atoi(cv_usejoystick4.string) != cv_usejoystick4.value)
+ cv_usejoystick2.value = atoi(cv_usejoystick4.string);
+ else // we tried...
+ cv_usejoystick2.value = 0;
+ }
+
+ if (player != 3)
+ {
+ //////////////////////////////
+ // update joystick 3's device index
+ //////////////////////////////
+
+ if (JoyInfo3.dev)
+ cv_usejoystick3.value = I_GetJoystickDeviceIndex(JoyInfo3.dev) + 1;
+ // is cv_usejoystick3 used?
+ else if (atoi(cv_usejoystick3.string) != JoyInfo.oldjoy
+ && atoi(cv_usejoystick3.string) != cv_usejoystick.value
+ && atoi(cv_usejoystick3.string) != JoyInfo2.oldjoy
+ && atoi(cv_usejoystick3.string) != cv_usejoystick2.value
+ // don't check JoyInfo3 or cv_usejoystick3; we're currently operating on those
+ && atoi(cv_usejoystick3.string) != JoyInfo4.oldjoy
+ && atoi(cv_usejoystick3.string) != cv_usejoystick4.value)
+ cv_usejoystick3.value = atoi(cv_usejoystick3.string);
+ // is cv_usejoystick used?
+ else if (atoi(cv_usejoystick.string) != JoyInfo.oldjoy
+ && atoi(cv_usejoystick.string) != cv_usejoystick.value
+ && atoi(cv_usejoystick.string) != JoyInfo2.oldjoy
+ && atoi(cv_usejoystick.string) != cv_usejoystick2.value
+ // don't check JoyInfo3 or cv_usejoystick3; we're currently operating on those
+ && atoi(cv_usejoystick.string) != JoyInfo4.oldjoy
+ && atoi(cv_usejoystick.string) != cv_usejoystick4.value)
+ cv_usejoystick3.value = atoi(cv_usejoystick.string);
+ // is cv_usejoystick2 used?
+ else if (atoi(cv_usejoystick2.string) != JoyInfo.oldjoy
+ && atoi(cv_usejoystick2.string) != cv_usejoystick.value
+ && atoi(cv_usejoystick2.string) != JoyInfo2.oldjoy
+ && atoi(cv_usejoystick2.string) != cv_usejoystick2.value
+ // don't check JoyInfo3 or cv_usejoystick3; we're currently operating on those
+ && atoi(cv_usejoystick2.string) != JoyInfo4.oldjoy
+ && atoi(cv_usejoystick2.string) != cv_usejoystick4.value)
+ cv_usejoystick3.value = atoi(cv_usejoystick2.string);
+ // is cv_usejoystick4 used?
+ else if (atoi(cv_usejoystick4.string) != JoyInfo.oldjoy
+ && atoi(cv_usejoystick4.string) != cv_usejoystick.value
+ && atoi(cv_usejoystick4.string) != JoyInfo2.oldjoy
+ && atoi(cv_usejoystick4.string) != cv_usejoystick2.value
+ // don't check JoyInfo3 or cv_usejoystick3; we're currently operating on those
+ && atoi(cv_usejoystick4.string) != JoyInfo4.oldjoy
+ && atoi(cv_usejoystick4.string) != cv_usejoystick4.value)
+ cv_usejoystick3.value = atoi(cv_usejoystick4.string);
+ else // we tried...
+ cv_usejoystick3.value = 0;
+ }
+
+ if (player != 4)
+ {
+ //////////////////////////////
+ // update joystick 4's device index
+ //////////////////////////////
+
+ if (JoyInfo4.dev)
+ cv_usejoystick4.value = I_GetJoystickDeviceIndex(JoyInfo4.dev) + 1;
+ // is cv_usejoystick4 used?
+ else if (atoi(cv_usejoystick4.string) != JoyInfo.oldjoy
+ && atoi(cv_usejoystick4.string) != cv_usejoystick.value
+ && atoi(cv_usejoystick4.string) != JoyInfo2.oldjoy
+ && atoi(cv_usejoystick4.string) != cv_usejoystick2.value
+ && atoi(cv_usejoystick4.string) != JoyInfo3.oldjoy
+ && atoi(cv_usejoystick4.string) != cv_usejoystick3.value)
+ // don't check JoyInfo4 or cv_usejoystick4; we're currently operating on those
+ cv_usejoystick4.value = atoi(cv_usejoystick4.string);
+ // is cv_usejoystick used?
+ else if (atoi(cv_usejoystick.string) != JoyInfo.oldjoy
+ && atoi(cv_usejoystick.string) != cv_usejoystick.value
+ && atoi(cv_usejoystick.string) != JoyInfo2.oldjoy
+ && atoi(cv_usejoystick.string) != cv_usejoystick2.value
+ && atoi(cv_usejoystick.string) != JoyInfo3.oldjoy
+ && atoi(cv_usejoystick.string) != cv_usejoystick3.value)
+ // don't check JoyInfo4 or cv_usejoystick4; we're currently operating on those
+ cv_usejoystick4.value = atoi(cv_usejoystick.string);
+ // is cv_usejoystick2 used?
+ else if (atoi(cv_usejoystick2.string) != JoyInfo.oldjoy
+ && atoi(cv_usejoystick2.string) != cv_usejoystick.value
+ && atoi(cv_usejoystick2.string) != JoyInfo2.oldjoy
+ && atoi(cv_usejoystick2.string) != cv_usejoystick2.value
+ && atoi(cv_usejoystick2.string) != JoyInfo3.oldjoy
+ && atoi(cv_usejoystick2.string) != cv_usejoystick3.value)
+ // don't check JoyInfo4 or cv_usejoystick4; we're currently operating on those
+ cv_usejoystick4.value = atoi(cv_usejoystick2.string);
+ // is cv_usejoystick3 used?
+ else if (atoi(cv_usejoystick3.string) != JoyInfo.oldjoy
+ && atoi(cv_usejoystick3.string) != cv_usejoystick.value
+ && atoi(cv_usejoystick3.string) != JoyInfo2.oldjoy
+ && atoi(cv_usejoystick3.string) != cv_usejoystick2.value
+ && atoi(cv_usejoystick3.string) != JoyInfo3.oldjoy
+ && atoi(cv_usejoystick3.string) != cv_usejoystick3.value)
+ // don't check JoyInfo4 or cv_usejoystick4; we're currently operating on those
+ cv_usejoystick4.value = atoi(cv_usejoystick3.string);
+ else // we tried...
+ cv_usejoystick4.value = 0;
+ }
+}
+
/** \brief Joystick 1 buttons states
*/
static UINT64 lastjoybuttons = 0;
@@ -871,7 +1085,7 @@ static UINT64 lastjoyhats = 0;
*/
-static void I_ShutdownJoystick(void)
+void I_ShutdownJoystick(void)
{
INT32 i;
event_t event;
@@ -905,15 +1119,8 @@ static void I_ShutdownJoystick(void)
joystick_started = 0;
JoyReset(&JoyInfo);
- if (!joystick_started && !joystick2_started && !joystick3_started && !joystick4_started
- && SDL_WasInit(SDL_INIT_JOYSTICK) == SDL_INIT_JOYSTICK)
- {
- SDL_QuitSubSystem(SDL_INIT_JOYSTICK);
- if (cv_usejoystick.value == 0)
- {
- I_OutputMsg("I_Joystick: SDL's Joystick system has been shutdown\n");
- }
- }
+
+ // don't shut down the subsystem here, because hotplugging
}
void I_GetJoystickEvents(void)
@@ -923,8 +1130,8 @@ void I_GetJoystickEvents(void)
UINT64 joyhats = 0;
#if 0
UINT64 joybuttons = 0;
-#endif
Sint16 axisx, axisy;
+#endif
if (!joystick_started) return;
@@ -992,6 +1199,7 @@ void I_GetJoystickEvents(void)
}
}
+#if 0
// send joystick axis positions
event.type = ev_joystick;
@@ -1042,6 +1250,7 @@ void I_GetJoystickEvents(void)
}
D_PostEvent(&event);
}
+#endif
}
/** \brief Open joystick handle
@@ -1052,74 +1261,66 @@ void I_GetJoystickEvents(void)
*/
-static int joy_open(const char *fname)
+static int joy_open(int joyindex)
{
- int joyindex = atoi(fname);
+ SDL_Joystick *newdev = NULL;
int num_joy = 0;
- int i;
- if (joystick_started == 0 && joystick2_started == 0 && joystick3_started == 0 && joystick4_started == 0)
+ if (SDL_WasInit(SDL_INIT_JOYSTICK) == 0)
{
- if (SDL_InitSubSystem(SDL_INIT_JOYSTICK) == -1)
- {
- CONS_Printf(M_GetText("Couldn't initialize joystick: %s\n"), SDL_GetError());
- return -1;
- }
- else
- {
- num_joy = SDL_NumJoysticks();
- }
+ CONS_Printf(M_GetText("Joystick subsystem not started\n"));
+ return -1;
+ }
- if (num_joy < joyindex)
- {
- CONS_Printf(M_GetText("Cannot use joystick #%d/(%s), it doesn't exist\n"),joyindex,fname);
- for (i = 0; i < num_joy; i++)
- CONS_Printf("#%d/(%s)\n", i+1, SDL_JoystickNameForIndex(i));
- I_ShutdownJoystick();
- return -1;
- }
- }
- else
- {
- JoyReset(&JoyInfo);
- //I_ShutdownJoystick();
- //joy_open(fname);
- }
+ if (joyindex <= 0)
+ return -1;
num_joy = SDL_NumJoysticks();
- if (joyindex <= 0 || num_joy == 0 || JoyInfo.oldjoy == joyindex)
+ if (num_joy == 0)
{
-// I_OutputMsg("Unable to use that joystick #(%s), non-number\n",fname);
- if (num_joy != 0)
- {
- CONS_Printf(M_GetText("Found %d joysticks on this system\n"), num_joy);
- for (i = 0; i < num_joy; i++)
- CONS_Printf("#%d/(%s)\n", i+1, SDL_JoystickNameForIndex(i));
- }
- else
- CONS_Printf("%s", M_GetText("Found no joysticks on this system\n"));
- if (joyindex <= 0 || num_joy == 0) return 0;
+ CONS_Printf("%s", M_GetText("Found no joysticks on this system\n"));
+ return -1;
}
- JoyInfo.dev = SDL_JoystickOpen(joyindex-1);
+ newdev = SDL_JoystickOpen(joyindex-1);
+
+ // Handle the edge case where the device <-> joystick index assignment can change due to hotplugging
+ // This indexing is SDL's responsibility and there's not much we can do about it.
+ //
+ // Example:
+ // 1. Plug Controller A -> Index 0 opened
+ // 2. Plug Controller B -> Index 1 opened
+ // 3. Unplug Controller A -> Index 0 closed, Index 1 active
+ // 4. Unplug Controller B -> Index 0 inactive, Index 1 closed
+ // 5. Plug Controller B -> Index 0 opened
+ // 6. Plug Controller A -> Index 0 REPLACED, opened as Controller A; Index 1 is now Controller B
+ if (JoyInfo.dev)
+ {
+ if (JoyInfo.dev == newdev // same device, nothing to do
+ || (newdev == NULL && SDL_JoystickGetAttached(JoyInfo.dev))) // we failed, but already have a working device
+ return JoyInfo.axises;
+ // Else, we're changing devices, so send neutral joy events
+ CONS_Debug(DBG_GAMELOGIC, "Joystick1 device is changing; resetting events...\n");
+ I_ShutdownJoystick();
+ }
+
+ JoyInfo.dev = newdev;
if (JoyInfo.dev == NULL)
{
- CONS_Printf(M_GetText("Couldn't open joystick: %s\n"), SDL_GetError());
- I_ShutdownJoystick();
+ CONS_Debug(DBG_GAMELOGIC, M_GetText("Joystick1: Couldn't open device - %s\n"), SDL_GetError());
return -1;
}
else
{
- CONS_Printf(M_GetText("Joystick: %s\n"), SDL_JoystickName(JoyInfo.dev));
+ CONS_Debug(DBG_GAMELOGIC, M_GetText("Joystick1: %s\n"), SDL_JoystickName(JoyInfo.dev));
JoyInfo.axises = SDL_JoystickNumAxes(JoyInfo.dev);
if (JoyInfo.axises > JOYAXISSET*2)
JoyInfo.axises = JOYAXISSET*2;
-/* if (joyaxes<2)
+ /* if (joyaxes<2)
{
I_OutputMsg("Not enought axes?\n");
- I_ShutdownJoystick();
return 0;
}*/
@@ -1154,7 +1355,7 @@ static UINT64 lastjoy2hats = 0;
\return void
*/
-static void I_ShutdownJoystick2(void)
+void I_ShutdownJoystick2(void)
{
INT32 i;
event_t event;
@@ -1188,15 +1389,8 @@ static void I_ShutdownJoystick2(void)
joystick2_started = 0;
JoyReset(&JoyInfo2);
- if (!joystick_started && !joystick2_started && !joystick3_started && !joystick4_started
- && SDL_WasInit(SDL_INIT_JOYSTICK) == SDL_INIT_JOYSTICK)
- {
- SDL_QuitSubSystem(SDL_INIT_JOYSTICK);
- if (cv_usejoystick2.value == 0)
- {
- DEBFILE("I_Joystick2: SDL's Joystick system has been shutdown\n");
- }
- }
+
+ // don't shut down the subsystem here, because hotplugging
}
void I_GetJoystick2Events(void)
@@ -1206,8 +1400,8 @@ void I_GetJoystick2Events(void)
UINT64 joyhats = 0;
#if 0
INT64 joybuttons = 0;
-#endif
INT32 axisx, axisy;
+#endif
if (!joystick2_started)
return;
@@ -1277,6 +1471,7 @@ void I_GetJoystick2Events(void)
}
}
+#if 0
// send joystick axis positions
event.type = ev_joystick2;
@@ -1327,7 +1522,7 @@ void I_GetJoystick2Events(void)
}
D_PostEvent(&event);
}
-
+#endif
}
/** \brief Open joystick handle
@@ -1338,72 +1533,66 @@ void I_GetJoystick2Events(void)
*/
-static int joy_open2(const char *fname)
+static int joy_open2(int joyindex)
{
- int joyindex = atoi(fname);
+ SDL_Joystick *newdev = NULL;
int num_joy = 0;
- int i;
- if (joystick_started == 0 && joystick2_started == 0 && joystick3_started == 0 && joystick4_started == 0)
+ if (SDL_WasInit(SDL_INIT_JOYSTICK) == 0)
{
- if (SDL_InitSubSystem(SDL_INIT_JOYSTICK) == -1)
- {
- CONS_Printf(M_GetText("Couldn't initialize joystick: %s\n"), SDL_GetError());
- return -1;
- }
- else
- num_joy = SDL_NumJoysticks();
+ CONS_Printf(M_GetText("Joystick subsystem not started\n"));
+ return -1;
+ }
- if (num_joy < joyindex)
- {
- CONS_Printf(M_GetText("Cannot use joystick #%d/(%s), it doesn't exist\n"),joyindex,fname);
- for (i = 0; i < num_joy; i++)
- CONS_Printf("#%d/(%s)\n", i+1, SDL_JoystickNameForIndex(i));
- I_ShutdownJoystick2();
- return -1;
- }
- }
- else
- {
- JoyReset(&JoyInfo2);
- //I_ShutdownJoystick();
- //joy_open(fname);
- }
+ if (joyindex <= 0)
+ return -1;
num_joy = SDL_NumJoysticks();
- if (joyindex <= 0 || num_joy == 0 || JoyInfo2.oldjoy == joyindex)
+ if (num_joy == 0)
{
-// I_OutputMsg("Unable to use that joystick #(%s), non-number\n",fname);
- if (num_joy != 0)
- {
- CONS_Printf(M_GetText("Found %d joysticks on this system\n"), num_joy);
- for (i = 0; i < num_joy; i++)
- CONS_Printf("#%d/(%s)\n", i+1, SDL_JoystickNameForIndex(i));
- }
- else
- CONS_Printf("%s", M_GetText("Found no joysticks on this system\n"));
- if (joyindex <= 0 || num_joy == 0) return 0;
+ CONS_Printf("%s", M_GetText("Found no joysticks on this system\n"));
+ return -1;
}
- JoyInfo2.dev = SDL_JoystickOpen(joyindex-1);
+ newdev = SDL_JoystickOpen(joyindex-1);
- if (!JoyInfo2.dev)
+ // Handle the edge case where the device <-> joystick index assignment can change due to hotplugging
+ // This indexing is SDL's responsibility and there's not much we can do about it.
+ //
+ // Example:
+ // 1. Plug Controller A -> Index 0 opened
+ // 2. Plug Controller B -> Index 1 opened
+ // 3. Unplug Controller A -> Index 0 closed, Index 1 active
+ // 4. Unplug Controller B -> Index 0 inactive, Index 1 closed
+ // 5. Plug Controller B -> Index 0 opened
+ // 6. Plug Controller A -> Index 0 REPLACED, opened as Controller A; Index 1 is now Controller B
+ if (JoyInfo2.dev)
{
- CONS_Printf(M_GetText("Couldn't open joystick2: %s\n"), SDL_GetError());
+ if (JoyInfo2.dev == newdev // same device, nothing to do
+ || (newdev == NULL && SDL_JoystickGetAttached(JoyInfo2.dev))) // we failed, but already have a working device
+ return JoyInfo.axises;
+ // Else, we're changing devices, so send neutral joy events
+ CONS_Debug(DBG_GAMELOGIC, "Joystick2 device is changing; resetting events...\n");
I_ShutdownJoystick2();
+ }
+
+ JoyInfo2.dev = newdev;
+
+ if (JoyInfo2.dev == NULL)
+ {
+ CONS_Debug(DBG_GAMELOGIC, M_GetText("Joystick2: couldn't open device - %s\n"), SDL_GetError());
return -1;
}
else
{
- CONS_Printf(M_GetText("Joystick2: %s\n"), SDL_JoystickName(JoyInfo2.dev));
+ CONS_Debug(DBG_GAMELOGIC, M_GetText("Joystick2: %s\n"), SDL_JoystickName(JoyInfo2.dev));
JoyInfo2.axises = SDL_JoystickNumAxes(JoyInfo2.dev);
if (JoyInfo2.axises > JOYAXISSET*2)
JoyInfo2.axises = JOYAXISSET*2;
-/* if (joyaxes < 2)
+/* if (joyaxes<2)
{
I_OutputMsg("Not enought axes?\n");
- I_ShutdownJoystick2();
return 0;
}*/
@@ -1438,7 +1627,7 @@ static UINT64 lastjoy3hats = 0;
\return void
*/
-static void I_ShutdownJoystick3(void)
+void I_ShutdownJoystick3(void)
{
INT32 i;
event_t event;
@@ -1470,16 +1659,10 @@ static void I_ShutdownJoystick3(void)
D_PostEvent(&event);
}
+ joystick3_started = 0;
JoyReset(&JoyInfo3);
- if (!joystick_started && !joystick2_started && !joystick3_started && !joystick4_started
- && SDL_WasInit(SDL_INIT_JOYSTICK) == SDL_INIT_JOYSTICK)
- {
- SDL_QuitSubSystem(SDL_INIT_JOYSTICK);
- if (cv_usejoystick3.value == 0)
- {
- DEBFILE("I_Joystick3: SDL's Joystick system has been shutdown\n");
- }
- }
+
+ // don't shutdown the subsystem here, because hotplugging
}
void I_GetJoystick3Events(void)
@@ -1621,73 +1804,67 @@ void I_GetJoystick3Events(void)
*/
-static int joy_open3(const char *fname)
+static int joy_open3(int joyindex)
{
- int joyindex = atoi(fname);
+ SDL_Joystick *newdev = NULL;
int num_joy = 0;
- int i;
- if (joystick_started == 0 && joystick2_started == 0 && joystick3_started == 0 && joystick4_started == 0)
+ if (SDL_WasInit(SDL_INIT_JOYSTICK) == 0)
{
- if (SDL_InitSubSystem(SDL_INIT_JOYSTICK) == -1)
- {
- CONS_Printf(M_GetText("Couldn't initialize joystick: %s\n"), SDL_GetError());
- return -1;
- }
- else
- num_joy = SDL_NumJoysticks();
+ CONS_Printf(M_GetText("Joystick subsystem not started\n"));
+ return -1;
+ }
- if (num_joy < joyindex)
- {
- CONS_Printf(M_GetText("Cannot use joystick #%d/(%s), it doesn't exist\n"),joyindex,fname);
- for (i = 0; i < num_joy; i++)
- CONS_Printf("#%d/(%s)\n", i+1, SDL_JoystickNameForIndex(i));
- I_ShutdownJoystick3();
- return -1;
- }
- }
- else
- {
- JoyReset(&JoyInfo3);
- //I_ShutdownJoystick();
- //joy_open(fname);
- }
+ if (joyindex <= 0)
+ return -1;
num_joy = SDL_NumJoysticks();
- if (joyindex <= 0 || num_joy == 0 || JoyInfo3.oldjoy == joyindex)
+ if (num_joy == 0)
{
-// I_OutputMsg("Unable to use that joystick #(%s), non-number\n",fname);
- if (num_joy != 0)
- {
- CONS_Printf(M_GetText("Found %d joysticks on this system\n"), num_joy);
- for (i = 0; i < num_joy; i++)
- CONS_Printf("#%d/(%s)\n", i+1, SDL_JoystickNameForIndex(i));
- }
- else
- CONS_Printf("%s", M_GetText("Found no joysticks on this system\n"));
- if (joyindex <= 0 || num_joy == 0) return 0;
+ CONS_Printf("%s", M_GetText("Found no joysticks on this system\n"));
+ return -1;
}
- JoyInfo3.dev = SDL_JoystickOpen(joyindex-1);
+ newdev = SDL_JoystickOpen(joyindex - 1);
- if (!JoyInfo3.dev)
+ // Handle the edge case where the device <-> joystick index assignment can change due to hotplugging
+ // This indexing is SDL's responsibility and there's not much we can do about it.
+ //
+ // Example:
+ // 1. Plug Controller A -> Index 0 opened
+ // 2. Plug Controller B -> Index 1 opened
+ // 3. Unplug Controller A -> Index 0 closed, Index 1 active
+ // 4. Unplug Controller B -> Index 0 inactive, Index 1 closed
+ // 5. Plug Controller B -> Index 0 opened
+ // 6. Plug Controller A -> Index 0 REPLACED, opened as Controller A; Index 1 is now Controller B
+ if (JoyInfo3.dev)
{
- CONS_Printf(M_GetText("Couldn't open joystick3: %s\n"), SDL_GetError());
+ if (JoyInfo3.dev == newdev // same device, nothing to do
+ || (newdev == NULL && SDL_JoystickGetAttached(JoyInfo3.dev))) // we failed, but already have a working device
+ return JoyInfo.axises;
+ // Else, we're changing devices, so send neutral joy events
+ CONS_Debug(DBG_GAMELOGIC, "Joystick3 device is changing; resetting events...\n");
I_ShutdownJoystick3();
+ }
+
+ JoyInfo3.dev = newdev;
+
+ if (JoyInfo3.dev == NULL)
+ {
+ CONS_Debug(DBG_GAMELOGIC, M_GetText("Joystick3: couldn't open device - %s\n"), SDL_GetError());
return -1;
}
else
{
- CONS_Printf(M_GetText("Joystick3: %s\n"), SDL_JoystickName(JoyInfo3.dev));
+ CONS_Debug(DBG_GAMELOGIC, M_GetText("Joystick3: %s\n"), SDL_JoystickName(JoyInfo3.dev));
JoyInfo3.axises = SDL_JoystickNumAxes(JoyInfo3.dev);
- if (JoyInfo3.axises > JOYAXISSET*2)
- JoyInfo3.axises = JOYAXISSET*2;
-/* if (joyaxes < 2)
+ if (JoyInfo3.axises > JOYAXISSET * 2)
+ JoyInfo3.axises = JOYAXISSET * 2;
+ /* if (joyaxes<2)
{
- I_OutputMsg("Not enought axes?\n");
- I_ShutdownJoystick3();
- return 0;
+ I_OutputMsg("Not enought axes?\n");
+ return 0;
}*/
JoyInfo3.buttons = SDL_JoystickNumButtons(JoyInfo3.dev);
@@ -1721,7 +1898,7 @@ static UINT64 lastjoy4hats = 0;
\return void
*/
-static void I_ShutdownJoystick4(void)
+void I_ShutdownJoystick4(void)
{
INT32 i;
event_t event;
@@ -1753,16 +1930,10 @@ static void I_ShutdownJoystick4(void)
D_PostEvent(&event);
}
+ joystick4_started = 0;
JoyReset(&JoyInfo4);
- if (!joystick_started && !joystick2_started && !joystick3_started && !joystick4_started
- && SDL_WasInit(SDL_INIT_JOYSTICK) == SDL_INIT_JOYSTICK)
- {
- SDL_QuitSubSystem(SDL_INIT_JOYSTICK);
- if (cv_usejoystick4.value == 0)
- {
- DEBFILE("I_Joystick4: SDL's Joystick system has been shutdown\n");
- }
- }
+
+ // don't shutdown the subsystem here, because hotplugging
}
void I_GetJoystick4Events(void)
@@ -1904,73 +2075,67 @@ void I_GetJoystick4Events(void)
*/
-static int joy_open4(const char *fname)
+static int joy_open4(int joyindex)
{
- int joyindex = atoi(fname);
+ SDL_Joystick *newdev = NULL;
int num_joy = 0;
- int i;
- if (joystick_started == 0 && joystick2_started == 0 && joystick3_started == 0 && joystick4_started == 0)
+ if (SDL_WasInit(SDL_INIT_JOYSTICK) == 0)
{
- if (SDL_InitSubSystem(SDL_INIT_JOYSTICK) == -1)
- {
- CONS_Printf(M_GetText("Couldn't initialize joystick: %s\n"), SDL_GetError());
- return -1;
- }
- else
- num_joy = SDL_NumJoysticks();
+ CONS_Printf(M_GetText("Joystick subsystem not started\n"));
+ return -1;
+ }
- if (num_joy < joyindex)
- {
- CONS_Printf(M_GetText("Cannot use joystick #%d/(%s), it doesn't exist\n"),joyindex,fname);
- for (i = 0; i < num_joy; i++)
- CONS_Printf("#%d/(%s)\n", i+1, SDL_JoystickNameForIndex(i));
- I_ShutdownJoystick4();
- return -1;
- }
- }
- else
- {
- JoyReset(&JoyInfo4);
- //I_ShutdownJoystick();
- //joy_open(fname);
- }
+ if (joyindex <= 0)
+ return -1;
num_joy = SDL_NumJoysticks();
- if (joyindex <= 0 || num_joy == 0 || JoyInfo4.oldjoy == joyindex)
+ if (num_joy == 0)
{
-// I_OutputMsg("Unable to use that joystick #(%s), non-number\n",fname);
- if (num_joy != 0)
- {
- CONS_Printf(M_GetText("Found %d joysticks on this system\n"), num_joy);
- for (i = 0; i < num_joy; i++)
- CONS_Printf("#%d/(%s)\n", i+1, SDL_JoystickNameForIndex(i));
- }
- else
- CONS_Printf("%s", M_GetText("Found no joysticks on this system\n"));
- if (joyindex <= 0 || num_joy == 0) return 0;
+ CONS_Printf("%s", M_GetText("Found no joysticks on this system\n"));
+ return -1;
}
- JoyInfo4.dev = SDL_JoystickOpen(joyindex-1);
+ newdev = SDL_JoystickOpen(joyindex - 1);
- if (!JoyInfo4.dev)
+ // Handle the edge case where the device <-> joystick index assignment can change due to hotplugging
+ // This indexing is SDL's responsibility and there's not much we can do about it.
+ //
+ // Example:
+ // 1. Plug Controller A -> Index 0 opened
+ // 2. Plug Controller B -> Index 1 opened
+ // 3. Unplug Controller A -> Index 0 closed, Index 1 active
+ // 4. Unplug Controller B -> Index 0 inactive, Index 1 closed
+ // 5. Plug Controller B -> Index 0 opened
+ // 6. Plug Controller A -> Index 0 REPLACED, opened as Controller A; Index 1 is now Controller B
+ if (JoyInfo4.dev)
{
- CONS_Printf(M_GetText("Couldn't open joystick4: %s\n"), SDL_GetError());
+ if (JoyInfo4.dev == newdev // same device, nothing to do
+ || (newdev == NULL && SDL_JoystickGetAttached(JoyInfo4.dev))) // we failed, but already have a working device
+ return JoyInfo.axises;
+ // Else, we're changing devices, so send neutral joy events
+ CONS_Debug(DBG_GAMELOGIC, "Joystick4 device is changing; resetting events...\n");
I_ShutdownJoystick4();
+ }
+
+ JoyInfo4.dev = newdev;
+
+ if (JoyInfo4.dev == NULL)
+ {
+ CONS_Debug(DBG_GAMELOGIC, M_GetText("Joystick4: couldn't open device - %s\n"), SDL_GetError());
return -1;
}
else
{
- CONS_Printf(M_GetText("Joystick4: %s\n"), SDL_JoystickName(JoyInfo4.dev));
+ CONS_Debug(DBG_GAMELOGIC, M_GetText("Joystick4: %s\n"), SDL_JoystickName(JoyInfo4.dev));
JoyInfo4.axises = SDL_JoystickNumAxes(JoyInfo4.dev);
- if (JoyInfo4.axises > JOYAXISSET*2)
- JoyInfo4.axises = JOYAXISSET*2;
-/* if (joyaxes < 2)
+ if (JoyInfo4.axises > JOYAXISSET * 2)
+ JoyInfo4.axises = JOYAXISSET * 2;
+ /* if (joyaxes<2)
{
- I_OutputMsg("Not enought axes?\n");
- I_ShutdownJoystick4();
- return 0;
+ I_OutputMsg("Not enought axes?\n");
+ return 0;
}*/
JoyInfo4.buttons = SDL_JoystickNumButtons(JoyInfo4.dev);
@@ -1983,7 +2148,7 @@ static int joy_open4(const char *fname)
JoyInfo4.balls = SDL_JoystickNumBalls(JoyInfo4.dev);
- //Joystick4.bGamepadStyle = !stricmp(SDL_JoystickName(JoyInfo4.dev), "pad");
+ //Joystick.bGamepadStyle = !stricmp(SDL_JoystickName(JoyInfo4.dev), "pad");
return JoyInfo4.axises;
}
@@ -1994,107 +2159,222 @@ static int joy_open4(const char *fname)
//
void I_InitJoystick(void)
{
- I_ShutdownJoystick();
- SDL_SetHintWithPriority("SDL_XINPUT_ENABLED", "0", SDL_HINT_OVERRIDE);
- if (!strcmp(cv_usejoystick.string, "0") || M_CheckParm("-nojoy"))
+ SDL_Joystick *newjoy = NULL;
+
+ //I_ShutdownJoystick();
+ //SDL_SetHintWithPriority("SDL_XINPUT_ENABLED", "0", SDL_HINT_OVERRIDE);
+ if (M_CheckParm("-nojoy"))
return;
- if (joy_open(cv_usejoystick.string) != -1)
- JoyInfo.oldjoy = atoi(cv_usejoystick.string);
+
+ if (M_CheckParm("-noxinput"))
+ SDL_SetHintWithPriority("SDL_XINPUT_ENABLED", "0", SDL_HINT_OVERRIDE);
+
+ if (M_CheckParm("-nohidapi"))
+ SDL_SetHintWithPriority("SDL_JOYSTICK_HIDAPI", "0", SDL_HINT_OVERRIDE);
+
+ if (SDL_WasInit(SDL_INIT_JOYSTICK) == 0)
+ {
+ CONS_Printf("I_InitJoystick()...\n");
+
+ if (SDL_InitSubSystem(SDL_INIT_JOYSTICK) == -1)
+ {
+ CONS_Printf(M_GetText("Couldn't initialize joystick: %s\n"), SDL_GetError());
+ return;
+ }
+ }
+
+ if (cv_usejoystick.value)
+ newjoy = SDL_JoystickOpen(cv_usejoystick.value-1);
+
+ if (newjoy && (JoyInfo2.dev == newjoy || JoyInfo3.dev == newjoy || JoyInfo4.dev == newjoy)) // don't override an active device
+ cv_usejoystick.value = I_GetJoystickDeviceIndex(JoyInfo.dev) + 1;
+ else if (newjoy && joy_open(cv_usejoystick.value) != -1)
+ {
+ // SDL's device indexes are unstable, so cv_usejoystick may not match
+ // the actual device index. So let's cheat a bit and find the device's current index.
+ JoyInfo.oldjoy = I_GetJoystickDeviceIndex(JoyInfo.dev) + 1;
+ joystick_started = 1;
+ }
else
{
+ if (JoyInfo.oldjoy)
+ I_ShutdownJoystick();
cv_usejoystick.value = 0;
- return;
+ joystick_started = 0;
}
- joystick_started = 1;
+
+ if (JoyInfo.dev != newjoy && JoyInfo2.dev != newjoy && JoyInfo3.dev != newjoy && JoyInfo4.dev != newjoy)
+ SDL_JoystickClose(newjoy);
}
void I_InitJoystick2(void)
{
- I_ShutdownJoystick2();
- SDL_SetHintWithPriority("SDL_XINPUT_ENABLED", "0", SDL_HINT_OVERRIDE);
- if (!strcmp(cv_usejoystick2.string, "0") || M_CheckParm("-nojoy"))
+ SDL_Joystick *newjoy = NULL;
+
+ //I_ShutdownJoystick2();
+ //SDL_SetHintWithPriority("SDL_XINPUT_ENABLED", "0", SDL_HINT_OVERRIDE);
+ if (M_CheckParm("-nojoy"))
return;
- if (joy_open2(cv_usejoystick2.string) != -1)
- JoyInfo2.oldjoy = atoi(cv_usejoystick2.string);
+
+ if (SDL_WasInit(SDL_INIT_JOYSTICK) == 0)
+ {
+ CONS_Printf("I_InitJoystick2()...\n");
+ if (SDL_InitSubSystem(SDL_INIT_JOYSTICK) == -1)
+ {
+ CONS_Printf(M_GetText("Couldn't initialize joystick: %s\n"), SDL_GetError());
+ return;
+ }
+ }
+
+ if (cv_usejoystick2.value)
+ newjoy = SDL_JoystickOpen(cv_usejoystick2.value-1);
+
+ if (newjoy && (JoyInfo.dev == newjoy || JoyInfo3.dev == newjoy || JoyInfo4.dev == newjoy)) // don't override an active device
+ cv_usejoystick2.value = I_GetJoystickDeviceIndex(JoyInfo2.dev) + 1;
+ else if (newjoy && joy_open2(cv_usejoystick2.value) != -1)
+ {
+ // SDL's device indexes are unstable, so cv_usejoystick may not match
+ // the actual device index. So let's cheat a bit and find the device's current index.
+ JoyInfo2.oldjoy = I_GetJoystickDeviceIndex(JoyInfo2.dev) + 1;
+ joystick2_started = 1;
+ }
else
{
+ if (JoyInfo2.oldjoy)
+ I_ShutdownJoystick2();
cv_usejoystick2.value = 0;
- return;
+ joystick2_started = 0;
}
- joystick2_started = 1;
+
+ if (JoyInfo.dev != newjoy && JoyInfo2.dev != newjoy && JoyInfo3.dev != newjoy && JoyInfo4.dev != newjoy)
+ SDL_JoystickClose(newjoy);
}
void I_InitJoystick3(void)
{
- I_ShutdownJoystick3();
- SDL_SetHintWithPriority("SDL_XINPUT_ENABLED", "0", SDL_HINT_OVERRIDE);
- if (!strcmp(cv_usejoystick3.string, "0") || M_CheckParm("-nojoy"))
+ SDL_Joystick *newjoy = NULL;
+
+ //I_ShutdownJoystick3();
+ //SDL_SetHintWithPriority("SDL_XINPUT_ENABLED", "0", SDL_HINT_OVERRIDE);
+ if (M_CheckParm("-nojoy"))
return;
- if (joy_open3(cv_usejoystick3.string) != -1)
- JoyInfo3.oldjoy = atoi(cv_usejoystick3.string);
+
+ if (SDL_WasInit(SDL_INIT_JOYSTICK) == 0)
+ {
+ CONS_Printf("I_InitJoystick3()...\n");
+ if (SDL_InitSubSystem(SDL_INIT_JOYSTICK) == -1)
+ {
+ CONS_Printf(M_GetText("Couldn't initialize joystick: %s\n"), SDL_GetError());
+ return;
+ }
+ }
+
+ if (cv_usejoystick3.value)
+ newjoy = SDL_JoystickOpen(cv_usejoystick3.value - 1);
+
+ if (newjoy && (JoyInfo.dev == newjoy || JoyInfo2.dev == newjoy || JoyInfo4.dev == newjoy)) // don't override an active device
+ cv_usejoystick3.value = I_GetJoystickDeviceIndex(JoyInfo3.dev) + 1;
+ else if (newjoy && joy_open3(cv_usejoystick3.value) != -1)
+ {
+ // SDL's device indexes are unstable, so cv_usejoystick may not match
+ // the actual device index. So let's cheat a bit and find the device's current index.
+ JoyInfo3.oldjoy = I_GetJoystickDeviceIndex(JoyInfo3.dev) + 1;
+ joystick3_started = 1;
+ }
else
{
+ if (JoyInfo3.oldjoy)
+ I_ShutdownJoystick3();
cv_usejoystick3.value = 0;
- return;
+ joystick3_started = 0;
}
- joystick3_started = 1;
+
+ if (JoyInfo.dev != newjoy && JoyInfo2.dev != newjoy && JoyInfo3.dev != newjoy && JoyInfo4.dev != newjoy)
+ SDL_JoystickClose(newjoy);
}
void I_InitJoystick4(void)
{
- I_ShutdownJoystick4();
- SDL_SetHintWithPriority("SDL_XINPUT_ENABLED", "0", SDL_HINT_OVERRIDE);
- if (!strcmp(cv_usejoystick4.string, "0") || M_CheckParm("-nojoy"))
+ SDL_Joystick *newjoy = NULL;
+
+ //I_ShutdownJoystick4();
+ //SDL_SetHintWithPriority("SDL_XINPUT_ENABLED", "0", SDL_HINT_OVERRIDE);
+ if (M_CheckParm("-nojoy"))
return;
- if (joy_open4(cv_usejoystick4.string) != -1)
- JoyInfo4.oldjoy = atoi(cv_usejoystick4.string);
+
+ if (SDL_WasInit(SDL_INIT_JOYSTICK) == 0)
+ {
+ CONS_Printf("I_InitJoystick4()...\n");
+ if (SDL_InitSubSystem(SDL_INIT_JOYSTICK) == -1)
+ {
+ CONS_Printf(M_GetText("Couldn't initialize joystick: %s\n"), SDL_GetError());
+ return;
+ }
+ }
+
+ if (cv_usejoystick4.value)
+ newjoy = SDL_JoystickOpen(cv_usejoystick4.value - 1);
+
+ if (newjoy && (JoyInfo.dev == newjoy || JoyInfo2.dev == newjoy || JoyInfo4.dev == newjoy)) // don't override an active device
+ cv_usejoystick4.value = I_GetJoystickDeviceIndex(JoyInfo4.dev) + 1;
+ else if (newjoy && joy_open4(cv_usejoystick4.value) != -1)
+ {
+ // SDL's device indexes are unstable, so cv_usejoystick may not match
+ // the actual device index. So let's cheat a bit and find the device's current index.
+ JoyInfo4.oldjoy = I_GetJoystickDeviceIndex(JoyInfo4.dev) + 1;
+ joystick4_started = 1;
+ }
else
{
+ if (JoyInfo4.oldjoy)
+ I_ShutdownJoystick4();
cv_usejoystick4.value = 0;
- return;
+ joystick4_started = 0;
}
- joystick4_started = 1;
+
+ if (JoyInfo.dev != newjoy && JoyInfo2.dev != newjoy && JoyInfo3.dev != newjoy && JoyInfo4.dev != newjoy)
+ SDL_JoystickClose(newjoy);
}
static void I_ShutdownInput(void)
{
+ // Yes, the name is misleading: these send neutral events to
+ // clean up the unplugged joystick's input
+ // Note these methods are internal to this file, not called elsewhere.
+ I_ShutdownJoystick();
+ I_ShutdownJoystick2();
+ I_ShutdownJoystick3();
+ I_ShutdownJoystick4();
+
if (SDL_WasInit(SDL_INIT_JOYSTICK) == SDL_INIT_JOYSTICK)
{
- JoyReset(&JoyInfo);
- JoyReset(&JoyInfo2);
- JoyReset(&JoyInfo3);
- JoyReset(&JoyInfo4);
+ CONS_Printf("Shutting down joy system\n");
SDL_QuitSubSystem(SDL_INIT_JOYSTICK);
+ I_OutputMsg("I_Joystick: SDL's Joystick system has been shutdown\n");
}
-
}
INT32 I_NumJoys(void)
{
INT32 numjoy = 0;
- if (SDL_WasInit(SDL_INIT_JOYSTICK) == 0)
- {
- if (SDL_InitSubSystem(SDL_INIT_JOYSTICK) != -1)
- numjoy = SDL_NumJoysticks();
- SDL_QuitSubSystem(SDL_INIT_JOYSTICK);
- }
- else
+ if (SDL_WasInit(SDL_INIT_JOYSTICK) == SDL_INIT_JOYSTICK)
numjoy = SDL_NumJoysticks();
return numjoy;
}
+static char joyname[255]; // MAX_PATH; joystick name is straight from the driver
+
const char *I_GetJoyName(INT32 joyindex)
{
- const char *joyname = "NA";
+ const char *tempname = NULL;
+ joyname[0] = 0;
joyindex--; //SDL's Joystick System starts at 0, not 1
- if (SDL_WasInit(SDL_INIT_JOYSTICK) == 0)
+ if (SDL_WasInit(SDL_INIT_JOYSTICK) == SDL_INIT_JOYSTICK)
{
- if (SDL_InitSubSystem(SDL_INIT_JOYSTICK) != -1)
- joyname = SDL_JoystickNameForIndex(joyindex);
- SDL_QuitSubSystem(SDL_INIT_JOYSTICK);
+ tempname = SDL_JoystickNameForIndex(joyindex);
+ if (tempname)
+ strncpy(joyname, tempname, 255);
}
- else
- joyname = SDL_JoystickNameForIndex(joyindex);
return joyname;
}
@@ -2171,7 +2451,7 @@ void I_UpdateMumble(const mobj_t *mobj, const listener_t listener)
if(mumble->uiVersion != 2) {
wcsncpy(mumble->name, L"SRB2Kart "VERSIONSTRINGW, 256);
- wcsncpy(mumble->description, L"Sonic Robo Blast 2 with integrated Mumble Link support.", 2048);
+ wcsncpy(mumble->description, L"Sonic Robo Blast 2 Kart with integrated Mumble Link support.", 2048);
mumble->uiVersion = 2;
}
mumble->uiTick++;
@@ -2801,6 +3081,8 @@ void I_Quit(void)
printf("\r");
ShowEndTxt();
}
+ if (myargmalloc)
+ free(myargv); // Deallocate allocated memory
death:
W_Shutdown();
exit(0);
diff --git a/src/sdl/i_video.c b/src/sdl/i_video.c
index b3587601..f63e9847 100644
--- a/src/sdl/i_video.c
+++ b/src/sdl/i_video.c
@@ -72,6 +72,7 @@
#include "../console.h"
#include "../command.h"
#include "sdlmain.h"
+#include "../i_system.h"
#ifdef HWRENDER
#include "../hardware/hw_main.h"
#include "../hardware/hw_drv.h"
@@ -200,7 +201,10 @@ static void SDLSetMode(INT32 width, INT32 height, SDL_bool fullscreen)
}
// Reposition window only in windowed mode
SDL_SetWindowSize(window, width, height);
- SDL_SetWindowPosition(window, SDL_WINDOWPOS_CENTERED, SDL_WINDOWPOS_CENTERED);
+ SDL_SetWindowPosition(window,
+ SDL_WINDOWPOS_CENTERED_DISPLAY(SDL_GetWindowDisplayIndex(window)),
+ SDL_WINDOWPOS_CENTERED_DISPLAY(SDL_GetWindowDisplayIndex(window))
+ );
}
}
else
@@ -357,6 +361,7 @@ static INT32 Impl_SDL_Scancode_To_Keycode(SDL_Scancode code)
static void SDLdoUngrabMouse(void)
{
+ SDL_ShowCursor(SDL_ENABLE);
SDL_SetWindowGrab(window, SDL_FALSE);
wrapmouseok = SDL_FALSE;
SDL_SetRelativeMouseMode(SDL_FALSE);
@@ -366,6 +371,7 @@ void SDLforceUngrabMouse(void)
{
if (SDL_WasInit(SDL_INIT_VIDEO)==SDL_INIT_VIDEO && window != NULL)
{
+ SDL_ShowCursor(SDL_ENABLE);
SDL_SetWindowGrab(window, SDL_FALSE);
wrapmouseok = SDL_FALSE;
SDL_SetRelativeMouseMode(SDL_FALSE);
@@ -617,6 +623,8 @@ static void Impl_HandleWindowEvent(SDL_WindowEvent evt)
if (cv_usemouse.value) I_StartupMouse();
}
//else firsttimeonmouse = SDL_FALSE;
+
+ capslock = !!( SDL_GetModState() & KMOD_CAPS );// in case CL changes
}
else if (!mousefocus && !kbfocus)
{
@@ -819,6 +827,33 @@ static void Impl_HandleJoystickAxisEvent(SDL_JoyAxisEvent evt)
D_PostEvent(&event);
}
+#if 0
+static void Impl_HandleJoystickHatEvent(SDL_JoyHatEvent evt)
+{
+ event_t event;
+ SDL_JoystickID joyid[2];
+
+ // Determine the Joystick IDs for each current open joystick
+ joyid[0] = SDL_JoystickInstanceID(JoyInfo.dev);
+ joyid[1] = SDL_JoystickInstanceID(JoyInfo2.dev);
+
+ if (evt.hat >= JOYHATS)
+ return; // ignore hats with too high an index
+
+ if (evt.which == joyid[0])
+ {
+ event.data1 = KEY_HAT1 + (evt.hat*4);
+ }
+ else if (evt.which == joyid[1])
+ {
+ event.data1 = KEY_2HAT1 + (evt.hat*4);
+ }
+ else return;
+
+ // NOTE: UNFINISHED
+}
+#endif
+
static void Impl_HandleJoystickButtonEvent(SDL_JoyButtonEvent evt, Uint32 type)
{
event_t event;
@@ -866,6 +901,8 @@ static void Impl_HandleJoystickButtonEvent(SDL_JoyButtonEvent evt, Uint32 type)
if (event.type != ev_console) D_PostEvent(&event);
}
+
+
void I_GetEvent(void)
{
SDL_Event evt;
@@ -906,10 +943,293 @@ void I_GetEvent(void)
case SDL_JOYAXISMOTION:
Impl_HandleJoystickAxisEvent(evt.jaxis);
break;
+#if 0
+ case SDL_JOYHATMOTION:
+ Impl_HandleJoystickHatEvent(evt.jhat)
+ break;
+#endif
case SDL_JOYBUTTONUP:
case SDL_JOYBUTTONDOWN:
Impl_HandleJoystickButtonEvent(evt.jbutton, evt.type);
break;
+
+ ////////////////////////////////////////////////////////////
+
+ case SDL_JOYDEVICEADDED:
+ {
+ // OH BOY are you in for a good time! #abominationstation
+
+ SDL_Joystick *newjoy = SDL_JoystickOpen(evt.jdevice.which);
+
+ CONS_Debug(DBG_GAMELOGIC, "Joystick device index %d added\n", evt.jdevice.which + 1);
+
+ ////////////////////////////////////////////////////////////
+ // Because SDL's device index is unstable, we're going to cheat here a bit:
+ // For the first joystick setting that is NOT active:
+ //
+ // 1. Set cv_usejoystickX.value to the new device index (this does not change what is written to config.cfg)
+ //
+ // 2. Set OTHERS' cv_usejoystickX.value to THEIR new device index, because it likely changed
+ // * If device doesn't exist, switch cv_usejoystick back to default value (.string)
+ // * BUT: If that default index is being occupied, use ANOTHER cv_usejoystick's default value!
+ ////////////////////////////////////////////////////////////
+
+ //////////////////////////////
+ // PLAYER 1
+ //////////////////////////////
+
+ if (newjoy && (!JoyInfo.dev || !SDL_JoystickGetAttached(JoyInfo.dev))
+ && JoyInfo2.dev != newjoy && JoyInfo3.dev != newjoy && JoyInfo4.dev != newjoy) // don't override a currently active device
+ {
+ cv_usejoystick.value = evt.jdevice.which + 1;
+ I_UpdateJoystickDeviceIndices(1);
+ }
+
+ //////////////////////////////
+ // PLAYER 2
+ //////////////////////////////
+
+ else if (newjoy && (!JoyInfo2.dev || !SDL_JoystickGetAttached(JoyInfo2.dev))
+ && JoyInfo.dev != newjoy && JoyInfo3.dev != newjoy && JoyInfo4.dev != newjoy) // don't override a currently active device
+ {
+ cv_usejoystick2.value = evt.jdevice.which + 1;
+ I_UpdateJoystickDeviceIndices(2);
+ }
+
+ //////////////////////////////
+ // PLAYER 3
+ //////////////////////////////
+
+ else if (newjoy && (!JoyInfo3.dev || !SDL_JoystickGetAttached(JoyInfo3.dev))
+ && JoyInfo.dev != newjoy && JoyInfo2.dev != newjoy && JoyInfo4.dev != newjoy) // don't override a currently active device
+ {
+ cv_usejoystick3.value = evt.jdevice.which + 1;
+ I_UpdateJoystickDeviceIndices(3);
+ }
+
+ //////////////////////////////
+ // PLAYER 4
+ //////////////////////////////
+
+ else if (newjoy && (!JoyInfo4.dev || !SDL_JoystickGetAttached(JoyInfo4.dev))
+ && JoyInfo.dev != newjoy && JoyInfo2.dev != newjoy && JoyInfo3.dev != newjoy) // don't override a currently active device
+ {
+ cv_usejoystick4.value = evt.jdevice.which + 1;
+ I_UpdateJoystickDeviceIndices(4);
+ }
+
+ ////////////////////////////////////////////////////////////
+ // Was cv_usejoystick disabled in settings?
+ ////////////////////////////////////////////////////////////
+
+ if (!strcmp(cv_usejoystick.string, "0") || !cv_usejoystick.value)
+ cv_usejoystick.value = 0;
+ else if (atoi(cv_usejoystick.string) <= I_NumJoys() // don't mess if we intentionally set higher than NumJoys
+ && cv_usejoystick.value) // update the cvar ONLY if a device exists
+ CV_SetValue(&cv_usejoystick, cv_usejoystick.value);
+
+ if (!strcmp(cv_usejoystick2.string, "0") || !cv_usejoystick2.value)
+ cv_usejoystick2.value = 0;
+ else if (atoi(cv_usejoystick2.string) <= I_NumJoys() // don't mess if we intentionally set higher than NumJoys
+ && cv_usejoystick2.value) // update the cvar ONLY if a device exists
+ CV_SetValue(&cv_usejoystick2, cv_usejoystick2.value);
+
+ if (!strcmp(cv_usejoystick3.string, "0") || !cv_usejoystick3.value)
+ cv_usejoystick3.value = 0;
+ else if (atoi(cv_usejoystick3.string) <= I_NumJoys() // don't mess if we intentionally set higher than NumJoys
+ && cv_usejoystick3.value) // update the cvar ONLY if a device exists
+ CV_SetValue(&cv_usejoystick3, cv_usejoystick3.value);
+
+ if (!strcmp(cv_usejoystick4.string, "0") || !cv_usejoystick4.value)
+ cv_usejoystick4.value = 0;
+ else if (atoi(cv_usejoystick4.string) <= I_NumJoys() // don't mess if we intentionally set higher than NumJoys
+ && cv_usejoystick4.value) // update the cvar ONLY if a device exists
+ CV_SetValue(&cv_usejoystick4, cv_usejoystick4.value);
+
+ ////////////////////////////////////////////////////////////
+ // Update all joysticks' init states
+ // This is a little wasteful since cv_usejoystick already calls this, but
+ // we need to do this in case CV_SetValue did nothing because the string was already same.
+ // if the device is already active, this should do nothing, effectively.
+ ////////////////////////////////////////////////////////////
+
+ I_InitJoystick();
+ I_InitJoystick2();
+ I_InitJoystick3();
+ I_InitJoystick4();
+
+ ////////////////////////////////////////////////////////////
+
+ CONS_Debug(DBG_GAMELOGIC, "Joystick1 device index: %d\n", JoyInfo.oldjoy);
+ CONS_Debug(DBG_GAMELOGIC, "Joystick2 device index: %d\n", JoyInfo2.oldjoy);
+ CONS_Debug(DBG_GAMELOGIC, "Joystick3 device index: %d\n", JoyInfo3.oldjoy);
+ CONS_Debug(DBG_GAMELOGIC, "Joystick4 device index: %d\n", JoyInfo4.oldjoy);
+
+ // update the menu
+ if (currentMenu == &OP_JoystickSetDef)
+ M_SetupJoystickMenu(0);
+
+ if (JoyInfo.dev != newjoy && JoyInfo2.dev != newjoy && JoyInfo3.dev != newjoy && JoyInfo4.dev != newjoy)
+ SDL_JoystickClose(newjoy);
+ }
+ break;
+
+ ////////////////////////////////////////////////////////////
+
+ case SDL_JOYDEVICEREMOVED:
+ if (JoyInfo.dev && !SDL_JoystickGetAttached(JoyInfo.dev))
+ {
+ CONS_Debug(DBG_GAMELOGIC, "Joystick1 removed, device index: %d\n", JoyInfo.oldjoy);
+ I_ShutdownJoystick();
+ }
+
+ if (JoyInfo2.dev && !SDL_JoystickGetAttached(JoyInfo2.dev))
+ {
+ CONS_Debug(DBG_GAMELOGIC, "Joystick2 removed, device index: %d\n", JoyInfo2.oldjoy);
+ I_ShutdownJoystick2();
+ }
+
+ if (JoyInfo3.dev && !SDL_JoystickGetAttached(JoyInfo3.dev))
+ {
+ CONS_Debug(DBG_GAMELOGIC, "Joystick3 removed, device index: %d\n", JoyInfo3.oldjoy);
+ I_ShutdownJoystick3();
+ }
+
+ if (JoyInfo4.dev && !SDL_JoystickGetAttached(JoyInfo4.dev))
+ {
+ CONS_Debug(DBG_GAMELOGIC, "Joystick4 removed, device index: %d\n", JoyInfo4.oldjoy);
+ I_ShutdownJoystick4();
+ }
+
+ ////////////////////////////////////////////////////////////
+ // Update the device indexes, because they likely changed
+ // * If device doesn't exist, switch cv_usejoystick back to default value (.string)
+ // * BUT: If that default index is being occupied, use ANOTHER cv_usejoystick's default value!
+ ////////////////////////////////////////////////////////////
+
+ if (JoyInfo.dev)
+ cv_usejoystick.value = JoyInfo.oldjoy = I_GetJoystickDeviceIndex(JoyInfo.dev) + 1;
+ else if (atoi(cv_usejoystick.string) != JoyInfo2.oldjoy
+ && atoi(cv_usejoystick.string) != JoyInfo3.oldjoy
+ && atoi(cv_usejoystick.string) != JoyInfo4.oldjoy)
+ cv_usejoystick.value = atoi(cv_usejoystick.string);
+ else if (atoi(cv_usejoystick2.string) != JoyInfo2.oldjoy
+ && atoi(cv_usejoystick2.string) != JoyInfo3.oldjoy
+ && atoi(cv_usejoystick2.string) != JoyInfo4.oldjoy)
+ cv_usejoystick.value = atoi(cv_usejoystick2.string);
+ else if (atoi(cv_usejoystick3.string) != JoyInfo2.oldjoy
+ && atoi(cv_usejoystick3.string) != JoyInfo3.oldjoy
+ && atoi(cv_usejoystick3.string) != JoyInfo4.oldjoy)
+ cv_usejoystick.value = atoi(cv_usejoystick3.string);
+ else if (atoi(cv_usejoystick4.string) != JoyInfo2.oldjoy
+ && atoi(cv_usejoystick4.string) != JoyInfo3.oldjoy
+ && atoi(cv_usejoystick4.string) != JoyInfo4.oldjoy)
+ cv_usejoystick.value = atoi(cv_usejoystick4.string);
+ else // we tried...
+ cv_usejoystick.value = 0;
+
+ if (JoyInfo2.dev)
+ cv_usejoystick2.value = JoyInfo2.oldjoy = I_GetJoystickDeviceIndex(JoyInfo2.dev) + 1;
+ else if (atoi(cv_usejoystick.string) != JoyInfo.oldjoy
+ && atoi(cv_usejoystick.string) != JoyInfo3.oldjoy
+ && atoi(cv_usejoystick.string) != JoyInfo4.oldjoy)
+ cv_usejoystick2.value = atoi(cv_usejoystick.string);
+ else if (atoi(cv_usejoystick2.string) != JoyInfo.oldjoy
+ && atoi(cv_usejoystick2.string) != JoyInfo3.oldjoy
+ && atoi(cv_usejoystick2.string) != JoyInfo4.oldjoy)
+ cv_usejoystick2.value = atoi(cv_usejoystick2.string);
+ else if (atoi(cv_usejoystick3.string) != JoyInfo.oldjoy
+ && atoi(cv_usejoystick3.string) != JoyInfo3.oldjoy
+ && atoi(cv_usejoystick3.string) != JoyInfo4.oldjoy)
+ cv_usejoystick2.value = atoi(cv_usejoystick3.string);
+ else if (atoi(cv_usejoystick4.string) != JoyInfo.oldjoy
+ && atoi(cv_usejoystick4.string) != JoyInfo3.oldjoy
+ && atoi(cv_usejoystick4.string) != JoyInfo4.oldjoy)
+ cv_usejoystick2.value = atoi(cv_usejoystick4.string);
+ else // we tried...
+ cv_usejoystick2.value = 0;
+
+ if (JoyInfo3.dev)
+ cv_usejoystick3.value = JoyInfo3.oldjoy = I_GetJoystickDeviceIndex(JoyInfo3.dev) + 1;
+ else if (atoi(cv_usejoystick.string) != JoyInfo.oldjoy
+ && atoi(cv_usejoystick.string) != JoyInfo2.oldjoy
+ && atoi(cv_usejoystick.string) != JoyInfo4.oldjoy)
+ cv_usejoystick3.value = atoi(cv_usejoystick.string);
+ else if (atoi(cv_usejoystick2.string) != JoyInfo.oldjoy
+ && atoi(cv_usejoystick2.string) != JoyInfo2.oldjoy
+ && atoi(cv_usejoystick2.string) != JoyInfo4.oldjoy)
+ cv_usejoystick3.value = atoi(cv_usejoystick2.string);
+ else if (atoi(cv_usejoystick3.string) != JoyInfo.oldjoy
+ && atoi(cv_usejoystick3.string) != JoyInfo2.oldjoy
+ && atoi(cv_usejoystick3.string) != JoyInfo4.oldjoy)
+ cv_usejoystick3.value = atoi(cv_usejoystick3.string);
+ else if (atoi(cv_usejoystick4.string) != JoyInfo.oldjoy
+ && atoi(cv_usejoystick4.string) != JoyInfo2.oldjoy
+ && atoi(cv_usejoystick4.string) != JoyInfo4.oldjoy)
+ cv_usejoystick3.value = atoi(cv_usejoystick4.string);
+ else // we tried...
+ cv_usejoystick3.value = 0;
+
+ if (JoyInfo4.dev)
+ cv_usejoystick4.value = JoyInfo4.oldjoy = I_GetJoystickDeviceIndex(JoyInfo4.dev) + 1;
+ else if (atoi(cv_usejoystick.string) != JoyInfo.oldjoy
+ && atoi(cv_usejoystick.string) != JoyInfo2.oldjoy
+ && atoi(cv_usejoystick.string) != JoyInfo3.oldjoy)
+ cv_usejoystick4.value = atoi(cv_usejoystick.string);
+ else if (atoi(cv_usejoystick2.string) != JoyInfo.oldjoy
+ && atoi(cv_usejoystick2.string) != JoyInfo2.oldjoy
+ && atoi(cv_usejoystick2.string) != JoyInfo3.oldjoy)
+ cv_usejoystick4.value = atoi(cv_usejoystick2.string);
+ else if (atoi(cv_usejoystick3.string) != JoyInfo.oldjoy
+ && atoi(cv_usejoystick3.string) != JoyInfo2.oldjoy
+ && atoi(cv_usejoystick3.string) != JoyInfo3.oldjoy)
+ cv_usejoystick4.value = atoi(cv_usejoystick3.string);
+ else if (atoi(cv_usejoystick4.string) != JoyInfo.oldjoy
+ && atoi(cv_usejoystick4.string) != JoyInfo2.oldjoy
+ && atoi(cv_usejoystick4.string) != JoyInfo3.oldjoy)
+ cv_usejoystick4.value = atoi(cv_usejoystick4.string);
+ else // we tried...
+ cv_usejoystick4.value = 0;
+
+ ////////////////////////////////////////////////////////////
+ // Was cv_usejoystick disabled in settings?
+ ////////////////////////////////////////////////////////////
+
+ if (!strcmp(cv_usejoystick.string, "0"))
+ cv_usejoystick.value = 0;
+ else if (atoi(cv_usejoystick.string) <= I_NumJoys() // don't mess if we intentionally set higher than NumJoys
+ && cv_usejoystick.value) // update the cvar ONLY if a device exists
+ CV_SetValue(&cv_usejoystick, cv_usejoystick.value);
+
+ if (!strcmp(cv_usejoystick2.string, "0"))
+ cv_usejoystick2.value = 0;
+ else if (atoi(cv_usejoystick2.string) <= I_NumJoys() // don't mess if we intentionally set higher than NumJoys
+ && cv_usejoystick2.value) // update the cvar ONLY if a device exists
+ CV_SetValue(&cv_usejoystick2, cv_usejoystick2.value);
+
+ if (!strcmp(cv_usejoystick3.string, "0"))
+ cv_usejoystick3.value = 0;
+ else if (atoi(cv_usejoystick3.string) <= I_NumJoys() // don't mess if we intentionally set higher than NumJoys
+ && cv_usejoystick3.value) // update the cvar ONLY if a device exists
+ CV_SetValue(&cv_usejoystick3, cv_usejoystick3.value);
+
+ if (!strcmp(cv_usejoystick4.string, "0"))
+ cv_usejoystick4.value = 0;
+ else if (atoi(cv_usejoystick4.string) <= I_NumJoys() // don't mess if we intentionally set higher than NumJoys
+ && cv_usejoystick4.value) // update the cvar ONLY if a device exists
+ CV_SetValue(&cv_usejoystick4, cv_usejoystick4.value);
+
+ ////////////////////////////////////////////////////////////
+
+ CONS_Debug(DBG_GAMELOGIC, "Joystick1 device index: %d\n", JoyInfo.oldjoy);
+ CONS_Debug(DBG_GAMELOGIC, "Joystick2 device index: %d\n", JoyInfo2.oldjoy);
+ CONS_Debug(DBG_GAMELOGIC, "Joystick3 device index: %d\n", JoyInfo3.oldjoy);
+ CONS_Debug(DBG_GAMELOGIC, "Joystick4 device index: %d\n", JoyInfo4.oldjoy);
+
+ // update the menu
+ if (currentMenu == &OP_JoystickSetDef)
+ M_SetupJoystickMenu(0);
+ break;
case SDL_QUIT:
I_Quit();
M_QuitResponse('y');
@@ -1529,7 +1849,7 @@ void I_StartupGraphics(void)
HWD.pfnDrawScreenFinalTexture=hwSym("DrawScreenFinalTexture",NULL);
// check gl renderer lib
if (HWD.pfnGetRenderVersion() != VERSION)
- I_Error("%s", M_GetText("The version of the renderer doesn't match the version of the executable\nBe sure you have installed SRB2 properly.\n"));
+ I_Error("%s", M_GetText("The version of the renderer doesn't match the version of the executable\nBe sure you have installed SRB2Kart properly.\n"));
if (!HWD.pfnInit(I_Error)) // let load the OpenGL library
{
rendermode = render_soft;
@@ -1579,9 +1899,18 @@ void I_StartupGraphics(void)
realheight = (Uint16)vid.height;
VID_Command_Info_f();
- if (!disable_mouse) SDL_ShowCursor(SDL_DISABLE);
SDLdoUngrabMouse();
+ SDL_RaiseWindow(window);
+
+ if (mousegrabok && !disable_mouse)
+ {
+ SDL_ShowCursor(SDL_DISABLE);
+ SDL_SetRelativeMouseMode(SDL_TRUE);
+ wrapmouseok = SDL_TRUE;
+ SDL_SetWindowGrab(window, SDL_TRUE);
+ }
+
graphics_started = true;
}
diff --git a/src/sdl/macosx/Srb2mac.icns b/src/sdl/macosx/Srb2mac.icns
index 4baedc1c..890c268f 100644
Binary files a/src/sdl/macosx/Srb2mac.icns and b/src/sdl/macosx/Srb2mac.icns differ
diff --git a/src/sdl/macosx/Srb2mac.xcodeproj/project.pbxproj b/src/sdl/macosx/Srb2mac.xcodeproj/project.pbxproj
index eaac87de..94a3fbb6 100644
--- a/src/sdl/macosx/Srb2mac.xcodeproj/project.pbxproj
+++ b/src/sdl/macosx/Srb2mac.xcodeproj/project.pbxproj
@@ -1214,7 +1214,7 @@
C01FCF4B08A954540054247B /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
- CURRENT_PROJECT_VERSION = 2.1.20;
+ CURRENT_PROJECT_VERSION = 2.1.23;
GCC_PREPROCESSOR_DEFINITIONS = (
"$(inherited)",
NORMALSRB2,
@@ -1226,7 +1226,7 @@
C01FCF4C08A954540054247B /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
- CURRENT_PROJECT_VERSION = 2.1.20;
+ CURRENT_PROJECT_VERSION = 2.1.23;
GCC_ENABLE_FIX_AND_CONTINUE = NO;
GCC_GENERATE_DEBUGGING_SYMBOLS = NO;
GCC_PREPROCESSOR_DEFINITIONS = (
diff --git a/src/sdl/mixer_sound.c b/src/sdl/mixer_sound.c
index a0446f87..954ef5ee 100644
--- a/src/sdl/mixer_sound.c
+++ b/src/sdl/mixer_sound.c
@@ -92,6 +92,12 @@ void I_StartupSound(void)
{
I_Assert(!sound_started);
+#ifdef _WIN32
+ // Force DirectSound instead of WASAPI
+ // SDL 2.0.6+ defaults to the latter and it screws up our sound effects
+ SDL_setenv("SDL_AUDIODRIVER", "directsound", 1);
+#endif
+
// EE inits audio first so we're following along.
if (SDL_WasInit(SDL_INIT_AUDIO) == SDL_INIT_AUDIO)
{
@@ -758,6 +764,7 @@ void I_UnloadSong(void)
boolean I_PlaySong(boolean looping)
{
+ boolean lpz = fpclassify(loop_point) == FP_ZERO;
#ifdef HAVE_LIBGME
if (gme)
{
@@ -771,14 +778,15 @@ boolean I_PlaySong(boolean looping)
if (!music)
return false;
- if (Mix_PlayMusic(music, looping && loop_point == 0.0f ? -1 : 0) == -1)
+
+ if (Mix_PlayMusic(music, looping && lpz ? -1 : 0) == -1)
{
CONS_Alert(CONS_ERROR, "Mix_PlayMusic: %s\n", Mix_GetError());
return false;
}
Mix_VolumeMusic((UINT32)music_volume*128/31);
- if (loop_point != 0.0f)
+ if (!lpz)
Mix_HookMusicFinished(music_loop);
return true;
}
diff --git a/src/sdl/sdl_sound.c b/src/sdl/sdl_sound.c
index ebd615de..9ff1dd0b 100644
--- a/src/sdl/sdl_sound.c
+++ b/src/sdl/sdl_sound.c
@@ -1186,6 +1186,12 @@ void I_StartupSound(void)
// Configure sound device
CONS_Printf("I_StartupSound:\n");
+#ifdef _WIN32
+ // Force DirectSound instead of WASAPI
+ // SDL 2.0.6+ defaults to the latter and it screws up our sound effects
+ SDL_setenv("SDL_AUDIODRIVER", "directsound", 1);
+#endif
+
// EE inits audio first so we're following along.
if (SDL_WasInit(SDL_INIT_AUDIO) == SDL_INIT_AUDIO)
CONS_Printf("SDL Audio already started\n");
diff --git a/src/sdl/sdlmain.h b/src/sdl/sdlmain.h
index 110b03fd..0bc771a7 100644
--- a/src/sdl/sdlmain.h
+++ b/src/sdl/sdlmain.h
@@ -1,7 +1,7 @@
// Emacs style mode select -*- C++ -*-
//-----------------------------------------------------------------------------
//
-// Copyright (C) 2006 by Sonic Team Jr.
+// Copyright (C) 2006-2018 by Sonic Team Jr.
//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
@@ -31,6 +31,9 @@ extern SDL_bool framebuffer;
#define SDL2STUB() CONS_Printf("SDL2: stubbed: %s:%d\n", __func__, __LINE__)
#endif
+// So m_menu knows whether to store cv_usejoystick value or string
+#define JOYSTICK_HOTPLUG
+
/** \brief The JoyInfo_s struct
info about joystick
@@ -77,6 +80,20 @@ extern SDLJoyInfo_t JoyInfo4;
void I_GetConsoleEvents(void);
+// So we can call this from i_video event loop
+void I_ShutdownJoystick(void);
+void I_ShutdownJoystick2(void);
+void I_ShutdownJoystick3(void);
+void I_ShutdownJoystick4(void);
+
+// Cheat to get the device index for a joystick handle
+INT32 I_GetJoystickDeviceIndex(SDL_Joystick *dev);
+
+// Quick thing to make SDL_JOYDEVICEADDED events less of an abomination
+void I_UpdateJoystickDeviceIndices(INT32 player);
+
+void I_GetConsoleEvents(void);
+
void SDLforceUngrabMouse(void);
// Needed for some WIN32 functions
diff --git a/src/sdl12/SRB2CE/cehelp.c b/src/sdl12/SRB2CE/cehelp.c
index 7c5efdee..13505cff 100644
--- a/src/sdl12/SRB2CE/cehelp.c
+++ b/src/sdl12/SRB2CE/cehelp.c
@@ -1,7 +1,7 @@
// Emacs style mode select -*- C++ -*-
//-----------------------------------------------------------------------------
//
-// Copyright (C) 2004 by Sonic Team Jr.
+// Copyright (C) 2004-2018 by Sonic Team Jr.
//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
diff --git a/src/sdl12/SRB2CE/cehelp.h b/src/sdl12/SRB2CE/cehelp.h
index bc265b05..3ed0d9dd 100644
--- a/src/sdl12/SRB2CE/cehelp.h
+++ b/src/sdl12/SRB2CE/cehelp.h
@@ -1,7 +1,7 @@
// Emacs style mode select -*- C++ -*-
//-----------------------------------------------------------------------------
//
-// Copyright (C) 2004 by Sonic Team Jr.
+// Copyright (C) 2004-2018 by Sonic Team Jr.
//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
diff --git a/src/sdl12/SRB2DC/dchelp.c b/src/sdl12/SRB2DC/dchelp.c
index 5fdf04bc..1468baa8 100644
--- a/src/sdl12/SRB2DC/dchelp.c
+++ b/src/sdl12/SRB2DC/dchelp.c
@@ -1,7 +1,7 @@
// Emacs style mode select -*- C++ -*-
//-----------------------------------------------------------------------------
//
-// Copyright (C) 2006 by Sonic Team Jr.
+// Copyright (C) 2006-2018 by Sonic Team Jr.
//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
diff --git a/src/sdl12/SRB2DC/dchelp.h b/src/sdl12/SRB2DC/dchelp.h
index 236f3111..3647f9c8 100644
--- a/src/sdl12/SRB2DC/dchelp.h
+++ b/src/sdl12/SRB2DC/dchelp.h
@@ -1,7 +1,7 @@
// Emacs style mode select -*- C++ -*-
//-----------------------------------------------------------------------------
//
-// Copyright (C) 2006 by Sonic Team Jr.
+// Copyright (C) 2006-2018 by Sonic Team Jr.
//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
diff --git a/src/sdl12/SRB2DC/i_udp.c b/src/sdl12/SRB2DC/i_udp.c
index ec5e305f..cf7654c1 100644
--- a/src/sdl12/SRB2DC/i_udp.c
+++ b/src/sdl12/SRB2DC/i_udp.c
@@ -1,7 +1,7 @@
// Emacs style mode select -*- C++ -*-
//-----------------------------------------------------------------------------
// Copyright (C) 1993-1996 by id Software, Inc.
-// Portions Copyright (C) 2005 by Sonic Team Jr.
+// Portions Copyright (C) 2005-2018 by Sonic Team Jr.
//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
diff --git a/src/sdl12/SRB2XBOX/xboxhelp.c b/src/sdl12/SRB2XBOX/xboxhelp.c
index 9de01712..05b6c5e6 100644
--- a/src/sdl12/SRB2XBOX/xboxhelp.c
+++ b/src/sdl12/SRB2XBOX/xboxhelp.c
@@ -1,7 +1,7 @@
// Emacs style mode select -*- C++ -*-
//-----------------------------------------------------------------------------
//
-// Copyright (C) 2004 by Sonic Team Jr.
+// Copyright (C) 2004-2018 by Sonic Team Jr.
//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
diff --git a/src/sdl12/Srb2SDL.ico b/src/sdl12/Srb2SDL.ico
index 6e667b61..4e3f8133 100644
Binary files a/src/sdl12/Srb2SDL.ico and b/src/sdl12/Srb2SDL.ico differ
diff --git a/src/sdl12/i_system.c b/src/sdl12/i_system.c
index 86ac6e55..0e5adbb4 100644
--- a/src/sdl12/i_system.c
+++ b/src/sdl12/i_system.c
@@ -155,9 +155,9 @@ void __set_fpscr(long); // in libgcc / kernel's startup.s?
//#define DEFAULTSEARCHPATH3 "/pc/home/alam/srb2code/data"
#elif defined (GP2X)
#define DEFAULTWADLOCATION1 "/mnt/sd"
-#define DEFAULTWADLOCATION2 "/mnt/sd/SRB2"
+#define DEFAULTWADLOCATION2 "/mnt/sd/SRB2Kart"
#define DEFAULTWADLOCATION3 "/tmp/mnt/sd"
-#define DEFAULTWADLOCATION4 "/tmp/mnt/sd/SRB2"
+#define DEFAULTWADLOCATION4 "/tmp/mnt/sd/SRB2Kart"
#define DEFAULTSEARCHPATH1 "/mnt/sd"
#define DEFAULTSEARCHPATH2 "/tmp/mnt/sd"
#elif defined (_WII)
@@ -184,10 +184,10 @@ void __set_fpscr(long); // in libgcc / kernel's startup.s?
#define DEFAULTSEARCHPATH1 "host0:/"
#define DEFAULTSEARCHPATH2 "ms0:/PSP/GAME/SRB2PSP"
#elif defined (__unix__) || defined(__APPLE__) || defined (UNIXCOMMON)
-#define DEFAULTWADLOCATION1 "/usr/local/share/games/SRB2"
-#define DEFAULTWADLOCATION2 "/usr/local/games/SRB2"
-#define DEFAULTWADLOCATION3 "/usr/share/games/SRB2"
-#define DEFAULTWADLOCATION4 "/usr/games/SRB2"
+#define DEFAULTWADLOCATION1 "/usr/local/share/games/SRB2Kart"
+#define DEFAULTWADLOCATION2 "/usr/local/games/SRB2Kart"
+#define DEFAULTWADLOCATION3 "/usr/share/games/SRB2Kart"
+#define DEFAULTWADLOCATION4 "/usr/games/SRB2Kart"
#define DEFAULTSEARCHPATH1 "/usr/local/games"
#define DEFAULTSEARCHPATH2 "/usr/games"
#define DEFAULTSEARCHPATH3 "/usr/local"
@@ -196,21 +196,21 @@ void __set_fpscr(long); // in libgcc / kernel's startup.s?
#ifdef __GNUC__
#include
#endif
-#define DEFAULTWADLOCATION1 "c:\\srb2"
-#define DEFAULTWADLOCATION2 "d:\\srb2"
-#define DEFAULTWADLOCATION3 "e:\\srb2"
-#define DEFAULTWADLOCATION4 "f:\\srb2"
-#define DEFAULTWADLOCATION5 "g:\\srb2"
-#define DEFAULTWADLOCATION6 "h:\\srb2"
-#define DEFAULTWADLOCATION7 "i:\\srb2"
+#define DEFAULTWADLOCATION1 "c:\\srb2kart"
+#define DEFAULTWADLOCATION2 "d:\\srb2kart"
+#define DEFAULTWADLOCATION3 "e:\\srb2kart"
+#define DEFAULTWADLOCATION4 "f:\\srb2kart"
+#define DEFAULTWADLOCATION5 "g:\\srb2kart"
+#define DEFAULTWADLOCATION6 "h:\\srb2kart"
+#define DEFAULTWADLOCATION7 "i:\\srb2kart"
#elif defined (_WIN32_WCE)
#define NOCWD
#define NOHOME
-#define DEFAULTWADLOCATION1 "\\Storage Card\\SRB2DEMO"
+#define DEFAULTWADLOCATION1 "\\Storage Card\\SRB2Kart"
#define DEFAULTSEARCHPATH1 "\\Storage Card"
#elif defined (_WIN32)
-#define DEFAULTWADLOCATION1 "c:\\games\\srb2"
-#define DEFAULTWADLOCATION2 "\\games\\srb2"
+#define DEFAULTWADLOCATION1 "c:\\games\\srb2kart"
+#define DEFAULTWADLOCATION2 "\\games\\srb2kart"
#define DEFAULTSEARCHPATH1 "c:\\games"
#define DEFAULTSEARCHPATH2 "\\games"
#endif
@@ -2236,18 +2236,28 @@ INT32 I_NumJoys(void)
return numjoy;
}
+static char joyname[255]; // MAX_PATH; joystick name is straight from the driver
+
const char *I_GetJoyName(INT32 joyindex)
{
- const char *joyname = "NA";
+ const char *tempname = NULL;
joyindex--; //SDL's Joystick System starts at 0, not 1
if (SDL_WasInit(SDL_INIT_JOYSTICK) == 0)
{
if (SDL_InitSubSystem(SDL_INIT_JOYSTICK) != -1)
- joyname = SDL_JoystickName(joyindex);
+ {
+ tempname = SDL_JoystickNameForIndex(joyindex);
+ if (tempname)
+ strncpy(joyname, tempname, 255);
+ }
SDL_QuitSubSystem(SDL_INIT_JOYSTICK);
}
else
- joyname = SDL_JoystickName(joyindex);
+ {
+ tempname = SDL_JoystickNameForIndex(joyindex);
+ if (tempname)
+ strncpy(joyname, tempname, 255);
+ }
return joyname;
}
@@ -2324,7 +2334,7 @@ void I_UpdateMumble(const mobj_t *mobj, const listener_t listener)
if(mumble->uiVersion != 2) {
wcsncpy(mumble->name, L"SRB2Kart "VERSIONSTRING, 256);
- wcsncpy(mumble->description, L"Sonic Robo Blast 2 with integrated Mumble Link support.", 2048);
+ wcsncpy(mumble->description, L"Sonic Robo Blast 2 Kart with integrated Mumble Link support.", 2048);
mumble->uiVersion = 2;
}
mumble->uiTick++;
@@ -2994,6 +3004,8 @@ void I_Quit(void)
printf("\r");
ShowEndTxt();
}
+ if (myargmalloc)
+ free(myargv); // Deallocate allocated memory
death:
W_Shutdown();
#ifdef GP2X
diff --git a/src/sdl12/macosx/Srb2mac.icns b/src/sdl12/macosx/Srb2mac.icns
index 4baedc1c..890c268f 100644
Binary files a/src/sdl12/macosx/Srb2mac.icns and b/src/sdl12/macosx/Srb2mac.icns differ
diff --git a/src/sdl12/macosx/Srb2mac.xcodeproj/project.pbxproj b/src/sdl12/macosx/Srb2mac.xcodeproj/project.pbxproj
index 574161c6..0ab40c45 100644
--- a/src/sdl12/macosx/Srb2mac.xcodeproj/project.pbxproj
+++ b/src/sdl12/macosx/Srb2mac.xcodeproj/project.pbxproj
@@ -1214,7 +1214,7 @@
C01FCF4B08A954540054247B /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
- CURRENT_PROJECT_VERSION = 2.1.20;
+ CURRENT_PROJECT_VERSION = 2.1.23;
GCC_PREPROCESSOR_DEFINITIONS = (
"$(inherited)",
NORMALSRB2,
@@ -1226,7 +1226,7 @@
C01FCF4C08A954540054247B /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
- CURRENT_PROJECT_VERSION = 2.1.20;
+ CURRENT_PROJECT_VERSION = 2.1.23;
GCC_ENABLE_FIX_AND_CONTINUE = NO;
GCC_GENERATE_DEBUGGING_SYMBOLS = NO;
GCC_PREPROCESSOR_DEFINITIONS = (
diff --git a/src/sdl12/sdlmain.h b/src/sdl12/sdlmain.h
index 1e497b10..d08236bd 100644
--- a/src/sdl12/sdlmain.h
+++ b/src/sdl12/sdlmain.h
@@ -1,7 +1,7 @@
// Emacs style mode select -*- C++ -*-
//-----------------------------------------------------------------------------
//
-// Copyright (C) 2006 by Sonic Team Jr.
+// Copyright (C) 2006-2018 by Sonic Team Jr.
//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
diff --git a/src/sounds.c b/src/sounds.c
index 5531e7a3..a3bc8bf4 100644
--- a/src/sounds.c
+++ b/src/sounds.c
@@ -2,7 +2,7 @@
//-----------------------------------------------------------------------------
// Copyright (C) 1993-1996 by id Software, Inc.
// Copyright (C) 1998-2000 by DooM Legacy Team.
-// Copyright (C) 1999-2016 by Sonic Team Junior.
+// Copyright (C) 1999-2018 by Sonic Team Junior.
//
// This program is free software distributed under the
// terms of the GNU General Public License, version 2.
@@ -792,6 +792,8 @@ sfxinfo_t S_sfx[NUMSFX] =
{"itrol7", true, 96, 0, -1, NULL, 0, -1, -1, LUMPERROR},
{"itrol8", true, 96, 0, -1, NULL, 0, -1, -1, LUMPERROR},
{"itrolf", true, 96, 0, -1, NULL, 0, -1, -1, LUMPERROR}, // Roulette end
+ {"itrolm", true, 96, 0, -1, NULL, 0, -1, -1, LUMPERROR}, // Roulette end (mashed)
+ {"itrolk", true, 96, 0, -1, NULL, 0, -1, -1, LUMPERROR}, // Roulette end (karma enhanced)
{"itrole", true, 96, 0, -1, NULL, 0, -1, -1, LUMPERROR}, // Roulette end (Eggman)
{"vroom", false, 64, 0, -1, NULL, 0, -1, -1, LUMPERROR}, // Kart Krew opening vroom
{"chaooo", false, 64, 0, -1, NULL, 0, -1, -1, LUMPERROR}, // Chao audience cheer
diff --git a/src/sounds.h b/src/sounds.h
index e93a17a4..4c341d49 100644
--- a/src/sounds.h
+++ b/src/sounds.h
@@ -2,7 +2,7 @@
//-----------------------------------------------------------------------------
// Copyright (C) 1993-1996 by id Software, Inc.
// Copyright (C) 1998-2000 by DooM Legacy Team.
-// Copyright (C) 1999-2016 by Sonic Team Junior.
+// Copyright (C) 1999-2018 by Sonic Team Junior.
//
// This program is free software distributed under the
// terms of the GNU General Public License, version 2.
@@ -867,6 +867,8 @@ typedef enum
sfx_itrol7,
sfx_itrol8,
sfx_itrolf,
+ sfx_itrolm,
+ sfx_itrolk,
sfx_itrole,
sfx_vroom,
sfx_chaooo,
diff --git a/src/st_stuff.c b/src/st_stuff.c
index 8aefb33b..8ebd2132 100644
--- a/src/st_stuff.c
+++ b/src/st_stuff.c
@@ -2,7 +2,7 @@
//-----------------------------------------------------------------------------
// Copyright (C) 1993-1996 by id Software, Inc.
// Copyright (C) 1998-2000 by DooM Legacy Team.
-// Copyright (C) 1999-2016 by Sonic Team Junior.
+// Copyright (C) 1999-2018 by Sonic Team Junior.
//
// This program is free software distributed under the
// terms of the GNU General Public License, version 2.
@@ -131,11 +131,6 @@ static patch_t *hud_tv2;
// SRB2kart
-//
-
-static boolean facefreed[MAXPLAYERS];
-boolean iconfreed[MAXPLAYERS];
-
hudinfo_t hudinfo[NUMHUDITEMS] =
{
{ 34, 176}, // HUD_LIVESNAME
@@ -362,7 +357,6 @@ void ST_LoadFaceGraphics(char *rankstr, char *wantstr, char *mmapstr, INT32 skin
facerankprefix[skinnum] = W_CachePatchName(rankstr, PU_HUDGFX);
facewantprefix[skinnum] = W_CachePatchName(wantstr, PU_HUDGFX);
facemmapprefix[skinnum] = W_CachePatchName(mmapstr, PU_HUDGFX);
- facefreed[skinnum] = false;
}
void ST_ReloadSkinFaceGraphics(void)
@@ -411,14 +405,6 @@ lumpnum_t st_borderpatchnum;
void ST_Init(void)
{
- INT32 i;
-
- for (i = 0; i < MAXPLAYERS; i++)
- {
- facefreed[i] = true;
- iconfreed[i] = true;
- }
-
if (dedicated)
return;
@@ -439,11 +425,14 @@ void ST_changeDemoView(void)
boolean st_overlay;
+/*
static INT32 SCZ(INT32 z)
{
return FixedInt(FixedMul(z<health-1, 0);
@@ -701,6 +696,7 @@ static inline void ST_drawRings(void)
ST_DrawNumFromHudWS(HUD_RINGSNUM, ringnum);
}
+*/
/*
static void ST_drawLives(void) // SRB2kart - unused.
@@ -1501,7 +1497,8 @@ static void ST_drawMatchHUD(void) // SRB2kart - unused.
}
*/
-static inline void ST_drawRaceHUD(void)
+/*
+static inline void ST_drawRaceHUD(void) // SRB2kart - unused.
{
if (leveltime > starttime-(3*TICRATE) && leveltime <= starttime-(2*TICRATE))
V_DrawScaledPatch(SCX((BASEVIDWIDTH - SHORT(race3->width))/2), (INT32)(SCY(BASEVIDHEIGHT/2)), V_NOSCALESTART, race3);
@@ -1520,6 +1517,7 @@ static inline void ST_drawRaceHUD(void)
V_DrawString(hudinfo[HUD_LAP].x, STRINGY(hudinfo[HUD_LAP].y), 0, va("Lap: %u/%d", stplyr->laps+1, cv_numlaps.value));
}
}
+*/
/*
static void ST_drawTagHUD(void) // SRB2kart - unused.
@@ -1632,7 +1630,8 @@ static void ST_drawCTFHUD(void) // SRB2kart - unused.
*/
// Draws "Red Team", "Blue Team", or "Spectator" for team gametypes.
-static inline void ST_drawTeamName(void)
+/*
+static inline void ST_drawTeamName(void) // SRB2kart - unused.
{
if (stplyr->ctfteam == 1)
V_DrawString(256, splitscreen ? STRINGY(184) : STRINGY(192), V_HUDTRANSHALF, "RED TEAM");
@@ -1641,6 +1640,7 @@ static inline void ST_drawTeamName(void)
else
V_DrawString(244, splitscreen ? STRINGY(184) : STRINGY(192), V_HUDTRANSHALF, "SPECTATOR");
}
+*/
/*
static void ST_drawSpecialStageHUD(void) // SRB2kart - unused.
@@ -1931,12 +1931,12 @@ static void ST_overlayDrawer(void)
if (!hu_showscores && netgame && !mapreset)
{
/*if (G_GametypeUsesLives() && stplyr->lives <= 0 && countdown != 1)
- V_DrawCenteredString(BASEVIDWIDTH/2, STRINGY(132), 0, M_GetText("Press F12 to watch another player."));
+ V_DrawCenteredString(BASEVIDWIDTH/2, STRINGY(132), 0, M_GetText("Press Viewpoint Key to watch a player."));
else if (gametype == GT_HIDEANDSEEK &&
(!stplyr->spectator && !(stplyr->pflags & PF_TAGIT)) && (leveltime > hidetime * TICRATE))
{
V_DrawCenteredString(BASEVIDWIDTH/2, STRINGY(116), 0, M_GetText("You cannot move while hiding."));
- V_DrawCenteredString(BASEVIDWIDTH/2, STRINGY(132), 0, M_GetText("Press F12 to watch another player."));
+ V_DrawCenteredString(BASEVIDWIDTH/2, STRINGY(132), 0, M_GetText("Press Viewpoint Key to watch a player."));
}
else if (!G_RaceGametype() && stplyr->playerstate == PST_DEAD && stplyr->lives) //Death overrides spectator text.
{
diff --git a/src/st_stuff.h b/src/st_stuff.h
index b054460b..f96aee93 100644
--- a/src/st_stuff.h
+++ b/src/st_stuff.h
@@ -2,7 +2,7 @@
//-----------------------------------------------------------------------------
// Copyright (C) 1993-1996 by id Software, Inc.
// Copyright (C) 1998-2000 by DooM Legacy Team.
-// Copyright (C) 1999-2016 by Sonic Team Junior.
+// Copyright (C) 1999-2018 by Sonic Team Junior.
//
// This program is free software distributed under the
// terms of the GNU General Public License, version 2.
@@ -71,7 +71,6 @@ extern patch_t *facewantprefix[MAXSKINS]; // wanted
extern patch_t *facemmapprefix[MAXSKINS]; // minimap
extern patch_t *livesback;
extern patch_t *ngradeletters[7];
-extern boolean iconfreed[MAXPLAYERS];
/** HUD location information (don't move this comment)
*/
diff --git a/src/string.c b/src/string.c
index d7f8b367..2a03e872 100644
--- a/src/string.c
+++ b/src/string.c
@@ -1,7 +1,7 @@
// SONIC ROBO BLAST 2
//-----------------------------------------------------------------------------
// Copyright (C) 2006 by Graue.
-// Copyright (C) 2006-2016 by Sonic Team Junior.
+// Copyright (C) 2006-2018 by Sonic Team Junior.
//
// This program is free software distributed under the
// terms of the GNU General Public License, version 2.
diff --git a/src/tables.c b/src/tables.c
index 6b06c81b..7d513707 100644
--- a/src/tables.c
+++ b/src/tables.c
@@ -2,7 +2,7 @@
//-----------------------------------------------------------------------------
// Copyright (C) 1993-1996 by id Software, Inc.
// Copyright (C) 1998-2000 by DooM Legacy Team.
-// Copyright (C) 1999-2016 by Sonic Team Junior.
+// Copyright (C) 1999-2018 by Sonic Team Junior.
//
// This program is free software distributed under the
// terms of the GNU General Public License, version 2.
@@ -37,6 +37,15 @@ unsigned SlopeDiv(unsigned num, unsigned den)
return ans <= SLOPERANGE ? ans : SLOPERANGE;
}
+UINT64 SlopeDivEx(unsigned int num, unsigned int den)
+{
+ UINT64 ans;
+ if (den < 512)
+ return SLOPERANGE;
+ ans = ((UINT64)num<<3)/(den>>8);
+ return ans <= SLOPERANGE ? ans : SLOPERANGE;
+}
+
fixed_t AngleFixed(angle_t af)
{
angle_t wa = ANGLE_180;
diff --git a/src/tables.h b/src/tables.h
index d231baf9..2c2f74e1 100644
--- a/src/tables.h
+++ b/src/tables.h
@@ -2,7 +2,7 @@
//-----------------------------------------------------------------------------
// Copyright (C) 1993-1996 by id Software, Inc.
// Copyright (C) 1998-2000 by DooM Legacy Team.
-// Copyright (C) 1999-2016 by Sonic Team Junior.
+// Copyright (C) 1999-2018 by Sonic Team Junior.
//
// This program is free software distributed under the
// terms of the GNU General Public License, version 2.
@@ -87,6 +87,8 @@ extern angle_t tantoangle[SLOPERANGE+1];
// Utility function, called by R_PointToAngle.
FUNCMATH unsigned SlopeDiv(unsigned num, unsigned den);
+// Only called by R_PointToAngleEx
+UINT64 SlopeDivEx(unsigned int num, unsigned int den);
// 360 - angle_t(ANGLE_45) = ANGLE_315
FUNCMATH FUNCINLINE static ATTRINLINE angle_t InvAngle(angle_t a)
diff --git a/src/tmap.nas b/src/tmap.nas
index 16f53f53..78840106 100644
--- a/src/tmap.nas
+++ b/src/tmap.nas
@@ -1,7 +1,7 @@
;; SONIC ROBO BLAST 2
;;-----------------------------------------------------------------------------
;; Copyright (C) 1998-2000 by DooM Legacy Team.
-;; Copyright (C) 1999-2016 by Sonic Team Junior.
+;; Copyright (C) 1999-2018 by Sonic Team Junior.
;;
;; This program is free software distributed under the
;; terms of the GNU General Public License, version 2.
diff --git a/src/tmap.s b/src/tmap.s
index a828a9d4..babd4ec1 100644
--- a/src/tmap.s
+++ b/src/tmap.s
@@ -1,7 +1,7 @@
// SONIC ROBO BLAST 2
//-----------------------------------------------------------------------------
// Copyright (C) 1998-2000 by DooM Legacy Team.
-// Copyright (C) 1999-2016 by Sonic Team Junior.
+// Copyright (C) 1999-2018 by Sonic Team Junior.
//
// This program is free software distributed under the
// terms of the GNU General Public License, version 2.
@@ -13,7 +13,7 @@
// structures, must match the C structures!
#include "asm_defs.inc"
-// Rappel: seuls EAX, ECX, EDX peuvent tre crass librement.
+// Rappel: seuls EAX, ECX, EDX peuvent �tre �cras�s librement.
// il faut sauver esi,edi, cd...gs
/* Attention aux comparaisons! */
@@ -28,7 +28,7 @@
/* cmp A,B // B-A , set flags */
/* jg B_greater_than_A */
/* */
-/* (soustrait l'oprande source DE l'oprande destination, */
+/* (soustrait l'op�rande source DE l'op�rande destination, */
/* comme sur Motorola! ) */
// RAPPEL: Intel
@@ -66,7 +66,7 @@ C(vidwidth): .long 0 //use this one out of the inner loops
.globl C(ASM_PatchRowBytes)
C(ASM_PatchRowBytes):
pushl %ebp
- movl %esp, %ebp // assure l'"adressabilit du stack"
+ movl %esp, %ebp // assure l'"adressabilit� du stack"
movl ARG1, %edx // read first arg
movl %edx, C(vidwidth)
diff --git a/src/tmap_asm.s b/src/tmap_asm.s
index e8b7af1c..99cb0b62 100644
--- a/src/tmap_asm.s
+++ b/src/tmap_asm.s
@@ -1,7 +1,7 @@
// SONIC ROBO BLAST 2
//-----------------------------------------------------------------------------
// Copyright (C) 1998-2000 by DooM Legacy Team.
-// Copyright (C) 1999-2016 by Sonic Team Junior.
+// Copyright (C) 1999-2018 by Sonic Team Junior.
//
// This program is free software distributed under the
// terms of the GNU General Public License, version 2.
diff --git a/src/tmap_mmx.nas b/src/tmap_mmx.nas
index 187beec7..39380a06 100644
--- a/src/tmap_mmx.nas
+++ b/src/tmap_mmx.nas
@@ -1,7 +1,7 @@
;; SONIC ROBO BLAST 2
;;-----------------------------------------------------------------------------
;; Copyright (C) 1998-2000 by DOSDOOM.
-;; Copyright (C) 2010-2016 by Sonic Team Junior.
+;; Copyright (C) 2010-2018 by Sonic Team Junior.
;;
;; This program is free software distributed under the
;; terms of the GNU General Public License, version 2.
diff --git a/src/tmap_vc.nas b/src/tmap_vc.nas
index 8fe39ec8..e943d48d 100644
--- a/src/tmap_vc.nas
+++ b/src/tmap_vc.nas
@@ -1,7 +1,7 @@
;; SONIC ROBO BLAST 2
;;-----------------------------------------------------------------------------
;; Copyright (C) 1998-2000 by DooM Legacy Team.
-;; Copyright (C) 1999-2016 by Sonic Team Junior.
+;; Copyright (C) 1999-2018 by Sonic Team Junior.
;;
;; This program is free software distributed under the
;; terms of the GNU General Public License, version 2.
diff --git a/src/v_video.c b/src/v_video.c
index 63eb6743..dd95efe3 100644
--- a/src/v_video.c
+++ b/src/v_video.c
@@ -2,7 +2,7 @@
//-----------------------------------------------------------------------------
// Copyright (C) 1993-1996 by id Software, Inc.
// Copyright (C) 1998-2000 by DooM Legacy Team.
-// Copyright (C) 1999-2016 by Sonic Team Junior.
+// Copyright (C) 1999-2018 by Sonic Team Junior.
//
// This program is free software distributed under the
// terms of the GNU General Public License, version 2.
@@ -348,8 +348,8 @@ void V_DrawFixedPatch(fixed_t x, fixed_t y, fixed_t pscale, INT32 scrn, patch_t
return;
#ifdef HWRENDER
- // oh please
- if (rendermode != render_soft && !con_startup)
+ //if (rendermode != render_soft && !con_startup) // Why?
+ if (rendermode != render_soft)
{
HWR_DrawFixedPatch((GLPatch_t *)patch, x, y, pscale, scrn, colormap);
return;
@@ -860,6 +860,149 @@ void V_DrawFill(INT32 x, INT32 y, INT32 w, INT32 h, INT32 c)
memset(dest, c, w * vid.bpp);
}
+#ifdef HWRENDER
+// This is now a function since it's otherwise repeated 2 times and honestly looks retarded:
+static UINT32 V_GetHWConsBackColor(void)
+{
+ UINT32 hwcolor;
+ switch (cons_backcolor.value)
+ {
+ case 0: hwcolor = 0xffffff00; break; // White
+ case 1: hwcolor = 0x80808000; break; // Gray
+ case 2: hwcolor = 0xdeb88700; break; // Sepia
+ case 3: hwcolor = 0x40201000; break; // Brown
+ case 4: hwcolor = 0xfa807200; break; // Pink
+ case 5: hwcolor = 0xff69b400; break; // Raspberry
+ case 6: hwcolor = 0xff000000; break; // Red
+ case 7: hwcolor = 0xffd68300; break; // Creamsicle
+ case 8: hwcolor = 0xff800000; break; // Orange
+ case 9: hwcolor = 0xdaa52000; break; // Gold
+ case 10: hwcolor = 0x80800000; break; // Yellow
+ case 11: hwcolor = 0x00ff0000; break; // Emerald
+ case 12: hwcolor = 0x00800000; break; // Green
+ case 13: hwcolor = 0x4080ff00; break; // Cyan
+ case 14: hwcolor = 0x4682b400; break; // Steel
+ case 15: hwcolor = 0x1e90ff00; break; // Periwinkle
+ case 16: hwcolor = 0x0000ff00; break; // Blue
+ case 17: hwcolor = 0xff00ff00; break; // Purple
+ case 18: hwcolor = 0xee82ee00; break; // Lavender
+ // Default green
+ default: hwcolor = 0x00800000; break;
+ }
+ return hwcolor;
+}
+#endif
+
+// THANK YOU MPC!!!
+
+void V_DrawFillConsoleMap(INT32 x, INT32 y, INT32 w, INT32 h, INT32 c)
+{
+ UINT8 *dest;
+ INT32 u, v;
+ UINT32 alphalevel = 0;
+
+ if (rendermode == render_none)
+ return;
+
+#ifdef HWRENDER
+ if (rendermode != render_soft && rendermode != render_none)
+ {
+ UINT32 hwcolor = V_GetHWConsBackColor();
+ HWR_DrawConsoleFill(x, y, w, h, hwcolor, c); // we still use the regular color stuff but only for flags. actual draw color is "hwcolor" for this.
+ return;
+ }
+#endif
+
+ if (!(c & V_NOSCALESTART))
+ {
+ INT32 dupx = vid.dupx, dupy = vid.dupy;
+
+ if (x == 0 && y == 0 && w == BASEVIDWIDTH && h == BASEVIDHEIGHT)
+ { // Clear the entire screen, from dest to deststop. Yes, this really works.
+ memset(screens[0], (UINT8)(c&255), vid.width * vid.height * vid.bpp);
+ return;
+ }
+
+ x *= dupx;
+ y *= dupy;
+ w *= dupx;
+ h *= dupy;
+
+ // Center it if necessary
+ if (vid.width != BASEVIDWIDTH * dupx)
+ {
+ // dupx adjustments pretend that screen width is BASEVIDWIDTH * dupx,
+ // so center this imaginary screen
+ if (c & V_SNAPTORIGHT)
+ x += (vid.width - (BASEVIDWIDTH * dupx));
+ else if (!(c & V_SNAPTOLEFT))
+ x += (vid.width - (BASEVIDWIDTH * dupx)) / 2;
+ }
+ if (vid.height != BASEVIDHEIGHT * dupy)
+ {
+ // same thing here
+ if (c & V_SNAPTOBOTTOM)
+ y += (vid.height - (BASEVIDHEIGHT * dupy));
+ else if (!(c & V_SNAPTOTOP))
+ y += (vid.height - (BASEVIDHEIGHT * dupy)) / 2;
+ }
+ }
+
+ if (x >= vid.width || y >= vid.height)
+ return; // off the screen
+ if (x < 0) {
+ w += x;
+ x = 0;
+ }
+ if (y < 0) {
+ h += y;
+ y = 0;
+ }
+
+ if (w <= 0 || h <= 0)
+ return; // zero width/height wouldn't draw anything
+ if (x + w > vid.width)
+ w = vid.width-x;
+ if (y + h > vid.height)
+ h = vid.height-y;
+
+ dest = screens[0] + y*vid.width + x;
+
+ if ((alphalevel = ((c & V_ALPHAMASK) >> V_ALPHASHIFT)))
+ {
+ if (alphalevel == 13)
+ alphalevel = hudminusalpha[cv_translucenthud.value];
+ else if (alphalevel == 14)
+ alphalevel = 10 - cv_translucenthud.value;
+ else if (alphalevel == 15)
+ alphalevel = hudplusalpha[cv_translucenthud.value];
+
+ if (alphalevel >= 10)
+ return; // invis
+ }
+
+ c &= 255;
+
+ if (!alphalevel) {
+ for (v = 0; v < h; v++, dest += vid.width) {
+ for (u = 0; u < w; u++) {
+ dest[u] = consolebgmap[dest[u]];
+ }
+ }
+ } else { // mpc 12-04-2018
+ const UINT8 *fadetable = ((UINT8 *)transtables + ((alphalevel-1)<y) ? y : x
+ w = clip(w,vid.width);
+ h = clip(h,vid.height);
+#undef clip
+ for (v = 0; v < h; v++, dest += vid.width) {
+ for (u = 0; u < w; u++) {
+ dest[u] = fadetable[consolebgmap[dest[u]]];
+ }
+ }
+ }
+}
+
//
// Fills a triangle of pixels with a single color, NOTE: scaled to screen size
//
@@ -961,148 +1104,6 @@ void V_DrawDiag(INT32 x, INT32 y, INT32 wh, INT32 c)
}
}
-#ifdef HWRENDER
-// This is now a function since it's otherwise repeated 2 times and honestly looks retarded:
-static UINT32 V_GetHWConsBackColor(void)
-{
- UINT32 hwcolor;
- switch (cons_backcolor.value)
- {
- case 0: hwcolor = 0xffffff00; break; // White
- case 1: hwcolor = 0x80808000; break; // Gray
- case 2: hwcolor = 0xdeb88700; break; // Sepia
- case 3: hwcolor = 0x40201000; break; // Brown
- case 4: hwcolor = 0xfa807200; break; // Pink
- case 5: hwcolor = 0xff69b400; break; // Raspberry
- case 6: hwcolor = 0xff000000; break; // Red
- case 7: hwcolor = 0xffd68300; break; // Creamsicle
- case 8: hwcolor = 0xff800000; break; // Orange
- case 9: hwcolor = 0xdaa52000; break; // Gold
- case 10: hwcolor = 0x80800000; break; // Yellow
- case 11: hwcolor = 0x00ff0000; break; // Emerald
- case 12: hwcolor = 0x00800000; break; // Green
- case 13: hwcolor = 0x4080ff00; break; // Cyan
- case 14: hwcolor = 0x4682b400; break; // Steel
- case 15: hwcolor = 0x1e90ff00; break; // Periwinkle
- case 16: hwcolor = 0x0000ff00; break; // Blue
- case 17: hwcolor = 0xff00ff00; break; // Purple
- case 18: hwcolor = 0xee82ee00; break; // Lavender
- // Default green
- default: hwcolor = 0x00800000; break;
- }
- return hwcolor;
-}
-#endif
-
-// THANK YOU MPC!!!
-
-void V_DrawFillConsoleMap(INT32 x, INT32 y, INT32 w, INT32 h, INT32 c)
-{
- UINT8 *dest;
- INT32 u, v;
- UINT32 alphalevel = 0;
-
- if (rendermode == render_none)
- return;
-
-#ifdef HWRENDER
- if (rendermode != render_soft && rendermode != render_none)
- {
- UINT32 hwcolor = V_GetHWConsBackColor();
- HWR_DrawConsoleFill(x, y, w, h, hwcolor, c); // we still use the regular color stuff but only for flags. actual draw color is "hwcolor" for this.
- return;
- }
-#endif
-
- if (!(c & V_NOSCALESTART))
- {
- INT32 dupx = vid.dupx, dupy = vid.dupy;
-
- if (x == 0 && y == 0 && w == BASEVIDWIDTH && h == BASEVIDHEIGHT)
- { // Clear the entire screen, from dest to deststop. Yes, this really works.
- memset(screens[0], (UINT8)(c&255), vid.width * vid.height * vid.bpp);
- return;
- }
-
- x *= dupx;
- y *= dupy;
- w *= dupx;
- h *= dupy;
-
- // Center it if necessary
- if (vid.width != BASEVIDWIDTH * dupx)
- {
- // dupx adjustments pretend that screen width is BASEVIDWIDTH * dupx,
- // so center this imaginary screen
- if (c & V_SNAPTORIGHT)
- x += (vid.width - (BASEVIDWIDTH * dupx));
- else if (!(c & V_SNAPTOLEFT))
- x += (vid.width - (BASEVIDWIDTH * dupx)) / 2;
- }
- if (vid.height != BASEVIDHEIGHT * dupy)
- {
- // same thing here
- if (c & V_SNAPTOBOTTOM)
- y += (vid.height - (BASEVIDHEIGHT * dupy));
- else if (!(c & V_SNAPTOTOP))
- y += (vid.height - (BASEVIDHEIGHT * dupy)) / 2;
- }
- }
-
- if (x >= vid.width || y >= vid.height)
- return; // off the screen
- if (x < 0) {
- w += x;
- x = 0;
- }
- if (y < 0) {
- h += y;
- y = 0;
- }
-
- if (w <= 0 || h <= 0)
- return; // zero width/height wouldn't draw anything
- if (x + w > vid.width)
- w = vid.width-x;
- if (y + h > vid.height)
- h = vid.height-y;
-
- dest = screens[0] + y*vid.width + x;
-
- if ((alphalevel = ((c & V_ALPHAMASK) >> V_ALPHASHIFT)))
- {
- if (alphalevel == 13)
- alphalevel = hudminusalpha[cv_translucenthud.value];
- else if (alphalevel == 14)
- alphalevel = 10 - cv_translucenthud.value;
- else if (alphalevel == 15)
- alphalevel = hudplusalpha[cv_translucenthud.value];
-
- if (alphalevel >= 10)
- return; // invis
- }
-
- c &= 255;
-
- if (!alphalevel) {
- for (v = 0; v < h; v++, dest += vid.width) {
- for (u = 0; u < w; u++) {
- dest[u] = consolebgmap[dest[u]];
- }
- }
- } else { // mpc 12-04-2018
- const UINT8 *fadetable = ((UINT8 *)transtables + ((alphalevel-1)<y) ? y : x
- w = clip(w,vid.width);
- h = clip(h,vid.height);
- for (v = 0; v < h; v++, dest += vid.width) {
- for (u = 0; u < w; u++) {
- dest[u] = fadetable[consolebgmap[dest[u]]];
- }
- }
- }
-}
-
//
// Fills a box of pixels using a flat texture as a pattern, scaled to screen size.
//
@@ -2266,6 +2267,7 @@ INT32 V_ThinStringWidth(const char *string, INT32 option)
{
INT32 c, w = 0;
INT32 spacewidth = 2, charwidth = 0;
+ boolean lowercase = (option & V_ALLOWLOWERCASE);
size_t i;
switch (option & V_SPACINGMASK)
@@ -2289,14 +2291,21 @@ INT32 V_ThinStringWidth(const char *string, INT32 option)
if ((UINT8)c >= 0x80 && (UINT8)c <= 0x8F) //color parsing! -Inuyasha 2.16.09
continue;
- c = toupper(c) - HU_FONTSTART;
+ if (!lowercase || !tny_font[c-HU_FONTSTART])
+ c = toupper(c);
+ c -= HU_FONTSTART;
+
if (c < 0 || c >= HU_FONTSIZE || !tny_font[c])
w += spacewidth;
else
+ {
w += (charwidth ? charwidth
- : (option & V_6WIDTHSPACE ? max(1, SHORT(tny_font[c]->width)-1) : SHORT(tny_font[c]->width))); // Reuse this flag for the alternate bunched-up spacing
+ : ((option & V_6WIDTHSPACE && i < strlen(string)-1) ? max(1, SHORT(tny_font[c]->width)-1) // Reuse this flag for the alternate bunched-up spacing
+ : SHORT(tny_font[c]->width)));
+ }
}
+
return w;
}
diff --git a/src/v_video.h b/src/v_video.h
index 734b8037..4a904f79 100644
--- a/src/v_video.h
+++ b/src/v_video.h
@@ -2,7 +2,7 @@
//-----------------------------------------------------------------------------
// Copyright (C) 1993-1996 by id Software, Inc.
// Copyright (C) 1998-2000 by DooM Legacy Team.
-// Copyright (C) 1999-2016 by Sonic Team Junior.
+// Copyright (C) 1999-2018 by Sonic Team Junior.
//
// This program is free software distributed under the
// terms of the GNU General Public License, version 2.
@@ -162,6 +162,7 @@ void V_DrawFadeConsBack(INT32 plines);
void V_DrawCharacter(INT32 x, INT32 y, INT32 c, boolean lowercaseallowed);
// draw a single character, but for the chat
void V_DrawChatCharacter(INT32 x, INT32 y, INT32 c, boolean lowercaseallowed, UINT8 *colormap);
+
UINT8 *V_GetStringColormap(INT32 colorflags);
void V_DrawLevelTitle(INT32 x, INT32 y, INT32 option, const char *string);
diff --git a/src/vid_copy.s b/src/vid_copy.s
index 9d8e7d4e..050a8099 100644
--- a/src/vid_copy.s
+++ b/src/vid_copy.s
@@ -1,7 +1,7 @@
// SONIC ROBO BLAST 2
//-----------------------------------------------------------------------------
// Copyright (C) 1998-2000 by DooM Legacy Team.
-// Copyright (C) 1999-2016 by Sonic Team Junior.
+// Copyright (C) 1999-2018 by Sonic Team Junior.
//
// This program is free software distributed under the
// terms of the GNU General Public License, version 2.
diff --git a/src/w_wad.c b/src/w_wad.c
index 998ee2b8..63bee97d 100644
--- a/src/w_wad.c
+++ b/src/w_wad.c
@@ -2,7 +2,7 @@
//-----------------------------------------------------------------------------
// Copyright (C) 1993-1996 by id Software, Inc.
// Copyright (C) 1998-2000 by DooM Legacy Team.
-// Copyright (C) 1999-2016 by Sonic Team Junior.
+// Copyright (C) 1999-2018 by Sonic Team Junior.
//
// This program is free software distributed under the
// terms of the GNU General Public License, version 2.
@@ -65,22 +65,25 @@ int snprintf(char *str, size_t n, const char *fmt, ...);
#define O_BINARY 0
#endif
-#if defined(_MSC_VER)
-#pragma pack(1)
+#ifdef HAVE_ZLIB
+#ifndef _MSC_VER
+#ifndef _LARGEFILE64_SOURCE
+#define _LARGEFILE64_SOURCE
+#endif
#endif
-// a raw entry of the wad directory
-typedef struct
-{
- UINT32 filepos; // file offset of the resource
- UINT32 size; // size of the resource
- char name[8]; // name of the resource
-} ATTRPACK filelump_t;
-
-#if defined(_MSC_VER)
-#pragma pack()
+#ifndef _LFS64_LARGEFILE
+#define _LFS64_LARGEFILE
#endif
+#ifndef _FILE_OFFSET_BITS
+#define _FILE_OFFSET_BITS 0
+#endif
+
+#include "zlib.h"
+#endif
+
+
typedef struct
{
const char *name;
@@ -115,8 +118,10 @@ void W_Shutdown(void)
while (numwadfiles--)
{
fclose(wadfiles[numwadfiles]->handle);
- Z_Free(wadfiles[numwadfiles]->lumpinfo);
Z_Free(wadfiles[numwadfiles]->filename);
+ while (wadfiles[numwadfiles]->numlumps--)
+ Z_Free(wadfiles[numwadfiles]->lumpinfo[wadfiles[numwadfiles]->numlumps].name2);
+ Z_Free(wadfiles[numwadfiles]->lumpinfo);
Z_Free(wadfiles[numwadfiles]);
}
}
@@ -176,6 +181,38 @@ FILE *W_OpenWadFile(const char **filename, boolean useerrors)
return handle;
}
+// Look for all DEHACKED and Lua scripts inside a PK3 archive.
+static inline void W_LoadDehackedLumpsPK3(UINT16 wadnum)
+{
+ UINT16 posStart, posEnd;
+ posStart = W_CheckNumForFolderStartPK3("Lua/", wadnum, 0);
+ if (posStart != INT16_MAX)
+ {
+ posEnd = W_CheckNumForFolderEndPK3("Lua/", wadnum, posStart);
+ posStart++;
+ for (; posStart < posEnd; posStart++)
+ LUA_LoadLump(wadnum, posStart);
+ }
+ posStart = W_CheckNumForFolderStartPK3("SOC/", wadnum, 0);
+ if (posStart != INT16_MAX)
+ {
+ posEnd = W_CheckNumForFolderEndPK3("SOC/", wadnum, posStart);
+ posStart++;
+ for(; posStart < posEnd; posStart++)
+ {
+ lumpinfo_t *lump_p = &wadfiles[wadnum]->lumpinfo[posStart];
+ size_t length = strlen(wadfiles[wadnum]->filename) + 1 + strlen(lump_p->name2); // length of file name, '|', and lump name
+ char *name = malloc(length + 1);
+ sprintf(name, "%s|%s", wadfiles[wadnum]->filename, lump_p->name2);
+ name[length] = '\0';
+ CONS_Printf(M_GetText("Loading SOC from %s\n"), name);
+ DEH_LoadDehackedLumpPwad(wadnum, posStart);
+ free(name);
+ }
+
+ }
+}
+
// search for all DEHACKED lump in all wads and load it
static inline void W_LoadDehackedLumps(UINT16 wadnum)
{
@@ -196,20 +233,13 @@ static inline void W_LoadDehackedLumps(UINT16 wadnum)
for (lump = 0; lump < wadfiles[wadnum]->numlumps; lump++, lump_p++)
if (memcmp(lump_p->name,"SOC_",4)==0) // Check for generic SOC lump
{ // shameless copy+paste of code from LUA_LoadLump
- size_t len = strlen(wadfiles[wadnum]->filename);
- char *name = malloc(len+10);
-
- strcpy(name, wadfiles[wadnum]->filename);
- if (!fasticmp(&name[len - 4], ".soc")) {
- // If it's not a .soc file, copy the lump name in too.
- name[len] = '|';
- M_Memcpy(name+len+1, lump_p->name, 8);
- name[len+9] = '\0';
- }
+ size_t length = strlen(wadfiles[wadnum]->filename) + 1 + strlen(lump_p->name2); // length of file name, '|', and lump name
+ char *name = malloc(length + 1);
+ sprintf(name, "%s|%s", wadfiles[wadnum]->filename, lump_p->name2);
+ name[length] = '\0';
CONS_Printf(M_GetText("Loading SOC from %s\n"), name);
DEH_LoadDehackedLumpPwad(wadnum, lump);
-
free(name);
}
else if (memcmp(lump_p->name,"MAINCFG",8)==0) // Check for MAINCFG
@@ -282,6 +312,324 @@ static void W_InvalidateLumpnumCache(void)
memset(lumpnumcache, 0, sizeof (lumpnumcache));
}
+/** Detect a file type.
+ * \todo Actually detect the wad/pkzip headers and whatnot, instead of just checking the extensions.
+ */
+static restype_t ResourceFileDetect (const char* filename)
+{
+ if (!stricmp(&filename[strlen(filename) - 4], ".pk3"))
+ return RET_PK3;
+ if (!stricmp(&filename[strlen(filename) - 4], ".soc"))
+ return RET_SOC;
+ if (!stricmp(&filename[strlen(filename) - 4], ".lua"))
+ return RET_LUA;
+
+ return RET_WAD;
+}
+
+/** Create a 1-lump lumpinfo_t for standalone files.
+ */
+static lumpinfo_t* ResGetLumpsStandalone (FILE* handle, UINT16* numlumps, const char* lumpname)
+{
+ lumpinfo_t* lumpinfo = Z_Calloc(sizeof (*lumpinfo), PU_STATIC, NULL);
+ lumpinfo = Z_Calloc(sizeof (*lumpinfo), PU_STATIC, NULL);
+ lumpinfo->position = 0;
+ fseek(handle, 0, SEEK_END);
+ lumpinfo->size = ftell(handle);
+ fseek(handle, 0, SEEK_SET);
+ strcpy(lumpinfo->name, lumpname);
+ // Allocate the lump's full name.
+ lumpinfo->name2 = Z_Malloc(9 * sizeof(char), PU_STATIC, NULL);
+ strcpy(lumpinfo->name2, lumpname);
+ lumpinfo->name2[8] = '\0';
+ *numlumps = 1;
+ return lumpinfo;
+}
+
+/** Create a lumpinfo_t array for a WAD file.
+ */
+static lumpinfo_t* ResGetLumpsWad (FILE* handle, UINT16* nlmp, const char* filename)
+{
+ UINT16 numlumps = *nlmp;
+ lumpinfo_t* lumpinfo;
+ size_t i;
+ INT32 compressed = 0;
+
+ wadinfo_t header;
+ lumpinfo_t *lump_p;
+ filelump_t *fileinfo;
+ void *fileinfov;
+
+ // read the header
+ if (fread(&header, 1, sizeof header, handle) < sizeof header)
+ {
+ CONS_Alert(CONS_ERROR, M_GetText("Can't read wad header because %s\n"), strerror(ferror(handle)));
+ return NULL;
+ }
+
+ if (memcmp(header.identification, "ZWAD", 4) == 0)
+ compressed = 1;
+ else if (memcmp(header.identification, "IWAD", 4) != 0
+ && memcmp(header.identification, "PWAD", 4) != 0
+ && memcmp(header.identification, "SDLL", 4) != 0)
+ {
+ CONS_Alert(CONS_ERROR, M_GetText("Invalid WAD header\n"));
+ return NULL;
+ }
+
+ header.numlumps = LONG(header.numlumps);
+ header.infotableofs = LONG(header.infotableofs);
+
+ // read wad file directory
+ i = header.numlumps * sizeof (*fileinfo);
+ fileinfov = fileinfo = malloc(i);
+ if (fseek(handle, header.infotableofs, SEEK_SET) == -1
+ || fread(fileinfo, 1, i, handle) < i)
+ {
+ CONS_Alert(CONS_ERROR, M_GetText("Corrupt wadfile directory (%s)\n"), strerror(ferror(handle)));
+ free(fileinfov);
+ return NULL;
+ }
+
+ numlumps = header.numlumps;
+
+ // fill in lumpinfo for this wad
+ lump_p = lumpinfo = Z_Malloc(numlumps * sizeof (*lumpinfo), PU_STATIC, NULL);
+ for (i = 0; i < numlumps; i++, lump_p++, fileinfo++)
+ {
+ lump_p->position = LONG(fileinfo->filepos);
+ lump_p->size = lump_p->disksize = LONG(fileinfo->size);
+ if (compressed) // wad is compressed, lump might be
+ {
+ UINT32 realsize = 0;
+ if (fseek(handle, lump_p->position, SEEK_SET)
+ == -1 || fread(&realsize, 1, sizeof realsize,
+ handle) < sizeof realsize)
+ {
+ I_Error("corrupt compressed file: %s; maybe %s", /// \todo Avoid the bailout?
+ filename, strerror(ferror(handle)));
+ }
+ realsize = LONG(realsize);
+ if (realsize != 0)
+ {
+ lump_p->size = realsize;
+ lump_p->compression = CM_LZF;
+ }
+ else
+ {
+ lump_p->size -= 4;
+ lump_p->compression = CM_NOCOMPRESSION;
+ }
+
+ lump_p->position += 4;
+ lump_p->disksize -= 4;
+ }
+ else
+ lump_p->compression = CM_NOCOMPRESSION;
+ memset(lump_p->name, 0x00, 9);
+ strncpy(lump_p->name, fileinfo->name, 8);
+ // Allocate the lump's full name.
+ lump_p->name2 = Z_Malloc(9 * sizeof(char), PU_STATIC, NULL);
+ strncpy(lump_p->name2, fileinfo->name, 8);
+ lump_p->name2[8] = '\0';
+ }
+ free(fileinfov);
+ *nlmp = numlumps;
+ return lumpinfo;
+}
+
+/** Optimized pattern search in a file.
+ */
+static boolean ResFindSignature (FILE* handle, char endPat[], UINT32 startpos)
+{
+ char *s;
+ int c;
+
+ fseek(handle, startpos, SEEK_SET);
+ s = endPat;
+ while((c = fgetc(handle)) != EOF)
+ {
+ if (*s != c && s > endPat) // No match?
+ s = endPat; // We "reset" the counter by sending the s pointer back to the start of the array.
+ if (*s == c)
+ {
+ s++;
+ if (*s == 0x00) // The array pointer has reached the key char which marks the end. It means we have matched the signature.
+ {
+ return true;
+ }
+ }
+ }
+ return false;
+}
+
+#if defined(_MSC_VER)
+#pragma pack(1)
+#endif
+typedef struct zend_s
+{
+ char signature[4];
+ UINT16 diskpos;
+ UINT16 cdirdisk;
+ UINT16 diskentries;
+ UINT16 entries;
+ UINT32 cdirsize;
+ UINT32 cdiroffset;
+ UINT16 commentlen;
+} ATTRPACK zend_t;
+
+typedef struct zentry_s
+{
+ char signature[4];
+ UINT16 version;
+ UINT16 versionneeded;
+ UINT16 flags;
+ UINT16 compression;
+ UINT16 modtime;
+ UINT16 moddate;
+ UINT32 CRC32;
+ UINT32 compsize;
+ UINT32 size;
+ UINT16 namelen;
+ UINT16 xtralen;
+ UINT16 commlen;
+ UINT16 diskstart;
+ UINT16 attrint;
+ UINT32 attrext;
+ UINT32 offset;
+} ATTRPACK zentry_t;
+
+typedef struct zlentry_s
+{
+ char signature[4];
+ UINT16 versionneeded;
+ UINT16 flags;
+ UINT16 compression;
+ UINT16 modtime;
+ UINT16 moddate;
+ UINT32 CRC32;
+ UINT32 compsize;
+ UINT32 size;
+ UINT16 namelen;
+ UINT16 xtralen;
+} ATTRPACK zlentry_t;
+#if defined(_MSC_VER)
+#pragma pack()
+#endif
+
+/** Create a lumpinfo_t array for a PKZip file.
+ */
+static lumpinfo_t* ResGetLumpsZip (FILE* handle, UINT16* nlmp)
+{
+ zend_t zend;
+ zentry_t* zentries;
+ zentry_t* zentry;
+
+ UINT16 numlumps = *nlmp;
+ lumpinfo_t* lumpinfo;
+ lumpinfo_t *lump_p;
+ size_t i;
+
+ char pat_central[] = {0x50, 0x4b, 0x01, 0x02, 0x00};
+ char pat_end[] = {0x50, 0x4b, 0x05, 0x06, 0x00};
+
+ // Look for central directory end signature near end of file.
+ // Contains entry number (number of lumps), and central directory start offset.
+ fseek(handle, 0, SEEK_END);
+ if (!ResFindSignature(handle, pat_end, max(0, ftell(handle) - (22 + 65536))))
+ {
+ CONS_Alert(CONS_ERROR, "Missing central directory\n");
+ return NULL;
+ }
+
+ fseek(handle, -4, SEEK_CUR);
+ if (fread(&zend, 1, sizeof zend, handle) < sizeof zend)
+ {
+ CONS_Alert(CONS_ERROR, "Corrupt central directory (%s)\n", strerror(ferror(handle)));
+ return NULL;
+ }
+ numlumps = zend.entries;
+
+ lump_p = lumpinfo = Z_Malloc(numlumps * sizeof (*lumpinfo), PU_STATIC, NULL);
+ zentry = zentries = malloc(numlumps * sizeof (*zentries));
+
+ fseek(handle, zend.cdiroffset, SEEK_SET);
+ for (i = 0; i < numlumps; i++, zentry++, lump_p++)
+ {
+ char* fullname;
+ char* trimname;
+ char* dotpos;
+
+ if (fread(zentry, 1, sizeof(zentry_t), handle) < sizeof(zentry_t))
+ {
+ CONS_Alert(CONS_ERROR, "Failed to read central directory (%s)\n", strerror(ferror(handle)));
+ Z_Free(lumpinfo);
+ free(zentry);
+ return NULL;
+ }
+ if (memcmp(zentry->signature, pat_central, 4))
+ {
+ CONS_Alert(CONS_ERROR, "Central directory is corrupt\n");
+ Z_Free(lumpinfo);
+ free(zentry);
+ return NULL;
+ }
+
+ lump_p->position = zentry->offset + zentry->namelen + zentry->xtralen + sizeof(zlentry_t);
+ lump_p->disksize = zentry->compsize;
+ lump_p->size = zentry->size;
+
+ fullname = malloc(zentry->namelen + 1);
+ if (fgets(fullname, zentry->namelen + 1, handle) != fullname)
+ {
+ CONS_Alert(CONS_ERROR, "Unable to read lumpname (%s)\n", strerror(ferror(handle)));
+ Z_Free(lumpinfo);
+ free(zentry);
+ free(fullname);
+ return NULL;
+ }
+
+ // Strip away file address and extension for the 8char name.
+ if ((trimname = strrchr(fullname, '/')) != 0)
+ trimname++;
+ else
+ trimname = fullname; // Care taken for root files.
+
+ if ((dotpos = strrchr(trimname, '.')) == 0)
+ dotpos = fullname + strlen(fullname); // Watch for files without extension.
+
+ memset(lump_p->name, '\0', 9); // Making sure they're initialized to 0. Is it necessary?
+ strncpy(lump_p->name, trimname, min(8, dotpos - trimname));
+
+ lump_p->name2 = Z_Calloc(zentry->namelen + 1, PU_STATIC, NULL);
+ strncpy(lump_p->name2, fullname, zentry->namelen);
+
+ free(fullname);
+
+ switch(zentry->compression)
+ {
+ case 0:
+ lump_p->compression = CM_NOCOMPRESSION;
+ break;
+#ifdef HAVE_ZLIB
+ case 8:
+ lump_p->compression = CM_DEFLATE;
+ break;
+#endif
+ case 14:
+ lump_p->compression = CM_LZF;
+ break;
+ default:
+ CONS_Alert(CONS_WARNING, "%s: Unsupported compression method\n", fullname);
+ lump_p->compression = CM_UNSUPPORTED;
+ break;
+ }
+ }
+
+ *nlmp = numlumps;
+ return lumpinfo;
+}
+
// Allocate a wadfile, setup the lumpinfo (directory) and
// lumpcache, add the wadfile to the current active wadfiles
//
@@ -293,14 +641,14 @@ static void W_InvalidateLumpnumCache(void)
//
// Can now load dehacked files (.soc)
//
-UINT16 W_LoadWadFile(const char *filename)
+UINT16 W_InitFile(const char *filename)
{
FILE *handle;
- lumpinfo_t *lumpinfo;
+ lumpinfo_t *lumpinfo = NULL;
wadfile_t *wadfile;
- UINT32 numlumps;
+ restype_t type;
+ UINT16 numlumps = 0;
size_t i;
- INT32 compressed = 0;
size_t packetsize;
UINT8 md5sum[16];
boolean important;
@@ -352,122 +700,6 @@ UINT16 W_LoadWadFile(const char *filename)
packetsizetally = packetsize;
}
- // detect dehacked file with the "soc" extension
- if (!stricmp(&filename[strlen(filename) - 4], ".soc"))
- {
- // This code emulates a wadfile with one lump name "OBJCTCFG"
- // at position 0 and size of the whole file.
- // This allows soc files to be like all wads, copied by network and loaded at the console.
- numlumps = 1;
- lumpinfo = Z_Calloc(sizeof (*lumpinfo), PU_STATIC, NULL);
- lumpinfo->position = 0;
- fseek(handle, 0, SEEK_END);
- lumpinfo->size = ftell(handle);
- fseek(handle, 0, SEEK_SET);
- strcpy(lumpinfo->name, "OBJCTCFG");
- }
-#ifdef HAVE_BLUA
- // detect lua script with the "lua" extension
- else if (!stricmp(&filename[strlen(filename) - 4], ".lua"))
- {
- // This code emulates a wadfile with one lump name "LUA_INIT"
- // at position 0 and size of the whole file.
- // This allows soc files to be like all wads, copied by network and loaded at the console.
- numlumps = 1;
- lumpinfo = Z_Calloc(sizeof (*lumpinfo), PU_STATIC, NULL);
- lumpinfo->position = 0;
- fseek(handle, 0, SEEK_END);
- lumpinfo->size = ftell(handle);
- fseek(handle, 0, SEEK_SET);
- strcpy(lumpinfo->name, "LUA_INIT");
- }
-#endif
- else
- {
- // assume wad file
- wadinfo_t header;
- lumpinfo_t *lump_p;
- filelump_t *fileinfo;
- void *fileinfov;
-
- // read the header
- if (fread(&header, 1, sizeof header, handle) < sizeof header)
- {
- CONS_Alert(CONS_ERROR, M_GetText("Can't read wad header from %s because %s\n"), filename, strerror(ferror(handle)));
- if (handle)
- fclose(handle);
- return INT16_MAX;
- }
-
- if (memcmp(header.identification, "ZWAD", 4) == 0)
- compressed = 1;
- else if (memcmp(header.identification, "IWAD", 4) != 0
- && memcmp(header.identification, "PWAD", 4) != 0
- && memcmp(header.identification, "SDLL", 4) != 0)
- {
- CONS_Alert(CONS_ERROR, M_GetText("%s does not have a valid WAD header\n"), filename);
- if (handle)
- fclose(handle);
- return INT16_MAX;
- }
-
- header.numlumps = LONG(header.numlumps);
- header.infotableofs = LONG(header.infotableofs);
-
- // read wad file directory
- i = header.numlumps * sizeof (*fileinfo);
- fileinfov = fileinfo = malloc(i);
- if (fseek(handle, header.infotableofs, SEEK_SET) == -1
- || fread(fileinfo, 1, i, handle) < i)
- {
- CONS_Alert(CONS_ERROR, M_GetText("Wadfile directory in %s is corrupted (%s)\n"), filename, strerror(ferror(handle)));
- free(fileinfov);
- if (handle)
- fclose(handle);
- return INT16_MAX;
- }
-
- numlumps = header.numlumps;
-
- // fill in lumpinfo for this wad
- lump_p = lumpinfo = Z_Malloc(numlumps * sizeof (*lumpinfo), PU_STATIC, NULL);
- for (i = 0; i < numlumps; i++, lump_p++, fileinfo++)
- {
- lump_p->position = LONG(fileinfo->filepos);
- lump_p->size = lump_p->disksize = LONG(fileinfo->size);
- if (compressed) // wad is compressed, lump might be
- {
- UINT32 realsize = 0;
-
- if (fseek(handle, lump_p->position, SEEK_SET)
- == -1 || fread(&realsize, 1, sizeof realsize,
- handle) < sizeof realsize)
- {
- I_Error("corrupt compressed file: %s; maybe %s",
- filename, strerror(ferror(handle)));
- }
- realsize = LONG(realsize);
- if (realsize != 0)
- {
- lump_p->size = realsize;
- lump_p->compressed = 1;
- }
- else
- {
- lump_p->size -= 4;
- lump_p->compressed = 0;
- }
-
- lump_p->position += 4;
- lump_p->disksize -= 4;
- }
- else lump_p->compressed = 0;
- memset(lump_p->name, 0x00, 9);
- strncpy(lump_p->name, fileinfo->name, 8);
- }
- free(fileinfov);
- }
-
#ifndef NOMD5
//
// w-waiiiit!
@@ -488,6 +720,32 @@ UINT16 W_LoadWadFile(const char *filename)
}
#endif
+ switch(type = ResourceFileDetect(filename))
+ {
+ case RET_SOC:
+ lumpinfo = ResGetLumpsStandalone(handle, &numlumps, "OBJCTCFG");
+ break;
+#ifdef HAVE_BLUA
+ case RET_LUA:
+ lumpinfo = ResGetLumpsStandalone(handle, &numlumps, "LUA_INIT");
+ break;
+#endif
+ case RET_PK3:
+ lumpinfo = ResGetLumpsZip(handle, &numlumps);
+ break;
+ case RET_WAD:
+ lumpinfo = ResGetLumpsWad(handle, &numlumps, filename);
+ break;
+ default:
+ CONS_Alert(CONS_ERROR, "Unsupported file format\n");
+ }
+
+ if (lumpinfo == NULL)
+ {
+ fclose(handle);
+ return INT16_MAX;
+ }
+
//
// link wad file to search files
//
@@ -499,6 +757,7 @@ UINT16 W_LoadWadFile(const char *filename)
wadfile->important = important;
fseek(handle, 0, SEEK_END);
wadfile->filesize = (unsigned)ftell(handle);
+ wadfile->type = type;
// already generated, just copy it over
M_Memcpy(&wadfile->md5sum, &md5sum, 16);
@@ -519,10 +778,28 @@ UINT16 W_LoadWadFile(const char *filename)
CONS_Printf(M_GetText("Added file %s (%u lumps)\n"), filename, numlumps);
wadfiles[numwadfiles] = wadfile;
numwadfiles++; // must come BEFORE W_LoadDehackedLumps, so any addfile called by COM_BufInsertText called by Lua doesn't overwrite what we just loaded
- W_LoadDehackedLumps(numwadfiles-1);
+
+ // TODO: HACK ALERT - Load Lua & SOC stuff right here. I feel like this should be out of this place, but... Let's stick with this for now.
+ switch (wadfile->type)
+ {
+ case RET_WAD:
+ W_LoadDehackedLumps(numwadfiles - 1);
+ break;
+ case RET_PK3:
+ W_LoadDehackedLumpsPK3(numwadfiles - 1);
+ break;
+ case RET_SOC:
+ CONS_Printf(M_GetText("Loading SOC from %s\n"), wadfile->filename);
+ DEH_LoadDehackedLumpPwad(numwadfiles - 1, 0);
+ break;
+ case RET_LUA:
+ LUA_LoadLump(numwadfiles - 1, 0);
+ break;
+ default:
+ break;
+ }
W_InvalidateLumpnumCache();
-
return wadfile->numlumps;
}
@@ -580,7 +857,7 @@ INT32 W_InitMultipleFiles(char **filenames)
for (; *filenames; filenames++)
{
//CONS_Debug(DBG_SETUP, "Loading %s\n", *filenames);
- rc &= (W_LoadWadFile(*filenames) != INT16_MAX) ? 1 : 0;
+ rc &= (W_InitFile(*filenames) != INT16_MAX) ? 1 : 0;
}
if (!numwadfiles)
@@ -658,6 +935,51 @@ UINT16 W_CheckNumForNamePwad(const char *name, UINT16 wad, UINT16 startlump)
return INT16_MAX;
}
+// Look for the first lump from a folder.
+UINT16 W_CheckNumForFolderStartPK3(const char *name, UINT16 wad, UINT16 startlump)
+{
+ INT32 i;
+ lumpinfo_t *lump_p = wadfiles[wad]->lumpinfo + startlump;
+ for (i = startlump; i < wadfiles[wad]->numlumps; i++, lump_p++)
+ {
+ if (strnicmp(name, lump_p->name2, strlen(name)) == 0)
+ break;
+ }
+ return i;
+}
+
+// In a PK3 type of resource file, it looks for the next lumpinfo entry that doesn't share the specified pathfile.
+// Useful for finding folder ends.
+// Returns the position of the lumpinfo entry.
+UINT16 W_CheckNumForFolderEndPK3(const char *name, UINT16 wad, UINT16 startlump)
+{
+ INT32 i;
+ lumpinfo_t *lump_p = wadfiles[wad]->lumpinfo + startlump;
+ for (i = startlump; i < wadfiles[wad]->numlumps; i++, lump_p++)
+ {
+ if (strnicmp(name, lump_p->name2, strlen(name)))
+ break;
+ }
+ return i;
+}
+
+// In a PK3 type of resource file, it looks for an entry with the specified full name.
+// Returns lump position in PK3's lumpinfo, or INT16_MAX if not found.
+UINT16 W_CheckNumForFullNamePK3(const char *name, UINT16 wad, UINT16 startlump)
+{
+ INT32 i;
+ lumpinfo_t *lump_p = wadfiles[wad]->lumpinfo + startlump;
+ for (i = startlump; i < wadfiles[wad]->numlumps; i++, lump_p++)
+ {
+ if (!strnicmp(name, lump_p->name2, strlen(name)))
+ {
+ return i;
+ }
+ }
+ // Not found at all?
+ return INT16_MAX;
+}
+
//
// W_CheckNumForName
// Returns LUMPERROR if name not found.
@@ -698,6 +1020,37 @@ lumpnum_t W_CheckNumForName(const char *name)
}
}
+// Look for valid map data through all added files in descendant order.
+// Get a map marker for WADs, and a standalone WAD file lump inside PK3s.
+// TODO: Make it search through cache first, maybe...?
+lumpnum_t W_CheckNumForMap(const char *name)
+{
+ UINT16 lumpNum, end;
+ UINT32 i;
+ for (i = numwadfiles - 1; i < numwadfiles; i--)
+ {
+ if (wadfiles[i]->type == RET_WAD)
+ {
+ for (lumpNum = 0; lumpNum < wadfiles[i]->numlumps; lumpNum++)
+ if (!strncmp(name, (wadfiles[i]->lumpinfo + lumpNum)->name, 8))
+ return (i<<16) + lumpNum;
+ }
+ else if (wadfiles[i]->type == RET_PK3)
+ {
+ lumpNum = W_CheckNumForFolderStartPK3("maps/", i, 0);
+ if (lumpNum != INT16_MAX)
+ end = W_CheckNumForFolderEndPK3("maps/", i, lumpNum);
+ else
+ continue;
+ // Now look for the specified map.
+ for (++lumpNum; lumpNum < end; lumpNum++)
+ if (!strnicmp(name, (wadfiles[i]->lumpinfo + lumpNum)->name, 8))
+ return (i<<16) + lumpNum;
+ }
+ }
+ return LUMPERROR;
+}
+
//
// W_GetNumForName
//
@@ -728,15 +1081,19 @@ lumpnum_t W_CheckNumForNameInBlock(const char *name, const char *blockstart, con
// scan wad files backwards so patch lump files take precedence
for (i = numwadfiles - 1; i >= 0; i--)
{
- bsid = W_CheckNumForNamePwad(blockstart,(UINT16)i,0);
- if (bsid == INT16_MAX)
- continue; // block doesn't exist, keep going
- beid = W_CheckNumForNamePwad(blockend,(UINT16)i,0);
- // if block end doesn't exist, just search through everything
+ if (wadfiles[i]->type == RET_WAD)
+ {
+ bsid = W_CheckNumForNamePwad(blockstart, (UINT16)i, 0);
+ if (bsid == INT16_MAX)
+ continue; // Start block doesn't exist?
+ beid = W_CheckNumForNamePwad(blockend, (UINT16)i, 0);
+ if (beid == INT16_MAX)
+ continue; // End block doesn't exist?
- check = W_CheckNumForNamePwad(name,(UINT16)i,bsid);
- if (check < beid)
- return (i<<16)+check; // found it, in our constraints
+ check = W_CheckNumForNamePwad(name, (UINT16)i, bsid);
+ if (check < beid)
+ return (i<<16)+check; // found it, in our constraints
+ }
}
return LUMPERROR;
}
@@ -773,103 +1130,78 @@ size_t W_LumpLength(lumpnum_t lumpnum)
return W_LumpLengthPwad(WADFILENUM(lumpnum),LUMPNUM(lumpnum));
}
-/** Reads bytes from the head of a lump, without doing decompression.
- *
- * \param wad Wad number to read from.
- * \param lump Lump number to read from, within wad.
- * \param dest Buffer in memory to serve as destination.
- * \param size Number of bytes to read.
- * \param offest Number of bytes to offset.
- * \return Number of bytes read (should equal size).
- * \sa W_ReadLumpHeader
- */
-static size_t W_RawReadLumpHeader(UINT16 wad, UINT16 lump, void *dest, size_t size, size_t offset)
+//
+// W_IsLumpWad
+// Is the lump a WAD? (presumably in a PK3)
+//
+boolean W_IsLumpWad(lumpnum_t lumpnum)
{
- size_t bytesread;
- lumpinfo_t *l;
- FILE *handle;
+ if (wadfiles[WADFILENUM(lumpnum)]->type == RET_PK3)
+ {
+ const char *lumpfullName = (wadfiles[WADFILENUM(lumpnum)]->lumpinfo + LUMPNUM(lumpnum))->name2;
- l = wadfiles[wad]->lumpinfo + lump;
+ if (strlen(lumpfullName) < 4)
+ return false; // can't possibly be a WAD can it?
+ return !strnicmp(lumpfullName + strlen(lumpfullName) - 4, ".wad", 4);
+ }
- handle = wadfiles[wad]->handle;
+ return false; // WADs should never be inside non-PK3s as far as SRB2 is concerned
+}
- fseek(handle, (long)(l->position + offset), SEEK_SET);
- bytesread = fread(dest, 1, size, handle);
+#ifdef HAVE_ZLIB
+/* report a zlib or i/o error */
+void zerr(int ret)
+{
+ CONS_Printf("zpipe: ");
+ switch (ret) {
+ case Z_ERRNO:
+ if (ferror(stdin))
+ CONS_Printf("error reading stdin\n");
+ if (ferror(stdout))
+ CONS_Printf("error writing stdout\n");
+ break;
+ case Z_STREAM_ERROR:
+ CONS_Printf("invalid compression level\n");
+ break;
+ case Z_DATA_ERROR:
+ CONS_Printf("invalid or incomplete deflate data\n");
+ break;
+ case Z_MEM_ERROR:
+ CONS_Printf("out of memory\n");
+ break;
+ case Z_VERSION_ERROR:
+ CONS_Printf("zlib version mismatch!\n");
+ }
+}
+#endif
-#if 1 // we're fucking sick of this
- if (bytesread < 67) // http://garethrees.org/2007/11/14/pngcrush/
- return bytesread;
+#define NO_PNG_LUMPS
-#define sigcheck ((UINT8 *)dest)
+#ifdef NO_PNG_LUMPS
+static void ErrorIfPNG(void *d, size_t s, char *f, char *l)
+{
+ if (s < 67) // http://garethrees.org/2007/11/14/pngcrush/
+ return;
+#define sigcheck ((UINT8 *)d)
if (sigcheck[0] == 0x89
- && sigcheck[1] == 0x50
- && sigcheck[2] == 0x4e
- && sigcheck[3] == 0x47
- && sigcheck[4] == 0x0d
- && sigcheck[5] == 0x0a
- && sigcheck[6] == 0x1a
- && sigcheck[7] == 0x0a)
+ && sigcheck[1] == 0x50
+ && sigcheck[2] == 0x4e
+ && sigcheck[3] == 0x47
+ && sigcheck[4] == 0x0d
+ && sigcheck[5] == 0x0a
+ && sigcheck[6] == 0x1a
+ && sigcheck[7] == 0x0a)
{
- char pnglump[9];
- strncpy(pnglump, l->name, 8);
- pnglump[8] = '\0';
- I_Error("W_Wad: Lump \"%s\" is a .PNG - have you tried converting to Doom or Flat (raw) image formats?", pnglump);
+ I_Error("W_Wad: Lump \"%s\" in file \"%s\" is a .PNG - please convert to either Doom or Flat (raw) image format.", l, f);
}
#undef sigcheck
-
-#endif
-
- return bytesread;
}
-
-// Read a compressed lump; return it in newly Z_Malloc'd memory.
-// wad is number of wad file, lump is number of lump in wad.
-static void *W_ReadCompressedLump(UINT16 wad, UINT16 lump)
-{
-#ifdef ZWAD
- char *compressed, *data;
- const lumpinfo_t *l = &wadfiles[wad]->lumpinfo[lump];
- size_t retval;
-
- compressed = Z_Malloc(l->disksize, PU_STATIC, NULL);
- data = Z_Malloc(l->size, PU_STATIC, NULL);
- if (W_RawReadLumpHeader(wad, lump, compressed, l->disksize, 0)
- < l->disksize)
- {
- I_Error("wad %d, lump %d: cannot read compressed data",
- wad, lump);
- }
-
- retval = lzf_decompress(compressed, l->disksize, data, l->size);
-#ifndef AVOID_ERRNO
- if (retval == 0 && errno == E2BIG)
- {
- I_Error("wad %d, lump %d: compressed data too big "
- "(bigger than %s)", wad, lump, sizeu1(l->size));
- }
- else if (retval == 0 && errno == EINVAL)
- I_Error("wad %d, lump %d: invalid compressed data", wad, lump);
- else
#endif
- if (retval != l->size)
- {
- I_Error("wad %d, lump %d: decompressed to wrong number of "
- "bytes (expected %s, got %s)", wad, lump,
- sizeu1(l->size), sizeu2(retval));
- }
- Z_Free(compressed);
- return data;
-#else
- (void)wad;
- (void)lump;
- //I_Error("ZWAD files not supported on this platform.");
- return NULL;
-#endif
-}
/** Reads bytes from the head of a lump.
* Note: If the lump is compressed, the whole thing has to be read anyway.
*
+ * \param wad Wad number to read from.
* \param lump Lump number to read from.
* \param dest Buffer in memory to serve as destination.
* \param size Number of bytes to read.
@@ -880,6 +1212,8 @@ static void *W_ReadCompressedLump(UINT16 wad, UINT16 lump)
size_t W_ReadLumpHeaderPwad(UINT16 wad, UINT16 lump, void *dest, size_t size, size_t offset)
{
size_t lumpsize;
+ lumpinfo_t *l;
+ FILE *handle;
if (!TestValidLump(wad,lump))
return 0;
@@ -893,17 +1227,130 @@ size_t W_ReadLumpHeaderPwad(UINT16 wad, UINT16 lump, void *dest, size_t size, si
if (!size || size+offset > lumpsize)
size = lumpsize - offset;
- if (wadfiles[wad]->lumpinfo[lump].compressed)
+ // Let's get the raw lump data.
+ // We setup the desired file handle to read the lump data.
+ l = wadfiles[wad]->lumpinfo + lump;
+ handle = wadfiles[wad]->handle;
+ fseek(handle, (long)(l->position + offset), SEEK_SET);
+
+ // But let's not copy it yet. We support different compression formats on lumps, so we need to take that into account.
+ switch(wadfiles[wad]->lumpinfo[lump].compression)
{
- UINT8 *data;
- data = W_ReadCompressedLump(wad, lump);
- if (!data) return 0;
- M_Memcpy(dest, data+offset, size);
- Z_Free(data);
- return size;
+ case CM_NOCOMPRESSION: // If it's uncompressed, we directly write the data into our destination, and return the bytes read.
+#ifdef NO_PNG_LUMPS
+ {
+ size_t bytesread = fread(dest, 1, size, handle);
+ ErrorIfPNG(dest, bytesread, wadfiles[wad]->filename, l->name2);
+ return bytesread;
+ }
+#else
+ return fread(dest, 1, size, handle);
+#endif
+ case CM_LZF: // Is it LZF compressed? Used by ZWADs.
+ {
+#ifdef ZWAD
+ char *rawData; // The lump's raw data.
+ char *decData; // Lump's decompressed real data.
+ size_t retval; // Helper var, lzf_decompress returns 0 when an error occurs.
+
+ rawData = Z_Malloc(l->disksize, PU_STATIC, NULL);
+ decData = Z_Malloc(l->size, PU_STATIC, NULL);
+
+ if (fread(rawData, 1, l->disksize, handle) < l->disksize)
+ I_Error("wad %d, lump %d: cannot read compressed data", wad, lump);
+ retval = lzf_decompress(rawData, l->disksize, decData, l->size);
+#ifndef AVOID_ERRNO
+ if (retval == 0) // If this was returned, check if errno was set
+ {
+ // errno is a global var set by the lzf functions when something goes wrong.
+ if (errno == E2BIG)
+ I_Error("wad %d, lump %d: compressed data too big (bigger than %s)", wad, lump, sizeu1(l->size));
+ else if (errno == EINVAL)
+ I_Error("wad %d, lump %d: invalid compressed data", wad, lump);
+ }
+ // Otherwise, fall back on below error (if zero was actually the correct size then ???)
+#endif
+ if (retval != l->size)
+ {
+ I_Error("wad %d, lump %d: decompressed to wrong number of bytes (expected %s, got %s)", wad, lump, sizeu1(l->size), sizeu2(retval));
+ }
+
+ if (!decData) // Did we get no data at all?
+ return 0;
+ M_Memcpy(dest, decData + offset, size);
+ Z_Free(rawData);
+ Z_Free(decData);
+#ifdef NO_PNG_LUMPS
+ ErrorIfPNG(dest, size, wadfiles[wad]->filename, l->name2);
+#endif
+ return size;
+#else
+ //I_Error("ZWAD files not supported on this platform.");
+ return 0;
+#endif
+ }
+#ifdef HAVE_ZLIB
+ case CM_DEFLATE: // Is it compressed via DEFLATE? Very common in ZIPs/PK3s, also what most doom-related editors support.
+ {
+ UINT8 *rawData; // The lump's raw data.
+ UINT8 *decData; // Lump's decompressed real data.
+
+ int zErr; // Helper var.
+ z_stream strm;
+ unsigned long rawSize = l->disksize;
+ unsigned long decSize = l->size;
+
+ rawData = Z_Malloc(rawSize, PU_STATIC, NULL);
+ decData = Z_Malloc(decSize, PU_STATIC, NULL);
+
+ if (fread(rawData, 1, rawSize, handle) < rawSize)
+ I_Error("wad %d, lump %d: cannot read compressed data", wad, lump);
+
+ strm.zalloc = Z_NULL;
+ strm.zfree = Z_NULL;
+ strm.opaque = Z_NULL;
+
+ strm.total_in = strm.avail_in = rawSize;
+ strm.total_out = strm.avail_out = decSize;
+
+ strm.next_in = rawData;
+ strm.next_out = decData;
+
+ zErr = inflateInit2(&strm, -15);
+ if (zErr == Z_OK)
+ {
+ zErr = inflate(&strm, Z_FINISH);
+ if (zErr == Z_STREAM_END)
+ {
+ M_Memcpy(dest, decData, size);
+ }
+ else
+ {
+ size = 0;
+ zerr(zErr);
+ (void)inflateEnd(&strm);
+ }
+ }
+ else
+ {
+ CONS_Printf("whopet\n");
+ size = 0;
+ zerr(zErr);
+ }
+
+ Z_Free(rawData);
+ Z_Free(decData);
+
+#ifdef NO_PNG_LUMPS
+ ErrorIfPNG(dest, size, wadfiles[wad]->filename, l->name2);
+#endif
+ return size;
+ }
+#endif
+ default:
+ I_Error("wad %d, lump %d: unsupported compression type!", wad, lump);
}
- else
- return W_RawReadLumpHeader(wad, lump, dest, size, offset);
+ return -1;
}
size_t W_ReadLumpHeader(lumpnum_t lumpnum, void *dest, size_t size, size_t offset)
@@ -1187,12 +1634,12 @@ static int W_VerifyFile(const char *filename, lumpchecklist_t *checklist,
if ((handle = W_OpenWadFile(&filename, false)) == NULL)
return -1;
- // detect dehacked file with the "soc" extension
- if (stricmp(&filename[strlen(filename) - 4], ".soc") != 0
+ // detect wad file by the absence of the other supported extensions
+ if (stricmp(&filename[strlen(filename) - 4], ".soc")
#ifdef HAVE_BLUA
- && stricmp(&filename[strlen(filename) - 4], ".lua") != 0
+ && stricmp(&filename[strlen(filename) - 4], ".lua")
#endif
- )
+ && stricmp(&filename[strlen(filename) - 4], ".pk3"))
{
// assume wad file
wadinfo_t header;
@@ -1281,12 +1728,17 @@ int W_VerifyNMUSlumps(const char *filename)
{"TRANS", 5}, // Translucency map
{"LTFNT", 5}, // Level title font changes
+ {"TTL", 3}, // Act number changes
{"STCFN", 5}, // Console font changes
{"TNYFN", 5}, // Tiny console font changes
- {"MKFNT", 5}, // Kart font changes
+ {"SBO", 3}, // Acceptable HUD changes (Score Time Rings)
+ {"RRINGS", 6}, // Rings HUD (not named as SBO)
+ {"YB_", 3}, // Intermission graphics, goes with the above
+ {"M_", 2}, // As does menu stuff
- {"M_", 2}, // Menu changes
+ {"MKFNT", 5}, // Kart font changes
{"K_", 2}, // Kart graphic changes
+ {"MUSICDEF", 8}, // Kart song definitions
{NULL, 0},
};
diff --git a/src/w_wad.h b/src/w_wad.h
index 8da22804..e2e17740 100644
--- a/src/w_wad.h
+++ b/src/w_wad.h
@@ -2,7 +2,7 @@
//-----------------------------------------------------------------------------
// Copyright (C) 1993-1996 by id Software, Inc.
// Copyright (C) 1998-2000 by DooM Legacy Team.
-// Copyright (C) 1999-2016 by Sonic Team Junior.
+// Copyright (C) 1999-2018 by Sonic Team Junior.
//
// This program is free software distributed under the
// terms of the GNU General Public License, version 2.
@@ -22,6 +22,22 @@
#pragma interface
#endif
+// a raw entry of the wad directory
+// NOTE: This sits here and not in w_wad.c because p_setup.c makes use of it to load map WADs inside PK3s.
+#if defined(_MSC_VER)
+#pragma pack(1)
+#endif
+typedef struct
+{
+ UINT32 filepos; // file offset of the resource
+ UINT32 size; // size of the resource
+ char name[8]; // name of the resource
+} ATTRPACK filelump_t;
+#if defined(_MSC_VER)
+#pragma pack()
+#endif
+
+
// ==============================================================
// WAD FILE STRUCTURE DEFINITIONS
// ==============================================================
@@ -34,21 +50,33 @@ typedef struct
UINT32 infotableofs; // the 'directory' of resources
} wadinfo_t;
+// Available compression methods for lumps.
+typedef enum
+{
+ CM_NOCOMPRESSION,
+#ifdef HAVE_ZLIB
+ CM_DEFLATE,
+#endif
+ CM_LZF,
+ CM_UNSUPPORTED
+} compmethod;
+
// a memory entry of the wad directory
typedef struct
{
unsigned long position; // filelump_t filepos
unsigned long disksize; // filelump_t size
char name[9]; // filelump_t name[]
+ char *name2; // Used by PK3s. Dynamically allocated name.
size_t size; // real (uncompressed) size
- INT32 compressed; // i
+ compmethod compression; // lump compression method
} lumpinfo_t;
// =========================================================================
// DYNAMIC WAD LOADING
// =========================================================================
-#define MAX_WADPATH 128
+#define MAX_WADPATH 512
#define MAX_WADFILES 48 // maximum of wad files used at the same time
// (there is a max of simultaneous open files anyway, and this should be plenty)
@@ -58,9 +86,21 @@ typedef struct
#include "m_aatree.h"
#endif
+// Resource type of the WAD. Yeah, I know this sounds dumb, but I'll leave it like this until I clean up the code further.
+typedef enum restype
+{
+ RET_WAD,
+ RET_SOC,
+ RET_LUA,
+ RET_PK3,
+ RET_UNKNOWN,
+} restype_t;
+
+
typedef struct wadfile_s
{
char *filename;
+ restype_t type;
lumpinfo_t *lumpinfo;
lumpcache_t *lumpcache;
#ifdef HWRENDER
@@ -86,7 +126,7 @@ void W_Shutdown(void);
// Opens a WAD file. Returns the FILE * handle for the file, or NULL if not found or could not be opened
FILE *W_OpenWadFile(const char **filename, boolean useerrors);
// Load and add a wadfile to the active wad files, returns numbers of lumps, INT16_MAX on error
-UINT16 W_LoadWadFile(const char *filename);
+UINT16 W_InitFile(const char *filename);
#ifdef DELFILE
void W_UnloadWadFile(UINT16 num);
#endif
@@ -99,6 +139,12 @@ const char *W_CheckNameForNumPwad(UINT16 wad, UINT16 lump);
const char *W_CheckNameForNum(lumpnum_t lumpnum);
UINT16 W_CheckNumForNamePwad(const char *name, UINT16 wad, UINT16 startlump); // checks only in one pwad
+
+UINT16 W_CheckNumForFullNamePK3(const char *name, UINT16 wad, UINT16 startlump);
+UINT16 W_CheckNumForFolderStartPK3(const char *name, UINT16 wad, UINT16 startlump);
+UINT16 W_CheckNumForFolderEndPK3(const char *name, UINT16 wad, UINT16 startlump);
+
+lumpnum_t W_CheckNumForMap(const char *name);
lumpnum_t W_CheckNumForName(const char *name);
lumpnum_t W_GetNumForName(const char *name); // like W_CheckNumForName but I_Error on LUMPERROR
lumpnum_t W_CheckNumForNameInBlock(const char *name, const char *blockstart, const char *blockend);
@@ -107,6 +153,12 @@ UINT8 W_LumpExists(const char *name); // Lua uses this.
size_t W_LumpLengthPwad(UINT16 wad, UINT16 lump);
size_t W_LumpLength(lumpnum_t lumpnum);
+boolean W_IsLumpWad(lumpnum_t lumpnum); // for loading maps from WADs in PK3s
+
+#ifdef HAVE_ZLIB
+void zerr(int ret); // zlib error checking
+#endif
+
size_t W_ReadLumpHeaderPwad(UINT16 wad, UINT16 lump, void *dest, size_t size, size_t offset);
size_t W_ReadLumpHeader(lumpnum_t lump, void *dest, size_t size, size_t offest); // read all or a part of a lump
void W_ReadLumpPwad(UINT16 wad, UINT16 lump, void *dest);
diff --git a/src/win32/Makefile.cfg b/src/win32/Makefile.cfg
index da66e996..157d9744 100644
--- a/src/win32/Makefile.cfg
+++ b/src/win32/Makefile.cfg
@@ -7,8 +7,9 @@
#
ifdef MINGW64
- NOASM=1
- NONX86=1
+ HAVE_LIBGME=1
+ LIBGME_CFLAGS=-I../libs/gme/include
+ LIBGME_LDFLAGS=-L../libs/gme/win64 -lgme
SDL_CFLAGS?=-I../libs/SDL2/x86_64-w64-mingw32/include/SDL2 -I../libs/SDL2_mixer/x86_64-w64-mingw32/include/SDL2 -Dmain=SDL_main
SDL_LDFLAGS?=-L../libs/SDL2/x86_64-w64-mingw32/lib -L../libs/SDL2_mixer/x86_64-w64-mingw32/lib -lmingw32 -lSDL2main -lSDL2 -mwindows
else
@@ -23,7 +24,9 @@ ifndef NOASM
USEASM=1
endif
+ifndef MINGW64 #miniupnc is broken with MINGW64
HAVE_MINIUPNPC=1
+endif
OPTS=-DSTDC_HEADERS
diff --git a/src/win32/Srb2win-vc10.vcxproj b/src/win32/Srb2win-vc10.vcxproj
index 0722c0b6..ca73b129 100644
--- a/src/win32/Srb2win-vc10.vcxproj
+++ b/src/win32/Srb2win-vc10.vcxproj
@@ -1,10 +1,26 @@
+
+ Debug
+ ARM
+
+
+ Debug
+ ARM64
+
Debug
Win32
+
+ Release
+ ARM
+
+
+ Release
+ ARM64
+
Release
Win32
@@ -23,26 +39,49 @@
{0F554F1D-ED49-4D65-A9A7-F63C57F277BE}
Win32Proj
Srb2win
- 8.1
+ 10.0.17763.0
-
- v140
-
+ v140
true
+
+ true
+ true
+ v141
+
+ v140
false
true
+
+ false
+ true
+ true
+ v141
+
+ v140
true
+
+ true
+ true
+ v141
+
+ v140
false
true
+
+ false
+ true
+ true
+ v141
+
@@ -58,23 +97,89 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
<_ProjectFileVersion>10.0.30319.1
false
+
+
+ true
+ gdi32.lib;%(AdditionalDependencies)
+
+
+ ProgramDatabase
+ false
+
+
+
+
+ true
+ gdi32.lib;%(AdditionalDependencies)
+
+
+
+
+ ProgramDatabase
+ false
+
+
+ gdi32.lib;%(AdditionalDependencies)
+
+
+
+
+ gdi32.lib;%(AdditionalDependencies)
+
+
+
+
+ gdi32.lib;%(AdditionalDependencies)
+
+
+
+
+ gdi32.lib;%(AdditionalDependencies)
+
+
+
+
+ gdi32.lib;%(AdditionalDependencies)
+
+
+
+
+ gdi32.lib;%(AdditionalDependencies)
+
+
@@ -132,6 +237,7 @@
+
diff --git a/src/win32/Srb2win-vc10.vcxproj.filters b/src/win32/Srb2win-vc10.vcxproj.filters
index 95e79cab..d20dd672 100644
--- a/src/win32/Srb2win-vc10.vcxproj.filters
+++ b/src/win32/Srb2win-vc10.vcxproj.filters
@@ -228,6 +228,9 @@
LUA
+
+ LUA
+
LUA
diff --git a/src/win32/Srb2win.ico b/src/win32/Srb2win.ico
index 6e667b61..4e3f8133 100644
Binary files a/src/win32/Srb2win.ico and b/src/win32/Srb2win.ico differ
diff --git a/src/win32/Srb2win.rc b/src/win32/Srb2win.rc
index 426a5e01..b60ba750 100644
--- a/src/win32/Srb2win.rc
+++ b/src/win32/Srb2win.rc
@@ -36,18 +36,18 @@ IDI_ICON1 ICON DISCARDABLE "Srb2win.ico"
// TEXTINCLUDE
//
-1 TEXTINCLUDE DISCARDABLE
+1 TEXTINCLUDE DISCARDABLE
BEGIN
"resource.h\0"
END
-2 TEXTINCLUDE DISCARDABLE
+2 TEXTINCLUDE DISCARDABLE
BEGIN
"#include ""afxres.h""\r\n"
"\0"
END
-3 TEXTINCLUDE DISCARDABLE
+3 TEXTINCLUDE DISCARDABLE
BEGIN
"\r\n"
"\0"
@@ -84,7 +84,7 @@ BEGIN
VALUE "FileDescription", "Sonic Robo Blast 2\0"
VALUE "FileVersion", "1, 09\0"
VALUE "InternalName", "srb2\0"
- VALUE "LegalCopyright", "Copyright 1998-2005 Sonic Team Junior\0"
+ VALUE "LegalCopyright", "Copyright � 1998-2018 by Sonic Team Junior\0"
VALUE "LegalTrademarks", "Sonic the Hedgehog and related characters are trademarks of Sega.\0"
VALUE "OriginalFilename", "srb2win.exe\0"
VALUE "PrivateBuild", "\0"
diff --git a/src/win32/win_sys.c b/src/win32/win_sys.c
index 882e3e58..75aca68d 100644
--- a/src/win32/win_sys.c
+++ b/src/win32/win_sys.c
@@ -771,6 +771,8 @@ void I_Quit(void)
ShowEndTxt(co);
}
fflush(stderr);
+ if (myargmalloc)
+ free(myargv); // Deallocate allocated memory
W_Shutdown();
exit(0);
}
diff --git a/src/win32/win_vid.c b/src/win32/win_vid.c
index f355eaea..9f3d13f8 100644
--- a/src/win32/win_vid.c
+++ b/src/win32/win_vid.c
@@ -995,7 +995,7 @@ static INT32 WINAPI VID_SetDirectDrawMode(viddef_t *lvid, vmode_t *currentmode)
// but rather render to memory bitmap buffer
lvid->direct = NULL;
- if (!cv_stretch.value && (float)vid.width/vid.height != ((float)BASEVIDWIDTH/BASEVIDHEIGHT))
+ if (!cv_stretch.value && fabsf((float)vid.width/vid.height - ((float)BASEVIDWIDTH/BASEVIDHEIGHT)) > 1.0E-36f)
vid.height = (int)(vid.width * ((float)BASEVIDHEIGHT/BASEVIDWIDTH));// Adjust the height to match
return 1;
diff --git a/src/win32ce/Srb2win.ico b/src/win32ce/Srb2win.ico
index 6e667b61..4e3f8133 100644
Binary files a/src/win32ce/Srb2win.ico and b/src/win32ce/Srb2win.ico differ
diff --git a/src/y_inter.c b/src/y_inter.c
index 50cae957..021519e3 100644
--- a/src/y_inter.c
+++ b/src/y_inter.c
@@ -1,6 +1,6 @@
// SONIC ROBO BLAST 2
//-----------------------------------------------------------------------------
-// Copyright (C) 2004-2016 by Sonic Team Junior.
+// Copyright (C) 2004-2018 by Sonic Team Junior.
//
// This program is free software distributed under the
// terms of the GNU General Public License, version 2.
@@ -712,6 +712,9 @@ static void Y_UpdateRecordReplays(void)
if ((earnedEmblems = M_CheckLevelEmblems()))
CONS_Printf(M_GetText("\x82" "Earned %hu medal%s for Record Attack records.\n"), (UINT16)earnedEmblems, earnedEmblems > 1 ? "s" : "");
+ if (M_UpdateUnlockablesAndExtraEmblems(false))
+ S_StartSound(NULL, sfx_ncitem);
+
// SRB2Kart - save here so you NEVER lose your earned times/medals.
G_SaveGameData(false);
@@ -1034,7 +1037,7 @@ void Y_VoteDrawer(void)
V_DrawFixedPatch((BASEVIDWIDTH-60)<menuflags & LF2_HIDEINMENU))
S_StartSound(NULL, sfx_noooo1); // this is bad
- else if (!splitscreen && pick == consoleplayer)
+ else if (netgame && (pick == consoleplayer
+ || pick == secondarydisplayplayer
+ || pick == thirddisplayplayer
+ || pick == fourthdisplayplayer))
S_StartSound(NULL, sfx_yeeeah); // yeeeah!
else
S_StartSound(NULL, sfx_kc48); // just a cool sound
diff --git a/src/y_inter.h b/src/y_inter.h
index 95ea67cc..6162dc28 100644
--- a/src/y_inter.h
+++ b/src/y_inter.h
@@ -1,6 +1,6 @@
// SONIC ROBO BLAST 2
//-----------------------------------------------------------------------------
-// Copyright (C) 2004-2016 by Sonic Team Junior.
+// Copyright (C) 2004-2018 by Sonic Team Junior.
//
// This program is free software distributed under the
// terms of the GNU General Public License, version 2.
diff --git a/src/z_zone.c b/src/z_zone.c
index eecb6e80..a3e13422 100644
--- a/src/z_zone.c
+++ b/src/z_zone.c
@@ -1,7 +1,7 @@
// SONIC ROBO BLAST 2
//-----------------------------------------------------------------------------
// Copyright (C) 2006 by Graue.
-// Copyright (C) 2006-2016 by Sonic Team Junior.
+// Copyright (C) 2006-2018 by Sonic Team Junior.
//
// This program is free software distributed under the
// terms of the GNU General Public License, version 2.
diff --git a/src/z_zone.h b/src/z_zone.h
index cd5fb2f7..1424a378 100644
--- a/src/z_zone.h
+++ b/src/z_zone.h
@@ -2,7 +2,7 @@
//-----------------------------------------------------------------------------
// Copyright (C) 1993-1996 by id Software, Inc.
// Copyright (C) 1998-2000 by DooM Legacy Team.
-// Copyright (C) 1999-2016 by Sonic Team Junior.
+// Copyright (C) 1999-2018 by Sonic Team Junior.
//
// This program is free software distributed under the
// terms of the GNU General Public License, version 2.
diff --git a/tools/masterserver/structure.sql b/tools/masterserver/structure.sql
new file mode 100644
index 00000000..3cc2cb15
--- /dev/null
+++ b/tools/masterserver/structure.sql
@@ -0,0 +1,117 @@
+SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
+SET AUTOCOMMIT = 0;
+START TRANSACTION;
+SET time_zone = "+00:00";
+
+
+/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
+/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
+/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
+/*!40101 SET NAMES utf8mb4 */;
+
+--
+-- Database: `srb2ms`
+--
+
+CREATE DATABASE IF NOT EXISTS `srb2ms` DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci;
+USE `srb2ms`;
+
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `ms_bans`
+--
+
+CREATE TABLE `ms_bans` (
+ `bid` int(11) DEFAULT NULL,
+ `ipstart` int(11) DEFAULT NULL,
+ `ipend` int(11) DEFAULT NULL,
+ `full_endtime` int(11) DEFAULT NULL,
+ `permanent` tinyint(1) DEFAULT NULL,
+ `hostonly` tinyint(1) DEFAULT NULL,
+ `reason` text COLLATE utf8mb4_unicode_ci
+) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `ms_rooms`
+--
+
+CREATE TABLE `ms_rooms` (
+ `room_id` int(11) NOT NULL,
+ `title` text COLLATE utf8mb4_unicode_ci NOT NULL,
+ `motd` text COLLATE utf8mb4_unicode_ci NOT NULL,
+ `visible` tinyint(1) NOT NULL,
+ `order` int(11) NOT NULL,
+ `private` tinyint(1) NOT NULL
+) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
+
+--
+-- Dumping data for table `ms_rooms`
+--
+
+INSERT INTO `ms_rooms` (`room_id`, `title`, `motd`, `visible`, `order`, `private`) VALUES
+(10, 'Example', 'Example Room', 1, 0, 0),
+(0, 'All', 'View all of the servers currently being hosted.', 1, 1, 1);
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `ms_servers`
+--
+
+CREATE TABLE `ms_servers` (
+ `sid` int(11) NOT NULL,
+ `name` text COLLATE utf8mb4_unicode_ci NOT NULL,
+ `ip` text COLLATE utf8mb4_unicode_ci NOT NULL,
+ `port` int(11) NOT NULL,
+ `version` text COLLATE utf8mb4_unicode_ci NOT NULL,
+ `timestamp` int(11) NOT NULL,
+ `room` int(11) NOT NULL,
+ `key` text COLLATE utf8mb4_unicode_ci NOT NULL,
+ `room_override` int(11) NOT NULL,
+ `upnow` tinyint(1) NOT NULL,
+ `permanent` tinyint(1) NOT NULL,
+ `delisted` tinyint(1) NOT NULL,
+ `sticky` int(11) NOT NULL
+) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `ms_versions`
+--
+
+CREATE TABLE `ms_versions` (
+ `mod_id` int(11) NOT NULL,
+ `mod_version` int(11) NOT NULL
+) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
+
+--
+-- Dumping data for table `ms_versions`
+--
+
+INSERT INTO `ms_versions` (`mod_id`, `mod_version`) VALUES
+(12, 25);
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `user`
+--
+
+CREATE TABLE `user` (
+ `userid` int(11) NOT NULL,
+ `username` text COLLATE utf8mb4_unicode_ci NOT NULL,
+ `live_authkey` blob NOT NULL,
+ `live_publickey` blob NOT NULL,
+ `salt` blob NOT NULL,
+ `password` blob NOT NULL
+) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
+COMMIT;
+
+/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
+/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
+/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
diff --git a/windows-installer/staging/! SRB2KART INSTALL INSTRUCTIONS !.txt b/windows-installer/staging/! SRB2KART INSTALL INSTRUCTIONS !.txt
new file mode 100644
index 00000000..91d055be
--- /dev/null
+++ b/windows-installer/staging/! SRB2KART INSTALL INSTRUCTIONS !.txt
@@ -0,0 +1,11 @@
+SRB2Kart Install Instructions
+
+1. Move every file from the "new-install" folder to this main install folder.
+
+2. DELETE "staging.bat" and "staging.txt"! These can mess up your installation if run by accident!
+
+3. Optionally, create a folder in your user profile named "SRB2Kart". This is where your game data and addons may live. For example,
+
+ C:\Users\[User]\SRB2Kart
+
+4. Run the game! Double-click srb2kart.exe -- or see if you have Start Menu icons under "SRB2Kart".
\ No newline at end of file