Compare commits

..

No commits in common. "main" and "v0.80.0" have entirely different histories.

430 changed files with 55164 additions and 77318 deletions

View file

@ -47,12 +47,6 @@ jobs:
- name: Checkout repository - name: Checkout repository
uses: actions/checkout@v4 uses: actions/checkout@v4
- uses: awalsh128/cache-apt-pkgs-action@latest
name: Install required packages
with:
packages: libopenal-dev libpulse-dev portaudio19-dev libasound2-dev libjack-dev libpipewire-0.3-dev qtbase5-dev libdbus-1-dev
version: "0.1"
# Setup SDL # Setup SDL
- name: Set up SDL - name: Set up SDL
id: sdl id: sdl

View file

@ -1,246 +0,0 @@
##########################
#
# Linux
# Ubuntu 22.04
#
# Using this version instead of 24.04 to use a lower GLIBC version (2.34).
# ARM is used for more efficiency, and x64 is used for legacy architectures like PowerPC.
##########################
name: Linux build workflow
on:
workflow_call:
inputs:
environment:
required: true
type: string
env:
# Customize the CMake build type here (Release, Debug, RelWithDebInfo, etc.)
BUILD_TYPE: RelWithDebInfo
RELEASE_STAGE: ${{ vars.RELEASE_STAGE || 'unstable' }}
jobs:
build:
strategy:
matrix:
architecture: [
{name: 'amd64', os: "ubuntu-22.04-arm", package: 'x86-64-linux-gnu', triple: 'x86_64-linux-gnu', arch_option: 'linux-x86_64'},
{name: 'i686', os: "ubuntu-22.04-arm", package: 'i686-linux-gnu', triple: 'i686-linux-gnu', arch_option: 'linux-x86'},
{name: 'arm64', os: "ubuntu-22.04-arm", package: 'aarch64-linux-gnu', triple: 'aarch64-linux-gnu', arch_option: 'linux-aarch64'},
{name: 'armhf', os: "ubuntu-22.04-arm", package: 'arm-linux-gnueabihf', triple: 'arm-linux-gnueabihf', arch_option: 'linux-armv4'},
{name: 'powerpc', os: "ubuntu-22.04", package: 'powerpc-linux-gnu', triple: 'powerpc-linux-gnu', arch_option: 'linux-ppc'},
{name: 'ppc64', os: "ubuntu-22.04", package: 'powerpc64-linux-gnu', triple: 'powerpc64-linux-gnu', arch_option: 'linux-ppc64'},
{name: 'ppc64el', os: "ubuntu-22.04-arm", package: 'powerpc64le-linux-gnu', triple: 'powerpc64le-linux-gnu', arch_option: 'linux-ppc64le'}
]
name: "Building for platform linux-${{matrix.architecture.name}}"
runs-on: ${{ matrix.architecture.os }}
environment: ${{ inputs.environment }}
env:
wolfssl-version: 'v5.7.6-stable'
curl-version: '8_12_1'
openal-soft-branch: '1.24.3'
steps:
###
# Packages
###
- uses: awalsh128/cache-apt-pkgs-action@latest
name: Install required packages
with:
packages: flex bison ninja-build cmake clang libpulse-dev portaudio19-dev libasound2-dev libjack-dev libpipewire-0.3-dev qtbase5-dev libdbus-1-dev
version: "${{ runner.os }}-${{ runner.arch }}-v1"
- name: Settings
working-directory: ${{github.workspace}}
run: |
echo "HOST_TRIPLE=$(gcc -dumpmachine)" >> $GITHUB_ENV
- uses: awalsh128/cache-apt-pkgs-action@latest
name: Install required cross-platform packages (${{ matrix.architecture.package }})
if: env.HOST_TRIPLE != matrix.architecture.triple
with:
packages: gcc-12-${{ matrix.architecture.package }} g++-12-${{ matrix.architecture.package }}
version: "${{ runner.os }}-${{ runner.arch }}-v1"
- name: Settings
working-directory: ${{github.workspace}}
run: |
echo "CMAKE_GENERATOR=Ninja Multi-Config" >> $GITHUB_ENV
echo "CC=clang" >> $GITHUB_ENV
echo "CXX=clang++" >> $GITHUB_ENV
echo "CFLAGS='--target=${{ matrix.architecture.triple }}'" >> $GITHUB_ENV
echo "CXXFLAGS='--target=${{ matrix.architecture.triple }}'" >> $GITHUB_ENV
###
# SDL
###
# Setup SDL
- name: Set up SDL
id: sdl
uses: libsdl-org/setup-sdl@main
with:
version: 2-latest
build-type: Release
# Workaround for when changing the runner OS version
cmake-arguments: "-DCACHE_OS_VERSION=Ubuntu_22.04"
###
# OpenAL
###
- name: Cache OpenAL
id: cache-openal-soft
uses: actions/cache@v4
with:
path: 'thirdparties/soft-oal/install'
key: ${{ runner.os }}-${{ matrix.architecture.name }}-openal-soft-${{ env.openal-soft-branch }}-v1
# soft-oal setup
- name: Checkout soft-oal
if: steps.cache-openal-soft.outputs.cache-hit != 'true'
uses: actions/checkout@v4
with:
repository: 'kcat/openal-soft'
path: 'thirdparties/soft-oal'
ref: '${{ env.openal-soft-branch }}'
- name: Configure and install soft-oal
if: steps.cache-openal-soft.outputs.cache-hit != 'true'
working-directory: ${{github.workspace}}/thirdparties/soft-oal
run: |
cmake -B ./build \
-DALSOFT_UTILS=OFF \
-DCMAKE_INSTALL_PREFIX='${{github.workspace}}/thirdparties/soft-oal/install'
cmake --build ./build --config Release --parallel
cmake --install ./build --config Release
###
# WolfSSL
###
- name: Cache WolfSSL
id: cache-wolfssl
uses: actions/cache@v4
with:
path: 'thirdparties/wolfssl/install'
key: ${{ runner.os }}-${{ matrix.architecture.name }}-wolfssl-${{ env.wolfssl-version }}-v1
# WolfSSL setup
- name: Checkout WolfSSL
if: steps.cache-wolfssl.outputs.cache-hit != 'true'
uses: actions/checkout@v4
with:
repository: 'wolfssl/wolfssl'
path: 'thirdparties/wolfssl'
ref: '${{ env.wolfssl-version }}'
# WolfSSL build
- name: Configure and install wolfssl
if: steps.cache-wolfssl.outputs.cache-hit != 'true'
working-directory: ${{github.workspace}}/thirdparties/wolfssl
run: |
cmake -B ./build \
-DCMAKE_INSTALL_PREFIX='${{github.workspace}}/thirdparties/wolfssl/install' \
-DCMAKE_C_FLAGS="$CFLAGS -fPIC" \
-DCMAKE_CXX_FLAGS="$CFLAGS -fPIC" \
-DBUILD_SHARED_LIBS=OFF -DWOLFSSL_OPENSSLEXTRA=ON -DWOLFSSL_ASM=OFF -DWOLFSSL_EXAMPLES=OFF -DWOLFSSL_CURL=ON
cmake --build ./build --config Release --parallel
cmake --install ./build --config Release
###
# cURL
###
- name: Cache cURL
id: cache-curl
uses: actions/cache@v4
with:
path: 'thirdparties/curl/install'
key: ${{ runner.os }}-${{ matrix.architecture.name }}-curl-${{ env.curl-version }}-v1
# cURL setup
- name: Checkout cURL
if: steps.cache-curl.outputs.cache-hit != 'true'
uses: actions/checkout@v4
with:
repository: 'curl/curl'
path: 'thirdparties/curl'
ref: 'curl-${{ env.curl-version }}'
# cURL build
- name: Configure and install curl
if: steps.cache-curl.outputs.cache-hit != 'true'
working-directory: ${{github.workspace}}/thirdparties/curl
run: |
cmake -B ./build \
-DCMAKE_INSTALL_PREFIX='${{github.workspace}}/thirdparties/curl/install' \
-DCURL_USE_LIBPSL=OFF \
-DCURL_USE_WOLFSSL=ON \
-DCURL_ZLIB="" \
-DCURL_BROTLI="" \
-DCURL_ZSTD="" \
-DCMAKE_SHARED_LINKER_FLAGS="-lm" \
-DWolfSSL_ROOT='${{github.workspace}}/thirdparties/wolfssl/install'
cmake --build ./build --config Release --parallel
cmake --install ./build --config Release
###
# Project
###
- uses: actions/checkout@v4
with:
path: 'source'
- name: CMake Settings
run: |
echo "CMAKE_PARAM=--log-level=VERBOSE \
-DCMAKE_INSTALL_PREFIX='${{github.workspace}}/install' \
-DOPENAL_LIBRARY='${{github.workspace}}/thirdparties/soft-oal' \
-DOPENAL_INCLUDE_DIR='${{github.workspace}}/thirdparties/soft-oal/install/include' \
-DCURL_ROOT='${{github.workspace}}/thirdparties/curl/install' \
-DGIT_REVISION_BUILD_NUMBER=${{ github.run_number }} \
-DPRODUCT_VERSION_STAGE='${{ env.RELEASE_STAGE }}'" >> $GITHUB_ENV
- name: Configure CMake
working-directory: ${{github.workspace}}
run: |
cmake -B ./build ${{ env.CMAKE_PARAM }} ./source
- name: Build
working-directory: ${{github.workspace}}
run: |
cmake --build ${{github.workspace}}/build --config ${{env.BUILD_TYPE}} --parallel
- name: Test
working-directory: ${{github.workspace}}
# Execute tests defined by the CMake configuration.
# See https://cmake.org/cmake/help/latest/manual/ctest.1.html for more detail
run: |
cd "${{github.workspace}}/build"
ctest -C ${{env.BUILD_TYPE}}
- name: Install
working-directory: ${{github.workspace}}
# Install to the directory defined in CMAKE_INSTALL_PREFIX
run: |
cmake --install ${{github.workspace}}/build --config ${{env.BUILD_TYPE}}
# Copy libraries
mkdir ${{github.workspace}}/package
cp -l ${{steps.sdl.outputs.prefix}}/lib/libSDL2-2.0.so.0 '${{github.workspace}}/package/'
cp -l ${{github.workspace}}/thirdparties/soft-oal/install/lib/libopenal.so.1 '${{github.workspace}}/package/'
cp -l ${{github.workspace}}/thirdparties/curl/install/lib*/libcurl.so.4 '${{github.workspace}}/package/'
if [ -d ${{github.workspace}}/install/bin ]; then cp -r ${{github.workspace}}/install/bin/openmohaa/. '${{github.workspace}}/package'; fi
if [ -d ${{github.workspace}}/install/lib ]; then cp -r ${{github.workspace}}/install/lib/openmohaa/. '${{github.workspace}}/package'; fi
###
# Artifacts
###
- uses: actions/upload-artifact@v4
with:
name: out-linux-${{matrix.architecture.name}}
if-no-files-found: error
path:
${{github.workspace}}/package

View file

@ -1,239 +0,0 @@
##########################
#
# Apple macOS
# macOS 15
#
# This version is used as the OS, as it's faster than other versions.
##########################
name: MacOS build workflow
on:
workflow_call:
inputs:
environment:
required: true
type: string
env:
# Customize the CMake build type here (Release, Debug, RelWithDebInfo, etc.)
BUILD_TYPE: RelWithDebInfo
RELEASE_STAGE: ${{ vars.RELEASE_STAGE || 'unstable' }}
jobs:
build:
strategy:
matrix:
architecture: [
#{name: 'x86_64', triple: 'x86_64-apple-macos10.8'},
#{name: 'arm64', triple: 'arm64-apple-macos11'}
#{name: 'x86_64', build_name: 'x86_64'},
#{name: 'arm64', build_name: 'arm64'},
# Compile into an universal binary
{name: 'multiarch(arm64-x86_64)', build_name: 'arm64;x86_64' }
]
name: "Building for platform macos-${{matrix.architecture.name}}"
runs-on: "macos-15"
env:
openal-soft-branch: '1.24.3'
wolfssl-version: 'v5.7.6-stable'
curl-version: '8_12_1'
steps:
###
# Packages
###
- name: Install required packages
run: |
brew install git flex bison ninja cmake llvm perl
- name: Settings
working-directory: ${{github.workspace}}
run: |
echo "CMAKE_GENERATOR=Ninja Multi-Config" >> $GITHUB_ENV
echo "CC=clang" >> $GITHUB_ENV
echo "CXX=clang++" >> $GITHUB_ENV
echo "MACOSX_DEPLOYMENT_TARGET=10.15" >> $GITHUB_ENV
###
# SDL
###
# Setup SDL
- name: Set up SDL
id: sdl
uses: libsdl-org/setup-sdl@main
with:
version: 2-latest
build-type: Release
cmake-arguments: "-DCMAKE_OSX_ARCHITECTURES='${{ matrix.architecture.build_name }}'
-DCMAKE_VERBOSE_MAKEFILE=on"
###
# OpenAL
###
- name: Cache OpenAL
id: cache-openal-soft
uses: actions/cache@v4
with:
path: 'thirdparties/soft-oal/install'
key: ${{ runner.os }}-${{ matrix.architecture.name }}-openal-soft-${{ env.openal-soft-branch }}-v1
# soft-oal setup
# Use GCC instead of Clang because of missing SSE intrinsics
# It also doesn't enable altivec support on PowerPC by default
- name: Checkout soft-oal
if: steps.cache-openal-soft.outputs.cache-hit != 'true'
uses: actions/checkout@v4
with:
repository: 'kcat/openal-soft'
path: 'thirdparties/soft-oal'
ref: '${{ env.openal-soft-branch }}'
# soft-oal build
- name: Configure and install soft-oal
if: steps.cache-openal-soft.outputs.cache-hit != 'true'
working-directory: ${{github.workspace}}/thirdparties/soft-oal
run: |
cmake -B ./build \
-DCMAKE_INSTALL_PREFIX='${{github.workspace}}/thirdparties/soft-oal/install' \
-DCMAKE_OSX_ARCHITECTURES='${{ matrix.architecture.build_name }}' \
-DCMAKE_VERBOSE_MAKEFILE=on
cmake --build ./build --config Release --parallel
cmake --install ./build --config Release
###
# WolfSSL
###
# FIXME: Figure out how to compile WolfSSL cross-architecture
#
# - name: Cache WolfSSL
# id: cache-wolfssl
# uses: actions/cache@v4
# with:
# path: 'thirdparties/wolfssl_install'
# key: ${{ runner.os }}-${{ matrix.architecture.name }}-wolfssl-${{ env.wolfssl-version }}-v1
#
# # WolfSSL setup
# - name: Checkout WolfSSL
# if: steps.cache-wolfssl.outputs.cache-hit != 'true'
# uses: actions/checkout@v4
# with:
# repository: 'wolfssl/wolfssl'
# path: 'thirdparties/wolfssl'
# ref: '${{ env.wolfssl-version }}'
#
# # WolfSSL build
# - name: Configure and install wolfssl
# if: steps.cache-wolfssl.outputs.cache-hit != 'true'
# working-directory: ${{github.workspace}}/thirdparties/wolfssl
# run: |
# cmake -B ./build \
# -DCMAKE_INSTALL_PREFIX='${{github.workspace}}/thirdparties/wolfssl_install' \
# -DCMAKE_OSX_ARCHITECTURES='${{ matrix.architecture.build_name }}' \
# -DBUILD_SHARED_LIBS=OFF -DWOLFSSL_OPENSSLEXTRA=ON -DWOLFSSL_ASM=OFF -DWOLFSSL_EXAMPLES=OFF -DWOLFSSL_CURL=ON
# cmake --build ./build --config Release --parallel
# cmake --install ./build --config Release
###
# cURL
###
- name: Cache cURL
id: cache-curl
uses: actions/cache@v4
with:
path: 'thirdparties/curl/install'
key: ${{ runner.os }}-${{ matrix.architecture.name }}-curl-${{ env.curl-version }}-v1
# cURL setup
- name: Checkout cURL
if: steps.cache-curl.outputs.cache-hit != 'true'
uses: actions/checkout@v4
with:
repository: 'curl/curl'
path: 'thirdparties/curl'
ref: 'curl-${{ env.curl-version }}'
# cURL build
- name: Configure and install curl
if: steps.cache-curl.outputs.cache-hit != 'true'
working-directory: ${{github.workspace}}/thirdparties/curl
run: |
cmake -B ./build \
-DCMAKE_INSTALL_PREFIX='${{github.workspace}}/thirdparties/curl/install' \
-DCMAKE_OSX_ARCHITECTURES='${{ matrix.architecture.build_name }}' \
-DCURL_USE_LIBPSL=OFF \
-DCURL_USE_WOLFSSL=OFF \
-DCURL_USE_LIBSSH2=OFF \
-DUSE_LIBIDN2=OFF \
-DUSE_NGHTTP2=OFF \
-DCURL_ENABLE_SSL=OFF \
-DCURL_ZLIB="" \
-DCURL_BROTLI="" \
-DCURL_ZSTD="" \
-DWolfSSL_ROOT='${{github.workspace}}/thirdparties/wolfssl_install'
cmake --build ./build --config Release --parallel
cmake --install ./build --config Release
###
# Project
###
- uses: actions/checkout@v4
with:
path: 'source'
- name: CMake Settings
run: |
echo "CMAKE_PARAM=--log-level=VERBOSE \
-DCMAKE_INSTALL_PREFIX='${{github.workspace}}/install' \
-DCMAKE_VERBOSE_MAKEFILE=on \
-DCMAKE_OSX_ARCHITECTURES='${{ matrix.architecture.build_name }}' \
-DOPENAL_LIBRARY='${{github.workspace}}/thirdparties/soft-oal/install' \
-DOPENAL_INCLUDE_DIR='${{github.workspace}}/thirdparties/soft-oal/install/include/AL' \
-DCURL_ROOT='${{github.workspace}}/thirdparties/curl/install' \
-DGIT_REVISION_BUILD_NUMBER=${{ github.run_number }} \
-DPRODUCT_VERSION_STAGE='${{ env.RELEASE_STAGE }}'" >> $GITHUB_ENV
- name: Configure CMake
working-directory: ${{github.workspace}}
run: |
cmake -B ./build ${{ env.CMAKE_PARAM }} ./source
- name: Build
working-directory: ${{github.workspace}}
run: |
cmake --build ${{github.workspace}}/build --config ${{env.BUILD_TYPE}} --parallel
- name: Test
working-directory: ${{github.workspace}}
# Execute tests defined by the CMake configuration.
# See https://cmake.org/cmake/help/latest/manual/ctest.1.html for more detail
run: |
cd "${{github.workspace}}/build"
ctest -C ${{env.BUILD_TYPE}}
- name: Install
working-directory: ${{github.workspace}}
# Install to the directory defined in CMAKE_INSTALL_PREFIX
run: |
cmake --install ${{github.workspace}}/build --config ${{env.BUILD_TYPE}}
# Create hard-link and copy symbolic links
mkdir ${{github.workspace}}/package
cp -l ${{steps.sdl.outputs.prefix}}/lib/libSDL2-2.0.0.dylib '${{github.workspace}}/package/'
cp -l ${{github.workspace}}/thirdparties/soft-oal/install/lib/libopenal.1.dylib '${{github.workspace}}/package/'
cp -l ${{github.workspace}}/thirdparties/curl/install/lib*/libcurl.4.dylib '${{github.workspace}}/package/'
if [ -d ${{github.workspace}}/install/bin ]; then cp -r ${{github.workspace}}/install/bin/openmohaa/. '${{github.workspace}}/package'; fi
if [ -d ${{github.workspace}}/install/lib ]; then cp -r ${{github.workspace}}/install/lib/openmohaa/. '${{github.workspace}}/package'; fi
###
# Artifacts
###
- uses: actions/upload-artifact@v4
with:
name: out-macos-${{matrix.architecture.name}}
if-no-files-found: error
path:
${{github.workspace}}/package

View file

@ -1,259 +0,0 @@
##########################
#
# Microsoft Windows
# Windows Server 2025
#
##########################
name: Windows build workflow
on:
workflow_call:
inputs:
environment:
required: true
type: string
env:
# Customize the CMake build type here (Release, Debug, RelWithDebInfo, etc.)
BUILD_TYPE: RelWithDebInfo
RELEASE_STAGE: ${{ vars.RELEASE_STAGE || 'unstable' }}
jobs:
build:
strategy:
matrix:
architecture: [
{name: 'x64', os: 'windows-2025', config: 'x64', toolset: 'x64', arch_option: 'VC-WIN64A' },
{name: 'x86', os: 'windows-2025', config: 'Win32', toolset: 'x64_x86', arch_option: 'VC-WIN32' },
{name: 'arm64', os: 'windows-11-arm', config: 'ARM64', toolset: 'x64_arm64', arch_option: 'VC-WIN64-ARM' }
]
name: "Building for platform windows-${{matrix.architecture.name}}"
runs-on: ${{ matrix.architecture.os }}
environment: ${{ inputs.environment }}
env:
flexbison-branch: 'v2.5.25'
wolfssl-version: 'v5.7.6-stable'
curl-version: '8_12_1'
openal-soft-branch: '1.24.3'
steps:
###
# Packages
###
- name: Cache Flex/Bison
id: cache-flexbison
uses: actions/cache@v4
with:
path: 'thirdparties/winflexbison-install'
key: ${{ runner.os }}-${{ matrix.architecture.name }}-flexbison-${{ env.flexbison-branch }}-v1
- name: Install Flex/Bison
if: steps.cache-flexbison.outputs.cache-hit != 'true'
working-directory: ${{github.workspace}}
run: |
mkdir thirdparties && cd thirdparties
git clone --depth 1 --single-branch --branch ${{ env.flexbison-branch }} https://github.com/lexxmark/winflexbison.git
cmake -B winflexbison-build -DCMAKE_INSTALL_PREFIX='${{github.workspace}}/thirdparties/winflexbison-install' ./winflexbison
cmake --build winflexbison-build --config Release --parallel
cmake --install winflexbison-build --config Release
- name: Settings
working-directory: ${{github.workspace}}
run: |
echo "CMAKE_GENERATOR=Ninja Multi-Config" >> $env:GITHUB_ENV
echo "CC=cl.exe" >> $env:GITHUB_ENV
echo "CXX=cl.exe" >> $env:GITHUB_ENV
pushd "$($env:PROGRAMFILES)\Microsoft Visual Studio\*\*\VC\Auxiliary\Build"
cmd /c "vcvarsall.bat ${{ matrix.architecture.toolset }} & set" | ForEach-Object {
if ($_ -match "=") {
# Split into key=value
$var = $_.split("=", 2);
echo "$($var[0])=$($var[1])" >> $env:GITHUB_ENV
}
}
popd
- name: Cache Required Packages
id: cache-required-packages
uses: actions/cache@v4
with:
path: 'C:\Packages'
key: ${{ runner.os }}-${{ matrix.architecture.name }}-required-packages-v1
- name: Install required packages
if: steps.cache-required-packages.outputs.cache-hit != 'true'
run: |
$DownloadPath="$($env:USERPROFILE)\Downloads"
if ("${{ matrix.architecture.config }}" -ieq "ARM64") {
Invoke-WebRequest "https://github.com/ninja-build/ninja/releases/download/v1.12.1/ninja-winarm64.zip" -OutFile "$DownloadPath\ninja-win.zip"
} else {
Invoke-WebRequest "https://github.com/ninja-build/ninja/releases/download/v1.12.1/ninja-win.zip" -OutFile "$DownloadPath\ninja-win.zip"
}
Expand-Archive -Path "$DownloadPath\ninja-win.zip" -DestinationPath "C:\Packages\ninja"
Invoke-WebRequest "https://download.qt.io/official_releases/jom/jom.zip" -OutFile "$DownloadPath\jom.zip"
Expand-Archive -Path "$DownloadPath\jom.zip" -DestinationPath "C:\Packages\jom"
- name: Setup required packages path
run: |
$env:PATH += ";C:\Packages\ninja;C:\Packages\jom;"
echo "PATH=$($env:PATH)" >> $env:GITHUB_ENV
###
# SDL
###
# Setup SDL
- name: Set up SDL
id: sdl
uses: libsdl-org/setup-sdl@main
with:
version: 2-latest
build-type: Release
cmake-arguments: ""
###
# OpenAL
###
- name: Cache OpenAL
id: cache-openal-soft
uses: actions/cache@v4
with:
path: 'thirdparties/soft-oal/install'
key: ${{ runner.os }}-${{ matrix.architecture.name }}-openal-soft-${{ env.openal-soft-branch }}-v1
# soft-oal setup
- name: Checkout soft-oal
if: steps.cache-openal-soft.outputs.cache-hit != 'true'
uses: actions/checkout@v4
with:
repository: 'kcat/openal-soft'
path: 'thirdparties/soft-oal'
ref: '${{ env.openal-soft-branch }}'
# soft-oal build
# Statically link the CRT runtime into OAL as a workaround to prevent crashes
- name: Configure and install soft-oal
if: steps.cache-openal-soft.outputs.cache-hit != 'true'
working-directory: ${{github.workspace}}/thirdparties/soft-oal
run: |
cmake -B ./build `
-DCMAKE_INSTALL_PREFIX='${{github.workspace}}/thirdparties/soft-oal/install' `
-DALSOFT_BUILD_ROUTER=OFF `
-DALSOFT_REQUIRE_WINMM=ON `
-DALSOFT_REQUIRE_DSOUND=ON `
-DALSOFT_REQUIRE_WASAPI=ON `
-DCMAKE_C_FLAGS_RELEASE="/MT /O2 /Ob2 /DNDEBUG" `
-DCMAKE_CXX_FLAGS_RELEASE="/MT /O2 /Ob2 /DNDEBUG" `
-DCMAKE_C_FLAGS_MINSIZEREL="/MT /O2 /Ob2 /DNDEBUG" `
-DCMAKE_CXX_FLAGS_MINSIZEREL="/MT /O1 /Ob1 /DNDEBUG" `
-DCMAKE_C_FLAGS_RELWITHDEBINFO="/MT /Zi /O2 /Ob1 /DNDEBUG" `
-DCMAKE_CXX_FLAGS_RELWITHDEBINFO="/MT /Zi /O2 /Ob1 /DNDEBUG"
cmake --build ./build --config Release --parallel
cmake --install ./build --config Release
# Unfortunately soft-oal produces a binary called OpenAL32 even in 64-bit
if (("x64", "ARM64") -icontains "${{ matrix.architecture.config }}") { Rename-Item -Path '.\install\bin\OpenAL32.dll' -NewName 'OpenAL64.dll' }
###
# cURL
#
# Uses Schannel as SSL backend, native CAs are used
###
- name: Cache cURL
id: cache-curl
uses: actions/cache@v4
with:
path: 'thirdparties/curl/install'
key: ${{ runner.os }}-${{ matrix.architecture.name }}-curl-${{ env.curl-version }}-v1
# cURL setup
- name: Checkout cURL
if: steps.cache-curl.outputs.cache-hit != 'true'
uses: actions/checkout@v4
with:
repository: 'curl/curl'
path: 'thirdparties/curl'
ref: 'curl-${{ env.curl-version }}'
# cURL build
- name: Configure and install curl
if: steps.cache-curl.outputs.cache-hit != 'true'
working-directory: ${{github.workspace}}/thirdparties/curl
run: |
cmake -B ./build `
-DCMAKE_INSTALL_PREFIX='${{github.workspace}}/thirdparties/curl/install' `
-DCURL_USE_LIBPSL=OFF `
-DCURL_USE_SCHANNEL=ON
cmake --build ./build --config Release --parallel
cmake --install ./build --config Release
###
# Project
###
- uses: actions/checkout@v4
with:
path: 'source'
- name: CMake Settings
run: |
echo "CMAKE_PARAM= `
--log-level=VERBOSE `
-DCMAKE_INSTALL_PREFIX='${{github.workspace}}/install' `
-DGIT_REVISION_BUILD_NUMBER=${{ github.run_number }} `
-DBISON_EXECUTABLE='${{github.workspace}}/thirdparties/winflexbison-install/win_bison.exe' `
-DOPENAL_LIBRARY='${{github.workspace}}/thirdparties/soft-oal' `
-DOPENAL_INCLUDE_DIR='${{github.workspace}}/thirdparties/soft-oal/install/include' `
-DCURL_ROOT='${{github.workspace}}/thirdparties/curl/install' `
-DFLEX_EXECUTABLE='${{github.workspace}}/thirdparties/winflexbison-install/win_flex.exe' `
-DPRODUCT_VERSION_STAGE='${{ env.RELEASE_STAGE }}'".Replace("`r", "").Replace("`n", "") >> $env:GITHUB_ENV
- name: Configure CMake
working-directory: ${{github.workspace}}
run: |
cmake -B ./build ${{ env.CMAKE_PARAM }} ./source
- name: Build
working-directory: ${{github.workspace}}
run: |
cmake --build ${{github.workspace}}/build --config ${{env.BUILD_TYPE}} --parallel
- name: Test
working-directory: ${{github.workspace}}
# Execute tests defined by the CMake configuration.
# See https://cmake.org/cmake/help/latest/manual/ctest.1.html for more detail
run: |
cd "${{github.workspace}}/build"
ctest -C ${{env.BUILD_TYPE}}
- name: Install
working-directory: ${{github.workspace}}
# Install to the directory defined in CMAKE_INSTALL_PREFIX
run: |
cmake --install ${{github.workspace}}/build --config ${{env.BUILD_TYPE}}
New-Item -ItemType Directory '${{github.workspace}}/package'
Copy-Item '${{steps.sdl.outputs.prefix}}/bin/*.dll' -Destination '${{github.workspace}}/package'
Copy-Item '${{github.workspace}}/thirdparties/soft-oal/install/bin/*.dll' -Destination '${{github.workspace}}/package'
Copy-Item '${{github.workspace}}/thirdparties/curl/install/bin/*.dll' -Destination '${{github.workspace}}/package'
if (Test-Path ${{github.workspace}}/install/bin) { Copy-Item '${{github.workspace}}/install/bin/*' -Include '*.dll','*.exe','*.pdb' -Destination '${{github.workspace}}/package' }
if (Test-Path ${{github.workspace}}/install/lib) { Copy-Item '${{github.workspace}}/install/lib/*' -Include '*.dll','*.exe','*.pdb' -Destination '${{github.workspace}}/package' }
###
# Artifact
###
- uses: actions/upload-artifact@v4
with:
name: out-windows-${{matrix.architecture.name}}
if-no-files-found: error
path: |
${{github.workspace}}/package
!${{github.workspace}}/package/**/*.pdb
- uses: actions/upload-artifact@v4
with:
name: out-windows-${{matrix.architecture.name}}-pdb
if-no-files-found: error
path: |
${{github.workspace}}/package

View file

@ -7,18 +7,471 @@ on:
required: true required: true
type: string type: string
env:
# Customize the CMake build type here (Release, Debug, RelWithDebInfo, etc.)
BUILD_TYPE: RelWithDebInfo
RELEASE_STAGE: ${{ vars.RELEASE_STAGE || 'unstable' }}
jobs: jobs:
##########################
#
# Linux
# Ubuntu 22.04
#
# Using this version instead of 24.04 to use a lower GLIBC version (2.34)
##########################
build-platform-linux: build-platform-linux:
uses: ./.github/workflows/shared-build-linux.yml strategy:
with: matrix:
architecture: [
{name: 'amd64', triple: 'x86_64-linux-gnu'},
{name: 'i686', triple: 'i686-linux-gnu'},
{name: 'arm64', triple: 'aarch64-linux-gnu'},
{name: 'armhf', triple: 'arm-linux-gnueabihf'},
{name: 'powerpc', triple: 'powerpc-linux-gnu'},
{name: 'ppc64', triple: 'powerpc64-linux-gnu'},
{name: 'ppc64el', triple: 'powerpc64le-linux-gnu'}
]
name: "Building for platform linux-${{matrix.architecture.name}}"
runs-on: "ubuntu-22.04"
environment: ${{ inputs.environment }} environment: ${{ inputs.environment }}
steps:
###
# Packages
###
- uses: awalsh128/cache-apt-pkgs-action@latest
name: Install required packages
with:
packages: flex bison ninja-build cmake clang libpulse-dev portaudio19-dev libasound2-dev libjack-dev libpipewire-0.3-dev qtbase5-dev libdbus-1-dev
version: "0.1"
- uses: awalsh128/cache-apt-pkgs-action@latest
name: Install required cross-platform packages (${{ matrix.architecture.triple }})
if: matrix.architecture.name != 'amd64'
with:
packages: gcc-12-${{ matrix.architecture.triple }} g++-12-${{ matrix.architecture.triple }}
version: "0.1"
- name: Settings
working-directory: ${{github.workspace}}
run: |
echo "CMAKE_GENERATOR=Ninja Multi-Config" >> $GITHUB_ENV
echo "CC=clang" >> $GITHUB_ENV
echo "CXX=clang++" >> $GITHUB_ENV
echo "CFLAGS='--target=${{ matrix.architecture.triple }}'" >> $GITHUB_ENV
echo "CXXFLAGS='--target=${{ matrix.architecture.triple }}'" >> $GITHUB_ENV
# Temporary workaround for PowerPC as the 1.24.0 version doesn't check for altivec
# Will use older versions until a new tag is created with this issue resolved
if [ ${{ matrix.architecture.name }} != 'powerpc' ] && [ ${{ matrix.architecture.name }} != 'ppc64' ] && [ ${{ matrix.architecture.name }} != 'ppc64el' ]; then
echo "OPENAL_REF=1.24.0" >> $GITHUB_ENV
else
echo "OPENAL_REF=1.23.1" >> $GITHUB_ENV
fi
###
# SDL
###
# Setup SDL
- name: Set up SDL
id: sdl
uses: libsdl-org/setup-sdl@main
with:
version: 2-latest
build-type: Release
# Workaround for when changing the runner OS version
cmake-arguments: "-DCACHE_OS_VERSION=Ubuntu_22.04"
###
# OpenAL
###
# soft-oal setup
- name: Checkout soft-oal
uses: actions/checkout@v4
with:
repository: 'kcat/openal-soft'
path: 'thirdparties/soft-oal'
ref: ${{ env.OPENAL_REF }}
- name: Configure and install soft-oal
working-directory: ${{github.workspace}}/thirdparties/soft-oal
run: |
cmake -B ./build \
-DCMAKE_INSTALL_PREFIX='${{github.workspace}}/thirdparties/soft-oal/install'
cmake --build ./build --config Release --parallel
cmake --install ./build --config Release
###
# Project
###
- uses: actions/checkout@v4
with:
path: 'source'
- name: CMake Settings
run: |
echo "CMAKE_PARAM=--log-level=VERBOSE \
-DCMAKE_INSTALL_PREFIX='${{github.workspace}}/install' \
-DOPENAL_LIBRARY='${{github.workspace}}/thirdparties/soft-oal' \
-DOPENAL_INCLUDE_DIR='${{github.workspace}}/thirdparties/soft-oal/include' \
-DGIT_REVISION_BUILD_NUMBER=${{ github.run_number }} \
-DPRODUCT_VERSION_STAGE='${{ env.RELEASE_STAGE }}'" >> $GITHUB_ENV
- name: Configure CMake
working-directory: ${{github.workspace}}
run: |
cmake -B ./build ${{ env.CMAKE_PARAM }} ./source
- name: Build
working-directory: ${{github.workspace}}
run: |
cmake --build ${{github.workspace}}/build --config ${{env.BUILD_TYPE}} --parallel
- name: Test
working-directory: ${{github.workspace}}
# Execute tests defined by the CMake configuration.
# See https://cmake.org/cmake/help/latest/manual/ctest.1.html for more detail
run: |
cd "${{github.workspace}}/build"
ctest -C ${{env.BUILD_TYPE}}
- name: Install
working-directory: ${{github.workspace}}
# Install to the directory defined in CMAKE_INSTALL_PREFIX
run: |
cmake --install ${{github.workspace}}/build --config ${{env.BUILD_TYPE}}
# Copy libraries
mkdir ${{github.workspace}}/package
cp -l ${{steps.sdl.outputs.prefix}}/lib/libSDL2-2.0.so.0 '${{github.workspace}}/package/'
cp -l ${{github.workspace}}/thirdparties/soft-oal/install/lib/libopenal.so.1 '${{github.workspace}}/package/'
if [ -d ${{github.workspace}}/install/bin ]; then cp -r ${{github.workspace}}/install/bin/openmohaa/. '${{github.workspace}}/package'; fi
if [ -d ${{github.workspace}}/install/lib ]; then cp -r ${{github.workspace}}/install/lib/openmohaa/. '${{github.workspace}}/package'; fi
###
# Artifacts
###
- uses: actions/upload-artifact@v4
with:
name: out-linux-${{matrix.architecture.name}}
if-no-files-found: error
path:
${{github.workspace}}/package
##########################
#
# Microsoft Windows
# Windows Server 2022
#
##########################
build-platform-windows: build-platform-windows:
uses: ./.github/workflows/shared-build-windows.yml strategy:
with: matrix:
architecture: [
{name: 'x64', config: 'x64', toolset: 'x64' },
{name: 'x86', config: 'Win32', toolset: 'x64_x86' },
{name: 'arm64', config: 'ARM64', toolset: 'x64_arm64' }
]
name: "Building for platform windows-${{matrix.architecture.name}}"
runs-on: "windows-2022"
environment: ${{ inputs.environment }} environment: ${{ inputs.environment }}
build-platform-macos: steps:
uses: ./.github/workflows/shared-build-macos.yml ###
# Packages
###
#
# Commented out for now, chocolatey servers started complaining about too many requests
#
#- name: Install required packages
# run: |
# choco install -y ninja
- name: Install required packages
run: |
$DownloadPath="$($env:USERPROFILE)\Downloads"
Invoke-WebRequest "https://github.com/ninja-build/ninja/releases/download/v1.12.1/ninja-win.zip" -OutFile "$DownloadPath\ninja-win.zip"
Expand-Archive -Path "$DownloadPath\ninja-win.zip" -DestinationPath "$($env:PROGRAMFILES)\ninja"
echo "$($env:PROGRAMFILES)\ninja" >> $GITHUB_PATH
- name: Install Flex/Bison
working-directory: ${{github.workspace}}
run: |
mkdir thirdparties && cd thirdparties
git clone --depth 1 --single-branch --branch v2.5.25 https://github.com/lexxmark/winflexbison.git
cmake -B winflexbison-build -DCMAKE_INSTALL_PREFIX='${{github.workspace}}/thirdparties/winflexbison-install' ./winflexbison
cmake --build winflexbison-build --config Release --parallel
cmake --install winflexbison-build --config Release
- name: Settings
working-directory: ${{github.workspace}}
run: |
echo "CMAKE_GENERATOR=Ninja Multi-Config" >> $env:GITHUB_ENV
echo "CC=cl.exe" >> $env:GITHUB_ENV
echo "CXX=cl.exe" >> $env:GITHUB_ENV
pushd "$($env:PROGRAMFILES)\Microsoft Visual Studio\*\*\VC\Auxiliary\Build"
cmd /c "vcvarsall.bat ${{ matrix.architecture.toolset }} & set" | ForEach-Object {
if ($_ -match "=") {
# Split into key=value
$var = $_.split("=", 2);
echo "$($var[0])=$($var[1])" >> $env:GITHUB_ENV
}
}
popd
###
# SDL
###
# Setup SDL
- name: Set up SDL
id: sdl
uses: libsdl-org/setup-sdl@main
with: with:
version: 2-latest
build-type: Release
cmake-arguments: ""
###
# OpenAL
###
# soft-oal setup
- name: Checkout soft-oal
uses: actions/checkout@v4
with:
repository: 'kcat/openal-soft'
path: 'thirdparties/soft-oal'
ref: '1.24.0'
# soft-oal build
# Statically link the CRT runtime into OAL as a workaround to prevent crashes
- name: Configure and install soft-oal
working-directory: ${{github.workspace}}/thirdparties/soft-oal
run: |
cmake -B ./build `
-DCMAKE_INSTALL_PREFIX='${{github.workspace}}/thirdparties/soft-oal/install' `
-DALSOFT_BUILD_ROUTER=OFF `
-DALSOFT_REQUIRE_WINMM=ON `
-DALSOFT_REQUIRE_DSOUND=ON `
-DALSOFT_REQUIRE_WASAPI=ON `
-DCMAKE_C_FLAGS_RELEASE="/MT /O2 /Ob2 /DNDEBUG" `
-DCMAKE_CXX_FLAGS_RELEASE="/MT /O2 /Ob2 /DNDEBUG" `
-DCMAKE_C_FLAGS_MINSIZEREL="/MT /O2 /Ob2 /DNDEBUG" `
-DCMAKE_CXX_FLAGS_MINSIZEREL="/MT /O1 /Ob1 /DNDEBUG" `
-DCMAKE_C_FLAGS_RELWITHDEBINFO="/MT /Zi /O2 /Ob1 /DNDEBUG" `
-DCMAKE_CXX_FLAGS_RELWITHDEBINFO="/MT /Zi /O2 /Ob1 /DNDEBUG"
cmake --build ./build --config Release --parallel
cmake --install ./build --config Release
# Unfortunately soft-oal produces a binary called OpenAL32 even in 64-bit
if (("x64", "ARM64") -icontains "${{ matrix.architecture.config }}") { Rename-Item -Path '.\install\bin\OpenAL32.dll' -NewName 'OpenAL64.dll' }
###
# Project
###
- uses: actions/checkout@v4
with:
path: 'source'
- name: CMake Settings
run: |
echo "CMAKE_PARAM= `
--log-level=VERBOSE `
-DCMAKE_INSTALL_PREFIX='${{github.workspace}}/install' `
-DGIT_REVISION_BUILD_NUMBER=${{ github.run_number }} `
-DBISON_EXECUTABLE='${{github.workspace}}/thirdparties/winflexbison-install/win_bison.exe' `
-DOPENAL_LIBRARY='${{github.workspace}}/thirdparties/soft-oal' `
-DOPENAL_INCLUDE_DIR='${{github.workspace}}/thirdparties/soft-oal/include' `
-DFLEX_EXECUTABLE='${{github.workspace}}/thirdparties/winflexbison-install/win_flex.exe' `
-DPRODUCT_VERSION_STAGE='${{ env.RELEASE_STAGE }}'".Replace("`r", "").Replace("`n", "") >> $env:GITHUB_ENV
- name: Configure CMake
working-directory: ${{github.workspace}}
run: |
cmake -B ./build ${{ env.CMAKE_PARAM }} ./source
- name: Build
working-directory: ${{github.workspace}}
run: |
cmake --build ${{github.workspace}}/build --config ${{env.BUILD_TYPE}} --parallel
- name: Test
working-directory: ${{github.workspace}}
# Execute tests defined by the CMake configuration.
# See https://cmake.org/cmake/help/latest/manual/ctest.1.html for more detail
run: |
cd "${{github.workspace}}/build"
ctest -C ${{env.BUILD_TYPE}}
- name: Install
working-directory: ${{github.workspace}}
# Install to the directory defined in CMAKE_INSTALL_PREFIX
run: |
cmake --install ${{github.workspace}}/build --config ${{env.BUILD_TYPE}}
New-Item -ItemType Directory '${{github.workspace}}/package'
Copy-Item '${{steps.sdl.outputs.prefix}}/bin/*.dll' -Destination '${{github.workspace}}/package'
Copy-Item '${{github.workspace}}/thirdparties/soft-oal/install/bin/*.dll' -Destination '${{github.workspace}}/package'
if (Test-Path ${{github.workspace}}/install/bin) { Copy-Item '${{github.workspace}}/install/bin/*' -Include '*.dll','*.exe','*.pdb' -Destination '${{github.workspace}}/package' }
if (Test-Path ${{github.workspace}}/install/lib) { Copy-Item '${{github.workspace}}/install/lib/*' -Include '*.dll','*.exe','*.pdb' -Destination '${{github.workspace}}/package' }
###
# Artifact
###
- uses: actions/upload-artifact@v4
with:
name: out-windows-${{matrix.architecture.name}}
if-no-files-found: error
path: |
${{github.workspace}}/package
!${{github.workspace}}/package/**/*.pdb
- uses: actions/upload-artifact@v4
with:
name: out-windows-${{matrix.architecture.name}}-pdb
if-no-files-found: error
path: |
${{github.workspace}}/package
##########################
#
# Apple macOS
# macOS 14
#
# This version is used as the OS, as older versions are slower.
##########################
build-platform-macos:
strategy:
matrix:
architecture: [
{name: 'x86_64', triple: 'x86_64-apple-macos10.8'},
{name: 'arm64', triple: 'arm64-apple-macos11'}
]
name: "Building for platform macos-${{matrix.architecture.name}}"
runs-on: "macos-14"
environment: ${{inputs.environment}} environment: ${{inputs.environment}}
steps:
###
# Packages
###
# Install required packages
# Paths on x86_64 and ARM64 are different for homebrew
- name: Install required packages
run: |
brew update && brew install git flex bison ninja cmake llvm ninja
- name: Settings
working-directory: ${{github.workspace}}
run: |
echo "CMAKE_GENERATOR=Ninja Multi-Config" >> $GITHUB_ENV
echo "CC=clang" >> $GITHUB_ENV
echo "CXX=clang++" >> $GITHUB_ENV
echo "MACOSX_DEPLOYMENT_TARGET=10.15" >> $GITHUB_ENV
###
# SDL
###
# Setup SDL
- name: Set up SDL
id: sdl
uses: libsdl-org/setup-sdl@main
with:
version: 2-latest
build-type: Release
cmake-arguments: "-DCMAKE_OSX_ARCHITECTURES=${{ matrix.architecture.name }}
-DCMAKE_VERBOSE_MAKEFILE=on"
###
# OpenAL
###
# soft-oal setup
# Use GCC instead of Clang because of missing SSE intrinsics
# It also doesn't enable altivec support on PowerPC by default
- name: Checkout soft-oal
uses: actions/checkout@v4
with:
repository: 'kcat/openal-soft'
path: 'thirdparties/soft-oal'
ref: '1.24.0'
- name: Configure and install soft-oal
working-directory: ${{github.workspace}}/thirdparties/soft-oal
run: |
cmake -B ./build \
-DCMAKE_INSTALL_PREFIX='${{github.workspace}}/thirdparties/soft-oal/install' \
-DCMAKE_OSX_ARCHITECTURES=${{ matrix.architecture.name }} \
-DCMAKE_VERBOSE_MAKEFILE=on
cmake --build ./build --config Release --parallel
cmake --install ./build --config Release
###
# Project
###
- uses: actions/checkout@v4
with:
path: 'source'
- name: CMake Settings
run: |
echo "CMAKE_PARAM=--log-level=VERBOSE \
-DCMAKE_INSTALL_PREFIX='${{github.workspace}}/install' \
-DCMAKE_VERBOSE_MAKEFILE=on \
-DCMAKE_OSX_ARCHITECTURES=${{ matrix.architecture.name }} \
-DOPENAL_LIBRARY='${{github.workspace}}/thirdparties/soft-oal/install' \
-DOPENAL_INCLUDE_DIR='${{github.workspace}}/thirdparties/soft-oal/install/include/AL' \
-DGIT_REVISION_BUILD_NUMBER=${{ github.run_number }} \
-DPRODUCT_VERSION_STAGE='${{ env.RELEASE_STAGE }}'" >> $GITHUB_ENV
- name: Configure CMake
working-directory: ${{github.workspace}}
run: |
cmake -B ./build ${{ env.CMAKE_PARAM }} ./source
- name: Build
working-directory: ${{github.workspace}}
run: |
cmake --build ${{github.workspace}}/build --config ${{env.BUILD_TYPE}} --parallel
- name: Test
working-directory: ${{github.workspace}}
# Execute tests defined by the CMake configuration.
# See https://cmake.org/cmake/help/latest/manual/ctest.1.html for more detail
run: |
cd "${{github.workspace}}/build"
ctest -C ${{env.BUILD_TYPE}}
- name: Install
working-directory: ${{github.workspace}}
# Install to the directory defined in CMAKE_INSTALL_PREFIX
run: |
cmake --install ${{github.workspace}}/build --config ${{env.BUILD_TYPE}}
# Create hard-link and copy symbolic links
mkdir ${{github.workspace}}/package
cp -l ${{steps.sdl.outputs.prefix}}/lib/libSDL2-2.0.0.dylib '${{github.workspace}}/package/'
cp -l ${{github.workspace}}/thirdparties/soft-oal/install/lib/libopenal.1.dylib '${{github.workspace}}/package/'
if [ -d ${{github.workspace}}/install/bin ]; then cp -r ${{github.workspace}}/install/bin/openmohaa/. '${{github.workspace}}/package'; fi
if [ -d ${{github.workspace}}/install/lib ]; then cp -r ${{github.workspace}}/install/lib/openmohaa/. '${{github.workspace}}/package'; fi
###
# Artifacts
###
- uses: actions/upload-artifact@v4
with:
name: out-macos-${{matrix.architecture.name}}
if-no-files-found: error
path:
${{github.workspace}}/package

View file

@ -38,9 +38,8 @@ jobs:
'windows-x86-pdb', 'windows-x86-pdb',
'windows-arm64', 'windows-arm64',
'windows-arm64-pdb', 'windows-arm64-pdb',
#'macos-x86_64', 'macos-x86_64',
#'macos-arm64', 'macos-arm64'
'macos-multiarch(arm64-x86_64)',
] ]
runs-on: ubuntu-24.04 runs-on: ubuntu-24.04
@ -57,8 +56,8 @@ jobs:
path: ${{github.workspace}}/${{matrix.target_os}} path: ${{github.workspace}}/${{matrix.target_os}}
- name: Zip - name: Zip
working-directory: '${{github.workspace}}/${{matrix.target_os}}' working-directory: ${{github.workspace}}/${{matrix.target_os}}
run: zip -r "../${{ env.RELEASE_NAME }}.zip" ./ run: zip -r ../${{ env.RELEASE_NAME }}.zip ./
- name: Release - name: Release
uses: softprops/action-gh-release@v2 uses: softprops/action-gh-release@v2

View file

@ -1,10 +1,9 @@
cmake_minimum_required(VERSION 3.12) cmake_minimum_required(VERSION 3.5)
project(openmohaa) project(openmohaa)
include(misc/cmake/TargetArch.cmake) include(TargetArch.cmake)
target_architecture(TARGET_ARCH) target_architecture(TARGET_ARCH)
list(LENGTH TARGET_ARCH TARGET_ARCH_COUNT)
set(USE_INTERNAL_LIBS ON) set(USE_INTERNAL_LIBS ON)
if(USE_SYSTEM_LIBS) if(USE_SYSTEM_LIBS)
@ -14,13 +13,12 @@ endif()
option(USE_INTERNAL_JPEG "If set, use bundled libjpeg." ${USE_INTERNAL_LIBS}) option(USE_INTERNAL_JPEG "If set, use bundled libjpeg." ${USE_INTERNAL_LIBS})
option(USE_INTERNAL_MAD "If set, use bundled libmad." ${USE_INTERNAL_LIBS}) option(USE_INTERNAL_MAD "If set, use bundled libmad." ${USE_INTERNAL_LIBS})
option(USE_INTERNAL_ZLIB "If set, use bundled zlib." ${USE_INTERNAL_LIBS}) option(USE_INTERNAL_ZLIB "If set, use bundled zlib." ${USE_INTERNAL_LIBS})
option(USE_RENDERER_DLOPEN "Whether to compile the renderer as separate pluggable modules" OFF)
option(TARGET_LOCAL_SYSTEM "Indicate that the project will be compiled and installed for the local system" OFF)
if(TARGET_GAME_TYPE) if(TARGET_GAME_TYPE)
message(SEND_ERROR "TARGET_GAME_TYPE is now unsupported, it is now done at runtime.") message(SEND_ERROR "TARGET_GAME_TYPE is now unsupported, it is now done at runtime.")
endif() endif()
set(TARGET_BASE_GAME "./") set(TARGET_BASE_GAME "./")
set(CMAKE_DEBUG_POSTFIX "-dbg") set(CMAKE_DEBUG_POSTFIX "-dbg")
@ -64,39 +62,27 @@ if(DEBUG_MEMORY)
add_definitions(-D_DEBUG_MEM) add_definitions(-D_DEBUG_MEM)
endif() endif()
if("${TARGET_ARCH}" STREQUAL "i386") IF("${TARGET_ARCH}" STREQUAL "i386")
set(TARGET_ARCH_SUFFIX "x86") set(TARGET_ARCH_SUFFIX "x86")
else() ELSE()
set(TARGET_ARCH_SUFFIX ${TARGET_ARCH}) set(TARGET_ARCH_SUFFIX ${TARGET_ARCH})
endif() ENDIF()
message(STATUS "Architecture detected: ${TARGET_ARCH}")
if(TARGET_LOCAL_SYSTEM)
add_definitions(-DTARGET_LOCAL_SYSTEM)
# As it targets the local system, no need to know about the architecture used
set(TARGET_BIN_SUFFIX "")
message(STATUS "Binary suffix will not be used as the local system is the target")
elseif(${TARGET_ARCH_COUNT} GREATER 1)
add_definitions(-DTARGET_MULTIPLE_ARCHITECTURES)
set(TARGET_BIN_SUFFIX ".multiarch")
message(STATUS "Multiple architectures were specified, suffix set to 'multiarch'.")
else()
set(TARGET_BIN_SUFFIX ".${TARGET_ARCH}") set(TARGET_BIN_SUFFIX ".${TARGET_ARCH}")
message(STATUS "Binary suffix set to '${TARGET_ARCH_SUFFIX}'.")
endif()
if(WIN32) message(STATUS "Architecture detected: ${TARGET_ARCH}, suffix set to ${TARGET_ARCH_SUFFIX}.")
IF(WIN32)
set(TARGET_PLATFORM_PREFIX "") set(TARGET_PLATFORM_PREFIX "")
message(STATUS "Using Win32 naming convention") message(STATUS "Using Win32 naming convention")
elseif(UNIX) ELSEIF(UNIX)
set(TARGET_PLATFORM_PREFIX "") set(TARGET_PLATFORM_PREFIX "")
message(STATUS "Using Unix naming convention") message(STATUS "Using Unix naming convention")
else() ELSE()
set(TARGET_PLATFORM_PREFIX "") set(TARGET_PLATFORM_PREFIX "")
endif() ENDIF()
if(CMAKE_BUILD_TYPE MATCHES Debug) IF(CMAKE_BUILD_TYPE MATCHES Debug)
add_compile_definitions(_DEBUG) add_compile_definitions(_DEBUG)
# NOTE: The following may mess up function importation # NOTE: The following may mess up function importation
@ -105,10 +91,10 @@ if(CMAKE_BUILD_TYPE MATCHES Debug)
# set(CMAKE_ENABLE_EXPORTS ON) # set(CMAKE_ENABLE_EXPORTS ON)
# message(STATUS "Enabling exports on Unix for backtrace") # message(STATUS "Enabling exports on Unix for backtrace")
#endif() #endif()
else() ELSE()
# Non-debug builds # Non-debug builds
add_compile_definitions(NDEBUG) add_compile_definitions(NDEBUG)
endif() ENDIF()
if(APPLE) if(APPLE)
# macOS doesn't search the executable path by default # macOS doesn't search the executable path by default
@ -134,7 +120,7 @@ if(WIN32)
set(LIB_INSTALL_SUBDIR ".") set(LIB_INSTALL_SUBDIR ".")
else() else()
# Unix # Unix
set(CMAKE_DEFAULT_INSTALL_RUNTIME_DIR lib${CMAKE_LIB_SUFFIX}) set(CMAKE_DEFAULT_INSTALL_RUNTIME_DIR lib)
set(BIN_INSTALL_SUBDIR ${CMAKE_PROJECT_NAME}) set(BIN_INSTALL_SUBDIR ${CMAKE_PROJECT_NAME})
set(LIB_INSTALL_SUBDIR ${CMAKE_PROJECT_NAME}) set(LIB_INSTALL_SUBDIR ${CMAKE_PROJECT_NAME})
endif() endif()
@ -185,17 +171,21 @@ if (NOT BUILD_NO_CLIENT)
## ##
## Client app ## Client app
## ##
option(NO_MODERN_DMA "Use older sound-system" FALSE)
add_subdirectory("code/client") add_subdirectory("code/client")
add_subdirectory("code/renderercommon") add_subdirectory("code/renderer")
add_subdirectory("code/sdl") add_subdirectory("code/sdl")
#include("code/renderergl2/glsl/shaders.cmake")
#file(GLOB_RECURSE SOURCES_RENDERER "code/sdl/*.c" "code/renderercommon/*.c" "code/renderergl2/*.c" "code/renderergl2/*.cpp")
#list(FILTER SOURCES_RENDERER EXCLUDE REGEX "code/renderergl2/tr_subs.c")
#list(FILTER SOURCES_RENDERER EXCLUDE REGEX "code/renderergl2/tr_model.c")
add_executable(openmohaa "misc/dummy.c") add_executable(openmohaa "misc/dummy.c")
target_link_libraries(openmohaa PRIVATE syslib) target_link_libraries(openmohaa PRIVATE syslib)
target_link_libraries(openmohaa PRIVATE omohserver) target_link_libraries(openmohaa PRIVATE omohserver)
target_link_libraries(openmohaa PRIVATE omohclient) target_link_libraries(openmohaa PRIVATE omohclient)
target_link_libraries(openmohaa PRIVATE omohrenderer) target_link_libraries(openmohaa PRIVATE omohrenderer omohsdl)
target_link_libraries(openmohaa PRIVATE qcommon qcommon_standalone) target_link_libraries(openmohaa PRIVATE qcommon qcommon_standalone)
# Add the gamespy dependency # Add the gamespy dependency
@ -270,3 +260,4 @@ if(NOT TARGET uninstall)
add_custom_target(uninstall add_custom_target(uninstall
COMMAND ${CMAKE_COMMAND} -P ${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake) COMMAND ${CMAKE_COMMAND} -P ${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake)
endif() endif()

View file

@ -10,15 +10,13 @@
## Intro ## Intro
The main goal of OpenMoHAA is to ensure the future and continuity of **Medal of Honor: Allied Assault** (including Spearhead and Breakthrough expansions) on all platforms/architectures by providing new patches/features. Thanks to the ioquake3 project and the F.A.K.K SDK, OpenMoHAA has already reached more than half of its goal: an open-source version of MoH:AA (based on version 2.40) that is fully compatible with both the original game and expansions, in terms of network protocol, assets, and scripts. OpenMoHAA is compatible with both MOH:AA servers and clients (Spearhead and Breakthrough included). The main goal of OpenMoHAA is to ensure the future and continuity of **Medal of Honor: Allied Assault** on all platforms/architectures by providing new patches/features. Thanks to the ioquake3 project and the F.A.K.K SDK, OpenMoHAA has already reached more than half of its goal: an open-source version of MoH:AA (based on version 2.40) that is fully compatible with the original game (in terms of protocol, assets, and scripts).
## Getting started ## Getting started
- [Downloading and installing OpenMoHAA](docs/getting_started_installation.md) - [Downloading and installing OpenMoHAA](docs/getting_started_installation.md)
- [Running OpenMoHAA and using expansion assets](docs/getting_started_running.md) - [Running OpenMoHAA and using expansion assets](docs/getting_started_running.md)
- [Game configuration](docs/configuration.md) - [Dedicated server configuration](docs/configuration/server.md)
If you encounter any issues, please refer to the [FAQ](docs/faq.md) for possible solutions.
## Current state ## Current state
@ -28,22 +26,16 @@ The entire single-player campaign should work (Allied Assault, Spearhead and Bre
### Multiplayer ### Multiplayer
The Multiplayer part is almost fully stable, all game modes including `Tug-of-War` from Medal of Honor: Spearhead, and `Liberation` from Medal of Honor: Breakthrough are implemented and are working as intended. Mods like `Freeze-Tag` are working as well. The Multiplayer part is almost fully stable.
OpenMoHAA can be used to [host](docs/getting_started_installation.md#server) a mohaa/mohaas/mohaab server and players can use OpenMoHAA to [play](docs/getting_started_installation.md#client) on any server. If some bugs/strange behavior occurs, the best way to report them is by [creating a new issue](https://github.com/openmoh/openmohaa/issues) on the [OpenMoHAA GitHub](https://github.com/openmoh/openmohaa) project with the steps to reproduce (with eventually the problematic mods). Server admins can use OpenMoHAA to [host](docs/getting_started_installation.md#server) a mohaa/mohaas/mohaab server. Bugs must be reported by creating a new [issue](https://github.com/openmoh/openmohaa/issues) on the OpenMoHAA GitHub project. Players can use OpenMoHAA to [play](docs/getting_started_installation.md#client) on a mohaa/mohaas/mohaab server.
One of the big multiplayer features are bots. They were introduced for testing and for entertainment purposes so players can have fun alone. See [Configuring bots](docs/configuration/server.md#bots) in the dedicated server configuration documentation to set them up. All game modes including `Tug-of-War` from Medal of Honor: Spearhead, and `Liberation` from Medal of Honor: Breakthrough are implemented and are working as intended. Mods like `Freeze-Tag` are working as well.
## Features ## Features
- [List of new features](docs/features.md) - [List of new features](docs/features.md)
- [Scripting](docs/scripting.md) - [Scripting commands](https://htmlpreview.github.io/?https://github.com/openmoh/openmohaa/blob/main/docs/features_g_allclasses.html)
## Reporting issues
If you encounter a bug, report it by creating a new [issue](https://github.com/openmoh/openmohaa/issues). Make sure to select the `Bug report` template and fill in the appropriate fields.
If you need help or have a problem, you can head over to the [discussions](https://github.com/openmoh/openmohaa/discussions) or join the OpenMoHAA Discord server (the link is at the bottom of this README).
## Compiling ## Compiling

View file

@ -1,40 +1,8 @@
#ifndef AL_AL_H #ifndef AL_AL_H
#define AL_AL_H #define AL_AL_H
/* NOLINTBEGIN */ #if defined(__cplusplus)
#ifdef __cplusplus
extern "C" { extern "C" {
#ifdef _MSVC_LANG
#define AL_CPLUSPLUS _MSVC_LANG
#else
#define AL_CPLUSPLUS __cplusplus
#endif
#ifndef AL_DISABLE_NOEXCEPT
#if AL_CPLUSPLUS >= 201103L
#define AL_API_NOEXCEPT noexcept
#else
#define AL_API_NOEXCEPT
#endif
#if AL_CPLUSPLUS >= 201703L
#define AL_API_NOEXCEPT17 noexcept
#else
#define AL_API_NOEXCEPT17
#endif
#else /* AL_DISABLE_NOEXCEPT */
#define AL_API_NOEXCEPT
#define AL_API_NOEXCEPT17
#endif
#undef AL_CPLUSPLUS
#else /* __cplusplus */
#define AL_API_NOEXCEPT
#define AL_API_NOEXCEPT17
#endif #endif
#ifndef AL_API #ifndef AL_API
@ -47,14 +15,14 @@ extern "C" {
#endif #endif
#endif #endif
#ifdef _WIN32 #if defined(_WIN32)
#define AL_APIENTRY __cdecl #define AL_APIENTRY __cdecl
#else #else
#define AL_APIENTRY #define AL_APIENTRY
#endif #endif
/* Deprecated macros. */ /** Deprecated macro. */
#define OPENAL #define OPENAL
#define ALAPI AL_API #define ALAPI AL_API
#define ALAPIENTRY AL_APIENTRY #define ALAPIENTRY AL_APIENTRY
@ -62,7 +30,7 @@ extern "C" {
#define AL_ILLEGAL_ENUM AL_INVALID_ENUM #define AL_ILLEGAL_ENUM AL_INVALID_ENUM
#define AL_ILLEGAL_COMMAND AL_INVALID_OPERATION #define AL_ILLEGAL_COMMAND AL_INVALID_OPERATION
/* Supported AL versions. */ /** Supported AL version. */
#define AL_VERSION_1_0 #define AL_VERSION_1_0
#define AL_VERSION_1_1 #define AL_VERSION_1_1
@ -72,43 +40,43 @@ typedef char ALboolean;
/** character */ /** character */
typedef char ALchar; typedef char ALchar;
/** signed 8-bit integer */ /** signed 8-bit 2's complement integer */
typedef signed char ALbyte; typedef signed char ALbyte;
/** unsigned 8-bit integer */ /** unsigned 8-bit integer */
typedef unsigned char ALubyte; typedef unsigned char ALubyte;
/** signed 16-bit integer */ /** signed 16-bit 2's complement integer */
typedef short ALshort; typedef short ALshort;
/** unsigned 16-bit integer */ /** unsigned 16-bit integer */
typedef unsigned short ALushort; typedef unsigned short ALushort;
/** signed 32-bit integer */ /** signed 32-bit 2's complement integer */
typedef int ALint; typedef int ALint;
/** unsigned 32-bit integer */ /** unsigned 32-bit integer */
typedef unsigned int ALuint; typedef unsigned int ALuint;
/** non-negative 32-bit integer size */ /** non-negative 32-bit binary integer size */
typedef int ALsizei; typedef int ALsizei;
/** 32-bit enumeration value */ /** enumerated 32-bit value */
typedef int ALenum; typedef int ALenum;
/** 32-bit IEEE-754 floating-point */ /** 32-bit IEEE754 floating-point */
typedef float ALfloat; typedef float ALfloat;
/** 64-bit IEEE-754 floating-point */ /** 64-bit IEEE754 floating-point */
typedef double ALdouble; typedef double ALdouble;
/** void type (opaque pointers only) */ /** void type (for opaque pointers only) */
typedef void ALvoid; typedef void ALvoid;
/* Enumeration values begin at column 50. Do not use tabs. */ /* Enumerant values begin at column 50. No tabs. */
/** No distance model or no buffer */ /** "no distance model" or "no buffer" */
#define AL_NONE 0 #define AL_NONE 0
/** Boolean False. */ /** Boolean False. */
@ -121,10 +89,10 @@ typedef void ALvoid;
/** /**
* Relative source. * Relative source.
* Type: ALboolean * Type: ALboolean
* Range: [AL_FALSE, AL_TRUE] * Range: [AL_TRUE, AL_FALSE]
* Default: AL_FALSE * Default: AL_FALSE
* *
* Specifies if the source uses relative coordinates. * Specifies if the Source has relative coordinates.
*/ */
#define AL_SOURCE_RELATIVE 0x202 #define AL_SOURCE_RELATIVE 0x202
@ -135,8 +103,7 @@ typedef void ALvoid;
* Range: [0 - 360] * Range: [0 - 360]
* Default: 360 * Default: 360
* *
* The angle covered by the inner cone, the area within which the source will * The angle covered by the inner cone, where the source will not attenuate.
* not be attenuated by direction.
*/ */
#define AL_CONE_INNER_ANGLE 0x1001 #define AL_CONE_INNER_ANGLE 0x1001
@ -145,8 +112,8 @@ typedef void ALvoid;
* Range: [0 - 360] * Range: [0 - 360]
* Default: 360 * Default: 360
* *
* The angle covered by the outer cone, the area outside of which the source * The angle covered by the outer cone, where the source will be fully
* will be fully attenuated by direction. * attenuated.
*/ */
#define AL_CONE_OUTER_ANGLE 0x1002 #define AL_CONE_OUTER_ANGLE 0x1002
@ -156,7 +123,7 @@ typedef void ALvoid;
* Range: [0.5 - 2.0] * Range: [0.5 - 2.0]
* Default: 1.0 * Default: 1.0
* *
* A multiplier for the sample rate of the source's buffer. * A multiplier for the frequency (sample rate) of the source's buffer.
*/ */
#define AL_PITCH 0x1003 #define AL_PITCH 0x1003
@ -167,12 +134,12 @@ typedef void ALvoid;
* *
* The source or listener location in three dimensional space. * The source or listener location in three dimensional space.
* *
* OpenAL uses a right handed coordinate system, like OpenGL, where with a * OpenAL, like OpenGL, uses a right handed coordinate system, where in a
* default view, X points right (thumb), Y points up (index finger), and Z * frontal default view X (thumb) points right, Y points up (index finger), and
* points towards the viewer/camera (middle finger). * Z points towards the viewer/camera (middle finger).
* *
* To change from or to a left handed coordinate system, negate the Z * To switch from a left handed coordinate system, flip the sign on the Z
* component. * coordinate.
*/ */
#define AL_POSITION 0x1004 #define AL_POSITION 0x1004
@ -181,11 +148,8 @@ typedef void ALvoid;
* Type: ALfloat[3], ALint[3] * Type: ALfloat[3], ALint[3]
* Default: {0, 0, 0} * Default: {0, 0, 0}
* *
* Specifies the current direction in local space. A zero-length vector * Specifies the current direction in local space.
* specifies an omni-directional source (cone is ignored). * A zero-length vector specifies an omni-directional source (cone is ignored).
*
* To change from or to a left handed coordinate system, negate the Z
* component.
*/ */
#define AL_DIRECTION 0x1005 #define AL_DIRECTION 0x1005
@ -194,30 +158,26 @@ typedef void ALvoid;
* Type: ALfloat[3], ALint[3] * Type: ALfloat[3], ALint[3]
* Default: {0, 0, 0} * Default: {0, 0, 0}
* *
* Specifies the current velocity, relative to the position. * Specifies the current velocity in local space.
*
* To change from or to a left handed coordinate system, negate the Z
* component.
*/ */
#define AL_VELOCITY 0x1006 #define AL_VELOCITY 0x1006
/** /**
* Source looping. * Source looping.
* Type: ALboolean * Type: ALboolean
* Range: [AL_FALSE, AL_TRUE] * Range: [AL_TRUE, AL_FALSE]
* Default: AL_FALSE * Default: AL_FALSE
* *
* Specifies whether source playback loops. * Specifies whether source is looping.
*/ */
#define AL_LOOPING 0x1007 #define AL_LOOPING 0x1007
/** /**
* Source buffer. * Source buffer.
* Type: ALuint * Type: ALuint
* Range: any valid Buffer ID * Range: any valid Buffer.
* Default: AL_NONE
* *
* Specifies the buffer to provide sound samples for a source. * Specifies the buffer to provide sound samples.
*/ */
#define AL_BUFFER 0x1009 #define AL_BUFFER 0x1009
@ -226,12 +186,12 @@ typedef void ALvoid;
* Type: ALfloat * Type: ALfloat
* Range: [0.0 - ] * Range: [0.0 - ]
* *
* For sources, an initial linear gain value (before attenuation is applied).
* For the listener, an output linear gain adjustment.
*
* A value of 1.0 means unattenuated. Each division by 2 equals an attenuation * A value of 1.0 means unattenuated. Each division by 2 equals an attenuation
* of about -6dB. Each multiplication by 2 equals an amplification of about * of about -6dB. Each multiplicaton by 2 equals an amplification of about
* +6dB. * +6dB.
*
* A value of 0.0 is meaningless with respect to a logarithmic scale; it is
* silent.
*/ */
#define AL_GAIN 0x100A #define AL_GAIN 0x100A
@ -240,8 +200,8 @@ typedef void ALvoid;
* Type: ALfloat * Type: ALfloat
* Range: [0.0 - 1.0] * Range: [0.0 - 1.0]
* *
* The minimum gain allowed for a source, after distance and cone attenuation * The minimum gain allowed for a source, after distance and cone attenation is
* are applied (if applicable). * applied (if applicable).
*/ */
#define AL_MIN_GAIN 0x100D #define AL_MIN_GAIN 0x100D
@ -250,8 +210,8 @@ typedef void ALvoid;
* Type: ALfloat * Type: ALfloat
* Range: [0.0 - 1.0] * Range: [0.0 - 1.0]
* *
* The maximum gain allowed for a source, after distance and cone attenuation * The maximum gain allowed for a source, after distance and cone attenation is
* are applied (if applicable). * applied (if applicable).
*/ */
#define AL_MAX_GAIN 0x100E #define AL_MAX_GAIN 0x100E
@ -261,22 +221,20 @@ typedef void ALvoid;
* Default: {0.0, 0.0, -1.0, 0.0, 1.0, 0.0} * Default: {0.0, 0.0, -1.0, 0.0, 1.0, 0.0}
* *
* Effectively two three dimensional vectors. The first vector is the front (or * Effectively two three dimensional vectors. The first vector is the front (or
* "at") and the second is the top (or "up"). Both vectors are relative to the * "at") and the second is the top (or "up").
* listener position.
* *
* To change from or to a left handed coordinate system, negate the Z * Both vectors are in local space.
* component of both vectors.
*/ */
#define AL_ORIENTATION 0x100F #define AL_ORIENTATION 0x100F
/** /**
* Source state (query only). * Source state (query only).
* Type: ALenum * Type: ALint
* Range: [AL_INITIAL, AL_PLAYING, AL_PAUSED, AL_STOPPED] * Range: [AL_INITIAL, AL_PLAYING, AL_PAUSED, AL_STOPPED]
*/ */
#define AL_SOURCE_STATE 0x1010 #define AL_SOURCE_STATE 0x1010
/* Source state values. */ /** Source state value. */
#define AL_INITIAL 0x1011 #define AL_INITIAL 0x1011
#define AL_PLAYING 0x1012 #define AL_PLAYING 0x1012
#define AL_PAUSED 0x1013 #define AL_PAUSED 0x1013
@ -309,9 +267,9 @@ typedef void ALvoid;
* Range: [0.0 - ] * Range: [0.0 - ]
* Default: 1.0 * Default: 1.0
* *
* The distance in units that no distance attenuation occurs. * The distance in units that no attenuation occurs.
* *
* At 0.0, no distance attenuation occurs with non-linear attenuation models. * At 0.0, no distance attenuation ever occurs on non-linear attenuation models.
*/ */
#define AL_REFERENCE_DISTANCE 0x1020 #define AL_REFERENCE_DISTANCE 0x1020
@ -334,7 +292,7 @@ typedef void ALvoid;
* Default: 0.0 * Default: 0.0
* *
* The gain attenuation applied when the listener is outside of the source's * The gain attenuation applied when the listener is outside of the source's
* outer cone angle. * outer cone.
*/ */
#define AL_CONE_OUTER_GAIN 0x1022 #define AL_CONE_OUTER_GAIN 0x1022
@ -342,7 +300,7 @@ typedef void ALvoid;
* Source maximum distance. * Source maximum distance.
* Type: ALfloat * Type: ALfloat
* Range: [0.0 - ] * Range: [0.0 - ]
* Default: FLT_MAX * Default: +inf
* *
* The distance above which the source is not attenuated any further with a * The distance above which the source is not attenuated any further with a
* clamped distance model, or where attenuation reaches 0.0 gain for linear * clamped distance model, or where attenuation reaches 0.0 gain for linear
@ -350,16 +308,16 @@ typedef void ALvoid;
*/ */
#define AL_MAX_DISTANCE 0x1023 #define AL_MAX_DISTANCE 0x1023
/** Source buffer offset, in seconds */ /** Source buffer position, in seconds */
#define AL_SEC_OFFSET 0x1024 #define AL_SEC_OFFSET 0x1024
/** Source buffer offset, in sample frames */ /** Source buffer position, in sample frames */
#define AL_SAMPLE_OFFSET 0x1025 #define AL_SAMPLE_OFFSET 0x1025
/** Source buffer offset, in bytes */ /** Source buffer position, in bytes */
#define AL_BYTE_OFFSET 0x1026 #define AL_BYTE_OFFSET 0x1026
/** /**
* Source type (query only). * Source type (query only).
* Type: ALenum * Type: ALint
* Range: [AL_STATIC, AL_STREAMING, AL_UNDETERMINED] * Range: [AL_STATIC, AL_STREAMING, AL_UNDETERMINED]
* *
* A Source is Static if a Buffer has been attached using AL_BUFFER. * A Source is Static if a Buffer has been attached using AL_BUFFER.
@ -372,30 +330,31 @@ typedef void ALvoid;
*/ */
#define AL_SOURCE_TYPE 0x1027 #define AL_SOURCE_TYPE 0x1027
/* Source type values. */ /** Source type value. */
#define AL_STATIC 0x1028 #define AL_STATIC 0x1028
#define AL_STREAMING 0x1029 #define AL_STREAMING 0x1029
#define AL_UNDETERMINED 0x1030 #define AL_UNDETERMINED 0x1030
/** Unsigned 8-bit mono buffer format. */ /** Buffer format specifier. */
#define AL_FORMAT_MONO8 0x1100 #define AL_FORMAT_MONO8 0x1100
/** Signed 16-bit mono buffer format. */
#define AL_FORMAT_MONO16 0x1101 #define AL_FORMAT_MONO16 0x1101
/** Unsigned 8-bit stereo buffer format. */
#define AL_FORMAT_STEREO8 0x1102 #define AL_FORMAT_STEREO8 0x1102
/** Signed 16-bit stereo buffer format. */
#define AL_FORMAT_STEREO16 0x1103 #define AL_FORMAT_STEREO16 0x1103
/** Buffer frequency/sample rate (query only). */ /** Buffer frequency (query only). */
#define AL_FREQUENCY 0x2001 #define AL_FREQUENCY 0x2001
/** Buffer bits per sample (query only). */ /** Buffer bits per sample (query only). */
#define AL_BITS 0x2002 #define AL_BITS 0x2002
/** Buffer channel count (query only). */ /** Buffer channel count (query only). */
#define AL_CHANNELS 0x2003 #define AL_CHANNELS 0x2003
/** Buffer data size in bytes (query only). */ /** Buffer data size (query only). */
#define AL_SIZE 0x2004 #define AL_SIZE 0x2004
/* Buffer state. Not for public use. */ /**
* Buffer state.
*
* Not for public use.
*/
#define AL_UNUSED 0x2010 #define AL_UNUSED 0x2010
#define AL_PENDING 0x2011 #define AL_PENDING 0x2011
#define AL_PROCESSED 0x2012 #define AL_PROCESSED 0x2012
@ -404,31 +363,32 @@ typedef void ALvoid;
/** No error. */ /** No error. */
#define AL_NO_ERROR 0 #define AL_NO_ERROR 0
/** Invalid name (ID) passed to an AL call. */ /** Invalid name paramater passed to AL call. */
#define AL_INVALID_NAME 0xA001 #define AL_INVALID_NAME 0xA001
/** Invalid enumeration passed to AL call. */ /** Invalid enum parameter passed to AL call. */
#define AL_INVALID_ENUM 0xA002 #define AL_INVALID_ENUM 0xA002
/** Invalid value passed to AL call. */ /** Invalid value parameter passed to AL call. */
#define AL_INVALID_VALUE 0xA003 #define AL_INVALID_VALUE 0xA003
/** Illegal AL call. */ /** Illegal AL call. */
#define AL_INVALID_OPERATION 0xA004 #define AL_INVALID_OPERATION 0xA004
/** Not enough memory to execute the AL call. */ /** Not enough memory. */
#define AL_OUT_OF_MEMORY 0xA005 #define AL_OUT_OF_MEMORY 0xA005
/** Context string: Vendor name. */ /** Context string: Vendor ID. */
#define AL_VENDOR 0xB001 #define AL_VENDOR 0xB001
/** Context string: Version. */ /** Context string: Version. */
#define AL_VERSION 0xB002 #define AL_VERSION 0xB002
/** Context string: Renderer name. */ /** Context string: Renderer ID. */
#define AL_RENDERER 0xB003 #define AL_RENDERER 0xB003
/** Context string: Space-separated extension list. */ /** Context string: Space-separated extension list. */
#define AL_EXTENSIONS 0xB004 #define AL_EXTENSIONS 0xB004
/** /**
* Doppler scale. * Doppler scale.
* Type: ALfloat * Type: ALfloat
@ -438,6 +398,7 @@ typedef void ALvoid;
* Scale for source and listener velocities. * Scale for source and listener velocities.
*/ */
#define AL_DOPPLER_FACTOR 0xC000 #define AL_DOPPLER_FACTOR 0xC000
AL_API void AL_APIENTRY alDopplerFactor(ALfloat value);
/** /**
* Doppler velocity (deprecated). * Doppler velocity (deprecated).
@ -445,6 +406,7 @@ typedef void ALvoid;
* A multiplier applied to the Speed of Sound. * A multiplier applied to the Speed of Sound.
*/ */
#define AL_DOPPLER_VELOCITY 0xC001 #define AL_DOPPLER_VELOCITY 0xC001
AL_API void AL_APIENTRY alDopplerVelocity(ALfloat value);
/** /**
* Speed of Sound, in units per second. * Speed of Sound, in units per second.
@ -453,13 +415,14 @@ typedef void ALvoid;
* Default: 343.3 * Default: 343.3
* *
* The speed at which sound waves are assumed to travel, when calculating the * The speed at which sound waves are assumed to travel, when calculating the
* doppler effect from source and listener velocities. * doppler effect.
*/ */
#define AL_SPEED_OF_SOUND 0xC003 #define AL_SPEED_OF_SOUND 0xC003
AL_API void AL_APIENTRY alSpeedOfSound(ALfloat value);
/** /**
* Distance attenuation model. * Distance attenuation model.
* Type: ALenum * Type: ALint
* Range: [AL_NONE, AL_INVERSE_DISTANCE, AL_INVERSE_DISTANCE_CLAMPED, * Range: [AL_NONE, AL_INVERSE_DISTANCE, AL_INVERSE_DISTANCE_CLAMPED,
* AL_LINEAR_DISTANCE, AL_LINEAR_DISTANCE_CLAMPED, * AL_LINEAR_DISTANCE, AL_LINEAR_DISTANCE_CLAMPED,
* AL_EXPONENT_DISTANCE, AL_EXPONENT_DISTANCE_CLAMPED] * AL_EXPONENT_DISTANCE, AL_EXPONENT_DISTANCE_CLAMPED]
@ -476,8 +439,9 @@ typedef void ALvoid;
* distance calculated is clamped between the reference and max distances. * distance calculated is clamped between the reference and max distances.
*/ */
#define AL_DISTANCE_MODEL 0xD000 #define AL_DISTANCE_MODEL 0xD000
AL_API void AL_APIENTRY alDistanceModel(ALenum distanceModel);
/* Distance model values. */ /** Distance model value. */
#define AL_INVERSE_DISTANCE 0xD001 #define AL_INVERSE_DISTANCE 0xD001
#define AL_INVERSE_DISTANCE_CLAMPED 0xD002 #define AL_INVERSE_DISTANCE_CLAMPED 0xD002
#define AL_LINEAR_DISTANCE 0xD003 #define AL_LINEAR_DISTANCE 0xD003
@ -485,223 +449,208 @@ typedef void ALvoid;
#define AL_EXPONENT_DISTANCE 0xD005 #define AL_EXPONENT_DISTANCE 0xD005
#define AL_EXPONENT_DISTANCE_CLAMPED 0xD006 #define AL_EXPONENT_DISTANCE_CLAMPED 0xD006
#ifndef AL_NO_PROTOTYPES /** Renderer State management. */
/* Renderer State management. */ AL_API void AL_APIENTRY alEnable(ALenum capability);
AL_API void AL_APIENTRY alEnable(ALenum capability) AL_API_NOEXCEPT; AL_API void AL_APIENTRY alDisable(ALenum capability);
AL_API void AL_APIENTRY alDisable(ALenum capability) AL_API_NOEXCEPT; AL_API ALboolean AL_APIENTRY alIsEnabled(ALenum capability);
AL_API ALboolean AL_APIENTRY alIsEnabled(ALenum capability) AL_API_NOEXCEPT;
/* Context state setting. */ /** State retrieval. */
AL_API void AL_APIENTRY alDopplerFactor(ALfloat value) AL_API_NOEXCEPT; AL_API const ALchar* AL_APIENTRY alGetString(ALenum param);
AL_API void AL_APIENTRY alDopplerVelocity(ALfloat value) AL_API_NOEXCEPT; AL_API void AL_APIENTRY alGetBooleanv(ALenum param, ALboolean *values);
AL_API void AL_APIENTRY alSpeedOfSound(ALfloat value) AL_API_NOEXCEPT; AL_API void AL_APIENTRY alGetIntegerv(ALenum param, ALint *values);
AL_API void AL_APIENTRY alDistanceModel(ALenum distanceModel) AL_API_NOEXCEPT; AL_API void AL_APIENTRY alGetFloatv(ALenum param, ALfloat *values);
AL_API void AL_APIENTRY alGetDoublev(ALenum param, ALdouble *values);
/* Context state retrieval. */ AL_API ALboolean AL_APIENTRY alGetBoolean(ALenum param);
AL_API const ALchar* AL_APIENTRY alGetString(ALenum param) AL_API_NOEXCEPT; AL_API ALint AL_APIENTRY alGetInteger(ALenum param);
AL_API void AL_APIENTRY alGetBooleanv(ALenum param, ALboolean *values) AL_API_NOEXCEPT; AL_API ALfloat AL_APIENTRY alGetFloat(ALenum param);
AL_API void AL_APIENTRY alGetIntegerv(ALenum param, ALint *values) AL_API_NOEXCEPT; AL_API ALdouble AL_APIENTRY alGetDouble(ALenum param);
AL_API void AL_APIENTRY alGetFloatv(ALenum param, ALfloat *values) AL_API_NOEXCEPT;
AL_API void AL_APIENTRY alGetDoublev(ALenum param, ALdouble *values) AL_API_NOEXCEPT;
AL_API ALboolean AL_APIENTRY alGetBoolean(ALenum param) AL_API_NOEXCEPT;
AL_API ALint AL_APIENTRY alGetInteger(ALenum param) AL_API_NOEXCEPT;
AL_API ALfloat AL_APIENTRY alGetFloat(ALenum param) AL_API_NOEXCEPT;
AL_API ALdouble AL_APIENTRY alGetDouble(ALenum param) AL_API_NOEXCEPT;
/** /**
* Obtain the first error generated in the AL context since the last call to * Error retrieval.
* this function. *
* Obtain the first error generated in the AL context since the last check.
*/ */
AL_API ALenum AL_APIENTRY alGetError(void) AL_API_NOEXCEPT; AL_API ALenum AL_APIENTRY alGetError(void);
/** Query for the presence of an extension on the AL context. */
AL_API ALboolean AL_APIENTRY alIsExtensionPresent(const ALchar *extname) AL_API_NOEXCEPT;
/** /**
* Retrieve the address of a function. The returned function may be context- * Extension support.
* specific. *
* Query for the presence of an extension, and obtain any appropriate function
* pointers and enum values.
*/ */
AL_API void* AL_APIENTRY alGetProcAddress(const ALchar *fname) AL_API_NOEXCEPT; AL_API ALboolean AL_APIENTRY alIsExtensionPresent(const ALchar *extname);
/** AL_API void* AL_APIENTRY alGetProcAddress(const ALchar *fname);
* Retrieve the value of an enum. The returned value may be context-specific. AL_API ALenum AL_APIENTRY alGetEnumValue(const ALchar *ename);
*/
AL_API ALenum AL_APIENTRY alGetEnumValue(const ALchar *ename) AL_API_NOEXCEPT;
/* Set listener parameters. */ /** Set Listener parameters */
AL_API void AL_APIENTRY alListenerf(ALenum param, ALfloat value) AL_API_NOEXCEPT; AL_API void AL_APIENTRY alListenerf(ALenum param, ALfloat value);
AL_API void AL_APIENTRY alListener3f(ALenum param, ALfloat value1, ALfloat value2, ALfloat value3) AL_API_NOEXCEPT; AL_API void AL_APIENTRY alListener3f(ALenum param, ALfloat value1, ALfloat value2, ALfloat value3);
AL_API void AL_APIENTRY alListenerfv(ALenum param, const ALfloat *values) AL_API_NOEXCEPT; AL_API void AL_APIENTRY alListenerfv(ALenum param, const ALfloat *values);
AL_API void AL_APIENTRY alListeneri(ALenum param, ALint value) AL_API_NOEXCEPT; AL_API void AL_APIENTRY alListeneri(ALenum param, ALint value);
AL_API void AL_APIENTRY alListener3i(ALenum param, ALint value1, ALint value2, ALint value3) AL_API_NOEXCEPT; AL_API void AL_APIENTRY alListener3i(ALenum param, ALint value1, ALint value2, ALint value3);
AL_API void AL_APIENTRY alListeneriv(ALenum param, const ALint *values) AL_API_NOEXCEPT; AL_API void AL_APIENTRY alListeneriv(ALenum param, const ALint *values);
/* Get listener parameters. */ /** Get Listener parameters */
AL_API void AL_APIENTRY alGetListenerf(ALenum param, ALfloat *value) AL_API_NOEXCEPT; AL_API void AL_APIENTRY alGetListenerf(ALenum param, ALfloat *value);
AL_API void AL_APIENTRY alGetListener3f(ALenum param, ALfloat *value1, ALfloat *value2, ALfloat *value3) AL_API_NOEXCEPT; AL_API void AL_APIENTRY alGetListener3f(ALenum param, ALfloat *value1, ALfloat *value2, ALfloat *value3);
AL_API void AL_APIENTRY alGetListenerfv(ALenum param, ALfloat *values) AL_API_NOEXCEPT; AL_API void AL_APIENTRY alGetListenerfv(ALenum param, ALfloat *values);
AL_API void AL_APIENTRY alGetListeneri(ALenum param, ALint *value) AL_API_NOEXCEPT; AL_API void AL_APIENTRY alGetListeneri(ALenum param, ALint *value);
AL_API void AL_APIENTRY alGetListener3i(ALenum param, ALint *value1, ALint *value2, ALint *value3) AL_API_NOEXCEPT; AL_API void AL_APIENTRY alGetListener3i(ALenum param, ALint *value1, ALint *value2, ALint *value3);
AL_API void AL_APIENTRY alGetListeneriv(ALenum param, ALint *values) AL_API_NOEXCEPT; AL_API void AL_APIENTRY alGetListeneriv(ALenum param, ALint *values);
/** Create source objects. */ /** Create Source objects. */
AL_API void AL_APIENTRY alGenSources(ALsizei n, ALuint *sources) AL_API_NOEXCEPT; AL_API void AL_APIENTRY alGenSources(ALsizei n, ALuint *sources);
/** Delete source objects. */ /** Delete Source objects. */
AL_API void AL_APIENTRY alDeleteSources(ALsizei n, const ALuint *sources) AL_API_NOEXCEPT; AL_API void AL_APIENTRY alDeleteSources(ALsizei n, const ALuint *sources);
/** Verify an ID is for a valid source. */ /** Verify a handle is a valid Source. */
AL_API ALboolean AL_APIENTRY alIsSource(ALuint source) AL_API_NOEXCEPT; AL_API ALboolean AL_APIENTRY alIsSource(ALuint source);
/* Set source parameters. */ /** Set Source parameters. */
AL_API void AL_APIENTRY alSourcef(ALuint source, ALenum param, ALfloat value) AL_API_NOEXCEPT; AL_API void AL_APIENTRY alSourcef(ALuint source, ALenum param, ALfloat value);
AL_API void AL_APIENTRY alSource3f(ALuint source, ALenum param, ALfloat value1, ALfloat value2, ALfloat value3) AL_API_NOEXCEPT; AL_API void AL_APIENTRY alSource3f(ALuint source, ALenum param, ALfloat value1, ALfloat value2, ALfloat value3);
AL_API void AL_APIENTRY alSourcefv(ALuint source, ALenum param, const ALfloat *values) AL_API_NOEXCEPT; AL_API void AL_APIENTRY alSourcefv(ALuint source, ALenum param, const ALfloat *values);
AL_API void AL_APIENTRY alSourcei(ALuint source, ALenum param, ALint value) AL_API_NOEXCEPT; AL_API void AL_APIENTRY alSourcei(ALuint source, ALenum param, ALint value);
AL_API void AL_APIENTRY alSource3i(ALuint source, ALenum param, ALint value1, ALint value2, ALint value3) AL_API_NOEXCEPT; AL_API void AL_APIENTRY alSource3i(ALuint source, ALenum param, ALint value1, ALint value2, ALint value3);
AL_API void AL_APIENTRY alSourceiv(ALuint source, ALenum param, const ALint *values) AL_API_NOEXCEPT; AL_API void AL_APIENTRY alSourceiv(ALuint source, ALenum param, const ALint *values);
/* Get source parameters. */ /** Get Source parameters. */
AL_API void AL_APIENTRY alGetSourcef(ALuint source, ALenum param, ALfloat *value) AL_API_NOEXCEPT; AL_API void AL_APIENTRY alGetSourcef(ALuint source, ALenum param, ALfloat *value);
AL_API void AL_APIENTRY alGetSource3f(ALuint source, ALenum param, ALfloat *value1, ALfloat *value2, ALfloat *value3) AL_API_NOEXCEPT; AL_API void AL_APIENTRY alGetSource3f(ALuint source, ALenum param, ALfloat *value1, ALfloat *value2, ALfloat *value3);
AL_API void AL_APIENTRY alGetSourcefv(ALuint source, ALenum param, ALfloat *values) AL_API_NOEXCEPT; AL_API void AL_APIENTRY alGetSourcefv(ALuint source, ALenum param, ALfloat *values);
AL_API void AL_APIENTRY alGetSourcei(ALuint source, ALenum param, ALint *value) AL_API_NOEXCEPT; AL_API void AL_APIENTRY alGetSourcei(ALuint source, ALenum param, ALint *value);
AL_API void AL_APIENTRY alGetSource3i(ALuint source, ALenum param, ALint *value1, ALint *value2, ALint *value3) AL_API_NOEXCEPT; AL_API void AL_APIENTRY alGetSource3i(ALuint source, ALenum param, ALint *value1, ALint *value2, ALint *value3);
AL_API void AL_APIENTRY alGetSourceiv(ALuint source, ALenum param, ALint *values) AL_API_NOEXCEPT; AL_API void AL_APIENTRY alGetSourceiv(ALuint source, ALenum param, ALint *values);
/** Play, restart, or resume a source, setting its state to AL_PLAYING. */ /** Play, replay, or resume (if paused) a list of Sources */
AL_API void AL_APIENTRY alSourcePlay(ALuint source) AL_API_NOEXCEPT; AL_API void AL_APIENTRY alSourcePlayv(ALsizei n, const ALuint *sources);
/** Stop a source, setting its state to AL_STOPPED if playing or paused. */ /** Stop a list of Sources */
AL_API void AL_APIENTRY alSourceStop(ALuint source) AL_API_NOEXCEPT; AL_API void AL_APIENTRY alSourceStopv(ALsizei n, const ALuint *sources);
/** Rewind a source, setting its state to AL_INITIAL. */ /** Rewind a list of Sources */
AL_API void AL_APIENTRY alSourceRewind(ALuint source) AL_API_NOEXCEPT; AL_API void AL_APIENTRY alSourceRewindv(ALsizei n, const ALuint *sources);
/** Pause a source, setting its state to AL_PAUSED if playing. */ /** Pause a list of Sources */
AL_API void AL_APIENTRY alSourcePause(ALuint source) AL_API_NOEXCEPT; AL_API void AL_APIENTRY alSourcePausev(ALsizei n, const ALuint *sources);
/** Play, restart, or resume a list of sources atomically. */ /** Play, replay, or resume a Source */
AL_API void AL_APIENTRY alSourcePlayv(ALsizei n, const ALuint *sources) AL_API_NOEXCEPT; AL_API void AL_APIENTRY alSourcePlay(ALuint source);
/** Stop a list of sources atomically. */ /** Stop a Source */
AL_API void AL_APIENTRY alSourceStopv(ALsizei n, const ALuint *sources) AL_API_NOEXCEPT; AL_API void AL_APIENTRY alSourceStop(ALuint source);
/** Rewind a list of sources atomically. */ /** Rewind a Source (set playback postiton to beginning) */
AL_API void AL_APIENTRY alSourceRewindv(ALsizei n, const ALuint *sources) AL_API_NOEXCEPT; AL_API void AL_APIENTRY alSourceRewind(ALuint source);
/** Pause a list of sources atomically. */ /** Pause a Source */
AL_API void AL_APIENTRY alSourcePausev(ALsizei n, const ALuint *sources) AL_API_NOEXCEPT; AL_API void AL_APIENTRY alSourcePause(ALuint source);
/** Queue buffers onto a source */ /** Queue buffers onto a source */
AL_API void AL_APIENTRY alSourceQueueBuffers(ALuint source, ALsizei nb, const ALuint *buffers) AL_API_NOEXCEPT; AL_API void AL_APIENTRY alSourceQueueBuffers(ALuint source, ALsizei nb, const ALuint *buffers);
/** Unqueue processed buffers from a source */ /** Unqueue processed buffers from a source */
AL_API void AL_APIENTRY alSourceUnqueueBuffers(ALuint source, ALsizei nb, ALuint *buffers) AL_API_NOEXCEPT; AL_API void AL_APIENTRY alSourceUnqueueBuffers(ALuint source, ALsizei nb, ALuint *buffers);
/** Create buffer objects */ /** Create Buffer objects */
AL_API void AL_APIENTRY alGenBuffers(ALsizei n, ALuint *buffers) AL_API_NOEXCEPT; AL_API void AL_APIENTRY alGenBuffers(ALsizei n, ALuint *buffers);
/** Delete buffer objects */ /** Delete Buffer objects */
AL_API void AL_APIENTRY alDeleteBuffers(ALsizei n, const ALuint *buffers) AL_API_NOEXCEPT; AL_API void AL_APIENTRY alDeleteBuffers(ALsizei n, const ALuint *buffers);
/** Verify an ID is a valid buffer (including the NULL buffer) */ /** Verify a handle is a valid Buffer */
AL_API ALboolean AL_APIENTRY alIsBuffer(ALuint buffer) AL_API_NOEXCEPT; AL_API ALboolean AL_APIENTRY alIsBuffer(ALuint buffer);
/** /** Specifies the data to be copied into a buffer */
* Copies data into the buffer, interpreting it using the specified format and AL_API void AL_APIENTRY alBufferData(ALuint buffer, ALenum format, const ALvoid *data, ALsizei size, ALsizei freq);
* samplerate.
*/
AL_API void AL_APIENTRY alBufferData(ALuint buffer, ALenum format, const ALvoid *data, ALsizei size, ALsizei samplerate) AL_API_NOEXCEPT;
/* Set buffer parameters. */ /** Set Buffer parameters, */
AL_API void AL_APIENTRY alBufferf(ALuint buffer, ALenum param, ALfloat value) AL_API_NOEXCEPT; AL_API void AL_APIENTRY alBufferf(ALuint buffer, ALenum param, ALfloat value);
AL_API void AL_APIENTRY alBuffer3f(ALuint buffer, ALenum param, ALfloat value1, ALfloat value2, ALfloat value3) AL_API_NOEXCEPT; AL_API void AL_APIENTRY alBuffer3f(ALuint buffer, ALenum param, ALfloat value1, ALfloat value2, ALfloat value3);
AL_API void AL_APIENTRY alBufferfv(ALuint buffer, ALenum param, const ALfloat *values) AL_API_NOEXCEPT; AL_API void AL_APIENTRY alBufferfv(ALuint buffer, ALenum param, const ALfloat *values);
AL_API void AL_APIENTRY alBufferi(ALuint buffer, ALenum param, ALint value) AL_API_NOEXCEPT; AL_API void AL_APIENTRY alBufferi(ALuint buffer, ALenum param, ALint value);
AL_API void AL_APIENTRY alBuffer3i(ALuint buffer, ALenum param, ALint value1, ALint value2, ALint value3) AL_API_NOEXCEPT; AL_API void AL_APIENTRY alBuffer3i(ALuint buffer, ALenum param, ALint value1, ALint value2, ALint value3);
AL_API void AL_APIENTRY alBufferiv(ALuint buffer, ALenum param, const ALint *values) AL_API_NOEXCEPT; AL_API void AL_APIENTRY alBufferiv(ALuint buffer, ALenum param, const ALint *values);
/* Get buffer parameters. */ /** Get Buffer parameters. */
AL_API void AL_APIENTRY alGetBufferf(ALuint buffer, ALenum param, ALfloat *value) AL_API_NOEXCEPT; AL_API void AL_APIENTRY alGetBufferf(ALuint buffer, ALenum param, ALfloat *value);
AL_API void AL_APIENTRY alGetBuffer3f(ALuint buffer, ALenum param, ALfloat *value1, ALfloat *value2, ALfloat *value3) AL_API_NOEXCEPT; AL_API void AL_APIENTRY alGetBuffer3f(ALuint buffer, ALenum param, ALfloat *value1, ALfloat *value2, ALfloat *value3);
AL_API void AL_APIENTRY alGetBufferfv(ALuint buffer, ALenum param, ALfloat *values) AL_API_NOEXCEPT; AL_API void AL_APIENTRY alGetBufferfv(ALuint buffer, ALenum param, ALfloat *values);
AL_API void AL_APIENTRY alGetBufferi(ALuint buffer, ALenum param, ALint *value) AL_API_NOEXCEPT; AL_API void AL_APIENTRY alGetBufferi(ALuint buffer, ALenum param, ALint *value);
AL_API void AL_APIENTRY alGetBuffer3i(ALuint buffer, ALenum param, ALint *value1, ALint *value2, ALint *value3) AL_API_NOEXCEPT; AL_API void AL_APIENTRY alGetBuffer3i(ALuint buffer, ALenum param, ALint *value1, ALint *value2, ALint *value3);
AL_API void AL_APIENTRY alGetBufferiv(ALuint buffer, ALenum param, ALint *values) AL_API_NOEXCEPT; AL_API void AL_APIENTRY alGetBufferiv(ALuint buffer, ALenum param, ALint *values);
#endif /* AL_NO_PROTOTYPES */
/* Pointer-to-function types, useful for storing dynamically loaded AL entry /** Pointer-to-function type, useful for dynamically getting AL entry points. */
* points. typedef void (AL_APIENTRY *LPALENABLE)(ALenum capability);
*/ typedef void (AL_APIENTRY *LPALDISABLE)(ALenum capability);
typedef void (AL_APIENTRY *LPALENABLE)(ALenum capability) AL_API_NOEXCEPT17; typedef ALboolean (AL_APIENTRY *LPALISENABLED)(ALenum capability);
typedef void (AL_APIENTRY *LPALDISABLE)(ALenum capability) AL_API_NOEXCEPT17; typedef const ALchar* (AL_APIENTRY *LPALGETSTRING)(ALenum param);
typedef ALboolean (AL_APIENTRY *LPALISENABLED)(ALenum capability) AL_API_NOEXCEPT17; typedef void (AL_APIENTRY *LPALGETBOOLEANV)(ALenum param, ALboolean *values);
typedef const ALchar* (AL_APIENTRY *LPALGETSTRING)(ALenum param) AL_API_NOEXCEPT17; typedef void (AL_APIENTRY *LPALGETINTEGERV)(ALenum param, ALint *values);
typedef void (AL_APIENTRY *LPALGETBOOLEANV)(ALenum param, ALboolean *values) AL_API_NOEXCEPT17; typedef void (AL_APIENTRY *LPALGETFLOATV)(ALenum param, ALfloat *values);
typedef void (AL_APIENTRY *LPALGETINTEGERV)(ALenum param, ALint *values) AL_API_NOEXCEPT17; typedef void (AL_APIENTRY *LPALGETDOUBLEV)(ALenum param, ALdouble *values);
typedef void (AL_APIENTRY *LPALGETFLOATV)(ALenum param, ALfloat *values) AL_API_NOEXCEPT17; typedef ALboolean (AL_APIENTRY *LPALGETBOOLEAN)(ALenum param);
typedef void (AL_APIENTRY *LPALGETDOUBLEV)(ALenum param, ALdouble *values) AL_API_NOEXCEPT17; typedef ALint (AL_APIENTRY *LPALGETINTEGER)(ALenum param);
typedef ALboolean (AL_APIENTRY *LPALGETBOOLEAN)(ALenum param) AL_API_NOEXCEPT17; typedef ALfloat (AL_APIENTRY *LPALGETFLOAT)(ALenum param);
typedef ALint (AL_APIENTRY *LPALGETINTEGER)(ALenum param) AL_API_NOEXCEPT17; typedef ALdouble (AL_APIENTRY *LPALGETDOUBLE)(ALenum param);
typedef ALfloat (AL_APIENTRY *LPALGETFLOAT)(ALenum param) AL_API_NOEXCEPT17; typedef ALenum (AL_APIENTRY *LPALGETERROR)(void);
typedef ALdouble (AL_APIENTRY *LPALGETDOUBLE)(ALenum param) AL_API_NOEXCEPT17; typedef ALboolean (AL_APIENTRY *LPALISEXTENSIONPRESENT)(const ALchar *extname);
typedef ALenum (AL_APIENTRY *LPALGETERROR)(void) AL_API_NOEXCEPT17; typedef void* (AL_APIENTRY *LPALGETPROCADDRESS)(const ALchar *fname);
typedef ALboolean (AL_APIENTRY *LPALISEXTENSIONPRESENT)(const ALchar *extname) AL_API_NOEXCEPT17; typedef ALenum (AL_APIENTRY *LPALGETENUMVALUE)(const ALchar *ename);
typedef void* (AL_APIENTRY *LPALGETPROCADDRESS)(const ALchar *fname) AL_API_NOEXCEPT17; typedef void (AL_APIENTRY *LPALLISTENERF)(ALenum param, ALfloat value);
typedef ALenum (AL_APIENTRY *LPALGETENUMVALUE)(const ALchar *ename) AL_API_NOEXCEPT17; typedef void (AL_APIENTRY *LPALLISTENER3F)(ALenum param, ALfloat value1, ALfloat value2, ALfloat value3);
typedef void (AL_APIENTRY *LPALLISTENERF)(ALenum param, ALfloat value) AL_API_NOEXCEPT17; typedef void (AL_APIENTRY *LPALLISTENERFV)(ALenum param, const ALfloat *values);
typedef void (AL_APIENTRY *LPALLISTENER3F)(ALenum param, ALfloat value1, ALfloat value2, ALfloat value3) AL_API_NOEXCEPT17; typedef void (AL_APIENTRY *LPALLISTENERI)(ALenum param, ALint value);
typedef void (AL_APIENTRY *LPALLISTENERFV)(ALenum param, const ALfloat *values) AL_API_NOEXCEPT17; typedef void (AL_APIENTRY *LPALLISTENER3I)(ALenum param, ALint value1, ALint value2, ALint value3);
typedef void (AL_APIENTRY *LPALLISTENERI)(ALenum param, ALint value) AL_API_NOEXCEPT17; typedef void (AL_APIENTRY *LPALLISTENERIV)(ALenum param, const ALint *values);
typedef void (AL_APIENTRY *LPALLISTENER3I)(ALenum param, ALint value1, ALint value2, ALint value3) AL_API_NOEXCEPT17; typedef void (AL_APIENTRY *LPALGETLISTENERF)(ALenum param, ALfloat *value);
typedef void (AL_APIENTRY *LPALLISTENERIV)(ALenum param, const ALint *values) AL_API_NOEXCEPT17; typedef void (AL_APIENTRY *LPALGETLISTENER3F)(ALenum param, ALfloat *value1, ALfloat *value2, ALfloat *value3);
typedef void (AL_APIENTRY *LPALGETLISTENERF)(ALenum param, ALfloat *value) AL_API_NOEXCEPT17; typedef void (AL_APIENTRY *LPALGETLISTENERFV)(ALenum param, ALfloat *values);
typedef void (AL_APIENTRY *LPALGETLISTENER3F)(ALenum param, ALfloat *value1, ALfloat *value2, ALfloat *value3) AL_API_NOEXCEPT17; typedef void (AL_APIENTRY *LPALGETLISTENERI)(ALenum param, ALint *value);
typedef void (AL_APIENTRY *LPALGETLISTENERFV)(ALenum param, ALfloat *values) AL_API_NOEXCEPT17; typedef void (AL_APIENTRY *LPALGETLISTENER3I)(ALenum param, ALint *value1, ALint *value2, ALint *value3);
typedef void (AL_APIENTRY *LPALGETLISTENERI)(ALenum param, ALint *value) AL_API_NOEXCEPT17; typedef void (AL_APIENTRY *LPALGETLISTENERIV)(ALenum param, ALint *values);
typedef void (AL_APIENTRY *LPALGETLISTENER3I)(ALenum param, ALint *value1, ALint *value2, ALint *value3) AL_API_NOEXCEPT17; typedef void (AL_APIENTRY *LPALGENSOURCES)(ALsizei n, ALuint *sources);
typedef void (AL_APIENTRY *LPALGETLISTENERIV)(ALenum param, ALint *values) AL_API_NOEXCEPT17; typedef void (AL_APIENTRY *LPALDELETESOURCES)(ALsizei n, const ALuint *sources);
typedef void (AL_APIENTRY *LPALGENSOURCES)(ALsizei n, ALuint *sources) AL_API_NOEXCEPT17; typedef ALboolean (AL_APIENTRY *LPALISSOURCE)(ALuint source);
typedef void (AL_APIENTRY *LPALDELETESOURCES)(ALsizei n, const ALuint *sources) AL_API_NOEXCEPT17; typedef void (AL_APIENTRY *LPALSOURCEF)(ALuint source, ALenum param, ALfloat value);
typedef ALboolean (AL_APIENTRY *LPALISSOURCE)(ALuint source) AL_API_NOEXCEPT17; typedef void (AL_APIENTRY *LPALSOURCE3F)(ALuint source, ALenum param, ALfloat value1, ALfloat value2, ALfloat value3);
typedef void (AL_APIENTRY *LPALSOURCEF)(ALuint source, ALenum param, ALfloat value) AL_API_NOEXCEPT17; typedef void (AL_APIENTRY *LPALSOURCEFV)(ALuint source, ALenum param, const ALfloat *values);
typedef void (AL_APIENTRY *LPALSOURCE3F)(ALuint source, ALenum param, ALfloat value1, ALfloat value2, ALfloat value3) AL_API_NOEXCEPT17; typedef void (AL_APIENTRY *LPALSOURCEI)(ALuint source, ALenum param, ALint value);
typedef void (AL_APIENTRY *LPALSOURCEFV)(ALuint source, ALenum param, const ALfloat *values) AL_API_NOEXCEPT17; typedef void (AL_APIENTRY *LPALSOURCE3I)(ALuint source, ALenum param, ALint value1, ALint value2, ALint value3);
typedef void (AL_APIENTRY *LPALSOURCEI)(ALuint source, ALenum param, ALint value) AL_API_NOEXCEPT17; typedef void (AL_APIENTRY *LPALSOURCEIV)(ALuint source, ALenum param, const ALint *values);
typedef void (AL_APIENTRY *LPALSOURCE3I)(ALuint source, ALenum param, ALint value1, ALint value2, ALint value3) AL_API_NOEXCEPT17; typedef void (AL_APIENTRY *LPALGETSOURCEF)(ALuint source, ALenum param, ALfloat *value);
typedef void (AL_APIENTRY *LPALSOURCEIV)(ALuint source, ALenum param, const ALint *values) AL_API_NOEXCEPT17; typedef void (AL_APIENTRY *LPALGETSOURCE3F)(ALuint source, ALenum param, ALfloat *value1, ALfloat *value2, ALfloat *value3);
typedef void (AL_APIENTRY *LPALGETSOURCEF)(ALuint source, ALenum param, ALfloat *value) AL_API_NOEXCEPT17; typedef void (AL_APIENTRY *LPALGETSOURCEFV)(ALuint source, ALenum param, ALfloat *values);
typedef void (AL_APIENTRY *LPALGETSOURCE3F)(ALuint source, ALenum param, ALfloat *value1, ALfloat *value2, ALfloat *value3) AL_API_NOEXCEPT17; typedef void (AL_APIENTRY *LPALGETSOURCEI)(ALuint source, ALenum param, ALint *value);
typedef void (AL_APIENTRY *LPALGETSOURCEFV)(ALuint source, ALenum param, ALfloat *values) AL_API_NOEXCEPT17; typedef void (AL_APIENTRY *LPALGETSOURCE3I)(ALuint source, ALenum param, ALint *value1, ALint *value2, ALint *value3);
typedef void (AL_APIENTRY *LPALGETSOURCEI)(ALuint source, ALenum param, ALint *value) AL_API_NOEXCEPT17; typedef void (AL_APIENTRY *LPALGETSOURCEIV)(ALuint source, ALenum param, ALint *values);
typedef void (AL_APIENTRY *LPALGETSOURCE3I)(ALuint source, ALenum param, ALint *value1, ALint *value2, ALint *value3) AL_API_NOEXCEPT17; typedef void (AL_APIENTRY *LPALSOURCEPLAYV)(ALsizei n, const ALuint *sources);
typedef void (AL_APIENTRY *LPALGETSOURCEIV)(ALuint source, ALenum param, ALint *values) AL_API_NOEXCEPT17; typedef void (AL_APIENTRY *LPALSOURCESTOPV)(ALsizei n, const ALuint *sources);
typedef void (AL_APIENTRY *LPALSOURCEPLAYV)(ALsizei n, const ALuint *sources) AL_API_NOEXCEPT17; typedef void (AL_APIENTRY *LPALSOURCEREWINDV)(ALsizei n, const ALuint *sources);
typedef void (AL_APIENTRY *LPALSOURCESTOPV)(ALsizei n, const ALuint *sources) AL_API_NOEXCEPT17; typedef void (AL_APIENTRY *LPALSOURCEPAUSEV)(ALsizei n, const ALuint *sources);
typedef void (AL_APIENTRY *LPALSOURCEREWINDV)(ALsizei n, const ALuint *sources) AL_API_NOEXCEPT17; typedef void (AL_APIENTRY *LPALSOURCEPLAY)(ALuint source);
typedef void (AL_APIENTRY *LPALSOURCEPAUSEV)(ALsizei n, const ALuint *sources) AL_API_NOEXCEPT17; typedef void (AL_APIENTRY *LPALSOURCESTOP)(ALuint source);
typedef void (AL_APIENTRY *LPALSOURCEPLAY)(ALuint source) AL_API_NOEXCEPT17; typedef void (AL_APIENTRY *LPALSOURCEREWIND)(ALuint source);
typedef void (AL_APIENTRY *LPALSOURCESTOP)(ALuint source) AL_API_NOEXCEPT17; typedef void (AL_APIENTRY *LPALSOURCEPAUSE)(ALuint source);
typedef void (AL_APIENTRY *LPALSOURCEREWIND)(ALuint source) AL_API_NOEXCEPT17; typedef void (AL_APIENTRY *LPALSOURCEQUEUEBUFFERS)(ALuint source, ALsizei nb, const ALuint *buffers);
typedef void (AL_APIENTRY *LPALSOURCEPAUSE)(ALuint source) AL_API_NOEXCEPT17; typedef void (AL_APIENTRY *LPALSOURCEUNQUEUEBUFFERS)(ALuint source, ALsizei nb, ALuint *buffers);
typedef void (AL_APIENTRY *LPALSOURCEQUEUEBUFFERS)(ALuint source, ALsizei nb, const ALuint *buffers) AL_API_NOEXCEPT17; typedef void (AL_APIENTRY *LPALGENBUFFERS)(ALsizei n, ALuint *buffers);
typedef void (AL_APIENTRY *LPALSOURCEUNQUEUEBUFFERS)(ALuint source, ALsizei nb, ALuint *buffers) AL_API_NOEXCEPT17; typedef void (AL_APIENTRY *LPALDELETEBUFFERS)(ALsizei n, const ALuint *buffers);
typedef void (AL_APIENTRY *LPALGENBUFFERS)(ALsizei n, ALuint *buffers) AL_API_NOEXCEPT17; typedef ALboolean (AL_APIENTRY *LPALISBUFFER)(ALuint buffer);
typedef void (AL_APIENTRY *LPALDELETEBUFFERS)(ALsizei n, const ALuint *buffers) AL_API_NOEXCEPT17; typedef void (AL_APIENTRY *LPALBUFFERDATA)(ALuint buffer, ALenum format, const ALvoid *data, ALsizei size, ALsizei freq);
typedef ALboolean (AL_APIENTRY *LPALISBUFFER)(ALuint buffer) AL_API_NOEXCEPT17; typedef void (AL_APIENTRY *LPALBUFFERF)(ALuint buffer, ALenum param, ALfloat value);
typedef void (AL_APIENTRY *LPALBUFFERDATA)(ALuint buffer, ALenum format, const ALvoid *data, ALsizei size, ALsizei samplerate) AL_API_NOEXCEPT17; typedef void (AL_APIENTRY *LPALBUFFER3F)(ALuint buffer, ALenum param, ALfloat value1, ALfloat value2, ALfloat value3);
typedef void (AL_APIENTRY *LPALBUFFERF)(ALuint buffer, ALenum param, ALfloat value) AL_API_NOEXCEPT17; typedef void (AL_APIENTRY *LPALBUFFERFV)(ALuint buffer, ALenum param, const ALfloat *values);
typedef void (AL_APIENTRY *LPALBUFFER3F)(ALuint buffer, ALenum param, ALfloat value1, ALfloat value2, ALfloat value3) AL_API_NOEXCEPT17; typedef void (AL_APIENTRY *LPALBUFFERI)(ALuint buffer, ALenum param, ALint value);
typedef void (AL_APIENTRY *LPALBUFFERFV)(ALuint buffer, ALenum param, const ALfloat *values) AL_API_NOEXCEPT17; typedef void (AL_APIENTRY *LPALBUFFER3I)(ALuint buffer, ALenum param, ALint value1, ALint value2, ALint value3);
typedef void (AL_APIENTRY *LPALBUFFERI)(ALuint buffer, ALenum param, ALint value) AL_API_NOEXCEPT17; typedef void (AL_APIENTRY *LPALBUFFERIV)(ALuint buffer, ALenum param, const ALint *values);
typedef void (AL_APIENTRY *LPALBUFFER3I)(ALuint buffer, ALenum param, ALint value1, ALint value2, ALint value3) AL_API_NOEXCEPT17; typedef void (AL_APIENTRY *LPALGETBUFFERF)(ALuint buffer, ALenum param, ALfloat *value);
typedef void (AL_APIENTRY *LPALBUFFERIV)(ALuint buffer, ALenum param, const ALint *values) AL_API_NOEXCEPT17; typedef void (AL_APIENTRY *LPALGETBUFFER3F)(ALuint buffer, ALenum param, ALfloat *value1, ALfloat *value2, ALfloat *value3);
typedef void (AL_APIENTRY *LPALGETBUFFERF)(ALuint buffer, ALenum param, ALfloat *value) AL_API_NOEXCEPT17; typedef void (AL_APIENTRY *LPALGETBUFFERFV)(ALuint buffer, ALenum param, ALfloat *values);
typedef void (AL_APIENTRY *LPALGETBUFFER3F)(ALuint buffer, ALenum param, ALfloat *value1, ALfloat *value2, ALfloat *value3) AL_API_NOEXCEPT17; typedef void (AL_APIENTRY *LPALGETBUFFERI)(ALuint buffer, ALenum param, ALint *value);
typedef void (AL_APIENTRY *LPALGETBUFFERFV)(ALuint buffer, ALenum param, ALfloat *values) AL_API_NOEXCEPT17; typedef void (AL_APIENTRY *LPALGETBUFFER3I)(ALuint buffer, ALenum param, ALint *value1, ALint *value2, ALint *value3);
typedef void (AL_APIENTRY *LPALGETBUFFERI)(ALuint buffer, ALenum param, ALint *value) AL_API_NOEXCEPT17; typedef void (AL_APIENTRY *LPALGETBUFFERIV)(ALuint buffer, ALenum param, ALint *values);
typedef void (AL_APIENTRY *LPALGETBUFFER3I)(ALuint buffer, ALenum param, ALint *value1, ALint *value2, ALint *value3) AL_API_NOEXCEPT17; typedef void (AL_APIENTRY *LPALDOPPLERFACTOR)(ALfloat value);
typedef void (AL_APIENTRY *LPALGETBUFFERIV)(ALuint buffer, ALenum param, ALint *values) AL_API_NOEXCEPT17; typedef void (AL_APIENTRY *LPALDOPPLERVELOCITY)(ALfloat value);
typedef void (AL_APIENTRY *LPALDOPPLERFACTOR)(ALfloat value) AL_API_NOEXCEPT17; typedef void (AL_APIENTRY *LPALSPEEDOFSOUND)(ALfloat value);
typedef void (AL_APIENTRY *LPALDOPPLERVELOCITY)(ALfloat value) AL_API_NOEXCEPT17; typedef void (AL_APIENTRY *LPALDISTANCEMODEL)(ALenum distanceModel);
typedef void (AL_APIENTRY *LPALSPEEDOFSOUND)(ALfloat value) AL_API_NOEXCEPT17;
typedef void (AL_APIENTRY *LPALDISTANCEMODEL)(ALenum distanceModel) AL_API_NOEXCEPT17;
#ifdef __cplusplus #if defined(__cplusplus)
} /* extern "C" */ } /* extern "C" */
#endif #endif
/* NOLINTEND */
#endif /* AL_AL_H */ #endif /* AL_AL_H */

View file

@ -1,40 +1,8 @@
#ifndef AL_ALC_H #ifndef AL_ALC_H
#define AL_ALC_H #define AL_ALC_H
/* NOLINTBEGIN */ #if defined(__cplusplus)
#ifdef __cplusplus
extern "C" { extern "C" {
#ifdef _MSVC_LANG
#define ALC_CPLUSPLUS _MSVC_LANG
#else
#define ALC_CPLUSPLUS __cplusplus
#endif
#ifndef AL_DISABLE_NOEXCEPT
#if ALC_CPLUSPLUS >= 201103L
#define ALC_API_NOEXCEPT noexcept
#else
#define ALC_API_NOEXCEPT
#endif
#if ALC_CPLUSPLUS >= 201703L
#define ALC_API_NOEXCEPT17 noexcept
#else
#define ALC_API_NOEXCEPT17
#endif
#else /* AL_DISABLE_NOEXCEPT */
#define ALC_API_NOEXCEPT
#define ALC_API_NOEXCEPT17
#endif
#undef ALC_CPLUSPLUS
#else /* __cplusplus */
#define ALC_API_NOEXCEPT
#define ALC_API_NOEXCEPT17
#endif #endif
#ifndef ALC_API #ifndef ALC_API
@ -47,14 +15,14 @@ extern "C" {
#endif #endif
#endif #endif
#ifdef _WIN32 #if defined(_WIN32)
#define ALC_APIENTRY __cdecl #define ALC_APIENTRY __cdecl
#else #else
#define ALC_APIENTRY #define ALC_APIENTRY
#endif #endif
/* Deprecated macros. */ /** Deprecated macro. */
#define ALCAPI ALC_API #define ALCAPI ALC_API
#define ALCAPIENTRY ALC_APIENTRY #define ALCAPIENTRY ALC_APIENTRY
#define ALC_INVALID 0 #define ALC_INVALID 0
@ -63,9 +31,9 @@ extern "C" {
#define ALC_VERSION_0_1 1 #define ALC_VERSION_0_1 1
/** Opaque device handle */ /** Opaque device handle */
typedef struct ALCdevice ALCdevice; typedef struct ALCdevice_struct ALCdevice;
/** Opaque context handle */ /** Opaque context handle */
typedef struct ALCcontext ALCcontext; typedef struct ALCcontext_struct ALCcontext;
/** 8-bit boolean */ /** 8-bit boolean */
typedef char ALCboolean; typedef char ALCboolean;
@ -73,41 +41,41 @@ typedef char ALCboolean;
/** character */ /** character */
typedef char ALCchar; typedef char ALCchar;
/** signed 8-bit integer */ /** signed 8-bit 2's complement integer */
typedef signed char ALCbyte; typedef signed char ALCbyte;
/** unsigned 8-bit integer */ /** unsigned 8-bit integer */
typedef unsigned char ALCubyte; typedef unsigned char ALCubyte;
/** signed 16-bit integer */ /** signed 16-bit 2's complement integer */
typedef short ALCshort; typedef short ALCshort;
/** unsigned 16-bit integer */ /** unsigned 16-bit integer */
typedef unsigned short ALCushort; typedef unsigned short ALCushort;
/** signed 32-bit integer */ /** signed 32-bit 2's complement integer */
typedef int ALCint; typedef int ALCint;
/** unsigned 32-bit integer */ /** unsigned 32-bit integer */
typedef unsigned int ALCuint; typedef unsigned int ALCuint;
/** non-negative 32-bit integer size */ /** non-negative 32-bit binary integer size */
typedef int ALCsizei; typedef int ALCsizei;
/** 32-bit enumeration value */ /** enumerated 32-bit value */
typedef int ALCenum; typedef int ALCenum;
/** 32-bit IEEE-754 floating-point */ /** 32-bit IEEE754 floating-point */
typedef float ALCfloat; typedef float ALCfloat;
/** 64-bit IEEE-754 floating-point */ /** 64-bit IEEE754 floating-point */
typedef double ALCdouble; typedef double ALCdouble;
/** void type (for opaque pointers only) */ /** void type (for opaque pointers only) */
typedef void ALCvoid; typedef void ALCvoid;
/* Enumeration values begin at column 50. Do not use tabs. */ /* Enumerant values begin at column 50. No tabs. */
/** Boolean False. */ /** Boolean False. */
#define ALC_FALSE 0 #define ALC_FALSE 0
@ -121,7 +89,7 @@ typedef void ALCvoid;
/** Context attribute: <int> Hz. */ /** Context attribute: <int> Hz. */
#define ALC_REFRESH 0x1008 #define ALC_REFRESH 0x1008
/** Context attribute: AL_TRUE or AL_FALSE synchronous context? */ /** Context attribute: AL_TRUE or AL_FALSE. */
#define ALC_SYNC 0x1009 #define ALC_SYNC 0x1009
/** Context attribute: <int> requested Mono (3D) Sources. */ /** Context attribute: <int> requested Mono (3D) Sources. */
@ -139,32 +107,30 @@ typedef void ALCvoid;
/** Invalid context handle. */ /** Invalid context handle. */
#define ALC_INVALID_CONTEXT 0xA002 #define ALC_INVALID_CONTEXT 0xA002
/** Invalid enumeration passed to an ALC call. */ /** Invalid enum parameter passed to an ALC call. */
#define ALC_INVALID_ENUM 0xA003 #define ALC_INVALID_ENUM 0xA003
/** Invalid value passed to an ALC call. */ /** Invalid value parameter passed to an ALC call. */
#define ALC_INVALID_VALUE 0xA004 #define ALC_INVALID_VALUE 0xA004
/** Out of memory. */ /** Out of memory. */
#define ALC_OUT_OF_MEMORY 0xA005 #define ALC_OUT_OF_MEMORY 0xA005
/** Runtime ALC major version. */ /** Runtime ALC version. */
#define ALC_MAJOR_VERSION 0x1000 #define ALC_MAJOR_VERSION 0x1000
/** Runtime ALC minor version. */
#define ALC_MINOR_VERSION 0x1001 #define ALC_MINOR_VERSION 0x1001
/** Context attribute list size. */
#define ALC_ATTRIBUTES_SIZE 0x1002
/** Context attribute list properties. */ /** Context attribute list properties. */
#define ALC_ATTRIBUTES_SIZE 0x1002
#define ALC_ALL_ATTRIBUTES 0x1003 #define ALC_ALL_ATTRIBUTES 0x1003
/** String for the default device specifier. */ /** String for the default device specifier. */
#define ALC_DEFAULT_DEVICE_SPECIFIER 0x1004 #define ALC_DEFAULT_DEVICE_SPECIFIER 0x1004
/** /**
* Device specifier string. * String for the given device's specifier.
* *
* If device handle is NULL, it is instead a null-character separated list of * If device handle is NULL, it is instead a null-char separated list of
* strings of known device specifiers (list ends with an empty string). * strings of known device specifiers (list ends with an empty string).
*/ */
#define ALC_DEVICE_SPECIFIER 0x1005 #define ALC_DEVICE_SPECIFIER 0x1005
@ -175,9 +141,9 @@ typedef void ALCvoid;
/** Capture extension */ /** Capture extension */
#define ALC_EXT_CAPTURE 1 #define ALC_EXT_CAPTURE 1
/** /**
* Capture device specifier string. * String for the given capture device's specifier.
* *
* If device handle is NULL, it is instead a null-character separated list of * If device handle is NULL, it is instead a null-char separated list of
* strings of known capture device specifiers (list ends with an empty string). * strings of known capture device specifiers (list ends with an empty string).
*/ */
#define ALC_CAPTURE_DEVICE_SPECIFIER 0x310 #define ALC_CAPTURE_DEVICE_SPECIFIER 0x310
@ -192,116 +158,80 @@ typedef void ALCvoid;
/** String for the default extended device specifier. */ /** String for the default extended device specifier. */
#define ALC_DEFAULT_ALL_DEVICES_SPECIFIER 0x1012 #define ALC_DEFAULT_ALL_DEVICES_SPECIFIER 0x1012
/** /**
* Device's extended specifier string. * String for the given extended device's specifier.
* *
* If device handle is NULL, it is instead a null-character separated list of * If device handle is NULL, it is instead a null-char separated list of
* strings of known extended device specifiers (list ends with an empty string). * strings of known extended device specifiers (list ends with an empty string).
*/ */
#define ALC_ALL_DEVICES_SPECIFIER 0x1013 #define ALC_ALL_DEVICES_SPECIFIER 0x1013
#ifndef ALC_NO_PROTOTYPES /** Context management. */
/* Context management. */ ALC_API ALCcontext* ALC_APIENTRY alcCreateContext(ALCdevice *device, const ALCint* attrlist);
ALC_API ALCboolean ALC_APIENTRY alcMakeContextCurrent(ALCcontext *context);
ALC_API void ALC_APIENTRY alcProcessContext(ALCcontext *context);
ALC_API void ALC_APIENTRY alcSuspendContext(ALCcontext *context);
ALC_API void ALC_APIENTRY alcDestroyContext(ALCcontext *context);
ALC_API ALCcontext* ALC_APIENTRY alcGetCurrentContext(void);
ALC_API ALCdevice* ALC_APIENTRY alcGetContextsDevice(ALCcontext *context);
/** Create and attach a context to the given device. */ /** Device management. */
ALC_API ALCcontext* ALC_APIENTRY alcCreateContext(ALCdevice *device, const ALCint *attrlist) ALC_API_NOEXCEPT; ALC_API ALCdevice* ALC_APIENTRY alcOpenDevice(const ALCchar *devicename);
/** ALC_API ALCboolean ALC_APIENTRY alcCloseDevice(ALCdevice *device);
* Makes the given context the active process-wide context. Passing NULL clears
* the active context.
*/
ALC_API ALCboolean ALC_APIENTRY alcMakeContextCurrent(ALCcontext *context) ALC_API_NOEXCEPT;
/** Resumes processing updates for the given context. */
ALC_API void ALC_APIENTRY alcProcessContext(ALCcontext *context) ALC_API_NOEXCEPT;
/** Suspends updates for the given context. */
ALC_API void ALC_APIENTRY alcSuspendContext(ALCcontext *context) ALC_API_NOEXCEPT;
/** Remove a context from its device and destroys it. */
ALC_API void ALC_APIENTRY alcDestroyContext(ALCcontext *context) ALC_API_NOEXCEPT;
/** Returns the currently active context. */
ALC_API ALCcontext* ALC_APIENTRY alcGetCurrentContext(void) ALC_API_NOEXCEPT;
/** Returns the device that a particular context is attached to. */
ALC_API ALCdevice* ALC_APIENTRY alcGetContextsDevice(ALCcontext *context) ALC_API_NOEXCEPT;
/* Device management. */
/** Opens the named playback device. */
ALC_API ALCdevice* ALC_APIENTRY alcOpenDevice(const ALCchar *devicename) ALC_API_NOEXCEPT;
/** Closes the given playback device. */
ALC_API ALCboolean ALC_APIENTRY alcCloseDevice(ALCdevice *device) ALC_API_NOEXCEPT;
/* Error support. */
/** Obtain the most recent Device error. */
ALC_API ALCenum ALC_APIENTRY alcGetError(ALCdevice *device) ALC_API_NOEXCEPT;
/* Extension support. */
/** /**
* Query for the presence of an extension on the device. Pass a NULL device to * Error support.
* query a device-inspecific extension. *
* Obtain the most recent Device error.
*/ */
ALC_API ALCboolean ALC_APIENTRY alcIsExtensionPresent(ALCdevice *device, const ALCchar *extname) ALC_API_NOEXCEPT; ALC_API ALCenum ALC_APIENTRY alcGetError(ALCdevice *device);
/**
* Retrieve the address of a function. Given a non-NULL device, the returned
* function may be device-specific.
*/
ALC_API ALCvoid* ALC_APIENTRY alcGetProcAddress(ALCdevice *device, const ALCchar *funcname) ALC_API_NOEXCEPT;
/**
* Retrieve the value of an enum. Given a non-NULL device, the returned value
* may be device-specific.
*/
ALC_API ALCenum ALC_APIENTRY alcGetEnumValue(ALCdevice *device, const ALCchar *enumname) ALC_API_NOEXCEPT;
/* Query functions. */
/** Returns information about the device, and error strings. */
ALC_API const ALCchar* ALC_APIENTRY alcGetString(ALCdevice *device, ALCenum param) ALC_API_NOEXCEPT;
/** Returns information about the device and the version of OpenAL. */
ALC_API void ALC_APIENTRY alcGetIntegerv(ALCdevice *device, ALCenum param, ALCsizei size, ALCint *values) ALC_API_NOEXCEPT;
/* Capture functions. */
/** /**
* Opens the named capture device with the given frequency, format, and buffer * Extension support.
* size. *
* Query for the presence of an extension, and obtain any appropriate
* function pointers and enum values.
*/ */
ALC_API ALCdevice* ALC_APIENTRY alcCaptureOpenDevice(const ALCchar *devicename, ALCuint frequency, ALCenum format, ALCsizei buffersize) ALC_API_NOEXCEPT; ALC_API ALCboolean ALC_APIENTRY alcIsExtensionPresent(ALCdevice *device, const ALCchar *extname);
/** Closes the given capture device. */ ALC_API void* ALC_APIENTRY alcGetProcAddress(ALCdevice *device, const ALCchar *funcname);
ALC_API ALCboolean ALC_APIENTRY alcCaptureCloseDevice(ALCdevice *device) ALC_API_NOEXCEPT; ALC_API ALCenum ALC_APIENTRY alcGetEnumValue(ALCdevice *device, const ALCchar *enumname);
/** Starts capturing samples into the device buffer. */
ALC_API void ALC_APIENTRY alcCaptureStart(ALCdevice *device) ALC_API_NOEXCEPT;
/** Stops capturing samples. Samples in the device buffer remain available. */
ALC_API void ALC_APIENTRY alcCaptureStop(ALCdevice *device) ALC_API_NOEXCEPT;
/** Reads samples from the device buffer. */
ALC_API void ALC_APIENTRY alcCaptureSamples(ALCdevice *device, ALCvoid *buffer, ALCsizei samples) ALC_API_NOEXCEPT;
#endif /* ALC_NO_PROTOTYPES */
/* Pointer-to-function types, useful for storing dynamically loaded ALC entry /** Query function. */
* points. ALC_API const ALCchar* ALC_APIENTRY alcGetString(ALCdevice *device, ALCenum param);
*/ ALC_API void ALC_APIENTRY alcGetIntegerv(ALCdevice *device, ALCenum param, ALCsizei size, ALCint *values);
typedef ALCcontext* (ALC_APIENTRY *LPALCCREATECONTEXT)(ALCdevice *device, const ALCint *attrlist) ALC_API_NOEXCEPT17;
typedef ALCboolean (ALC_APIENTRY *LPALCMAKECONTEXTCURRENT)(ALCcontext *context) ALC_API_NOEXCEPT17;
typedef void (ALC_APIENTRY *LPALCPROCESSCONTEXT)(ALCcontext *context) ALC_API_NOEXCEPT17;
typedef void (ALC_APIENTRY *LPALCSUSPENDCONTEXT)(ALCcontext *context) ALC_API_NOEXCEPT17;
typedef void (ALC_APIENTRY *LPALCDESTROYCONTEXT)(ALCcontext *context) ALC_API_NOEXCEPT17;
typedef ALCcontext* (ALC_APIENTRY *LPALCGETCURRENTCONTEXT)(void) ALC_API_NOEXCEPT17;
typedef ALCdevice* (ALC_APIENTRY *LPALCGETCONTEXTSDEVICE)(ALCcontext *context) ALC_API_NOEXCEPT17;
typedef ALCdevice* (ALC_APIENTRY *LPALCOPENDEVICE)(const ALCchar *devicename) ALC_API_NOEXCEPT17;
typedef ALCboolean (ALC_APIENTRY *LPALCCLOSEDEVICE)(ALCdevice *device) ALC_API_NOEXCEPT17;
typedef ALCenum (ALC_APIENTRY *LPALCGETERROR)(ALCdevice *device) ALC_API_NOEXCEPT17;
typedef ALCboolean (ALC_APIENTRY *LPALCISEXTENSIONPRESENT)(ALCdevice *device, const ALCchar *extname) ALC_API_NOEXCEPT17;
typedef ALCvoid* (ALC_APIENTRY *LPALCGETPROCADDRESS)(ALCdevice *device, const ALCchar *funcname) ALC_API_NOEXCEPT17;
typedef ALCenum (ALC_APIENTRY *LPALCGETENUMVALUE)(ALCdevice *device, const ALCchar *enumname) ALC_API_NOEXCEPT17;
typedef const ALCchar* (ALC_APIENTRY *LPALCGETSTRING)(ALCdevice *device, ALCenum param) ALC_API_NOEXCEPT17;
typedef void (ALC_APIENTRY *LPALCGETINTEGERV)(ALCdevice *device, ALCenum param, ALCsizei size, ALCint *values) ALC_API_NOEXCEPT17;
typedef ALCdevice* (ALC_APIENTRY *LPALCCAPTUREOPENDEVICE)(const ALCchar *devicename, ALCuint frequency, ALCenum format, ALCsizei buffersize) ALC_API_NOEXCEPT17;
typedef ALCboolean (ALC_APIENTRY *LPALCCAPTURECLOSEDEVICE)(ALCdevice *device) ALC_API_NOEXCEPT17;
typedef void (ALC_APIENTRY *LPALCCAPTURESTART)(ALCdevice *device) ALC_API_NOEXCEPT17;
typedef void (ALC_APIENTRY *LPALCCAPTURESTOP)(ALCdevice *device) ALC_API_NOEXCEPT17;
typedef void (ALC_APIENTRY *LPALCCAPTURESAMPLES)(ALCdevice *device, ALCvoid *buffer, ALCsizei samples) ALC_API_NOEXCEPT17;
#ifdef __cplusplus /** Capture function. */
} /* extern "C" */ ALC_API ALCdevice* ALC_APIENTRY alcCaptureOpenDevice(const ALCchar *devicename, ALCuint frequency, ALCenum format, ALCsizei buffersize);
ALC_API ALCboolean ALC_APIENTRY alcCaptureCloseDevice(ALCdevice *device);
ALC_API void ALC_APIENTRY alcCaptureStart(ALCdevice *device);
ALC_API void ALC_APIENTRY alcCaptureStop(ALCdevice *device);
ALC_API void ALC_APIENTRY alcCaptureSamples(ALCdevice *device, ALCvoid *buffer, ALCsizei samples);
/** Pointer-to-function type, useful for dynamically getting ALC entry points. */
typedef ALCcontext* (ALC_APIENTRY *LPALCCREATECONTEXT)(ALCdevice *device, const ALCint *attrlist);
typedef ALCboolean (ALC_APIENTRY *LPALCMAKECONTEXTCURRENT)(ALCcontext *context);
typedef void (ALC_APIENTRY *LPALCPROCESSCONTEXT)(ALCcontext *context);
typedef void (ALC_APIENTRY *LPALCSUSPENDCONTEXT)(ALCcontext *context);
typedef void (ALC_APIENTRY *LPALCDESTROYCONTEXT)(ALCcontext *context);
typedef ALCcontext* (ALC_APIENTRY *LPALCGETCURRENTCONTEXT)(void);
typedef ALCdevice* (ALC_APIENTRY *LPALCGETCONTEXTSDEVICE)(ALCcontext *context);
typedef ALCdevice* (ALC_APIENTRY *LPALCOPENDEVICE)(const ALCchar *devicename);
typedef ALCboolean (ALC_APIENTRY *LPALCCLOSEDEVICE)(ALCdevice *device);
typedef ALCenum (ALC_APIENTRY *LPALCGETERROR)(ALCdevice *device);
typedef ALCboolean (ALC_APIENTRY *LPALCISEXTENSIONPRESENT)(ALCdevice *device, const ALCchar *extname);
typedef void* (ALC_APIENTRY *LPALCGETPROCADDRESS)(ALCdevice *device, const ALCchar *funcname);
typedef ALCenum (ALC_APIENTRY *LPALCGETENUMVALUE)(ALCdevice *device, const ALCchar *enumname);
typedef const ALCchar* (ALC_APIENTRY *LPALCGETSTRING)(ALCdevice *device, ALCenum param);
typedef void (ALC_APIENTRY *LPALCGETINTEGERV)(ALCdevice *device, ALCenum param, ALCsizei size, ALCint *values);
typedef ALCdevice* (ALC_APIENTRY *LPALCCAPTUREOPENDEVICE)(const ALCchar *devicename, ALCuint frequency, ALCenum format, ALCsizei buffersize);
typedef ALCboolean (ALC_APIENTRY *LPALCCAPTURECLOSEDEVICE)(ALCdevice *device);
typedef void (ALC_APIENTRY *LPALCCAPTURESTART)(ALCdevice *device);
typedef void (ALC_APIENTRY *LPALCCAPTURESTOP)(ALCdevice *device);
typedef void (ALC_APIENTRY *LPALCCAPTURESAMPLES)(ALCdevice *device, ALCvoid *buffer, ALCsizei samples);
#if defined(__cplusplus)
}
#endif #endif
/* NOLINTEND */
#endif /* AL_ALC_H */ #endif /* AL_ALC_H */

View file

@ -1,22 +1,38 @@
/**
* OpenAL cross platform audio library
* Copyright (C) 2008 by authors.
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
* Or go to http://www.gnu.org/copyleft/lgpl.html
*/
#ifndef AL_ALEXT_H #ifndef AL_ALEXT_H
#define AL_ALEXT_H #define AL_ALEXT_H
/* NOLINTBEGIN */
#include <stddef.h> #include <stddef.h>
/* Define int64 and uint64 types */ /* Define int64_t and uint64_t types */
#if (defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L) || \ #if defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
(defined(__cplusplus) && __cplusplus >= 201103L) #include <inttypes.h>
#elif defined(_WIN32) && defined(__GNUC__)
#include <stdint.h> #include <stdint.h>
typedef int64_t _alsoft_int64_t;
typedef uint64_t _alsoft_uint64_t;
#elif defined(_WIN32) #elif defined(_WIN32)
typedef __int64 _alsoft_int64_t; typedef __int64 int64_t;
typedef unsigned __int64 _alsoft_uint64_t; typedef unsigned __int64 uint64_t;
#else #else
/* Fallback if nothing above works */ /* Fallback if nothing above works */
#include <stdint.h> #include <inttypes.h>
typedef int64_t _alsoft_int64_t;
typedef uint64_t _alsoft_uint64_t;
#endif #endif
#include "alc.h" #include "alc.h"
@ -26,8 +42,6 @@ typedef uint64_t _alsoft_uint64_t;
extern "C" { extern "C" {
#endif #endif
struct _GUID;
#ifndef AL_LOKI_IMA_ADPCM_format #ifndef AL_LOKI_IMA_ADPCM_format
#define AL_LOKI_IMA_ADPCM_format 1 #define AL_LOKI_IMA_ADPCM_format 1
#define AL_FORMAT_IMA_ADPCM_MONO16_EXT 0x10000 #define AL_FORMAT_IMA_ADPCM_MONO16_EXT 0x10000
@ -83,31 +97,6 @@ struct _GUID;
#ifndef AL_EXT_MCFORMATS #ifndef AL_EXT_MCFORMATS
#define AL_EXT_MCFORMATS 1 #define AL_EXT_MCFORMATS 1
/* Provides support for surround sound buffer formats with 8, 16, and 32-bit
* samples.
*
* QUAD8: Unsigned 8-bit, Quadraphonic (Front Left, Front Right, Rear Left,
* Rear Right).
* QUAD16: Signed 16-bit, Quadraphonic.
* QUAD32: 32-bit float, Quadraphonic.
* REAR8: Unsigned 8-bit, Rear Stereo (Rear Left, Rear Right).
* REAR16: Signed 16-bit, Rear Stereo.
* REAR32: 32-bit float, Rear Stereo.
* 51CHN8: Unsigned 8-bit, 5.1 Surround (Front Left, Front Right, Front Center,
* LFE, Side Left, Side Right). Note that some audio systems may label
* 5.1's Side channels as Rear or Surround; they are equivalent for the
* purposes of this extension.
* 51CHN16: Signed 16-bit, 5.1 Surround.
* 51CHN32: 32-bit float, 5.1 Surround.
* 61CHN8: Unsigned 8-bit, 6.1 Surround (Front Left, Front Right, Front Center,
* LFE, Rear Center, Side Left, Side Right).
* 61CHN16: Signed 16-bit, 6.1 Surround.
* 61CHN32: 32-bit float, 6.1 Surround.
* 71CHN8: Unsigned 8-bit, 7.1 Surround (Front Left, Front Right, Front Center,
* LFE, Rear Left, Rear Right, Side Left, Side Right).
* 71CHN16: Signed 16-bit, 7.1 Surround.
* 71CHN32: 32-bit float, 7.1 Surround.
*/
#define AL_FORMAT_QUAD8 0x1204 #define AL_FORMAT_QUAD8 0x1204
#define AL_FORMAT_QUAD16 0x1205 #define AL_FORMAT_QUAD16 0x1205
#define AL_FORMAT_QUAD32 0x1206 #define AL_FORMAT_QUAD32 0x1206
@ -144,9 +133,9 @@ struct _GUID;
#ifndef AL_EXT_STATIC_BUFFER #ifndef AL_EXT_STATIC_BUFFER
#define AL_EXT_STATIC_BUFFER 1 #define AL_EXT_STATIC_BUFFER 1
typedef void (AL_APIENTRY*PFNALBUFFERDATASTATICPROC)(const ALuint,ALenum,ALvoid*,ALsizei,ALsizei) AL_API_NOEXCEPT17; typedef ALvoid (AL_APIENTRY*PFNALBUFFERDATASTATICPROC)(const ALint,ALenum,ALvoid*,ALsizei,ALsizei);
#ifdef AL_ALEXT_PROTOTYPES #ifdef AL_ALEXT_PROTOTYPES
void AL_APIENTRY alBufferDataStatic(const ALuint buffer, ALenum format, ALvoid *data, ALsizei size, ALsizei freq) AL_API_NOEXCEPT; AL_API ALvoid AL_APIENTRY alBufferDataStatic(const ALint buffer, ALenum format, ALvoid *data, ALsizei len, ALsizei freq);
#endif #endif
#endif #endif
@ -162,11 +151,11 @@ void AL_APIENTRY alBufferDataStatic(const ALuint buffer, ALenum format, ALvoid *
#ifndef ALC_EXT_thread_local_context #ifndef ALC_EXT_thread_local_context
#define ALC_EXT_thread_local_context 1 #define ALC_EXT_thread_local_context 1
typedef ALCboolean (ALC_APIENTRY*PFNALCSETTHREADCONTEXTPROC)(ALCcontext *context) ALC_API_NOEXCEPT17; typedef ALCboolean (ALC_APIENTRY*PFNALCSETTHREADCONTEXTPROC)(ALCcontext *context);
typedef ALCcontext* (ALC_APIENTRY*PFNALCGETTHREADCONTEXTPROC)(void) ALC_API_NOEXCEPT17; typedef ALCcontext* (ALC_APIENTRY*PFNALCGETTHREADCONTEXTPROC)(void);
#ifdef AL_ALEXT_PROTOTYPES #ifdef AL_ALEXT_PROTOTYPES
ALC_API ALCboolean ALC_APIENTRY alcSetThreadContext(ALCcontext *context) ALC_API_NOEXCEPT; ALC_API ALCboolean ALC_APIENTRY alcSetThreadContext(ALCcontext *context);
ALC_API ALCcontext* ALC_APIENTRY alcGetThreadContext(void) ALC_API_NOEXCEPT; ALC_API ALCcontext* ALC_APIENTRY alcGetThreadContext(void);
#endif #endif
#endif #endif
@ -179,9 +168,9 @@ ALC_API ALCcontext* ALC_APIENTRY alcGetThreadContext(void) ALC_API_NOEXCEPT;
#define AL_SOFT_buffer_sub_data 1 #define AL_SOFT_buffer_sub_data 1
#define AL_BYTE_RW_OFFSETS_SOFT 0x1031 #define AL_BYTE_RW_OFFSETS_SOFT 0x1031
#define AL_SAMPLE_RW_OFFSETS_SOFT 0x1032 #define AL_SAMPLE_RW_OFFSETS_SOFT 0x1032
typedef void (AL_APIENTRY*PFNALBUFFERSUBDATASOFTPROC)(ALuint,ALenum,const ALvoid*,ALsizei,ALsizei) AL_API_NOEXCEPT17; typedef ALvoid (AL_APIENTRY*PFNALBUFFERSUBDATASOFTPROC)(ALuint,ALenum,const ALvoid*,ALsizei,ALsizei);
#ifdef AL_ALEXT_PROTOTYPES #ifdef AL_ALEXT_PROTOTYPES
AL_API void AL_APIENTRY alBufferSubDataSOFT(ALuint buffer,ALenum format,const ALvoid *data,ALsizei offset,ALsizei length) AL_API_NOEXCEPT; AL_API ALvoid AL_APIENTRY alBufferSubDataSOFT(ALuint buffer,ALenum format,const ALvoid *data,ALsizei offset,ALsizei length);
#endif #endif
#endif #endif
@ -198,12 +187,12 @@ AL_API void AL_APIENTRY alBufferSubDataSOFT(ALuint buffer,ALenum format,const AL
#define AL_FOLDBACK_EVENT_STOP 0x4113 #define AL_FOLDBACK_EVENT_STOP 0x4113
#define AL_FOLDBACK_MODE_MONO 0x4101 #define AL_FOLDBACK_MODE_MONO 0x4101
#define AL_FOLDBACK_MODE_STEREO 0x4102 #define AL_FOLDBACK_MODE_STEREO 0x4102
typedef void (AL_APIENTRY*LPALFOLDBACKCALLBACK)(ALenum,ALsizei) AL_API_NOEXCEPT17; typedef void (AL_APIENTRY*LPALFOLDBACKCALLBACK)(ALenum,ALsizei);
typedef void (AL_APIENTRY*LPALREQUESTFOLDBACKSTART)(ALenum,ALsizei,ALsizei,ALfloat*,LPALFOLDBACKCALLBACK) AL_API_NOEXCEPT17; typedef void (AL_APIENTRY*LPALREQUESTFOLDBACKSTART)(ALenum,ALsizei,ALsizei,ALfloat*,LPALFOLDBACKCALLBACK);
typedef void (AL_APIENTRY*LPALREQUESTFOLDBACKSTOP)(void) AL_API_NOEXCEPT17; typedef void (AL_APIENTRY*LPALREQUESTFOLDBACKSTOP)(void);
#ifdef AL_ALEXT_PROTOTYPES #ifdef AL_ALEXT_PROTOTYPES
AL_API void AL_APIENTRY alRequestFoldbackStart(ALenum mode,ALsizei count,ALsizei length,ALfloat *mem,LPALFOLDBACKCALLBACK callback) AL_API_NOEXCEPT; AL_API void AL_APIENTRY alRequestFoldbackStart(ALenum mode,ALsizei count,ALsizei length,ALfloat *mem,LPALFOLDBACKCALLBACK callback);
AL_API void AL_APIENTRY alRequestFoldbackStop(void) AL_API_NOEXCEPT; AL_API void AL_APIENTRY alRequestFoldbackStop(void);
#endif #endif
#endif #endif
@ -266,15 +255,15 @@ AL_API void AL_APIENTRY alRequestFoldbackStop(void) AL_API_NOEXCEPT;
#define AL_SAMPLE_LENGTH_SOFT 0x200A #define AL_SAMPLE_LENGTH_SOFT 0x200A
#define AL_SEC_LENGTH_SOFT 0x200B #define AL_SEC_LENGTH_SOFT 0x200B
typedef void (AL_APIENTRY*LPALBUFFERSAMPLESSOFT)(ALuint,ALuint,ALenum,ALsizei,ALenum,ALenum,const ALvoid*) AL_API_NOEXCEPT17; typedef void (AL_APIENTRY*LPALBUFFERSAMPLESSOFT)(ALuint,ALuint,ALenum,ALsizei,ALenum,ALenum,const ALvoid*);
typedef void (AL_APIENTRY*LPALBUFFERSUBSAMPLESSOFT)(ALuint,ALsizei,ALsizei,ALenum,ALenum,const ALvoid*) AL_API_NOEXCEPT17; typedef void (AL_APIENTRY*LPALBUFFERSUBSAMPLESSOFT)(ALuint,ALsizei,ALsizei,ALenum,ALenum,const ALvoid*);
typedef void (AL_APIENTRY*LPALGETBUFFERSAMPLESSOFT)(ALuint,ALsizei,ALsizei,ALenum,ALenum,ALvoid*) AL_API_NOEXCEPT17; typedef void (AL_APIENTRY*LPALGETBUFFERSAMPLESSOFT)(ALuint,ALsizei,ALsizei,ALenum,ALenum,ALvoid*);
typedef ALboolean (AL_APIENTRY*LPALISBUFFERFORMATSUPPORTEDSOFT)(ALenum) AL_API_NOEXCEPT17; typedef ALboolean (AL_APIENTRY*LPALISBUFFERFORMATSUPPORTEDSOFT)(ALenum);
#ifdef AL_ALEXT_PROTOTYPES #ifdef AL_ALEXT_PROTOTYPES
AL_API void AL_APIENTRY alBufferSamplesSOFT(ALuint buffer, ALuint samplerate, ALenum internalformat, ALsizei samples, ALenum channels, ALenum type, const ALvoid *data) AL_API_NOEXCEPT; AL_API void AL_APIENTRY alBufferSamplesSOFT(ALuint buffer, ALuint samplerate, ALenum internalformat, ALsizei samples, ALenum channels, ALenum type, const ALvoid *data);
AL_API void AL_APIENTRY alBufferSubSamplesSOFT(ALuint buffer, ALsizei offset, ALsizei samples, ALenum channels, ALenum type, const ALvoid *data) AL_API_NOEXCEPT; AL_API void AL_APIENTRY alBufferSubSamplesSOFT(ALuint buffer, ALsizei offset, ALsizei samples, ALenum channels, ALenum type, const ALvoid *data);
AL_API void AL_APIENTRY alGetBufferSamplesSOFT(ALuint buffer, ALsizei offset, ALsizei samples, ALenum channels, ALenum type, ALvoid *data) AL_API_NOEXCEPT; AL_API void AL_APIENTRY alGetBufferSamplesSOFT(ALuint buffer, ALsizei offset, ALsizei samples, ALenum channels, ALenum type, ALvoid *data);
AL_API ALboolean AL_APIENTRY alIsBufferFormatSupportedSOFT(ALenum format) AL_API_NOEXCEPT; AL_API ALboolean AL_APIENTRY alIsBufferFormatSupportedSOFT(ALenum format);
#endif #endif
#endif #endif
@ -305,13 +294,13 @@ AL_API ALboolean AL_APIENTRY alIsBufferFormatSupportedSOFT(ALenum format) AL_API
#define ALC_6POINT1_SOFT 0x1505 #define ALC_6POINT1_SOFT 0x1505
#define ALC_7POINT1_SOFT 0x1506 #define ALC_7POINT1_SOFT 0x1506
typedef ALCdevice* (ALC_APIENTRY*LPALCLOOPBACKOPENDEVICESOFT)(const ALCchar*) ALC_API_NOEXCEPT17; typedef ALCdevice* (ALC_APIENTRY*LPALCLOOPBACKOPENDEVICESOFT)(const ALCchar*);
typedef ALCboolean (ALC_APIENTRY*LPALCISRENDERFORMATSUPPORTEDSOFT)(ALCdevice*,ALCsizei,ALCenum,ALCenum) ALC_API_NOEXCEPT17; typedef ALCboolean (ALC_APIENTRY*LPALCISRENDERFORMATSUPPORTEDSOFT)(ALCdevice*,ALCsizei,ALCenum,ALCenum);
typedef void (ALC_APIENTRY*LPALCRENDERSAMPLESSOFT)(ALCdevice*,ALCvoid*,ALCsizei) ALC_API_NOEXCEPT17; typedef void (ALC_APIENTRY*LPALCRENDERSAMPLESSOFT)(ALCdevice*,ALCvoid*,ALCsizei);
#ifdef AL_ALEXT_PROTOTYPES #ifdef AL_ALEXT_PROTOTYPES
ALC_API ALCdevice* ALC_APIENTRY alcLoopbackOpenDeviceSOFT(const ALCchar *deviceName) AL_API_NOEXCEPT; ALC_API ALCdevice* ALC_APIENTRY alcLoopbackOpenDeviceSOFT(const ALCchar *deviceName);
ALC_API ALCboolean ALC_APIENTRY alcIsRenderFormatSupportedSOFT(ALCdevice *device, ALCsizei freq, ALCenum channels, ALCenum type) AL_API_NOEXCEPT; ALC_API ALCboolean ALC_APIENTRY alcIsRenderFormatSupportedSOFT(ALCdevice *device, ALCsizei freq, ALCenum channels, ALCenum type);
ALC_API void ALC_APIENTRY alcRenderSamplesSOFT(ALCdevice *device, ALCvoid *buffer, ALCsizei samples) AL_API_NOEXCEPT; ALC_API void ALC_APIENTRY alcRenderSamplesSOFT(ALCdevice *device, ALCvoid *buffer, ALCsizei samples);
#endif #endif
#endif #endif
@ -329,764 +318,38 @@ ALC_API void ALC_APIENTRY alcRenderSamplesSOFT(ALCdevice *device, ALCvoid *buffe
#define AL_SOFT_source_latency 1 #define AL_SOFT_source_latency 1
#define AL_SAMPLE_OFFSET_LATENCY_SOFT 0x1200 #define AL_SAMPLE_OFFSET_LATENCY_SOFT 0x1200
#define AL_SEC_OFFSET_LATENCY_SOFT 0x1201 #define AL_SEC_OFFSET_LATENCY_SOFT 0x1201
typedef _alsoft_int64_t ALint64SOFT; typedef int64_t ALint64SOFT;
typedef _alsoft_uint64_t ALuint64SOFT; typedef uint64_t ALuint64SOFT;
typedef void (AL_APIENTRY*LPALSOURCEDSOFT)(ALuint,ALenum,ALdouble) AL_API_NOEXCEPT17; typedef void (AL_APIENTRY*LPALSOURCEDSOFT)(ALuint,ALenum,ALdouble);
typedef void (AL_APIENTRY*LPALSOURCE3DSOFT)(ALuint,ALenum,ALdouble,ALdouble,ALdouble) AL_API_NOEXCEPT17; typedef void (AL_APIENTRY*LPALSOURCE3DSOFT)(ALuint,ALenum,ALdouble,ALdouble,ALdouble);
typedef void (AL_APIENTRY*LPALSOURCEDVSOFT)(ALuint,ALenum,const ALdouble*) AL_API_NOEXCEPT17; typedef void (AL_APIENTRY*LPALSOURCEDVSOFT)(ALuint,ALenum,const ALdouble*);
typedef void (AL_APIENTRY*LPALGETSOURCEDSOFT)(ALuint,ALenum,ALdouble*) AL_API_NOEXCEPT17; typedef void (AL_APIENTRY*LPALGETSOURCEDSOFT)(ALuint,ALenum,ALdouble*);
typedef void (AL_APIENTRY*LPALGETSOURCE3DSOFT)(ALuint,ALenum,ALdouble*,ALdouble*,ALdouble*) AL_API_NOEXCEPT17; typedef void (AL_APIENTRY*LPALGETSOURCE3DSOFT)(ALuint,ALenum,ALdouble*,ALdouble*,ALdouble*);
typedef void (AL_APIENTRY*LPALGETSOURCEDVSOFT)(ALuint,ALenum,ALdouble*) AL_API_NOEXCEPT17; typedef void (AL_APIENTRY*LPALGETSOURCEDVSOFT)(ALuint,ALenum,ALdouble*);
typedef void (AL_APIENTRY*LPALSOURCEI64SOFT)(ALuint,ALenum,ALint64SOFT) AL_API_NOEXCEPT17; typedef void (AL_APIENTRY*LPALSOURCEI64SOFT)(ALuint,ALenum,ALint64SOFT);
typedef void (AL_APIENTRY*LPALSOURCE3I64SOFT)(ALuint,ALenum,ALint64SOFT,ALint64SOFT,ALint64SOFT) AL_API_NOEXCEPT17; typedef void (AL_APIENTRY*LPALSOURCE3I64SOFT)(ALuint,ALenum,ALint64SOFT,ALint64SOFT,ALint64SOFT);
typedef void (AL_APIENTRY*LPALSOURCEI64VSOFT)(ALuint,ALenum,const ALint64SOFT*) AL_API_NOEXCEPT17; typedef void (AL_APIENTRY*LPALSOURCEI64VSOFT)(ALuint,ALenum,const ALint64SOFT*);
typedef void (AL_APIENTRY*LPALGETSOURCEI64SOFT)(ALuint,ALenum,ALint64SOFT*) AL_API_NOEXCEPT17; typedef void (AL_APIENTRY*LPALGETSOURCEI64SOFT)(ALuint,ALenum,ALint64SOFT*);
typedef void (AL_APIENTRY*LPALGETSOURCE3I64SOFT)(ALuint,ALenum,ALint64SOFT*,ALint64SOFT*,ALint64SOFT*) AL_API_NOEXCEPT17; typedef void (AL_APIENTRY*LPALGETSOURCE3I64SOFT)(ALuint,ALenum,ALint64SOFT*,ALint64SOFT*,ALint64SOFT*);
typedef void (AL_APIENTRY*LPALGETSOURCEI64VSOFT)(ALuint,ALenum,ALint64SOFT*) AL_API_NOEXCEPT17; typedef void (AL_APIENTRY*LPALGETSOURCEI64VSOFT)(ALuint,ALenum,ALint64SOFT*);
#ifdef AL_ALEXT_PROTOTYPES #ifdef AL_ALEXT_PROTOTYPES
AL_API void AL_APIENTRY alSourcedSOFT(ALuint source, ALenum param, ALdouble value) AL_API_NOEXCEPT; AL_API void AL_APIENTRY alSourcedSOFT(ALuint source, ALenum param, ALdouble value);
AL_API void AL_APIENTRY alSource3dSOFT(ALuint source, ALenum param, ALdouble value1, ALdouble value2, ALdouble value3) AL_API_NOEXCEPT; AL_API void AL_APIENTRY alSource3dSOFT(ALuint source, ALenum param, ALdouble value1, ALdouble value2, ALdouble value3);
AL_API void AL_APIENTRY alSourcedvSOFT(ALuint source, ALenum param, const ALdouble *values) AL_API_NOEXCEPT; AL_API void AL_APIENTRY alSourcedvSOFT(ALuint source, ALenum param, const ALdouble *values);
AL_API void AL_APIENTRY alGetSourcedSOFT(ALuint source, ALenum param, ALdouble *value) AL_API_NOEXCEPT; AL_API void AL_APIENTRY alGetSourcedSOFT(ALuint source, ALenum param, ALdouble *value);
AL_API void AL_APIENTRY alGetSource3dSOFT(ALuint source, ALenum param, ALdouble *value1, ALdouble *value2, ALdouble *value3) AL_API_NOEXCEPT; AL_API void AL_APIENTRY alGetSource3dSOFT(ALuint source, ALenum param, ALdouble *value1, ALdouble *value2, ALdouble *value3);
AL_API void AL_APIENTRY alGetSourcedvSOFT(ALuint source, ALenum param, ALdouble *values) AL_API_NOEXCEPT; AL_API void AL_APIENTRY alGetSourcedvSOFT(ALuint source, ALenum param, ALdouble *values);
AL_API void AL_APIENTRY alSourcei64SOFT(ALuint source, ALenum param, ALint64SOFT value) AL_API_NOEXCEPT; AL_API void AL_APIENTRY alSourcei64SOFT(ALuint source, ALenum param, ALint64SOFT value);
AL_API void AL_APIENTRY alSource3i64SOFT(ALuint source, ALenum param, ALint64SOFT value1, ALint64SOFT value2, ALint64SOFT value3) AL_API_NOEXCEPT; AL_API void AL_APIENTRY alSource3i64SOFT(ALuint source, ALenum param, ALint64SOFT value1, ALint64SOFT value2, ALint64SOFT value3);
AL_API void AL_APIENTRY alSourcei64vSOFT(ALuint source, ALenum param, const ALint64SOFT *values) AL_API_NOEXCEPT; AL_API void AL_APIENTRY alSourcei64vSOFT(ALuint source, ALenum param, const ALint64SOFT *values);
AL_API void AL_APIENTRY alGetSourcei64SOFT(ALuint source, ALenum param, ALint64SOFT *value) AL_API_NOEXCEPT; AL_API void AL_APIENTRY alGetSourcei64SOFT(ALuint source, ALenum param, ALint64SOFT *value);
AL_API void AL_APIENTRY alGetSource3i64SOFT(ALuint source, ALenum param, ALint64SOFT *value1, ALint64SOFT *value2, ALint64SOFT *value3) AL_API_NOEXCEPT; AL_API void AL_APIENTRY alGetSource3i64SOFT(ALuint source, ALenum param, ALint64SOFT *value1, ALint64SOFT *value2, ALint64SOFT *value3);
AL_API void AL_APIENTRY alGetSourcei64vSOFT(ALuint source, ALenum param, ALint64SOFT *values) AL_API_NOEXCEPT; AL_API void AL_APIENTRY alGetSourcei64vSOFT(ALuint source, ALenum param, ALint64SOFT *values);
#endif #endif
#endif #endif
#ifndef ALC_EXT_DEFAULT_FILTER_ORDER
#define ALC_EXT_DEFAULT_FILTER_ORDER 1
#define ALC_DEFAULT_FILTER_ORDER 0x1100
#endif
#ifndef AL_SOFT_deferred_updates
#define AL_SOFT_deferred_updates 1
#define AL_DEFERRED_UPDATES_SOFT 0xC002
typedef void (AL_APIENTRY*LPALDEFERUPDATESSOFT)(void) AL_API_NOEXCEPT17;
typedef void (AL_APIENTRY*LPALPROCESSUPDATESSOFT)(void) AL_API_NOEXCEPT17;
#ifdef AL_ALEXT_PROTOTYPES
AL_API void AL_APIENTRY alDeferUpdatesSOFT(void) AL_API_NOEXCEPT;
AL_API void AL_APIENTRY alProcessUpdatesSOFT(void) AL_API_NOEXCEPT;
#endif
#endif
#ifndef AL_SOFT_block_alignment
#define AL_SOFT_block_alignment 1
#define AL_UNPACK_BLOCK_ALIGNMENT_SOFT 0x200C
#define AL_PACK_BLOCK_ALIGNMENT_SOFT 0x200D
#endif
#ifndef AL_SOFT_MSADPCM
#define AL_SOFT_MSADPCM 1
#define AL_FORMAT_MONO_MSADPCM_SOFT 0x1302
#define AL_FORMAT_STEREO_MSADPCM_SOFT 0x1303
#endif
#ifndef AL_SOFT_source_length
#define AL_SOFT_source_length 1
/*#define AL_BYTE_LENGTH_SOFT 0x2009*/
/*#define AL_SAMPLE_LENGTH_SOFT 0x200A*/
/*#define AL_SEC_LENGTH_SOFT 0x200B*/
#endif
#ifndef AL_SOFT_buffer_length_query
#define AL_SOFT_buffer_length_query 1
/*#define AL_BYTE_LENGTH_SOFT 0x2009*/
/*#define AL_SAMPLE_LENGTH_SOFT 0x200A*/
/*#define AL_SEC_LENGTH_SOFT 0x200B*/
#endif
#ifndef ALC_SOFT_pause_device
#define ALC_SOFT_pause_device 1
typedef void (ALC_APIENTRY*LPALCDEVICEPAUSESOFT)(ALCdevice *device) ALC_API_NOEXCEPT17;
typedef void (ALC_APIENTRY*LPALCDEVICERESUMESOFT)(ALCdevice *device) ALC_API_NOEXCEPT17;
#ifdef AL_ALEXT_PROTOTYPES
ALC_API void ALC_APIENTRY alcDevicePauseSOFT(ALCdevice *device) ALC_API_NOEXCEPT;
ALC_API void ALC_APIENTRY alcDeviceResumeSOFT(ALCdevice *device) ALC_API_NOEXCEPT;
#endif
#endif
#ifndef AL_EXT_BFORMAT
#define AL_EXT_BFORMAT 1
/* Provides support for B-Format ambisonic buffers (first-order, FuMa scaling
* and layout).
*
* BFORMAT2D_8: Unsigned 8-bit, 3-channel non-periphonic (WXY).
* BFORMAT2D_16: Signed 16-bit, 3-channel non-periphonic (WXY).
* BFORMAT2D_FLOAT32: 32-bit float, 3-channel non-periphonic (WXY).
* BFORMAT3D_8: Unsigned 8-bit, 4-channel periphonic (WXYZ).
* BFORMAT3D_16: Signed 16-bit, 4-channel periphonic (WXYZ).
* BFORMAT3D_FLOAT32: 32-bit float, 4-channel periphonic (WXYZ).
*/
#define AL_FORMAT_BFORMAT2D_8 0x20021
#define AL_FORMAT_BFORMAT2D_16 0x20022
#define AL_FORMAT_BFORMAT2D_FLOAT32 0x20023
#define AL_FORMAT_BFORMAT3D_8 0x20031
#define AL_FORMAT_BFORMAT3D_16 0x20032
#define AL_FORMAT_BFORMAT3D_FLOAT32 0x20033
#endif
#ifndef AL_EXT_MULAW_BFORMAT
#define AL_EXT_MULAW_BFORMAT 1
#define AL_FORMAT_BFORMAT2D_MULAW 0x10031
#define AL_FORMAT_BFORMAT3D_MULAW 0x10032
#endif
#ifndef ALC_SOFT_HRTF
#define ALC_SOFT_HRTF 1
#define ALC_HRTF_SOFT 0x1992
#define ALC_DONT_CARE_SOFT 0x0002
#define ALC_HRTF_STATUS_SOFT 0x1993
#define ALC_HRTF_DISABLED_SOFT 0x0000
#define ALC_HRTF_ENABLED_SOFT 0x0001
#define ALC_HRTF_DENIED_SOFT 0x0002
#define ALC_HRTF_REQUIRED_SOFT 0x0003
#define ALC_HRTF_HEADPHONES_DETECTED_SOFT 0x0004
#define ALC_HRTF_UNSUPPORTED_FORMAT_SOFT 0x0005
#define ALC_NUM_HRTF_SPECIFIERS_SOFT 0x1994
#define ALC_HRTF_SPECIFIER_SOFT 0x1995
#define ALC_HRTF_ID_SOFT 0x1996
typedef const ALCchar* (ALC_APIENTRY*LPALCGETSTRINGISOFT)(ALCdevice *device, ALCenum paramName, ALCsizei index) ALC_API_NOEXCEPT17;
typedef ALCboolean (ALC_APIENTRY*LPALCRESETDEVICESOFT)(ALCdevice *device, const ALCint *attribs) ALC_API_NOEXCEPT17;
#ifdef AL_ALEXT_PROTOTYPES
ALC_API const ALCchar* ALC_APIENTRY alcGetStringiSOFT(ALCdevice *device, ALCenum paramName, ALCsizei index) ALC_API_NOEXCEPT;
ALC_API ALCboolean ALC_APIENTRY alcResetDeviceSOFT(ALCdevice *device, const ALCint *attribs) ALC_API_NOEXCEPT;
#endif
#endif
#ifndef AL_SOFT_gain_clamp_ex
#define AL_SOFT_gain_clamp_ex 1
#define AL_GAIN_LIMIT_SOFT 0x200E
#endif
#ifndef AL_SOFT_source_resampler
#define AL_SOFT_source_resampler
#define AL_NUM_RESAMPLERS_SOFT 0x1210
#define AL_DEFAULT_RESAMPLER_SOFT 0x1211
#define AL_SOURCE_RESAMPLER_SOFT 0x1212
#define AL_RESAMPLER_NAME_SOFT 0x1213
typedef const ALchar* (AL_APIENTRY*LPALGETSTRINGISOFT)(ALenum pname, ALsizei index) AL_API_NOEXCEPT17;
#ifdef AL_ALEXT_PROTOTYPES
AL_API const ALchar* AL_APIENTRY alGetStringiSOFT(ALenum pname, ALsizei index) AL_API_NOEXCEPT;
#endif
#endif
#ifndef AL_SOFT_source_spatialize
#define AL_SOFT_source_spatialize
#define AL_SOURCE_SPATIALIZE_SOFT 0x1214
#define AL_AUTO_SOFT 0x0002
#endif
#ifndef ALC_SOFT_output_limiter
#define ALC_SOFT_output_limiter
#define ALC_OUTPUT_LIMITER_SOFT 0x199A
#endif
#ifndef ALC_SOFT_device_clock
#define ALC_SOFT_device_clock 1
typedef _alsoft_int64_t ALCint64SOFT;
typedef _alsoft_uint64_t ALCuint64SOFT;
#define ALC_DEVICE_CLOCK_SOFT 0x1600
#define ALC_DEVICE_LATENCY_SOFT 0x1601
#define ALC_DEVICE_CLOCK_LATENCY_SOFT 0x1602
#define AL_SAMPLE_OFFSET_CLOCK_SOFT 0x1202
#define AL_SEC_OFFSET_CLOCK_SOFT 0x1203
typedef void (ALC_APIENTRY*LPALCGETINTEGER64VSOFT)(ALCdevice *device, ALCenum pname, ALsizei size, ALCint64SOFT *values) ALC_API_NOEXCEPT17;
#ifdef AL_ALEXT_PROTOTYPES
ALC_API void ALC_APIENTRY alcGetInteger64vSOFT(ALCdevice *device, ALCenum pname, ALsizei size, ALCint64SOFT *values) ALC_API_NOEXCEPT;
#endif
#endif
#ifndef AL_SOFT_direct_channels_remix
#define AL_SOFT_direct_channels_remix 1
#define AL_DROP_UNMATCHED_SOFT 0x0001
#define AL_REMIX_UNMATCHED_SOFT 0x0002
#endif
#ifndef AL_SOFT_bformat_ex
#define AL_SOFT_bformat_ex 1
#define AL_AMBISONIC_LAYOUT_SOFT 0x1997
#define AL_AMBISONIC_SCALING_SOFT 0x1998
/* Ambisonic layouts */
#define AL_FUMA_SOFT 0x0000
#define AL_ACN_SOFT 0x0001
/* Ambisonic scalings (normalization) */
/*#define AL_FUMA_SOFT*/
#define AL_SN3D_SOFT 0x0001
#define AL_N3D_SOFT 0x0002
#endif
#ifndef ALC_SOFT_loopback_bformat
#define ALC_SOFT_loopback_bformat 1
#define ALC_AMBISONIC_LAYOUT_SOFT 0x1997
#define ALC_AMBISONIC_SCALING_SOFT 0x1998
#define ALC_AMBISONIC_ORDER_SOFT 0x1999
#define ALC_MAX_AMBISONIC_ORDER_SOFT 0x199B
#define ALC_BFORMAT3D_SOFT 0x1507
/* Ambisonic layouts */
#define ALC_FUMA_SOFT 0x0000
#define ALC_ACN_SOFT 0x0001
/* Ambisonic scalings (normalization) */
/*#define ALC_FUMA_SOFT*/
#define ALC_SN3D_SOFT 0x0001
#define ALC_N3D_SOFT 0x0002
#endif
#ifndef AL_SOFT_effect_target
#define AL_SOFT_effect_target
#define AL_EFFECTSLOT_TARGET_SOFT 0x199C
#endif
#ifndef AL_SOFT_events
#define AL_SOFT_events 1
#define AL_EVENT_CALLBACK_FUNCTION_SOFT 0x19A2
#define AL_EVENT_CALLBACK_USER_PARAM_SOFT 0x19A3
#define AL_EVENT_TYPE_BUFFER_COMPLETED_SOFT 0x19A4
#define AL_EVENT_TYPE_SOURCE_STATE_CHANGED_SOFT 0x19A5
#define AL_EVENT_TYPE_DISCONNECTED_SOFT 0x19A6
typedef void (AL_APIENTRY*ALEVENTPROCSOFT)(ALenum eventType, ALuint object, ALuint param,
ALsizei length, const ALchar *message, void *userParam) AL_API_NOEXCEPT17;
typedef void (AL_APIENTRY*LPALEVENTCONTROLSOFT)(ALsizei count, const ALenum *types, ALboolean enable) AL_API_NOEXCEPT17;
typedef void (AL_APIENTRY*LPALEVENTCALLBACKSOFT)(ALEVENTPROCSOFT callback, void *userParam) AL_API_NOEXCEPT17;
typedef void* (AL_APIENTRY*LPALGETPOINTERSOFT)(ALenum pname) AL_API_NOEXCEPT17;
typedef void (AL_APIENTRY*LPALGETPOINTERVSOFT)(ALenum pname, void **values) AL_API_NOEXCEPT17;
#ifdef AL_ALEXT_PROTOTYPES
AL_API void AL_APIENTRY alEventControlSOFT(ALsizei count, const ALenum *types, ALboolean enable) AL_API_NOEXCEPT;
AL_API void AL_APIENTRY alEventCallbackSOFT(ALEVENTPROCSOFT callback, void *userParam) AL_API_NOEXCEPT;
AL_API void* AL_APIENTRY alGetPointerSOFT(ALenum pname) AL_API_NOEXCEPT;
AL_API void AL_APIENTRY alGetPointervSOFT(ALenum pname, void **values) AL_API_NOEXCEPT;
#endif
#endif
#ifndef ALC_SOFT_reopen_device
#define ALC_SOFT_reopen_device
typedef ALCboolean (ALC_APIENTRY*LPALCREOPENDEVICESOFT)(ALCdevice *device,
const ALCchar *deviceName, const ALCint *attribs) ALC_API_NOEXCEPT17;
#ifdef AL_ALEXT_PROTOTYPES
ALCboolean ALC_APIENTRY alcReopenDeviceSOFT(ALCdevice *device, const ALCchar *deviceName,
const ALCint *attribs) ALC_API_NOEXCEPT;
#endif
#endif
#ifndef AL_SOFT_callback_buffer
#define AL_SOFT_callback_buffer
#define AL_BUFFER_CALLBACK_FUNCTION_SOFT 0x19A0
#define AL_BUFFER_CALLBACK_USER_PARAM_SOFT 0x19A1
typedef ALsizei (AL_APIENTRY*ALBUFFERCALLBACKTYPESOFT)(ALvoid *userptr, ALvoid *sampledata, ALsizei numbytes) AL_API_NOEXCEPT17;
typedef void (AL_APIENTRY*LPALBUFFERCALLBACKSOFT)(ALuint buffer, ALenum format, ALsizei freq, ALBUFFERCALLBACKTYPESOFT callback, ALvoid *userptr) AL_API_NOEXCEPT17;
typedef void (AL_APIENTRY*LPALGETBUFFERPTRSOFT)(ALuint buffer, ALenum param, ALvoid **value) AL_API_NOEXCEPT17;
typedef void (AL_APIENTRY*LPALGETBUFFER3PTRSOFT)(ALuint buffer, ALenum param, ALvoid **value1, ALvoid **value2, ALvoid **value3) AL_API_NOEXCEPT17;
typedef void (AL_APIENTRY*LPALGETBUFFERPTRVSOFT)(ALuint buffer, ALenum param, ALvoid **values) AL_API_NOEXCEPT17;
#ifdef AL_ALEXT_PROTOTYPES
AL_API void AL_APIENTRY alBufferCallbackSOFT(ALuint buffer, ALenum format, ALsizei freq, ALBUFFERCALLBACKTYPESOFT callback, ALvoid *userptr) AL_API_NOEXCEPT;
AL_API void AL_APIENTRY alGetBufferPtrSOFT(ALuint buffer, ALenum param, ALvoid **ptr) AL_API_NOEXCEPT;
AL_API void AL_APIENTRY alGetBuffer3PtrSOFT(ALuint buffer, ALenum param, ALvoid **ptr0, ALvoid **ptr1, ALvoid **ptr2) AL_API_NOEXCEPT;
AL_API void AL_APIENTRY alGetBufferPtrvSOFT(ALuint buffer, ALenum param, ALvoid **ptr) AL_API_NOEXCEPT;
#endif
#endif
#ifndef AL_SOFT_UHJ
#define AL_SOFT_UHJ
#define AL_FORMAT_UHJ2CHN8_SOFT 0x19A2
#define AL_FORMAT_UHJ2CHN16_SOFT 0x19A3
#define AL_FORMAT_UHJ2CHN_FLOAT32_SOFT 0x19A4
#define AL_FORMAT_UHJ3CHN8_SOFT 0x19A5
#define AL_FORMAT_UHJ3CHN16_SOFT 0x19A6
#define AL_FORMAT_UHJ3CHN_FLOAT32_SOFT 0x19A7
#define AL_FORMAT_UHJ4CHN8_SOFT 0x19A8
#define AL_FORMAT_UHJ4CHN16_SOFT 0x19A9
#define AL_FORMAT_UHJ4CHN_FLOAT32_SOFT 0x19AA
#define AL_STEREO_MODE_SOFT 0x19B0
#define AL_NORMAL_SOFT 0x0000
#define AL_SUPER_STEREO_SOFT 0x0001
#define AL_SUPER_STEREO_WIDTH_SOFT 0x19B1
#endif
#ifndef AL_SOFT_UHJ_ex
#define AL_SOFT_UHJ_ex
#define AL_FORMAT_UHJ2CHN_MULAW_SOFT 0x19B3
#define AL_FORMAT_UHJ2CHN_ALAW_SOFT 0x19B4
#define AL_FORMAT_UHJ2CHN_IMA4_SOFT 0x19B5
#define AL_FORMAT_UHJ2CHN_MSADPCM_SOFT 0x19B6
#define AL_FORMAT_UHJ3CHN_MULAW_SOFT 0x19B7
#define AL_FORMAT_UHJ3CHN_ALAW_SOFT 0x19B8
#define AL_FORMAT_UHJ4CHN_MULAW_SOFT 0x19B9
#define AL_FORMAT_UHJ4CHN_ALAW_SOFT 0x19BA
#endif
#ifndef ALC_SOFT_output_mode
#define ALC_SOFT_output_mode
#define ALC_OUTPUT_MODE_SOFT 0x19AC
#define ALC_ANY_SOFT 0x19AD
/*#define ALC_MONO_SOFT 0x1500*/
/*#define ALC_STEREO_SOFT 0x1501*/
#define ALC_STEREO_BASIC_SOFT 0x19AE
#define ALC_STEREO_UHJ_SOFT 0x19AF
#define ALC_STEREO_HRTF_SOFT 0x19B2
/*#define ALC_QUAD_SOFT 0x1503*/
#define ALC_SURROUND_5_1_SOFT 0x1504
#define ALC_SURROUND_6_1_SOFT 0x1505
#define ALC_SURROUND_7_1_SOFT 0x1506
#endif
#ifndef AL_SOFT_source_start_delay
#define AL_SOFT_source_start_delay
typedef void (AL_APIENTRY*LPALSOURCEPLAYATTIMESOFT)(ALuint source, ALint64SOFT start_time) AL_API_NOEXCEPT17;
typedef void (AL_APIENTRY*LPALSOURCEPLAYATTIMEVSOFT)(ALsizei n, const ALuint *sources, ALint64SOFT start_time) AL_API_NOEXCEPT17;
#ifdef AL_ALEXT_PROTOTYPES
void AL_APIENTRY alSourcePlayAtTimeSOFT(ALuint source, ALint64SOFT start_time) AL_API_NOEXCEPT;
void AL_APIENTRY alSourcePlayAtTimevSOFT(ALsizei n, const ALuint *sources, ALint64SOFT start_time) AL_API_NOEXCEPT;
#endif
#endif
#ifndef ALC_EXT_debug
#define ALC_EXT_debug
#define ALC_CONTEXT_FLAGS_EXT 0x19CF
#define ALC_CONTEXT_DEBUG_BIT_EXT 0x0001
#endif
#ifndef AL_EXT_debug
#define AL_EXT_debug
#define AL_DONT_CARE_EXT 0x0002
#define AL_DEBUG_OUTPUT_EXT 0x19B2
#define AL_DEBUG_CALLBACK_FUNCTION_EXT 0x19B3
#define AL_DEBUG_CALLBACK_USER_PARAM_EXT 0x19B4
#define AL_DEBUG_SOURCE_API_EXT 0x19B5
#define AL_DEBUG_SOURCE_AUDIO_SYSTEM_EXT 0x19B6
#define AL_DEBUG_SOURCE_THIRD_PARTY_EXT 0x19B7
#define AL_DEBUG_SOURCE_APPLICATION_EXT 0x19B8
#define AL_DEBUG_SOURCE_OTHER_EXT 0x19B9
#define AL_DEBUG_TYPE_ERROR_EXT 0x19BA
#define AL_DEBUG_TYPE_DEPRECATED_BEHAVIOR_EXT 0x19BB
#define AL_DEBUG_TYPE_UNDEFINED_BEHAVIOR_EXT 0x19BC
#define AL_DEBUG_TYPE_PORTABILITY_EXT 0x19BD
#define AL_DEBUG_TYPE_PERFORMANCE_EXT 0x19BE
#define AL_DEBUG_TYPE_MARKER_EXT 0x19BF
#define AL_DEBUG_TYPE_PUSH_GROUP_EXT 0x19C0
#define AL_DEBUG_TYPE_POP_GROUP_EXT 0x19C1
#define AL_DEBUG_TYPE_OTHER_EXT 0x19C2
#define AL_DEBUG_SEVERITY_HIGH_EXT 0x19C3
#define AL_DEBUG_SEVERITY_MEDIUM_EXT 0x19C4
#define AL_DEBUG_SEVERITY_LOW_EXT 0x19C5
#define AL_DEBUG_SEVERITY_NOTIFICATION_EXT 0x19C6
#define AL_DEBUG_LOGGED_MESSAGES_EXT 0x19C7
#define AL_DEBUG_NEXT_LOGGED_MESSAGE_LENGTH_EXT 0x19C8
#define AL_MAX_DEBUG_MESSAGE_LENGTH_EXT 0x19C9
#define AL_MAX_DEBUG_LOGGED_MESSAGES_EXT 0x19CA
#define AL_MAX_DEBUG_GROUP_STACK_DEPTH_EXT 0x19CB
#define AL_MAX_LABEL_LENGTH_EXT 0x19CC
#define AL_STACK_OVERFLOW_EXT 0x19CD
#define AL_STACK_UNDERFLOW_EXT 0x19CE
#define AL_CONTEXT_FLAGS_EXT 0x19CF
#define AL_BUFFER_EXT 0x1009 /* Same as AL_BUFFER */
#define AL_SOURCE_EXT 0x19D0
#define AL_FILTER_EXT 0x19D1
#define AL_EFFECT_EXT 0x19D2
#define AL_AUXILIARY_EFFECT_SLOT_EXT 0x19D3
typedef void (AL_APIENTRY*ALDEBUGPROCEXT)(ALenum source, ALenum type, ALuint id, ALenum severity, ALsizei length, const ALchar *message, void *userParam) AL_API_NOEXCEPT17;
typedef void (AL_APIENTRY*LPALDEBUGMESSAGECALLBACKEXT)(ALDEBUGPROCEXT callback, void *userParam) AL_API_NOEXCEPT17;
typedef void (AL_APIENTRY*LPALDEBUGMESSAGEINSERTEXT)(ALenum source, ALenum type, ALuint id, ALenum severity, ALsizei length, const ALchar *message) AL_API_NOEXCEPT17;
typedef void (AL_APIENTRY*LPALDEBUGMESSAGECONTROLEXT)(ALenum source, ALenum type, ALenum severity, ALsizei count, const ALuint *ids, ALboolean enable) AL_API_NOEXCEPT17;
typedef void (AL_APIENTRY*LPALPUSHDEBUGGROUPEXT)(ALenum source, ALuint id, ALsizei length, const ALchar *message) AL_API_NOEXCEPT17;
typedef void (AL_APIENTRY*LPALPOPDEBUGGROUPEXT)(void) AL_API_NOEXCEPT17;
typedef ALuint (AL_APIENTRY*LPALGETDEBUGMESSAGELOGEXT)(ALuint count, ALsizei logBufSize, ALenum *sources, ALenum *types, ALuint *ids, ALenum *severities, ALsizei *lengths, ALchar *logBuf) AL_API_NOEXCEPT17;
typedef void (AL_APIENTRY*LPALOBJECTLABELEXT)(ALenum identifier, ALuint name, ALsizei length, const ALchar *label) AL_API_NOEXCEPT17;
typedef void (AL_APIENTRY*LPALGETOBJECTLABELEXT)(ALenum identifier, ALuint name, ALsizei bufSize, ALsizei *length, ALchar *label) AL_API_NOEXCEPT17;
typedef void* (AL_APIENTRY*LPALGETPOINTEREXT)(ALenum pname) AL_API_NOEXCEPT17;
typedef void (AL_APIENTRY*LPALGETPOINTERVEXT)(ALenum pname, void **values) AL_API_NOEXCEPT17;
#ifdef AL_ALEXT_PROTOTYPES
void AL_APIENTRY alDebugMessageCallbackEXT(ALDEBUGPROCEXT callback, void *userParam) AL_API_NOEXCEPT;
void AL_APIENTRY alDebugMessageInsertEXT(ALenum source, ALenum type, ALuint id, ALenum severity, ALsizei length, const ALchar *message) AL_API_NOEXCEPT;
void AL_APIENTRY alDebugMessageControlEXT(ALenum source, ALenum type, ALenum severity, ALsizei count, const ALuint *ids, ALboolean enable) AL_API_NOEXCEPT;
void AL_APIENTRY alPushDebugGroupEXT(ALenum source, ALuint id, ALsizei length, const ALchar *message) AL_API_NOEXCEPT;
void AL_APIENTRY alPopDebugGroupEXT(void) AL_API_NOEXCEPT;
ALuint AL_APIENTRY alGetDebugMessageLogEXT(ALuint count, ALsizei logBufSize, ALenum *sources, ALenum *types, ALuint *ids, ALenum *severities, ALsizei *lengths, ALchar *logBuf) AL_API_NOEXCEPT;
void AL_APIENTRY alObjectLabelEXT(ALenum identifier, ALuint name, ALsizei length, const ALchar *label) AL_API_NOEXCEPT;
void AL_APIENTRY alGetObjectLabelEXT(ALenum identifier, ALuint name, ALsizei bufSize, ALsizei *length, ALchar *label) AL_API_NOEXCEPT;
void* AL_APIENTRY alGetPointerEXT(ALenum pname) AL_API_NOEXCEPT;
void AL_APIENTRY alGetPointervEXT(ALenum pname, void **values) AL_API_NOEXCEPT;
#endif
#endif
#ifndef ALC_SOFT_system_events
#define ALC_SOFT_system_events
#define ALC_PLAYBACK_DEVICE_SOFT 0x19D4
#define ALC_CAPTURE_DEVICE_SOFT 0x19D5
#define ALC_EVENT_TYPE_DEFAULT_DEVICE_CHANGED_SOFT 0x19D6
#define ALC_EVENT_TYPE_DEVICE_ADDED_SOFT 0x19D7
#define ALC_EVENT_TYPE_DEVICE_REMOVED_SOFT 0x19D8
#define ALC_EVENT_SUPPORTED_SOFT 0x19D9
#define ALC_EVENT_NOT_SUPPORTED_SOFT 0x19DA
typedef void (ALC_APIENTRY*ALCEVENTPROCTYPESOFT)(ALCenum eventType, ALCenum deviceType,
ALCdevice *device, ALCsizei length, const ALCchar *message, void *userParam) ALC_API_NOEXCEPT17;
typedef ALCenum (ALC_APIENTRY*LPALCEVENTISSUPPORTEDSOFT)(ALCenum eventType, ALCenum deviceType) ALC_API_NOEXCEPT17;
typedef ALCboolean (ALC_APIENTRY*LPALCEVENTCONTROLSOFT)(ALCsizei count, const ALCenum *events, ALCboolean enable) ALC_API_NOEXCEPT17;
typedef void (ALC_APIENTRY*LPALCEVENTCALLBACKSOFT)(ALCEVENTPROCTYPESOFT callback, void *userParam) ALC_API_NOEXCEPT17;
#ifdef AL_ALEXT_PROTOTYPES
ALCenum ALC_APIENTRY alcEventIsSupportedSOFT(ALCenum eventType, ALCenum deviceType) ALC_API_NOEXCEPT;
ALCboolean ALC_APIENTRY alcEventControlSOFT(ALCsizei count, const ALCenum *events, ALCboolean enable) ALC_API_NOEXCEPT;
void ALC_APIENTRY alcEventCallbackSOFT(ALCEVENTPROCTYPESOFT callback, void *userParam) ALC_API_NOEXCEPT;
#endif
#endif
#ifndef AL_EXT_direct_context
#define AL_EXT_direct_context
typedef ALCvoid* (ALC_APIENTRY *LPALCGETPROCADDRESS2)(ALCdevice *device, const ALCchar *funcname) AL_API_NOEXCEPT17;
typedef void (AL_APIENTRY *LPALENABLEDIRECT)(ALCcontext *context, ALenum capability) AL_API_NOEXCEPT17;
typedef void (AL_APIENTRY *LPALDISABLEDIRECT)(ALCcontext *context, ALenum capability) AL_API_NOEXCEPT17;
typedef ALboolean (AL_APIENTRY *LPALISENABLEDDIRECT)(ALCcontext *context, ALenum capability) AL_API_NOEXCEPT17;
typedef void (AL_APIENTRY *LPALDOPPLERFACTORDIRECT)(ALCcontext *context, ALfloat value) AL_API_NOEXCEPT17;
typedef void (AL_APIENTRY *LPALSPEEDOFSOUNDDIRECT)(ALCcontext *context, ALfloat value) AL_API_NOEXCEPT17;
typedef void (AL_APIENTRY *LPALDISTANCEMODELDIRECT)(ALCcontext *context, ALenum distanceModel) AL_API_NOEXCEPT17;
typedef const ALchar* (AL_APIENTRY *LPALGETSTRINGDIRECT)(ALCcontext *context, ALenum param) AL_API_NOEXCEPT17;
typedef void (AL_APIENTRY *LPALGETBOOLEANVDIRECT)(ALCcontext *context, ALenum param, ALboolean *values) AL_API_NOEXCEPT17;
typedef void (AL_APIENTRY *LPALGETINTEGERVDIRECT)(ALCcontext *context, ALenum param, ALint *values) AL_API_NOEXCEPT17;
typedef void (AL_APIENTRY *LPALGETFLOATVDIRECT)(ALCcontext *context, ALenum param, ALfloat *values) AL_API_NOEXCEPT17;
typedef void (AL_APIENTRY *LPALGETDOUBLEVDIRECT)(ALCcontext *context, ALenum param, ALdouble *values) AL_API_NOEXCEPT17;
typedef ALboolean (AL_APIENTRY *LPALGETBOOLEANDIRECT)(ALCcontext *context, ALenum param) AL_API_NOEXCEPT17;
typedef ALint (AL_APIENTRY *LPALGETINTEGERDIRECT)(ALCcontext *context, ALenum param) AL_API_NOEXCEPT17;
typedef ALfloat (AL_APIENTRY *LPALGETFLOATDIRECT)(ALCcontext *context, ALenum param) AL_API_NOEXCEPT17;
typedef ALdouble (AL_APIENTRY *LPALGETDOUBLEDIRECT)(ALCcontext *context, ALenum param) AL_API_NOEXCEPT17;
typedef ALenum (AL_APIENTRY *LPALGETERRORDIRECT)(ALCcontext *context) AL_API_NOEXCEPT17;
typedef ALboolean (AL_APIENTRY *LPALISEXTENSIONPRESENTDIRECT)(ALCcontext *context, const ALchar *extname) AL_API_NOEXCEPT17;
typedef void* (AL_APIENTRY *LPALGETPROCADDRESSDIRECT)(ALCcontext *context, const ALchar *fname) AL_API_NOEXCEPT17;
typedef ALenum (AL_APIENTRY *LPALGETENUMVALUEDIRECT)(ALCcontext *context, const ALchar *ename) AL_API_NOEXCEPT17;
typedef void (AL_APIENTRY *LPALLISTENERFDIRECT)(ALCcontext *context, ALenum param, ALfloat value) AL_API_NOEXCEPT17;
typedef void (AL_APIENTRY *LPALLISTENER3FDIRECT)(ALCcontext *context, ALenum param, ALfloat value1, ALfloat value2, ALfloat value3) AL_API_NOEXCEPT17;
typedef void (AL_APIENTRY *LPALLISTENERFVDIRECT)(ALCcontext *context, ALenum param, const ALfloat *values) AL_API_NOEXCEPT17;
typedef void (AL_APIENTRY *LPALLISTENERIDIRECT)(ALCcontext *context, ALenum param, ALint value) AL_API_NOEXCEPT17;
typedef void (AL_APIENTRY *LPALLISTENER3IDIRECT)(ALCcontext *context, ALenum param, ALint value1, ALint value2, ALint value3) AL_API_NOEXCEPT17;
typedef void (AL_APIENTRY *LPALLISTENERIVDIRECT)(ALCcontext *context, ALenum param, const ALint *values) AL_API_NOEXCEPT17;
typedef void (AL_APIENTRY *LPALGETLISTENERFDIRECT)(ALCcontext *context, ALenum param, ALfloat *value) AL_API_NOEXCEPT17;
typedef void (AL_APIENTRY *LPALGETLISTENER3FDIRECT)(ALCcontext *context, ALenum param, ALfloat *value1, ALfloat *value2, ALfloat *value3) AL_API_NOEXCEPT17;
typedef void (AL_APIENTRY *LPALGETLISTENERFVDIRECT)(ALCcontext *context, ALenum param, ALfloat *values) AL_API_NOEXCEPT17;
typedef void (AL_APIENTRY *LPALGETLISTENERIDIRECT)(ALCcontext *context, ALenum param, ALint *value) AL_API_NOEXCEPT17;
typedef void (AL_APIENTRY *LPALGETLISTENER3IDIRECT)(ALCcontext *context, ALenum param, ALint *value1, ALint *value2, ALint *value3) AL_API_NOEXCEPT17;
typedef void (AL_APIENTRY *LPALGETLISTENERIVDIRECT)(ALCcontext *context, ALenum param, ALint *values) AL_API_NOEXCEPT17;
typedef void (AL_APIENTRY *LPALGENSOURCESDIRECT)(ALCcontext *context, ALsizei n, ALuint *sources) AL_API_NOEXCEPT17;
typedef void (AL_APIENTRY *LPALDELETESOURCESDIRECT)(ALCcontext *context, ALsizei n, const ALuint *sources) AL_API_NOEXCEPT17;
typedef ALboolean (AL_APIENTRY *LPALISSOURCEDIRECT)(ALCcontext *context, ALuint source) AL_API_NOEXCEPT17;
typedef void (AL_APIENTRY *LPALSOURCEFDIRECT)(ALCcontext *context, ALuint source, ALenum param, ALfloat value) AL_API_NOEXCEPT17;
typedef void (AL_APIENTRY *LPALSOURCE3FDIRECT)(ALCcontext *context, ALuint source, ALenum param, ALfloat value1, ALfloat value2, ALfloat value3) AL_API_NOEXCEPT17;
typedef void (AL_APIENTRY *LPALSOURCEFVDIRECT)(ALCcontext *context, ALuint source, ALenum param, const ALfloat *values) AL_API_NOEXCEPT17;
typedef void (AL_APIENTRY *LPALSOURCEIDIRECT)(ALCcontext *context, ALuint source, ALenum param, ALint value) AL_API_NOEXCEPT17;
typedef void (AL_APIENTRY *LPALSOURCE3IDIRECT)(ALCcontext *context, ALuint source, ALenum param, ALint value1, ALint value2, ALint value3) AL_API_NOEXCEPT17;
typedef void (AL_APIENTRY *LPALSOURCEIVDIRECT)(ALCcontext *context, ALuint source, ALenum param, const ALint *values) AL_API_NOEXCEPT17;
typedef void (AL_APIENTRY *LPALGETSOURCEFDIRECT)(ALCcontext *context, ALuint source, ALenum param, ALfloat *value) AL_API_NOEXCEPT17;
typedef void (AL_APIENTRY *LPALGETSOURCE3FDIRECT)(ALCcontext *context, ALuint source, ALenum param, ALfloat *value1, ALfloat *value2, ALfloat *value3) AL_API_NOEXCEPT17;
typedef void (AL_APIENTRY *LPALGETSOURCEFVDIRECT)(ALCcontext *context, ALuint source, ALenum param, ALfloat *values) AL_API_NOEXCEPT17;
typedef void (AL_APIENTRY *LPALGETSOURCEIDIRECT)(ALCcontext *context, ALuint source, ALenum param, ALint *value) AL_API_NOEXCEPT17;
typedef void (AL_APIENTRY *LPALGETSOURCE3IDIRECT)(ALCcontext *context, ALuint source, ALenum param, ALint *value1, ALint *value2, ALint *value3) AL_API_NOEXCEPT17;
typedef void (AL_APIENTRY *LPALGETSOURCEIVDIRECT)(ALCcontext *context, ALuint source, ALenum param, ALint *values) AL_API_NOEXCEPT17;
typedef void (AL_APIENTRY *LPALSOURCEPLAYDIRECT)(ALCcontext *context, ALuint source) AL_API_NOEXCEPT17;
typedef void (AL_APIENTRY *LPALSOURCESTOPDIRECT)(ALCcontext *context, ALuint source) AL_API_NOEXCEPT17;
typedef void (AL_APIENTRY *LPALSOURCEREWINDDIRECT)(ALCcontext *context, ALuint source) AL_API_NOEXCEPT17;
typedef void (AL_APIENTRY *LPALSOURCEPAUSEDIRECT)(ALCcontext *context, ALuint source) AL_API_NOEXCEPT17;
typedef void (AL_APIENTRY *LPALSOURCEPLAYVDIRECT)(ALCcontext *context, ALsizei n, const ALuint *sources) AL_API_NOEXCEPT17;
typedef void (AL_APIENTRY *LPALSOURCESTOPVDIRECT)(ALCcontext *context, ALsizei n, const ALuint *sources) AL_API_NOEXCEPT17;
typedef void (AL_APIENTRY *LPALSOURCEREWINDVDIRECT)(ALCcontext *context, ALsizei n, const ALuint *sources) AL_API_NOEXCEPT17;
typedef void (AL_APIENTRY *LPALSOURCEPAUSEVDIRECT)(ALCcontext *context, ALsizei n, const ALuint *sources) AL_API_NOEXCEPT17;
typedef void (AL_APIENTRY *LPALSOURCEQUEUEBUFFERSDIRECT)(ALCcontext *context, ALuint source, ALsizei nb, const ALuint *buffers) AL_API_NOEXCEPT17;
typedef void (AL_APIENTRY *LPALSOURCEUNQUEUEBUFFERSDIRECT)(ALCcontext *context, ALuint source, ALsizei nb, ALuint *buffers) AL_API_NOEXCEPT17;
typedef void (AL_APIENTRY *LPALGENBUFFERSDIRECT)(ALCcontext *context, ALsizei n, ALuint *buffers) AL_API_NOEXCEPT17;
typedef void (AL_APIENTRY *LPALDELETEBUFFERSDIRECT)(ALCcontext *context, ALsizei n, const ALuint *buffers) AL_API_NOEXCEPT17;
typedef ALboolean (AL_APIENTRY *LPALISBUFFERDIRECT)(ALCcontext *context, ALuint buffer) AL_API_NOEXCEPT17;
typedef void (AL_APIENTRY *LPALBUFFERDATADIRECT)(ALCcontext *context, ALuint buffer, ALenum format, const ALvoid *data, ALsizei size, ALsizei samplerate) AL_API_NOEXCEPT17;
typedef void (AL_APIENTRY *LPALBUFFERFDIRECT)(ALCcontext *context, ALuint buffer, ALenum param, ALfloat value) AL_API_NOEXCEPT17;
typedef void (AL_APIENTRY *LPALBUFFER3FDIRECT)(ALCcontext *context, ALuint buffer, ALenum param, ALfloat value1, ALfloat value2, ALfloat value3) AL_API_NOEXCEPT17;
typedef void (AL_APIENTRY *LPALBUFFERFVDIRECT)(ALCcontext *context, ALuint buffer, ALenum param, const ALfloat *values) AL_API_NOEXCEPT17;
typedef void (AL_APIENTRY *LPALBUFFERIDIRECT)(ALCcontext *context, ALuint buffer, ALenum param, ALint value) AL_API_NOEXCEPT17;
typedef void (AL_APIENTRY *LPALBUFFER3IDIRECT)(ALCcontext *context, ALuint buffer, ALenum param, ALint value1, ALint value2, ALint value3) AL_API_NOEXCEPT17;
typedef void (AL_APIENTRY *LPALBUFFERIVDIRECT)(ALCcontext *context, ALuint buffer, ALenum param, const ALint *values) AL_API_NOEXCEPT17;
typedef void (AL_APIENTRY *LPALGETBUFFERFDIRECT)(ALCcontext *context, ALuint buffer, ALenum param, ALfloat *value) AL_API_NOEXCEPT17;
typedef void (AL_APIENTRY *LPALGETBUFFER3FDIRECT)(ALCcontext *context, ALuint buffer, ALenum param, ALfloat *value1, ALfloat *value2, ALfloat *value3) AL_API_NOEXCEPT17;
typedef void (AL_APIENTRY *LPALGETBUFFERFVDIRECT)(ALCcontext *context, ALuint buffer, ALenum param, ALfloat *values) AL_API_NOEXCEPT17;
typedef void (AL_APIENTRY *LPALGETBUFFERIDIRECT)(ALCcontext *context, ALuint buffer, ALenum param, ALint *value) AL_API_NOEXCEPT17;
typedef void (AL_APIENTRY *LPALGETBUFFER3IDIRECT)(ALCcontext *context, ALuint buffer, ALenum param, ALint *value1, ALint *value2, ALint *value3) AL_API_NOEXCEPT17;
typedef void (AL_APIENTRY *LPALGETBUFFERIVDIRECT)(ALCcontext *context, ALuint buffer, ALenum param, ALint *values) AL_API_NOEXCEPT17;
/* ALC_EXT_EFX */
typedef void (AL_APIENTRY *LPALGENEFFECTSDIRECT)(ALCcontext *context, ALsizei n, ALuint *effects) AL_API_NOEXCEPT17;
typedef void (AL_APIENTRY *LPALDELETEEFFECTSDIRECT)(ALCcontext *context, ALsizei n, const ALuint *effects) AL_API_NOEXCEPT17;
typedef ALboolean (AL_APIENTRY *LPALISEFFECTDIRECT)(ALCcontext *context, ALuint effect) AL_API_NOEXCEPT17;
typedef void (AL_APIENTRY *LPALEFFECTIDIRECT)(ALCcontext *context, ALuint effect, ALenum param, ALint value) AL_API_NOEXCEPT17;
typedef void (AL_APIENTRY *LPALEFFECTIVDIRECT)(ALCcontext *context, ALuint effect, ALenum param, const ALint *values) AL_API_NOEXCEPT17;
typedef void (AL_APIENTRY *LPALEFFECTFDIRECT)(ALCcontext *context, ALuint effect, ALenum param, ALfloat value) AL_API_NOEXCEPT17;
typedef void (AL_APIENTRY *LPALEFFECTFVDIRECT)(ALCcontext *context, ALuint effect, ALenum param, const ALfloat *values) AL_API_NOEXCEPT17;
typedef void (AL_APIENTRY *LPALGETEFFECTIDIRECT)(ALCcontext *context, ALuint effect, ALenum param, ALint *value) AL_API_NOEXCEPT17;
typedef void (AL_APIENTRY *LPALGETEFFECTIVDIRECT)(ALCcontext *context, ALuint effect, ALenum param, ALint *values) AL_API_NOEXCEPT17;
typedef void (AL_APIENTRY *LPALGETEFFECTFDIRECT)(ALCcontext *context, ALuint effect, ALenum param, ALfloat *value) AL_API_NOEXCEPT17;
typedef void (AL_APIENTRY *LPALGETEFFECTFVDIRECT)(ALCcontext *context, ALuint effect, ALenum param, ALfloat *values) AL_API_NOEXCEPT17;
typedef void (AL_APIENTRY *LPALGENFILTERSDIRECT)(ALCcontext *context, ALsizei n, ALuint *filters) AL_API_NOEXCEPT17;
typedef void (AL_APIENTRY *LPALDELETEFILTERSDIRECT)(ALCcontext *context, ALsizei n, const ALuint *filters) AL_API_NOEXCEPT17;
typedef ALboolean (AL_APIENTRY *LPALISFILTERDIRECT)(ALCcontext *context, ALuint filter) AL_API_NOEXCEPT17;
typedef void (AL_APIENTRY *LPALFILTERIDIRECT)(ALCcontext *context, ALuint filter, ALenum param, ALint value) AL_API_NOEXCEPT17;
typedef void (AL_APIENTRY *LPALFILTERIVDIRECT)(ALCcontext *context, ALuint filter, ALenum param, const ALint *values) AL_API_NOEXCEPT17;
typedef void (AL_APIENTRY *LPALFILTERFDIRECT)(ALCcontext *context, ALuint filter, ALenum param, ALfloat value) AL_API_NOEXCEPT17;
typedef void (AL_APIENTRY *LPALFILTERFVDIRECT)(ALCcontext *context, ALuint filter, ALenum param, const ALfloat *values) AL_API_NOEXCEPT17;
typedef void (AL_APIENTRY *LPALGETFILTERIDIRECT)(ALCcontext *context, ALuint filter, ALenum param, ALint *value) AL_API_NOEXCEPT17;
typedef void (AL_APIENTRY *LPALGETFILTERIVDIRECT)(ALCcontext *context, ALuint filter, ALenum param, ALint *values) AL_API_NOEXCEPT17;
typedef void (AL_APIENTRY *LPALGETFILTERFDIRECT)(ALCcontext *context, ALuint filter, ALenum param, ALfloat *value) AL_API_NOEXCEPT17;
typedef void (AL_APIENTRY *LPALGETFILTERFVDIRECT)(ALCcontext *context, ALuint filter, ALenum param, ALfloat *values) AL_API_NOEXCEPT17;
typedef void (AL_APIENTRY *LPALGENAUXILIARYEFFECTSLOTSDIRECT)(ALCcontext *context, ALsizei n, ALuint *effectslots) AL_API_NOEXCEPT17;
typedef void (AL_APIENTRY *LPALDELETEAUXILIARYEFFECTSLOTSDIRECT)(ALCcontext *context, ALsizei n, const ALuint *effectslots) AL_API_NOEXCEPT17;
typedef ALboolean (AL_APIENTRY *LPALISAUXILIARYEFFECTSLOTDIRECT)(ALCcontext *context, ALuint effectslot) AL_API_NOEXCEPT17;
typedef void (AL_APIENTRY *LPALAUXILIARYEFFECTSLOTIDIRECT)(ALCcontext *context, ALuint effectslot, ALenum param, ALint value) AL_API_NOEXCEPT17;
typedef void (AL_APIENTRY *LPALAUXILIARYEFFECTSLOTIVDIRECT)(ALCcontext *context, ALuint effectslot, ALenum param, const ALint *values) AL_API_NOEXCEPT17;
typedef void (AL_APIENTRY *LPALAUXILIARYEFFECTSLOTFDIRECT)(ALCcontext *context, ALuint effectslot, ALenum param, ALfloat value) AL_API_NOEXCEPT17;
typedef void (AL_APIENTRY *LPALAUXILIARYEFFECTSLOTFVDIRECT)(ALCcontext *context, ALuint effectslot, ALenum param, const ALfloat *values) AL_API_NOEXCEPT17;
typedef void (AL_APIENTRY *LPALGETAUXILIARYEFFECTSLOTIDIRECT)(ALCcontext *context, ALuint effectslot, ALenum param, ALint *value) AL_API_NOEXCEPT17;
typedef void (AL_APIENTRY *LPALGETAUXILIARYEFFECTSLOTIVDIRECT)(ALCcontext *context, ALuint effectslot, ALenum param, ALint *values) AL_API_NOEXCEPT17;
typedef void (AL_APIENTRY *LPALGETAUXILIARYEFFECTSLOTFDIRECT)(ALCcontext *context, ALuint effectslot, ALenum param, ALfloat *value) AL_API_NOEXCEPT17;
typedef void (AL_APIENTRY *LPALGETAUXILIARYEFFECTSLOTFVDIRECT)(ALCcontext *context, ALuint effectslot, ALenum param, ALfloat *values) AL_API_NOEXCEPT17;
/* AL_EXT_BUFFER_DATA_STATIC */
typedef void (AL_APIENTRY *LPALBUFFERDATASTATICDIRECT)(ALCcontext *context, ALuint buffer, ALenum format, ALvoid *data, ALsizei size, ALsizei freq) AL_API_NOEXCEPT17;
/* AL_EXT_debug */
typedef void (AL_APIENTRY*LPALDEBUGMESSAGECALLBACKDIRECTEXT)(ALCcontext *context, ALDEBUGPROCEXT callback, void *userParam) AL_API_NOEXCEPT17;
typedef void (AL_APIENTRY*LPALDEBUGMESSAGEINSERTDIRECTEXT)(ALCcontext *context, ALenum source, ALenum type, ALuint id, ALenum severity, ALsizei length, const ALchar *message) AL_API_NOEXCEPT17;
typedef void (AL_APIENTRY*LPALDEBUGMESSAGECONTROLDIRECTEXT)(ALCcontext *context, ALenum source, ALenum type, ALenum severity, ALsizei count, const ALuint *ids, ALboolean enable) AL_API_NOEXCEPT17;
typedef void (AL_APIENTRY*LPALPUSHDEBUGGROUPDIRECTEXT)(ALCcontext *context, ALenum source, ALuint id, ALsizei length, const ALchar *message) AL_API_NOEXCEPT17;
typedef void (AL_APIENTRY*LPALPOPDEBUGGROUPDIRECTEXT)(ALCcontext *context) AL_API_NOEXCEPT17;
typedef ALuint (AL_APIENTRY*LPALGETDEBUGMESSAGELOGDIRECTEXT)(ALCcontext *context, ALuint count, ALsizei logBufSize, ALenum *sources, ALenum *types, ALuint *ids, ALenum *severities, ALsizei *lengths, ALchar *logBuf) AL_API_NOEXCEPT17;
typedef void (AL_APIENTRY*LPALOBJECTLABELDIRECTEXT)(ALCcontext *context, ALenum identifier, ALuint name, ALsizei length, const ALchar *label) AL_API_NOEXCEPT17;
typedef void (AL_APIENTRY*LPALGETOBJECTLABELDIRECTEXT)(ALCcontext *context, ALenum identifier, ALuint name, ALsizei bufSize, ALsizei *length, ALchar *label) AL_API_NOEXCEPT17;
typedef void* (AL_APIENTRY*LPALGETPOINTERDIRECTEXT)(ALCcontext *context, ALenum pname) AL_API_NOEXCEPT17;
typedef void (AL_APIENTRY*LPALGETPOINTERVDIRECTEXT)(ALCcontext *context, ALenum pname, void **values) AL_API_NOEXCEPT17;
/* AL_EXT_FOLDBACK */
typedef void (AL_APIENTRY *LPALREQUESTFOLDBACKSTARTDIRECT)(ALCcontext *context, ALenum mode, ALsizei count, ALsizei length, ALfloat *mem, LPALFOLDBACKCALLBACK callback) AL_API_NOEXCEPT17;
typedef void (AL_APIENTRY *LPALREQUESTFOLDBACKSTOPDIRECT)(ALCcontext *context) AL_API_NOEXCEPT17;
/* AL_SOFT_buffer_sub_data */
typedef void (AL_APIENTRY *LPALBUFFERSUBDATADIRECTSOFT)(ALCcontext *context, ALuint buffer, ALenum format, const ALvoid *data, ALsizei offset, ALsizei length) AL_API_NOEXCEPT17;
/* AL_SOFT_source_latency */
typedef void (AL_APIENTRY *LPALSOURCEDDIRECTSOFT)(ALCcontext*,ALuint,ALenum,ALdouble) AL_API_NOEXCEPT17;
typedef void (AL_APIENTRY *LPALSOURCE3DDIRECTSOFT)(ALCcontext*,ALuint,ALenum,ALdouble,ALdouble,ALdouble) AL_API_NOEXCEPT17;
typedef void (AL_APIENTRY *LPALSOURCEDVDIRECTSOFT)(ALCcontext*,ALuint,ALenum,const ALdouble*) AL_API_NOEXCEPT17;
typedef void (AL_APIENTRY *LPALGETSOURCEDDIRECTSOFT)(ALCcontext*,ALuint,ALenum,ALdouble*) AL_API_NOEXCEPT17;
typedef void (AL_APIENTRY *LPALGETSOURCE3DDIRECTSOFT)(ALCcontext*,ALuint,ALenum,ALdouble*,ALdouble*,ALdouble*) AL_API_NOEXCEPT17;
typedef void (AL_APIENTRY *LPALGETSOURCEDVDIRECTSOFT)(ALCcontext*,ALuint,ALenum,ALdouble*) AL_API_NOEXCEPT17;
typedef void (AL_APIENTRY *LPALSOURCEI64DIRECTSOFT)(ALCcontext*,ALuint,ALenum,ALint64SOFT) AL_API_NOEXCEPT17;
typedef void (AL_APIENTRY *LPALSOURCE3I64DIRECTSOFT)(ALCcontext*,ALuint,ALenum,ALint64SOFT,ALint64SOFT,ALint64SOFT) AL_API_NOEXCEPT17;
typedef void (AL_APIENTRY *LPALSOURCEI64VDIRECTSOFT)(ALCcontext*,ALuint,ALenum,const ALint64SOFT*) AL_API_NOEXCEPT17;
typedef void (AL_APIENTRY *LPALGETSOURCEI64DIRECTSOFT)(ALCcontext*,ALuint,ALenum,ALint64SOFT*) AL_API_NOEXCEPT17;
typedef void (AL_APIENTRY *LPALGETSOURCE3I64DIRECTSOFT)(ALCcontext*,ALuint,ALenum,ALint64SOFT*,ALint64SOFT*,ALint64SOFT*) AL_API_NOEXCEPT17;
typedef void (AL_APIENTRY *LPALGETSOURCEI64VDIRECTSOFT)(ALCcontext*,ALuint,ALenum,ALint64SOFT*) AL_API_NOEXCEPT17;
/* AL_SOFT_deferred_updates */
typedef void (AL_APIENTRY *LPALDEFERUPDATESDIRECTSOFT)(ALCcontext *context) AL_API_NOEXCEPT17;
typedef void (AL_APIENTRY *LPALPROCESSUPDATESDIRECTSOFT)(ALCcontext *context) AL_API_NOEXCEPT17;
/* AL_SOFT_source_resampler */
typedef const ALchar* (AL_APIENTRY *LPALGETSTRINGIDIRECTSOFT)(ALCcontext *context, ALenum pname, ALsizei index) AL_API_NOEXCEPT17;
/* AL_SOFT_events */
typedef void (AL_APIENTRY *LPALEVENTCONTROLDIRECTSOFT)(ALCcontext *context, ALsizei count, const ALenum *types, ALboolean enable) AL_API_NOEXCEPT17;
typedef void (AL_APIENTRY *LPALEVENTCALLBACKDIRECTSOFT)(ALCcontext *context, ALEVENTPROCSOFT callback, void *userParam) AL_API_NOEXCEPT17;
typedef void* (AL_APIENTRY *LPALGETPOINTERDIRECTSOFT)(ALCcontext *context, ALenum pname) AL_API_NOEXCEPT17;
typedef void (AL_APIENTRY *LPALGETPOINTERVDIRECTSOFT)(ALCcontext *context, ALenum pname, void **values) AL_API_NOEXCEPT17;
/* AL_SOFT_callback_buffer */
typedef void (AL_APIENTRY *LPALBUFFERCALLBACKDIRECTSOFT)(ALCcontext *context, ALuint buffer, ALenum format, ALsizei freq, ALBUFFERCALLBACKTYPESOFT callback, ALvoid *userptr) AL_API_NOEXCEPT17;
typedef void (AL_APIENTRY *LPALGETBUFFERPTRDIRECTSOFT)(ALCcontext *context, ALuint buffer, ALenum param, ALvoid **value) AL_API_NOEXCEPT17;
typedef void (AL_APIENTRY *LPALGETBUFFER3PTRDIRECTSOFT)(ALCcontext *context, ALuint buffer, ALenum param, ALvoid **value1, ALvoid **value2, ALvoid **value3) AL_API_NOEXCEPT17;
typedef void (AL_APIENTRY *LPALGETBUFFERPTRVDIRECTSOFT)(ALCcontext *context, ALuint buffer, ALenum param, ALvoid **values) AL_API_NOEXCEPT17;
/* AL_SOFT_source_start_delay */
typedef void (AL_APIENTRY *LPALSOURCEPLAYATTIMEDIRECTSOFT)(ALCcontext *context, ALuint source, ALint64SOFT start_time) AL_API_NOEXCEPT17;
typedef void (AL_APIENTRY *LPALSOURCEPLAYATTIMEVDIRECTSOFT)(ALCcontext *context, ALsizei n, const ALuint *sources, ALint64SOFT start_time) AL_API_NOEXCEPT17;
/* EAX */
typedef ALenum (AL_APIENTRY *LPEAXSETDIRECT)(ALCcontext *context, const struct _GUID *property_set_id, ALuint property_id, ALuint source_id, ALvoid *value, ALuint value_size) AL_API_NOEXCEPT17;
typedef ALenum (AL_APIENTRY *LPEAXGETDIRECT)(ALCcontext *context, const struct _GUID *property_set_id, ALuint property_id, ALuint source_id, ALvoid *value, ALuint value_size) AL_API_NOEXCEPT17;
typedef ALboolean (AL_APIENTRY *LPEAXSETBUFFERMODEDIRECT)(ALCcontext *context, ALsizei n, const ALuint *buffers, ALint value) AL_API_NOEXCEPT17;
typedef ALenum (AL_APIENTRY *LPEAXGETBUFFERMODEDIRECT)(ALCcontext *context, ALuint buffer, ALint *pReserved) AL_API_NOEXCEPT17;
#ifdef AL_ALEXT_PROTOTYPES
ALCvoid* ALC_APIENTRY alcGetProcAddress2(ALCdevice *device, const ALCchar *funcName) AL_API_NOEXCEPT;
void AL_APIENTRY alEnableDirect(ALCcontext *context, ALenum capability) AL_API_NOEXCEPT;
void AL_APIENTRY alDisableDirect(ALCcontext *context, ALenum capability) AL_API_NOEXCEPT;
ALboolean AL_APIENTRY alIsEnabledDirect(ALCcontext *context, ALenum capability) AL_API_NOEXCEPT;
void AL_APIENTRY alDopplerFactorDirect(ALCcontext *context, ALfloat value) AL_API_NOEXCEPT;
void AL_APIENTRY alSpeedOfSoundDirect(ALCcontext *context, ALfloat value) AL_API_NOEXCEPT;
void AL_APIENTRY alDistanceModelDirect(ALCcontext *context, ALenum distanceModel) AL_API_NOEXCEPT;
const ALchar* AL_APIENTRY alGetStringDirect(ALCcontext *context, ALenum param) AL_API_NOEXCEPT;
void AL_APIENTRY alGetBooleanvDirect(ALCcontext *context, ALenum param, ALboolean *values) AL_API_NOEXCEPT;
void AL_APIENTRY alGetIntegervDirect(ALCcontext *context, ALenum param, ALint *values) AL_API_NOEXCEPT;
void AL_APIENTRY alGetFloatvDirect(ALCcontext *context, ALenum param, ALfloat *values) AL_API_NOEXCEPT;
void AL_APIENTRY alGetDoublevDirect(ALCcontext *context, ALenum param, ALdouble *values) AL_API_NOEXCEPT;
ALboolean AL_APIENTRY alGetBooleanDirect(ALCcontext *context, ALenum param) AL_API_NOEXCEPT;
ALint AL_APIENTRY alGetIntegerDirect(ALCcontext *context, ALenum param) AL_API_NOEXCEPT;
ALfloat AL_APIENTRY alGetFloatDirect(ALCcontext *context, ALenum param) AL_API_NOEXCEPT;
ALdouble AL_APIENTRY alGetDoubleDirect(ALCcontext *context, ALenum param) AL_API_NOEXCEPT;
ALenum AL_APIENTRY alGetErrorDirect(ALCcontext *context) AL_API_NOEXCEPT;
ALboolean AL_APIENTRY alIsExtensionPresentDirect(ALCcontext *context, const ALchar *extname) AL_API_NOEXCEPT;
void* AL_APIENTRY alGetProcAddressDirect(ALCcontext *context, const ALchar *fname) AL_API_NOEXCEPT;
ALenum AL_APIENTRY alGetEnumValueDirect(ALCcontext *context, const ALchar *ename) AL_API_NOEXCEPT;
void AL_APIENTRY alListenerfDirect(ALCcontext *context, ALenum param, ALfloat value) AL_API_NOEXCEPT;
void AL_APIENTRY alListener3fDirect(ALCcontext *context, ALenum param, ALfloat value1, ALfloat value2, ALfloat value3) AL_API_NOEXCEPT;
void AL_APIENTRY alListenerfvDirect(ALCcontext *context, ALenum param, const ALfloat *values) AL_API_NOEXCEPT;
void AL_APIENTRY alListeneriDirect(ALCcontext *context, ALenum param, ALint value) AL_API_NOEXCEPT;
void AL_APIENTRY alListener3iDirect(ALCcontext *context, ALenum param, ALint value1, ALint value2, ALint value3) AL_API_NOEXCEPT;
void AL_APIENTRY alListenerivDirect(ALCcontext *context, ALenum param, const ALint *values) AL_API_NOEXCEPT;
void AL_APIENTRY alGetListenerfDirect(ALCcontext *context, ALenum param, ALfloat *value) AL_API_NOEXCEPT;
void AL_APIENTRY alGetListener3fDirect(ALCcontext *context, ALenum param, ALfloat *value1, ALfloat *value2, ALfloat *value3) AL_API_NOEXCEPT;
void AL_APIENTRY alGetListenerfvDirect(ALCcontext *context, ALenum param, ALfloat *values) AL_API_NOEXCEPT;
void AL_APIENTRY alGetListeneriDirect(ALCcontext *context, ALenum param, ALint *value) AL_API_NOEXCEPT;
void AL_APIENTRY alGetListener3iDirect(ALCcontext *context, ALenum param, ALint *value1, ALint *value2, ALint *value3) AL_API_NOEXCEPT;
void AL_APIENTRY alGetListenerivDirect(ALCcontext *context, ALenum param, ALint *values) AL_API_NOEXCEPT;
void AL_APIENTRY alGenSourcesDirect(ALCcontext *context, ALsizei n, ALuint *sources) AL_API_NOEXCEPT;
void AL_APIENTRY alDeleteSourcesDirect(ALCcontext *context, ALsizei n, const ALuint *sources) AL_API_NOEXCEPT;
ALboolean AL_APIENTRY alIsSourceDirect(ALCcontext *context, ALuint source) AL_API_NOEXCEPT;
void AL_APIENTRY alSourcefDirect(ALCcontext *context, ALuint source, ALenum param, ALfloat value) AL_API_NOEXCEPT;
void AL_APIENTRY alSource3fDirect(ALCcontext *context, ALuint source, ALenum param, ALfloat value1, ALfloat value2, ALfloat value3) AL_API_NOEXCEPT;
void AL_APIENTRY alSourcefvDirect(ALCcontext *context, ALuint source, ALenum param, const ALfloat *values) AL_API_NOEXCEPT;
void AL_APIENTRY alSourceiDirect(ALCcontext *context, ALuint source, ALenum param, ALint value) AL_API_NOEXCEPT;
void AL_APIENTRY alSource3iDirect(ALCcontext *context, ALuint source, ALenum param, ALint value1, ALint value2, ALint value3) AL_API_NOEXCEPT;
void AL_APIENTRY alSourceivDirect(ALCcontext *context, ALuint source, ALenum param, const ALint *values) AL_API_NOEXCEPT;
void AL_APIENTRY alGetSourcefDirect(ALCcontext *context, ALuint source, ALenum param, ALfloat *value) AL_API_NOEXCEPT;
void AL_APIENTRY alGetSource3fDirect(ALCcontext *context, ALuint source, ALenum param, ALfloat *value1, ALfloat *value2, ALfloat *value3) AL_API_NOEXCEPT;
void AL_APIENTRY alGetSourcefvDirect(ALCcontext *context, ALuint source, ALenum param, ALfloat *values) AL_API_NOEXCEPT;
void AL_APIENTRY alGetSourceiDirect(ALCcontext *context, ALuint source, ALenum param, ALint *value) AL_API_NOEXCEPT;
void AL_APIENTRY alGetSource3iDirect(ALCcontext *context, ALuint source, ALenum param, ALint *value1, ALint *value2, ALint *value3) AL_API_NOEXCEPT;
void AL_APIENTRY alGetSourceivDirect(ALCcontext *context, ALuint source, ALenum param, ALint *values) AL_API_NOEXCEPT;
void AL_APIENTRY alSourcePlayDirect(ALCcontext *context, ALuint source) AL_API_NOEXCEPT;
void AL_APIENTRY alSourceStopDirect(ALCcontext *context, ALuint source) AL_API_NOEXCEPT;
void AL_APIENTRY alSourceRewindDirect(ALCcontext *context, ALuint source) AL_API_NOEXCEPT;
void AL_APIENTRY alSourcePauseDirect(ALCcontext *context, ALuint source) AL_API_NOEXCEPT;
void AL_APIENTRY alSourcePlayvDirect(ALCcontext *context, ALsizei n, const ALuint *sources) AL_API_NOEXCEPT;
void AL_APIENTRY alSourceStopvDirect(ALCcontext *context, ALsizei n, const ALuint *sources) AL_API_NOEXCEPT;
void AL_APIENTRY alSourceRewindvDirect(ALCcontext *context, ALsizei n, const ALuint *sources) AL_API_NOEXCEPT;
void AL_APIENTRY alSourcePausevDirect(ALCcontext *context, ALsizei n, const ALuint *sources) AL_API_NOEXCEPT;
void AL_APIENTRY alSourceQueueBuffersDirect(ALCcontext *context, ALuint source, ALsizei nb, const ALuint *buffers) AL_API_NOEXCEPT;
void AL_APIENTRY alSourceUnqueueBuffersDirect(ALCcontext *context, ALuint source, ALsizei nb, ALuint *buffers) AL_API_NOEXCEPT;
void AL_APIENTRY alGenBuffersDirect(ALCcontext *context, ALsizei n, ALuint *buffers) AL_API_NOEXCEPT;
void AL_APIENTRY alDeleteBuffersDirect(ALCcontext *context, ALsizei n, const ALuint *buffers) AL_API_NOEXCEPT;
ALboolean AL_APIENTRY alIsBufferDirect(ALCcontext *context, ALuint buffer) AL_API_NOEXCEPT;
void AL_APIENTRY alBufferDataDirect(ALCcontext *context, ALuint buffer, ALenum format, const ALvoid *data, ALsizei size, ALsizei samplerate) AL_API_NOEXCEPT;
void AL_APIENTRY alBufferfDirect(ALCcontext *context, ALuint buffer, ALenum param, ALfloat value) AL_API_NOEXCEPT;
void AL_APIENTRY alBuffer3fDirect(ALCcontext *context, ALuint buffer, ALenum param, ALfloat value1, ALfloat value2, ALfloat value3) AL_API_NOEXCEPT;
void AL_APIENTRY alBufferfvDirect(ALCcontext *context, ALuint buffer, ALenum param, const ALfloat *values) AL_API_NOEXCEPT;
void AL_APIENTRY alBufferiDirect(ALCcontext *context, ALuint buffer, ALenum param, ALint value) AL_API_NOEXCEPT;
void AL_APIENTRY alBuffer3iDirect(ALCcontext *context, ALuint buffer, ALenum param, ALint value1, ALint value2, ALint value3) AL_API_NOEXCEPT;
void AL_APIENTRY alBufferivDirect(ALCcontext *context, ALuint buffer, ALenum param, const ALint *values) AL_API_NOEXCEPT;
void AL_APIENTRY alGetBufferfDirect(ALCcontext *context, ALuint buffer, ALenum param, ALfloat *value) AL_API_NOEXCEPT;
void AL_APIENTRY alGetBuffer3fDirect(ALCcontext *context, ALuint buffer, ALenum param, ALfloat *value1, ALfloat *value2, ALfloat *value3) AL_API_NOEXCEPT;
void AL_APIENTRY alGetBufferfvDirect(ALCcontext *context, ALuint buffer, ALenum param, ALfloat *values) AL_API_NOEXCEPT;
void AL_APIENTRY alGetBufferiDirect(ALCcontext *context, ALuint buffer, ALenum param, ALint *value) AL_API_NOEXCEPT;
void AL_APIENTRY alGetBuffer3iDirect(ALCcontext *context, ALuint buffer, ALenum param, ALint *value1, ALint *value2, ALint *value3) AL_API_NOEXCEPT;
void AL_APIENTRY alGetBufferivDirect(ALCcontext *context, ALuint buffer, ALenum param, ALint *values) AL_API_NOEXCEPT;
void AL_APIENTRY alGenEffectsDirect(ALCcontext *context, ALsizei n, ALuint *effects) AL_API_NOEXCEPT;
void AL_APIENTRY alDeleteEffectsDirect(ALCcontext *context, ALsizei n, const ALuint *effects) AL_API_NOEXCEPT;
ALboolean AL_APIENTRY alIsEffectDirect(ALCcontext *context, ALuint effect) AL_API_NOEXCEPT;
void AL_APIENTRY alEffectiDirect(ALCcontext *context, ALuint effect, ALenum param, ALint iValue) AL_API_NOEXCEPT;
void AL_APIENTRY alEffectivDirect(ALCcontext *context, ALuint effect, ALenum param, const ALint *piValues) AL_API_NOEXCEPT;
void AL_APIENTRY alEffectfDirect(ALCcontext *context, ALuint effect, ALenum param, ALfloat flValue) AL_API_NOEXCEPT;
void AL_APIENTRY alEffectfvDirect(ALCcontext *context, ALuint effect, ALenum param, const ALfloat *pflValues) AL_API_NOEXCEPT;
void AL_APIENTRY alGetEffectiDirect(ALCcontext *context, ALuint effect, ALenum param, ALint *piValue) AL_API_NOEXCEPT;
void AL_APIENTRY alGetEffectivDirect(ALCcontext *context, ALuint effect, ALenum param, ALint *piValues) AL_API_NOEXCEPT;
void AL_APIENTRY alGetEffectfDirect(ALCcontext *context, ALuint effect, ALenum param, ALfloat *pflValue) AL_API_NOEXCEPT;
void AL_APIENTRY alGetEffectfvDirect(ALCcontext *context, ALuint effect, ALenum param, ALfloat *pflValues) AL_API_NOEXCEPT;
void AL_APIENTRY alGenFiltersDirect(ALCcontext *context, ALsizei n, ALuint *filters) AL_API_NOEXCEPT;
void AL_APIENTRY alDeleteFiltersDirect(ALCcontext *context, ALsizei n, const ALuint *filters) AL_API_NOEXCEPT;
ALboolean AL_APIENTRY alIsFilterDirect(ALCcontext *context, ALuint filter) AL_API_NOEXCEPT;
void AL_APIENTRY alFilteriDirect(ALCcontext *context, ALuint filter, ALenum param, ALint iValue) AL_API_NOEXCEPT;
void AL_APIENTRY alFilterivDirect(ALCcontext *context, ALuint filter, ALenum param, const ALint *piValues) AL_API_NOEXCEPT;
void AL_APIENTRY alFilterfDirect(ALCcontext *context, ALuint filter, ALenum param, ALfloat flValue) AL_API_NOEXCEPT;
void AL_APIENTRY alFilterfvDirect(ALCcontext *context, ALuint filter, ALenum param, const ALfloat *pflValues) AL_API_NOEXCEPT;
void AL_APIENTRY alGetFilteriDirect(ALCcontext *context, ALuint filter, ALenum param, ALint *piValue) AL_API_NOEXCEPT;
void AL_APIENTRY alGetFilterivDirect(ALCcontext *context, ALuint filter, ALenum param, ALint *piValues) AL_API_NOEXCEPT;
void AL_APIENTRY alGetFilterfDirect(ALCcontext *context, ALuint filter, ALenum param, ALfloat *pflValue) AL_API_NOEXCEPT;
void AL_APIENTRY alGetFilterfvDirect(ALCcontext *context, ALuint filter, ALenum param, ALfloat *pflValues) AL_API_NOEXCEPT;
void AL_APIENTRY alGenAuxiliaryEffectSlotsDirect(ALCcontext *context, ALsizei n, ALuint *effectslots) AL_API_NOEXCEPT;
void AL_APIENTRY alDeleteAuxiliaryEffectSlotsDirect(ALCcontext *context, ALsizei n, const ALuint *effectslots) AL_API_NOEXCEPT;
ALboolean AL_APIENTRY alIsAuxiliaryEffectSlotDirect(ALCcontext *context, ALuint effectslot) AL_API_NOEXCEPT;
void AL_APIENTRY alAuxiliaryEffectSlotiDirect(ALCcontext *context, ALuint effectslot, ALenum param, ALint iValue) AL_API_NOEXCEPT;
void AL_APIENTRY alAuxiliaryEffectSlotivDirect(ALCcontext *context, ALuint effectslot, ALenum param, const ALint *piValues) AL_API_NOEXCEPT;
void AL_APIENTRY alAuxiliaryEffectSlotfDirect(ALCcontext *context, ALuint effectslot, ALenum param, ALfloat flValue) AL_API_NOEXCEPT;
void AL_APIENTRY alAuxiliaryEffectSlotfvDirect(ALCcontext *context, ALuint effectslot, ALenum param, const ALfloat *pflValues) AL_API_NOEXCEPT;
void AL_APIENTRY alGetAuxiliaryEffectSlotiDirect(ALCcontext *context, ALuint effectslot, ALenum param, ALint *piValue) AL_API_NOEXCEPT;
void AL_APIENTRY alGetAuxiliaryEffectSlotivDirect(ALCcontext *context, ALuint effectslot, ALenum param, ALint *piValues) AL_API_NOEXCEPT;
void AL_APIENTRY alGetAuxiliaryEffectSlotfDirect(ALCcontext *context, ALuint effectslot, ALenum param, ALfloat *pflValue) AL_API_NOEXCEPT;
void AL_APIENTRY alGetAuxiliaryEffectSlotfvDirect(ALCcontext *context, ALuint effectslot, ALenum param, ALfloat *pflValues) AL_API_NOEXCEPT;
void AL_APIENTRY alBufferDataStaticDirect(ALCcontext *context, ALuint buffer, ALenum format, ALvoid *data, ALsizei size, ALsizei freq) AL_API_NOEXCEPT;
void AL_APIENTRY alDebugMessageCallbackDirectEXT(ALCcontext *context, ALDEBUGPROCEXT callback, void *userParam) AL_API_NOEXCEPT;
void AL_APIENTRY alDebugMessageInsertDirectEXT(ALCcontext *context, ALenum source, ALenum type, ALuint id, ALenum severity, ALsizei length, const ALchar *message) AL_API_NOEXCEPT;
void AL_APIENTRY alDebugMessageControlDirectEXT(ALCcontext *context, ALenum source, ALenum type, ALenum severity, ALsizei count, const ALuint *ids, ALboolean enable) AL_API_NOEXCEPT;
void AL_APIENTRY alPushDebugGroupDirectEXT(ALCcontext *context, ALenum source, ALuint id, ALsizei length, const ALchar *message) AL_API_NOEXCEPT;
void AL_APIENTRY alPopDebugGroupDirectEXT(ALCcontext *context) AL_API_NOEXCEPT;
ALuint AL_APIENTRY alGetDebugMessageLogDirectEXT(ALCcontext *context, ALuint count, ALsizei logBufSize, ALenum *sources, ALenum *types, ALuint *ids, ALenum *severities, ALsizei *lengths, ALchar *logBuf) AL_API_NOEXCEPT;
void AL_APIENTRY alObjectLabelDirectEXT(ALCcontext *context, ALenum identifier, ALuint name, ALsizei length, const ALchar *label) AL_API_NOEXCEPT;
void AL_APIENTRY alGetObjectLabelDirectEXT(ALCcontext *context, ALenum identifier, ALuint name, ALsizei bufSize, ALsizei *length, ALchar *label) AL_API_NOEXCEPT;
void* AL_APIENTRY alGetPointerDirectEXT(ALCcontext *context, ALenum pname) AL_API_NOEXCEPT;
void AL_APIENTRY alGetPointervDirectEXT(ALCcontext *context, ALenum pname, void **values) AL_API_NOEXCEPT;
void AL_APIENTRY alRequestFoldbackStartDirect(ALCcontext *context, ALenum mode, ALsizei count, ALsizei length, ALfloat *mem, LPALFOLDBACKCALLBACK callback) AL_API_NOEXCEPT;
void AL_APIENTRY alRequestFoldbackStopDirect(ALCcontext *context) AL_API_NOEXCEPT;
void AL_APIENTRY alBufferSubDataDirectSOFT(ALCcontext *context, ALuint buffer, ALenum format, const ALvoid *data, ALsizei offset, ALsizei length) AL_API_NOEXCEPT;
void AL_APIENTRY alSourcedDirectSOFT(ALCcontext *context, ALuint source, ALenum param, ALdouble value) AL_API_NOEXCEPT;
void AL_APIENTRY alSource3dDirectSOFT(ALCcontext *context, ALuint source, ALenum param, ALdouble value1, ALdouble value2, ALdouble value3) AL_API_NOEXCEPT;
void AL_APIENTRY alSourcedvDirectSOFT(ALCcontext *context, ALuint source, ALenum param, const ALdouble *values) AL_API_NOEXCEPT;
void AL_APIENTRY alGetSourcedDirectSOFT(ALCcontext *context, ALuint source, ALenum param, ALdouble *value) AL_API_NOEXCEPT;
void AL_APIENTRY alGetSource3dDirectSOFT(ALCcontext *context, ALuint source, ALenum param, ALdouble *value1, ALdouble *value2, ALdouble *value3) AL_API_NOEXCEPT;
void AL_APIENTRY alGetSourcedvDirectSOFT(ALCcontext *context, ALuint source, ALenum param, ALdouble *values) AL_API_NOEXCEPT;
void AL_APIENTRY alSourcei64DirectSOFT(ALCcontext *context, ALuint source, ALenum param, ALint64SOFT value) AL_API_NOEXCEPT;
void AL_APIENTRY alSource3i64DirectSOFT(ALCcontext *context, ALuint source, ALenum param, ALint64SOFT value1, ALint64SOFT value2, ALint64SOFT value3) AL_API_NOEXCEPT;
void AL_APIENTRY alSourcei64vDirectSOFT(ALCcontext *context, ALuint source, ALenum param, const ALint64SOFT *values) AL_API_NOEXCEPT;
void AL_APIENTRY alGetSourcei64DirectSOFT(ALCcontext *context, ALuint source, ALenum param, ALint64SOFT *value) AL_API_NOEXCEPT;
void AL_APIENTRY alGetSource3i64DirectSOFT(ALCcontext *context, ALuint source, ALenum param, ALint64SOFT *value1, ALint64SOFT *value2, ALint64SOFT *value3) AL_API_NOEXCEPT;
void AL_APIENTRY alGetSourcei64vDirectSOFT(ALCcontext *context, ALuint source, ALenum param, ALint64SOFT *values) AL_API_NOEXCEPT;
void AL_APIENTRY alDeferUpdatesDirectSOFT(ALCcontext *context) AL_API_NOEXCEPT;
void AL_APIENTRY alProcessUpdatesDirectSOFT(ALCcontext *context) AL_API_NOEXCEPT;
const ALchar* AL_APIENTRY alGetStringiDirectSOFT(ALCcontext *context, ALenum pname, ALsizei index) AL_API_NOEXCEPT;
void AL_APIENTRY alEventControlDirectSOFT(ALCcontext *context, ALsizei count, const ALenum *types, ALboolean enable) AL_API_NOEXCEPT;
void AL_APIENTRY alEventCallbackDirectSOFT(ALCcontext *context, ALEVENTPROCSOFT callback, void *userParam) AL_API_NOEXCEPT;
void* AL_APIENTRY alGetPointerDirectSOFT(ALCcontext *context, ALenum pname) AL_API_NOEXCEPT;
void AL_APIENTRY alGetPointervDirectSOFT(ALCcontext *context, ALenum pname, void **values) AL_API_NOEXCEPT;
void AL_APIENTRY alBufferCallbackDirectSOFT(ALCcontext *context, ALuint buffer, ALenum format, ALsizei freq, ALBUFFERCALLBACKTYPESOFT callback, ALvoid *userptr) AL_API_NOEXCEPT;
void AL_APIENTRY alGetBufferPtrDirectSOFT(ALCcontext *context, ALuint buffer, ALenum param, ALvoid **ptr) AL_API_NOEXCEPT;
void AL_APIENTRY alGetBuffer3PtrDirectSOFT(ALCcontext *context, ALuint buffer, ALenum param, ALvoid **ptr0, ALvoid **ptr1, ALvoid **ptr2) AL_API_NOEXCEPT;
void AL_APIENTRY alGetBufferPtrvDirectSOFT(ALCcontext *context, ALuint buffer, ALenum param, ALvoid **ptr) AL_API_NOEXCEPT;
void AL_APIENTRY alSourcePlayAtTimeDirectSOFT(ALCcontext *context, ALuint source, ALint64SOFT start_time) AL_API_NOEXCEPT;
void AL_APIENTRY alSourcePlayAtTimevDirectSOFT(ALCcontext *context, ALsizei n, const ALuint *sources, ALint64SOFT start_time) AL_API_NOEXCEPT;
ALenum AL_APIENTRY EAXSetDirect(ALCcontext *context, const struct _GUID *property_set_id, ALuint property_id, ALuint source_id, ALvoid *value, ALuint value_size) AL_API_NOEXCEPT;
ALenum AL_APIENTRY EAXGetDirect(ALCcontext *context, const struct _GUID *property_set_id, ALuint property_id, ALuint source_id, ALvoid *value, ALuint value_size) AL_API_NOEXCEPT;
ALboolean AL_APIENTRY EAXSetBufferModeDirect(ALCcontext *context, ALsizei n, const ALuint *buffers, ALint value) AL_API_NOEXCEPT;
ALenum AL_APIENTRY EAXGetBufferModeDirect(ALCcontext *context, ALuint buffer, ALint *pReserved) AL_API_NOEXCEPT;
#endif
#endif
#ifndef AL_SOFT_bformat_hoa
#define AL_SOFT_bformat_hoa
#define AL_UNPACK_AMBISONIC_ORDER_SOFT 0x199D
#endif
#ifdef __cplusplus #ifdef __cplusplus
} }
#endif #endif
/* NOLINTEND */
#endif #endif

View file

@ -2,7 +2,6 @@
#ifndef EFX_PRESETS_H #ifndef EFX_PRESETS_H
#define EFX_PRESETS_H #define EFX_PRESETS_H
/* NOLINTBEGIN */
#ifndef EFXEAXREVERBPROPERTIES_DEFINED #ifndef EFXEAXREVERBPROPERTIES_DEFINED
#define EFXEAXREVERBPROPERTIES_DEFINED #define EFXEAXREVERBPROPERTIES_DEFINED
@ -346,7 +345,7 @@ typedef struct {
/* Driving Presets */ /* Driving Presets */
#define EFX_REVERB_PRESET_DRIVING_COMMENTATOR \ #define EFX_REVERB_PRESET_DRIVING_COMMENTATOR \
{ 1.0000f, 0.0000f, 0.3162f, 0.5623f, 0.5012f, 2.4200f, 0.8800f, 0.6800f, 0.1995f, 0.0930f, { 0.0000f, 0.0000f, 0.0000f }, 0.2512f, 0.0170f, { 0.0000f, 0.0000f, 0.0000f }, 0.2500f, 1.0000f, 0.2500f, 0.0000f, 0.9886f, 5000.0000f, 250.0000f, 0.0000f, 0x1 } { 1.0000f, 0.0000f, 3.1623f, 0.5623f, 0.5012f, 2.4200f, 0.8800f, 0.6800f, 0.1995f, 0.0930f, { 0.0000f, 0.0000f, 0.0000f }, 0.2512f, 0.0170f, { 0.0000f, 0.0000f, 0.0000f }, 0.2500f, 1.0000f, 0.2500f, 0.0000f, 0.9886f, 5000.0000f, 250.0000f, 0.0000f, 0x1 }
#define EFX_REVERB_PRESET_DRIVING_PITGARAGE \ #define EFX_REVERB_PRESET_DRIVING_PITGARAGE \
{ 0.4287f, 0.5900f, 0.3162f, 0.7079f, 0.5623f, 1.7200f, 0.9300f, 0.8700f, 0.5623f, 0.0000f, { 0.0000f, 0.0000f, 0.0000f }, 1.2589f, 0.0160f, { 0.0000f, 0.0000f, 0.0000f }, 0.2500f, 0.1100f, 0.2500f, 0.0000f, 0.9943f, 5000.0000f, 250.0000f, 0.0000f, 0x0 } { 0.4287f, 0.5900f, 0.3162f, 0.7079f, 0.5623f, 1.7200f, 0.9300f, 0.8700f, 0.5623f, 0.0000f, { 0.0000f, 0.0000f, 0.0000f }, 1.2589f, 0.0160f, { 0.0000f, 0.0000f, 0.0000f }, 0.2500f, 0.1100f, 0.2500f, 0.0000f, 0.9943f, 5000.0000f, 250.0000f, 0.0000f, 0x0 }
@ -400,5 +399,4 @@ typedef struct {
#define EFX_REVERB_PRESET_SMALLWATERROOM \ #define EFX_REVERB_PRESET_SMALLWATERROOM \
{ 1.0000f, 0.7000f, 0.3162f, 0.4477f, 1.0000f, 1.5100f, 1.2500f, 1.1400f, 0.8913f, 0.0200f, { 0.0000f, 0.0000f, 0.0000f }, 1.4125f, 0.0300f, { 0.0000f, 0.0000f, 0.0000f }, 0.1790f, 0.1500f, 0.8950f, 0.1900f, 0.9920f, 5000.0000f, 250.0000f, 0.0000f, 0x0 } { 1.0000f, 0.7000f, 0.3162f, 0.4477f, 1.0000f, 1.5100f, 1.2500f, 1.1400f, 0.8913f, 0.0200f, { 0.0000f, 0.0000f, 0.0000f }, 1.4125f, 0.0300f, { 0.0000f, 0.0000f, 0.0000f }, 0.1790f, 0.1500f, 0.8950f, 0.1900f, 0.9920f, 5000.0000f, 250.0000f, 0.0000f, 0x0 }
/* NOLINTEND */
#endif /* EFX_PRESETS_H */ #endif /* EFX_PRESETS_H */

View file

@ -1,8 +1,6 @@
#ifndef AL_EFX_H #ifndef AL_EFX_H
#define AL_EFX_H #define AL_EFX_H
/* NOLINTBEGIN */
#include <float.h>
#include "alc.h" #include "alc.h"
#include "al.h" #include "al.h"
@ -205,80 +203,80 @@ extern "C" {
/* Effect object function types. */ /* Effect object function types. */
typedef void (AL_APIENTRY *LPALGENEFFECTS)(ALsizei, ALuint*) AL_API_NOEXCEPT17; typedef void (AL_APIENTRY *LPALGENEFFECTS)(ALsizei, ALuint*);
typedef void (AL_APIENTRY *LPALDELETEEFFECTS)(ALsizei, const ALuint*) AL_API_NOEXCEPT17; typedef void (AL_APIENTRY *LPALDELETEEFFECTS)(ALsizei, const ALuint*);
typedef ALboolean (AL_APIENTRY *LPALISEFFECT)(ALuint) AL_API_NOEXCEPT17; typedef ALboolean (AL_APIENTRY *LPALISEFFECT)(ALuint);
typedef void (AL_APIENTRY *LPALEFFECTI)(ALuint, ALenum, ALint) AL_API_NOEXCEPT17; typedef void (AL_APIENTRY *LPALEFFECTI)(ALuint, ALenum, ALint);
typedef void (AL_APIENTRY *LPALEFFECTIV)(ALuint, ALenum, const ALint*) AL_API_NOEXCEPT17; typedef void (AL_APIENTRY *LPALEFFECTIV)(ALuint, ALenum, const ALint*);
typedef void (AL_APIENTRY *LPALEFFECTF)(ALuint, ALenum, ALfloat) AL_API_NOEXCEPT17; typedef void (AL_APIENTRY *LPALEFFECTF)(ALuint, ALenum, ALfloat);
typedef void (AL_APIENTRY *LPALEFFECTFV)(ALuint, ALenum, const ALfloat*) AL_API_NOEXCEPT17; typedef void (AL_APIENTRY *LPALEFFECTFV)(ALuint, ALenum, const ALfloat*);
typedef void (AL_APIENTRY *LPALGETEFFECTI)(ALuint, ALenum, ALint*) AL_API_NOEXCEPT17; typedef void (AL_APIENTRY *LPALGETEFFECTI)(ALuint, ALenum, ALint*);
typedef void (AL_APIENTRY *LPALGETEFFECTIV)(ALuint, ALenum, ALint*) AL_API_NOEXCEPT17; typedef void (AL_APIENTRY *LPALGETEFFECTIV)(ALuint, ALenum, ALint*);
typedef void (AL_APIENTRY *LPALGETEFFECTF)(ALuint, ALenum, ALfloat*) AL_API_NOEXCEPT17; typedef void (AL_APIENTRY *LPALGETEFFECTF)(ALuint, ALenum, ALfloat*);
typedef void (AL_APIENTRY *LPALGETEFFECTFV)(ALuint, ALenum, ALfloat*) AL_API_NOEXCEPT17; typedef void (AL_APIENTRY *LPALGETEFFECTFV)(ALuint, ALenum, ALfloat*);
/* Filter object function types. */ /* Filter object function types. */
typedef void (AL_APIENTRY *LPALGENFILTERS)(ALsizei, ALuint*) AL_API_NOEXCEPT17; typedef void (AL_APIENTRY *LPALGENFILTERS)(ALsizei, ALuint*);
typedef void (AL_APIENTRY *LPALDELETEFILTERS)(ALsizei, const ALuint*) AL_API_NOEXCEPT17; typedef void (AL_APIENTRY *LPALDELETEFILTERS)(ALsizei, const ALuint*);
typedef ALboolean (AL_APIENTRY *LPALISFILTER)(ALuint) AL_API_NOEXCEPT17; typedef ALboolean (AL_APIENTRY *LPALISFILTER)(ALuint);
typedef void (AL_APIENTRY *LPALFILTERI)(ALuint, ALenum, ALint) AL_API_NOEXCEPT17; typedef void (AL_APIENTRY *LPALFILTERI)(ALuint, ALenum, ALint);
typedef void (AL_APIENTRY *LPALFILTERIV)(ALuint, ALenum, const ALint*) AL_API_NOEXCEPT17; typedef void (AL_APIENTRY *LPALFILTERIV)(ALuint, ALenum, const ALint*);
typedef void (AL_APIENTRY *LPALFILTERF)(ALuint, ALenum, ALfloat) AL_API_NOEXCEPT17; typedef void (AL_APIENTRY *LPALFILTERF)(ALuint, ALenum, ALfloat);
typedef void (AL_APIENTRY *LPALFILTERFV)(ALuint, ALenum, const ALfloat*) AL_API_NOEXCEPT17; typedef void (AL_APIENTRY *LPALFILTERFV)(ALuint, ALenum, const ALfloat*);
typedef void (AL_APIENTRY *LPALGETFILTERI)(ALuint, ALenum, ALint*) AL_API_NOEXCEPT17; typedef void (AL_APIENTRY *LPALGETFILTERI)(ALuint, ALenum, ALint*);
typedef void (AL_APIENTRY *LPALGETFILTERIV)(ALuint, ALenum, ALint*) AL_API_NOEXCEPT17; typedef void (AL_APIENTRY *LPALGETFILTERIV)(ALuint, ALenum, ALint*);
typedef void (AL_APIENTRY *LPALGETFILTERF)(ALuint, ALenum, ALfloat*) AL_API_NOEXCEPT17; typedef void (AL_APIENTRY *LPALGETFILTERF)(ALuint, ALenum, ALfloat*);
typedef void (AL_APIENTRY *LPALGETFILTERFV)(ALuint, ALenum, ALfloat*) AL_API_NOEXCEPT17; typedef void (AL_APIENTRY *LPALGETFILTERFV)(ALuint, ALenum, ALfloat*);
/* Auxiliary Effect Slot object function types. */ /* Auxiliary Effect Slot object function types. */
typedef void (AL_APIENTRY *LPALGENAUXILIARYEFFECTSLOTS)(ALsizei, ALuint*) AL_API_NOEXCEPT17; typedef void (AL_APIENTRY *LPALGENAUXILIARYEFFECTSLOTS)(ALsizei, ALuint*);
typedef void (AL_APIENTRY *LPALDELETEAUXILIARYEFFECTSLOTS)(ALsizei, const ALuint*) AL_API_NOEXCEPT17; typedef void (AL_APIENTRY *LPALDELETEAUXILIARYEFFECTSLOTS)(ALsizei, const ALuint*);
typedef ALboolean (AL_APIENTRY *LPALISAUXILIARYEFFECTSLOT)(ALuint) AL_API_NOEXCEPT17; typedef ALboolean (AL_APIENTRY *LPALISAUXILIARYEFFECTSLOT)(ALuint);
typedef void (AL_APIENTRY *LPALAUXILIARYEFFECTSLOTI)(ALuint, ALenum, ALint) AL_API_NOEXCEPT17; typedef void (AL_APIENTRY *LPALAUXILIARYEFFECTSLOTI)(ALuint, ALenum, ALint);
typedef void (AL_APIENTRY *LPALAUXILIARYEFFECTSLOTIV)(ALuint, ALenum, const ALint*) AL_API_NOEXCEPT17; typedef void (AL_APIENTRY *LPALAUXILIARYEFFECTSLOTIV)(ALuint, ALenum, const ALint*);
typedef void (AL_APIENTRY *LPALAUXILIARYEFFECTSLOTF)(ALuint, ALenum, ALfloat) AL_API_NOEXCEPT17; typedef void (AL_APIENTRY *LPALAUXILIARYEFFECTSLOTF)(ALuint, ALenum, ALfloat);
typedef void (AL_APIENTRY *LPALAUXILIARYEFFECTSLOTFV)(ALuint, ALenum, const ALfloat*) AL_API_NOEXCEPT17; typedef void (AL_APIENTRY *LPALAUXILIARYEFFECTSLOTFV)(ALuint, ALenum, const ALfloat*);
typedef void (AL_APIENTRY *LPALGETAUXILIARYEFFECTSLOTI)(ALuint, ALenum, ALint*) AL_API_NOEXCEPT17; typedef void (AL_APIENTRY *LPALGETAUXILIARYEFFECTSLOTI)(ALuint, ALenum, ALint*);
typedef void (AL_APIENTRY *LPALGETAUXILIARYEFFECTSLOTIV)(ALuint, ALenum, ALint*) AL_API_NOEXCEPT17; typedef void (AL_APIENTRY *LPALGETAUXILIARYEFFECTSLOTIV)(ALuint, ALenum, ALint*);
typedef void (AL_APIENTRY *LPALGETAUXILIARYEFFECTSLOTF)(ALuint, ALenum, ALfloat*) AL_API_NOEXCEPT17; typedef void (AL_APIENTRY *LPALGETAUXILIARYEFFECTSLOTF)(ALuint, ALenum, ALfloat*);
typedef void (AL_APIENTRY *LPALGETAUXILIARYEFFECTSLOTFV)(ALuint, ALenum, ALfloat*) AL_API_NOEXCEPT17; typedef void (AL_APIENTRY *LPALGETAUXILIARYEFFECTSLOTFV)(ALuint, ALenum, ALfloat*);
#ifdef AL_ALEXT_PROTOTYPES #ifdef AL_ALEXT_PROTOTYPES
AL_API void AL_APIENTRY alGenEffects(ALsizei n, ALuint *effects) AL_API_NOEXCEPT; AL_API ALvoid AL_APIENTRY alGenEffects(ALsizei n, ALuint *effects);
AL_API void AL_APIENTRY alDeleteEffects(ALsizei n, const ALuint *effects) AL_API_NOEXCEPT; AL_API ALvoid AL_APIENTRY alDeleteEffects(ALsizei n, const ALuint *effects);
AL_API ALboolean AL_APIENTRY alIsEffect(ALuint effect) AL_API_NOEXCEPT; AL_API ALboolean AL_APIENTRY alIsEffect(ALuint effect);
AL_API void AL_APIENTRY alEffecti(ALuint effect, ALenum param, ALint iValue) AL_API_NOEXCEPT; AL_API ALvoid AL_APIENTRY alEffecti(ALuint effect, ALenum param, ALint iValue);
AL_API void AL_APIENTRY alEffectiv(ALuint effect, ALenum param, const ALint *piValues) AL_API_NOEXCEPT; AL_API ALvoid AL_APIENTRY alEffectiv(ALuint effect, ALenum param, const ALint *piValues);
AL_API void AL_APIENTRY alEffectf(ALuint effect, ALenum param, ALfloat flValue) AL_API_NOEXCEPT; AL_API ALvoid AL_APIENTRY alEffectf(ALuint effect, ALenum param, ALfloat flValue);
AL_API void AL_APIENTRY alEffectfv(ALuint effect, ALenum param, const ALfloat *pflValues) AL_API_NOEXCEPT; AL_API ALvoid AL_APIENTRY alEffectfv(ALuint effect, ALenum param, const ALfloat *pflValues);
AL_API void AL_APIENTRY alGetEffecti(ALuint effect, ALenum param, ALint *piValue) AL_API_NOEXCEPT; AL_API ALvoid AL_APIENTRY alGetEffecti(ALuint effect, ALenum param, ALint *piValue);
AL_API void AL_APIENTRY alGetEffectiv(ALuint effect, ALenum param, ALint *piValues) AL_API_NOEXCEPT; AL_API ALvoid AL_APIENTRY alGetEffectiv(ALuint effect, ALenum param, ALint *piValues);
AL_API void AL_APIENTRY alGetEffectf(ALuint effect, ALenum param, ALfloat *pflValue) AL_API_NOEXCEPT; AL_API ALvoid AL_APIENTRY alGetEffectf(ALuint effect, ALenum param, ALfloat *pflValue);
AL_API void AL_APIENTRY alGetEffectfv(ALuint effect, ALenum param, ALfloat *pflValues) AL_API_NOEXCEPT; AL_API ALvoid AL_APIENTRY alGetEffectfv(ALuint effect, ALenum param, ALfloat *pflValues);
AL_API void AL_APIENTRY alGenFilters(ALsizei n, ALuint *filters) AL_API_NOEXCEPT; AL_API ALvoid AL_APIENTRY alGenFilters(ALsizei n, ALuint *filters);
AL_API void AL_APIENTRY alDeleteFilters(ALsizei n, const ALuint *filters) AL_API_NOEXCEPT; AL_API ALvoid AL_APIENTRY alDeleteFilters(ALsizei n, const ALuint *filters);
AL_API ALboolean AL_APIENTRY alIsFilter(ALuint filter) AL_API_NOEXCEPT; AL_API ALboolean AL_APIENTRY alIsFilter(ALuint filter);
AL_API void AL_APIENTRY alFilteri(ALuint filter, ALenum param, ALint iValue) AL_API_NOEXCEPT; AL_API ALvoid AL_APIENTRY alFilteri(ALuint filter, ALenum param, ALint iValue);
AL_API void AL_APIENTRY alFilteriv(ALuint filter, ALenum param, const ALint *piValues) AL_API_NOEXCEPT; AL_API ALvoid AL_APIENTRY alFilteriv(ALuint filter, ALenum param, const ALint *piValues);
AL_API void AL_APIENTRY alFilterf(ALuint filter, ALenum param, ALfloat flValue) AL_API_NOEXCEPT; AL_API ALvoid AL_APIENTRY alFilterf(ALuint filter, ALenum param, ALfloat flValue);
AL_API void AL_APIENTRY alFilterfv(ALuint filter, ALenum param, const ALfloat *pflValues) AL_API_NOEXCEPT; AL_API ALvoid AL_APIENTRY alFilterfv(ALuint filter, ALenum param, const ALfloat *pflValues);
AL_API void AL_APIENTRY alGetFilteri(ALuint filter, ALenum param, ALint *piValue) AL_API_NOEXCEPT; AL_API ALvoid AL_APIENTRY alGetFilteri(ALuint filter, ALenum param, ALint *piValue);
AL_API void AL_APIENTRY alGetFilteriv(ALuint filter, ALenum param, ALint *piValues) AL_API_NOEXCEPT; AL_API ALvoid AL_APIENTRY alGetFilteriv(ALuint filter, ALenum param, ALint *piValues);
AL_API void AL_APIENTRY alGetFilterf(ALuint filter, ALenum param, ALfloat *pflValue) AL_API_NOEXCEPT; AL_API ALvoid AL_APIENTRY alGetFilterf(ALuint filter, ALenum param, ALfloat *pflValue);
AL_API void AL_APIENTRY alGetFilterfv(ALuint filter, ALenum param, ALfloat *pflValues) AL_API_NOEXCEPT; AL_API ALvoid AL_APIENTRY alGetFilterfv(ALuint filter, ALenum param, ALfloat *pflValues);
AL_API void AL_APIENTRY alGenAuxiliaryEffectSlots(ALsizei n, ALuint *effectslots) AL_API_NOEXCEPT; AL_API ALvoid AL_APIENTRY alGenAuxiliaryEffectSlots(ALsizei n, ALuint *effectslots);
AL_API void AL_APIENTRY alDeleteAuxiliaryEffectSlots(ALsizei n, const ALuint *effectslots) AL_API_NOEXCEPT; AL_API ALvoid AL_APIENTRY alDeleteAuxiliaryEffectSlots(ALsizei n, const ALuint *effectslots);
AL_API ALboolean AL_APIENTRY alIsAuxiliaryEffectSlot(ALuint effectslot) AL_API_NOEXCEPT; AL_API ALboolean AL_APIENTRY alIsAuxiliaryEffectSlot(ALuint effectslot);
AL_API void AL_APIENTRY alAuxiliaryEffectSloti(ALuint effectslot, ALenum param, ALint iValue) AL_API_NOEXCEPT; AL_API ALvoid AL_APIENTRY alAuxiliaryEffectSloti(ALuint effectslot, ALenum param, ALint iValue);
AL_API void AL_APIENTRY alAuxiliaryEffectSlotiv(ALuint effectslot, ALenum param, const ALint *piValues) AL_API_NOEXCEPT; AL_API ALvoid AL_APIENTRY alAuxiliaryEffectSlotiv(ALuint effectslot, ALenum param, const ALint *piValues);
AL_API void AL_APIENTRY alAuxiliaryEffectSlotf(ALuint effectslot, ALenum param, ALfloat flValue) AL_API_NOEXCEPT; AL_API ALvoid AL_APIENTRY alAuxiliaryEffectSlotf(ALuint effectslot, ALenum param, ALfloat flValue);
AL_API void AL_APIENTRY alAuxiliaryEffectSlotfv(ALuint effectslot, ALenum param, const ALfloat *pflValues) AL_API_NOEXCEPT; AL_API ALvoid AL_APIENTRY alAuxiliaryEffectSlotfv(ALuint effectslot, ALenum param, const ALfloat *pflValues);
AL_API void AL_APIENTRY alGetAuxiliaryEffectSloti(ALuint effectslot, ALenum param, ALint *piValue) AL_API_NOEXCEPT; AL_API ALvoid AL_APIENTRY alGetAuxiliaryEffectSloti(ALuint effectslot, ALenum param, ALint *piValue);
AL_API void AL_APIENTRY alGetAuxiliaryEffectSlotiv(ALuint effectslot, ALenum param, ALint *piValues) AL_API_NOEXCEPT; AL_API ALvoid AL_APIENTRY alGetAuxiliaryEffectSlotiv(ALuint effectslot, ALenum param, ALint *piValues);
AL_API void AL_APIENTRY alGetAuxiliaryEffectSlotf(ALuint effectslot, ALenum param, ALfloat *pflValue) AL_API_NOEXCEPT; AL_API ALvoid AL_APIENTRY alGetAuxiliaryEffectSlotf(ALuint effectslot, ALenum param, ALfloat *pflValue);
AL_API void AL_APIENTRY alGetAuxiliaryEffectSlotfv(ALuint effectslot, ALenum param, ALfloat *pflValues) AL_API_NOEXCEPT; AL_API ALvoid AL_APIENTRY alGetAuxiliaryEffectSlotfv(ALuint effectslot, ALenum param, ALfloat *pflValues);
#endif #endif
/* Filter ranges and defaults. */ /* Filter ranges and defaults. */
@ -759,6 +757,5 @@ AL_API void AL_APIENTRY alGetAuxiliaryEffectSlotfv(ALuint effectslot, ALenum par
#ifdef __cplusplus #ifdef __cplusplus
} /* extern "C" */ } /* extern "C" */
#endif #endif
/* NOLINTEND */
#endif /* AL_EFX_H */ #endif /* AL_EFX_H */

View file

@ -1,5 +1,3 @@
cmake_minimum_required(VERSION 3.12)
project(Launcher) project(Launcher)
set(LAUNCHER_SOURCES "${CMAKE_SOURCE_DIR}/code/Launcher/launch_main.cpp") set(LAUNCHER_SOURCES "${CMAKE_SOURCE_DIR}/code/Launcher/launch_main.cpp")

View file

@ -38,9 +38,9 @@ const char* targetGameList[] =
int main(int argc, const char* argv[]) { int main(int argc, const char* argv[]) {
std::vector<std::string> argumentList; std::vector<std::string> argumentList;
#if !defined(DEDICATED) || !DEDICATED #if !defined(DEDICATED) || !DEDICATED
const char* programName = "openmohaa" ARCH_SUFFIX DLL_SUFFIX EXE_EXT; const char* programName = "openmohaa" "." ARCH_STRING DLL_SUFFIX EXE_EXT;
#else #else
const char* programName = "omohaaded" ARCH_SUFFIX DLL_SUFFIX EXE_EXT; const char* programName = "omohaaded" "." ARCH_STRING DLL_SUFFIX EXE_EXT;
#endif #endif
argumentList.push_back("+set"); argumentList.push_back("+set");

View file

@ -1,4 +1,4 @@
cmake_minimum_required(VERSION 3.12) cmake_minimum_required(VERSION 3.5)
project(cgame) project(cgame)
# Shared source files for modules # Shared source files for modules

View file

@ -3866,7 +3866,7 @@ void ClientGameCommandManager::PlaySound(
} }
if (!name || !soundAlias) { if (!name || !soundAlias) {
cgi.DPrintf( Com_Printf(
"\nERROR PlaySound: %s needs an alias in ubersound.scr or uberdialog.scr - Please fix.\n", "\nERROR PlaySound: %s needs an alias in ubersound.scr or uberdialog.scr - Please fix.\n",
sound_name.c_str() sound_name.c_str()
); );
@ -4066,7 +4066,7 @@ void ClientGameCommandManager::StopAliasChannel(Event *ev)
} }
if (!name || !soundAlias) { if (!name || !soundAlias) {
cgi.DPrintf("\nERROR stopaliaschannel: couldn't find alias %s\n", sound_name.c_str()); Com_Printf("\nERROR stopaliaschannel: couldn't find alias %s\n", sound_name.c_str());
return; return;
} }
@ -4145,8 +4145,8 @@ void ClientGameCommandManager::StopLoopSound(Event* ev)
return; return;
} }
cgi.DPrintf("\n\nClientGameCommandManager::StopLoopSound\n\n"); Com_Printf("\n\nClientGameCommandManager::StopLoopSound\n\n");
current_centity->tikiLoopSound = (sfxHandle_t)0; current_centity->tikiLoopSound = NULL;
} }
//=============== //===============
@ -4265,7 +4265,7 @@ qboolean bLoadForMap(const char *psMapsBuffer, const char *name)
} }
if (!token || !token[0]) { if (!token || !token[0]) {
cgi.DPrintf("ERROR bLoadForMap: %s alias with empty maps specification.\n", name); Com_Printf("ERROR bLoadForMap: %s alias with empty maps specification.\n", name);
return false; return false;
} }
@ -5179,7 +5179,7 @@ void CG_ProcessInitCommands(dtiki_t *tiki, refEntity_t *ent)
} }
if (!commandManager.SelectProcessEvent(ev)) { if (!commandManager.SelectProcessEvent(ev)) {
cgi.DPrintf( Com_Printf(
"^~^~^ CG_ProcessInitCommands: Bad init client command '%s' in '%s'\n", pcmd->args[0], tiki->name "^~^~^ CG_ProcessInitCommands: Bad init client command '%s' in '%s'\n", pcmd->args[0], tiki->name
); );
} }
@ -5225,7 +5225,7 @@ void CG_ProcessCacheInitCommands(dtiki_t *tiki)
} }
if (!commandManager.SelectProcessEvent(ev)) { if (!commandManager.SelectProcessEvent(ev)) {
cgi.DPrintf( Com_Printf(
"^~^~^ CG_ProcessInitCommands: Bad init client command '%s' in '%s'\n", pcmd->args[0], tiki->name "^~^~^ CG_ProcessInitCommands: Bad init client command '%s' in '%s'\n", pcmd->args[0], tiki->name
); );
} }
@ -5298,7 +5298,7 @@ qboolean CG_ProcessEntityCommands(int frame, int anim, int entnum, refEntity_t *
current_centity = cent; current_centity = cent;
current_entity_number = entnum; current_entity_number = entnum;
current_tiki = ent->tiki; current_tiki = ent->tiki;
CG_AnimationDebugMessage(entnum, "Processing Ent Commands: Entity: %3d Anim:#(%i) Frame:#(%i)\n", entnum, anim, frame); CG_AnimationDebugMessage(entnum, "Processing Ent Commands: Entity: %3d Anim:#(%i) Frame:#(%i)\n", anim, frame);
for (i = 0; i < tikicmds.num_cmds; i++) { for (i = 0; i < tikicmds.num_cmds; i++) {
Event *ev; Event *ev;
@ -5840,7 +5840,7 @@ void ClientGameCommandManager::SetCurrentTiki(Event *ev)
str tikiName; str tikiName;
if (ev->NumArgs() != 1) { if (ev->NumArgs() != 1) {
cgi.DPrintf("ERROR: settiki command takes 1 parameter.\n"); Com_Printf("ERROR: settiki command takes 1 parameter.\n");
return; return;
} }

View file

@ -705,5 +705,5 @@ int CG_WeaponCommandButtonBits(void)
cg.iWeaponCommand = 0; cg.iWeaponCommand = 0;
} }
return iShiftedWeaponCommand & GetWeaponCommandMask(cg_protocol >= PROTOCOL_MOHTA_MIN ? WEAPON_COMMAND_MAX_VER17 : WEAPON_COMMAND_MAX_VER6); return iShiftedWeaponCommand & WEAPON_COMMAND_MASK;
} }

View file

@ -1,6 +1,6 @@
/* /*
=========================================================================== ===========================================================================
Copyright (C) 2025 the OpenMoHAA team Copyright (C) 2023 the OpenMoHAA team
This file is part of OpenMoHAA source code. This file is part of OpenMoHAA source code.
@ -191,8 +191,8 @@ void CG_DrawDisconnect(void)
} }
handle = cgi.R_RegisterShader("gfx/2d/net.tga"); handle = cgi.R_RegisterShader("gfx/2d/net.tga");
w = cgi.R_GetShaderWidth(handle) * cgs.uiHiResScale[0]; w = cgi.R_GetShaderWidth(handle);
h = cgi.R_GetShaderHeight(handle) * cgs.uiHiResScale[1]; h = cgi.R_GetShaderHeight(handle);
x = ((float)cgs.glconfig.vidWidth - w) * 0.5; x = ((float)cgs.glconfig.vidWidth - w) * 0.5;
y = (float)cgs.glconfig.vidHeight - h; y = (float)cgs.glconfig.vidHeight - h;
@ -331,7 +331,7 @@ static void CG_DrawPauseIcon()
x = (cgs.glconfig.vidWidth - w) / 2.f; x = (cgs.glconfig.vidWidth - w) / 2.f;
cgi.R_SetColor(colorWhite); cgi.R_SetColor(colorWhite);
cgi.R_DrawStretchPic(x, y, w * cgs.uiHiResScale[0], h * cgs.uiHiResScale[1], 0, 0, 1, 1, handle); cgi.R_DrawStretchPic(x, y, w, h, 0, 0, 1, 1, handle);
} }
static void CG_DrawServerLag() static void CG_DrawServerLag()
@ -362,8 +362,8 @@ static void CG_DrawServerLag()
} }
handle = cgi.R_RegisterShader("gfx/2d/slowserver"); handle = cgi.R_RegisterShader("gfx/2d/slowserver");
w = (float)cgi.R_GetShaderWidth(handle) * cgs.uiHiResScale[0] / 4; w = (float)cgi.R_GetShaderWidth(handle) / 4;
h = (float)cgi.R_GetShaderHeight(handle) * cgs.uiHiResScale[1] / 4; h = (float)cgi.R_GetShaderHeight(handle) / 4;
x = ((float)cgs.glconfig.vidWidth - w) / 2; x = ((float)cgs.glconfig.vidWidth - w) / 2;
y = (float)cgs.glconfig.vidHeight - h; y = (float)cgs.glconfig.vidHeight - h;
cgi.R_DrawStretchPic(x, y, w, h, 0.0, 0.0, 1.0, 1.0, handle); cgi.R_DrawStretchPic(x, y, w, h, 0.0, 0.0, 1.0, 1.0, handle);
@ -580,15 +580,11 @@ void CG_HudDrawElements()
int i; int i;
float fX, fY; float fX, fY;
float fWidth, fHeight; float fWidth, fHeight;
vec2_t virtualScale;
if (!cg_huddraw_force->integer && !cg_hud->integer) { if (!cg_huddraw_force->integer && !cg_hud->integer) {
return; return;
} }
virtualScale[0] = cgs.glconfig.vidWidth / 640.0;
virtualScale[1] = cgs.glconfig.vidHeight / 480.0;
for (i = 0; i < MAX_HUDDRAW_ELEMENTS; i++) { for (i = 0; i < MAX_HUDDRAW_ELEMENTS; i++) {
if ((!cgi.HudDrawElements[i].hShader && !cgi.HudDrawElements[i].string[0]) if ((!cgi.HudDrawElements[i].hShader && !cgi.HudDrawElements[i].string[0])
|| !cgi.HudDrawElements[i].vColor[3]) { || !cgi.HudDrawElements[i].vColor[3]) {
@ -601,13 +597,6 @@ void CG_HudDrawElements()
fWidth = cgi.HudDrawElements[i].iWidth; fWidth = cgi.HudDrawElements[i].iWidth;
fHeight = cgi.HudDrawElements[i].iHeight; fHeight = cgi.HudDrawElements[i].iHeight;
if (!cgi.HudDrawElements[i].bVirtualScreen) {
fWidth *= cgs.uiHiResScale[0];
fHeight *= cgs.uiHiResScale[1];
fX *= cgs.uiHiResScale[0];
fY *= cgs.uiHiResScale[1];
}
if (cgi.HudDrawElements[i].iHorizontalAlign == HUD_ALIGN_X_CENTER) { if (cgi.HudDrawElements[i].iHorizontalAlign == HUD_ALIGN_X_CENTER) {
if (cgi.HudDrawElements[i].bVirtualScreen) { if (cgi.HudDrawElements[i].bVirtualScreen) {
fX += 320.0 - fWidth * 0.5; fX += 320.0 - fWidth * 0.5;
@ -638,21 +627,23 @@ void CG_HudDrawElements()
cgi.R_SetColor(cgi.HudDrawElements[i].vColor); cgi.R_SetColor(cgi.HudDrawElements[i].vColor);
if (cgi.HudDrawElements[i].string[0]) { if (cgi.HudDrawElements[i].string[0]) {
fontheader_t *pFont = cgi.HudDrawElements[i].pFont; if (cgi.HudDrawElements[i].pFont) {
if (!pFont) { cgi.R_DrawString(
pFont = cgs.media.hudDrawFont; cgi.HudDrawElements[i].pFont,
} cgi.LV_ConvertString(cgi.HudDrawElements[i].string),
fX,
if (cgi.HudDrawElements[i].bVirtualScreen) { fY,
cgi.R_DrawString(pFont, cgi.LV_ConvertString(cgi.HudDrawElements[i].string), fX, fY, -1, virtualScale); -1,
cgi.HudDrawElements[i].bVirtualScreen
);
} else { } else {
cgi.R_DrawString( cgi.R_DrawString(
pFont, cgs.media.hudDrawFont,
cgi.LV_ConvertString(cgi.HudDrawElements[i].string), cgi.LV_ConvertString(cgi.HudDrawElements[i].string),
fX / cgs.uiHiResScale[0], fX,
fY / cgs.uiHiResScale[1], fY,
-1, -1,
cgs.uiHiResScale cgi.HudDrawElements[i].bVirtualScreen
); );
} }
} else { } else {
@ -743,17 +734,7 @@ void CG_DrawObjectives()
vColor[0] = 0.2f; vColor[0] = 0.2f;
vColor[3] = cg.ObjectivesCurrentAlpha * 0.75; vColor[3] = cg.ObjectivesCurrentAlpha * 0.75;
cgi.R_SetColor(vColor); cgi.R_SetColor(vColor);
cgi.R_DrawStretchPic( cgi.R_DrawStretchPic(fX, fY, 450.0, fWidth, 0.0, 0.0, 1.0, 1.0, cgs.media.objectivesBackShader);
fX,
fY,
450.0 * cgs.uiHiResScale[0],
fWidth * cgs.uiHiResScale[1],
0.0,
0.0,
1.0,
1.0,
cgs.media.objectivesBackShader
);
fX = 30.0; fX = 30.0;
fY = fObjectivesTop + 10; fY = fObjectivesTop + 10;
@ -762,25 +743,11 @@ void CG_DrawObjectives()
vColor[2] = 1.0; vColor[2] = 1.0;
vColor[3] = cg.ObjectivesCurrentAlpha; vColor[3] = cg.ObjectivesCurrentAlpha;
cgi.R_SetColor(vColor); cgi.R_SetColor(vColor);
cgi.R_DrawString( cgi.R_DrawString(cgs.media.objectiveFont, cgi.LV_ConvertString("Mission Objectives:"), fX, fY, -1, 0);
cgs.media.objectiveFont,
cgi.LV_ConvertString("Mission Objectives:"),
fX,
fY / cgs.uiHiResScale[1],
-1,
cgs.uiHiResScale
);
fY = fY + 5.0; fY = fY + 5.0;
cgi.R_DrawString( cgi.R_DrawString(cgs.media.objectiveFont, "_______________________________________________________", fX, fY, -1, 0);
cgs.media.objectiveFont, fHeight = fObjectivesTop + 35;
"_______________________________________________________",
fX,
fY / cgs.uiHiResScale[1],
-1,
cgs.uiHiResScale
);
fHeight = fObjectivesTop + 35 * cgs.uiHiResScale[1];
for (i = 0; i < MAX_OBJECTIVES; ++i) { for (i = 0; i < MAX_OBJECTIVES; ++i) {
qhandle_t hBoxShader; qhandle_t hBoxShader;
@ -818,14 +785,7 @@ void CG_DrawObjectives()
cgi.R_SetColor(vColor); cgi.R_SetColor(vColor);
fX = 55.0; fX = 55.0;
fY = fHeight; fY = fHeight;
cgi.R_DrawString( cgi.R_DrawString(cgs.media.objectiveFont, cgi.LV_ConvertString(cg.Objectives[i].text), 55.0, fHeight, -1, 0);
cgs.media.objectiveFont,
cgi.LV_ConvertString(cg.Objectives[i].text),
55.0,
fY / cgs.uiHiResScale[1],
-1,
cgs.uiHiResScale
);
fX = 30.0; fX = 30.0;
fY = fHeight; fY = fHeight;
@ -834,19 +794,9 @@ void CG_DrawObjectives()
vColor[2] = 1.0; vColor[2] = 1.0;
vColor[3] = cg.ObjectivesCurrentAlpha; vColor[3] = cg.ObjectivesCurrentAlpha;
cgi.R_SetColor(vColor); cgi.R_SetColor(vColor);
cgi.R_DrawStretchPic( cgi.R_DrawStretchPic(fX, fY, 16.0, 16.0, 0.0, 0.0, 1.0, 1.0, hBoxShader);
fX * cgs.uiHiResScale[0],
fY,
16.0 * cgs.uiHiResScale[0],
16.0 * cgs.uiHiResScale[1],
0.0,
0.0,
1.0,
1.0,
hBoxShader
);
fHeight += iNumLines[i] * 12 + 25 * cgs.uiHiResScale[1]; fHeight += iNumLines[i] * 12 + 25;
} }
} }
@ -870,17 +820,7 @@ void CG_DrawPlayerTeam()
if (handle) { if (handle) {
cgi.R_SetColor(NULL); cgi.R_SetColor(NULL);
cgi.R_DrawStretchPic( cgi.R_DrawStretchPic(96.0, cgs.glconfig.vidHeight - 46, 24.0, 24.0, 0.0, 0.0, 1.0, 1.0, handle);
96.0 * cgs.uiHiResScale[0],
cgs.glconfig.vidHeight - 46 * cgs.uiHiResScale[1],
24.0 * cgs.uiHiResScale[0],
24.0 * cgs.uiHiResScale[1],
0.0,
0.0,
1.0,
1.0,
handle
);
} }
} }
@ -922,28 +862,13 @@ void CG_DrawPlayerEntInfo()
if (handle) { if (handle) {
cgi.R_SetColor(0); cgi.R_SetColor(0);
cgi.R_DrawStretchPic( cgi.R_DrawStretchPic(56.0, fY, 16.0, 16.0, 0.0, 0.0, 1.0, 1.0, handle);
fX, fY, 16.0 * cgs.uiHiResScale[0], 16.0 * cgs.uiHiResScale[1], 0.0, 0.0, 1.0, 1.0, handle fX = 56.0 + 24.0;
);
} }
cgi.R_SetColor(color); cgi.R_SetColor(color);
cgi.R_DrawString( cgi.R_DrawString(cgs.media.hudDrawFont, (char *)pszName, fX, fY, -1, 0);
cgs.media.hudDrawFont, cgi.R_DrawString(cgs.media.hudDrawFont, va("%i", cg.snap->ps.stats[STAT_INFOCLIENT_HEALTH]), fX, fY + 20.0, -1, 0);
(char *)pszName,
fX / cgs.uiHiResScale[0] + 24.0,
fY / cgs.uiHiResScale[1],
-1,
cgs.uiHiResScale
);
cgi.R_DrawString(
cgs.media.hudDrawFont,
va("%i", cg.snap->ps.stats[STAT_INFOCLIENT_HEALTH]),
fX / cgs.uiHiResScale[0] + 24.0,
fY / cgs.uiHiResScale[1] + 20.0,
-1,
cgs.uiHiResScale
);
} }
void CG_UpdateAttackerDisplay() void CG_UpdateAttackerDisplay()
@ -982,17 +907,7 @@ void CG_UpdateAttackerDisplay()
if (handle) { if (handle) {
cgi.R_SetColor(0); cgi.R_SetColor(0);
cgi.R_DrawStretchPic( cgi.R_DrawStretchPic(56.0, fY, 24.0, 24.0, 0.0, 0.0, 1.0, 1.0, handle);
56.0 * cgs.uiHiResScale[0],
fY,
24.0 * cgs.uiHiResScale[0],
24.0 * cgs.uiHiResScale[1],
0.0,
0.0,
1.0,
1.0,
handle
);
} }
if ((cg.snap->ps.stats[STAT_TEAM] == TEAM_ALLIES || cg.snap->ps.stats[STAT_TEAM] == TEAM_AXIS) if ((cg.snap->ps.stats[STAT_TEAM] == TEAM_ALLIES || cg.snap->ps.stats[STAT_TEAM] == TEAM_AXIS)
@ -1006,7 +921,7 @@ void CG_UpdateAttackerDisplay()
color[2] = 0.5; color[2] = 0.5;
} }
fX = 56.0; fX = 56.0 + 32.0;
} else { } else {
color[0] = 1.0; color[0] = 1.0;
color[1] = 0.5; color[1] = 0.5;
@ -1014,9 +929,7 @@ void CG_UpdateAttackerDisplay()
} }
cgi.R_SetColor(color); cgi.R_SetColor(color);
cgi.R_DrawString( cgi.R_DrawString(cgs.media.attackerFont, pszName, fX, fY, -1, 0);
cgs.media.attackerFont, pszName, fX / cgs.uiHiResScale[0] + 32.0, fY / cgs.uiHiResScale[1], -1, cgs.uiHiResScale
);
} }
void CG_UpdateCountdown() void CG_UpdateCountdown()
@ -1047,8 +960,7 @@ void CG_UpdateCountdown()
} }
} }
static void CG_RemoveStopwatch() static void CG_RemoveStopwatch() {
{
cgi.Cmd_Execute(EXEC_NOW, "ui_removehud hud_stopwatch\n"); cgi.Cmd_Execute(EXEC_NOW, "ui_removehud hud_stopwatch\n");
cgi.Cmd_Execute(EXEC_NOW, "ui_removehud hud_fuse\n"); cgi.Cmd_Execute(EXEC_NOW, "ui_removehud hud_fuse\n");
cgi.Cmd_Execute(EXEC_NOW, "ui_removehud hud_fuse_wet\n"); cgi.Cmd_Execute(EXEC_NOW, "ui_removehud hud_fuse_wet\n");
@ -1131,9 +1043,7 @@ void CG_DrawInstantMessageMenu()
x = 8.0; x = 8.0;
y = ((float)cgs.glconfig.vidHeight - h) * 0.5; y = ((float)cgs.glconfig.vidHeight - h) * 0.5;
cgi.R_SetColor(0); cgi.R_SetColor(0);
cgi.R_DrawStretchPic( cgi.R_DrawStretchPic(x, y, w, h, 0.0, 0.0, 1.0, 1.0, handle);
x * cgs.uiHiResScale[0], y, w * cgs.uiHiResScale[0], h * cgs.uiHiResScale[1], 0.0, 0.0, 1.0, 1.0, handle
);
} }
void CG_DrawSpectatorView_ver_15() void CG_DrawSpectatorView_ver_15()
@ -1156,14 +1066,10 @@ void CG_DrawSpectatorView_ver_15()
if (!bOnTeam) { if (!bOnTeam) {
cgi.Key_GetKeysForCommand("+attackprimary", &iKey1, &iKey2); cgi.Key_GetKeysForCommand("+attackprimary", &iKey1, &iKey2);
pszString = cgi.LV_ConvertString(va("Press Fire(%s) to join the battle!", cgi.Key_KeynumToBindString(iKey1))); pszString = cgi.LV_ConvertString(va("Press Fire(%s) to join the battle!", cgi.Key_KeynumToBindString(iKey1)));
fX = (float)(cgs.glconfig.vidWidth fX = (float)(cgs.glconfig.vidWidth - cgi.UI_FontStringWidth(cgs.media.attackerFont, pszString, -1)) * 0.5;
- cgi.UI_FontStringWidth(cgs.media.attackerFont, pszString, -1) * cgs.uiHiResScale[0]) fY = cgs.glconfig.vidHeight - 64.0;
* 0.5;
fY = cgs.glconfig.vidHeight - 64.0 * cgs.uiHiResScale[1];
cgi.R_SetColor(NULL); cgi.R_SetColor(NULL);
cgi.R_DrawString( cgi.R_DrawString(cgs.media.attackerFont, pszString, fX, fY, -1, qfalse);
cgs.media.attackerFont, pszString, fX / cgs.uiHiResScale[0], fY / cgs.uiHiResScale[1], -1, cgs.uiHiResScale
);
} }
if (cg.predicted_player_state.pm_flags & PMF_CAMERA_VIEW) { if (cg.predicted_player_state.pm_flags & PMF_CAMERA_VIEW) {
@ -1176,14 +1082,10 @@ void CG_DrawSpectatorView_ver_15()
cgi.Key_KeynumToBindString(iKey1b)) cgi.Key_KeynumToBindString(iKey1b))
); );
fX = (float)(cgs.glconfig.vidWidth fX = (float)(cgs.glconfig.vidWidth - cgi.UI_FontStringWidth(cgs.media.attackerFont, pszString, -1)) * 0.5;
- cgi.UI_FontStringWidth(cgs.media.attackerFont, pszString, -1) * cgs.uiHiResScale[0]) fY = (float)cgs.glconfig.vidHeight - 40.0;
* 0.5;
fY = (float)cgs.glconfig.vidHeight - 40.0 * cgs.uiHiResScale[1];
cgi.R_SetColor(0); cgi.R_SetColor(0);
cgi.R_DrawString( cgi.R_DrawString(cgs.media.attackerFont, pszString, fX, fY, -1, 0);
cgs.media.attackerFont, pszString, fX / cgs.uiHiResScale[0], fY / cgs.uiHiResScale[1], -1, cgs.uiHiResScale
);
} }
if (!bOnTeam && (cg.predicted_player_state.pm_flags & PMF_CAMERA_VIEW)) { if (!bOnTeam && (cg.predicted_player_state.pm_flags & PMF_CAMERA_VIEW)) {
@ -1191,14 +1093,10 @@ void CG_DrawSpectatorView_ver_15()
pszString = pszString =
cgi.LV_ConvertString(va("Press Use(%s) to enter free spectate mode.", cgi.Key_KeynumToBindString(iKey1))); cgi.LV_ConvertString(va("Press Use(%s) to enter free spectate mode.", cgi.Key_KeynumToBindString(iKey1)));
fX = (float)(cgs.glconfig.vidWidth fX = (float)(cgs.glconfig.vidWidth - cgi.UI_FontStringWidth(cgs.media.attackerFont, pszString, -1)) * 0.5;
- cgi.UI_FontStringWidth(cgs.media.attackerFont, pszString, -1) * cgs.uiHiResScale[0]) fY = (float)cgs.glconfig.vidHeight - 24.0;
* 0.5;
fY = (float)cgs.glconfig.vidHeight - 24.0 * cgs.uiHiResScale[1];
cgi.R_SetColor(0); cgi.R_SetColor(0);
cgi.R_DrawString( cgi.R_DrawString(cgs.media.attackerFont, pszString, fX, fY, -1, 0);
cgs.media.attackerFont, pszString, fX / cgs.uiHiResScale[0], fY / cgs.uiHiResScale[1], -1, cgs.uiHiResScale
);
} }
if (!(cg.predicted_player_state.pm_flags & PMF_CAMERA_VIEW)) { if (!(cg.predicted_player_state.pm_flags & PMF_CAMERA_VIEW)) {
@ -1208,27 +1106,20 @@ void CG_DrawSpectatorView_ver_15()
va("Press Use(%s) to enter player following spectate mode.", cgi.Key_KeynumToBindString(iKey1)) va("Press Use(%s) to enter player following spectate mode.", cgi.Key_KeynumToBindString(iKey1))
); );
fX = (float)(cgs.glconfig.vidWidth fX = (float)(cgs.glconfig.vidWidth - cgi.UI_FontStringWidth(cgs.media.attackerFont, pszString, -1)) * 0.5;
- cgi.UI_FontStringWidth(cgs.media.attackerFont, pszString, -1) * cgs.uiHiResScale[0]) fY = (float)cgs.glconfig.vidHeight - 24.0;
* 0.5;
fY = (float)cgs.glconfig.vidHeight - 24.0 * cgs.uiHiResScale[1];
cgi.R_SetColor(0); cgi.R_SetColor(0);
cgi.R_DrawString( cgi.R_DrawString(cgs.media.attackerFont, pszString, fX, fY, -1, 0);
cgs.media.attackerFont, pszString, fX / cgs.uiHiResScale[0], fY / cgs.uiHiResScale[1], -1, cgs.uiHiResScale
);
} }
if ((cg.predicted_player_state.pm_flags & PMF_CAMERA_VIEW) != 0 && cg.snap if ((cg.predicted_player_state.pm_flags & 0x80) != 0 && cg.snap && cg.snap->ps.stats[STAT_INFOCLIENT] != -1) {
&& cg.snap->ps.stats[STAT_INFOCLIENT] != -1) {
int iClientNum; int iClientNum;
qhandle_t hShader; qhandle_t hShader;
vec4_t color; vec4_t color;
char buf[128]; char buf[128];
iClientNum = cg.snap->ps.stats[STAT_INFOCLIENT]; iClientNum = cg.snap->ps.stats[STAT_INFOCLIENT];
Com_sprintf( Com_sprintf(buf, sizeof(buf), "%s : %i", cg.clientinfo[iClientNum].name, cg.snap->ps.stats[STAT_INFOCLIENT_HEALTH]);
buf, sizeof(buf), "%s : %i", cg.clientinfo[iClientNum].name, cg.snap->ps.stats[STAT_INFOCLIENT_HEALTH]
);
hShader = 0; hShader = 0;
color[0] = 0.5; color[0] = 0.5;
@ -1236,14 +1127,10 @@ void CG_DrawSpectatorView_ver_15()
color[2] = 0.5; color[2] = 0.5;
color[3] = 1.0; color[3] = 1.0;
fX = (float)(cgs.glconfig.vidWidth fX = (float)(cgs.glconfig.vidWidth - cgi.UI_FontStringWidth(cgs.media.attackerFont, pszString, -1) - 16) * 0.5;
- (cgi.UI_FontStringWidth(cgs.media.attackerFont, pszString, -1) - 16) * cgs.uiHiResScale[0]) fY = (float)cgs.glconfig.vidHeight - 80.0;
* 0.5;
fY = (float)cgs.glconfig.vidHeight - 80.0 * cgs.uiHiResScale[1];
cgi.R_SetColor(color); cgi.R_SetColor(color);
cgi.R_DrawString( cgi.R_DrawString(cgs.media.attackerFont, buf, fX, fY, -1, 0);
cgs.media.attackerFont, buf, fX / cgs.uiHiResScale[0], fY / cgs.uiHiResScale[1], -1, cgs.uiHiResScale
);
if (cg.clientinfo[iClientNum].team == TEAM_ALLIES) { if (cg.clientinfo[iClientNum].team == TEAM_ALLIES) {
hShader = cgi.R_RegisterShader("textures/hud/allies"); hShader = cgi.R_RegisterShader("textures/hud/allies");
@ -1252,18 +1139,9 @@ void CG_DrawSpectatorView_ver_15()
} }
if (hShader) { if (hShader) {
fX -= 20.0;
cgi.R_SetColor(NULL); cgi.R_SetColor(NULL);
cgi.R_DrawStretchPic( cgi.R_DrawStretchPic(fX, fY, 16.0, 16.0, 0.0, 0.0, 1.0, 1.0, hShader);
fX - 20.0 * cgs.uiHiResScale[0],
fY,
16.0 * cgs.uiHiResScale[0],
16.0 * cgs.uiHiResScale[1],
0.0,
0.0,
1.0,
1.0,
hShader
);
} }
} }
} }
@ -1295,14 +1173,10 @@ void CG_DrawSpectatorView_ver_6()
pszString = cgi.LV_ConvertString(va("Press Use(%s) to follow a player.", cgi.Key_KeynumToBindString(iKey1))); pszString = cgi.LV_ConvertString(va("Press Use(%s) to follow a player.", cgi.Key_KeynumToBindString(iKey1)));
} }
fX = (float)(cgs.glconfig.vidWidth fX = (float)(cgs.glconfig.vidWidth - cgi.UI_FontStringWidth(cgs.media.attackerFont, pszString, -1)) * 0.5;
- cgi.UI_FontStringWidth(cgs.media.attackerFont, pszString, -1) * cgs.uiHiResScale[0]) fY = (float)cgs.glconfig.vidHeight - 40.0;
* 0.5;
fY = (float)cgs.glconfig.vidHeight - 40.0 * cgs.uiHiResScale[1];
cgi.R_SetColor(0); cgi.R_SetColor(0);
cgi.R_DrawString( cgi.R_DrawString(cgs.media.attackerFont, pszString, fX, fY, -1, 0);
cgs.media.attackerFont, pszString, fX / cgs.uiHiResScale[0], fY / cgs.uiHiResScale[1], -1, cgs.uiHiResScale
);
if (!bOnTeam && (cg.predicted_player_state.pm_flags & PMF_CAMERA_VIEW)) { if (!bOnTeam && (cg.predicted_player_state.pm_flags & PMF_CAMERA_VIEW)) {
cgi.Key_GetKeysForCommand("+moveup", &iKey1, &iKey2); cgi.Key_GetKeysForCommand("+moveup", &iKey1, &iKey2);
@ -1313,14 +1187,10 @@ void CG_DrawSpectatorView_ver_6()
cgi.Key_KeynumToBindString(iKey1b)) cgi.Key_KeynumToBindString(iKey1b))
); );
fX = (float)(cgs.glconfig.vidWidth fX = (float)(cgs.glconfig.vidWidth - cgi.UI_FontStringWidth(cgs.media.attackerFont, pszString, -1)) * 0.5;
- cgi.UI_FontStringWidth(cgs.media.attackerFont, pszString, -1) * cgs.uiHiResScale[0]) fY = (float)cgs.glconfig.vidHeight - 24.0;
* 0.5;
fY = (float)cgs.glconfig.vidHeight - 24.0 * cgs.uiHiResScale[1];
cgi.R_SetColor(0); cgi.R_SetColor(0);
cgi.R_DrawString( cgi.R_DrawString(cgs.media.attackerFont, pszString, fX, fY, -1, 0);
cgs.media.attackerFont, pszString, fX / cgs.uiHiResScale[0], fY / cgs.uiHiResScale[1], -1, cgs.uiHiResScale
);
} }
} }
@ -1363,9 +1233,6 @@ void CG_DrawCrosshair()
return; return;
} }
// Fixed in OPM: R_RegisterShaderNoMip
// Use R_RegisterShaderNoMip, as it's UI stuff
if (cgs.gametype != GT_FFA) { if (cgs.gametype != GT_FFA) {
AngleVectorsLeft(cg.refdefViewAngles, forward, NULL, NULL); AngleVectorsLeft(cg.refdefViewAngles, forward, NULL, NULL);
@ -1393,23 +1260,23 @@ void CG_DrawCrosshair()
|| ((myFlags & EF_AXIS) && (friendEnt->currentState.eFlags & EF_AXIS))) { || ((myFlags & EF_AXIS) && (friendEnt->currentState.eFlags & EF_AXIS))) {
// friend // friend
if (cg.snap->ps.stats[STAT_CROSSHAIR]) { if (cg.snap->ps.stats[STAT_CROSSHAIR]) {
shader = cgi.R_RegisterShaderNoMip(cg_crosshair_friend->string); shader = cgi.R_RegisterShader(cg_crosshair_friend->string);
} }
} else { } else {
// enemy // enemy
if (cg.snap->ps.stats[STAT_CROSSHAIR]) { if (cg.snap->ps.stats[STAT_CROSSHAIR]) {
shader = cgi.R_RegisterShaderNoMip(cg_crosshair->string); shader = cgi.R_RegisterShader(cg_crosshair->string);
} }
} }
} else { } else {
if (cg.snap->ps.stats[STAT_CROSSHAIR]) { if (cg.snap->ps.stats[STAT_CROSSHAIR]) {
shader = cgi.R_RegisterShaderNoMip(cg_crosshair->string); shader = cgi.R_RegisterShader(cg_crosshair->string);
} }
} }
} else { } else {
// FFA // FFA
if (cg.snap->ps.stats[STAT_CROSSHAIR]) { if (cg.snap->ps.stats[STAT_CROSSHAIR]) {
shader = cgi.R_RegisterShaderNoMip(cg_crosshair->string); shader = cgi.R_RegisterShader(cg_crosshair->string);
} }
} }
@ -1420,7 +1287,7 @@ void CG_DrawCrosshair()
y = (cgs.glconfig.vidHeight - height) * 0.5f; y = (cgs.glconfig.vidHeight - height) * 0.5f;
cgi.R_SetColor(NULL); cgi.R_SetColor(NULL);
cgi.R_DrawStretchPic(x, y, width * cgs.uiHiResScale[0], height * cgs.uiHiResScale[1], 0, 0, 1, 1, shader); cgi.R_DrawStretchPic(x, y, width, height, 0, 0, 1, 1, shader);
} }
} }
@ -1451,17 +1318,15 @@ void CG_DrawVote()
percentNo = cgs.numVotesNo * 100 / (cgs.numUndecidedVotes + cgs.numVotesNo + cgs.numVotesYes); percentNo = cgs.numVotesNo * 100 / (cgs.numUndecidedVotes + cgs.numVotesNo + cgs.numVotesYes);
percentUndecided = cgs.numUndecidedVotes * 100 / (cgs.numUndecidedVotes + cgs.numVotesNo + cgs.numVotesYes); percentUndecided = cgs.numUndecidedVotes * 100 / (cgs.numUndecidedVotes + cgs.numVotesNo + cgs.numVotesYes);
x = 8 * cgs.uiHiResScale[0]; x = 8;
y = ((cgs.glconfig.vidHeight > 480) ? (cgs.glconfig.vidHeight * 0.725f) : (cgs.glconfig.vidHeight * 0.75f)); y = (cgs.glconfig.vidHeight > 480) ? (cgs.glconfig.vidHeight * 0.725f) : (cgs.glconfig.vidHeight * 0.75f);
cgi.R_SetColor(NULL); cgi.R_SetColor(NULL);
text = va("%s: %s", cgi.LV_ConvertString("Vote Running"), cgs.voteString); text = va("%s: %s", cgi.LV_ConvertString("Vote Running"), cgs.voteString);
cgi.R_DrawString( cgi.R_DrawString(cgs.media.attackerFont, text, x, y, -1, qfalse);
cgs.media.attackerFont, text, x / cgs.uiHiResScale[0], y / cgs.uiHiResScale[1], -1, cgs.uiHiResScale
);
y += 12 * cgs.uiHiResScale[1]; y += 12;
text = text =
va("%s: %isec %s: %i%% %s: %i%% %s: %i%%", va("%s: %isec %s: %i%% %s: %i%% %s: %i%%",
@ -1473,9 +1338,7 @@ void CG_DrawVote()
percentNo, percentNo,
cgi.LV_ConvertString("Undecided"), cgi.LV_ConvertString("Undecided"),
percentUndecided); percentUndecided);
cgi.R_DrawString( cgi.R_DrawString(cgs.media.attackerFont, text, x, y, -1, qfalse);
cgs.media.attackerFont, text, x / cgs.uiHiResScale[0], y / cgs.uiHiResScale[1], -1, cgs.uiHiResScale
);
if (cg.snap && !cg.snap->ps.voted) { if (cg.snap && !cg.snap->ps.voted) {
col[0] = 0.5; col[0] = 0.5;
@ -1484,19 +1347,15 @@ void CG_DrawVote()
col[3] = 1.0; col[3] = 1.0;
cgi.R_SetColor(col); cgi.R_SetColor(col);
y += 12 * cgs.uiHiResScale[1]; y += 12;
text = cgi.LV_ConvertString("Vote now, it's your patriotic duty!"); text = cgi.LV_ConvertString("Vote now, it's your patriotic duty!");
cgi.R_DrawString( cgi.R_DrawString(cgs.media.attackerFont, text, x, y, -1, qfalse);
cgs.media.attackerFont, text, x / cgs.uiHiResScale[0], y / cgs.uiHiResScale[1], -1, cgs.uiHiResScale
);
y += 12 * cgs.uiHiResScale[1]; y += 12;
text = cgi.LV_ConvertString("To vote Yes, press F1. To vote No, press F2."); text = cgi.LV_ConvertString("To vote Yes, press F1. To vote No, press F2.");
cgi.R_DrawString( cgi.R_DrawString(cgs.media.attackerFont, text, x, y, -1, qfalse);
cgs.media.attackerFont, text, x / cgs.uiHiResScale[0], y / cgs.uiHiResScale[1], -1, cgs.uiHiResScale
);
cgi.R_SetColor(NULL); cgi.R_SetColor(NULL);
} }
} }

View file

@ -270,8 +270,6 @@ extern "C" {
qhandle_t hAlliedPlayerModelHandle; qhandle_t hAlliedPlayerModelHandle;
dtiki_t *pAxisPlayerModel; dtiki_t *pAxisPlayerModel;
qhandle_t hAxisPlayerModelHandle; qhandle_t hAxisPlayerModelHandle;
qboolean serverAlliedModelValid;
qboolean serverAxisModelValid;
// view eyes // view eyes
vec3_t vOffsetViewAngles; vec3_t vOffsetViewAngles;
@ -382,7 +380,6 @@ extern "C" {
float screenXScale; // derived from glconfig float screenXScale; // derived from glconfig
float screenYScale; float screenYScale;
float screenXBias; float screenXBias;
vec2_t uiHiResScale;
int serverCommandSequence; // reliable command stream counter int serverCommandSequence; // reliable command stream counter
int processedSnapshotNum; // the number of snapshots cgame has requested int processedSnapshotNum; // the number of snapshots cgame has requested
@ -508,16 +505,9 @@ extern "C" {
extern cvar_t *cg_shadowdebug; extern cvar_t *cg_shadowdebug;
extern cvar_t *ui_timemessage; extern cvar_t *ui_timemessage;
//
// Added in OPM
//
extern cvar_t *cg_fov;
extern cvar_t *cg_cheats;
// //
// cg_main.c // cg_main.c
// //
qboolean CG_UseLargeLightmaps(const char* mapName);
void CG_ProcessConfigString(int num, qboolean modelOnly); void CG_ProcessConfigString(int num, qboolean modelOnly);
const char *CG_ConfigString(int index); const char *CG_ConfigString(int index);
void CG_AddToTeamChat(const char *str); void CG_AddToTeamChat(const char *str);
@ -533,9 +523,6 @@ extern "C" {
// //
// cg_modelanim.cpp // cg_modelanim.cpp
// //
void CG_ProcessPlayerModel();
void CG_ServerModelLoaded(const char* name, qhandle_t handle);
void CG_ServerModelUnloaded(qhandle_t handle);
void CG_ModelAnim(centity_t *cent, qboolean bDoShaderTime); void CG_ModelAnim(centity_t *cent, qboolean bDoShaderTime);
void CG_AttachEntity( void CG_AttachEntity(
refEntity_t *entity, refEntity_t *parent, dtiki_t *tiki, int tagnum, qboolean use_angles, vec3_t attach_offset refEntity_t *entity, refEntity_t *parent, dtiki_t *tiki, int tagnum, qboolean use_angles, vec3_t attach_offset

View file

@ -112,12 +112,6 @@ cvar_t *cg_shadowscount;
cvar_t *cg_shadowdebug; cvar_t *cg_shadowdebug;
cvar_t *ui_timemessage; cvar_t *ui_timemessage;
//
// Added in OPM
//
cvar_t *cg_fov;
cvar_t *cg_cheats;
/* /*
================= =================
CG_RegisterCvars CG_RegisterCvars
@ -209,32 +203,6 @@ void CG_RegisterCvars(void)
// see if we are also running the server on this machine // see if we are also running the server on this machine
temp = cgi.Cvar_Get("sv_running", "0", 0); temp = cgi.Cvar_Get("sv_running", "0", 0);
cgs.localServer = temp->integer; cgs.localServer = temp->integer;
//
// Added in OPM
//
cg_fov = cgi.Cvar_Get("cg_fov", "80", CVAR_ARCHIVE);
cg_cheats = cgi.Cvar_Get("cheats", "0", CVAR_USERINFO | CVAR_SERVERINFO | CVAR_LATCH);
}
/*
===============
CG_UseLargeLightmaps
Added in 2.0
Returns true if the standard BSP file should be used, false if the smaller lightmap BSP file should be used
===============
*/
qboolean CG_UseLargeLightmaps(const char* mapName) {
char buffer[MAX_QPATH];
Com_sprintf(buffer, sizeof(buffer), "maps/%s_sml.bsp", mapName);
if (cgi.FS_ReadFile(buffer, NULL, qtrue) == -1) {
return qtrue;
}
return cgi.Cvar_Get("r_largemap", "0", 0)->integer;
} }
/* /*
@ -367,8 +335,6 @@ void CG_ProcessConfigString(int num, qboolean modelOnly)
if (tiki) { if (tiki) {
CG_ProcessCacheInitCommands(tiki); CG_ProcessCacheInitCommands(tiki);
} }
CG_ServerModelLoaded(str, hModel);
} else { } else {
// clear out the model // clear out the model
if (hOldModel && CG_IsHandleUnique(hOldModel)) { if (hOldModel && CG_IsHandleUnique(hOldModel)) {
@ -376,10 +342,6 @@ void CG_ProcessConfigString(int num, qboolean modelOnly)
cgi.R_UnregisterServerModel(hOldModel); cgi.R_UnregisterServerModel(hOldModel);
} }
cgs.model_draw[num - CS_MODELS] = 0; cgs.model_draw[num - CS_MODELS] = 0;
if (!str || !str[0]) {
CG_ServerModelUnloaded(hOldModel);
}
} }
} }
@ -608,7 +570,6 @@ void CG_GetRendererConfig(void)
cgi.GetGlconfig(&cgs.glconfig); cgi.GetGlconfig(&cgs.glconfig);
cgs.screenXScale = cgs.glconfig.vidWidth / 640.0; cgs.screenXScale = cgs.glconfig.vidWidth / 640.0;
cgs.screenYScale = cgs.glconfig.vidHeight / 480.0; cgs.screenYScale = cgs.glconfig.vidHeight / 480.0;
cgi.UI_GetHighResolutionScale(cgs.uiHiResScale);
} }
/* /*

View file

@ -1,6 +1,6 @@
/* /*
=========================================================================== ===========================================================================
Copyright (C) 2025 the OpenMoHAA team Copyright (C) 2023 the OpenMoHAA team
This file is part of OpenMoHAA source code. This file is part of OpenMoHAA source code.
@ -26,33 +26,6 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
#include "cg_local.h" #include "cg_local.h"
#include "tiki.h" #include "tiki.h"
static qboolean cg_forceModelAllowed = qfalse;
/*
===============
CG_GetPlayerModelTiki
===============
*/
const char *CG_GetPlayerModelTiki(const char *modelName)
{
return va("models/player/%s.tik", modelName);
}
/*
===============
CG_GetPlayerLocalModelTiki
===============
*/
const char *CG_GetPlayerLocalModelTiki(const char *modelName)
{
return va("models/player/%s.tik", modelName);
}
/*
===============
CG_PlayerTeamIcon
===============
*/
void CG_PlayerTeamIcon(refEntity_t *pModel, entityState_t *pPlayerState) void CG_PlayerTeamIcon(refEntity_t *pModel, entityState_t *pPlayerState)
{ {
qboolean bInArtillery, bInTeam, bSpecialIcon; qboolean bInArtillery, bInTeam, bSpecialIcon;
@ -241,8 +214,7 @@ void CG_InterpolateAnimParms(entityState_t *state, entityState_t *sNext, refEnti
(sNext->frameInfo[i].weight - state->frameInfo[i].weight) * t + state->frameInfo[i].weight; (sNext->frameInfo[i].weight - state->frameInfo[i].weight) * t + state->frameInfo[i].weight;
if (sNext->frameInfo[i].time >= state->frameInfo[i].time) { if (sNext->frameInfo[i].time >= state->frameInfo[i].time) {
model->frameInfo[i].time = model->frameInfo[i].time = (sNext->frameInfo[i].time - state->frameInfo[i].time) * t + state->frameInfo[i].time;
(sNext->frameInfo[i].time - state->frameInfo[i].time) * t + state->frameInfo[i].time;
} else { } else {
animLength = cgi.Anim_Time(model->tiki, sNext->frameInfo[i].index); animLength = cgi.Anim_Time(model->tiki, sNext->frameInfo[i].index);
if (!animLength) { if (!animLength) {
@ -349,7 +321,8 @@ void CG_CastFootShadow(const vec_t *vLightPos, vec_t *vLightIntensity, int iTag,
VectorMA(vPos, vEnd[i], model->axis[i], vPos); VectorMA(vPos, vEnd[i], model->axis[i], vPos);
} }
if (cg_shadowdebug->integer) { if (cg_shadowdebug->integer)
{
vec3_t vDir; vec3_t vDir;
// //
@ -404,7 +377,8 @@ void CG_CastFootShadow(const vec_t *vLightPos, vec_t *vLightIntensity, int iTag,
VectorMA(vPos, -96.0, vDelta, vEnd); VectorMA(vPos, -96.0, vDelta, vEnd);
CG_Trace(&trace, vPos, vec3_origin, vec3_origin, vEnd, 0, MASK_FOOTSHADOW, qfalse, qtrue, "CG_CastFootShadow"); CG_Trace(&trace, vPos, vec3_origin, vec3_origin, vEnd, 0, MASK_FOOTSHADOW, qfalse, qtrue, "CG_CastFootShadow");
if (cg_shadowdebug->integer) { if (cg_shadowdebug->integer)
{
cgi.R_DebugLine(vPos, vLightPos, 0.75, 0.75, 0.5, 1.0); cgi.R_DebugLine(vPos, vLightPos, 0.75, 0.75, 0.5, 1.0);
cgi.R_DebugLine(vPos, vEnd, 1.0, 1.0, 1.0, 1.0); cgi.R_DebugLine(vPos, vEnd, 1.0, 1.0, 1.0, 1.0);
} }
@ -471,15 +445,7 @@ CG_CastSimpleFeetShadow
Cast basic feet shadow Cast basic feet shadow
=============== ===============
*/ */
void CG_CastSimpleFeetShadow( void CG_CastSimpleFeetShadow(const trace_t* pTrace, float fWidth, float fAlpha, int iRightTag, int iLeftTag, const dtiki_t* tiki, refEntity_t* model)
const trace_t *pTrace,
float fWidth,
float fAlpha,
int iRightTag,
int iLeftTag,
const dtiki_t *tiki,
refEntity_t *model
)
{ {
int i; int i;
float fShadowYaw; float fShadowYaw;
@ -589,8 +555,10 @@ qboolean CG_EntityShadow(centity_t *cent, refEntity_t *model)
iNumLights = Q_clamp(cg_shadowscount->integer, 1, 8); iNumLights = Q_clamp(cg_shadowscount->integer, 1, 8);
iNumLights = cgi.R_GatherLightSources(model->origin, avLightPos, avLightIntensity, iNumLights); iNumLights = cgi.R_GatherLightSources(model->origin, avLightPos, avLightIntensity, iNumLights);
if (iNumLights) { if (iNumLights)
for (iCurrLight = 0; iCurrLight < iNumLights; iCurrLight++) { {
for (iCurrLight = 0; iCurrLight < iNumLights; iCurrLight++)
{
CG_CastFootShadow(avLightPos[iCurrLight], avLightIntensity[iCurrLight], iTagL, model); CG_CastFootShadow(avLightPos[iCurrLight], avLightIntensity[iCurrLight], iTagL, model);
CG_CastFootShadow(avLightPos[iCurrLight], avLightIntensity[iCurrLight], iTagR, model); CG_CastFootShadow(avLightPos[iCurrLight], avLightIntensity[iCurrLight], iTagR, model);
} }
@ -757,11 +725,6 @@ void CG_AttachEntity(
VectorAdd(entity->origin, vOrigin, entity->lightingOrigin); VectorAdd(entity->origin, vOrigin, entity->lightingOrigin);
} }
/*
===============
CG_AttachEyeEntity
===============
*/
void CG_AttachEyeEntity( void CG_AttachEyeEntity(
refEntity_t *entity, refEntity_t *parent, dtiki_t *tiki, int tagnum, qboolean use_angles, vec_t *attach_offset refEntity_t *entity, refEntity_t *parent, dtiki_t *tiki, int tagnum, qboolean use_angles, vec_t *attach_offset
) )
@ -774,7 +737,8 @@ void CG_AttachEyeEntity(
AnglesToAxis(cg.refdefViewAngles, entity->axis); AnglesToAxis(cg.refdefViewAngles, entity->axis);
} }
if (attach_offset[0] || attach_offset[1] || attach_offset[2]) { if (attach_offset[0] || attach_offset[1] || attach_offset[2])
{
for (i = 0; i < 3; i++) { for (i = 0; i < 3; i++) {
VectorMA(entity->origin, attach_offset[i], entity->axis[i], entity->origin); VectorMA(entity->origin, attach_offset[i], entity->axis[i], entity->origin);
} }
@ -786,123 +750,6 @@ void CG_AttachEyeEntity(
VectorCopy(parent->lightingOrigin, entity->lightingOrigin); VectorCopy(parent->lightingOrigin, entity->lightingOrigin);
} }
/*
===============
CG_IsValidServerModel
===============
*/
qboolean CG_IsValidServerModel(const char *modelpath)
{
const char *str;
int i;
for (i = 1; i < MAX_MODELS; i++) {
str = CG_ConfigString(CS_MODELS + i);
if (!Q_stricmp(str, modelpath)) {
return qtrue;
}
}
return qfalse;
}
/*
===============
CG_CheckValidModels
This verifies the allied player model and the german player model:
- If they don't exist on the client, reset to the default allied player model
- If they don't exist on the server, don't allow forceModel so the client explicitly know the skin isn't supported
===============
*/
void CG_CheckValidModels()
{
const char *modelpath;
qboolean isDirty = qfalse;
if (dm_playermodel->modified) {
// Check for allied model
modelpath = va("models/player/%s.tik", dm_playermodel->string);
if (!cgi.R_RegisterModel(modelpath)) {
cgi.Printf(
"Allied model '%s' is invalid, resetting to '%s'\n", dm_playermodel->string, dm_playermodel->resetString
);
cgi.Cvar_Set("dm_playermodel", dm_playermodel->resetString);
modelpath = va("models/player/%s.tik", dm_playermodel->string);
}
cg.serverAlliedModelValid = CG_IsValidServerModel(modelpath);
}
if (dm_playergermanmodel->modified) {
// Check for axis model
modelpath = va("models/player/%s.tik", dm_playergermanmodel->string);
if (!cgi.R_RegisterModel(modelpath)) {
cgi.Printf(
"Allied model '%s' is invalid, resetting to '%s'\n",
dm_playergermanmodel->string,
dm_playergermanmodel->resetString
);
cgi.Cvar_Set("dm_playergermanmodel", dm_playergermanmodel->resetString);
modelpath = va("models/player/%s.tik", dm_playergermanmodel->string);
}
cg.serverAxisModelValid = CG_IsValidServerModel(modelpath);
}
if (dm_playermodel->modified || dm_playergermanmodel->modified) {
cg_forceModelAllowed = cg.serverAlliedModelValid && cg.serverAxisModelValid;
}
}
/*
===============
CG_ServerModelLoaded
===============
*/
void CG_ServerModelLoaded(const char *name, qhandle_t handle)
{
if (!Q_stricmpn(name, "models/player/", 14) && (!cg.serverAlliedModelValid || !cg.serverAxisModelValid)) {
char modelName[MAX_QPATH];
COM_StripExtension(name + 14, modelName, sizeof(modelName));
//
// The player model has been loaded on the server
// so try again parsing
//
if (!Q_stricmp(modelName, dm_playermodel->string)) {
dm_playermodel->modified = qtrue;
}
if (!Q_stricmp(modelName, dm_playergermanmodel->string)) {
dm_playergermanmodel->modified = qtrue;
}
}
}
/*
===============
CG_ServerModelUnloaded
===============
*/
void CG_ServerModelUnloaded(qhandle_t handle)
{
#if 0
if (cg.serverAlliedModelValid && handle == cg.hAlliedPlayerModelHandle) {
dm_playermodel->modified = qtrue;
}
if (cg.serverAxisModelValid && handle == cg.hAxisPlayerModelHandle) {
dm_playergermanmodel->modified = qtrue;
}
#endif
}
/*
===============
CG_UpdateForceModels
===============
*/
void CG_UpdateForceModels() void CG_UpdateForceModels()
{ {
qhandle_t hModel; qhandle_t hModel;
@ -910,22 +757,8 @@ void CG_UpdateForceModels()
char* pszAxisPartial; char* pszAxisPartial;
char szAlliesModel[256]; char szAlliesModel[256];
char szAxisModel[256]; char szAxisModel[256];
qboolean isDirty;
isDirty = dm_playermodel->modified || dm_playergermanmodel->modified || cg_forceModel->modified; if (cg.pAlliedPlayerModel && cg.pAxisPlayerModel && !dm_playermodel->modified && !dm_playergermanmodel->modified) {
if (!cg_forceModelAllowed) {
if (isDirty) {
cgi.Printf(
"One or more of the selected players model don't exist on the server or are not loaded, using the "
"default skin\n"
);
}
return;
}
if (cg.pAlliedPlayerModel && cg.pAxisPlayerModel && !isDirty) {
return; return;
} }
@ -934,12 +767,8 @@ void CG_UpdateForceModels()
Com_sprintf(szAlliesModel, sizeof(szAlliesModel), "models/player/%s.tik", pszAlliesPartial); Com_sprintf(szAlliesModel, sizeof(szAlliesModel), "models/player/%s.tik", pszAlliesPartial);
Com_sprintf(szAxisModel, sizeof(szAxisModel), "models/player/%s.tik", pszAxisPartial); Com_sprintf(szAxisModel, sizeof(szAxisModel), "models/player/%s.tik", pszAxisPartial);
hModel = cg.serverAlliedModelValid ? cgi.R_RegisterModel(szAlliesModel) : 0;
if (!hModel) {
Com_sprintf(szAlliesModel, sizeof(szAlliesModel), "models/player/%s.tik", dm_playermodel->resetString);
hModel = cgi.R_RegisterModel(szAlliesModel); hModel = cgi.R_RegisterModel(szAlliesModel);
} if (!hModel) hModel = cgi.R_RegisterModel("models/player/american_army.tik");
if (hModel) { if (hModel) {
cg.hAlliedPlayerModelHandle = hModel; cg.hAlliedPlayerModelHandle = hModel;
@ -949,14 +778,11 @@ void CG_UpdateForceModels()
} }
} else { } else {
cg.hAlliedPlayerModelHandle = 0; cg.hAlliedPlayerModelHandle = 0;
cg.pAlliedPlayerModel = NULL; cg.pAlliedPlayerModel = 0;
} }
hModel = cg.serverAxisModelValid ? cgi.R_RegisterModel(szAxisModel) : 0;
if (!hModel) {
Com_sprintf(szAxisModel, sizeof(szAxisModel), "models/player/%s.tik", dm_playergermanmodel->resetString);
hModel = cgi.R_RegisterModel(szAxisModel); hModel = cgi.R_RegisterModel(szAxisModel);
} if (!hModel) hModel = cgi.R_RegisterModel("models/player/german_wehrmacht_soldier.tik");
if (hModel) { if (hModel) {
cg.hAxisPlayerModelHandle = hModel; cg.hAxisPlayerModelHandle = hModel;
@ -969,36 +795,11 @@ void CG_UpdateForceModels()
cg.pAxisPlayerModel = 0; cg.pAxisPlayerModel = 0;
} }
// Clear modified flag
//dm_playermodel->modified = qfalse;
//dm_playergermanmodel->modified = qfalse;
}
/*
===============
CG_ProcessPlayerModel
Checks player models, and update force models
===============
*/
void CG_ProcessPlayerModel()
{
CG_CheckValidModels();
if (cg_forceModel->integer) {
CG_UpdateForceModels();
}
// Clear modified flag // Clear modified flag
dm_playermodel->modified = qfalse; dm_playermodel->modified = qfalse;
dm_playergermanmodel->modified = qfalse; dm_playergermanmodel->modified = qfalse;
cg_forceModel->modified = qfalse;
} }
/*
===============
CG_ModelAnim
===============
*/
void CG_ModelAnim(centity_t *cent, qboolean bDoShaderTime) void CG_ModelAnim(centity_t *cent, qboolean bDoShaderTime)
{ {
entityState_t *s1; entityState_t *s1;
@ -1139,8 +940,8 @@ void CG_ModelAnim(centity_t *cent, qboolean bDoShaderTime)
model.tiki = cgi.R_Model_GetHandle(cgs.model_draw[s1->modelindex]); model.tiki = cgi.R_Model_GetHandle(cgs.model_draw[s1->modelindex]);
if (s1->number != cg.snap->ps.clientNum && (s1->eType == ET_PLAYER || (s1->eFlags & EF_DEAD))) { if (s1->number != cg.snap->ps.clientNum && (s1->eType == ET_PLAYER || (s1->eFlags & EF_DEAD))) {
if (cg_forceModel->integer && cg_forceModelAllowed) { if (cg_forceModel->integer) {
//CG_UpdateForceModels(); CG_UpdateForceModels();
if (s1->eFlags & EF_AXIS) { if (s1->eFlags & EF_AXIS) {
model.hModel = cg.hAxisPlayerModelHandle; model.hModel = cg.hAxisPlayerModelHandle;
@ -1164,9 +965,9 @@ void CG_ModelAnim(centity_t *cent, qboolean bDoShaderTime)
if (!model.hModel || !model.tiki) { if (!model.hModel || !model.tiki) {
// Use a model in case it still doesn't exist // Use a model in case it still doesn't exist
if (s1->eFlags & EF_AXIS) { if (s1->eFlags & EF_AXIS) {
model.hModel = cgi.R_RegisterModel(CG_GetPlayerModelTiki(dm_playergermanmodel->resetString)); model.hModel = cgi.R_RegisterModel("models/player/german_wehrmacht_soldier.tik");
} else { } else {
model.hModel = cgi.R_RegisterModel(CG_GetPlayerModelTiki(dm_playermodel->resetString)); model.hModel = cgi.R_RegisterModel("models/player/american_army.tik");
} }
model.tiki = cgi.R_Model_GetHandle(model.hModel); model.tiki = cgi.R_Model_GetHandle(model.hModel);
model.hOldModel = cgs.model_draw[s1->modelindex]; model.hOldModel = cgs.model_draw[s1->modelindex];
@ -1399,9 +1200,7 @@ void CG_ModelAnim(centity_t *cent, qboolean bDoShaderTime)
if (!cg.pLastPlayerWorldModel || cg.pLastPlayerWorldModel != model.tiki) { if (!cg.pLastPlayerWorldModel || cg.pLastPlayerWorldModel != model.tiki) {
qhandle_t hModel; qhandle_t hModel;
char fpsname[128]; char fpsname[128];
COM_StripExtension(model.tiki->a->name, fpsname, sizeof(fpsname)); COM_StripExtension(model.tiki->a->name, fpsname, sizeof(fpsname));
Q_strcat(fpsname, sizeof(fpsname), "_fps.tik");
hModel = cgi.R_RegisterModel(fpsname); hModel = cgi.R_RegisterModel(fpsname);
if (hModel) { if (hModel) {
@ -1412,9 +1211,9 @@ void CG_ModelAnim(centity_t *cent, qboolean bDoShaderTime)
} }
} else { } else {
if (cg.snap->ps.stats[STAT_TEAM] == TEAM_AXIS) { if (cg.snap->ps.stats[STAT_TEAM] == TEAM_AXIS) {
hModel = cgi.R_RegisterModel(CG_GetPlayerLocalModelTiki(dm_playergermanmodel->resetString)); hModel = cgi.R_RegisterModel("models/player/german_wehrmacht_soldier_fps.tik");
} else { } else {
hModel = cgi.R_RegisterModel(CG_GetPlayerLocalModelTiki(dm_playermodel->resetString)); hModel = cgi.R_RegisterModel("models/player/american_army_fps.tik");
} }
if (hModel) { if (hModel) {

View file

@ -85,12 +85,7 @@ void CG_MakeBulletHoleSound(const vec3_t i_vPos, const vec3_t i_vNorm, int iLarg
iSurfType = SURF_PUDDLE; iSurfType = SURF_PUDDLE;
} }
if (trace.fraction == 1) { if (trace.fraction == 1.0f || trace.startsolid || (trace.surfaceFlags & SURF_SKY)) {
// no reason to make a sound if it nothing was hit
return;
}
if ((trace.surfaceFlags & SURF_SKY) || !CG_CheckMakeMarkOnEntity(trace.entityNum)) {
return; return;
} }
@ -258,12 +253,7 @@ CG_MakeBulletHole(const vec3_t i_vPos, const vec3_t i_vNorm, int iLarge, trace_t
iSurfType = SURF_PUDDLE; iSurfType = SURF_PUDDLE;
} }
if (trace.fraction == 1.0f || trace.startsolid) { if (trace.fraction == 1.0f || trace.startsolid || (trace.surfaceFlags & SURF_SKY)) {
return;
}
if (trace.surfaceFlags & SURF_SKY) {
// ignore sky surfaces
return; return;
} }
@ -489,11 +479,10 @@ static void CG_MakeBulletTracerInternal(
int iNumImpacts; int iNumImpacts;
trace_t tImpacts[128]; trace_t tImpacts[128];
float fImpSndDistRA; float fImpSndDistRA;
float fImpSndDistLA; static float fImpSndDistLA;
float fImpSndDistRB; float fImpSndDistRB;
float fImpSndDistLB; float fImpSndDistLB;
int iImpSndIndexRA; int iImpSndIndexRA;
int iImpSndIndexLA;
int iImpSndIndexRB; int iImpSndIndexRB;
int iImpSndIndexLB; int iImpSndIndexLB;
float fVolume; float fVolume;
@ -595,8 +584,7 @@ static void CG_MakeBulletTracerInternal(
|| (trace.contents & CONTENTS_WATER)) || (trace.contents & CONTENTS_WATER))
&& iContinueCount < 5) { && iContinueCount < 5) {
if (bInWater) { if (bInWater) {
VectorMA(trace.endpos, -1.0, vDir, vTmp); VectorSubtract(trace.endpos, vDir, vTmp);
if (!(trace.contents & CONTENTS_FLUID) && !(trace.surfaceFlags & SURF_PUDDLE) if (!(trace.contents & CONTENTS_FLUID) && !(trace.surfaceFlags & SURF_PUDDLE)
&& !(cgi.CM_PointContents(vTmp, 0) & CONTENTS_FLUID)) { && !(cgi.CM_PointContents(vTmp, 0) & CONTENTS_FLUID)) {
CG_MakeBubbleTrail(vTrailStart, trace.endpos, iLarge, alpha); CG_MakeBubbleTrail(vTrailStart, trace.endpos, iLarge, alpha);
@ -608,7 +596,8 @@ static void CG_MakeBulletTracerInternal(
bInWater = qtrue; bInWater = qtrue;
} }
VectorMA(trace.endpos, 2.0, vDir, vTraceStart); VectorAdd(vDir, vDir, vTraceStart);
VectorAdd(vTraceStart, vTraceStart, trace.endpos);
iContinueCount++; iContinueCount++;
} else { } else {
@ -670,30 +659,30 @@ static void CG_MakeBulletTracerInternal(
if (iNumImpacts > 2) { if (iNumImpacts > 2) {
fImpSndDistRA = 9999.0f; fImpSndDistRA = 9999.0f;
fImpSndDistRB = 9999.0f; fImpSndDistRB = 9999.0f;
fImpSndDistLA = 9999.0f;
fImpSndDistLB = 9999.0f;
iImpSndIndexRA = 0; iImpSndIndexRA = 0;
iImpSndIndexLA = 0;
iImpSndIndexRB = 0; iImpSndIndexRB = 0;
fImpSndDistLB = 9999.0f;
iImpSndIndexLB = 0; iImpSndIndexLB = 0;
for (iBullet = 0; iBullet < iNumImpacts; iBullet++) { for (iBullet = 0; iBullet < iNumImpacts; iBullet++) {
CG_MakeBulletHole( CG_MakeBulletHole(
tImpacts[iBullet].endpos, tImpacts[iBullet].plane.normal, iLarge, &tImpacts[iBullet], qfalse tImpacts[iImpSndIndexLB].endpos,
tImpacts[iImpSndIndexLB].plane.normal,
iLarge,
&tImpacts[iImpSndIndexLB],
qfalse
); );
VectorSubtract(tImpacts[iBullet].endpos, cg.SoundOrg, vTmp); VectorSubtract(tImpacts[iImpSndIndexLB].endpos, cg.SoundOrg, vTmp);
iHeadDist = VectorLength(vTmp); iHeadDist = VectorLength(vTmp);
if (DotProduct(vTmp, cg.SoundAxis[1]) <= 0.f) { if (DotProduct(vTmp, cg.SoundAxis[1]) <= 0.f) {
if (iHeadDist < fImpSndDistLA || iHeadDist < fImpSndDistLB) { if (iHeadDist < 9999.0f || iHeadDist < fImpSndDistLB) {
if (iHeadDist < fImpSndDistLA) { if (iHeadDist < 9999.0f) {
iImpSndIndexLB = iImpSndIndexLA;
fImpSndDistLB = fImpSndDistLA;
iImpSndIndexRA = iBullet;
fImpSndDistRA = iHeadDist; fImpSndDistRA = iHeadDist;
fImpSndDistLB = 9999.0;
iImpSndIndexRA = iBullet;
} else if (iHeadDist < fImpSndDistLB) { } else if (iHeadDist < fImpSndDistLB) {
iImpSndIndexLB = iBullet;
fImpSndDistLB = iHeadDist; fImpSndDistLB = iHeadDist;
} }
} }
@ -701,15 +690,15 @@ static void CG_MakeBulletTracerInternal(
if (iHeadDist < fImpSndDistRA || iHeadDist < fImpSndDistRB) { if (iHeadDist < fImpSndDistRA || iHeadDist < fImpSndDistRB) {
if (iHeadDist < fImpSndDistRA) { if (iHeadDist < fImpSndDistRA) {
iImpSndIndexRB = iImpSndIndexRA; iImpSndIndexRB = iImpSndIndexRA;
fImpSndDistRB = fImpSndDistRA;
iImpSndIndexRA = iBullet; iImpSndIndexRA = iBullet;
fImpSndDistRA = iHeadDist;
} else if (iHeadDist < fImpSndDistRB) { } else if (iHeadDist < fImpSndDistRB) {
iImpSndIndexRB = iBullet;
fImpSndDistRB = iHeadDist; fImpSndDistRB = iHeadDist;
iImpSndIndexRB = iBullet;
} }
} }
} }
iImpSndIndexLB++;
} }
if (fImpSndDistRA < 9999.0f) { if (fImpSndDistRA < 9999.0f) {
@ -729,24 +718,6 @@ static void CG_MakeBulletTracerInternal(
); );
} }
} }
if (fImpSndDistLA < 9999.0f) {
CG_MakeBulletHoleSound(
tImpacts[iImpSndIndexLA].endpos,
tImpacts[iImpSndIndexLA].plane.normal,
iLarge,
&tImpacts[iImpSndIndexLA]
);
if (fImpSndDistLB < 9999.0f) {
CG_MakeBulletHoleSound(
tImpacts[iImpSndIndexLB].endpos,
tImpacts[iImpSndIndexLB].plane.normal,
iLarge,
&tImpacts[iImpSndIndexLB]
);
}
}
} else { } else {
for (iBullet = 0; iBullet < iNumImpacts; iBullet++) { for (iBullet = 0; iBullet < iNumImpacts; iBullet++) {
CG_MakeBulletHole( CG_MakeBulletHole(
@ -1667,8 +1638,8 @@ void CG_ParseCGMessage_ver_15()
CG_HudDrawFont(iInfo); CG_HudDrawFont(iInfo);
break; break;
case CGM_NOTIFY_HIT:
case CGM_NOTIFY_KILL: case CGM_NOTIFY_KILL:
case CGM_NOTIFY_HIT:
if (cg.snap) { if (cg.snap) {
const char *soundName; const char *soundName;
int iOldEnt; int iOldEnt;
@ -1676,11 +1647,12 @@ void CG_ParseCGMessage_ver_15()
iOldEnt = current_entity_number; iOldEnt = current_entity_number;
current_entity_number = cg.snap->ps.clientNum; current_entity_number = cg.snap->ps.clientNum;
if (iType == CGM_NOTIFY_KILL) { if (iType == CGM_NOTIFY_HIT) {
commandManager.PlaySound("dm_kill_notify", NULL, CHAN_LOCAL, 2.0, -1, -1, 1); soundName = "dm_kill_notify";
} else { } else {
commandManager.PlaySound("dm_hit_notify", NULL, CHAN_LOCAL, 2.0, -1, -1, 1); soundName = "dm_hit_notify";
} }
commandManager.PlaySound(soundName, NULL, CHAN_LOCAL, 2.0, -1, -1, 1);
current_entity_number = iOldEnt; current_entity_number = iOldEnt;
} }
@ -2057,15 +2029,15 @@ void CG_ParseCGMessage_ver_6()
CG_HudDrawFont(iInfo); CG_HudDrawFont(iInfo);
break; break;
case CGM6_NOTIFY_HIT:
case CGM6_NOTIFY_KILL: case CGM6_NOTIFY_KILL:
case CGM6_NOTIFY_HIT:
if (cg.snap) { if (cg.snap) {
int iOldEnt; int iOldEnt;
iOldEnt = current_entity_number; iOldEnt = current_entity_number;
current_entity_number = cg.snap->ps.clientNum; current_entity_number = cg.snap->ps.clientNum;
if (iType == CGM6_NOTIFY_KILL) { if (iType == CGM6_NOTIFY_HIT) {
commandManager.PlaySound("dm_kill_notify", NULL, CHAN_LOCAL, 2.0, -1, -1, 1); commandManager.PlaySound("dm_kill_notify", NULL, CHAN_LOCAL, 2.0, -1, -1, 1);
} else { } else {
commandManager.PlaySound("dm_hit_notify", NULL, CHAN_LOCAL, 2.0, -1, -1, 1); commandManager.PlaySound("dm_hit_notify", NULL, CHAN_LOCAL, 2.0, -1, -1, 1);

View file

@ -330,17 +330,7 @@ static void CG_InterpolatePlayerStateCamera(void)
// //
VectorCopy(cg.predicted_player_state.camera_angles, cg.camera_angles); VectorCopy(cg.predicted_player_state.camera_angles, cg.camera_angles);
VectorCopy(cg.predicted_player_state.camera_origin, cg.camera_origin); VectorCopy(cg.predicted_player_state.camera_origin, cg.camera_origin);
//
// Added in OPM
// Use the specified fov specified by the server
// when zooming
//
if (cg.predicted_player_state.stats[STAT_INZOOM]) {
cg.camera_fov = cg.predicted_player_state.fov; cg.camera_fov = cg.predicted_player_state.fov;
} else {
cg.camera_fov = cg_fov->value;
}
// if the next frame is a teleport, we can't lerp to it // if the next frame is a teleport, we can't lerp to it
if (cg.nextFrameCameraCut) { if (cg.nextFrameCameraCut) {
@ -353,12 +343,8 @@ static void CG_InterpolatePlayerStateCamera(void)
f = (float)(cg.time - prev->serverTime) / (next->serverTime - prev->serverTime); f = (float)(cg.time - prev->serverTime) / (next->serverTime - prev->serverTime);
if (cg.predicted_player_state.stats[STAT_INZOOM]) {
// interpolate fov // interpolate fov
cg.camera_fov = prev->ps.fov + f * (next->ps.fov - prev->ps.fov); cg.camera_fov = prev->ps.fov + f * (next->ps.fov - prev->ps.fov);
} else {
cg.camera_fov = cg_fov->value;
}
if (!(cg.snap->ps.pm_flags & PMF_CAMERA_VIEW)) { if (!(cg.snap->ps.pm_flags & PMF_CAMERA_VIEW)) {
return; return;

View file

@ -122,7 +122,6 @@ functions exported to the main executable
cvar_t *(*Cvar_Get)(const char *var_name, const char *value, int flags); cvar_t *(*Cvar_Get)(const char *var_name, const char *value, int flags);
cvar_t *(*Cvar_Find)(const char *var_name); cvar_t *(*Cvar_Find)(const char *var_name);
void (*Cvar_Set)(const char *var_name, const char *value); void (*Cvar_Set)(const char *var_name, const char *value);
void (*Cvar_CheckRange)(cvar_t* var, float min, float max, qboolean integral);
// ClientCommand and ConsoleCommand parameter access // ClientCommand and ConsoleCommand parameter access
int (*Argc)(void); int (*Argc)(void);
@ -313,12 +312,12 @@ functions exported to the main executable
); // 0 = white ); // 0 = white
fontheader_t *(*R_LoadFont)(const char *name); fontheader_t *(*R_LoadFont)(const char *name);
void (*R_DrawString)( void (*R_DrawString)(
fontheader_t *font, const char *text, float x, float y, int maxLen, const float *pvVirtualScreen fontheader_t *font, const char *text, float x, float y, int maxLen, qboolean virtualScreen
); );
refEntity_t *(*R_GetRenderEntity)(int entityNumber); refEntity_t *(*R_GetRenderEntity)(int entityNumber);
void (*R_ModelBounds)(clipHandle_t model, vec3_t mins, vec3_t maxs); void (*R_ModelBounds)(clipHandle_t model, vec3_t mins, vec3_t maxs);
float (*R_ModelRadius)(clipHandle_t model); float (*R_ModelRadius)(clipHandle_t model);
float (*R_Noise)(float x, float y, float z, double t); float (*R_Noise)(float x, float y, float z, float t);
void (*R_DebugLine)(const vec3_t start, const vec3_t end, float r, float g, float b, float alpha); void (*R_DebugLine)(const vec3_t start, const vec3_t end, float r, float g, float b, float alpha);
baseshader_t *(*GetShader)(int shaderNum); baseshader_t *(*GetShader)(int shaderNum);
// =========== Swipes ============= // =========== Swipes =============
@ -364,7 +363,6 @@ functions exported to the main executable
int (*UI_FontStringWidth)(fontheader_t *font, const char *string, int maxLen); int (*UI_FontStringWidth)(fontheader_t *font, const char *string, int maxLen);
// Added in 2.0 // Added in 2.0
float (*UI_GetObjectivesTop)(void); float (*UI_GetObjectivesTop)(void);
void (*UI_GetHighResolutionScale)(vec2_t scale);
int (*Key_StringToKeynum)(const char *str); int (*Key_StringToKeynum)(const char *str);
const char *(*Key_KeynumToBindString)(int keyNum); const char *(*Key_KeynumToBindString)(int keyNum);

View file

@ -26,7 +26,8 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
#include "cg_local.h" #include "cg_local.h"
#include "../fgame/bg_voteoptions.h" #include "../fgame/bg_voteoptions.h"
#include "cg_servercmds_filter.h"
static qboolean CG_IsStatementFiltered(char *cmd);
/* /*
================ ================
@ -189,11 +190,7 @@ void CG_ParseServerinfo(void)
Q_strncpyz(map, mapname, sizeof(map)); Q_strncpyz(map, mapname, sizeof(map));
} }
if (CG_UseLargeLightmaps(mapname)) {
Com_sprintf(cgs.mapname, sizeof(cgs.mapname), "maps/%s.bsp", map); Com_sprintf(cgs.mapname, sizeof(cgs.mapname), "maps/%s.bsp", map);
} else {
Com_sprintf(cgs.mapname, sizeof(cgs.mapname), "maps/%s_sml.bsp", map);
}
// hide/show huds // hide/show huds
if (cgs.gametype) { if (cgs.gametype) {
@ -457,3 +454,233 @@ void CG_ExecuteNewServerCommands(int latestSequence, qboolean differentServer)
} }
} }
} }
//
// List of client variables allowed to be changed by the server
//
static const char *whiteListedVariables[] = {
"r_fastsky", // some mods set this variable to make the sky uniform
"ui_hud",
};
//
// List of client variables allowed to be changed by the server
//
static const char *whiteListedLocalServerVariables[] = {"ui_hidemouse", "ui_showmouse", "cg_marks_add"};
//
// List of commands allowed to be executed by the server
//
static const char *whiteListedCommands[] = {
"primarydmweapon",
"pushmenu",
"pushmenu_teamselect",
"pushmenu_weaponselect",
"popmenu",
"wait",
"globalwidgetcommand", // used for mods adding custom HUDs
"ui_addhud",
"ui_removehud",
"tmstart",
"tmstartloop",
"tmstop",
"tmvolume",
"`stufftext",
"+moveup", // workaround for mods that want to prevent inactivity when handling the spectate
"-moveup",
"screenshot",
"screenshotJPEG",
"levelshot"
};
//
// List of commands allowed to be executed by the server
//
static const char *whiteListedLocalServerCommands[] = {
"spmap", // Used by briefings
"map",
"disconnect",
"cinematic",
"showmenu",
"hidemenu"
};
/*
====================
CG_IsVariableFiltered
Returns whether or not the variable should be filtered
====================
*/
static qboolean CG_IsVariableFiltered(const char *name)
{
cvar_t *var;
size_t i;
for (i = 0; i < ARRAY_LEN(whiteListedVariables); i++) {
if (!Q_stricmp(name, whiteListedVariables[i])) {
return qfalse;
}
}
if (cgs.localServer) {
for (i = 0; i < ARRAY_LEN(whiteListedLocalServerVariables); i++) {
if (!Q_stricmp(name, whiteListedLocalServerVariables[i])) {
return qfalse;
}
}
}
// Filtered
return qtrue;
}
/*
====================
CG_IsSetVariableFiltered
Returns whether or not the variable should be filtered
====================
*/
static qboolean CG_IsSetVariableFiltered(const char *name, char type)
{
cvar_t *var;
if (!CG_IsVariableFiltered(name)) {
return qfalse;
}
if (type != 'u' && type != 's') {
// Don't allow custom info variables to avoid flooding
// the client with many serverinfo and userinfo variables
var = cgi.Cvar_Find(name);
if (!var) {
// Allow as it doesn't exist
return qfalse;
}
if (var->flags & CVAR_USER_CREATED) {
// Allow, it's user-created, wouldn't cause issues
return qfalse;
}
}
// Filtered
return qtrue;
}
/*
====================
CG_IsCommandFiltered
Returns whether or not the variable should be filtered
====================
*/
static qboolean CG_IsCommandFiltered(const char *name)
{
size_t i;
for (i = 0; i < ARRAY_LEN(whiteListedCommands); i++) {
if (!Q_stricmp(name, whiteListedCommands[i])) {
return qfalse;
}
}
if (cgs.localServer) {
// Allow more commands when the client is hosting the server
// Mostly used on single-player mode, like when briefings switch to the next map
for (i = 0; i < ARRAY_LEN(whiteListedLocalServerCommands); i++) {
if (!Q_stricmp(name, whiteListedLocalServerCommands[i])) {
return qfalse;
}
}
}
//
// Test variables
//
return CG_IsVariableFiltered(name);
}
/*
====================
RemoveEndToken
====================
*/
static qboolean RemoveEndToken(char* com_token) {
char* p;
for (p = com_token; p[0]; p++) {
if (*p == ';') {
*p = 0;
return qtrue;
}
}
return qfalse;
}
/*
====================
CG_IsStatementFiltered
Returns whether or not the statement is filtered
====================
*/
static qboolean CG_IsStatementFiltered(char *cmd)
{
char* parsed;
char* p;
char com_token[256];
qboolean bNextStatement = qfalse;
parsed = cmd;
for (Q_strncpyz(com_token, COM_ParseExt(&parsed, qtrue), sizeof(com_token)); com_token[0]; Q_strncpyz(com_token, COM_ParseExt(&parsed, qtrue), sizeof(com_token))) {
bNextStatement = RemoveEndToken(com_token);
if (com_token[0] == ';') {
continue;
}
if (!Q_stricmp(com_token, "set") || !Q_stricmp(com_token, "setu") || !Q_stricmp(com_token, "seta")
|| !Q_stricmp(com_token, "sets")) {
char type = com_token[3];
//
// variable
//
Q_strncpyz(com_token, COM_ParseExt(&parsed, qfalse), sizeof(com_token));
bNextStatement |= RemoveEndToken(com_token);
if (com_token[0] == ';') {
continue;
}
if (CG_IsSetVariableFiltered(com_token, type)) {
return qtrue;
}
} else {
//
// normal command
//
if (CG_IsCommandFiltered(com_token)) {
return qtrue;
}
}
if (!bNextStatement) {
// Skip up to the next statement
while (parsed && parsed[0]) {
char c = parsed[0];
parsed++;
if (c == '\n' || c == ';') {
break;
}
}
}
}
return qfalse;
}

View file

@ -1,292 +0,0 @@
/*
===========================================================================
Copyright (C) 2025 the OpenMoHAA team
This file is part of OpenMoHAA source code.
OpenMoHAA source code 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.
OpenMoHAA source code is distributed in the hope that it will be
useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with OpenMoHAA source code; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
===========================================================================
*/
// DESCRIPTION:
// cg_servercmds_filter.c -- filtered server commands
#include "cg_local.h"
#include "cg_servercmds_filter.h"
//
// List of variables allowed to be changed by the server
//
static const char *whiteListedVariables[] = {
// some mods set this variable to make the sky uniform
"r_fastsky",
"ui_hud",
"subtitle0",
"subtitle1",
"subtitle2",
"subtitle3",
"name",
// for 3rd person server
"cg_3rd_person",
"cg_cameraverticaldisplacement"
};
//
// List of variables allowed to be changed by the server
//
static const char *whiteListedLocalServerVariables[] = {"ui_hidemouse", "ui_showmouse", "cg_marks_add"};
//
// List of commands allowed to be executed by the server
//
static const char *whiteListedCommands[] = {
//
// HUD
//==========
"pushmenu",
"pushmenu_teamselect",
"pushmenu_weaponselect",
"popmenu",
"globalwidgetcommand", // used for mods adding custom HUDs
"ui_addhud",
"ui_removehud",
"echo", // to print stuff client-side
//
// Sounds
//==========
"tmstart",
"tmstartloop",
"tmstop",
"tmvolume",
"play",
"playmp3",
"stopmp3",
//
// Misc
//==========
"primarydmweapon",
"wait",
"+moveup", // workaround for mods that want to prevent inactivity when handling the spectate
"-moveup",
"screenshot",
"screenshotJPEG",
"levelshot",
"`stufftext" // Stufftext detection from Reborn, the player gets kicked without it
};
//
// List of commands allowed to be executed locally
// (when the client also runs the server)
//
static const char *whiteListedLocalServerCommands[] = {
// Used by briefings
"spmap",
"map",
"disconnect",
"cinematic",
"showmenu",
"hidemenu"
};
/*
====================
CG_IsVariableFiltered
Returns whether or not the variable should be filtered
====================
*/
static qboolean CG_IsVariableFiltered(const char *name)
{
size_t i;
for (i = 0; i < ARRAY_LEN(whiteListedVariables); i++) {
if (!Q_stricmp(name, whiteListedVariables[i])) {
return qfalse;
}
}
if (cgs.localServer) {
for (i = 0; i < ARRAY_LEN(whiteListedLocalServerVariables); i++) {
if (!Q_stricmp(name, whiteListedLocalServerVariables[i])) {
return qfalse;
}
}
}
// Filtered
return qtrue;
}
/*
====================
CG_IsSetVariableFiltered
Returns whether or not the variable should be filtered
====================
*/
static qboolean CG_IsSetVariableFiltered(const char *name, char type)
{
cvar_t *var;
if (!CG_IsVariableFiltered(name)) {
return qfalse;
}
if (type != 'u' && type != 's') {
// Don't allow custom info variables to avoid flooding
// the client with many serverinfo and userinfo variables
var = cgi.Cvar_Find(name);
if (!var) {
// Allow as it doesn't exist
return qfalse;
}
if (var->flags & CVAR_USER_CREATED) {
// Allow, it's user-created, wouldn't cause issues
return qfalse;
}
}
// Filtered
return qtrue;
}
/*
====================
CG_IsCommandFiltered
Returns whether or not the variable should be filtered
====================
*/
static qboolean CG_IsCommandFiltered(const char *name)
{
size_t i;
for (i = 0; i < ARRAY_LEN(whiteListedCommands); i++) {
if (!Q_stricmp(name, whiteListedCommands[i])) {
return qfalse;
}
}
if (cgs.localServer) {
// Allow more commands when the client is hosting the server
// Mostly used on single-player mode, like when briefings switch to the next map
for (i = 0; i < ARRAY_LEN(whiteListedLocalServerCommands); i++) {
if (!Q_stricmp(name, whiteListedLocalServerCommands[i])) {
return qfalse;
}
}
}
//
// Test variables
//
return CG_IsVariableFiltered(name);
}
/*
====================
RemoveEndToken
====================
*/
static qboolean RemoveEndToken(char* com_token) {
char* p;
for (p = com_token; p[0]; p++) {
if (*p == ';') {
*p = 0;
return qtrue;
}
}
return qfalse;
}
/*
====================
CG_IsStatementFiltered
Returns whether or not the statement is filtered
====================
*/
qboolean CG_IsStatementFiltered(char *cmd)
{
char* parsed;
char com_token[256];
qboolean bNextStatement = qfalse;
parsed = cmd;
for (Q_strncpyz(com_token, COM_ParseExt(&parsed, qtrue), sizeof(com_token)); com_token[0]; Q_strncpyz(com_token, COM_ParseExt(&parsed, qtrue), sizeof(com_token))) {
bNextStatement = RemoveEndToken(com_token);
if (com_token[0] == ';') {
continue;
}
if (!Q_stricmp(com_token, "set") || !Q_stricmp(com_token, "setu") || !Q_stricmp(com_token, "seta")
|| !Q_stricmp(com_token, "sets") || !Q_stricmp(com_token, "append")) {
char type;
if (Q_stricmp(com_token, "append")) {
type = com_token[3];
} else {
type = 0;
}
//
// variable
//
Q_strncpyz(com_token, COM_ParseExt(&parsed, qfalse), sizeof(com_token));
bNextStatement |= RemoveEndToken(com_token);
if (com_token[0] == ';') {
continue;
}
if (CG_IsSetVariableFiltered(com_token, type)) {
return qtrue;
}
} else {
//
// normal command
//
if (CG_IsCommandFiltered(com_token)) {
return qtrue;
}
}
if (!bNextStatement) {
// Skip up to the next statement
while (parsed && parsed[0]) {
char c = parsed[0];
parsed++;
if (c == '\n' || c == ';') {
break;
}
}
}
}
return qfalse;
}

View file

@ -230,14 +230,9 @@ void ClientGameCommandManager::InitializeTempModelCvars(void)
{ {
cg_showtempmodels = cgi.Cvar_Get("cg_showtempmodels", "0", 0); cg_showtempmodels = cgi.Cvar_Get("cg_showtempmodels", "0", 0);
cg_detail = cgi.Cvar_Get("detail", "1", CVAR_ARCHIVE); cg_detail = cgi.Cvar_Get("detail", "1", CVAR_ARCHIVE);
cg_effectdetail = cgi.Cvar_Get("cg_effectdetail", "0.2", CVAR_ARCHIVE); cg_effectdetail = cgi.Cvar_Get("cg_effectdetail", "0.2", CVAR_ARCHIVE);
cgi.Cvar_CheckRange(cg_effectdetail, 0.2, 1.0, qfalse);
cg_effect_physicsrate = cgi.Cvar_Get("cg_effect_physicsrate", "10", CVAR_ARCHIVE); cg_effect_physicsrate = cgi.Cvar_Get("cg_effect_physicsrate", "10", CVAR_ARCHIVE);
cg_max_tempmodels = cgi.Cvar_Get("cg_max_tempmodels", "1100", CVAR_ARCHIVE); cg_max_tempmodels = cgi.Cvar_Get("cg_max_tempmodels", "1100", CVAR_ARCHIVE);
cgi.Cvar_CheckRange(cg_max_tempmodels, 200, MAX_TEMPMODELS, qtrue);
cg_reserve_tempmodels = cgi.Cvar_Get("cg_reserve_tempmodels", "200", CVAR_ARCHIVE); cg_reserve_tempmodels = cgi.Cvar_Get("cg_reserve_tempmodels", "200", CVAR_ARCHIVE);
if (cg_max_tempmodels->integer > MAX_TEMPMODELS) { if (cg_max_tempmodels->integer > MAX_TEMPMODELS) {
@ -582,7 +577,8 @@ qboolean ClientGameCommandManager::TempModelPhysics(ctempmodel_t *p, float ftime
parentOrigin = e->origin; parentOrigin = e->origin;
vectoangles(e->axis[0], parentAngles); vectoangles(e->axis[0], parentAngles);
} else if (p->cgd.flags & T_SWARM) { }
else if (p->cgd.flags & T_SWARM) {
p->cgd.parentOrigin = p->cgd.velocity + p->cgd.accel * ftime * scale; p->cgd.parentOrigin = p->cgd.velocity + p->cgd.accel * ftime * scale;
} }
@ -895,8 +891,7 @@ void ClientGameCommandManager::AddTempModels(void)
refEntity_t *old_ent; refEntity_t *old_ent;
// To counteract cg.time going backwards // To counteract cg.time going backwards
if (lastTempModelFrameTime if (lastTempModelFrameTime && ((cg.time < lastTempModelFrameTime) || (cg.time - lastTempModelFrameTime > TOO_MUCH_TIME_PASSED))) {
&& ((cg.time < lastTempModelFrameTime) || (cg.time - lastTempModelFrameTime > TOO_MUCH_TIME_PASSED))) {
p = m_active_tempmodels.prev; p = m_active_tempmodels.prev;
for (; p != &m_active_tempmodels; p = next) { for (; p != &m_active_tempmodels; p = next) {
next = p->prev; next = p->prev;

View file

@ -298,7 +298,7 @@ void CG_OffsetFirstPersonView(refEntity_t *pREnt, qboolean bUseWorldPosition)
VectorCopy(origin, vOldOrigin); VectorCopy(origin, vOldOrigin);
if (!cg.predicted_player_state.walking || (!(cg.predicted_player_state.pm_flags & PMF_FROZEN) && !(cg.predicted_player_state.pm_flags & PMF_NO_MOVE))) { if (!cg.predicted_player_state.walking || !(cg.predicted_player_state.pm_flags & PMF_FROZEN)) {
VectorCopy(cg.predicted_player_state.velocity, vVelocity); VectorCopy(cg.predicted_player_state.velocity, vVelocity);
} else { } else {
// //
@ -485,15 +485,8 @@ static int CG_CalcFov(void)
int contents; int contents;
float fov_x, fov_y; float fov_x, fov_y;
int inwater; int inwater;
float fov_ratio;
fov_ratio = (float)cg.refdef.width / (float)cg.refdef.height * (3.0 / 4.0);
if (fov_ratio == 1) {
fov_x = cg.camera_fov; fov_x = cg.camera_fov;
} else {
fov_x = RAD2DEG(atan(tan(DEG2RAD(cg.camera_fov / 2.0)) * fov_ratio)) * 2.0;
}
x = cg.refdef.width / tan(fov_x / 360 * M_PI); x = cg.refdef.width / tan(fov_x / 360 * M_PI);
fov_y = atan2(cg.refdef.height, x); fov_y = atan2(cg.refdef.height, x);
fov_y = fov_y * 360 / M_PI; fov_y = fov_y * 360 / M_PI;
@ -847,15 +840,6 @@ void CG_DrawActiveFrame(int serverTime, int frameTime, stereoFrame_t stereoView,
// no entities should be marked as interpolating // no entities should be marked as interpolating
} }
//
// Added in OPM
// Clamp the fov to avoid artifacts
if (cg_fov->value < 65) {
cgi.Cvar_Set("cg_fov", "65");
} else if (cg_fov->value > 120) {
cgi.Cvar_Set("cg_fov", "120");
}
// update cg.predicted_player_state // update cg.predicted_player_state
CG_PredictPlayerState(); CG_PredictPlayerState();
@ -963,9 +947,6 @@ void CG_DrawActiveFrame(int serverTime, int frameTime, stereoFrame_t stereoView,
cg.bIntermissionDisplay = qfalse; cg.bIntermissionDisplay = qfalse;
} }
// Added in OPM
CG_ProcessPlayerModel();
// build the render lists // build the render lists
if (!cg.hyperspace) { if (!cg.hyperspace) {
CG_AddPacketEntities(); // after calcViewValues, so predicted player state is correct CG_AddPacketEntities(); // after calcViewValues, so predicted player state is correct

View file

@ -1,29 +1,26 @@
cmake_minimum_required(VERSION 3.12) cmake_minimum_required(VERSION 3.5)
project(omohclient) project(omohclient)
option(NO_OPENAL "Use older sound-system" FALSE)
add_subdirectory("../cgame" "./cgame") add_subdirectory("../cgame" "./cgame")
file(GLOB SOURCES_CLIENT "./*.c*") file(GLOB SOURCES_CLIENT "./*.c*")
file(GLOB_RECURSE SOURCES_UILIB "../uilib/*.c*") file(GLOB_RECURSE SOURCES_UILIB "../uilib/*.c*")
set(SOURCES_CLIENT ${SOURCES_CLIENT}
# Gamespy
"${CMAKE_SOURCE_DIR}/code/gamespy/cl_gamespy.c"
)
# Made as an interface and not static, as static only links used methods # Made as an interface and not static, as static only links used methods
add_library(omohclient INTERFACE) add_library(omohclient INTERFACE)
target_compile_definitions(omohclient INTERFACE APP_MODULE) target_compile_definitions(omohclient INTERFACE APP_MODULE)
target_compile_definitions(omohclient INTERFACE USE_OPENAL_DLOPEN=1)
target_compile_features(omohclient INTERFACE cxx_nullptr) target_compile_features(omohclient INTERFACE cxx_nullptr)
target_compile_features(omohclient INTERFACE c_variadic_macros) target_compile_features(omohclient INTERFACE c_variadic_macros)
target_link_libraries(omohclient INTERFACE omohsdl_client) target_link_libraries(omohclient INTERFACE omohsdl)
target_link_libraries(omohclient INTERFACE gcd) target_link_libraries(omohclient INTERFACE gcd)
# Sound stuff # Sound stuff
target_compile_definitions(omohclient INTERFACE USE_CODEC_MP3) target_compile_definitions(omohclient INTERFACE USE_CODEC_MP3)
if (NOT NO_MODERN_DMA) if (NOT NO_OPENAL)
# Use OpenAL # Use OpenAL
find_package(OpenAL REQUIRED) find_package(OpenAL REQUIRED)
@ -34,13 +31,7 @@ if (NOT NO_MODERN_DMA)
else() else()
target_include_directories(omohclient INTERFACE ${OPENAL_INCLUDE_DIR}) target_include_directories(omohclient INTERFACE ${OPENAL_INCLUDE_DIR})
endif() endif()
target_link_libraries(omohclient INTERFACE ${OPENAL_LIBRARY})
if(NOT USE_SYSTEM_LIBS)
target_compile_definitions(omohclient INTERFACE USE_OPENAL_DLOPEN=1)
else()
# Link against system OpenAL
target_link_libraries(omohclient INTERFACE OpenAL::OpenAL)
endif()
endif() endif()
list(FILTER SOURCES_CLIENT EXCLUDE REGEX "./snd_([a-zA-Z0-9_]+)\.c$") list(FILTER SOURCES_CLIENT EXCLUDE REGEX "./snd_([a-zA-Z0-9_]+)\.c$")

View file

@ -629,7 +629,6 @@ void CL_InitCGameDLL( clientGameImport_t *cgi, clientGameExport_t **cge ) {
cgi->Cvar_Get = Cvar_Get; cgi->Cvar_Get = Cvar_Get;
cgi->Cvar_Find = Cvar_FindVar; cgi->Cvar_Find = Cvar_FindVar;
cgi->Cvar_Set = Cvar_Set; cgi->Cvar_Set = Cvar_Set;
cgi->Cvar_CheckRange = Cvar_CheckRange;
cgi->Argc = Cmd_Argc; cgi->Argc = Cmd_Argc;
cgi->Args = Cmd_Args; cgi->Args = Cmd_Args;
@ -775,7 +774,6 @@ void CL_InitCGameDLL( clientGameImport_t *cgi, clientGameExport_t **cge ) {
cgi->UI_HideMenu = UI_HideMenu; cgi->UI_HideMenu = UI_HideMenu;
cgi->UI_FontStringWidth = CL_FontStringWidth; cgi->UI_FontStringWidth = CL_FontStringWidth;
cgi->UI_GetObjectivesTop = UI_GetObjectivesTop; cgi->UI_GetObjectivesTop = UI_GetObjectivesTop;
cgi->UI_GetHighResolutionScale = UI_GetHighResolutionScale;
cgi->Key_StringToKeynum = Key_StringToKeynum; cgi->Key_StringToKeynum = Key_StringToKeynum;
cgi->Key_KeynumToBindString = Key_KeynumToBindString; cgi->Key_KeynumToBindString = Key_KeynumToBindString;
cgi->Key_GetKeysForCommand = Key_GetKeysForCommand; cgi->Key_GetKeysForCommand = Key_GetKeysForCommand;
@ -924,13 +922,7 @@ void CL_InitCGame( void ) {
// find the current mapname // find the current mapname
info = cl.gameState.stringData + cl.gameState.stringOffsets[ CS_SERVERINFO ]; info = cl.gameState.stringData + cl.gameState.stringOffsets[ CS_SERVERINFO ];
mapname = Info_ValueForKey( info, "mapname" ); mapname = Info_ValueForKey( info, "mapname" );
if (CL_UseLargeLightmap(mapname)) {
Com_sprintf( cl.mapname, sizeof( cl.mapname ), "maps/%s.bsp", mapname ); Com_sprintf( cl.mapname, sizeof( cl.mapname ), "maps/%s.bsp", mapname );
} else {
// Added in 2.0
Com_sprintf(cl.mapname, sizeof(cl.mapname), "maps/%s_sml.bsp", mapname);
}
S_BeginRegistration(); S_BeginRegistration();
CL_ShutdownCGame(); CL_ShutdownCGame();
@ -945,17 +937,10 @@ void CL_InitCGame( void ) {
CL_InitClientSavedData(); CL_InitClientSavedData();
} }
if (cl.snap.valid) {
// init for this gamestate // init for this gamestate
// use the lastExecutedServerCommand instead of the serverCommandSequence // use the lastExecutedServerCommand instead of the serverCommandSequence
// otherwise server commands sent just before a gamestate are dropped // otherwise server commands sent just before a gamestate are dropped
cge->CG_Init( &cgi, clc.serverMessageSequence, clc.lastExecutedServerCommand, clc.clientNum ); cge->CG_Init( &cgi, clc.serverMessageSequence, clc.lastExecutedServerCommand, clc.clientNum );
} else {
// executing client commands from previous map/server might be an issue, some commands might be cs commands,
// like old CS_SYSTEMINFO configstrings which still contain the sv_serverId from previous map.
// It would cause the client to lose the game state number
cge->CG_Init(&cgi, clc.serverMessageSequence, clc.serverCommandSequence, clc.clientNum);
}
ClearNewConfigFlag(); ClearNewConfigFlag();
TIKI_FinishLoad(); TIKI_FinishLoad();

View file

@ -866,8 +866,8 @@ qboolean CL_ReadyToSendPacket( void ) {
} }
// check for exceeding cl_maxpackets // check for exceeding cl_maxpackets
if ( cl_maxpackets->integer < 30 ) { if ( cl_maxpackets->integer < 15 ) {
Cvar_Set( "cl_maxpackets", "30" ); Cvar_Set( "cl_maxpackets", "15" );
} else if ( cl_maxpackets->integer > 125 ) { } else if ( cl_maxpackets->integer > 125 ) {
Cvar_Set( "cl_maxpackets", "125" ); Cvar_Set( "cl_maxpackets", "125" );
} }

View file

@ -1,640 +0,0 @@
/*
===========================================================================
Copyright (C) 2025 the OpenMoHAA team
This file is part of OpenMoHAA source code.
OpenMoHAA source code 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.
OpenMoHAA source code is distributed in the hope that it will be
useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with OpenMoHAA source code; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
===========================================================================
*/
#include "cl_ui.h"
#include "cl_instantAction.h"
#include "cl_uiserverlist.h"
#include "../gamespy/sv_gamespy.h"
Event EV_UIInstantAction_AcceptServer
(
"acceptserver",
EV_DEFAULT,
NULL,
NULL,
"Connect to the current server"
);
Event EV_UIInstantAction_RejectServer
(
"rejectserver",
EV_DEFAULT,
NULL,
NULL,
"Reject the current server"
);
Event EV_UIInstantAction_Cancel
(
"ia_cancel",
EV_DEFAULT,
NULL,
NULL,
"cancel the server update"
);
Event EV_UIInstantAction_Refresh
(
"ia_refresh",
EV_DEFAULT,
NULL,
NULL,
"Refresh the server list"
);
CLASS_DECLARATION(UIWidget, UIInstantAction, NULL) {
{&EV_UIInstantAction_AcceptServer, &UIInstantAction::Connect },
{&EV_UIInstantAction_RejectServer, &UIInstantAction::Reject },
{&EV_UIInstantAction_Cancel, &UIInstantAction::CancelRefresh},
{&EV_UIInstantAction_Refresh, &UIInstantAction::Refresh },
{NULL, NULL }
};
struct ServerListInstance {
int iServerType;
UIInstantAction *pServerList;
};
ServerListInstance g_IAServerListInst[2];
UIInstantAction::UIInstantAction()
{
state = IA_INITIALIZE;
numFoundServers = 0;
numServers = 0;
minPlayers = 3;
startingMaxPing = 100;
endingMaxPing = 1500;
maxServers = -1;
servers = NULL;
doneList[0] = false;
doneList[1] = false;
serverList[0] = NULL;
serverList[1] = NULL;
ReadIniFile();
EnableServerInfo(false);
menuManager.PassEventToWidget("ia_cancel_button", new Event(EV_Widget_Disable));
menuManager.PassEventToWidget("ia_refresh_button", new Event(EV_Widget_Disable));
}
UIInstantAction::~UIInstantAction()
{
CleanUp();
}
void UIInstantAction::CleanUp()
{
if (serverList[0]) {
ServerListFree(serverList[0]);
serverList[0] = NULL;
}
if (serverList[1]) {
ServerListFree(serverList[1]);
serverList[1] = NULL;
}
if (servers) {
delete[] servers;
servers = NULL;
}
}
void UIInstantAction::Init()
{
const char *secret_key;
const char *game_name;
static const unsigned int iNumConcurrent = 10;
numFoundServers = 0;
numServers = 0;
doneList[0] = false;
doneList[1] = false;
EnableServerInfo(false);
menuManager.PassEventToWidget("ia_cancel_button", new Event(EV_Widget_Disable));
menuManager.PassEventToWidget("ia_refresh_button", new Event(EV_Widget_Disable));
menuManager.PassEventToWidget("ia_noserverfound", new Event(EV_Widget_Disable));
Cvar_Set("ia_search_percentage", va("%d %%", 0));
if (com_target_game->integer < target_game_e::TG_MOHTT) {
g_IAServerListInst[0].iServerType = com_target_game->integer;
g_IAServerListInst[0].pServerList = this;
game_name = GS_GetGameName(com_target_game->integer);
secret_key = GS_GetGameKey(com_target_game->integer);
serverList[0] = ServerListNew(
game_name,
game_name,
secret_key,
iNumConcurrent,
(void *)&IAServerListCallBack,
1,
(void *)&g_IAServerListInst[0]
);
ServerListClear(serverList[0]);
} else {
g_IAServerListInst[0].iServerType = target_game_e::TG_MOHTT;
g_IAServerListInst[0].pServerList = this;
game_name = GS_GetGameName(target_game_e::TG_MOHTT);
secret_key = GS_GetGameKey(target_game_e::TG_MOHTT);
serverList[0] = ServerListNew(
game_name,
game_name,
secret_key,
iNumConcurrent,
(void *)&IAServerListCallBack,
1,
(void *)&g_IAServerListInst[0]
);
ServerListClear(serverList[0]);
g_IAServerListInst[1].iServerType = target_game_e::TG_MOHTA;
g_IAServerListInst[1].pServerList = this;
game_name = GS_GetGameName(target_game_e::TG_MOHTA);
secret_key = GS_GetGameKey(target_game_e::TG_MOHTA);
serverList[1] = ServerListNew(
game_name,
game_name,
secret_key,
iNumConcurrent,
(void *)&IAServerListCallBack,
1,
(void *)&g_IAServerListInst[1]
);
ServerListClear(serverList[1]);
}
state = IA_WAITING;
numFoundServers = 0;
ServerListUpdate(serverList[0], true);
if (serverList[1]) {
ServerListUpdate(serverList[1], true);
}
menuManager.PassEventToWidget("ia_cancel_button", new Event(EV_Widget_Enable));
menuManager.PassEventToWidget("searchstatus", new Event(EV_Widget_Enable));
menuManager.PassEventToWidget("searchstatuslable", new Event(EV_Widget_Enable));
}
int UIInstantAction::GetServerIndex(int maxPing, int gameType)
{
int bestPing = 1500;
int bestServer = -1;
int i;
for (i = 0; i < numFoundServers; i++) {
const IAServer_t& IAServer = servers[i];
char *gameVer;
float fGameVer;
int ping;
int numPlayers;
if (IAServer.rejected) {
continue;
}
// Skip servers that don't match the provided game type
if (ServerGetIntValue(IAServer.server, "g_gametype_i", 1) != gameType) {
continue;
}
// Skip servers with high ping
ping = ServerGetPing(IAServer.server);
if (ping > maxPing) {
continue;
}
gameVer = ServerGetStringValue(IAServer.server, "gamever", "1.00");
if (com_target_demo->integer && *gameVer != 'd') {
// Skip retail servers on demo game
continue;
} else if (!com_target_demo->integer && *gameVer == 'd') {
// Skip demo servers on retail game
continue;
}
// Skip incompatible servers
fGameVer = atof(gameVer);
if (com_target_game->integer >= target_game_e::TG_MOHTT) {
if (IAServer.serverGame.serverType == target_game_e::TG_MOHTT) {
if (fabs(fGameVer) < 2.3f) {
continue;
}
} else {
if (fabs(fGameVer) < 2.1f) {
continue;
}
}
} else {
if (fabs(fGameVer - com_target_version->value) > 0.1f) {
continue;
}
}
// Skip servers with a password
if (ServerGetIntValue(IAServer.server, "password", 0)) {
continue;
}
// Skip servers that don't match the minimum number of players
numPlayers = ServerGetIntValue(IAServer.server, "numplayers", 0);
if (numPlayers < minPlayers) {
continue;
}
// Skip full servers
if (numPlayers == ServerGetIntValue(IAServer.server, "maxplayers", 0)) {
continue;
}
// Skip servers with an higher ping than the best one
if (ping >= bestPing) {
continue;
}
//
// Found a potential server
//
bestPing = ping;
bestServer = i;
}
return bestServer;
}
void UIInstantAction::ReadIniFile()
{
char *buffer;
const char *p;
const char *pVal;
int intValue;
char value[32];
if (!FS_ReadFileEx("iaction.ini", (void **)&buffer, qtrue)) {
return;
}
for (p = buffer; p; p = strstr(pVal, "\n")) {
if (sscanf(p, "%31s", value) != 1) {
break;
}
pVal = strstr(p, "=");
if (!pVal) {
break;
}
pVal++;
if (sscanf(pVal, "%d", &intValue) != 1) {
break;
}
if (!Q_stricmpn(value, "MinPlayers", 10)) {
minPlayers = intValue;
}
if (!Q_stricmpn(value, "StartingMaxPing", 15)) {
startingMaxPing = intValue;
}
if (!Q_stricmpn(value, "EndingMaxPing", 13)) {
endingMaxPing = intValue;
}
if (!Q_stricmpn(value, "MaxServers", 10)) {
maxServers = intValue;
}
}
}
void UIInstantAction::FindServer()
{
int ping;
int i;
currentServer = -1;
state = IA_NONE;
for (ping = startingMaxPing; ping < endingMaxPing; ping += 100) {
//
// Find the best server starting from FFA gametype first
//
for (i = 1; i < 7; i++) {
currentServer = GetServerIndex(ping, i);
if (currentServer >= 0) {
break;
}
}
if (currentServer >= 0) {
break;
}
}
menuManager.PassEventToWidget("ia_refresh_button", new Event(EV_Widget_Enable));
menuManager.PassEventToWidget("ia_cancel_button", new Event(EV_Widget_Disable));
menuManager.PassEventToWidget("searchstatus", new Event(EV_Widget_Disable));
menuManager.PassEventToWidget("searchstatuslable", new Event(EV_Widget_Disable));
if (currentServer < 0) {
EnableServerInfo(false);
menuManager.PassEventToWidget("ia_noserverfound", new Event(EV_Widget_Enable));
return;
}
const IAServer_t& IAServer = servers[currentServer];
const char *hostname = ServerGetStringValue(IAServer.server, "hostname", "(NONE)");
const char *gametype = ServerGetStringValue(IAServer.server, "gametype", "(NONE)");
int numplayers = ServerGetIntValue(IAServer.server, "numplayers", 0);
int maxplayers = ServerGetIntValue(IAServer.server, "maxplayers", 0);
ping = ServerGetPing(IAServer.server);
Cvar_Set("ia_servername", va(" %s", hostname));
Cvar_Set("ia_ping", va("%d", ping));
Cvar_Set("ia_gametype", va("%s", gametype));
Cvar_Set("ia_players", va("%d", numplayers));
Cvar_Set("ia_maxplayers", va("%d", maxplayers));
EnableServerInfo(true);
}
void UIInstantAction::Connect(Event *ev)
{
char *gameVer;
float fGameVer;
bool bDiffVersion;
char command[256];
if (currentServer < 0 || currentServer < numServers) {
return;
}
const IAServer_t& IAServer = servers[currentServer];
gameVer = ServerGetStringValue(IAServer.server, "gamever", "1.00");
if (gameVer[0] == 'd') {
gameVer++;
}
// Skip incompatible servers
fGameVer = atof(gameVer);
bDiffVersion = false;
if (com_target_game->integer >= target_game_e::TG_MOHTT) {
if (IAServer.serverGame.serverType == target_game_e::TG_MOHTT) {
if (fabs(fGameVer) < 2.3f) {
bDiffVersion = true;
}
} else {
if (fabs(fGameVer) < 2.1f) {
bDiffVersion = true;
}
}
} else {
if (fabs(fGameVer - com_target_version->value) > 0.1f) {
bDiffVersion = true;
}
}
if (bDiffVersion) {
if (fGameVer - com_target_version->value > 0) {
// Older version
UI_SetReturnMenuToCurrent();
Cvar_Set("com_errormessage", va("Server is version %s, you are using %s", gameVer, "2.40"));
UI_PushMenu("wrongversion");
} else {
// Server version is newer
Cvar_Set("dm_serverstatus", va("Can not connect to v%s server, you are using v%s", gameVer, "2.40"));
}
}
UI_SetReturnMenuToCurrent();
Cvar_Set("g_servertype", va("%d", servers[currentServer].serverGame.serverType));
Com_sprintf(
command,
sizeof(command),
"connect %s:%i\n",
ServerGetAddress(IAServer.server),
ServerGetIntValue(IAServer.server, "hostport", PORT_SERVER)
);
Cbuf_AddText(command);
}
void UIInstantAction::Reject(Event *ev)
{
servers[currentServer].rejected = 1;
FindServer();
}
void UIInstantAction::Draw()
{
switch (state) {
case IA_INITIALIZE:
Init();
break;
case IA_UPDATE:
Update();
break;
case IA_FINISHED:
FindServer();
break;
default:
break;
}
if (serverList[0]) {
ServerListThink(serverList[0]);
}
if (serverList[1]) {
ServerListThink(serverList[1]);
}
}
void UIInstantAction::Update()
{
numFoundServers = 0;
// count the total number of servers from both server list
numServers = ServerListCount(serverList[0]);
if (serverList[1]) {
numServers += ServerListCount(serverList[1]);
}
state = IA_FINISHED;
servers = new IAServer_t[numServers];
ServerListHalt(serverList[0]);
if (serverList[1]) {
ServerListHalt(serverList[1]);
}
ServerListThink(serverList[0]);
if (serverList[1]) {
ServerListThink(serverList[1]);
}
state = IA_SEARCHING;
// Start updating the first list
doneList[0] = false;
ServerListClear(serverList[0]);
ServerListUpdate(serverList[0], true);
// Update the second optional list
if (serverList[1]) {
doneList[1] = false;
ServerListClear(serverList[1]);
ServerListUpdate(serverList[1], true);
}
}
int UIInstantAction::AddServer(GServer server, const ServerGame_t& serverGame)
{
servers[numFoundServers].server = server;
servers[numFoundServers].serverGame = serverGame;
servers[numFoundServers].rejected = false;
numFoundServers++;
return numFoundServers;
}
void UIInstantAction::CancelRefresh(Event *ev)
{
state = IA_FINISHED;
ServerListHalt(serverList[0]);
ServerListHalt(serverList[1]);
}
void UIInstantAction::Refresh(Event *ev)
{
state = IA_INITIALIZE;
}
void UIInstantAction::EnableServerInfo(bool enable)
{
if (enable) {
menuManager.PassEventToWidget("iaservername_label", new Event(EV_Widget_Enable));
menuManager.PassEventToWidget("ia_servername_field", new Event(EV_Widget_Enable));
menuManager.PassEventToWidget("ia_ping_label", new Event(EV_Widget_Enable));
menuManager.PassEventToWidget("ia_ping_field", new Event(EV_Widget_Enable));
menuManager.PassEventToWidget("ia_gametype_label", new Event(EV_Widget_Enable));
menuManager.PassEventToWidget("ia_gametype_field", new Event(EV_Widget_Enable));
menuManager.PassEventToWidget("ia_players_label", new Event(EV_Widget_Enable));
menuManager.PassEventToWidget("ia_players_field", new Event(EV_Widget_Enable));
menuManager.PassEventToWidget("ia_maxplayers_label", new Event(EV_Widget_Enable));
menuManager.PassEventToWidget("ia_maxplayers_field", new Event(EV_Widget_Enable));
menuManager.PassEventToWidget("acceptserver", new Event(EV_Widget_Enable));
menuManager.PassEventToWidget("rejectserver", new Event(EV_Widget_Enable));
} else {
menuManager.PassEventToWidget("iaservername_label", new Event(EV_Widget_Disable));
menuManager.PassEventToWidget("ia_servername_field", new Event(EV_Widget_Disable));
menuManager.PassEventToWidget("ia_ping_label", new Event(EV_Widget_Disable));
menuManager.PassEventToWidget("ia_ping_field", new Event(EV_Widget_Disable));
menuManager.PassEventToWidget("ia_gametype_label", new Event(EV_Widget_Disable));
menuManager.PassEventToWidget("ia_gametype_field", new Event(EV_Widget_Disable));
menuManager.PassEventToWidget("ia_players_label", new Event(EV_Widget_Disable));
menuManager.PassEventToWidget("ia_players_field", new Event(EV_Widget_Disable));
menuManager.PassEventToWidget("ia_maxplayers_label", new Event(EV_Widget_Disable));
menuManager.PassEventToWidget("ia_maxplayers_field", new Event(EV_Widget_Disable));
menuManager.PassEventToWidget("acceptserver", new Event(EV_Widget_Disable));
menuManager.PassEventToWidget("rejectserver", new Event(EV_Widget_Disable));
}
}
void UIInstantAction::IAServerListCallBack(GServerList serverlist, int msg, void *instance, void *param1, void *param2)
{
const ServerListInstance *pInstance = (const ServerListInstance *)instance;
UIInstantAction *pServerList = pInstance->pServerList;
if (msg == LIST_PROGRESS) {
if (pServerList->state == IA_WAITING) {
if (pInstance->iServerType == com_target_game->integer) {
pServerList->doneList[0] = true;
}
if (com_target_game->integer >= target_game_e::TG_MOHTT && pInstance->iServerType == target_game_e::TG_MOHTA) {
pServerList->doneList[1] = true;
}
if (pServerList->doneList[0] && (!pServerList->serverList[1] || pServerList->doneList[1])) {
pServerList->state = IA_UPDATE;
}
} else if (pServerList->state == IA_SEARCHING) {
ServerGame_t serverGame;
serverGame.serverType = pInstance->iServerType;
const int serverIndex = pServerList->AddServer((GServer)param1, serverGame);
Cvar_Set("ia_search_percentage", va("%d %%", 100 * serverIndex / pServerList->numServers));
if (pServerList->maxServers >= 0 && serverIndex >= pServerList->maxServers) {
// Reached the maximum number of servers, stop there
pServerList->doneList[0] = true;
ServerListHalt(pServerList->serverList[0]);
if (pServerList->serverList[1]) {
pServerList->doneList[1] = true;
ServerListHalt(pServerList->serverList[1]);
}
pServerList->state = IA_FINISHED;
}
}
} else if (msg == LIST_STATECHANGED && ServerListState(serverlist) == GServerListState::sl_idle) {
if (pInstance->iServerType == com_target_game->integer) {
pServerList->doneList[0] = true;
}
if (com_target_game->integer >= target_game_e::TG_MOHTT && pInstance->iServerType == target_game_e::TG_MOHTA) {
pServerList->doneList[1] = true;
}
if (pServerList->doneList[0] && (!pServerList->serverList[1] || pServerList->doneList[1])) {
if (pServerList->state == IA_WAITING) {
pServerList->state = IA_UPDATE;
}
if (pServerList->state == IA_SEARCHING) {
pServerList->state = IA_FINISHED;
}
}
}
}

View file

@ -1,103 +0,0 @@
/*
===========================================================================
Copyright (C) 2025 the OpenMoHAA team
This file is part of OpenMoHAA source code.
OpenMoHAA source code 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.
OpenMoHAA source code is distributed in the hope that it will be
useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with OpenMoHAA source code; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
===========================================================================
*/
// Added in 2.30
// Instantly find a server matching common criterias
#pragma once
#include "../gamespy/goaceng.h"
typedef struct {
int serverType;
} ServerGame_t;
typedef struct {
GServer server;
ServerGame_t serverGame;
bool rejected;
} IAServer_t;
enum IAState_e {
IA_NONE,
IA_INITIALIZE,
IA_WAITING,
IA_UPDATE,
IA_SEARCHING,
IA_FINISHED
};
class UIInstantAction : public UIWidget
{
public:
CLASS_PROTOTYPE(UIInstantAction);
public:
UIInstantAction();
~UIInstantAction() override;
void CleanUp();
void Init();
int GetServerIndex(int maxPing, int gameType);
void ReadIniFile();
void FindServer();
void Connect(Event *ev);
void Reject(Event *ev);
void Draw();
void Update();
int AddServer(GServer server, const ServerGame_t& serverGame);
void CancelRefresh(Event *ev);
void Refresh(Event *ev);
void EnableServerInfo(bool enable);
private:
static void IAServerListCallBack(GServerList serverlist, int msg, void *instance, void *param1, void *param2);
private:
//
// List
//
bool doneList[2];
GServerList serverList[2];
int maxServers;
//
// Current states
//
IAState_e state;
int numServers;
int numFoundServers;
//
// Filters
//
int minPlayers;
int startingMaxPing;
int endingMaxPing;
//
// Servers
//
IAServer_t *servers;
int currentServer;
};

View file

@ -295,7 +295,7 @@ void UI_DoInventory(qboolean activate_mouse)
if (client_inv.align == INV_ALIGN_RIGHT) { if (client_inv.align == INV_ALIGN_RIGHT) {
s_main_inv->InitFrame( s_main_inv->InitFrame(
NULL, NULL,
client_inv.horizoffset + uid.vidWidth - client_inv.typewidth, client_inv.horizoffset + cls.glconfig.vidWidth - client_inv.typewidth,
client_inv.vertoffset, client_inv.vertoffset,
client_inv.typewidth, client_inv.typewidth,
client_inv.typeheight * client_inv.types.NumObjects(), client_inv.typeheight * client_inv.types.NumObjects(),

View file

@ -29,21 +29,14 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
#include "../qcommon/localization.h" #include "../qcommon/localization.h"
#include "../qcommon/bg_compat.h" #include "../qcommon/bg_compat.h"
#include "../sys/sys_local.h" #include "../sys/sys_local.h"
#include "../sys/sys_update_checker.h" #ifdef USE_RENDERER_DLL
#include "../uilib/uimessage.h"
extern "C" {
#include "../sys/sys_loadlib.h" #include "../sys/sys_loadlib.h"
} #endif
#include "../gamespy/gcdkey/gcdkeyc.h" #include "../gamespy/gcdkey/gcdkeyc.h"
#include <climits> #include <climits>
#ifdef USE_RENDERER_DLOPEN
cvar_t* cl_renderer;
#endif
cvar_t *cl_nodelta; cvar_t *cl_nodelta;
cvar_t *cl_debugMove; cvar_t *cl_debugMove;
@ -137,14 +130,19 @@ clientGameExport_t *cge;
// Structure containing functions exported from refresh DLL // Structure containing functions exported from refresh DLL
refexport_t re; refexport_t re;
#ifdef USE_RENDERER_DLOPEN
static void *rendererLib = NULL;
#endif
qboolean camera_reset; qboolean camera_reset;
qboolean camera_active; qboolean camera_active;
vec3_t camera_offset; vec3_t camera_offset;
#ifdef USE_RENDERER_DLL
// su44: for plugable renderer system
refexport_t* (*DGetRefAPI)(int apiVersion, refimport_t * rimp) = NULL;
static cvar_t *cl_renderer = NULL;
static void *rendererLib = NULL;
#endif // USE_RENDERER_DLL
ping_t cl_pinglist[MAX_PINGREQUESTS]; ping_t cl_pinglist[MAX_PINGREQUESTS];
typedef struct serverStatus_s typedef struct serverStatus_s
@ -173,27 +171,6 @@ void CL_ServerStatus_f(void);
void CL_ServerStatusResponse( netadr_t from, msg_t *msg ); void CL_ServerStatusResponse( netadr_t from, msg_t *msg );
static qboolean cl_bCLSystemStarted = qfalse; static qboolean cl_bCLSystemStarted = qfalse;
static qboolean cl_updateNotified = qfalse;
/*
===============
CL_UseLargeLightmap
Added in 2.0
Returns true if the standard BSP file should be used, false if the smaller lightmap BSP file should be used
===============
*/
qboolean CL_UseLargeLightmap(const char* mapName) {
char buffer[MAX_QPATH];
Com_sprintf(buffer, sizeof(buffer), "maps/%s_sml.bsp", mapName);
if (FS_ReadFileEx(buffer, NULL, qtrue) == -1) {
return qtrue;
}
return Cvar_Get("r_largemap", "0", 0)->integer;
}
/* /*
=============== ===============
@ -805,10 +782,9 @@ void CL_ShutdownAll(qboolean shutdownRef) {
TIKI_FreeAll(); TIKI_FreeAll();
// shutdown the renderer // shutdown the renderer
if(shutdownRef) if ( re.Shutdown ) {
CL_ShutdownRef();
else if(re.Shutdown)
re.Shutdown( qfalse ); // don't destroy window or context re.Shutdown( qfalse ); // don't destroy window or context
}
cls.uiStarted = qfalse; cls.uiStarted = qfalse;
cls.cgameStarted = qfalse; cls.cgameStarted = qfalse;
@ -1584,24 +1560,19 @@ void CL_Vid_Restart_f( void ) {
S_BeginRegistration(); S_BeginRegistration();
// shutdown the UI
//CL_ShutdownUI();
// shutdown the renderer and clear the renderer interface // shutdown the renderer and clear the renderer interface
CL_ShutdownRef(); CL_ShutdownRef();
cls.rendererRegistered = qfalse;
// shutdown the CGame // shutdown the CGame
CL_ShutdownCGame(); CL_ShutdownCGame();
// initialize the renderer interface // initialize the renderer interface
CL_InitRef(); CL_InitRef();
// initialize the UI
//CL_InitializeUI();
// initialize the ui library // initialize the ui library
UI_ResolutionChange(); UI_ResolutionChange();
// clear aliases // clear aliases
Alias_Clear(); Alias_Clear();
cls.rendererRegistered = qfalse;
// unpause so the cgame definately gets a snapshot and renders a frame // unpause so the cgame definately gets a snapshot and renders a frame
Com_Unpause(); Com_Unpause();
@ -2583,7 +2554,7 @@ void CL_CheckUserinfo( void ) {
// send a reliable userinfo update if needed // send a reliable userinfo update if needed
if(cvar_modifiedFlags & CVAR_USERINFO) if(cvar_modifiedFlags & CVAR_USERINFO)
{ {
if (Com_SanitizeName(name->string, szSanitizedName, sizeof(szSanitizedName))) { if (Com_SanitizeName(name->string, szSanitizedName)) {
Cvar_Set("name", szSanitizedName); Cvar_Set("name", szSanitizedName);
} }
@ -2593,43 +2564,9 @@ void CL_CheckUserinfo( void ) {
} }
void CL_SetFrameNumber(int frameNumber) { void CL_SetFrameNumber(int frameNumber) {
if (!re.SetFrameNumber) {
return;
}
re.SetFrameNumber(frameNumber); re.SetFrameNumber(frameNumber);
} }
/*
==================
CL_VerifyUpdate
Check for a new version and display a message box
when a new version is available
==================
*/
void CL_VerifyUpdate() {
if (cl_updateNotified) {
return;
}
int lastMajor, lastMinor, lastPatch;
if (updateChecker.CheckNewVersion(lastMajor, lastMinor, lastPatch)) {
cl_updateNotified = true;
const char *updateText =
va("A new update is available!\n"
"The latest version is v%d.%d.%d (you are running v%s).\n"
"Check https://github.com/openmoh/openmohaa for more.",
lastMajor,
lastMinor,
lastPatch,
PRODUCT_VERSION_NUMBER_STRING);
UIMessageDialog::ShowMessageBox("Update available", updateText);
}
}
/* /*
================== ==================
CL_Frame CL_Frame
@ -2668,8 +2605,6 @@ void CL_Frame ( int msec ) {
S_TriggeredMusic_PlayIntroMusic(); S_TriggeredMusic_PlayIntroMusic();
UI_MenuEscape("main"); UI_MenuEscape("main");
} }
CL_VerifyUpdate();
} else if (clc.state == CA_CINEMATIC) { } else if (clc.state == CA_CINEMATIC) {
UI_ForceMenuOff(qtrue); UI_ForceMenuOff(qtrue);
} }
@ -2854,13 +2789,13 @@ CL_ShutdownRef
============ ============
*/ */
void CL_ShutdownRef( void ) { void CL_ShutdownRef( void ) {
if ( re.Shutdown ) { if ( !re.Shutdown ) {
re.Shutdown( qtrue ); return;
} }
re.Shutdown( qtrue );
Com_Memset( &re, 0, sizeof( re ) ); Com_Memset( &re, 0, sizeof( re ) );
#ifdef USE_RENDERER_DLL
#ifdef USE_RENDERER_DLOPEN // su44: remember to unload renderer library
if(rendererLib) { if(rendererLib) {
Sys_UnloadLibrary(rendererLib); Sys_UnloadLibrary(rendererLib);
rendererLib = NULL; rendererLib = NULL;
@ -3039,105 +2974,22 @@ void CL_CG_EndTiki( dtiki_t *tiki ) {
} }
} }
/*
============
CL_CG_EndTiki
============
*/
extern "C" extern "C"
int CL_ScaledMilliseconds(void) { int CL_ScaledMilliseconds(void) {
return Sys_Milliseconds()*com_timescale->value; return Sys_Milliseconds()*com_timescale->value;
} }
/*
============
CL_RefFS_WriteFile
============
*/
void CL_RefFS_WriteFile(const char* qpath, const void* buffer, int size) { void CL_RefFS_WriteFile(const char* qpath, const void* buffer, int size) {
FS_WriteFile(qpath, buffer, size); FS_WriteFile(qpath, buffer, size);
} }
/*
============
CL_RefFS_ListFiles
============
*/
char** CL_RefFS_ListFiles(const char* name, const char* extension, int* numfilesfound) { char** CL_RefFS_ListFiles(const char* name, const char* extension, int* numfilesfound) {
return FS_ListFiles(name, extension, qtrue, numfilesfound); return FS_ListFiles(name, extension, qtrue, numfilesfound);
} }
/*
============
CL_RefCIN_UploadCinematic
============
*/
void CL_RefCIN_UploadCinematic(int handle) { void CL_RefCIN_UploadCinematic(int handle) {
} }
/*
============
CL_RefTIKI_GetNumChannels
============
*/
int CL_RefTIKI_GetNumChannels(dtiki_t* tiki) {
return tiki->m_boneList.NumChannels();
}
/*
============
CL_RefTIKI_GetLocalChannel
============
*/
int CL_RefTIKI_GetLocalChannel(dtiki_t* tiki, int channel) {
return tiki->m_boneList.LocalChannel(channel);
}
/*
============
CL_RefTIKI_GetLocalFromGlobal
============
*/
int CL_RefTIKI_GetLocalFromGlobal(dtiki_t* tiki, int channel) {
return tiki->m_boneList.GetLocalFromGlobal(channel);
}
/*
============
CL_RefSKEL_GetMorphWeightFrame
============
*/
int CL_RefSKEL_GetMorphWeightFrame(void* skeletor, int index, float time, int* data) {
return ((skeletor_c*)skeletor)->GetMorphWeightFrame(index, time, data);
}
/*
============
CL_RefSKEL_GetBoneParent
============
*/
int CL_RefSKEL_GetBoneParent(void* skeletor, int boneIndex) {
return ((skeletor_c*)skeletor)->GetBoneParent(boneIndex);
}
/*
============
CL_GetRefSequence
============
*/
int CL_GetRefSequence(void) {
return cls.refSequence;
}
/*
============
CL_IsRendererLoaded
============
*/
qboolean CL_IsRendererLoaded(void) {
return re.Shutdown != NULL;
}
/* /*
============ ============
CL_InitRef CL_InitRef
@ -3146,40 +2998,12 @@ CL_InitRef
void CL_InitRef( void ) { void CL_InitRef( void ) {
refimport_t ri; refimport_t ri;
refexport_t *ret; refexport_t *ret;
#ifdef USE_RENDERER_DLOPEN #ifdef USE_RENDERER_DLL
GetRefAPI_t GetRefAPI; char dllName[256];
char dllName[MAX_OSPATH];
#endif #endif
Com_Printf( "----- Initializing Renderer ----\n" ); Com_Printf( "----- Initializing Renderer ----\n" );
#ifdef USE_RENDERER_DLOPEN
cl_renderer = Cvar_Get("cl_renderer", "opengl1", CVAR_ARCHIVE | CVAR_LATCH);
Com_sprintf(dllName, sizeof(dllName), "renderer_%s" ARCH_SUFFIX DLL_SUFFIX DLL_EXT, cl_renderer->string);
if(!(rendererLib = Sys_LoadDll(dllName, qfalse)) && strcmp(cl_renderer->string, cl_renderer->resetString))
{
Com_Printf("failed:\n\"%s\"\n", Sys_LibraryError());
Cvar_ForceReset("cl_renderer");
Com_sprintf(dllName, sizeof(dllName), "renderer_opengl1" ARCH_SUFFIX DLL_SUFFIX DLL_EXT);
rendererLib = Sys_LoadDll(dllName, qfalse);
}
if(!rendererLib)
{
Com_Printf("failed:\n\"%s\"\n", Sys_LibraryError());
Com_Error(ERR_FATAL, "Failed to load renderer");
}
GetRefAPI = (GetRefAPI_t)Sys_LoadFunction(rendererLib, "GetRefAPI");
if(!GetRefAPI)
{
Com_Error(ERR_FATAL, "Can't load symbol GetRefAPI: '%s'", Sys_LibraryError());
}
#endif
ri.Cmd_AddCommand = Cmd_AddCommand; ri.Cmd_AddCommand = Cmd_AddCommand;
ri.Cmd_RemoveCommand = Cmd_RemoveCommand; ri.Cmd_RemoveCommand = Cmd_RemoveCommand;
ri.Cmd_Argc = Cmd_Argc; ri.Cmd_Argc = Cmd_Argc;
@ -3203,10 +3027,8 @@ void CL_InitRef( void ) {
ri.CM_DrawDebugSurface = CM_DrawDebugSurface; ri.CM_DrawDebugSurface = CM_DrawDebugSurface;
ri.FS_OpenFile = FS_FOpenFileRead; ri.FS_OpenFile = FS_FOpenFileRead;
ri.FS_OpenFileWrite = FS_FOpenFileWrite;
ri.FS_CloseFile = FS_FCloseFile; ri.FS_CloseFile = FS_FCloseFile;
ri.FS_Read = FS_Read; ri.FS_Read = FS_Read;
ri.FS_Write = FS_Write;
ri.FS_Seek = FS_Seek; ri.FS_Seek = FS_Seek;
ri.FS_ReadFile = FS_ReadFile; ri.FS_ReadFile = FS_ReadFile;
ri.FS_ReadFileEx = FS_ReadFileEx; ri.FS_ReadFileEx = FS_ReadFileEx;
@ -3216,10 +3038,8 @@ void CL_InitRef( void ) {
ri.FS_ListFiles = CL_RefFS_ListFiles; ri.FS_ListFiles = CL_RefFS_ListFiles;
ri.FS_FileIsInPAK = FS_FileIsInPAK; ri.FS_FileIsInPAK = FS_FileIsInPAK;
ri.FS_FileExists = FS_FileExists; ri.FS_FileExists = FS_FileExists;
ri.FS_CanonicalFilename = FS_CanonicalFilename;
ri.Cvar_Get = Cvar_Get; ri.Cvar_Get = Cvar_Get;
ri.Cvar_Set = Cvar_Set; ri.Cvar_Set = Cvar_Set;
ri.Cvar_SetValue = Cvar_SetValue;
ri.Cvar_SetDefault = Cvar_SetDefault; ri.Cvar_SetDefault = Cvar_SetDefault;
ri.CM_EntityString = CM_EntityString; ri.CM_EntityString = CM_EntityString;
@ -3268,30 +3088,40 @@ void CL_InitRef( void ) {
ri.Sys_GLimpInit = Sys_GLimpInit; ri.Sys_GLimpInit = Sys_GLimpInit;
ri.Sys_LowPhysicalMemory = Sys_LowPhysicalMemory; ri.Sys_LowPhysicalMemory = Sys_LowPhysicalMemory;
// #ifdef USE_RENDERER_DLL
// Added in OPM // su44: load renderer dll
// cl_renderer = Cvar_Get("cl_renderer", "glom", CVAR_ARCHIVE);
ri.UI_LoadResource = UI_LoadResource; Q_snprintf(dllName, sizeof(dllName), "renderer_%s" ARCH_STRING DLL_EXT, cl_renderer->string);
ri.CM_PointLeafnum = CM_PointLeafnum; Com_Printf("Loading \"%s\"...", dllName);
ri.CM_LeafCluster = CM_LeafCluster; if((rendererLib = Sys_LoadLibrary(dllName)) == 0) {
#ifdef _WIN32
Com_Error(ERR_FATAL, "failed:\n\"%s\"\n", Sys_LibraryError());
#else
char fn[1024];
ri.TIKI_CalcLodConsts = TIKI_CalcLodConsts; Q_strncpyz(fn, Sys_Cwd(), sizeof(fn));
ri.TIKI_CalculateBounds = TIKI_CalculateBounds; strncat(fn, "/", sizeof(fn) - strlen(fn) - 1);
ri.TIKI_FindTiki = TIKI_FindTiki; strncat(fn, dllName, sizeof(fn) - strlen(fn) - 1);
ri.TIKI_RegisterTikiFlags = TIKI_RegisterTikiFlags;
ri.TIKI_GetSkeletor = TIKI_GetSkeletor;
ri.TIKI_GetSkel = TIKI_GetSkel;
ri.TIKI_GetSkelAnimFrame = TIKI_GetSkelAnimFrame;
ri.TIKI_GlobalRadius = TIKI_GlobalRadius;
ri.TIKI_FindSkelByHeader = TIKI_FindSkelByHeader;
ri.TIKI_GetNumChannels = CL_RefTIKI_GetNumChannels;
ri.TIKI_GetLocalChannel = CL_RefTIKI_GetLocalChannel;
ri.TIKI_GetLocalFromGlobal = CL_RefTIKI_GetLocalFromGlobal;
ri.SKEL_GetBoneParent = CL_RefSKEL_GetBoneParent; Com_Printf("Loading \"%s\"...", fn);
ri.SKEL_GetMorphWeightFrame = CL_RefSKEL_GetMorphWeightFrame; if((rendererLib = Sys_LoadLibrary(fn)) == 0)
{
Com_Error(ERR_FATAL, "failed:\n\"%s\"", Sys_LibraryError());
}
#endif /* _WIN32 */
}
Com_Printf("done\n");
DGetRefAPI = Sys_LoadFunction(rendererLib, "GetRefAPI");
if(!DGetRefAPI)
{
Com_Error(ERR_FATAL, "Can't load symbol GetRefAPI: '%s'", Sys_LibraryError());
}
ret = DGetRefAPI( REF_API_VERSION, &ri );
#else
ret = GetRefAPI( REF_API_VERSION, &ri ); ret = GetRefAPI( REF_API_VERSION, &ri );
#endif
#if defined __USEA3D && defined __A3D_GEOM #if defined __USEA3D && defined __A3D_GEOM
hA3Dg_ExportRenderGeom (ret); hA3Dg_ExportRenderGeom (ret);
@ -3307,8 +3137,6 @@ void CL_InitRef( void ) {
// unpause so the cgame definately gets a snapshot and renders a frame // unpause so the cgame definately gets a snapshot and renders a frame
Cvar_Set( "cl_paused", "0" ); Cvar_Set( "cl_paused", "0" );
cls.refSequence++;
} }
@ -3653,13 +3481,21 @@ void CL_Init( void ) {
cl_consoleKeys = Cvar_Get( "cl_consoleKeys", "~ ` 0x7e 0x60", CVAR_ARCHIVE ); cl_consoleKeys = Cvar_Get( "cl_consoleKeys", "~ ` 0x7e 0x60", CVAR_ARCHIVE );
// userinfo // userinfo
name = Cvar_Get ("name", va("UnnamedSoldier#%d", rand() % 100000), CVAR_USERINFO | CVAR_ARCHIVE); name = Cvar_Get ("name", "UnnamedSoldier", CVAR_USERINFO | CVAR_ARCHIVE );
cl_rate = Cvar_Get ("rate", "25000", CVAR_USERINFO | CVAR_ARCHIVE ); cl_rate = Cvar_Get ("rate", "5000", CVAR_USERINFO | CVAR_ARCHIVE );
Cvar_Get ("snaps", "20", CVAR_USERINFO | CVAR_ARCHIVE ); Cvar_Get ("snaps", "20", CVAR_USERINFO | CVAR_ARCHIVE );
Cvar_Get ("password", "", CVAR_USERINFO); Cvar_Get ("password", "", CVAR_USERINFO);
Cvar_Get ("dm_playermodel", "american_army", CVAR_USERINFO | CVAR_ARCHIVE ); Cvar_Get ("dm_playermodel", "american_army", CVAR_USERINFO | CVAR_ARCHIVE );
Cvar_Get ("dm_playergermanmodel", "german_wehrmacht_soldier", CVAR_USERINFO | CVAR_ARCHIVE ); Cvar_Get ("dm_playergermanmodel", "german_wehrmacht_soldier", CVAR_USERINFO | CVAR_ARCHIVE );
Cvar_Get ("cg_predictItems", "1", CVAR_USERINFO | CVAR_ARCHIVE );
// cgame might not be initialized before menu is used
Cvar_Get ("cg_viewsize", "100", CVAR_ARCHIVE );
Cvar_Get ("cg_running", "0", CVAR_ROM );
// //
// register our commands // register our commands
// //
@ -3720,12 +3556,6 @@ void CL_Init( void ) {
end = Sys_Milliseconds(); end = Sys_Milliseconds();
if (com_gotOriginalConfig) {
// Added in OPM
// Apply config tweaks after loading the original config
CL_ApplyOriginalConfigTweaks();
}
Com_Printf( "----- Client Initialization Complete ----- %i ms\n", start - end ); Com_Printf( "----- Client Initialization Complete ----- %i ms\n", start - end );
} }
@ -4095,7 +3925,7 @@ CL_ServerStatusResponse
void CL_ServerStatusResponse( netadr_t from, msg_t *msg ) { void CL_ServerStatusResponse( netadr_t from, msg_t *msg ) {
const char *s; const char *s;
char info[MAX_INFO_STRING]; char info[MAX_INFO_STRING];
int i, l, ping; int i, l, score, ping;
int len; int len;
serverStatus_t *serverStatus; serverStatus_t *serverStatus;
@ -4149,7 +3979,7 @@ void CL_ServerStatusResponse( netadr_t from, msg_t *msg ) {
if (serverStatus->print) { if (serverStatus->print) {
Com_Printf("\nPlayers:\n"); Com_Printf("\nPlayers:\n");
Com_Printf("num: ping: name:\n"); Com_Printf("num: score: ping: name:\n");
} }
for (i = 0, s = MSG_ReadStringLine( msg ); *s; s = MSG_ReadStringLine( msg ), i++) { for (i = 0, s = MSG_ReadStringLine( msg ); *s; s = MSG_ReadStringLine( msg ), i++) {
@ -4157,14 +3987,16 @@ void CL_ServerStatusResponse( netadr_t from, msg_t *msg ) {
Com_sprintf(&serverStatus->string[len], sizeof(serverStatus->string)-len, "\\%s", s); Com_sprintf(&serverStatus->string[len], sizeof(serverStatus->string)-len, "\\%s", s);
if (serverStatus->print) { if (serverStatus->print) {
ping = 0; score = ping = 0;
sscanf(s, "%d", &ping); sscanf(s, "%d %d", &score, &ping);
s = strchr(s, ' '); s = strchr(s, ' ');
if (s)
s = strchr(s+1, ' ');
if (s) if (s)
s++; s++;
else else
s = "unknown"; s = "unknown";
Com_Printf("%-2d %-3d %s\n", i, ping, s ); Com_Printf("%-2d %-3d %-3d %s\n", i, score, ping, s );
} }
} }
len = strlen(serverStatus->string); len = strlen(serverStatus->string);
@ -4902,15 +4734,3 @@ void TIKI_CG_Command_ProcessFile(char* filename, qboolean quiet, dtiki_t* curTik
Com_Printf("NO CGE \n"); Com_Printf("NO CGE \n");
} }
void CL_ApplyOriginalConfigTweaks()
{
cvar_t* snaps = Cvar_Get("snaps", "", 0);
// Those variables are not editable via UI so reset them
// snaps/maxpackets can also have wrong values due to them being changed
// via stufftext
Cvar_Set("snaps", snaps->resetString);
Cvar_Set("cl_maxpackets", cl_maxpackets->resetString);
}

View file

@ -568,7 +568,6 @@ void CL_ParseGamestate( msg_t *msg ) {
csNum = CPT_NormalizeConfigstring(i); csNum = CPT_NormalizeConfigstring(i);
if (csNum < 0 || csNum >= MAX_CONFIGSTRINGS) { if (csNum < 0 || csNum >= MAX_CONFIGSTRINGS) {
Com_Error(ERR_DROP, "configstring > MAX_CONFIGSTRINGS"); Com_Error(ERR_DROP, "configstring > MAX_CONFIGSTRINGS");
return;
} }
s = MSG_ReadScrambledBigString(msg); s = MSG_ReadScrambledBigString(msg);
len = strlen(s); len = strlen(s);
@ -589,7 +588,8 @@ void CL_ParseGamestate( msg_t *msg ) {
//Com_Memset (&nullstate, 0, sizeof(nullstate)); //Com_Memset (&nullstate, 0, sizeof(nullstate));
MSG_GetNullEntityState(&nullstate); MSG_GetNullEntityState(&nullstate);
es = &cl.entityBaselines[ newnum ]; es = &cl.entityBaselines[ newnum ];
MSG_ReadDeltaEntity( msg, &nullstate, es, newnum, cls.serverFrameTime); // FIXME: frametime
MSG_ReadDeltaEntity( msg, &nullstate, es, newnum, 0.0);
} else { } else {
Com_Error( ERR_DROP, "CL_ParseGamestate: bad command byte %i", cmd ); Com_Error( ERR_DROP, "CL_ParseGamestate: bad command byte %i", cmd );
} }
@ -607,24 +607,15 @@ void CL_ParseGamestate( msg_t *msg ) {
if(cl_autoRecordDemo->integer && clc.demorecording) if(cl_autoRecordDemo->integer && clc.demorecording)
CL_StopRecord_f(); CL_StopRecord_f();
if (clc.state == CA_CONNECTED && !Cvar_Get("sv_paks", "", 0)->string[0]) {
// Added in 2.30
FS_Restart(clc.checksumFeed);
} else {
// reinitialize the filesystem if the game directory has changed // reinitialize the filesystem if the game directory has changed
FS_ConditionalRestart( clc.checksumFeed, qfalse ); FS_ConditionalRestart( clc.checksumFeed, qfalse );
}
clc.state = CA_LOADING; clc.state = CA_LOADING;
if (!com_sv_running->integer) if (!com_sv_running->integer)
{ {
const char *info = cl.gameState.stringData + cl.gameState.stringOffsets[CS_SERVERINFO]; const char *info = cl.gameState.stringData + cl.gameState.stringOffsets[CS_SERVERINFO];
const char *mapname = Info_ValueForKey(info, "mapname");
// Added in 2.0
Cvar_Set("mapname", mapname);
UI_ClearState(); UI_ClearState();
UI_BeginLoad(mapname); UI_BeginLoad(Info_ValueForKey(info, "mapname"));
} }
// This used to call CL_StartHunkUsers, but now we enter the download state before loading the // This used to call CL_StartHunkUsers, but now we enter the download state before loading the

View file

@ -29,7 +29,6 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
#include "../qcommon/q_version.h" #include "../qcommon/q_version.h"
#include "cl_ui.h" #include "cl_ui.h"
#include "cl_uigamespy.h"
#include <ctime> #include <ctime>
@ -144,19 +143,12 @@ static unsigned int totalLoadTime;
static unsigned int currentLoadTime; static unsigned int currentLoadTime;
unsigned char UIListCtrlItem[8]; unsigned char UIListCtrlItem[8];
static const float maxWidthRes = 1920;
static const float maxHeightRes = 1080;
inventory_t client_inv; inventory_t client_inv;
bind_t client_bind; bind_t client_bind;
static str scoreboard_menuname; static str scoreboard_menuname;
static str ui_sCurrentLoadingMenu; static str ui_sCurrentLoadingMenu;
static Container<Menu *> hudList; static Container<Menu *> hudList;
const UColor UWhiteChatMessageColor(0.75, 0.75, 0.75);
const UColor URedChatMessageColor(1.0, 0.25, 0.25);
const UColor UGreenChatMessageColor(0.0, 1.0, 0.25, 1.0);
void UI_MultiplayerMenuWidgetsUpdate(void); void UI_MultiplayerMenuWidgetsUpdate(void);
void UI_MultiplayerMainMenuWidgetsUpdate(void); void UI_MultiplayerMainMenuWidgetsUpdate(void);
void UI_MainMenuWidgetsUpdate(void); void UI_MainMenuWidgetsUpdate(void);
@ -220,15 +212,15 @@ static UIRect2D getDefaultConsoleRectangle(void)
f[i] = floor(f[i]); f[i] = floor(f[i]);
} }
rect.pos.x = f[0] - uid.vidWidth; rect.pos.x = f[0] - cls.glconfig.vidWidth;
rect.pos.y = f[1] - uid.vidHeight; rect.pos.y = f[1] - cls.glconfig.vidHeight;
rect.size.width = f[2] + 50.0; rect.size.width = f[2] + 50.0;
rect.size.height = f[3] + 50.0; rect.size.height = f[3] + 50.0;
} else { } else {
rect.pos.x = 25.0; rect.pos.x = 25.0;
rect.pos.y = 25.0; rect.pos.y = 25.0;
rect.size.width = (uid.vidWidth - 50); rect.size.width = (cls.glconfig.vidWidth - 50);
rect.size.height = (uid.vidHeight / 2); rect.size.height = (cls.glconfig.vidHeight / 2);
} }
return rect; return rect;
@ -975,15 +967,15 @@ static UIRect2D getDefaultDMConsoleRectangle(void)
f[i] = floor(f[i]); f[i] = floor(f[i]);
} }
rect.pos.x = f[0] - uid.vidWidth; rect.pos.x = f[0] - cls.glconfig.vidWidth;
rect.pos.y = f[1] - uid.vidHeight; rect.pos.y = f[1] - cls.glconfig.vidHeight;
rect.size.width = f[2] + 50.0; rect.size.width = f[2] + 50.0;
rect.size.height = f[3] + 50.0; rect.size.height = f[3] + 50.0;
} else { } else {
rect.pos.x = 0; rect.pos.x = 0;
rect.pos.y = uid.vidHeight * 0.58; rect.pos.y = cls.glconfig.vidHeight * 0.58;
rect.size.width = uid.vidWidth; rect.size.width = cls.glconfig.vidWidth;
rect.size.height = uid.vidHeight * 0.415; rect.size.height = cls.glconfig.vidHeight * 0.415;
} }
return rect; return rect;
@ -1005,19 +997,19 @@ static UIRect2D getQuickMessageDMConsoleRectangle(void)
f[i] = floor(f[i]); f[i] = floor(f[i]);
} }
rect.pos.x = f[0] - uid.vidWidth; rect.pos.x = f[0] - cls.glconfig.vidWidth;
rect.pos.y = f[1] - uid.vidHeight; rect.pos.y = f[1] - cls.glconfig.vidHeight;
rect.size.width = f[2] + 50.0; rect.size.width = f[2] + 50.0;
rect.size.height = f[3] + 50.0; rect.size.height = f[3] + 50.0;
} else { } else {
rect.pos.x = 0; rect.pos.x = 0;
rect.pos.y = uid.vidHeight * 0.66; rect.pos.y = cls.glconfig.vidHeight * 0.66;
rect.size.width = uid.vidWidth; rect.size.width = cls.glconfig.vidWidth;
// Fixed in 2.0 // Fixed in 2.0
// Was 38.0 in 1.11 and below // Was 38.0 in 1.11 and below
// This prevents characters to be seen from the DM console // This prevents characters to be seen from the DM console
// in the quick message console // in the quick message console
rect.size.height = 36.0 * uid.scaleRes[1]; rect.size.height = 36.0;
} }
return rect; return rect;
@ -1136,20 +1128,6 @@ static void DMConsoleCommandHandler(const char *txt)
CL_AddReliableCommand(szStringOut, qfalse); CL_AddReliableCommand(szStringOut, qfalse);
} }
/*
====================
getScreenWidth
====================
*/
static float getScreenWidth()
{
if (uid.bHighResScaling) {
return maxWidthRes;
} else {
return uid.vidWidth;
}
}
/* /*
==================== ====================
getNewConsole getNewConsole
@ -1211,14 +1189,14 @@ getDefaultGMBoxRectangle
static UIRect2D getDefaultGMBoxRectangle(void) static UIRect2D getDefaultGMBoxRectangle(void)
{ {
UIRect2D dmRect = getDefaultDMBoxRectangle(); UIRect2D dmRect = getDefaultDMBoxRectangle();
float height = uid.vidHeight * ui_compass_scale->value * 0.25f; float height = cls.glconfig.vidHeight * ui_compass_scale->value * 0.25f;
float y = dmRect.size.height + dmRect.pos.y; float y = dmRect.size.height + dmRect.pos.y;
if (height < y) { if (height < y) {
height = y; height = y;
} }
return UIRect2D(20.0f, height, (getScreenWidth() - 20) * uid.scaleRes[0], 128.0f * uid.scaleRes[1]); return UIRect2D(20.0f, height, cls.glconfig.vidWidth - 20, 128.0f);
} }
/* /*
@ -1228,12 +1206,9 @@ getDefaultDMBoxRectangle
*/ */
static UIRect2D getDefaultDMBoxRectangle(void) static UIRect2D getDefaultDMBoxRectangle(void)
{ {
float width; float width = cls.glconfig.vidWidth * ui_compass_scale->value * 0.2f;
float screenWidth = getScreenWidth();
width = screenWidth * uid.scaleRes[0] * ui_compass_scale->value * 0.2f; return UIRect2D(width, 0, cls.glconfig.vidWidth - (width + 192.0f), 120.0f);
return UIRect2D(width, 0, (screenWidth - (width + 192.0f)) * uid.scaleRes[0], 120.0f * uid.scaleRes[1]);
} }
/* /*
@ -1246,21 +1221,6 @@ float UI_GetObjectivesTop(void)
return getDefaultGMBoxRectangle().pos.y; return getDefaultGMBoxRectangle().pos.y;
} }
/*
====================
UI_GetObjectivesTop
====================
*/
void UI_GetHighResolutionScale(vec2_t scale)
{
if (uid.bHighResScaling) {
scale[0] = uid.scaleRes[0];
scale[1] = uid.scaleRes[1];
} else {
scale[0] = scale[1] = 1.0;
}
}
/* /*
==================== ====================
UI_ShowHudList UI_ShowHudList
@ -1308,7 +1268,7 @@ UI_PrintConsole
*/ */
void UI_PrintConsole(const char *msg) void UI_PrintConsole(const char *msg)
{ {
const UColor *pColor = NULL; UColor *pColor = NULL;
const char *pszString; const char *pszString;
char szString[1024]; char szString[1024];
char szBlah[1024]; char szBlah[1024];
@ -1330,7 +1290,7 @@ void UI_PrintConsole(const char *msg)
break; break;
case MESSAGE_CHAT_WHITE: case MESSAGE_CHAT_WHITE:
bDMMessage = qtrue; bDMMessage = qtrue;
pColor = &UWhiteChatMessageColor; pColor = &UGrey;
break; break;
case MESSAGE_WHITE: case MESSAGE_WHITE:
bBold = qtrue; bBold = qtrue;
@ -1338,11 +1298,11 @@ void UI_PrintConsole(const char *msg)
break; break;
case MESSAGE_CHAT_RED: case MESSAGE_CHAT_RED:
bDeathMessage = MESSAGE_CHAT_RED; bDeathMessage = MESSAGE_CHAT_RED;
pColor = &URedChatMessageColor; pColor = &ULightRed;
break; break;
case MESSAGE_CHAT_GREEN: case MESSAGE_CHAT_GREEN:
bDeathMessage = MESSAGE_CHAT_GREEN; bDeathMessage = MESSAGE_CHAT_GREEN;
pColor = &UGreenChatMessageColor; pColor = &UGreen;
break; break;
} }
@ -1721,11 +1681,11 @@ UI_ClearBackground
void UI_ClearBackground(void) void UI_ClearBackground(void)
{ {
re.Set2DWindow( re.Set2DWindow(
0, 0, uid.vidWidth, uid.vidHeight, 0, uid.vidWidth, uid.vidHeight, 0, -1, 1 0, 0, cls.glconfig.vidWidth, cls.glconfig.vidHeight, 0, cls.glconfig.vidWidth, cls.glconfig.vidHeight, 0, -1, 1
); );
re.Scissor(0, 0, uid.vidWidth, uid.vidHeight); re.Scissor(0, 0, cls.glconfig.vidWidth, cls.glconfig.vidHeight);
re.SetColor(g_color_table[0]); re.SetColor(g_color_table[0]);
re.DrawBox(0, 0, uid.vidWidth, uid.vidHeight); re.DrawBox(0, 0, cls.glconfig.vidWidth, cls.glconfig.vidHeight);
re.SetColor(NULL); re.SetColor(NULL);
} }
@ -3138,7 +3098,7 @@ void UI_MapList_f(void)
MapRunnerClass *map = new MapRunnerClass; MapRunnerClass *map = new MapRunnerClass;
map->Setup("maps", mappath, ".bsp", "_sml"); map->Setup("maps", mappath, ".bsp", "_sml");
CL_SetMousePos(uid.vidWidth / 2, uid.vidHeight / 2); CL_SetMousePos(cls.glconfig.vidWidth / 2, cls.glconfig.vidHeight / 2);
} }
/* /*
@ -3178,7 +3138,7 @@ void UI_DMMapSelect_f(void)
MpMapPickerClass *map = new MpMapPickerClass; MpMapPickerClass *map = new MpMapPickerClass;
map->Setup(basepath, mappath, gametype); map->Setup(basepath, mappath, gametype);
CL_SetMousePos(uid.vidWidth / 2, uid.vidHeight / 2); CL_SetMousePos(cls.glconfig.vidWidth / 2, cls.glconfig.vidHeight / 2);
} }
/* /*
@ -3362,7 +3322,7 @@ void UI_PlayerModel_f(void)
PlayerModelPickerClass *picker = new PlayerModelPickerClass; PlayerModelPickerClass *picker = new PlayerModelPickerClass;
picker->Setup("models/player", modelpath, bGermanModel); picker->Setup("models/player", modelpath, bGermanModel);
CL_SetMousePos(uid.vidWidth / 2, uid.vidHeight / 2); CL_SetMousePos(cls.glconfig.vidWidth / 2, cls.glconfig.vidHeight / 2);
} }
/* /*
@ -3752,7 +3712,6 @@ void CL_FillUIImports(void)
uii.Rend_Scissor = re.Scissor; uii.Rend_Scissor = re.Scissor;
uii.Rend_Set2D = re.Set2DWindow; uii.Rend_Set2D = re.Set2DWindow;
uii.Rend_SetColor = re.SetColor; uii.Rend_SetColor = re.SetColor;
uii.Rend_ImageExists = re.ImageExists;
uii.Cmd_Stuff = Cbuf_AddText; uii.Cmd_Stuff = Cbuf_AddText;
uii.Cvar_GetString = CvarGetForUI; uii.Cvar_GetString = CvarGetForUI;
@ -3791,9 +3750,6 @@ void CL_FillUIImports(void)
uii.GetConfigstring = CL_ConfigString; uii.GetConfigstring = CL_ConfigString;
uii.UI_CloseDMConsole = UI_CloseDMConsole; uii.UI_CloseDMConsole = UI_CloseDMConsole;
uii.GetRefSequence = CL_GetRefSequence;
uii.IsRendererLoaded = CL_IsRendererLoaded;
} }
/* /*
@ -3850,7 +3806,7 @@ void UI_CreateDialog(
{ {
UIDialog *dlg = new UIDialog; UIDialog *dlg = new UIDialog;
UIRect2D rect = UIRect2D rect =
UIRect2D((uid.vidWidth - width) / 2, (uid.vidHeight - height) / 2, width, height); UIRect2D((cls.glconfig.vidWidth - width) >> 1, (cls.glconfig.vidHeight - height) >> 1, width, height);
UColor bgColor = UWindowColor; UColor bgColor = UWindowColor;
dlg->Create(NULL, rect, title, bgColor, UHudColor); dlg->Create(NULL, rect, title, bgColor, UHudColor);
@ -3880,28 +3836,12 @@ void UI_ResolutionChange(void)
ui_compass_scale = Cvar_Get("ui_compass_scale", "0.75", CVAR_ARCHIVE | CVAR_LATCH); ui_compass_scale = Cvar_Get("ui_compass_scale", "0.75", CVAR_ARCHIVE | CVAR_LATCH);
} else { } else {
// Older version doesn't have an adjustable compass, so assume 0.5 by default // Older version doesn't have an adjustable compass, so assume 0.5 by default
ui_compass_scale = Cvar_Get("ui_compass_scale", "0.55", CVAR_ARCHIVE | CVAR_LATCH); ui_compass_scale = Cvar_Get("ui_compass_scale", "0.5", CVAR_ARCHIVE | CVAR_LATCH);
} }
CL_FillUIImports(); CL_FillUIImports();
CL_FillUIDef(); CL_FillUIDef();
// Added in OPM
// Scaling for high resolutions
if (uid.vidWidth > maxWidthRes && uid.vidHeight > maxHeightRes) {
const float vidRatio = (float)uid.vidWidth / (float)uid.vidHeight;
uid.scaleRes[0] = (float)uid.vidWidth / (maxHeightRes * vidRatio);
uid.scaleRes[1] = (float)uid.vidHeight / maxHeightRes;
//uid.scaleRes[0] = (float)uid.vidWidth / maxWidthRes;
//uid.scaleRes[1] = (float)uid.vidHeight / maxHeightRes;
uid.bHighResScaling = qtrue;
} else {
uid.scaleRes[0] = 1;
uid.scaleRes[1] = 1;
uid.bHighResScaling = qfalse;
}
if (!uie.ResolutionChange) { if (!uie.ResolutionChange) {
return; return;
} }
@ -3936,7 +3876,7 @@ void UI_ResolutionChange(void)
menuManager.RealignMenus(); menuManager.RealignMenus();
if (view3d) { if (view3d) {
frame = UIRect2D(0, 0, uid.vidWidth, uid.vidHeight); frame = UIRect2D(0, 0, cls.glconfig.vidWidth, cls.glconfig.vidHeight);
view3d->setFrame(frame); view3d->setFrame(frame);
} }
@ -4372,9 +4312,11 @@ UI_ShowScoreboard_f
void UI_ShowScoreboard_f(const char *pszMenuName) void UI_ShowScoreboard_f(const char *pszMenuName)
{ {
if (pszMenuName) { if (pszMenuName) {
if (scoreboard_menuname.length() && str::icmp(scoreboard_menuname, pszMenuName) && scoreboard_menu) { if (scoreboard_menuname.length()) {
if (str::icmp(scoreboard_menuname, pszMenuName)) {
scoreboard_menu->ForceHide(); scoreboard_menu->ForceHide();
} }
}
scoreboard_menuname = pszMenuName; scoreboard_menuname = pszMenuName;
} }
@ -4422,12 +4364,9 @@ void UI_HideScoreboard_f(void)
} }
if (scoreboard_menuname.length()) { if (scoreboard_menuname.length()) {
// Fixed in 2.30 (scoreboard_menu check)
if (scoreboard_menu) {
scoreboard_menu->ForceHide(); scoreboard_menu->ForceHide();
} }
} }
}
class ScoreboardListItem : public UIListCtrlItem class ScoreboardListItem : public UIListCtrlItem
{ {
@ -4470,7 +4409,7 @@ void ScoreboardListItem::DrawListItem(int iColumn, const UIRect2D& drawRect, boo
{ {
DrawBox(drawRect, backColor, 1.0); DrawBox(drawRect, backColor, 1.0);
pFont->setColor(textColor); pFont->setColor(textColor);
pFont->Print((drawRect.pos.x + 1) / uid.scaleRes[0], drawRect.pos.y / uid.scaleRes[1], Sys_LV_CL_ConvertString(getListItemString(iColumn)), -1, uid.scaleRes); pFont->Print(drawRect.pos.x + 1, drawRect.pos.y, Sys_LV_CL_ConvertString(getListItemString(iColumn)), -1, qfalse);
if (bTitleItem) { if (bTitleItem) {
UIRect2D lineRect; UIRect2D lineRect;
@ -4523,7 +4462,7 @@ void UI_CreateScoreboard(void)
scoreboard_h = h; scoreboard_h = h;
SCR_AdjustFrom640(&x, &y, &w, &h); SCR_AdjustFrom640(&x, &y, &w, &h);
fColumnScale = uid.vidWidth / 640.0; fColumnScale = cls.glconfig.vidWidth / 640.0;
cge->CG_GetScoreBoardColor(&fR, &fG, &fB, &fA); cge->CG_GetScoreBoardColor(&fR, &fG, &fB, &fA);
cge->CG_GetScoreBoardFontColor(&fFontR, &fFontG, &fFontB, &fFontA); cge->CG_GetScoreBoardFontColor(&fFontR, &fFontG, &fFontB, &fFontA);
@ -5348,7 +5287,6 @@ void CL_InitializeUI(void)
Cmd_AddCommand("setreturnmenu", UI_SetReturnMenuToCurrent); Cmd_AddCommand("setreturnmenu", UI_SetReturnMenuToCurrent);
Cmd_AddCommand("gotoreturnmenu", UI_PushReturnMenu_f); Cmd_AddCommand("gotoreturnmenu", UI_PushReturnMenu_f);
Cmd_AddCommand("salesscreen", UI_SalesScreen_f); Cmd_AddCommand("salesscreen", UI_SalesScreen_f);
Cmd_AddCommand("launchgamespy", UI_LaunchGameSpy_f);
if (developer->integer) { if (developer->integer) {
UColor bgColor; UColor bgColor;
@ -5370,7 +5308,7 @@ void CL_InitializeUI(void)
// Create the 3D view // Create the 3D view
view3d = new View3D; view3d = new View3D;
view3d->setAlwaysOnBottom(true); view3d->setAlwaysOnBottom(true);
view3d->InitFrame(NULL, 0, 0, uid.vidWidth, uid.vidHeight, -1, "facfont-20"); view3d->InitFrame(NULL, 0, 0, cls.glconfig.vidWidth, cls.glconfig.vidHeight, -1, "facfont-20");
view3d->setName("view3d"); view3d->setName("view3d");
view3d->InitSubtitle(); view3d->InitSubtitle();
@ -5566,7 +5504,7 @@ qboolean UI_IsResourceLoaded(const char *name)
case 107: case 107:
return S_IsSoundRegistered(name + 1); return S_IsSoundRegistered(name + 1);
case 110: case 110:
return uii.Rend_ImageExists(name + 1); return R_ImageExists(name + 1);
default: default:
return qfalse; return qfalse;
} }
@ -5827,15 +5765,8 @@ void UI_BeginLoad(const char *pszMapName)
loadName = "maps/"; loadName = "maps/";
loadName += pszMapName; loadName += pszMapName;
mapfile = loadName;
loadName += ".min"; loadName += ".min";
mapfile = loadName + ".bsp";
if (CL_UseLargeLightmap(pszMapName)) {
mapfile += ".bsp";
} else {
// Added in 2.0
mapfile += "_sml.bsp";
}
if (UI_ArchiveLoadMapinfo(mapfile)) { if (UI_ArchiveLoadMapinfo(mapfile)) {
cls.loading = SS_LOADING2; cls.loading = SS_LOADING2;

View file

@ -51,16 +51,12 @@ extern inventory_t client_inv;
extern bind_t client_bind; extern bind_t client_bind;
extern cvar_t *cl_greenfps; extern cvar_t *cl_greenfps;
extern qboolean server_loading; extern qboolean server_loading;
extern const UColor UWhiteChatMessageColor;
extern const UColor URedChatMessageColor;
extern const UColor UGreenChatMessageColor;
const char *CvarGetForUI(const char *name, const char *defval); const char *CvarGetForUI(const char *name, const char *defval);
void UI_ClearState(void); void UI_ClearState(void);
void CL_BeginRegistration(void); void CL_BeginRegistration(void);
void CL_EndRegistration(void); void CL_EndRegistration(void);
float UI_GetObjectivesTop(void); float UI_GetObjectivesTop(void);
void UI_GetHighResolutionScale(vec2_t scale);
// //
// menu // menu

View file

@ -1,6 +1,6 @@
/* /*
=========================================================================== ===========================================================================
Copyright (C) 2024 the OpenMoHAA team Copyright (C) 2015 the OpenMoHAA team
This file is part of OpenMoHAA source code. This file is part of OpenMoHAA source code.
@ -21,7 +21,6 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/ */
#include "cl_ui.h" #include "cl_ui.h"
#include "../qcommon/localization.h"
Event EV_DMBox_Goin Event EV_DMBox_Goin
( (
@ -45,7 +44,8 @@ static float s_dmboxWidth = 384.0;
static float s_dmboxOffsetX = 3.0f; static float s_dmboxOffsetX = 3.0f;
static float s_dmboxOffsetY = 8.0f; static float s_dmboxOffsetY = 8.0f;
CLASS_DECLARATION(UIWidget, UIDMBox, NULL) { CLASS_DECLARATION( UIWidget, UIDMBox, NULL )
{
{ &W_SizeChanged, &UIDMBox::OnSizeChanged }, { &W_SizeChanged, &UIDMBox::OnSizeChanged },
{ &EV_DMBox_Goin, &UIDMBox::MoveInEvent }, { &EV_DMBox_Goin, &UIDMBox::MoveInEvent },
{ &EV_DMBox_Decay, &UIDMBox::DecayEvent }, { &EV_DMBox_Decay, &UIDMBox::DecayEvent },
@ -67,7 +67,8 @@ UIDMBox::UIDMBox()
void UIDMBox::VerifyBoxOut( void ) void UIDMBox::VerifyBoxOut( void )
{ {
PostMoveinEvent(); PostMoveinEvent();
if (m_boxstate != boxstate_t::box_moving_out && m_boxstate != boxstate_t::box_out) { if (m_boxstate != boxstate_t::box_moving_out && m_boxstate != boxstate_t::box_out)
{
ChangeBoxState(boxstate_t::box_moving_out); ChangeBoxState(boxstate_t::box_moving_out);
} }
} }
@ -94,27 +95,33 @@ void UIDMBox::HandleBoxMoving(void)
delta = m_movespeed * (uid.time - m_boxtime) / 1000; delta = m_movespeed * (uid.time - m_boxtime) / 1000;
m_boxtime = 1000 * delta / m_movespeed + m_boxtime; m_boxtime = 1000 * delta / m_movespeed + m_boxtime;
if (m_boxstate == boxstate_t::box_moving_out) { if (m_boxstate == boxstate_t::box_moving_out)
{
newRect.size.width = m_frame.size.width; newRect.size.width = m_frame.size.width;
newRect.size.height = m_frame.size.height; newRect.size.height = m_frame.size.height;
newRect.pos.x = m_frame.pos.x; newRect.pos.x = m_frame.pos.x;
newRect.pos.y = delta + m_frame.pos.y; newRect.pos.y = delta + m_frame.pos.y;
if (newRect.pos.y <= 0.0) { if (newRect.pos.y <= 0.0)
{
newRect.pos.y = 0.0; newRect.pos.y = 0.0;
ChangeBoxState(boxstate_t::box_out); ChangeBoxState(boxstate_t::box_out);
} }
} else if (m_boxstate == boxstate_t::box_moving_in) { }
else if (m_boxstate == boxstate_t::box_moving_in)
{
newRect.size.width = m_frame.size.width; newRect.size.width = m_frame.size.width;
newRect.size.height = m_frame.size.height; newRect.size.height = m_frame.size.height;
newRect.pos.x = m_frame.pos.x; newRect.pos.x = m_frame.pos.x;
newRect.pos.y = delta - m_frame.pos.y; newRect.pos.y = delta - m_frame.pos.y;
if (newRect.pos.y <= -newRect.size.height) { if (newRect.pos.y <= -newRect.size.height)
{
newRect.pos.y = -newRect.size.height; newRect.pos.y = -newRect.size.height;
ChangeBoxState(boxstate_t::box_in); ChangeBoxState(boxstate_t::box_in);
} }
} else { }
else {
newRect = m_frame; newRect = m_frame;
} }
@ -129,14 +136,16 @@ void UIDMBox::PostMoveinEvent(void)
if (!EventPending(EV_DMBox_Goin)) { if (!EventPending(EV_DMBox_Goin)) {
PostEvent(EV_DMBox_Goin, 10.0); PostEvent(EV_DMBox_Goin, 10.0);
} else { }
else {
PostponeEvent(EV_DMBox_Goin, 10.0); PostponeEvent(EV_DMBox_Goin, 10.0);
} }
} }
void UIDMBox::PostDecayEvent( void ) void UIDMBox::PostDecayEvent( void )
{ {
if (!EventPending(EV_DMBox_Decay)) { if (!EventPending(EV_DMBox_Decay))
{
float fDelayTime; float fDelayTime;
int iNumLines; int iNumLines;
int i; int i;
@ -146,7 +155,8 @@ void UIDMBox::PostDecayEvent(void)
// Calculate the number of lines // Calculate the number of lines
// //
iNumLines = 1; iNumLines = 1;
for (i = 0; pszString[i]; i++) { for (i = 0; pszString[i]; i++)
{
if (pszString[i] == '\n') { if (pszString[i] == '\n') {
iNumLines++; iNumLines++;
} }
@ -160,7 +170,8 @@ void UIDMBox::PostDecayEvent(void)
// //
else if (m_items[0].flags & DMBOX_ITEM_FLAG_DEATH) { else if (m_items[0].flags & DMBOX_ITEM_FLAG_DEATH) {
fDelayTime = iNumLines * 6.0; fDelayTime = iNumLines * 6.0;
} else { }
else {
fDelayTime = iNumLines * 5.0; fDelayTime = iNumLines * 5.0;
} }
@ -195,27 +206,39 @@ void UIDMBox::RemoveTopItem(void)
str UIDMBox::CalculateBreaks( UIFont *font, str text, float max_width ) str UIDMBox::CalculateBreaks( UIFont *font, str text, float max_width )
{ {
str newText; str newText, sTmp;
int i;
float fX; float fX;
float fwX; float fwX, fsX;
const char *current;
int count;
current = text; Cmd_TokenizeString(text.c_str());
if (Cmd_Argc())
{
fX = 0.0; fX = 0.0;
fsX = font->getCharWidth(' ');
for (count = font->DBCSGetWordBlockCount(current, -1); count; for (i = 0; i < Cmd_Argc(); i++)
current += count, count = font->DBCSGetWordBlockCount(current, -1)) { {
fwX = font->getWidth(current, count); sTmp = Cmd_Argv(i);
if (fX + fwX > max_width) { fwX = font->getWidth(sTmp.c_str(), -1);
newText += "\n" + str(current, 0, count); if (fwX + i <= max_width)
fX = 0; {
if (fwX + i + fX <= max_width)
{
newText += sTmp + " ";
} else { } else {
newText += str(current, 0, count); newText += "\n" + sTmp + " ";
} }
}
fX += fwX; else
{
sTmp += "\n";
fX = 0.0;
}
}
} else {
newText = "";
} }
return newText; return newText;
@ -231,7 +254,8 @@ float UIDMBox::PrintWrap(UIFont *font, float x, float y, str text)
p1 = text.c_str(); p1 = text.c_str();
l = text.length(); l = text.length();
for (;;) { for (;;)
{
p2 = strchr(p1, '\n'); p2 = strchr(p1, '\n');
if (!p2) { if (!p2) {
break; break;
@ -242,18 +266,15 @@ float UIDMBox::PrintWrap(UIFont *font, float x, float y, str text)
break; break;
} }
font->Print(x, fY, p1, p2 - p1, getHighResScale()); font->Print(x, fY, p1, p2 - p1, qfalse);
p1 = p2 + 1; p1 = p2 + 1;
l -= n; l -= n;
fY += font->getHeight(); fY += font->getHeight(qfalse);
} }
if (*p1) { font->Print(x, fY, p1, l, qfalse);
font->Print(x, fY, p1, l, getHighResScale());
fY += font->getHeight();
}
return fY - y; return font->getHeight(qfalse) + (fY - y);
} }
float UIDMBox::DrawItem( item_t *in, float x, float y, float alpha ) float UIDMBox::DrawItem( item_t *in, float x, float y, float alpha )
@ -290,7 +311,8 @@ void UIDMBox::Print(const char *text)
{ {
const char* text1 = text; const char* text1 = text;
if (m_numitems > 5) { if (m_numitems > 5)
{
// //
// Overwrite an item // Overwrite an item
// //
@ -299,30 +321,41 @@ void UIDMBox::Print(const char *text)
m_items[m_numitems].flags = 0; m_items[m_numitems].flags = 0;
if (*text == MESSAGE_CHAT_WHITE) { if (*text == MESSAGE_CHAT_WHITE)
m_items[m_numitems].color = UWhiteChatMessageColor; {
m_items[m_numitems].color = UGrey;
m_items[m_numitems].font = m_fontbold; m_items[m_numitems].font = m_fontbold;
m_items[m_numitems].flags |= DMBOX_ITEM_FLAG_BOLD; m_items[m_numitems].flags |= DMBOX_ITEM_FLAG_BOLD;
text1 = text + 1; text1 = text + 1;
} else if (*text == MESSAGE_CHAT_RED) { }
m_items[m_numitems].color = URedChatMessageColor; else if (*text == MESSAGE_CHAT_RED)
m_items[m_numitems].font = m_fontbold; {
m_items[m_numitems].flags |= DMBOX_ITEM_FLAG_DEATH; m_items[m_numitems].color = ULightRed;
text1 = text + 1;
} else if (*text == MESSAGE_CHAT_GREEN) {
m_items[m_numitems].color = UGreenChatMessageColor;
m_items[m_numitems].font = m_fontbold; m_items[m_numitems].font = m_fontbold;
m_items[m_numitems].flags |= DMBOX_ITEM_FLAG_DEATH; m_items[m_numitems].flags |= DMBOX_ITEM_FLAG_DEATH;
text1 = text + 1; text1 = text + 1;
}
else if (*text == MESSAGE_CHAT_GREEN)
{
if (com_target_game->integer >= TG_MOHTA) {
m_items[m_numitems].color = ULightGreen;
} else { } else {
m_items[m_numitems].color = UGreen;
}
m_items[m_numitems].font = m_fontbold;
m_items[m_numitems].flags |= DMBOX_ITEM_FLAG_DEATH;
text1 = text + 1;
}
else
{
m_items[m_numitems].color = m_foreground_color; m_items[m_numitems].color = m_foreground_color;
m_items[m_numitems].font = m_font; m_items[m_numitems].font = m_font;
} }
m_items[m_numitems].string = CalculateBreaks(m_items[m_numitems].font, Sys_LV_CL_ConvertString(text1), s_dmboxWidth); m_items[m_numitems].string = CalculateBreaks(m_items[m_numitems].font, text1, s_dmboxWidth);
m_numitems++; m_numitems++;
VerifyBoxOut(); VerifyBoxOut();
@ -355,7 +388,9 @@ void UIDMBox::Create(const UIRect2D& rect, const UColor& fore, const UColor& bac
setShowState(); setShowState();
} }
void UIDMBox::MoveInEvent(Event *ev) {} void UIDMBox::MoveInEvent( Event *ev )
{
}
void UIDMBox::DecayEvent( Event *ev ) void UIDMBox::DecayEvent( Event *ev )
{ {
@ -384,14 +419,10 @@ void UIDMBox::Draw(void)
m_font->setColor(m_foreground_color); m_font->setColor(m_foreground_color);
alpha = (float)(cls.realtime - m_iBeginDecay) / (float)m_iEndDecay; alpha = (float)(cls.realtime - m_iBeginDecay) / (float)m_iEndDecay;
if (alpha > 1.0) { if (alpha > 1.0) alpha = 1.0;
alpha = 1.0;
}
alpha = (1.0 - alpha) * 4.0; alpha = (1.0 - alpha) * 4.0;
if (alpha > 1.0) { if (alpha > 1.0) alpha = 1.0;
alpha = 1.0;
}
if (cge) { if (cge) {
alphaScale = 1.0 - cge->CG_GetObjectiveAlpha(); alphaScale = 1.0 - cge->CG_GetObjectiveAlpha();
@ -400,9 +431,11 @@ void UIDMBox::Draw(void)
fsY = DrawItem(m_items, s_dmboxOffsetX, s_dmboxOffsetY, alpha * alphaScale); fsY = DrawItem(m_items, s_dmboxOffsetX, s_dmboxOffsetY, alpha * alphaScale);
fsY = alpha <= 0.2 ? s_dmboxOffsetY : fsY + s_dmboxOffsetY; fsY = alpha <= 0.2 ? s_dmboxOffsetY : fsY + s_dmboxOffsetY;
for (i = 1; i < m_numitems; i++) { for (i = 1; i < m_numitems; i++)
{
fsY += DrawItem(&m_items[i], s_dmboxOffsetX, fsY, alphaScale); fsY += DrawItem(&m_items[i], s_dmboxOffsetX, fsY, alphaScale);
if (fsY > m_frame.size.height) { if (fsY > m_frame.size.height)
{
if (EventPending(EV_DMBox_Decay)) { if (EventPending(EV_DMBox_Decay)) {
CancelEventsOfType(EV_DMBox_Decay); CancelEventsOfType(EV_DMBox_Decay);
} }

View file

@ -47,7 +47,7 @@ FilePickerClass::FilePickerClass()
window = new UIFloatingWindow(); window = new UIFloatingWindow();
window->Create( window->Create(
NULL, NULL,
UIRect2D((uid.vidWidth - 400) / 2, (uid.vidHeight - 300) / 2, 400, 300), UIRect2D((cls.glconfig.vidWidth - 400) / 2, (cls.glconfig.vidHeight - 300) / 2, 400, 300),
"File Picker", "File Picker",
UColor(0.15f, 0.195f, 0.278f), UColor(0.15f, 0.195f, 0.278f),
UHudColor UHudColor

View file

@ -1,118 +0,0 @@
/*
===========================================================================
Copyright (C) 2025 the OpenMoHAA team
This file is part of OpenMoHAA source code.
OpenMoHAA source code 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.
OpenMoHAA source code is distributed in the hope that it will be
useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with OpenMoHAA source code; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
===========================================================================
*/
// cl_uigamespy.cpp
#include "cl_uigamespy.h"
CLASS_DECLARATION(UIFloatingWindow, GameSpyDialog, NULL) {
{&W_Deactivated, &UIFloatingWindow::ClosePressed},
{NULL, NULL }
};
GameSpyDialog::GameSpyDialog()
: overlay(NULL)
, label(NULL)
, closeButton(NULL)
{
AddFlag(WF_ALWAYS_TOP);
}
GameSpyDialog::~GameSpyDialog()
{
if (overlay) {
delete overlay;
overlay = NULL;
}
if (label) {
delete label;
label = NULL;
}
if (closeButton) {
delete closeButton;
closeButton = NULL;
}
}
void GameSpyDialog::FrameInitialized(void)
{
UIFloatingWindow::FrameInitialized();
label = new UILabel();
label->InitFrame(getChildSpace(), getChildSpace()->getClientFrame(), 0);
label->setTitle(
"GameSpy's multiplayer matchmaking\n"
"and server browsing services, which were\n"
"essential for online gaming in many classic\n"
"titles including Medal of Honor: Allied Assault,\n"
"were permanently shut down in 2014."
);
label->setForegroundColor(UHudColor);
closeButton = new UIButton();
closeButton->InitFrame(getChildSpace(), UIRect2D(100, 150, 100, 30), 0);
closeButton->setTitle("Close");
closeButton->AllowActivate(true);
closeButton->Connect(this, W_Button_Pressed, W_Deactivated);
overlay = new UIButton();
overlay->InitFrame(NULL, UIRect2D(0, 0, uid.vidWidth, uid.vidHeight), 0);
overlay->setBackgroundColor(UColor(0, 0, 0, 0.5f), true);
overlay->AllowActivate(true);
overlay->Connect(this, W_Button_Pressed, W_Deactivated);
}
void GameSpyDialog::Create(
UIWidget *parent, const UIRect2D& rect, const char *title, const UColor& bgColor, const UColor& fgColor
)
{
// First call parent's Create
UIFloatingWindow::Create(parent, rect, title, bgColor, fgColor);
// After creation, find minimize button by name and hide it
for (UIWidget *child = getFirstChild(); child; child = getNextChild(child)) {
if (strcmp(child->getName(), "minimizebutton") == 0) {
child->setShow(false);
break;
}
}
}
void UI_LaunchGameSpy_f(void)
{
GameSpyDialog *dialog = new GameSpyDialog();
dialog->Create(
NULL,
UIRect2D((uid.vidWidth - 300) / 2, (uid.vidHeight - 200) / 2, 300, 200),
"GameSpy",
UColor(0.15f, 0.195f, 0.278f),
UHudColor
);
uWinMan.ActivateControl(dialog);
dialog->Connect(dialog, W_Deactivated, W_Deactivated);
}

View file

@ -1,50 +0,0 @@
/*
===========================================================================
Copyright (C) 2025 the OpenMoHAA team
This file is part of OpenMoHAA source code.
OpenMoHAA source code 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.
OpenMoHAA source code is distributed in the hope that it will be
useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with OpenMoHAA source code; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
===========================================================================
*/
// cl_gamespy.h
#ifndef __CL_GAMESPY_H__
#define __CL_GAMESPY_H__
#include "cl_ui.h"
#include "keycodes.h"
class GameSpyDialog : public UIFloatingWindow
{
private:
UIButton *overlay;
UILabel *label;
UIButton *closeButton;
protected:
void FrameInitialized(void) override;
public:
GameSpyDialog();
~GameSpyDialog();
void
Create(UIWidget *parent, const UIRect2D& rect, const char *title, const UColor& bgColor, const UColor& fgColor);
CLASS_PROTOTYPE(GameSpyDialog);
};
void UI_LaunchGameSpy_f(void);
#endif

View file

@ -21,7 +21,6 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/ */
#include "cl_ui.h" #include "cl_ui.h"
#include "../qcommon/localization.h"
Event EV_GMBox_Goin Event EV_GMBox_Goin
( (
@ -45,7 +44,8 @@ static float s_gmboxWidth = 640.0;
static float s_gmboxOffsetX = 3.0f; static float s_gmboxOffsetX = 3.0f;
static float s_gmboxOffsetY = 0.0f; static float s_gmboxOffsetY = 0.0f;
CLASS_DECLARATION(UIWidget, UIGMBox, NULL) { CLASS_DECLARATION( UIWidget, UIGMBox, NULL )
{
{ &W_SizeChanged, &UIGMBox::OnSizeChanged }, { &W_SizeChanged, &UIGMBox::OnSizeChanged },
{ &EV_GMBox_Goin, &UIGMBox::MoveInEvent }, { &EV_GMBox_Goin, &UIGMBox::MoveInEvent },
{ &EV_GMBox_Decay, &UIGMBox::DecayEvent }, { &EV_GMBox_Decay, &UIGMBox::DecayEvent },
@ -67,7 +67,8 @@ UIGMBox::UIGMBox()
void UIGMBox::VerifyBoxOut( void ) void UIGMBox::VerifyBoxOut( void )
{ {
PostMoveinEvent(); PostMoveinEvent();
if (m_boxstate != boxstate_t::box_moving_out && m_boxstate != boxstate_t::box_out) { if (m_boxstate != boxstate_t::box_moving_out && m_boxstate != boxstate_t::box_out)
{
ChangeBoxState(boxstate_t::box_moving_out); ChangeBoxState(boxstate_t::box_moving_out);
} }
} }
@ -94,23 +95,28 @@ void UIGMBox::HandleBoxMoving(void)
delta = m_movespeed * (uid.time - m_boxtime) / 1000; delta = m_movespeed * (uid.time - m_boxtime) / 1000;
m_boxtime = 1000 * delta / m_movespeed + m_boxtime; m_boxtime = 1000 * delta / m_movespeed + m_boxtime;
if (m_boxstate == boxstate_t::box_moving_out) { if (m_boxstate == boxstate_t::box_moving_out)
{
newRect.size.width = m_frame.size.width; newRect.size.width = m_frame.size.width;
newRect.size.height = m_frame.size.height; newRect.size.height = m_frame.size.height;
newRect.pos.x = m_frame.pos.x; newRect.pos.x = m_frame.pos.x;
newRect.pos.y = delta + m_frame.pos.y; newRect.pos.y = delta + m_frame.pos.y;
if (newRect.pos.y <= 0.0) { if (newRect.pos.y <= 0.0)
{
newRect.pos.y = 0.0; newRect.pos.y = 0.0;
ChangeBoxState(boxstate_t::box_out); ChangeBoxState(boxstate_t::box_out);
} }
} else if (m_boxstate == boxstate_t::box_moving_in) { }
else if (m_boxstate == boxstate_t::box_moving_in)
{
newRect.size.width = m_frame.size.width; newRect.size.width = m_frame.size.width;
newRect.size.height = m_frame.size.height; newRect.size.height = m_frame.size.height;
newRect.pos.x = m_frame.pos.x; newRect.pos.x = m_frame.pos.x;
newRect.pos.y = delta - m_frame.pos.y; newRect.pos.y = delta - m_frame.pos.y;
if (newRect.pos.y <= -newRect.size.height) { if (newRect.pos.y <= -newRect.size.height)
{
newRect.pos.y = -newRect.size.height; newRect.pos.y = -newRect.size.height;
ChangeBoxState(boxstate_t::box_in); ChangeBoxState(boxstate_t::box_in);
} }
@ -136,7 +142,8 @@ void UIGMBox::PostMoveinEvent(void)
void UIGMBox::PostDecayEvent( void ) void UIGMBox::PostDecayEvent( void )
{ {
if (!EventPending(EV_GMBox_Decay)) { if (!EventPending(EV_GMBox_Decay))
{
float fDelayTime; float fDelayTime;
int iNumLines; int iNumLines;
int i; int i;
@ -146,7 +153,8 @@ void UIGMBox::PostDecayEvent(void)
// Calculate the number of lines // Calculate the number of lines
// //
iNumLines = 1; iNumLines = 1;
for (i = 0; pszString[i]; i++) { for (i = 0; pszString[i]; i++)
{
if (pszString[i] == '\n') { if (pszString[i] == '\n') {
iNumLines++; iNumLines++;
} }
@ -192,27 +200,39 @@ void UIGMBox::RemoveTopItem(void)
str UIGMBox::CalculateBreaks( UIFont *font, str text, float max_width ) str UIGMBox::CalculateBreaks( UIFont *font, str text, float max_width )
{ {
str newText; str newText, sTmp;
int i;
float fX; float fX;
float fwX; float fwX, fsX;
const char *current;
int count;
current = text; Cmd_TokenizeString(text.c_str());
if (Cmd_Argc())
{
fX = 0.0; fX = 0.0;
fsX = font->getCharWidth(' ');
for (count = font->DBCSGetWordBlockCount(current, -1); count; for (i = 0; i < Cmd_Argc(); i++)
current += count, count = font->DBCSGetWordBlockCount(current, -1)) { {
fwX = font->getWidth(current, count); sTmp = Cmd_Argv(i);
if (fX + fwX > max_width) { fwX = font->getWidth(sTmp.c_str(), -1);
newText += "\n" + str(current, 0, count); if (fwX + i <= max_width)
fX = 0; {
if (fwX + i + fX <= max_width)
{
newText += sTmp + " ";
} else { } else {
newText += str(current, 0, count); newText += "\n" + sTmp + " ";
} }
}
fX += fwX; else
{
sTmp += "\n";
fX = 0.0;
}
}
} else {
newText = "";
} }
return newText; return newText;
@ -228,7 +248,8 @@ float UIGMBox::PrintWrap(UIFont *font, float x, float y, str text)
p1 = text.c_str(); p1 = text.c_str();
l = text.length(); l = text.length();
for (;;) { for (;;)
{
p2 = strchr(p1, '\n'); p2 = strchr(p1, '\n');
if (!p2) { if (!p2) {
break; break;
@ -239,18 +260,15 @@ float UIGMBox::PrintWrap(UIFont *font, float x, float y, str text)
break; break;
} }
font->Print(x, fY, p1, p2 - p1, getHighResScale()); font->Print(x, fY, p1, p2 - p1, qfalse);
p1 = p2 + 1; p1 = p2 + 1;
l -= n; l -= n;
fY += font->getHeight(); fY += font->getHeight(qfalse);
} }
if (*p1) { font->Print(x, fY, p1, l, qfalse);
font->Print(x, fY, p1, l, getHighResScale());
fY += font->getHeight();
}
return fY - y; return font->getHeight(qfalse) + (fY - y);
} }
float UIGMBox::DrawItem( item_t *in, float x, float y, float alpha ) float UIGMBox::DrawItem( item_t *in, float x, float y, float alpha )
@ -287,7 +305,8 @@ void UIGMBox::Print(const char *text)
{ {
const char* text1 = text; const char* text1 = text;
if (m_numitems > 4) { if (m_numitems > 4)
{
// //
// Overwrite an item // Overwrite an item
// //
@ -296,18 +315,21 @@ void UIGMBox::Print(const char *text)
m_items[m_numitems].flags = 0; m_items[m_numitems].flags = 0;
if (*text == MESSAGE_WHITE) { if (*text == 3)
{
m_items[m_numitems].color = UWhite; m_items[m_numitems].color = UWhite;
m_items[m_numitems].font = m_fontbold; m_items[m_numitems].font = m_fontbold;
m_items[m_numitems].flags |= GMBOX_ITEM_FLAG_BOLD; m_items[m_numitems].flags |= GMBOX_ITEM_FLAG_BOLD;
text1 = text + 1; text1 = text + 1;
} else { }
else
{
m_items[m_numitems].color = m_foreground_color; m_items[m_numitems].color = m_foreground_color;
m_items[m_numitems].font = m_font; m_items[m_numitems].font = m_font;
} }
m_items[m_numitems].string = CalculateBreaks(m_items[m_numitems].font, Sys_LV_CL_ConvertString(text1), s_gmboxWidth); m_items[m_numitems].string = CalculateBreaks(m_items[m_numitems].font, text1, s_gmboxWidth);
m_numitems++; m_numitems++;
VerifyBoxOut(); VerifyBoxOut();
@ -340,7 +362,9 @@ void UIGMBox::Create(const UIRect2D& rect, const UColor& fore, const UColor& bac
setShowState(); setShowState();
} }
void UIGMBox::MoveInEvent(Event *ev) {} void UIGMBox::MoveInEvent( Event *ev )
{
}
void UIGMBox::DecayEvent( Event *ev ) void UIGMBox::DecayEvent( Event *ev )
{ {
@ -369,14 +393,10 @@ void UIGMBox::Draw(void)
m_font->setColor(m_foreground_color); m_font->setColor(m_foreground_color);
alpha = (float)(cls.realtime - m_iBeginDecay) / (float)m_iEndDecay; alpha = (float)(cls.realtime - m_iBeginDecay) / (float)m_iEndDecay;
if (alpha > 1.0) { if (alpha > 1.0) alpha = 1.0;
alpha = 1.0;
}
alpha = (1.0 - alpha) * 4.0; alpha = (1.0 - alpha) * 4.0;
if (alpha > 1.0) { if (alpha > 1.0) alpha = 1.0;
alpha = 1.0;
}
if (cge) { if (cge) {
alphaScale = 1.0 - cge->CG_GetObjectiveAlpha(); alphaScale = 1.0 - cge->CG_GetObjectiveAlpha();
@ -385,9 +405,11 @@ void UIGMBox::Draw(void)
fsY = DrawItem(m_items, s_gmboxOffsetX, s_gmboxOffsetY, alpha * alphaScale); fsY = DrawItem(m_items, s_gmboxOffsetX, s_gmboxOffsetY, alpha * alphaScale);
fsY = alpha <= 0.2 ? s_gmboxOffsetY : fsY + s_gmboxOffsetY; fsY = alpha <= 0.2 ? s_gmboxOffsetY : fsY + s_gmboxOffsetY;
for (i = 1; i < m_numitems; i++) { for (i = 1; i < m_numitems; i++)
{
fsY += DrawItem(&m_items[i], s_gmboxOffsetX, fsY, alphaScale); fsY += DrawItem(&m_items[i], s_gmboxOffsetX, fsY, alphaScale);
if (fsY > m_frame.size.height) { if (fsY > m_frame.size.height)
{
if (EventPending(EV_GMBox_Decay)) { if (EventPending(EV_GMBox_Decay)) {
CancelEventsOfType(EV_GMBox_Decay); CancelEventsOfType(EV_GMBox_Decay);
} }
@ -408,3 +430,4 @@ void UIGMBox::Clear(void)
{ {
m_numitems = 0; m_numitems = 0;
} }

View file

@ -333,7 +333,6 @@ str FAKKLoadGameItem::getListItemString(int which) const
{ {
int numseconds; int numseconds;
int numseconds_hours; int numseconds_hours;
int seconds;
// hours // hours
numseconds = atol(strings[1]); numseconds = atol(strings[1]);
@ -342,18 +341,17 @@ str FAKKLoadGameItem::getListItemString(int which) const
// minutes // minutes
numseconds_hours = numseconds % 3600; numseconds_hours = numseconds % 3600;
if (numseconds_hours / 60 < 10) { if (numseconds_hours / 60 <= 9) {
itemstring += "0"; itemstring += "0";
} }
itemstring += (numseconds_hours / 60); itemstring += (numseconds_hours / 60);
itemstring += ":"; itemstring += ":";
// seconds // seconds
seconds = numseconds_hours % 60; if (numseconds_hours / 60 <= 9) {
if (seconds < 10) {
itemstring += "0"; itemstring += "0";
} }
itemstring += seconds; itemstring += (numseconds_hours % 60);
} }
break; break;
case 2: case 2:
@ -362,7 +360,7 @@ str FAKKLoadGameItem::getListItemString(int which) const
char buffer[2048]; char buffer[2048];
time = atol(strings[2]); time = atol(strings[2]);
strftime(buffer, sizeof(buffer), "%a %b %d %Y %H:%M:%S", localtime(&time)); strftime(buffer, sizeof(buffer), "%a %b %d %H:%M:%S %Y", localtime(&time));
itemstring = buffer; itemstring = buffer;
} }
break; break;

View file

@ -112,7 +112,7 @@ void FakkMiniconsole::PostMoveinEvent(void)
void FakkMiniconsole::OnSizeChanged(Event *ev) void FakkMiniconsole::OnSizeChanged(Event *ev)
{ {
m_maxlines = m_frame.size.height / m_font->getHeight(getHighResScale()); m_maxlines = m_frame.size.height / m_font->getHeight(false);
} }
void FakkMiniconsole::MoveInEvent(Event *ev) void FakkMiniconsole::MoveInEvent(Event *ev)
@ -163,14 +163,14 @@ void FakkMiniconsole::Draw(void)
HandleBoxMoving(); HandleBoxMoving();
m_font->setColor(m_foreground_color); m_font->setColor(m_foreground_color);
aty = m_frame.size.height - m_font->getHeight(getHighResScale()); aty = m_frame.size.height - m_font->getHeight(false);
for (i = m_lines.NumObjects(); i > 0; i--) { for (i = m_lines.NumObjects(); i > 0; i--) {
if (-m_font->getHeight(getHighResScale()) >= aty) { if (-m_font->getHeight(false) >= aty) {
break; break;
} }
m_font->Print(0, aty / getHighResScale()[1], m_lines.ObjectAt(i), -1, getHighResScale()); m_font->Print(0, aty, m_lines.ObjectAt(i), -1, false);
aty -= m_font->getHeight(getHighResScale()); aty -= m_font->getHeight(false);
} }
} }

View file

@ -51,7 +51,7 @@ MpMapPickerClass::MpMapPickerClass()
window = new UIFloatingWindow(); window = new UIFloatingWindow();
window->Create( window->Create(
NULL, NULL,
UIRect2D((uid.vidWidth - 300) / 2, (uid.vidHeight - 200) / 2, 300, 200), UIRect2D((cls.glconfig.vidWidth - 300) / 2, (cls.glconfig.vidHeight - 200) / 2, 300, 200),
"Select a Map", "Select a Map",
UColor(0.15f, 0.195f, 0.278f), UColor(0.15f, 0.195f, 0.278f),
UHudColor UHudColor

View file

@ -155,7 +155,7 @@ PlayerModelPickerClass::PlayerModelPickerClass()
window = new UIFloatingWindow(); window = new UIFloatingWindow();
window->Create( window->Create(
NULL, NULL,
UIRect2D((uid.vidWidth - 400) / 2, (uid.vidHeight - 300) / 2, 400, 300), UIRect2D((cls.glconfig.vidWidth - 400) / 2, (cls.glconfig.vidHeight - 300) / 2, 400, 300),
"Player Model Select...", "Player Model Select...",
UColor(0.15f, 0.195f, 0.278f), UColor(0.15f, 0.195f, 0.278f),
UHudColor UHudColor

View file

@ -25,8 +25,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
#include "../gamespy/sv_gamespy.h" #include "../gamespy/sv_gamespy.h"
#include "../gamespy/common/gsPlatformSocket.h" #include "../gamespy/common/gsPlatformSocket.h"
Event EV_FAKKServerList_Connect Event EV_FAKKServerList_Connect(
(
"connect", "connect",
EV_DEFAULT, EV_DEFAULT,
NULL, NULL,
@ -34,8 +33,7 @@ Event EV_FAKKServerList_Connect
"Connect to the specified server" "Connect to the specified server"
); );
Event EV_FAKKServerList_RefreshServerList Event EV_FAKKServerList_RefreshServerList(
(
"refreshserverlist", "refreshserverlist",
EV_DEFAULT, EV_DEFAULT,
NULL, NULL,
@ -43,8 +41,7 @@ Event EV_FAKKServerList_RefreshServerList
"Refresh the serverlist" "Refresh the serverlist"
); );
Event EV_FAKKServerList_RefreshLANServerList Event EV_FAKKServerList_RefreshLANServerList(
(
"refreshlanserverlist", "refreshlanserverlist",
EV_DEFAULT, EV_DEFAULT,
NULL, NULL,
@ -52,8 +49,7 @@ Event EV_FAKKServerList_RefreshLANServerList
"Refresh the LAN serverlist" "Refresh the LAN serverlist"
); );
Event EV_FAKKServerList_CancelRefresh Event EV_FAKKServerList_CancelRefresh(
(
"cancelrefresh", "cancelrefresh",
EV_DEFAULT, EV_DEFAULT,
NULL, NULL,
@ -61,8 +57,7 @@ Event EV_FAKKServerList_CancelRefresh
"Cancel serverlist Refresh" "Cancel serverlist Refresh"
); );
Event EV_FAKKServerList_LANListing Event EV_FAKKServerList_LANListing(
(
"lanlisting", "lanlisting",
EV_DEFAULT, EV_DEFAULT,
NULL, NULL,
@ -70,8 +65,7 @@ Event EV_FAKKServerList_LANListing
"Makes this server list to LAN stuff when there's a choice between Internet & LAN servers" "Makes this server list to LAN stuff when there's a choice between Internet & LAN servers"
); );
Event EV_FAKKServerList_UpdateServer Event EV_FAKKServerList_UpdateServer(
(
"updateserver", "updateserver",
EV_DEFAULT, EV_DEFAULT,
NULL, NULL,
@ -84,8 +78,7 @@ struct ServerListInstance {
UIFAKKServerList* serverList; UIFAKKServerList* serverList;
}; };
class FAKKServerListItem : public UIListCtrlItem class FAKKServerListItem : public UIListCtrlItem {
{
UIFAKKServerList* m_parent; // Added in OPM UIFAKKServerList* m_parent; // Added in OPM
str m_strings[6]; str m_strings[6];
str m_sVersion; str m_sVersion;
@ -102,9 +95,7 @@ public:
int m_iGameSpyPort; int m_iGameSpyPort;
public: public:
FAKKServerListItem( FAKKServerListItem(UIFAKKServerList* parent, str string1, str string2, str string3, str string4, str string5, str string6, str ver);
UIFAKKServerList *parent, str string1, str string2, str string3, str string4, str string5, str string6, str ver
);
griditemtype_t getListItemType(int index) const override; griditemtype_t getListItemType(int index) const override;
int getListItemValue(int i) const override; int getListItemValue(int i) const override;
@ -132,18 +123,10 @@ qboolean g_NeedAdditionalLANSearch = qfalse;
qboolean g_bDoneUpdating[2]; qboolean g_bDoneUpdating[2];
ServerListInstance g_ServerListInst[2]; ServerListInstance g_ServerListInst[2];
// Fixed in OPM void UpdateServerListCallBack(GServerList serverlist, int msg, void* instance, void* param1, void* param2);
// It was a static vaariable inside UpdateServerListCallBack
// that was set to 0 when the mode changed. This caused some issues
static int g_iServerQueryCount = 0;
static int g_iServerTotalCount = 0;
static void AddFilter(char* filter, const char* value); static void AddFilter(char* filter, const char* value);
static void AddFilter(char *filter, const char *value, size_t maxsize);
FAKKServerListItem::FAKKServerListItem( FAKKServerListItem::FAKKServerListItem(UIFAKKServerList* parent, str string1, str string2, str string3, str string4, str string5, str string6, str ver)
UIFAKKServerList *parent, str string1, str string2, str string3, str string4, str string5, str string6, str ver
)
{ {
m_parent = parent; m_parent = parent;
m_strings[0] = string1; m_strings[0] = string1;
@ -195,9 +178,6 @@ void FAKKServerListItem::DrawListItem(int iColumn, const UIRect2D& drawRect, boo
} }
*/ */
virtualScale[0] = m_parent->getHighResScale()[0];
virtualScale[1] = m_parent->getHighResScale()[1];
if (!pColoringType->integer) { if (!pColoringType->integer) {
if (IfQueryFailed() || (IsDifferentVersion() && IsQueried())) { if (IfQueryFailed() || (IsDifferentVersion() && IsQueried())) {
if (bSelected) { if (bSelected) {
@ -230,7 +210,7 @@ void FAKKServerListItem::DrawListItem(int iColumn, const UIRect2D& drawRect, boo
newRect.pos.y / virtualScale[1], newRect.pos.y / virtualScale[1],
getListItemString(iColumn).c_str(), getListItemString(iColumn).c_str(),
-1, -1,
virtualScale false //m_parent->isVirtual()
); );
} else { } else {
if (IsDifferentVersion()) { if (IsDifferentVersion()) {
@ -286,7 +266,7 @@ void FAKKServerListItem::DrawListItem(int iColumn, const UIRect2D& drawRect, boo
newRect.pos.y / virtualScale[1], newRect.pos.y / virtualScale[1],
getListItemString(iColumn).c_str(), getListItemString(iColumn).c_str(),
-1, -1,
virtualScale false //m_parent->isVirtual()
); );
if (IsDifferentVersion()) { if (IsDifferentVersion()) {
@ -376,7 +356,8 @@ bool FAKKServerListItem::IsDifferentVersion() const
return m_bDifferentVersion; return m_bDifferentVersion;
} }
CLASS_DECLARATION(UIListCtrl, UIFAKKServerList, NULL) { CLASS_DECLARATION( UIListCtrl, UIFAKKServerList, NULL )
{
{ &EV_UIListBase_ItemSelected, &UIFAKKServerList::SelectServer }, { &EV_UIListBase_ItemSelected, &UIFAKKServerList::SelectServer },
{ &EV_UIListBase_ItemDoubleClicked, &UIFAKKServerList::ConnectServer }, { &EV_UIListBase_ItemDoubleClicked, &UIFAKKServerList::ConnectServer },
{ &EV_FAKKServerList_RefreshServerList, &UIFAKKServerList::RefreshServerList }, { &EV_FAKKServerList_RefreshServerList, &UIFAKKServerList::RefreshServerList },
@ -406,7 +387,9 @@ UIFAKKServerList::UIFAKKServerList()
m_iLastSortColumn = 2; m_iLastSortColumn = 2;
} }
void UIFAKKServerList::SelectServer(Event *ev) {} void UIFAKKServerList::SelectServer( Event *ev )
{
}
void UIFAKKServerList::ConnectServer( Event *ev ) void UIFAKKServerList::ConnectServer( Event *ev )
{ {
@ -426,18 +409,12 @@ void UIFAKKServerList::ConnectServer(Event *ev)
if (fabs(neededVersion - serverVersion) >= 0.1) { if (fabs(neededVersion - serverVersion) >= 0.1) {
UI_SetReturnMenuToCurrent(); UI_SetReturnMenuToCurrent();
message = message = va("Server is version %s, you are targeting %s", pItem->GetListItemVersion().c_str(), com_target_version->string);
va("Server is version %s, you are targeting %s",
pItem->GetListItemVersion().c_str(),
com_target_version->string);
Cvar_Set("com_errormessage", message); Cvar_Set("com_errormessage", message);
UI_PushMenu("wrongversion"); UI_PushMenu("wrongversion");
} else { } else {
message = message = va("Can not connect to v%s server, you are targeting v%s", pItem->GetListItemVersion().c_str(), com_target_version->string);
va("Can not connect to v%s server, you are targeting v%s",
pItem->GetListItemVersion().c_str(),
com_target_version->string);
Cvar_Set("dm_serverstatus", message); Cvar_Set("dm_serverstatus", message);
} }
@ -454,7 +431,8 @@ void UIFAKKServerList::ConnectServer(Event *ev)
qboolean UIFAKKServerList::KeyEvent( int key, unsigned int time ) qboolean UIFAKKServerList::KeyEvent( int key, unsigned int time )
{ {
switch (key) { switch (key)
{
case K_ENTER: case K_ENTER:
case K_KP_ENTER: case K_KP_ENTER:
ConnectServer(NULL); ConnectServer(NULL);
@ -475,17 +453,17 @@ qboolean UIFAKKServerList::KeyEvent(int key, unsigned int time)
SelectServer(NULL); SelectServer(NULL);
return qtrue; return qtrue;
} else { }
else {
return qfalse; return qfalse;
} }
break; break;
case 'u': case 'u':
case 'U': case 'U':
if (getCurrentItem() > 0) { if (getCurrentItem() > 0)
{
const FAKKServerListItem* pItem = static_cast<const FAKKServerListItem*>(GetItem(getCurrentItem())); const FAKKServerListItem* pItem = static_cast<const FAKKServerListItem*>(GetItem(getCurrentItem()));
ServerListAuxUpdate( ServerListAuxUpdate(m_serverList[0], pItem->m_sIP.c_str(), pItem->m_iGameSpyPort, true, GQueryType::qt_status);
m_serverList[0], pItem->m_sIP.c_str(), pItem->m_iGameSpyPort, true, GQueryType::qt_status
);
} }
return UIListCtrl::KeyEvent(key, time); return UIListCtrl::KeyEvent(key, time);
case 'c': case 'c':
@ -508,20 +486,12 @@ qboolean UIFAKKServerList::KeyEvent(int key, unsigned int time)
if (!str::icmp(pServerItem1->m_sIP.c_str(), pServerItem2->m_sIP.c_str())) { if (!str::icmp(pServerItem1->m_sIP.c_str(), pServerItem2->m_sIP.c_str())) {
if (pServerItem1->m_iPort == pServerItem2->m_iPort) { if (pServerItem1->m_iPort == pServerItem2->m_iPort) {
Com_DPrintf( Com_DPrintf("*#*#* Duplicate server address: %s:%i\n", pServerItem1->m_sIP.c_str(), pServerItem1->m_iPort);
"*#*#* Duplicate server address: %s:%i\n",
pServerItem1->m_sIP.c_str(),
pServerItem1->m_iPort
);
iNumErrors++; iNumErrors++;
} }
if (pServerItem1->m_iGameSpyPort == pServerItem2->m_iGameSpyPort) { if (pServerItem1->m_iGameSpyPort == pServerItem2->m_iGameSpyPort) {
Com_DPrintf( Com_DPrintf("*#*#* servers at IP %s sharing GameSpy port %i\n", pServerItem1->m_sIP.c_str(), pServerItem1->m_iGameSpyPort);
"*#*#* servers at IP %s sharing GameSpy port %i\n",
pServerItem1->m_sIP.c_str(),
pServerItem1->m_iGameSpyPort
);
iNumErrors++; iNumErrors++;
} }
} }
@ -559,17 +529,6 @@ void UIFAKKServerList::RefreshServerList(Event *ev)
int i; int i;
FAKKServerListItem* pNewServerItem; FAKKServerListItem* pNewServerItem;
if (m_serverList[0] && ServerListState(m_serverList[0]) != sl_idle) {
// Fixed in OPM
// Only free the server list if it isn't currently being queried.
// The server list must not be queried
return;
}
if (m_serverList[1] && ServerListState(m_serverList[1]) != sl_idle) {
return;
}
for (i = 1; i <= getNumItems(); i++) { for (i = 1; i <= getNumItems(); i++) {
pNewServerItem = static_cast<FAKKServerListItem*>(GetItem(i)); pNewServerItem = static_cast<FAKKServerListItem*>(GetItem(i));
pNewServerItem->SetQueried(false); pNewServerItem->SetQueried(false);
@ -579,8 +538,6 @@ void UIFAKKServerList::RefreshServerList(Event *ev)
if (m_serverList[0]) { if (m_serverList[0]) {
ServerListClear(m_serverList[0]); ServerListClear(m_serverList[0]);
// Added in 2.0: Free the server list
// Since 2.0, the UI no longer refreshes the server list when clicking "Browse Internet Servers"
ServerListFree(m_serverList[0]); ServerListFree(m_serverList[0]);
m_serverList[0] = NULL; m_serverList[0] = NULL;
} }
@ -591,7 +548,7 @@ void UIFAKKServerList::RefreshServerList(Event *ev)
m_serverList[1] = NULL; m_serverList[1] = NULL;
} }
if (!m_serverList[0] && (com_target_game->integer < target_game_e::TG_MOHTT || !m_serverList[1])) { if (!m_serverList[0]) {
NewServerList(); NewServerList();
} }
@ -600,7 +557,7 @@ void UIFAKKServerList::RefreshServerList(Event *ev)
Cvar_Set("dm_playercount", "0"); Cvar_Set("dm_playercount", "0");
{ {
char filter[256] = {0}; char filter[2048] = { 0 };
static cvar_t* dm_max_players = Cvar_Get("dm_max_players", "0", CVAR_ARCHIVE); static cvar_t* dm_max_players = Cvar_Get("dm_max_players", "0", CVAR_ARCHIVE);
static cvar_t* dm_min_players = Cvar_Get("dm_min_players", "0", CVAR_ARCHIVE); static cvar_t* dm_min_players = Cvar_Get("dm_min_players", "0", CVAR_ARCHIVE);
static cvar_t* dm_show_demo_servers = Cvar_Get("dm_show_demo_servers", "1", CVAR_ARCHIVE); static cvar_t* dm_show_demo_servers = Cvar_Get("dm_show_demo_servers", "1", CVAR_ARCHIVE);
@ -610,31 +567,31 @@ void UIFAKKServerList::RefreshServerList(Event *ev)
static cvar_t* dm_filter_full = Cvar_Get("dm_filter_full", "0", CVAR_ARCHIVE); static cvar_t* dm_filter_full = Cvar_Get("dm_filter_full", "0", CVAR_ARCHIVE);
if (dm_min_players->integer) { if (dm_min_players->integer) {
AddFilter(filter, va("numplayers >= %d", dm_min_players->integer), sizeof(filter)); AddFilter(filter, va("numplayers >= %d", dm_min_players->integer));
} }
if (dm_max_players->integer) { if (dm_max_players->integer) {
AddFilter(filter, va("numplayers <= %d", dm_max_players->integer), sizeof(filter)); AddFilter(filter, va("numplayers <= %d", dm_max_players->integer));
} }
if (dm_show_demo_servers && !dm_show_demo_servers->integer) { if (dm_show_demo_servers && !dm_show_demo_servers->integer) {
AddFilter(filter, "gamever not like 'd%'", sizeof(filter)); AddFilter(filter, "gamever not like 'd%'");
} }
if (dm_realism_mode && dm_realism_mode->integer == 1) { if (dm_realism_mode && dm_realism_mode->integer == 1) {
AddFilter(filter, "realism=1", sizeof(filter)); AddFilter(filter, "realism=1");
} }
if (dm_filter_listen->integer == 1) { if (dm_filter_listen->integer == 1) {
AddFilter(filter, "dedicated=1", sizeof(filter)); AddFilter(filter, "dedicated=1");
} }
if (dm_filter_empty && dm_filter_empty->integer) { if (dm_filter_empty && dm_filter_empty->integer) {
AddFilter(filter, "numplayers > 0", sizeof(filter)); AddFilter(filter, "numplayers > 0 ");
} }
if (dm_filter_full && dm_filter_full->integer == 1) { if (dm_filter_full && dm_filter_full->integer == 1) {
AddFilter(filter, "numplayers < maxplayers", sizeof(filter)); AddFilter(filter, "numplayers < maxplayers");
} }
ServerListUpdate2(m_serverList[0], true, filter, GQueryType::qt_status); ServerListUpdate2(m_serverList[0], true, filter, GQueryType::qt_status);
@ -659,15 +616,13 @@ void UIFAKKServerList::RefreshLANServerList(Event *ev)
pNewServerItem->SetQueryFailed(false); pNewServerItem->SetQueryFailed(false);
} }
if (m_serverList[0]) {
ServerListClear(m_serverList[0]);
}
if (m_serverList[1]) { if (m_serverList[1]) {
ServerListClear(m_serverList[1]); ServerListClear(m_serverList[1]);
} }
if (!m_serverList[0] && (com_target_game->integer < target_game_e::TG_MOHTT || !m_serverList[1])) { if (m_serverList[0]) {
ServerListClear(m_serverList[0]);
} else {
NewServerList(); NewServerList();
} }
@ -685,8 +640,7 @@ void UIFAKKServerList::RefreshLANServerList(Event *ev)
} }
} }
static void AddFilter(char *filter, const char *value) static void AddFilter(char* filter, const char* value) {
{
if (*filter) { if (*filter) {
strcat(filter, va(" and %s", value)); strcat(filter, va(" and %s", value));
} else { } else {
@ -694,31 +648,6 @@ static void AddFilter(char *filter, const char *value)
} }
} }
//
// Added in OPM
// Filter with safety checks
//
static void AddFilter(char *filter, const char *value, size_t maxsize)
{
const char *newval;
size_t valuelen;
size_t filterlen;
if (*filter) {
newval = va(" and %s", value);
} else {
newval = value;
}
valuelen = strlen(newval);
filterlen = strlen(filter);
if (filterlen + valuelen >= maxsize) {
return;
}
strncpy(filter + filterlen, newval, maxsize - filterlen);
}
void UIFAKKServerList::CancelRefresh( Event *ev ) void UIFAKKServerList::CancelRefresh( Event *ev )
{ {
ServerListHalt(m_serverList[0]); ServerListHalt(m_serverList[0]);
@ -744,9 +673,6 @@ void UIFAKKServerList::NewServerList(void)
iNumConcurrent = 15; iNumConcurrent = 15;
} }
g_iServerQueryCount = 0;
g_iServerTotalCount = 0;
if (com_target_game->integer < target_game_e::TG_MOHTT) { if (com_target_game->integer < target_game_e::TG_MOHTT) {
game_name = GS_GetCurrentGameName(); game_name = GS_GetCurrentGameName();
secret_key = GS_GetCurrentGameKey(); secret_key = GS_GetCurrentGameKey();
@ -825,9 +751,7 @@ void UIFAKKServerList::UpdateServer(Event *ev)
const cvar_t* dm_omit_spearhead = Cvar_Get("dm_omit_spearhead", "0", CVAR_ARCHIVE); const cvar_t* dm_omit_spearhead = Cvar_Get("dm_omit_spearhead", "0", CVAR_ARCHIVE);
// check for Spearhead // check for Spearhead
if (!dm_omit_spearhead->integer) { if (!dm_omit_spearhead->integer) {
ServerListAuxUpdate( ServerListAuxUpdate(m_serverList[1], item->m_sIP.c_str(), item->m_iGameSpyPort, true, GQueryType::qt_status);
m_serverList[1], item->m_sIP.c_str(), item->m_iGameSpyPort, true, GQueryType::qt_status
);
} }
} }
} }
@ -839,16 +763,15 @@ int UIFAKKServerList::ServerCompareFunction(const UIListCtrlItem *i1, const UILi
const FAKKServerListItem* fi1 = static_cast<const FAKKServerListItem*>(i1); const FAKKServerListItem* fi1 = static_cast<const FAKKServerListItem*>(i1);
const FAKKServerListItem* fi2 = static_cast<const FAKKServerListItem*>(i2); const FAKKServerListItem* fi2 = static_cast<const FAKKServerListItem*>(i2);
if (fi1->IsFavorite() != fi2->IsFavorite()) { if (fi1->IsFavorite() != fi2->IsFavorite())
{
if (fi1->IsFavorite()) { if (fi1->IsFavorite()) {
iCompResult = -1; iCompResult = -1;
} else { } else {
iCompResult = 1; iCompResult = 1;
} }
if (g_bReverseSort) { if (g_bReverseSort) iCompResult = -iCompResult;
iCompResult = -iCompResult;
}
} else if (fi1->IsQueried() != fi2->IsQueried()) { } else if (fi1->IsQueried() != fi2->IsQueried()) {
if (fi1->IsQueried()) { if (fi1->IsQueried()) {
iCompResult = -1; iCompResult = -1;
@ -856,19 +779,16 @@ int UIFAKKServerList::ServerCompareFunction(const UIListCtrlItem *i1, const UILi
iCompResult = 1; iCompResult = 1;
} }
if (g_bReverseSort) { if (g_bReverseSort) iCompResult = -iCompResult;
iCompResult = -iCompResult;
}
} else if (fi1->IsDifferentVersion() != fi2->IsDifferentVersion()) { } else if (fi1->IsDifferentVersion() != fi2->IsDifferentVersion()) {
if (fi1->IsDifferentVersion()) { if (fi1->IsDifferentVersion()) {
iCompResult = 1; iCompResult = 1;
} else { } else {
iCompResult = -1; iCompResult = -1;
} }
if (g_bReverseSort) { if (g_bReverseSort) iCompResult = -iCompResult;
iCompResult = -iCompResult;
}
} else if (fi1->IfQueryFailed() != fi2->IfQueryFailed()) { } else if (fi1->IfQueryFailed() != fi2->IfQueryFailed()) {
if (fi1->IfQueryFailed()) { if (fi1->IfQueryFailed()) {
iCompResult = 1; iCompResult = 1;
@ -876,9 +796,7 @@ int UIFAKKServerList::ServerCompareFunction(const UIListCtrlItem *i1, const UILi
iCompResult = -1; iCompResult = -1;
} }
if (g_bReverseSort) { if (g_bReverseSort) iCompResult = -iCompResult;
iCompResult = -iCompResult;
}
} else if (g_bNumericSort) { } else if (g_bNumericSort) {
val1 = fi1->getListItemValue(columnname); val1 = fi1->getListItemValue(columnname);
val2 = fi2->getListItemValue(columnname); val2 = fi2->getListItemValue(columnname);
@ -894,7 +812,8 @@ int UIFAKKServerList::ServerCompareFunction(const UIListCtrlItem *i1, const UILi
iCompResult = str::icmp(fi1->getListItemString(columnname), fi2->getListItemString(columnname)); iCompResult = str::icmp(fi1->getListItemString(columnname), fi2->getListItemString(columnname));
} }
if (!iCompResult) { if (!iCompResult)
{
if (columnname != -2) { if (columnname != -2) {
val1 = fi1->getListItemValue(2); val1 = fi1->getListItemValue(2);
val2 = fi2->getListItemValue(2); val2 = fi2->getListItemValue(2);
@ -927,9 +846,11 @@ int UIFAKKServerList::ServerCompareFunction(const UIListCtrlItem *i1, const UILi
if (val1 < val2) { if (val1 < val2) {
iCompResult = 1; iCompResult = 1;
} else if (val1 > val2) { }
else if (val1 > val2) {
iCompResult = -1; iCompResult = -1;
} else { }
else {
iCompResult = 0; iCompResult = 0;
} }
} }
@ -947,9 +868,7 @@ int UIFAKKServerList::ServerCompareFunction(const UIListCtrlItem *i1, const UILi
} }
} }
if (g_bReverseSort) { if (g_bReverseSort) iCompResult = -iCompResult;
iCompResult = -iCompResult;
}
} }
return iCompResult; return iCompResult;
@ -957,7 +876,8 @@ int UIFAKKServerList::ServerCompareFunction(const UIListCtrlItem *i1, const UILi
void UIFAKKServerList::Draw( void ) void UIFAKKServerList::Draw( void )
{ {
if (m_serverList[0]) { if (m_serverList[0])
{
GServerListState listState[2]; GServerListState listState[2];
ServerListThink(m_serverList[0]); ServerListThink(m_serverList[0]);
@ -967,17 +887,22 @@ void UIFAKKServerList::Draw(void)
listState[0] = ServerListState(m_serverList[0]); listState[0] = ServerListState(m_serverList[0]);
listState[1] = m_serverList[1] ? ServerListState(m_serverList[1]) : GServerListState::sl_idle; listState[1] = m_serverList[1] ? ServerListState(m_serverList[1]) : GServerListState::sl_idle;
if (listState[0] != GServerListState::sl_idle || listState[1] != GServerListState::sl_idle) { if (listState[0] != GServerListState::sl_idle || listState[1] != GServerListState::sl_idle)
{
menuManager.PassEventToWidget("refresh", new Event(EV_Widget_Disable)); menuManager.PassEventToWidget("refresh", new Event(EV_Widget_Disable));
menuManager.PassEventToWidget("cancelrefresh", new Event(EV_Widget_Enable)); menuManager.PassEventToWidget("cancelrefresh", new Event(EV_Widget_Enable));
} else { }
else
{
menuManager.PassEventToWidget("refresh", new Event(EV_Widget_Enable)); menuManager.PassEventToWidget("refresh", new Event(EV_Widget_Enable));
menuManager.PassEventToWidget("cancelrefresh", new Event(EV_Widget_Disable)); menuManager.PassEventToWidget("cancelrefresh", new Event(EV_Widget_Disable));
} }
} else if (!m_bHasList) { } else if (!m_bHasList) {
if (m_bLANListing) { if (m_bLANListing) {
RefreshLANServerList(NULL); RefreshLANServerList(NULL);
} else { }
else {
RefreshServerList(NULL); RefreshServerList(NULL);
} }
@ -1055,7 +980,7 @@ void UIFAKKServerList::SortByColumn(int column)
} }
} }
void UIFAKKServerList::UpdateServerListCallBack(GServerList serverlist, int msg, void *instance, void *param1, void *param2) void UpdateServerListCallBack(GServerList serverlist, int msg, void* instance, void* param1, void* param2)
{ {
int i, j; int i, j;
int iPort, iGameSpyPort; int iPort, iGameSpyPort;
@ -1063,6 +988,8 @@ void UIFAKKServerList::UpdateServerListCallBack(GServerList serverlist, int msg,
str sAddress; str sAddress;
GServer server; GServer server;
FAKKServerListItem* pNewServerItem; FAKKServerListItem* pNewServerItem;
static int iServerQueryCount = 0;
static int iServerTotalCount = 0;
UIFAKKServerList* uiServerList; UIFAKKServerList* uiServerList;
int iServerType; int iServerType;
// filters // filters
@ -1085,7 +1012,8 @@ void UIFAKKServerList::UpdateServerListCallBack(GServerList serverlist, int msg,
pNewServerItem = NULL; pNewServerItem = NULL;
server = (GServer)param1; server = (GServer)param1;
if (param2) { if (param2)
{
if (msg == LIST_PROGRESS && param2 == (void*)-1) { if (msg == LIST_PROGRESS && param2 == (void*)-1) {
iRealIP = inet_addr(ServerGetAddress(server)); iRealIP = inet_addr(ServerGetAddress(server));
ServerGetIntValue(server, "hostport", PORT_SERVER); ServerGetIntValue(server, "hostport", PORT_SERVER);
@ -1105,13 +1033,11 @@ void UIFAKKServerList::UpdateServerListCallBack(GServerList serverlist, int msg,
return; return;
} }
//Cvar_Set("dm_serverstatusbar", va("%i", (int)(uintptr_t)param2)); Cvar_Set("dm_serverstatusbar", va("%i", (int)(uintptr_t)param2));
// Fixed in OPM
// As both lists are combined, show the correct percentage
Cvar_Set("dm_serverstatusbar", va("%i", 100 * g_iServerQueryCount / g_iServerTotalCount));
} }
if (msg == LIST_PROGRESS) { if (msg == LIST_PROGRESS)
{
const char* pszHostName; const char* pszHostName;
bool bDiffVersion; bool bDiffVersion;
bool bIsDemo; bool bIsDemo;
@ -1119,7 +1045,6 @@ void UIFAKKServerList::UpdateServerListCallBack(GServerList serverlist, int msg,
str sPlayers; str sPlayers;
const char* pszGameVer; const char* pszGameVer;
const char* pszGameVerNumber; const char* pszGameVerNumber;
float fGameVer;
pszHostName = ServerGetStringValue(server, "hostname", "(NONE)"); pszHostName = ServerGetStringValue(server, "hostname", "(NONE)");
bDiffVersion = false; bDiffVersion = false;
@ -1133,26 +1058,24 @@ void UIFAKKServerList::UpdateServerListCallBack(GServerList serverlist, int msg,
bIsDemo = true; bIsDemo = true;
} }
fGameVer = atof(pszGameVerNumber);
if (com_target_game->integer >= target_game_e::TG_MOHTT) { if (com_target_game->integer >= target_game_e::TG_MOHTT) {
if (iServerType == target_game_e::TG_MOHTT) { if (iServerType == target_game_e::TG_MOHTT) {
//if (fabs(fGameVer - com_target_version->value) > 0.1f) { //if (fabs(atof(pszGameVerNumber) - com_target_version->value) > 0.1f) {
// bDiffVersion = true; // bDiffVersion = true;
//} //}
if (fabs(fGameVer) < 2.3f) { if (fabs(atof(pszGameVerNumber)) < 2.3f) {
bDiffVersion = true; bDiffVersion = true;
} }
} else { } else {
//if (fabs(fGameVer - com_target_version->value) > 0.3f) { //if (fabs(atof(pszGameVerNumber) - com_target_version->value) > 0.3f) {
// bDiffVersion = true; // bDiffVersion = true;
//} //}
if (fabs(fGameVer) < 2.1f) { if (fabs(atof(pszGameVerNumber)) < 2.1f) {
bDiffVersion = true; bDiffVersion = true;
} }
} }
} else { } else {
if (fabs(fGameVer - com_target_version->value) > 0.1f) { if (fabs(atof(pszGameVerNumber) - com_target_version->value) > 0.1f) {
bDiffVersion = true; bDiffVersion = true;
} }
} }
@ -1198,12 +1121,15 @@ void UIFAKKServerList::UpdateServerListCallBack(GServerList serverlist, int msg,
pNewServerItem->SetQueried(true); pNewServerItem->SetQueried(true);
pNewServerItem->SetNumPlayers(ServerGetIntValue(server, "numplayers", 0)); pNewServerItem->SetNumPlayers(ServerGetIntValue(server, "numplayers", 0));
g_iServerQueryCount++; iServerQueryCount++;
Cvar_Set("dm_servercount", va("%d/%d", g_iServerQueryCount, g_iServerTotalCount)); Cvar_Set("dm_servercount", va("%d/%d", iServerQueryCount, iServerTotalCount));
uiServerList->SortByLastSortColumn(); uiServerList->SortByLastSortColumn();
} else if (msg == LIST_STATECHANGED) { }
switch (ServerListState(serverlist)) { else if (msg == LIST_STATECHANGED)
{
switch (ServerListState(serverlist))
{
case GServerListState::sl_idle: case GServerListState::sl_idle:
if (com_target_game->integer >= target_game_e::TG_MOHTT) { if (com_target_game->integer >= target_game_e::TG_MOHTT) {
if (iServerType == target_game_e::TG_MOHTT) { if (iServerType == target_game_e::TG_MOHTT) {
@ -1227,17 +1153,14 @@ void UIFAKKServerList::UpdateServerListCallBack(GServerList serverlist, int msg,
case GServerListState::sl_listxfer: case GServerListState::sl_listxfer:
Cvar_Set("dm_serverstatus", "Getting List."); Cvar_Set("dm_serverstatus", "Getting List.");
if (com_target_game->integer >= target_game_e::TG_MOHTT) { if (com_target_game->integer >= target_game_e::TG_MOHTT) {
if (iServerType == target_game_e::TG_MOHTT) { if (iServerType == target_game_e::TG_MOHTT) uiServerList->m_bGettingList[0] = true;
uiServerList->m_bGettingList[0] = true; if (iServerType == target_game_e::TG_MOHTA) uiServerList->m_bGettingList[1] = true;
}
if (iServerType == target_game_e::TG_MOHTA) {
uiServerList->m_bGettingList[1] = true;
}
} else { } else {
uiServerList->m_bGettingList[0] = true; uiServerList->m_bGettingList[0] = true;
uiServerList->m_bGettingList[1] = false; uiServerList->m_bGettingList[1] = false;
} }
uiServerList->m_bUpdatingList = true; uiServerList->m_bUpdatingList = true;
iServerQueryCount = 0;
return; return;
case GServerListState::sl_lanlist: case GServerListState::sl_lanlist:
Cvar_Set("dm_serverstatus", "Searching LAN."); Cvar_Set("dm_serverstatus", "Searching LAN.");
@ -1246,27 +1169,18 @@ void UIFAKKServerList::UpdateServerListCallBack(GServerList serverlist, int msg,
case GServerListState::sl_querying: case GServerListState::sl_querying:
Cvar_Set("dm_serverstatus", "Querying Servers."); Cvar_Set("dm_serverstatus", "Querying Servers.");
uiServerList->m_bUpdatingList = true; uiServerList->m_bUpdatingList = true;
iServerQueryCount = 0;
iServerTotalCount = 0;
break; break;
default: default:
break; break;
} }
//if (!uiServerList->m_bGettingList[0] && !uiServerList->m_bGettingList[1]) { if (!uiServerList->m_bGettingList[0] && !uiServerList->m_bGettingList[1]) {
// return; return;
//}
// Rebuild the number of servers
g_iServerTotalCount = 0;
for(i = 0; i < ARRAY_LEN(uiServerList->m_serverList); i++) {
if (uiServerList->m_bGettingList[i] && uiServerList->m_serverList[i]) {
g_iServerTotalCount += ServerListCount(uiServerList->m_serverList[i]);
}
} }
// Removed in 2.0 iServerTotalCount += ServerListCount(serverlist);
// Only add entries for servers that are queried successfully
// it avoids unnecessary entries
#if 0
for (j = 0; j < ServerListCount(serverlist); j++) { for (j = 0; j < ServerListCount(serverlist); j++) {
GServer arrayServer = ServerListGetServer(serverlist, j); GServer arrayServer = ServerListGetServer(serverlist, j);
@ -1294,7 +1208,6 @@ void UIFAKKServerList::UpdateServerListCallBack(GServerList serverlist, int msg,
uiServerList->AddItem(pNewServerItem); uiServerList->AddItem(pNewServerItem);
} }
#endif
/* /*
for (i = 1; i <= uiServerList->getNumItems(); i++) for (i = 1; i <= uiServerList->getNumItems(); i++)

View file

@ -22,8 +22,6 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
#pragma once #pragma once
#include "../gamespy/goaceng.h"
class UIFAKKServerList : public UIListCtrl { class UIFAKKServerList : public UIListCtrl {
protected: protected:
// need a new struct instead of gamespy // need a new struct instead of gamespy
@ -49,7 +47,6 @@ protected:
void MakeLANListing( Event *ev ); void MakeLANListing( Event *ev );
void UpdateServer( Event *ev ); void UpdateServer( Event *ev );
static int ServerCompareFunction( const UIListCtrlItem *i1, const UIListCtrlItem *i2, int columnname ); static int ServerCompareFunction( const UIListCtrlItem *i1, const UIListCtrlItem *i2, int columnname );
static void UpdateServerListCallBack(GServerList serverlist, int msg, void *instance, void *param1, void *param2);
public: public:
UIFAKKServerList(); UIFAKKServerList();

View file

@ -443,7 +443,6 @@ void UIFakkLabel::DrawStatbar(float frac)
float alpha; float alpha;
qhandle_t hMat; qhandle_t hMat;
float w, h; float w, h;
float fvWidth, fvHeight;
col[0] = col[1] = col[2] = col[3] = 1.0; col[0] = col[1] = col[2] = col[3] = 1.0;
@ -489,20 +488,11 @@ void UIFakkLabel::DrawStatbar(float frac)
{ {
float width = frac * m_frame.size.width; float width = frac * m_frame.size.width;
fvWidth = m_frame.size.width / m_vVirtualScale[0] / uii.Rend_GetShaderWidth(m_statbar_material->GetMaterial()); re.DrawTilePic(0.0, 0.0, width, m_frame.size.height, m_statbar_material->GetMaterial());
fvHeight = m_frame.size.height / m_vVirtualScale[1] / uii.Rend_GetShaderHeight(m_statbar_material->GetMaterial());
re.DrawStretchPic(0.0, 0.0, width, m_frame.size.height, 0, 0, fvWidth, fvHeight, m_statbar_material->GetMaterial());
//re.DrawTilePic(0.0, 0.0, width, m_frame.size.height, m_statbar_material->GetMaterial());
if (alpha != 0.0 && m_statbar_material_flash) { if (alpha != 0.0 && m_statbar_material_flash) {
re.SetColor(col); re.SetColor(col);
re.DrawTilePic(0.0, 0.0, width, m_frame.size.height, m_statbar_material_flash->GetMaterial());
fvWidth = m_frame.size.width / m_vVirtualScale[0] / uii.Rend_GetShaderWidth(m_statbar_material_flash->GetMaterial());
fvHeight = m_frame.size.height / m_vVirtualScale[1] / uii.Rend_GetShaderHeight(m_statbar_material_flash->GetMaterial());
re.DrawStretchPic(0.0, 0.0, width, m_frame.size.height, 0, 0, fvWidth, fvHeight, m_statbar_material_flash->GetMaterial());
//re.DrawTilePic(0.0, 0.0, width, m_frame.size.height, m_statbar_material_flash->GetMaterial());
} }
if (m_statbar_material_marker) { if (m_statbar_material_marker) {
@ -531,22 +521,13 @@ void UIFakkLabel::DrawStatbar(float frac)
{ {
float y = m_frame.size.height * (1.0 - frac); float y = m_frame.size.height * (1.0 - frac);
fvWidth = m_frame.size.width / m_vVirtualScale[0] / uii.Rend_GetShaderWidth(m_statbar_material->GetMaterial()); re.DrawTilePic(0.0, y, m_frame.size.width, m_frame.size.height, m_statbar_material->GetMaterial());
fvHeight = m_frame.size.height / m_vVirtualScale[1] / uii.Rend_GetShaderHeight(m_statbar_material->GetMaterial());
re.DrawStretchPic(0.0, y, m_frame.size.width, m_frame.size.height, 0, 0, fvWidth, fvHeight, m_statbar_material->GetMaterial());
//re.DrawTilePic(0.0, y, m_frame.size.width, m_frame.size.height, m_statbar_material->GetMaterial());
if (alpha != 0.0 && m_statbar_material_flash) { if (alpha != 0.0 && m_statbar_material_flash) {
re.SetColor(col); re.SetColor(col);
re.DrawTilePic(
fvWidth = m_frame.size.width / m_vVirtualScale[0] / uii.Rend_GetShaderWidth(m_statbar_material_flash->GetMaterial()); 0.0, y, m_frame.size.width, m_frame.size.height, m_statbar_material_flash->GetMaterial()
fvHeight = m_frame.size.height / m_vVirtualScale[1] / uii.Rend_GetShaderHeight(m_statbar_material_flash->GetMaterial()); );
re.DrawStretchPic(0.0, y, m_frame.size.width, m_frame.size.height, 0, 0, fvWidth, fvHeight, m_statbar_material_flash->GetMaterial());
//re.DrawTilePic(
// 0.0, y, m_frame.size.width, m_frame.size.height, m_statbar_material_flash->GetMaterial()
//);
} }
if (m_statbar_material_marker) { if (m_statbar_material_marker) {
@ -980,8 +961,8 @@ void UIFakkLabel::DrawStatRotator(float frac)
vNeedleDir[0] = fSinVal; vNeedleDir[0] = fSinVal;
vNeedleDir[1] = -fCosVal; vNeedleDir[1] = -fCosVal;
vSize[0] = (m_frame.size.width + m_frame.size.height) / m_frame.size.width * m_angles[2] * getVirtualScale()[0]; vSize[0] = (m_frame.size.width + m_frame.size.height) / m_frame.size.width * m_angles[2] * m_vVirtualScale[0];
vSize[1] = (m_frame.size.width + m_frame.size.height) / m_frame.size.height * m_scale * getVirtualScale()[1]; vSize[1] = (m_frame.size.width + m_frame.size.height) / m_frame.size.height * m_scale * m_vVirtualScale[1];
vCenter[0] = (m_frame.size.width * 0.5f - vSize[0]) * vNeedleDir[0] + m_frame.size.width * 0.5f; vCenter[0] = (m_frame.size.width * 0.5f - vSize[0]) * vNeedleDir[0] + m_frame.size.width * 0.5f;
vCenter[1] = (m_frame.size.height * 0.5f - vSize[1]) * vNeedleDir[1] + m_frame.size.height * 0.5f; vCenter[1] = (m_frame.size.height * 0.5f - vSize[1]) * vNeedleDir[1] + m_frame.size.height * 0.5f;
@ -1376,7 +1357,7 @@ void UIFakkLabel::Draw(void)
m_iFontAlignmentVertical, m_iFontAlignmentVertical,
Sys_LV_CL_ConvertString(va("%s", CL_ConfigString(cl.snap.ps.stats[m_stat_configstring]))), Sys_LV_CL_ConvertString(va("%s", CL_ConfigString(cl.snap.ps.stats[m_stat_configstring]))),
UBlack, UBlack,
getVirtualScale() m_bVirtual ? m_vVirtualScale : NULL
); );
} else { } else {
m_font->PrintJustified( m_font->PrintJustified(
@ -1384,7 +1365,7 @@ void UIFakkLabel::Draw(void)
m_iFontAlignmentHorizontal, m_iFontAlignmentHorizontal,
m_iFontAlignmentVertical, m_iFontAlignmentVertical,
Sys_LV_CL_ConvertString(va("%s", CL_ConfigString(cl.snap.ps.stats[m_stat_configstring]))), Sys_LV_CL_ConvertString(va("%s", CL_ConfigString(cl.snap.ps.stats[m_stat_configstring]))),
getVirtualScale() m_bVirtual ? m_vVirtualScale : NULL
); );
} }
return; return;
@ -1403,7 +1384,7 @@ void UIFakkLabel::Draw(void)
m_iFontAlignmentVertical, m_iFontAlignmentVertical,
va("%d", delta), va("%d", delta),
UBlack, UBlack,
getVirtualScale() m_bVirtual ? m_vVirtualScale : NULL
); );
} else { } else {
m_font->PrintJustified( m_font->PrintJustified(
@ -1411,7 +1392,7 @@ void UIFakkLabel::Draw(void)
m_iFontAlignmentHorizontal, m_iFontAlignmentHorizontal,
m_iFontAlignmentVertical, m_iFontAlignmentVertical,
va("%d", delta), va("%d", delta),
getVirtualScale() m_bVirtual ? m_vVirtualScale : NULL
); );
} }
return; return;
@ -1497,7 +1478,7 @@ void UIFakkLabel::Draw(void)
m_iFontAlignmentVertical, m_iFontAlignmentVertical,
Sys_LV_CL_ConvertString(va("%s", CL_ConfigString(CS_WEAPONS + cl.snap.ps.activeItems[m_itemindex]))), Sys_LV_CL_ConvertString(va("%s", CL_ConfigString(CS_WEAPONS + cl.snap.ps.activeItems[m_itemindex]))),
UBlack, UBlack,
getVirtualScale() m_bVirtual ? m_vVirtualScale : NULL
); );
} else { } else {
m_font->PrintJustified( m_font->PrintJustified(
@ -1505,7 +1486,7 @@ void UIFakkLabel::Draw(void)
m_iFontAlignmentHorizontal, m_iFontAlignmentHorizontal,
m_iFontAlignmentVertical, m_iFontAlignmentVertical,
Sys_LV_CL_ConvertString(va("%s", CL_ConfigString(CS_WEAPONS + cl.snap.ps.activeItems[m_itemindex]))), Sys_LV_CL_ConvertString(va("%s", CL_ConfigString(CS_WEAPONS + cl.snap.ps.activeItems[m_itemindex]))),
getVirtualScale() m_bVirtual ? m_vVirtualScale : NULL
); );
} }

View file

@ -124,9 +124,9 @@ void View3D::DrawFPS(void)
re.SetColor(UBlack); re.SetColor(UBlack);
re.DrawBox( re.DrawBox(
0.0, 0.0,
m_frame.pos.y + m_frame.size.height - m_font->getHeight() * 4.0, m_frame.pos.y + m_frame.size.height - m_font->getHeight(qfalse) * 4.0,
m_frame.pos.x + m_frame.size.width, m_frame.pos.x + m_frame.size.width,
m_font->getHeight() * 4.0 m_font->getHeight(qfalse) * 4.0
); );
} }
@ -145,11 +145,11 @@ void View3D::DrawFPS(void)
} }
m_font->Print( m_font->Print(
m_font->getHeight(getHighResScale()) * 10.0 / getHighResScale()[0], m_font->getHeight(qfalse) * 10.0,
(m_frame.pos.y + m_frame.size.height - m_font->getHeight(getHighResScale()) * 3.0) / getHighResScale()[1], m_frame.pos.y + m_frame.size.height - m_font->getHeight(qfalse) * 3.0,
string, string,
-1, -1,
getHighResScale() qfalse
); );
// Draw elements count // Draw elements count
@ -162,11 +162,11 @@ void View3D::DrawFPS(void)
Com_sprintf(string, sizeof(string), "wt%5d wv%5d cl%d", cls.world_tris, cls.world_verts, cls.character_lights); Com_sprintf(string, sizeof(string), "wt%5d wv%5d cl%d", cls.world_tris, cls.world_verts, cls.character_lights);
m_font->Print( m_font->Print(
(m_font->getHeight(getHighResScale()) * 10.0) / getHighResScale()[0], m_font->getHeight(qfalse) * 10.0,
(m_frame.pos.y + m_frame.size.height - m_font->getHeight(getHighResScale()) * 2.0) / getHighResScale()[1], m_frame.pos.y + m_frame.size.height - m_font->getHeight(qfalse) * 2.0,
string, string,
-1, -1,
getHighResScale() qfalse
); );
Com_sprintf( Com_sprintf(
@ -179,11 +179,11 @@ void View3D::DrawFPS(void)
); );
m_font->Print( m_font->Print(
(m_font->getHeight(getHighResScale()) * 10.0) / getHighResScale()[0], m_font->getHeight(qfalse) * 10.0,
(m_frame.pos.y + m_frame.size.height - m_font->getHeight(getHighResScale())) / getHighResScale()[1], m_frame.pos.y + m_frame.size.height - m_font->getHeight(qfalse),
string, string,
-1, -1,
getHighResScale() qfalse
); );
m_font->setColor(UBlack); m_font->setColor(UBlack);
@ -208,32 +208,32 @@ void View3D::PrintSound(int channel, const char *name, float vol, int rvol, floa
float xStep; float xStep;
float height; float height;
height = m_font->getHeight(getHighResScale()); height = m_font->getHeight(false);
xStep = height; xStep = height;
x = 0; x = 0;
Com_sprintf(buf, sizeof(buf), "%d", channel); Com_sprintf(buf, sizeof(buf), "%d", channel);
m_font->Print(x, height * line + m_frame.pos.y, buf, -1, getHighResScale()); m_font->Print(x, height * line + m_frame.pos.y, buf, -1, false);
x += xStep + xStep; x += xStep + xStep;
Com_sprintf(buf, sizeof(buf), "%s", name); Com_sprintf(buf, sizeof(buf), "%s", name);
m_font->Print(x, height * line + m_frame.pos.y, buf, -1, getHighResScale()); m_font->Print(x, height * line + m_frame.pos.y, buf, -1, false);
x += xStep * 30.0; x += xStep * 30.0;
Com_sprintf(buf, sizeof(buf), "vol:%.2f", vol); Com_sprintf(buf, sizeof(buf), "vol:%.2f", vol);
m_font->Print(x, height * line + m_frame.pos.y, buf, -1, getHighResScale()); m_font->Print(x, height * line + m_frame.pos.y, buf, -1, false);
x += xStep * 8; x += xStep * 8;
Com_sprintf(buf, sizeof(buf), "rvol:%.2f", (float)(rvol / 128.f)); Com_sprintf(buf, sizeof(buf), "rvol:%.2f", (float)(rvol / 128.f));
m_font->Print(x, height * line + m_frame.pos.y, buf, -1, getHighResScale()); m_font->Print(x, height * line + m_frame.pos.y, buf, -1, false);
x += xStep * 5; x += xStep * 5;
Com_sprintf(buf, sizeof(buf), "pit:%.2f", pitch); Com_sprintf(buf, sizeof(buf), "pit:%.2f", pitch);
m_font->Print(x, height * line + m_frame.pos.y, buf, -1, getHighResScale()); m_font->Print(x, height * line + m_frame.pos.y, buf, -1, false);
x += xStep * 5; x += xStep * 5;
Com_sprintf(buf, sizeof(buf), "base:%d", (int)base); Com_sprintf(buf, sizeof(buf), "base:%d", (int)base);
m_font->Print(x, height * line + m_frame.pos.y, buf, -1, getHighResScale()); m_font->Print(x, height * line + m_frame.pos.y, buf, -1, false);
line++; line++;
} }
@ -264,7 +264,8 @@ void DisplayServerNetProfileInfo(UIFont *font, float y, netprofclient_t *netprof
(unsigned int)((float)(netprofile->outPackets.numFragmented + netprofile->inPackets.numFragmented) (unsigned int)((float)(netprofile->outPackets.numFragmented + netprofile->inPackets.numFragmented)
/ (float)(netprofile->inPackets.totalProcessed + netprofile->outPackets.totalProcessed) / (float)(netprofile->inPackets.totalProcessed + netprofile->outPackets.totalProcessed)
)), )),
-1 -1,
qfalse
); );
font->Print(334, y, va("%i", netprofile->inPackets.percentDropped)); font->Print(334, y, va("%i", netprofile->inPackets.percentDropped));
font->Print(364, y, va("%i", netprofile->outPackets.percentDropped)); font->Print(364, y, va("%i", netprofile->outPackets.percentDropped));
@ -275,7 +276,8 @@ void DisplayServerNetProfileInfo(UIFont *font, float y, netprofclient_t *netprof
(unsigned int)((float)(netprofile->outPackets.numDropped + netprofile->inPackets.numDropped) (unsigned int)((float)(netprofile->outPackets.numDropped + netprofile->inPackets.numDropped)
/ (float)(netprofile->inPackets.totalProcessed + netprofile->outPackets.totalProcessed) / (float)(netprofile->inPackets.totalProcessed + netprofile->outPackets.totalProcessed)
)), )),
-1 -1,
qfalse
); );
font->Print(434, y, va("%i", netprofile->inPackets.percentDropped)); font->Print(434, y, va("%i", netprofile->inPackets.percentDropped));
font->Print(464, y, va("%i", netprofile->outPackets.percentDropped)); font->Print(464, y, va("%i", netprofile->outPackets.percentDropped));
@ -286,7 +288,8 @@ void DisplayServerNetProfileInfo(UIFont *font, float y, netprofclient_t *netprof
(unsigned int)((float)(netprofile->outPackets.totalLengthConnectionLess (unsigned int)((float)(netprofile->outPackets.totalLengthConnectionLess
+ netprofile->inPackets.totalLengthConnectionLess) + netprofile->inPackets.totalLengthConnectionLess)
/ (float)(netprofile->outPackets.totalSize + netprofile->inPackets.totalSize))), / (float)(netprofile->outPackets.totalSize + netprofile->inPackets.totalSize))),
-1 -1,
qfalse
); );
font->Print(534, y, va("%i", netprofile->inPackets.bytesPerSec)); font->Print(534, y, va("%i", netprofile->inPackets.bytesPerSec));
font->Print(594, y, va("%i", netprofile->outPackets.bytesPerSec)); font->Print(594, y, va("%i", netprofile->outPackets.bytesPerSec));
@ -300,7 +303,7 @@ void DisplayClientNetProfile(UIFont *font, float x, float y, netprofclient_t *ne
float fontHeight; float fontHeight;
float columnHeight; float columnHeight;
fontHeight = font->getHeight(); fontHeight = font->getHeight(qfalse);
columns[0] = x + 120; columns[0] = x + 120;
columns[1] = x + 230; columns[1] = x + 230;
columns[2] = x + 330; columns[2] = x + 330;
@ -399,13 +402,13 @@ void View3D::DrawNetProfile(void)
setFont("verdana-14"); setFont("verdana-14");
m_font->setColor(UWhite); m_font->setColor(UWhite);
fontHeight = m_font->getHeight(); fontHeight = m_font->getHeight(qfalse);
yOffset = sv_netprofileoverlay->integer + 8; yOffset = sv_netprofileoverlay->integer + 8;
if (svs.netprofile.rate) { if (svs.netprofile.rate) {
m_font->Print(8, yOffset, va("Server Net Profile Max Rate: %i", svs.netprofile.rate), -1); m_font->Print(8, yOffset, va("Server Net Profile Max Rate: %i", svs.netprofile.rate), -1, qfalse);
} else { } else {
m_font->Print(8, yOffset, "Server Net Profile Max Rate: none", -1); m_font->Print(8, yOffset, "Server Net Profile Max Rate: none", -1, qfalse);
} }
columnHeight = fontHeight + fontHeight + yOffset; columnHeight = fontHeight + fontHeight + yOffset;
@ -484,10 +487,10 @@ void View3D::DrawNetProfile(void)
setFont("verdana-14"); setFont("verdana-14");
m_font->setColor(UWhite); m_font->setColor(UWhite);
fontHeight = m_font->getHeight(); fontHeight = m_font->getHeight(qfalse);
yOffset = cl_netprofileoverlay->integer + 16; yOffset = cl_netprofileoverlay->integer + 16;
m_font->Print(16, yOffset, "Client Net Profile", -1); m_font->Print(16, yOffset, "Client Net Profile", -1, qfalse);
NetProfileCalcStats(&cls.netprofile.outPackets, 500); NetProfileCalcStats(&cls.netprofile.outPackets, 500);
NetProfileCalcStats(&cls.netprofile.inPackets, 500); NetProfileCalcStats(&cls.netprofile.inPackets, 500);
@ -564,7 +567,7 @@ void View3D::CenterPrint(void)
m_iFontAlignmentHorizontal, m_iFontAlignmentHorizontal,
m_iFontAlignmentVertical, m_iFontAlignmentVertical,
p, p,
getVirtualScale() m_bVirtual ? m_vVirtualScale : NULL
); );
m_font->setColor(UColor(1, 1, 1, alpha)); m_font->setColor(UColor(1, 1, 1, alpha));
@ -572,7 +575,7 @@ void View3D::CenterPrint(void)
frame = getClientFrame(); frame = getClientFrame();
m_font->PrintJustified( m_font->PrintJustified(
frame, m_iFontAlignmentHorizontal, m_iFontAlignmentVertical, p, getVirtualScale() frame, m_iFontAlignmentHorizontal, m_iFontAlignmentVertical, p, m_bVirtual ? m_vVirtualScale : NULL
); );
m_font->setColor(UBlack); m_font->setColor(UBlack);
@ -625,7 +628,7 @@ void View3D::LocationPrint(void)
alpha = Q_clamp_float(alpha, 0, 1); alpha = Q_clamp_float(alpha, 0, 1);
x = m_x_coord / 640.f * m_screenframe.size.width; x = m_x_coord / 640.f * m_screenframe.size.width;
y = (480 - m_font->getHeight(getHighResScale()) - m_y_coord) / 480.f * m_screenframe.size.height; y = (480 - m_font->getHeight(false) - m_y_coord) / 480.f * m_screenframe.size.height;
if (m_x_coord == -1) { if (m_x_coord == -1) {
horiz = FONT_JUSTHORZ_CENTER; horiz = FONT_JUSTHORZ_CENTER;
@ -644,7 +647,7 @@ void View3D::LocationPrint(void)
horiz, horiz,
vert, vert,
p, p,
getVirtualScale() m_bVirtual ? m_vVirtualScale : NULL
); );
m_font->setColor(UColor(1, 1, 1, alpha)); m_font->setColor(UColor(1, 1, 1, alpha));
@ -655,7 +658,7 @@ void View3D::LocationPrint(void)
horiz, horiz,
vert, vert,
p, p,
getVirtualScale() m_bVirtual ? m_vVirtualScale : NULL
); );
m_font->setColor(UBlack); m_font->setColor(UBlack);
@ -743,7 +746,7 @@ void View3D::DrawSubtitleOverlay(void)
{ {
cvar_t *subAlpha; cvar_t *subAlpha;
int i; int i;
float minX, maxX; float minX, maxY;
int line; int line;
subAlpha = Cvar_Get("subAlpha", "0.5", 0); subAlpha = Cvar_Get("subAlpha", "0.5", 0);
@ -778,8 +781,8 @@ void View3D::DrawSubtitleOverlay(void)
} }
} }
minX = m_screenframe.size.height - m_font->getHeight(getHighResScale()) * 10; minX = m_screenframe.size.height - m_font->getHeight(false) * 10;
maxX = ((m_frame.pos.x + m_frame.size.width) - (m_frame.pos.x + m_frame.size.width) * 0.2f) / getHighResScale()[0]; maxY = (m_frame.pos.x + m_frame.size.width) - (m_frame.pos.x + m_frame.size.width) * 0.2f;
line = 0; line = 0;
for (i = 0; i < MAX_SUBTITLES; i++) { for (i = 0; i < MAX_SUBTITLES; i++) {
@ -787,7 +790,7 @@ void View3D::DrawSubtitleOverlay(void)
continue; continue;
} }
if (m_font->getWidth(subs[i]->string, sizeof(oldStrings[i])) > maxX) { if (m_font->getWidth(subs[i]->string, sizeof(oldStrings[i])) > maxY) {
char buf[2048]; char buf[2048];
char *c; char *c;
char *end; char *end;
@ -810,12 +813,12 @@ void View3D::DrawSubtitleOverlay(void)
width = m_font->getWidth(c, blockcount); width = m_font->getWidth(c, blockcount);
if (total + width > maxX) { if (total + width > maxY) {
m_font->setColor(UColor(0, 0, 0, alpha[i] * subAlpha->value)); m_font->setColor(UColor(0, 0, 0, alpha[i] * subAlpha->value));
m_font->Print(18, (m_font->getHeight(getHighResScale()) * line + minX + 1.f) / getHighResScale()[1], buf, -1, getHighResScale()); m_font->Print(18, m_font->getHeight(false) * line + minX + 1.f, buf, -1, false);
m_font->setColor(UColor(1, 1, 1, alpha[i] * subAlpha->value)); m_font->setColor(UColor(1, 1, 1, alpha[i] * subAlpha->value));
m_font->Print(20, (m_font->getHeight(getHighResScale()) * line + minX) / getHighResScale()[1], buf, -1, getHighResScale()); m_font->Print(20, m_font->getHeight(false) * line + minX, buf, -1, false);
line++; line++;
@ -838,17 +841,17 @@ void View3D::DrawSubtitleOverlay(void)
} }
m_font->setColor(UColor(0, 0, 0, alpha[i] * subAlpha->value)); m_font->setColor(UColor(0, 0, 0, alpha[i] * subAlpha->value));
m_font->Print(18, (m_font->getHeight(getHighResScale()) * line + minX + 1.f) / getHighResScale()[1], buf, -1, getHighResScale()); m_font->Print(18, m_font->getHeight(false) * line + minX + 1.f, buf, -1, qfalse);
m_font->setColor(UColor(1, 1, 1, alpha[i] * subAlpha->value)); m_font->setColor(UColor(1, 1, 1, alpha[i] * subAlpha->value));
m_font->Print(20, (m_font->getHeight(getHighResScale()) * line + minX) / getHighResScale()[1], buf, -1, getHighResScale()); m_font->Print(20, m_font->getHeight(false) * line + minX, buf, -1, qfalse);
line++; line++;
} else { } else {
m_font->setColor(UColor(0, 0, 0, alpha[i] * subAlpha->value)); m_font->setColor(UColor(0, 0, 0, alpha[i] * subAlpha->value));
m_font->Print(18, (m_font->getHeight(getHighResScale()) * line + minX + 1.f) / getHighResScale()[1], subs[i]->string, -1, getHighResScale()); m_font->Print(18, m_font->getHeight(false) * line + minX + 1.f, subs[i]->string, -1, qfalse);
m_font->setColor(UColor(1, 1, 1, alpha[i] * subAlpha->value)); m_font->setColor(UColor(1, 1, 1, alpha[i] * subAlpha->value));
m_font->Print(20, (m_font->getHeight(getHighResScale()) * line + minX) / getHighResScale()[1], subs[i]->string, -1, getHighResScale()); m_font->Print(20, m_font->getHeight(false) * line + minX, subs[i]->string, -1, qfalse);
line++; line++;
} }

View file

@ -389,8 +389,6 @@ typedef struct {
qhandle_t whiteShader; qhandle_t whiteShader;
qhandle_t consoleShader; qhandle_t consoleShader;
fontInfo_t consoleFont; fontInfo_t consoleFont;
int refSequence;
} clientStatic_t; } clientStatic_t;
extern clientStatic_t cls; extern clientStatic_t cls;
@ -559,10 +557,6 @@ void UI_LoadResource( const char *name );
qboolean CL_CheckPaused(void); qboolean CL_CheckPaused(void);
int CL_GetRefSequence(void);
qboolean CL_IsRendererLoaded(void);
void CL_ApplyOriginalConfigTweaks();
// //
// cl_input // cl_input
// //

View file

@ -81,7 +81,6 @@ LPALGENBUFFERS qalGenBuffers;
LPALDELETEBUFFERS qalDeleteBuffers; LPALDELETEBUFFERS qalDeleteBuffers;
LPALISBUFFER qalIsBuffer; LPALISBUFFER qalIsBuffer;
LPALBUFFERDATA qalBufferData; LPALBUFFERDATA qalBufferData;
LPALBUFFERI qalBufferi;
LPALGETBUFFERF qalGetBufferf; LPALGETBUFFERF qalGetBufferf;
LPALGETBUFFERFV qalGetBufferfv; LPALGETBUFFERFV qalGetBufferfv;
LPALGETBUFFERI qalGetBufferi; LPALGETBUFFERI qalGetBufferi;
@ -202,7 +201,6 @@ qboolean QAL_Init(const char *libname)
qalDeleteBuffers = GPA("alDeleteBuffers"); qalDeleteBuffers = GPA("alDeleteBuffers");
qalIsBuffer = GPA("alIsBuffer"); qalIsBuffer = GPA("alIsBuffer");
qalBufferData = GPA("alBufferData"); qalBufferData = GPA("alBufferData");
qalBufferi = GPA("alBufferi");
qalGetBufferf = GPA("alGetBufferf"); qalGetBufferf = GPA("alGetBufferf");
qalGetBufferfv = GPA("alGetBufferfv"); qalGetBufferfv = GPA("alGetBufferfv");
qalGetBufferi = GPA("alGetBufferi"); qalGetBufferi = GPA("alGetBufferi");

View file

@ -36,18 +36,15 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
#ifdef USE_LOCAL_HEADERS #ifdef USE_LOCAL_HEADERS
#include "../AL/al.h" #include "../AL/al.h"
#include "../AL/alc.h" #include "../AL/alc.h"
#include "../AL/alext.h"
#else #else
#if defined(_MSC_VER) || defined(__APPLE__) #if defined(_MSC_VER) || defined(__APPLE__)
// MSVC users must install the OpenAL SDK which doesn't use the AL/*.h scheme. // MSVC users must install the OpenAL SDK which doesn't use the AL/*.h scheme.
// OSX framework also needs this // OSX framework also needs this
#include <al.h> #include <al.h>
#include <alc.h> #include <alc.h>
#include <alext.h>
#else #else
#include <AL/al.h> #include <AL/al.h>
#include <AL/alc.h> #include <AL/alc.h>
#include <AL/alext.h>
#endif #endif
#endif #endif
@ -123,7 +120,7 @@ extern LPALBUFFERDATA qalBufferData;
extern LPALBUFFERF qalBufferf; extern LPALBUFFERF qalBufferf;
extern LPALBUFFER3F qalBuffer3f; extern LPALBUFFER3F qalBuffer3f;
extern LPALBUFFERFV qalBufferfv; extern LPALBUFFERFV qalBufferfv;
extern LPALBUFFERI qalBufferi; extern LPALBUFFERF qalBufferi;
extern LPALBUFFER3F qalBuffer3i; extern LPALBUFFER3F qalBuffer3i;
extern LPALBUFFERFV qalBufferiv; extern LPALBUFFERFV qalBufferiv;
extern LPALGETBUFFERF qalGetBufferf; extern LPALGETBUFFERF qalGetBufferf;

View file

@ -34,12 +34,11 @@ extern "C" {
typedef struct snd_info_s typedef struct snd_info_s
{ {
int rate; int rate;
float width; int width;
int channels; int channels;
int samples; int samples;
int size; int size;
int dataofs; int dataofs;
int dataalign;
} snd_info_t; } snd_info_t;
typedef struct snd_codec_s snd_codec_t; typedef struct snd_codec_s snd_codec_t;

View file

@ -622,7 +622,7 @@ int S_MP3_CodecReadStream(snd_stream_t* stream, int bytes, void* buffer)
mp3info = stream->ptr; mp3info = stream->ptr;
// Make sure we get complete frames all the way through. // Make sure we get complete frames all the way through.
bytes -= fmod(bytes, (stream->info.channels * stream->info.width)); bytes -= bytes % (stream->info.channels * stream->info.width);
if (mp3info->buflen) if (mp3info->buflen)
{ {

View file

@ -133,7 +133,6 @@ static qboolean S_ReadRIFFHeader(fileHandle_t file, snd_info_t *info)
char dump[16]; char dump[16];
int bits; int bits;
int fmtlen = 0; int fmtlen = 0;
int bytealign;
// skip the riff wav header // skip the riff wav header
FS_Read(dump, 12, file); FS_Read(dump, 12, file);
@ -150,23 +149,18 @@ static qboolean S_ReadRIFFHeader(fileHandle_t file, snd_info_t *info)
info->channels = FGetLittleShort(file); info->channels = FGetLittleShort(file);
info->rate = FGetLittleLong(file); info->rate = FGetLittleLong(file);
FGetLittleLong(file); FGetLittleLong(file);
bytealign = FGetLittleShort(file); FGetLittleShort(file);
bits = FGetLittleShort(file); bits = FGetLittleShort(file);
//if( bits < 8 ) if( bits < 8 )
//{ {
// Com_Printf( S_COLOR_RED "ERROR: Less than 8 bit sound is not supported\n"); Com_Printf( S_COLOR_RED "ERROR: Less than 8 bit sound is not supported\n");
// return qfalse; return qfalse;
//}
info->width = bits / 8.0;
info->dataofs = 0;
if (bits == 16) {
info->dataalign = 1;
} else {
info->dataalign = (bytealign / info->channels - 4) / 4 * 8 + 1;
} }
info->width = bits / 8;
info->dataofs = 0;
// Skip the rest of the format chunk if required // Skip the rest of the format chunk if required
if(fmtlen > 16) if(fmtlen > 16)
{ {

View file

@ -104,7 +104,7 @@ void S_Init(qboolean full_startup)
s_musicVolume = Cvar_Get("s_musicvolume", "0.9", CVAR_ARCHIVE); s_musicVolume = Cvar_Get("s_musicvolume", "0.9", CVAR_ARCHIVE);
s_ambientVolume = Cvar_Get("s_ambientvolume", "1.00", CVAR_ARCHIVE); s_ambientVolume = Cvar_Get("s_ambientvolume", "1.00", CVAR_ARCHIVE);
s_separation = Cvar_Get("s_separation", "0.5", CVAR_ARCHIVE); s_separation = Cvar_Get("s_separation", "0.5", CVAR_ARCHIVE);
s_khz = Cvar_Get("s_khz", "44", CVAR_ARCHIVE | CVAR_SOUND_LATCH); s_khz = Cvar_Get("s_khz", "11", CVAR_ARCHIVE | CVAR_SOUND_LATCH);
s_loadas8bit = Cvar_Get("s_loadas8bit", "0", CVAR_ARCHIVE | CVAR_LATCH); s_loadas8bit = Cvar_Get("s_loadas8bit", "0", CVAR_ARCHIVE | CVAR_LATCH);
s_mixPreStep = Cvar_Get("s_mixPreStep", "0.05", CVAR_ARCHIVE); s_mixPreStep = Cvar_Get("s_mixPreStep", "0.05", CVAR_ARCHIVE);
s_show = Cvar_Get("s_show", "0", CVAR_CHEAT); s_show = Cvar_Get("s_show", "0", CVAR_CHEAT);
@ -552,7 +552,7 @@ void S_StartLocalSound(const char *sound_name, qboolean force_load)
} }
S_StartSound( S_StartSound(
NULL, 0,
s_iListenerNumber, s_iListenerNumber,
CHAN_MENU, CHAN_MENU,
sfxHandle, sfxHandle,
@ -749,10 +749,6 @@ void S_Play()
int i; int i;
char name[MAX_QPATH]; char name[MAX_QPATH];
if (Cmd_Argc() < 2) {
return;
}
for (i = 1; i < Cmd_Argc(); i++) { for (i = 1; i < Cmd_Argc(); i++) {
if (strrchr(Cmd_Argv(i), '.')) { if (strrchr(Cmd_Argv(i), '.')) {
Q_strncpyz(name, Cmd_Argv(i), sizeof(name)); Q_strncpyz(name, Cmd_Argv(i), sizeof(name));

View file

@ -62,7 +62,6 @@ typedef struct {
int dataofs; int dataofs;
int datasize; int datasize;
int dataalign;
} wavinfo_t; } wavinfo_t;
typedef struct sfx_s { typedef struct sfx_s {

View file

@ -218,7 +218,6 @@ wavinfo_t GetWavinfo(const char *name, byte *wav, int wavlength)
{ {
wavinfo_t info; wavinfo_t info;
int samples; int samples;
short bytealign;
memset(&info, 0, sizeof(wavinfo_t)); memset(&info, 0, sizeof(wavinfo_t));
@ -248,9 +247,7 @@ wavinfo_t GetWavinfo(const char *name, byte *wav, int wavlength)
if (info.format == 17) { if (info.format == 17) {
info.channels = GetLittleShort(); info.channels = GetLittleShort();
info.rate = (float)GetLittleLong(); info.rate = (float)GetLittleLong();
data_p += 4; data_p += 6;
bytealign = GetLittleShort();
info.width = (float)GetLittleShort() / 8.f; info.width = (float)GetLittleShort() / 8.f;
data_p += 2; data_p += 2;
@ -273,16 +270,12 @@ wavinfo_t GetWavinfo(const char *name, byte *wav, int wavlength)
Com_Error(ERR_DROP, "Sound %s has a bad loop length", name); Com_Error(ERR_DROP, "Sound %s has a bad loop length", name);
} }
info.dataofs = data_p - wav; info.dataofs = 0;
info.datasize = iff_chunk_len - bytealign + info.dataofs;
info.dataalign = (bytealign / info.channels - 4) / 4 * 8 + 1;
} else if (info.format == 1) { } else if (info.format == 1) {
info.channels = GetLittleShort(); info.channels = GetLittleShort();
info.rate = (float)GetLittleLong(); info.rate = (float)GetLittleLong();
data_p += 4; data_p += 6;
info.width = (float)(GetLittleShort() / 8);
bytealign = GetLittleShort();
info.width = (float)GetLittleShort() / 8.f;
FindChunk("data"); FindChunk("data");
if (!data_p) { if (!data_p) {
@ -300,15 +293,13 @@ wavinfo_t GetWavinfo(const char *name, byte *wav, int wavlength)
} }
info.dataofs = data_p - wav; info.dataofs = data_p - wav;
info.datasize = iff_chunk_len;
info.dataalign = (bytealign / info.channels - 4) / 4 * 8 + 1;
// dataalign should always be 1
assert(info.dataalign == 1);
} else { } else {
Com_Printf("Microsoft PCM format only\n"); Com_Printf("Microsoft PCM format only\n");
return info; return info;
} }
info.datasize = iff_chunk_len;
return info; return info;
} }
@ -331,12 +322,14 @@ qboolean DownSampleWav(wavinfo_t *info, byte *wav, int wavlength, int newkhz, by
newdatasize = 0; newdatasize = 0;
datap = &wav[info->dataofs]; datap = &wav[info->dataofs];
if (info->channels > 1) { if (info->channels > 1)
{
Com_DPrintf("Could not downsample WAV file. Stereo WAVs not supported!\n"); Com_DPrintf("Could not downsample WAV file. Stereo WAVs not supported!\n");
return 0; return 0;
} }
if (info->format != 1 || !info->dataofs) { if (info->format != 1 || !info->dataofs)
{
Com_DPrintf("Could not downsample WAV file. Not PCM format!\n"); Com_DPrintf("Could not downsample WAV file. Not PCM format!\n");
return 0; return 0;
} }
@ -368,14 +361,16 @@ qboolean DownSampleWav(wavinfo_t *info, byte *wav, int wavlength, int newkhz, by
iff_end = *newdata + newdatasize; iff_end = *newdata + newdatasize;
FindChunk("RIFF"); FindChunk("RIFF");
if (!data_p || strncmp((const char *)data_p + 8, "WAVE", 4u)) { if (!data_p || strncmp((const char*)data_p + 8, "WAVE", 4u))
{
Com_DPrintf("Missing RIFF/WAVE chunks\n"); Com_DPrintf("Missing RIFF/WAVE chunks\n");
return 0; return 0;
} }
iff_data = data_p + 12; iff_data = data_p + 12;
FindChunk("fmt "); FindChunk("fmt ");
if (!data_p) { if (!data_p)
{
Com_DPrintf("Missing fmt chunk\n"); Com_DPrintf("Missing fmt chunk\n");
return 0; return 0;
} }
@ -385,7 +380,8 @@ qboolean DownSampleWav(wavinfo_t *info, byte *wav, int wavlength, int newkhz, by
data_p += 8; data_p += 8;
FindChunk("data"); FindChunk("data");
if (!data_p) { if (!data_p)
{
Com_DPrintf("Missing data chunk\n"); Com_DPrintf("Missing data chunk\n");
return 0; return 0;
} }
@ -460,7 +456,8 @@ qboolean S_LoadSound(const char *fileName, sfx_t *sfx, int streamed, qboolean fo
} }
size = FS_FOpenFileRead(fileName, &file_handle, qfalse, qtrue); size = FS_FOpenFileRead(fileName, &file_handle, qfalse, qtrue);
if (size <= 0) { if (size <= 0)
{
if (file_handle) { if (file_handle) {
FS_FCloseFile(file_handle); FS_FCloseFile(file_handle);
} }
@ -473,7 +470,8 @@ qboolean S_LoadSound(const char *fileName, sfx_t *sfx, int streamed, qboolean fo
FS_FCloseFile(file_handle); FS_FCloseFile(file_handle);
sfx->info = GetWavinfo(fileName, sfx->data, size); sfx->info = GetWavinfo(fileName, sfx->data, size);
if (sfx->info.channels != 1 && !streamed) { if (sfx->info.channels != 1 && !streamed)
{
Com_Printf("%s is a stereo wav file\n", fileName); Com_Printf("%s is a stereo wav file\n", fileName);
Z_Free(sfx->data); Z_Free(sfx->data);
sfx->data = NULL; sfx->data = NULL;

View file

@ -26,6 +26,12 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
#include "../server/server.h" #include "../server/server.h"
#include "snd_codec.h" #include "snd_codec.h"
#if defined(_MSC_VER) || defined(__APPLE__)
# include <alext.h>
#else
# include <AL/alext.h>
#endif
typedef struct { typedef struct {
const char *funcname; const char *funcname;
void **funcptr; void **funcptr;
@ -72,8 +78,6 @@ static float al_current_volume = 0;
static unsigned int al_frequency = 22050; static unsigned int al_frequency = 22050;
static ALCcontext *al_context_id = NULL; static ALCcontext *al_context_id = NULL;
static ALCdevice *al_device = NULL; static ALCdevice *al_device = NULL;
static ALsizei al_default_resampler_index = 0;
static ALsizei al_resampler_index = 0;
static ALboolean (*_alutLoadMP3_LOKI)(unsigned int buffer, const byte *data, int length); static ALboolean (*_alutLoadMP3_LOKI)(unsigned int buffer, const byte *data, int length);
static void (*_alReverbScale_LOKI)(); static void (*_alReverbScale_LOKI)();
@ -96,9 +100,6 @@ int music_currentsong = 0;
static qboolean enumeration_ext = qfalse; static qboolean enumeration_ext = qfalse;
static qboolean enumeration_all_ext = qfalse; static qboolean enumeration_all_ext = qfalse;
static qboolean ima4_ext = qfalse;
static qboolean soft_block_align = qfalse;
song_t music_songs[MAX_MUSIC_SONGS]; song_t music_songs[MAX_MUSIC_SONGS];
openal_internal_t openal; openal_internal_t openal;
static float s_fFadeStartTime; static float s_fFadeStartTime;
@ -112,7 +113,7 @@ static int
S_OPENAL_SpatializeStereoSound(const vec3_t listener_origin, const vec3_t listener_left, const vec3_t origin); S_OPENAL_SpatializeStereoSound(const vec3_t listener_origin, const vec3_t listener_left, const vec3_t origin);
static void S_OPENAL_reverb(int iChannel, int iReverbType, float fReverbLevel); static void S_OPENAL_reverb(int iChannel, int iReverbType, float fReverbLevel);
static bool S_OPENAL_LoadMP3_Codec(const char *_path, sfx_t *pSfx); static bool S_OPENAL_LoadMP3_Codec(const char *_path, sfx_t *pSfx);
static ALuint S_OPENAL_Format(float width, int channels); static ALuint S_OPENAL_Format(int width, int channels);
#define alDieIfError() __alDieIfError(__FILE__, __LINE__) #define alDieIfError() __alDieIfError(__FILE__, __LINE__)
@ -128,13 +129,6 @@ static ALuint S_OPENAL_Format(float width, int channels);
# define ALDRIVER_DEFAULT "libopenal.so.1" # define ALDRIVER_DEFAULT "libopenal.so.1"
#endif #endif
//
// alext
//
#ifdef AL_SOFT_source_resampler
LPALGETSTRINGISOFT qalGetStringiSOFT;
#endif
/* /*
============== ==============
__alDieIfError __alDieIfError
@ -274,7 +268,7 @@ S_OPENAL_InitContext
static bool S_OPENAL_InitContext() static bool S_OPENAL_InitContext()
{ {
const char *dev; const char *dev;
int attrlist[12]; int attrlist[8];
Com_DPrintf("OpenAL: Context initialization\n"); Com_DPrintf("OpenAL: Context initialization\n");
@ -381,11 +375,6 @@ static bool S_OPENAL_InitContext()
#ifdef ALC_SOFT_output_mode #ifdef ALC_SOFT_output_mode
attrlist[4] = ALC_OUTPUT_MODE_SOFT; attrlist[4] = ALC_OUTPUT_MODE_SOFT;
// Disable HRTF by default
// For example, actual speakers that are recognized as headphones by the OS
// will not get forced HRTF
attrlist[6] = ALC_HRTF_SOFT;
attrlist[7] = ALC_FALSE;
switch (s_speaker_type->integer) { switch (s_speaker_type->integer) {
// Two speakers // Two speakers
@ -396,8 +385,6 @@ static bool S_OPENAL_InitContext()
// Headphones // Headphones
case 1: case 1:
attrlist[5] = ALC_STEREO_HRTF_SOFT; attrlist[5] = ALC_STEREO_HRTF_SOFT;
// Allow HRTF mixing (without forcing in case it's unsupported)
attrlist[7] = ALC_DONT_CARE_SOFT;
break; break;
// Surround // Surround
case 2: case 2:
@ -418,13 +405,8 @@ static bool S_OPENAL_InitContext()
attrlist[5] = 0; attrlist[5] = 0;
#endif #endif
#ifdef ALC_SOFT_output_limiter attrlist[6] = 0;
// Disable limiter attrlist[7] = 0;
attrlist[8] = ALC_OUTPUT_LIMITER_SOFT;
attrlist[9] = ALC_FALSE;
#endif
attrlist[10] = 0;
attrlist[11] = 0;
Com_Printf("OpenAL: Creating AL context...\n"); Com_Printf("OpenAL: Creating AL context...\n");
al_context_id = qalcCreateContext(al_device, attrlist); al_context_id = qalcCreateContext(al_device, attrlist);
@ -467,7 +449,9 @@ S_OPENAL_InitExtensions
*/ */
static bool S_OPENAL_InitExtensions() static bool S_OPENAL_InitExtensions()
{ {
/* Com_Printf("AL extensions ignored\n");
return true;
extensions_table_t extensions_table[4] = { extensions_table_t extensions_table[4] = {
"alutLoadMP3_LOKI", "alutLoadMP3_LOKI",
(void **)&_alutLoadMP3_LOKI, (void **)&_alutLoadMP3_LOKI,
@ -479,17 +463,6 @@ static bool S_OPENAL_InitExtensions()
(void **)&_alReverbDelay_LOKI, (void **)&_alReverbDelay_LOKI,
true true
}; };
*/
extensions_table_t extensions_table[] = {
#ifdef AL_SOFT_source_resampler
extensions_table_t {
"alGetStringiSOFT", (void **)&qalGetStringiSOFT,
false, },
#endif
extensions_table_t {NULL, NULL, NULL}
};
extensions_table_t *i; extensions_table_t *i;
for (i = extensions_table; i->funcname; ++i) { for (i = extensions_table; i->funcname; ++i) {
@ -512,9 +485,6 @@ static bool S_OPENAL_InitExtensions()
Com_Printf("...found.\n"); Com_Printf("...found.\n");
} }
ima4_ext = qalIsExtensionPresent("AL_EXT_IMA4");
soft_block_align = qalIsExtensionPresent("AL_SOFT_block_alignment");
qalGetError(); qalGetError();
return true; return true;
} }
@ -554,11 +524,6 @@ static bool S_OPENAL_InitChannel(int idx, openal_channel *chan)
qalSourcei(chan->source, AL_SOURCE_RELATIVE, true); qalSourcei(chan->source, AL_SOURCE_RELATIVE, true);
alDieIfError(); alDieIfError();
#ifdef AL_SOFT_source_resampler
qalSourcei(chan->source, AL_SOURCE_RESAMPLER_SOFT, al_resampler_index);
alDieIfError();
#endif
return true; return true;
} }
@ -629,34 +594,11 @@ qboolean S_OPENAL_Init()
Com_Printf("OpenAL: No reverb support. Reverb is disabled.\n"); Com_Printf("OpenAL: No reverb support. Reverb is disabled.\n");
} }
} }
s_reverb->modified = false;
al_current_volume = Square(s_volume->value); al_current_volume = Square(s_volume->value);
qalListenerf(AL_GAIN, al_current_volume); qalListenerf(AL_GAIN, al_current_volume);
alDieIfError(); alDieIfError();
#ifdef AL_SOFT_source_resampler
if (qalGetStringiSOFT) {
size_t numResamplers;
size_t i;
al_default_resampler_index = qalGetInteger(AL_DEFAULT_RESAMPLER_SOFT);
alDieIfError();
al_resampler_index = al_default_resampler_index;
numResamplers = qalGetInteger(AL_NUM_RESAMPLERS_SOFT);
alDieIfError();
for (i = 0; i < numResamplers; i++) {
const ALchar *resamplerName = qalGetStringiSOFT(AL_RESAMPLER_NAME_SOFT, i);
if (Q_stristr(resamplerName, "spline")) {
Com_Printf("OpenAL: Using %s as the resampler.\n", resamplerName);
al_resampler_index = i;
break;
}
}
}
#endif
for (i = 0; i < MAX_SOUNDSYSTEM_CHANNELS_3D; i++) { for (i = 0; i < MAX_SOUNDSYSTEM_CHANNELS_3D; i++) {
if (!S_OPENAL_InitChannel(i, &openal.chan_3D[i])) { if (!S_OPENAL_InitChannel(i, &openal.chan_3D[i])) {
return false; return false;
@ -670,9 +612,7 @@ qboolean S_OPENAL_Init()
} }
for (i = 0; i < MAX_SOUNDSYSTEM_CHANNELS_2D_STREAM; i++) { for (i = 0; i < MAX_SOUNDSYSTEM_CHANNELS_2D_STREAM; i++) {
if (!S_OPENAL_InitChannel( if (!S_OPENAL_InitChannel(i + MAX_SOUNDSYSTEM_CHANNELS_3D + MAX_SOUNDSYSTEM_CHANNELS_2D, &openal.chan_2D_stream[i])) {
i + MAX_SOUNDSYSTEM_CHANNELS_3D + MAX_SOUNDSYSTEM_CHANNELS_2D, &openal.chan_2D_stream[i]
)) {
return false; return false;
} }
} }
@ -698,17 +638,6 @@ qboolean S_OPENAL_Init()
return false; return false;
} }
//
// Disable sound virtualization on special channels
// (triggered music, ambient sounds...)
//
for (i = 0; i < MAX_SOUNDSYSTEM_SONGS; i++) {
openal.chan_song[i].set_no_virtualization();
}
openal.chan_mp3.set_no_virtualization();
openal.chan_trig_music.set_no_virtualization();
openal.chan_movie.set_no_virtualization();
Cmd_AddCommand("playmp3", S_OPENAL_PlayMP3); Cmd_AddCommand("playmp3", S_OPENAL_PlayMP3);
Cmd_AddCommand("stopmp3", S_OPENAL_StopMP3); Cmd_AddCommand("stopmp3", S_OPENAL_StopMP3);
Cmd_AddCommand("loadsoundtrack", S_loadsoundtrack); Cmd_AddCommand("loadsoundtrack", S_loadsoundtrack);
@ -760,8 +689,6 @@ void S_OPENAL_Shutdown()
s_bProvidersEmunerated = false; s_bProvidersEmunerated = false;
al_initialized = false; al_initialized = false;
QAL_Shutdown();
} }
/* /*
@ -900,8 +827,7 @@ void S_DumpInfo()
S_DumpStatus( S_DumpStatus(
"Misc", "Misc",
i, i,
openal.channel openal.channel[MAX_SOUNDSYSTEM_CHANNELS_3D + MAX_SOUNDSYSTEM_CHANNELS_2D + MAX_SOUNDSYSTEM_CHANNELS_2D_STREAM + i]
[MAX_SOUNDSYSTEM_CHANNELS_3D + MAX_SOUNDSYSTEM_CHANNELS_2D + MAX_SOUNDSYSTEM_CHANNELS_2D_STREAM + i]
); );
} }
} }
@ -1431,14 +1357,15 @@ static void S_OPENAL_Start2DSound(
pChannel->iBaseRate = pChannel->sample_playback_rate(); pChannel->iBaseRate = pChannel->sample_playback_rate();
pChannel->set_no_3d(); pChannel->set_no_3d();
fRealVolume = fRealVolume * s_fVolumeGain; fRealVolume = fRealVolume * s_fVolumeGain;
pChannel->set_gain(fRealVolume);
pChannel->play();
} else { } else {
pChannel->stop(); pChannel->stop();
pChannel->set_no_3d(); pChannel->set_no_3d();
pChannel->set_sfx(pSfx); pChannel->set_sfx(pSfx);
}
pChannel->set_gain(fRealVolume); pChannel->set_gain(fRealVolume);
pChannel->play(); pChannel->play();
}
if (s_show_sounds->integer > 0) { if (s_show_sounds->integer > 0) {
Com_DPrintf( Com_DPrintf(
@ -1891,9 +1818,7 @@ static int S_OPENAL_Start2DLoopSound(
pChannel->set_gain(fVolumeToPlay); pChannel->set_gain(fVolumeToPlay);
pChannel->start_sample(); pChannel->start_sample();
if (s_show_sounds->integer > 0) { if (s_show_sounds->integer > 0) {
Com_DPrintf( Com_DPrintf("OpenAL: %d (#%i) - %s (vol %f)\n", cl.serverTime, pLoopSound->iChannel, pLoopSound->pSfx->name, fVolume);
"OpenAL: %d (#%i) - %s (vol %f)\n", cl.serverTime, pLoopSound->iChannel, pLoopSound->pSfx->name, fVolume
);
} }
return iChannel; return iChannel;
@ -2213,9 +2138,7 @@ void S_OPENAL_AddLoopSounds(const vec3_t vTempAxis)
} }
if (s_show_sounds->integer > 0) { if (s_show_sounds->integer > 0) {
Com_DPrintf( Com_DPrintf("OpenAL: %d (#%i) - started loop - %s\n", cl.serverTime, pLoopSound->iChannel, pLoopSound->pSfx->name);
"OpenAL: %d (#%i) - started loop - %s\n", cl.serverTime, pLoopSound->iChannel, pLoopSound->pSfx->name
);
} }
if (pLoopSound->pSfx->iFlags & (SFX_FLAG_NO_OFFSET) if (pLoopSound->pSfx->iFlags & (SFX_FLAG_NO_OFFSET)
@ -2466,10 +2389,7 @@ S_OPENAL_reverb
*/ */
static void S_OPENAL_reverb(int iChannel, int iReverbType, float fReverbLevel) static void S_OPENAL_reverb(int iChannel, int iReverbType, float fReverbLevel)
{ {
// FIXME: Connect source to effect slot // No reverb.
// see https://github.com/kcat/openal-soft/blob/master/examples/alreverb.c
// No reverb currently.
} }
/* /*
@ -2484,10 +2404,6 @@ void S_OPENAL_SetReverb(int iType, float fLevel)
if (al_use_reverb) { if (al_use_reverb) {
s_bReverbChanged = true; s_bReverbChanged = true;
} }
// FIXME: generate effect and auxiliary effect slot
// or destroy them
// see https://github.com/kcat/openal-soft/blob/master/examples/alreverb.c
} }
/* /*
@ -2559,16 +2475,7 @@ void S_OPENAL_Update()
if (s_reverb->modified) { if (s_reverb->modified) {
s_reverb->modified = false; s_reverb->modified = false;
Com_Printf("FIXME: Allow reverb toggle at runtime in OpenAL code.\n");
if (s_reverb->integer) {
if (al_use_reverb) {
S_OPENAL_SetReverb(s_iReverbType, s_fReverbLevel);
} else {
Com_Printf("OpenAL: No reverb support. Reverb is disabled.\n");
}
} else if (al_use_reverb) {
S_OPENAL_SetReverb(0, 0);
}
} }
if (s_show_num_active_sounds->integer == 1) { if (s_show_num_active_sounds->integer == 1) {
@ -2976,35 +2883,6 @@ void openal_channel::play()
alDieIfError(); alDieIfError();
} }
/*
==============
openal_channel::set_no_virtualization
==============
*/
void openal_channel::set_no_virtualization()
{
#if AL_SOFT_direct_channels_remix
qalSourcei(source, AL_DIRECT_CHANNELS_SOFT, AL_REMIX_UNMATCHED_SOFT);
alDieIfError();
#elif AL_SOFT_direct_channels
qalSourcei(source, AL_DIRECT_CHANNELS_SOFT, AL_TRUE);
alDieIfError();
#endif
}
/*
==============
openal_channel::set_virtualization
==============
*/
void openal_channel::set_virtualization()
{
#if AL_SOFT_direct_channels_remix || AL_SOFT_direct_channels
qalSourcei(source, AL_DIRECT_CHANNELS_SOFT, AL_FALSE);
alDieIfError();
#endif
}
/* /*
============== ==============
openal_channel::pause openal_channel::pause
@ -3113,23 +2991,9 @@ bool openal_channel::set_sfx(sfx_t *pSfx)
return false; return false;
} }
if (pSfx->info.dataalign > 1 && !soft_block_align) {
Com_DPrintf(
"OpenAL: Alignment specified but AL doesn't support block alignment (%d).", pSfx->info.dataalign
);
return false;
}
qalGenBuffers(1, &pSfx->buffer); qalGenBuffers(1, &pSfx->buffer);
alDieIfError(); alDieIfError();
#if AL_SOFT_block_alignment
if (pSfx->info.dataalign > 1) {
qalBufferi(pSfx->buffer, AL_UNPACK_BLOCK_ALIGNMENT_SOFT, pSfx->info.dataalign);
alDieIfError();
}
#endif
qalBufferData( qalBufferData(
pSfx->buffer, pSfx->buffer,
fmt, fmt,
@ -4352,7 +4216,7 @@ int S_CurrentMoviePosition()
S_AL_Format S_AL_Format
================= =================
*/ */
static ALuint S_OPENAL_Format(float width, int channels) static ALuint S_OPENAL_Format(int width, int channels)
{ {
ALuint format = AL_FORMAT_MONO16; ALuint format = AL_FORMAT_MONO16;
@ -4369,17 +4233,6 @@ static ALuint S_OPENAL_Format(float width, int channels)
} else if (channels == 2) { } else if (channels == 2) {
format = AL_FORMAT_STEREO16; format = AL_FORMAT_STEREO16;
} }
} else if (width == 0.5) {
if (ima4_ext && soft_block_align) {
if (channels == 1) {
format = AL_FORMAT_MONO_IMA4;
} else if (channels == 2) {
format = AL_FORMAT_STEREO_IMA4;
}
} else {
// unsupported
format = 0;
}
} }
return format; return format;
@ -4507,13 +4360,6 @@ bool openal_channel_two_d_stream::set_sfx(sfx_t *pSfx)
return true; return true;
} }
#if AL_SOFT_block_alignment
if (stream->info.dataalign > 1 && soft_block_align) {
qalBufferi(buffers[currentBuf], AL_UNPACK_BLOCK_ALIGNMENT_SOFT, stream->info.dataalign);
alDieIfError();
}
#endif
qalBufferData(buffers[currentBuf], pSfx->info.format, rawData, bytesRead, stream->info.rate); qalBufferData(buffers[currentBuf], pSfx->info.format, rawData, bytesRead, stream->info.rate);
alDieIfError(); alDieIfError();
@ -4653,13 +4499,6 @@ void openal_channel_two_d_stream::update()
} }
} }
#if AL_SOFT_block_alignment
if (stream->info.dataalign > 1 && soft_block_align) {
qalBufferi(buffers[currentBuf], AL_UNPACK_BLOCK_ALIGNMENT_SOFT, stream->info.dataalign);
alDieIfError();
}
#endif
qalBufferData(buffers[currentBuf], format, rawData, bytesRead, stream->info.rate); qalBufferData(buffers[currentBuf], format, rawData, bytesRead, stream->info.rate);
alDieIfError(); alDieIfError();
@ -4688,7 +4527,7 @@ U32 openal_channel_two_d_stream::sample_offset()
ALint numProcessedBuffers = 0; ALint numProcessedBuffers = 0;
ALint numQueuedBuffers = 0; ALint numQueuedBuffers = 0;
unsigned int totalQueueLength = 0; unsigned int totalQueueLength = 0;
unsigned int bitsPerSample = 0; unsigned int bytesPerSample = 0;
unsigned int offset = 0; unsigned int offset = 0;
ALint bits = 0, channels = 0; ALint bits = 0, channels = 0;
@ -4702,7 +4541,7 @@ U32 openal_channel_two_d_stream::sample_offset()
alDieIfError(); alDieIfError();
totalQueueLength = getQueueLength(); totalQueueLength = getQueueLength();
bitsPerSample = getBitsPerSample(); bytesPerSample = getBytesPerSample();
assert(playerByteOffset < totalQueueLength); assert(playerByteOffset < totalQueueLength);
assert(streamNextOffset >= totalQueueLength || stream); assert(streamNextOffset >= totalQueueLength || stream);
@ -4730,7 +4569,7 @@ U32 openal_channel_two_d_stream::sample_offset()
offset = totalQueueLength - streamNextOffset + playerByteOffset; offset = totalQueueLength - streamNextOffset + playerByteOffset;
} }
return offset * 8 / bitsPerSample; return offset / bytesPerSample;
} }
/* /*
@ -4760,7 +4599,7 @@ void openal_channel_two_d_stream::set_sample_offset(U32 offset)
snd_stream_t *stream; snd_stream_t *stream;
unsigned int bytesToRead, bytesRead; unsigned int bytesToRead, bytesRead;
unsigned int byteOffset; unsigned int byteOffset;
unsigned int bitsPerSample; unsigned int bytesPerSample;
unsigned int streamPosition; unsigned int streamPosition;
ALuint format; ALuint format;
ALint numQueuedBuffers; ALint numQueuedBuffers;
@ -4773,8 +4612,8 @@ void openal_channel_two_d_stream::set_sample_offset(U32 offset)
stream = (snd_stream_t *)streamHandle; stream = (snd_stream_t *)streamHandle;
streamPosition = getCurrentStreamPosition(); streamPosition = getCurrentStreamPosition();
bitsPerSample = getBitsPerSample(); bytesPerSample = getBytesPerSample();
byteOffset = offset * bitsPerSample / 8; byteOffset = offset * bytesPerSample;
if (byteOffset >= streamPosition && byteOffset < streamNextOffset) { if (byteOffset >= streamPosition && byteOffset < streamNextOffset) {
// //
@ -5024,13 +4863,13 @@ unsigned int openal_channel_two_d_stream::getCurrentStreamPosition() const
/* /*
============== ==============
openal_channel_two_d_stream::getBitsPerSample openal_channel_two_d_stream::getBytesPerSample
Return the number of bytes per sample. Return the number of bytes per sample.
It assumes that all pending buffers have the same channels and bits. It assumes that all pending buffers have the same channels and bits.
============== ==============
*/ */
unsigned int openal_channel_two_d_stream::getBitsPerSample() const unsigned int openal_channel_two_d_stream::getBytesPerSample() const
{ {
unsigned int bufferId; unsigned int bufferId;
ALint bits = 0, channels = 0; ALint bits = 0, channels = 0;
@ -5041,5 +4880,5 @@ unsigned int openal_channel_two_d_stream::getBitsPerSample() const
qalGetBufferi(buffers[bufferId], AL_CHANNELS, &channels); qalGetBufferi(buffers[bufferId], AL_CHANNELS, &channels);
alDieIfError(); alDieIfError();
return bits * channels; return bits * channels / 8;
} }

View file

@ -95,8 +95,6 @@ public:
void set_no_3d(); void set_no_3d();
void set_3d(); void set_3d();
void set_no_virtualization();
void set_virtualization();
void set_gain(float gain); void set_gain(float gain);
void set_velocity(float v0, float v1, float v2); void set_velocity(float v0, float v1, float v2);
@ -167,7 +165,7 @@ private:
unsigned int getQueueLength() const; unsigned int getQueueLength() const;
unsigned int getCurrentStreamPosition() const; unsigned int getCurrentStreamPosition() const;
unsigned int getBitsPerSample() const; unsigned int getBytesPerSample() const;
}; };
struct openal_movie_channel : public openal_channel { struct openal_movie_channel : public openal_channel {

View file

@ -1,4 +1,4 @@
cmake_minimum_required(VERSION 3.12) cmake_minimum_required(VERSION 3.5)
project(fgame) project(fgame)
# Shared source files for modules # Shared source files for modules

View file

@ -71,15 +71,10 @@ void cVehicleSlot::NotSolid(void)
} }
} }
// Added in 2.0 if (!ent->IsSubclassOfPlayer()) {
// Commented in OPM
// Not sure why since 2.0, players aren't made non-solid in slots
//if (!ent->IsSubclassOfPlayer()) {
// ent->setSolidType(SOLID_NOT);
//}
ent->setSolidType(SOLID_NOT); ent->setSolidType(SOLID_NOT);
} }
}
void cVehicleSlot::Solid(void) void cVehicleSlot::Solid(void)
{ {

View file

@ -432,7 +432,7 @@ Event EV_Actor_SetAnimFinal
EV_DEFAULT, EV_DEFAULT,
NULL, NULL,
NULL, NULL,
"Whether the animation was successfully finished", "Whether the animation was succesfully finished",
EV_SETTER EV_SETTER
); );
Event EV_Actor_GetWeaponType Event EV_Actor_GetWeaponType
@ -2993,7 +2993,6 @@ Actor::Actor()
// The variable isn't set in original // The variable isn't set in original
// //
m_bSilent = false; m_bSilent = false;
m_bMumble = true;
} }
/* /*
@ -8390,7 +8389,7 @@ bool Actor::AttackEntryAnimation(void)
m_bNewEnemy = true; m_bNewEnemy = true;
return true; return true;
} }
} else if (fDistSquared > Square(1024) && (rand() % 4) == 0) { } else if (fDistSquared > Square(1024)) {
Sentient *pSquadMate; Sentient *pSquadMate;
for (pSquadMate = m_pNextSquadMate; pSquadMate != this; pSquadMate = pSquadMate->m_pNextSquadMate) { for (pSquadMate = m_pNextSquadMate; pSquadMate != this; pSquadMate = pSquadMate->m_pNextSquadMate) {
@ -8702,7 +8701,7 @@ void Actor::FaceEnemyOrMotion(int iTimeIntoMove)
{ {
vec2_t vDelta; vec2_t vDelta;
VectorSub2D(origin, m_vLastEnemyPos, vDelta); VectorCopy2D(origin, vDelta);
if (iTimeIntoMove <= 999) { if (iTimeIntoMove <= 999) {
m_bFaceEnemy = true; m_bFaceEnemy = true;

View file

@ -1,6 +1,6 @@
/* /*
=========================================================================== ===========================================================================
Copyright (C) 2025 the OpenMoHAA team Copyright (C) 2024 the OpenMoHAA team
This file is part of OpenMoHAA source code. This file is part of OpenMoHAA source code.
@ -167,29 +167,23 @@ public:
template<class Type> template<class Type>
inline void Container<Type>::Archive(Archiver& arc, void (*ArchiveFunc)(Archiver& arc, Type *obj)) inline void Container<Type>::Archive(Archiver& arc, void (*ArchiveFunc)(Archiver& arc, Type *obj))
{ {
Type *obj;
int num; int num;
int i; int i;
if (arc.Loading()) { if (arc.Loading()) {
arc.ArchiveInteger(&num); arc.ArchiveInteger(&num);
Resize(num); Resize(num);
} else {
num = numobjects;
arc.ArchiveInteger(&num);
}
for (i = 1; i <= num; i++) {
if (num > numobjects) { if (num > numobjects) {
numobjects = num; numobjects = num;
} }
for (i = 0; i < num; i++) { ArchiveFunc(arc, &objlist[i - 1]);
obj = new (objlist + i) Type();
ArchiveFunc(arc, obj);
}
} else {
num = numobjects;
arc.ArchiveInteger(&num);
for (i = 0; i < num; i++) {
ArchiveFunc(arc, &objlist[i]);
}
} }
} }
@ -293,7 +287,7 @@ void con_set<key, value>::Archive(Archiver& arc)
if (arc.Loading()) { if (arc.Loading()) {
if (tableLength != 1) { if (tableLength != 1) {
table = new (NewTable(tableLength)) Entry *[tableLength](); table = new Entry *[tableLength]();
memset(table, 0, tableLength * sizeof(Entry *)); memset(table, 0, tableLength * sizeof(Entry *));
} }

View file

@ -717,16 +717,6 @@ static void PM_NoclipMove(void)
// move // move
VectorMA(pm->ps->origin, pml.frametime, pm->ps->velocity, pm->ps->origin); VectorMA(pm->ps->origin, pml.frametime, pm->ps->velocity, pm->ps->origin);
// Added in 2.0
// If the player is out of bounds in noclip mode,
// teleport it back to the (0,0,0) coordinates
for (i = 0; i < 3; i++) {
if (fabs(pm->ps->origin[i]) >= MAX_MAP_BOUNDS - 512) {
VectorClear(pm->ps->origin);
break;
}
}
} }
//============================================================================ //============================================================================

View file

@ -652,7 +652,7 @@ movement on the server game.
#define MASK_CAMERASOLID (CONTENTS_SOLID | CONTENTS_PLAYERCLIP | CONTENTS_BODY | MASK_WATER) #define MASK_CAMERASOLID (CONTENTS_SOLID | CONTENTS_PLAYERCLIP | CONTENTS_BODY | MASK_WATER)
#define MASK_BEAM (CONTENTS_SOLID | CONTENTS_TRIGGER | CONTENTS_PLAYERCLIP | CONTENTS_BODY | CONTENTS_FENCE) #define MASK_BEAM (CONTENTS_SOLID | CONTENTS_TRIGGER | CONTENTS_PLAYERCLIP | CONTENTS_BODY | CONTENTS_FENCE)
#define MASK_LADDER \ #define MASK_LADDER \
(CONTENTS_SOLID | CONTENTS_LADDER | CONTENTS_TRIGGER | CONTENTS_PLAYERCLIP | CONTENTS_BODY | CONTENTS_FENCE | CONTENTS_UNKNOWN2 | CONTENTS_NOBOTCLIP | CONTENTS_BBOX) (CONTENTS_SOLID | CONTENTS_LADDER | CONTENTS_TRIGGER | CONTENTS_PLAYERCLIP | CONTENTS_BODY | CONTENTS_FENCE)
#define MASK_AUTOCALCLIFE (CONTENTS_SOLID | CONTENTS_TRIGGER | CONTENTS_FENCE) #define MASK_AUTOCALCLIFE (CONTENTS_SOLID | CONTENTS_TRIGGER | CONTENTS_FENCE)
#define MASK_EXPLOSION (CONTENTS_SOLID | CONTENTS_TRIGGER | CONTENTS_WEAPONCLIP) #define MASK_EXPLOSION (CONTENTS_SOLID | CONTENTS_TRIGGER | CONTENTS_WEAPONCLIP)
#define MASK_SOUND (CONTENTS_SOLID | CONTENTS_TRANSLUCENT) #define MASK_SOUND (CONTENTS_SOLID | CONTENTS_TRANSLUCENT)
@ -770,8 +770,8 @@ movement on the server game.
CGM_HUDDRAW_ALPHA, CGM_HUDDRAW_ALPHA,
CGM_HUDDRAW_STRING, CGM_HUDDRAW_STRING,
CGM_HUDDRAW_FONT, CGM_HUDDRAW_FONT,
CGM_NOTIFY_HIT,
CGM_NOTIFY_KILL, CGM_NOTIFY_KILL,
CGM_NOTIFY_HIT,
CGM_VOICE_CHAT, CGM_VOICE_CHAT,
CGM_FENCEPOST, CGM_FENCEPOST,
}; };
@ -812,8 +812,8 @@ movement on the server game.
CGM6_HUDDRAW_ALPHA, CGM6_HUDDRAW_ALPHA,
CGM6_HUDDRAW_STRING, CGM6_HUDDRAW_STRING,
CGM6_HUDDRAW_FONT, CGM6_HUDDRAW_FONT,
CGM6_NOTIFY_HIT,
CGM6_NOTIFY_KILL, CGM6_NOTIFY_KILL,
CGM6_NOTIFY_HIT,
CGM6_VOICE_CHAT, CGM6_VOICE_CHAT,
}; };

View file

@ -77,7 +77,7 @@ Conditional::Conditional()
Expression::Expression() {} Expression::Expression() {}
Expression::Expression(const Expression& exp) Expression::Expression(Expression& exp)
{ {
int i; int i;

View file

@ -184,7 +184,7 @@ private:
public: public:
Expression(); Expression();
Expression(const Expression& exp); Expression(Expression& exp);
Expression(Script& script, State& state); Expression(Script& script, State& state);
void operator=(const Expression& exp); void operator=(const Expression& exp);

View file

@ -42,8 +42,8 @@ typedef struct spawnsort_s {
static qboolean SpotWouldTelefrag(float *origin) static qboolean SpotWouldTelefrag(float *origin)
{ {
static Vector mins = Vector(-15, -15, 1); static Vector mins = Vector(-16, -16, 1);
static Vector maxs = Vector(15, 15, 96); static Vector maxs = Vector(16, 16, 97);
trace_t trace; trace_t trace;
trace = G_Trace(Vector(origin), mins, maxs, Vector(origin), NULL, MASK_PLAYERSTART, qfalse, "SpotWouldTelefrag"); trace = G_Trace(Vector(origin), mins, maxs, Vector(origin), NULL, MASK_PLAYERSTART, qfalse, "SpotWouldTelefrag");
@ -58,12 +58,15 @@ static qboolean SpotWouldTelefrag(float *origin)
static int compare_spawnsort(const void *pe1, const void *pe2) static int compare_spawnsort(const void *pe1, const void *pe2)
{ {
float fDelta = ((spawnsort_t *)pe1)->fMetric - ((spawnsort_t *)pe2)->fMetric; float fDelta = ((spawnsort_t *)pe1)->fMetric - ((spawnsort_t *)pe2)->fMetric;
if (fDelta < -0.001) {
return 1; if (fDelta >= -0.001f) {
} else if (fDelta > 0.001) { if (fDelta <= 0.001f) {
return -1;
} else {
return 0; return 0;
} else {
return -1;
}
} else {
return 1;
} }
} }
@ -80,11 +83,7 @@ static PlayerStart *GetRandomSpawnpointFromList(spawnsort_t *pSpots, int nSpots)
qsort(pSpots, nSpots, sizeof(spawnsort_t), compare_spawnsort); qsort(pSpots, nSpots, sizeof(spawnsort_t), compare_spawnsort);
if (pSpots[0].fMetric <= 0) { if (pSpots[0].fMetric > 0.0f) {
// return the spot anyway
return pSpots[0].spawnpoint;
}
if (nSpots > 5) { if (nSpots > 5) {
nSpots = 5; nSpots = 5;
} }
@ -92,7 +91,9 @@ static PlayerStart *GetRandomSpawnpointFromList(spawnsort_t *pSpots, int nSpots)
fMinPosMetric = pSpots[0].fMetric * nSpots; fMinPosMetric = pSpots[0].fMetric * nSpots;
fTotalMetric = fMinPosMetric; fTotalMetric = fMinPosMetric;
if (nSpots > 1) { if (nSpots <= 1) {
fChosen = fMinPosMetric;
} else {
i = 0; i = 0;
fTotalMetric = 0.0f; fTotalMetric = 0.0f;
@ -112,29 +113,31 @@ static PlayerStart *GetRandomSpawnpointFromList(spawnsort_t *pSpots, int nSpots)
} }
fMinPosMetric = fTotalMetric; fMinPosMetric = fTotalMetric;
} else {
fChosen = fMinPosMetric;
} }
fTotalMetric = (fMinPosMetric - i * fChosen * 0.9) * G_Random(); fTotalMetric = (fMinPosMetric - i * fChosen * 0.90f) * G_Random();
for (i = 0; i < nSpots - 1; i++) { for (i = 0; i < nSpots - 1; i++) {
fTotalMetric -= (nSpots - i) * pSpots[i].fMetric - (fChosen * 0.9); fTotalMetric -= (nSpots - i) * pSpots[i].fMetric - (fChosen * 0.90f);
if (fTotalMetric <= 0) { if (fTotalMetric <= 0.0f) {
break; break;
} }
} }
return pSpots[i].spawnpoint; return pSpots[i].spawnpoint;
} else {
// return the spot anyway
return pSpots[0].spawnpoint;
}
} }
float SpawnpointMetric_Ffa(const vec3_t origin, DM_Team *dmTeam, const Player *player) float SpawnpointMetric_Ffa(const float *origin, DM_Team *dmTeam, const Player *player)
{ {
float fMinEnemyDistSquared = Square(23170.f); float fMinEnemyDistSquared = 23170.0f * 23170.0f;
int i; int i;
int nPlayers = dmManager.PlayerCount(); int nPlayers = dmManager.PlayerCount();
float fDist; float fDist;
for (i = 1; i <= nPlayers; i++) { for (i = 1; i < nPlayers; i++) {
Player *teammate = dmManager.GetPlayer(i); Player *teammate = dmManager.GetPlayer(i);
if (teammate == player || teammate->IsDead() || teammate->IsSpectator()) { if (teammate == player || teammate->IsDead() || teammate->IsSpectator()) {
continue; continue;
@ -147,12 +150,12 @@ float SpawnpointMetric_Ffa(const vec3_t origin, DM_Team *dmTeam, const Player *p
} }
} }
return fMinEnemyDistSquared - Square(1024) * (G_Random(0.25) + 1.0); return fMinEnemyDistSquared - (G_Random(0.25f) + 1.0f) * (1024.0f * 1024.0f);
} }
float SpawnpointMetric_Team(const vec3_t origin, DM_Team *dmTeam, const Player *player) float SpawnpointMetric_Team(const float *origin, DM_Team *dmTeam, const Player *player)
{ {
float fMinEnemyDistSquared = Square(23170.f); float fMinEnemyDistSquared = 23170.0f * 23170.0f;
float fSumFriendDistSquared = 0.0f; float fSumFriendDistSquared = 0.0f;
float fDistSquared; float fDistSquared;
float fMetric; float fMetric;
@ -160,7 +163,7 @@ float SpawnpointMetric_Team(const vec3_t origin, DM_Team *dmTeam, const Player *
int nPlayers = dmManager.PlayerCount(); int nPlayers = dmManager.PlayerCount();
int nFriends = 0; int nFriends = 0;
for (i = 1; i <= nPlayers; i++) { for (i = 1; i < nPlayers; i++) {
Player *teammate = dmManager.GetPlayer(i); Player *teammate = dmManager.GetPlayer(i);
if (teammate == player || teammate->IsDead() || teammate->IsSpectator()) { if (teammate == player || teammate->IsDead() || teammate->IsSpectator()) {
continue; continue;
@ -171,23 +174,25 @@ float SpawnpointMetric_Team(const vec3_t origin, DM_Team *dmTeam, const Player *
if (teammate->GetDM_Team() == dmTeam) { if (teammate->GetDM_Team() == dmTeam) {
nFriends++; nFriends++;
fSumFriendDistSquared += fDistSquared; fSumFriendDistSquared += fDistSquared;
} else if (fMinEnemyDistSquared > fDistSquared) { } else {
if (fMinEnemyDistSquared > fDistSquared) {
fMinEnemyDistSquared = fDistSquared; fMinEnemyDistSquared = fDistSquared;
} }
} }
}
fMetric = fMinEnemyDistSquared - Square(1024) * (G_Random(0.25) + 1.0); fMetric = fMinEnemyDistSquared - (G_Random(0.25f) + 1.0f) * (1024.0f * 1024.0f);
if (nFriends) { if (nFriends) {
fMetric += Square(23170) * 0.25 - fSumFriendDistSquared / nFriends; fMetric += 0.25f * ((23170.0f * 23170.0f) - fSumFriendDistSquared / nFriends);
} }
return fMetric; return fMetric;
} }
float SpawnpointMetric_Objective(const vec3_t origin, DM_Team *dmTeam, const Player *player) float SpawnpointMetric_Objective(const float *origin, DM_Team *dmTeam, const Player *player)
{ {
return rand() / (float)RAND_MAX; return rand() * 0.0000000005f;
} }
CLASS_DECLARATION(Listener, DM_Team, NULL) { CLASS_DECLARATION(Listener, DM_Team, NULL) {
@ -454,12 +459,12 @@ PlayerStart *DM_Team::GetRandomSpawnpointWithMetric(
vNewSpawn, player->mins, player->maxs, vEnd, player, MASK_PLAYERSOLID, qfalse, "TempSpawnPoint" vNewSpawn, player->mins, player->maxs, vEnd, player, MASK_PLAYERSOLID, qfalse, "TempSpawnPoint"
); );
if (!trace.allsolid && !trace.startsolid && trace.fraction != 1.0f && trace.plane.dist >= 0.8f) { if (!trace.allsolid && !trace.startsolid && trace.fraction != 1.0f && trace.fraction != 1.0f
&& trace.plane.dist >= 0.8f) {
points[numSpots].spawnpoint = new PlayerStart; points[numSpots].spawnpoint = new PlayerStart;
points[numSpots].spawnpoint->setOrigin(trace.endpos); points[numSpots].spawnpoint->setOrigin(trace.endpos);
points[numSpots].spawnpoint->setAngles(spot->angles); points[numSpots].spawnpoint->setAngles(spot->angles);
points[numSpots].fMetric = MetricFunction(vNewSpawn, this, player); points[numSpots].fMetric = MetricFunction(vNewSpawn, this, player);
numSpots++;
if (numSpots >= (sizeof(points) / sizeof(points[0]))) { if (numSpots >= (sizeof(points) / sizeof(points[0]))) {
break; break;
@ -472,8 +477,8 @@ PlayerStart *DM_Team::GetRandomSpawnpointWithMetric(
spot = GetRandomSpawnpointFromList(points, numSpots); spot = GetRandomSpawnpointFromList(points, numSpots);
for (int i = 0; i < numSpots; i++) { for (int i = 0; i < numSpots; i++) {
// delete all created spawnpoint // delete all created spawnpoint
if (points[i].spawnpoint != spot) { if (points[numSpots].spawnpoint != spot) {
delete points[i].spawnpoint; delete points[numSpots].spawnpoint;
} }
} }
@ -492,7 +497,6 @@ PlayerStart *DM_Team::GetRandomSpawnpointWithMetric(
if (!SpotWouldTelefrag(spot->origin)) { if (!SpotWouldTelefrag(spot->origin)) {
points[numSpots].spawnpoint = spot; points[numSpots].spawnpoint = spot;
points[numSpots].fMetric = MetricFunction(spot->origin, this, player); points[numSpots].fMetric = MetricFunction(spot->origin, this, player);
numSpots++;
if (numSpots >= (sizeof(points) / sizeof(points[0]))) { if (numSpots >= (sizeof(points) / sizeof(points[0]))) {
break; break;
@ -673,7 +677,6 @@ DM_Manager::DM_Manager()
m_bAllowAxisRespawn = true; m_bAllowAxisRespawn = true;
m_bAllowAlliedRespawn = true; m_bAllowAlliedRespawn = true;
m_bRoundActive = false; m_bRoundActive = false;
m_iTotalMapTime = 0;
} }
DM_Manager::~DM_Manager() {} DM_Manager::~DM_Manager() {}
@ -1242,7 +1245,7 @@ bool DM_Manager::CheckEndMatch()
if (AllowRespawn() || (!m_team_axis.IsDead() && !m_team_allies.IsDead())) { if (AllowRespawn() || (!m_team_axis.IsDead() && !m_team_allies.IsDead())) {
int roundLimit = GetRoundLimit(); int roundLimit = GetRoundLimit();
if (roundLimit > 0 && level.time >= roundLimit * 60 + m_fRoundTime) { if (roundLimit > 0 && level.time >= m_iDefaultRoundLimit * 60 + m_fRoundTime) {
if (m_csTeamBombPlantSide != STRING_DRAW) { if (m_csTeamBombPlantSide != STRING_DRAW) {
if (m_bIgnoringClockForBomb) { if (m_bIgnoringClockForBomb) {
if (m_iNumBombsPlanted > 0) { if (m_iNumBombsPlanted > 0) {
@ -1251,7 +1254,7 @@ bool DM_Manager::CheckEndMatch()
m_bIgnoringClockForBomb = false; m_bIgnoringClockForBomb = false;
} else if (m_iNumBombsPlanted > 0) { } else if (m_iNumBombsPlanted > 0) {
G_PrintToAllClients(va("%s\n", gi.LV_ConvertString("A Bomb is Still Set!"))); G_PrintToAllClients("A bomb is still set!");
m_bIgnoringClockForBomb = true; m_bIgnoringClockForBomb = true;
return false; return false;
} }
@ -1325,7 +1328,7 @@ bool DM_Manager::CheckEndMatch()
return true; return true;
} else if (m_iNumBombsPlanted >= m_iNumTargetsToDestroy - m_iNumTargetsDestroyed) { } else if (m_iNumBombsPlanted >= m_iNumTargetsToDestroy - m_iNumTargetsDestroyed) {
if (!m_bIgnoringClockForBomb) { if (!m_bIgnoringClockForBomb) {
G_PrintToAllClients(va("%s\n", gi.LV_ConvertString("A Bomb is Still Set!"))); G_PrintToAllClients("A bomb is still set!");
m_bIgnoringClockForBomb = true; m_bIgnoringClockForBomb = true;
} }
} else { } else {
@ -1409,26 +1412,26 @@ void DM_Manager::EventDoRoundTransition(Event *ev)
} }
if (m_iTeamWin == TEAM_AXIS) { if (m_iTeamWin == TEAM_AXIS) {
G_CenterPrintToAllClients(va("\n\n\n%s\n", gi.LV_ConvertString("Axis win!"))); G_CenterPrintToAllClients(va("\n\n\n%s\n", gi.LV_ConvertString("Axis win!\n")));
G_PrintToAllClients(va("%s\n", gi.LV_ConvertString("Axis win!"))); G_PrintToAllClients(va("%s\n", gi.LV_ConvertString("Axis win!\n")));
// Play the axis victory sound // Play the axis victory sound
world->Sound("den_victory_v"); world->Sound("den_victory_v");
level.Unregister(STRING_AXISWIN); Unregister(STRING_AXISWIN);
} else if (m_iTeamWin == TEAM_ALLIES) { } else if (m_iTeamWin == TEAM_ALLIES) {
G_CenterPrintToAllClients(va("\n\n\n%s\n", gi.LV_ConvertString("Allies win!"))); G_CenterPrintToAllClients(va("\n\n\n%s\n", gi.LV_ConvertString("Allies win!\n")));
G_PrintToAllClients(va("%s\n", gi.LV_ConvertString("Allies win!"))); G_PrintToAllClients(va("%s\n", gi.LV_ConvertString("Allies win!\n")));
// Play the allies victory sound // Play the allies victory sound
world->Sound("dfr_victory_v"); world->Sound("dfr_victory_v");
level.Unregister(STRING_ALLIESWIN); Unregister(STRING_ALLIESWIN);
} else { } else {
G_CenterPrintToAllClients(va("\n\n\n%s\n", gi.LV_ConvertString("It's a draw!"))); G_CenterPrintToAllClients(va("\n\n\n%s\n", gi.LV_ConvertString("It's a draw!\n")));
G_PrintToAllClients(va("%s\n", gi.LV_ConvertString("It's a draw!"))); G_PrintToAllClients(va("%s\n", gi.LV_ConvertString("It's a draw!\n")));
level.Unregister(STRING_DRAW); Unregister(STRING_DRAW);
} }
G_DisplayScoresToAllClients(); G_DisplayScoresToAllClients();
@ -1843,7 +1846,7 @@ void DM_Manager::BuildTeamInfo_ver6(DM_Team *dmTeam)
for (int i = iNumPlayers; i > 0; i--) { for (int i = iNumPlayers; i > 0; i--) {
pTeamPlayer = dmTeam->m_players.ObjectAt(i); pTeamPlayer = dmTeam->m_players.ObjectAt(i);
if (pTeamPlayer->edict->r.svFlags & SVF_BOT) { if (pTeamPlayer->IsSubclassOfBot()) {
continue; continue;
} }
@ -1888,7 +1891,7 @@ void DM_Manager::BuildTeamInfo_ver15(DM_Team *dmTeam)
for (int i = iNumPlayers; i > 0; i--) { for (int i = iNumPlayers; i > 0; i--) {
pTeamPlayer = dmTeam->m_players.ObjectAt(i); pTeamPlayer = dmTeam->m_players.ObjectAt(i);
if (pTeamPlayer->edict->r.svFlags & SVF_BOT) { if (pTeamPlayer->IsSubclassOfBot()) {
continue; continue;
} }
@ -1900,11 +1903,11 @@ void DM_Manager::BuildTeamInfo_ver15(DM_Team *dmTeam)
iPing /= iNumPlayers; iPing /= iNumPlayers;
} }
if (g_gametype->integer == GT_TEAM_ROUNDS || g_gametype->integer == GT_OBJECTIVE || g_gametype->integer == GT_TOW) { if (g_gametype->integer >= GT_TEAM_ROUNDS) {
iKills = dmTeam->m_teamwins; iKills = dmTeam->m_wins_in_a_row;
iDeaths = dmTeam->m_wins_in_a_row; iDeaths = dmTeam->m_teamwins;
} else { } else {
iKills = dmTeam->m_teamwins; iKills = dmTeam->m_iKills;
iDeaths = dmTeam->m_iDeaths; iDeaths = dmTeam->m_iDeaths;
} }
@ -1962,7 +1965,7 @@ void DM_Manager::BuildPlayerTeamInfo(DM_Team *dmTeam, int *iPlayerList, DM_Team
pTeamPlayer->GetNumKills(), pTeamPlayer->GetNumKills(),
pTeamPlayer->GetNumDeaths(), pTeamPlayer->GetNumDeaths(),
G_TimeString(level.svsFloatTime - pTeamPlayer->edict->client->pers.enterTime), G_TimeString(level.svsFloatTime - pTeamPlayer->edict->client->pers.enterTime),
(pTeamPlayer->edict->r.svFlags & SVF_BOT) ? "bot" : va("%d", pTeamPlayer->client->ps.ping) pTeamPlayer->IsSubclassOfBot() ? "bot" : va("%d", pTeamPlayer->client->ps.ping)
); );
} else { } else {
Com_sprintf( Com_sprintf(
@ -1973,7 +1976,7 @@ void DM_Manager::BuildPlayerTeamInfo(DM_Team *dmTeam, int *iPlayerList, DM_Team
pTeamPlayer->GetNumKills(), pTeamPlayer->GetNumKills(),
pTeamPlayer->GetNumDeaths(), pTeamPlayer->GetNumDeaths(),
G_TimeString(level.svsFloatTime - pTeamPlayer->edict->client->pers.enterTime), G_TimeString(level.svsFloatTime - pTeamPlayer->edict->client->pers.enterTime),
(pTeamPlayer->edict->r.svFlags & SVF_BOT) ? "bot" : va("%d", pTeamPlayer->client->ps.ping) pTeamPlayer->IsSubclassOfBot() ? "bot" : va("%d", pTeamPlayer->client->ps.ping)
); );
} }

View file

@ -847,20 +847,7 @@ void Door::DoorBlocked(Event *ev)
if (state == STATE_OPENING || state == STATE_OPEN) { if (state == STATE_OPENING || state == STATE_OPEN) {
spawnflags &= ~DOOR_START_OPEN; spawnflags &= ~DOOR_START_OPEN;
const bool bIsMoving = EventPending(EV_MoveDone);
ProcessEvent(EV_Door_Close); ProcessEvent(EV_Door_Close);
if (bIsMoving) {
// Added in OPM
// Reopen to the other side so sentients can still pass.
// This avoid entities like players trying to prevent the door
// from opening in multiplayer
diropened = -diropened;
e = new Event(EV_Door_Open);
e->AddEntity(other);
ProcessEvent(e);
}
} else { } else {
e = new Event(EV_Door_Open); e = new Event(EV_Door_Open);
e->AddEntity(other); e->AddEntity(other);

View file

@ -1217,8 +1217,6 @@ Event EV_CanSee
"returns 1 if the entities can see eachother, 0 if not", "returns 1 if the entities can see eachother, 0 if not",
EV_RETURN EV_RETURN
); );
// Added in 2.0
Event EV_CanSeeNoEnts Event EV_CanSeeNoEnts
( (
"canseenoents", "canseenoents",
@ -1228,7 +1226,6 @@ Event EV_CanSeeNoEnts
"returns 1 if the entities can see eachother, 0 if not; ignores any entities between them", "returns 1 if the entities can see eachother, 0 if not; ignores any entities between them",
EV_RETURN EV_RETURN
); );
Event EV_Entity_InPVS Event EV_Entity_InPVS
( (
"inpvs", "inpvs",
@ -1631,7 +1628,6 @@ CLASS_DECLARATION(SimpleEntity, Entity, NULL) {
{&EV_IsTouching, &Entity::IsTouching }, {&EV_IsTouching, &Entity::IsTouching },
{&EV_IsInside, &Entity::IsInside }, {&EV_IsInside, &Entity::IsInside },
{&EV_CanSee, &Entity::CanSee }, {&EV_CanSee, &Entity::CanSee },
{&EV_CanSeeNoEnts, &Entity::CanSeeNoEnts }, // Added in 2.0
{&EV_Entity_InPVS, &Entity::EventInPVS }, {&EV_Entity_InPVS, &Entity::EventInPVS },
{&EV_SetShaderData, &Entity::SetShaderData }, {&EV_SetShaderData, &Entity::SetShaderData },
{&EV_GetVelocity, &Entity::GetVelocity }, {&EV_GetVelocity, &Entity::GetVelocity },
@ -2673,7 +2669,7 @@ void Entity::DamageEvent(Event *ev)
Vector momentum; Vector momentum;
Vector position, direction, normal; Vector position, direction, normal;
int knockback, damageflags, meansofdeath, location; int knockback, damageflags, meansofdeath, location;
Event event; Event *event;
float m; float m;
EntityPtr This; EntityPtr This;
@ -2759,79 +2755,67 @@ void Entity::DamageEvent(Event *ev)
if (health <= 0) { if (health <= 0) {
if (attacker) { if (attacker) {
const EntityPtr attackerPtr = attacker; event = new Event(EV_GotKill);
event->AddEntity(this);
event->AddInteger(damage);
event->AddEntity(inflictor);
event->AddInteger(meansofdeath);
event->AddInteger(0);
event = Event(EV_GotKill, 5); attacker->ProcessEvent(event);
event.AddEntity(this);
event.AddInteger(damage);
event.AddEntity(inflictor);
event.AddInteger(meansofdeath);
event.AddInteger(0);
attackerPtr->ProcessEvent(event);
if (attackerPtr) {
attackerPtr->delegate_gotKill.Execute(event);
}
} }
if (!This) { if (!This) {
return; return;
} }
event = Event(EV_Killed, 10); event = new Event(EV_Killed);
event.AddEntity(attacker); event->AddEntity(attacker);
event.AddFloat(damage); event->AddFloat(damage);
event.AddEntity(inflictor); event->AddEntity(inflictor);
event.AddVector(position); event->AddVector(position);
event.AddVector(direction); event->AddVector(direction);
event.AddVector(normal); event->AddVector(normal);
event.AddInteger(knockback); event->AddInteger(knockback);
event.AddInteger(damageflags); event->AddInteger(damageflags);
event.AddInteger(meansofdeath); event->AddInteger(meansofdeath);
event.AddInteger(location); event->AddInteger(location);
ProcessEvent(event); ProcessEvent(event);
if (!This) { if (!This) {
return; return;
} }
// Notify scripts // Notify scripts
Unregister(STRING_DAMAGE); Unregister(STRING_DAMAGE);
if (!This) {
return; return;
} }
delegate_killed.Execute(event); event = new Event(EV_Pain);
return; event->AddEntity(attacker);
} event->AddFloat(damage);
event->AddEntity(inflictor);
event = Event(EV_Pain, 10); event->AddVector(position);
event.AddEntity(attacker); event->AddVector(direction);
event.AddFloat(damage); event->AddVector(normal);
event.AddEntity(inflictor); event->AddInteger(knockback);
event.AddVector(position); event->AddInteger(damageflags);
event.AddVector(direction); event->AddInteger(meansofdeath);
event.AddVector(normal); event->AddInteger(location);
event.AddInteger(knockback);
event.AddInteger(damageflags);
event.AddInteger(meansofdeath);
event.AddInteger(location);
ProcessEvent(event); ProcessEvent(event);
if (!This) { if (!This) {
return; return;
} }
// Notify scripts // Notify scripts
Unregister(STRING_DAMAGE); Unregister(STRING_DAMAGE);
if (!This) {
return;
}
delegate_damage.Execute(event);
} }
qboolean Entity::IsTouching(Entity *e1) qboolean Entity::IsTouching(Entity *e1)
{ {
if (e1->absmin.x > absmax.x) { if (e1->absmin.x > absmax.x) {
return false; return false;
@ -3012,6 +2996,7 @@ void Entity::FadeIn(Event *ev)
if (ev->NumArgs() > 0) { if (ev->NumArgs() > 0) {
rate = ev->GetFloat(1); rate = ev->GetFloat(1);
assert(rate);
if (rate > 0) { if (rate > 0) {
rate = FRAMETIME / rate; rate = FRAMETIME / rate;
} }
@ -3047,6 +3032,7 @@ void Entity::Fade(Event *ev)
if (ev->NumArgs() > 0) { if (ev->NumArgs() > 0) {
rate = ev->GetFloat(1); rate = ev->GetFloat(1);
assert(rate);
if (rate > 0) { if (rate > 0) {
rate = FRAMETIME / rate; rate = FRAMETIME / rate;
} }
@ -3625,12 +3611,13 @@ void Entity::Sound(
} }
if (!name) { if (!name) {
name = gi.GlobalAlias_FindRandom(sound_name.c_str(), &ret); name = sound_name.c_str();
} }
// Play the sound // Play the sound
if (name && ret) { if (name != NULL) {
if (ret) {
aliaschannel = ret->channel; aliaschannel = ret->channel;
aliasvolume = G_Random() * ret->volumeMod + ret->volume; aliasvolume = G_Random() * ret->volumeMod + ret->volume;
aliaspitch = G_Random() * ret->pitchMod + ret->pitch; aliaspitch = G_Random() * ret->pitchMod + ret->pitch;
@ -3705,10 +3692,10 @@ void Entity::Sound(
break; break;
} }
if (g_gametype->integer == GT_SINGLE_PLAYER && (ret->forcesubtitle || !checkSubtitle || g_subtitle->integer) && ret->subtitle) { if ((!checkSubtitle || g_subtitle->integer) && ret->subtitle) {
Entity *p = G_GetEntity(0); Entity *p = G_GetEntity(0);
if (p && (g_subtitle->integer == 2 || Square(max_dist) > DistanceSquared(org, p->edict->s.origin))) { if (g_subtitle->integer == 2 || Square(max_dist) > DistanceSquared(org, p->edict->s.origin)) {
cvar_t *curSubtitle = gi.Cvar_Get("curSubtitle", "0", 0); cvar_t *curSubtitle = gi.Cvar_Get("curSubtitle", "0", 0);
int curSub; int curSub;
@ -3723,6 +3710,7 @@ void Entity::Sound(
} }
gi.Sound(&org, num, channel, name, volume, min_dist, pitch, max_dist, ret->streamed); gi.Sound(&org, num, channel, name, volume, min_dist, pitch, max_dist, ret->streamed);
}
} else { } else {
gi.DPrintf( gi.DPrintf(
"ERROR: Entity::Sound: %s needs an alias in ubersound.scr or uberdialog.scr - Please fix.\n", "ERROR: Entity::Sound: %s needs an alias in ubersound.scr or uberdialog.scr - Please fix.\n",
@ -5733,14 +5721,6 @@ void Entity::Delete(void)
// Delete the entity the next frame // Delete the entity the next frame
if (g_iInThinks) { if (g_iInThinks) {
if (ProcessingEvents) {
// Fixed in OPM
// Add a slight delay because otherwise this would cause an infinite loop
// when processing pending events
PostEvent(EV_Remove, 0.001);
return;
}
PostEvent(EV_Remove, 0); PostEvent(EV_Remove, 0);
} else { } else {
delete this; delete this;

View file

@ -51,7 +51,6 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
#include "script.h" #include "script.h"
#include "listener.h" #include "listener.h"
#include "simpleentity.h" #include "simpleentity.h"
#include "../qcommon/delegate.h"
// modification flags // modification flags
#define FLAG_IGNORE 0 #define FLAG_IGNORE 0
@ -297,12 +296,6 @@ public:
//==== //====
#endif #endif
MulticastDelegate<void (const Event& ev)> delegate_damage;
MulticastDelegate<void (const Event& ev)> delegate_killed;
MulticastDelegate<void (const Event& ev)> delegate_gotKill;
public:
Entity(); Entity();
virtual ~Entity(); virtual ~Entity();

View file

@ -1,6 +1,6 @@
/* /*
=========================================================================== ===========================================================================
Copyright (C) 2025 the OpenMoHAA team Copyright (C) 2024 the OpenMoHAA team
This file is part of OpenMoHAA source code. This file is part of OpenMoHAA source code.
@ -28,6 +28,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
static saved_bot_t *saved_bots = NULL; static saved_bot_t *saved_bots = NULL;
static unsigned int num_saved_bots = 0; static unsigned int num_saved_bots = 0;
static unsigned int current_bot_count = 0;
static unsigned int botId = 0; static unsigned int botId = 0;
Container<str> alliedModelList; Container<str> alliedModelList;
@ -42,7 +43,7 @@ Return whether or not the specified filename is for allies
*/ */
bool IsAlliedPlayerModel(const char *filename) bool IsAlliedPlayerModel(const char *filename)
{ {
return !Q_stricmpn(filename, "allied_", 7) || !Q_stricmpn(filename, "american_", 9); return !Q_stricmpn(filename, "/allied_", 8) || !Q_stricmpn(filename, "/american_", 10);
} }
/* /*
@ -54,7 +55,7 @@ Return whether or not the specified filename is for axis
*/ */
bool IsGermanPlayerModel(const char *filename) bool IsGermanPlayerModel(const char *filename)
{ {
return !Q_stricmpn(filename, "german_", 7) || !Q_stricmpn(filename, "IT_", 3) || !Q_stricmpn(filename, "SC_", 3); return !Q_stricmpn(filename, "/german_", 8) || !Q_stricmpn(filename, "/IT_", 4) || !Q_stricmpn(filename, "/SC_", 4);
} }
/* /*
@ -139,9 +140,9 @@ void InitModelList()
} }
if (IsAlliedPlayerModel(filename)) { if (IsAlliedPlayerModel(filename)) {
alliedModelList.AddObject(str(filename, 0, len - 4)); alliedModelList.AddObject(str(filename + 1, 0, len - 5));
} else { } else {
germanModelList.AddObject(str(filename, 0, len - 4)); germanModelList.AddObject(str(filename + 1, 0, len - 5));
} }
} }
@ -157,16 +158,16 @@ Begin spawning a new bot entity
*/ */
void G_BotBegin(gentity_t *ent) void G_BotBegin(gentity_t *ent)
{ {
Player *player; PlayerBot *player;
BotController *controller; BotController *controller;
level.spawn_entnum = ent->s.number; level.spawn_entnum = ent->s.number;
player = new Player; player = new PlayerBot;
G_ClientBegin(ent, NULL); G_ClientBegin(ent, NULL);
controller = botManager.getControllerManager().createController(player); controller = botManager.getControllerManager().createController(player);
//player->setController(controller); player->setController(controller);
} }
/* /*
@ -271,7 +272,7 @@ void G_BotShift(int clientNum)
return; return;
} }
if (!botManager.getControllerManager().findController(ent->entity)) { if (!ent->entity->IsSubclassOfBot()) {
return; return;
} }
@ -355,7 +356,7 @@ bool G_IsBot(gentity_t *ent)
return false; return false;
} }
if (!ent->entity || !botManager.getControllerManager().findController(ent->entity)) { if (!ent->entity || !ent->entity->IsSubclassOfBot()) {
return false; return false;
} }
@ -375,43 +376,13 @@ bool G_IsPlayer(gentity_t *ent)
return false; return false;
} }
if (!ent->entity || botManager.getControllerManager().findController(ent->entity)) { if (!ent->entity || ent->entity->IsSubclassOfBot()) {
return false; return false;
} }
return true; return true;
} }
/*
===========
G_GetRandomAlliedPlayerModel
============
*/
const char *G_GetRandomAlliedPlayerModel()
{
if (!alliedModelList.NumObjects()) {
return "";
}
const unsigned int index = rand() % alliedModelList.NumObjects();
return alliedModelList[index];
}
/*
===========
G_GetRandomGermanPlayerModel
============
*/
const char *G_GetRandomGermanPlayerModel()
{
if (!germanModelList.NumObjects()) {
return "";
}
const unsigned int index = rand() % germanModelList.NumObjects();
return germanModelList[index];
}
/* /*
=========== ===========
G_AddBot G_AddBot
@ -437,6 +408,7 @@ void G_AddBot(const saved_bot_t *saved)
clientNum = e - g_entities; clientNum = e - g_entities;
current_bot_count++;
// increase the unique ID // increase the unique ID
botId++; botId++;
@ -457,8 +429,14 @@ void G_AddBot(const saved_bot_t *saved)
// //
// Choose a random model // Choose a random model
// //
Info_SetValueForKey(userinfo, "dm_playermodel", G_GetRandomAlliedPlayerModel()); if (alliedModelList.NumObjects()) {
Info_SetValueForKey(userinfo, "dm_playergermanmodel", G_GetRandomGermanPlayerModel()); const unsigned int index = rand() % alliedModelList.NumObjects();
Info_SetValueForKey(userinfo, "dm_playermodel", alliedModelList[index]);
}
if (germanModelList.NumObjects()) {
const unsigned int index = rand() % germanModelList.NumObjects();
Info_SetValueForKey(userinfo, "dm_playergermanmodel", germanModelList[index]);
}
Info_SetValueForKey(userinfo, "fov", "80"); Info_SetValueForKey(userinfo, "fov", "80");
Info_SetValueForKey(userinfo, "ip", "localhost"); Info_SetValueForKey(userinfo, "ip", "localhost");
@ -502,6 +480,7 @@ void G_RemoveBot(gentity_t *ent)
} }
G_ClientDisconnect(ent); G_ClientDisconnect(ent);
current_bot_count--;
} }
/* /*
@ -580,18 +559,17 @@ void G_SaveBots()
saved_bots = NULL; saved_bots = NULL;
} }
const BotControllerManager& manager = botManager.getControllerManager(); if (!current_bot_count) {
unsigned int numSpawnedBots = manager.getControllers().NumObjects();
if (!numSpawnedBots) {
return; return;
} }
saved_bots = new saved_bot_t[numSpawnedBots]; saved_bots = new saved_bot_t[current_bot_count];
num_saved_bots = 0; num_saved_bots = 0;
const BotControllerManager& manager = botManager.getControllerManager();
count = manager.getControllers().NumObjects(); count = manager.getControllers().NumObjects();
assert(count <= numSpawnedBots); assert(count <= current_bot_count);
for (n = 1; n <= count; n++) { for (n = 1; n <= count; n++) {
const BotController *controller = manager.getControllers().ObjectAt(n); const BotController *controller = manager.getControllers().ObjectAt(n);
@ -685,18 +663,6 @@ int G_CountClients()
return count; return count;
} }
/*
===========
G_RestartBots
Save bots
============
*/
void G_RestartBots()
{
G_SaveBots();
}
/* /*
=========== ===========
G_ResetBots G_ResetBots
@ -706,8 +672,11 @@ Save and reset the bot count
*/ */
void G_ResetBots() void G_ResetBots()
{ {
G_SaveBots();
botManager.Cleanup(); botManager.Cleanup();
current_bot_count = 0;
botId = 0; botId = 0;
} }
@ -761,7 +730,6 @@ void G_SpawnBots()
{ {
unsigned int numClients; unsigned int numClients;
unsigned int numBotsToSpawn; unsigned int numBotsToSpawn;
unsigned int numSpawnedBots;
// //
// Check the minimum bot count // Check the minimum bot count
@ -784,14 +752,12 @@ void G_SpawnBots()
numBotsToSpawn = Q_min(numBotsToSpawn, sv_maxbots->integer); numBotsToSpawn = Q_min(numBotsToSpawn, sv_maxbots->integer);
} }
numSpawnedBots = botManager.getControllerManager().getControllers().NumObjects();
// //
// Spawn bots // Spawn bots
// //
if (numBotsToSpawn > numSpawnedBots) { if (numBotsToSpawn > current_bot_count) {
G_AddBots(numBotsToSpawn - numSpawnedBots); G_AddBots(numBotsToSpawn - current_bot_count);
} else if (numBotsToSpawn < numSpawnedBots) { } else if (numBotsToSpawn < current_bot_count) {
G_RemoveBots(numSpawnedBots - numBotsToSpawn); G_RemoveBots(current_bot_count - numBotsToSpawn);
} }
} }

View file

@ -1,6 +1,6 @@
/* /*
=========================================================================== ===========================================================================
Copyright (C) 2025 the OpenMoHAA team Copyright (C) 2024 the OpenMoHAA team
This file is part of OpenMoHAA source code. This file is part of OpenMoHAA source code.
@ -37,10 +37,7 @@ void G_RemoveBots(unsigned int num);
bool G_IsBot(gentity_t *ent); bool G_IsBot(gentity_t *ent);
bool G_IsPlayer(gentity_t *ent); bool G_IsPlayer(gentity_t *ent);
void G_ResetBots(); void G_ResetBots();
void G_RestartBots();
void G_BotInit(); void G_BotInit();
void G_BotFrame(); void G_BotFrame();
void G_BotPostInit(); void G_BotPostInit();
void G_SpawnBots(); void G_SpawnBots();
const char *G_GetRandomAlliedPlayerModel();
const char *G_GetRandomGermanPlayerModel();

View file

@ -757,7 +757,6 @@ void G_ClientUserinfoChanged(gentity_t *ent, const char *u)
char *s; char *s;
gclient_t *client; gclient_t *client;
int clientnum; int clientnum;
char oldname[MAX_NAME_LENGTH];
if (!ent) { if (!ent) {
return; return;
@ -773,19 +772,10 @@ void G_ClientUserinfoChanged(gentity_t *ent, const char *u)
clientnum = ent - g_entities; clientnum = ent - g_entities;
Q_strncpyz(oldname, client->pers.netname, sizeof(oldname)); if (gi.SanitizeName(s, client->pers.netname)) {
if (gi.SanitizeName(s, client->pers.netname, sizeof(client->pers.netname))) {
gi.Printf("WARNING: had to sanitize the name for client %i\n", clientnum); gi.Printf("WARNING: had to sanitize the name for client %i\n", clientnum);
} }
if (strcmp(oldname, client->pers.netname)) {
//
// Added in OPM
// Print name changes
//
gi.Printf("Client %i changed name from '%s' to '%s'\n", clientnum, oldname, client->pers.netname);
}
s = Info_ValueForKey(u, "dm_playermodel"); s = Info_ValueForKey(u, "dm_playermodel");
if (!s) { if (!s) {
@ -804,7 +794,7 @@ void G_ClientUserinfoChanged(gentity_t *ent, const char *u)
Q_strncpyz(client->pers.dm_playergermanmodel, s, sizeof(client->pers.dm_playergermanmodel)); Q_strncpyz(client->pers.dm_playergermanmodel, s, sizeof(client->pers.dm_playergermanmodel));
G_SetClientConfigString(ent); gi.setConfigstring(CS_PLAYERS + clientnum, va("name\\%s", client->pers.netname));
if (ent->entity) { if (ent->entity) {
float fov; float fov;
@ -837,7 +827,6 @@ void G_BotConnect(int clientNum, qboolean firstTime, const char *userinfo)
ent->client = game.clients + clientNum; ent->client = game.clients + clientNum;
ent->s.number = clientNum; ent->s.number = clientNum;
ent->r.svFlags |= SVF_BOT;
client = ent->client; client = ent->client;
@ -888,6 +877,8 @@ const char *G_ClientConnect(int clientNum, qboolean firstTime, qboolean differen
gentity_t *ent; gentity_t *ent;
char userinfo[MAX_INFO_STRING]; char userinfo[MAX_INFO_STRING];
gi.DPrintf("TTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTT\n");
// Added in OPM // Added in OPM
G_BotShift(clientNum); G_BotShift(clientNum);

View file

@ -227,13 +227,9 @@ void G_AllocGameData(void)
void G_DeAllocGameData(void) void G_DeAllocGameData(void)
{ {
// Free up debug lines // Initialize debug lines
G_DeAllocDebugLines(); G_DeAllocDebugLines();
// Added in OPM
// Free up debug strings
G_DeAllocDebugStrings();
// free up the entities // free up the entities
if (g_entities) { if (g_entities) {
gi.Free(g_entities); gi.Free(g_entities);
@ -918,9 +914,6 @@ void G_Restart(void)
// Added in 2.0 // Added in 2.0
G_ResetSmokeSprites(); G_ResetSmokeSprites();
// Added in OPM
G_RestartBots();
} }
void G_SetFrameNumber(int framenum) void G_SetFrameNumber(int framenum)
@ -1888,8 +1881,8 @@ void G_ExitLevel(void)
// The nextmap cvar was set (possibly by a vote - so go ahead and use it) // The nextmap cvar was set (possibly by a vote - so go ahead and use it)
level.nextmap = sv_nextmap->string; level.nextmap = sv_nextmap->string;
gi.cvar_set("nextmap", ""); gi.cvar_set("nextmap", "");
} else { } else // Use the next map in the maplist
// Use the next map in the maplist {
char *s, *f, *t; char *s, *f, *t;
f = NULL; f = NULL;
@ -1899,17 +1892,19 @@ void G_ExitLevel(void)
if (!Q_stricmp(t, level.mapname.c_str())) { if (!Q_stricmp(t, level.mapname.c_str())) {
// it's in the list, go to the next one // it's in the list, go to the next one
t = strtok(NULL, seps); t = strtok(NULL, seps);
if (t) { if (t == NULL) // end of list, go to first one
level.nextmap = t; {
} else if (f) { if (f == NULL) // there isn't a first one, same level
// end of list, go to first one {
level.nextmap = f;
} else {
// there isn't a first one, same level
level.nextmap = level.mapname; level.nextmap = level.mapname;
} else {
level.nextmap = f;
} }
} else {
break; level.nextmap = t;
}
free(s);
goto out;
} }
// set the first map // set the first map
@ -1920,7 +1915,7 @@ void G_ExitLevel(void)
} }
free(s); free(s);
} }
out:
// level.nextmap should be set now, but if it isn't use the same map // level.nextmap should be set now, but if it isn't use the same map
if (level.nextmap.length() == 0) { if (level.nextmap.length() == 0) {
// Stay on the same map since no nextmap was set // Stay on the same map since no nextmap was set
@ -1934,8 +1929,8 @@ void G_ExitLevel(void)
// alias on another map // alias on another map
Q_strncpyz(command, level.nextmap, sizeof(command)); Q_strncpyz(command, level.nextmap, sizeof(command));
gi.SendConsoleCommand(command); gi.SendConsoleCommand(command);
} else { } else // use the level.nextmap variable
// use the level.nextmap variable {
Com_sprintf(command, sizeof(command), "gamemap \"%s\"\n", level.nextmap.c_str()); Com_sprintf(command, sizeof(command), "gamemap \"%s\"\n", level.nextmap.c_str());
gi.SendConsoleCommand(command); gi.SendConsoleCommand(command);
} }

View file

@ -365,7 +365,6 @@ void MM_StepSlideMove(void)
vec3_t start_hit_origin; vec3_t start_hit_origin;
vec3_t first_hit_origin; vec3_t first_hit_origin;
trace_t nostep_groundTrace; trace_t nostep_groundTrace;
qboolean nostep_validGroundTrace;
VectorCopy(mm->origin, start_o); VectorCopy(mm->origin, start_o);
VectorCopy(mm->velocity, start_v); VectorCopy(mm->velocity, start_v);
@ -411,9 +410,6 @@ void MM_StepSlideMove(void)
VectorCopy(mm->origin, nostep_o); VectorCopy(mm->origin, nostep_o);
VectorCopy(mm->velocity, nostep_v); VectorCopy(mm->velocity, nostep_v);
memcpy(&nostep_groundTrace, &mml.groundTrace, sizeof(trace_t)); memcpy(&nostep_groundTrace, &mml.groundTrace, sizeof(trace_t));
// Fixed in OPM
// Save the valid ground trace
nostep_validGroundTrace = mml.validGroundTrace;
VectorCopy(up, mm->origin); VectorCopy(up, mm->origin);
VectorCopy(start_v, mm->velocity); VectorCopy(start_v, mm->velocity);
@ -436,10 +432,6 @@ void MM_StepSlideMove(void)
VectorCopy(nostep_o, mm->origin); VectorCopy(nostep_o, mm->origin);
VectorCopy(nostep_v, mm->velocity); VectorCopy(nostep_v, mm->velocity);
memcpy(&mml.groundTrace, &nostep_groundTrace, sizeof(mml.groundTrace)); memcpy(&mml.groundTrace, &nostep_groundTrace, sizeof(mml.groundTrace));
// Fixed in OPM
// Do not use the ground trace as it's invalid and would have an invalid entity number
mml.validGroundTrace = nostep_validGroundTrace;
mm->hit_obstacle = first_hit_wall; mm->hit_obstacle = first_hit_wall;
VectorCopy(first_hit_origin, mm->hit_origin); VectorCopy(first_hit_origin, mm->hit_origin);
VectorCopy(first_wall_normal, mm->obstacle_normal); VectorCopy(first_wall_normal, mm->obstacle_normal);

File diff suppressed because it is too large Load diff

View file

@ -29,7 +29,8 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
class Entity; class Entity;
typedef enum { typedef enum
{
STEPMOVE_OK, STEPMOVE_OK,
STEPMOVE_BLOCKED_BY_ENTITY, STEPMOVE_BLOCKED_BY_ENTITY,
STEPMOVE_BLOCKED_BY_WORLD, STEPMOVE_BLOCKED_BY_WORLD,
@ -40,7 +41,8 @@ typedef enum {
} stepmoveresult_t; } stepmoveresult_t;
// movetype values // movetype values
typedef enum { typedef enum
{
MOVETYPE_NONE, // never moves MOVETYPE_NONE, // never moves
MOVETYPE_STATIONARY, // never moves but does collide agains push objects MOVETYPE_STATIONARY, // never moves but does collide agains push objects
MOVETYPE_NOCLIP, // origin and angles change with no interaction MOVETYPE_NOCLIP, // origin and angles change with no interaction
@ -58,7 +60,8 @@ typedef enum {
MOVETYPE_PORTABLE_TURRET MOVETYPE_PORTABLE_TURRET
} movetype_t; } movetype_t;
typedef struct { typedef struct
{
Entity *ent; Entity *ent;
Vector localorigin; Vector localorigin;
Vector origin; Vector origin;

View file

@ -248,8 +248,6 @@ typedef struct gameImport_s {
void (*cvar_set)(const char *varName, const char *varValue); void (*cvar_set)(const char *varName, const char *varValue);
cvar_t *(*cvar_set2)(const char *varName, const char *varValue, qboolean force); cvar_t *(*cvar_set2)(const char *varName, const char *varValue, qboolean force);
cvar_t *(*NextCvar)(cvar_t *var); cvar_t *(*NextCvar)(cvar_t *var);
void (*Cvar_CheckRange)(cvar_t* var, float min, float max, qboolean integral);
int (*Argc)(); int (*Argc)();
char *(*Argv)(int arg); char *(*Argv)(int arg);
char *(*Args)(); char *(*Args)();
@ -259,7 +257,6 @@ typedef struct gameImport_s {
int (*FS_WriteFile)(const char *qpath, const void *buffer, int size); int (*FS_WriteFile)(const char *qpath, const void *buffer, int size);
fileHandle_t (*FS_FOpenFileWrite)(const char *fileName); fileHandle_t (*FS_FOpenFileWrite)(const char *fileName);
fileHandle_t (*FS_FOpenFileAppend)(const char *fileName); fileHandle_t (*FS_FOpenFileAppend)(const char *fileName);
long (*FS_FOpenFile)(const char* qpath, fileHandle_t *file, qboolean uniqueFILE, qboolean quiet);
const char *(*FS_PrepFileWrite)(const char *fileName); const char *(*FS_PrepFileWrite)(const char *fileName);
size_t (*FS_Write)(const void *buffer, size_t size, fileHandle_t fileHandle); size_t (*FS_Write)(const void *buffer, size_t size, fileHandle_t fileHandle);
size_t (*FS_Read)(void *buffer, size_t len, fileHandle_t fileHandle); size_t (*FS_Read)(void *buffer, size_t len, fileHandle_t fileHandle);
@ -481,7 +478,7 @@ typedef struct gameImport_s {
void (*HudDrawAlpha)(int info, float alpha); void (*HudDrawAlpha)(int info, float alpha);
void (*HudDrawString)(int info, const char *string); void (*HudDrawString)(int info, const char *string);
void (*HudDrawFont)(int info, const char *fontName); void (*HudDrawFont)(int info, const char *fontName);
qboolean (*SanitizeName)(const char *oldName, char *newName, size_t bufferSize); qboolean (*SanitizeName)(const char *oldName, char *newName);
// //
// Added in OPM // Added in OPM

View file

@ -87,13 +87,6 @@ Called on a first-time connect
*/ */
void G_InitClientPersistant( gclient_t *client, const char *userinfo ) void G_InitClientPersistant( gclient_t *client, const char *userinfo )
{ {
// Clear the persistent data
client->pers = {};
// Added in OPM
// Reset the persistent session data.
// This fixes some bugs like the player getting score
// from previous maps
G_WriteClientSessionData( client ); G_WriteClientSessionData( client );
} }

View file

@ -924,10 +924,10 @@ float G_GetAngle(Vector movedir)
angle = RAD2DEG(atan(1.0) * 2 + atan(-movedir[0] / sqrt(-movedir[0] * movedir[0] + 1.0))); angle = RAD2DEG(atan(1.0) * 2 + atan(-movedir[0] / sqrt(-movedir[0] * movedir[0] + 1.0)));
if (movedir[1] < 0) { if (movedir[1] < 0) {
return (int)((360 - angle) * 10000) / 10000.0; return 360 - angle;
} }
return (int)(angle * 10000) / 10000.0; return angle;
} }
/* /*
@ -2171,9 +2171,9 @@ void G_PrintToAllClients(const char *pszString, int iType)
} }
} else { } else {
if (iType == 0) { if (iType == 0) {
gi.SendServerCommand(-1, "print \"" HUD_MESSAGE_YELLOW "%s\"", pszString); gi.SendServerCommand(-1, "print \"" HUD_MESSAGE_YELLOW "%s\n\"", pszString);
} else { } else {
gi.SendServerCommand(-1, "print \"" HUD_MESSAGE_WHITE "%s\"", pszString); gi.SendServerCommand(-1, "print \"" HUD_MESSAGE_WHITE "%s\n\"", pszString);
} }
} }
} }
@ -2232,12 +2232,9 @@ G_PrintDeathMessageEmulated(const char *s1, const char *s2, char *attackerName,
result2 = NULL; result2 = NULL;
if (type == tolower(type)) { if (type == tolower(type)) {
// Enemy
hudColor = 4; hudColor = 4;
} else { } else {
// Friend hudColor = 5;
//hudColor = 5;
hudColor = 4;
} }
if (*s1 != 'x') { if (*s1 != 'x') {
@ -2330,7 +2327,7 @@ void G_PrintDeathMessage_Old(const char *pszString)
continue; continue;
} }
gi.SendServerCommand(ent - g_entities, "print \"%s\"", pszString); gi.SendServerCommand(ent - g_entities, "print \"" HUD_MESSAGE_CHAT_RED "%s\"", pszString);
} }
} }
@ -2452,7 +2449,3 @@ gentity_t *G_GetGEntity(int ent_num)
return ent; return ent;
} }
unsigned int G_GetWeaponCommand(unsigned int buttons) {
return GetWeaponCommand(buttons, g_protocol >= PROTOCOL_MOHTA_MIN ? WEAPON_COMMAND_MAX_VER17 : WEAPON_COMMAND_MAX_VER6);
}

View file

@ -327,4 +327,3 @@ const char *WeaponHandNumToName(weaponhand_t hand);
weaponhand_t WeaponHandNameToNum(str side); weaponhand_t WeaponHandNameToNum(str side);
void G_DebugTargets(Entity *e, str from); void G_DebugTargets(Entity *e, str from);
void G_DebugDamage(float damage, Entity *victim, Entity *attacker, Entity *inflictor); void G_DebugDamage(float damage, Entity *victim, Entity *attacker, Entity *inflictor);
unsigned int G_GetWeaponCommand(unsigned int buttons);

View file

@ -1,6 +1,6 @@
/* /*
=========================================================================== ===========================================================================
Copyright (C) 2025 the OpenMoHAA team Copyright (C) 2024 the OpenMoHAA team
This file is part of OpenMoHAA source code. This file is part of OpenMoHAA source code.
@ -686,17 +686,10 @@ void GameScript::ArchiveCodePos(Archiver& arc, unsigned char **codePos)
void GameScript::Close(void) void GameScript::Close(void)
{ {
// Free up catch blocks
for (int i = m_CatchBlocks.NumObjects(); i > 0; i--) { for (int i = m_CatchBlocks.NumObjects(); i > 0; i--) {
delete m_CatchBlocks.ObjectAt(i); delete m_CatchBlocks.ObjectAt(i);
} }
// Added in OPM
// Free up allocated state scripts
for (int i = m_StateScripts.NumObjects(); i > 0; i--) {
delete m_StateScripts.ObjectAt(i);
}
m_CatchBlocks.FreeObjectList(); m_CatchBlocks.FreeObjectList();
if (m_ProgToSource) { if (m_ProgToSource) {
@ -821,11 +814,7 @@ StateScript *GameScript::CreateCatchStateScript(unsigned char *try_begin_code_po
StateScript *GameScript::CreateSwitchStateScript(void) StateScript *GameScript::CreateSwitchStateScript(void)
{ {
StateScript *stateScript = new StateScript; return new StateScript;
m_StateScripts.AddObject(stateScript);
return stateScript;
} }
StateScript *GameScript::GetCatchStateScript(unsigned char *in, unsigned char *& out) StateScript *GameScript::GetCatchStateScript(unsigned char *in, unsigned char *& out)
@ -877,7 +866,7 @@ ScriptThreadLabel::ScriptThreadLabel()
m_Label = STRING_EMPTY; m_Label = STRING_EMPTY;
} }
ScriptThread *ScriptThreadLabel::Create(Listener *listener) const ScriptThread *ScriptThreadLabel::Create(Listener *listener)
{ {
ScriptClass *scriptClass; ScriptClass *scriptClass;
ScriptThread *thread; ScriptThread *thread;
@ -907,7 +896,7 @@ ScriptThread *ScriptThreadLabel::Create(Listener *listener) const
return thread; return thread;
} }
void ScriptThreadLabel::Execute(Listener *listener) const void ScriptThreadLabel::Execute(Listener *listener)
{ {
if (!m_Script) { if (!m_Script) {
return; return;
@ -920,7 +909,12 @@ void ScriptThreadLabel::Execute(Listener *listener) const
} }
} }
void ScriptThreadLabel::Execute(Listener *listener, Event& ev) const void ScriptThreadLabel::Execute(Listener *listener, Event& ev)
{
Execute(listener, &ev);
}
void ScriptThreadLabel::Execute(Listener *listener, Event *ev)
{ {
if (!m_Script) { if (!m_Script) {
return; return;
@ -933,13 +927,7 @@ void ScriptThreadLabel::Execute(Listener *listener, Event& ev) const
} }
} }
void ScriptThreadLabel::Execute(Listener *listener, Event *ev) const
{
Execute(listener, *ev);
}
void ScriptThreadLabel::Execute(Listener *pSelf, const SafePtr<Listener>& listener, const SafePtr<Listener>& param) void ScriptThreadLabel::Execute(Listener *pSelf, const SafePtr<Listener>& listener, const SafePtr<Listener>& param)
const
{ {
if (!m_Script) { if (!m_Script) {
return; return;
@ -1226,7 +1214,7 @@ bool ScriptThreadLabel::TrySetScript(const_str label)
return true; return true;
} }
void ScriptThreadLabel::GetScriptValue(ScriptVariable *var) const void ScriptThreadLabel::GetScriptValue(ScriptVariable *var)
{ {
if (!m_Script) { if (!m_Script) {
var->Clear(); var->Clear();
@ -1240,12 +1228,12 @@ void ScriptThreadLabel::GetScriptValue(ScriptVariable *var) const
var->setConstArrayValue(var_array, 2); var->setConstArrayValue(var_array, 2);
} }
bool ScriptThreadLabel::IsSet(void) const bool ScriptThreadLabel::IsSet(void)
{ {
return m_Script != NULL; return m_Script != NULL;
} }
bool ScriptThreadLabel::IsFile(const_str filename) const bool ScriptThreadLabel::IsFile(const_str filename)
{ {
return m_Script && m_Script->ConstFilename() == filename && m_Label == STRING_EMPTY; return m_Script && m_Script->ConstFilename() == filename && m_Label == STRING_EMPTY;
} }

View file

@ -1,6 +1,6 @@
/* /*
=========================================================================== ===========================================================================
Copyright (C) 2025 the OpenMoHAA team Copyright (C) 2024 the OpenMoHAA team
This file is part of OpenMoHAA source code. This file is part of OpenMoHAA source code.
@ -119,7 +119,6 @@ class GameScript : public AbstractScript
protected: protected:
// try/throw variable // try/throw variable
Container<CatchBlock *> m_CatchBlocks; Container<CatchBlock *> m_CatchBlocks;
Container<StateScript *> m_StateScripts;
public: public:
// program variables // program variables
@ -170,11 +169,11 @@ private:
public: public:
ScriptThreadLabel(); ScriptThreadLabel();
ScriptThread *Create(Listener *listener) const; ScriptThread *Create(Listener *listener);
void Execute(Listener *listener = NULL) const; void Execute(Listener *listener = NULL);
void Execute(Listener *listener, Event& ev) const; void Execute(Listener *listener, Event& ev);
void Execute(Listener *listener, Event *ev) const; void Execute(Listener *listener, Event *ev);
void Execute(Listener *pSelf, const SafePtr<Listener>& listener, const SafePtr<Listener>& param) const; void Execute(Listener *pSelf, const SafePtr<Listener>& listener, const SafePtr<Listener>& param);
void Clear(); void Clear();
void Set(const char *label); void Set(const char *label);
@ -189,10 +188,10 @@ public:
bool TrySetScript(const_str label); bool TrySetScript(const_str label);
bool TrySetScript(const char *label); bool TrySetScript(const char *label);
bool IsSet(void) const; bool IsSet(void);
bool IsFile(const_str filename) const; bool IsFile(const_str filename);
void GetScriptValue(ScriptVariable *var) const; void GetScriptValue(ScriptVariable *var);
void Archive(Archiver& arc); void Archive(Archiver& arc);

View file

@ -114,7 +114,7 @@ void Health::PickupHealth(Event *ev)
gi.SendServerCommand( gi.SendServerCommand(
player->edict - g_entities, player->edict - g_entities,
"print \"" HUD_MESSAGE_YELLOW "%s\n\"", "print \"" HUD_MESSAGE_YELLOW "%s \"",
gi.LV_ConvertString(va("Recovered %d Health", amount)) gi.LV_ConvertString(va("Recovered %d Health", amount))
); );
} }

View file

@ -418,11 +418,15 @@ void Item::RemoveFromOwner(void)
void Item::Delete(void) void Item::Delete(void)
{ {
if (g_iInThinks && owner) { if (g_iInThinks) {
if (owner) {
RemoveFromOwner(); RemoveFromOwner();
} }
Animate::Delete(); PostEvent(EV_Remove, 0);
} else {
delete this;
}
} }
void Item::SetNoRemove(Event *ev) void Item::SetNoRemove(Event *ev)

View file

@ -969,8 +969,8 @@ void Level::CleanUp(qboolean samemap, qboolean resetConfigStrings)
gi.setConfigstring(CS_RAIN_NUMSHADERS, "0"); gi.setConfigstring(CS_RAIN_NUMSHADERS, "0");
gi.setConfigstring(CS_CURRENT_OBJECTIVE, ""); gi.setConfigstring(CS_CURRENT_OBJECTIVE, "");
for (i = 0; i < MAX_OBJECTIVES; i++) { for (int i = CS_OBJECTIVES; i < CS_OBJECTIVES + MAX_OBJECTIVES; i++) {
gi.setConfigstring(CS_OBJECTIVES + i, ""); gi.setConfigstring(i, "");
} }
gi.setConfigstring(CS_VOTE_TIME, ""); gi.setConfigstring(CS_VOTE_TIME, "");
@ -1097,12 +1097,6 @@ void Level::SpawnEntities(char *entities, int svsTime)
int start, end; int start, end;
char name[128]; char name[128];
if (gi.Cvar_Get("g_invulnoverride", "0", 0)->integer == 1) {
// Added in 2.30
// Clear the invulnerable override when loading
gi.cvar_set("g_invulnoverride", "0");
}
Com_Printf("-------------------- Spawning Entities -----------------------\n"); Com_Printf("-------------------- Spawning Entities -----------------------\n");
t1 = gi.Milliseconds(); t1 = gi.Milliseconds();
@ -1511,7 +1505,7 @@ void Level::ServerSpawned(void)
void Level::SetMap(const char *themapname) void Level::SetMap(const char *themapname)
{ {
const char *spawnpos; char *spawnpos;
int i; int i;
str text; str text;
@ -1522,8 +1516,8 @@ void Level::SetMap(const char *themapname)
// set a specific spawnpoint if the map was started with a $ // set a specific spawnpoint if the map was started with a $
spawnpos = strchr((char *)themapname, '$'); spawnpos = strchr((char *)themapname, '$');
if (spawnpos) { if (spawnpos) {
mapname = str(themapname, 0, spawnpos - themapname); mapname = (const char *)(spawnpos - themapname);
spawnpoint = spawnpos + 1; spawnpoint = mapname;
} else { } else {
mapname = themapname; mapname = themapname;
spawnpoint = ""; spawnpoint = "";
@ -1588,30 +1582,6 @@ void Level::Precache(void)
LoadAllScripts("global", ".scr"); LoadAllScripts("global", ".scr");
InitVoteOptions(); InitVoteOptions();
// Added in OPM
// Cache all player models in multi-player
// This avoids using precache scripts
if (g_gametype->integer != GT_SINGLE_PLAYER) {
char **fileList;
int numFiles;
int i;
fileList = gi.FS_ListFiles("models/player", ".tik", qfalse, &numFiles);
for (i = 0; i < numFiles; i++) {
const char *filename = fileList[i];
const size_t filelen = strlen(filename);
if (!Q_stricmpn(filename, "allied_", 7) || !Q_stricmpn(filename, "american_", 9)
|| !Q_stricmpn(filename, "german_", 7) || !Q_stricmpn(filename, "IT_", 3)
|| !Q_stricmpn(filename, "SC_", 3)) {
CacheResource(va("models/player/%s", filename));
}
}
gi.FS_FreeFileList(fileList);
}
} }
/* /*
@ -1754,10 +1724,6 @@ void Level::FreeEdict(gentity_t *ed)
{ {
gclient_t *client; gclient_t *client;
// clear the model so it decreases the user count
// and free memory if the model is not used anywhere
gi.clearmodel(ed);
// unlink from world // unlink from world
gi.unlinkentity(ed); gi.unlinkentity(ed);
@ -1944,8 +1910,6 @@ void Level::CheckVote(void)
level.m_voteNo++; level.m_voteNo++;
} }
} }
numVoters++;
} }
level.m_numVoters = numVoters; level.m_numVoters = numVoters;

View file

@ -1,6 +1,6 @@
/* /*
=========================================================================== ===========================================================================
Copyright (C) 2025 the OpenMoHAA team Copyright (C) 2023 the OpenMoHAA team
This file is part of OpenMoHAA source code. This file is part of OpenMoHAA source code.
@ -146,7 +146,8 @@ If PROJECTILES is set, the trigger will respond to projectiles (rockets, grenade
Event EV_ExplodingWall_StopRotating Event EV_ExplodingWall_StopRotating
( (
"stoprotating", EV_DEFAULT, "stoprotating",
EV_DEFAULT,
NULL, NULL,
NULL, NULL,
"Stop rotating the wall.", "Stop rotating the wall.",
@ -154,16 +155,17 @@ Event EV_ExplodingWall_StopRotating
); );
Event EV_ExplodingWall_OnGround Event EV_ExplodingWall_OnGround
( (
"checkonground", EV_DEFAULT, "checkonground",
EV_DEFAULT,
NULL, NULL,
NULL, NULL,
"Check if exploding wall is on ground.", "Check if exploding wall is on ground.",
EV_NORMAL EV_NORMAL
); );
Event EV_ExplodingWall_AngleSpeed Event EV_ExplodingWall_AngleSpeed
( (
"anglespeed", EV_DEFAULT, "anglespeed",
EV_DEFAULT,
"f", "f",
"speed", "speed",
"Set the angle speed.", "Set the angle speed.",
@ -171,7 +173,8 @@ Event EV_ExplodingWall_AngleSpeed
); );
Event EV_ExplodingWall_LandRadius Event EV_ExplodingWall_LandRadius
( (
"land_radius", EV_DEFAULT, "land_radius",
EV_DEFAULT,
"f", "f",
"radius", "radius",
"Set the land radius.", "Set the land radius.",
@ -179,7 +182,8 @@ Event EV_ExplodingWall_LandRadius
); );
Event EV_ExplodingWall_LandAngles Event EV_ExplodingWall_LandAngles
( (
"land_angles", EV_DEFAULT, "land_angles",
EV_DEFAULT,
"v", "v",
"angles", "angles",
"Set the land angles.", "Set the land angles.",
@ -187,13 +191,15 @@ Event EV_ExplodingWall_LandAngles
); );
Event EV_ExplodingWall_BaseVelocity Event EV_ExplodingWall_BaseVelocity
( (
"base_velocity", EV_DEFAULT, "base_velocity",
EV_DEFAULT,
"v", "v",
"velocity", "velocity",
"Set the base velocity.", "Set the base velocity.",
EV_NORMAL EV_NORMAL
); );
Event EV_ExplodingWall_RandomVelocity( Event EV_ExplodingWall_RandomVelocity
(
"random_velocity", "random_velocity",
EV_DEFAULT, EV_DEFAULT,
"v", "v",
@ -203,7 +209,8 @@ Event EV_ExplodingWall_RandomVelocity(
); );
Event EV_ExplodingWall_SetDmg Event EV_ExplodingWall_SetDmg
( (
"dmg", EV_DEFAULT, "dmg",
EV_DEFAULT,
"i", "i",
"dmg", "dmg",
"Set the damage from the exploding wall.", "Set the damage from the exploding wall.",
@ -211,16 +218,17 @@ Event EV_ExplodingWall_SetDmg
); );
Event EV_ExplodingWall_SetExplosions Event EV_ExplodingWall_SetExplosions
( (
"explosions", EV_DEFAULT, "explosions",
EV_DEFAULT,
"i", "i",
"explosions", "explosions",
"Set the number of explosions.", "Set the number of explosions.",
EV_NORMAL EV_NORMAL
); );
Event EV_ExplodingWall_Setup Event EV_ExplodingWall_Setup
( (
"setup", EV_CODEONLY, "setup",
EV_CODEONLY,
NULL, NULL,
NULL, NULL,
"Initializes the exploding wall.", "Initializes the exploding wall.",
@ -245,41 +253,49 @@ CLASS_DECLARATION(Trigger, ExplodingWall, "func_explodingwall") {
}; };
void ExplodingWall::AngleSpeed(Event *ev) void ExplodingWall::AngleSpeed(Event *ev)
{ {
angle_speed = ev->GetFloat(1); angle_speed = ev->GetFloat(1);
} }
void ExplodingWall::LandRadius(Event *ev) void ExplodingWall::LandRadius(Event *ev)
{ {
land_radius = ev->GetFloat(1); land_radius = ev->GetFloat(1);
} }
void ExplodingWall::LandAngles(Event *ev) void ExplodingWall::LandAngles(Event *ev)
{ {
land_angles = ev->GetVector(1); land_angles = ev->GetVector(1);
} }
void ExplodingWall::BaseVelocity(Event *ev) void ExplodingWall::BaseVelocity(Event *ev)
{ {
base_velocity = ev->GetVector(1); base_velocity = ev->GetVector(1);
} }
void ExplodingWall::RandomVelocity(Event *ev) void ExplodingWall::RandomVelocity(Event *ev)
{ {
random_velocity = ev->GetVector(1); random_velocity = ev->GetVector(1);
} }
void ExplodingWall::SetDmg(Event *ev) void ExplodingWall::SetDmg(Event *ev)
{ {
dmg = ev->GetInteger(1); dmg = ev->GetInteger(1);
} }
void ExplodingWall::SetExplosions(Event *ev) void ExplodingWall::SetExplosions(Event *ev)
{ {
explosions = ev->GetInteger(1); explosions = ev->GetInteger(1);
} }
void ExplodingWall::Explode(Event *ev) void ExplodingWall::Explode(Event *ev)
{ {
Entity *other; Entity *other;
Vector pos; Vector pos;
@ -374,6 +390,7 @@ void ExplodingWall::Explode(Event *ev)
} }
void ExplodingWall::DamageEvent(Event *ev) void ExplodingWall::DamageEvent(Event *ev)
{ {
Event *event; Event *event;
Entity *inflictor; Entity *inflictor;
@ -410,6 +427,7 @@ void ExplodingWall::DamageEvent(Event *ev)
} }
void ExplodingWall::GroundDamage(Event *ev) void ExplodingWall::GroundDamage(Event *ev)
{ {
Entity *inflictor; Entity *inflictor;
Entity *attacker; Entity *attacker;
@ -449,12 +467,14 @@ void ExplodingWall::GroundDamage(Event *ev)
} }
void ExplodingWall::SetupSecondStage(void) void ExplodingWall::SetupSecondStage(void)
{ {
health = max_health; health = max_health;
takedamage = DAMAGE_YES; takedamage = DAMAGE_YES;
} }
void ExplodingWall::StopRotating(Event *ev) void ExplodingWall::StopRotating(Event *ev)
{ {
avelocity = vec_zero; avelocity = vec_zero;
setAngles(land_angles); setAngles(land_angles);
@ -464,6 +484,7 @@ void ExplodingWall::StopRotating(Event *ev)
} }
void ExplodingWall::CheckOnGround(Event *ev) void ExplodingWall::CheckOnGround(Event *ev)
{ {
if ((velocity == vec_zero) && groundentity) { if ((velocity == vec_zero) && groundentity) {
Vector delta; Vector delta;
@ -511,6 +532,7 @@ void ExplodingWall::CheckOnGround(Event *ev)
} }
void ExplodingWall::TouchFunc(Event *ev) void ExplodingWall::TouchFunc(Event *ev)
{ {
Entity *other; Entity *other;
@ -546,6 +568,7 @@ void ExplodingWall::TouchFunc(Event *ev)
} }
void ExplodingWall::Setup(Event *ev) void ExplodingWall::Setup(Event *ev)
{ {
if (spawnflags & INVISIBLE) { if (spawnflags & INVISIBLE) {
if (Targeted()) { if (Targeted()) {
@ -627,7 +650,6 @@ Event EV_Teleporter_StopTeleport
"entity", "entity",
"Releases the entity at the end of the teleport.", "Releases the entity at the end of the teleport.",
EV_NORMAL EV_NORMAL
); );
Event EV_Teleporter_SetThread Event EV_Teleporter_SetThread
( (
@ -737,6 +759,7 @@ void Teleporter::StartTeleport(Event *ev)
} }
void Teleporter::Teleport(Event *ev) void Teleporter::Teleport(Event *ev)
{ {
Entity *dest; Entity *dest;
int i; int i;
@ -850,6 +873,7 @@ void Teleporter::Teleport(Event *ev)
} }
void Teleporter::StopTeleport(Event *ev) void Teleporter::StopTeleport(Event *ev)
{ {
Entity *other; Entity *other;
@ -950,7 +974,6 @@ Event EV_UseAnim_Reset
NULL, NULL,
"Reset's the Use Anim after it has no longer been touched.", "Reset's the Use Anim after it has no longer been touched.",
EV_NORMAL EV_NORMAL
); );
Event EV_UseAnim_Thread Event EV_UseAnim_Thread
( (
@ -960,16 +983,15 @@ Event EV_UseAnim_Thread
"label", "label",
"Sets which thread to use when this UseAnim is triggered.", "Sets which thread to use when this UseAnim is triggered.",
EV_NORMAL EV_NORMAL
); );
Event EV_UseAnim_Count Event EV_UseAnim_Count
( (
"count", EV_DEFAULT, "count",
EV_DEFAULT,
"i", "i",
"newCount", "newCount",
"Sets how many times the UseAnim can be triggered.", "Sets how many times the UseAnim can be triggered.",
EV_NORMAL EV_NORMAL
); );
Event EV_UseAnim_TriggerTarget Event EV_UseAnim_TriggerTarget
( (
@ -997,7 +1019,6 @@ Event EV_UseAnim_SetKey
"keyName", "keyName",
"set the key needed to make this UseAnim function.", "set the key needed to make this UseAnim function.",
EV_NORMAL EV_NORMAL
); );
Event EV_UseAnim_SetState Event EV_UseAnim_SetState
( (
@ -1008,7 +1029,8 @@ Event EV_UseAnim_SetState
"set the state to use for the player.", "set the state to use for the player.",
EV_NORMAL EV_NORMAL
); );
Event EV_UseAnim_SetCamera( Event EV_UseAnim_SetCamera
(
"camera", "camera",
EV_DEFAULT, EV_DEFAULT,
"s", "s",
@ -1025,9 +1047,9 @@ Event EV_UseAnim_SetNumLoops
"loopCount", "loopCount",
"set the number of times to loop an animation per use.", "set the number of times to loop an animation per use.",
EV_NORMAL EV_NORMAL
); );
Event EV_UseAnim_SetDelay( Event EV_UseAnim_SetDelay
(
"delay", "delay",
EV_DEFAULT, EV_DEFAULT,
"f", "f",
@ -1098,6 +1120,7 @@ UseAnim::UseAnim()
} }
void UseAnim::Touched(Event *ev) void UseAnim::Touched(Event *ev)
{ {
Entity *other; Entity *other;
@ -1119,6 +1142,7 @@ void UseAnim::Touched(Event *ev)
} }
bool UseAnim::canBeUsed(Entity *activator) bool UseAnim::canBeUsed(Entity *activator)
{ {
Entity *dest; Entity *dest;
@ -1186,6 +1210,7 @@ bool UseAnim::canBeUsed(Entity *activator)
bool UseAnim::GetInformation( bool UseAnim::GetInformation(
Entity *activator, Vector *org, Vector *angles, str *animation, int *loopcount, str *state, str *camera Entity *activator, Vector *org, Vector *angles, str *animation, int *loopcount, str *state, str *camera
) )
{ {
Entity *dest; Entity *dest;
UseAnimDestination *uadest; UseAnimDestination *uadest;
@ -1257,6 +1282,7 @@ bool UseAnim::GetInformation(
} }
void UseAnim::TriggerTargets(Entity *activator) void UseAnim::TriggerTargets(Entity *activator)
{ {
// //
// fire off our trigger target if appropriate // fire off our trigger target if appropriate
@ -1286,6 +1312,7 @@ void UseAnim::TriggerTargets(Entity *activator)
} }
void UseAnim::Reset(Event *ev) void UseAnim::Reset(Event *ev)
{ {
// //
// find out if our triggertarget is of type door and only reset if the door is closed // find out if our triggertarget is of type door and only reset if the door is closed
@ -1336,21 +1363,25 @@ void UseAnim::Reset(Event *ev)
} }
void UseAnim::SetThread(Event *ev) void UseAnim::SetThread(Event *ev)
{ {
thread.SetThread(ev->GetValue(1)); thread.SetThread(ev->GetValue(1));
} }
void UseAnim::SetDelay(Event *ev) void UseAnim::SetDelay(Event *ev)
{ {
delay = ev->GetFloat(1); delay = ev->GetFloat(1);
} }
void UseAnim::SetTriggerTarget(Event *ev) void UseAnim::SetTriggerTarget(Event *ev)
{ {
triggertarget = ev->GetString(1); triggertarget = ev->GetString(1);
} }
void UseAnim::SetCount(Event *ev) void UseAnim::SetCount(Event *ev)
{ {
count = ev->GetInteger(1); count = ev->GetInteger(1);
} }
@ -1487,7 +1518,6 @@ Event EV_UseObject_StopThread
"label", "label",
"Sets which stop thread to use when this UseObject is finished.", "Sets which stop thread to use when this UseObject is finished.",
EV_NORMAL EV_NORMAL
); );
Event EV_UseObject_ResetThread Event EV_UseObject_ResetThread
( (
@ -1497,7 +1527,6 @@ Event EV_UseObject_ResetThread
"label", "label",
"Sets which thread to call when resetting.", "Sets which thread to call when resetting.",
EV_NORMAL EV_NORMAL
); );
Event EV_UseObject_Count Event EV_UseObject_Count
( (
@ -1507,7 +1536,6 @@ Event EV_UseObject_Count
"newCount", "newCount",
"Sets how many times the UseObject can be triggered.", "Sets how many times the UseObject can be triggered.",
EV_NORMAL EV_NORMAL
); );
Event EV_UseObject_Cone Event EV_UseObject_Cone
( (
@ -1517,7 +1545,6 @@ Event EV_UseObject_Cone
"newCone", "newCone",
"Sets the cone in angles of where the Useobject can be used.", "Sets the cone in angles of where the Useobject can be used.",
EV_NORMAL EV_NORMAL
); );
Event EV_UseObject_Offset Event EV_UseObject_Offset
( (
@ -1527,7 +1554,6 @@ Event EV_UseObject_Offset
"newOffset", "newOffset",
"Sets the offset to use for this UseObject.", "Sets the offset to use for this UseObject.",
EV_NORMAL EV_NORMAL
); );
Event EV_UseObject_YawOffset Event EV_UseObject_YawOffset
( (
@ -1537,7 +1563,6 @@ Event EV_UseObject_YawOffset
"newYawOffset", "newYawOffset",
"Sets the yaw offset to use for this UseObject.", "Sets the yaw offset to use for this UseObject.",
EV_NORMAL EV_NORMAL
); );
Event EV_UseObject_State Event EV_UseObject_State
( (
@ -1556,7 +1581,6 @@ Event EV_UseObject_StateBackwards
"newState", "newState",
"Sets the backward state to use for this UseObject.", "Sets the backward state to use for this UseObject.",
EV_NORMAL EV_NORMAL
); );
Event EV_UseObject_TriggerTarget Event EV_UseObject_TriggerTarget
( (
@ -1602,7 +1626,6 @@ Event EV_UseObject_Resetting
NULL, NULL,
"Intermediate function for useobject reset.", "Intermediate function for useobject reset.",
EV_NORMAL EV_NORMAL
); );
Event EV_UseObject_DamageTriggered Event EV_UseObject_DamageTriggered
( (
@ -1639,7 +1662,6 @@ Event EV_UseObject_UseMaterial
"nameOfUseMaterial", "nameOfUseMaterial",
"the name of the material that glows when active.", "the name of the material that glows when active.",
EV_NORMAL EV_NORMAL
); );
Event EV_UseObject_SetActiveState Event EV_UseObject_SetActiveState
( (
@ -1649,7 +1671,6 @@ Event EV_UseObject_SetActiveState
NULL, NULL,
"event that sets up the proper skin for the useobject.", "event that sets up the proper skin for the useobject.",
EV_NORMAL EV_NORMAL
); );
#define MULTI_STATE (1 << 0) #define MULTI_STATE (1 << 0)
@ -1800,73 +1821,87 @@ void UseObject::SetActiveState(Event *ev)
} }
void UseObject::SetMoveThread(Event *ev) void UseObject::SetMoveThread(Event *ev)
{ {
move_thread.SetThread(ev->GetValue(1)); move_thread.SetThread(ev->GetValue(1));
} }
void UseObject::SetStopThread(Event *ev) void UseObject::SetStopThread(Event *ev)
{ {
stop_thread.SetThread(ev->GetValue(1)); stop_thread.SetThread(ev->GetValue(1));
} }
void UseObject::SetResetThread(Event *ev) void UseObject::SetResetThread(Event *ev)
{ {
reset_thread.SetThread(ev->GetValue(1)); reset_thread.SetThread(ev->GetValue(1));
} }
void UseObject::ActivateEvent(Event *ev) void UseObject::ActivateEvent(Event *ev)
{ {
active = qtrue; active = qtrue;
PostEvent(EV_UseObject_SetActiveState, 0); PostEvent(EV_UseObject_SetActiveState, 0);
} }
void UseObject::DeactivateEvent(Event *ev) void UseObject::DeactivateEvent(Event *ev)
{ {
active = qfalse; active = qfalse;
PostEvent(EV_UseObject_SetActiveState, 0); PostEvent(EV_UseObject_SetActiveState, 0);
} }
void UseObject::SetTriggerTarget(Event *ev) void UseObject::SetTriggerTarget(Event *ev)
{ {
triggertarget = ev->GetString(1); triggertarget = ev->GetString(1);
} }
void UseObject::SetOffset(Event *ev) void UseObject::SetOffset(Event *ev)
{ {
offset = ev->GetVector(1); offset = ev->GetVector(1);
} }
void UseObject::SetYawOffset(Event *ev) void UseObject::SetYawOffset(Event *ev)
{ {
yaw_offset = ev->GetFloat(1); yaw_offset = ev->GetFloat(1);
} }
void UseObject::SetCount(Event *ev) void UseObject::SetCount(Event *ev)
{ {
count = ev->GetInteger(1); count = ev->GetInteger(1);
} }
void UseObject::SetCone(Event *ev) void UseObject::SetCone(Event *ev)
{ {
cone = cos(DEG2RAD(ev->GetFloat(1))); cone = cos(DEG2RAD(ev->GetFloat(1)));
} }
void UseObject::SetState(Event *ev) void UseObject::SetState(Event *ev)
{ {
state = ev->GetString(1); state = ev->GetString(1);
} }
void UseObject::SetBackwardsState(Event *ev) void UseObject::SetBackwardsState(Event *ev)
{ {
state_backwards = ev->GetString(1); state_backwards = ev->GetString(1);
} }
void UseObject::UseMaterialEvent(Event *ev) void UseObject::UseMaterialEvent(Event *ev)
{ {
useMaterial = ev->GetString(1); useMaterial = ev->GetString(1);
} }
void UseObject::SetResetTime(Event *ev) void UseObject::SetResetTime(Event *ev)
{ {
reset_time = ev->GetFloat(1); reset_time = ev->GetFloat(1);
} }
@ -1877,6 +1912,7 @@ void UseObject::Reset(Event *ev)
} }
void UseObject::Resetting(Event *ev) void UseObject::Resetting(Event *ev)
{ {
SetActiveState(NULL); SetActiveState(NULL);
NewAnim("start"); NewAnim("start");
@ -1912,6 +1948,7 @@ void UseObject::Resetting(Event *ev)
} }
bool UseObject::canBeUsed(Vector org, Vector dir) bool UseObject::canBeUsed(Vector org, Vector dir)
{ {
float dot; float dot;
Vector forward; Vector forward;
@ -1955,6 +1992,7 @@ bool UseObject::canBeUsed(Vector org, Vector dir)
} }
void UseObject::DamageFunc(Event *ev) void UseObject::DamageFunc(Event *ev)
{ {
Event *e; Event *e;
Entity *attacker; Entity *attacker;
@ -1991,12 +2029,14 @@ void UseObject::DamageFunc(Event *ev)
} }
void UseObject::DamageTriggered(Event *ev) void UseObject::DamageTriggered(Event *ev)
{ {
// grab the attacker from our event // grab the attacker from our event
Stop(ev->GetEntity(1)); Stop(ev->GetEntity(1));
} }
void UseObject::Setup(Entity *activator, Vector *org, Vector *ang, str *newstate) void UseObject::Setup(Entity *activator, Vector *org, Vector *ang, str *newstate)
{ {
if ((spawnflags & MULTI_STATE) && objectState) { if ((spawnflags & MULTI_STATE) && objectState) {
*newstate = state_backwards; *newstate = state_backwards;
@ -2020,6 +2060,7 @@ void UseObject::Setup(Entity *activator, Vector *org, Vector *ang, str *newstate
} }
void UseObject::Start(Event *ev) void UseObject::Start(Event *ev)
{ {
// //
// fire off the move_thread // fire off the move_thread
@ -2038,6 +2079,7 @@ void UseObject::Start(Event *ev)
} }
bool UseObject::Loop(void) bool UseObject::Loop(void)
{ {
if (!count) { if (!count) {
return qfalse; return qfalse;
@ -2047,6 +2089,7 @@ bool UseObject::Loop(void)
} }
void UseObject::Stop(Entity *activator) void UseObject::Stop(Entity *activator)
{ {
if ((spawnflags & MULTI_STATE) && objectState) { if ((spawnflags & MULTI_STATE) && objectState) {
NewAnim("start"); NewAnim("start");
@ -2179,6 +2222,7 @@ MonkeyBars::MonkeyBars()
} }
void MonkeyBars::SetAngleEvent(Event *ev) void MonkeyBars::SetAngleEvent(Event *ev)
{ {
dir = ev->GetFloat(1); dir = ev->GetFloat(1);
} }
@ -2208,6 +2252,7 @@ HorizontalPipe::HorizontalPipe()
} }
void HorizontalPipe::SetAngleEvent(Event *ev) void HorizontalPipe::SetAngleEvent(Event *ev)
{ {
dir = ev->GetFloat(1); dir = ev->GetFloat(1);
} }
@ -2218,15 +2263,14 @@ void HorizontalPipe::SetAngleEvent(Event *ev)
Event EV_TossObject_SetBounceSound Event EV_TossObject_SetBounceSound
( (
"bouncesound", "bouncesound", EV_DEFAULT,
EV_DEFAULT,
"s", "s",
"sound", "sound",
"When bouncing, what sound to play on impact", "When bouncing, what sound to play on impact",
EV_NORMAL EV_NORMAL
); );
Event EV_TossObject_SetBounceSoundChance( Event EV_TossObject_SetBounceSoundChance
(
"bouncesoundchance", "bouncesoundchance",
EV_DEFAULT, EV_DEFAULT,
"f[0,1]", "f[0,1]",
@ -2265,26 +2309,31 @@ TossObject::TossObject(str model)
} }
void TossObject::SetBounceSound(str bounce) void TossObject::SetBounceSound(str bounce)
{ {
bouncesound = bounce; bouncesound = bounce;
} }
void TossObject::SetBounceSound(Event *ev) void TossObject::SetBounceSound(Event *ev)
{ {
bouncesound = ev->GetString(1); bouncesound = ev->GetString(1);
} }
void TossObject::SetBounceSoundChance(float chance) void TossObject::SetBounceSoundChance(float chance)
{ {
bouncesoundchance = chance; bouncesoundchance = chance;
} }
void TossObject::SetBounceSoundChance(Event *ev) void TossObject::SetBounceSoundChance(Event *ev)
{ {
bouncesoundchance = ev->GetFloat(1); bouncesoundchance = ev->GetFloat(1);
} }
void TossObject::Stop(Event *ev) void TossObject::Stop(Event *ev)
{ {
setMoveType(MOVETYPE_NONE); setMoveType(MOVETYPE_NONE);
setSolidType(SOLID_NOT); setSolidType(SOLID_NOT);
@ -2296,6 +2345,7 @@ void TossObject::Stop(Event *ev)
} }
void TossObject::Touch(Event *ev) void TossObject::Touch(Event *ev)
{ {
Entity *ent; Entity *ent;
@ -2318,6 +2368,7 @@ void TossObject::Touch(Event *ev)
} }
void TossObject::SetVelocity(float severity) void TossObject::SetVelocity(float severity)
{ {
setSolidType(SOLID_BBOX); setSolidType(SOLID_BBOX);
velocity[0] = 100.0 * crandom(); velocity[0] = 100.0 * crandom();
@ -2362,7 +2413,8 @@ Pushable object
Event EV_PushObject_Start Event EV_PushObject_Start
( (
"start", EV_DEFAULT, "start",
EV_DEFAULT,
NULL, NULL,
NULL, NULL,
"Sets up the pushobject.", "Sets up the pushobject.",
@ -2371,7 +2423,8 @@ Event EV_PushObject_Start
Event EV_PushObject_SetDamage Event EV_PushObject_SetDamage
( (
"dmg", EV_DEFAULT, "dmg",
EV_DEFAULT,
"i", "i",
"damage", "damage",
"Set the damage.", "Set the damage.",
@ -2380,7 +2433,8 @@ Event EV_PushObject_SetDamage
Event EV_PushObject_SetPushSound Event EV_PushObject_SetPushSound
( (
"pushsound", EV_DEFAULT, "pushsound",
EV_DEFAULT,
"s", "s",
"sound", "sound",
"Set the pushing sound", "Set the pushing sound",
@ -2410,11 +2464,13 @@ PushObject::PushObject()
} }
void PushObject::SetPushSound(Event *ev) void PushObject::SetPushSound(Event *ev)
{ {
pushsound = ev->GetString(1); pushsound = ev->GetString(1);
} }
void PushObject::Start(Event *ev) void PushObject::Start(Event *ev)
{ {
// make sure that this touches triggers // make sure that this touches triggers
flags |= FL_TOUCH_TRIGGERS; flags |= FL_TOUCH_TRIGGERS;
@ -2427,6 +2483,7 @@ void PushObject::Start(Event *ev)
} }
qboolean PushObject::canPush(Vector dir) qboolean PushObject::canPush(Vector dir)
{ {
trace_t trace; trace_t trace;
@ -2437,6 +2494,7 @@ qboolean PushObject::canPush(Vector dir)
} }
qboolean PushObject::Push(Entity *pusher, Vector move) qboolean PushObject::Push(Entity *pusher, Vector move)
{ {
trace_t trace; trace_t trace;
@ -2466,11 +2524,13 @@ qboolean PushObject::Push(Entity *pusher, Vector move)
} }
Entity *PushObject::getOwner(void) Entity *PushObject::getOwner(void)
{ {
return (Entity *)owner; return (Entity *)owner;
} }
void PushObject::BlockFunc(Event *ev) void PushObject::BlockFunc(Event *ev)
{ {
Entity *other; Entity *other;
@ -2484,6 +2544,7 @@ void PushObject::BlockFunc(Event *ev)
} }
void PushObject::SetDamage(Event *ev) void PushObject::SetDamage(Event *ev)
{ {
dmg = ev->GetInteger(1); dmg = ev->GetInteger(1);
} }
@ -2571,7 +2632,6 @@ Event EV_FallingRock_SetBounceSound
"sound", "sound",
"Set the sound to play when the rock bounces", "Set the sound to play when the rock bounces",
EV_NORMAL EV_NORMAL
); );
CLASS_DECLARATION(Entity, FallingRock, "func_fallingrock") { CLASS_DECLARATION(Entity, FallingRock, "func_fallingrock") {
@ -2606,6 +2666,7 @@ FallingRock::FallingRock()
} }
Entity *FallingRock::SetNextBounceDir(void) Entity *FallingRock::SetNextBounceDir(void)
{ {
Entity *ent; Entity *ent;
@ -2625,6 +2686,7 @@ Entity *FallingRock::SetNextBounceDir(void)
} }
void FallingRock::NextBounce(void) void FallingRock::NextBounce(void)
{ {
float time; float time;
float distance; float distance;
@ -2667,6 +2729,7 @@ void FallingRock::NextBounce(void)
} }
void FallingRock::Rotate(Event *ev) void FallingRock::Rotate(Event *ev)
{ {
float mat[3][3]; float mat[3][3];
float ang; float ang;
@ -2684,16 +2747,19 @@ void FallingRock::Rotate(Event *ev)
} }
void FallingRock::SetWait(Event *ev) void FallingRock::SetWait(Event *ev)
{ {
wait = ev->GetFloat(1); wait = ev->GetFloat(1);
} }
void FallingRock::SetSpeed(Event *ev) void FallingRock::SetSpeed(Event *ev)
{ {
speed = ev->GetFloat(1); speed = ev->GetFloat(1);
} }
void FallingRock::SetDmg(Event *ev) void FallingRock::SetDmg(Event *ev)
{ {
dmg = ev->GetInteger(1); dmg = ev->GetInteger(1);
} }
@ -2706,11 +2772,13 @@ void FallingRock::SetBounceSound(str sound)
} }
void FallingRock::SetBounceSound(Event *ev) void FallingRock::SetBounceSound(Event *ev)
{ {
SetBounceSound(ev->GetString(1)); SetBounceSound(ev->GetString(1));
} }
void FallingRock::Activate(Event *ev) void FallingRock::Activate(Event *ev)
{ {
if (active == 1) { if (active == 1) {
return; return;
@ -2734,6 +2802,7 @@ void FallingRock::Activate(Event *ev)
} }
void FallingRock::StartFalling(Event *ev) void FallingRock::StartFalling(Event *ev)
{ {
if (current) { if (current) {
return; return;
@ -2758,6 +2827,7 @@ void FallingRock::StartFalling(Event *ev)
} }
void FallingRock::Touch(Event *ev) void FallingRock::Touch(Event *ev)
{ {
Entity *other; Entity *other;
@ -2788,6 +2858,7 @@ void FallingRock::Touch(Event *ev)
} }
void FallingRock::Bounce(Event *ev) void FallingRock::Bounce(Event *ev)
{ {
Vector delta; Vector delta;
@ -3023,7 +3094,7 @@ void FuncLadder::AdjustPositionOnLadder(Entity *pUser)
); );
} }
pUser->setOrigin(trace.endpos); pUser->setOrigin(trace.endpos + m_vFacingDir * 0.005);
} }
void FuncLadder::EnsureOverLadder(Entity *pUser) void FuncLadder::EnsureOverLadder(Entity *pUser)
@ -3084,19 +3155,10 @@ void FuncLadder::EnsureForwardOffLadder(Entity *pUser)
pUser->setOrigin(trace.endpos); pUser->setOrigin(trace.endpos);
} }
const Vector& FuncLadder::getFacingAngles() const
{
return m_vFacingAngles;
}
const Vector& FuncLadder::getFacingDir() const
{
return m_vFacingDir;
}
Event EV_InfoLandmark_Name Event EV_InfoLandmark_Name
( (
"landmark_name", EV_DEFAULT, "landmark_name",
EV_DEFAULT,
"s", "s",
"name", "name",
"Set the name of this landmark", "Set the name of this landmark",
@ -3104,7 +3166,8 @@ Event EV_InfoLandmark_Name
); );
Event EV_InfoLandmark_SetOrigin Event EV_InfoLandmark_SetOrigin
( (
"origin", EV_DEFAULT, "origin",
EV_DEFAULT,
"v", "v",
"origin", "origin",
"Set the origin of the landmark.", "Set the origin of the landmark.",

View file

@ -1,6 +1,6 @@
/* /*
=========================================================================== ===========================================================================
Copyright (C) 2025 the OpenMoHAA team Copyright (C) 2023 the OpenMoHAA team
This file is part of OpenMoHAA source code. This file is part of OpenMoHAA source code.
@ -565,9 +565,6 @@ public:
void EnsureOverLadder(Entity *pUser); void EnsureOverLadder(Entity *pUser);
void EnsureForwardOffLadder(Entity *pUser); void EnsureForwardOffLadder(Entity *pUser);
const Vector& getFacingAngles() const;
const Vector& getFacingDir() const;
void Archive(Archiver& arc) override; void Archive(Archiver& arc) override;
}; };

View file

@ -1,6 +1,6 @@
/* /*
=========================================================================== ===========================================================================
Copyright (C) 2025 the OpenMoHAA team Copyright (C) 2015 the OpenMoHAA team
This file is part of OpenMoHAA source code. This file is part of OpenMoHAA source code.
@ -35,19 +35,26 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
#define MOVE_ANGLES 1 #define MOVE_ANGLES 1
#define MOVE_ORIGIN 2 #define MOVE_ORIGIN 2
CLASS_DECLARATION(Trigger, Mover, "mover") { CLASS_DECLARATION( Trigger, Mover, "mover" )
{
{ &EV_MoveDone, &Mover::MoveDone }, { &EV_MoveDone, &Mover::MoveDone },
{ NULL, NULL } { NULL, NULL }
}; };
Mover::Mover() Mover::Mover()
{ {
endevent = NULL; endevent = NULL;
} }
Mover::~Mover() {} Mover::~Mover()
{
}
void Mover::MoveDone(Event *ev) void Mover::MoveDone
(
Event *ev
)
{ {
Event * event; Event * event;
Vector move; Vector move;
@ -55,51 +62,57 @@ void Mover::MoveDone(Event *ev)
// zero out the movement // zero out the movement
avelocity = vec_zero; avelocity = vec_zero;
if (moveflags & MOVE_ANGLES) { if( moveflags & MOVE_ANGLES )
{
amove = angledest - localangles; amove = angledest - localangles;
} else { }
else
{
amove = vec_zero; amove = vec_zero;
} }
velocity = vec_zero; velocity = vec_zero;
if (moveflags & MOVE_ORIGIN) { if( moveflags & MOVE_ORIGIN )
{
move = finaldest - localorigin; move = finaldest - localorigin;
} else { }
else
{
move = vec_zero; move = vec_zero;
} }
accel = vec_zero; accel = vec_zero;
aaccel = vec_zero; aaccel = vec_zero;
if (!G_PushMove(this, move, amove)) { if( !G_PushMove( this, move, amove ) )
// Added in OPM {
// Check to make sure the event isn't pending
// blocked events called by G_PushMove() might alter
// the mover
if (!EventPending(EV_MoveDone)) {
// Delay finish till we can move into the final position // Delay finish till we can move into the final position
PostEvent( EV_MoveDone, FRAMETIME ); PostEvent( EV_MoveDone, FRAMETIME );
}
return; return;
} }
// //
// After moving, set origin to exact final destination // After moving, set origin to exact final destination
// //
if (moveflags & MOVE_ORIGIN) { if( moveflags & MOVE_ORIGIN )
{
setLocalOrigin( finaldest ); setLocalOrigin( finaldest );
} }
if (moveflags & MOVE_ANGLES) { if( moveflags & MOVE_ANGLES )
{
localangles = angledest; localangles = angledest;
if ((localangles.x >= 360) || (localangles.x < 0)) { if( ( localangles.x >= 360 ) || ( localangles.x < 0 ) )
{
localangles.x -= ( ( int )localangles.x / 360 ) * 360; localangles.x -= ( ( int )localangles.x / 360 ) * 360;
} }
if ((localangles.y >= 360) || (localangles.y < 0)) { if( ( localangles.y >= 360 ) || ( localangles.y < 0 ) )
{
localangles.y -= ( ( int )localangles.y / 360 ) * 360; localangles.y -= ( ( int )localangles.y / 360 ) * 360;
} }
if ((localangles.z >= 360) || (localangles.z < 0)) { if( ( localangles.z >= 360 ) || ( localangles.z < 0 ) )
{
localangles.z -= ( ( int )localangles.z / 360 ) * 360; localangles.z -= ( ( int )localangles.z / 360 ) * 360;
} }
} }
@ -107,10 +120,9 @@ void Mover::MoveDone(Event *ev)
event = endevent; event = endevent;
endevent = NULL; endevent = NULL;
if (event) { if( event )
ProcessEvent( event ); ProcessEvent( event );
} }
}
/* /*
============= =============
@ -129,11 +141,13 @@ void Mover::MoveTo(Vector tdest, Vector angdest, float tspeed, Event& event)
assert( tspeed >= 0.0f ); assert( tspeed >= 0.0f );
if (!tspeed) { if( !tspeed )
{
error( "MoveTo", "No speed is defined!" ); error( "MoveTo", "No speed is defined!" );
} }
if (tspeed < 0.0f) { if( tspeed < 0.0f )
{
error( "MoveTo", "Speed is negative!" ); error( "MoveTo", "Speed is negative!" );
} }
@ -142,7 +156,8 @@ void Mover::MoveTo(Vector tdest, Vector angdest, float tspeed, Event& event)
moveflags = 0; moveflags = 0;
if (endevent) { if( endevent )
{
delete endevent; delete endevent;
} }
@ -151,14 +166,17 @@ void Mover::MoveTo(Vector tdest, Vector angdest, float tspeed, Event& event)
finaldest = tdest; finaldest = tdest;
angledest = angdest; angledest = angdest;
if (finaldest != localorigin) { if( finaldest != localorigin )
{
moveflags |= MOVE_ORIGIN; moveflags |= MOVE_ORIGIN;
} }
if (angledest != localangles) { if( angledest != localangles )
{
moveflags |= MOVE_ANGLES; moveflags |= MOVE_ANGLES;
} }
if (!moveflags) { if( !moveflags )
{
// stop the object from moving // stop the object from moving
velocity = vec_zero; velocity = vec_zero;
avelocity = vec_zero; avelocity = vec_zero;
@ -174,10 +192,13 @@ void Mover::MoveTo(Vector tdest, Vector angdest, float tspeed, Event& event)
angdestdelta[ 1 ] = angledist( angdest[ 1 ] - localangles[ 1 ] ); angdestdelta[ 1 ] = angledist( angdest[ 1 ] - localangles[ 1 ] );
angdestdelta[ 2 ] = angledist( angdest[ 2 ] - localangles[ 2 ] ); angdestdelta[ 2 ] = angledist( angdest[ 2 ] - localangles[ 2 ] );
if (tdest == localorigin) { if( tdest == localorigin )
{
// calculate length of vector based on angles // calculate length of vector based on angles
len = angdestdelta.length(); len = angdestdelta.length();
} else { }
else
{
// calculate length of vector based on distance // calculate length of vector based on distance
len = vdestdelta.length(); len = vdestdelta.length();
} }
@ -185,18 +206,21 @@ void Mover::MoveTo(Vector tdest, Vector angdest, float tspeed, Event& event)
// divide by speed to get time to reach dest // divide by speed to get time to reach dest
traveltime = len / tspeed; traveltime = len / tspeed;
if (traveltime < level.frametime) { if( traveltime < level.frametime )
{
traveltime = level.frametime; traveltime = level.frametime;
vdestdelta = vec_zero; vdestdelta = vec_zero;
angdestdelta = vec_zero; angdestdelta = vec_zero;
} }
// scale the destdelta vector by the time spent traveling to get velocity // scale the destdelta vector by the time spent traveling to get velocity
if (moveflags & MOVE_ORIGIN) { if( moveflags & MOVE_ORIGIN )
{
velocity = vdestdelta * ( 1.0f / traveltime ); velocity = vdestdelta * ( 1.0f / traveltime );
} }
if (moveflags & MOVE_ANGLES) { if( moveflags & MOVE_ANGLES )
{
avelocity = angdestdelta * ( 1.0f / traveltime ); avelocity = angdestdelta * ( 1.0f / traveltime );
} }
@ -208,13 +232,20 @@ void Mover::MoveTo(Vector tdest, Vector angdest, float tspeed, Event& event)
LinearInterpolate LinearInterpolate
=============== ===============
*/ */
void Mover::LinearInterpolate(Vector tdest, Vector angdest, float time, Event& event) void Mover::LinearInterpolate
(
Vector tdest,
Vector angdest,
float time,
Event &event
)
{ {
Vector vdestdelta; Vector vdestdelta;
Vector angdestdelta; Vector angdestdelta;
float t; float t;
if (endevent) { if( endevent )
{
delete endevent; delete endevent;
} }
endevent = new Event( event ); endevent = new Event( event );
@ -225,49 +256,31 @@ void Mover::LinearInterpolate(Vector tdest, Vector angdest, float time, Event& e
CancelEventsOfType( EV_MoveDone ); CancelEventsOfType( EV_MoveDone );
// Quantize to FRAMETIME // Quantize to FRAMETIME
if (time < FRAMETIME) { if( time < FRAMETIME )
{
time = FRAMETIME; time = FRAMETIME;
} }
moveflags = 0; moveflags = 0;
t = 1 / time; t = 1 / time;
// scale the destdelta vector by the time spent traveling to get velocity // scale the destdelta vector by the time spent traveling to get velocity
if (finaldest != localorigin) { if( finaldest != localorigin )
{
vdestdelta = tdest - localorigin; vdestdelta = tdest - localorigin;
velocity = vdestdelta * t; velocity = vdestdelta * t;
moveflags |= MOVE_ORIGIN; moveflags |= MOVE_ORIGIN;
} }
if (angledest != localangles) { if( angledest != localangles )
{
angdestdelta = angdest - localangles; angdestdelta = angdest - localangles;
avelocity = angdestdelta * t; avelocity = angdestdelta * t;
moveflags |= MOVE_ANGLES; moveflags |= MOVE_ANGLES;
} }
if (g_bBeforeThinks) { if( g_bBeforeThinks )
time -= FRAMETIME; time -= FRAMETIME;
}
PostEvent( EV_MoveDone, time ); PostEvent( EV_MoveDone, time );
} }
/*
=============
Stop
===============
*/
void Mover::Stop()
{
if (endevent) {
delete endevent;
endevent = NULL;
}
CancelEventsOfType(EV_MoveDone);
moveflags = 0;
avelocity = vec_zero;
velocity = vec_zero;
accel = vec_zero;
aaccel = vec_zero;
}

View file

@ -1,6 +1,6 @@
/* /*
=========================================================================== ===========================================================================
Copyright (C) 2025 the OpenMoHAA team Copyright (C) 2024 the OpenMoHAA team
This file is part of OpenMoHAA source code. This file is part of OpenMoHAA source code.
@ -48,11 +48,13 @@ public:
void MoveDone( Event *ev ); void MoveDone( Event *ev );
void MoveTo( Vector tdest, Vector angdest, float tspeed, Event &event ); void MoveTo( Vector tdest, Vector angdest, float tspeed, Event &event );
void LinearInterpolate( Vector tdest, Vector angdest, float time, Event &event ); void LinearInterpolate( Vector tdest, Vector angdest, float time, Event &event );
void Stop();
void Archive( Archiver &arc ) override; void Archive( Archiver &arc ) override;
}; };
inline void Mover::Archive(Archiver& arc) inline void Mover::Archive
(
Archiver &arc
)
{ {
Trigger::Archive( arc ); Trigger::Archive( arc );

View file

@ -1001,7 +1001,7 @@ PathNode *PathSearch::FindCornerNodeForWall(
PathNode *PathSearch::FindCornerNodeForExactPath(Entity *pSelf, Sentient *enemy, float fMaxPath) PathNode *PathSearch::FindCornerNodeForExactPath(Entity *pSelf, Sentient *enemy, float fMaxPath)
{ {
PathNode *pPathNode[MAX_PATHNODES]; PathNode *pPathNode[4096];
PathNode *pParentNode; PathNode *pParentNode;
size_t i, iDepth; size_t i, iDepth;
Vector vEnd; Vector vEnd;
@ -1554,7 +1554,7 @@ void DrawNode(int iNodeCount)
Vector aStart; Vector aStart;
Vector aEnd; Vector aEnd;
PathNode *node; PathNode *node;
PathNode *nodelist[MAX_PATHNODES]; PathNode *nodelist[4096];
Vector end; Vector end;
Vector start; Vector start;
Vector p; Vector p;
@ -1562,8 +1562,8 @@ void DrawNode(int iNodeCount)
playerorigin = g_entities[0].client->ps.origin; playerorigin = g_entities[0].client->ps.origin;
if (iNodeCount > MAX_PATHNODES) { if (iNodeCount > 4096) {
iNodeCount = MAX_PATHNODES; iNodeCount = 4096;
} }
if (ai_showallnode->integer) { if (ai_showallnode->integer) {
@ -2500,10 +2500,7 @@ PathNode *PathSearch::FindNearestSniperNode(Entity*pEnt, Vector& vPos, Entity *p
PathNode *PathSearch::GetSpawnNode(ClassDef *cls) PathNode *PathSearch::GetSpawnNode(ClassDef *cls)
{ {
if (m_bNodesloaded if (m_bNodesloaded) {
// Fixed in OPM
&& m_LoadIndex < nodecount
) {
return pathnodes[m_LoadIndex++]; return pathnodes[m_LoadIndex++];
} else { } else {
// Otherwise create a new node // Otherwise create a new node

View file

@ -252,7 +252,7 @@ private:
static int m_LoadIndex; static int m_LoadIndex;
public: public:
static PathNode *pathnodes[MAX_PATHNODES]; static PathNode *pathnodes[4096];
static int nodecount; static int nodecount;
static float total_dist; static float total_dist;
static const char *last_error; static const char *last_error;

View file

@ -58,13 +58,6 @@ const Vector power_color(0.0, 1.0, 0.0);
const Vector acolor(1.0, 1.0, 1.0); const Vector acolor(1.0, 1.0, 1.0);
const Vector bcolor(1.0, 0.0, 0.0); const Vector bcolor(1.0, 0.0, 0.0);
ScriptDelegate Player::scriptDelegate_connected("player_connected", "Sent once when the player connected");
ScriptDelegate Player::scriptDelegate_disconnecting("player_disconnecting", "The player is disconnecting");
ScriptDelegate Player::scriptDelegate_spawned("player_spawned", "The player has spawned");
ScriptDelegate Player::scriptDelegate_damage("player_damaged", "The player got hit");
ScriptDelegate Player::scriptDelegate_kill("player_killed", "The player got killed");
ScriptDelegate Player::scriptDelegate_textMessage("player_textMessage", "The player just sent a text message");
// //
// mohaas 2.0 and above // mohaas 2.0 and above
// //
@ -1911,6 +1904,7 @@ CLASS_DECLARATION(Sentient, Player, "player") {
{&EV_Player_AdminRights, &Player::AdminRights }, {&EV_Player_AdminRights, &Player::AdminRights },
{&EV_Player_BindWeap, &Player::BindWeap }, {&EV_Player_BindWeap, &Player::BindWeap },
{&EV_Player_Dive, &Player::Dive }, {&EV_Player_Dive, &Player::Dive },
{&EV_Player_DMMessage, &Player::EventDMMessage },
{&EV_Player_FreezeControls, &Player::FreezeControls }, {&EV_Player_FreezeControls, &Player::FreezeControls },
{&EV_Player_SetTeam, &Player::EventSetTeam }, {&EV_Player_SetTeam, &Player::EventSetTeam },
{&EV_Player_GetConnState, &Player::GetConnState }, {&EV_Player_GetConnState, &Player::GetConnState },
@ -2215,12 +2209,6 @@ Player::~Player()
// when the player is deleted // when the player is deleted
RemoveFromVehiclesAndTurrets(); RemoveFromVehiclesAndTurrets();
// Added in OPM
// Remove the player at destructor
if (g_gametype->integer != GT_SINGLE_PLAYER && dmManager.PlayerCount()) {
dmManager.RemovePlayer(this);
}
entflags &= ~ECF_PLAYER; entflags &= ~ECF_PLAYER;
} }
@ -2270,8 +2258,6 @@ void Player::Init(void)
Event *ev = new Event; Event *ev = new Event;
ev->AddEntity(this); ev->AddEntity(this);
scriptDelegate_connected.Trigger(this, *ev);
scriptedEvents[SE_CONNECTED].Trigger(ev); scriptedEvents[SE_CONNECTED].Trigger(ev);
} }
@ -2427,12 +2413,6 @@ void Player::InitHealth(void)
// //
m_fHealRate = 0; m_fHealRate = 0;
edict->s.eFlags &= ~EF_DEAD; edict->s.eFlags &= ~EF_DEAD;
// Fixed in OPM
// This avoid losing weapons when dying and then immediately respawning
CancelEventsOfType(EV_Player_DMDeathDrop);
// And this prevents the player from dying when respawning immediately after getting killed
CancelEventsOfType(EV_Player_Dead);
} }
void Player::InitModel(void) void Player::InitModel(void)
@ -2677,11 +2657,6 @@ void Player::ChooseSpawnPoint(void)
void Player::EndLevel(Event *ev) void Player::EndLevel(Event *ev)
{ {
if (IsDead()) {
ScriptError("cannot do player.endlevel if the player is dead");
return;
}
InitPowerups(); InitPowerups();
if (health > max_health) { if (health > max_health) {
health = max_health; health = max_health;
@ -3225,7 +3200,6 @@ void Player::Killed(Event *ev)
event->AddInteger(ev->GetInteger(10)); event->AddInteger(ev->GetInteger(10));
event->AddEntity(this); event->AddEntity(this);
scriptDelegate_kill.Trigger(this, *event);
scriptedEvents[SE_KILL].Trigger(event); scriptedEvents[SE_KILL].Trigger(event);
Unregister(STRING_DEATH); Unregister(STRING_DEATH);
@ -4083,9 +4057,9 @@ void Player::ClientMove(usercmd_t *ucmd)
// Also use the weapon movement speed // Also use the weapon movement speed
// //
if (!IsZoomed()) { if (!IsZoomed()) {
client->ps.speed = (float)client->ps.speed * pWeap->GetMovementSpeed(); client->ps.speed = (float)client->ps.speed * pWeap->m_fMovementSpeed;
} else { } else {
client->ps.speed = (float)client->ps.speed * pWeap->GetZoomMovement(); client->ps.speed = (float)client->ps.speed * pWeap->m_fZoomMovement * pWeap->m_fMovementSpeed;
} }
} }
} }
@ -4276,7 +4250,7 @@ void Player::ClientInactivityTimer(void)
// //
// The player reached maximum team kills // The player reached maximum team kills
// //
G_PrintToAllClients(va("%s %s\n", client->pers.netname, message.c_str()), 2); G_PrintToAllClients(va("%s %s", client->pers.netname, message.c_str()), qfalse);
if (Q_stricmp(Info_ValueForKey(client->pers.userinfo, "ip"), "localhost")) { if (Q_stricmp(Info_ValueForKey(client->pers.userinfo, "ip"), "localhost")) {
// //
@ -4768,7 +4742,7 @@ void Player::Think(void)
} }
} else { } else {
if ((server_new_buttons & BUTTON_USE)) { if ((server_new_buttons & BUTTON_USE)) {
SetPlayerSpectate(true); SetPlayerSpectateRandom();
} }
} }
@ -4827,7 +4801,7 @@ void Player::Think(void)
} }
if (!IsDead()) { if (!IsDead()) {
m_iClientWeaponCommand = G_GetWeaponCommand(server_new_buttons); m_iClientWeaponCommand = (server_new_buttons & WEAPON_COMMAND_MASK) >> 7;
switch (m_iClientWeaponCommand) { switch (m_iClientWeaponCommand) {
case 0: case 0:
@ -5440,13 +5414,6 @@ void Player::EvaluateState(State *forceTorso, State *forceLegs)
StopPartAnimating(torso); StopPartAnimating(torso);
animdone_Torso = true; animdone_Torso = true;
} else if (torsoAnim != "") { } else if (torsoAnim != "") {
if (torsoAnim == partAnim[torso]) {
// Fixed in OPM
// Stop the part if it's the same animation
// so the new animation can play and make some action
// like activate the new weapon.
StopPartAnimating(torso);
}
SetPartAnim(torsoAnim.c_str(), torso); SetPartAnim(torsoAnim.c_str(), torso);
} }
} else { } else {
@ -5454,11 +5421,6 @@ void Player::EvaluateState(State *forceTorso, State *forceLegs)
StopPartAnimating(torso); StopPartAnimating(torso);
animdone_Torso = true; animdone_Torso = true;
} else if (torsoAnim != "") { } else if (torsoAnim != "") {
if (torsoAnim == partAnim[torso]) {
// Fixed in OPM
// See above
StopPartAnimating(torso);
}
SetPartAnim(torsoAnim.c_str(), torso); SetPartAnim(torsoAnim.c_str(), torso);
} }
@ -5542,6 +5504,7 @@ void Player::EvaluateState(State *forceTorso, State *forceLegs)
laststate_Legs = NULL; laststate_Legs = NULL;
} }
animdone_Legs = false;
if (currentState_Legs) { if (currentState_Legs) {
if (laststate_Legs) { if (laststate_Legs) {
// Process exit commands of the last state // Process exit commands of the last state
@ -5562,26 +5525,7 @@ void Player::EvaluateState(State *forceTorso, State *forceLegs)
StopPartAnimating(legs); StopPartAnimating(legs);
animdone_Legs = true; animdone_Legs = true;
} else if (legsAnim != "") { } else if (legsAnim != "") {
float oldTime;
if (currentState_Legs == laststate_Legs) {
//
// Added in OPM
// This allows different animations in the same state
// to be continued at the same moment.
// This is used to avoid "ghost walking" where the player
// would switch weapons indefinitely to avoid footstep sounds
//
oldTime = GetTime(m_iPartSlot[legs]);
SetPartAnim(legsAnim, legs); SetPartAnim(legsAnim, legs);
if (animtimes[m_iPartSlot[legs]] > 0) {
SetTime(m_iPartSlot[legs], fmod(oldTime, animtimes[m_iPartSlot[legs]]));
}
} else {
SetPartAnim(legsAnim, legs);
}
} }
} else { } else {
currentState_Legs = laststate_Legs; currentState_Legs = laststate_Legs;
@ -5592,25 +5536,21 @@ void Player::EvaluateState(State *forceTorso, State *forceLegs)
} }
if (g_showplayeranim->integer) { if (g_showplayeranim->integer) {
str sNewAnim; if (last_leg_anim_name != AnimName(legs)) {
gi.DPrintf("Legs change from %s to %s\n", last_leg_anim_name.c_str(), AnimName(legs));
sNewAnim = AnimName(m_iPartSlot[legs]); last_leg_anim_name = AnimName(legs);
if (last_leg_anim_name != sNewAnim) {
gi.DPrintf("Legs anim change from %s to %s\n", last_leg_anim_name.c_str(), sNewAnim.c_str());
last_leg_anim_name = sNewAnim;
} }
sNewAnim = AnimName(m_iPartSlot[torso]); if (last_torso_anim_name != AnimName(torso)) {
if (last_torso_anim_name != sNewAnim) { gi.DPrintf("Torso change from %s to %s\n", last_torso_anim_name.c_str(), AnimName(torso));
gi.DPrintf("Torso anim change from %s to %s\n", last_torso_anim_name.c_str(), sNewAnim.c_str()); last_torso_anim_name = AnimName(torso);
last_torso_anim_name = sNewAnim;
} }
} }
if (g_showplayerstate->integer) { if (g_showplayerstate->integer) {
if (startstate_Legs != currentState_Legs) { if (startstate_Legs != currentState_Legs) {
gi.DPrintf( gi.DPrintf(
"Legs state change from %s to %s\n", "Legs change from %s to %s\n",
startstate_Legs ? startstate_Legs->getName() : "NULL", startstate_Legs ? startstate_Legs->getName() : "NULL",
currentState_Legs ? currentState_Legs->getName() : "NULL" currentState_Legs ? currentState_Legs->getName() : "NULL"
); );
@ -5618,7 +5558,7 @@ void Player::EvaluateState(State *forceTorso, State *forceLegs)
if (startstate_Torso != currentState_Torso) { if (startstate_Torso != currentState_Torso) {
gi.DPrintf( gi.DPrintf(
"Torso state change from %s to %s\n", "Torso change from %s to %s\n",
startstate_Torso ? startstate_Torso->getName() : "NULL", startstate_Torso ? startstate_Torso->getName() : "NULL",
currentState_Torso ? currentState_Torso->getName() : "NULL" currentState_Torso ? currentState_Torso->getName() : "NULL"
); );
@ -6516,17 +6456,20 @@ void Player::DamageFeedback(void)
// //
damage_blood = 0; damage_blood = 0;
if (g_target_game >= target_game_e::TG_MOHTA) {
// //
// Added in 2.0 // Added in 2.0
// Don't show damage when in god mode // No more damage angles since MOHTA
// //
if (flags & FL_GODMODE) {
if (IsSubclassOfPlayer()) {
damage_count = 0; damage_count = 0;
damage_blood = 0; damage_blood = 0;
damage_alpha = 0; damage_alpha = 0;
damage_angles = vec_zero; damage_angles = vec_zero;
} }
} }
}
void Player::GetPlayerView(Vector *pos, Vector *angle) void Player::GetPlayerView(Vector *pos, Vector *angle)
{ {
@ -7336,7 +7279,7 @@ void Player::UpdateStats(void)
trace = G_Trace(m_vViewPos, vec_zero, vec_zero, vEnd, this, MASK_BEAM, qfalse, "infoclientcheck"); trace = G_Trace(m_vViewPos, vec_zero, vec_zero, vEnd, this, MASK_BEAM, qfalse, "infoclientcheck");
if (trace.ent && trace.ent->entity->IsSubclassOfPlayer() && !(trace.ent->r.svFlags & SVF_NOCLIENT)) { if (trace.ent && trace.ent->entity->IsSubclassOfPlayer()) {
Player *p = static_cast<Player *>(trace.ent->entity); Player *p = static_cast<Player *>(trace.ent->entity);
if (IsSpectator() || p->GetTeam() == GetTeam()) { if (IsSpectator() || p->GetTeam() == GetTeam()) {
@ -8842,25 +8785,25 @@ void Player::EnsurePlayerHasAllowedWeapons()
Q_strncpyz(client->pers.dm_primary, "smg", sizeof(client->pers.dm_primary)); Q_strncpyz(client->pers.dm_primary, "smg", sizeof(client->pers.dm_primary));
} else if (!Q_stricmp(client->pers.dm_primary, "smg")) { } else if (!Q_stricmp(client->pers.dm_primary, "smg")) {
if (!(dmflags->integer & DF_WEAPON_NO_SMG)) { if (!(dmflags->integer & DF_WEAPON_NO_RIFLE)) {
return; return;
} }
Q_strncpyz(client->pers.dm_primary, "mg", sizeof(client->pers.dm_primary)); Q_strncpyz(client->pers.dm_primary, "mg", sizeof(client->pers.dm_primary));
} else if (!Q_stricmp(client->pers.dm_primary, "mg")) { } else if (!Q_stricmp(client->pers.dm_primary, "mg")) {
if (!(dmflags->integer & DF_WEAPON_NO_MG)) { if (!(dmflags->integer & DF_WEAPON_NO_RIFLE)) {
return; return;
} }
Q_strncpyz(client->pers.dm_primary, "shotgun", sizeof(client->pers.dm_primary)); Q_strncpyz(client->pers.dm_primary, "shotgun", sizeof(client->pers.dm_primary));
} else if (!Q_stricmp(client->pers.dm_primary, "shotgun")) { } else if (!Q_stricmp(client->pers.dm_primary, "shotgun")) {
if (!(dmflags->integer & DF_WEAPON_NO_SHOTGUN)) { if (!(dmflags->integer & DF_WEAPON_NO_RIFLE)) {
return; return;
} }
Q_strncpyz(client->pers.dm_primary, "heavy", sizeof(client->pers.dm_primary)); Q_strncpyz(client->pers.dm_primary, "heavy", sizeof(client->pers.dm_primary));
} else if (!Q_stricmp(client->pers.dm_primary, "heavy")) { } else if (!Q_stricmp(client->pers.dm_primary, "heavy")) {
if (!(dmflags->integer & DF_WEAPON_NO_ROCKET)) { if (!(dmflags->integer & DF_WEAPON_NO_RIFLE)) {
return; return;
} }
@ -8929,12 +8872,7 @@ void Player::EquipWeapons()
} }
break; break;
case NA_GERMAN: case NA_GERMAN:
if (g_target_game < target_game_e::TG_MOHTA if (g_target_game < target_game_e::TG_MOHTA || dmflags->integer & DF_OLD_SNIPER) {
|| dmflags->integer & DF_OLD_SNIPER
// Added in OPM
// This was also a feature of Daven's fixes
// Use KAR98 for panzer skins
|| !Q_stricmpn(client->pers.dm_playergermanmodel, "german_panzer", 13)) {
// Old snipers are forced older versions of the game // Old snipers are forced older versions of the game
giveItem("weapons/kar98sniper.tik"); giveItem("weapons/kar98sniper.tik");
event->AddString("KAR98 - Sniper"); event->AddString("KAR98 - Sniper");
@ -9711,21 +9649,19 @@ void Player::ArmorDamage(Event *ev)
event->AddInteger(ev->GetInteger(10)); event->AddInteger(ev->GetInteger(10));
event->AddEntity(this); event->AddEntity(this);
scriptDelegate_damage.Trigger(this, *event);
scriptedEvents[SE_DAMAGE].Trigger(event); scriptedEvents[SE_DAMAGE].Trigger(event);
} }
void Player::Disconnect(void) void Player::Disconnect(void)
{ {
Event *ev = new Event; Event *ev = new Event;
ev->AddListener(this);
scriptDelegate_disconnecting.Trigger(this, *ev); ev->AddListener(this);
scriptedEvents[SE_DISCONNECTED].Trigger(ev); scriptedEvents[SE_DISCONNECTED].Trigger(ev);
// if (g_gametype->integer != GT_SINGLE_PLAYER) { if (g_gametype->integer != GT_SINGLE_PLAYER) {
// dmManager.RemovePlayer(this); dmManager.RemovePlayer(this);
// } }
} }
void Player::CallVote(Event *ev) void Player::CallVote(Event *ev)
@ -10384,7 +10320,7 @@ void Player::Stats(Event *ev)
m_iObjectivesCompleted, m_iObjectivesCompleted,
iNumShotsFired, iNumShotsFired,
iNumHits, iNumHits,
((float)iNumHits / (float)iNumShotsFired * 100.f), (iNumHits / iNumShotsFired * 100.f),
szPreferredWeapon.c_str(), szPreferredWeapon.c_str(),
m_iNumHitsTaken, m_iNumHitsTaken,
m_iNumObjectsDestroyed, m_iNumObjectsDestroyed,
@ -10438,12 +10374,9 @@ void Player::EventStuffText(Event *ev)
Event *event = new Event(EV_Player_StuffText); Event *event = new Event(EV_Player_StuffText);
event->AddValue(ev->GetValue(1)); event->AddValue(ev->GetValue(1));
PostEvent(event, level.frametime, 0); PostEvent(event, level.frametime, 0);
return; } else {
}
gi.SendServerCommand(edict - g_entities, "stufftext \"%s\"", ev->GetString(1).c_str()); gi.SendServerCommand(edict - g_entities, "stufftext \"%s\"", ev->GetString(1).c_str());
}
delegate_stufftext.Execute(ev->GetString(1));
} }
void Player::EventSetVoiceType(Event *ev) void Player::EventSetVoiceType(Event *ev)
@ -10630,17 +10563,6 @@ void Player::EventDMMessage(Event *ev)
return; return;
} }
if (!Q_stricmp(client->pers.netname, "console")) {
// Added in OPM
// Reserved name
gi.Printf(
"Client %d trying to send a message using a reserved name ('%s')\n",
edict - g_entities,
client->pers.netname
);
return;
}
sToken = ev->GetString(2); sToken = ev->GetString(2);
// Check for taunts // Check for taunts
@ -10815,18 +10737,11 @@ void Player::EventDMMessage(Event *ev)
Q_strcat(szPrintString, sizeof(szPrintString), ": "); Q_strcat(szPrintString, sizeof(szPrintString), ": ");
Q_strcat(szPrintString, sizeof(szPrintString), gi.LV_ConvertString(pTmpInstantMsg)); Q_strcat(szPrintString, sizeof(szPrintString), gi.LV_ConvertString(pTmpInstantMsg));
} else { } else {
bool met_comment = false; bool met_comment;
Q_strcat(szPrintString, sizeof(szPrintString), ":"); Q_strcat(szPrintString, sizeof(szPrintString), ":");
iStringLength = strlen(szPrintString); iStringLength = strlen(szPrintString);
// Added in OPM.
// Checks for comments in string (as COM_Parse will parse them)
// This was fixed in 2.0 but make the fix compatible with older versions
if (g_protocol < protocol_e::PROTOCOL_MOHTA_MIN && strstr(client->pers.netname, "/*")) {
met_comment = true;
}
for (i = 2; i <= ev->NumArgs(); i++) { for (i = 2; i <= ev->NumArgs(); i++) {
sToken = ev->GetString(i); sToken = ev->GetString(i);
// Added in 2.40 // Added in 2.40
@ -10838,7 +10753,13 @@ void Player::EventDMMessage(Event *ev)
break; break;
} }
if (met_comment && strstr(sToken, "*/")) { // Added in OPM.
// Checks for comments in string (as COM_Parse will parse them)
if (strstr(sToken, "/*")) {
met_comment = true;
}
if (strstr(sToken, "*/") && met_comment) {
// ignore messages containing comments // ignore messages containing comments
return; return;
} }
@ -10851,44 +10772,15 @@ void Player::EventDMMessage(Event *ev)
Q_strcat(szPrintString, sizeof(szPrintString), "\n"); Q_strcat(szPrintString, sizeof(szPrintString), "\n");
// ignore names containing comments // ignore names containing comments
if (g_protocol < protocol_e::PROTOCOL_MOHTA_MIN) {
if (strstr(client->pers.netname, "//") if (strstr(client->pers.netname, "//")
|| (strstr(client->pers.netname, "/*") && strstr(client->pers.netname, "*/"))) { || (strstr(client->pers.netname, "/*") && strstr(client->pers.netname, "*/"))) {
return; return;
} }
}
//
// Added in OPM
//=============
// Print the dm message to console
sToken = "";
for (i = 2; i <= ev->NumArgs(); i++) {
if (i != 2) {
sToken += " ";
}
sToken += ev->GetString(i);
}
//=============
if (iMode == 0) { if (iMode == 0) {
// //
// everyone // everyone
// //
// Added in OPM
if (bInstaMessage) {
gi.Printf(
"%s (%zu) says (voice) to everyone: %s\n", client->pers.netname, edict - g_entities, pTmpInstantMsg
);
} else {
gi.Printf(
"%s (%zu) says (text) to everyone: %s\n", client->pers.netname, edict - g_entities, sToken.c_str()
);
}
if (!IsSpectator() || g_spectate_allow_full_chat->integer) { if (!IsSpectator() || g_spectate_allow_full_chat->integer) {
for (i = 0; i < game.maxclients; i++) { for (i = 0; i < game.maxclients; i++) {
ent = &g_entities[i]; ent = &g_entities[i];
@ -10929,27 +10821,10 @@ void Player::EventDMMessage(Event *ev)
gi.SendServerCommand(i, "%s", szPrintString); gi.SendServerCommand(i, "%s", szPrintString);
} }
} }
if (!bInstaMessage) {
Event event;
// sent to everyone (not a team)
event.AddString(sToken);
event.AddInteger(false);
scriptDelegate_textMessage.Trigger(this, event);
}
} else if (iMode < 0) { } else if (iMode < 0) {
// //
// team message // team message
// //
// Added in OPM
if (bInstaMessage) {
gi.Printf("%s (%zu) says (voice) to team: %s\n", client->pers.netname, edict - g_entities, pTmpInstantMsg);
} else {
gi.Printf("%s (%zu) says (text) to team: %s\n", client->pers.netname, edict - g_entities, sToken.c_str());
}
if (IsSpectator()) { if (IsSpectator()) {
for (i = 0; i < game.maxclients; i++) { for (i = 0; i < game.maxclients; i++) {
ent = &g_entities[i]; ent = &g_entities[i];
@ -10992,15 +10867,6 @@ void Player::EventDMMessage(Event *ev)
} }
} }
} }
if (!bInstaMessage) {
Event event;
// sent to team
event.AddString(sToken);
event.AddInteger(true);
scriptDelegate_textMessage.Trigger(this, event);
}
} else if (iMode <= game.maxclients) { } else if (iMode <= game.maxclients) {
ent = &g_entities[iMode - 1]; ent = &g_entities[iMode - 1];
@ -11018,25 +10884,6 @@ void Player::EventDMMessage(Event *ev)
return; return;
} }
// Added in OPM
if (bInstaMessage) {
gi.Printf(
"%s (%zu) says (voice) to client #%d: %s\n",
client->pers.netname,
edict - g_entities,
iMode - 1,
pTmpInstantMsg
);
} else {
gi.Printf(
"%s (%zu) says (text) to client #%d: %s\n",
client->pers.netname,
edict - g_entities,
iMode - 1,
sToken.c_str()
);
}
gi.SendServerCommand(iMode - 1, "%s", szPrintString); gi.SendServerCommand(iMode - 1, "%s", szPrintString);
if (ent->entity != this) { if (ent->entity != this) {
@ -11356,13 +11203,9 @@ void Player::EventIPrint(Event *ev)
} }
if (iBold) { if (iBold) {
gi.SendServerCommand( gi.SendServerCommand(edict - g_entities, "print \"" HUD_MESSAGE_WHITE "%s\n\"", sString.c_str());
edict - g_entities, "print \"" HUD_MESSAGE_WHITE "%s\n\"", gi.LV_ConvertString(sString.c_str())
);
} else { } else {
gi.SendServerCommand( gi.SendServerCommand(edict - g_entities, "print \"" HUD_MESSAGE_YELLOW "%s\n\"", sString.c_str());
edict - g_entities, "print \"" HUD_MESSAGE_YELLOW "%s\n\"", gi.LV_ConvertString(sString.c_str())
);
} }
} }
@ -11656,15 +11499,13 @@ qboolean Player::CheckCanSwitchTeam(teamtype_t team)
} }
if (pNewTeam->m_players.NumObjects() > numTeamPlayers) { if (pNewTeam->m_players.NumObjects() > numTeamPlayers) {
const char *message = gi.LV_ConvertString(
"That team has enough players. Choose the team that has the lowest number of players."
);
gi.SendServerCommand( gi.SendServerCommand(
edict - g_entities, "print \"" HUD_MESSAGE_WHITE "%s\n\"", gi.LV_ConvertString(message) edict - g_entities,
"print \"" HUD_MESSAGE_WHITE "%s\n\"",
gi.LV_ConvertString(
"That team has enough players. Choose the team that has the lowest number of players."
)
); );
gi.centerprintf(edict, message);
return qfalse; return qfalse;
} }
} }
@ -11840,13 +11681,6 @@ void Player::FireWeapon(int number, firemode_t mode)
return; return;
} }
if (G_GetWeaponCommand(last_ucmd.buttons)) {
// Added in OPM
// If there is a weapon command (like DROP), then just don't fire
// this prevent tricky behaviors, like silent firing
return;
}
Sentient::FireWeapon(number, mode); Sentient::FireWeapon(number, mode);
if (g_gametype->integer != GT_SINGLE_PLAYER) { if (g_gametype->integer != GT_SINGLE_PLAYER) {
@ -12144,15 +11978,18 @@ bool Player::IsReady(void) const
void Player::Spawned(void) void Player::Spawned(void)
{ {
Event *ev = new Event; Event *ev = new Event;
ev->AddEntity(this);
scriptDelegate_spawned.Trigger(this, *ev); ev->AddEntity(this);
scriptedEvents[SE_SPAWN].Trigger(ev); scriptedEvents[SE_SPAWN].Trigger(ev);
} }
void Player::AddKills(int num) void Player::AddKills(int num)
{ {
num_kills += num; num_kills += num;
if (g_gametype->integer >= GT_TEAM_ROUNDS) {
num_deaths += num;
}
} }
void Player::AddDeaths(int num) void Player::AddDeaths(int num)

View file

@ -37,7 +37,6 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
#include "actor.h" #include "actor.h"
#include "vehicle.h" #include "vehicle.h"
#include "dm_manager.h" #include "dm_manager.h"
#include "scriptdelegate.h"
extern Event EV_Player_EndLevel; extern Event EV_Player_EndLevel;
extern Event EV_Player_GiveCheat; extern Event EV_Player_GiveCheat;
@ -311,16 +310,6 @@ private:
bool m_bShowingHint; bool m_bShowingHint;
#endif #endif
public:
MulticastDelegate<void(const str& text)> delegate_stufftext;
static ScriptDelegate scriptDelegate_connected;
static ScriptDelegate scriptDelegate_disconnecting;
static ScriptDelegate scriptDelegate_spawned;
static ScriptDelegate scriptDelegate_damage;
static ScriptDelegate scriptDelegate_kill;
static ScriptDelegate scriptDelegate_textMessage;
public: public:
int m_iNumObjectives; int m_iNumObjectives;
int m_iObjectivesCompleted; int m_iObjectivesCompleted;

Some files were not shown because too many files have changed in this diff Show more