Compare commits

..
Author SHA1 Message Date
Alug a8df763823 fix bad copy paste 2025-09-26 17:20:41 +02:00
Alug 58af8f84b9 squash cherry all changes to here 2025-09-22 22:50:55 +02:00
Alug b0395ad539 Revert "get rid of the automatic "downsample" detection stufff"
This reverts commit b712cba62d.
2025-09-22 22:48:55 +02:00
Alug b712cba62d get rid of the automatic "downsample" detection stufff
massive declutter
2025-09-21 14:56:44 +02:00
Alug 16c0b48f4a add backwards compat support for ogl 2.1 fbo extensions
this should allow older gpus to use the feature aswell, not super clean but seems to work
TODO: refactor this whole crap, switch to seperate read and draw to use blitting and make this multisampling compatible so we can get rid of the messy "downsample" code and have this active by default
2025-09-21 05:12:47 +02:00
241 changed files with 21889 additions and 8499 deletions

No files matched your search

+73
View File
@@ -0,0 +1,73 @@
version: 2
jobs:
build:
working_directory: /root/SRB2
docker:
- image: debian:stretch
environment:
CC: ccache gcc -m32
PKG_CONFIG_LIBDIR: /usr/lib/i386-linux-gnu/pkgconfig
LIBGME_CFLAGS: -I/usr/include
LIBGME_LDFLAGS: -lgme
CCACHE_COMPRESS: true
WFLAGS: -Wno-unsuffixed-float-constants
GCC49: true
#- image: ubuntu:trusty
# environment:
# CC: ccache gcc -m32
# PKG_CONFIG_LIBDIR: /usr/lib/i386-linux-gnu/pkgconfig
# LIBGME_CFLAGS: -I/usr/include
# LIBGME_LDFLAGS: -lgme
# CCACHE_COMPRESS: true
# WFLAGS: -Wno-unsuffixed-float-constants
# GCC48: true
steps:
- run:
name: Add i386 arch
command: dpkg --add-architecture i386
- run:
name: Add STJr PPA
command: |
apt-get -qq update
apt-get -qq -y install dirmngr
apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 0B1702D71499D9C25F986507F240F4449D3B0EC6
echo "deb http://ppa.launchpad.net/stjr/srb2/ubuntu trusty main" >> /etc/apt/sources.list
- run:
name: Update APT listing
command: apt-get -qq update
- run:
name: Support S3 upload
command: apt-get -qq -y install ca-certificates
- restore_cache:
keys:
- v1-SRB2-APT
- run:
name: Install SDK
command: apt-get -qq -y --no-install-recommends install git build-essential libpng-dev:i386 libsdl2-mixer-dev:i386 libgme-dev:i386 libcurl4-openssl-dev:i386 libopenmpt-dev:i386 gettext ccache wget gcc-multilib upx openssh-client
- save_cache:
key: v1-SRB2-APT
paths:
- /var/cache/apt/archives
- checkout
#- run:
# name: Compile without network support and BLUA
# command: make -C src LINUX=1 ERRORMODE=1 -k NONET=1 NO_LUA=1
#- run:
# name: wipe build
# command: make -C src LINUX=1 cleandep
- run:
name: rebuild depend
command: make -C src LINUX=1 clean
- restore_cache:
keys:
- v1-SRB2-{{ .Branch }}-{{ checksum "objs/Linux/SDL/Release/depend.dep" }}
- run:
name: Compile
command: make -C src LINUX=1 ERRORMODE=1 -k
- store_artifacts:
path: /root/SRB2/bin/Linux/Release/
destination: bin
- save_cache:
key: v1-SRB2-{{ .Branch }}-{{ checksum "objs/Linux/SDL/Release/depend.dep" }}
paths:
- /root/.ccache
+436
View File
@@ -0,0 +1,436 @@
default:
image: debian:stable-slim
stages: # List of stages for jobs, and their order of execution
- build
variables:
GIT_STRATEGY: clone
GIT_CLONE_PATH: $CI_BUILDS_DIR/$CI_CONCURRENT_ID/$CI_PROJECT_PATH
.job_template: &job_build # This job runs in the build stage, which runs first.
stage: build
cache:
- key: ccache-$CI_PROJECT_PATH_SLUG-$CI_JOB_NAME_SLUG
fallback_keys:
- cache-$CI_PROJECT_PATH_SLUG-$CI_DEFAULT_BRANCH
- cache-$CI_PROJECT_PATH_SLUG-default
paths:
- ccache
- ccache_statslog
- key: apt-$CI_JOB_IMAGE
paths:
- apt-cache
unprotect: true
before_script:
- - |
# debconf
echo -e "\e[0Ksection_start:`date +%s`:debconf[collapsed=true]\r\e[0KSetup debconf's environment"
- export DEBIAN_FRONTEND="noninteractive"
- export DEBIAN_PRIORITY="low"
- export DEBCONF_NONINTERACTIVE_SEEN="true"
- |
# debconf
echo -e "\e[0Ksection_end:`date +%s`:debconf\r\e[0K"
- - |
# dpkg_aa
echo -e "\e[0Ksection_start:`date +%s`:dpkg_aa[collapsed=true]\r\e[0KAdding architectures to dpkg"
- dpkg --add-architecture i386
- dpkg --add-architecture amd64
- dpkg --add-architecture arm64
- |
# dpkg_aa
echo -e "\e[0Ksection_end:`date +%s`:dpkg_aa\r\e[0K"
- - |
# apt_conf
echo -e "\e[0Ksection_start:`date +%s`:apt_conf[collapsed=true]\r\e[0KSetting up APT conf"
- export APT_CACHE_DIR=`pwd`/apt-cache
- mkdir --parents --verbose $APT_CACHE_DIR/partial/
- touch /etc/apt/apt.conf.d/99build
- |
# apt.conf
echo Adding options to apt.conf':'
- |
# APT::Install-Recommends
echo APT::Install-Recommends "false"\; | tee --append /etc/apt/apt.conf.d/99build
- |
# quit
echo quiet "1"\; | tee --append /etc/apt/apt.conf.d/99build
- |
# APT::Get::Assume-Yes
echo APT::Get::Assume-Yes "true"\; | tee --append /etc/apt/apt.conf.d/99build
- |
# Dir::Cache::Archives
echo Dir::Cache::Archives "$APT_CACHE_DIR"\; | tee --append /etc/apt/apt.conf.d/99build
- |
# apt_conf
echo -e "\e[0Ksection_end:`date +%s`:apt_conf\r\e[0K"
- - |
# apt_update
echo -e "\e[0Ksection_start:`date +%s`:apt_update[collapsed=true]\r\e[0KUpdating APT listing"
- apt-get update
- |
# apt_update
echo -e "\e[0Ksection_end:`date +%s`:apt_update\r\e[0K"
- - |
# apt_pre
echo -e "\e[0Ksection_start:`date +%s`:apt_pre[collapsed=true]\r\e[0KInstalling pre packages"
- apt-get install apt-utils
- |
# apt_pre
echo -e "\e[0Ksection_end:`date +%s`:apt_pre\r\e[0K"
- - |
# apt_upgrade
echo -e "\e[0Ksection_start:`date +%s`:apt_upgrade[collapsed=true]\r\e[0KUpdating existing packages"
- apt-get upgrade
- |
# apt_update
echo -e "\e[0Ksection_end:`date +%s`:apt_upgrade\r\e[0K"
- - |
# apt_common
echo -e "\e[0Ksection_start:`date +%s`:apt_common[collapsed=true]\r\e[0KInstalling common packages"
- apt-get install make git ccache
- |
# apt_common
echo -e "\e[0Ksection_end:`date +%s`:apt_common\r\e[0K"
- - |
# ccache_config
echo -e "\e[0Ksection_start:`date +%s`:ccache_config[collapsed=true]\r\e[0KSetting up ccache config"
- mkdir --parents --verbose ~/.ccache/
- touch ~/.ccache/ccache.conf
- |
# cache.conf
echo Adding ccache configution option
- |
# base_dir
echo base_dir = $PWD | tee --append ~/.ccache/ccache.conf
- |
# cache_dir
echo cache_dir = $PWD/ccache | tee --append ~/.ccache/ccache.conf
- |
# compiler_check
echo compiler_check = content | tee --append ~/.ccache/ccache.conf
- |
# stats_log
echo stats_log = $PWD/ccache_statslog | tee --append ~/.ccache/ccache.conf
- |
# max_size
echo max_size = 50M | tee --append ~/.ccache/ccache.conf
- |
# ccache_config
echo -e "\e[0Ksection_end:`date +%s`:ccache_config\r\e[0K"
- - |
# cache_reset
echo -e "\e[0Ksection_start:`date +%s`:ccache_reset[collapsed=true]\r\e[0KResetting ccache statistics"
- ccache --zero-stats
- ccache --show-stats
- |
# ccache_reset
echo -e "\e[0Ksection_end:`date +%s`:ccache_reset\r\e[0K"
after_script:
- - |
# apt_clean
echo -e "\e[0Ksection_start:`date +%s`:apt_clean[collapsed=true]\r\e[0KCleaning of unneeded APT packages"
- apt-get autoclean
- |
# apt_clean
echo -e "\e[0Ksection_end:`date +%s`:apt_clean\r\e[0K"
- - |
# ccache_stats
echo -e "\e[0Ksection_start:`date +%s`:ccache_stats[collapsed=true]\r\e[0Kccache statistics:"
- ccache --show-stats --verbose
- ccache --show-log-stats --verbose
- |
# ccahe_stats
echo -e "\e[0Ksection_end:`date +%s`:ccache_stats\r\e[0K"
Debian testing GCC:
<<: *job_build
image: debian:testing-slim
allow_failure: true
artifacts:
paths:
- "bin/"
- "src/comptime.h"
expose_as: "Debian GCC testing"
name: "$CI_PROJECT_PATH_SLUG-$CI_COMMIT_REF_SLUG-$CI_COMMIT_SHORT_SHA-testing-gcc"
variables:
CC: gcc
script:
- - |
# apt_toolchain
echo -e "\e[0Ksection_start:`date +%s`:apt_toolchain[collapsed=true]\r\e[0KInstalling toolchain packages"
- apt-get install gcc
- |
# apt_toolchain
echo -e "\e[0Ksection_end:`date +%s`:apt_toolchain\r\e[0K"
- - |
# apt_development
echo -e "\e[0Ksection_start:`date +%s`:apt_development[collapsed=true]\r\e[0KInstalling development packages"
- apt-get install libsdl2-mixer-dev libpng-dev libcurl4-openssl-dev libgme-dev libopenmpt-dev
- |
# apt_development
echo -e "\e[0Ksection_end:`date +%s`:apt_development\r\e[0K"
- - |
# make
echo -e "\e[0Ksection_start:`date +%s`:make[collapsed=false]\r\e[0KCompiling SRB2"
- make --directory=src --keep-going CCACHE=1 ERRORMODE=1 NONX86=1 || make --directory=src --keep-going CCACHE=1 ERRORMODE=1 NONX86=1
- |
# make
echo -e "\e[0Ksection_end:`date +%s`:make\r\e[0K"
Windows x86:
<<: *job_build
artifacts:
paths:
- "bin/"
- "src/comptime.h"
name: "$CI_PROJECT_PATH_SLUG-$CI_COMMIT_REF_SLUG-$CI_COMMIT_SHORT_SHA-Win32"
variables:
PREFIX: i686-w64-mingw32
script:
- - |
# apt_toolchain
echo -e "\e[0Ksection_start:`date +%s`:apt_toolchain[collapsed=true]\r\e[0KInstalling toolchain packages"
- apt-get install gcc-mingw-w64-i686-win32
- |
# apt_toolchain
echo -e "\e[0Ksection_end:`date +%s`:apt_toolchain\r\e[0K"
- - |
# make
echo -e "\e[0Ksection_start:`date +%s`:make[collapsed=false]\r\e[0KCompiling SRB2"
- make --directory=src --keep-going CCACHE=1 ERRORMODE=1 MINGW=1 SDL=1 || make --directory=src --keep-going CCACHE=1 ERRORMODE=1 MINGW=1 SDL=1
- |
# make
echo -e "\e[0Ksection_end:`date +%s`:make\r\e[0K"
Debian stable:amd64:
<<: *job_build
artifacts:
paths:
- "bin/"
- "src/comptime.h"
expose_as: "Debian amd64"
name: "$CI_PROJECT_PATH_SLUG-$CI_COMMIT_REF_SLUG-$CI_COMMIT_SHORT_SHA-x86-64"
variables:
CC: x86_64-linux-gnu-gcc
OBJCOPY: x86_64-linux-gnu-objcopy
OBJDUMP: x86_64-linux-gnu-objdump
PKG_CONFIG_PATH: /usr/lib/x86_64-linux-gnu/pkgconfig
script:
- - |
# apt_toolchain
echo -e "\e[0Ksection_start:`date +%s`:apt_toolchain[collapsed=true]\r\e[0KInstalling toolchain packages"
- apt-get install gcc-x86-64-linux-gnu || apt-get install gcc
- |
# apt_toolchain
echo -e "\e[0Ksection_end:`date +%s`:apt_toolchain\r\e[0K"
- - |
# apt_development
echo -e "\e[0Ksection_start:`date +%s`:apt_development[collapsed=true]\r\e[0KInstalling development packages"
- apt-get install libsdl2-mixer-dev:amd64 libpng-dev:amd64 libcurl4-openssl-dev:amd64 libgme-dev:amd64 libopenmpt-dev:amd64
- |
# apt_development
echo -e "\e[0Ksection_end:`date +%s`:apt_development\r\e[0K"
- - |
# make
echo -e "\e[0Ksection_start:`date +%s`:make[collapsed=false]\r\e[0KCompiling SRB2"
- make --directory=src --keep-going CCACHE=1 ERRORMODE=1 LINUX64=1 || make --directory=src --keep-going CCACHE=1 ERRORMODE=1 LINUX64=1
- |
# make
echo -e "\e[0Ksection_end:`date +%s`:make\r\e[0K"
Debian stable:i386:
<<: *job_build
artifacts:
paths:
- "bin/"
- "src/comptime.h"
expose_as: "Debian i386"
name: "$CI_PROJECT_PATH_SLUG-$CI_COMMIT_REF_SLUG-$CI_COMMIT_SHORT_SHA-i686"
variables:
CC: i686-linux-gnu-gcc
OBJCOPY: i686-linux-gnu-objcopy
OBJDUMP: i686-linux-gnu-objdump
PKG_CONFIG_PATH: /usr/lib/i386-linux-gnu/pkgconfig
script:
- - |
# apt_toolchain
echo -e "\e[0Ksection_start:`date +%s`:apt_toolchain[collapsed=true]\r\e[0KInstalling toolchain packages"
- apt-get install gcc-i686-linux-gnu || apt-get install gcc
- |
# apt_toolchain
echo -e "\e[0Ksection_end:`date +%s`:apt_toolchain\r\e[0K"
- - |
# apt_development
echo -e "\e[0Ksection_start:`date +%s`:apt_development[collapsed=true]\r\e[0KInstalling development packages"
- apt-get install libsdl2-mixer-dev:i386 libpng-dev:i386 libcurl4-openssl-dev:i386 libgme-dev:i386 libopenmpt-dev:i386
- |
# apt_development
echo -e "\e[0Ksection_end:`date +%s`:apt_development\r\e[0K"
- - |
# make
echo -e "\e[0Ksection_start:`date +%s`:make[collapsed=false]\r\e[0KCompiling SRB2"
- make --directory=src --keep-going CCACHE=1 ERRORMODE=1 LINUX=1 || make --directory=src --keep-going CCACHE=1 ERRORMODE=1 LINUX=1
- |
# make
echo -e "\e[0Ksection_end:`date +%s`:make\r\e[0K"
Debian stable:arm64:
<<: *job_build
artifacts:
paths:
- "bin/"
- "src/comptime.h"
expose_as: "Debian arm64"
name: "$CI_PROJECT_PATH_SLUG-$CI_COMMIT_REF_SLUG-$CI_COMMIT_SHORT_SHA-aarch64"
variables:
CC: aarch64-linux-gnu-gcc
OBJCOPY: aarch64-linux-gnu-objcopy
OBJDUMP: aarch64-linux-gnu-objdump
PKG_CONFIG_PATH: /usr/lib/aarch64-linux-gnu/pkgconfig
script:
- - |
# apt_toolchain
echo -e "\e[0Ksection_start:`date +%s`:apt_toolchain[collapsed=true]\r\e[0KInstalling toolchain packages"
- apt-get install gcc-aarch64-linux-gnu || apt-get install gcc
- |
# apt_toolchain
echo -e "\e[0Ksection_end:`date +%s`:apt_toolchain\r\e[0K"
- - |
# apt_development
echo -e "\e[0Ksection_start:`date +%s`:apt_development[collapsed=true]\r\e[0KInstalling development packages"
- apt-get install libsdl2-mixer-dev:arm64 libpng-dev:arm64 libcurl4-openssl-dev:arm64 libgme-dev:arm64 libopenmpt-dev:arm64
- |
# apt_development
echo -e "\e[0Ksection_end:`date +%s`:apt_development\r\e[0K"
- - |
# make
echo -e "\e[0Ksection_start:`date +%s`:make[collapsed=false]\r\e[0KCompiling SRB2"
- make --directory=src --keep-going CCACHE=1 ERRORMODE=1 LINUX64=1 ERRORMODE=1 NONX86=1 || make --directory=src --keep-going CCACHE=1 ERRORMODE=1 LINUX64=1 NONX86=1
- |
# make
echo -e "\e[0Ksection_end:`date +%s`:make\r\e[0K"
Windows x64:
<<: *job_build
artifacts:
paths:
- "bin/"
- "src/comptime.h"
expose_as: "Win64"
name: "$CI_PROJECT_PATH_SLUG-$CI_COMMIT_REF_SLUG-$CI_COMMIT_SHORT_SHA-Win64"
variables:
PREFIX: x86_64-w64-mingw32
script:
- - |
# apt_toolchain
echo -e "\e[0Ksection_start:`date +%s`:apt_toolchain[collapsed=true]\r\e[0KInstalling toolchain packages"
- apt-get install gcc-mingw-w64-x86-64-win32
- |
# apt_toolchain
echo -e "\e[0Ksection_end:`date +%s`:apt_toolchain\r\e[0K"
- - |
# make
echo -e "\e[0Ksection_start:`date +%s`:make[collapsed=false]\r\e[0KCompiling SRB2"
- make --directory=src --keep-going CCACHE=1 ERRORMODE=1 MINGW64=1 SDL=1 || make --directory=src --keep-going CCACHE=1 ERRORMODE=1 MINGW64=1 SDL=1
- |
# make
echo -e "\e[0Ksection_end:`date +%s`:make\r\e[0K"
Debian stable Clang:
<<: *job_build
allow_failure: true
artifacts:
paths:
- "bin/"
- "src/comptime.h"
expose_as: "Debian Clang"
name: "$CI_PROJECT_PATH_SLUG-$CI_COMMIT_REF_SLUG-$CI_COMMIT_SHORT_SHA-clang"
variables:
CC: clang
WFLAGS: -Wno-cast-align
script:
- - |
# apt_toolchain
echo -e "\e[0Ksection_start:`date +%s`:apt_toolchain[collapsed=true]\r\e[0KInstalling toolchain packages"
- apt-get install clang
- |
# apt_toolchain
echo -e "\e[0Ksection_end:`date +%s`:apt_toolchain\r\e[0K"
- - |
# apt_development
echo -e "\e[0Ksection_start:`date +%s`:apt_development[collapsed=true]\r\e[0KInstalling development packages"
- apt-get install libsdl2-mixer-dev libpng-dev libcurl4-openssl-dev libgme-dev libopenmpt-dev
- |
# apt_development
echo -e "\e[0Ksection_end:`date +%s`:apt_development\r\e[0K"
- - |
# make
echo -e "\e[0Ksection_start:`date +%s`:make[collapsed=false]\r\e[0KCompiling SRB2"
- make --directory=src --keep-going CCACHE=1 ERRORMODE=1 NONX86=1 || make --directory=src --keep-going CCACHE=1 ERRORMODE=1 NONX86=1
- |
# make
echo -e "\e[0Ksection_end:`date +%s`:make\r\e[0K"
Debian testing Clang:
extends: Debian stable Clang
image: debian:testing-slim
artifacts:
paths:
- "bin/"
- "src/comptime.h"
expose_as: "Debina Clang testing"
name: "$CI_PROJECT_PATH_SLUG-$CI_COMMIT_REF_SLUG-$CI_COMMIT_SHORT_SHA-testing-clang"
variables:
CC: clang
WFLAGS: -Wno-cast-align -Wno-deprecated-non-prototype
+712
View File
@@ -0,0 +1,712 @@
# 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:
packages:
- libsdl2-mixer-dev
- libpng-dev
- libgl1-mesa-dev
- libgme-dev
- libcurl4-openssl-dev
- p7zip-full
- gcc-4.4
compiler: gcc-4.4
env: GCC44=1
if: env(DPL_ENABLED) != "1" OR env(DPL_TERMINATE_TESTS) != "1" OR NOT branch =~ /^.*deployer.*$/
#gcc-4.4 (Ubuntu/Linaro 4.4.7-8ubuntu1) 4.4.7
- os: linux
addons:
apt:
packages:
- libsdl2-mixer-dev
- libpng-dev
- libgl1-mesa-dev
- libgme-dev
- libcurl4-openssl-dev
- p7zip-full
- gcc-4.6
compiler: gcc-4.6
env: GCC46=1
if: env(DPL_ENABLED) != "1" OR env(DPL_TERMINATE_TESTS) != "1" OR NOT branch =~ /^.*deployer.*$/
#gcc-4.6 (Ubuntu/Linaro 4.6.4-6ubuntu2) 4.6.4
- os: linux
addons:
apt:
packages:
- libsdl2-mixer-dev
- libpng-dev
- libgl1-mesa-dev
- libgme-dev
- libcurl4-openssl-dev
- p7zip-full
- gcc-4.7
compiler: gcc-4.7
env: GCC47=1
if: env(DPL_ENABLED) != "1" OR env(DPL_TERMINATE_TESTS) != "1" OR NOT branch =~ /^.*deployer.*$/
#gcc-4.7
- os: linux
compiler: gcc
env: GCC48=1
if: env(DPL_ENABLED) != "1" OR env(DPL_TERMINATE_TESTS) != "1" OR NOT branch =~ /^.*deployer.*$/
#gcc (Ubuntu 4.8.4-2ubuntu1~14.04) 4.8.4
- os: linux
addons:
apt:
sources:
- ubuntu-toolchain-r-test
packages:
- libsdl2-mixer-dev
- libpng-dev
- libgl1-mesa-dev
- libgme-dev
- libcurl4-openssl-dev
- p7zip-full
- gcc-4.8
compiler: gcc-4.8
env: GCC48=1
if: env(DPL_ENABLED) != "1" OR env(DPL_TERMINATE_TESTS) != "1" OR NOT branch =~ /^.*deployer.*$/
#gcc-4.8 (Ubuntu 4.8.5-2ubuntu1~14.04.1) 4.8.5
- os: linux
addons:
apt:
sources:
- ubuntu-toolchain-r-test
packages:
- libsdl2-mixer-dev
- libpng-dev
- libgl1-mesa-dev
- libgme-dev
- libcurl4-openssl-dev
- p7zip-full
- gcc-7
compiler: gcc-7
env: WFLAGS="-Wno-tautological-compare -Wno-error=implicit-fallthrough -Wno-implicit-fallthrough" GCC72=1
if: env(DPL_ENABLED) != "1" OR env(DPL_TERMINATE_TESTS) != "1" OR NOT branch =~ /^.*deployer.*$/
#gcc-7 (Ubuntu 7.2.0-1ubuntu1~14.04) 7.2.0 20170802
- os: linux
addons:
apt:
sources:
- ubuntu-toolchain-r-test
packages:
- libsdl2-mixer-dev
- libpng-dev
- libgl1-mesa-dev
- libgme-dev
- libcurl4-openssl-dev
- p7zip-full
- gcc-8
compiler: gcc-8
env: WFLAGS="-Wno-tautological-compare -Wno-error=implicit-fallthrough -Wno-implicit-fallthrough -Wno-error=format-overflow -Wno-error=format-truncation" GCC81=1
if: env(DPL_ENABLED) != "1" OR env(DPL_TERMINATE_TESTS) != "1" OR NOT branch =~ /^.*deployer.*$/
#gcc-8 (Ubuntu 7.2.0-1ubuntu1~14.04) 8.1.0
- os: linux
compiler: clang
if: env(DPL_ENABLED) != "1" OR env(DPL_TERMINATE_TESTS) != "1" OR NOT branch =~ /^.*deployer.*$/
#clang version 3.5.0 (tags/RELEASE_350/final)
- os: linux
addons:
apt:
sources:
- llvm-toolchain-precise-3.5
packages:
- libsdl2-mixer-dev
- libpng-dev
- libgl1-mesa-dev
- libgme-dev
- libcurl4-openssl-dev
- p7zip-full
- clang-3.5
compiler: clang-3.5
if: env(DPL_ENABLED) != "1" OR env(DPL_TERMINATE_TESTS) != "1" OR NOT branch =~ /^.*deployer.*$/
#Ubuntu clang version 3.5.0-4ubuntu2~trusty2 (tags/RELEASE_350/final) (based on LLVM 3.5.0)
- os: linux
addons:
apt:
sources:
- llvm-toolchain-precise-3.6
- ubuntu-toolchain-r-test
packages:
- libsdl2-mixer-dev
- libpng-dev
- libgl1-mesa-dev
- libgme-dev
- libcurl4-openssl-dev
- p7zip-full
- clang-3.6
compiler: clang-3.6
if: env(DPL_ENABLED) != "1" OR env(DPL_TERMINATE_TESTS) != "1" OR NOT branch =~ /^.*deployer.*$/
#Ubuntu clang version 3.6.2-svn240577-1~exp1 (branches/release_36) (based on LLVM 3.6.2)
- os: linux
addons:
apt:
sources:
- llvm-toolchain-precise-3.7
- ubuntu-toolchain-r-test
packages:
- libsdl2-mixer-dev
- libpng-dev
- libgl1-mesa-dev
- libgme-dev
- libcurl4-openssl-dev
- p7zip-full
- clang-3.7
compiler: clang-3.7
if: env(DPL_ENABLED) != "1" OR env(DPL_TERMINATE_TESTS) != "1" OR NOT branch =~ /^.*deployer.*$/
#Ubuntu clang version 3.7.1-svn253571-1~exp1 (branches/release_37) (based on LLVM 3.7.1)
- os: linux
addons:
apt:
sources:
- llvm-toolchain-precise-3.8
- ubuntu-toolchain-r-test
packages:
- libsdl2-mixer-dev
- libpng-dev
- libgl1-mesa-dev
- libgme-dev
- libcurl4-openssl-dev
- p7zip-full
- clang-3.8
compiler: clang-3.8
if: env(DPL_ENABLED) != "1" OR env(DPL_TERMINATE_TESTS) != "1" OR NOT branch =~ /^.*deployer.*$/
#clang version 3.8.1-svn271127-1~exp1 (branches/release_38)
- os: linux
addons:
apt:
sources:
- llvm-toolchain-precise-3.9
- ubuntu-toolchain-r-test
packages:
- libsdl2-mixer-dev
- libpng-dev
- libgl1-mesa-dev
- libgme-dev
- libcurl4-openssl-dev
- p7zip-full
- clang-3.9
compiler: clang-3.9
if: env(DPL_ENABLED) != "1" OR env(DPL_TERMINATE_TESTS) != "1" OR NOT branch =~ /^.*deployer.*$/
#clang version 3.9.X
# - os: linux
# addons:
# apt:
# sources:
# - llvm-toolchain-precise-4.0
# - ubuntu-toolchain-r-test
# packages:
# - libsdl2-mixer-dev
# - libpng-dev
# - libgl1-mesa-dev
# - libgme-dev
# - p7zip-full
# - clang-4.0
# compiler: clang-4.0
# if: env(DPL_ENABLED) != "1" OR env(DPL_TERMINATE_TESTS) != "1" OR NOT branch =~ /^.*deployer.*$/
# #clang version 4.0.X
# - os: linux
# addons:
# apt:
# sources:
# - llvm-toolchain-precise-5.0
# - ubuntu-toolchain-r-test
# packages:
# - libsdl2-mixer-dev
# - libpng-dev
# - libgl1-mesa-dev
# - libgme-dev
# - p7zip-full
# - clang-5.0
# compiler: clang-5.0
# if: env(DPL_ENABLED) != "1" OR env(DPL_TERMINATE_TESTS) != "1" OR NOT branch =~ /^.*deployer.*$/
# #clang version 5.0.X
# - os: osx
# osx_image: beta-xcode6.1
# if: env(DPL_ENABLED) != "1" OR env(DPL_TERMINATE_TESTS) != "1" OR NOT branch =~ /^.*deployer.*$/
# #Apple LLVM version 6.0 (clang-600.0.54) (based on LLVM 3.5svn)
# - os: osx
# osx_image: beta-xcode6.2
# compiler: gcc
# if: env(DPL_ENABLED) != "1" OR env(DPL_TERMINATE_TESTS) != "1" OR NOT branch =~ /^.*deployer.*$/
# #Apple LLVM version 6.0 (clang-600.0.57) (based on LLVM 3.5svn)
## - os: osx
## osx_image: beta-xcode6.3
## if: env(DPL_ENABLED) != "1" OR env(DPL_TERMINATE_TESTS) != "1" OR NOT branch =~ /^.*deployer.*$/
## #I think xcode.6.3 VM is broken, it does not boot
# - os: osx
# osx_image: xcode6.4
# if: env(DPL_ENABLED) != "1" OR env(DPL_TERMINATE_TESTS) != "1" OR NOT branch =~ /^.*deployer.*$/
# #Apple LLVM version 6.1.0 (clang-602.0.53) (based on LLVM 3.6.0svn)
# - os: osx
# osx_image: xcode7
# if: env(DPL_ENABLED) != "1" OR env(DPL_TERMINATE_TESTS) != "1" OR NOT branch =~ /^.*deployer.*$/
# #Apple LLVM version 7.0.0 (clang-700.0.72)
# - os: osx
# osx_image: xcode7.1
# if: env(DPL_ENABLED) != "1" OR env(DPL_TERMINATE_TESTS) != "1" OR NOT branch =~ /^.*deployer.*$/
# #Apple LLVM version 7.0.0 (clang-700.1.76)
# - os: osx
# osx_image: xcode7.2
# if: env(DPL_ENABLED) != "1" OR env(DPL_TERMINATE_TESTS) != "1" OR NOT branch =~ /^.*deployer.*$/
# #Apple LLVM version 7.0.2 (clang-700.1.81)
# - os: osx
# osx_image: xcode7.3
# #Apple LLVM version 7.3.0 (clang-703.0.31)
# - os: osx
# osx_image: xcode7.3
# #Apple LLVM version 7.3.0 (clang-703.0.31)
- os: osx
if: env(DPL_ENABLED) != "1" OR env(DPL_TERMINATE_TESTS) != "1" OR NOT branch =~ /^.*deployer.*$/
#Default: macOS 10.13 and Xcode 9.4.1
################################
# Deployer Buildbots - OSX
################################
- os: osx
if: env(DPL_ENABLED) = "1" AND (env(_DPL_JOB_ENABLED) = "1" OR env(DPL_JOB_ENABLE_ALL) = "1")
AND (branch =~ /^.*deployer.*$/ OR (tag IS present AND env(DPL_TAG_ENABLED) = "1"))
AND env(DPL_TERMINATE_MAIN) != "1"
env:
- _DPL_JOB_ENABLED=1
- _DPL_JOB_NAME=osx
- _DPL_FTP_TARGET=1
- _DPL_PACKAGE_BINARY=1
#Apple LLVM version 7.3.0 (clang-703.0.31)
################################
# Deployer Buildbots - Linux assets
# Set DPL_TERMINATE_ASSETS to disable all of these
# List Ubuntu LTS next, newest to oldest
# Then list non-LTS, newest to oldest
################################
- os: linux
addons:
apt:
packages:
- libsdl2-mixer-dev
- libpng-dev
- libgl1-mesa-dev
- libgme-dev
- libcurl4-openssl-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
- libcurl4-openssl-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=focal
- _DPL_DPUT_TARGET=1
- _DPL_PACKAGE_SOURCE=1
- PACKAGE_DISTRO=focal
- PACKAGE_SUBVERSION=~20.04focal
#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
- libcurl4-openssl-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
- libcurl4-openssl-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
- os: linux
addons:
apt:
packages:
- libsdl2-mixer-dev
- libpng-dev
- libgl1-mesa-dev
- libgme-dev
- libcurl4-openssl-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
- libcurl4-openssl-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=eoan
- _DPL_DPUT_TARGET=1
- _DPL_PACKAGE_SOURCE=1
- PACKAGE_DISTRO=eoan
- PACKAGE_SUBVERSION=~19.10eoan
#gcc-4.8 (Ubuntu 4.8.5-2ubuntu1~14.04.1) 4.8.5
allow_failures:
- compiler: clang-3.5
- compiler: clang-3.6
- compiler: clang-3.7
- compiler: clang-3.8
- compiler: clang-3.9
- compiler: clang-4.0
- compiler: clang-5.0
cache:
apt: true
ccache: true
directories:
- $HOME/srb2_cache
addons:
apt:
packages:
- libsdl2-mixer-dev
- libpng-dev
- libgl1-mesa-dev
- libgme-dev
- zlib1g-dev
- libcurl4-openssl-dev
- p7zip-full
homebrew:
taps:
- mazmazz/srb2
packages:
- sdl2_mixer
- game-music-emu
- p7zip
- cmake
- curl
update: true
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 -- see `deployer.sh` for conditions.
# This should never happen on non-release buildbots when Deployer is not triggered.
- if [[ "$__DPL_TRY_TERMINATE_EARLY" == "1" ]]; then
if [[ "$__DPL_ACTIVE" != "1" ]]; then
echo "Exiting early because this job is not deploying.";
exit;
fi;
fi
# If we're triggered by release tag, force ASSET_FILES_OPTIONAL_GET=1
- if [[ "$__DPL_TAG_ELIGIBLE" = "1" ]]; then
ASSET_FILES_OPTIONAL_GET=1;
fi;
install:
# Install OS X library dependencies via Homebrew
# Do this differently for release buildbots:
# * `brew install --build-bottle` builds libraries for x86_64's lowest common denominator CPU, core2
# * `sdl2_mixer` requires options from the formula tap https://github.com/mazmazz/homebrew-srb2
# * `brew postinstall` runs post-install scripts after building a bottle
- if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then
if [[ "$__DPL_ACTIVE" == "1" ]]; then
brew install --build-bottle sdl2 game-music-emu;
brew install --build-bottle mazmazz/srb2/sdl2_mixer --with-flac --with-mpg123;
brew postinstall sdl2 game-music-emu mazmazz/srb2/sdl2_mixer;
fi;
fi
- mkdir -p $HOME/srb2_cache
before_script:
# OLDPWD is root repo folder
- OLDPWD=$PWD
- __ASSET_DIRECTORY="$OLDPWD/assets/installer"
- mkdir -p "$__ASSET_DIRECTORY"
- cd "$HOME/srb2_cache"
# Get stat command so we know what the cached archive date is.
# stat is different for OSX
- if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then
STATCMD="stat -f %m";
else
STATCMD="stat -c %y";
fi
# Get asset files (required for MD5)
# See `deployer_defaults.sh` for asset download path
- if [[ "$ASSET_ARCHIVE_PATH" != "" ]]; then
if [ -f "$(basename $ASSET_ARCHIVE_PATH)" ]; then
echo "$(basename $ASSET_ARCHIVE_PATH) cache date -- $($STATCMD $(basename $ASSET_ARCHIVE_PATH))";
fi;
wget --verbose --server-response -N "$ASSET_ARCHIVE_PATH";
7z x "$(basename $ASSET_ARCHIVE_PATH)" -o"$__ASSET_DIRECTORY" -aos;
fi;
# Get optional files too
- if [[ "$__DPL_ACTIVE" == "1" ]] && [[ "$ASSET_FILES_OPTIONAL_GET" == "1" ]] && [[ "$ASSET_ARCHIVE_OPTIONAL_PATH" != "" ]]; then
if [ -f "$(basename $ASSET_ARCHIVE_OPTIONAL_PATH)" ]; then
echo "$(basename $ASSET_ARCHIVE_OPTIONAL_PATH) cache date -- $($STATCMD $(basename $ASSET_ARCHIVE_OPTIONAL_PATH))";
fi;
wget --verbose --server-response -N "$ASSET_ARCHIVE_OPTIONAL_PATH";
7z x "$(basename $ASSET_ARCHIVE_OPTIONAL_PATH)" -o"$__ASSET_DIRECTORY" -aos;
fi;
# Go back to root repo folder
- cd "$OLDPWD"
# Prepare CMake asset lists
- SRB2_ASSET_HASHED=$(echo ${ASSET_FILES_HASHED// /\;})
- SRB2_ASSET_DOCS=$(echo ${ASSET_FILES_DOCS// /\;})
- SRB2_ASSET_DIRECTORY="$__ASSET_DIRECTORY"
# Prepare CMake
- mkdir build
- cd build
- mkdir package
- export CFLAGS="-Wall -W -Werror $WFLAGS"
- export CCACHE_COMPRESS=true
# If OS X, set -march=core2 to build compatible binaries with old Macs
- if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then
export CFLAGS="${CFLAGS} -march=core2";
fi;
- cmake .. -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=$PWD/bin -DCPACK_PACKAGE_DIRECTORY=$PWD/package
-DSRB2_ASSET_HASHED="${SRB2_ASSET_HASHED}" -DSRB2_ASSET_DOCS="${SRB2_ASSET_DOCS}"
-DSRB2_ASSET_DIRECTORY="${SRB2_ASSET_DIRECTORY}"
-DCPACK_PACKAGE_DESCRIPTION_SUMMARY="${PROGRAM_NAME}"
-DCPACK_PACKAGE_VENDOR="${PROGRAM_VENDOR}"
-DSRB2_SDL2_EXE_NAME="${PROGRAM_FILENAME}"
script:
# Build our Makefile from Cmake!
- if [[ "$__DPL_ACTIVE" == "1" ]]; then
. ../deployer/travis/deployer_build.sh;
else
make -k;
fi;
after_success:
# Run the upload scripts
# These do nothing if Deployer is not triggered
- . ../deployer/travis/deployer_ftp.sh
- . ../deployer/travis/deployer_dput.sh
+269
View File
@@ -0,0 +1,269 @@
# Doxyfile 1.4.3
#---------------------------------------------------------------------------
# Project related configuration options
#---------------------------------------------------------------------------
PROJECT_NAME = SRB2
PROJECT_NUMBER = 1.09
OUTPUT_DIRECTORY = ./doc/SRB2
CREATE_SUBDIRS = YES
OUTPUT_LANGUAGE = English
USE_WINDOWS_ENCODING = YES
BRIEF_MEMBER_DESC = YES
REPEAT_BRIEF = YES
ABBREVIATE_BRIEF = "The $name class" \
"The $name widget" \
"The $name file" \
is \
provides \
specifies \
contains \
represents \
a \
an \
the
ALWAYS_DETAILED_SEC = NO
INLINE_INHERITED_MEMB = NO
FULL_PATH_NAMES = YES
STRIP_FROM_PATH =
STRIP_FROM_INC_PATH =
SHORT_NAMES = NO
JAVADOC_AUTOBRIEF = NO
MULTILINE_CPP_IS_BRIEF = NO
DETAILS_AT_TOP = NO
INHERIT_DOCS = YES
DISTRIBUTE_GROUP_DOC = NO
SEPARATE_MEMBER_PAGES = NO
TAB_SIZE = 8
ALIASES =
OPTIMIZE_OUTPUT_FOR_C = YES
OPTIMIZE_OUTPUT_JAVA = NO
SUBGROUPING = YES
#---------------------------------------------------------------------------
# Build related configuration options
#---------------------------------------------------------------------------
EXTRACT_ALL = YES
EXTRACT_PRIVATE = YES
EXTRACT_STATIC = YES
EXTRACT_LOCAL_CLASSES = YES
EXTRACT_LOCAL_METHODS = NO
HIDE_UNDOC_MEMBERS = NO
HIDE_UNDOC_CLASSES = NO
HIDE_FRIEND_COMPOUNDS = NO
HIDE_IN_BODY_DOCS = NO
INTERNAL_DOCS = NO
CASE_SENSE_NAMES = NO
HIDE_SCOPE_NAMES = NO
SHOW_INCLUDE_FILES = YES
INLINE_INFO = YES
SORT_MEMBER_DOCS = YES
SORT_BRIEF_DOCS = NO
SORT_BY_SCOPE_NAME = NO
GENERATE_TODOLIST = YES
GENERATE_TESTLIST = YES
GENERATE_BUGLIST = YES
GENERATE_DEPRECATEDLIST= YES
ENABLED_SECTIONS =
MAX_INITIALIZER_LINES = 30
SHOW_USED_FILES = YES
SHOW_DIRECTORIES = YES
FILE_VERSION_FILTER =
#---------------------------------------------------------------------------
# configuration options related to warning and progress messages
#---------------------------------------------------------------------------
QUIET = NO
WARNINGS = YES
WARN_IF_UNDOCUMENTED = YES
WARN_IF_DOC_ERROR = YES
WARN_NO_PARAMDOC = NO
WARN_FORMAT = "$file:$line: $text"
WARN_LOGFILE =
#---------------------------------------------------------------------------
# configuration options related to the input files
#---------------------------------------------------------------------------
INPUT = ./src
FILE_PATTERNS = *.c \
*.cc \
*.cxx \
*.cpp \
*.c++ \
*.d \
*.java \
*.ii \
*.ixx \
*.ipp \
*.i++ \
*.inl \
*.h \
*.hh \
*.hxx \
*.hpp \
*.h++ \
*.idl \
*.odl \
*.cs \
*.php \
*.php3 \
*.inc \
*.m \
*.mm \
*.dox
RECURSIVE = YES
EXCLUDE = ./src/sdl/IMG_xpm.c \
./src/sdl/SRB2DC/scramble.c
EXCLUDE_SYMLINKS = NO
EXCLUDE_PATTERNS = */src/hardware/*/* \
*/src/sdl/SDL_main/* \
*/src/*/*_private.h \
*/src/sdl/*/*help.? \
*/src/md5.? \
*/src/sdl/filter/*
EXAMPLE_PATH =
EXAMPLE_PATTERNS = *
EXAMPLE_RECURSIVE = NO
IMAGE_PATH =
INPUT_FILTER =
FILTER_PATTERNS =
FILTER_SOURCE_FILES = YES
#---------------------------------------------------------------------------
# configuration options related to source browsing
#---------------------------------------------------------------------------
SOURCE_BROWSER = NO
INLINE_SOURCES = NO
STRIP_CODE_COMMENTS = YES
REFERENCED_BY_RELATION = NO
REFERENCES_RELATION = NO
#USE_HTAGS = NO
VERBATIM_HEADERS = YES
#---------------------------------------------------------------------------
# configuration options related to the alphabetical class index
#---------------------------------------------------------------------------
ALPHABETICAL_INDEX = NO
COLS_IN_ALPHA_INDEX = 5
IGNORE_PREFIX =
#---------------------------------------------------------------------------
# configuration options related to the HTML output
#---------------------------------------------------------------------------
GENERATE_HTML = YES
HTML_OUTPUT = html
HTML_FILE_EXTENSION = .html
HTML_HEADER =
HTML_FOOTER =
HTML_STYLESHEET =
HTML_ALIGN_MEMBERS = YES
GENERATE_HTMLHELP = NO
CHM_FILE =
HHC_LOCATION =
GENERATE_CHI = NO
BINARY_TOC = NO
TOC_EXPAND = NO
DISABLE_INDEX = NO
ENUM_VALUES_PER_LINE = 4
GENERATE_TREEVIEW = YES
TREEVIEW_WIDTH = 250
#---------------------------------------------------------------------------
# configuration options related to the LaTeX output
#---------------------------------------------------------------------------
GENERATE_LATEX = NO
LATEX_OUTPUT = latex
LATEX_CMD_NAME = latex
MAKEINDEX_CMD_NAME = makeindex
COMPACT_LATEX = NO
PAPER_TYPE = a4wide
EXTRA_PACKAGES =
LATEX_HEADER =
PDF_HYPERLINKS = NO
USE_PDFLATEX = NO
LATEX_BATCHMODE = NO
LATEX_HIDE_INDICES = NO
#---------------------------------------------------------------------------
# configuration options related to the RTF output
#---------------------------------------------------------------------------
GENERATE_RTF = NO
RTF_OUTPUT = rtf
COMPACT_RTF = NO
RTF_HYPERLINKS = NO
RTF_STYLESHEET_FILE =
RTF_EXTENSIONS_FILE =
#---------------------------------------------------------------------------
# configuration options related to the man page output
#---------------------------------------------------------------------------
GENERATE_MAN = NO
MAN_OUTPUT = man
MAN_EXTENSION = .3
MAN_LINKS = YES
#---------------------------------------------------------------------------
# configuration options related to the XML output
#---------------------------------------------------------------------------
GENERATE_XML = NO
XML_OUTPUT = xml
XML_SCHEMA =
XML_DTD =
XML_PROGRAMLISTING = YES
#---------------------------------------------------------------------------
# configuration options for the AutoGen Definitions output
#---------------------------------------------------------------------------
GENERATE_AUTOGEN_DEF = NO
#---------------------------------------------------------------------------
# configuration options related to the Perl module output
#---------------------------------------------------------------------------
GENERATE_PERLMOD = NO
PERLMOD_LATEX = NO
PERLMOD_PRETTY = YES
PERLMOD_MAKEVAR_PREFIX =
#---------------------------------------------------------------------------
# Configuration options related to the preprocessor
#---------------------------------------------------------------------------
ENABLE_PREPROCESSING = YES
MACRO_EXPANSION = NO
EXPAND_ONLY_PREDEF = NO
SEARCH_INCLUDES = YES
INCLUDE_PATH =
INCLUDE_FILE_PATTERNS =
PREDEFINED = DOXYGEN \
HWRENDER \
DIRECTFULLSCREEN \
HW3SOUND \
LOGMESSAGES \
WALLSPLATS \
FLOORSPLATS
EXPAND_AS_DEFINED =
SKIP_FUNCTION_MACROS = YES
#---------------------------------------------------------------------------
# Configuration::additions related to external references
#---------------------------------------------------------------------------
TAGFILES =
GENERATE_TAGFILE =
ALLEXTERNALS = NO
EXTERNAL_GROUPS = YES
PERL_PATH = /usr/bin/perl
#---------------------------------------------------------------------------
# Configuration options related to the dot tool
#---------------------------------------------------------------------------
CLASS_DIAGRAMS = YES
HIDE_UNDOC_RELATIONS = YES
HAVE_DOT = NO
CLASS_GRAPH = YES
COLLABORATION_GRAPH = YES
GROUP_GRAPHS = YES
UML_LOOK = NO
TEMPLATE_RELATIONS = NO
INCLUDE_GRAPH = YES
INCLUDED_BY_GRAPH = YES
CALL_GRAPH = NO
GRAPHICAL_HIERARCHY = YES
DIRECTORY_GRAPH = YES
DOT_IMAGE_FORMAT = png
DOT_PATH =
DOTFILE_DIRS =
MAX_DOT_GRAPH_WIDTH = 1024
MAX_DOT_GRAPH_HEIGHT = 1024
MAX_DOT_GRAPH_DEPTH = 1000
DOT_TRANSPARENT = NO
DOT_MULTI_TARGETS = NO
GENERATE_LEGEND = YES
DOT_CLEANUP = YES
#---------------------------------------------------------------------------
# Configuration::additions related to the search engine
#---------------------------------------------------------------------------
SEARCHENGINE = NO
+85 -17
View File
@@ -1,35 +1,103 @@
# SRB2Kart-Saturn
SRB2Kart-Saturn is a modification of SRB2Kart with a focus on new Features, Fixes, Optimizations and general Improvements, all while retaining 100% compatibility with vanilla SRB2Kart.
# SRB2Kart: Saturn
[SRB2Kart](https://srb2.org/mods/) is a kart racing mod based on the 3D Sonic the Hedgehog fangame [Sonic Robo Blast 2](https://srb2.org/), based on a modified version of [Doom Legacy](http://doomlegacy.sourceforge.net/).
For more information on Saturn´s features check out the changelogs on the [Releases](https://github.com/Indev450/SRB2Kart-Saturn/releases) page and the ingame "Saturn Options" menu.
## Saturn Features (Take a look at the "Saturn Options" menu c;)
Also be sure to check the LUASTUFF file for more information on all the extra lua features Saturn has.
- Sprites player rotation on slopes; going on hills, levitate, going down, and so on alters your sprites (configurable)
- You can alter all the base kart HUD element offsets on the fly in the Saturn Options settings menu
- `addfilelocal` Command, for those who want to use things like their custom hud in netgames (Same as addfile but completely client sided)
- Palette rendering, make the OpenGL renderer (almost) look like software mode!
- OpenMPT for Tracker module playback instead of GME
- Fixes looping and sounds better
- Allows filter configuration
- Colourize your Kart HUD, to either your player color or whichever colour you like! (optional / requieres extra2.kart file)
- The minimal brightness with Shaders can be configured, now you can seeeee in dark areas (0-255 , uses Sector brightness values)
- Lua HUD hooks for Intermission (ex: You can make hostmod votes still visible during intermission!)
- Lua HUD hooks for Vote Screen (ex: You can make hostmod votes still visible during map vote screen!)
- Saltyhop! do a funny hop
- Smaller Speedometer (optional / requieres extra.kart file)
- Record Attack input display can now be used everywhere
- Smaller minimap icons and also show player names on the minimap (toggable)
- Support for animated votescreens!
- `showmusiccredit` command, shows you the current music track again
- `listskins` show a list of all skins currently loaded
- Visual Portals from Haya's HEP Client
- Horizonline effect in OpenGL (watch the endless bricks on SNES Bowsers Castle!)
- Localskins! use whatever skin you like!
- Toggable lowercase menu's also from Haya's HEP client
- Everything that Galaxy has
We also have a Flatpak available on [Flathub](https://flathub.org/en/apps/org.srb2.SRB2Kart-Saturn)! (many thanks to riomccloud!)
## Improvements / Bug fixes
- Replay size has been increased to 10MiB minimum, to make replay overflows very unlikely to happen
- can be set to 100MiB max with `maxdemosize` command in console
- Music changes now properly show the music credits (ex: Kart maps with easter eggs that alter the music)
- The mapper still has to provide a MusicDEF for this to work.
- Configurable chatlog length (yay can read those messages from 30 mins ago without opening log.txt)
- Configurable timeout for waiting to join a full server (in vanilla this is capped to 5 minutes before it boots you out)
- Characters now spin in skin selection menu (configurable)
- HTTP Addon download speed has been raised dramatically
- configurable with `downloadspeed` command
- HWR Drawnodes have been refactored, this should fix a few rare crashes esp in regards to OpenGL Visportals
- The Position Number in the corner is alot smaller now (half the size!)
- Toggable Lap animation
- Main menu shows the current renderer being used
- MSAA and A2C Antialiasing support (Configurable in renderer.txt file)
- A simple button to rejoin your last visited server
- Ability to show ALL maps in the mapselect screen, this includes hidden or hellmaps "showallmaps yes/no"
- Ability to toggle the Stagetitlecard "maptitles on/off"
## Performance / Debugging
- Access for `mobj_t` and `player_t` fields from Lua has been completely rewritten, for much better performance with many Lua scripts
- Lua shows Tracebacks whenever an error occurs
- The Lua Perfstats page now has multiple pages and is more organized (ps_thinkframe_page X in console)
- People with lower end hardware can disable "screen textures" with "gr_screentextures" command, huge performance gain with minimal visual loss
- Intermission backgrounds, heat wave effects and etc are broken with this
- `ffloorclip`, exclusive to Software, which boosts performance on maps with many Floor over Floor sectors
## Technical fixes
- ZFigthing Textures in Opengl mode have been fixed in engine (well almost all of it)
- FOFs intersecting with slopes have less issues and now render correctly in Opengl
- Midtextures on slopes in Opengl are fixed, many weird guardrails and fences, aswell as some of those sticking out textures from the ground on some maps should be gone
- The annoying depraction messages for `P_TeleportMove` and `P_AproxDistance` have been silenced
- Silenced the annoying "cant find next map..." messages as theyre super useless and annoying anyways
- Added a small cooldown on `map` command due to spamming causing a SIGSEGV
- Many bugfixes to the Software renderer, so its much less prone to crashing
- Many bugfixes to the OpenGL renderer (too many too list all of them here; check the changelogs for more information)
- Bugfixes to the soundsystem, mainly regarding Sound muting
- Refactored Zone Memory Allocations (helps a bit with large maps)
- Many many more crash fixes and other bugfixes to the basegame (too many too list all of them here; check the changelogs for more information)
- Crash Backtraces have been replaced by libbacktrace (except for 32bit Windows builds)
Crashlogs now contain alot more informations. and even more if your build has debug symbols
Also allows 64bit Windows builds to produce Crashlogs!
## MISC
- Bird's Camera Tilting feature is no longer turned on by default
- Bird's warning on the title screen has been removed
## Bugs
- On maps which change the song multiple times on map start (exp: Wandering Falls) may show multiple music credits appearing
- A2C antialiasing makes transparent surfaces even more transparent
- You tell us! c:
## Note
Check the LUASTUFF file for more information on all the lua things Saturn has.
## Dependencies
- SDL2 (Linux/OS X only)
- SDL2-Mixer (Linux/OS X only)
- libupnp (Linux/OS X only)
- libgme (Linux/OS X only)
- libopenmpt (Linux/OS X only)
- libbacktrace (Linux/OS X only, optional, disable support with NOLIBBACKTRACE)
- libupnp (Linux/OS X only, optional, enable support with HAVE_MINIUPNPC)
- libbacktrace (Linux/OS X only)
## Compiling
See [SRB2 Wiki/Source code compiling](http://wiki.srb2.org/wiki/Source_code_compiling). The compiling process for SRB2Kart is largely identical to SRB2.
Currently only the Makefile build system with GCC or Clang compiler is supported.
Visual C++ (MSVC) is unsupported.
64-bit Windows builds are supported and recommended over 32-bit builds, they will build automatically when using the MSYS2 MinGW 64-bit executable (requires the mingw-w64-x86_64-gcc package), no extra flags needed!
The specific DLLs can be found under /libs/dll-binaries/(i686 for 32bit/x86_64 for 64-bit)/ or in the Release packages
Alternatively the [srb2bld](https://github.com/Bijman/srb2bld) script by Bijman can be used aswell!
## Disclaimer
Kart Krew is in no way affiliated with SEGA or Sonic Team. We do not claim ownership of any of SEGA's intellectual property used in SRB2.
+2136
View File
File diff suppressed because it is too large. Load diff
+3033
View File
File diff suppressed because it is too large. Load diff
+133
View File
@@ -0,0 +1,133 @@
version: 1.3.{branch}-{build}
os: MinGW
environment:
CC: ccache
CCACHE_CC: i686-w64-mingw32-gcc
CCACHE_CC_64: x86_64-w64-mingw32-gcc
WINDRES: windres
# c:\mingw-w64 i686 has gcc 6.3.0, so use c:\msys64 7.3.0 instead
MINGW_SDK: c:\msys64\mingw32
# c:\msys64 x86_64 has gcc 8.2.0, so use c:\mingw-w64 7.3.0 instead
MINGW_SDK_64: C:\mingw-w64\x86_64-8.1.0-posix-seh-rt_v6-rev0\mingw64
CFLAGS: -Wall -W -Werror -Wno-error=implicit-fallthrough -Wimplicit-fallthrough=3 -Wno-tautological-compare -Wno-error=suggest-attribute=noreturn
UPX_ZIP: upx391w
UPX_URL: http://upx.sourceforge.net/download/upx391w.zip
CCACHE_EXE: ccache.exe
CCACHE_URL: http://alam.srb2.org/ccache.exe
CCACHE_COMPRESS: true
CCACHE_DIR: C:\Users\appveyor\.ccache
# Disable UPX by default. The user can override this in their Appveyor project settings
NOUPX: 1
##############################
# DEPLOYER VARIABLES
# DPL_ENABLED=1 builds installers for branch names starting with `deployer`.
# DPL_TAG_ENABLED=1 will also build installers for release tags. DPL_ENABLED=1 must also be set.
# Set these in the Appveyor project settings
##############################
DPL_ENABLED: 0
DPL_TAG_ENABLED: 0
DPL_INSTALLER_NAME: srb2kart-v13
# Asset handling is barebones vs. Travis Deployer. We operate on 7z only.
# Include the README files and the OpenGL batch in the main and patch archives.
# The x86/x64 archives contain the DLL binaries.
ASSET_ARCHIVE_PATH: https://github.com/mazmazz/Kart-Public/releases/download/kart_assets/srb2kart-v102-assets.7z
ASSET_ARCHIVE_PATCH_PATH: https://github.com/mazmazz/Kart-Public/releases/download/kart_assets/srb2kart-v102-patch-assets.7z
ASSET_ARCHIVE_X86_PATH: https://github.com/mazmazz/Kart-Public/releases/download/kart_assets/srb2kart-v102-x86-assets.7z
ASSET_ARCHIVE_X64_PATH: https://github.com/mazmazz/Kart-Public/releases/download/kart_assets/srb2kart-v102-x64-assets.7z
ASSET_ARCHIVE_OPTIONAL_PATH: https://github.com/mazmazz/Kart-Public/releases/download/kart_assets/srb2kart-v102-optional-assets.7z
# This is overridden to 1 for release tag builds
ASSET_FILES_OPTIONAL_GET: 0
# For patches, also include the X86/X64 DLLs.
PACKAGE_PATCH_DLL_GET: 0
# Delete all asset downloads so they can be redownloaded
ASSET_CLEAN: 0
cache:
- upx391w.zip
- ccache.exe
- C:\Users\appveyor\.ccache
- C:\Users\appveyor\srb2_cache
install:
- if [%CONFIGURATION%] == [SDL64] ( set "X86_64=1" )
- if [%CONFIGURATION%] == [SDL64] ( set "CONFIGURATION=SDL" )
- if [%X86_64%] == [1] ( set "MINGW_SDK=%MINGW_SDK_64%" )
- if [%X86_64%] == [1] ( set "CCACHE_CC=%CCACHE_CC_64%" )
- if not exist "%UPX_ZIP%.zip" appveyor DownloadFile "%UPX_URL%" -FileName "%UPX_ZIP%.zip"
- 7z x -y "%UPX_ZIP%.zip" -o%TMP% >null
- robocopy /S /xx /ns /nc /nfl /ndl /np /njh /njs "%TMP%\%UPX_ZIP%" "%MINGW_SDK%\bin" upx.exe || exit 0
- if not exist "%CCACHE_EXE%" appveyor DownloadFile "%CCACHE_URL%" -FileName "%CCACHE_EXE%"
- ccache -M 99M
- xcopy /Y /V /I ccache.exe "%MINGW_SDK%\bin"
configuration:
- SDL
#- SDL64
before_build:
- set "Path=%MINGW_SDK%\bin;%Path%"
- if [%X86_64%] == [1] ( x86_64-w64-mingw32-gcc --version ) else ( i686-w64-mingw32-gcc --version )
- mingw32-make --version
- if not [%NOUPX%] == [1] ( upx -V )
- ccache -V
- ccache -s
- if [%NOUPX%] == [1] ( set "NOUPX=NOUPX=1" ) else ( set "NOUPX=" )
- if defined [%APPVEYOR_PULL_REQUEST_HEAD_COMMIT%] ( set "COMMIT=%APPVEYOR_PULL_REQUEST_HEAD_COMMIT%" ) else ( set "COMMIT=%APPVEYOR_REPO_COMMIT%" )
- cmd: git rev-parse --short %COMMIT%>%TMP%/gitshort.txt
- cmd: set /P GITSHORT=<%TMP%/gitshort.txt
# for pull requests, take the owner's name only, if this isn't the same repo of course
- set "REPO=%APPVEYOR_REPO_BRANCH%"
- if not [%APPVEYOR_PULL_REQUEST_HEAD_REPO_NAME%] == [] ( if not [%APPVEYOR_PULL_REQUEST_HEAD_REPO_NAME%] == [%APPVEYOR_REPO_NAME%] ( for /f "delims=/" %%a in ("%APPVEYOR_PULL_REQUEST_HEAD_REPO_NAME%") do set "REPO=%%a-%APPVEYOR_PULL_REQUEST_HEAD_REPO_BRANCH%" ) )
- set "EXENAME=EXENAME=srb2win-%REPO%-%GITSHORT%.exe"
- set "SRB2_MFLAGS=-C src WARNINGMODE=1 CCACHE=1 NOOBJDUMP=1 %NOUPX% %EXENAME%"
- if [%X86_64%] == [1] ( set "MINGW_FLAGS=MINGW64=1 X86_64=1 GCC81=1" ) else ( set "MINGW_FLAGS=MINGW=1 GCC91=1" )
- set "SRB2_MFLAGS=%SRB2_MFLAGS% %MINGW_FLAGS% %CONFIGURATION%=1"
build_script:
- cmd: mingw32-make.exe %SRB2_MFLAGS% clean
- cmd: mingw32-make.exe %SRB2_MFLAGS% ERRORMODE=1 -k
after_build:
- if [%X86_64%] == [1] (
set "BUILD_PATH=bin\Mingw64\Release"
) else (
set "BUILD_PATH=bin\Mingw\Release"
)
- if [%X86_64%] == [1] ( set "CONFIGURATION=%CONFIGURATION%64" )
- ccache -s
- set BUILD_ARCHIVE=%REPO%-%GITSHORT%-%CONFIGURATION%.7z
- set BUILDSARCHIVE=%REPO%-%CONFIGURATION%.7z
- cmd: 7z a %BUILD_ARCHIVE% %BUILD_PATH% -xr!.gitignore
- appveyor PushArtifact %BUILD_ARCHIVE%
- cmd: copy %BUILD_ARCHIVE% %BUILDSARCHIVE%
- appveyor PushArtifact %BUILDSARCHIVE%
##############################
# DEPLOYER SCRIPT
##############################
- if [%DPL_ENABLED%] == [1] ( call "deployer\appveyor\deployer.bat" )
test: off
#deploy:
# - provider: FTP
# protocol: ftps
# host:
# secure: NsLJEPIBvmwCOj8Tg8RoRQ==
# username:
# secure: ejxi5mvk7oLYu7QtbYojajEPigMy0mokaKhuEVuDZcA=
# password:
# secure: Hbn6Uy3lT0YZ88yFJ3aW4w==
# folder: appveyor
# application:
# active_mode: false
# on:
# branch: master
# appveyor_repo_tag: true
on_finish:
#- cmd: echo xfreerdp /u:appveyor /cert-ignore +clipboard /v:<ip>:<port>
#- ps: $blockRdp = $true; iex ((new-object net.webclient).DownloadString('https://raw.githubusercontent.com/appveyor/ci/master/scripts/enable-rdp.ps1'))
+70
View File
@@ -0,0 +1,70 @@
srb2 for Debian
---------------
SRB2 Debian package!
Hi there, to rebuild these packages just use debuild in the root source directory (not /src!).
You can build these with or without a key if you want, but if you want to put these on a repo,
generate your own GnuPG key as per the https://help.ubuntu.com/community/GnuPrivacyGuardHowto
instructions and pass the -k<keyid> command to debuild. Make sure you export the key footprint
and give them to your users to install with apt-key add. Thanks!
-- Callum Dickinson <gcfreak_ag20@hotmail.com> 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 <jdoe@example.com>" to match
the identity of the key you will use to sign the package.
Building for Launchpad PPA
Use these steps to prepare building a source package for Launchpad:
1. cd [repo-root]
2. git reset --hard; git clean -fd; git clean -fx;
* Resets your repo folder to a committed state and removes untracked files
* If you built srb2-data in the assets/ folder, MAKE SURE THAT FOLDER DOES NOT HAVE ASSETS,
OR THEY MAY BE INCLUDED IN THE MAIN SOURCE PACKAGE!
Build the source package:
1. source [repo-root]/debian_template.sh
* Initializes defaults for the package variables and fills in templates.
2. debuild -S (builds the source package for Launchpad)
Signing for Launchpad PPA
First, follow Callum's instructions to generate a GnuPG key with your identity. You will need
to publish the fingerprint of that key to Ubuntu's key server.
https://help.ubuntu.com/community/GnuPrivacyGuardHowto#Uploading_the_key_to_Ubuntu_keyserver
Next, you will have to add that key fingerprint to your Launchpad account. Go to your Launchpad
profile and click the yellow Edit button next to "OpenPGP keys". Once you add the key, you can
upload signed source packages and publish them onto your PPA.
IF YOU UPLOAD A PACKAGE and Launchpad does NOT send you a confirmation or rejection email, that
means your key is not set up correctly with your Launchpad account.
Finally, if your packages have not already been signed, follow these steps:
1. cd ..
* Packages are located in the parent folder of where debuild was called
2. debsign "srb2_[version]_source.changes"
* You may need to specify -k [key-fingerprint]
Uploading for Launchpad PPA
Follow the instructions at <https://help.launchpad.net/Packaging/PPA/Uploading> to upload
to your PPA and have Launchpad build your binary deb packages.
-- Marco Zafra <marco.a.zafra@gmail.com> Mon, 26 Nov 2018 21:13:00 -0500
+46
View File
@@ -0,0 +1,46 @@
srb2 for Debian
---------------
Here it is! SRB2 v2.1.2 source code!
GNU/Linux
~~~
Dependencies:
SDL 1.2.7 or better (from libsdl.org)
SDL_Mixer 1.2.2(.7 for file-less music playback) (from libsdl.org)
Nasm (use NOASM=1 if you don't have it or have an non-i386 system, I think)
libPNG 1.2.7
Zlib 1.2.3
The Xiph.org libogg and libvorbis libraries
The OpenGL headers (from Mesa, usually shipped with your X.org or XFree
installation, so you needn't worry, most likely)
GCC 3.x toolchain and binutils
GNU Make
Build instructions:
make -C src LINUX=1
Build instructions for non-X86 devices (such as X64):
make -C src LINUX=1 NONX86=1
Build instructions to build for Wii Linux/SRB2Wii on a PowerPC system,
follow cross-compiling instructions for cross-compiling on a x86 system:
make -C src LINUX=1 WIILINUX=1
Build instructions to build for Pandora (Linux) on a ARM system,
follow cross-compiling instructions for cross-compiling on a x86 system:
make -C src PANDORA=1
-------------------------------------------------------------------------------
binaries will turn in up in bin/
note: read the src/makefile for more options
- Sonic Team Junior
http://www.srb2.org
+5
View File
@@ -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}
+1
View File
@@ -0,0 +1 @@
7
+51
View File
@@ -0,0 +1,51 @@
# SRB2 Debian package control file.
Source: ${PACKAGE_NAME}
Section: games
Priority: extra
Maintainer: ${PACKAGE_GROUP_NAME_EMAIL}
Build-Depends: debhelper (>= 7.0.50~),
libsdl2-dev,
libsdl2-mixer-dev,
libpng-dev | libpng16-dev | libpng12-dev (>= 1.2.7),
zlib1g-dev,
libgme-dev,
libcurl4-openssl-dev,
libglu1-dev | libglu-dev,
libosmesa6-dev | libgl-dev,
nasm [i386]
Standards-Version: 3.8.4
Homepage: ${PACKAGE_WEBSITE}
Package: ${PACKAGE_NAME}
Architecture: any
Depends: ${SHLIBS_DEPENDS}, ${MISC_DEPENDS},
${PACKAGE_NAME}-data (>> ${PACKAGE_ASSET_MINVERSION}), ${PACKAGE_NAME}-data (<< ${PACKAGE_ASSET_MAXVERSION}),
libsdl2-2.0-0,
libsdl2-mixer-2.0-0,
zlib1g,
libgme0,
libcurl4,
libpng | libpng16-16 | libpng12-0
Description: A cross-platform 3D Sonic fangame
Sonic Robo Blast 2 is a 3D open-source Sonic the Hedgehog
fangame built using a modified version of the Doom Legacy
port of Doom. SRB2 is closely inspired by the original
Sonic games from the Sega Genesis, and attempts to recreate
the design in 3D. It features tons of levels, enemies, speed,
and quite a lot of the fun that the original Sonic games provided.
Package: ${PACKAGE_NAME}-dbg
Architecture: any
# FIXME: should be Depends: ${SHLIBS_DEPENDS}, ${MISC_DEPENDS}, srb2-data (= 2.1.14), srb2 but dh_shlibdeps is being an asshat
Depends: libc6, ${MISC_DEPENDS}, ${PACKAGE_NAME}-data (>> ${PACKAGE_ASSET_MINVERSION}), ${PACKAGE_NAME}-data (<< ${PACKAGE_ASSET_MAXVERSION}), ${PACKAGE_NAME}
Description: A cross-platform 3D Sonic fangame
Sonic Robo Blast 2 is a 3D open-source Sonic the Hedgehog
fangame built using a modified version of the Doom Legacy
port of Doom. SRB2 is closely inspired by the original
Sonic games from the Sega Genesis, and attempts to recreate
the design in 3D. It features tons of levels, enemies, speed,
and quite a lot of the fun that the original Sonic games provided.
This is a debug binary; its symbols will be loaded by gdb
when the user starts the game with gdb for debugging.
+27
View File
@@ -0,0 +1,27 @@
This work was packaged for Debian by:
${PACKAGE_NAME_EMAIL} ${__PACKAGE_DATETIME}
It was downloaded from:
${PACKAGE_WEBSITE}
Upstream Author(s):
${PACKAGE_GROUP_NAME_EMAIL}
Copyright:
Copyright (C) 1998-2018 by Sonic Team Junior
License:
GNU General Public License, version 2
The Debian packaging is:
Copyright (C) 2010 Callum Dickinson <gcfreak_ag20@hotmail.com>
Copyright (C) 2010-2018 by Sonic Team Junior <stjr@srb2.org>
and is licensed under the GPL version 2,
see "/usr/share/common-licenses/GPL-2".
+4
View File
@@ -0,0 +1,4 @@
README.md
assets/README.txt
assets/LICENSE.txt
assets/LICENSE-3RD-PARTY.txt
+172
View File
@@ -0,0 +1,172 @@
#!/usr/bin/make -f
# -*- makefile -*-
#############################################################################
#
# GNU Make Debian package makefile for SRB2
#
# Copyright (C) 1998-2010 by Callum Dickinson
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# This file most likely will not need to be modified to make
# branches of SRB2 capable of making their own Debian packages,
# instead look at the /debian/control file for configuration.
#
#############################################################################
#############################################################################
#
# !!!!!!!!!! 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
# user/group of to-be-installed files
ROOT_USER := 0
ROOT_GROUP := 0
# determine cross-compile (may need some work)
CROSS_COMPILE_BUILD := $(shell dpkg-architecture -qDEB_BUILD_GNU_TYPE)
CROSS_COMPILE_HOST := $(shell dpkg-architecture -qDEB_HOST_GNU_TYPE)
CROSS_COMPILE := $(shell test "$(CROSS_COMPILE_BUILD)" != "$(CROSS_COMPILE_HOST)" && echo "$(CROSS_COMPILE_HOST)")
MKDIR = mkdir -p
MAKE = make
INSTALL = install -o $(ROOT_USER) -g $(ROOT_GROUP) -m 644
MV = mv
RM = rm -rf
STRIPARGS = --strip-unneeded
ifdef CROSS_COMPILE
STRIP = $(CROSS_COMPILE_HOST)-strip $(STRIPARGS)
else
STRIP = strip $(STRIPARGS)
endif
DIR := $(shell pwd)
# FIXME: hate hate hate head/tail hack :(
CONTROLF = $(DIR)/debian/control
PACKAGE = ${PACKAGE_NAME}
DBGPKG = ${PACKAGE}-dbg
TITLE = ${PROGRAM_NAME}
SECTION = Games/Action
EXENAME = ${PROGRAM_FILENAME}
DBGNAME = debug/$(EXENAME)
PKGDIR = $(shell echo "${PACKAGE_INSTALL_PATH}" | sed -e 's/^\///')
DBGDIR = usr/lib/debug/$(PKGDIR)
LINKDIR = $(shell echo "${PACKAGE_LINK_PATH}" | sed -e 's/^\///')
PIXMAPS_DIR = usr/share/pixmaps
DESKTOP_DIR = usr/share/applications
PREFIX = $(shell test "$(CROSS_COMPILE_BUILD)" != "$(CROSS_COMPILE_HOST)" && echo "PREFIX=$(CROSS_COMPILE_HOST)")
OS = LINUX=1
NONX86 = $(shell test "`echo $(CROSS_COMPILE_HOST) | grep 'i[3-6]86'`" || echo "NONX86=1")
MAKEARGS = $(OS) $(NONX86) $(PREFIX) EXENAME=$(EXENAME) DBGNAME=$(DBGNAME) NOOBJDUMP=1 # SDL_PKGCONFIG=sdl2 PNG_PKGCONFIG=libpng
MENUFILE1 = ?package($(PACKAGE)):needs="X11" section="$(SECTION)"
MENUFILE2 = title="$(TITLE)" command="/$(PKGDIR)/$(PACKAGE)"
BINDIR := $(DIR)/bin/Linux/Release
# FIXME pkg-config dir hacks
# Launchpad doesn't need this; it actually makes i386 builds fail due to cross-compile
# export PKG_CONFIG_LIBDIR = /usr/lib/$(CROSS_COMPILE_HOST)/pkgconfig
LDFLAGS += "-Wl,-rpath=/usr/lib/$(CROSS_COMPILE_HOST)"
# Some libgme-dev packages don't use pkg-config yet, so include the linker flag ourselves
PKG_CONFIG?=pkg-config
LIBGME_PKGCONFIG?=libgme
LIBGME_LDFLAGS?=$(shell $(PKG_CONFIG) $(LIBGME_PKGCONFIG) --libs)
ifeq ($(LIBGME_LDFLAGS),)
MAKEARGS += LIBGME_LDFLAGS=-lgme
endif
build:
$(MKDIR) $(BINDIR)/debug
$(MAKE) -C $(DIR)/src $(MAKEARGS)
$(STRIP) $(BINDIR)/$(EXENAME)
binary-indep:
# only here to kill Lintian warning
echo "no need to do any arch-independent stuff"
binary-arch:
# create ddirs
$(MKDIR) $(DIR)/debian/tmp/$(PKGDIR) $(DIR)/debian/tmp/$(DBGDIR)
$(MKDIR) $(DIR)/debian/tmp/$(PKGDIR) $(DIR)/debian/tmp/$(DESKTOP_DIR)
$(MKDIR) $(DIR)/debian/tmp/$(PKGDIR) $(DIR)/debian/tmp/$(PIXMAPS_DIR)
# install main binaries
$(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/${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
# Generate install folder files
echo $(PKGDIR) > $(DIR)/debian/$(PACKAGE).install
echo $(DESKTOP_DIR) >> $(DIR)/debian/$(PACKAGE).install
echo $(PIXMAPS_DIR) >> $(DIR)/debian/$(PACKAGE).install
echo $(DBGDIR) > $(DIR)/debian/$(DBGPKG).install
# Launchpad only calls binary-arch, so just move everything up
#binary: binary-arch
# Generate .desktop specifications
echo "`echo '$(MENUFILE1)\\'`" > $(DIR)/debian/menu
echo " `echo '$(MENUFILE2)'`" >> $(DIR)/debian/menu
dh_testdir
dh_testroot
dh_installchangelogs
dh_installdocs
# dh_installexamples
dh_install --sourcedir=$(DIR)/debian/tmp
dh_installmenu
# dh_installdebconf
# dh_installlogrotate
# dh_installemacsen
# dh_installpam
# dh_installmime
# dh_python
# dh_installinit
# dh_installcron
# dh_installinfo
# dh_installman
dh_link $(PKGDIR)/$(EXENAME) $(LINKDIR)/$(EXENAME)
dh_compress
dh_fixperms
# dh_perl
# dh_makeshlibs
dh_installdeb
-dh_shlibdeps
dh_gencontrol
dh_md5sums
dh_builddeb
binary: binary-arch
clean:
$(MAKE) -C $(DIR)/src $(MAKEARGS) clean cleandep
$(RM) $(BINDIR)/*
$(RM) $(DIR)/debian/$(PACKAGE)/*
$(RM) $(DIR)/debian/$(DBGPKG)/*
$(RM) $(DIR)/debian/tmp/*
$(RM) $(DIR)/debian/$(PACKAGE).install
$(RM) $(DIR)/debian/$(DBGPKG).install
$(RM) $(DIR)/debian/menu
$(RM) $(DIR)/debian/files
$(RM) $(DIR)/debian/source/include-binaries
.PHONY: all clean binary binary-indep build
+1
View File
@@ -0,0 +1 @@
3.0 (native)
+11
View File
@@ -0,0 +1,11 @@
tar-ignore = "assets/*.srb"
tar-ignore = "assets/*.pk3"
tar-ignore = "assets/*.dta"
tar-ignore = "assets/*.wad"
tar-ignore = "assets/*.kart"
tar-ignore = "assets/debian/${PACKAGE_NAME}-data/*"
tar-ignore = "assets/debian/tmp/*"
tar-ignore = "*.obj"
tar-ignore = "*.dep"
tar-ignore = ".git/*"
tar-ignore = ".git*"
+10
View File
@@ -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;
+166
View File
@@ -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 <jdoe@example.com>" 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;
+195
View File
@@ -0,0 +1,195 @@
@setlocal enableextensions enabledelayedexpansion
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
: Appveyor Deployer
: See appveyor.yml for default variables
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
: Evaluate whether we should be deploying
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
if not [%DPL_ENABLED%] == [1] (
echo Deployer is not enabled...
exit /b
)
: Don't do DD installs because fmodex DLL handling is not implemented.
if [%CONFIGURATION%] == [DD] (
echo Deployer does not support DD builds...
exit /b
)
if [%CONFIGURATION%] == [DD64] (
echo Deployer does not support DD builds...
exit /b
)
: Substring match from https://stackoverflow.com/questions/7005951/batch-file-find-if-substring-is-in-string-not-in-a-file
: The below line says "if deployer is NOT in string"
: Note that APPVEYOR_REPO_BRANCH for pull request builds is the BASE branch that PR is merging INTO
if x%APPVEYOR_REPO_BRANCH:deployer=%==x%APPVEYOR_REPO_BRANCH% (
if not [%APPVEYOR_REPO_TAG%] == [true] (
echo Deployer is enabled but we are not in a release tag or a 'deployer' branch...
exit /b
) else (
if not [%DPL_TAG_ENABLED%] == [1] (
echo Deployer is not enabled for release tags...
exit /b
)
)
)
: Release tags always get optional assets (music.dta)
if [%APPVEYOR_REPO_TAG%] == [true] (
set "ASSET_FILES_OPTIONAL_GET=1"
)
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
: Get asset archives
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
if exist "C:\Users\appveyor\srb2_cache\archives\" (
if [%ASSET_CLEAN%] == [1] (
echo Cleaning asset archives...
rmdir /s /q "C:\Users\appveyor\srb2_cache\archives"
)
)
if not exist "C:\Users\appveyor\srb2_cache\archives\" mkdir "C:\Users\appveyor\srb2_cache\archives"
goto EXTRACT_ARCHIVES
::::::::::::::::::::::::::::::::
: ARCHIVE_NAME_PARTS
: Call this like a function. %archivepath% is the path to extract parts from.
::::::::::::::::::::::::::::::::
for %%a in (%archivepath%) do (
set "file=%%~fa"
set "filepath=%%~dpa"
set "filename=%%~nxa"
)
set "localarchivepath=C:\Users\appveyor\srb2_cache\archives\%filename%"
goto EOF
::::::::::::::::::::::::::::::::
: EXTRACT_ARCHIVES
::::::::::::::::::::::::::::::::
set "archivepath=%ASSET_ARCHIVE_PATH%"
call :ARCHIVE_NAME_PARTS
set "ASSET_ARCHIVE_PATH_LOCAL=%localarchivepath%"
if not exist "%localarchivepath%" appveyor DownloadFile "%ASSET_ARCHIVE_PATH%" -FileName "%localarchivepath%"
set "archivepath=%ASSET_ARCHIVE_PATCH_PATH%"
call :ARCHIVE_NAME_PARTS
set "ASSET_ARCHIVE_PATCH_PATH_LOCAL=%localarchivepath%"
if not exist "%localarchivepath%" appveyor DownloadFile "%ASSET_ARCHIVE_PATCH_PATH%" -FileName "%localarchivepath%"
if not [%X86_64%] == [1] (
set "archivepath=%ASSET_ARCHIVE_X86_PATH%"
call :ARCHIVE_NAME_PARTS
set "ASSET_ARCHIVE_X86_PATH_LOCAL=!localarchivepath!"
if not exist "!localarchivepath!" appveyor DownloadFile "%ASSET_ARCHIVE_X86_PATH%" -FileName "!localarchivepath!"
)
if [%X86_64%] == [1] (
set "archivepath=%ASSET_ARCHIVE_X64_PATH%"
call :ARCHIVE_NAME_PARTS
set "ASSET_ARCHIVE_X64_PATH_LOCAL=!localarchivepath!"
if not exist "!localarchivepath!" appveyor DownloadFile "%ASSET_ARCHIVE_X64_PATH%" -FileName "!localarchivepath!"
)
if [%ASSET_FILES_OPTIONAL_GET%] == [1] (
set "archivepath=%ASSET_ARCHIVE_OPTIONAL_PATH%"
call :ARCHIVE_NAME_PARTS
set "ASSET_ARCHIVE_OPTIONAL_PATH_LOCAL=!localarchivepath!"
if not exist "!localarchivepath!" appveyor DownloadFile "%ASSET_ARCHIVE_OPTIONAL_PATH%" -FileName "!localarchivepath!"
)
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
: Build the installers
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
mkdir "assets\installer"
mkdir "assets\patch"
7z x -y "%ASSET_ARCHIVE_PATH_LOCAL%" -o"assets\installer" >null
7z x -y "%ASSET_ARCHIVE_PATCH_PATH_LOCAL%" -o"assets\patch" >null
: Copy optional files to full installer (music.dta)
if [%ASSET_FILES_OPTIONAL_GET%] == [1] (
7z x -y "%ASSET_ARCHIVE_OPTIONAL_PATH_LOCAL%" -o"assets\installer" >null
)
: Copy EXE -- BUILD_PATH is from appveyor.yml
robocopy /S /ns /nc /nfl /ndl /np /njh /njs "%BUILD_PATH%" "assets\installer" /XF "*.debug" ".gitignore"
robocopy /S /ns /nc /nfl /ndl /np /njh /njs "%BUILD_PATH%" "assets\patch" /XF "*.debug" ".gitignore"
: Are we building DD? (we were supposed to exit earlier!)
if [%CONFIGURATION%] == [DD] ( set "DPL_INSTALLER_NAME=%DPL_INSTALLER_NAME%-DD" )
if [%CONFIGURATION%] == [DD64] ( set "DPL_INSTALLER_NAME=%DPL_INSTALLER_NAME%-DD" )
: If we are not a release tag, suffix the filename
if not [%APPVEYOR_REPO_TAG%] == [true] (
set "INSTALLER_SUFFIX=-%APPVEYOR_REPO_BRANCH%-%GITSHORT%-%CONFIGURATION%"
) else (
set "INSTALLER_SUFFIX="
)
if not [%X86_64%] == [1] ( goto X86_INSTALL )
::::::::::::::::::::::::::::::::
: X64_INSTALL
::::::::::::::::::::::::::::::::
: Extract DLL binaries
7z x -y "%ASSET_ARCHIVE_X64_PATH_LOCAL%" -o"assets\installer" >null
if [%PACKAGE_PATCH_DLL_GET%] == [1] (
7z x -y "!ASSET_ARCHIVE_X64_PATH_LOCAL!" -o"assets\patch" >null
)
: Build the installer
7z a -sfx7z.sfx "%DPL_INSTALLER_NAME%-x64-Installer%INSTALLER_SUFFIX%.exe" .\assets\installer\*
: Build the patch
7z a "%DPL_INSTALLER_NAME%-x64-Patch%INSTALLER_SUFFIX%.zip" .\assets\patch\*
: Upload artifacts
appveyor PushArtifact "%DPL_INSTALLER_NAME%-x64-Installer%INSTALLER_SUFFIX%.exe"
appveyor PushArtifact "%DPL_INSTALLER_NAME%-x64-Patch%INSTALLER_SUFFIX%.zip"
: We only do x86 OR x64, one at a time, so exit now.
goto EOF
::::::::::::::::::::::::::::::::
: X86_INSTALL
::::::::::::::::::::::::::::::::
: Extract DLL binaries
7z x -y "%ASSET_ARCHIVE_X86_PATH_LOCAL%" -o"assets\installer" >null
if [%PACKAGE_PATCH_DLL_GET%] == [1] (
7z x -y "!ASSET_ARCHIVE_X86_PATH_LOCAL!" -o"assets\patch" >null
)
: Build the installer
7z a -sfx7z.sfx "%DPL_INSTALLER_NAME%-Installer%INSTALLER_SUFFIX%.exe" .\assets\installer\*
: Build the patch
7z a "%DPL_INSTALLER_NAME%-Patch%INSTALLER_SUFFIX%.zip" .\assets\patch\*
: Upload artifacts
appveyor PushArtifact "%DPL_INSTALLER_NAME%-Installer%INSTALLER_SUFFIX%.exe"
appveyor PushArtifact "%DPL_INSTALLER_NAME%-Patch%INSTALLER_SUFFIX%.zip"
: We only do x86 OR x64, one at a time, so exit now
goto EOF
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
: EOF
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
endlocal
+157
View File
@@ -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;
+190
View File
@@ -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 <<EOD
spawn debuild -S -us -uc;
expect "continue anyway? (y/n)"
send "y\r"
interact
EOD
);
fi;
if [[ "$_DPL_PACKAGE_BINARY" == "1" ]]; then
echo "Building main binary Debian package";
expect <(cat <<EOD
spawn debuild -us -uc;
expect "continue anyway? (y/n)"
send "y\r"
interact
EOD
);
fi;
cd $OLDPWD;
fi;
# Also an asset package
if [[ "$_DPL_PACKAGE_ASSET" == "1" ]]; then
. ../debian_template.sh asset;
OLDPWD=$PWD; # [repo]/build
cd ../assets;
# make sure the asset files exist, download them if they don't
#echo "Checking asset files for asset Debian package";
#debuild -T build;
if [[ "$_DPL_PACKAGE_SOURCE" == "1" ]]; then
echo "Building asset source Debian package";
expect <(cat <<EOD
spawn debuild -S -us -uc;
expect "continue anyway? (y/n)"
send "y\r"
interact
EOD
);
fi;
if [[ "$_DPL_PACKAGE_BINARY" == "1" ]]; then
echo "Building asset binary Debian package";
expect <(cat <<EOD
spawn debuild -us -uc;
expect "continue anyway? (y/n)"
send "y\r"
interact
EOD
);
fi;
cd $OLDPWD;
fi;
# Now sign our packages
if [[ "$DPL_PGP_KEY_PRIVATE" != "" ]] && [[ "$DPL_PGP_KEY_PASSPHRASE" != "" ]]; then
# Get the key to sign
# Do this AFTER debuild so that we can specify the passphrase in command line
echo "$DPL_PGP_KEY_PRIVATE" | base64 --decode > 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;
+105
View File
@@ -0,0 +1,105 @@
#!/bin/bash
# Deployer for Travis-CI
# Default Variables
#
# Here are all of the user-set variables used by Deployer.
# See the "Cross-platform deployment" page on SRB2 Wiki for documentation.
# Core Parameters
: ${DPL_ENABLED} # Enable Deployer behavior; must be set for any deployment activity
: ${DPL_TAG_ENABLED} # Trigger Deployer for all tag releases
: ${DPL_JOB_ENABLE_ALL} # Enable all jobs for deployment
: ${DPL_TERMINATE_TESTS} # Terminate all build test jobs (used in .travis.yml)
: ${DPL_TRIGGER} # Use a [word] in the commit message to trigger Deployer
: ${DPL_JOBNAMES} # Trigger Deployer by job name
: ${DPL_OSNAMES} # Trigger Deployer by OS name (osx,linux)
: ${DPL_BRANCHES} # Trigger Deployer by git branch name
# Job Parameters
: ${_DPL_JOB_ENABLED} # Enable Deployer for this specific job. DPL_ENABLED must be set too.
: ${_DPL_JOB_NAME} # Identifier for the job, used for logging and trigger word matching
: ${_DPL_FTP_TARGET} # Deploy to FTP
: ${_DPL_DPUT_TARGET} # Deploy to DPUT
: ${_DPL_PACKAGE_SOURCE} # Build packages into a Source distribution. Linux only.
: ${_DPL_PACKAGE_BINARY} # Build packages into a Binary distribution.
: ${_DPL_PACKAGE_MAIN:=1} # Build main installation package. Linux only; OS X assumes this.
: ${_DPL_PACKAGE_ASSET} # Build asset installation package. Linux only.
# Asset File Parameters
: ${ASSET_ARCHIVE_PATH:=https://github.com/mazmazz/Kart-Public/releases/download/kart_assets/srb2kart-v102-assets.7z}
: ${ASSET_ARCHIVE_OPTIONAL_PATH:=https://github.com/mazmazz/Kart-Public/releases/download/kart_assets/srb2kart-v102-optional-assets.7z}
: ${ASSET_FILES_HASHED:=srb2.srb patch.kart gfx.kart textures.kart chars.kart maps.kart}
: ${ASSET_FILES_DOCS:=README.txt HISTORY.txt LICENSE.txt LICENSE-3RD-PARTY.txt}
: ${ASSET_FILES_OPTIONAL_GET:=0}
# FTP Parameters
: ${DPL_FTP_PROTOCOL}
: ${DPL_FTP_USER}
: ${DPL_FTP_PASS}
: ${DPL_FTP_HOSTNAME}
: ${DPL_FTP_PORT}
: ${DPL_FTP_PATH}
# DPUT Parameters
: ${DPL_DPUT_DOMAIN:=ppa.launchpad.net}
: ${DPL_DPUT_METHOD:=sftp}
: ${DPL_DPUT_INCOMING}
: ${DPL_DPUT_LOGIN:=anonymous}
: ${DPL_SSH_KEY_PRIVATE} # Base64-encoded private key file. Used to sign repository uploads
: ${DPL_SSH_KEY_PASSPHRASE} # Decodes the private key file.
# Package Parameters
: ${PACKAGE_NAME:=srb2kart}
: ${PACKAGE_VERSION:=1.0.2}
: ${PACKAGE_SUBVERSION} # Highly recommended to set this to reflect the distro series target (e.g., ~18.04bionic)
: ${PACKAGE_REVISION} # Defaults to UTC timestamp
: ${PACKAGE_INSTALL_PATH:=/usr/games/SRB2Kart}
: ${PACKAGE_LINK_PATH:=/usr/games}
: ${PACKAGE_DISTRO:=trusty}
: ${PACKAGE_URGENCY:=high}
: ${PACKAGE_NAME_EMAIL:=Kart Krew <stjr@srb2.org>}
: ${PACKAGE_GROUP_NAME_EMAIL:=Kart Krew <stjr@srb2.org>}
: ${PACKAGE_WEBSITE:=<https://mb.srb2.org/showthread.php?p=802695>}
: ${PACKAGE_ASSET_MINVERSION:=1.0.1} # Number this the version BEFORE the actual required version, because we do a > check
: ${PACKAGE_ASSET_MAXVERSION:=1.0.3} # Number this the version AFTER the actual required version, because we do a < check
: ${PROGRAM_NAME:=Sonic Robo Blast 2 Kart}
: ${PROGRAM_VENDOR:=Kart Krew}
: ${PROGRAM_VERSION:=1.0.2}
: ${PROGRAM_DESCRIPTION:=A kart racing mod based on the 3D Sonic the Hedgehog fangame Sonic Robo Blast 2.}
: ${PROGRAM_FILENAME:=srb2kart}
: ${DPL_PGP_KEY_PRIVATE} # Base64-encoded private key file. Used to sign Debian packages
: ${DPL_PGP_KEY_PASSPHRASE} # Decodes the private key file.
# Export Asset and Package Parameters for envsubst templating
export ASSET_ARCHIVE_PATH="${ASSET_ARCHIVE_PATH}"
export ASSET_ARCHIVE_OPTIONAL_PATH="${ASSET_ARCHIVE_OPTIONAL_PATH}"
export ASSET_FILES_HASHED="${ASSET_FILES_HASHED}"
export ASSET_FILES_DOCS="${ASSET_FILES_DOCS}"
export ASSET_FILES_OPTIONAL_GET="${ASSET_FILES_OPTIONAL_GET}"
export PACKAGE_NAME="${PACKAGE_NAME}"
export PACKAGE_VERSION="${PACKAGE_VERSION}"
export PACKAGE_SUBVERSION="${PACKAGE_SUBVERSION}" # in case we have this
export PACKAGE_REVISION="${PACKAGE_REVISION}"
export PACKAGE_ASSET_MINVERSION="${PACKAGE_ASSET_MINVERSION}"
export PACKAGE_ASSET_MAXVERSION="${PACKAGE_ASSET_MAXVERSION}"
export PACKAGE_INSTALL_PATH="${PACKAGE_INSTALL_PATH}"
export PACKAGE_LINK_PATH="${PACKAGE_LINK_PATH}"
export PACKAGE_DISTRO="${PACKAGE_DISTRO}"
export PACKAGE_URGENCY="${PACKAGE_URGENCY}"
export PACKAGE_NAME_EMAIL="${PACKAGE_NAME_EMAIL}"
export PACKAGE_GROUP_NAME_EMAIL="${PACKAGE_GROUP_NAME_EMAIL}"
export PACKAGE_WEBSITE="${PACKAGE_WEBSITE}"
export PROGRAM_NAME="${PROGRAM_NAME}"
export PROGRAM_VERSION="${PROGRAM_VERSION}"
export PROGRAM_DESCRIPTION="${PROGRAM_DESCRIPTION}"
export PROGRAM_FILENAME="${PROGRAM_FILENAME}"
# This file is called in debian_template.sh, so mark our completion so we don't run it again
__DEBIAN_PARAMETERS_INITIALIZED=1
+133
View File
@@ -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 <<EOD
spawn dput -c "${OLDPWD}/dput.cf" deployer "$f";
expect "Enter passphrase for key"
send "${DPL_SSH_KEY_PASSPHRASE}\r"
interact
EOD
);
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 ..;
# 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 <<EOD
spawn dput -c "${OLDPWD}/dput.cf" deployer "$f";
expect "Enter passphrase for key"
send "${DPL_SSH_KEY_PASSPHRASE}\r"
interact
EOD
);
done;
done;
# Go back to [repo]/build folder
cd $OLDPWD;
fi;
srm ./key.private;
fi;
+137
View File
@@ -0,0 +1,137 @@
#!/bin/bash
# Deployer for Travis-CI
# FTP Uploader
#
# Package files are uploaded to, e.g., ftp://username:password@example.com:21/path/to/upload/STJr/SRB2/master/460873812-151.1
# With file `commit.txt` and folder(s) `bin` and `package`
#
# Set these environment variables in your Travis-CI settings, where they are stored securely.
# See other shell scripts for more options.
#
# DPL_FTP_PROTOCOL = ftp (ftp or sftp or ftps or however your FTP URI begins)
# DPL_FTP_USER = username
# DPL_FTP_PASS = password
# DPL_FTP_HOSTNAME = example.com
# DPL_FTP_PORT = 21
# DPL_FTP_PATH = path/to/upload (do not add trailing slash)
if [[ "$__DPL_FTP_ACTIVE" == "1" ]]; then
if [[ "$TRAVIS_JOB_NAME" != "" ]]; then
JOBNAME=$TRAVIS_JOB_NAME;
else
if [[ "$_DPL_JOB_NAME" != "" ]]; then
JOBNAME=$_DPL_JOB_NAME;
else
JOBNAME=$TRAVIS_OS_NAME;
fi;
fi;
# Generate commit.txt file
echo "Travis-CI Build $TRAVIS_OS_NAME - $TRAVIS_REPO_SLUG/$TRAVIS_BRANCH - $TRAVIS_JOB_NUMBER - $JOBNAME" > "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
+93
View File
@@ -0,0 +1,93 @@
================================================================
How to add Low-res modes to your XF86Config under Linux MANUALLY
================================================================
I TAKE NO RESPONSIBILITY FOR ANY DAMAGE DONE TO YOUR EQUIPMENT!!!
This document explains how to add low-res modes like 320x200 to your
X-Server configuration, because some new setup tools for the X-Server
do not support this. ONLY RECOMMENDED FOR USERS WHO KNOW WHAT THEY DO!
I do not take any responsibility for damage done to your monitor, your
videocard, your harddisk, your cat, your dog or anything else!!!
IMPORTANT IS, THAT YOUR "HorizSync" AND "VertRefresh" VALUES REALLY
MATCH YOUR MONITOR! OTHERWISE YOUR MONITOR CAN BLOW UP!!!
OK, if you have read up to here, you either know what you do or really
die-hard want those low-res modes. Here is what to do:
Look up your XF86Config. Is is either in /etc or in /etc/X11. Here is
what you have to add to the definition of your modeslines:
# Low-res Doublescan modes
# If your chipset does not support doublescan, you get a 'squashed'
# resolution like 320x400.
# 320x200 @ 70 Hz, 31.5 kHz hsync, 8:5 aspect ratio
Modeline "320x200" 12.588 320 336 384 400 200 204 205 225 Doublescan
# 320x240 @ 60 Hz, 31.5 kHz hsync, 4:3 aspect ratio
Modeline "320x240" 12.588 320 336 384 400 240 245 246 262 Doublescan
# 320x240 @ 72 Hz, 36.5 kHz hsync
Modeline "320x240" 15.750 320 336 384 400 240 244 246 262 Doublescan
# 400x300 @ 56 Hz, 35.2 kHz hsync, 4:3 aspect ratio
ModeLine "400x300" 18 400 416 448 512 300 301 302 312 Doublescan
# 400x300 @ 60 Hz, 37.8 kHz hsync
Modeline "400x300" 20 400 416 480 528 300 301 303 314 Doublescan
# 400x300 @ 72 Hz, 48.0 kHz hsync
Modeline "400x300" 25 400 424 488 520 300 319 322 333 Doublescan
If your video card only supports a specific set of discrete dotclocks
(RAMDAC) you may have to replace the dotclocks given here by one of the
specified (e.g in the first modeline the dotclock is 12.588 MHz). I believe
that nowadays all cards and monitors should work with these settings, but
if you have outdated hardware you better check the frequencies yourself. If
there is any uncertainty, please check the "XFree86 Video Timings HOWTO".
Then have a look at the section "Screen" with the appropriate driver
(usually either "svga" or "accel"). Under Subsection "Display" there
are modes for the given color depth. Add the desired modes. As an
example I give you my screens definition here with low-res modes in
16 bit color depth:
Section "Screen"
Driver "accel"
Device "3D Charger"
Monitor "Iiyama Pro 450"
DefaultColorDepth 16
Subsection "Display"
Depth 8
Modes "1280x1024" "1024x768" "800x600" "640x480"
ViewPort 0 0
Virtual 1280 1024
EndSubsection
Subsection "Display"
Depth 16
Modes "1152x864" "1024x768" "800x600" "640x480" "400x300" "320x200" <- THIS IS ACTUALLY WHAT YOU WANT!!!
ViewPort 0 0 ^^^^^^^^^^^^^^^^^^^
Virtual 1152 864
EndSubsection
Subsection "Display"
Depth 24
Modes "800x600" "640x480"
ViewPort 0 0
Virtual 800 600
EndSubsection
Subsection "Display"
Depth 32
Modes "800x600" "640x480"
ViewPort 0 0
Virtual 800 600
EndSubsection
EndSection
Once again: important is, that you edit the correct Screen section.
If you use the SVGA Server and edit the ACCEL Server, you might
wonder where your new modes have gone.
If everything went fine and you want to say thank you, just write
to "metzgermeister@users.sourceforge.net". If your monitor blew
up and you want to kill me, find me playing Legacy or Q3A on the net
and frag me (with your second monitor, hehe).
- metzgermeister
+212
View File
@@ -0,0 +1,212 @@
1-99 : Player Starts
1 - Player 1 Start 1
2 - Player 2 Start 2
3 - Player 3 Start 3
4 - Player 4 Start 4
5 - Player 5 Start 4001
6 - Player 6 Start 4002
7 - Player 7 Start 4003
8 - Player 8 Start 4004
9 - Player 9 Start 4005
10 - Player 10 Start 4006
11 - Player 11 Start 4007
12 - Player 12 Start 4008
13 - Player 13 Start 4009
14 - Player 14 Start 4010
15 - Player 15 Start 4011
16 - Player 16 Start 4012
17 - Player 17 Start 4013
18 - Player 18 Start 4014
19 - Player 19 Start 4015
20 - Player 20 Start 4016
21 - Player 21 Start 4017
22 - Player 22 Start 4018
23 - Player 23 Start 4019
24 - Player 24 Start 4020
25 - Player 25 Start 4021
26 - Player 26 Start 4022
27 - Player 27 Start 4023
28 - Player 28 Start 4024
29 - Player 29 Start 4025
30 - Player 30 Start 4026
31 - Player 31 Start 4027
32 - Player 32 Start 4028
33 - Player Match Start 11
34 - Red Team Start 87
35 - Blue Team Start 89
36 - Tag start New
100 - 199 : Enemies
100 - Blue Crawla 3004
101 - Red Crawla 9
102 - GFZ Fish 58
103 - Gold Buzz 5005
104 - Red Buzz 5006
105 - Jetty-Syn Bomber 3005
106 - Jetty-Syn Gunner 22
107 - Crawla Commander 21
108 - Deton 71
109 - Skim 56
110 - THZ Turret 2004
111 - Pop-up Turret 42
200 - 299 : Bosses and their associated items (if any)
200 - Boss 1 16
201 - Boss 2 2008
290 - Boss Fly Point 17
291 - EggTrap Center 2049
300 - 399 : Collectibles
300 - Ring 2014
301 - Homing Ring 69
302 - Rail Ring 3003
303 - Infinity Ring 80
304 - Automatic Ring 26
305 - Explosion Ring 54
306 - Red CTF Flag 31
307 - Blue CTF Flag 34
308 - Special Stage Token 2013
309 - Emerald 1 420
310 - Emerald 2 421
311 - Emerald 3 422
312 - Emerald 4 423
313 - Emerald 5 424
314 - Emerald 6 425
315 - Emerald 7 426
316 - Hunting Emerald 1 64
317 - Hunting Emerald 2 3002
318 - Hunting Emerald 3 3001
400 - 499 : Boxes
400 - Super Ring Box 2011
401 - Grey Ring Box 2012
402 - Ring Shield Box 48
403 - Fire Shield Box 2002
404 - Bomb Shield Box 2018
405 - Jump Shield Box 35
406 - Water Shield Box 2028
407 - Sneaker Box 25
408 - Invincibility Box 2022
409 - 1-Up Box 41
410 - Eggman Box 2005
411 - Mixup Box 78
412 - Question Box 3000
500 - 599 : Interactive Objects (friendly or otherwise - includes springs)
500 - Bubble Patch 33
501 - Level End Sign 86
502 - Starpost 3006
520 - Spike Ball -1
521 - Special Stage Spike Ball 23
522 - Ceiling Spike 67
523 - Floor Spike 68
540 - Fan 32
541 - Steam Riser 30
550 - Yellow Spring 28
551 - Red Spring 79
552 - Blue Spring 5004
553 - Yellow Spring Down 65
554 - Red Spring Down 66
555 - Yellow Diagonal Spring 2015
556 - Red Diagonal Spring 38
557 - Yellow Diag Spring Down 20
558 - Red Diag Spring Down 39
600 - 699 : Special placement patterns
600 - Vertical Rigns - Stack of 5 (suitable for Yellow Spring) 84
601 - Vertical Rings - Stack of 5 (suitable for Red Spring) 44
602 - Diagonal rings (5) 76
603 - Diagonal rings (10) 77
604 - A ring of rings 47
605 - A BIGGER ring of rings 2007
606 - A ring of wing items 2048
607 - A BIGGER ring of wing items 2010
608 - A ring of rings and wings (alternating) 2046
609 - A BIGGER ring of rings and wings (alternating) 2047
700 - 799 : Powerup indicators/environmental effects/miscellany
700 - Ambient Water 1a (S) 2026
701 - Ambient Water 1b (S) 2024
702 - Ambient Water 2a (M) 2023
703 - Ambient Water 2b (M) 2045
704 - Ambient Water 3a (L) 83
705 - Ambient Water 3b (L) 2019
706 - Ambient Water 4a (XL) 2025
707 - Ambient Water 4b (XL) 27
708 - Random Ambient 1 14
709 - Random Ambient 2 43
750 - Chaos Spawner 8
751 - Teleport Point 5003
752 - Alternate View Point 5007
753 - Zoom Tube Waypoint 18
754 - Pusher 5001
755 - Puller 5002
756 - Street Light 2003
800 - 899 : Greenflower Scenery
800 - Flower 1 36
801 - Flower 2 70
802 - Flower 3 73
804 - Berry Bush 74
805 - Bush 75
900 - 999 : Techno Hill Scenery
900 - THZ Plant 2035
901 - Alarm 2006
1000 - 1099 : Deep Sea Scenery
1000 - Gargoyle 81
1100 - 1199 : Castle Eggman Scenery
1100 - Ceiling Chain 49
1101 - Torch Flame 24
1102 - Eggman Statue 52
1103 - CEZ Flower 2001
1200 - 1299 : Arid Canyon Scenery
1300 - 1399 : Red Volcano Scenery
1400 - 1499 : Dark City Scenery
1500 - 1599 : Doom Ship Scenery
1600 - 1699 : Egg Rock/Final Fight Scenery
1700 - 1799 : NiGHTS Items
1700 - Axis 72
1701 - Axis Transfer (Normal) 61
1702 - Axis Transfer (Line) 46
1703 - Nights Drone 60
1704 - Nights Bumper 82
1705 - Hoop 57
1706 - Nights Wing 37
1707 - Super Loop Powerup 3007
1708 - Drill Refill Powerup 3008
1709 - Helper Powerup 3009
1710 - Egg Capsule 40
1800 - 1849 : Mario Items
1800 - Coin 10005
1801 - Goomba 10000
1802 - Blue Goomba 10001
1803 - FireFlower 50
1804 - Shell 10
1805 - Puma 29
1806 - Koopa 19
1807 - Axe 12
1808 - Mario Bush 1 10002
1809 - Mario Bush 2 10003
1810 - Toad 10004
1850 - 1899 : Christmas Items
1850 - Xmas Pole 5
1851 - Candy Cane 13
1852 - Snowman 6
1900 - 1999 : Misc Scenery
1900 - Stalagmite 0
1901 - Stalagmite 1
1902 - Stalagmite 2
1903 - Stalagmite 3
1904 - Stalagmite 4
1905 - Stalagmite 5
1906 - Stalagmite 6
1907 - Stalagmite 7
1908 - Stalagmite 8
1909 - Stalagmite 9
+223
View File
@@ -0,0 +1,223 @@
Description OldNum NewNum Description
Old Water 14 Removed
Level Parameters/Misc:
Per-Sector Gravity 64 1
Custom Exit 71 2
Zoom Tube Parameters 18 3
Speed Pad 65 4
Camera Scanner 63 5
Disable Linedef 73 6
Flat Alignment 66 7
Sector Special Parameters New 8
Mace Parameters New 9
Sprite Cull Height New 10
Rope Hang Parameters New 11
Rock Spawner Parameters New 12
PolyObjects
Marks first line in PolyObject New 20
Explicitly includes a PolyObject line New 21
PolyObject: Parameters New 22
PolyObject: Waving Flag New 31
Level-Load Effects:
Instant Floor Lower 26 50
Instant Ceiling Raise 24 51
Continuously Falling Sector 88 52
Continuous Floor/Ceiling Mover 2 53
Continuous Floor Mover 3 54
Continuous Ceiling Mover 4 55
Continuous Two-Speed Floor/Ceiling Mover 6 56
Continuous Two-Speed Floor Mover 7 57
Continuous Two-Speed Ceiling Mover 8 58
Activate Floating Platform 232 59
Activate Floating Platform (Adjustable Speed) 233 60
Crusher 1 (Ceiling to Floor) 43 61
Crusher 2 (Floor to Ceiling) 50 62
Fake Floor/Ceiling 242 63
Appearing/Disappearing FOF New 64
Bridge Thinker New 65
Floor Over Floors:
"Floor Over Floor: Solid, Opaque, Shadowcasting " 25 100
"Floor Over Floor: Solid, Opaque, Non-Shadowcasting " 33 101
"Floor Over Floor: Solid, Translucent " 44 102
"Floor Over Floor: Solid, Sides Only " 69 103
"Floor Over Floor: Solid, No Sides " 51 104
"Floor Over Floor: Solid, Invisible " 57 105
"Floor Over Floor: Water, Opaque " 48 120
"Floor Over Floor: Water, Translucent " 45 121
"Floor Over Floor: Water, Opaque, No Sides " 75 122
"Floor Over Floor: Water, Translucent, No Sides " 74 123
"Floor Over Floor: Platform, Opaque " 59 140
"Floor Over Floor: Platform, Translucent " 81 141
"Floor Over Floor: Platform, Translucent, No Sides " 77 142
Floor Over Floor: Bobbing (Air) 38 150
Floor Over Floor: Adjustable Bobbing (Air) 68 151
Floor Over Floor: Reverse Adjustable Bobbing (Air) 72 152
"Floor Over Floor: Floating, Bobbing " 34 160
Floor Over Floor: Crumbling (Respawn) 36 170
Floor Over Floor: Crumbling (No Respawn) 35 171
"Floor Over Floor: Crumbling (Respawn), Platform " 79 172
"Floor Over Floor: Crumbling (No Respawn), Platform " 80 173
"Floor Over Floor: Crumbling (Respawn), Platform, Translucent " 82 174
"Floor Over Floor: Crumbling (No Respawn), Platform, Translucent " 83 175
"Floor Over Floor: Crumbling (Respawn), Floating, Bobbing " 39 176
"Floor Over Floor: Crumbling (No Respawn), Floating, Bobbing " 1 177
"Floor Over Floor: Crumbling (Respawn), Floating " 37 178
"Floor Over Floor: Crumbling (No Respawn), Floating " 42 179
"Floor Over Floor: Crumbling (Respawn), Bobbing (Air) " 40 180
"Floor Over Floor: Rising Platform, Solid, Opaque, Shadowcasting " 89 190
"Floor Over Floor: Rising Platform, Solid, Opaque, Non-Shadowcasting " 90 191
"Floor Over Floor: Rising Platform, Solid, Translucent " 91 192
"Floor Over Floor: Rising Platform, Solid, Invisible " 94 193
"Floor Over Floor: Rising Platform, Platform, Opaque " 92 194
"Floor Over Floor: Rising Platform, Platform, Translucent " 93 195
Floor Over Floor: Light Block 49 200
Floor Over Floor: Half Light Block 47 201
Floor Over Floor: Fog Block 46 202
"Floor Over Floor: Intangible, Opaque " 62 220
"Floor Over Floor: Intangible, Translucent " 52 221
"Floor Over Floor: Intangible, Sides Only " 67 222
"Floor Over Floor: Intangible, Invisible " 58 223
Floor Over Floor: Mario Block 41 250
Floor Over Floor: Thwomp Block 54 251
Floor Over Floor: Shatter Block 76 252
"Floor Over Floor: Shatter Block, Translucent " 86 253
Floor Over Floor: Bustable Block 55 254
Floor Over Floor: Spin Bust Block 78 255
"Floor Over Floor: Spin Bust Block, Translucent " 84 256
Floor Over Floor: Quicksand Block 56 257
Floor Over Floor: Laser Block 53 258
Floor Over Floor: Custom 87 259
Linedef Executor Triggers:
Trigger Linedef Executor (Continuous) 96 300
Trigger Linedef Executor (Each Time) 97 301
Trigger Linedef Executor (Once) 98 302
Trigger Linedef Executor (Ring Count - Continuous) 95 303
Trigger Linedef Executor (Ring Count - Once) 99 304
Trigger Linedef Executor (Character Ability - Continuous) 19 305
Trigger Linedef Executor (Character Ability - Each Time) 20 306
Trigger Linedef Executor (Character Ability - Once) 21 307
"Trigger Linedef Executor (Race Only, Once) " 9 308
Trigger Linedef Executor (CTF Red Team - Continuous) 10 309
Trigger Linedef Executor (CTF Red Team - Each Time) 11 310
Trigger Linedef Executor (CTF Blue Team - Continuous) 12 311
Trigger Linedef Executor (CTF Blue Team - Each Time) 13 312
Trigger Linedef Executor (No More Enemies - Once) 15 313
Trigger Linedef Executor (# of Pushables - Continuous) New 314
Trigger Linedef Executor (# of Pushables - Once) New 315
Trigger Linedef Executors (PolyObject - Land On) New 316
Trigger Linedef Executor (Level Load) New 399
Linedef Executor Options:
Linedef Executor: Set Tagged Sector's Floor Height/Pic 101 400
Linedef Executor: Set Tagged Sector's Ceiling Height/Pic 102 401
Linedef Executor: Set Tagged Sector's Light Level 103 402
Linedef Executor: Move Tagged Sector's Floor 106 403
Linedef Executor: Move Tagged Sector's Ceiling 107 404
Linedef Executor: Lower Floor by Line 108 405
Linedef Executor: Raise Floor by Line 109 406
Linedef Executor: Lower Ceiling by Line 110 407
Linedef Executor: Raise Ceiling by Line 111 408
Linedef Executor: Change Calling Sector's Tag 112 409
Linedef Executor: Change Front Sector's Tag 114 410
Linedef Executor: Stop Plane Movement 116 411
Linedef Executor: Teleport Player to Tagged Sector 104 412
Linedef Executor: Change Music 105 413
Linedef Executor: Play SFX 115 414
Linedef Executor: Run Script 113 415
Linedef Executor: Start Adjustable Fire Flicker 119 416
Linedef Executor: Start Adjustable Glowing Light 120 417
Linedef Executor: Start Adjustable Strobe Flash (unsynchronized) New 418
Linedef Executor: Start Adjustable Strobe Flash (synchronized) New 419
Linedef Executor: Fade Light Level 117 420
Linedef Executor: Stop Lighting Effect 118 421
Linedef Executor: Cut-Away View 121 422
Linedef Executor: Change Sky 123 423
Linedef Executor: Change Weather 124 424
Linedef Executor: Change Object State 125 425
Linedef Executor: Stop Object 122 426
Linedef Executor: Award Score 126 427
Linedef Executor: Start Platform Movement 127 428
Linedef Executor: Crush Ceiling Once New 429
Linedef Executor: Crush Floor Once New 430
Linedef Executor: Crush Floor & Ceiling Once New 431
Linedef Executor: Enable 2D Mode New 432
Linedef Executor: Disable 2D Mode New 433
Linedef Executor: Award Custom Power New 434
Linedef Executor: Stop Conveyor New 435
Linedef Executor: Start Conveyor New 436
Linedef Executor: Disable Player Movement New 437
Linedef Executor: Execute Linedef Executor New 450
Linedef Executor: PolyObject: Door Slide New 480
Linedef Executor: PolyObject: Door Swing New 481
Linedef Executor: PolyObject: Move XY New 482
Linedef Executor: PolyObject: Move XY w/ override New 483
Linedef Executor: PolyObject: Rotate Right New 484
Linedef Executor: PolyObject: Rotate Right w/ override New 485
Linedef Executor: PolyObject: Rotate Left New 486
Linedef Executor: PolyObject: Rotate Left w/ override New 487
Linedef Executor: PolyObject: Start waypoint movement New 488
Linedef Executor: PolyObject: Make Invisible New 489
Linedef Executor: PolyObject: Make Visible New 490
Scrollers/Pushers:
Scroll Wall First Side Left 100 500
Scroll Wall First Side Opposite Direction 85 501
Scroll Wall According to Linedef 254 502
Acc Scroll Wall According to Linedef 218 503
Disp Scroll Wall According to Linedef 249 504
Scroll Texture by Offsets 255 505
Scroll Floor Texture 251 510
Acc Scroll Floor Texture 215 511
Disp Scroll Floor Texture 246 512
Scroll Ceiling Texture 250 513
Acc Scroll Ceiling Texture 214 514
Disp Scroll Ceiling Texture 245 515
Carry Objects on Floor (no scroll) 252 520
Acc Carry Objects on Floor 216 521
Disp Carry Objects on Floor 247 522
Carry Objects on Ceiling 203 523
Acc Carry Objects on Ceiling 205 524
Disp Carry Objects on Ceiling 201 525
Scroll Floor Texture and Carry Objects 253 530
Acc Scroll Floor Texture and Carry Objects 217 531
Disp Scroll Floor Texture and Carry Objects 248 532
Scroll Ceiling Texture and Carry Objects 202 533
Acc Scroll Ceiling Texture and Carry Objects 204 534
Disp Scroll Ceiling Texture and Carry Objects 200 535
Friction 223 540
Horizontal Wind 224 541
Upwards Wind 229 542
Downwards Wind 230 543
Horizontal Current 225 544
Upwards Current 227 545
Downwards Current 228 546
Boom Push/Pull Thing 226 547
Lighting:
Floor Lighting 213 600
Ceiling Lighting 5 601
Adjustable Pulsating Light 60 602
Adjustable Flickering Light 61 603
Adjustable Blinking Light (unsynchronized) New 604
Adjustable Blinking Light (synchronized) New 605
Colormap 16 606
BIN
View File
Binary file not shown.
+78
View File
@@ -0,0 +1,78 @@
Removed:
- Buttons 1-20 690-709
- Button 21 (THZ2 A/740 B/741 D/742 E/745 710
- Close Door Blazing (Tag 743) 711
- Raise Ceiling to Highest (Tag 744) 981
- THZ2 Slime Raise (B/712 W713 P714 D715 S716) 986
Stuff to Remove/Change:
- Light Blinks On Every 0.5 Seconds 2 Add Linedef Combine
- Light Blinks On Every 1 Second 3 Add Linedef Combine
- Light Pulses Smoothly 8 Remove
- Light Blinks On Every 0.5 Seconds (Sync) 12 Add Linedef Combine
- Lights Blinks On Every 1 Second (Sync) 13 Add Linedef Combine
- Light Flickers Like Fire 17 Remove
? - Damage (Fire) and Current 519 Remove (convert to combination)
? - Damage (Water) and Current 984 Remove (convert to combination)
Section 1:
1 - Damage (Generic) 11
2 - Damage (Water) 983
3 - Damage (Fire) 7
4 - Damage (Electrical) 18
5 - Spikes 4
6 - Death Pit (Camera Mod) 16
7 - Death Pit (No Camera Mod) 5
8 - Instant Kill 10
9 - Ring Drainer (Floor Touch) 978
10 - Ring Drainer (No Floor Touch) 980
11 - Special Stage Damage 9
12 - Space Countdown 6
13 - Ramp Sector (Increase step-up) 992
14 - Non-Ramp Sector (Don't step-down) 996
15 - Bouncy Sector (FOF Control Only) 14
Section 2: << 4
1 - Trigger Linedef Exec (Pushable Objects) 971
2 - Trigger LD Exec (Anywhere in Sec/All Pls) 972
3 - Trigger Linedef Exec (Floor Touch/All Pls) 973
4 - Trigger Linedef Exec (Anywhere in Sec) 974
5 - Trigger Linedef Exec (Floor Touch) 975
6 - Trigger Linedef Exec (Emerald Check) 967
7 - Trigger Linedef Exec (NiGHTS Mare) 968
8 - Check for linedef executor on FOFs (ANY) 970
9 - Egg Trap Capsule 666
10 - Special Stage Time/Rings, Par 990
11 - Custom Global Gravity 991
Section 3: << 8
1 - Ice/Sludge (required?!) 256
2 - Wind/Current (required?!) 512
3 - Ice/Sludge and Wind/Current 768
4 - Conveyor Belt 985
5 - Speed Pad (No Spin) 976
6 - Speed Pad (Spin) 977
7 - Bustable Block Sprite Parameter 1500-1515
8 - "
9 - "
10 - "
11 - "
12 - "
13 - "
14 - "
15 - "
Section 4: << 12
1 - Starpost Activator 993
2 - Special Stage Goal Combine 33
2 - Exit Sector Combine 982
2 - No Tag Zone Combine 987
2 - CTF: Flag Return Combine 995
3 - CTF: Red Team Base 988
4 - CTF: Blue Team Base 989
5 - Fan Sector 997
6 - Super Sonic Transform 969
7 - Spinner 979
8 - Zoom Tube Start 998
9 - Zoom Tube End 999
10 - Finish Line 994
+307
View File
@@ -0,0 +1,307 @@
SRB2
Release v1.09, ? 2005.
Last Updated: June 2005
Original game & sources by: Id Software.
Additions: (c)1998 by: Fabrice Denis & Boris Pereira
(c)1999 by: Fabrice Denis, Boris Pereira & Thierry Van Elsuwe
(c)2000 by: Boris Pereira & Thierry Van Elsuwe
(c)2004 By: AJ, Graue, Alam Arias, Logan Arias & Andrew Clunis
Special thanks to Steven McGranahan, Lee Killough, Robert Bäuml and Bell Kin for
their large contribution and to other DooM LEGACY & SRB2 Team members.
Web site: http://www.SRB2.org/
e-mail: none@none.com
OpenGL specific:
Web site: http://legacy.newdoom.com/gl
-----------------------------------------------------------------------
F.A.Q.
-----------------------------------------------------------------------
If you have any trouble with SRB2, you might find a solution
here.
If you find a solution to a problem that was not listed here,
please tell us so that we can update the FAQ and help other people!
Mail your hardware/software problems to:
None@none.com subject: FAQ
--------
CONTENTS
--------
[0] Miscellaneous
[1] Mouse/Joystick/Keyboard
[2] Video
[3] Sound
[4] Network
[5] Troubleshooting
-----------------
[0] MISCELLANEOUS
-----------------
* under win95 or OS/2, I don't have enough memory. How can i handle with ?
Tell win95 to put more dpmi memory for your dos box.
Or use the -mb option.
---------------------------
[1] MOUSE/JOYSTICK/KEYBOARD
---------------------------
* My mouse/joystick does not work in SRB2.
First, check that the mouse/joystick is activated : go at the
console and type either 'use_mouse' (or use the respective
menuitem) or 'use_joystick'.
If it tells '0' or off than the mouse/joystick is not used,
set the variable to 1. eg: 'use_mouse 1'.
For the joystick, different values will support different
types of joystick, check the console documentation for the
command 'use_joystick' for more.
Even if the mouse or joystick is activated, you have to
set up the contols into the Setup Controls menu. That is:
tell what use you will make of the mouse/joystick buttons.
---------
[2] VIDEO
---------
* Where are the other video modes ? I have only '320x200' in the
Video Modes menu.
DOS
---
SRB2 adds new video modes only if a VESA2 (or better) driver
is present. The VESA2 driver is a standard of 'talking' between a
program and the huge amount of different graphics cards
available today.
If you don't have a VESA2 driver, you can download UNIVBE, or
SMART DISPLAY DOCTOR from
http://www.scitechsoft.com/products/ent/free_titles.html
or if you have an S3 based card, you can download the free
software called 'S3VBE'.
ftp://ftp.externet.hu/pub/mirror/sac/graph/s3vbe318.zip
ftp://ftp.digsys.bg/pub/simtelnet/msdos/graphics/s3vbe318.zip
http://www.filesearching.com/cgi-bin/s?q=s3vbe318.zip
http://www.google.com/search?q=s3vbe318.zip
* The game doesn't restore the video mode I have chosen the last time
I played SRB2.
The current video mode has to be made the 'default' so that it is
saved to the config : press the key 'D' on the Video Options menu
to set the current video mode the default.
* I have some problems with OpenGL mode
Have a look at the FAQ for OpenGL on the glLegacy web site:
http://www.doomnation.com/gllegacy/faqe.htm
# Linux: I only have a 1024x768 (or 800x600, 1280x1024, ...) resolution
in fullscreen mode under X and SRB2 is really really slow. Can I
have lower resolutions like 320x200 in fullscreen mode as well?
Probably yes. SRB2 can only use the resolutions offered by the
X-Server. So if all fullscreen modes have a very high resolution you
have to modify /etc/XF86Config (or /etc/X11/XF86Config). Use XF86Setup
(or the appropriate tool coming with your distribution - sax,
xf86config, ...) to do this.
If you do not succeed there, you can enter them manually into your
XF86Config file. ONLY RECOMMENDED FOR USERS WHO KNOW WHAT THEY DO!
For a short guide on how to do this, have a look at the file
"Doublescan.txt".
In case of doubt consult the XFree86-HOWTO (or ask your system
administrator :).
# Linux: I cannot have any fullscreen modes at all!
You have only modes above 1024x768 in your XF86Config. Proceed as
described above.
# Linux: After a certain idle time my screensaver jams the display of
SRB2. I can still operate SRB2, but I do not see what's happening
and the screensaver won't go away.
You probably have KDE. The KDE screensaver does not obey the screensaver
rules (at least mine, version 1.1). The solution is to deactivate the
KDE screensaver and use another screensaver (like the xscreensaver,
e.g.). But the hell, when you started SRB2 you should have played it
as well and not left it alone!!!
---------
[3] SOUND
---------
+ DOS:I can't have CD audio music, why ?
Make sure that the MSCDEX driver version 2.0 or later is loaded.
If it says 'MSCDEX version xxx' at game startup, and you still
don't hear the cd music, then probably your card doesn't respond
when SRB2 tries to set the cd volume. If so, make sure your sound
card's mixer have the cd volume set up so that you can hear something.
+ When the CD plays, the game is very 'jerky'. It doesn't do that when
I type 'cd off' in the console.
You have an old/bad cd driver, that can take up to a second to
respond to cd driver commands. Either get the latest version of
your driver, or turn cd update off. Check 'cd_udpate' in the
console documentation for more.
* DOS:How can I *ALWAYS* disable the sounds or music of the game ?
Edit the allegro.cfg file and set digicard/midicard to 0 (none)
* DOS:My sterero sound is reversed, how can I set it the right way ?
Change the console variable 'stereoreverse' to either 1 or 0.
Or, you can edit the allegro.cfg file, and set the 'flip_pan' variable.
* DOS:The sounds are too 'slow', or 'low-pitched'
It seems to be a problem of the auto-detection of some 8bit sound
cards. You will have to set manually the 'sb_freq' value in the
allegro.cfg file to a lower value : 11906, 16129.
* DOS:SRB2 doesn't play any sound/music, but I have a sound
blaster genuine/compatible card.
If you have a genuine or compatible SoundBlaster card, it is very
important that you set the BLASTER environment variable.
If you are playing under DOS, and never installed your sound card
under DOS, run the setup of your sound card for DOS.
Check if the BLASTER variable was set: type 'SET' under dos
(or DOSbox)
Do you see something like 'BLASTER=A220 I5 D1 ...' ?
Yes? If you don't hear sounds/music, then tweak the settings in the
allegro.cfg file until you get something, first try changing the
type of the sound card, it is not always properly detected.
No? You have to set this variable in order that your sound card is
detected. Run the setup that was shipped with your sound card, and
make sure you run the setup for DOS too, it will usually add a
line of the type 'SET BLASTER=... ...' in the autoexec.bat file.
* DOS:How can I have better midi music on my 8bit sound card ?
Use the DIGMID driver, it is supported in SRB2.
What the hell is this? Well, the Gravis Ultrasound uses digital
samples to play midi music. On a simple 8bit card, you can use digital
samples too, which will sound usually better than what is output
by the poor fm synthesis chip of 8bit cards.
You will need to get a Gravis Ultrasound patch set, you can find
several ones for free on internet, it consists of a bunch of '.pat'
files which are the digital samples to play the midi instruments
(eg: piano, conga, guitar, ect.).
Check the Allegro homepage for some links to GUS patches:
http://alleg.sourceforge.net/digmid.html
http://alleg.sourceforge.net/
http://www.talula.demon.co.uk/allegro/digmid.html
http://www.talula.demon.co.uk/allegro/
Now to activate the DIGMID driver:
Set the 'midi_card' value to 8 (DIGMID) in the allegro.cfg file.
Make sure you leave the 'digi_voices' blank, or set it to a low
value, because the midi music will use digital voices.
At the end of the allegro.cfg file, set the 'patches' value
to the path, where you have installed a Gravis Ultrasound midi
patch set. eg: patches = d:\music\midipat\
# Linux: CD music does not work or only works when run as root.
We do not encourage you to run SRB2 as root (you never know
what SRB2 can do to your system - it's a mighty piece of code :).
There is a common problem with ATAPI CD-rom drives, which are
treated as harddisks. Usually there is a link /dev/cdrom pointing to
device hd[b,c,d]. As harddisks are not supposed to be read directly
via this device (especially not by a common user), there are no read
permissions for "all". For CD-roms you can savely set read permissions
unless you are very paranoid. Assuming your CD-rom drive is /dev/hdc,
set permissions with "chmod +r /dev/hdc" (as root). SCSI CD-rom drives
should not have this problem. But if they do, proceed as described
with ATAPI drives.
# Linux: The CD music volume is not set properly.
Go to the console and type "jigglecdvolume 1".
-----------
[4] NETWORK
-----------
* Where can I find Internet servers ?
For the moment there is one public server.
http://srb2.servegame.org/ Master server web page
srb2.servegame.org:28910 current Master Server
* When I start SRB2 with -server or -connect it say :
"BinToPort: Address already in use (EADDRINUSE)"
It appears only when SRB2 crashes or when you leave with ctrl-break.
use -udpport 12345 (or any other free slot) on both sides (client and
server).
This can also happens when there is already a SRB2 running on your
computer if you whant to try two SRB2 running on the same computer
use -clientport 12345 (or any other free slot). Then the second will
connect to the first one.
* Do you use the tcp protocol ?
No, we use the udp protocol which is faster, but don't worry udp is a
part of the internet protocol.
-------------------
[5] Troubleshooting
-------------------
# Linux: SRB2 is hung in fullscreen mode and won´t let me leave.
What shall I do?
Some people press the reset button, but hey, we are not in the
stoneage of operating systems! There are two "proper" ways to
get out: kill your X-Server. You can usually do this by pressing
"CTRL-ALT-BACKSPACE". But if you have other open applications with
important data (probably hacked away on your diploma thesis for 3
weeks without saving once) you can also kill SRB2 directly. Press
"CTRL-ALT-F2" and you will get to a console. Log in, type
"killall llxSRB2" and switch back to the X-Server with "CTRL-ALT-F7".
Some X-Server crash on this procedure - blame the X-Server for the
loss of 3 weeks work on your diploma thesis :)
+68
View File
@@ -0,0 +1,68 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>
Sonic Robo Blast 2 Manual
</title>
<link rel="stylesheet" type="text/css" href="srb2manstyle.css">
<!-- Borrowed some javascript code so the height of the iframe is equal to the size of the document - Sonict -->
<script type="text/javascript">
/* free code from dyn-web.com */
function getDocHeight(doc) {
doc = doc || document;
// from http://stackoverflow.com/questions/1145850/get-height-of-entire-document-with-javascript
var body = doc.body, html = doc.documentElement;
var height = Math.max( body.scrollHeight, body.offsetHeight,
html.clientHeight, html.scrollHeight, html.offsetHeight );
return height;
}
function setIframeHeight(id) {
var ifrm = document.getElementById(id);
var doc = ifrm.contentDocument? ifrm.contentDocument: ifrm.contentWindow.document;
ifrm.style.visibility = 'hidden';
ifrm.style.height = "10px"; // reset to minimal height in case going from longer to shorter doc
ifrm.style.height = getDocHeight( doc ) + "px";
ifrm.style.visibility = 'visible';
}
</script>
<meta http-equiv="Content-type" content="text/html; charset=UTF-8">
</head>
<body>
<p class="c1">
<img src="manual_img/sonicname2.png" alt="SONIC" width="136" height="36">
<br>
<img src="manual_img/srb2banner.png" alt="ROBO BLAST 2" width="224" height="43">
</p>
<p class="c1">
<big><big><strong>Manual</strong></big></big>
</p>
<table class="cf" align="center">
<tr><td class="c">
<ul class="hmenu">
<li class="hmenu"><a class="hmenu" href="intro.htm" target="ifrm">Main</a></li>
<li class="hmenu"><a class="hmenu" href="items.htm" target="ifrm">Items</a></li>
<li class="hmenu"><a class="hmenu" href="playerabilities.htm" target="ifrm">Player Abilities</a></li>
<li class="hmenu"><a class="hmenu" href="basicplay.htm" target="ifrm">Gameplay</a></li>
<li class="hmenu"><a class="hmenu" href="surroundings.htm" target="ifrm">Surroundings</a></li>
</ul>
</td></tr>
<tr><td class="c">
<ul class="hmenu">
<li class="hmenu"><a class="hmenu" href="multiplayer.htm" target="ifrm">Multiplayer</a></li>
<li class="hmenu"><a class="hmenu" href="zones.htm" target="ifrm">Zones</a></li>
<li class="hmenu"><a class="hmenu" href="controls.htm" target="ifrm">Controls</a></li>
<li class="hmenu"><a class="hmenu" href="consolecommands.htm" target="ifrm">Console Commands</a></li>
<li class="hmenu"><a class="hmenu" href="misc.htm" target="ifrm">Misc</a></li>
</ul>
</td></tr>
</table>
<hr>
<p class="c1">
<!-- The "onload" property of the iframe makes an error when validated through the W3C validation checker. -->
<!-- This will not be fixed as it isn't worth the time to fix it up properly. - Sonict -->
<iframe id="ifrm" name="ifrm" src="intro.htm" onload="setIframeHeight(this.id)"> </iframe>
</p>
</body>
</html>
+39
View File
@@ -0,0 +1,39 @@
SVN-RULES
- As you can see, there is sub-directory in the repository, one for eatch
platform (djgpp (dos),win32,SDL) the root directory is for all platform,
so take care of the order we have put in.
- do not commit/upload tests of bugged code, try to fix a maximum of know
bugs and update know bugs list in source.txt. If you must commit your source
make your code in #ifdef so we can disable it
- SRB2 is a modification of doom/Doom Legacy source. We allow additionnal feature
and visual addition.
- Maximize communications between members, do not impose your changes, if your
are not sure about a feature/change, talk about it in irc://irc.esper.net/srb2 chat room.
CODE-RULES
- We use no tab, 4 space indent, and tab size 8 (in case some tab have filtred
and for makefile)
- Self documented code, variable and function must have a name that help
understand the code, so do not call variable and function a,b, a2, ...
- the usage of extern in a c file is prohibited, except for declaration of a
function with body (so it is like public keyword in c++)
Also function protos haren't allowed for external function, put it un the
corresponding h file.
- Try to minimize #ifdef usage for :
- code readability
- the main code is for all port so if something is good for a platform all
platform can benefit by this feature
- Take care of platform dependent code, we would like to have code that work
on Dos, Win32, SDL, ... little and big endian, software/Glide/OpenGl.
GOOD PRACTICE
- Try to put as mush static variable and function on module so it help to
understand the role of the varaible/function in the module also this
help the compiler to optimize
- minimise global variable
- make a log of your work, so you don't need to put a lot of comment in
the code, this will also help us to update the what's new section of doc
when doing final release
+240
View File
@@ -0,0 +1,240 @@
1. Compile SRB2
2. Explanation of the code
2.1 The memory model
2.2 Hardware Texture model
1. Compile SRB2
=================
DOS
---
need:
- djgpp 2.03 (http://www.delorie.com/djgpp/)
- allegro 3.12 (http://alleg.sourceforge.net/index.html)
(
- libsocket 0.7.4 (beta 4) or better
for use with Winsock 1.1 (example Windows 3.1)
(http://www.phekda.freeserve.co.uk/richdawe/lsck/lsck.htm)
OR
- Wattcp-32 v2.2 dev.rel 6 or better
For use with a packet driver
(http://www.bgnett.no/~giva/)
(http://groups.yahoo.com/group/watt-32/)
(http://groups.yahoo.com/group/watt-32/files/v2.2/)
)
- bcd 1.03 (inlcude in this package)
- gcc 2.95.2 is recommended
- nasm 0.98 (or better) (http://nasm.sourceforge.net/)
compile:
make
make WATTCP=1 (to make a Wattcp-32 version)
debug:
when craching SRB2 will return eip
type make asm, then you will have a 8 megs srb2.s (a assembler file)
the you can find the faulting instruction and function
------------------------------------------------------------------------
Linux/SDL
-----
need:
- tested with gcc 2.95 and 3.X.
- SDL 1.2
- SDL_mixer 1.2
- ibogg and libvorbis (http://Xiph.org/)
- nasm 0.98 (or better)(http://nasm.sourceforge.net/) only with 2.95, else add CC30=1
compile
make LINUX=1
debug:
gdb ?
------------------------------------------------------------------------
Win32
-----
need :
- glide 3.x sdk (optional) (http://www.3dfx.com)
- directx6 sdk (or higher) (http://www.micosoft.com/directx)
- nasm 0.98 (or better) (http://nasm.sourceforge.net/)
- use src\win32\wLegacy.dsp
- VC6 should also work with VC5, and VS.NET 200X
debug:
press on "step over" with the release version (there is some debug info
on it). Then change the eip in the regster window when you will type
enter the edi will go to the faulting instruction. don't forget that
you can follow the stack for calls.
You can also use trace with the debug version but add -win and -nomouse.
------------------------------------------------------------------------
Win32/minGW/SDL
-----
need:
- tested with gcc 2.95 and 3.X.
- can also use Dev-C++ 5.0 beta 9 (4.9.9.0) from http://www.bloodshed.net/dev/devcpp.html
- SDL 1.2
- SDL_mixer 1.2
compile
make minGW=1 SDL=1
or use src\SDL\Win32SDL.dev with Dev-C++ 4.9.9.0 or later
debug:
gdb ?
------------------------------------------------------------------------
WinCE/SDL WIP
-----
need:
- ActiveSync 3.8
http://www.microsoft.com/windowsmobile/downloads/activesync38.mspx
- ActiveSync 3.7.1, if 3.8 isn't available for your language
http://www.microsoft.com/windowsmobile/downloads/activesync37.mspx
- eMbedded Visual Tools 3.0 - 2002 Edition
http://www.microsoft.com/downloads/details.aspx?FamilyID=f663bf48-31ee-4cbe-aac5-0affd5fb27dd
- Pocket PC 2000 SDK
http://www.microsoft.com/downloads/details.aspx?FamilyID=bb3f4d7b-de2a-4e1a-a175-26a68c301ac4
- Pocket PC 2002 SDK (eMVT 3.0 2002 Ed. comes with this)
http://www.microsoft.com/downloads/details.aspx?FamilyID=2dbee84a-bd94-4167-b817-2b2e548b2e92
- Pocket PC 2002 SDK Emulator Images (eMVT 3.0 2002 Ed. comes with this)
http://www.microsoft.com/downloads/details.aspx?FamilyID=25f4de97-ae80-477a-9df1-496b85b3d3e3
- eMbedded Visual C++ 4.0
http://www.microsoft.com/downloads/details.aspx?familyid=1DACDB3D-50D1-41B2-A107-FA75AE960856
- eMbedded Visual C++ 4.0 SP3 (Win CE 4.0-4.2)
http://www.microsoft.com/downloads/details.aspx?FamilyID=5bb36f3e-5b3d-419a-9610-2fe53815ae3b
OR
- eMbedded Visual C++ 4.0 SP4 (No SH3 support,Win CE 4.0-5.0 support)
http://www.microsoft.com/downloads/details.aspx?FamilyID=4a4ed1f4-91d3-4dbe-986e-a812984318e5
- eMbedded Visual C++ 4.0 Update 5625 (SP4 only)
http://www.microsoft.com/downloads/details.aspx?FamilyID=aa282a6d-6f57-436d-8c10-0ec02d94f5b1
- Windows CE: Standard Software Development Kit
http://www.microsoft.com/downloads/details.aspx?familyid=a08f6991-16b0-4019-a174-0c40e6d25fe7
- SDK for Windows Mobile 2003-based Pocket PCs
http://www.microsoft.com/downloads/details.aspx?FamilyId=9996B314-0364-4623-9EDE-0B5FBB133652
- Emulator Images for Windows Mobile 2003 Second Edition software for Pocket PC
http://www.microsoft.com/downloads/details.aspx?familyid=5C53E3B5-F2A2-47D7-A41D-825FD68EBB6C
- Microsoft Device Emulator 1.0 Community Preview
http://beta.microsoft.com Use Guest ID "MSDEVICE" to access the Community Preview website
- Windows CE Utilities for Visual Studio .NET 2003 Add-on Pack 1.1
(if you also have VS 2003 installed, you need this to install Win CE 5.0 SDK, else no need)
http://www.microsoft.com/downloads/details.aspx?FamilyId=7EC99CA6-2095-4086-B0CC-7C6C39B28762
- Windows CE 5.0: Standard Software Development Kit (eMC++ 4 SP4 only)
http://www.microsoft.com/downloads/details.aspx?FamilyID=fa1a3d66-3f61-4ddc-9510-ae450e2318c3
- SDL 1.27 (use patch and zip in tools\SDL1.2.7_CE)
compile
use src\SDL\WinCE\SRB2CE.vcw
debug:
?
2. Explanation of the code
==========================
2.1 The memory model (original) (z_zone.c) (by BP)
--------------------
SRB2 allocate a heap of 6/32/48 megs at begining and provide a Z_Malloc function
to allocate in this heap.
Z_Malloc( int size,int tag,void* user )
size is the size in byte
tag can be : PU_STATIC allocated static (like malloc do)
call Z_Free to free it
PU_LEVEL same as static but the zone is "tagged" with the
tag PU_LEVEL, when calling
Z_FreeTag (PU_LEVEL, PU_LEVEL) all zone tagged
with PU_LEVEL are freed (at the end of the level)
PU_CACHE this one _can_ be freed automatiquely by one other
call to Z_Malloc. the *user point to a pointer
to this zone so when freed automatiquely the
pointer is set to NULL so eatch time you use it
you must check if the pointer is not NULL and
reload it.
(...)
2.2 Hardware Texture model (by BP)
--------------------------
Eatch texture/patch/flats/pic in SRB2 are converted to hardware texture at
runtime (the GlideMipmap_s structure (hw_data.h)). I will call hardware
texture a gr_texture so there is no confusion.
To remind you :
- Texture are set of patch and are associate to linedefs (walls) can be
upper, lower or middle texture. It can have hole on it.
- patch are sprites (the doom patch are run of vertical lines)
- flats are used for floors and ceiling of sectors and have size of 64x64
it can't have hole on it
- pic are new legacy format for picture, it can only handle plain texture
like flats it is now used for hud in full screen for the main picture
of legacy and for coronas (the format was extended to handle 32 bit color
or intensity + alpha, not all are implemented at this time)
Since patch, flat and pic are basic structure represented by only one lump in
the wad, the wad loader allocate for eatch lump a GlideMipmap_s (cache3Dfx)
and init data field to NULL. Since the data structure is allocated in
PU_3DFXCACHE (like PU_CACHE) the data will be initilised when needed
(hw_cache.c).
The GlideMipmap_s structures for textures are initialized on
HWR_PrepLevelCache (hw_cache.c) it is called in P_SetupLevel (load level)
the number of textures is computed with TEXTURE1, TEXTURE2 lumps since this
can be changed in runtime in SRB2 (load a wad while runing) it must be
reallocated. Well, at this time it is realloceted at eatch level start. We
can do better, since numtextures change only when a wad is loaded.
The 3dfx driver use glide3, it load gr_texture in gr_texture memory of the
card in fifo order when there is no more place it remove the first gr_texture,
the downloaded field of GlideMipmap_s go to false and when needed it is
reloaded in gr_texture memory. In OpenGl, since OpenGl keep texture in there
own memory and handle gr_texture memory of the card we no more need to
redownload it but if we not free time to time gr_texture memory in opengl,
it will get alot of memory, so the gr_texture memory is cleared at eatch
new level (same time of texture reallocation). Opengl and 3dfx link the
loaded gr_texture with the nextmipmap field of GlideMipmap_s so before clear
textures of the heap we MUST free gr_texture memory of OpenGl or 3dfx !
SRB2 can also draw patch with a differant colormap (thanks to Hurdler).
When needed it create the same gr_texture but just with a differant colormap.
This one is linked with the original in the GlideMipmap_s with the
nextcolormap field.
So when a polygone with a gr_texture must be drawn, first we check if the
gr_textures is not allready loaded in hadware memory (downloaded field) if
not then we check if gr_texture data is there (not grabbed by z_malloc
function) if not we must recompute it eatch type of gr_texture (texture,
patch, flat, pic have there own methode) the we can send the gr_texture
to 3dfx or OpenGl.
+1992
View File
File diff suppressed because it is too large. Load diff
+4 -4
View File
@@ -5,13 +5,13 @@
# met:
# (1) Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# notice, this list of conditions and the following disclaimer.
# (2) Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in
# the documentation and/or other materials provided with the
# distribution.
# distribution.
# (3) The name of the author may not be used to
# endorse or promote products derived from this software without
# specific prior written permission.
@@ -26,4 +26,4 @@
# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
# STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
# IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
# POSSIBILITY OF SUCH DAMAGE.
# POSSIBILITY OF SUCH DAMAGE.
+1 -11
View File
@@ -10,18 +10,8 @@ The libbacktrace library may be linked into a program or library and
used to produce symbolic backtraces.
Sample uses would be to print a detailed backtrace when an error
occurs or to gather detailed profiling information.
In general the functions provided by this library are async-signal-safe,
meaning that they may be safely called from a signal handler.
That said, on systems that use `dl_iterate_phdr`, such as GNU/Linux,
the first call to a libbacktrace function will call `dl_iterate_phdr`,
which is not in general async-signal-safe. Therefore, programs
that call libbacktrace from a signal handler should ensure that they
make an initial call from outside of a signal handler.
Similar considerations apply when arranging to call libbacktrace
from within malloc; `dl_iterate_phdr` can also call malloc,
so make an initial call to a libbacktrace function outside of
malloc before trying to call libbacktrace functions within malloc.
The libbacktrace library is provided under a BSD license.
See the source files for the exact license text.
@@ -35,7 +25,7 @@ will work.
See the source file backtrace-supported.h.in for the macros that it
defines.
As of July 2024, libbacktrace supports ELF, PE/COFF, Mach-O, and
As of October 2020, libbacktrace supports ELF, PE/COFF, Mach-O, and
XCOFF executables with DWARF debugging information.
In other words, it supports GNU/Linux, *BSD, macOS, Windows, and AIX.
The library is written to make it straightforward to add support for
Binary file not shown.
@@ -1,41 +0,0 @@
# libbacktrace.la - a libtool library file
# Generated by libtool (GNU libtool 1.3134 2009-11-29) 2.2.7a
#
# Please DO NOT delete this file!
# It is necessary for linking the library.
# The name that we can dlopen(3).
dlname=''
# Names of this library.
library_names=''
# The name of the static archive.
old_library='libbacktrace.a'
# Linker flags that can not go in dependency_libs.
inherited_linker_flags=''
# Libraries that this one depends upon.
dependency_libs=''
# Names of additional weak libraries provided by this library
weak_library_names=''
# Version information for libbacktrace.
current=0
age=0
revision=0
# Is this an already installed library?
installed=no
# Should we warn about portability when linking against -modules?
shouldnotlink=no
# Files to dlopen/dlpreopen
dlopen=''
dlpreopen=''
# Directory that this library needs to be installed in:
libdir='/mingw64/lib'
@@ -1,41 +0,0 @@
# libbacktrace.la - a libtool library file
# Generated by libtool (GNU libtool 1.3134 2009-11-29) 2.2.7a
#
# Please DO NOT delete this file!
# It is necessary for linking the library.
# The name that we can dlopen(3).
dlname=''
# Names of this library.
library_names=''
# The name of the static archive.
old_library='libbacktrace.a'
# Linker flags that can not go in dependency_libs.
inherited_linker_flags=''
# Libraries that this one depends upon.
dependency_libs=''
# Names of additional weak libraries provided by this library
weak_library_names=''
# Version information for libbacktrace.
current=0
age=0
revision=0
# Is this an already installed library?
installed=yes
# Should we warn about portability when linking against -modules?
shouldnotlink=no
# Files to dlopen/dlpreopen
dlopen=''
dlpreopen=''
# Directory that this library needs to be installed in:
libdir='/mingw64/lib'
BIN
View File
Binary file not shown.

After

Width:  |  Height:  |  Size: 153 KiB

+6 -1
View File
@@ -442,7 +442,12 @@ if(${SRB2_CONFIG_HAVE_PNG} AND ${SRB2_CONFIG_HAVE_ZLIB})
set(SRB2_HAVE_PNG ON)
add_definitions(-DHAVE_PNG)
add_definitions(-D_LARGEFILE64_SOURCE)
source_group("Main" FILES ${SRB2_CORE_SOURCES} ${SRB2_CORE_HEADERS})
set(SRB2_PNG_SOURCES apng.c)
set(SRB2_PNG_HEADERS apng.h)
prepend_sources(SRB2_PNG_SOURCES)
prepend_sources(SRB2_PNG_HEADERS)
source_group("Main" FILES ${SRB2_CORE_SOURCES} ${SRB2_CORE_HEADERS}
${SRB2_PNG_SOURCES} ${SRB2_PNG_HEADERS})
else()
message(WARNING "You have specified that PNG is available but it was not found. SRB2Kart may not compile correctly.")
endif()
+13 -22
View File
@@ -49,7 +49,6 @@
# Already enabled by default for 32-bit
# Windows.
# NOCURL=1 - Disable libcurl--HTTP capability.
# NOHOLEPUNCH=1 - Disable holepunch capability.
# NOLIBGME=1 - Disable game music emu, retro VGM support.
# NOOPENMPT=1 - Disable module (tracker) music support.
# NOMIXER=1 - Disable SDL Mixer (audio playback).
@@ -70,7 +69,6 @@
# VALGRIND=1 - Enable Valgrind memory debugging support.
# PROFILEMODE=1 - Enable performance profiling (gprof).
# USEASAN=1 - Enable building with Address Sanitizer.
# USEUBSAN=1 - Enable building with Undefined Behavior Sanitizer.
# NOLIBBACKTRACE=1 - Disable using Libbacktrace for crashlog traces.
#
# General flags for building:
@@ -245,14 +243,10 @@ ifdef STATIC
libs+=-static
endif
ifneq (,$(filter $(CC) $(CXX),gcc g++))
opts+=-mno-ms-bitfields
endif
# build with profiling information
ifdef PROFILEMODE
opts+=-pg
libs+=-pg
LDFLAGS+=-pg
endif
ifdef DEBUGMODE
@@ -262,32 +256,29 @@ debug_opts=-DNDEBUG
opts+=-O3
ifdef USELTO
# compile with LTO
ifdef MINGW
opts+=-flto=auto -g
LDFLAGS+=-flto=auto -g
else
opts+=-flto=auto
libs+=-flto=auto
LDFLAGS+=-flto=auto
endif
endif
endif
ifdef USEASAN
# compile with asan
ifdef MINGW
opts+=-fsanitize=address -g
libs+=-fsanitize=address -g
else
opts+=-fsanitize=address
libs+=-fsanitize=address
endif
ifdef USEUBSAN
# compile with asan
opts+=-fsanitize=undefined
libs+=-fsanitize=undefined
endif
ifneq (,$(filter $(CC) $(CXX),clang clang++))
libs+=-fuse-ld=lld
endif
ifdef MINGW
# mingw needs this passed AFTER lto and the likes were passed
# otherwise libbacktrace may break
opts+=-g
libs+=-g
ifeq ($(CC),clang)
LDFLAGS+= -fuse-ld=lld
endif
# debug_opts also get passed to windres
-5
View File
@@ -1,5 +0,0 @@
makedir:=$(makedir)/Dummy
sources+=$(call List,dummy/Sourcefile)
NOHW=1
+4 -4
View File
@@ -6,8 +6,7 @@ passthru_opts+=\
NOHW NOMD5 NOPOSTPROCESSING\
MOBJCONSISTANCY PACKETDROP ZDEBUG\
HAVE_MINIUPNPC\
HAVE_DISCORDRPC DEVELOP\
NOHOLEPUNCH\
HAVE_DISCORDRPC DEVELOP
# build with debugging information
ifdef DEBUGMODE
@@ -19,10 +18,8 @@ ifndef NOHW
opts+=-DHWRENDER
ifndef NOSCREENFBO
ifndef STATIC_OPENGL
opts+=-DUSE_FBO_OGL
endif
endif
sources+=$(call List,hardware/Sourcefile)
endif
@@ -31,12 +28,14 @@ ifndef NOMD5
sources+=md5.c
endif
ifndef NONET
ifndef NOSATURNJOIN
opts+=-DDOSATURNJOIN
endif
ifndef NOSATURNPAK
opts+=-DDOSATURNPAK
endif
endif
ifndef NOZLIB
ifndef NOPNG
@@ -51,6 +50,7 @@ ifdef LINUX
opts+=-D_LARGEFILE64_SOURCE
endif
opts+=-DHAVE_PNG
sources+=apng.c
endif
endif
+2
View File
@@ -19,7 +19,9 @@ else ifeq (${DEDICATED},1)
EXENAME?=srb2haikud
endif
ifndef NONET
libs+=-lnetwork
endif
define _set =
$(1)_CFLAGS?=$($(1)_opts)
+1 -1
View File
@@ -10,7 +10,7 @@
makedir:=$(makedir)/SDL
opts+=-DHAVE_SDL
opts+=-DDIRECTFULLSCREEN -DHAVE_SDL
sources+=$(call List,sdl/Sourcefile)
NOUPNP=1
+2 -4
View File
@@ -144,10 +144,8 @@ ifdef GCC81
WFLAGS+=-Wno-error=multistatement-macros
endif
ifneq (,$(filter $(CC) $(CXX),clang clang++))
WFLAGS+= -Wno-unknown-pragmas
WFLAGS+= -Wno-cast-align
WFLAGS+= -Wno-cast-qual # not a fan, but clang really hates our read macros
ifeq ($(CC),clang)
WFLAGS+= -Wno-unknown-pragmas -Wno-cast-align
endif
ifdef NONX86
+1 -3
View File
@@ -2,8 +2,6 @@
# Mingw, if you don't know, that's Win32/Win64
#
sources+=$(call List,win32/Sourcefile)
ifndef MINGW64
EXENAME?=srb2kart-saturn_32bit.exe
else
@@ -97,7 +95,7 @@ LIBBACKTRACE_libs:=-L$(lib)/lib/x86_64 -lbacktrace
$(eval $(call _set,LIBBACKTRACE))
else
lib:=../libs/drmingw
opts+=-I$(lib)/include -DHAVE_DRMINGW
opts+=-I$(lib)/include
libs+=-L$(lib)/lib/win32 -lmgwhelp -lexchndl
endif
+1 -2
View File
@@ -34,7 +34,6 @@ m_misc.c
m_perfstats.c
m_queue.c
m_random.c
m_curl.c
mserv.c
http-mserv.c
qs22j.c
@@ -53,7 +52,7 @@ r_data.c
r_draw.c
r_fps.cpp
r_main.cpp
r_patch.cpp
r_patch.c
r_patchrotation.c
r_plane.cpp
r_segs.cpp
+1 -8
View File
@@ -265,11 +265,6 @@ static void AM_findMinMaxBoundaries(void)
max_w = minimapinfo.map_w << MAPBITS;
max_h = minimapinfo.map_h << MAPBITS;
if (max_w == 0)
max_w = 1;
if (max_h == 0)
max_h = 1;
a = FixedDiv(f_w<<FRACBITS, max_w);
b = FixedDiv(f_h<<FRACBITS, max_h);
@@ -359,9 +354,7 @@ static void AM_LevelInit(void)
AM_findMinMaxBoundaries();
scale_mtof = FixedDiv(min_scale_mtof*10, 7*FRACUNIT);
if (scale_mtof > max_scale_mtof)
scale_mtof = max_scale_mtof;
if (scale_mtof == 0)
scale_mtof = 1;
scale_mtof = min_scale_mtof;
scale_ftom = FixedDiv(FRACUNIT, scale_mtof);
}
+2 -2
View File
@@ -110,7 +110,7 @@ void I_Error(const char *error, ...)
char logbuf[8192];
va_start(argptr, error);
vsnprintf(logbuf, 8192, error, argptr);
vsprintf(logbuf, error, argptr);
va_end(argptr);
LOGE(logbuf);
@@ -166,7 +166,7 @@ void I_OutputMsg(const char *fmt, ...)
char logbuf[8192];
va_start(argptr, fmt);
vsnprintf(logbuf, 8192, fmt, argptr);
vsprintf(logbuf, fmt, argptr);
va_end(argptr);
LOGD(logbuf);
+2 -1
View File
@@ -42,6 +42,7 @@ INT32 VID_SetMode(INT32 modenum)
vid.modenum = 0;
vid.width = 320;
vid.height = 240;
vid.buffer = android_surface;
return 0;
}
@@ -64,7 +65,7 @@ void I_WaitVBL(INT32 count)
(void)count;
}
void I_ReadScreen(UINT8 * restrict scr, INT32 scale)
void I_ReadScreen(UINT8 *scr)
{
(void)scr;
}
+289
View File
@@ -0,0 +1,289 @@
/*
Copyright 2019, James R.
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include <stdlib.h>
#include <string.h>
#include "apng.h"
#define APNG_INFO_acTL 0x20000U
#define APNG_WROTE_acTL 0x10000U
struct apng_info_def
{
png_uint_32 mode;
png_uint_32 valid;
png_uint_32 num_frames;
png_uint_32 num_plays;
long start_acTL;/* acTL is written here */
png_flush_ptr output_flush_fn;
apng_seek_ptr output_seek_fn;
apng_tell_ptr output_tell_fn;
apng_set_acTL_ptr set_acTL_fn;
};
/* PROTOS (FUCK COMPILER) */
void apng_seek (png_structp, apng_const_infop, size_t);
size_t apng_tell (png_structp, apng_const_infop);
#ifdef PNG_WRITE_FLUSH_SUPPORTED
void apng_flush (png_structp, apng_infop);
#ifdef PNG_STDIO_SUPPORTED
void apng_default_flush (png_structp);
#endif/* PNG_STDIO_SUPPORTED */
#endif/* PNG_WRITE_FLUSH_SUPPORTED */
#ifdef PNG_STDIO_SUPPORTED
void apng_default_seek (png_structp, size_t);
size_t apng_default_tell (png_structp);
#endif/* PNG_STDIO_SUPPORTED */
void apng_write_IEND (png_structp);
void apng_write_acTL (png_structp, png_uint_32, png_uint_32);
#ifndef PNG_WRITE_APNG_SUPPORTED
png_uint_32 apng_set_acTL_dummy (png_structp, png_infop,
png_uint_32, png_uint_32);
#endif/* PNG_WRITE_APNG_SUPPORTED */
apng_infop
apng_create_info_struct (png_structp pngp)
{
apng_infop ainfop;
(void)pngp;
if (( ainfop = calloc(1, sizeof (apng_info)) ))
{
apng_set_write_fn(pngp, ainfop, 0, 0, 0, 0, 0);
apng_set_set_acTL_fn(pngp, ainfop, 0);
}
return ainfop;
}
void
apng_destroy_info_struct (png_structp pngp, apng_infopp ainfopp)
{
(void)pngp;
if (!( pngp && ainfopp ))
return;
free((*ainfopp));
}
void
apng_seek (png_structp pngp, apng_const_infop ainfop, size_t l)
{
(*(ainfop->output_seek_fn))(pngp, l);
}
size_t
apng_tell (png_structp pngp, apng_const_infop ainfop)
{
return (*(ainfop->output_tell_fn))(pngp);
}
#ifdef PNG_WRITE_FLUSH_SUPPORTED
void
apng_flush (png_structp pngp, apng_infop ainfop)
{
if (ainfop->output_flush_fn)
(*(ainfop->output_flush_fn))(pngp);
}
#ifdef PNG_STDIO_SUPPORTED
void
apng_default_flush (png_structp pngp)
{
if (!( pngp ))
return;
fflush((png_FILE_p)png_get_io_ptr);
}
#endif/* PNG_STDIO_SUPPORTED */
#endif/* PNG_WRITE_FLUSH_SUPPORTED */
#ifdef PNG_STDIO_SUPPORTED
void
apng_default_seek (png_structp pngp, size_t l)
{
if (!( pngp ))
return;
if (fseek((png_FILE_p)png_get_io_ptr(pngp), (long)l, SEEK_SET) == -1)
png_error(pngp, "Seek Error");
}
size_t
apng_default_tell (png_structp pngp)
{
long l;
if (!( pngp ))
{
png_error(pngp, "Call to apng_default_tell with NULL pngp failed");
}
if (( l = ftell((png_FILE_p)png_get_io_ptr(pngp)) ) == -1)
png_error(pngp, "Tell Error");
return (size_t)l;
}
#endif/* PNG_STDIO_SUPPORTED */
void
apng_set_write_fn (png_structp pngp, apng_infop ainfop, png_voidp iop,
png_rw_ptr write_f, png_flush_ptr flush_f,
apng_seek_ptr seek_f, apng_tell_ptr tell_f)
{
if (!( pngp && ainfop ))
return;
png_set_write_fn(pngp, iop, write_f, flush_f);
#ifdef PNG_WRITE_FLUSH_SUPPORTED
#ifdef PNG_STDIO_SUPPORTED
if (!flush_f)
ainfop->output_flush_fn = &apng_default_flush;
else
#endif/* PNG_STDIO_SUPPORTED */
ainfop->output_flush_fn = flush_f;
#endif/* PNG_WRITE_FLUSH_SUPPORTED */
#ifdef PNG_STDIO_SUPPORTED
if (!seek_f)
ainfop->output_seek_fn = &apng_default_seek;
else
#endif/* PNG_STDIO_SUPPORTED */
ainfop->output_seek_fn = seek_f;
#ifdef PNG_STDIO_SUPPORTED
if (!seek_f)
ainfop->output_tell_fn = apng_default_tell;
else
#endif/* PNG_STDIO_SUPPORTED */
ainfop->output_tell_fn = tell_f;
}
void
apng_write_IEND (png_structp pngp)
{
png_byte chunkc[] = "IEND";
png_write_chunk(pngp, chunkc, 0, 0);
}
void
apng_write_acTL (png_structp pngp, png_uint_32 frames, png_uint_32 plays)
{
png_byte chunkc[] = "acTL";
png_byte buf[8];
png_save_uint_32(buf, frames);
png_save_uint_32(buf + 4, plays);
png_write_chunk(pngp, chunkc, buf, 8);
}
png_uint_32
apng_set_acTL (png_structp pngp, png_infop infop, apng_infop ainfop,
png_uint_32 frames, png_uint_32 plays)
{
(void)pngp;
(void)infop;
if (!( pngp && infop && ainfop ))
return 0;
ainfop->num_frames = frames;
ainfop->num_plays = plays;
ainfop->valid |= APNG_INFO_acTL;
return 1;
}
void
apng_write_info_before_PLTE (png_structp pngp, png_infop infop,
apng_infop ainfop)
{
if (!( pngp && infop && ainfop ))
return;
png_write_info_before_PLTE(pngp, infop);
if (( ainfop->valid & APNG_INFO_acTL )&&!( ainfop->mode & APNG_WROTE_acTL ))
{
ainfop->start_acTL = apng_tell(pngp, ainfop);
apng_write_acTL(pngp, 0, 0);
/* modified for runtime dynamic linking */
(*(ainfop->set_acTL_fn))(pngp, infop, PNG_UINT_31_MAX, 0);
ainfop->mode |= APNG_WROTE_acTL;
}
}
void
apng_write_info (png_structp pngp, png_infop infop,
apng_infop ainfop)
{
apng_write_info_before_PLTE(pngp, infop, ainfop);
png_write_info(pngp, infop);
}
void
apng_write_end (png_structp pngp, png_infop infop, apng_infop ainfop)
{
(void)infop;
apng_write_IEND(pngp);
apng_seek(pngp, ainfop, ainfop->start_acTL);
apng_write_acTL(pngp, ainfop->num_frames, ainfop->num_plays);
#ifdef PNG_WRITE_FLUSH_SUPPORTED
#ifdef PNG_WRITE_FLUSH_AFTER_IEND_SUPPORTED
apng_flush(pngp, infop);
#endif/* PNG_WRITE_FLUSH_SUPPORTED */
#endif/* PNG_WRITE_FLUSH_AFTER_IEND_SUPPORTED */
}
#ifndef PNG_WRITE_APNG_SUPPORTED
png_uint_32
apng_set_acTL_dummy (png_structp pngp, png_infop infop,
png_uint_32 frames, png_uint_32 plays)
{
(void)pngp;
(void)infop;
(void)frames;
(void)plays;
return 0;
}
#endif/* PNG_WRITE_APNG_SUPPORTED */
/* Dynamic runtime linking capable! (Hopefully.) */
void
apng_set_set_acTL_fn (png_structp pngp, apng_infop ainfop,
apng_set_acTL_ptr set_acTL_f)
{
(void)pngp;
if (!ainfop->set_acTL_fn)
#ifndef PNG_WRITE_APNG_SUPPORTED
ainfop->set_acTL_fn = &apng_set_acTL_dummy;
#else
ainfop->set_acTL_fn = &png_set_acTL;
#endif/* PNG_WRITE_APNG_SUPPORTED */
else
ainfop->set_acTL_fn = set_acTL_f;
}
+80
View File
@@ -0,0 +1,80 @@
/*
Copyright 2019, James R.
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef APNG_H
#define APNG_H
#ifndef _MSC_VER
#ifndef _LARGEFILE64_SOURCE
#define _LARGEFILE64_SOURCE
#endif
#endif
#ifndef _LFS64_LARGEFILE
#define _LFS64_LARGEFILE
#endif
#ifndef _FILE_OFFSET_BITS
#define _FILE_OFFSET_BITS 0
#endif
#include <png.h>
typedef struct apng_info_def apng_info;
typedef apng_info * apng_infop;
typedef const apng_info * apng_const_infop;
typedef apng_info * * apng_infopp;
typedef void (*apng_seek_ptr)(png_structp, size_t);
typedef size_t (*apng_tell_ptr)(png_structp);
typedef png_uint_32 (*apng_set_acTL_ptr)(png_structp, png_infop,
png_uint_32, png_uint_32);
apng_infop apng_create_info_struct (png_structp png_ptr);
void apng_destroy_info_struct (png_structp png_ptr,
apng_infopp info_ptr_ptr);
/* Call the following functions in place of the libpng counterparts. */
png_uint_32 apng_set_acTL (png_structp png_ptr, png_infop info_ptr,
apng_infop ainfo_ptr,
png_uint_32 num_frames, png_uint_32 num_plays);
void apng_write_info_before_PLTE (png_structp png_ptr, png_infop info_ptr,
apng_infop ainfo_ptr);
void apng_write_info (png_structp png_ptr, png_infop info_ptr,
apng_infop ainfo_ptr);
void apng_write_end (png_structp png_ptr, png_infop info_ptr,
apng_infop ainfo_ptr);
void apng_set_write_fn (png_structp png_ptr, apng_infop ainfo_ptr,
png_voidp io_ptr,
png_rw_ptr write_data_fn, png_flush_ptr output_flush_fn,
apng_seek_ptr output_seek_fn, apng_tell_ptr output_tell_fn);
void apng_set_set_acTL_fn (png_structp png_ptr, apng_infop ainfo_ptr,
apng_set_acTL_ptr set_acTL_fn);
#endif/* APNG_H */
-5
View File
@@ -10,13 +10,8 @@
/// \file b_bot.h
/// \brief Basic bot handling
#ifndef __B_BOT__
#define __B_BOT__
void B_BuildTiccmd(player_t *player, ticcmd_t *cmd);
void B_KeysToTiccmd(mobj_t *mo, ticcmd_t *cmd, boolean forward, boolean backward, boolean left, boolean right, boolean strafeleft, boolean straferight, boolean jump, boolean spin);
boolean B_CheckRespawn(player_t *player);
void B_MoveBlocked(player_t *player);
void B_RespawnBot(INT32 playernum);
#endif
+1 -1
View File
@@ -434,7 +434,7 @@ LUA_API void lua_pushnumber (lua_State *L, lua_Number n) {
LUA_API void lua_pushlstring (lua_State *L, const char *s, size_t len) {
lua_lock(L);
luaC_checkGC(L);
setsvalue2s(L, L->top, (len == 0) ? luaS_new(L, "") : luaS_newlstr(L, s, len));
setsvalue2s(L, L->top, luaS_newlstr(L, s, len));
api_incr_top(L);
lua_unlock(L);
}
+2 -4
View File
@@ -24,8 +24,6 @@
#include "lauxlib.h"
#include "../doomdef.h"
#define FREELIST_REF 0 /* free list of references */
@@ -42,7 +40,7 @@ LUALIB_API int luaL_argerror (lua_State *L, int narg, const char *extramsg) {
if (!lua_getstack(L, 0, &ar)) /* no stack frame? */
return luaL_error(L, "bad argument #%d (%s)", narg, extramsg);
lua_getinfo(L, "n", &ar);
if (fastcmp(ar.namewhat, "method")) {
if (strcmp(ar.namewhat, "method") == 0) {
narg--; /* do not count `self' */
if (narg == 0) /* error is in the self argument itself? */
return luaL_error(L, "calling " LUA_QS " on bad self (%s)",
@@ -99,7 +97,7 @@ LUALIB_API int luaL_checkoption (lua_State *L, int narg, const char *def,
luaL_checkstring(L, narg);
int i;
for (i=0; lst[i]; i++)
if (fastcmp(lst[i], name))
if (strcmp(lst[i], name) == 0)
return i;
return luaL_argerror(L, narg,
lua_pushfstring(L, "invalid option " LUA_QS, name));
+8
View File
@@ -46,6 +46,10 @@
** =======================================================
*/
#ifdef _MSC_VER
#pragma warning(disable : 4324)
#endif
/* chain list of long jump buffers */
struct lua_longjmp {
struct lua_longjmp *previous;
@@ -53,6 +57,10 @@ struct lua_longjmp {
volatile int status; /* error code */
};
#ifdef _MSC_VER
#pragma warning(default : 4324)
#endif
void luaD_seterrorobj (lua_State *L, int lerrcode, StkId oldtop) {
switch (lerrcode) {
case LUA_ERRMEM: {
+6
View File
@@ -48,6 +48,12 @@ LUAI_FUNC void luaD_reallocCI (lua_State *L, int newsize);
LUAI_FUNC void luaD_reallocstack (lua_State *L, int newsize);
LUAI_FUNC void luaD_growstack (lua_State *L, int n);
#ifdef _MSC_VER
#ifndef ATTRNORETURN
#define ATTRNORETURN __declspec(noreturn)
#endif
#endif
#ifndef ATTRNORETURN
#define ATTRNORETURN
#endif
+3 -5
View File
@@ -161,13 +161,12 @@ static int io_tostring (lua_State *L) {
static int StartsWith(const char *a, const char *b) // this is wolfs being lazy yet again
{
if (strncmp(a, b, strlen(b)) == 0) return 1;
if(strncmp(a, b, strlen(b)) == 0) return 1;
return 0;
}
static int io_open(lua_State *L)
{
static int io_open (lua_State *L) {
FILE **pf;
const char *filename = luaL_checkstring(L, 1);
int pass = 0;
@@ -179,13 +178,12 @@ static int io_open(lua_State *L)
for (i = 0; i < (sizeof (whitelist) / sizeof(const char *)); i++)
{
if (fasticmp(&filename[length - strlen(whitelist[i])], whitelist[i]))
if (!stricmp(&filename[length - strlen(whitelist[i])], whitelist[i]))
{
pass = 1;
break;
}
}
if (l_unlikely(strstr(filename, "..") || strchr(filename, ':') || StartsWith(filename, "\\")
|| StartsWith(filename, "/") || !pass))
{
+20
View File
@@ -11,8 +11,12 @@
#include <limits.h>
#include <stddef.h>
#ifdef _MSC_VER
#define INT32 __int32
#else
#include <stdint.h>
#define INT32 int32_t
#endif
#ifndef __cplusplus
#ifndef min // Double-Check with WATTCP-32's cdefs.h
@@ -566,6 +570,9 @@
#define luai_numshl(a,b) ((unsigned)(a)<<(unsigned)(b))
#define luai_numshr(a,b) ((unsigned)(a)>>(unsigned)(b))
#define luai_numnot(a) (~((unsigned)(a)))
#ifdef _MSC_VER
#pragma warning(disable : 4244)
#endif
#endif
@@ -582,11 +589,24 @@
#if defined(LUA_NUMBER_DOUBLE) && !defined(LUA_ANSI) && !defined(__SSE2__) && \
(defined(__i386) || defined (_M_IX86) || defined(__i386__))
/* On a Microsoft compiler, use assembler */
#if defined(_MSC_VER)
#define lua_number2int(i,d) __asm fld d __asm fistp i
#define lua_number2integer(i,n) lua_number2int(i, n)
/* the next trick should work on any Pentium, but sometimes clashes
with a DirectX idiosyncrasy */
#else
union luai_Cast { double l_d; long l_l; };
#define lua_number2int(i,d) \
{ volatile union luai_Cast u; u.l_d = (d) + 6755399441055744.0; (i) = u.l_l; }
#define lua_number2integer(i,n) lua_number2int(i, n)
#endif
/* this option always works, but may be slow */
#else
#define lua_number2int(i,d) ((i)=(int)(d))
+31 -33
View File
@@ -1,8 +1,7 @@
// SONIC ROBO BLAST 2 KART
// SONIC ROBO BLAST 2
//-----------------------------------------------------------------------------
// Copyright (C) 2025 by Kart Krew.
// Copyright (C) 2020 by Sonic Team Junior.
// Copyright (C) 2000 by DooM Legacy Team.
// Copyright (C) 1998-2000 by DooM Legacy Team.
// Copyright (C) 1999-2025 by Sonic Team Junior.
//
// This program is free software distributed under the
// terms of the GNU General Public License, version 2.
@@ -25,9 +24,8 @@ extern "C" {
//
// Little-endian machines
//
#define WRITEUINT8(p,b) do { UINT8 *p_tmp = ( UINT8 *)p; const UINT8 tv = ( UINT8)(b); memcpy(p, &tv, sizeof( UINT8)); p_tmp++; *(void**)(&(p)) = (void *)p_tmp; } while (0)
#define WRITESINT8(p,b) do { SINT8 *p_tmp = ( SINT8 *)p; const SINT8 tv = ( SINT8)(b); memcpy(p, &tv, sizeof( SINT8)); p_tmp++; *(void**)(&(p)) = (void *)p_tmp; } while (0)
#define WRITESINT8(p,b) do { SINT8 *p_tmp = ( SINT8 *)p; const SINT8 tv = ( UINT8)(b); memcpy(p, &tv, sizeof( UINT8)); p_tmp++; *(void**)(&(p)) = (void *)p_tmp; } while (0)
#define WRITEINT16(p,b) do { INT16 *p_tmp = ( INT16 *)p; const INT16 tv = ( INT16)(b); memcpy(p, &tv, sizeof( INT16)); p_tmp++; *(void**)(&(p)) = (void *)p_tmp; } while (0)
#define WRITEUINT16(p,b) do { UINT16 *p_tmp = ( UINT16 *)p; const UINT16 tv = ( UINT16)(b); memcpy(p, &tv, sizeof( UINT16)); p_tmp++; *(void**)(&(p)) = (void *)p_tmp; } while (0)
#define WRITEINT32(p,b) do { INT32 *p_tmp = ( INT32 *)p; const INT32 tv = ( INT32)(b); memcpy(p, &tv, sizeof( INT32)); p_tmp++; *(void**)(&(p)) = (void *)p_tmp; } while (0)
@@ -38,25 +36,25 @@ extern "C" {
// what is this?
#if defined (__GNUC__)
#define READUINT8(p) ({ const UINT8 *p_tmp = (const UINT8 *)p; UINT8 b; memcpy(&b, p, sizeof( UINT8)); p_tmp++; *(const void**)(&(p)) = (const void *)p_tmp; b; })
#define READSINT8(p) ({ const SINT8 *p_tmp = (const SINT8 *)p; SINT8 b; memcpy(&b, p, sizeof( SINT8)); p_tmp++; *(const void**)(&(p)) = (const void *)p_tmp; b; })
#define READINT16(p) ({ const INT16 *p_tmp = (const INT16 *)p; INT16 b; memcpy(&b, p, sizeof( INT16)); p_tmp++; *(const void**)(&(p)) = (const void *)p_tmp; b; })
#define READUINT16(p) ({ const UINT16 *p_tmp = (const UINT16 *)p; UINT16 b; memcpy(&b, p, sizeof( UINT16)); p_tmp++; *(const void**)(&(p)) = (const void *)p_tmp; b; })
#define READINT32(p) ({ const INT32 *p_tmp = (const INT32 *)p; INT32 b; memcpy(&b, p, sizeof( INT32)); p_tmp++; *(const void**)(&(p)) = (const void *)p_tmp; b; })
#define READUINT32(p) ({ const UINT32 *p_tmp = (const UINT32 *)p; UINT32 b; memcpy(&b, p, sizeof( UINT32)); p_tmp++; *(const void**)(&(p)) = (const void *)p_tmp; b; })
#define READCHAR(p) ({ const char *p_tmp = (const char *)p; char b; memcpy(&b, p, sizeof( char)); p_tmp++; *(const void**)(&(p)) = (const void *)p_tmp; b; })
#define READFIXED(p) ({ const fixed_t *p_tmp = (const fixed_t *)p; fixed_t b; memcpy(&b, p, sizeof(fixed_t)); p_tmp++; *(const void**)(&(p)) = (const void *)p_tmp; b; })
#define READANGLE(p) ({ const angle_t *p_tmp = (const angle_t *)p; angle_t b; memcpy(&b, p, sizeof(angle_t)); p_tmp++; *(const void**)(&(p)) = (const void *)p_tmp; b; })
#define READUINT8(p) ({ UINT8 *p_tmp = (UINT8 *)p; UINT8 b; memcpy(&b, p, sizeof( UINT8)); p_tmp++; *(void**)(&(p)) = (void *)p_tmp; b; })
#define READSINT8(p) ({ SINT8 *p_tmp = (SINT8 *)p; SINT8 b; memcpy(&b, p, sizeof( SINT8)); p_tmp++; *(void**)(&(p)) = (void *)p_tmp; b; })
#define READINT16(p) ({ INT16 *p_tmp = (INT16 *)p; INT16 b; memcpy(&b, p, sizeof( INT16)); p_tmp++; *(void**)(&(p)) = (void *)p_tmp; b; })
#define READUINT16(p) ({ UINT16 *p_tmp = (UINT16 *)p; UINT16 b; memcpy(&b, p, sizeof( UINT16)); p_tmp++; *(void**)(&(p)) = (void *)p_tmp; b; })
#define READINT32(p) ({ INT32 *p_tmp = (INT32 *)p; INT32 b; memcpy(&b, p, sizeof( INT32)); p_tmp++; *(void**)(&(p)) = (void *)p_tmp; b; })
#define READUINT32(p) ({ UINT32 *p_tmp = (UINT32 *)p; UINT32 b; memcpy(&b, p, sizeof( UINT32)); p_tmp++; *(void**)(&(p)) = (void *)p_tmp; b; })
#define READCHAR(p) ({ char *p_tmp = (char *)p; char b; memcpy(&b, p, sizeof( char)); p_tmp++; *(void**)(&(p)) = (void *)p_tmp; b; })
#define READFIXED(p) ({ fixed_t *p_tmp = (fixed_t *)p; fixed_t b; memcpy(&b, p, sizeof(fixed_t)); p_tmp++; *(void**)(&(p)) = (void *)p_tmp; b; })
#define READANGLE(p) ({ angle_t *p_tmp = (angle_t *)p; angle_t b; memcpy(&b, p, sizeof(angle_t)); p_tmp++; *(void**)(&(p)) = (void *)p_tmp; b; })
#else
#define READUINT8(p) ((const UINT8*) (*(const void**)(&(p)) = (const void*)&((const UINT8*) (p))[1]))[-1]
#define READSINT8(p) ((const SINT8*) (*(const void**)(&(p)) = (const void*)&((const SINT8*) (p))[1]))[-1]
#define READINT16(p) ((const INT16*) (*(const void**)(&(p)) = (const void*)&((const INT16*) (p))[1]))[-1]
#define READUINT16(p) ((const UINT16*) (*(const void**)(&(p)) = (const void*)&((const UINT16*) (p))[1]))[-1]
#define READINT32(p) ((const INT32*) (*(const void**)(&(p)) = (const void*)&((const INT32*) (p))[1]))[-1]
#define READUINT32(p) ((const UINT32*) (*(const void**)(&(p)) = (const void*)&((const UINT32*) (p))[1]))[-1]
#define READCHAR(p) ((const char*) (*(const void**)(&(p)) = (const void*)&((const char*) (p))[1]))[-1]
#define READFIXED(p) ((const fixed_t*)(*(const void**)(&(p)) = (const void*)&((const fixed_t*)(p))[1]))[-1]
#define READANGLE(p) ((const angle_t*)(*(const void**)(&(p)) = (const void*)&((const angle_t*)(p))[1]))[-1]
#define READUINT8(p) ((UINT8*)(*(void**)(&(p)) = (void*)&((UINT8*)(p))[1]))[-1]
#define READSINT8(p) ((SINT8*)(*(void**)(&(p)) = (void*)&((SINT8*)(p))[1]))[-1]
#define READINT16(p) ((INT16*)(*(void**)(&(p)) = (void*)&((INT16*)(p))[1]))[-1]
#define READUINT16(p) ((UINT16*)(*(void**)(&(p)) = (void*)&((UINT16*)(p))[1]))[-1]
#define READINT32(p) ((INT32*)(*(void**)(&(p)) = (void*)&((INT32*)(p))[1]))[-1]
#define READUINT32(p) ((UINT32*)(*(void**)(&(p)) = (void*)&((UINT32*)(p))[1]))[-1]
#define READCHAR(p) ((char*)(*(void**)(&(p)) = (void*)&((char*)(p))[1]))[-1]
#define READFIXED(p) ((fixed_t*)(*(void**)(&(p)) = (void*)&((fixed_t*)(p))[1]))[-1]
#define READANGLE(p) ((angle_t*)(*(void**)(&(p)) = (void*)&((angle_t*)(p))[1]))[-1]
#endif
#else //SRB2_BIG_ENDIAN
@@ -119,15 +117,15 @@ FUNCINLINE static ATTRINLINE UINT32 readulong(void *ptr)
return (ucp[3] << 24) | (ucp[2] << 16) | (ucp[1] << 8) | ucp[0];
}
#define READUINT8(p) ((const UINT8*)(p = (const void*)&((const UINT8*)p)[1]))[-1]
#define READSINT8(p) ((const SINT8*)(p = (const void*)&((const SINT8*)p)[1]))[-1]
#define READINT16(p) readshort(&((const INT16*)(p = (const void*)&((const INT16*)p)[1]))[-1])
#define READUINT16(p) readushort(&((const UINT16*)(p = (const void*)&((const UINT16*)p)[1]))[-1])
#define READINT32(p) readlong(&((const INT32*)(p = (const void*)&((const INT32*)p)[1]))[-1])
#define READUINT32(p) readulong(&((const UINT32*)(p = (const void*)&((const UINT32*)p)[1]))[-1])
#define READCHAR(p) ((const char*)(p = (const void*)&((const char*)p)[1]))[-1]
#define READFIXED(p) readlong(&((const fixed_t*)(p = (const void*)&((const fixed_t*)p)[1]))[-1])
#define READANGLE(p) readulong(&((const angle_t*)(p = (const void*)&((const angle_t*)p)[1]))[-1])
#define READUINT8(p) ((UINT8*)(p = (void*)&((UINT8*)p)[1]))[-1]
#define READSINT8(p) ((SINT8*)(p = (void*)&((SINT8*)p)[1]))[-1]
#define READINT16(p) readshort(&((INT16*)(p = (void*)&((INT16*)p)[1]))[-1])
#define READUINT16(p) readushort(&((UINT16*)(p = (void*)&((UINT16*)p)[1]))[-1])
#define READINT32(p) readlong(&((INT32*)(p = (void*)&((INT32*)p)[1]))[-1])
#define READUINT32(p) readulong(&((UINT32*)(p = (void*)&((UINT32*)p)[1]))
#define READCHAR(p) ((char*)(p = (void*)&((char*)p)[1]))[-1]
#define READFIXED(p) readlong(&((fixed_t*)(p = (void*)&((fixed_t*)p)[1]))[-1])
#define READANGLE(p) readulong(&((angle_t*)(p = (void*)&((angle_t*)p)[1]))[-1])
#endif //SRB2_BIG_ENDIAN
#define WRITESTRINGN(p, s, n) do { \
+78 -83
View File
@@ -142,7 +142,7 @@ void COM_BufInsertText(const char *ptext)
templen = com_text.cursize;
if (templen)
{
temp = memcpy(ZZ_Alloc(templen), com_text.data, templen);
temp = M_Memcpy(ZZ_Alloc(templen), com_text.data, templen);
VS_Clear(&com_text);
}
@@ -199,7 +199,7 @@ void COM_BufExecute(void)
break;
}
memcpy(line, ptext, i);
M_Memcpy(line, ptext, i);
line[i] = 0;
// flush the command text from the command buffer, _BEFORE_
@@ -281,7 +281,7 @@ char *com_argv[MAX_ARGS];
static const char *com_null_string = "";
static char *com_args = NULL; // current command args or NULL
static void Got_NetVar(const UINT8 **p, INT32 playernum);
static void Got_NetVar(UINT8 **p, INT32 playernum);
/** Initializes command buffer and adds basic commands.
*/
@@ -359,7 +359,7 @@ size_t COM_CheckParm(const char *check)
size_t i;
for (i = 1; i < com_argc; i++)
if (fasticmp(check, com_argv[i]))
if (!strcasecmp(check, com_argv[i]))
return i;
return 0;
}
@@ -456,7 +456,7 @@ void COM_AddCommand(const char *name, com_func_t func)
// fail if the command already exists
for (cmd = com_commands; cmd; cmd = cmd->next)
{
if (fasticmp(name, cmd->name)) //case insensitive now that we have lower and uppercase!
if (!stricmp(name, cmd->name)) //case insensitive now that we have lower and uppercase!
{
// don't I_Error for Lua commands
// Lua commands can replace game commands, and they have priority.
@@ -492,7 +492,7 @@ int COM_AddLuaCommand(const char *name)
// command already exists
for (cmd = com_commands; cmd; cmd = cmd->next)
{
if (fasticmp(name, cmd->name)) //case insensitive now that we have lower and uppercase!
if (!stricmp(name, cmd->name)) //case insensitive now that we have lower and uppercase!
{
// replace the built in command.
cmd->function = COM_Lua_f;
@@ -519,7 +519,7 @@ static boolean COM_Exists(const char *com_name)
xcommand_t *cmd;
for (cmd = com_commands; cmd; cmd = cmd->next)
if (fasticmp(com_name, cmd->name))
if (!stricmp(com_name, cmd->name))
return true;
return false;
@@ -571,7 +571,7 @@ static void COM_ExecuteString(char *ptext)
// check functions
for (cmd = com_commands; cmd; cmd = cmd->next)
{
if (fasticmp(com_argv[0], cmd->name)) //case insensitive now that we have lower and uppercase!
if (!stricmp(com_argv[0], cmd->name)) //case insensitive now that we have lower and uppercase!
{
cmd->function();
return;
@@ -581,7 +581,7 @@ static void COM_ExecuteString(char *ptext)
// check aliases
for (a = com_alias; a; a = a->next)
{
if (fasticmp(com_argv[0], a->name))
if (!stricmp(com_argv[0], a->name))
{
if (recursion > MAX_ALIAS_RECURSION)
CONS_Alert(CONS_WARNING, M_GetText("Alias recursion cycle detected!\n"));
@@ -700,7 +700,6 @@ static void COM_Echo_f(void)
for (i = 1; i < COM_Argc(); i++)
CONS_Printf("%s ", COM_Argv(i));
CONS_Printf("\n");
}
@@ -709,14 +708,16 @@ static void COM_Echo_f(void)
static void COM_CEcho_f(void)
{
size_t i;
char cechotext[1024] = {0};
char cechotext[1024] = "";
for (i = 1; i < COM_Argc(); i++)
{
strlcat(cechotext, COM_Argv(i), sizeof(cechotext)-1);
strlcat(cechotext, " ", sizeof(cechotext)-1);
strncat(cechotext, COM_Argv(i), sizeof(cechotext)-1);
strncat(cechotext, " ", sizeof(cechotext)-1);
}
cechotext[sizeof(cechotext) - 1] = '\0';
HU_DoCEcho(cechotext);
}
@@ -836,7 +837,7 @@ static void COM_Help_f(void)
if (cvar->PossibleValue)
{
{
if (fasticmp(cvar->PossibleValue[0].strvalue, "MIN") && fasticmp(cvar->PossibleValue[1].strvalue, "MAX"))
if (!stricmp(cvar->PossibleValue[0].strvalue, "MIN") && !stricmp(cvar->PossibleValue[1].strvalue, "MAX"))
{
if (floatmode)
{
@@ -879,7 +880,7 @@ static void COM_Help_f(void)
{
for (cmd = com_commands; cmd; cmd = cmd->next)
{
if (!fastcmp(cmd->name, help))
if (strcmp(cmd->name, help))
continue;
CONS_Printf("\x82""Command %s:\n", cmd->name);
@@ -939,8 +940,6 @@ static void COM_Find_f(void)
}
help = COM_Argv(1);
if (!help)
return;
helplen = strlen(help);
CONS_Printf("\x82""Variables:\n");
matchesany = false;
@@ -1129,7 +1128,7 @@ void *VS_GetSpace(vsbuf_t *buf, size_t length)
*/
void VS_Write(vsbuf_t *buf, const void *data, size_t length)
{
memcpy(VS_GetSpace(buf, length), data, length);
M_Memcpy(VS_GetSpace(buf, length), data, length);
}
/** Prints text in a variable buffer. Like VS_Write() plus a
@@ -1146,9 +1145,9 @@ void VS_Print(vsbuf_t *buf, const char *data)
len = strlen(data) + 1;
if (buf->data[buf->cursize-1])
memcpy((UINT8 *)VS_GetSpace(buf, len), data, len); // no trailing 0
M_Memcpy((UINT8 *)VS_GetSpace(buf, len), data, len); // no trailing 0
else
memcpy((UINT8 *)VS_GetSpace(buf, len-1) - 1, data, len); // write over trailing 0
M_Memcpy((UINT8 *)VS_GetSpace(buf, len-1) - 1, data, len); // write over trailing 0
}
// =========================================================================
@@ -1176,7 +1175,7 @@ consvar_t *CV_FindVar(const char *name)
consvar_t *cvar;
for (cvar = consvar_vars; cvar; cvar = cvar->next)
if (fasticmp(name,cvar->name))
if (!stricmp(name,cvar->name))
return cvar;
return NULL;
@@ -1366,7 +1365,7 @@ static void Setvalue(consvar_t *var, const char *valstr, boolean stealth)
v = INT32_MIN; // Invalid integer trigger
}
if (var->PossibleValue[0].strvalue && fasticmp(var->PossibleValue[0].strvalue, "MIN")) // bounded cvar
if (var->PossibleValue[0].strvalue && !stricmp(var->PossibleValue[0].strvalue, "MIN")) // bounded cvar
{
#define MINVAL 0
#define MAXVAL 1
@@ -1379,21 +1378,21 @@ static void Setvalue(consvar_t *var, const char *valstr, boolean stealth)
// search for other
for (i = MAXVAL+1; var->PossibleValue[i].strvalue; i++)
if (v == var->PossibleValue[i].value || fasticmp(var->PossibleValue[i].strvalue, valstr))
if (v == var->PossibleValue[i].value || !stricmp(var->PossibleValue[i].strvalue, valstr))
{
var->value = var->PossibleValue[i].value;
var->string = var->PossibleValue[i].strvalue;
goto finish;
}
if ((v != INT32_MIN && v < var->PossibleValue[MINVAL].value) || fasticmp(valstr, "MIN"))
if ((v != INT32_MIN && v < var->PossibleValue[MINVAL].value) || !stricmp(valstr, "MIN"))
{
v = var->PossibleValue[MINVAL].value;
valstr = var->PossibleValue[MINVAL].strvalue;
override = true;
overrideval = v;
}
else if ((v != INT32_MIN && v > var->PossibleValue[MAXVAL].value) || fasticmp(valstr, "MAX"))
else if ((v != INT32_MIN && v > var->PossibleValue[MAXVAL].value) || !stricmp(valstr, "MAX"))
{
v = var->PossibleValue[MAXVAL].value;
valstr = var->PossibleValue[MAXVAL].strvalue;
@@ -1411,7 +1410,7 @@ static void Setvalue(consvar_t *var, const char *valstr, boolean stealth)
// check first strings
for (i = 0; var->PossibleValue[i].strvalue; i++)
if (fasticmp(var->PossibleValue[i].strvalue, valstr))
if (!stricmp(var->PossibleValue[i].strvalue, valstr))
goto found;
if (v != INT32_MIN)
{
@@ -1424,9 +1423,9 @@ static void Setvalue(consvar_t *var, const char *valstr, boolean stealth)
if (var->PossibleValue == CV_OnOff || var->PossibleValue == CV_YesNo)
{
overrideval = -1;
if (fasticmp(valstr, "on") || fasticmp(valstr, "yes"))
if (!stricmp(valstr, "on") || !stricmp(valstr, "yes"))
overrideval = 1;
else if (fasticmp(valstr, "off") || fasticmp(valstr, "no"))
else if (!stricmp(valstr, "off") || !stricmp(valstr, "no"))
overrideval = 0;
if (overrideval != -1)
@@ -1474,7 +1473,7 @@ finish:
var->flags |= CV_MODIFIED;
// raise 'on change' code
LUA_CVarChanged(var); // let consolelib know what cvar this is.
LUA_CVarChanged(var->name); // let consolelib know what cvar this is.
if (var->flags & CV_CALL && !stealth)
var->func();
@@ -1500,11 +1499,11 @@ badinput:
static boolean serverloading = false;
static void Got_NetVar(const UINT8 **p, INT32 playernum)
static void Got_NetVar(UINT8 **p, INT32 playernum)
{
consvar_t *cvar;
UINT16 netid;
const char *svalue;
char *svalue;
UINT8 stealth = false;
if (playernum != serverplayer && !IsPlayerAdmin(playernum) && !serverloading)
@@ -1518,10 +1517,9 @@ static void Got_NetVar(const UINT8 **p, INT32 playernum)
}
return;
}
netid = READUINT16(*p);
cvar = CV_FindNetVar(netid);
svalue = (const char *)*p;
svalue = (char *)*p;
SKIPSTRING(*p);
stealth = READUINT8(*p);
@@ -1577,9 +1575,8 @@ void CV_SaveNetVars(UINT8 **p, boolean isdemorecording)
WRITEUINT16(count_p, count);
}
size_t CV_LoadNetVars(const UINT8 *bufstart)
void CV_LoadNetVars(UINT8 **p)
{
const UINT8 *p = bufstart;
consvar_t *cvar;
UINT16 count;
@@ -1590,13 +1587,11 @@ size_t CV_LoadNetVars(const UINT8 *bufstart)
if (cvar->flags & CV_NETVAR)
Setvalue(cvar, cvar->defaultvalue, true);
count = READUINT16(p);
count = READUINT16(*p);
while (count--)
Got_NetVar(&p, 0);
Got_NetVar(p, 0);
serverloading = false;
return p - bufstart;
}
static void CV_SetCVar(consvar_t *var, const char *value, boolean stealth);
@@ -1614,7 +1609,7 @@ void CV_ResetCheatNetVars(void)
// Returns true if the variable's current value is its default value
boolean CV_IsSetToDefault(consvar_t *v)
{
return (fastcmp(v->defaultvalue, v->string));
return (!(strcmp(v->defaultvalue, v->string)));
}
// If any cheats CVars are not at their default settings, return true.
@@ -1626,7 +1621,7 @@ UINT8 CV_CheatsEnabled(void)
consvar_t *cvar;
for (cvar = consvar_vars; cvar; cvar = cvar->next)
if ((cvar->flags & CV_CHEAT) && !fastcmp(cvar->defaultvalue, cvar->string))
if ((cvar->flags & CV_CHEAT) && strcmp(cvar->defaultvalue, cvar->string))
return 1;
return 0;
}
@@ -1647,7 +1642,7 @@ static void CV_SetCVar(consvar_t *var, const char *value, boolean stealth)
if (!var->string)
I_Error("CV_Set: %s no string set!\n", var->name);
#endif
if (!var || !var->string || !value || fasticmp(var->string, value))
if (!var || !var->string || !value || !stricmp(var->string, value))
return; // no changes
if (var->flags & CV_NETVAR)
@@ -1657,21 +1652,21 @@ static void CV_SetCVar(consvar_t *var, const char *value, boolean stealth)
UINT8 *p = buf;
if (!(server || (IsPlayerAdmin(consoleplayer))))
{
CONS_Alert(CONS_NOTICE, "Only the server or admin can change: %s %s\n", var->name, var->string);
CONS_Printf(M_GetText("Only the server or admin can change: %s %s\n"), var->name, var->string);
return;
}
if (var == &cv_kartencore && !M_SecretUnlocked(SECRET_ENCORE))
{
CONS_Alert(CONS_NOTICE, "You haven't unlocked Encore Mode yet!\n");
CONS_Printf(M_GetText("You haven't unlocked Encore Mode yet!\n"));
return;
}
if (var == &cv_kartspeed && !M_SecretUnlocked(SECRET_HARDSPEED))
{
if (fasticmp(value, "Hard") || atoi(value) == 2)
if (!stricmp(value, "Hard") || atoi(value) == 2)
{
CONS_Alert(CONS_NOTICE, "You haven't unlocked this yet!\n");
CONS_Printf(M_GetText("You haven't unlocked this yet!\n"));
return;
}
}
@@ -1688,13 +1683,14 @@ static void CV_SetCVar(consvar_t *var, const char *value, boolean stealth)
else
Setvalue(var, value, stealth);
}
else if ((var->flags & CV_NOTINNET) && netgame)
{
CONS_Alert(CONS_NOTICE, "This variable can't be changed while in netgame: %s %s\n", var->name, var->string);
return;
}
else
Setvalue(var, value, stealth);
if ((var->flags & CV_NOTINNET) && netgame)
{
CONS_Printf(M_GetText("This variable can't be changed while in netgame: %s %s\n"), var->name, var->string);
return;
}
else
Setvalue(var, value, stealth);
}
/** Sets a value to a variable without calling its callback function.
@@ -1777,7 +1773,7 @@ void CV_AddValue(consvar_t *var, INT32 increment)
newvalue = var->value - 1;
do
{
if (increment > 0) // Going up!
if(increment > 0) // Going up!
{
if (++newvalue == NUMMAPS)
newvalue = -1;
@@ -1791,7 +1787,7 @@ void CV_AddValue(consvar_t *var, INT32 increment)
if (newvalue == oldvalue)
break; // don't loop forever if there's none of a certain gametype
if (newvalue >= 0 && !mapheaderinfo[newvalue])
if(!mapheaderinfo[newvalue])
continue; // Don't allocate the header. That just makes memory usage skyrocket.
} while (!M_CanShowLevelInList(newvalue, gt));
@@ -1803,7 +1799,7 @@ void CV_AddValue(consvar_t *var, INT32 increment)
}
#define MINVAL 0
#define MAXVAL 1
else if (var->PossibleValue[MINVAL].strvalue && fastcmp(var->PossibleValue[MINVAL].strvalue, "MIN"))
else if (var->PossibleValue[MINVAL].strvalue && !strcmp(var->PossibleValue[MINVAL].strvalue, "MIN"))
{ // SRB2Kart
#ifdef PARANOIA
if (!var->PossibleValue[MAXVAL].strvalue)
@@ -1920,14 +1916,13 @@ void CV_AddValue(consvar_t *var, INT32 increment)
max = (M_SecretUnlocked(SECRET_HARDSPEED) ? 3 : 2);
}
#ifdef PARANOIA
if (currentindice == -1 || max == 0)
I_Error("CV_AddValue: current value %d not found in possible value\n", var->value);
if (currentindice == -1)
I_Error("CV_AddValue: current value %d not found in possible value\n",
var->value);
#endif
if (max > 0)
{
newindice = (currentindice + increment + max) % max;
CV_Set(var, var->PossibleValue[newindice].strvalue);
}
newindice = (currentindice + increment + max) % max;
CV_Set(var, var->PossibleValue[newindice].strvalue);
}
}
else
@@ -1975,12 +1970,12 @@ static boolean CV_FilterJoyAxisVars(consvar_t *v, const char *valstr)
{
if (joyaxis_default[i])
{
if (fasticmp(v->name, "joyaxis_fire"))
if (!stricmp(v->name, "joyaxis_fire"))
{
if (joyaxis_count[i] > 7) return false;
else if (joyaxis_count[i] == 7) return true;
if (fasticmp(valstr, "None")) joyaxis_count[i]++;
if (!stricmp(valstr, "None")) joyaxis_count[i]++;
else joyaxis_default[i] = false;
}
// reset all axis settings to defaults
@@ -2012,37 +2007,37 @@ static boolean CV_FilterJoyAxisVars(consvar_t *v, const char *valstr)
// Block the Xbox DInput default axes and reset to the current defaults
static boolean CV_FilterJoyAxisVars2(consvar_t *v, const char *valstr)
{
if (fasticmp(v->name, "joyaxis_turn") && fasticmp(valstr, "X-Axis"))
if (!stricmp(v->name, "joyaxis_turn") && !stricmp(valstr, "X-Axis"))
return false;
if (fasticmp(v->name, "joyaxis2_turn") && fasticmp(valstr, "X-Axis"))
if (!stricmp(v->name, "joyaxis2_turn") && !stricmp(valstr, "X-Axis"))
return false;
if (fasticmp(v->name, "joyaxis3_turn") && fasticmp(valstr, "X-Axis"))
if (!stricmp(v->name, "joyaxis3_turn") && !stricmp(valstr, "X-Axis"))
return false;
if (fasticmp(v->name, "joyaxis4_turn") && fasticmp(valstr, "X-Axis"))
if (!stricmp(v->name, "joyaxis4_turn") && !stricmp(valstr, "X-Axis"))
return false;
if (fasticmp(v->name, "joyaxis_aim") && fasticmp(valstr, "Y-Axis"))
if (!stricmp(v->name, "joyaxis_aim") && !stricmp(valstr, "Y-Axis"))
return false;
if (fasticmp(v->name, "joyaxis2_aim") && fasticmp(valstr, "Y-Axis"))
if (!stricmp(v->name, "joyaxis2_aim") && !stricmp(valstr, "Y-Axis"))
return false;
if (fasticmp(v->name, "joyaxis3_aim") && fasticmp(valstr, "Y-Axis"))
if (!stricmp(v->name, "joyaxis3_aim") && !stricmp(valstr, "Y-Axis"))
return false;
if (fasticmp(v->name, "joyaxis4_aim") && fasticmp(valstr, "Y-Axis"))
if (!stricmp(v->name, "joyaxis4_aim") && !stricmp(valstr, "Y-Axis"))
return false;
if (fasticmp(v->name, "joyaxis_fire") && fasticmp(valstr, "None"))
if (!stricmp(v->name, "joyaxis_fire") && !stricmp(valstr, "None"))
return false;
if (fasticmp(v->name, "joyaxis2_fire") && fasticmp(valstr, "None"))
if (!stricmp(v->name, "joyaxis2_fire") && !stricmp(valstr, "None"))
return false;
if (fasticmp(v->name, "joyaxis3_fire") && fasticmp(valstr, "None"))
if (!stricmp(v->name, "joyaxis3_fire") && !stricmp(valstr, "None"))
return false;
if (fasticmp(v->name, "joyaxis4_fire") && fasticmp(valstr, "None"))
if (!stricmp(v->name, "joyaxis4_fire") && !stricmp(valstr, "None"))
return false;
if (fasticmp(v->name, "joyaxis_drift") && fasticmp(valstr, "None"))
if (!stricmp(v->name, "joyaxis_drift") && !stricmp(valstr, "None"))
return false;
if (fasticmp(v->name, "joyaxis2_drift") && fasticmp(valstr, "None"))
if (!stricmp(v->name, "joyaxis2_drift") && !stricmp(valstr, "None"))
return false;
if (fasticmp(v->name, "joyaxis3_drift") && fasticmp(valstr, "None"))
if (!stricmp(v->name, "joyaxis3_drift") && !stricmp(valstr, "None"))
return false;
if (fasticmp(v->name, "joyaxis4_drift") && fasticmp(valstr, "None"))
if (!stricmp(v->name, "joyaxis4_drift") && !stricmp(valstr, "None"))
return false;
return true;
@@ -2059,8 +2054,8 @@ static boolean CV_FilterVarByVersion(consvar_t *v, const char *valstr)
if (GETMAJOREXECVERSION(cv_execversion.value) < 8) // 8 = 1.4
{
if (fasticmp(v->name, "masterserver") // Replaces a hack in MasterServer_OnChange for the original SRB2 MS.
|| fasticmp(v->name, "gamma")) // Too easy to accidentially change in prior versions.
if (!stricmp(v->name, "masterserver") // Replaces a hack in MasterServer_OnChange for the original SRB2 MS.
|| !stricmp(v->name, "gamma")) // Too easy to accidentially change in prior versions.
return false;
}
@@ -2143,7 +2138,7 @@ void CV_SaveVariables(FILE *f)
char stringtowrite[MAXTEXTCMD+1];
// Silly hack for Min/Max vars
if (fastcmp(cvar->string, "MAX") || fastcmp(cvar->string, "MIN"))
if (!strcmp(cvar->string, "MAX") || !strcmp(cvar->string, "MIN"))
{
if (cvar->flags & CV_FLOAT)
sprintf(stringtowrite, "%f", FixedToFloat(cvar->value));
+1 -1
View File
@@ -182,7 +182,7 @@ void CV_SaveVariables(FILE *f);
// load/save gamesate (load and save option and for network join in game)
void CV_SaveNetVars(UINT8 **p, boolean isdemorecording);
size_t CV_LoadNetVars(const UINT8 *p);
void CV_LoadNetVars(UINT8 **p);
// reset cheat netvars after cheats is deactivated
void CV_ResetCheatNetVars(void);
+49 -28
View File
@@ -69,9 +69,14 @@ static boolean consoleready; // console prompt is ready
INT32 con_destlines; // vid lines used by console at final position
static INT32 con_curlines; // vid lines currently used by console
INT32 con_clipviewtop; // (useless)
static UINT8 con_hudlines; // number of console heads up message lines
static UINT32 con_hudtime[MAXHUDLINES]; // remaining time of display for hud msg lines
INT32 con_clearlines; // top screen lines to refresh when view reduced
boolean con_hudupdate; // when messages scroll, we need a backgrnd refresh
// console text output
static char *con_line; // console text output current line
static size_t con_cx; // cursor position in current line
@@ -388,6 +393,9 @@ void CON_Init(void)
Lock_state();
//note: CON_Ticker should always execute at least once before D_Display()
con_clipviewtop = -1; // -1 does not clip
con_hudlines = atoi(cons_hudlines.defaultvalue);
Unlock_state();
@@ -471,18 +479,18 @@ static void CON_RecalcSize(void)
switch (cv_constextsize.value)
{
case V_NOSCALEPATCH:
con_scalefactor = 1;
break;
case V_SMALLSCALEPATCH:
con_scalefactor = vid.smalldup;
break;
case V_MEDSCALEPATCH:
con_scalefactor = vid.meddup;
break;
default: // Full scaling
con_scalefactor = vid.dup;
break;
case V_NOSCALEPATCH:
con_scalefactor = 1;
break;
case V_SMALLSCALEPATCH:
con_scalefactor = vid.smalldupx;
break;
case V_MEDSCALEPATCH:
con_scalefactor = vid.meddupx;
break;
default: // Full scaling
con_scalefactor = vid.dupx;
break;
}
con_recalc = false;
@@ -521,7 +529,7 @@ static void CON_RecalcSize(void)
oldcon_width = con_width;
oldnumlines = con_totallines;
oldcon_cy = con_cy;
memcpy(tmp_buffer, con_buffer, CON_BUFFERSIZE);
M_Memcpy(tmp_buffer, con_buffer, CON_BUFFERSIZE);
if (conw < 1)
con_width = (BASEVIDWIDTH>>3) - 2;
@@ -547,7 +555,7 @@ static void CON_RecalcSize(void)
{
if (tmp_buffer[(i%oldnumlines)*oldcon_width])
{
memcpy(string, &tmp_buffer[(i%oldnumlines)*oldcon_width], oldcon_width);
M_Memcpy(string, &tmp_buffer[(i%oldnumlines)*oldcon_width], oldcon_width);
conw = oldcon_width - 1;
while (string[conw] == ' ' && conw)
conw--;
@@ -599,7 +607,7 @@ static void CON_MoveConsole(void)
}
// Not instant - Increment fracmovement fractionally
fracmovement += FixedMul(cons_speed.value*vid.fdup, (cv_uncappedhud.value ? renderdeltatics : FRACUNIT));
fracmovement += FixedMul(cons_speed.value*vid.fdupy, (cv_uncappedhud.value ? renderdeltatics : FRACUNIT));
if (con_curlines < con_destlines) // Move the console downwards
{
@@ -719,8 +727,7 @@ void CON_ToggleOff(void)
con_curlines = 0;
CON_ClearHUD();
con_forcepic = 0;
I_SetTextInput(false);
con_clipviewtop = -1; // remove console clipping of view
Unlock_state();
}
@@ -761,24 +768,28 @@ void CON_Ticker(void)
{
con_destlines = 0;
CON_ClearHUD();
I_SetTextInput(false);
}
else
{
CON_ChangeHeight();
I_SetTextInput(true);
}
}
// clip the view, so that the part under the console is not drawn
con_clipviewtop = -1;
if (cons_backpic.value) // clip only when using an opaque background
{
if (con_curlines > 0)
con_clipviewtop = con_curlines - viewwindowy - 1 - 10;
// NOTE: BIG HACK::SUBTRACT 10, SO THAT WATER DON'T COPY LINES OF THE CONSOLE
// WINDOW!!! (draw some more lines behind the bottom of the console)
if (con_clipviewtop < 0)
con_clipviewtop = -1; // maybe not necessary, provided it's < 0
}
// check if console ready for prompt
if (con_destlines >= minheight)
{
consoleready = true;
}
else
{
consoleready = false;
}
// make overlay messages disappear after a while
for (i = 0; i < con_hudlines; i++)
@@ -1010,7 +1021,7 @@ boolean CON_Responder(event_t *ev)
Lock_state();
// Only add command to history if it differs from previous one
if (!fastcmp(input.buffer, inputlines[(inputline-1) & 31]))
if (strcmp(input.buffer, inputlines[(inputline-1) & 31]))
{
inputline = (inputline+1) & 31;
M_TextInputInit(&input, inputlines[inputline], CON_MAXPROMPTCHARS);
@@ -1079,6 +1090,9 @@ static void CON_Linefeed(void)
con_line = &con_buffer[(con_cy%con_totallines)*con_width];
memset(con_line, ' ', con_width);
// make sure the view borders are refreshed if hud messages scroll
con_hudupdate = true; // see HU_Erase()
}
// Outputs text into the console text buffer
@@ -1258,7 +1272,7 @@ void CONS_Alert(alerttype_t level, const char *fmt, ...)
txt = malloc(8192);
va_start(argptr, fmt);
vsnprintf(txt, 8192, fmt, argptr);
vsprintf(txt, fmt, argptr);
va_end(argptr);
switch (level)
@@ -1294,7 +1308,7 @@ void CONS_Debug(INT32 debugflags, const char *fmt, ...)
txt = malloc(8192);
va_start(argptr, fmt);
vsnprintf(txt, 8192, fmt, argptr);
vsprintf(txt, fmt, argptr);
va_end(argptr);
// Again I am lazy, oh well
@@ -1465,6 +1479,9 @@ static void CON_DrawHudlines(void)
//V_DrawCharacter(x, y, (p[c]&0xff) | cv_constextsize.value | V_NOSCALESTART, !cv_allcaps.value);
y += charheight;
}
// top screen lines that might need clearing when view is reduced
con_clearlines = y; // this is handled by HU_Erase();
}
// draw the console background, text, and prompt if enough place
@@ -1482,6 +1499,10 @@ static void CON_DrawConsole(void)
if (con_curlines <= 0)
return;
//FIXME: refresh borders only when console bg is translucent
con_clearlines = con_curlines; // clear console draw from view borders
con_hudupdate = true; // always refresh while console is on
// draw console background
if (cons_backpic.value || con_forcepic)
{
+5
View File
@@ -30,9 +30,14 @@ extern boolean con_recalc;
extern boolean con_startup;
// top clip value for view render: do not draw part of view hidden by console
extern INT32 con_clipviewtop;
// 0 means console if off, or moving out
extern INT32 con_destlines;
extern INT32 con_clearlines; // lines of top of screen to refresh
extern boolean con_hudupdate; // hud messages have changed, need refresh
extern UINT32 con_scalefactor; // console text scale factor
extern consvar_t cons_backcolor, cons_menuhighlight;
+1 -1
View File
@@ -1,4 +1,4 @@
// SONIC ROBO BLAST 2 KART
// BLANKART
//-----------------------------------------------------------------------------
// Copyright (C) 2024 by Ronald "Eidolon" Kinard
// Copyright (C) 2024 by Kart Krew
+1 -1
View File
@@ -1,4 +1,4 @@
// SONIC ROBO BLAST 2 KART
// BLANKART
//-----------------------------------------------------------------------------
// Copyright (C) 2024 by Ronald "Eidolon" Kinard
// Copyright (C) 2024 by Kart Krew
+1 -1
View File
@@ -1,4 +1,4 @@
// SONIC ROBO BLAST 2 KART
// BLANKART
//-----------------------------------------------------------------------------
// Copyright (C) 2024 by Ronald "Eidolon" Kinard
// Copyright (C) 2024 by Kart Krew
-45
View File
@@ -147,51 +147,6 @@ public:
template <class T>
NotNull(T) -> NotNull<T>;
// does a super safe cast from floating point to interger types
// this prob could be better since i suck at ceepeepee
// but atleast we can just template shit to our desired types
template <typename FloatT, typename IntT>
static inline IntT floattoint(FloatT val)
{
// :chaosleep:
static_assert(std::is_floating_point_v<FloatT>, "Input must be a floating-point type");
static_assert(std::is_integral_v<IntT>, "Output must be a integer type");
if (std::fpclassify(val) == FP_NAN)
return 0; // if stuffs not a number we sure screwed up lmao
// treat inifinity as "int min/max"
if (std::fpclassify(val) == FP_INFINITE)
{
// yes infinity can be signed kek
if (std::signbit(val))
return std::numeric_limits<IntT>::min(); // negative infinity, so return min
else
return std::numeric_limits<IntT>::max();
}
// make sure we fit into our targettype uwu
if (val > static_cast<FloatT>(std::numeric_limits<IntT>::max()))
return std::numeric_limits<IntT>::max();
else if (val < static_cast<FloatT>(std::numeric_limits<IntT>::min()))
return std::numeric_limits<IntT>::min();
return static_cast<IntT>(val);
}
// safe float to fixed
// which handles nan and inf
// pretty much the same stuff as the above, but uh, idk how id use the above with this
template <typename FloatT> // can use both float and doubles yay
static inline int32_t floattofixed(FloatT val)
{
// :chaosleep:
static_assert(std::is_floating_point_v<FloatT>, "Input must be a floating-point type");
// fixed_t is just an int32_t, i dont wanna include doomtype here if it can be avoided
return floattoint<FloatT, int32_t>(val * 65535.);
}
} // namespace srb2
#endif // __SRB2_CXXUTIL_HPP__
+190 -108
View File
@@ -54,9 +54,11 @@
#include "d_main.h"
#include "r_fps.h"
#ifdef CLIENT_LOADINGSCREEN
// cl loading screen
#include "v_video.h"
#include "f_finale.h"
#endif
#ifdef HAVE_DISCORDRPC
#include "discord.h"
@@ -78,14 +80,14 @@
#define MAX_REASONLENGTH 30
#define FORCECLOSE 0x8000
static long long unsigned packetstat[NUMPACKETTYPE+1] = {};
static long long unsigned packetstat[NUMPACKETTYPE+1] = {0};
boolean server = true; // true or false but !server == client
#define client (!server)
boolean nodownload = false;
boolean serverrunning = false;
INT32 serverplayer = 0;
char motd[254] = {}, server_context[8] = {}; // Message of the Day, Unique Context (even without Mumble support)
char motd[254], server_context[8]; // Message of the Day, Unique Context (even without Mumble support)
#define MAP_ICON_REQUEST_FREQUENCY 8
@@ -98,13 +100,14 @@ static int map_icon_request_count; // current count of icon requests sent
static UINT8 *map_icon_data;
static patch_t *map_icon;
plrinfo playerinfo[MAXPLAYERS] = {};
plrinfo playerinfo[MAXPLAYERS];
SINT8 joinnode = 0; // used for CL_VIEWSERVER
boolean player_muted[MAXPLAYERS] = {};
boolean player_muted[MAXPLAYERS] = {0};
// Server specific vars
UINT8 playernode[MAXPLAYERS] = {};
UINT8 playernode[MAXPLAYERS];
// Minimum timeout for sending the savegame
// The actual timeout will be longer depending on the savegame length
@@ -117,15 +120,15 @@ static tic_t savegameresendcooldown[MAXNETNODES]; // How long before we can rese
static tic_t freezetimeout[MAXNETNODES]; // Until when can this node freeze the server before getting a timeout?
UINT16 pingmeasurecount = 1;
UINT32 realpingtable[MAXPLAYERS] = {}; //the base table of ping where an average will be sent to everyone.
UINT32 playerpingtable[MAXPLAYERS] = {}; //table of player latency values.
UINT32 realpingtable[MAXPLAYERS]; //the base table of ping where an average will be sent to everyone.
UINT32 playerpingtable[MAXPLAYERS]; //table of player latency values.
#define GENTLEMANSMOOTHING (TICRATE)
static tic_t reference_lag;
static UINT8 spike_time;
tic_t lowest_lag = 0;
tic_t simulated_lag = 0;
boolean server_lagless = true;
tic_t lowest_lag;
tic_t simulated_lag;
boolean server_lagless;
static void Lagless_OnChange(void)
{
@@ -143,12 +146,12 @@ static CV_PossibleValue_t mindelay_cons_t[] = {{0, "MIN"}, {30, "MAX"}, {0, NULL
consvar_t cv_mindelay = {"mindelay", "0", CV_SAVE, mindelay_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
consvar_t cv_gentlemens = {"gentlemensdelay", "Off", CV_SAVE|CV_CALL|CV_NOINIT, CV_OnOff, Lagless_OnChange, 0, NULL, NULL, 0, 0, NULL}; // this should be a netvar Zzz...
SINT8 nodetoplayer[MAXNETNODES] = {};
SINT8 nodetoplayer2[MAXNETNODES] = {}; // say the numplayer for this node if any (splitscreen)
SINT8 nodetoplayer3[MAXNETNODES] = {}; // say the numplayer for this node if any (splitscreen == 2)
SINT8 nodetoplayer4[MAXNETNODES] = {}; // say the numplayer for this node if any (splitscreen == 3)
UINT8 playerpernode[MAXNETNODES] = {}; // used specialy for splitscreen
boolean nodeingame[MAXNETNODES] = {}; // set false as nodes leave game
SINT8 nodetoplayer[MAXNETNODES];
SINT8 nodetoplayer2[MAXNETNODES]; // say the numplayer for this node if any (splitscreen)
SINT8 nodetoplayer3[MAXNETNODES]; // say the numplayer for this node if any (splitscreen == 2)
SINT8 nodetoplayer4[MAXNETNODES]; // say the numplayer for this node if any (splitscreen == 3)
UINT8 playerpernode[MAXNETNODES]; // used specialy for splitscreen
boolean nodeingame[MAXNETNODES]; // set false as nodes leave game
tic_t servermaxping = 20; // server's max delay, in frames. Defaults to 20
static tic_t nettics[MAXNETNODES]; // what tic the client have received
@@ -195,7 +198,7 @@ boolean is_client_saturn[MAXNETNODES];
static UINT8 localtextcmd[MAXSPLITSCREENPLAYERS][MAXTEXTCMD];
static tic_t neededtic;
SINT8 servernode = 0; // the number of the server node
char connectedservername[MAXSERVERNAME+1] = {};
char connectedservername[MAXSERVERNAME+1];
/// \brief do we accept new players?
/// \todo WORK!
boolean acceptnewnode = true;
@@ -226,7 +229,7 @@ struct textcmdbuf_s
static textcmdbuf_t *textcmdbuf[MAXSPLITSCREENPLAYERS] = {NULL};
static ticcmd_t playercmds[MAXPLAYERS];
ticcmd_t netcmds[BACKUPTICS][MAXPLAYERS] = {};
ticcmd_t netcmds[BACKUPTICS][MAXPLAYERS];
static textcmdtic_t *textcmds[TEXTCMD_HASH_SIZE] = {NULL};
consvar_t cv_showjoinaddress = {"showjoinaddress", "On", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL};
@@ -284,7 +287,7 @@ static inline void *G_ScpyTiccmd(ticcmd_t* dest, void* src, const size_t n)
// Some software don't support largest packet
// (original sersetup, not exactely, but the probability of sending a packet
// of 512 bytes is like 0.1)
UINT16 software_MAXPACKETLENGTH = 0;
UINT16 software_MAXPACKETLENGTH;
/** Guesses the value of a tic from its lowest byte and from maketic
*
@@ -311,9 +314,9 @@ static inline tic_t ExpandTics(INT32 low, tic_t basetic)
// Some extra data function for handle textcmd buffer
// -----------------------------------------------------------------
static void (*listnetxcmd[MAXNETXCMD])(const UINT8 **p, INT32 playernum);
static void (*listnetxcmd[MAXNETXCMD])(UINT8 **p, INT32 playernum);
void RegisterNetXCmd(netxcmd_t id, void (*cmd_f)(const UINT8 **p, INT32 playernum))
void RegisterNetXCmd(netxcmd_t id, void (*cmd_f)(UINT8 **p, INT32 playernum))
{
#ifdef PARANOIA
if (id >= MAXNETXCMD)
@@ -330,14 +333,14 @@ static void WriteNetXCmd(UINT8 *cmd, netxcmd_t id, const void *param, size_t npa
cmd[cmd[0]] = (UINT8)id;
if (param && nparam)
{
memcpy(&cmd[cmd[0]+1], param, nparam);
M_Memcpy(&cmd[cmd[0]+1], param, nparam);
cmd[0] = (UINT8)(cmd[0] + (UINT8)nparam);
}
}
void SendNetXCmdForPlayer(UINT8 playerid, netxcmd_t id, const void *param, size_t nparam)
{
if (textcmdbuf[playerid] != NULL || localtextcmd[playerid][0]+2+nparam > MAXTEXTCMD)
if (localtextcmd[playerid][0]+2+nparam > MAXTEXTCMD)
{
textcmdbuf_t *buf = textcmdbuf[playerid];
@@ -372,13 +375,17 @@ void SendNetXCmdForPlayer(UINT8 playerid, netxcmd_t id, const void *param, size_
{
WriteNetXCmd(buf->cmd, id, param, nparam);
}
return;
}
WriteNetXCmd(localtextcmd[playerid], id, param, nparam);
}
/*UINT8 GetFreeXCmdSize(UINT8 playerid)
{
// -1 for the size and another -1 for the ID.
return (UINT8)(localtextcmd[playerid][0] - 2);
}*/
// Frees all textcmd memory for the specified tic
static void D_FreeTextcmd(tic_t tic)
{
@@ -417,8 +424,7 @@ static UINT8* D_GetExistingTextcmd(tic_t tic, INT32 playernum)
if (textcmdtic)
{
UINT8 *cmd = textcmdtic->playercmds[playernum];
if (cmd)
return cmd;
if (cmd) return cmd;
}
return NULL;
@@ -456,22 +462,22 @@ static void ExtraDataTicker(void)
INT32 i;
for (i = 0; i < MAXPLAYERS; i++)
{
if (playeringame[i] || i == 0)
{
const UINT8 *bufferstart = D_GetExistingTextcmd(gametic, i);
UINT8 *bufferstart = D_GetExistingTextcmd(gametic, i);
if (bufferstart)
{
const UINT8 *curpos = bufferstart;
const UINT8 *bufferend = &curpos[curpos[0]+1];
UINT8 *curpos = bufferstart;
UINT8 *bufferend = &curpos[curpos[0]+1];
curpos++;
while (curpos < bufferend)
{
if (*curpos < MAXNETXCMD && listnetxcmd[*curpos])
{
const UINT8 id = *curpos++;
const UINT8 id = *curpos;
curpos++;
DEBFILE(va("executing x_cmd %s ply %u ", netxcmdnames[id - 1], i));
(listnetxcmd[id])(&curpos, i);
DEBFILE("done\n");
@@ -483,14 +489,12 @@ static void ExtraDataTicker(void)
SendKick(i, KICK_MSG_CON_FAIL);
DEBFILE(va("player %d kicked [gametic=%u] reason as follows:\n", i, gametic));
}
CONS_Alert(CONS_WARNING, M_GetText("Got unknown net command [%s]=%d (max %d)\n"), sizeu1(curpos - bufferstart), *curpos, bufferstart[0]);
break;
}
}
}
}
}
// If you are a client, you can safely forget the net commands for this tic
// If you are the server, you need to remember them until every client has been aknowledged,
@@ -822,7 +826,7 @@ static void resynch_read_player(resynch_pak *rsp)
P_SetThingPosition(players[i].mo);
}
static void resynch_write_ctf(resynchend_pak *rst)
static inline void resynch_write_ctf(resynchend_pak *rst)
{
mobj_t *mflag;
UINT8 i, j;
@@ -862,7 +866,7 @@ static void resynch_write_ctf(resynchend_pak *rst)
}
}
static void resynch_read_ctf(resynchend_pak *p)
static inline void resynch_read_ctf(resynchend_pak *p)
{
UINT8 i;
@@ -1100,6 +1104,10 @@ static void SV_AcknowledgeResynchAck(INT32 node, UINT8 rsg)
static INT16 Consistancy(void);
#ifndef NONET
#define JOININGAME
#endif
typedef enum
{
CL_SEARCHING,
@@ -1109,7 +1117,9 @@ typedef enum
CL_LOADFILES,
CL_SETUPFILES,
CL_WAITJOINRESPONSE,
#ifdef JOININGAME
CL_DOWNLOADSAVEGAME,
#endif
CL_CONNECTED,
CL_ABORTED,
CL_VIEWSERVER,
@@ -1161,6 +1171,8 @@ static void CV_LoadPlayerNames(UINT8 **p)
}
}
#ifdef CLIENT_LOADINGSCREEN
//
// CL_DrawConnectionStatus
//
@@ -1198,6 +1210,7 @@ static inline void CL_DrawConnectionStatus(void)
switch (cl_mode)
{
#ifdef JOININGAME
case CL_DOWNLOADSAVEGAME:
if (filedownload.current != -1)
{
@@ -1223,6 +1236,7 @@ static inline void CL_DrawConnectionStatus(void)
else
cltext = M_GetText("Waiting to download game state...");
break;
#endif
case CL_ASKFULLFILELIST:
case CL_CONFIRMCONNECT:
case CL_LEGACYREQUESTFAILED:
@@ -1495,6 +1509,7 @@ static inline void CL_DrawConnectionStatus(void)
}
}
}
#endif
static boolean CL_AskFileList(INT32 firstfile)
{
@@ -1502,7 +1517,7 @@ static boolean CL_AskFileList(INT32 firstfile)
netbuffer->packettype = PT_TELLFILESNEEDED;
netbuffer->u.filesneedednum = firstfile;
return HSendPacket(servernode, false, 0, sizeof(INT32));
return HSendPacket(servernode, false, 0, sizeof (INT32));
}
/** Sends a special packet to declare how many players in local
@@ -1584,7 +1599,7 @@ static void SV_SendServerInfo(INT32 node, tic_t servertime)
MAXSERVERNAME);
strncpy(netbuffer->u.serverinfo.mapname, G_BuildMapName(gamemap), sizeof(netbuffer->u.serverinfo.mapname)-1);
memcpy(netbuffer->u.serverinfo.mapmd5, mapmd5, sizeof(netbuffer->u.serverinfo.mapmd5));
M_Memcpy(netbuffer->u.serverinfo.mapmd5, mapmd5, sizeof(netbuffer->u.serverinfo.mapmd5));
netbuffer->u.serverinfo.iszone = 0;
@@ -1655,7 +1670,12 @@ static void SV_SendPlayerInfo(INT32 node)
netbuffer->u.playerinfo[i].node = i;
strlcpy(netbuffer->u.playerinfo[i].name, (const char *)&player_names[i], MAXPLAYERNAME+1);
// Can't really change this because net compatibility, but the warning is annoying
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wstringop-truncation"
strncpy(netbuffer->u.playerinfo[i].name, (const char *)&player_names[i], MAXPLAYERNAME+1);
#pragma GCC diagnostic pop
netbuffer->u.playerinfo[i].name[MAXPLAYERNAME] = '\0';
//fetch IP address
//No, don't do that, you fuckface.
@@ -1857,6 +1877,7 @@ static boolean SV_SendServerConfig(INT32 node)
return waspacketsent;
}
#ifdef JOININGAME
#define SAVEGAMESIZE (768*1024)
#ifdef SATURNPAK
@@ -1879,7 +1900,7 @@ static void SV_SendSaveGame(INT32 node, boolean resending)
UINT8 *buffertosend;
// first save it in a malloced buffer
save.buffer = (UINT8 *)Z_Malloc(SAVEGAMESIZE, PU_STATIC, NULL);
save.buffer = (UINT8 *)malloc(SAVEGAMESIZE);
if (!save.buffer)
{
CONS_Alert(CONS_ERROR, M_GetText("No more free memory for savegame\n"));
@@ -1894,7 +1915,7 @@ static void SV_SendSaveGame(INT32 node, boolean resending)
length = save.p - save.buffer;
if (length > SAVEGAMESIZE)
{
Z_Free(save.buffer);
free(save.buffer);
save.p = NULL;
I_Error("Savegame buffer overrun");
}
@@ -1912,7 +1933,8 @@ static void SV_SendSaveGame(INT32 node, boolean resending)
if ((compressedlen = lzf_compress(save.buffer + sizeof(UINT32), length - sizeof(UINT32), compressedsave + sizeof(UINT32), length - sizeof(UINT32) - 1)))
{
// Compressing succeeded; send compressed data
Z_Free(save.buffer);
free(save.buffer);
// State that we're compressed.
buffertosend = compressedsave;
@@ -1953,7 +1975,7 @@ static void SV_SavedGame(void)
sprintf(tmpsave, "%s" PATHSEP TMPSAVENAME, srb2home);
// first save it in a malloced buffer
save.p = save.buffer = (UINT8 *)Z_Malloc(SAVEGAMESIZE, PU_STATIC, NULL);
save.p = save.buffer = (UINT8 *)malloc(SAVEGAMESIZE);
if (!save.p)
{
CONS_Alert(CONS_ERROR, M_GetText("No more free memory for savegame\n"));
@@ -1965,7 +1987,7 @@ static void SV_SavedGame(void)
length = save.p - save.buffer;
if (length > SAVEGAMESIZE)
{
Z_Free(save.buffer);
free(save.buffer);
save.p = NULL;
I_Error("Savegame buffer overrun");
}
@@ -1974,7 +1996,7 @@ static void SV_SavedGame(void)
if (!FIL_WriteFile(tmpsave, save.buffer, length))
CONS_Printf(M_GetText("Didn't save %s for netgame"), tmpsave);
Z_Free(save.buffer);
free(save.buffer);
save.p = NULL;
}
@@ -2089,7 +2111,9 @@ static void CL_ReloadReceivedSavegame(void)
CONS_Printf(M_GetText("Game state reloaded\n"));
}
#endif
#endif
#ifndef NONET
static void SendAskInfo(INT32 node)
{
tic_t asktime;
@@ -2173,7 +2197,7 @@ static void SL_InsertServer(serverinfo_pak* info, SINT8 node)
if (info->subversion != SUBVERSION)
return; // Close, but no cigar.
if (!fastcmp(info->application, SRB2APPLICATION))
if (strcmp(info->application, SRB2APPLICATION))
return;/* that's a different mod */
i = serverlistcount++;
@@ -2218,7 +2242,7 @@ void CL_QueryServerList (msg_server_t *server_list)
// thwart nefarious servers who lie to the MS.
/* lol bruh, that version COMES from the servers */
//if (fastcmp(version, server_list[i].version))
//if (strcmp(version, server_list[i].version) == 0)
{
INT32 node = I_NetMakeNodewPort(server_list[i].ip, server_list[i].port);
if (node == -1)
@@ -2263,6 +2287,7 @@ void CL_TimeoutServerList(void)
}
}
}
#endif // ifndef NONET
static void CL_ConfirmConnect(void)
{
@@ -2293,6 +2318,7 @@ static void CL_ConfirmConnect(void)
static void M_ConfirmConnect(event_t *ev)
{
#ifndef NONET
if (ev->type == ev_keydown)
{
if (ev->data1 == ' ' || ev->data1 == 'y' || ev->data1 == KEY_ENTER || ev->data1 == gamecontrol[0][gc_accelerate][0] || ev->data1 == gamecontrol[0][gc_accelerate][1])
@@ -2307,6 +2333,9 @@ static void M_ConfirmConnect(event_t *ev)
M_ClearMenus(true);
}
}
#else
(void)ev;
#endif
}
void CL_AbortConnection(void)
@@ -2401,25 +2430,29 @@ static boolean CL_FinishedFileList(void)
if (!filedownload.http_failed)
#endif
{
#ifndef NONET
filedownload.completednum = 0;
filedownload.completedsize = 0;
filedownload.totalnum = 0;
filedownload.totalsize = 0;
#endif
for (i = 0; i < fileneedednum; i++)
{
if (fileneeded[i].status == FS_NOTFOUND || fileneeded[i].status == FS_MD5SUMBAD)
{
#ifndef NONET
filedownload.totalnum++;
filedownload.totalsize += fileneeded[i].totalsize;
#endif
}
}
#ifndef NONET
if (filedownload.totalsize>>20 >= 10)
downloadsize = Z_StrDup(va("%uM",filedownload.totalsize>>20));
else
downloadsize = Z_StrDup(va("%uK",filedownload.totalsize>>10));
#endif
if (cv_showdownloadprompt.value)
{
@@ -2473,6 +2506,7 @@ static boolean CL_FinishedFileList(void)
*/
static boolean CL_ServerConnectionSearchTicker(tic_t *asksent)
{
#ifndef NONET
INT32 i;
// serverlist is updated by GetPacket function
@@ -2491,7 +2525,6 @@ static boolean CL_ServerConnectionSearchTicker(tic_t *asksent)
if (i < 0)
return true;
}
joinnode = i;
// Quit here rather than downloading files and being refused later.
@@ -2512,7 +2545,6 @@ static boolean CL_ServerConnectionSearchTicker(tic_t *asksent)
CONS_Printf("We received a http url from the server, however it will not be used as this build lacks curl support (%s)\n", serverlist[i].info.httpsource);
#endif
D_ParseFileneeded(serverlist[i].info.fileneedednum, serverlist[i].info.fileneeded, 0);
if (serverlist[i].info.kartvars & SV_LOTSOFADDONS)
{
cl_mode = CL_ASKFULLFILELIST;
@@ -2537,6 +2569,11 @@ static boolean CL_ServerConnectionSearchTicker(tic_t *asksent)
SendAskInfo(servernode);
*asksent = I_GetTime() + NEWTICRATE;
}
#else
(void)asksent;
// No netgames, so we skip this state.
cl_mode = CL_ASKJOIN;
#endif // ifndef NONET/else
return true;
}
@@ -2556,6 +2593,10 @@ static boolean CL_ServerConnectionTicker(const char *tmpsave, tic_t *oldtic, tic
boolean waitmore;
INT32 i;
#ifdef NONET
(void)tmpsave;
#endif
switch (cl_mode)
{
case CL_SEARCHING:
@@ -2674,12 +2715,12 @@ static boolean CL_ServerConnectionTicker(const char *tmpsave, tic_t *oldtic, tic
), NULL, MM_NOTHING);
return false;
}
#ifdef JOININGAME
// prepare structures to save the file
// WARNING: this can be useless in case of server not in GS_LEVEL
// but since the network layer doesn't provide ordered packets...
CL_PrepareDownloadSaveGame(tmpsave);
#endif
if (I_GetTime() >= *asksent && CL_SendJoin())
{
*asksent = I_GetTime() + NEWTICRATE*3;
@@ -2692,6 +2733,7 @@ static boolean CL_ServerConnectionTicker(const char *tmpsave, tic_t *oldtic, tic
cl_mode = CL_ASKJOIN;
}
break;
#ifdef JOININGAME
case CL_DOWNLOADSAVEGAME:
// At this state, the first (and only) needed file is the gamestate
if (fileneeded[0].status == FS_FOUND)
@@ -2703,6 +2745,7 @@ static boolean CL_ServerConnectionTicker(const char *tmpsave, tic_t *oldtic, tic
} // don't break case continue to CL_CONNECTED
else
break;
#endif
case CL_CONNECTED:
case CL_CONFIRMCONNECT: //logic is handled by M_ConfirmConnect
default:
@@ -2765,6 +2808,7 @@ static boolean CL_ServerConnectionTicker(const char *tmpsave, tic_t *oldtic, tic
}
*oldtic = I_GetTime();
#ifdef CLIENT_LOADINGSCREEN
if (client && cl_mode != CL_CONNECTED && cl_mode != CL_ABORTED)
{
F_TitleScreenTicker(true);
@@ -2781,6 +2825,10 @@ static boolean CL_ServerConnectionTicker(const char *tmpsave, tic_t *oldtic, tic
if (moviemode)
M_SaveFrame();
}
#else
CON_Drawer();
I_UpdateNoVsync();
#endif
}
else
{
@@ -2800,17 +2848,26 @@ static void CL_ConnectToServer(void)
{
INT32 pnumnodes, nodewaited = doomcom->numnodes, i;
tic_t oldtic;
#ifndef NONET
tic_t asksent;
#endif
#ifdef JOININGAME
char tmpsave[264];
sprintf(tmpsave, "%s" PATHSEP TMPSAVENAME, srb2home);
#endif
#ifdef CLIENT_LOADINGSCREEN
filedownload.current = -1;
#endif
cl_mode = CL_SEARCHING;
#ifdef JOININGAME
// Don't get a corrupt savegame error because tmpsave already exists
if (FIL_FileExists(tmpsave) && unlink(tmpsave) == -1)
I_Error("Can't delete %s\n", tmpsave);
#endif
if (netgame)
{
@@ -2832,6 +2889,7 @@ static void CL_ConnectToServer(void)
ClearAdminPlayers();
pnumnodes = 1;
oldtic = 0;
#ifndef NONET
asksent = 0;
firstconnectattempttime = I_GetTime();
@@ -2864,11 +2922,16 @@ static void CL_ConnectToServer(void)
map_icon_read = 0;
map_icon_missing = 0xffffffff;
map_icon_last_request = I_GetTime();
#endif
do
{
// If the connection was aborted for some reason, leave
#ifndef NONET
if (!CL_ServerConnectionTicker(tmpsave, &oldtic, &asksent))
#else
if (!CL_ServerConnectionTicker((char*)NULL, &oldtic, (tic_t *)NULL))
#endif
{
if (P_PartialAddGetStage() >= 0)
P_MultiSetupWadFiles(true); // in case any partial adds were done
@@ -2885,14 +2948,16 @@ static void CL_ConnectToServer(void)
}
while (!(cl_mode == CL_CONNECTED && (client || (server && nodewaited <= pnumnodes))));
#ifndef NONET
if (netgame)
F_StartWaitingPlayers();
#endif
DEBFILE(va("Synchronisation Finished\n"));
displayplayers[0] = consoleplayer;
}
#ifndef NONET
static void Command_ShowBan(void) //Print out ban list
{
size_t i;
@@ -3214,7 +3279,7 @@ static void Command_connect(void)
server = false;
if (fasticmp(COM_Argv(1), "self"))
if (!stricmp(COM_Argv(1), "self"))
{
servernode = 0;
server = true;
@@ -3224,7 +3289,7 @@ static void Command_connect(void)
else
{
// used in menu to connect to a server in the list
if (netgame && fasticmp(COM_Argv(1), "node"))
if (netgame && !stricmp(COM_Argv(1), "node"))
{
servernode = (SINT8)atoi(COM_Argv(2));
}
@@ -3239,7 +3304,7 @@ static void Command_connect(void)
netgame = true;
multiplayer = true;
if (fasticmp(COM_Argv(1), "any"))
if (!stricmp(COM_Argv(1), "any"))
servernode = BROADCASTADDR;
else if (I_NetMakeNodewPort && COM_Argc() >= 3)
servernode = I_NetMakeNodewPort(COM_Argv(1), COM_Argv(2));
@@ -3263,7 +3328,6 @@ static void Command_connect(void)
splitscreen = cv_splitplayers.value-1;
SplitScreen_OnChange();
}
botingame = false;
botskin = 0;
CL_ConnectToServer();
@@ -3279,6 +3343,8 @@ static void Command_Packetstat(void)
}
}
#endif
static void ResetNode(INT32 node);
//
@@ -3410,8 +3476,10 @@ void CL_Reset(void)
memset(fileneeded, 0, sizeof(fileneeded));
memset(packetstat, 0, sizeof(packetstat));
#ifndef NONET
filedownload.totalnum = 0;
filedownload.totalsize = 0;
#endif
firstconnectattempttime = 0;
serverisfull = false;
connectiontimeout = (tic_t)cv_nettimeout.value; //reset this temporary hack
@@ -3429,6 +3497,7 @@ void CL_Reset(void)
// D_StartTitle should get done now, but the calling function will handle it
}
#ifndef NONET
static void Command_GetPlayerNum(void)
{
INT32 i;
@@ -3755,8 +3824,9 @@ static void Command_Kick(void)
else
CONS_Printf(M_GetText("Only the server or a remote admin can use this.\n"));
}
#endif
static void Got_KickCmd(const UINT8 **p, INT32 playernum)
static void Got_KickCmd(UINT8 **p, INT32 playernum)
{
INT32 pnum, msg;
char buf[3 + MAX_REASONLENGTH];
@@ -4112,6 +4182,10 @@ consvar_t cv_allownewplayer = {"allowjoin", "On", CV_SAVE|CV_CALL, CV_OnOff, Joi
consvar_t cv_allownewsaturnplayer = {"allowsaturnjoin", "On", CV_HIDEN, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL};
#endif
#ifdef VANILLAJOINNEXTROUND
consvar_t cv_joinnextround = {"joinnextround", "Off", CV_SAVE|CV_NETVAR, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL}; /// \todo not done
#endif
static CV_PossibleValue_t maxplayers_cons_t[] = {{2, "MIN"}, {MAXPLAYERS, "MAX"}, {0, NULL}};
consvar_t cv_maxplayers = {"maxplayers", "8", CV_SAVE|CV_CALL, maxplayers_cons_t, Joinable_OnChange, 0, NULL, NULL, 0, 0, NULL};
@@ -4146,8 +4220,8 @@ consvar_t cv_connectawaittime = {"connectawaittime", "5", CV_SAVE, connectawaitt
consvar_t cv_serverinfoscreen = {"serverinfoscreen", "On", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL};
static void Got_AddPlayer(const UINT8 **p, INT32 playernum);
static void Got_RemovePlayer(const UINT8 **p, INT32 playernum);
static void Got_AddPlayer(UINT8 **p, INT32 playernum);
static void Got_RemovePlayer(UINT8 **p, INT32 playernum);
static void Joinable_OnChange(void)
{
@@ -4156,10 +4230,7 @@ static void Joinable_OnChange(void)
UINT8 maxplayer;
if (!server)
{
CONS_Alert(CONS_NOTICE, ("Only the server can change: %s %s\n"), cv_allownewplayer.name, cv_allownewplayer.string);
return;
}
#ifdef SATURNJOIN
// disabling joins should also disable saturn joins unless its called with CV_StealthSet and vice versa to make life a bit easier
@@ -4181,6 +4252,7 @@ void D_ClientServerInit(void)
DEBFILE(va("- - -== SRB2Kart v%d.%d "VERSIONSTRING" debugfile ==- - -\n",
VERSION, SUBVERSION));
#ifndef NONET
COM_AddCommand("getplayernum", Command_GetPlayerNum);
COM_AddCommand("kick", Command_Kick);
COM_AddCommand("ban", Command_Ban);
@@ -4206,13 +4278,17 @@ void D_ClientServerInit(void)
#ifdef _DEBUG
COM_AddCommand("numnodes", Command_Numnodes);
#endif
#endif
RegisterNetXCmd(XD_KICK, Got_KickCmd);
RegisterNetXCmd(XD_ADDPLAYER, Got_AddPlayer);
RegisterNetXCmd(XD_REMOVEPLAYER, Got_RemovePlayer);
#ifndef NONET
#ifdef DUMPCONSISTENCY
CV_RegisterVar(&cv_dumpconsistency);
#endif
D_LoadBan(false);
#endif
gametic = 0;
localgametic = 0;
@@ -4399,7 +4475,7 @@ static inline void SV_AddNode(INT32 node)
}
// Xcmd XD_ADDPLAYER
static void Got_AddPlayer(const UINT8 **p, INT32 playernum)
static void Got_AddPlayer(UINT8 **p, INT32 playernum)
{
INT16 node, newplayernum;
UINT8 splitscreenplayer = 0;
@@ -4486,7 +4562,7 @@ static void Got_AddPlayer(const UINT8 **p, INT32 playernum)
}
// Xcmd XD_REMOVEPLAYER
static void Got_RemovePlayer(const UINT8 **p, INT32 playernum)
static void Got_RemovePlayer(UINT8 **p, INT32 playernum)
{
SINT8 pnum, reason;
@@ -4647,26 +4723,13 @@ void SV_StopServer(void)
if (gamestate == GS_INTERMISSION)
Y_EndIntermission();
else if (gamestate == GS_VOTING)
if (gamestate == GS_VOTING)
Y_EndVote();
G_SetGamestate(GS_NULL);
wipegamestate = GS_NULL;
gamestate = wipegamestate = GS_NULL;
for (i = 0; i < MAXSPLITSCREENPLAYERS; i++)
{
localtextcmd[i][0] = 0;
while (textcmdbuf[i] != NULL)
{
textcmdbuf_t *buf = textcmdbuf[i];
textcmdbuf[i] = textcmdbuf[i]->next;
Z_Free(buf);
}
textcmdbuf[i] = NULL;
}
for (i = firstticstosend; i < firstticstosend + BACKUPTICS; i++)
D_Clearticcmd(i);
@@ -4820,17 +4883,18 @@ static void HandleConnect(SINT8 node)
}
else
{
#ifndef NONET
boolean newnode = false;
#endif
// client authorised to join
nodewaiting[node] = (UINT8)(netbuffer->u.clientcfg.localplayers - playerpernode[node]);
if (!nodeingame[node])
{
gamestate_t backupstate = gamestate;
#ifndef NONET
newnode = true;
#endif
SV_AddNode(node);
/// \note Wait what???
@@ -4839,6 +4903,10 @@ static void HandleConnect(SINT8 node)
// you get a free second before desynch checks. use it wisely.
SV_InitResynchVars(node);
#ifdef VANILLAJOINNEXTROUND
if (cv_joinnextround.value && gameaction == ga_nothing)
G_SetGamestate(GS_WAITINGPLAYERS);
#endif
if (!SV_SendServerConfig(node))
{
G_SetGamestate(backupstate);
@@ -4856,6 +4924,7 @@ static void HandleConnect(SINT8 node)
DEBFILE("new node joined\n");
}
#ifdef JOININGAME
if (nodewaiting[node])
{
if (node && newnode)
@@ -4866,6 +4935,12 @@ static void HandleConnect(SINT8 node)
SV_AddWaitingPlayers();
}
#else
#ifndef NONET
// I guess we have no use for this if we aren't doing mid-level joins?
(void)newnode;
#endif
#endif
}
}
@@ -4897,6 +4972,7 @@ static void HandleTimeout(SINT8 node)
M_StartMessage(M_GetText("Server Timeout\n\nPress Esc\n"), NULL, MM_NOTHING);
}
#ifndef NONET
/** Called when a PT_SERVERINFO packet is received
*
* \param node The packet sender
@@ -5205,8 +5281,11 @@ static void PT_ServerCFG(SINT8 node)
playernode[(UINT8)serverplayer] = servernode;
if (netgame)
#ifdef JOININGAME
CONS_Printf(M_GetText("Join accepted, waiting for complete game state...\n"));
#else
CONS_Printf(M_GetText("Join accepted, waiting for next level change...\n"));
#endif
DEBFILE(va("Server accept join gametic=%u mynode=%d\n", gametic, mynode));
#ifdef SATURNPAK
@@ -5228,14 +5307,17 @@ static void PT_ServerCFG(SINT8 node)
scp = netbuffer->u.servercfg.varlengthinputs;
CV_LoadPlayerNames(&scp);
scp += CV_LoadNetVars(scp);
CV_LoadNetVars(&scp);
#ifdef JOININGAME
/// \note Wait. What if a Lua script uses some global custom variables synched with the NetVars hook?
/// Shouldn't them be downloaded even at intermission time?
/// Also, according to HandleConnect, the server will send the savegame even during intermission...
/// Sryder 2018-07-05: If we don't want to send the player config another way we need to send the gamestate
/// At almost any gamestate there could be joiners... So just always send gamestate?
cl_mode = ((server) ? CL_CONNECTED : CL_DOWNLOADSAVEGAME);
#else
cl_mode = CL_CONNECTED;
#endif
}
static void PT_FileFragmentFromAwayNode(SINT8 node)
@@ -5263,6 +5345,8 @@ static void PT_RequestFile(SINT8 node)
Net_CloseConnection(node); // nope
}
#endif
#ifdef SATURNPAK
static void PT_WillResendGamestate(void)
{
@@ -5400,8 +5484,11 @@ static void PT_ClientCmd(INT32 netconsole, SINT8 node)
{
tic_t realend, realstart;
if (client)
return;
// Ignore tics from those not synched
if (client || resynch_inprogress[node])
if (resynch_inprogress[node])
return;
doomdata_t *netbuffer = DOOMCOM_DATA(doomcom);
@@ -5557,8 +5644,7 @@ static void PT_ClientCmd(INT32 netconsole, SINT8 node)
--resynch_score[node];
#else
// Check player consistancy during the level
if (gamestate == GS_LEVEL
&& (realstart <= gametic && realstart + BACKUPTICS - 1 > gametic)
if (realstart <= gametic && realstart > gametic - BACKUPTICS+1 && gamestate == GS_LEVEL
&& consistancy[realstart%BACKUPTICS] != SHORT(netbuffer->u.clientpak.consistancy))
{
SV_RequireResynch(node);
@@ -5566,13 +5652,10 @@ static void PT_ClientCmd(INT32 netconsole, SINT8 node)
if (cv_resynchattempts.value && resynch_score[node] <= (unsigned)cv_resynchattempts.value*250)
{
if (cv_blamecfail.value)
{
CONS_Printf(M_GetText("Synch failure for player %d (%s); expected %hd, got %hd\n"),
netconsole+1, player_names[netconsole],
consistancy[realstart%BACKUPTICS],
SHORT(netbuffer->u.clientpak.consistancy));
}
DEBFILE(va("Restoring player %d (synch failure) [%update] %d!=%d\n",
netconsole, realstart, consistancy[realstart%BACKUPTICS],
SHORT(netbuffer->u.clientpak.consistancy)));
@@ -5688,7 +5771,7 @@ static void PT_TextCmd(INT32 netconsole, SINT8 node)
DEBFILE(va("textcmd put in tic %u at position %d (player %d) ftts %u mk %u\n",
tic, textcmd[0]+1, netconsole, firstticstosend, maketic));
memcpy(&textcmd[textcmd[0]+1], netbuffer->u.textcmd+1, netbuffer->u.textcmd[0]);
M_Memcpy(&textcmd[textcmd[0]+1], netbuffer->u.textcmd+1, netbuffer->u.textcmd[0]);
textcmd[0] += (UINT8)netbuffer->u.textcmd[0];
}
}
@@ -5795,7 +5878,7 @@ static void PT_ServerTics(SINT8 node)
}
if (i >= gametic) // Don't copy old net commands
memcpy(D_GetTextcmd(i, playernum), txtpak, txtsize);
M_Memcpy(D_GetTextcmd(i, playernum), txtpak, txtsize);
txtpak += txtsize;
}
}
@@ -5969,17 +6052,16 @@ static void GetPackets(void)
{
node = (SINT8)doomcom->remotenode;
if (server && netbuffer->packettype == PT_CLIENTJOIN)
if (netbuffer->packettype == PT_CLIENTJOIN && server)
{
if (!levelloading) // Otherwise just ignore
{
HandleConnect(node);
}
continue;
}
if (client && node == servernode && cl_mode != CL_SEARCHING)
if (node == servernode && client && cl_mode != CL_SEARCHING)
{
if (netbuffer->packettype == PT_SERVERSHUTDOWN)
{
@@ -5993,11 +6075,13 @@ static void GetPackets(void)
}
}
#ifndef NONET
if (netbuffer->packettype == PT_SERVERINFO)
{
HandleServerInfo(node);
continue;
}
#endif
/*if (netbuffer->packettype == PT_PLAYERINFO)
continue; // We do nothing with PLAYERINFO, that's for the MS browser. Not quite true anymore :p*/
@@ -6038,8 +6122,7 @@ static INT16 Consistancy(void)
{
if (!playeringame[i])
ret ^= 0xCCCC;
else if (!players[i].mo || gamestate != GS_LEVEL)
;
else if (!players[i].mo || gamestate != GS_LEVEL);
else
{
ret += players[i].mo->x;
@@ -6048,7 +6131,6 @@ static INT16 Consistancy(void)
ret *= i+1;
}
}
// I give up
// Coop desynching enemies is painful
if (gamestate == GS_LEVEL)
@@ -6333,7 +6415,7 @@ static void CL_SendClientCmd(void)
break;
}
memcpy(netbuffer->u.textcmd, localtextcmd[i], localtextcmd[i][0]+1);
M_Memcpy(netbuffer->u.textcmd, localtextcmd[i], localtextcmd[i][0]+1);
// All extra data have been sent
if (HSendPacket(servernode, true, 0, localtextcmd[i][0]+1)) // Send can fail...
@@ -6343,7 +6425,7 @@ static void CL_SendClientCmd(void)
if (textcmdbuf[i] != NULL)
{
textcmdbuf_t *buf = textcmdbuf[i];
memcpy(localtextcmd[i], textcmdbuf[i]->cmd, textcmdbuf[i]->cmd[0]+1);
M_Memcpy(localtextcmd[i], textcmdbuf[i]->cmd, textcmdbuf[i]->cmd[0]+1);
textcmdbuf[i] = textcmdbuf[i]->next;
Z_Free(buf);
}
@@ -6456,7 +6538,7 @@ static void SV_SendTics(void)
{
(*ntextcmd)++;
WRITEUINT8(bufpos, j);
memcpy(bufpos, textcmd, size + 1);
M_Memcpy(bufpos, textcmd, size + 1);
bufpos += size + 1;
}
}
@@ -6889,7 +6971,7 @@ void NetKeepAlive(void)
UpdatePingTable();
// Sryder: What is FILESTAMP??? << lmao
// Sryder: What is FILESTAMP??? << lmao
GetPackets();
@@ -7159,7 +7241,7 @@ void CL_ClearRewinds(void)
while ((head = rewindhead))
{
rewindhead = rewindhead->next;
Z_Free(head);
free(head);
}
}
@@ -7171,7 +7253,7 @@ rewind_t *CL_SaveRewindPoint(size_t demopos)
if (rewindhead && rewindhead->leveltime + REWIND_POINT_INTERVAL > leveltime)
return NULL;
rewind = (rewind_t *)Z_Malloc(sizeof(rewind_t), PU_STATIC, NULL);
rewind = (rewind_t *)malloc(sizeof (rewind_t));
if (!rewind)
return NULL;
@@ -7194,7 +7276,7 @@ rewind_t *CL_RewindToTime(tic_t time)
while (rewindhead && rewindhead->leveltime > time)
{
rewind = rewindhead->next;
Z_Free(rewindhead);
free(rewindhead);
rewindhead = rewind;
}
+29 -3
View File
@@ -133,6 +133,10 @@ void Command_Droprate(void);
void Command_Numnodes(void);
#endif
#if defined(_MSC_VER)
#pragma pack(1)
#endif
// Client to server packet
typedef struct
{
@@ -172,6 +176,10 @@ typedef struct
ticcmd_t cmd, cmd2, cmd3, cmd4;
} ATTRPACK client4cmd_pak;
#ifdef _MSC_VER
#pragma warning(disable : 4200)
#endif
// Server to client packet
// this packet is too large
typedef struct
@@ -364,6 +372,10 @@ typedef struct {
UINT8 data[0]; // Size is variable using hardware_MAXPACKETLENGTH
} ATTRPACK filetx_pak;
#ifdef _MSC_VER
#pragma warning(default : 4200)
#endif
#define MAXAPPLICATION 16
typedef struct
@@ -507,6 +519,10 @@ typedef struct
} u; // This is needed to pack diff packet types data together
} ATTRPACK doomdata_t;
#if defined(_MSC_VER)
#pragma pack()
#endif
#define MAXSERVERLIST (MAXNETNODES-1)
typedef struct
{
@@ -583,6 +599,9 @@ extern tic_t lowest_lag;
extern consvar_t cv_mindelay, cv_gentlemens;
extern consvar_t
#ifdef VANILLAJOINNEXTROUND
cv_joinnextround,
#endif
cv_netticbuffer, cv_allownewplayer,
#ifdef SATURNJOIN
cv_allownewsaturnplayer,
@@ -604,7 +623,7 @@ extern consvar_t cv_serverinfoscreen;
void D_ClientServerInit(void);
// Initialise the other field
void RegisterNetXCmd(netxcmd_t id, void (*cmd_f)(const UINT8 **p, INT32 playernum));
void RegisterNetXCmd(netxcmd_t id, void (*cmd_f)(UINT8 **p, INT32 playernum));
void SendNetXCmdForPlayer(UINT8 playerid, netxcmd_t id, const void *param, size_t nparam);
#define SendNetXCmd(id, param, nparam) SendNetXCmdForPlayer(0, id, param, nparam) // Shortcut for P1
void SendKick(UINT8 playernum, UINT8 msg);
@@ -639,9 +658,16 @@ void D_QuitNetGame(void);
//? How many ticks to run?
boolean TryRunTics(tic_t realtic);
// extra data for lmps
// these functions scare me. they contain magic.
/*boolean AddLmpExtradata(UINT8 **demo_p, INT32 playernum);
void ReadLmpExtraData(UINT8 **demo_pointer, INT32 playernum);*/
#ifndef NONET
// translate a playername in a player number return -1 if not found and
// print a error message in the console
SINT8 nametonum(const char *name);
#endif
extern char motd[254], server_context[8];
extern UINT8 playernode[MAXPLAYERS];
@@ -653,6 +679,7 @@ INT32 D_NumPlayers(void);
void D_ResetTiccmds(void);
tic_t GetLag(INT32 node);
//UINT8 GetFreeXCmdSize(UINT8 playerid);
extern UINT8 hu_resynching;
#ifdef SATURNPAK
@@ -660,8 +687,7 @@ extern UINT8 hu_redownloadinggamestate;
#endif
extern boolean hu_stopped; // kart, true when the game is stopped for players due to a disconnecting or connecting player
typedef struct rewind_s
{
typedef struct rewind_s {
UINT8 savebuffer[(768*1024)];
tic_t leveltime;
size_t demopos;
+266 -224
View File
@@ -97,15 +97,15 @@
UINT8 window_notinfocus = false;
static char *startupiwadfiles[MAX_WADFILES];
static size_t startupiwadcount = 0;
static char *startuppwads[MAX_WADFILES];
static size_t startuppwadcount = 0;
// autoloading
static char *autoloadwadfiles[MAX_WADFILES];
static char *autoloadwadfilespost[MAX_WADFILES];
static size_t autoloadcount = 0;
static size_t postloadcount = 0;
boolean autoloading;
boolean autoloaded;
boolean postautoloaded = false;
boolean wasautoloaded = false;
//
boolean devparm = false; // started game with -devparm
@@ -113,9 +113,7 @@ boolean devparm = false; // started game with -devparm
boolean singletics = false; // timedemo
boolean lastdraw = false;
#ifdef MOTIONBLUR
INT32 postimgparam[MAXSPLITSCREENPLAYERS];
#endif
// These variables are only true if
// whether the respective sound system is disabled
@@ -142,8 +140,8 @@ static char addonsdir[MAX_WADPATH];
// Events can be discarded if no responder claims them
// referenced from i_system.c for I_GetKey()
event_t events[MAXEVENTS] = {};
INT32 eventhead = 0, eventtail = 0;
event_t events[MAXEVENTS];
INT32 eventhead, eventtail;
boolean dedicated = false;
@@ -161,17 +159,68 @@ void D_PostEvent(const event_t *ev)
// modifier keys
// Now handled in I_OsPolling
UINT8 shiftdown = 0; // 0x1 left, 0x2 right
UINT8 ctrldown = 0; // 0x1 left, 0x2 right
UINT8 altdown = 0; // 0x1 left, 0x2 right
boolean capslock = 0; // gee i wonder what this does.
UINT8 shiftdown = 0; // 0x1 left, 0x2 right
UINT8 ctrldown = 0; // 0x1 left, 0x2 right
UINT8 altdown = 0; // 0x1 left, 0x2 right
boolean capslock = 0; // gee i wonder what this does.
static UINT16 curcolor[MAXSPLITSCREENPLAYERS] = {};
static void D_PadMenuScrollInput(UINT8 input)
{
event_t dpadev;
memset(&dpadev, 0, sizeof(event_t));
dpadev.type = ev_keydown;
switch (input)
{
case DPAD_UP:
dpadev.data1 = KEY_UPARROW;
break;
case DPAD_DOWN:
dpadev.data1 = KEY_DOWNARROW;
break;
case DPAD_LEFT:
dpadev.data1 = KEY_LEFTARROW;
break;
case DPAD_RIGHT:
dpadev.data1 = KEY_RIGHTARROW;
break;
}
D_PostEvent(&dpadev); // put into eventlist
}
#define SCROLLDELAY 19
// Check if any dpad button is held
// and pass it to the eventlist
static void D_GamePadMenuScrollTicker(void)
{
UINT8 i;
static UINT8 menuInputDelayTimer = 0;
for (i = 0; i < MAXSPLITSCREENPLAYERS; i++)
{
if (dpadscrollstate[i])
{
if (menuInputDelayTimer < SCROLLDELAY)
menuInputDelayTimer++;
else if (menuInputDelayTimer == SCROLLDELAY)
D_PadMenuScrollInput(i);
return;
}
}
menuInputDelayTimer = 0;
}
#undef SCROLLDELAY
static UINT16 curcolor[MAXSPLITSCREENPLAYERS] = {0};
static void D_DeviceLEDTick(void)
{
UINT8 i;
static UINT16 color[MAXSPLITSCREENPLAYERS] = {};
static UINT16 color[MAXSPLITSCREENPLAYERS] = {0};
if (numcontrollers == 0)
{
@@ -298,69 +347,13 @@ static void D_Renderview(void)
}
}
for (i = 0; i <= splitscreen; i++)
{
if (!P_MobjWasRemoved(players[displayplayers[i]].mo) || players[displayplayers[i]].playerstate == PST_DEAD)
{
viewssnum = i;
switch (i)
{
case 1:
if (splitscreen > 1)
{
viewwindowx = viewwidth;
viewwindowy = 0;
}
else
{
viewwindowx = 0;
viewwindowy = viewheight;
}
break;
case 2:
viewwindowx = 0;
viewwindowy = viewheight;
break;
case 3:
viewwindowx = viewwidth;
viewwindowy = viewheight;
break;
default: // Initialize for P1
viewwindowy = viewwindowx = 0;
objectsdrawn = 0;
break;
}
#ifdef HWRENDER
if (rendermode == render_opengl)
{
HWR_RenderPlayerView();
}
else if (rendermode == render_soft)
#endif
R_RenderPlayerView(&players[displayplayers[i]]);
}
if (rendermode == render_soft)
{
if (i == 0)
R_ApplyViewMorph();
#ifdef MOTIONBLUR
V_DoPostProcessor(i, postimgparam[i]);
#else
V_DoPostProcessor(i, 0);
#endif
}
}
// Draw over the fourth screen so you don't have to stare at a HOM :V
if (splitscreen == 2)
{
// V_DrawPatchFill, but for the fourth screen only
patch_t *pat = W_CachePatchName("SRB2BACK", PU_PATCH);
INT32 x, y, pw = SHORT(pat->width) * vid.dup, ph = SHORT(pat->height) * vid.dup;
patch_t *pat = W_CachePatchName("SRB2BACK", PU_CACHE);
INT32 dupz = (vid.dupx < vid.dupy ? vid.dupx : vid.dupy);
INT32 x, y, pw = SHORT(pat->width) * dupz, ph = SHORT(pat->height) * dupz;
for (x = vid.width>>1; x < vid.width; x += pw)
{
@@ -369,6 +362,65 @@ static void D_Renderview(void)
}
}
for (i = 0; i <= splitscreen; i++)
{
const boolean issplitscreen = (i > 0);
if (!P_MobjWasRemoved(players[displayplayers[i]].mo) || players[displayplayers[i]].playerstate == PST_DEAD)
{
viewssnum = i;
if (!issplitscreen) // Initialize for P1
{
viewwindowy = viewwindowx = 0;
objectsdrawn = 0;
}
#ifdef HWRENDER
if (rendermode == render_opengl)
{
HWR_RenderPlayerView();
R_RestoreLevelInterpolators();
continue;
}
#endif
if (issplitscreen) // Splitscreen-specific
{
switch (i)
{
case 1:
if (splitscreen > 1)
{
viewwindowx = viewwidth;
viewwindowy = 0;
}
else
{
viewwindowx = 0;
viewwindowy = viewheight;
}
break;
case 2:
viewwindowx = 0;
viewwindowy = viewheight;
break;
case 3:
viewwindowx = viewwidth;
viewwindowy = viewheight;
default:
break;
}
}
R_RenderPlayerView(&players[displayplayers[i]]);
}
if (!issplitscreen)
R_ApplyViewMorph();
V_DoPostProcessor(i, postimgparam[i]);
}
R_RestoreLevelInterpolators();
}
@@ -471,16 +523,19 @@ static boolean D_Display(void)
case GS_LEVEL:
if (!gametic)
break;
HU_Erase();
AM_Drawer();
break;
case GS_INTERMISSION:
Y_IntermissionDrawer();
HU_Erase();
HU_Drawer();
break;
case GS_VOTING:
Y_VoteDrawer();
HU_Erase();
HU_Drawer();
break;
@@ -495,6 +550,7 @@ static boolean D_Display(void)
case GS_CUTSCENE:
F_CutsceneDrawer();
HU_Erase();
HU_Drawer();
break;
@@ -504,6 +560,7 @@ static boolean D_Display(void)
case GS_EVALUATION:
F_GameEvaluationDrawer();
HU_Erase();
HU_Drawer();
break;
@@ -513,6 +570,7 @@ static boolean D_Display(void)
case GS_CREDITS:
F_CreditDrawer();
HU_Erase();
HU_Drawer();
break;
@@ -529,6 +587,7 @@ static boolean D_Display(void)
{
// I don't think HOM from nothing drawing is independent...
F_WaitingPlayersDrawer();
HU_Erase();
HU_Drawer();
}
case GS_TIMEATTACK:
@@ -551,7 +610,7 @@ static boolean D_Display(void)
{
if (rendermode == render_soft)
{
VID_BlitLinearScreen(vid.screens[0], vid.screens[1], vid.width, vid.height, vid.width, vid.width);
VID_BlitLinearScreen(vid.screens[0], vid.screens[1], vid.width, vid.height, vid.width, vid.rowbytes);
}
lastdraw = false;
@@ -668,7 +727,7 @@ static boolean D_Display(void)
// D_SRB2Loop
// =========================================================================
tic_t rendergametic = 0;
tic_t rendergametic;
void D_SRB2Loop(void)
{
@@ -715,8 +774,8 @@ void D_SRB2Loop(void)
// capbudget is the minimum precise_t duration of a single loop iteration
precise_t capbudget;
precise_t enterprecise = I_GetPreciseTime();
precise_t finishprecise = enterprecise;
memset(&g_dc, 0, sizeof(g_dc));
Z_Frame_Reset();
// Casting the return value of a function is bad practice (apparently)
@@ -793,6 +852,11 @@ void D_SRB2Loop(void)
if (!dedicated)
{
if (menuactive)
{
D_GamePadMenuScrollTicker();
}
D_DeviceLEDTick();
}
}
@@ -827,6 +891,12 @@ void D_SRB2Loop(void)
// always update console and hud
// otherwise it may take minutes to open it
CON_Drawer();
if (gamestate == GS_LEVEL)
{
ST_Drawer();
HU_Drawer();
}
}
}
@@ -848,7 +918,7 @@ void D_SRB2Loop(void)
}
#endif
// Fully completed frame made.
precise_t finishprecise = I_GetPreciseTime();
finishprecise = I_GetPreciseTime();
// Use the time before sleep for frameskip calculations:
// post-sleep time is literally being intentionally wasted
@@ -863,16 +933,9 @@ void D_SRB2Loop(void)
//
// Wipes run an inner loop and artificially increase
// the measured time.
if (cv_frameskip.value)
if (!ranwipe && (frameskip < 3) && (deltatics > 1.0))
{
if (!ranwipe && (frameskip < 3) && (deltatics > 1.0))
{
frameskip++;
}
else
{
frameskip = 0;
}
frameskip++;
}
else
{
@@ -910,11 +973,8 @@ void D_ClearState(void)
{
INT32 i;
demo.title = false;
// okay, stop now
// (otherwise the game still thinks we're playing!)
CURLAbortFile();
SV_StopServer();
SV_ResetServer();
serverlistultimatecount = 0;
@@ -923,10 +983,7 @@ void D_ClearState(void)
CL_ClearPlayer(i);
splitscreen = 0;
// recompute screen size
R_ExecuteSetViewSize();
SplitScreen_OnChange();
botingame = false;
botskin = 0;
cv_debug = 0;
@@ -945,6 +1002,7 @@ void D_ClearState(void)
gameaction = ga_nothing;
memset(displayplayers, 0, sizeof(displayplayers));
consoleplayer = 0;
//demosequence = -1;
gametype = GT_RACE; // SRB2kart
paused = false;
@@ -963,15 +1021,10 @@ void D_ClearState(void)
S_StopSounds();
S_ResetKeepAndSpecialMus(); // just in case
//P_FreeLevelState();
P_FreeLevelState();
G_SetGamestate(GS_NULL);
wipegamestate = GS_NULL;
M_ClearMenus(true);
// map palettes affect this
D_ResetDeviceLED();
}
//
@@ -979,18 +1032,25 @@ void D_ClearState(void)
//
void D_StartTitle(void)
{
demo.title = false;
D_ClearState();
multiplayer = netgame = false; // title menu shouldnt be a netgame or multiplayer lmao
netgame = false; // title menu shouldnt be a netgame lmao
M_ClearMenus(true);
F_StartTitleScreen();
D_ResetDeviceLED();
}
//
// D_AddFile
//
static void D_AddFile(const char *file, char **filearray, size_t index)
static void D_AddFile(const char *file, char **filearray)
{
size_t pnumwadfiles;
char *newfile;
for (pnumwadfiles = 0; filearray[pnumwadfiles]; pnumwadfiles++)
;
newfile = malloc(strlen(file) + 1);
if (!newfile)
{
@@ -998,17 +1058,16 @@ static void D_AddFile(const char *file, char **filearray, size_t index)
}
strcpy(newfile, file);
filearray[index] = newfile;
filearray[pnumwadfiles] = newfile;
}
static void D_CleanFile(char **filearray, size_t count)
static void D_CleanFile(char **filearray)
{
size_t i;
for (i = 0; i < count; i++)
size_t pnumwadfiles;
for (pnumwadfiles = 0; filearray[pnumwadfiles]; pnumwadfiles++)
{
free(filearray[i]);
filearray[i] = NULL;
free(filearray[pnumwadfiles]);
filearray[pnumwadfiles] = NULL;
}
}
@@ -1021,49 +1080,50 @@ static INT32 D_DetectFileType(const char* filename)
const size_t len = strlen(filename);
if (fasticmp(&filename[len - 4], ".wad"))
if (!stricmp(&filename[len - 4], ".wad"))
return 2;
else if (fasticmp(&filename[len - 4], ".pk3"))
else if (!stricmp(&filename[len - 4], ".pk3"))
return 3;
else if (fasticmp(&filename[len - 5], ".kart"))
else if (!stricmp(&filename[len - 5], ".kart"))
return 4;
else if (fasticmp(&filename[len - 4], ".lua"))
else if (!stricmp(&filename[len - 4], ".lua"))
return 5;
else if (fasticmp(&filename[len - 4], ".soc"))
else if (!stricmp(&filename[len - 4], ".soc"))
return 6;
else if (fasticmp(&filename[len - 4], ".cfg"))
else if (!stricmp(&filename[len - 4], ".cfg"))
return 7;
else if (fasticmp(&filename[len - 4], ".txt"))
else if (!stricmp(&filename[len - 4], ".txt"))
return 8;
return 0;
}
// autoload that shit
static void D_AutoloadFile(const char *file, char **filearray, size_t index)
static void D_AutoloadFile(const char *file, char **filearray)
{
size_t pnumwadfiles;
char *newfile;
INT32 fileType = D_DetectFileType(file);
for (pnumwadfiles = 0; filearray[pnumwadfiles]; pnumwadfiles++)
;
newfile = malloc(strlen(file) + 1);
if (!newfile)
I_Error("No more free memory to AutoloadFile %s",file);
if (!fileType)
{
CONS_Printf("D_AutoloadFile: File %s is unknown or invalid\n", file);
return;
}
if (fileType <= 6)
{
newfile = malloc(strlen(file) + 1);
if (!newfile)
I_Error("No more free memory to AutoloadFile %s",file);
strcpy(newfile, file);
strcpy(newfile, file);
filearray[index] = newfile;
}
if (fileType <= 6)
filearray[pnumwadfiles] = newfile;
else
{
COM_BufAddText(va("exec %s\n", file));
}
COM_BufAddText(va("exec %s\n", newfile));
}
static char *strremove(char *str, const char *sub)
@@ -1088,44 +1148,42 @@ static void D_FindAddonsToAutoload(void)
{
FILE *autoloadconfigfile;
const char *autoloadpath;
char *newline;
boolean postload;
INT32 i;
char wadsToAutoload[256] = "";
// does it exist tho
autoloadpath = va("%s"PATHSEP"%s", srb2home, AUTOLOADCONFIGFILENAME);
autoloadpath = va("%s"PATHSEP"%s",srb2home,AUTOLOADCONFIGFILENAME);
autoloadconfigfile = fopen(autoloadpath, "r");
// If the file is found, run our shit
if (!autoloadconfigfile) // nope outta here
{
autoloadcount = postloadcount = 0; // so D_AddAutoloadFiles can skip everything since nothings there to autoload
wasautoloaded = postautoloaded = true; // so D_AddAutoloadFiles can skip everything since nothings there to autoload
return;
}
while (fgets(wadsToAutoload, sizeof(wadsToAutoload), autoloadconfigfile) != NULL)
while (fgets(wadsToAutoload, sizeof wadsToAutoload, autoloadconfigfile) != NULL)
{
postload = false;
// skip if commented or empty
if (wadsToAutoload[0] == '\n' ||
wadsToAutoload[0] == '#' ||
wadsToAutoload[0] == '\0')
if ((wadsToAutoload[1] == '\0' || wadsToAutoload[1] == '\n')
|| (wadsToAutoload[0] == '#'))
continue;
// this marks it so that it loads after loading server addons
if (fastncmp(wadsToAutoload, "postload ", 9))
else if (fastncmp(wadsToAutoload, "postload ", 9))
{
strremove(wadsToAutoload, "postload ");
postload = true;
}
// Remove Any Empty or Skipped Lines
newline = strchr(wadsToAutoload, '\n');
if (newline)
*newline = '\0';
for (i = 0; wadsToAutoload[i] != '\0'; i++)
{
if (wadsToAutoload[i] == '\n')
wadsToAutoload[i] = '\0';
}
if (!postload && W_CheckPostLoadList(wadsToAutoload))
{
@@ -1135,19 +1193,14 @@ static void D_FindAddonsToAutoload(void)
// LOAD IT
if (!postload)
{
D_AutoloadFile(wadsToAutoload, autoloadwadfiles, autoloadcount);
autoloadcount++;
}
D_AutoloadFile(wadsToAutoload, autoloadwadfiles);
else
{
D_AutoloadFile(wadsToAutoload, autoloadwadfilespost, postloadcount);
postloadcount++;
}
}
D_AutoloadFile(wadsToAutoload, autoloadwadfilespost);
autoloadwadfiles[autoloadcount] = NULL;
autoloadwadfilespost[postloadcount] = NULL;
// end it here
for (i = 0; wadsToAutoload[i] != '\0'; i++)
wadsToAutoload[i] = '\0';
}
// we dont want memory leaks around here do we?
fclose(autoloadconfigfile);
@@ -1155,47 +1208,41 @@ static void D_FindAddonsToAutoload(void)
static void D_AddAutoloadFiles(void)
{
// nothing to autoload
if (autoloadcount == 0)
if (wasautoloaded)
return;
CONS_Printf("D_AutoloadFile(): Loading autoloaded addons...\n");
if (W_AddAutoloadedLocalFiles(autoloadwadfiles) == 0)
CONS_Printf("D_AutoloadFile(): Are you sure you put in valid files or what?\n");
D_CleanFile(autoloadwadfiles);
D_CleanFile(autoloadwadfiles, autoloadcount);
autoloadcount = 0;
wasautoloaded = true;
}
void D_AddPostloadFiles(void)
{
// nothing to postload
if (postloadcount == 0 || !netgame)
if (postautoloaded || !netgame)
return;
CONS_Printf("D_AddPostloadFiles(): Loading postloaded addons...\n");
if (W_AddAutoloadedLocalFiles(autoloadwadfilespost) == 0)
CONS_Printf("D_AddPostloadFiles(): Are you sure you put in valid files or what?\n");
D_CleanFile(autoloadwadfilespost);
D_CleanFile(autoloadwadfilespost, postloadcount);
postloadcount = 0;
postautoloaded = true;
}
// ==========================================================================
// Identify the SRB2 version, and IWAD file to use.
// ==========================================================================
static boolean AddIWAD(const char * file, const char *dir)
static boolean AddIWAD(void)
{
char * path = va(pandf, dir, file);
char * path = va(pandf, srb2path, "srb2.srb");
if (FIL_ReadFileOK(path))
{
D_AddFile(path, startupiwadfiles, startupiwadcount++);
D_AddFile(path, startupiwadfiles);
return true;
}
@@ -1231,14 +1278,14 @@ static void IdentifyVersion(void)
}
#if (1) // reduce the amount of findfile by only using full cwd in this func
if (!fastcmp(tempsrb2path, srb2waddir))
if (strcmp(tempsrb2path, srb2waddir))
#endif
{
strlcpy(srb2path, srb2waddir, sizeof (srb2path));
}
// Load the IWAD
if (!AddIWAD("srb2.srb", srb2path)) // not sure why this uses srb2path and not srb2waddir?
if (!AddIWAD())
{
I_Error("SRB2.SRB not found! Expected in %s\n", srb2waddir);
}
@@ -1252,60 +1299,57 @@ static void IdentifyVersion(void)
#ifdef USE_PATCH_DTA
// Add our crappy patches to fix our bugs
if (!AddIWAD("patch.dta", srb2waddir))
{
I_Error("patch.dta not found! Expected in %s\n", srb2waddir);
}
D_AddFile(va(pandf,srb2waddir,"patch.dta"));
#endif
if (!AddIWAD("gfx.kart", srb2waddir))
{
I_Error("gfx.kart not found! Expected in %s\n", srb2waddir);
}
if (!AddIWAD("textures.kart", srb2waddir))
{
I_Error("textures.kart not found! Expected in %s\n", srb2waddir);
}
if (!AddIWAD("chars.kart", srb2waddir))
{
I_Error("chars.kart not found! Expected in %s\n", srb2waddir);
}
if (!AddIWAD("maps.kart", srb2waddir))
{
I_Error("maps.kart not found! Expected in %s\n", srb2waddir);
}
D_AddFile(va(pandf, srb2waddir, "gfx.kart"), startupiwadfiles);
D_AddFile(va(pandf, srb2waddir, "textures.kart"), startupiwadfiles);
D_AddFile(va(pandf, srb2waddir, "chars.kart"), startupiwadfiles);
D_AddFile(va(pandf, srb2waddir, "maps.kart"), startupiwadfiles);
#ifdef USE_PATCH_KART
if (!AddIWAD("patch.kart", srb2waddir))
{
I_Error("patch.kart not found! Expected in %s\n", srb2waddir);
}
D_AddFile(va(pandf,srb2waddir,"patch.kart"), startupiwadfiles);
#endif
const char *path = NULL;
path = va(pandf, srb2waddir, "extra.kart");
// completely optional
if (AddIWAD("extra.kart", srb2waddir))
if (FIL_ReadFileOK(path))
{
D_AddFile(path, startupiwadfiles);
found_extra_kart = true;
}
path = va(pandf, srb2waddir, "extra2.kart");
// completely optional 2: Back with a vengence
if (AddIWAD("extra2.kart", srb2waddir))
if (FIL_ReadFileOK(path))
{
D_AddFile(path, startupiwadfiles);
found_extra2_kart = true;
}
if (AddIWAD("extra3.kart", srb2waddir))
path = va(pandf, srb2waddir, "extra3.kart");
if (FIL_ReadFileOK(path))
{
D_AddFile(path, startupiwadfiles);
found_extra3_kart = true;
}
#if !defined (HAVE_SDL) || defined (HAVE_MIXER)
#define MUSICTEST(str) \
musicpath = va(pandf, srb2waddir, str);\
musicpath = va(pandf,srb2waddir,str);\
handle = W_OpenWadFile(&musicpath, false); \
if (handle) \
{ \
{\
int ms = W_VerifyNMUSlumps(musicpath, handle, false); \
fclose(handle); \
if (ms == 0) \
I_Error("File " str " has been modified with non-music/sound lumps"); \
if (ms == 1) \
D_AddFile(musicpath, startupiwadfiles, startupiwadcount++); \
D_AddFile(musicpath, startupiwadfiles); \
}
{
const char *musicpath;
@@ -1679,14 +1723,8 @@ void D_SRB2Main(void)
else
{
// use user specific config file
if (M_CheckParm("-workdir") && M_IsNextParm())
snprintf(srb2home, sizeof srb2home, "%s", M_GetNextParm());
else
#ifdef DEFAULTDIR
snprintf(srb2home, sizeof srb2home, "%s" PATHSEP DEFAULTDIR, userhome);
#else // DEFAULTDIR
snprintf(srb2home, sizeof srb2home, "%s", userhome);
#endif // DEFAULTDIR
snprintf(srb2home, sizeof srb2home, "%s" PATHSEP DEFAULTDIR, userhome);
snprintf(downloaddir, sizeof downloaddir, "%s" PATHSEP "DOWNLOAD", srb2home);
if (dedicated)
snprintf(configfile, sizeof configfile, "%s" PATHSEP "d"CONFIGFILENAME, srb2home);
@@ -1695,6 +1733,17 @@ void D_SRB2Main(void)
// can't use sprintf since there is %u in savegamename
strcatbf(savegamename, srb2home, PATHSEP);
#else
snprintf(srb2home, sizeof srb2home, "%s", userhome);
snprintf(downloaddir, sizeof downloaddir, "%s", userhome);
if (dedicated)
snprintf(configfile, sizeof configfile, "%s" PATHSEP "d"CONFIGFILENAME, userhome);
else
snprintf(configfile, sizeof configfile, "%s" PATHSEP CONFIGFILENAME, userhome);
// can't use sprintf since there is %u in savegamename
strcatbf(savegamename, userhome, PATHSEP);
#endif
}
configfile[sizeof configfile - 1] = '\0';
@@ -1720,9 +1769,6 @@ void D_SRB2Main(void)
}
}
// make sure workdir exists
I_mkdir(srb2home, 0755);
// Create addons dir
snprintf(addonsdir, sizeof addonsdir, "%s%s%s", srb2home, PATHSEP, "addons");
I_mkdir(addonsdir, 0755);
@@ -1751,7 +1797,7 @@ void D_SRB2Main(void)
const char *s = M_GetNextParm();
if (s) // Check for NULL?
D_AddFile(s, startuppwads, startuppwadcount++);
D_AddFile(s, startuppwads);
}
}
}
@@ -1784,10 +1830,8 @@ void D_SRB2Main(void)
// load wad, including the main wad file
CONS_Printf("W_InitMultipleFiles(): Adding IWAD and main PWADs.\n");
W_InitMultipleFiles(startupiwadfiles, startupiwadcount, false);
//mainwads = startupiwadcount - musicwads;
D_CleanFile(startupiwadfiles, startupiwadcount);
startupiwadcount = 0;
W_InitMultipleFiles(startupiwadfiles, false);
D_CleanFile(startupiwadfiles);
mainwads = 0;
#ifndef DEVELOP
@@ -1826,16 +1870,15 @@ void D_SRB2Main(void)
D_CheckMaps(false);
W_InitMultipleFiles(startuppwads, startuppwadcount, true);
W_InitMultipleFiles(startuppwads, true);
// Only search for pwad maps if we actually have a pwad added
if (startuppwadcount > 0)
if (startuppwads[0] != NULL)
{
D_CheckMaps(true);
}
D_CleanFile(startuppwads, startuppwadcount);
startuppwadcount = 0;
D_CleanFile(startuppwads);
cht_Init();
@@ -1879,7 +1922,9 @@ void D_SRB2Main(void)
G_LoadGameData();
#if defined (__unix__) || defined (UNIXCOMMON) || defined (HAVE_SDL)
VID_PrepareModeList(); // Regenerate Modelist according to cv_fullscreen
#endif
// set user default mode or mode set at cmdline
SCR_CheckDefaultMode();
@@ -2099,14 +2144,11 @@ void D_SRB2Main(void)
const char *sskill = M_GetNextParm();
for (j = 0; kartspeed_cons_t[j].strvalue; j++)
{
if (fasticmp(kartspeed_cons_t[j].strvalue, sskill))
if (!strcasecmp(kartspeed_cons_t[j].strvalue, sskill))
{
newskill = (INT16)kartspeed_cons_t[j].value;
break;
}
}
if (!kartspeed_cons_t[j].strvalue) // reached end of the list with no match
{
j = atoi(sskill); // assume they gave us a skill number, which is okay too
+3
View File
@@ -61,6 +61,9 @@ extern boolean minilighticon; // mkwii-style minimap headlight
//
// autoload stuff
extern boolean autoloading;
extern boolean autoloaded;
extern boolean postautoloaded;
void D_AddPostloadFiles(void);
// the infinite loop of D_SRB2Loop() called from win_main for windows version
+61 -11
View File
@@ -95,9 +95,9 @@ static INT32 sendackpacket = 0, getackpacket = 0;
INT32 ticruned = 0, ticmiss = 0;
// globals
INT32 getbps = 0, sendbps = 0;
float lostpercent = 0, duppercent = 0, gamelostpercent = 0;
INT32 packetheaderlength = 0;
INT32 getbps, sendbps;
float lostpercent, duppercent, gamelostpercent;
INT32 packetheaderlength;
boolean Net_GetNetStat(void)
{
@@ -145,6 +145,7 @@ boolean Net_GetNetStat(void)
#define URGENTFREESLOTNUM 10
#define ACKTOSENDTIMEOUT (TICRATE/11)
#ifndef NONET
typedef struct
{
UINT8 acknum;
@@ -158,6 +159,7 @@ typedef struct
doomdata_t data;
} pak;
} ackpak_t;
#endif
typedef enum
{
@@ -165,8 +167,10 @@ typedef enum
NF_TIMEOUT = 2, // Flag is set when the node got a timeout
} node_flags_t;
#ifndef NONET
// Table of packets that were not acknowleged can be resent (the sender window)
static ackpak_t ackpak[MAXACKPACKETS];
#endif
typedef struct
{
@@ -194,6 +198,7 @@ typedef struct
static node_t nodes[MAXNETNODES];
#define NODETIMEOUT 14
#ifndef NONET
// return <0 if a < b (mod 256)
// 0 if a = n (mod 256)
// >0 if a > b (mod 256)
@@ -243,7 +248,7 @@ static boolean GetFreeAcknum(UINT8 *freeack)
ackpak[i].length = doomcom->datalength;
ackpak[i].senttime = I_GetTime();
ackpak[i].resentnum = 0;
memcpy(ackpak[i].pak.raw, netbuffer, ackpak[i].length);
M_Memcpy(ackpak[i].pak.raw, netbuffer, ackpak[i].length);
*freeack = ackpak[i].acknum;
@@ -406,16 +411,22 @@ static boolean Processackpak(void)
}
return goodpacket;
}
#endif
// send special packet with only ack on it
void Net_SendAcks(INT32 node)
{
#ifdef NONET
(void)node;
#else
doomdata_t *netbuffer = DOOMCOM_DATA(doomcom);
netbuffer->packettype = PT_NOTHING;
memcpy(netbuffer->u.textcmd, nodes[node].acktosend, MAXACKTOSEND);
M_Memcpy(netbuffer->u.textcmd, nodes[node].acktosend, MAXACKTOSEND);
HSendPacket(node, false, 0, MAXACKTOSEND);
#endif
}
#ifndef NONET
static void GotAcks(void)
{
INT32 i, j;
@@ -446,6 +457,7 @@ static void GotAcks(void)
}
}
}
#endif
void Net_ConnectionTimeout(INT32 node)
{
@@ -472,6 +484,7 @@ void Net_ConnectionTimeout(INT32 node)
// Resend the data if needed
void Net_AckTicker(void)
{
#ifndef NONET
INT32 i;
doomdata_t *netbuffer = DOOMCOM_DATA(doomcom);
@@ -494,7 +507,7 @@ void Net_AckTicker(void)
}
DEBFILE(va("Resend ack %d, %u<%d at %u\n", ackpak[i].acknum, ackpak[i].senttime,
NODETIMEOUT, I_GetTime()));
memcpy(netbuffer, ackpak[i].pak.raw, ackpak[i].length);
M_Memcpy(netbuffer, ackpak[i].pak.raw, ackpak[i].length);
ackpak[i].senttime = I_GetTime();
ackpak[i].resentnum++;
ackpak[i].nextacknum = node->nextacknum;
@@ -521,12 +534,16 @@ void Net_AckTicker(void)
}
}
}
#endif
}
// Remove last packet received ack before resending the ackreturn
// (the higher layer doesn't have room, or something else ....)
void Net_UnAcknowledgePacket(INT32 node)
{
#ifdef NONET
(void)node;
#else
INT32 hm1 = (nodes[node].acktosend_head-1+MAXACKTOSEND) % MAXACKTOSEND;
DEBFILE(va("UnAcknowledge node %d\n", node));
@@ -563,8 +580,10 @@ void Net_UnAcknowledgePacket(INT32 node)
if (!nodes[node].firstacktosend)
nodes[node].firstacktosend = 1;
}
#endif
}
#ifndef NONET
/** Checks if all acks have been received
*
* \return True if all acks have been received
@@ -582,6 +601,7 @@ static boolean Net_AllAcksReceived(void)
return true;
}
#endif
/** Waits for all ackreturns
*
@@ -590,6 +610,9 @@ static boolean Net_AllAcksReceived(void)
*/
void Net_WaitAllAckReceived(UINT32 timeout)
{
#ifdef NONET
(void)timeout;
#else
tic_t tictac = I_GetTime();
timeout = tictac + timeout*NEWTICRATE;
@@ -607,6 +630,7 @@ void Net_WaitAllAckReceived(UINT32 timeout)
HGetPacket();
Net_AckTicker();
}
#endif
}
static void InitNode(node_t *node)
@@ -623,8 +647,10 @@ static void InitAck(void)
{
INT32 i;
#ifndef NONET
for (i = 0; i < MAXACKPACKETS; i++)
ackpak[i].acknum = 0;
#endif
for (i = 0; i < MAXNETNODES; i++)
InitNode(&nodes[i]);
@@ -637,6 +663,9 @@ static void InitAck(void)
*/
void Net_AbortPacketType(UINT8 packettype)
{
#ifdef NONET
(void)packettype;
#else
for (INT32 i = 0; i < MAXACKPACKETS; i++)
{
if (ackpak[i].acknum && (ackpak[i].pak.data.packettype == packettype
@@ -645,6 +674,7 @@ void Net_AbortPacketType(UINT8 packettype)
ackpak[i].acknum = 0;
}
}
#endif
}
// -----------------------------------------------------------------
@@ -654,6 +684,9 @@ void Net_AbortPacketType(UINT8 packettype)
// remove a node, clear all ack from this node and reset askret
void Net_CloseConnection(INT32 node)
{
#ifdef NONET
(void)node;
#else
INT32 i;
if (node == -1)
@@ -705,8 +738,10 @@ void Net_CloseConnection(INT32 node)
InitNode(&nodes[node]);
SV_AbortSendFiles(node);
I_NetFreeNodenum(node);
#endif
}
#ifndef NONET
//
// Checksum
//
@@ -722,8 +757,10 @@ static UINT32 NetbufferChecksum(void)
return LONG(c);
}
#endif
#ifdef DEBUGFILE
static void fprintfstring(char *s, size_t len)
{
INT32 mode = 0;
@@ -995,6 +1032,7 @@ void Command_Droprate(void)
packetdroprate = droprate;
}
#ifndef NONET
static boolean ShouldDropPacket(void)
{
doomdata_t *netbuffer = DOOMCOM_DATA(doomcom);
@@ -1002,6 +1040,7 @@ static boolean ShouldDropPacket(void)
|| (packetdroprate != 0 && rand() < (((double)RAND_MAX) * (packetdroprate / 100.f))) || packetdroprate == 100;
}
#endif
#endif
//
// HSendPacket
@@ -1021,7 +1060,7 @@ boolean HSendPacket(INT32 node, boolean reliable, UINT8 acknum, size_t packetlen
return false;
}
netbuffer->ack = netbuffer->ackreturn = 0; // don't hold over values from last packet sent/received
memcpy(&reboundstore[rebound_head], netbuffer,
M_Memcpy(&reboundstore[rebound_head], netbuffer,
doomcom->datalength);
reboundsize[rebound_head] = doomcom->datalength;
rebound_head = (rebound_head+1) % MAXREBOUND;
@@ -1038,6 +1077,11 @@ boolean HSendPacket(INT32 node, boolean reliable, UINT8 acknum, size_t packetlen
if (!netgame)
I_Error("Tried to transmit to another node");
#ifdef NONET
(void)node;
(void)reliable;
(void)acknum;
#else
// do this before GetFreeAcknum because this function backups
// the current packet
doomcom->remotenode = (INT16)node;
@@ -1092,6 +1136,8 @@ boolean HSendPacket(INT32 node, boolean reliable, UINT8 acknum, size_t packetlen
}
#endif
#endif // ndef NONET
return true;
}
@@ -1107,7 +1153,7 @@ boolean HGetPacket(void)
// Get a packet from self
if (rebound_tail != rebound_head)
{
memcpy(netbuffer, &reboundstore[rebound_tail], reboundsize[rebound_tail]);
M_Memcpy(netbuffer, &reboundstore[rebound_tail], reboundsize[rebound_tail]);
doomcom->datalength = reboundsize[rebound_tail];
if (netbuffer->packettype == PT_NODETIMEOUT)
doomcom->remotenode = netbuffer->u.textcmd[0];
@@ -1125,9 +1171,13 @@ boolean HGetPacket(void)
if (!netgame)
return false;
while (true)
#ifndef NONET
while(true)
{
if (!I_NetGet()) // No packets received
I_NetGet();
if (doomcom->remotenode == -1) // No packet received
return false;
getbytes += packetheaderlength + doomcom->datalength; // For stat
@@ -1163,10 +1213,10 @@ boolean HGetPacket(void)
GotAcks();
continue;
}
doomcom->datalength -= BASEPACKETSIZE;
break;
}
#endif // ifndef NONET
return true;
}
+2
View File
@@ -53,8 +53,10 @@ void Net_AckTicker(void);
boolean HSendPacket(INT32 node, boolean reliable, UINT8 acknum, size_t packetlength);
boolean HGetPacket(void);
void D_SetDoomcom(void);
#ifndef NONET
void D_SaveBan(void);
void D_LoadBan(boolean warning);
#endif
boolean D_CheckNetGame(void);
void D_CloseConnection(void);
void Net_UnAcknowledgePacket(INT32 node);
+144 -145
View File
@@ -68,22 +68,22 @@
// protos
// ------
static void Got_NameAndColor(const UINT8 **cp, INT32 playernum);
static void Got_WeaponPref(const UINT8 **cp, INT32 playernum);
static void Got_Mapcmd(const UINT8 **cp, INT32 playernum);
static void Got_ExitLevelcmd(const UINT8 **cp, INT32 playernum);
static void Got_SetupVotecmd(const UINT8 **cp, INT32 playernum);
static void Got_ModifyVotecmd(const UINT8 **cp, INT32 playernum);
static void Got_PickVotecmd(const UINT8 **cp, INT32 playernum);
static void Got_RequestAddfilecmd(const UINT8 **cp, INT32 playernum);
static void Got_Addfilecmd(const UINT8 **cp, INT32 playernum);
static void Got_Pause(const UINT8 **cp, INT32 playernum);
static void Got_Respawn(const UINT8 **cp, INT32 playernum);
static void Got_RandomSeed(const UINT8 **cp, INT32 playernum);
static void Got_RunSOCcmd(const UINT8 **cp, INT32 playernum);
static void Got_Teamchange(const UINT8 **cp, INT32 playernum);
static void Got_Clearscores(const UINT8 **cp, INT32 playernum);
static void Got_DiscordInfo(const UINT8 **cp, INT32 playernum);
static void Got_NameAndColor(UINT8 **cp, INT32 playernum);
static void Got_WeaponPref(UINT8 **cp, INT32 playernum);
static void Got_Mapcmd(UINT8 **cp, INT32 playernum);
static void Got_ExitLevelcmd(UINT8 **cp, INT32 playernum);
static void Got_SetupVotecmd(UINT8 **cp, INT32 playernum);
static void Got_ModifyVotecmd(UINT8 **cp, INT32 playernum);
static void Got_PickVotecmd(UINT8 **cp, INT32 playernum);
static void Got_RequestAddfilecmd(UINT8 **cp, INT32 playernum);
static void Got_Addfilecmd(UINT8 **cp, INT32 playernum);
static void Got_Pause(UINT8 **cp, INT32 playernum);
static void Got_Respawn(UINT8 **cp, INT32 playernum);
static void Got_RandomSeed(UINT8 **cp, INT32 playernum);
static void Got_RunSOCcmd(UINT8 **cp, INT32 playernum);
static void Got_Teamchange(UINT8 **cp, INT32 playernum);
static void Got_Clearscores(UINT8 **cp, INT32 playernum);
static void Got_DiscordInfo(UINT8 **cp, INT32 playernum);
static void PointLimit_OnChange(void);
static void TimeLimit_OnChange(void);
@@ -178,13 +178,13 @@ static void Command_Clearscores_f(void);
// Remote Administration
static void Command_Changepassword_f(void);
static void Command_Login_f(void);
static void Got_Login(const UINT8 **cp, INT32 playernum);
static void Got_Verification(const UINT8 **cp, INT32 playernum);
static void Got_Removal(const UINT8 **cp, INT32 playernum);
static void Got_Login(UINT8 **cp, INT32 playernum);
static void Got_Verification(UINT8 **cp, INT32 playernum);
static void Got_Removal(UINT8 **cp, INT32 playernum);
static void Command_Verify_f(void);
static void Command_RemoveAdmin_f(void);
static void Command_MotD_f(void);
static void Got_MotD_f(const UINT8 **cp, INT32 playernum);
static void Got_MotD_f(UINT8 **cp, INT32 playernum);
static void Command_ShowScores_f(void);
static void Command_ShowTime_f(void);
@@ -292,10 +292,6 @@ consvar_t cv_mouseturn = {"mouseturn", "Off", CV_SAVE, CV_OnOff, NULL, 0, NULL,
// Lagless camera! Yay!
consvar_t cv_laglesscam = {"lagless_camera", "Off", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL};
// makes the camera use the saved angleturn in replays instead of the players angle
// more accurate to how the recording player seen things in game, but may be jittery if they encountered net issues
consvar_t cv_demoangturn = {"useangleturninreplays", "Off", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL};
consvar_t cv_verticallook[MAXSPLITSCREENPLAYERS] = {
{"verticallook", "On", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL},
{"verticallook2", "On", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL},
@@ -725,8 +721,10 @@ void D_RegisterServerCommands(void)
CV_RegisterVar(&cv_killingdead);
// d_clisrv
#ifndef NONET
#ifdef SATURNJOIN
CV_RegisterVar(&cv_allownewsaturnplayer); // need to register it before cv_maxplayers && cv_allownewplayer
#endif
#endif
CV_RegisterVar(&cv_maxplayers);
CV_RegisterVar(&cv_resynchattempts);
@@ -739,15 +737,18 @@ void D_RegisterServerCommands(void)
CV_RegisterVar(&cv_downloadspeed);
CV_RegisterVar(&cv_connectawaittime);
CV_RegisterVar(&cv_httpsource);
#ifndef NONET
CV_RegisterVar(&cv_allownewplayer);
CV_RegisterVar(&cv_joinrefusemessage);
CV_RegisterVar(&cv_chatlogsize);
#ifdef VANILLAJOINNEXTROUND
CV_RegisterVar(&cv_joinnextround);
#endif
CV_RegisterVar(&cv_showjoinaddress);
CV_RegisterVar(&cv_shownodeip);
CV_RegisterVar(&cv_blamecfail);
#endif
COM_AddCommand("ping", Command_Ping_f);
CV_RegisterVar(&cv_nettimeout);
@@ -849,6 +850,12 @@ void D_RegisterClientCommands(void)
CV_RegisterVar(&cv_zlib_memory);
CV_RegisterVar(&cv_zlib_strategy);
CV_RegisterVar(&cv_zlib_window_bits);
// APNG variables
CV_RegisterVar(&cv_zlib_levela);
CV_RegisterVar(&cv_zlib_memorya);
CV_RegisterVar(&cv_zlib_strategya);
CV_RegisterVar(&cv_zlib_window_bitsa);
CV_RegisterVar(&cv_apng_delay);
// GIF variables
CV_RegisterVar(&cv_gif_optimize);
CV_RegisterVar(&cv_gif_downscale);
@@ -968,11 +975,10 @@ void D_RegisterClientCommands(void)
// g_input.c
CV_RegisterVar(&cv_controlperkey);
CV_RegisterVar(&cv_turnsmooth);
for (i = 0; i < MAXSPLITSCREENPLAYERS; i++)
{
CV_RegisterVar(&cv_turnsmooth[i]);
CV_RegisterVar(&cv_turnaxis[i]);
CV_RegisterVar(&cv_moveaxis[i]);
CV_RegisterVar(&cv_camturnaxis[i]);
@@ -989,8 +995,6 @@ void D_RegisterClientCommands(void)
CV_RegisterVar(&cv_xdeadzone[i]);
CV_RegisterVar(&cv_ydeadzone[i]);
CV_RegisterVar(&cv_litesteer[i]);
CV_RegisterVar(&cv_usejoystick[i]);
CV_RegisterVar(&cv_joyscale[i]);
CV_RegisterVar(&cv_rumble[i]);
@@ -1023,7 +1027,6 @@ void D_RegisterClientCommands(void)
// screen.c
CV_RegisterVar(&cv_fullscreen);
CV_RegisterVar(&cv_renderview);
CV_RegisterVar(&cv_frameskip);
CV_RegisterVar(&cv_vhseffect);
CV_RegisterVar(&cv_shittyscreen);
CV_RegisterVar(&cv_scr_width);
@@ -1047,7 +1050,6 @@ void D_RegisterClientCommands(void)
CV_RegisterVar(&cv_betainterscreen);
CV_RegisterVar(&cv_laglesscam);
CV_RegisterVar(&cv_demoangturn);
for (i = 0; i < MAXSPLITSCREENPLAYERS; i++)
{
@@ -1219,7 +1221,7 @@ static boolean EnsurePlayerNameIsGood(char *name, INT32 playernum)
for (ix = 0; ix < MAXPLAYERS; ix++)
{
if (ix != playernum && playeringame[ix]
&& fasticmp(name, player_names[ix]))
&& strcasecmp(name, player_names[ix]) == 0)
{
// We shouldn't kick people out just because
// they joined the game with the same name
@@ -1336,7 +1338,7 @@ static void CleanupPlayerName(INT32 playernum, const char *newname)
for (i = 0; i < MAXPLAYERS; i++)
{
if (i != playernum && playeringame[i]
&& fasticmp(tmpname, player_names[i]))
&& strcasecmp(tmpname, player_names[i]) == 0)
{
break;
}
@@ -1386,7 +1388,7 @@ static void SetPlayerName(INT32 playernum, char *newname)
{
if (EnsurePlayerNameIsGood(newname, playernum))
{
if (!fasticmp(newname, player_names[playernum]))
if (strcasecmp(newname, player_names[playernum]) != 0)
{
if (netgame)
HU_AddChatText(va("\x82*%s renamed to %s", player_names[playernum], newname), false);
@@ -1508,9 +1510,9 @@ static void SendNameAndColor(void)
CV_StealthSet(&cv_playercolor, cv_playercolor.defaultvalue);
}
if (fastcmp(cv_playername.string, player_names[consoleplayer])
if (!strcmp(cv_playername.string, player_names[consoleplayer])
&& cv_playercolor.value == players[consoleplayer].skincolor
&& fastcmp(cv_skin.string, skins[players[consoleplayer].skin].name))
&& !strcmp(cv_skin.string, skins[players[consoleplayer].skin].name))
return;
// We'll handle it later if we're not playing.
@@ -1913,7 +1915,7 @@ static void SendNameAndColor4(void)
SendNetXCmdForPlayer(3, XD_NAMEANDCOLOR, buf, p - buf);
}
static void Got_NameAndColor(const UINT8 **cp, INT32 playernum)
static void Got_NameAndColor(UINT8 **cp, INT32 playernum)
{
player_t *p = &players[playernum];
char name[MAXPLAYERNAME+1];
@@ -1945,7 +1947,7 @@ static void Got_NameAndColor(const UINT8 **cp, INT32 playernum)
// set name
if (player_name_changes[playernum] < MAXNAMECHANGES)
{
if (!fasticmp(player_names[playernum], name))
if (strcasecmp(player_names[playernum], name) != 0)
SetPlayerName(playernum, name);
}
@@ -1999,6 +2001,11 @@ static void Got_NameAndColor(const UINT8 **cp, INT32 playernum)
}
else
SetPlayerSkinByNum(playernum, skin);
#ifdef HAVE_DISCORDRPC
if (playernum == consoleplayer)
DRPC_UpdatePresence();
#endif
}
void SendWeaponPref(void)
@@ -2041,17 +2048,15 @@ void SendWeaponPref4(void)
SendNetXCmdForPlayer(3, XD_WEAPONPREF, buf, 1);
}
static void Got_WeaponPref(const UINT8 **cp, INT32 playernum)
static void Got_WeaponPref(UINT8 **cp,INT32 playernum)
{
player_t *player = &players[playernum];
UINT8 prefs = READUINT8(*cp);
player->pflags &= ~(PF_FLIPCAM|PF_ANALOGMODE);
players[playernum].pflags &= ~(PF_FLIPCAM|PF_ANALOGMODE);
if (prefs & 1)
player->pflags |= PF_FLIPCAM;
players[playernum].pflags |= PF_FLIPCAM;
if (prefs & 2)
player->pflags |= PF_ANALOGMODE;
players[playernum].pflags |= PF_ANALOGMODE;
}
void D_SendPlayerConfig(void)
@@ -2324,8 +2329,8 @@ static void Command_Playdemo_f(void)
CONS_Printf(M_GetText("Playing back demo '%s'.\n"), name);
demo.loadfiles = fastcmp(COM_Argv(2), "-addfiles");
demo.ignorefiles = fastcmp(COM_Argv(2), "-force");
demo.loadfiles = strcmp(COM_Argv(2), "-addfiles") == 0;
demo.ignorefiles = strcmp(COM_Argv(2), "-force") == 0;
// Internal if no extension, external if one exists
// If external, convert the file name to a path in SRB2's home directory
@@ -2494,18 +2499,15 @@ void D_SetupVote(void)
INT32 i;
UINT8 gt = (cv_kartgametypepreference.value == -1) ? gametype : cv_kartgametypepreference.value;
UINT8 secondgt = G_SometimesGetDifferentGametype(gt);
INT16 votebuffer[4] = {-1,-1,-1, 0};
INT16 votebuffer[4] = {-1,-1,-1,0};
INT16 luamaps[4] = {0, 0, 0, 0};
LUA_HookSetupVote(luamaps, sizeof(luamaps)/sizeof(luamaps[0]), gt, secondgt);
// Correct secondgt if needed
if (luamaps[2])
{
UINT8 typeoflevel = mapheaderinfo[luamaps[2]-1]->typeoflevel;
if ((typeoflevel & G_TOLFlag(secondgt&(~0x80))) == 0)
secondgt = ((typeoflevel & TOL_RACE) ? GT_RACE : GT_MATCH)|(secondgt&0x80);
}
UINT8 typeoflevel = mapheaderinfo[luamaps[2]-1]->typeoflevel;
if (luamaps[2] && (typeoflevel & G_TOLFlag(secondgt&(~0x80))) == 0)
secondgt = ((typeoflevel & TOL_RACE) ? GT_RACE : GT_MATCH)|(secondgt&0x80);
if (cv_kartencore.value && gt == GT_RACE)
WRITEUINT8(p, (gt|0x80));
@@ -2606,18 +2608,14 @@ ConcatCommandArgv (int start, int end)
size += strlen(COM_Argv(i)) + 1;
}
p = final = ZZ_Alloc(size);
if (!p)
I_Error("ConcatCommandArgv: Out of memory!\n");
final = ZZ_Alloc(size);
p = final;
--end;/* handle the final argument separately */
for (i = start; i < end; ++i)
{
p += sprintf(p, "%s ", COM_Argv(i));
}
/* at this point "end" is actually the last argument's position */
strcpy(p, COM_Argv(end));
@@ -2850,7 +2848,7 @@ static void Command_Map_f(void)
* ::serverplayer or ::adminplayer.
* \sa D_MapChange
*/
static void Got_Mapcmd(const UINT8 **cp, INT32 playernum)
static void Got_Mapcmd(UINT8 **cp, INT32 playernum)
{
char mapname[MAX_WADPATH+1];
UINT8 flags;
@@ -2969,7 +2967,7 @@ static void Command_Pause(void)
CONS_Printf(M_GetText("Only the server or a remote admin can use this.\n"));
}
static void Got_Pause(const UINT8 **cp, INT32 playernum)
static void Got_Pause(UINT8 **cp, INT32 playernum)
{
UINT8 dedicatedpause = false;
const char *playername;
@@ -3081,7 +3079,7 @@ static void Command_Respawn(void)
SendNetXCmd(XD_RESPAWN, &buf, 4);
}
static void Got_Respawn(const UINT8 **cp, INT32 playernum)
static void Got_Respawn(UINT8 **cp, INT32 playernum)
{
INT32 respawnplayer = READINT32(*cp);
@@ -3116,7 +3114,7 @@ static void Got_Respawn(const UINT8 **cp, INT32 playernum)
* \param playernum Player responsible for the message. Must be ::serverplayer.
* \author Graue <graue@oceanbase.org>
*/
static void Got_RandomSeed(const UINT8 **cp, INT32 playernum)
static void Got_RandomSeed(UINT8 **cp, INT32 playernum)
{
UINT32 seed;
@@ -3151,7 +3149,7 @@ static void Command_Clearscores_f(void)
* \sa XD_CLEARSCORES, Command_Clearscores_f
* \author SSNTails <http://www.ssntails.org>
*/
static void Got_Clearscores(const UINT8 **cp, INT32 playernum)
static void Got_Clearscores(UINT8 **cp, INT32 playernum)
{
INT32 i;
@@ -3196,20 +3194,20 @@ static void Command_Teamchange_f(void)
if (G_GametypeHasTeams())
{
if (fasticmp(COM_Argv(1), "red") || fasticmp(COM_Argv(1), "1"))
if (!strcasecmp(COM_Argv(1), "red") || !strcasecmp(COM_Argv(1), "1"))
NetPacket.packet.newteam = 1;
else if (fasticmp(COM_Argv(1), "blue") || fasticmp(COM_Argv(1), "2"))
else if (!strcasecmp(COM_Argv(1), "blue") || !strcasecmp(COM_Argv(1), "2"))
NetPacket.packet.newteam = 2;
else if (fasticmp(COM_Argv(1), "spectator") || fasticmp(COM_Argv(1), "0"))
else if (!strcasecmp(COM_Argv(1), "spectator") || !strcasecmp(COM_Argv(1), "0"))
NetPacket.packet.newteam = 0;
else
error = true;
}
else if (G_GametypeHasSpectators())
{
if (fasticmp(COM_Argv(1), "spectator") || fasticmp(COM_Argv(1), "0"))
if (!strcasecmp(COM_Argv(1), "spectator") || !strcasecmp(COM_Argv(1), "0"))
NetPacket.packet.newteam = 0;
else if (fasticmp(COM_Argv(1), "playing") || fasticmp(COM_Argv(1), "1"))
else if (!strcasecmp(COM_Argv(1), "playing") || !strcasecmp(COM_Argv(1), "1"))
NetPacket.packet.newteam = 3;
else
error = true;
@@ -3286,20 +3284,20 @@ static void Command_Teamchange2_f(void)
if (G_GametypeHasTeams())
{
if (fasticmp(COM_Argv(1), "red") || fasticmp(COM_Argv(1), "1"))
if (!strcasecmp(COM_Argv(1), "red") || !strcasecmp(COM_Argv(1), "1"))
NetPacket.packet.newteam = 1;
else if (fasticmp(COM_Argv(1), "blue") || fasticmp(COM_Argv(1), "2"))
else if (!strcasecmp(COM_Argv(1), "blue") || !strcasecmp(COM_Argv(1), "2"))
NetPacket.packet.newteam = 2;
else if (fasticmp(COM_Argv(1), "spectator") || fasticmp(COM_Argv(1), "0"))
else if (!strcasecmp(COM_Argv(1), "spectator") || !strcasecmp(COM_Argv(1), "0"))
NetPacket.packet.newteam = 0;
else
error = true;
}
else if (G_GametypeHasSpectators())
{
if (fasticmp(COM_Argv(1), "spectator") || fasticmp(COM_Argv(1), "0"))
if (!strcasecmp(COM_Argv(1), "spectator") || !strcasecmp(COM_Argv(1), "0"))
NetPacket.packet.newteam = 0;
else if (fasticmp(COM_Argv(1), "playing") || fasticmp(COM_Argv(1), "1"))
else if (!strcasecmp(COM_Argv(1), "playing") || !strcasecmp(COM_Argv(1), "1"))
NetPacket.packet.newteam = 3;
else
error = true;
@@ -3377,20 +3375,20 @@ static void Command_Teamchange3_f(void)
if (G_GametypeHasTeams())
{
if (fasticmp(COM_Argv(1), "red") || fasticmp(COM_Argv(1), "1"))
if (!strcasecmp(COM_Argv(1), "red") || !strcasecmp(COM_Argv(1), "1"))
NetPacket.packet.newteam = 1;
else if (fasticmp(COM_Argv(1), "blue") || fasticmp(COM_Argv(1), "2"))
else if (!strcasecmp(COM_Argv(1), "blue") || !strcasecmp(COM_Argv(1), "2"))
NetPacket.packet.newteam = 2;
else if (fasticmp(COM_Argv(1), "spectator") || fasticmp(COM_Argv(1), "0"))
else if (!strcasecmp(COM_Argv(1), "spectator") || !strcasecmp(COM_Argv(1), "0"))
NetPacket.packet.newteam = 0;
else
error = true;
}
else if (G_GametypeHasSpectators())
{
if (fasticmp(COM_Argv(1), "spectator") || fasticmp(COM_Argv(1), "0"))
if (!strcasecmp(COM_Argv(1), "spectator") || !strcasecmp(COM_Argv(1), "0"))
NetPacket.packet.newteam = 0;
else if (fasticmp(COM_Argv(1), "playing") || fasticmp(COM_Argv(1), "1"))
else if (!strcasecmp(COM_Argv(1), "playing") || !strcasecmp(COM_Argv(1), "1"))
NetPacket.packet.newteam = 3;
else
error = true;
@@ -3468,20 +3466,20 @@ static void Command_Teamchange4_f(void)
if (G_GametypeHasTeams())
{
if (fasticmp(COM_Argv(1), "red") || fasticmp(COM_Argv(1), "1"))
if (!strcasecmp(COM_Argv(1), "red") || !strcasecmp(COM_Argv(1), "1"))
NetPacket.packet.newteam = 1;
else if (fasticmp(COM_Argv(1), "blue") || fasticmp(COM_Argv(1), "2"))
else if (!strcasecmp(COM_Argv(1), "blue") || !strcasecmp(COM_Argv(1), "2"))
NetPacket.packet.newteam = 2;
else if (fasticmp(COM_Argv(1), "spectator") || fasticmp(COM_Argv(1), "0"))
else if (!strcasecmp(COM_Argv(1), "spectator") || !strcasecmp(COM_Argv(1), "0"))
NetPacket.packet.newteam = 0;
else
error = true;
}
else if (G_GametypeHasSpectators())
{
if (fasticmp(COM_Argv(1), "spectator") || fasticmp(COM_Argv(1), "0"))
if (!strcasecmp(COM_Argv(1), "spectator") || !strcasecmp(COM_Argv(1), "0"))
NetPacket.packet.newteam = 0;
else if (fasticmp(COM_Argv(1), "playing") || fasticmp(COM_Argv(1), "1"))
else if (!strcasecmp(COM_Argv(1), "playing") || !strcasecmp(COM_Argv(1), "1"))
NetPacket.packet.newteam = 3;
else
error = true;
@@ -3567,33 +3565,33 @@ static void Command_ServerTeamChange_f(void)
if (G_TagGametype())
{
if (fasticmp(COM_Argv(2), "it") || fasticmp(COM_Argv(2), "1"))
if (!strcasecmp(COM_Argv(2), "it") || !strcasecmp(COM_Argv(2), "1"))
NetPacket.packet.newteam = 1;
else if (fasticmp(COM_Argv(2), "notit") || fasticmp(COM_Argv(2), "2"))
else if (!strcasecmp(COM_Argv(2), "notit") || !strcasecmp(COM_Argv(2), "2"))
NetPacket.packet.newteam = 2;
else if (fasticmp(COM_Argv(2), "playing") || fasticmp(COM_Argv(2), "3"))
else if (!strcasecmp(COM_Argv(2), "playing") || !strcasecmp(COM_Argv(2), "3"))
NetPacket.packet.newteam = 3;
else if (fasticmp(COM_Argv(2), "spectator") || fasticmp(COM_Argv(2), "0"))
else if (!strcasecmp(COM_Argv(2), "spectator") || !strcasecmp(COM_Argv(2), "0"))
NetPacket.packet.newteam = 0;
else
error = true;
}
else if (G_GametypeHasTeams())
{
if (fasticmp(COM_Argv(2), "red") || fasticmp(COM_Argv(2), "1"))
if (!strcasecmp(COM_Argv(2), "red") || !strcasecmp(COM_Argv(2), "1"))
NetPacket.packet.newteam = 1;
else if (fasticmp(COM_Argv(2), "blue") || fasticmp(COM_Argv(2), "2"))
else if (!strcasecmp(COM_Argv(2), "blue") || !strcasecmp(COM_Argv(2), "2"))
NetPacket.packet.newteam = 2;
else if (fasticmp(COM_Argv(2), "spectator") || fasticmp(COM_Argv(2), "0"))
else if (!strcasecmp(COM_Argv(2), "spectator") || !strcasecmp(COM_Argv(2), "0"))
NetPacket.packet.newteam = 0;
else
error = true;
}
else if (G_GametypeHasSpectators())
{
if (fasticmp(COM_Argv(2), "spectator") || fasticmp(COM_Argv(2), "0"))
if (!strcasecmp(COM_Argv(2), "spectator") || !strcasecmp(COM_Argv(2), "0"))
NetPacket.packet.newteam = 0;
else if (fasticmp(COM_Argv(2), "playing") || fasticmp(COM_Argv(2), "1"))
else if (!strcasecmp(COM_Argv(2), "playing") || !strcasecmp(COM_Argv(2), "1"))
NetPacket.packet.newteam = 3;
else
error = true;
@@ -3668,7 +3666,7 @@ static void Command_ServerTeamChange_f(void)
}
//todo: This and the other teamchange functions are getting too long and messy. Needs cleaning.
static void Got_Teamchange(const UINT8 **cp, INT32 playernum)
static void Got_Teamchange(UINT8 **cp, INT32 playernum)
{
changeteam_union NetPacket;
boolean error = false, wasspectator = false;
@@ -4025,7 +4023,7 @@ static void Command_Login_f(void)
#endif
}
static void Got_Login(const UINT8 **cp, INT32 playernum)
static void Got_Login(UINT8 **cp, INT32 playernum)
{
#ifdef NOMD5
// If we have no MD5 support then completely disable XD_LOGIN responses for security.
@@ -4135,7 +4133,7 @@ static void Command_Verify_f(void)
SendNetXCmd(XD_VERIFIED, buf, 1);
}
static void Got_Verification(const UINT8 **cp, INT32 playernum)
static void Got_Verification(UINT8 **cp, INT32 playernum)
{
INT16 num = READUINT8(*cp);
@@ -4187,7 +4185,7 @@ static void Command_RemoveAdmin_f(void)
SendNetXCmd(XD_DEMOTED, buf, 1);
}
static void Got_Removal(const UINT8 **cp, INT32 playernum)
static void Got_Removal(UINT8 **cp, INT32 playernum)
{
INT16 num = READUINT8(*cp);
@@ -4228,32 +4226,23 @@ static void Command_MotD_f(void)
mymotd = Z_Malloc(sizeof(motd), PU_STATIC, NULL);
if (!mymotd)
return;
//I_Error("Command_MotD_f: Out of memory!\n"); // idk if this aint a bit too much lel
strlcpy(mymotd, COM_Argv(1), sizeof(motd));
strlcpy(mymotd, COM_Argv(1), sizeof motd);
for (i = 2; i < j; i++)
{
strlcat(mymotd, " ", sizeof(motd));
strlcat(mymotd, COM_Argv(i), sizeof(motd));
strlcat(mymotd, " ", sizeof motd);
strlcat(mymotd, COM_Argv(i), sizeof motd);
}
// Disallow non-printing characters and semicolons.
for (i = 0; mymotd[i] != '\0'; i++)
{
if (!isprint(mymotd[i]) || mymotd[i] == ';')
{
Z_Free(mymotd);
return;
}
}
if ((netgame || multiplayer) && client)
{
SendNetXCmd(XD_SETMOTD, mymotd, i); // send the actual size of the motd string, not the full buffer's size
}
else
{
strcpy(motd, mymotd);
@@ -4263,7 +4252,7 @@ static void Command_MotD_f(void)
Z_Free(mymotd);
}
static void Got_MotD_f(const UINT8 **cp, INT32 playernum)
static void Got_MotD_f(UINT8 **cp, INT32 playernum)
{
char *mymotd = Z_Malloc(sizeof(motd), PU_STATIC, NULL);
INT32 i;
@@ -4330,7 +4319,7 @@ static void Command_RunSOC(void)
SendNetXCmd(XD_RUNSOC, buf, length);
}
static void Got_RunSOCcmd(const UINT8 **cp, INT32 playernum)
static void Got_RunSOCcmd(UINT8 **cp, INT32 playernum)
{
char filename[256];
filestatus_t ncs = FS_NOTCHECKED;
@@ -4397,14 +4386,6 @@ static void Command_Addfilelocal(void)
P_AddWadFile(fn, true);
}
static void CloseFileHandle(FILE **fhandle)
{
if (*fhandle)
{
fclose(*fhandle);
*fhandle = NULL;
}
}
/** Adds a pwad at runtime.
* Searches for sounds, maps, music, new images.
@@ -4417,7 +4398,7 @@ static void Command_Addfile(void)
INT32 i;
int musiconly = -1; // W_VerifyNMUSlumps isn't boolean
CLEANUP(CloseFileHandle) FILE *fhandle = NULL;
FILE *fhandle = NULL;
if (COM_Argc() != 2)
{
@@ -4432,15 +4413,18 @@ static void Command_Addfile(void)
if (!isprint(fn[i]) || fn[i] == ';')
return;
if (fhandle)
{
fclose(fhandle);
fhandle = NULL;
}
if ((fhandle = W_OpenWadFile(&fn, true)) != NULL)
{
musiconly = W_VerifyNMUSlumps(fn, fhandle, false);
}
if (fhandle == NULL || musiconly == -1)
return; // file not found
if (!musiconly)
if (musiconly == -1)
{
// ... But only so long as they contain nothing more then music and sprites.
if (netgame && !(server || IsPlayerAdmin(consoleplayer)))
@@ -4452,7 +4436,7 @@ static void Command_Addfile(void)
}
// Add file on your client directly if it is trivial, or you aren't in a netgame.
if (!netgame || musiconly)
if (!(netgame || multiplayer) || musiconly)
{
P_AddWadFile(fn, false);
return;
@@ -4468,7 +4452,7 @@ static void Command_Addfile(void)
{
UINT8 md5sum[16];
#ifdef NOMD5
memset(md5sum, 0, 16);
memset(md5sum,0,16);
#else
{
@@ -4480,15 +4464,15 @@ static void Command_Addfile(void)
for (i = 0; i < numwadfiles; i++)
{
if (!memcmp(wadfiles[i]->md5sum, md5sum, 16))
{
CONS_Alert(CONS_ERROR, M_GetText("%s is already loaded\n"), fn);
return;
}
if (memcmp(wadfiles[i]->md5sum, md5sum, 16))
continue;
CONS_Alert(CONS_ERROR, M_GetText("%s is already loaded\n"), fn);
goto addfile_finally;
}
#endif
// Finally okay to write this important data
WRITESTRINGN(buf_p, p, 240);
WRITESTRINGN(buf_p,p,240);
WRITEMEM(buf_p, md5sum, 16);
}
@@ -4496,6 +4480,10 @@ static void Command_Addfile(void)
SendNetXCmd(XD_REQADDFILE, buf, buf_p - buf);
else
SendNetXCmd(XD_ADDFILE, buf, buf_p - buf);
addfile_finally:
if (fhandle)
fclose(fhandle);
}
/** Adds something at runtime.
@@ -4608,7 +4596,7 @@ static void Command_GLocalSkin (void)
}
}
static void Got_RequestAddfilecmd(const UINT8 **cp, INT32 playernum)
static void Got_RequestAddfilecmd(UINT8 **cp, INT32 playernum)
{
char filename[241];
filestatus_t ncs = FS_NOTCHECKED;
@@ -4667,7 +4655,7 @@ static void Got_RequestAddfilecmd(const UINT8 **cp, INT32 playernum)
COM_BufAddText(va("addfile %s\n", filename));
}
static void Got_Addfilecmd(const UINT8 **cp, INT32 playernum)
static void Got_Addfilecmd(UINT8 **cp, INT32 playernum)
{
char filename[241];
filestatus_t ncs = FS_NOTCHECKED;
@@ -4686,7 +4674,7 @@ static void Got_Addfilecmd(const UINT8 **cp, INT32 playernum)
return;
}
ncs = findfile(filename, md5sum, true);
ncs = findfile(filename,md5sum,true);
if (ncs != FS_FOUND || !P_AddWadFile(filename, false))
{
@@ -4899,7 +4887,18 @@ static void Command_Version_f(void)
#endif
// OS
CONS_Printf("%s ", I_GetSysName());
// Would be nice to use SDL_GetPlatform for this
#if defined (_WIN32) || defined (_WIN64)
CONS_Printf("Windows ");
#elif defined(__linux__)
CONS_Printf("Linux ");
#elif defined(MACOSX)
CONS_Printf("macOS ");
#elif defined(UNIXCOMMON)
CONS_Printf("Unix (Common) ");
#else
CONS_Printf("Other OS ");
#endif
// Bitness
if (sizeof(void*) == 4)
@@ -5211,14 +5210,14 @@ static void Ringslinger_OnChange(void)
static void Gravity_OnChange(void)
{
if (!M_SecretUnlocked(SECRET_PANDORA) && !netgame && !cv_debug
&& !fastcmp(cv_gravity.string, cv_gravity.defaultvalue))
&& strcmp(cv_gravity.string, cv_gravity.defaultvalue))
{
CONS_Printf(M_GetText("You haven't earned this yet.\n"));
CV_StealthSet(&cv_gravity, cv_gravity.defaultvalue);
return;
}
#ifndef NETGAME_GRAVITY
if (netgame)
if(netgame)
{
CV_StealthSet(&cv_gravity, cv_gravity.defaultvalue);
return;
@@ -5287,7 +5286,7 @@ retryscramble:
memset(&scrambleplayers, 0, sizeof(scrambleplayers));
memset(&scrambleteams, 0, sizeof(scrambleplayers));
scrambletotal = scramblecount = 0;
blue = red = newteam = playercount = 0;
blue = red = maxcomposition = newteam = playercount = 0;
repick = true;
// Put each player's node in the array.
@@ -5467,7 +5466,7 @@ static void Command_ExitLevel_f(void)
SendNetXCmd(XD_EXITLEVEL, NULL, 0);
}
static void Got_ExitLevelcmd(const UINT8 **cp, INT32 playernum)
static void Got_ExitLevelcmd(UINT8 **cp, INT32 playernum)
{
(void)cp;
@@ -5488,7 +5487,7 @@ static void Got_ExitLevelcmd(const UINT8 **cp, INT32 playernum)
G_ExitLevel();
}
static void Got_SetupVotecmd(const UINT8 **cp, INT32 playernum)
static void Got_SetupVotecmd(UINT8 **cp, INT32 playernum)
{
INT32 i;
UINT8 gt, secondgt;
@@ -5540,7 +5539,7 @@ static void Got_SetupVotecmd(const UINT8 **cp, INT32 playernum)
Y_StartVote();
}
static void Got_ModifyVotecmd(const UINT8 **cp, INT32 playernum)
static void Got_ModifyVotecmd(UINT8 **cp, INT32 playernum)
{
SINT8 voted = READSINT8(*cp);
UINT8 p = READUINT8(*cp);
@@ -5549,7 +5548,7 @@ static void Got_ModifyVotecmd(const UINT8 **cp, INT32 playernum)
votes[p] = voted;
}
static void Got_PickVotecmd(const UINT8 **cp, INT32 playernum)
static void Got_PickVotecmd(UINT8 **cp, INT32 playernum)
{
SINT8 pick = READSINT8(*cp);
SINT8 level = READSINT8(*cp);
@@ -6189,7 +6188,7 @@ static void KartEliminateLast_OnChange(void)
P_CheckRacers();
}
void Got_DiscordInfo(const UINT8 **p, INT32 playernum)
void Got_DiscordInfo(UINT8 **p, INT32 playernum)
{
if (playernum != serverplayer /*&& !IsPlayerAdmin(playernum)*/)
{
+16 -2
View File
@@ -209,8 +209,6 @@ extern consvar_t cv_betainterscreen;
extern consvar_t cv_laglesscam;
extern consvar_t cv_demoangturn;
typedef enum
{
SKINMENUTYPE_SCROLL = 0,
@@ -268,6 +266,14 @@ typedef enum
extern const char *netxcmdnames[MAXNETXCMD - 1];
#if defined(_MSC_VER)
#pragma pack(1)
#endif
#ifdef _MSC_VER
#pragma warning(disable : 4214)
#endif
//Packet composition for Command_TeamChange_f() ServerTeamChange, etc.
//bitwise structs make packing bits a little easier, but byte alignment harder?
//todo: decide whether to make the other netcommands conform, or just get rid of this experiment.
@@ -279,6 +285,10 @@ typedef struct {
UINT32 scrambled : 1; // value 0 to 1
} ATTRPACK changeteam_packet_t;
#ifdef _MSC_VER
#pragma warning(default : 4214)
#endif
typedef struct {
UINT16 l; // liitle endian
UINT16 b; // big enian
@@ -292,6 +302,10 @@ typedef union {
changeteam_value_t value;
} ATTRPACK changeteam_union;
#if defined(_MSC_VER)
#pragma pack()
#endif
// add game commands, needs cleanup
void D_RegisterServerCommands(void);
void D_RegisterClientCommands(void);
+74 -100
View File
@@ -35,8 +35,7 @@
#endif
#ifdef HAVE_CURL
#include <curl/curl.h>
#include "m_curl.h"
#include "curl/curl.h"
#endif
#include "doomdef.h"
@@ -110,18 +109,17 @@ static fileused_t transferFiles[UINT8_MAX + 1];
// Write time of file: utime
// Receiver structure
INT32 fileneedednum = 0; // Number of files needed to join the server
fileneeded_t fileneeded[MAX_WADFILES] = {}; // List of needed files
INT32 fileneedednum; // Number of files needed to join the server
fileneeded_t fileneeded[MAX_WADFILES]; // List of needed files
#ifdef HAVE_THREADS
static I_mutex downloadmutex;
#endif
char downloaddir[512] = "DOWNLOAD";
file_download_t filedownload = {};
file_download_t filedownload;
#ifdef HAVE_CURL
static CURL *http_handle;
static char curl_errbuf[CURL_ERROR_SIZE];
static CURLM *multi_handle;
static UINT32 curl_dlnow;
static UINT32 curl_dltotal;
@@ -131,7 +129,7 @@ static UINT32 curl_origfilesize;
static UINT32 curl_origtotalfilesize;
static char *curl_realname = NULL;
fileneeded_t *curl_curfile = NULL;
HTTP_login *curl_logins = NULL;
HTTP_login *curl_logins;
#endif
/** Fills a serverinfo packet with information about wad files loaded.
@@ -231,7 +229,9 @@ void D_ParseFileneeded(INT32 fileneedednum_parm, UINT8 *fileneededstr, UINT16 fi
void CL_PrepareDownloadSaveGame(const char *tmpsave)
{
#ifdef CLIENT_LOADINGSCREEN
filedownload.current = -1;
#endif
fileneedednum = 1;
fileneeded[0].status = FS_REQUESTED;
fileneeded[0].justdownloaded = false;
@@ -493,6 +493,9 @@ INT32 CL_CheckFiles(void)
size_t filestoload = 0;
boolean downloadrequired = false;
// if (M_CheckParm("-nofiles"))
// return 1;
// the first is the iwad (the main wad file)
// we don't care if it's called srb2.srb or srb2.wad.
// Never download the IWAD, just assume it's there and identical
@@ -506,9 +509,11 @@ INT32 CL_CheckFiles(void)
{
CONS_Debug(DBG_NETPLAY, "game is modified; only doing basic checks\n");
boolean have_important = false;
for (i = 0, j = mainwads+1; i < fileneedednum || j < numwadfiles;)
{
if (j < numwadfiles && !wadfiles[j]->important) // TODO: add checks for localfiles that dont contain anything "allowed" (maps and stuff like that)
if (j < numwadfiles && (!wadfiles[j]->important || wadfiles[j]->localfile))
{
// Unimportant on our side. still don't care.
++j;
@@ -517,7 +522,15 @@ INT32 CL_CheckFiles(void)
// If this test is true, we've reached the end of one file list.
if (i >= fileneedednum || j >= numwadfiles)
return 2;
{
// We are missing some of important files, or have too much
// important files.
if (have_important)
return 2;
// All checked files weren't important, don't care about them.
break;
}
// For the sake of speed, only bother with a md5 check
if (memcmp(wadfiles[j]->md5sum, fileneeded[i].md5sum, 16))
@@ -525,12 +538,14 @@ INT32 CL_CheckFiles(void)
// It's accounted for! let's keep going.
CONS_Debug(DBG_NETPLAY, "'%s' accounted for\n", fileneeded[i].filename);
have_important = true;
fileneeded[i].status = FS_OPEN;
++i;
++j;
}
return 1;
if (have_important)
return 1;
}
for (i = 0; i < fileneedednum; i++)
@@ -550,8 +565,7 @@ INT32 CL_CheckFiles(void)
for (j = mainwads+1; j < numwadfiles; j++)
{
nameonly(strcpy(wadfilename, wadfiles[j]->filename));
if (fasticmp(wadfilename, fileneeded[i].filename) &&
if (!stricmp(wadfilename, fileneeded[i].filename) &&
!memcmp(wadfiles[j]->md5sum, fileneeded[i].md5sum, 16))
{
CONS_Debug(DBG_NETPLAY, "already loaded\n");
@@ -579,6 +593,9 @@ boolean CL_LoadServerFiles(void)
{
INT32 i;
// if (M_CheckParm("-nofiles"))
// return;
for (i = 0; i < fileneedednum; i++)
{
if (fileneeded[i].status == FS_OPEN)
@@ -614,7 +631,6 @@ boolean CL_LoadServerFiles(void)
fileneeded[i].status, s);
}
}
return true;
}
@@ -666,7 +682,7 @@ static boolean SV_SendFile(INT32 node, const char *filename, UINT8 fileid)
strlcpy(wadfilename, wadfiles[wadnum]->filename, MAX_WADPATH);
nameonly(wadfilename);
if (fasticmp(wadfilename, p->id.filename))
if (!stricmp(wadfilename, p->id.filename))
{
// Copy file name with full path
strlcpy(p->id.filename, wadfiles[wadnum]->filename, MAX_WADPATH);
@@ -902,7 +918,7 @@ void SV_FileSendTicker(void)
if (ram)
{
memcpy(p->data, &f->id.ram[transfer[i].position], size);
M_Memcpy(p->data, &f->id.ram[transfer[i].position], size);
}
else if (fread(p->data, 1, size, transferFiles[f->fileid].file) != size)
{
@@ -947,17 +963,17 @@ void Got_Filetxpak(void)
char *filename = file->filename;
static INT32 filetime = 0;
if ((fastcmp(filename, "srb2.srb")
//|| fastcmp(filename, "srb2.wad")
//|| fastcmp(filename, "patch.dta")
//|| fastcmp(filename, "music.dta")
|| fastcmp(filename, "gfx.kart")
|| fastcmp(filename, "textures.kart")
|| fastcmp(filename, "chars.kart")
|| fastcmp(filename, "maps.kart")
|| fastcmp(filename, "sounds.kart")
|| fastcmp(filename, "music.kart")
|| fastcmp(filename, "patch.kart")
if (!(strcmp(filename, "srb2.srb")
//&& strcmp(filename, "srb2.wad")
//&& strcmp(filename, "patch.dta")
//&& strcmp(filename, "music.dta")
&& strcmp(filename, "gfx.kart")
&& strcmp(filename, "textures.kart")
&& strcmp(filename, "chars.kart")
&& strcmp(filename, "maps.kart")
&& strcmp(filename, "sounds.kart")
&& strcmp(filename, "music.kart")
&& strcmp(filename, "patch.kart")
))
I_Error("Tried to download \"%s\"", filename);
@@ -1006,16 +1022,17 @@ void Got_Filetxpak(void)
file->file = NULL;
file->status = FS_FOUND;
file->justdownloaded = true;
CONS_Printf(M_GetText("Downloading %s...(done)\n"), filename);
CONS_Printf(M_GetText("Downloading %s...(done)\n"),
filename);
#ifndef NONET
filedownload.completednum++;
filedownload.completedsize += file->totalsize;
#endif
}
}
else if (!file->justdownloaded)
{
const char *s;
switch(file->status)
{
case FS_NOTFOUND:
@@ -1034,7 +1051,6 @@ void Got_Filetxpak(void)
s = "unknown";
break;
}
I_Error("Received a file not requested (file id: %d, file status: %s)\n", filenum, s);
}
@@ -1045,7 +1061,9 @@ void Got_Filetxpak(void)
filetime = 0;
}
#ifdef CLIENT_LOADINGSCREEN
filedownload.current = filenum;
#endif
}
/** \brief Checks if a node is downloading a file
@@ -1104,7 +1122,7 @@ void nameonly(char *s)
ns = &(s[j+1]);
len = strlen(ns);
#if 0
memcpy(s, ns, len+1);
M_Memcpy(s, ns, len+1);
#else
memmove(s, ns, len+1);
#endif
@@ -1198,7 +1216,7 @@ filestatus_t findfile(char *filename, const UINT8 *wantedmd5sum, boolean complet
}
// next, check SRB2's "home" directory (if non-'.')
if (!fastcmp(srb2home, "."))
if (strcmp(srb2home, "."))
{
homecheck = filesearch(filename, srb2home, wantedmd5sum, completepath, 10);
@@ -1210,7 +1228,7 @@ filestatus_t findfile(char *filename, const UINT8 *wantedmd5sum, boolean complet
}
// next, check SRB2's "path" directory (also if non-'.')
if (!fastcmp(srb2path, "."))
if (strcmp(srb2path, "."))
{
homecheck = filesearch(filename, srb2path, wantedmd5sum, completepath, 10);
@@ -1291,7 +1309,6 @@ static int curlprogress_callback(void *clientp, double dltotal, double dlnow, do
void CURLPrepareFile(const char* url, int dfilenum)
{
HTTP_login *login;
CURLcode cc;
#ifdef PARANOIA
if (M_CheckParm("-nodownload"))
@@ -1300,33 +1317,14 @@ void CURLPrepareFile(const char* url, int dfilenum)
if (!multi_handle)
{
cc = curl_global_init(CURL_GLOBAL_ALL);
if (cc < 0)
{
I_OutputMsg("libcurl: curl_global_init() returned %d\n", cc);
}
else
{
multi_handle = curl_multi_init();
}
if (!multi_handle)
{
I_OutputMsg("libcurl: curl_multi_init() failed\n");
curl_global_cleanup();
return;
}
curl_global_init(CURL_GLOBAL_ALL);
multi_handle = curl_multi_init();
}
http_handle = curl_easy_init();
if (http_handle)
if (http_handle && multi_handle)
{
CURLMcode mc;
cc = curl_easy_setopt(http_handle, CURLOPT_ERRORBUFFER, curl_errbuf);
if (cc != CURLE_OK) I_OutputMsg("libcurl: CURLOPT_ERRORBUFFER failed\n");
curl_errbuf[0] = 0x00;
I_mkdir(downloaddir, 0755);
curl_curfile = &fileneeded[dfilenum];
@@ -1336,38 +1334,31 @@ void CURLPrepareFile(const char* url, int dfilenum)
curl_origfilesize = curl_curfile->currentsize;
curl_origtotalfilesize = curl_curfile->totalsize;
cc = curl_easy_setopt(http_handle, CURLOPT_URL, va("%s/%s", url, curl_realname));
if (cc != CURLE_OK) I_OutputMsg("libcurl: %s\n", curl_errbuf);
curl_easy_setopt(http_handle, CURLOPT_URL, va("%s/%s", url, curl_realname));
// Only allow HTTP and HTTPS
#if (LIBCURL_VERSION_MAJOR <= 7) && (LIBCURL_VERSION_MINOR < 85)
cc = curl_easy_setopt(http_handle, CURLOPT_PROTOCOLS, CURLPROTO_HTTP|CURLPROTO_HTTPS);
curl_easy_setopt(http_handle, CURLOPT_PROTOCOLS, CURLPROTO_HTTP|CURLPROTO_HTTPS);
#else
cc = curl_easy_setopt(http_handle, CURLOPT_PROTOCOLS_STR, "http,https");
curl_easy_setopt(http_handle, CURLOPT_PROTOCOLS_STR, "http,https");
#endif
if (cc != CURLE_OK) I_OutputMsg("libcurl: %s\n", curl_errbuf);
// Set user agent, as some servers won't accept invalid user agents.
cc = curl_easy_setopt(http_handle, CURLOPT_USERAGENT, va("SRB2Kart/v%d.%d", VERSION, SUBVERSION));
if (cc != CURLE_OK) I_OutputMsg("libcurl: %s\n", curl_errbuf);
curl_easy_setopt(http_handle, CURLOPT_USERAGENT, va("SRB2Kart/v%d.%d", VERSION, SUBVERSION)); // Set user agent as some servers won't accept invalid user agents.
// Authenticate if the user so wishes
login = CURLGetLogin(url, NULL);
if (login)
{
cc = curl_easy_setopt(http_handle, CURLOPT_USERPWD, login->auth);
if (cc != CURLE_OK) I_OutputMsg("libcurl: %s\n", curl_errbuf);
curl_easy_setopt(http_handle, CURLOPT_USERPWD, login->auth);
}
// Follow a redirect request, if sent by the server.
cc = curl_easy_setopt(http_handle, CURLOPT_FOLLOWLOCATION, 1L);
if (cc != CURLE_OK) I_OutputMsg("libcurl: %s\n", curl_errbuf);
curl_easy_setopt(http_handle, CURLOPT_FOLLOWLOCATION, 1L);
cc = curl_easy_setopt(http_handle, CURLOPT_FAILONERROR, 1L);
if (cc != CURLE_OK) I_OutputMsg("libcurl: %s\n", curl_errbuf);
curl_easy_setopt(http_handle, CURLOPT_FAILONERROR, 1L);
CONS_Printf("Downloading addon \"%s\" from %s\n", curl_realname, url);
CONS_Printf("Downloading %s from %s\n", curl_realname, url);
strcatbf(curl_curfile->filename, downloaddir, "/");
curl_curfile->file = fopen(curl_curfile->filename, "wb");
@@ -1386,33 +1377,19 @@ void CURLPrepareFile(const char* url, int dfilenum)
return;
}
cc = curl_easy_setopt(http_handle, CURLOPT_WRITEDATA, curl_curfile->file);
if (cc != CURLE_OK) I_OutputMsg("libcurl: %s\n", curl_errbuf);
cc = curl_easy_setopt(http_handle, CURLOPT_WRITEFUNCTION, curlwrite_data);
if (cc != CURLE_OK) I_OutputMsg("libcurl: %s\n", curl_errbuf);
cc = curl_easy_setopt(http_handle, CURLOPT_NOPROGRESS, 0L);
if (cc != CURLE_OK) I_OutputMsg("libcurl: %s\n", curl_errbuf);
curl_easy_setopt(http_handle, CURLOPT_WRITEDATA, curl_curfile->file);
curl_easy_setopt(http_handle, CURLOPT_WRITEFUNCTION, curlwrite_data);
curl_easy_setopt(http_handle, CURLOPT_NOPROGRESS, 0L);
#ifdef XFERINFOFUNCTION
cc = curl_easy_setopt(http_handle, CURLOPT_XFERINFOFUNCTION, curlprogress_callbackx);
if (cc != CURLE_OK) I_OutputMsg("libcurl: %s\n", curl_errbuf);
curl_easy_setopt(http_handle, CURLOPT_XFERINFOFUNCTION, curlprogress_callbackx);
#else
cc = curl_easy_setopt(http_handle, CURLOPT_PROGRESSFUNCTION, curlprogress_callback);
if (cc != CURLE_OK) I_OutputMsg("libcurl: %s\n", curl_errbuf);
curl_easy_setopt(http_handle, CURLOPT_PROGRESSFUNCTION, curlprogress_callback);
#endif
M_SetCURLArgs(http_handle, curl_errbuf);
curl_curfile->status = FS_DOWNLOADING;
curl_multi_add_handle(multi_handle, http_handle);
mc = curl_multi_add_handle(multi_handle, http_handle);
if (mc != CURLM_OK) I_OutputMsg("libcurl: %s\n", curl_multi_strerror(mc));
mc = curl_multi_perform(multi_handle, &curl_runninghandles);
if (mc != CURLM_OK) I_OutputMsg("libcurl: %s\n", curl_multi_strerror(mc));
curl_multi_perform(multi_handle, &curl_runninghandles);
curl_starttime = time(NULL);
filedownload.current = dfilenum;
@@ -1454,15 +1431,14 @@ void CURLGetFile(void)
{
if (curl_runninghandles)
{
mc = curl_multi_perform(multi_handle, &curl_runninghandles);
if (mc != CURLM_OK) I_OutputMsg("libcurl: %s\n", curl_multi_strerror(mc));
curl_multi_perform(multi_handle, &curl_runninghandles);
/* wait for activity, timeout or "nothing" */
mc = curl_multi_wait(multi_handle, NULL, 0, 1000, NULL);
if (mc != CURLM_OK)
{
CONS_Alert(CONS_WARNING, "curl_multi_wait() failed: %s.\n", curl_multi_strerror(mc));
CONS_Alert(CONS_WARNING, "curl_multi_wait() failed, code %d.\n", mc);
continue;
}
@@ -1520,8 +1496,7 @@ void CURLGetFile(void)
Z_Free(filename);
curl_curfile->file = NULL;
filedownload.remaining--;
mc = curl_multi_remove_handle(multi_handle, e);
if (mc != CURLM_OK) I_OutputMsg("libcurl: %s\n", curl_multi_strerror(mc));
curl_multi_remove_handle(multi_handle, e);
curl_easy_cleanup(e);
if (!filedownload.remaining)
@@ -1532,8 +1507,7 @@ void CURLGetFile(void)
if (!filedownload.remaining || !filedownload.http_running)
{
mc = curl_multi_cleanup(multi_handle);
if (mc != CURLM_OK) I_OutputMsg("libcurl: %s\n", curl_multi_strerror(mc));
curl_multi_cleanup(multi_handle);
curl_global_cleanup();
multi_handle = NULL;
}
@@ -1555,7 +1529,7 @@ CURLGetLogin (const char *url, HTTP_login ***return_prev_next)
( login = (*prev_next));
prev_next = &login->next
){
if (fastcmp(login->url, url) != 0)
if (strcmp(login->url, url) == 0)
{
if (return_prev_next)
(*return_prev_next) = prev_next;
+5
View File
@@ -59,15 +59,19 @@ extern char downloaddir[512];
typedef struct
{
#ifdef CLIENT_LOADINGSCREEN
INT32 current;
INT32 completednum;
UINT32 completedsize;
INT32 totalnum;
UINT32 totalsize;
#endif
#ifdef HAVE_CURL
INT32 remaining;
boolean http_failed;
boolean http_running;
char http_source[MAX_MIRROR_LENGTH+1];
#endif
} file_download_t;
@@ -75,6 +79,7 @@ typedef struct
extern file_download_t filedownload;
#ifdef HAVE_CURL
typedef struct HTTP_login HTTP_login;
extern struct HTTP_login
+13 -30
View File
@@ -22,7 +22,6 @@
#ifdef HAVE_CURL
#include <curl/curl.h>
#include "m_curl.h"
#endif
#include "doomdef.h"
@@ -208,15 +207,14 @@ void D_SetupProtocol(void)
fp = fopen(protocolfile, "a+");
result = fgets(buffer, PATH_MAX, fp);
if (result)
{
if (!fastcmp(buffer, "no"))
{
fclose(fp);
return;
}
else if (fastcmp(buffer, exe_path))
if (strcmp(buffer, "no") == 0)
{
fclose(fp);
return;
}
else if (strcmp(buffer, exe_path) != 0)
{
// overwrite
fclose(fp);
@@ -234,7 +232,6 @@ void D_SetupProtocol(void)
else
fprintf(fp, "no");
}
fclose(fp);
}
@@ -258,10 +255,8 @@ void D_CreateProtocol(void)
}
#ifdef HAVE_CURL
static char curl_errbuf[CURL_ERROR_SIZE];
void D_DownloadReplay(const char *url, const char *path)
{
FILE *fp = NULL;
CURL *curl;
CURLcode cc;
@@ -269,29 +264,17 @@ void D_DownloadReplay(const char *url, const char *path)
if (!curl)
I_Error("Unable to download replay. Error initializing CURL.");
cc = curl_easy_setopt(curl, CURLOPT_ERRORBUFFER, curl_errbuf);
if (cc != CURLE_OK) I_OutputMsg("libcurl: CURLOPT_ERRORBUFFER failed\n");
curl_errbuf[0] = 0x00;
fp = fopen(path, "wb");
CONS_Printf("REPLAY: URL: %s\n", url);
curl_easy_setopt(curl, CURLOPT_URL, url);
curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, curlwrite_data);
curl_easy_setopt(curl, CURLOPT_WRITEDATA, fp);
cc = curl_easy_setopt(curl, CURLOPT_URL, url);
if (cc != CURLE_OK) I_OutputMsg("libcurl: %s\n", curl_errbuf);
cc = curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, curlwrite_data);
if (cc != CURLE_OK) I_OutputMsg("libcurl: %s\n", curl_errbuf);
cc = curl_easy_setopt(curl, CURLOPT_WRITEDATA, fp);
if (cc != CURLE_OK) I_OutputMsg("libcurl: %s\n", curl_errbuf);
M_SetCURLArgs(curl, curl_errbuf);
cc = curl_easy_perform(curl);
cc = curl_easy_perform(curl);
if (cc != CURLE_OK)
I_Error("Unable to download replay. libcurl: %s.", curl_errbuf);
I_Error("Unable to download replay. URL gave response code %u.", cc);
curl_easy_cleanup(curl);
fclose(fp);
curl_easy_cleanup(curl);
fclose(fp);
}
#endif
-5
View File
@@ -9,9 +9,6 @@
/// \file d_protocol.h
/// \brief srb2kart:// protocol stuff
#ifndef __D_PROTOCOL__
#define __D_PROTOCOL__
void D_SetupProtocol(void);
void D_CreateProtocol(void);
@@ -19,5 +16,3 @@ void D_DeleteProtocol(void);
#ifdef HAVE_CURL
void D_DownloadReplay(const char *url, const char *path);
#endif
#endif //__D_PROTOCOL__
+8
View File
@@ -50,6 +50,10 @@ typedef enum
#define TICCMD_RECEIVED 1
#define TICCMD_XY 2
#if defined(_MSC_VER)
#pragma pack(1)
#endif
typedef struct
{
SINT8 forwardmove; // -MAXPLMOVE to MAXPLMOVE (50)
@@ -61,4 +65,8 @@ typedef struct
UINT8 latency; // Netgames: how many tics ago was this ticcmd generated from this player's end?
} ATTRPACK ticcmd_t;
#if defined(_MSC_VER)
#pragma pack()
#endif
#endif
+18 -6
View File
@@ -138,7 +138,8 @@ static void InitLogging(void)
if (M_IsPathAbsolute(reldir))
{
left = snprintf(logfilename, sizeof logfilename, "%s"PATHSEP, reldir);
left = snprintf(logfilename, sizeof logfilename,
"%s"PATHSEP, reldir);
}
else
#ifdef DEFAULTDIR
@@ -154,10 +155,13 @@ static void InitLogging(void)
"."PATHSEP"%s"PATHSEP, reldir);
}
strftime(&logfilename[left], sizeof logfilename - left, format, timeinfo);
strftime(&logfilename[left], sizeof logfilename - left,
format, timeinfo);
}
M_MkdirEachUntil(logfilename, M_PathParts(logdir) - 1, M_PathParts(logfilename) - 1, 0755);
M_MkdirEachUntil(logfilename,
M_PathParts(logdir) - 1,
M_PathParts(logfilename) - 1, 0755);
#if defined (__unix__) || defined(__APPLE__) || defined (UNIXCOMMON)
logstream = fopen(logfilename, "w");
@@ -209,9 +213,12 @@ int main(int argc, char **argv)
//I_OutputMsg("I_StartupSystem() ...\n");
I_StartupSystem();
#ifdef HAVE_DRMINGW
InitDrMingw();
#if defined (_WIN32)
{
#ifdef DRMINGW
ExcHndlInit();
#endif
}
#endif
// startup SRB2
@@ -221,6 +228,11 @@ int main(int argc, char **argv)
// never return
D_SRB2Loop();
#ifdef BUGTRAP
// This is safe even if BT didn't start.
ShutdownBugTrap();
#endif
// return to OS
return 0;
}
+363 -363
View File
@@ -54,6 +54,8 @@ typedef LPVOID (WINAPI *p_MapViewOfFile) (HANDLE, DWORD, DWORD, DWORD, SIZE_T);
#include <string.h>
#ifdef __GNUC__
#include <unistd.h>
#elif defined (_MSC_VER)
#include <direct.h>
#endif
#if defined (__unix__) || defined (UNIXCOMMON)
#include <fcntl.h>
@@ -64,6 +66,10 @@ typedef LPVOID (WINAPI *p_MapViewOfFile) (HANDLE, DWORD, DWORD, DWORD, SIZE_T);
#include <conio.h>
#endif
#ifdef _MSC_VER
#pragma warning(disable : 4214 4244)
#endif
#if defined (__unix__) || defined(__APPLE__) || (defined (UNIXCOMMON) && !defined (__HAIKU__))
#include <time.h>
#if defined (__linux__)
@@ -174,10 +180,293 @@ static char returnWadPath[256];
#include "../byteptr.h"
#endif
#ifdef HAVE_LIBBACKTRACE
#include <backtrace.h>
// TODO - move this to some header file instead
extern struct backtrace_state *bt_state;
typedef struct bt_crash_reason_s {
enum {
BTCRASH_SIGNAL,
BTCRASH_ERRORMSG,
} type;
union {
INT32 signal;
const char *errormsg;
} value;
} bt_crash_reason_t;
#define BT_CRASH_REASON_SIGNAL(num) (bt_crash_reason_t){ .type = BTCRASH_SIGNAL, .value = { .signal = num } }
#define BT_CRASH_REASON_ERRORMSG(msg) (bt_crash_reason_t){ .type = BTCRASH_ERRORMSG, .value = { .errormsg = msg } }
static void printsignal(FILE *fp, INT32 num)
{
switch (num)
{
case SIGILL:
fprintf(fp, "SIGILL - illegal instruction - invalid function image");
break;
case SIGFPE:
fprintf(fp, "SIGFPE - mathematical exception");
break;
case SIGSEGV:
fprintf(fp, "SIGSEGV - segment violation");
break;
case SIGABRT:
fprintf(fp, "SIGABRT - abnormal termination triggered by abort call");
break;
default:
fprintf(fp, "Signal number %d", num);
}
}
typedef struct bt_out_buf_s {
boolean error;
char *pos;
size_t size;
} bt_out_buf_t;
static void bt_syminfo_cb(void *data, uintptr_t pc, const char *symname, uintptr_t symval, uintptr_t symsize)
{
(void)symval;
(void)symsize;
bt_out_buf_t *buf = (bt_out_buf_t*)data;
if (!symname)
symname = "???";
int n = snprintf(buf->pos, buf->size, "%p %s\n", (void*)pc, symname);
if (n <= 0)
{
buf->size = 0;
return;
}
buf->pos += n;
buf->size -= n;
}
static int bt_simple_cb(void *data, uintptr_t pc)
{
bt_out_buf_t *buf = (bt_out_buf_t*)data;
backtrace_syminfo(bt_state, pc, bt_syminfo_cb, NULL, data);
if (!buf->size) return 1;
return 0;
}
static int bt_full_cb(void *data, uintptr_t pc, const char *filename, int lineno, const char *function)
{
bt_out_buf_t *buf = (bt_out_buf_t*)data;
if (!filename) filename = "???";
if (!function) function = "???";
int n = snprintf(buf->pos, buf->size, "%p %s\n\t%s:%d\n", (void*)pc, function, filename, lineno);
if (n <= 0) return 1;
buf->pos += n;
buf->size -= n;
if (!buf->size) return 1;
return 0;
}
static void bt_error_cb(void *data, const char *msg, int errnum)
{
(void)msg; // We don't need this
bt_out_buf_t *buf = (bt_out_buf_t*)data;
// No debug info
if (errnum == -1)
buf->error = true;
}
static void write_backtrace(bt_crash_reason_t reason)
{
FILE *out = fopen(va("%s" PATHSEP "%s", srb2home, "srb2kart-crash-log.txt"), "a");
time_t rawtime;
struct tm *timeinfo;
const size_t BUFSIZE = 8192;
char backtrace[BUFSIZE];
bt_out_buf_t buf;
buf.error = false;
buf.pos = backtrace;
buf.size = BUFSIZE;
if (!out)
{
fprintf(stderr, "\nWARNING: Couldn't open crash log for writing! Make sure your permissions are correct. Please save the below report!\n");
out = stderr;
}
// Get the current time as a string.
time(&rawtime);
timeinfo = localtime(&rawtime);
fprintf(out, "------------------------\n\n");
fprintf(out, "Program name: %s %s\n", SRB2APPLICATION, VERSIONSTRING);
if (compdate && comptime && comprevision && compbranch)
fprintf(out, "Compiled: %s %s, commit %s, branch %s\n", compdate, comptime, comprevision, compbranch);
if (gamestate == GS_LEVEL)
{
char *title = G_BuildMapTitle(gamemap);
if (title)
{
fprintf(out, "Game map: %s (%s)\n", title, G_BuildMapName(gamemap));
Z_Free(title);
}
else
fprintf(out, "Game map: %s\n", G_BuildMapName(gamemap));
}
fprintf(out, "Time of crash: %s\n", asctime(timeinfo));
fprintf(out, "Caused by: ");
switch (reason.type)
{
case BTCRASH_SIGNAL:
printsignal(out, reason.value.signal);
break;
case BTCRASH_ERRORMSG:
fprintf(out, "%s", reason.value.errormsg);
break;
}
fprintf(out, "\nBacktrace:\n");
// Try to get full backtrace, it will print files and line numbers
backtrace_full(bt_state, 2, bt_full_cb, bt_error_cb, (void*)&buf);
if (buf.error)
{
// Fall back to simple backtrace, only prints function names
backtrace_simple(bt_state, 2, bt_simple_cb, NULL, (void*)&buf);
}
fputs(backtrace, out);
if (out != stderr)
{
fclose(out);
fprintf(stderr, "Crash report created, find srb2kart-crash-log.txt in your SRB2Kart directory\n");
}
}
#endif
boolean consolevent = false;
boolean framebuffer = false;
boolean g_in_exiting_signal_handler = false;
UINT8 keyboard_started = false;
static void I_ReportSignal(int num, int coredumped)
{
//static char msg[] = "oh no! back to reality!\r\n";
const char * sigmsg;
char msg[256];
switch (num)
{
// case SIGINT:
// sigmsg = "SIGINT - interrupted";
// break;
case SIGILL:
sigmsg = "SIGILL - illegal instruction - invalid function image";
break;
case SIGFPE:
sigmsg = "SIGFPE - mathematical exception";
break;
case SIGSEGV:
sigmsg = "SIGSEGV - segment violation";
break;
// case SIGTERM:
// sigmsg = "SIGTERM - Software termination signal from kill";
// break;
// case SIGBREAK:
// sigmsg = "SIGBREAK - Ctrl-Break sequence";
// break;
case SIGABRT:
sigmsg = "SIGABRT - abnormal termination triggered by abort call";
break;
default:
sprintf(msg,"signal number %d", num);
if (coredumped)
sigmsg = 0;
else
sigmsg = msg;
}
if (coredumped)
{
if (sigmsg)
sprintf(msg, "%s (core dumped)", sigmsg);
else
strcat(msg, " (core dumped)");
}
else
{
sprintf(msg, "%s", sigmsg);
}
#ifdef HAVE_LIBBACKTRACE
strncat(msg, "\n\nCrash report has been saved into srb2kart-crash-log.txt", 255);
#elif defined(_WIN32) && !defined(__MINGW64__)
strncat(msg, "\n\nCrash report has been saved into srb2kart.rpt", 255);
#endif
I_OutputMsg("\nProcess killed by signal: %s\n\n", sigmsg);
}
#ifndef NEWSIGNALHANDLER
FUNCNORETURN static ATTRNORETURN void signal_handler(INT32 num)
{
g_in_exiting_signal_handler = true;
D_QuitNetGame(); // Fix server freezes
#ifdef HAVE_LIBBACKTRACE
write_backtrace(BT_CRASH_REASON_SIGNAL(num));
#endif
if (demo.recording)
G_SaveDemo();
I_ReportSignal(num, 0);
I_ShutdownSystem();
signal(num, SIG_DFL); //default signal action
raise(num);
I_Quit();
}
#endif
FUNCNORETURN static ATTRNORETURN void quit_handler(int num)
{
signal(num, SIG_DFL); //default signal action
raise(num);
I_Quit();
}
#ifdef HAVE_TERMIOS
// TERMIOS console code from Quake3: thank you!
boolean stdin_active = true;
@@ -206,6 +495,16 @@ static struct termios tty_tc;
// so we provide tty_Clear and tty_Show to be called before and after a stdout or stderr output
// =============================================================
// flush stdin, I suspect some terminals are sending a LOT of garbage
// FIXME TTimo relevant?
#if 0
static inline void tty_FlushIn(void)
{
char key;
while (read(STDIN_FILENO, &key, 1)!=-1);
}
#endif
// do a backspace
// TTimo NOTE: it seems on some terminals just sending '\b' is not enough
// so for now, in any case we send "\b \b" .. yeah well ..
@@ -500,6 +799,55 @@ static inline void I_StartupConsole(void)
static inline void I_ShutdownConsole(void){}
#endif
//
// StartupKeyboard
//
static void I_RegisterSignals (void)
{
#ifdef SIGINT
signal(SIGINT , quit_handler);
#endif
#ifdef SIGBREAK
signal(SIGBREAK , quit_handler);
#endif
#ifdef SIGTERM
signal(SIGTERM , quit_handler);
#endif
// If these defines don't exist,
// then compilation would have failed above us...
#ifndef NEWSIGNALHANDLER
signal(SIGILL , signal_handler);
signal(SIGSEGV , signal_handler);
signal(SIGABRT , signal_handler);
signal(SIGFPE , signal_handler);
#endif
}
#ifdef NEWSIGNALHANDLER
static void signal_handler_child(INT32 num)
{
#ifdef HAVE_LIBBACKTRACE
write_backtrace(BT_CRASH_REASON_SIGNAL(num));
#endif
if (demo.recording)
G_SaveDemo();
signal(num, SIG_DFL); //default signal action
raise(num);
}
static void I_RegisterChildSignals(void)
{
// If these defines don't exist,
// then compilation would have failed above us...
signal(SIGILL , signal_handler_child);
signal(SIGSEGV , signal_handler_child);
signal(SIGABRT , signal_handler_child);
signal(SIGFPE , signal_handler_child);
}
#endif
//
//I_OutputMsg
@@ -526,6 +874,10 @@ void I_OutputMsg(const char *fmt, ...)
DEFAULTFONTBGR, DEFAULTFONTBGG, DEFAULTFONTBGB, DEFAULTFONTBGA, txt);
#endif
#if defined (_WIN32) && defined (_MSC_VER)
OutputDebugStringA(txt);
#endif
len = strlen(txt);
#ifdef LOGMESSAGES
@@ -970,317 +1322,6 @@ void I_SleepDuration(precise_t duration)
#endif
}
boolean g_in_exiting_signal_handler = false;
static void I_PrintSignal(INT32 signal_num, boolean core_dumped, char *signal_msg)
{
const char *sigmsg;
switch (signal_num)
{
#ifdef SIGINT
case SIGINT:
sigmsg = ("SIGINT - SRB2Kart-Saturn was interrupted prematurely by the user.");
break;
#endif
case SIGILL: // illegal instruction - invalid function image
sigmsg = ("SIGILL - SRB2Kart-Saturn has attempted to execute an illegal instruction and needs to close.");
break;
case SIGFPE: // mathematical exception
sigmsg = ("SIGFPE - SRB2Kart-Saturn has encountered a mathematical exception and needs to close.");
break;
case SIGSEGV: // segment violation
sigmsg = ("SIGSEGV - SRB2Kart-Saturn has attempted to access a memory location that it shouldn't and needs to close.");
break;
#ifdef SIGTERM
case SIGTERM: // Software termination signal from kill
sigmsg = ("SIGTERM - SRB2Kart-Saturn was terminated by a kill signal.");
break;
#endif
#ifdef SIGBREAK
case SIGBREAK: // Ctrl-Break sequence
sigmsg =("SIGBREAK - SRB2Kart-Saturn was terminated by a Ctrl-Break sequence.")
break;
#endif
case SIGABRT: // abnormal termination triggered by abort call
sigmsg = ("SIGABRT - SRB2Kart-Saturn was terminated by an abort signal.");
break;
default:
sprintf(signal_msg, "Signal number %d", signal_num);
sigmsg = (core_dumped ? "Unknown signal" : signal_msg);
break;
}
if (core_dumped)
{
if (sigmsg)
sprintf(signal_msg, "%s (core dumped)", sigmsg);
else
strcat(signal_msg, " (core dumped)");
}
else
{
sprintf(signal_msg, "%s", sigmsg);
}
}
static void I_ReportSignal(int num, int coredumped)
{
char sigmsg[512];
I_PrintSignal(num, coredumped, sigmsg);
size_t len = strlen(sigmsg);
snprintf(sigmsg + len, sizeof(sigmsg) - len, "\n\nCrash report has been saved into %s", CRASH_LOGFILE_NAME);
I_OutputMsg("\nProcess killed by signal: %s\n\n", sigmsg);
}
#ifndef NEWSIGNALHANDLER
FUNCNORETURN static ATTRNORETURN void signal_handler(INT32 num)
{
g_in_exiting_signal_handler = true;
D_QuitNetGame(); // Fix server freezes
#ifdef HAVE_LIBBACKTRACE
write_backtrace(BT_CRASH_REASON_SIGNAL(num));
#endif
I_ReportSignal(num, 0);
I_ShutdownSystem();
signal(num, SIG_DFL); //default signal action
raise(num);
I_Quit();
}
#endif
FUNCNORETURN static ATTRNORETURN void quit_handler(int num)
{
signal(num, SIG_DFL); //default signal action
raise(num);
I_Quit();
}
#ifdef HAVE_LIBBACKTRACE
#include <backtrace.h>
// TODO - move this to some header file instead
extern struct backtrace_state *bt_state;
typedef struct bt_crash_reason_s {
enum {
BTCRASH_SIGNAL,
BTCRASH_ERRORMSG,
} type;
union {
INT32 signal;
const char *errormsg;
} value;
} bt_crash_reason_t;
#define BT_CRASH_REASON_SIGNAL(num) (bt_crash_reason_t){ .type = BTCRASH_SIGNAL, .value = { .signal = num } }
#define BT_CRASH_REASON_ERRORMSG(msg) (bt_crash_reason_t){ .type = BTCRASH_ERRORMSG, .value = { .errormsg = msg } }
typedef struct bt_out_buf_s {
boolean error;
char *pos;
size_t size;
} bt_out_buf_t;
static void bt_syminfo_cb(void *data, uintptr_t pc, const char *symname, uintptr_t symval, uintptr_t symsize)
{
(void)symval;
(void)symsize;
bt_out_buf_t *buf = (bt_out_buf_t*)data;
if (!symname)
symname = "???";
int n = snprintf(buf->pos, buf->size, "%p %s\n", (void*)pc, symname);
if (n <= 0)
{
buf->size = 0;
return;
}
buf->pos += n;
buf->size -= n;
}
static int bt_simple_cb(void *data, uintptr_t pc)
{
bt_out_buf_t *buf = (bt_out_buf_t*)data;
backtrace_syminfo(bt_state, pc, bt_syminfo_cb, NULL, data);
if (!buf->size) return 1;
return 0;
}
static int bt_full_cb(void *data, uintptr_t pc, const char *filename, int lineno, const char *function)
{
bt_out_buf_t *buf = (bt_out_buf_t*)data;
if (!filename) filename = "???";
if (!function) function = "???";
int n = snprintf(buf->pos, buf->size, "%p %s\n\t%s:%d\n", (void*)pc, function, filename, lineno);
if (n <= 0) return 1;
buf->pos += n;
buf->size -= n;
if (!buf->size) return 1;
return 0;
}
static void bt_error_cb(void *data, const char *msg, int errnum)
{
(void)msg; // We don't need this
bt_out_buf_t *buf = (bt_out_buf_t*)data;
// No debug info
if (errnum == -1)
buf->error = true;
}
static void write_backtrace(bt_crash_reason_t reason)
{
char sig_msg[512];
const char *filename = va("%s" PATHSEP CRASH_LOGFILE_NAME, srb2home);
FILE *out = fopen(filename, "a+");
time_t rawtime;
struct tm *timeinfo;
const size_t BUFSIZE = 8192;
char backtrace[BUFSIZE];
bt_out_buf_t buf;
buf.error = false;
buf.pos = backtrace;
buf.size = BUFSIZE;
if (!out)
{
fprintf(stderr, "\nWARNING: Couldn't open crash log for writing! Make sure your permissions are correct. Please save the below report!\n");
out = stderr;
}
// Get the current time as a string.
time(&rawtime);
timeinfo = localtime(&rawtime);
fprintf(out, "------------------------\n\n");
fprintf(out, "Program name: %s %s\n", SRB2APPLICATION, VERSIONSTRING);
fprintf(out, "Dedicated build\n");
fprintf(out, "Platform: %s\n", I_GetSysName());
if (compdate && comptime && comprevision && compbranch)
fprintf(out, "Compiled: %s %s, commit %s, branch %s\n", compdate, comptime, comprevision, compbranch);
if (gamestate == GS_LEVEL && gamemap)
{
char *title = G_BuildMapTitle(gamemap);
if (title)
{
fprintf(out, "Game map: %s (%s)\n", title, G_BuildMapName(gamemap));
Z_Free(title);
}
else
fprintf(out, "Game map: %s\n", G_BuildMapName(gamemap));
}
fprintf(out, "Time of crash: %s\n", asctime(timeinfo));
fprintf(out, "Caused by: ");
switch (reason.type)
{
case BTCRASH_SIGNAL:
I_PrintSignal(reason.value.signal, false, sig_msg);
fprintf(out, "%s", sig_msg);
break;
case BTCRASH_ERRORMSG:
fprintf(out, "%s", reason.value.errormsg);
break;
}
fprintf(out, "\nBacktrace:\n");
// Try to get full backtrace, it will print files and line numbers
backtrace_full(bt_state, 2, bt_full_cb, bt_error_cb, (void*)&buf);
if (buf.error)
{
// Fall back to simple backtrace, only prints function names
backtrace_simple(bt_state, 2, bt_simple_cb, NULL, (void*)&buf);
}
fputs(backtrace, out);
if (out != stderr)
{
fclose(out);
fprintf(stderr, "Crash report created, find %s in your SRB2Kart directory\n", CRASH_LOGFILE_NAME);
}
}
#endif
static void I_RegisterSignals(void)
{
#ifdef SIGINT
signal(SIGINT, quit_handler);
#endif
#ifdef SIGBREAK
signal(SIGBREAK, quit_handler);
#endif
#ifdef SIGTERM
signal(SIGTERM, quit_handler);
#endif
#ifndef NEWSIGNALHANDLER
// If these defines don't exist,
// then compilation would have failed above us...
signal(SIGILL, signal_handler);
signal(SIGSEGV, signal_handler);
signal(SIGABRT, signal_handler);
signal(SIGFPE, signal_handler);
#endif
}
#ifdef NEWSIGNALHANDLER
static void signal_handler_child(INT32 num)
{
g_in_exiting_signal_handler = true;
#ifdef HAVE_LIBBACKTRACE
write_backtrace(BT_CRASH_REASON_SIGNAL(num));
#endif
signal(num, SIG_DFL); // default signal action
raise(num);
}
static void I_RegisterChildSignals(void)
{
// If these defines don't exist,
// then compilation would have failed above us...
signal(SIGILL, signal_handler_child);
signal(SIGSEGV, signal_handler_child);
signal(SIGABRT, signal_handler_child);
signal(SIGFPE, signal_handler_child);
}
#endif
#ifdef NEWSIGNALHANDLER
FUNCNORETURN static ATTRNORETURN void newsignalhandler_Warn(const char *pr)
{
@@ -1385,12 +1426,13 @@ void I_Quit(void)
static boolean quiting = false;
/* prevent recursive I_Quit() */
if (quiting)
goto death;
if (quiting) goto death;
quiting = false;
I_ShutdownConsole();
M_SaveConfig(NULL); //save game config, cvars..
#ifndef NONET
D_SaveBan(); // save the ban list
#endif
G_SaveGameData(false); // Tails 12-08-2002
//added:16-02-98: when recording a demo, should exit using 'q' key,
// but sometimes we forget and use 'F10'.. so save here too.
@@ -1442,7 +1484,7 @@ static INT32 errorcount = 0;
*/
static boolean shutdowning = false;
FUNCIERROR void ATTRNORETURN I_Error(const char *error, ...)
void I_Error(const char *error, ...)
{
va_list argptr;
char buffer[8192];
@@ -1468,7 +1510,7 @@ FUNCIERROR void ATTRNORETURN I_Error(const char *error, ...)
if (errorcount > 20)
{
va_start(argptr, error);
vsnprintf(buffer, 8192, error, argptr);
vsprintf(buffer, error, argptr);
va_end(argptr);
I_OutputMsg("SRB2Kart %s Recursive Error", buffer);
@@ -1482,7 +1524,7 @@ FUNCIERROR void ATTRNORETURN I_Error(const char *error, ...)
// Display error message in the console before we start shutting it down
va_start(argptr, error);
vsnprintf(buffer, 8192, error, argptr);
vsprintf(buffer, error, argptr);
va_end(argptr);
I_OutputMsg("\nI_Error(): %s\n", buffer);
@@ -1494,7 +1536,9 @@ FUNCIERROR void ATTRNORETURN I_Error(const char *error, ...)
I_ShutdownConsole();
M_SaveConfig(NULL); // save game config, cvars..
#ifndef NONET
D_SaveBan(); // save the ban list
#endif
G_SaveGameData(false); // Tails 12-08-2002
// Shutdown. Here might be other errors.
@@ -1709,9 +1753,9 @@ char *I_GetUserName(void)
strncpy(username, p, MAXPLAYERNAME);
}
if (!fastcmp(username, ""))
return username;
if (strcmp(username, "") != 0)
return username;
return NULL; // dummy for platform independent version
}
@@ -1983,7 +2027,7 @@ const char *I_LocateWad(void)
#if defined (_WIN32)
SetCurrentDirectoryA(waddir);
#else
if (waddir == NULL || chdir(waddir) == -1)
if (chdir(waddir) == -1)
I_OutputMsg("Couldn't change working directory\n");
#endif
}
@@ -2131,50 +2175,6 @@ size_t I_GetFreeMem(size_t *total)
// note CPUAFFINITY code used to reside here
void I_RegisterSysCommands(void) {}
const char *I_GetSysName(void)
{
// reference: https://sourceforge.net/p/predef/wiki/OperatingSystems/
#if defined(_WIN32) || defined(__CYGWIN__)
return "Windows";
#elif defined(__APPLE__)
return "Mac OS";
#elif defined(__linux__)
return "Linux";
#elif defined(__FreeBSD__)
return "FreeBSD";
#elif defined(__OpenBSD__)
return "OpenBSD";
#elif defined(__NetBSD__)
return "NetBSD";
#elif defined(__DragonFly__)
return "DragonFly BSD";
#elif defined(__gnu_hurd__)
return "GNU Hurd"; // for anyone mental enough to set up an SRB2 server on GNU Hurd
#elif defined(__hpux)
return "HP-UX";
#elif defined(EPLAN9)
return "Plan 9";
#elif defined(__HAIKU__)
return "Haiku";
#elif defined(__BEOS__)
return "BeOS";
#elif defined(__minix)
return "Minix";
#elif defined(__sun)
#if defined(__SVR4) || defined(__srv4__)
return "Solaris"; // this would be so cursed...
#else
return "SunOS";
#endif
#elif defined(_AIX)
return "AIX";
#elif defined(__SYLLABLE__)
return "SyllableOS"; // RIP SyllableOS, i still miss you ;-;
#else
return "Unknown";
#endif
}
boolean I_InitNetwork(void)
{
// this must exist, but this is actually handled in i_tcp.c
+2 -4
View File
@@ -89,10 +89,9 @@ void I_UpdateNoVsync(void)
//
// I_ReadScreen
//
void I_ReadScreen(UINT8 * restrict scr, INT32 scale)
void I_ReadScreen(UINT8 *scr)
{
(void)scr;
(void)scale;
}
//
@@ -145,9 +144,8 @@ UINT32 I_GetRefreshRate(void)
return 0;
}
void I_SetTextInput(boolean enable)
void I_SetTextInput(void)
{
(void)enable;
}
boolean I_UseNativeKeyboard(void)
+9 -9
View File
@@ -754,7 +754,7 @@ static void readlevelheader(MYFILE *f, INT32 num, INT32 wadnum)
strupr(word);
// Now get the part after
word2 = tmp + 2;
word2 = tmp += 2;
i = atoi(word2); // used for numerical settings
// CHEAP HACK: move this over here for lowercase subtitles
@@ -1393,7 +1393,7 @@ static void readhuditem(MYFILE *f, INT32 num)
strupr(word);
// Now get the part after
word2 = tmp + 2;
word2 = tmp += 2;
strupr(word2);
i = atoi(word2); // used for numerical settings
@@ -1862,7 +1862,7 @@ static void reademblemdata(MYFILE *f, INT32 num)
strupr(word);
// Now get the part after
word2 = tmp + 2;
word2 = tmp += 2;
value = atoi(word2); // used for numerical settings
// Up here to allow lowercase in hints
@@ -1989,7 +1989,7 @@ static void readextraemblemdata(MYFILE *f, INT32 num)
strupr(word);
// Now get the part after
word2 = tmp + 2;
word2 = tmp += 2;
strupr(word2);
value = atoi(word2); // used for numerical settings
@@ -2067,7 +2067,7 @@ static void readunlockable(MYFILE *f, INT32 num)
strupr(word);
// Now get the part after
word2 = tmp + 2;
word2 = tmp += 2;
strupr(word2);
i = atoi(word2); // used for numerical settings
@@ -2336,7 +2336,7 @@ static void readconditionset(MYFILE *f, UINT8 setnum)
strupr(word);
// Now get the part after
word2 = tmp + 2;
word2 = tmp += 2;
strupr(word2);
if (fastncmp(word, "CONDITION", 9))
@@ -2470,7 +2470,7 @@ static void readmaincfg(MYFILE *f)
strupr(word);
// Now get the part after
word2 = tmp + 2;
word2 = tmp += 2;
strupr(word2);
value = atoi(word2); // used for numerical settings
@@ -2649,7 +2649,7 @@ static void readwipes(MYFILE *f)
{
char *s = Z_Malloc(MAXLINELEN, PU_STATIC, NULL);
char *word = s;
char *pword;
char *pword = word;
char *word2;
char *tmp;
INT32 value;
@@ -2682,7 +2682,7 @@ static void readwipes(MYFILE *f)
strupr(word);
// Now get the part after
word2 = tmp + 2;
word2 = tmp += 2;
value = atoi(word2); // used for numerical settings
if (value < -1 || value > 99)
+4 -30
View File
@@ -49,27 +49,6 @@ discordRequest_t *discordRequestList = NULL;
static char self_ip[IP_SIZE+1];
/*--------------------------------------------------
* const char *DRPC_HideUsername(const char *input)
*
* See header file for description.
* --------------------------------------------------*/
const char *DRPC_HideUsername(const char *input)
{
static char buffer[5];
int i;
buffer[0] = input[0];
for (i = 1; i < 4; ++i)
{
buffer[i] = '.';
}
buffer[4] = '\0';
return buffer;
}
boolean drpc_init = false;
/*--------------------------------------------------
@@ -126,7 +105,7 @@ static void DRPC_HandleReady(const DiscordUser *user)
}
else
{
CONS_Printf("Discord: connected to %s (%s)\n", user->username, user->userId);
CONS_Printf("Discord: connected to %s#%s (%s)\n", user->username, user->discriminator, user->userId);
}
}
@@ -262,10 +241,8 @@ static void DRPC_HandleJoinRequest(const DiscordUser *requestUser)
newRequest->username = Z_Calloc(344, PU_STATIC, NULL);
snprintf(newRequest->username, 344, "%s", requestUser->username);
#if 0
newRequest->discriminator = Z_Calloc(8, PU_STATIC, NULL);
snprintf(newRequest->discriminator, 8, "%s", requestUser->discriminator);
#endif
newRequest->userID = Z_Calloc(32, PU_STATIC, NULL);
snprintf(newRequest->userID, 32, "%s", requestUser->userId);
@@ -277,7 +254,7 @@ static void DRPC_HandleJoinRequest(const DiscordUser *requestUser)
while (append != NULL)
{
// CHECK FOR DUPES!! Ignore any that already exist from the same user.
if (fastcmp(newRequest->userID, append->userID))
if (!strcmp(newRequest->userID, append->userID))
{
Discord_Respond(newRequest->userID, DISCORD_REPLY_IGNORE);
DRPC_RemoveRequest(newRequest);
@@ -331,9 +308,6 @@ void DRPC_RemoveRequest(discordRequest_t *removeRequest)
}
Z_Free(removeRequest->username);
#if 0
Z_Free(removeRequest->discriminator);
#endif
Z_Free(removeRequest->userID);
Z_Free(removeRequest);
}
@@ -419,7 +393,7 @@ static const char *DRPC_GetServerIP(void)
// If you're connected
if (I_GetNodeAddress && (address = I_GetNodeAddress(servernode)) != NULL)
{
if (!fastcmp(address, "self"))
if (strcmp(address, "self"))
{
// We're not the server, so we could successfully get the IP!
// No need to do anything else :)
@@ -684,7 +658,7 @@ void DRPC_UpdatePresence(void)
// Character image
while (supportedSkins[checkSkin] != NULL)
{
if (fastcmp(skins[players[consoleplayer].skin].name, supportedSkins[checkSkin]))
if (!strcmp(skins[players[consoleplayer].skin].name, supportedSkins[checkSkin]))
{
snprintf(charimg, 21, "char%s", supportedSkins[checkSkin]);
discordPresence.smallImageKey = charimg;
-11
View File
@@ -29,9 +29,7 @@ extern struct discordInfo_s {
typedef struct discordRequest_s {
char *username; // Discord user name.
#if 0 // Good night, sweet prince...
char *discriminator; // Discord discriminator (The little hashtag thing after the username). Separated for a "hide discriminators" cvar.
#endif
char *userID; // The ID of the Discord user, gets used with Discord_Respond()
// HAHAHA, no.
@@ -46,15 +44,6 @@ typedef struct discordRequest_s {
extern discordRequest_t *discordRequestList;
/*--------------------------------------------------
* const char *DRPC_HideUsername(const char *input);
*
* Handle usernames while cv_discordstreamer is activated.
* (The loss of discriminators is still a dumbass regression
* that I will never forgive the Discord developers for.)
* --------------------------------------------------*/
const char *DRPC_HideUsername(const char *input);
/*--------------------------------------------------
void DRPC_RemoveRequest(void);
+8
View File
@@ -57,6 +57,10 @@ enum
// Do not use bit five or after, as they are used for object z-offsets.
#if defined(_MSC_VER)
#pragma pack(1)
#endif
// A single Vertex.
typedef struct
{
@@ -184,6 +188,10 @@ typedef struct
UINT16 children[2];
} ATTRPACK mapnode_t;
#if defined(_MSC_VER)
#pragma pack()
#endif
// Thing definition, position, orientation and type,
// plus visibility flags and attributes.
typedef struct
+27 -24
View File
@@ -47,6 +47,17 @@
#define ASMCALL
#endif
#ifdef _MSC_VER
#pragma warning(disable : 4127 4152 4213 4514)
#ifdef _WIN64
#pragma warning(disable : 4306)
#endif
#endif
// warning level 4
// warning C4127: conditional expression is constant
// warning C4152: nonstandard extension, function/data pointer conversion in expression
// warning C4213: nonstandard extension used : cast on l-value
#ifdef __cplusplus
extern "C" {
#endif
@@ -69,8 +80,6 @@ extern "C" {
#include <sys/stat.h>
#include <ctype.h>
#include "fastcmp.h"
#ifdef _WIN32
#include <io.h>
#endif
@@ -92,14 +101,6 @@ extern FILE *logstream;
extern char logfilename[1024];
#endif
#if defined (HAVE_LIBBACKTRACE)
#define CRASH_LOGFILE_NAME "srb2kart-crash-log.txt"
#elif defined (HAVE_DRMINGW)
#define CRASH_LOGFILE_NAME "srb2kart-crash-log.RPT"
#else
#define CRASH_LOGFILE_NAME "(unknown crash log)"
#endif
/* A mod name to further distinguish versions. */
#define SRB2APPLICATION "SRB2Kart"
@@ -116,11 +117,9 @@ extern char logfilename[1024];
#define SUBVERSION 6 // more precise version number
#define VERSIONSTRING "Saturn v9"
#define VERSIONSTRINGW L"Saturn v9"
#define SATURN_TESTING // comment out for saturn release builds!
// Hey! If you change this, add 1 to the MODVERSION below! Otherwise we can't force updates!
// And change CMakeLists.txt (not src/, but in root), for CMake users!
// AND appveyor.yml, for the build bots!
#endif
// Maintain compatibility with 1.0.x record attack replays?
@@ -417,7 +416,7 @@ enum {
*/
FUNCIERROR void ATTRNORETURN I_Error(const char *error, ...);
void I_Error(const char *error, ...) FUNCIERROR;
/** \brief write a message to stderr (use before I_Quit) for when you need to quit with a msg, but need
the return code 0 of I_Quit();
@@ -453,6 +452,11 @@ extern char savegamename[256];
//TODO: delet this
#define M_GetText(x) (x)
FUNCINLINE static ATTRINLINE void *M_Memcpy(void *dest, const void *src, size_t n)
{
return memcpy(dest, src, n);
}
char *va(const char *format, ...) FUNCPRINTF;
char *M_GetToken(const char *inputString);
char *sizeu1(size_t num);
@@ -556,19 +560,13 @@ UINT32 quickncasehash (const char *p, size_t n)
#endif
#ifdef __cplusplus
#if defined(__GNUC__) || defined(__clang__)
#if defined(__GNUC__) || defined(__clang__) || defined(_MSC_VER)
#define restrict __restrict
#else
#define restrict
#endif
#endif
// the GNU cleanup attribute: plugging memory leaks since 2003!
// on scope exit, the cleanup function is called with a pointer to the declared variable,
// essentially behaving like a C++ destructor
// NOTE: you WILL have nasal troubles if the variable is not initialized
#define CLEANUP(f) __attribute__((__cleanup__(f)))
// An assert-type mechanism.
#ifdef PARANOIA
#define I_Assert(e) ((e) ? (void)0 : I_Error("assert failed: %s, file %s, line %d", #e, __FILE__, __LINE__))
@@ -591,6 +589,7 @@ extern const char *compdate, *comptime, *comprevision, *compbranch;
// None of these that are disabled in the normal build are guaranteed to work perfectly
// Compile them at your own risk!
#ifndef NONET
//-- SATURN __
/// Detect if a client is on Saturn in the clientconfig.
/// To seperately allow them to join or block joining from vanilla clients.
@@ -605,6 +604,7 @@ extern const char *compdate, *comptime, *comprevision, *compbranch;
#define SATURNPAK
#endif
//-- <( ̄︶ ̄)> __
#endif
/// Undefine to use the new method of Gamma correction see colour cube in v_video.c
#define BACKWARDSCOMPATCORRECTION
@@ -626,6 +626,11 @@ extern const char *compdate, *comptime, *comprevision, *compbranch;
/// Most modifications should probably enable this.
//#define SAVEGAME_OTHERVERSIONS
#ifndef NONET
/// Display a connection screen on join attempts.
#define CLIENT_LOADINGSCREEN
#endif
/// Backwards compatibility with musicslots.
/// \note You should leave this enabled unless you're working with a future SRB2 version.
#define MUSICSLOT_COMPATIBILITY
@@ -646,11 +651,9 @@ extern const char *compdate, *comptime, *comprevision, *compbranch;
#define ROTANGLES 72 // Needs to be a divisor of 360 (45, 60, 90, 120...)
#define ROTANGDIFF (360 / ROTANGLES)
#if defined (HAVE_CURL)
#if defined (HAVE_CURL) && ! defined (NONET)
#define MASTERSERVER
#ifndef NOHOLEPUNCH
#define HOLEPUNCH
#endif
#else
#undef UPDATE_ALERT
#endif
-3
View File
@@ -116,10 +116,7 @@ extern UINT8 window_notinfocus; // are we in focus? (backend independant -- hand
extern boolean nodrawers;
extern boolean noblit;
extern boolean lastdraw;
#ifdef MOTIONBLUR
extern INT32 postimgparam[MAXSPLITSCREENPLAYERS];
#endif
extern INT32 viewwindowx, viewwindowy;
extern INT32 viewwidth;
+45 -2
View File
@@ -28,6 +28,31 @@ extern "C" {
#endif
/* 7.18.1.1 Exact-width integer types */
#ifdef _MSC_VER
#define UINT8 unsigned __int8
#define SINT8 signed __int8
#define UINT16 unsigned __int16
#define INT16 __int16
#define INT32 __int32
#define UINT32 unsigned __int32
#define INT64 __int64
#define UINT64 unsigned __int64
typedef long ssize_t;
/* Older Visual C++ headers don't have the Win64-compatible typedefs... */
#if (_MSC_VER <= 1200)
#ifndef DWORD_PTR
#define DWORD_PTR DWORD
#endif
#ifndef PDWORD_PTR
#define PDWORD_PTR PDWORD
#endif
#endif
#else
#define __STDC_LIMIT_MACROS
#include <stdint.h>
@@ -41,15 +66,26 @@ extern "C" {
#define UINT32 uint32_t
#define INT64 int64_t
#define UINT64 uint64_t
#endif
#ifdef __APPLE_CC__
#define DIRECTFULLSCREEN 1
#define DEBUG_LOG
#define NOIPX
#endif
/* Strings and some misc platform specific stuff */
#if defined (__OS2__)
#if defined (_MSC_VER) || defined (__OS2__)
// Microsoft VisualC++
#ifdef _MSC_VER
#if (_MSC_VER <= 1800) // MSVC 2013 and back
#define snprintf _snprintf
#if (_MSC_VER <= 1200) // MSVC 6.0 and back
#define vsnprintf _vsnprintf
#endif
#endif
#endif
#define strncasecmp strnicmp
#define strcasecmp stricmp
#define inline __inline
@@ -234,6 +270,13 @@ typedef int32_t boolean;
#endif
#define ATTRUNUSED __attribute__((unused))
#elif defined (_MSC_VER)
#define ATTRNORETURN __declspec(noreturn)
#define ATTRINLINE __forceinline
#if _MSC_VER > 1200 // >= MSVC 6.0
#define ATTRNOINLINE __declspec(noinline)
#endif
#endif
#ifndef FUNCPRINTF
@@ -325,7 +368,7 @@ typedef UINT8 bitarray_t;
static inline int
in_bit_array (const bitarray_t * const array, const int value)
{
return(array[value >> 3] & (1<<(value & 7)));
return (array[value >> 3] & (1<<(value & 7)));
}
static inline void
+12 -7
View File
@@ -169,7 +169,7 @@ static void F_SkyScroll(INT32 scrollspeed)
pat = W_CachePatchName("TITLEBG1", PU_PATCH_LOWPRIORITY);
pat2 = W_CachePatchName("TITLEBG2", PU_PATCH_LOWPRIORITY);
w = (vid.scaledwidth << FRACBITS);
w = (vid.width / vid.dupx)<<FRACBITS;
// The scroll offset MUST be clamped before shifting by FRACBITS, or else it'll overflow in about 3 minutes
animtimer = ((((finalecount * scrollspeed) % (pat->width*16))<<FRACBITS) + (R_GetTimeFrac(RTF_MENU) * scrollspeed))/16;
@@ -677,7 +677,7 @@ void F_CreditDrawer(void)
y += 12<<FRACBITS;
break;
}
if (((y>>FRACBITS) * vid.dup) > vid.height)
if (((y>>FRACBITS) * vid.dupy) > vid.height)
break;
}
@@ -685,8 +685,8 @@ void F_CreditDrawer(void)
if (finalecount)
{
const char *goodbyefornow = "See you in ""\x82""Dr. Robotnik's Ring Racers""\x80""!";
fixed_t lpad = (vid.scaledwidth - BASEVIDWIDTH) << FRACBITS;
fixed_t w = V_StringWidth(goodbyefornow, V_ALLOWLOWERCASE) << FRACBITS;
fixed_t lpad = ((vid.width/vid.dupx) - BASEVIDWIDTH)<<FRACBITS;
fixed_t w = V_StringWidth(goodbyefornow, V_ALLOWLOWERCASE)<<FRACBITS;
fixed_t x = FixedMul(((BASEVIDWIDTH<<FRACBITS)+w+lpad), ((finalecount-1)<<FRACBITS)/(5*TICRATE)) - w - (lpad/2);
V_DrawString(x>>FRACBITS, y>>FRACBITS, V_ALLOWLOWERCASE, goodbyefornow); // for some reason DrawStringAtFixed can't tolerate colour codes
}
@@ -707,8 +707,7 @@ void F_CreditTicker(void)
case 1: y += 30<<FRACBITS; break;
default: y += 12<<FRACBITS; break;
}
if (FixedMul(y, vid.dup) > vid.height)
if (FixedMul(y,vid.dupy) > vid.height)
break;
}
@@ -963,7 +962,6 @@ void F_StartTitleScreen(void)
finalecount = 0;
else
wipegamestate = GS_TITLESCREEN;
G_SetGamestate(GS_TITLESCREEN);
CON_ClearHUD();
@@ -1151,6 +1149,13 @@ void F_TitleScreenTicker(boolean run)
// Setup demo name
snprintf(dname, 9, "%sS%02u", mapname, numstaff);
/*if ((l = W_CheckNumForName(dname)) == LUMPERROR) -- we KNOW it exists now
{
CONS_Alert(CONS_ERROR, M_GetText("Demo lump \"%s\" doesn't exist\n"), dname);
F_StartIntro();
return;
}*/
loadreplay:
demo.title = demo.fromtitle = true;
demo.ignorefiles = true;
+4 -4
View File
@@ -257,7 +257,7 @@ static void F_DoWipe(fademask_t *fademask)
// shortcut - memcpy source to work
while (draw_linestogo--)
{
memcpy(w_base+relativepos, s_base+relativepos, draw_rowend-draw_rowstart);
M_Memcpy(w_base+relativepos, s_base+relativepos, draw_rowend-draw_rowstart);
relativepos += vid.width;
}
}
@@ -266,7 +266,7 @@ static void F_DoWipe(fademask_t *fademask)
// shortcut - memcpy target to work
while (draw_linestogo--)
{
memcpy(w_base+relativepos, e_base+relativepos, draw_rowend-draw_rowstart);
M_Memcpy(w_base+relativepos, e_base+relativepos, draw_rowend-draw_rowstart);
relativepos += vid.width;
}
}
@@ -314,7 +314,7 @@ void F_WipeStartScreen(void)
}
#endif
wipe_scr_start = vid.screens[3];
I_ReadScreen(wipe_scr_start, 1);
I_ReadScreen(wipe_scr_start);
#endif
}
@@ -331,7 +331,7 @@ void F_WipeEndScreen(void)
}
#endif
wipe_scr_end = vid.screens[4];
I_ReadScreen(wipe_scr_end, 1);
I_ReadScreen(wipe_scr_end);
V_DrawBlock(0, 0, 0, vid.width, vid.height, wipe_scr_start);
#endif
}
+324 -31
View File
@@ -30,7 +30,286 @@
#include "z_zone.h"
#include "m_menu.h" // Addons_option_Onchange
static CV_PossibleValue_t addons_cons_t[] = {{0, "Default"}, {1, "HOME"}, {2, "SRB2"}, {3, "CUSTOM"}, {0, NULL}};
#if defined (_WIN32) && defined (_MSC_VER)
#include <errno.h>
#include <io.h>
#include <tchar.h>
#define SUFFIX "*"
#define S_ISDIR(m) (((m) & S_IFMT) == S_IFDIR)
#ifndef INVALID_FILE_ATTRIBUTES
#define INVALID_FILE_ATTRIBUTES ((DWORD)-1)
#endif
struct dirent
{
long d_ino; /* Always zero. */
unsigned short d_reclen; /* Always zero. */
unsigned short d_namlen; /* Length of name in d_name. */
char d_name[FILENAME_MAX]; /* File name. */
};
/*
* This is an internal data structure. Good programmers will not use it
* except as an argument to one of the functions below.
* dd_stat field is now int (was short in older versions).
*/
typedef struct
{
/* disk transfer area for this dir */
struct _finddata_t dd_dta;
/* dirent struct to return from dir (NOTE: this makes this thread
* safe as long as only one thread uses a particular DIR struct at
* a time) */
struct dirent dd_dir;
/* _findnext handle */
#if _MSC_VER > 1200
intptr_t dd_handle;
#else
long dd_handle;
#endif
/*
* Status of search:
* 0 = not started yet (next entry to read is first entry)
* -1 = off the end
* positive = 0 based index of next entry
*/
int dd_stat;
/* given path for dir with search pattern (struct is extended) */
CHAR dd_name[1];
} DIR;
/*
* opendir
*
* Returns a pointer to a DIR structure appropriately filled in to begin
* searching a directory.
*/
DIR *
opendir (const CHAR *szPath)
{
DIR *nd;
DWORD rc;
CHAR szFullPath[MAX_PATH];
errno = 0;
if (!szPath)
{
errno = EFAULT;
return (DIR *) 0;
}
if (szPath[0] == '\0')
{
errno = ENOTDIR;
return (DIR *) 0;
}
/* Attempt to determine if the given path really is a directory. */
rc = GetFileAttributesA(szPath);
if (rc == INVALID_FILE_ATTRIBUTES)
{
/* call GetLastError for more error info */
errno = ENOENT;
return (DIR *) 0;
}
if (!(rc & FILE_ATTRIBUTE_DIRECTORY))
{
/* Error, entry exists but not a directory. */
errno = ENOTDIR;
return (DIR *) 0;
}
/* Make an absolute pathname. */
_fullpath (szFullPath, szPath, MAX_PATH);
/* Allocate enough space to store DIR structure and the complete
* directory path given. */
nd = (DIR *) malloc (sizeof (DIR) + (strlen(szFullPath) + strlen (SLASH) +
strlen(PATHSEP) + 1) * sizeof (CHAR));
if (!nd)
{
/* Error, out of memory. */
errno = ENOMEM;
return (DIR *) 0;
}
/* Create the search expression. */
strcpy (nd->dd_name, szFullPath);
/* Add on a slash if the path does not end with one. */
if (nd->dd_name[0] != '\0' &&
nd->dd_name[strlen (nd->dd_name) - 1] != PATHSEP[0])
{
strcat (nd->dd_name, PATHSEP);
}
/* Add on the search pattern */
strcat (nd->dd_name, SUFFIX);
/* Initialize handle to -1 so that a premature closedir doesn't try
* to call _findclose on it. */
nd->dd_handle = -1;
/* Initialize the status. */
nd->dd_stat = 0;
/* Initialize the dirent structure. ino and reclen are invalid under
* Win32, and name simply points at the appropriate part of the
* findfirst_t structure. */
nd->dd_dir.d_ino = 0;
nd->dd_dir.d_reclen = 0;
nd->dd_dir.d_namlen = 0;
ZeroMemory(nd->dd_dir.d_name, FILENAME_MAX);
return nd;
}
/*
* readdir
*
* Return a pointer to a dirent structure filled with the information on the
* next entry in the directory.
*/
struct dirent *
readdir (DIR * dirp)
{
errno = 0;
/* Check for valid DIR struct. */
if (!dirp)
{
errno = EFAULT;
return (struct dirent *) 0;
}
if (dirp->dd_stat < 0)
{
/* We have already returned all files in the directory
* (or the structure has an invalid dd_stat). */
return (struct dirent *) 0;
}
else if (dirp->dd_stat == 0)
{
/* We haven't started the search yet. */
/* Start the search */
dirp->dd_handle = _findfirst (dirp->dd_name, &(dirp->dd_dta));
if (dirp->dd_handle == -1)
{
/* Whoops! Seems there are no files in that
* directory. */
dirp->dd_stat = -1;
}
else
{
dirp->dd_stat = 1;
}
}
else
{
/* Get the next search entry. */
if (_findnext (dirp->dd_handle, &(dirp->dd_dta)))
{
/* We are off the end or otherwise error.
_findnext sets errno to ENOENT if no more file
Undo this. */
DWORD winerr = GetLastError();
if (winerr == ERROR_NO_MORE_FILES)
errno = 0;
_findclose (dirp->dd_handle);
dirp->dd_handle = -1;
dirp->dd_stat = -1;
}
else
{
/* Update the status to indicate the correct
* number. */
dirp->dd_stat++;
}
}
if (dirp->dd_stat > 0)
{
/* Successfully got an entry. Everything about the file is
* already appropriately filled in except the length of the
* file name. */
dirp->dd_dir.d_namlen = (unsigned short)strlen (dirp->dd_dta.name);
strcpy (dirp->dd_dir.d_name, dirp->dd_dta.name);
return &dirp->dd_dir;
}
return (struct dirent *) 0;
}
/*
* rewinddir
*
* Makes the next readdir start from the beginning.
*/
int
rewinddir (DIR * dirp)
{
errno = 0;
/* Check for valid DIR struct. */
if (!dirp)
{
errno = EFAULT;
return -1;
}
dirp->dd_stat = 0;
return 0;
}
/*
* closedir
*
* Frees up resources allocated by opendir.
*/
int
closedir (DIR * dirp)
{
int rc;
errno = 0;
rc = 0;
if (!dirp)
{
errno = EFAULT;
return -1;
}
if (dirp->dd_handle != -1)
{
rc = _findclose (dirp->dd_handle);
}
/* Delete the dir structure. */
free (dirp);
return rc;
}
#endif
static CV_PossibleValue_t addons_cons_t[] = {{0, "Default"},
#if 1
{1, "HOME"}, {2, "SRB2"},
#endif
{3, "CUSTOM"}, {0, NULL}};
consvar_t cv_addons_option = {"addons_option", "Default", CV_SAVE|CV_CALL, addons_cons_t, Addons_option_Onchange, 0, NULL, NULL, 0, 0, NULL};
consvar_t cv_addons_folder = {"addons_folder", "", CV_SAVE, NULL, NULL, 0, NULL, NULL, 0, 0, NULL};
@@ -44,7 +323,7 @@ consvar_t cv_addons_search_case = {"addons_search_case", "No", CV_SAVE, CV_YesNo
static CV_PossibleValue_t addons_search_type_cons_t[] = {{0, "Start"}, {1, "Anywhere"}, {0, NULL}};
consvar_t cv_addons_search_type = {"addons_search_type", "Anywhere", CV_SAVE, addons_search_type_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
char menupath[MAXFILEPATH];
char menupath[1024];
size_t menupathindex[menudepth];
size_t menudepthleft = menudepth;
@@ -111,7 +390,7 @@ filestatus_t filesearch(char *filename, const char *startpath, const UINT8 *want
int found = 0;
char *searchname;
int depthleft = maxsearchdepth;
char searchpath[MAXFILEPATH];
char searchpath[1024];
size_t *searchpathindex;
dirhandle = (DIR**)malloc(maxsearchdepth * sizeof(DIR*));
@@ -198,21 +477,20 @@ filestatus_t filesearch(char *filename, const char *startpath, const UINT8 *want
for (; *path != NULL; path++)
{
if (fasticmp(*path, dent->d_name))
if (strcasecmp(*path, dent->d_name) == 0)
{
skipfolder = true;
break;
}
}
// This folder is excluded
if (skipfolder)
{
continue;
}
}
if (!fasticmp(".git", dent->d_name) // sanity if you're weird like me
if (strcasecmp(".git", dent->d_name) // sanity if you're weird like me
&& (dirhandle[depthleft-1] = opendir(searchpath)) != NULL)
{
// Got read permissions!
@@ -227,7 +505,7 @@ filestatus_t filesearch(char *filename, const char *startpath, const UINT8 *want
// I am a file!
if (!fasticmp(searchname, dent->d_name))
if (strcasecmp(searchname, dent->d_name))
continue; // Not what we're looking for!
switch (checkfilemd5(searchpath, wantedmd5sum))
@@ -353,7 +631,7 @@ void searchfilemenu(char *tempname)
{
for (i = first; i < sizedirmenu; i++)
{
if (fastcmp(dirmenu[i]+DIR_STRING, tempname))
if (!strcmp(dirmenu[i]+DIR_STRING, tempname))
{
dir_on[menudepthleft] = i;
break;
@@ -400,7 +678,7 @@ void searchfilemenu(char *tempname)
{
if (filemenucmp(coredirmenu[i]+DIR_STRING, localmenusearch))
{
if (tempname && fastcmp(coredirmenu[i]+DIR_STRING, tempname))
if (tempname && !strcmp(coredirmenu[i]+DIR_STRING, tempname))
{
dir_on[menudepthleft] = sizedirmenu;
Z_Free(tempname);
@@ -421,6 +699,9 @@ boolean preparefilemenu(boolean samedepth, boolean replayhut)
{
DIR *dirhandle;
struct dirent *dent;
#ifndef _WIN32
struct stat fsstat;
#endif
size_t pos = 0, folderpos = 0, numfolders = 0;
char *tempname = NULL;
@@ -442,13 +723,10 @@ boolean preparefilemenu(boolean samedepth, boolean replayhut)
Z_Free(dirmenu);
dirmenu = NULL;
if (coredirmenu != NULL)
for (; sizecoredirmenu > 0; sizecoredirmenu--) // clear out existing items
{
for (; sizecoredirmenu > 0; sizecoredirmenu--) // clear out existing items
{
Z_Free(coredirmenu[sizecoredirmenu-1]);
coredirmenu[sizecoredirmenu-1] = NULL;
}
Z_Free(coredirmenu[sizecoredirmenu-1]);
coredirmenu[sizecoredirmenu-1] = NULL;
}
while (true)
@@ -466,26 +744,33 @@ boolean preparefilemenu(boolean samedepth, boolean replayhut)
strcpy(&menupath[menupathindex[menudepthleft]],dent->d_name);
INT32 isdir = pathisdirectory(menupath);
if (isdir == -1)
#ifndef _WIN32
if (stat(menupath, &fsstat) < 0)
#else
// if we wanna follow symlinks we can check with FILE_ATTRIBUTE_REPARSE_POINT
DWORD fileattr = GetFileAttributes(menupath);
if (fileattr == INVALID_FILE_ATTRIBUTES)
#endif
; // was the file (re)moved? can't stat it
else // is a file or directory
{
if (isdir == 0) // file
#ifndef _WIN32
if (!S_ISDIR(fsstat.st_mode)) // file
#else
if (!(fileattr & FILE_ATTRIBUTE_DIRECTORY))
#endif
{
size_t len = strlen(dent->d_name)+1;
if (replayhut)
{
if (!fasticmp(".lmp", dent->d_name+len-5))
if (strcasecmp(".lmp", dent->d_name+len-5))
continue; // Not a replay
}
else if (!cv_addons_showall.value)
{
UINT8 ext;
for (ext = 0; ext < NUM_EXT_TABLE; ext++)
if (fasticmp(exttable[ext]+1, dent->d_name+len-(exttable[ext][0])))
if (!strcasecmp(exttable[ext]+1, dent->d_name+len-(exttable[ext][0])))
break; // extension comparison
if (ext == NUM_EXT_TABLE)
@@ -541,9 +826,13 @@ boolean preparefilemenu(boolean samedepth, boolean replayhut)
strcpy(&menupath[menupathindex[menudepthleft]],dent->d_name);
INT32 isdir = pathisdirectory(menupath);
if (isdir == -1)
#ifndef _WIN32
if (stat(menupath, &fsstat) < 0)
#else
// if we wanna follow symlinks we can check with FILE_ATTRIBUTE_REPARSE_POINT
DWORD fileattr = GetFileAttributes(menupath);
if (fileattr == INVALID_FILE_ATTRIBUTES)
#endif
; // was the file (re)moved? can't stat it
else // is a file or directory
{
@@ -552,14 +841,18 @@ boolean preparefilemenu(boolean samedepth, boolean replayhut)
UINT8 ext = EXT_FOLDER;
UINT8 folder;
if (isdir == 0) // file
#ifndef _WIN32
if (!S_ISDIR(fsstat.st_mode)) // file
#else
if (!(fileattr & FILE_ATTRIBUTE_DIRECTORY))
#endif
{
if (!((numfolders+pos) < sizecoredirmenu))
continue; // crash prevention
if (replayhut)
{
if (!fasticmp(".lmp", dent->d_name+len-5))
if (strcasecmp(".lmp", dent->d_name+len-5))
continue; // Not a replay
ext = EXT_TXT; // This isn't used anywhere but better safe than sorry for messing with this...
@@ -567,7 +860,7 @@ boolean preparefilemenu(boolean samedepth, boolean replayhut)
else
{
for (; ext < NUM_EXT_TABLE; ext++)
if (fasticmp(exttable[ext]+1, dent->d_name+len-(exttable[ext][0])))
if (!strcasecmp(exttable[ext]+1, dent->d_name+len-(exttable[ext][0])))
break; // extension comparison
if (ext == NUM_EXT_TABLE && !cv_addons_showall.value)
@@ -587,7 +880,7 @@ boolean preparefilemenu(boolean samedepth, boolean replayhut)
nameonly(filenamebuf[i]);
}
if (!fastcmp(dent->d_name, filenamebuf[i]))
if (strcmp(dent->d_name, filenamebuf[i]))
continue;
if (cv_addons_md5.value && !checkfilemd5(menupath, wadfiles[i]->md5sum))
@@ -598,11 +891,11 @@ boolean preparefilemenu(boolean samedepth, boolean replayhut)
}
else if (ext == EXT_TXT)
{
if (!strncmp(dent->d_name, "log-", 4) || fastcmp(dent->d_name, "errorlog.txt"))
if (!strncmp(dent->d_name, "log-", 4) || !strcmp(dent->d_name, "errorlog.txt"))
ext |= EXT_LOADED;
}
if (fastcmp(dent->d_name, configfile))
if (!strcmp(dent->d_name, configfile))
ext |= EXT_LOADED;
}
+1 -2
View File
@@ -34,8 +34,7 @@ filestatus_t filesearch(char *filename, const char *startpath, const UINT8 *want
#define menudepth 20
#define MAXFILEPATH 1024
extern char menupath[MAXFILEPATH];
extern char menupath[1024];
extern size_t menupathindex[menudepth];
extern size_t menudepthleft;
+371 -451
View File
File diff suppressed because it is too large. Load diff
Loaded 100 of 241 files, more files were not shown because too many files have changed in this diff. Show more