From 78fa72514f03a881d559eb757708b2e7d0722841 Mon Sep 17 00:00:00 2001 From: mazmazz Date: Sun, 30 Dec 2018 15:08:30 -0500 Subject: [PATCH 01/56] Implement deployer scripts for Travis -- OSX and Linux package building --- .gitignore | 2 + .travis.yml | 448 +++++++++++++++++- CMakeLists.txt | 10 +- assets/.gitignore | 11 +- assets/CMakeLists.txt | 74 ++- .../{debian => debian-template}/README.Debian | 52 +- .../{debian => debian-template}/README.source | 0 assets/debian-template/changelog | 5 + assets/{debian => debian-template}/compat | 0 assets/{debian => debian-template}/control | 8 +- {debian => assets/debian-template}/copyright | 10 +- assets/{debian => debian-template}/rules | 54 ++- .../{debian => debian-template}/source/format | 0 .../source/options | 0 assets/debian/changelog | 19 - {debian => debian-template}/README.Debian | 50 +- {debian => debian-template}/README.source | 0 debian-template/changelog | 5 + {debian => debian-template}/compat | 0 {debian => debian-template}/control | 24 +- {assets/debian => debian-template}/copyright | 10 +- {debian => debian-template}/docs | 0 {debian => debian-template}/rules | 26 +- {debian => debian-template}/source/format | 0 {debian => debian-template}/source/options | 2 +- debian-template/srb2.desktop | 10 + debian/changelog | 12 - debian/srb2.desktop | 10 - debian_template.sh | 166 +++++++ deployer/travis/deployer.sh | 157 ++++++ deployer/travis/deployer_build.sh | 190 ++++++++ deployer/travis/deployer_defaults.sh | 107 +++++ deployer/travis/deployer_dput.sh | 133 ++++++ deployer/travis/deployer_ftp.sh | 137 ++++++ src/sdl/CMakeLists.txt | 13 +- 35 files changed, 1594 insertions(+), 151 deletions(-) rename assets/{debian => debian-template}/README.Debian (59%) rename assets/{debian => debian-template}/README.source (100%) create mode 100644 assets/debian-template/changelog rename assets/{debian => debian-template}/compat (100%) rename assets/{debian => debian-template}/control (84%) rename {debian => assets/debian-template}/copyright (57%) rename assets/{debian => debian-template}/rules (58%) mode change 100755 => 100644 rename assets/{debian => debian-template}/source/format (100%) rename assets/{debian => debian-template}/source/options (100%) delete mode 100644 assets/debian/changelog rename {debian => debian-template}/README.Debian (62%) rename {debian => debian-template}/README.source (100%) create mode 100644 debian-template/changelog rename {debian => debian-template}/compat (100%) rename {debian => debian-template}/control (65%) rename {assets/debian => debian-template}/copyright (57%) rename {debian => debian-template}/docs (100%) rename {debian => debian-template}/rules (87%) mode change 100755 => 100644 rename {debian => debian-template}/source/format (100%) rename {debian => debian-template}/source/options (81%) create mode 100644 debian-template/srb2.desktop delete mode 100644 debian/changelog delete mode 100644 debian/srb2.desktop create mode 100644 debian_template.sh create mode 100644 deployer/travis/deployer.sh create mode 100644 deployer/travis/deployer_build.sh create mode 100644 deployer/travis/deployer_defaults.sh create mode 100644 deployer/travis/deployer_dput.sh create mode 100644 deployer/travis/deployer_ftp.sh diff --git a/.gitignore b/.gitignore index 922fac4aa..3090417dd 100644 --- a/.gitignore +++ b/.gitignore @@ -19,3 +19,5 @@ Win32_LIB_ASM_Release *.db *.opendb /.vs +/debian +/assets/debian diff --git a/.travis.yml b/.travis.yml index 1131bff3a..9d5774293 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: @@ -71,6 +87,7 @@ matrix: - gcc-7 compiler: gcc-7 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: @@ -86,9 +103,11 @@ matrix: - 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: @@ -103,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: @@ -118,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: @@ -133,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: @@ -148,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: @@ -163,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: @@ -178,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: @@ -193,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 @@ -228,12 +542,14 @@ matrix: - compiler: clang-4.0 - compiler: clang-5.0 + cache: apt: true ccache: true directories: - $HOME/srb2_cache + addons: apt: packages: @@ -241,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 + - 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: + - if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then + brew update; + brew install sdl2 game-music-emu zlib p7zip; + brew install sdl2_mixer --with-flac --with-mpg123; + brew install cmake||true; + fi - mkdir -p $HOME/srb2_cache -script: make -k + +before_script: + # OLDPWD is root repo folder + - OLDPWD=$PWD + - cd "$HOME/srb2_cache" + + # 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) + - 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"$HOME/srb2_cache" -aos; + for f in $ASSET_FILES_REQUIRED; do + cp "$HOME/srb2_cache/$f" "$OLDPWD/assets/$f"; + done; + fi; + + # Get individual required files + - for f in $ASSET_FILES_REQUIRED; do + if [ -f "$f" ]; then + echo "$f cache date -- $($STATCMD $f)"; + fi; + wget --verbose --server-response -N "$ASSET_BASE_PATH/$f"; + if [ ! -f "$HOME/srb2_cache/$f" ]; then + echo "Could not download \"$ASSET_BASE_PATH/$f\""; + return 1; + fi; + cp "$HOME/srb2_cache/$f" "$OLDPWD/assets/$f"; + done; + + # Get the docs + - for f in $ASSET_FILES_DOCS; do + if [ -f "$f" ]; then + echo "$f cache date -- $($STATCMD $f)"; + fi; + wget --verbose --server-response -N "$ASSET_BASE_PATH/$f"; + cp "$HOME/srb2_cache/$f" "$OLDPWD/assets/$f"; + done; + + # Get optional files too + - if [[ "$ASSET_FILES_OPTIONAL_GET" == "1" ]]; then + for f in $ASSET_FILES_OPTIONAL; do + if [ -f "$f" ]; then + echo "$f cache date -- $($STATCMD $f)"; + fi; + wget --verbose --server-response -N "$ASSET_BASE_PATH/$f"; + cp "$HOME/srb2_cache/$f" "$OLDPWD/assets/$f"; + done; + fi; + + # Go back to root repo folder + - cd "$OLDPWD" + + # Prepare CMake asset lists + - SRB2_ASSET_REQUIRED=$(echo ${ASSET_FILES_REQUIRED// /\;}) + - SRB2_ASSET_OPTIONAL=$(echo ${ASSET_FILES_OPTIONAL// /\;}) + - SRB2_ASSET_DOCS=$(echo ${ASSET_FILES_DOCS// /\;}) + + # Prepare CMake + - mkdir build + - cd build + - mkdir package + - export CFLAGS="-Wall -W -Werror $WFLAGS" + - export CCACHE_COMPRESS=true + - cmake .. -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=$PWD/bin -DCPACK_PACKAGE_DIRECTORY=$PWD/package + -DSRB2_ASSET_REQUIRED="${SRB2_ASSET_REQUIRED}" -DSRB2_ASSET_OPTIONAL="${SRB2_ASSET_OPTIONAL}" + -DSRB2_ASSET_DOCS="${SRB2_ASSET_DOCS}" + -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 Deployer scripts + - . ../deployer/travis/deployer_ftp.sh + - . ../deployer/travis/deployer_dput.sh diff --git a/CMakeLists.txt b/CMakeLists.txt index 6eb065d04..bc198e81b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,4 +1,6 @@ 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.23 LANGUAGES C) @@ -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 srb2 CACHE STRING "Executable binary output name") +set(SRB2_WIN_EXE_NAME srb2dd CACHE STRING "Executable binary output name for DirectDraw build") include_directories(${CMAKE_CURRENT_BINARY_DIR}/src) @@ -116,8 +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" CACHE STRING "Program name for display purposes") +set(CPACK_PACKAGE_VENDOR "Sonic Team Jr." CACHE STRING "Vendor name for display purposes") #set(CPACK_PACKAGE_DESCRIPTION_FILE ) set(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_CURRENT_SOURCE_DIR}/LICENSE") set(CPACK_PACKAGE_VERSION_MAJOR ${SRB2_VERSION_MAJOR}) diff --git a/assets/.gitignore b/assets/.gitignore index 9ed61ca1a..d6e46a75b 100644 --- a/assets/.gitignore +++ b/assets/.gitignore @@ -1,5 +1,10 @@ -* -*.* +*.srb +*.pk3 +*.dta +*.wad +*.txt !README.txt !LICENSE.txt -!LICENSE-3RD-PARTY.txt \ No newline at end of file +!LICENSE-3RD-PARTY.txt +!CMakeLists.txt +!debian-template/* diff --git a/assets/CMakeLists.txt b/assets/CMakeLists.txt index 6edb3df13..35e018d46 100644 --- a/assets/CMakeLists.txt +++ b/assets/CMakeLists.txt @@ -1,26 +1,44 @@ ## Assets Target Configuration ## -# MD5 generation -set(SRB2_ASSET_ALL - ${CMAKE_CURRENT_SOURCE_DIR}/srb2.srb - ${CMAKE_CURRENT_SOURCE_DIR}/player.dta - ${CMAKE_CURRENT_SOURCE_DIR}/rings.dta - ${CMAKE_CURRENT_SOURCE_DIR}/zones.dta - ${CMAKE_CURRENT_SOURCE_DIR}/patch.dta - ${CMAKE_CURRENT_SOURCE_DIR}/music.dta - ${CMAKE_CURRENT_SOURCE_DIR}/README.txt - ${CMAKE_CURRENT_SOURCE_DIR}/LICENSE.txt - ${CMAKE_CURRENT_SOURCE_DIR}/LICENSE-3RD-PARTY.txt +# For prepending the current source path, later +FUNCTION(PREPEND var prefix) + SET(listVar "") + FOREACH(f ${ARGN}) + LIST(APPEND listVar "${prefix}/${f}") + ENDFOREACH(f) + SET(${var} "${listVar}" PARENT_SCOPE) +ENDFUNCTION(PREPEND) + +set(SRB2_ASSET_REQUIRED +"srb2.srb;\ +player.dta;\ +rings.dta;\ +zones.dta;\ +patch.dta" + CACHE STRING "Required asset files for packaging. No spaces between entries!" ) -set(SRB2_ASSET_HASHED - srb2.srb - player.dta - rings.dta - zones.dta - patch.dta +set(SRB2_ASSET_DOCS +"README.txt;\ +LICENSE.txt;\ +LICENSE-3RD-PARTY.txt" + CACHE STRING "Documentation files; will not fail if they do not exist. Packaged differently from optional assets. No spaces between entries!" ) +set(SRB2_ASSET_OPTIONAL +"music.dta" + CACHE STRING "Optional asset files. No spaces between entries!" +) + +# MD5 generation - Filename only, we don't append path to this +set(SRB2_ASSET_HASHED + ${SRB2_ASSET_REQUIRED} +) + +PREPEND(SRB2_ASSET_REQUIRED ${CMAKE_CURRENT_SOURCE_DIR} ${SRB2_ASSET_REQUIRED}) +PREPEND(SRB2_ASSET_DOCS ${CMAKE_CURRENT_SOURCE_DIR} ${SRB2_ASSET_DOCS}) +PREPEND(SRB2_ASSET_OPTIONAL ${CMAKE_CURRENT_SOURCE_DIR} ${SRB2_ASSET_OPTIONAL}) + foreach(SRB2_ASSET ${SRB2_ASSET_HASHED}) file(MD5 ${CMAKE_CURRENT_SOURCE_DIR}/${SRB2_ASSET} "SRB2_ASSET_${SRB2_ASSET}_HASH") set(SRB2_ASSET_${SRB2_ASSET}_HASH ${SRB2_ASSET_${SRB2_ASSET}_HASH} PARENT_SCOPE) @@ -28,13 +46,29 @@ endforeach() # Installation -if(CLANG) +if(${CMAKE_SYSTEM} MATCHES Darwin) get_target_property(outname SRB2SDL2 OUTPUT_NAME) - install(FILES ${SRB2_ASSET_ALL} + install(FILES ${SRB2_ASSET_REQUIRED} DESTINATION "${outname}.app/Contents/Resources" ) + install(FILES ${SRB2_ASSET_OPTIONAL} + DESTINATION "${outname}.app/Contents/Resources" + OPTIONAL + ) + install(FILES ${SRB2_ASSET_DOCS} + DESTINATION . + OPTIONAL + ) else() - install(FILES ${SRB2_ASSET_ALL} + install(FILES ${SRB2_ASSET_REQUIRED} DESTINATION . ) + install(FILES ${SRB2_ASSET_OPTIONAL} + DESTINATION . + OPTIONAL + ) + install(FILES ${SRB2_ASSET_DOCS} + DESTINATION . + OPTIONAL + ) endif() diff --git a/assets/debian/README.Debian b/assets/debian-template/README.Debian similarity index 59% rename from assets/debian/README.Debian rename to assets/debian-template/README.Debian index 68c952a4e..f3fe90030 100644 --- a/assets/debian/README.Debian +++ b/assets/debian-template/README.Debian @@ -12,9 +12,39 @@ with apt-key add. Thanks! -- Callum Dickinson Fri, 26 Nov 2010 18:25:31 +1300 +--------------- + + +Templating + +Note that you MUST run [repo-root]/debian_template.sh before running debuild +on these scripts! debian_template.sh fills these template files with working values. + +You should also set PACKAGE_NAME_EMAIL="John Doe " to match +the identity of the key you will use to sign the package. + + +Building for Launchpad PPA + +Run this step first: + + 1. source [repo-root]/debian_template.sh + * Initializes defaults for the package variables and fills in templates. + +Use these steps to prepare building a source package for Launchpad: + + 1. cd [repo-root]/assets/ + 2. debuild -T clean-all (optional; if you already have asset files, this clears them) + +Build the source package: + + 1. debuild -T build (this downloads the asset files from srb2.org if necessary) + 2. debuild -S (builds the source package for Launchpad, including the asset files) + + Signing for Launchpad PPA -First, follow the above instructions to generate a GnuPG key with your identity. You will need +First, follow Callum's instructions to generate a GnuPG key with your identity. You will need to publish the fingerprint of that key to Ubuntu's key server. https://help.ubuntu.com/community/GnuPrivacyGuardHowto#Uploading_the_key_to_Ubuntu_keyserver @@ -26,22 +56,18 @@ upload signed source packages and publish them onto your PPA. IF YOU UPLOAD A PACKAGE and Launchpad does NOT send you a confirmation or rejection email, that means your key is not set up correctly with your Launchpad account. +Finally, if your packages have not already been signed, follow these steps: -Building for Launchpad PPA + 1. cd .. + * Packages are located in the parent folder of where debuild was called + 2. debsign "srb2-data_[version]_source.changes" + * You may need to specify -k [key-fingerprint] -Use these steps to prepare building a source package for Launchpad: - 1. Highly recommend copying the assets/ folder to outside your repo folder, or else the asset - files may be included in the main source package, when you build that. - 2. cd [wherever-your-assets-folder-is]/assets/ - 3. debuild -T clean (optional, if you already have asset files) +Uploading for Launchpad PPA -Building the source package is a two-step process: - - 1. debuild -T build (this downloads the asset files from srb2.org if necessary) - 2. debuild -S (builds the source package for Launchpad, including the asset files) - -Then follow the instructions at to upload +Follow the instructions at to upload to your PPA and have Launchpad build your binary deb packages. + -- Marco Zafra Mon, 26 Nov 2018 21:13:00 -0500 diff --git a/assets/debian/README.source b/assets/debian-template/README.source similarity index 100% rename from assets/debian/README.source rename to assets/debian-template/README.source diff --git a/assets/debian-template/changelog b/assets/debian-template/changelog new file mode 100644 index 000000000..64562e2a3 --- /dev/null +++ b/assets/debian-template/changelog @@ -0,0 +1,5 @@ +${PACKAGE_NAME}-data (${PACKAGE_VERSION}${PACKAGE_SUBVERSION}${PACKAGE_REVISION}) ${PACKAGE_DISTRO}; urgency=${PACKAGE_URGENCY} + + * ${PROGRAM_NAME} v${PROGRAM_VERSION} asset data + + -- ${PACKAGE_NAME_EMAIL} ${__PACKAGE_DATETIME} diff --git a/assets/debian/compat b/assets/debian-template/compat similarity index 100% rename from assets/debian/compat rename to assets/debian-template/compat diff --git a/assets/debian/control b/assets/debian-template/control similarity index 84% rename from assets/debian/control rename to assets/debian-template/control index 22d9643ee..ae5c0ce67 100644 --- a/assets/debian/control +++ b/assets/debian-template/control @@ -1,15 +1,15 @@ # SRB2-data Debian package control file. -Source: srb2-data +Source: ${PACKAGE_NAME}-data Section: games Priority: extra -Maintainer: Sonic Team Junior +Maintainer: ${PACKAGE_GROUP_NAME_EMAIL} Build-Depends: debhelper (>= 7.0.50~), wget Standards-Version: 3.8.4 -Homepage: http://www.srb2.org +Homepage: ${PACKAGE_WEBSITE} -Package: srb2-data +Package: ${PACKAGE_NAME}-data Architecture: all Description: A cross-platform 3D Sonic fangame Sonic Robo Blast 2 is a 3D open-source Sonic the Hedgehog diff --git a/debian/copyright b/assets/debian-template/copyright similarity index 57% rename from debian/copyright rename to assets/debian-template/copyright index 97d606b0f..cc47c453b 100644 --- a/debian/copyright +++ b/assets/debian-template/copyright @@ -1,18 +1,18 @@ This work was packaged for Debian by: - Marco Zafra Mon, 26 Nov 2018 14:31:00 -0500 + ${PACKAGE_NAME_EMAIL} ${__PACKAGE_DATETIME} It was downloaded from: - + ${PACKAGE_WEBSITE} Upstream Author(s): - Sonic Team Junior + ${PACKAGE_GROUP_NAME_EMAIL} Copyright: - Copyright (C) 1998-2018 Sonic Team Junior + Copyright (C) 1998-2018 by Sonic Team Junior License: @@ -21,7 +21,7 @@ License: The Debian packaging is: Copyright (C) 2010 Callum Dickinson - Copyright (C) 2010-2018 Sonic Team Junior + Copyright (C) 2010-2018 by Sonic Team Junior and is licensed under the GPL version 2, see "/usr/share/common-licenses/GPL-2". diff --git a/assets/debian/rules b/assets/debian-template/rules old mode 100755 new mode 100644 similarity index 58% rename from assets/debian/rules rename to assets/debian-template/rules index a34a3393f..99a4eaf3c --- 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,9 +47,12 @@ RM := rm -rf DIR := $(shell pwd) PACKAGE := $(shell cat $(DIR)/debian/control | grep 'Package:' | sed -e 's/Package: //g') -DATAFILES := srb2.srb zones.dta player.dta rings.dta music.dta patch.dta README.txt LICENSE.txt LICENSE-3RD-PARTY.txt +DATAFILES := ${ASSET_FILES_REQUIRED} +DOCFILES := ${ASSET_FILES_DOCS} +OPTIONALFILES := ${ASSET_FILES_OPTIONAL} +GETOPTIONALFILES := ${ASSET_FILES_OPTIONAL_GET} -DATADIR := usr/games/SRB2 +DATADIR := $(shell echo "${PACKAGE_INSTALL_PATH}" | sed -e 's/^\///') RESOURCEDIR := . WGET := wget -P $(RESOURCEDIR) -c -nc @@ -49,18 +62,41 @@ build: # This will need to be updated every time SRB2 official version is # Copy data files to their install locations, and add data files to include-binaries for file in $(DATAFILES); do \ - if [ ! -f $(RESOURCEDIR)/$$file ]; then \ - $(WGET) http://alam.srb2.org/SRB2/2.1.21-Final/Resources/$$file; \ + if [ ! -f $(RESOURCEDIR)/${DEBFILEVAR} ]; then \ + $(WGET) ${ASSET_BASE_PATH}/${DEBFILEVAR}; \ fi; \ - if [ -f $(RESOURCEDIR)/$$file ]; then \ - $(INSTALL) $(RESOURCEDIR)/$$file $(DIR)/debian/tmp/$(DATADIR)/$$file; \ - echo $(RESOURCEDIR)/$$file >> $(DIR)/debian/source/include-binaries; \ + if [ -f $(RESOURCEDIR)/${DEBFILEVAR} ]; then \ + $(INSTALL) $(RESOURCEDIR)/${DEBFILEVAR} $(DIR)/debian/tmp/$(DATADIR)/${DEBFILEVAR}; \ + echo $(RESOURCEDIR)/${DEBFILEVAR} >> $(DIR)/debian/source/include-binaries; \ fi; \ - if [ ! -f $(DIR)/debian/tmp/$(DATADIR)/$$file ]; then \ - echo $(DIR)/debian/tmp/$(DATADIR)/$$file not found and could not be downloaded!; \ + if [ ! -f $(DIR)/debian/tmp/$(DATADIR)/${DEBFILEVAR} ]; then \ + echo $(DIR)/debian/tmp/$(DATADIR)/${DEBFILEVAR} not found and could not be downloaded!; \ return 1; \ fi; \ done + # Do the same for DOCFILES, but don't error out if not found + for file in $(DOCFILES); do \ + if [ ! -f $(RESOURCEDIR)/${DEBFILEVAR} ]; then \ + $(WGET) ${ASSET_BASE_PATH}/${DEBFILEVAR}; \ + fi; \ + if [ -f $(RESOURCEDIR)/${DEBFILEVAR} ]; then \ + $(INSTALL) $(RESOURCEDIR)/${DEBFILEVAR} $(DIR)/debian/tmp/$(DATADIR)/${DEBFILEVAR}; \ + echo $(RESOURCEDIR)/${DEBFILEVAR} >> $(DIR)/debian/source/include-binaries; \ + fi; \ + done + # Do the same for OPTIONALFILES if GETOPTIONALFILES == 1 + if [ "$(GETOPTIONALFILES)" = "1" ]; then \ + for file in $(OPTIONALFILES); do \ + if [ ! -f $(RESOURCEDIR)/${DEBFILEVAR} ]; then \ + $(WGET) ${ASSET_BASE_PATH}/${DEBFILEVAR}; \ + fi; \ + if [ -f $(RESOURCEDIR)/${DEBFILEVAR} ]; then \ + $(INSTALL) $(RESOURCEDIR)/${DEBFILEVAR} $(DIR)/debian/tmp/$(DATADIR)/${DEBFILEVAR}; \ + echo $(RESOURCEDIR)/${DEBFILEVAR} >> $(DIR)/debian/source/include-binaries; \ + fi; \ + done; \ + fi; + binary-indep: # Generate install folder file diff --git a/assets/debian/source/format b/assets/debian-template/source/format similarity index 100% rename from assets/debian/source/format rename to assets/debian-template/source/format diff --git a/assets/debian/source/options b/assets/debian-template/source/options similarity index 100% rename from assets/debian/source/options rename to assets/debian-template/source/options diff --git a/assets/debian/changelog b/assets/debian/changelog deleted file mode 100644 index f3a92e1cd..000000000 --- a/assets/debian/changelog +++ /dev/null @@ -1,19 +0,0 @@ -srb2-data (2.1.21~7) trusty; urgency=high - - * Updated for SRB2 v2.1.21 - - -- Marco Zafra Mon, 26 Nov 2018 14:31:00 -0500 - - -srb2-data (2.1.14~1) unstable; urgency=low - - * Updated for SRB2 v2.1.14 - - -- Alam Arias Sat, 6 Jan 2016 11:00:00 -0500 - - -srb2-data (2.0.6-2) maverick; urgency=high - - * Initial proper release.. - - -- Callum Dickinson Sat, 29 Jan 2011 01:18:42 +1300 diff --git a/debian/README.Debian b/debian-template/README.Debian similarity index 62% rename from debian/README.Debian rename to debian-template/README.Debian index 4b724816e..3aa52787e 100644 --- a/debian/README.Debian +++ b/debian-template/README.Debian @@ -10,10 +10,38 @@ and give them to your users to install with apt-key add. Thanks! -- Callum Dickinson Fri, 26 Nov 2010 18:25:31 +1300 +--------------- + + +Templating + +Note that you MUST run [repo-root]/debian_template.sh before running debuild +on these scripts! debian_template.sh fills these template files with working values. + +You should also set PACKAGE_NAME_EMAIL="John Doe " to match +the identity of the key you will use to sign the package. + + +Building for Launchpad PPA + +Use these steps to prepare building a source package for Launchpad: + + 1. cd [repo-root] + 2. git reset --hard; git clean -fd; git clean -fx; + * Resets your repo folder to a committed state and removes untracked files + * If you built srb2-data in the assets/ folder, MAKE SURE THAT FOLDER DOES NOT HAVE ASSETS, + OR THEY MAY BE INCLUDED IN THE MAIN SOURCE PACKAGE! + +Build the source package: + + 1. source [repo-root]/debian_template.sh + * Initializes defaults for the package variables and fills in templates. + 2. debuild -S (builds the source package for Launchpad) + Signing for Launchpad PPA -First, follow the above instructions to generate a GnuPG key with your identity. You will need +First, follow Callum's instructions to generate a GnuPG key with your identity. You will need to publish the fingerprint of that key to Ubuntu's key server. https://help.ubuntu.com/community/GnuPrivacyGuardHowto#Uploading_the_key_to_Ubuntu_keyserver @@ -25,22 +53,18 @@ upload signed source packages and publish them onto your PPA. IF YOU UPLOAD A PACKAGE and Launchpad does NOT send you a confirmation or rejection email, that means your key is not set up correctly with your Launchpad account. +Finally, if your packages have not already been signed, follow these steps: -Building for Launchpad PPA + 1. cd .. + * Packages are located in the parent folder of where debuild was called + 2. debsign "srb2_[version]_source.changes" + * You may need to specify -k [key-fingerprint] -Use these steps to prepare building a source package for Launchpad: - 1. cd [srb2repo] - 2. git reset --hard; git clean -fd; git clean -fx; - * Resets your repo folder to a committed state and removes untracked files - * If you built srb2-data in the assets/ folder, MAKE SURE THAT FOLDER DOES NOT HAVE ASSETS, - OR THEY MAY BE INCLUDED IN THE MAIN SOURCE PACKAGE! +Uploading for Launchpad PPA -Building the source package takes just one step: - - 1. debuild -S (builds the source package for Launchpad) - -Then follow the instructions at to upload +Follow the instructions at to upload to your PPA and have Launchpad build your binary deb packages. + -- Marco Zafra Mon, 26 Nov 2018 21:13:00 -0500 diff --git a/debian/README.source b/debian-template/README.source similarity index 100% rename from debian/README.source rename to debian-template/README.source diff --git a/debian-template/changelog b/debian-template/changelog new file mode 100644 index 000000000..fb08908cd --- /dev/null +++ b/debian-template/changelog @@ -0,0 +1,5 @@ +${PACKAGE_NAME} (${PACKAGE_VERSION}${PACKAGE_SUBVERSION}${PACKAGE_REVISION}) ${PACKAGE_DISTRO}; urgency=${PACKAGE_URGENCY} + + * ${PROGRAM_NAME} v${PROGRAM_VERSION} program build + + -- ${PACKAGE_NAME_EMAIL} ${__PACKAGE_DATETIME} diff --git a/debian/compat b/debian-template/compat similarity index 100% rename from debian/compat rename to debian-template/compat diff --git a/debian/control b/debian-template/control similarity index 65% rename from debian/control rename to debian-template/control index 0f2d8062b..e1348d704 100644 --- a/debian/control +++ b/debian-template/control @@ -1,24 +1,30 @@ # SRB2 Debian package control file. -Source: srb2 +Source: ${PACKAGE_NAME} Section: games Priority: extra -Maintainer: Sonic Team Junior +Maintainer: ${PACKAGE_GROUP_NAME_EMAIL} Build-Depends: debhelper (>= 7.0.50~), libsdl2-dev, libsdl2-mixer-dev, - libpng12-dev (>= 1.2.7) | libpng-dev, + libpng-dev | libpng16-dev | libpng12-dev (>= 1.2.7), zlib1g-dev, libgme-dev, libglu1-dev | libglu-dev, libosmesa6-dev | libgl-dev, nasm [i386] Standards-Version: 3.8.4 -Homepage: http://www.srb2.org +Homepage: ${PACKAGE_WEBSITE} -Package: srb2 +Package: ${PACKAGE_NAME} Architecture: any -Depends: ${shlibs:Depends}, ${misc:Depends}, srb2-data (>= 2.1.15), srb2-data (<= 2.1.23) +Depends: ${SHLIBS_DEPENDS}, ${MISC_DEPENDS}, + ${PACKAGE_NAME}-data (>> ${PACKAGE_ASSET_MINVERSION}), ${PACKAGE_NAME}-data (<< ${PACKAGE_ASSET_MAXVERSION}), + libsdl2-2.0-0, + libsdl2-mixer-2.0-0, + zlib1g, + libgme0, + libpng | libpng16-16 | libpng12-0 Description: A cross-platform 3D Sonic fangame Sonic Robo Blast 2 is a 3D open-source Sonic the Hedgehog fangame built using a modified version of the Doom Legacy @@ -28,10 +34,10 @@ Description: A cross-platform 3D Sonic fangame and quite a lot of the fun that the original Sonic games provided. -Package: srb2-dbg +Package: ${PACKAGE_NAME}-dbg Architecture: any -# FIXME: should be Depends: ${shlibs:Depends}, ${misc:Depends}, srb2-data (= 2.1.14), srb2 but dh_shlibdeps is being an asshat -Depends: libc6, ${misc:Depends}, srb2-data (>= 2.1.15), srb2-data (<= 2.1.23), srb2 +# FIXME: should be Depends: ${SHLIBS_DEPENDS}, ${MISC_DEPENDS}, srb2-data (= 2.1.14), srb2 but dh_shlibdeps is being an asshat +Depends: libc6, ${MISC_DEPENDS}, ${PACKAGE_NAME}-data (>> ${PACKAGE_ASSET_MINVERSION}), ${PACKAGE_NAME}-data (<< ${PACKAGE_ASSET_MAXVERSION}), ${PACKAGE_NAME} Description: A cross-platform 3D Sonic fangame Sonic Robo Blast 2 is a 3D open-source Sonic the Hedgehog fangame built using a modified version of the Doom Legacy diff --git a/assets/debian/copyright b/debian-template/copyright similarity index 57% rename from assets/debian/copyright rename to debian-template/copyright index 97d606b0f..cc47c453b 100644 --- a/assets/debian/copyright +++ b/debian-template/copyright @@ -1,18 +1,18 @@ This work was packaged for Debian by: - Marco Zafra Mon, 26 Nov 2018 14:31:00 -0500 + ${PACKAGE_NAME_EMAIL} ${__PACKAGE_DATETIME} It was downloaded from: - + ${PACKAGE_WEBSITE} Upstream Author(s): - Sonic Team Junior + ${PACKAGE_GROUP_NAME_EMAIL} Copyright: - Copyright (C) 1998-2018 Sonic Team Junior + Copyright (C) 1998-2018 by Sonic Team Junior License: @@ -21,7 +21,7 @@ License: The Debian packaging is: Copyright (C) 2010 Callum Dickinson - Copyright (C) 2010-2018 Sonic Team Junior + Copyright (C) 2010-2018 by Sonic Team Junior and is licensed under the GPL version 2, see "/usr/share/common-licenses/GPL-2". diff --git a/debian/docs b/debian-template/docs similarity index 100% rename from debian/docs rename to debian-template/docs diff --git a/debian/rules b/debian-template/rules old mode 100755 new mode 100644 similarity index 87% rename from debian/rules rename to debian-template/rules index ff80d50bf..0a77624cb --- a/debian/rules +++ b/debian-template/rules @@ -23,6 +23,16 @@ # ############################################################################# +############################################################################# +# +# !!!!!!!!!! DEPLOYER NOTE !!!!!!!!!! +# +# Variables to be templated are curly-braced ${PACKAGE_INSTALL_PATH} +# Variables used by the rules script are parenthese'd $(PKGDIR) +# See [repo-root]/debian_template.sh +# +############################################################################# + # Uncomment this to turn on verbose mode. #export DH_VERBOSE=1 @@ -50,16 +60,16 @@ DIR := $(shell pwd) # FIXME: hate hate hate head/tail hack :( CONTROLF = $(DIR)/debian/control -PACKAGE = srb2 -DBGPKG = $(PACKAGE)-dbg -TITLE = Sonic Robo Blast 2 +PACKAGE = ${PACKAGE_NAME} +DBGPKG = ${PACKAGE}-dbg +TITLE = ${PROGRAM_NAME} SECTION = Games/Action -EXENAME = srb2 +EXENAME = ${PROGRAM_FILENAME} DBGNAME = debug/$(EXENAME) -PKGDIR = usr/games/SRB2 +PKGDIR = $(shell echo "${PACKAGE_INSTALL_PATH}" | sed -e 's/^\///') DBGDIR = usr/lib/debug/$(PKGDIR) -LINKDIR = usr/games +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)") @@ -102,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 diff --git a/debian/source/format b/debian-template/source/format similarity index 100% rename from debian/source/format rename to debian-template/source/format diff --git a/debian/source/options b/debian-template/source/options similarity index 81% rename from debian/source/options rename to debian-template/source/options index 841c65a6f..1ef771ddf 100644 --- a/debian/source/options +++ b/debian-template/source/options @@ -2,7 +2,7 @@ tar-ignore = "assets/*.srb" tar-ignore = "assets/*.pk3" tar-ignore = "assets/*.dta" tar-ignore = "assets/*.wad" -tar-ignore = "assets/debian/srb2-data/*" +tar-ignore = "assets/debian/${PACKAGE_NAME}-data/*" tar-ignore = "assets/debian/tmp/*" tar-ignore = "*.obj" tar-ignore = "*.dep" diff --git a/debian-template/srb2.desktop b/debian-template/srb2.desktop new file mode 100644 index 000000000..07c7906e0 --- /dev/null +++ b/debian-template/srb2.desktop @@ -0,0 +1,10 @@ +[Desktop Entry] +Name=${PROGRAM_NAME} +Comment=${PROGRAM_DESCRIPTION} +Encoding=UTF-8 +Exec=${PACKAGE_INSTALL_PATH}/${PROGRAM_FILENAME} +Icon=/usr/share/pixmaps/${PROGRAM_FILENAME}.png +Terminal=false +Type=Application +StartupNotify=false +Categories=Application;Game; diff --git a/debian/changelog b/debian/changelog deleted file mode 100644 index b06a78e2b..000000000 --- a/debian/changelog +++ /dev/null @@ -1,12 +0,0 @@ -srb2 (2.1.23~9) trusty; urgency=high - - * SRB2 v2.1.23 release - - -- Marco Zafra Mon, 27 Nov 2018 16:45:00 -0500 - - -srb2 (2.0.6-5) maverick; urgency=high - - * Initial proper release.. - - -- Callum Dickinson Sat, 29 Jan 2011 01:18:42 +1300 diff --git a/debian/srb2.desktop b/debian/srb2.desktop deleted file mode 100644 index 3a1cac9f6..000000000 --- a/debian/srb2.desktop +++ /dev/null @@ -1,10 +0,0 @@ -[Desktop Entry] -Name=Sonic Robo Blast 2 -Comment=A free 3D Sonic the Hedgehog fangame closely inspired by the original Sonic games on the Sega Genesis. -Encoding=UTF-8 -Exec=/usr/games/SRB2/srb2 -Icon=/usr/share/pixmaps/srb2.png -Terminal=false -Type=Application -StartupNotify=false -Categories=Application;Game; diff --git a/debian_template.sh b/debian_template.sh new file mode 100644 index 000000000..c1af3c19f --- /dev/null +++ b/debian_template.sh @@ -0,0 +1,166 @@ +#!/bin/bash + +# Deployer for Travis-CI +# Debian package templating +# +# Call this script BEFORE running debuild! +# source ./debian_template.sh [clean] [main/asset] +# +# Before running this script, +# you should also set PACKAGE_NAME_EMAIL="John Doe " to match +# the identity of the key you will use to sign the package. +# + +# Get script's actual path +DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null && pwd )" + +# Recursive function for directory crawling +# $1 = Directory root to crawl +# $2 = Code to eval on file +# $3 = Code to eval on directory +# Exposes $dirtails, $dirlevel, and $dirtailname +dirlevel=0 # initialize +dirtails=() + +# Utility function to make dira/dirb/dirc string +makedirtailname () { + dirtailname="" + for tail in $dirtails; do + if [[ "$dirtailname" == "" ]]; then + dirtailname="/$tail"; + else + dirtailname="$dirtailname/$tail"; + fi; + done; +} + +evaldirectory () { + if [ -d "$1" ]; then + # Set contextual variables + # dirtails is an array of directory basenames after the crawl root + if (( $dirlevel > 0 )); then + dirtails+=( "$(basename $1)" ); + else + dirtails=(); + fi; + dirlevel=$((dirlevel+1)); + + # Generate directory path after the crawl root + makedirtailname; + + # Eval our directory with the latest contextual info + # Don't eval on root + if (( $dirlevel > 1 )) && [[ "$3" != "" ]]; then + eval "$3"; + fi; + + # Iterate entries + for name in $1/*; do + if [ -d "$name" ]; then + # Name is a directory, but don't eval yet + # Recurse so our vars are updated + evaldirectory "$name" "$2" "$3"; + + # Decrement our directory level and remove a dirtail + unset 'dirtails[ ${#dirtails[@]}-1 ]'; + dirlevel=$((dirlevel-1)); + makedirtailname; + else + # Name is a file + if [ -f "$name" ] && [[ "$2" != "" ]]; then + eval "$2"; + fi; + fi; + done; + + # Reset our variables; we're done iterating + if (( $dirlevel == 1 )); then + dirlevel=0; + fi; + fi; +} + +# +# Initialize package parameter defaults +# +if [[ "$__DEBIAN_PARAMETERS_INITIALIZED" != "1" ]]; then + . ${DIR}/deployer/travis/deployer_defaults.sh; +fi; + +# Clean up after ourselves; we only expect to run this script once +# during buildboting +__DEBIAN_PARAMETERS_INITIALIZED=0 + +# for envsubst +export __PACKAGE_DATETIME="$(date '+%a, %d %b %Y %H:%M:%S %z')" +export __PACKAGE_DATETIME_DIGIT="$(date -u '+%Y%m%d%H%M%S')" + +if [[ "$PACKAGE_REVISION" == "" ]]; then + PACKAGE_REVISION="-$__PACKAGE_DATETIME_DIGIT"; + __PACKAGE_REVISION_BY_DATE=1; + export PACKAGE_REVISION=${PACKAGE_REVISION}; # for envsubst +fi; + +# +# Clean the old debian/ directories +# +if [[ "$1" == "clean" ]]; then + toclean=$2; +else + toclean=$1; +fi; + +if [[ "$toclean" == "" ]] || [[ "$toclean" == "main" ]]; then + echo "Cleaning main package scripts"; + if [[ ! -f ${DIR}/debian ]]; then + rm -rf ${DIR}/debian; + fi; +fi; +if [[ "$toclean" == "" ]] || [[ "$toclean" == "asset" ]]; then + echo "Cleaning asset package scripts"; + if [[ ! -f ${DIR}/assets/debian ]]; then + rm -rf ${DIR}/assets/debian; + fi; +fi; + +# +# Make new templates +# +if [[ "$1" != "clean" ]]; then + totemplate=$1; + + # HACK: ${shlibs:Depends} in the templates make the templating fail + # So just define replacemment variables + export SHLIBS_DEPENDS=${SHLIBS_DEPENDS}; + export MISC_DEPENDS=${MISC_DEPENDS}; + export DEBFILEVAR='$$file'; # used in assets/debian/rules + + # Package parameters are exported for envsubst in deployer_defaults.sh + + if [[ "$totemplate" == "" ]] || [[ "$totemplate" == "main" ]]; then + echo "Generating main package scripts"; + fromroot=${DIR}/debian-template; + toroot=${DIR}/debian; + mkdir ${toroot}; + + evaldirectory ${fromroot} \ + "cat \$name | envsubst > ${toroot}\${dirtailname}/\$( basename \$name )" \ + "mkdir \"${toroot}\${dirtailname}\""; + fi; + + if [[ "$totemplate" == "" ]] || [[ "$totemplate" == "asset" ]]; then + echo "Generating asset package scripts"; + fromroot=${DIR}/assets/debian-template; + toroot=${DIR}/assets/debian; + mkdir ${toroot}; + + # Root dir to crawl; file eval; directory eval + evaldirectory ${fromroot} \ + "cat \$name | envsubst > ${toroot}\${dirtailname}/\$( basename \$name )" \ + "mkdir \"${toroot}\${dirtailname}\""; + fi; +fi; + +if [[ "$__DPL_ACTIVE" != "1" ]] && [[ "$__PACKAGE_REVISION_BY_DATE" == "1" ]]; then + unset PACKAGE_REVISION; # so we can reset the date on subsequent runs +fi; diff --git a/deployer/travis/deployer.sh b/deployer/travis/deployer.sh new file mode 100644 index 000000000..c88155d21 --- /dev/null +++ b/deployer/travis/deployer.sh @@ -0,0 +1,157 @@ +#!/bin/bash + +# Deployer for Travis-CI +# Initialization +# +# Performs validity checks to ensure that Deployer is allowed to run +# e.g., is an FTP hostname specified? Are we whitelisted by OSNAMES and BRANCHES? +# +# Set these environment variables in your Travis-CI settings, where they are stored securely. +# See other shell scripts for more options. +# +# DPL_ENABLED = 1 (leave blank to disable) +# DPL_TAG_ENABLED = 1 (run Deployer on all tags) +# DPL_JOB_ENABLE_ALL = 1 (run Deployer on all jobs; leave blank to act on specific jobs, see below) +# DPL_JOBNAMES = name1,name2 (whitelist of job names to allow uploading; leave blank to upload from all jobs) +# DPL_OSNAMES = osx (whitelist of OS names to allow uploading; leave blank to upload from all OSes) +# DPL_BRANCHES = master,branch1,branch2 (whitelist of branches to upload; leave blank to upload all branches) +# +# To enable Deployer on specific jobs, set _DPL_JOB_ENABLED=1 for that job. Example: +# - matrix: +# - os: osx +# env: +# - _DPL_JOB_ENABLED=1 +# +# DO NOT set __DPL_ACTIVE, because that would bypass these validity checks. + +# Validate Deployer state +if [[ "$DPL_ENABLED" == "1" ]] && [[ "$TRAVIS_PULL_REQUEST" == "false" ]]; then + # Test for base eligibility: + # Are we in a deployer branch? Or + # Are we in a release tag AND DPL_TAG_ENABLED=1? + if [[ $TRAVIS_BRANCH == *"deployer"* ]]; then + __DPL_BASE_ELIGIBLE=1; + __DPL_TERMINATE_EARLY_ELIGIBLE=1; + fi; + + if [[ "$TRAVIS_TAG" != "" ]] && [[ "$DPL_TAG_ENABLED" == "1" ]]; then + __DPL_BASE_ELIGIBLE=1; + __DPL_TAG_ELIGIBLE=1; + __DPL_TERMINATE_EARLY_ELIGIBLE=1; + fi; + + # Logging message for trigger word + if [[ "$__DPL_TAG_ELIGIBLE" != "1" ]] && [[ "$DPL_TRIGGER" != "" ]]; then + echo "Testing for trigger $DPL_TRIGGER, commit message: $TRAVIS_COMMIT_MESSAGE"; + echo "[${DPL_TRIGGER}]"; + echo "[${DPL_TRIGGER}-${_DPL_JOB_NAME}]"; + echo "[${DPL_TRIGGER}-${TRAVIS_OS_NAME}]"; + fi; + + # + # Search for the trigger word + # Force enable if release tags are eligible + # + if [[ "$__DPL_TAG_ELIGIBLE" == "1" ]] || [[ "$DPL_TRIGGER" == "" ]] \ + || [[ $TRAVIS_COMMIT_MESSAGE == *"[$DPL_TRIGGER]"* ]] \ + || [[ $TRAVIS_COMMIT_MESSAGE == *"[${DPL_TRIGGER}-${_DPL_JOB_NAME}]"* ]] \ + || [[ $TRAVIS_COMMIT_MESSAGE == *"[${DPL_TRIGGER}-${TRAVIS_OS_NAME}]"* ]]; then + # + # Whitelist by branch name + # Force enable if release tags are eligible + # + if [[ "$__DPL_TAG_ELIGIBLE" == "1" ]] || [[ "$DPL_BRANCHES" == "" ]] || [[ $DPL_BRANCHES == *"$TRAVIS_BRANCH"* ]]; then + # Set this so we only early-terminate builds when we are specifically deploying + # Trigger string and branch are encompassing conditions; the rest are job-specific + # This check only matters for deployer branches and when DPL_TERMINATE_TESTS=1, + # because we're filtering non-deployer jobs. + # + # __DPL_TRY_TERMINATE_EARLY is invalidated in .travis.yml if __DPL_ACTIVE=1 + if [[ "$__DPL_TERMINATE_EARLY_ELIGIBLE" == "1" ]] && [[ "$DPL_TERMINATE_TESTS" == "1" ]]; then + __DPL_TRY_TERMINATE_EARLY=1; + fi; + + # + # Is the job enabled for deployment? + # + if [[ "$DPL_JOB_ENABLE_ALL" == "1" ]] || [[ "$_DPL_JOB_ENABLED" == "1" ]]; then + # + # Whitelist by job names + # + if [[ "$DPL_JOBNAMES" == "" ]] || [[ "$_DPL_JOB_NAME" == "" ]] || [[ $DPL_JOBNAMES == *"$_DPL_JOB_NAME"* ]]; then + # + # Whitelist by OS names + # + if [[ "$DPL_OSNAMES" == "" ]] || [[ $DPL_OSNAMES == *"$TRAVIS_OS_NAME"* ]]; then + # Base Deployer is eligible for becoming active + + # Are we building for Linux? + if [[ "$_DPL_PACKAGE_BINARY" == "1" ]] || [[ "$_DPL_PACKAGE_SOURCE" == "1" ]]; then + if [[ "$_DPL_PACKAGE_MAIN" == "1" ]] || [[ "$_DPL_PACKAGE_ASSET" == "1" ]]; then + if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then + __DPL_DEBIAN_ACTIVE=1; + fi; + fi; + fi; + + # Now check for deployment targets + if [[ "$_DPL_FTP_TARGET" == "1" ]] && [[ "$DPL_FTP_HOSTNAME" != "" ]]; then + if [[ "$TRAVIS_OS_HOST" == "linux" ]] && [[ "$DPL_FTP_PROTOCOL" == "ftp" ]]; then + echo "Non-secure FTP will not work on Linux Travis-CI jobs!"; + echo "Try SFTP or another target. Details:"; + echo "https://blog.travis-ci.com/2018-07-23-the-tale-of-ftp-at-travis-ci"; + else + if [[ "$__DPL_DEBIAN_ACTIVE" == "1" ]] || [[ "$_DPL_PACKAGE_BINARY" == "1" ]] || [[ "$_DPL_BINARY" == "1" ]]; then + echo "Deployer FTP target is enabled"; + __DPL_FTP_ACTIVE=1; + else + echo "Deployer FTP target cannot be enabled: You must specify _DPL_PACKAGE_BINARY=1,"; + echo "and/or _DPL_BINARY=1 in your job's environment variables."; + fi; + fi; + fi; + + if [[ "$_DPL_DPUT_TARGET" == "1" ]] && [[ "$__DPL_DEBIAN_ACTIVE" == "1" ]] \ + && [[ "$DPL_DPUT_INCOMING" != "" ]]; then + if [[ "$DPL_DPUT_METHOD" == "ftp" ]]; then + echo "DPUT will not work with non-secure FTP on Linux Travis-CI jobs!"; + echo "Try SFTP or another method for DPUT. Details:"; + echo "https://blog.travis-ci.com/2018-07-23-the-tale-of-ftp-at-travis-ci"; + else + echo "Deployer DPUT target is enabled"; + __DPL_DPUT_ACTIVE=1; + fi; + fi; + + # If any deployment targets are active, then so is the Deployer at large + if [[ "$__DPL_FTP_ACTIVE" == "1" ]] || [[ "$__DPL_DPUT_ACTIVE" == "1" ]]; then + __DPL_ACTIVE=1; + fi; + fi; + fi; + fi; + fi; + else + if [[ "$DPL_TRIGGER" != "" ]]; then + echo "Testing for global trigger [$DPL_TRIGGER, commit message: $TRAVIS_COMMIT_MESSAGE"; + fi; + if [[ "$DPL_TRIGGER" != "" ]] && [[ $TRAVIS_COMMIT_MESSAGE == *"[$DPL_TRIGGER"* ]]; then + if [[ "$__DPL_TAG_ELIGIBLE" == "1" ]] || [[ "$DPL_BRANCHES" == "" ]] || [[ $DPL_BRANCHES == *"$TRAVIS_BRANCH"* ]]; then + # This check only matters for deployer branches and when DPL_TERMINATE_TESTS=1, + # because we're filtering non-deployer jobs. + if [[ "$__DPL_TERMINATE_EARLY_ELIGIBLE" == "1" ]] && [[ "$DPL_TERMINATE_TESTS" == "1" ]]; then + # Assume that some job received the trigger, so mark this for early termination + __DPL_TRY_TERMINATE_EARLY=1; + fi; + fi; + fi; + fi; +fi; + +if [[ "$__DPL_TRY_TERMINATE_EARLY" == "1" ]] && [[ "$__DPL_ACTIVE" != "1" ]]; then + echo "Deployer is active in another job"; +fi; + +if [[ "$__DPL_TRY_TERMINATE_EARLY" != "1" ]] && [[ "$__DPL_ACTIVE" != "1" ]]; then + echo "Deployer is not active"; +fi; diff --git a/deployer/travis/deployer_build.sh b/deployer/travis/deployer_build.sh new file mode 100644 index 000000000..3817f025d --- /dev/null +++ b/deployer/travis/deployer_build.sh @@ -0,0 +1,190 @@ +#!/bin/bash + +# Deployer for Travis-CI +# Build Script +# +# Builds the required targets depending on which sub-modules are enabled + +if [[ "$__DPL_FTP_ACTIVE" == "1" ]] || [[ "$__DPL_DPUT_ACTIVE" == "1" ]]; then + if [[ "$__DPL_DEBIAN_ACTIVE" == "1" ]]; then + echo "Building Debian package(s)" + + sudo apt-get install devscripts debhelper fakeroot secure-delete expect; + + # Build source packages first, since they zip up the entire source folder, + # binaries and all + if [[ "$_DPL_PACKAGE_MAIN" == "1" ]]; then + . ../debian_template.sh main; + OLDPWD=$PWD; # [repo]/build + cd ..; # repo root + + if [[ "$_DPL_PACKAGE_SOURCE" == "1" ]]; then + echo "Building main source Debian package"; + expect <(cat < key.asc; + echo "$DPL_PGP_KEY_PASSPHRASE" > phrase.txt; + gpg --import key.asc; + + if [[ "$_DPL_PACKAGE_MAIN" == "1" ]]; then + echo "Signing main package(s)"; + + PACKAGEFILENAME=${PACKAGE_NAME}_${PACKAGE_VERSION}${PACKAGE_SUBVERSION}${PACKAGE_REVISION}; + PACKAGEDBGFILENAME=${PACKAGE_NAME}-dbg_${PACKAGE_VERSION}${PACKAGE_SUBVERSION}${PACKAGE_REVISION}; + #PACKAGENIGHTLYFILENAME=${PACKAGE_NAME}-nightly_${PACKAGE_VERSION}${PACKAGE_SUBVERSION}${PACKAGE_REVISION}; + #PACKAGENIGHTLYDBGFILENAME=${PACKAGE_NAME}-nightly-dbg_${PACKAGE_VERSION}${PACKAGE_SUBVERSION}${PACKAGE_REVISION}; + #PACKAGEPATCHFILENAME=${PACKAGE_NAME}-patch_${PACKAGE_VERSION}${PACKAGE_SUBVERSION}${PACKAGE_REVISION}; + #PACKAGEPATCHDBGFILENAME=${PACKAGE_NAME}-patch-dbg_${PACKAGE_VERSION}${PACKAGE_SUBVERSION}${PACKAGE_REVISION}; + #PACKAGEPATCHNIGHTLYFILENAME=${PACKAGE_NAME}-patch-nightly_${PACKAGE_VERSION}${PACKAGE_SUBVERSION}${PACKAGE_REVISION}; + #PACKAGEPATCHNIGHTLYDBGFILENAME=${PACKAGE_NAME}-patch-nightly-dbg_${PACKAGE_VERSION}${PACKAGE_SUBVERSION}${PACKAGE_REVISION}; + + PACKAGEFILENAMES=( + $PACKAGEFILENAME + $PACKAGEDBGFILENAME + #$PACKAGENIGHTLYFILENAME + #$PACKAGENIGHTLYDBGFILENAME + #$PACKAGEPATCHFILENAME + #$PACKAGEPATCHDBGFILENAME + #$PACKAGEPATCHNIGHTLYFILENAME + #$PACKAGEPATCHNIGHTLYDBGFILENAME + ); + + # Main packages are in parent of root repo folder + OLDPWD=$PWD; # [repo]/build + cd ../..; # parent of repo root + + for n in ${PACKAGEFILENAMES}; do + for f in ./$n*.changes; do + debsign --no-re-sign -p"gpg --passphrase-file $OLDPWD/phrase.txt --batch" "$f"; + done; + done; + + cd $OLDPWD; + fi; + + if [[ "$_DPL_PACKAGE_ASSET" == "1" ]]; then + echo "Signing asset package(s)"; + + PACKAGEFILENAME=${PACKAGE_NAME}-data_${PACKAGE_VERSION}${PACKAGE_SUBVERSION}${PACKAGE_REVISION}; + #PACKAGENIGHTLYFILENAME=${PACKAGE_NAME}-nightly-data_${PACKAGE_VERSION}${PACKAGE_SUBVERSION}${PACKAGE_REVISION}; + #PACKAGEPATCHFILENAME=${PACKAGE_NAME}-patch-data_${PACKAGE_VERSION}${PACKAGE_SUBVERSION}${PACKAGE_REVISION}; + #PACKAGEPATCHNIGHTLYFILENAME=${PACKAGE_NAME}-patch-nightly-data_${PACKAGE_VERSION}${PACKAGE_SUBVERSION}${PACKAGE_REVISION}; + + PACKAGEFILENAMES=( + $PACKAGEFILENAME + #$PACKAGENIGHTLYFILENAME + #$PACKAGEPATCHFILENAME + #$PACKAGEPATCHNIGHTLYFILENAME + ) + + # Asset packages are in root repo folder + OLDPWD=$PWD; # [repo]/build + cd ..; # repo root + + for n in ${PACKAGEFILENAMES}; do + for f in ./$n*.changes; do + debsign --no-re-sign -p"gpg --passphrase-file $OLDPWD/phrase.txt --batch" "$f"; + done; + done; + + cd $OLDPWD; + fi; + + # Delete the keys :eyes: + srm key.asc; + srm phrase.txt; + fi; + fi; + + # all other OSes + if [[ "$TRAVIS_OS_NAME" != "linux" ]]; then + # + # Check for binary building + # + if [[ "$_DPL_BINARY" == "1" ]]; then + echo "Building a Binary"; + make -k; + fi; + + # + # Check for package building + # + if [[ "$_DPL_PACKAGE_BINARY" == "1" ]]; then + echo "Building a Package"; + + # Make an OSX package; superuser is required for library bundling + # + # HACK: OSX packaging can't write libraries to .app package unless we're superuser + # because the original library files don't have WRITE permission + # Bug may be sidestepped by using CHMOD_BUNDLE_ITEMS=TRUE + # But I don't know where this is set. Not `cmake -D...` because this var is ignored. + # https://cmake.org/Bug/view.php?id=9284 + if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then + sudo make -k package; + else + # Some day, when Windows is supported, we'll just make a standard package + make -k package; + fi; + fi; + fi; +fi; diff --git a/deployer/travis/deployer_defaults.sh b/deployer/travis/deployer_defaults.sh new file mode 100644 index 000000000..9716c31cb --- /dev/null +++ b/deployer/travis/deployer_defaults.sh @@ -0,0 +1,107 @@ +#!/bin/bash + +# Deployer for Travis-CI +# Default Variables +# +# Here are all of the user-set variables used by Deployer. +# See the "Cross-platform deployment" page on SRB2 Wiki for documentation. + +# Core Parameters +: ${DPL_ENABLED} # Enable Deployer behavior; must be set for any deployment activity +: ${DPL_TAG_ENABLED} # Trigger Deployer for all tag releases +: ${DPL_JOB_ENABLE_ALL} # Enable all jobs for deployment +: ${DPL_TERMINATE_TESTS} # Terminate all build test jobs (used in .travis.yml) +: ${DPL_TRIGGER} # Use a [word] in the commit message to trigger Deployer +: ${DPL_JOBNAMES} # Trigger Deployer by job name +: ${DPL_OSNAMES} # Trigger Deployer by OS name (osx,linux) +: ${DPL_BRANCHES} # Trigger Deployer by git branch name + +# Job Parameters +: ${_DPL_JOB_ENABLED} # Enable Deployer for this specific job. DPL_ENABLED must be set too. +: ${_DPL_JOB_NAME} # Identifier for the job, used for logging and trigger word matching +: ${_DPL_FTP_TARGET} # Deploy to FTP +: ${_DPL_DPUT_TARGET} # Deploy to DPUT +: ${_DPL_PACKAGE_SOURCE} # Build packages into a Source distribution. Linux only. +: ${_DPL_PACKAGE_BINARY} # Build packages into a Binary distribution. +: ${_DPL_PACKAGE_MAIN:=1} # Build main installation package. Linux only; OS X assumes this. +: ${_DPL_PACKAGE_ASSET} # Build asset installation package. Linux only. + +# Asset File Parameters +: ${ASSET_ARCHIVE_PATH:=https://github.com/mazmazz/SRB2/releases/download/SRB2_assets/SRB2-v2122-assets.7z} +: ${ASSET_BASE_PATH:=https://github.com/mazmazz/SRB2/releases/download/SRB2_assets} +: ${ASSET_FILES_REQUIRED:=srb2.srb zones.dta player.dta rings.dta patch.dta} +: ${ASSET_FILES_DOCS:=README.txt LICENSE.txt LICENSE-3RD-PARTY.txt} +: ${ASSET_FILES_OPTIONAL:=music.dta} +: ${ASSET_FILES_OPTIONAL_GET:=0} + +# FTP Parameters +: ${DPL_FTP_PROTOCOL} +: ${DPL_FTP_USER} +: ${DPL_FTP_PASS} +: ${DPL_FTP_HOSTNAME} +: ${DPL_FTP_PORT} +: ${DPL_FTP_PATH} + +# DPUT Parameters +: ${DPL_DPUT_DOMAIN:=ppa.launchpad.net} +: ${DPL_DPUT_METHOD:=sftp} +: ${DPL_DPUT_INCOMING} +: ${DPL_DPUT_LOGIN:=anonymous} +: ${DPL_SSH_KEY_PRIVATE} # Base64-encoded private key file. Used to sign repository uploads +: ${DPL_SSH_KEY_PASSPHRASE} # Decodes the private key file. + +# Package Parameters +: ${PACKAGE_NAME:=srb2} +: ${PACKAGE_VERSION:=2.1.23} +: ${PACKAGE_SUBVERSION} # Highly recommended to set this to reflect the distro series target (e.g., ~18.04bionic) +: ${PACKAGE_REVISION} # Defaults to UTC timestamp +: ${PACKAGE_INSTALL_PATH:=/usr/games/SRB2} +: ${PACKAGE_LINK_PATH:=/usr/games} +: ${PACKAGE_DISTRO:=trusty} +: ${PACKAGE_URGENCY:=high} +: ${PACKAGE_NAME_EMAIL:=Sonic Team Junior } +: ${PACKAGE_GROUP_NAME_EMAIL:=Sonic Team Junior } +: ${PACKAGE_WEBSITE:=} + +: ${PACKAGE_ASSET_MINVERSION:=2.1.21} # Number this the version BEFORE the actual required version, because we do a > check +: ${PACKAGE_ASSET_MAXVERSION:=2.1.24} # Number this the version AFTER the actual required version, because we do a < check + +: ${PROGRAM_NAME:=Sonic Robo Blast 2} +: ${PROGRAM_VENDOR:=Sonic Team Junior} +: ${PROGRAM_VERSION:=2.1.23} +: ${PROGRAM_DESCRIPTION:=A free 3D Sonic the Hedgehog fangame closely inspired by the original Sonic games on the Sega Genesis.} +: ${PROGRAM_FILENAME:=srb2} + +: ${DPL_PGP_KEY_PRIVATE} # Base64-encoded private key file. Used to sign Debian packages +: ${DPL_PGP_KEY_PASSPHRASE} # Decodes the private key file. + +# Export Asset and Package Parameters for envsubst templating + +export ASSET_ARCHIVE_PATH="${ASSET_ARCHIVE_PATH}" +export ASSET_BASE_PATH="${ASSET_BASE_PATH}" +export ASSET_FILES_REQUIRED="${ASSET_FILES_REQUIRED}" +export ASSET_FILES_DOCS="${ASSET_FILES_DOCS}" +export ASSET_FILES_OPTIONAL="${ASSET_FILES_OPTIONAL}" +export ASSET_FILES_OPTIONAL_GET="${ASSET_FILES_OPTIONAL_GET}" + +export PACKAGE_NAME="${PACKAGE_NAME}" +export PACKAGE_VERSION="${PACKAGE_VERSION}" +export PACKAGE_SUBVERSION="${PACKAGE_SUBVERSION}" # in case we have this +export PACKAGE_REVISION="${PACKAGE_REVISION}" +export PACKAGE_ASSET_MINVERSION="${PACKAGE_ASSET_MINVERSION}" +export PACKAGE_ASSET_MAXVERSION="${PACKAGE_ASSET_MAXVERSION}" +export PACKAGE_INSTALL_PATH="${PACKAGE_INSTALL_PATH}" +export PACKAGE_LINK_PATH="${PACKAGE_LINK_PATH}" +export PACKAGE_DISTRO="${PACKAGE_DISTRO}" +export PACKAGE_URGENCY="${PACKAGE_URGENCY}" +export PACKAGE_NAME_EMAIL="${PACKAGE_NAME_EMAIL}" +export PACKAGE_GROUP_NAME_EMAIL="${PACKAGE_GROUP_NAME_EMAIL}" +export PACKAGE_WEBSITE="${PACKAGE_WEBSITE}" + +export PROGRAM_NAME="${PROGRAM_NAME}" +export PROGRAM_VERSION="${PROGRAM_VERSION}" +export PROGRAM_DESCRIPTION="${PROGRAM_DESCRIPTION}" +export PROGRAM_FILENAME="${PROGRAM_FILENAME}" + +# This file is called in debian_template.sh, so mark our completion so we don't run it again +__DEBIAN_PARAMETERS_INITIALIZED=1 diff --git a/deployer/travis/deployer_dput.sh b/deployer/travis/deployer_dput.sh new file mode 100644 index 000000000..863a928cd --- /dev/null +++ b/deployer/travis/deployer_dput.sh @@ -0,0 +1,133 @@ +#!/bin/bash + +# Deployer for Travis-CI +# DPUT uploader (e.g., Launchpad PPA) +# + +if [[ "$__DPL_DPUT_ACTIVE" == "1" ]]; then + # Install APT dependencies + # paramiko required for ssh + sudo apt-get install python-paramiko expect dput; # python-pip + #pip install paramiko; + + # Output the DPUT config + # Dput only works if you're using secure FTP, so that's what we default to. + cat > "./dput.cf" << EOM +[deployer] +fqdn = ${DPL_DPUT_DOMAIN} +method = ${DPL_DPUT_METHOD} +incoming = ${DPL_DPUT_INCOMING} +login = ${DPL_DPUT_LOGIN} +allow_unsigned_uploads = 0 +EOM + + # Output SSH config + # Don't let SSH prompt us for untrusted hosts + cat >> "./ssh_config" << EOM + +Host * + StrictHostKeyChecking no + UserKnownHostsFile=/dev/null + PubKeyAuthentication yes + IdentityFile ${PWD}/key.private + IdentitiesOnly yes +EOM + sudo sh -c "cat < ${PWD}/ssh_config >> /etc/ssh/ssh_config"; + + # Get the private key + echo "$DPL_SSH_KEY_PRIVATE" | base64 --decode > key.private; + chmod 700 ./key.private; + + if [[ "$_DPL_PACKAGE_MAIN" == "1" ]]; then + PACKAGEFILENAME=${PACKAGE_NAME}_${PACKAGE_VERSION}${PACKAGE_SUBVERSION}${PACKAGE_REVISION}; + PACKAGEDBGFILENAME=${PACKAGE_NAME}-dbg_${PACKAGE_VERSION}${PACKAGE_SUBVERSION}${PACKAGE_REVISION}; + #PACKAGENIGHTLYFILENAME=${PACKAGE_NAME}-nightly_${PACKAGE_VERSION}${PACKAGE_SUBVERSION}${PACKAGE_REVISION}; + #PACKAGENIGHTLYDBGFILENAME=${PACKAGE_NAME}-nightly-dbg_${PACKAGE_VERSION}${PACKAGE_SUBVERSION}${PACKAGE_REVISION}; + #PACKAGEPATCHFILENAME=${PACKAGE_NAME}-patch_${PACKAGE_VERSION}${PACKAGE_SUBVERSION}${PACKAGE_REVISION}; + #PACKAGEPATCHDBGFILENAME=${PACKAGE_NAME}-patch-dbg_${PACKAGE_VERSION}${PACKAGE_SUBVERSION}${PACKAGE_REVISION}; + #PACKAGEPATCHNIGHTLYFILENAME=${PACKAGE_NAME}-patch-nightly_${PACKAGE_VERSION}${PACKAGE_SUBVERSION}${PACKAGE_REVISION}; + #PACKAGEPATCHNIGHTLYDBGFILENAME=${PACKAGE_NAME}-patch-nightly-dbg_${PACKAGE_VERSION}${PACKAGE_SUBVERSION}${PACKAGE_REVISION}; + + PACKAGEFILENAMES=( + $PACKAGEFILENAME + $PACKAGEDBGFILENAME + #$PACKAGENIGHTLYFILENAME + #$PACKAGENIGHTLYDBGFILENAME + #$PACKAGEPATCHFILENAME + #$PACKAGEPATCHDBGFILENAME + #$PACKAGEPATCHNIGHTLYFILENAME + #$PACKAGEPATCHNIGHTLYDBGFILENAME + ); + + # Main packages are in parent of root repo folder + OLDPWD=$PWD; # [repo]/build + cd ../..; + + # Enter passphrase if required + for n in ${PACKAGEFILENAMES}; do + for f in $n*.changes; do + # Binary builds also generate source builds, so exclude the source + # builds if desired + if [[ "$_DPL_PACKAGE_SOURCE" != "1" ]]; then + if [[ "$f" == *"_source"* ]] || [[ "$f" == *".tar.xz"* ]]; then + continue; + fi; + fi; + + expect <(cat < "commit.txt"; + echo "Job ID $TRAVIS_JOB_ID" >> "commit.txt"; + echo "" >> "commit.txt"; + echo "Commit $TRAVIS_COMMIT" >> "commit.txt"; + echo "$TRAVIS_COMMIT_MESSAGE" >> "commit.txt"; + echo "" >> "commit.txt"; + + # Initialize FTP parameters + if [[ "$DPL_FTP_PORT" == "" ]]; then + DPL_FTP_PORT=21; + fi; + if [[ "$DPL_FTP_PROTOCOL" == "" ]]; then + DPL_FTP_PROTOCOL=ftp; + fi; + __DPL_FTP_LOCATION=$DPL_FTP_PROTOCOL://$DPL_FTP_HOSTNAME:$DPL_FTP_PORT/$DPL_FTP_PATH/$TRAVIS_REPO_SLUG/$TRAVIS_BRANCH/$TRAVIS_JOB_ID-$TRAVIS_JOB_NUMBER-$JOBNAME; + + # Upload to FTP! + echo "Uploading to FTP..."; + curl --ftp-create-dirs -T "commit.txt" -u $DPL_FTP_USER:$DPL_FTP_PASS "$__DPL_FTP_LOCATION/commit.txt"; + + if [[ "$__DPL_DEBIAN_ACTIVE" == "1" ]]; then + if [[ "$_DPL_PACKAGE_MAIN" == "1" ]]; then + PACKAGEFILENAME=${PACKAGE_NAME}_${PACKAGE_VERSION}${PACKAGE_SUBVERSION}${PACKAGE_REVISION}; + PACKAGEDBGFILENAME=${PACKAGE_NAME}-dbg_${PACKAGE_VERSION}${PACKAGE_SUBVERSION}${PACKAGE_REVISION}; + #PACKAGENIGHTLYFILENAME=${PACKAGE_NAME}-nightly_${PACKAGE_VERSION}${PACKAGE_SUBVERSION}${PACKAGE_REVISION}; + #PACKAGENIGHTLYDBGFILENAME=${PACKAGE_NAME}-nightly-dbg_${PACKAGE_VERSION}${PACKAGE_SUBVERSION}${PACKAGE_REVISION}; + #PACKAGEPATCHFILENAME=${PACKAGE_NAME}-patch_${PACKAGE_VERSION}${PACKAGE_SUBVERSION}${PACKAGE_REVISION}; + #PACKAGEPATCHDBGFILENAME=${PACKAGE_NAME}-patch-dbg_${PACKAGE_VERSION}${PACKAGE_SUBVERSION}${PACKAGE_REVISION}; + #PACKAGEPATCHNIGHTLYFILENAME=${PACKAGE_NAME}-patch-nightly_${PACKAGE_VERSION}${PACKAGE_SUBVERSION}${PACKAGE_REVISION}; + #PACKAGEPATCHNIGHTLYDBGFILENAME=${PACKAGE_NAME}-patch-nightly-dbg_${PACKAGE_VERSION}${PACKAGE_SUBVERSION}${PACKAGE_REVISION}; + + PACKAGEFILENAMES=( + $PACKAGEFILENAME + $PACKAGEDBGFILENAME + #$PACKAGENIGHTLYFILENAME + #$PACKAGENIGHTLYDBGFILENAME + #$PACKAGEPATCHFILENAME + #$PACKAGEPATCHDBGFILENAME + #$PACKAGEPATCHNIGHTLYFILENAME + #$PACKAGEPATCHNIGHTLYDBGFILENAME + ); + + # Main packages are in parent of root repo folder + OLDPWD=$PWD; # [repo]/build + cd ../..; + + for n in ${PACKAGEFILENAMES}; do + for f in ./$n*; do + # Binary builds also generate source builds, so exclude the source + # builds if desired + if [[ "$_DPL_PACKAGE_SOURCE" != "1" ]]; then + if [[ "$f" == *"_source"* ]] || [[ "$f" == *".tar.xz"* ]]; then + continue; + fi; + fi; + curl --ftp-create-dirs -T "$f" -u $DPL_FTP_USER:$DPL_FTP_PASS "$__DPL_FTP_LOCATION/package/main/$f"; + done; + done; + + # Go back to [repo]/build folder + cd $OLDPWD; + fi; + + if [[ "$_DPL_PACKAGE_ASSET" == "1" ]]; then + PACKAGEFILENAME=${PACKAGE_NAME}-data_${PACKAGE_VERSION}${PACKAGE_SUBVERSION}${PACKAGE_REVISION}; + #PACKAGENIGHTLYFILENAME=${PACKAGE_NAME}-nightly-data_${PACKAGE_VERSION}${PACKAGE_SUBVERSION}${PACKAGE_REVISION}; + #PACKAGEPATCHFILENAME=${PACKAGE_NAME}-patch-data_${PACKAGE_VERSION}${PACKAGE_SUBVERSION}${PACKAGE_REVISION}; + #PACKAGEPATCHNIGHTLYFILENAME=${PACKAGE_NAME}-patch-nightly-data_${PACKAGE_VERSION}${PACKAGE_SUBVERSION}${PACKAGE_REVISION}; + + PACKAGEFILENAMES=( + $PACKAGEFILENAME + #$PACKAGENIGHTLYFILENAME + #$PACKAGEPATCHFILENAME + #$PACKAGEPATCHNIGHTLYFILENAME + ) + + # Asset packages are in root repo folder + OLDPWD=$PWD; # [repo]/build + cd ..; + + for n in ${PACKAGEFILENAMES}; do + for f in ./$n*; do + # Binary builds also generate source builds, so exclude the source + # builds if desired + if [[ "$_DPL_PACKAGE_SOURCE" != "1" ]]; then + if [[ "$f" == *"_source"* ]] || [[ "$f" == *".tar.xz"* ]]; then + continue; + fi; + fi; + curl --ftp-create-dirs -T "$f" -u $DPL_FTP_USER:$DPL_FTP_PASS "$__DPL_FTP_LOCATION/package/asset/$f"; + done; + done; + + # Go back to [repo]/build folder + cd $OLDPWD; + fi; + else + if [[ "$_DPL_BINARY" == "1" ]]; then + find bin -type f -exec curl -u $DPL_FTP_USER:$DPL_FTP_PASS --ftp-create-dirs -T {} $__DPL_FTP_LOCATION/{} \;; + fi; + + if [[ "$_DPL_PACKAGE_BINARY" == "1" ]]; then + sudo rm -r package/_CPack_Packages + find package -type f -exec curl -u $DPL_FTP_USER:$DPL_FTP_PASS --ftp-create-dirs -T {} $__DPL_FTP_LOCATION/{} \;; + fi; + fi; +fi diff --git a/src/sdl/CMakeLists.txt b/src/sdl/CMakeLists.txt index f7b7c7ba4..ec5d63ac7 100644 --- a/src/sdl/CMakeLists.txt +++ b/src/sdl/CMakeLists.txt @@ -150,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} @@ -334,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 )" From 4d4b048eade5fc051100819b74dd714bb5054e5f Mon Sep 17 00:00:00 2001 From: mazmazz Date: Mon, 31 Dec 2018 17:09:59 -0500 Subject: [PATCH 02/56] Don't download individual asset files; support only archives --- .travis.yml | 53 ++++++++-------------------- assets/CMakeLists.txt | 46 ++++++++---------------- assets/debian-template/rules | 52 ++++++++------------------- deployer/travis/deployer_defaults.sh | 10 +++--- 4 files changed, 47 insertions(+), 114 deletions(-) diff --git a/.travis.yml b/.travis.yml index 9d5774293..6e5c9fc0d 100644 --- a/.travis.yml +++ b/.travis.yml @@ -593,8 +593,10 @@ install: before_script: # OLDPWD is root repo folder - OLDPWD=$PWD + - mkdir -p "$OLDPWD/assets/installer" - 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"; @@ -608,52 +610,25 @@ before_script: 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"$HOME/srb2_cache" -aos; - for f in $ASSET_FILES_REQUIRED; do - cp "$HOME/srb2_cache/$f" "$OLDPWD/assets/$f"; - done; + 7z x "$(basename $ASSET_ARCHIVE_PATH)" -o"$OLDPWD/assets/installer" -aos; fi; - # Get individual required files - - for f in $ASSET_FILES_REQUIRED; do - if [ -f "$f" ]; then - echo "$f cache date -- $($STATCMD $f)"; - fi; - wget --verbose --server-response -N "$ASSET_BASE_PATH/$f"; - if [ ! -f "$HOME/srb2_cache/$f" ]; then - echo "Could not download \"$ASSET_BASE_PATH/$f\""; - return 1; - fi; - cp "$HOME/srb2_cache/$f" "$OLDPWD/assets/$f"; - done; - - # Get the docs - - for f in $ASSET_FILES_DOCS; do - if [ -f "$f" ]; then - echo "$f cache date -- $($STATCMD $f)"; - fi; - wget --verbose --server-response -N "$ASSET_BASE_PATH/$f"; - cp "$HOME/srb2_cache/$f" "$OLDPWD/assets/$f"; - done; - # Get optional files too - - if [[ "$ASSET_FILES_OPTIONAL_GET" == "1" ]]; then - for f in $ASSET_FILES_OPTIONAL; do - if [ -f "$f" ]; then - echo "$f cache date -- $($STATCMD $f)"; - fi; - wget --verbose --server-response -N "$ASSET_BASE_PATH/$f"; - cp "$HOME/srb2_cache/$f" "$OLDPWD/assets/$f"; - done; + - if [[ "$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"$OLDPWD/assets/installer" -aos; fi; - # Go back to root repo folder + # Copy assets to repo staging folder, then go back to root repo folder - cd "$OLDPWD" # Prepare CMake asset lists - - SRB2_ASSET_REQUIRED=$(echo ${ASSET_FILES_REQUIRED// /\;}) - - SRB2_ASSET_OPTIONAL=$(echo ${ASSET_FILES_OPTIONAL// /\;}) + - SRB2_ASSET_HASHED=$(echo ${ASSET_FILES_HASHED// /\;}) - SRB2_ASSET_DOCS=$(echo ${ASSET_FILES_DOCS// /\;}) + - SRB2_ASSET_DIRECTORY="$OLDPWD/assets/installer" # Prepare CMake - mkdir build @@ -662,8 +637,8 @@ before_script: - export CFLAGS="-Wall -W -Werror $WFLAGS" - export CCACHE_COMPRESS=true - cmake .. -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=$PWD/bin -DCPACK_PACKAGE_DIRECTORY=$PWD/package - -DSRB2_ASSET_REQUIRED="${SRB2_ASSET_REQUIRED}" -DSRB2_ASSET_OPTIONAL="${SRB2_ASSET_OPTIONAL}" - -DSRB2_ASSET_DOCS="${SRB2_ASSET_DOCS}" + -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}" diff --git a/assets/CMakeLists.txt b/assets/CMakeLists.txt index 35e018d46..68ff0fdf9 100644 --- a/assets/CMakeLists.txt +++ b/assets/CMakeLists.txt @@ -9,38 +9,29 @@ FUNCTION(PREPEND var prefix) SET(${var} "${listVar}" PARENT_SCOPE) ENDFUNCTION(PREPEND) -set(SRB2_ASSET_REQUIRED +set(SRB2_ASSET_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/installer" + CACHE STRING "Path to directory that contains all asset files for the installer.") + +set(SRB2_ASSET_HASHED "srb2.srb;\ player.dta;\ rings.dta;\ zones.dta;\ patch.dta" - CACHE STRING "Required asset files for packaging. No spaces between entries!" + CACHE STRING "Asset filenames to apply MD5 checks. No spaces between entries!" ) set(SRB2_ASSET_DOCS "README.txt;\ LICENSE.txt;\ LICENSE-3RD-PARTY.txt" - CACHE STRING "Documentation files; will not fail if they do not exist. Packaged differently from optional assets. No spaces between entries!" + CACHE STRING "Documentation filenames. In OS X, these are packaged separately from other assets. No spaces between entries!" ) -set(SRB2_ASSET_OPTIONAL -"music.dta" - CACHE STRING "Optional asset files. No spaces between entries!" -) - -# MD5 generation - Filename only, we don't append path to this -set(SRB2_ASSET_HASHED - ${SRB2_ASSET_REQUIRED} -) - -PREPEND(SRB2_ASSET_REQUIRED ${CMAKE_CURRENT_SOURCE_DIR} ${SRB2_ASSET_REQUIRED}) -PREPEND(SRB2_ASSET_DOCS ${CMAKE_CURRENT_SOURCE_DIR} ${SRB2_ASSET_DOCS}) -PREPEND(SRB2_ASSET_OPTIONAL ${CMAKE_CURRENT_SOURCE_DIR} ${SRB2_ASSET_OPTIONAL}) +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() @@ -48,27 +39,20 @@ endforeach() if(${CMAKE_SYSTEM} MATCHES Darwin) get_target_property(outname SRB2SDL2 OUTPUT_NAME) - install(FILES ${SRB2_ASSET_REQUIRED} + install(DIRECTORY "${SRB2_ASSET_DIRECTORY}/" DESTINATION "${outname}.app/Contents/Resources" ) - install(FILES ${SRB2_ASSET_OPTIONAL} - DESTINATION "${outname}.app/Contents/Resources" - OPTIONAL - ) install(FILES ${SRB2_ASSET_DOCS} DESTINATION . OPTIONAL ) else() - install(FILES ${SRB2_ASSET_REQUIRED} + install(DIRECTORY "${SRB2_ASSET_DIRECTORY}/" DESTINATION . ) - install(FILES ${SRB2_ASSET_OPTIONAL} - DESTINATION . - OPTIONAL - ) - install(FILES ${SRB2_ASSET_DOCS} - DESTINATION . - OPTIONAL - ) + # Docs are assumed to be located in SRB2_ASSET_DIRECTORY, so don't install again + #install(FILES ${SRB2_ASSET_DOCS} + # DESTINATION . + # OPTIONAL + #) endif() diff --git a/assets/debian-template/rules b/assets/debian-template/rules index 99a4eaf3c..c2d19922d 100644 --- a/assets/debian-template/rules +++ b/assets/debian-template/rules @@ -47,55 +47,31 @@ RM := rm -rf DIR := $(shell pwd) PACKAGE := $(shell cat $(DIR)/debian/control | grep 'Package:' | sed -e 's/Package: //g') -DATAFILES := ${ASSET_FILES_REQUIRED} -DOCFILES := ${ASSET_FILES_DOCS} -OPTIONALFILES := ${ASSET_FILES_OPTIONAL} +ARCHIVEPATH := ${ASSET_ARCHIVE_PATH} +ARCHIVEOPTIONALPATH := ${ASSET_ARCHIVE_OPTIONAL_PATH} GETOPTIONALFILES := ${ASSET_FILES_OPTIONAL_GET} DATADIR := $(shell echo "${PACKAGE_INSTALL_PATH}" | sed -e 's/^\///') RESOURCEDIR := . +STAGINGDIR := $(RESOURCEDIR)/installer WGET := wget -P $(RESOURCEDIR) -c -nc build: $(MKDIR) $(DIR)/debian/tmp/$(DATADIR) > $(DIR)/debian/source/include-binaries - # This will need to be updated every time SRB2 official version is # Copy data files to their install locations, and add data files to include-binaries - for file in $(DATAFILES); do \ - if [ ! -f $(RESOURCEDIR)/${DEBFILEVAR} ]; then \ - $(WGET) ${ASSET_BASE_PATH}/${DEBFILEVAR}; \ + if [ ! -d $(STAGINGDIR) ]; then \ + mkdir -p "$(STAGINGDIR)"; \ + $(WGET) $(ARCHIVEPATH); \ + 7z x "$(RESOURCEDIR)/$(shell basename $(ARCHIVEPATH))" -aos; \ + if [ "$(GETOPTIONALFILES)" = "1" ]; then \ + $(WGET) $(ARCHIVEOPTIONALPATH); \ + 7z x "$(RESOURCEDIR)/$(shell basename $(ARCHIVEOPTIONALPATH))" -aos; \ fi; \ - if [ -f $(RESOURCEDIR)/${DEBFILEVAR} ]; then \ - $(INSTALL) $(RESOURCEDIR)/${DEBFILEVAR} $(DIR)/debian/tmp/$(DATADIR)/${DEBFILEVAR}; \ - echo $(RESOURCEDIR)/${DEBFILEVAR} >> $(DIR)/debian/source/include-binaries; \ - fi; \ - if [ ! -f $(DIR)/debian/tmp/$(DATADIR)/${DEBFILEVAR} ]; then \ - echo $(DIR)/debian/tmp/$(DATADIR)/${DEBFILEVAR} not found and could not be downloaded!; \ - return 1; \ - fi; \ - done - # Do the same for DOCFILES, but don't error out if not found - for file in $(DOCFILES); do \ - if [ ! -f $(RESOURCEDIR)/${DEBFILEVAR} ]; then \ - $(WGET) ${ASSET_BASE_PATH}/${DEBFILEVAR}; \ - fi; \ - if [ -f $(RESOURCEDIR)/${DEBFILEVAR} ]; then \ - $(INSTALL) $(RESOURCEDIR)/${DEBFILEVAR} $(DIR)/debian/tmp/$(DATADIR)/${DEBFILEVAR}; \ - echo $(RESOURCEDIR)/${DEBFILEVAR} >> $(DIR)/debian/source/include-binaries; \ - fi; \ - done - # Do the same for OPTIONALFILES if GETOPTIONALFILES == 1 - if [ "$(GETOPTIONALFILES)" = "1" ]; then \ - for file in $(OPTIONALFILES); do \ - if [ ! -f $(RESOURCEDIR)/${DEBFILEVAR} ]; then \ - $(WGET) ${ASSET_BASE_PATH}/${DEBFILEVAR}; \ - fi; \ - if [ -f $(RESOURCEDIR)/${DEBFILEVAR} ]; then \ - $(INSTALL) $(RESOURCEDIR)/${DEBFILEVAR} $(DIR)/debian/tmp/$(DATADIR)/${DEBFILEVAR}; \ - echo $(RESOURCEDIR)/${DEBFILEVAR} >> $(DIR)/debian/source/include-binaries; \ - fi; \ - done; \ - fi; + 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: diff --git a/deployer/travis/deployer_defaults.sh b/deployer/travis/deployer_defaults.sh index 9716c31cb..bccb7409a 100644 --- a/deployer/travis/deployer_defaults.sh +++ b/deployer/travis/deployer_defaults.sh @@ -28,10 +28,9 @@ # Asset File Parameters : ${ASSET_ARCHIVE_PATH:=https://github.com/mazmazz/SRB2/releases/download/SRB2_assets/SRB2-v2122-assets.7z} -: ${ASSET_BASE_PATH:=https://github.com/mazmazz/SRB2/releases/download/SRB2_assets} -: ${ASSET_FILES_REQUIRED:=srb2.srb zones.dta player.dta rings.dta patch.dta} +: ${ASSET_ARCHIVE_OPTIONAL_PATH:=https://github.com/mazmazz/SRB2/releases/download/SRB2_assets/SRB2-v2122-optional-assets.7z} +: ${ASSET_FILES_HASHED:=srb2.srb zones.dta player.dta rings.dta patch.dta} : ${ASSET_FILES_DOCS:=README.txt LICENSE.txt LICENSE-3RD-PARTY.txt} -: ${ASSET_FILES_OPTIONAL:=music.dta} : ${ASSET_FILES_OPTIONAL_GET:=0} # FTP Parameters @@ -78,10 +77,9 @@ # Export Asset and Package Parameters for envsubst templating export ASSET_ARCHIVE_PATH="${ASSET_ARCHIVE_PATH}" -export ASSET_BASE_PATH="${ASSET_BASE_PATH}" -export ASSET_FILES_REQUIRED="${ASSET_FILES_REQUIRED}" +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="${ASSET_FILES_OPTIONAL}" export ASSET_FILES_OPTIONAL_GET="${ASSET_FILES_OPTIONAL_GET}" export PACKAGE_NAME="${PACKAGE_NAME}" From e765b9400cf741eb8aaa72768ef677769ee5c12b Mon Sep 17 00:00:00 2001 From: Jimita the Cat Date: Wed, 2 Jan 2019 00:41:52 -0300 Subject: [PATCH 03/56] Add support for flashpals in screenshots --- src/hardware/hw_draw.c | 9 +++-- src/hardware/hw_main.h | 5 +-- src/m_misc.c | 74 +++++++++++++++++++++++++----------------- src/m_misc.h | 2 +- src/st_stuff.c | 2 +- src/st_stuff.h | 1 + 6 files changed, 56 insertions(+), 37 deletions(-) diff --git a/src/hardware/hw_draw.c b/src/hardware/hw_draw.c index 55bbde459..bccb0ee82 100644 --- a/src/hardware/hw_draw.c +++ b/src/hardware/hw_draw.c @@ -1082,21 +1082,24 @@ UINT8 *HWR_GetScreenshot(void) return buf; } -boolean HWR_Screenshot(const char *lbmname) +boolean HWR_Screenshot(const char *pathname, char **error) { boolean ret; UINT8 *buf = malloc(vid.width * vid.height * 3 * sizeof (*buf)); if (!buf) + { + *error = "Failed to allocate memory for HWR_Screenshot"; return false; + } // returns 24bit 888 RGB HWD.pfnReadRect(0, 0, vid.width, vid.height, vid.width * 3, (void *)buf); #ifdef USE_PNG - ret = M_SavePNG(lbmname, buf, vid.width, vid.height, NULL); + ret = M_SavePNG(pathname, buf, vid.width, vid.height, NULL, &*error); // c_irl #else - ret = saveTGA(lbmname, buf, vid.width, vid.height); + ret = saveTGA(pathname, buf, vid.width, vid.height); #endif free(buf); return ret; diff --git a/src/hardware/hw_main.h b/src/hardware/hw_main.h index 59042cf3b..cf9f2232c 100644 --- a/src/hardware/hw_main.h +++ b/src/hardware/hw_main.h @@ -38,8 +38,6 @@ void HWR_RenderSkyboxView(INT32 viewnumber, player_t *player); void HWR_RenderPlayerView(INT32 viewnumber, player_t *player); void HWR_DrawViewBorder(INT32 clearlines); void HWR_DrawFlatFill(INT32 x, INT32 y, INT32 w, INT32 h, lumpnum_t flatlumpnum); -UINT8 *HWR_GetScreenshot(void); -boolean HWR_Screenshot(const char *lbmname); void HWR_InitTextureMapping(void); void HWR_SetViewSize(void); void HWR_DrawPatch(GLPatch_t *gpatch, INT32 x, INT32 y, INT32 option); @@ -54,6 +52,9 @@ void HWR_DrawFill(INT32 x, INT32 y, INT32 w, INT32 h, INT32 color); void HWR_DrawConsoleFill(INT32 x, INT32 y, INT32 w, INT32 h, UINT32 color, INT32 options); // Lat: separate flags from color since color needs to be an uint to work right. void HWR_DrawPic(INT32 x,INT32 y,lumpnum_t lumpnum); +UINT8 *HWR_GetScreenshot(void); +boolean HWR_Screenshot(const char *pathname, char **error); + void HWR_AddCommands(void); void HWR_CorrectSWTricks(void); void transform(float *cx, float *cy, float *cz); diff --git a/src/m_misc.c b/src/m_misc.c index 7dd0d822c..7b60caff1 100644 --- a/src/m_misc.c +++ b/src/m_misc.c @@ -30,6 +30,7 @@ #include "g_game.h" #include "m_misc.h" #include "hu_stuff.h" +#include "st_stuff.h" #include "v_video.h" #include "z_zone.h" #include "g_input.h" @@ -585,6 +586,21 @@ void M_SaveConfig(const char *filename) fclose(f); } +// ========================================================================== +// SCREENSHOTS +// ========================================================================== +static UINT8 screenshot_palette[768]; +static void M_CreateScreenShotPalette(void) +{ + size_t i, j; + for (i = 0, j = 0; i < 768; i += 3, j++) + { + RGBA_t locpal = pLocalPalette[(max(st_palette,0)*256)+j]; + screenshot_palette[i] = locpal.s.red; + screenshot_palette[i+1] = locpal.s.green; + screenshot_palette[i+2] = locpal.s.blue; + } +} #if NUMSCREENS > 2 static const char *Newsnapshotfile(const char *pathname, const char *ext) @@ -1047,6 +1063,7 @@ static boolean M_SetupaPNG(png_const_charp filename, png_bytep pal) static inline moviemode_t M_StartMovieAPNG(const char *pathname) { #ifdef USE_APNG + UINT8 *palette; const char *freename = NULL; boolean ret = false; @@ -1062,10 +1079,8 @@ static inline moviemode_t M_StartMovieAPNG(const char *pathname) return MM_OFF; } - if (rendermode == render_soft) - ret = M_SetupaPNG(va(pandf,pathname,freename), W_CacheLumpName(GetPalette(), PU_CACHE)); - else - ret = M_SetupaPNG(va(pandf,pathname,freename), NULL); + if (rendermode == render_soft) M_CreateScreenShotPalette(); + ret = M_SetupaPNG(va(pandf,pathname,freename), (palette = screenshot_palette)); if (!ret) { @@ -1268,10 +1283,11 @@ void M_StopMovie(void) * \param data The image data. * \param width Width of the picture. * \param height Height of the picture. - * \param palette Palette of image data + * \param palette Palette of image data. * \note if palette is NULL, BGR888 format + * \param error Error string to return, if screenshot failed. */ -boolean M_SavePNG(const char *filename, void *data, int width, int height, const UINT8 *palette) +boolean M_SavePNG(const char *filename, void *data, int width, int height, const UINT8 *palette, char **error) { png_structp png_ptr; png_infop png_info_ptr; @@ -1286,15 +1302,14 @@ boolean M_SavePNG(const char *filename, void *data, int width, int height, const png_FILE = fopen(filename,"wb"); if (!png_FILE) { - CONS_Debug(DBG_RENDER, "M_SavePNG: Error on opening %s for write\n", filename); + *error = "Failed to open file for write"; return false; } - png_ptr = png_create_write_struct(PNG_LIBPNG_VER_STRING, NULL, - PNG_error, PNG_warn); + png_ptr = png_create_write_struct(PNG_LIBPNG_VER_STRING, NULL, PNG_error, PNG_warn); if (!png_ptr) { - CONS_Debug(DBG_RENDER, "M_SavePNG: Error on initialize libpng\n"); + *error = "Failed to initialize libpng"; fclose(png_FILE); remove(filename); return false; @@ -1303,7 +1318,7 @@ boolean M_SavePNG(const char *filename, void *data, int width, int height, const png_info_ptr = png_create_info_struct(png_ptr); if (!png_info_ptr) { - CONS_Debug(DBG_RENDER, "M_SavePNG: Error on allocate for libpng\n"); + *error = "Failed to allocate memory for libpng"; png_destroy_write_struct(&png_ptr, NULL); fclose(png_FILE); remove(filename); @@ -1316,7 +1331,7 @@ boolean M_SavePNG(const char *filename, void *data, int width, int height, const if (setjmp(png_jmpbuf(png_ptr))) #endif { - //CONS_Debug(DBG_RENDER, "libpng write error on %s\n", filename); + *error = "libpng write error"; png_destroy_write_struct(&png_ptr, &png_info_ptr); fclose(png_FILE); remove(filename); @@ -1445,9 +1460,8 @@ void M_ScreenShot(void) } /** Takes a screenshot. - * The screenshot is saved as "srb2xxxx.pcx" (or "srb2xxxx.tga" in hardware - * rendermode) where xxxx is the lowest four-digit number for which a file - * does not already exist. + * The screenshot is saved as "srb2xxxx.png" where xxxx is the lowest + * four-digit number for which a file does not already exist. * * \sa HWR_ScreenShot */ @@ -1456,11 +1470,16 @@ void M_DoScreenShot(void) #if NUMSCREENS > 2 const char *freename = NULL, *pathname = "."; boolean ret = false; + char *error = "Unknown error"; UINT8 *linear = NULL; // Don't take multiple screenshots, obviously takescreenshot = false; + // how does one take a screenshot without a render system? + if (rendermode == render_none) + return; + if (cv_screenshot_option.value == 0) pathname = usehome ? srb2home : srb2path; else if (cv_screenshot_option.value == 1) @@ -1471,16 +1490,13 @@ void M_DoScreenShot(void) pathname = cv_screenshot_folder.string; #ifdef USE_PNG - if (rendermode != render_none) - freename = Newsnapshotfile(pathname,"png"); + freename = Newsnapshotfile(pathname,"png"); #else if (rendermode == render_soft) freename = Newsnapshotfile(pathname,"pcx"); - else if (rendermode != render_none) + else if (rendermode == render_opengl) freename = Newsnapshotfile(pathname,"tga"); #endif - else - I_Error("Can't take a screenshot without a render system"); if (rendermode == render_soft) { @@ -1494,18 +1510,16 @@ void M_DoScreenShot(void) // save the pcx file #ifdef HWRENDER - if (rendermode != render_soft) - ret = HWR_Screenshot(va(pandf,pathname,freename)); + if (rendermode == render_opengl) + ret = HWR_Screenshot(va(pandf,pathname,freename), &error); else #endif - if (rendermode != render_none) { + M_CreateScreenShotPalette(); #ifdef USE_PNG - ret = M_SavePNG(va(pandf,pathname,freename), linear, vid.width, vid.height, - W_CacheLumpName(GetPalette(), PU_CACHE)); + ret = M_SavePNG(va(pandf,pathname,freename), linear, vid.width, vid.height, screenshot_palette, &error); #else - ret = WritePCXfile(va(pandf,pathname,freename), linear, vid.width, vid.height, - W_CacheLumpName(GetPalette(), PU_CACHE)); + ret = WritePCXfile(va(pandf,pathname,freename), linear, vid.width, vid.height, screenshot_palette); #endif } @@ -1513,14 +1527,14 @@ failure: if (ret) { if (moviemode != MM_SCREENSHOT) - CONS_Printf(M_GetText("screen shot %s saved in %s\n"), freename, pathname); + CONS_Printf(M_GetText("Screen shot %s saved in %s\n"), freename, pathname); } else { if (freename) - CONS_Printf(M_GetText("Couldn't create screen shot %s in %s\n"), freename, pathname); + CONS_Alert(CONS_ERROR, M_GetText("Couldn't create screen shot %s in %s (%s)\n"), freename, pathname, error); else - CONS_Printf(M_GetText("Couldn't create screen shot (all 10000 slots used!) in %s\n"), pathname); + CONS_Alert(CONS_ERROR, M_GetText("Couldn't create screen shot in %s (all 10000 slots used!)\n"), pathname); if (moviemode == MM_SCREENSHOT) M_StopMovie(); diff --git a/src/m_misc.h b/src/m_misc.h index 7dd8baabf..cb4af3927 100644 --- a/src/m_misc.h +++ b/src/m_misc.h @@ -64,7 +64,7 @@ void FIL_ForceExtension(char *path, const char *extension); boolean FIL_CheckExtension(const char *in); #ifdef HAVE_PNG -boolean M_SavePNG(const char *filename, void *data, int width, int height, const UINT8 *palette); +boolean M_SavePNG(const char *filename, void *data, int width, int height, const UINT8 *palette, char **error); #endif extern boolean takescreenshot; diff --git a/src/st_stuff.c b/src/st_stuff.c index 1f8dbbf61..287aea134 100644 --- a/src/st_stuff.c +++ b/src/st_stuff.c @@ -197,7 +197,7 @@ void ST_Ticker(void) } // 0 is default, any others are special palettes. -static INT32 st_palette = 0; +INT32 st_palette = 0; void ST_doPaletteStuff(void) { diff --git a/src/st_stuff.h b/src/st_stuff.h index 6c4140ce3..6f05bbf3e 100644 --- a/src/st_stuff.h +++ b/src/st_stuff.h @@ -58,6 +58,7 @@ boolean ST_SameTeam(player_t *a, player_t *b); //-------------------- extern boolean st_overlay; // sb overlay on or off when fullscreen +extern INT32 st_palette; // 0 is default, any others are special palettes. extern lumpnum_t st_borderpatchnum; // patches, also used in intermission From 892e65071281e1aa2bd6158748120cf4b7cd81c2 Mon Sep 17 00:00:00 2001 From: Jimita the Cat Date: Wed, 2 Jan 2019 01:01:57 -0300 Subject: [PATCH 04/56] dumb --- src/hardware/hw_draw.c | 6 +++--- src/hardware/hw_main.h | 2 +- src/m_misc.c | 18 ++++++++---------- src/m_misc.h | 2 +- 4 files changed, 13 insertions(+), 15 deletions(-) diff --git a/src/hardware/hw_draw.c b/src/hardware/hw_draw.c index bccb0ee82..cd2c95237 100644 --- a/src/hardware/hw_draw.c +++ b/src/hardware/hw_draw.c @@ -1082,14 +1082,14 @@ UINT8 *HWR_GetScreenshot(void) return buf; } -boolean HWR_Screenshot(const char *pathname, char **error) +boolean HWR_Screenshot(const char *pathname) { boolean ret; UINT8 *buf = malloc(vid.width * vid.height * 3 * sizeof (*buf)); if (!buf) { - *error = "Failed to allocate memory for HWR_Screenshot"; + CONS_Debug(DBG_RENDER, "HWR_Screenshot: Failed to allocate memory\n"); return false; } @@ -1097,7 +1097,7 @@ boolean HWR_Screenshot(const char *pathname, char **error) HWD.pfnReadRect(0, 0, vid.width, vid.height, vid.width * 3, (void *)buf); #ifdef USE_PNG - ret = M_SavePNG(pathname, buf, vid.width, vid.height, NULL, &*error); // c_irl + ret = M_SavePNG(pathname, buf, vid.width, vid.height, NULL); #else ret = saveTGA(pathname, buf, vid.width, vid.height); #endif diff --git a/src/hardware/hw_main.h b/src/hardware/hw_main.h index cf9f2232c..929544ec1 100644 --- a/src/hardware/hw_main.h +++ b/src/hardware/hw_main.h @@ -53,7 +53,7 @@ void HWR_DrawConsoleFill(INT32 x, INT32 y, INT32 w, INT32 h, UINT32 color, INT32 void HWR_DrawPic(INT32 x,INT32 y,lumpnum_t lumpnum); UINT8 *HWR_GetScreenshot(void); -boolean HWR_Screenshot(const char *pathname, char **error); +boolean HWR_Screenshot(const char *pathname); void HWR_AddCommands(void); void HWR_CorrectSWTricks(void); diff --git a/src/m_misc.c b/src/m_misc.c index 7b60caff1..88ae3b86a 100644 --- a/src/m_misc.c +++ b/src/m_misc.c @@ -1285,9 +1285,8 @@ void M_StopMovie(void) * \param height Height of the picture. * \param palette Palette of image data. * \note if palette is NULL, BGR888 format - * \param error Error string to return, if screenshot failed. */ -boolean M_SavePNG(const char *filename, void *data, int width, int height, const UINT8 *palette, char **error) +boolean M_SavePNG(const char *filename, void *data, int width, int height, const UINT8 *palette) { png_structp png_ptr; png_infop png_info_ptr; @@ -1302,14 +1301,14 @@ boolean M_SavePNG(const char *filename, void *data, int width, int height, const png_FILE = fopen(filename,"wb"); if (!png_FILE) { - *error = "Failed to open file for write"; + CONS_Debug(DBG_RENDER, "M_SavePNG: Error on opening %s for write\n", filename); return false; } png_ptr = png_create_write_struct(PNG_LIBPNG_VER_STRING, NULL, PNG_error, PNG_warn); if (!png_ptr) { - *error = "Failed to initialize libpng"; + CONS_Debug(DBG_RENDER, "M_SavePNG: Error on initialize libpng\n"); fclose(png_FILE); remove(filename); return false; @@ -1318,7 +1317,7 @@ boolean M_SavePNG(const char *filename, void *data, int width, int height, const png_info_ptr = png_create_info_struct(png_ptr); if (!png_info_ptr) { - *error = "Failed to allocate memory for libpng"; + CONS_Debug(DBG_RENDER, "M_SavePNG: Error on allocate for libpng\n"); png_destroy_write_struct(&png_ptr, NULL); fclose(png_FILE); remove(filename); @@ -1331,7 +1330,7 @@ boolean M_SavePNG(const char *filename, void *data, int width, int height, const if (setjmp(png_jmpbuf(png_ptr))) #endif { - *error = "libpng write error"; + //CONS_Debug(DBG_RENDER, "libpng write error on %s\n", filename); png_destroy_write_struct(&png_ptr, &png_info_ptr); fclose(png_FILE); remove(filename); @@ -1470,7 +1469,6 @@ void M_DoScreenShot(void) #if NUMSCREENS > 2 const char *freename = NULL, *pathname = "."; boolean ret = false; - char *error = "Unknown error"; UINT8 *linear = NULL; // Don't take multiple screenshots, obviously @@ -1511,13 +1509,13 @@ void M_DoScreenShot(void) // save the pcx file #ifdef HWRENDER if (rendermode == render_opengl) - ret = HWR_Screenshot(va(pandf,pathname,freename), &error); + ret = HWR_Screenshot(va(pandf,pathname,freename)); else #endif { M_CreateScreenShotPalette(); #ifdef USE_PNG - ret = M_SavePNG(va(pandf,pathname,freename), linear, vid.width, vid.height, screenshot_palette, &error); + ret = M_SavePNG(va(pandf,pathname,freename), linear, vid.width, vid.height, screenshot_palette); #else ret = WritePCXfile(va(pandf,pathname,freename), linear, vid.width, vid.height, screenshot_palette); #endif @@ -1532,7 +1530,7 @@ failure: else { if (freename) - CONS_Alert(CONS_ERROR, M_GetText("Couldn't create screen shot %s in %s (%s)\n"), freename, pathname, error); + CONS_Alert(CONS_ERROR, M_GetText("Couldn't create screen shot %s in %s\n"), freename, pathname); else CONS_Alert(CONS_ERROR, M_GetText("Couldn't create screen shot in %s (all 10000 slots used!)\n"), pathname); diff --git a/src/m_misc.h b/src/m_misc.h index cb4af3927..7dd8baabf 100644 --- a/src/m_misc.h +++ b/src/m_misc.h @@ -64,7 +64,7 @@ void FIL_ForceExtension(char *path, const char *extension); boolean FIL_CheckExtension(const char *in); #ifdef HAVE_PNG -boolean M_SavePNG(const char *filename, void *data, int width, int height, const UINT8 *palette, char **error); +boolean M_SavePNG(const char *filename, void *data, int width, int height, const UINT8 *palette); #endif extern boolean takescreenshot; From 9b3174c4f43dc5ddb8969ba8ff11174545b8454b Mon Sep 17 00:00:00 2001 From: mazmazz Date: Wed, 2 Jan 2019 18:19:44 -0500 Subject: [PATCH 05/56] Correct asset directory for travis --- .travis.yml | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/.travis.yml b/.travis.yml index 6e5c9fc0d..d0bc064fe 100644 --- a/.travis.yml +++ b/.travis.yml @@ -593,7 +593,8 @@ install: before_script: # OLDPWD is root repo folder - OLDPWD=$PWD - - mkdir -p "$OLDPWD/assets/installer" + - __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. @@ -610,7 +611,7 @@ before_script: 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"$OLDPWD/assets/installer" -aos; + 7z x "$(basename $ASSET_ARCHIVE_PATH)" -o"$__ASSET_DIRECTORY" -aos; fi; # Get optional files too @@ -619,16 +620,16 @@ before_script: 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"$OLDPWD/assets/installer" -aos; + 7z x "$(basename $ASSET_ARCHIVE_OPTIONAL_PATH)" -o"$__ASSET_DIRECTORY" -aos; fi; - # Copy assets to repo staging folder, then go back to root repo folder + # 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="$OLDPWD/assets/installer" + - SRB2_ASSET_DIRECTORY="$__ASSET_DIRECTORY" # Prepare CMake - mkdir build From ac7b29eb2db79bb2d0ab762e5123c75bf4ca0499 Mon Sep 17 00:00:00 2001 From: mazmazz Date: Wed, 2 Jan 2019 20:48:00 -0500 Subject: [PATCH 06/56] Add __DPL_ACTIVE condition to optional asset download --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index d0bc064fe..b87650f6a 100644 --- a/.travis.yml +++ b/.travis.yml @@ -615,7 +615,7 @@ before_script: fi; # Get optional files too - - if [[ "$ASSET_FILES_OPTIONAL_GET" == "1" ]] && [[ "$ASSET_ARCHIVE_OPTIONAL_PATH" != "" ]]; then + - 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; From 88c4a54cea71097e918593907477e2353c7efaaf Mon Sep 17 00:00:00 2001 From: Marco Z Date: Fri, 4 Jan 2019 20:25:41 -0500 Subject: [PATCH 07/56] Add GME to VC10 SRB2SDL project --- libs/libgme.props | 16 ++++++++++++++++ src/sdl/Srb2SDL-vc10.vcxproj | 1 + src/sdl/Srb2SDL.props | 2 +- 3 files changed, 18 insertions(+), 1 deletion(-) create mode 100644 libs/libgme.props diff --git a/libs/libgme.props b/libs/libgme.props new file mode 100644 index 000000000..d530eac75 --- /dev/null +++ b/libs/libgme.props @@ -0,0 +1,16 @@ + + + + + + $(SolutionDir)libs\gme\include;$(IncludePath) + $(SolutionDir)libs\gme\win32;$(LibraryPath) + $(SolutionDir)libs\gme\win64;$(LibraryPath) + + + + libgme.dll.a;%(AdditionalDependencies) + + + + \ No newline at end of file diff --git a/src/sdl/Srb2SDL-vc10.vcxproj b/src/sdl/Srb2SDL-vc10.vcxproj index 04af6a8e1..3b764996d 100644 --- a/src/sdl/Srb2SDL-vc10.vcxproj +++ b/src/sdl/Srb2SDL-vc10.vcxproj @@ -93,6 +93,7 @@ + diff --git a/src/sdl/Srb2SDL.props b/src/sdl/Srb2SDL.props index 260f81eed..cba6d1642 100644 --- a/src/sdl/Srb2SDL.props +++ b/src/sdl/Srb2SDL.props @@ -5,7 +5,7 @@ - USE_WGL_SWAP;DIRECTFULLSCREEN;HAVE_SDL;HWRENDER;HW3SOUND;HAVE_FILTER;HAVE_MIXER;SDLMAIN;%(PreprocessorDefinitions) + USE_WGL_SWAP;DIRECTFULLSCREEN;HAVE_SDL;HWRENDER;HW3SOUND;HAVE_FILTER;HAVE_MIXER;HAVE_LIBGME;HAVE_ZLIB;SDLMAIN;%(PreprocessorDefinitions) From 09ed8bd04621ec3e93fdaf9968676b0b01665120 Mon Sep 17 00:00:00 2001 From: Marco Z Date: Fri, 4 Jan 2019 20:38:03 -0500 Subject: [PATCH 08/56] Add LibGME to DD vc10 project --- src/win32/Srb2win-vc10.vcxproj | 1 + src/win32/Srb2win.props | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/src/win32/Srb2win-vc10.vcxproj b/src/win32/Srb2win-vc10.vcxproj index ca73b1293..f74cf3c16 100644 --- a/src/win32/Srb2win-vc10.vcxproj +++ b/src/win32/Srb2win-vc10.vcxproj @@ -91,6 +91,7 @@ + diff --git a/src/win32/Srb2win.props b/src/win32/Srb2win.props index 44a30d50d..ea12ffb28 100644 --- a/src/win32/Srb2win.props +++ b/src/win32/Srb2win.props @@ -5,7 +5,7 @@ - _WINDOWS;%(PreprocessorDefinitions) + _WINDOWS;HAVE_LIBGME;HAVE_ZLIB;%(PreprocessorDefinitions) From 882355d24b4b1c570480395043ac311fda77a848 Mon Sep 17 00:00:00 2001 From: Marco Z Date: Fri, 4 Jan 2019 21:18:55 -0500 Subject: [PATCH 09/56] Specify HAVE_LIBGME, paths, and depends only for Win32/x64 MSVC --- libs/libgme.props | 4 ++-- src/sdl/Srb2SDL.props | 5 ++++- src/win32/Srb2win.props | 5 ++++- 3 files changed, 10 insertions(+), 4 deletions(-) diff --git a/libs/libgme.props b/libs/libgme.props index d530eac75..209f6b9a8 100644 --- a/libs/libgme.props +++ b/libs/libgme.props @@ -2,12 +2,12 @@ - + $(SolutionDir)libs\gme\include;$(IncludePath) $(SolutionDir)libs\gme\win32;$(LibraryPath) $(SolutionDir)libs\gme\win64;$(LibraryPath) - + libgme.dll.a;%(AdditionalDependencies) diff --git a/src/sdl/Srb2SDL.props b/src/sdl/Srb2SDL.props index cba6d1642..75839a5b2 100644 --- a/src/sdl/Srb2SDL.props +++ b/src/sdl/Srb2SDL.props @@ -5,7 +5,10 @@ - USE_WGL_SWAP;DIRECTFULLSCREEN;HAVE_SDL;HWRENDER;HW3SOUND;HAVE_FILTER;HAVE_MIXER;HAVE_LIBGME;HAVE_ZLIB;SDLMAIN;%(PreprocessorDefinitions) + + HAVE_ZLIB;HAVE_LIBGME;USE_WGL_SWAP;DIRECTFULLSCREEN;HAVE_SDL;HWRENDER;HW3SOUND;HAVE_FILTER;HAVE_MIXER;SDLMAIN;%(PreprocessorDefinitions) + + USE_WGL_SWAP;DIRECTFULLSCREEN;HAVE_SDL;HWRENDER;HW3SOUND;HAVE_FILTER;HAVE_MIXER;SDLMAIN;%(PreprocessorDefinitions) diff --git a/src/win32/Srb2win.props b/src/win32/Srb2win.props index ea12ffb28..fa152f0c9 100644 --- a/src/win32/Srb2win.props +++ b/src/win32/Srb2win.props @@ -5,7 +5,10 @@ - _WINDOWS;HAVE_LIBGME;HAVE_ZLIB;%(PreprocessorDefinitions) + + HAVE_ZLIB;HAVE_LIBGME;_WINDOWS;%(PreprocessorDefinitions) + + _WINDOWS;%(PreprocessorDefinitions) From abaa8730a5272a868c871ffb42f395866ae0c1b9 Mon Sep 17 00:00:00 2001 From: mazmazz Date: Sat, 5 Jan 2019 09:54:45 -0500 Subject: [PATCH 10/56] Revised comments --- .travis.yml | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index b87650f6a..1f80e3dfc 100644 --- a/.travis.yml +++ b/.travis.yml @@ -564,16 +564,20 @@ addons: before_install: # 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 + + # 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; @@ -606,6 +610,7 @@ before_script: 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))"; @@ -655,5 +660,8 @@ script: after_success: # Run the Deployer scripts + - if [[ "$__DPL_ACTIVE" != "1" ]]; then + exit; + fi; - . ../deployer/travis/deployer_ftp.sh - . ../deployer/travis/deployer_dput.sh From 97f8448b72bd0563ed57f9c93c4fd96a96346072 Mon Sep 17 00:00:00 2001 From: mazmazz Date: Sat, 5 Jan 2019 10:17:33 -0500 Subject: [PATCH 11/56] Don't terminate in after_success because it halts the log abruptly --- .travis.yml | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/.travis.yml b/.travis.yml index 1f80e3dfc..3068b89bd 100644 --- a/.travis.yml +++ b/.travis.yml @@ -659,9 +659,7 @@ script: fi; after_success: - # Run the Deployer scripts - - if [[ "$__DPL_ACTIVE" != "1" ]]; then - exit; - fi; + # Run the upload scripts + # These do nothing if Deployer is not triggered - . ../deployer/travis/deployer_ftp.sh - . ../deployer/travis/deployer_dput.sh From 0834dbc194770ef4897558974a953239789ae704 Mon Sep 17 00:00:00 2001 From: mazmazz Date: Sat, 5 Jan 2019 19:20:58 -0500 Subject: [PATCH 12/56] * Add homebrew tap mazmazz/srb2 * Use sdl2_mixer from mazmazz/srb2 due to removed options from homebrew-core * Use `brew install --build-bottle` to build compatible libraries for old Macs --- .travis.yml | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index 3068b89bd..18e706476 100644 --- a/.travis.yml +++ b/.travis.yml @@ -585,10 +585,18 @@ before_install: install: + # Install OS X library dependencies via Homebrew + # `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 install sdl2 game-music-emu zlib p7zip; - brew install sdl2_mixer --with-flac --with-mpg123; + brew tap mazmazz/srb2; + fi; + - if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then + brew install --build-bottle sdl2 game-music-emu zlib p7zip; + brew install --build-bottle mazmazz/srb2/sdl2_mixer --with-flac --with-mpg123; + brew postinstall sdl2 game-music-emu zlib p7zip mazmazz/srb2/sdl2_mixer; brew install cmake||true; fi - mkdir -p $HOME/srb2_cache From 9ef7d2e6ba46eb4fa9d015c3a998789c221de045 Mon Sep 17 00:00:00 2001 From: mazmazz Date: Sat, 5 Jan 2019 19:27:34 -0500 Subject: [PATCH 13/56] OS X set CFLAGS+="-march=core2" for compatible binaries with old Macs --- .travis.yml | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/.travis.yml b/.travis.yml index 18e706476..1103c4e89 100644 --- a/.travis.yml +++ b/.travis.yml @@ -583,6 +583,9 @@ before_install: ASSET_FILES_OPTIONAL_GET=1; fi; + # Print version info + - gcc --version; + install: # Install OS X library dependencies via Homebrew @@ -650,6 +653,10 @@ before_script: - 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}" From 17cde328c123edc45dd710e7a4cbb730e4ec2138 Mon Sep 17 00:00:00 2001 From: mazmazz Date: Sat, 5 Jan 2019 19:43:37 -0500 Subject: [PATCH 14/56] Use standard OSX brew bottles to speed up test buildbots --- .travis.yml | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/.travis.yml b/.travis.yml index 1103c4e89..301991ddf 100644 --- a/.travis.yml +++ b/.travis.yml @@ -589,18 +589,24 @@ before_install: install: # Install OS X library dependencies via Homebrew - # `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 + # 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 - brew install --build-bottle sdl2 game-music-emu zlib p7zip; - brew install --build-bottle mazmazz/srb2/sdl2_mixer --with-flac --with-mpg123; - brew postinstall sdl2 game-music-emu zlib p7zip mazmazz/srb2/sdl2_mixer; - brew install cmake||true; + 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 zlib p7zip; + brew install --build-bottle mazmazz/srb2/sdl2_mixer --with-flac --with-mpg123; + brew postinstall sdl2 game-music-emu zlib p7zip mazmazz/srb2/sdl2_mixer; + brew install cmake||true; + fi; fi - mkdir -p $HOME/srb2_cache From 20879f1f40418ce05aed27bd7251da72285661e1 Mon Sep 17 00:00:00 2001 From: mazmazz Date: Sat, 5 Jan 2019 19:49:25 -0500 Subject: [PATCH 15/56] Remove zlib from release brew packages (it was never in the original travis script) --- .travis.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index 301991ddf..19a6d7a80 100644 --- a/.travis.yml +++ b/.travis.yml @@ -602,9 +602,9 @@ install: brew install sdl2 sdl2_mixer game-music-emu p7zip; brew install cmake||true; else - brew install --build-bottle sdl2 game-music-emu zlib p7zip; + 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 zlib p7zip mazmazz/srb2/sdl2_mixer; + brew postinstall sdl2 game-music-emu p7zip mazmazz/srb2/sdl2_mixer; brew install cmake||true; fi; fi From 2592f42a17325520c32882bf7b0d429f76aea3c1 Mon Sep 17 00:00:00 2001 From: mazmazz Date: Sat, 5 Jan 2019 19:56:27 -0500 Subject: [PATCH 16/56] Remove unnecessary version info call --- .travis.yml | 3 --- 1 file changed, 3 deletions(-) diff --git a/.travis.yml b/.travis.yml index 19a6d7a80..e9c8d0d71 100644 --- a/.travis.yml +++ b/.travis.yml @@ -583,9 +583,6 @@ before_install: ASSET_FILES_OPTIONAL_GET=1; fi; - # Print version info - - gcc --version; - install: # Install OS X library dependencies via Homebrew From d92ccf68237eedbb185d1af2ef07ab8ff8e63c9b Mon Sep 17 00:00:00 2001 From: Monster Iestyn Date: Thu, 2 May 2019 18:01:18 +0100 Subject: [PATCH 17/56] Hardcoded all the main Fang-specific object types, states and sprites. This cannot be compiled as-is right now for the following reasons: * Numerous actions still need to be hardcoded. * MT_FBOMB uses the TNT barrel explosion (and by extention A_TNTExplode) for its death state. This is a pickle, I'll deal with it when I get to it. Also missing: * Fang waypoint object type+states. * Fang's good looks (to be put in the resource files obviously). * Fang's brain. --- src/dehacked.c | 83 ++++++++++++++++++++ src/info.c | 207 ++++++++++++++++++++++++++++++++++++++++++++++++- src/info.h | 87 ++++++++++++++++++++- 3 files changed, 375 insertions(+), 2 deletions(-) diff --git a/src/dehacked.c b/src/dehacked.c index 54dfc441e..4aba5c495 100644 --- a/src/dehacked.c +++ b/src/dehacked.c @@ -4530,6 +4530,83 @@ static const char *const STATE_LIST[] = { // array length left dynamic for sanit "S_JETFLAME1", "S_JETFLAME2", + // Boss 5 + "S_FANG_IDLE1", + "S_FANG_IDLE2", + "S_FANG_IDLE3", + "S_FANG_IDLE4", + "S_FANG_IDLE5", + "S_FANG_IDLE6", + "S_FANG_IDLE7", + "S_FANG_IDLE8", + "S_FANG_PAIN1", + "S_FANG_PAIN2", + "S_FANG_PATHINGSTART1", + "S_FANG_PATHINGSTART2", + "S_FANG_PATHING", + "S_FANG_BOUNCE1", + "S_FANG_BOUNCE2", + "S_FANG_BOUNCE3", + "S_FANG_BOUNCE4", + "S_FANG_FALL1", + "S_FANG_FALL2", + "S_FANG_SLIDE", + "S_FANG_CHECKPATH1", + "S_FANG_CHECKPATH2", + "S_FANG_PATHINGCONT1", + "S_FANG_PATHINGCONT2", + "S_FANG_PATHINGCONT3", + "S_FANG_SKID1", + "S_FANG_SKID2", + "S_FANG_SKID3", + "S_FANG_CHOOSEATTACK", + "S_FANG_FIRESTART1", + "S_FANG_FIRESTART2", + "S_FANG_FIRE1", + "S_FANG_FIRE2", + "S_FANG_FIRE3", + "S_FANG_FIRE4", + "S_FANG_FIREREPEAT", + "S_FANG_LOBSHOT1", + "S_FANG_LOBSHOT2", + "S_FANG_WAIT1", + "S_FANG_WAIT2", + "S_FANG_WALLHIT", + "S_FANG_PINCHPATHINGSTART1", + "S_FANG_PINCHPATHINGSTART2", + "S_FANG_PINCHPATHING", + "S_FANG_PINCHBOUNCE1", + "S_FANG_PINCHBOUNCE2", + "S_FANG_PINCHBOUNCE3", + "S_FANG_PINCHBOUNCE4", + "S_FANG_PINCHFALL1", + "S_FANG_PINCHFALL2", + "S_FANG_PINCHSKID1", + "S_FANG_PINCHSKID2", + "S_FANG_PINCHLOBSHOT1", + "S_FANG_PINCHLOBSHOT2", + "S_FANG_PINCHLOBSHOT3", + "S_FANG_PINCHLOBSHOT4", + "S_FANG_DIE1", + "S_FANG_DIE2", + "S_FANG_DIE3", + "S_FANG_DIE4", + "S_FANG_DIE5", + "S_FANG_DIE6", + "S_FANG_DIE7", + "S_FANG_DIE8", + "S_FANG_FLEEPATHING1", + "S_FANG_FLEEPATHING2", + "S_FANG_FLEEBOUNCE1", + "S_FANG_FLEEBOUNCE2", + "S_FANG_KO", + + "S_FBOMB1", + "S_FBOMB2", + "S_FSGNA", + "S_FSGNB", + "S_FSGNC", + // Black Eggman (Boss 7) "S_BLACKEGG_STND", "S_BLACKEGG_STND2", @@ -6820,6 +6897,12 @@ static const char *const MOBJTYPE_LIST[] = { // array length left dynamic for s "MT_EGGMOBILE4_MACE", "MT_JETFLAME", + // Boss 5 + "MT_FANG", + "MT_FBOMB", + "MT_FSGNA", + "MT_FSGNB", + // Black Eggman (Boss 7) "MT_BLACKEGGMAN", "MT_BLACKEGGMAN_HELPER", diff --git a/src/info.c b/src/info.c index 86e40c388..e2f4c9246 100644 --- a/src/info.c +++ b/src/info.c @@ -87,7 +87,9 @@ char sprnames[NUMSPRITES + 1][5] = "EFIR", // Boss 4 jet flame // Boss 5 (Arid Canyon) - "EGGQ", + "FANG", // replaces EGGQ + "FBOM", + "FSGN", // Boss 6 (Red Volcano) "EGGR", @@ -1315,6 +1317,101 @@ state_t states[NUMSTATES] = {SPR_EFIR, FF_FULLBRIGHT, 1, {NULL}, 0, 0, S_JETFLAME2}, // S_JETFLAME1 {SPR_EFIR, FF_FULLBRIGHT|1, 1, {NULL}, 0, 0, S_JETFLAME1}, // S_JETFLAME2 + // Boss 5 + {SPR_FANG, 2, 16, {A_Look}, 1, 0, S_FANG_IDLE2}, // S_FANG_IDLE1 + {SPR_FANG, 3, 16, {A_Look}, 1, 0, S_FANG_IDLE3}, // S_FANG_IDLE2 + {SPR_FANG, 3, 16, {A_Look}, 1, 0, S_FANG_IDLE4}, // S_FANG_IDLE3 + {SPR_FANG, 3, 16, {A_Look}, 1, 0, S_FANG_IDLE5}, // S_FANG_IDLE4 + {SPR_FANG, 2, 16, {A_Look}, 1, 0, S_FANG_IDLE6}, // S_FANG_IDLE5 + {SPR_FANG, 1, 16, {A_Look}, 1, 0, S_FANG_IDLE7}, // S_FANG_IDLE6 + {SPR_FANG, 1, 16, {A_Look}, 1, 0, S_FANG_IDLE8}, // S_FANG_IDLE7 + {SPR_FANG, 1, 16, {A_Look}, 1, 0, S_FANG_IDLE1}, // S_FANG_IDLE8 + + {SPR_FANG, 14, 0, {A_DoNPCPain}, FRACUNIT, 0, S_FANG_PAIN2}, // S_FANG_PAIN1 + {SPR_FANG, 14, 1, {A_Boss5CheckOnGround}, S_FANG_PATHINGSTART1, S_FANG_PINCHPATHINGSTART1, S_FANG_PAIN2}, // S_FANG_PAIN2 + + {SPR_FANG, 8, 0, {A_Boss5ExtraRepeat}, 5, 4, S_FANG_PATHINGSTART2}, // S_FANG_PATHINGSTART1 + {SPR_FANG, 8, 0, {A_PlayActiveSound}, 0, 0, S_FANG_PATHING}, // S_FANG_PATHINGSTART2 + {SPR_FANG, 8, 0, {A_Boss5FindWaypoint}, 0, 0, S_FANG_BOUNCE1}, // S_FANG_PATHING + + {SPR_FANG, 8, 2, {A_Thrust}, 0, 1, S_FANG_BOUNCE2}, // S_FANG_BOUNCE1 + {SPR_FANG, 9, 2, {NULL}, 0, 0, S_FANG_BOUNCE3}, // S_FANG_BOUNCE2 + {SPR_FANG, 10, 1, {A_Boss5Jump}, 0, 0, S_FANG_BOUNCE4}, // S_FANG_BOUNCE3 + {SPR_FANG, 10, 1, {A_Boss5CheckFalling}, S_FANG_CHECKPATH1, S_FANG_FALL1, S_FANG_BOUNCE4}, // S_FANG_BOUNCE4 + + {SPR_FANG, 12, 1, {A_Boss5CheckOnGround}, S_FANG_CHECKPATH1, 0, S_FANG_FALL2}, // S_FANG_FALL1 + {SPR_FANG, 13, 1, {A_Boss5CheckOnGround}, S_FANG_CHECKPATH1, 0, S_FANG_FALL1}, // S_FANG_FALL2 + + {SPR_FANG, 8, 0, {A_Boss5Calm}, 0, 0, S_FANG_CHECKPATH2}, // S_FANG_CHECKPATH1 + {SPR_FANG, 8, 0, {A_Repeat}, 0, S_FANG_PATHINGCONT1, S_FANG_SKID1}, // S_FANG_CHECKPATH2 + + {SPR_FANG, 9, 0, {A_Boss5PinchShot}, MT_FBOMB, -16, S_FANG_PATHINGCONT2}, // S_FANG_PATHINGCONT1 + {SPR_FANG, 9, 0, {A_PlayActiveSound}, 0, 0, S_FANG_PATHINGCONT3}, // S_FANG_PATHINGCONT2 + {SPR_FANG, 9, 2, {A_Thrust}, 0, 1, S_FANG_PATHING}, // S_FANG_PATHINGCONT3 + + {SPR_FANG, 4, 0, {A_PlayAttackSound}, 0, 0, S_FANG_SKID2}, // S_FANG_SKID1 + {SPR_FANG, 4, 1, {A_DoNPCSkid}, S_FANG_SKID3, 0, S_FANG_SKID2}, // S_FANG_SKID2 + {SPR_FANG, 4, 10, {NULL}, 0, 0, S_FANG_CHOOSEATTACK}, // S_FANG_SKID3 + + {SPR_FANG, 0, 0, {A_RandomState}, S_FANG_LOBSHOT1, S_FANG_FIRESTART1, S_NULL}, // S_FANG_CHOOSEATTACK + + {SPR_FANG, 5, 0, {A_PrepareRepeat}, 3, 0, S_FANG_FIRESTART2}, // S_FANG_FIRESTART1 // Reset loop + {SPR_FANG, 5, 18, {A_LookForBetter}, 1, 0, S_FANG_FIRE1}, // S_FANG_FIRESTART2 + {SPR_FANG, 5, 5, {A_FireShot}, MT_CORK, -16, S_FANG_FIRE2}, // S_FANG_FIRE1 // Start of loop + {SPR_FANG, 6, 5, {NULL}, 0, 0, S_FANG_FIRE3}, // S_FANG_FIRE2 + {SPR_FANG, 7, 5, {NULL}, 0, 0, S_FANG_FIRE4}, // S_FANG_FIRE3 + {SPR_FANG, 5, 5, {NULL}, 2, 0, S_FANG_FIREREPEAT}, // S_FANG_FIRE4 + {SPR_FANG, 5, 0, {A_Repeat}, 3, S_FANG_FIRE1, S_FANG_WAIT1}, // S_FANG_FIREREPEAT // End of loop + + {SPR_FANG, 19, 18, {A_LookForBetter}, 1, 0, S_FANG_LOBSHOT2}, // S_FANG_LOBSHOT1 + {SPR_FANG, 20, 18, {A_BrakLobShot}, MT_FBOMB, 32+FRACUNIT, S_FANG_WAIT1}, // S_FANG_LOBSHOT2 + + {SPR_FANG, FF_ANIMATE|15, 70, {NULL}, 1, 5, S_FANG_WAIT2}, // S_FANG_WAIT1 + {SPR_FANG, 0, 35, {A_Look}, 1, 0, S_FANG_IDLE1}, // S_FANG_WAIT2 + + {SPR_FANG, 12, 1, {A_Boss5CheckOnGround}, S_FANG_PATHINGSTART2, S_FANG_PINCHPATHINGSTART1, S_FANG_WALLHIT}, // S_FANG_WALLHIT + + {SPR_FANG, 8, 0, {A_PrepareRepeat}, 1, 0, S_FANG_PINCHPATHINGSTART2}, // S_FANG_PINCHPATHINGSTART1 + {SPR_FANG, 8, 0, {A_PlayActiveSound}, 0, 0, S_FANG_PINCHPATHING}, // S_FANG_PINCHPATHINGSTART2 + {SPR_FANG, 8, 0, {A_Boss5FindWaypoint}, 1, 0, S_FANG_PINCHBOUNCE1}, // S_FANG_PINCHPATHING + {SPR_FANG, 8, 2, {A_Thrust}, 0, 1, S_FANG_PINCHBOUNCE2}, // S_FANG_PINCHBOUNCE1 + {SPR_FANG, 9, 2, {NULL}, 0, 0, S_FANG_PINCHBOUNCE3}, // S_FANG_PINCHBOUNCE2 + {SPR_FANG, 10, 2, {A_Boss5Jump}, 0, 0, S_FANG_PINCHBOUNCE4}, // S_FANG_PINCHBOUNCE3 + {SPR_FANG, 10, 1, {A_Boss5CheckFalling}, S_FANG_PINCHSKID1, S_FANG_PINCHFALL1, S_FANG_PINCHBOUNCE4}, // S_FANG_PINCHBOUNCE4 + {SPR_FANG, 12, 1, {A_Boss5CheckOnGround}, S_FANG_PINCHSKID1, 0, S_FANG_PINCHFALL2}, // S_FANG_PINCHFALL1 + {SPR_FANG, 13, 1, {A_Boss5CheckOnGround}, S_FANG_PINCHSKID1, 0, S_FANG_PINCHFALL1}, // S_FANG_PINCHFALL2 + {SPR_FANG, 4, 0, {A_PlayAttackSound}, 0, 0, S_FANG_PINCHSKID2}, // S_FANG_PINCHSKID1 + {SPR_FANG, 4, 1, {A_DoNPCSkid}, S_FANG_PINCHLOBSHOT1, 0, S_FANG_PINCHSKID2}, // S_FANG_PINCHSKID2 + {SPR_FANG, 19, 18, {A_FaceTarget}, 3, 0, S_FANG_PINCHLOBSHOT2}, // S_FANG_PINCHLOBSHOT1 + {SPR_FANG, 20, 30, {A_Boss5MakeItRain}, MT_FBOMB, -16, S_FANG_PINCHLOBSHOT3}, // S_FANG_PINCHLOBSHOT2 + {SPR_FANG, 19, 18, {A_LinedefExecute}, LE_BOSS4DROP, 0, S_FANG_PINCHLOBSHOT4}, // S_FANG_PINCHLOBSHOT3 + {SPR_FANG, 19, 0, {A_Boss5Calm}, 0, 0, S_FANG_PATHINGSTART1}, // S_FANG_PINCHLOBSHOT4 + + {SPR_FANG, 14, 0, {A_DoNPCPain}, 0, 0, S_FANG_DIE2}, // S_FANG_DIE1 + {SPR_FANG, 14, 1, {A_Boss5CheckOnGround}, S_FANG_DIE3, 0, S_FANG_DIE2}, // S_FANG_DIE2 + + {SPR_FANG, 17, 0, {A_Scream}, 0, 0, S_FANG_DIE4}, // S_FANG_DIE3 + {SPR_FANG, 17, 104, {NULL}, 0, 0, S_FANG_DIE5}, // S_FANG_DIE4 + + {SPR_FANG, 11, 0, {A_PlaySound}, sfx_jump, 0, S_FANG_DIE6}, // S_FANG_DIE5 + {SPR_FANG, 11, 1, {A_ZThrust}, 6, FRACUNIT|1, S_FANG_DIE7}, // S_FANG_DIE6 + {SPR_FANG, 11, 1, {A_Boss5CheckFalling}, S_FANG_FLEEPATHING1, S_FANG_DIE8, S_FANG_DIE7}, // S_FANG_DIE7 + {SPR_FANG, 12, 1, {A_Boss5CheckOnGround}, S_FANG_FLEEPATHING1, 0, S_FANG_DIE8}, // S_FANG_DIE8 + + {SPR_FANG, 9, 0, {A_PlayActiveSound}, 0, 0, S_FANG_FLEEPATHING2}, // S_FANG_FLEEPATHING1 + {SPR_FANG, 8, 2, {A_Boss5FindWaypoint}, 2, 0, S_FANG_FLEEBOUNCE1}, // S_FANG_FLEEPATHING2 + {SPR_FANG, 9, 2, {NULL}, 0, 0, S_FANG_FLEEBOUNCE2}, // S_FANG_FLEEBOUNCE1 + {SPR_FANG, 10, -1, {A_BossDeath}, 0, 0, S_NULL}, // S_FANG_FLEEBOUNCE2 + + {SPR_FANG, 18, 7*TICRATE, {NULL}, 0, 0, S_NULL}, // S_FANG_KO + + {SPR_FBOM, 0, 1, {A_GhostMe}, 0, 0, S_FBOMB2}, // S_FBOMB1 + {SPR_FBOM, 1, 1, {A_GhostMe}, 0, 0, S_FBOMB1}, // S_FBOMB2 + {SPR_FSGN, 0|FF_PAPERSPRITE, -1, {NULL}, 0, 0, S_NULL}, // S_FSGNA + {SPR_FSGN, 1|FF_PAPERSPRITE, -1, {NULL}, 0, 0, S_NULL}, // S_FSGNB + {SPR_FSGN, 2|FF_PAPERSPRITE, -1, {NULL}, 0, 0, S_NULL}, // S_FSGNC + + // Black Eggman (Boss 7) {SPR_BRAK, 0, 1, {A_SetReactionTime}, 0, 0, S_BLACKEGG_STND2}, // S_BLACKEGG_STND {SPR_BRAK, 0, 7, {A_Look}, 1, 0, S_BLACKEGG_STND2}, // S_BLACKEGG_STND2 {SPR_BRAK, 1, 7, {NULL}, 0, 0, S_BLACKEGG_WALK2}, // S_BLACKEGG_WALK1 @@ -5248,6 +5345,114 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] = S_NULL // raisestate }, + { // MT_FANG + 204, // doomednum + S_FANG_IDLE1, // spawnstate + 8, // spawnhealth + S_FANG_PATHINGSTART1, // seestate + sfx_None, // seesound + 0, // reactiontime + sfx_skid, // attacksound + S_FANG_PAIN1, // painstate + 0, // painchance + sfx_s3k5d, // painsound + S_NULL, // meleestate + S_NULL, // missilestate + S_FANG_DIE1, // deathstate + S_FANG_KO, // xdeathstate + sfx_s3k90, // deathsound + 0, // speed + 24*FRACUNIT, // radius + 60*FRACUNIT, // height + 0, // display offset + 0, // mass + 3, // damage + sfx_boingf, // activesound + MF_SPECIAL|MF_BOSS|MF_SHOOTABLE, // flags + S_NULL // raisestate + }, + + { // MT_FBOMB + -1, // doomednum + S_FBOMB1, // spawnstate + 1, // spawnhealth + S_NULL, // seestate + sfx_s3k51, // seesound + 0, // reactiontime + sfx_None, // attacksound + S_NULL, // painstate + 0, // painchance + sfx_None, // painsound + S_NULL, // meleestate + S_NULL, // missilestate + S_TNTBARREL_EXPL1, // deathstate + S_NULL, // xdeathstate + sfx_s3k4e, // deathsound + 20*FRACUNIT, // speed + 24*FRACUNIT, // radius + 48*FRACUNIT, // height + 0, // display offset + 0, // mass + 0, // damage + sfx_s3k8d, // activesound + MF_NOBLOCKMAP|MF_MISSILE, // flags + S_NULL // raisestate + }, + + { // MT_FSGNA + -1, // doomednum + S_FSGNA, // spawnstate + 1, // spawnhealth + S_NULL, // seestate + sfx_None, // seesound + 0, // 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_mspogo, // deathsound + 0, // speed + 124*FRACUNIT, // radius + 124*FRACUNIT, // height + 0, // display offset + 0, // mass + 0, // damage + sfx_None, // activesound + MF_NOGRAVITY|MF_NOCLIP|MF_NOCLIPHEIGHT|MF_SCENERY, // flags + S_NULL // raisestate + }, + + { // MT_FSGNB + -1, // doomednum + S_FSGNB, // spawnstate + 1, // spawnhealth + S_NULL, // seestate + sfx_None, // seesound + 0, // reactiontime + sfx_None, // attacksound + S_NULL, // painstate + 0, // painchance + sfx_None, // painsound + S_NULL, // meleestate + S_NULL, // missilestate + S_FSGNC, // deathstate + S_NULL, // xdeathstate + sfx_None, // deathsound + 0, // speed + 124*FRACUNIT, // radius + 640*FRACUNIT, // height + 0, // display offset + 0, // mass + 0, // damage + sfx_None, // activesound + MF_NOGRAVITY|MF_NOCLIP|MF_NOCLIPHEIGHT|MF_SCENERY|MF_SOLID, // flags + S_NULL // raisestate + }, + { // MT_BLACKEGGMAN 206, // doomednum S_BLACKEGG_STND, // spawnstate diff --git a/src/info.h b/src/info.h index 962a6be29..932c82573 100644 --- a/src/info.h +++ b/src/info.h @@ -306,7 +306,9 @@ typedef enum sprite SPR_EFIR, // Boss 4 jet flame // Boss 5 (Arid Canyon) - SPR_EGGQ, + SPR_FANG, // replaces EGGQ + SPR_FBOM, + SPR_FSGN, // Boss 6 (Red Volcano) SPR_EGGR, @@ -1442,6 +1444,83 @@ typedef enum state S_JETFLAME1, S_JETFLAME2, + // Boss 5 + S_FANG_IDLE1, + S_FANG_IDLE2, + S_FANG_IDLE3, + S_FANG_IDLE4, + S_FANG_IDLE5, + S_FANG_IDLE6, + S_FANG_IDLE7, + S_FANG_IDLE8, + S_FANG_PAIN1, + S_FANG_PAIN2, + S_FANG_PATHINGSTART1, + S_FANG_PATHINGSTART2, + S_FANG_PATHING, + S_FANG_BOUNCE1, + S_FANG_BOUNCE2, + S_FANG_BOUNCE3, + S_FANG_BOUNCE4, + S_FANG_FALL1, + S_FANG_FALL2, + S_FANG_SLIDE, + S_FANG_CHECKPATH1, + S_FANG_CHECKPATH2, + S_FANG_PATHINGCONT1, + S_FANG_PATHINGCONT2, + S_FANG_PATHINGCONT3, + S_FANG_SKID1, + S_FANG_SKID2, + S_FANG_SKID3, + S_FANG_CHOOSEATTACK, + S_FANG_FIRESTART1, + S_FANG_FIRESTART2, + S_FANG_FIRE1, + S_FANG_FIRE2, + S_FANG_FIRE3, + S_FANG_FIRE4, + S_FANG_FIREREPEAT, + S_FANG_LOBSHOT1, + S_FANG_LOBSHOT2, + S_FANG_WAIT1, + S_FANG_WAIT2, + S_FANG_WALLHIT, + S_FANG_PINCHPATHINGSTART1, + S_FANG_PINCHPATHINGSTART2, + S_FANG_PINCHPATHING, + S_FANG_PINCHBOUNCE1, + S_FANG_PINCHBOUNCE2, + S_FANG_PINCHBOUNCE3, + S_FANG_PINCHBOUNCE4, + S_FANG_PINCHFALL1, + S_FANG_PINCHFALL2, + S_FANG_PINCHSKID1, + S_FANG_PINCHSKID2, + S_FANG_PINCHLOBSHOT1, + S_FANG_PINCHLOBSHOT2, + S_FANG_PINCHLOBSHOT3, + S_FANG_PINCHLOBSHOT4, + S_FANG_DIE1, + S_FANG_DIE2, + S_FANG_DIE3, + S_FANG_DIE4, + S_FANG_DIE5, + S_FANG_DIE6, + S_FANG_DIE7, + S_FANG_DIE8, + S_FANG_FLEEPATHING1, + S_FANG_FLEEPATHING2, + S_FANG_FLEEBOUNCE1, + S_FANG_FLEEBOUNCE2, + S_FANG_KO, + + S_FBOMB1, + S_FBOMB2, + S_FSGNA, + S_FSGNB, + S_FSGNC, + // Black Eggman (Boss 7) S_BLACKEGG_STND, S_BLACKEGG_STND2, @@ -3752,6 +3831,12 @@ typedef enum mobj_type MT_EGGMOBILE4_MACE, MT_JETFLAME, + // Boss 5 + MT_FANG, + MT_FBOMB, + MT_FSGNA, + MT_FSGNB, + // Black Eggman (Boss 7) MT_BLACKEGGMAN, MT_BLACKEGGMAN_HELPER, From 75701294eaeae79d9c859c2073a3113337738715 Mon Sep 17 00:00:00 2001 From: Monster Iestyn Date: Thu, 2 May 2019 18:11:44 +0100 Subject: [PATCH 18/56] Hardcode Fang waypoint object type (turns out no state is needed) --- src/dehacked.c | 1 + src/info.c | 27 +++++++++++++++++++++++++++ src/info.h | 1 + 3 files changed, 29 insertions(+) diff --git a/src/dehacked.c b/src/dehacked.c index 4aba5c495..cbb16e63e 100644 --- a/src/dehacked.c +++ b/src/dehacked.c @@ -6902,6 +6902,7 @@ static const char *const MOBJTYPE_LIST[] = { // array length left dynamic for s "MT_FBOMB", "MT_FSGNA", "MT_FSGNB", + "MT_FANGWAYPOINT", // Black Eggman (Boss 7) "MT_BLACKEGGMAN", diff --git a/src/info.c b/src/info.c index e2f4c9246..fa24132a1 100644 --- a/src/info.c +++ b/src/info.c @@ -5453,6 +5453,33 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] = S_NULL // raisestate }, + { // MT_FANGWAYPOINT + 294, // doomednum + S_INVISIBLE, // spawnstate + 1000, // spawnhealth + S_NULL, // seestate + sfx_None, // seesound + 0, // 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 + FRACUNIT, // radius + FRACUNIT, // height + 0, // display offset + 0, // mass + 0, // damage + sfx_None, // activesound + MF_NOGRAVITY|MF_NOBLOCKMAP|MF_NOTHINK, // flags + S_NULL // raisestate + }, + { // MT_BLACKEGGMAN 206, // doomednum S_BLACKEGG_STND, // spawnstate diff --git a/src/info.h b/src/info.h index 932c82573..8c8c2ccde 100644 --- a/src/info.h +++ b/src/info.h @@ -3836,6 +3836,7 @@ typedef enum mobj_type MT_FBOMB, MT_FSGNA, MT_FSGNB, + MT_FANGWAYPOINT, // Black Eggman (Boss 7) MT_BLACKEGGMAN, From 3bbc5d0b080f3f2f006cdcd489fd6b4a221007ff Mon Sep 17 00:00:00 2001 From: Monster Iestyn Date: Thu, 2 May 2019 18:32:43 +0100 Subject: [PATCH 19/56] hardcoded A_DoNPCPain --- src/dehacked.c | 1 + src/info.h | 1 + src/p_enemy.c | 58 ++++++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 60 insertions(+) diff --git a/src/dehacked.c b/src/dehacked.c index cbb16e63e..0bbeaa4b2 100644 --- a/src/dehacked.c +++ b/src/dehacked.c @@ -2225,6 +2225,7 @@ static actionpointer_t actionpointers[] = {{A_ParentTriesToSleep}, "A_PARENTTRIESTOSLEEP"}, {{A_CryingToMomma}, "A_CRYINGTOMOMMA"}, {{A_CheckFlags2}, "A_CHECKFLAGS2"}, + {{A_DoNPCPain}, "A_DONPCPAIN"}, {{NULL}, "NONE"}, diff --git a/src/info.h b/src/info.h index 8c8c2ccde..58eebb24e 100644 --- a/src/info.h +++ b/src/info.h @@ -239,6 +239,7 @@ void A_WhoCaresIfYourSonIsABee(); void A_ParentTriesToSleep(); void A_CryingToMomma(); void A_CheckFlags2(); +void A_DoNPCPain(); // ratio of states to sprites to mobj types is roughly 6 : 1 : 1 #define NUMMOBJFREESLOTS 256 diff --git a/src/p_enemy.c b/src/p_enemy.c index 9d2425e53..177d37e86 100644 --- a/src/p_enemy.c +++ b/src/p_enemy.c @@ -266,6 +266,7 @@ void A_WhoCaresIfYourSonIsABee(mobj_t *actor); void A_ParentTriesToSleep(mobj_t *actor); void A_CryingToMomma(mobj_t *actor); void A_CheckFlags2(mobj_t *actor); +void A_DoNPCPain(mobj_t *actor); //for p_enemy.c // @@ -11852,3 +11853,60 @@ void A_CheckFlags2(mobj_t *actor) if (actor->flags2 & locvar1) P_SetMobjState(actor, (statenum_t)locvar2); } + +// Function: A_DoNPCPain +// +// Description: Something that looks like a player was hit, put them in pain. +// +// var1 = If zero, always fling the same amount. +// Otherwise, slowly reduce the vertical +// and horizontal speed to the base value +// multiplied by this the more damage is done. +// var2 = If zero, use default fling values. +// Otherwise, vertical and horizontal speed +// will be multiplied by this. +// +void A_DoNPCPain(mobj_t *actor) +{ + INT32 locvar1 = var1; + INT32 locvar2 = var2; + fixed_t vspeed = 0; + fixed_t hspeed = FixedMul(4*FRACUNIT, actor->scale); +#ifdef HAVE_BLUA + if (LUA_CallAction("A_DoNPCPain", actor)) + return; +#endif + + actor->flags &= ~(MF_NOGRAVITY|MF_NOCLIP|MF_NOCLIPHEIGHT); + + var1 = var2 = 0; + A_Pain(actor); + + actor->z += P_MobjFlip(actor); + + if (actor->eflags & MFE_UNDERWATER) + vspeed = FixedDiv(10511*FRACUNIT,2600*FRACUNIT); + else + vspeed = FixedDiv(69*FRACUNIT,10*FRACUNIT); + + if (actor->target) + actor->angle = R_PointToAngle2(actor->x, actor->y, actor->target->x + actor->target->momx, actor->target->y + actor->target->momy); + + if (locvar1) + { + if (actor->info->spawnhealth) + return; // there's something very wrong here if you're using this action on something with no starting health + locvar1 += ((FRACUNIT - locvar1)/actor->info->spawnhealth)*actor->health; + hspeed = FixedMul(hspeed, locvar1); + vspeed = FixedMul(vspeed, locvar1); + } + + if (locvar2) + { + hspeed = FixedMul(hspeed, locvar2); + vspeed = FixedMul(vspeed, locvar2); + } + + P_SetObjectMomZ(actor, vspeed, false); + P_InstaThrust(actor, actor->angle, -hspeed); +} From fb17c1ac5ac9769015155b8ff1531360e528a363 Mon Sep 17 00:00:00 2001 From: Monster Iestyn Date: Thu, 2 May 2019 19:09:40 +0100 Subject: [PATCH 20/56] Hardcoded A_Boss5CheckOnGround --- src/dehacked.c | 1 + src/info.h | 1 + src/p_enemy.c | 33 +++++++++++++++++++++++++++++++++ 3 files changed, 35 insertions(+) diff --git a/src/dehacked.c b/src/dehacked.c index 0bbeaa4b2..5cec3dfca 100644 --- a/src/dehacked.c +++ b/src/dehacked.c @@ -2226,6 +2226,7 @@ static actionpointer_t actionpointers[] = {{A_CryingToMomma}, "A_CRYINGTOMOMMA"}, {{A_CheckFlags2}, "A_CHECKFLAGS2"}, {{A_DoNPCPain}, "A_DONPCPAIN"}, + {{A_Boss5CheckOnGround}, "A_BOSS5CHECKONGROUND"}, {{NULL}, "NONE"}, diff --git a/src/info.h b/src/info.h index 58eebb24e..1a4446f80 100644 --- a/src/info.h +++ b/src/info.h @@ -240,6 +240,7 @@ void A_ParentTriesToSleep(); void A_CryingToMomma(); void A_CheckFlags2(); void A_DoNPCPain(); +void A_Boss5CheckOnGround(); // ratio of states to sprites to mobj types is roughly 6 : 1 : 1 #define NUMMOBJFREESLOTS 256 diff --git a/src/p_enemy.c b/src/p_enemy.c index 177d37e86..099f87bc1 100644 --- a/src/p_enemy.c +++ b/src/p_enemy.c @@ -267,6 +267,7 @@ void A_ParentTriesToSleep(mobj_t *actor); void A_CryingToMomma(mobj_t *actor); void A_CheckFlags2(mobj_t *actor); void A_DoNPCPain(mobj_t *actor); +void A_Boss5CheckOnGround(mobj_t *actor); //for p_enemy.c // @@ -11910,3 +11911,35 @@ void A_DoNPCPain(mobj_t *actor) P_SetObjectMomZ(actor, vspeed, false); P_InstaThrust(actor, actor->angle, -hspeed); } + +// Function: A_Boss5CheckOnGround +// +// Description: Ground checker. +// +// var1 = state to change to upon hitting ground. +// var2 = state to change to upon hitting ground if health == pinchhealth, assuming it exists +// +void A_Boss5CheckOnGround(mobj_t *actor) +{ + INT32 locvar1 = var1; + INT32 locvar2 = var2; +#ifdef HAVE_BLUA + if (LUA_CallAction("A_Boss5CheckOnGround", actor)) + return; +#endif + + if ((!(actor->eflags & MFE_VERTICALFLIP) && actor->z <= actor->floorz) + || (actor->eflags & MFE_VERTICALFLIP && actor->z + actor->height >= actor->ceilingz)) + { + if (locvar2 && (!actor->health || (actor->health == actor->info->damage && !(actor->flags2 & MF2_STRONGBOX)))) + P_SetMobjState(actor, locvar2); + else + P_SetMobjState(actor, locvar1); + } + + if (actor->tracer && P_AproxDistance(actor->tracer->x - actor->x, actor->tracer->y - actor->y) < 2*actor->radius) + { + actor->momx = (4*actor->momx)/5; + actor->momy = (4*actor->momy)/5; + } +} From 953a0c2967281f2fc106b78948c0a13d569be190 Mon Sep 17 00:00:00 2001 From: Monster Iestyn Date: Thu, 2 May 2019 21:21:15 +0100 Subject: [PATCH 21/56] Hardcoded A_Boss5ExtraRepeat --- src/dehacked.c | 1 + src/info.h | 1 + src/p_enemy.c | 39 +++++++++++++++++++++++++++++++++++++++ 3 files changed, 41 insertions(+) diff --git a/src/dehacked.c b/src/dehacked.c index 5cec3dfca..155e2b5ce 100644 --- a/src/dehacked.c +++ b/src/dehacked.c @@ -2226,6 +2226,7 @@ static actionpointer_t actionpointers[] = {{A_CryingToMomma}, "A_CRYINGTOMOMMA"}, {{A_CheckFlags2}, "A_CHECKFLAGS2"}, {{A_DoNPCPain}, "A_DONPCPAIN"}, + {{A_Boss5ExtraRepeat}, "A_BOSS5EXTRAREPEAT"}, {{A_Boss5CheckOnGround}, "A_BOSS5CHECKONGROUND"}, {{NULL}, "NONE"}, diff --git a/src/info.h b/src/info.h index 1a4446f80..f623aaa1f 100644 --- a/src/info.h +++ b/src/info.h @@ -240,6 +240,7 @@ void A_ParentTriesToSleep(); void A_CryingToMomma(); void A_CheckFlags2(); void A_DoNPCPain(); +void A_Boss5ExtraRepeat(); void A_Boss5CheckOnGround(); // ratio of states to sprites to mobj types is roughly 6 : 1 : 1 diff --git a/src/p_enemy.c b/src/p_enemy.c index 099f87bc1..0746f629f 100644 --- a/src/p_enemy.c +++ b/src/p_enemy.c @@ -11912,6 +11912,45 @@ void A_DoNPCPain(mobj_t *actor) P_InstaThrust(actor, actor->angle, -hspeed); } +// Function: A_Boss5PinchRepeat +// +// Description: Simple way to prepare A_Repeat. +// +// var1 = maximum value to setextravalue2 to (normally) +// var2 = pinch annoyance +// +void A_Boss5ExtraRepeat(mobj_t *actor) +{ + INT32 locvar1 = var1; + INT32 locvar2 = var2; + INT32 calc; + INT32 locspawn; + INT32 lochealth; +#ifdef HAVE_BLUA + if (LUA_CallAction("A_Boss5ExtraRepeat", actor)) + return; +#endif + + if (actor->extravalue2 > 0 && !(actor->flags2 & MF2_FRET)) + return; + + locspawn = actor->info->spawnhealth - actor->info->damage; + lochealth = actor->health - actor->info->damage; + + if (locspawn <= 0 || lochealth <= 0) + calc = locvar1; + else + calc = (locvar1*(locspawn - lochealth))/locspawn; + + if (calc > 2) + actor->extravalue2 = 1 + calc/2 + P_RandomKey(calc/2); + else + actor->extravalue2 = 1 + calc; + + if (lochealth <= 0) + actor->extravalue2 += locvar2; +} + // Function: A_Boss5CheckOnGround // // Description: Ground checker. From 61eb05eab2331267457d43481cbea3921652d5c9 Mon Sep 17 00:00:00 2001 From: Monster Iestyn Date: Thu, 2 May 2019 21:32:28 +0100 Subject: [PATCH 22/56] Hardcoded A_Boss5CheckFalling --- src/dehacked.c | 1 + src/info.h | 1 + src/p_enemy.c | 29 +++++++++++++++++++++++++++++ 3 files changed, 31 insertions(+) diff --git a/src/dehacked.c b/src/dehacked.c index 155e2b5ce..baa5f13b3 100644 --- a/src/dehacked.c +++ b/src/dehacked.c @@ -2228,6 +2228,7 @@ static actionpointer_t actionpointers[] = {{A_DoNPCPain}, "A_DONPCPAIN"}, {{A_Boss5ExtraRepeat}, "A_BOSS5EXTRAREPEAT"}, {{A_Boss5CheckOnGround}, "A_BOSS5CHECKONGROUND"}, + {{A_Boss5CheckFalling}, "A_BOSS5CHECKFALLING"}, {{NULL}, "NONE"}, diff --git a/src/info.h b/src/info.h index f623aaa1f..166402651 100644 --- a/src/info.h +++ b/src/info.h @@ -242,6 +242,7 @@ void A_CheckFlags2(); void A_DoNPCPain(); void A_Boss5ExtraRepeat(); void A_Boss5CheckOnGround(); +void A_Boss5CheckFalling(); // ratio of states to sprites to mobj types is roughly 6 : 1 : 1 #define NUMMOBJFREESLOTS 256 diff --git a/src/p_enemy.c b/src/p_enemy.c index 0746f629f..118367da4 100644 --- a/src/p_enemy.c +++ b/src/p_enemy.c @@ -268,6 +268,7 @@ void A_CryingToMomma(mobj_t *actor); void A_CheckFlags2(mobj_t *actor); void A_DoNPCPain(mobj_t *actor); void A_Boss5CheckOnGround(mobj_t *actor); +void A_Boss5CheckFalling(mobj_t *actor); //for p_enemy.c // @@ -11982,3 +11983,31 @@ void A_Boss5CheckOnGround(mobj_t *actor) actor->momy = (4*actor->momy)/5; } } + +// Function: A_Boss5CheckFalling +// +// Description: Falling checker. +// +// var1 = state to change to when hitting ground. +// var2 = state to change to when falling. +// +void A_Boss5CheckFalling(mobj_t *actor) +{ + INT32 locvar1 = var1; + INT32 locvar2 = var2; +#ifdef HAVE_BLUA + if (LUA_CallAction("A_Boss5CheckFalling", actor)) + return; +#endif + + if (actor->health && actor->extravalue2 > 1) + { + var1 = locvar1; + var2 = 0; + A_Boss5CheckOnGround(actor); + return; + } + + if (P_MobjFlip(actor)*actor->momz <= 0) + P_SetMobjState(actor, locvar2); +} From 266fa05e15be8f28f3a32ee8b59565fa57a05639 Mon Sep 17 00:00:00 2001 From: Monster Iestyn Date: Thu, 2 May 2019 21:34:00 +0100 Subject: [PATCH 23/56] fix a slipup in A_DoNPCPain I just noticed I made, whoops --- src/p_enemy.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/p_enemy.c b/src/p_enemy.c index 118367da4..283a83559 100644 --- a/src/p_enemy.c +++ b/src/p_enemy.c @@ -11896,7 +11896,7 @@ void A_DoNPCPain(mobj_t *actor) if (locvar1) { - if (actor->info->spawnhealth) + if (!actor->info->spawnhealth) return; // there's something very wrong here if you're using this action on something with no starting health locvar1 += ((FRACUNIT - locvar1)/actor->info->spawnhealth)*actor->health; hspeed = FixedMul(hspeed, locvar1); From a0220454fdce8f78e89fc20a8e9330454950e94c Mon Sep 17 00:00:00 2001 From: Monster Iestyn Date: Fri, 3 May 2019 18:51:17 +0100 Subject: [PATCH 24/56] Hardcoded A_PrepareRepeat and A_Boss5Calm, added missing prototype for A_Boss5ExtraRepeat (and also fixed its description) --- src/dehacked.c | 2 ++ src/info.h | 2 ++ src/p_enemy.c | 41 ++++++++++++++++++++++++++++++++++++++++- 3 files changed, 44 insertions(+), 1 deletion(-) diff --git a/src/dehacked.c b/src/dehacked.c index baa5f13b3..9491aa6bc 100644 --- a/src/dehacked.c +++ b/src/dehacked.c @@ -2226,7 +2226,9 @@ static actionpointer_t actionpointers[] = {{A_CryingToMomma}, "A_CRYINGTOMOMMA"}, {{A_CheckFlags2}, "A_CHECKFLAGS2"}, {{A_DoNPCPain}, "A_DONPCPAIN"}, + {{A_PrepareRepeat}, "A_PREPAREREPEAT"}, {{A_Boss5ExtraRepeat}, "A_BOSS5EXTRAREPEAT"}, + {{A_Boss5Calm}, "A_BOSS5CALM"}, {{A_Boss5CheckOnGround}, "A_BOSS5CHECKONGROUND"}, {{A_Boss5CheckFalling}, "A_BOSS5CHECKFALLING"}, diff --git a/src/info.h b/src/info.h index 166402651..7c93457d6 100644 --- a/src/info.h +++ b/src/info.h @@ -240,7 +240,9 @@ void A_ParentTriesToSleep(); void A_CryingToMomma(); void A_CheckFlags2(); void A_DoNPCPain(); +void A_PrepareRepeat(); void A_Boss5ExtraRepeat(); +void A_Boss5Calm(); void A_Boss5CheckOnGround(); void A_Boss5CheckFalling(); diff --git a/src/p_enemy.c b/src/p_enemy.c index 283a83559..c7e1e90f3 100644 --- a/src/p_enemy.c +++ b/src/p_enemy.c @@ -267,6 +267,9 @@ void A_ParentTriesToSleep(mobj_t *actor); void A_CryingToMomma(mobj_t *actor); void A_CheckFlags2(mobj_t *actor); void A_DoNPCPain(mobj_t *actor); +void A_PrepareRepeat(mobj_t *actor); +void A_Boss5ExtraRepeat(mobj_t *actor); +void A_Boss5Calm(mobj_t *actor); void A_Boss5CheckOnGround(mobj_t *actor); void A_Boss5CheckFalling(mobj_t *actor); //for p_enemy.c @@ -11913,7 +11916,26 @@ void A_DoNPCPain(mobj_t *actor) P_InstaThrust(actor, actor->angle, -hspeed); } -// Function: A_Boss5PinchRepeat +// Function: A_PrepareRepeat +// +// Description: Simple way to prepare A_Repeat. +// +// var1 = value to set extravalue2 to +// var2 = unused +// +void A_PrepareRepeat(mobj_t *actor) +{ + INT32 locvar1 = var1; + //INT32 locvar2 = var2; +#ifdef HAVE_BLUA + if (LUA_CallAction("A_PrepareRepeat", actor)) + return; +#endif + + actor->extravalue2 = locvar1; +} + +// Function: A_Boss5ExtraRepeat // // Description: Simple way to prepare A_Repeat. // @@ -11952,6 +11974,23 @@ void A_Boss5ExtraRepeat(mobj_t *actor) actor->extravalue2 += locvar2; } +// Function: A_Boss5Calm +// +// Description: Simple way to disable MF2_FRET (and enable MF_SHOOTABLE the first time it's called) +// +// var1 = unused +// var2 = unused +// +void A_Boss5Calm(mobj_t *actor) +{ +#ifdef HAVE_BLUA + if (LUA_CallAction("A_Boss5Calm", actor)) + return; +#endif + actor->flags |= MF_SHOOTABLE; + actor->flags2 &= ~MF2_FRET; +} + // Function: A_Boss5CheckOnGround // // Description: Ground checker. From 6cd2b732731525c4c5db4ef06b3984fd4eef8abc Mon Sep 17 00:00:00 2001 From: Monster Iestyn Date: Fri, 3 May 2019 19:14:17 +0100 Subject: [PATCH 25/56] Hardcoded A_LookForBetter --- src/dehacked.c | 1 + src/info.h | 1 + src/p_enemy.c | 27 +++++++++++++++++++++++++++ 3 files changed, 29 insertions(+) diff --git a/src/dehacked.c b/src/dehacked.c index 9491aa6bc..6830d2c63 100644 --- a/src/dehacked.c +++ b/src/dehacked.c @@ -2231,6 +2231,7 @@ static actionpointer_t actionpointers[] = {{A_Boss5Calm}, "A_BOSS5CALM"}, {{A_Boss5CheckOnGround}, "A_BOSS5CHECKONGROUND"}, {{A_Boss5CheckFalling}, "A_BOSS5CHECKFALLING"}, + {{A_LookForBetter}, "A_LOOKFORBETTER"}, {{NULL}, "NONE"}, diff --git a/src/info.h b/src/info.h index 7c93457d6..11d96de1c 100644 --- a/src/info.h +++ b/src/info.h @@ -245,6 +245,7 @@ void A_Boss5ExtraRepeat(); void A_Boss5Calm(); void A_Boss5CheckOnGround(); void A_Boss5CheckFalling(); +void A_LookForBetter(); // ratio of states to sprites to mobj types is roughly 6 : 1 : 1 #define NUMMOBJFREESLOTS 256 diff --git a/src/p_enemy.c b/src/p_enemy.c index c7e1e90f3..32f7d2aad 100644 --- a/src/p_enemy.c +++ b/src/p_enemy.c @@ -272,6 +272,7 @@ void A_Boss5ExtraRepeat(mobj_t *actor); void A_Boss5Calm(mobj_t *actor); void A_Boss5CheckOnGround(mobj_t *actor); void A_Boss5CheckFalling(mobj_t *actor); +void A_LookForBetter(mobj_t *actor); //for p_enemy.c // @@ -12050,3 +12051,29 @@ void A_Boss5CheckFalling(mobj_t *actor) if (P_MobjFlip(actor)*actor->momz <= 0) P_SetMobjState(actor, locvar2); } + +// Function: A_LookForBetter +// +// Description: A_Look, except it finds a better target in multiplayer, and doesn't lose the target in singleplayer. +// +// var1 lower 16 bits = 0 - looks only in front, 1 - looks all around +// var1 upper 16 bits = distance limit +// var2 = unused +// +void A_LookForBetter(mobj_t *actor) +{ + INT32 locvar1 = var1; + //INT32 locvar2 = var2; + mobj_t *oldtarget = NULL; +#ifdef HAVE_BLUA + if (LUA_CallAction("A_LookForBetter", actor)) + return; +#endif + + P_SetTarget(&oldtarget, actor->target); + + if (!P_LookForPlayers(actor, (locvar1 & 65535), false, FixedMul((locvar1 >> 16)*FRACUNIT, actor->scale))) + P_SetTarget(&actor->target, oldtarget); + + A_FaceTarget(actor); +} From b4d8c2fa29183e8c6008b6a3463b1b781ef35ae4 Mon Sep 17 00:00:00 2001 From: Monster Iestyn Date: Fri, 3 May 2019 19:46:41 +0100 Subject: [PATCH 26/56] Hardcoded A_Boss5PinchShot --- src/dehacked.c | 1 + src/info.h | 1 + src/p_enemy.c | 37 +++++++++++++++++++++++++++++++++++++ 3 files changed, 39 insertions(+) diff --git a/src/dehacked.c b/src/dehacked.c index 6830d2c63..da806615d 100644 --- a/src/dehacked.c +++ b/src/dehacked.c @@ -2231,6 +2231,7 @@ static actionpointer_t actionpointers[] = {{A_Boss5Calm}, "A_BOSS5CALM"}, {{A_Boss5CheckOnGround}, "A_BOSS5CHECKONGROUND"}, {{A_Boss5CheckFalling}, "A_BOSS5CHECKFALLING"}, + {{A_Boss5PinchShot}, "A_BOSS5PINCHSHOT"}, {{A_LookForBetter}, "A_LOOKFORBETTER"}, {{NULL}, "NONE"}, diff --git a/src/info.h b/src/info.h index 11d96de1c..4db5d46b2 100644 --- a/src/info.h +++ b/src/info.h @@ -245,6 +245,7 @@ void A_Boss5ExtraRepeat(); void A_Boss5Calm(); void A_Boss5CheckOnGround(); void A_Boss5CheckFalling(); +void A_Boss5PinchShot(); void A_LookForBetter(); // ratio of states to sprites to mobj types is roughly 6 : 1 : 1 diff --git a/src/p_enemy.c b/src/p_enemy.c index 32f7d2aad..2fac0fa39 100644 --- a/src/p_enemy.c +++ b/src/p_enemy.c @@ -272,6 +272,7 @@ void A_Boss5ExtraRepeat(mobj_t *actor); void A_Boss5Calm(mobj_t *actor); void A_Boss5CheckOnGround(mobj_t *actor); void A_Boss5CheckFalling(mobj_t *actor); +void A_Boss5PinchShot(mobj_t *actor); void A_LookForBetter(mobj_t *actor); //for p_enemy.c @@ -12052,6 +12053,42 @@ void A_Boss5CheckFalling(mobj_t *actor) P_SetMobjState(actor, locvar2); } +// Function: A_Boss5PinchShot +// +// Description: Fires a missile directly upwards if in pinch. +// +// var1 = object # to shoot +// var2 = height offset (from default of +48 FU) +// +void A_Boss5PinchShot(mobj_t *actor) +{ + INT32 locvar1 = var1; + INT32 locvar2 = var2; + fixed_t zoffset; + mobj_t *missile; +#ifdef HAVE_BLUA + if (LUA_CallAction("A_Boss5PinchShot", actor)) + return; +#endif + + if (actor->health > actor->info->damage) + return; + + if (actor->eflags & MFE_VERTICALFLIP) + zoffset = actor->z + actor->height - FixedMul((48 + locvar2)*FRACUNIT, actor->scale); + else + zoffset = actor->z + FixedMul((48 + locvar2)*FRACUNIT, actor->scale); + + missile = P_SpawnPointMissile(actor, actor->x, actor->y, zoffset, locvar1, + actor->x, actor->y, zoffset); + + if (!missile) + return; + + missile->momx = missile->momy = 0; + missile->momz = P_MobjFlip(actor)*missile->info->speed/2; +} + // Function: A_LookForBetter // // Description: A_Look, except it finds a better target in multiplayer, and doesn't lose the target in singleplayer. From b03bfbabe4c7efdb508032c96905a278f985237a Mon Sep 17 00:00:00 2001 From: Monster Iestyn Date: Fri, 3 May 2019 20:00:31 +0100 Subject: [PATCH 27/56] Hardcode A_DoNPCSkid --- src/dehacked.c | 1 + src/info.h | 1 + src/p_enemy.c | 52 ++++++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 54 insertions(+) diff --git a/src/dehacked.c b/src/dehacked.c index da806615d..e824b0652 100644 --- a/src/dehacked.c +++ b/src/dehacked.c @@ -2225,6 +2225,7 @@ static actionpointer_t actionpointers[] = {{A_ParentTriesToSleep}, "A_PARENTTRIESTOSLEEP"}, {{A_CryingToMomma}, "A_CRYINGTOMOMMA"}, {{A_CheckFlags2}, "A_CHECKFLAGS2"}, + {{A_DoNPCSkid}, "A_DONPCSKID"}, {{A_DoNPCPain}, "A_DONPCPAIN"}, {{A_PrepareRepeat}, "A_PREPAREREPEAT"}, {{A_Boss5ExtraRepeat}, "A_BOSS5EXTRAREPEAT"}, diff --git a/src/info.h b/src/info.h index 4db5d46b2..cb98e6962 100644 --- a/src/info.h +++ b/src/info.h @@ -239,6 +239,7 @@ void A_WhoCaresIfYourSonIsABee(); void A_ParentTriesToSleep(); void A_CryingToMomma(); void A_CheckFlags2(); +void A_DoNPCSkid(); void A_DoNPCPain(); void A_PrepareRepeat(); void A_Boss5ExtraRepeat(); diff --git a/src/p_enemy.c b/src/p_enemy.c index 2fac0fa39..469730483 100644 --- a/src/p_enemy.c +++ b/src/p_enemy.c @@ -266,6 +266,7 @@ void A_WhoCaresIfYourSonIsABee(mobj_t *actor); void A_ParentTriesToSleep(mobj_t *actor); void A_CryingToMomma(mobj_t *actor); void A_CheckFlags2(mobj_t *actor); +void A_DoNPCSkid(mobj_t *actor); void A_DoNPCPain(mobj_t *actor); void A_PrepareRepeat(mobj_t *actor); void A_Boss5ExtraRepeat(mobj_t *actor); @@ -11861,6 +11862,57 @@ void A_CheckFlags2(mobj_t *actor) P_SetMobjState(actor, (statenum_t)locvar2); } +// Function: A_DoNPCSkid +// +// Description: Something that looks like a player is skidding. +// +// var1 = state to change to upon being slow enough +// var2 = minimum speed +// +void A_DoNPCSkid(mobj_t *actor) +{ + INT32 locvar1 = var1; + INT32 locvar2 = var2; + fixed_t x, y, z; +#ifdef HAVE_BLUA + if (LUA_CallAction("A_DoNPCSkid", actor)) + return; +#endif + + x = actor->x; + y = actor->y; + z = actor->y; + + if (!locvar2) + locvar2 = FRACUNIT/2; + + if ((FixedHypot(actor->momx, actor->momy) < locvar2) + || !P_TryMove(actor, actor->x + actor->momx, actor->y + actor->momy, false)) + { + actor->momx = actor->momy = 0; + P_SetMobjState(actor, locvar1); + return; + } + else + { + actor->momx = (2*actor->momx)/3; + actor->momy = (2*actor->momy)/3; + } + + P_TeleportMove(actor, x, y, z); + + // Spawn a particle every 3 tics. + if (!(leveltime % 3)) + { + mobj_t *particle = P_SpawnMobjFromMobj(actor, 0, 0, 0, MT_SPINDUST); + particle->tics = 10; + + P_SetScale(particle, 2*actor->scale/3); + particle->destscale = actor->scale; + P_SetObjectMomZ(particle, FRACUNIT, false); + } +} + // Function: A_DoNPCPain // // Description: Something that looks like a player was hit, put them in pain. From 0d7cd34882ace8dd254986b75993fd39139c60cd Mon Sep 17 00:00:00 2001 From: Monster Iestyn Date: Fri, 3 May 2019 20:52:56 +0100 Subject: [PATCH 28/56] Hardcoded A_Boss5MakeItRain --- src/dehacked.c | 1 + src/info.h | 1 + src/p_enemy.c | 37 +++++++++++++++++++++++++++++++++++++ 3 files changed, 39 insertions(+) diff --git a/src/dehacked.c b/src/dehacked.c index e824b0652..946e6f117 100644 --- a/src/dehacked.c +++ b/src/dehacked.c @@ -2233,6 +2233,7 @@ static actionpointer_t actionpointers[] = {{A_Boss5CheckOnGround}, "A_BOSS5CHECKONGROUND"}, {{A_Boss5CheckFalling}, "A_BOSS5CHECKFALLING"}, {{A_Boss5PinchShot}, "A_BOSS5PINCHSHOT"}, + {{A_Boss5MakeItRain}, "A_BOSS5MAKEITRAIN"}, {{A_LookForBetter}, "A_LOOKFORBETTER"}, {{NULL}, "NONE"}, diff --git a/src/info.h b/src/info.h index cb98e6962..948ecef97 100644 --- a/src/info.h +++ b/src/info.h @@ -247,6 +247,7 @@ void A_Boss5Calm(); void A_Boss5CheckOnGround(); void A_Boss5CheckFalling(); void A_Boss5PinchShot(); +void A_Boss5MakeItRain(); void A_LookForBetter(); // ratio of states to sprites to mobj types is roughly 6 : 1 : 1 diff --git a/src/p_enemy.c b/src/p_enemy.c index 469730483..10662ba88 100644 --- a/src/p_enemy.c +++ b/src/p_enemy.c @@ -274,6 +274,7 @@ void A_Boss5Calm(mobj_t *actor); void A_Boss5CheckOnGround(mobj_t *actor); void A_Boss5CheckFalling(mobj_t *actor); void A_Boss5PinchShot(mobj_t *actor); +void A_Boss5MakeItRain(mobj_t *actor); void A_LookForBetter(mobj_t *actor); //for p_enemy.c @@ -12141,6 +12142,42 @@ void A_Boss5PinchShot(mobj_t *actor) missile->momz = P_MobjFlip(actor)*missile->info->speed/2; } +// Function: A_Boss5MakeItRain +// +// Description: Pinch crisis. +// +// var1 = object # to shoot +// var2 = height offset (from default of +48 FU) +// +void A_Boss5MakeItRain(mobj_t *actor) +{ + INT32 locvar1 = var1; + INT32 locvar2 = var2; + INT32 offset = (48 + locvar2)<<16; // upper 16 bits, not fixed_t! + INT32 i; +#ifdef HAVE_BLUA + if (LUA_CallAction("A_Boss5MakeItRain", actor)) + return; +#endif + + actor->flags2 |= MF2_STRONGBOX; + + var1 = locvar1; + var2 = offset + 90; + A_TrapShot(actor); + + for (i = 0; i < 8; i++) + { + actor->angle += ANGLE_45; + + var1 = locvar1; + var2 = offset + (i & 1) ? 55 : 70; + A_TrapShot(actor); + } + + actor->extravalue2 = 0; +} + // Function: A_LookForBetter // // Description: A_Look, except it finds a better target in multiplayer, and doesn't lose the target in singleplayer. From df99e9328893f021e65c6764afb5039478a806f7 Mon Sep 17 00:00:00 2001 From: Monster Iestyn Date: Fri, 3 May 2019 22:58:54 +0100 Subject: [PATCH 29/56] Hardcoded A_Boss5FindWaypoint ...that took a while x_x --- src/dehacked.c | 1 + src/info.h | 1 + src/p_enemy.c | 188 +++++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 190 insertions(+) diff --git a/src/dehacked.c b/src/dehacked.c index 946e6f117..dbe0491ef 100644 --- a/src/dehacked.c +++ b/src/dehacked.c @@ -2225,6 +2225,7 @@ static actionpointer_t actionpointers[] = {{A_ParentTriesToSleep}, "A_PARENTTRIESTOSLEEP"}, {{A_CryingToMomma}, "A_CRYINGTOMOMMA"}, {{A_CheckFlags2}, "A_CHECKFLAGS2"}, + {{A_Boss5FindWaypoint}, "A_BOSS5FINDWAYPOINT"}, {{A_DoNPCSkid}, "A_DONPCSKID"}, {{A_DoNPCPain}, "A_DONPCPAIN"}, {{A_PrepareRepeat}, "A_PREPAREREPEAT"}, diff --git a/src/info.h b/src/info.h index 948ecef97..f052972e6 100644 --- a/src/info.h +++ b/src/info.h @@ -239,6 +239,7 @@ void A_WhoCaresIfYourSonIsABee(); void A_ParentTriesToSleep(); void A_CryingToMomma(); void A_CheckFlags2(); +void A_Boss5FindWaypoint(); void A_DoNPCSkid(); void A_DoNPCPain(); void A_PrepareRepeat(); diff --git a/src/p_enemy.c b/src/p_enemy.c index 10662ba88..227b8dd47 100644 --- a/src/p_enemy.c +++ b/src/p_enemy.c @@ -266,6 +266,7 @@ void A_WhoCaresIfYourSonIsABee(mobj_t *actor); void A_ParentTriesToSleep(mobj_t *actor); void A_CryingToMomma(mobj_t *actor); void A_CheckFlags2(mobj_t *actor); +void A_Boss5FindWaypoint(mobj_t *actor); void A_DoNPCSkid(mobj_t *actor); void A_DoNPCPain(mobj_t *actor); void A_PrepareRepeat(mobj_t *actor); @@ -11863,6 +11864,193 @@ void A_CheckFlags2(mobj_t *actor) P_SetMobjState(actor, (statenum_t)locvar2); } +// Function: A_Boss5FindWaypoint +// +// Description: Finds the next waypoint in sequence and sets it as its tracer. +// +// var1 = if 1, always go to ambush-marked waypoint. if 2, go to MT_BOSSFLYPOINT. +// var2 = unused +// +void A_Boss5FindWaypoint(mobj_t *actor) +{ + INT32 locvar1 = var1; + //INT32 locvar2 = var2; + boolean avoidcenter; + INT32 i; +#ifdef HAVE_BLUA + if (LUA_CallAction("A_Boss5FindWaypoint", actor)) + return; +#endif + + avoidcenter = !actor->tracer || (mobj->health == mobj->info->damage+1); + + if (locvar1 == 2) // look for the boss waypoint + { + for (i = 0; i < nummapthings; i++) + { + if (!mapthings[i].mobj) + continue; + if (mapthings[i].mobj->type != MT_BOSSFLYPOINT) + continue; + P_SetTarget(&actor->tracer, mapthings[i].mobj); + break; + } + if (i == nummapthings) + return; // no boss flypoints found + } + else if (locvar1 == 1) // always go to ambush-marked waypoint + { + if (avoidcenter) + goto nowaypoints; // if we can't go the center, why on earth are we doing this? + + for (i = 0; i < nummapthings; i++) + { + if (!mapthings[i].mobj) + continue; + if (mapthings[i].mobj->type != MT_FANGWAYPOINT) + continue; + if (mapthings[i].options & MTF_AMBUSH) + { + P_SetTarget(&actor->tracer, mapthings[i].mobj); + break; + } + } + + if (i == nummapthings) + goto nowaypoints; + } + else // locvar1 == 0 + { + fixed_t hackoffset = P_MobjFlip(actor)*56*FRACUNIT; + INT32 numwaypoints = 0; + mobj_t **waypoints; + INT32 key; + + actor->z += hackoffset; + + // first, count how many waypoints we have + for (i = 0; i < nummapthings; i++) + { + if (!mapthings[i].mobj) + continue; + if (mapthings[i].mobj->type != MT_FANGWAYPOINT) + continue; + if (actor->tracer == mapthings[i].mobj) // this was your tracer last time + continue; + if (mapthings[i].options & MTF_AMBUSH) + { + if (avoidcenter) + continue; + } + else if (mapthings[i].mobj->reactiontime > 0) + continue; + numwaypoints++; + } + + // players also count as waypoints apparently + if (actor->extravalue2 > 1) + { + for (i = 0; i < MAXPLAYERS; i++) + { + if (!playeringame[i]) + continue; + if (!players[i].mo) + continue; + if (players[i].spectator) + continue; + if (players[i].mo->health <= 0) + continue; + if (players[i].powers[pw_flashing]) + continue; + if (actor->tracer == players[i].mo) // this was your tracer last time + continue; + if (!P_CheckSight(actor, players[i].mo)) + continue; + numwaypoints++; + } + } + + if (!numwaypoints) + { + // restore z position + actor->z -= hackoffset; + goto nowaypoints; // no waypoints :( + } + + // allocate the table and reset count to zero + waypoints = Z_Calloc(sizeof(*waypoints)*numwaypoints, PU_STATIC, NULL); + numwaypoints = 0; + + // now find them again and add them to the table! + for (i = 0; i < nummapthings; i++) + { + if (!mapthings[i].mobj) + continue; + if (mapthings[i].mobj->type != MT_FANGWAYPOINT) + continue; + if (actor->tracer == mapthings[i].mobj) // this was your tracer last time + continue; + if (mapthings[i].options & MTF_AMBUSH) + { + if (avoidcenter) + continue; + waypoints[numwaypoints++] = mapthings[i].mobj; + } + else if (mapthings[i].mobj->reactiontime > 0) + mapthings[i].mobj->reactiontime--; + else + waypoints[numwaypoints++] = mapthings[i].mobj; + } + + if (actor->extravalue2 > 1) + { + for (i = 0; i < MAXPLAYERS; i++) + { + if (!playeringame[i]) + continue; + if (!players[i].mo) + continue; + if (players[i].spectator) + continue; + if (players[i].mo->health <= 0) + continue; + if (players[i].powers[pw_flashing]) + continue; + if (actor->tracer == players[i].mo) // this was your tracer last time + continue; + if (!P_CheckSight(actor, players[i].mo)) + continue; + waypoints[numwaypoints++] = players[i].mo; + } + } + + // restore z position + actor->z -= hackoffset; + + if (!numwaypoints) + goto nowaypoints; // ??? + + key = P_RandomKey(numwaypoints); + + P_SetTarget(&actor->tracer, waypoints[key]); + if (actor->tracer->type == MT_FANGWAYPOINT) + actor->tracer->reactiontime = numwaypoints/4; // Monster Iestyn: is this how it should be? I count center waypoints as waypoints unlike the original Lua script + Z_Free(waypoints); // free table + } + + // now face the tracer you just set! + A_FaceTracer(actor); + return; + +nowaypoints: + // no waypoints at all, guess the mobj has to disappear + if (actor->health) + P_KillMobj(actor, NULL, NULL, 0); + else + P_RemoveMobj(actor); + return; +} + // Function: A_DoNPCSkid // // Description: Something that looks like a player is skidding. From ee1fd72f9fe4a12d84919d4bc2083e0bf59ed227 Mon Sep 17 00:00:00 2001 From: Monster Iestyn Date: Fri, 3 May 2019 23:12:03 +0100 Subject: [PATCH 30/56] ah, forgot to do this --- src/p_enemy.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/p_enemy.c b/src/p_enemy.c index 227b8dd47..3b90f65a9 100644 --- a/src/p_enemy.c +++ b/src/p_enemy.c @@ -12028,7 +12028,10 @@ void A_Boss5FindWaypoint(mobj_t *actor) actor->z -= hackoffset; if (!numwaypoints) + { + Z_Free(waypoints); // free table goto nowaypoints; // ??? + } key = P_RandomKey(numwaypoints); From 54fea4d0b92ef5d61abccb79b49c2f70454fa5c1 Mon Sep 17 00:00:00 2001 From: Monster Iestyn Date: Fri, 3 May 2019 23:16:11 +0100 Subject: [PATCH 31/56] AND I forgot these checks, confound it --- src/p_enemy.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/p_enemy.c b/src/p_enemy.c index 3b90f65a9..85786eeec 100644 --- a/src/p_enemy.c +++ b/src/p_enemy.c @@ -11944,6 +11944,8 @@ void A_Boss5FindWaypoint(mobj_t *actor) } else if (mapthings[i].mobj->reactiontime > 0) continue; + if (!P_CheckSight(actor, mapthings[i].mobj)) + continue; numwaypoints++; } @@ -11998,7 +12000,7 @@ void A_Boss5FindWaypoint(mobj_t *actor) } else if (mapthings[i].mobj->reactiontime > 0) mapthings[i].mobj->reactiontime--; - else + else if (P_CheckSight(actor, mapthings[i].mobj)) waypoints[numwaypoints++] = mapthings[i].mobj; } From a5331f8024dc57d38a2ebdd6746d6060f06ef468 Mon Sep 17 00:00:00 2001 From: Monster Iestyn Date: Sat, 4 May 2019 17:15:59 +0100 Subject: [PATCH 32/56] Fix A_LookForBetter to not leave a stray thinker reference lingering potentially forever, as toaster pointed out it might do. --- src/p_enemy.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/p_enemy.c b/src/p_enemy.c index 85786eeec..d9f8af96f 100644 --- a/src/p_enemy.c +++ b/src/p_enemy.c @@ -12389,10 +12389,10 @@ void A_LookForBetter(mobj_t *actor) return; #endif - P_SetTarget(&oldtarget, actor->target); + oldtarget = actor->target; if (!P_LookForPlayers(actor, (locvar1 & 65535), false, FixedMul((locvar1 >> 16)*FRACUNIT, actor->scale))) - P_SetTarget(&actor->target, oldtarget); + actor->target = oldtarget; A_FaceTarget(actor); } From b205602db6be8ab32438509bd7bd148ca70cde85 Mon Sep 17 00:00:00 2001 From: Monster Iestyn Date: Sat, 4 May 2019 19:43:14 +0100 Subject: [PATCH 33/56] DO NOT USE FRACUNIT AS A LAZY WAY TO DO UPPER 16 BITS FOR ACTION VARS --- src/info.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/info.c b/src/info.c index fa24132a1..28ca6452d 100644 --- a/src/info.c +++ b/src/info.c @@ -1364,7 +1364,7 @@ state_t states[NUMSTATES] = {SPR_FANG, 5, 0, {A_Repeat}, 3, S_FANG_FIRE1, S_FANG_WAIT1}, // S_FANG_FIREREPEAT // End of loop {SPR_FANG, 19, 18, {A_LookForBetter}, 1, 0, S_FANG_LOBSHOT2}, // S_FANG_LOBSHOT1 - {SPR_FANG, 20, 18, {A_BrakLobShot}, MT_FBOMB, 32+FRACUNIT, S_FANG_WAIT1}, // S_FANG_LOBSHOT2 + {SPR_FANG, 20, 18, {A_BrakLobShot}, MT_FBOMB, 32+(1<<16), S_FANG_WAIT1}, // S_FANG_LOBSHOT2 {SPR_FANG, FF_ANIMATE|15, 70, {NULL}, 1, 5, S_FANG_WAIT2}, // S_FANG_WAIT1 {SPR_FANG, 0, 35, {A_Look}, 1, 0, S_FANG_IDLE1}, // S_FANG_WAIT2 @@ -1394,7 +1394,7 @@ state_t states[NUMSTATES] = {SPR_FANG, 17, 104, {NULL}, 0, 0, S_FANG_DIE5}, // S_FANG_DIE4 {SPR_FANG, 11, 0, {A_PlaySound}, sfx_jump, 0, S_FANG_DIE6}, // S_FANG_DIE5 - {SPR_FANG, 11, 1, {A_ZThrust}, 6, FRACUNIT|1, S_FANG_DIE7}, // S_FANG_DIE6 + {SPR_FANG, 11, 1, {A_ZThrust}, 6, (1<<16)|1, S_FANG_DIE7}, // S_FANG_DIE6 {SPR_FANG, 11, 1, {A_Boss5CheckFalling}, S_FANG_FLEEPATHING1, S_FANG_DIE8, S_FANG_DIE7}, // S_FANG_DIE7 {SPR_FANG, 12, 1, {A_Boss5CheckOnGround}, S_FANG_FLEEPATHING1, 0, S_FANG_DIE8}, // S_FANG_DIE8 From 445709037daab969df682e6cb9ab2f1c0bc31f97 Mon Sep 17 00:00:00 2001 From: Monster Iestyn Date: Sat, 4 May 2019 20:17:00 +0100 Subject: [PATCH 34/56] Fix some compiler complaints about A_Boss5FindWaypoint --- src/p_enemy.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/p_enemy.c b/src/p_enemy.c index d9f8af96f..e3573e604 100644 --- a/src/p_enemy.c +++ b/src/p_enemy.c @@ -15,6 +15,7 @@ #include "doomdef.h" #include "g_game.h" #include "p_local.h" +#include "p_setup.h" #include "r_main.h" #include "r_state.h" #include "s_sound.h" @@ -22,6 +23,7 @@ #include "m_misc.h" #include "r_things.h" #include "i_video.h" +#include "z_zone.h" #include "lua_hook.h" #ifdef HW3SOUND @@ -11876,13 +11878,13 @@ void A_Boss5FindWaypoint(mobj_t *actor) INT32 locvar1 = var1; //INT32 locvar2 = var2; boolean avoidcenter; - INT32 i; + UINT32 i; #ifdef HAVE_BLUA if (LUA_CallAction("A_Boss5FindWaypoint", actor)) return; #endif - avoidcenter = !actor->tracer || (mobj->health == mobj->info->damage+1); + avoidcenter = !actor->tracer || (actor->health == actor->info->damage+1); if (locvar1 == 2) // look for the boss waypoint { From 7b6b34212b6073cc241c9d4fd1a3cab687f50490 Mon Sep 17 00:00:00 2001 From: Monster Iestyn Date: Sat, 4 May 2019 20:20:34 +0100 Subject: [PATCH 35/56] Swap "S_TNTBARREL_EXPL1" for S_NULL as a temporary measure until I actually hardcode the explosion states. As of now, you can now compile this branch with no issues. But Fang won't work properly for a while yet, we'll get there don't worry. --- src/info.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/info.c b/src/info.c index 28ca6452d..851e565c9 100644 --- a/src/info.c +++ b/src/info.c @@ -5385,7 +5385,7 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] = sfx_None, // painsound S_NULL, // meleestate S_NULL, // missilestate - S_TNTBARREL_EXPL1, // deathstate + S_NULL, //S_TNTBARREL_EXPL1, // deathstate S_NULL, // xdeathstate sfx_s3k4e, // deathsound 20*FRACUNIT, // speed From 691ae982e741ef0a3d70959bc088d1a8ff2e7337 Mon Sep 17 00:00:00 2001 From: Monster Iestyn Date: Sat, 4 May 2019 21:31:46 +0100 Subject: [PATCH 36/56] S_FANG_SLIDE wasn't defined in the Lua script, despite being declared :| Also Fang seems to turn invisible after his first jump for some reason, and I can't figure out why??? --- src/dehacked.c | 1 - src/info.h | 1 - 2 files changed, 2 deletions(-) diff --git a/src/dehacked.c b/src/dehacked.c index dbe0491ef..dc30f7c7a 100644 --- a/src/dehacked.c +++ b/src/dehacked.c @@ -4561,7 +4561,6 @@ static const char *const STATE_LIST[] = { // array length left dynamic for sanit "S_FANG_BOUNCE4", "S_FANG_FALL1", "S_FANG_FALL2", - "S_FANG_SLIDE", "S_FANG_CHECKPATH1", "S_FANG_CHECKPATH2", "S_FANG_PATHINGCONT1", diff --git a/src/info.h b/src/info.h index f052972e6..6d115d564 100644 --- a/src/info.h +++ b/src/info.h @@ -1475,7 +1475,6 @@ typedef enum state S_FANG_BOUNCE4, S_FANG_FALL1, S_FANG_FALL2, - S_FANG_SLIDE, S_FANG_CHECKPATH1, S_FANG_CHECKPATH2, S_FANG_PATHINGCONT1, From d44265a217c1411abc6ba13e68447497e143b213 Mon Sep 17 00:00:00 2001 From: Monster Iestyn Date: Sat, 4 May 2019 22:38:14 +0100 Subject: [PATCH 37/56] Mystery solved, he was turning "invisible" because of this mistake in A_DoNPCSkid --- src/p_enemy.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/p_enemy.c b/src/p_enemy.c index e3573e604..807ec93a9 100644 --- a/src/p_enemy.c +++ b/src/p_enemy.c @@ -12077,7 +12077,7 @@ void A_DoNPCSkid(mobj_t *actor) x = actor->x; y = actor->y; - z = actor->y; + z = actor->z; if (!locvar2) locvar2 = FRACUNIT/2; From 09368963dd2c9f425c32cce65f9a97a4bba741fb Mon Sep 17 00:00:00 2001 From: Monster Iestyn Date: Sat, 4 May 2019 22:46:27 +0100 Subject: [PATCH 38/56] hardcode MT_FBOMB's MobjSpawn hook function --- src/p_mobj.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/p_mobj.c b/src/p_mobj.c index 5457c4f68..2b16d7cc7 100644 --- a/src/p_mobj.c +++ b/src/p_mobj.c @@ -9100,6 +9100,10 @@ mobj_t *P_SpawnMobj(fixed_t x, fixed_t y, fixed_t z, mobjtype_t type) case MT_NIGHTSSTAR: if (nummaprings >= 0) nummaprings++; + break; + case MT_FBOMB: + mobj->flags2 |= MF2_EXPLOSION; + break; default: break; } From 9e26d7bdaa721ed292a4ed413f85caa2bb96d519 Mon Sep 17 00:00:00 2001 From: Monster Iestyn Date: Sun, 5 May 2019 14:09:09 +0100 Subject: [PATCH 39/56] I just checked how P_LookForPlayers works, and it turns out it doesn't modify the target *unless* it returns true. So I guess we've no need to account for a change in target in A_LookForBetter after all? --- src/p_enemy.c | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/src/p_enemy.c b/src/p_enemy.c index 807ec93a9..b3039b74e 100644 --- a/src/p_enemy.c +++ b/src/p_enemy.c @@ -12385,16 +12385,11 @@ void A_LookForBetter(mobj_t *actor) { INT32 locvar1 = var1; //INT32 locvar2 = var2; - mobj_t *oldtarget = NULL; #ifdef HAVE_BLUA if (LUA_CallAction("A_LookForBetter", actor)) return; #endif - oldtarget = actor->target; - - if (!P_LookForPlayers(actor, (locvar1 & 65535), false, FixedMul((locvar1 >> 16)*FRACUNIT, actor->scale))) - actor->target = oldtarget; - + P_LookForPlayers(actor, (locvar1 & 65535), false, FixedMul((locvar1 >> 16)*FRACUNIT, actor->scale)); A_FaceTarget(actor); } From 289a4123772957bdd8fcaddf8de26e95d3f2ae89 Mon Sep 17 00:00:00 2001 From: Monster Iestyn Date: Sun, 5 May 2019 15:34:06 +0100 Subject: [PATCH 40/56] Hardcode the boss thinker function --- src/p_mobj.c | 44 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) diff --git a/src/p_mobj.c b/src/p_mobj.c index 2b16d7cc7..a7623e4d9 100644 --- a/src/p_mobj.c +++ b/src/p_mobj.c @@ -5013,6 +5013,47 @@ static void P_Boss4Thinker(mobj_t *mobj) A_FaceTarget(mobj); } +// +// AI for the fifth boss. +// +static void P_Boss5Thinker(mobj_t *mobj) +{ + if (!mobj->health) + { + if (mobj->state == &states[mobj->info->xdeathstate]) + mobj->momz -= (2*FRACUNIT)/3; + else if (mobj->tracer && P_AproxDistance(mobj->tracer->x - mobj->x, mobj->tracer->y - mobj->y) < 2*mobj->radius) + mobj->flags &= ~MF_NOCLIP; + } + else + { + if (mobj->flags2 & MF2_FRET && (leveltime & 1) + && mobj->state != &states[S_FANG_PAIN1] && mobj->state != &states[S_FANG_PAIN2]) + mobj->flags2 |= MF2_DONTDRAW; + else + mobj->flags2 &= ~MF2_DONTDRAW; + } + + if (mobj->state == &states[S_FANG_BOUNCE3] + || mobj->state == &states[S_FANG_BOUNCE4] + || mobj->state == &states[S_FANG_PINCHBOUNCE3] + || mobj->state == &states[S_FANG_PINCHBOUNCE4]) + { + if (P_MobjFlip(mobj)*mobj->momz > 0 + && abs(mobj->momx) < FRACUNIT/2 && abs(mobj->momy) < FRACUNIT/2 + && !P_IsObjectOnGround(mobj)) + { + mobj_t *prevtarget = mobj->target; + P_SetTarget(&mobj->target, NULL); + var1 = var2 = 0; + A_DoNPCPain(mobj); + P_SetTarget(&mobj->target, prevtarget); + P_SetMobjState(mobj, S_FANG_WALLHIT); + mobj->extravalue2++; + } + } +} + // // AI for Black Eggman // Note: You CANNOT have more than ONE Black Eggman @@ -7378,6 +7419,9 @@ void P_MobjThinker(mobj_t *mobj) case MT_EGGMOBILE4: P_Boss4Thinker(mobj); break; + case MT_FANG: + P_Boss5Thinker(mobj); + break; case MT_BLACKEGGMAN: P_Boss7Thinker(mobj); break; From 9c0c0ad3dcdb856c37e549fb99b0f5d051f4209b Mon Sep 17 00:00:00 2001 From: Monster Iestyn Date: Sun, 5 May 2019 16:03:34 +0100 Subject: [PATCH 41/56] hardcoded the boss's A_BossDeath behaviour. (also turned this part of the function into a switch case to make things neater) --- src/p_enemy.c | 132 +++++++++++++++++++++++++++++++++----------------- 1 file changed, 88 insertions(+), 44 deletions(-) diff --git a/src/p_enemy.c b/src/p_enemy.c index b3039b74e..c983a0dc3 100644 --- a/src/p_enemy.c +++ b/src/p_enemy.c @@ -3562,59 +3562,103 @@ bossjustdie: else if (P_MobjWasRemoved(mo)) return; #endif - if (mo->type == MT_BLACKEGGMAN || mo->type == MT_CYBRAKDEMON) + switch (mo->type) { - mo->flags |= MF_NOCLIP; - mo->flags &= ~MF_SPECIAL; + case MT_BLACKEGGMAN: + case MT_CYBRAKDEMON: + { + mo->flags |= MF_NOCLIP; + mo->flags &= ~MF_SPECIAL; - S_StartSound(NULL, sfx_befall); - } - else if (mo->type == MT_KOOPA) - { - junk.tag = 650; - EV_DoCeiling(&junk, raiseToHighest); - return; - } - else // eggmobiles - { - // Stop exploding and prepare to run. - P_SetMobjState(mo, mo->info->xdeathstate); - if (P_MobjWasRemoved(mo)) + S_StartSound(NULL, sfx_befall); + break; + } + case MT_KOOPA: + { + junk.tag = 650; + EV_DoCeiling(&junk, raiseToHighest); return; - - P_SetTarget(&mo->target, NULL); - - // Flee! Flee! Find a point to escape to! If none, just shoot upward! - // scan the thinkers to find the runaway point - for (th = thinkercap.next; th != &thinkercap; th = th->next) + } + case MT_FANG: { - if (th->function.acp1 != (actionf_p1)P_MobjThinker) - continue; - - mo2 = (mobj_t *)th; - - if (mo2->type == MT_BOSSFLYPOINT) + if (mo->tracer) { - // If this one's closer then the last one, go for it. - if (!mo->target || - P_AproxDistance(P_AproxDistance(mo->x - mo2->x, mo->y - mo2->y), mo->z - mo2->z) < - P_AproxDistance(P_AproxDistance(mo->x - mo->target->x, mo->y - mo->target->y), mo->z - mo->target->z)) - P_SetTarget(&mo->target, mo2); - // Otherwise... Don't! + var1 = var2 = 0; + A_Boss5Jump(mo); + mo->momx = ((16 - 1)*mo->momx)/16; + mo->momy = ((16 - 1)*mo->momy)/16; + if (!(mo->flags2 & MF2_AMBUSH)) + { + const fixed_t time = FixedHypot(mo->tracer->x - mo->x, mo->tracer->y - mo->y)/FixedHypot(mo->momx, mo->momy); + const fixed_t speed = 64*FRACUNIT; + mobj_t *pole = P_SpawnMobj( + mo->tracer->x - P_ReturnThrustX(mo->tracer, mo->tracer->angle, speed*time), + mo->tracer->y - P_ReturnThrustY(mo->tracer, mo->tracer->angle, speed*time), + mo->tracer->floorz + 4*FRACUNIT, + MT_FSGNB); + P_SetTarget(&pole->tracer, P_SpawnMobj( + pole->x + P_ReturnThrustX(pole, mo->tracer->angle, FRACUNIT), + pole->y + P_ReturnThrustY(pole, mo->tracer->angle, FRACUNIT), + pole->z + 256*FRACUNIT, + MT_FSGNA)); + pole->angle = mo->tracer->angle; + pole->tracer->angle = pole->angle - ANGLE_90; + pole->momx = P_ReturnThrustX(pole, pole->angle, speed); + pole->momy = P_ReturnThrustY(pole, pole->angle, speed); + pole->tracer->momx = pole->momx; + pole->tracer->momy = pole->momy; + } } + else + { + P_SetObjectMomZ(mo, 10*FRACUNIT, false); + mo->flags |= MF_NOGRAVITY; + } + mo->flags |= MF_NOCLIP|MF_NOCLIPHEIGHT; + return; } - - mo->flags |= MF_NOGRAVITY|MF_NOCLIP; - mo->flags |= MF_NOCLIPHEIGHT; - - if (mo->target) + default: //eggmobiles { - mo->angle = R_PointToAngle2(mo->x, mo->y, mo->target->x, mo->target->y); - mo->flags2 |= MF2_BOSSFLEE; - mo->momz = FixedMul(FixedDiv(mo->target->z - mo->z, P_AproxDistance(mo->x-mo->target->x,mo->y-mo->target->y)), FixedMul(2*FRACUNIT, mo->scale)); + // Stop exploding and prepare to run. + P_SetMobjState(mo, mo->info->xdeathstate); + if (P_MobjWasRemoved(mo)) + return; + + P_SetTarget(&mo->target, NULL); + + // Flee! Flee! Find a point to escape to! If none, just shoot upward! + // scan the thinkers to find the runaway point + for (th = thinkercap.next; th != &thinkercap; th = th->next) + { + if (th->function.acp1 != (actionf_p1)P_MobjThinker) + continue; + + mo2 = (mobj_t *)th; + + if (mo2->type == MT_BOSSFLYPOINT) + { + // If this one's closer then the last one, go for it. + if (!mo->target || + P_AproxDistance(P_AproxDistance(mo->x - mo2->x, mo->y - mo2->y), mo->z - mo2->z) < + P_AproxDistance(P_AproxDistance(mo->x - mo->target->x, mo->y - mo->target->y), mo->z - mo->target->z)) + P_SetTarget(&mo->target, mo2); + // Otherwise... Don't! + } + } + + mo->flags |= MF_NOGRAVITY|MF_NOCLIP; + mo->flags |= MF_NOCLIPHEIGHT; + + if (mo->target) + { + mo->angle = R_PointToAngle2(mo->x, mo->y, mo->target->x, mo->target->y); + mo->flags2 |= MF2_BOSSFLEE; + mo->momz = FixedMul(FixedDiv(mo->target->z - mo->z, P_AproxDistance(mo->x-mo->target->x,mo->y-mo->target->y)), FixedMul(2*FRACUNIT, mo->scale)); + } + else + mo->momz = FixedMul(2*FRACUNIT, mo->scale); + break; } - else - mo->momz = FixedMul(2*FRACUNIT, mo->scale); } if (mo->type == MT_EGGMOBILE2) From f7fbf404376dc3cb91999aebab5d566bd90d0a62 Mon Sep 17 00:00:00 2001 From: Monster Iestyn Date: Sun, 5 May 2019 16:42:50 +0100 Subject: [PATCH 42/56] Hardcoded MT_FSGNA's MobjThinker hook function --- src/p_mobj.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/p_mobj.c b/src/p_mobj.c index a7623e4d9..bc43fbe1e 100644 --- a/src/p_mobj.c +++ b/src/p_mobj.c @@ -7330,6 +7330,10 @@ void P_MobjThinker(mobj_t *mobj) mobj->angle += (angle_t)mobj->movecount; } break; + case MT_FSGNA: + if (mobj->movedir) + mobj->angle += mobj->movedir; + break; default: if (mobj->fuse) { // Scenery object fuse! Very basic! From 373d12cb82e26fe70657dc9821146f1486df893e Mon Sep 17 00:00:00 2001 From: Monster Iestyn Date: Sun, 5 May 2019 17:36:55 +0100 Subject: [PATCH 43/56] Hardcode "slapstick" --- src/p_map.c | 52 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 52 insertions(+) diff --git a/src/p_map.c b/src/p_map.c index ceaa6ca24..ffe6cf916 100644 --- a/src/p_map.c +++ b/src/p_map.c @@ -551,6 +551,44 @@ static void P_DoTailsCarry(player_t *sonic, player_t *tails) } } +// Boss 5 post-defeat comedy +static void P_SlapStick(mobj_t *fang, mobj_t *pole) +{ + fixed_t momx1, momx2, momy1, momy2; + +#define dist 3 + momx1 = pole->momx/dist; + momy1 = pole->momy/dist; + momx2 = fang->momx/dist; + momy2 = fang->momy/dist; + + pole->tracer->momx = momx1 + (dist-1)*momx2; + pole->tracer->momy = momy1 + (dist-1)*momy2; + fang->momx = (dist-1)*momx1 + momx2; + fang->momy = (dist-1)*momy1 + momy2; +#undef dist + + P_SetMobjState(pole, pole->info->deathstate); + + P_SetObjectMomZ(pole->tracer, 6*FRACUNIT, false); + pole->tracer->flags &= ~(MF_NOGRAVITY|MF_NOCLIP); + pole->tracer->movedir = ANGLE_67h; + if ((R_PointToAngle(fang->x - pole->tracer->x, fang->y - pole->tracer->y) - pole->angle) > ANGLE_180) + pole->tracer->movedir = InvAngle(pole->tracer->movedir); + + P_SetObjectMomZ(fang, 14*FRACUNIT, false); + fang->flags |= MF_NOGRAVITY|MF_NOCLIP; + P_SetMobjState(fang, fang->info->xdeathstate); + + pole->tracer->tics = pole->tics = fang->tics; + + var1 = var2 = 0; + A_Scream(pole->tracer); + S_StartSound(fang, sfx_altdi1); + + P_SetTarget(&pole->tracer, NULL); +} + // // PIT_CheckThing // @@ -780,6 +818,20 @@ static boolean PIT_CheckThing(mobj_t *thing) } #endif + if (tmthing->type == MT_FANG && thing->type == MT_FSGNB) + { + if (thing->z > tmthing->z + tmthing->height) + return true; // overhead + if (thing->z + thing->height < tmthing->z) + return true; // underneath + if (!thing->tracer) + return true; + P_SlapStick(tmthing, thing); + // no return value was used in the original prototype script at this point, + // so I'm assuming we fall back on the solid code to determine how it all ends? + // -- Monster Iestyn + } + // Billiards mines! if (thing->type == MT_BIGMINE) { From b0087616c73bfe7c7866ad427e7d39dbcb43288c Mon Sep 17 00:00:00 2001 From: Monster Iestyn Date: Sun, 5 May 2019 18:22:19 +0100 Subject: [PATCH 44/56] Hardcoded the boss's TouchSpecial hook. Also cleaned up this part of P_TouchSpecialThing a bit while I'm here --- src/p_inter.c | 106 ++++++++++++++++++++++++++++++++++---------------- 1 file changed, 72 insertions(+), 34 deletions(-) diff --git a/src/p_inter.c b/src/p_inter.c index 177b8d16e..70050a4cd 100644 --- a/src/p_inter.c +++ b/src/p_inter.c @@ -375,44 +375,82 @@ void P_TouchSpecialThing(mobj_t *special, mobj_t *toucher, boolean heightcheck) /////ENEMIES & BOSSES!!///////////////////////////////// //////////////////////////////////////////////////////// - if (special->type == MT_BLACKEGGMAN) + switch (special->type) { - P_DamageMobj(toucher, special, special, 1, 0); // ouch - return; - } - - if (special->type == MT_BIGMINE) - { - special->momx = toucher->momx/3; - special->momy = toucher->momy/3; - special->momz = toucher->momz/3; - toucher->momx /= -8; - toucher->momy /= -8; - toucher->momz /= -8; - special->flags &= ~MF_SPECIAL; - if (special->info->activesound) - S_StartSound(special, special->info->activesound); - P_SetTarget(&special->tracer, toucher); - player->homing = 0; - return; - } - - if (special->type == MT_GSNAPPER && !elementalpierce - && toucher->z < special->z + special->height && toucher->z + toucher->height > special->z - && P_DamageMobj(toucher, special, special, 1, DMG_SPIKE)) - return; // Can only hit snapper from above - - if (special->type == MT_SPINCUSHION - && (P_MobjFlip(toucher)*(toucher->z - (special->z + special->height/2)) > 0)) - { - if (player->pflags & PF_BOUNCING) + case MT_BLACKEGGMAN: { - toucher->momz = -toucher->momz; - P_DoAbilityBounce(player, false); + P_DamageMobj(toucher, special, special, 1, 0); // ouch return; } - else if (P_DamageMobj(toucher, special, special, 1, DMG_SPIKE)) - return; // Cannot hit sharp from above + case MT_BIGMINE: + { + special->momx = toucher->momx/3; + special->momy = toucher->momy/3; + special->momz = toucher->momz/3; + toucher->momx /= -8; + toucher->momy /= -8; + toucher->momz /= -8; + special->flags &= ~MF_SPECIAL; + if (special->info->activesound) + S_StartSound(special, special->info->activesound); + P_SetTarget(&special->tracer, toucher); + player->homing = 0; + return; + } + case MT_GSNAPPER: + if (!elementalpierce + && toucher->z < special->z + special->height + && toucher->z + toucher->height > special->z + && P_DamageMobj(toucher, special, special, 1, DMG_SPIKE)) + return; // Can only hit snapper from above + break; + + case MT_SPINCUSHION: + if (P_MobjFlip(toucher)*(toucher->z - (special->z + special->height/2)) > 0) + { + if (player->pflags & PF_BOUNCING) + { + toucher->momz = -toucher->momz; + P_DoAbilityBounce(player, false); + return; + } + else if (P_DamageMobj(toucher, special, special, 1, DMG_SPIKE)) + return; // Cannot hit sharp from above + } + break; + case MT_FANG: + if (!player->powers[pw_flashing] + && !(player->charability == CA_TWINSPIN && player->panim == PA_ABILITY) + && !(player->charability2 == CA2_MELEE && player->panim == PA_ABILITY2)) + { + if ((special->state == &states[S_FANG_BOUNCE3] + || special->state == &states[S_FANG_BOUNCE4] + || special->state == &states[S_FANG_PINCHBOUNCE3] + || special->state == &states[S_FANG_PINCHBOUNCE4]) + && P_MobjFlip(special)*((special->z + special->height/2) - (toucher->z - toucher->height/2)) > 0) + { + P_DamageMobj(toucher, special, special, 1, 0); + P_SetTarget(&special->tracer, toucher); + + if (special->state == &states[S_FANG_PINCHBOUNCE3] + || special->state == &states[S_FANG_PINCHBOUNCE4]) + P_SetMobjState(special, S_FANG_PINCHPATHINGSTART2); + else + { + var1 = var2 = 4; + A_Boss5ExtraRepeat(special); + P_SetMobjState(special, S_FANG_PATHINGCONT2); //S_FANG_PATHINGCONT1 if you want him to drop a bomb on the player + } + if (special->eflags & MFE_VERTICALFLIP) + special->z = toucher->z - special->height; + else + special->z = toucher->z + toucher->height; + return; + } + } + break; + default: + break; } if (((player->powers[pw_carry] == CR_NIGHTSMODE) && (player->pflags & PF_DRILLING)) From b9611c3a8130974122727b11cf73584ba35b5245 Mon Sep 17 00:00:00 2001 From: Monster Iestyn Date: Sun, 5 May 2019 19:16:30 +0100 Subject: [PATCH 45/56] Hardcoded the cork's stun-you-even-while-flashing behaviour --- src/p_inter.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/p_inter.c b/src/p_inter.c index 70050a4cd..68f1782c5 100644 --- a/src/p_inter.c +++ b/src/p_inter.c @@ -3390,9 +3390,11 @@ boolean P_DamageMobj(mobj_t *target, mobj_t *inflictor, mobj_t *source, INT32 da else if (player->powers[pw_invulnerability] || player->powers[pw_flashing] // ignore bouncing & such in invulnerability || player->powers[pw_super]) { - if (force || (inflictor && (inflictor->flags & MF_MISSILE) - && (inflictor->flags2 & MF2_SUPERFIRE) - && player->powers[pw_super])) + if (force + || (player->powers[pw_super] + && inflictor && inflictor->flags & MF_MISSILE && inflictor->flags2 & MF2_SUPERFIRE) // Super Sonic is stunned! + || (player->powers[pw_flashing] + && source && source->type == MT_FANG && inflictor && inflictor->type == MT_CORK)) // Fang's cork bullets knock you back even when flashing { #ifdef HAVE_BLUA if (!LUAh_MobjDamage(target, inflictor, source, damage, damagetype)) @@ -3400,8 +3402,7 @@ boolean P_DamageMobj(mobj_t *target, mobj_t *inflictor, mobj_t *source, INT32 da P_SuperDamage(player, inflictor, source, damage); return true; } - else - return false; + return false; } #ifdef HAVE_BLUA else if (LUAh_MobjDamage(target, inflictor, source, damage, damagetype)) From ee0c4b42a601d2ebd55dcb0e71179c68b1c9c863 Mon Sep 17 00:00:00 2001 From: Monster Iestyn Date: Sun, 5 May 2019 21:03:15 +0100 Subject: [PATCH 46/56] fix P_CheckSight to consider FOFs that completely block the view (this could probably be in its own branch to be tested properly, but I'm on a roll with this atm) --- src/p_sight.c | 38 +++++++++++++++++++++++++++++++++++++- 1 file changed, 37 insertions(+), 1 deletion(-) diff --git a/src/p_sight.c b/src/p_sight.c index 556041585..579b94e56 100644 --- a/src/p_sight.c +++ b/src/p_sight.c @@ -254,7 +254,8 @@ static boolean P_CrossSubsector(size_t num, register los_t *los) // no wall to block sight with? if ((front = seg->frontsector)->floorheight == (back = seg->backsector)->floorheight && - front->ceilingheight == back->ceilingheight) + front->ceilingheight == back->ceilingheight + && !front->ffloors && !back->ffloors) continue; // possible occluder @@ -288,6 +289,41 @@ static boolean P_CrossSubsector(size_t num, register los_t *los) if (los->topslope <= los->bottomslope) return false; + + // Monster Iestyn: check FOFs! + if (front->ffloors || back->ffloors) + { + ffloor_t *rover; + fixed_t topslope, bottomslope; + // check front sector's FOFs first + for (rover = front->ffloors; rover; rover = rover->next) + { + if (!(rover->flags & FF_EXISTS) + || !(rover->flags & FF_RENDERSIDES) || rover->flags & FF_TRANSLUCENT) + { + continue; + } + topslope = FixedDiv(*rover->topheight - los->sightzstart , frac); + bottomslope = FixedDiv(*rover->bottomheight - los->sightzstart , frac); + if (topslope >= los->topslope && bottomslope <= los->bottomslope) + return false; // view completely blocked + } + // check back sector's FOFs as well + for (rover = back->ffloors; rover; rover = rover->next) + { + if (!(rover->flags & FF_EXISTS) + || !(rover->flags & FF_RENDERSIDES) || rover->flags & FF_TRANSLUCENT) + { + continue; + } + topslope = FixedDiv(*rover->topheight - los->sightzstart , frac); + bottomslope = FixedDiv(*rover->bottomheight - los->sightzstart , frac); + if (topslope >= los->topslope && bottomslope <= los->bottomslope) + return false; // view completely blocked + } + // TODO: figure out if it's worth considering partially blocked cases or not? + // maybe to adjust los's top/bottom slopes if needed + } } // passed the subsector ok From ea951eef78bce86365a503ad83f4c49a2a2e0e40 Mon Sep 17 00:00:00 2001 From: Monster Iestyn Date: Sun, 5 May 2019 21:16:44 +0100 Subject: [PATCH 47/56] fix an inconsistency I introduced between counting the waypoints and finding them again --- src/p_enemy.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/p_enemy.c b/src/p_enemy.c index c983a0dc3..adc0f88f0 100644 --- a/src/p_enemy.c +++ b/src/p_enemy.c @@ -12042,12 +12042,15 @@ void A_Boss5FindWaypoint(mobj_t *actor) { if (avoidcenter) continue; - waypoints[numwaypoints++] = mapthings[i].mobj; } else if (mapthings[i].mobj->reactiontime > 0) + { mapthings[i].mobj->reactiontime--; - else if (P_CheckSight(actor, mapthings[i].mobj)) - waypoints[numwaypoints++] = mapthings[i].mobj; + continue; + } + if (!P_CheckSight(actor, mapthings[i].mobj)) + continue; + waypoints[numwaypoints++] = mapthings[i].mobj; } if (actor->extravalue2 > 1) From 742b11c0ff8c7982f176019d0a71a8ed79824c8c Mon Sep 17 00:00:00 2001 From: Monster Iestyn Date: Tue, 21 May 2019 21:51:19 +0100 Subject: [PATCH 48/56] Hardcoded ACZ3.wad's version of A_TNTExplode under the name of A_Boss5BombExplode. After a lot of confusion and silly misunderstandings on my part (as well as a lot of mess cleaning), I've finally got there! The states for the actual bomb explosion effect itself are yet to be hardcoded, but that I'll do tomorrow afternoon probably. --- src/dehacked.c | 1 + src/info.h | 1 + src/p_enemy.c | 81 ++++++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 83 insertions(+) diff --git a/src/dehacked.c b/src/dehacked.c index dc30f7c7a..0af1520fd 100644 --- a/src/dehacked.c +++ b/src/dehacked.c @@ -2236,6 +2236,7 @@ static actionpointer_t actionpointers[] = {{A_Boss5PinchShot}, "A_BOSS5PINCHSHOT"}, {{A_Boss5MakeItRain}, "A_BOSS5MAKEITRAIN"}, {{A_LookForBetter}, "A_LOOKFORBETTER"}, + {{A_Boss5BombExplode}, "A_BOSS5BOMBEXPLODE"}, {{NULL}, "NONE"}, diff --git a/src/info.h b/src/info.h index 6d115d564..b3cbba78f 100644 --- a/src/info.h +++ b/src/info.h @@ -250,6 +250,7 @@ void A_Boss5CheckFalling(); void A_Boss5PinchShot(); void A_Boss5MakeItRain(); void A_LookForBetter(); +void A_Boss5BombExplode(); // ratio of states to sprites to mobj types is roughly 6 : 1 : 1 #define NUMMOBJFREESLOTS 256 diff --git a/src/p_enemy.c b/src/p_enemy.c index adc0f88f0..664e3b9b0 100644 --- a/src/p_enemy.c +++ b/src/p_enemy.c @@ -279,6 +279,7 @@ void A_Boss5CheckFalling(mobj_t *actor); void A_Boss5PinchShot(mobj_t *actor); void A_Boss5MakeItRain(mobj_t *actor); void A_LookForBetter(mobj_t *actor); +void A_Boss5BombExplode(mobj_t *actor); //for p_enemy.c // @@ -12440,3 +12441,83 @@ void A_LookForBetter(mobj_t *actor) P_LookForPlayers(actor, (locvar1 & 65535), false, FixedMul((locvar1 >> 16)*FRACUNIT, actor->scale)); A_FaceTarget(actor); } + +/* * Spawns a dust ring. + * The dust ring behaves slightly randomly so it doesn't look too uniform. + * + * \param mobjtype Thing type to make a ring of. + * \param div Amount of things to spawn on the ring. + * \param x Center X coordinates. + * \param y Center Y coordinates. + * \param z Center Z coordinates. + * \param radius Radius. + * \param speed Additional thrust on particles. + * \param scale Scale. + */ +static void P_DustRing(mobjtype_t mobjtype, UINT32 div, fixed_t x, fixed_t y, fixed_t z, fixed_t radius, fixed_t speed, fixed_t scale) +{ + angle_t ang = FixedAngle(FixedDiv(360*FRACUNIT, div*FRACUNIT)); //(ANGLE_180/div)*2; + UINT32 i; + + // it turned out the radius was effectively nullified thanks to errors in the original script + // BUT people preferred how it looked before I "fixed" it, so I got rid of the radius calculations altogether + // this was a bit of a mess to sort out, but at least it's probably somewhat fine now? + // -- Monster Iestyn (21/05/19) + (void)radius; + + for (i = 0; i < div; i++) + { + mobj_t *dust = P_SpawnMobj( + x, //+ FixedMul(radius, FINECOSINE((ang*i) >> ANGLETOFINESHIFT)), + y, //+ FixedMul(radius, FINESINE((ang*i) >> ANGLETOFINESHIFT)), + z, + mobjtype + ); + + dust->angle = ang*i + ANGLE_90; + P_SetScale(dust, scale); + dust->destscale = FixedMul(4*FRACUNIT + P_RandomFixed(), scale); + dust->scalespeed = scale/24; + P_Thrust(dust, ang*i, speed + FixedMul(P_RandomFixed(), scale)); + dust->momz = P_SignedRandom()*scale/64; + } +} + +// Function: A_Boss5BombExplode +// +// Description: Boss 5's bomb exploding. +// +// var1 = Thing type to spawn as dust +// var2 = unused +// +void A_Boss5BombExplode(mobj_t *actor) +{ + INT32 locvar1 = var1; + //INT32 locvar2 = var2; +#ifdef HAVE_BLUA + if (LUA_CallAction("A_Boss5BombExplode", actor)) + return; +#endif + + // The original Lua script did not use |= to add flags but just set these flags exactly apparently? + // (I may modify this later) + // -- Monster Iestyn (21/05/19) + actor->flags = MF_NOCLIP|MF_NOGRAVITY|MF_NOBLOCKMAP; + actor->flags2 = MF2_EXPLOSION; + + if (actor->target) + P_RadiusAttack(actor, actor->target, 7*actor->radius, 0); + + P_DustRing(locvar1, 4, actor->x, actor->y, actor->z+actor->height, 2*actor->radius, 0, actor->scale); + P_DustRing(locvar1, 6, actor->x, actor->y, actor->z+actor->height/2, 3*actor->radius, FRACUNIT, actor->scale); + //P_StartQuake(9*actor->scale, TICRATE/6, {actor->x, actor->y, actor->z}, 20*actor->radius); + // the above does not exist, so we set the quake values directly instead + quake.intensity = 9*actor->scale; + quake.time = TICRATE/6; + // the following quake values have no effect atm? ah well, may as well set them anyway + { + mappoint_t q_epicenter = {actor->x, actor->y, actor->z}; + quake.epicenter = &q_epicenter; + } + quake.radius = 20*actor->radius; +} From e60b0b1a80b06f28166d58ffaa50015e3bd7caff Mon Sep 17 00:00:00 2001 From: Monster Iestyn Date: Thu, 23 May 2019 21:08:27 +0100 Subject: [PATCH 49/56] Update hw_light.c (though I'm not sure why we bother, since coronas have been disabled for a decade now) --- src/hardware/hw_light.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/hardware/hw_light.c b/src/hardware/hw_light.c index 2515c6a86..16929dd5e 100644 --- a/src/hardware/hw_light.c +++ b/src/hardware/hw_light.c @@ -199,7 +199,9 @@ light_t *t_lspr[NUMSPRITES] = &lspr[REDBALL_L], // SPR_EFIR // Boss 5 (Arid Canyon) - &lspr[NOLIGHT], // SPR_EGGQ + &lspr[NOLIGHT], //SPR_FANG // replaces EGGQ + &lspr[NOLIGHT], //SPR_FBOM + &lspr[NOLIGHT], //SPR_FSGN // Boss 6 (Red Volcano) &lspr[NOLIGHT], // SPR_EEGR From 677801f5fffe99137a17f98b57c762928b27f677 Mon Sep 17 00:00:00 2001 From: Monster Iestyn Date: Thu, 23 May 2019 21:51:58 +0100 Subject: [PATCH 50/56] Hardcode the bomb's explosion states, the dust object type and states, and the sprite prefixes for both --- src/dehacked.c | 15 ++++++++++++++ src/hardware/hw_light.c | 2 ++ src/info.c | 44 ++++++++++++++++++++++++++++++++++++++++- src/info.h | 17 ++++++++++++++++ 4 files changed, 77 insertions(+), 1 deletion(-) diff --git a/src/dehacked.c b/src/dehacked.c index ab79b21a1..6d1f58990 100644 --- a/src/dehacked.c +++ b/src/dehacked.c @@ -4788,6 +4788,20 @@ static const char *const STATE_LIST[] = { // array length left dynamic for sanit "S_FBOMB1", "S_FBOMB2", + "S_FBOMB_EXPL1", + "S_FBOMB_EXPL2", + "S_FBOMB_EXPL3", + "S_FBOMB_EXPL4", + "S_FBOMB_EXPL5", + "S_FBOMB_EXPL6", + "S_TNTDUST_1", + "S_TNTDUST_2", + "S_TNTDUST_3", + "S_TNTDUST_4", + "S_TNTDUST_5", + "S_TNTDUST_6", + "S_TNTDUST_7", + "S_TNTDUST_8", "S_FSGNA", "S_FSGNB", "S_FSGNC", @@ -7095,6 +7109,7 @@ static const char *const MOBJTYPE_LIST[] = { // array length left dynamic for s // Boss 5 "MT_FANG", "MT_FBOMB", + "MT_TNTDUST", // also used by barrel "MT_FSGNA", "MT_FSGNB", "MT_FANGWAYPOINT", diff --git a/src/hardware/hw_light.c b/src/hardware/hw_light.c index 16929dd5e..90d02fdf8 100644 --- a/src/hardware/hw_light.c +++ b/src/hardware/hw_light.c @@ -202,6 +202,8 @@ light_t *t_lspr[NUMSPRITES] = &lspr[NOLIGHT], //SPR_FANG // replaces EGGQ &lspr[NOLIGHT], //SPR_FBOM &lspr[NOLIGHT], //SPR_FSGN + &lspr[REDBALL_L], //SPR_BARX // bomb explosion (also used by barrel) + &lspr[NOLIGHT], //SPR_BARD // bomb dust (also used by barrel) // Boss 6 (Red Volcano) &lspr[NOLIGHT], // SPR_EEGR diff --git a/src/info.c b/src/info.c index 04b138e8b..e03b63a65 100644 --- a/src/info.c +++ b/src/info.c @@ -90,6 +90,8 @@ char sprnames[NUMSPRITES + 1][5] = "FANG", // replaces EGGQ "FBOM", "FSGN", + "BARX", // bomb explosion (also used by barrel) + "BARD", // bomb dust (also used by barrel) // Boss 6 (Red Volcano) "EGGR", @@ -1410,6 +1412,20 @@ state_t states[NUMSTATES] = {SPR_FBOM, 0, 1, {A_GhostMe}, 0, 0, S_FBOMB2}, // S_FBOMB1 {SPR_FBOM, 1, 1, {A_GhostMe}, 0, 0, S_FBOMB1}, // S_FBOMB2 + {SPR_BARX, 0|FF_FULLBRIGHT, 3, {A_SetObjectFlags}, MF_NOCLIP|MF_NOGRAVITY|MF_NOBLOCKMAP, 0, S_FBOMB_EXPL2}, // S_FBOMB_EXPL1 + {SPR_BARX, 1|FF_FULLBRIGHT, 2, {A_Boss5BombExplode}, MT_TNTDUST, 0, S_FBOMB_EXPL3}, // S_FBOMB_EXPL2 + {SPR_BARX, 1|FF_FULLBRIGHT, 1, {NULL}, 0, 0, S_FBOMB_EXPL4}, // S_FBOMB_EXPL3 + {SPR_BARX, 2|FF_FULLBRIGHT, 3, {NULL}, 0, 0, S_FBOMB_EXPL5}, // S_FBOMB_EXPL4 + {SPR_BARX, 3|FF_FULLBRIGHT, 3, {NULL}, 0, 0, S_FBOMB_EXPL6}, // S_FBOMB_EXPL5 + {SPR_NULL, 0, 2*TICRATE, {NULL}, 0, 0, S_NULL}, // S_FBOMB_EXPL6 + {SPR_BARD, 0|FF_TRANS90, 2, {NULL}, 0, 0, S_TNTDUST_2}, // S_TNTDUST_1 + {SPR_BARD, 0|FF_TRANS30, 2*TICRATE, {A_SetRandomTics}, 2, TICRATE, S_TNTDUST_3}, // S_TNTDUST_2 + {SPR_BARD, 0|FF_TRANS40, 10, {NULL}, 0, 0, S_TNTDUST_4}, // S_TNTDUST_3 + {SPR_BARD, 0|FF_TRANS50, 10, {NULL}, 0, 0, S_TNTDUST_5}, // S_TNTDUST_4 + {SPR_BARD, 0|FF_TRANS60, 10, {NULL}, 0, 0, S_TNTDUST_6}, // S_TNTDUST_5 + {SPR_BARD, 0|FF_TRANS70, 10, {NULL}, 0, 0, S_TNTDUST_7}, // S_TNTDUST_6 + {SPR_BARD, 0|FF_TRANS80, 10, {NULL}, 0, 0, S_TNTDUST_8}, // S_TNTDUST_7 + {SPR_BARD, 0|FF_TRANS90, 10, {NULL}, 0, 0, S_NULL}, // S_TNTDUST_8 {SPR_FSGN, 0|FF_PAPERSPRITE, -1, {NULL}, 0, 0, S_NULL}, // S_FSGNA {SPR_FSGN, 1|FF_PAPERSPRITE, -1, {NULL}, 0, 0, S_NULL}, // S_FSGNB {SPR_FSGN, 2|FF_PAPERSPRITE, -1, {NULL}, 0, 0, S_NULL}, // S_FSGNC @@ -5398,7 +5414,7 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] = sfx_None, // painsound S_NULL, // meleestate S_NULL, // missilestate - S_NULL, //S_TNTBARREL_EXPL1, // deathstate + S_FBOMB_EXPL1, // deathstate S_NULL, // xdeathstate sfx_s3k4e, // deathsound 20*FRACUNIT, // speed @@ -5412,6 +5428,32 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] = S_NULL // raisestate }, + { // MT_TNTDUST + -1, // doomednum + S_TNTDUST_1, // spawnstate + 1, // spawnhealth + S_NULL, // seestate + sfx_None, // seesound + 0, // 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 + 20*FRACUNIT, // speed + 16*FRACUNIT, // radius + 32*FRACUNIT, // height + 0, // display offset + 100, // mass + 0, // damage + sfx_None, // activesound + MF_NOGRAVITY|MF_NOBLOCKMAP|MF_NOCLIP|MF_SCENERY, // flags + S_NULL // raisestate + }, { // MT_FSGNA -1, // doomednum S_FSGNA, // spawnstate diff --git a/src/info.h b/src/info.h index ad8d138e6..fbe8ed8d7 100644 --- a/src/info.h +++ b/src/info.h @@ -321,6 +321,8 @@ typedef enum sprite SPR_FANG, // replaces EGGQ SPR_FBOM, SPR_FSGN, + SPR_BARX, // bomb explosion (also used by barrel) + SPR_BARD, // bomb dust (also used by barrel) // Boss 6 (Red Volcano) SPR_EGGR, @@ -1531,6 +1533,20 @@ typedef enum state S_FBOMB1, S_FBOMB2, + S_FBOMB_EXPL1, + S_FBOMB_EXPL2, + S_FBOMB_EXPL3, + S_FBOMB_EXPL4, + S_FBOMB_EXPL5, + S_FBOMB_EXPL6, + S_TNTDUST_1, + S_TNTDUST_2, + S_TNTDUST_3, + S_TNTDUST_4, + S_TNTDUST_5, + S_TNTDUST_6, + S_TNTDUST_7, + S_TNTDUST_8, S_FSGNA, S_FSGNB, S_FSGNC, @@ -3858,6 +3874,7 @@ typedef enum mobj_type // Boss 5 MT_FANG, MT_FBOMB, + MT_TNTDUST, // also used by barrel MT_FSGNA, MT_FSGNB, MT_FANGWAYPOINT, From ad4006712e16e0932ce110aa36a99029d805210a Mon Sep 17 00:00:00 2001 From: Monster Iestyn Date: Sun, 5 May 2019 21:03:15 +0100 Subject: [PATCH 51/56] fix P_CheckSight to consider FOFs that completely block the view (this could probably be in its own branch to be tested properly, but I'm on a roll with this atm) --- src/p_sight.c | 38 +++++++++++++++++++++++++++++++++++++- 1 file changed, 37 insertions(+), 1 deletion(-) diff --git a/src/p_sight.c b/src/p_sight.c index 556041585..579b94e56 100644 --- a/src/p_sight.c +++ b/src/p_sight.c @@ -254,7 +254,8 @@ static boolean P_CrossSubsector(size_t num, register los_t *los) // no wall to block sight with? if ((front = seg->frontsector)->floorheight == (back = seg->backsector)->floorheight && - front->ceilingheight == back->ceilingheight) + front->ceilingheight == back->ceilingheight + && !front->ffloors && !back->ffloors) continue; // possible occluder @@ -288,6 +289,41 @@ static boolean P_CrossSubsector(size_t num, register los_t *los) if (los->topslope <= los->bottomslope) return false; + + // Monster Iestyn: check FOFs! + if (front->ffloors || back->ffloors) + { + ffloor_t *rover; + fixed_t topslope, bottomslope; + // check front sector's FOFs first + for (rover = front->ffloors; rover; rover = rover->next) + { + if (!(rover->flags & FF_EXISTS) + || !(rover->flags & FF_RENDERSIDES) || rover->flags & FF_TRANSLUCENT) + { + continue; + } + topslope = FixedDiv(*rover->topheight - los->sightzstart , frac); + bottomslope = FixedDiv(*rover->bottomheight - los->sightzstart , frac); + if (topslope >= los->topslope && bottomslope <= los->bottomslope) + return false; // view completely blocked + } + // check back sector's FOFs as well + for (rover = back->ffloors; rover; rover = rover->next) + { + if (!(rover->flags & FF_EXISTS) + || !(rover->flags & FF_RENDERSIDES) || rover->flags & FF_TRANSLUCENT) + { + continue; + } + topslope = FixedDiv(*rover->topheight - los->sightzstart , frac); + bottomslope = FixedDiv(*rover->bottomheight - los->sightzstart , frac); + if (topslope >= los->topslope && bottomslope <= los->bottomslope) + return false; // view completely blocked + } + // TODO: figure out if it's worth considering partially blocked cases or not? + // maybe to adjust los's top/bottom slopes if needed + } } // passed the subsector ok From abfdac15a8582c8f28cb11ad609cfca4d0e4d7c4 Mon Sep 17 00:00:00 2001 From: Monster Iestyn Date: Mon, 27 May 2019 20:36:35 +0100 Subject: [PATCH 52/56] Fixed P_CheckSight to support slopes, both for normal planes and FOF planes (Untested) --- src/p_sight.c | 68 +++++++++++++++++++++++++++++++++++++++------------ 1 file changed, 52 insertions(+), 16 deletions(-) diff --git a/src/p_sight.c b/src/p_sight.c index 579b94e56..1b3ff0cf9 100644 --- a/src/p_sight.c +++ b/src/p_sight.c @@ -14,6 +14,7 @@ #include "doomdef.h" #include "doomstat.h" #include "p_local.h" +#include "p_slopes.h" #include "r_main.h" #include "r_state.h" @@ -216,6 +217,10 @@ static boolean P_CrossSubsector(size_t num, register los_t *los) const sector_t *front, *back; const vertex_t *v1,*v2; fixed_t frac; + fixed_t frontf, backf, frontc, backc; +#ifdef ESLOPE + fixed_t fracx, fracy; +#endif // already checked other side? if (line->validcount == validcount) @@ -250,37 +255,51 @@ static boolean P_CrossSubsector(size_t num, register los_t *los) if (!(line->flags & ML_TWOSIDED)) return false; + // calculate fractional intercept (how far along we are divided by how far we are from t2) + frac = P_InterceptVector2(&los->strace, &divl); + + front = seg->frontsector; + back = seg->backsector; +#ifdef ESLOPE + // calculate position at intercept + fracx = los->strace.x + FixedMul(los->strace.dx, frac); + fracy = los->strace.y + FixedMul(los->strace.dy, frac); + // calculate sector heights + frontf = (front->f_slope) ? P_GetZAt(front->f_slope, fracx, fracy) : front->floorheight; + frontc = (front->c_slope) ? P_GetZAt(front->c_slope, fracx, fracy) : front->ceilingheight; + backf = (back->f_slope) ? P_GetZAt(back->f_slope, fracx, fracy) : back->floorheight; + backc = (back->c_slope) ? P_GetZAt(back->c_slope, fracx, fracy) : back->ceilingheight; +#else + frontf = front->floorheight; + frontc = front->ceilingheight; + backf = back->floorheight; + backc = back->ceilingheight; +#endif // crosses a two sided line // no wall to block sight with? - if ((front = seg->frontsector)->floorheight == - (back = seg->backsector)->floorheight && - front->ceilingheight == back->ceilingheight - && !front->ffloors && !back->ffloors) + if (frontf == backf && frontc == backc + && !front->ffloors & !back->ffloors) // (and no FOFs) continue; // possible occluder // because of ceiling height differences - popentop = front->ceilingheight < back->ceilingheight ? - front->ceilingheight : back->ceilingheight ; + popentop = min(frontc, backc); // because of floor height differences - popenbottom = front->floorheight > back->floorheight ? - front->floorheight : back->floorheight ; + popenbottom = max(frontf, backf); // quick test for totally closed doors if (popenbottom >= popentop) return false; - frac = P_InterceptVector2(&los->strace, &divl); - - if (front->floorheight != back->floorheight) + if (frontf != backf) { fixed_t slope = FixedDiv(popenbottom - los->sightzstart , frac); if (slope > los->bottomslope) los->bottomslope = slope; } - if (front->ceilingheight != back->ceilingheight) + if (frontc != backc) { fixed_t slope = FixedDiv(popentop - los->sightzstart , frac); if (slope < los->topslope) @@ -295,6 +314,7 @@ static boolean P_CrossSubsector(size_t num, register los_t *los) { ffloor_t *rover; fixed_t topslope, bottomslope; + fixed_t topz, bottomz; // check front sector's FOFs first for (rover = front->ffloors; rover; rover = rover->next) { @@ -303,8 +323,16 @@ static boolean P_CrossSubsector(size_t num, register los_t *los) { continue; } - topslope = FixedDiv(*rover->topheight - los->sightzstart , frac); - bottomslope = FixedDiv(*rover->bottomheight - los->sightzstart , frac); + +#ifdef ESLOPE + topz = (*rover->t_slope) ? P_GetZAt(*rover->t_slope, fracx, fracy) : *rover->topheight; + bottomz = (*rover->b_slope) ? P_GetZAt(*rover->b_slope, fracx, fracy) : *rover->bottomheight; +#else + topz = *rover->topheight; + bottomz = *rover->bottomheight; +#endif + topslope = FixedDiv(topz - los->sightzstart , frac); + bottomslope = FixedDiv(bottomz - los->sightzstart , frac); if (topslope >= los->topslope && bottomslope <= los->bottomslope) return false; // view completely blocked } @@ -316,8 +344,16 @@ static boolean P_CrossSubsector(size_t num, register los_t *los) { continue; } - topslope = FixedDiv(*rover->topheight - los->sightzstart , frac); - bottomslope = FixedDiv(*rover->bottomheight - los->sightzstart , frac); + +#ifdef ESLOPE + topz = (*rover->t_slope) ? P_GetZAt(*rover->t_slope, fracx, fracy) : *rover->topheight; + bottomz = (*rover->b_slope) ? P_GetZAt(*rover->b_slope, fracx, fracy) : *rover->bottomheight; +#else + topz = *rover->topheight; + bottomz = *rover->bottomheight; +#endif + topslope = FixedDiv(topz - los->sightzstart , frac); + bottomslope = FixedDiv(bottomz - los->sightzstart , frac); if (topslope >= los->topslope && bottomslope <= los->bottomslope) return false; // view completely blocked } From 571c5b89b5739795386b81f0554c4655a9cad4e4 Mon Sep 17 00:00:00 2001 From: Monster Iestyn Date: Mon, 27 May 2019 21:18:02 +0100 Subject: [PATCH 53/56] Whoops, forgot to make P_CheckSight support slopes for same-sector FOF plane checking. --- src/p_sight.c | 35 +++++++++++++++++++++++++++++------ 1 file changed, 29 insertions(+), 6 deletions(-) diff --git a/src/p_sight.c b/src/p_sight.c index 1b3ff0cf9..aa59314f1 100644 --- a/src/p_sight.c +++ b/src/p_sight.c @@ -470,6 +470,8 @@ boolean P_CheckSight(mobj_t *t1, mobj_t *t2) if (s1 == s2) // Both sectors are the same. { ffloor_t *rover; + fixed_t topz1, bottomz1; // top, bottom heights at t1's position + fixed_t topz2, bottomz2; // likewise but for t2 for (rover = s1->ffloors; rover; rover = rover->next) { @@ -482,9 +484,30 @@ boolean P_CheckSight(mobj_t *t1, mobj_t *t2) continue; } +#ifdef ESLOPE + if (*rover->t_slope) + { + topz1 = P_GetZAt(*rover->t_slope, t1->x, t1->y); + topz2 = P_GetZAt(*rover->t_slope, t2->x, t2->y); + } + else + topz1 = topz2 = *rover->topheight; + + if (*rover->b_slope) + { + bottomz1 = P_GetZAt(*rover->b_slope, t1->x, t1->y); + bottomz2 = P_GetZAt(*rover->b_slope, t2->x, t2->y); + } + else + bottomz1 = bottomz2 = *rover->bottomheight; +#else + topz1 = topz2 = *rover->topheight; + bottomz1 = bottomz2 = *rover->bottomheight; +#endif + // Check for blocking floors here. - if ((los.sightzstart < *rover->bottomheight && t2->z >= *rover->topheight) - || (los.sightzstart >= *rover->topheight && t2->z + t2->height < *rover->bottomheight)) + if ((los.sightzstart < bottomz1 && t2->z >= topz2) + || (los.sightzstart >= topz1 && t2->z + t2->height < bottomz2)) { // no way to see through that return false; @@ -495,19 +518,19 @@ boolean P_CheckSight(mobj_t *t1, mobj_t *t2) if (!(rover->flags & FF_INVERTPLANES)) { - if (los.sightzstart >= *rover->topheight && t2->z + t2->height < *rover->topheight) + if (los.sightzstart >= topz1 && t2->z + t2->height < topz2) return false; // blocked by upper outside plane - if (los.sightzstart < *rover->bottomheight && t2->z >= *rover->bottomheight) + if (los.sightzstart < bottomz1 && t2->z >= bottomz2) return false; // blocked by lower outside plane } if (rover->flags & FF_INVERTPLANES || rover->flags & FF_BOTHPLANES) { - if (los.sightzstart < *rover->topheight && t2->z >= *rover->topheight) + if (los.sightzstart < topz1 && t2->z >= topz2) return false; // blocked by upper inside plane - if (los.sightzstart >= *rover->bottomheight && t2->z + t2->height < *rover->bottomheight) + if (los.sightzstart >= bottomz1 && t2->z + t2->height < bottomz2) return false; // blocked by lower inside plane } } From d4dac52766e5841a3aa01373445a2f2a70448594 Mon Sep 17 00:00:00 2001 From: Steel Titanium Date: Mon, 3 Jun 2019 15:23:48 -0400 Subject: [PATCH 54/56] Upped freeslots limit --- src/info.h | 2 +- src/sounds.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/info.h b/src/info.h index cba49667d..0700494f9 100644 --- a/src/info.h +++ b/src/info.h @@ -210,7 +210,7 @@ void A_NapalmScatter(); void A_SpawnFreshCopy(); // ratio of states to sprites to mobj types is roughly 6 : 1 : 1 -#define NUMMOBJFREESLOTS 256 +#define NUMMOBJFREESLOTS 512 #define NUMSPRITEFREESLOTS NUMMOBJFREESLOTS #define NUMSTATEFREESLOTS (NUMMOBJFREESLOTS*8) diff --git a/src/sounds.h b/src/sounds.h index 495a55a1e..3c74d56e6 100644 --- a/src/sounds.h +++ b/src/sounds.h @@ -42,7 +42,7 @@ typedef enum } skinsound_t; // free sfx for S_AddSoundFx() -#define NUMSFXFREESLOTS 800 // Matches SOC Editor. +#define NUMSFXFREESLOTS 1600 // Matches SOC Editor. #define NUMSKINSFXSLOTS (MAXSKINS*NUMSKINSOUNDS) // From 0fd36681111a9ae7cdc48438de5a2f7813a3e480 Mon Sep 17 00:00:00 2001 From: Monster Iestyn Date: Tue, 4 Jun 2019 17:34:59 +0000 Subject: [PATCH 55/56] Revert "Merge branch '144-scrolltweaks' into 'master'" This reverts merge request !213 --- src/p_spec.c | 145 ++++++++++++++------------------------------------- 1 file changed, 38 insertions(+), 107 deletions(-) diff --git a/src/p_spec.c b/src/p_spec.c index f8aefb9c8..e47b5cc03 100644 --- a/src/p_spec.c +++ b/src/p_spec.c @@ -7746,22 +7746,11 @@ static void P_SpawnScrollers(void) for (i = 0; i < numlines; i++, l++) { - fixed_t dx = l->dx; // direction and speed of scrolling - fixed_t dy = l->dy; + fixed_t dx = l->dx >> SCROLL_SHIFT; // direction and speed of scrolling + fixed_t dy = l->dy >> SCROLL_SHIFT; INT32 control = -1, accel = 0; // no control sector or acceleration INT32 special = l->special; - // If front texture X offset provided, override the amount with it. - if (sides[l->sidenum[0]].textureoffset != 0) - { - fixed_t len = sides[l->sidenum[0]].textureoffset; - fixed_t h = FixedHypot(dx, dy); - dx = FixedMul(FixedDiv(dx, h), len); - dy = FixedMul(FixedDiv(dy, h), len); - } - dx = dx >> SCROLL_SHIFT; - dy = dy >> SCROLL_SHIFT; - // These types are same as the ones they get set to except that the // first side's sector's heights cause scrolling when they change, and // this linedef controls the direction and speed of the scrolling. The @@ -7796,14 +7785,8 @@ static void P_SpawnScrollers(void) case 513: // scroll effect ceiling case 533: // scroll and carry objects on ceiling - if (l->tag == 0) - Add_Scroller(sc_ceiling, -dx, dy, control, l->frontsector - sectors, accel, l->flags & ML_NOCLIMB); - else - { - for (s = -1; (s = P_FindSectorFromLineTag(l, s)) >= 0 ;) - Add_Scroller(sc_ceiling, -dx, dy, control, s, accel, l->flags & ML_NOCLIMB); - } - + for (s = -1; (s = P_FindSectorFromLineTag(l, s)) >= 0 ;) + Add_Scroller(sc_ceiling, -dx, dy, control, s, accel, l->flags & ML_NOCLIMB); if (special != 533) break; /* FALLTHRU */ @@ -7811,26 +7794,14 @@ static void P_SpawnScrollers(void) case 523: // carry objects on ceiling dx = FixedMul(dx, CARRYFACTOR); dy = FixedMul(dy, CARRYFACTOR); - - if (l->tag == 0) - Add_Scroller(sc_carry_ceiling, dx, dy, control, l->frontsector - sectors, accel, l->flags & ML_NOCLIMB); - else - { - for (s = -1; (s = P_FindSectorFromLineTag(l, s)) >= 0 ;) - Add_Scroller(sc_carry_ceiling, dx, dy, control, s, accel, l->flags & ML_NOCLIMB); - } + for (s = -1; (s = P_FindSectorFromLineTag(l, s)) >= 0 ;) + Add_Scroller(sc_carry_ceiling, dx, dy, control, s, accel, l->flags & ML_NOCLIMB); break; case 510: // scroll effect floor case 530: // scroll and carry objects on floor - if (l->tag == 0) - Add_Scroller(sc_floor, -dx, dy, control, l->frontsector - sectors, accel, l->flags & ML_NOCLIMB); - else - { - for (s = -1; (s = P_FindSectorFromLineTag(l, s)) >= 0 ;) - Add_Scroller(sc_floor, -dx, dy, control, s, accel, l->flags & ML_NOCLIMB); - } - + for (s = -1; (s = P_FindSectorFromLineTag(l, s)) >= 0 ;) + Add_Scroller(sc_floor, -dx, dy, control, s, accel, l->flags & ML_NOCLIMB); if (special != 530) break; /* FALLTHRU */ @@ -7838,14 +7809,8 @@ static void P_SpawnScrollers(void) case 520: // carry objects on floor dx = FixedMul(dx, CARRYFACTOR); dy = FixedMul(dy, CARRYFACTOR); - - if (l->tag == 0) - Add_Scroller(sc_carry, dx, dy, control, l->frontsector - sectors, accel, l->flags & ML_NOCLIMB); - else - { - for (s = -1; (s = P_FindSectorFromLineTag(l, s)) >= 0 ;) - Add_Scroller(sc_carry, dx, dy, control, s, accel, l->flags & ML_NOCLIMB); - } + for (s = -1; (s = P_FindSectorFromLineTag(l, s)) >= 0 ;) + Add_Scroller(sc_carry, dx, dy, control, s, accel, l->flags & ML_NOCLIMB); break; // scroll wall according to linedef @@ -9208,77 +9173,43 @@ static void P_SpawnPushers(void) line_t *l = lines; register INT32 s; mobj_t *thing; - pushertype_e pushertype; - fixed_t dx, dy; for (i = 0; i < numlines; i++, l++) - { switch (l->special) { - case 541: // wind - pushertype = p_wind; - break; - - case 544: // current - pushertype = p_current; - break; - case 547: // push/pull - if (l->tag == 0) - { - s = l->frontsector - sectors; - if ((thing = P_GetPushThing(s)) != NULL) // No MT_P* means no effect - Add_Pusher(p_push, l->dx, l->dy, thing, s, -1, l->flags & ML_NOCLIMB, l->flags & ML_EFFECT4); - } - else + case 541: // wind + for (s = -1; (s = P_FindSectorFromLineTag(l, s)) >= 0 ;) + Add_Pusher(p_wind, l->dx, l->dy, NULL, s, -1, l->flags & ML_NOCLIMB, l->flags & ML_EFFECT4); + break; + case 544: // current + for (s = -1; (s = P_FindSectorFromLineTag(l, s)) >= 0 ;) + Add_Pusher(p_current, l->dx, l->dy, NULL, s, -1, l->flags & ML_NOCLIMB, l->flags & ML_EFFECT4); + break; + case 547: // push/pull for (s = -1; (s = P_FindSectorFromLineTag(l, s)) >= 0 ;) { - if ((thing = P_GetPushThing(s)) != NULL) // No MT_P* means no effect + thing = P_GetPushThing(s); + if (thing) // No MT_P* means no effect Add_Pusher(p_push, l->dx, l->dy, thing, s, -1, l->flags & ML_NOCLIMB, l->flags & ML_EFFECT4); } - - continue; - - case 545: // current up - pushertype = p_upcurrent; - break; - - case 546: // current down - pushertype = p_downcurrent; - break; - - case 542: // wind up - pushertype = p_upwind; - break; - - case 543: // wind down - pushertype = p_downwind; - break; - - default: - continue; + break; + case 545: // current up + for (s = -1; (s = P_FindSectorFromLineTag(l, s)) >= 0 ;) + Add_Pusher(p_upcurrent, l->dx, l->dy, NULL, s, -1, l->flags & ML_NOCLIMB, l->flags & ML_EFFECT4); + break; + case 546: // current down + for (s = -1; (s = P_FindSectorFromLineTag(l, s)) >= 0 ;) + Add_Pusher(p_downcurrent, l->dx, l->dy, NULL, s, -1, l->flags & ML_NOCLIMB, l->flags & ML_EFFECT4); + break; + case 542: // wind up + for (s = -1; (s = P_FindSectorFromLineTag(l, s)) >= 0 ;) + Add_Pusher(p_upwind, l->dx, l->dy, NULL, s, -1, l->flags & ML_NOCLIMB, l->flags & ML_EFFECT4); + break; + case 543: // wind down + for (s = -1; (s = P_FindSectorFromLineTag(l, s)) >= 0 ;) + Add_Pusher(p_downwind, l->dx, l->dy, NULL, s, -1, l->flags & ML_NOCLIMB, l->flags & ML_EFFECT4); + break; } - - dx = l->dx; - dy = l->dy; - - // Obtain versor and scale it up according to texture offset, if provided; line length is ignored in this case. - - if (sides[l->sidenum[0]].textureoffset != 0) - { - fixed_t len = sides[l->sidenum[0]].textureoffset; - fixed_t h = FixedHypot(dx, dy); - dx = FixedMul(FixedDiv(dx, h), len); - dy = FixedMul(FixedDiv(dy, h), len); - } - - if (l->tag == 0) - Add_Pusher(pushertype, dx, dy, NULL, l->frontsector - sectors, -1, l->flags & ML_NOCLIMB, l->flags & ML_EFFECT4); - else - { - for (s = -1; (s = P_FindSectorFromLineTag(l, s)) >= 0 ;) - Add_Pusher(pushertype, dx, dy, NULL, s, -1, l->flags & ML_NOCLIMB, l->flags & ML_EFFECT4); - } - } } static void P_SearchForDisableLinedefs(void) From 6f6d912fa6f6e009502e7350bbea9f0420e1e222 Mon Sep 17 00:00:00 2001 From: Monster Iestyn Date: Fri, 7 Jun 2019 15:48:33 +0100 Subject: [PATCH 56/56] Update version to 2.1.24 --- CMakeLists.txt | 2 +- appveyor.yml | 2 +- debian/changelog | 4 ++-- debian/control | 4 ++-- src/doomdef.h | 8 ++++---- src/sdl/macosx/Srb2mac.xcodeproj/project.pbxproj | 4 ++-- src/sdl12/macosx/Srb2mac.xcodeproj/project.pbxproj | 4 ++-- 7 files changed, 14 insertions(+), 14 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 0a5507b92..2d7b34159 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,6 +1,6 @@ cmake_minimum_required(VERSION 3.0) project(SRB2 - VERSION 2.1.23 + VERSION 2.1.24 LANGUAGES C) if(${PROJECT_SOURCE_DIR} MATCHES ${PROJECT_BINARY_DIR}) diff --git a/appveyor.yml b/appveyor.yml index f0f843fbb..98da61dbf 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -1,4 +1,4 @@ -version: 2.1.23.{branch}-{build} +version: 2.1.24.{branch}-{build} os: MinGW environment: diff --git a/debian/changelog b/debian/changelog index b06a78e2b..ff59fdc47 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,6 +1,6 @@ -srb2 (2.1.23~9) trusty; urgency=high +srb2 (2.1.24~9) trusty; urgency=high - * SRB2 v2.1.23 release + * SRB2 v2.1.24 release -- Marco Zafra Mon, 27 Nov 2018 16:45:00 -0500 diff --git a/debian/control b/debian/control index 0f2d8062b..92bb147de 100644 --- a/debian/control +++ b/debian/control @@ -18,7 +18,7 @@ Homepage: http://www.srb2.org Package: srb2 Architecture: any -Depends: ${shlibs:Depends}, ${misc:Depends}, srb2-data (>= 2.1.15), srb2-data (<= 2.1.23) +Depends: ${shlibs:Depends}, ${misc:Depends}, srb2-data (>= 2.1.15), srb2-data (<= 2.1.24) 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 @@ -31,7 +31,7 @@ Description: A cross-platform 3D Sonic fangame 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.15), srb2-data (<= 2.1.23), srb2 +Depends: libc6, ${misc:Depends}, srb2-data (>= 2.1.15), srb2-data (<= 2.1.24), 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 diff --git a/src/doomdef.h b/src/doomdef.h index 088d81d0a..6b6afbf1b 100644 --- a/src/doomdef.h +++ b/src/doomdef.h @@ -150,9 +150,9 @@ extern FILE *logstream; // we use comprevision and compbranch instead. #else #define VERSION 201 // Game version -#define SUBVERSION 23 // more precise version number -#define VERSIONSTRING "v2.1.23" -#define VERSIONSTRINGW L"v2.1.23" +#define SUBVERSION 24 // more precise version number +#define VERSIONSTRING "v2.1.24" +#define VERSIONSTRINGW L"v2.1.24" // Hey! If you change this, add 1 to the MODVERSION below! // Otherwise we can't force updates! #endif @@ -217,7 +217,7 @@ extern FILE *logstream; // it's only for detection of the version the player is using so the MS can alert them of an update. // Only set it higher, not lower, obviously. // Note that we use this to help keep internal testing in check; this is why v2.1.0 is not version "1". -#define MODVERSION 28 +#define MODVERSION 29 // To version config.cfg, MAJOREXECVERSION is set equal to MODVERSION automatically. // Increment MINOREXECVERSION whenever a config change is needed that does not correspond diff --git a/src/sdl/macosx/Srb2mac.xcodeproj/project.pbxproj b/src/sdl/macosx/Srb2mac.xcodeproj/project.pbxproj index a8ecbf7f8..878db3d8d 100644 --- a/src/sdl/macosx/Srb2mac.xcodeproj/project.pbxproj +++ b/src/sdl/macosx/Srb2mac.xcodeproj/project.pbxproj @@ -1219,7 +1219,7 @@ C01FCF4B08A954540054247B /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { - CURRENT_PROJECT_VERSION = 2.1.23; + CURRENT_PROJECT_VERSION = 2.1.24; GCC_PREPROCESSOR_DEFINITIONS = ( "$(inherited)", NORMALSRB2, @@ -1231,7 +1231,7 @@ C01FCF4C08A954540054247B /* Release */ = { isa = XCBuildConfiguration; buildSettings = { - CURRENT_PROJECT_VERSION = 2.1.23; + CURRENT_PROJECT_VERSION = 2.1.24; GCC_ENABLE_FIX_AND_CONTINUE = NO; GCC_GENERATE_DEBUGGING_SYMBOLS = NO; GCC_PREPROCESSOR_DEFINITIONS = ( diff --git a/src/sdl12/macosx/Srb2mac.xcodeproj/project.pbxproj b/src/sdl12/macosx/Srb2mac.xcodeproj/project.pbxproj index 69c544c56..6b3997b1f 100644 --- a/src/sdl12/macosx/Srb2mac.xcodeproj/project.pbxproj +++ b/src/sdl12/macosx/Srb2mac.xcodeproj/project.pbxproj @@ -1219,7 +1219,7 @@ C01FCF4B08A954540054247B /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { - CURRENT_PROJECT_VERSION = 2.1.23; + CURRENT_PROJECT_VERSION = 2.1.24; GCC_PREPROCESSOR_DEFINITIONS = ( "$(inherited)", NORMALSRB2, @@ -1231,7 +1231,7 @@ C01FCF4C08A954540054247B /* Release */ = { isa = XCBuildConfiguration; buildSettings = { - CURRENT_PROJECT_VERSION = 2.1.23; + CURRENT_PROJECT_VERSION = 2.1.24; GCC_ENABLE_FIX_AND_CONTINUE = NO; GCC_GENERATE_DEBUGGING_SYMBOLS = NO; GCC_PREPROCESSOR_DEFINITIONS = (