Compare commits

..

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

1037 changed files with 325600 additions and 320942 deletions

View file

@ -1,90 +0,0 @@
---
Language: Cpp
Standard: c++17
AccessModifierOffset: -4
AlignAfterOpenBracket: BlockIndent
AlignArrayOfStructures: Left
AlignConsecutiveAssignments: Consecutive
AlignConsecutiveBitFields: Consecutive
AlignConsecutiveDeclarations: Consecutive
AlignConsecutiveMacros:
Enabled: true
AcrossEmptyLines: true
AcrossComments: false
AlignEscapedNewlines: Left
AlignOperands: AlignAfterOperator
AllowAllArgumentsOnNextLine: true
AllowAllParametersOfDeclarationOnNextLine: true
AllowShortBlocksOnASingleLine: Empty
AllowShortCaseLabelsOnASingleLine: false
AllowShortEnumsOnASingleLine: false
AllowShortFunctionsOnASingleLine: Inline
AllowShortIfStatementsOnASingleLine: Never
AllowShortLambdasOnASingleLine: Inline
AllowShortLoopsOnASingleLine: false
AlwaysBreakAfterReturnType: None
AlwaysBreakBeforeMultilineStrings: True
AlwaysBreakTemplateDeclarations: Yes
BinPackArguments: false
BinPackParameters: false
BitFieldColonSpacing: Both
BraceWrapping:
AfterClass: true
AfterEnum: false
AfterExternBlock: false
AfterFunction: true
AfterNamespace: true
AfterStruct: false
AfterUnion: false
BeforeCatch: false
BeforeElse: false
BeforeLambdaBody: true
BeforeWhile: false
IndentBraces: false
SplitEmptyFunction: false
SplitEmptyNamespace: false
SplitEmptyRecord: false
BreakArrays: true
BreakBeforeBinaryOperators: NonAssignment
BreakBeforeBraces: Custom
BreakBeforeConceptDeclarations: Always
BreakBeforeTernaryOperators: true
BreakConstructorInitializers: BeforeComma
BreakInheritanceList: BeforeComma
ColumnLimit: 120
CompactNamespaces: false
Cpp11BracedListStyle: true
EmptyLineBeforeAccessModifier: Always
IndentAccessModifiers: false
IndentCaseBlocks: true
IndentCaseLabels: false
IndentExternBlock: Indent
IndentGotoLabels: true
IndentPPDirectives: AfterHash
IndentRequiresClause: true
IndentWidth: 4
InsertBraces: true
KeepEmptyLinesAtTheStartOfBlocks: false
LambdaBodyIndentation: Signature
LineEnding: LF
MaxEmptyLinesToKeep: 1
NamespaceIndentation: All
PackConstructorInitializers: Never
PointerAlignment: Right
QualifierAlignment: Left
ReferenceAlignment: Left
ReflowComments: false
RequiresClausePosition: WithFollowing
SeparateDefinitionBlocks: Always
SortIncludes: false
SortUsingDeclarations: Lexicographic
SpaceAfterCStyleCast: false
SpaceAfterLogicalNot: false
SpaceAfterTemplateKeyword: false
SpaceBeforeAssignmentOperators: true
SpaceBeforeCaseColon: false
SpaceBeforeCpp11BracedList: true
SpaceBeforeParens: ControlStatements
SpacesInAngles: Never
UseTab: Never

View file

@ -1,39 +0,0 @@
---
name: Bug report
about: Create a report to help us improve
title: ''
labels: bug
assignees: ''
---
**Describe the bug**
A clear and concise description of what the bug is.
**To Reproduce**
Steps to reproduce the behavior:
1. Go to '...'
2. Click on '....'
3. Scroll down to '....'
4. See error
**Expected behavior**
A clear and concise description of what you expected to happen.
**Screenshots (OPTIONAL)**
If applicable, add screenshots to help explain your problem.
**Logs**
- Paste the output of the console window in a text file, and attach the text file.
- If applicable (`logfile` set to 2), attach the `qconsole.log` file. On Windows, it can be found in **%APPDATA%\...\qconsole.log** and on Linux, it can be found on the home directory **~/.openmohaa/.../qconsole.log**.
**Version information (please complete the following information):**
- OS: [e.g. `Debian`]
- OS Version [e.g `12`]
- OpenMoHAA Version: [e.g `0.70.0-alpha+0.0b1a20dcf win_msvc64-x86_64-debug`, can be found below **Common Initialization** in the console, or by typing `version`]
**Dump (OPTIONAL)**
You can include a core dump generated by the OS (`.dmp` file). If you compiled OpenMoHAA yourself, also add all output openmohaa binaries (except libopenal and libSDL).
**Additional context (OPTIONAL)**
Add any other context about the problem here.

View file

@ -1,17 +0,0 @@
name: Build branch
on:
push:
branches:
- '**'
pull_request:
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
build-all:
uses: ./.github/workflows/shared-build.yml
with:
environment: "testing"

222
.github/workflows/build-cmake.yml vendored Normal file
View file

@ -0,0 +1,222 @@
name: Build
on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]
workflow_call:
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
env:
# Customize the CMake build type here (Release, Debug, RelWithDebInfo, etc.)
BUILD_TYPE: RelWithDebInfo
jobs:
build-platform-linux:
strategy:
matrix:
architecture: [
{name: 'amd64', triple: 'x86_64-linux-gnu'},
{name: 'i686', triple: 'i686-linux-gnu'},
{name: 'aarch64', triple: 'aarch64-linux-gnu'},
{name: 'armhf', triple: 'arm-linux-gnueabihf'}
]
name: "Building for platform linux-${{matrix.architecture.name}}"
runs-on: ubuntu-22.04
# container:
# image: ubuntu:22.04
# volumes:
# - ${{github.workspace}}:${{github.workspace}}
#
# steps:
# - name: Install required packages
# run: apt update && apt install -y clang-15 cmake ninja-build flex bison git
#
# - name: Install required cross-platform packages (${{ matrix.architecture.triple }})
# if: matrix.architecture.name != 'amd64'
# run: apt install -y gcc-12-${{ matrix.architecture.triple }} g++-12-${{ matrix.architecture.triple }}
steps:
- name: Settings
working-directory: ${{github.workspace}}
run: |
echo "CMAKE_BUILD_PARALLEL_LEVEL=$(($(nproc) * 16))" >> $GITHUB_ENV
# echo "CMAKE_GENERATOR=Ninja" >> $GITHUB_ENV
- name: Install required packages
run: |
sudo apt update && sudo apt install -y flex bison
- name: Install required cross-platform packages (${{ matrix.architecture.triple }})
if: matrix.architecture.name != 'amd64'
run: sudo apt install -y gcc-12-${{ matrix.architecture.triple }} g++-12-${{ matrix.architecture.triple }}
- name: Install dependencies
working-directory: ${{github.workspace}}
run: |
echo Using triple: ${{ matrix.architecture.triple }}
mkdir -p thirdparties && cd thirdparties
git clone --depth 1 --single-branch --branch SDL2 https://github.com/libsdl-org/SDL.git
cmake -B SDL-build \
-DCMAKE_C_COMPILER=clang \
-DCMAKE_CXX_COMPILER=clang++ \
-DCMAKE_C_FLAGS=--target=${{ matrix.architecture.triple }} \
-DCMAKE_CXX_FLAGS=--target=${{ matrix.architecture.triple }} \
-DCMAKE_INSTALL_PREFIX='${{github.workspace}}/thirdparties/SDL-install' \
./SDL
cmake --build SDL-build --config Release
cmake --install SDL-build
- uses: actions/checkout@v3
with:
path: 'source'
- name: CMake Settings
run: |
echo "CMAKE_PARAM=--log-level=VERBOSE \
-DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} \
-DCMAKE_INSTALL_PREFIX='${{github.workspace}}/install' \
-DCMAKE_C_COMPILER=clang \
-DCMAKE_CXX_COMPILER=clang++ \
-DCMAKE_C_FLAGS=--target=${{ matrix.architecture.triple }} \
-DCMAKE_CXX_FLAGS=--target=${{ matrix.architecture.triple }} \
-DGIT_REVISION_BUILD_NUMBER=${{ github.run_number }} \
-DSDL2_DIR='${{github.workspace}}/thirdparties/SDL-install/lib/cmake/SDL2' \
-DWITH_CLIENT=1" >> $GITHUB_ENV
- name: Configure CMake
working-directory: ${{github.workspace}}
run: |
cmake -B ./build ${{ env.CMAKE_PARAM }} -DTARGET_GAME_TYPE=0 ./source
cmake -B ./buildtt ${{ env.CMAKE_PARAM }} -DTARGET_GAME_TYPE=2 ./source
- name: Build
working-directory: ${{github.workspace}}
run: |
cmake --build ${{github.workspace}}/build --config ${{env.BUILD_TYPE}}
cmake --build ${{github.workspace}}/buildtt --config ${{env.BUILD_TYPE}}
- 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}}
cd "${{github.workspace}}/buildtt"
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}}
cmake --install ${{github.workspace}}/buildtt --config ${{env.BUILD_TYPE}}
cp '${{github.workspace}}/thirdparties/SDL-install/lib/libSDL2.so' '${{github.workspace}}/install'
- uses: actions/upload-artifact@v3
with:
name: out-linux-${{matrix.architecture.name}}
if-no-files-found: error
path:
${{github.workspace}}/install
build-platform-windows:
strategy:
matrix:
architecture: [
{name: 'x64', config: 'x64' },
{name: 'x86', config: 'Win32' },
{name: 'arm64', config: 'ARM64' }
]
name: "Building for platform windows-${{matrix.architecture.name}}"
runs-on: windows-2022
steps:
- name: Settings
working-directory: ${{github.workspace}}
run: |
echo "CMAKE_BUILD_PARALLEL_LEVEL=$((Get-CimInstance Win32_ComputerSystem).NumberOfLogicalProcessors * 16)" >> $GITHUB_ENV
- name: Install required packages
working-directory: ${{github.workspace}}
run: |
mkdir thirdparties && cd thirdparties
git clone --depth 1 --single-branch --branch SDL2 https://github.com/libsdl-org/SDL.git
cmake -B SDL-build -A ${{ matrix.architecture.config }} -DCMAKE_INSTALL_PREFIX='${{github.workspace}}/thirdparties/SDL-install' ./SDL
cmake --build SDL-build --config Release --parallel
cmake --install SDL-build
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
- uses: actions/checkout@v3
with:
path: 'source'
- name: CMake Settings
run: |
echo "CMAKE_PARAM=-A ${{ matrix.architecture.config }} `
--log-level=VERBOSE `
-DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} `
-DCMAKE_INSTALL_PREFIX='${{github.workspace}}/install' `
-DCMAKE_C_COMPILER=clang `
-DCMAKE_CXX_COMPILER=clang++ `
-DGIT_REVISION_BUILD_NUMBER=${{ github.run_number }} `
-DSDL2_DIR='${{github.workspace}}/thirdparties/SDL-install/cmake' `
-DBISON_EXECUTABLE='${{github.workspace}}/thirdparties/winflexbison-install/win_bison.exe' `
-DFLEX_EXECUTABLE='${{github.workspace}}/thirdparties/winflexbison-install/win_flex.exe' `
-DWITH_CLIENT=1".Replace("`r", "").Replace("`n", "") >> $env:GITHUB_ENV
- name: Configure CMake
working-directory: ${{github.workspace}}
run: |
cmake -B ./build ${{ env.CMAKE_PARAM }} -DTARGET_GAME_TYPE=0 ./source
cmake -B ./buildtt ${{ env.CMAKE_PARAM }} -DTARGET_GAME_TYPE=2 ./source
- name: Build
working-directory: ${{github.workspace}}
run: |
cmake --build ${{github.workspace}}/build --config ${{env.BUILD_TYPE}}
cmake --build ${{github.workspace}}/buildtt --config ${{env.BUILD_TYPE}}
- 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}}
cd "${{github.workspace}}/buildtt"
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}}
cmake --install ${{github.workspace}}/buildtt --config ${{env.BUILD_TYPE}}
Copy-Item "${{github.workspace}}/thirdparties/SDL-install/bin/*.dll" -Destination "${{github.workspace}}/install"
- uses: actions/upload-artifact@v3
with:
name: out-windows-${{matrix.architecture.name}}
if-no-files-found: error
path: |
${{github.workspace}}/install
!${{github.workspace}}/install/**/*.pdb
- uses: actions/upload-artifact@v3
with:
name: out-windows-${{matrix.architecture.name}}-pdb
if-no-files-found: error
path: |
${{github.workspace}}/install

View file

@ -20,10 +20,6 @@ on:
schedule: schedule:
- cron: '42 8 * * 1' - cron: '42 8 * * 1'
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs: jobs:
analyze: analyze:
name: Analyze name: Analyze
@ -45,24 +41,11 @@ jobs:
steps: steps:
- name: Checkout repository - name: Checkout repository
uses: actions/checkout@v4 uses: actions/checkout@v3
- 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
- name: Set up SDL
id: sdl
uses: libsdl-org/setup-sdl@main
with:
version: sdl2-latest
# Initializes the CodeQL tools for scanning. # Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL - name: Initialize CodeQL
uses: github/codeql-action/init@v3 uses: github/codeql-action/init@v2
with: with:
languages: ${{ matrix.language }} languages: ${{ matrix.language }}
# If you wish to specify custom queries, you can do so here or in a config file. # If you wish to specify custom queries, you can do so here or in a config file.
@ -76,7 +59,7 @@ jobs:
# Autobuild attempts to build any compiled languages (C/C++, C#, Go, Java, or Swift). # Autobuild attempts to build any compiled languages (C/C++, C#, Go, Java, or Swift).
# If this step fails, then you should remove it and run the build manually (see below) # If this step fails, then you should remove it and run the build manually (see below)
- name: Autobuild - name: Autobuild
uses: github/codeql-action/autobuild@v3 uses: github/codeql-action/autobuild@v2
# Command-line programs to run using the OS shell. # Command-line programs to run using the OS shell.
# 📚 See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun # 📚 See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun
@ -89,6 +72,6 @@ jobs:
# ./location_of_script_within_repo/buildscript.sh # ./location_of_script_within_repo/buildscript.sh
- name: Perform CodeQL Analysis - name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v3 uses: github/codeql-action/analyze@v2
with: with:
category: "/language:${{matrix.language}}" category: "/language:${{matrix.language}}"

View file

@ -6,7 +6,7 @@ on:
- "v*.*.*" - "v*.*.*"
env: env:
RELEASE_STAGE: ${{ vars.RELEASE_STAGE || 'unstable' }} RELEASE_TYPE: ${{ vars.RELEASE_TYPE || 'test' }}
RELEASE_IS_PRERELEASE: ${{ vars.RELEASE_IS_PRELEASE }} RELEASE_IS_PRERELEASE: ${{ vars.RELEASE_IS_PRELEASE }}
permissions: permissions:
@ -14,55 +14,44 @@ permissions:
jobs: jobs:
build-all: build-all:
uses: ./.github/workflows/shared-build.yml uses: ./.github/workflows/build-cmake.yml
with:
environment: "release"
deploy_all: deploy_all:
strategy: strategy:
# Set the maximum number of parallel jobs to 1, to avoid a race-condition
# while creating a new release
max-parallel: 1
matrix: matrix:
target_os: [ target_os: [
'linux-amd64', 'linux-amd64',
'linux-i686', 'linux-i686',
'linux-arm64', 'linux-aarch64',
'linux-armhf', 'linux-armhf',
'linux-powerpc',
'linux-ppc64',
'linux-ppc64el',
'windows-x64', 'windows-x64',
'windows-x64-pdb',
'windows-x86', 'windows-x86',
'windows-x64-pdb',
'windows-x86-pdb', 'windows-x86-pdb',
'windows-arm64', 'windows-arm64',
'windows-arm64-pdb', 'windows-arm64-pdb'
#'macos-x86_64',
#'macos-arm64',
'macos-multiarch(arm64-x86_64)',
] ]
runs-on: ubuntu-24.04 runs-on: ubuntu-22.04
environment: "release" environment: release
needs: [build-all] needs: [build-all]
env: env:
RELEASE_NAME: ${{ github.event.repository.name }}-${{github.ref_name}}-${{matrix.target_os}} RELEASE_NAME: ${{ github.event.repository.name }}-${{github.ref_name}}-${{matrix.target_os}}
steps: steps:
- uses: actions/download-artifact@v4 - uses: actions/download-artifact@v3
with: with:
name: 'out-${{matrix.target_os}}' name: 'out-${{matrix.target_os}}'
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@v1
with: with:
name: '${{github.ref_name}}-${{env.RELEASE_STAGE}}' name: '${{github.ref_name}}-${{env.RELEASE_TYPE}}'
prerelease: ${{env.RELEASE_IS_PRERELEASE}} prerelease: ${{env.RELEASE_IS_PRERELEASE}}
files: ${{github.workspace}}/${{ env.RELEASE_NAME }}.zip files: ${{github.workspace}}/${{ env.RELEASE_NAME }}.zip

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

@ -1,24 +0,0 @@
name: Shared build workflow
on:
workflow_call:
inputs:
environment:
required: true
type: string
jobs:
build-platform-linux:
uses: ./.github/workflows/shared-build-linux.yml
with:
environment: ${{inputs.environment}}
build-platform-windows:
uses: ./.github/workflows/shared-build-windows.yml
with:
environment: ${{inputs.environment}}
build-platform-macos:
uses: ./.github/workflows/shared-build-macos.yml
with:
environment: ${{inputs.environment}}

5
.gitignore vendored
View file

@ -5,8 +5,6 @@ Makefile.local
*.swp *.swp
*tags *tags
*~ *~
/.vscode/
/baseq3
# OS X # OS X
#################### ####################
@ -46,6 +44,5 @@ profile
*.suo *.suo
.vs .vs
out
code_unfinished/* code_unfinished/*
thirdparties/
code/parser/generated/*

13
CHANGELOG.txt Normal file
View file

@ -0,0 +1,13 @@
=== Patch 1.12 ===
>>> Client :
- Added GFX features such as bloom, SSAO & FXAA
- Added support of .vision files
- Added support of custom weapons and view model animations
>>> Game :
- Added more scripting functions
- Lot more..
THIS CHANGELOG IS NOT COMPLETED YET.

View file

@ -1,164 +1,77 @@
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)
if(USE_SYSTEM_LIBS)
set(USE_INTERNAL_LIBS OFF)
endif()
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_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.") if(TARGET_GAME_TYPE EQUAL 1)
# Build for Team Assault (Spearhead)
set(TARGET_BASE_SUFFIX "ta")
elseif(TARGET_GAME_TYPE EQUAL 2)
# Build for Team Tactics (Breakthrough)
set(TARGET_BASE_SUFFIX "tt")
else()
set(TARGET_BASE_SUFFIX)
message(SEND_ERROR "Invalid game type. Game type can be 0, 1 or 2")
endif()
else()
set(TARGET_BASE_SUFFIX)
set(TARGET_GAME_TYPE 0)
endif() endif()
set(TARGET_BASE_GAME "./") set(TARGET_BASE_GAME "main${TARGET_BASE_SUFFIX}")
set(CMAKE_DEBUG_POSTFIX "-dbg")
#
# Microsoft compiler specific parameters
#
if(MSVC) if(MSVC)
add_definitions(-D_CRT_SECURE_NO_WARNINGS -D_CRT_NONSTDC_NO_DEPRECATE) add_definitions(-D_CRT_SECURE_NO_WARNINGS -D_CRT_NONSTDC_NO_DEPRECATE)
# Treat no return type as error elseif(CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
add_compile_options(/we4715)
endif()
#
# Clang and GCC specific parameters
#
if(CMAKE_C_COMPILER_ID MATCHES "Clang" OR CMAKE_CXX_COMPILER_ID MATCHES "Clang" OR CMAKE_C_COMPILER_ID STREQUAL "GNU" OR CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
add_compile_options(-Wno-comment) add_compile_options(-Wno-comment)
# Treat no return type as error
add_compile_options(-Werror=return-type)
endif()
#
# Clang specific parameters
#
if(CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
# Ignore warnings for code like 'assert("Assert string")' # Ignore warnings for code like 'assert("Assert string")'
add_compile_options(-Wno-pointer-bool-conversion) add_compile_options(-Wno-pointer-bool-conversion)
endif() endif()
# IF("${TARGET_ARCH}" STREQUAL "i386")
# GCC specific parameters
#
if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
# Add this option on gcc to prevent functions from having the STB_GNU_UNIQUE binding
# Otherwise, it would prevent libraries from being unloaded
# which will cause undefined behavior and crashes due to memory corruption
add_compile_options(-fno-gnu-unique)
endif()
if(DEBUG_MEMORY)
add_definitions(-D_DEBUG_MEM)
endif()
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}") message(STATUS "Architecture detected: ${TARGET_ARCH}, suffix set to ${TARGET_ARCH_SUFFIX}")
if(TARGET_LOCAL_SYSTEM) IF(WIN32)
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}")
message(STATUS "Binary suffix set to '${TARGET_ARCH_SUFFIX}'.")
endif()
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) set(TARGET_CONFIG_SUFFIX "-dbg")
add_definitions(-D_DEBUG)
# NOTE: The following may mess up function importation
#if(UNIX) #if(UNIX)
# # Enable all exports so all functions name can be seen during executable crash # # Enable all exports so all functions name can be seen during executable crash
# 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 set(TARGET_CONFIG_SUFFIX "")
add_compile_definitions(NDEBUG) ENDIF()
endif()
if(APPLE)
# macOS doesn't search the executable path by default
# so, locate libraries like SDL in the executable path
set(CMAKE_INSTALL_RPATH "@executable_path")
set(CMAKE_BUILD_WITH_INSTALL_RPATH ON)
if(CMAKE_C_COMPILER_ID MATCHES "Clang" OR CMAKE_C_COMPILER_ID STREQUAL "GNU")
# Set the visibility to hidden on macOS to prevent shared libraries from
# using functions in the executable
# it's ok to hide them because the backtrace on macOS will still print the name of the functions
add_compile_options(-fvisibility=hidden)
endif()
endif()
#
# Setup the installation directory
#
if(WIN32)
# By default, both DLLs and EXEs are in the same directory
set(CMAKE_DEFAULT_INSTALL_RUNTIME_DIR bin)
set(BIN_INSTALL_SUBDIR ".")
set(LIB_INSTALL_SUBDIR ".")
else()
# Unix
set(CMAKE_DEFAULT_INSTALL_RUNTIME_DIR lib${CMAKE_LIB_SUFFIX})
set(BIN_INSTALL_SUBDIR ${CMAKE_PROJECT_NAME})
set(LIB_INSTALL_SUBDIR ${CMAKE_PROJECT_NAME})
endif()
# By default, put both binaries and shared libraries in the same directory
# the game uses internal shared libraries that must be in the same folder as the binaries
set(CMAKE_INSTALL_BINDIR ${CMAKE_DEFAULT_INSTALL_RUNTIME_DIR} CACHE PATH "Binary dir")
set(CMAKE_INSTALL_LIBDIR ${CMAKE_INSTALL_BINDIR} CACHE PATH "Library dir")
include(GNUInstallDirs)
#
# Common stuff # Common stuff
#
add_subdirectory("code/qcommon") add_subdirectory("code/qcommon")
add_subdirectory("code/gamespy") add_subdirectory("code/gamespy")
#
# Application # Application
#
add_subdirectory("code/sys") add_subdirectory("code/sys")
##
## Server app ## Server app
##
add_subdirectory("code/server") add_subdirectory("code/server")
add_executable(omohaaded "code/null/null_client.c" "code/null/null_input.c" "code/null/null_snddma.c") add_executable(omohaaded "code/null/null_client.c" "code/null/null_input.c" "code/null/null_snddma.c")
@ -168,105 +81,55 @@ target_compile_features(omohaaded PUBLIC c_variadic_macros)
target_link_libraries(omohaaded PRIVATE omohserver) target_link_libraries(omohaaded PRIVATE omohserver)
target_link_libraries(omohaaded PRIVATE syslib) target_link_libraries(omohaaded PRIVATE syslib)
target_link_libraries(omohaaded PRIVATE qcommon qcommon_standalone) target_link_libraries(omohaaded PRIVATE qcommon qcommon_standalone)
# Gamespy dependency
# Add the gamespy dependency
target_include_directories(omohaaded PUBLIC "code/qcommon" "code/script" "code/gamespy" "code/server") target_include_directories(omohaaded PUBLIC "code/qcommon" "code/script" "code/gamespy" "code/server")
set_target_properties(omohaaded PROPERTIES OUTPUT_NAME "omohaaded${TARGET_BIN_SUFFIX}") set_target_properties(omohaaded PROPERTIES OUTPUT_NAME "omohaaded${TARGET_BASE_SUFFIX}${TARGET_ARCH_SUFFIX}${TARGET_CONFIG_SUFFIX}")
set_target_properties(omohaaded PROPERTIES DEBUG_POSTFIX ${CMAKE_DEBUG_POSTFIX})
INSTALL(TARGETS omohaaded DESTINATION ${CMAKE_INSTALL_BINDIR}/${BIN_INSTALL_SUBDIR})
if (MSVC) if (MSVC)
target_link_options(omohaaded PRIVATE "/MANIFEST:NO") target_link_options(omohaaded PRIVATE "/MANIFEST:NO")
INSTALL(FILES $<TARGET_PDB_FILE:omohaaded> DESTINATION ${CMAKE_INSTALL_BINDIR}/${BIN_INSTALL_SUBDIR} OPTIONAL) INSTALL(FILES $<TARGET_PDB_FILE:omohaaded> DESTINATION "./" OPTIONAL)
endif() endif()
if (NOT BUILD_NO_CLIENT) INSTALL(TARGETS omohaaded DESTINATION "./")
##
## Client app
##
option(NO_MODERN_DMA "Use older sound-system" FALSE)
add_subdirectory("code/client") if (WITH_CLIENT)
add_subdirectory("code/renderercommon") ## Client app
add_subdirectory("code/renderer")
add_subdirectory("code/sdl") add_subdirectory("code/sdl")
add_subdirectory("code/client")
#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 ### Gamespy dependency
target_include_directories(openmohaa PUBLIC "code/qcommon" "code/script" "code/gamespy" "code/server" "code/client" "code/uilib") target_include_directories(openmohaa PUBLIC "code/qcommon" "code/script" "code/gamespy" "code/server" "code/client" "code/uilib" "code/jpeg-8c")
set_target_properties(openmohaa PROPERTIES OUTPUT_NAME "openmohaa${TARGET_BIN_SUFFIX}") set_target_properties(openmohaa PROPERTIES OUTPUT_NAME "openmohaa${TARGET_BASE_SUFFIX}${TARGET_ARCH_SUFFIX}${TARGET_CONFIG_SUFFIX}")
set_target_properties(openmohaa PROPERTIES DEBUG_POSTFIX ${CMAKE_DEBUG_POSTFIX})
if(USE_INTERNAL_JPEG)
target_include_directories(openmohaa PUBLIC "code/jpeg-8c")
target_link_libraries(openmohaa PRIVATE jpeg8) target_link_libraries(openmohaa PRIVATE jpeg8)
else() if (USE_OPENAL)
find_package(JPEG REQUIRED) # Try to use OpenAL
target_include_directories(openmohaa PUBLIC ${JPEG_INCLUDE_DIRS}) find_package(OpenAL)
target_link_libraries(openmohaa PRIVATE ${JPEG_LIBRARIES}) if (OPENAL_FOUND)
target_compile_definitions(openmohaa PRIVATE USE_OPENAL=1)
target_include_directories(openmohaa PRIVATE ${OPENAL_INCLUDE_DIR})
target_link_libraries(openmohaa PRIVATE ${OPENAL_LIBRARY})
endif()
endif() endif()
INSTALL(TARGETS openmohaa DESTINATION ${CMAKE_INSTALL_BINDIR}/${BIN_INSTALL_SUBDIR})
if (MSVC) if (MSVC)
target_link_options(openmohaa PRIVATE "/MANIFEST:NO") target_link_options(openmohaa PRIVATE "/MANIFEST:NO")
INSTALL(FILES $<TARGET_PDB_FILE:openmohaa> DESTINATION ${CMAKE_INSTALL_BINDIR}/${BIN_INSTALL_SUBDIR} OPTIONAL) INSTALL(FILES $<TARGET_PDB_FILE:openmohaa> DESTINATION "./" OPTIONAL)
endif() endif()
if(UNIX AND NOT APPLE) INSTALL(TARGETS openmohaa DESTINATION "./")
#
# Desktop entries installation on Unix
#
set(TARGET_ARCH ${TARGET_BIN_SUFFIX})
# Configure the .desktop entries with the arch suffix
configure_file(
misc/linux/org.openmoh.openmohaa.desktop.in
${CMAKE_BINARY_DIR}/misc/linux/org.openmoh.openmohaa.desktop
@ONLY
)
configure_file(
misc/linux/org.openmoh.openmohaab.desktop.in
${CMAKE_BINARY_DIR}/misc/linux/org.openmoh.openmohaab.desktop
@ONLY
)
configure_file(
misc/linux/org.openmoh.openmohaas.desktop.in
${CMAKE_BINARY_DIR}/misc/linux/org.openmoh.openmohaas.desktop
@ONLY
)
# Install .desktop entries
install(FILES ${CMAKE_BINARY_DIR}/misc/linux/org.openmoh.openmohaa.desktop DESTINATION ${CMAKE_INSTALL_DATADIR}/applications)
install(FILES ${CMAKE_BINARY_DIR}/misc/linux/org.openmoh.openmohaab.desktop DESTINATION ${CMAKE_INSTALL_DATADIR}/applications)
install(FILES ${CMAKE_BINARY_DIR}/misc/linux/org.openmoh.openmohaas.desktop DESTINATION ${CMAKE_INSTALL_DATADIR}/applications)
install(FILES misc/linux/org.openmoh.openmohaa.metainfo.xml DESTINATION ${CMAKE_INSTALL_DATADIR}/metainfo)
install(FILES misc/openmohaa.svg DESTINATION ${CMAKE_INSTALL_DATADIR}/icons/hicolor/symbolic/apps/ RENAME org.openmoh.openmohaa.svg)
endif()
endif()
#
# Launcher
#
add_subdirectory(code/Launcher)
#
# uninstall target
#
if(NOT TARGET uninstall)
configure_file(
"${CMAKE_CURRENT_SOURCE_DIR}/cmake_uninstall.cmake.in"
"${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake"
IMMEDIATE @ONLY)
add_custom_target(uninstall
COMMAND ${CMAKE_COMMAND} -P ${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake)
endif() endif()

124
README.md
View file

@ -1,63 +1,111 @@
# OpenMoHAA # OpenMoHAA
[![Build](https://github.com/openmoh/openmohaa/actions/workflows/branches-build.yml/badge.svg?branch=main)](https://github.com/openmoh/openmohaa/actions/workflows/branches-build.yml) [![Release](https://img.shields.io/github/v/release/openmoh/openmohaa)](https://github.com/openmoh/openmohaa/releases) [![Downloads](https://img.shields.io/github/downloads/openmoh/openmohaa/total)](https://github.com/openmoh/openmohaa/releases) / _ \ _ __ ___ _ __ | \/ |/ _ \| | | | / \ / \
| | | | '_ \ / _ \ '_ \| |\/| | | | | |_| | / _ \ / _ \
| |_| | |_) | __/ | | | | | | |_| | _ |/ ___ \ / ___ \
\___/| .__/ \___|_| |_|_| |_|\___/|_| |_/_/ \_\/_/ \_\
|_|
![License](https://img.shields.io/github/license/openmoh/openmohaa) ![Commits](https://img.shields.io/github/commit-activity/t/openmoh/openmohaa)
![Discord](https://img.shields.io/discord/596049712579215361?logo=discord&logoColor=white&color=5865F2)
![logo](misc/openmohaa-text-sm.png) ## Discord
## Intro [![Discord Banner 1](https://discordapp.com/api/guilds/596049712579215361/widget.png?style=banner2)](https://discord.gg/NYtH58R)
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). ## Current State
## Getting started [![Build](https://github.com/openmoh/openmohaa/actions/workflows/build-cmake.yml/badge.svg)](https://github.com/openmoh/openmohaa/actions/workflows/build-cmake.yml)
- [Downloading and installing OpenMoHAA](docs/getting_started_installation.md) OpenMoHAA is still in its early days.
- [Running OpenMoHAA and using expansion assets](docs/getting_started_running.md)
- [Game configuration](docs/configuration.md)
If you encounter any issues, please refer to the [FAQ](docs/faq.md) for possible solutions. ### Server
## Current state The server version can successfully be built.
Some stuff are not working as intended, such as Actor or Vehicle. These systems are both almost fully implemented, but not really in stable state.
### Single-player Overall the server part and the game module are almost fully implemented, but the stability may vary, there may be some minor bugs and crashes.
The entire single-player campaign should work (Allied Assault, Spearhead and Breakthrough). If you encounter any bug, please create a new [GitHub issue](https://github.com/openmoh/openmohaa/issues) describing them. ### Client
### Multiplayer The client version of OpenMoHAA is partially implemented and not stable currently. The cgame module is partially implemented as well, but is compatible with the original MOH:AA game. Credits to **Heavy Metal: F.A.K.K. 2**'s SDK for the cgame module.
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. Here is the current working state for each part of the engine:
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). | Part name | Full | Almost | Half | Early | Bad | Not working | Comment |
|-------------------------|------|--------|------|-------|-----|-------------|-------------------------------------------------------------------|
| Audio | | | | | x | | Very basic implementation from Quake III |
| CG Module | | x | | | | | Missing FX, Marks and decals |
| Client | | | x | | | | Missing GameSpy, server list, binds, map picker, ... |
| Collision | x | | | | | | |
| Model/TIKI/Skeletor | x | | | | | | |
| Renderer | | | | x | | | Missing ghost, marks, sphere lights, sky portal, sun flare, swipe |
| Server | | x | | | | | Probably a few bugs remaining |
| Server module (fgame) | | x | | | | | Actor, vehicle, and few gameplay bugs |
| UI | | | | x | | | Has core features only (menu, widgets, console, hud, urc loading) |
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. NOTE: Both client and server version can be compiled to target **Medal of Honor: Spearhead** and **Medal of Honor: Breakthrough**.
## Features ## Running
- [List of new features](docs/features.md) Backup existing mohaa files, **cgamex86.dll** and **gamex86.dll** (set their extension to **.bak**)
- [Scripting](docs/scripting.md)
## Reporting issues a) extract archive to your MOHAA installation directory.
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. -or-
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). b) Copy all pak*.pk3 files and the sound/ directory from your **MOHAA/main** directory into openmohaa's 'main' directory.
If you have problems running the game :
You may need to install Microsoft Visual C++ 2015/2017/2019/2022 Redistributable from
https://learn.microsoft.com/en-US/cpp/windows/latest-supported-vc-redist?view=msvc-170
You can now start a local OpenMOHAA server or play on a server.
## Compiling ## Compiling
- See [Compiling OpenMoHAA](docs/compiling.md) OpenMoHAA supports both x86 and x64 architectures, and although the target platform is Windows, it still can be compiled for other platforms, and even other architectures.
These are the tools required for all platforms :
- CMake >= 3.5
- Flex and Bison (currently not used)
- A C++11 compiler is required.
The installation directory can be set to MOHAA directory.
The client build can be built by adding `-DWITH_CLIENT=1` to the CMake command line. This will compile the cgame module and the full app with rendering, ui and sound suppport, alongside the dedicated server version.
To compile for either Spearhead or Breakthrough, append `-DTARGET_GAME_TYPE=x` where x can be 1 for Team Assault (Spearhead), and 2 for Team Tactics (Breakthrough). 2 is recommended because Team Tactics can connect to both Spearhead and Breakthrough servers.
### Linux
These are the tools required on Unix :
- Clang >= 3.3 or GCC >= 4.8.1
**clang-3.5** and **gcc-4.8.5** should work (tested on Ubuntu 16.04). Use the latest possible version of those compilers.
SDL2 library is required (libsdl2-dev).
1 line install command with latest clang version : `sudo apt-get install -y ninja-build cmake make clang-15 lld-15 flex bison libsdl2-dev`
Example with **CMake**, **clang-15** and **ninja-build** installed:
```sh
mkdir .cmake && cd .cmake
cmake -DCMAKE_C_COMPILER=clang-15 -DCMAKE_CXX_COMPILER=clang++-15 -DWITH_CLIENT=1 -G Ninja
```
### Windows
Visual Studio (2019 or 2022) is generally preferred.
## Screenshots ## Screenshots
| | | | | |
|-----------------------------------------------------------------------------------|----------------------------------------------------------------------------| |---------------------------------------------------------------------|---------------------------------------------------------------------------|
| ![](docs/images/v0.60.0-x86_64/mohdm1_1.png) | ![](docs/images/v0.60.0-x86_64/training_1.png) | | ![](docs/images/opm_53_tt_1.png "Playing on a Breakthrough server") | ![](docs/images/opm_50b_1.png) |
| ![](docs/images/v0.60.0-x86_64/flughafen_1.png) | ![](docs/images/v0.60.0-x86_64/flughafen_2.png) | | ![](docs/images/opm_50b_2.png) | ![](docs/images/opm-arm_53_tt_1.png "OpenMoHAA on Raspberry") |
| ![](docs/images/v0.60.0-x86_64/mohdm2_1.png "Playing Freeze-Tag mode with bots") | ![](docs/images/v0.60.0-x86_64/training_3.png "Single-Player training") |
*More screenshots [here](docs/images)*
## Third party ## Third party
@ -65,14 +113,20 @@ If you need help or have a problem, you can head over to the [discussions](https
http://www.libsdl.org/ http://www.libsdl.org/
download Source code, compile
### OpenAL ### OpenAL
https://www.openal.org/ https://www.openal.org/ download OpenAL soft source
run cmake on OpenAL, compile
### LibMAD ### LibMAD
http://www.underbit.com/products/mad/ http://www.underbit.com/products/mad/
download source code, compile
### cURL ### cURL
https://curl.se/ https://curl.se/
@ -89,14 +143,8 @@ https://xiph.org/vorbis/
https://opus-codec.org/ https://opus-codec.org/
## Communities ## URLs and communities
### URLs
- https://github.com/openmoh/openmohaa/ - https://github.com/openmoh/openmohaa/
- https://mohaaaa.co.uk/AAAAMOHAA/index.php - https://mohaaaa.co.uk/AAAAMOHAA/index.php
- https://x-null.net/ - https://x-null.net/
### Discord
[![Discord Banner 1](https://discordapp.com/api/guilds/596049712579215361/widget.png?style=banner2)](https://discord.gg/NYtH58R)

25
TODO.TXT Normal file
View file

@ -0,0 +1,25 @@
//// //// //// //// ////
/// OpenMoHAA - TODO ///
//// //// //// //// ////
================
= Server code =
================
1) Fix some crashes
================
= Client =
================
2) Better client/sound implementation
3) Better renderer implementation (light, fog)
4) Better cgame implementation (using FAKK2)
5) UI implementation (unfortunately, the mohaa UI is fully based on FAKK 2 sources but isn't available anywhere)
================
= Game code =
================
6) Finish the vehicle implementation
--- Open Beta ---
7) Actors/SinglePlayer
8) SH/BT features (there are not much things to implement I guess)
--- Release ---

View file

@ -3,12 +3,8 @@ set(archdetect_c_code "
#error cmake_ARCH x86 #error cmake_ARCH x86
#elif defined(__x86_64) || defined(__x86_64__) || defined(__amd64) || defined(_M_X64) #elif defined(__x86_64) || defined(__x86_64__) || defined(__amd64) || defined(_M_X64)
#error cmake_ARCH x86_64 #error cmake_ARCH x86_64
#elif defined(__PPC64__) || defined(__ppc64__) || defined(__powerpc64__) || defined(_ARCH_PPC64) #elif defined(__ppc64__) || defined(__powerpc64__)
# if __BIG_ENDIAN__
#error cmake_ARCH ppc64 #error cmake_ARCH ppc64
# else
# error cmake_ARCH ppc64el
# endif
#elif defined(__ppc__) || defined(__ppc) || defined(__powerpc__) #elif defined(__ppc__) || defined(__ppc) || defined(__powerpc__)
#error cmake_ARCH ppc #error cmake_ARCH ppc
#elif defined __s390__ #elif defined __s390__
@ -17,20 +13,14 @@ set(archdetect_c_code "
#error cmake_ARCH s390x #error cmake_ARCH s390x
#elif defined __ia64__ #elif defined __ia64__
#error cmake_ARCH ia64 #error cmake_ARCH ia64
#elif defined __e2k__
# error cmake_ARCH e2k
#elif defined __alpha__ #elif defined __alpha__
#error cmake_ARCH alpha #error cmake_ARCH alpha
#elif defined __sparc__ #elif defined __sparc__
#error cmake_ARCH sparc #error cmake_ARCH sparc
#elif defined(__aarch64__) || defined(__ARM64__) || defined(_M_ARM64)
# error cmake_ARCH arm64
#elif defined __arm__ || defined (_M_ARM) #elif defined __arm__ || defined (_M_ARM)
# if defined(__ARM_PCS_VFP) && (__ARM_PCS_VFP) #error cmake_ARCH arm
# error cmake_ARCH armhf #elif defined(__aarch64__) || defined(__ARM64__) || defined(_M_ARM64)
# else #error cmake_ARCH aarch64
# error cmake_ARCH armel
# endif
#elif defined __cris__ #elif defined __cris__
#error cmake_ARCH cris #error cmake_ARCH cris
#elif defined __hppa__ #elif defined __hppa__
@ -39,12 +29,6 @@ set(archdetect_c_code "
#error cmake_ARCH mips #error cmake_ARCH mips
#elif defined __sh__ #elif defined __sh__
#error cmake_ARCH sh #error cmake_ARCH sh
#elif defined __riscv
# if __UINTPTR_MAX__ == __UINT64_MAX__
# error cmake_ARCH riscv64
# else
# error cmake_ARCH riscv
# endif
#else #else
#error cmake_ARCH unknown #error cmake_ARCH unknown
#endif #endif
@ -71,14 +55,12 @@ function(target_architecture output_var)
foreach(osx_arch ${CMAKE_OSX_ARCHITECTURES}) foreach(osx_arch ${CMAKE_OSX_ARCHITECTURES})
if("${osx_arch}" STREQUAL "ppc" AND ppc_support) if("${osx_arch}" STREQUAL "ppc" AND ppc_support)
set(osx_arch_ppc TRUE) set(osx_arch_ppc TRUE)
elseif("${osx_arch}" STREQUAL "ppc64" AND ppc_support)
set(osx_arch_ppc64 TRUE)
elseif("${osx_arch}" STREQUAL "i386") elseif("${osx_arch}" STREQUAL "i386")
set(osx_arch_i386 TRUE) set(osx_arch_i386 TRUE)
elseif("${osx_arch}" STREQUAL "x86_64") elseif("${osx_arch}" STREQUAL "x86_64")
set(osx_arch_x86_64 TRUE) set(osx_arch_x86_64 TRUE)
elseif("${osx_arch}" STREQUAL "arm64") elseif("${osx_arch}" STREQUAL "ppc64" AND ppc_support)
set(osx_arch_arm64 TRUE) set(osx_arch_ppc64 TRUE)
else() else()
message(FATAL_ERROR "Invalid OS X arch name: ${osx_arch}") message(FATAL_ERROR "Invalid OS X arch name: ${osx_arch}")
endif() endif()
@ -89,10 +71,6 @@ function(target_architecture output_var)
list(APPEND ARCH ppc) list(APPEND ARCH ppc)
endif() endif()
if(osx_arch_ppc64)
list(APPEND ARCH ppc64)
endif()
if(osx_arch_i386) if(osx_arch_i386)
list(APPEND ARCH i386) list(APPEND ARCH i386)
endif() endif()
@ -101,8 +79,8 @@ function(target_architecture output_var)
list(APPEND ARCH x86_64) list(APPEND ARCH x86_64)
endif() endif()
if(osx_arch_arm64) if(osx_arch_ppc64)
list(APPEND ARCH arm64) list(APPEND ARCH ppc64)
endif() endif()
else() else()
# figure out extension for the source file # figure out extension for the source file

View file

@ -1,21 +0,0 @@
if(NOT EXISTS "@CMAKE_BINARY_DIR@/install_manifest.txt")
message(FATAL_ERROR "Cannot find install manifest: @CMAKE_BINARY_DIR@/install_manifest.txt")
endif()
file(READ "@CMAKE_BINARY_DIR@/install_manifest.txt" files)
string(REGEX REPLACE "\n" ";" files "${files}")
foreach(file ${files})
message(STATUS "Uninstalling $ENV{DESTDIR}${file}")
if(IS_SYMLINK "$ENV{DESTDIR}${file}" OR EXISTS "$ENV{DESTDIR}${file}")
execute_process(
COMMAND "@CMAKE_COMMAND@" -E remove "$ENV{DESTDIR}${file}"
OUTPUT_VARIABLE rm_out
RESULT_VARIABLE rm_retval
)
if(NOT "${rm_retval}" STREQUAL 0)
message(FATAL_ERROR "Problem when removing $ENV{DESTDIR}${file}")
endif()
else(IS_SYMLINK "$ENV{DESTDIR}${file}" OR EXISTS "$ENV{DESTDIR}${file}")
message(STATUS "File $ENV{DESTDIR}${file} does not exist.")
endif()
endforeach()

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,38 +0,0 @@
cmake_minimum_required(VERSION 3.12)
project(Launcher)
set(LAUNCHER_SOURCES "${CMAKE_SOURCE_DIR}/code/Launcher/launch_main.cpp")
if (WIN32)
set(LAUNCHER_SOURCES ${LAUNCHER_SOURCES}
"${CMAKE_SOURCE_DIR}/code/Launcher/launch_win32.cpp"
"${CMAKE_SOURCE_DIR}/code/sys/win_resource.rc")
else()
set(LAUNCHER_SOURCES ${LAUNCHER_SOURCES}
"${CMAKE_SOURCE_DIR}/code/Launcher/launch_linux.cpp")
endif()
function (create_launcher name type)
if (NOT BUILD_NO_CLIENT)
add_executable(openmohaa_launcher_${name} ${LAUNCHER_SOURCES})
target_include_directories(openmohaa_launcher_${name} PUBLIC "../qcommon")
target_compile_definitions(openmohaa_launcher_${name} PRIVATE NO_RC_MANIFEST=1 TARGET_GAME=${type})
target_compile_features(openmohaa_launcher_${name} PRIVATE cxx_std_17)
set_target_properties(openmohaa_launcher_${name} PROPERTIES OUTPUT_NAME "launch_openmohaa_${name}${TARGET_BIN_SUFFIX}")
INSTALL(TARGETS openmohaa_launcher_${name} DESTINATION ${CMAKE_INSTALL_BINDIR}/${BIN_INSTALL_SUBDIR})
endif()
#add_executable(omohaaded_launcher_${name} ${LAUNCHER_SOURCES})
#target_include_directories(omohaaded_launcher_${name} PUBLIC "../qcommon")
#target_compile_definitions(omohaaded_launcher_${name} PRIVATE NO_RC_MANIFEST=1 TARGET_GAME=${type} DEDICATED=1)
#target_compile_features(omohaaded_launcher_${name} PRIVATE cxx_std_17)
#set_target_properties(omohaaded_launcher_${name} PROPERTIES OUTPUT_NAME "launch_omohaaded_${name}${TARGET_BIN_SUFFIX}")
#
#INSTALL(TARGETS omohaaded_launcher_${name} DESTINATION ${CMAKE_INSTALL_BINDIR}/${PROJECT_INSTALL_SUBDIR})
endfunction()
create_launcher(base 0)
create_launcher(spearhead 1)
create_launcher(breakthrough 2)

View file

@ -1,32 +0,0 @@
/*
===========================================================================
Copyright (C) 2024 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
===========================================================================
*/
// launch.h: Base interface for starting programs
#include "q_platform.h"
#include <filesystem>
#include <string>
#include <vector>
std::filesystem::path GetProgramLocation();
void LaunchProgram(const std::filesystem::path& path, const std::vector<std::string>& argumentList);

View file

@ -1,80 +0,0 @@
/*
===========================================================================
Copyright (C) 2024 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
===========================================================================
*/
// main.cpp: Windows implementation of the launcher
#include "launch.h"
#include <unistd.h>
#include <spawn.h>
#include <sys/wait.h>
#include <stdlib.h>
#include <string>
#include <iostream>
extern "C" char** environ;
std::filesystem::path GetProgramLocation()
{
char path[FILENAME_MAX];
ssize_t count = readlink("/proc/self/exe", path, FILENAME_MAX);
return std::filesystem::path(std::string(path, (count > 0) ? count : 0)).parent_path();
}
void LaunchProgram(const std::filesystem::path& path, const std::vector<std::string>& argumentList)
{
pid_t pid;
std::string pathString = path.string();
size_t argCount = argumentList.size();
char** argv;
int status;
argv = new char*[argCount + 2];
argv[0] = (char*)pathString.c_str();
for (size_t i = 0; i < argCount; i++) {
argv[i + 1] = (char*)argumentList[i].c_str();
}
argv[argCount + 1] = NULL;
//status = posix_spawn(&pid, pathString.c_str(), NULL, NULL, argv, environ);
//delete[] argv;
//if (status != 0) {
// std::cout << "posix_spawn returned error: " << status << std::endl;
// return;
//}
//
// Using execve rather than posix_spawn
// This replaces the current process that is not needed anyway
//
status = execve(pathString.c_str(), argv, environ);
delete[] argv;
if (status == -1) {
std::cout << "posix_spawn returned error: " << errno << std::endl;
return;
}
waitpid(pid, NULL, 0);
}

View file

@ -1,67 +0,0 @@
/*
===========================================================================
Copyright (C) 2024 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
===========================================================================
*/
// main.cpp: The launcher
#include "launch.h"
#include <iostream>
#include <string>
#include <vector>
const char* targetGameList[] =
{
"Base",
"Spearhead",
"Breakthrough"
};
int main(int argc, const char* argv[]) {
std::vector<std::string> argumentList;
#if !defined(DEDICATED) || !DEDICATED
const char* programName = "openmohaa" ARCH_SUFFIX DLL_SUFFIX EXE_EXT;
#else
const char* programName = "omohaaded" ARCH_SUFFIX DLL_SUFFIX EXE_EXT;
#endif
argumentList.push_back("+set");
argumentList.push_back("com_target_game");
argumentList.push_back(std::to_string(TARGET_GAME));
for (size_t i = 1; i < argc; i++) {
argumentList.push_back(argv[i]);
}
std::cout << "Using the target game: " << targetGameList[TARGET_GAME] << std::endl;
std::cout << std::endl;
std::cout << "Expected program name: " << programName << std::endl;
const std::filesystem::path programLocation = GetProgramLocation();
const std::filesystem::path programPath = programLocation / programName;
std::cout << "Program location: " << programLocation << std::endl;
std::cout << "Expected path: " << programPath << std::endl;
LaunchProgram(programPath, argumentList);
return 0;
}

View file

@ -1,87 +0,0 @@
/*
===========================================================================
Copyright (C) 2024 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
===========================================================================
*/
// main.cpp: Windows implementation of the launcher
#include "launch.h"
#include <Windows.h>
#include <string>
#include <iostream>
std::filesystem::path GetProgramLocation()
{
wchar_t path[FILENAME_MAX] = { 0 };
GetModuleFileNameW(nullptr, path, FILENAME_MAX);
return std::filesystem::path(path).parent_path();
}
void LaunchProgram(const std::filesystem::path& path, const std::vector<std::string>& argumentList)
{
PROCESS_INFORMATION processInfo;
STARTUPINFOW startupInfo;
BOOL returnValue;
std::wstring osCommandLine;
std::wstring commandLine;
size_t argCount = argumentList.size();
memset(&processInfo, 0, sizeof(processInfo));
memset(&startupInfo, 0, sizeof(startupInfo));
startupInfo.cb = sizeof(startupInfo);
for (size_t i = 0; i < argCount; i++) {
commandLine += L"\"";
commandLine += std::wstring(argumentList[i].begin(), argumentList[i].end());
commandLine += L"\"";
if (i != argCount - 1) {
commandLine += L" ";
}
}
osCommandLine = path.wstring();
osCommandLine += L" ";
osCommandLine += commandLine;
returnValue = CreateProcessW(
path.wstring().c_str(),
(LPWSTR)osCommandLine.c_str(),
NULL,
NULL,
FALSE,
0,
NULL,
std::filesystem::current_path().wstring().c_str(),
&startupInfo,
&processInfo
);
if (!returnValue) {
std::cout << "Error in CreateProcess: " << GetLastError() << std::endl;
return;
}
WaitForSingleObject(processInfo.hProcess, INFINITE);
CloseHandle(processInfo.hProcess);
CloseHandle(processInfo.hThread);
}

View file

@ -933,13 +933,10 @@ static void waitToApplyUpdates(void)
OS forcibly closes the pipe), we will unblock. Then we can loop on OS forcibly closes the pipe), we will unblock. Then we can loop on
kill() until the process is truly gone. */ kill() until the process is truly gone. */
int x = 0; int x = 0;
struct timespec req;
req.tv_sec = 0;
req.tv_nsec = 100000000;
read(3, &x, sizeof (x)); read(3, &x, sizeof (x));
info("Pipe has closed, waiting for process to fully go away now."); info("Pipe has closed, waiting for process to fully go away now.");
while (kill(options.waitforprocess, 0) == 0) { while (kill(options.waitforprocess, 0) == 0) {
nanosleep(&req, NULL); usleep(100000);
} }
#endif #endif
} }

View file

@ -1,5 +1,5 @@
cmake_minimum_required(VERSION 3.12) cmake_minimum_required(VERSION 3.5)
project(cgame) project(fgame)
# Shared source files for modules # Shared source files for modules
set(SOURCES_SHARED set(SOURCES_SHARED
@ -18,20 +18,25 @@ set(SOURCES_SHARED
"../script/scriptvariable.cpp" "../script/scriptvariable.cpp"
) )
file(GLOB_RECURSE SOURCES_BG "../fgame/bg_misc.cpp" "../fgame/bg_pmove.cpp" "../fgame/bg_slidemove.cpp" "../fgame/bg_voteoptions.cpp") file(GLOB_RECURSE SOURCES_BG "../fgame/bg_*.cpp")
file(GLOB_RECURSE SOURCES_CGAME "./*.c" "./*.cpp") file(GLOB_RECURSE SOURCES_CGAME "./*.c" "./*.cpp")
add_library(cgame SHARED ${SOURCES_CGAME} ${SOURCES_BG}) add_library(cgame SHARED ${SOURCES_CGAME} ${SOURCES_BG})
target_compile_definitions(cgame PRIVATE CGAME_DLL) target_compile_definitions(cgame PRIVATE CGAME_DLL TARGET_GAME_TYPE=${TARGET_GAME_TYPE})
target_compile_features(cgame PUBLIC cxx_nullptr) target_compile_features(cgame PUBLIC cxx_nullptr)
target_compile_features(cgame PUBLIC c_variadic_macros) target_compile_features(cgame PUBLIC c_variadic_macros)
target_link_libraries(cgame PUBLIC qcommon) target_link_libraries(cgame PUBLIC qcommon)
set_target_properties(cgame PROPERTIES PREFIX "") set_target_properties(cgame PROPERTIES PREFIX "${TARGET_PLATFORM_PREFIX}")
set_target_properties(cgame PROPERTIES OUTPUT_NAME "cgame${TARGET_BIN_SUFFIX}") set_target_properties(cgame PROPERTIES OUTPUT_NAME "cgame${TARGET_ARCH_SUFFIX}${TARGET_CONFIG_SUFFIX}")
set_target_properties(cgame PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${TARGET_BASE_GAME}")
INSTALL(TARGETS cgame DESTINATION ${CMAKE_INSTALL_LIBDIR}/${LIB_INSTALL_SUBDIR}) INSTALL(
TARGETS cgame
DESTINATION "${TARGET_BASE_GAME}"
ARCHIVE EXCLUDE_FROM_ALL
)
if(MSVC) if(MSVC)
INSTALL(FILES $<TARGET_PDB_FILE:cgame> DESTINATION ${CMAKE_INSTALL_LIBDIR}/${LIB_INSTALL_SUBDIR} OPTIONAL) INSTALL(FILES $<TARGET_PDB_FILE:cgame> DESTINATION "${TARGET_BASE_GAME}" OPTIONAL)
endif() endif()

View file

@ -1,196 +0,0 @@
/*
===========================================================================
Copyright (C) 2023 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 "cg_local.h"
#include "cg_archive.h"
#include "cg_commands.h"
#include "memarchiver.h"
#include "../qcommon/tiki.h"
void CG_ArchiveStuff(MemArchiver& archiver, int svsTime)
{
archiver.SetBaseTime(svsTime);
commandManager.ArchiveToMemory(archiver);
CG_ArchiveVSSGlobals(archiver);
}
size_t CG_SaveStateToBuffer(void** out, int svsTime)
{
MemArchiver archiver;
size_t size;
archiver.SetupForWriting(0x200000);
CG_ArchiveStuff(archiver, svsTime);
size = archiver.BufferSize();
if (size && out) {
*out = archiver.ConfiscateBuffer();
}
return size;
}
qboolean CG_LoadStateToBuffer(void* state, size_t size, int svsTime)
{
MemArchiver archiver;
archiver.SetupForReading((byte*)state, size);
CG_ArchiveStuff(archiver, svsTime);
return archiver.FinishedReading();
}
void CG_ArchiveStringContainer(MemArchiver& archiver, Container<str>* container)
{
int num;
int i;
if (archiver.IsReading()) {
str tmp;
archiver.ArchiveInteger(&num);
container->ClearObjectList();
for (i = 0; i < num; i++) {
archiver.ArchiveString(&tmp);
container->AddObject(tmp);
}
} else {
num = container->NumObjects();
archiver.ArchiveInteger(&num);
for (i = 0; i < num; i++) {
str& tmp = container->ObjectAt(i + 1);
archiver.ArchiveString(&tmp);
}
}
}
void CG_ArchiveTikiPointer(MemArchiver& archiver, dtiki_t** pTiki)
{
str tmp;
if (archiver.IsReading()) {
archiver.ArchiveString(&tmp);
if (tmp.length()) {
*pTiki = cgi.R_Model_GetHandle(cgi.R_RegisterModel(tmp.c_str()));
} else {
*pTiki = NULL;
}
} else {
if (*pTiki) {
tmp = (*pTiki)->name;
}
archiver.ArchiveString(&tmp);
}
}
void CG_ArchiveModelHandle(MemArchiver& archiver, qhandle_t* handle)
{
str tmp;
if (archiver.IsReading()) {
archiver.ArchiveString(&tmp);
if (tmp.length()) {
*handle = cgi.R_RegisterModel(tmp.c_str());
} else {
*handle = (qhandle_t)0;
}
} else {
if (*handle) {
tmp = cgi.R_GetModelName(*handle);
} else {
tmp = "";
}
archiver.ArchiveString(&tmp);
}
}
void CG_ArchiveShaderHandle(MemArchiver& archiver, qhandle_t* handle)
{
str tmp;
if (archiver.IsReading()) {
archiver.ArchiveString(&tmp);
if (tmp.length()) {
*handle = cgi.R_RegisterShader(tmp.c_str());
} else {
*handle = (qhandle_t)0;
}
} else {
if (*handle) {
tmp = cgi.R_GetShaderName(*handle);
} else {
tmp = "";
}
archiver.ArchiveString(&tmp);
}
}
void CG_ArchiveRefEntity(MemArchiver& archiver, refEntity_t* ref)
{
archiver.ArchiveRaw(&ref->reType, sizeof(ref->reType));
archiver.ArchiveInteger(&ref->renderfx);
CG_ArchiveModelHandle(archiver, &ref->hModel);
CG_ArchiveModelHandle(archiver, &ref->hOldModel);
archiver.ArchiveVec3(ref->lightingOrigin);
archiver.ArchiveInteger(&ref->parentEntity);
archiver.ArchiveVec3(ref->axis[0]);
archiver.ArchiveVec3(ref->axis[1]);
archiver.ArchiveVec3(ref->axis[2]);
archiver.ArchiveBoolean(&ref->nonNormalizedAxes);
archiver.ArchiveVec3(ref->origin);
archiver.ArchiveRaw(ref->frameInfo, sizeof(ref->frameInfo));
archiver.ArchiveFloat(&ref->actionWeight);
archiver.ArchiveShort(&ref->wasframe);
archiver.ArchiveFloat(&ref->scale);
archiver.ArchiveVec3(ref->oldorigin);
archiver.ArchiveInteger(&ref->skinNum);
CG_ArchiveShaderHandle(archiver, &ref->customShader);
archiver.ArchiveRaw(ref->shaderRGBA, sizeof(ref->shaderRGBA));
archiver.ArchiveFloat(ref->shaderTexCoord);
archiver.ArchiveFloat(&ref->shaderTexCoord[1]);
archiver.ArchiveFloat(&ref->shaderTime);
archiver.ArchiveInteger(&ref->entityNumber);
archiver.ArchiveRaw(ref->surfaces, 32);
archiver.ArchiveFloat(ref->shader_data);
archiver.ArchiveFloat(&ref->shader_data[1]);
ref->bone_tag = NULL;
ref->bone_quat = NULL;
ref->of = NULL;
ref->nf = NULL;
CG_ArchiveTikiPointer(archiver, &ref->tiki);
archiver.ArchiveInteger(&ref->bonestart);
archiver.ArchiveInteger(&ref->morphstart);
archiver.ArchiveBoolean(&ref->hasMorph);
archiver.ArchiveFloat(&ref->radius);
archiver.ArchiveFloat(&ref->rotation);
}

View file

@ -1,53 +0,0 @@
/*
===========================================================================
Copyright (C) 2023 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:
// Memory archiver
#pragma once
#ifdef __cplusplus
#include "../qcommon/container.h"
#include "../qcommon/str.h"
class MemArchiver;
extern "C" {
#endif
size_t CG_SaveStateToBuffer(void** out, int svsTime);
qboolean CG_LoadStateToBuffer(void* state, size_t size, int svsTime);
#ifdef __cplusplus
void CG_ArchiveStuff(MemArchiver& archiver, int svsTime);
void CG_ArchiveStringContainer(MemArchiver& archiver, Container<str>* container);
void CG_ArchiveTikiPointer(MemArchiver& archiver, dtiki_t** pTiki);
void CG_ArchiveModelHandle(MemArchiver& archiver, qhandle_t* handle);
void CG_ArchiveShaderHandle(MemArchiver& archiver, qhandle_t* handle);
void CG_ArchiveRefEntity(MemArchiver& archiver, refEntity_t* ref);
#endif
#ifdef __cplusplus
}
#endif

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

View file

@ -112,18 +112,11 @@ TIKI file, similar to ScriptMaster in the server game dll.
#define T2_FRICTION (1 << 19) #define T2_FRICTION (1 << 19)
#define T2_VARYCOLOR (1 << 20) #define T2_VARYCOLOR (1 << 20)
#define T2_SPIN (1 << 21) #define T2_SPIN (1 << 21)
#define T2_RELATIVEANGLES (1 << 22)
#define T2_NOTAGAXIS (1 << 23)
class spawnthing_t; class spawnthing_t;
class specialeffect_t; class specialeffect_t;
class MemArchiver;
typedef enum { typedef enum { NOT_RANDOM, RANDOM, CRANDOM } randtype_t;
NOT_RANDOM,
RANDOM,
CRANDOM
} randtype_t;
class cg_common_data : public Class class cg_common_data : public Class
{ {
@ -183,9 +176,6 @@ public:
float decal_orientation; float decal_orientation;
float decal_radius; float decal_radius;
float spin_rotation; float spin_rotation;
public:
void ArchiveToMemory(MemArchiver& archiver);
}; };
inline cg_common_data::cg_common_data() inline cg_common_data::cg_common_data()
@ -254,9 +244,6 @@ public:
spawnthing_t* m_spawnthing; spawnthing_t* m_spawnthing;
void (*touchfcn)(ctempmodel_t* ct, trace_t* trace); void (*touchfcn)(ctempmodel_t* ct, trace_t* trace);
public:
void ArchiveToMemory(MemArchiver& archiver);
}; };
inline ctempmodel_t::ctempmodel_t() inline ctempmodel_t::ctempmodel_t()
@ -323,44 +310,8 @@ public:
int lastPhysicsTime; int lastPhysicsTime;
int lastLightingTime; int lastLightingTime;
qboolean lastValid; qboolean lastValid;
public:
cvssource_t();
public:
void ArchiveToMemory(MemArchiver& archiver);
}; };
inline cvssource_t::cvssource_t()
: next(NULL)
, prev(NULL)
, stnext(NULL)
, stindex(0)
, lastRadius(0)
, lastDensity(0)
, lastColor {0}
, lastLighting {0}
, newRadius(0)
, newDensity(0)
, newColor {0}
, newLighting {0}
, ooRadius(0)
, startAlpha(0)
, roll(0)
, lifeTime(0)
, collisionmask(0)
, parent(0)
, flags(0)
, flags2(0)
, smokeType(0)
, typeInfo(0)
, fadeMult(0)
, scaleMult(0)
, lastPhysicsTime(0)
, lastLightingTime(0)
, lastValid(qfalse)
{}
class cvssourcestate_t class cvssourcestate_t
{ {
public: public:
@ -431,17 +382,16 @@ public:
protected: protected:
qboolean usedNumbers[256]; qboolean usedNumbers[256];
virtual void RemoveEntity(int entnum); virtual void RemoveEntity(int entnum);
public:
void ArchiveToMemory(MemArchiver& archiver);
}; };
inline enttracker_t::enttracker_t() inline enttracker_t::enttracker_t()
{ {
memset(usedNumbers, 0, sizeof(usedNumbers)); memset(usedNumbers, 0, sizeof(usedNumbers));
} }
inline void enttracker_t::RemoveEntity(int entnum) inline void enttracker_t::RemoveEntity(int entnum)
{ {
// If the entnum is a magic number, then clear out the usedNumber field, so // If the entnum is a magic number, then clear out the usedNumber field, so
// that it may be reused for this emitter. // that it may be reused for this emitter.
@ -457,6 +407,7 @@ inline void enttracker_t::RemoveEntity(int entnum)
} }
inline int enttracker_t::AssignNumber(void) inline int enttracker_t::AssignNumber(void)
{ {
int i; int i;
@ -484,9 +435,6 @@ public:
Vector oldorigin; Vector oldorigin;
qboolean active; qboolean active;
qboolean lerp_emitter; qboolean lerp_emitter;
public:
void ArchiveToMemory(MemArchiver& archiver);
}; };
// emitterthing_t is used to keep track of the last time and emitter was updated // emitterthing_t is used to keep track of the last time and emitter was updated
@ -502,9 +450,6 @@ public:
emittertime_t* GetEmitTime(int entnum); emittertime_t* GetEmitTime(int entnum);
virtual void RemoveEntity(int entnum); virtual void RemoveEntity(int entnum);
qboolean startoff; qboolean startoff;
public:
void ArchiveToMemory(MemArchiver& archiver);
}; };
inline void emitterthing_t::RemoveEntity(int entnum) inline void emitterthing_t::RemoveEntity(int entnum)
@ -563,26 +508,23 @@ public:
int entity_number; int entity_number;
int command_number; int command_number;
int last_command_time; int last_command_time;
public:
void ArchiveToMemory(MemArchiver& archiver);
}; };
// This class is used for keeping track of the last time an entity executed a // This class is used for keeping track of the last time an entity executed a
// particular command. A command number must be assigned externally by the user // particular command. A command number must be assigned externally by the user
class commandthing_t : public enttracker_t class commandthing_t : public enttracker_t
{ {
Container<commandtime_t> m_commandtimes; // A list of entity numbers and the last time they
Container<commandtime_t*> m_commandtimes; // A list of entity numbers and the last time they
// executed a command // executed a command
public: public:
commandtime_t* GetLastCommandTime(int entnum, int commandnum); commandtime_t* GetLastCommandTime(int entnum, int commandnum);
virtual void RemoveEntity(int entnum); virtual void RemoveEntity(int entnum);
void ArchiveToMemory(MemArchiver& archiver);
}; };
inline void commandthing_t::RemoveEntity(int entnum) inline void commandthing_t::RemoveEntity(int entnum)
{ {
int num, count; int num, count;
commandtime_t* ct; commandtime_t* ct;
@ -590,7 +532,7 @@ inline void commandthing_t::RemoveEntity(int entnum)
count = m_commandtimes.NumObjects(); count = m_commandtimes.NumObjects();
for (num = count; num >= 1; num--) { for (num = count; num >= 1; num--) {
ct = &m_commandtimes.ObjectAt(num); ct = m_commandtimes.ObjectAt(num);
if (ct->entity_number == entnum) { if (ct->entity_number == entnum) {
m_commandtimes.RemoveObjectAt(num); m_commandtimes.RemoveObjectAt(num);
} }
@ -599,35 +541,40 @@ inline void commandthing_t::RemoveEntity(int entnum)
enttracker_t::RemoveEntity(entnum); enttracker_t::RemoveEntity(entnum);
} }
inline commandtime_t *commandthing_t::GetLastCommandTime(int entnum, int commandnum) inline commandtime_t* commandthing_t::GetLastCommandTime(int entnum,
int commandnum)
{ {
int num, count; int num, count;
commandtime_t* ct;
// Search for this entity number // Search for this entity number
count = m_commandtimes.NumObjects(); count = m_commandtimes.NumObjects();
for (num = 1; num <= count; num++) { for (num = 1; num <= count; num++) {
commandtime_t *ct = &m_commandtimes.ObjectAt(num); ct = m_commandtimes.ObjectAt(num);
if ((ct->entity_number == entnum) && (ct->command_number == commandnum)) { if ((ct->entity_number == entnum) &&
(ct->command_number == commandnum)) {
return ct; return ct;
} }
} }
// Add a new entry if we didn't find it // Add a new entry if we didn't find it
commandtime_t ct; ct = new commandtime_t;
ct.entity_number = entnum; ct->entity_number = entnum;
ct.command_number = commandnum; ct->command_number = commandnum;
ct.last_command_time = 0; ct->last_command_time = 0;
m_commandtimes.AddObject(ct); m_commandtimes.AddObject(ct);
return &m_commandtimes.ObjectAt(m_commandtimes.NumObjects()); return ct;
} }
class spawnthing_t : public emitterthing_t class spawnthing_t : public emitterthing_t
{ {
public: public:
Container<str> m_modellist; // A list of models that should be spawned from the emitter Container<str>
m_modellist; // A list of models that should be spawned from the emitter
Container<str> m_taglist; // A list of tags to create beams Container<str> m_taglist; // A list of tags to create beams
cg_common_data cgd; cg_common_data cgd;
@ -682,18 +629,17 @@ public:
void (*touchfcn)(ctempmodel_t* ct, trace_t* trace); void (*touchfcn)(ctempmodel_t* ct, trace_t* trace);
str GetModel(void); str GetModel(void);
void SetModel(str model); void SetModel(str model);
public:
void ArchiveToMemory(MemArchiver& archiver);
}; };
inline void spawnthing_t::SetModel(str model) inline void spawnthing_t::SetModel(str model)
{ {
m_modellist.ClearObjectList(); m_modellist.ClearObjectList();
m_modellist.AddObject(model); m_modellist.AddObject(model);
} }
inline str spawnthing_t::GetModel(void) inline str spawnthing_t::GetModel(void)
{ {
int num, index; int num, index;
@ -735,7 +681,7 @@ public:
byte modulate[4]; byte modulate[4];
}; };
#define MAX_TEMPMODELS 2048 #define MAX_TEMPMODELS 1024
#define MAX_BEAMS 4096 #define MAX_BEAMS 4096
class ClientGameCommandManager : public Listener class ClientGameCommandManager : public Listener
@ -764,7 +710,6 @@ private:
void SpawnVSSSource(int count, int timealive); void SpawnVSSSource(int count, int timealive);
void EventViewKick(Event* ev); void EventViewKick(Event* ev);
void Print(Event* ev); void Print(Event* ev);
void PrintDeathMsg(Event *ev); // Added in 2.0
void StartBlock(Event* ev); void StartBlock(Event* ev);
void EndBlock(Event* ev); void EndBlock(Event* ev);
void UpdateSpawnThing(spawnthing_t* ep); void UpdateSpawnThing(spawnthing_t* ep);
@ -790,7 +735,6 @@ private:
void SetScaleRate(Event* ev); void SetScaleRate(Event* ev);
void SetRandomVelocity(Event* ev); void SetRandomVelocity(Event* ev);
void SetRandomVelocityAlongAxis(Event* ev); void SetRandomVelocityAlongAxis(Event* ev);
void SetNoTagAxis(Event *ev); // Added in 2.0
void SetAccel(Event* ev); void SetAccel(Event* ev);
void SetFriction(Event* ev); void SetFriction(Event* ev);
void SetSpin(Event* ev); void SetSpin(Event* ev);
@ -819,7 +763,6 @@ private:
void SetParentLink(Event* ev); void SetParentLink(Event* ev);
void SetHardLink(Event* ev); void SetHardLink(Event* ev);
void SetAngles(Event* ev); void SetAngles(Event* ev);
void SetRelativeAngles(Event *ev);
void ParentAngles(Event* ev); void ParentAngles(Event* ev);
void EmitterAngles(Event* ev); void EmitterAngles(Event* ev);
void SetTwinkle(Event* ev); void SetTwinkle(Event* ev);
@ -852,7 +795,6 @@ private:
void StopSound(Event* ev); void StopSound(Event* ev);
void StopAliasChannel(Event* ev); void StopAliasChannel(Event* ev);
void LoopSound(Event* ev); void LoopSound(Event* ev);
void StopLoopSound(Event *ev); // Added in 2.0
void Cache(Event* ev); void Cache(Event* ev);
void CacheImage(Event* ev); void CacheImage(Event* ev);
void CacheFont(Event* ev); void CacheFont(Event* ev);
@ -887,14 +829,18 @@ private:
void SetClampVel(Event* ev); void SetClampVel(Event* ev);
void SetClampVelAxis(Event* ev); void SetClampVelAxis(Event* ev);
ctempmodel_t* AllocateTempModel(void); ctempmodel_t* AllocateTempModel(void);
qboolean TempModelPhysics(ctempmodel_t *p, float ftime, float scale); qboolean TempModelPhysics(ctempmodel_t* p, float ftime, float time2,
qboolean TempModelRealtimeEffects(ctempmodel_t *p, float ftime, float scale); float scale);
qboolean TempModelRealtimeEffects(ctempmodel_t* p, float ftime, float time2,
float scale);
qboolean LerpTempModel(refEntity_t* newEnt, ctempmodel_t* p, float frac); qboolean LerpTempModel(refEntity_t* newEnt, ctempmodel_t* p, float frac);
void SpawnEffect(int count, int timealive); void SpawnEffect(int count, int timealive);
void SpawnTempModel(int count); void SpawnTempModel(int count, int timealive = 0);
void FreeTempModel(ctempmodel_t* le); void FreeTempModel(ctempmodel_t* le);
void AnimateTempModel(ctempmodel_t *ent, Vector origin, refEntity_t *newEnt); void AnimateTempModel(ctempmodel_t* ent, Vector origin,
void OtherTempModelEffects(ctempmodel_t *p, Vector origin, refEntity_t *newEnt); refEntity_t* newEnt);
void OtherTempModelEffects(ctempmodel_t* p, Vector origin,
refEntity_t* newEnt);
qboolean IsBlockCommand(const str& name); qboolean IsBlockCommand(const str& name);
void SetBaseAndAmplitude(Event* ev, Vector& base, Vector& amplitude); void SetBaseAndAmplitude(Event* ev, Vector& base, Vector& amplitude);
@ -931,35 +877,27 @@ public:
ClientGameCommandManager(); ClientGameCommandManager();
void AddTempModels(void); void AddTempModels(void);
void UpdateEmitter(dtiki_t *tiki, vec3_t axis[3], int entity_number, int parent_number, Vector entity_origin); void UpdateEmitter(dtiki_t* tiki, vec3_t axis[3], int entity_number,
int parent_number, Vector entity_origin);
void UpdateBeam(dtiki_t *tiki, int entity_number, spawnthing_t* beamthing); void UpdateBeam(dtiki_t *tiki, int entity_number, spawnthing_t* beamthing);
void PlaySound( void PlaySound(str sound_name, vec3_t origin = NULL,
str sound_name, int channel = CHAN_AUTO, float volume = -1,
const vec3_t origin = NULL, float min_distance = -1, float pitch = -1, int argstype = 0);
int channel = CHAN_AUTO,
float volume = -1,
float min_distance = -1,
float pitch = -1,
int argstype = 0
);
spawnthing_t* InitializeSpawnthing(spawnthing_t* ep); spawnthing_t* InitializeSpawnthing(spawnthing_t* ep);
void SpawnEffect(int count, spawnthing_t* sp); void SpawnEffect(int count, spawnthing_t* sp);
void FreeAllTempModels(void); void FreeAllTempModels(void);
void FreeSomeTempModels(void);
void RestartAllEmitters(void); void RestartAllEmitters(void);
void InitializeTempModels(void); void InitializeTempModels(void);
void InitializeTempModelCvars(void); void InitializeTempModelCvars(void);
void InitializeEmitters(void); void InitializeEmitters(void);
void RemoveClientEntity(int number, dtiki_t *tiki, centity_t *cent, ctempmodel_t *p = NULL); void RemoveClientEntity(int number, dtiki_t* tiki, centity_t* cent,
ctempmodel_t* p = NULL);
void ClearSwipes(void); void ClearSwipes(void);
void FreeSpawnthing(spawnthing_t *sp);
void ResetTempModels(void); void ResetTempModels(void);
void SpawnTempModel(int count, spawnthing_t* sp); void SpawnTempModel(int count, spawnthing_t* sp);
inline void SetSpawnthing(spawnthing_t* st) { m_spawnthing = st; }; inline void SetSpawnthing(spawnthing_t* st) { m_spawnthing = st; };
spawnthing_t* CreateNewEmitter(str emittername); spawnthing_t* CreateNewEmitter(str emittername);
spawnthing_t* CreateNewEmitter(void); spawnthing_t* CreateNewEmitter(void);
spawnthing_t* GetEmitterByName(str emittername); spawnthing_t* GetEmitterByName(str emittername);
@ -985,21 +923,6 @@ public:
void ResetTreadMarkSources(Event* ev); void ResetTreadMarkSources(Event* ev);
void InitializeRainCvars(); void InitializeRainCvars();
void InitializeBeams(); void InitializeBeams();
//
// archive stuff
//
int IdForTempModel(const ctempmodel_t *model);
ctempmodel_t *TempModelForId(int id);
int IdForSpawnThing(const spawnthing_t *sp);
spawnthing_t *SpawnThingForId(int id);
int IdForVssSource(const cvssource_t *source);
cvssource_t *VssSourceForId(int id);
void ArchiveTempModelPointerToMemory(MemArchiver& archiver, ctempmodel_t **model);
void ArchiveSpawnThingPointerToMemory(MemArchiver& archiver, spawnthing_t **sp);
void ArchiveVssSourcePointerToMemory(MemArchiver& archiver, cvssource_t **source);
void ArchiveToMemory(MemArchiver& archiver);
}; };
class EmitterLoader : public Listener class EmitterLoader : public Listener
@ -1016,8 +939,7 @@ public:
void Emitter(Event* ev); void Emitter(Event* ev);
}; };
class EffectsEventQueueNode class EffectsEventQueueNode {
{
public: public:
Event* event; Event* event;
int inttime; int inttime;
@ -1031,12 +953,7 @@ public:
str name; str name;
#endif #endif
EffectsEventQueueNode() EffectsEventQueueNode() { prev = this; next = this; }
{
prev = this;
next = this;
}
EffectsEventQueueNode(Event* event, int inttime, int flags, int entity_num) EffectsEventQueueNode(Event* event, int inttime, int flags, int entity_num)
{ {
this->event = event; this->event = event;

View file

@ -1,6 +1,6 @@
/* /*
=========================================================================== ===========================================================================
Copyright (C) 2008-2024 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.
@ -25,7 +25,6 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
// text commands typed in at the local console, or executed by a key binding // text commands typed in at the local console, or executed by a key binding
#include "cg_local.h" #include "cg_local.h"
#include "../fgame/bg_voteoptions.h"
void CG_TargetCommand_f(void); void CG_TargetCommand_f(void);
@ -62,13 +61,9 @@ Debugging command to print the current position
*/ */
static void CG_Viewpos_f(void) static void CG_Viewpos_f(void)
{ {
cgi.Printf( cgi.Printf("(%i %i %i) : %i\n", (int)cg.refdef.vieworg[0],
"(%i %i %i) : %i\n", (int)cg.refdef.vieworg[1], (int)cg.refdef.vieworg[2],
(int)cg.refdef.vieworg[0], (int)cg.refdefViewAngles[YAW]);
(int)cg.refdef.vieworg[1],
(int)cg.refdef.vieworg[2],
(int)cg.refdefViewAngles[YAW]
);
} }
void CG_SetDesiredObjectiveAlpha(float fAlpha) void CG_SetDesiredObjectiveAlpha(float fAlpha)
@ -80,7 +75,8 @@ void CG_SetDesiredObjectiveAlpha(float fAlpha)
void CG_ScoresDown_f( void ) void CG_ScoresDown_f( void )
{ {
if (cgs.gametype == GT_SINGLE_PLAYER) { if (cgs.gametype == GT_SINGLE_PLAYER)
{
if (!cg.scoresRequestTime) { if (!cg.scoresRequestTime) {
cg.scoresRequestTime = cg.time; cg.scoresRequestTime = cg.time;
CG_SetDesiredObjectiveAlpha(1.0f); CG_SetDesiredObjectiveAlpha(1.0f);
@ -89,7 +85,8 @@ void CG_ScoresDown_f(void)
return; return;
} }
if (cg.scoresRequestTime + 2000 >= cg.time) { if ( cg.scoresRequestTime + 2000 >= cg.time )
{
// send another request // send another request
cg.showScores = qtrue; cg.showScores = qtrue;
CG_PrepScoreBoardInfo(); CG_PrepScoreBoardInfo();
@ -110,9 +107,11 @@ void CG_ScoresDown_f(void)
void CG_ScoresUp_f( void ) void CG_ScoresUp_f( void )
{ {
if (cgs.gametype == GT_SINGLE_PLAYER) { if (cgs.gametype == GT_SINGLE_PLAYER)
if (cg.scoresRequestTime) { {
cg.scoresRequestTime = 0; if (!cg.scoresRequestTime)
{
cg.scoresRequestTime = cg.time;
CG_SetDesiredObjectiveAlpha(0.0f); CG_SetDesiredObjectiveAlpha(0.0f);
} }
@ -146,8 +145,13 @@ baseshader_t *CG_GetShaderUnderCrosshair(qboolean bVerbose, trace_t *pRetTrace)
return NULL; return NULL;
} }
if (bVerbose) { if (bVerbose)
cgi.Printf("Surface hit at (%i %i %i)\n", (int)trace.endpos[0], (int)trace.endpos[1], (int)trace.endpos[2]); {
cgi.Printf(
"Surface hit at (%i %i %i)\n",
(int)trace.endpos[0],
(int)trace.endpos[1],
(int)trace.endpos[2]);
} }
pShader = cgi.GetShader(trace.shaderNum); pShader = cgi.GetShader(trace.shaderNum);
@ -160,157 +164,17 @@ baseshader_t *CG_GetShaderUnderCrosshair(qboolean bVerbose, trace_t *pRetTrace)
static void CG_PrintContentTypes(int iContentFlags) static void CG_PrintContentTypes(int iContentFlags)
{ {
if (iContentFlags & CONTENTS_SOLID) { // FIXME: unimplemented
cgi.Printf(" solid");
}
if (iContentFlags & CONTENTS_LAVA) {
cgi.Printf(" lava");
}
if (iContentFlags & CONTENTS_SLIME) {
cgi.Printf(" slime");
}
if (iContentFlags & CONTENTS_WATER) {
cgi.Printf(" water");
}
if (iContentFlags & CONTENTS_FOG) {
cgi.Printf(" fog");
}
if (iContentFlags & CONTENTS_FENCE) {
cgi.Printf(" fence");
}
if (iContentFlags & CONTENTS_AREAPORTAL) {
cgi.Printf(" areaportal");
}
if (iContentFlags & CONTENTS_PLAYERCLIP) {
cgi.Printf(" playerclip");
}
if (iContentFlags & CONTENTS_VEHICLECLIP) {
cgi.Printf(" vehicleclip");
}
if (iContentFlags & CONTENTS_MONSTERCLIP) {
cgi.Printf(" monsterclip");
}
if (iContentFlags & CONTENTS_WEAPONCLIP) {
cgi.Printf(" weaponclip");
}
if (iContentFlags & CONTENTS_SHOOTONLY) {
cgi.Printf(" shootableonly");
}
if (iContentFlags & CONTENTS_ORIGIN) {
cgi.Printf(" origin");
}
if (iContentFlags & CONTENTS_TRANSLUCENT) {
cgi.Printf(" trans");
}
} }
static void CG_PrintSurfaceProperties(int iSurfaceFlags) static void CG_PrintSurfaceProperties(int iSurfaceFlags)
{ {
if (iSurfaceFlags & SURF_NODAMAGE) { // FIXME: unimplemented
cgi.Printf(" nodamage");
}
if (iSurfaceFlags & SURF_SLICK) {
cgi.Printf(" slick");
}
if (iSurfaceFlags & SURF_SKY) {
cgi.Printf(" sky");
}
if (iSurfaceFlags & SURF_LADDER) {
cgi.Printf(" ladder");
}
if (iSurfaceFlags & SURF_NOIMPACT) {
cgi.Printf(" noimpact");
}
if (iSurfaceFlags & SURF_NOMARKS) {
cgi.Printf(" nomarks");
}
if (iSurfaceFlags & SURF_CASTSHADOW) {
cgi.Printf(" castshadow");
}
if (iSurfaceFlags & SURF_NODRAW) {
cgi.Printf(" nodraw");
}
if (iSurfaceFlags & SURF_NOLIGHTMAP) {
cgi.Printf(" nolightmap");
}
if (iSurfaceFlags & SURF_ALPHASHADOW) {
cgi.Printf(" alphashadow");
}
if (iSurfaceFlags & SURF_NOSTEPS) {
cgi.Printf(" nofootsteps");
}
if (iSurfaceFlags & SURF_NONSOLID) {
cgi.Printf(" nonsolid");
}
if (iSurfaceFlags & SURF_OVERBRIGHT) {
cgi.Printf(" overbright");
}
if (iSurfaceFlags & SURF_BACKSIDE) {
cgi.Printf(" backside");
}
if (iSurfaceFlags & SURF_NODLIGHT) {
cgi.Printf(" nodlight");
}
if (iSurfaceFlags & SURF_HINT) {
cgi.Printf(" hint");
}
if (iSurfaceFlags & SURF_PATCH) {
cgi.Printf(" patch");
}
} }
static void CG_PrintSurfaceType(int iSurfType) static void CG_PrintSurfaceType(int iSurfType)
{ {
switch (iSurfType & MASK_SURF_TYPE) { // FIXME: unimplemented
case SURF_FOLIAGE:
cgi.Printf("foliage");
break;
case SURF_SNOW:
cgi.Printf("snow");
break;
case SURF_CARPET:
cgi.Printf("carpet");
break;
case SURF_SAND:
cgi.Printf("sand");
break;
case SURF_PUDDLE:
cgi.Printf("puddle");
break;
case SURF_GLASS:
cgi.Printf("glass");
break;
case SURF_GRAVEL:
cgi.Printf("gravel");
break;
case SURF_MUD:
cgi.Printf("mud");
break;
case SURF_DIRT:
cgi.Printf("dirt");
break;
case SURF_GRILL:
cgi.Printf("metal grill");
break;
case SURF_GRASS:
cgi.Printf("grass");
break;
case SURF_ROCK:
cgi.Printf("rock");
break;
case SURF_PAPER:
cgi.Printf("paper");
break;
case SURF_WOOD:
cgi.Printf("wood");
break;
case SURF_METAL:
cgi.Printf("metal");
break;
default:
cgi.Printf("!!*none specified*!!");
break;
}
} }
void CG_GetCHShader(void) void CG_GetCHShader(void)
@ -320,10 +184,14 @@ void CG_GetCHShader(void)
pShader = CG_GetShaderUnderCrosshair(qtrue, &trace); pShader = CG_GetShaderUnderCrosshair(qtrue, &trace);
cgi.Printf("\n"); cgi.Printf("\n");
if (pShader) { if (pShader)
if (pShader->surfaceFlags & SURF_SKY) { {
if (pShader->surfaceFlags & SURF_SKY)
{
cgi.Printf("Hit the sky\n"); cgi.Printf("Hit the sky\n");
} else { }
else
{
cgi.Printf("Shader: %s\n", pShader->shader); cgi.Printf("Shader: %s\n", pShader->shader);
cgi.Printf("Shader Contents:"); cgi.Printf("Shader Contents:");
CG_PrintContentTypes(pShader->contentFlags); CG_PrintContentTypes(pShader->contentFlags);
@ -344,7 +212,9 @@ void CG_GetCHShader(void)
CG_PrintSurfaceType(trace.surfaceFlags); CG_PrintSurfaceType(trace.surfaceFlags);
cgi.Printf("\n\n"); cgi.Printf("\n\n");
} }
} else { }
else
{
cgi.Printf("No surface selected\n"); cgi.Printf("No surface selected\n");
} }
} }
@ -355,12 +225,15 @@ void CG_EditCHShader(void)
baseshader_t* pShader; baseshader_t* pShader;
pShader = CG_GetShaderUnderCrosshair(qfalse, NULL); pShader = CG_GetShaderUnderCrosshair(qfalse, NULL);
if (pShader) { if (pShader)
Q_strncpyz(name, "editspecificshader ", sizeof(name)); {
Q_strcat(name, sizeof(name), pShader->shader); strcpy(name, "editspecificshader ");
Q_strcat(name, sizeof(name), "\n"); strcat(name, pShader->shader);
strcat(name, "\n");
cgi.AddCommand(name); cgi.AddCommand(name);
} else { }
else
{
cgi.Printf("No surface selected\n"); cgi.Printf("No surface selected\n");
} }
} }
@ -530,15 +403,6 @@ static consoleCommand_t commands[] = {
{ "instamsg_group_e", &CG_InstaMessageGroupE_f }, { "instamsg_group_e", &CG_InstaMessageGroupE_f },
{ "pushmenu_teamselect", &CG_PushMenuTeamSelect_f }, { "pushmenu_teamselect", &CG_PushMenuTeamSelect_f },
{ "pushmenu_weaponselect", &CG_PushMenuWeaponSelect_f }, { "pushmenu_weaponselect", &CG_PushMenuWeaponSelect_f },
// Added in 2.0
{"pushcallvote", &CG_PushCallVote_f },
{"pushcallvotesublist", &CG_PushCallVoteSubList_f },
{"pushcallvotesubtext", &CG_PushCallVoteSubText_f },
{"pushcallvotesubinteger", &CG_PushCallVoteSubInteger_f},
{"pushcallvotesubfloat", &CG_PushCallVoteSubFloat_f },
{"pushcallvotesubclient", &CG_PushCallVoteSubClient_f },
{"pushvote", &CG_PushVote_f },
{"callentryvote", &CG_CallEntryVote_f },
}; };
/* /*
@ -705,5 +569,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;
} }

File diff suppressed because it is too large Load diff

View file

@ -23,7 +23,6 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
// cg_ents.c -- present snapshot entities, happens every single frame // cg_ents.c -- present snapshot entities, happens every single frame
#include "cg_local.h" #include "cg_local.h"
#include "cg_radar.h"
/* /*
========================================================================== ==========================================================================
@ -42,7 +41,8 @@ void CG_SetEntitySoundPosition(centity_t *cent)
{ {
vec3_t origin; vec3_t origin;
if (cent->currentState.solid == SOLID_BMODEL) { if ( cent->currentState.solid == SOLID_BMODEL )
{
float *v; float *v;
vec3_t vel; vec3_t vel;
@ -54,8 +54,11 @@ void CG_SetEntitySoundPosition(centity_t *cent)
vel[2] = 0.0; vel[2] = 0.0;
cgi.S_UpdateEntity( cent->currentState.number, origin, vel, qfalse ); cgi.S_UpdateEntity( cent->currentState.number, origin, vel, qfalse );
} else { }
if (cent && cg.snap && cent->currentState.parent == cg.snap->ps.clientNum) { else
{
if ( cent && cg.snap && cent->currentState.parent == cg.snap->ps.clientNum )
{
vec3_t origin; vec3_t origin;
vec3_t velocity; vec3_t velocity;
@ -68,7 +71,9 @@ void CG_SetEntitySoundPosition(centity_t *cent)
velocity[2] = 0; velocity[2] = 0;
cgi.S_UpdateEntity( cent->currentState.number, origin, velocity, qtrue ); cgi.S_UpdateEntity( cent->currentState.number, origin, velocity, qtrue );
} else { }
else
{
CG_GetOrigin( cent, origin ); CG_GetOrigin( cent, origin );
cgi.S_UpdateEntity( cent->currentState.number, origin, cent->currentState.pos.trDelta, qfalse ); cgi.S_UpdateEntity( cent->currentState.number, origin, cent->currentState.pos.trDelta, qfalse );
} }
@ -90,7 +95,8 @@ void CG_EntityEffects(centity_t *cent)
cent->color[ 2 ] = cent->client_color[ 2 ]; cent->color[ 2 ] = cent->client_color[ 2 ];
cent->color[ 3 ] = cent->client_color[ 3 ]; cent->color[ 3 ] = cent->client_color[ 3 ];
if (cent->currentState.constantLight != 0xffffff) { if ( cent->currentState.constantLight != 0xffffff )
{
int style; int style;
unsigned cl; unsigned cl;
float i, r, g, b; float i, r, g, b;
@ -101,7 +107,8 @@ void CG_EntityEffects(centity_t *cent)
g = ( float )( ( cl >> 8 ) & 255 ) / 255.0f; g = ( float )( ( cl >> 8 ) & 255 ) / 255.0f;
b = ( float )( ( cl >> 16 ) & 255 ) / 255.0f; b = ( float )( ( cl >> 16 ) & 255 ) / 255.0f;
i = ( ( cl >> 24 ) & 255 ) * CONSTANTLIGHT_RADIUS_SCALE; i = ( ( cl >> 24 ) & 255 ) * CONSTANTLIGHT_RADIUS_SCALE;
if (cent->currentState.renderfx & RF_LIGHTSTYLE_DLIGHT) { if ( cent->currentState.renderfx & RF_LIGHTSTYLE_DLIGHT )
{
float color[ 4 ]; float color[ 4 ];
CG_LightStyleColor( style, cg.time, color, qfalse ); CG_LightStyleColor( style, cg.time, color, qfalse );
@ -110,39 +117,40 @@ void CG_EntityEffects(centity_t *cent)
b = color[ 2 ]; b = color[ 2 ];
i *= color[ 3 ]; i *= color[ 3 ];
} }
if (i) { if ( i )
{
int flags; int flags;
flags = 0; flags = 0;
if (cent->currentState.renderfx & RF_LENSFLARE) { if ( cent->currentState.renderfx & RF_LENSFLARE )
{
flags |= lensflare; flags |= lensflare;
} else if (cent->currentState.renderfx & RF_VIEWLENSFLARE) { }
else if ( cent->currentState.renderfx & RF_VIEWLENSFLARE )
{
flags |= viewlensflare; flags |= viewlensflare;
} }
if (cent->currentState.renderfx & RF_ADDITIVE_DLIGHT) { if ( cent->currentState.renderfx & RF_ADDITIVE_DLIGHT )
{
flags |= additive; flags |= additive;
} }
cgi.R_AddLightToScene( cent->lerpOrigin, i, r, g, b, flags ); cgi.R_AddLightToScene( cent->lerpOrigin, i, r, g, b, flags );
} }
if (r < cent->color[0]) { if ( r < cent->color[ 0 ] )
cent->color[ 0 ] = r; cent->color[ 0 ] = r;
} if ( g < cent->color[ 1 ] )
if (g < cent->color[1]) {
cent->color[ 1 ] = g; cent->color[ 1 ] = g;
} if ( b < cent->color[ 2 ] )
if (b < cent->color[2]) {
cent->color[ 2 ] = b; cent->color[ 2 ] = b;
} }
} }
}
/* /*
================== ==================
CG_General CG_General
================== ==================
*/ */
void CG_General(centity_t *cent) void CG_General( centity_t *cent ) {
{
refEntity_t ent; refEntity_t ent;
entityState_t *s1; entityState_t *s1;
int i; int i;
@ -151,45 +159,18 @@ void CG_General(centity_t *cent)
s1 = &cent->currentState; s1 = &cent->currentState;
// add loop sound // add loop sound
if (s1->loopSound) { if ( s1->loopSound )
cgi.S_AddLoopingSound( {
cent->lerpOrigin, cgi.S_AddLoopingSound( cent->lerpOrigin, vec3_origin, cgs.sound_precache[s1->loopSound], s1->loopSoundVolume, s1->loopSoundMinDist, s1->loopSoundMaxDist, s1->loopSoundPitch, s1->loopSoundFlags );
vec3_origin,
cgs.sound_precache[s1->loopSound],
s1->loopSoundVolume,
s1->loopSoundMinDist,
s1->loopSoundMaxDist,
s1->loopSoundPitch,
s1->loopSoundFlags
);
}
if (cent->tikiLoopSound) {
cgi.S_AddLoopingSound(
cent->lerpOrigin,
vec3_origin,
cent->tikiLoopSound,
cent->tikiLoopSoundVolume,
cent->tikiLoopSoundMinDist,
cent->tikiLoopSoundMaxDist,
cent->tikiLoopSoundPitch,
cent->tikiLoopSoundFlags
);
}
if (s1->renderfx & RF_SKYORIGIN) {
AnglesToAxis(cent->lerpAngles, cg.sky_axis);
VectorCopy(cent->lerpOrigin, cg.sky_origin);
} }
if ( cent->tikiLoopSound )
cgi.S_AddLoopingSound( cent->lerpOrigin, vec3_origin, cent->tikiLoopSound, cent->tikiLoopSoundVolume, cent->tikiLoopSoundMinDist, cent->tikiLoopSoundMaxDist, cent->tikiLoopSoundPitch, cent->tikiLoopSoundFlags );
// if set to invisible, skip // if set to invisible, skip
if (!s1->modelindex) { if (!s1->modelindex) {
return; return;
} }
if (s1->renderfx & RF_DONTDRAW) {
return;
}
memset (&ent, 0, sizeof(ent)); memset (&ent, 0, sizeof(ent));
// set frame // set frame
@ -201,8 +182,10 @@ void CG_General(centity_t *cent)
// set skin // set skin
IntegerToBoundingBox(s1->solid, vMins, vMaxs); IntegerToBoundingBox(s1->solid, vMins, vMaxs);
VectorMA(ent.origin, 0.5f, ent.lightingOrigin, ent.lightingOrigin);
VectorSubtract(vMins, vMaxs, vTmp); VectorSubtract(vMins, vMaxs, vTmp);
ent.lightingOrigin[0] = ent.origin[0] + (vMins[0] + vMaxs[0]) * 0.5;
ent.lightingOrigin[1] = ent.origin[1] + (vMins[1] + vMaxs[1]) * 0.5;
ent.lightingOrigin[2] = ent.origin[2] + (vMins[2] + vMaxs[2]) * 0.5;
ent.radius = VectorLength(vTmp) * 0.5; ent.radius = VectorLength(vTmp) * 0.5;
ent.skinNum = s1->skinNum; ent.skinNum = s1->skinNum;
@ -213,14 +196,16 @@ void CG_General(centity_t *cent)
memcpy( ent.surfaces, s1->surfaces, MAX_MODEL_SURFACES ); memcpy( ent.surfaces, s1->surfaces, MAX_MODEL_SURFACES );
// Modulation based off the color // Modulation based off the color
for (i = 0; i < 3; i++) { for( i=0; i<3; i++ )
ent.shaderRGBA[ i ] = cent->color[ i ] * 255; ent.shaderRGBA[ i ] = cent->color[ i ] * 255;
}
// take the alpha from the entity if less than 1, else grab it from the client commands version // take the alpha from the entity if less than 1, else grab it from the client commands version
if (s1->alpha < 1) { if ( s1->alpha < 1 )
{
ent.shaderRGBA[ 3 ] = s1->alpha * 255; ent.shaderRGBA[ 3 ] = s1->alpha * 255;
} else { }
else
{
ent.shaderRGBA[ 3 ] = cent->color[ 3 ] * 255; ent.shaderRGBA[ 3 ] = cent->color[ 3 ] * 255;
} }
@ -228,9 +213,12 @@ void CG_General(centity_t *cent)
AnglesToAxis( cent->lerpAngles, ent.axis ); AnglesToAxis( cent->lerpAngles, ent.axis );
// Interpolated state variables // Interpolated state variables
if (cent->interpolate) { if ( cent->interpolate )
{
ent.scale = s1->scale + cg.frameInterpolation * ( cent->nextState.scale - cent->currentState.scale ); ent.scale = s1->scale + cg.frameInterpolation * ( cent->nextState.scale - cent->currentState.scale );
} else { }
else
{
ent.scale = s1->scale; ent.scale = s1->scale;
} }
// set the entity number // set the entity number
@ -241,14 +229,23 @@ void CG_General(centity_t *cent)
ent.shader_data[ 1 ] = s1->skinNum; ent.shader_data[ 1 ] = s1->skinNum;
ent.renderfx |= s1->renderfx; ent.renderfx |= s1->renderfx;
if ( ent.renderfx & RF_SKYORIGIN )
{
memcpy( cg.sky_axis, ent.axis, sizeof( cg.sky_axis ) );
VectorCopy( ent.origin, cg.sky_origin );
}
ent.tiki = cgi.R_Model_GetHandle(cgs.model_draw[s1->modelindex]); ent.tiki = cgi.R_Model_GetHandle(cgs.model_draw[s1->modelindex]);
ent.frameInfo[0] = s1->frameInfo[0]; ent.frameInfo[0].index = s1->frameInfo[0].index;
ent.frameInfo[0].time = s1->frameInfo[0].time;
ent.frameInfo[0].weight = s1->frameInfo[0].weight;
ent.actionWeight = 1.0; ent.actionWeight = 1.0;
// add to refresh list // add to refresh list
cgi.R_AddRefEntityToScene (&ent, ENTITYNUM_NONE); cgi.R_AddRefEntityToScene (&ent, ENTITYNUM_NONE);
if (ent.tiki) { if (ent.tiki)
{
// update any emitter's... // update any emitter's...
CG_UpdateEntityEmitters(s1->number, &ent, cent); CG_UpdateEntityEmitters(s1->number, &ent, cent);
} }
@ -268,7 +265,8 @@ void CG_Speaker(centity_t *cent)
return; // not auto triggering return; // not auto triggering
} }
if (cg.time < cent->miscTime) { if ( cg.time < cent->miscTime )
{
return; return;
} }
@ -280,13 +278,13 @@ void CG_Speaker(centity_t *cent)
cent->miscTime = cg.time + cent->currentState.wasframe * 100 + cent->currentState.clientNum * 100 * crandom(); cent->miscTime = cg.time + cent->currentState.wasframe * 100 + cent->currentState.clientNum * 100 * crandom();
} }
/* /*
=============== ===============
CG_Mover CG_Mover
=============== ===============
*/ */
void CG_Mover(centity_t *cent) void CG_Mover( centity_t *cent ) {
{
refEntity_t ent; refEntity_t ent;
entityState_t *s1; entityState_t *s1;
@ -319,8 +317,7 @@ void CG_Mover(centity_t *cent)
CG_Beam CG_Beam
=============== ===============
*/ */
void CG_Beam(centity_t *cent) void CG_Beam( centity_t *cent ) {
{
entityState_t *s1; entityState_t *s1;
vec3_t vz={0,0,0},origin={0,0,0}; vec3_t vz={0,0,0},origin={0,0,0};
float modulate[4]; float modulate[4];
@ -328,26 +325,28 @@ void CG_Beam(centity_t *cent)
s1 = &cent->currentState; s1 = &cent->currentState;
for (i = 0; i < 4; i++) { for ( i=0;i<4;i++ )
modulate[i] = cent->color[i]; modulate[i] = cent->color[i];
}
if (s1->beam_entnum != ENTITYNUM_NONE) { if ( s1->beam_entnum != ENTITYNUM_NONE )
{
refEntity_t *parent; refEntity_t *parent;
parent = cgi.R_GetRenderEntity( s1->beam_entnum); parent = cgi.R_GetRenderEntity( s1->beam_entnum);
if (!parent) { if ( !parent )
{
cgi.DPrintf( "CG_Beam: Could not find parent entity\n" ); cgi.DPrintf( "CG_Beam: Could not find parent entity\n" );
return; return;
} }
VectorAdd( s1->origin, parent->origin, origin ); VectorAdd( s1->origin, parent->origin, origin );
} else { }
else
{
VectorCopy( s1->origin, origin ); VectorCopy( s1->origin, origin );
} }
CG_CreateBeam( CG_CreateBeam( origin, // start
origin, // start
vz, // dir ( auto calculated by using origin2-origin ) vz, // dir ( auto calculated by using origin2-origin )
s1->number, // owner number s1->number, // owner number
cgs.model_draw[s1->modelindex], //hModel cgs.model_draw[s1->modelindex], //hModel
@ -374,7 +373,11 @@ void CG_Beam(centity_t *cent)
); );
} }
void CG_Decal(centity_t *cent)
void CG_Decal
(
centity_t *cent
)
{ {
qhandle_t shader; qhandle_t shader;
@ -385,24 +388,21 @@ void CG_Decal(centity_t *cent)
shader = cgi.R_RegisterShader( CG_ConfigString( CS_IMAGES + s1->tag_num ) ); shader = cgi.R_RegisterShader( CG_ConfigString( CS_IMAGES + s1->tag_num ) );
ByteToDir( s1->surfaces[0], dir ); ByteToDir( s1->surfaces[0], dir );
CG_ImpactMark( CG_ImpactMark( shader,
shader,
s1->origin, s1->origin,
dir, dir,
s1->angles[2], s1->angles[2],
s1->scale,
s1->scale,
cent->color[0], cent->color[0],
cent->color[1], cent->color[1],
cent->color[2], cent->color[2],
cent->color[3], cent->color[3],
qtrue, qtrue,
s1->scale,
qfalse, qfalse,
qtrue, -1,
qfalse, qfalse,
0.5f, 0.f,
0.5f 0.f);
);
} }
/* /*
@ -410,15 +410,16 @@ void CG_Decal(centity_t *cent)
CG_Portal CG_Portal
=============== ===============
*/ */
void CG_Portal(centity_t *cent) {} void CG_Portal(centity_t* cent)
{
}
/* /*
================ ================
BG_EvaluateTrajectory BG_EvaluateTrajectory
================ ================
*/ */
void BG_EvaluateTrajectory(const trajectory_t *tr, int atTime, const vec3_t base, vec3_t result) void BG_EvaluateTrajectory(const trajectory_t* tr, int atTime, const vec3_t base, vec3_t result) {
{
float deltaTime; float deltaTime;
if (atTime > cg_smoothClientsTime->integer + tr->trTime) { if (atTime > cg_smoothClientsTime->integer + tr->trTime) {
@ -445,8 +446,10 @@ void CG_CalcEntityLerpPositions(centity_t *cent)
f = cg.frameInterpolation; f = cg.frameInterpolation;
if (cent->currentState.eType == ET_PLAYER) { if (cent->currentState.eType == ET_PLAYER)
if (cent->currentState.number == cg.snap->ps.clientNum) { {
if (cent->currentState.number == cg.snap->ps.clientNum)
{
// if the player, take position from prediction // if the player, take position from prediction
VectorCopy(cg.predicted_player_state.origin, cent->lerpOrigin); VectorCopy(cg.predicted_player_state.origin, cent->lerpOrigin);
for (i = 0; i < 3; i++) { for (i = 0; i < 3; i++) {
@ -468,20 +471,22 @@ void CG_CalcEntityLerpPositions(centity_t *cent)
} }
for (i = 0; i < 3; i++) { for (i = 0; i < 3; i++) {
cent->lerpOrigin[i] = cent->lerpOrigin[i] = cent->currentState.origin[i] +
cent->currentState.origin[i] + f * (cent->nextState.origin[i] - cent->currentState.origin[i]); f * (cent->nextState.origin[i] - cent->currentState.origin[i]);
} }
if (!memcmp(cent->currentState.angles, cent->nextState.angles, sizeof(vec3_t))) { if (!memcmp(cent->currentState.angles, cent->nextState.angles, sizeof(vec3_t))) {
VectorCopy(cent->currentState.angles, cent->lerpAngles); VectorCopy(cent->currentState.angles, cent->lerpAngles);
} else { }
else {
// use spherical interpolation using quaternions so that bound objects // use spherical interpolation using quaternions so that bound objects
// rotate properly without gimble lock. // rotate properly without gimble lock.
SlerpQuaternion(cent->currentState.quat, cent->nextState.quat, f, quat); SlerpQuaternion(cent->currentState.quat, cent->nextState.quat, f, quat);
QuatToMat(quat, mat); QuatToMat(quat, mat);
MatrixToEulerAngles(mat, cent->lerpAngles); MatrixToEulerAngles(mat, cent->lerpAngles);
} }
} else if (cent->interpolate) { }
else if (cent->interpolate) {
float quat[4]; float quat[4];
float mat[3][3]; float mat[3][3];
@ -500,14 +505,16 @@ void CG_CalcEntityLerpPositions(centity_t *cent)
if (!memcmp(cent->currentState.angles, cent->nextState.angles, sizeof(vec3_t))) { if (!memcmp(cent->currentState.angles, cent->nextState.angles, sizeof(vec3_t))) {
VectorCopy(cent->currentState.angles, cent->lerpAngles); VectorCopy(cent->currentState.angles, cent->lerpAngles);
} else { }
else {
// use spherical interpolation using quaternions so that bound objects // use spherical interpolation using quaternions so that bound objects
// rotate properly without gimble lock. // rotate properly without gimble lock.
SlerpQuaternion(cent->currentState.quat, cent->nextState.quat, f, quat); SlerpQuaternion(cent->currentState.quat, cent->nextState.quat, f, quat);
QuatToMat(quat, mat); QuatToMat(quat, mat);
MatrixToEulerAngles(mat, cent->lerpAngles); MatrixToEulerAngles(mat, cent->lerpAngles);
} }
} else { }
else {
// just use the current frame and evaluate as best we can // just use the current frame and evaluate as best we can
BG_EvaluateTrajectory(&cent->currentState.pos, cg.time, cent->currentState.origin, cent->lerpOrigin); BG_EvaluateTrajectory(&cent->currentState.pos, cg.time, cent->currentState.origin, cent->lerpOrigin);
VectorCopy(cent->currentState.angles, cent->lerpAngles); VectorCopy(cent->currentState.angles, cent->lerpAngles);
@ -553,9 +560,6 @@ void CG_AddCEntity(centity_t *cent)
case ET_PLAYER: case ET_PLAYER:
CG_Player(cent); CG_Player(cent);
CG_Splash(cent); CG_Splash(cent);
CG_ModelAnim(cent, qfalse);
CG_UpdateRadarClient(cent);
break;
case ET_ITEM: case ET_ITEM:
CG_ModelAnim(cent, qfalse); CG_ModelAnim(cent, qfalse);
break; break;
@ -597,8 +601,7 @@ CG_AddPacketEntities
=============== ===============
*/ */
void CG_AddPacketEntities(void) void CG_AddPacketEntities( void ) {
{
int num; int num;
centity_t *cent; centity_t *cent;
int child, parent; int child, parent;
@ -636,13 +639,16 @@ void CG_AddPacketEntities(void)
cent = &cg_entities[child]; cent = &cg_entities[child];
// add the parent first // add the parent first
// so attachments are consistent // so attachments are consistent
for (parent = cent->currentState.parent; parent != ENTITYNUM_NONE && !processed[parent]; for (parent = cent->currentState.parent;
parent = cg_entities[parent].currentState.parent) { parent != ENTITYNUM_NONE && !processed[parent];
parent = cg_entities[parent].currentState.parent)
{
processed[parent] = qtrue; processed[parent] = qtrue;
CG_AddCEntity(&cg_entities[parent]); CG_AddCEntity(&cg_entities[parent]);
} }
if (!processed[child]) { if (!processed[child])
{
// now add the children if not processed // now add the children if not processed
processed[child] = qtrue; processed[child] = qtrue;
CG_AddCEntity(cent); CG_AddCEntity(cent);
@ -652,24 +658,29 @@ void CG_AddPacketEntities(void)
// Add in the multibeams at the end // Add in the multibeams at the end
for ( num = 0 ; num < cg.snap->numEntities ; num++ ) { for ( num = 0 ; num < cg.snap->numEntities ; num++ ) {
cent = &cg_entities[ cg.snap->entities[ num ].number ]; cent = &cg_entities[ cg.snap->entities[ num ].number ];
if (cent->currentState.eType == ET_MULTIBEAM) { if ( cent->currentState.eType == ET_MULTIBEAM )
CG_MultiBeam( cent ); CG_MultiBeam( cent );
} }
}
} }
void CG_GetOrigin(centity_t* cent, vec3_t origin) void CG_GetOrigin(centity_t* cent, vec3_t origin)
{ {
if (cent->currentState.parent == ENTITYNUM_NONE) { if (cent->currentState.parent == ENTITYNUM_NONE)
{
VectorCopy(cent->lerpOrigin, origin); VectorCopy(cent->lerpOrigin, origin);
} else { }
else
{
int i; int i;
orientation_t or; orientation_t or;
refEntity_t* parent; refEntity_t* parent;
parent = cgi.R_GetRenderEntity(cent->currentState.parent); parent = cgi.R_GetRenderEntity(cent->currentState.parent);
if (!parent) { if (!parent)
{
cgi.DPrintf("CG_GetOrigin: Could not find parent entity\n");
return; return;
} }
@ -678,7 +689,8 @@ void CG_GetOrigin(centity_t *cent, vec3_t origin)
VectorCopy(parent->origin, origin); VectorCopy(parent->origin, origin);
for (i = 0; i < 3; i++) { for (i = 0; i < 3; i++)
{
VectorMA(origin, or .origin[i], parent->axis[i], origin); VectorMA(origin, or .origin[i], parent->axis[i], origin);
} }
} }

View file

@ -25,6 +25,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
#include "cg_local.h" #include "cg_local.h"
/* /*
============== ==============
CG_EntityEvent CG_EntityEvent
@ -33,4 +34,6 @@ An entity has an event value
============== ==============
*/ */
void CG_EntityEvent(centity_t *cent, vec3_t position) {} void CG_EntityEvent( centity_t *cent, vec3_t position )
{
}

View file

@ -36,7 +36,8 @@ LIGHT STYLE CODE
#define MAX_LIGHTSTYLE_LENGTH 128 #define MAX_LIGHTSTYLE_LENGTH 128
#define MAX_LIGHTSTYLE_NAME_LENGTH 64 #define MAX_LIGHTSTYLE_NAME_LENGTH 64
typedef struct { typedef struct
{
char name[ MAX_LIGHTSTYLE_NAME_LENGTH ]; char name[ MAX_LIGHTSTYLE_NAME_LENGTH ];
qboolean hasalpha; qboolean hasalpha;
int length; int length;
@ -59,44 +60,53 @@ qboolean CG_LightStyleColor(int style, int realtime, vec4_t color, qboolean clam
time = realtime / 50; time = realtime / 50;
frac = ( realtime - ( time * 50.0f ) ) / 50.0f; frac = ( realtime - ( time * 50.0f ) ) / 50.0f;
VectorClear4(color); memset( color, 0, sizeof( color ) );
if ((style < 0) || (style >= (MAX_LIGHTSTYLES * 2))) { if ( ( style < 0 ) || ( style >= ( MAX_LIGHTSTYLES * 2 ) ) )
{
cgi.DPrintf ("CG_LightStyleColor: style out of range.\n"); cgi.DPrintf ("CG_LightStyleColor: style out of range.\n");
return qtrue; return qtrue;
} }
ls = &cg_lightstyle[ style ]; ls = &cg_lightstyle[ style ];
if (!ls->length) { if ( !ls->length )
{
cgi.DPrintf ("CG_LightStyleColor: style %d has zero length.\n", style); cgi.DPrintf ("CG_LightStyleColor: style %d has zero length.\n", style);
return qtrue; return qtrue;
} }
// by default we are not at the end // by default we are not at the end
at_end = qfalse; at_end = qfalse;
if (clamp) { if ( clamp )
if (time >= ls->length) { {
if ( time >= ls->length )
{
time = ls->length - 1; time = ls->length - 1;
at_end = qtrue; at_end = qtrue;
} }
} else { }
else
{
time %= ls->length; time %= ls->length;
} }
// //
// only lerp if we are before the end // only lerp if we are before the end
// //
if (time == ls->length - 1) { if ( time == ls->length - 1 )
{
memcpy( color, ls->map[ time ], 4 * sizeof( ls->map[ time ][ 0 ] ) ); memcpy( color, ls->map[ time ], 4 * sizeof( ls->map[ time ][ 0 ] ) );
} else { }
for (i = 0; i < 4; i++) { else
{
for( i = 0; i < 4; i++ )
{
color[ i ] = ls->map[ time ][ i ] + frac * ( ls->map[ time + 1 ][ i ] - ls->map[ time ][ i ] ); color[ i ] = ls->map[ time ][ i ] + frac * ( ls->map[ time + 1 ][ i ] - ls->map[ time ][ i ] );
} }
} }
if (!ls->hasalpha) { if ( !ls->hasalpha )
color[ 3 ] = 1; color[ 3 ] = 1;
}
return at_end; return at_end;
} }
@ -125,7 +135,8 @@ static qboolean LoadTGA(const char *name, byte **pic, int *width, int *height, q
// load the file // load the file
// //
cgi.FS_ReadFile(name, (void **)&buffer, qtrue); cgi.FS_ReadFile(name, (void **)&buffer, qtrue);
if (!buffer) { if (!buffer)
{
cgi.DPrintf( "TGA File not found: %s\n", name ); cgi.DPrintf( "TGA File not found: %s\n", name );
return false; return false;
} }
@ -152,13 +163,17 @@ static qboolean LoadTGA(const char *name, byte **pic, int *width, int *height, q
targa_header.pixel_size = *buf_p++; targa_header.pixel_size = *buf_p++;
targa_header.attributes = *buf_p++; targa_header.attributes = *buf_p++;
if (targa_header.image_type != 1 && targa_header.image_type != 2 && targa_header.image_type != 10) { if (targa_header.image_type!=1
&& targa_header.image_type!=2
&& targa_header.image_type!=10)
{
cgi.DPrintf("LoadTGA: Only type 1, 2 and 10 targa RGB images supported\n"); cgi.DPrintf("LoadTGA: Only type 1, 2 and 10 targa RGB images supported\n");
return false; return false;
} }
if ( (targa_header.colormap_type !=0 && targa_header.colormap_type !=1) if ( (targa_header.colormap_type !=0 && targa_header.colormap_type !=1)
|| (targa_header.pixel_size != 32 && targa_header.pixel_size != 24 && targa_header.pixel_size != 8)) { || (targa_header.pixel_size!=32 && targa_header.pixel_size!=24 && targa_header.pixel_size!=8))
{
cgi.DPrintf("LoadTGA: Only 24, 32 and colormap images supported (no colormaps)\n"); cgi.DPrintf("LoadTGA: Only 24, 32 and colormap images supported (no colormaps)\n");
return false; return false;
} }
@ -167,44 +182,45 @@ static qboolean LoadTGA(const char *name, byte **pic, int *width, int *height, q
rows = targa_header.height; rows = targa_header.height;
numPixels = columns * rows; numPixels = columns * rows;
if (width) { if (width)
*width = columns; *width = columns;
} if (height)
if (height) {
*height = rows; *height = rows;
}
targa_rgba = ( byte * )cgi.Malloc( numPixels * 4 ); targa_rgba = ( byte * )cgi.Malloc( numPixels * 4 );
*pic = targa_rgba; *pic = targa_rgba;
if (targa_header.id_length != 0) { if (targa_header.id_length != 0)
buf_p += targa_header.id_length; // skip TARGA image comment buf_p += targa_header.id_length; // skip TARGA image comment
}
for (i = 0; i < targa_header.colormap_length; i++) { for (i=0;i<targa_header.colormap_length;i++)
{
byte blue = *buf_p++; byte blue = *buf_p++;
byte green = *buf_p++; byte green = *buf_p++;
byte red = *buf_p++; byte red = *buf_p++;
byte alpha = 0xff; byte alpha = 0xff;
if (targa_header.colormap_size == 4) { if (targa_header.colormap_size == 4)
alpha = *buf_p++; alpha = *buf_p++;
}
targa_palette[i*4+0] = red; targa_palette[i*4+0] = red;
targa_palette[i*4+1] = green; targa_palette[i*4+1] = green;
targa_palette[i*4+2] = blue; targa_palette[i*4+2] = blue;
targa_palette[i*4+3] = alpha; targa_palette[i*4+3] = alpha;
if (alpha != 0xff) { if (alpha != 0xff)
*hasalpha = true; *hasalpha = true;
} }
}
if (targa_header.image_type == 1) { if (targa_header.image_type==1)
for (row = rows - 1; row >= 0; row--) { {
for(row=rows-1; row>=0; row--)
{
pixbuf = targa_rgba + row*columns; pixbuf = targa_rgba + row*columns;
for (column = 0; column < columns; column++) { for(column=0; column<columns; column++)
switch (targa_header.pixel_size) { {
switch (targa_header.pixel_size)
{
case 8: case 8:
*pixbuf++ = targa_palette[ *buf_p * 4 + 0]; *pixbuf++ = targa_palette[ *buf_p * 4 + 0];
*pixbuf++ = targa_palette[ *buf_p * 4 + 1]; *pixbuf++ = targa_palette[ *buf_p * 4 + 1];
@ -215,7 +231,8 @@ static qboolean LoadTGA(const char *name, byte **pic, int *width, int *height, q
} }
} }
} }
} else if (targa_header.image_type == 2) { // Uncompressed, RGB images }
else if (targa_header.image_type==2) { // Uncompressed, RGB images
for(row=rows-1; row>=0; row--) { for(row=rows-1; row>=0; row--) {
pixbuf = targa_rgba + row*columns*4; pixbuf = targa_rgba + row*columns*4;
for(column=0; column<columns; column++) { for(column=0; column<columns; column++) {
@ -240,14 +257,14 @@ static qboolean LoadTGA(const char *name, byte **pic, int *width, int *height, q
*pixbuf++ = green; *pixbuf++ = green;
*pixbuf++ = blue; *pixbuf++ = blue;
*pixbuf++ = alphabyte; *pixbuf++ = alphabyte;
if (alphabyte != 0xff) { if (alphabyte != 0xff)
*hasalpha = true; *hasalpha = true;
}
break; break;
} }
} }
} }
} else if (targa_header.image_type == 10) { // Runlength encoded RGB images }
else if (targa_header.image_type==10) { // Runlength encoded RGB images
unsigned char red,green,blue,alphabyte,packetHeader,packetSize,j; unsigned char red,green,blue,alphabyte,packetHeader,packetSize,j;
for(row=rows-1; row>=0; row--) { for(row=rows-1; row>=0; row--) {
pixbuf = targa_rgba + row*columns*4; pixbuf = targa_rgba + row*columns*4;
@ -261,9 +278,8 @@ static qboolean LoadTGA(const char *name, byte **pic, int *width, int *height, q
green = *buf_p++; green = *buf_p++;
red = *buf_p++; red = *buf_p++;
alphabyte = *buf_p++; alphabyte = *buf_p++;
if (alphabyte != 0xff) { if (alphabyte != 0xff)
*hasalpha = true; *hasalpha = true;
}
break; break;
case 24: case 24:
default: default:
@ -282,15 +298,15 @@ static qboolean LoadTGA(const char *name, byte **pic, int *width, int *height, q
column++; column++;
if (column==columns) { // run spans across rows if (column==columns) { // run spans across rows
column=0; column=0;
if (row > 0) { if (row>0)
row--; row--;
} else { else
goto breakOut; goto breakOut;
}
pixbuf = targa_rgba + row*columns*4; pixbuf = targa_rgba + row*columns*4;
} }
} }
} else { // non run-length packet }
else { // non run-length packet
for(j=0;j<packetSize;j++) { for(j=0;j<packetSize;j++) {
switch (targa_header.pixel_size) { switch (targa_header.pixel_size) {
default: default:
@ -312,19 +328,17 @@ static qboolean LoadTGA(const char *name, byte **pic, int *width, int *height, q
*pixbuf++ = green; *pixbuf++ = green;
*pixbuf++ = blue; *pixbuf++ = blue;
*pixbuf++ = alphabyte; *pixbuf++ = alphabyte;
if (alphabyte != 0xff) { if (alphabyte != 0xff)
*hasalpha = true; *hasalpha = true;
}
break; break;
} }
column++; column++;
if (column==columns) { // pixel packet run spans across rows if (column==columns) { // pixel packet run spans across rows
column=0; column=0;
if (row > 0) { if (row>0)
row--; row--;
} else { else
goto breakOut; goto breakOut;
}
pixbuf = targa_rgba + row*columns*4; pixbuf = targa_rgba + row*columns*4;
} }
} }
@ -343,11 +357,13 @@ void createLightstyleFromTGA(int num, const char *filename)
int i, j, width, height; int i, j, width, height;
qboolean hasalpha; qboolean hasalpha;
if (!LoadTGA(filename, &data, &width, &height, &hasalpha)) { if (!LoadTGA(filename, &data, &width, &height, &hasalpha))
{
return; return;
} }
if (width > MAX_LIGHTSTYLE_LENGTH) { if ( width > MAX_LIGHTSTYLE_LENGTH )
{
cgi.DPrintf("createLightstyleFromTGA: Light style too large, truncating.\n",filename); cgi.DPrintf("createLightstyleFromTGA: Light style too large, truncating.\n",filename);
width = MAX_LIGHTSTYLE_LENGTH; width = MAX_LIGHTSTYLE_LENGTH;
} }
@ -356,16 +372,17 @@ void createLightstyleFromTGA(int num, const char *filename)
cg_lightstyle[ num ].hasalpha = hasalpha; cg_lightstyle[ num ].hasalpha = hasalpha;
cg_lightstyle[ num ].length = width; cg_lightstyle[ num ].length = width;
for (i = 0; i < width; i++) { for( i = 0; i < width; i++ )
for (j = 0; j < 4; j++) { {
for ( j = 0; j < 4; j++ )
{
cg_lightstyle[ num ].map[ i ][ j ] = ( float )data[ ( i * 4 ) + j ] / 255.0f; cg_lightstyle[ num ].map[ i ][ j ] = ( float )data[ ( i * 4 ) + j ] / 255.0f;
} }
} }
if (data) { if ( data )
cgi.Free( data ); cgi.Free( data );
} }
}
void CG_SetLightStyle( int num, const char *s ) void CG_SetLightStyle( int num, const char *s )
{ {
@ -374,21 +391,22 @@ void CG_SetLightStyle(int num, const char *s)
size_t len; size_t len;
float t; float t;
if ((num < 0) || (num >= (MAX_LIGHTSTYLES * 2))) { if ( ( num < 0 ) || ( num >= ( MAX_LIGHTSTYLES * 2 ) ) )
{
cgi.DPrintf ("CG_SetLightStyle: num out of range.\n"); cgi.DPrintf ("CG_SetLightStyle: num out of range.\n");
return; return;
} }
len = strlen( s ); len = strlen( s );
if (!Q_stricmp(&s[len - 4], ".tga")) { if ( !Q_stricmp( &s[ len - 4 ], ".tga" ) )
{
createLightstyleFromTGA( num, s ); createLightstyleFromTGA( num, s );
return; return;
} }
if (!s) { if ( !s )
return; return;
}
r = strchr( s, 'R' ); r = strchr( s, 'R' );
g = strchr( s, 'G' ); g = strchr( s, 'G' );
@ -396,39 +414,37 @@ void CG_SetLightStyle(int num, const char *s)
a = strchr( s, 'A' ); a = strchr( s, 'A' );
n = 0; n = 0;
if (r) { if (r)
n++; n++;
} if (g)
if (g) {
n++; n++;
} if (b)
if (b) {
n++; n++;
} if (a)
if (a) {
n++; n++;
} if (!n)
if (!n) {
n++; n++;
}
if (!a) { if (!a)
cg_lightstyle[ num ].hasalpha = false; cg_lightstyle[ num ].hasalpha = false;
} else { else
cg_lightstyle[ num ].hasalpha = true; cg_lightstyle[ num ].hasalpha = true;
}
j = strlen (s) / n; j = strlen (s) / n;
if (j >= MAX_LIGHTSTYLE_LENGTH) { if (j >= MAX_LIGHTSTYLE_LENGTH)
{
cgi.DPrintf ( "svc_lightstyle length=%i", j); cgi.DPrintf ( "svc_lightstyle length=%i", j);
j = MAX_LIGHTSTYLE_LENGTH - 1; j = MAX_LIGHTSTYLE_LENGTH - 1;
} }
if (!r && !g && !b && !a) { if ( !r && !g && !b && !a )
{
cg_lightstyle[ num ].length = j; cg_lightstyle[ num ].length = j;
for (k = 0; k < j; k++) { for( k = 0; k < j; k++ )
{
t = ( float )( s[ k ] - 'a' ) * 127.5f / 12.5; t = ( float )( s[ k ] - 'a' ) * 127.5f / 12.5;
if (t > 255) { if ( t > 255 )
{
t = 255.0f; t = 255.0f;
} }
cg_lightstyle[ num ].map[ k ][ 0 ] = t / 255.0f; cg_lightstyle[ num ].map[ k ][ 0 ] = t / 255.0f;
@ -436,16 +452,21 @@ void CG_SetLightStyle(int num, const char *s)
cg_lightstyle[ num ].map[ k ][ 2 ] = t / 255.0f; cg_lightstyle[ num ].map[ k ][ 2 ] = t / 255.0f;
cg_lightstyle[ num ].map[ k ][ 3 ] = 1; cg_lightstyle[ num ].map[ k ][ 3 ] = 1;
} }
} else { }
else
{
n = 0; n = 0;
// red // red
k = 0; k = 0;
t = 0; t = 0;
if (r) { if ( r )
{
r++; r++;
while ((r[k] >= 'a') && (r[k] <= 'z')) { while( ( r[ k ] >= 'a' ) && ( r[ k ] <= 'z' ) )
{
t = ( float )( r[ k ] - 'a' ) * 127.5f / 12.5; t = ( float )( r[ k ] - 'a' ) * 127.5f / 12.5;
if (t > 255) { if ( t > 255 )
{
t = 255.0f; t = 255.0f;
} }
cg_lightstyle[ num ].map[ k ][ 0 ] = t / 255.0f; cg_lightstyle[ num ].map[ k ][ 0 ] = t / 255.0f;
@ -453,18 +474,22 @@ void CG_SetLightStyle(int num, const char *s)
} }
n = k; n = k;
} }
while (k < MAX_LIGHTSTYLE_LENGTH) { while( k < MAX_LIGHTSTYLE_LENGTH )
{
cg_lightstyle[ num ].map[ k++ ][ 0 ] = t / 255.0f; cg_lightstyle[ num ].map[ k++ ][ 0 ] = t / 255.0f;
} }
// green // green
k = 0; k = 0;
t = 0; t = 0;
if (g) { if ( g )
{
g++; g++;
while ((g[k] >= 'a') && (g[k] <= 'z')) { while( ( g[ k ] >= 'a' ) && ( g[ k ] <= 'z' ) )
{
t = ( float )( g[ k ] - 'a' ) * 127.5f / 12.5; t = ( float )( g[ k ] - 'a' ) * 127.5f / 12.5;
if (t > 255) { if ( t > 255 )
{
t = 255.0f; t = 255.0f;
} }
cg_lightstyle[ num ].map[ k ][ 1 ] = t / 255.0f; cg_lightstyle[ num ].map[ k ][ 1 ] = t / 255.0f;
@ -472,18 +497,22 @@ void CG_SetLightStyle(int num, const char *s)
} }
n = Q_max( n, k ); n = Q_max( n, k );
} }
while (k < MAX_LIGHTSTYLE_LENGTH) { while( k < MAX_LIGHTSTYLE_LENGTH )
{
cg_lightstyle[ num ].map[ k++ ][ 1 ] = t / 255.0f; cg_lightstyle[ num ].map[ k++ ][ 1 ] = t / 255.0f;
} }
// blue // blue
k = 0; k = 0;
t = 0; t = 0;
if (b) { if ( b )
{
b++; b++;
while ((b[k] >= 'a') && (b[k] <= 'z')) { while( ( b[ k ] >= 'a' ) && ( b[ k ] <= 'z' ) )
{
t = ( float )( b[ k ] - 'a' ) * 127.5f / 12.5; t = ( float )( b[ k ] - 'a' ) * 127.5f / 12.5;
if (t > 255) { if ( t > 255 )
{
t = 255.0f; t = 255.0f;
} }
cg_lightstyle[ num ].map[ k ][ 2 ] = t / 255.0f; cg_lightstyle[ num ].map[ k ][ 2 ] = t / 255.0f;
@ -491,18 +520,22 @@ void CG_SetLightStyle(int num, const char *s)
} }
n = Q_max( n, k ); n = Q_max( n, k );
} }
while (k < MAX_LIGHTSTYLE_LENGTH) { while( k < MAX_LIGHTSTYLE_LENGTH )
{
cg_lightstyle[ num ].map[ k++ ][ 2 ] = t / 255.0f; cg_lightstyle[ num ].map[ k++ ][ 2 ] = t / 255.0f;
} }
// alpha // alpha
k = 0; k = 0;
t = 255; t = 255;
if (a) { if ( a )
{
a++; a++;
while ((a[k] >= 'a') && (a[k] <= 'z')) { while( ( a[ k ] >= 'a' ) && ( a[ k ] <= 'z' ) )
{
t = ( float )( a[ k ] - 'a' ) * 127.5f / 25; t = ( float )( a[ k ] - 'a' ) * 127.5f / 25;
if (t > 255) { if ( t > 255 )
{
t = 255.0f; t = 255.0f;
} }
cg_lightstyle[ num ].map[ k ][ 3 ] = t / 255.0f; cg_lightstyle[ num ].map[ k ][ 3 ] = t / 255.0f;
@ -510,7 +543,8 @@ void CG_SetLightStyle(int num, const char *s)
} }
n = Q_max( n, k ); n = Q_max( n, k );
} }
while (k < MAX_LIGHTSTYLE_LENGTH) { while( k < MAX_LIGHTSTYLE_LENGTH )
{
cg_lightstyle[ num ].map[ k++ ][ 3 ] = t / 255.0f; cg_lightstyle[ num ].map[ k++ ][ 3 ] = t / 255.0f;
} }
@ -527,8 +561,10 @@ int CG_GetLightStyle(const char *name)
{ {
int i; int i;
for (i = MAX_LIGHTSTYLES; i < MAX_LIGHTSTYLES * 2; i++) { for( i = MAX_LIGHTSTYLES; i < MAX_LIGHTSTYLES * 2; i++ )
if (!Q_stricmp(cg_lightstyle[i].name, name)) { {
if ( !Q_stricmp( cg_lightstyle[ i ].name, name ) )
{
return i; return i;
} }
} }
@ -544,8 +580,10 @@ int CG_GetFreeLightStyle(void)
{ {
int i; int i;
for (i = MAX_LIGHTSTYLES; i < MAX_LIGHTSTYLES * 2; i++) { for( i = MAX_LIGHTSTYLES; i < MAX_LIGHTSTYLES * 2; i++ )
if (!cg_lightstyle[i].name[0]) { {
if ( !cg_lightstyle[ i ].name[ 0 ] )
{
return i; return i;
} }
} }
@ -572,14 +610,19 @@ int CG_RegisterLightStyle(const char *name)
int num; int num;
num = CG_GetLightStyle( name ); num = CG_GetLightStyle( name );
if (num == -1) { if ( num == -1 )
{
num = CG_GetFreeLightStyle(); num = CG_GetFreeLightStyle();
if (num != -1) { if ( num != -1 )
{
CG_SetLightStyle( num, name ); CG_SetLightStyle( num, name );
} else { }
else
{
cgi.DPrintf ("CG_RegisterLightStyle: no free spots for lightstyle %s.\n"); cgi.DPrintf ("CG_RegisterLightStyle: no free spots for lightstyle %s.\n");
} }
} }
return num; return num;
} }

View file

@ -35,12 +35,12 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
#include "cg_public.h" #include "cg_public.h"
#ifdef __cplusplus #ifdef __cplusplus
class MemArchiver; extern "C"
{
extern "C" {
#endif #endif
typedef struct { typedef struct
{
int anim; int anim;
int frame; int frame;
int oldanim; int oldanim;
@ -49,7 +49,8 @@ extern "C" {
float framelerp; float framelerp;
} lerpstate_t; } lerpstate_t;
typedef struct { typedef struct
{
lerpstate_t base; lerpstate_t base;
// crossblend variables // crossblend variables
@ -134,38 +135,29 @@ extern "C" {
int iNextLandTime; int iNextLandTime;
} centity_t; } centity_t;
//====================================================================== //======================================================================
// local entities are created as a result of events or predicted actions, // local entities are created as a result of events or predicted actions,
// and live independantly from all server transmitted entities // and live independantly from all server transmitted entities
#define MAX_VERTS_ON_POLY 8 #define MAX_VERTS_ON_POLY 10
#define MAX_MARK_POLYS 64 #define MAX_MARK_POLYS 64
#define MAX_TREAD_MARKS 16
typedef struct markPoly_s { typedef struct markPoly_s
struct markPoly_s* nextPoly; {
int numVerts; struct markPoly_s *prevMark, *nextMark;
int time;
int lightstyle;
qhandle_t markShader;
qboolean alphaFade; // fade alpha instead of rgb
qboolean fadein;
float color[4];
poly_t poly;
polyVert_t verts[MAX_VERTS_ON_POLY]; polyVert_t verts[MAX_VERTS_ON_POLY];
int iIndex;
} markPoly_t; } markPoly_t;
typedef struct markObj_s {
struct markObj_s* prevMark;
struct markObj_s* nextMark;
int time;
int lastVisTime;
int leafnum;
vec3_t pos;
float radius;
int markShader;
int alphaFade;
int fadein;
markPoly_t* markPolys;
} markObj_t;
#define MAX_CUSTOM_SOUNDS 32 #define MAX_CUSTOM_SOUNDS 32
typedef struct { typedef struct {
int team; int team;
char name[64]; char name[64];
@ -187,7 +179,6 @@ extern "C" {
float min_dist; float min_dist;
float width; float width;
char shader[MAX_RAIN_SHADERS][MAX_STRING_CHARS]; char shader[MAX_RAIN_SHADERS][MAX_STRING_CHARS];
char currentShader[MAX_STRING_CHARS];
int numshaders; int numshaders;
} crain_t; } crain_t;
@ -210,8 +201,7 @@ extern "C" {
snapshot_t* nextSnap; // cg.nextSnap->serverTime > cg.time, or NULL snapshot_t* nextSnap; // cg.nextSnap->serverTime > cg.time, or NULL
snapshot_t activeSnapshots[2]; snapshot_t activeSnapshots[2];
float float frameInterpolation; // (float)( cg.time - cg.frame->serverTime ) / (cg.nextFrame->serverTime - cg.frame->serverTime)
frameInterpolation; // (float)( cg.time - cg.frame->serverTime ) / (cg.nextFrame->serverTime - cg.frame->serverTime)
qboolean thisFrameTeleport; qboolean thisFrameTeleport;
qboolean nextFrameTeleport; qboolean nextFrameTeleport;
@ -251,11 +241,6 @@ extern "C" {
vec3_t refdefViewAngles; // will be converted to refdef.viewaxis vec3_t refdefViewAngles; // will be converted to refdef.viewaxis
vec3_t currentViewPos; // current position of the camera vec3_t currentViewPos; // current position of the camera
vec3_t currentViewAngles; // current angles of the camera vec3_t currentViewAngles; // current angles of the camera
float fRefFovXSin;
float fRefFovXCos;
float fRefFovYSin;
float fRefFovYCos;
float fCurrentViewHeight; float fCurrentViewHeight;
float fCurrentViewBobPhase; float fCurrentViewBobPhase;
float fCurrentViewBobAmp; float fCurrentViewBobAmp;
@ -270,8 +255,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;
@ -343,13 +326,10 @@ extern "C" {
float ObjectivesBaseAlpha; float ObjectivesBaseAlpha;
float ObjectivesDesiredAlpha; float ObjectivesDesiredAlpha;
float ObjectivesCurrentAlpha; float ObjectivesCurrentAlpha;
int ObjectivesCurrentIndex;
// misc // misc
crain_t rain; crain_t rain;
clientInfo_t clientinfo[MAX_CLIENTS]; clientInfo_t clientinfo[MAX_CLIENTS];
radarClient_t radars[MAX_CLIENTS];
qhandle_t radarShaders[2];
} cg_t; } cg_t;
typedef struct { typedef struct {
@ -382,7 +362,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
@ -401,19 +380,8 @@ extern "C" {
int maxclients; int maxclients;
int cinematic; int cinematic;
int mapChecksum; int mapChecksum;
qboolean useMapChecksum;
char mapname[MAX_QPATH]; char mapname[MAX_QPATH];
//
// vote
//
int voteTime;
int numVotesYes;
int numVotesNo;
int numUndecidedVotes;
qboolean voteRefreshed;
char voteString[1024];
// //
// locally derived information from gamestate // locally derived information from gamestate
// //
@ -434,10 +402,8 @@ extern "C" {
extern cgs_t cgs; extern cgs_t cgs;
extern cg_t cg; extern cg_t cg;
extern clientGameImport_t cgi; extern clientGameImport_t cgi;
extern target_game_e cg_target_game;
extern int cg_protocol;
extern centity_t cg_entities[MAX_GENTITIES]; extern centity_t cg_entities[MAX_GENTITIES];
extern markPoly_t *cg_markPolys; extern markPoly_t cg_markPolys[MAX_MARK_POLYS];
extern cvar_t* cg_animSpeed; extern cvar_t* cg_animSpeed;
extern cvar_t* cg_debugAnim; extern cvar_t* cg_debugAnim;
@ -477,9 +443,6 @@ extern "C" {
extern cvar_t* cg_hud; extern cvar_t* cg_hud;
extern cvar_t* cg_huddraw_force; extern cvar_t* cg_huddraw_force;
extern cvar_t* cg_drawsvlag; extern cvar_t* cg_drawsvlag;
extern cvar_t *cg_crosshair;
extern cvar_t *cg_crosshair_friend;
extern cvar_t *ui_crosshair;
extern cvar_t* vm_offset_max; extern cvar_t* vm_offset_max;
extern cvar_t* vm_offset_speed; extern cvar_t* vm_offset_speed;
extern cvar_t* vm_sway_front; extern cvar_t* vm_sway_front;
@ -506,19 +469,11 @@ extern "C" {
extern cvar_t* voiceChat; extern cvar_t* voiceChat;
extern cvar_t* cg_shadowscount; extern cvar_t* cg_shadowscount;
extern cvar_t* cg_shadowdebug; extern cvar_t* cg_shadowdebug;
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 );
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 );
void CG_NewClientinfo( int clientNum ); void CG_NewClientinfo( int clientNum );
@ -533,13 +488,8 @@ 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
);
// //
// cg_commands.cpp // cg_commands.cpp
@ -554,7 +504,6 @@ extern "C" {
void CG_EndTiki(dtiki_t* tiki); void CG_EndTiki(dtiki_t* tiki);
qboolean CG_Command_ProcessFile( const char * filename, qboolean quiet, dtiki_t *curTiki ); qboolean CG_Command_ProcessFile( const char * filename, qboolean quiet, dtiki_t *curTiki );
void CG_RestartCommandManager(); void CG_RestartCommandManager();
void CG_CleanUpTempModels();
qboolean CG_ProcessEntityCommands(int frame, int anim, int entnum, refEntity_t* ent, centity_t* cent); qboolean CG_ProcessEntityCommands(int frame, int anim, int entnum, refEntity_t* ent, centity_t* cent);
void CG_ClientCommands(refEntity_t* ent, centity_t* cent, int slot); void CG_ClientCommands(refEntity_t* ent, centity_t* cent, int slot);
float RandomizeRange(float start, float end); float RandomizeRange(float start, float end);
@ -563,8 +512,6 @@ extern "C" {
// cg_tempmodels.cpp // cg_tempmodels.cpp
// //
extern cvar_t *cg_showtempmodels; extern cvar_t *cg_showtempmodels;
extern cvar_t *cg_max_tempmodels;
extern cvar_t *cg_reserve_tempmodels;
extern cvar_t *cg_detail; extern cvar_t *cg_detail;
extern cvar_t *cg_effectdetail; extern cvar_t *cg_effectdetail;
extern cvar_t *cg_effect_physicsrate; extern cvar_t *cg_effect_physicsrate;
@ -587,6 +534,7 @@ extern "C" {
void L_InitEvents( void ); void L_InitEvents( void );
void L_ShutdownEvents( void ); void L_ShutdownEvents( void );
// //
// cg_view.c // cg_view.c
// //
@ -605,7 +553,6 @@ extern "C" {
void CG_EyeAngles(vec3_t* o_vAngles); void CG_EyeAngles(vec3_t* o_vAngles);
float CG_SensitivityScale(); float CG_SensitivityScale();
void CG_AddLightShow(); void CG_AddLightShow();
qboolean CG_FrustumCullSphere(const vec3_t vPos, float fRadius);
void CG_OffsetFirstPersonView(refEntity_t* pREnt, qboolean bUseWorldPosition); void CG_OffsetFirstPersonView(refEntity_t* pREnt, qboolean bUseWorldPosition);
void CG_DrawActiveFrame( int serverTime, int frameTime, stereoFrame_t stereoView, qboolean demoPlayback ); void CG_DrawActiveFrame( int serverTime, int frameTime, stereoFrame_t stereoView, qboolean demoPlayback );
@ -647,32 +594,17 @@ extern "C" {
// cg_predict.c // cg_predict.c
// //
void CG_BuildSolidList( void ); void CG_BuildSolidList( void );
int CG_GetBrushEntitiesInBounds(int iMaxEnts, centity_t** pEntList, const vec3_t vMins, const vec3_t vMaxs);
int CG_PointContents( const vec3_t point, int passEntityNum ); int CG_PointContents( const vec3_t point, int passEntityNum );
void CG_ClipMoveToEntities( void CG_ClipMoveToEntities(const vec3_t start, const vec3_t mins,
const vec3_t start, const vec3_t maxs, const vec3_t end,
const vec3_t mins, int skipNumber, int mask, trace_t* tr,
const vec3_t maxs, qboolean cylinder);
const vec3_t end, void CG_Trace( trace_t *result, const vec3_t start, const vec3_t mins,
int skipNumber, const vec3_t maxs, const vec3_t end, int skipNumber,
int mask, int mask, qboolean cylinder, qboolean cliptoentities, const char * description );
trace_t *tr,
qboolean cylinder
);
void CG_Trace(
trace_t *result,
const vec3_t start,
const vec3_t mins,
const vec3_t maxs,
const vec3_t end,
int skipNumber,
int mask,
qboolean cylinder,
qboolean cliptoentities,
const char *description
);
void CG_PredictPlayerState( void ); void CG_PredictPlayerState( void );
// //
// cg_ents.c // cg_ents.c
// //
@ -682,9 +614,10 @@ extern "C" {
void CG_Beam( centity_t *cent ); void CG_Beam( centity_t *cent );
void CG_AdjustPositionForMover( const vec3_t in, int moverNum, int fromTime, int toTime, vec3_t out ); void CG_AdjustPositionForMover( const vec3_t in, int moverNum, int fromTime, int toTime, vec3_t out );
void CG_PositionEntityOnTag(refEntity_t *entity, const refEntity_t *parent, qhandle_t parentModel, char *tagName); void CG_PositionEntityOnTag( refEntity_t *entity, const refEntity_t *parent,
void qhandle_t parentModel, char *tagName );
CG_PositionRotatedEntityOnTag(refEntity_t *entity, const refEntity_t *parent, qhandle_t parentModel, char *tagName); void CG_PositionRotatedEntityOnTag( refEntity_t *entity, const refEntity_t *parent,
qhandle_t parentModel, char *tagName );
void CG_GetOrigin( centity_t *cent, vec3_t origin ); void CG_GetOrigin( centity_t *cent, vec3_t origin );
void CG_EntityEffects( centity_t *cent ); void CG_EntityEffects( centity_t *cent );
@ -693,28 +626,18 @@ extern "C" {
// //
void CG_InitMarks( void ); void CG_InitMarks( void );
void CG_AddMarks( void ); void CG_AddMarks( void );
void CG_ImpactMark( void CG_ImpactMark( qhandle_t markShader,
qhandle_t markShader, const vec3_t origin, const vec3_t dir,
const vec3_t origin,
const vec3_t dir,
float orientation, float orientation,
float fSScale, float r, float g, float b, float a,
float fTScale,
float red,
float green,
float blue,
float alpha,
qboolean alphaFade, qboolean alphaFade,
qboolean temporary, float radius, qboolean temporary,
qboolean dolighting, int lightstyle, qboolean fadein,
qboolean fadein, float fSCenter, float fTCenter );
float fSCenter,
float fTCenter
);
void CG_ImpactMarkSimple( void CG_ImpactMarkSimple(
qhandle_t markShader, qhandle_t markShader,
const vec3_t origin, vec_t* origin,
const vec3_t dir, vec_t* dir,
float orientation, float orientation,
float fRadius, float fRadius,
float red, float red,
@ -726,25 +649,10 @@ extern "C" {
qboolean dolighting, qboolean dolighting,
qboolean fadein qboolean fadein
); );
void CG_AssembleFinalMarks(
vec3_t *markPoints,
markFragment_t *markFragments,
int numFragments,
qboolean (*PerPolyCallback)(const vec3_t* markPoints, markFragment_t* mf, polyVert_t* verts, void* pCustom),
int (*GetLeafCallback)(markFragment_t* mf, void* pCustom),
void *pCustom,
vec3_t pos,
float radius,
qhandle_t markShader,
qboolean fadein,
qboolean alphaFade
);
qboolean CG_CheckMakeMarkOnEntity(int iEntIndex);
void CG_InitTestTreadMark(); void CG_InitTestTreadMark();
void CG_AddTreadMarks();
int CG_PermanentMark( int CG_PermanentMark(
vec3_t origin, const vec3_t origin,
vec3_t dir, const vec3_t dir,
float orientation, float orientation,
float fSScale, float fSScale,
float fTScale, float fTScale,
@ -768,7 +676,12 @@ extern "C" {
); );
int CG_PermanentUpdateTreadMark( int CG_PermanentUpdateTreadMark(
treadMark_t *pTread, float fAlpha, float fMinSegment, float fMaxSegment, float fMaxOffset, float fTexScale treadMark_t* pTread,
float fAlpha,
float fMinSegment,
float fMaxSegment,
float fMaxOffset,
float fTexScale
); );
// //
@ -823,15 +736,30 @@ extern "C" {
// //
void CG_AddBeams( void ); void CG_AddBeams( void );
void CG_MultiBeamBegin( void ); void CG_MultiBeamBegin( void );
void CG_MultiBeamAddPoints( void CG_MultiBeamAddPoints
vec3_t start, vec3_t end, int numsegments, int flags, float minoffset, float maxoffset, qboolean addstartpoint (
vec3_t start,
vec3_t end,
int numsegments,
int flags,
float minoffset,
float maxoffset,
qboolean addstartpoint
); );
void CG_MultiBeamEnd( void CG_MultiBeamEnd
float scale, int renderfx, const char *beamshadername, byte modulate[4], int flags, int owner, float life (
float scale,
int renderfx,
const char *beamshadername,
byte modulate[4],
int flags,
int owner,
float life
); );
void CG_CreateBeam( void CG_CreateBeam
const vec3_t start, (
const vec3_t dir, vec3_t start,
vec3_t dir,
int owner, int owner,
qhandle_t hModel, qhandle_t hModel,
float alpha, float alpha,
@ -840,7 +768,7 @@ extern "C" {
float length, float length,
int life, int life,
qboolean create, qboolean create,
const vec3_t endpointvec, vec3_t endpointvec,
int min_offset, int min_offset,
int max_offset, int max_offset,
int overlap, int overlap,
@ -860,6 +788,7 @@ extern "C" {
void CG_Rope( centity_t *cent ); void CG_Rope( centity_t *cent );
void CG_RestartBeams( int timedelta ); void CG_RestartBeams( int timedelta );
// //
// cg_nature.cpp // cg_nature.cpp
// //
@ -903,10 +832,9 @@ qboolean CG_LightStyleColor(int style, int realtime, vec4_t color, qboolean clam
void CG_GetScoreBoardFontColor(float* fR, float* fG, float* fB, float* fA); void CG_GetScoreBoardFontColor(float* fR, float* fG, float* fB, float* fA);
void CG_GetScoreBoardPosition(float* fX, float* fY, float* fW, float* fH); void CG_GetScoreBoardPosition(float* fX, float* fY, float* fW, float* fH);
int CG_GetScoreBoardDrawHeader(); int CG_GetScoreBoardDrawHeader();
//const char* CG_GetColumnName(int iColumnNum, int* iColumnWidth); const char* CG_GetColumnName(int iColumnNum, int* iColumnWidth);
void CG_PrepScoreBoardInfo(); void CG_PrepScoreBoardInfo();
void CG_ParseScores(); void CG_ParseScores();
void CG_InitScoresAPI(clientGameExport_t *cge);
// //
// cg_specialfx.cpp // cg_specialfx.cpp
@ -937,8 +865,7 @@ qboolean CG_LightStyleColor(int style, int realtime, vec4_t color, qboolean clam
void CG_InstaMessageGroupD_f(void); void CG_InstaMessageGroupD_f(void);
void CG_InstaMessageGroupE_f(void); void CG_InstaMessageGroupE_f(void);
void CG_HudPrint_f(void); void CG_HudPrint_f(void);
int CG_CheckCaptureKey(int key, qboolean down, unsigned int time);
qboolean CG_CheckCaptureKey(int key, qboolean down, unsigned int time);
// //
// cg_vehicle.cpp // cg_vehicle.cpp
@ -947,9 +874,6 @@ qboolean CG_LightStyleColor(int style, int realtime, vec4_t color, qboolean clam
// //
// cg_volumetricsmoke.cpp // cg_volumetricsmoke.cpp
void CG_ResetVSSSources(void); void CG_ResetVSSSources(void);
#ifdef __cplusplus
void CG_ArchiveVSSGlobals(MemArchiver& archiver);
#endif
void CG_AddVSSSources(void); void CG_AddVSSSources(void);
extern cvar_t* vss_draw; extern cvar_t* vss_draw;
@ -970,6 +894,7 @@ qboolean CG_LightStyleColor(int style, int realtime, vec4_t color, qboolean clam
extern cvar_t* vss_default_b; extern cvar_t* vss_default_b;
extern cvar_t* vss_lighting_fps; extern cvar_t* vss_lighting_fps;
#ifdef __cplusplus #ifdef __cplusplus
} }
#endif #endif

View file

@ -25,22 +25,17 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
#include "cg_local.h" #include "cg_local.h"
#include "cg_parsemsg.h" #include "cg_parsemsg.h"
#include "cg_archive.h"
#include "cg_radar.h"
#ifdef _WIN32 #ifdef _WIN32
#include <windows.h> #include <windows.h>
#endif #endif
clientGameImport_t cgi; clientGameImport_t cgi;
static clientGameExport_t cge;
cvar_t* paused; cvar_t* paused;
cvar_t* developer; cvar_t* developer;
cg_t cg; cg_t cg;
cgs_t cgs; cgs_t cgs;
target_game_e cg_target_game = TG_INVALID;
int cg_protocol;
centity_t cg_entities[MAX_GENTITIES]; centity_t cg_entities[MAX_GENTITIES];
cvar_t* cg_animSpeed; cvar_t* cg_animSpeed;
@ -81,9 +76,6 @@ cvar_t *cg_acidtrip;
cvar_t* cg_hud; cvar_t* cg_hud;
cvar_t* cg_huddraw_force; cvar_t* cg_huddraw_force;
cvar_t* cg_drawsvlag; cvar_t* cg_drawsvlag;
cvar_t *cg_crosshair;
cvar_t *cg_crosshair_friend;
cvar_t *ui_crosshair;
cvar_t* vm_offset_max; cvar_t* vm_offset_max;
cvar_t* vm_offset_speed; cvar_t* vm_offset_speed;
cvar_t* vm_sway_front; cvar_t* vm_sway_front;
@ -110,13 +102,6 @@ cvar_t *vm_lean_lower;
cvar_t* voiceChat; cvar_t* voiceChat;
cvar_t* cg_shadowscount; cvar_t* cg_shadowscount;
cvar_t* cg_shadowdebug; cvar_t* cg_shadowdebug;
cvar_t *ui_timemessage;
//
// Added in OPM
//
cvar_t *cg_fov;
cvar_t *cg_cheats;
/* /*
================= =================
@ -162,23 +147,14 @@ void CG_RegisterCvars(void)
cg_shadowdebug = cgi.Cvar_Get("cg_shadowdebug", "0", 0); cg_shadowdebug = cgi.Cvar_Get("cg_shadowdebug", "0", 0);
developer = cgi.Cvar_Get("developer", "0", 0); developer = cgi.Cvar_Get("developer", "0", 0);
dm_playermodel = cgi.Cvar_Get("dm_playermodel", "american_army", 3); dm_playermodel = cgi.Cvar_Get("dm_playermodel", "american_army", 3);
dm_playergermanmodel = cgi.Cvar_Get("dm_playergermanmodel", "german_wehrmacht_soldier", CVAR_ARCHIVE | CVAR_USERINFO); dm_playergermanmodel = cgi.Cvar_Get("dm_playergermanmodel", "german_wehrmacht_soldier", 3);
cg_forceModel = cgi.Cvar_Get("cg_forceModel", "0", CVAR_ARCHIVE); cg_forceModel = cgi.Cvar_Get("cg_forceModel", "0", CVAR_ARCHIVE);
cg_animationviewmodel = cgi.Cvar_Get("cg_animationviewmodel", "0", CVAR_SYSTEMINFO); cg_animationviewmodel = cgi.Cvar_Get("cg_animationviewmodel", "0", 8);
cg_hitmessages = cgi.Cvar_Get("cg_hitmessages", "1", CVAR_ARCHIVE); cg_hitmessages = cgi.Cvar_Get("cg_hitmessages", "1", CVAR_ARCHIVE);
cg_acidtrip = cgi.Cvar_Get("cg_acidtrip", "0", CVAR_CHEAT); cg_acidtrip = cgi.Cvar_Get("cg_acidtrip", "0", CVAR_CHEAT);
cg_hud = cgi.Cvar_Get("cg_hud", "0", 0); cg_hud = cgi.Cvar_Get("cg_hud", "0", 0);
cg_huddraw_force = cgi.Cvar_Get("cg_huddraw_force", "0", CVAR_SAVEGAME); cg_huddraw_force = cgi.Cvar_Get("cg_huddraw_force", "0", CVAR_SAVEGAME);
cg_drawsvlag = cgi.Cvar_Get("cg_drawsvlag", "1", CVAR_ARCHIVE); cg_drawsvlag = cgi.Cvar_Get("cg_drawsvlag", "1", CVAR_ARCHIVE);
cg_crosshair = cgi.Cvar_Get("cg_crosshair", "textures/hud/crosshair", CVAR_ARCHIVE);
if (cg_protocol >= PROTOCOL_MOHTA_MIN) {
cg_crosshair_friend = cgi.Cvar_Get("cg_crosshair_friend", "textures/hud/crosshair_friend", CVAR_ARCHIVE);
} else {
// on 1.11 and below, fallback to standard crosshair
// as it doesn't have crosshair_friend texture
cg_crosshair_friend = cgi.Cvar_Get("cg_crosshair_friend", "textures/hud/crosshair", CVAR_ARCHIVE);
}
ui_crosshair = cgi.Cvar_Get("ui_crosshair", "1", CVAR_ARCHIVE);
vm_offset_max = cgi.Cvar_Get("vm_offset_max", "8.0", 0); vm_offset_max = cgi.Cvar_Get("vm_offset_max", "8.0", 0);
vm_offset_speed = cgi.Cvar_Get("vm_offset_speed", "8.0", 0); vm_offset_speed = cgi.Cvar_Get("vm_offset_speed", "8.0", 0);
vm_sway_front = cgi.Cvar_Get("vm_sway_front", "0.1", 0); vm_sway_front = cgi.Cvar_Get("vm_sway_front", "0.1", 0);
@ -204,137 +180,51 @@ void CG_RegisterCvars(void)
vm_lean_lower = cgi.Cvar_Get("vm_lean_lower", "0.1", 0); vm_lean_lower = cgi.Cvar_Get("vm_lean_lower", "0.1", 0);
voiceChat = cgi.Cvar_Get("cg_voicechat", "1", 0); voiceChat = cgi.Cvar_Get("cg_voicechat", "1", 0);
ui_timemessage = cgi.Cvar_Get("ui_timemessage", "", 0);
// 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;
}
/*
================
CG_RegisterSoundsForFile
Register the specified ubersound source file
================
*/
void CG_RegisterSoundsForFile(const char *name)
{
int startTime;
int endTime;
Com_Printf("\n\n-----------PARSING '%s'------------\n", name);
Com_Printf(
"Any SetCurrentTiki errors means that tiki wasn't prefetched and tiki-specific sounds for it won't work. To "
"fix prefetch the tiki. Ignore if you don't use that tiki on this level.\n"
);
startTime = cgi.Milliseconds();
CG_Command_ProcessFile(name, qfalse, NULL);
endTime = cgi.Milliseconds();
Com_Printf("Parse/Load time: %f seconds.\n", (float)(endTime - startTime) / 1000.0);
Com_Printf("-------------PARSING '%s' DONE---------------\n\n", name);
}
/*
=================
qsort_compare_strings
perform case-insensitive sorting
=================
*/
int qsort_compare_strings(const void *s1, const void *s2)
{
return Q_stricmp(*(const char **)s1, *(const char **)s2);
} }
/* /*
================= =================
CG_RegisterSounds CG_RegisterSounds
Called during a precache command called during a precache command
================= =================
*/ */
void CG_RegisterSounds( void ) void CG_RegisterSounds( void )
{ {
char **fileList; int startTime;
int numFiles; int endTime;
int i; char filename[MAX_QPATH];
fileList = cgi.FS_ListFilteredFiles("ubersound/", "scr", "*.scr", qfalse, &numFiles, qtrue); Com_Printf("\n\n-----------PARSING UBERSOUND------------\n");
if (cg_target_game >= TG_MOHTA) { Com_Printf(
// Fixed in 2.0 "Any SetCurrentTiki errors means that tiki wasn't prefetched and "
// The behavior has changed, all aliases get cleared "tiki-specific sounds for it won't work. To fix prefe"
if (cgs.gametype != GT_SINGLE_PLAYER) { "tch the tiki. Ignore if you don't use that tiki on this level.\n");
cgi.Alias_Clear(); Com_sprintf(filename, sizeof(filename), "ubersound/ubersound.scr");
}
} else {
if (!cgs.localServer) {
cgi.Alias_Clear();
}
}
qsort(fileList, numFiles, sizeof(char *), &qsort_compare_strings); startTime = cgi.Milliseconds();
CG_Command_ProcessFile(filename, 0, 0);
endTime = cgi.Milliseconds();
for (i = 0; i < numFiles; i++) { Com_Printf("Parse/Load time: %f seconds.\n", (endTime - startTime) / 1000.0f);
// Added in 2.0
// Since 2.0, all files in the ubersound folder
// are parsed
CG_RegisterSoundsForFile(va("ubersound/%s", fileList[i]));
}
cgi.FS_FreeFileList(fileList); Com_Printf("-------------UBERSOUND DONE---------------\n\n");
} Com_Printf("\n\n-----------PARSING UBERDIALOG------------\n");
Com_Printf(
"Any SetCurrentTiki errors means that tiki wasn't prefetched and "
"tiki-specific sounds for it won't work. To fix prefe"
"tch the tiki. Ignore if you don't use that tiki on this level.\n");
Com_sprintf(filename, sizeof(filename), "ubersound/uberdialog.scr");
/* startTime = cgi.Milliseconds();
================ CG_Command_ProcessFile(filename, 0, 0);
CG_IsHandleUnique endTime = cgi.Milliseconds() - startTime;
Check if the model handle is unique Com_Printf("Parse/Load time: %f seconds.\n", endTime / 1000.0f);
================ Com_Printf("-------------UBERDIALOG DONE---------------\n\n");
*/
static qboolean CG_IsHandleUnique(qhandle_t handle) {
int i;
int numRef;
numRef = 0;
for (i = 0; i < MAX_MODELS; i++) {
if (cgs.model_draw[i] == handle) {
numRef++;
if (numRef >= 2) {
return qfalse;
}
}
}
return qtrue;
} }
/* /*
@ -342,49 +232,13 @@ static qboolean CG_IsHandleUnique(qhandle_t handle) {
CG_ProcessConfigString CG_ProcessConfigString
================ ================
*/ */
void CG_ProcessConfigString(int num, qboolean modelOnly) void CG_ProcessConfigString(int num)
{ {
const char* str; const char* str = CG_ConfigString(num);
int i; int i;
str = CG_ConfigString(num); switch (num)
{
if (num >= CS_MODELS && num < CS_MODELS + MAX_MODELS) {
qhandle_t hOldModel = cgs.model_draw[num - CS_MODELS];
if (str && str[0] && !modelOnly) {
qhandle_t hModel = cgi.R_RegisterServerModel(str);
dtiki_t *tiki;
if (hModel != hOldModel) {
if (hOldModel) {
cgi.R_UnregisterServerModel(hOldModel);
}
cgs.model_draw[num - CS_MODELS] = hModel;
}
tiki = cgi.R_Model_GetHandle(hModel);
if (tiki) {
CG_ProcessCacheInitCommands(tiki);
}
CG_ServerModelLoaded(str, hModel);
} else {
// clear out the model
if (hOldModel && CG_IsHandleUnique(hOldModel)) {
// Handle uniqueness added in OPM
cgi.R_UnregisterServerModel(hOldModel);
}
cgs.model_draw[num - CS_MODELS] = 0;
if (!str || !str[0]) {
CG_ServerModelUnloaded(hOldModel);
}
}
}
if (!modelOnly) {
switch (num) {
case CS_RAIN_DENSITY: case CS_RAIN_DENSITY:
cg.rain.density = atof(str); cg.rain.density = atof(str);
return; return;
@ -407,42 +261,38 @@ void CG_ProcessConfigString(int num, qboolean modelOnly)
cg.rain.width = atof(str); cg.rain.width = atof(str);
return; return;
case CS_RAIN_SHADER: case CS_RAIN_SHADER:
Q_strncpyz(cg.rain.currentShader, str, sizeof(cg.rain.currentShader)); if (cg.rain.numshaders)
if (cg.rain.numshaders) { {
// Fixed in OPM for (i = 0; i < cg.rain.numshaders; i++)
// not sure why some maps set a digit at the end... {
size_t len = strlen(cg.rain.currentShader); sprintf(cg.rain.shader[i], "%s%i", str, i);
if (isdigit(cg.rain.currentShader[len - 1])) {
cg.rain.currentShader[len - 1] = 0;
} }
} }
for (i = 0; i < cg.rain.numshaders; ++i) { else {
Com_sprintf(cg.rain.shader[i], sizeof(cg.rain.shader[i]), "%s%i", cg.rain.currentShader, i); strcpy(cg.rain.shader[0], str);
}
if (!cg.rain.numshaders) {
Q_strncpyz(cg.rain.shader[0], cg.rain.currentShader, sizeof(cg.rain.shader[0]));
} }
return; return;
case CS_RAIN_NUMSHADERS: case CS_RAIN_NUMSHADERS:
cg.rain.numshaders = atoi(str); cg.rain.numshaders = atoi(str);
if (cg.rain.numshaders) { if (cg.rain.numshaders)
for (i = 0; i < cg.rain.numshaders; i++) { {
Com_sprintf(cg.rain.shader[i], sizeof(cg.rain.shader[i]), "%s%i", cg.rain.currentShader, i); for (i = 0; i < cg.rain.numshaders; i++)
{
sprintf(cg.rain.shader[i], "%s%i", str, i);
} }
} }
return; return;
case CS_CURRENT_OBJECTIVE:
cg.ObjectivesCurrentIndex = atoi(str);
return;
} }
if (num >= CS_OBJECTIVES && num < CS_OBJECTIVES + MAX_OBJECTIVES) { if (num >= CS_OBJECTIVES && num < CS_OBJECTIVES + MAX_OBJECTIVES)
{
cobjective_t* objective = &cg.Objectives[num - CS_OBJECTIVES]; cobjective_t* objective = &cg.Objectives[num - CS_OBJECTIVES];
objective->flags = atoi(Info_ValueForKey(str, "flags")); objective->flags = atoi(Info_ValueForKey(str, "flags"));
Q_strncpyz(objective->text, Info_ValueForKey(str, "text"), sizeof(objective->text)); strcpy(objective->text, Info_ValueForKey(str, "text"));
} }
switch (num) { switch (num)
{
case CS_MUSIC: case CS_MUSIC:
cgi.MUSIC_NewSoundtrack(str); cgi.MUSIC_NewSoundtrack(str);
return; return;
@ -450,14 +300,16 @@ void CG_ProcessConfigString(int num, qboolean modelOnly)
cg.matchStartTime = atoi(str); cg.matchStartTime = atoi(str);
return; return;
case CS_FOGINFO: case CS_FOGINFO:
cg.farclipOverride = 0;
cg.farplaneColorOverride[0] = -1;
cg.farplaneColorOverride[1] = -1;
cg.farplaneColorOverride[2] = -1;
CG_ParseFogInfo(str); CG_ParseFogInfo(str);
return; return;
case CS_SKYINFO: case CS_SKYINFO:
sscanf(str, "%f %d", &cg.sky_alpha, &cg.sky_portal); sscanf
(
str,
"%f %d",
&cg.sky_alpha,
&cg.sky_portal
);
return; return;
case CS_SERVERINFO: case CS_SERVERINFO:
CG_ParseServerinfo(); CG_ParseServerinfo();
@ -465,36 +317,50 @@ void CG_ProcessConfigString(int num, qboolean modelOnly)
case CS_LEVEL_START_TIME: case CS_LEVEL_START_TIME:
cgs.levelStartTime = atoi(str); cgs.levelStartTime = atoi(str);
return; return;
case CS_VOTE_TIME:
cgs.voteTime = atoi(str);
cgs.voteRefreshed = qtrue;
break;
case CS_VOTE_STRING:
Q_strncpyz(cgs.voteString, str, sizeof(cgs.voteString));
break;
case CS_VOTE_YES:
cgs.numVotesYes = atoi(str);
cgs.voteRefreshed = qtrue;
break;
case CS_VOTE_NO:
cgs.numVotesNo = atoi(str);
cgs.voteRefreshed = qtrue;
break;
case CS_VOTE_UNDECIDED:
cgs.numUndecidedVotes = atoi(str);
cgs.voteRefreshed = qtrue;
break;
case CS_MATCHEND: case CS_MATCHEND:
cgs.matchEndTime = atoi(str); cgs.matchEndTime = atoi(str);
return; return;
} }
if (num >= CS_SOUNDS && num < CS_SOUNDS + MAX_SOUNDS) { if (num >= CS_MODELS && num < CS_MODELS + MAX_MODELS)
{
qhandle_t hOldModel = cgs.model_draw[num - CS_MODELS];
if (str && str[0])
{
qhandle_t hModel = cgi.R_RegisterServerModel(str);
dtiki_t* tiki;
if (hModel != hOldModel)
{
if (hOldModel) {
cgi.R_UnregisterServerModel(hOldModel);
}
cgs.model_draw[num - CS_MODELS] = hModel;
}
tiki = cgi.R_Model_GetHandle(hModel);
if (tiki) {
CG_ProcessCacheInitCommands(tiki);
}
}
else
{
// clear out the model
if (hOldModel) {
cgi.R_UnregisterServerModel(hOldModel);
}
cgs.model_draw[num - CS_MODELS] = 0;
}
}
else if (num >= CS_SOUNDS && num < CS_SOUNDS + MAX_SOUNDS)
{
size_t len = strlen(str); size_t len = strlen(str);
if (len) { if (len)
{
qboolean streamed; qboolean streamed;
char buf[1024]; char buf[1024];
Q_strncpyz(buf, str, sizeof(buf)); strcpy(buf, str);
streamed = buf[len - 1] != '0'; streamed = buf[len - 1] != '0';
buf[len - 1] = 0; buf[len - 1] = 0;
@ -502,18 +368,21 @@ void CG_ProcessConfigString(int num, qboolean modelOnly)
cgs.sound_precache[num - CS_SOUNDS] = cgi.S_RegisterSound(buf, streamed); cgs.sound_precache[num - CS_SOUNDS] = cgi.S_RegisterSound(buf, streamed);
} }
} }
} else if (num >= CS_LIGHTSTYLES && num < CS_LIGHTSTYLES + MAX_LIGHTSTYLES) { }
else if (num >= CS_LIGHTSTYLES && num < CS_LIGHTSTYLES + MAX_LIGHTSTYLES)
{
CG_SetLightStyle(num - CS_LIGHTSTYLES, str); CG_SetLightStyle(num - CS_LIGHTSTYLES, str);
} else if (num >= CS_PLAYERS && num < CS_PLAYERS + MAX_CLIENTS) { }
else if (num >= CS_PLAYERS && num < CS_PLAYERS + MAX_CLIENTS)
{
const char* value; const char* value;
value = Info_ValueForKey(str, "name"); value = Info_ValueForKey(str, "name");
if (value) { if (value) {
strncpy(cg.clientinfo[num - CS_PLAYERS].name, value, sizeof(cg.clientinfo[num - CS_PLAYERS].name)); strncpy(cg.clientinfo[num - CS_PLAYERS].name, value, sizeof(cg.clientinfo[num - CS_PLAYERS].name));
} else { }
strncpy( else {
cg.clientinfo[num - CS_PLAYERS].name, "UnnamedSoldier", sizeof(cg.clientinfo[num - CS_PLAYERS].name) strncpy(cg.clientinfo[num - CS_PLAYERS].name, "UnnamedSoldier", sizeof(cg.clientinfo[num - CS_PLAYERS].name));
);
} }
value = Info_ValueForKey(str, "team"); value = Info_ValueForKey(str, "team");
@ -524,7 +393,6 @@ void CG_ProcessConfigString(int num, qboolean modelOnly)
} }
} }
} }
}
//=================================================================================== //===================================================================================
@ -547,7 +415,8 @@ void CG_PrepRefresh(void)
// register the inline models // register the inline models
cgs.numInlineModels = cgi.CM_NumInlineModels(); cgs.numInlineModels = cgi.CM_NumInlineModels();
for (i = 1; i < cgs.numInlineModels; i++) { for (i = 1; i < cgs.numInlineModels; i++)
{
char name[10]; char name[10];
vec3_t mins, maxs; vec3_t mins, maxs;
int j; int j;
@ -556,7 +425,8 @@ void CG_PrepRefresh(void)
cgs.inlineDrawModel[i] = cgi.R_RegisterModel(name); cgs.inlineDrawModel[i] = cgi.R_RegisterModel(name);
cgi.R_ModelBounds(cgs.inlineDrawModel[i], mins, maxs); cgi.R_ModelBounds(cgs.inlineDrawModel[i], mins, maxs);
for (j = 0; j < 3; j++) { for (j = 0; j < 3; j++)
{
cgs.inlineModelMidpoints[i][j] = mins[j] + 0.5 * (maxs[j] - mins[j]); cgs.inlineModelMidpoints[i][j] = mins[j] + 0.5 * (maxs[j] - mins[j]);
} }
} }
@ -574,14 +444,15 @@ void CG_PrepRefresh(void)
cgs.media.binocularsOverlayShader = cgi.R_RegisterShaderNoMip("textures/hud/binocularsoverlay"); cgs.media.binocularsOverlayShader = cgi.R_RegisterShaderNoMip("textures/hud/binocularsoverlay");
cgs.media.hudDrawFont = cgi.R_LoadFont("verdana-14"); cgs.media.hudDrawFont = cgi.R_LoadFont("verdana-14");
cgs.media.attackerFont = cgi.R_LoadFont("facfont-20"); cgs.media.attackerFont = cgi.R_LoadFont("facfont-20");
cgs.media.objectiveFont = cgi.R_LoadFont("facfont-20"); // was courier-16 before 2.0 cgs.media.objectiveFont = cgi.R_LoadFont("courier-16");
cgs.media.objectivesBackShader = cgi.R_RegisterShaderNoMip("textures/hud/objectives_backdrop"); cgs.media.objectivesBackShader = cgi.R_RegisterShaderNoMip("textures/hud/objectives_backdrop");
cgs.media.checkedBoxShader = cgi.R_RegisterShaderNoMip("textures/objectives/filledbox"); cgs.media.checkedBoxShader = cgi.R_RegisterShaderNoMip("textures/objectives/filledbox");
cgs.media.uncheckedBoxShader = cgi.R_RegisterShaderNoMip("textures/objectives/emptybox"); cgs.media.uncheckedBoxShader = cgi.R_RegisterShaderNoMip("textures/objectives/emptybox");
// go through all the configstrings and process them // go through all the configstrings and process them
for (i = CS_SYSTEMINFO + 1; i < MAX_CONFIGSTRINGS; i++) { for (i = CS_SYSTEMINFO + 1; i < MAX_CONFIGSTRINGS; i++)
CG_ProcessConfigString(i, qfalse); {
CG_ProcessConfigString(i);
} }
} }
@ -592,8 +463,7 @@ void CG_PrepRefresh(void)
CG_ConfigString CG_ConfigString
================= =================
*/ */
const char *CG_ConfigString(int index) const char *CG_ConfigString( int index ) {
{
if ( index < 0 || index >= MAX_CONFIGSTRINGS ) { if ( index < 0 || index >= MAX_CONFIGSTRINGS ) {
cgi.Error( ERR_DROP, "CG_ConfigString: bad index: %i", index ); cgi.Error( ERR_DROP, "CG_ConfigString: bad index: %i", index );
} }
@ -602,13 +472,13 @@ const char *CG_ConfigString(int index)
//================================================================== //==================================================================
void CG_GetRendererConfig(void) void CG_GetRendererConfig(void)
{ {
// get the rendering configuration from the client system // get the rendering configuration from the client system
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);
} }
/* /*
@ -621,7 +491,6 @@ Displays the info screen while loading media
void CG_GameStateReceived( void ) void CG_GameStateReceived( void )
{ {
const char* s; const char* s;
int checksum;
// clear everything // clear everything
memset(&cg, 0, sizeof(cg)); memset(&cg, 0, sizeof(cg));
@ -648,10 +517,7 @@ void CG_GameStateReceived(void)
CG_ParseServerinfo(); CG_ParseServerinfo();
// load the new map // load the new map
cgi.CM_LoadMap(cgs.mapname, &checksum); cgi.CM_LoadMap(cgs.mapname);
if (cgs.useMapChecksum && checksum != cgs.mapChecksum && cgs.gametype != GT_SINGLE_PLAYER) {
cgi.Error(ERR_DROP, "Client/Server map checksum mismatch: %x/%x", checksum, cgs.mapChecksum);
}
CG_InitMarks(); CG_InitMarks();
@ -695,6 +561,16 @@ void CG_ServerRestarted(void)
CG_InitializeObjectives(); CG_InitializeObjectives();
} }
void* CG_Malloc(int size)
{
return malloc(size);
}
void CG_Free(void *ptr)
{
free(ptr);
}
/* /*
================= =================
CG_Init CG_Init
@ -702,23 +578,17 @@ CG_Init
Called after every level change or subsystem restart Called after every level change or subsystem restart
================= =================
*/ */
void CG_Init(clientGameImport_t *imported, int serverMessageNum, int serverCommandSequence, int clientNum) void CG_Init(clientGameImport_t* imported, int serverMessageNum,
int serverCommandSequence, int clientNum)
{ {
cgi = *imported; cgi = *imported;
#if _DEBUG
cg_protocol = cgi.Cvar_Get("com_protocol", "", 0)->integer; cgi.Malloc = &CG_Malloc;
cg_target_game = (target_game_e)cgi.Cvar_Get("com_target_game", "0", 0)->integer; cgi.Free = &CG_Free;
#endif
CG_InitCGMessageAPI(&cge);
CG_InitScoresAPI(&cge);
memset(&cg, 0, sizeof(cg)); memset(&cg, 0, sizeof(cg));
memset(&cgs, 0, sizeof(cgs)); memset(&cgs, 0, sizeof(cgs));
// clear fog values
cg.farclipOverride = 0;
cg.farplaneColorOverride[0] = -1;
cg.farplaneColorOverride[1] = -1;
cg.farplaneColorOverride[2] = -1;
cg.clientNum = clientNum; cg.clientNum = clientNum;
cgs.processedSnapshotNum = serverMessageNum; cgs.processedSnapshotNum = serverMessageNum;
@ -775,14 +645,11 @@ Called before every level change or subsystem restart
void CG_Shutdown(void) void CG_Shutdown(void)
{ {
L_ShutdownEvents(); L_ShutdownEvents();
// Shutdown radar
cgi.CL_InitRadar(NULL, NULL, -1);
// some mods may need to do cleanup work here, // some mods may need to do cleanup work here,
// like closing files or archiving session data // like closing files or archiving session data
// hide the stats screen // hide the stats screen
cgi.UI_HideMenu("StatsScreen", qtrue); cgi.UI_HideMenu("StatsScreen", 1);
// reset the scoreboard // reset the scoreboard
CG_PrepScoreBoardInfo(); CG_PrepScoreBoardInfo();
@ -808,6 +675,8 @@ The only exported function from this module
*/ */
clientGameExport_t *GetCGameAPI(void) clientGameExport_t *GetCGameAPI(void)
{ {
static clientGameExport_t cge;
cge.CG_Init = CG_Init; cge.CG_Init = CG_Init;
cge.CG_DrawActiveFrame = CG_DrawActiveFrame; cge.CG_DrawActiveFrame = CG_DrawActiveFrame;
cge.CG_Shutdown = CG_Shutdown; cge.CG_Shutdown = CG_Shutdown;
@ -818,6 +687,7 @@ clientGameExport_t *GetCGameAPI(void)
cge.CG_EyeOffset = CG_EyeOffset; cge.CG_EyeOffset = CG_EyeOffset;
cge.CG_EyeAngles = CG_EyeAngles; cge.CG_EyeAngles = CG_EyeAngles;
cge.CG_SensitivityScale = CG_SensitivityScale; cge.CG_SensitivityScale = CG_SensitivityScale;
cge.CG_ParseCGMessage = CG_ParseCGMessage;
cge.CG_RefreshHudDrawElements = CG_RefreshHudDrawElements; cge.CG_RefreshHudDrawElements = CG_RefreshHudDrawElements;
cge.CG_HudDrawShader = CG_HudDrawShader; cge.CG_HudDrawShader = CG_HudDrawShader;
cge.CG_HudDrawFont = CG_HudDrawFont; cge.CG_HudDrawFont = CG_HudDrawFont;
@ -829,13 +699,13 @@ clientGameExport_t *GetCGameAPI(void)
cge.CG_EndTiki = CG_EndTiki; cge.CG_EndTiki = CG_EndTiki;
cge.CG_GetParent = CG_GetParent; cge.CG_GetParent = CG_GetParent;
cge.CG_GetObjectiveAlpha = CG_GetObjectiveAlpha; cge.CG_GetObjectiveAlpha = CG_GetObjectiveAlpha;
cge.CG_GetColumnName = CG_GetColumnName;
cge.CG_GetScoreBoardColor = CG_GetScoreBoardColor;
cge.CG_GetScoreBoardFontColor = CG_GetScoreBoardFontColor;
cge.CG_GetScoreBoardPosition = CG_GetScoreBoardPosition;
cge.CG_GetScoreBoardDrawHeader = CG_GetScoreBoardDrawHeader;
cge.CG_WeaponCommandButtonBits = CG_WeaponCommandButtonBits; cge.CG_WeaponCommandButtonBits = CG_WeaponCommandButtonBits;
cge.CG_CheckCaptureKey = CG_CheckCaptureKey; cge.CG_CheckCaptureKey = CG_CheckCaptureKey;
cge.CG_ReadNonPVSClient = CG_ReadNonPVSClient;
cge.CG_UpdateRadar = CG_UpdateRadar;
cge.CG_SaveStateToBuffer = CG_SaveStateToBuffer;
cge.CG_LoadStateToBuffer = CG_LoadStateToBuffer;
cge.CG_CleanUpTempModels = CG_CleanUpTempModels;
// FIXME // FIXME
//cge.profStruct = NULL; //cge.profStruct = NULL;
@ -876,7 +746,8 @@ void CG_DrawActive(stereoFrame_t stereoView)
// offset vieworg appropriately if we're doing stereo separation // offset vieworg appropriately if we're doing stereo separation
VectorCopy(cg.refdef.vieworg, baseOrg); VectorCopy(cg.refdef.vieworg, baseOrg);
if (separation != 0) { if (separation != 0) {
VectorMA(cg.refdef.vieworg, -separation, cg.refdef.viewaxis[1], cg.refdef.vieworg); VectorMA(cg.refdef.vieworg, -separation, cg.refdef.viewaxis[1],
cg.refdef.vieworg);
} }
// draw 3D view // draw 3D view
@ -891,25 +762,23 @@ void CG_DrawActive(stereoFrame_t stereoView)
#ifndef CGAME_HARD_LINKED #ifndef CGAME_HARD_LINKED
// this is only here so the functions in q_shared.c and bg_*.c can link (FIXME) // this is only here so the functions in q_shared.c and bg_*.c can link (FIXME)
void Com_Error(int level, const char *error, ...) void Com_Error( int level, const char *error, ... ) {
{
va_list argptr; va_list argptr;
char text[1024]; char text[1024];
va_start (argptr, error); va_start (argptr, error);
Q_vsnprintf(text, sizeof(text), error, argptr); vsprintf (text, error, argptr);
va_end (argptr); va_end (argptr);
cgi.Error( level, "%s", text); cgi.Error( level, "%s", text);
} }
void Com_Printf(const char *msg, ...) void Com_Printf( const char *msg, ... ) {
{
va_list argptr; va_list argptr;
char text[1024]; char text[1024];
va_start (argptr, msg); va_start (argptr, msg);
Q_vsnprintf(text, sizeof(text), msg, argptr); vsprintf (text, msg, argptr);
va_end (argptr); va_end (argptr);
cgi.Printf( "%s", text); cgi.Printf( "%s", text);
@ -917,8 +786,9 @@ void Com_Printf(const char *msg, ...)
#endif #endif
void CG_ParseFogInfo_ver_15(const char *str) #if TARGET_GAME_PROTOCOL >= 15
{
void CG_ParseFogInfo(const char* str) {
sscanf( sscanf(
str, str,
"%d %f %f %f %f %f %f %f %d %f %f %f %f", "%d %f %f %f %f %f %f %f %d %f %f %f %f",
@ -938,23 +808,15 @@ void CG_ParseFogInfo_ver_15(const char *str)
); );
} }
void CG_ParseFogInfo_ver_6(const char *str) #else
{
//
// clear all unsupported fields in protocol below version 15
//
// don't set the farplane_bias 0, otherwise the renderer will set a minimum value void CG_ParseFogInfo(const char* str) {
cg.farplane_bias = 0.001f; cg.farclipOverride = 0.0;
cg.skyboxFarplane = 0;
cg.skyboxSpeed = 0;
cg.renderTerrain = qtrue;
cg.farclipOverride = -1.0;
cg.farplaneColorOverride[0] = -1.0; cg.farplaneColorOverride[0] = -1.0;
cg.farplaneColorOverride[1] = -1.0; cg.farplaneColorOverride[1] = -1.0;
cg.farplaneColorOverride[2] = -1.0; cg.farplaneColorOverride[2] = -1.0;
sscanf
sscanf( (
str, str,
"%d %f %f %f %f", "%d %f %f %f %f",
&cg.farplane_cull, &cg.farplane_cull,
@ -965,11 +827,4 @@ void CG_ParseFogInfo_ver_6(const char *str)
); );
} }
void CG_ParseFogInfo(const char *str) #endif
{
if (cg_protocol >= PROTOCOL_MOHTA_MIN) {
CG_ParseFogInfo_ver_15(str);
} else {
CG_ParseFogInfo_ver_6(str);
}
}

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

View file

@ -51,16 +51,15 @@ void RainTouch(ctempmodel_t *ct, trace_t *trace)
void ClientGameCommandManager::RainTouch(Event* ev) void ClientGameCommandManager::RainTouch(Event* ev)
{ {
// Nothing to do // FIXME: unimplemented
} }
void ClientGameCommandManager::InitializeRainCvars() void ClientGameCommandManager::InitializeRainCvars()
{ {
int i; int i;
cg_rain = cgi.Cvar_Get("cg_rain", "1", CVAR_ARCHIVE); cg_rain = cgi.Cvar_Get("cg_rain", "0", CVAR_ARCHIVE);
cg_rain_drawcoverage = cg_rain_drawcoverage = cgi.Cvar_Get("cg_rain_drawcoverage", "0", CVAR_SAVEGAME | CVAR_SERVER_CREATED | CVAR_SYSTEMINFO);
cgi.Cvar_Get("cg_rain_drawcoverage", "0", CVAR_SAVEGAME | CVAR_RESETSTRING | CVAR_SYSTEMINFO);
cg.rain.density = 0.0; cg.rain.density = 0.0;
cg.rain.speed = 2048.0f; cg.rain.speed = 2048.0f;
@ -134,21 +133,30 @@ void CG_Rain(centity_t *cent)
return; return;
} }
if (cg_rain_drawcoverage->integer) { if (cg_rain_drawcoverage->integer)
{
cgi.R_DebugLine( cgi.R_DebugLine(
Vector(vOmins[0], vOmins[1], vOmins[2]), Vector(vOmaxs[0], vOmins[1], vOmins[2]), 1.0, 0.0, 0.0, 1.0 Vector(vOmins[0], vOmins[1], vOmins[2]),
Vector(vOmaxs[0], vOmins[1], vOmins[2]),
1.0, 0.0, 0.0, 1.0
); );
cgi.R_DebugLine( cgi.R_DebugLine(
Vector(vOmaxs[0], vOmins[1], vOmins[2]), Vector(vOmaxs[0], vOmaxs[1], vOmins[2]), 1.0, 0.0, 0.0, 1.0 Vector(vOmaxs[0], vOmins[1], vOmins[2]),
Vector(vOmaxs[0], vOmaxs[1], vOmins[2]),
1.0, 0.0, 0.0, 1.0
); );
cgi.R_DebugLine( cgi.R_DebugLine(
Vector(vOmaxs[0], vOmaxs[1], vOmins[2]), Vector(vOmins[0], vOmaxs[1], vOmins[2]), 1.0, 0.0, 0.0, 1.0 Vector(vOmaxs[0], vOmaxs[1], vOmins[2]),
Vector(vOmins[0], vOmaxs[1], vOmins[2]),
1.0, 0.0, 0.0, 1.0
); );
cgi.R_DebugLine( cgi.R_DebugLine(
Vector(vOmins[0], vOmaxs[1], vOmins[2]), Vector(vOmins[0], vOmins[1], vOmins[2]), 1.0, 0.0, 0.0, 1.0 Vector(vOmins[0], vOmaxs[1], vOmins[2]),
Vector(vOmins[0], vOmins[1], vOmins[2]),
1.0, 0.0, 0.0, 1.0
); );
} }
@ -163,18 +171,21 @@ void CG_Rain(centity_t *cent)
if (cg.rain.numshaders) { if (cg.rain.numshaders) {
shadername = cg.rain.shader[iRandom % cg.rain.numshaders]; shadername = cg.rain.shader[iRandom % cg.rain.numshaders];
} else { }
else {
shadername = cg.rain.shader[0]; shadername = cg.rain.shader[0];
} }
for (i = 0; i < iNumSpawn; ++i) { for (i = 0; i < iNumSpawn; ++i)
{
iLife = (int)(vOe[2] / ((float)(iRandom % cg.rain.speed_vary) + cg.rain.speed) * 1000.0); iLife = (int)(vOe[2] / ((float)(iRandom % cg.rain.speed_vary) + cg.rain.speed) * 1000.0);
vStart[0] = (float)(iRandom % (int)(vOe[0] + 1.0)) + vOmins[0]; vStart[0] = (float)(iRandom % (int)(vOe[0] + 1.0)) + vOmins[0];
iRandom = ((214013 * iRandom + 2531011) >> 16) & 0x7FFF; iRandom = ((214013 * iRandom + 2531011) >> 16) & 0x7FFF;
vStart[1] = (float)(iRandom % (int)(vOe[1] + 1.0)) + vOmins[1]; vStart[1] = (float)(iRandom % (int)(vOe[1] + 1.0)) + vOmins[1];
vStart[2] = vOmaxs[2]; vStart[2] = vOmaxs[2];
if (cg.snap) { if (cg.snap)
{
vLength[0] = cg.snap->ps.origin[0] - vStart[0]; vLength[0] = cg.snap->ps.origin[0] - vStart[0];
vLength[1] = cg.snap->ps.origin[1] - vStart[1]; vLength[1] = cg.snap->ps.origin[1] - vStart[1];
vLength[2] = 0.0; vLength[2] = 0.0;

File diff suppressed because it is too large Load diff

View file

@ -31,7 +31,7 @@ extern "C" {
void CG_AddBulletTracers(); void CG_AddBulletTracers();
void CG_AddBulletImpacts(); void CG_AddBulletImpacts();
void CG_InitCGMessageAPI(clientGameExport_t *cge); void CG_ParseCGMessage();
#ifdef __cplusplus #ifdef __cplusplus
} }

View file

@ -53,7 +53,8 @@ void CG_ResetPlayerEntity(centity_t *cent)
VectorCopy(cent->currentState.angles, cent->lerpAngles); VectorCopy(cent->currentState.angles, cent->lerpAngles);
VectorCopy(cent->lerpAngles, cent->rawAngles); VectorCopy(cent->lerpAngles, cent->rawAngles);
if (cent->currentState.number == cg.snap->ps.clientNum) { if (cent->currentState.number == cg.snap->ps.clientNum)
{
// initialize the camera position // initialize the camera position
VectorCopy(cent->lerpOrigin, cg.currentViewPos); VectorCopy(cent->lerpOrigin, cg.currentViewPos);
// initialize the camera angles // initialize the camera angles

View file

@ -35,4 +35,8 @@ CG_TransitionPlayerState
=============== ===============
*/ */
void CG_TransitionPlayerState(playerState_t *ps, playerState_t *ops) {} void CG_TransitionPlayerState( playerState_t *ps, playerState_t *ops )
{
}

View file

@ -25,9 +25,6 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
// interpolating between snapshots from the server or locally predicting // interpolating between snapshots from the server or locally predicting
// ahead the client's movement. It also handles local physics interaction, // ahead the client's movement. It also handles local physics interaction,
// like fragments bouncing off walls // like fragments bouncing off walls
//
// ADDITIONS:
// - CG_InterpolatePlayerState() footer: Interpolate the lean angles
#include "cg_local.h" #include "cg_local.h"
@ -36,7 +33,6 @@ static pmove_t cg_pmove;
static int cg_numSolidEntities; static int cg_numSolidEntities;
static centity_t* cg_solidEntities[MAX_ENTITIES_IN_SNAPSHOT]; static centity_t* cg_solidEntities[MAX_ENTITIES_IN_SNAPSHOT];
static int cg_numTriggerEntities; static int cg_numTriggerEntities;
// static centity_t *cg_triggerEntities[MAX_ENTITIES_IN_SNAPSHOT]; // static centity_t *cg_triggerEntities[MAX_ENTITIES_IN_SNAPSHOT];
/* /*
@ -68,7 +64,8 @@ void CG_BuildSolidList(void)
cent = &cg_entities[snap->entities[i].number]; cent = &cg_entities[snap->entities[i].number];
ent = &cent->currentState; ent = &cent->currentState;
if (ent->eType == ET_ITEM || ent->eType == ET_PUSH_TRIGGER || ent->eType == ET_TELEPORT_TRIGGER) { if (ent->eType == ET_ITEM || ent->eType == ET_PUSH_TRIGGER ||
ent->eType == ET_TELEPORT_TRIGGER) {
/* /*
cg_triggerEntities[cg_numTriggerEntities] = cent; cg_triggerEntities[cg_numTriggerEntities] = cent;
cg_numTriggerEntities++; cg_numTriggerEntities++;
@ -84,59 +81,17 @@ void CG_BuildSolidList(void)
} }
} }
int CG_GetBrushEntitiesInBounds(int iMaxEnts, centity_t** pEntList, const vec3_t vMins, const vec3_t vMaxs)
{
int i;
int iEntCount;
clipHandle_t cmodel;
vec3_t vEntMins, vEntMaxs;
centity_t* cent;
iEntCount = 0;
for (i = 0; i < cg_numSolidEntities; i++) {
cent = cg_solidEntities[i];
if (cent->currentState.solid != SOLID_BMODEL) {
continue;
}
cmodel = cgi.CM_InlineModel(cent->currentState.modelindex);
cgi.R_GetInlineModelBounds(cmodel, vEntMins, vEntMaxs);
if (cent->lerpAngles[0] || cent->lerpAngles[1] || cent->lerpAngles[2]) {
CalculateRotatedBounds(cent->lerpAngles, vEntMins, vEntMaxs);
}
VectorAdd(vEntMins, cent->lerpOrigin, vEntMins);
VectorAdd(vEntMaxs, cent->lerpOrigin, vEntMaxs);
if (vEntMins[0] <= vMaxs[0] && vEntMaxs[0] >= vMins[0]
&& vEntMins[1] <= vMaxs[1] && vEntMaxs[1] >= vMins[1]
&& vEntMins[2] <= vMaxs[2] && vEntMaxs[2] >= vMins[2]) {
pEntList[iEntCount++] = cent;
if (iEntCount >= iMaxEnts) {
return iEntCount;
}
}
}
return iEntCount;
}
/* /*
==================== ====================
CG_ClipMoveToEntities CG_ClipMoveToEntities
==================== ====================
*/ */
void CG_ClipMoveToEntities( void CG_ClipMoveToEntities(const vec3_t start, const vec3_t mins,
const vec3_t start, const vec3_t maxs, const vec3_t end,
const vec3_t mins, int skipNumber, int mask, trace_t* tr,
const vec3_t maxs, qboolean cylinder)
const vec3_t end,
int skipNumber,
int mask,
trace_t *tr,
qboolean cylinder
)
{ {
int i; int i;
trace_t trace; trace_t trace;
@ -162,17 +117,21 @@ void CG_ClipMoveToEntities(
} }
} else { } else {
IntegerToBoundingBox(ent->solid, bmins, bmaxs); IntegerToBoundingBox(ent->solid, bmins, bmaxs);
cmodel = cgi.CM_TempBoxModel(bmins, bmaxs, CONTENTS_BBOX); cmodel = cgi.CM_TempBoxModel(
bmins, bmaxs,
CONTENTS_BBOX);
} }
VectorCopy(cent->lerpOrigin, origin); VectorCopy(cent->lerpOrigin, origin);
if (ent->eFlags & EF_LINKANGLES) { if (ent->eFlags & EF_LINKANGLES) {
VectorCopy(cent->lerpAngles, angles); VectorCopy(cent->lerpAngles, angles);
} else { }
else {
VectorClear(angles); VectorClear(angles);
} }
cgi.CM_TransformedBoxTrace(&trace, start, end, mins, maxs, cmodel, mask, origin, angles, cylinder); cgi.CM_TransformedBoxTrace(&trace, start, end, mins, maxs, cmodel, mask,
origin, angles, cylinder);
if (trace.allsolid || trace.fraction < tr->fraction) { if (trace.allsolid || trace.fraction < tr->fraction) {
trace.entityNum = ent->number; trace.entityNum = ent->number;
@ -184,22 +143,16 @@ void CG_ClipMoveToEntities(
} }
void CG_ShowTrace(trace_t* trace, int passent, const char* reason) void CG_ShowTrace(trace_t* trace, int passent, const char* reason)
{ {
char text[1024]; char text[1024];
assert(reason); assert(reason);
assert(trace); assert(trace);
Com_sprintf( sprintf(text, "%0.2f : Pass (%d) Frac %f Hit (%d): '%s'\n",
text, (float)cg.time / 1000.0f, passent, trace->fraction,
sizeof(text), trace->entityNum, reason ? reason : "");
"%0.2f : Pass (%d) Frac %f Hit (%d): '%s'\n",
(float)cg.time / 1000.0f,
passent,
trace->fraction,
trace->entityNum,
reason ? reason : ""
);
if (cg_traceinfo->integer == 3) { if (cg_traceinfo->integer == 3) {
cgi.DebugPrintf(text); cgi.DebugPrintf(text);
@ -213,18 +166,11 @@ void CG_ShowTrace(trace_t *trace, int passent, const char *reason)
CG_Trace CG_Trace
================ ================
*/ */
void CG_Trace( void CG_Trace(trace_t* result, const vec3_t start, const vec3_t mins,
trace_t *result, const vec3_t maxs, const vec3_t end, int skipNumber, int mask,
const vec3_t start, qboolean cylinder, qboolean cliptoentities,
const vec3_t mins, const char* description)
const vec3_t maxs,
const vec3_t end,
int skipNumber,
int mask,
qboolean cylinder,
qboolean cliptoentities,
const char *description
)
{ {
trace_t t; trace_t t;
@ -239,7 +185,8 @@ void CG_Trace(
if (cliptoentities) { if (cliptoentities) {
// check all other solid models // check all other solid models
CG_ClipMoveToEntities(start, mins, maxs, end, skipNumber, mask, &t, cylinder); CG_ClipMoveToEntities(start, mins, maxs, end, skipNumber, mask, &t,
cylinder);
} }
*result = t; *result = t;
@ -254,19 +201,13 @@ void CG_Trace(
CG_PlayerTrace CG_PlayerTrace
================ ================
*/ */
void CG_PlayerTrace( void CG_PlayerTrace(trace_t* result, const vec3_t start, const vec3_t mins,
trace_t *result, const vec3_t maxs, const vec3_t end, int skipNumber,
const vec3_t start, int mask, qboolean cylinder, qboolean tracedeep)
const vec3_t mins,
const vec3_t maxs,
const vec3_t end,
int skipNumber,
int mask,
qboolean cylinder,
qboolean tracedeep
)
{ {
CG_Trace(result, start, mins, maxs, end, skipNumber, mask, cylinder, qtrue, "PlayerTrace"); CG_Trace(result, start, mins, maxs, end, skipNumber, mask, cylinder, qtrue,
"PlayerTrace");
} }
/* /*
@ -302,7 +243,8 @@ int CG_PointContents(const vec3_t point, int passEntityNum)
continue; continue;
} }
contents |= cgi.CM_TransformedPointContents(point, cmodel, ent->origin, ent->angles); contents |= cgi.CM_TransformedPointContents(point, cmodel, ent->origin,
ent->angles);
} }
return contents; return contents;
@ -330,17 +272,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) {
@ -351,29 +283,22 @@ static void CG_InterpolatePlayerStateCamera(void)
return; return;
} }
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;
} }
// Added in 2.0
if (cg.predicted_player_state.camera_flags & CF_CAMERA_ANGLES_TURRETMODE) {
VectorCopy(cg.nextSnap->ps.camera_origin, cg.camera_origin);
VectorCopy(cg.nextSnap->ps.camera_angles, cg.camera_angles);
return;
}
for (i = 0; i < 3; i++) { for (i = 0; i < 3; i++) {
cg.camera_origin[i] = prev->ps.camera_origin[i] + f * (next->ps.camera_origin[i] - prev->ps.camera_origin[i]); cg.camera_origin[i] =
cg.camera_angles[i] = LerpAngle(prev->ps.camera_angles[i], next->ps.camera_angles[i], f); prev->ps.camera_origin[i] +
f * (next->ps.camera_origin[i] - prev->ps.camera_origin[i]);
cg.camera_angles[i] =
LerpAngle(prev->ps.camera_angles[i], next->ps.camera_angles[i], f);
} }
} }
@ -424,15 +349,15 @@ static void CG_InterpolatePlayerState(qboolean grabAngles)
f = cg.frameInterpolation; f = cg.frameInterpolation;
for (i = 0; i < 3; i++) { for (i = 0; i < 3; i++) {
out->origin[i] = prev->ps.origin[i] + f * (next->ps.origin[i] - prev->ps.origin[i]); out->origin[i] =
prev->ps.origin[i] + f * (next->ps.origin[i] - prev->ps.origin[i]);
if (!grabAngles) { if (!grabAngles) {
out->viewangles[i] = LerpAngle(prev->ps.viewangles[i], next->ps.viewangles[i], f); out->viewangles[i] =
LerpAngle(prev->ps.viewangles[i], next->ps.viewangles[i], f);
} }
out->velocity[i] = prev->ps.velocity[i] + f * (next->ps.velocity[i] - prev->ps.velocity[i]); out->velocity[i] = prev->ps.velocity[i] +
f * (next->ps.velocity[i] - prev->ps.velocity[i]);
} }
// interpolate the lean angle
out->fLeanAngle = LerpAngle(prev->ps.fLeanAngle, next->ps.fLeanAngle, f);
} }
/* /*
@ -479,7 +404,8 @@ void CG_PredictPlayerState(void)
} }
// demo playback just copies the moves // demo playback just copies the moves
if (cg.demoPlayback || (cg.snap->ps.pm_flags & PMF_NO_PREDICTION) || (cg.snap->ps.pm_flags & PMF_FROZEN)) { if (cg.demoPlayback || (cg.snap->ps.pm_flags & PMF_NO_PREDICTION) ||
(cg.snap->ps.pm_flags & PMF_FROZEN)) {
CG_InterpolatePlayerState(qfalse); CG_InterpolatePlayerState(qfalse);
return; return;
} }
@ -488,7 +414,8 @@ void CG_PredictPlayerState(void)
// FIXME // FIXME
// Noclip is jittery for some reason, so I'm disabling prediction while // Noclip is jittery for some reason, so I'm disabling prediction while
// noclipping // noclipping
if (cg_nopredict->integer || cg_synchronousClients->integer || (cg.snap->ps.pm_type == PM_NOCLIP)) { if (cg_nopredict->integer || cg_synchronousClients->integer ||
(cg.snap->ps.pm_type == PM_NOCLIP)) {
CG_InterpolatePlayerState(qtrue); CG_InterpolatePlayerState(qtrue);
return; return;
} }
@ -505,29 +432,6 @@ void CG_PredictPlayerState(void)
} }
cg_pmove.noFootsteps = (cgs.dmflags & DF_NO_FOOTSTEPS) > 0; cg_pmove.noFootsteps = (cgs.dmflags & DF_NO_FOOTSTEPS) > 0;
if (cg_protocol >= PROTOCOL_MOHTA_MIN) {
// Leaning while moving is allowed in mohta and mohtt only with a specific dm flag bit set
cg_pmove.alwaysAllowLean = (cgs.dmflags & DF_ALLOW_LEAN_MOVEMENT) ? qtrue : qfalse;
cg_pmove.leanMax = 45.f;
cg_pmove.leanAdd = 6.f;
cg_pmove.leanRecoverSpeed = 8.5f;
cg_pmove.leanSpeed = 2.f;
} else {
cg_pmove.alwaysAllowLean = qtrue;
if (cgs.gametype != GT_SINGLE_PLAYER) {
cg_pmove.leanMax = 40.f;
} else {
// Don't allow lean in single-player, like in the original game
cg_pmove.leanMax = 0;
}
cg_pmove.leanAdd = 10.f;
cg_pmove.leanRecoverSpeed = 15.f;
cg_pmove.leanSpeed = 4.f;
}
cg_pmove.protocol = cg_protocol;
// save the state before the pmove so we can detect transitions // save the state before the pmove so we can detect transitions
oldPlayerState = cg.predicted_player_state; oldPlayerState = cg.predicted_player_state;
@ -542,11 +446,7 @@ void CG_PredictPlayerState(void)
// the server time is beyond our current cg.time, // the server time is beyond our current cg.time,
// because predicted player positions are going to // because predicted player positions are going to
// be ahead of everything else anyway // be ahead of everything else anyway
// Added in OPM: prediction check if (cg.nextSnap && !cg.nextFrameTeleport && !cg.thisFrameTeleport) {
// Don't use the next snapshot if the prediction is about to be disabled
// this prevent "blinking" issues like when entering a vehicle turret gun
// where arms would be seen shortly
if (cg.nextSnap && !cg.nextFrameTeleport && !cg.thisFrameTeleport && !(cg.nextSnap->ps.pm_flags & PMF_NO_PREDICTION)) {
cg.predicted_player_state = cg.nextSnap->ps; cg.predicted_player_state = cg.nextSnap->ps;
cg.physicsTime = cg.nextSnap->serverTime; cg.physicsTime = cg.nextSnap->serverTime;
} else { } else {
@ -554,11 +454,13 @@ void CG_PredictPlayerState(void)
cg.physicsTime = cg.snap->serverTime; cg.physicsTime = cg.snap->serverTime;
} }
if (pmove_msec->integer >= 8) { if (pmove_msec->integer >= 8)
if (pmove_msec->integer > 33) { {
if (pmove_msec->integer > 33)
cgi.Cvar_Set("pmove_msec", "33"); cgi.Cvar_Set("pmove_msec", "33");
} }
} else { else
{
cgi.Cvar_Set("pmove_msec", "8"); cgi.Cvar_Set("pmove_msec", "8");
} }
@ -590,7 +492,9 @@ void CG_PredictPlayerState(void)
// from the snapshot, but on a wan we will have // from the snapshot, but on a wan we will have
// to predict several commands to get to the point // to predict several commands to get to the point
// we want to compare // we want to compare
if (cg.predicted_player_state.commandTime == oldPlayerState.commandTime) { if (cg.predicted_player_state.commandTime ==
oldPlayerState.commandTime) {
if (cg.thisFrameTeleport) { if (cg.thisFrameTeleport) {
// a teleport will not cause an error decay // a teleport will not cause an error decay
VectorClear(cg.predictedError); VectorClear(cg.predictedError);
@ -608,8 +512,9 @@ void CG_PredictPlayerState(void)
} }
if (cg_pmove.pmove_fixed) { if (cg_pmove.pmove_fixed) {
cg_pmove.cmd.serverTime = cg_pmove.cmd.serverTime = pmove_msec->integer
pmove_msec->integer * ((cg_pmove.cmd.serverTime + pmove_msec->integer - 1) / pmove_msec->integer); * ((cg_pmove.cmd.serverTime + pmove_msec->integer - 1)
/ pmove_msec->integer);
} }
Pmove(&cg_pmove); Pmove(&cg_pmove);
@ -639,15 +544,9 @@ void CG_PredictPlayerState(void)
f = cg.frameInterpolation - 1.0; f = cg.frameInterpolation - 1.0;
offset[0] = (cent->nextState.origin[0] offset[0] = (cent->nextState.origin[0] - cg_entities[cg.predicted_player_state.groundEntityNum].currentState.origin[0]) * f;
- cg_entities[cg.predicted_player_state.groundEntityNum].currentState.origin[0]) offset[1] = (cent->nextState.origin[1] - cg_entities[cg.predicted_player_state.groundEntityNum].currentState.origin[1]) * f;
* f; offset[2] = (cent->nextState.origin[2] - cg_entities[cg.predicted_player_state.groundEntityNum].currentState.origin[2]) * f;
offset[1] = (cent->nextState.origin[1]
- cg_entities[cg.predicted_player_state.groundEntityNum].currentState.origin[1])
* f;
offset[2] = (cent->nextState.origin[2]
- cg_entities[cg.predicted_player_state.groundEntityNum].currentState.origin[2])
* f;
cg.predicted_player_state.origin[0] += offset[0]; cg.predicted_player_state.origin[0] += offset[0];
cg.predicted_player_state.origin[1] += offset[1]; cg.predicted_player_state.origin[1] += offset[1];

View file

@ -23,12 +23,12 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
// DESCRIPTION: // DESCRIPTION:
// client game public interfaces // client game public interfaces
#pragma once #ifndef __CG_PUBLIC_H__
#define __CG_PUBLIC_H__
#include "../renderercommon/tr_types.h"
#ifdef __cplusplus #ifdef __cplusplus
extern "C" { extern "C"
{
#endif #endif
#define MAGIC_UNUSED_NUMBER 7777 #define MAGIC_UNUSED_NUMBER 7777
@ -38,6 +38,7 @@ extern "C" {
// multiple commands may be combined into a single packet, so this // multiple commands may be combined into a single packet, so this
// needs to be larger than PACKET_BACKUP // needs to be larger than PACKET_BACKUP
#define MAX_ENTITIES_IN_SNAPSHOT 1024 #define MAX_ENTITIES_IN_SNAPSHOT 1024
// snapshots are a view of the server at a given time // snapshots are a view of the server at a given time
@ -65,10 +66,11 @@ extern "C" {
server_sound_t sounds[ MAX_SERVER_SOUNDS ]; server_sound_t sounds[ MAX_SERVER_SOUNDS ];
} snapshot_t; } snapshot_t;
typedef struct stopWatch_s { typedef struct stopWatch_s
{
int iStartTime; int iStartTime;
int iEndTime; int iEndTime;
int eType;
} stopWatch_t; } stopWatch_t;
typedef struct AliasList_s AliasList_t; typedef struct AliasList_s AliasList_t;
@ -94,7 +96,8 @@ functions exported to the main executable
================================================================== ==================================================================
*/ */
typedef struct { typedef struct
{
int apiversion; int apiversion;
//============== general services ================== //============== general services ==================
@ -120,9 +123,7 @@ functions exported to the main executable
// console variable interaction // console variable interaction
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);
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 );
@ -139,8 +140,6 @@ functions exported to the main executable
void (*FS_FreeFile)( void *buf ); void (*FS_FreeFile)( void *buf );
int (*FS_WriteFile)( const char *qpath, const void *buffer, int size ); int (*FS_WriteFile)( const char *qpath, const void *buffer, int size );
void (*FS_WriteTextFile)( const char *qpath, const void *buffer, int size ); void (*FS_WriteTextFile)( const char *qpath, const void *buffer, int size );
char** (*FS_ListFilteredFiles)(const char* path, const char* extension, const char* filter, qboolean wantSubs, int* numfiles, qboolean allowNonPureFilesOnDisk);
void (*FS_FreeFileList)(char **list);
// add commands to the local console as if they were typed in // add commands to the local console as if they were typed in
// for map changing, etc. The command is not executed immediately, // for map changing, etc. The command is not executed immediately,
// but will be executed in order the next time console commands // but will be executed in order the next time console commands
@ -167,94 +166,44 @@ functions exported to the main executable
void (*SendClientCommand)( const char *s ); void (*SendClientCommand)( const char *s );
// CM functions // CM functions
void (*CM_LoadMap)(const char *name, int* checksum); void (*CM_LoadMap)( const char *name );
clipHandle_t (*CM_InlineModel)( int index ); // 0 = world, 1+ = bmodels clipHandle_t (*CM_InlineModel)( int index ); // 0 = world, 1+ = bmodels
int (*CM_NumInlineModels)( void ); int (*CM_NumInlineModels)( void );
int (*CM_PointContents)( const vec3_t p, int headnode ); int (*CM_PointContents)( const vec3_t p, int headnode );
int (*CM_TransformedPointContents)( int (*CM_TransformedPointContents)(const vec3_t p, clipHandle_t model, const vec3_t origin, const vec3_t angles);
const vec3_t p, clipHandle_t model, const vec3_t origin, const vec3_t angles void (*CM_BoxTrace)( trace_t *results, const vec3_t start, const vec3_t end,
); const vec3_t mins, const vec3_t maxs,
void (*CM_BoxTrace)( int headnode, int brushmask, qboolean cylinder );
trace_t *results, void (*CM_TransformedBoxTrace)( trace_t *results, const vec3_t start, const vec3_t end,
const vec3_t start, const vec3_t mins, const vec3_t maxs,
const vec3_t end, int headnode, int brushmask,
const vec3_t mins, const vec3_t origin, const vec3_t angles,
const vec3_t maxs,
int headnode,
int brushmask,
qboolean cylinder
);
void (*CM_TransformedBoxTrace)(
trace_t *results,
const vec3_t start,
const vec3_t end,
const vec3_t mins,
const vec3_t maxs,
int headnode,
int brushmask,
const vec3_t origin,
const vec3_t angles,
qboolean cylinder qboolean cylinder
); );
clipHandle_t (*CM_TempBoxModel)( const vec3_t mins, const vec3_t maxs, int contents ); clipHandle_t (*CM_TempBoxModel)( const vec3_t mins, const vec3_t maxs, int contents );
void (*CM_PrintBSPFileSizes)(); void (*CM_PrintBSPFileSizes)();
qboolean (*CM_LeafInPVS)(int leaf1, int leaf2); qboolean (*CM_LeafInPVS)(int leaf1, int leaf2);
int (*CM_PointLeafnum)(const vec3_t p); int (*CM_PointLeafnum)(const vec3_t p);
int (*R_MarkFragments)( int (*R_MarkFragments)( int numPoints, const vec3_t *points, const vec3_t projection,
int numPoints, int maxPoints, vec3_t pointBuffer,
const vec3_t *points, int maxFragments, markFragment_t *fragmentBuffer, float fRadiusSquared );
const vec3_t projection, int (*R_MarkFragmentsForInlineModel)(clipHandle_t bmodel, const vec3_t vAngles, const vec3_t vOrigin,
int maxPoints, int numPoints, const vec3_t *points, const vec3_t projection,
vec3_t pointBuffer, int maxPoints, vec3_t pointBuffer,
int maxFragments, int maxFragments, markFragment_t *fragmentBuffer, float fRadiusSquared );
markFragment_t *fragmentBuffer,
float fRadiusSquared
);
int (*R_MarkFragmentsForInlineModel)(
clipHandle_t bmodel,
const vec3_t vAngles,
const vec3_t vOrigin,
int numPoints,
const vec3_t *points,
const vec3_t projection,
int maxPoints,
vec3_t pointBuffer,
int maxFragments,
markFragment_t *fragmentBuffer,
float fRadiusSquared
);
void (*R_GetInlineModelBounds)(int index, vec3_t mins, vec3_t maxs); void (*R_GetInlineModelBounds)(int index, vec3_t mins, vec3_t maxs);
void (*R_GetLightingForDecal)(vec3_t light, const vec3_t facing, const vec3_t origin); void (*R_GetLightingForDecal)(vec3_t light, vec3_t facing, vec3_t origin);
void (*R_GetLightingForSmoke)(vec3_t light, const vec3_t origin); void (*R_GetLightingForSmoke)(vec3_t light, vec3_t origin);
int (*R_GatherLightSources)(const vec3_t pos, vec3_t* lightPos, vec3_t* lightIntensity, int maxLights); int (*R_GatherLightSources)(const vec3_t pos, vec3_t* lightPos, vec3_t* lightIntensity, int maxLights);
// =========== sound function calls =============== // =========== sound function calls ===============
void (*S_StartSound)( void (*S_StartSound)(const vec3_t origin, int entNum, int entChannel, sfxHandle_t sfxHandle, float volume, float minDist, float pitch, float maxDist, int streamed);
const vec3_t origin,
int entNum,
int entChannel,
sfxHandle_t sfxHandle,
float volume,
float minDist,
float pitch,
float maxDist,
int streamed
);
void (*S_StartLocalSound)(const char* soundName, qboolean forceLoad); void (*S_StartLocalSound)(const char* soundName, qboolean forceLoad);
void (*S_StopSound)( int entnum, int channel ); void (*S_StopSound)( int entnum, int channel );
void (*S_ClearLoopingSounds)(void); void (*S_ClearLoopingSounds)(void);
void (*S_AddLoopingSound)( void (*S_AddLoopingSound)(const vec3_t origin, const vec3_t velocity, sfxHandle_t sfxHandle, float volume, float minDist, float maxDist, float pitch, int flags);
const vec3_t origin,
const vec3_t velocity,
sfxHandle_t sfxHandle,
float volume,
float minDist,
float maxDist,
float pitch,
int flags
);
void (*S_Respatialize)( int entityNum, const vec3_t origin, vec3_t axis[3] ); void (*S_Respatialize)( int entityNum, const vec3_t origin, vec3_t axis[3] );
void (*S_BeginRegistration)( void ); void (*S_BeginRegistration)( void );
sfxHandle_t (*S_RegisterSound)( const char *sample, int streamed ); sfxHandle_t (*S_RegisterSound)( const char *sample, int streamed );
@ -287,38 +236,25 @@ functions exported to the main executable
qhandle_t (*R_RegisterModel)( const char *name ); qhandle_t (*R_RegisterModel)( const char *name );
qhandle_t (*R_SpawnEffectModel)(const char* name, vec3_t pos, vec3_t axis[3]); qhandle_t (*R_SpawnEffectModel)(const char* name, vec3_t pos, vec3_t axis[3]);
qhandle_t (*R_RegisterServerModel)(const char* name); qhandle_t (*R_RegisterServerModel)(const char* name);
const char * (*R_GetModelName)(qhandle_t hModel);
void (*R_UnregisterServerModel)(qhandle_t hModel); void (*R_UnregisterServerModel)(qhandle_t hModel);
qhandle_t (*R_RegisterSkin)( const char *name );
qhandle_t (*R_RegisterShader)( const char *name ); qhandle_t (*R_RegisterShader)( const char *name );
qhandle_t (*R_RegisterShaderNoMip)( const char *name ); qhandle_t (*R_RegisterShaderNoMip)( const char *name );
const char* (*R_GetShaderName)(qhandle_t hShader);
void (*R_AddRefEntityToScene)(const refEntity_t *ent, int parentEntityNumber ); void (*R_AddRefEntityToScene)(const refEntity_t *ent, int parentEntityNumber );
void (*R_AddRefSpriteToScene)(const refEntity_t *ent ); void (*R_AddRefSpriteToScene)(const refEntity_t *ent );
void (*R_AddLightToScene)(const vec3_t origin, float intensity, float r, float g, float b, int type ); void (*R_AddLightToScene)(const vec3_t origin, float intensity, float r, float g, float b, int type );
qboolean (*R_AddPolyToScene)(qhandle_t hShader, int numVerts, const polyVert_t* verts, int renderfx); qboolean (*R_AddPolyToScene)(qhandle_t hShader, int numVerts, const polyVert_t* verts, int renderfx);
void (*R_AddTerrainMarkToScene)( void (*R_AddTerrainMarkToScene)(int terrainIndex, qhandle_t hShader, int numVerts, const polyVert_t* verts, int renderFx);
int terrainIndex, qhandle_t hShader, int numVerts, const polyVert_t *verts, int renderFx
);
void (*R_SetColor)( const vec4_t rgba ); // NULL = 1,1,1,1 void (*R_SetColor)( const vec4_t rgba ); // NULL = 1,1,1,1
void (*R_DrawStretchPic)( void (*R_DrawStretchPic) ( float x, float y, float w, float h,
float x, float s1, float t1, float s2, float t2,
float y, qhandle_t hShader ); // 0 = white
float w,
float h,
float s1,
float t1,
float s2,
float t2,
qhandle_t hShader
); // 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, qboolean virtualScreen);
fontheader_t *font, const char *text, float x, float y, int maxLen, const float *pvVirtualScreen
);
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 =============
@ -353,18 +289,13 @@ functions exported to the main executable
void (*Alias_Dump)( void ); void (*Alias_Dump)( void );
void (*Alias_Clear)( void ); void (*Alias_Clear)( void );
AliasList_t* (*AliasList_New)(const char* name); AliasList_t* (*AliasList_New)(const char* name);
void (*Alias_ListFindRandomRange)( void (*Alias_ListFindRandomRange)(AliasList_t* list, const char* alias, int* minIndex, int* maxIndex, float* totalWeight);
AliasList_t *list, const char *alias, int *minIndex, int *maxIndex, float *totalWeight
);
AliasList_t* (*Alias_GetGlobalList)(); AliasList_t* (*Alias_GetGlobalList)();
// ==================== UI STUFF ========================== // ==================== UI STUFF ==========================
void (*UI_ShowMenu)(const char* name, qboolean bForce); void (*UI_ShowMenu)(const char* name, qboolean bForce);
void (*UI_HideMenu)(const char* name, qboolean bForce); void (*UI_HideMenu)(const char* name, qboolean bForce);
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
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);
@ -412,30 +343,17 @@ functions exported to the main executable
// MISCELLANEOUS SPECIFIC STUFF // MISCELLANEOUS SPECIFIC STUFF
void (*UI_ShowScoreBoard)(const char* menuName); void (*UI_ShowScoreBoard)(const char* menuName);
void (*UI_HideScoreBoard)(); void (*UI_HideScoreBoard)();
void (*UI_SetScoreBoardItem)( void (*UI_SetScoreBoardItem)(int itemNumber, const char* data1,
int itemNumber, const char* data2, const char* data3,
const char *data1, const char* data4, const char* data5,
const char *data2, const char* data6, const char* data7,
const char *data3, const char* data8, const vec4_t textColor,
const char *data4, const vec4_t backColor, qboolean isHeader);
const char *data5,
const char *data6,
const char *data7,
const char *data8,
const vec4_t textColor,
const vec4_t backColor,
qboolean isHeader
);
void (*UI_DeleteScoreBoardItems)(int maxIndex); void (*UI_DeleteScoreBoardItems)(int maxIndex);
void (*UI_ToggleDMMessageConsole)(int consoleMode); void (*UI_ToggleDMMessageConsole)(int consoleMode);
void (*CL_InitRadar)(radarClient_t* radars, qhandle_t* shaders, int clientNum); // Added in 2.0
dtiki_t* (*TIKI_FindTiki)(const char* path); dtiki_t* (*TIKI_FindTiki)(const char* path);
void (*LoadResource)(const char* name); void (*LoadResource)(const char* name);
void (*FS_CanonicalFilename)(char* name); void (*FS_CanonicalFilename)(char* name);
void (*CL_RestoreSavedCgameState)();
void (*CL_ClearSavedCgameState)();
size_t (*getConfigStringIdNormalized)(size_t num);
cvar_t* fsDebug; cvar_t* fsDebug;
hdelement_t* HudDrawElements; hdelement_t* HudDrawElements;
@ -444,6 +362,7 @@ functions exported to the main executable
} clientGameImport_t; } clientGameImport_t;
/* /*
================================================================== ==================================================================
@ -469,32 +388,9 @@ functions exported to the main executable
void (*CG_HudDrawFont)(int info); void (*CG_HudDrawFont)(int info);
int (*CG_GetParent)(int entNum); int (*CG_GetParent)(int entNum);
float (*CG_GetObjectiveAlpha)(); float (*CG_GetObjectiveAlpha)();
int (*CG_PermanentMark)( int (*CG_PermanentMark)(const vec3_t origin, const vec3_t dir, float orientation, float sScale, float tScale, float red, float green, float blue, float alpha, qboolean doLighting, float sCenter, float tCenter, markFragment_t* markFragments, void* polyVerts);
vec3_t origin, int (*CG_PermanentTreadMarkDecal)(treadMark_t* treadMark, qboolean startSegment, qboolean doLighting, markFragment_t* markFragments, void* polyVerts);
vec3_t dir, int (*CG_PermanentUpdateTreadMark)(treadMark_t* treadMark, float alpha, float minSegment, float maxSegment, float maxOffset, float texScale);
float orientation,
float sScale,
float tScale,
float red,
float green,
float blue,
float alpha,
qboolean doLighting,
float sCenter,
float tCenter,
markFragment_t *markFragments,
void *polyVerts
);
int (*CG_PermanentTreadMarkDecal)(
treadMark_t *treadMark,
qboolean startSegment,
qboolean doLighting,
markFragment_t *markFragments,
void *polyVerts
);
int (*CG_PermanentUpdateTreadMark)(
treadMark_t *treadMark, float alpha, float minSegment, float maxSegment, float maxOffset, float texScale
);
void (*CG_ProcessInitCommands)(dtiki_t* tiki, refEntity_t* ent); void (*CG_ProcessInitCommands)(dtiki_t* tiki, refEntity_t* ent);
void (*CG_EndTiki)(dtiki_t* tiki); void (*CG_EndTiki)(dtiki_t* tiki);
const char* (*CG_GetColumnName)(int columnNum, int* columnWidth); const char* (*CG_GetColumnName)(int columnNum, int* columnWidth);
@ -505,15 +401,6 @@ functions exported to the main executable
int (*CG_WeaponCommandButtonBits)(); int (*CG_WeaponCommandButtonBits)();
int (*CG_CheckCaptureKey)(int key, qboolean down, unsigned int time); int (*CG_CheckCaptureKey)(int key, qboolean down, unsigned int time);
//
// Added in 2.0
//
void (*CG_ReadNonPVSClient)(radarUnpacked_t* radarUnpacked);
void (*CG_UpdateRadar)();
size_t (*CG_SaveStateToBuffer)(void** out, int svsTime);
qboolean (*CG_LoadStateToBuffer)(void* state, size_t size, int svsTime);
void (*CG_CleanUpTempModels)();
// FIXME // FIXME
//prof_cgame_t* profStruct; //prof_cgame_t* profStruct;
@ -533,3 +420,5 @@ functions exported to the main executable
#ifdef __cplusplus #ifdef __cplusplus
} }
#endif #endif
#endif // __CG_PUBLIC_H__

View file

@ -1,168 +0,0 @@
/*
===========================================================================
Copyright (C) 2023 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 "cg_local.h"
#include "cg_radar.h"
void CG_InitRadar()
{
int i;
cg.radarShaders[0] = cgi.R_RegisterShader("textures/hud/radar_allies.tga");
cg.radarShaders[1] = cgi.R_RegisterShader("textures/hud/radar_axis.tga");
for (i = 0; i < MAX_CLIENTS; i++)
{
cg.radars[i].time = 0;
cg.radars[i].lastSpeakTime = 0;
}
cgi.CL_InitRadar(cg.radars, cg.radarShaders, cg.snap->ps.clientNum);
}
bool CG_InTeamGame(centity_t *ent)
{
return ent->currentState.solid && cg.clientinfo[ent->currentState.number].team;
}
bool CG_SameTeam(centity_t *ent)
{
return cg.clientinfo[ent->currentState.number].team == cg.clientinfo[cg.snap->ps.clientNum].team;
}
bool CG_IsTeamGame()
{
return cgs.gametype >= GT_TEAM;
}
bool CG_ValidRadarClient(centity_t *ent)
{
if (!cg.snap) {
return qfalse;
}
if (!CG_IsTeamGame()) {
return false;
}
if (!CG_InTeamGame(&cg_entities[cg.snap->ps.clientNum])) {
return false;
}
if (!CG_InTeamGame(ent)) {
return false;
}
return CG_SameTeam(ent);
}
int CG_RadarIcon()
{
switch (cg.clientinfo[cg.snap->ps.clientNum].team)
{
case TEAM_ALLIES:
return 0;
default:
case TEAM_AXIS:
return 1;
}
}
void CG_UpdateRadarClient(centity_t* ent)
{
radarClient_t* radar;
radar = &cg.radars[ent->currentState.number];
if (!CG_ValidRadarClient(ent)) {
radar->time = 0;
return;
}
radar->time = cg.time;
radar->teamShader = CG_RadarIcon();
if (cg.snap->ps.clientNum == ent->currentState.number)
{
radar->origin[0] = cg.refdef.vieworg[0];
radar->origin[1] = cg.refdef.vieworg[1];
radar->axis[0] = cg.refdef.viewaxis[0][0];
radar->axis[1] = cg.refdef.viewaxis[0][1];
VectorNormalize2D(radar->axis);
}
else
{
float axis[2];
radar->origin[0] = ent->currentState.origin[0];
radar->origin[1] = ent->currentState.origin[1];
YawToAxis(ent->currentState.angles[1], axis);
radar->axis[0] = axis[0];
radar->axis[1] = axis[1];
VectorNormalize2D(radar->axis);
}
}
void CG_ReadNonPVSClient(radarUnpacked_t* radarUnpacked)
{
radarClient_t* radar;
float axis[2];
if (!CG_ValidRadarClient(&cg_entities[radarUnpacked->clientNum])) {
return;
}
radar = &cg.radars[radarUnpacked->clientNum];
radar->time = cg.time;
radar->teamShader = CG_RadarIcon();
// copy origin
radar->origin[0] = radarUnpacked->x;
radar->origin[1] = radarUnpacked->y;
// copy yaw
YawToAxis(radarUnpacked->yaw, axis);
radar->axis[0] = axis[0];
radar->axis[1] = axis[1];
VectorNormalize2D(radar->axis);
}
void CG_UpdateRadar()
{
int i;
for (i = 0; i < MAX_CLIENTS; i++)
{
if (cg.radars[i].time)
{
if (!CG_ValidRadarClient(&cg_entities[i])) {
cg.radars[i].time = 0;
}
}
}
}
void CG_RadarClientSpeaks(int num)
{
if (!CG_ValidRadarClient(&cg_entities[num])) {
return;
}
cg.radars[num].lastSpeakTime = cg.time;
}

View file

@ -58,24 +58,26 @@ void CG_PrepScoreBoardInfo()
{ {
switch (cgs.gametype) { switch (cgs.gametype) {
case GT_TEAM_ROUNDS: case GT_TEAM_ROUNDS:
Q_strncpyz(cg.scoresMenuName, "DM_Round_Scoreboard", sizeof(cg.scoresMenuName)); strcpy(cg.scoresMenuName, "DM_Round_Scoreboard");
break; break;
case GT_OBJECTIVE: case GT_OBJECTIVE:
Q_strncpyz(cg.scoresMenuName, "Obj_Scoreboard", sizeof(cg.scoresMenuName)); strcpy(cg.scoresMenuName, "Obj_Scoreboard");
break; break;
case GT_TOW: case GT_TOW:
Q_strncpyz(cg.scoresMenuName, "Tow_Scoreboard", sizeof(cg.scoresMenuName)); strcpy(cg.scoresMenuName, "Tow_Scoreboard");
break; break;
case GT_LIBERATION: case GT_LIBERATION:
Q_strncpyz(cg.scoresMenuName, "Lib_Scoreboard", sizeof(cg.scoresMenuName)); strcpy(cg.scoresMenuName, "Lib_Scoreboard");
break; break;
default: default:
Q_strncpyz(cg.scoresMenuName, "DM_Scoreboard", sizeof(cg.scoresMenuName)); strcpy(cg.scoresMenuName, "DM_Scoreboard");
break; break;
} }
} }
const char *CG_GetColumnName_ver_15(int iColumnNum, int *iColumnWidth) #if TARGET_GAME_PROTOCOL >= 15
const char* CG_GetColumnName(int iColumnNum, int* iColumnWidth)
{ {
int iReturnWidth; int iReturnWidth;
const char* pszReturnString; const char* pszReturnString;
@ -121,49 +123,7 @@ const char *CG_GetColumnName_ver_15(int iColumnNum, int *iColumnWidth)
return pszReturnString; return pszReturnString;
} }
const char *CG_GetColumnName_ver_6(int iColumnNum, int *iColumnWidth) void CG_ParseScores()
{
int iReturnWidth;
const char *pszReturnString;
switch (iColumnNum) {
case 0:
iReturnWidth = 128;
pszReturnString = "Name";
break;
case 1:
iReturnWidth = 64;
pszReturnString = "Kills";
break;
case 2:
iReturnWidth = 64;
pszReturnString = "Deaths";
if (cgs.gametype > GT_TEAM) {
pszReturnString = "Total";
}
break;
case 3:
iReturnWidth = 64;
pszReturnString = "Time";
break;
case 4:
iReturnWidth = 64;
pszReturnString = "Ping";
break;
default:
iReturnWidth = 0;
pszReturnString = 0;
break;
}
if (iColumnWidth) {
*iColumnWidth = iReturnWidth;
}
return pszReturnString;
}
void CG_ParseScores_ver_15()
{ {
int i; int i;
int iEntryCount; int iEntryCount;
@ -225,11 +185,14 @@ void CG_ParseScores_ver_15()
vThisClientTextColor[2] = 0.0f; vThisClientTextColor[2] = 0.0f;
vThisClientTextColor[3] = 1.0f; vThisClientTextColor[3] = 1.0f;
if (cgs.gametype > GT_FFA) { if (cgs.gametype > GT_FFA)
{
vThisClientBackColor[0] = 0.5f; vThisClientBackColor[0] = 0.5f;
vThisClientBackColor[1] = 0.75f; vThisClientBackColor[1] = 0.75f;
vThisClientBackColor[2] = 0.5f; vThisClientBackColor[2] = 0.5f;
} else { }
else
{
vThisClientBackColor[0] = 0.75f; vThisClientBackColor[0] = 0.75f;
vThisClientBackColor[1] = 0.75f; vThisClientBackColor[1] = 0.75f;
vThisClientBackColor[2] = 0.75f; vThisClientBackColor[2] = 0.75f;
@ -238,10 +201,12 @@ void CG_ParseScores_ver_15()
vThisClientBackColor[3] = 0.8f; vThisClientBackColor[3] = 0.8f;
iCurrentEntry = 1; iCurrentEntry = 1;
if (cgs.gametype > GT_FFA) { if (cgs.gametype > GT_FFA)
{
iDatumCount = 6; iDatumCount = 6;
iMatchTeam = cg.snap->ps.stats[STAT_TEAM]; iMatchTeam = cg.snap->ps.stats[STAT_TEAM];
if (iMatchTeam != TEAM_ALLIES && iMatchTeam != TEAM_AXIS) { if (iMatchTeam != TEAM_ALLIES && iMatchTeam != TEAM_AXIS)
{
iMatchTeam = TEAM_ALLIES; iMatchTeam = TEAM_ALLIES;
vThisClientTextColor[0] = 0.0f; vThisClientTextColor[0] = 0.0f;
vThisClientTextColor[1] = 0.0f; vThisClientTextColor[1] = 0.0f;
@ -250,7 +215,9 @@ void CG_ParseScores_ver_15()
vThisClientBackColor[1] = 0.75f; vThisClientBackColor[1] = 0.75f;
vThisClientBackColor[2] = 0.75f; vThisClientBackColor[2] = 0.75f;
} }
} else { }
else
{
// free-for-all // free-for-all
iDatumCount = 5; iDatumCount = 5;
} }
@ -260,7 +227,8 @@ void CG_ParseScores_ver_15()
iEntryCount = MAX_CLIENTS; iEntryCount = MAX_CLIENTS;
} }
if (cgs.gametype == GT_TOW) { if (cgs.gametype == GT_TOW)
{
cgi.Cvar_Set("tow_allied_obj1", va("%i", (int)atof(cgi.Argv(iCurrentEntry++)))); cgi.Cvar_Set("tow_allied_obj1", va("%i", (int)atof(cgi.Argv(iCurrentEntry++))));
cgi.Cvar_Set("tow_allied_obj2", va("%i", (int)atof(cgi.Argv(iCurrentEntry++)))); cgi.Cvar_Set("tow_allied_obj2", va("%i", (int)atof(cgi.Argv(iCurrentEntry++))));
cgi.Cvar_Set("tow_allied_obj3", va("%i", (int)atof(cgi.Argv(iCurrentEntry++)))); cgi.Cvar_Set("tow_allied_obj3", va("%i", (int)atof(cgi.Argv(iCurrentEntry++))));
@ -273,38 +241,43 @@ void CG_ParseScores_ver_15()
cgi.Cvar_Set("tow_axis_obj5", va("%i", (int)atof(cgi.Argv(iCurrentEntry++)))); cgi.Cvar_Set("tow_axis_obj5", va("%i", (int)atof(cgi.Argv(iCurrentEntry++))));
} }
if (cgs.gametype == GT_LIBERATION) { if (cgs.gametype == GT_LIBERATION)
{
cgi.Cvar_Set("scoreboard_toggle1", va("%i", (int)atof(cgi.Argv(iCurrentEntry++)))); cgi.Cvar_Set("scoreboard_toggle1", va("%i", (int)atof(cgi.Argv(iCurrentEntry++))));
cgi.Cvar_Set("scoreboard_toggle2", va("%i", (int)atof(cgi.Argv(iCurrentEntry++)))); cgi.Cvar_Set("scoreboard_toggle2", va("%i", (int)atof(cgi.Argv(iCurrentEntry++))));
} }
for (i = 0; i < iEntryCount; ++i) { for (i = 0; i < iEntryCount; ++i)
{
bIsHeader = qfalse; bIsHeader = qfalse;
if (cgs.gametype > GT_FFA) { if (cgs.gametype > GT_FFA)
{
iClientNum = atoi(cgi.Argv(iCurrentEntry + iDatumCount * i)); iClientNum = atoi(cgi.Argv(iCurrentEntry + iDatumCount * i));
iClientTeam = atoi(cgi.Argv(1 + iCurrentEntry + iDatumCount * i)); iClientTeam = atoi(cgi.Argv(1 + iCurrentEntry + iDatumCount * i));
if (iClientTeam >= 0) { if (iClientTeam >= 0) {
bIsDead = qfalse; bIsDead = qfalse;
} else { }
else {
bIsDead = qtrue; bIsDead = qtrue;
iClientTeam = -iClientTeam; iClientTeam = -iClientTeam;
} }
if (iClientNum == -1) { if (iClientNum == -1)
{
szString2[0] = 0; szString2[0] = 0;
bIsHeader = qtrue; bIsHeader = qtrue;
switch (iClientTeam) { switch (iClientTeam)
{
case 1: case 1:
Q_strncpyz(szString3, cgi.LV_ConvertString("Spectators"), sizeof(szString3)); strcpy(szString3, cgi.LV_ConvertString("Spectators"));
break; break;
case 2: case 2:
Q_strncpyz(szString3, cgi.LV_ConvertString("Free-For-Allers"), sizeof(szString3)); strcpy(szString3, cgi.LV_ConvertString("Free-For-Allers"));
break; break;
case 3: case 3:
Com_sprintf( sprintf(
szString3, szString3,
sizeof(szString3),
"%s - %d %s", "%s - %d %s",
cgi.LV_ConvertString("Allies"), cgi.LV_ConvertString("Allies"),
atoi(cgi.Argv(2 + iCurrentEntry + iDatumCount * i)), atoi(cgi.Argv(2 + iCurrentEntry + iDatumCount * i)),
@ -313,9 +286,8 @@ void CG_ParseScores_ver_15()
iCurrentEntry++; iCurrentEntry++;
break; break;
case 4: case 4:
Com_sprintf( sprintf(
szString3, szString3,
sizeof(szString3),
"%s - %d %s", "%s - %d %s",
cgi.LV_ConvertString("Axis"), cgi.LV_ConvertString("Axis"),
atoi(cgi.Argv(2 + iCurrentEntry + iDatumCount * i)), atoi(cgi.Argv(2 + iCurrentEntry + iDatumCount * i)),
@ -324,44 +296,58 @@ void CG_ParseScores_ver_15()
iCurrentEntry++; iCurrentEntry++;
break; break;
default: default:
Q_strncpyz(szString3, cgi.LV_ConvertString("No Team"), sizeof(szString3)); strcpy(szString3, cgi.LV_ConvertString("No Team"));
break; break;
} }
} else if (iClientNum == -2) { }
else if (iClientNum == -2)
{
// spectating // spectating
szString2[0] = 0; szString2[0] = 0;
szString3[0] = 0; szString3[0] = 0;
} else { }
Q_strncpyz(szString2, va("%i", iClientNum), sizeof(szString2)); else
Q_strncpyz(szString3, cg.clientinfo[iClientNum].name, sizeof(szString3)); {
strcpy(szString2, va("%i", iClientNum));
strcpy(szString3, cg.clientinfo[iClientNum].name);
} }
Q_strncpyz(szString4, cgi.Argv(2 + iCurrentEntry + iDatumCount * i), sizeof(szString4)); strcpy(szString4, cgi.Argv(2 + iCurrentEntry + iDatumCount * i));
Q_strncpyz(szString5, cgi.Argv(3 + iCurrentEntry + iDatumCount * i), sizeof(szString5)); strcpy(szString5, cgi.Argv(3 + iCurrentEntry + iDatumCount * i));
Q_strncpyz(szString6, cgi.Argv(4 + iCurrentEntry + iDatumCount * i), sizeof(szString6)); strcpy(szString6, cgi.Argv(4 + iCurrentEntry + iDatumCount * i));
Q_strncpyz(szString7, cgi.Argv(5 + iCurrentEntry + iDatumCount * i), sizeof(szString7)); strcpy(szString7, cgi.Argv(5 + iCurrentEntry + iDatumCount * i));
if (cgs.gametype >= GT_TEAM_ROUNDS && iClientNum == -1 if (cgs.gametype >= GT_TEAM_ROUNDS && iClientNum == -1 && (iClientTeam == TEAM_ALLIES || iClientTeam == TEAM_AXIS))
&& (iClientTeam == TEAM_ALLIES || iClientTeam == TEAM_AXIS)) { {
strcat(szString4, va(" %s", cgi.LV_ConvertString("Wins"))); strcat(szString4, va(" %s", cgi.LV_ConvertString("Wins")));
szString5[0] = 0; szString5[0] = 0;
} }
if (iClientNum == cg.snap->ps.clientNum) { if (iClientNum == cg.snap->ps.clientNum)
{
pItemTextColor = vThisClientTextColor; pItemTextColor = vThisClientTextColor;
pItemBackColor = vThisClientBackColor; pItemBackColor = vThisClientBackColor;
} else if (iClientNum == -2) { }
else if (iClientNum == -2)
{
pItemTextColor = vNoTeamTextColor; pItemTextColor = vNoTeamTextColor;
pItemBackColor = vNoTeamBackColor; pItemBackColor = vNoTeamBackColor;
} else if (iClientTeam == TEAM_ALLIES || iClientTeam == TEAM_AXIS) { }
if (iClientTeam == iMatchTeam) { else if (iClientTeam == TEAM_ALLIES || iClientTeam == TEAM_AXIS)
{
if (iClientTeam == iMatchTeam)
{
pItemTextColor = vSameTeamTextColor; pItemTextColor = vSameTeamTextColor;
pItemBackColor = vSameTeamBackColor; pItemBackColor = vSameTeamBackColor;
} else { }
else
{
pItemTextColor = vOtherTeamTextColor; pItemTextColor = vOtherTeamTextColor;
pItemBackColor = vOtherTeamBackColor; pItemBackColor = vOtherTeamBackColor;
} }
} else { }
else
{
pItemTextColor = vNoTeamTextColor; pItemTextColor = vNoTeamTextColor;
pItemBackColor = vNoTeamBackColor; pItemBackColor = vNoTeamBackColor;
} }
@ -369,24 +355,34 @@ void CG_ParseScores_ver_15()
if (bIsDead) { if (bIsDead) {
pItemTextColor = vDeadTextColorDead; pItemTextColor = vDeadTextColorDead;
} }
} else { }
else
{
iClientNum = atoi(cgi.Argv(iCurrentEntry + iDatumCount * i)); iClientNum = atoi(cgi.Argv(iCurrentEntry + iDatumCount * i));
if (iClientNum >= 0) { if (iClientNum >= 0)
Q_strncpyz(szString2, va("%i", iClientNum), sizeof(szString2)); {
Q_strncpyz(szString3, cg.clientinfo[iClientNum].name, sizeof(szString3)); strcpy(szString2, va("%i", iClientNum));
Q_strncpyz(szString4, cgi.Argv(1 + iCurrentEntry + iDatumCount * i), sizeof(szString4)); strcpy(szString3, cg.clientinfo[iClientNum].name);
Q_strncpyz(szString5, cgi.Argv(2 + iCurrentEntry + iDatumCount * i), sizeof(szString5)); strcpy(szString4, cgi.Argv(1 + iCurrentEntry + iDatumCount * i));
Q_strncpyz(szString6, cgi.Argv(3 + iCurrentEntry + iDatumCount * i), sizeof(szString6)); strcpy(szString5, cgi.Argv(2 + iCurrentEntry + iDatumCount * i));
Q_strncpyz(szString7, cgi.Argv(4 + iCurrentEntry + iDatumCount * i), sizeof(szString7)); strcpy(szString6, cgi.Argv(3 + iCurrentEntry + iDatumCount * i));
} else { strcpy(szString7, cgi.Argv(4 + iCurrentEntry + iDatumCount * i));
}
else
{
szString2[0] = 0; szString2[0] = 0;
if (iClientNum == -3) { if (iClientNum == -3)
Q_strncpyz(szString2, cgi.LV_ConvertString("Players"), sizeof(szString2)); {
strcpy(szString2, cgi.LV_ConvertString("Players"));
bIsHeader = qtrue; bIsHeader = qtrue;
} else if (iClientNum == -2) { }
Q_strncpyz(szString2, cgi.LV_ConvertString("Spectators"), sizeof(szString2)); else if (iClientNum == -2)
{
strcpy(szString2, cgi.LV_ConvertString("Spectators"));
bIsHeader = qtrue; bIsHeader = qtrue;
} else { }
else
{
// unknown // unknown
szString3[0] = 0; szString3[0] = 0;
} }
@ -396,10 +392,13 @@ void CG_ParseScores_ver_15()
szString7[0] = 0; szString7[0] = 0;
} }
if (iClientNum == cg.snap->ps.clientNum) { if (iClientNum == cg.snap->ps.clientNum)
{
pItemTextColor = vThisClientTextColor; pItemTextColor = vThisClientTextColor;
pItemBackColor = vThisClientBackColor; pItemBackColor = vThisClientBackColor;
} else { }
else
{
pItemTextColor = vNoTeamTextColor; pItemTextColor = vNoTeamTextColor;
pItemBackColor = vNoTeamBackColor; pItemBackColor = vNoTeamBackColor;
} }
@ -424,7 +423,51 @@ void CG_ParseScores_ver_15()
cgi.UI_DeleteScoreBoardItems(iEntryCount); cgi.UI_DeleteScoreBoardItems(iEntryCount);
} }
void CG_ParseScores_ver_6() #else
const char* CG_GetColumnName(int iColumnNum, int* iColumnWidth)
{
int iReturnWidth;
const char* pszReturnString;
switch (iColumnNum) {
case 0:
iReturnWidth = 128;
pszReturnString = "Name";
break;
case 1:
iReturnWidth = 64;
pszReturnString = "Kills";
break;
case 2:
iReturnWidth = 64;
pszReturnString = "Deaths";
if (cgs.gametype > GT_TEAM) {
pszReturnString = "Total";
}
break;
case 3:
iReturnWidth = 64;
pszReturnString = "Time";
break;
case 4:
iReturnWidth = 64;
pszReturnString = "Ping";
break;
default:
iReturnWidth = 0;
pszReturnString = 0;
break;
}
if (iColumnWidth) {
*iColumnWidth = iReturnWidth;
}
return pszReturnString;
}
void CG_ParseScores()
{ {
int i; int i;
int iEntryCount; int iEntryCount;
@ -485,11 +528,14 @@ void CG_ParseScores_ver_6()
vThisClientTextColor[2] = 0.0f; vThisClientTextColor[2] = 0.0f;
vThisClientTextColor[3] = 1.0f; vThisClientTextColor[3] = 1.0f;
if (cgs.gametype > GT_FFA) { if (cgs.gametype > GT_FFA)
{
vThisClientBackColor[0] = 0.5f; vThisClientBackColor[0] = 0.5f;
vThisClientBackColor[1] = 0.75f; vThisClientBackColor[1] = 0.75f;
vThisClientBackColor[2] = 0.5f; vThisClientBackColor[2] = 0.5f;
} else { }
else
{
vThisClientBackColor[0] = 0.75f; vThisClientBackColor[0] = 0.75f;
vThisClientBackColor[1] = 0.75f; vThisClientBackColor[1] = 0.75f;
vThisClientBackColor[2] = 0.75f; vThisClientBackColor[2] = 0.75f;
@ -498,10 +544,12 @@ void CG_ParseScores_ver_6()
vThisClientBackColor[3] = 0.8f; vThisClientBackColor[3] = 0.8f;
iCurrentEntry = 1; iCurrentEntry = 1;
if (cgs.gametype > GT_FFA) { if (cgs.gametype > GT_FFA)
{
iDatumCount = 6; iDatumCount = 6;
iMatchTeam = cg.snap->ps.stats[STAT_TEAM]; iMatchTeam = cg.snap->ps.stats[STAT_TEAM];
if (iMatchTeam != TEAM_ALLIES && iMatchTeam != TEAM_AXIS) { if (iMatchTeam != TEAM_ALLIES && iMatchTeam != TEAM_AXIS)
{
iMatchTeam = TEAM_ALLIES; iMatchTeam = TEAM_ALLIES;
vThisClientTextColor[0] = 0.0f; vThisClientTextColor[0] = 0.0f;
vThisClientTextColor[1] = 0.0f; vThisClientTextColor[1] = 0.0f;
@ -510,7 +558,9 @@ void CG_ParseScores_ver_6()
vThisClientBackColor[1] = 0.75f; vThisClientBackColor[1] = 0.75f;
vThisClientBackColor[2] = 0.75f; vThisClientBackColor[2] = 0.75f;
} }
} else { }
else
{
// free-for-all // free-for-all
iDatumCount = 5; iDatumCount = 5;
} }
@ -520,65 +570,84 @@ void CG_ParseScores_ver_6()
iEntryCount = MAX_CLIENTS; iEntryCount = MAX_CLIENTS;
} }
for (i = 0; i < iEntryCount; ++i) { for (i = 0; i < iEntryCount; ++i)
{
bIsHeader = qfalse; bIsHeader = qfalse;
if (cgs.gametype > GT_FFA) { if (cgs.gametype > GT_FFA)
{
iClientNum = atoi(cgi.Argv(iCurrentEntry + iDatumCount * i)); iClientNum = atoi(cgi.Argv(iCurrentEntry + iDatumCount * i));
iClientTeam = atoi(cgi.Argv(1 + iCurrentEntry + iDatumCount * i)); iClientTeam = atoi(cgi.Argv(1 + iCurrentEntry + iDatumCount * i));
if (iClientTeam >= 0) { if (iClientTeam >= 0) {
bIsDead = qfalse; bIsDead = qfalse;
} else { }
else {
bIsDead = qtrue; bIsDead = qtrue;
iClientTeam = -iClientTeam; iClientTeam = -iClientTeam;
} }
if (iClientNum == -1) { if (iClientNum == -1)
{
bIsHeader = qtrue; bIsHeader = qtrue;
switch (iClientTeam) { switch (iClientTeam)
{
case 1: case 1:
Q_strncpyz(szString2, cgi.LV_ConvertString("Spectators"), sizeof(szString2)); strcpy(szString2, cgi.LV_ConvertString("Spectators"));
break; break;
case 2: case 2:
Q_strncpyz(szString2, cgi.LV_ConvertString("Free-For-Allers"), sizeof(szString2)); strcpy(szString2, cgi.LV_ConvertString("Free-For-Allers"));
break; break;
case 3: case 3:
Q_strncpyz(szString2, cgi.LV_ConvertString("Allies"), sizeof(szString2)); strcpy(szString2, cgi.LV_ConvertString("Allies"));
break; break;
case 4: case 4:
Q_strncpyz(szString2, cgi.LV_ConvertString("Axis"), sizeof(szString2)); strcpy(szString2, cgi.LV_ConvertString("Axis"));
break; break;
default: default:
Q_strncpyz(szString2, cgi.LV_ConvertString("No Team"), sizeof(szString2)); strcpy(szString2, cgi.LV_ConvertString("No Team"));
break; break;
} }
} else if (iClientNum == -2) { }
else if (iClientNum == -2)
{
// spectating // spectating
szString2[0] = 0; szString2[0] = 0;
} else { }
Q_strncpyz(szString2, cg.clientinfo[iClientNum].name, sizeof(szString2)); else
{
strcpy(szString2, cg.clientinfo[iClientNum].name);
} }
Q_strncpyz(szString3, cgi.Argv(2 + iCurrentEntry + iDatumCount * i), sizeof(szString3)); strcpy(szString3, cgi.Argv(2 + iCurrentEntry + iDatumCount * i));
Q_strncpyz(szString4, cgi.Argv(3 + iCurrentEntry + iDatumCount * i), sizeof(szString4)); strcpy(szString4, cgi.Argv(3 + iCurrentEntry + iDatumCount * i));
Q_strncpyz(szString5, cgi.Argv(4 + iCurrentEntry + iDatumCount * i), sizeof(szString5)); strcpy(szString5, cgi.Argv(4 + iCurrentEntry + iDatumCount * i));
Q_strncpyz(szString6, cgi.Argv(5 + iCurrentEntry + iDatumCount * i), sizeof(szString6)); strcpy(szString6, cgi.Argv(5 + iCurrentEntry + iDatumCount * i));
if (iClientNum == cg.snap->ps.clientNum) { if (iClientNum == cg.snap->ps.clientNum)
{
pItemTextColor = vThisClientTextColor; pItemTextColor = vThisClientTextColor;
pItemBackColor = vThisClientBackColor; pItemBackColor = vThisClientBackColor;
} else if (iClientNum == -2) { }
else if (iClientNum == -2)
{
pItemTextColor = vNoTeamTextColor; pItemTextColor = vNoTeamTextColor;
pItemBackColor = vNoTeamBackColor; pItemBackColor = vNoTeamBackColor;
} else if (iClientTeam == TEAM_ALLIES || iClientTeam == TEAM_AXIS) { }
if (iClientTeam == iMatchTeam) { else if (iClientTeam == TEAM_ALLIES || iClientTeam == TEAM_AXIS)
{
if (iClientTeam == iMatchTeam)
{
pItemTextColor = vSameTeamTextColor; pItemTextColor = vSameTeamTextColor;
pItemBackColor = vSameTeamBackColor; pItemBackColor = vSameTeamBackColor;
} else { }
else
{
pItemTextColor = vOtherTeamTextColor; pItemTextColor = vOtherTeamTextColor;
pItemBackColor = vOtherTeamBackColor; pItemBackColor = vOtherTeamBackColor;
} }
} else { }
else
{
pItemTextColor = vNoTeamTextColor; pItemTextColor = vNoTeamTextColor;
pItemBackColor = vNoTeamBackColor; pItemBackColor = vNoTeamBackColor;
} }
@ -586,22 +655,32 @@ void CG_ParseScores_ver_6()
if (bIsDead) { if (bIsDead) {
pItemTextColor = vDeadTextColorDead; pItemTextColor = vDeadTextColorDead;
} }
} else { }
else
{
iClientNum = atoi(cgi.Argv(iCurrentEntry + iDatumCount * i)); iClientNum = atoi(cgi.Argv(iCurrentEntry + iDatumCount * i));
if (iClientNum >= 0) { if (iClientNum >= 0)
Q_strncpyz(szString2, cg.clientinfo[iClientNum].name, sizeof(szString2)); {
Q_strncpyz(szString3, cgi.Argv(1 + iCurrentEntry + iDatumCount * i), sizeof(szString3)); strcpy(szString2, cg.clientinfo[iClientNum].name);
Q_strncpyz(szString4, cgi.Argv(2 + iCurrentEntry + iDatumCount * i), sizeof(szString4)); strcpy(szString3, cgi.Argv(1 + iCurrentEntry + iDatumCount * i));
Q_strncpyz(szString5, cgi.Argv(3 + iCurrentEntry + iDatumCount * i), sizeof(szString5)); strcpy(szString4, cgi.Argv(2 + iCurrentEntry + iDatumCount * i));
Q_strncpyz(szString6, cgi.Argv(4 + iCurrentEntry + iDatumCount * i), sizeof(szString6)); strcpy(szString5, cgi.Argv(3 + iCurrentEntry + iDatumCount * i));
} else { strcpy(szString6, cgi.Argv(4 + iCurrentEntry + iDatumCount * i));
if (iClientNum == -3) { }
Q_strncpyz(szString2, cgi.LV_ConvertString("Players"), sizeof(szString2)); else
{
if (iClientNum == -3)
{
strcpy(szString2, cgi.LV_ConvertString("Players"));
bIsHeader = qtrue; bIsHeader = qtrue;
} else if (iClientNum == -2) { }
Q_strncpyz(szString2, cgi.LV_ConvertString("Spectators"), sizeof(szString2)); else if (iClientNum == -2)
{
strcpy(szString2, cgi.LV_ConvertString("Spectators"));
bIsHeader = qtrue; bIsHeader = qtrue;
} else { }
else
{
// unknown // unknown
szString2[0] = 0; szString2[0] = 0;
} }
@ -611,10 +690,13 @@ void CG_ParseScores_ver_6()
szString6[0] = 0; szString6[0] = 0;
} }
if (iClientNum == cg.snap->ps.clientNum) { if (iClientNum == cg.snap->ps.clientNum)
{
pItemTextColor = vThisClientTextColor; pItemTextColor = vThisClientTextColor;
pItemBackColor = vThisClientBackColor; pItemBackColor = vThisClientBackColor;
} else { }
else
{
pItemTextColor = vNoTeamTextColor; pItemTextColor = vNoTeamTextColor;
pItemBackColor = vNoTeamBackColor; pItemBackColor = vNoTeamBackColor;
} }
@ -638,26 +720,4 @@ void CG_ParseScores_ver_6()
cgi.UI_DeleteScoreBoardItems(iEntryCount); cgi.UI_DeleteScoreBoardItems(iEntryCount);
} }
#endif
void CG_ParseScores()
{
if (cg_protocol >= PROTOCOL_MOHTA_MIN) {
CG_ParseScores_ver_15();
} else {
CG_ParseScores_ver_6();
}
}
void CG_InitScoresAPI(clientGameExport_t *cge)
{
cge->CG_GetScoreBoardColor = CG_GetScoreBoardColor;
cge->CG_GetScoreBoardFontColor = CG_GetScoreBoardFontColor;
cge->CG_GetScoreBoardPosition = CG_GetScoreBoardPosition;
cge->CG_GetScoreBoardDrawHeader = CG_GetScoreBoardDrawHeader;
if (cg_protocol >= PROTOCOL_MOHTA_MIN) {
cge->CG_GetColumnName = &CG_GetColumnName_ver_15;
} else {
cge->CG_GetColumnName = &CG_GetColumnName_ver_6;
}
}

View file

@ -1,7 +1,6 @@
/* /*
=========================================================================== ===========================================================================
Copyright (C) 2008-2024 the OpenMoHAA team Copyright (C) 2023 the OpenMoHAA team
Copyright (C) 1999-2005 Id Software, Inc.
This file is part of OpenMoHAA source code. This file is part of OpenMoHAA source code.
@ -25,30 +24,12 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
// cg_servercmds.c -- text commands sent by the server // cg_servercmds.c -- text commands sent by the server
#include "cg_local.h" #include "cg_local.h"
#include "../fgame/bg_voteoptions.h"
#include "cg_servercmds_filter.h"
/* static const char* IsWeaponAllowed(int dmFlags, int flags) {
================
IsWeaponAllowed
Returns true if the weapon is allowed
================
*/
static const char *IsWeaponAllowed(int dmFlags, int flags)
{
return (dmFlags & flags) ? "0" : "1"; return (dmFlags & flags) ? "0" : "1";
} }
/* static qboolean QueryLandminesAllowed2(const char* mapname, int dmflags) {
================
QueryLandminesAllowed2
Returns true if landmines is allowed by the map or by a dm flag
================
*/
static qboolean QueryLandminesAllowed2(const char *mapname, int dmflags)
{
if (dmflags & DF_WEAPON_NO_LANDMINE) { if (dmflags & DF_WEAPON_NO_LANDMINE) {
return qfalse; return qfalse;
} }
@ -57,60 +38,42 @@ static qboolean QueryLandminesAllowed2(const char *mapname, int dmflags)
return qtrue; return qtrue;
} }
if (!Q_stricmpn(mapname, "obj/obj_", 8u)) { if (!Q_stricmpn(mapname, "obj/obj_", 8u))
return qfalse; return qfalse;
} if (!Q_stricmpn(mapname, "dm/mohdm", 8u))
if (!Q_stricmpn(mapname, "dm/mohdm", 8u)) {
return qfalse; return qfalse;
} if (!Q_stricmp(mapname, "DM/MP_Bahnhof_DM"))
if (!Q_stricmp(mapname, "DM/MP_Bahnhof_DM")) {
return qfalse; return qfalse;
} if (!Q_stricmp(mapname, "obj/MP_Ardennes_TOW"))
if (!Q_stricmp(mapname, "obj/MP_Ardennes_TOW")) {
return qfalse; return qfalse;
} if (!Q_stricmp(mapname, "DM/MP_Bazaar_DM"))
if (!Q_stricmp(mapname, "DM/MP_Bazaar_DM")) {
return qfalse; return qfalse;
} if (!Q_stricmp(mapname, "obj/MP_Berlin_TOW"))
if (!Q_stricmp(mapname, "obj/MP_Berlin_TOW")) {
return qfalse; return qfalse;
} if (!Q_stricmp(mapname, "DM/MP_Brest_DM"))
if (!Q_stricmp(mapname, "DM/MP_Brest_DM")) {
return qfalse; return qfalse;
} if (!Q_stricmp(mapname, "obj/MP_Druckkammern_TOW"))
if (!Q_stricmp(mapname, "obj/MP_Druckkammern_TOW")) {
return qfalse; return qfalse;
} if (!Q_stricmp(mapname, "DM/MP_Gewitter_DM"))
if (!Q_stricmp(mapname, "DM/MP_Gewitter_DM")) {
return qfalse; return qfalse;
} if (!Q_stricmp(mapname, "obj/MP_Flughafen_TOW"))
if (!Q_stricmp(mapname, "obj/MP_Flughafen_TOW")) {
return qfalse; return qfalse;
} if (!Q_stricmp(mapname, "DM/MP_Holland_DM"))
if (!Q_stricmp(mapname, "DM/MP_Holland_DM")) {
return qfalse; return qfalse;
} if (!Q_stricmp(mapname, "DM/MP_Malta_DM"))
if (!Q_stricmp(mapname, "DM/MP_Malta_DM")) {
return qfalse; return qfalse;
} if (!Q_stricmp(mapname, "DM/MP_Stadt_DM"))
if (!Q_stricmp(mapname, "DM/MP_Stadt_DM")) {
return qfalse; return qfalse;
} if (!Q_stricmp(mapname, "DM/MP_Unterseite_DM"))
if (!Q_stricmp(mapname, "DM/MP_Unterseite_DM")) {
return qfalse; return qfalse;
} if (!Q_stricmp(mapname, "DM/MP_Verschneit_DM"))
if (!Q_stricmp(mapname, "DM/MP_Verschneit_DM")) {
return qfalse; return qfalse;
} if (!Q_stricmp(mapname, "lib/mp_ship_lib"))
if (!Q_stricmp(mapname, "lib/mp_ship_lib")) {
return qfalse; return qfalse;
} if (!Q_stricmp(mapname, "DM/MP_Verschneit_DM"))
if (!Q_stricmp(mapname, "DM/MP_Verschneit_DM")) {
return qfalse; return qfalse;
} if (!Q_stricmp(mapname, "lib/mp_ship_lib"))
if (!Q_stricmp(mapname, "lib/mp_ship_lib")) {
return qfalse; return qfalse;
}
return qtrue; return qtrue;
} }
@ -129,7 +92,6 @@ void CG_ParseServerinfo(void)
char map[MAX_QPATH]; char map[MAX_QPATH];
char* spawnpos; char* spawnpos;
const char* version; const char* version;
const char *mapChecksumStr;
info = CG_ConfigString(CS_SERVERINFO); info = CG_ConfigString(CS_SERVERINFO);
cgs.gametype = atoi(Info_ValueForKey(info, "g_gametype")); cgs.gametype = atoi(Info_ValueForKey(info, "g_gametype"));
@ -150,27 +112,15 @@ void CG_ParseServerinfo(void)
cgi.Cvar_Set("cg_fraglimit", Info_ValueForKey(info, "fraglimit")); cgi.Cvar_Set("cg_fraglimit", Info_ValueForKey(info, "fraglimit"));
cgi.Cvar_Set("cg_timelimit", Info_ValueForKey(info, "timelimit")); cgi.Cvar_Set("cg_timelimit", Info_ValueForKey(info, "timelimit"));
cgi.Cvar_Set("cg_maxclients", Info_ValueForKey(info, "sv_gametype")); cgi.Cvar_Set("cg_maxclients", Info_ValueForKey(info, "sv_gametype"));
cgi.Cvar_Set("cg_allowvote", Info_ValueForKey(info, "g_allowvote"));
cgi.Cvar_Set("cg_obj_alliedtext1", Info_ValueForKey(info, "g_obj_alliedtext1")); cgi.Cvar_Set("cg_obj_alliedtext1", Info_ValueForKey(info, "g_obj_alliedtext1"));
cgi.Cvar_Set("cg_obj_alliedtext2", Info_ValueForKey(info, "g_obj_alliedtext2")); cgi.Cvar_Set("cg_obj_alliedtext2", Info_ValueForKey(info, "g_obj_alliedtext2"));
cgi.Cvar_Set("cg_obj_alliedtext3", Info_ValueForKey(info, "g_obj_alliedtext3")); cgi.Cvar_Set("cg_obj_alliedtext3", Info_ValueForKey(info, "g_obj_alliedtext3"));
cgi.Cvar_Set("cg_obj_alliedtext4", Info_ValueForKey(info, "g_obj_alliedtext4")); cgi.Cvar_Set("cg_obj_axistext1", Info_ValueForKey(info, "cg_obj_axistext1"));
cgi.Cvar_Set("cg_obj_alliedtext5", Info_ValueForKey(info, "g_obj_alliedtext5")); cgi.Cvar_Set("cg_obj_axistext2", Info_ValueForKey(info, "cg_obj_axistext2"));
cgi.Cvar_Set("cg_obj_axistext1", Info_ValueForKey(info, "g_obj_axistext1")); cgi.Cvar_Set("cg_obj_axistext3", Info_ValueForKey(info, "cg_obj_axistext3"));
cgi.Cvar_Set("cg_obj_axistext2", Info_ValueForKey(info, "g_obj_axistext2"));
cgi.Cvar_Set("cg_obj_axistext3", Info_ValueForKey(info, "g_obj_axistext3"));
cgi.Cvar_Set("cg_obj_axistext4", Info_ValueForKey(info, "g_obj_axistext4"));
cgi.Cvar_Set("cg_obj_axistext5", Info_ValueForKey(info, "g_obj_axistext5"));
cgi.Cvar_Set("cg_scoreboardpic", Info_ValueForKey(info, "g_scoreboardpic")); cgi.Cvar_Set("cg_scoreboardpic", Info_ValueForKey(info, "g_scoreboardpic"));
cgi.Cvar_Set("cg_scoreboardpicover", Info_ValueForKey(info, "g_scoreboardpicover")); cgi.Cvar_Set("cg_scoreboardpicover", Info_ValueForKey(info, "g_scoreboardpicover"));
mapChecksumStr = Info_ValueForKey(info, "sv_mapChecksum"); cgs.mapChecksum = atoi(Info_ValueForKey(info, "sv_mapChecksum"));
if (mapChecksumStr && mapChecksumStr[0]) {
cgs.mapChecksum = atoi(mapChecksumStr);
cgs.useMapChecksum = qtrue;
} else {
cgs.mapChecksum = 0;
cgs.useMapChecksum = qfalse;
}
mapname = Info_ValueForKey(info, "mapname"); mapname = Info_ValueForKey(info, "mapname");
@ -186,26 +136,28 @@ void CG_ParseServerinfo(void)
if (spawnpos) { if (spawnpos) {
Q_strncpyz(map, mapname, spawnpos - mapname + 1); Q_strncpyz(map, mapname, spawnpos - mapname + 1);
} else { } else {
Q_strncpyz(map, mapname, sizeof(map)); strcpy(map, mapname);
} }
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)
{
cgi.Cmd_Execute(EXEC_NOW, "ui_addhud hud_timelimit\n"); cgi.Cmd_Execute(EXEC_NOW, "ui_addhud hud_timelimit\n");
if (cgs.fraglimit) { if (cgs.fraglimit)
{
cgi.Cmd_Execute(EXEC_NOW, "ui_addhud hud_fraglimit\n"); cgi.Cmd_Execute(EXEC_NOW, "ui_addhud hud_fraglimit\n");
cgi.Cmd_Execute(EXEC_NOW, "ui_removehud hud_score\n"); cgi.Cmd_Execute(EXEC_NOW, "ui_removehud hud_score\n");
} else { }
else
{
cgi.Cmd_Execute(EXEC_NOW, "ui_addhud hud_score\n"); cgi.Cmd_Execute(EXEC_NOW, "ui_addhud hud_score\n");
cgi.Cmd_Execute(EXEC_NOW, "ui_removehud hud_fraglimit\n"); cgi.Cmd_Execute(EXEC_NOW, "ui_removehud hud_fraglimit\n");
} }
} else { }
else
{
cgi.Cmd_Execute(EXEC_NOW, "ui_removehud hud_timelimit\n"); cgi.Cmd_Execute(EXEC_NOW, "ui_removehud hud_timelimit\n");
cgi.Cmd_Execute(EXEC_NOW, "ui_removehud hud_fraglimit\n"); cgi.Cmd_Execute(EXEC_NOW, "ui_removehud hud_fraglimit\n");
cgi.Cmd_Execute(EXEC_NOW, "ui_removehud hud_score\n"); cgi.Cmd_Execute(EXEC_NOW, "ui_removehud hud_score\n");
@ -218,13 +170,17 @@ CG_ConfigStringModified
================ ================
*/ */
static void CG_ConfigStringModified(int num, qboolean modelOnly) static void CG_ConfigStringModified(void)
{ {
int num;
num = atoi(cgi.Argv(1));
// get the gamestate from the client system, which will have the // get the gamestate from the client system, which will have the
// new configstring already integrated // new configstring already integrated
cgi.GetGameState(&cgs.gameState); cgi.GetGameState(&cgs.gameState);
CG_ProcessConfigString(num, modelOnly); CG_ProcessConfigString(num);
} }
/* /*
@ -263,29 +219,32 @@ CG_Stopwatch_f
================ ================
*/ */
#if TARGET_GAME_PROTOCOL >= 15
static void CG_Stopwatch_f() static void CG_Stopwatch_f()
{ {
if (cgi.Argc() < 3) { if (cgi.Argc() < 3) {
Com_Error(ERR_DROP, "stopwatch didn't have 2 parameters"); Com_Error(ERR_DROP, "stopwatch didn't have 2 parameters");
} }
if (cg_protocol >= PROTOCOL_MOHTA_MIN) {
cgi.stopWatch->iStartTime = atoi(cgi.Argv(1)); cgi.stopWatch->iStartTime = atoi(cgi.Argv(1));
if (cgi.Argc() > 3) {
cgi.stopWatch->eType = atoi(cgi.Argv(3));
} else {
// Normal stop watch
cgi.stopWatch->eType = SWT_NORMAL;
}
} else {
// The base game has it wrong
cgi.stopWatch->iStartTime = 1000 * atoi(cgi.Argv(1));
}
cgi.stopWatch->iEndTime = cgi.stopWatch->iStartTime + 1000 * atoi(cgi.Argv(2)); cgi.stopWatch->iEndTime = cgi.stopWatch->iStartTime + 1000 * atoi(cgi.Argv(2));
} }
#else
static void CG_Stopwatch_f()
{
if (cgi.Argc() < 3) {
Com_Error(ERR_DROP, "stopwatch didn't have 2 parameters");
}
cgi.stopWatch->iStartTime = 1000 * atoi(cgi.Argv(1));
cgi.stopWatch->iEndTime = cgi.stopWatch->iStartTime + 1000 * atoi(cgi.Argv(2));
}
#endif
/* /*
================ ================
CG_ServerLag_f CG_ServerLag_f
@ -305,7 +264,7 @@ The string has been tokenized and can be retrieved with
Cmd_Argc() / Cmd_Argv() Cmd_Argc() / Cmd_Argv()
================= =================
*/ */
static void CG_ServerCommand(qboolean modelOnly) static void CG_ServerCommand(void)
{ {
const char* cmd; const char* cmd;
@ -317,11 +276,7 @@ static void CG_ServerCommand(qboolean modelOnly)
} }
if (!strcmp(cmd, "cs")) { if (!strcmp(cmd, "cs")) {
CG_ConfigStringModified(cgi.getConfigStringIdNormalized(atoi(cgi.Argv(1))), modelOnly); CG_ConfigStringModified();
return;
}
if (modelOnly) {
return; return;
} }
@ -331,8 +286,9 @@ static void CG_ServerCommand(qboolean modelOnly)
CG_HudPrint_f(); CG_HudPrint_f();
} }
return; return;
} else if (!strcmp(cmd, "printdeathmsg")) { }
const char *s1, *s2, *attackerName, *victimName, *type; else if (!strcmp(cmd, "printdeathmsg")) {
const char* s1, * s2, * s3, * s4, * s5;
const char* result1, * result2; const char* result1, * result2;
int hudColor; int hudColor;
@ -340,47 +296,44 @@ static void CG_ServerCommand(qboolean modelOnly)
result2 = NULL; result2 = NULL;
s1 = cgi.Argv(1); s1 = cgi.Argv(1);
s2 = cgi.Argv(2); s2 = cgi.Argv(2);
attackerName = cgi.Argv(3); s3 = cgi.Argv(3);
victimName = cgi.Argv(4); s4 = cgi.Argv(4);
type = cgi.Argv(5); s5 = cgi.Argv(5);
if (*type == tolower(*type)) { if (*s5 == tolower(*s5)) {
hudColor = 4; hudColor = 4;
} else { } else {
hudColor = 5; hudColor = 5;
} }
if (*s1 != 'x') { if (*s1 != 'x')
result1 = cgi.LV_ConvertString(s1); result1 = cgi.LV_ConvertString(s1);
} if (*s2 != 'x')
if (*s2 != 'x') {
result2 = cgi.LV_ConvertString(s2); result2 = cgi.LV_ConvertString(s2);
if (tolower(*s5) == 's')
{
cgi.Printf("%c%s %s\n", hudColor, s4, result1);
} }
if (tolower(*type) == 's') { else if (tolower(*s5) == 'p')
cgi.Printf("%c%s %s\n", hudColor, victimName, result1); {
} else if (tolower(*type) == 'p') { if (*s2 == 'x')
if (*s2 == 'x') { cgi.Printf("%c%s %s %s\n", hudColor, s4, result1, s3);
cgi.Printf("%c%s %s %s\n", hudColor, victimName, result1, attackerName); else
} else { cgi.Printf("%c%s %s %s%s\n", hudColor, s4, result1, s3, result2);
cgi.Printf("%c%s %s %s%s\n", hudColor, victimName, result1, attackerName, result2);
} }
} else if (tolower(*type) == 'w') { else if (tolower(*s5) == 'w')
cgi.Printf("%c%s %s\n", hudColor, victimName, result1); {
} else { cgi.Printf("%c%s %s\n", hudColor, s4, result1);
}
else
{
cgi.Printf("%s", cgi.Argv(1)); cgi.Printf("%s", cgi.Argv(1));
} }
return; return;
} }
if (!strcmp(cmd, "stufftext")) { if (!strcmp(cmd, "stufftext")) {
char *cmd = cgi.Argv(1); cgi.Cmd_Stuff(cgi.Argv(1));
if (CG_IsStatementFiltered(cmd)) {
// Added in OPM
// Don't execute filtered commands
return;
}
cgi.Cmd_Stuff(cmd);
cgi.Cmd_Stuff("\n"); cgi.Cmd_Stuff("\n");
return; return;
} }
@ -405,28 +358,6 @@ static void CG_ServerCommand(qboolean modelOnly)
return; return;
} }
if (!strcmp(cmd, "voteresult")) {
cmd = cgi.Argv(1);
if (*cmd) {
strcmp(cmd, "passed");
}
}
if (!strcmp(cmd, "vo0")) {
CG_VoteOptions_StartReadFromServer(cgi.Argv(1));
return;
}
if (!strcmp(cmd, "vo1")) {
CG_VoteOptions_ContinueReadFromServer(cgi.Argv(1));
return;
}
if (!strcmp(cmd, "vo2")) {
CG_VoteOptions_FinishReadFromServer(cgi.Argv(1));
return;
}
cgi.Printf("Unknown client game command: %s\n", cmd); cgi.Printf("Unknown client game command: %s\n", cmd);
} }
@ -440,20 +371,9 @@ with this this snapshot.
*/ */
void CG_ExecuteNewServerCommands(int latestSequence, qboolean differentServer) void CG_ExecuteNewServerCommands(int latestSequence, qboolean differentServer)
{ {
int lastServerCommandSequence;
lastServerCommandSequence = cgs.serverCommandSequence;
while (cgs.serverCommandSequence < latestSequence) { while (cgs.serverCommandSequence < latestSequence) {
if (cgi.GetServerCommand(++cgs.serverCommandSequence, differentServer)) { if (cgi.GetServerCommand(++cgs.serverCommandSequence, differentServer)) {
CG_ServerCommand(qtrue); CG_ServerCommand();
}
}
cgs.serverCommandSequence = lastServerCommandSequence;
while (cgs.serverCommandSequence < latestSequence) {
if (cgi.GetServerCommand(++cgs.serverCommandSequence, differentServer)) {
CG_ServerCommand(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

@ -23,12 +23,8 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
// DESCRIPTION: // DESCRIPTION:
// things that happen on snapshot transition, not necessarily every // things that happen on snapshot transition, not necessarily every
// single frame // single frame
//
// ADDITIONS:
// - CG_TransitionSnapshot() footer: set ps.walking to true if the ps has a ground entity
#include "cg_local.h" #include "cg_local.h"
#include "cg_radar.h"
#include "tiki.h" #include "tiki.h"
/* /*
@ -73,10 +69,10 @@ static void CG_ResetEntity(centity_t *cent)
CG_RemoveClientEntity(cent->currentState.number, tiki, cent); CG_RemoveClientEntity(cent->currentState.number, tiki, cent);
// reset the animation for the entities // reset the animation for the entities
if (tiki) { if (tiki && tiki->a->bIsCharacter) {
for (i = 0; i < MAX_FRAMEINFOS; i++) { for (i = 0; i < MAX_FRAMEINFOS; i++) {
cent->animLast[i] = -1; cent->animLast[i] = cent->currentState.frameInfo[i].index;
cent->animLastTimes[i] = -1; cent->animLastTimes[i] = cent->currentState.frameInfo[i].time;
if (cent->currentState.frameInfo[i].weight) { if (cent->currentState.frameInfo[i].weight) {
cent->animLastWeight |= 1 << i; cent->animLastWeight |= 1 << i;
} else { } else {
@ -88,7 +84,6 @@ static void CG_ResetEntity(centity_t *cent)
// clear all the last animations // clear all the last animations
for (i = 0; i < MAX_FRAMEINFOS; i++) { for (i = 0; i < MAX_FRAMEINFOS; i++) {
cent->animLast[i] = -1; cent->animLast[i] = -1;
cent->animLastTimes[i] = 0.0;
} }
cent->animLastWeight = 0; cent->animLastWeight = 0;
@ -163,12 +158,11 @@ void CG_SetInitialSnapshot(snapshot_t *snap)
CG_ResetEntity(cent); CG_ResetEntity(cent);
} }
cgi.MUSIC_UpdateMood(snap->ps.current_music_mood, snap->ps.fallback_music_mood); cgi.MUSIC_UpdateMood(snap->ps.current_music_mood,
cgi.MUSIC_UpdateVolume(snap->ps.music_volume, snap->ps.music_volume_fade_time); snap->ps.fallback_music_mood);
cgi.MUSIC_UpdateVolume(snap->ps.music_volume,
snap->ps.music_volume_fade_time);
cgi.S_SetReverb(snap->ps.reverb_type, snap->ps.reverb_level); cgi.S_SetReverb(snap->ps.reverb_type, snap->ps.reverb_level);
CG_InitRadar();
cgi.CL_RestoreSavedCgameState();
} }
/* /*
@ -211,9 +205,6 @@ static void CG_TransitionSnapshot(qboolean differentServer)
cent->teleported = qfalse; cent->teleported = qfalse;
} }
CG_TransitionEntity(cent); CG_TransitionEntity(cent);
// remember time of snapshot this entity was last updated in
cent->snapShotTime = cg.snap->serverTime;
} }
for (i = 0; i < cg.snap->number_of_sounds; i++) { for (i = 0; i < cg.snap->number_of_sounds; i++) {
@ -236,30 +227,24 @@ static void CG_TransitionSnapshot(qboolean differentServer)
cg.thisFrameTeleport = qtrue; cg.thisFrameTeleport = qtrue;
} }
if ((ops->music_volume != ps->music_volume) || (ops->music_volume_fade_time != ps->music_volume_fade_time)) { if ((ops->music_volume != ps->music_volume) ||
cgi.MUSIC_UpdateVolume(ps->music_volume, ps->music_volume_fade_time); (ops->music_volume_fade_time != ps->music_volume_fade_time)) {
cgi.MUSIC_UpdateVolume(ps->music_volume,
ps->music_volume_fade_time);
} }
if ((ops->reverb_type != ps->reverb_type) || (ops->reverb_level != ps->reverb_level)) { if ((ops->reverb_type != ps->reverb_type) ||
(ops->reverb_level != ps->reverb_level)) {
cgi.S_SetReverb(ps->reverb_type, ps->reverb_level); cgi.S_SetReverb(ps->reverb_type, ps->reverb_level);
} }
// if we are not doing client side movement prediction for any // if we are not doing client side movement prediction for any
// reason, then the client events and view changes will be issued now // reason, then the client events and view changes will be issued now
if (cg.demoPlayback || (cg.snap->ps.pm_flags & PMF_NO_PREDICTION) || cg_nopredict->integer if (cg.demoPlayback || (cg.snap->ps.pm_flags & PMF_NO_PREDICTION) ||
|| cg_synchronousClients->integer) { cg_nopredict->integer || cg_synchronousClients->integer) {
CG_TransitionPlayerState(ps, ops); CG_TransitionPlayerState(ps, ops);
} }
} }
if (differentServer) {
cgi.CL_RestoreSavedCgameState();
} else {
cgi.CL_ClearSavedCgameState();
}
// this allows the view model to still look normal when the player is on ground
cg.snap->ps.walking = cg.snap->ps.groundEntityNum != ENTITYNUM_NONE;
} }
/* /*
@ -288,8 +273,10 @@ static void CG_SetNextSnap(snapshot_t *snap)
// if this frame is a teleport, or the entity wasn't in the // if this frame is a teleport, or the entity wasn't in the
// previous frame, don't interpolate // previous frame, don't interpolate
if (!cent->currentValid || ((cent->currentState.eFlags ^ es->eFlags) & EF_TELEPORT_BIT) if (!cent->currentValid ||
|| (cent->currentState.parent != es->parent) || (cent->currentState.modelindex != es->modelindex)) { ((cent->currentState.eFlags ^ es->eFlags) & EF_TELEPORT_BIT) ||
(cent->currentState.parent != es->parent) ||
(cent->currentState.modelindex != es->modelindex)) {
cent->interpolate = qfalse; cent->interpolate = qfalse;
// if this isn't the first frame and we have valid data, set the // if this isn't the first frame and we have valid data, set the
// teleport flag // teleport flag
@ -315,7 +302,8 @@ static void CG_SetNextSnap(snapshot_t *snap)
} }
// if the camera cut bit changed, than the next frame is a camera cut // if the camera cut bit changed, than the next frame is a camera cut
if ((cg.nextSnap->ps.camera_flags & CF_CAMERA_CUT_BIT) != (cg.snap->ps.camera_flags & CF_CAMERA_CUT_BIT)) { if ((cg.nextSnap->ps.camera_flags & CF_CAMERA_CUT_BIT) !=
(cg.snap->ps.camera_flags & CF_CAMERA_CUT_BIT)) {
cg.nextFrameCameraCut = qtrue; cg.nextFrameCameraCut = qtrue;
} else { } else {
cg.nextFrameCameraCut = qfalse; cg.nextFrameCameraCut = qfalse;
@ -347,11 +335,8 @@ static snapshot_t *CG_ReadNextSnapshot(void)
snapshot_t* dest; snapshot_t* dest;
if (cg.latestSnapshotNum > cgs.processedSnapshotNum + 1000) { if (cg.latestSnapshotNum > cgs.processedSnapshotNum + 1000) {
cgi.Printf( cgi.Error(ERR_DROP, "CG_ReadNextSnapshot: way out of range, %i > %i",
"WARNING: CG_ReadNextSnapshot: way out of range, %i > %i\n", cg.latestSnapshotNum, cgs.processedSnapshotNum);
cg.latestSnapshotNum,
cgs.processedSnapshotNum
);
} }
while (cgs.processedSnapshotNum < cg.latestSnapshotNum) { while (cgs.processedSnapshotNum < cg.latestSnapshotNum) {
@ -418,7 +403,8 @@ void CG_ProcessSnapshots(void)
if (n != cg.latestSnapshotNum) { if (n != cg.latestSnapshotNum) {
if (n < cg.latestSnapshotNum) { if (n < cg.latestSnapshotNum) {
// this should never happen // this should never happen
cgi.Error(ERR_DROP, "CG_ProcessSnapshots: n < cg.latestSnapshotNum"); cgi.Error(ERR_DROP,
"CG_ProcessSnapshots: n < cg.latestSnapshotNum");
} }
cg.latestSnapshotNum = n; cg.latestSnapshotNum = n;
} }
@ -459,8 +445,11 @@ void CG_ProcessSnapshots(void)
// if time went backwards, we have a level restart // if time went backwards, we have a level restart
if (cg.nextSnap->serverTime < cg.snap->serverTime) { if (cg.nextSnap->serverTime < cg.snap->serverTime) {
// only drop if this is not a restart or loadgame // only drop if this is not a restart or loadgame
if (!((cg.nextSnap->snapFlags ^ cg.snap->snapFlags) & SNAPFLAG_SERVERCOUNT)) { if (!((cg.nextSnap->snapFlags ^ cg.snap->snapFlags) &
cgi.Error(ERR_DROP, "CG_ProcessSnapshots: Server time went backwards"); SNAPFLAG_SERVERCOUNT)) {
cgi.Error(
ERR_DROP,
"CG_ProcessSnapshots: Server time went backwards");
} }
} }
} }
@ -468,7 +457,9 @@ void CG_ProcessSnapshots(void)
differentServer = cg.snap->serverTime <= cgi.GetServerStartTime(); differentServer = cg.snap->serverTime <= cgi.GetServerStartTime();
// if our time is < nextFrame's, we have a nice interpolating state // if our time is < nextFrame's, we have a nice interpolating state
if (cg.time >= cg.snap->serverTime && cg.time < cg.nextSnap->serverTime && !differentServer) { if (cg.time >= cg.snap->serverTime &&
cg.time < cg.nextSnap->serverTime &&
!differentServer) {
break; break;
} }
@ -486,6 +477,7 @@ void CG_ProcessSnapshots(void)
cgi.SetTime(cg.time); cgi.SetTime(cg.time);
} }
if (cg.nextSnap != NULL && cg.nextSnap->serverTime <= cg.time) { if (cg.nextSnap != NULL && cg.nextSnap->serverTime <= cg.time) {
cgi.Error(ERR_DROP, "CG_ProcessSnapshots: cg.nextSnap->serverTime <= cg.time"); cgi.Error(ERR_DROP,
"CG_ProcessSnapshots: cg.nextSnap->serverTime <= cg.time");
} }
} }

View file

@ -27,19 +27,13 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
void CG_ProcessSound( server_sound_t *sound ) void CG_ProcessSound( server_sound_t *sound )
{ {
if (sound->stop_flag) { if ( sound->stop_flag )
{
cgi.S_StopSound( sound->entity_number, sound->channel ); cgi.S_StopSound( sound->entity_number, sound->channel );
} else { }
cgi.S_StartSound( else
sound->origin, {
sound->entity_number, cgi.S_StartSound( sound->origin, sound->entity_number, sound->channel, cgs.sound_precache[sound->sound_index],
sound->channel, sound->volume, sound->min_dist, sound->pitch, sound->maxDist, sound->streamed );
cgs.sound_precache[sound->sound_index],
sound->volume,
sound->min_dist,
sound->pitch,
sound->maxDist,
sound->streamed
);
} }
} }

File diff suppressed because it is too large Load diff

View file

@ -31,127 +31,11 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
#define MAX_SPECIAL_EFFECT_COMMANDS 32 #define MAX_SPECIAL_EFFECT_COMMANDS 32
typedef enum { class specialeffectcommand_t : public Class {
SFX_BHIT_PAPER_LITE,
SFX_BHIT_PAPER_HARD,
SFX_BHIT_WOOD_LITE,
SFX_BHIT_WOOD_HARD,
SFX_BHIT_METAL_LITE,
SFX_BHIT_METAL_HARD,
SFX_BHIT_STONE_LITE,
SFX_BHIT_STONE_HARD,
SFX_BHIT_DIRT_LITE,
SFX_BHIT_DIRT_HARD,
SFX_BHIT_GRILL_LITE,
SFX_BHIT_GRILL_HARD,
SFX_BHIT_GRASS_LITE,
SFX_BHIT_GRASS_HARD,
SFX_BHIT_MUD_LITE,
SFX_BHIT_MUD_HARD,
SFX_BHIT_PUDDLE_LITE,
SFX_BHIT_PUDDLE_HARD,
SFX_BHIT_GLASS_LITE,
SFX_BHIT_GLASS_HARD,
SFX_BHIT_GRAVEL_LITE,
SFX_BHIT_GRAVEL_HARD,
SFX_BHIT_SAND_LITE,
SFX_BHIT_SAND_HARD,
SFX_BHIT_FOLIAGE_LITE,
SFX_BHIT_FOLIAGE_HARD,
SFX_BHIT_SNOW_LITE,
SFX_BHIT_SNOW_HARD,
SFX_BHIT_CARPET_LITE,
SFX_BHIT_CARPET_HARD,
SFX_BHIT_HUMAN_UNIFORM_LITE,
SFX_BHIT_HUMAN_UNIFORM_HARD,
SFX_WATER_TRAIL_BUBBLE,
SFX_VFX_PAPER_LITE,
SFX_VFX_PAPER_HARD,
SFX_VFX_WOOD_LITE,
SFX_VFX_WOOD_HARD,
SFX_VFX_METAL_LITE,
SFX_VFX_METAL_HARD,
SFX_VFX_STONE_LITE,
SFX_VFX_STONE_HARD,
SFX_VFX_DIRT_LITE,
SFX_VFX_DIRT_HARD,
SFX_VFX_GRILL_LITE,
SFX_VFX_GRILL_HARD,
SFX_VFX_GRASS_LITE,
SFX_VFX_GRASS_HARD,
SFX_VFX_MUD_LITE,
SFX_VFX_MUD_HARD,
SFX_VFX_PUDDLE_LITE,
SFX_VFX_PUDDLE_HARD,
SFX_VFX_GLASS_LITE,
SFX_VFX_GLASS_HARD,
SFX_VFX_GRAVEL_LITE,
SFX_VFX_GRAVEL_HARD,
SFX_VFX_SAND_LITE,
SFX_VFX_SAND_HARD,
SFX_VFX_FOLIAGE_LITE,
SFX_VFX_FOLIAGE_HARD,
SFX_VFX_SNOW_LITE,
SFX_VFX_SNOW_HARD,
SFX_VFX_CARPET_LITE,
SFX_VFX_CARPET_HARD,
SFX_EXP_GREN_BASE,
SFX_EXP_BAZOOKA_BASE,
SFX_EXP_HEAVYSHELL_BASE,
SFX_EXP_TANK_BASE,
SFX_EXP_GREN_PAPER,
SFX_EXP_GREN_WOOD,
SFX_EXP_GREN_METAL,
SFX_EXP_GREN_STONE,
SFX_EXP_GREN_DIRT,
SFX_EXP_GREN_GRILL,
SFX_EXP_GREN_GRASS,
SFX_EXP_GREN_MUD,
SFX_EXP_GREN_PUDDLE,
SFX_EXP_GREN_GLASS,
SFX_EXP_GREN_GRAVEL,
SFX_EXP_GREN_SAND,
SFX_EXP_GREN_FOLIAGE,
SFX_EXP_GREN_SNOW,
SFX_EXP_GREN_CARPET,
SFX_EXP_HEAVYSHELL_DIRT,
SFX_EXP_HEAVYSHELL_STONE,
SFX_EXP_HEAVYSHELL_SNOW,
SFX_EXP_TANK_DIRT,
SFX_EXP_TANK_STONE,
SFX_EXP_TANK_SNOW,
SFX_EXP_BAZOOKA_DIRT,
SFX_EXP_BAZOOKA_STONE,
SFX_EXP_BAZOOKA_SNOW,
SFX_WATER_RIPPLE_STILL,
SFX_WATER_RIPPLE_MOVING,
SFX_OIL_LEAK_BIG,
SFX_OIL_LEAK_MEDIUM,
SFX_OIL_LEAK_SMALL,
SFX_OIL_LEAK_SPLAT,
SFX_WATER_LEAK_BIG,
SFX_WATER_LEAK_MEDIUM,
SFX_WATER_LEAK_SMALL,
SFX_WATER_LEAK_SPLAT,
SFX_FOOT_LIGHT_DUST,
SFX_FOOT_HEAVY_DUST,
SFX_FOOT_DIRT,
SFX_FOOT_GRASS,
SFX_FOOT_MUD,
SFX_FOOT_PUDDLE,
SFX_FOOT_SAND,
SFX_FOOT_SNOW,
SFX_FENCE_WOOD,
SFX_TEST_EFFECT,
SFX_COUNT
} SpecialEffects;
class specialeffectcommand_t : public Class
{
public: public:
spawnthing_t* emitter; spawnthing_t* emitter;
float fCommandTime; float fCommandTime;
void (ClientGameCommandManager::*endfcn)(); void (*endfcn)();
Event *pEvent; Event *pEvent;
public: public:
@ -170,9 +54,11 @@ public:
specialeffectcommand_t* AddNewCommand(); specialeffectcommand_t* AddNewCommand();
}; };
class ClientSpecialEffectsManager : public Listener #define MAX_SPECIAL_EFFECTS 99
{ #define SPECIAL_EFFECT_TEST MAX_SPECIAL_EFFECTS - 1
specialeffect_t m_effects[SFX_COUNT];
class ClientSpecialEffectsManager : public Listener {
specialeffect_t m_effects[99];
qboolean m_bEffectsLoaded; qboolean m_bEffectsLoaded;
int m_iNumPendingEvents; int m_iNumPendingEvents;

View file

@ -31,7 +31,10 @@ extern refEntity_t *current_entity;
extern dtiki_t* current_tiki; extern dtiki_t* current_tiki;
extern centity_t *current_centity; extern centity_t *current_centity;
void ClientGameCommandManager::SwipeOn(Event *ev) void ClientGameCommandManager::SwipeOn
(
Event *ev
)
{ {
// Make a swipe for this if available // Make a swipe for this if available
@ -40,32 +43,38 @@ void ClientGameCommandManager::SwipeOn(Event *ev)
str tagname_start,tagname_end; str tagname_start,tagname_end;
qhandle_t shader; qhandle_t shader;
if (ev->NumArgs() != 4) { if ( ev->NumArgs () != 4 )
return; return;
}
shader = cgi.R_RegisterShader( ev->GetString( 1 ) ); shader = cgi.R_RegisterShader( ev->GetString( 1 ) );
tagname_start = ev->GetString( 2 ); tagname_start = ev->GetString( 2 );
tagname_end = ev->GetString( 3 ); tagname_end = ev->GetString( 3 );
for (i = 0; i < MAX_SWIPES; i++) { for ( i=0; i < MAX_SWIPES; i++ )
{
swipething_t &swipe = m_swipes[i]; swipething_t &swipe = m_swipes[i];
if (!swipe.enabled if ( !swipe.enabled ||
|| ((swipe.entitynum == current_entity_number) && (tagname_start == swipe.tagname_start) (
&& (tagname_end == swipe.tagname_end) && (shader == swipe.shader))) { ( swipe.entitynum == current_entity_number ) &&
( tagname_start == swipe.tagname_start ) &&
( tagname_end == swipe.tagname_end ) &&
( shader == swipe.shader )
)
)
{
freeswipe = i; freeswipe = i;
break; break;
} }
} }
if (freeswipe == -1) { if ( freeswipe == -1 )
return; return;
}
swipething_t &swipe = m_swipes[freeswipe]; swipething_t &swipe = m_swipes[freeswipe];
if (!swipe.enabled) { if ( !swipe.enabled )
{
swipe.Init (); swipe.Init ();
swipe.enabled = qtrue; swipe.enabled = qtrue;
swipe.entitynum = current_entity_number; swipe.entitynum = current_entity_number;
@ -76,38 +85,45 @@ void ClientGameCommandManager::SwipeOn(Event *ev)
swipe.tagname_end = ev->GetString ( 3 ); swipe.tagname_end = ev->GetString ( 3 );
swipe.life = ev->GetFloat ( 4 ) * 1000.f; swipe.life = ev->GetFloat ( 4 ) * 1000.f;
if (current_centity) { if ( current_centity )
current_centity->clientFlags |= CF_UPDATESWIPE; current_centity->clientFlags |= CF_UPDATESWIPE;
} }
}
void ClientGameCommandManager::SwipeOff(Event *ev) void ClientGameCommandManager::SwipeOff
(
Event *ev
)
{ {
qboolean was_enabled; qboolean was_enabled;
int i; int i;
was_enabled = qfalse; was_enabled = qfalse;
for (i = 0; i < MAX_SWIPES; i++) { for ( i=0; i < MAX_SWIPES; i++ )
{
swipething_t &swipe = m_swipes[i]; swipething_t &swipe = m_swipes[i];
if (swipe.enabled && swipe.entitynum == current_entity_number) { if ( swipe.enabled && swipe.entitynum == current_entity_number )
{
swipe.enabled = qfalse; swipe.enabled = qfalse;
was_enabled = qtrue; was_enabled = qtrue;
} }
} }
if (was_enabled) { if ( was_enabled )
{
//cgi.R_SwipeBegin ( 0.f, 0.f, -1 ); //cgi.R_SwipeBegin ( 0.f, 0.f, -1 );
//cgi.R_SwipeEnd (); //cgi.R_SwipeEnd ();
if (current_centity) { if ( current_centity )
current_centity->clientFlags &= ~CF_UPDATESWIPE; current_centity->clientFlags &= ~CF_UPDATESWIPE;
} }
} }
}
void ClientGameCommandManager::Swipe(Event *ev) void ClientGameCommandManager::Swipe
(
Event *ev
)
{ {
// This does a swipe effect on the entity // This does a swipe effect on the entity
@ -120,31 +136,40 @@ void ClientGameCommandManager::Swipe(Event *ev)
assert(current_entity); assert(current_entity);
assert(current_tiki); assert(current_tiki);
if (!current_entity || !current_tiki) { if (!current_entity || !current_tiki)
{
return; return;
} }
// Let's find us a new (or current) swipe // Let's find us a new (or current) swipe
for (swipenum = 0; swipenum < MAX_SWIPES; swipenum++) { for ( swipenum=0; swipenum < MAX_SWIPES; swipenum++ )
{
swipething_t &swipe = m_swipes[swipenum]; swipething_t &swipe = m_swipes[swipenum];
if (swipe.enabled && swipe.entitynum == current_entity_number) { if ( swipe.enabled && swipe.entitynum == current_entity_number )
while (swipe.num_live_swipes > 1) { {
while ( swipe.num_live_swipes > 1 )
{
i = ( swipe.first_swipe + 1 ) % MAX_SWIPE_POINTS; i = ( swipe.first_swipe + 1 ) % MAX_SWIPE_POINTS;
swipepoint_t &swipepoint = swipe.swipepoints[i]; swipepoint_t &swipepoint = swipe.swipepoints[i];
if (swipepoint.time < cg.time - swipe.life) { if ( swipepoint.time < cg.time - swipe.life )
{
// then let's delete the previous // then let's delete the previous
swipe.first_swipe = ( swipe.first_swipe + 1 ) % MAX_SWIPE_POINTS; swipe.first_swipe = ( swipe.first_swipe + 1 ) % MAX_SWIPE_POINTS;
swipe.num_live_swipes--; swipe.num_live_swipes--;
} else { }
else
{
break; break;
} }
} }
if (swipe.num_live_swipes == 1) { if ( swipe.num_live_swipes == 1 )
{
swipepoint_t &swipepoint = swipe.swipepoints[swipe.first_swipe]; swipepoint_t &swipepoint = swipe.swipepoints[swipe.first_swipe];
if (swipepoint.time < cg.time - swipe.life) { if ( swipepoint.time < cg.time - swipe.life )
{
swipe.num_live_swipes = 0; swipe.num_live_swipes = 0;
} }
} }
@ -160,14 +185,14 @@ void ClientGameCommandManager::Swipe(Event *ev)
VectorClear ( swipe.cntPoint.points[0] ); VectorClear ( swipe.cntPoint.points[0] );
VectorClear ( swipe.cntPoint.points[1] ); VectorClear ( swipe.cntPoint.points[1] );
if (ev->NumArgs() > 0) { if ( ev->NumArgs() > 0 )
VectorCopy( ev->GetVector( 1 ), tmp ); VectorCopy( ev->GetVector( 1 ), tmp );
} else { else
VectorCopy ( current_entity->origin, tmp ); VectorCopy ( current_entity->origin, tmp );
}
// Transform the origin of the tag by the axis of the entity and add it to the origin of the entity // Transform the origin of the tag by the axis of the entity and add it to the origin of the entity
for (i = 0; i < 3; i++) { for ( i = 0; i < 3; i++ )
{
VectorMA ( tmp, _or.origin[i], current_entity->axis[i], tmp ); VectorMA ( tmp, _or.origin[i], current_entity->axis[i], tmp );
} }
@ -177,68 +202,70 @@ void ClientGameCommandManager::Swipe(Event *ev)
tagnum_end = cgi.Tag_NumForName( current_tiki, swipe.tagname_end.c_str() ); tagnum_end = cgi.Tag_NumForName( current_tiki, swipe.tagname_end.c_str() );
_or = cgi.TIKI_Orientation(current_entity, tagnum_end); _or = cgi.TIKI_Orientation(current_entity, tagnum_end);
if (ev->NumArgs() > 0) { if ( ev->NumArgs() > 0 )
VectorCopy( ev->GetVector( 1 ), tmp ); VectorCopy( ev->GetVector( 1 ), tmp );
} else { else
VectorCopy ( current_entity->origin, tmp ); VectorCopy ( current_entity->origin, tmp );
}
// Transform the origin of the tag by the axis of the entity and add it to the origin of the entity // Transform the origin of the tag by the axis of the entity and add it to the origin of the entity
for (i = 0; i < 3; i++) { for ( i = 0; i < 3; i++ )
{
VectorMA ( tmp, _or.origin[i], current_entity->axis[i], tmp ); VectorMA ( tmp, _or.origin[i], current_entity->axis[i], tmp );
} }
// Copy tmp into the startpoint // Copy tmp into the startpoint
VectorCopy ( tmp, swipe.cntPoint.points[1] ); VectorCopy ( tmp, swipe.cntPoint.points[1] );
if (swipe.num_live_swipes == 0) { if ( swipe.num_live_swipes == 0 )
add_cnt_point = qtrue; add_cnt_point = qtrue;
} else { else
{
float deltime = swipe.life / float ( MAX_SWIPES ); float deltime = swipe.life / float ( MAX_SWIPES );
swipepoint_t& lastpoint = swipepoint_t &lastpoint = swipe.swipepoints[ ( swipe.first_swipe + swipe.num_live_swipes - 1 ) % MAX_SWIPE_POINTS];
swipe.swipepoints[(swipe.first_swipe + swipe.num_live_swipes - 1) % MAX_SWIPE_POINTS];
if (swipe.cntPoint.time - lastpoint.time >= deltime) { if ( swipe.cntPoint.time - lastpoint.time >= deltime )
add_cnt_point = qtrue; add_cnt_point = qtrue;
} }
}
cgi.R_SwipeBegin ( cg.time, swipe.life, swipe.shader ); cgi.R_SwipeBegin ( cg.time, swipe.life, swipe.shader );
if (add_cnt_point) { if ( add_cnt_point )
swipepoint_t& swipepoint = {
swipe.swipepoints[(swipe.first_swipe + swipe.num_live_swipes) % MAX_SWIPE_POINTS]; swipepoint_t &swipepoint = swipe.swipepoints[ ( swipe.first_swipe + swipe.num_live_swipes ) % MAX_SWIPE_POINTS];
swipepoint = swipe.cntPoint; swipepoint = swipe.cntPoint;
if (swipe.num_live_swipes == MAX_SWIPE_POINTS) { if ( swipe.num_live_swipes == MAX_SWIPE_POINTS )
swipe.first_swipe = ( swipe.first_swipe + 1 ) % MAX_SWIPE_POINTS; swipe.first_swipe = ( swipe.first_swipe + 1 ) % MAX_SWIPE_POINTS;
} else { else
swipe.num_live_swipes++; swipe.num_live_swipes++;
} }
}
for (i = 0; i != swipe.num_live_swipes; i++) { for ( i = 0; i != swipe.num_live_swipes; i++ )
{
swipepoint_t &swipepoint = swipe.swipepoints[ ( swipe.first_swipe + i ) % MAX_SWIPE_POINTS]; swipepoint_t &swipepoint = swipe.swipepoints[ ( swipe.first_swipe + i ) % MAX_SWIPE_POINTS];
cgi.R_SwipePoint ( swipepoint.points[0], swipepoint.points[1], swipepoint.time ); cgi.R_SwipePoint ( swipepoint.points[0], swipepoint.points[1], swipepoint.time );
} }
if (!add_cnt_point) { if ( !add_cnt_point )
cgi.R_SwipePoint ( swipe.cntPoint.points[0], swipe.cntPoint.points[1], swipe.cntPoint.time ); cgi.R_SwipePoint ( swipe.cntPoint.points[0], swipe.cntPoint.points[1], swipe.cntPoint.time );
}
cgi.R_SwipeEnd (); cgi.R_SwipeEnd ();
} }
} }
} }
void ClientGameCommandManager::ClearSwipes(void) void ClientGameCommandManager::ClearSwipes
(
void
)
{ {
int i; int i;
for (i = 0; i < MAX_SWIPES; i++) { for ( i=0; i < MAX_SWIPES; i++ )
{
swipething_t &swipe = m_swipes[i]; swipething_t &swipe = m_swipes[i];
swipe.enabled = qfalse; swipe.enabled = qfalse;
@ -248,6 +275,7 @@ void ClientGameCommandManager::ClearSwipes(void)
cgi.R_SwipeEnd (); cgi.R_SwipeEnd ();
} }
/* /*
=================== ===================
CG_ClearSwipes CG_ClearSwipes

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

View file

@ -25,7 +25,6 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
#include "cg_local.h" #include "cg_local.h"
#include "str.h" #include "str.h"
#include "../client/keycodes.h"
void CG_MessageMode_f(void) void CG_MessageMode_f(void)
{ {
@ -62,8 +61,9 @@ void CG_MessageMode_Private_f(void)
return; return;
} }
clientNum = atoi(cgi.Argv(1)); clientNum = atoi(cgi.Argv(1)) - 1;
if (clientNum < 1 || clientNum >= MAX_CLIENTS) { if (clientNum < 0 || clientNum >= MAX_CLIENTS)
{
cgi.Printf(HUD_MESSAGE_CHAT_WHITE "Message Error: %s is a bad client number\n", cgi.Argv(1)); cgi.Printf(HUD_MESSAGE_CHAT_WHITE "Message Error: %s is a bad client number\n", cgi.Argv(1));
return; return;
} }
@ -79,7 +79,8 @@ void CG_MessageSingleAll_f(void)
if (cgi.Argc() > 1) { if (cgi.Argc() > 1) {
cgi.SendClientCommand(va("dmmessage 0 %s\n", cgi.Args())); cgi.SendClientCommand(va("dmmessage 0 %s\n", cgi.Args()));
} else { }
else {
cgi.UI_ToggleDMMessageConsole(-100); cgi.UI_ToggleDMMessageConsole(-100);
} }
} }
@ -92,7 +93,8 @@ void CG_MessageSingleTeam_f(void)
if (cgi.Argc() > 1) { if (cgi.Argc() > 1) {
cgi.SendClientCommand(va("dmmessage -1 %s\n", cgi.Args())); cgi.SendClientCommand(va("dmmessage -1 %s\n", cgi.Args()));
} else { }
else {
cgi.UI_ToggleDMMessageConsole(-200); cgi.UI_ToggleDMMessageConsole(-200);
} }
} }
@ -106,12 +108,14 @@ void CG_MessageSingleClient_f(void)
} }
clientNum = atoi(cgi.Argv(1)); clientNum = atoi(cgi.Argv(1));
if (clientNum < 1 || clientNum > MAX_CLIENTS) { if (clientNum < 1 || clientNum > MAX_CLIENTS)
{
cgi.Printf(HUD_MESSAGE_CHAT_WHITE "Message Error: %s is a bad client number\n", cgi.Argv(1)); cgi.Printf(HUD_MESSAGE_CHAT_WHITE "Message Error: %s is a bad client number\n", cgi.Argv(1));
return; return;
} }
if (cgi.Argc() > 2) { if (cgi.Argc() > 2)
{
int i; int i;
str sString; str sString;
@ -125,7 +129,8 @@ void CG_MessageSingleClient_f(void)
sString += "\n"; sString += "\n";
cgi.SendClientCommand(sString.c_str()); cgi.SendClientCommand(sString.c_str());
} else { }
else {
cgi.UI_ToggleDMMessageConsole(-clientNum); cgi.UI_ToggleDMMessageConsole(-clientNum);
} }
} }
@ -190,39 +195,11 @@ void CG_InstaMessageGroupE_f(void)
void CG_HudPrint_f(void) void CG_HudPrint_f(void)
{ {
cgi.Printf("\x1%s", cgi.Argv(1)); cgi.Printf("\x1%s", cgi.Argv(0));
} }
qboolean CG_CheckCaptureKey(int key, qboolean down, unsigned int time) int CG_CheckCaptureKey(int key, qboolean down, unsigned int time)
{ {
char minKey = '1', maxKey = '9'; // FIXME: unimplemented
return 0;
if (!cg.iInstaMessageMenu || !down) {
return qfalse;
}
if (cg_protocol >= protocol_e::PROTOCOL_MOHTA_MIN) {
maxKey = '8';
}
if (key < minKey || key > maxKey) {
if (key == K_ESCAPE || key == '0') {
cg.iInstaMessageMenu = 0;
return qtrue;
}
return qfalse;
}
if (cg.iInstaMessageMenu == -1) {
if (key > '6') {
cg.iInstaMessageMenu = 0;
} else {
cg.iInstaMessageMenu = key - '0';
}
} else if (cg.iInstaMessageMenu > 0) {
cgi.SendClientCommand(va("dmmessage 0 *%i%i\n", cg.iInstaMessageMenu, key - '0'));
cg.iInstaMessageMenu = 0;
}
return qtrue;
} }

View file

@ -26,7 +26,10 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
#include "cg_local.h" #include "cg_local.h"
#include "cg_commands.h" #include "cg_commands.h"
void CG_Vehicle(centity_t *cent) {} void CG_Vehicle(centity_t* cent)
{
}
void ClientGameCommandManager::SpawnTreads(Event* ev) void ClientGameCommandManager::SpawnTreads(Event* ev)
{ {

View file

@ -25,6 +25,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
//============================================================================ //============================================================================
/* /*
================= =================
CG_CalcVrect CG_CalcVrect
@ -32,8 +33,7 @@ CG_CalcVrect
Sets the coordinates of the rendered window Sets the coordinates of the rendered window
================= =================
*/ */
static void CG_CalcVrect(void) static void CG_CalcVrect (void) {
{
int size; int size;
// the intermission should allways be full screen // the intermission should allways be full screen
@ -50,6 +50,7 @@ static void CG_CalcVrect(void)
} else { } else {
size = cg_viewsize->integer; size = cg_viewsize->integer;
} }
} }
cg.refdef.width = cgs.glconfig.vidWidth*size/100; cg.refdef.width = cgs.glconfig.vidWidth*size/100;
cg.refdef.width &= ~1; cg.refdef.width &= ~1;
@ -63,6 +64,7 @@ static void CG_CalcVrect(void)
//============================================================================== //==============================================================================
/* /*
=============== ===============
CG_OffsetThirdPersonView CG_OffsetThirdPersonView
@ -70,7 +72,6 @@ CG_OffsetThirdPersonView
=============== ===============
*/ */
#define CAMERA_MINIMUM_DISTANCE 40 #define CAMERA_MINIMUM_DISTANCE 40
static void CG_OffsetThirdPersonView( void ) static void CG_OffsetThirdPersonView( void )
{ {
vec3_t forward; vec3_t forward;
@ -91,17 +92,20 @@ static void CG_OffsetThirdPersonView(void)
target_position = cg.refdef.vieworg; target_position = cg.refdef.vieworg;
// see if angles are absolute // see if angles are absolute
if (cg.predicted_player_state.camera_flags & CF_CAMERA_ANGLES_ABSOLUTE) { if ( cg.predicted_player_state.camera_flags & CF_CAMERA_ANGLES_ABSOLUTE )
{
VectorClear( target_angles ); VectorClear( target_angles );
} }
// see if we need to ignore yaw // see if we need to ignore yaw
if (cg.predicted_player_state.camera_flags & CF_CAMERA_ANGLES_IGNORE_YAW) { if ( cg.predicted_player_state.camera_flags & CF_CAMERA_ANGLES_IGNORE_YAW )
{
target_angles[ YAW ] = 0; target_angles[ YAW ] = 0;
} }
// see if we need to ignore pitch // see if we need to ignore pitch
if (cg.predicted_player_state.camera_flags & CF_CAMERA_ANGLES_IGNORE_PITCH) { if ( cg.predicted_player_state.camera_flags & CF_CAMERA_ANGLES_IGNORE_PITCH )
{
target_angles[ PITCH ] = 0; target_angles[ PITCH ] = 0;
} }
@ -111,15 +115,23 @@ static void CG_OffsetThirdPersonView(void)
// Get the position of the camera after any needed rotation // Get the position of the camera after any needed rotation
look_offset = cgi.get_camera_offset( &lookactive, &resetview ); look_offset = cgi.get_camera_offset( &lookactive, &resetview );
if ((!resetview) && ((cg.predicted_player_state.camera_flags & CF_CAMERA_ANGLES_ALLOWOFFSET) || (lookactive))) { if (
( !resetview ) &&
(
( cg.predicted_player_state.camera_flags & CF_CAMERA_ANGLES_ALLOWOFFSET ) ||
( lookactive )
)
)
{
VectorSubtract( look_offset, saved_look_offset, camera_offset ); VectorSubtract( look_offset, saved_look_offset, camera_offset );
VectorAdd( target_angles, camera_offset, target_angles ); VectorAdd( target_angles, camera_offset, target_angles );
if (target_angles[PITCH] > 90) { if ( target_angles[ PITCH ] > 90 )
target_angles[ PITCH ] = 90; target_angles[ PITCH ] = 90;
} else if (target_angles[PITCH] < -90) { else if ( target_angles[ PITCH ] < -90 )
target_angles[ PITCH ] = -90; target_angles[ PITCH ] = -90;
} }
} else { else
{
VectorCopy( look_offset, saved_look_offset ); VectorCopy( look_offset, saved_look_offset );
} }
@ -158,10 +170,10 @@ static void CG_OffsetThirdPersonView(void)
// calculate distance from end position to head position // calculate distance from end position to head position
VectorSubtract( target_position, cg.playerHeadPos, delta ); VectorSubtract( target_position, cg.playerHeadPos, delta );
// kill any negative z difference in delta // kill any negative z difference in delta
if (delta[2] < CAMERA_MINIMUM_DISTANCE) { if ( delta[ 2 ] < CAMERA_MINIMUM_DISTANCE )
delta[ 2 ] = 0; delta[ 2 ] = 0;
} if ( VectorLength( delta ) < CAMERA_MINIMUM_DISTANCE )
if (VectorLength(delta) < CAMERA_MINIMUM_DISTANCE) { {
VectorNormalize( delta); VectorNormalize( delta);
/* /*
// see if we are going straight up // see if we are going straight up
@ -179,7 +191,8 @@ static void CG_OffsetThirdPersonView(void)
// save off the original angles // save off the original angles
VectorCopy( target_angles, original_angles ); VectorCopy( target_angles, original_angles );
// start cranking up the target angles, pitch until we are the correct distance away from the player // start cranking up the target angles, pitch until we are the correct distance away from the player
while (target_angles[PITCH] < 90) { while ( target_angles[ PITCH ] < 90 )
{
target_angles[ PITCH ] += 2; target_angles[ PITCH ] += 2;
AngleVectors(target_angles, forward, NULL, NULL); AngleVectors(target_angles, forward, NULL, NULL);
@ -188,35 +201,25 @@ static void CG_OffsetThirdPersonView(void)
new_vieworg[ 2 ] += cg_cameraverticaldisplacement->value; new_vieworg[ 2 ] += cg_cameraverticaldisplacement->value;
CG_Trace( CG_Trace(&trace, cg.playerHeadPos, min, max, new_vieworg, 0, MASK_CAMERASOLID, qfalse, qtrue, "ThirdPersonTrace 3" );
&trace,
cg.playerHeadPos,
min,
max,
new_vieworg,
0,
MASK_CAMERASOLID,
qfalse,
qtrue,
"ThirdPersonTrace 3"
);
VectorCopy(trace.endpos, target_position); VectorCopy(trace.endpos, target_position);
// calculate distance from end position to head position // calculate distance from end position to head position
VectorSubtract( target_position, cg.playerHeadPos, delta ); VectorSubtract( target_position, cg.playerHeadPos, delta );
// kill any negative z difference in delta // kill any negative z difference in delta
if (delta[2] < 0) { if ( delta[ 2 ] < 0 )
delta[ 2 ] = 0; delta[ 2 ] = 0;
} if ( VectorLength( delta ) >= CAMERA_MINIMUM_DISTANCE )
if (VectorLength(delta) >= CAMERA_MINIMUM_DISTANCE) { {
target_angles[ PITCH ] = ( 0.25f * target_angles[ PITCH ] ) + ( 0.75f * original_angles[ PITCH ] ); target_angles[ PITCH ] = ( 0.25f * target_angles[ PITCH ] ) + ( 0.75f * original_angles[ PITCH ] );
// set the pitch to be that of the angle we are currently looking // set the pitch to be that of the angle we are currently looking
//target_angles[ PITCH ] = original_angles[ PITCH ]; //target_angles[ PITCH ] = original_angles[ PITCH ];
break; break;
} }
} }
if (target_angles[PITCH] > 90) { if ( target_angles[ PITCH ] > 90 )
{
// if we failed, go with the original angles // if we failed, go with the original angles
target_angles[ PITCH ] = original_angles[ PITCH ]; target_angles[ PITCH ] = original_angles[ PITCH ];
} }
@ -242,7 +245,6 @@ void CG_OffsetFirstPersonView(refEntity_t *pREnt, qboolean bUseWorldPosition)
float mat[3][3]; float mat[3][3];
vec3_t vOldOrigin; vec3_t vOldOrigin;
vec3_t vStart, vEnd, vMins, vMaxs; vec3_t vStart, vEnd, vMins, vMaxs;
vec3_t vVelocity;
trace_t trace; trace_t trace;
VectorSet(vMins, -6, -6, -6); VectorSet(vMins, -6, -6, -6);
@ -258,8 +260,10 @@ void CG_OffsetFirstPersonView(refEntity_t *pREnt, qboolean bUseWorldPosition)
tiki = cgi.R_Model_GetHandle(cgs.model_draw[pCent->currentState.modelindex]); tiki = cgi.R_Model_GetHandle(cgs.model_draw[pCent->currentState.modelindex]);
iTag = cgi.Tag_NumForName(tiki, "eyes bone"); iTag = cgi.Tag_NumForName(tiki, "eyes bone");
if (iTag != -1) { if (iTag != -1)
if (bUseWorldPosition) { {
if (bUseWorldPosition)
{
orientation_t oHead; orientation_t oHead;
float mat3[3][3]; float mat3[3][3];
vec3_t vHeadAng, vDelta; vec3_t vHeadAng, vDelta;
@ -277,7 +281,9 @@ void CG_OffsetFirstPersonView(refEntity_t *pREnt, qboolean bUseWorldPosition)
AnglesSubtract(vHeadAng, cg.refdefViewAngles, vDelta); AnglesSubtract(vHeadAng, cg.refdefViewAngles, vDelta);
VectorMA(cg.refdefViewAngles, cg.fEyeOffsetFrac, vDelta, cg.refdefViewAngles); VectorMA(cg.refdefViewAngles, cg.fEyeOffsetFrac, vDelta, cg.refdefViewAngles);
VectorCopy(vHeadAng, cg.refdefViewAngles); VectorCopy(vHeadAng, cg.refdefViewAngles);
} else { }
else
{
orientation_t oHead; orientation_t oHead;
vec3_t vHeadAng; vec3_t vHeadAng;
@ -292,24 +298,20 @@ void CG_OffsetFirstPersonView(refEntity_t *pREnt, qboolean bUseWorldPosition)
cg.refdefViewAngles[2] += cg.predicted_player_state.fLeanAngle * 0.3; cg.refdefViewAngles[2] += cg.predicted_player_state.fLeanAngle * 0.3;
} }
} else { }
else
{
cgi.DPrintf("CG_OffsetFirstPersonView warning: Couldn't find 'eyes bone' for player\n"); cgi.DPrintf("CG_OffsetFirstPersonView warning: Couldn't find 'eyes bone' for player\n");
} }
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 (bUseWorldPosition)
VectorCopy(cg.predicted_player_state.velocity, vVelocity); {
} else {
//
// Added in OPM
// When frozen, there must be no movement at all
VectorClear(vVelocity);
}
if (bUseWorldPosition) {
iMask = MASK_VIEWSOLID; iMask = MASK_VIEWSOLID;
} else { }
else
{
float fTargHeight; float fTargHeight;
float fHeightDelta, fHeightChange; float fHeightDelta, fHeightChange;
float fPhase, fVel; float fPhase, fVel;
@ -322,13 +324,17 @@ void CG_OffsetFirstPersonView(refEntity_t *pREnt, qboolean bUseWorldPosition)
fTargHeight = cg.predicted_player_state.origin[2] + cg.predicted_player_state.viewheight; fTargHeight = cg.predicted_player_state.origin[2] + cg.predicted_player_state.viewheight;
fHeightDelta = fTargHeight - cg.fCurrentViewHeight; fHeightDelta = fTargHeight - cg.fCurrentViewHeight;
if (fabs(fHeightDelta) < 0.1 || !cg.fCurrentViewHeight) { if (fabs(fHeightDelta) < 0.1 || !cg.fCurrentViewHeight)
{
cg.fCurrentViewHeight = fTargHeight; cg.fCurrentViewHeight = fTargHeight;
} else { }
else
{
if (fHeightDelta > 32.f) { if (fHeightDelta > 32.f) {
fHeightDelta = 32.f; fHeightDelta = 32.f;
cg.fCurrentViewHeight = fTargHeight - 32.0; cg.fCurrentViewHeight = fTargHeight - 32.0;
} else if (fHeightDelta < -32.f) { }
else if (fHeightDelta < -32.f) {
fHeightDelta = -32.f; fHeightDelta = -32.f;
cg.fCurrentViewHeight = fTargHeight + 32.0; cg.fCurrentViewHeight = fTargHeight + 32.0;
} }
@ -353,13 +359,16 @@ void CG_OffsetFirstPersonView(refEntity_t *pREnt, qboolean bUseWorldPosition)
VectorCopy(origin, vStart); VectorCopy(origin, vStart);
if (cg.predicted_player_state.pm_type != PM_CLIMBWALL) { if (cg.predicted_player_state.pm_type != PM_CLIMBWALL)
{
if (cg.refdefViewAngles[0] > 0.0) { if (cg.refdefViewAngles[0] > 0.0) {
vStart[2] -= (cg.fCurrentViewHeight - cg.predicted_player_state.origin[2]) * 0.4; vStart[2] -= (cg.fCurrentViewHeight - cg.predicted_player_state.origin[2]) * 0.4;
} else { }
else {
vStart[2] -= (cg.fCurrentViewHeight - cg.predicted_player_state.origin[2]) * 0.2; vStart[2] -= (cg.fCurrentViewHeight - cg.predicted_player_state.origin[2]) * 0.2;
} }
} else { }
else {
vStart[2] -= (cg.fCurrentViewHeight - cg.predicted_player_state.origin[2]) * 0.15; vStart[2] -= (cg.fCurrentViewHeight - cg.predicted_player_state.origin[2]) * 0.15;
} }
@ -376,14 +385,16 @@ void CG_OffsetFirstPersonView(refEntity_t *pREnt, qboolean bUseWorldPosition)
VectorAdd(vStart, vEnd, origin); VectorAdd(vStart, vEnd, origin);
} }
if (cg.predicted_player_state.walking) { if (cg.predicted_player_state.walking)
fVel = VectorLength(vVelocity); {
fVel = VectorLength(cg.predicted_player_state.velocity);
fPhase = fVel * 0.0015 + 0.9; fPhase = fVel * 0.0015 + 0.9;
cg.fCurrentViewBobPhase += (cg.frametime / 1000.0 + cg.frametime / 1000.0) * M_PI * fPhase; cg.fCurrentViewBobPhase += (cg.frametime / 1000.0 + cg.frametime / 1000.0) * M_PI * fPhase;
if (cg.fCurrentViewBobAmp) { if (cg.fCurrentViewBobAmp) {
cg.fCurrentViewBobAmp = fVel; cg.fCurrentViewBobAmp = fVel;
} else { }
else {
cg.fCurrentViewBobAmp = fVel * 0.5; cg.fCurrentViewBobAmp = fVel * 0.5;
} }
@ -392,21 +403,25 @@ void CG_OffsetFirstPersonView(refEntity_t *pREnt, qboolean bUseWorldPosition)
} }
cg.fCurrentViewBobAmp *= (1.0 - fabs(cg.refdefViewAngles[0]) * (1.0 / 90.0) * 0.5) * 0.5; cg.fCurrentViewBobAmp *= (1.0 - fabs(cg.refdefViewAngles[0]) * (1.0 / 90.0) * 0.5) * 0.5;
} else if (cg.fCurrentViewBobAmp > 0.0) { }
cg.fCurrentViewBobAmp -= else if (cg.fCurrentViewBobAmp > 0.0)
(cg.frametime / 1000.0 * cg.fCurrentViewBobAmp) + (cg.frametime / 1000.0 * cg.fCurrentViewBobAmp); {
cg.fCurrentViewBobAmp -= (cg.frametime / 1000.0 * cg.fCurrentViewBobAmp)
+ (cg.frametime / 1000.0 * cg.fCurrentViewBobAmp);
if (cg.fCurrentViewBobAmp < 0.1) { if (cg.fCurrentViewBobAmp < 0.1) {
cg.fCurrentViewBobAmp = 0.0; cg.fCurrentViewBobAmp = 0.0;
} }
} }
if (cg.fCurrentViewBobAmp > 0.0) { if (cg.fCurrentViewBobAmp > 0.0)
{
fPhase = sin(cg.fCurrentViewBobPhase) * cg.fCurrentViewBobAmp * 0.03; fPhase = sin(cg.fCurrentViewBobPhase) * cg.fCurrentViewBobAmp * 0.03;
if (fPhase > 16.0) { if (fPhase > 16.0) {
fPhase = 16.0; fPhase = 16.0;
} else if (fPhase < -16.0) { }
else if (fPhase < -16.0) {
fPhase = -16.0; fPhase = -16.0;
} }
@ -417,7 +432,8 @@ void CG_OffsetFirstPersonView(refEntity_t *pREnt, qboolean bUseWorldPosition)
if (fPhase > 16.0) { if (fPhase > 16.0) {
fPhase = 16.0; fPhase = 16.0;
} else if (fPhase < -16.0) { }
else if (fPhase < -16.0) {
fPhase = -16.0; fPhase = -16.0;
} }
@ -434,9 +450,7 @@ void CG_OffsetFirstPersonView(refEntity_t *pREnt, qboolean bUseWorldPosition)
vEnd[1] = cg.predicted_player_state.origin[1]; vEnd[1] = cg.predicted_player_state.origin[1];
vEnd[2] = origin[2]; vEnd[2] = origin[2];
CG_Trace( CG_Trace(&trace, vStart, vMins, vMaxs, vEnd, cg.snap->ps.clientNum, iMask, qfalse, qtrue, "FirstPerson Height Check");
&trace, vStart, vMins, vMaxs, vEnd, cg.snap->ps.clientNum, iMask, qfalse, qtrue, "FirstPerson Height Check"
);
VectorCopy(trace.endpos, vStart); VectorCopy(trace.endpos, vStart);
vEnd[0] = origin[0]; vEnd[0] = origin[0];
@ -448,7 +462,8 @@ void CG_OffsetFirstPersonView(refEntity_t *pREnt, qboolean bUseWorldPosition)
VectorSubtract(origin, vOldOrigin, vDelta); VectorSubtract(origin, vOldOrigin, vDelta);
VectorAdd(pREnt->origin, vDelta, pREnt->origin); VectorAdd(pREnt->origin, vDelta, pREnt->origin);
if (!bUseWorldPosition) { if (!bUseWorldPosition)
{
VectorCopy(cg.refdefViewAngles, vDelta); VectorCopy(cg.refdefViewAngles, vDelta);
vDelta[0] *= 0.5; vDelta[0] *= 0.5;
vDelta[2] *= 0.75; vDelta[2] *= 0.75;
@ -456,7 +471,10 @@ void CG_OffsetFirstPersonView(refEntity_t *pREnt, qboolean bUseWorldPosition)
AngleVectorsLeft(vDelta, mat[0], mat[1], mat[2]); AngleVectorsLeft(vDelta, mat[0], mat[1], mat[2]);
CG_CalcViewModelMovement( CG_CalcViewModelMovement(
cg.fCurrentViewBobPhase, cg.fCurrentViewBobAmp, vVelocity, vDelta cg.fCurrentViewBobPhase,
cg.fCurrentViewBobAmp,
cg.predicted_player_state.velocity,
vDelta
); );
VectorMA(pREnt->origin, vDelta[0], mat[0], pREnt->origin); VectorMA(pREnt->origin, vDelta[0], mat[0], pREnt->origin);
@ -485,15 +503,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;
@ -506,58 +517,19 @@ static int CG_CalcFov(void)
fov_x += v; fov_x += v;
fov_y -= v; fov_y -= v;
inwater = qtrue; inwater = qtrue;
} else { }
else {
inwater = qfalse; inwater = qfalse;
} }
// set it // set it
cg.refdef.fov_x = fov_x; cg.refdef.fov_x = fov_x;
cg.refdef.fov_y = fov_y; cg.refdef.fov_y = fov_y;
cg.fRefFovXCos = cos(fov_x / 114.0f);
cg.fRefFovXSin = sin(fov_x / 114.0f);
cg.fRefFovYCos = cos(fov_y / 114.0f);
cg.fRefFovYSin = sin(fov_y / 114.0f);
cg.zoomSensitivity = cg.refdef.fov_y / 75.0; cg.zoomSensitivity = cg.refdef.fov_y / 75.0;
return inwater; return inwater;
} }
/*
===============
CG_SetupFog
Prepares fog values for rendering
===============
*/
void CG_SetupFog() {
cg.refdef.farplane_distance = cg.farplane_distance;
cg.refdef.farplane_bias = cg.farplane_bias;
cg.refdef.farplane_color[0] = cg.farplane_color[0];
cg.refdef.farplane_color[1] = cg.farplane_color[1];
cg.refdef.farplane_color[2] = cg.farplane_color[2];
cg.refdef.farplane_cull = cg.farplane_cull;
cg.refdef.skybox_farplane = cg.skyboxFarplane;
cg.refdef.renderTerrain = cg.renderTerrain;
cg.refdef.farclipOverride = cg.farclipOverride;
cg.refdef.farplaneColorOverride[0] = cg.farplaneColorOverride[0];
cg.refdef.farplaneColorOverride[1] = cg.farplaneColorOverride[1];
cg.refdef.farplaneColorOverride[2] = cg.farplaneColorOverride[2];
}
/*
===============
CG_SetupPortalSky
Sets portalsky values for rendering
===============
*/
void CG_SetupPortalSky() {
cg.refdef.sky_alpha = cg.sky_alpha;
cg.refdef.sky_portal = cg.sky_portal;
VectorCopy(cg.sky_axis[0], cg.refdef.sky_axis[0]);
VectorCopy(cg.sky_axis[1], cg.refdef.sky_axis[1]);
VectorCopy(cg.sky_axis[2], cg.refdef.sky_axis[2]);
VectorMA(cg.sky_origin, cg.skyboxSpeed, cg.refdef.vieworg, cg.refdef.sky_origin);
}
/* /*
=============== ===============
@ -575,44 +547,64 @@ static int CG_CalcViewValues(void)
// calculate size of 3D view // calculate size of 3D view
CG_CalcVrect(); CG_CalcVrect();
CG_SetupFog();
// setup fog and far clipping plane
cg.refdef.farplane_distance = cg.farplane_distance;
VectorCopy(cg.farplane_color, cg.refdef.farplane_color);
cg.refdef.farplane_cull = cg.farplane_cull;
// setup portal sky
cg.refdef.sky_alpha = cg.sky_alpha;
cg.refdef.sky_portal = cg.sky_portal;
memcpy(cg.refdef.sky_axis, cg.sky_axis, sizeof(cg.sky_axis));
VectorCopy(cg.sky_origin, cg.refdef.sky_origin);
ps = &cg.predicted_player_state; ps = &cg.predicted_player_state;
VectorCopy(ps->origin, cg.refdef.vieworg); VectorCopy(ps->origin, cg.refdef.vieworg);
VectorCopy(ps->viewangles, cg.refdefViewAngles); VectorCopy(ps->viewangles, cg.refdefViewAngles);
if (cg.snap->ps.stats[STAT_HEALTH] > 0) { if (cg.snap->ps.stats[STAT_HEALTH] > 0)
{
VectorSubtract(cg.refdefViewAngles, cg.predicted_player_state.damage_angles, cg.refdefViewAngles); VectorSubtract(cg.refdefViewAngles, cg.predicted_player_state.damage_angles, cg.refdefViewAngles);
cg.refdefViewAngles[0] += cg.viewkick[0]; cg.refdefViewAngles[0] += cg.viewkick[0];
cg.refdefViewAngles[1] += cg.viewkick[1]; cg.refdefViewAngles[1] += cg.viewkick[1];
if (cg.viewkick[0] || cg.viewkick[1]) { if (cg.viewkick[0] || cg.viewkick[1])
{
int i; int i;
float fDecay; float fDecay;
for (i = 0; i < 2; i++) { for (i = 0; i < 2; i++)
{
fDecay = cg.viewkick[i] * cg.viewkickRecenter; fDecay = cg.viewkick[i] * cg.viewkickRecenter;
if (fDecay > cg.viewkickMaxDecay) { if (fDecay > cg.viewkickMaxDecay)
{
fDecay = cg.viewkickMaxDecay; fDecay = cg.viewkickMaxDecay;
} else if (fDecay < -cg.viewkickMaxDecay) { }
else if (fDecay < -cg.viewkickMaxDecay) {
fDecay = -cg.viewkickMaxDecay; fDecay = -cg.viewkickMaxDecay;
} }
if (fabs(fDecay) < cg.viewkickMinDecay) { if (fabs(fDecay) < cg.viewkickMinDecay)
{
if (fDecay > 0.0) { if (fDecay > 0.0) {
fDecay = cg.viewkickMinDecay; fDecay = cg.viewkickMinDecay;
} else { }
else {
fDecay = -cg.viewkickMinDecay; fDecay = -cg.viewkickMinDecay;
} }
} }
if (cg.viewkick[i] > 0.0) { if (cg.viewkick[i] > 0.0)
{
cg.viewkick[i] -= fDecay * (float)cg.frametime / 1000.0; cg.viewkick[i] -= fDecay * (float)cg.frametime / 1000.0;
if (cg.viewkick[i] < 0.0) { if (cg.viewkick[i] < 0.0) {
cg.viewkick[i] = 0.0; cg.viewkick[i] = 0.0;
} }
} else { }
else
{
cg.viewkick[i] -= fDecay * (float)cg.frametime / 1000.0; cg.viewkick[i] -= fDecay * (float)cg.frametime / 1000.0;
if (cg.viewkick[i] > 0.0) { if (cg.viewkick[i] > 0.0) {
cg.viewkick[i] = 0.0; cg.viewkick[i] = 0.0;
@ -625,15 +617,19 @@ static int CG_CalcViewValues(void)
// FIXME: fffx screen shake on win32 builds? // FIXME: fffx screen shake on win32 builds?
// add error decay // add error decay
if (cg_errorDecay->value > 0) { if (cg_errorDecay->value > 0)
{
int t; int t;
float f; float f;
t = cg.time - cg.predictedErrorTime; t = cg.time - cg.predictedErrorTime;
f = (cg_errorDecay->value - t) / cg_errorDecay->value; f = (cg_errorDecay->value - t) / cg_errorDecay->value;
if (f > 0 && f < 1) { if (f > 0 && f < 1)
{
VectorMA(cg.refdef.vieworg, f, cg.predictedError, cg.refdef.vieworg); VectorMA(cg.refdef.vieworg, f, cg.predictedError, cg.refdef.vieworg);
} else { }
else
{
cg.predictedErrorTime = 0; cg.predictedErrorTime = 0;
} }
} }
@ -649,33 +645,29 @@ static int CG_CalcViewValues(void)
// Set the aural axis of the player // Set the aural axis of the player
VectorCopy(cg.refdefViewAngles, SoundAngles); VectorCopy(cg.refdefViewAngles, SoundAngles);
// yaw is purposely inverted because of the miles sound system // yaw is purposely inverted because of the miles sound system
// Commented out in OPM SoundAngles[YAW] = -SoundAngles[YAW];
// Useless as SDL audio/AL is used
//SoundAngles[YAW] = -SoundAngles[YAW];
AnglesToAxis(SoundAngles, cg.SoundAxis); AnglesToAxis(SoundAngles, cg.SoundAxis);
// decide on third person view // decide on third person view
cg.renderingThirdPerson = cg_3rd_person->integer; cg.renderingThirdPerson = cg_3rd_person->integer;
if (cg.renderingThirdPerson) { if (cg.renderingThirdPerson)
{
// back away from character // back away from character
CG_OffsetThirdPersonView(); CG_OffsetThirdPersonView();
} }
// if we are in a camera view, we take our audio cues directly from the camera // if we are in a camera view, we take our audio cues directly from the camera
if (ps->pm_flags & PMF_CAMERA_VIEW) { if (ps->pm_flags & PMF_CAMERA_VIEW)
{
// Set the aural position to that of the camera // Set the aural position to that of the camera
VectorCopy(cg.camera_origin, cg.refdef.vieworg); VectorCopy(cg.camera_origin, cg.refdef.vieworg);
// Set the aural axis to the camera's angles // Set the aural axis to the camera's angles
VectorCopy(cg.camera_angles, cg.refdefViewAngles); VectorCopy(cg.camera_angles, cg.refdefViewAngles);
if (cg_protocol >= PROTOCOL_MOHTA_MIN && (ps->pm_flags & PMF_DAMAGE_ANGLES)) { if (ps->camera_posofs[0] || ps->camera_posofs[1] || ps->camera_posofs[2])
// Handle camera shake {
VectorSubtract(cg.refdefViewAngles, cg.predicted_player_state.damage_angles, cg.refdefViewAngles);
}
if (ps->camera_posofs[0] || ps->camera_posofs[1] || ps->camera_posofs[2]) {
vec3_t vAxis[3], vOrg; vec3_t vAxis[3], vOrg;
AnglesToAxis(cg.refdefViewAngles, vAxis); AnglesToAxis(cg.refdefViewAngles, vAxis);
MatrixTransformVector(ps->camera_posofs, vAxis, vOrg); MatrixTransformVector(ps->camera_posofs, vAxis, vOrg);
@ -685,9 +677,6 @@ static int CG_CalcViewValues(void)
// copy view values // copy view values
VectorCopy(cg.refdef.vieworg, cg.currentViewPos); VectorCopy(cg.refdef.vieworg, cg.currentViewPos);
VectorCopy(cg.refdefViewAngles, cg.currentViewAngles); VectorCopy(cg.refdefViewAngles, cg.currentViewAngles);
// since 2.0: also copy location data for sound
VectorCopy(cg.refdef.vieworg, cg.SoundOrg);
AnglesToAxis(cg.refdefViewAngles, cg.SoundAxis);
} }
// position eye reletive to origin // position eye reletive to origin
@ -729,73 +718,7 @@ float CG_SensitivityScale()
void CG_AddLightShow() void CG_AddLightShow()
{ {
int i; // FIXME: unimplemented
float fSlopeY, fSlopeZ;
float x, y, z;
vec3_t vOrg;
float r, g, b;
float fMax;
fSlopeY = tan(cg.refdef.fov_x * 0.5);
fSlopeZ = tan(cg.refdef.fov_y * 0.5);
for (i = 0; i < cg_acidtrip->integer; i++) {
x = pow(random(), 1.0 / 3.0) * 2048.0;
y = crandom() * x * fSlopeY;
z = crandom() * x * fSlopeZ;
VectorCopy(cg.refdef.vieworg, vOrg);
VectorMA(vOrg, x, cg.refdef.viewaxis[0], vOrg);
VectorMA(vOrg, y, cg.refdef.viewaxis[1], vOrg);
VectorMA(vOrg, z, cg.refdef.viewaxis[2], vOrg);
r = random();
g = random();
b = random();
fMax = Q_max(r, Q_max(g, b));
r /= fMax;
g /= fMax;
b /= fMax;
cgi.R_AddLightToScene(vOrg, (rand() & 0x1FF) + 0x80, r, g, b, 0);
}
}
qboolean CG_FrustumCullSphere(const vec3_t vPos, float fRadius) {
vec3_t delta;
float fDotFwd, fDotSide, fDotUp;
VectorSubtract(vPos, cg.refdef.vieworg, delta);
fDotFwd = DotProduct(delta, cg.refdef.viewaxis[0]);
if (-fRadius >= fDotFwd) {
return qtrue;
}
if (cg.refdef.farplane_distance && cg.refdef.farplane_distance + fRadius <= fDotFwd) {
return qtrue;
}
fDotSide = DotProduct(delta, cg.refdef.viewaxis[1]);
if (fDotSide < 1.f) {
fDotSide = -fDotSide;
}
if (fDotSide * cg.fRefFovXCos - fDotFwd * cg.fRefFovXSin >= fRadius) {
return qtrue;
}
fDotUp = DotProduct(delta, cg.refdef.viewaxis[2]);
if (fDotUp < 0.f) {
fDotUp = -fDotUp;
}
if (fDotUp * cg.fRefFovYCos - fDotFwd * cg.fRefFovYSin >= fRadius) {
return qtrue;
}
return qfalse;
} }
//========================================================================= //=========================================================================
@ -825,7 +748,8 @@ void CG_DrawActiveFrame(int serverTime, int frameTime, stereoFrame_t stereoView,
// if we haven't received any snapshots yet, all // if we haven't received any snapshots yet, all
// we can draw is the information screen // we can draw is the information screen
if (!cg.snap || (cg.snap->snapFlags & SNAPFLAG_NOT_ACTIVE)) { if (!cg.snap || (cg.snap->snapFlags & SNAPFLAG_NOT_ACTIVE))
{
return; return;
} }
@ -839,23 +763,16 @@ void CG_DrawActiveFrame(int serverTime, int frameTime, stereoFrame_t stereoView,
delta = (cg.nextSnap->serverTime - cg.snap->serverTime); delta = (cg.nextSnap->serverTime - cg.snap->serverTime);
if (delta == 0) { if (delta == 0) {
cg.frameInterpolation = 0; cg.frameInterpolation = 0;
} else { }
else {
cg.frameInterpolation = (float)(cg.time - cg.snap->serverTime) / delta; cg.frameInterpolation = (float)(cg.time - cg.snap->serverTime) / delta;
} }
} else { }
else {
cg.frameInterpolation = 0; // actually, it should never be used, because cg.frameInterpolation = 0; // actually, it should never be used, because
// 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();
@ -863,117 +780,52 @@ void CG_DrawActiveFrame(int serverTime, int frameTime, stereoFrame_t stereoView,
CG_CalcViewValues(); CG_CalcViewValues();
// display the intermission // display the intermission
if (cg.snap->ps.pm_flags & PMF_INTERMISSION) { if (cg.snap->ps.pm_flags & PMF_INTERMISSION)
{
if (cgs.gametype != GT_SINGLE_PLAYER) { if (cgs.gametype != GT_SINGLE_PLAYER) {
CG_ScoresDown_f(); CG_ScoresDown_f();
} else if (cg.bIntermissionDisplay) { }
if (cg.nextSnap) { else if (cg.bIntermissionDisplay)
if (cg_protocol >= PROTOCOL_MOHTA_MIN) {
cvar_t* pMission = cgi.Cvar_Get("g_mission", "", CVAR_ARCHIVE);
if (cgi.Cvar_Get("g_success", "", 0)->integer) {
switch (pMission->integer)
{ {
default: if (cg.nextSnap)
case 0:
cgi.UI_ShowMenu("mission_success_1", 0);
cgi.Cvar_Set("g_t2l1", "1");
break;
case 2:
cgi.UI_ShowMenu("mission_success_2", 0);
cgi.Cvar_Set("g_t3l1", "1");
break;
case 3:
cgi.UI_ShowMenu("mission_success_3", 0);
break;
}
} else {
switch (pMission->integer)
{ {
default:
case 0:
cgi.UI_ShowMenu("mission_failed_1", 0);
break;
case 2:
cgi.UI_ShowMenu("mission_failed_2", 0);
break;
case 3:
cgi.UI_ShowMenu("mission_failed_3", 0);
break;
}
}
} else {
if (cgi.Cvar_Get("g_success", "", 0)->integer) { if (cgi.Cvar_Get("g_success", "", 0)->integer) {
cgi.UI_ShowMenu("StatsScreen_Success", qfalse); cgi.UI_ShowMenu("StatsScreen_Success", qfalse);
} else { } else {
cgi.UI_ShowMenu("StatsScreen_Failed", qfalse); cgi.UI_ShowMenu("StatsScreen_Failed", qfalse);
} }
} }
}
} else { } else {
cgi.SendClientCommand("stats"); cgi.SendClientCommand("stats");
} }
cg.bIntermissionDisplay = qtrue; cg.bIntermissionDisplay = qtrue;
} else if (cg.bIntermissionDisplay) { }
else if (cg.bIntermissionDisplay)
{
if (cgs.gametype != GT_SINGLE_PLAYER) { if (cgs.gametype != GT_SINGLE_PLAYER) {
CG_ScoresUp_f(); CG_ScoresUp_f();
} else { }
if (cg_protocol >= PROTOCOL_MOHTA_MIN) { else
cvar_t* pMission = cgi.Cvar_Get("g_mission", "", CVAR_ARCHIVE);
if (cgi.Cvar_Get("g_success", "", 0)->integer) {
switch (pMission->integer)
{ {
default:
case 0:
cgi.UI_HideMenu("mission_success_1", qtrue);
break;
case 2:
cgi.UI_HideMenu("mission_success_2", qtrue);
break;
case 3:
cgi.UI_HideMenu("mission_success_3", qtrue);
break;
}
} else {
switch (pMission->integer)
{
default:
case 0:
cgi.UI_HideMenu("mission_failed_1", qtrue);
break;
case 2:
cgi.UI_HideMenu("mission_failed_2", qtrue);
break;
case 3:
cgi.UI_HideMenu("mission_failed_3", qtrue);
break;
}
}
} else {
if (cgi.Cvar_Get("g_success", "", 0)->integer) { if (cgi.Cvar_Get("g_success", "", 0)->integer) {
cgi.UI_HideMenu("StatsScreen_Success", qtrue); cgi.UI_ShowMenu("StatsScreen_Success", qfalse);
} else { } else {
cgi.UI_HideMenu("StatsScreen_Failed", qtrue); cgi.UI_ShowMenu("StatsScreen_Failed", qfalse);
}
} }
} }
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
CG_AddMarks(); CG_AddMarks();
} }
// finish up the rest of the refdef // finish up the rest of the refdef
CG_SetupPortalSky();
cg.refdef.time = cg.time; cg.refdef.time = cg.time;
memcpy(cg.refdef.areamask, cg.snap->areamask, sizeof(cg.refdef.areamask)); memcpy(cg.refdef.areamask, cg.snap->areamask, sizeof(cg.refdef.areamask));
@ -989,9 +841,8 @@ void CG_DrawActiveFrame(int serverTime, int frameTime, stereoFrame_t stereoView,
CG_UpdateTestEmitter(); CG_UpdateTestEmitter();
CG_AddPendingEffects(); CG_AddPendingEffects();
if (!cg_hidetempmodels->integer) { if (!cg_hidetempmodels->integer)
CG_AddTempModels(); CG_AddTempModels();
}
if (vss_draw->integer) { if (vss_draw->integer) {
CG_AddVSSSources(); CG_AddVSSSources();
@ -1009,7 +860,9 @@ void CG_DrawActiveFrame(int serverTime, int frameTime, stereoFrame_t stereoView,
// actually issue the rendering calls // actually issue the rendering calls
CG_DrawActive(stereoView); CG_DrawActive(stereoView);
if (cg_stats->integer) { if (cg_stats->integer)
{
cgi.Printf("cg.clientFrame:%i\n", cg.clientFrame); cgi.Printf("cg.clientFrame:%i\n", cg.clientFrame);
} }
} }

View file

@ -26,9 +26,9 @@ 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 const char *AnimPrefixList[] = { static const char* AnimPrefixList[] =
{
"", "",
"unarmed",
"papers", "papers",
"colt45", "colt45",
"p38", "p38",
@ -46,6 +46,7 @@ static const char *AnimPrefixList[] = {
"bazooka", "bazooka",
"panzerschreck", "panzerschreck",
"shotgun", "shotgun",
"unarmed",
// //
// Team Assault and Team Tactics weapons // Team Assault and Team Tactics weapons
"mg42portable", "mg42portable",
@ -59,6 +60,7 @@ static const char *AnimPrefixList[] = {
"enfieldl42a1", "enfieldl42a1",
"carcano", "carcano",
"delisle", "delisle",
"thompson",
"sten", "sten",
"ppsh", "ppsh",
"moschetto", "moschetto",
@ -80,9 +82,9 @@ static const char *AnimPrefixList[] = {
"PIAT" "PIAT"
}; };
enum animPrefix_e { enum animPrefix_e
{
WPREFIX_NONE, WPREFIX_NONE,
WPREFIX_UNARMED,
WPREFIX_PAPERS, WPREFIX_PAPERS,
WPREFIX_COLT45, WPREFIX_COLT45,
WPREFIX_P38, WPREFIX_P38,
@ -100,6 +102,7 @@ enum animPrefix_e {
WPREFIX_BAZOOKA, WPREFIX_BAZOOKA,
WPREFIX_PANZERSCHRECK, WPREFIX_PANZERSCHRECK,
WPREFIX_SHOTGUN, WPREFIX_SHOTGUN,
WPREFIX_UNARMED,
// //
// Team Assault and Team Tactics weapons // Team Assault and Team Tactics weapons
WPREFIX_MG42_PORTABLE, WPREFIX_MG42_PORTABLE,
@ -142,184 +145,148 @@ int CG_GetVMAnimPrefixIndex()
iWeaponClass = cg.snap->ps.stats[STAT_EQUIPPED_WEAPON]; iWeaponClass = cg.snap->ps.stats[STAT_EQUIPPED_WEAPON];
szWeaponName = CG_ConfigString(CS_WEAPONS + cg.snap->ps.activeItems[1]); szWeaponName = CG_ConfigString(CS_WEAPONS + cg.snap->ps.activeItems[1]);
if (iWeaponClass & WEAPON_CLASS_ANY_ITEM) { if (iWeaponClass & WEAPON_CLASS_ANY_ITEM)
if (!Q_stricmp(szWeaponName, "Papers")) { {
if (!Q_stricmp(szWeaponName, "Papers"))
return WPREFIX_PAPERS; return WPREFIX_PAPERS;
} if (!Q_stricmp(szWeaponName, "Packed MG42 Turret"))
if (!Q_stricmp(szWeaponName, "Packed MG42 Turret")) {
return WPREFIX_MG42_PORTABLE; return WPREFIX_MG42_PORTABLE;
} }
} else if (iWeaponClass & WEAPON_CLASS_PISTOL) { else if (iWeaponClass & WEAPON_CLASS_PISTOL)
if (!Q_stricmp(szWeaponName, "Colt 45")) { {
if (!Q_stricmp(szWeaponName, "Colt 45"))
return WPREFIX_COLT45; return WPREFIX_COLT45;
} if (!Q_stricmp(szWeaponName, "Walther P38"))
if (!Q_stricmp(szWeaponName, "Walther P38")) {
return WPREFIX_P38; return WPREFIX_P38;
} if (!Q_stricmp(szWeaponName, "Hi-Standard Silenced"))
if (!Q_stricmp(szWeaponName, "Hi-Standard Silenced")) {
return WPREFIX_HISTANDARD; return WPREFIX_HISTANDARD;
}
// //
// Team Assault and Team Tactics // Team Assault and Team Tactics
// //
if (!Q_stricmp(szWeaponName, "Webley Revolver")) { if (!Q_stricmp(szWeaponName, "Webley Revolver"))
return WPREFIX_WEBLEY; return WPREFIX_WEBLEY;
} if (!Q_stricmp(szWeaponName, "Nagant Revolver"))
if (!Q_stricmp(szWeaponName, "Nagant Revolver")) {
return WPREFIX_NAGANTREV; return WPREFIX_NAGANTREV;
} if (!Q_stricmp(szWeaponName, "Beretta"))
if (!Q_stricmp(szWeaponName, "Beretta")) {
return WPREFIX_BERETTA; return WPREFIX_BERETTA;
}
return WPREFIX_COLT45; return WPREFIX_COLT45;
} else if (iWeaponClass & WEAPON_CLASS_RIFLE) {
if (!Q_stricmp(szWeaponName, "M1 Garand")) {
return WPREFIX_GARAND;
} }
if (!Q_stricmp(szWeaponName, "Mauser KAR 98K")) { else if (iWeaponClass & WEAPON_CLASS_RIFLE)
{
if (!Q_stricmp(szWeaponName, "M1 Garand"))
return WPREFIX_GARAND;
if (!Q_stricmp(szWeaponName, "Mauser KAR 98K"))
return WPREFIX_KAR98; return WPREFIX_KAR98;
} if (!Q_stricmp(szWeaponName, "KAR98 - Sniper"))
if (!Q_stricmp(szWeaponName, "KAR98 - Sniper")) {
return WPREFIX_KAR98SNIPER; return WPREFIX_KAR98SNIPER;
} if (!Q_stricmp(szWeaponName, "Springfield '03 Sniper"))
if (!Q_stricmp(szWeaponName, "Springfield '03 Sniper")) {
return WPREFIX_SPRINGFIELD; return WPREFIX_SPRINGFIELD;
}
// //
// Team Assault and Team Tactics // Team Assault and Team Tactics
// //
if (!Q_stricmp(szWeaponName, "Lee-Enfield")) { if (!Q_stricmp(szWeaponName, "Lee-Enfield"))
return WPREFIX_ENFIELD; return WPREFIX_SPRINGFIELD;
} if (!Q_stricmp(szWeaponName, "SVT 40"))
if (!Q_stricmp(szWeaponName, "SVT 40")) {
return WPREFIX_SVT; return WPREFIX_SVT;
} if (!Q_stricmp(szWeaponName, "Mosin Nagant Rifle"))
if (!Q_stricmp(szWeaponName, "Mosin Nagant Rifle")) {
return WPREFIX_MOSIN; return WPREFIX_MOSIN;
} if (!Q_stricmp(szWeaponName, "G 43"))
if (!Q_stricmp(szWeaponName, "G 43")) {
return WPREFIX_G43; return WPREFIX_G43;
} if (!Q_stricmp(szWeaponName, "Enfield L42A1"))
if (!Q_stricmp(szWeaponName, "Enfield L42A1")) { return WPREFIX_ENFIELD;
return WPREFIX_ENFIELDL42A; if (!Q_stricmp(szWeaponName, "Carcano"))
}
if (!Q_stricmp(szWeaponName, "Carcano")) {
return WPREFIX_CARCANO; return WPREFIX_CARCANO;
} if (!Q_stricmp(szWeaponName, "DeLisle"))
if (!Q_stricmp(szWeaponName, "DeLisle")) {
return WPREFIX_DELISLE; return WPREFIX_DELISLE;
}
return WPREFIX_GARAND; return WPREFIX_GARAND;
} else if (iWeaponClass & WEAPON_CLASS_SMG) {
if (!Q_stricmp(szWeaponName, "Thompson")) {
return WPREFIX_THOMPSON;
} }
if (!Q_stricmp(szWeaponName, "MP40")) { else if (iWeaponClass & WEAPON_CLASS_SMG)
{
if (!Q_stricmp(szWeaponName, "Thompson"))
return WPREFIX_THOMPSON;
if (!Q_stricmp(szWeaponName, "MP40"))
return WPREFIX_MP40; return WPREFIX_MP40;
}
// //
// Team Assault and Team Tactics // Team Assault and Team Tactics
// //
if (!Q_stricmp(szWeaponName, "Sten Mark II")) { if (!Q_stricmp(szWeaponName, "Sten Mark II"))
return WPREFIX_STEN; return WPREFIX_STEN;
} if (!Q_stricmp(szWeaponName, "PPSH SMG"))
if (!Q_stricmp(szWeaponName, "PPSH SMG")) {
return WPREFIX_PPSH; return WPREFIX_PPSH;
} if (!Q_stricmp(szWeaponName, "Moschetto"))
if (!Q_stricmp(szWeaponName, "Moschetto")) {
return WPREFIX_MOSCHETTO; return WPREFIX_MOSCHETTO;
}
return WPREFIX_THOMPSON; return WPREFIX_THOMPSON;
} else if (iWeaponClass & WEAPON_CLASS_MG) { }
if (!Q_stricmp(szWeaponName, "BAR")) { else if (iWeaponClass & WEAPON_CLASS_MG)
{
if (!Q_stricmp(szWeaponName, "BAR"))
return WPREFIX_BAR; return WPREFIX_BAR;
} if (!Q_stricmp(szWeaponName, "StG 44"))
if (!Q_stricmp(szWeaponName, "StG 44")) {
return WPREFIX_MP44; return WPREFIX_MP44;
}
// //
// Team Assault and Team Tactics // Team Assault and Team Tactics
// //
if (!Q_stricmp(szWeaponName, "FG 42")) { if (!Q_stricmp(szWeaponName, "FG 42"))
return WPREFIX_MP44;
if (!Q_stricmp(szWeaponName, "Vickers-Berthier"))
return WPREFIX_MP44;
if (!Q_stricmp(szWeaponName, "Breda"))
return WPREFIX_MP44; return WPREFIX_MP44;
}
if (!Q_stricmp(szWeaponName, "Vickers-Berthier")) {
return WPREFIX_VICKERS;
}
if (!Q_stricmp(szWeaponName, "Breda")) {
return WPREFIX_BREDA;
}
return WPREFIX_BAR; return WPREFIX_BAR;
} else if (iWeaponClass & WEAPON_CLASS_GRENADE) {
if (!Q_stricmp(szWeaponName, "Frag Grenade")) {
return WPREFIX_FRAGGRENADE;
} }
if (!Q_stricmp(szWeaponName, "Stielhandgranate")) { else if (iWeaponClass & WEAPON_CLASS_GRENADE)
{
if (!Q_stricmp(szWeaponName, "Frag Grenade"))
return WPREFIX_FRAGGRENADE;
if (!Q_stricmp(szWeaponName, "Stielhandgranate"))
return WPREFIX_STIELHANDGRANATE; return WPREFIX_STIELHANDGRANATE;
}
// //
// Team Assault and Team Tactics // Team Assault and Team Tactics
// //
if (!Q_stricmp(szWeaponName, "F1 Grenade")) { if (!Q_stricmp(szWeaponName, "F1 Grenade"))
return WPREFIX_F1_GRENADE; return WPREFIX_F1_GRENADE;
} if (!Q_stricmp(szWeaponName, "Mills Grenade"))
if (!Q_stricmp(szWeaponName, "Mills Grenade")) {
return WPREFIX_MILLS_GRENADE; return WPREFIX_MILLS_GRENADE;
} if (!Q_stricmp(szWeaponName, "Nebelhandgranate"))
if (!Q_stricmp(szWeaponName, "Nebelhandgranate")) {
return WPREFIX_NEBELHANDGRANATE; return WPREFIX_NEBELHANDGRANATE;
} if (!Q_stricmp(szWeaponName, "M18 Smoke Grenade"))
if (!Q_stricmp(szWeaponName, "M18 Smoke Grenade")) {
return WPREFIX_M18_SMOKE_GRENADE; return WPREFIX_M18_SMOKE_GRENADE;
} if (!Q_stricmp(szWeaponName, "RDG-1 Smoke Grenade"))
if (!Q_stricmp(szWeaponName, "RDG-1 Smoke Grenade")) {
return WPREFIX_RDG1_SMOKE_GRENADE; return WPREFIX_RDG1_SMOKE_GRENADE;
} if (!Q_stricmp(szWeaponName, "Bomba A Mano"))
if (!Q_stricmp(szWeaponName, "Bomba A Mano")) {
return WPREFIX_BOMBA; return WPREFIX_BOMBA;
} if (!Q_stricmp(szWeaponName, "Bomba A Mano Breda"))
if (!Q_stricmp(szWeaponName, "Bomba A Mano Breda")) {
return WPREFIX_BOMBA_BREDA; return WPREFIX_BOMBA_BREDA;
} if (!Q_stricmp(szWeaponName, "LandmineAllies"))
if (!Q_stricmp(szWeaponName, "LandmineAllies")) {
return WPREFIX_MINE; return WPREFIX_MINE;
} if (!Q_stricmp(szWeaponName, "LandmineAxis"))
if (!Q_stricmp(szWeaponName, "LandmineAxis")) {
return WPREFIX_MINE; return WPREFIX_MINE;
} if (!Q_stricmp(szWeaponName, "Minensuchgerat"))
if (!Q_stricmp(szWeaponName, "Minensuchgerat")) {
return WPREFIX_MINE_DETECTOR_AXIS; return WPREFIX_MINE_DETECTOR_AXIS;
} if (!Q_stricmp(szWeaponName, "Minedetector"))
if (!Q_stricmp(szWeaponName, "Minedetector")) {
return WPREFIX_MINE_DETECTOR; return WPREFIX_MINE_DETECTOR;
}
return WPREFIX_FRAGGRENADE; return WPREFIX_FRAGGRENADE;
} else if (iWeaponClass & WEAPON_CLASS_HEAVY) { }
if (!Q_stricmp(szWeaponName, "Bazooka")) { else if (iWeaponClass & WEAPON_CLASS_HEAVY)
{
if (!Q_stricmp(szWeaponName, "Bazooka"))
return WPREFIX_BAZOOKA; return WPREFIX_BAZOOKA;
} if (!Q_stricmp(szWeaponName, "Panzerschreck"))
if (!Q_stricmp(szWeaponName, "Panzerschreck")) {
return WPREFIX_PANZERSCHRECK; return WPREFIX_PANZERSCHRECK;
} if (!Q_stricmp(szWeaponName, "Shotgun"))
if (!Q_stricmp(szWeaponName, "Gewehrgranate")) {
return WPREFIX_KAR98_MORTAR;
}
if (!Q_stricmp(szWeaponName, "Shotgun")) {
return WPREFIX_SHOTGUN; return WPREFIX_SHOTGUN;
}
// //
// Team Assault and Team Tactics // Team Assault and Team Tactics
// //
if (!Q_stricmp(szWeaponName, "PIAT")) { if (!Q_stricmp(szWeaponName, "PIAT"))
return WPREFIX_PIAT; return WPREFIX_PIAT;
}
return WPREFIX_BAZOOKA; return WPREFIX_BAZOOKA;
} }
@ -338,31 +305,32 @@ void CG_ViewModelAnimation(refEntity_t *pModel)
char szAnimName[MAX_QPATH]; char szAnimName[MAX_QPATH];
dtiki_t* pTiki; dtiki_t* pTiki;
qboolean bAnimChanged; qboolean bAnimChanged;
qboolean bWeaponChanged;
fCrossblendFrac = 0.0; fCrossblendFrac = 0.0;
bAnimChanged = qfalse; bAnimChanged = 0;
bWeaponChanged = qfalse; // Added in OPM
pTiki = pModel->tiki; pTiki = pModel->tiki;
if (cgi.anim->g_iLastEquippedWeaponStat == cg.snap->ps.stats[STAT_EQUIPPED_WEAPON] if (cgi.anim->g_iLastEquippedWeaponStat == cg.snap->ps.stats[STAT_EQUIPPED_WEAPON]
&& !strcmp(cgi.anim->g_szLastActiveItem, CG_ConfigString(CS_WEAPONS + cg.snap->ps.activeItems[1]))) { && !strcmp(cgi.anim->g_szLastActiveItem, CG_ConfigString(CS_WEAPONS + cg.snap->ps.activeItems[1])))
{
iAnimPrefixIndex = cgi.anim->g_iLastAnimPrefixIndex; iAnimPrefixIndex = cgi.anim->g_iLastAnimPrefixIndex;
} else { }
else
{
iAnimPrefixIndex = CG_GetVMAnimPrefixIndex(); iAnimPrefixIndex = CG_GetVMAnimPrefixIndex();
cgi.anim->g_iLastEquippedWeaponStat = cg.snap->ps.stats[STAT_EQUIPPED_WEAPON]; cgi.anim->g_iLastEquippedWeaponStat = cg.snap->ps.stats[STAT_EQUIPPED_WEAPON];
Q_strncpyz(cgi.anim->g_szLastActiveItem, CG_ConfigString(CS_WEAPONS + cg.snap->ps.activeItems[1]), sizeof(cgi.anim->g_szLastActiveItem)); strcpy(cgi.anim->g_szLastActiveItem, CG_ConfigString(CS_WEAPONS + cg.snap->ps.activeItems[1]));
cgi.anim->g_iLastAnimPrefixIndex = iAnimPrefixIndex; cgi.anim->g_iLastAnimPrefixIndex = iAnimPrefixIndex;
bAnimChanged = qtrue; bAnimChanged = qtrue;
bWeaponChanged = qtrue;
} }
if (cgi.anim->g_iLastVMAnim == -1) { if (cgi.anim->g_iLastVMAnim == -1)
Com_sprintf(szAnimName, sizeof(szAnimName), "%s_idle", AnimPrefixList[iAnimPrefixIndex]); {
sprintf(szAnimName, "%s_idle", AnimPrefixList[iAnimPrefixIndex]);
cgi.anim->g_VMFrameInfo[cgi.anim->g_iCurrentVMAnimSlot].index = cgi.Anim_NumForName(pTiki, szAnimName); cgi.anim->g_VMFrameInfo[cgi.anim->g_iCurrentVMAnimSlot].index = cgi.Anim_NumForName(pTiki, szAnimName);
if (cgi.anim->g_VMFrameInfo[cgi.anim->g_iCurrentVMAnimSlot].index == -1) { if (cgi.anim->g_VMFrameInfo[cgi.anim->g_iCurrentVMAnimSlot].index == -1)
{
cgi.anim->g_VMFrameInfo[cgi.anim->g_iCurrentVMAnimSlot].index = cgi.Anim_NumForName(pTiki, "idle"); cgi.anim->g_VMFrameInfo[cgi.anim->g_iCurrentVMAnimSlot].index = cgi.Anim_NumForName(pTiki, "idle");
cgi.DPrintf("Warning: Couldn't find view model animation %s\n", szAnimName); cgi.DPrintf("Warning: Couldn't find view model animation %s\n", szAnimName);
} }
@ -372,14 +340,17 @@ void CG_ViewModelAnimation(refEntity_t *pModel)
cgi.anim->g_iLastVMAnim = 0; cgi.anim->g_iLastVMAnim = 0;
} }
if (cg.snap->ps.iViewModelAnimChanged != cgi.anim->g_iLastVMAnimChanged) { if (cg.snap->ps.iViewModelAnimChanged != cgi.anim->g_iLastVMAnimChanged)
{
bAnimChanged = qtrue; bAnimChanged = qtrue;
cgi.anim->g_iLastVMAnim = cg.snap->ps.iViewModelAnim; cgi.anim->g_iLastVMAnim = cg.snap->ps.iViewModelAnim;
cgi.anim->g_iLastVMAnimChanged = cg.snap->ps.iViewModelAnimChanged; cgi.anim->g_iLastVMAnimChanged = cg.snap->ps.iViewModelAnimChanged;
} }
if (bAnimChanged) { if (bAnimChanged)
switch (cgi.anim->g_iLastVMAnim) { {
switch (cgi.anim->g_iLastVMAnim)
{
case VM_ANIM_CHARGE: case VM_ANIM_CHARGE:
pszAnimSuffix = "charge"; pszAnimSuffix = "charge";
break; break;
@ -428,34 +399,32 @@ void CG_ViewModelAnimation(refEntity_t *pModel)
break; break;
} }
Com_sprintf(szAnimName, sizeof(szAnimName), "%s_%s", AnimPrefixList[iAnimPrefixIndex], pszAnimSuffix); sprintf(szAnimName, "%s_%s", AnimPrefixList[iAnimPrefixIndex], pszAnimSuffix);
if (!bWeaponChanged) { fCrossblendTime = cgi.Anim_CrossblendTime(pTiki, cgi.anim->g_VMFrameInfo[cgi.anim->g_iCurrentVMAnimSlot].index);
fCrossblendTime =
cgi.Anim_CrossblendTime(pTiki, cgi.anim->g_VMFrameInfo[cgi.anim->g_iCurrentVMAnimSlot].index);
fCrossblendAmount = cgi.anim->g_iCurrentVMDuration / 1000.0; fCrossblendAmount = cgi.anim->g_iCurrentVMDuration / 1000.0;
if (fCrossblendAmount < fCrossblendTime && fCrossblendAmount > 0.0) { if (fCrossblendAmount < fCrossblendTime && fCrossblendAmount > 0.0)
{
fCrossblendFrac = fCrossblendAmount / fCrossblendTime; fCrossblendFrac = fCrossblendAmount / fCrossblendTime;
for (i = 0; i < MAX_FRAMEINFOS; ++i) { for (i = 0; i < MAX_FRAMEINFOS; ++i)
if (cgi.anim->g_VMFrameInfo[i].weight) { {
if (cgi.anim->g_VMFrameInfo[i].weight)
{
if (i == cgi.anim->g_iCurrentVMAnimSlot) { if (i == cgi.anim->g_iCurrentVMAnimSlot) {
cgi.anim->g_VMFrameInfo[i].weight = fCrossblendFrac; cgi.anim->g_VMFrameInfo[i].weight = fCrossblendFrac;
} else { }
else {
cgi.anim->g_VMFrameInfo[i].weight *= (1.0 - fCrossblendFrac); cgi.anim->g_VMFrameInfo[i].weight *= (1.0 - fCrossblendFrac);
} }
} }
} }
} }
} else {
fCrossblendTime = 0;
fCrossblendAmount = 0;
fCrossblendFrac = 0;
}
cgi.anim->g_iCurrentVMAnimSlot = (cgi.anim->g_iCurrentVMAnimSlot + 1) % MAX_FRAMEINFOS; cgi.anim->g_iCurrentVMAnimSlot = (cgi.anim->g_iCurrentVMAnimSlot + 1) % MAX_FRAMEINFOS;
cgi.anim->g_VMFrameInfo[cgi.anim->g_iCurrentVMAnimSlot].index = cgi.Anim_NumForName(pTiki, szAnimName); cgi.anim->g_VMFrameInfo[cgi.anim->g_iCurrentVMAnimSlot].index = cgi.Anim_NumForName(pTiki, szAnimName);
if (cgi.anim->g_VMFrameInfo[cgi.anim->g_iCurrentVMAnimSlot].index == -1) { if (cgi.anim->g_VMFrameInfo[cgi.anim->g_iCurrentVMAnimSlot].index == -1)
{
cgi.anim->g_VMFrameInfo[cgi.anim->g_iCurrentVMAnimSlot].index = cgi.Anim_NumForName(pTiki, "idle"); cgi.anim->g_VMFrameInfo[cgi.anim->g_iCurrentVMAnimSlot].index = cgi.Anim_NumForName(pTiki, "idle");
cgi.DPrintf("Warning: Couldn't find view model animation %s\n", szAnimName); cgi.DPrintf("Warning: Couldn't find view model animation %s\n", szAnimName);
} }
@ -464,84 +433,84 @@ void CG_ViewModelAnimation(refEntity_t *pModel)
cgi.anim->g_VMFrameInfo[cgi.anim->g_iCurrentVMAnimSlot].weight = 1.0; cgi.anim->g_VMFrameInfo[cgi.anim->g_iCurrentVMAnimSlot].weight = 1.0;
cgi.anim->g_iCurrentVMDuration = 0; cgi.anim->g_iCurrentVMDuration = 0;
if (!bWeaponChanged) { fCrossblendTime = cgi.Anim_CrossblendTime(pTiki, cgi.anim->g_VMFrameInfo[cgi.anim->g_iCurrentVMAnimSlot].index);
fCrossblendTime = if (!fCrossblendTime)
cgi.Anim_CrossblendTime(pTiki, cgi.anim->g_VMFrameInfo[cgi.anim->g_iCurrentVMAnimSlot].index); {
if (!fCrossblendTime) { for (i = 0; i < MAX_FRAMEINFOS; ++i)
for (i = 0; i < MAX_FRAMEINFOS; ++i) { {
if (i != cgi.anim->g_iCurrentVMAnimSlot) { if (i != cgi.anim->g_iCurrentVMAnimSlot) {
cgi.anim->g_VMFrameInfo[i].weight = 0.0; cgi.anim->g_VMFrameInfo[i].weight = 0.0;
} }
} }
cgi.anim->g_bCrossblending = qfalse; cgi.anim->g_bCrossblending = qfalse;
} else { }
else
{
cgi.anim->g_bCrossblending = qtrue; cgi.anim->g_bCrossblending = qtrue;
} }
} else {
// Added in OPM
// If there is a new weapon, don't do any crossblend
cgi.anim->g_bCrossblending = qfalse;
// clear crossblend values
for (i = 0; i < MAX_FRAMEINFOS; ++i) {
if (i != cgi.anim->g_iCurrentVMAnimSlot) {
cgi.anim->g_VMFrameInfo[i].weight = 0.0;
}
}
}
} }
cgi.anim->g_iCurrentVMDuration += cg.frametime; cgi.anim->g_iCurrentVMDuration += cg.frametime;
if (cgi.anim->g_bCrossblending) { if (cgi.anim->g_bCrossblending)
{
fCrossblendTime = cgi.Anim_CrossblendTime(pTiki, cgi.anim->g_VMFrameInfo[cgi.anim->g_iCurrentVMAnimSlot].index); fCrossblendTime = cgi.Anim_CrossblendTime(pTiki, cgi.anim->g_VMFrameInfo[cgi.anim->g_iCurrentVMAnimSlot].index);
fCrossblendAmount = cgi.anim->g_iCurrentVMDuration / 1000.0; fCrossblendAmount = cgi.anim->g_iCurrentVMDuration / 1000.0;
if (fCrossblendAmount >= fCrossblendTime || fCrossblendAmount <= 0.0) { if (fCrossblendAmount >= fCrossblendTime || fCrossblendAmount <= 0.0)
{
// clear crossblend values // clear crossblend values
for (i = 0; i < MAX_FRAMEINFOS; ++i) { for (i = 0; i < MAX_FRAMEINFOS; ++i)
{
if (i != cgi.anim->g_iCurrentVMAnimSlot) { if (i != cgi.anim->g_iCurrentVMAnimSlot) {
cgi.anim->g_VMFrameInfo[i].weight = 0.0; cgi.anim->g_VMFrameInfo[i].weight = 0.0;
} }
} }
cgi.anim->g_bCrossblending = qfalse; cgi.anim->g_bCrossblending = qfalse;
} else { }
else {
fCrossblendFrac = fCrossblendAmount / fCrossblendTime; fCrossblendFrac = fCrossblendAmount / fCrossblendTime;
} }
} }
for (i = 0; i < MAX_FRAMEINFOS; ++i) { for (i = 0; i < MAX_FRAMEINFOS; ++i)
if (!cgi.anim->g_VMFrameInfo[i].weight) { {
if (!cgi.anim->g_VMFrameInfo[i].weight)
{
// clear the weight values of the ref entity // clear the weight values of the ref entity
pModel->frameInfo[i].index = 0; pModel->frameInfo[i].index = 0;
pModel->frameInfo[i].time = 0.0; pModel->frameInfo[i].time = 0.0;
pModel->frameInfo[i].weight = 0.0; pModel->frameInfo[i].weight = 0.0;
} else { }
else
{
fAnimLength = cgi.Anim_Time(pTiki, cgi.anim->g_VMFrameInfo[i].index); fAnimLength = cgi.Anim_Time(pTiki, cgi.anim->g_VMFrameInfo[i].index);
cgi.anim->g_VMFrameInfo[i].time += cg.frametime / 1000.0; cgi.anim->g_VMFrameInfo[i].time += cg.frametime / 1000.0;
if (cgi.anim->g_VMFrameInfo[i].time > fAnimLength) { if (cgi.anim->g_VMFrameInfo[i].time > fAnimLength)
if (pTiki) { {
if (cgi.Anim_Flags(pTiki, cgi.anim->g_VMFrameInfo[i].index) & TAF_DELTADRIVEN) { if (cgi.Anim_Flags(pTiki, cgi.anim->g_VMFrameInfo[i].index) & TAF_DELTADRIVEN) {
cgi.anim->g_VMFrameInfo[i].time -= fAnimLength; cgi.anim->g_VMFrameInfo[i].time -= fAnimLength;
} else {
cgi.anim->g_VMFrameInfo[i].time = fAnimLength;
} }
} else { else {
cgi.anim->g_VMFrameInfo[i].time = 0.f; cgi.anim->g_VMFrameInfo[i].time = fAnimLength;
} }
} }
pModel->frameInfo[i].index = cgi.anim->g_VMFrameInfo[i].index; pModel->frameInfo[i].index = cgi.anim->g_VMFrameInfo[i].index;
pModel->frameInfo[i].time = cgi.anim->g_VMFrameInfo[i].time; pModel->frameInfo[i].time = cgi.anim->g_VMFrameInfo[i].time;
if (cgi.anim->g_bCrossblending) { if (cgi.anim->g_bCrossblending)
{
if (i == cgi.anim->g_iCurrentVMAnimSlot) { if (i == cgi.anim->g_iCurrentVMAnimSlot) {
pModel->frameInfo[i].weight = fCrossblendFrac; pModel->frameInfo[i].weight = fCrossblendFrac;
} else {
pModel->frameInfo[i].weight = cgi.anim->g_VMFrameInfo[i].weight * (1.0 - fCrossblendFrac);
} }
} else { else {
pModel->frameInfo[i].weight *= (1.0 - fCrossblendFrac);
}
}
else
{
pModel->frameInfo[i].weight = 1.0; pModel->frameInfo[i].weight = 1.0;
} }
} }
@ -564,34 +533,46 @@ void CG_CalcViewModelMovement(float fViewBobPhase, float fViewBobAmp, vec_t *vVe
fPhase = sin(fViewBobPhase - 0.94 + fViewBobPhase - 0.94 + M_PI); fPhase = sin(fViewBobPhase - 0.94 + fViewBobPhase - 0.94 + M_PI);
vMovement[2] = (sin((fViewBobPhase - 0.94) * 4.0 + M_PI / 2) * 0.125 + fPhase) * fViewBobAmp * vm_sway_up->value; vMovement[2] = (sin((fViewBobPhase - 0.94) * 4.0 + M_PI / 2) * 0.125 + fPhase) * fViewBobAmp * vm_sway_up->value;
if (cg.predicted_player_state.walking) { if (cg.predicted_player_state.walking)
if (cg.predicted_player_state.viewheight == CROUCH_EYE_HEIGHT) { {
if (cgi.anim->g_iLastAnimPrefixIndex == WPREFIX_BAZOOKA if (cg.predicted_player_state.viewheight == CROUCH_EYE_HEIGHT)
|| cgi.anim->g_iLastAnimPrefixIndex == WPREFIX_PANZERSCHRECK) { {
if (cgi.anim->g_iLastAnimPrefixIndex == WPREFIX_BAZOOKA || cgi.anim->g_iLastAnimPrefixIndex == WPREFIX_PANZERSCHRECK)
{
vTargOfs[0] = vm_offset_rocketcrouch_front->value; vTargOfs[0] = vm_offset_rocketcrouch_front->value;
vTargOfs[1] = vm_offset_rocketcrouch_side->value; vTargOfs[1] = vm_offset_rocketcrouch_side->value;
vTargOfs[2] = vm_offset_rocketcrouch_up->value; vTargOfs[2] = vm_offset_rocketcrouch_up->value;
} else if (cgi.anim->g_iLastAnimPrefixIndex == WPREFIX_SHOTGUN) { }
else if (cgi.anim->g_iLastAnimPrefixIndex == WPREFIX_SHOTGUN)
{
vTargOfs[0] = vm_offset_shotguncrouch_front->value; vTargOfs[0] = vm_offset_shotguncrouch_front->value;
vTargOfs[1] = vm_offset_shotguncrouch_side->value; vTargOfs[1] = vm_offset_shotguncrouch_side->value;
vTargOfs[2] = vm_offset_shotguncrouch_up->value; vTargOfs[2] = vm_offset_shotguncrouch_up->value;
} else { }
else
{
vTargOfs[0] = vm_offset_crouch_front->value; vTargOfs[0] = vm_offset_crouch_front->value;
vTargOfs[1] = vm_offset_crouch_side->value; vTargOfs[1] = vm_offset_crouch_side->value;
vTargOfs[2] = vm_offset_crouch_up->value; vTargOfs[2] = vm_offset_crouch_up->value;
} }
} else { }
else
{
memset(vTargOfs, 0, sizeof(vTargOfs)); memset(vTargOfs, 0, sizeof(vTargOfs));
} }
} else { }
else
{
vTargOfs[0] = vm_offset_air_front->value; vTargOfs[0] = vm_offset_air_front->value;
vTargOfs[1] = vm_offset_air_side->value; vTargOfs[1] = vm_offset_air_side->value;
vTargOfs[2] = vm_offset_air_up->value; vTargOfs[2] = vm_offset_air_up->value;
} }
if (cg.predicted_player_state.walking) { if (cg.predicted_player_state.walking)
{
fDelta = VectorLength(vVelocity) - vm_offset_vel_base->value; fDelta = VectorLength(vVelocity) - vm_offset_vel_base->value;
if (fDelta > 0.0) { if (fDelta > 0.0)
{
if (fDelta > 250.0 - vm_offset_vel_base->value) { if (fDelta > 250.0 - vm_offset_vel_base->value) {
fDelta = 250.0 - vm_offset_vel_base->value; fDelta = 250.0 - vm_offset_vel_base->value;
} }
@ -601,19 +582,23 @@ void CG_CalcViewModelMovement(float fViewBobPhase, float fViewBobAmp, vec_t *vVe
vTargOfs[1] += fPhase * vm_offset_vel_side->value; vTargOfs[1] += fPhase * vm_offset_vel_side->value;
vTargOfs[2] += fPhase * vm_offset_vel_up->value; vTargOfs[2] += fPhase * vm_offset_vel_up->value;
} }
} else if (vVelocity[2]) { }
else if (vVelocity[2]) {
vTargOfs[2] -= vVelocity[2] * vm_offset_upvel->value; vTargOfs[2] -= vVelocity[2] * vm_offset_upvel->value;
} }
for (i = 0; i < 3; i++) { for (i = 0; i < 3; i++)
{
fDelta = vTargOfs[i] - cgi.anim->g_vCurrentVMPosOffset[i]; fDelta = vTargOfs[i] - cgi.anim->g_vCurrentVMPosOffset[i];
cgi.anim->g_vCurrentVMPosOffset[i] += cg.frametime / 1000.0 * fDelta * vm_offset_speed->value; cgi.anim->g_vCurrentVMPosOffset[i] += cg.frametime / 1000.0 * fDelta * vm_offset_speed->value;
if (fDelta > 0.0) { if (fDelta > 0.0)
{
if (cgi.anim->g_vCurrentVMPosOffset[i] > vTargOfs[i]) { if (cgi.anim->g_vCurrentVMPosOffset[i] > vTargOfs[i]) {
cgi.anim->g_vCurrentVMPosOffset[i] = vTargOfs[i]; cgi.anim->g_vCurrentVMPosOffset[i] = vTargOfs[i];
} }
} else if (fDelta < 0.0) { }
else if (fDelta < 0.0) {
if (cgi.anim->g_vCurrentVMPosOffset[i] < vTargOfs[i]) { if (cgi.anim->g_vCurrentVMPosOffset[i] < vTargOfs[i]) {
cgi.anim->g_vCurrentVMPosOffset[i] = vTargOfs[i]; cgi.anim->g_vCurrentVMPosOffset[i] = vTargOfs[i];
} }

File diff suppressed because it is too large Load diff

View file

@ -1,241 +0,0 @@
/*
===========================================================================
Copyright (C) 2023 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 "cg_local.h"
#include "memarchiver.h"
#include "../qcommon/vector.h"
#include "../qcommon/str.h"
MemArchiver::MemArchiver()
{
state = MEMARC_WRITING;
buffer = 0;
allocatedSize = 0;
bufferSize = 0;
}
MemArchiver::~MemArchiver()
{
if (state == MEMARC_WRITING && buffer) {
cgi.Free(buffer);
}
}
void MemArchiver::SetupForWriting(size_t initialSize)
{
this->state = MEMARC_WRITING;
this->buffer = (byte*)cgi.Malloc(initialSize);
this->allocatedSize = initialSize;
this->bufferSize = 0;
}
void MemArchiver::SetupForReading(byte* buffer, size_t size)
{
this->state = MEMARC_READING;
this->buffer = buffer;
this->allocatedSize = size;
this->bufferSize = 0;
}
void MemArchiver::SetBaseTime(unsigned int time)
{
this->svsTime = time;
}
size_t MemArchiver::BufferSize() const
{
return bufferSize;
}
byte* MemArchiver::ConfiscateBuffer()
{
byte* confiscatedBuffer = buffer;
buffer = NULL;
allocatedSize = 0;
bufferSize = 0;
return confiscatedBuffer;
}
bool MemArchiver::IsReading() const
{
return !IsWriting();
}
bool MemArchiver::IsWriting() const
{
return state == MEMARC_WRITING;
}
bool MemArchiver::FinishedReading() const
{
return bufferSize == allocatedSize;
}
void MemArchiver::ArchiveByte(byte* value)
{
ArchiveRaw(value, sizeof(byte));
}
void MemArchiver::ArchiveBoolean(qboolean* value)
{
ArchiveRaw(value, sizeof(qboolean));
}
void MemArchiver::ArchiveChar(char* value)
{
ArchiveRaw(value, sizeof(char));
}
void MemArchiver::ArchiveUChar(unsigned char* value)
{
ArchiveRaw(value, sizeof(unsigned char));
}
void MemArchiver::ArchiveShort(short* value)
{
ArchiveRaw(value, sizeof(short));
}
void MemArchiver::ArchiveInteger(int* value)
{
ArchiveRaw(value, sizeof(int));
}
void MemArchiver::ArchiveSize(size_t* value)
{
ArchiveRaw(value, sizeof(size_t));
}
void MemArchiver::ArchiveFloat(float* value)
{
ArchiveRaw(value, sizeof(float));
}
void MemArchiver::ArchiveVec3(vec3_t value)
{
ArchiveRaw(value, sizeof(vec3_t));
}
void MemArchiver::ArchiveVector(Vector* value)
{
ArchiveFloat(&value->x);
ArchiveFloat(&value->y);
ArchiveFloat(&value->z);
}
void MemArchiver::ArchiveString(str* value)
{
char tmp[4096];
int current = 0;
if (IsReading()) {
for (current = 0; current < 4096; current++) {
ArchiveReadRaw(&tmp[current], sizeof(char));
if (!tmp[current]) {
break;
}
}
if (current == 4096) {
tmp[current - 1] = 0;
}
*value = tmp;
} else {
ArchiveWriteRaw(value->c_str(), value->length() + 1);
}
}
void MemArchiver::ArchiveTime(int* value)
{
int time;
if (IsReading()) {
ArchiveReadRaw(&time, sizeof(time));
if (time) {
time += svsTime;
}
*value = time;
} else {
time = *value;
if (time) {
time -= svsTime;
}
ArchiveWriteRaw(&time, sizeof(time));
}
}
void MemArchiver::ArchiveRaw(void* buffer, size_t size)
{
if (IsReading()) {
ArchiveReadRaw(buffer, size);
} else {
ArchiveWriteRaw(buffer, size);
}
}
void MemArchiver::ArchiveReadRaw(void* buffer, size_t size)
{
if (!size) {
return;
}
if (size + this->bufferSize > this->allocatedSize) {
Com_Error(ERR_DROP, "MemArchiver: tried to read past end of buffer");
}
memcpy(buffer, this->buffer + this->bufferSize, size);
this->bufferSize += size;
}
void MemArchiver::ArchiveWriteRaw(const void* buffer, size_t size)
{
if (!size) {
return;
}
if (size + this->bufferSize > this->allocatedSize) {
if (!this->allocatedSize) {
this->allocatedSize = 1024;
this->buffer = (byte*)cgi.Malloc(this->allocatedSize);
} else {
byte* newBuffer;
do {
this->allocatedSize *= 2;
} while (size + this->bufferSize > this->allocatedSize);
newBuffer = (byte*)cgi.Malloc(this->allocatedSize);
memcpy(newBuffer, this->buffer, this->bufferSize);
cgi.Free(this->buffer);
this->buffer = newBuffer;
}
}
memcpy(this->buffer + this->bufferSize, buffer, size);
this->bufferSize += size;
}

View file

@ -1,72 +0,0 @@
/*
===========================================================================
Copyright (C) 2023 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:
// In-memory archiver
#include "cg_local.h"
class Vector;
class str;
typedef enum {
MEMARC_WRITING,
MEMARC_READING
} archiverState_e;
class MemArchiver {
public:
MemArchiver();
~MemArchiver();
void SetupForWriting(size_t initialSize);
void SetupForReading(byte* buffer, size_t size);
void SetBaseTime(unsigned int time);
size_t BufferSize() const;
byte* ConfiscateBuffer();
bool IsReading() const;
bool IsWriting() const;
bool FinishedReading() const;
void ArchiveByte(byte* value);
void ArchiveBoolean(qboolean* value);
void ArchiveChar(char* value);
void ArchiveUChar(unsigned char* value);
void ArchiveShort(short* value);
void ArchiveInteger(int* value);
void ArchiveSize(size_t* value);
void ArchiveFloat(float* value);
void ArchiveVec3(vec3_t value);
void ArchiveVector(Vector* value);
void ArchiveString(str* value);
void ArchiveTime(int* value);
void ArchiveRaw(void* buffer, size_t size);
void ArchiveReadRaw(void* buffer, size_t size);
void ArchiveWriteRaw(const void* buffer, size_t size);
private:
archiverState_e state;
byte* buffer;
size_t bufferSize;
size_t allocatedSize;
int svsTime;
};

View file

@ -1,84 +1,23 @@
cmake_minimum_required(VERSION 3.12) cmake_minimum_required(VERSION 3.5)
project(omohclient) project(omohclient)
add_subdirectory("../cgame" "./cgame") add_subdirectory("../cgame" "./cgame")
file(GLOB SOURCES_CLIENT "./*.c*") file(GLOB_RECURSE 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_sources(omohclient INTERFACE ${SOURCES_CLIENT} ${SOURCES_UILIB})
target_compile_definitions(omohclient INTERFACE APP_MODULE) target_compile_definitions(omohclient INTERFACE APP_MODULE)
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) add_subdirectory("../libmad-0.15.1b" "./libmad")
# Use OpenAL target_link_libraries(omohclient INTERFACE libmad)
find_package(OpenAL REQUIRED) target_include_directories(omohclient INTERFACE "../libmad-0.15.1b")
if (OPENAL_FOUND)
target_compile_definitions(omohclient INTERFACE USE_OPENAL=1 NO_MODERN_DMA=0)
if (MSVC)
target_include_directories(omohclient INTERFACE ${OPENAL_INCLUDE_DIR}/AL)
else()
target_include_directories(omohclient INTERFACE ${OPENAL_INCLUDE_DIR})
endif()
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()
list(FILTER SOURCES_CLIENT EXCLUDE REGEX "./snd_([a-zA-Z0-9_]+)\.c$")
file(GLOB SOURCES_CLIENT_SND "./snd_*_new.c*" "./snd_codec*.c*")
list(APPEND SOURCES_CLIENT ${SOURCES_CLIENT_SND})
else()
#
# Fallback to old DMA sound system
#
message(NOTICE "OpenAL was explicitly disabled - fallback to old SDL sound system")
target_compile_definitions(omohclient INTERFACE NO_MODERN_DMA=1)
set(NO_MODERN_DMA TRUE)
list(FILTER SOURCES_CLIENT EXCLUDE REGEX "./snd_([a-zA-Z0-9_]+)\.cpp$")
file(GLOB_RECURSE SOURCES_CLIENT_SND "./new/*.c*")
list(APPEND SOURCES_CLIENT ${SOURCES_CLIENT_SND})
endif()
set(OLD_VALUE ${BUILD_SHARED_LIBS})
set(BUILD_SHARED_LIBS OFF CACHE BOOL "" FORCE)
if(USE_INTERNAL_MAD)
add_subdirectory("../libmad" "./libmad" EXCLUDE_FROM_ALL)
target_link_libraries(omohclient INTERFACE mad)
else()
include(FindPackageHandleStandardArgs)
find_path(LIBMAD_INCLUDE_DIRS mad.h)
find_library(LIBMAD_LIBRARIES mad)
find_package_handle_standard_args(
LibMad
DEFAULT_MSG
LIBMAD_LIBRARIES
LIBMAD_INCLUDE_DIRS
)
target_include_directories(omohclient INTERFACE ${LIBMAD_INCLUDE_DIRS})
target_link_libraries(omohclient INTERFACE ${LIBMAD_LIBRARIES})
endif()
set(BUILD_SHARED_LIBS ${OLD_VALUE} CACHE BOOL "" FORCE)
target_sources(omohclient INTERFACE ${SOURCES_CLIENT} ${SOURCES_UILIB})

View file

@ -334,9 +334,6 @@ writing the actual data can begin
*/ */
qboolean CL_OpenAVIForWriting( const char *fileName ) qboolean CL_OpenAVIForWriting( const char *fileName )
{ {
return qfalse;
// Removed in OPM
#if 0
if( afd.fileOpen ) if( afd.fileOpen )
return qfalse; return qfalse;
@ -428,7 +425,6 @@ qboolean CL_OpenAVIForWriting( const char *fileName )
afd.fileOpen = qtrue; afd.fileOpen = qtrue;
return qtrue; return qtrue;
#endif
} }
/* /*

View file

@ -23,10 +23,8 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
#include "client.h" #include "client.h"
#include "cl_ui.h" #include "cl_ui.h"
#include "cl_uiradar.h"
#include "../qcommon/tiki.h" #include "../qcommon/tiki.h"
#include "../qcommon/localization.h" #include "../qcommon/localization.h"
#include "../qcommon/bg_compat.h"
extern qboolean loadCamera(const char *name); extern qboolean loadCamera(const char *name);
extern void startCamera(int time); extern void startCamera(int time);
@ -211,20 +209,20 @@ qboolean CL_GetSnapshot( int snapshotNumber, snapshot_t *snapshot ) {
} }
snapshot->numEntities = 0; snapshot->numEntities = 0;
for(i = 0; i < MAX_ENTITIES_IN_SNAPSHOT; i++) {
parents[i] = -1;
}
for ( i = 0 ; i < count ; i++ ) { for ( i = 0 ; i < count ; i++ ) {
s1 = &cl.parseEntities[(clSnap->parseEntitiesNum + i) & (MAX_PARSE_ENTITIES - 1)]; s1 = &cl.parseEntities[(clSnap->parseEntitiesNum + i) & (MAX_PARSE_ENTITIES - 1)];
pnum = s1->parent; pnum = s1->parent;
if (pnum == ENTITYNUM_NONE) { if (pnum == ENTITYNUM_NONE) {
parents[s1->number] = -2; parents[s1->number] = -2;
} else { }
else
{
if (parents[pnum] == -2) { if (parents[pnum] == -2) {
parents[s1->number] = -2; parents[s1->number] = -2;
} else { }
else
{
// add it later // add it later
parents[s1->number] = pnum; parents[s1->number] = pnum;
continue; continue;
@ -234,24 +232,23 @@ qboolean CL_GetSnapshot( int snapshotNumber, snapshot_t *snapshot ) {
snapshot->entities[snapshot->numEntities++] = *s1; snapshot->entities[snapshot->numEntities++] = *s1;
} }
for(pcount = 0; pcount < 8 && snapshot->numEntities != count; pcount++) { for(pcount = 0; pcount < 8 && snapshot->numEntities != count; pcount++)
for (i = 0; i < count; i++) { {
for (i = 0; i < count; i++)
{
s1 = &cl.parseEntities[(clSnap->parseEntitiesNum + i) & (MAX_PARSE_ENTITIES - 1)]; s1 = &cl.parseEntities[(clSnap->parseEntitiesNum + i) & (MAX_PARSE_ENTITIES - 1)];
pnum = parents[s1->number]; pnum = parents[s1->number];
if (pnum >= 0 && parents[pnum] == -2) { if (pnum >= 0 && parents[pnum] == -2) {
parents[s1->number] = -2;
snapshot->entities[snapshot->numEntities++] = *s1; snapshot->entities[snapshot->numEntities++] = *s1;
} }
} }
} }
if (snapshot->numEntities != count) { if (pcount >= 8)
Com_DPrintf("CL_GetSnapshot: Not all children could find their parents.\n");
for (i = snapshot->numEntities; i < count; i++)
{ {
for (pnum = 0; pnum < count; pnum++) { for (i = count; i < snapshot->numEntities; i++)
s1 = &cl.parseEntities[(clSnap->parseEntitiesNum + pnum) & (MAX_PARSE_ENTITIES - 1)]; {
s1 = &cl.parseEntities[(clSnap->parseEntitiesNum + i) & (MAX_PARSE_ENTITIES - 1)];
if (parents[s1->number] >= 0) { if (parents[s1->number] >= 0) {
Com_DPrintf( Com_DPrintf(
"CL_GetSnapshot: entity %d with parent %d and model '%s' at %.2f %.2f %.2f, could not find parent.\n", "CL_GetSnapshot: entity %d with parent %d and model '%s' at %.2f %.2f %.2f, could not find parent.\n",
@ -262,9 +259,6 @@ qboolean CL_GetSnapshot( int snapshotNumber, snapshot_t *snapshot ) {
s1->origin[1], s1->origin[1],
s1->origin[2] s1->origin[2]
); );
parents[s1->number] = -2;
}
} }
} }
} }
@ -303,7 +297,6 @@ void CL_ConfigstringModified(int index, char* s) {
gameState_t oldGs; gameState_t oldGs;
size_t len; size_t len;
index = CPT_NormalizeConfigstring(index);
if ( index < 0 || index >= MAX_CONFIGSTRINGS ) { if ( index < 0 || index >= MAX_CONFIGSTRINGS ) {
Com_Error( ERR_DROP, "configstring > MAX_CONFIGSTRINGS" ); Com_Error( ERR_DROP, "configstring > MAX_CONFIGSTRINGS" );
} }
@ -362,9 +355,7 @@ qboolean CL_ProcessServerCommand(const char* origString, const char* cmd, qboole
// because this function might be called from a module that would be unloaded // because this function might be called from a module that would be unloaded
// inside Com_Error // inside Com_Error
UI_ForceMenuOff(1); UI_ForceMenuOff(1);
// Fixed in OPM Cbuf_AddText("disconnect;pushmenu disconnected");
// Added a newline for next commands
Cbuf_AddText("disconnect;pushmenu disconnected\n");
return qtrue; return qtrue;
} }
@ -430,36 +421,6 @@ qboolean CL_GetServerCommand( int serverCommandNumber, qboolean differentServer
Cmd_TokenizeString( s ); Cmd_TokenizeString( s );
cmd = Cmd_Argv(0); cmd = Cmd_Argv(0);
// Readded in OPM (from ioquake)
// Configstring big buffer
if (!strcmp(cmd, "bcs0")) {
Com_sprintf(bigConfigString, BIG_INFO_STRING, "cs %s \"%s", Cmd_Argv(1), Cmd_Argv(2));
return qfalse;
}
if (!strcmp(cmd, "bcs1")) {
s = Cmd_Argv(2);
if (strlen(bigConfigString) + strlen(s) >= BIG_INFO_STRING) {
Com_Error(ERR_DROP, "bcs exceeded BIG_INFO_STRING");
}
strcat(bigConfigString, s);
return qfalse;
}
if (!strcmp(cmd, "bcs2")) {
s = Cmd_Argv(2);
if (strlen(bigConfigString) + strlen(s) + 1 >= BIG_INFO_STRING) {
Com_Error(ERR_DROP, "bcs exceeded BIG_INFO_STRING");
}
strcat(bigConfigString, s);
strcat(bigConfigString, "\"");
s = bigConfigString;
// reparse
Cmd_TokenizeString(s);
cmd = Cmd_Argv(0);
}
return CL_ProcessServerCommand(s, cmd, differentServer); return CL_ProcessServerCommand(s, cmd, differentServer);
} }
@ -471,10 +432,10 @@ CL_CM_LoadMap
Just adds default parameters that cgame doesn't need to know about Just adds default parameters that cgame doesn't need to know about
==================== ====================
*/ */
void CL_CM_LoadMap( const char *mapname, int *checksum ) { void CL_CM_LoadMap( const char *mapname ) {
CM_LoadMap( mapname, qtrue, checksum ); int checksum;
// prepare world vis data
re.SetWorldVisData(CM_VisibilityPointer()); CM_LoadMap( mapname, qtrue, &checksum );
} }
/* /*
@ -577,29 +538,6 @@ void CL_StartLocalSound(const char* soundName, qboolean forceLoad) {
S_StartLocalSound(soundName, qfalse ); S_StartLocalSound(soundName, qfalse );
} }
/*
====================
CL_RestoreSavedCgameState
====================
*/
void CL_RestoreSavedCgameState() {
if (cls.savedCgameState) {
cge->CG_LoadStateToBuffer(cls.savedCgameState, cls.savedCgameStateSize, cl.snap.serverTime);
}
}
/*
====================
CL_ClearSavedCgameState
====================
*/
void CL_ClearSavedCgameState() {
if (cls.savedCgameState) {
cls.savedCgameState = NULL;
cls.savedCgameStateSize = 0;
}
}
/* /*
==================== ====================
CL_InitCGameDLL CL_InitCGameDLL
@ -616,7 +554,6 @@ void CL_InitCGameDLL( clientGameImport_t *cgi, clientGameExport_t **cge ) {
cgi->Printf = Com_Printf; cgi->Printf = Com_Printf;
cgi->DPrintf = Com_DPrintf; cgi->DPrintf = Com_DPrintf;
cgi->DebugPrintf = Com_DebugPrintf;
cgi->Malloc = CL_CG_Malloc; cgi->Malloc = CL_CG_Malloc;
cgi->Free = CL_CG_Free; cgi->Free = CL_CG_Free;
@ -627,9 +564,7 @@ void CL_InitCGameDLL( clientGameImport_t *cgi, clientGameExport_t **cge ) {
cgi->LV_ConvertString = Sys_LV_CL_ConvertString; cgi->LV_ConvertString = Sys_LV_CL_ConvertString;
cgi->Cvar_Get = Cvar_Get; cgi->Cvar_Get = Cvar_Get;
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;
@ -644,8 +579,6 @@ void CL_InitCGameDLL( clientGameImport_t *cgi, clientGameExport_t **cge ) {
cgi->FS_FreeFile = FS_FreeFile; cgi->FS_FreeFile = FS_FreeFile;
cgi->FS_WriteFile = FS_WriteFile; cgi->FS_WriteFile = FS_WriteFile;
cgi->FS_WriteTextFile = FS_WriteTextFile; cgi->FS_WriteTextFile = FS_WriteTextFile;
cgi->FS_ListFilteredFiles = FS_ListFilteredFiles;
cgi->FS_FreeFileList = FS_FreeFileList;
cgi->SendConsoleCommand = Cbuf_AddText; cgi->SendConsoleCommand = Cbuf_AddText;
@ -717,11 +650,9 @@ void CL_InitCGameDLL( clientGameImport_t *cgi, clientGameExport_t **cge ) {
cgi->R_RegisterModel = re.RegisterModel; cgi->R_RegisterModel = re.RegisterModel;
cgi->R_SpawnEffectModel = re.SpawnEffectModel; cgi->R_SpawnEffectModel = re.SpawnEffectModel;
cgi->R_RegisterServerModel = re.RegisterServerModel; cgi->R_RegisterServerModel = re.RegisterServerModel;
cgi->R_GetModelName = re.GetModelName;
cgi->R_UnregisterServerModel = re.UnregisterServerModel; cgi->R_UnregisterServerModel = re.UnregisterServerModel;
cgi->R_RegisterShader = re.RegisterShader; cgi->R_RegisterShader = re.RegisterShader;
cgi->R_RegisterShaderNoMip = re.RegisterShaderNoMip; cgi->R_RegisterShaderNoMip = re.RegisterShaderNoMip;
cgi->R_GetShaderName = re.GetShaderName;
cgi->R_AddRefEntityToScene = re.AddRefEntityToScene; cgi->R_AddRefEntityToScene = re.AddRefEntityToScene;
cgi->R_AddRefSpriteToScene = re.AddRefSpriteToScene; cgi->R_AddRefSpriteToScene = re.AddRefSpriteToScene;
@ -773,9 +704,7 @@ void CL_InitCGameDLL( clientGameImport_t *cgi, clientGameExport_t **cge ) {
cgi->UI_ShowMenu = UI_ShowMenu; cgi->UI_ShowMenu = UI_ShowMenu;
cgi->UI_HideMenu = UI_HideMenu; cgi->UI_HideMenu = UI_HideMenu;
cgi->UI_FontStringWidth = CL_FontStringWidth; cgi->UI_FontStringWidth = uie.FontStringWidth;
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;
@ -814,16 +743,11 @@ void CL_InitCGameDLL( clientGameImport_t *cgi, clientGameExport_t **cge ) {
cgi->UI_SetScoreBoardItem = UI_SetScoreBoardItem; cgi->UI_SetScoreBoardItem = UI_SetScoreBoardItem;
cgi->UI_DeleteScoreBoardItems = UI_DeleteScoreBoardItems; cgi->UI_DeleteScoreBoardItems = UI_DeleteScoreBoardItems;
cgi->UI_ToggleDMMessageConsole = UI_ToggleDMConsole; cgi->UI_ToggleDMMessageConsole = UI_ToggleDMConsole;
cgi->CL_InitRadar = CL_InitRadar;
cgi->TIKI_FindTiki = TIKI_FindTiki; cgi->TIKI_FindTiki = TIKI_FindTiki;
cgi->LoadResource = UI_LoadResource; cgi->LoadResource = UI_LoadResource;
cgi->FS_CanonicalFilename = FS_CanonicalFilename; cgi->FS_CanonicalFilename = FS_CanonicalFilename;
cgi->CL_RestoreSavedCgameState = CL_RestoreSavedCgameState;
cgi->CL_ClearSavedCgameState = CL_ClearSavedCgameState;
cgi->getConfigStringIdNormalized = CPT_NormalizeConfigstring;
cgi->fsDebug = fs_debug; cgi->fsDebug = fs_debug;
cgi->HudDrawElements = cls.HudDrawElements; cgi->HudDrawElements = cls.HudDrawElements;
@ -924,13 +848,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 +863,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();
@ -991,6 +902,8 @@ qboolean CL_GameCommand( void ) {
return cge->CG_ConsoleCommand(); return cge->CG_ConsoleCommand();
} }
/* /*
===================== =====================
CL_CGameRendering CL_CGameRendering
@ -1005,10 +918,6 @@ void CL_CGameRendering( stereoFrame_t stereo ) {
cge->CG_DrawActiveFrame( cl.serverTime, cl.serverTime - cl.oldServerTime, stereo, clc.demoplaying ); cge->CG_DrawActiveFrame( cl.serverTime, cl.serverTime - cl.oldServerTime, stereo, clc.demoplaying );
cl.oldServerTime = cl.serverTime; cl.oldServerTime = cl.serverTime;
//
// Let cgame clean up temp models
//
cge->CG_CleanUpTempModels();
} }
/* /*
@ -1130,42 +1039,6 @@ void CL_FirstSnapshot( void ) {
Cbuf_AddText( cl_activeAction->string ); Cbuf_AddText( cl_activeAction->string );
Cvar_Set( "activeAction", "" ); Cvar_Set( "activeAction", "" );
} }
#ifdef USE_MUMBLE
if ((cl_useMumble->integer) && !mumble_islinked()) {
int ret = mumble_link(CLIENT_WINDOW_TITLE);
Com_Printf("Mumble: Linking to Mumble application %s\n", ret==0?"ok":"failed");
}
#endif
#ifdef USE_VOIP
if (!clc.voipCodecInitialized) {
int i;
int error;
clc.opusEncoder = opus_encoder_create(48000, 1, OPUS_APPLICATION_VOIP, &error);
if ( error ) {
Com_DPrintf("VoIP: Error opus_encoder_create %d\n", error);
return;
}
for (i = 0; i < MAX_CLIENTS; i++) {
clc.opusDecoder[i] = opus_decoder_create(48000, 1, &error);
if ( error ) {
Com_DPrintf("VoIP: Error opus_decoder_create(%d) %d\n", i, error);
return;
}
clc.voipIgnore[i] = qfalse;
clc.voipGain[i] = 1.0f;
}
clc.voipCodecInitialized = qtrue;
clc.voipMuteAll = qfalse;
Cmd_AddCommand ("voip", CL_Voip_f);
Cvar_Set("cl_voipSendTarget", "spatial");
Com_Memset(clc.voipTargets, ~0, sizeof(clc.voipTargets));
}
#endif
} }
static int lastSnapFlags; static int lastSnapFlags;
@ -1216,23 +1089,20 @@ void CL_SetCGameTime( void ) {
// allow pause in single player // allow pause in single player
if ( paused->integer && com_sv_running->integer ) { if ( paused->integer && com_sv_running->integer ) {
// paused // paused
//CL_AdjustTimeDelta(); CL_AdjustTimeDelta();
// Fixed in OPM
// Keep in sync with the server time.
// In OG, the game could lag for a short time
// when pausing and unpausing frequently
cl.serverTimeDelta = cl.snap.serverTime - cls.realtime;
return; return;
} }
if( ( cl.snap.snapFlags ^ lastSnapFlags ) & SNAPFLAG_SERVERCOUNT ) { // FIXME
CL_ServerRestarted(); //if( ( cl.snap.snapFlags ^ lastSnapFlags ) & SNAPFLAG_SERVERCOUNT ) {
} else { // CL_ServerRestarted();
//} else {
if( cl.snap.serverTime < cl.oldFrameServerTime ) { if( cl.snap.serverTime < cl.oldFrameServerTime ) {
assert( 0 ); assert( 0 );
Com_Error( ERR_DROP, "cl.snap.serverTime < cl.oldFrameServerTime" ); Com_Error( ERR_DROP, "cl.snap.serverTime < cl.oldFrameServerTime" );
} }
} //}
cl.oldFrameServerTime = cl.snap.serverTime; cl.oldFrameServerTime = cl.snap.serverTime;

View file

@ -35,8 +35,6 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
#include "../uilib/ui_public.h" #include "../uilib/ui_public.h"
#include "snd_local.h" #include "snd_local.h"
#include "cl_ui.h"
#define MAXSIZE 8 #define MAXSIZE 8
#define MINSIZE 4 #define MINSIZE 4
@ -57,7 +55,6 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
static void RoQ_init( void ); static void RoQ_init( void );
static void CL_FinishedCinematic();
/****************************************************************************** /******************************************************************************
* *
@ -129,10 +126,6 @@ typedef struct {
int playonwalls; int playonwalls;
byte* buf; byte* buf;
long drawX, drawY; long drawX, drawY;
long realTime;
long currTime;
long soundTime;
} cin_cache; } cin_cache;
static cinematics_t cin; static cinematics_t cin;
@ -140,10 +133,6 @@ static cin_cache cinTable[MAX_VIDEO_HANDLES];
static int currentHandle = -1; static int currentHandle = -1;
static int CL_handle = -1; static int CL_handle = -1;
static connstate_t oldClientState;
static int audioStartTime = 0;
extern "C" int s_soundtime; // sample PAIRS extern "C" int s_soundtime; // sample PAIRS
@ -171,7 +160,7 @@ static int CIN_HandleForVideo(void) {
} }
extern "C" int Com_Milliseconds(void); extern "C" int CL_ScaledMilliseconds(void);
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// RllSetupTable // RllSetupTable
@ -1153,20 +1142,24 @@ redump:
case ZA_SOUND_MONO: case ZA_SOUND_MONO:
if (!cinTable[currentHandle].silent) { if (!cinTable[currentHandle].silent) {
ssize = RllDecodeMonoToStereo( framedata, sbuf, cinTable[currentHandle].RoQFrameSize, 0, (unsigned short)cinTable[currentHandle].roq_flags); ssize = RllDecodeMonoToStereo( framedata, sbuf, cinTable[currentHandle].RoQFrameSize, 0, (unsigned short)cinTable[currentHandle].roq_flags);
// S_RawSamples(0, ssize, 22050, 2, 1, (byte *)sbuf, 1.0f, -1); S_RawSamples(0, ssize, 22050, 2, 1, (byte *)sbuf, 1.0f, -1);
} }
break; break;
case ZA_SOUND_STEREO: case ZA_SOUND_STEREO:
if (!cinTable[currentHandle].silent) { if (!cinTable[currentHandle].silent) {
if (cinTable[currentHandle].numQuads == -1) {
S_Update();
s_rawend[0] = s_soundtime;
}
ssize = RllDecodeStereoToStereo( framedata, sbuf, cinTable[currentHandle].RoQFrameSize, 0, (unsigned short)cinTable[currentHandle].roq_flags); ssize = RllDecodeStereoToStereo( framedata, sbuf, cinTable[currentHandle].RoQFrameSize, 0, (unsigned short)cinTable[currentHandle].roq_flags);
// S_RawSamples(0, ssize, 22050, 2, 2, (byte *)sbuf, 1.0f, -1); S_RawSamples(0, ssize, 22050, 2, 2, (byte *)sbuf, 1.0f, -1);
} }
break; break;
case ROQ_QUAD_INFO: case ROQ_QUAD_INFO:
if (cinTable[currentHandle].numQuads == -1) { if (cinTable[currentHandle].numQuads == -1) {
readQuadInfo( framedata ); readQuadInfo( framedata );
setupQuad( 0, 0 ); setupQuad( 0, 0 );
cinTable[currentHandle].startTime = cinTable[currentHandle].lastTime = Com_Milliseconds(); cinTable[currentHandle].startTime = cinTable[currentHandle].lastTime = CL_ScaledMilliseconds();
} }
if (cinTable[currentHandle].numQuads != 1) cinTable[currentHandle].numQuads = 0; if (cinTable[currentHandle].numQuads != 1) cinTable[currentHandle].numQuads = 0;
break; break;
@ -1233,10 +1226,7 @@ redump:
static void RoQ_init( void ) static void RoQ_init( void )
{ {
cinTable[currentHandle].startTime = cinTable[currentHandle].lastTime = Com_Milliseconds(); cinTable[currentHandle].startTime = cinTable[currentHandle].lastTime = CL_ScaledMilliseconds();
cinTable[currentHandle].realTime = Com_Milliseconds();
cinTable[currentHandle].currTime = 0;
cinTable[currentHandle].soundTime = 0;
cinTable[currentHandle].RoQPlayed = 24; cinTable[currentHandle].RoQPlayed = 24;
@ -1283,10 +1273,8 @@ static void RoQShutdown( void ) {
cinTable[currentHandle].iFile = 0; cinTable[currentHandle].iFile = 0;
} }
S_StopMovieAudio();
if (cinTable[currentHandle].alterGameState) { if (cinTable[currentHandle].alterGameState) {
clc.state = oldClientState; clc.state = CA_DISCONNECTED;
// we can't just do a vstr nextmap, because // we can't just do a vstr nextmap, because
// if we are aborting the intro cinematic with // if we are aborting the intro cinematic with
// a devmap command, nextmap would be valid by // a devmap command, nextmap would be valid by
@ -1298,29 +1286,8 @@ static void RoQShutdown( void ) {
} }
CL_handle = -1; CL_handle = -1;
} }
cinTable[currentHandle].fileName[0] = 0; cinTable[currentHandle].fileName[0] = 0;
currentHandle = -1; currentHandle = -1;
CL_FinishedCinematic();
}
static void CL_FinishedCinematic()
{
const char* s;
if (!CL_FinishedIntro())
{
CL_FinishedStartStage();
return;
}
s = Cvar_VariableString("nextmap");
if (*s)
{
Cbuf_ExecuteText(EXEC_APPEND, va("%s\n", s));
Cvar_Set("nextmap", "");
}
} }
/* /*
@ -1361,11 +1328,8 @@ Fetch and decompress the pending frame
e_status CIN_RunCinematic (int handle) e_status CIN_RunCinematic (int handle)
{ {
int deltaTime; int start = 0;
int frameTime; int thisTime = 0;
int soundTime;
int newTime;
long tfps;
if (handle < 0 || handle>= MAX_VIDEO_HANDLES || cinTable[handle].status == FMV_EOF) return FMV_EOF; if (handle < 0 || handle>= MAX_VIDEO_HANDLES || cinTable[handle].status == FMV_EOF) return FMV_EOF;
@ -1393,46 +1357,24 @@ e_status CIN_RunCinematic (int handle)
return cinTable[currentHandle].status; return cinTable[currentHandle].status;
} }
frameTime = Com_Milliseconds(); thisTime = CL_ScaledMilliseconds();
deltaTime = frameTime - cinTable[currentHandle].realTime; if (cinTable[currentHandle].shader && (abs(thisTime - cinTable[currentHandle].lastTime))>100) {
if (deltaTime > 100) { cinTable[currentHandle].startTime += thisTime - cinTable[currentHandle].lastTime;
deltaTime = 100;
} }
cinTable[currentHandle].tfps = (((CL_ScaledMilliseconds() - cinTable[currentHandle].startTime)*3)/100);
newTime = cinTable[currentHandle].currTime + deltaTime; start = cinTable[currentHandle].startTime;
if (cl_movieaudio->integer) { while( (cinTable[currentHandle].tfps != cinTable[currentHandle].numQuads)
soundTime = S_CurrentMoviePosition();
if (soundTime > cinTable[currentHandle].currTime || soundTime > cinTable[currentHandle].soundTime) {
cinTable[currentHandle].currTime = newTime + (deltaTime * (soundTime - newTime)) / 100;
}
else {
cinTable[currentHandle].currTime = newTime;
}
cinTable[currentHandle].soundTime = soundTime;
} else {
//
// Fixed in OPM
//
cinTable[currentHandle].currTime = newTime;
}
cinTable[currentHandle].realTime = frameTime;
tfps = (cinTable[currentHandle].currTime * 3) / 100;
while( (tfps != cinTable[currentHandle].numQuads)
&& (cinTable[currentHandle].status == FMV_PLAY) ) && (cinTable[currentHandle].status == FMV_PLAY) )
{ {
RoQInterrupt(); RoQInterrupt();
if (start != cinTable[currentHandle].startTime) {
cinTable[currentHandle].realTime = Com_Milliseconds(); cinTable[currentHandle].tfps = (((CL_ScaledMilliseconds() - cinTable[currentHandle].startTime)*3)/100);
if (cinTable[currentHandle].realTime > frameTime + 66) { start = cinTable[currentHandle].startTime;
break;
} }
} }
cinTable[currentHandle].lastTime = frameTime; cinTable[currentHandle].lastTime = thisTime;
if (cinTable[currentHandle].status == FMV_LOOPED) { if (cinTable[currentHandle].status == FMV_LOOPED) {
cinTable[currentHandle].status = FMV_PLAY; cinTable[currentHandle].status = FMV_PLAY;
@ -1480,7 +1422,7 @@ int CIN_PlayCinematic( const char *arg, int x, int y, int w, int h, int systemBi
cin.currentHandle = currentHandle; cin.currentHandle = currentHandle;
Q_strncpyz(cinTable[currentHandle].fileName, name, sizeof(cinTable[currentHandle].fileName)); strcpy(cinTable[currentHandle].fileName, name);
cinTable[currentHandle].ROQSize = 0; cinTable[currentHandle].ROQSize = 0;
cinTable[currentHandle].ROQSize = FS_FOpenFileRead (cinTable[currentHandle].fileName, &cinTable[currentHandle].iFile, qtrue, qtrue); cinTable[currentHandle].ROQSize = FS_FOpenFileRead (cinTable[currentHandle].fileName, &cinTable[currentHandle].iFile, qtrue, qtrue);
@ -1526,6 +1468,10 @@ int CIN_PlayCinematic( const char *arg, int x, int y, int w, int h, int systemBi
clc.state = CA_CINEMATIC; clc.state = CA_CINEMATIC;
} }
if (!cinTable[currentHandle].silent) {
s_rawend[0] = s_soundtime;
}
return currentHandle; return currentHandle;
} }
Com_DPrintf("trFMV::play(), invalid RoQ ID\n"); Com_DPrintf("trFMV::play(), invalid RoQ ID\n");
@ -1637,106 +1583,43 @@ void CIN_DrawCinematic (int handle) {
CIN_ResampleCinematic(handle, buf2); CIN_ResampleCinematic(handle, buf2);
re.DrawStretchRaw( x, y, w, h, 256, 256, 0, (byte *)buf2); re.DrawStretchRaw( x, y, w, h, 256, 256, (byte *)buf2, 0, qfalse);
cinTable[handle].dirty = qfalse; cinTable[handle].dirty = qfalse;
Hunk_FreeTempMemory(buf2); Hunk_FreeTempMemory(buf2);
return; return;
} }
re.DrawStretchRaw( x, y, w, h, cinTable[handle].drawX, cinTable[handle].drawY, 0, buf); re.DrawStretchRaw( x, y, w, h, cinTable[handle].drawX, cinTable[handle].drawY, buf, 0, qfalse);
cinTable[handle].dirty = qfalse; cinTable[handle].dirty = qfalse;
} }
static unsigned short CL_PlayRoQ(const char* name, const char* arg, const char* s) {
unsigned short RoQID;
Com_Memset(&cin, 0, sizeof(cinematics_t) );
currentHandle = CIN_HandleForVideo();
cin.currentHandle = currentHandle;
Q_strncpyz(cinTable[currentHandle].fileName, name, sizeof(cinTable[currentHandle].fileName));
cinTable[currentHandle].ROQSize = 0;
cinTable[currentHandle].ROQSize = FS_FOpenFileRead (cinTable[currentHandle].fileName, &cinTable[currentHandle].iFile, qtrue, qtrue);
if (cinTable[currentHandle].ROQSize<=0) {
Com_DPrintf("Can not find RoQ cinematic '%s'\n", name);
CL_FinishedCinematic();
return -1;
}
if ((s && s[0] == '1') || Q_stricmp(arg,"demoend.roq")==0 || Q_stricmp(arg,"end.roq")==0) {
cinTable[currentHandle].holdAtEnd = qtrue;
}
CIN_SetExtents(currentHandle, 0, 0, 640, 480);
cinTable[currentHandle].alterGameState = qtrue;
initRoQ();
FS_Read (cin.file, 16, cinTable[currentHandle].iFile);
RoQID = (unsigned short)(cin.file[0]) + (unsigned short)(cin.file[1])*256;
if (RoQID == 0x1084)
{
RoQ_init();
// FS_Read (cin.file, cinTable[currentHandle].RoQFrameSize+8, cinTable[currentHandle].iFile);
cinTable[currentHandle].status = FMV_PLAY;
Com_DPrintf("trFMV::play(), playing %s\n", arg);
if (cl_movieaudio->integer) {
audioStartTime = Com_Milliseconds();
S_SetupMovieAudio(name);
}
oldClientState = clc.state;
clc.state = CA_CINEMATIC;
if (cls.glconfig.maxTextureSize <= 256 || s && *s == '2') {
//cinTable[currentHandle].interlaced = qtrue;
}
CL_handle = currentHandle;
do {
SCR_RunCinematic();
} while (!cinTable[currentHandle].buf && cinTable[currentHandle].status == FMV_PLAY);
UI_CloseConsole();
return currentHandle;
}
Com_DPrintf("trFMV::play(), invalid RoQ ID\n");
RoQShutdown();
return -1;
}
void CL_PlayCinematic_f(void) { void CL_PlayCinematic_f(void) {
char *arg, *s; char *arg, *s;
char name[256]; int bits = CIN_system;
Com_DPrintf("CL_PlayCinematic_f\n");
if (clc.state == CA_CINEMATIC) { if (clc.state == CA_CINEMATIC) {
SCR_StopCinematic(); SCR_StopCinematic();
} }
arg = Cmd_Argv( 1 ); arg = Cmd_Argv( 1 );
Com_DPrintf("CL_PlayCinematic( %s )\n", arg);
s = Cmd_Argv(2); s = Cmd_Argv(2);
CL_StartHunkUsers(qfalse); if ((s && s[0] == '1') || Q_stricmp(arg,"demoend.roq")==0 || Q_stricmp(arg,"end.roq")==0) {
S_StopAllSounds2(qtrue); bits |= CIN_hold;
}
Com_sprintf(name, sizeof(name), "video/%s", arg); if (s && s[0] == '2') {
bits |= CIN_loop;
if (Q_stricmp(&name[strlen(name) - 4], ".roq")) {
Com_Printf("Bad or missing cinematic extension.\n");
return;
} }
CL_PlayRoQ(name, arg, s); S_StopAllSounds( qtrue );
CL_handle = CIN_PlayCinematic( arg, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, bits );
if (CL_handle >= 0) {
do {
SCR_RunCinematic();
} while (cinTable[currentHandle].buf == NULL && cinTable[currentHandle].status == FMV_PLAY); // wait for first frame (load codebook and sound)
}
} }
@ -1756,5 +1639,7 @@ void SCR_RunCinematic (void)
void SCR_StopCinematic(void) { void SCR_StopCinematic(void) {
if (CL_handle >= 0 && CL_handle < MAX_VIDEO_HANDLES) { if (CL_handle >= 0 && CL_handle < MAX_VIDEO_HANDLES) {
CIN_StopCinematic(CL_handle); CIN_StopCinematic(CL_handle);
S_StopAllSounds( qtrue );
CL_handle = -1;
} }
} }

View file

@ -56,10 +56,6 @@ qboolean in_guimouse;
kbutton_t in_up, in_down; kbutton_t in_up, in_down;
#ifdef USE_VOIP
kbutton_t in_voiprecord;
#endif
kbutton_t in_buttons[16]; kbutton_t in_buttons[16];
qboolean in_mlooking; qboolean in_mlooking;
@ -262,20 +258,6 @@ void IN_SpeedUp(void) {IN_KeyUp(&in_speed);}
void IN_StrafeDown(void) {IN_KeyDown(&in_strafe);} void IN_StrafeDown(void) {IN_KeyDown(&in_strafe);}
void IN_StrafeUp(void) {IN_KeyUp(&in_strafe);} void IN_StrafeUp(void) {IN_KeyUp(&in_strafe);}
#ifdef USE_VOIP
void IN_VoipRecordDown(void)
{
IN_KeyDown(&in_voiprecord);
Cvar_Set("cl_voipSend", "1");
}
void IN_VoipRecordUp(void)
{
IN_KeyUp(&in_voiprecord);
Cvar_Set("cl_voipSend", "0");
}
#endif
void IN_Button0Down(void) {IN_KeyDown(&in_buttons[0]);} void IN_Button0Down(void) {IN_KeyDown(&in_buttons[0]);}
void IN_Button0Up(void) {IN_KeyUp(&in_buttons[0]);} void IN_Button0Up(void) {IN_KeyUp(&in_buttons[0]);}
void IN_Button1Down(void) {IN_KeyDown(&in_buttons[1]);} void IN_Button1Down(void) {IN_KeyDown(&in_buttons[1]);}
@ -450,7 +432,7 @@ void CL_MouseEvent( int dx, int dy, int time ) {
if( cl.mousey > cls.glconfig.vidHeight ) if( cl.mousey > cls.glconfig.vidHeight )
cl.mousey = cls.glconfig.vidHeight; cl.mousey = cls.glconfig.vidHeight;
} }
else if ( !paused->integer ) else
{ {
cl.mouseDx[cl.mouseIndex] += dx; cl.mouseDx[cl.mouseIndex] += dx;
cl.mouseDy[cl.mouseIndex] += dy; cl.mouseDy[cl.mouseIndex] += dy;
@ -479,16 +461,6 @@ CL_JoystickMove
void CL_JoystickMove( usercmd_t *cmd ) { void CL_JoystickMove( usercmd_t *cmd ) {
float anglespeed; float anglespeed;
float yaw = j_yaw->value * cl.joystickAxis[j_yaw_axis->integer];
float right = j_side->value * cl.joystickAxis[j_side_axis->integer];
float forward = j_forward->value * cl.joystickAxis[j_forward_axis->integer];
float pitch = j_pitch->value * cl.joystickAxis[j_pitch_axis->integer];
float up = j_up->value * cl.joystickAxis[j_up_axis->integer];
if ( in_speed.active ^ cl_run->integer ) {
cmd->buttons |= BUTTON_RUN;
}
if ( in_speed.active ) { if ( in_speed.active ) {
anglespeed = 0.001 * cls.frametime * cl_anglespeedkey->value; anglespeed = 0.001 * cls.frametime * cl_anglespeedkey->value;
} else { } else {
@ -496,22 +468,18 @@ void CL_JoystickMove( usercmd_t *cmd ) {
} }
if ( !in_strafe.active ) { if ( !in_strafe.active ) {
cl.viewangles[YAW] += anglespeed * yaw; cl.viewangles[YAW] += anglespeed * cl_yawspeed->value * cl.joystickAxis[AXIS_SIDE];
cmd->rightmove = ClampChar( cmd->rightmove + (int)right );
} else { } else {
cl.viewangles[YAW] += anglespeed * right; cmd->rightmove = ClampChar( cmd->rightmove + cl.joystickAxis[AXIS_SIDE] );
cmd->rightmove = ClampChar( cmd->rightmove + (int)yaw );
} }
if ( in_mlooking ) { if ( in_mlooking ) {
cl.viewangles[PITCH] += anglespeed * forward; cl.viewangles[PITCH] += anglespeed * cl_pitchspeed->value * cl.joystickAxis[AXIS_FORWARD];
cmd->forwardmove = ClampChar( cmd->forwardmove + (int)pitch );
} else { } else {
cl.viewangles[PITCH] += anglespeed * pitch; cmd->forwardmove = ClampChar( cmd->forwardmove + cl.joystickAxis[AXIS_FORWARD] );
cmd->forwardmove = ClampChar( cmd->forwardmove + (int)forward );
} }
cmd->upmove = ClampChar( cmd->upmove + (int)up ); cmd->upmove = ClampChar( cmd->upmove + cl.joystickAxis[AXIS_UP] );
} }
/* /*
@ -597,8 +565,6 @@ void CL_MouseMove( usercmd_t *cmd ) {
mx *= cgameSensitivity; mx *= cgameSensitivity;
my *= cgameSensitivity; my *= cgameSensitivity;
cmd->buttons |= BUTTON_ANY;
// add mouse X/Y movement to cmd // add mouse X/Y movement to cmd
if(in_strafe.active) if(in_strafe.active)
cmd->rightmove = ClampChar(cmd->rightmove + m_side->value * mx); cmd->rightmove = ClampChar(cmd->rightmove + m_side->value * mx);
@ -609,14 +575,6 @@ void CL_MouseMove( usercmd_t *cmd ) {
cl.viewangles[PITCH] += m_pitch->value * my; cl.viewangles[PITCH] += m_pitch->value * my;
else else
cmd->forwardmove = ClampChar(cmd->forwardmove - m_forward->value * my); cmd->forwardmove = ClampChar(cmd->forwardmove - m_forward->value * my);
if (!isfinite(cl.viewangles[PITCH]) || !isfinite(cl.viewangles[YAW])) {
Com_DPrintf("Invalid client viewangles encountered (view pitch: %f, view yaw: %f)!\n", cl.viewangles[PITCH], cl.viewangles[YAW]);
Com_DPrintf("cgameSensitivity: %f | mx: %f | my: %f | m_pitch: %f | m_yaw: %f\n", cgameSensitivity, mx, my, m_pitch->value, m_yaw->value);
Com_DPrintf("Resetting client viewangles\n");
cl.viewangles[PITCH] = 0;
cl.viewangles[YAW] = 0;
}
} }
/* /*
@ -652,7 +610,7 @@ void CL_CmdButtons( usercmd_t *cmd ) {
cmd->buttons |= BUTTON_TALK; cmd->buttons |= BUTTON_TALK;
} }
if ( in_speed.active ^ cl_run->integer ) { if (in_speed.active == !cl_run->integer) {
cmd->buttons |= BUTTON_RUN; cmd->buttons |= BUTTON_RUN;
} }
@ -760,12 +718,6 @@ void CL_CreateNewCommands( void ) {
frame_msec = com_frameTime - old_com_frameTime; frame_msec = com_frameTime - old_com_frameTime;
// if running over 1000fps, act as if each frame is 1ms
// prevents divisions by zero
if ( frame_msec < 1 ) {
frame_msec = 1;
}
// if running less than 5fps, truncate the extra time to prevent // if running less than 5fps, truncate the extra time to prevent
// unexpected moves after a hitch // unexpected moves after a hitch
if ( frame_msec > 200 ) { if ( frame_msec > 200 ) {
@ -866,8 +818,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" );
} }
@ -957,58 +909,6 @@ void CL_WritePacket( void ) {
count = MAX_PACKET_USERCMDS; count = MAX_PACKET_USERCMDS;
Com_Printf("MAX_PACKET_USERCMDS\n"); Com_Printf("MAX_PACKET_USERCMDS\n");
} }
#ifdef USE_VOIP
if (clc.voipOutgoingDataSize > 0)
{
if((clc.voipFlags & VOIP_SPATIAL) || Com_IsVoipTarget(clc.voipTargets, sizeof(clc.voipTargets), -1))
{
MSG_WriteByte (&buf, clc_voipOpus);
MSG_WriteByte (&buf, clc.voipOutgoingGeneration);
MSG_WriteLong (&buf, clc.voipOutgoingSequence);
MSG_WriteByte (&buf, clc.voipOutgoingDataFrames);
MSG_WriteData (&buf, clc.voipTargets, sizeof(clc.voipTargets));
MSG_WriteByte(&buf, clc.voipFlags);
MSG_WriteShort (&buf, clc.voipOutgoingDataSize);
MSG_WriteData (&buf, clc.voipOutgoingData, clc.voipOutgoingDataSize);
// If we're recording a demo, we have to fake a server packet with
// this VoIP data so it gets to disk; the server doesn't send it
// back to us, and we might as well eliminate concerns about dropped
// and misordered packets here.
if(clc.demorecording && !clc.demowaiting)
{
const int voipSize = clc.voipOutgoingDataSize;
msg_t fakemsg;
byte fakedata[MAX_MSGLEN];
MSG_Init (&fakemsg, fakedata, sizeof (fakedata));
MSG_Bitstream (&fakemsg);
MSG_WriteLong (&fakemsg, clc.reliableAcknowledge);
MSG_WriteByte (&fakemsg, svc_voipOpus);
MSG_WriteShort (&fakemsg, clc.clientNum);
MSG_WriteByte (&fakemsg, clc.voipOutgoingGeneration);
MSG_WriteLong (&fakemsg, clc.voipOutgoingSequence);
MSG_WriteByte (&fakemsg, clc.voipOutgoingDataFrames);
MSG_WriteShort (&fakemsg, clc.voipOutgoingDataSize );
MSG_WriteBits (&fakemsg, clc.voipFlags, VOIP_FLAGCNT);
MSG_WriteData (&fakemsg, clc.voipOutgoingData, voipSize);
MSG_WriteByte (&fakemsg, svc_EOF);
CL_WriteDemoMessage (&fakemsg, 0);
}
clc.voipOutgoingSequence += clc.voipOutgoingDataFrames;
clc.voipOutgoingDataSize = 0;
clc.voipOutgoingDataFrames = 0;
}
else
{
// We have data, but no targets. Silently discard all data
clc.voipOutgoingDataSize = 0;
clc.voipOutgoingDataFrames = 0;
}
}
#endif
if ( count >= 1 ) { if ( count >= 1 ) {
if ( cl_showSend->integer ) { if ( cl_showSend->integer ) {
Com_Printf( "(%i)", count ); Com_Printf( "(%i)", count );
@ -1065,6 +965,16 @@ void CL_WritePacket( void ) {
} }
CL_Netchan_Transmit (&clc.netchan, &buf); CL_Netchan_Transmit (&clc.netchan, &buf);
// clients never really should have messages large enough
// to fragment, but in case they do, fire them all off
// at once
// TTimo: this causes a packet burst, which is bad karma for winsock
// added a WARNING message, we'll see if there are legit situations where this happens
while ( clc.netchan.unsentFragments ) {
Com_DPrintf( "WARNING: #462 unsent fragments (not supposed to happen!)\n" );
CL_Netchan_TransmitNextFragment( &clc.netchan );
}
} }
/* /*
@ -1081,7 +991,7 @@ void CL_SendCmd( void ) {
} }
// don't send commands if paused // don't send commands if paused
if ( com_sv_running->integer && paused->integer ) { if ( com_sv_running->integer && paused->integer && paused->integer ) {
return; return;
} }
@ -1141,8 +1051,8 @@ void CL_InitInput( void ) {
Cmd_AddCommand("-leanleft", IN_LeanLeftUp); Cmd_AddCommand("-leanleft", IN_LeanLeftUp);
Cmd_AddCommand("+leanright", IN_LeanRightDown); Cmd_AddCommand("+leanright", IN_LeanRightDown);
Cmd_AddCommand("-leanright", IN_LeanRightUp); Cmd_AddCommand("-leanright", IN_LeanRightUp);
Cmd_AddCommand("+speed", IN_SpeedDown); Cmd_AddCommand("+speed", IN_SpeedUp);
Cmd_AddCommand("-speed", IN_SpeedUp); Cmd_AddCommand("-speed", IN_SpeedDown);
Cmd_AddCommand("+button0", IN_Button0Down); Cmd_AddCommand("+button0", IN_Button0Down);
Cmd_AddCommand("-button0", IN_Button0Up); Cmd_AddCommand("-button0", IN_Button0Up);
Cmd_AddCommand("+button1", IN_Button1Down); Cmd_AddCommand("+button1", IN_Button1Down);
@ -1176,85 +1086,6 @@ void CL_InitInput( void ) {
Cmd_AddCommand("+mlook", IN_MLookDown); Cmd_AddCommand("+mlook", IN_MLookDown);
Cmd_AddCommand("-mlook", IN_MLookUp); Cmd_AddCommand("-mlook", IN_MLookUp);
#ifdef USE_VOIP
Cmd_AddCommand ("+voiprecord", IN_VoipRecordDown);
Cmd_AddCommand ("-voiprecord", IN_VoipRecordUp);
#endif
cl_nodelta = Cvar_Get ("cl_nodelta", "0", 0); cl_nodelta = Cvar_Get ("cl_nodelta", "0", 0);
cl_debugMove = Cvar_Get ("cl_debugMove", "0", 0); cl_debugMove = Cvar_Get ("cl_debugMove", "0", 0);
} }
/*
============
CL_ShutdownInput
============
*/
void CL_ShutdownInput(void)
{
Cmd_RemoveCommand("centerview");
Cmd_RemoveCommand("+moveup");
Cmd_RemoveCommand("-moveup");
Cmd_RemoveCommand("+movedown");
Cmd_RemoveCommand("-movedown");
Cmd_RemoveCommand("+left");
Cmd_RemoveCommand("-left");
Cmd_RemoveCommand("+right");
Cmd_RemoveCommand("-right");
Cmd_RemoveCommand("+forward");
Cmd_RemoveCommand("-forward");
Cmd_RemoveCommand("+back");
Cmd_RemoveCommand("-back");
Cmd_RemoveCommand("+lookup");
Cmd_RemoveCommand("-lookup");
Cmd_RemoveCommand("+lookdown");
Cmd_RemoveCommand("-lookdown");
Cmd_RemoveCommand("+strafe");
Cmd_RemoveCommand("-strafe");
Cmd_RemoveCommand("+moveleft");
Cmd_RemoveCommand("-moveleft");
Cmd_RemoveCommand("+moveright");
Cmd_RemoveCommand("-moveright");
Cmd_RemoveCommand("+speed");
Cmd_RemoveCommand("-speed");
Cmd_RemoveCommand("+attack");
Cmd_RemoveCommand("-attack");
Cmd_RemoveCommand("+button0");
Cmd_RemoveCommand("-button0");
Cmd_RemoveCommand("+button1");
Cmd_RemoveCommand("-button1");
Cmd_RemoveCommand("+button2");
Cmd_RemoveCommand("-button2");
Cmd_RemoveCommand("+button3");
Cmd_RemoveCommand("-button3");
Cmd_RemoveCommand("+button4");
Cmd_RemoveCommand("-button4");
Cmd_RemoveCommand("+button5");
Cmd_RemoveCommand("-button5");
Cmd_RemoveCommand("+button6");
Cmd_RemoveCommand("-button6");
Cmd_RemoveCommand("+button7");
Cmd_RemoveCommand("-button7");
Cmd_RemoveCommand("+button8");
Cmd_RemoveCommand("-button8");
Cmd_RemoveCommand("+button9");
Cmd_RemoveCommand("-button9");
Cmd_RemoveCommand("+button10");
Cmd_RemoveCommand("-button10");
Cmd_RemoveCommand("+button11");
Cmd_RemoveCommand("-button11");
Cmd_RemoveCommand("+button12");
Cmd_RemoveCommand("-button12");
Cmd_RemoveCommand("+button13");
Cmd_RemoveCommand("-button13");
Cmd_RemoveCommand("+button14");
Cmd_RemoveCommand("-button14");
Cmd_RemoveCommand("+mlook");
Cmd_RemoveCommand("-mlook");
#ifdef USE_VOIP
Cmd_RemoveCommand("+voiprecord");
Cmd_RemoveCommand("-voiprecord");
#endif
}

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;
};

File diff suppressed because it is too large Load diff

View file

@ -1,6 +1,6 @@
/* /*
=========================================================================== ===========================================================================
Copyright (C) 2023 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.
@ -20,33 +20,14 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
=========================================================================== ===========================================================================
*/ */
#pragma once #ifndef __CL_INV_H__
#define __CL_INV_H__
typedef enum { typedef enum { INV_MOVE_NONE, INV_MOVE_BOB, INV_MOVE_SPIN } inv_move_type;
INV_MOVE_NONE, typedef enum { INV_CASCADE_LEFT, INV_CASCADE_RIGHT } inv_cascade_type;
INV_MOVE_BOB, typedef enum { INV_HUDANGLES_BASE, INV_HUDANGLES_COMPASS, INV_HUDANGLES_COMPASS_NEEDLE } inv_hudangles_type;
INV_MOVE_SPIN
} inv_move_type;
typedef enum { class item_properties_t : public Class {
INV_ALIGN_NONE,
INV_ALIGN_LEFT,
INV_ALIGN_RIGHT
} inv_align_type;
typedef enum {
INV_CASCADE_LEFT,
INV_CASCADE_RIGHT
} inv_cascade_type;
typedef enum {
INV_HUDANGLES_BASE,
INV_HUDANGLES_COMPASS,
INV_HUDANGLES_COMPASS_NEEDLE
} inv_hudangles_type;
class item_properties_t : public Class
{
public: public:
float scale; float scale;
Vector angles; Vector angles;
@ -58,8 +39,7 @@ public:
str anim; str anim;
}; };
class inventory_item_t : public Class class inventory_item_t : public Class {
{
public: public:
str name; str name;
str ammoname; str ammoname;
@ -85,8 +65,7 @@ public:
UIReggedMaterial *selshader; UIReggedMaterial *selshader;
}; };
class inventory_type_t class inventory_type_t {
{
public: public:
str name; str name;
bool bg_tile; bool bg_tile;
@ -99,10 +78,13 @@ public:
int IndexOfItemPtr( inventory_item_t *item ); int IndexOfItemPtr( inventory_item_t *item );
}; };
inline int inventory_type_t::IndexOfItemPtr(inventory_item_t *item) inline
int inventory_type_t::IndexOfItemPtr( inventory_item_t *item )
{
for( int i = items.NumObjects(); i > 0; i-- )
{
if( items.ObjectAt( i ) == item )
{ {
for (int i = items.NumObjects(); i > 0; i--) {
if (items.ObjectAt(i) == item) {
return i; return i;
} }
} }
@ -110,30 +92,23 @@ inline int inventory_type_t::IndexOfItemPtr(inventory_item_t *item)
return 0; return 0;
} }
class inventory_t class inventory_t {
{
public: public:
int typewidth; int typewidth;
int typeheight; int typeheight;
int horizoffset; int horizoffset;
int vertoffset; int vertoffset;
inv_align_type align; int align;
inv_cascade_type cascade; inv_cascade_type cascade;
str selectsound; str selectsound;
str rejectsound; str rejectsound;
str changesound; str changesound;
Container<inventory_type_t *> types; Container<inventory_type_t *> types;
public: void Clear() { types.ClearObjectList(); }
inventory_t();
~inventory_t();
inventory_t(const inventory_t& other);
inventory_t& operator=(const inventory_t& other);
void Clear();
}; };
class invlistener : public Listener class invlistener : public Listener {
{
protected: protected:
inventory_t *inv; inventory_t *inv;
inventory_type_t *curtype; inventory_type_t *curtype;
@ -215,3 +190,5 @@ bool CL_LoadInventory(const char *filename, inventory_t *inv);
inventory_item_t *CL_GetInvItemByName( inventory_t *inv, const char *name ); inventory_item_t *CL_GetInvItemByName( inventory_t *inv, const char *name );
qboolean CL_HasInventoryItem( const char *name ); qboolean CL_HasInventoryItem( const char *name );
void CL_AmmoCount( const char *name, int *ammo_count, int *max_ammo_count ); void CL_AmmoCount( const char *name, int *ammo_count, int *max_ammo_count );
#endif // __CL_INV_H__

File diff suppressed because it is too large Load diff

View file

@ -1,6 +1,6 @@
/* /*
=========================================================================== ===========================================================================
Copyright (C) 2023 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.
@ -20,18 +20,13 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
=========================================================================== ===========================================================================
*/ */
#pragma once #ifndef __CL_INVRENDER_H__
#define __CL_INVRENDER_H__
class FakkInventory; class FakkInventory;
typedef enum { typedef enum { selectsound, rejectsound, changesound } invsound_t;
selectsound, class FakkItemList : public UIWidget {
rejectsound,
changesound
} invsound_t;
class FakkItemList : public UIWidget
{
protected: protected:
inventory_type_t *type; inventory_type_t *type;
uipopup_describe m_describe[ 10 ]; uipopup_describe m_describe[ 10 ];
@ -60,12 +55,9 @@ public:
void OnMouseLeave( Event *ev ); void OnMouseLeave( Event *ev );
void OnMenuKilled( Event *ev ); void OnMenuKilled( Event *ev );
void EquipItem( Event *ev ); void EquipItem( Event *ev );
inventory_item_t *getHoverItem() const;
}; };
class FakkInventory : public UIWidget class FakkInventory : public UIWidget {
{
protected: protected:
inventory_t *m_inv; inventory_t *m_inv;
SafePtr<FakkItemList> m_currentlist; SafePtr<FakkItemList> m_currentlist;
@ -75,11 +67,8 @@ protected:
public: public:
CLASS_PROTOTYPE( FakkInventory ); CLASS_PROTOTYPE( FakkInventory );
public:
qboolean m_mouse_active;
protected: protected:
void VerifyTypeUp(inventory_type_t *t, qboolean warpmouse); void VerifyItemUp( inventory_item_t *item, qboolean warpmouse );
public: public:
FakkInventory(); FakkInventory();
@ -103,19 +92,7 @@ public:
int FindFirstItem( int itemindex, int sign ); int FindFirstItem( int itemindex, int sign );
}; };
void CL_Draw3DModel( void CL_Draw3DModel( float x, float y, float w, float h, qhandle_t model, vec3_t origin, vec3_t rotateoffset, vec3_t offset, vec3_t angle, vec3_t color, str anim );
float x,
float y,
float w,
float h,
qhandle_t model,
vec3_t origin,
vec3_t rotateoffset,
vec3_t offset,
vec3_t angle,
vec3_t color,
str anim
);
void UI_DoInventory(qboolean activate_mouse);
qboolean UI_CloseInventory( void ); qboolean UI_CloseInventory( void );
#endif // __CL_INVRENDER_H__

View file

@ -37,6 +37,7 @@ qboolean chat_team;
int chat_playerNum; int chat_playerNum;
qboolean key_overstrikeMode; qboolean key_overstrikeMode;
int anykeydown; int anykeydown;
@ -55,7 +56,8 @@ typedef struct {
} keyname_t; } keyname_t;
// names not in this list can either be lowercase ascii, or '0xnn' hex sequences // names not in this list can either be lowercase ascii, or '0xnn' hex sequences
keyname_t keynames[] = { keyname_t keynames[] =
{
{"TAB", K_TAB}, {"TAB", K_TAB},
{"ENTER", K_ENTER}, {"ENTER", K_ENTER},
{"ESCAPE", K_ESCAPE}, {"ESCAPE", K_ESCAPE},
@ -74,6 +76,7 @@ keyname_t keynames[] = {
{"CAPSLOCK", K_CAPSLOCK}, {"CAPSLOCK", K_CAPSLOCK},
{"F1", K_F1}, {"F1", K_F1},
{"F2", K_F2}, {"F2", K_F2},
{"F3", K_F3}, {"F3", K_F3},
@ -340,14 +343,18 @@ Message_Key
In game talk message In game talk message
================ ================
*/ */
void Message_Key(int key) void Message_Key( int key ) {
{
char buffer[MAX_STRING_CHARS];
if (key == K_ESCAPE) { if (key == K_ESCAPE) {
Key_SetCatcher( Key_GetCatcher( ) & ~KEYCATCH_MESSAGE ); Key_SetCatcher( Key_GetCatcher( ) & ~KEYCATCH_MESSAGE );
return; return;
} }
if (key == K_ENTER || key == K_KP_ENTER) { if ( key == K_ENTER || key == K_KP_ENTER )
{
Key_SetCatcher( Key_GetCatcher( ) & ~KEYCATCH_MESSAGE ); Key_SetCatcher( Key_GetCatcher( ) & ~KEYCATCH_MESSAGE );
return; return;
} }
@ -355,23 +362,23 @@ void Message_Key(int key)
//============================================================================ //============================================================================
qboolean Key_GetOverstrikeMode(void)
{ qboolean Key_GetOverstrikeMode( void ) {
return key_overstrikeMode; return key_overstrikeMode;
} }
void Key_SetOverstrikeMode(qboolean state)
{ void Key_SetOverstrikeMode( qboolean state ) {
key_overstrikeMode = state; key_overstrikeMode = state;
} }
/* /*
=================== ===================
Key_IsDown Key_IsDown
=================== ===================
*/ */
qboolean Key_IsDown(int keynum) qboolean Key_IsDown( int keynum ) {
{
if ( keynum < 0 || keynum >= MAX_KEYS ) { if ( keynum < 0 || keynum >= MAX_KEYS ) {
return qfalse; return qfalse;
} }
@ -379,6 +386,7 @@ qboolean Key_IsDown(int keynum)
return keys[keynum].down; return keys[keynum].down;
} }
/* /*
=================== ===================
Key_StringToKeynum Key_StringToKeynum
@ -392,8 +400,7 @@ the K_* names are matched up.
to be configured even if they don't have defined names. to be configured even if they don't have defined names.
=================== ===================
*/ */
int Key_StringToKeynum(const char *str) int Key_StringToKeynum( const char *str ) {
{
keyname_t *kn; keyname_t *kn;
if ( !str || !str[0] ) { if ( !str || !str[0] ) {
@ -430,10 +437,9 @@ int Key_StringToKeynum(const char *str)
// scan for a text match // scan for a text match
for ( kn=keynames ; kn->name ; kn++ ) { for ( kn=keynames ; kn->name ; kn++ ) {
if (!Q_stricmp(str, kn->name)) { if ( !Q_stricmp( str,kn->name ) )
return kn->keynum; return kn->keynum;
} }
}
return -1; return -1;
} }
@ -446,8 +452,7 @@ Returns a string (either a single ascii char, a K_* name, or a 0x11 hex string)
given keynum. given keynum.
=================== ===================
*/ */
const char *Key_KeynumToString(int keynum) const char *Key_KeynumToString( int keynum ) {
{
keyname_t *kn; keyname_t *kn;
static char tinystr[5]; static char tinystr[5];
int i, j; int i, j;
@ -495,8 +500,7 @@ Returns a string (either a single ascii char, a K_* name, or a 0x11 hex string)
given keynum. given keynum.
=================== ===================
*/ */
const char *Key_KeynumToBindString(int keynum) const char *Key_KeynumToBindString( int keynum ) {
{
keyname_t *kn; keyname_t *kn;
static char tinystr[5]; static char tinystr[5];
@ -525,13 +529,13 @@ const char *Key_KeynumToBindString(int keynum)
return "Unknown Key"; return "Unknown Key";
} }
/* /*
=================== ===================
Key_SetBinding Key_SetBinding
=================== ===================
*/ */
void Key_SetBinding(int keynum, const char *binding) void Key_SetBinding( int keynum, const char *binding ) {
{
if ( keynum < 0 || keynum >= MAX_KEYS ) { if ( keynum < 0 || keynum >= MAX_KEYS ) {
return; return;
} }
@ -554,8 +558,7 @@ void Key_SetBinding(int keynum, const char *binding)
Key_SetAltBinding Key_SetAltBinding
=================== ===================
*/ */
void Key_SetAltBinding(int keynum, const char *binding) void Key_SetAltBinding( int keynum, const char *binding ) {
{
if ( keynum < 0 || keynum >= MAX_KEYS ) { if ( keynum < 0 || keynum >= MAX_KEYS ) {
return; return;
} }
@ -578,8 +581,7 @@ void Key_SetAltBinding(int keynum, const char *binding)
Key_SetCtrlBinding Key_SetCtrlBinding
=================== ===================
*/ */
void Key_SetCtrlBinding(int keynum, const char *binding) void Key_SetCtrlBinding( int keynum, const char *binding ) {
{
if ( keynum < 0 || keynum >= MAX_KEYS ) { if ( keynum < 0 || keynum >= MAX_KEYS ) {
return; return;
} }
@ -597,13 +599,13 @@ void Key_SetCtrlBinding(int keynum, const char *binding)
cvar_modifiedFlags |= CVAR_ARCHIVE; cvar_modifiedFlags |= CVAR_ARCHIVE;
} }
/* /*
=================== ===================
Key_GetBinding Key_GetBinding
=================== ===================
*/ */
const char *Key_GetBinding(int keynum) const char *Key_GetBinding( int keynum ) {
{
if ( keynum < 0 || keynum >= MAX_KEYS ) { if ( keynum < 0 || keynum >= MAX_KEYS ) {
return ""; return "";
} }
@ -617,8 +619,7 @@ Key_GetKey
=================== ===================
*/ */
int Key_GetKey(const char *binding) int Key_GetKey(const char *binding) {
{
int i; int i;
if (binding) { if (binding) {
@ -636,8 +637,7 @@ int Key_GetKey(const char *binding)
Key_GetKeynameForCommand Key_GetKeynameForCommand
=================== ===================
*/ */
const char *Key_GetKeynameForCommand(const char *command) const char *Key_GetKeynameForCommand( const char *command ) {
{
int i; int i;
for( i = 0; i < MAX_KEYS; i++ ) { for( i = 0; i < MAX_KEYS; i++ ) {
@ -657,8 +657,7 @@ const char *Key_GetKeynameForCommand(const char *command)
Key_GetKeysForCommand Key_GetKeysForCommand
=================== ===================
*/ */
void Key_GetKeysForCommand(const char *command, int *key1, int *key2) void Key_GetKeysForCommand( const char *command, int *key1, int *key2 ) {
{
int i; int i;
*key1 = *key2 = -1; *key1 = *key2 = -1;
@ -687,13 +686,15 @@ void Key_Unbind_f(void)
{ {
int b; int b;
if (Cmd_Argc() != 2) { if (Cmd_Argc() != 2)
{
Com_Printf ("unbind <key> : remove commands from a key\n"); Com_Printf ("unbind <key> : remove commands from a key\n");
return; return;
} }
b = Key_StringToKeynum (Cmd_Argv(1)); b = Key_StringToKeynum (Cmd_Argv(1));
if (b == -1) { if (b==-1)
{
Com_Printf ("\"%s\" isn't a valid key\n", Cmd_Argv(1)); Com_Printf ("\"%s\" isn't a valid key\n", Cmd_Argv(1));
return; return;
} }
@ -710,13 +711,15 @@ void Key_Unaltbind_f(void)
{ {
int b; int b;
if (Cmd_Argc() != 2) { if (Cmd_Argc() != 2)
{
Com_Printf ("unaltbind <key> : remove commands from a key\n"); Com_Printf ("unaltbind <key> : remove commands from a key\n");
return; return;
} }
b = Key_StringToKeynum (Cmd_Argv(1)); b = Key_StringToKeynum (Cmd_Argv(1));
if (b == -1) { if (b==-1)
{
Com_Printf ("\"%s\" isn't a valid key\n", Cmd_Argv(1)); Com_Printf ("\"%s\" isn't a valid key\n", Cmd_Argv(1));
return; return;
} }
@ -733,13 +736,15 @@ void Key_Unctrlbind_f(void)
{ {
int b; int b;
if (Cmd_Argc() != 2) { if (Cmd_Argc() != 2)
{
Com_Printf ("unctrlbind <key> : remove commands from a key\n"); Com_Printf ("unctrlbind <key> : remove commands from a key\n");
return; return;
} }
b = Key_StringToKeynum (Cmd_Argv(1)); b = Key_StringToKeynum (Cmd_Argv(1));
if (b == -1) { if (b==-1)
{
Com_Printf ("\"%s\" isn't a valid key\n", Cmd_Argv(1)); Com_Printf ("\"%s\" isn't a valid key\n", Cmd_Argv(1));
return; return;
} }
@ -756,12 +761,11 @@ void Key_Unbindall_f(void)
{ {
int i; int i;
for (i = 0; i < MAX_KEYS; i++) { for (i=0 ; i < MAX_KEYS; i++)
if (keys[i].binding) { if (keys[i].binding)
Key_SetBinding (i, ""); Key_SetBinding (i, "");
} }
}
}
/* /*
=================== ===================
@ -775,33 +779,35 @@ void Key_Bind_f(void)
c = Cmd_Argc(); c = Cmd_Argc();
if (c < 2) { if (c < 2)
{
Com_Printf ("bind <key> [command] : attach a command to a key\n"); Com_Printf ("bind <key> [command] : attach a command to a key\n");
return; return;
} }
b = Key_StringToKeynum (Cmd_Argv(1)); b = Key_StringToKeynum (Cmd_Argv(1));
if (b == -1) { if (b==-1)
{
Com_Printf ("\"%s\" isn't a valid key\n", Cmd_Argv(1)); Com_Printf ("\"%s\" isn't a valid key\n", Cmd_Argv(1));
return; return;
} }
if (c == 2) { if (c == 2)
if (keys[b].binding) { {
if (keys[b].binding)
Com_Printf ("\"%s\" = \"%s\"\n", Cmd_Argv(1), keys[b].binding ); Com_Printf ("\"%s\" = \"%s\"\n", Cmd_Argv(1), keys[b].binding );
} else { else
Com_Printf ("\"%s\" is not bound\n", Cmd_Argv(1) ); Com_Printf ("\"%s\" is not bound\n", Cmd_Argv(1) );
}
return; return;
} }
// copy the rest of the command line // copy the rest of the command line
cmd[0] = 0; // start out with a null string cmd[0] = 0; // start out with a null string
for (i = 2; i < c; i++) { for (i=2 ; i< c ; i++)
{
strcat (cmd, Cmd_Argv(i)); strcat (cmd, Cmd_Argv(i));
if (i != (c - 1)) { if (i != (c-1))
strcat (cmd, " "); strcat (cmd, " ");
} }
}
Key_SetBinding (b, cmd); Key_SetBinding (b, cmd);
} }
@ -818,33 +824,35 @@ void Key_AltBind_f(void)
c = Cmd_Argc(); c = Cmd_Argc();
if (c < 2) { if (c < 2)
{
Com_Printf ("altbind <key> [command] : attach a command to a key\n"); Com_Printf ("altbind <key> [command] : attach a command to a key\n");
return; return;
} }
b = Key_StringToKeynum (Cmd_Argv(1)); b = Key_StringToKeynum (Cmd_Argv(1));
if (b == -1) { if (b==-1)
{
Com_Printf ("\"%s\" isn't a valid key\n", Cmd_Argv(1)); Com_Printf ("\"%s\" isn't a valid key\n", Cmd_Argv(1));
return; return;
} }
if (c == 2) { if (c == 2)
if (altkeys[b].binding) { {
if (altkeys[b].binding)
Com_Printf ("\"%s\" = \"%s\"\n", Cmd_Argv(1), altkeys[b].binding ); Com_Printf ("\"%s\" = \"%s\"\n", Cmd_Argv(1), altkeys[b].binding );
} else { else
Com_Printf ("\"%s\" is not bound\n", Cmd_Argv(1) ); Com_Printf ("\"%s\" is not bound\n", Cmd_Argv(1) );
}
return; return;
} }
// copy the rest of the command line // copy the rest of the command line
cmd[0] = 0; // start out with a null string cmd[0] = 0; // start out with a null string
for (i = 2; i < c; i++) { for (i=2 ; i< c ; i++)
{
strcat (cmd, Cmd_Argv(i)); strcat (cmd, Cmd_Argv(i));
if (i != (c - 1)) { if (i != (c-1))
strcat (cmd, " "); strcat (cmd, " ");
} }
}
Key_SetAltBinding (b, cmd); Key_SetAltBinding (b, cmd);
} }
@ -861,33 +869,35 @@ void Key_CtrlBind_f(void)
c = Cmd_Argc(); c = Cmd_Argc();
if (c < 2) { if (c < 2)
{
Com_Printf ("ctrlbind <key> [command] : attach a command to a key\n"); Com_Printf ("ctrlbind <key> [command] : attach a command to a key\n");
return; return;
} }
b = Key_StringToKeynum (Cmd_Argv(1)); b = Key_StringToKeynum (Cmd_Argv(1));
if (b == -1) { if (b==-1)
{
Com_Printf ("\"%s\" isn't a valid key\n", Cmd_Argv(1)); Com_Printf ("\"%s\" isn't a valid key\n", Cmd_Argv(1));
return; return;
} }
if (c == 2) { if (c == 2)
if (ctrlkeys[b].binding) { {
if (ctrlkeys[b].binding)
Com_Printf ("\"%s\" = \"%s\"\n", Cmd_Argv(1), ctrlkeys[b].binding ); Com_Printf ("\"%s\" = \"%s\"\n", Cmd_Argv(1), ctrlkeys[b].binding );
} else { else
Com_Printf ("\"%s\" is not bound\n", Cmd_Argv(1) ); Com_Printf ("\"%s\" is not bound\n", Cmd_Argv(1) );
}
return; return;
} }
// copy the rest of the command line // copy the rest of the command line
cmd[0] = 0; // start out with a null string cmd[0] = 0; // start out with a null string
for (i = 2; i < c; i++) { for (i=2 ; i< c ; i++)
{
strcat (cmd, Cmd_Argv(i)); strcat (cmd, Cmd_Argv(i));
if (i != (c - 1)) { if (i != (c-1))
strcat (cmd, " "); strcat (cmd, " ");
} }
}
Key_SetCtrlBinding (b, cmd); Key_SetCtrlBinding (b, cmd);
} }
@ -899,8 +909,7 @@ Key_WriteBindings
Writes lines containing "bind key value" Writes lines containing "bind key value"
============ ============
*/ */
void Key_WriteBindings(fileHandle_t f) void Key_WriteBindings( fileHandle_t f ) {
{
int i; int i;
FS_Printf (f, "unbindall\n" ); FS_Printf (f, "unbindall\n" );
@ -908,9 +917,12 @@ void Key_WriteBindings(fileHandle_t f)
for (i=0 ; i<MAX_KEYS ; i++) { for (i=0 ; i<MAX_KEYS ; i++) {
if (keys[i].binding && keys[i].binding[0] ) { if (keys[i].binding && keys[i].binding[0] ) {
FS_Printf (f, "bind %s \"%s\"\n", Key_KeynumToString(i), keys[i].binding); FS_Printf (f, "bind %s \"%s\"\n", Key_KeynumToString(i), keys[i].binding);
}
} }
} }
}
/* /*
============ ============
@ -918,8 +930,7 @@ Key_Bindlist_f
============ ============
*/ */
void Key_Bindlist_f(void) void Key_Bindlist_f( void ) {
{
int i; int i;
for ( i = 0 ; i < MAX_KEYS ; i++ ) { for ( i = 0 ; i < MAX_KEYS ; i++ ) {
@ -935,8 +946,7 @@ Key_AltBindlist_f
============ ============
*/ */
void Key_AltBindlist_f(void) void Key_AltBindlist_f( void ) {
{
int i; int i;
for ( i = 0 ; i < MAX_KEYS ; i++ ) { for ( i = 0 ; i < MAX_KEYS ; i++ ) {
@ -952,8 +962,7 @@ Key_CtrlBindlist_f
============ ============
*/ */
void Key_CtrlBindlist_f(void) void Key_CtrlBindlist_f( void ) {
{
int i; int i;
for ( i = 0 ; i < MAX_KEYS ; i++ ) { for ( i = 0 ; i < MAX_KEYS ; i++ ) {
@ -968,24 +977,19 @@ void Key_CtrlBindlist_f(void)
Key_KeynameCompletion Key_KeynameCompletion
============ ============
*/ */
void Key_KeynameCompletion(void (*callback)(const char *s)) void Key_KeynameCompletion( void(*callback)(const char *s) ) {
{
int i; int i;
for (i = 0; keynames[i].name != NULL; i++) { for( i = 0; keynames[ i ].name != NULL; i++ )
callback( keynames[ i ].name ); callback( keynames[ i ].name );
} }
}
/* /*
=================== ===================
CL_InitKeyCommands CL_InitKeyCommands
=================== ===================
*/ */
void CL_InitKeyCommands(void) void CL_InitKeyCommands( void ) {
{
int i;
// register our functions // register our functions
Cmd_AddCommand ("bind",Key_Bind_f); Cmd_AddCommand ("bind",Key_Bind_f);
Cmd_AddCommand ("unbind",Key_Unbind_f); Cmd_AddCommand ("unbind",Key_Unbind_f);
@ -999,10 +1003,6 @@ void CL_InitKeyCommands(void)
Cmd_AddCommand ("ctrlbindlist", Key_AltBindlist_f); Cmd_AddCommand ("ctrlbindlist", Key_AltBindlist_f);
memset( menubound, 0, sizeof( menubound ) ); memset( menubound, 0, sizeof( menubound ) );
for (i = K_F1; i <= K_F15; i++) {
menubound[i] = qtrue;
}
} }
/* /*
@ -1010,8 +1010,7 @@ void CL_InitKeyCommands(void)
CL_AddKeyUpCommands CL_AddKeyUpCommands
=================== ===================
*/ */
void CL_AddKeyUpCommands(int key, char *kb, unsigned time) void CL_AddKeyUpCommands( int key, char *kb, unsigned time) {
{
int i; int i;
char button[1024], *buttonPtr; char button[1024], *buttonPtr;
char cmd[1024]; char cmd[1024];
@ -1059,8 +1058,7 @@ CL_KeyEvent
Called by the system for both key up and key down events Called by the system for both key up and key down events
=================== ===================
*/ */
void CL_KeyEvent(int key, qboolean down, unsigned time) void CL_KeyEvent (int key, qboolean down, unsigned time) {
{
char *kb; char *kb;
char cmd[1024]; char cmd[1024];
@ -1088,26 +1086,30 @@ void CL_KeyEvent(int key, qboolean down, unsigned time)
ctrl_down = down; ctrl_down = down;
} }
if (down && !CL_FinishedIntro()) { if (down && !CL_FinishedIntro())
{
UI_StartStageKeyEvent(); UI_StartStageKeyEvent();
return; return;
} }
if (clc.state > CA_DISCONNECTED && cge && !Key_GetCatcher() && cge->CG_CheckCaptureKey(key, down, time) if( clc.state > CA_DISCONNECTED && cge && !Key_GetCatcher() && cge->CG_CheckCaptureKey( key, down, time ) && key != K_ESCAPE )
&& key != K_ESCAPE) { {
if (key != K_CONSOLE && (!keys[K_SHIFT].down || key != K_ESCAPE)) { if (key == K_CONSOLE || (keys[K_SHIFT].down && key == K_ESCAPE))
return; return;
} }
}
if (key == K_CONSOLE || (keys[K_SHIFT].down && key == K_ESCAPE)) { if (key == K_CONSOLE || (keys[K_SHIFT].down && key == K_ESCAPE))
{
if( !down ) { if( !down ) {
return; return;
} }
if (Cvar_VariableIntegerValue("ui_console")) { if( Cvar_VariableIntegerValue( "ui_console" ) )
{
UI_ToggleConsole(); UI_ToggleConsole();
} else if (clc.state == CA_ACTIVE) { }
else if( clc.state == CA_ACTIVE )
{
if( cg_gametype->integer ) { if( cg_gametype->integer ) {
UI_ToggleDMConsole( 300 ); UI_ToggleDMConsole( 300 );
} }
@ -1115,7 +1117,8 @@ void CL_KeyEvent(int key, qboolean down, unsigned time)
return; return;
} }
if (down) { if( down )
{
if( alt_down && key != K_ALT && key != K_INS ) { if( alt_down && key != K_ALT && key != K_INS ) {
altkeys[ key ].down = down; altkeys[ key ].down = down;
} }
@ -1128,31 +1131,37 @@ void CL_KeyEvent(int key, qboolean down, unsigned time)
ctrlkeys[ key ].down = down; ctrlkeys[ key ].down = down;
} }
if (key == K_ENTER) { if (key == K_ENTER)
if (down) { {
if (keys[K_ALT].down) { if (down)
{
if (keys[K_ALT].down)
{
Key_ClearStates(); Key_ClearStates();
Cvar_SetValue("r_fullscreen", !Cvar_VariableIntegerValue("r_fullscreen")); Cvar_SetValue( "r_fullscreen",
!Cvar_VariableIntegerValue( "r_fullscreen" ) );
return; return;
} }
} }
} }
if (key >= K_MOUSE1 && key <= K_MOUSE5) {
if( key == K_MOUSE1 || key == K_MOUSE2
|| key == K_MOUSE3 || key == K_MOUSE4
|| key == K_MOUSE5 )
{
if( down ) { if( down ) {
cl.mouseButtons |= (1 << (key - K_MOUSE1)); cl.mouseButtons |= ( 1 << ( key + (256 - K_MOUSE1) ) );
} else { } else {
cl.mouseButtons &= ~(1 << (key - K_MOUSE1)); cl.mouseButtons &= ~( 1 << ( key + (256 - K_MOUSE1)) );
}
if (in_guimouse) {
return;
} }
} }
if (!in_guimouse || key <= K_MOUSE3 || key > K_JOY1)
{
// keys can still be used for bound actions // keys can still be used for bound actions
if (down && (key <= K_BACKSPACE || key == K_MOUSE4) && (clc.demoplaying || clc.state == CA_CINEMATIC) if (down && (key <= K_BACKSPACE || key == K_MOUSE4) &&
&& Key_GetCatcher() == 0) { ( clc.demoplaying || clc.state == CA_CINEMATIC ) && Key_GetCatcher() == 0 ) {
Cvar_Set( "nextdemo", "" ); Cvar_Set( "nextdemo", "" );
key = K_ESCAPE; key = K_ESCAPE;
} }
@ -1163,7 +1172,8 @@ void CL_KeyEvent(int key, qboolean down, unsigned time)
qboolean wasup = UI_MenuUp(); qboolean wasup = UI_MenuUp();
UI_DeactiveFloatingWindows(); UI_DeactiveFloatingWindows();
if (clc.state == CA_CINEMATIC) { if( clc.state == CA_CINEMATIC )
{
SCR_StopCinematic(); SCR_StopCinematic();
return; return;
} }
@ -1204,7 +1214,8 @@ void CL_KeyEvent(int key, qboolean down, unsigned time)
} }
if( !kb ) { if( !kb ) {
if( key >= 200 ) { if( key >= 200 ) {
Com_Printf("%s is unbound, use controls menu to set.\n", Key_KeynumToString(key)); Com_Printf( "%s is unbound, use controls menu to set.\n"
, Key_KeynumToString( key ) );
} }
} else if( kb[ 0 ] == '+' ) { } else if( kb[ 0 ] == '+' ) {
int i; int i;
@ -1218,7 +1229,8 @@ void CL_KeyEvent(int key, qboolean down, unsigned time)
// sources can be discriminated and subframe corrected // sources can be discriminated and subframe corrected
Com_sprintf( cmd, sizeof( cmd ), "%s %i %i\n", button, key, time ); Com_sprintf( cmd, sizeof( cmd ), "%s %i %i\n", button, key, time );
Cbuf_AddText( cmd ); Cbuf_AddText( cmd );
} else { }
else {
// down-only command // down-only command
Cbuf_AddText( button ); Cbuf_AddText( button );
Cbuf_AddText( "\n" ); Cbuf_AddText( "\n" );
@ -1255,33 +1267,8 @@ void CL_KeyEvent(int key, qboolean down, unsigned time)
CL_AddKeyUpCommands( key, keys[ key ].binding, time ); CL_AddKeyUpCommands( key, keys[ key ].binding, time );
} }
/*
===================
CL_Key_ForceCommand
===================
*/
void CL_Key_ForceCommand(int key, unsigned int time)
{
const char *kb;
char cmd[1024];
if (clc.state == CA_DISCONNECTED) {
return;
} }
kb = keys[key].binding;
if (kb) {
if (*kb == '+') {
Com_sprintf(cmd, sizeof(cmd), "%s %i %i\n", kb, key, time);
} else {
Cbuf_AddText(keys[key].binding);
Cbuf_AddText("\n");
}
} else if (key > K_JOY12) {
Com_Printf("%s is unbound, use controls menu to set.\n", Key_KeynumToString(key));
}
}
/* /*
=================== ===================
@ -1290,8 +1277,7 @@ CL_CharEvent
Normal keyboard characters, already shifted / capslocked / etc Normal keyboard characters, already shifted / capslocked / etc
=================== ===================
*/ */
void CL_CharEvent(int key) void CL_CharEvent( int key ) {
{
// the console key should never be used as a char // the console key should never be used as a char
if ( key == '`' || key == '~' ) { if ( key == '`' || key == '~' ) {
return; return;
@ -1313,6 +1299,7 @@ void CL_CharEvent(int key)
} }
} }
/* /*
=================== ===================
Key_ClearStates Key_ClearStates
@ -1327,6 +1314,7 @@ void Key_ClearStates(void)
for ( i=0 ; i < MAX_KEYS ; i++ ) { for ( i=0 ; i < MAX_KEYS ; i++ ) {
if ( keys[i].down ) { if ( keys[i].down ) {
CL_KeyEvent( i, qfalse, 0 ); CL_KeyEvent( i, qfalse, 0 );
} }
keys[i].down = 0; keys[i].down = 0;
keys[i].repeats = 0; keys[i].repeats = 0;
@ -1340,8 +1328,7 @@ static int keyCatchers = 0;
Key_GetCatcher Key_GetCatcher
==================== ====================
*/ */
int Key_GetCatcher(void) int Key_GetCatcher( void ) {
{
return cls.keyCatchers; return cls.keyCatchers;
} }
@ -1350,7 +1337,6 @@ int Key_GetCatcher(void)
Key_SetCatcher Key_SetCatcher
==================== ====================
*/ */
void Key_SetCatcher(int catcher) void Key_SetCatcher( int catcher ) {
{ keyCatchers = catcher;
cls.keyCatchers = catcher;
} }

File diff suppressed because it is too large Load diff

View file

@ -132,7 +132,7 @@ CL_Netchan_TransmitNextFragment
================= =================
*/ */
void CL_Netchan_TransmitNextFragment( netchan_t *chan ) { void CL_Netchan_TransmitNextFragment( netchan_t *chan ) {
Netchan_TransmitNextFragment( chan, cl_netprofile->integer ? &cls.netprofile.inPackets : NULL ); Netchan_TransmitNextFragment( chan );
} }
/* /*
@ -144,7 +144,7 @@ void CL_Netchan_Transmit( netchan_t *chan, msg_t* msg ) {
MSG_WriteByte( msg, clc_EOF ); MSG_WriteByte( msg, clc_EOF );
CL_Netchan_Encode( msg ); CL_Netchan_Encode( msg );
Netchan_Transmit( chan, msg->cursize, msg->data, cl_netprofile->integer ? &cls.netprofile.inPackets : NULL ); Netchan_Transmit( chan, msg->cursize, msg->data );
} }
extern int oldsize; extern int oldsize;
@ -158,30 +158,10 @@ CL_Netchan_Process
qboolean CL_Netchan_Process( netchan_t *chan, msg_t *msg ) { qboolean CL_Netchan_Process( netchan_t *chan, msg_t *msg ) {
int ret; int ret;
ret = Netchan_Process( chan, msg, cl_netprofile->integer ? &cls.netprofile.outPackets : NULL ); ret = Netchan_Process( chan, msg );
if (!ret) if (!ret)
return qfalse; return qfalse;
CL_Netchan_Decode( msg ); CL_Netchan_Decode( msg );
newsize += msg->cursize; newsize += msg->cursize;
return qtrue; return qtrue;
} }
/*
=================
CL_NET_OutOfBandPrint
=================
*/
void CL_NET_OutOfBandPrint(netadr_t adr, const char* format, ...) {
va_list argptr;
char string[MAX_MSGLEN];
va_start(argptr, format);
Q_vsnprintf(string, sizeof(string), format, argptr);
va_end(argptr);
NET_OutOfBandPrint(NS_CLIENT, adr, "%s", string);
if (cl_netprofile->integer) {
NetProfileAddPacket(&cls.netprofile.inPackets, strlen(string), NETPROF_PACKET_MESSAGE);
}
}

View file

@ -23,7 +23,6 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
#include "client.h" #include "client.h"
#include "cl_ui.h" #include "cl_ui.h"
#include "../qcommon/bg_compat.h"
const char *svc_strings[256] = { const char *svc_strings[256] = {
"svc_bad", "svc_bad",
@ -194,69 +193,6 @@ void CL_ParsePacketEntities( msg_t *msg, clSnapshot_t *oldframe, clSnapshot_t *n
} }
} }
/*
================
CL_UnpackNonPVSClient
Unpack info about non-visible client.
================
*/
qboolean CL_UnpackNonPVSClient(int* packed, radarUnpacked_t* unpacked) {
int x, y;
int yaw;
qboolean bValid;
float range;
unpacked->clientNum = *packed & (MAX_CLIENTS - 1);
if (unpacked->clientNum == cl.snap.ps.clientNum) {
return qfalse;
}
x = ((*packed >> 6) & 0x7F) - (MAX_CLIENTS - 1);
y = ((*packed >> 13) & 0x7F) - (MAX_CLIENTS - 1);
yaw = (*packed >> 20) & 0x1F;
bValid = (*packed >> 25) & 1;
if (com_radar_range && com_radar_range->value) {
range = com_radar_range->value;
} else {
range = 0;
}
unpacked->x = x * range / (MAX_CLIENTS - 1);
unpacked->y = y * range / (MAX_CLIENTS - 1);
if (!bValid)
{
unpacked->x = x * range / (MAX_CLIENTS - 1) * 1024.0;
unpacked->y = y * range / (MAX_CLIENTS - 1) * 1024.0;
}
unpacked->yaw = yaw * 11.25f;
return qtrue;
}
/*
================
CL_ReadNonPVSClient
Reads packed info about non-visible client.
================
*/
void CL_ReadNonPVSClient(int radarInfo) {
radarUnpacked_t unpacked;
if (!cge) {
return;
}
if (CL_UnpackNonPVSClient(&radarInfo, &unpacked)) {
unpacked.x += cl.snap.ps.origin[0];
unpacked.y += cl.snap.ps.origin[1];
cge->CG_ReadNonPVSClient(&unpacked);
}
}
/* /*
================ ================
@ -342,9 +278,6 @@ void CL_ParseSnapshot( msg_t *msg ) {
} else { } else {
MSG_ReadDeltaPlayerstate( msg, NULL, &newSnap.ps, cls.serverFrameTime); MSG_ReadDeltaPlayerstate( msg, NULL, &newSnap.ps, cls.serverFrameTime);
} }
// get normalized flags
newSnap.ps.pm_flags = CPT_NormalizePlayerStateFlags(newSnap.ps.net_pm_flags);
newSnap.ps.iViewModelAnim = CPT_NormalizeViewModelAnim(newSnap.ps.iNetViewModelAnim);
// read packet entities // read packet entities
SHOWNET( msg, "packet entities" ); SHOWNET( msg, "packet entities" );
@ -395,9 +328,6 @@ void CL_ParseSnapshot( msg_t *msg ) {
} }
cl.newSnapshots = qtrue; cl.newSnapshots = qtrue;
// read radar info about invisible clients
CL_ReadNonPVSClient(cl.snap.ps.radarInfo);
} }
@ -429,24 +359,12 @@ void CL_SystemInfoChanged( void ) {
// in some cases, outdated cp commands might get sent with this news serverId // in some cases, outdated cp commands might get sent with this news serverId
cl.serverId = atoi( Info_ValueForKey( systemInfo, "sv_serverid" ) ); cl.serverId = atoi( Info_ValueForKey( systemInfo, "sv_serverid" ) );
#ifdef USE_VOIP
#ifdef LEGACY_PROTOCOL
if(clc.compat)
clc.voipEnabled = qfalse;
else
#endif
{
s = Info_ValueForKey( systemInfo, "sv_voipProtocol" );
clc.voipEnabled = !Q_stricmp(s, "opus");
}
#endif
// don't set any vars when playing a demo // don't set any vars when playing a demo
if ( clc.demoplaying ) { if ( clc.demoplaying ) {
return; return;
} }
s = Info_ValueForKey( systemInfo, "cheats" ); s = Info_ValueForKey( systemInfo, "sv_cheats" );
cl_connectedToCheatServer = atoi( s ); cl_connectedToCheatServer = atoi( s );
if ( !cl_connectedToCheatServer ) { if ( !cl_connectedToCheatServer ) {
Cvar_SetCheatState(); Cvar_SetCheatState();
@ -526,13 +444,35 @@ static void CL_ParseServerInfo(void)
sizeof(clc.sv_dlURL)); sizeof(clc.sv_dlURL));
} }
#if TARGET_GAME_PROTOCOL >= 15
char* MSG_ReadGameStateChar(msg_t* msg) {
return MSG_ReadScrambledBigString(msg);
}
float MSG_ReadServerFrameTime(msg_t* msg) {
return MSG_ReadFloat(msg);
}
#else
char* MSG_ReadGameStateChar(msg_t* msg) {
return MSG_ReadString(msg);
}
float MSG_ReadServerFrameTime(msg_t* msg) {
return 1.f / atof(Info_ValueForKey(cl.gameState.stringData + cl.gameState.stringOffsets[CS_SYSTEMINFO], "sv_fps"));
}
#endif
/* /*
================== ==================
CL_ParseGamestate CL_ParseGamestate
================== ==================
*/ */
void CL_ParseGamestate( msg_t *msg ) { void CL_ParseGamestate( msg_t *msg ) {
int i, csNum; int i;
entityState_t *es; entityState_t *es;
int newnum; int newnum;
entityState_t nullstate; entityState_t nullstate;
@ -565,20 +505,17 @@ void CL_ParseGamestate( msg_t *msg ) {
int len; int len;
i = MSG_ReadShort( msg ); i = MSG_ReadShort( msg );
csNum = CPT_NormalizeConfigstring(i); if ( i < 0 || i >= 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_ReadGameStateChar( msg );
len = strlen( s ); len = strlen( s );
if ( len + 1 + cl.gameState.dataCount > MAX_GAMESTATE_CHARS ) { if ( len + 1 + cl.gameState.dataCount > MAX_GAMESTATE_CHARS ) {
Com_Error( ERR_DROP, "MAX_GAMESTATE_CHARS exceeded" ); Com_Error( ERR_DROP, "MAX_GAMESTATE_CHARS exceeded" );
} }
// append it to the gameState string buffer // append it to the gameState string buffer
cl.gameState.stringOffsets[csNum] = cl.gameState.dataCount; cl.gameState.stringOffsets[ i ] = cl.gameState.dataCount;
Com_Memcpy( cl.gameState.stringData + cl.gameState.dataCount, s, len + 1 ); Com_Memcpy( cl.gameState.stringData + cl.gameState.dataCount, s, len + 1 );
cl.gameState.dataCount += len + 1; cl.gameState.dataCount += len + 1;
} else if ( cmd == svc_baseline ) { } else if ( cmd == svc_baseline ) {
@ -589,7 +526,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 );
} }
@ -598,7 +536,7 @@ void CL_ParseGamestate( msg_t *msg ) {
clc.clientNum = MSG_ReadLong(msg); clc.clientNum = MSG_ReadLong(msg);
// read the checksum feed // read the checksum feed
clc.checksumFeed = MSG_ReadLong( msg ); clc.checksumFeed = MSG_ReadLong( msg );
cls.serverFrameTime = MSG_ReadServerFrameTime(msg, &cl.gameState); cls.serverFrameTime = MSG_ReadServerFrameTime(msg);
// parse serverId and other cvars // parse serverId and other cvars
CL_SystemInfoChanged(); CL_SystemInfoChanged();
@ -607,24 +545,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
@ -805,178 +734,6 @@ void CL_ParseDownload ( msg_t *msg ) {
} }
} }
#ifdef USE_VOIP
static
qboolean CL_ShouldIgnoreVoipSender(int sender)
{
if (!cl_voip->integer)
return qtrue; // VoIP is disabled.
else if ((sender == clc.clientNum) && (!clc.demoplaying))
return qtrue; // ignore own voice (unless playing back a demo).
else if (clc.voipMuteAll)
return qtrue; // all channels are muted with extreme prejudice.
else if (clc.voipIgnore[sender])
return qtrue; // just ignoring this guy.
else if (clc.voipGain[sender] == 0.0f)
return qtrue; // too quiet to play.
return qfalse;
}
/*
=====================
CL_PlayVoip
Play raw data
=====================
*/
static void CL_PlayVoip(int sender, int samplecnt, const byte *data, int flags)
{
if(flags & VOIP_DIRECT)
{
S_RawSamples(sender + 1, samplecnt, 48000, 2, 1,
data, clc.voipGain[sender], -1);
}
if(flags & VOIP_SPATIAL)
{
S_RawSamples(sender + MAX_CLIENTS + 1, samplecnt, 48000, 2, 1,
data, 1.0f, sender);
}
}
/*
=====================
CL_ParseVoip
A VoIP message has been received from the server
=====================
*/
static
void CL_ParseVoip ( msg_t *msg, qboolean ignoreData ) {
static short decoded[VOIP_MAX_PACKET_SAMPLES*4]; // !!! FIXME: don't hard code
const int sender = MSG_ReadShort(msg);
const int generation = MSG_ReadByte(msg);
const int sequence = MSG_ReadLong(msg);
const int frames = MSG_ReadByte(msg);
const int packetsize = MSG_ReadShort(msg);
const int flags = MSG_ReadBits(msg, VOIP_FLAGCNT);
unsigned char encoded[4000];
int numSamples;
int seqdiff;
int written = 0;
int i;
Com_DPrintf("VoIP: %d-byte packet from client %d\n", packetsize, sender);
if (sender < 0)
return; // short/invalid packet, bail.
else if (generation < 0)
return; // short/invalid packet, bail.
else if (sequence < 0)
return; // short/invalid packet, bail.
else if (frames < 0)
return; // short/invalid packet, bail.
else if (packetsize < 0)
return; // short/invalid packet, bail.
if (packetsize > sizeof (encoded)) { // overlarge packet?
int bytesleft = packetsize;
while (bytesleft) {
int br = bytesleft;
if (br > sizeof (encoded))
br = sizeof (encoded);
MSG_ReadData(msg, encoded, br);
bytesleft -= br;
}
return; // overlarge packet, bail.
}
MSG_ReadData(msg, encoded, packetsize);
if (ignoreData) {
return; // just ignore legacy speex voip data
} else if (!clc.voipCodecInitialized) {
return; // can't handle VoIP without libopus!
} else if (sender >= MAX_CLIENTS) {
return; // bogus sender.
} else if (CL_ShouldIgnoreVoipSender(sender)) {
return; // Channel is muted, bail.
}
// !!! FIXME: make sure data is narrowband? Does decoder handle this?
Com_DPrintf("VoIP: packet accepted!\n");
seqdiff = sequence - clc.voipIncomingSequence[sender];
// This is a new "generation" ... a new recording started, reset the bits.
if (generation != clc.voipIncomingGeneration[sender]) {
Com_DPrintf("VoIP: new generation %d!\n", generation);
opus_decoder_ctl(clc.opusDecoder[sender], OPUS_RESET_STATE);
clc.voipIncomingGeneration[sender] = generation;
seqdiff = 0;
} else if (seqdiff < 0) { // we're ahead of the sequence?!
// This shouldn't happen unless the packet is corrupted or something.
Com_DPrintf("VoIP: misordered sequence! %d < %d!\n",
sequence, clc.voipIncomingSequence[sender]);
// reset the decoder just in case.
opus_decoder_ctl(clc.opusDecoder[sender], OPUS_RESET_STATE);
seqdiff = 0;
} else if (seqdiff * VOIP_MAX_PACKET_SAMPLES*2 >= sizeof (decoded)) { // dropped more than we can handle?
// just start over.
Com_DPrintf("VoIP: Dropped way too many (%d) frames from client #%d\n",
seqdiff, sender);
opus_decoder_ctl(clc.opusDecoder[sender], OPUS_RESET_STATE);
seqdiff = 0;
}
if (seqdiff != 0) {
Com_DPrintf("VoIP: Dropped %d frames from client #%d\n",
seqdiff, sender);
// tell opus that we're missing frames...
for (i = 0; i < seqdiff; i++) {
assert((written + VOIP_MAX_PACKET_SAMPLES) * 2 < sizeof (decoded));
numSamples = opus_decode(clc.opusDecoder[sender], NULL, 0, decoded + written, VOIP_MAX_PACKET_SAMPLES, 0);
if ( numSamples <= 0 ) {
Com_DPrintf("VoIP: Error decoding frame %d from client #%d\n", i, sender);
continue;
}
written += numSamples;
}
}
numSamples = opus_decode(clc.opusDecoder[sender], encoded, packetsize, decoded + written, ARRAY_LEN(decoded) - written, 0);
if ( numSamples <= 0 ) {
Com_DPrintf("VoIP: Error decoding voip data from client #%d\n", sender);
numSamples = 0;
}
#if 0
static FILE *encio = NULL;
if (encio == NULL) encio = fopen("voip-incoming-encoded.bin", "wb");
if (encio != NULL) { fwrite(encoded, packetsize, 1, encio); fflush(encio); }
static FILE *decio = NULL;
if (decio == NULL) decio = fopen("voip-incoming-decoded.bin", "wb");
if (decio != NULL) { fwrite(decoded+written, numSamples*2, 1, decio); fflush(decio); }
#endif
written += numSamples;
Com_DPrintf("VoIP: playback %d bytes, %d samples, %d frames\n",
written * 2, written, frames);
if(written > 0)
CL_PlayVoip(sender, written, (const byte *) decoded, flags);
clc.voipIncomingSequence[sender] = sequence + frames;
}
#endif
/* /*
===================== =====================
CL_ParseCommandString CL_ParseCommandString
@ -1125,16 +882,8 @@ void CL_ParseServerMessage( msg_t *msg ) {
} }
CL_ParseCGMessage( msg ); CL_ParseCGMessage( msg );
break; break;
case svc_voipSpeex:
#ifdef USE_VOIP
CL_ParseVoip( msg, qtrue );
#endif
break;
case svc_voipOpus:
#ifdef USE_VOIP
CL_ParseVoip( msg, !clc.voipEnabled );
#endif
break;
} }
} }
} }

View file

@ -343,7 +343,7 @@ void SCR_DrawDemoRecording( void ) {
} }
pos = FS_FTell( clc.demofile ); pos = FS_FTell( clc.demofile );
Com_sprintf( string, sizeof( string ), "RECORDING %s: %ik", clc.demoName, pos / 1024 ); sprintf( string, "RECORDING %s: %ik", clc.demoName, pos / 1024 );
SCR_DrawStringExt( 320 - strlen( string ) * 4, 20, 8, string, g_color_table[7], qtrue, qfalse ); SCR_DrawStringExt( 320 - strlen( string ) * 4, 20, 8, string, g_color_table[7], qtrue, qfalse );
} }
@ -520,18 +520,16 @@ text to the screen.
================== ==================
*/ */
void SCR_UpdateScreen( void ) { void SCR_UpdateScreen( void ) {
static qboolean screen_recursive; static int recursive;
if ( !scr_initialized ) { if ( !scr_initialized ) {
return; // not initialized yet return; // not initialized yet
} }
if (screen_recursive) { if ( ++recursive > 2 ) {
// already called Com_Error( ERR_FATAL, "SCR_UpdateScreen: recursively called" );
return;
} }
recursive = 1;
screen_recursive = qtrue;
CL_StartHunkUsers(qfalse); CL_StartHunkUsers(qfalse);
SCR_SimpleUpdateScreen(); SCR_SimpleUpdateScreen();
@ -555,6 +553,6 @@ void SCR_UpdateScreen( void ) {
} }
} }
screen_recursive = qfalse; recursive = 0;
} }

File diff suppressed because it is too large Load diff

View file

@ -1,6 +1,6 @@
/* /*
=========================================================================== ===========================================================================
Copyright (C) 2023-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.
@ -20,7 +20,8 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
=========================================================================== ===========================================================================
*/ */
#pragma once #ifndef __CL_UI_H__
#define __CL_UI_H__
#include "../uilib/ui_extern.h" #include "../uilib/ui_extern.h"
#include "../uilib/uiwidget.h" #include "../uilib/uiwidget.h"
@ -29,14 +30,6 @@ typedef struct {
UIReggedMaterial *loading; UIReggedMaterial *loading;
} static_media_t; } static_media_t;
//
// cvars
//
extern cvar_t *ui_health_start;
extern cvar_t *ui_health_end;
extern cvar_t *sound_overlay;
extern cvar_t *cl_movieaudio;
// //
// initialization // initialization
// //
@ -50,17 +43,11 @@ void CL_ShutdownUI(void);
extern inventory_t client_inv; 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 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);
void UI_GetHighResolutionScale(vec2_t scale);
// //
// menu // menu
@ -73,42 +60,20 @@ void UI_ForceMenuOff(bool force);
void UI_PushMenu( const char *name ); void UI_PushMenu( const char *name );
void UI_ForceMenu( const char *name ); void UI_ForceMenu( const char *name );
qboolean UI_BindActive( void ); qboolean UI_BindActive( void );
void UI_SetReturnMenuToCurrent(void);
void UI_ActivateView3D( void ); void UI_ActivateView3D( void );
void UI_MenuEscape( const char *name ); void UI_MenuEscape( const char *name );
void UI_CreateScoreboard( void ); void UI_CreateScoreboard( void );
qboolean UI_MenuActive( void ); qboolean UI_MenuActive( void );
qboolean UI_MenuUp( void ); qboolean UI_MenuUp( void );
void UI_FocusMenuIfExists(void);
void UI_DrawConnect( void ); void UI_DrawConnect( void );
void UI_CreateDialog( void UI_CreateDialog( const char *title, char *cvarname, const char *command, const char *cancelCommand, int width, int height, const char *shader, const char *okshader, const char *cancelshader );
const char *title,
char *cvarname,
const char *command,
const char *cancelCommand,
int width,
int height,
const char *shader,
const char *okshader,
const char *cancelshader
);
void UI_ToggleDMConsole( int iMode ); void UI_ToggleDMConsole( int iMode );
void UI_ShowScoreboard_f( const char *pszMenuName ); void UI_ShowScoreboard_f( const char *pszMenuName );
void UI_HideScoreboard_f( void ); void UI_HideScoreboard_f( void );
void UI_SetScoreBoardItem( void UI_SetScoreBoardItem( int iItemNumber,
int iItemNumber, const char *pszData1, const char *pszData2, const char *pszData3, const char *pszData4,
const char *pszData1, const char *pszData5, const char *pszData6, const char *pszData7, const char *pszData8,
const char *pszData2, const vec4_t pTextColor, const vec4_t pBackColor, qboolean bIsHeader );
const char *pszData3,
const char *pszData4,
const char *pszData5,
const char *pszData6,
const char *pszData7,
const char *pszData8,
const vec4_t pTextColor,
const vec4_t pBackColor,
qboolean bIsHeader
);
void UI_DeleteScoreBoardItems( int iMaxIndex ); void UI_DeleteScoreBoardItems( int iMaxIndex );
// //
@ -117,7 +82,6 @@ void UI_DeleteScoreBoardItems(int iMaxIndex);
void UI_BeginLoad( const char *pszMapName ); void UI_BeginLoad( const char *pszMapName );
void UI_EndLoad( void ); void UI_EndLoad( void );
void UI_AbortLoad( void ); void UI_AbortLoad( void );
int CL_FontStringWidth(fontheader_t* pFont, const char* pszString, int iMaxLen);
void UI_BeginLoadResource( void ); void UI_BeginLoadResource( void );
void UI_EndLoadResource( void ); void UI_EndLoadResource( void );
void UI_EndLoadResource( const char *name ); void UI_EndLoadResource( const char *name );
@ -154,3 +118,5 @@ void UI_ServerLoaded(void);
void UI_ResolutionChange( void ); void UI_ResolutionChange( void );
void UI_KeyEvent( int key, unsigned int time ); void UI_KeyEvent( int key, unsigned int time );
void UI_CharEvent( int ch ); void UI_CharEvent( int ch );
#endif /* __CL_UI_H__ */

View file

@ -1,6 +1,6 @@
/* /*
=========================================================================== ===========================================================================
Copyright (C) 2023 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.
@ -24,20 +24,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
bind_t::bind_t() bind_t::bind_t()
{ {
int i; // FIXME: stub
commandwidth = 100;
commandheight = 20;
primarykeywidth = 100;
primarykeyheight = 20;
alternatekeywidth = 100;
alternatekeyheight = 20;
fillwidth = 16;
fillmaterial = NULL;
for (i = 0; i < ARRAY_LEN(headermats); i++) {
headermats[i] = NULL;
}
} }
bind_t::~bind_t() bind_t::~bind_t()
@ -45,508 +32,273 @@ bind_t::~bind_t()
Clear(); Clear();
} }
void bind_t::Clear(void) void bind_t::Clear
(
void
)
{ {
for (int i = binds.NumObjects(); i > 0; i--) { // FIXME: stub
bind_item_t *bi;
bi = binds.ObjectAt(i);
binds.RemoveObjectAt(i);
if (bi) {
delete bi;
}
}
} }
Event EV_Bind_Header CLASS_DECLARATION( Listener, bindlistener, NULL )
( {
"header",
EV_DEFAULT,
"iss",
"column_num name material",
"Set the header of each column"
);
Event EV_Bind_Width
(
"bind_width",
EV_DEFAULT,
"i",
"width",
"Width of the bind menu"
);
Event EV_Bind_Height
(
"bind_height",
EV_DEFAULT,
"i",
"height",
"Height of the bind menu"
);
Event EV_Bind_FillWidth
(
"bind_fillwidth",
EV_DEFAULT,
"iS",
"width material",
"Width of the filling between widgets"
);
Event EV_Bind_CommandWidth
(
"bind_commandwidth",
EV_DEFAULT,
"i",
"width",
"Width of the command item"
);
Event EV_Bind_CommandHeight
(
"bind_commandheight",
EV_DEFAULT,
"i",
"height",
"Height of the command item"
);
Event EV_Bind_PrimaryKeyWidth
(
"bind_primarykeywidth",
EV_DEFAULT,
"i",
"width",
"Width of the primary key item"
);
Event EV_Bind_PrimaryKeyHeight
(
"bind_primarykeyheight",
EV_DEFAULT,
"i",
"height",
"Height of the primary key item"
);
Event EV_Bind_AlternateKeyWidth
(
"bind_alternatekeywidth",
EV_DEFAULT,
"i",
"width",
"Width of the alternate key item"
);
Event EV_Bind_AlternateKeyHeight
(
"bind_alternatekeyheight",
EV_DEFAULT,
"i",
"height",
"Height of the alternate key item"
);
Event EV_Bind_NewItem
(
"binditem",
EV_DEFAULT,
"ss",
"name command",
"Create a new bind item in the interface"
);
Event EV_Bind_Align
(
"align",
EV_DEFAULT,
"sSSSSS",
"arg1 arg2 arg3 arg4 arg5 arg6",
"Set the alignment on the bind menu"
);
Event EV_Bind_TitleForegroundColor
(
"titleforegroundcolor",
EV_DEFAULT,
"ffff",
"r g b a",
"Set the color for the title foreground"
);
Event EV_Bind_TitleBackgroundColor
(
"titlebackgroundcolor",
EV_DEFAULT,
"ffff",
"r g b a",
"Set the color for the title background"
);
Event EV_Bind_InactiveForegroundColor
(
"inactiveforegroundcolor",
EV_DEFAULT,
"ffff",
"r g b a",
"Set the color for the inactive button foreground"
);
Event EV_Bind_InactiveBackgroundColor
(
"inactivebackgroundcolor",
EV_DEFAULT,
"ffff",
"r g b a",
"Set the color for the inactive button background"
);
Event EV_Bind_ActiveForegroundColor
(
"activeforegroundcolor",
EV_DEFAULT,
"ffff",
"r g b a",
"Set the color for the active button foreground"
);
Event EV_Bind_ActiveBackgroundColor
(
"activebackgroundcolor",
EV_DEFAULT,
"ffff",
"r g b a",
"Set the color for the active button background"
);
Event EV_Bind_ActiveBorderColor
(
"activebordercolor",
EV_DEFAULT,
"ffff",
"r g b a",
"Set the color for the active button border"
);
Event EV_Bind_HighlightForegroundColor
(
"highlightforegroundcolor",
EV_DEFAULT,
"ffff",
"r g b a",
"Set the color for the highlighted button foreground"
);
Event EV_Bind_HighlightBackgroundColor
(
"highlightbackgroundcolor",
EV_DEFAULT,
"ffff",
"r g b a",
"Set the color for the highlighted button background"
);
Event EV_Bind_SelectForegroundColor
(
"selectforegroundcolor",
EV_DEFAULT,
"ffff",
"r g b a",
"Set the color for the selected button foreground"
);
Event EV_Bind_SelectBackgroundColor
(
"selectbackgroundcolor",
EV_DEFAULT,
"ffff",
"r g b a",
"Set the color for the selected button background"
);
Event EV_Bind_ChangeSound
(
"changesound",
EV_DEFAULT,
"s",
"soundname",
"Set the name of the sound to play when the highlighted item changes"
);
Event EV_Bind_ActiveSound
(
"activesound",
EV_DEFAULT,
"s",
"soundname",
"Set the name of the sound to play when the item is made active"
);
Event EV_Bind_EnterSound
(
"entersound",
EV_DEFAULT,
"s",
"soundname",
"Set the name of the sound to play when the key is entered"
);
CLASS_DECLARATION(Listener, bindlistener, NULL) {
{&EV_Bind_Width, &bindlistener::Width },
{&EV_Bind_Height, &bindlistener::Height },
{&EV_Bind_FillWidth, &bindlistener::FillWidth },
{&EV_Bind_CommandWidth, &bindlistener::CommandWidth },
{&EV_Bind_CommandHeight, &bindlistener::CommandHeight },
{&EV_Bind_PrimaryKeyWidth, &bindlistener::PrimaryKeyWidth },
{&EV_Bind_PrimaryKeyHeight, &bindlistener::PrimaryKeyHeight },
{&EV_Bind_AlternateKeyWidth, &bindlistener::AlternateKeyWidth },
{&EV_Bind_AlternateKeyHeight, &bindlistener::AlternateKeyHeight },
{&EV_Bind_Header, &bindlistener::Header },
{&EV_Bind_NewItem, &bindlistener::NewItem },
{&EV_Bind_Align, &bindlistener::Align },
{&EV_Bind_TitleForegroundColor, &bindlistener::TitleForegroundColor },
{&EV_Bind_TitleBackgroundColor, &bindlistener::TitleBackgroundColor },
{&EV_Bind_InactiveForegroundColor, &bindlistener::InactiveForegroundColor },
{&EV_Bind_InactiveBackgroundColor, &bindlistener::InactiveBackgroundColor },
{&EV_Bind_ActiveForegroundColor, &bindlistener::ActiveForegroundColor },
{&EV_Bind_ActiveBackgroundColor, &bindlistener::ActiveBackgroundColor },
{&EV_Bind_ActiveBorderColor, &bindlistener::ActiveBorderColor },
{&EV_Bind_HighlightForegroundColor, &bindlistener::HighlightForegroundColor},
{&EV_Bind_HighlightBackgroundColor, &bindlistener::HighlightBackgroundColor},
{&EV_Bind_SelectForegroundColor, &bindlistener::SelectForegroundColor },
{&EV_Bind_SelectBackgroundColor, &bindlistener::SelectBackgroundColor },
{&EV_Bind_ChangeSound, &bindlistener::ChangeSound },
{&EV_Bind_ActiveSound, &bindlistener::ActiveSound },
{&EV_Bind_EnterSound, &bindlistener::EnterSound },
{ NULL, NULL } { NULL, NULL }
}; };
bindlistener::bindlistener() {} bindlistener::bindlistener()
{
}
bindlistener::bindlistener
(
bind_t *b
)
bindlistener::bindlistener(bind_t *b)
{ {
bind = b; bind = b;
} }
void bindlistener::Header(Event *ev) bool bindlistener::Load
(
Script& script
)
{ {
int num; // FIXME: stub
return false;
num = ev->GetInteger(1) - 1;
if (num > ARRAY_LEN(bind_t::headers)) {
return;
} }
bind->headers[num] = ev->GetString(2); void bindlistener::Header
if (ev->NumArgs() > 2) { (
bind->headermats[num] = uWinMan.RegisterShader(ev->GetString(3)); Event *ev
} )
}
void bindlistener::ChangeSound(Event *ev)
{ {
bind->changesound = ev->GetString(1); // FIXME: stub
} }
void bindlistener::ActiveSound(Event *ev) void bindlistener::Width
(
Event *ev
)
{ {
bind->activesound = ev->GetString(1); // FIXME: stub
} }
void bindlistener::EnterSound(Event *ev) void bindlistener::FillWidth
(
Event *ev
)
{ {
bind->entersound = ev->GetString(1); // FIXME: stub
} }
void bindlistener::SelectForegroundColor(Event *ev) void bindlistener::Height
(
Event *ev
)
{ {
bind->selectfgcolor.r = ev->GetFloat(1); // FIXME: stub
bind->selectfgcolor.g = ev->GetFloat(2);
bind->selectfgcolor.b = ev->GetFloat(3);
bind->selectfgcolor.a = ev->GetFloat(4);
} }
void bindlistener::SelectBackgroundColor(Event *ev) void bindlistener::CommandWidth
(
Event *ev
)
{ {
bind->selectbgcolor.r = ev->GetFloat(1); // FIXME: stub
bind->selectbgcolor.g = ev->GetFloat(2);
bind->selectbgcolor.b = ev->GetFloat(3);
bind->selectbgcolor.a = ev->GetFloat(4);
} }
void bindlistener::TitleForegroundColor(Event *ev) void bindlistener::CommandHeight
(
Event *ev
)
{ {
bind->titlefgcolor.r = ev->GetFloat(1); // FIXME: stub
bind->titlefgcolor.g = ev->GetFloat(2);
bind->titlefgcolor.b = ev->GetFloat(3);
bind->titlefgcolor.a = ev->GetFloat(4);
} }
void bindlistener::TitleBackgroundColor(Event *ev) void bindlistener::PrimaryKeyWidth
(
Event *ev
)
{ {
bind->titlebgcolor.r = ev->GetFloat(1); // FIXME: stub
bind->titlebgcolor.g = ev->GetFloat(2);
bind->titlebgcolor.b = ev->GetFloat(3);
bind->titlebgcolor.a = ev->GetFloat(4);
} }
void bindlistener::ActiveBorderColor(Event *ev) void bindlistener::PrimaryKeyHeight
(
Event *ev
)
{ {
bind->activebordercolor.r = ev->GetFloat(1); // FIXME: stub
bind->activebordercolor.g = ev->GetFloat(2);
bind->activebordercolor.b = ev->GetFloat(3);
bind->activebordercolor.a = ev->GetFloat(4);
} }
void bindlistener::ActiveForegroundColor(Event *ev) void bindlistener::AlternateKeyWidth
(
Event *ev
)
{ {
bind->activefgcolor.r = ev->GetFloat(1); // FIXME: stub
bind->activefgcolor.g = ev->GetFloat(2);
bind->activefgcolor.b = ev->GetFloat(3);
bind->activefgcolor.a = ev->GetFloat(4);
} }
void bindlistener::ActiveBackgroundColor(Event *ev) void bindlistener::AlternateKeyHeight
(
Event *ev
)
{ {
bind->activebgcolor.r = ev->GetFloat(1); // FIXME: stub
bind->activebgcolor.g = ev->GetFloat(2);
bind->activebgcolor.b = ev->GetFloat(3);
bind->activebgcolor.a = ev->GetFloat(4);
} }
void bindlistener::InactiveForegroundColor(Event *ev) void bindlistener::NewItem
(
Event *ev
)
{ {
bind->inactivefgcolor.r = ev->GetFloat(1); // FIXME: stub
bind->inactivefgcolor.g = ev->GetFloat(2);
bind->inactivefgcolor.b = ev->GetFloat(3);
bind->inactivefgcolor.a = ev->GetFloat(4);
} }
void bindlistener::InactiveBackgroundColor(Event *ev) void bindlistener::Align
(
Event *ev
)
{ {
bind->inactivebgcolor.r = ev->GetFloat(1); // FIXME: stub
bind->inactivebgcolor.g = ev->GetFloat(2);
bind->inactivebgcolor.b = ev->GetFloat(3);
bind->inactivebgcolor.a = ev->GetFloat(4);
} }
void bindlistener::HighlightForegroundColor(Event *ev) void bindlistener::TitleForegroundColor
(
Event *ev
)
{ {
bind->highlightfgcolor.r = ev->GetFloat(1); // FIXME: stub
bind->highlightfgcolor.g = ev->GetFloat(2);
bind->highlightfgcolor.b = ev->GetFloat(3);
bind->highlightfgcolor.a = ev->GetFloat(4);
} }
void bindlistener::HighlightBackgroundColor(Event *ev) void bindlistener::TitleBackgroundColor
(
Event *ev
)
{ {
bind->highlightbgcolor.r = ev->GetFloat(1); // FIXME: stub
bind->highlightbgcolor.g = ev->GetFloat(2);
bind->highlightbgcolor.b = ev->GetFloat(3);
bind->highlightbgcolor.a = ev->GetFloat(4);
} }
void bindlistener::Align(Event *ev) void bindlistener::InactiveForegroundColor
(
Event *ev
)
{ {
int i; // FIXME: stub
for (i = 1; i <= ev->NumArgs(); i++) {
str align = ev->GetString(i);
if (!str::icmp(align, "left")) {
bind->align |= WA_LEFT;
} else if (!str::icmp(align, "right")) {
bind->align |= WA_RIGHT;
} else if (!str::icmp(align, "top")) {
bind->align |= WA_TOP;
} else if (!str::icmp(align, "bottom")) {
bind->align |= WA_BOTTOM;
} else if (!str::icmp(align, "centerx")) {
bind->align |= WA_CENTERX;
} else if (!str::icmp(align, "centery")) {
bind->align |= WA_CENTERY;
}
}
} }
void bindlistener::NewItem(Event *ev) void bindlistener::InactiveBackgroundColor
(
Event *ev
)
{ {
bind_item_t *bt; // FIXME: stub
UIReggedMaterial *mat = NULL;
if (ev->NumArgs() > 2) {
mat = uWinMan.RegisterShader(ev->GetString(3));
} }
str n = ev->GetString(1); void bindlistener::ActiveForegroundColor
str c = ev->GetString(2); (
Event *ev
)
bt = new bind_item_t;
bt->name = n;
bt->command = c;
bt->nameMaterial = mat;
bind->binds.AddObject(bt);
}
void bindlistener::Width(Event *ev)
{ {
bind->width = ev->GetInteger(1); // FIXME: stub
} }
void bindlistener::Height(Event *ev) void bindlistener::ActiveBackgroundColor
(
Event *ev
)
{ {
bind->height = ev->GetInteger(1); // FIXME: stub
} }
void bindlistener::FillWidth(Event *ev) void bindlistener::ActiveBorderColor
(
Event *ev
)
{ {
bind->fillwidth = ev->GetInteger(1); // FIXME: stub
if (ev->NumArgs() > 1) {
bind->fillmaterial = uWinMan.RegisterShader(ev->GetString(2));
}
} }
void bindlistener::CommandWidth(Event *ev) void bindlistener::HighlightForegroundColor
(
Event *ev
)
{ {
bind->commandwidth = ev->GetInteger(1); // FIXME: stub
} }
void bindlistener::CommandHeight(Event *ev) void bindlistener::HighlightBackgroundColor
(
Event *ev
)
{ {
bind->commandheight = ev->GetInteger(1); // FIXME: stub
} }
void bindlistener::PrimaryKeyWidth(Event *ev) void bindlistener::SelectForegroundColor
(
Event *ev
)
{ {
bind->primarykeywidth = ev->GetInteger(1); // FIXME: stub
} }
void bindlistener::PrimaryKeyHeight(Event *ev) void bindlistener::SelectBackgroundColor
(
Event *ev
)
{ {
bind->primarykeyheight = ev->GetInteger(1); // FIXME: stub
} }
void bindlistener::AlternateKeyWidth(Event *ev) void bindlistener::ChangeSound
(
Event *ev
)
{ {
bind->alternatekeywidth = ev->GetInteger(1); // FIXME: stub
} }
void bindlistener::AlternateKeyHeight(Event *ev) void bindlistener::ActiveSound
(
Event *ev
)
{ {
bind->alternatekeyheight = ev->GetInteger(1); // FIXME: stub
} }
bool bindlistener::Load(Script& script) void bindlistener::EnterSound
(
Event *ev
)
{ {
str token; // FIXME: stub
str errortext;
while (script.TokenAvailable(true)) {
token = script.GetToken(true);
if (!token.length() || !ValidEvent(token)) {
throw "invalid token";
}
Event *event = new Event(token);
while (script.TokenAvailable(false)) {
event->AddToken(script.GetToken(false));
}
ProcessEvent(event);
}
return true;
}
bool CL_LoadBind(const char *filename, bind_t *bind)
{
Script script;
bind->Clear();
bindlistener listener(bind);
script.LoadFile(filename);
// Load the bind file
return listener.Load(script);
} }

View file

@ -1,6 +1,6 @@
/* /*
=========================================================================== ===========================================================================
Copyright (C) 2023 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.
@ -20,10 +20,10 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
=========================================================================== ===========================================================================
*/ */
#pragma once #ifndef __CL_UIBIND_H__
#define __CL_UIBIND_H__
class bind_item_t class bind_item_t {
{
public: public:
str name; str name;
str command; str command;
@ -33,20 +33,27 @@ public:
bind_item_t( str name, str command, UIReggedMaterial *nameMaterial ); bind_item_t( str name, str command, UIReggedMaterial *nameMaterial );
}; };
inline bind_item_t::bind_item_t() inline
bind_item_t::bind_item_t()
{ {
nameMaterial = NULL; nameMaterial = NULL;
} }
inline bind_item_t::bind_item_t(str name, str command, UIReggedMaterial *nameMaterial) inline
bind_item_t::bind_item_t
(
str name,
str command,
UIReggedMaterial *nameMaterial
)
{ {
this->name = name; this->name = name;
this->command = command; this->command = command;
this->nameMaterial = nameMaterial; this->nameMaterial = nameMaterial;
} }
class bind_t class bind_t {
{
public: public:
int width; int width;
int height; int height;
@ -84,8 +91,7 @@ public:
void Clear( void ); void Clear( void );
}; };
class bindlistener : public Listener class bindlistener : public Listener {
{
protected: protected:
bind_t *bind; bind_t *bind;
@ -125,4 +131,4 @@ public:
void EnterSound( Event *ev ); void EnterSound( Event *ev );
}; };
bool CL_LoadBind(const char* filename, bind_t* bind); #endif

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 },
@ -61,13 +61,13 @@ UIDMBox::UIDMBox()
m_iBeginDecay = 0; m_iBeginDecay = 0;
m_boxtime = uid.time; m_boxtime = uid.time;
m_movespeed = 500; m_movespeed = 500;
m_drawoutline = com_target_game->integer >= target_game_e::TG_MOHTA;
} }
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 +94,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 +135,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,21 +154,20 @@ 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++;
} }
} }
if (m_items[0].flags & DMBOX_ITEM_FLAG_BOLD) {
fDelayTime = iNumLines * 8.0;
}
// //
// Bold as twice more decay // Bold as twice more decay
// //
else if (m_items[0].flags & DMBOX_ITEM_FLAG_DEATH) { if (m_items[0].flags & DMBOX_ITEM_FLAG_BOLD) {
fDelayTime = iNumLines * 6.0; fDelayTime = iNumLines * 6.0;
} else { }
else {
fDelayTime = iNumLines * 5.0; fDelayTime = iNumLines * 5.0;
} }
@ -195,27 +202,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 +250,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,44 +262,19 @@ 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 )
{ {
if (m_drawoutline) {
//
// Draw an outline
//
in->font->setColor(UBlack);
in->font->setAlpha(alpha);
PrintWrap(in->font, x + 1, y + 2, in->string);
PrintWrap(in->font, x + 2, y + 1, in->string);
PrintWrap(in->font, x - 1, y + 2, in->string);
PrintWrap(in->font, x - 2, y + 1, in->string);
PrintWrap(in->font, x - 1, y - 2, in->string);
PrintWrap(in->font, x - 2, y - 1, in->string);
PrintWrap(in->font, x + 1, y - 2, in->string);
PrintWrap(in->font, x + 2, y - 1, in->string);
PrintWrap(in->font, x + 2, y, in->string);
PrintWrap(in->font, x - 2, y, in->string);
PrintWrap(in->font, x, y + 2, in->string);
PrintWrap(in->font, x, y - 2, in->string);
}
in->font->setColor(in->color); in->font->setColor(in->color);
in->font->setAlpha(alpha); in->font->setAlpha(alpha);
@ -290,7 +285,8 @@ void UIDMBox::Print(const char *text)
{ {
const char* text1 = text; const char* text1 = text;
if (m_numitems > 5) { if (m_numitems > 4)
{
// //
// Overwrite an item // Overwrite an item
// //
@ -299,30 +295,37 @@ 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].color = ULightRed;
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_BOLD;
text1 = text + 1; text1 = text + 1;
} else if (*text == MESSAGE_CHAT_GREEN) { }
m_items[m_numitems].color = UGreenChatMessageColor; else if (*text == MESSAGE_CHAT_GREEN)
{
m_items[m_numitems].color = UGreen;
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_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_dmboxWidth); m_items[m_numitems].string = CalculateBreaks(m_items[m_numitems].font, text1, s_dmboxWidth);
m_numitems++; m_numitems++;
VerifyBoxOut(); VerifyBoxOut();
@ -355,7 +358,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 )
{ {
@ -372,7 +377,7 @@ void UIDMBox::Draw(void)
float alpha; float alpha;
float alphaScale; float alphaScale;
alphaScale = 0.8f; alphaScale = 0.8;
HandleBoxMoving(); HandleBoxMoving();
if (!m_numitems) { if (!m_numitems) {
@ -384,14 +389,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 +401,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

@ -1,6 +1,6 @@
/* /*
=========================================================================== ===========================================================================
Copyright (C) 2015-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.
@ -20,10 +20,10 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
=========================================================================== ===========================================================================
*/ */
#pragma once #ifndef __CL_UIDMBOX_H__
#define __CL_UIDMBOX_H__
static constexpr unsigned int DMBOX_ITEM_FLAG_BOLD = 2u; static constexpr unsigned int DMBOX_ITEM_FLAG_BOLD = 1u;
static constexpr unsigned int DMBOX_ITEM_FLAG_DEATH = 4u;
typedef enum { box_moving_out, box_moving_in, box_out, box_in } boxstate_t; typedef enum { box_moving_out, box_moving_in, box_out, box_in } boxstate_t;
@ -46,8 +46,6 @@ protected:
int m_movespeed; int m_movespeed;
int m_iBeginDecay; int m_iBeginDecay;
int m_iEndDecay; int m_iEndDecay;
// Added in OPM
bool m_drawoutline;
public: public:
CLASS_PROTOTYPE( UIDMBox ); CLASS_PROTOTYPE( UIDMBox );
@ -76,3 +74,5 @@ public:
void setRealShow( bool b ); void setRealShow( bool b );
void Clear( void ); void Clear( void );
}; };
#endif /* __CL_UIDMBOX_H__ */

View file

@ -1,6 +1,6 @@
/* /*
=========================================================================== ===========================================================================
Copyright (C) 2023 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.
@ -22,256 +22,72 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
#include "cl_ui.h" #include "cl_ui.h"
class FilePickerItem : public UIListCtrlItem CLASS_DECLARATION( USignal, FilePickerClass, NULL )
{ {
str strings[3];
public:
FilePickerItem(const str& fileName, const str& date, const str& size);
int getListItemValue(int which) const override;
griditemtype_t getListItemType(int which) const override;
str getListItemString(int which) const override;
void DrawListItem(int iColumn, const UIRect2D& drawRect, bool bSelected, UIFont *pFont) override;
qboolean IsHeaderEntry() const override;
};
CLASS_DECLARATION(USignal, FilePickerClass, NULL) {
{&EV_UIListBase_ItemSelected, &FilePickerClass::FileSelected },
{&EV_UIListBase_ItemDoubleClicked, &FilePickerClass::FileChosen },
{&W_Deactivated, &FilePickerClass::OnDeactivated},
{ NULL, NULL } { NULL, NULL }
}; };
FilePickerClass::FilePickerClass() FilePickerClass::FilePickerClass()
{ {
window = new UIFloatingWindow(); // FIXME: stub
window->Create(
NULL,
UIRect2D((uid.vidWidth - 400) / 2, (uid.vidHeight - 300) / 2, 400, 300),
"File Picker",
UColor(0.15f, 0.195f, 0.278f),
UHudColor
);
window->Connect(this, W_Deactivated, W_Deactivated);
listbox = new UIListCtrl();
listbox->InitFrame(window->getChildSpace(), window->getChildSpace()->getClientFrame(), 0);
listbox->setBackgroundColor(UColor(0.02f, 0.07f, 0.005f), true);
listbox->setForegroundColor(UHudColor);
listbox->AddColumn("File Name", 0, 175, false, false);
listbox->AddColumn("Date", 1, 125, false, false);
listbox->AddColumn("Size", 2, 100, true, false);
listbox->Connect(this, EV_UIListBase_ItemDoubleClicked, EV_UIListBase_ItemDoubleClicked);
listbox->Connect(this, EV_UIListBase_ItemSelected, EV_UIListBase_ItemSelected);
listbox->AllowActivate(true);
// Added in 2.0
// Don't localize elements
listbox->SetDontLocalize();
} }
FilePickerClass::~FilePickerClass() FilePickerClass::~FilePickerClass()
{ {
if (listbox) { // FIXME: stub
delete listbox;
listbox = NULL;
}
if (window) {
delete window;
window = NULL;
}
}
void FilePickerClass::Setup(
const char *root_directory, const char *current_directory, const char *ext, const char *ignore_files
)
{
Initialize(root_directory, current_directory, ext, ignore_files);
}
void FilePickerClass::Initialize(
const char *root_directory, const char *current_directory, const char *ext, const char *ignore_files
)
{
rootDirectory = root_directory;
if (rootDirectory.length() > 1 && rootDirectory[rootDirectory.length() - 1] != '/') {
rootDirectory += "/";
}
currentDirectory = current_directory;
if (currentDirectory.length() > 1 && currentDirectory[currentDirectory.length() - 1] != '/') {
currentDirectory += "/";
}
extension = ext;
if (ignore_files) {
ignoredFiles = ignore_files;
}
SetupFiles();
}
void FilePickerClass::GotoParentDirectory(void)
{
int i;
if (currentDirectory == rootDirectory) {
return;
}
for (i = currentDirectory.length() - 2; i > 0; i--) {
if (currentDirectory[i] == '/') {
break;
}
}
if (currentDirectory[i] == '/') {
i++;
}
currentDirectory = str(currentDirectory, 0, i);
// refresh files
SetupFiles();
}
void FilePickerClass::GotoSubDirectory(str subdir)
{
currentDirectory += subdir + "/";
// refresh files
SetupFiles();
} }
void FilePickerClass::SetupFiles( void ) void FilePickerClass::SetupFiles( void )
{ {
str mappath; // FIXME: stub
str work;
char **filenames;
int numfiles;
int i;
char date[128];
char size[128];
listbox->DeleteAllItems();
if (currentDirectory != rootDirectory) {
// create the parent directory item
listbox->AddItem(new FilePickerItem("..", "", ""));
} }
// retrieve directories void FilePickerClass::GotoParentDirectory( void )
filenames = FS_ListFiles(currentDirectory, "/", qfalse, &numfiles);
for (i = 0; i < numfiles; i++) {
const char *filename = filenames[i];
if (filename[0] == '.' || !strlen(filename)) {
continue;
}
work = "[";
work += filename;
work += "]";
FS_FileTime(currentDirectory + filename, date, size);
listbox->AddItem(new FilePickerItem(work, date, size));
}
FS_FreeFileList(filenames);
filenames = FS_ListFiles(currentDirectory, extension, qfalse, &numfiles);
for (i = 0; i < numfiles; i++) {
const char *filename = filenames[i];
if (ignoredFiles.length() && strstr(filename, ignoredFiles)) {
// Added in 2.0
// Check for ignored files
continue;
}
work = filename;
FS_FileTime(currentDirectory + work, date, size);
listbox->AddItem(new FilePickerItem(work, date, size));
}
FS_FreeFileList(filenames);
window->setTitle(currentDirectory);
}
void FilePickerClass::FileSelected(const str& currentDirectory, const str& partialName, const str& fullname) {}
void FilePickerClass::FileSelected(Event *ev)
{ {
str name = listbox->GetItem(listbox->getCurrentItem())->getListItemString(0); // FIXME: stub
if (*name != '[' && *name != '.') {
FileSelected(currentDirectory, name, currentDirectory + name);
} }
uii.Snd_PlaySound("sound/menu/scroll.wav"); void FilePickerClass::GotoSubDirectory( str subdir )
}
void FilePickerClass::FileChosen(const str& currentDirectory, const str& partialName, const str& fullname) {}
void FilePickerClass::FileChosen(Event *ev)
{ {
str filename = listbox->GetItem(listbox->getCurrentItem())->getListItemString(0); // FIXME: stub
if (*filename == '[') {
uii.Snd_PlaySound("sound/menu/scroll.wav");
GotoSubDirectory(str(filename, 1, filename.length() - 1));
} else if (*filename == '.') {
GotoParentDirectory();
} else {
uii.Snd_PlaySound("sound/menu/apply.wav");
FileChosen(currentDirectory, filename, currentDirectory + filename);
} }
void FilePickerClass::Initialize( const char *root_directory, const char *current_directory, const char *ext )
{
// FIXME: stub
} }
void FilePickerClass::CloseWindow( void ) void FilePickerClass::CloseWindow( void )
{ {
PostEvent(EV_Remove, 0); // FIXME: stub
}
void FilePickerClass::FileSelected( Event *ev )
{
// FIXME: stub
}
void FilePickerClass::FileSelected( str &currentDirectory, str &partialName, str &fullname )
{
// FIXME: stub
}
void FilePickerClass::FileChosen( Event *ev )
{
// FIXME: stub
}
void FilePickerClass::FileChosen( str &currentDirectory, str &partialName, str &fullname )
{
// FIXME: stub
} }
void FilePickerClass::OnDeactivated( Event *ev ) void FilePickerClass::OnDeactivated( Event *ev )
{ {
CloseWindow(); // FIXME: stub
} }
FilePickerItem::FilePickerItem(const str& fileName, const str& date, const str& size) void FilePickerClass::Setup( const char *root_directory, const char *current_directory, const char *ext )
{ {
strings[0] = fileName; // FIXME: stub
strings[1] = date;
strings[2] = size;
}
int FilePickerItem::getListItemValue(int which) const
{
return atoi(strings[which]);
}
griditemtype_t FilePickerItem::getListItemType(int which) const
{
return griditemtype_t::TYPE_STRING;
}
str FilePickerItem::getListItemString(int which) const
{
return strings[which];
}
void FilePickerItem::DrawListItem(int iColumn, const UIRect2D& drawRect, bool bSelected, UIFont *pFont) {}
qboolean FilePickerItem::IsHeaderEntry() const
{
return qfalse;
} }

View file

@ -1,6 +1,6 @@
/* /*
=========================================================================== ===========================================================================
Copyright (C) 2023 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.
@ -20,19 +20,17 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
=========================================================================== ===========================================================================
*/ */
#pragma once #ifndef __CL_UIFILEPICKER_H__
#define __CL_UIFILEPICKER_H__
class UIListCtrl; class UIListCtrl;
class FilePickerClass : public USignal class FilePickerClass : public USignal {
{
UIFloatingWindow *window; UIFloatingWindow *window;
UIListCtrl *listbox; UIListCtrl *listbox;
str currentDirectory; str currentDirectory;
str rootDirectory; str rootDirectory;
str extension; str extension;
// Added in 2.0
str ignoredFiles;
public: public:
CLASS_PROTOTYPE( FilePickerClass ); CLASS_PROTOTYPE( FilePickerClass );
@ -41,20 +39,21 @@ private:
void SetupFiles( void ); void SetupFiles( void );
void GotoParentDirectory( void ); void GotoParentDirectory( void );
void GotoSubDirectory( str subdir ); void GotoSubDirectory( str subdir );
// ignore_files parameter, added in 2.0 void Initialize( const char *root_directory, const char *current_directory, const char *ext );
void Initialize(const char *root_directory, const char *current_directory, const char *ext, const char* ignore_files);
protected: protected:
void CloseWindow( void ); void CloseWindow( void );
void FileSelected( Event *ev ); void FileSelected( Event *ev );
virtual void FileSelected(const str& currentDirectory, const str& partialName, const str& fullname); virtual void FileSelected( str &currentDirectory, str &partialName, str &fullname );
void FileChosen( Event *ev ); void FileChosen( Event *ev );
virtual void FileChosen(const str& currentDirectory, const str& partialName, const str& fullname); virtual void FileChosen( str &currentDirectory, str &partialName, str &fullname );
void OnDeactivated( Event *ev ); void OnDeactivated( Event *ev );
public: public:
FilePickerClass(); FilePickerClass();
~FilePickerClass(); ~FilePickerClass();
void Setup(const char *root_directory, const char *current_directory, const char *ext, const char* ignore_files = NULL); void Setup( const char *root_directory, const char *current_directory, const char *ext );
}; };
#endif /* __CL_UIFILEPICKER_H__ */

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 },
@ -61,13 +61,13 @@ UIGMBox::UIGMBox()
m_iBeginDecay = 0; m_iBeginDecay = 0;
m_boxtime = uid.time; m_boxtime = uid.time;
m_movespeed = 500; m_movespeed = 500;
m_drawoutline = com_target_game->integer >= target_game_e::TG_MOHTA;
} }
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 +94,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 +141,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 +152,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 +199,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 +247,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,44 +259,19 @@ 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 )
{ {
if (m_drawoutline) {
//
// Draw an outline
//
in->font->setColor(UBlack);
in->font->setAlpha(alpha);
PrintWrap(in->font, x + 1, y + 2, in->string);
PrintWrap(in->font, x + 2, y + 1, in->string);
PrintWrap(in->font, x - 1, y + 2, in->string);
PrintWrap(in->font, x - 2, y + 1, in->string);
PrintWrap(in->font, x - 1, y - 2, in->string);
PrintWrap(in->font, x - 2, y - 1, in->string);
PrintWrap(in->font, x + 1, y - 2, in->string);
PrintWrap(in->font, x + 2, y - 1, in->string);
PrintWrap(in->font, x + 2, y, in->string);
PrintWrap(in->font, x - 2, y, in->string);
PrintWrap(in->font, x, y + 2, in->string);
PrintWrap(in->font, x, y - 2, in->string);
}
in->font->setColor(in->color); in->font->setColor(in->color);
in->font->setAlpha(alpha); in->font->setAlpha(alpha);
@ -287,7 +282,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 +292,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 +339,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 +370,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 +382,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 +407,4 @@ void UIGMBox::Clear(void)
{ {
m_numitems = 0; m_numitems = 0;
} }

View file

@ -1,6 +1,6 @@
/* /*
=========================================================================== ===========================================================================
Copyright (C) 2015-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.
@ -20,7 +20,8 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
=========================================================================== ===========================================================================
*/ */
#pragma once #ifndef __CL_UIGMBOX_H__
#define __CL_UIGMBOX_H__
static constexpr unsigned int GMBOX_ITEM_FLAG_BOLD = 1u; static constexpr unsigned int GMBOX_ITEM_FLAG_BOLD = 1u;
@ -43,8 +44,6 @@ protected:
int m_movespeed; int m_movespeed;
int m_iBeginDecay; int m_iBeginDecay;
int m_iEndDecay; int m_iEndDecay;
// Added in OPM
bool m_drawoutline;
public: public:
CLASS_PROTOTYPE( UIGMBox ); CLASS_PROTOTYPE( UIGMBox );
@ -73,3 +72,5 @@ public:
void setRealShow( bool b ); void setRealShow( bool b );
void Clear( void ); void Clear( void );
}; };
#endif

View file

@ -1,6 +1,6 @@
/* /*
=========================================================================== ===========================================================================
Copyright (C) 2023-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,224 +21,44 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/ */
#include "cl_ui.h" #include "cl_ui.h"
#include "../qcommon/localization.h"
class LANGameItem : public UIListCtrlItem CLASS_DECLARATION( UIListCtrl, UILANGameClass, NULL )
{ {
str strings[6];
public:
LANGameItem();
LANGameItem(
const str& hostName, const str& mapName, const str& players, const str& gameTypeString, const str& ping, const str& ipAddress
);
int getListItemValue(int which) const override;
griditemtype_t getListItemType(int which) const override;
str getListItemString(int which) const override;
void DrawListItem(int iColumn, const UIRect2D& drawRect, bool bSelected, UIFont *pFont) override;
qboolean IsHeaderEntry() const override;
};
Event EV_LANGame_JoinGame
(
"joingame",
EV_DEFAULT,
NULL,
NULL,
"Join the currently selected server"
);
CLASS_DECLARATION(UIListCtrl, UILANGameClass, NULL) {
{&EV_UIListBase_ItemSelected, &UILANGameClass::SelectServer},
{&EV_UIListBase_ItemDoubleClicked, &UILANGameClass::JoinServer },
{&EV_LANGame_JoinGame, &UILANGameClass::JoinServer },
{ NULL, NULL } { NULL, NULL }
}; };
UILANGameClass::UILANGameClass() UILANGameClass::UILANGameClass()
{ {
Connect(this, EV_UIListBase_ItemDoubleClicked, EV_UIListBase_ItemDoubleClicked); // FIXME: stub
Connect(this, EV_UIListBase_ItemSelected, EV_UIListBase_ItemSelected);
AllowActivate(true);
setHeaderFont("facfont-20");
m_iLastUpdateTime = 0;
m_noservers_mat = uWinMan.RegisterShader("textures/menu/noservers");
//
// Added in OPM
//
m_bVirtual = false;
}
void UILANGameClass::Draw(void)
{
if (cls.bNewLocalServerInfo) {
SetupServers();
}
UIListCtrl::Draw();
if (!getNumItems() && m_noservers_mat) {
float x, y, w, h;
w = re.GetShaderWidth(m_noservers_mat->GetMaterial()) * m_vVirtualScale[0];
h = re.GetShaderHeight(m_noservers_mat->GetMaterial()) * m_vVirtualScale[1];
UIRect2D frame = getClientFrame();
x = (frame.size.width - w) * 0.5f;
y = (frame.size.height - h) * 0.5f;
re.DrawStretchPic(x, y, w, h, 0, 0, 1, 1, m_noservers_mat->GetMaterial());
}
if (m_iLastUpdateTime && m_iLastUpdateTime < cls.realtime) {
Cvar_Set("cl_langamerefreshstatus", "Ready");
m_iLastUpdateTime = 0;
}
}
void UILANGameClass::UpdateUIElement(void)
{
float width;
RemoveAllColumns();
width = getClientFrame().size.width - 16.f;
AddColumn(Sys_LV_CL_ConvertString("Server Name"), 0, width * 0.27f, false, false); // was 0.4
AddColumn(Sys_LV_CL_ConvertString("Map"), 1, width * 0.12f, false, false); // was 0.15
AddColumn(Sys_LV_CL_ConvertString("Players"), 2, width * 0.08f, true, true); // was 0.165
AddColumn(Sys_LV_CL_ConvertString("GameType"), 3, width * 0.118f, false, false); // was 0.22
AddColumn(Sys_LV_CL_ConvertString("Ping"), 4, width * 0.052f, true, false); // was 0.065
AddColumn(Sys_LV_CL_ConvertString("IP"), 5, width * 0.36f, false, false); // Added in OPM
uWinMan.ActivateControl(this);
SetupServers();
} }
void UILANGameClass::SetupServers( void ) void UILANGameClass::SetupServers( void )
{ {
int i; // FIXME: stub
LANGameItem *pItem;
const serverInfo_t *pServerInfo;
for (i = 1; i <= cls.numlocalservers; i++) {
pServerInfo = &cls.localServers[i - 1];
if (i > getNumItems()) {
pItem = new LANGameItem();
AddItem(pItem);
} else {
pItem = static_cast<LANGameItem *>(GetItem(i));
} }
*pItem = LANGameItem( void UILANGameClass::Draw( void )
pServerInfo->hostName, {
pServerInfo->mapName, // FIXME: stub
va("%02i/%02i", pServerInfo->clients, pServerInfo->maxClients),
pServerInfo->gameTypeString,
str(pServerInfo->ping),
// Added in OPM
NET_AdrToStringwPort(pServerInfo->adr)
);
}
while (cls.numlocalservers < getNumItems()) {
DeleteItem(getNumItems());
}
cls.bNewLocalServerInfo = false;
m_iLastUpdateTime = 0;
} }
void UILANGameClass::SelectServer( Event *ev ) void UILANGameClass::SelectServer( Event *ev )
{ {
const serverInfo_t& serverInfo = cls.localServers[getCurrentItem() - 1]; // FIXME: stub
static const char info[] = "\xFF\xFF\xFF\xFF\x02getinfo xxx";
Com_Printf("Requesting updated info from server...\n");
Cvar_Set("cl_langamerefreshstatus", "Requesting updated info from server...");
NET_SendPacket(NS_CLIENT, sizeof(info), info, serverInfo.adr);
m_iLastUpdateTime = cls.realtime + 3000;
} }
void UILANGameClass::JoinServer( Event *ev ) void UILANGameClass::JoinServer( Event *ev )
{ {
if (!getCurrentItem()) { // FIXME: stub
return;
}
const serverInfo_t& serverInfo = cls.localServers[getCurrentItem() - 1];
UI_SetReturnMenuToCurrent();
CL_Connect(NET_AdrToStringwPort(serverInfo.adr), netadrtype_t::NA_UNSPEC);
} }
qboolean UILANGameClass::KeyEvent( int key, unsigned int time ) qboolean UILANGameClass::KeyEvent( int key, unsigned int time )
{ {
switch (key) { // FIXME: stub
case K_ENTER:
case K_KP_ENTER:
JoinServer(NULL);
return true;
case K_UPARROW:
if (getCurrentItem() > 1) {
TrySelectItem(getCurrentItem() - 1);
SelectServer(NULL);
}
return false;
case K_DOWNARROW:
if (getCurrentItem() < getNumItems()) {
TrySelectItem(getCurrentItem() + 1);
SelectServer(NULL);
}
return false;
}
return UIListBase::KeyEvent(key, time);
}
LANGameItem::LANGameItem() {}
LANGameItem::LANGameItem(
const str& hostName, const str& mapName, const str& players, const str& gameTypeString, const str& ping, const str& ipAddress
)
{
strings[0] = hostName;
strings[1] = mapName;
strings[2] = players;
strings[3] = gameTypeString;
strings[4] = ping;
//
// Added in OPM
//
strings[5] = ipAddress;
}
int LANGameItem::getListItemValue(int which) const
{
return atoi(strings[which]);
}
griditemtype_t LANGameItem::getListItemType(int which) const
{
return griditemtype_t::TYPE_STRING;
}
str LANGameItem::getListItemString(int which) const
{
return strings[which];
}
void LANGameItem::DrawListItem(int iColumn, const UIRect2D& drawRect, bool bSelected, UIFont *pFont) {}
qboolean LANGameItem::IsHeaderEntry() const
{
return qfalse; return qfalse;
} }
void UILANGameClass::UpdateUIElement( void )
{
// FIXME: stub
}

View file

@ -1,6 +1,6 @@
/* /*
=========================================================================== ===========================================================================
Copyright (C) 2023 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.
@ -20,10 +20,10 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
=========================================================================== ===========================================================================
*/ */
#pragma once #ifndef __CL_UILANGAME_H__
#define __CL_UILANGAME_H__
class UILANGameClass : public UIListCtrl class UILANGameClass : public UIListCtrl {
{
protected: protected:
int m_iLastUpdateTime; int m_iLastUpdateTime;
UIReggedMaterial *m_noservers_mat; UIReggedMaterial *m_noservers_mat;
@ -44,3 +44,5 @@ protected:
public: public:
UILANGameClass(); UILANGameClass();
}; };
#endif /* __CL_UILANGAME_H__ */

View file

@ -1,6 +1,6 @@
/* /*
=========================================================================== ===========================================================================
Copyright (C) 2023 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,359 +21,63 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/ */
#include "cl_ui.h" #include "cl_ui.h"
#include "../qcommon/localization.h"
class FAKKLoadGameItem : public UIListCtrlItem CLASS_DECLARATION( UIListCtrl, UIFAKKLoadGameClass, NULL )
{ {
str strings[4];
public:
FAKKLoadGameItem(const str& missionName, const str& elapsedTime, const str& dateTime, const str& fileName);
int getListItemValue(int which) const override;
griditemtype_t getListItemType(int which) const override;
str getListItemString(int which) const override;
void DrawListItem(int iColumn, const UIRect2D& drawRect, bool bSelected, UIFont *pFont) override;
qboolean IsHeaderEntry() const override;
};
static UIFAKKLoadGameClass *loadgame_ui = NULL;
Event EV_FAKKLoadGame_LoadGame
(
"loadgame",
EV_DEFAULT,
NULL,
NULL,
"Load the currently selected game"
);
Event EV_FAKKLoadGame_RemoveGame
(
"removegame",
EV_DEFAULT,
NULL,
NULL,
"Delete the currently selected game"
);
Event EV_FAKKLoadGame_DeleteGame
(
"deletegame",
EV_DEFAULT,
NULL,
NULL,
"Delete the currently selected game... for real"
);
Event EV_FAKKLoadGame_NoDeleteGame
(
"nodeletegame",
EV_DEFAULT,
NULL,
NULL,
"Delete the currently selected game... for real"
);
Event EV_FAKKLoadGame_SaveGame
(
"savegame",
EV_DEFAULT,
NULL,
NULL,
"Save the currently selected game"
);
CLASS_DECLARATION(UIListCtrl, UIFAKKLoadGameClass, NULL) {
{&EV_UIListBase_ItemSelected, &UIFAKKLoadGameClass::SelectGame },
{&EV_UIListBase_ItemDoubleClicked, &UIFAKKLoadGameClass::LoadGame },
{&EV_FAKKLoadGame_RemoveGame, &UIFAKKLoadGameClass::RemoveGame },
{&EV_FAKKLoadGame_DeleteGame, &UIFAKKLoadGameClass::DeleteGame },
{&EV_FAKKLoadGame_NoDeleteGame, &UIFAKKLoadGameClass::NoDeleteGame},
{&EV_FAKKLoadGame_LoadGame, &UIFAKKLoadGameClass::LoadGame },
{&EV_FAKKLoadGame_SaveGame, &UIFAKKLoadGameClass::SaveGame },
{ NULL, NULL } { NULL, NULL }
}; };
UIFAKKLoadGameClass::UIFAKKLoadGameClass() UIFAKKLoadGameClass::UIFAKKLoadGameClass()
{ {
Connect(this, EV_UIListBase_ItemDoubleClicked, EV_UIListBase_ItemDoubleClicked); // FIXME: stub
Connect(this, EV_UIListBase_ItemSelected, EV_UIListBase_ItemSelected);
AllowActivate(true);
m_bRemovePending = false;
setHeaderFont("facfont-20");
loadgame_ui = this;
}
UIFAKKLoadGameClass::~UIFAKKLoadGameClass()
{
loadgame_ui = NULL;
}
void UIFAKKLoadGameClass::UpdateUIElement(void)
{
float width;
RemoveAllColumns();
width = getClientFrame().size.width;
AddColumn(Sys_LV_CL_ConvertString("Mission"), 0, width * 0.555, false, false);
AddColumn(Sys_LV_CL_ConvertString("Elapsed Time"), 1, width * 0.17f, true, true);
AddColumn(Sys_LV_CL_ConvertString("Date & Time Logged"), 2, width * 0.275f, true, true);
uWinMan.ActivateControl(this);
SetupFiles();
}
void UIFAKKLoadGameClass::SetupFiles(void)
{
char **filenames;
int numfiles;
int i;
const char *searchFolder = Com_GetArchiveFolder();
// cleanup
DeleteAllItems();
filenames = FS_ListFiles(searchFolder, "ssv", qfalse, &numfiles);
for (i = 0; i < numfiles; i++) {
const char *filename;
str work;
str gametime;
str date;
fileHandle_t f;
savegamestruct_t save;
filename = filenames[i];
work = searchFolder;
work += "/";
work += filename;
FS_FOpenFileRead(work, &f, qfalse, qtrue);
if (!f) {
continue;
}
FS_Read(&save, sizeof(savegamestruct_t), f);
FS_FCloseFile(f);
Com_SwapSaveStruct(&save);
if (save.version != SAVEGAME_STRUCT_VERSION) {
// wrong save game version
continue;
}
if (save.type != com_target_game->integer) {
continue;
}
gametime = (save.mapTime / 1000);
date = save.time;
AddItem(new FAKKLoadGameItem(save.comment, gametime, date, save.saveName));
}
FS_FreeFileList(filenames);
// sort by date
SortByColumn(2);
// select the first item
TrySelectItem(1);
SelectGame(NULL);
} }
void UIFAKKLoadGameClass::SelectGame( Event *ev ) void UIFAKKLoadGameClass::SelectGame( Event *ev )
{ {
UIWidget *wid; // FIXME: stub
const char *shotName;
if (getCurrentItem() > 0) {
shotName = Com_GetArchiveFileName(GetItem(getCurrentItem())->getListItemString(3), "tga");
} else {
shotName = "textures/menu/no_saved_games.tga";
}
wid = findSibling("LoadSaveShot");
if (!wid) {
return;
}
wid->setMaterial(uWinMan.RefreshShader(shotName));
}
void UIFAKKLoadGameClass::RemoveGame(Event *ev)
{
if (m_bRemovePending || getCurrentItem() <= 0) {
return;
}
Cbuf_ExecuteText(
EXEC_NOW,
"dialog \"\" \"\" \"widgetcommand LoadSaveList deletegame\" \"widgetcommand LoadSaveList nodeletegame\" 256 64 "
"confirm_delete menu_button_trans menu_button_trans\n"
);
m_bRemovePending = true;
}
void UIFAKKLoadGameClass::NoDeleteGame(Event *ev)
{
m_bRemovePending = false;
}
void UIFAKKLoadGameClass::DeleteGame(Event *ev)
{
str name;
cvar_t *var;
m_bRemovePending = false;
if (getCurrentItem() <= 0) {
return;
}
name = GetItem(getCurrentItem())->getListItemString(3);
var = Cvar_Get("g_lastsave", "", 0);
if (!strcmp(name, var->string)) {
// Make sure the last save is not the save being deleted
Cvar_Set("g_lastsave", "");
}
Com_WipeSavegame(name);
SetupFiles();
} }
void UIFAKKLoadGameClass::LoadGame( Event *ev ) void UIFAKKLoadGameClass::LoadGame( Event *ev )
{ {
char cmdString[266]; // FIXME: stub
str name;
if (getCurrentItem() <= 0) {
return;
}
name = GetItem(getCurrentItem())->getListItemString(3);
// Execute the command
Com_sprintf(cmdString, sizeof(cmdString), "loadgame %s\n", name.c_str());
Cbuf_AddText(cmdString);
} }
void UIFAKKLoadGameClass::SaveGame( Event *ev ) void UIFAKKLoadGameClass::SaveGame( Event *ev )
{ {
Cbuf_ExecuteText(EXEC_NOW, "savegame"); // FIXME: stub
}
void UIFAKKLoadGameClass::RemoveGame( Event *ev )
{
// FIXME: stub
}
void UIFAKKLoadGameClass::DeleteGame( Event *ev )
{
// FIXME: stub
}
void UIFAKKLoadGameClass::NoDeleteGame( Event *ev )
{
// FIXME: stub
} }
qboolean UIFAKKLoadGameClass::KeyEvent( int key, unsigned int time ) qboolean UIFAKKLoadGameClass::KeyEvent( int key, unsigned int time )
{ {
switch (key) { // FIXME: stub
case K_DEL:
RemoveGame(NULL);
return qtrue;
case K_ENTER:
case K_KP_ENTER:
LoadGame(NULL);
return qtrue;
case K_UPARROW:
if (getCurrentItem() > 1) {
TrySelectItem(getCurrentItem() - 1);
SelectGame(NULL);
return qtrue;
}
break;
case K_DOWNARROW:
if (getCurrentItem() < getNumItems()) {
TrySelectItem(getCurrentItem() + 1);
SelectGame(NULL);
return qtrue;
}
break;
default:
return UIListCtrl::KeyEvent(key, time);
}
return qfalse; return qfalse;
} }
void UI_SetupFiles(void) void UIFAKKLoadGameClass::UpdateUIElement( void )
{ {
if (loadgame_ui && loadgame_ui->getShow()) { // FIXME: stub
loadgame_ui->SetupFiles();
}
} }
FAKKLoadGameItem::FAKKLoadGameItem( void UIFAKKLoadGameClass::SetupFiles( void )
const str& missionName, const str& elapsedTime, const str& dateTime, const str& fileName
)
{ {
strings[0] = missionName; // FIXME: stub
strings[1] = elapsedTime;
strings[2] = dateTime;
strings[3] = fileName;
} }
int FAKKLoadGameItem::getListItemValue(int which) const void UI_SetupFiles( void ) {
{ // FIXME: stub
return atoi(strings[which]);
}
griditemtype_t FAKKLoadGameItem::getListItemType(int which) const
{
return griditemtype_t::TYPE_STRING;
}
str FAKKLoadGameItem::getListItemString(int which) const
{
str itemstring;
switch (which) {
case 0:
case 3:
itemstring = strings[which];
break;
case 1:
{
int numseconds;
int numseconds_hours;
int seconds;
// hours
numseconds = atol(strings[1]);
itemstring += (numseconds / 3600);
itemstring += ":";
// minutes
numseconds_hours = numseconds % 3600;
if (numseconds_hours / 60 < 10) {
itemstring += "0";
}
itemstring += (numseconds_hours / 60);
itemstring += ":";
// seconds
seconds = numseconds_hours % 60;
if (seconds < 10) {
itemstring += "0";
}
itemstring += seconds;
}
break;
case 2:
{
time_t time;
char buffer[2048];
time = atol(strings[2]);
strftime(buffer, sizeof(buffer), "%a %b %d %Y %H:%M:%S", localtime(&time));
itemstring = buffer;
}
break;
}
return itemstring;
}
void FAKKLoadGameItem::DrawListItem(int iColumn, const UIRect2D& drawRect, bool bSelected, UIFont *pFont) {}
qboolean FAKKLoadGameItem::IsHeaderEntry() const
{
return qfalse;
} }

View file

@ -1,6 +1,6 @@
/* /*
=========================================================================== ===========================================================================
Copyright (C) 2023 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.
@ -20,10 +20,10 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
=========================================================================== ===========================================================================
*/ */
#pragma once #ifndef __CL_UILOADSAVE_H__
#define __CL_UILOADSAVE_H__
class UIFAKKLoadGameClass : public UIListCtrl class UIFAKKLoadGameClass : public UIListCtrl {
{
bool m_bRemovePending; bool m_bRemovePending;
public: public:
@ -38,10 +38,20 @@ protected:
void NoDeleteGame( Event *ev ); void NoDeleteGame( Event *ev );
qboolean KeyEvent( int key, unsigned int time ) override; qboolean KeyEvent( int key, unsigned int time ) override;
void UpdateUIElement( void ) override; void UpdateUIElement( void ) override;
public: public:
UIFAKKLoadGameClass(); UIFAKKLoadGameClass();
~UIFAKKLoadGameClass();
void SetupFiles( void ); void SetupFiles( void );
}; };
#ifdef __cplusplus
extern "C" {
#endif
void UI_SetupFiles( void );
#ifdef __cplusplus
}
#endif
#endif

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