mirror of
https://github.com/FWGS/xash3d-fwgs.git
synced 2026-08-05 19:45:05 +08:00
Compare commits
212 Commits
continuous
...
continuous
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
de21d845ec | ||
|
|
320f8466e6 | ||
|
|
f3208e95b2 | ||
|
|
ea34bc8652 | ||
|
|
3daf014af8 | ||
|
|
ca9d3d262a | ||
|
|
a08f5e439d | ||
|
|
8f6771dff4 | ||
|
|
cd47c6b5b3 | ||
|
|
1f4f3d7fda | ||
|
|
e81b5144b3 | ||
|
|
9ec1caed53 | ||
|
|
ca3b4a9d7f | ||
|
|
87ac217887 | ||
|
|
213650db8f | ||
|
|
ac46164a6e | ||
|
|
6d12d84e94 | ||
|
|
2a18cde60c | ||
|
|
35783bcec2 | ||
|
|
1677835b45 | ||
|
|
2f2780cb1b | ||
|
|
95b134b5a6 | ||
|
|
f60e856f35 | ||
|
|
2ec0d25d85 | ||
|
|
fcd0982524 | ||
|
|
6881ee742d | ||
|
|
f070bbef3c | ||
|
|
dd8c66d90e | ||
|
|
f995d055b5 | ||
|
|
fed65dd497 | ||
|
|
c896425ad9 | ||
|
|
4107bd4e0f | ||
|
|
156b2b2b10 | ||
|
|
13a063bf7d | ||
|
|
ef786b7d79 | ||
|
|
5c0c1b1226 | ||
|
|
d041b2aa27 | ||
|
|
f6d489e038 | ||
|
|
d34fedea69 | ||
|
|
80b3f90091 | ||
|
|
2a4fafc3f9 | ||
|
|
9b3ccf5f04 | ||
|
|
f59ac2360a | ||
|
|
ff21fb42e6 | ||
|
|
288cac69de | ||
|
|
2640b6d869 | ||
|
|
d8910b0e38 | ||
|
|
049bed555e | ||
|
|
fe5944720b | ||
|
|
665c46b281 | ||
|
|
975ab6785e | ||
|
|
6fa4dbfba2 | ||
|
|
0506a1dfce | ||
|
|
908a9930e6 | ||
|
|
7d7e72196b | ||
|
|
7cc67157e5 | ||
|
|
b7ff9c7a24 | ||
|
|
aab1fa1ba2 | ||
|
|
effeba2f44 | ||
|
|
e039ef35c0 | ||
|
|
599a1f026e | ||
|
|
39cba17f01 | ||
|
|
17e106f96d | ||
|
|
081cf9132b | ||
|
|
6a7e027248 | ||
|
|
27100e7751 | ||
|
|
75d9ed341a | ||
|
|
1a0867523d | ||
|
|
7584bbe47e | ||
|
|
505b6cc264 | ||
|
|
24f23908be | ||
|
|
43bd73f37b | ||
|
|
bb2753cbfc | ||
|
|
5568eccc8a | ||
|
|
c3b2cc4423 | ||
|
|
d84130219f | ||
|
|
d97d4d6c42 | ||
|
|
15798aaf52 | ||
|
|
e53892e827 | ||
|
|
cb12af69ed | ||
|
|
e82050a4bc | ||
|
|
e4edd2da45 | ||
|
|
4f80922358 | ||
|
|
ae7ed03376 | ||
|
|
c082e46662 | ||
|
|
b0bbcab6b4 | ||
|
|
0fc83080ec | ||
|
|
73883b504f | ||
|
|
8efc9d74e8 | ||
|
|
373321ff00 | ||
|
|
a508467aac | ||
|
|
abbe993e80 | ||
|
|
c644e4d569 | ||
|
|
c200e008f1 | ||
|
|
e95a2da6d0 | ||
|
|
8afca1a79c | ||
|
|
827c9ca857 | ||
|
|
2416635ba3 | ||
|
|
39eec89580 | ||
|
|
98d88266a6 | ||
|
|
0f3359fc05 | ||
|
|
6c77608c34 | ||
|
|
abdff6eff6 | ||
|
|
95a75465c9 | ||
|
|
119926805f | ||
|
|
f749b5cb4b | ||
|
|
c29ad6b598 | ||
|
|
4c5dfb963e | ||
|
|
e11f9e05d4 | ||
|
|
5c8b5b3511 | ||
|
|
2ea7162287 | ||
|
|
e62ab51842 | ||
|
|
f1bc9b87b1 | ||
|
|
a9bddaac64 | ||
|
|
6cef6f6a75 | ||
|
|
25ea6ed500 | ||
|
|
3d5173f257 | ||
|
|
05ff0d6020 | ||
|
|
3cea12627e | ||
|
|
b59b7c1a8d | ||
|
|
dd2c369df3 | ||
|
|
8b79e49a0f | ||
|
|
4ea6eba8f2 | ||
|
|
f649076bc3 | ||
|
|
8ecffa4663 | ||
|
|
e90b83849a | ||
|
|
d517b9717a | ||
|
|
2c0d6e06be | ||
|
|
dec71850a1 | ||
|
|
b1860972c6 | ||
|
|
1f4c9b67da | ||
|
|
c2da125358 | ||
|
|
31fa990d44 | ||
|
|
d3e60c7d84 | ||
|
|
e2424b4303 | ||
|
|
240563cd1b | ||
|
|
d708cd58fb | ||
|
|
491b503f96 | ||
|
|
636a2228f6 | ||
|
|
bb03e2597c | ||
|
|
21c828ee40 | ||
|
|
132c9de142 | ||
|
|
9d9507d77f | ||
|
|
7daa6c3451 | ||
|
|
c8e1ffe0dd | ||
|
|
b5f02324a6 | ||
|
|
47f5dfdcfd | ||
|
|
33da68b013 | ||
|
|
618ec83c9d | ||
|
|
85de61ebc8 | ||
|
|
2feaae59f7 | ||
|
|
2550d7fbd3 | ||
|
|
565f717804 | ||
|
|
b56c83a2f9 | ||
|
|
bf17996f72 | ||
|
|
a3acb1c85b | ||
|
|
d4d63301e0 | ||
|
|
e9af0c9810 | ||
|
|
131ad9c790 | ||
|
|
bfcaba54dc | ||
|
|
f67736180b | ||
|
|
725b7ea7f9 | ||
|
|
600d574376 | ||
|
|
04f42df7d5 | ||
|
|
ab15662d78 | ||
|
|
072b0cef27 | ||
|
|
e274c62cfc | ||
|
|
a28d45fdb2 | ||
|
|
6ca5f7c6fb | ||
|
|
af316bff14 | ||
|
|
c8945caefc | ||
|
|
8c61a2f021 | ||
|
|
0b24810927 | ||
|
|
b3d8fb03bf | ||
|
|
02c5890c2f | ||
|
|
0579e40857 | ||
|
|
c77f290bc6 | ||
|
|
7bf9407177 | ||
|
|
b41fe076ae | ||
|
|
a7c422fde6 | ||
|
|
568a394a40 | ||
|
|
2b6a550405 | ||
|
|
7200f0da7e | ||
|
|
d3c3c26618 | ||
|
|
7152393089 | ||
|
|
661e60720d | ||
|
|
bf959da7ff | ||
|
|
75d476f9df | ||
|
|
b077822f4d | ||
|
|
6d3f188675 | ||
|
|
0231f5e8ac | ||
|
|
901b35d4b1 | ||
|
|
eaafd0ff13 | ||
|
|
963d9b8f2a | ||
|
|
5696c9c96a | ||
|
|
862b9e68be | ||
|
|
2f2890cd11 | ||
|
|
482aa840e7 | ||
|
|
4599983c8e | ||
|
|
11172838f2 | ||
|
|
47bc50b8c6 | ||
|
|
7c82766a5c | ||
|
|
5d6cf62405 | ||
|
|
edc08e39ef | ||
|
|
a9846e765d | ||
|
|
aa54309d5c | ||
|
|
443317bedf | ||
|
|
ffd320507f | ||
|
|
60df08c11c | ||
|
|
7d464df107 | ||
|
|
296f89acf9 | ||
|
|
5f31417bae |
27
.builds/alpine.yml
Normal file
27
.builds/alpine.yml
Normal file
@@ -0,0 +1,27 @@
|
||||
image: alpine/latest
|
||||
packages:
|
||||
- build-base
|
||||
- sdl2-dev
|
||||
- freetype-dev
|
||||
- fontconfig-dev
|
||||
- opus-dev
|
||||
sources:
|
||||
- https://git.sr.ht/~a1batross/xash3d-fwgs
|
||||
tasks:
|
||||
- client: |
|
||||
cd xash3d-fwgs
|
||||
./waf configure -8 --enable-tests --enable-engine-tests build install --destdir=bin
|
||||
- server: |
|
||||
cd xash3d-fwgs
|
||||
./waf configure --reconfigure --dedicated build install --destdir=bin
|
||||
- run-tests: |
|
||||
cd xash3d-fwgs/bin
|
||||
export SDL_VIDEODRIVER=wayland
|
||||
./xash3d -runtests
|
||||
./xash -runtests
|
||||
rm -rf valve/gameinfo.txt test_*
|
||||
- package: |
|
||||
cd xash3d-fwgs/bin
|
||||
tar -cjvf xash3d-fwgs-alpine-amd64.tar.bz2 *
|
||||
artifacts:
|
||||
- xash3d-fwgs/bin/xash3d-fwgs-alpine-amd64.tar.bz2
|
||||
30
.builds/debian-arm64.yml
Normal file
30
.builds/debian-arm64.yml
Normal file
@@ -0,0 +1,30 @@
|
||||
image: debian/sid
|
||||
arch: amd64
|
||||
packages:
|
||||
- build-essential
|
||||
- python-is-python3
|
||||
- libsdl2-dev
|
||||
- libfreetype-dev
|
||||
- libfontconfig-dev
|
||||
- libopus-dev
|
||||
sources:
|
||||
- https://git.sr.ht/~a1batross/xash3d-fwgs
|
||||
tasks:
|
||||
- client: |
|
||||
cd xash3d-fwgs
|
||||
./waf configure -8 --enable-tests --enable-engine-tests build install --destdir=bin
|
||||
- server: |
|
||||
cd xash3d-fwgs
|
||||
./waf configure --reconfigure --dedicated build install --destdir=bin
|
||||
- run-tests: |
|
||||
cd xash3d-fwgs/bin
|
||||
export SDL_VIDEODRIVER=wayland
|
||||
./xash3d -runtests
|
||||
./xash -runtests
|
||||
rm -rf valve/gameinfo.txt test_*
|
||||
- package: |
|
||||
cd xash3d-fwgs/bin
|
||||
tar -cjvf xash3d-fwgs-debian-arm64.tar.bz2 *
|
||||
artifacts:
|
||||
- xash3d-fwgs/bin/xash3d-fwgs-debian-arm64.tar.bz2
|
||||
|
||||
29
.builds/debian.yml
Normal file
29
.builds/debian.yml
Normal file
@@ -0,0 +1,29 @@
|
||||
image: debian/sid
|
||||
packages:
|
||||
- build-essential
|
||||
- python-is-python3
|
||||
- libsdl2-dev
|
||||
- libfreetype-dev
|
||||
- libfontconfig-dev
|
||||
- libopus-dev
|
||||
sources:
|
||||
- https://git.sr.ht/~a1batross/xash3d-fwgs
|
||||
tasks:
|
||||
- client: |
|
||||
cd xash3d-fwgs
|
||||
./waf configure -8 --enable-tests --enable-engine-tests build install --destdir=bin
|
||||
- server: |
|
||||
cd xash3d-fwgs
|
||||
./waf configure --reconfigure --dedicated build install --destdir=bin
|
||||
- run-tests: |
|
||||
cd xash3d-fwgs/bin
|
||||
export SDL_VIDEODRIVER=wayland
|
||||
./xash3d -runtests
|
||||
./xash -runtests
|
||||
rm -rf valve/gameinfo.txt test_*
|
||||
- package: |
|
||||
cd xash3d-fwgs/bin
|
||||
tar -cjvf xash3d-fwgs-debian-amd64.tar.bz2 *
|
||||
artifacts:
|
||||
- xash3d-fwgs/bin/xash3d-fwgs-debian-amd64.tar.bz2
|
||||
|
||||
29
.builds/freebsd.yml
Normal file
29
.builds/freebsd.yml
Normal file
@@ -0,0 +1,29 @@
|
||||
image: freebsd/latest
|
||||
packages:
|
||||
- lang/python
|
||||
- devel/pkgconf
|
||||
- devel/sdl20
|
||||
- print/freetype2
|
||||
- x11-fonts/fontconfig
|
||||
- audio/opus
|
||||
sources:
|
||||
- https://git.sr.ht/~a1batross/xash3d-fwgs
|
||||
tasks:
|
||||
- client: |
|
||||
cd xash3d-fwgs
|
||||
./waf configure --enable-tests --enable-engine-tests build install --destdir=bin
|
||||
- server: |
|
||||
cd xash3d-fwgs
|
||||
./waf configure --reconfigure --dedicated build install --destdir=bin
|
||||
- run-tests: |
|
||||
cd xash3d-fwgs/bin
|
||||
export SDL_VIDEODRIVER=wayland
|
||||
./xash3d -runtests
|
||||
./xash -runtests
|
||||
rm -rf valve/gameinfo.txt test_*
|
||||
- package: |
|
||||
cd xash3d-fwgs/bin
|
||||
tar -cjvf xash3d-fwgs-freebsd-amd64.tar.bz2 *
|
||||
artifacts:
|
||||
- xash3d-fwgs/bin/xash3d-fwgs-freebsd-amd64.tar.bz2
|
||||
|
||||
29
.builds/netbsd.yml
Normal file
29
.builds/netbsd.yml
Normal file
@@ -0,0 +1,29 @@
|
||||
image: netbsd/latest
|
||||
packages:
|
||||
- python311
|
||||
- SDL2
|
||||
- freetype2
|
||||
- fontconfig
|
||||
- libopus
|
||||
- pkgconf
|
||||
sources:
|
||||
- https://git.sr.ht/~a1batross/xash3d-fwgs
|
||||
tasks:
|
||||
- client: |
|
||||
cd xash3d-fwgs
|
||||
python3.11 waf configure --enable-tests --enable-engine-tests build install --destdir=bin
|
||||
- server: |
|
||||
cd xash3d-fwgs
|
||||
python3.11 waf configure --reconfigure --dedicated build install --destdir=bin
|
||||
- run-tests: |
|
||||
cd xash3d-fwgs/bin
|
||||
export SDL_VIDEODRIVER=wayland
|
||||
./xash3d -runtests
|
||||
./xash -runtests
|
||||
rm -rf valve/gameinfo.txt test_*
|
||||
- package: |
|
||||
cd xash3d-fwgs/bin
|
||||
tar -cjvf xash3d-fwgs-netbsd-amd64.tar.bz2 *
|
||||
artifacts:
|
||||
- xash3d-fwgs/bin/xash3d-fwgs-netbsd-amd64.tar.bz2
|
||||
|
||||
26
.builds/openbsd.yml
Normal file
26
.builds/openbsd.yml
Normal file
@@ -0,0 +1,26 @@
|
||||
image: openbsd/latest
|
||||
packages:
|
||||
- python3
|
||||
- sdl2
|
||||
- opus
|
||||
sources:
|
||||
- https://git.sr.ht/~a1batross/xash3d-fwgs
|
||||
tasks:
|
||||
- client: |
|
||||
cd xash3d-fwgs
|
||||
python3 waf configure --enable-tests --enable-engine-tests build install --destdir=bin
|
||||
- server: |
|
||||
cd xash3d-fwgs
|
||||
python3 waf configure --reconfigure --dedicated build install --destdir=bin
|
||||
- run-tests: |
|
||||
cd xash3d-fwgs/bin
|
||||
export SDL_VIDEODRIVER=wayland
|
||||
./xash3d -runtests
|
||||
./xash -runtests
|
||||
rm -rf valve/gameinfo.txt test_*
|
||||
- package: |
|
||||
cd xash3d-fwgs/bin
|
||||
tar -cjvf xash3d-fwgs-openbsd-amd64.tar.bz2 *
|
||||
artifacts:
|
||||
- xash3d-fwgs/bin/xash3d-fwgs-openbsd-amd64.tar.bz2
|
||||
|
||||
15
.cirrus.yml
15
.cirrus.yml
@@ -1,16 +1,3 @@
|
||||
task:
|
||||
# Seems packages for it were removed from the mirrors
|
||||
# name: freebsd-12-amd64
|
||||
# freebsd_instance:
|
||||
# image_family: freebsd-12-4
|
||||
# setup_script:
|
||||
# - pkg update
|
||||
# - pkg install -y pkgconf git sdl2 python fontconfig opus
|
||||
# - git submodule update --init --recursive
|
||||
# test_script:
|
||||
# - ./scripts/cirrus/build_freebsd.sh dedicated
|
||||
# - ./scripts/cirrus/build_freebsd.sh full
|
||||
|
||||
task:
|
||||
name: freebsd-13-amd64
|
||||
freebsd_instance:
|
||||
@@ -26,7 +13,7 @@ task:
|
||||
task:
|
||||
name: freebsd-14-amd64
|
||||
freebsd_instance:
|
||||
image_family: freebsd-14-0-snap
|
||||
image_family: freebsd-14-0
|
||||
setup_script:
|
||||
- pkg update
|
||||
- pkg install -y pkgconf git sdl2 python fontconfig opus
|
||||
|
||||
1
.github/FUNDING.yml
vendored
Normal file
1
.github/FUNDING.yml
vendored
Normal file
@@ -0,0 +1 @@
|
||||
custom: https://github.com/FWGS/xash3d-fwgs/blob/master/Documentation/donate.md
|
||||
12
.github/workflows/c-cpp.yml
vendored
12
.github/workflows/c-cpp.yml
vendored
@@ -24,14 +24,9 @@ jobs:
|
||||
# - os: ubuntu-aarch64-20.04
|
||||
# targetos: linux
|
||||
# targetarch: aarch64
|
||||
|
||||
# - os: ubuntu-20.04
|
||||
# targetos: android
|
||||
# targetarch: 32
|
||||
# - os: ubuntu-20.04
|
||||
# targetos: android
|
||||
# targetarch: 64
|
||||
|
||||
- os: ubuntu-20.04
|
||||
targetos: android
|
||||
targetarch: multiarch
|
||||
# - os: ubuntu-20.04
|
||||
# targetos: motomagx
|
||||
# targetarch: armv6
|
||||
@@ -51,7 +46,6 @@ jobs:
|
||||
env:
|
||||
SDL_VERSION: 2.28.5
|
||||
GH_CPU_ARCH: ${{ matrix.targetarch }}
|
||||
ANDROID_SDK_TOOLS_VER: 4333796
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v3
|
||||
|
||||
5
.gitignore
vendored
5
.gitignore
vendored
@@ -54,6 +54,11 @@ CMakeFiles
|
||||
Makefile
|
||||
cmake_install.cmake
|
||||
install_manifest.txt
|
||||
CMakeLists.txt*
|
||||
CMakeScripts
|
||||
Testing
|
||||
compile_commands.json
|
||||
_deps
|
||||
# makedepend
|
||||
Makefile.dep
|
||||
*.bak
|
||||
|
||||
2
3rdparty/gl-wes-v2
vendored
2
3rdparty/gl-wes-v2
vendored
Submodule 3rdparty/gl-wes-v2 updated: 7ba4631bf5...2d9b5afe10
2
3rdparty/gl4es/gl4es
vendored
2
3rdparty/gl4es/gl4es
vendored
Submodule 3rdparty/gl4es/gl4es updated: 5226f5f937...e39434a2b1
2
3rdparty/gl4es/wscript
vendored
2
3rdparty/gl4es/wscript
vendored
@@ -18,7 +18,7 @@ def build(bld):
|
||||
target = 'gl4es',
|
||||
features = 'c',
|
||||
includes = ['gl4es/src', 'gl4es/src/gl', 'gl4es/src/glx', 'gl4es/include'],
|
||||
defines = ['NOX11', 'NO_GBM', 'NO_INIT_CONSTRUCTOR', 'DEFAULT_ES=2', 'NOEGL', 'EXTERNAL_GETPROCADDRESS=GL4ES_GetProcAddress', 'NO_LOADER', 'STATICLIB'],
|
||||
defines = ['NOX11', 'NO_GBM', 'NO_INIT_CONSTRUCTOR', 'DEFAULT_ES=2', 'NOEGL', 'NO_LOADER', 'STATICLIB'],
|
||||
cflags = ['-w', '-fvisibility=hidden', '-std=gnu99'],
|
||||
subsystem = bld.env.MSVC_SUBSYSTEM,
|
||||
export_includes = '.')
|
||||
|
||||
2
3rdparty/mainui
vendored
2
3rdparty/mainui
vendored
Submodule 3rdparty/mainui updated: 7223589d60...f5497ceb04
2
3rdparty/nanogl
vendored
2
3rdparty/nanogl
vendored
Submodule 3rdparty/nanogl updated: 6b6a947ee0...e75792de03
2
3rdparty/vgui_support
vendored
2
3rdparty/vgui_support
vendored
Submodule 3rdparty/vgui_support updated: f85d64c149...a2a7b9073f
@@ -1,17 +1,15 @@
|
||||
# Bug-compatibility in Xash3D FWGS
|
||||
|
||||
Xash3D FWGS has special mode for games that rely on original engine bugs.
|
||||
|
||||
In this mode, we emulate the behaviour of selected functions that may help running mods relying on engine bugs, but enabling them by default may break majority of other games.
|
||||
Xash3D FWGS has special mode for games that rely on original engine bugs. In this mode, we emulate the behaviour of selected functions that may help running mods relying on engine bugs, but enabling them by default may break majority of other games.
|
||||
|
||||
At this time, we only have implemented GoldSrc bug-compatibility. It can be enabled with `-bugcomp` command line switch.
|
||||
|
||||
When `-bugcomp` is specified without argument, it enables everything. This behavior might be changed or removed in future versions.
|
||||
|
||||
When `-bugcomp` is specified with argument, it interpreted as flags separated with `+`. This way it's possible to combine multiple levels of bug-compatibility.
|
||||
|
||||
## GoldSrc bug-compatibility
|
||||
|
||||
### Emulated bugs
|
||||
|
||||
* `pfnPEntityOfEntIndex` in GoldSrc returns NULL for last player due to incorrect player index comparison
|
||||
|
||||
### Games and mods that require this
|
||||
|
||||
* Counter-Strike: Condition Zero - Deleted Scenes
|
||||
| Flag | Description | Games that require this flag |
|
||||
| ------- | ----------- | ---------------------------- |
|
||||
| `peoei` | Reverts `pfnPEntityOfEntIndex` behavior to GoldSrc, where it returns NULL for last player due to incorrect player index comparison | * Counter-Strike: Condition Zero - Deleted Scenes |
|
||||
|
||||
21
Documentation/environment-variables.md
Normal file
21
Documentation/environment-variables.md
Normal file
@@ -0,0 +1,21 @@
|
||||
## Environment variables
|
||||
|
||||
#### Xash3D FWGS
|
||||
|
||||
The engine respects these environment variables:
|
||||
|
||||
| Variable | Type | Description |
|
||||
| --------------------- | ---------- | ----------- |
|
||||
| `XASH3D_GAME` | _string_ | Overrides default game directory. Ignored if `-game` command line argument is set |
|
||||
| `XASH3D_BASEDIR` | _string_ | Sets path to base (root) directory, instead of current working directory |
|
||||
| `XASH3D_RODIR` | _string_ | Sets path to read-only base (root) directory. Ignored if `-rodir` command line argument is set |
|
||||
| `XASH3D_EXTRAS_PAK1` | _string_ | Archive file from specified path will be added to virtual filesystem search path in the lowest possible priority |
|
||||
| `XASH3D_EXTRAS_PAK2` | _string_ | Similar to `XASH3D_EXTRAS_PAK1` but next to it in priority list |
|
||||
|
||||
Environment variables NOT listed in the table above are used internally, and aren't considered as stable interface.
|
||||
|
||||
#### mdldec
|
||||
|
||||
| Variable | Type | Description |
|
||||
| --------------------- | ---------- | ----------- |
|
||||
| `MDLDEC_ACT_PATH` | _string_ | If set, will read activities list from this path |
|
||||
25
Documentation/extensions/native-object.md
Normal file
25
Documentation/extensions/native-object.md
Normal file
@@ -0,0 +1,25 @@
|
||||
# GetNativeObject API
|
||||
|
||||
To be able to use platform-specific features or get optional engine interfaces, we've added a simple call to MobilityAPI on client DLL and PhysicsAPI for server DLL and extended MenuAPI for menu DLL.
|
||||
|
||||
It's defined like this:
|
||||
|
||||
```
|
||||
void *pfnGetNativeObject( const char *name );
|
||||
```
|
||||
|
||||
#### Cross-platform objects
|
||||
|
||||
Only these objects are guaranteed to be available on all targets.
|
||||
|
||||
| Object name | Interface |
|
||||
|-------------|-----------|
|
||||
| `VFileSystem009` | Provides C++ interface to filesystem, binary-compatible with Valve's VFileSystem009. |
|
||||
| `XashFileSystemXXX` | Provides C interface to filesystem. This interface is unstable and not recommended for generic use, outside of engine internals. For more info about current version look into `filesystem.h`. |
|
||||
|
||||
#### Android-specific objects
|
||||
|
||||
| Object name | Interface |
|
||||
|-------------|-----------|
|
||||
| `JNIEnv` | Allows interfacing with Java Native Interface. |
|
||||
| `ActivityClass` | Returns JNI object for engine Android activity class. |
|
||||
65
Documentation/extensions/sounds.lst.md
Normal file
65
Documentation/extensions/sounds.lst.md
Normal file
@@ -0,0 +1,65 @@
|
||||
# sounds.lst.md
|
||||
|
||||
Using sounds.lst located in scripts folder, modder can override some of the hardcoded sounds in temp entities and server physics.
|
||||
|
||||
File format:
|
||||
```
|
||||
<group name>
|
||||
{
|
||||
<path1>
|
||||
<path2>
|
||||
<path3>
|
||||
}
|
||||
|
||||
<group2 name> <path with %d> <min number> <max number>
|
||||
```
|
||||
|
||||
* Sounds can use any supported sound format (WAV or MP3).
|
||||
* The path must be relative to the sounds/ folder in the game or base directory root, addon folder, or archive root.
|
||||
* Groups can be empty or omitted from the file to load no sound.
|
||||
* Groups can either list a set of files or specify a format string and a range.
|
||||
* Anything after // will be considered a comment and ignored.
|
||||
* Behavior is undefined if the group was listed multiple times.
|
||||
|
||||
Currently supported groups are:
|
||||
|Group name|Usage|
|
||||
|----------|-----|
|
||||
|`BouncePlayerShell`|Used for BOUNCE_SHELL tempentity hitsound|
|
||||
|`BounceWeaponShell`|Used for BOUCNE_SHOTSHELL tempentity hitsound|
|
||||
|`BounceConcrete`|Used for BOUNCE_CONCRETE tempentity hitsound|
|
||||
|`BounceGlass`|Used for BOUCNE_GLASS|
|
||||
|`BounceMetal`|Used for BOUNCE_METAL|
|
||||
|`BounceFlesh`|Used for BOUNCE_FLESH|
|
||||
|`BounceWood`|Used for BOUNCE_WOOD|
|
||||
|`Ricochet`|Used for BOUNCE_SHRAP and ricochet tempentities|
|
||||
|`Explode`|Used for tempentity explosions|
|
||||
|`EntityWaterEnter`|Used for entity entering water|
|
||||
|`EntityWaterExit`|Used for entity exiting water|
|
||||
|`PlayerWaterEnter`|Used for player entering water|
|
||||
|`PlayerWaterExit`|Used for player exiting water|
|
||||
|
||||
## Example
|
||||
|
||||
This example is based on defaults sounds used in Half-Life:
|
||||
|
||||
```
|
||||
BouncePlayerShell "player/pl_shell%d.wav" 1 3
|
||||
BounceWeaponShell "weapons/sshell%d.wav" 1 3
|
||||
BounceConcrete "debris/concrete%d.wav" 1 3
|
||||
BounceGlass "debris/glass%d.wav" 1 4
|
||||
BounceMetal "debris/metal%d.wav" 1 6
|
||||
BounceFlesh "debris/flesh%d.wav" 1 7
|
||||
BounceWood "debris/wood%d.wav" 1 4
|
||||
Ricochet "weapons/ric%d.wav" 1 5
|
||||
Explode "weapons/explode%d.wav" 3 5
|
||||
EntityWaterEnter "player/pl_wade%d.wav" 1 4
|
||||
EntityWaterExit "player/pl_wade%d.wav" 1 4
|
||||
PlayerWaterEnter
|
||||
{
|
||||
"player/pl_wade1.wav"
|
||||
}
|
||||
PlayerWaterExit
|
||||
{
|
||||
"player/pl_wade2.wav"
|
||||
}
|
||||
```
|
||||
15
Documentation/musl.md
Normal file
15
Documentation/musl.md
Normal file
@@ -0,0 +1,15 @@
|
||||
# Xash3D FWGS on `musl`
|
||||
|
||||
Xash3D FWGS works on `musl` out of the box. However, the engine doesn't try to differentiate glibc and musl anymore. If you see error similar to:
|
||||
|
||||
```
|
||||
Host_InitError: can't initialize cl_dlls/client.so: Error relocating valve/cl_dlls/client.so: __sprintf_chk: symbol not found
|
||||
```
|
||||
|
||||
... or you know that the game you're running is linked against glibc, you can try using `libgcompat`, like this:
|
||||
|
||||
```
|
||||
$ LD_PRELOAD=/lib/libgcompat.so.0 ./xash3d ...
|
||||
```
|
||||
|
||||
It will automatically add the missing symbols that glibc binaries usually need. In the future we might automatically link engine against `libgcompat` for better compatibility with prebuilt or closed-source games, if there will be any use for this.
|
||||
@@ -1,5 +1,5 @@
|
||||
# Xash3D FWGS Engine <img align="right" width="128" height="128" src="https://github.com/FWGS/xash3d-fwgs/raw/master/game_launch/icon-xash-material.png" alt="Xash3D FWGS icon" />
|
||||
[](https://github.com/FWGS/xash3d-fwgs/actions/workflows/c-cpp.yml) [](https://cirrus-ci.com/github/FWGS/xash3d-fwgs) [](http://fwgsdiscord.mentality.rip/) \
|
||||
[](https://builds.sr.ht/~a1batross/xash3d-fwgs?) [](https://github.com/FWGS/xash3d-fwgs/actions/workflows/c-cpp.yml) [](https://cirrus-ci.com/github/FWGS/xash3d-fwgs) [](http://fwgsdiscord.mentality.rip/) \
|
||||
[](https://github.com/FWGS/xash3d-fwgs/releases/latest) [](https://github.com/FWGS/xash3d-fwgs/releases/tag/continuous)
|
||||
|
||||
Xash3D FWGS is a game engine, aimed to provide compatibility with Half-Life Engine and extend it, as well as to give game developers well known workflow.
|
||||
|
||||
@@ -534,5 +534,14 @@ typedef struct
|
||||
#define MAX_EFRAGS 8192 // Arcane Dimensions required
|
||||
#define MAX_REQUESTS 64
|
||||
|
||||
#if ! XASH_64BIT
|
||||
STATIC_ASSERT( sizeof( mextrasurf_t ) == 324, "mextrasurf_t unexpected size" );
|
||||
STATIC_ASSERT( sizeof( decal_t ) == 60, "decal_t unexpected size");
|
||||
STATIC_ASSERT( sizeof( mfaceinfo_t ) == 176, "mfaceinfo_t unexpected size");
|
||||
#else
|
||||
STATIC_ASSERT( sizeof( mextrasurf_t) == 496, "mextrasurf_t unexpected size");
|
||||
STATIC_ASSERT( sizeof( decal_t ) == 88, "decal_t unexpected size");
|
||||
STATIC_ASSERT( sizeof( mfaceinfo_t ) == 304, "mfaceinfo_t unexpected size");
|
||||
#endif
|
||||
|
||||
#endif//COM_MODEL_H
|
||||
|
||||
@@ -35,7 +35,6 @@ GNU General Public License for more details.
|
||||
#define __cdecl
|
||||
#define __stdcall
|
||||
#define _inline static inline
|
||||
#define FORCEINLINE inline __attribute__((always_inline))
|
||||
|
||||
#if XASH_POSIX
|
||||
#include <unistd.h>
|
||||
@@ -63,13 +62,6 @@ GNU General Public License for more details.
|
||||
int x, y;
|
||||
} POINT;
|
||||
#else // WIN32
|
||||
#ifdef __MINGW32__
|
||||
#define _inline static inline
|
||||
#define FORCEINLINE inline __attribute__((always_inline))
|
||||
#else
|
||||
#define FORCEINLINE __forceinline
|
||||
#endif
|
||||
|
||||
#define open _open
|
||||
#define read _read
|
||||
#define alloca _alloca
|
||||
|
||||
@@ -107,7 +107,8 @@ typedef enum
|
||||
TF_ARB_FLOAT = (1<<26), // float textures
|
||||
TF_NOCOMPARE = (1<<27), // disable comparing for depth textures
|
||||
TF_ARB_16BIT = (1<<28), // keep image as 16-bit (not 24)
|
||||
TF_MULTISAMPLE = (1<<29) // multisampling texture
|
||||
TF_MULTISAMPLE = (1<<29), // multisampling texture
|
||||
TF_ALLOW_NEAREST = (1<<30), // allows toggling nearest filtering for TF_NOMIPMAP textures
|
||||
} texFlags_t;
|
||||
|
||||
typedef enum
|
||||
|
||||
@@ -28,11 +28,7 @@ typedef byte rgb_t[3]; // unsigned byte colorpack
|
||||
typedef vec_t matrix3x4[3][4];
|
||||
typedef vec_t matrix4x4[4][4];
|
||||
|
||||
#if XASH_64BIT
|
||||
typedef uint32_t poolhandle_t;
|
||||
#else
|
||||
typedef void* poolhandle_t;
|
||||
#endif
|
||||
|
||||
#undef true
|
||||
#undef false
|
||||
|
||||
@@ -157,32 +157,12 @@ void CL_PlayCDTrack_f( void )
|
||||
CL_ScreenshotGetName
|
||||
==================
|
||||
*/
|
||||
static qboolean CL_ScreenshotGetName( int lastnum, char *filename, size_t size )
|
||||
static qboolean CL_ScreenshotGetName( const char *fmt, int lastnum, char *filename, size_t size )
|
||||
{
|
||||
if( lastnum < 0 || lastnum > 9999 )
|
||||
{
|
||||
Con_Printf( S_ERROR "unable to write screenshot\n" );
|
||||
return false;
|
||||
}
|
||||
|
||||
return Q_snprintf( filename, size, "scrshots/%s_shot%04d.png", clgame.mapname, lastnum ) > 0;
|
||||
}
|
||||
|
||||
/*
|
||||
==================
|
||||
CL_SnapshotGetName
|
||||
==================
|
||||
*/
|
||||
static qboolean CL_SnapshotGetName( int lastnum, char *filename, size_t size )
|
||||
{
|
||||
if( lastnum < 0 || lastnum > 9999 )
|
||||
{
|
||||
Con_Printf( S_ERROR "unable to write snapshot\n" );
|
||||
FS_AllowDirectPaths( false );
|
||||
return false;
|
||||
}
|
||||
|
||||
return Q_snprintf( filename, size, "../%s_%04d.png", clgame.mapname, lastnum ) > 0;
|
||||
return Q_snprintf( filename, size, fmt, clgame.mapname, lastnum ) > 0;
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -192,127 +172,6 @@ static qboolean CL_SnapshotGetName( int lastnum, char *filename, size_t size )
|
||||
|
||||
==============================================================================
|
||||
*/
|
||||
/*
|
||||
==================
|
||||
CL_ScreenShot_f
|
||||
|
||||
normal screenshot
|
||||
==================
|
||||
*/
|
||||
void CL_ScreenShot_f( void )
|
||||
{
|
||||
int i;
|
||||
string checkname;
|
||||
|
||||
if( CL_IsDevOverviewMode() == 1 )
|
||||
{
|
||||
// special case for write overview image and script file
|
||||
Q_snprintf( cls.shotname, sizeof( cls.shotname ), "overviews/%s.bmp", clgame.mapname );
|
||||
cls.scrshot_action = scrshot_mapshot; // build new frame for mapshot
|
||||
}
|
||||
else
|
||||
{
|
||||
// scan for a free filename
|
||||
for( i = 0; i < 9999; i++ )
|
||||
{
|
||||
if( !CL_ScreenshotGetName( i, checkname, sizeof( checkname )))
|
||||
return; // no namespace
|
||||
|
||||
if( !FS_FileExists( checkname, true ))
|
||||
break;
|
||||
}
|
||||
|
||||
Q_strncpy( cls.shotname, checkname, sizeof( cls.shotname ));
|
||||
cls.scrshot_action = scrshot_normal; // build new frame for screenshot
|
||||
}
|
||||
|
||||
cls.envshot_vieworg = NULL; // no custom view
|
||||
cls.envshot_viewsize = 0;
|
||||
}
|
||||
|
||||
/*
|
||||
==================
|
||||
CL_SnapShot_f
|
||||
|
||||
save screenshots into root dir
|
||||
==================
|
||||
*/
|
||||
void CL_SnapShot_f( void )
|
||||
{
|
||||
int i;
|
||||
string checkname;
|
||||
|
||||
if( CL_IsDevOverviewMode() == 1 )
|
||||
{
|
||||
// special case for write overview image and script file
|
||||
Q_snprintf( cls.shotname, sizeof( cls.shotname ), "overviews/%s.bmp", clgame.mapname );
|
||||
cls.scrshot_action = scrshot_mapshot; // build new frame for mapshot
|
||||
}
|
||||
else
|
||||
{
|
||||
FS_AllowDirectPaths( true );
|
||||
|
||||
// scan for a free filename
|
||||
for( i = 0; i < 9999; i++ )
|
||||
{
|
||||
if( !CL_SnapshotGetName( i, checkname, sizeof( checkname )))
|
||||
return; // no namespace
|
||||
|
||||
if( !FS_FileExists( checkname, true ))
|
||||
break;
|
||||
}
|
||||
|
||||
FS_AllowDirectPaths( false );
|
||||
Q_strncpy( cls.shotname, checkname, sizeof( cls.shotname ));
|
||||
cls.scrshot_action = scrshot_snapshot; // build new frame for screenshot
|
||||
}
|
||||
|
||||
cls.envshot_vieworg = NULL; // no custom view
|
||||
cls.envshot_viewsize = 0;
|
||||
}
|
||||
|
||||
/*
|
||||
==================
|
||||
CL_EnvShot_f
|
||||
|
||||
cubemap view
|
||||
==================
|
||||
*/
|
||||
void CL_EnvShot_f( void )
|
||||
{
|
||||
if( Cmd_Argc() < 2 )
|
||||
{
|
||||
Con_Printf( S_USAGE "envshot <shotname>\n" );
|
||||
return;
|
||||
}
|
||||
|
||||
Q_snprintf( cls.shotname, sizeof( cls.shotname ), "gfx/env/%s", Cmd_Argv( 1 ));
|
||||
cls.scrshot_action = scrshot_envshot; // build new frame for envshot
|
||||
cls.envshot_vieworg = NULL; // no custom view
|
||||
cls.envshot_viewsize = 0;
|
||||
}
|
||||
|
||||
/*
|
||||
==================
|
||||
CL_SkyShot_f
|
||||
|
||||
skybox view
|
||||
==================
|
||||
*/
|
||||
void CL_SkyShot_f( void )
|
||||
{
|
||||
if( Cmd_Argc() < 2 )
|
||||
{
|
||||
Con_Printf( S_USAGE "skyshot <shotname>\n" );
|
||||
return;
|
||||
}
|
||||
|
||||
Q_snprintf( cls.shotname, sizeof( cls.shotname ),"gfx/env/%s", Cmd_Argv( 1 ));
|
||||
cls.scrshot_action = scrshot_skyshot; // build new frame for skyshot
|
||||
cls.envshot_vieworg = NULL; // no custom view
|
||||
cls.envshot_viewsize = 0;
|
||||
}
|
||||
|
||||
/*
|
||||
==================
|
||||
CL_LevelShot_f
|
||||
@@ -355,23 +214,100 @@ void CL_LevelShot_f( void )
|
||||
else cls.scrshot_action = scrshot_inactive; // disable - not needs
|
||||
}
|
||||
|
||||
/*
|
||||
==================
|
||||
CL_SaveShot_f
|
||||
|
||||
mini-pic in loadgame menu
|
||||
==================
|
||||
*/
|
||||
void CL_SaveShot_f( void )
|
||||
static scrshot_t CL_GetScreenshotTypeFromString( const char *string )
|
||||
{
|
||||
if( Cmd_Argc() < 2 )
|
||||
if( !Q_stricmp( string, "snapshot" ))
|
||||
return scrshot_snapshot;
|
||||
|
||||
if( !Q_stricmp( string, "screenshot" ))
|
||||
return scrshot_normal;
|
||||
|
||||
if( !Q_stricmp( string, "saveshot" ))
|
||||
return scrshot_savegame;
|
||||
|
||||
if( !Q_stricmp( string, "envshot" ))
|
||||
return scrshot_envshot;
|
||||
|
||||
if( !Q_stricmp( string, "skyshot" ))
|
||||
return scrshot_skyshot;
|
||||
|
||||
return scrshot_inactive;
|
||||
}
|
||||
|
||||
void CL_GenericShot_f( void )
|
||||
{
|
||||
const char *argv0 = Cmd_Argv( 0 );
|
||||
scrshot_t type;
|
||||
|
||||
type = CL_GetScreenshotTypeFromString( argv0 );
|
||||
|
||||
if( type == scrshot_normal || type == scrshot_snapshot )
|
||||
{
|
||||
Con_Printf( S_USAGE "saveshot <savename>\n" );
|
||||
return;
|
||||
if( CL_IsDevOverviewMode() == 1 )
|
||||
type = scrshot_mapshot;
|
||||
}
|
||||
else
|
||||
{
|
||||
if( Cmd_Argc() < 2 )
|
||||
{
|
||||
Con_Printf( S_USAGE "%s <shotname>\n", argv0 );
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
Q_snprintf( cls.shotname, sizeof( cls.shotname ), DEFAULT_SAVE_DIRECTORY "%s.bmp", Cmd_Argv( 1 ));
|
||||
cls.scrshot_action = scrshot_savegame; // build new frame for saveshot
|
||||
switch( type )
|
||||
{
|
||||
case scrshot_envshot:
|
||||
case scrshot_skyshot:
|
||||
Q_snprintf( cls.shotname, sizeof( cls.shotname ), "gfx/env/%s", Cmd_Argv( 1 ));
|
||||
break;
|
||||
case scrshot_savegame:
|
||||
Q_snprintf( cls.shotname, sizeof( cls.shotname ), DEFAULT_SAVE_DIRECTORY "%s.bmp", Cmd_Argv( 1 ));
|
||||
break;
|
||||
case scrshot_mapshot:
|
||||
Q_snprintf( cls.shotname, sizeof( cls.shotname ), "overviews/%s.bmp", clgame.mapname );
|
||||
break;
|
||||
case scrshot_normal:
|
||||
case scrshot_snapshot:
|
||||
{
|
||||
const char *fmt;
|
||||
string checkname;
|
||||
int i;
|
||||
|
||||
if( type == scrshot_snapshot )
|
||||
{
|
||||
fmt = "../%s_%04d.png";
|
||||
FS_AllowDirectPaths( true );
|
||||
}
|
||||
else fmt = "scrshots/%s_shot%04d.png";
|
||||
|
||||
for( i = 0; i < 9999; i++ )
|
||||
{
|
||||
if( !CL_ScreenshotGetName( fmt, i, checkname, sizeof( checkname )))
|
||||
{
|
||||
Con_Printf( S_ERROR "unable to write %s\n", argv0 );
|
||||
FS_AllowDirectPaths( false );
|
||||
return;
|
||||
}
|
||||
|
||||
if( !FS_FileExists( checkname, true ))
|
||||
break;
|
||||
}
|
||||
|
||||
FS_AllowDirectPaths( false );
|
||||
|
||||
Q_strncpy( cls.shotname, checkname, sizeof( cls.shotname ));
|
||||
break;
|
||||
}
|
||||
case scrshot_inactive:
|
||||
case scrshot_plaque:
|
||||
default:
|
||||
return; // shouldn't happen
|
||||
}
|
||||
|
||||
cls.scrshot_action = type; // build new frame for saveshot
|
||||
cls.envshot_vieworg = NULL;
|
||||
cls.envshot_viewsize = 0;
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
@@ -127,7 +127,7 @@ void CL_MoveToOnHandList( resource_t *pResource )
|
||||
CL_AddToResourceList( pResource, &cl.resourcesonhand );
|
||||
}
|
||||
|
||||
void CL_ClearResourceList( resource_t *pList )
|
||||
static void CL_ClearResourceList( resource_t *pList )
|
||||
{
|
||||
resource_t *p, *n;
|
||||
|
||||
|
||||
@@ -107,6 +107,8 @@ struct
|
||||
int angle_position;
|
||||
} demo;
|
||||
|
||||
static qboolean CL_NextDemo( void );
|
||||
|
||||
/*
|
||||
====================
|
||||
CL_StartupDemoHeader
|
||||
@@ -156,7 +158,7 @@ CL_GetDemoRecordClock
|
||||
write time while demo is recording
|
||||
====================
|
||||
*/
|
||||
float CL_GetDemoRecordClock( void )
|
||||
static float CL_GetDemoRecordClock( void )
|
||||
{
|
||||
return cl.mtime[0];
|
||||
}
|
||||
@@ -168,7 +170,7 @@ CL_GetDemoPlaybackClock
|
||||
overwrite host.realtime
|
||||
====================
|
||||
*/
|
||||
float CL_GetDemoPlaybackClock( void )
|
||||
static float CL_GetDemoPlaybackClock( void )
|
||||
{
|
||||
return host.realtime + host.frametime;
|
||||
}
|
||||
@@ -194,7 +196,7 @@ CL_WriteDemoCmdHeader
|
||||
Writes the demo command header and time-delta
|
||||
====================
|
||||
*/
|
||||
void CL_WriteDemoCmdHeader( byte cmd, file_t *file )
|
||||
static void CL_WriteDemoCmdHeader( byte cmd, file_t *file )
|
||||
{
|
||||
float dt;
|
||||
|
||||
@@ -267,7 +269,7 @@ Save state of cls.netchan sequences
|
||||
so that we can play the demo correctly.
|
||||
====================
|
||||
*/
|
||||
void CL_WriteDemoSequence( file_t *file )
|
||||
static void CL_WriteDemoSequence( file_t *file )
|
||||
{
|
||||
Assert( file != NULL );
|
||||
|
||||
@@ -348,7 +350,7 @@ CL_WriteDemoHeader
|
||||
Write demo header
|
||||
====================
|
||||
*/
|
||||
void CL_WriteDemoHeader( const char *name )
|
||||
static void CL_WriteDemoHeader( const char *name )
|
||||
{
|
||||
int copysize;
|
||||
int savepos;
|
||||
@@ -436,7 +438,7 @@ CL_StopRecord
|
||||
finish recording demo
|
||||
=================
|
||||
*/
|
||||
void CL_StopRecord( void )
|
||||
static void CL_StopRecord( void )
|
||||
{
|
||||
int i, curpos;
|
||||
float stoptime;
|
||||
@@ -518,7 +520,7 @@ CL_ReadDemoCmdHeader
|
||||
read the demo command
|
||||
=================
|
||||
*/
|
||||
qboolean CL_ReadDemoCmdHeader( byte *cmd, float *dt )
|
||||
static qboolean CL_ReadDemoCmdHeader( byte *cmd, float *dt )
|
||||
{
|
||||
// read the command
|
||||
// HACKHACK: skip NOPs
|
||||
@@ -548,7 +550,7 @@ read the demo usercmd for predicting
|
||||
and smooth movement during playback the demo
|
||||
=================
|
||||
*/
|
||||
void CL_ReadDemoUserCmd( qboolean discard )
|
||||
static void CL_ReadDemoUserCmd( qboolean discard )
|
||||
{
|
||||
byte data[1024];
|
||||
int cmdnumber;
|
||||
@@ -613,7 +615,7 @@ CL_ReadDemoSequence
|
||||
read netchan sequences
|
||||
=================
|
||||
*/
|
||||
void CL_ReadDemoSequence( qboolean discard )
|
||||
static void CL_ReadDemoSequence( qboolean discard )
|
||||
{
|
||||
int incoming_sequence;
|
||||
int incoming_acknowledged;
|
||||
@@ -647,7 +649,7 @@ void CL_ReadDemoSequence( qboolean discard )
|
||||
CL_DemoStartPlayback
|
||||
=================
|
||||
*/
|
||||
void CL_DemoStartPlayback( int mode )
|
||||
static void CL_DemoStartPlayback( int mode )
|
||||
{
|
||||
if( cls.changedemo )
|
||||
{
|
||||
@@ -692,7 +694,7 @@ void CL_DemoStartPlayback( int mode )
|
||||
CL_DemoAborted
|
||||
=================
|
||||
*/
|
||||
void CL_DemoAborted( void )
|
||||
static void CL_DemoAborted( void )
|
||||
{
|
||||
if( cls.demofile )
|
||||
FS_Close( cls.demofile );
|
||||
@@ -732,7 +734,7 @@ returns true on success, false on failure
|
||||
g-cont. probably captain obvious mode is ON
|
||||
=================
|
||||
*/
|
||||
qboolean CL_DemoMoveToNextSection( void )
|
||||
static qboolean CL_DemoMoveToNextSection( void )
|
||||
{
|
||||
if( ++demo.entryIndex >= demo.directory.numentries )
|
||||
{
|
||||
@@ -754,7 +756,7 @@ qboolean CL_DemoMoveToNextSection( void )
|
||||
return true;
|
||||
}
|
||||
|
||||
qboolean CL_ReadRawNetworkData( byte *buffer, size_t *length )
|
||||
static qboolean CL_ReadRawNetworkData( byte *buffer, size_t *length )
|
||||
{
|
||||
int msglen = 0;
|
||||
|
||||
@@ -805,7 +807,7 @@ CL_DemoReadMessageQuake
|
||||
reads demo data and write it to client
|
||||
=================
|
||||
*/
|
||||
qboolean CL_DemoReadMessageQuake( byte *buffer, size_t *length )
|
||||
static qboolean CL_DemoReadMessageQuake( byte *buffer, size_t *length )
|
||||
{
|
||||
vec3_t viewangles;
|
||||
int msglen = 0;
|
||||
@@ -1020,7 +1022,7 @@ qboolean CL_DemoReadMessage( byte *buffer, size_t *length )
|
||||
return CL_ReadRawNetworkData( buffer, length );
|
||||
}
|
||||
|
||||
void CL_DemoFindInterpolatedViewAngles( float t, float *frac, demoangle_t **prev, demoangle_t **next )
|
||||
static void CL_DemoFindInterpolatedViewAngles( float t, float *frac, demoangle_t **prev, demoangle_t **next )
|
||||
{
|
||||
int i, i0, i1, imod;
|
||||
float at;
|
||||
@@ -1115,7 +1117,7 @@ CL_FinishTimeDemo
|
||||
show stats
|
||||
==============
|
||||
*/
|
||||
void CL_FinishTimeDemo( void )
|
||||
static void CL_FinishTimeDemo( void )
|
||||
{
|
||||
int frames;
|
||||
double time;
|
||||
@@ -1264,7 +1266,7 @@ CL_NextDemo
|
||||
Called when a demo finishes
|
||||
==================
|
||||
*/
|
||||
qboolean CL_NextDemo( void )
|
||||
static qboolean CL_NextDemo( void )
|
||||
{
|
||||
char str[MAX_QPATH];
|
||||
|
||||
|
||||
@@ -218,7 +218,7 @@ R_AllocTracer
|
||||
can return NULL if particles is out
|
||||
================
|
||||
*/
|
||||
particle_t *R_AllocTracer( const vec3_t org, const vec3_t vel, float life )
|
||||
static particle_t *R_AllocTracer( const vec3_t org, const vec3_t vel, float life )
|
||||
{
|
||||
particle_t *p;
|
||||
|
||||
@@ -300,7 +300,7 @@ R_BeamAlloc
|
||||
|
||||
==============
|
||||
*/
|
||||
BEAM *R_BeamAlloc( void )
|
||||
static BEAM *R_BeamAlloc( void )
|
||||
{
|
||||
BEAM *pBeam;
|
||||
|
||||
@@ -323,7 +323,7 @@ R_BeamFree
|
||||
|
||||
==============
|
||||
*/
|
||||
void R_BeamFree( BEAM *pBeam )
|
||||
static void R_BeamFree( BEAM *pBeam )
|
||||
{
|
||||
// free particles that have died off.
|
||||
R_FreeDeadParticles( &pBeam->particles );
|
||||
@@ -605,7 +605,7 @@ CL_BeamAttemptToDie
|
||||
Check for expired beams
|
||||
==============
|
||||
*/
|
||||
qboolean CL_BeamAttemptToDie( BEAM *pBeam )
|
||||
static qboolean CL_BeamAttemptToDie( BEAM *pBeam )
|
||||
{
|
||||
Assert( pBeam != NULL );
|
||||
|
||||
@@ -2040,7 +2040,7 @@ void CL_ReadPointFile_f( void )
|
||||
else Con_Printf( "map %s has no leaks!\n", clgame.mapname );
|
||||
}
|
||||
|
||||
void CL_FreeDeadBeams( void )
|
||||
static void CL_FreeDeadBeams( void )
|
||||
{
|
||||
BEAM *pBeam, *pNext, *pPrev = NULL;
|
||||
// draw temporary entity beams
|
||||
|
||||
@@ -40,7 +40,7 @@ CL_CalcPlayerVelocity
|
||||
compute velocity for a given client
|
||||
=============
|
||||
*/
|
||||
void CL_CalcPlayerVelocity( int idx, vec3_t velocity )
|
||||
static void CL_CalcPlayerVelocity( int idx, vec3_t velocity )
|
||||
{
|
||||
clientdata_t *pcd;
|
||||
vec3_t delta;
|
||||
@@ -78,7 +78,7 @@ CL_DescribeEvent
|
||||
|
||||
=============
|
||||
*/
|
||||
void CL_DescribeEvent( event_info_t *ei, int slot )
|
||||
static void CL_DescribeEvent( event_info_t *ei, int slot )
|
||||
{
|
||||
int idx = (slot & 63) * 2;
|
||||
con_nprint_t info;
|
||||
@@ -202,7 +202,7 @@ CL_FireEvent
|
||||
|
||||
=============
|
||||
*/
|
||||
qboolean CL_FireEvent( event_info_t *ei, int slot )
|
||||
static qboolean CL_FireEvent( event_info_t *ei, int slot )
|
||||
{
|
||||
cl_user_event_t *ev;
|
||||
const char *name;
|
||||
@@ -292,7 +292,7 @@ CL_FindEvent
|
||||
find first empty event
|
||||
=============
|
||||
*/
|
||||
event_info_t *CL_FindEmptyEvent( void )
|
||||
static event_info_t *CL_FindEmptyEvent( void )
|
||||
{
|
||||
int i;
|
||||
event_state_t *es;
|
||||
@@ -320,7 +320,7 @@ CL_FindEvent
|
||||
replace only unreliable events
|
||||
=============
|
||||
*/
|
||||
event_info_t *CL_FindUnreliableEvent( void )
|
||||
static event_info_t *CL_FindUnreliableEvent( void )
|
||||
{
|
||||
event_state_t *es;
|
||||
event_info_t *ei;
|
||||
@@ -350,7 +350,7 @@ CL_QueueEvent
|
||||
|
||||
=============
|
||||
*/
|
||||
void CL_QueueEvent( int flags, int index, float delay, event_args_t *args )
|
||||
static void CL_QueueEvent( int flags, int index, float delay, event_args_t *args )
|
||||
{
|
||||
event_info_t *ei;
|
||||
|
||||
|
||||
@@ -46,10 +46,35 @@ static int CL_LoadFontTexture( const char *fontname, uint texFlags, int *width )
|
||||
return tex;
|
||||
}
|
||||
|
||||
qboolean Con_LoadFixedWidthFont( const char *fontname, cl_font_t *font, float scale, int rendermode, uint texFlags )
|
||||
static int CL_FontRenderMode( convar_t *fontrender )
|
||||
{
|
||||
switch((int)fontrender->value )
|
||||
{
|
||||
case 0:
|
||||
return kRenderTransAdd;
|
||||
case 1:
|
||||
return kRenderTransAlpha;
|
||||
case 2:
|
||||
return kRenderTransTexture;
|
||||
default:
|
||||
Cvar_DirectSet( fontrender, fontrender->def_string );
|
||||
}
|
||||
|
||||
return kRenderTransTexture;
|
||||
}
|
||||
|
||||
void CL_SetFontRendermode( cl_font_t *font )
|
||||
{
|
||||
ref.dllFuncs.GL_SetRenderMode( CL_FontRenderMode( font->rendermode ));
|
||||
}
|
||||
|
||||
qboolean Con_LoadFixedWidthFont( const char *fontname, cl_font_t *font, float scale, convar_t *rendermode, uint texFlags )
|
||||
{
|
||||
int font_width, i;
|
||||
|
||||
if( !rendermode )
|
||||
return false;
|
||||
|
||||
if( font->valid )
|
||||
return true; // already loaded
|
||||
|
||||
@@ -60,7 +85,6 @@ qboolean Con_LoadFixedWidthFont( const char *fontname, cl_font_t *font, float sc
|
||||
font->type = FONT_FIXED;
|
||||
font->valid = true;
|
||||
font->scale = scale;
|
||||
font->nearest = FBitSet( texFlags, TF_NEAREST );
|
||||
font->rendermode = rendermode;
|
||||
font->charHeight = Q_rint( font_width / 16 * scale );
|
||||
|
||||
@@ -77,13 +101,16 @@ qboolean Con_LoadFixedWidthFont( const char *fontname, cl_font_t *font, float sc
|
||||
return true;
|
||||
}
|
||||
|
||||
qboolean Con_LoadVariableWidthFont( const char *fontname, cl_font_t *font, float scale, int rendermode, uint texFlags )
|
||||
qboolean Con_LoadVariableWidthFont( const char *fontname, cl_font_t *font, float scale, convar_t *rendermode, uint texFlags )
|
||||
{
|
||||
fs_offset_t length;
|
||||
qfont_t src;
|
||||
byte *pfile;
|
||||
int font_width, i;
|
||||
|
||||
if( !rendermode )
|
||||
return false;
|
||||
|
||||
if( font->valid )
|
||||
return true;
|
||||
|
||||
@@ -106,8 +133,7 @@ qboolean Con_LoadVariableWidthFont( const char *fontname, cl_font_t *font, float
|
||||
|
||||
font->type = FONT_VARIABLE;
|
||||
font->valid = true;
|
||||
font->scale = scale;
|
||||
font->nearest = FBitSet( texFlags, TF_NEAREST );
|
||||
font->scale = scale ? scale : 1.0f;
|
||||
font->rendermode = rendermode;
|
||||
font->charHeight = Q_rint( src.rowheight * scale );
|
||||
|
||||
@@ -179,7 +205,8 @@ int CL_DrawCharacter( float x, float y, int number, rgba_t color, cl_font_t *fon
|
||||
return font->charWidths[number];
|
||||
|
||||
rc = &font->fontRc[number];
|
||||
if( font->nearest || font->scale <= 1.0f )
|
||||
|
||||
if( font->scale <= 1.f || !REF_GET_PARM( PARM_TEX_FILTERING, font->hFontTexture ))
|
||||
half = 0;
|
||||
|
||||
s1 = ((float)rc->left + half ) / texw;
|
||||
@@ -193,7 +220,7 @@ int CL_DrawCharacter( float x, float y, int number, rgba_t color, cl_font_t *fon
|
||||
SPR_AdjustSize( &x, &y, &w, &h );
|
||||
|
||||
if( !FBitSet( flags, FONT_DRAW_NORENDERMODE ))
|
||||
ref.dllFuncs.GL_SetRenderMode( font->rendermode );
|
||||
CL_SetFontRendermode( font );
|
||||
|
||||
// don't apply color to fixed fonts it's already colored
|
||||
if( font->type != FONT_FIXED || REF_GET_PARM( PARM_TEX_GLFORMAT, font->hFontTexture ) == 0x8045 ) // GL_LUMINANCE8_ALPHA8
|
||||
@@ -216,7 +243,7 @@ int CL_DrawString( float x, float y, const char *s, rgba_t color, cl_font_t *fon
|
||||
Con_UtfProcessChar( 0 ); // clear utf state
|
||||
|
||||
if( !FBitSet( flags, FONT_DRAW_NORENDERMODE ))
|
||||
ref.dllFuncs.GL_SetRenderMode( font->rendermode );
|
||||
CL_SetFontRendermode( font );
|
||||
|
||||
Vector4Copy( color, current_color );
|
||||
|
||||
|
||||
@@ -52,7 +52,7 @@ CL_UpdatePositions
|
||||
Store another position into interpolation circular buffer
|
||||
==================
|
||||
*/
|
||||
void CL_UpdatePositions( cl_entity_t *ent )
|
||||
static void CL_UpdatePositions( cl_entity_t *ent )
|
||||
{
|
||||
position_history_t *ph, *prev;
|
||||
|
||||
@@ -85,7 +85,7 @@ CL_ResetPositions
|
||||
Interpolation init or reset after teleporting
|
||||
==================
|
||||
*/
|
||||
void CL_ResetPositions( cl_entity_t *ent )
|
||||
static void CL_ResetPositions( cl_entity_t *ent )
|
||||
{
|
||||
position_history_t store;
|
||||
|
||||
@@ -107,7 +107,7 @@ check for instant movement in case
|
||||
we don't want interpolate this
|
||||
==================
|
||||
*/
|
||||
qboolean CL_EntityTeleported( cl_entity_t *ent )
|
||||
static qboolean CL_EntityTeleported( cl_entity_t *ent )
|
||||
{
|
||||
float len, maxlen;
|
||||
vec3_t delta;
|
||||
@@ -128,7 +128,7 @@ CL_CompareTimestamps
|
||||
round-off floating errors
|
||||
==================
|
||||
*/
|
||||
qboolean CL_CompareTimestamps( float t1, float t2 )
|
||||
static qboolean CL_CompareTimestamps( float t1, float t2 )
|
||||
{
|
||||
int iTime1 = t1 * 1000;
|
||||
int iTime2 = t2 * 1000;
|
||||
@@ -143,7 +143,7 @@ CL_EntityIgnoreLerp
|
||||
some ents will be ignore lerping
|
||||
==================
|
||||
*/
|
||||
qboolean CL_EntityIgnoreLerp( cl_entity_t *e )
|
||||
static qboolean CL_EntityIgnoreLerp( cl_entity_t *e )
|
||||
{
|
||||
if( cl_nointerp.value > 0.f )
|
||||
return true;
|
||||
@@ -160,7 +160,7 @@ CL_EntityCustomLerp
|
||||
|
||||
==================
|
||||
*/
|
||||
qboolean CL_EntityCustomLerp( cl_entity_t *e )
|
||||
static qboolean CL_EntityCustomLerp( cl_entity_t *e )
|
||||
{
|
||||
switch( e->curstate.movetype )
|
||||
{
|
||||
@@ -226,7 +226,7 @@ CL_UpdateLatchedVars
|
||||
|
||||
====================
|
||||
*/
|
||||
void CL_UpdateLatchedVars( cl_entity_t *ent )
|
||||
static void CL_UpdateLatchedVars( cl_entity_t *ent )
|
||||
{
|
||||
if( !ent->model || ( ent->model->type != mod_alias && ent->model->type != mod_studio ))
|
||||
return; // below fields used only for alias and studio interpolation
|
||||
@@ -321,7 +321,7 @@ CL_ProcessEntityUpdate
|
||||
apply changes since new frame received
|
||||
==================
|
||||
*/
|
||||
void CL_ProcessEntityUpdate( cl_entity_t *ent )
|
||||
static void CL_ProcessEntityUpdate( cl_entity_t *ent )
|
||||
{
|
||||
qboolean parametric;
|
||||
|
||||
@@ -585,7 +585,7 @@ CL_ProcessPlayerState
|
||||
process player states after the new packet has received
|
||||
=================
|
||||
*/
|
||||
void CL_ProcessPlayerState( int playerindex, entity_state_t *state )
|
||||
static void CL_ProcessPlayerState( int playerindex, entity_state_t *state )
|
||||
{
|
||||
entity_state_t *ps;
|
||||
|
||||
@@ -605,7 +605,7 @@ reset latched state if this frame entity was teleported
|
||||
or just EF_NOINTERP was set
|
||||
=================
|
||||
*/
|
||||
void CL_ResetLatchedState( int pnum, frame_t *frame, cl_entity_t *ent )
|
||||
static void CL_ResetLatchedState( int pnum, frame_t *frame, cl_entity_t *ent )
|
||||
{
|
||||
if( CHECKVISBIT( frame->flags, pnum ))
|
||||
{
|
||||
@@ -695,7 +695,7 @@ CL_FlushEntityPacket
|
||||
Read and ignore whole entity packet.
|
||||
=================
|
||||
*/
|
||||
void CL_FlushEntityPacket( sizebuf_t *msg )
|
||||
static void CL_FlushEntityPacket( sizebuf_t *msg )
|
||||
{
|
||||
int newnum;
|
||||
entity_state_t from, to;
|
||||
@@ -725,7 +725,7 @@ CL_DeltaEntity
|
||||
processing delta update
|
||||
=================
|
||||
*/
|
||||
void CL_DeltaEntity( sizebuf_t *msg, frame_t *frame, int newnum, entity_state_t *old, qboolean has_update )
|
||||
static void CL_DeltaEntity( sizebuf_t *msg, frame_t *frame, int newnum, entity_state_t *old, qboolean has_update )
|
||||
{
|
||||
cl_entity_t *ent;
|
||||
entity_state_t *state;
|
||||
@@ -1057,7 +1057,7 @@ CL_LinkCustomEntity
|
||||
Add server beam to draw list
|
||||
=============
|
||||
*/
|
||||
void CL_LinkCustomEntity( cl_entity_t *ent, entity_state_t *state )
|
||||
static void CL_LinkCustomEntity( cl_entity_t *ent, entity_state_t *state )
|
||||
{
|
||||
ent->curstate.movetype = state->modelindex; // !!!
|
||||
|
||||
@@ -1080,7 +1080,7 @@ Create visible entities in the correct position
|
||||
for all current players
|
||||
=============
|
||||
*/
|
||||
void CL_LinkPlayers( frame_t *frame )
|
||||
static void CL_LinkPlayers( frame_t *frame )
|
||||
{
|
||||
entity_state_t *state;
|
||||
cl_entity_t *ent;
|
||||
@@ -1163,7 +1163,7 @@ CL_LinkPacketEntities
|
||||
|
||||
===============
|
||||
*/
|
||||
void CL_LinkPacketEntities( frame_t *frame )
|
||||
static void CL_LinkPacketEntities( frame_t *frame )
|
||||
{
|
||||
cl_entity_t *ent;
|
||||
entity_state_t *state;
|
||||
@@ -1492,9 +1492,3 @@ qboolean CL_GetMovieSpatialization( rawchan_t *ch )
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void CL_ExtraUpdate( void )
|
||||
{
|
||||
clgame.dllFuncs.IN_Accumulate();
|
||||
S_ExtraUpdate();
|
||||
}
|
||||
|
||||
@@ -357,20 +357,23 @@ void SPR_AdjustSize( float *x, float *y, float *w, float *h )
|
||||
*h *= yscale;
|
||||
}
|
||||
|
||||
void SPR_AdjustTexCoords( float width, float height, float *s1, float *t1, float *s2, float *t2 )
|
||||
static void SPR_AdjustTexCoords( int texnum, float width, float height, float *s1, float *t1, float *s2, float *t2 )
|
||||
{
|
||||
if( refState.width != clgame.scrInfo.iWidth )
|
||||
if( REF_GET_PARM( PARM_TEX_FILTERING, texnum ))
|
||||
{
|
||||
// align to texel if scaling
|
||||
*s1 += 0.5f;
|
||||
*s2 -= 0.5f;
|
||||
}
|
||||
if( refState.width != clgame.scrInfo.iWidth )
|
||||
{
|
||||
// align to texel if scaling
|
||||
*s1 += 0.5f;
|
||||
*s2 -= 0.5f;
|
||||
}
|
||||
|
||||
if( refState.height != clgame.scrInfo.iHeight )
|
||||
{
|
||||
// align to texel if scaling
|
||||
*t1 += 0.5f;
|
||||
*t2 -= 0.5f;
|
||||
if( refState.height != clgame.scrInfo.iHeight )
|
||||
{
|
||||
// align to texel if scaling
|
||||
*t1 += 0.5f;
|
||||
*t2 -= 0.5f;
|
||||
}
|
||||
}
|
||||
|
||||
*s1 /= width;
|
||||
@@ -402,6 +405,8 @@ static void SPR_DrawGeneric( int frame, float x, float y, float width, float hei
|
||||
height = h;
|
||||
}
|
||||
|
||||
texnum = ref.dllFuncs.R_GetSpriteTexture( clgame.ds.pSprite, frame );
|
||||
|
||||
if( prc )
|
||||
{
|
||||
wrect_t rc = *prc;
|
||||
@@ -418,7 +423,7 @@ static void SPR_DrawGeneric( int frame, float x, float y, float width, float hei
|
||||
t2 = rc.bottom;
|
||||
|
||||
// calc user-defined rectangle
|
||||
SPR_AdjustTexCoords( width, height, &s1, &t1, &s2, &t2 );
|
||||
SPR_AdjustTexCoords( texnum, width, height, &s1, &t1, &s2, &t2 );
|
||||
width = rc.right - rc.left;
|
||||
height = rc.bottom - rc.top;
|
||||
}
|
||||
@@ -434,7 +439,6 @@ static void SPR_DrawGeneric( int frame, float x, float y, float width, float hei
|
||||
|
||||
// scale for screen sizes
|
||||
SPR_AdjustSize( &x, &y, &width, &height );
|
||||
texnum = ref.dllFuncs.R_GetSpriteTexture( clgame.ds.pSprite, frame );
|
||||
ref.dllFuncs.Color4ub( clgame.ds.spriteColor[0], clgame.ds.spriteColor[1], clgame.ds.spriteColor[2], clgame.ds.spriteColor[3] );
|
||||
ref.dllFuncs.R_DrawStretchPic( x, y, width, height, s1, t1, s2, t2, texnum );
|
||||
}
|
||||
@@ -470,8 +474,7 @@ void CL_DrawCenterPrint( void )
|
||||
pText = clgame.centerPrint.message;
|
||||
|
||||
CL_DrawCharacterLen( font, 0, NULL, &charHeight );
|
||||
|
||||
ref.dllFuncs.GL_SetRenderMode( font->rendermode );
|
||||
CL_SetFontRendermode( font );
|
||||
for( i = 0; i < clgame.centerPrint.lines; i++ )
|
||||
{
|
||||
lineLength = 0;
|
||||
@@ -547,7 +550,7 @@ fill screen with specfied color
|
||||
can be modulated
|
||||
=============
|
||||
*/
|
||||
void CL_DrawScreenFade( void )
|
||||
static void CL_DrawScreenFade( void )
|
||||
{
|
||||
screenfade_t *sf = &clgame.fade;
|
||||
int alpha;
|
||||
@@ -763,7 +766,7 @@ CL_SoundFromIndex
|
||||
return soundname from index
|
||||
====================
|
||||
*/
|
||||
const char *CL_SoundFromIndex( int index )
|
||||
static const char *CL_SoundFromIndex( int index )
|
||||
{
|
||||
sfx_t *sfx = NULL;
|
||||
int hSound;
|
||||
@@ -909,7 +912,7 @@ CL_DrawCrosshair
|
||||
Render crosshair
|
||||
====================
|
||||
*/
|
||||
void CL_DrawCrosshair( void )
|
||||
static void CL_DrawCrosshair( void )
|
||||
{
|
||||
int x, y, width, height;
|
||||
float xscale, yscale;
|
||||
@@ -1326,6 +1329,7 @@ pfnSPR_Load
|
||||
function exported for support GoldSrc Monitor utility
|
||||
=========
|
||||
*/
|
||||
HSPRITE EXPORT pfnSPR_Load( const char *szPicName );
|
||||
HSPRITE EXPORT pfnSPR_Load( const char *szPicName )
|
||||
{
|
||||
model_t *spr;
|
||||
@@ -1375,6 +1379,7 @@ pfnSPR_Frames
|
||||
function exported for support GoldSrc Monitor utility
|
||||
=========
|
||||
*/
|
||||
int EXPORT pfnSPR_Frames( HSPRITE hPic );
|
||||
int EXPORT pfnSPR_Frames( HSPRITE hPic )
|
||||
{
|
||||
int numFrames = 0;
|
||||
@@ -1443,7 +1448,7 @@ pfnSPR_Draw
|
||||
*/
|
||||
static void GAME_EXPORT pfnSPR_Draw( int frame, int x, int y, const wrect_t *prc )
|
||||
{
|
||||
ref.dllFuncs.GL_SetRenderMode( kRenderNormal );
|
||||
ref.dllFuncs.GL_SetRenderMode( kRenderTransAlpha );
|
||||
SPR_DrawGeneric( frame, x, y, -1, -1, prc );
|
||||
}
|
||||
|
||||
@@ -1593,7 +1598,7 @@ CL_FillRGBA
|
||||
|
||||
=============
|
||||
*/
|
||||
void GAME_EXPORT CL_FillRGBA( int x, int y, int w, int h, int r, int g, int b, int a )
|
||||
static void GAME_EXPORT CL_FillRGBA( int x, int y, int w, int h, int r, int g, int b, int a )
|
||||
{
|
||||
float _x = x, _y = y, _w = w, _h = h;
|
||||
|
||||
@@ -1635,6 +1640,7 @@ get actual screen info
|
||||
*/
|
||||
int GAME_EXPORT CL_GetScreenInfo( SCREENINFO *pscrinfo )
|
||||
{
|
||||
qboolean apply_scale_factor = false;
|
||||
float scale_factor = hud_scale.value;
|
||||
|
||||
if( FBitSet( hud_fontscale.flags, FCVAR_CHANGED ))
|
||||
@@ -1649,17 +1655,24 @@ int GAME_EXPORT CL_GetScreenInfo( SCREENINFO *pscrinfo )
|
||||
clgame.scrInfo.iSize = sizeof( clgame.scrInfo );
|
||||
clgame.scrInfo.iFlags = SCRINFO_SCREENFLASH;
|
||||
|
||||
if( scale_factor && scale_factor != 1.0f)
|
||||
if( scale_factor && scale_factor != 1.0f )
|
||||
{
|
||||
float scaled_width = (float)refState.width / scale_factor;
|
||||
if( scaled_width >= hud_scale_minimal_width.value )
|
||||
apply_scale_factor = true;
|
||||
}
|
||||
|
||||
if( apply_scale_factor )
|
||||
{
|
||||
clgame.scrInfo.iWidth = (float)refState.width / scale_factor;
|
||||
clgame.scrInfo.iHeight = (float)refState.height / scale_factor;
|
||||
clgame.scrInfo.iFlags |= SCRINFO_STRETCHED;
|
||||
SetBits( clgame.scrInfo.iFlags, SCRINFO_STRETCHED );
|
||||
}
|
||||
else
|
||||
{
|
||||
clgame.scrInfo.iWidth = refState.width;
|
||||
clgame.scrInfo.iHeight = refState.height;
|
||||
clgame.scrInfo.iFlags &= ~SCRINFO_STRETCHED;
|
||||
ClearBits( clgame.scrInfo.iFlags, SCRINFO_STRETCHED );
|
||||
}
|
||||
|
||||
if( !pscrinfo ) return 0;
|
||||
@@ -1700,7 +1713,8 @@ pfnCvar_RegisterVariable
|
||||
static cvar_t *GAME_EXPORT pfnCvar_RegisterClientVariable( const char *szName, const char *szValue, int flags )
|
||||
{
|
||||
// a1ba: try to mitigate outdated client.dll vulnerabilities
|
||||
if( !Q_stricmp( szName, "motdfile" ))
|
||||
if( !Q_stricmp( szName, "motdfile" )
|
||||
|| !Q_stricmp( szName, "sensitivity" ))
|
||||
flags |= FCVAR_PRIVILEGED;
|
||||
|
||||
return (cvar_t *)Cvar_Get( szName, szValue, flags|FCVAR_CLIENTDLL, Cvar_BuildAutoDescription( szName, flags|FCVAR_CLIENTDLL ));
|
||||
@@ -2121,7 +2135,7 @@ pfnGetViewModel
|
||||
|
||||
=============
|
||||
*/
|
||||
cl_entity_t* GAME_EXPORT CL_GetViewModel( void )
|
||||
static cl_entity_t* GAME_EXPORT CL_GetViewModel( void )
|
||||
{
|
||||
return &clgame.viewent;
|
||||
}
|
||||
@@ -2470,6 +2484,36 @@ static physent_t *pfnGetVisent( int idx )
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static int GAME_EXPORT CL_TestLine( const vec3_t start, const vec3_t end, int flags )
|
||||
{
|
||||
return PM_TestLineExt( clgame.pmove, clgame.pmove->physents, clgame.pmove->numphysent, start, end, flags );
|
||||
}
|
||||
|
||||
/*
|
||||
=============
|
||||
CL_PushTraceBounds
|
||||
|
||||
=============
|
||||
*/
|
||||
static void GAME_EXPORT CL_PushTraceBounds( int hullnum, const float *mins, const float *maxs )
|
||||
{
|
||||
hullnum = bound( 0, hullnum, 3 );
|
||||
VectorCopy( mins, clgame.pmove->player_mins[hullnum] );
|
||||
VectorCopy( maxs, clgame.pmove->player_maxs[hullnum] );
|
||||
}
|
||||
|
||||
/*
|
||||
=============
|
||||
CL_PopTraceBounds
|
||||
|
||||
=============
|
||||
*/
|
||||
static void GAME_EXPORT CL_PopTraceBounds( void )
|
||||
{
|
||||
memcpy( clgame.pmove->player_mins, host.player_mins, sizeof( host.player_mins ));
|
||||
memcpy( clgame.pmove->player_maxs, host.player_maxs, sizeof( host.player_maxs ));
|
||||
}
|
||||
|
||||
/*
|
||||
=============
|
||||
pfnSetTraceHull
|
||||
@@ -2665,6 +2709,48 @@ static model_t *pfnLoadMapSprite( const char *filename )
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/*
|
||||
=============
|
||||
COM_AddAppDirectoryToSearchPath
|
||||
|
||||
=============
|
||||
*/
|
||||
static void GAME_EXPORT COM_AddAppDirectoryToSearchPath( const char *pszBaseDir, const char *appName )
|
||||
{
|
||||
FS_AddGameHierarchy( pszBaseDir, FS_NOWRITE_PATH );
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
===========
|
||||
COM_ExpandFilename
|
||||
|
||||
Finds the file in the search path, copies over the name with the full path name.
|
||||
This doesn't search in the pak file.
|
||||
===========
|
||||
*/
|
||||
static int GAME_EXPORT COM_ExpandFilename( const char *fileName, char *nameOutBuffer, int nameOutBufferSize )
|
||||
{
|
||||
char result[MAX_SYSPATH];
|
||||
|
||||
if( !COM_CheckString( fileName ) || !nameOutBuffer || nameOutBufferSize <= 0 )
|
||||
return 0;
|
||||
|
||||
// filename examples:
|
||||
// media\sierra.avi - D:\Xash3D\valve\media\sierra.avi
|
||||
// models\barney.mdl - D:\Xash3D\bshift\models\barney.mdl
|
||||
if( g_fsapi.GetFullDiskPath( result, sizeof( result ), fileName, false ))
|
||||
{
|
||||
// check for enough room
|
||||
if( Q_strlen( result ) > nameOutBufferSize )
|
||||
return 0;
|
||||
|
||||
Q_strncpy( nameOutBuffer, result, nameOutBufferSize );
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
=============
|
||||
PlayerInfo_ValueForKey
|
||||
|
||||
@@ -542,7 +542,7 @@ pfnPIC_Set
|
||||
|
||||
=========
|
||||
*/
|
||||
void GAME_EXPORT pfnPIC_Set( HIMAGE hPic, int r, int g, int b, int a )
|
||||
static void GAME_EXPORT pfnPIC_Set( HIMAGE hPic, int r, int g, int b, int a )
|
||||
{
|
||||
gameui.ds.gl_texturenum = hPic;
|
||||
r = bound( 0, r, 255 );
|
||||
@@ -558,7 +558,7 @@ pfnPIC_Draw
|
||||
|
||||
=========
|
||||
*/
|
||||
void GAME_EXPORT pfnPIC_Draw( int x, int y, int width, int height, const wrect_t *prc )
|
||||
static void GAME_EXPORT pfnPIC_Draw( int x, int y, int width, int height, const wrect_t *prc )
|
||||
{
|
||||
ref.dllFuncs.GL_SetRenderMode( kRenderNormal );
|
||||
PIC_DrawGeneric( x, y, width, height, prc );
|
||||
@@ -570,7 +570,7 @@ pfnPIC_DrawTrans
|
||||
|
||||
=========
|
||||
*/
|
||||
void GAME_EXPORT pfnPIC_DrawTrans( int x, int y, int width, int height, const wrect_t *prc )
|
||||
static void GAME_EXPORT pfnPIC_DrawTrans( int x, int y, int width, int height, const wrect_t *prc )
|
||||
{
|
||||
ref.dllFuncs.GL_SetRenderMode( kRenderTransTexture );
|
||||
PIC_DrawGeneric( x, y, width, height, prc );
|
||||
@@ -582,7 +582,7 @@ pfnPIC_DrawHoles
|
||||
|
||||
=========
|
||||
*/
|
||||
void GAME_EXPORT pfnPIC_DrawHoles( int x, int y, int width, int height, const wrect_t *prc )
|
||||
static void GAME_EXPORT pfnPIC_DrawHoles( int x, int y, int width, int height, const wrect_t *prc )
|
||||
{
|
||||
ref.dllFuncs.GL_SetRenderMode( kRenderTransAlpha );
|
||||
PIC_DrawGeneric( x, y, width, height, prc );
|
||||
@@ -594,7 +594,7 @@ pfnPIC_DrawAdditive
|
||||
|
||||
=========
|
||||
*/
|
||||
void GAME_EXPORT pfnPIC_DrawAdditive( int x, int y, int width, int height, const wrect_t *prc )
|
||||
static void GAME_EXPORT pfnPIC_DrawAdditive( int x, int y, int width, int height, const wrect_t *prc )
|
||||
{
|
||||
ref.dllFuncs.GL_SetRenderMode( kRenderTransAdd );
|
||||
PIC_DrawGeneric( x, y, width, height, prc );
|
||||
@@ -984,7 +984,7 @@ pfnCheckGameDll
|
||||
|
||||
=========
|
||||
*/
|
||||
int GAME_EXPORT pfnCheckGameDll( void )
|
||||
static int GAME_EXPORT pfnCheckGameDll( void )
|
||||
{
|
||||
#ifdef XASH_INTERNAL_GAMELIBS
|
||||
return true;
|
||||
@@ -1092,6 +1092,11 @@ static int pfnDelete( const char *path )
|
||||
return FS_Delete( path );
|
||||
}
|
||||
|
||||
static void GAME_EXPORT pfnCon_DefaultColor( int r, int g, int b )
|
||||
{
|
||||
Con_DefaultColor( r, g, b, true );
|
||||
}
|
||||
|
||||
// engine callbacks
|
||||
static ui_enginefuncs_t gEngfuncs =
|
||||
{
|
||||
@@ -1131,7 +1136,7 @@ static ui_enginefuncs_t gEngfuncs =
|
||||
UI_DrawConsoleString,
|
||||
UI_DrawSetTextColor,
|
||||
Con_DrawStringLen,
|
||||
Con_DefaultColor,
|
||||
pfnCon_DefaultColor,
|
||||
pfnGetPlayerModel,
|
||||
pfnSetPlayerModel,
|
||||
pfnClearScene,
|
||||
@@ -1215,6 +1220,7 @@ static ui_extendedfuncs_t gExtendedfuncs =
|
||||
pfnParseFileSafe,
|
||||
NET_AdrToString,
|
||||
NET_CompareAdrSort,
|
||||
Sys_GetNativeObject,
|
||||
};
|
||||
|
||||
void UI_UnloadProgs( void )
|
||||
|
||||
@@ -28,7 +28,6 @@ GNU General Public License for more details.
|
||||
#define MAX_CMD_BUFFER 8000
|
||||
#define CONNECTION_PROBLEM_TIME 15.0 // 15 seconds
|
||||
#define CL_CONNECTION_RETRIES 10
|
||||
#define CL_TEST_RETRIES_NORESPONCE 3
|
||||
#define CL_TEST_RETRIES 5
|
||||
|
||||
CVAR_DEFINE_AUTO( mp_decals, "300", FCVAR_ARCHIVE, "decals limit in multiplayer" );
|
||||
@@ -61,7 +60,9 @@ CVAR_DEFINE_AUTO( cl_smoothtime, "0.1", FCVAR_ARCHIVE, "time to smooth up" );
|
||||
CVAR_DEFINE_AUTO( cl_clockreset, "0.1", FCVAR_ARCHIVE, "frametime delta maximum value before reset" );
|
||||
CVAR_DEFINE_AUTO( cl_fixtimerate, "7.5", FCVAR_ARCHIVE, "time in msec to client clock adjusting" );
|
||||
CVAR_DEFINE_AUTO( hud_fontscale, "1.0", FCVAR_ARCHIVE|FCVAR_LATCH, "scale hud font texture" );
|
||||
CVAR_DEFINE_AUTO( hud_fontrender, "0", FCVAR_ARCHIVE, "hud font render mode (0: additive, 1: holes, 2: trans)" );
|
||||
CVAR_DEFINE_AUTO( hud_scale, "0", FCVAR_ARCHIVE|FCVAR_LATCH, "scale hud at current resolution" );
|
||||
CVAR_DEFINE_AUTO( hud_scale_minimal_width, "640", FCVAR_ARCHIVE|FCVAR_LATCH, "if hud_scale results in a HUD virtual screen smaller than this value, it won't be applied" );
|
||||
CVAR_DEFINE_AUTO( cl_solid_players, "1", 0, "Make all players not solid (can't traceline them)" );
|
||||
CVAR_DEFINE_AUTO( cl_updaterate, "20", FCVAR_USERINFO|FCVAR_ARCHIVE, "refresh rate of server messages" );
|
||||
CVAR_DEFINE_AUTO( cl_showevents, "0", FCVAR_ARCHIVE, "show events playback" );
|
||||
@@ -73,8 +74,9 @@ static CVAR_DEFINE_AUTO( cl_upmax, "1200", FCVAR_ARCHIVE, "max allowed incoming
|
||||
|
||||
CVAR_DEFINE_AUTO( cl_lw, "1", FCVAR_ARCHIVE|FCVAR_USERINFO, "enable client weapon predicting" );
|
||||
CVAR_DEFINE_AUTO( cl_charset, "utf-8", FCVAR_ARCHIVE, "1-byte charset to use (iconv style)" );
|
||||
CVAR_DEFINE_AUTO( cl_trace_messages, "0", FCVAR_ARCHIVE|FCVAR_CHEAT, "enable message names tracing (good for developers)");
|
||||
CVAR_DEFINE_AUTO( cl_trace_events, "0", FCVAR_ARCHIVE|FCVAR_CHEAT, "enable events tracing (good for developers)");
|
||||
CVAR_DEFINE_AUTO( cl_trace_stufftext, "0", FCVAR_ARCHIVE|FCVAR_CHEAT, "enable stufftext (server-to-client console commands) tracing (good for developers)" );
|
||||
CVAR_DEFINE_AUTO( cl_trace_messages, "0", FCVAR_ARCHIVE|FCVAR_CHEAT, "enable message names tracing (good for developers)" );
|
||||
CVAR_DEFINE_AUTO( cl_trace_events, "0", FCVAR_ARCHIVE|FCVAR_CHEAT, "enable events tracing (good for developers)" );
|
||||
static CVAR_DEFINE_AUTO( cl_nat, "0", 0, "show servers running under NAT" );
|
||||
CVAR_DEFINE_AUTO( hud_utf8, "0", FCVAR_ARCHIVE, "Use utf-8 encoding for hud text" );
|
||||
CVAR_DEFINE_AUTO( ui_renderworld, "0", FCVAR_ARCHIVE, "render world when UI is visible" );
|
||||
@@ -178,7 +180,7 @@ finalize connection process and begin new frame
|
||||
with new cls.state
|
||||
===============
|
||||
*/
|
||||
void CL_CheckClientState( void )
|
||||
static void CL_CheckClientState( void )
|
||||
{
|
||||
// first update is the pre-final signon stage
|
||||
if(( cls.state == ca_connected || cls.state == ca_validate ) && ( cls.signon == SIGNONS ))
|
||||
@@ -278,7 +280,7 @@ CL_DriftInterpolationAmount
|
||||
Drift interpolation value (this is used for server unlag system)
|
||||
===============
|
||||
*/
|
||||
int CL_DriftInterpolationAmount( int goal )
|
||||
static int CL_DriftInterpolationAmount( int goal )
|
||||
{
|
||||
float fgoal, maxmove, diff;
|
||||
int msec;
|
||||
@@ -306,7 +308,7 @@ CL_ComputeClientInterpolationAmount
|
||||
Validate interpolation cvars, calc interpolation window
|
||||
===============
|
||||
*/
|
||||
void CL_ComputeClientInterpolationAmount( usercmd_t *cmd )
|
||||
static void CL_ComputeClientInterpolationAmount( usercmd_t *cmd )
|
||||
{
|
||||
const float epsilon = 0.001f; // to avoid float invalid comparision
|
||||
float min_interp;
|
||||
@@ -352,7 +354,7 @@ CL_ComputePacketLoss
|
||||
|
||||
=================
|
||||
*/
|
||||
void CL_ComputePacketLoss( void )
|
||||
static void CL_ComputePacketLoss( void )
|
||||
{
|
||||
int i, frm;
|
||||
frame_t *frame;
|
||||
@@ -397,7 +399,7 @@ void CL_UpdateFrameLerp( void )
|
||||
cl.commands[(cls.netchan.outgoing_sequence - 1) & CL_UPDATE_MASK].frame_lerp = cl.lerpFrac;
|
||||
}
|
||||
|
||||
void CL_FindInterpolatedAddAngle( float t, float *frac, pred_viewangle_t **prev, pred_viewangle_t **next )
|
||||
static void CL_FindInterpolatedAddAngle( float t, float *frac, pred_viewangle_t **prev, pred_viewangle_t **next )
|
||||
{
|
||||
int i, i0, i1, imod;
|
||||
float at;
|
||||
@@ -439,7 +441,7 @@ void CL_FindInterpolatedAddAngle( float t, float *frac, pred_viewangle_t **prev,
|
||||
*frac = bound( 0.0f, *frac, 1.0f );
|
||||
}
|
||||
|
||||
void CL_ApplyAddAngle( void )
|
||||
static void CL_ApplyAddAngle( void )
|
||||
{
|
||||
pred_viewangle_t *prev = NULL, *next = NULL;
|
||||
float addangletotal = 0.0f;
|
||||
@@ -475,7 +477,7 @@ CL_ProcessShowTexturesCmds
|
||||
navigate around texture atlas
|
||||
===============
|
||||
*/
|
||||
qboolean CL_ProcessShowTexturesCmds( usercmd_t *cmd )
|
||||
static qboolean CL_ProcessShowTexturesCmds( usercmd_t *cmd )
|
||||
{
|
||||
static int oldbuttons;
|
||||
int changed;
|
||||
@@ -504,7 +506,7 @@ CL_ProcessOverviewCmds
|
||||
Transform user movement into overview adjust
|
||||
===============
|
||||
*/
|
||||
qboolean CL_ProcessOverviewCmds( usercmd_t *cmd )
|
||||
static qboolean CL_ProcessOverviewCmds( usercmd_t *cmd )
|
||||
{
|
||||
ref_overview_t *ov = &clgame.overView;
|
||||
int sign = 1;
|
||||
@@ -556,7 +558,7 @@ CL_UpdateClientData
|
||||
tell the client.dll about player origin, angles, fov, etc
|
||||
=================
|
||||
*/
|
||||
void CL_UpdateClientData( void )
|
||||
static void CL_UpdateClientData( void )
|
||||
{
|
||||
client_data_t cdat;
|
||||
|
||||
@@ -583,7 +585,7 @@ void CL_UpdateClientData( void )
|
||||
CL_CreateCmd
|
||||
=================
|
||||
*/
|
||||
void CL_CreateCmd( void )
|
||||
static void CL_CreateCmd( void )
|
||||
{
|
||||
usercmd_t nullcmd, *cmd;
|
||||
runcmd_t *pcmd;
|
||||
@@ -687,7 +689,7 @@ Create and send the command packet to the server
|
||||
Including both the reliable commands and the usercmds
|
||||
===================
|
||||
*/
|
||||
void CL_WritePacket( void )
|
||||
static void CL_WritePacket( void )
|
||||
{
|
||||
sizebuf_t buf;
|
||||
qboolean send_command = false;
|
||||
@@ -879,7 +881,7 @@ CL_SendCommand
|
||||
Called every frame to builds and sends a command packet to the server.
|
||||
=================
|
||||
*/
|
||||
void CL_SendCommand( void )
|
||||
static void CL_SendCommand( void )
|
||||
{
|
||||
// we create commands even if a demo is playing,
|
||||
CL_CreateCmd();
|
||||
@@ -893,7 +895,7 @@ void CL_SendCommand( void )
|
||||
CL_BeginUpload_f
|
||||
==================
|
||||
*/
|
||||
void CL_BeginUpload_f( void )
|
||||
static void CL_BeginUpload_f( void )
|
||||
{
|
||||
const char *name;
|
||||
resource_t custResource;
|
||||
@@ -990,7 +992,7 @@ We have gotten a challenge from the server, so try and
|
||||
connect.
|
||||
======================
|
||||
*/
|
||||
void CL_SendConnectPacket( void )
|
||||
static void CL_SendConnectPacket( void )
|
||||
{
|
||||
char protinfo[MAX_INFO_STRING];
|
||||
const char *qport;
|
||||
@@ -1069,6 +1071,22 @@ void CL_SendConnectPacket( void )
|
||||
cls.timestart = Sys_DoubleTime();
|
||||
}
|
||||
|
||||
/*
|
||||
=================
|
||||
CL_GetTestFragmentSize
|
||||
|
||||
Returns bandwidth test fragment size
|
||||
=================
|
||||
*/
|
||||
static int CL_GetTestFragmentSize( void )
|
||||
{
|
||||
const int fragmentSizes[CL_TEST_RETRIES] = { 64000, 32000, 10666, 5200, 1400 };
|
||||
if( cls.connect_retry >= 0 && cls.connect_retry < CL_TEST_RETRIES )
|
||||
return bound( FRAGMENT_MIN_SIZE, fragmentSizes[cls.connect_retry], FRAGMENT_MAX_SIZE );
|
||||
else
|
||||
return FRAGMENT_MIN_SIZE;
|
||||
}
|
||||
|
||||
/*
|
||||
=================
|
||||
CL_CheckForResend
|
||||
@@ -1076,12 +1094,13 @@ CL_CheckForResend
|
||||
Resend a connect message if the last one has timed out
|
||||
=================
|
||||
*/
|
||||
void CL_CheckForResend( void )
|
||||
static void CL_CheckForResend( void )
|
||||
{
|
||||
netadr_t adr;
|
||||
net_gai_state_t res;
|
||||
float resendTime;
|
||||
qboolean bandwidthTest;
|
||||
|
||||
|
||||
if( cls.internetservers_wait )
|
||||
CL_SendMasterServerScanRequest();
|
||||
|
||||
@@ -1107,7 +1126,10 @@ void CL_CheckForResend( void )
|
||||
else if( cl_resend.value > CL_MAX_RESEND_TIME )
|
||||
Cvar_SetValue( "cl_resend", CL_MAX_RESEND_TIME );
|
||||
|
||||
if(( host.realtime - cls.connect_time ) < cl_resend.value )
|
||||
bandwidthTest = !cls.legacymode && cl_test_bandwidth.value && cls.connect_retry <= CL_TEST_RETRIES;
|
||||
resendTime = bandwidthTest ? 1.0f : cl_resend.value;
|
||||
|
||||
if(( host.realtime - cls.connect_time ) < resendTime )
|
||||
return;
|
||||
|
||||
res = NET_StringToAdrNB( cls.servername, &adr );
|
||||
@@ -1134,10 +1156,11 @@ void CL_CheckForResend( void )
|
||||
|
||||
if( adr.port == 0 ) adr.port = MSG_BigShort( PORT_SERVER );
|
||||
|
||||
if( cls.connect_retry == CL_TEST_RETRIES_NORESPONCE )
|
||||
if( cls.connect_retry == CL_TEST_RETRIES )
|
||||
{
|
||||
// too many fails use default connection method
|
||||
Con_Printf( "hi-speed connection is failed, use default method\n" );
|
||||
Con_Printf( "Bandwidth test failed, fallback to default connecting method\n" );
|
||||
Con_Printf( "Connecting to %s... (retry #%i)\n", cls.servername, cls.connect_retry + 1 );
|
||||
Netchan_OutOfBandPrint( NS_CLIENT, adr, "getchallenge\n" );
|
||||
Cvar_SetValue( "cl_dlmax", FRAGMENT_MIN_SIZE );
|
||||
cls.connect_time = host.realtime;
|
||||
@@ -1145,16 +1168,15 @@ void CL_CheckForResend( void )
|
||||
return;
|
||||
}
|
||||
|
||||
bandwidthTest = !cls.legacymode && cl_test_bandwidth.value;
|
||||
cls.serveradr = adr;
|
||||
cls.max_fragment_size = Q_min( FRAGMENT_MAX_SIZE, cls.max_fragment_size / (cls.connect_retry + 1));
|
||||
cls.max_fragment_size = CL_GetTestFragmentSize();
|
||||
cls.connect_time = host.realtime; // for retransmit requests
|
||||
cls.connect_retry++;
|
||||
|
||||
if( bandwidthTest )
|
||||
Con_Printf( "Connecting to %s... [retry #%i, max fragment size %i]\n", cls.servername, cls.connect_retry, cls.max_fragment_size );
|
||||
Con_Printf( "Connecting to %s... (retry #%i, fragment size %i)\n", cls.servername, cls.connect_retry, cls.max_fragment_size );
|
||||
else
|
||||
Con_Printf( "Connecting to %s... [retry #%i]\n", cls.servername, cls.connect_retry );
|
||||
Con_Printf( "Connecting to %s... (retry #%i)\n", cls.servername, cls.connect_retry );
|
||||
|
||||
if( bandwidthTest )
|
||||
Netchan_OutOfBandPrint( NS_CLIENT, adr, "bandwidth %i %i\n", PROTOCOL_VERSION, cls.max_fragment_size );
|
||||
@@ -1162,7 +1184,7 @@ void CL_CheckForResend( void )
|
||||
Netchan_OutOfBandPrint( NS_CLIENT, adr, "getchallenge\n" );
|
||||
}
|
||||
|
||||
resource_t *CL_AddResource( resourcetype_t type, const char *name, int size, qboolean bFatalIfMissing, int index )
|
||||
static resource_t *CL_AddResource( resourcetype_t type, const char *name, int size, qboolean bFatalIfMissing, int index )
|
||||
{
|
||||
resource_t *r = &cl.resourcelist[cl.num_resources];
|
||||
|
||||
@@ -1179,7 +1201,7 @@ resource_t *CL_AddResource( resourcetype_t type, const char *name, int size, qbo
|
||||
return r;
|
||||
}
|
||||
|
||||
void CL_CreateResourceList( void )
|
||||
static void CL_CreateResourceList( void )
|
||||
{
|
||||
char szFileName[MAX_OSPATH];
|
||||
byte rgucMD5_hash[16];
|
||||
@@ -1227,7 +1249,7 @@ CL_Connect_f
|
||||
|
||||
================
|
||||
*/
|
||||
void CL_Connect_f( void )
|
||||
static void CL_Connect_f( void )
|
||||
{
|
||||
string server;
|
||||
qboolean legacyconnect = false;
|
||||
@@ -1274,7 +1296,7 @@ Send the rest of the command line over as
|
||||
an unconnected command.
|
||||
=====================
|
||||
*/
|
||||
void CL_Rcon_f( void )
|
||||
static void CL_Rcon_f( void )
|
||||
{
|
||||
char message[1024];
|
||||
netadr_t to;
|
||||
@@ -1381,7 +1403,7 @@ CL_SendDisconnectMessage
|
||||
Sends a disconnect message to the server
|
||||
=====================
|
||||
*/
|
||||
void CL_SendDisconnectMessage( void )
|
||||
static void CL_SendDisconnectMessage( void )
|
||||
{
|
||||
sizebuf_t buf;
|
||||
byte data[32];
|
||||
@@ -1426,7 +1448,7 @@ CL_Reconnect
|
||||
build a request to reconnect client
|
||||
=====================
|
||||
*/
|
||||
void CL_Reconnect( qboolean setup_netchan )
|
||||
static void CL_Reconnect( qboolean setup_netchan )
|
||||
{
|
||||
if( setup_netchan )
|
||||
{
|
||||
@@ -1553,7 +1575,7 @@ void CL_Crashed( void )
|
||||
CL_LocalServers_f
|
||||
=================
|
||||
*/
|
||||
void CL_LocalServers_f( void )
|
||||
static void CL_LocalServers_f( void )
|
||||
{
|
||||
netadr_t adr;
|
||||
|
||||
@@ -1622,7 +1644,7 @@ static void CL_SendMasterServerScanRequest( void )
|
||||
CL_InternetServers_f
|
||||
=================
|
||||
*/
|
||||
void CL_InternetServers_f( void )
|
||||
static void CL_InternetServers_f( void )
|
||||
{
|
||||
qboolean nat = cl_nat.value != 0.0f;
|
||||
uint32_t key;
|
||||
@@ -1651,7 +1673,7 @@ CL_Reconnect_f
|
||||
The server is changing levels
|
||||
=================
|
||||
*/
|
||||
void CL_Reconnect_f( void )
|
||||
static void CL_Reconnect_f( void )
|
||||
{
|
||||
if( cls.state == ca_disconnected )
|
||||
return;
|
||||
@@ -1688,7 +1710,7 @@ CL_FixupColorStringsForInfoString
|
||||
all the keys and values must be ends with ^7
|
||||
=================
|
||||
*/
|
||||
void CL_FixupColorStringsForInfoString( const char *in, char *out )
|
||||
static void CL_FixupColorStringsForInfoString( const char *in, char *out )
|
||||
{
|
||||
qboolean hasPrefix = false;
|
||||
qboolean endOfKeyVal = false;
|
||||
@@ -1752,7 +1774,7 @@ CL_ParseStatusMessage
|
||||
Handle a reply from a info
|
||||
=================
|
||||
*/
|
||||
void CL_ParseStatusMessage( netadr_t from, sizebuf_t *msg )
|
||||
static void CL_ParseStatusMessage( netadr_t from, sizebuf_t *msg )
|
||||
{
|
||||
static char infostring[MAX_INFO_STRING+8];
|
||||
char *s = MSG_ReadString( msg );
|
||||
@@ -1801,7 +1823,7 @@ CL_ParseNETInfoMessage
|
||||
Handle a reply from a netinfo
|
||||
=================
|
||||
*/
|
||||
void CL_ParseNETInfoMessage( netadr_t from, sizebuf_t *msg, const char *s )
|
||||
static void CL_ParseNETInfoMessage( netadr_t from, sizebuf_t *msg, const char *s )
|
||||
{
|
||||
net_request_t *nr;
|
||||
static char infostring[MAX_INFO_STRING+8];
|
||||
@@ -1856,7 +1878,7 @@ CL_ProcessNetRequests
|
||||
check for timeouts
|
||||
=================
|
||||
*/
|
||||
void CL_ProcessNetRequests( void )
|
||||
static void CL_ProcessNetRequests( void )
|
||||
{
|
||||
net_request_t *nr;
|
||||
int i;
|
||||
@@ -1938,7 +1960,7 @@ CL_ConnectionlessPacket
|
||||
Responses to broadcasts, etc
|
||||
=================
|
||||
*/
|
||||
void CL_ConnectionlessPacket( netadr_t from, sizebuf_t *msg )
|
||||
static void CL_ConnectionlessPacket( netadr_t from, sizebuf_t *msg )
|
||||
{
|
||||
char *args;
|
||||
const char *c;
|
||||
@@ -2235,7 +2257,7 @@ CL_GetMessage
|
||||
Handles recording and playback of demos, on top of NET_ code
|
||||
====================
|
||||
*/
|
||||
int CL_GetMessage( byte *data, size_t *length )
|
||||
static int CL_GetMessage( byte *data, size_t *length )
|
||||
{
|
||||
if( cls.demoplayback )
|
||||
{
|
||||
@@ -2254,7 +2276,7 @@ int CL_GetMessage( byte *data, size_t *length )
|
||||
CL_ReadNetMessage
|
||||
=================
|
||||
*/
|
||||
void CL_ReadNetMessage( void )
|
||||
static void CL_ReadNetMessage( void )
|
||||
{
|
||||
size_t curSize;
|
||||
|
||||
@@ -2338,7 +2360,7 @@ Updates the local time and reads/handles messages
|
||||
on client net connection.
|
||||
=================
|
||||
*/
|
||||
void CL_ReadPackets( void )
|
||||
static void CL_ReadPackets( void )
|
||||
{
|
||||
// decide the simulation time
|
||||
cl.oldtime = cl.time;
|
||||
@@ -2402,7 +2424,7 @@ CL_CleanFileName
|
||||
Replace the displayed name for some resources
|
||||
====================
|
||||
*/
|
||||
const char *CL_CleanFileName( const char *filename )
|
||||
static const char *CL_CleanFileName( const char *filename )
|
||||
{
|
||||
if( COM_CheckString( filename ) && filename[0] == '!' )
|
||||
return "customization";
|
||||
@@ -2418,7 +2440,7 @@ CL_RegisterCustomization
|
||||
register custom resource for player
|
||||
====================
|
||||
*/
|
||||
void CL_RegisterCustomization( resource_t *resource )
|
||||
static void CL_RegisterCustomization( resource_t *resource )
|
||||
{
|
||||
qboolean bFound = false;
|
||||
customization_t *pList;
|
||||
@@ -2624,7 +2646,7 @@ void CL_ServerCommand( qboolean reliable, const char *fmt, ... )
|
||||
CL_SetInfo_f
|
||||
==============
|
||||
*/
|
||||
void CL_SetInfo_f( void )
|
||||
static void CL_SetInfo_f( void )
|
||||
{
|
||||
convar_t *var;
|
||||
|
||||
@@ -2664,7 +2686,7 @@ void CL_SetInfo_f( void )
|
||||
CL_Physinfo_f
|
||||
==============
|
||||
*/
|
||||
void CL_Physinfo_f( void )
|
||||
static void CL_Physinfo_f( void )
|
||||
{
|
||||
Con_Printf( "Phys info settings:\n" );
|
||||
Info_Print( cls.physinfo );
|
||||
@@ -2819,7 +2841,7 @@ CL_FullServerinfo_f
|
||||
Sent by server when serverinfo changes
|
||||
==================
|
||||
*/
|
||||
void CL_FullServerinfo_f( void )
|
||||
static void CL_FullServerinfo_f( void )
|
||||
{
|
||||
if( Cmd_Argc() != 2 )
|
||||
{
|
||||
@@ -2837,7 +2859,7 @@ CL_Escape_f
|
||||
Escape to menu from game
|
||||
=================
|
||||
*/
|
||||
void CL_Escape_f( void )
|
||||
static void CL_Escape_f( void )
|
||||
{
|
||||
if( cls.key_dest == key_menu )
|
||||
return;
|
||||
@@ -2855,7 +2877,7 @@ void CL_Escape_f( void )
|
||||
CL_InitLocal
|
||||
=================
|
||||
*/
|
||||
void CL_InitLocal( void )
|
||||
static void CL_InitLocal( void )
|
||||
{
|
||||
cls.state = ca_disconnected;
|
||||
cls.signon = 0;
|
||||
@@ -2890,6 +2912,7 @@ void CL_InitLocal( void )
|
||||
|
||||
Cvar_RegisterVariable( &rcon_address );
|
||||
|
||||
Cvar_RegisterVariable( &cl_trace_stufftext );
|
||||
Cvar_RegisterVariable( &cl_trace_messages );
|
||||
Cvar_RegisterVariable( &cl_trace_events );
|
||||
|
||||
@@ -2925,7 +2948,9 @@ void CL_InitLocal( void )
|
||||
Cvar_RegisterVariable( &cl_clockreset );
|
||||
Cvar_RegisterVariable( &cl_fixtimerate );
|
||||
Cvar_RegisterVariable( &hud_fontscale );
|
||||
Cvar_RegisterVariable( &hud_fontrender );
|
||||
Cvar_RegisterVariable( &hud_scale );
|
||||
Cvar_RegisterVariable( &hud_scale_minimal_width );
|
||||
Cvar_Get( "cl_background", "0", FCVAR_READ_ONLY, "indicate what background map is running" );
|
||||
Cvar_RegisterVariable( &cl_showevents );
|
||||
Cvar_Get( "lastdemo", "", FCVAR_ARCHIVE, "last played demo" );
|
||||
@@ -2981,12 +3006,12 @@ void CL_InitLocal( void )
|
||||
Cmd_AddRestrictedCommand ("quit", CL_Quit_f, "quit from game" );
|
||||
Cmd_AddRestrictedCommand ("exit", CL_Quit_f, "quit from game" );
|
||||
|
||||
Cmd_AddCommand ("screenshot", CL_ScreenShot_f, "takes a screenshot of the next rendered frame" );
|
||||
Cmd_AddCommand ("snapshot", CL_SnapShot_f, "takes a snapshot of the next rendered frame" );
|
||||
Cmd_AddCommand ("envshot", CL_EnvShot_f, "takes a six-sides cubemap shot with specified name" );
|
||||
Cmd_AddCommand ("skyshot", CL_SkyShot_f, "takes a six-sides envmap (skybox) shot with specified name" );
|
||||
Cmd_AddCommand ("screenshot", CL_GenericShot_f, "takes a screenshot of the next rendered frame" );
|
||||
Cmd_AddCommand ("snapshot", CL_GenericShot_f, "takes a snapshot of the next rendered frame" );
|
||||
Cmd_AddCommand ("envshot", CL_GenericShot_f, "takes a six-sides cubemap shot with specified name" );
|
||||
Cmd_AddCommand ("skyshot", CL_GenericShot_f, "takes a six-sides envmap (skybox) shot with specified name" );
|
||||
Cmd_AddCommand ("levelshot", CL_LevelShot_f, "same as \"screenshot\", used for create plaque images" );
|
||||
Cmd_AddCommand ("saveshot", CL_SaveShot_f, "used for create save previews with LoadGame menu" );
|
||||
Cmd_AddCommand ("saveshot", CL_GenericShot_f, "used for create save previews with LoadGame menu" );
|
||||
|
||||
Cmd_AddCommand ("connect", CL_Connect_f, "connect to a server by hostname" );
|
||||
Cmd_AddCommand ("reconnect", CL_Reconnect_f, "reconnect to current level" );
|
||||
@@ -3005,7 +3030,7 @@ slowly adjuct client clock
|
||||
to smooth lag effect
|
||||
==================
|
||||
*/
|
||||
void CL_AdjustClock( void )
|
||||
static void CL_AdjustClock( void )
|
||||
{
|
||||
if( cl.timedelta == 0.0f || !cl_fixtimerate.value )
|
||||
return;
|
||||
@@ -3139,7 +3164,7 @@ void CL_Init( void )
|
||||
|
||||
VID_Init(); // init video
|
||||
S_Init(); // init sound
|
||||
Voice_Init( VOICE_DEFAULT_CODEC, 3 ); // init voice
|
||||
Voice_Init( VOICE_DEFAULT_CODEC, 3, true ); // init voice (do not open the device)
|
||||
|
||||
// unreliable buffer. unsed for unreliable commands and voice stream
|
||||
MSG_Init( &cls.datagram, "cls.datagram", cls.datagram_buf, sizeof( cls.datagram_buf ));
|
||||
|
||||
@@ -387,7 +387,7 @@ static void NetGraph_DrawTextFields( int x, int y, int w, wrect_t rect, int coun
|
||||
// move rolling average
|
||||
framerate = FRAMERATE_AVG_FRAC * host.frametime + ( 1.0f - FRAMERATE_AVG_FRAC ) * framerate;
|
||||
|
||||
ref.dllFuncs.GL_SetRenderMode( font->rendermode );
|
||||
CL_SetFontRendermode( font );
|
||||
|
||||
if( framerate > 0.0f )
|
||||
{
|
||||
|
||||
@@ -21,7 +21,6 @@ GNU General Public License for more details.
|
||||
#include "shake.h"
|
||||
#include "hltv.h"
|
||||
#include "input.h"
|
||||
#include "server.h"
|
||||
#if XASH_LOW_MEMORY != 2
|
||||
int CL_UPDATE_BACKUP = SINGLEPLAYER_BACKUP;
|
||||
#endif
|
||||
@@ -32,7 +31,7 @@ CL_UserMsgStub
|
||||
Default stub for missed callbacks
|
||||
===============
|
||||
*/
|
||||
int CL_UserMsgStub( const char *pszName, int iSize, void *pbuf )
|
||||
static int CL_UserMsgStub( const char *pszName, int iSize, void *pbuf )
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
@@ -58,7 +57,7 @@ CL_ParseSoundPacket
|
||||
|
||||
==================
|
||||
*/
|
||||
void CL_ParseSoundPacket( sizebuf_t *msg )
|
||||
static void CL_ParseSoundPacket( sizebuf_t *msg )
|
||||
{
|
||||
vec3_t pos;
|
||||
int chan, sound;
|
||||
@@ -305,7 +304,7 @@ CL_ParseStaticEntity
|
||||
static client entity
|
||||
==================
|
||||
*/
|
||||
void CL_ParseStaticEntity( sizebuf_t *msg )
|
||||
static void CL_ParseStaticEntity( sizebuf_t *msg )
|
||||
{
|
||||
int i, newnum;
|
||||
entity_state_t from, to;
|
||||
@@ -619,7 +618,7 @@ static void CL_StartResourceDownloading( const char *pszMessage, qboolean bCusto
|
||||
CL_BatchResourceRequest( !bCustom );
|
||||
}
|
||||
|
||||
customization_t *CL_PlayerHasCustomization( int nPlayerNum, resourcetype_t type )
|
||||
static customization_t *CL_PlayerHasCustomization( int nPlayerNum, resourcetype_t type )
|
||||
{
|
||||
customization_t *pList;
|
||||
|
||||
@@ -631,7 +630,7 @@ customization_t *CL_PlayerHasCustomization( int nPlayerNum, resourcetype_t type
|
||||
return NULL;
|
||||
}
|
||||
|
||||
void CL_RemoveCustomization( int nPlayerNum, customization_t *pRemove )
|
||||
static void CL_RemoveCustomization( int nPlayerNum, customization_t *pRemove )
|
||||
{
|
||||
customization_t *pList;
|
||||
customization_t *pNext;
|
||||
@@ -802,7 +801,7 @@ CL_CreateCustomizationList
|
||||
loading custom decal for self
|
||||
==================
|
||||
*/
|
||||
void CL_CreateCustomizationList( void )
|
||||
static void CL_CreateCustomizationList( void )
|
||||
{
|
||||
resource_t *pResource;
|
||||
player_info_t *pPlayer;
|
||||
@@ -1383,9 +1382,13 @@ void CL_UpdateUserinfo( sizebuf_t *msg, qboolean legacy )
|
||||
if( slot >= MAX_CLIENTS )
|
||||
Host_Error( "CL_ParseServerMessage: svc_updateuserinfo >= MAX_CLIENTS\n" );
|
||||
|
||||
player = &cl.players[slot];
|
||||
|
||||
if( !legacy )
|
||||
id = MSG_ReadLong( msg ); // unique user ID
|
||||
player = &cl.players[slot];
|
||||
else
|
||||
id = 0; // bogus
|
||||
|
||||
active = MSG_ReadOneBit( msg ) ? true : false;
|
||||
|
||||
if( active )
|
||||
@@ -1407,6 +1410,10 @@ void CL_UpdateUserinfo( sizebuf_t *msg, qboolean legacy )
|
||||
|
||||
memset( player, 0, sizeof( *player ));
|
||||
}
|
||||
|
||||
// in GoldSrc userinfo might be empty but userid is always sent as separate value
|
||||
// thus avoids clean up even after client disconnect
|
||||
player->userid = id;
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -1494,7 +1501,7 @@ void CL_UpdateUserPings( sizebuf_t *msg )
|
||||
}
|
||||
}
|
||||
|
||||
void CL_SendConsistencyInfo( sizebuf_t *msg )
|
||||
static void CL_SendConsistencyInfo( sizebuf_t *msg )
|
||||
{
|
||||
qboolean user_changed_diskfile;
|
||||
vec3_t mins, maxs;
|
||||
@@ -1671,7 +1678,7 @@ void CL_RegisterResources( sizebuf_t *msg )
|
||||
}
|
||||
}
|
||||
|
||||
void CL_ParseConsistencyInfo( sizebuf_t *msg )
|
||||
static void CL_ParseConsistencyInfo( sizebuf_t *msg )
|
||||
{
|
||||
int lastcheck;
|
||||
int delta;
|
||||
@@ -1736,7 +1743,7 @@ CL_ParseResourceList
|
||||
|
||||
==============
|
||||
*/
|
||||
void CL_ParseResourceList( sizebuf_t *msg )
|
||||
static void CL_ParseResourceList( sizebuf_t *msg )
|
||||
{
|
||||
resource_t *pResource;
|
||||
int i, total;
|
||||
@@ -1773,12 +1780,12 @@ CL_ParseVoiceInit
|
||||
|
||||
==================
|
||||
*/
|
||||
void CL_ParseVoiceInit( sizebuf_t *msg )
|
||||
static void CL_ParseVoiceInit( sizebuf_t *msg )
|
||||
{
|
||||
char *pszCodec = MSG_ReadString( msg );
|
||||
int quality = MSG_ReadByte( msg );
|
||||
|
||||
Voice_Init( pszCodec, quality );
|
||||
Voice_Init( pszCodec, quality, false ); // init requested codec and the device
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -1787,7 +1794,7 @@ CL_ParseVoiceData
|
||||
|
||||
==================
|
||||
*/
|
||||
void CL_ParseVoiceData( sizebuf_t *msg )
|
||||
static void CL_ParseVoiceData( sizebuf_t *msg )
|
||||
{
|
||||
int size, idx, frames;
|
||||
byte received[8192];
|
||||
@@ -1904,7 +1911,7 @@ CL_ParseScreenShake
|
||||
Set screen shake
|
||||
==============
|
||||
*/
|
||||
void CL_ParseScreenShake( sizebuf_t *msg )
|
||||
static void CL_ParseScreenShake( sizebuf_t *msg )
|
||||
{
|
||||
float amplitude = (float)(word)MSG_ReadShort( msg ) * ( 1.0f / (float)( 1 << 12 ));
|
||||
float duration = (float)(word)MSG_ReadShort( msg ) * ( 1.0f / (float)( 1 << 12 ));
|
||||
@@ -1927,7 +1934,7 @@ CL_ParseScreenFade
|
||||
Set screen fade
|
||||
==============
|
||||
*/
|
||||
void CL_ParseScreenFade( sizebuf_t *msg )
|
||||
static void CL_ParseScreenFade( sizebuf_t *msg )
|
||||
{
|
||||
float duration, holdTime;
|
||||
screenfade_t *sf = &clgame.fade;
|
||||
@@ -2026,7 +2033,7 @@ CL_ParseExec
|
||||
Exec map/class specific configs
|
||||
==============
|
||||
*/
|
||||
void CL_ParseExec( sizebuf_t *msg )
|
||||
static void CL_ParseExec( sizebuf_t *msg )
|
||||
{
|
||||
qboolean is_class;
|
||||
int class_idx;
|
||||
@@ -2322,11 +2329,18 @@ void CL_ParseServerMessage( sizebuf_t *msg, qboolean normal_message )
|
||||
break;
|
||||
case svc_stufftext:
|
||||
s = MSG_ReadString( msg );
|
||||
if( cl_trace_stufftext.value )
|
||||
{
|
||||
size_t len = Q_strlen( s );
|
||||
Con_Printf( "Stufftext: %s%c", s, len && s[len-1] == '\n' ? '\0' : '\n' );
|
||||
}
|
||||
|
||||
#ifdef HACKS_RELATED_HLMODS
|
||||
// disable Cry Of Fear antisave protection
|
||||
if( !Q_strnicmp( s, "disconnect", 10 ) && cls.signon != SIGNONS )
|
||||
break; // too early
|
||||
#endif
|
||||
|
||||
Cbuf_AddFilteredText( s );
|
||||
break;
|
||||
case svc_setangle:
|
||||
|
||||
@@ -30,7 +30,7 @@ CL_ParseStaticEntity
|
||||
static client entity
|
||||
==================
|
||||
*/
|
||||
void CL_LegacyParseStaticEntity( sizebuf_t *msg )
|
||||
static void CL_LegacyParseStaticEntity( sizebuf_t *msg )
|
||||
{
|
||||
int i;
|
||||
entity_state_t state;
|
||||
@@ -98,7 +98,7 @@ void CL_LegacyParseStaticEntity( sizebuf_t *msg )
|
||||
R_AddEfrags( ent ); // add link
|
||||
}
|
||||
|
||||
void CL_LegacyParseSoundPacket( sizebuf_t *msg, qboolean is_ambient )
|
||||
static void CL_LegacyParseSoundPacket( sizebuf_t *msg, qboolean is_ambient )
|
||||
{
|
||||
vec3_t pos;
|
||||
int chan, sound;
|
||||
@@ -167,7 +167,7 @@ CL_PrecacheSound
|
||||
prceache sound from server
|
||||
================
|
||||
*/
|
||||
void CL_LegacyPrecacheSound( sizebuf_t *msg )
|
||||
static void CL_LegacyPrecacheSound( sizebuf_t *msg )
|
||||
{
|
||||
int soundIndex;
|
||||
|
||||
@@ -184,7 +184,7 @@ void CL_LegacyPrecacheSound( sizebuf_t *msg )
|
||||
cl.sound_index[soundIndex] = S_RegisterSound( cl.sound_precache[soundIndex] );
|
||||
}
|
||||
|
||||
void CL_LegacyPrecacheModel( sizebuf_t *msg )
|
||||
static void CL_LegacyPrecacheModel( sizebuf_t *msg )
|
||||
{
|
||||
int modelIndex;
|
||||
string model;
|
||||
@@ -214,7 +214,7 @@ void CL_LegacyPrecacheModel( sizebuf_t *msg )
|
||||
cl.nummodels = Q_max( cl.nummodels, modelIndex );
|
||||
}
|
||||
|
||||
void CL_LegacyPrecacheEvent( sizebuf_t *msg )
|
||||
static void CL_LegacyPrecacheEvent( sizebuf_t *msg )
|
||||
{
|
||||
int eventIndex;
|
||||
|
||||
@@ -242,7 +242,7 @@ CL_ParseResourceList
|
||||
|
||||
==============
|
||||
*/
|
||||
void CL_LegacyParseResourceList( sizebuf_t *msg )
|
||||
static void CL_LegacyParseResourceList( sizebuf_t *msg )
|
||||
{
|
||||
int i = 0;
|
||||
static struct
|
||||
@@ -443,13 +443,17 @@ void CL_ParseLegacyServerMessage( sizebuf_t *msg, qboolean normal_message )
|
||||
break;
|
||||
case svc_stufftext:
|
||||
s = MSG_ReadString( msg );
|
||||
if( cl_trace_stufftext.value )
|
||||
{
|
||||
size_t len = Q_strlen( s );
|
||||
Con_Printf( "Stufftext: %s%c", s, len && s[len-1] == '\n' ? '\0' : '\n' );
|
||||
}
|
||||
|
||||
#ifdef HACKS_RELATED_HLMODS
|
||||
// disable Cry Of Fear antisave protection
|
||||
if( !Q_strnicmp( s, "disconnect", 10 ) && cls.signon != SIGNONS )
|
||||
break; // too early
|
||||
#endif
|
||||
|
||||
Con_Reportf( "Stufftext: %s", s );
|
||||
Cbuf_AddFilteredText( s );
|
||||
break;
|
||||
case svc_setangle:
|
||||
|
||||
@@ -54,31 +54,6 @@ void GAME_EXPORT CL_PopPMStates( void )
|
||||
clgame.pushed = false;
|
||||
}
|
||||
|
||||
/*
|
||||
=============
|
||||
CL_PushTraceBounds
|
||||
|
||||
=============
|
||||
*/
|
||||
void GAME_EXPORT CL_PushTraceBounds( int hullnum, const float *mins, const float *maxs )
|
||||
{
|
||||
hullnum = bound( 0, hullnum, 3 );
|
||||
VectorCopy( mins, clgame.pmove->player_mins[hullnum] );
|
||||
VectorCopy( maxs, clgame.pmove->player_maxs[hullnum] );
|
||||
}
|
||||
|
||||
/*
|
||||
=============
|
||||
CL_PopTraceBounds
|
||||
|
||||
=============
|
||||
*/
|
||||
void GAME_EXPORT CL_PopTraceBounds( void )
|
||||
{
|
||||
memcpy( clgame.pmove->player_mins, host.player_mins, sizeof( host.player_mins ));
|
||||
memcpy( clgame.pmove->player_maxs, host.player_maxs, sizeof( host.player_maxs ));
|
||||
}
|
||||
|
||||
/*
|
||||
===============
|
||||
CL_IsPredicted
|
||||
@@ -417,7 +392,7 @@ CL_AddLinksToPmove
|
||||
collect solid entities
|
||||
====================
|
||||
*/
|
||||
void CL_AddLinksToPmove( frame_t *frame )
|
||||
static void CL_AddLinksToPmove( frame_t *frame )
|
||||
{
|
||||
entity_state_t *state;
|
||||
model_t *model;
|
||||
@@ -687,11 +662,6 @@ cl_entity_t *CL_GetWaterEntity( const float *rgflPos )
|
||||
return CL_GetEntityByIndex( entnum );
|
||||
}
|
||||
|
||||
int GAME_EXPORT CL_TestLine( const vec3_t start, const vec3_t end, int flags )
|
||||
{
|
||||
return PM_TestLineExt( clgame.pmove, clgame.pmove->physents, clgame.pmove->numphysent, start, end, flags );
|
||||
}
|
||||
|
||||
static int GAME_EXPORT pfnTestPlayerPosition( float *pos, pmtrace_t *ptrace )
|
||||
{
|
||||
return PM_TestPlayerPosition( clgame.pmove, pos, ptrace, NULL );
|
||||
@@ -825,25 +795,14 @@ static void CL_SetupPMove( playermove_t *pmove, const local_state_t *from, const
|
||||
|
||||
pmove->player_index = ps->number - 1;
|
||||
|
||||
// a1ba: workaround bug on old protocol where the server refuse to send
|
||||
// our local player in delta. cl.playernum, in theory, must be equal
|
||||
// to our local player index anyway
|
||||
// a1ba: workaround bug where the server refuse to send our local player in delta
|
||||
// cl.playernum, in theory, must be equal to our local player index anyway
|
||||
//
|
||||
// this might not be a real solution, since everything else will be bogus
|
||||
// but we need to properly run prediction and avoid potential memory
|
||||
// corruption
|
||||
// either debug this, or remove when old protocol will be dropped!!!
|
||||
if( pmove->player_index < 0 )
|
||||
{
|
||||
if( cls.legacymode )
|
||||
{
|
||||
pmove->player_index = bound( 0, cl.playernum, cl.maxclients - 1 );
|
||||
}
|
||||
else
|
||||
{
|
||||
// if this happens, record a demo and send it to a1ba
|
||||
Host_Error( "%s: ps->number == %d\n", __func__, ps->number );
|
||||
}
|
||||
}
|
||||
pmove->player_index = bound( 0, cl.playernum, cl.maxclients - 1 );
|
||||
|
||||
pmove->multiplayer = (cl.maxclients > 1);
|
||||
pmove->runfuncs = runfuncs;
|
||||
@@ -897,7 +856,7 @@ static void CL_SetupPMove( playermove_t *pmove, const local_state_t *from, const
|
||||
Q_strncpy( pmove->physinfo, cls.physinfo, MAX_INFO_STRING );
|
||||
}
|
||||
|
||||
const void CL_FinishPMove( const playermove_t *pmove, local_state_t *to )
|
||||
static const void CL_FinishPMove( const playermove_t *pmove, local_state_t *to )
|
||||
{
|
||||
entity_state_t *ps;
|
||||
clientdata_t *cd;
|
||||
@@ -950,7 +909,7 @@ CL_RunUsercmd
|
||||
Runs prediction code for user cmd
|
||||
=================
|
||||
*/
|
||||
void CL_RunUsercmd( local_state_t *from, local_state_t *to, usercmd_t *u, qboolean runfuncs, double *time, unsigned int random_seed )
|
||||
static void CL_RunUsercmd( local_state_t *from, local_state_t *to, usercmd_t *u, qboolean runfuncs, double *time, unsigned int random_seed )
|
||||
{
|
||||
usercmd_t cmd;
|
||||
|
||||
|
||||
@@ -414,7 +414,7 @@ If an entities model or origin changes from frame to frame, it must be
|
||||
relinked. Other attributes can change without relinking.
|
||||
==================
|
||||
*/
|
||||
void CL_ParseQuakeEntityData( sizebuf_t *msg, int bits )
|
||||
static void CL_ParseQuakeEntityData( sizebuf_t *msg, int bits )
|
||||
{
|
||||
int i, newnum, pack;
|
||||
qboolean forcelink;
|
||||
@@ -565,7 +565,7 @@ CL_ParseQuakeParticles
|
||||
|
||||
==================
|
||||
*/
|
||||
void CL_ParseQuakeParticle( sizebuf_t *msg )
|
||||
static void CL_ParseQuakeParticle( sizebuf_t *msg )
|
||||
{
|
||||
int count, color;
|
||||
vec3_t org, dir;
|
||||
@@ -587,7 +587,7 @@ CL_ParseQuakeStaticSound
|
||||
|
||||
===================
|
||||
*/
|
||||
void CL_ParseQuakeStaticSound( sizebuf_t *msg )
|
||||
static void CL_ParseQuakeStaticSound( sizebuf_t *msg )
|
||||
{
|
||||
int sound_num;
|
||||
float vol, attn;
|
||||
@@ -816,7 +816,7 @@ CL_QuakeStuffText
|
||||
|
||||
==================
|
||||
*/
|
||||
void CL_QuakeStuffText( const char *text )
|
||||
static void CL_QuakeStuffText( const char *text )
|
||||
{
|
||||
Q_strncat( cmd_buf, text, sizeof( cmd_buf ));
|
||||
|
||||
@@ -831,7 +831,7 @@ CL_QuakeExecStuff
|
||||
|
||||
==================
|
||||
*/
|
||||
void CL_QuakeExecStuff( void )
|
||||
static void CL_QuakeExecStuff( void )
|
||||
{
|
||||
char *text = cmd_buf;
|
||||
char token[256];
|
||||
|
||||
@@ -126,7 +126,7 @@ CL_GenericHandle
|
||||
|
||||
=============
|
||||
*/
|
||||
const char *CL_GenericHandle( int fileindex )
|
||||
static const char *CL_GenericHandle( int fileindex )
|
||||
{
|
||||
if( fileindex < 0 || fileindex >= MAX_CUSTOM )
|
||||
return 0;
|
||||
|
||||
@@ -252,7 +252,7 @@ VID_WriteOverviewScript
|
||||
Create overview script file
|
||||
===============
|
||||
*/
|
||||
void VID_WriteOverviewScript( void )
|
||||
static void VID_WriteOverviewScript( void )
|
||||
{
|
||||
ref_overview_t *ov = &clgame.overView;
|
||||
string filename;
|
||||
@@ -288,6 +288,9 @@ void SCR_MakeScreenShot( void )
|
||||
qboolean iRet = false;
|
||||
int viewsize;
|
||||
|
||||
if( cls.scrshot_action == scrshot_inactive )
|
||||
return;
|
||||
|
||||
if( cls.envshot_viewsize > 0 )
|
||||
viewsize = cls.envshot_viewsize;
|
||||
else viewsize = cl_envshot_size.value;
|
||||
@@ -319,8 +322,6 @@ void SCR_MakeScreenShot( void )
|
||||
if( iRet )
|
||||
VID_WriteOverviewScript(); // store overview script too
|
||||
break;
|
||||
case scrshot_inactive:
|
||||
return;
|
||||
}
|
||||
|
||||
// report
|
||||
@@ -344,7 +345,7 @@ void SCR_MakeScreenShot( void )
|
||||
SCR_DrawPlaque
|
||||
================
|
||||
*/
|
||||
void SCR_DrawPlaque( void )
|
||||
static void SCR_DrawPlaque( void )
|
||||
{
|
||||
if(( cl_allow_levelshots.value && !cls.changelevel ) || cl.background )
|
||||
{
|
||||
@@ -415,7 +416,7 @@ void SCR_EndLoadingPlaque( void )
|
||||
SCR_AddDirtyPoint
|
||||
=================
|
||||
*/
|
||||
void SCR_AddDirtyPoint( int x, int y )
|
||||
static void SCR_AddDirtyPoint( int x, int y )
|
||||
{
|
||||
if( x < scr_dirty.x1 ) scr_dirty.x1 = x;
|
||||
if( x > scr_dirty.x2 ) scr_dirty.x2 = x;
|
||||
@@ -572,15 +573,15 @@ void SCR_LoadCreditsFont( void )
|
||||
"creditsfont_%s.fnt", Cvar_VariableString( "con_charset" )) > 0 )
|
||||
{
|
||||
if( FS_FileExists( charsetFnt, false ))
|
||||
success = Con_LoadVariableWidthFont( charsetFnt, font, scale, kRenderTransAdd, TF_FONT );
|
||||
success = Con_LoadVariableWidthFont( charsetFnt, font, scale, &hud_fontrender, TF_FONT );
|
||||
}
|
||||
}
|
||||
|
||||
if( !success )
|
||||
success = Con_LoadVariableWidthFont( "gfx/creditsfont.fnt", font, scale, kRenderTransAdd, TF_FONT );
|
||||
success = Con_LoadVariableWidthFont( "gfx/creditsfont.fnt", font, scale, &hud_fontrender, TF_FONT );
|
||||
|
||||
if( !success )
|
||||
success = Con_LoadFixedWidthFont( "gfx/conchars", font, scale, kRenderTransAdd, TF_FONT );
|
||||
success = Con_LoadFixedWidthFont( "gfx/conchars", font, scale, &hud_fontrender, TF_FONT );
|
||||
|
||||
// copy font size for client.dll
|
||||
if( success )
|
||||
@@ -602,7 +603,7 @@ SCR_InstallParticlePalette
|
||||
INTERNAL RESOURCE
|
||||
================
|
||||
*/
|
||||
void SCR_InstallParticlePalette( void )
|
||||
static void SCR_InstallParticlePalette( void )
|
||||
{
|
||||
rgbdata_t *pic;
|
||||
int i;
|
||||
@@ -648,21 +649,21 @@ void SCR_RegisterTextures( void )
|
||||
// register gfx.wad images
|
||||
|
||||
if( FS_FileExists( "gfx/paused.lmp", false ))
|
||||
cls.pauseIcon = ref.dllFuncs.GL_LoadTexture( "gfx/paused.lmp", NULL, 0, TF_IMAGE );
|
||||
cls.pauseIcon = ref.dllFuncs.GL_LoadTexture( "gfx/paused.lmp", NULL, 0, TF_IMAGE|TF_ALLOW_NEAREST );
|
||||
else if( FS_FileExists( "gfx/pause.lmp", false ))
|
||||
cls.pauseIcon = ref.dllFuncs.GL_LoadTexture( "gfx/pause.lmp", NULL, 0, TF_IMAGE );
|
||||
cls.pauseIcon = ref.dllFuncs.GL_LoadTexture( "gfx/pause.lmp", NULL, 0, TF_IMAGE|TF_ALLOW_NEAREST );
|
||||
|
||||
if( FS_FileExists( "gfx/lambda.lmp", false ))
|
||||
{
|
||||
if( cl_allow_levelshots.value )
|
||||
cls.loadingBar = ref.dllFuncs.GL_LoadTexture( "gfx/lambda.lmp", NULL, 0, TF_IMAGE|TF_LUMINANCE );
|
||||
else cls.loadingBar = ref.dllFuncs.GL_LoadTexture( "gfx/lambda.lmp", NULL, 0, TF_IMAGE );
|
||||
cls.loadingBar = ref.dllFuncs.GL_LoadTexture( "gfx/lambda.lmp", NULL, 0, TF_IMAGE|TF_LUMINANCE|TF_ALLOW_NEAREST );
|
||||
else cls.loadingBar = ref.dllFuncs.GL_LoadTexture( "gfx/lambda.lmp", NULL, 0, TF_IMAGE|TF_ALLOW_NEAREST );
|
||||
}
|
||||
else if( FS_FileExists( "gfx/loading.lmp", false ))
|
||||
{
|
||||
if( cl_allow_levelshots.value )
|
||||
cls.loadingBar = ref.dllFuncs.GL_LoadTexture( "gfx/loading.lmp", NULL, 0, TF_IMAGE|TF_LUMINANCE );
|
||||
else cls.loadingBar = ref.dllFuncs.GL_LoadTexture( "gfx/loading.lmp", NULL, 0, TF_IMAGE );
|
||||
cls.loadingBar = ref.dllFuncs.GL_LoadTexture( "gfx/loading.lmp", NULL, 0, TF_IMAGE|TF_LUMINANCE|TF_ALLOW_NEAREST );
|
||||
else cls.loadingBar = ref.dllFuncs.GL_LoadTexture( "gfx/loading.lmp", NULL, 0, TF_IMAGE|TF_ALLOW_NEAREST );
|
||||
}
|
||||
|
||||
cls.tileImage = ref.dllFuncs.GL_LoadTexture( "gfx/backtile.lmp", NULL, 0, TF_NOMIPMAP );
|
||||
@@ -675,7 +676,7 @@ SCR_SizeUp_f
|
||||
Keybinding command
|
||||
=================
|
||||
*/
|
||||
void SCR_SizeUp_f( void )
|
||||
static void SCR_SizeUp_f( void )
|
||||
{
|
||||
Cvar_SetValue( "viewsize", Q_min( scr_viewsize.value + 10, 120 ));
|
||||
}
|
||||
@@ -688,7 +689,7 @@ SCR_SizeDown_f
|
||||
Keybinding command
|
||||
=================
|
||||
*/
|
||||
void SCR_SizeDown_f( void )
|
||||
static void SCR_SizeDown_f( void )
|
||||
{
|
||||
Cvar_SetValue( "viewsize", Q_max( scr_viewsize.value - 10, 30 ));
|
||||
}
|
||||
|
||||
@@ -57,35 +57,7 @@ const char *cl_default_sprites[] =
|
||||
"sprites/shellchrome.spr",
|
||||
};
|
||||
|
||||
const char *cl_player_shell_sounds[] =
|
||||
{
|
||||
"player/pl_shell1.wav",
|
||||
"player/pl_shell2.wav",
|
||||
"player/pl_shell3.wav",
|
||||
};
|
||||
|
||||
const char *cl_weapon_shell_sounds[] =
|
||||
{
|
||||
"weapons/sshell1.wav",
|
||||
"weapons/sshell2.wav",
|
||||
"weapons/sshell3.wav",
|
||||
};
|
||||
|
||||
const char *cl_ricochet_sounds[] =
|
||||
{
|
||||
"weapons/ric1.wav",
|
||||
"weapons/ric2.wav",
|
||||
"weapons/ric3.wav",
|
||||
"weapons/ric4.wav",
|
||||
"weapons/ric5.wav",
|
||||
};
|
||||
|
||||
const char *cl_explode_sounds[] =
|
||||
{
|
||||
"weapons/explode3.wav",
|
||||
"weapons/explode4.wav",
|
||||
"weapons/explode5.wav",
|
||||
};
|
||||
static void CL_PlayerDecal( int playerIndex, int textureIndex, int entityIndex, float *pos );
|
||||
|
||||
/*
|
||||
================
|
||||
@@ -146,6 +118,7 @@ client resources not precached by server
|
||||
*/
|
||||
void CL_AddClientResources( void )
|
||||
{
|
||||
const char *snd;
|
||||
char filepath[MAX_QPATH];
|
||||
int i;
|
||||
|
||||
@@ -161,37 +134,37 @@ void CL_AddClientResources( void )
|
||||
}
|
||||
|
||||
// then check sounds
|
||||
for( i = 0; i < ARRAYSIZE( cl_player_shell_sounds ); i++ )
|
||||
for( i = 0; ( snd = SoundList_Get( BouncePlayerShell, i )); i++ )
|
||||
{
|
||||
Q_snprintf( filepath, sizeof( filepath ), DEFAULT_SOUNDPATH "%s", cl_player_shell_sounds[i] );
|
||||
Q_snprintf( filepath, sizeof( filepath ), DEFAULT_SOUNDPATH "%s", snd );
|
||||
|
||||
if( !FS_FileExists( filepath, false ))
|
||||
CL_AddClientResource( cl_player_shell_sounds[i], t_sound );
|
||||
CL_AddClientResource( snd, t_sound );
|
||||
}
|
||||
|
||||
for( i = 0; i < ARRAYSIZE( cl_weapon_shell_sounds ); i++ )
|
||||
for( i = 0; ( snd = SoundList_Get( BounceWeaponShell, i )); i++ )
|
||||
{
|
||||
Q_snprintf( filepath, sizeof( filepath ), DEFAULT_SOUNDPATH "%s", cl_weapon_shell_sounds[i] );
|
||||
Q_snprintf( filepath, sizeof( filepath ), DEFAULT_SOUNDPATH "%s", snd );
|
||||
|
||||
if( !FS_FileExists( filepath, false ))
|
||||
CL_AddClientResource( cl_weapon_shell_sounds[i], t_sound );
|
||||
CL_AddClientResource( snd, t_sound );
|
||||
}
|
||||
|
||||
for( i = 0; i < ARRAYSIZE( cl_explode_sounds ); i++ )
|
||||
for( i = 0; ( snd = SoundList_Get( Explode, i )); i++ )
|
||||
{
|
||||
Q_snprintf( filepath, sizeof( filepath ), DEFAULT_SOUNDPATH "%s", cl_explode_sounds[i] );
|
||||
Q_snprintf( filepath, sizeof( filepath ), DEFAULT_SOUNDPATH "%s", snd );
|
||||
|
||||
if( !FS_FileExists( filepath, false ))
|
||||
CL_AddClientResource( cl_explode_sounds[i], t_sound );
|
||||
CL_AddClientResource( snd, t_sound );
|
||||
}
|
||||
|
||||
#if 0 // ric sounds was precached by server-side
|
||||
for( i = 0; i < ARRAYSIZE( cl_ricochet_sounds ); i++ )
|
||||
for( i = 0; ( snd = SoundList_Get( Ricochet, i )); i++ )
|
||||
{
|
||||
Q_snprintf( filepath, sizeof( filepath ), DEFAULT_SOUNDPATH "%s", cl_ricochet_sounds[i] );
|
||||
Q_snprintf( filepath, sizeof( filepath ), DEFAULT_SOUNDPATH "%s", snd );
|
||||
|
||||
if( !FS_FileExists( filepath, false ))
|
||||
CL_AddClientResource( cl_ricochet_sounds[i], t_sound );
|
||||
CL_AddClientResource( snd, t_sound );
|
||||
}
|
||||
#endif
|
||||
}
|
||||
@@ -255,7 +228,7 @@ CL_PrepareTEnt
|
||||
set default values
|
||||
==============
|
||||
*/
|
||||
void CL_PrepareTEnt( TEMPENTITY *pTemp, model_t *pmodel )
|
||||
static void CL_PrepareTEnt( TEMPENTITY *pTemp, model_t *pmodel )
|
||||
{
|
||||
int frameCount = 0;
|
||||
int modelIndex = 0;
|
||||
@@ -296,10 +269,10 @@ CL_TempEntPlaySound
|
||||
play collide sound
|
||||
==============
|
||||
*/
|
||||
void CL_TempEntPlaySound( TEMPENTITY *pTemp, float damp )
|
||||
static void CL_TempEntPlaySound( TEMPENTITY *pTemp, float damp )
|
||||
{
|
||||
float fvol;
|
||||
char soundname[32];
|
||||
const char *soundname = NULL;
|
||||
qboolean isshellcasing = false;
|
||||
int zvel;
|
||||
|
||||
@@ -310,36 +283,39 @@ void CL_TempEntPlaySound( TEMPENTITY *pTemp, float damp )
|
||||
switch( pTemp->hitSound )
|
||||
{
|
||||
case BOUNCE_GLASS:
|
||||
Q_snprintf( soundname, sizeof( soundname ), "debris/glass%i.wav", COM_RandomLong( 1, 4 ));
|
||||
soundname = SoundList_GetRandom( BounceGlass );
|
||||
break;
|
||||
case BOUNCE_METAL:
|
||||
Q_snprintf( soundname, sizeof( soundname ), "debris/metal%i.wav", COM_RandomLong( 1, 6 ));
|
||||
soundname = SoundList_GetRandom( BounceMetal );
|
||||
break;
|
||||
case BOUNCE_FLESH:
|
||||
Q_snprintf( soundname, sizeof( soundname ), "debris/flesh%i.wav", COM_RandomLong( 1, 7 ));
|
||||
soundname = SoundList_GetRandom( BounceFlesh );
|
||||
break;
|
||||
case BOUNCE_WOOD:
|
||||
Q_snprintf( soundname, sizeof( soundname ), "debris/wood%i.wav", COM_RandomLong( 1, 4 ));
|
||||
soundname = SoundList_GetRandom( BounceWood );
|
||||
break;
|
||||
case BOUNCE_SHRAP:
|
||||
Q_strncpy( soundname, cl_ricochet_sounds[COM_RandomLong( 0, 4 )], sizeof( soundname ) );
|
||||
soundname = SoundList_GetRandom( Ricochet );
|
||||
break;
|
||||
case BOUNCE_SHOTSHELL:
|
||||
Q_strncpy( soundname, cl_weapon_shell_sounds[COM_RandomLong( 0, 2 )], sizeof( soundname ) );
|
||||
soundname = SoundList_GetRandom( BounceWeaponShell );
|
||||
isshellcasing = true; // shell casings have different playback parameters
|
||||
fvol = 0.5f;
|
||||
break;
|
||||
case BOUNCE_SHELL:
|
||||
Q_strncpy( soundname, cl_player_shell_sounds[COM_RandomLong( 0, 2 )], sizeof( soundname ) );
|
||||
soundname = SoundList_GetRandom( BouncePlayerShell );
|
||||
isshellcasing = true; // shell casings have different playback parameters
|
||||
break;
|
||||
case BOUNCE_CONCRETE:
|
||||
Q_snprintf( soundname, sizeof( soundname ), "debris/concrete%i.wav", COM_RandomLong( 1, 3 ));
|
||||
soundname = SoundList_GetRandom( BounceConcrete );
|
||||
break;
|
||||
default: // null sound
|
||||
return;
|
||||
}
|
||||
|
||||
if( !soundname )
|
||||
return;
|
||||
|
||||
zvel = abs( pTemp->entity.baseline.origin[2] );
|
||||
|
||||
// only play one out of every n
|
||||
@@ -380,7 +356,7 @@ CL_TEntAddEntity
|
||||
add entity to renderlist
|
||||
==============
|
||||
*/
|
||||
int CL_TempEntAddEntity( cl_entity_t *pEntity )
|
||||
static int CL_TempEntAddEntity( cl_entity_t *pEntity )
|
||||
{
|
||||
vec3_t mins, maxs;
|
||||
|
||||
@@ -432,7 +408,7 @@ CL_TEntAddEntity
|
||||
free the first low priority tempent it finds.
|
||||
==============
|
||||
*/
|
||||
qboolean CL_FreeLowPriorityTempEnt( void )
|
||||
static qboolean CL_FreeLowPriorityTempEnt( void )
|
||||
{
|
||||
TEMPENTITY *pActive = cl_active_tents;
|
||||
TEMPENTITY *pPrev = NULL;
|
||||
@@ -1489,7 +1465,7 @@ void GAME_EXPORT R_FunnelSprite( const vec3_t org, int modelIndex, int reverse )
|
||||
===============
|
||||
R_SparkEffect
|
||||
|
||||
Create a streaks + richochet sprite
|
||||
Create a streaks + ricochet sprite
|
||||
===============
|
||||
*/
|
||||
void GAME_EXPORT R_SparkEffect( const vec3_t pos, int count, int velocityMin, int velocityMax )
|
||||
@@ -1505,18 +1481,25 @@ R_RicochetSound
|
||||
Make a random ricochet sound
|
||||
==============
|
||||
*/
|
||||
static void R_RicochetSound_( const vec3_t pos, int sound )
|
||||
static void R_RicochetSoundByName( const vec3_t pos, const char *name )
|
||||
{
|
||||
sound_t handle;
|
||||
|
||||
handle = S_RegisterSound( cl_ricochet_sounds[sound] );
|
||||
|
||||
sound_t handle;
|
||||
handle = S_RegisterSound( name );
|
||||
S_StartSound( pos, 0, CHAN_AUTO, handle, VOL_NORM, 1.0, 100, 0 );
|
||||
}
|
||||
|
||||
static void R_RicochetSoundByIndex( const vec3_t pos, int idx )
|
||||
{
|
||||
const char *name = SoundList_Get( Ricochet, idx );
|
||||
if( name )
|
||||
R_RicochetSoundByName( pos, name );
|
||||
}
|
||||
|
||||
void GAME_EXPORT R_RicochetSound( const vec3_t pos )
|
||||
{
|
||||
R_RicochetSound_( pos, COM_RandomLong( 0, 4 ));
|
||||
const char *name = SoundList_GetRandom( Ricochet );
|
||||
if( name )
|
||||
R_RicochetSoundByName( pos, name );
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -1663,8 +1646,12 @@ void GAME_EXPORT R_Explosion( vec3_t pos, int model, float scale, float framerat
|
||||
|
||||
if( !FBitSet( flags, TE_EXPLFLAG_NOSOUND ))
|
||||
{
|
||||
hSound = S_RegisterSound( cl_explode_sounds[COM_RandomLong( 0, 2 )] );
|
||||
S_StartSound( pos, 0, CHAN_STATIC, hSound, VOL_NORM, 0.3f, PITCH_NORM, 0 );
|
||||
const char *name = SoundList_GetRandom( Explode );
|
||||
if( name )
|
||||
{
|
||||
hSound = S_RegisterSound( name );
|
||||
S_StartSound( pos, 0, CHAN_STATIC, hSound, VOL_NORM, 0.3f, PITCH_NORM, 0 );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1907,6 +1894,7 @@ void CL_ParseTempEntity( sizebuf_t *msg )
|
||||
cl_entity_t *pEnt;
|
||||
dlight_t *dl;
|
||||
sound_t hSound;
|
||||
const char *name;
|
||||
|
||||
if( cls.legacymode )
|
||||
iSize = MSG_ReadByte( msg );
|
||||
@@ -1966,8 +1954,11 @@ void CL_ParseTempEntity( sizebuf_t *msg )
|
||||
pos[2] = MSG_ReadCoord( &buf );
|
||||
R_BlobExplosion( pos );
|
||||
|
||||
hSound = S_RegisterSound( cl_explode_sounds[0] );
|
||||
S_StartSound( pos, -1, CHAN_AUTO, hSound, VOL_NORM, 1.0f, PITCH_NORM, 0 );
|
||||
if(( name = SoundList_Get( Explode, 0 )))
|
||||
{
|
||||
hSound = S_RegisterSound( name );
|
||||
S_StartSound( pos, -1, CHAN_AUTO, hSound, VOL_NORM, 1.0f, PITCH_NORM, 0 );
|
||||
}
|
||||
break;
|
||||
case TE_SMOKE:
|
||||
pos[0] = MSG_ReadCoord( &buf );
|
||||
@@ -2020,8 +2011,11 @@ void CL_ParseTempEntity( sizebuf_t *msg )
|
||||
dl->die = cl.time + 0.5;
|
||||
dl->decay = 300;
|
||||
|
||||
hSound = S_RegisterSound( cl_explode_sounds[0] );
|
||||
S_StartSound( pos, -1, CHAN_AUTO, hSound, VOL_NORM, 0.6f, PITCH_NORM, 0 );
|
||||
if(( name = SoundList_Get( Explode, 0 )))
|
||||
{
|
||||
hSound = S_RegisterSound( name );
|
||||
S_StartSound( pos, -1, CHAN_AUTO, hSound, VOL_NORM, 1.0f, PITCH_NORM, 0 );
|
||||
}
|
||||
break;
|
||||
case TE_BSPDECAL:
|
||||
case TE_DECAL:
|
||||
@@ -2249,8 +2243,8 @@ void CL_ParseTempEntity( sizebuf_t *msg )
|
||||
CL_DecalShoot( CL_DecalIndex( decalIndex ), entityIndex, 0, pos, 0 );
|
||||
R_BulletImpactParticles( pos );
|
||||
flags = COM_RandomLong( 0, 0x7fff );
|
||||
if( flags < 0x3fff )
|
||||
R_RicochetSound_( pos, flags % 5 );
|
||||
if( flags < 0x3fff && ( count = SoundList_Count( Ricochet )))
|
||||
R_RicochetSoundByIndex( pos, flags % count );
|
||||
break;
|
||||
case TE_SPRAY:
|
||||
case TE_SPRITE_SPRAY:
|
||||
@@ -2414,7 +2408,7 @@ LIGHT STYLE MANAGEMENT
|
||||
CL_ClearLightStyles
|
||||
================
|
||||
*/
|
||||
void CL_ClearLightStyles( void )
|
||||
static void CL_ClearLightStyles( void )
|
||||
{
|
||||
memset( cl.lightstyles, 0, sizeof( cl.lightstyles ));
|
||||
}
|
||||
@@ -2472,7 +2466,7 @@ dlight_t cl_elights[MAX_ELIGHTS];
|
||||
CL_ClearDlights
|
||||
================
|
||||
*/
|
||||
void CL_ClearDlights( void )
|
||||
static void CL_ClearDlights( void )
|
||||
{
|
||||
memset( cl_dlights, 0, sizeof( cl_dlights ));
|
||||
memset( cl_elights, 0, sizeof( cl_elights ));
|
||||
@@ -2919,7 +2913,7 @@ CL_PlayerDecal
|
||||
spray custom colored decal (clan logo etc)
|
||||
===============
|
||||
*/
|
||||
void CL_PlayerDecal( int playernum, int customIndex, int entityIndex, float *pos )
|
||||
static void CL_PlayerDecal( int playernum, int customIndex, int entityIndex, float *pos )
|
||||
{
|
||||
int textureIndex = 0;
|
||||
customization_t *pCust = NULL;
|
||||
|
||||
@@ -68,7 +68,7 @@ qboolean SCR_NextMovie( void )
|
||||
return true;
|
||||
}
|
||||
|
||||
void SCR_CreateStartupVids( void )
|
||||
static void SCR_CreateStartupVids( void )
|
||||
{
|
||||
file_t *f;
|
||||
|
||||
|
||||
@@ -29,7 +29,7 @@ V_CalcViewRect
|
||||
calc frame rectangle (Quake1 style)
|
||||
===============
|
||||
*/
|
||||
void V_CalcViewRect( void )
|
||||
static void V_CalcViewRect( void )
|
||||
{
|
||||
qboolean full = false;
|
||||
int sb_lines;
|
||||
@@ -88,7 +88,7 @@ void V_CalcViewRect( void )
|
||||
V_SetupViewModel
|
||||
===============
|
||||
*/
|
||||
void V_SetupViewModel( void )
|
||||
static void V_SetupViewModel( void )
|
||||
{
|
||||
cl_entity_t *view = &clgame.viewent;
|
||||
player_info_t *info = &cl.players[cl.playernum];
|
||||
@@ -118,7 +118,7 @@ void V_SetupViewModel( void )
|
||||
V_SetRefParams
|
||||
===============
|
||||
*/
|
||||
void V_SetRefParams( ref_params_t *fd )
|
||||
static void V_SetRefParams( ref_params_t *fd )
|
||||
{
|
||||
memset( fd, 0, sizeof( ref_params_t ));
|
||||
|
||||
@@ -182,7 +182,7 @@ V_MergeOverviewRefdef
|
||||
merge refdef with overview settings
|
||||
===============
|
||||
*/
|
||||
void V_RefApplyOverview( ref_viewpass_t *rvp )
|
||||
static void V_RefApplyOverview( ref_viewpass_t *rvp )
|
||||
{
|
||||
ref_overview_t *ov = &clgame.overView;
|
||||
float aspect;
|
||||
@@ -281,7 +281,7 @@ static void V_AdjustFov( float *fov_x, float *fov_y, float width, float height,
|
||||
V_GetRefParams
|
||||
=============
|
||||
*/
|
||||
void V_GetRefParams( ref_params_t *fd, ref_viewpass_t *rvp )
|
||||
static void V_GetRefParams( ref_params_t *fd, ref_viewpass_t *rvp )
|
||||
{
|
||||
// part1: deniable updates
|
||||
VectorCopy( fd->simvel, cl.simvel );
|
||||
@@ -408,14 +408,14 @@ void V_RenderView( void )
|
||||
#define NODE_INTERVAL_X(x) (x * 16.0f)
|
||||
#define NODE_INTERVAL_Y(x) (x * 16.0f)
|
||||
|
||||
void R_DrawLeafNode( float x, float y, float scale )
|
||||
static void R_DrawLeafNode( float x, float y, float scale )
|
||||
{
|
||||
float downScale = scale * 0.25f;// * POINT_SIZE;
|
||||
|
||||
ref.dllFuncs.R_DrawStretchPic( x - downScale * 0.5f, y - downScale * 0.5f, downScale, downScale, 0, 0, 1, 1, R_GetBuiltinTexture( REF_PARTICLE_TEXTURE ) );
|
||||
}
|
||||
|
||||
void R_DrawNodeConnection( float x, float y, float x2, float y2 )
|
||||
static void R_DrawNodeConnection( float x, float y, float x2, float y2 )
|
||||
{
|
||||
ref.dllFuncs.Begin( TRI_LINES );
|
||||
ref.dllFuncs.Vertex3f( x, y, 0 );
|
||||
@@ -423,7 +423,7 @@ void R_DrawNodeConnection( float x, float y, float x2, float y2 )
|
||||
ref.dllFuncs.End( );
|
||||
}
|
||||
|
||||
void R_ShowTree_r( mnode_t *node, float x, float y, float scale, int shownodes, mleaf_t *viewleaf )
|
||||
static void R_ShowTree_r( mnode_t *node, float x, float y, float scale, int shownodes, mleaf_t *viewleaf )
|
||||
{
|
||||
float downScale = scale * 0.8f;
|
||||
|
||||
@@ -470,7 +470,7 @@ void R_ShowTree_r( mnode_t *node, float x, float y, float scale, int shownodes,
|
||||
world.recursion_level--;
|
||||
}
|
||||
|
||||
void R_ShowTree( void )
|
||||
static void R_ShowTree( void )
|
||||
{
|
||||
float x = (float)((refState.width - (int)POINT_SIZE) >> 1);
|
||||
float y = NODE_INTERVAL_Y(1.0f);
|
||||
@@ -553,4 +553,6 @@ void V_PostRender( void )
|
||||
ref.dllFuncs.R_AllowFog( true );
|
||||
Platform_SetTimer( 0.0f );
|
||||
ref.dllFuncs.R_EndFrame();
|
||||
|
||||
V_CheckGammaEnd();
|
||||
}
|
||||
|
||||
@@ -342,8 +342,7 @@ typedef struct
|
||||
byte charWidths[256]; // scaled widths
|
||||
int charHeight; // scaled height
|
||||
int type; // fixed width font or variable
|
||||
int rendermode; // default rendermode
|
||||
qboolean nearest; // nearest filtering enabled
|
||||
convar_t *rendermode; // user-defined default rendermode
|
||||
qboolean valid; // all rectangles are valid
|
||||
} cl_font_t;
|
||||
|
||||
@@ -682,11 +681,14 @@ extern convar_t cl_draw_beams;
|
||||
extern convar_t cl_clockreset;
|
||||
extern convar_t cl_fixtimerate;
|
||||
extern convar_t hud_fontscale;
|
||||
extern convar_t hud_fontrender;
|
||||
extern convar_t hud_scale;
|
||||
extern convar_t hud_scale_minimal_width;
|
||||
extern convar_t r_showtextures;
|
||||
extern convar_t cl_bmodelinterp;
|
||||
extern convar_t cl_lw; // local weapons
|
||||
extern convar_t cl_charset;
|
||||
extern convar_t cl_trace_stufftext;
|
||||
extern convar_t cl_trace_messages;
|
||||
extern convar_t cl_trace_events;
|
||||
extern convar_t hud_utf8;
|
||||
@@ -705,7 +707,6 @@ extern convar_t cl_fixmodelinterpolationartifacts;
|
||||
//=============================================================================
|
||||
|
||||
void CL_SetLightstyle( int style, const char* s, float f );
|
||||
void CL_RunLightStyles( void );
|
||||
void CL_DecayLights( void );
|
||||
dlight_t *CL_GetDynamicLight( int number );
|
||||
dlight_t *CL_GetEntityLight( int number );
|
||||
@@ -716,12 +717,8 @@ dlight_t *CL_GetEntityLight( int number );
|
||||
// cl_cmds.c
|
||||
//
|
||||
void CL_Quit_f( void );
|
||||
void CL_ScreenShot_f( void );
|
||||
void CL_SnapShot_f( void );
|
||||
void CL_GenericShot_f( void );
|
||||
void CL_PlayCDTrack_f( void );
|
||||
void CL_EnvShot_f( void );
|
||||
void CL_SkyShot_f( void );
|
||||
void CL_SaveShot_f( void );
|
||||
void CL_LevelShot_f( void );
|
||||
void CL_SetSky_f( void );
|
||||
void SCR_Viewpos_f( void );
|
||||
@@ -742,8 +739,6 @@ void CL_ClearResourceLists( void );
|
||||
void CL_Parse_Debug( qboolean enable );
|
||||
void CL_Parse_RecordCommand( int cmd, int startoffset );
|
||||
void CL_ResetFrame( frame_t *frame );
|
||||
void CL_WriteMessageHistory( void );
|
||||
const char *CL_MsgInfo( int cmd );
|
||||
|
||||
//
|
||||
// cl_efx.c
|
||||
@@ -754,7 +749,6 @@ void CL_Particle( const vec3_t org, int color, float life, int zpos, int zvel );
|
||||
// cl_main.c
|
||||
//
|
||||
void CL_Init( void );
|
||||
void CL_SendCommand( void );
|
||||
void CL_Disconnect_f( void );
|
||||
void CL_ProcessFile( qboolean successfully_received, const char *filename );
|
||||
void CL_WriteUsercmd( sizebuf_t *msg, int from, int to );
|
||||
@@ -763,7 +757,6 @@ qboolean CL_PrecacheResources( void );
|
||||
void CL_SetupOverviewParams( void );
|
||||
void CL_UpdateFrameLerp( void );
|
||||
int CL_IsDevOverviewMode( void );
|
||||
void CL_PingServers_f( void );
|
||||
void CL_SignonReply( void );
|
||||
void CL_ClearState( void );
|
||||
|
||||
@@ -781,8 +774,6 @@ void CL_CheckStartupDemos( void );
|
||||
void CL_WriteDemoJumpTime( void );
|
||||
void CL_CloseDemoHeader( void );
|
||||
void CL_DemoCompleted( void );
|
||||
void CL_StopPlayback( void );
|
||||
void CL_StopRecord( void );
|
||||
void CL_PlayDemo_f( void );
|
||||
void CL_TimeDemo_f( void );
|
||||
void CL_StartDemos_f( void );
|
||||
@@ -790,6 +781,7 @@ void CL_Demos_f( void );
|
||||
void CL_DeleteDemo_f( void );
|
||||
void CL_Record_f( void );
|
||||
void CL_Stop_f( void );
|
||||
int CL_GetDemoComment( const char *demoname, char *comment );
|
||||
|
||||
//
|
||||
// cl_events.c
|
||||
@@ -797,12 +789,9 @@ void CL_Stop_f( void );
|
||||
void CL_ParseEvent( sizebuf_t *msg );
|
||||
void CL_ParseReliableEvent( sizebuf_t *msg );
|
||||
void CL_SetEventIndex( const char *szEvName, int ev_index );
|
||||
void CL_QueueEvent( int flags, int index, float delay, event_args_t *args );
|
||||
void CL_PlaybackEvent( int flags, const edict_t *pInvoker, word eventindex, float delay, float *origin,
|
||||
float *angles, float fparam1, float fparam2, int iparam1, int iparam2, int bparam1, int bparam2 );
|
||||
void CL_RegisterEvent( int lastnum, const char *szEvName, pfnEventHook func );
|
||||
void CL_BatchResourceRequest( qboolean initialize );
|
||||
int CL_EstimateNeededResources( void );
|
||||
void CL_ResetEvent( event_info_t *ei );
|
||||
word CL_EventIndex( const char *name );
|
||||
void CL_FireEvents( void );
|
||||
@@ -811,9 +800,10 @@ void CL_FireEvents( void );
|
||||
// cl_font.c
|
||||
//
|
||||
qboolean CL_FixedFont( cl_font_t *font );
|
||||
qboolean Con_LoadFixedWidthFont( const char *fontname, cl_font_t *font, float scale, int rendermode, uint texFlags );
|
||||
qboolean Con_LoadVariableWidthFont( const char *fontname, cl_font_t *font, float scale, int rendermode, uint texFlags );
|
||||
qboolean Con_LoadFixedWidthFont( const char *fontname, cl_font_t *font, float scale, convar_t *rendermode, uint texFlags );
|
||||
qboolean Con_LoadVariableWidthFont( const char *fontname, cl_font_t *font, float scale, convar_t *rendermode, uint texFlags );
|
||||
void CL_FreeFont( cl_font_t *font );
|
||||
void CL_SetFontRendermode( cl_font_t *font );
|
||||
int CL_DrawCharacter( float x, float y, int number, rgba_t color, cl_font_t *font, int flags );
|
||||
int CL_DrawString( float x, float y, const char *s, rgba_t color, cl_font_t *font, int flags );
|
||||
void CL_DrawCharacterLen( cl_font_t *font, int number, int *width, int *height );
|
||||
@@ -826,10 +816,7 @@ int CL_DrawStringf( cl_font_t *font, float x, float y, rgba_t color, int flags,
|
||||
//
|
||||
void CL_UnloadProgs( void );
|
||||
qboolean CL_LoadProgs( const char *name );
|
||||
void CL_ParseUserMessage( sizebuf_t *msg, int svc_num );
|
||||
void CL_LinkUserMessage( char *pszName, const int svc_num, int iSize );
|
||||
void CL_ParseFinaleCutscene( sizebuf_t *msg, int level );
|
||||
void CL_ParseTextMessage( sizebuf_t *msg );
|
||||
void CL_DrawHUD( int state );
|
||||
void CL_InitEdicts( int maxclients );
|
||||
void CL_FreeEdicts( void );
|
||||
@@ -846,20 +833,17 @@ model_t *CL_LoadClientSprite( const char *filename );
|
||||
model_t *CL_LoadModel( const char *modelname, int *index );
|
||||
HSPRITE pfnSPR_LoadExt( const char *szPicName, uint texFlags );
|
||||
void SPR_AdjustSize( float *x, float *y, float *w, float *h );
|
||||
void SPR_AdjustTexCoords( float width, float height, float *s1, float *t1, float *s2, float *t2 );
|
||||
int CL_GetScreenInfo( SCREENINFO *pscrinfo );
|
||||
void CL_FillRGBA( int x, int y, int width, int height, int r, int g, int b, int a );
|
||||
pmtrace_t *PM_CL_TraceLine( float *start, float *end, int flags, int usehull, int ignore_pe );
|
||||
const char *PM_CL_TraceTexture( int ground, float *vstart, float *vend );
|
||||
int PM_CL_PointContents( const float *p, int *truecontents );
|
||||
void CL_GetMousePosition( int *mx, int *my ); // TODO: move to input
|
||||
cl_entity_t* CL_GetViewModel( void );
|
||||
physent_t *pfnGetPhysent( int idx );
|
||||
struct msurface_s *pfnTraceSurface( int ground, float *vstart, float *vend );
|
||||
movevars_t *pfnGetMoveVars( void );
|
||||
void CL_EnableScissor( scissor_state_t *scissor, int x, int y, int width, int height );
|
||||
void CL_DisableScissor( scissor_state_t *scissor );
|
||||
qboolean CL_Scissor( const scissor_state_t *scissor, float *x, float *y, float *width, float *height, float *u0, float *v0, float *u1, float *v1 );
|
||||
struct cl_entity_s *CL_GetEntityByIndex( int index );
|
||||
|
||||
_inline cl_entity_t *CL_EDICT_NUM( int n )
|
||||
{
|
||||
@@ -911,6 +895,11 @@ qboolean CL_RequestMissingResources( void );
|
||||
void CL_RegisterResources ( sizebuf_t *msg );
|
||||
void CL_ParseViewEntity( sizebuf_t *msg );
|
||||
void CL_ParseServerTime( sizebuf_t *msg );
|
||||
void CL_ParseUserMessage( sizebuf_t *msg, int svc_num );
|
||||
void CL_ParseFinaleCutscene( sizebuf_t *msg, int level );
|
||||
void CL_ParseTextMessage( sizebuf_t *msg );
|
||||
void CL_BatchResourceRequest( qboolean initialize );
|
||||
int CL_EstimateNeededResources( void );
|
||||
|
||||
//
|
||||
// cl_parse_48.c
|
||||
@@ -924,8 +913,6 @@ void CL_LegacyPrecache_f( void );
|
||||
void SCR_VidInit( void );
|
||||
void SCR_TileClear( void );
|
||||
void SCR_DirtyScreen( void );
|
||||
void SCR_AddDirtyPoint( int x, int y );
|
||||
void SCR_InstallParticlePalette( void );
|
||||
void SCR_EndLoadingPlaque( void );
|
||||
void SCR_RegisterTextures( void );
|
||||
void SCR_LoadCreditsFont( void );
|
||||
@@ -961,20 +948,17 @@ void CL_InitClientMove( void );
|
||||
void CL_PredictMovement( qboolean repredicting );
|
||||
void CL_CheckPredictionError( void );
|
||||
qboolean CL_IsPredicted( void );
|
||||
int CL_TruePointContents( const vec3_t p );
|
||||
int CL_WaterEntity( const float *rgflPos );
|
||||
cl_entity_t *CL_GetWaterEntity( const float *rgflPos );
|
||||
int CL_TestLine( const vec3_t start, const vec3_t end, int flags );
|
||||
pmtrace_t *CL_VisTraceLine( vec3_t start, vec3_t end, int flags );
|
||||
pmtrace_t CL_TraceLine( vec3_t start, vec3_t end, int flags );
|
||||
void CL_PushTraceBounds( int hullnum, const float *mins, const float *maxs );
|
||||
void CL_PopTraceBounds( void );
|
||||
void CL_MoveSpectatorCamera( void );
|
||||
void CL_SetLastUpdate( void );
|
||||
void CL_RedoPrediction( void );
|
||||
void CL_PushPMStates( void );
|
||||
void CL_PopPMStates( void );
|
||||
void CL_SetUpPlayerPrediction( int dopred, int bIncludeLocalClient );
|
||||
void CL_SetIdealPitch( void );
|
||||
|
||||
//
|
||||
// cl_qparse.c
|
||||
@@ -991,12 +975,10 @@ qboolean CL_AddVisibleEntity( cl_entity_t *ent, int entityType );
|
||||
void CL_ResetLatchedVars( cl_entity_t *ent, qboolean full_reset );
|
||||
qboolean CL_GetEntitySpatialization( struct channel_s *ch );
|
||||
qboolean CL_GetMovieSpatialization( struct rawchan_s *ch );
|
||||
void CL_ProcessPlayerState( int playerindex, entity_state_t *state );
|
||||
void CL_ComputePlayerOrigin( cl_entity_t *clent );
|
||||
void CL_ProcessPacket( frame_t *frame );
|
||||
void CL_MoveThirdpersonCamera( void );
|
||||
qboolean CL_IsPlayerIndex( int idx );
|
||||
void CL_SetIdealPitch( void );
|
||||
void CL_EmitEntities( void );
|
||||
|
||||
//
|
||||
@@ -1020,6 +1002,7 @@ const ref_overview_t *GL_GetOverviewParms( void );
|
||||
//
|
||||
void R_StoreEfrags( efrag_t **ppefrag, int framecount );
|
||||
void R_AddEfrags( cl_entity_t *ent );
|
||||
|
||||
//
|
||||
// cl_tent.c
|
||||
//
|
||||
@@ -1030,7 +1013,6 @@ void CL_ClearEfrags( void );
|
||||
void CL_TestLights( void );
|
||||
void CL_FireCustomDecal( int textureIndex, int entityIndex, int modelIndex, float *pos, int flags, float scale );
|
||||
void CL_DecalShoot( int textureIndex, int entityIndex, int modelIndex, float *pos, int flags );
|
||||
void CL_PlayerDecal( int playerIndex, int textureIndex, int entityIndex, float *pos );
|
||||
void R_FreeDeadParticles( struct particle_s **ppparticles );
|
||||
void CL_AddClientResource( const char *filename, int type );
|
||||
void CL_AddClientResources( void );
|
||||
@@ -1052,7 +1034,6 @@ void CL_ReadPointFile_f( void );
|
||||
void CL_DrawEFX( float time, qboolean fTrans );
|
||||
void CL_ThinkParticle( double frametime, particle_t *p );
|
||||
void CL_ReadLineFile_f( void );
|
||||
void CL_RunLightStyles( void );
|
||||
|
||||
//
|
||||
// console.c
|
||||
@@ -1072,27 +1053,23 @@ int Con_UtfProcessChar( int in );
|
||||
int Con_UtfProcessCharForce( int in );
|
||||
int Con_UtfMoveLeft( char *str, int pos );
|
||||
int Con_UtfMoveRight( char *str, int pos, int length );
|
||||
void Con_DefaultColor( int r, int g, int b );
|
||||
void Con_InvalidateFonts( void );
|
||||
void Con_DefaultColor( int r, int g, int b, qboolean gameui );
|
||||
cl_font_t *Con_GetCurFont( void );
|
||||
cl_font_t *Con_GetFont( int num );
|
||||
void Con_DrawCharacterLen( int number, int *width, int *height );
|
||||
int Con_DrawString( int x, int y, const char *string, rgba_t setColor ); // legacy, use cl_font.c
|
||||
void GAME_EXPORT Con_DrawStringLen( const char *pText, int *length, int *height ); // legacy, use cl_font.c
|
||||
void Con_CharEvent( int key );
|
||||
void Con_RestoreFont( void );
|
||||
void Key_Console( int key );
|
||||
void Key_Message( int key );
|
||||
void Con_FastClose( void );
|
||||
void Con_Bottom( void );
|
||||
void Con_Top( void );
|
||||
void Con_PageDown( int lines );
|
||||
void Con_PageUp( int lines );
|
||||
|
||||
//
|
||||
// s_main.c
|
||||
//
|
||||
void S_StreamRawSamples( int samples, int rate, int width, int channels, const byte *data );
|
||||
void S_StreamAviSamples( void *Avi, int entnum, float fvol, float attn, float synctime );
|
||||
void S_StartBackgroundTrack( const char *intro, const char *loop, int position, qboolean fullpath );
|
||||
void S_StopBackgroundTrack( void );
|
||||
@@ -1139,11 +1116,6 @@ void UI_ConnectionProgress_Precache( void );
|
||||
void UI_ConnectionProgress_Connect( const char *server );
|
||||
void UI_ConnectionProgress_ChangeLevel( void );
|
||||
void UI_ConnectionProgress_ParseServerInfo( const char *server );
|
||||
void pfnPIC_Set( HIMAGE hPic, int r, int g, int b, int a );
|
||||
void pfnPIC_Draw( int x, int y, int width, int height, const wrect_t *prc );
|
||||
void pfnPIC_DrawTrans( int x, int y, int width, int height, const wrect_t *prc );
|
||||
void pfnPIC_DrawHoles( int x, int y, int width, int height, const wrect_t *prc );
|
||||
void pfnPIC_DrawAdditive( int x, int y, int width, int height, const wrect_t *prc );
|
||||
|
||||
//
|
||||
// cl_mobile.c
|
||||
|
||||
@@ -25,6 +25,7 @@ GNU General Public License for more details.
|
||||
static CVAR_DEFINE_AUTO( scr_conspeed, "600", FCVAR_ARCHIVE, "console moving speed" );
|
||||
static CVAR_DEFINE_AUTO( con_notifytime, "3", FCVAR_ARCHIVE, "notify time to live" );
|
||||
CVAR_DEFINE_AUTO( con_fontsize, "1", FCVAR_ARCHIVE, "console font number (0, 1 or 2)" );
|
||||
static CVAR_DEFINE_AUTO( con_fontrender, "2", FCVAR_ARCHIVE, "console font render mode (0: additive, 1: holes, 2: trans)" );
|
||||
static CVAR_DEFINE_AUTO( con_charset, "cp1251", FCVAR_ARCHIVE, "console font charset (only cp1251 supported now)" );
|
||||
static CVAR_DEFINE_AUTO( con_fontscale, "1.0", FCVAR_ARCHIVE, "scale font texture" );
|
||||
static CVAR_DEFINE_AUTO( con_fontnum, "-1", FCVAR_ARCHIVE, "console font number (0, 1 or 2), -1 for autoselect" );
|
||||
@@ -140,8 +141,9 @@ typedef struct
|
||||
|
||||
static console_t con;
|
||||
|
||||
void Con_ClearField( field_t *edit );
|
||||
void Field_CharEvent( field_t *edit, int ch );
|
||||
static void Con_ClearField( field_t *edit );
|
||||
static void Field_CharEvent( field_t *edit, int ch );
|
||||
static void Con_InvalidateFonts( void );
|
||||
|
||||
static void Con_LoadHistory( con_history_t *self );
|
||||
static void Con_SaveHistory( con_history_t *self );
|
||||
@@ -151,7 +153,7 @@ static void Con_SaveHistory( con_history_t *self );
|
||||
Con_Clear_f
|
||||
================
|
||||
*/
|
||||
void Con_Clear_f( void )
|
||||
static void Con_Clear_f( void )
|
||||
{
|
||||
con.lines_count = 0;
|
||||
con.backscroll = 0; // go to end
|
||||
@@ -175,10 +177,10 @@ static void Con_SetColor( void )
|
||||
switch( num )
|
||||
{
|
||||
case 1:
|
||||
Con_DefaultColor( r, r, r );
|
||||
Con_DefaultColor( r, r, r, false );
|
||||
break;
|
||||
case 3:
|
||||
Con_DefaultColor( r, g, b );
|
||||
Con_DefaultColor( r, g, b, false );
|
||||
break;
|
||||
default:
|
||||
Cvar_DirectSet( &con_color, con_color.def_string );
|
||||
@@ -206,7 +208,7 @@ void Con_ClearNotify( void )
|
||||
Con_ClearTyping
|
||||
================
|
||||
*/
|
||||
void Con_ClearTyping( void )
|
||||
static void Con_ClearTyping( void )
|
||||
{
|
||||
Con_ClearField( &con.input );
|
||||
con.input.widthInChars = con.linewidth;
|
||||
@@ -219,7 +221,7 @@ void Con_ClearTyping( void )
|
||||
Con_MessageMode_f
|
||||
================
|
||||
*/
|
||||
void Con_MessageMode_f( void )
|
||||
static void Con_MessageMode_f( void )
|
||||
{
|
||||
g_messagemode_privileged = Cmd_CurrentCommandIsPrivileged();
|
||||
|
||||
@@ -235,7 +237,7 @@ void Con_MessageMode_f( void )
|
||||
Con_MessageMode2_f
|
||||
================
|
||||
*/
|
||||
void Con_MessageMode2_f( void )
|
||||
static void Con_MessageMode2_f( void )
|
||||
{
|
||||
g_messagemode_privileged = Cmd_CurrentCommandIsPrivileged();
|
||||
|
||||
@@ -280,7 +282,7 @@ void Con_ToggleConsole_f( void )
|
||||
Con_SetTimes_f
|
||||
================
|
||||
*/
|
||||
void Con_SetTimes_f( void )
|
||||
static void Con_SetTimes_f( void )
|
||||
{
|
||||
int newtimes;
|
||||
|
||||
@@ -303,7 +305,7 @@ Notifies the console code about the current time
|
||||
went backwards)
|
||||
================
|
||||
*/
|
||||
void Con_FixTimes( void )
|
||||
static void Con_FixTimes( void )
|
||||
{
|
||||
double diff;
|
||||
int i;
|
||||
@@ -324,7 +326,7 @@ Con_DeleteLine
|
||||
Deletes the first line from the console history.
|
||||
================
|
||||
*/
|
||||
void Con_DeleteLine( void )
|
||||
static void Con_DeleteLine( void )
|
||||
{
|
||||
if( con.lines_count == 0 )
|
||||
return;
|
||||
@@ -339,7 +341,7 @@ Con_DeleteLastLine
|
||||
Deletes the last line from the console history.
|
||||
================
|
||||
*/
|
||||
void Con_DeleteLastLine( void )
|
||||
static void Con_DeleteLastLine( void )
|
||||
{
|
||||
if( con.lines_count == 0 )
|
||||
return;
|
||||
@@ -398,7 +400,7 @@ Con_AddLine
|
||||
Appends a given string as a new line to the console.
|
||||
================
|
||||
*/
|
||||
void Con_AddLine( const char *line, int length, qboolean newline )
|
||||
static void Con_AddLine( const char *line, int length, qboolean newline )
|
||||
{
|
||||
char *putpos;
|
||||
con_lineinfo_t *p;
|
||||
@@ -444,7 +446,7 @@ Con_CheckResize
|
||||
If the line width has changed, reformat the buffer.
|
||||
================
|
||||
*/
|
||||
void Con_CheckResize( void )
|
||||
static void Con_CheckResize( void )
|
||||
{
|
||||
int charWidth = 8;
|
||||
int i, width;
|
||||
@@ -493,7 +495,7 @@ void Con_PageDown( int lines )
|
||||
Con_Top
|
||||
================
|
||||
*/
|
||||
void Con_Top( void )
|
||||
static void Con_Top( void )
|
||||
{
|
||||
con.backscroll = CON_MAXLINES;
|
||||
}
|
||||
@@ -546,7 +548,7 @@ static void Con_LoadConsoleFont( int fontNumber, cl_font_t *font )
|
||||
|
||||
if( con_oldfont.value )
|
||||
{
|
||||
success = Con_LoadVariableWidthFont( "gfx/conchars.fnt", font, scale, kRenderTransTexture, TF_FONT|TF_NEAREST );
|
||||
success = Con_LoadVariableWidthFont( "gfx/conchars.fnt", font, scale, &con_fontrender, TF_FONT|TF_NEAREST );
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -559,14 +561,14 @@ static void Con_LoadConsoleFont( int fontNumber, cl_font_t *font )
|
||||
if( Q_snprintf( path, sizeof( path ),
|
||||
"font%i_%s.fnt", fontNumber, Cvar_VariableString( "con_charset" )) > 0 )
|
||||
{
|
||||
success = Con_LoadVariableWidthFont( path, font, scale, kRenderTransTexture, TF_FONT|TF_NEAREST );
|
||||
success = Con_LoadVariableWidthFont( path, font, scale, &con_fontrender, TF_FONT|TF_NEAREST );
|
||||
}
|
||||
}
|
||||
|
||||
if( !success )
|
||||
{
|
||||
Q_snprintf( path, sizeof( path ), "fonts/font%i", fontNumber );
|
||||
success = Con_LoadVariableWidthFont( path, font, scale, kRenderTransTexture, TF_FONT|TF_NEAREST );
|
||||
success = Con_LoadVariableWidthFont( path, font, scale, &con_fontrender, TF_FONT|TF_NEAREST );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -574,7 +576,7 @@ static void Con_LoadConsoleFont( int fontNumber, cl_font_t *font )
|
||||
{
|
||||
// quake fixed font as fallback
|
||||
// keep source to print directly into conback image
|
||||
if( !Con_LoadFixedWidthFont( "gfx/conchars", font, scale, kRenderTransTexture, TF_FONT|TF_KEEP_SOURCE ))
|
||||
if( !Con_LoadFixedWidthFont( "gfx/conchars", font, scale, &con_fontrender, TF_FONT|TF_NEAREST|TF_KEEP_SOURCE ))
|
||||
Con_DPrintf( S_ERROR "failed to load console font\n" );
|
||||
}
|
||||
}
|
||||
@@ -839,6 +841,7 @@ void Con_Init( void )
|
||||
Cvar_RegisterVariable( &con_fontsize );
|
||||
Cvar_RegisterVariable( &con_charset );
|
||||
Cvar_RegisterVariable( &con_fontscale );
|
||||
Cvar_RegisterVariable( &con_fontrender );
|
||||
Cvar_RegisterVariable( &con_fontnum );
|
||||
Cvar_RegisterVariable( &con_color );
|
||||
Cvar_RegisterVariable( &scr_drawversion );
|
||||
@@ -1120,9 +1123,9 @@ EDIT FIELDS
|
||||
Con_ClearField
|
||||
================
|
||||
*/
|
||||
void Con_ClearField( field_t *edit )
|
||||
static void Con_ClearField( field_t *edit )
|
||||
{
|
||||
memset( edit->buffer, 0, MAX_STRING );
|
||||
memset( edit->buffer, 0, sizeof( edit->buffer ));
|
||||
edit->cursor = 0;
|
||||
edit->scroll = 0;
|
||||
}
|
||||
@@ -1143,7 +1146,7 @@ static void Field_Set( field_t *f, const char *string )
|
||||
Field_Paste
|
||||
================
|
||||
*/
|
||||
void Field_Paste( field_t *edit )
|
||||
static void Field_Paste( field_t *edit )
|
||||
{
|
||||
char *cbd;
|
||||
int i, pasteLen;
|
||||
@@ -1179,7 +1182,7 @@ in-game talk, and menu fields
|
||||
Key events are used for non-printable characters, others are gotten from char events.
|
||||
=================
|
||||
*/
|
||||
void Field_KeyDownEvent( field_t *edit, int key )
|
||||
static void Field_KeyDownEvent( field_t *edit, int key )
|
||||
{
|
||||
int len;
|
||||
|
||||
@@ -1250,7 +1253,7 @@ void Field_KeyDownEvent( field_t *edit, int key )
|
||||
Field_CharEvent
|
||||
==================
|
||||
*/
|
||||
void Field_CharEvent( field_t *edit, int ch )
|
||||
static void Field_CharEvent( field_t *edit, int ch )
|
||||
{
|
||||
int len;
|
||||
|
||||
@@ -1311,7 +1314,7 @@ void Field_CharEvent( field_t *edit, int ch )
|
||||
Field_DrawInputLine
|
||||
==================
|
||||
*/
|
||||
void Field_DrawInputLine( int x, int y, field_t *edit )
|
||||
static void Field_DrawInputLine( int x, int y, field_t *edit )
|
||||
{
|
||||
int len, cursorChar;
|
||||
int drawLen;
|
||||
@@ -1441,36 +1444,49 @@ static void Con_HistoryAppend( con_history_t *self, field_t *from )
|
||||
|
||||
static void Con_LoadHistory( con_history_t *self )
|
||||
{
|
||||
const byte *aFile = FS_LoadFile( "console_history.txt", NULL, true );
|
||||
const char *pLine, *pFile;
|
||||
int i, len;
|
||||
field_t *f;
|
||||
file_t *fd;
|
||||
int i;
|
||||
|
||||
if( !aFile )
|
||||
fd = FS_Open( "console_history.txt", "rb", true );
|
||||
|
||||
if( !fd )
|
||||
return;
|
||||
|
||||
for( pFile = pLine = (char *)aFile; *pFile; pFile++ )
|
||||
while( !FS_Eof( fd ))
|
||||
{
|
||||
if( *pFile != '\n' )
|
||||
f = &self->lines[self->next % CON_HISTORY];
|
||||
|
||||
Con_ClearField( f );
|
||||
f->widthInChars = con.linewidth;
|
||||
|
||||
FS_Gets( fd, f->buffer, sizeof( f->buffer ));
|
||||
f->cursor = Q_strlen( f->buffer );
|
||||
|
||||
// skip empty lines
|
||||
if( f->cursor == 0 )
|
||||
continue;
|
||||
|
||||
Con_ClearField( &self->lines[self->next] );
|
||||
|
||||
len = Q_min( pFile - pLine + 1, sizeof( f->buffer ));
|
||||
f = &self->lines[self->next % CON_HISTORY];
|
||||
f->widthInChars = con.linewidth;
|
||||
f->cursor = len - 1;
|
||||
Q_strncpy( f->buffer, pLine, len);
|
||||
// skip repeating lines
|
||||
if( self->next > 0 )
|
||||
{
|
||||
field_t *prev;
|
||||
prev = &self->lines[(self->next - 1) % CON_HISTORY];
|
||||
if( !Q_stricmp( prev->buffer, f->buffer ))
|
||||
continue;
|
||||
}
|
||||
|
||||
self->next++;
|
||||
|
||||
pLine = pFile + 1;
|
||||
}
|
||||
|
||||
FS_Close( fd );
|
||||
|
||||
for( i = self->next; i < CON_HISTORY; i++ )
|
||||
{
|
||||
Con_ClearField( &self->lines[i] );
|
||||
self->lines[i].widthInChars = con.linewidth;
|
||||
f = &self->lines[i];
|
||||
|
||||
Con_ClearField( f );
|
||||
f->widthInChars = con.linewidth;
|
||||
}
|
||||
|
||||
self->line = self->next;
|
||||
@@ -1488,7 +1504,7 @@ static void Con_SaveHistory( con_history_t *self )
|
||||
if( historyStart < 0 )
|
||||
historyStart = 0;
|
||||
|
||||
f = FS_Open( "console_history.txt", "w", true );
|
||||
f = FS_Open( "console_history.txt", "wb", true );
|
||||
|
||||
for( i = historyStart; i < self->next; i++ )
|
||||
FS_Printf( f, "%s\n", self->lines[i % CON_HISTORY].buffer );
|
||||
@@ -1683,7 +1699,7 @@ Con_DrawInput
|
||||
The input line scrolls horizontally if typing goes beyond the right edge
|
||||
================
|
||||
*/
|
||||
void Con_DrawInput( int lines )
|
||||
static void Con_DrawInput( int lines )
|
||||
{
|
||||
int y;
|
||||
|
||||
@@ -1703,7 +1719,7 @@ Con_DrawDebugLines
|
||||
Custom debug messages
|
||||
================
|
||||
*/
|
||||
int Con_DrawDebugLines( void )
|
||||
static int Con_DrawDebugLines( void )
|
||||
{
|
||||
notify_t *notify = con.notify;
|
||||
int i, count = 0;
|
||||
@@ -1788,7 +1804,7 @@ Con_DrawNotify
|
||||
Draws the last few lines of output transparently over the game top
|
||||
================
|
||||
*/
|
||||
void Con_DrawNotify( void )
|
||||
static void Con_DrawNotify( void )
|
||||
{
|
||||
double time = cl.time;
|
||||
int i, x, y = 0;
|
||||
@@ -1840,7 +1856,7 @@ If alpha is 0, the line is not drawn, but still wrapped and its height
|
||||
returned.
|
||||
================
|
||||
*/
|
||||
int Con_DrawConsoleLine( int y, int lineno )
|
||||
static int Con_DrawConsoleLine( int y, int lineno )
|
||||
{
|
||||
con_lineinfo_t *li = &CON_LINES( lineno );
|
||||
|
||||
@@ -1895,7 +1911,7 @@ Con_DrawConsole
|
||||
Draws the console with the solid background
|
||||
================
|
||||
*/
|
||||
void Con_DrawSolidConsole( int lines )
|
||||
static void Con_DrawSolidConsole( int lines )
|
||||
{
|
||||
int i, x, y;
|
||||
float fraction;
|
||||
@@ -2097,9 +2113,13 @@ void Con_RunConsole( void )
|
||||
// decide on the destination height of the console
|
||||
if( host.allow_console && cls.key_dest == key_console )
|
||||
{
|
||||
#if XASH_MOBILE_PLATFORM
|
||||
con.showlines = refState.height; // always full screen on mobile devices
|
||||
#else
|
||||
if( cls.state < ca_active || cl.first_frame )
|
||||
con.showlines = refState.height; // full screen
|
||||
else con.showlines = (refState.height >> 1); // half screen
|
||||
#endif
|
||||
}
|
||||
else con.showlines = 0; // none visible
|
||||
|
||||
@@ -2184,6 +2204,8 @@ INTERNAL RESOURCE
|
||||
*/
|
||||
void Con_VidInit( void )
|
||||
{
|
||||
const uint flags = TF_IMAGE|TF_ALLOW_NEAREST;
|
||||
|
||||
if( !con.historyLoaded )
|
||||
{
|
||||
Con_LoadHistory( &con.history );
|
||||
@@ -2203,28 +2225,28 @@ void Con_VidInit( void )
|
||||
{
|
||||
// trying to load truecolor image first
|
||||
if( FS_FileExists( "gfx/shell/conback.bmp", false ) || FS_FileExists( "gfx/shell/conback.tga", false ))
|
||||
con.background = ref.dllFuncs.GL_LoadTexture( "gfx/shell/conback", NULL, 0, TF_IMAGE );
|
||||
con.background = ref.dllFuncs.GL_LoadTexture( "gfx/shell/conback", NULL, 0, flags );
|
||||
|
||||
if( !con.background )
|
||||
{
|
||||
if( FS_FileExists( "cached/conback640", false ))
|
||||
con.background = ref.dllFuncs.GL_LoadTexture( "cached/conback640", NULL, 0, TF_IMAGE );
|
||||
con.background = ref.dllFuncs.GL_LoadTexture( "cached/conback640", NULL, 0, flags );
|
||||
else if( FS_FileExists( "cached/conback", false ))
|
||||
con.background = ref.dllFuncs.GL_LoadTexture( "cached/conback", NULL, 0, TF_IMAGE );
|
||||
con.background = ref.dllFuncs.GL_LoadTexture( "cached/conback", NULL, 0, flags );
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// trying to load truecolor image first
|
||||
if( FS_FileExists( "gfx/shell/loading.bmp", false ) || FS_FileExists( "gfx/shell/loading.tga", false ))
|
||||
con.background = ref.dllFuncs.GL_LoadTexture( "gfx/shell/loading", NULL, 0, TF_IMAGE );
|
||||
con.background = ref.dllFuncs.GL_LoadTexture( "gfx/shell/loading", NULL, 0, flags );
|
||||
|
||||
if( !con.background )
|
||||
{
|
||||
if( FS_FileExists( "cached/loading640", false ))
|
||||
con.background = ref.dllFuncs.GL_LoadTexture( "cached/loading640", NULL, 0, TF_IMAGE );
|
||||
con.background = ref.dllFuncs.GL_LoadTexture( "cached/loading640", NULL, 0, flags );
|
||||
else if( FS_FileExists( "cached/loading", false ))
|
||||
con.background = ref.dllFuncs.GL_LoadTexture( "cached/loading", NULL, 0, TF_IMAGE );
|
||||
con.background = ref.dllFuncs.GL_LoadTexture( "cached/loading", NULL, 0, flags );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2310,11 +2332,20 @@ Con_DefaultColor
|
||||
called from MainUI
|
||||
=========
|
||||
*/
|
||||
void GAME_EXPORT Con_DefaultColor( int r, int g, int b )
|
||||
void Con_DefaultColor( int r, int g, int b, qboolean gameui )
|
||||
{
|
||||
r = bound( 0, r, 255 );
|
||||
g = bound( 0, g, 255 );
|
||||
b = bound( 0, b, 255 );
|
||||
|
||||
// gameui wants to override console color... check if it's not default
|
||||
if( gameui && ( g_color_table[7][0] != r || g_color_table[7][1] != g || g_color_table[7][2] != b ))
|
||||
{
|
||||
// yes, different from default orange, disable con_color
|
||||
SetBits( con_color.flags, FCVAR_READ_ONLY );
|
||||
ClearBits( con_color.flags, FCVAR_CHANGED );
|
||||
}
|
||||
|
||||
MakeRGBA( g_color_table[7], r, g, b, 255 );
|
||||
}
|
||||
|
||||
|
||||
@@ -21,6 +21,7 @@ GNU General Public License for more details.
|
||||
//-----------------------------------------------------------------------------
|
||||
// Gamma conversion support
|
||||
//-----------------------------------------------------------------------------
|
||||
static qboolean gamma_rebuilt;
|
||||
static byte texgammatable[256];
|
||||
static uint lightgammatable[1024];
|
||||
static uint lineargammatable[1024];
|
||||
@@ -82,9 +83,6 @@ static void BuildGammaTable( const float gamma, const float brightness, const fl
|
||||
|
||||
static void V_ValidateGammaCvars( void )
|
||||
{
|
||||
if( Host_IsLocalGame( ))
|
||||
return;
|
||||
|
||||
if( v_gamma.value < 1.8f )
|
||||
Cvar_DirectSet( &v_gamma, "1.8" );
|
||||
else if( v_gamma.value > 3.0f )
|
||||
@@ -102,14 +100,13 @@ static void V_ValidateGammaCvars( void )
|
||||
|
||||
if( v_brightness.value < 0.0f )
|
||||
Cvar_DirectSet( &v_brightness, "0" );
|
||||
else if( v_brightness.value > 2.0f )
|
||||
Cvar_DirectSet( &v_brightness, "2" );
|
||||
else if( v_brightness.value > 3.0f )
|
||||
Cvar_DirectSet( &v_brightness, "3" );
|
||||
}
|
||||
|
||||
void V_CheckGamma( void )
|
||||
{
|
||||
static qboolean dirty = false;
|
||||
qboolean notify_refdll = false;
|
||||
|
||||
// because these cvars were defined as archive
|
||||
// but wasn't doing anything useful
|
||||
@@ -135,20 +132,33 @@ void V_CheckGamma( void )
|
||||
V_ValidateGammaCvars();
|
||||
|
||||
dirty = false;
|
||||
gamma_rebuilt = true;
|
||||
|
||||
BuildGammaTable( v_gamma.value, v_brightness.value, v_texgamma.value, v_lightgamma.value );
|
||||
|
||||
// force refdll to recalculate lightmaps
|
||||
notify_refdll = true;
|
||||
if( ref.initialized )
|
||||
ref.dllFuncs.R_GammaChanged( false );
|
||||
}
|
||||
}
|
||||
|
||||
// unfortunately, recalculating textures isn't possible yet
|
||||
void V_CheckGammaEnd( void )
|
||||
{
|
||||
// don't reset changed flag if it was set during frame
|
||||
// keep it for next frame
|
||||
if( !gamma_rebuilt )
|
||||
return;
|
||||
|
||||
gamma_rebuilt = false;
|
||||
|
||||
// keep the flags until the end of frame so client.dll will catch these changes
|
||||
if( FBitSet( v_texgamma.flags|v_lightgamma.flags|v_brightness.flags|v_gamma.flags, FCVAR_CHANGED ))
|
||||
{
|
||||
ClearBits( v_texgamma.flags, FCVAR_CHANGED );
|
||||
ClearBits( v_lightgamma.flags, FCVAR_CHANGED );
|
||||
ClearBits( v_brightness.flags, FCVAR_CHANGED );
|
||||
ClearBits( v_gamma.flags, FCVAR_CHANGED );
|
||||
}
|
||||
|
||||
if( notify_refdll && ref.initialized )
|
||||
ref.dllFuncs.R_GammaChanged( false );
|
||||
}
|
||||
|
||||
void V_Init( void )
|
||||
|
||||
@@ -252,7 +252,7 @@ Touch_DumpConfig
|
||||
Dump config to file
|
||||
=================
|
||||
*/
|
||||
qboolean Touch_DumpConfig( const char *name, const char *profilename )
|
||||
static qboolean Touch_DumpConfig( const char *name, const char *profilename )
|
||||
{
|
||||
file_t *f;
|
||||
touch_button_t *button;
|
||||
@@ -2029,10 +2029,18 @@ int IN_TouchEvent( touchEventType type, int fingerID, float x, float y, float dx
|
||||
{
|
||||
touch.move_finger = touch.resize_finger = touch.look_finger = -1;
|
||||
// Hack for keyboard, hope it help
|
||||
// a1ba: this is absolutely horrible
|
||||
if( cls.key_dest == key_console || cls.key_dest == key_message )
|
||||
{
|
||||
if ( type == event_down ) // don't pop it again on event_up
|
||||
static float x1 = 0.0f;
|
||||
x1 += dx;
|
||||
|
||||
if( type == event_up ) // don't show keyboard on every tap
|
||||
{
|
||||
Key_EnableTextInput( true, true );
|
||||
x1 = 0.0f;
|
||||
}
|
||||
|
||||
if( cls.key_dest == key_console )
|
||||
{
|
||||
static float y1 = 0;
|
||||
@@ -2054,6 +2062,13 @@ int IN_TouchEvent( touchEventType type, int fingerID, float x, float y, float dx
|
||||
// exit of console area
|
||||
if( type == event_down && x < 0.1f && y > 0.9f )
|
||||
Cbuf_AddText( "escape\n" );
|
||||
|
||||
// swipe from edge to exit console/chat
|
||||
if(( x > 0.8f && x1 < -0.1f ) || ( x < 0.2f && x1 > 0.1f ))
|
||||
{
|
||||
Cbuf_AddText( "escape\n" );
|
||||
x1 = 0.0f;
|
||||
}
|
||||
}
|
||||
UI_MouseMove( TO_SCRN_X(x), TO_SCRN_Y(y) );
|
||||
//MsgDev( D_NOTE, "touch %d %d\n", TO_SCRN_X(x), TO_SCRN_Y(y) );
|
||||
|
||||
@@ -107,7 +107,7 @@ void IN_LockInputDevices( qboolean lock )
|
||||
IN_StartupMouse
|
||||
===========
|
||||
*/
|
||||
void IN_StartupMouse( void )
|
||||
static void IN_StartupMouse( void )
|
||||
{
|
||||
Cvar_RegisterVariable( &m_ignore );
|
||||
|
||||
@@ -206,7 +206,7 @@ void IN_ToggleClientMouse( int newstate, int oldstate )
|
||||
}
|
||||
}
|
||||
|
||||
void IN_CheckMouseState( qboolean active )
|
||||
static void IN_CheckMouseState( qboolean active )
|
||||
{
|
||||
static qboolean s_bRawInput, s_bMouseGrab;
|
||||
|
||||
@@ -313,7 +313,7 @@ void IN_DeactivateMouse( void )
|
||||
IN_MouseMove
|
||||
================
|
||||
*/
|
||||
void IN_MouseMove( void )
|
||||
static void IN_MouseMove( void )
|
||||
{
|
||||
int x, y;
|
||||
|
||||
@@ -588,7 +588,7 @@ void IN_EngineAppendMove( float frametime, void *cmd1, qboolean active )
|
||||
}
|
||||
}
|
||||
|
||||
void IN_Commands( void )
|
||||
static void IN_Commands( void )
|
||||
{
|
||||
#if XASH_USE_EVDEV
|
||||
IN_EvdevFrame();
|
||||
|
||||
@@ -332,7 +332,7 @@ int Key_GetKey( const char *pBinding )
|
||||
Key_Unbind_f
|
||||
===================
|
||||
*/
|
||||
void Key_Unbind_f( void )
|
||||
static void Key_Unbind_f( void )
|
||||
{
|
||||
int b;
|
||||
|
||||
@@ -358,7 +358,7 @@ void Key_Unbind_f( void )
|
||||
Key_Unbindall_f
|
||||
===================
|
||||
*/
|
||||
void Key_Unbindall_f( void )
|
||||
static void Key_Unbindall_f( void )
|
||||
{
|
||||
int i;
|
||||
|
||||
@@ -378,7 +378,7 @@ void Key_Unbindall_f( void )
|
||||
Key_Reset_f
|
||||
===================
|
||||
*/
|
||||
void Key_Reset_f( void )
|
||||
static void Key_Reset_f( void )
|
||||
{
|
||||
keyname_t *kn;
|
||||
int i;
|
||||
@@ -400,7 +400,7 @@ void Key_Reset_f( void )
|
||||
Key_Bind_f
|
||||
===================
|
||||
*/
|
||||
void Key_Bind_f( void )
|
||||
static void Key_Bind_f( void )
|
||||
{
|
||||
char cmd[1024];
|
||||
int i, c, b;
|
||||
@@ -473,7 +473,7 @@ Key_Bindlist_f
|
||||
|
||||
============
|
||||
*/
|
||||
void Key_Bindlist_f( void )
|
||||
static void Key_Bindlist_f( void )
|
||||
{
|
||||
int i;
|
||||
|
||||
@@ -523,7 +523,7 @@ void Key_Init( void )
|
||||
Key_AddKeyCommands
|
||||
===================
|
||||
*/
|
||||
void Key_AddKeyCommands( int key, const char *kb, qboolean down )
|
||||
static void Key_AddKeyCommands( int key, const char *kb, qboolean down )
|
||||
{
|
||||
char button[1024];
|
||||
char *buttonPtr;
|
||||
|
||||
@@ -109,6 +109,12 @@ static void *pfnMod_Extradata( int type, model_t *m )
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static void CL_ExtraUpdate( void )
|
||||
{
|
||||
clgame.dllFuncs.IN_Accumulate();
|
||||
S_ExtraUpdate();
|
||||
}
|
||||
|
||||
static void pfnCL_GetScreenInfo( int *width, int *height ) // clgame.scrInfo, ptrs may be NULL
|
||||
{
|
||||
if( width ) *width = clgame.scrInfo.iWidth;
|
||||
@@ -559,7 +565,7 @@ static void R_CollectRendererNames( void )
|
||||
"GL4ES",
|
||||
#endif
|
||||
#if XASH_REF_GLES3COMPAT_ENABLED
|
||||
"GLES3 (gl2_shim)"
|
||||
"GLES3 (gl2_shim)",
|
||||
#endif
|
||||
#if XASH_REF_SOFT_ENABLED
|
||||
"Software",
|
||||
@@ -605,6 +611,7 @@ qboolean R_Init( void )
|
||||
|
||||
// cvars that are expected to exist by client.dll
|
||||
// refdll should just get pointer to them
|
||||
Cvar_Get( "r_lighting_modulate", "0.6", FCVAR_ARCHIVE, "compatibility cvar, does nothing" );
|
||||
Cvar_Get( "r_drawentities", "1", FCVAR_CHEAT, "render entities" );
|
||||
Cvar_Get( "cl_himodels", "1", FCVAR_ARCHIVE, "draw high-resolution player models in multiplayer" );
|
||||
|
||||
|
||||
@@ -43,7 +43,7 @@ CVAR_DEFINE_AUTO( s_lerping, "0", FCVAR_ARCHIVE|FCVAR_FILTERABLE, "apply interpo
|
||||
static CVAR_DEFINE( s_ambient_level, "ambient_level", "0.3", FCVAR_ARCHIVE|FCVAR_FILTERABLE, "volume of environment noises (water and wind)" );
|
||||
static CVAR_DEFINE( s_ambient_fade, "ambient_fade", "1000", FCVAR_ARCHIVE|FCVAR_FILTERABLE, "rate of volume fading when client is moving" );
|
||||
static CVAR_DEFINE_AUTO( s_combine_sounds, "0", FCVAR_ARCHIVE|FCVAR_FILTERABLE, "combine channels with same sounds" );
|
||||
CVAR_DEFINE_AUTO( snd_mute_losefocus, "1", FCVAR_ARCHIVE|FCVAR_FILTERABLE, "silence the audio when game window loses focus" );
|
||||
static CVAR_DEFINE_AUTO( snd_mute_losefocus, "1", FCVAR_ARCHIVE|FCVAR_FILTERABLE, "silence the audio when game window loses focus" );
|
||||
CVAR_DEFINE_AUTO( s_test, "0", 0, "engine developer cvar for quick testing new features" );
|
||||
CVAR_DEFINE_AUTO( s_samplecount, "0", FCVAR_ARCHIVE|FCVAR_FILTERABLE, "sample count (0 for default value)" );
|
||||
CVAR_DEFINE_AUTO( s_warn_late_precache, "0", FCVAR_ARCHIVE|FCVAR_FILTERABLE, "warn about late precached sounds on client-side" );
|
||||
@@ -64,6 +64,12 @@ float S_GetMasterVolume( void )
|
||||
{
|
||||
float scale = 1.0f;
|
||||
|
||||
if( host.status == HOST_NOFOCUS && snd_mute_losefocus.value != 0.0f )
|
||||
{
|
||||
// we return zero volume to keep sounds running
|
||||
return 0.0f;
|
||||
}
|
||||
|
||||
if( !s_listener.inmenu && soundfade.percent != 0 )
|
||||
{
|
||||
scale = bound( 0.0f, soundfade.percent / 100.0f, 1.0f );
|
||||
@@ -91,7 +97,7 @@ void S_FadeClientVolume( float fadePercent, float fadeOutSeconds, float holdTime
|
||||
S_IsClient
|
||||
=================
|
||||
*/
|
||||
qboolean S_IsClient( int entnum )
|
||||
static qboolean S_IsClient( int entnum )
|
||||
{
|
||||
return ( entnum == s_listener.entnum );
|
||||
}
|
||||
@@ -124,7 +130,7 @@ void S_FreeChannel( channel_t *ch )
|
||||
S_UpdateSoundFade
|
||||
=================
|
||||
*/
|
||||
void S_UpdateSoundFade( void )
|
||||
static void S_UpdateSoundFade( void )
|
||||
{
|
||||
float f, totaltime, elapsed;
|
||||
|
||||
@@ -184,7 +190,7 @@ override any other sound playing on the same channel (see code comments below fo
|
||||
exceptions).
|
||||
=================
|
||||
*/
|
||||
qboolean SND_FStreamIsPlaying( sfx_t *sfx )
|
||||
static qboolean SND_FStreamIsPlaying( sfx_t *sfx )
|
||||
{
|
||||
int ch_idx;
|
||||
|
||||
@@ -399,7 +405,7 @@ returns TRUE if sound was altered,
|
||||
returns FALSE if sound was not found (sound is not playing)
|
||||
=================
|
||||
*/
|
||||
int S_AlterChannel( int entnum, int channel, sfx_t *sfx, int vol, int pitch, int flags )
|
||||
static int S_AlterChannel( int entnum, int channel, sfx_t *sfx, int vol, int pitch, int flags )
|
||||
{
|
||||
channel_t *ch;
|
||||
int i;
|
||||
@@ -457,7 +463,7 @@ int S_AlterChannel( int entnum, int channel, sfx_t *sfx, int vol, int pitch, int
|
||||
S_SpatializeChannel
|
||||
=================
|
||||
*/
|
||||
void S_SpatializeChannel( int *left_vol, int *right_vol, int master_vol, float gain, float dot, float dist )
|
||||
static void S_SpatializeChannel( int *left_vol, int *right_vol, int master_vol, float gain, float dot, float dist )
|
||||
{
|
||||
float lscale, rscale, scale;
|
||||
|
||||
@@ -480,7 +486,7 @@ void S_SpatializeChannel( int *left_vol, int *right_vol, int master_vol, float g
|
||||
SND_Spatialize
|
||||
=================
|
||||
*/
|
||||
void SND_Spatialize( channel_t *ch )
|
||||
static void SND_Spatialize( channel_t *ch )
|
||||
{
|
||||
vec3_t source_vec;
|
||||
float dist, dot, gain = 1.0f;
|
||||
@@ -953,7 +959,7 @@ int S_GetCurrentDynamicSounds( soundlist_t *pout, int size )
|
||||
S_InitAmbientChannels
|
||||
===================
|
||||
*/
|
||||
void S_InitAmbientChannels( void )
|
||||
static void S_InitAmbientChannels( void )
|
||||
{
|
||||
int ambient_channel;
|
||||
channel_t *chan;
|
||||
@@ -975,7 +981,7 @@ void S_InitAmbientChannels( void )
|
||||
S_UpdateAmbientSounds
|
||||
===================
|
||||
*/
|
||||
void S_UpdateAmbientSounds( void )
|
||||
static void S_UpdateAmbientSounds( void )
|
||||
{
|
||||
mleaf_t *leaf;
|
||||
float vol;
|
||||
@@ -1407,7 +1413,7 @@ static void S_FreeRawChannels( void )
|
||||
S_ClearBuffer
|
||||
==================
|
||||
*/
|
||||
void S_ClearBuffer( void )
|
||||
static void S_ClearBuffer( void )
|
||||
{
|
||||
S_ClearRawChannels();
|
||||
|
||||
@@ -1506,7 +1512,7 @@ static int S_GetSoundtime( void )
|
||||
}
|
||||
|
||||
//=============================================================================
|
||||
void S_UpdateChannels( void )
|
||||
static void S_UpdateChannels( void )
|
||||
{
|
||||
uint endtime;
|
||||
int samps;
|
||||
@@ -1695,7 +1701,7 @@ console functions
|
||||
|
||||
===============================================================================
|
||||
*/
|
||||
void S_Play_f( void )
|
||||
static void S_Play_f( void )
|
||||
{
|
||||
if( Cmd_Argc() == 1 )
|
||||
{
|
||||
@@ -1706,7 +1712,7 @@ void S_Play_f( void )
|
||||
S_StartLocalSound( Cmd_Argv( 1 ), VOL_NORM, false );
|
||||
}
|
||||
|
||||
void S_Play2_f( void )
|
||||
static void S_Play2_f( void )
|
||||
{
|
||||
int i = 1;
|
||||
|
||||
@@ -1723,7 +1729,7 @@ void S_Play2_f( void )
|
||||
}
|
||||
}
|
||||
|
||||
void S_PlayVol_f( void )
|
||||
static void S_PlayVol_f( void )
|
||||
{
|
||||
if( Cmd_Argc() == 1 )
|
||||
{
|
||||
@@ -1749,7 +1755,7 @@ static void S_Say( const char *name, qboolean reliable )
|
||||
S_StartLocalSound( sentence, 1.0f, reliable );
|
||||
}
|
||||
|
||||
void S_Say_f( void )
|
||||
static void S_Say_f( void )
|
||||
{
|
||||
if( Cmd_Argc() == 1 )
|
||||
{
|
||||
@@ -1760,7 +1766,7 @@ void S_Say_f( void )
|
||||
S_Say( Cmd_Argv( 1 ), false );
|
||||
}
|
||||
|
||||
void S_SayReliable_f( void )
|
||||
static void S_SayReliable_f( void )
|
||||
{
|
||||
if( Cmd_Argc() == 1 )
|
||||
{
|
||||
@@ -1776,7 +1782,7 @@ void S_SayReliable_f( void )
|
||||
S_Music_f
|
||||
=================
|
||||
*/
|
||||
void S_Music_f( void )
|
||||
static void S_Music_f( void )
|
||||
{
|
||||
int c = Cmd_Argc();
|
||||
|
||||
@@ -1840,7 +1846,7 @@ void S_Music_f( void )
|
||||
S_StopSound_f
|
||||
=================
|
||||
*/
|
||||
void S_StopSound_f( void )
|
||||
static void S_StopSound_f( void )
|
||||
{
|
||||
S_StopAllSounds( true );
|
||||
}
|
||||
@@ -1850,7 +1856,7 @@ void S_StopSound_f( void )
|
||||
S_SoundFade_f
|
||||
=================
|
||||
*/
|
||||
void S_SoundFade_f( void )
|
||||
static void S_SoundFade_f( void )
|
||||
{
|
||||
int c = Cmd_Argc();
|
||||
float fadeTime = 5.0f;
|
||||
@@ -1884,7 +1890,7 @@ void S_SoundInfo_f( void )
|
||||
S_VoiceRecordStart_f
|
||||
=================
|
||||
*/
|
||||
void S_VoiceRecordStart_f( void )
|
||||
static void S_VoiceRecordStart_f( void )
|
||||
{
|
||||
if( cls.state != ca_active || cls.legacymode )
|
||||
return;
|
||||
@@ -1897,7 +1903,7 @@ void S_VoiceRecordStart_f( void )
|
||||
S_VoiceRecordStop_f
|
||||
=================
|
||||
*/
|
||||
void S_VoiceRecordStop_f( void )
|
||||
static void S_VoiceRecordStop_f( void )
|
||||
{
|
||||
if( cls.state != ca_active || !Voice_IsRecording() )
|
||||
return;
|
||||
|
||||
@@ -58,7 +58,7 @@ S_TransferPaintBuffer
|
||||
|
||||
===================
|
||||
*/
|
||||
void S_TransferPaintBuffer( int endtime )
|
||||
static void S_TransferPaintBuffer( int endtime )
|
||||
{
|
||||
int *snd_p, snd_linear_count;
|
||||
int lpos, lpaintedtime;
|
||||
@@ -201,7 +201,7 @@ CHANNEL MIXING
|
||||
|
||||
===============================================================================
|
||||
*/
|
||||
void S_PaintMonoFrom8( portable_samplepair_t *pbuf, int *volume, byte *pData, int outCount )
|
||||
static void S_PaintMonoFrom8( portable_samplepair_t *pbuf, int *volume, byte *pData, int outCount )
|
||||
{
|
||||
int *lscale, *rscale;
|
||||
int i, data;
|
||||
@@ -217,7 +217,7 @@ void S_PaintMonoFrom8( portable_samplepair_t *pbuf, int *volume, byte *pData, in
|
||||
}
|
||||
}
|
||||
|
||||
void S_PaintStereoFrom8( portable_samplepair_t *pbuf, int *volume, byte *pData, int outCount )
|
||||
static void S_PaintStereoFrom8( portable_samplepair_t *pbuf, int *volume, byte *pData, int outCount )
|
||||
{
|
||||
int *lscale, *rscale;
|
||||
uint left, right;
|
||||
@@ -237,7 +237,7 @@ void S_PaintStereoFrom8( portable_samplepair_t *pbuf, int *volume, byte *pData,
|
||||
}
|
||||
}
|
||||
|
||||
void S_PaintMonoFrom16( portable_samplepair_t *pbuf, int *volume, short *pData, int outCount )
|
||||
static void S_PaintMonoFrom16( portable_samplepair_t *pbuf, int *volume, short *pData, int outCount )
|
||||
{
|
||||
int left, right;
|
||||
int i, data;
|
||||
@@ -252,7 +252,7 @@ void S_PaintMonoFrom16( portable_samplepair_t *pbuf, int *volume, short *pData,
|
||||
}
|
||||
}
|
||||
|
||||
void S_PaintStereoFrom16( portable_samplepair_t *pbuf, int *volume, short *pData, int outCount )
|
||||
static void S_PaintStereoFrom16( portable_samplepair_t *pbuf, int *volume, short *pData, int outCount )
|
||||
{
|
||||
uint *data;
|
||||
int left, right;
|
||||
@@ -273,11 +273,11 @@ void S_PaintStereoFrom16( portable_samplepair_t *pbuf, int *volume, short *pData
|
||||
}
|
||||
}
|
||||
|
||||
void S_Mix8MonoTimeCompress( portable_samplepair_t *pbuf, int *volume, byte *pData, int inputOffset, uint rateScale, int outCount, int timecompress )
|
||||
static void S_Mix8MonoTimeCompress( portable_samplepair_t *pbuf, int *volume, byte *pData, int inputOffset, uint rateScale, int outCount, int timecompress )
|
||||
{
|
||||
}
|
||||
|
||||
void S_Mix8Mono( portable_samplepair_t *pbuf, int *volume, byte *pData, int inputOffset, uint rateScale, int outCount, int timecompress )
|
||||
static void S_Mix8Mono( portable_samplepair_t *pbuf, int *volume, byte *pData, int inputOffset, uint rateScale, int outCount, int timecompress )
|
||||
{
|
||||
int i, sampleIndex = 0;
|
||||
uint sampleFrac = inputOffset;
|
||||
@@ -309,7 +309,7 @@ void S_Mix8Mono( portable_samplepair_t *pbuf, int *volume, byte *pData, int inpu
|
||||
}
|
||||
}
|
||||
|
||||
void S_Mix8Stereo( portable_samplepair_t *pbuf, int *volume, byte *pData, int inputOffset, uint rateScale, int outCount )
|
||||
static void S_Mix8Stereo( portable_samplepair_t *pbuf, int *volume, byte *pData, int inputOffset, uint rateScale, int outCount )
|
||||
{
|
||||
int i, sampleIndex = 0;
|
||||
uint sampleFrac = inputOffset;
|
||||
@@ -335,7 +335,7 @@ void S_Mix8Stereo( portable_samplepair_t *pbuf, int *volume, byte *pData, int in
|
||||
}
|
||||
}
|
||||
|
||||
void S_Mix16Mono( portable_samplepair_t *pbuf, int *volume, short *pData, int inputOffset, uint rateScale, int outCount )
|
||||
static void S_Mix16Mono( portable_samplepair_t *pbuf, int *volume, short *pData, int inputOffset, uint rateScale, int outCount )
|
||||
{
|
||||
int i, sampleIndex = 0;
|
||||
uint sampleFrac = inputOffset;
|
||||
@@ -357,7 +357,7 @@ void S_Mix16Mono( portable_samplepair_t *pbuf, int *volume, short *pData, int in
|
||||
}
|
||||
}
|
||||
|
||||
void S_Mix16Stereo( portable_samplepair_t *pbuf, int *volume, short *pData, int inputOffset, uint rateScale, int outCount )
|
||||
static void S_Mix16Stereo( portable_samplepair_t *pbuf, int *volume, short *pData, int inputOffset, uint rateScale, int outCount )
|
||||
{
|
||||
int i, sampleIndex = 0;
|
||||
uint sampleFrac = inputOffset;
|
||||
@@ -379,7 +379,7 @@ void S_Mix16Stereo( portable_samplepair_t *pbuf, int *volume, short *pData, int
|
||||
}
|
||||
}
|
||||
|
||||
void S_MixChannel( channel_t *pChannel, void *pData, int outputOffset, int inputOffset, uint fracRate, int outCount, int timecompress )
|
||||
static void S_MixChannel( channel_t *pChannel, void *pData, int outputOffset, int inputOffset, uint fracRate, int outCount, int timecompress )
|
||||
{
|
||||
int pvol[CCHANVOLUMES];
|
||||
paintbuffer_t *ppaint = MIX_GetCurrentPaintbufferPtr();
|
||||
@@ -496,7 +496,7 @@ int S_MixDataToDevice( channel_t *pChannel, int sampleCount, int outRate, int ou
|
||||
return outOffset - startingOffset;
|
||||
}
|
||||
|
||||
qboolean S_ShouldContinueMixing( channel_t *ch )
|
||||
static qboolean S_ShouldContinueMixing( channel_t *ch )
|
||||
{
|
||||
if( ch->isSentence )
|
||||
{
|
||||
@@ -517,7 +517,7 @@ qboolean S_ShouldContinueMixing( channel_t *ch )
|
||||
// this routine will fill the paintbuffer to endtime. Otherwise, fewer samples are mixed.
|
||||
// if( endtime - paintedtime ) is not aligned on boundaries of 4,
|
||||
// we'll miss data if outputRate < SOUND_DMA_SPEED!
|
||||
void MIX_MixChannelsToPaintbuffer( int endtime, int rate, int outputRate )
|
||||
static void MIX_MixChannelsToPaintbuffer( int endtime, int rate, int outputRate )
|
||||
{
|
||||
channel_t *ch;
|
||||
wavdata_t *pSource;
|
||||
@@ -647,7 +647,7 @@ _inline portable_samplepair_t *S_GetNextpFilter( int i, portable_samplepair_t *p
|
||||
// if NULL then perform no filtering.
|
||||
// count: how many samples to upsample. will become count*2 samples in buffer, in place.
|
||||
|
||||
void S_Interpolate2xCubic( portable_samplepair_t *pbuffer, portable_samplepair_t *pfiltermem, int cfltmem, int count )
|
||||
static void S_Interpolate2xCubic( portable_samplepair_t *pbuffer, portable_samplepair_t *pfiltermem, int cfltmem, int count )
|
||||
{
|
||||
|
||||
// implement cubic interpolation on 2x upsampled buffer. Effectively delays buffer contents by 2 samples.
|
||||
@@ -740,7 +740,7 @@ void S_Interpolate2xCubic( portable_samplepair_t *pbuffer, portable_samplepair_t
|
||||
// prevfilter: filter memory. NOTE: this must match the filtertype ie: filterlinear[] for FILTERTYPE_LINEAR
|
||||
// if NULL then perform no filtering.
|
||||
// count: how many samples to upsample. will become count*2 samples in buffer, in place.
|
||||
void S_Interpolate2xLinear( portable_samplepair_t *pbuffer, portable_samplepair_t *pfiltermem, int cfltmem, int count )
|
||||
static void S_Interpolate2xLinear( portable_samplepair_t *pbuffer, portable_samplepair_t *pfiltermem, int cfltmem, int count )
|
||||
{
|
||||
int i, upCount = count<<1;
|
||||
|
||||
@@ -769,7 +769,7 @@ void S_Interpolate2xLinear( portable_samplepair_t *pbuffer, portable_samplepair_
|
||||
// if NULL then perform no filtering.
|
||||
// cfltmem: max number of sample pairs filter can use
|
||||
// filtertype: FILTERTYPE_NONE, _LINEAR, _CUBIC etc. Must match prevfilter.
|
||||
void S_MixBufferUpsample2x( int count, portable_samplepair_t *pbuffer, portable_samplepair_t *pfiltermem, int cfltmem, int filtertype )
|
||||
static void S_MixBufferUpsample2x( int count, portable_samplepair_t *pbuffer, portable_samplepair_t *pfiltermem, int cfltmem, int filtertype )
|
||||
{
|
||||
int upCount = count<<1;
|
||||
int i, j;
|
||||
@@ -822,7 +822,7 @@ void MIX_ClearAllPaintBuffers( int SampleCount, qboolean clearFilters )
|
||||
// mixes pbuf1 + pbuf2 into pbuf3, count samples
|
||||
// fgain is output gain 0-1.0
|
||||
// NOTE: pbuf3 may equal pbuf1 or pbuf2!
|
||||
void MIX_MixPaintbuffers( int ibuf1, int ibuf2, int ibuf3, int count, float fgain )
|
||||
static void MIX_MixPaintbuffers( int ibuf1, int ibuf2, int ibuf3, int count, float fgain )
|
||||
{
|
||||
portable_samplepair_t *pbuf1, *pbuf2, *pbuf3;
|
||||
int i, gain;
|
||||
@@ -855,7 +855,7 @@ void MIX_MixPaintbuffers( int ibuf1, int ibuf2, int ibuf3, int count, float fgai
|
||||
}
|
||||
}
|
||||
|
||||
void MIX_CompressPaintbuffer( int ipaint, int count )
|
||||
static void MIX_CompressPaintbuffer( int ipaint, int count )
|
||||
{
|
||||
portable_samplepair_t *pbuf;
|
||||
paintbuffer_t *ppaint;
|
||||
@@ -871,7 +871,7 @@ void MIX_CompressPaintbuffer( int ipaint, int count )
|
||||
}
|
||||
}
|
||||
|
||||
void S_MixUpsample( int sampleCount, int filtertype )
|
||||
static void S_MixUpsample( int sampleCount, int filtertype )
|
||||
{
|
||||
paintbuffer_t *ppaint = MIX_GetCurrentPaintbufferPtr();
|
||||
int ifilter = ppaint->ifilter;
|
||||
@@ -884,7 +884,7 @@ void S_MixUpsample( int sampleCount, int filtertype )
|
||||
ppaint->ifilter++;
|
||||
}
|
||||
|
||||
void MIX_MixRawSamplesBuffer( int end )
|
||||
static void MIX_MixRawSamplesBuffer( int end )
|
||||
{
|
||||
portable_samplepair_t *pbuf, *roombuf, *streambuf;
|
||||
uint i, j, stop;
|
||||
@@ -928,7 +928,7 @@ void MIX_MixRawSamplesBuffer( int end )
|
||||
// IROOMBUFFER, IFACINGBUFFER, IFACINGAWAY
|
||||
// dsp fx are then applied to these buffers by the caller.
|
||||
// caller also remixes all into final IPAINTBUFFER output.
|
||||
void MIX_UpsampleAllPaintbuffers( int end, int count )
|
||||
static void MIX_UpsampleAllPaintbuffers( int end, int count )
|
||||
{
|
||||
// 11khz sounds are mixed into 3 buffers based on distance from listener, and facing direction
|
||||
// These buffers are facing, facingaway, room
|
||||
|
||||
@@ -221,7 +221,6 @@ extern convar_t s_musicvolume;
|
||||
extern convar_t s_lerping;
|
||||
extern convar_t s_test; // cvar to testify new effects
|
||||
extern convar_t s_samplecount;
|
||||
extern convar_t snd_mute_losefocus;
|
||||
extern convar_t s_warn_late_precache;
|
||||
|
||||
void S_InitScaletable( void );
|
||||
|
||||
@@ -20,8 +20,6 @@ GNU General Public License for more details.
|
||||
#include "vid_common.h"
|
||||
#include "platform/platform.h"
|
||||
|
||||
static CVAR_DEFINE( window_width, "width", "0", FCVAR_RENDERINFO|FCVAR_VIDRESTART, "screen width" );
|
||||
static CVAR_DEFINE( window_height, "height", "0", FCVAR_RENDERINFO|FCVAR_VIDRESTART, "screen height" );
|
||||
static CVAR_DEFINE_AUTO( vid_mode, "0", FCVAR_RENDERINFO, "current video mode index (used only for storage)" );
|
||||
static CVAR_DEFINE_AUTO( vid_rotate, "0", FCVAR_RENDERINFO|FCVAR_VIDRESTART, "screen rotation (0-3)" );
|
||||
static CVAR_DEFINE_AUTO( vid_scale, "1.0", FCVAR_RENDERINFO|FCVAR_VIDRESTART, "pixel scale" );
|
||||
@@ -29,6 +27,8 @@ static CVAR_DEFINE_AUTO( vid_scale, "1.0", FCVAR_RENDERINFO|FCVAR_VIDRESTART, "p
|
||||
CVAR_DEFINE_AUTO( vid_highdpi, "1", FCVAR_RENDERINFO|FCVAR_VIDRESTART, "enable High-DPI mode" );
|
||||
CVAR_DEFINE_AUTO( vid_maximized, "0", FCVAR_RENDERINFO, "window maximized state, read-only" );
|
||||
CVAR_DEFINE( vid_fullscreen, "fullscreen", "0", FCVAR_RENDERINFO|FCVAR_VIDRESTART, "fullscreen state (0 windowed, 1 fullscreen, 2 borderless)" );
|
||||
CVAR_DEFINE( window_width, "width", "0", FCVAR_RENDERINFO|FCVAR_VIDRESTART, "screen width" );
|
||||
CVAR_DEFINE( window_height, "height", "0", FCVAR_RENDERINFO|FCVAR_VIDRESTART, "screen height" );
|
||||
CVAR_DEFINE( window_xpos, "_window_xpos", "-1", FCVAR_RENDERINFO, "window position by horizontal" );
|
||||
CVAR_DEFINE( window_ypos, "_window_ypos", "-1", FCVAR_RENDERINFO, "window position by vertical" );
|
||||
|
||||
|
||||
@@ -38,6 +38,8 @@ extern glwstate_t glw_state;
|
||||
extern convar_t vid_fullscreen;
|
||||
extern convar_t vid_maximized;
|
||||
extern convar_t vid_highdpi;
|
||||
extern convar_t window_width;
|
||||
extern convar_t window_height;
|
||||
extern convar_t window_xpos;
|
||||
extern convar_t window_ypos;
|
||||
extern convar_t gl_msaa_samples;
|
||||
|
||||
@@ -25,11 +25,12 @@ voice_state_t voice = { 0 };
|
||||
CVAR_DEFINE_AUTO( voice_enable, "1", FCVAR_PRIVILEGED|FCVAR_ARCHIVE, "enable voice chat" );
|
||||
CVAR_DEFINE_AUTO( voice_loopback, "0", FCVAR_PRIVILEGED, "loopback voice back to the speaker" );
|
||||
CVAR_DEFINE_AUTO( voice_scale, "1.0", FCVAR_PRIVILEGED|FCVAR_ARCHIVE, "incoming voice volume scale" );
|
||||
CVAR_DEFINE_AUTO( voice_transmit_scale, "1.0", FCVAR_PRIVILEGED|FCVAR_ARCHIVE, "outcoming voice volume scale" );
|
||||
CVAR_DEFINE_AUTO( voice_avggain, "0.5", FCVAR_PRIVILEGED|FCVAR_ARCHIVE, "automatic voice gain control (average)" );
|
||||
CVAR_DEFINE_AUTO( voice_maxgain, "5.0", FCVAR_PRIVILEGED|FCVAR_ARCHIVE, "automatic voice gain control (maximum)" );
|
||||
CVAR_DEFINE_AUTO( voice_inputfromfile, "0", FCVAR_PRIVILEGED, "input voice from voice_input.wav" );
|
||||
|
||||
static void Voice_ApplyGainAdjust( int16_t *samples, int count );
|
||||
static void Voice_ApplyGainAdjust( int16_t *samples, int count, float scale );
|
||||
|
||||
/*
|
||||
===============================================================================
|
||||
@@ -39,6 +40,25 @@ static void Voice_ApplyGainAdjust( int16_t *samples, int count );
|
||||
===============================================================================
|
||||
*/
|
||||
|
||||
static qboolean Voice_InitCustomMode( void )
|
||||
{
|
||||
int err = 0;
|
||||
|
||||
voice.width = sizeof( opus_int16 );
|
||||
voice.samplerate = VOICE_OPUS_CUSTOM_SAMPLERATE;
|
||||
voice.frame_size = VOICE_OPUS_CUSTOM_FRAME_SIZE;
|
||||
|
||||
voice.custom_mode = opus_custom_mode_create( SOUND_44k, voice.frame_size, &err );
|
||||
|
||||
if( !voice.custom_mode )
|
||||
{
|
||||
Con_Printf( S_ERROR "Can't create Opus Custom mode: %s\n", opus_strerror( err ));
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/*
|
||||
=========================
|
||||
Voice_InitOpusDecoder
|
||||
@@ -47,24 +67,17 @@ Voice_InitOpusDecoder
|
||||
*/
|
||||
static qboolean Voice_InitOpusDecoder( void )
|
||||
{
|
||||
int err;
|
||||
int err = 0;
|
||||
|
||||
voice.width = sizeof( opus_int16 );
|
||||
voice.samplerate = VOICE_OPUS_CUSTOM_SAMPLERATE;
|
||||
voice.frame_size = VOICE_OPUS_CUSTOM_FRAME_SIZE;
|
||||
|
||||
voice.custom_mode = opus_custom_mode_create( SOUND_44k, voice.frame_size, &err );
|
||||
if( !voice.custom_mode )
|
||||
for( int i = 0; i < cl.maxclients; i++ )
|
||||
{
|
||||
Con_Printf( S_ERROR "Can't create Opus Custom mode: %s\n", opus_strerror( err ));
|
||||
return false;
|
||||
}
|
||||
voice.decoders[i] = opus_custom_decoder_create( voice.custom_mode, VOICE_PCM_CHANNELS, &err );
|
||||
|
||||
voice.decoder = opus_custom_decoder_create( voice.custom_mode, VOICE_PCM_CHANNELS, &err );
|
||||
if( !voice.decoder )
|
||||
{
|
||||
Con_Printf( S_ERROR "Can't create Opus encoder: %s\n", opus_strerror( err ));
|
||||
return false;
|
||||
if( !voice.decoders[i] )
|
||||
{
|
||||
Con_Printf( S_ERROR "Can't create Opus decoder for %i: %s\n", i, opus_strerror( err ));
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
@@ -78,7 +91,7 @@ Voice_InitOpusEncoder
|
||||
*/
|
||||
static qboolean Voice_InitOpusEncoder( int quality )
|
||||
{
|
||||
int err;
|
||||
int err = 0;
|
||||
|
||||
voice.encoder = opus_custom_encoder_create( voice.custom_mode, VOICE_PCM_CHANNELS, &err );
|
||||
if( !voice.encoder )
|
||||
@@ -117,10 +130,13 @@ Voice_ShutdownOpusDecoder
|
||||
*/
|
||||
static void Voice_ShutdownOpusDecoder( void )
|
||||
{
|
||||
if( voice.decoder )
|
||||
for( int i = 0; i < MAX_CLIENTS; i++ )
|
||||
{
|
||||
opus_custom_decoder_destroy( voice.decoder );
|
||||
voice.decoder = NULL;
|
||||
if( !voice.decoders[i] )
|
||||
continue;
|
||||
|
||||
opus_custom_decoder_destroy( voice.decoders[i] );
|
||||
voice.decoders[i] = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -137,7 +153,10 @@ static void Voice_ShutdownOpusEncoder( void )
|
||||
opus_custom_encoder_destroy( voice.encoder );
|
||||
voice.encoder = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
static void Voice_ShutdownCustomMode( void )
|
||||
{
|
||||
if( voice.custom_mode )
|
||||
{
|
||||
opus_custom_mode_destroy( voice.custom_mode );
|
||||
@@ -184,7 +203,7 @@ static uint Voice_GetOpusCompressedData( byte *out, uint maxsize, uint *frames )
|
||||
if( !voice.input_file )
|
||||
{
|
||||
// adjust gain before encoding, but only for input from voice
|
||||
Voice_ApplyGainAdjust((opus_int16*)(voice.input_buffer + ofs), voice.frame_size);
|
||||
Voice_ApplyGainAdjust((opus_int16*)(voice.input_buffer + ofs), voice.frame_size, voice_transmit_scale.value);
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -238,10 +257,10 @@ Voice_ApplyGainAdjust
|
||||
|
||||
=========================
|
||||
*/
|
||||
static void Voice_ApplyGainAdjust( int16_t *samples, int count )
|
||||
static void Voice_ApplyGainAdjust( int16_t *samples, int count, float scale )
|
||||
{
|
||||
float gain, modifiedMax;
|
||||
int average, adjustedSample, blockOffset = 0;
|
||||
int average, blockOffset = 0;
|
||||
|
||||
for( ;; )
|
||||
{
|
||||
@@ -260,10 +279,8 @@ static void Voice_ApplyGainAdjust( int16_t *samples, int count )
|
||||
localMax = absSample;
|
||||
|
||||
localSum += absSample;
|
||||
|
||||
gain = voice.autogain.current_gain + i * voice.autogain.gain_multiplier;
|
||||
adjustedSample = Q_min( SHRT_MAX, Q_max(( int )( sample * gain ), SHRT_MIN ));
|
||||
samples[blockOffset + i] = adjustedSample;
|
||||
samples[blockOffset + i] = bound( SHRT_MIN, (int)( sample * gain ), SHRT_MAX );
|
||||
}
|
||||
|
||||
if( blockOffset % voice.autogain.block_size == 0 )
|
||||
@@ -271,9 +288,9 @@ static void Voice_ApplyGainAdjust( int16_t *samples, int count )
|
||||
average = localSum / blockSize;
|
||||
modifiedMax = average + ( localMax - average ) * voice_avggain.value;
|
||||
|
||||
voice.autogain.current_gain = voice.autogain.next_gain * voice_scale.value;
|
||||
voice.autogain.next_gain = Q_min( (float)SHRT_MAX / modifiedMax, voice_maxgain.value ) * voice_scale.value;
|
||||
voice.autogain.gain_multiplier = ( voice.autogain.next_gain - voice.autogain.current_gain ) / ( voice.autogain.block_size - 1 );
|
||||
voice.autogain.current_gain = voice.autogain.next_gain * scale;
|
||||
voice.autogain.next_gain = Q_min( (float)SHRT_MAX / modifiedMax, voice_maxgain.value ) * scale;
|
||||
voice.autogain.gain_multiplier = ( voice.autogain.next_gain - voice.autogain.current_gain ) / ( blockSize - 1 );
|
||||
}
|
||||
blockOffset += blockSize;
|
||||
}
|
||||
@@ -428,6 +445,9 @@ void Voice_Disconnect( void )
|
||||
voice.players_status[i].talking_ack = false;
|
||||
}
|
||||
}
|
||||
|
||||
VoiceCapture_Shutdown();
|
||||
voice.device_opened = false;
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -440,7 +460,7 @@ Feed the decoded data to engine sound subsystem
|
||||
static void Voice_StartChannel( uint samples, byte *data, int entnum )
|
||||
{
|
||||
SND_ForceInitMouth( entnum );
|
||||
S_RawEntSamples( entnum, samples, voice.samplerate, voice.width, VOICE_PCM_CHANNELS, data, 255 );
|
||||
S_RawEntSamples( entnum, samples, voice.samplerate, voice.width, VOICE_PCM_CHANNELS, data, bound( 0, 255 * voice_scale.value, 255 ));
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -452,10 +472,11 @@ Received encoded voice data, decode it
|
||||
*/
|
||||
void Voice_AddIncomingData( int ent, const byte *data, uint size, uint frames )
|
||||
{
|
||||
const int playernum = ent - 1;
|
||||
int samples = 0;
|
||||
int ofs = 0;
|
||||
|
||||
if( !voice.decoder )
|
||||
if( playernum < 0 || playernum >= cl.maxclients || !voice.decoders[playernum] )
|
||||
return;
|
||||
|
||||
// decode frame by frame
|
||||
@@ -475,7 +496,7 @@ void Voice_AddIncomingData( int ent, const byte *data, uint size, uint frames )
|
||||
if( ofs + compressed_size > size )
|
||||
break;
|
||||
|
||||
frame_samples = opus_custom_decode( voice.decoder, data + ofs, compressed_size,
|
||||
frame_samples = opus_custom_decode( voice.decoders[playernum], data + ofs, compressed_size,
|
||||
(opus_int16*)voice.decompress_buffer + samples, voice.frame_size );
|
||||
|
||||
ofs += compressed_size;
|
||||
@@ -499,8 +520,8 @@ void CL_AddVoiceToDatagram( void )
|
||||
|
||||
if( cls.state != ca_active || !Voice_IsRecording() || !voice.encoder )
|
||||
return;
|
||||
|
||||
size = Voice_GetOpusCompressedData( voice.output_buffer, sizeof( voice.output_buffer ), &frames );
|
||||
|
||||
size = Voice_GetOpusCompressedData( voice.compress_buffer, sizeof( voice.compress_buffer ), &frames );
|
||||
|
||||
if( size > 0 && MSG_GetNumBytesLeft( &cls.datagram ) >= size + 32 )
|
||||
{
|
||||
@@ -508,7 +529,7 @@ void CL_AddVoiceToDatagram( void )
|
||||
MSG_WriteByte( &cls.datagram, voice_loopback.value != 0 );
|
||||
MSG_WriteByte( &cls.datagram, frames );
|
||||
MSG_WriteShort( &cls.datagram, size );
|
||||
MSG_WriteBytes( &cls.datagram, voice.output_buffer, size );
|
||||
MSG_WriteBytes( &cls.datagram, voice.compress_buffer, size );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -524,6 +545,7 @@ void Voice_RegisterCvars( void )
|
||||
Cvar_RegisterVariable( &voice_enable );
|
||||
Cvar_RegisterVariable( &voice_loopback );
|
||||
Cvar_RegisterVariable( &voice_scale );
|
||||
Cvar_RegisterVariable( &voice_transmit_scale );
|
||||
Cvar_RegisterVariable( &voice_avggain );
|
||||
Cvar_RegisterVariable( &voice_maxgain );
|
||||
Cvar_RegisterVariable( &voice_inputfromfile );
|
||||
@@ -541,8 +563,9 @@ static void Voice_Shutdown( void )
|
||||
int i;
|
||||
|
||||
Voice_RecordStop();
|
||||
Voice_ShutdownOpusEncoder();
|
||||
Voice_ShutdownOpusDecoder();
|
||||
Voice_ShutdownOpusEncoder();
|
||||
Voice_ShutdownCustomMode();
|
||||
VoiceCapture_Shutdown();
|
||||
|
||||
if( voice.local.talking_ack )
|
||||
@@ -588,48 +611,62 @@ Voice_Init
|
||||
Initialize the voice subsystem
|
||||
=========================
|
||||
*/
|
||||
qboolean Voice_Init( const char *pszCodecName, int quality )
|
||||
qboolean Voice_Init( const char *pszCodecName, int quality, qboolean preinit )
|
||||
{
|
||||
if( !voice_enable.value )
|
||||
return false;
|
||||
|
||||
if( Q_strcmp( pszCodecName, VOICE_OPUS_CUSTOM_CODEC ))
|
||||
{
|
||||
Con_Printf( S_ERROR "Server requested unsupported codec: %s\n", pszCodecName );
|
||||
return false;
|
||||
}
|
||||
|
||||
// reinitialize only if codec parameters are different
|
||||
if( !Q_strcmp( voice.codec, pszCodecName ) && voice.quality == quality )
|
||||
return true;
|
||||
|
||||
Voice_Shutdown();
|
||||
|
||||
voice.autogain.block_size = 128;
|
||||
|
||||
if( !Voice_InitOpusDecoder( ))
|
||||
if( Q_strcmp( pszCodecName, voice.codec ) || voice.quality != quality )
|
||||
{
|
||||
// no reason to init encoder and open audio device
|
||||
// if we can't hear other players
|
||||
Con_Printf( S_ERROR "Voice chat disabled.\n" );
|
||||
Voice_Shutdown();
|
||||
return false;
|
||||
|
||||
if( Q_strcmp( pszCodecName, VOICE_OPUS_CUSTOM_CODEC ))
|
||||
{
|
||||
Con_Printf( S_ERROR "Server requested unsupported codec: %s\n", pszCodecName );
|
||||
return false;
|
||||
}
|
||||
|
||||
voice.autogain.block_size = 128;
|
||||
|
||||
if( !Voice_InitCustomMode( ))
|
||||
{
|
||||
// no reason to init encoder and open audio device
|
||||
// if we can't hear other players
|
||||
Voice_Shutdown();
|
||||
return false;
|
||||
}
|
||||
|
||||
// we can hear others players, so it's fine to fail now
|
||||
voice.initialized = true;
|
||||
Q_strncpy( voice.codec, pszCodecName, sizeof( voice.codec ));
|
||||
|
||||
if( !Voice_InitOpusEncoder( quality ))
|
||||
{
|
||||
Con_Printf( S_WARN "Other players will not be able to hear you.\n" );
|
||||
return false;
|
||||
}
|
||||
|
||||
voice.quality = quality;
|
||||
}
|
||||
|
||||
// we can hear others players, so it's fine to fail now
|
||||
voice.initialized = true;
|
||||
Q_strncpy( voice.codec, pszCodecName, sizeof( voice.codec ));
|
||||
|
||||
if( !Voice_InitOpusEncoder( quality ))
|
||||
if( !preinit )
|
||||
{
|
||||
Con_Printf( S_WARN "Other players will not be able to hear you.\n" );
|
||||
return false;
|
||||
Voice_ShutdownOpusDecoder();
|
||||
if( !Voice_InitOpusDecoder())
|
||||
{
|
||||
// no reason to init encoder and open audio device
|
||||
// if we can't hear other players
|
||||
Con_Printf( S_ERROR "Can't create decoders, voice chat is disabled.\n" );
|
||||
Voice_Shutdown();
|
||||
return false;
|
||||
}
|
||||
|
||||
voice.device_opened = VoiceCapture_Init();
|
||||
|
||||
if( !voice.device_opened )
|
||||
Con_Printf( S_WARN "No microphone is available.\n" );
|
||||
}
|
||||
|
||||
voice.quality = quality;
|
||||
|
||||
if( !VoiceCapture_Init( ))
|
||||
Con_Printf( S_WARN "No microphone is available.\n" );
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -53,6 +53,7 @@ typedef struct voice_state_s
|
||||
|
||||
qboolean initialized;
|
||||
qboolean is_recording;
|
||||
qboolean device_opened;
|
||||
double start_time;
|
||||
|
||||
voice_status_t local;
|
||||
@@ -61,7 +62,7 @@ typedef struct voice_state_s
|
||||
// opus stuff
|
||||
OpusCustomMode *custom_mode;
|
||||
OpusCustomEncoder *encoder;
|
||||
OpusCustomDecoder *decoder;
|
||||
OpusCustomDecoder *decoders[MAX_CLIENTS];
|
||||
|
||||
// audio info
|
||||
uint width;
|
||||
@@ -70,7 +71,7 @@ typedef struct voice_state_s
|
||||
|
||||
// buffers
|
||||
byte input_buffer[MAX_RAW_SAMPLES];
|
||||
byte output_buffer[MAX_RAW_SAMPLES];
|
||||
byte compress_buffer[MAX_RAW_SAMPLES];
|
||||
byte decompress_buffer[MAX_RAW_SAMPLES];
|
||||
fs_offset_t input_buffer_pos; // in bytes
|
||||
|
||||
@@ -92,7 +93,7 @@ extern voice_state_t voice;
|
||||
void CL_AddVoiceToDatagram( void );
|
||||
|
||||
void Voice_RegisterCvars( void );
|
||||
qboolean Voice_Init( const char *pszCodecName, int quality );
|
||||
qboolean Voice_Init( const char *pszCodecName, int quality, qboolean preinit );
|
||||
void Voice_Idle( double frametime );
|
||||
qboolean Voice_IsRecording( void );
|
||||
void Voice_RecordStop( void );
|
||||
|
||||
@@ -52,7 +52,7 @@ CSCR_ExpectString
|
||||
Return true if next token is pExpext and skip it
|
||||
===================
|
||||
*/
|
||||
qboolean CSCR_ExpectString( parserstate_t *ps, const char *pExpect, qboolean skip, qboolean error )
|
||||
static qboolean CSCR_ExpectString( parserstate_t *ps, const char *pExpect, qboolean skip, qboolean error )
|
||||
{
|
||||
char *tmp = COM_ParseFile( ps->buf, ps->token, sizeof( ps->token ));
|
||||
|
||||
@@ -75,7 +75,7 @@ CSCR_ParseType
|
||||
Determine script variable type
|
||||
===================
|
||||
*/
|
||||
cvartype_t CSCR_ParseType( parserstate_t *ps )
|
||||
static cvartype_t CSCR_ParseType( parserstate_t *ps )
|
||||
{
|
||||
int i;
|
||||
|
||||
@@ -96,7 +96,7 @@ cvartype_t CSCR_ParseType( parserstate_t *ps )
|
||||
CSCR_ParseSingleCvar
|
||||
=========================
|
||||
*/
|
||||
qboolean CSCR_ParseSingleCvar( parserstate_t *ps, scrvardef_t *result )
|
||||
static qboolean CSCR_ParseSingleCvar( parserstate_t *ps, scrvardef_t *result )
|
||||
{
|
||||
// read the name
|
||||
ps->buf = COM_ParseFile( ps->buf, result->name, sizeof( result->name ));
|
||||
@@ -170,7 +170,7 @@ CSCR_ParseHeader
|
||||
Check version and seek to first cvar name
|
||||
======================
|
||||
*/
|
||||
qboolean CSCR_ParseHeader( parserstate_t *ps )
|
||||
static qboolean CSCR_ParseHeader( parserstate_t *ps )
|
||||
{
|
||||
if( !CSCR_ExpectString( ps, "VERSION", false, true ))
|
||||
return false;
|
||||
|
||||
@@ -53,7 +53,7 @@ static void Cmd_ExecuteStringWithPrivilegeCheck( const char *text, qboolean isPr
|
||||
Cbuf_Init
|
||||
============
|
||||
*/
|
||||
void Cbuf_Init( void )
|
||||
static void Cbuf_Init( void )
|
||||
{
|
||||
cmd_text.data = cmd_text_buf;
|
||||
filteredcmd_text.data = filteredcmd_text_buf;
|
||||
@@ -79,7 +79,7 @@ void Cbuf_Clear( void )
|
||||
Cbuf_GetSpace
|
||||
============
|
||||
*/
|
||||
void *Cbuf_GetSpace( cmdbuf_t *buf, int length )
|
||||
static void *Cbuf_GetSpace( cmdbuf_t *buf, int length )
|
||||
{
|
||||
void *data;
|
||||
|
||||
@@ -176,7 +176,7 @@ void Cbuf_InsertText( const char *text )
|
||||
Cbuf_Execute
|
||||
============
|
||||
*/
|
||||
void Cbuf_ExecuteCommandsFromBuffer( cmdbuf_t *buf, qboolean isPrivileged, int cmdsToExecute )
|
||||
static void Cbuf_ExecuteCommandsFromBuffer( cmdbuf_t *buf, qboolean isPrivileged, int cmdsToExecute )
|
||||
{
|
||||
char *text;
|
||||
char line[MAX_CMD_LINE];
|
||||
@@ -356,7 +356,7 @@ hl.exe -dev 3 +map c1a0d
|
||||
hl.exe -nosound -game bshift
|
||||
===============
|
||||
*/
|
||||
void Cmd_StuffCmds_f( void )
|
||||
static void Cmd_StuffCmds_f( void )
|
||||
{
|
||||
host.stuffcmds_pending = true;
|
||||
}
|
||||
@@ -370,7 +370,7 @@ next frame. This allows commands like:
|
||||
bind g "cmd use rocket ; +attack ; wait ; -attack ; cmd use blaster"
|
||||
============
|
||||
*/
|
||||
void Cmd_Wait_f( void )
|
||||
static void Cmd_Wait_f( void )
|
||||
{
|
||||
cmd_wait = true;
|
||||
}
|
||||
@@ -382,7 +382,7 @@ Cmd_Echo_f
|
||||
Just prints the rest of the line to the console
|
||||
===============
|
||||
*/
|
||||
void Cmd_Echo_f( void )
|
||||
static void Cmd_Echo_f( void )
|
||||
{
|
||||
int i;
|
||||
|
||||
@@ -398,7 +398,7 @@ Cmd_Alias_f
|
||||
Creates a new command that executes a command string (possibly ; seperated)
|
||||
===============
|
||||
*/
|
||||
void Cmd_Alias_f( void )
|
||||
static void Cmd_Alias_f( void )
|
||||
{
|
||||
cmdalias_t *a;
|
||||
char cmd[MAX_CMD_LINE];
|
||||
@@ -529,7 +529,6 @@ typedef struct cmd_s
|
||||
static int cmd_argc;
|
||||
static const char *cmd_args = NULL;
|
||||
static char *cmd_argv[MAX_CMD_TOKENS];
|
||||
static char cmd_tokenized[MAX_CMD_BUFFER]; // will have 0 bytes inserted
|
||||
static cmd_t *cmd_functions; // possible commands to execute
|
||||
|
||||
/*
|
||||
@@ -882,7 +881,7 @@ Cmd_If_f
|
||||
Compare and et condition bit if true
|
||||
============
|
||||
*/
|
||||
void Cmd_If_f( void )
|
||||
static void Cmd_If_f( void )
|
||||
{
|
||||
// reset bit first
|
||||
cmd_condition &= ~BIT( cmd_condlevel );
|
||||
@@ -943,14 +942,14 @@ Cmd_Else_f
|
||||
Invert condition bit
|
||||
============
|
||||
*/
|
||||
void Cmd_Else_f( void )
|
||||
static void Cmd_Else_f( void )
|
||||
{
|
||||
cmd_condition ^= BIT( cmd_condlevel );
|
||||
}
|
||||
|
||||
static qboolean Cmd_ShouldAllowCommand( cmd_t *cmd, qboolean isPrivileged )
|
||||
{
|
||||
const char *prefixes[] = { "cl_", "gl_", "r_", "m_", "hud_" };
|
||||
const char *prefixes[] = { "cl_", "gl_", "r_", "m_", "hud_", "joy_" };
|
||||
int i;
|
||||
|
||||
// always allow local commands
|
||||
@@ -1179,7 +1178,7 @@ void Cmd_ForwardToServer( void )
|
||||
Cmd_List_f
|
||||
============
|
||||
*/
|
||||
void Cmd_List_f( void )
|
||||
static void Cmd_List_f( void )
|
||||
{
|
||||
cmd_t *cmd;
|
||||
int i = 0;
|
||||
|
||||
@@ -17,15 +17,24 @@ GNU General Public License for more details.
|
||||
#define COM_STRINGS_H
|
||||
|
||||
// default colored message headers
|
||||
#define S_NOTE "^2Note:^7 "
|
||||
#define S_WARN "^3Warning:^7 "
|
||||
#define S_ERROR "^1Error:^7 "
|
||||
#define S_USAGE "Usage: "
|
||||
#define S_USAGE_INDENT " "
|
||||
#define S_BLACK "^0"
|
||||
#define S_RED "^1"
|
||||
#define S_GREEN "^2"
|
||||
#define S_YELLOW "^3"
|
||||
#define S_BLUE "^4"
|
||||
#define S_CYAN "^5"
|
||||
#define S_MAGENTA "^6"
|
||||
#define S_DEFAULT "^7"
|
||||
|
||||
#define S_OPENGL_NOTE "^2OpenGL Note:^7 "
|
||||
#define S_OPENGL_WARN "^3OpenGL Warning:^7 "
|
||||
#define S_OPENGL_ERROR "^3OpenGL Error:^7 "
|
||||
#define S_NOTE S_GREEN "Note: " S_DEFAULT
|
||||
#define S_WARN S_YELLOW "Warning: " S_DEFAULT
|
||||
#define S_ERROR S_RED "Error: " S_DEFAULT
|
||||
#define S_USAGE "Usage: "
|
||||
#define S_USAGE_INDENT "\t"
|
||||
|
||||
#define S_OPENGL_NOTE S_GREEN "OpenGL Note: " S_DEFAULT
|
||||
#define S_OPENGL_WARN S_YELLOW "OpenGL Warning: " S_DEFAULT
|
||||
#define S_OPENGL_ERROR S_RED "OpenGL Error: " S_DEFAULT
|
||||
|
||||
// end game final default message
|
||||
#define DEFAULT_ENDGAME_MESSAGE "The End"
|
||||
@@ -65,6 +74,7 @@ GNU General Public License for more details.
|
||||
#define DEFAULT_UPDATE_PAGE "https://github.com/FWGS/xash3d-fwgs/releases/latest"
|
||||
|
||||
#define XASH_ENGINE_NAME "Xash3D FWGS"
|
||||
#define XASH_DEDICATED_SERVER_NAME "XashDS"
|
||||
#define XASH_VERSION "0.20" // engine current version
|
||||
#define XASH_COMPAT_VERSION "0.99" // version we are based on
|
||||
|
||||
|
||||
@@ -390,6 +390,9 @@ byte *LZSS_Compress( byte *pInput, int inputLength, uint *pOutputSize )
|
||||
byte *pFinal = NULL;
|
||||
lzss_state_t state;
|
||||
|
||||
if( !pStart )
|
||||
return NULL;
|
||||
|
||||
memset( &state, 0, sizeof( state ));
|
||||
state.window_size = LZSS_WINDOW_SIZE;
|
||||
|
||||
@@ -531,47 +534,6 @@ int GAME_EXPORT COM_FileSize( const char *filename )
|
||||
return FS_FileSize( filename, false );
|
||||
}
|
||||
|
||||
/*
|
||||
=============
|
||||
COM_AddAppDirectoryToSearchPath
|
||||
|
||||
=============
|
||||
*/
|
||||
void GAME_EXPORT COM_AddAppDirectoryToSearchPath( const char *pszBaseDir, const char *appName )
|
||||
{
|
||||
FS_AddGameHierarchy( pszBaseDir, FS_NOWRITE_PATH );
|
||||
}
|
||||
|
||||
/*
|
||||
===========
|
||||
COM_ExpandFilename
|
||||
|
||||
Finds the file in the search path, copies over the name with the full path name.
|
||||
This doesn't search in the pak file.
|
||||
===========
|
||||
*/
|
||||
int GAME_EXPORT COM_ExpandFilename( const char *fileName, char *nameOutBuffer, int nameOutBufferSize )
|
||||
{
|
||||
char result[MAX_SYSPATH];
|
||||
|
||||
if( !COM_CheckString( fileName ) || !nameOutBuffer || nameOutBufferSize <= 0 )
|
||||
return 0;
|
||||
|
||||
// filename examples:
|
||||
// media\sierra.avi - D:\Xash3D\valve\media\sierra.avi
|
||||
// models\barney.mdl - D:\Xash3D\bshift\models\barney.mdl
|
||||
if( g_fsapi.GetFullDiskPath( result, sizeof( result ), fileName, false ))
|
||||
{
|
||||
// check for enough room
|
||||
if( Q_strlen( result ) > nameOutBufferSize )
|
||||
return 0;
|
||||
|
||||
Q_strncpy( nameOutBuffer, result, nameOutBufferSize );
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
=============
|
||||
COM_TrimSpace
|
||||
@@ -734,7 +696,7 @@ COM_LoadFileForMe
|
||||
byte *GAME_EXPORT COM_LoadFileForMe( const char *filename, int *pLength )
|
||||
{
|
||||
string name;
|
||||
byte *file, *pfile;
|
||||
byte *pfile;
|
||||
fs_offset_t iLength;
|
||||
|
||||
if( !COM_CheckString( filename ))
|
||||
@@ -747,21 +709,9 @@ byte *GAME_EXPORT COM_LoadFileForMe( const char *filename, int *pLength )
|
||||
Q_strncpy( name, filename, sizeof( name ));
|
||||
COM_FixSlashes( name );
|
||||
|
||||
pfile = FS_LoadFile( name, &iLength, false );
|
||||
pfile = g_fsapi.LoadFileMalloc( name, &iLength, false );
|
||||
if( pLength ) *pLength = (int)iLength;
|
||||
|
||||
if( pfile )
|
||||
{
|
||||
file = malloc( iLength + 1 );
|
||||
if( file != NULL )
|
||||
{
|
||||
memcpy( file, pfile, iLength );
|
||||
file[iLength] = '\0';
|
||||
}
|
||||
Mem_Free( pfile );
|
||||
pfile = file;
|
||||
}
|
||||
|
||||
return pfile;
|
||||
}
|
||||
|
||||
@@ -869,18 +819,6 @@ cvar_t *GAME_EXPORT pfnCVarGetPointer( const char *szVarName )
|
||||
return (cvar_t *)Cvar_FindVar( szVarName );
|
||||
}
|
||||
|
||||
/*
|
||||
=============
|
||||
pfnCVarDirectSet
|
||||
|
||||
allow to set cvar directly
|
||||
=============
|
||||
*/
|
||||
void GAME_EXPORT pfnCVarDirectSet( cvar_t *var, const char *szValue )
|
||||
{
|
||||
Cvar_DirectSet( (convar_t *)var, szValue );
|
||||
}
|
||||
|
||||
/*
|
||||
=============
|
||||
COM_CompareFileTime
|
||||
@@ -996,21 +934,6 @@ qboolean COM_IsSafeFileToDownload( const char *filename )
|
||||
return true;
|
||||
}
|
||||
|
||||
const char *COM_GetResourceTypeName( resourcetype_t restype )
|
||||
{
|
||||
switch( restype )
|
||||
{
|
||||
case t_decal: return "decal";
|
||||
case t_eventscript: return "eventscript";
|
||||
case t_generic: return "generic";
|
||||
case t_model: return "model";
|
||||
case t_skin: return "skin";
|
||||
case t_sound: return "sound";
|
||||
case t_world: return "world";
|
||||
default: return "unknown";
|
||||
}
|
||||
}
|
||||
|
||||
char *_copystring( poolhandle_t mempool, const char *s, const char *filename, int fileline )
|
||||
{
|
||||
size_t size;
|
||||
|
||||
@@ -273,12 +273,8 @@ typedef struct
|
||||
|
||||
typedef enum bugcomp_e
|
||||
{
|
||||
// default mode, we assume that user dlls are not relying on engine bugs
|
||||
BUGCOMP_OFF,
|
||||
|
||||
// GoldSrc mode, user dlls are relying on GoldSrc specific bugs
|
||||
// but fixing them may break regular Xash games
|
||||
BUGCOMP_GOLDSRC,
|
||||
// reverts fix for pfnPEntityOfEntIndex for bug compatibility with GoldSrc
|
||||
BUGCOMP_PENTITYOFENTINDEX_FLAG = BIT( 0 ),
|
||||
} bugcomp_t;
|
||||
|
||||
typedef struct host_parm_s
|
||||
@@ -356,7 +352,7 @@ typedef struct host_parm_s
|
||||
int numdecals;
|
||||
|
||||
// bug compatibility level, for very "special" games
|
||||
bugcomp_t bugcomp;
|
||||
uint32_t bugcomp;
|
||||
|
||||
// measure time to first frame
|
||||
double starttime;
|
||||
@@ -388,7 +384,6 @@ void *FS_GetNativeObject( const char *obj );
|
||||
//
|
||||
// cmd.c
|
||||
//
|
||||
void Cbuf_Init( void );
|
||||
void Cbuf_Clear( void );
|
||||
void Cbuf_AddText( const char *text );
|
||||
void Cbuf_AddTextf( const char *text, ... ) _format( 1 );
|
||||
@@ -412,9 +407,6 @@ void Cmd_RemoveCommand( const char *cmd_name );
|
||||
qboolean Cmd_Exists( const char *cmd_name );
|
||||
void Cmd_LookupCmds( void *buffer, void *ptr, setpair_t callback );
|
||||
int Cmd_ListMaps( search_t *t , char *lastmapname, size_t len );
|
||||
qboolean Cmd_GetMapList( const char *s, char *completedname, int length );
|
||||
qboolean Cmd_GetDemoList( const char *s, char *completedname, int length );
|
||||
qboolean Cmd_GetMovieList( const char *s, char *completedname, int length );
|
||||
void Cmd_TokenizeString( const char *text );
|
||||
void Cmd_ExecuteString( const char *text );
|
||||
void Cmd_ForwardToServer( void );
|
||||
@@ -461,13 +453,12 @@ void FS_FreeImage( rgbdata_t *pack );
|
||||
extern const bpc_desc_t PFDesc[]; // image get pixelformat
|
||||
qboolean Image_Process( rgbdata_t **pix, int width, int height, uint flags, float reserved );
|
||||
void Image_PaletteHueReplace( byte *palSrc, int newHue, int start, int end, int pal_size );
|
||||
void Image_PaletteTranslate( byte *palSrc, int top, int bottom, int pal_size );
|
||||
void Image_SetForceFlags( uint flags ); // set image force flags on loading
|
||||
size_t Image_DXTGetLinearSize( int type, int width, int height, int depth );
|
||||
qboolean Image_CustomPalette( void );
|
||||
void Image_ClearForceFlags( void );
|
||||
void Image_SetMDLPointer( byte *p );
|
||||
void Image_CheckPaletteQ1( void );
|
||||
|
||||
/*
|
||||
========================================================================
|
||||
|
||||
@@ -543,7 +534,6 @@ qboolean Host_IsQuakeCompatible( void );
|
||||
void EXPORT Host_Shutdown( void );
|
||||
int EXPORT Host_Main( int argc, char **argv, const char *progname, int bChangeGame, pfnChangeGame func );
|
||||
int Host_CompareFileTime( int ft1, int ft2 );
|
||||
void Host_NewInstance( const char *name, const char *finalmsg );
|
||||
void Host_EndGame( qboolean abort, const char *message, ... ) _format( 2 );
|
||||
void Host_AbortCurrentFrame( void ) NORETURN;
|
||||
void Host_WriteServerConfig( const char *name );
|
||||
@@ -556,7 +546,6 @@ void Host_ShutdownServer( void );
|
||||
void Host_Error( const char *error, ... ) _format( 1 );
|
||||
void Host_ValidateEngineFeatures( uint32_t features );
|
||||
void Host_Frame( float time );
|
||||
void Host_InitDecals( void );
|
||||
void Host_Credits( void );
|
||||
|
||||
//
|
||||
@@ -600,7 +589,6 @@ void COM_HexConvert( const char *pszInput, int nInputLength, byte *pOutput );
|
||||
int COM_SaveFile( const char *filename, const void *data, int len );
|
||||
byte* COM_LoadFileForMe( const char *filename, int *pLength );
|
||||
qboolean COM_IsSafeFileToDownload( const char *filename );
|
||||
const char *COM_GetResourceTypeName( resourcetype_t restype );
|
||||
cvar_t *pfnCVarGetPointer( const char *szVarName );
|
||||
int pfnDrawConsoleString( int x, int y, char *string );
|
||||
void pfnDrawSetTextColor( float r, float g, float b );
|
||||
@@ -608,7 +596,6 @@ void pfnDrawConsoleStringLen( const char *pText, int *length, int *height );
|
||||
void *Cache_Check( poolhandle_t mempool, struct cache_user_s *c );
|
||||
void COM_TrimSpace( const char *source, char *dest );
|
||||
void pfnGetModelBounds( model_t *mod, float *mins, float *maxs );
|
||||
void pfnCVarDirectSet( cvar_t *var, const char *szValue );
|
||||
int COM_CheckParm( char *parm, char **ppnext );
|
||||
void pfnGetGameDir( char *szGetGameDir );
|
||||
int pfnGetModelType( model_t *mod );
|
||||
@@ -650,7 +637,6 @@ void pfnResetTutorMessageDecayData( void );
|
||||
//
|
||||
// con_utils.c
|
||||
//
|
||||
qboolean Cmd_AutocompleteName( const char *source, int arg, char *buffer, size_t bufsize );
|
||||
void Con_CompleteCommand( field_t *field );
|
||||
void Cmd_AutoComplete( char *complete_string );
|
||||
void Cmd_AutoCompleteClear( void );
|
||||
@@ -706,24 +692,15 @@ void CL_LegacyUpdateInfo( void );
|
||||
void CL_CharEvent( int key );
|
||||
qboolean CL_DisableVisibility( void );
|
||||
byte *COM_LoadFile( const char *filename, int usehunk, int *pLength );
|
||||
int CL_GetDemoComment( const char *demoname, char *comment );
|
||||
void COM_AddAppDirectoryToSearchPath( const char *pszBaseDir, const char *appName );
|
||||
int COM_ExpandFilename( const char *fileName, char *nameOutBuffer, int nameOutBufferSize );
|
||||
struct cmd_s *Cmd_GetFirstFunctionHandle( void );
|
||||
struct cmd_s *Cmd_GetNextFunctionHandle( struct cmd_s *cmd );
|
||||
struct cmdalias_s *Cmd_AliasGetList( void );
|
||||
const char *Cmd_GetName( struct cmd_s *cmd );
|
||||
void SV_StartSound( edict_t *ent, int chan, const char *sample, float vol, float attn, int flags, int pitch );
|
||||
void SV_CreateDecal( sizebuf_t *msg, const float *origin, int decalIndex, int entityIndex, int modelIndex, int flags, float scale );
|
||||
void Log_Printf( const char *fmt, ... ) _format( 1 );
|
||||
void SV_BroadcastCommand( const char *fmt, ... ) _format( 1 );
|
||||
qboolean SV_RestoreCustomDecal( struct decallist_s *entry, edict_t *pEdict, qboolean adjacent );
|
||||
void SV_BroadcastPrintf( struct sv_client_s *ignore, const char *fmt, ... ) _format( 2 );
|
||||
int R_CreateDecalList( struct decallist_s *pList );
|
||||
void R_ClearAllDecals( void );
|
||||
void CL_ClearStaticEntities( void );
|
||||
qboolean S_StreamGetCurrentState( char *currentTrack, char *loopTrack, int *position );
|
||||
struct cl_entity_s *CL_GetEntityByIndex( int index );
|
||||
void CL_ServerCommand( qboolean reliable, const char *fmt, ... ) _format( 2 );
|
||||
void CL_HudMessage( const char *pMessage );
|
||||
const char *CL_MsgInfo( int cmd );
|
||||
@@ -732,17 +709,14 @@ void SV_DrawOrthoTriangles( void );
|
||||
double CL_GetDemoFramerate( void );
|
||||
qboolean UI_CreditsActive( void );
|
||||
void CL_StopPlayback( void );
|
||||
void CL_ExtraUpdate( void );
|
||||
int CL_GetMaxClients( void );
|
||||
int SV_GetMaxClients( void );
|
||||
qboolean CL_IsRecordDemo( void );
|
||||
qboolean CL_IsTimeDemo( void );
|
||||
qboolean CL_IsPlaybackDemo( void );
|
||||
qboolean SV_Initialized( void );
|
||||
qboolean CL_LoadProgs( const char *name );
|
||||
void CL_ProcessFile( qboolean successfully_received, const char *filename );
|
||||
int SV_GetSaveComment( const char *savename, char *comment );
|
||||
qboolean SV_NewGame( const char *mapName, qboolean loadGame );
|
||||
void SV_ClipPMoveToEntity( struct physent_s *pe, const vec3_t start, vec3_t mins, vec3_t maxs, const vec3_t end, struct pmtrace_s *tr );
|
||||
void CL_ClipPMoveToEntity( struct physent_s *pe, const vec3_t start, vec3_t mins, vec3_t maxs, const vec3_t end, struct pmtrace_s *tr );
|
||||
void SV_SysError( const char *error_string );
|
||||
@@ -751,11 +725,9 @@ void SV_ExecLoadLevel( void );
|
||||
void SV_ExecLoadGame( void );
|
||||
void SV_ExecChangeLevel( void );
|
||||
void CL_WriteMessageHistory( void );
|
||||
void CL_SendCmd( void );
|
||||
void CL_Disconnect( void );
|
||||
void CL_ClearEdicts( void );
|
||||
void CL_Crashed( void );
|
||||
qboolean CL_NextDemo( void );
|
||||
char *SV_Serverinfo( void );
|
||||
void CL_Drop( void );
|
||||
void Con_Init( void );
|
||||
@@ -780,7 +752,6 @@ qboolean Info_SetValueForStarKey( char *s, const char *key, const char *value, i
|
||||
qboolean Info_IsValid( const char *s );
|
||||
void Info_WriteVars( file_t *f );
|
||||
void Info_Print( const char *s );
|
||||
void Cmd_WriteVariables( file_t *f );
|
||||
int Cmd_CheckMapsList( int fRefresh );
|
||||
void COM_SetRandomSeed( int lSeed );
|
||||
int COM_RandomLong( int lMin, int lMax );
|
||||
@@ -802,6 +773,7 @@ int COM_FileSize( const char *filename );
|
||||
void COM_FreeFile( void *buffer );
|
||||
int COM_CompareFileTime( const char *filename1, const char *filename2, int *iCompare );
|
||||
char *va( const char *format, ... ) _format( 1 );
|
||||
qboolean CRC32_MapFile( dword *crcvalue, const char *filename, qboolean multiplayer );
|
||||
|
||||
// soundlib shared exports
|
||||
qboolean S_Init( void );
|
||||
@@ -819,6 +791,7 @@ uint ScreenGammaTable( uint );
|
||||
uint LinearGammaTable( uint );
|
||||
void V_Init( void );
|
||||
void V_CheckGamma( void );
|
||||
void V_CheckGammaEnd( void );
|
||||
|
||||
//
|
||||
// identification.c
|
||||
@@ -839,6 +812,34 @@ void NET_MasterClear( void );
|
||||
void NET_MasterShutdown( void );
|
||||
qboolean NET_GetMaster( netadr_t from, uint *challenge, double *last_heartbeat );
|
||||
|
||||
//
|
||||
// sounds.c
|
||||
//
|
||||
typedef enum soundlst_group_e
|
||||
{
|
||||
BouncePlayerShell = 0,
|
||||
BounceWeaponShell,
|
||||
BounceConcrete,
|
||||
BounceGlass,
|
||||
BounceMetal,
|
||||
BounceFlesh,
|
||||
BounceWood,
|
||||
Ricochet,
|
||||
Explode,
|
||||
PlayerWaterEnter,
|
||||
PlayerWaterExit,
|
||||
EntityWaterEnter,
|
||||
EntityWaterExit,
|
||||
|
||||
SoundList_Groups // must be last
|
||||
} soundlst_group_t;
|
||||
|
||||
int SoundList_Count( soundlst_group_t group );
|
||||
const char *SoundList_GetRandom( soundlst_group_t group );
|
||||
const char *SoundList_Get( soundlst_group_t group, int idx );
|
||||
void SoundList_Init( void );
|
||||
void SoundList_Shutdown( void );
|
||||
|
||||
#ifdef REF_DLL
|
||||
#error "common.h in ref_dll"
|
||||
#endif
|
||||
|
||||
@@ -184,7 +184,7 @@ Cmd_GetMapList
|
||||
Prints or complete map filename
|
||||
=====================================
|
||||
*/
|
||||
qboolean Cmd_GetMapList( const char *s, char *completedname, int length )
|
||||
static qboolean Cmd_GetMapList( const char *s, char *completedname, int length )
|
||||
{
|
||||
search_t *t;
|
||||
string matchbuf;
|
||||
@@ -220,7 +220,7 @@ Cmd_GetDemoList
|
||||
Prints or complete demo filename
|
||||
=====================================
|
||||
*/
|
||||
qboolean Cmd_GetDemoList( const char *s, char *completedname, int length )
|
||||
static qboolean Cmd_GetDemoList( const char *s, char *completedname, int length )
|
||||
{
|
||||
search_t *t;
|
||||
string matchbuf;
|
||||
@@ -267,7 +267,7 @@ Cmd_GetMovieList
|
||||
Prints or complete movie filename
|
||||
=====================================
|
||||
*/
|
||||
qboolean Cmd_GetMovieList( const char *s, char *completedname, int length )
|
||||
static qboolean Cmd_GetMovieList( const char *s, char *completedname, int length )
|
||||
{
|
||||
search_t *t;
|
||||
string matchbuf;
|
||||
@@ -314,7 +314,7 @@ Cmd_GetMusicList
|
||||
Prints or complete background track filename
|
||||
=====================================
|
||||
*/
|
||||
qboolean Cmd_GetMusicList( const char *s, char *completedname, int length )
|
||||
static qboolean Cmd_GetMusicList( const char *s, char *completedname, int length )
|
||||
{
|
||||
search_t *t;
|
||||
string matchbuf;
|
||||
@@ -362,7 +362,7 @@ Cmd_GetSavesList
|
||||
Prints or complete savegame filename
|
||||
=====================================
|
||||
*/
|
||||
qboolean Cmd_GetSavesList( const char *s, char *completedname, int length )
|
||||
static qboolean Cmd_GetSavesList( const char *s, char *completedname, int length )
|
||||
{
|
||||
search_t *t;
|
||||
string matchbuf;
|
||||
@@ -409,7 +409,7 @@ Cmd_GetConfigList
|
||||
Prints or complete .cfg filename
|
||||
=====================================
|
||||
*/
|
||||
qboolean Cmd_GetConfigList( const char *s, char *completedname, int length )
|
||||
static qboolean Cmd_GetConfigList( const char *s, char *completedname, int length )
|
||||
{
|
||||
search_t *t;
|
||||
string matchbuf;
|
||||
@@ -456,7 +456,7 @@ Cmd_GetSoundList
|
||||
Prints or complete sound filename
|
||||
=====================================
|
||||
*/
|
||||
qboolean Cmd_GetSoundList( const char *s, char *completedname, int length )
|
||||
static qboolean Cmd_GetSoundList( const char *s, char *completedname, int length )
|
||||
{
|
||||
search_t *t;
|
||||
string matchbuf;
|
||||
@@ -508,7 +508,7 @@ Cmd_GetItemsList
|
||||
Prints or complete item classname (weapons only)
|
||||
=====================================
|
||||
*/
|
||||
qboolean Cmd_GetItemsList( const char *s, char *completedname, int length )
|
||||
static qboolean Cmd_GetItemsList( const char *s, char *completedname, int length )
|
||||
{
|
||||
search_t *t;
|
||||
string matchbuf;
|
||||
@@ -555,7 +555,7 @@ Cmd_GetKeysList
|
||||
Autocomplete for bind command
|
||||
=====================================
|
||||
*/
|
||||
qboolean Cmd_GetKeysList( const char *s, char *completedname, int length )
|
||||
static qboolean Cmd_GetKeysList( const char *s, char *completedname, int length )
|
||||
{
|
||||
size_t i, numkeys;
|
||||
string keys[256];
|
||||
@@ -636,7 +636,7 @@ Cmd_GetCommandsList
|
||||
Autocomplete for bind command
|
||||
=====================================
|
||||
*/
|
||||
qboolean Cmd_GetCommandsList( const char *s, char *completedname, int length )
|
||||
static qboolean Cmd_GetCommandsList( const char *s, char *completedname, int length )
|
||||
{
|
||||
size_t i;
|
||||
string matchbuf;
|
||||
@@ -701,7 +701,7 @@ Cmd_GetCustomList
|
||||
Prints or complete .HPK filenames
|
||||
=====================================
|
||||
*/
|
||||
qboolean Cmd_GetCustomList( const char *s, char *completedname, int length )
|
||||
static qboolean Cmd_GetCustomList( const char *s, char *completedname, int length )
|
||||
{
|
||||
search_t *t;
|
||||
string matchbuf;
|
||||
@@ -747,17 +747,13 @@ Cmd_GetGameList
|
||||
Prints or complete gamedir name
|
||||
=====================================
|
||||
*/
|
||||
qboolean Cmd_GetGamesList( const char *s, char *completedname, int length )
|
||||
static qboolean Cmd_GetGamesList( const char *s, char *completedname, int length )
|
||||
{
|
||||
int i, numgamedirs;
|
||||
string gamedirs[MAX_MODS];
|
||||
string matchbuf;
|
||||
int len;
|
||||
|
||||
// stand-alone games doesn't have cmd "game"
|
||||
if( !Cmd_Exists( "game" ))
|
||||
return false;
|
||||
|
||||
// compare gamelist with current keyword
|
||||
len = Q_strlen( s );
|
||||
|
||||
@@ -800,7 +796,7 @@ Cmd_GetCDList
|
||||
Prints or complete CD command name
|
||||
=====================================
|
||||
*/
|
||||
qboolean Cmd_GetCDList( const char *s, char *completedname, int length )
|
||||
static qboolean Cmd_GetCDList( const char *s, char *completedname, int length )
|
||||
{
|
||||
int i, numcdcommands;
|
||||
string cdcommands[8];
|
||||
@@ -854,7 +850,7 @@ qboolean Cmd_GetCDList( const char *s, char *completedname, int length )
|
||||
return true;
|
||||
}
|
||||
|
||||
qboolean Cmd_CheckMapsList_R( qboolean fRefresh, qboolean onlyingamedir )
|
||||
static qboolean Cmd_CheckMapsList_R( qboolean fRefresh, qboolean onlyingamedir )
|
||||
{
|
||||
qboolean use_filter = false;
|
||||
byte buf[MAX_SYSPATH];
|
||||
@@ -870,7 +866,7 @@ qboolean Cmd_CheckMapsList_R( qboolean fRefresh, qboolean onlyingamedir )
|
||||
return true; // exist
|
||||
|
||||
// setup mpfilter
|
||||
size = Q_snprintf( mpfilter, sizeof( mpfilter ), "maps/%s", GI->mp_filter );
|
||||
Q_snprintf( mpfilter, sizeof( mpfilter ), "maps/%s", GI->mp_filter );
|
||||
t = FS_Search( "maps/*.bsp", false, onlyingamedir );
|
||||
|
||||
if( !t )
|
||||
@@ -904,9 +900,9 @@ qboolean Cmd_CheckMapsList_R( qboolean fRefresh, qboolean onlyingamedir )
|
||||
|
||||
if( f )
|
||||
{
|
||||
int num_spawnpoints = 0;
|
||||
dheader_t *header;
|
||||
dlump_t entities;
|
||||
qboolean have_spawnpoints = false;
|
||||
dheader_t *header;
|
||||
dlump_t entities;
|
||||
|
||||
memset( buf, 0, MAX_SYSPATH );
|
||||
FS_Read( f, buf, MAX_SYSPATH );
|
||||
@@ -947,7 +943,18 @@ qboolean Cmd_CheckMapsList_R( qboolean fRefresh, qboolean onlyingamedir )
|
||||
while(( pfile = COM_ParseFile( pfile, token, sizeof( token ))) != NULL )
|
||||
{
|
||||
if( token[0] == '}' && worldspawn )
|
||||
{
|
||||
worldspawn = false;
|
||||
|
||||
// if mod has mp_filter set up, then it's a mod that
|
||||
// might not have valid mp_entity set in GI
|
||||
// if mod is multiplayer only, assume all maps are valid
|
||||
if( use_filter || GI->gamemode == GAME_MULTIPLAYER_ONLY )
|
||||
{
|
||||
have_spawnpoints = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
else if( !Q_strcmp( token, "message" ) && worldspawn )
|
||||
{
|
||||
// get the message contents
|
||||
@@ -956,17 +963,23 @@ qboolean Cmd_CheckMapsList_R( qboolean fRefresh, qboolean onlyingamedir )
|
||||
else if( !Q_strcmp( token, "classname" ))
|
||||
{
|
||||
pfile = COM_ParseFile( pfile, token, sizeof( token ));
|
||||
if( !Q_strcmp( token, GI->mp_entity ) || use_filter )
|
||||
num_spawnpoints++;
|
||||
|
||||
if( !Q_strcmp( token, GI->mp_entity ))
|
||||
{
|
||||
have_spawnpoints = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if( num_spawnpoints ) break; // valid map
|
||||
|
||||
if( have_spawnpoints )
|
||||
break; // valid map
|
||||
}
|
||||
Mem_Free( ents );
|
||||
}
|
||||
|
||||
if( f ) FS_Close( f );
|
||||
|
||||
if( num_spawnpoints )
|
||||
if( have_spawnpoints )
|
||||
{
|
||||
// format: mapname "maptitle"\n
|
||||
Q_snprintf( result, sizeof( result ), "%s \"%s\"\n", mapname, message );
|
||||
@@ -1061,7 +1074,7 @@ Autocomplete filename
|
||||
for various cmds
|
||||
============
|
||||
*/
|
||||
qboolean Cmd_AutocompleteName( const char *source, int arg, char *buffer, size_t bufsize )
|
||||
static qboolean Cmd_AutocompleteName( const char *source, int arg, char *buffer, size_t bufsize )
|
||||
{
|
||||
autocomplete_list_t *list;
|
||||
|
||||
@@ -1345,13 +1358,13 @@ static void Cmd_WriteHelp(const char *name, const char *unused, const char *desc
|
||||
if( length == 0 ) FS_Printf( f, "%s \"%s\"\n", name, desc );
|
||||
}
|
||||
|
||||
void Cmd_WriteOpenGLVariables( file_t *f )
|
||||
static void Cmd_WriteOpenGLVariables( file_t *f )
|
||||
{
|
||||
Cvar_LookupVars( FCVAR_GLCONFIG, NULL, f, (setpair_t)Cmd_WriteOpenGLCvar );
|
||||
}
|
||||
|
||||
#if !XASH_DEDICATED
|
||||
void Host_FinalizeConfig( file_t *f, const char *config )
|
||||
static void Host_FinalizeConfig( file_t *f, const char *config )
|
||||
{
|
||||
string backup, newcfg;
|
||||
|
||||
|
||||
@@ -372,9 +372,9 @@ static void Sys_Crash( int signal, siginfo_t *si, void *context)
|
||||
bp = (void**)ucontext->uc_mcontext.mc_rbp;
|
||||
sp = (void**)ucontext->uc_mcontext.mc_rsp;
|
||||
#elif XASH_NETBSD
|
||||
pc = (void*)ucontext->uc_mcontext.__gregs[REG_RIP];
|
||||
bp = (void**)ucontext->uc_mcontext.__gregs[REG_RBP];
|
||||
sp = (void**)ucontext->uc_mcontext.__gregs[REG_RSP];
|
||||
pc = (void*)ucontext->uc_mcontext.__gregs[_REG_RIP];
|
||||
bp = (void**)ucontext->uc_mcontext.__gregs[_REG_RBP];
|
||||
sp = (void**)ucontext->uc_mcontext.__gregs[_REG_RSP];
|
||||
#elif XASH_OPENBSD
|
||||
pc = (void*)ucontext->sc_rip;
|
||||
bp = (void**)ucontext->sc_rbp;
|
||||
@@ -490,13 +490,14 @@ static void Sys_Crash( int signal, siginfo_t *si, void *context)
|
||||
#ifdef XASH_SDL
|
||||
SDL_SetWindowGrab( host.hWnd, SDL_FALSE );
|
||||
#endif
|
||||
host.crashed = true;
|
||||
Platform_MessageBox( "Xash Error", message, false );
|
||||
|
||||
// log saved, now we can try to save configs and close log correctly, it may crash
|
||||
if( host.type == HOST_NORMAL )
|
||||
CL_Crashed();
|
||||
host.status = HOST_CRASHED;
|
||||
host.crashed = true;
|
||||
|
||||
|
||||
Sys_Quit();
|
||||
}
|
||||
|
||||
@@ -152,8 +152,10 @@ static qboolean Cvar_UpdateInfo( convar_t *var, const char *value, qboolean noti
|
||||
if ( Host_IsDedicated() )
|
||||
{
|
||||
// g-cont. this is a very strange behavior...
|
||||
Info_SetValueForKey( SV_Serverinfo(), var->name, value, MAX_SERVERINFO_STRING ),
|
||||
SV_BroadcastCommand( "fullserverinfo \"%s\"\n", SV_Serverinfo( ));
|
||||
char *info = SV_Serverinfo();
|
||||
|
||||
Info_SetValueForKey( info, var->name, value, MAX_SERVERINFO_STRING ),
|
||||
SV_BroadcastCommand( "fullserverinfo \"%s\"\n", info );
|
||||
}
|
||||
#if !XASH_DEDICATED
|
||||
else
|
||||
@@ -195,7 +197,7 @@ Cvar_ValidateString
|
||||
deal with userinfo etc
|
||||
============
|
||||
*/
|
||||
const char *Cvar_ValidateString( convar_t *var, const char *value )
|
||||
static const char *Cvar_ValidateString( convar_t *var, const char *value )
|
||||
{
|
||||
const char *pszValue;
|
||||
static char szNew[MAX_STRING];
|
||||
@@ -278,7 +280,7 @@ Cvar_UnlinkVar
|
||||
unlink the variable
|
||||
============
|
||||
*/
|
||||
int Cvar_UnlinkVar( const char *var_name, int group )
|
||||
static int Cvar_UnlinkVar( const char *var_name, int group )
|
||||
{
|
||||
int count = 0;
|
||||
convar_t **prev;
|
||||
@@ -685,7 +687,7 @@ Cvar_DirectSet
|
||||
way to change value for many cvars
|
||||
============
|
||||
*/
|
||||
void Cvar_DirectSet( convar_t *var, const char *value )
|
||||
void GAME_EXPORT Cvar_DirectSet( convar_t *var, const char *value )
|
||||
{
|
||||
const char *pszValue;
|
||||
|
||||
@@ -953,7 +955,7 @@ static void Cvar_SetGL( const char *name, const char *value )
|
||||
|
||||
static qboolean Cvar_ShouldSetCvar( convar_t *v, qboolean isPrivileged )
|
||||
{
|
||||
const char *prefixes[] = { "cl_", "gl_", "m_", "r_", "hud_" };
|
||||
const char *prefixes[] = { "cl_", "gl_", "m_", "r_", "hud_", "joy_" };
|
||||
int i;
|
||||
|
||||
if( isPrivileged )
|
||||
@@ -1091,7 +1093,7 @@ Cvar_Toggle_f
|
||||
Toggles a cvar for easy single key binding
|
||||
============
|
||||
*/
|
||||
void Cvar_Toggle_f( void )
|
||||
static void Cvar_Toggle_f( void )
|
||||
{
|
||||
int v;
|
||||
|
||||
@@ -1114,7 +1116,7 @@ Allows setting and defining of arbitrary cvars from console, even if they
|
||||
weren't declared in C code.
|
||||
============
|
||||
*/
|
||||
void Cvar_Set_f( void )
|
||||
static void Cvar_Set_f( void )
|
||||
{
|
||||
int i, c, l = 0, len;
|
||||
char combined[MAX_CMD_TOKENS];
|
||||
@@ -1147,7 +1149,7 @@ Cvar_SetGL_f
|
||||
As Cvar_Set, but also flags it as glconfig
|
||||
============
|
||||
*/
|
||||
void Cvar_SetGL_f( void )
|
||||
static void Cvar_SetGL_f( void )
|
||||
{
|
||||
if( Cmd_Argc() != 3 )
|
||||
{
|
||||
@@ -1163,7 +1165,7 @@ void Cvar_SetGL_f( void )
|
||||
Cvar_Reset_f
|
||||
============
|
||||
*/
|
||||
void Cvar_Reset_f( void )
|
||||
static void Cvar_Reset_f( void )
|
||||
{
|
||||
if( Cmd_Argc() != 2 )
|
||||
{
|
||||
@@ -1179,7 +1181,7 @@ void Cvar_Reset_f( void )
|
||||
Cvar_List_f
|
||||
============
|
||||
*/
|
||||
void Cvar_List_f( void )
|
||||
static void Cvar_List_f( void )
|
||||
{
|
||||
convar_t *var;
|
||||
const char *match = NULL;
|
||||
|
||||
@@ -134,15 +134,6 @@ void Con_Init( void )
|
||||
|
||||
}
|
||||
|
||||
void R_ClearAllDecals( void )
|
||||
{
|
||||
|
||||
}
|
||||
int R_CreateDecalList( struct decallist_s *pList )
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
void GAME_EXPORT S_StopSound(int entnum, int channel, const char *soundname)
|
||||
{
|
||||
|
||||
|
||||
@@ -65,7 +65,33 @@ static CVAR_DEFINE( host_sleeptime, "sleeptime", "1", FCVAR_ARCHIVE|FCVAR_FILTER
|
||||
static CVAR_DEFINE_AUTO( host_sleeptime_debug, "0", 0, "print sleeps between frames" );
|
||||
CVAR_DEFINE( con_gamemaps, "con_mapfilter", "1", FCVAR_ARCHIVE, "when true show only maps in game folder" );
|
||||
|
||||
void Sys_PrintUsage( void )
|
||||
typedef struct feature_message_s
|
||||
{
|
||||
uint32_t mask;
|
||||
const char *msg;
|
||||
const char *arg;
|
||||
} feature_message_t;
|
||||
|
||||
static feature_message_t bugcomp_features[] =
|
||||
{
|
||||
{ BUGCOMP_PENTITYOFENTINDEX_FLAG, "pfnPEntityOfEntIndex bugfix revert", "peoei" },
|
||||
};
|
||||
|
||||
static feature_message_t engine_features[] =
|
||||
{
|
||||
{ ENGINE_WRITE_LARGE_COORD, "Big World Support" },
|
||||
{ ENGINE_QUAKE_COMPATIBLE, "Quake Compatibility" },
|
||||
{ ENGINE_LOAD_DELUXEDATA, "Deluxemap Support" },
|
||||
{ ENGINE_PHYSICS_PUSHER_EXT, "Improved MOVETYPE_PUSH" },
|
||||
{ ENGINE_LARGE_LIGHTMAPS, "Large Lightmaps" },
|
||||
{ ENGINE_COMPENSATE_QUAKE_BUG, "Stupid Quake Bug Compensation" },
|
||||
{ ENGINE_IMPROVED_LINETRACE, "Improved Trace Line" },
|
||||
{ ENGINE_COMPUTE_STUDIO_LERP, "Studio MOVETYPE_STEP Lerping" },
|
||||
{ ENGINE_LINEAR_GAMMA_SPACE, "Linear Gamma Space" },
|
||||
{ ENGINE_STEP_POSHISTORY_LERP, "MOVETYPE_STEP Position History Based Lerping" },
|
||||
};
|
||||
|
||||
static void Sys_PrintUsage( void )
|
||||
{
|
||||
string version_str;
|
||||
const char *usage_str;
|
||||
@@ -92,8 +118,9 @@ void Sys_PrintUsage( void )
|
||||
O("-minidumps ", "enable writing minidumps when game is crashed")
|
||||
#endif
|
||||
O("-rodir <path> ", "set read-only base directory")
|
||||
O("-bugcomp ", "enable precise bug compatibility. Will break games that don't require it")
|
||||
O(" ", "Refer to engine documentation for more info")
|
||||
O("-bugcomp [opts] ", "enable precise bug compatibility")
|
||||
O(" ", "will break games that don't require it")
|
||||
O(" ", "refer to engine documentation for more info")
|
||||
O("-disablehelp ", "disable this message")
|
||||
#if !XASH_DEDICATED
|
||||
O("-dedicated ", "run engine in dedicated mode")
|
||||
@@ -106,9 +133,11 @@ void Sys_PrintUsage( void )
|
||||
O("-noip6 ", "disable IPv6")
|
||||
O("-ip6 <ip> ", "set IPv6 address")
|
||||
O("-port6 <port> ", "set IPv6 port")
|
||||
O("-clockwindow <cw>", "adjust clockwindow used to ignore client commands to prevent speed hacks")
|
||||
O("-clockwindow <cw>", "adjust clockwindow used to ignore client commands")
|
||||
O(" ", "to prevent speed hacks")
|
||||
|
||||
"\nGame options:\n"
|
||||
O("-game <directory>", "set game directory to start engine with")
|
||||
O("-dll <path> ", "override server DLL path")
|
||||
#if !XASH_DEDICATED
|
||||
O("-clientlib <path>", "override client DLL path")
|
||||
@@ -190,31 +219,14 @@ void Host_ShutdownServer( void )
|
||||
Host_PrintEngineFeatures
|
||||
================
|
||||
*/
|
||||
static void Host_PrintEngineFeatures( int features )
|
||||
static void Host_PrintFeatures( uint32_t flags, const char *s, feature_message_t *features, size_t size )
|
||||
{
|
||||
struct
|
||||
{
|
||||
uint32_t mask;
|
||||
const char *msg;
|
||||
} features_str[] =
|
||||
{
|
||||
{ ENGINE_WRITE_LARGE_COORD, "Big World Support" },
|
||||
{ ENGINE_QUAKE_COMPATIBLE, "Quake Compatibility" },
|
||||
{ ENGINE_LOAD_DELUXEDATA, "Deluxemap Support" },
|
||||
{ ENGINE_PHYSICS_PUSHER_EXT, "Improved MOVETYPE_PUSH" },
|
||||
{ ENGINE_LARGE_LIGHTMAPS, "Large Lightmaps" },
|
||||
{ ENGINE_COMPENSATE_QUAKE_BUG, "Stupid Quake Bug Compensation" },
|
||||
{ ENGINE_IMPROVED_LINETRACE, "Improved Trace Line" },
|
||||
{ ENGINE_COMPUTE_STUDIO_LERP, "Studio MOVETYPE_STEP Lerping" },
|
||||
{ ENGINE_LINEAR_GAMMA_SPACE, "Linear Gamma Space" },
|
||||
{ ENGINE_STEP_POSHISTORY_LERP, "MOVETYPE_STEP Position History Based Lerping" },
|
||||
};
|
||||
int i;
|
||||
size_t i;
|
||||
|
||||
for( i = 0; i < ARRAYSIZE( features_str ); i++ )
|
||||
for( i = 0; i < size; i++ )
|
||||
{
|
||||
if( FBitSet( features, features_str[i].mask ))
|
||||
Con_Reportf( "^3EXT:^7 %s is enabled\n", features_str[i].msg );
|
||||
if( FBitSet( flags, features[i].mask ))
|
||||
Con_Printf( "^3%s:^7 %s is enabled\n", s, features[i].msg );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -242,7 +254,7 @@ void Host_ValidateEngineFeatures( uint32_t features )
|
||||
SetBits( features, ENGINE_STEP_POSHISTORY_LERP );
|
||||
|
||||
// print requested first
|
||||
Host_PrintEngineFeatures( features );
|
||||
Host_PrintFeatures( features, "EXT", engine_features, ARRAYSIZE( engine_features ));
|
||||
|
||||
// now warn about incompatible bits
|
||||
if( FBitSet( features, ENGINE_STEP_POSHISTORY_LERP|ENGINE_COMPUTE_STUDIO_LERP ) == ( ENGINE_STEP_POSHISTORY_LERP|ENGINE_COMPUTE_STUDIO_LERP ))
|
||||
@@ -348,7 +360,7 @@ static int Host_CalcSleep( void )
|
||||
return host_sleeptime.value;
|
||||
}
|
||||
|
||||
void Host_NewInstance( const char *name, const char *finalmsg )
|
||||
static void Host_NewInstance( const char *name, const char *finalmsg )
|
||||
{
|
||||
if( !pChangeGame ) return;
|
||||
|
||||
@@ -366,7 +378,7 @@ Host_ChangeGame_f
|
||||
Change game modification
|
||||
=================
|
||||
*/
|
||||
void Host_ChangeGame_f( void )
|
||||
static void Host_ChangeGame_f( void )
|
||||
{
|
||||
int i;
|
||||
|
||||
@@ -405,7 +417,7 @@ void Host_ChangeGame_f( void )
|
||||
Host_Exec_f
|
||||
===============
|
||||
*/
|
||||
void Host_Exec_f( void )
|
||||
static void Host_Exec_f( void )
|
||||
{
|
||||
string cfgpath;
|
||||
byte *f;
|
||||
@@ -491,7 +503,7 @@ void Host_Exec_f( void )
|
||||
Host_MemStats_f
|
||||
===============
|
||||
*/
|
||||
void Host_MemStats_f( void )
|
||||
static void Host_MemStats_f( void )
|
||||
{
|
||||
switch( Cmd_Argc( ))
|
||||
{
|
||||
@@ -509,7 +521,7 @@ void Host_MemStats_f( void )
|
||||
}
|
||||
}
|
||||
|
||||
void Host_Minimize_f( void )
|
||||
static void Host_Minimize_f( void )
|
||||
{
|
||||
#ifdef XASH_SDL
|
||||
if( host.hWnd ) SDL_MinimizeWindow( host.hWnd );
|
||||
@@ -548,7 +560,7 @@ qboolean Host_IsLocalClient( void )
|
||||
Host_RegisterDecal
|
||||
=================
|
||||
*/
|
||||
qboolean Host_RegisterDecal( const char *name, int *count )
|
||||
static qboolean Host_RegisterDecal( const char *name, int *count )
|
||||
{
|
||||
char shortname[MAX_QPATH];
|
||||
int i;
|
||||
@@ -582,7 +594,7 @@ qboolean Host_RegisterDecal( const char *name, int *count )
|
||||
Host_InitDecals
|
||||
=================
|
||||
*/
|
||||
void Host_InitDecals( void )
|
||||
static void Host_InitDecals( void )
|
||||
{
|
||||
int i, num_decals = 0;
|
||||
search_t *t;
|
||||
@@ -613,7 +625,7 @@ Host_GetCommands
|
||||
Add them exactly as if they had been typed at the console
|
||||
===================
|
||||
*/
|
||||
void Host_GetCommands( void )
|
||||
static void Host_GetCommands( void )
|
||||
{
|
||||
char *cmd;
|
||||
|
||||
@@ -631,7 +643,7 @@ Host_CalcFPS
|
||||
compute actual FPS for various modes
|
||||
===================
|
||||
*/
|
||||
double Host_CalcFPS( void )
|
||||
static double Host_CalcFPS( void )
|
||||
{
|
||||
double fps = 0.0;
|
||||
|
||||
@@ -748,7 +760,7 @@ Host_FilterTime
|
||||
Returns false if the time is too short to run a frame
|
||||
===================
|
||||
*/
|
||||
qboolean Host_FilterTime( float time )
|
||||
static qboolean Host_FilterTime( float time )
|
||||
{
|
||||
static double oldtime;
|
||||
double dt;
|
||||
@@ -873,7 +885,7 @@ void GAME_EXPORT Host_Error( const char *error, ... )
|
||||
Host_AbortCurrentFrame();
|
||||
}
|
||||
|
||||
void Host_Error_f( void )
|
||||
static void Host_Error_f( void )
|
||||
{
|
||||
const char *error = Cmd_Argv( 1 );
|
||||
|
||||
@@ -881,7 +893,7 @@ void Host_Error_f( void )
|
||||
Host_Error( "%s\n", error );
|
||||
}
|
||||
|
||||
void Sys_Error_f( void )
|
||||
static void Sys_Error_f( void )
|
||||
{
|
||||
const char *error = Cmd_Argv( 1 );
|
||||
|
||||
@@ -904,7 +916,7 @@ static void Host_Crash_f( void )
|
||||
Host_Userconfigd_f
|
||||
=================
|
||||
*/
|
||||
void Host_Userconfigd_f( void )
|
||||
static void Host_Userconfigd_f( void )
|
||||
{
|
||||
search_t *t;
|
||||
int i;
|
||||
@@ -938,17 +950,65 @@ static void Host_RunTests( int stage )
|
||||
TEST_LIST_1_CLIENT;
|
||||
#endif
|
||||
Msg( "Done! %d passed, %d failed\n", tests_stats.passed, tests_stats.failed );
|
||||
error_on_exit = tests_stats.failed > 0 ? EXIT_FAILURE : EXIT_SUCCESS;
|
||||
Sys_Quit();
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
static uint32_t Host_CheckBugcomp( void )
|
||||
{
|
||||
uint32_t flags = 0;
|
||||
string args, arg;
|
||||
char *prev, *next;
|
||||
size_t i;
|
||||
|
||||
if( !Sys_CheckParm( "-bugcomp" ))
|
||||
return 0;
|
||||
|
||||
if( Sys_GetParmFromCmdLine( "-bugcomp", args ) && args[0] != '-' )
|
||||
{
|
||||
for( prev = args, next = Q_strchrnul( prev, '+' ); ; prev = next + 1, next = Q_strchrnul( prev, '+' ))
|
||||
{
|
||||
Q_strncpy( arg, prev, next - prev + 1 );
|
||||
for( i = 0; i < ARRAYSIZE( bugcomp_features ); i++ )
|
||||
{
|
||||
if( !Q_stricmp( bugcomp_features[i].arg, arg ))
|
||||
{
|
||||
SetBits( flags, bugcomp_features[i].mask );
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if( i == ARRAYSIZE( bugcomp_features ))
|
||||
{
|
||||
Con_Printf( S_ERROR "Unknown bugcomp flag %s\n", arg );
|
||||
Con_Printf( "Valid flags are:\n" );
|
||||
for( i = 0; i < ARRAYSIZE( bugcomp_features ); i++ )
|
||||
Con_Printf( "\t%s: %s\n", bugcomp_features[i].arg, bugcomp_features[i].msg );
|
||||
}
|
||||
|
||||
if( !*next )
|
||||
break;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// no argument specified -bugcomp just enables everything
|
||||
flags = -1;
|
||||
}
|
||||
|
||||
Host_PrintFeatures( flags, "BUGCOMP", bugcomp_features, ARRAYSIZE( bugcomp_features ));
|
||||
|
||||
return flags;
|
||||
}
|
||||
|
||||
/*
|
||||
=================
|
||||
Host_InitCommon
|
||||
=================
|
||||
*/
|
||||
void Host_InitCommon( int argc, char **argv, const char *progname, qboolean bChangeGame )
|
||||
static void Host_InitCommon( int argc, char **argv, const char *progname, qboolean bChangeGame )
|
||||
{
|
||||
char dev_level[4];
|
||||
int developer = DEFAULT_DEV;
|
||||
@@ -1047,13 +1107,6 @@ void Host_InitCommon( int argc, char **argv, const char *progname, qboolean bCha
|
||||
// member console allowing
|
||||
host.allow_console_init = host.allow_console;
|
||||
|
||||
if( Sys_CheckParm( "-bugcomp" ))
|
||||
{
|
||||
// add argument check here when we add other levels
|
||||
// of bugcompatibility
|
||||
host.bugcomp = BUGCOMP_GOLDSRC;
|
||||
}
|
||||
|
||||
// timeBeginPeriod( 1 ); // a1ba: Do we need this?
|
||||
|
||||
// NOTE: this message couldn't be passed into game console but it doesn't matter
|
||||
@@ -1180,11 +1233,11 @@ void Host_InitCommon( int argc, char **argv, const char *progname, qboolean bCha
|
||||
|
||||
Sys_InitLog();
|
||||
|
||||
// print bugcompatibility level here, after log was initialized
|
||||
if( host.bugcomp == BUGCOMP_GOLDSRC )
|
||||
{
|
||||
Con_Printf( "^3BUGCOMP^7: GoldSrc bug-compatibility enabled\n" );
|
||||
}
|
||||
// print current developer level to simplify processing users feedback
|
||||
if( developer > 0 )
|
||||
Con_Printf( "Developer level: ^3%i\n", developer );
|
||||
|
||||
host.bugcomp = Host_CheckBugcomp();
|
||||
|
||||
Cmd_AddCommand( "exec", Host_Exec_f, "execute a script file" );
|
||||
Cmd_AddCommand( "memlist", Host_MemStats_f, "prints memory pool information" );
|
||||
@@ -1240,7 +1293,7 @@ void Host_InitCommon( int argc, char **argv, const char *progname, qboolean bCha
|
||||
Key_Init();
|
||||
}
|
||||
|
||||
void Host_FreeCommon( void )
|
||||
static void Host_FreeCommon( void )
|
||||
{
|
||||
Image_Shutdown();
|
||||
Sound_Shutdown();
|
||||
@@ -1310,6 +1363,7 @@ int EXPORT Host_Main( int argc, char **argv, const char *progname, int bChangeGa
|
||||
|
||||
HTTP_Init();
|
||||
ID_Init();
|
||||
SoundList_Init();
|
||||
|
||||
if( Host_IsDedicated() )
|
||||
{
|
||||
@@ -1367,7 +1421,11 @@ int EXPORT Host_Main( int argc, char **argv, const char *progname, int bChangeGa
|
||||
host.status = HOST_FRAME;
|
||||
|
||||
if( GameState->nextstate == STATE_RUNFRAME )
|
||||
#if XASH_WIN32 // FIXME: implement autocomplete on *nix
|
||||
Con_Printf( "Type 'map <mapname>' to start game... (TAB-autocomplete is working too)\n" );
|
||||
#else // !XASH_WIN32
|
||||
Con_Printf( "Type 'map <mapname>' to start game...\n" );
|
||||
#endif // !XASH_WIN32
|
||||
|
||||
// execute server.cfg after commandline
|
||||
// so we have a chance to set servercfgfile
|
||||
@@ -1412,6 +1470,7 @@ void EXPORT Host_Shutdown( void )
|
||||
SV_ShutdownFilter();
|
||||
CL_Shutdown();
|
||||
|
||||
SoundList_Shutdown();
|
||||
Mod_Shutdown();
|
||||
NET_Shutdown();
|
||||
HTTP_Shutdown();
|
||||
|
||||
@@ -121,7 +121,7 @@ void COM_ChangeLevel( char const *pNewLevel, char const *pLandmarkName, qboolean
|
||||
GameState->newGame = false;
|
||||
}
|
||||
|
||||
void Host_ShutdownGame( void )
|
||||
static void Host_ShutdownGame( void )
|
||||
{
|
||||
SV_ShutdownGame();
|
||||
|
||||
@@ -137,7 +137,7 @@ void Host_ShutdownGame( void )
|
||||
}
|
||||
}
|
||||
|
||||
void Host_RunFrame( float time )
|
||||
static void Host_RunFrame( float time )
|
||||
{
|
||||
// at this time, we don't need to get events from OS on dedicated
|
||||
#if !XASH_DEDICATED
|
||||
|
||||
@@ -34,7 +34,7 @@ static hash_pack_queue_t *gp_hpak_queue = NULL;
|
||||
static hpak_header_t hash_pack_header;
|
||||
static hpak_info_t hash_pack_info;
|
||||
|
||||
const char *HPAK_TypeFromIndex( int type )
|
||||
static const char *HPAK_TypeFromIndex( int type )
|
||||
{
|
||||
switch( type )
|
||||
{
|
||||
@@ -94,7 +94,7 @@ void HPAK_FlushHostQueue( void )
|
||||
gp_hpak_queue = NULL;
|
||||
}
|
||||
|
||||
void HPAK_CreatePak( const char *filename, resource_t *pResource, byte *pData, file_t *fin )
|
||||
static void HPAK_CreatePak( const char *filename, resource_t *pResource, byte *pData, file_t *fin )
|
||||
{
|
||||
int filelocation;
|
||||
string pakname;
|
||||
@@ -400,7 +400,8 @@ static qboolean HPAK_Validate( const char *filename, qboolean quiet, qboolean de
|
||||
f = FS_Open( pakname, "rb", true );
|
||||
if( !f )
|
||||
{
|
||||
Con_DPrintf( S_ERROR "Couldn't find %s.\n", pakname );
|
||||
if( !quiet )
|
||||
Con_DPrintf( S_ERROR "Couldn't find %s.\n", pakname );
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -872,7 +873,7 @@ void HPAK_RemoveLump( const char *name, resource_t *pResource )
|
||||
FS_Rename( save_path, read_path );
|
||||
}
|
||||
|
||||
void HPAK_List_f( void )
|
||||
static void HPAK_List_f( void )
|
||||
{
|
||||
int nCurrent;
|
||||
hpak_header_t header;
|
||||
@@ -950,7 +951,7 @@ void HPAK_List_f( void )
|
||||
FS_Close( f );
|
||||
}
|
||||
|
||||
void HPAK_Extract_f( void )
|
||||
static void HPAK_Extract_f( void )
|
||||
{
|
||||
int nCurrent;
|
||||
hpak_header_t header;
|
||||
@@ -1061,7 +1062,7 @@ void HPAK_Extract_f( void )
|
||||
FS_Close( f );
|
||||
}
|
||||
|
||||
void HPAK_Remove_f( void )
|
||||
static void HPAK_Remove_f( void )
|
||||
{
|
||||
resource_t resource;
|
||||
|
||||
@@ -1083,7 +1084,7 @@ void HPAK_Remove_f( void )
|
||||
}
|
||||
}
|
||||
|
||||
void HPAK_Validate_f( void )
|
||||
static void HPAK_Validate_f( void )
|
||||
{
|
||||
if( Cmd_Argc() != 2 )
|
||||
{
|
||||
|
||||
@@ -28,7 +28,7 @@ qboolean Image_LoadBMP( const char *name, const byte *buffer, fs_offset_t filesi
|
||||
rgba_t palette[256] = { 0 };
|
||||
int i, columns, column, rows, row, bpp = 1;
|
||||
int cbPalBytes = 0, padSize = 0, bps = 0;
|
||||
int reflectivity[3] = { 0, 0, 0 };
|
||||
uint reflectivity[3] = { 0, 0, 0 };
|
||||
qboolean load_qfont = false;
|
||||
bmp_t bhdr;
|
||||
fs_offset_t estimatedSize;
|
||||
|
||||
@@ -17,7 +17,7 @@ GNU General Public License for more details.
|
||||
#include "xash3d_mathlib.h"
|
||||
#include "img_dds.h"
|
||||
|
||||
qboolean Image_CheckDXT3Alpha( dds_t *hdr, byte *fin )
|
||||
static qboolean Image_CheckDXT3Alpha( dds_t *hdr, byte *fin )
|
||||
{
|
||||
word sAlpha;
|
||||
byte *alpha;
|
||||
@@ -50,7 +50,7 @@ qboolean Image_CheckDXT3Alpha( dds_t *hdr, byte *fin )
|
||||
return false;
|
||||
}
|
||||
|
||||
qboolean Image_CheckDXT5Alpha( dds_t *hdr, byte *fin )
|
||||
static qboolean Image_CheckDXT5Alpha( dds_t *hdr, byte *fin )
|
||||
{
|
||||
uint bits, bitmask;
|
||||
byte *alphamask;
|
||||
@@ -91,7 +91,7 @@ qboolean Image_CheckDXT5Alpha( dds_t *hdr, byte *fin )
|
||||
return false;
|
||||
}
|
||||
|
||||
void Image_DXTGetPixelFormat( dds_t *hdr, dds_header_dxt10_t *headerExt )
|
||||
static void Image_DXTGetPixelFormat( dds_t *hdr, dds_header_dxt10_t *headerExt )
|
||||
{
|
||||
uint bits = hdr->dsPixelFormat.dwRGBBitCount;
|
||||
|
||||
@@ -215,7 +215,7 @@ void Image_DXTGetPixelFormat( dds_t *hdr, dds_header_dxt10_t *headerExt )
|
||||
image.num_mips = hdr->dwMipMapCount; // get actual mip count
|
||||
}
|
||||
|
||||
size_t Image_DXTCalcMipmapSize( dds_t *hdr )
|
||||
static size_t Image_DXTCalcMipmapSize( dds_t *hdr )
|
||||
{
|
||||
size_t buffsize = 0;
|
||||
int i, width, height;
|
||||
@@ -231,7 +231,7 @@ size_t Image_DXTCalcMipmapSize( dds_t *hdr )
|
||||
return buffsize;
|
||||
}
|
||||
|
||||
uint Image_DXTCalcSize( const char *name, dds_t *hdr, size_t filesize )
|
||||
static uint Image_DXTCalcSize( const char *name, dds_t *hdr, size_t filesize )
|
||||
{
|
||||
size_t buffsize = 0;
|
||||
int w = image.width;
|
||||
@@ -269,7 +269,7 @@ uint Image_DXTCalcSize( const char *name, dds_t *hdr, size_t filesize )
|
||||
return buffsize;
|
||||
}
|
||||
|
||||
void Image_DXTAdjustVolume( dds_t *hdr )
|
||||
static void Image_DXTAdjustVolume( dds_t *hdr )
|
||||
{
|
||||
if( hdr->dwDepth <= 1 )
|
||||
return;
|
||||
|
||||
@@ -70,6 +70,7 @@ static qboolean Image_KTX2Parse( const ktx2_header_t *header, const byte *buffer
|
||||
ktx2_index_t index;
|
||||
size_t total_size = 0;
|
||||
size_t max_offset = 0;
|
||||
int mip, cursor;
|
||||
const byte *const levels_begin = buffer + KTX2_LEVELS_OFFSET;
|
||||
|
||||
// Sets image.type and image.flags
|
||||
@@ -125,7 +126,7 @@ static qboolean Image_KTX2Parse( const ktx2_header_t *header, const byte *buffer
|
||||
|
||||
memcpy( &index, buffer + KTX2_IDENTIFIER_SIZE + sizeof( ktx2_header_t ), sizeof( index ));
|
||||
|
||||
for( int mip = 0; mip < header->levelCount; ++mip )
|
||||
for( mip = 0; mip < header->levelCount; ++mip )
|
||||
{
|
||||
const uint32_t width = Q_max( 1, ( header->pixelWidth >> mip ));
|
||||
const uint32_t height = Q_max( 1, ( header->pixelHeight >> mip ));
|
||||
@@ -154,7 +155,7 @@ static qboolean Image_KTX2Parse( const ktx2_header_t *header, const byte *buffer
|
||||
image.rgba = Mem_Malloc( host.imagepool, image.size );
|
||||
memcpy( image.rgba, buffer, image.size );
|
||||
|
||||
for( int mip = 0, cursor = 0; mip < header->levelCount; ++mip )
|
||||
for( mip = 0, cursor = 0; mip < header->levelCount; ++mip )
|
||||
{
|
||||
ktx2_level_t level;
|
||||
memcpy( &level, levels_begin + mip * sizeof( level ), sizeof( level ));
|
||||
|
||||
@@ -597,6 +597,7 @@ void Test_RunImagelib( void )
|
||||
}
|
||||
|
||||
#define IMPLEMENT_IMAGELIB_FUZZ_TARGET( export, target ) \
|
||||
int export( const uint8_t *Data, size_t Size ); \
|
||||
int EXPORT export( const uint8_t *Data, size_t Size ) \
|
||||
{ \
|
||||
rgbdata_t *rgb; \
|
||||
|
||||
@@ -65,7 +65,7 @@ static int bias[netsize]; // bias and freq arrays for learning
|
||||
static int freq[netsize];
|
||||
static int radpower[initrad]; // radpower for precomputation
|
||||
|
||||
void initnet( byte *thepic, int len, int sample )
|
||||
static void initnet( byte *thepic, int len, int sample )
|
||||
{
|
||||
register int i, *p;
|
||||
|
||||
@@ -83,7 +83,7 @@ void initnet( byte *thepic, int len, int sample )
|
||||
}
|
||||
|
||||
// Unbias network to give byte values 0..255 and record position i to prepare for sort
|
||||
void unbiasnet( void )
|
||||
static void unbiasnet( void )
|
||||
{
|
||||
int i, j, temp;
|
||||
|
||||
@@ -103,7 +103,7 @@ void unbiasnet( void )
|
||||
}
|
||||
|
||||
// Insertion sort of network and building of netindex[0..255] (to do after unbias)
|
||||
void inxbuild( void )
|
||||
static void inxbuild( void )
|
||||
{
|
||||
register int *p, *q;
|
||||
register int i, j, smallpos, smallval;
|
||||
@@ -162,7 +162,7 @@ void inxbuild( void )
|
||||
|
||||
|
||||
// Search for BGR values 0..255 (after net is unbiased) and return colour index
|
||||
int inxsearch( int r, int g, int b )
|
||||
static int inxsearch( int r, int g, int b )
|
||||
{
|
||||
register int i, j, dist, a, bestd;
|
||||
register int *p;
|
||||
@@ -243,7 +243,7 @@ int inxsearch( int r, int g, int b )
|
||||
}
|
||||
|
||||
// Search for biased BGR values
|
||||
int contest( int r, int g, int b )
|
||||
static int contest( int r, int g, int b )
|
||||
{
|
||||
register int *p, *f, *n;
|
||||
register int i, dist, a, biasdist, betafreq;
|
||||
@@ -298,7 +298,7 @@ int contest( int r, int g, int b )
|
||||
}
|
||||
|
||||
// Move neuron i towards biased (b,g,r) by factor alpha
|
||||
void altersingle( int alpha, int i, int r, int g, int b )
|
||||
static void altersingle( int alpha, int i, int r, int g, int b )
|
||||
{
|
||||
register int *n;
|
||||
|
||||
@@ -311,7 +311,7 @@ void altersingle( int alpha, int i, int r, int g, int b )
|
||||
}
|
||||
|
||||
// Move adjacent neurons by precomputed alpha*(1-((i-j)^2/[r]^2)) in radpower[|i-j|]
|
||||
void alterneigh( int rad, int i, int r, int g, int b )
|
||||
static void alterneigh( int rad, int i, int r, int g, int b )
|
||||
{
|
||||
register int j, k, lo, hi, a;
|
||||
register int *p, *q;
|
||||
@@ -354,7 +354,7 @@ void alterneigh( int rad, int i, int r, int g, int b )
|
||||
}
|
||||
|
||||
// Main Learning Loop
|
||||
void learn( void )
|
||||
static void learn( void )
|
||||
{
|
||||
register byte *p;
|
||||
register int i, j, r, g, b;
|
||||
|
||||
@@ -29,7 +29,7 @@ qboolean Image_LoadTGA( const char *name, const byte *buffer, fs_offset_t filesi
|
||||
rgba_t palette[256];
|
||||
byte red = 0, green = 0, blue = 0, alpha = 0;
|
||||
int readpixelcount, pixelcount;
|
||||
int reflectivity[3] = { 0, 0, 0 };
|
||||
uint reflectivity[3] = { 0, 0, 0 };
|
||||
qboolean compressed;
|
||||
tga_t targa_header;
|
||||
|
||||
|
||||
@@ -281,7 +281,7 @@ int Image_ComparePalette( const byte *pal )
|
||||
return PAL_CUSTOM;
|
||||
}
|
||||
|
||||
void Image_SetPalette( const byte *pal, uint *d_table )
|
||||
static void Image_SetPalette( const byte *pal, uint *d_table )
|
||||
{
|
||||
byte rgba[4];
|
||||
uint uirgba; // TODO: palette looks byte-swapped on big-endian
|
||||
@@ -530,7 +530,7 @@ void Image_PaletteHueReplace( byte *palSrc, int newHue, int start, int end, int
|
||||
}
|
||||
}
|
||||
|
||||
void Image_PaletteTranslate( byte *palSrc, int top, int bottom, int pal_size )
|
||||
static void Image_PaletteTranslate( byte *palSrc, int top, int bottom, int pal_size )
|
||||
{
|
||||
byte dst[256], src[256];
|
||||
int i;
|
||||
@@ -726,7 +726,7 @@ static void Image_Resample24LerpLine( const byte *in, byte *out, int inwidth, in
|
||||
}
|
||||
}
|
||||
|
||||
void Image_Resample32Lerp( const void *indata, int inwidth, int inheight, void *outdata, int outwidth, int outheight )
|
||||
static void Image_Resample32Lerp( const void *indata, int inwidth, int inheight, void *outdata, int outwidth, int outheight )
|
||||
{
|
||||
const byte *inrow;
|
||||
int i, j, r, yi, oldy = 0, f, fstep, lerp, endy = (inheight - 1);
|
||||
@@ -834,7 +834,7 @@ void Image_Resample32Lerp( const void *indata, int inwidth, int inheight, void *
|
||||
Mem_Free( resamplerow1 );
|
||||
}
|
||||
|
||||
void Image_Resample32Nolerp( const void *indata, int inwidth, int inheight, void *outdata, int outwidth, int outheight )
|
||||
static void Image_Resample32Nolerp( const void *indata, int inwidth, int inheight, void *outdata, int outwidth, int outheight )
|
||||
{
|
||||
int i, j;
|
||||
uint frac, fracstep;
|
||||
@@ -873,7 +873,7 @@ void Image_Resample32Nolerp( const void *indata, int inwidth, int inheight, void
|
||||
}
|
||||
}
|
||||
|
||||
void Image_Resample24Lerp( const void *indata, int inwidth, int inheight, void *outdata, int outwidth, int outheight )
|
||||
static void Image_Resample24Lerp( const void *indata, int inwidth, int inheight, void *outdata, int outwidth, int outheight )
|
||||
{
|
||||
const byte *inrow;
|
||||
int i, j, r, yi, oldy, f, fstep, lerp, endy = (inheight - 1);
|
||||
@@ -974,7 +974,7 @@ void Image_Resample24Lerp( const void *indata, int inwidth, int inheight, void *
|
||||
Mem_Free( resamplerow1 );
|
||||
}
|
||||
|
||||
void Image_Resample24Nolerp( const void *indata, int inwidth, int inheight, void *outdata, int outwidth, int outheight )
|
||||
static void Image_Resample24Nolerp( const void *indata, int inwidth, int inheight, void *outdata, int outwidth, int outheight )
|
||||
{
|
||||
uint frac, fracstep;
|
||||
int i, j, f, inwidth3 = inwidth * 3;
|
||||
@@ -1040,7 +1040,7 @@ void Image_Resample24Nolerp( const void *indata, int inwidth, int inheight, void
|
||||
}
|
||||
}
|
||||
|
||||
void Image_Resample8Nolerp( const void *indata, int inwidth, int inheight, void *outdata, int outwidth, int outheight )
|
||||
static void Image_Resample8Nolerp( const void *indata, int inwidth, int inheight, void *outdata, int outwidth, int outheight )
|
||||
{
|
||||
int i, j;
|
||||
byte *in, *inrow;
|
||||
@@ -1179,7 +1179,7 @@ byte *Image_FlipInternal( const byte *in, word *srcwidth, word *srcheight, int t
|
||||
return image.tempbuffer;
|
||||
}
|
||||
|
||||
byte *Image_CreateLumaInternal( byte *fin, int width, int height, int type, int flags )
|
||||
static byte *Image_CreateLumaInternal( byte *fin, int width, int height, int type, int flags )
|
||||
{
|
||||
byte *out;
|
||||
int i;
|
||||
@@ -1235,7 +1235,7 @@ Image_Decompress
|
||||
force to unpack any image to 32-bit buffer
|
||||
=============
|
||||
*/
|
||||
qboolean Image_Decompress( const byte *data )
|
||||
static qboolean Image_Decompress( const byte *data )
|
||||
{
|
||||
byte *fin, *fout;
|
||||
int i, size;
|
||||
@@ -1303,7 +1303,7 @@ qboolean Image_Decompress( const byte *data )
|
||||
return true;
|
||||
}
|
||||
|
||||
rgbdata_t *Image_DecompressInternal( rgbdata_t *pic )
|
||||
static rgbdata_t *Image_DecompressInternal( rgbdata_t *pic )
|
||||
{
|
||||
// quick case to reject unneeded conversions
|
||||
if( pic->type == PF_RGBA_32 )
|
||||
@@ -1326,7 +1326,7 @@ rgbdata_t *Image_DecompressInternal( rgbdata_t *pic )
|
||||
return pic;
|
||||
}
|
||||
|
||||
rgbdata_t *Image_LightGamma( rgbdata_t *pic )
|
||||
static rgbdata_t *Image_LightGamma( rgbdata_t *pic )
|
||||
{
|
||||
byte *in = (byte *)pic->buffer;
|
||||
int i;
|
||||
@@ -1344,7 +1344,7 @@ rgbdata_t *Image_LightGamma( rgbdata_t *pic )
|
||||
return pic;
|
||||
}
|
||||
|
||||
qboolean Image_RemapInternal( rgbdata_t *pic, int topColor, int bottomColor )
|
||||
static qboolean Image_RemapInternal( rgbdata_t *pic, int topColor, int bottomColor )
|
||||
{
|
||||
if( !pic->palette )
|
||||
return false;
|
||||
|
||||
@@ -360,7 +360,7 @@ qboolean Image_LoadMIP( const char *name, const byte *buffer, fs_offset_t filesi
|
||||
byte *fin, *pal;
|
||||
int ofs[4], rendermode;
|
||||
int i, pixels, numcolors;
|
||||
int reflectivity[3] = { 0, 0, 0 };
|
||||
uint reflectivity[3] = { 0, 0, 0 };
|
||||
|
||||
if( filesize < sizeof( mip ))
|
||||
return false;
|
||||
@@ -390,7 +390,7 @@ qboolean Image_LoadMIP( const char *name, const byte *buffer, fs_offset_t filesi
|
||||
if( Q_strrchr( name, '{' ))
|
||||
{
|
||||
// NOTE: decals with 'blue base' can be interpret as colored decals
|
||||
if( !Image_CheckFlag( IL_LOAD_DECAL ) || ( pal[765] == 0 && pal[766] == 0 && pal[767] == 255 ))
|
||||
if( !Image_CheckFlag( IL_LOAD_DECAL ) || ( pal && pal[765] == 0 && pal[766] == 0 && pal[767] == 255 ))
|
||||
{
|
||||
SetBits( image.flags, IMAGE_ONEBIT_ALPHA );
|
||||
rendermode = LUMP_MASKED;
|
||||
@@ -488,37 +488,40 @@ qboolean Image_LoadMIP( const char *name, const byte *buffer, fs_offset_t filesi
|
||||
}
|
||||
|
||||
// check for half-life water texture
|
||||
if( hl_texture && ( mip.name[0] == '!' || !Q_strnicmp( mip.name, "water", 5 )))
|
||||
if( pal != NULL )
|
||||
{
|
||||
// grab the fog color
|
||||
image.fogParams[0] = pal[3*3+0];
|
||||
image.fogParams[1] = pal[3*3+1];
|
||||
image.fogParams[2] = pal[3*3+2];
|
||||
|
||||
// grab the fog density
|
||||
image.fogParams[3] = pal[4*3+0];
|
||||
}
|
||||
else if( hl_texture && ( rendermode == LUMP_GRADIENT ))
|
||||
{
|
||||
// grab the decal color
|
||||
image.fogParams[0] = pal[255*3+0];
|
||||
image.fogParams[1] = pal[255*3+1];
|
||||
image.fogParams[2] = pal[255*3+2];
|
||||
|
||||
// calc the decal reflectivity
|
||||
image.fogParams[3] = VectorAvg( image.fogParams );
|
||||
}
|
||||
else if( pal != NULL )
|
||||
{
|
||||
// calc texture reflectivity
|
||||
for( i = 0; i < 256; i++ )
|
||||
if( hl_texture && ( mip.name[0] == '!' || !Q_strnicmp( mip.name, "water", 5 )))
|
||||
{
|
||||
reflectivity[0] += pal[i*3+0];
|
||||
reflectivity[1] += pal[i*3+1];
|
||||
reflectivity[2] += pal[i*3+2];
|
||||
}
|
||||
// grab the fog color
|
||||
image.fogParams[0] = pal[3*3+0];
|
||||
image.fogParams[1] = pal[3*3+1];
|
||||
image.fogParams[2] = pal[3*3+2];
|
||||
|
||||
VectorDivide( reflectivity, 256, image.fogParams );
|
||||
// grab the fog density
|
||||
image.fogParams[3] = pal[4*3+0];
|
||||
}
|
||||
else if( hl_texture && ( rendermode == LUMP_GRADIENT ))
|
||||
{
|
||||
// grab the decal color
|
||||
image.fogParams[0] = pal[255*3+0];
|
||||
image.fogParams[1] = pal[255*3+1];
|
||||
image.fogParams[2] = pal[255*3+2];
|
||||
|
||||
// calc the decal reflectivity
|
||||
image.fogParams[3] = VectorAvg( image.fogParams );
|
||||
}
|
||||
else
|
||||
{
|
||||
// calc texture reflectivity
|
||||
for( i = 0; i < 256; i++ )
|
||||
{
|
||||
reflectivity[0] += pal[i*3+0];
|
||||
reflectivity[1] += pal[i*3+1];
|
||||
reflectivity[2] += pal[i*3+2];
|
||||
}
|
||||
|
||||
VectorDivide( reflectivity, 256, image.fogParams );
|
||||
}
|
||||
}
|
||||
|
||||
image.type = PF_INDEXED_32; // 32-bit palete
|
||||
|
||||
@@ -333,7 +333,7 @@ void Info_RemovePrefixedKeys( char *start, char prefix )
|
||||
}
|
||||
}
|
||||
|
||||
qboolean Info_IsKeyImportant( const char *key )
|
||||
static qboolean Info_IsKeyImportant( const char *key )
|
||||
{
|
||||
if( key[0] == '*' )
|
||||
return true;
|
||||
@@ -358,7 +358,7 @@ qboolean Info_IsKeyImportant( const char *key )
|
||||
return false;
|
||||
}
|
||||
|
||||
char *Info_FindLargestKey( char *s )
|
||||
static char *Info_FindLargestKey( char *s )
|
||||
{
|
||||
char key[MAX_KV_SIZE];
|
||||
char value[MAX_KV_SIZE];
|
||||
|
||||
@@ -166,7 +166,7 @@ Some modders use _i?86 suffix in game library name
|
||||
So strip it to follow library naming for non-Intel CPUs
|
||||
==============
|
||||
*/
|
||||
static void COM_StripIntelSuffix( char *out )
|
||||
static inline void COM_StripIntelSuffix( char *out )
|
||||
{
|
||||
char *suffix = Q_strrchr( out, '_' );
|
||||
|
||||
|
||||
@@ -118,7 +118,7 @@ static void NET_AnnounceToMaster( master_t *m )
|
||||
MSG_WriteBytes( &msg, "q\xFF", 2 );
|
||||
MSG_WriteDword( &msg, m->heartbeat_challenge );
|
||||
|
||||
NET_SendPacket( NS_SERVER, MSG_GetNumBytesWritten( &msg ), MSG_GetBuf( &msg ), m->adr );
|
||||
NET_SendPacket( NS_SERVER, MSG_GetNumBytesWritten( &msg ), MSG_GetData( &msg ), m->adr );
|
||||
|
||||
if( sv_verbose_heartbeats.value )
|
||||
{
|
||||
|
||||
@@ -583,7 +583,7 @@ void Mod_PrintWorldStats_f( void )
|
||||
Mod_DecompressPVS
|
||||
===================
|
||||
*/
|
||||
byte *Mod_DecompressPVS( const byte *in, int visbytes )
|
||||
static byte *Mod_DecompressPVS( const byte *in, int visbytes )
|
||||
{
|
||||
byte *out;
|
||||
int c;
|
||||
|
||||
@@ -20,6 +20,7 @@ GNU General Public License for more details.
|
||||
#if !XASH_DEDICATED
|
||||
#include "ref_common.h"
|
||||
#endif // XASH_DEDICATED
|
||||
#include "mod_local.h"
|
||||
|
||||
|
||||
/*
|
||||
|
||||
@@ -109,90 +109,6 @@ void MSG_InitMasks( void )
|
||||
ExtraMasks[maskBit] = (uint)BIT( maskBit ) - 1;
|
||||
}
|
||||
|
||||
void MSG_InitExt( sizebuf_t *sb, const char *pDebugName, void *pData, int nBytes, int nMaxBits )
|
||||
{
|
||||
MSG_StartWriting( sb, pData, nBytes, 0, nMaxBits );
|
||||
|
||||
sb->pDebugName = pDebugName;
|
||||
}
|
||||
|
||||
void MSG_StartWriting( sizebuf_t *sb, void *pData, int nBytes, int iStartBit, int nBits )
|
||||
{
|
||||
// make sure it's dword aligned and padded.
|
||||
Assert(((uint32_t)pData & 3 ) == 0 );
|
||||
|
||||
sb->pDebugName = "Unnamed";
|
||||
sb->pData = (byte *)pData;
|
||||
|
||||
if( nBits == -1 )
|
||||
{
|
||||
sb->nDataBits = nBytes << 3;
|
||||
}
|
||||
else
|
||||
{
|
||||
Assert( nBits <= nBytes * 8 );
|
||||
sb->nDataBits = nBits;
|
||||
}
|
||||
|
||||
sb->iCurBit = iStartBit;
|
||||
sb->bOverflow = false;
|
||||
}
|
||||
|
||||
/*
|
||||
=======================
|
||||
MSG_Clear
|
||||
|
||||
for clearing overflowed buffer
|
||||
=======================
|
||||
*/
|
||||
void MSG_Clear( sizebuf_t *sb )
|
||||
{
|
||||
sb->iCurBit = 0;
|
||||
sb->bOverflow = false;
|
||||
}
|
||||
|
||||
static qboolean MSG_Overflow( sizebuf_t *sb, int nBits )
|
||||
{
|
||||
if( sb->iCurBit + nBits > sb->nDataBits )
|
||||
sb->bOverflow = true;
|
||||
return sb->bOverflow;
|
||||
}
|
||||
|
||||
qboolean MSG_CheckOverflow( sizebuf_t *sb )
|
||||
{
|
||||
return MSG_Overflow( sb, 0 );
|
||||
}
|
||||
|
||||
int MSG_SeekToBit( sizebuf_t *sb, int bitPos, int whence )
|
||||
{
|
||||
// compute the file offset
|
||||
switch( whence )
|
||||
{
|
||||
case SEEK_CUR:
|
||||
bitPos += sb->iCurBit;
|
||||
break;
|
||||
case SEEK_SET:
|
||||
break;
|
||||
case SEEK_END:
|
||||
bitPos += sb->nDataBits;
|
||||
break;
|
||||
default:
|
||||
return -1;
|
||||
}
|
||||
|
||||
if( bitPos < 0 || bitPos > sb->nDataBits )
|
||||
return -1;
|
||||
|
||||
sb->iCurBit = bitPos;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
void MSG_SeekToByte( sizebuf_t *sb, int bytePos )
|
||||
{
|
||||
sb->iCurBit = bytePos << 3;
|
||||
}
|
||||
|
||||
void MSG_WriteOneBit( sizebuf_t *sb, int nValue )
|
||||
{
|
||||
if( !MSG_Overflow( sb, 1 ))
|
||||
@@ -674,7 +590,7 @@ qboolean MSG_ReadBytes( sizebuf_t *sb, void *pOut, int nBytes )
|
||||
return MSG_ReadBits( sb, pOut, nBytes << 3 );
|
||||
}
|
||||
|
||||
char *MSG_ReadStringExt( sizebuf_t *sb, qboolean bLine )
|
||||
static char *MSG_ReadStringExt( sizebuf_t *sb, qboolean bLine )
|
||||
{
|
||||
static char string[4096];
|
||||
int l = 0, c;
|
||||
@@ -700,6 +616,16 @@ char *MSG_ReadStringExt( sizebuf_t *sb, qboolean bLine )
|
||||
return string;
|
||||
}
|
||||
|
||||
char *MSG_ReadString( sizebuf_t *sb )
|
||||
{
|
||||
return MSG_ReadStringExt( sb, false );
|
||||
}
|
||||
|
||||
char *MSG_ReadStringLine( sizebuf_t *sb )
|
||||
{
|
||||
return MSG_ReadStringExt( sb, true );
|
||||
}
|
||||
|
||||
void MSG_ExciseBits( sizebuf_t *sb, int startbit, int bitstoremove )
|
||||
{
|
||||
int i, endbit = startbit + bitstoremove;
|
||||
|
||||
@@ -30,39 +30,128 @@ GNU General Public License for more details.
|
||||
// So PAD_NUMBER(0,4) is 0 and PAD_NUMBER(1,4) is 4
|
||||
#define PAD_NUMBER( num, boundary ) ((( num ) + (( boundary ) - 1 )) / ( boundary )) * ( boundary )
|
||||
|
||||
_inline int BitByte( int bits )
|
||||
static inline int BitByte( int bits )
|
||||
{
|
||||
return PAD_NUMBER( bits, 8 ) >> 3;
|
||||
}
|
||||
|
||||
struct sizebuf_s
|
||||
{
|
||||
qboolean bOverflow; // overflow reading or writing
|
||||
const char *pDebugName; // buffer name (pointer to const name)
|
||||
|
||||
byte *pData;
|
||||
int iCurBit;
|
||||
int nDataBits;
|
||||
byte *pData;
|
||||
qboolean bOverflow; // overflow reading or writing
|
||||
int iCurBit;
|
||||
int nDataBits;
|
||||
const char *pDebugName; // buffer name (pointer to const name)
|
||||
};
|
||||
|
||||
#define MSG_StartReading MSG_StartWriting
|
||||
#define MSG_GetNumBytesRead MSG_GetNumBytesWritten
|
||||
#define MSG_GetRealBytesRead MSG_GetRealBytesWritten
|
||||
#define MSG_GetNumBitsRead MSG_GetNumBitsWritten
|
||||
#define MSG_ReadBitAngles MSG_ReadBitVec3Coord
|
||||
#define MSG_ReadString( sb ) MSG_ReadStringExt( sb, false )
|
||||
#define MSG_ReadStringLine( sb ) MSG_ReadStringExt( sb, true )
|
||||
#define MSG_ReadAngle( sb ) (float)(MSG_ReadChar( sb ) * ( 360.0f / 256.0f ))
|
||||
#define MSG_Init( sb, name, data, bytes ) MSG_InitExt( sb, name, data, bytes, -1 )
|
||||
#define MSG_StartReading MSG_StartWriting
|
||||
#define MSG_GetNumBytesRead MSG_GetNumBytesWritten
|
||||
#define MSG_GetRealBytesRead MSG_GetRealBytesWritten
|
||||
#define MSG_GetNumBitsRead MSG_GetNumBitsWritten
|
||||
#define MSG_ReadBitAngles MSG_ReadBitVec3Coord
|
||||
#define MSG_ReadAngle( sb ) (float)( MSG_ReadChar( sb ) * ( 360.0f / 256.0f ))
|
||||
#define MSG_Init( sb, name, data, bytes ) MSG_InitExt( sb, name, data, bytes, -1 )
|
||||
#define MSG_CheckOverflow( sb ) MSG_Overflow( sb, 0 )
|
||||
|
||||
// common functions
|
||||
void MSG_InitExt( sizebuf_t *sb, const char *pDebugName, void *pData, int nBytes, int nMaxBits );
|
||||
void MSG_InitMasks( void ); // called once at startup engine
|
||||
int MSG_SeekToBit( sizebuf_t *sb, int bitPos, int whence );
|
||||
void MSG_ExciseBits( sizebuf_t *sb, int startbit, int bitstoremove );
|
||||
_inline int MSG_TellBit( sizebuf_t *sb ) { return sb->iCurBit; }
|
||||
_inline const char *MSG_GetName( sizebuf_t *sb ) { return sb->pDebugName; }
|
||||
qboolean MSG_CheckOverflow( sizebuf_t *sb );
|
||||
static inline void MSG_Clear( sizebuf_t *sb )
|
||||
{
|
||||
sb->bOverflow = false;
|
||||
sb->iCurBit = 0;
|
||||
}
|
||||
|
||||
static inline void MSG_InitExt( sizebuf_t *sb, const char *pDebugName, void *pData, int nBytes, int nBits )
|
||||
{
|
||||
sb->pData = pData;
|
||||
MSG_Clear( sb );
|
||||
|
||||
if( nBits < 0 )
|
||||
sb->nDataBits = nBytes << 3;
|
||||
else
|
||||
sb->nDataBits = nBits;
|
||||
|
||||
sb->pDebugName = pDebugName;
|
||||
}
|
||||
|
||||
static inline void MSG_StartWriting( sizebuf_t *sb, void *pData, int nBytes, int iStartBit, int nBits )
|
||||
{
|
||||
MSG_InitExt( sb, "Unnamed", pData, nBytes, nBits );
|
||||
sb->iCurBit = iStartBit;
|
||||
}
|
||||
|
||||
static inline int MSG_SeekToBit( sizebuf_t *sb, int bitPos, int whence )
|
||||
{
|
||||
// compute the file offset
|
||||
switch( whence )
|
||||
{
|
||||
case SEEK_CUR:
|
||||
bitPos += sb->iCurBit;
|
||||
break;
|
||||
case SEEK_SET:
|
||||
break;
|
||||
case SEEK_END:
|
||||
bitPos += sb->nDataBits;
|
||||
break;
|
||||
default:
|
||||
return -1;
|
||||
}
|
||||
|
||||
if( unlikely( bitPos < 0 || bitPos > sb->nDataBits ))
|
||||
return -1;
|
||||
|
||||
sb->iCurBit = bitPos;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static inline int MSG_TellBit( sizebuf_t *sb )
|
||||
{
|
||||
return sb->iCurBit;
|
||||
}
|
||||
|
||||
static inline const char *MSG_GetName( sizebuf_t *sb )
|
||||
{
|
||||
return sb->pDebugName;
|
||||
}
|
||||
|
||||
static inline int MSG_GetNumBytesWritten( sizebuf_t *sb )
|
||||
{
|
||||
return BitByte( sb->iCurBit );
|
||||
}
|
||||
|
||||
static inline int MSG_GetRealBytesWritten( sizebuf_t *sb )
|
||||
{
|
||||
return sb->iCurBit >> 3; // unpadded
|
||||
}
|
||||
static inline int MSG_GetNumBitsWritten( sizebuf_t *sb )
|
||||
{
|
||||
return sb->iCurBit;
|
||||
}
|
||||
|
||||
static inline int MSG_GetMaxBits( sizebuf_t *sb )
|
||||
{
|
||||
return sb->nDataBits;
|
||||
}
|
||||
|
||||
static inline int MSG_GetMaxBytes( sizebuf_t *sb )
|
||||
{
|
||||
return sb->nDataBits >> 3;
|
||||
}
|
||||
|
||||
static inline int MSG_GetNumBitsLeft( sizebuf_t *sb )
|
||||
{
|
||||
return sb->nDataBits - sb->iCurBit;
|
||||
}
|
||||
|
||||
static inline int MSG_GetNumBytesLeft( sizebuf_t *sb )
|
||||
{
|
||||
return MSG_GetNumBitsLeft( sb ) >> 3;
|
||||
}
|
||||
|
||||
static inline byte *MSG_GetData( sizebuf_t *sb )
|
||||
{
|
||||
return sb->pData;
|
||||
}
|
||||
|
||||
#if XASH_BIG_ENDIAN
|
||||
#define MSG_BigShort( x ) ( x )
|
||||
@@ -73,9 +162,15 @@ static inline uint16_t MSG_BigShort( const uint16_t x )
|
||||
}
|
||||
#endif
|
||||
|
||||
// init writing
|
||||
void MSG_StartWriting( sizebuf_t *sb, void *pData, int nBytes, int iStartBit, int nBits );
|
||||
void MSG_Clear( sizebuf_t *sb );
|
||||
static inline qboolean MSG_Overflow( sizebuf_t *sb, int nBits )
|
||||
{
|
||||
if( sb->iCurBit + nBits > sb->nDataBits )
|
||||
sb->bOverflow = true;
|
||||
return sb->bOverflow;
|
||||
}
|
||||
|
||||
void MSG_InitMasks( void ); // called once at startup engine
|
||||
void MSG_ExciseBits( sizebuf_t *sb, int startbit, int bitstoremove );
|
||||
|
||||
// Bit-write functions
|
||||
void MSG_WriteOneBit( sizebuf_t *sb, int nValue );
|
||||
@@ -99,20 +194,11 @@ void MSG_WriteCoord( sizebuf_t *sb, float val );
|
||||
void MSG_WriteFloat( sizebuf_t *sb, float val );
|
||||
void MSG_WriteVec3Coord( sizebuf_t *sb, const float *fa );
|
||||
void MSG_WriteVec3Angles( sizebuf_t *sb, const float *fa );
|
||||
qboolean MSG_WriteBytes( sizebuf_t *sb, const void *pBuf, int nBytes ); // same as MSG_WriteData
|
||||
qboolean MSG_WriteString( sizebuf_t *sb, const char *pStr ); // returns false if it overflows the buffer.
|
||||
qboolean MSG_WriteStringf( sizebuf_t *sb, const char *format, ... ) _format( 2 );
|
||||
qboolean MSG_WriteBytes( sizebuf_t *sb, const void *pBuf, int nBytes );
|
||||
|
||||
// helper functions
|
||||
_inline int MSG_GetNumBytesWritten( sizebuf_t *sb ) { return BitByte( sb->iCurBit ); }
|
||||
_inline int MSG_GetRealBytesWritten( sizebuf_t *sb ) { return sb->iCurBit >> 3; } // unpadded
|
||||
_inline int MSG_GetNumBitsWritten( sizebuf_t *sb ) { return sb->iCurBit; }
|
||||
_inline int MSG_GetMaxBits( sizebuf_t *sb ) { return sb->nDataBits; }
|
||||
_inline int MSG_GetMaxBytes( sizebuf_t *sb ) { return sb->nDataBits >> 3; }
|
||||
_inline int MSG_GetNumBitsLeft( sizebuf_t *sb ) { return sb->nDataBits - sb->iCurBit; }
|
||||
_inline int MSG_GetNumBytesLeft( sizebuf_t *sb ) { return MSG_GetNumBitsLeft( sb ) >> 3; }
|
||||
_inline byte *MSG_GetData( sizebuf_t *sb ) { return sb->pData; }
|
||||
_inline byte *MSG_GetBuf( sizebuf_t *sb ) { return sb->pData; } // just an alias
|
||||
|
||||
// Bit-read functions
|
||||
int MSG_ReadOneBit( sizebuf_t *sb );
|
||||
@@ -136,7 +222,8 @@ float MSG_ReadCoord( sizebuf_t *sb );
|
||||
float MSG_ReadFloat( sizebuf_t *sb );
|
||||
void MSG_ReadVec3Coord( sizebuf_t *sb, vec3_t fa );
|
||||
void MSG_ReadVec3Angles( sizebuf_t *sb, vec3_t fa );
|
||||
char *MSG_ReadString( sizebuf_t *sb );
|
||||
char *MSG_ReadStringLine( sizebuf_t *sb );
|
||||
qboolean MSG_ReadBytes( sizebuf_t *sb, void *pOut, int nBytes );
|
||||
char *MSG_ReadStringExt( sizebuf_t *sb, qboolean bLine );
|
||||
|
||||
#endif//NET_BUFFER_H
|
||||
|
||||
@@ -198,44 +198,6 @@ qboolean NetSplit_GetLong( netsplit_t *ns, netadr_t *from, byte *data, size_t *l
|
||||
return false;
|
||||
}
|
||||
|
||||
/*
|
||||
======================
|
||||
NetSplit_SendLong
|
||||
|
||||
Send parts that are less or equal maxpacket
|
||||
======================
|
||||
*/
|
||||
void NetSplit_SendLong( netsrc_t sock, size_t length, void *data, netadr_t to, unsigned int maxpacket, unsigned int id)
|
||||
{
|
||||
netsplit_packet_t packet = {0};
|
||||
unsigned int part = maxpacket - NETSPLIT_HEADER_SIZE;
|
||||
|
||||
packet.signature = LittleLong(0xFFFFFFFE);
|
||||
packet.id = LittleLong(id);
|
||||
packet.length = LittleLong(length);
|
||||
packet.part = LittleLong(part);
|
||||
packet.count = ( length - 1 ) / part + 1;
|
||||
|
||||
//Con_Reportf( S_NOTE "NetSplit_SendLong: packet to %s, count %d, length %d\n", NET_AdrToString( to ), (int)packet.count, (int)packet.length );
|
||||
|
||||
while( packet.index < packet.count )
|
||||
{
|
||||
unsigned int size = part;
|
||||
|
||||
if( size > length )
|
||||
size = length;
|
||||
|
||||
length -= size;
|
||||
|
||||
memcpy( packet.data, (const byte*)data + packet.index * part, size );
|
||||
//Con_Reportf( S_NOTE "NetSplit_SendLong: packet to %s, id %d, index %d\n", NET_AdrToString( to ), (int)packet.id, (int)packet.index );
|
||||
|
||||
NET_SendPacket( sock, size + NETSPLIT_HEADER_SIZE, &packet, to );
|
||||
packet.index++;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
===============
|
||||
Netchan_Init
|
||||
@@ -367,7 +329,7 @@ Netchan_UnlinkFragment
|
||||
|
||||
==============================
|
||||
*/
|
||||
void Netchan_UnlinkFragment( fragbuf_t *buf, fragbuf_t **list )
|
||||
static void Netchan_UnlinkFragment( fragbuf_t *buf, fragbuf_t **list )
|
||||
{
|
||||
fragbuf_t *search;
|
||||
|
||||
@@ -405,7 +367,7 @@ Netchan_ClearFragbufs
|
||||
|
||||
==============================
|
||||
*/
|
||||
void Netchan_ClearFragbufs( fragbuf_t **ppbuf )
|
||||
static void Netchan_ClearFragbufs( fragbuf_t **ppbuf )
|
||||
{
|
||||
fragbuf_t *buf, *n;
|
||||
|
||||
@@ -431,7 +393,7 @@ Netchan_ClearFragments
|
||||
|
||||
==============================
|
||||
*/
|
||||
void Netchan_ClearFragments( netchan_t *chan )
|
||||
static void Netchan_ClearFragments( netchan_t *chan )
|
||||
{
|
||||
fragbufwaiting_t *wait, *next;
|
||||
int i;
|
||||
@@ -539,7 +501,7 @@ Netchan_AllocFragbuf
|
||||
|
||||
==============================
|
||||
*/
|
||||
fragbuf_t *Netchan_AllocFragbuf( int fragment_size )
|
||||
static fragbuf_t *Netchan_AllocFragbuf( int fragment_size )
|
||||
{
|
||||
fragbuf_t *buf;
|
||||
|
||||
@@ -556,7 +518,7 @@ Netchan_AddFragbufToTail
|
||||
|
||||
==============================
|
||||
*/
|
||||
void Netchan_AddFragbufToTail( fragbufwaiting_t *wait, fragbuf_t *buf )
|
||||
static void Netchan_AddFragbufToTail( fragbufwaiting_t *wait, fragbuf_t *buf )
|
||||
{
|
||||
fragbuf_t *p;
|
||||
|
||||
@@ -579,7 +541,7 @@ Netchan_UpdateFlow
|
||||
|
||||
==============================
|
||||
*/
|
||||
void Netchan_UpdateFlow( netchan_t *chan )
|
||||
static void Netchan_UpdateFlow( netchan_t *chan )
|
||||
{
|
||||
float faccumulatedtime = 0.0;
|
||||
int i, bytes = 0;
|
||||
@@ -791,7 +753,7 @@ Netchan_FindBufferById
|
||||
|
||||
==============================
|
||||
*/
|
||||
fragbuf_t *Netchan_FindBufferById( fragbuf_t **pplist, int id, qboolean allocate )
|
||||
static fragbuf_t *Netchan_FindBufferById( fragbuf_t **pplist, int id, qboolean allocate )
|
||||
{
|
||||
fragbuf_t *list = *pplist;
|
||||
fragbuf_t *pnewbuf;
|
||||
@@ -821,7 +783,7 @@ Netchan_CheckForCompletion
|
||||
|
||||
==============================
|
||||
*/
|
||||
void Netchan_CheckForCompletion( netchan_t *chan, int stream, int intotalbuffers )
|
||||
static void Netchan_CheckForCompletion( netchan_t *chan, int stream, int intotalbuffers )
|
||||
{
|
||||
int c, id;
|
||||
int size;
|
||||
@@ -1287,7 +1249,7 @@ qboolean Netchan_CopyFileFragments( netchan_t *chan, sizebuf_t *msg )
|
||||
return true;
|
||||
}
|
||||
|
||||
qboolean Netchan_Validate( netchan_t *chan, sizebuf_t *sb, qboolean *frag_message, uint *fragid, int *frag_offset, int *frag_length )
|
||||
static qboolean Netchan_Validate( netchan_t *chan, sizebuf_t *sb, qboolean *frag_message, uint *fragid, int *frag_offset, int *frag_length )
|
||||
{
|
||||
int i, buffer, offset;
|
||||
int count, length;
|
||||
|
||||
@@ -315,6 +315,43 @@ static const delta_field_t ent_fields[] =
|
||||
{ NULL },
|
||||
};
|
||||
|
||||
#if XASH_ENGINE_TESTS
|
||||
typedef struct delta_test_struct_t
|
||||
{
|
||||
char dt_string[128]; // always signed
|
||||
float dt_timewindow_big; // always signed
|
||||
float dt_timewindow_8; // always signed
|
||||
float dt_angle; // always_signed
|
||||
float dt_float_signed;
|
||||
float dt_float_unsigned;
|
||||
int32_t dt_integer_signed;
|
||||
uint32_t dt_integer_unsigned;
|
||||
int16_t dt_short_signed;
|
||||
uint16_t dt_short_unsigned;
|
||||
int8_t dt_byte_signed;
|
||||
uint8_t dt_byte_unsigned;
|
||||
} delta_test_struct_t;
|
||||
|
||||
#define TEST_DEF( x ) #x, offsetof( delta_test_struct_t, x ), sizeof( ((delta_test_struct_t *)0)->x )
|
||||
|
||||
static const delta_field_t test_fields[] =
|
||||
{
|
||||
{ TEST_DEF( dt_string ) },
|
||||
{ TEST_DEF( dt_timewindow_big )},
|
||||
{ TEST_DEF( dt_timewindow_8 )},
|
||||
{ TEST_DEF( dt_angle ) },
|
||||
{ TEST_DEF( dt_float_signed ) },
|
||||
{ TEST_DEF( dt_float_unsigned ) },
|
||||
{ TEST_DEF( dt_integer_signed ) },
|
||||
{ TEST_DEF( dt_integer_unsigned ) },
|
||||
{ TEST_DEF( dt_short_signed ) },
|
||||
{ TEST_DEF( dt_short_unsigned ) },
|
||||
{ TEST_DEF( dt_byte_signed ) },
|
||||
{ TEST_DEF( dt_byte_unsigned ) },
|
||||
{ NULL },
|
||||
};
|
||||
#endif
|
||||
|
||||
enum
|
||||
{
|
||||
DT_EVENT_T = 0,
|
||||
@@ -325,6 +362,10 @@ enum
|
||||
DT_ENTITY_STATE_T,
|
||||
DT_ENTITY_STATE_PLAYER_T,
|
||||
DT_CUSTOM_ENTITY_STATE_T,
|
||||
#if XASH_ENGINE_TESTS
|
||||
DT_DELTA_TEST_STRUCT_T,
|
||||
#endif
|
||||
DT_STRUCT_COUNT
|
||||
};
|
||||
|
||||
static delta_info_t dt_info[] =
|
||||
@@ -337,7 +378,10 @@ static delta_info_t dt_info[] =
|
||||
[DT_ENTITY_STATE_T] = { "entity_state_t", ent_fields, NUM_FIELDS( ent_fields ) },
|
||||
[DT_ENTITY_STATE_PLAYER_T] = { "entity_state_player_t", ent_fields, NUM_FIELDS( ent_fields ) },
|
||||
[DT_CUSTOM_ENTITY_STATE_T] = { "custom_entity_state_t", ent_fields, NUM_FIELDS( ent_fields ) },
|
||||
{ NULL },
|
||||
#if XASH_ENGINE_TESTS
|
||||
[DT_DELTA_TEST_STRUCT_T] = { "delta_test_struct_t", test_fields, NUM_FIELDS( test_fields ) },
|
||||
#endif
|
||||
[DT_STRUCT_COUNT] = { NULL },
|
||||
};
|
||||
|
||||
static delta_info_t *Delta_FindStruct( const char *name )
|
||||
@@ -411,9 +455,7 @@ static void Delta_CustomEncode( delta_info_t *dt, const void *from, const void *
|
||||
dt->pFields[i].bInactive = false;
|
||||
|
||||
if( dt->userCallback )
|
||||
{
|
||||
dt->userCallback( dt->pFields, from, to );
|
||||
}
|
||||
}
|
||||
|
||||
static delta_field_t *Delta_FindFieldInfo( const delta_field_t *pInfo, const char *fieldName )
|
||||
@@ -974,14 +1016,14 @@ static qboolean Delta_CompareField( delta_t *pField, void *from, void *to, doubl
|
||||
toF = *(uint8_t *)((int8_t *)to + pField->offset );
|
||||
}
|
||||
|
||||
if( !Q_equal(pField->multiplier, 1.0f ))
|
||||
{
|
||||
fromF *= pField->multiplier;
|
||||
toF *= pField->multiplier;
|
||||
}
|
||||
|
||||
fromF = Delta_ClampIntegerField( pField, fromF, signbit, pField->bits );
|
||||
toF = Delta_ClampIntegerField( pField, toF, signbit, pField->bits );
|
||||
|
||||
if( !Q_equal(pField->multiplier, 1.0f ))
|
||||
fromF *= pField->multiplier;
|
||||
|
||||
if( !Q_equal( pField->multiplier, 1.0f ))
|
||||
toF *= pField->multiplier;
|
||||
}
|
||||
else if( pField->flags & DT_SHORT )
|
||||
{
|
||||
@@ -996,14 +1038,14 @@ static qboolean Delta_CompareField( delta_t *pField, void *from, void *to, doubl
|
||||
toF = *(uint16_t *)((int8_t *)to + pField->offset );
|
||||
}
|
||||
|
||||
if( !Q_equal(pField->multiplier, 1.0f ))
|
||||
{
|
||||
fromF *= pField->multiplier;
|
||||
toF *= pField->multiplier;
|
||||
}
|
||||
|
||||
fromF = Delta_ClampIntegerField( pField, fromF, signbit, pField->bits );
|
||||
toF = Delta_ClampIntegerField( pField, toF, signbit, pField->bits );
|
||||
|
||||
if( !Q_equal(pField->multiplier, 1.0f ))
|
||||
fromF *= pField->multiplier;
|
||||
|
||||
if( !Q_equal( pField->multiplier, 1.0f ))
|
||||
toF *= pField->multiplier;
|
||||
}
|
||||
else if( pField->flags & DT_INTEGER )
|
||||
{
|
||||
@@ -1017,14 +1059,15 @@ static qboolean Delta_CompareField( delta_t *pField, void *from, void *to, doubl
|
||||
fromF = *(uint32_t *)((int8_t *)from + pField->offset );
|
||||
toF = *(uint32_t *)((int8_t *)to + pField->offset );
|
||||
}
|
||||
fromF = Delta_ClampIntegerField( pField, fromF, signbit, pField->bits );
|
||||
toF = Delta_ClampIntegerField( pField, toF, signbit, pField->bits );
|
||||
|
||||
if( !Q_equal(pField->multiplier, 1.0f ))
|
||||
{
|
||||
fromF *= pField->multiplier;
|
||||
|
||||
if( !Q_equal( pField->multiplier, 1.0f ))
|
||||
toF *= pField->multiplier;
|
||||
}
|
||||
|
||||
fromF = Delta_ClampIntegerField( pField, fromF, signbit, pField->bits );
|
||||
toF = Delta_ClampIntegerField( pField, toF, signbit, pField->bits );
|
||||
}
|
||||
else if( pField->flags & ( DT_ANGLE|DT_FLOAT ))
|
||||
{
|
||||
@@ -1034,33 +1077,17 @@ static qboolean Delta_CompareField( delta_t *pField, void *from, void *to, doubl
|
||||
}
|
||||
else if( pField->flags & DT_TIMEWINDOW_8 )
|
||||
{
|
||||
val_a = Q_rint((*(float *)((byte *)from + pField->offset )) * 100.0f );
|
||||
val_b = Q_rint((*(float *)((byte *)to + pField->offset )) * 100.0f );
|
||||
val_a -= Q_rint(timebase * 100.0);
|
||||
val_b -= Q_rint(timebase * 100.0);
|
||||
fromF = FloatAsInt( val_a );
|
||||
toF = FloatAsInt( val_b );
|
||||
val_a = *(float *)((byte *)from + pField->offset );
|
||||
val_b = *(float *)((byte *)to + pField->offset );
|
||||
fromF = Q_rint( val_a * 100.0 );
|
||||
toF = Q_rint( val_b * 100.0 );
|
||||
}
|
||||
else if( pField->flags & DT_TIMEWINDOW_BIG )
|
||||
{
|
||||
val_a = (*(float *)((byte *)from + pField->offset ));
|
||||
val_b = (*(float *)((byte *)to + pField->offset ));
|
||||
|
||||
if( !Q_equal( pField->multiplier, 1.0f ))
|
||||
{
|
||||
val_a *= pField->multiplier;
|
||||
val_b *= pField->multiplier;
|
||||
val_a = (timebase * pField->multiplier) - val_a;
|
||||
val_b = (timebase * pField->multiplier) - val_b;
|
||||
}
|
||||
else
|
||||
{
|
||||
val_a = timebase - val_a;
|
||||
val_b = timebase - val_b;
|
||||
}
|
||||
|
||||
fromF = FloatAsInt( val_a );
|
||||
toF = FloatAsInt( val_b );
|
||||
val_a = *(float *)((byte *)from + pField->offset );
|
||||
val_b = *(float *)((byte *)to + pField->offset );
|
||||
fromF = Q_rint( val_a * pField->multiplier );
|
||||
toF = Q_rint( val_b * pField->multiplier );
|
||||
}
|
||||
else if( pField->flags & DT_STRING )
|
||||
{
|
||||
@@ -1144,6 +1171,7 @@ static qboolean Delta_WriteField( sizebuf_t *msg, delta_t *pField, void *from, v
|
||||
int signbit = FBitSet( pField->flags, DT_SIGNED ) ? 1 : 0;
|
||||
float flValue, flAngle;
|
||||
uint iValue;
|
||||
int dt;
|
||||
const char *pStr;
|
||||
|
||||
if( Delta_CompareField( pField, from, to, timebase ))
|
||||
@@ -1160,11 +1188,11 @@ static qboolean Delta_WriteField( sizebuf_t *msg, delta_t *pField, void *from, v
|
||||
iValue = *(int8_t *)((int8_t *)to + pField->offset );
|
||||
else
|
||||
iValue = *(uint8_t *)((int8_t *)to + pField->offset );
|
||||
iValue = Delta_ClampIntegerField( pField, iValue, signbit, pField->bits );
|
||||
|
||||
if( !Q_equal( pField->multiplier, 1.0 ) )
|
||||
if( !Q_equal( pField->multiplier, 1.0 ))
|
||||
iValue *= pField->multiplier;
|
||||
|
||||
iValue = Delta_ClampIntegerField( pField, iValue, signbit, pField->bits );
|
||||
MSG_WriteBitLong( msg, iValue, pField->bits, signbit );
|
||||
}
|
||||
else if( pField->flags & DT_SHORT )
|
||||
@@ -1173,11 +1201,11 @@ static qboolean Delta_WriteField( sizebuf_t *msg, delta_t *pField, void *from, v
|
||||
iValue = *(int16_t *)((int8_t *)to + pField->offset );
|
||||
else
|
||||
iValue = *(uint16_t *)((int8_t *)to + pField->offset );
|
||||
iValue = Delta_ClampIntegerField( pField, iValue, signbit, pField->bits );
|
||||
|
||||
if( !Q_equal( pField->multiplier, 1.0 ) )
|
||||
if( !Q_equal( pField->multiplier, 1.0 ))
|
||||
iValue *= pField->multiplier;
|
||||
|
||||
|
||||
iValue = Delta_ClampIntegerField( pField, iValue, signbit, pField->bits );
|
||||
MSG_WriteBitLong( msg, iValue, pField->bits, signbit );
|
||||
}
|
||||
else if( pField->flags & DT_INTEGER )
|
||||
@@ -1186,11 +1214,11 @@ static qboolean Delta_WriteField( sizebuf_t *msg, delta_t *pField, void *from, v
|
||||
iValue = *(int32_t *)((int8_t *)to + pField->offset );
|
||||
else
|
||||
iValue = *(uint32_t *)((int8_t *)to + pField->offset );
|
||||
iValue = Delta_ClampIntegerField( pField, iValue, signbit, pField->bits );
|
||||
|
||||
if( !Q_equal( pField->multiplier, 1.0 ) )
|
||||
if( !Q_equal( pField->multiplier, 1.0 ))
|
||||
iValue *= pField->multiplier;
|
||||
|
||||
iValue = Delta_ClampIntegerField( pField, iValue, signbit, pField->bits );
|
||||
MSG_WriteBitLong( msg, iValue, pField->bits, signbit );
|
||||
}
|
||||
else if( pField->flags & DT_FLOAT )
|
||||
@@ -1210,19 +1238,17 @@ static qboolean Delta_WriteField( sizebuf_t *msg, delta_t *pField, void *from, v
|
||||
}
|
||||
else if( pField->flags & DT_TIMEWINDOW_8 )
|
||||
{
|
||||
signbit = 1; // timewindow is always signed
|
||||
flValue = *(float *)((byte *)to + pField->offset );
|
||||
iValue = (int)Q_rint( timebase * 100.0 ) - (int)Q_rint( flValue * 100.0 );
|
||||
iValue = Delta_ClampIntegerField( pField, iValue, signbit, pField->bits );
|
||||
MSG_WriteBitLong( msg, iValue, pField->bits, signbit );
|
||||
dt = Q_rint(( timebase - flValue ) * 100.0 );
|
||||
dt = Delta_ClampIntegerField( pField, dt, 1, pField->bits );
|
||||
MSG_WriteSBitLong( msg, dt, pField->bits );
|
||||
}
|
||||
else if( pField->flags & DT_TIMEWINDOW_BIG )
|
||||
{
|
||||
signbit = 1; // timewindow is always signed
|
||||
flValue = *(float *)((byte *)to + pField->offset );
|
||||
iValue = (int)Q_rint( timebase * pField->multiplier ) - (int)Q_rint( flValue * pField->multiplier );
|
||||
iValue = Delta_ClampIntegerField( pField, iValue, signbit, pField->bits );
|
||||
MSG_WriteBitLong( msg, iValue, pField->bits, signbit );
|
||||
dt = Q_rint(( timebase - flValue ) * pField->multiplier );
|
||||
dt = Delta_ClampIntegerField( pField, dt, 1, pField->bits );
|
||||
MSG_WriteSBitLong( msg, dt, pField->bits );
|
||||
}
|
||||
else if( pField->flags & DT_STRING )
|
||||
{
|
||||
@@ -1306,9 +1332,12 @@ static qboolean Delta_ReadField( sizebuf_t *msg, delta_t *pField, void *from, vo
|
||||
if( pField->flags & DT_BYTE )
|
||||
{
|
||||
iValue = MSG_ReadBitLong( msg, pField->bits, bSigned );
|
||||
if( !Q_equal( pField->multiplier, 1.0 ) )
|
||||
if( !Q_equal( pField->multiplier, 1.0 ))
|
||||
iValue /= pField->multiplier;
|
||||
|
||||
if( !Q_equal( pField->post_multiplier, 1.0 ))
|
||||
iValue *= pField->post_multiplier;
|
||||
|
||||
if( bSigned )
|
||||
*(int8_t *)((uint8_t *)to + pField->offset ) = iValue;
|
||||
else
|
||||
@@ -1317,9 +1346,12 @@ static qboolean Delta_ReadField( sizebuf_t *msg, delta_t *pField, void *from, vo
|
||||
else if( pField->flags & DT_SHORT )
|
||||
{
|
||||
iValue = MSG_ReadBitLong( msg, pField->bits, bSigned );
|
||||
if( !Q_equal( pField->multiplier, 1.0 ) )
|
||||
if( !Q_equal( pField->multiplier, 1.0 ))
|
||||
iValue /= pField->multiplier;
|
||||
|
||||
if( !Q_equal( pField->post_multiplier, 1.0 ))
|
||||
iValue *= pField->post_multiplier;
|
||||
|
||||
if( bSigned )
|
||||
*(int16_t *)((uint8_t *)to + pField->offset ) = iValue;
|
||||
else
|
||||
@@ -1328,9 +1360,12 @@ static qboolean Delta_ReadField( sizebuf_t *msg, delta_t *pField, void *from, vo
|
||||
else if( pField->flags & DT_INTEGER )
|
||||
{
|
||||
iValue = MSG_ReadBitLong( msg, pField->bits, bSigned );
|
||||
if( !Q_equal( pField->multiplier, 1.0 ) )
|
||||
if( !Q_equal( pField->multiplier, 1.0 ))
|
||||
iValue /= pField->multiplier;
|
||||
|
||||
if( !Q_equal( pField->post_multiplier, 1.0 ))
|
||||
iValue *= pField->post_multiplier;
|
||||
|
||||
if( bSigned )
|
||||
*(int32_t *)((uint8_t *)to + pField->offset ) = iValue;
|
||||
else
|
||||
@@ -1344,11 +1379,11 @@ static qboolean Delta_ReadField( sizebuf_t *msg, delta_t *pField, void *from, vo
|
||||
else
|
||||
flValue = iValue;
|
||||
|
||||
if( !Q_equal( pField->multiplier, 1.0 ) )
|
||||
flValue = flValue / pField->multiplier;
|
||||
if( !Q_equal( pField->multiplier, 1.0 ))
|
||||
flValue /= pField->multiplier;
|
||||
|
||||
if( !Q_equal( pField->post_multiplier, 1.0 ) )
|
||||
flValue = flValue * pField->post_multiplier;
|
||||
if( !Q_equal( pField->post_multiplier, 1.0 ))
|
||||
flValue *= pField->post_multiplier;
|
||||
|
||||
*(float *)((byte *)to + pField->offset ) = flValue;
|
||||
}
|
||||
@@ -1359,22 +1394,14 @@ static qboolean Delta_ReadField( sizebuf_t *msg, delta_t *pField, void *from, vo
|
||||
}
|
||||
else if( pField->flags & DT_TIMEWINDOW_8 )
|
||||
{
|
||||
bSigned = true; // timewindow is always signed
|
||||
iValue = MSG_ReadBitLong( msg, pField->bits, bSigned );
|
||||
flTime = (timebase * 100.0 - (int)iValue) / 100.0;
|
||||
|
||||
iValue = MSG_ReadSBitLong( msg, pField->bits );
|
||||
flTime = ( timebase * 100.0 - (int)iValue ) / 100.0;
|
||||
*(float *)((byte *)to + pField->offset ) = flTime;
|
||||
}
|
||||
else if( pField->flags & DT_TIMEWINDOW_BIG )
|
||||
{
|
||||
bSigned = true; // timewindow is always signed
|
||||
iValue = MSG_ReadBitLong( msg, pField->bits, bSigned );
|
||||
|
||||
if( !Q_equal( pField->multiplier, 1.0 ) )
|
||||
flTime = ( timebase * pField->multiplier - (int)iValue ) / pField->multiplier;
|
||||
else
|
||||
flTime = timebase - (int)iValue;
|
||||
|
||||
iValue = MSG_ReadSBitLong( msg, pField->bits );
|
||||
flTime = ( timebase * pField->multiplier - (int)iValue ) / pField->multiplier;
|
||||
*(float *)((byte *)to + pField->offset ) = flTime;
|
||||
}
|
||||
else if( pField->flags & DT_STRING )
|
||||
@@ -2069,3 +2096,103 @@ void GAME_EXPORT Delta_UnsetFieldByIndex( delta_t *pFields, int fieldNumber )
|
||||
|
||||
dt->pFields[fieldNumber].bInactive = true;
|
||||
}
|
||||
|
||||
#if XASH_ENGINE_TESTS
|
||||
#include "tests.h"
|
||||
|
||||
void Test_RunDelta( void )
|
||||
{
|
||||
delta_info_t *dt = &dt_info[DT_DELTA_TEST_STRUCT_T];
|
||||
delta_test_struct_t from, to = { 0 };
|
||||
delta_test_struct_t null = { 0 };
|
||||
sizebuf_t msg;
|
||||
int i;
|
||||
char buffer[4096] = { 0 };
|
||||
const double timebase = 123.123;
|
||||
|
||||
// a1ba: netbuffer bitmasks are initialized in netchan for some reason
|
||||
// initialize it ourselves just in case
|
||||
MSG_InitMasks(); // initialize bit-masks
|
||||
|
||||
Delta_AddField( dt, "dt_string", DT_STRING, 1, 1.0f, 1.0f );
|
||||
Delta_AddField( dt, "dt_timewindow_big", DT_TIMEWINDOW_BIG, 24, 1000.f, 1.0f );
|
||||
Delta_AddField( dt, "dt_timewindow_8", DT_TIMEWINDOW_8, 8, 1.0f, 1.0f );
|
||||
Delta_AddField( dt, "dt_angle", DT_ANGLE, 16, 1.0f, 1.0f );
|
||||
Delta_AddField( dt, "dt_float_signed", DT_FLOAT | DT_SIGNED, 22, 100.0f, 1.0f );
|
||||
Delta_AddField( dt, "dt_float_unsigned", DT_FLOAT, 24, 10000.0f, 0.1f );
|
||||
Delta_AddField( dt, "dt_integer_signed", DT_INTEGER | DT_SIGNED, 24, 1.0f, 1.0f );
|
||||
Delta_AddField( dt, "dt_integer_unsigned", DT_INTEGER, 24, 1.0f, 1.0f );
|
||||
Delta_AddField( dt, "dt_short_signed", DT_SHORT | DT_SIGNED, 16, 1.0f, 1.0f );
|
||||
Delta_AddField( dt, "dt_short_unsigned", DT_SHORT, 15, 0.125f, 1.0f );
|
||||
Delta_AddField( dt, "dt_byte_signed", DT_BYTE | DT_SIGNED, 6, 1.0f, 1.0f );
|
||||
Delta_AddField( dt, "dt_byte_unsigned", DT_BYTE, 8, 1.0f, 1.0f );
|
||||
|
||||
Q_strncpy( from.dt_string, "test data check it's the same", sizeof( from.dt_string ));
|
||||
from.dt_timewindow_big = timebase + 2.3456;
|
||||
from.dt_timewindow_8 = timebase + 0.0234;
|
||||
from.dt_angle = 160.245f;
|
||||
from.dt_float_signed = -15.123f;
|
||||
from.dt_float_unsigned = 1235.321f;
|
||||
from.dt_integer_signed = -412784;
|
||||
from.dt_integer_unsigned = 123453;
|
||||
from.dt_short_signed = -12343;
|
||||
from.dt_short_unsigned = 32131;
|
||||
from.dt_byte_signed = 16;
|
||||
from.dt_byte_unsigned = 218;
|
||||
|
||||
MSG_Init( &msg, "test message", buffer, sizeof( buffer ));
|
||||
|
||||
for( i = 0; i < dt->numFields; i++ )
|
||||
Delta_WriteField( &msg, &dt->pFields[i], &null, &from, timebase );
|
||||
|
||||
MSG_SeekToBit( &msg, 0, SEEK_SET );
|
||||
|
||||
for( i = 0; i < dt->numFields; i++ )
|
||||
Delta_ReadField( &msg, &dt->pFields[i], &null, &to, timebase );
|
||||
|
||||
Con_Printf( "struct as encoded to delta:\n" );
|
||||
TASSERT_STR( from.dt_string, to.dt_string );
|
||||
|
||||
// the epsilon value is derived from multiplier value
|
||||
TASSERT( Q_equal_e( from.dt_timewindow_big, to.dt_timewindow_big, 0.001f ));
|
||||
|
||||
// dt_timewindow_8 type has multiplier locked at 100.0f
|
||||
TASSERT( Q_equal_e( from.dt_timewindow_8, to.dt_timewindow_8, 0.01f ));
|
||||
TASSERT( Q_equal_e( from.dt_angle, to.dt_angle, 0.1f ));
|
||||
TASSERT( Q_equal_e( from.dt_float_signed, to.dt_float_signed, 0.01f ));
|
||||
|
||||
// dt_float_unsigned has post-multiplier that doesn't affect network data
|
||||
// and therefore should be reverted back when comparing
|
||||
TASSERT( Q_equal_e( from.dt_float_unsigned, to.dt_float_unsigned * 10.f , 0.01f ));
|
||||
|
||||
TASSERT_EQi( from.dt_integer_signed, to.dt_integer_signed );
|
||||
TASSERT_EQi( from.dt_integer_unsigned, to.dt_integer_unsigned );
|
||||
TASSERT_EQi( from.dt_short_signed, to.dt_short_signed );
|
||||
TASSERT(( from.dt_short_unsigned & ( 0xffff << 3 )) == to.dt_short_unsigned );
|
||||
TASSERT_EQi( from.dt_byte_signed, to.dt_byte_signed );
|
||||
TASSERT_EQi( from.dt_byte_unsigned, to.dt_byte_unsigned );
|
||||
|
||||
Con_Printf( "from.dt_timewindow_big = %f\n", from.dt_timewindow_big );
|
||||
Con_Printf( "to.dt_timewindow_big = %f\n", to.dt_timewindow_big );
|
||||
Con_Printf( "from.dt_timewindow_8 = %f\n", from.dt_timewindow_8 );
|
||||
Con_Printf( "to.dt_timewindow_8 = %f\n", to.dt_timewindow_8 );
|
||||
Con_Printf( "from.dt_angle = %f\n", from.dt_angle );
|
||||
Con_Printf( "to.dt_angle = %f\n", to.dt_angle );
|
||||
Con_Printf( "from.dt_float_signed = %f\n", from.dt_float_signed );
|
||||
Con_Printf( "to.dt_float_signed = %f\n", to.dt_float_signed );
|
||||
Con_Printf( "from.dt_float_unsigned = %f\n", from.dt_float_unsigned );
|
||||
Con_Printf( "to.dt_float_unsigned = %f\n", to.dt_float_unsigned );
|
||||
Con_Printf( "from.dt_integer_signed = %i\n", from.dt_integer_signed );
|
||||
Con_Printf( "to.dt_integer_signed = %i\n", to.dt_integer_signed );
|
||||
Con_Printf( "from.dt_integer_unsigned = %i\n", from.dt_integer_unsigned );
|
||||
Con_Printf( "to.dt_integer_unsigned = %i\n", to.dt_integer_unsigned );
|
||||
Con_Printf( "from.dt_short_signed = %i\n", from.dt_short_signed );
|
||||
Con_Printf( "to.dt_short_signed = %i\n", to.dt_short_signed );
|
||||
Con_Printf( "from.dt_short_unsigned = %i\n", from.dt_short_unsigned );
|
||||
Con_Printf( "to.dt_short_unsigned = %i\n", to.dt_short_unsigned );
|
||||
Con_Printf( "from.dt_byte_signed = %i\n", from.dt_byte_signed );
|
||||
Con_Printf( "to.dt_byte_signed = %i\n", to.dt_byte_signed );
|
||||
Con_Printf( "from.dt_byte_unsigned = %i\n", from.dt_byte_unsigned );
|
||||
Con_Printf( "to.dt_byte_unsigned = %i\n", to.dt_byte_unsigned );
|
||||
}
|
||||
#endif // XASH_ENGINE_TESTS
|
||||
|
||||
@@ -317,7 +317,7 @@ static void NET_SockadrToNetadr( const struct sockaddr_storage *s, netadr_t *a )
|
||||
NET_GetHostByName
|
||||
============
|
||||
*/
|
||||
qboolean NET_GetHostByName( const char *hostname, int family, struct sockaddr_storage *addr )
|
||||
static qboolean NET_GetHostByName( const char *hostname, int family, struct sockaddr_storage *addr )
|
||||
{
|
||||
#if defined HAVE_GETADDRINFO
|
||||
struct addrinfo *ai = NULL, *cur;
|
||||
@@ -372,7 +372,7 @@ static void NET_ResolveThread( void );
|
||||
#define detach_thread( x ) pthread_detach(x)
|
||||
#define mutex_t pthread_mutex_t
|
||||
#define thread_t pthread_t
|
||||
void *NET_ThreadStart( void *unused )
|
||||
static void *NET_ThreadStart( void *unused )
|
||||
{
|
||||
NET_ResolveThread();
|
||||
return NULL;
|
||||
@@ -1018,7 +1018,7 @@ idnewt
|
||||
192.246.40.70
|
||||
=============
|
||||
*/
|
||||
qboolean NET_StringToAdrEx( const char *string, netadr_t *adr, int family )
|
||||
static qboolean NET_StringToAdrEx( const char *string, netadr_t *adr, int family )
|
||||
{
|
||||
struct sockaddr_storage s;
|
||||
|
||||
@@ -1339,7 +1339,7 @@ NET_GetLong
|
||||
receive long packet from network
|
||||
==================
|
||||
*/
|
||||
qboolean NET_GetLong( byte *pData, int size, size_t *outSize, int splitsize )
|
||||
static qboolean NET_GetLong( byte *pData, int size, size_t *outSize, int splitsize )
|
||||
{
|
||||
int i, sequence_number, offset;
|
||||
SPLITPACKET *pHeader = (SPLITPACKET *)pData;
|
||||
@@ -1534,7 +1534,7 @@ NET_SendLong
|
||||
Fragment long packets, send short directly
|
||||
==================
|
||||
*/
|
||||
int NET_SendLong( netsrc_t sock, int net_socket, const char *buf, size_t len, int flags, const struct sockaddr_storage *to, size_t tolen, size_t splitsize )
|
||||
static int NET_SendLong( netsrc_t sock, int net_socket, const char *buf, size_t len, int flags, const struct sockaddr_storage *to, size_t tolen, size_t splitsize )
|
||||
{
|
||||
#ifdef NET_USE_FRAGMENTS
|
||||
// do we need to break this packet up?
|
||||
@@ -1864,7 +1864,7 @@ NET_GetLocalAddress
|
||||
Returns the servers' ip address as a string.
|
||||
================
|
||||
*/
|
||||
void NET_GetLocalAddress( void )
|
||||
static void NET_GetLocalAddress( void )
|
||||
{
|
||||
char hostname[512];
|
||||
char buff[512];
|
||||
|
||||
@@ -48,7 +48,7 @@ SampleMiptex
|
||||
fence texture testing
|
||||
=============
|
||||
*/
|
||||
int PM_SampleMiptex( const msurface_t *surf, const vec3_t point )
|
||||
static int PM_SampleMiptex( const msurface_t *surf, const vec3_t point )
|
||||
{
|
||||
mextrasurf_t *info = surf->info;
|
||||
mfacebevel_t *fb = info->bevel;
|
||||
@@ -221,7 +221,7 @@ PM_TestLine_r
|
||||
optimized trace for light gathering
|
||||
==================
|
||||
*/
|
||||
int PM_TestLine_r( model_t *mod, mnode_t *node, vec_t p1f, vec_t p2f, const vec3_t start, const vec3_t stop, linetrace_t *trace )
|
||||
static int PM_TestLine_r( model_t *mod, mnode_t *node, vec_t p1f, vec_t p2f, const vec3_t start, const vec3_t stop, linetrace_t *trace )
|
||||
{
|
||||
float front, back;
|
||||
float frac, midf;
|
||||
|
||||
@@ -105,7 +105,7 @@ To keep everything totally uniform, bounding boxes are turned into small
|
||||
BSP trees instead of being compared directly.
|
||||
===================
|
||||
*/
|
||||
hull_t *PM_HullForBox( const vec3_t mins, const vec3_t maxs )
|
||||
static hull_t *PM_HullForBox( const vec3_t mins, const vec3_t maxs )
|
||||
{
|
||||
pm_boxplanes[0].dist = maxs[0];
|
||||
pm_boxplanes[1].dist = mins[0];
|
||||
@@ -199,7 +199,7 @@ PM_HullForStudio
|
||||
generate multiple hulls as hitboxes
|
||||
==================
|
||||
*/
|
||||
hull_t *PM_HullForStudio( physent_t *pe, playermove_t *pmove, int *numhitboxes )
|
||||
static hull_t *PM_HullForStudio( physent_t *pe, playermove_t *pmove, int *numhitboxes )
|
||||
{
|
||||
vec3_t size;
|
||||
|
||||
|
||||
@@ -127,7 +127,7 @@ GNU General Public License for more details.
|
||||
#define MAX_CUSTOM (1<<MAX_CUSTOM_BITS)// 10 bits == 1024 generic file
|
||||
#define MAX_USER_MESSAGES 197 // another 58 messages reserved for engine routines
|
||||
#define MAX_DLIGHTS 32 // dynamic lights (rendered per one frame)
|
||||
#define MAX_ELIGHTS 64 // entity only point lights
|
||||
#define MAX_ELIGHTS 128 // a1ba: increased from 64 to 128, entity only point lights
|
||||
#define MAX_LIGHTSTYLES 256 // a1ba: increased from 64 to 256, protocol limit
|
||||
#define MAX_RENDER_DECALS 4096 // max rendering decals per a level
|
||||
|
||||
|
||||
@@ -56,20 +56,20 @@ static int good_enc( const int enc )
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
void mpg123_rates( const long **list, size_t *number )
|
||||
static void mpg123_rates( const long **list, size_t *number )
|
||||
{
|
||||
if( number != NULL ) *number = sizeof( my_rates ) / sizeof( long );
|
||||
if( list != NULL ) *list = my_rates;
|
||||
}
|
||||
|
||||
// now that's a bit tricky... One build of the library knows only a subset of the encodings.
|
||||
void mpg123_encodings( const int **list, size_t *number )
|
||||
static void mpg123_encodings( const int **list, size_t *number )
|
||||
{
|
||||
if( number != NULL ) *number = sizeof( good_encodings ) / sizeof( int );
|
||||
if( list != NULL ) *list = good_encodings;
|
||||
}
|
||||
|
||||
int mpg123_encsize( int encoding )
|
||||
static int mpg123_encsize( int encoding )
|
||||
{
|
||||
return sizeof( short );
|
||||
}
|
||||
@@ -364,7 +364,7 @@ int mpg123_format( mpg123_handle_t *mh, long rate, int channels, int encodings )
|
||||
return r;
|
||||
}
|
||||
|
||||
int mpg123_format_support( mpg123_handle_t *mh, long rate, int encoding )
|
||||
static int mpg123_format_support( mpg123_handle_t *mh, long rate, int encoding )
|
||||
{
|
||||
if( mh == NULL )
|
||||
return 0;
|
||||
|
||||
@@ -393,7 +393,7 @@ void frame_exit( mpg123_handle_t *fr )
|
||||
bc_cleanup( &fr->rdat.buffer );
|
||||
}
|
||||
|
||||
int mpg123_framedata( mpg123_handle_t *mh, ulong *header, byte **bodydata, size_t *bodybytes )
|
||||
static int mpg123_framedata( mpg123_handle_t *mh, ulong *header, byte **bodydata, size_t *bodybytes )
|
||||
{
|
||||
if( mh == NULL )
|
||||
return MPG123_BAD_HANDLE;
|
||||
@@ -512,7 +512,7 @@ mpg_off_t frame_index_find( mpg123_handle_t *fr, mpg_off_t want_frame, mpg_off_t
|
||||
return gopos;
|
||||
}
|
||||
|
||||
mpg_off_t frame_ins2outs( mpg123_handle_t *fr, mpg_off_t ins )
|
||||
static mpg_off_t frame_ins2outs( mpg123_handle_t *fr, mpg_off_t ins )
|
||||
{
|
||||
mpg_off_t outs = 0;
|
||||
|
||||
|
||||
@@ -15,6 +15,7 @@ GNU General Public License for more details.
|
||||
|
||||
#include "mpg123.h"
|
||||
#include "sample.h"
|
||||
#include "libmpg.h"
|
||||
|
||||
static int initialized = 0;
|
||||
|
||||
@@ -83,7 +84,7 @@ mpg123_handle_t *mpg123_parnew( mpg123_parm_t *mp, int *error )
|
||||
return fr;
|
||||
}
|
||||
|
||||
int mpg123_par( mpg123_parm_t *mp, enum mpg123_parms key, long val )
|
||||
static int mpg123_par( mpg123_parm_t *mp, enum mpg123_parms key, long val )
|
||||
{
|
||||
int ret = MPG123_OK;
|
||||
|
||||
@@ -189,7 +190,7 @@ int mpg123_param( mpg123_handle_t *mh, enum mpg123_parms key, long val )
|
||||
}
|
||||
}
|
||||
|
||||
int mpg123_close( mpg123_handle_t *mh )
|
||||
static int mpg123_close( mpg123_handle_t *mh )
|
||||
{
|
||||
if( mh == NULL )
|
||||
return MPG123_BAD_HANDLE;
|
||||
@@ -263,7 +264,7 @@ int mpg123_replace_reader_handle( mpg123_handle_t *mh, mpg_ssize_t (*fread)( voi
|
||||
// a) a new choice of decoder
|
||||
// b) a changed native format of the MPEG stream
|
||||
// ... calls are only valid after parsing some MPEG frame!
|
||||
int decode_update( mpg123_handle_t *mh )
|
||||
static int decode_update( mpg123_handle_t *mh )
|
||||
{
|
||||
long native_rate;
|
||||
int b;
|
||||
@@ -320,13 +321,13 @@ int decode_update( mpg123_handle_t *mh )
|
||||
return 0;
|
||||
}
|
||||
|
||||
size_t mpg123_safe_buffer( void )
|
||||
static size_t mpg123_safe_buffer( void )
|
||||
{
|
||||
// real is the largest possible output
|
||||
return sizeof( float ) * 2 * 1152;
|
||||
}
|
||||
|
||||
size_t mpg123_outblock( mpg123_handle_t *mh )
|
||||
static size_t mpg123_outblock( mpg123_handle_t *mh )
|
||||
{
|
||||
// try to be helpful and never return zero output block size.
|
||||
if( mh != NULL && mh->outblock > 0 )
|
||||
@@ -697,7 +698,7 @@ int mpg123_getformat( mpg123_handle_t *mh, int *rate, int *channels, int *encodi
|
||||
return MPG123_OK;
|
||||
}
|
||||
|
||||
int mpg123_scan( mpg123_handle_t *mh )
|
||||
static int mpg123_scan( mpg123_handle_t *mh )
|
||||
{
|
||||
mpg_off_t track_frames = 0;
|
||||
mpg_off_t track_samples = 0;
|
||||
@@ -963,8 +964,10 @@ const char *mpg123_plain_strerror( int errcode )
|
||||
}
|
||||
}
|
||||
|
||||
const char *get_error( mpg123_handle_t *mh )
|
||||
const char *get_error( void *handle )
|
||||
{
|
||||
mpg123_handle_t *mh = handle;
|
||||
|
||||
if( !mh ) return mpg123_plain_strerror( MPG123_BAD_HANDLE );
|
||||
return mpg123_plain_strerror( mh->err );
|
||||
}
|
||||
|
||||
@@ -68,7 +68,7 @@ void set_pointer( mpg123_handle_t *fr, long backstep )
|
||||
fr->bitindex = 0;
|
||||
}
|
||||
|
||||
int frame_bitrate( mpg123_handle_t *fr )
|
||||
static int frame_bitrate( mpg123_handle_t *fr )
|
||||
{
|
||||
return tabsel_123[fr->lsf][fr->lay-1][fr->bitrate_index];
|
||||
}
|
||||
@@ -643,7 +643,7 @@ static int forget_head_shift( mpg123_handle_t *fr, ulong *newheadp, int forget )
|
||||
// returns: 0: bad or just unparseable tag
|
||||
// 1: good, (possibly) new tag info
|
||||
// <0: reader error (may need more data feed, try again)
|
||||
int parse_new_id3( mpg123_handle_t *fr, ulong first4bytes )
|
||||
static int parse_new_id3( mpg123_handle_t *fr, ulong first4bytes )
|
||||
{
|
||||
byte buf[6];
|
||||
ulong length=0;
|
||||
|
||||
@@ -25,7 +25,7 @@ GNU General Public License for more details.
|
||||
else { *(samples) = REAL_TO_SHORT( sum ); }
|
||||
|
||||
// main synth function, uses the plain dct64
|
||||
int synth_1to1( float *bandPtr, int channel, mpg123_handle_t *fr, int final )
|
||||
static int synth_1to1( float *bandPtr, int channel, mpg123_handle_t *fr, int final )
|
||||
{
|
||||
static const int step = 2;
|
||||
short *samples = (short *) (fr->buffer.data + fr->buffer.fill);
|
||||
@@ -147,7 +147,7 @@ static int synth_stereo( float *bandPtr_l, float *bandPtr_r, mpg123_handle_t *fr
|
||||
}
|
||||
|
||||
// mono to stereo synth, wrapping over synth_1to1
|
||||
int synth_1to1_m2s(float *bandPtr, mpg123_handle_t *fr )
|
||||
static int synth_1to1_m2s(float *bandPtr, mpg123_handle_t *fr )
|
||||
{
|
||||
byte *samples = fr->buffer.data;
|
||||
int i, ret;
|
||||
@@ -165,7 +165,7 @@ int synth_1to1_m2s(float *bandPtr, mpg123_handle_t *fr )
|
||||
}
|
||||
|
||||
// mono synth, wrapping over synth_1to1
|
||||
int synth_1to1_mono( float *bandPtr, mpg123_handle_t *fr )
|
||||
static int synth_1to1_mono( float *bandPtr, mpg123_handle_t *fr )
|
||||
{
|
||||
short samples_tmp[BLOCK];
|
||||
short *tmp1 = samples_tmp;
|
||||
|
||||
@@ -18,7 +18,7 @@ GNU General Public License for more details.
|
||||
// global sound variables
|
||||
sndlib_t sound;
|
||||
|
||||
void Sound_Reset( void )
|
||||
static void Sound_Reset( void )
|
||||
{
|
||||
// reset global variables
|
||||
sound.width = sound.rate = 0;
|
||||
@@ -30,7 +30,7 @@ void Sound_Reset( void )
|
||||
sound.size = 0;
|
||||
}
|
||||
|
||||
wavdata_t *SoundPack( void )
|
||||
static wavdata_t *SoundPack( void )
|
||||
{
|
||||
wavdata_t *pack = Mem_Calloc( host.soundpool, sizeof( wavdata_t ));
|
||||
|
||||
@@ -294,6 +294,7 @@ void FS_FreeStream( stream_t *stream )
|
||||
|
||||
#if XASH_ENGINE_TESTS
|
||||
#define IMPLEMENT_SOUNDLIB_FUZZ_TARGET( export, target ) \
|
||||
int EXPORT export( const uint8_t *Data, size_t Size ); \
|
||||
int EXPORT export( const uint8_t *Data, size_t Size ) \
|
||||
{ \
|
||||
wavdata_t *wav; \
|
||||
|
||||
@@ -186,6 +186,7 @@ static qboolean Sound_ParseID3Tag( const byte *buffer, fs_offset_t filesize )
|
||||
}
|
||||
|
||||
#if XASH_ENGINE_TESTS
|
||||
int EXPORT Fuzz_Sound_ParseID3Tag( const uint8_t *Data, size_t Size );
|
||||
int EXPORT Fuzz_Sound_ParseID3Tag( const uint8_t *Data, size_t Size )
|
||||
{
|
||||
memset( &sound, 0, sizeof( sound ));
|
||||
@@ -294,7 +295,7 @@ qboolean Sound_LoadMPG( const char *name, const byte *buffer, fs_offset_t filesi
|
||||
FS_SeekEx
|
||||
=================
|
||||
*/
|
||||
fs_offset_t FS_SeekEx( file_t *file, fs_offset_t offset, int whence )
|
||||
static fs_offset_t FS_SeekEx( file_t *file, fs_offset_t offset, int whence )
|
||||
{
|
||||
return FS_Seek( file, offset, whence ) == -1 ? -1 : FS_Tell( file );
|
||||
}
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user