mirror of
https://github.com/FWGS/xash3d-fwgs.git
synced 2026-08-05 19:45:05 +08:00
Compare commits
311 Commits
continuous
...
continuous
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
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 | ||
|
|
150d98bd15 | ||
|
|
f162fbd806 | ||
|
|
7d8ea61ac2 | ||
|
|
40041e30eb | ||
|
|
a247e139bf | ||
|
|
00b2ca7f5a | ||
|
|
e58007aab3 | ||
|
|
dca862a838 | ||
|
|
7e71e20714 | ||
|
|
cee6862924 | ||
|
|
a8cc68f6b9 | ||
|
|
2af0adb629 | ||
|
|
628ac376ed | ||
|
|
251e6ac1dc | ||
|
|
9b6518376c | ||
|
|
6c3fee7f27 | ||
|
|
c111a59639 | ||
|
|
ba9bb70924 | ||
|
|
6acc97b0ef | ||
|
|
cd681d4303 | ||
|
|
46f30e215c | ||
|
|
2ae038c01c | ||
|
|
aaa9fbd50f | ||
|
|
51d4716bcb | ||
|
|
045caacfee | ||
|
|
95a5c670a2 | ||
|
|
30259e1573 | ||
|
|
8b884132b7 | ||
|
|
266f9a6bc6 | ||
|
|
58177d9251 | ||
|
|
69e801d6b8 | ||
|
|
388cc3061f | ||
|
|
c9d29b3955 | ||
|
|
371025dc8e | ||
|
|
cf7a79bff3 | ||
|
|
55dfa1bf44 | ||
|
|
519c8a032a | ||
|
|
c15822f375 | ||
|
|
0e91deec19 | ||
|
|
87b204c661 | ||
|
|
caefa0b7b9 | ||
|
|
a311923d4e | ||
|
|
ee4cb39f3e | ||
|
|
18436a70eb | ||
|
|
8298053e6a | ||
|
|
9304a0041d | ||
|
|
64f92003fa | ||
|
|
be0a241244 | ||
|
|
df6546d5b1 | ||
|
|
a0c31120d9 | ||
|
|
c0757bd84c | ||
|
|
9fa32a9cf4 | ||
|
|
15bc09b06b | ||
|
|
315aea1991 | ||
|
|
380422a6dc | ||
|
|
be26ecf1c9 | ||
|
|
d2bbe9dfd2 | ||
|
|
9c929c1405 | ||
|
|
9551240680 | ||
|
|
6605d0456c | ||
|
|
99e8f7b486 | ||
|
|
5ac8f63741 | ||
|
|
9d3949a948 | ||
|
|
5bd1dd34b3 | ||
|
|
6862b14e59 | ||
|
|
dc1d65f621 | ||
|
|
fba3a2b67f | ||
|
|
b946c8455d | ||
|
|
c56e876043 | ||
|
|
9773d11464 | ||
|
|
3c28b11754 | ||
|
|
f2584dcb9d | ||
|
|
ce73838f1b | ||
|
|
49f972a7c9 | ||
|
|
1ae01d89de | ||
|
|
8e54e18c8f | ||
|
|
18136e5320 | ||
|
|
a29f1899d3 | ||
|
|
0f804ffc30 | ||
|
|
620a4b4894 | ||
|
|
4cf87c2c23 | ||
|
|
f031c31b77 | ||
|
|
c2447d8634 | ||
|
|
ae9c1d9f18 | ||
|
|
0132eb6e44 | ||
|
|
f12df54226 | ||
|
|
d971055927 | ||
|
|
6059538d77 | ||
|
|
17deba0606 | ||
|
|
82a2d272ad | ||
|
|
707a9228e1 | ||
|
|
59ddfb787f | ||
|
|
acdf1da995 | ||
|
|
f1cdab91eb | ||
|
|
05d5abe4db | ||
|
|
44e017a410 | ||
|
|
64f3884f23 | ||
|
|
6386782674 | ||
|
|
8084687e50 | ||
|
|
6c16de55c0 | ||
|
|
537237ef62 | ||
|
|
4dfc3f34cb | ||
|
|
d22bbb4213 | ||
|
|
0e3b14e9a5 | ||
|
|
afb0540aa3 | ||
|
|
4d802d8901 | ||
|
|
6a4bf4965f | ||
|
|
a3c9538d12 | ||
|
|
632264809f | ||
|
|
bcfabbe802 | ||
|
|
c244cfc937 |
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
|
||||||
|
|
||||||
14
.cirrus.yml
14
.cirrus.yml
@@ -1,15 +1,3 @@
|
|||||||
task:
|
|
||||||
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:
|
task:
|
||||||
name: freebsd-13-amd64
|
name: freebsd-13-amd64
|
||||||
freebsd_instance:
|
freebsd_instance:
|
||||||
@@ -25,7 +13,7 @@ task:
|
|||||||
task:
|
task:
|
||||||
name: freebsd-14-amd64
|
name: freebsd-14-amd64
|
||||||
freebsd_instance:
|
freebsd_instance:
|
||||||
image_family: freebsd-14-0-snap
|
image_family: freebsd-14-0
|
||||||
setup_script:
|
setup_script:
|
||||||
- pkg update
|
- pkg update
|
||||||
- pkg install -y pkgconf git sdl2 python fontconfig opus
|
- 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
|
||||||
16
.github/workflows/c-cpp.yml
vendored
16
.github/workflows/c-cpp.yml
vendored
@@ -24,14 +24,9 @@ jobs:
|
|||||||
# - os: ubuntu-aarch64-20.04
|
# - os: ubuntu-aarch64-20.04
|
||||||
# targetos: linux
|
# targetos: linux
|
||||||
# targetarch: aarch64
|
# targetarch: aarch64
|
||||||
|
- os: ubuntu-20.04
|
||||||
# - os: ubuntu-20.04
|
targetos: android
|
||||||
# targetos: android
|
targetarch: multiarch
|
||||||
# targetarch: 32
|
|
||||||
# - os: ubuntu-20.04
|
|
||||||
# targetos: android
|
|
||||||
# targetarch: 64
|
|
||||||
|
|
||||||
# - os: ubuntu-20.04
|
# - os: ubuntu-20.04
|
||||||
# targetos: motomagx
|
# targetos: motomagx
|
||||||
# targetarch: armv6
|
# targetarch: armv6
|
||||||
@@ -45,13 +40,12 @@ jobs:
|
|||||||
- os: windows-latest
|
- os: windows-latest
|
||||||
targetos: win32
|
targetos: win32
|
||||||
targetarch: amd64
|
targetarch: amd64
|
||||||
- os: windows-latest
|
- os: windows-2019 # always use the oldest possible for 32-bit because of older compilers, and better support of certain legacy OSes
|
||||||
targetos: win32
|
targetos: win32
|
||||||
targetarch: i386
|
targetarch: i386
|
||||||
env:
|
env:
|
||||||
SDL_VERSION: 2.28.1
|
SDL_VERSION: 2.28.5
|
||||||
GH_CPU_ARCH: ${{ matrix.targetarch }}
|
GH_CPU_ARCH: ${{ matrix.targetarch }}
|
||||||
ANDROID_SDK_TOOLS_VER: 4333796
|
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@v3
|
uses: actions/checkout@v3
|
||||||
|
|||||||
5
.gitignore
vendored
5
.gitignore
vendored
@@ -54,6 +54,11 @@ CMakeFiles
|
|||||||
Makefile
|
Makefile
|
||||||
cmake_install.cmake
|
cmake_install.cmake
|
||||||
install_manifest.txt
|
install_manifest.txt
|
||||||
|
CMakeLists.txt*
|
||||||
|
CMakeScripts
|
||||||
|
Testing
|
||||||
|
compile_commands.json
|
||||||
|
_deps
|
||||||
# makedepend
|
# makedepend
|
||||||
Makefile.dep
|
Makefile.dep
|
||||||
*.bak
|
*.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',
|
target = 'gl4es',
|
||||||
features = 'c',
|
features = 'c',
|
||||||
includes = ['gl4es/src', 'gl4es/src/gl', 'gl4es/src/glx', 'gl4es/include'],
|
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'],
|
cflags = ['-w', '-fvisibility=hidden', '-std=gnu99'],
|
||||||
subsystem = bld.env.MSVC_SUBSYSTEM,
|
subsystem = bld.env.MSVC_SUBSYSTEM,
|
||||||
export_includes = '.')
|
export_includes = '.')
|
||||||
|
|||||||
2
3rdparty/mainui
vendored
2
3rdparty/mainui
vendored
Submodule 3rdparty/mainui updated: b4bb815420...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
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.
|
||||||
@@ -240,6 +240,8 @@ CSO-like Xash3D-based mod, CSMoE - https://github.com/MoeMod/CSMoE
|
|||||||
## Crack-Life: Campaign Mode
|
## Crack-Life: Campaign Mode
|
||||||
Recreation by lostgamer aka nillerusr - https://github.com/LostGamerHL/crack_life
|
Recreation by lostgamer aka nillerusr - https://github.com/LostGamerHL/crack_life
|
||||||
|
|
||||||
|
Reverse-engineered code: branch **clcampaign** in hlsdk-portable - https://github.com/FWGS/hlsdk-portable/tree/clcampaign
|
||||||
|
|
||||||
## Escape from the Darkness
|
## Escape from the Darkness
|
||||||
malortie's recreation - https://github.com/malortie/hl-eftd
|
malortie's recreation - https://github.com/malortie/hl-eftd
|
||||||
|
|
||||||
|
|||||||
@@ -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" />
|
# 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)
|
[](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.
|
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_EFRAGS 8192 // Arcane Dimensions required
|
||||||
#define MAX_REQUESTS 64
|
#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
|
#endif//COM_MODEL_H
|
||||||
|
|||||||
@@ -717,6 +717,7 @@ enum
|
|||||||
kRenderFxExplode, // Scale up really big!
|
kRenderFxExplode, // Scale up really big!
|
||||||
kRenderFxGlowShell, // Glowing Shell
|
kRenderFxGlowShell, // Glowing Shell
|
||||||
kRenderFxClampMinScale, // Keep this sprite from getting very small (SPRITES only!)
|
kRenderFxClampMinScale, // Keep this sprite from getting very small (SPRITES only!)
|
||||||
|
kRenderFxLightMultiplier,
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef int func_t;
|
typedef int func_t;
|
||||||
|
|||||||
@@ -27,6 +27,8 @@ GNU General Public License for more details.
|
|||||||
#define ENGINE_COMPUTE_STUDIO_LERP (1<<7) // enable MOVETYPE_STEP lerping back in engine
|
#define ENGINE_COMPUTE_STUDIO_LERP (1<<7) // enable MOVETYPE_STEP lerping back in engine
|
||||||
#define ENGINE_LINEAR_GAMMA_SPACE (1<<8) // disable influence of gamma/brightness cvars to textures/lightmaps, for mods with custom renderer
|
#define ENGINE_LINEAR_GAMMA_SPACE (1<<8) // disable influence of gamma/brightness cvars to textures/lightmaps, for mods with custom renderer
|
||||||
|
|
||||||
|
#define ENGINE_STEP_POSHISTORY_LERP (1U<<31) // enable MOVETYPE_STEP interpolation based on position history. Incompatible with ENGINE_COMPUTE_STUDIO_LERP!
|
||||||
|
|
||||||
// adjust the mask when features will be added or removed
|
// adjust the mask when features will be added or removed
|
||||||
#define ENGINE_FEATURES_MASK \
|
#define ENGINE_FEATURES_MASK \
|
||||||
( ENGINE_WRITE_LARGE_COORD \
|
( ENGINE_WRITE_LARGE_COORD \
|
||||||
@@ -37,6 +39,7 @@ GNU General Public License for more details.
|
|||||||
| ENGINE_COMPENSATE_QUAKE_BUG \
|
| ENGINE_COMPENSATE_QUAKE_BUG \
|
||||||
| ENGINE_IMPROVED_LINETRACE \
|
| ENGINE_IMPROVED_LINETRACE \
|
||||||
| ENGINE_COMPUTE_STUDIO_LERP \
|
| ENGINE_COMPUTE_STUDIO_LERP \
|
||||||
| ENGINE_LINEAR_GAMMA_SPACE )
|
| ENGINE_LINEAR_GAMMA_SPACE \
|
||||||
|
| ENGINE_STEP_POSHISTORY_LERP )
|
||||||
|
|
||||||
#endif//FEATURES_H
|
#endif//FEATURES_H
|
||||||
|
|||||||
@@ -1,18 +1,35 @@
|
|||||||
//========= Copyright © 1996-2002, Valve LLC, All rights reserved. ============
|
/*
|
||||||
//
|
Copyright (C) 1996-1997 Id Software, Inc.
|
||||||
// Purpose:
|
|
||||||
//
|
|
||||||
// $NoKeywords: $
|
|
||||||
//=============================================================================
|
|
||||||
|
|
||||||
#if !defined( KBUTTONH )
|
This program is free software; you can redistribute it and/or
|
||||||
#define KBUTTONH
|
modify it under the terms of the GNU General Public License
|
||||||
#pragma once
|
as published by the Free Software Foundation; either version 2
|
||||||
|
of the License, or (at your option) any later version.
|
||||||
|
|
||||||
typedef struct kbutton_s
|
This program is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||||
|
|
||||||
|
See the GNU General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License
|
||||||
|
along with this program; if not, write to the Free Software
|
||||||
|
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
|
|
||||||
|
*/
|
||||||
|
#ifndef KBUTTON_H
|
||||||
|
#define KBUTTON_H
|
||||||
|
|
||||||
|
// a1ba: copied from WinQuake/client.h
|
||||||
|
//
|
||||||
|
// cl_input
|
||||||
|
//
|
||||||
|
typedef struct
|
||||||
{
|
{
|
||||||
int down[2]; // key nums holding it down
|
int down[2]; // key nums holding it down
|
||||||
int state; // low bit is down state
|
int state; // low bit is down state
|
||||||
} kbutton_t;
|
} kbutton_t;
|
||||||
|
|
||||||
#endif // !KBUTTONH
|
STATIC_ASSERT( sizeof( kbutton_t ) == 12, "kbutton_t isn't 12 bytes!" );
|
||||||
|
|
||||||
|
#endif // KBUTTON_H
|
||||||
|
|||||||
106
common/netadr.h
106
common/netadr.h
@@ -1,76 +1,74 @@
|
|||||||
/***
|
/*
|
||||||
*
|
Copyright (C) 1997-2001 Id Software, Inc.
|
||||||
* Copyright (c) 1996-2002, Valve LLC. All rights reserved.
|
|
||||||
*
|
|
||||||
* This product contains software technology licensed from Id
|
|
||||||
* Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc.
|
|
||||||
* All Rights Reserved.
|
|
||||||
*
|
|
||||||
* Use, distribution, and modification of this source code and/or resulting
|
|
||||||
* object code is restricted to non-commercial enhancements to products from
|
|
||||||
* Valve LLC. All other use, distribution, or modification is prohibited
|
|
||||||
* without written permission from Valve LLC.
|
|
||||||
*
|
|
||||||
****/
|
|
||||||
|
|
||||||
#ifndef NETADR_H
|
This program is free software; you can redistribute it and/or
|
||||||
#define NETADR_H
|
modify it under the terms of the GNU General Public License
|
||||||
|
as published by the Free Software Foundation; either version 2
|
||||||
|
of the License, or (at your option) any later version.
|
||||||
|
|
||||||
|
This program is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||||
|
|
||||||
|
See the GNU General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License
|
||||||
|
along with this program; if not, write to the Free Software
|
||||||
|
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef NET_ADR_H
|
||||||
|
#define NET_ADR_H
|
||||||
|
|
||||||
#include "build.h"
|
|
||||||
#include STDINT_H
|
#include STDINT_H
|
||||||
|
|
||||||
typedef enum
|
// net.h -- quake's interface to the networking layer
|
||||||
{
|
// a1ba: copied from Quake-2/qcommon/qcommon.h and modified to support IPv6
|
||||||
NA_UNUSED = 0,
|
|
||||||
NA_LOOPBACK,
|
|
||||||
NA_BROADCAST,
|
|
||||||
NA_IP,
|
|
||||||
NA_IPX,
|
|
||||||
NA_BROADCAST_IPX,
|
|
||||||
NA_IP6,
|
|
||||||
NA_MULTICAST_IP6, // all nodes multicast
|
|
||||||
} netadrtype_t;
|
|
||||||
|
|
||||||
// Original structure:
|
#define PORT_ANY -1
|
||||||
// typedef struct netadr_s
|
|
||||||
// {
|
typedef enum {NA_LOOPBACK = 1, NA_BROADCAST, NA_IP, NA_IPX, NA_BROADCAST_IPX, NA_IP6, NA_MULTICAST_IP6} netadrtype_t;
|
||||||
// netadrtype_t type;
|
|
||||||
// unsigned char ip[4];
|
/*
|
||||||
// unsigned char ipx[10];
|
Original Quake-2 structure:
|
||||||
// unsigned short port;
|
typedef struct
|
||||||
// } netadr_t;
|
{
|
||||||
|
netadrtype_t type;
|
||||||
|
|
||||||
|
byte ip[4];
|
||||||
|
byte ipx[10];
|
||||||
|
|
||||||
|
unsigned short port;
|
||||||
|
} netadr_t;
|
||||||
|
*/
|
||||||
|
|
||||||
#pragma pack( push, 1 )
|
#pragma pack( push, 1 )
|
||||||
typedef struct netadr_s
|
typedef struct netadr_s
|
||||||
{
|
{
|
||||||
union
|
union
|
||||||
{
|
{
|
||||||
|
// IPv6 struct
|
||||||
struct
|
struct
|
||||||
{
|
{
|
||||||
uint32_t type;
|
uint16_t type6;
|
||||||
|
uint8_t ip6[16];
|
||||||
|
};
|
||||||
|
struct
|
||||||
|
{
|
||||||
|
uint32_t type; // must be netadrtype_t but will break with short enums
|
||||||
union
|
union
|
||||||
{
|
{
|
||||||
uint8_t ip[4];
|
uint8_t ip[4];
|
||||||
uint32_t ip4;
|
uint32_t ip4; // for easier conversions
|
||||||
};
|
};
|
||||||
uint8_t ipx[10];
|
uint8_t ipx[10];
|
||||||
};
|
|
||||||
struct
|
|
||||||
{
|
|
||||||
#if XASH_LITTLE_ENDIAN
|
|
||||||
uint16_t type6;
|
|
||||||
uint8_t ip6[16];
|
|
||||||
#elif XASH_BIG_ENDIAN
|
|
||||||
uint8_t ip6_0[2];
|
|
||||||
uint16_t type6;
|
|
||||||
uint8_t ip6_2[14];
|
|
||||||
#endif
|
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
uint16_t port;
|
uint16_t port;
|
||||||
} netadr_t;
|
} netadr_t;
|
||||||
#pragma pack( pop )
|
#pragma pack( pop )
|
||||||
|
|
||||||
STATIC_ASSERT( sizeof( netadr_t ) == 20, "invalid netadr_t size" );
|
STATIC_ASSERT( sizeof( netadr_t ) == 20, "netadr_t isn't 20 bytes!" );
|
||||||
|
|
||||||
#endif//NETADR_H
|
#endif // NET_ADR_H
|
||||||
|
|||||||
@@ -35,7 +35,6 @@ GNU General Public License for more details.
|
|||||||
#define __cdecl
|
#define __cdecl
|
||||||
#define __stdcall
|
#define __stdcall
|
||||||
#define _inline static inline
|
#define _inline static inline
|
||||||
#define FORCEINLINE inline __attribute__((always_inline))
|
|
||||||
|
|
||||||
#if XASH_POSIX
|
#if XASH_POSIX
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
@@ -63,13 +62,6 @@ GNU General Public License for more details.
|
|||||||
int x, y;
|
int x, y;
|
||||||
} POINT;
|
} POINT;
|
||||||
#else // WIN32
|
#else // WIN32
|
||||||
#ifdef __MINGW32__
|
|
||||||
#define _inline static inline
|
|
||||||
#define FORCEINLINE inline __attribute__((always_inline))
|
|
||||||
#else
|
|
||||||
#define FORCEINLINE __forceinline
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#define open _open
|
#define open _open
|
||||||
#define read _read
|
#define read _read
|
||||||
#define alloca _alloca
|
#define alloca _alloca
|
||||||
|
|||||||
@@ -107,7 +107,8 @@ typedef enum
|
|||||||
TF_ARB_FLOAT = (1<<26), // float textures
|
TF_ARB_FLOAT = (1<<26), // float textures
|
||||||
TF_NOCOMPARE = (1<<27), // disable comparing for depth textures
|
TF_NOCOMPARE = (1<<27), // disable comparing for depth textures
|
||||||
TF_ARB_16BIT = (1<<28), // keep image as 16-bit (not 24)
|
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;
|
} texFlags_t;
|
||||||
|
|
||||||
typedef enum
|
typedef enum
|
||||||
|
|||||||
@@ -58,9 +58,6 @@ typedef uint64_t longtime_t;
|
|||||||
|
|
||||||
#define BIT( n ) ( 1U << ( n ))
|
#define BIT( n ) ( 1U << ( n ))
|
||||||
#define BIT64( n ) ( 1ULL << ( n ))
|
#define BIT64( n ) ( 1ULL << ( n ))
|
||||||
#define GAMMA ( 2.2f ) // Valve Software gamma
|
|
||||||
#define INVGAMMA ( 1.0f / 2.2f ) // back to 1.0
|
|
||||||
#define TEXGAMMA ( 0.9f ) // compensate dim textures
|
|
||||||
#define SetBits( iBitVector, bits ) ((iBitVector) = (iBitVector) | (bits))
|
#define SetBits( iBitVector, bits ) ((iBitVector) = (iBitVector) | (bits))
|
||||||
#define ClearBits( iBitVector, bits ) ((iBitVector) = (iBitVector) & ~(bits))
|
#define ClearBits( iBitVector, bits ) ((iBitVector) = (iBitVector) & ~(bits))
|
||||||
#define FBitSet( iBitVector, bit ) ((iBitVector) & (bit))
|
#define FBitSet( iBitVector, bit ) ((iBitVector) & (bit))
|
||||||
@@ -121,15 +118,18 @@ typedef uint64_t longtime_t;
|
|||||||
#define likely(x) (x)
|
#define likely(x) (x)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if __STDC_VERSION >= 202311L || __cplusplus >= 201103L // C23 or C++ static_assert is a keyword
|
#if __STDC_VERSION__ >= 202311L || __cplusplus >= 201103L // C23 or C++ static_assert is a keyword
|
||||||
#define STATIC_ASSERT_ static_assert
|
#define STATIC_ASSERT_( ignore, x, y ) static_assert( x, y )
|
||||||
#define STATIC_ASSERT static_assert
|
#define STATIC_ASSERT static_assert
|
||||||
#elif __STDC_VERSION >= 201112L // in C11 it's _Static_assert
|
#elif __STDC_VERSION__ >= 201112L // in C11 it's _Static_assert
|
||||||
#define STATIC_ASSERT_ _Static_assert
|
#define STATIC_ASSERT_( ignore, x, y ) _Static_assert( x, y )
|
||||||
#define STATIC_ASSERT _Static_assert
|
#define STATIC_ASSERT _Static_assert
|
||||||
#else
|
#else
|
||||||
#define STATIC_ASSERT_( id, x, y ) extern int id[( x ) ? 1 : -1]
|
#define STATIC_ASSERT_( id, x, y ) extern int id[( x ) ? 1 : -1]
|
||||||
#define STATIC_ASSERT( x, y ) STATIC_ASSERT_( static_assert_##__LINE__, x, y )
|
// need these to correctly expand the line macro
|
||||||
|
#define STATIC_ASSERT_3( line, x, y ) STATIC_ASSERT_( static_assert_ ## line, x, y )
|
||||||
|
#define STATIC_ASSERT_2( line, x, y ) STATIC_ASSERT_3( line, x, y )
|
||||||
|
#define STATIC_ASSERT( x, y ) STATIC_ASSERT_2( __LINE__, x, y )
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef XASH_BIG_ENDIAN
|
#ifdef XASH_BIG_ENDIAN
|
||||||
|
|||||||
356
engine/anorms.h
356
engine/anorms.h
@@ -1,177 +1,181 @@
|
|||||||
/***
|
/*
|
||||||
*
|
Copyright (C) 1996-1997 Id Software, Inc.
|
||||||
* Copyright (c) 1996-2002, Valve LLC. All rights reserved.
|
|
||||||
*
|
|
||||||
* This product contains software technology licensed from Id
|
|
||||||
* Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc.
|
|
||||||
* All Rights Reserved.
|
|
||||||
*
|
|
||||||
* Use, distribution, and modification of this source code and/or resulting
|
|
||||||
* object code is restricted to non-commercial enhancements to products from
|
|
||||||
* Valve LLC. All other use, distribution, or modification is prohibited
|
|
||||||
* without written permission from Valve LLC.
|
|
||||||
*
|
|
||||||
****/
|
|
||||||
|
|
||||||
{-0.525731, 0.000000, 0.850651},
|
This program is free software; you can redistribute it and/or
|
||||||
{-0.442863, 0.238856, 0.864188},
|
modify it under the terms of the GNU General Public License
|
||||||
{-0.295242, 0.000000, 0.955423},
|
as published by the Free Software Foundation; either version 2
|
||||||
{-0.309017, 0.500000, 0.809017},
|
of the License, or (at your option) any later version.
|
||||||
{-0.162460, 0.262866, 0.951056},
|
|
||||||
{0.000000, 0.000000, 1.000000},
|
This program is distributed in the hope that it will be useful,
|
||||||
{0.000000, 0.850651, 0.525731},
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
{-0.147621, 0.716567, 0.681718},
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||||
{0.147621, 0.716567, 0.681718},
|
|
||||||
{0.000000, 0.525731, 0.850651},
|
See the GNU General Public License for more details.
|
||||||
{0.309017, 0.500000, 0.809017},
|
|
||||||
{0.525731, 0.000000, 0.850651},
|
You should have received a copy of the GNU General Public License
|
||||||
{0.295242, 0.000000, 0.955423},
|
along with this program; if not, write to the Free Software
|
||||||
{0.442863, 0.238856, 0.864188},
|
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
{0.162460, 0.262866, 0.951056},
|
|
||||||
{-0.681718, 0.147621, 0.716567},
|
*/
|
||||||
{-0.809017, 0.309017, 0.500000},
|
{-0.525731, 0.000000, 0.850651},
|
||||||
{-0.587785, 0.425325, 0.688191},
|
{-0.442863, 0.238856, 0.864188},
|
||||||
{-0.850651, 0.525731, 0.000000},
|
{-0.295242, 0.000000, 0.955423},
|
||||||
{-0.864188, 0.442863, 0.238856},
|
{-0.309017, 0.500000, 0.809017},
|
||||||
{-0.716567, 0.681718, 0.147621},
|
{-0.162460, 0.262866, 0.951056},
|
||||||
{-0.688191, 0.587785, 0.425325},
|
{0.000000, 0.000000, 1.000000},
|
||||||
{-0.500000, 0.809017, 0.309017},
|
{0.000000, 0.850651, 0.525731},
|
||||||
{-0.238856, 0.864188, 0.442863},
|
{-0.147621, 0.716567, 0.681718},
|
||||||
{-0.425325, 0.688191, 0.587785},
|
{0.147621, 0.716567, 0.681718},
|
||||||
{-0.716567, 0.681718, -0.147621},
|
{0.000000, 0.525731, 0.850651},
|
||||||
{-0.500000, 0.809017, -0.309017},
|
{0.309017, 0.500000, 0.809017},
|
||||||
{-0.525731, 0.850651, 0.000000},
|
{0.525731, 0.000000, 0.850651},
|
||||||
{0.000000, 0.850651, -0.525731},
|
{0.295242, 0.000000, 0.955423},
|
||||||
{-0.238856, 0.864188, -0.442863},
|
{0.442863, 0.238856, 0.864188},
|
||||||
{0.000000, 0.955423, -0.295242},
|
{0.162460, 0.262866, 0.951056},
|
||||||
{-0.262866, 0.951056, -0.162460},
|
{-0.681718, 0.147621, 0.716567},
|
||||||
{0.000000, 1.000000, 0.000000},
|
{-0.809017, 0.309017, 0.500000},
|
||||||
{0.000000, 0.955423, 0.295242},
|
{-0.587785, 0.425325, 0.688191},
|
||||||
{-0.262866, 0.951056, 0.162460},
|
{-0.850651, 0.525731, 0.000000},
|
||||||
{0.238856, 0.864188, 0.442863},
|
{-0.864188, 0.442863, 0.238856},
|
||||||
{0.262866, 0.951056, 0.162460},
|
{-0.716567, 0.681718, 0.147621},
|
||||||
{0.500000, 0.809017, 0.309017},
|
{-0.688191, 0.587785, 0.425325},
|
||||||
{0.238856, 0.864188, -0.442863},
|
{-0.500000, 0.809017, 0.309017},
|
||||||
{0.262866, 0.951056, -0.162460},
|
{-0.238856, 0.864188, 0.442863},
|
||||||
{0.500000, 0.809017, -0.309017},
|
{-0.425325, 0.688191, 0.587785},
|
||||||
{0.850651, 0.525731, 0.000000},
|
{-0.716567, 0.681718, -0.147621},
|
||||||
{0.716567, 0.681718, 0.147621},
|
{-0.500000, 0.809017, -0.309017},
|
||||||
{0.716567, 0.681718, -0.147621},
|
{-0.525731, 0.850651, 0.000000},
|
||||||
{0.525731, 0.850651, 0.000000},
|
{0.000000, 0.850651, -0.525731},
|
||||||
{0.425325, 0.688191, 0.587785},
|
{-0.238856, 0.864188, -0.442863},
|
||||||
{0.864188, 0.442863, 0.238856},
|
{0.000000, 0.955423, -0.295242},
|
||||||
{0.688191, 0.587785, 0.425325},
|
{-0.262866, 0.951056, -0.162460},
|
||||||
{0.809017, 0.309017, 0.500000},
|
{0.000000, 1.000000, 0.000000},
|
||||||
{0.681718, 0.147621, 0.716567},
|
{0.000000, 0.955423, 0.295242},
|
||||||
{0.587785, 0.425325, 0.688191},
|
{-0.262866, 0.951056, 0.162460},
|
||||||
{0.955423, 0.295242, 0.000000},
|
{0.238856, 0.864188, 0.442863},
|
||||||
{1.000000, 0.000000, 0.000000},
|
{0.262866, 0.951056, 0.162460},
|
||||||
{0.951056, 0.162460, 0.262866},
|
{0.500000, 0.809017, 0.309017},
|
||||||
{0.850651, -0.525731, 0.000000},
|
{0.238856, 0.864188, -0.442863},
|
||||||
{0.955423, -0.295242, 0.000000},
|
{0.262866, 0.951056, -0.162460},
|
||||||
{0.864188, -0.442863, 0.238856},
|
{0.500000, 0.809017, -0.309017},
|
||||||
{0.951056, -0.162460, 0.262866},
|
{0.850651, 0.525731, 0.000000},
|
||||||
{0.809017, -0.309017, 0.500000},
|
{0.716567, 0.681718, 0.147621},
|
||||||
{0.681718, -0.147621, 0.716567},
|
{0.716567, 0.681718, -0.147621},
|
||||||
{0.850651, 0.000000, 0.525731},
|
{0.525731, 0.850651, 0.000000},
|
||||||
{0.864188, 0.442863, -0.238856},
|
{0.425325, 0.688191, 0.587785},
|
||||||
{0.809017, 0.309017, -0.500000},
|
{0.864188, 0.442863, 0.238856},
|
||||||
{0.951056, 0.162460, -0.262866},
|
{0.688191, 0.587785, 0.425325},
|
||||||
{0.525731, 0.000000, -0.850651},
|
{0.809017, 0.309017, 0.500000},
|
||||||
{0.681718, 0.147621, -0.716567},
|
{0.681718, 0.147621, 0.716567},
|
||||||
{0.681718, -0.147621, -0.716567},
|
{0.587785, 0.425325, 0.688191},
|
||||||
{0.850651, 0.000000, -0.525731},
|
{0.955423, 0.295242, 0.000000},
|
||||||
{0.809017, -0.309017, -0.500000},
|
{1.000000, 0.000000, 0.000000},
|
||||||
{0.864188, -0.442863, -0.238856},
|
{0.951056, 0.162460, 0.262866},
|
||||||
{0.951056, -0.162460, -0.262866},
|
{0.850651, -0.525731, 0.000000},
|
||||||
{0.147621, 0.716567, -0.681718},
|
{0.955423, -0.295242, 0.000000},
|
||||||
{0.309017, 0.500000, -0.809017},
|
{0.864188, -0.442863, 0.238856},
|
||||||
{0.425325, 0.688191, -0.587785},
|
{0.951056, -0.162460, 0.262866},
|
||||||
{0.442863, 0.238856, -0.864188},
|
{0.809017, -0.309017, 0.500000},
|
||||||
{0.587785, 0.425325, -0.688191},
|
{0.681718, -0.147621, 0.716567},
|
||||||
{0.688191, 0.587785, -0.425325},
|
{0.850651, 0.000000, 0.525731},
|
||||||
{-0.147621, 0.716567, -0.681718},
|
{0.864188, 0.442863, -0.238856},
|
||||||
{-0.309017, 0.500000, -0.809017},
|
{0.809017, 0.309017, -0.500000},
|
||||||
{0.000000, 0.525731, -0.850651},
|
{0.951056, 0.162460, -0.262866},
|
||||||
{-0.525731, 0.000000, -0.850651},
|
{0.525731, 0.000000, -0.850651},
|
||||||
{-0.442863, 0.238856, -0.864188},
|
{0.681718, 0.147621, -0.716567},
|
||||||
{-0.295242, 0.000000, -0.955423},
|
{0.681718, -0.147621, -0.716567},
|
||||||
{-0.162460, 0.262866, -0.951056},
|
{0.850651, 0.000000, -0.525731},
|
||||||
{0.000000, 0.000000, -1.000000},
|
{0.809017, -0.309017, -0.500000},
|
||||||
{0.295242, 0.000000, -0.955423},
|
{0.864188, -0.442863, -0.238856},
|
||||||
{0.162460, 0.262866, -0.951056},
|
{0.951056, -0.162460, -0.262866},
|
||||||
{-0.442863, -0.238856, -0.864188},
|
{0.147621, 0.716567, -0.681718},
|
||||||
{-0.309017, -0.500000, -0.809017},
|
{0.309017, 0.500000, -0.809017},
|
||||||
{-0.162460, -0.262866, -0.951056},
|
{0.425325, 0.688191, -0.587785},
|
||||||
{0.000000, -0.850651, -0.525731},
|
{0.442863, 0.238856, -0.864188},
|
||||||
{-0.147621, -0.716567, -0.681718},
|
{0.587785, 0.425325, -0.688191},
|
||||||
{0.147621, -0.716567, -0.681718},
|
{0.688191, 0.587785, -0.425325},
|
||||||
{0.000000, -0.525731, -0.850651},
|
{-0.147621, 0.716567, -0.681718},
|
||||||
{0.309017, -0.500000, -0.809017},
|
{-0.309017, 0.500000, -0.809017},
|
||||||
{0.442863, -0.238856, -0.864188},
|
{0.000000, 0.525731, -0.850651},
|
||||||
{0.162460, -0.262866, -0.951056},
|
{-0.525731, 0.000000, -0.850651},
|
||||||
{0.238856, -0.864188, -0.442863},
|
{-0.442863, 0.238856, -0.864188},
|
||||||
{0.500000, -0.809017, -0.309017},
|
{-0.295242, 0.000000, -0.955423},
|
||||||
{0.425325, -0.688191, -0.587785},
|
{-0.162460, 0.262866, -0.951056},
|
||||||
{0.716567, -0.681718, -0.147621},
|
{0.000000, 0.000000, -1.000000},
|
||||||
{0.688191, -0.587785, -0.425325},
|
{0.295242, 0.000000, -0.955423},
|
||||||
{0.587785, -0.425325, -0.688191},
|
{0.162460, 0.262866, -0.951056},
|
||||||
{0.000000, -0.955423, -0.295242},
|
{-0.442863, -0.238856, -0.864188},
|
||||||
{0.000000, -1.000000, 0.000000},
|
{-0.309017, -0.500000, -0.809017},
|
||||||
{0.262866, -0.951056, -0.162460},
|
{-0.162460, -0.262866, -0.951056},
|
||||||
{0.000000, -0.850651, 0.525731},
|
{0.000000, -0.850651, -0.525731},
|
||||||
{0.000000, -0.955423, 0.295242},
|
{-0.147621, -0.716567, -0.681718},
|
||||||
{0.238856, -0.864188, 0.442863},
|
{0.147621, -0.716567, -0.681718},
|
||||||
{0.262866, -0.951056, 0.162460},
|
{0.000000, -0.525731, -0.850651},
|
||||||
{0.500000, -0.809017, 0.309017},
|
{0.309017, -0.500000, -0.809017},
|
||||||
{0.716567, -0.681718, 0.147621},
|
{0.442863, -0.238856, -0.864188},
|
||||||
{0.525731, -0.850651, 0.000000},
|
{0.162460, -0.262866, -0.951056},
|
||||||
{-0.238856, -0.864188, -0.442863},
|
{0.238856, -0.864188, -0.442863},
|
||||||
{-0.500000, -0.809017, -0.309017},
|
{0.500000, -0.809017, -0.309017},
|
||||||
{-0.262866, -0.951056, -0.162460},
|
{0.425325, -0.688191, -0.587785},
|
||||||
{-0.850651, -0.525731, 0.000000},
|
{0.716567, -0.681718, -0.147621},
|
||||||
{-0.716567, -0.681718, -0.147621},
|
{0.688191, -0.587785, -0.425325},
|
||||||
{-0.716567, -0.681718, 0.147621},
|
{0.587785, -0.425325, -0.688191},
|
||||||
{-0.525731, -0.850651, 0.000000},
|
{0.000000, -0.955423, -0.295242},
|
||||||
{-0.500000, -0.809017, 0.309017},
|
{0.000000, -1.000000, 0.000000},
|
||||||
{-0.238856, -0.864188, 0.442863},
|
{0.262866, -0.951056, -0.162460},
|
||||||
{-0.262866, -0.951056, 0.162460},
|
{0.000000, -0.850651, 0.525731},
|
||||||
{-0.864188, -0.442863, 0.238856},
|
{0.000000, -0.955423, 0.295242},
|
||||||
{-0.809017, -0.309017, 0.500000},
|
{0.238856, -0.864188, 0.442863},
|
||||||
{-0.688191, -0.587785, 0.425325},
|
{0.262866, -0.951056, 0.162460},
|
||||||
{-0.681718, -0.147621, 0.716567},
|
{0.500000, -0.809017, 0.309017},
|
||||||
{-0.442863, -0.238856, 0.864188},
|
{0.716567, -0.681718, 0.147621},
|
||||||
{-0.587785, -0.425325, 0.688191},
|
{0.525731, -0.850651, 0.000000},
|
||||||
{-0.309017, -0.500000, 0.809017},
|
{-0.238856, -0.864188, -0.442863},
|
||||||
{-0.147621, -0.716567, 0.681718},
|
{-0.500000, -0.809017, -0.309017},
|
||||||
{-0.425325, -0.688191, 0.587785},
|
{-0.262866, -0.951056, -0.162460},
|
||||||
{-0.162460, -0.262866, 0.951056},
|
{-0.850651, -0.525731, 0.000000},
|
||||||
{0.442863, -0.238856, 0.864188},
|
{-0.716567, -0.681718, -0.147621},
|
||||||
{0.162460, -0.262866, 0.951056},
|
{-0.716567, -0.681718, 0.147621},
|
||||||
{0.309017, -0.500000, 0.809017},
|
{-0.525731, -0.850651, 0.000000},
|
||||||
{0.147621, -0.716567, 0.681718},
|
{-0.500000, -0.809017, 0.309017},
|
||||||
{0.000000, -0.525731, 0.850651},
|
{-0.238856, -0.864188, 0.442863},
|
||||||
{0.425325, -0.688191, 0.587785},
|
{-0.262866, -0.951056, 0.162460},
|
||||||
{0.587785, -0.425325, 0.688191},
|
{-0.864188, -0.442863, 0.238856},
|
||||||
{0.688191, -0.587785, 0.425325},
|
{-0.809017, -0.309017, 0.500000},
|
||||||
{-0.955423, 0.295242, 0.000000},
|
{-0.688191, -0.587785, 0.425325},
|
||||||
{-0.951056, 0.162460, 0.262866},
|
{-0.681718, -0.147621, 0.716567},
|
||||||
{-1.000000, 0.000000, 0.000000},
|
{-0.442863, -0.238856, 0.864188},
|
||||||
{-0.850651, 0.000000, 0.525731},
|
{-0.587785, -0.425325, 0.688191},
|
||||||
{-0.955423, -0.295242, 0.000000},
|
{-0.309017, -0.500000, 0.809017},
|
||||||
{-0.951056, -0.162460, 0.262866},
|
{-0.147621, -0.716567, 0.681718},
|
||||||
{-0.864188, 0.442863, -0.238856},
|
{-0.425325, -0.688191, 0.587785},
|
||||||
{-0.951056, 0.162460, -0.262866},
|
{-0.162460, -0.262866, 0.951056},
|
||||||
{-0.809017, 0.309017, -0.500000},
|
{0.442863, -0.238856, 0.864188},
|
||||||
{-0.864188, -0.442863, -0.238856},
|
{0.162460, -0.262866, 0.951056},
|
||||||
{-0.951056, -0.162460, -0.262866},
|
{0.309017, -0.500000, 0.809017},
|
||||||
{-0.809017, -0.309017, -0.500000},
|
{0.147621, -0.716567, 0.681718},
|
||||||
{-0.681718, 0.147621, -0.716567},
|
{0.000000, -0.525731, 0.850651},
|
||||||
{-0.681718, -0.147621, -0.716567},
|
{0.425325, -0.688191, 0.587785},
|
||||||
{-0.850651, 0.000000, -0.525731},
|
{0.587785, -0.425325, 0.688191},
|
||||||
{-0.688191, 0.587785, -0.425325},
|
{0.688191, -0.587785, 0.425325},
|
||||||
{-0.587785, 0.425325, -0.688191},
|
{-0.955423, 0.295242, 0.000000},
|
||||||
{-0.425325, 0.688191, -0.587785},
|
{-0.951056, 0.162460, 0.262866},
|
||||||
{-0.425325, -0.688191, -0.587785},
|
{-1.000000, 0.000000, 0.000000},
|
||||||
{-0.587785, -0.425325, -0.688191},
|
{-0.850651, 0.000000, 0.525731},
|
||||||
{-0.688191, -0.587785, -0.425325},
|
{-0.955423, -0.295242, 0.000000},
|
||||||
|
{-0.951056, -0.162460, 0.262866},
|
||||||
|
{-0.864188, 0.442863, -0.238856},
|
||||||
|
{-0.951056, 0.162460, -0.262866},
|
||||||
|
{-0.809017, 0.309017, -0.500000},
|
||||||
|
{-0.864188, -0.442863, -0.238856},
|
||||||
|
{-0.951056, -0.162460, -0.262866},
|
||||||
|
{-0.809017, -0.309017, -0.500000},
|
||||||
|
{-0.681718, 0.147621, -0.716567},
|
||||||
|
{-0.681718, -0.147621, -0.716567},
|
||||||
|
{-0.850651, 0.000000, -0.525731},
|
||||||
|
{-0.688191, 0.587785, -0.425325},
|
||||||
|
{-0.587785, 0.425325, -0.688191},
|
||||||
|
{-0.425325, 0.688191, -0.587785},
|
||||||
|
{-0.425325, -0.688191, -0.587785},
|
||||||
|
{-0.587785, -0.425325, -0.688191},
|
||||||
|
{-0.688191, -0.587785, -0.425325},
|
||||||
|
|||||||
@@ -157,32 +157,12 @@ void CL_PlayCDTrack_f( void )
|
|||||||
CL_ScreenshotGetName
|
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 )
|
if( lastnum < 0 || lastnum > 9999 )
|
||||||
{
|
|
||||||
Con_Printf( S_ERROR "unable to write screenshot\n" );
|
|
||||||
return false;
|
return false;
|
||||||
}
|
|
||||||
|
|
||||||
return Q_snprintf( filename, size, "scrshots/%s_shot%04d.png", clgame.mapname, lastnum ) > 0;
|
return Q_snprintf( filename, size, fmt, 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;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -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
|
CL_LevelShot_f
|
||||||
@@ -355,23 +214,100 @@ void CL_LevelShot_f( void )
|
|||||||
else cls.scrshot_action = scrshot_inactive; // disable - not needs
|
else cls.scrshot_action = scrshot_inactive; // disable - not needs
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
static scrshot_t CL_GetScreenshotTypeFromString( const char *string )
|
||||||
==================
|
|
||||||
CL_SaveShot_f
|
|
||||||
|
|
||||||
mini-pic in loadgame menu
|
|
||||||
==================
|
|
||||||
*/
|
|
||||||
void CL_SaveShot_f( void )
|
|
||||||
{
|
{
|
||||||
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" );
|
if( CL_IsDevOverviewMode() == 1 )
|
||||||
return;
|
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 ));
|
switch( type )
|
||||||
cls.scrshot_action = scrshot_savegame; // build new frame for saveshot
|
{
|
||||||
|
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 );
|
CL_AddToResourceList( pResource, &cl.resourcesonhand );
|
||||||
}
|
}
|
||||||
|
|
||||||
void CL_ClearResourceList( resource_t *pList )
|
static void CL_ClearResourceList( resource_t *pList )
|
||||||
{
|
{
|
||||||
resource_t *p, *n;
|
resource_t *p, *n;
|
||||||
|
|
||||||
|
|||||||
@@ -107,6 +107,8 @@ struct
|
|||||||
int angle_position;
|
int angle_position;
|
||||||
} demo;
|
} demo;
|
||||||
|
|
||||||
|
static qboolean CL_NextDemo( void );
|
||||||
|
|
||||||
/*
|
/*
|
||||||
====================
|
====================
|
||||||
CL_StartupDemoHeader
|
CL_StartupDemoHeader
|
||||||
@@ -156,7 +158,7 @@ CL_GetDemoRecordClock
|
|||||||
write time while demo is recording
|
write time while demo is recording
|
||||||
====================
|
====================
|
||||||
*/
|
*/
|
||||||
float CL_GetDemoRecordClock( void )
|
static float CL_GetDemoRecordClock( void )
|
||||||
{
|
{
|
||||||
return cl.mtime[0];
|
return cl.mtime[0];
|
||||||
}
|
}
|
||||||
@@ -168,7 +170,7 @@ CL_GetDemoPlaybackClock
|
|||||||
overwrite host.realtime
|
overwrite host.realtime
|
||||||
====================
|
====================
|
||||||
*/
|
*/
|
||||||
float CL_GetDemoPlaybackClock( void )
|
static float CL_GetDemoPlaybackClock( void )
|
||||||
{
|
{
|
||||||
return host.realtime + host.frametime;
|
return host.realtime + host.frametime;
|
||||||
}
|
}
|
||||||
@@ -194,7 +196,7 @@ CL_WriteDemoCmdHeader
|
|||||||
Writes the demo command header and time-delta
|
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;
|
float dt;
|
||||||
|
|
||||||
@@ -267,7 +269,7 @@ Save state of cls.netchan sequences
|
|||||||
so that we can play the demo correctly.
|
so that we can play the demo correctly.
|
||||||
====================
|
====================
|
||||||
*/
|
*/
|
||||||
void CL_WriteDemoSequence( file_t *file )
|
static void CL_WriteDemoSequence( file_t *file )
|
||||||
{
|
{
|
||||||
Assert( file != NULL );
|
Assert( file != NULL );
|
||||||
|
|
||||||
@@ -348,7 +350,7 @@ CL_WriteDemoHeader
|
|||||||
Write demo header
|
Write demo header
|
||||||
====================
|
====================
|
||||||
*/
|
*/
|
||||||
void CL_WriteDemoHeader( const char *name )
|
static void CL_WriteDemoHeader( const char *name )
|
||||||
{
|
{
|
||||||
int copysize;
|
int copysize;
|
||||||
int savepos;
|
int savepos;
|
||||||
@@ -436,7 +438,7 @@ CL_StopRecord
|
|||||||
finish recording demo
|
finish recording demo
|
||||||
=================
|
=================
|
||||||
*/
|
*/
|
||||||
void CL_StopRecord( void )
|
static void CL_StopRecord( void )
|
||||||
{
|
{
|
||||||
int i, curpos;
|
int i, curpos;
|
||||||
float stoptime;
|
float stoptime;
|
||||||
@@ -518,7 +520,7 @@ CL_ReadDemoCmdHeader
|
|||||||
read the demo command
|
read the demo command
|
||||||
=================
|
=================
|
||||||
*/
|
*/
|
||||||
qboolean CL_ReadDemoCmdHeader( byte *cmd, float *dt )
|
static qboolean CL_ReadDemoCmdHeader( byte *cmd, float *dt )
|
||||||
{
|
{
|
||||||
// read the command
|
// read the command
|
||||||
// HACKHACK: skip NOPs
|
// HACKHACK: skip NOPs
|
||||||
@@ -548,7 +550,7 @@ read the demo usercmd for predicting
|
|||||||
and smooth movement during playback the demo
|
and smooth movement during playback the demo
|
||||||
=================
|
=================
|
||||||
*/
|
*/
|
||||||
void CL_ReadDemoUserCmd( qboolean discard )
|
static void CL_ReadDemoUserCmd( qboolean discard )
|
||||||
{
|
{
|
||||||
byte data[1024];
|
byte data[1024];
|
||||||
int cmdnumber;
|
int cmdnumber;
|
||||||
@@ -570,6 +572,9 @@ void CL_ReadDemoUserCmd( qboolean discard )
|
|||||||
memset( &nullcmd, 0, sizeof( nullcmd ));
|
memset( &nullcmd, 0, sizeof( nullcmd ));
|
||||||
MSG_Init( &buf, "UserCmd", data, sizeof( data ));
|
MSG_Init( &buf, "UserCmd", data, sizeof( data ));
|
||||||
|
|
||||||
|
// a1ba: I have no proper explanation why
|
||||||
|
cmdnumber++;
|
||||||
|
|
||||||
pcmd = &cl.commands[cmdnumber & CL_UPDATE_MASK];
|
pcmd = &cl.commands[cmdnumber & CL_UPDATE_MASK];
|
||||||
pcmd->processedfuncs = false;
|
pcmd->processedfuncs = false;
|
||||||
pcmd->senttime = 0.0f;
|
pcmd->senttime = 0.0f;
|
||||||
@@ -610,7 +615,7 @@ CL_ReadDemoSequence
|
|||||||
read netchan sequences
|
read netchan sequences
|
||||||
=================
|
=================
|
||||||
*/
|
*/
|
||||||
void CL_ReadDemoSequence( qboolean discard )
|
static void CL_ReadDemoSequence( qboolean discard )
|
||||||
{
|
{
|
||||||
int incoming_sequence;
|
int incoming_sequence;
|
||||||
int incoming_acknowledged;
|
int incoming_acknowledged;
|
||||||
@@ -644,7 +649,7 @@ void CL_ReadDemoSequence( qboolean discard )
|
|||||||
CL_DemoStartPlayback
|
CL_DemoStartPlayback
|
||||||
=================
|
=================
|
||||||
*/
|
*/
|
||||||
void CL_DemoStartPlayback( int mode )
|
static void CL_DemoStartPlayback( int mode )
|
||||||
{
|
{
|
||||||
if( cls.changedemo )
|
if( cls.changedemo )
|
||||||
{
|
{
|
||||||
@@ -689,7 +694,7 @@ void CL_DemoStartPlayback( int mode )
|
|||||||
CL_DemoAborted
|
CL_DemoAborted
|
||||||
=================
|
=================
|
||||||
*/
|
*/
|
||||||
void CL_DemoAborted( void )
|
static void CL_DemoAborted( void )
|
||||||
{
|
{
|
||||||
if( cls.demofile )
|
if( cls.demofile )
|
||||||
FS_Close( cls.demofile );
|
FS_Close( cls.demofile );
|
||||||
@@ -729,7 +734,7 @@ returns true on success, false on failure
|
|||||||
g-cont. probably captain obvious mode is ON
|
g-cont. probably captain obvious mode is ON
|
||||||
=================
|
=================
|
||||||
*/
|
*/
|
||||||
qboolean CL_DemoMoveToNextSection( void )
|
static qboolean CL_DemoMoveToNextSection( void )
|
||||||
{
|
{
|
||||||
if( ++demo.entryIndex >= demo.directory.numentries )
|
if( ++demo.entryIndex >= demo.directory.numentries )
|
||||||
{
|
{
|
||||||
@@ -751,7 +756,7 @@ qboolean CL_DemoMoveToNextSection( void )
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
qboolean CL_ReadRawNetworkData( byte *buffer, size_t *length )
|
static qboolean CL_ReadRawNetworkData( byte *buffer, size_t *length )
|
||||||
{
|
{
|
||||||
int msglen = 0;
|
int msglen = 0;
|
||||||
|
|
||||||
@@ -802,7 +807,7 @@ CL_DemoReadMessageQuake
|
|||||||
reads demo data and write it to client
|
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;
|
vec3_t viewangles;
|
||||||
int msglen = 0;
|
int msglen = 0;
|
||||||
@@ -1017,7 +1022,7 @@ qboolean CL_DemoReadMessage( byte *buffer, size_t *length )
|
|||||||
return CL_ReadRawNetworkData( buffer, 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;
|
int i, i0, i1, imod;
|
||||||
float at;
|
float at;
|
||||||
@@ -1112,7 +1117,7 @@ CL_FinishTimeDemo
|
|||||||
show stats
|
show stats
|
||||||
==============
|
==============
|
||||||
*/
|
*/
|
||||||
void CL_FinishTimeDemo( void )
|
static void CL_FinishTimeDemo( void )
|
||||||
{
|
{
|
||||||
int frames;
|
int frames;
|
||||||
double time;
|
double time;
|
||||||
@@ -1261,7 +1266,7 @@ CL_NextDemo
|
|||||||
Called when a demo finishes
|
Called when a demo finishes
|
||||||
==================
|
==================
|
||||||
*/
|
*/
|
||||||
qboolean CL_NextDemo( void )
|
static qboolean CL_NextDemo( void )
|
||||||
{
|
{
|
||||||
char str[MAX_QPATH];
|
char str[MAX_QPATH];
|
||||||
|
|
||||||
|
|||||||
@@ -175,7 +175,7 @@ particle_t * GAME_EXPORT R_AllocParticle( void (*callback)( particle_t*, float )
|
|||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
// never alloc particles when we not in game
|
// never alloc particles when we not in game
|
||||||
// if( tr.frametime == 0.0 ) return NULL;
|
if( cl_clientframetime() == 0.0 ) return NULL;
|
||||||
|
|
||||||
if( !cl_free_particles )
|
if( !cl_free_particles )
|
||||||
{
|
{
|
||||||
@@ -218,7 +218,7 @@ R_AllocTracer
|
|||||||
can return NULL if particles is out
|
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;
|
particle_t *p;
|
||||||
|
|
||||||
@@ -226,7 +226,7 @@ particle_t *R_AllocTracer( const vec3_t org, const vec3_t vel, float life )
|
|||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
// never alloc particles when we not in game
|
// never alloc particles when we not in game
|
||||||
//if( tr.frametime == 0.0 ) return NULL;
|
if( cl_clientframetime() == 0.0 ) return NULL;
|
||||||
|
|
||||||
if( !cl_free_particles )
|
if( !cl_free_particles )
|
||||||
{
|
{
|
||||||
@@ -300,7 +300,7 @@ R_BeamAlloc
|
|||||||
|
|
||||||
==============
|
==============
|
||||||
*/
|
*/
|
||||||
BEAM *R_BeamAlloc( void )
|
static BEAM *R_BeamAlloc( void )
|
||||||
{
|
{
|
||||||
BEAM *pBeam;
|
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.
|
// free particles that have died off.
|
||||||
R_FreeDeadParticles( &pBeam->particles );
|
R_FreeDeadParticles( &pBeam->particles );
|
||||||
@@ -605,7 +605,7 @@ CL_BeamAttemptToDie
|
|||||||
Check for expired beams
|
Check for expired beams
|
||||||
==============
|
==============
|
||||||
*/
|
*/
|
||||||
qboolean CL_BeamAttemptToDie( BEAM *pBeam )
|
static qboolean CL_BeamAttemptToDie( BEAM *pBeam )
|
||||||
{
|
{
|
||||||
Assert( pBeam != NULL );
|
Assert( pBeam != NULL );
|
||||||
|
|
||||||
@@ -2040,7 +2040,7 @@ void CL_ReadPointFile_f( void )
|
|||||||
else Con_Printf( "map %s has no leaks!\n", clgame.mapname );
|
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;
|
BEAM *pBeam, *pNext, *pPrev = NULL;
|
||||||
// draw temporary entity beams
|
// draw temporary entity beams
|
||||||
|
|||||||
@@ -40,7 +40,7 @@ CL_CalcPlayerVelocity
|
|||||||
compute velocity for a given client
|
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;
|
clientdata_t *pcd;
|
||||||
vec3_t delta;
|
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;
|
int idx = (slot & 63) * 2;
|
||||||
con_nprint_t info;
|
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;
|
cl_user_event_t *ev;
|
||||||
const char *name;
|
const char *name;
|
||||||
@@ -292,7 +292,7 @@ CL_FindEvent
|
|||||||
find first empty event
|
find first empty event
|
||||||
=============
|
=============
|
||||||
*/
|
*/
|
||||||
event_info_t *CL_FindEmptyEvent( void )
|
static event_info_t *CL_FindEmptyEvent( void )
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
event_state_t *es;
|
event_state_t *es;
|
||||||
@@ -320,7 +320,7 @@ CL_FindEvent
|
|||||||
replace only unreliable events
|
replace only unreliable events
|
||||||
=============
|
=============
|
||||||
*/
|
*/
|
||||||
event_info_t *CL_FindUnreliableEvent( void )
|
static event_info_t *CL_FindUnreliableEvent( void )
|
||||||
{
|
{
|
||||||
event_state_t *es;
|
event_state_t *es;
|
||||||
event_info_t *ei;
|
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;
|
event_info_t *ei;
|
||||||
|
|
||||||
|
|||||||
@@ -46,10 +46,35 @@ static int CL_LoadFontTexture( const char *fontname, uint texFlags, int *width )
|
|||||||
return tex;
|
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;
|
int font_width, i;
|
||||||
|
|
||||||
|
if( !rendermode )
|
||||||
|
return false;
|
||||||
|
|
||||||
if( font->valid )
|
if( font->valid )
|
||||||
return true; // already loaded
|
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->type = FONT_FIXED;
|
||||||
font->valid = true;
|
font->valid = true;
|
||||||
font->scale = scale;
|
font->scale = scale;
|
||||||
font->nearest = FBitSet( texFlags, TF_NEAREST );
|
|
||||||
font->rendermode = rendermode;
|
font->rendermode = rendermode;
|
||||||
font->charHeight = Q_rint( font_width / 16 * scale );
|
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;
|
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;
|
fs_offset_t length;
|
||||||
qfont_t src;
|
qfont_t src;
|
||||||
byte *pfile;
|
byte *pfile;
|
||||||
int font_width, i;
|
int font_width, i;
|
||||||
|
|
||||||
|
if( !rendermode )
|
||||||
|
return false;
|
||||||
|
|
||||||
if( font->valid )
|
if( font->valid )
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
@@ -106,8 +133,7 @@ qboolean Con_LoadVariableWidthFont( const char *fontname, cl_font_t *font, float
|
|||||||
|
|
||||||
font->type = FONT_VARIABLE;
|
font->type = FONT_VARIABLE;
|
||||||
font->valid = true;
|
font->valid = true;
|
||||||
font->scale = scale;
|
font->scale = scale ? scale : 1.0f;
|
||||||
font->nearest = FBitSet( texFlags, TF_NEAREST );
|
|
||||||
font->rendermode = rendermode;
|
font->rendermode = rendermode;
|
||||||
font->charHeight = Q_rint( src.rowheight * scale );
|
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];
|
return font->charWidths[number];
|
||||||
|
|
||||||
rc = &font->fontRc[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;
|
half = 0;
|
||||||
|
|
||||||
s1 = ((float)rc->left + half ) / texw;
|
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 );
|
SPR_AdjustSize( &x, &y, &w, &h );
|
||||||
|
|
||||||
if( !FBitSet( flags, FONT_DRAW_NORENDERMODE ))
|
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
|
// 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
|
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
|
Con_UtfProcessChar( 0 ); // clear utf state
|
||||||
|
|
||||||
if( !FBitSet( flags, FONT_DRAW_NORENDERMODE ))
|
if( !FBitSet( flags, FONT_DRAW_NORENDERMODE ))
|
||||||
ref.dllFuncs.GL_SetRenderMode( font->rendermode );
|
CL_SetFontRendermode( font );
|
||||||
|
|
||||||
Vector4Copy( color, current_color );
|
Vector4Copy( color, current_color );
|
||||||
|
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ GNU General Public License for more details.
|
|||||||
#include "sound.h"
|
#include "sound.h"
|
||||||
#include "input.h"
|
#include "input.h"
|
||||||
|
|
||||||
#define STUDIO_INTERPOLATION_FIX
|
// #define STUDIO_INTERPOLATION_FIX
|
||||||
|
|
||||||
/*
|
/*
|
||||||
==================
|
==================
|
||||||
@@ -52,19 +52,30 @@ CL_UpdatePositions
|
|||||||
Store another position into interpolation circular buffer
|
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;
|
position_history_t *ph, *prev;
|
||||||
|
|
||||||
|
prev = &ent->ph[ent->current_position];
|
||||||
|
|
||||||
ent->current_position = (ent->current_position + 1) & HISTORY_MASK;
|
ent->current_position = (ent->current_position + 1) & HISTORY_MASK;
|
||||||
ph = &ent->ph[ent->current_position];
|
ph = &ent->ph[ent->current_position];
|
||||||
VectorCopy( ent->curstate.origin, ph->origin );
|
VectorCopy( ent->curstate.origin, ph->origin );
|
||||||
VectorCopy( ent->curstate.angles, ph->angles );
|
VectorCopy( ent->curstate.angles, ph->angles );
|
||||||
|
|
||||||
if( ent->model && ent->model->type == mod_brush )
|
ph->animtime = ent->curstate.animtime;
|
||||||
ph->animtime = ent->curstate.animtime;
|
|
||||||
else
|
// a1ba: for some reason, this sometimes still may happen
|
||||||
ph->animtime = cl.time;
|
// at this time, I'm not sure whether this bug happens in delta readwrite code
|
||||||
|
// or server just decides to go backwards and really sends these values
|
||||||
|
if( ph->animtime < prev->animtime )
|
||||||
|
{
|
||||||
|
// try to deduce real animtime by looking up the difference between
|
||||||
|
// server messages (cl.mtime is never modified ny the interpolation code)
|
||||||
|
float diff = Q_max( 0, ent->curstate.msg_time - ent->prevstate.msg_time );
|
||||||
|
|
||||||
|
ph->animtime = prev->animtime + diff;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -74,7 +85,7 @@ CL_ResetPositions
|
|||||||
Interpolation init or reset after teleporting
|
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;
|
position_history_t store;
|
||||||
|
|
||||||
@@ -96,7 +107,7 @@ check for instant movement in case
|
|||||||
we don't want interpolate this
|
we don't want interpolate this
|
||||||
==================
|
==================
|
||||||
*/
|
*/
|
||||||
qboolean CL_EntityTeleported( cl_entity_t *ent )
|
static qboolean CL_EntityTeleported( cl_entity_t *ent )
|
||||||
{
|
{
|
||||||
float len, maxlen;
|
float len, maxlen;
|
||||||
vec3_t delta;
|
vec3_t delta;
|
||||||
@@ -117,7 +128,7 @@ CL_CompareTimestamps
|
|||||||
round-off floating errors
|
round-off floating errors
|
||||||
==================
|
==================
|
||||||
*/
|
*/
|
||||||
qboolean CL_CompareTimestamps( float t1, float t2 )
|
static qboolean CL_CompareTimestamps( float t1, float t2 )
|
||||||
{
|
{
|
||||||
int iTime1 = t1 * 1000;
|
int iTime1 = t1 * 1000;
|
||||||
int iTime2 = t2 * 1000;
|
int iTime2 = t2 * 1000;
|
||||||
@@ -132,7 +143,7 @@ CL_EntityIgnoreLerp
|
|||||||
some ents will be ignore lerping
|
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 )
|
if( cl_nointerp.value > 0.f )
|
||||||
return true;
|
return true;
|
||||||
@@ -149,7 +160,7 @@ CL_EntityCustomLerp
|
|||||||
|
|
||||||
==================
|
==================
|
||||||
*/
|
*/
|
||||||
qboolean CL_EntityCustomLerp( cl_entity_t *e )
|
static qboolean CL_EntityCustomLerp( cl_entity_t *e )
|
||||||
{
|
{
|
||||||
switch( e->curstate.movetype )
|
switch( e->curstate.movetype )
|
||||||
{
|
{
|
||||||
@@ -159,6 +170,13 @@ qboolean CL_EntityCustomLerp( cl_entity_t *e )
|
|||||||
case MOVETYPE_FLY:
|
case MOVETYPE_FLY:
|
||||||
case MOVETYPE_COMPOUND:
|
case MOVETYPE_COMPOUND:
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
// ABSOLUTELY STUPID HACK TO ALLOW MONSTERS
|
||||||
|
// INTERPOLATION IN GRAVGUNMOD COOP
|
||||||
|
// MUST BE REMOVED ONCE WE REMOVE 48 PROTO SUPPORT
|
||||||
|
case MOVETYPE_TOSS:
|
||||||
|
if( cls.legacymode && e->model && e->model->type == mod_studio )
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
@@ -171,7 +189,7 @@ CL_ParametricMove
|
|||||||
check for parametrical moved entities
|
check for parametrical moved entities
|
||||||
==================
|
==================
|
||||||
*/
|
*/
|
||||||
qboolean CL_ParametricMove( cl_entity_t *ent )
|
static qboolean CL_ParametricMove( cl_entity_t *ent )
|
||||||
{
|
{
|
||||||
float frac, dt, t;
|
float frac, dt, t;
|
||||||
vec3_t delta;
|
vec3_t delta;
|
||||||
@@ -208,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 ))
|
if( !ent->model || ( ent->model->type != mod_alias && ent->model->type != mod_studio ))
|
||||||
return; // below fields used only for alias and studio interpolation
|
return; // below fields used only for alias and studio interpolation
|
||||||
@@ -303,7 +321,7 @@ CL_ProcessEntityUpdate
|
|||||||
apply changes since new frame received
|
apply changes since new frame received
|
||||||
==================
|
==================
|
||||||
*/
|
*/
|
||||||
void CL_ProcessEntityUpdate( cl_entity_t *ent )
|
static void CL_ProcessEntityUpdate( cl_entity_t *ent )
|
||||||
{
|
{
|
||||||
qboolean parametric;
|
qboolean parametric;
|
||||||
|
|
||||||
@@ -349,11 +367,10 @@ CL_FindInterpolationUpdates
|
|||||||
find two timestamps
|
find two timestamps
|
||||||
==================
|
==================
|
||||||
*/
|
*/
|
||||||
qboolean CL_FindInterpolationUpdates( cl_entity_t *ent, float targettime, position_history_t **ph0, position_history_t **ph1 )
|
static qboolean CL_FindInterpolationUpdates( cl_entity_t *ent, double targettime, position_history_t **ph0, position_history_t **ph1 )
|
||||||
{
|
{
|
||||||
qboolean extrapolate = true;
|
qboolean extrapolate = true;
|
||||||
uint i, i0, i1, imod;
|
uint i, i0, i1, imod;
|
||||||
float at;
|
|
||||||
|
|
||||||
imod = ent->current_position;
|
imod = ent->current_position;
|
||||||
i0 = (imod - 0) & HISTORY_MASK; // curpos (lerp end)
|
i0 = (imod - 0) & HISTORY_MASK; // curpos (lerp end)
|
||||||
@@ -361,8 +378,10 @@ qboolean CL_FindInterpolationUpdates( cl_entity_t *ent, float targettime, positi
|
|||||||
|
|
||||||
for( i = 1; i < HISTORY_MAX - 1; i++ )
|
for( i = 1; i < HISTORY_MAX - 1; i++ )
|
||||||
{
|
{
|
||||||
at = ent->ph[( imod - i ) & HISTORY_MASK].animtime;
|
double at = ent->ph[( imod - i ) & HISTORY_MASK].animtime;
|
||||||
if( at == 0.0f ) break;
|
|
||||||
|
if( at == 0.0f )
|
||||||
|
break;
|
||||||
|
|
||||||
if( targettime > at )
|
if( targettime > at )
|
||||||
{
|
{
|
||||||
@@ -387,15 +406,14 @@ CL_PureOrigin
|
|||||||
non-local players interpolation
|
non-local players interpolation
|
||||||
==================
|
==================
|
||||||
*/
|
*/
|
||||||
void CL_PureOrigin( cl_entity_t *ent, float t, vec3_t outorigin, vec3_t outangles )
|
static void CL_PureOrigin( cl_entity_t *ent, double t, vec3_t outorigin, vec3_t outangles )
|
||||||
{
|
{
|
||||||
qboolean extrapolate;
|
double t1, t0, frac;
|
||||||
float t1, t0, frac;
|
|
||||||
position_history_t *ph0, *ph1;
|
position_history_t *ph0, *ph1;
|
||||||
vec3_t delta;
|
vec3_t delta;
|
||||||
|
|
||||||
// NOTE: ph0 is next, ph1 is a prev
|
// NOTE: ph0 is next, ph1 is a prev
|
||||||
extrapolate = CL_FindInterpolationUpdates( ent, t, &ph0, &ph1 );
|
CL_FindInterpolationUpdates( ent, t, &ph0, &ph1 );
|
||||||
|
|
||||||
if ( !ph0 || !ph1 )
|
if ( !ph0 || !ph1 )
|
||||||
return;
|
return;
|
||||||
@@ -403,7 +421,7 @@ void CL_PureOrigin( cl_entity_t *ent, float t, vec3_t outorigin, vec3_t outangle
|
|||||||
t0 = ph0->animtime;
|
t0 = ph0->animtime;
|
||||||
t1 = ph1->animtime;
|
t1 = ph1->animtime;
|
||||||
|
|
||||||
if( t0 != 0.0f )
|
if( t0 != 0.0 )
|
||||||
{
|
{
|
||||||
vec4_t q, q1, q2;
|
vec4_t q, q1, q2;
|
||||||
|
|
||||||
@@ -411,9 +429,9 @@ void CL_PureOrigin( cl_entity_t *ent, float t, vec3_t outorigin, vec3_t outangle
|
|||||||
|
|
||||||
if( !Q_equal( t0, t1 ))
|
if( !Q_equal( t0, t1 ))
|
||||||
frac = ( t - t1 ) / ( t0 - t1 );
|
frac = ( t - t1 ) / ( t0 - t1 );
|
||||||
else frac = 1.0f;
|
else frac = 1.0;
|
||||||
|
|
||||||
frac = bound( 0.0f, frac, 1.2f );
|
frac = bound( 0.0, frac, 1.2 );
|
||||||
|
|
||||||
VectorMA( ph1->origin, frac, delta, outorigin );
|
VectorMA( ph1->origin, frac, delta, outorigin );
|
||||||
|
|
||||||
@@ -437,11 +455,11 @@ CL_InterpolateModel
|
|||||||
non-players interpolation
|
non-players interpolation
|
||||||
==================
|
==================
|
||||||
*/
|
*/
|
||||||
int CL_InterpolateModel( cl_entity_t *e )
|
static int CL_InterpolateModel( cl_entity_t *e )
|
||||||
{
|
{
|
||||||
position_history_t *ph0 = NULL, *ph1 = NULL;
|
position_history_t *ph0 = NULL, *ph1 = NULL;
|
||||||
vec3_t origin, angles, delta;
|
vec3_t origin, angles, delta;
|
||||||
float t, t1, t2, frac;
|
double t, t1, t2, frac;
|
||||||
vec4_t q, q1, q2;
|
vec4_t q, q1, q2;
|
||||||
|
|
||||||
VectorCopy( e->curstate.origin, e->origin );
|
VectorCopy( e->curstate.origin, e->origin );
|
||||||
@@ -489,9 +507,7 @@ int CL_InterpolateModel( cl_entity_t *e )
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
// HACKHACK: workaround buggy position history animtime
|
if( Q_equal( t2, t1 ))
|
||||||
// going backward sometimes
|
|
||||||
if( Q_equal( t2, t1 ) || t2 < t1 )
|
|
||||||
{
|
{
|
||||||
VectorCopy( ph0->origin, e->origin );
|
VectorCopy( ph0->origin, e->origin );
|
||||||
VectorCopy( ph0->angles, e->angles );
|
VectorCopy( ph0->angles, e->angles );
|
||||||
@@ -529,7 +545,7 @@ interpolate non-local clients
|
|||||||
*/
|
*/
|
||||||
void CL_ComputePlayerOrigin( cl_entity_t *ent )
|
void CL_ComputePlayerOrigin( cl_entity_t *ent )
|
||||||
{
|
{
|
||||||
float targettime;
|
double targettime;
|
||||||
vec4_t q, q1, q2;
|
vec4_t q, q1, q2;
|
||||||
vec3_t origin;
|
vec3_t origin;
|
||||||
vec3_t angles;
|
vec3_t angles;
|
||||||
@@ -569,7 +585,7 @@ CL_ProcessPlayerState
|
|||||||
process player states after the new packet has received
|
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;
|
entity_state_t *ps;
|
||||||
|
|
||||||
@@ -589,7 +605,7 @@ reset latched state if this frame entity was teleported
|
|||||||
or just EF_NOINTERP was set
|
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 ))
|
if( CHECKVISBIT( frame->flags, pnum ))
|
||||||
{
|
{
|
||||||
@@ -679,7 +695,7 @@ CL_FlushEntityPacket
|
|||||||
Read and ignore whole entity packet.
|
Read and ignore whole entity packet.
|
||||||
=================
|
=================
|
||||||
*/
|
*/
|
||||||
void CL_FlushEntityPacket( sizebuf_t *msg )
|
static void CL_FlushEntityPacket( sizebuf_t *msg )
|
||||||
{
|
{
|
||||||
int newnum;
|
int newnum;
|
||||||
entity_state_t from, to;
|
entity_state_t from, to;
|
||||||
@@ -709,7 +725,7 @@ CL_DeltaEntity
|
|||||||
processing delta update
|
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;
|
cl_entity_t *ent;
|
||||||
entity_state_t *state;
|
entity_state_t *state;
|
||||||
@@ -1041,7 +1057,7 @@ CL_LinkCustomEntity
|
|||||||
Add server beam to draw list
|
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; // !!!
|
ent->curstate.movetype = state->modelindex; // !!!
|
||||||
|
|
||||||
@@ -1064,7 +1080,7 @@ Create visible entities in the correct position
|
|||||||
for all current players
|
for all current players
|
||||||
=============
|
=============
|
||||||
*/
|
*/
|
||||||
void CL_LinkPlayers( frame_t *frame )
|
static void CL_LinkPlayers( frame_t *frame )
|
||||||
{
|
{
|
||||||
entity_state_t *state;
|
entity_state_t *state;
|
||||||
cl_entity_t *ent;
|
cl_entity_t *ent;
|
||||||
@@ -1147,7 +1163,7 @@ CL_LinkPacketEntities
|
|||||||
|
|
||||||
===============
|
===============
|
||||||
*/
|
*/
|
||||||
void CL_LinkPacketEntities( frame_t *frame )
|
static void CL_LinkPacketEntities( frame_t *frame )
|
||||||
{
|
{
|
||||||
cl_entity_t *ent;
|
cl_entity_t *ent;
|
||||||
entity_state_t *state;
|
entity_state_t *state;
|
||||||
@@ -1212,17 +1228,33 @@ void CL_LinkPacketEntities( frame_t *frame )
|
|||||||
#else
|
#else
|
||||||
if( ent->lastmove >= cl.time )
|
if( ent->lastmove >= cl.time )
|
||||||
{
|
{
|
||||||
|
float at = ent->curstate.animtime;
|
||||||
|
|
||||||
CL_ResetLatchedVars( ent, true );
|
CL_ResetLatchedVars( ent, true );
|
||||||
|
|
||||||
|
if( cl_fixmodelinterpolationartifacts.value )
|
||||||
|
ent->latched.prevanimtime = ent->curstate.animtime = at;
|
||||||
|
|
||||||
VectorCopy( ent->curstate.origin, ent->latched.prevorigin );
|
VectorCopy( ent->curstate.origin, ent->latched.prevorigin );
|
||||||
VectorCopy( ent->curstate.angles, ent->latched.prevangles );
|
VectorCopy( ent->curstate.angles, ent->latched.prevangles );
|
||||||
|
|
||||||
// disable step interpolation in client.dll
|
if( !FBitSet( host.features, ENGINE_COMPUTE_STUDIO_LERP ))
|
||||||
ent->curstate.movetype = MOVETYPE_NONE;
|
{
|
||||||
|
// disable step interpolation in client.dll
|
||||||
|
ent->curstate.movetype = MOVETYPE_NONE;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// restore step interpolation in client.dll
|
if( FBitSet( host.features, ENGINE_COMPUTE_STUDIO_LERP ))
|
||||||
ent->curstate.movetype = MOVETYPE_STEP;
|
{
|
||||||
|
interpolate = true;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// restore step interpolation in client.dll
|
||||||
|
ent->curstate.movetype = MOVETYPE_STEP;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
@@ -1247,11 +1279,24 @@ void CL_LinkPacketEntities( frame_t *frame )
|
|||||||
if ( !CL_InterpolateModel( ent ))
|
if ( !CL_InterpolateModel( ent ))
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
else if( ent->curstate.movetype == MOVETYPE_STEP && !NET_IsLocalAddress( cls.netchan.remote_address ))
|
// a1ba: in GoldSrc this is done for cstrike and czero
|
||||||
|
// but let modders use this as an engine feature
|
||||||
|
else if( FBitSet( host.features, ENGINE_STEP_POSHISTORY_LERP ) &&
|
||||||
|
ent->curstate.movetype == MOVETYPE_STEP && !NET_IsLocalAddress( cls.netchan.remote_address ))
|
||||||
{
|
{
|
||||||
if( !CL_InterpolateModel( ent ))
|
if( !CL_InterpolateModel( ent ))
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
#if 0
|
||||||
|
// ABSOLUTELY STUPID HACK TO ALLOW MONSTERS
|
||||||
|
// INTERPOLATION IN GRAVGUNMOD COOP
|
||||||
|
// MUST BE REMOVED ONCE WE REMOVE 48 PROTO SUPPORT
|
||||||
|
else if( cls.legacymode && ent->model->type == mod_studio && ent->curstate.movetype == MOVETYPE_TOSS )
|
||||||
|
{
|
||||||
|
if( !CL_InterpolateModel( ent ))
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// no interpolation right now
|
// no interpolation right now
|
||||||
@@ -1447,9 +1492,3 @@ qboolean CL_GetMovieSpatialization( rawchan_t *ch )
|
|||||||
|
|
||||||
return true;
|
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;
|
*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
|
if( refState.width != clgame.scrInfo.iWidth )
|
||||||
*s1 += 0.5f;
|
{
|
||||||
*s2 -= 0.5f;
|
// align to texel if scaling
|
||||||
}
|
*s1 += 0.5f;
|
||||||
|
*s2 -= 0.5f;
|
||||||
|
}
|
||||||
|
|
||||||
if( refState.height != clgame.scrInfo.iHeight )
|
if( refState.height != clgame.scrInfo.iHeight )
|
||||||
{
|
{
|
||||||
// align to texel if scaling
|
// align to texel if scaling
|
||||||
*t1 += 0.5f;
|
*t1 += 0.5f;
|
||||||
*t2 -= 0.5f;
|
*t2 -= 0.5f;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
*s1 /= width;
|
*s1 /= width;
|
||||||
@@ -402,6 +405,8 @@ static void SPR_DrawGeneric( int frame, float x, float y, float width, float hei
|
|||||||
height = h;
|
height = h;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
texnum = ref.dllFuncs.R_GetSpriteTexture( clgame.ds.pSprite, frame );
|
||||||
|
|
||||||
if( prc )
|
if( prc )
|
||||||
{
|
{
|
||||||
wrect_t rc = *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;
|
t2 = rc.bottom;
|
||||||
|
|
||||||
// calc user-defined rectangle
|
// 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;
|
width = rc.right - rc.left;
|
||||||
height = rc.bottom - rc.top;
|
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
|
// scale for screen sizes
|
||||||
SPR_AdjustSize( &x, &y, &width, &height );
|
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.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 );
|
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;
|
pText = clgame.centerPrint.message;
|
||||||
|
|
||||||
CL_DrawCharacterLen( font, 0, NULL, &charHeight );
|
CL_DrawCharacterLen( font, 0, NULL, &charHeight );
|
||||||
|
CL_SetFontRendermode( font );
|
||||||
ref.dllFuncs.GL_SetRenderMode( font->rendermode );
|
|
||||||
for( i = 0; i < clgame.centerPrint.lines; i++ )
|
for( i = 0; i < clgame.centerPrint.lines; i++ )
|
||||||
{
|
{
|
||||||
lineLength = 0;
|
lineLength = 0;
|
||||||
@@ -547,7 +550,7 @@ fill screen with specfied color
|
|||||||
can be modulated
|
can be modulated
|
||||||
=============
|
=============
|
||||||
*/
|
*/
|
||||||
void CL_DrawScreenFade( void )
|
static void CL_DrawScreenFade( void )
|
||||||
{
|
{
|
||||||
screenfade_t *sf = &clgame.fade;
|
screenfade_t *sf = &clgame.fade;
|
||||||
int alpha;
|
int alpha;
|
||||||
@@ -763,7 +766,7 @@ CL_SoundFromIndex
|
|||||||
return soundname from index
|
return soundname from index
|
||||||
====================
|
====================
|
||||||
*/
|
*/
|
||||||
const char *CL_SoundFromIndex( int index )
|
static const char *CL_SoundFromIndex( int index )
|
||||||
{
|
{
|
||||||
sfx_t *sfx = NULL;
|
sfx_t *sfx = NULL;
|
||||||
int hSound;
|
int hSound;
|
||||||
@@ -909,7 +912,7 @@ CL_DrawCrosshair
|
|||||||
Render crosshair
|
Render crosshair
|
||||||
====================
|
====================
|
||||||
*/
|
*/
|
||||||
void CL_DrawCrosshair( void )
|
static void CL_DrawCrosshair( void )
|
||||||
{
|
{
|
||||||
int x, y, width, height;
|
int x, y, width, height;
|
||||||
float xscale, yscale;
|
float xscale, yscale;
|
||||||
@@ -1326,6 +1329,7 @@ pfnSPR_Load
|
|||||||
function exported for support GoldSrc Monitor utility
|
function exported for support GoldSrc Monitor utility
|
||||||
=========
|
=========
|
||||||
*/
|
*/
|
||||||
|
HSPRITE EXPORT pfnSPR_Load( const char *szPicName );
|
||||||
HSPRITE EXPORT pfnSPR_Load( const char *szPicName )
|
HSPRITE EXPORT pfnSPR_Load( const char *szPicName )
|
||||||
{
|
{
|
||||||
model_t *spr;
|
model_t *spr;
|
||||||
@@ -1375,6 +1379,7 @@ pfnSPR_Frames
|
|||||||
function exported for support GoldSrc Monitor utility
|
function exported for support GoldSrc Monitor utility
|
||||||
=========
|
=========
|
||||||
*/
|
*/
|
||||||
|
int EXPORT pfnSPR_Frames( HSPRITE hPic );
|
||||||
int EXPORT pfnSPR_Frames( HSPRITE hPic )
|
int EXPORT pfnSPR_Frames( HSPRITE hPic )
|
||||||
{
|
{
|
||||||
int numFrames = 0;
|
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 )
|
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 );
|
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;
|
float _x = x, _y = y, _w = w, _h = h;
|
||||||
|
|
||||||
@@ -1635,6 +1640,7 @@ get actual screen info
|
|||||||
*/
|
*/
|
||||||
int GAME_EXPORT CL_GetScreenInfo( SCREENINFO *pscrinfo )
|
int GAME_EXPORT CL_GetScreenInfo( SCREENINFO *pscrinfo )
|
||||||
{
|
{
|
||||||
|
qboolean apply_scale_factor = false;
|
||||||
float scale_factor = hud_scale.value;
|
float scale_factor = hud_scale.value;
|
||||||
|
|
||||||
if( FBitSet( hud_fontscale.flags, FCVAR_CHANGED ))
|
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.iSize = sizeof( clgame.scrInfo );
|
||||||
clgame.scrInfo.iFlags = SCRINFO_SCREENFLASH;
|
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.iWidth = (float)refState.width / scale_factor;
|
||||||
clgame.scrInfo.iHeight = (float)refState.height / scale_factor;
|
clgame.scrInfo.iHeight = (float)refState.height / scale_factor;
|
||||||
clgame.scrInfo.iFlags |= SCRINFO_STRETCHED;
|
SetBits( clgame.scrInfo.iFlags, SCRINFO_STRETCHED );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
clgame.scrInfo.iWidth = refState.width;
|
clgame.scrInfo.iWidth = refState.width;
|
||||||
clgame.scrInfo.iHeight = refState.height;
|
clgame.scrInfo.iHeight = refState.height;
|
||||||
clgame.scrInfo.iFlags &= ~SCRINFO_STRETCHED;
|
ClearBits( clgame.scrInfo.iFlags, SCRINFO_STRETCHED );
|
||||||
}
|
}
|
||||||
|
|
||||||
if( !pscrinfo ) return 0;
|
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 )
|
static cvar_t *GAME_EXPORT pfnCvar_RegisterClientVariable( const char *szName, const char *szValue, int flags )
|
||||||
{
|
{
|
||||||
// a1ba: try to mitigate outdated client.dll vulnerabilities
|
// 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;
|
flags |= FCVAR_PRIVILEGED;
|
||||||
|
|
||||||
return (cvar_t *)Cvar_Get( szName, szValue, flags|FCVAR_CLIENTDLL, Cvar_BuildAutoDescription( szName, flags|FCVAR_CLIENTDLL ));
|
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;
|
return &clgame.viewent;
|
||||||
}
|
}
|
||||||
@@ -2470,6 +2484,36 @@ static physent_t *pfnGetVisent( int idx )
|
|||||||
return NULL;
|
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
|
pfnSetTraceHull
|
||||||
@@ -2665,6 +2709,48 @@ static model_t *pfnLoadMapSprite( const char *filename )
|
|||||||
return NULL;
|
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
|
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;
|
gameui.ds.gl_texturenum = hPic;
|
||||||
r = bound( 0, r, 255 );
|
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 );
|
ref.dllFuncs.GL_SetRenderMode( kRenderNormal );
|
||||||
PIC_DrawGeneric( x, y, width, height, prc );
|
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 );
|
ref.dllFuncs.GL_SetRenderMode( kRenderTransTexture );
|
||||||
PIC_DrawGeneric( x, y, width, height, prc );
|
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 );
|
ref.dllFuncs.GL_SetRenderMode( kRenderTransAlpha );
|
||||||
PIC_DrawGeneric( x, y, width, height, prc );
|
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 );
|
ref.dllFuncs.GL_SetRenderMode( kRenderTransAdd );
|
||||||
PIC_DrawGeneric( x, y, width, height, prc );
|
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
|
#ifdef XASH_INTERNAL_GAMELIBS
|
||||||
return true;
|
return true;
|
||||||
@@ -1092,6 +1092,11 @@ static int pfnDelete( const char *path )
|
|||||||
return FS_Delete( 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
|
// engine callbacks
|
||||||
static ui_enginefuncs_t gEngfuncs =
|
static ui_enginefuncs_t gEngfuncs =
|
||||||
{
|
{
|
||||||
@@ -1131,7 +1136,7 @@ static ui_enginefuncs_t gEngfuncs =
|
|||||||
UI_DrawConsoleString,
|
UI_DrawConsoleString,
|
||||||
UI_DrawSetTextColor,
|
UI_DrawSetTextColor,
|
||||||
Con_DrawStringLen,
|
Con_DrawStringLen,
|
||||||
Con_DefaultColor,
|
pfnCon_DefaultColor,
|
||||||
pfnGetPlayerModel,
|
pfnGetPlayerModel,
|
||||||
pfnSetPlayerModel,
|
pfnSetPlayerModel,
|
||||||
pfnClearScene,
|
pfnClearScene,
|
||||||
@@ -1215,6 +1220,7 @@ static ui_extendedfuncs_t gExtendedfuncs =
|
|||||||
pfnParseFileSafe,
|
pfnParseFileSafe,
|
||||||
NET_AdrToString,
|
NET_AdrToString,
|
||||||
NET_CompareAdrSort,
|
NET_CompareAdrSort,
|
||||||
|
Sys_GetNativeObject,
|
||||||
};
|
};
|
||||||
|
|
||||||
void UI_UnloadProgs( void )
|
void UI_UnloadProgs( void )
|
||||||
|
|||||||
@@ -28,7 +28,6 @@ GNU General Public License for more details.
|
|||||||
#define MAX_CMD_BUFFER 8000
|
#define MAX_CMD_BUFFER 8000
|
||||||
#define CONNECTION_PROBLEM_TIME 15.0 // 15 seconds
|
#define CONNECTION_PROBLEM_TIME 15.0 // 15 seconds
|
||||||
#define CL_CONNECTION_RETRIES 10
|
#define CL_CONNECTION_RETRIES 10
|
||||||
#define CL_TEST_RETRIES_NORESPONCE 3
|
|
||||||
#define CL_TEST_RETRIES 5
|
#define CL_TEST_RETRIES 5
|
||||||
|
|
||||||
CVAR_DEFINE_AUTO( mp_decals, "300", FCVAR_ARCHIVE, "decals limit in multiplayer" );
|
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_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( 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_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, "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_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_updaterate, "20", FCVAR_USERINFO|FCVAR_ARCHIVE, "refresh rate of server messages" );
|
||||||
CVAR_DEFINE_AUTO( cl_showevents, "0", FCVAR_ARCHIVE, "show events playback" );
|
CVAR_DEFINE_AUTO( cl_showevents, "0", FCVAR_ARCHIVE, "show events playback" );
|
||||||
@@ -73,11 +74,14 @@ 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_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_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_stufftext, "0", FCVAR_ARCHIVE|FCVAR_CHEAT, "enable stufftext (server-to-client console commands) 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_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" );
|
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( 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" );
|
CVAR_DEFINE_AUTO( ui_renderworld, "0", FCVAR_ARCHIVE, "render world when UI is visible" );
|
||||||
|
static CVAR_DEFINE_AUTO( cl_maxframetime, "0", 0, "set deadline timer for client rendering to catch freezes" );
|
||||||
|
CVAR_DEFINE_AUTO( cl_fixmodelinterpolationartifacts, "1", 0, "try to fix up models interpolation on a moving platforms (monsters on trains for example)" );
|
||||||
|
|
||||||
//
|
//
|
||||||
// userinfo
|
// userinfo
|
||||||
@@ -87,7 +91,6 @@ static CVAR_DEFINE_AUTO( model, "", FCVAR_USERINFO|FCVAR_ARCHIVE|FCVAR_FILTERABL
|
|||||||
static CVAR_DEFINE_AUTO( topcolor, "0", FCVAR_USERINFO|FCVAR_ARCHIVE|FCVAR_FILTERABLE, "player top color" );
|
static CVAR_DEFINE_AUTO( topcolor, "0", FCVAR_USERINFO|FCVAR_ARCHIVE|FCVAR_FILTERABLE, "player top color" );
|
||||||
static CVAR_DEFINE_AUTO( bottomcolor, "0", FCVAR_USERINFO|FCVAR_ARCHIVE|FCVAR_FILTERABLE, "player bottom color" );
|
static CVAR_DEFINE_AUTO( bottomcolor, "0", FCVAR_USERINFO|FCVAR_ARCHIVE|FCVAR_FILTERABLE, "player bottom color" );
|
||||||
CVAR_DEFINE_AUTO( rate, "3500", FCVAR_USERINFO|FCVAR_ARCHIVE|FCVAR_FILTERABLE, "player network rate" );
|
CVAR_DEFINE_AUTO( rate, "3500", FCVAR_USERINFO|FCVAR_ARCHIVE|FCVAR_FILTERABLE, "player network rate" );
|
||||||
static CVAR_DEFINE_AUTO( cl_maxframetime, "0", 0, "set deadline timer for client rendering to catch freezes" );
|
|
||||||
|
|
||||||
client_t cl;
|
client_t cl;
|
||||||
client_static_t cls;
|
client_static_t cls;
|
||||||
@@ -177,7 +180,7 @@ finalize connection process and begin new frame
|
|||||||
with new cls.state
|
with new cls.state
|
||||||
===============
|
===============
|
||||||
*/
|
*/
|
||||||
void CL_CheckClientState( void )
|
static void CL_CheckClientState( void )
|
||||||
{
|
{
|
||||||
// first update is the pre-final signon stage
|
// first update is the pre-final signon stage
|
||||||
if(( cls.state == ca_connected || cls.state == ca_validate ) && ( cls.signon == SIGNONS ))
|
if(( cls.state == ca_connected || cls.state == ca_validate ) && ( cls.signon == SIGNONS ))
|
||||||
@@ -277,7 +280,7 @@ CL_DriftInterpolationAmount
|
|||||||
Drift interpolation value (this is used for server unlag system)
|
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;
|
float fgoal, maxmove, diff;
|
||||||
int msec;
|
int msec;
|
||||||
@@ -305,7 +308,7 @@ CL_ComputeClientInterpolationAmount
|
|||||||
Validate interpolation cvars, calc interpolation window
|
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
|
const float epsilon = 0.001f; // to avoid float invalid comparision
|
||||||
float min_interp;
|
float min_interp;
|
||||||
@@ -351,7 +354,7 @@ CL_ComputePacketLoss
|
|||||||
|
|
||||||
=================
|
=================
|
||||||
*/
|
*/
|
||||||
void CL_ComputePacketLoss( void )
|
static void CL_ComputePacketLoss( void )
|
||||||
{
|
{
|
||||||
int i, frm;
|
int i, frm;
|
||||||
frame_t *frame;
|
frame_t *frame;
|
||||||
@@ -396,7 +399,7 @@ void CL_UpdateFrameLerp( void )
|
|||||||
cl.commands[(cls.netchan.outgoing_sequence - 1) & CL_UPDATE_MASK].frame_lerp = cl.lerpFrac;
|
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;
|
int i, i0, i1, imod;
|
||||||
float at;
|
float at;
|
||||||
@@ -438,7 +441,7 @@ void CL_FindInterpolatedAddAngle( float t, float *frac, pred_viewangle_t **prev,
|
|||||||
*frac = bound( 0.0f, *frac, 1.0f );
|
*frac = bound( 0.0f, *frac, 1.0f );
|
||||||
}
|
}
|
||||||
|
|
||||||
void CL_ApplyAddAngle( void )
|
static void CL_ApplyAddAngle( void )
|
||||||
{
|
{
|
||||||
pred_viewangle_t *prev = NULL, *next = NULL;
|
pred_viewangle_t *prev = NULL, *next = NULL;
|
||||||
float addangletotal = 0.0f;
|
float addangletotal = 0.0f;
|
||||||
@@ -474,7 +477,7 @@ CL_ProcessShowTexturesCmds
|
|||||||
navigate around texture atlas
|
navigate around texture atlas
|
||||||
===============
|
===============
|
||||||
*/
|
*/
|
||||||
qboolean CL_ProcessShowTexturesCmds( usercmd_t *cmd )
|
static qboolean CL_ProcessShowTexturesCmds( usercmd_t *cmd )
|
||||||
{
|
{
|
||||||
static int oldbuttons;
|
static int oldbuttons;
|
||||||
int changed;
|
int changed;
|
||||||
@@ -503,7 +506,7 @@ CL_ProcessOverviewCmds
|
|||||||
Transform user movement into overview adjust
|
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;
|
ref_overview_t *ov = &clgame.overView;
|
||||||
int sign = 1;
|
int sign = 1;
|
||||||
@@ -555,7 +558,7 @@ CL_UpdateClientData
|
|||||||
tell the client.dll about player origin, angles, fov, etc
|
tell the client.dll about player origin, angles, fov, etc
|
||||||
=================
|
=================
|
||||||
*/
|
*/
|
||||||
void CL_UpdateClientData( void )
|
static void CL_UpdateClientData( void )
|
||||||
{
|
{
|
||||||
client_data_t cdat;
|
client_data_t cdat;
|
||||||
|
|
||||||
@@ -582,7 +585,7 @@ void CL_UpdateClientData( void )
|
|||||||
CL_CreateCmd
|
CL_CreateCmd
|
||||||
=================
|
=================
|
||||||
*/
|
*/
|
||||||
void CL_CreateCmd( void )
|
static void CL_CreateCmd( void )
|
||||||
{
|
{
|
||||||
usercmd_t nullcmd, *cmd;
|
usercmd_t nullcmd, *cmd;
|
||||||
runcmd_t *pcmd;
|
runcmd_t *pcmd;
|
||||||
@@ -606,10 +609,10 @@ void CL_CreateCmd( void )
|
|||||||
// message we are constructing.
|
// message we are constructing.
|
||||||
i = cls.netchan.outgoing_sequence & CL_UPDATE_MASK;
|
i = cls.netchan.outgoing_sequence & CL_UPDATE_MASK;
|
||||||
pcmd = &cl.commands[i];
|
pcmd = &cl.commands[i];
|
||||||
pcmd->processedfuncs = false;
|
|
||||||
|
|
||||||
if( !cls.demoplayback )
|
if( !cls.demoplayback )
|
||||||
{
|
{
|
||||||
|
pcmd->processedfuncs = false;
|
||||||
pcmd->senttime = host.realtime;
|
pcmd->senttime = host.realtime;
|
||||||
memset( &pcmd->cmd, 0, sizeof( pcmd->cmd ));
|
memset( &pcmd->cmd, 0, sizeof( pcmd->cmd ));
|
||||||
pcmd->receivedtime = -1.0;
|
pcmd->receivedtime = -1.0;
|
||||||
@@ -686,7 +689,7 @@ Create and send the command packet to the server
|
|||||||
Including both the reliable commands and the usercmds
|
Including both the reliable commands and the usercmds
|
||||||
===================
|
===================
|
||||||
*/
|
*/
|
||||||
void CL_WritePacket( void )
|
static void CL_WritePacket( void )
|
||||||
{
|
{
|
||||||
sizebuf_t buf;
|
sizebuf_t buf;
|
||||||
qboolean send_command = false;
|
qboolean send_command = false;
|
||||||
@@ -878,7 +881,7 @@ CL_SendCommand
|
|||||||
Called every frame to builds and sends a command packet to the server.
|
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,
|
// we create commands even if a demo is playing,
|
||||||
CL_CreateCmd();
|
CL_CreateCmd();
|
||||||
@@ -892,7 +895,7 @@ void CL_SendCommand( void )
|
|||||||
CL_BeginUpload_f
|
CL_BeginUpload_f
|
||||||
==================
|
==================
|
||||||
*/
|
*/
|
||||||
void CL_BeginUpload_f( void )
|
static void CL_BeginUpload_f( void )
|
||||||
{
|
{
|
||||||
const char *name;
|
const char *name;
|
||||||
resource_t custResource;
|
resource_t custResource;
|
||||||
@@ -989,7 +992,7 @@ We have gotten a challenge from the server, so try and
|
|||||||
connect.
|
connect.
|
||||||
======================
|
======================
|
||||||
*/
|
*/
|
||||||
void CL_SendConnectPacket( void )
|
static void CL_SendConnectPacket( void )
|
||||||
{
|
{
|
||||||
char protinfo[MAX_INFO_STRING];
|
char protinfo[MAX_INFO_STRING];
|
||||||
const char *qport;
|
const char *qport;
|
||||||
@@ -1068,6 +1071,22 @@ void CL_SendConnectPacket( void )
|
|||||||
cls.timestart = Sys_DoubleTime();
|
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
|
CL_CheckForResend
|
||||||
@@ -1075,12 +1094,13 @@ CL_CheckForResend
|
|||||||
Resend a connect message if the last one has timed out
|
Resend a connect message if the last one has timed out
|
||||||
=================
|
=================
|
||||||
*/
|
*/
|
||||||
void CL_CheckForResend( void )
|
static void CL_CheckForResend( void )
|
||||||
{
|
{
|
||||||
netadr_t adr;
|
netadr_t adr;
|
||||||
net_gai_state_t res;
|
net_gai_state_t res;
|
||||||
|
float resendTime;
|
||||||
qboolean bandwidthTest;
|
qboolean bandwidthTest;
|
||||||
|
|
||||||
if( cls.internetservers_wait )
|
if( cls.internetservers_wait )
|
||||||
CL_SendMasterServerScanRequest();
|
CL_SendMasterServerScanRequest();
|
||||||
|
|
||||||
@@ -1106,7 +1126,10 @@ void CL_CheckForResend( void )
|
|||||||
else if( cl_resend.value > CL_MAX_RESEND_TIME )
|
else if( cl_resend.value > CL_MAX_RESEND_TIME )
|
||||||
Cvar_SetValue( "cl_resend", 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;
|
return;
|
||||||
|
|
||||||
res = NET_StringToAdrNB( cls.servername, &adr );
|
res = NET_StringToAdrNB( cls.servername, &adr );
|
||||||
@@ -1133,10 +1156,11 @@ void CL_CheckForResend( void )
|
|||||||
|
|
||||||
if( adr.port == 0 ) adr.port = MSG_BigShort( PORT_SERVER );
|
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
|
// 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" );
|
Netchan_OutOfBandPrint( NS_CLIENT, adr, "getchallenge\n" );
|
||||||
Cvar_SetValue( "cl_dlmax", FRAGMENT_MIN_SIZE );
|
Cvar_SetValue( "cl_dlmax", FRAGMENT_MIN_SIZE );
|
||||||
cls.connect_time = host.realtime;
|
cls.connect_time = host.realtime;
|
||||||
@@ -1144,16 +1168,15 @@ void CL_CheckForResend( void )
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
bandwidthTest = !cls.legacymode && cl_test_bandwidth.value;
|
|
||||||
cls.serveradr = adr;
|
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_time = host.realtime; // for retransmit requests
|
||||||
cls.connect_retry++;
|
cls.connect_retry++;
|
||||||
|
|
||||||
if( bandwidthTest )
|
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
|
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 )
|
if( bandwidthTest )
|
||||||
Netchan_OutOfBandPrint( NS_CLIENT, adr, "bandwidth %i %i\n", PROTOCOL_VERSION, cls.max_fragment_size );
|
Netchan_OutOfBandPrint( NS_CLIENT, adr, "bandwidth %i %i\n", PROTOCOL_VERSION, cls.max_fragment_size );
|
||||||
@@ -1161,7 +1184,7 @@ void CL_CheckForResend( void )
|
|||||||
Netchan_OutOfBandPrint( NS_CLIENT, adr, "getchallenge\n" );
|
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];
|
resource_t *r = &cl.resourcelist[cl.num_resources];
|
||||||
|
|
||||||
@@ -1178,7 +1201,7 @@ resource_t *CL_AddResource( resourcetype_t type, const char *name, int size, qbo
|
|||||||
return r;
|
return r;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CL_CreateResourceList( void )
|
static void CL_CreateResourceList( void )
|
||||||
{
|
{
|
||||||
char szFileName[MAX_OSPATH];
|
char szFileName[MAX_OSPATH];
|
||||||
byte rgucMD5_hash[16];
|
byte rgucMD5_hash[16];
|
||||||
@@ -1226,7 +1249,7 @@ CL_Connect_f
|
|||||||
|
|
||||||
================
|
================
|
||||||
*/
|
*/
|
||||||
void CL_Connect_f( void )
|
static void CL_Connect_f( void )
|
||||||
{
|
{
|
||||||
string server;
|
string server;
|
||||||
qboolean legacyconnect = false;
|
qboolean legacyconnect = false;
|
||||||
@@ -1273,7 +1296,7 @@ Send the rest of the command line over as
|
|||||||
an unconnected command.
|
an unconnected command.
|
||||||
=====================
|
=====================
|
||||||
*/
|
*/
|
||||||
void CL_Rcon_f( void )
|
static void CL_Rcon_f( void )
|
||||||
{
|
{
|
||||||
char message[1024];
|
char message[1024];
|
||||||
netadr_t to;
|
netadr_t to;
|
||||||
@@ -1380,7 +1403,7 @@ CL_SendDisconnectMessage
|
|||||||
Sends a disconnect message to the server
|
Sends a disconnect message to the server
|
||||||
=====================
|
=====================
|
||||||
*/
|
*/
|
||||||
void CL_SendDisconnectMessage( void )
|
static void CL_SendDisconnectMessage( void )
|
||||||
{
|
{
|
||||||
sizebuf_t buf;
|
sizebuf_t buf;
|
||||||
byte data[32];
|
byte data[32];
|
||||||
@@ -1425,7 +1448,7 @@ CL_Reconnect
|
|||||||
build a request to reconnect client
|
build a request to reconnect client
|
||||||
=====================
|
=====================
|
||||||
*/
|
*/
|
||||||
void CL_Reconnect( qboolean setup_netchan )
|
static void CL_Reconnect( qboolean setup_netchan )
|
||||||
{
|
{
|
||||||
if( setup_netchan )
|
if( setup_netchan )
|
||||||
{
|
{
|
||||||
@@ -1552,7 +1575,7 @@ void CL_Crashed( void )
|
|||||||
CL_LocalServers_f
|
CL_LocalServers_f
|
||||||
=================
|
=================
|
||||||
*/
|
*/
|
||||||
void CL_LocalServers_f( void )
|
static void CL_LocalServers_f( void )
|
||||||
{
|
{
|
||||||
netadr_t adr;
|
netadr_t adr;
|
||||||
|
|
||||||
@@ -1621,7 +1644,7 @@ static void CL_SendMasterServerScanRequest( void )
|
|||||||
CL_InternetServers_f
|
CL_InternetServers_f
|
||||||
=================
|
=================
|
||||||
*/
|
*/
|
||||||
void CL_InternetServers_f( void )
|
static void CL_InternetServers_f( void )
|
||||||
{
|
{
|
||||||
qboolean nat = cl_nat.value != 0.0f;
|
qboolean nat = cl_nat.value != 0.0f;
|
||||||
uint32_t key;
|
uint32_t key;
|
||||||
@@ -1650,7 +1673,7 @@ CL_Reconnect_f
|
|||||||
The server is changing levels
|
The server is changing levels
|
||||||
=================
|
=================
|
||||||
*/
|
*/
|
||||||
void CL_Reconnect_f( void )
|
static void CL_Reconnect_f( void )
|
||||||
{
|
{
|
||||||
if( cls.state == ca_disconnected )
|
if( cls.state == ca_disconnected )
|
||||||
return;
|
return;
|
||||||
@@ -1687,7 +1710,7 @@ CL_FixupColorStringsForInfoString
|
|||||||
all the keys and values must be ends with ^7
|
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 hasPrefix = false;
|
||||||
qboolean endOfKeyVal = false;
|
qboolean endOfKeyVal = false;
|
||||||
@@ -1751,7 +1774,7 @@ CL_ParseStatusMessage
|
|||||||
Handle a reply from a info
|
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];
|
static char infostring[MAX_INFO_STRING+8];
|
||||||
char *s = MSG_ReadString( msg );
|
char *s = MSG_ReadString( msg );
|
||||||
@@ -1800,7 +1823,7 @@ CL_ParseNETInfoMessage
|
|||||||
Handle a reply from a netinfo
|
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;
|
net_request_t *nr;
|
||||||
static char infostring[MAX_INFO_STRING+8];
|
static char infostring[MAX_INFO_STRING+8];
|
||||||
@@ -1855,7 +1878,7 @@ CL_ProcessNetRequests
|
|||||||
check for timeouts
|
check for timeouts
|
||||||
=================
|
=================
|
||||||
*/
|
*/
|
||||||
void CL_ProcessNetRequests( void )
|
static void CL_ProcessNetRequests( void )
|
||||||
{
|
{
|
||||||
net_request_t *nr;
|
net_request_t *nr;
|
||||||
int i;
|
int i;
|
||||||
@@ -1937,7 +1960,7 @@ CL_ConnectionlessPacket
|
|||||||
Responses to broadcasts, etc
|
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;
|
char *args;
|
||||||
const char *c;
|
const char *c;
|
||||||
@@ -2190,9 +2213,20 @@ void CL_ConnectionlessPacket( netadr_t from, sizebuf_t *msg )
|
|||||||
// serverlist got from masterserver
|
// serverlist got from masterserver
|
||||||
while( MSG_GetNumBitsLeft( msg ) > 8 )
|
while( MSG_GetNumBitsLeft( msg ) > 8 )
|
||||||
{
|
{
|
||||||
MSG_ReadBytes( msg, servadr.ip, sizeof( servadr.ip )); // 4 bytes for IP
|
uint8_t addr[16];
|
||||||
|
|
||||||
|
if( from.type6 == NA_IP6 ) // IPv6 master server only sends IPv6 addresses
|
||||||
|
{
|
||||||
|
MSG_ReadBytes( msg, addr, sizeof( addr ));
|
||||||
|
NET_IP6BytesToNetadr( &servadr, addr );
|
||||||
|
servadr.type6 = NA_IP6;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
MSG_ReadBytes( msg, servadr.ip, sizeof( servadr.ip )); // 4 bytes for IP
|
||||||
|
servadr.type = NA_IP;
|
||||||
|
}
|
||||||
servadr.port = MSG_ReadShort( msg ); // 2 bytes for Port
|
servadr.port = MSG_ReadShort( msg ); // 2 bytes for Port
|
||||||
servadr.type = NA_IP;
|
|
||||||
|
|
||||||
// list is ends here
|
// list is ends here
|
||||||
if( !servadr.port )
|
if( !servadr.port )
|
||||||
@@ -2223,7 +2257,7 @@ CL_GetMessage
|
|||||||
Handles recording and playback of demos, on top of NET_ code
|
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 )
|
if( cls.demoplayback )
|
||||||
{
|
{
|
||||||
@@ -2242,7 +2276,7 @@ int CL_GetMessage( byte *data, size_t *length )
|
|||||||
CL_ReadNetMessage
|
CL_ReadNetMessage
|
||||||
=================
|
=================
|
||||||
*/
|
*/
|
||||||
void CL_ReadNetMessage( void )
|
static void CL_ReadNetMessage( void )
|
||||||
{
|
{
|
||||||
size_t curSize;
|
size_t curSize;
|
||||||
|
|
||||||
@@ -2326,7 +2360,7 @@ Updates the local time and reads/handles messages
|
|||||||
on client net connection.
|
on client net connection.
|
||||||
=================
|
=================
|
||||||
*/
|
*/
|
||||||
void CL_ReadPackets( void )
|
static void CL_ReadPackets( void )
|
||||||
{
|
{
|
||||||
// decide the simulation time
|
// decide the simulation time
|
||||||
cl.oldtime = cl.time;
|
cl.oldtime = cl.time;
|
||||||
@@ -2390,7 +2424,7 @@ CL_CleanFileName
|
|||||||
Replace the displayed name for some resources
|
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] == '!' )
|
if( COM_CheckString( filename ) && filename[0] == '!' )
|
||||||
return "customization";
|
return "customization";
|
||||||
@@ -2406,7 +2440,7 @@ CL_RegisterCustomization
|
|||||||
register custom resource for player
|
register custom resource for player
|
||||||
====================
|
====================
|
||||||
*/
|
*/
|
||||||
void CL_RegisterCustomization( resource_t *resource )
|
static void CL_RegisterCustomization( resource_t *resource )
|
||||||
{
|
{
|
||||||
qboolean bFound = false;
|
qboolean bFound = false;
|
||||||
customization_t *pList;
|
customization_t *pList;
|
||||||
@@ -2612,7 +2646,7 @@ void CL_ServerCommand( qboolean reliable, const char *fmt, ... )
|
|||||||
CL_SetInfo_f
|
CL_SetInfo_f
|
||||||
==============
|
==============
|
||||||
*/
|
*/
|
||||||
void CL_SetInfo_f( void )
|
static void CL_SetInfo_f( void )
|
||||||
{
|
{
|
||||||
convar_t *var;
|
convar_t *var;
|
||||||
|
|
||||||
@@ -2652,7 +2686,7 @@ void CL_SetInfo_f( void )
|
|||||||
CL_Physinfo_f
|
CL_Physinfo_f
|
||||||
==============
|
==============
|
||||||
*/
|
*/
|
||||||
void CL_Physinfo_f( void )
|
static void CL_Physinfo_f( void )
|
||||||
{
|
{
|
||||||
Con_Printf( "Phys info settings:\n" );
|
Con_Printf( "Phys info settings:\n" );
|
||||||
Info_Print( cls.physinfo );
|
Info_Print( cls.physinfo );
|
||||||
@@ -2807,7 +2841,7 @@ CL_FullServerinfo_f
|
|||||||
Sent by server when serverinfo changes
|
Sent by server when serverinfo changes
|
||||||
==================
|
==================
|
||||||
*/
|
*/
|
||||||
void CL_FullServerinfo_f( void )
|
static void CL_FullServerinfo_f( void )
|
||||||
{
|
{
|
||||||
if( Cmd_Argc() != 2 )
|
if( Cmd_Argc() != 2 )
|
||||||
{
|
{
|
||||||
@@ -2825,7 +2859,7 @@ CL_Escape_f
|
|||||||
Escape to menu from game
|
Escape to menu from game
|
||||||
=================
|
=================
|
||||||
*/
|
*/
|
||||||
void CL_Escape_f( void )
|
static void CL_Escape_f( void )
|
||||||
{
|
{
|
||||||
if( cls.key_dest == key_menu )
|
if( cls.key_dest == key_menu )
|
||||||
return;
|
return;
|
||||||
@@ -2843,7 +2877,7 @@ void CL_Escape_f( void )
|
|||||||
CL_InitLocal
|
CL_InitLocal
|
||||||
=================
|
=================
|
||||||
*/
|
*/
|
||||||
void CL_InitLocal( void )
|
static void CL_InitLocal( void )
|
||||||
{
|
{
|
||||||
cls.state = ca_disconnected;
|
cls.state = ca_disconnected;
|
||||||
cls.signon = 0;
|
cls.signon = 0;
|
||||||
@@ -2878,6 +2912,7 @@ void CL_InitLocal( void )
|
|||||||
|
|
||||||
Cvar_RegisterVariable( &rcon_address );
|
Cvar_RegisterVariable( &rcon_address );
|
||||||
|
|
||||||
|
Cvar_RegisterVariable( &cl_trace_stufftext );
|
||||||
Cvar_RegisterVariable( &cl_trace_messages );
|
Cvar_RegisterVariable( &cl_trace_messages );
|
||||||
Cvar_RegisterVariable( &cl_trace_events );
|
Cvar_RegisterVariable( &cl_trace_events );
|
||||||
|
|
||||||
@@ -2913,16 +2948,15 @@ void CL_InitLocal( void )
|
|||||||
Cvar_RegisterVariable( &cl_clockreset );
|
Cvar_RegisterVariable( &cl_clockreset );
|
||||||
Cvar_RegisterVariable( &cl_fixtimerate );
|
Cvar_RegisterVariable( &cl_fixtimerate );
|
||||||
Cvar_RegisterVariable( &hud_fontscale );
|
Cvar_RegisterVariable( &hud_fontscale );
|
||||||
|
Cvar_RegisterVariable( &hud_fontrender );
|
||||||
Cvar_RegisterVariable( &hud_scale );
|
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_Get( "cl_background", "0", FCVAR_READ_ONLY, "indicate what background map is running" );
|
||||||
Cvar_RegisterVariable( &cl_showevents );
|
Cvar_RegisterVariable( &cl_showevents );
|
||||||
Cvar_Get( "lastdemo", "", FCVAR_ARCHIVE, "last played demo" );
|
Cvar_Get( "lastdemo", "", FCVAR_ARCHIVE, "last played demo" );
|
||||||
Cvar_RegisterVariable( &ui_renderworld );
|
Cvar_RegisterVariable( &ui_renderworld );
|
||||||
Cvar_RegisterVariable( &cl_maxframetime );
|
Cvar_RegisterVariable( &cl_maxframetime );
|
||||||
|
Cvar_RegisterVariable( &cl_fixmodelinterpolationartifacts );
|
||||||
// these two added to shut up CS 1.5 about 'unknown' commands
|
|
||||||
Cvar_Get( "lightgamma", "1", FCVAR_ARCHIVE, "ambient lighting level (legacy, unused)" );
|
|
||||||
Cvar_Get( "direct", "1", FCVAR_ARCHIVE, "direct lighting level (legacy, unused)" );
|
|
||||||
|
|
||||||
// server commands
|
// server commands
|
||||||
Cmd_AddCommand ("noclip", NULL, "enable or disable no clipping mode" );
|
Cmd_AddCommand ("noclip", NULL, "enable or disable no clipping mode" );
|
||||||
@@ -2972,12 +3006,12 @@ void CL_InitLocal( void )
|
|||||||
Cmd_AddRestrictedCommand ("quit", CL_Quit_f, "quit from game" );
|
Cmd_AddRestrictedCommand ("quit", CL_Quit_f, "quit from game" );
|
||||||
Cmd_AddRestrictedCommand ("exit", 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 ("screenshot", CL_GenericShot_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 ("snapshot", CL_GenericShot_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 ("envshot", CL_GenericShot_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 ("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 ("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 ("connect", CL_Connect_f, "connect to a server by hostname" );
|
||||||
Cmd_AddCommand ("reconnect", CL_Reconnect_f, "reconnect to current level" );
|
Cmd_AddCommand ("reconnect", CL_Reconnect_f, "reconnect to current level" );
|
||||||
@@ -2996,7 +3030,7 @@ slowly adjuct client clock
|
|||||||
to smooth lag effect
|
to smooth lag effect
|
||||||
==================
|
==================
|
||||||
*/
|
*/
|
||||||
void CL_AdjustClock( void )
|
static void CL_AdjustClock( void )
|
||||||
{
|
{
|
||||||
if( cl.timedelta == 0.0f || !cl_fixtimerate.value )
|
if( cl.timedelta == 0.0f || !cl_fixtimerate.value )
|
||||||
return;
|
return;
|
||||||
@@ -3130,7 +3164,7 @@ void CL_Init( void )
|
|||||||
|
|
||||||
VID_Init(); // init video
|
VID_Init(); // init video
|
||||||
S_Init(); // init sound
|
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
|
// unreliable buffer. unsed for unreliable commands and voice stream
|
||||||
MSG_Init( &cls.datagram, "cls.datagram", cls.datagram_buf, sizeof( cls.datagram_buf ));
|
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
|
// move rolling average
|
||||||
framerate = FRAMERATE_AVG_FRAC * host.frametime + ( 1.0f - FRAMERATE_AVG_FRAC ) * framerate;
|
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 )
|
if( framerate > 0.0f )
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -21,7 +21,6 @@ GNU General Public License for more details.
|
|||||||
#include "shake.h"
|
#include "shake.h"
|
||||||
#include "hltv.h"
|
#include "hltv.h"
|
||||||
#include "input.h"
|
#include "input.h"
|
||||||
#include "server.h"
|
|
||||||
#if XASH_LOW_MEMORY != 2
|
#if XASH_LOW_MEMORY != 2
|
||||||
int CL_UPDATE_BACKUP = SINGLEPLAYER_BACKUP;
|
int CL_UPDATE_BACKUP = SINGLEPLAYER_BACKUP;
|
||||||
#endif
|
#endif
|
||||||
@@ -32,7 +31,7 @@ CL_UserMsgStub
|
|||||||
Default stub for missed callbacks
|
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;
|
return 1;
|
||||||
}
|
}
|
||||||
@@ -58,7 +57,7 @@ CL_ParseSoundPacket
|
|||||||
|
|
||||||
==================
|
==================
|
||||||
*/
|
*/
|
||||||
void CL_ParseSoundPacket( sizebuf_t *msg )
|
static void CL_ParseSoundPacket( sizebuf_t *msg )
|
||||||
{
|
{
|
||||||
vec3_t pos;
|
vec3_t pos;
|
||||||
int chan, sound;
|
int chan, sound;
|
||||||
@@ -305,7 +304,7 @@ CL_ParseStaticEntity
|
|||||||
static client entity
|
static client entity
|
||||||
==================
|
==================
|
||||||
*/
|
*/
|
||||||
void CL_ParseStaticEntity( sizebuf_t *msg )
|
static void CL_ParseStaticEntity( sizebuf_t *msg )
|
||||||
{
|
{
|
||||||
int i, newnum;
|
int i, newnum;
|
||||||
entity_state_t from, to;
|
entity_state_t from, to;
|
||||||
@@ -619,7 +618,7 @@ static void CL_StartResourceDownloading( const char *pszMessage, qboolean bCusto
|
|||||||
CL_BatchResourceRequest( !bCustom );
|
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;
|
customization_t *pList;
|
||||||
|
|
||||||
@@ -631,7 +630,7 @@ customization_t *CL_PlayerHasCustomization( int nPlayerNum, resourcetype_t type
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CL_RemoveCustomization( int nPlayerNum, customization_t *pRemove )
|
static void CL_RemoveCustomization( int nPlayerNum, customization_t *pRemove )
|
||||||
{
|
{
|
||||||
customization_t *pList;
|
customization_t *pList;
|
||||||
customization_t *pNext;
|
customization_t *pNext;
|
||||||
@@ -802,7 +801,7 @@ CL_CreateCustomizationList
|
|||||||
loading custom decal for self
|
loading custom decal for self
|
||||||
==================
|
==================
|
||||||
*/
|
*/
|
||||||
void CL_CreateCustomizationList( void )
|
static void CL_CreateCustomizationList( void )
|
||||||
{
|
{
|
||||||
resource_t *pResource;
|
resource_t *pResource;
|
||||||
player_info_t *pPlayer;
|
player_info_t *pPlayer;
|
||||||
@@ -903,11 +902,7 @@ void CL_ParseServerData( sizebuf_t *msg, qboolean legacy )
|
|||||||
Q_strncpy( clgame.maptitle, MSG_ReadString( msg ), sizeof( clgame.maptitle ));
|
Q_strncpy( clgame.maptitle, MSG_ReadString( msg ), sizeof( clgame.maptitle ));
|
||||||
background = MSG_ReadOneBit( msg );
|
background = MSG_ReadOneBit( msg );
|
||||||
Q_strncpy( gamefolder, MSG_ReadString( msg ), sizeof( gamefolder ));
|
Q_strncpy( gamefolder, MSG_ReadString( msg ), sizeof( gamefolder ));
|
||||||
host.features = (uint)MSG_ReadLong( msg );
|
Host_ValidateEngineFeatures( MSG_ReadDword( msg ));
|
||||||
host.features &= legacy ? ENGINE_LEGACY_FEATURES_MASK : ENGINE_FEATURES_MASK;
|
|
||||||
|
|
||||||
if( !Host_IsLocalGame( ))
|
|
||||||
Host_PrintEngineFeatures( host.features );
|
|
||||||
|
|
||||||
if( !legacy )
|
if( !legacy )
|
||||||
{
|
{
|
||||||
@@ -1387,9 +1382,13 @@ void CL_UpdateUserinfo( sizebuf_t *msg, qboolean legacy )
|
|||||||
if( slot >= MAX_CLIENTS )
|
if( slot >= MAX_CLIENTS )
|
||||||
Host_Error( "CL_ParseServerMessage: svc_updateuserinfo >= MAX_CLIENTS\n" );
|
Host_Error( "CL_ParseServerMessage: svc_updateuserinfo >= MAX_CLIENTS\n" );
|
||||||
|
|
||||||
|
player = &cl.players[slot];
|
||||||
|
|
||||||
if( !legacy )
|
if( !legacy )
|
||||||
id = MSG_ReadLong( msg ); // unique user ID
|
id = MSG_ReadLong( msg ); // unique user ID
|
||||||
player = &cl.players[slot];
|
else
|
||||||
|
id = 0; // bogus
|
||||||
|
|
||||||
active = MSG_ReadOneBit( msg ) ? true : false;
|
active = MSG_ReadOneBit( msg ) ? true : false;
|
||||||
|
|
||||||
if( active )
|
if( active )
|
||||||
@@ -1411,6 +1410,10 @@ void CL_UpdateUserinfo( sizebuf_t *msg, qboolean legacy )
|
|||||||
|
|
||||||
memset( player, 0, sizeof( *player ));
|
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;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -1498,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;
|
qboolean user_changed_diskfile;
|
||||||
vec3_t mins, maxs;
|
vec3_t mins, maxs;
|
||||||
@@ -1642,9 +1645,6 @@ void CL_RegisterResources( sizebuf_t *msg )
|
|||||||
|
|
||||||
CL_ClearWorld ();
|
CL_ClearWorld ();
|
||||||
|
|
||||||
// update the ref state.
|
|
||||||
R_UpdateRefState ();
|
|
||||||
|
|
||||||
// tell rendering system we have a new set of models.
|
// tell rendering system we have a new set of models.
|
||||||
ref.dllFuncs.R_NewMap ();
|
ref.dllFuncs.R_NewMap ();
|
||||||
|
|
||||||
@@ -1678,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 lastcheck;
|
||||||
int delta;
|
int delta;
|
||||||
@@ -1743,7 +1743,7 @@ CL_ParseResourceList
|
|||||||
|
|
||||||
==============
|
==============
|
||||||
*/
|
*/
|
||||||
void CL_ParseResourceList( sizebuf_t *msg )
|
static void CL_ParseResourceList( sizebuf_t *msg )
|
||||||
{
|
{
|
||||||
resource_t *pResource;
|
resource_t *pResource;
|
||||||
int i, total;
|
int i, total;
|
||||||
@@ -1780,12 +1780,12 @@ CL_ParseVoiceInit
|
|||||||
|
|
||||||
==================
|
==================
|
||||||
*/
|
*/
|
||||||
void CL_ParseVoiceInit( sizebuf_t *msg )
|
static void CL_ParseVoiceInit( sizebuf_t *msg )
|
||||||
{
|
{
|
||||||
char *pszCodec = MSG_ReadString( msg );
|
char *pszCodec = MSG_ReadString( msg );
|
||||||
int quality = MSG_ReadByte( msg );
|
int quality = MSG_ReadByte( msg );
|
||||||
|
|
||||||
Voice_Init( pszCodec, quality );
|
Voice_Init( pszCodec, quality, false ); // init requested codec and the device
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -1794,7 +1794,7 @@ CL_ParseVoiceData
|
|||||||
|
|
||||||
==================
|
==================
|
||||||
*/
|
*/
|
||||||
void CL_ParseVoiceData( sizebuf_t *msg )
|
static void CL_ParseVoiceData( sizebuf_t *msg )
|
||||||
{
|
{
|
||||||
int size, idx, frames;
|
int size, idx, frames;
|
||||||
byte received[8192];
|
byte received[8192];
|
||||||
@@ -1911,7 +1911,7 @@ CL_ParseScreenShake
|
|||||||
Set screen shake
|
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 amplitude = (float)(word)MSG_ReadShort( msg ) * ( 1.0f / (float)( 1 << 12 ));
|
||||||
float duration = (float)(word)MSG_ReadShort( msg ) * ( 1.0f / (float)( 1 << 12 ));
|
float duration = (float)(word)MSG_ReadShort( msg ) * ( 1.0f / (float)( 1 << 12 ));
|
||||||
@@ -1934,7 +1934,7 @@ CL_ParseScreenFade
|
|||||||
Set screen fade
|
Set screen fade
|
||||||
==============
|
==============
|
||||||
*/
|
*/
|
||||||
void CL_ParseScreenFade( sizebuf_t *msg )
|
static void CL_ParseScreenFade( sizebuf_t *msg )
|
||||||
{
|
{
|
||||||
float duration, holdTime;
|
float duration, holdTime;
|
||||||
screenfade_t *sf = &clgame.fade;
|
screenfade_t *sf = &clgame.fade;
|
||||||
@@ -2033,7 +2033,7 @@ CL_ParseExec
|
|||||||
Exec map/class specific configs
|
Exec map/class specific configs
|
||||||
==============
|
==============
|
||||||
*/
|
*/
|
||||||
void CL_ParseExec( sizebuf_t *msg )
|
static void CL_ParseExec( sizebuf_t *msg )
|
||||||
{
|
{
|
||||||
qboolean is_class;
|
qboolean is_class;
|
||||||
int class_idx;
|
int class_idx;
|
||||||
@@ -2329,11 +2329,18 @@ void CL_ParseServerMessage( sizebuf_t *msg, qboolean normal_message )
|
|||||||
break;
|
break;
|
||||||
case svc_stufftext:
|
case svc_stufftext:
|
||||||
s = MSG_ReadString( msg );
|
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
|
#ifdef HACKS_RELATED_HLMODS
|
||||||
// disable Cry Of Fear antisave protection
|
// disable Cry Of Fear antisave protection
|
||||||
if( !Q_strnicmp( s, "disconnect", 10 ) && cls.signon != SIGNONS )
|
if( !Q_strnicmp( s, "disconnect", 10 ) && cls.signon != SIGNONS )
|
||||||
break; // too early
|
break; // too early
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
Cbuf_AddFilteredText( s );
|
Cbuf_AddFilteredText( s );
|
||||||
break;
|
break;
|
||||||
case svc_setangle:
|
case svc_setangle:
|
||||||
|
|||||||
@@ -30,7 +30,7 @@ CL_ParseStaticEntity
|
|||||||
static client entity
|
static client entity
|
||||||
==================
|
==================
|
||||||
*/
|
*/
|
||||||
void CL_LegacyParseStaticEntity( sizebuf_t *msg )
|
static void CL_LegacyParseStaticEntity( sizebuf_t *msg )
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
entity_state_t state;
|
entity_state_t state;
|
||||||
@@ -98,7 +98,7 @@ void CL_LegacyParseStaticEntity( sizebuf_t *msg )
|
|||||||
R_AddEfrags( ent ); // add link
|
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;
|
vec3_t pos;
|
||||||
int chan, sound;
|
int chan, sound;
|
||||||
@@ -167,7 +167,7 @@ CL_PrecacheSound
|
|||||||
prceache sound from server
|
prceache sound from server
|
||||||
================
|
================
|
||||||
*/
|
*/
|
||||||
void CL_LegacyPrecacheSound( sizebuf_t *msg )
|
static void CL_LegacyPrecacheSound( sizebuf_t *msg )
|
||||||
{
|
{
|
||||||
int soundIndex;
|
int soundIndex;
|
||||||
|
|
||||||
@@ -184,7 +184,7 @@ void CL_LegacyPrecacheSound( sizebuf_t *msg )
|
|||||||
cl.sound_index[soundIndex] = S_RegisterSound( cl.sound_precache[soundIndex] );
|
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;
|
int modelIndex;
|
||||||
string model;
|
string model;
|
||||||
@@ -214,7 +214,7 @@ void CL_LegacyPrecacheModel( sizebuf_t *msg )
|
|||||||
cl.nummodels = Q_max( cl.nummodels, modelIndex );
|
cl.nummodels = Q_max( cl.nummodels, modelIndex );
|
||||||
}
|
}
|
||||||
|
|
||||||
void CL_LegacyPrecacheEvent( sizebuf_t *msg )
|
static void CL_LegacyPrecacheEvent( sizebuf_t *msg )
|
||||||
{
|
{
|
||||||
int eventIndex;
|
int eventIndex;
|
||||||
|
|
||||||
@@ -242,7 +242,7 @@ CL_ParseResourceList
|
|||||||
|
|
||||||
==============
|
==============
|
||||||
*/
|
*/
|
||||||
void CL_LegacyParseResourceList( sizebuf_t *msg )
|
static void CL_LegacyParseResourceList( sizebuf_t *msg )
|
||||||
{
|
{
|
||||||
int i = 0;
|
int i = 0;
|
||||||
static struct
|
static struct
|
||||||
@@ -443,13 +443,17 @@ void CL_ParseLegacyServerMessage( sizebuf_t *msg, qboolean normal_message )
|
|||||||
break;
|
break;
|
||||||
case svc_stufftext:
|
case svc_stufftext:
|
||||||
s = MSG_ReadString( msg );
|
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
|
#ifdef HACKS_RELATED_HLMODS
|
||||||
// disable Cry Of Fear antisave protection
|
// disable Cry Of Fear antisave protection
|
||||||
if( !Q_strnicmp( s, "disconnect", 10 ) && cls.signon != SIGNONS )
|
if( !Q_strnicmp( s, "disconnect", 10 ) && cls.signon != SIGNONS )
|
||||||
break; // too early
|
break; // too early
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
Con_Reportf( "Stufftext: %s", s );
|
|
||||||
Cbuf_AddFilteredText( s );
|
Cbuf_AddFilteredText( s );
|
||||||
break;
|
break;
|
||||||
case svc_setangle:
|
case svc_setangle:
|
||||||
@@ -660,9 +664,6 @@ void CL_LegacyPrecache_f( void )
|
|||||||
if( clgame.entities )
|
if( clgame.entities )
|
||||||
clgame.entities->model = cl.worldmodel;
|
clgame.entities->model = cl.worldmodel;
|
||||||
|
|
||||||
// update the ref state.
|
|
||||||
R_UpdateRefState ();
|
|
||||||
|
|
||||||
// tell rendering system we have a new set of models.
|
// tell rendering system we have a new set of models.
|
||||||
ref.dllFuncs.R_NewMap ();
|
ref.dllFuncs.R_NewMap ();
|
||||||
|
|
||||||
|
|||||||
@@ -54,31 +54,6 @@ void GAME_EXPORT CL_PopPMStates( void )
|
|||||||
clgame.pushed = false;
|
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
|
CL_IsPredicted
|
||||||
@@ -417,7 +392,7 @@ CL_AddLinksToPmove
|
|||||||
collect solid entities
|
collect solid entities
|
||||||
====================
|
====================
|
||||||
*/
|
*/
|
||||||
void CL_AddLinksToPmove( frame_t *frame )
|
static void CL_AddLinksToPmove( frame_t *frame )
|
||||||
{
|
{
|
||||||
entity_state_t *state;
|
entity_state_t *state;
|
||||||
model_t *model;
|
model_t *model;
|
||||||
@@ -687,11 +662,6 @@ cl_entity_t *CL_GetWaterEntity( const float *rgflPos )
|
|||||||
return CL_GetEntityByIndex( entnum );
|
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 )
|
static int GAME_EXPORT pfnTestPlayerPosition( float *pos, pmtrace_t *ptrace )
|
||||||
{
|
{
|
||||||
return PM_TestPlayerPosition( clgame.pmove, pos, ptrace, NULL );
|
return PM_TestPlayerPosition( clgame.pmove, pos, ptrace, NULL );
|
||||||
@@ -824,6 +794,16 @@ static void CL_SetupPMove( playermove_t *pmove, const local_state_t *from, const
|
|||||||
cd = &from->client;
|
cd = &from->client;
|
||||||
|
|
||||||
pmove->player_index = ps->number - 1;
|
pmove->player_index = ps->number - 1;
|
||||||
|
|
||||||
|
// 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
|
||||||
|
if( pmove->player_index < 0 )
|
||||||
|
pmove->player_index = bound( 0, cl.playernum, cl.maxclients - 1 );
|
||||||
|
|
||||||
pmove->multiplayer = (cl.maxclients > 1);
|
pmove->multiplayer = (cl.maxclients > 1);
|
||||||
pmove->runfuncs = runfuncs;
|
pmove->runfuncs = runfuncs;
|
||||||
pmove->time = time * 1000.0f;
|
pmove->time = time * 1000.0f;
|
||||||
@@ -876,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 );
|
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;
|
entity_state_t *ps;
|
||||||
clientdata_t *cd;
|
clientdata_t *cd;
|
||||||
@@ -929,7 +909,7 @@ CL_RunUsercmd
|
|||||||
Runs prediction code for user cmd
|
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;
|
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.
|
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;
|
int i, newnum, pack;
|
||||||
qboolean forcelink;
|
qboolean forcelink;
|
||||||
@@ -565,7 +565,7 @@ CL_ParseQuakeParticles
|
|||||||
|
|
||||||
==================
|
==================
|
||||||
*/
|
*/
|
||||||
void CL_ParseQuakeParticle( sizebuf_t *msg )
|
static void CL_ParseQuakeParticle( sizebuf_t *msg )
|
||||||
{
|
{
|
||||||
int count, color;
|
int count, color;
|
||||||
vec3_t org, dir;
|
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;
|
int sound_num;
|
||||||
float vol, attn;
|
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 ));
|
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 *text = cmd_buf;
|
||||||
char token[256];
|
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 )
|
if( fileindex < 0 || fileindex >= MAX_CUSTOM )
|
||||||
return 0;
|
return 0;
|
||||||
@@ -142,8 +142,6 @@ intptr_t CL_RenderGetParm( const int parm, const int arg, const qboolean checkRe
|
|||||||
return 1;
|
return 1;
|
||||||
#endif
|
#endif
|
||||||
return 0;
|
return 0;
|
||||||
case PARM_SKY_SPHERE:
|
|
||||||
return FBitSet( world.flags, FWORLD_SKYSPHERE ) && !FBitSet( world.flags, FWORLD_CUSTOM_SKYBOX );
|
|
||||||
case PARAM_GAMEPAUSED:
|
case PARAM_GAMEPAUSED:
|
||||||
return cl.paused;
|
return cl.paused;
|
||||||
case PARM_CLIENT_INGAME:
|
case PARM_CLIENT_INGAME:
|
||||||
@@ -187,28 +185,30 @@ intptr_t CL_RenderGetParm( const int parm, const int arg, const qboolean checkRe
|
|||||||
return CL_IsThirdPerson();
|
return CL_IsThirdPerson();
|
||||||
case PARM_QUAKE_COMPATIBLE:
|
case PARM_QUAKE_COMPATIBLE:
|
||||||
return Host_IsQuakeCompatible();
|
return Host_IsQuakeCompatible();
|
||||||
case PARM_PLAYER_INDEX:
|
|
||||||
return cl.playernum + 1;
|
|
||||||
case PARM_VIEWENT_INDEX:
|
|
||||||
return cl.viewentity;
|
|
||||||
case PARM_CONNSTATE:
|
case PARM_CONNSTATE:
|
||||||
return (int)cls.state;
|
return (int)cls.state;
|
||||||
case PARM_PLAYING_DEMO:
|
case PARM_PLAYING_DEMO:
|
||||||
return cls.demoplayback;
|
return cls.demoplayback;
|
||||||
case PARM_WATER_LEVEL:
|
case PARM_WATER_LEVEL:
|
||||||
return cl.local.waterlevel;
|
return cl.local.waterlevel;
|
||||||
case PARM_MAX_CLIENTS:
|
|
||||||
return cl.maxclients;
|
|
||||||
case PARM_LOCAL_HEALTH:
|
case PARM_LOCAL_HEALTH:
|
||||||
return cl.local.health;
|
return cl.local.health;
|
||||||
case PARM_LOCAL_GAME:
|
case PARM_LOCAL_GAME:
|
||||||
return Host_IsLocalGame();
|
return Host_IsLocalGame();
|
||||||
case PARM_NUMENTITIES:
|
case PARM_NUMENTITIES:
|
||||||
return pfnNumberOfEntities();
|
return pfnNumberOfEntities();
|
||||||
case PARM_NUMMODELS:
|
case PARM_GET_CLIENT_PTR:
|
||||||
return cl.nummodels;
|
return (intptr_t)&cl.time; // with the offset
|
||||||
case PARM_WORLD_VERSION:
|
case PARM_GET_HOST_PTR:
|
||||||
return world.version;
|
return (intptr_t)&host.realtime; // with the offset
|
||||||
|
case PARM_GET_WORLD_PTR:
|
||||||
|
return (intptr_t)&world;
|
||||||
|
case PARM_GET_MOVEVARS_PTR:
|
||||||
|
return (intptr_t)&clgame.movevars;
|
||||||
|
case PARM_GET_PALETTE_PTR:
|
||||||
|
return (intptr_t)&clgame.palette;
|
||||||
|
case PARM_GET_VIEWENT_PTR:
|
||||||
|
return (intptr_t)&clgame.viewent;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
|
|||||||
@@ -252,7 +252,7 @@ VID_WriteOverviewScript
|
|||||||
Create overview script file
|
Create overview script file
|
||||||
===============
|
===============
|
||||||
*/
|
*/
|
||||||
void VID_WriteOverviewScript( void )
|
static void VID_WriteOverviewScript( void )
|
||||||
{
|
{
|
||||||
ref_overview_t *ov = &clgame.overView;
|
ref_overview_t *ov = &clgame.overView;
|
||||||
string filename;
|
string filename;
|
||||||
@@ -288,10 +288,15 @@ void SCR_MakeScreenShot( void )
|
|||||||
qboolean iRet = false;
|
qboolean iRet = false;
|
||||||
int viewsize;
|
int viewsize;
|
||||||
|
|
||||||
|
if( cls.scrshot_action == scrshot_inactive )
|
||||||
|
return;
|
||||||
|
|
||||||
if( cls.envshot_viewsize > 0 )
|
if( cls.envshot_viewsize > 0 )
|
||||||
viewsize = cls.envshot_viewsize;
|
viewsize = cls.envshot_viewsize;
|
||||||
else viewsize = cl_envshot_size.value;
|
else viewsize = cl_envshot_size.value;
|
||||||
|
|
||||||
|
V_CheckGamma();
|
||||||
|
|
||||||
switch( cls.scrshot_action )
|
switch( cls.scrshot_action )
|
||||||
{
|
{
|
||||||
case scrshot_normal:
|
case scrshot_normal:
|
||||||
@@ -317,8 +322,6 @@ void SCR_MakeScreenShot( void )
|
|||||||
if( iRet )
|
if( iRet )
|
||||||
VID_WriteOverviewScript(); // store overview script too
|
VID_WriteOverviewScript(); // store overview script too
|
||||||
break;
|
break;
|
||||||
case scrshot_inactive:
|
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// report
|
// report
|
||||||
@@ -342,7 +345,7 @@ void SCR_MakeScreenShot( void )
|
|||||||
SCR_DrawPlaque
|
SCR_DrawPlaque
|
||||||
================
|
================
|
||||||
*/
|
*/
|
||||||
void SCR_DrawPlaque( void )
|
static void SCR_DrawPlaque( void )
|
||||||
{
|
{
|
||||||
if(( cl_allow_levelshots.value && !cls.changelevel ) || cl.background )
|
if(( cl_allow_levelshots.value && !cls.changelevel ) || cl.background )
|
||||||
{
|
{
|
||||||
@@ -413,7 +416,7 @@ void SCR_EndLoadingPlaque( void )
|
|||||||
SCR_AddDirtyPoint
|
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.x1 ) scr_dirty.x1 = x;
|
||||||
if( x > scr_dirty.x2 ) scr_dirty.x2 = x;
|
if( x > scr_dirty.x2 ) scr_dirty.x2 = x;
|
||||||
@@ -570,15 +573,15 @@ void SCR_LoadCreditsFont( void )
|
|||||||
"creditsfont_%s.fnt", Cvar_VariableString( "con_charset" )) > 0 )
|
"creditsfont_%s.fnt", Cvar_VariableString( "con_charset" )) > 0 )
|
||||||
{
|
{
|
||||||
if( FS_FileExists( charsetFnt, false ))
|
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 )
|
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 )
|
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
|
// copy font size for client.dll
|
||||||
if( success )
|
if( success )
|
||||||
@@ -600,7 +603,7 @@ SCR_InstallParticlePalette
|
|||||||
INTERNAL RESOURCE
|
INTERNAL RESOURCE
|
||||||
================
|
================
|
||||||
*/
|
*/
|
||||||
void SCR_InstallParticlePalette( void )
|
static void SCR_InstallParticlePalette( void )
|
||||||
{
|
{
|
||||||
rgbdata_t *pic;
|
rgbdata_t *pic;
|
||||||
int i;
|
int i;
|
||||||
@@ -646,21 +649,21 @@ void SCR_RegisterTextures( void )
|
|||||||
// register gfx.wad images
|
// register gfx.wad images
|
||||||
|
|
||||||
if( FS_FileExists( "gfx/paused.lmp", false ))
|
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 ))
|
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( FS_FileExists( "gfx/lambda.lmp", false ))
|
||||||
{
|
{
|
||||||
if( cl_allow_levelshots.value )
|
if( cl_allow_levelshots.value )
|
||||||
cls.loadingBar = ref.dllFuncs.GL_LoadTexture( "gfx/lambda.lmp", NULL, 0, TF_IMAGE|TF_LUMINANCE );
|
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 );
|
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 ))
|
else if( FS_FileExists( "gfx/loading.lmp", false ))
|
||||||
{
|
{
|
||||||
if( cl_allow_levelshots.value )
|
if( cl_allow_levelshots.value )
|
||||||
cls.loadingBar = ref.dllFuncs.GL_LoadTexture( "gfx/loading.lmp", NULL, 0, TF_IMAGE|TF_LUMINANCE );
|
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 );
|
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 );
|
cls.tileImage = ref.dllFuncs.GL_LoadTexture( "gfx/backtile.lmp", NULL, 0, TF_NOMIPMAP );
|
||||||
@@ -673,7 +676,7 @@ SCR_SizeUp_f
|
|||||||
Keybinding command
|
Keybinding command
|
||||||
=================
|
=================
|
||||||
*/
|
*/
|
||||||
void SCR_SizeUp_f( void )
|
static void SCR_SizeUp_f( void )
|
||||||
{
|
{
|
||||||
Cvar_SetValue( "viewsize", Q_min( scr_viewsize.value + 10, 120 ));
|
Cvar_SetValue( "viewsize", Q_min( scr_viewsize.value + 10, 120 ));
|
||||||
}
|
}
|
||||||
@@ -686,7 +689,7 @@ SCR_SizeDown_f
|
|||||||
Keybinding command
|
Keybinding command
|
||||||
=================
|
=================
|
||||||
*/
|
*/
|
||||||
void SCR_SizeDown_f( void )
|
static void SCR_SizeDown_f( void )
|
||||||
{
|
{
|
||||||
Cvar_SetValue( "viewsize", Q_max( scr_viewsize.value - 10, 30 ));
|
Cvar_SetValue( "viewsize", Q_max( scr_viewsize.value - 10, 30 ));
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -57,35 +57,7 @@ const char *cl_default_sprites[] =
|
|||||||
"sprites/shellchrome.spr",
|
"sprites/shellchrome.spr",
|
||||||
};
|
};
|
||||||
|
|
||||||
const char *cl_player_shell_sounds[] =
|
static void CL_PlayerDecal( int playerIndex, int textureIndex, int entityIndex, float *pos );
|
||||||
{
|
|
||||||
"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",
|
|
||||||
};
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
================
|
================
|
||||||
@@ -146,6 +118,7 @@ client resources not precached by server
|
|||||||
*/
|
*/
|
||||||
void CL_AddClientResources( void )
|
void CL_AddClientResources( void )
|
||||||
{
|
{
|
||||||
|
const char *snd;
|
||||||
char filepath[MAX_QPATH];
|
char filepath[MAX_QPATH];
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
@@ -161,37 +134,37 @@ void CL_AddClientResources( void )
|
|||||||
}
|
}
|
||||||
|
|
||||||
// then check sounds
|
// 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 ))
|
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 ))
|
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 ))
|
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
|
#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 ))
|
if( !FS_FileExists( filepath, false ))
|
||||||
CL_AddClientResource( cl_ricochet_sounds[i], t_sound );
|
CL_AddClientResource( snd, t_sound );
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
@@ -255,7 +228,7 @@ CL_PrepareTEnt
|
|||||||
set default values
|
set default values
|
||||||
==============
|
==============
|
||||||
*/
|
*/
|
||||||
void CL_PrepareTEnt( TEMPENTITY *pTemp, model_t *pmodel )
|
static void CL_PrepareTEnt( TEMPENTITY *pTemp, model_t *pmodel )
|
||||||
{
|
{
|
||||||
int frameCount = 0;
|
int frameCount = 0;
|
||||||
int modelIndex = 0;
|
int modelIndex = 0;
|
||||||
@@ -296,10 +269,10 @@ CL_TempEntPlaySound
|
|||||||
play collide sound
|
play collide sound
|
||||||
==============
|
==============
|
||||||
*/
|
*/
|
||||||
void CL_TempEntPlaySound( TEMPENTITY *pTemp, float damp )
|
static void CL_TempEntPlaySound( TEMPENTITY *pTemp, float damp )
|
||||||
{
|
{
|
||||||
float fvol;
|
float fvol;
|
||||||
char soundname[32];
|
const char *soundname = NULL;
|
||||||
qboolean isshellcasing = false;
|
qboolean isshellcasing = false;
|
||||||
int zvel;
|
int zvel;
|
||||||
|
|
||||||
@@ -310,36 +283,39 @@ void CL_TempEntPlaySound( TEMPENTITY *pTemp, float damp )
|
|||||||
switch( pTemp->hitSound )
|
switch( pTemp->hitSound )
|
||||||
{
|
{
|
||||||
case BOUNCE_GLASS:
|
case BOUNCE_GLASS:
|
||||||
Q_snprintf( soundname, sizeof( soundname ), "debris/glass%i.wav", COM_RandomLong( 1, 4 ));
|
soundname = SoundList_GetRandom( BounceGlass );
|
||||||
break;
|
break;
|
||||||
case BOUNCE_METAL:
|
case BOUNCE_METAL:
|
||||||
Q_snprintf( soundname, sizeof( soundname ), "debris/metal%i.wav", COM_RandomLong( 1, 6 ));
|
soundname = SoundList_GetRandom( BounceMetal );
|
||||||
break;
|
break;
|
||||||
case BOUNCE_FLESH:
|
case BOUNCE_FLESH:
|
||||||
Q_snprintf( soundname, sizeof( soundname ), "debris/flesh%i.wav", COM_RandomLong( 1, 7 ));
|
soundname = SoundList_GetRandom( BounceFlesh );
|
||||||
break;
|
break;
|
||||||
case BOUNCE_WOOD:
|
case BOUNCE_WOOD:
|
||||||
Q_snprintf( soundname, sizeof( soundname ), "debris/wood%i.wav", COM_RandomLong( 1, 4 ));
|
soundname = SoundList_GetRandom( BounceWood );
|
||||||
break;
|
break;
|
||||||
case BOUNCE_SHRAP:
|
case BOUNCE_SHRAP:
|
||||||
Q_strncpy( soundname, cl_ricochet_sounds[COM_RandomLong( 0, 4 )], sizeof( soundname ) );
|
soundname = SoundList_GetRandom( Ricochet );
|
||||||
break;
|
break;
|
||||||
case BOUNCE_SHOTSHELL:
|
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
|
isshellcasing = true; // shell casings have different playback parameters
|
||||||
fvol = 0.5f;
|
fvol = 0.5f;
|
||||||
break;
|
break;
|
||||||
case BOUNCE_SHELL:
|
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
|
isshellcasing = true; // shell casings have different playback parameters
|
||||||
break;
|
break;
|
||||||
case BOUNCE_CONCRETE:
|
case BOUNCE_CONCRETE:
|
||||||
Q_snprintf( soundname, sizeof( soundname ), "debris/concrete%i.wav", COM_RandomLong( 1, 3 ));
|
soundname = SoundList_GetRandom( BounceConcrete );
|
||||||
break;
|
break;
|
||||||
default: // null sound
|
default: // null sound
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if( !soundname )
|
||||||
|
return;
|
||||||
|
|
||||||
zvel = abs( pTemp->entity.baseline.origin[2] );
|
zvel = abs( pTemp->entity.baseline.origin[2] );
|
||||||
|
|
||||||
// only play one out of every n
|
// only play one out of every n
|
||||||
@@ -380,7 +356,7 @@ CL_TEntAddEntity
|
|||||||
add entity to renderlist
|
add entity to renderlist
|
||||||
==============
|
==============
|
||||||
*/
|
*/
|
||||||
int CL_TempEntAddEntity( cl_entity_t *pEntity )
|
static int CL_TempEntAddEntity( cl_entity_t *pEntity )
|
||||||
{
|
{
|
||||||
vec3_t mins, maxs;
|
vec3_t mins, maxs;
|
||||||
|
|
||||||
@@ -432,7 +408,7 @@ CL_TEntAddEntity
|
|||||||
free the first low priority tempent it finds.
|
free the first low priority tempent it finds.
|
||||||
==============
|
==============
|
||||||
*/
|
*/
|
||||||
qboolean CL_FreeLowPriorityTempEnt( void )
|
static qboolean CL_FreeLowPriorityTempEnt( void )
|
||||||
{
|
{
|
||||||
TEMPENTITY *pActive = cl_active_tents;
|
TEMPENTITY *pActive = cl_active_tents;
|
||||||
TEMPENTITY *pPrev = NULL;
|
TEMPENTITY *pPrev = NULL;
|
||||||
@@ -1489,7 +1465,7 @@ void GAME_EXPORT R_FunnelSprite( const vec3_t org, int modelIndex, int reverse )
|
|||||||
===============
|
===============
|
||||||
R_SparkEffect
|
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 )
|
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
|
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;
|
sound_t handle;
|
||||||
|
handle = S_RegisterSound( name );
|
||||||
handle = S_RegisterSound( cl_ricochet_sounds[sound] );
|
|
||||||
|
|
||||||
S_StartSound( pos, 0, CHAN_AUTO, handle, VOL_NORM, 1.0, 100, 0 );
|
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 )
|
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 ))
|
if( !FBitSet( flags, TE_EXPLFLAG_NOSOUND ))
|
||||||
{
|
{
|
||||||
hSound = S_RegisterSound( cl_explode_sounds[COM_RandomLong( 0, 2 )] );
|
const char *name = SoundList_GetRandom( Explode );
|
||||||
S_StartSound( pos, 0, CHAN_STATIC, hSound, VOL_NORM, 0.3f, PITCH_NORM, 0 );
|
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;
|
cl_entity_t *pEnt;
|
||||||
dlight_t *dl;
|
dlight_t *dl;
|
||||||
sound_t hSound;
|
sound_t hSound;
|
||||||
|
const char *name;
|
||||||
|
|
||||||
if( cls.legacymode )
|
if( cls.legacymode )
|
||||||
iSize = MSG_ReadByte( msg );
|
iSize = MSG_ReadByte( msg );
|
||||||
@@ -1966,8 +1954,11 @@ void CL_ParseTempEntity( sizebuf_t *msg )
|
|||||||
pos[2] = MSG_ReadCoord( &buf );
|
pos[2] = MSG_ReadCoord( &buf );
|
||||||
R_BlobExplosion( pos );
|
R_BlobExplosion( pos );
|
||||||
|
|
||||||
hSound = S_RegisterSound( cl_explode_sounds[0] );
|
if(( name = SoundList_Get( Explode, 0 )))
|
||||||
S_StartSound( pos, -1, CHAN_AUTO, hSound, VOL_NORM, 1.0f, PITCH_NORM, 0 );
|
{
|
||||||
|
hSound = S_RegisterSound( name );
|
||||||
|
S_StartSound( pos, -1, CHAN_AUTO, hSound, VOL_NORM, 1.0f, PITCH_NORM, 0 );
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case TE_SMOKE:
|
case TE_SMOKE:
|
||||||
pos[0] = MSG_ReadCoord( &buf );
|
pos[0] = MSG_ReadCoord( &buf );
|
||||||
@@ -2020,8 +2011,11 @@ void CL_ParseTempEntity( sizebuf_t *msg )
|
|||||||
dl->die = cl.time + 0.5;
|
dl->die = cl.time + 0.5;
|
||||||
dl->decay = 300;
|
dl->decay = 300;
|
||||||
|
|
||||||
hSound = S_RegisterSound( cl_explode_sounds[0] );
|
if(( name = SoundList_Get( Explode, 0 )))
|
||||||
S_StartSound( pos, -1, CHAN_AUTO, hSound, VOL_NORM, 0.6f, PITCH_NORM, 0 );
|
{
|
||||||
|
hSound = S_RegisterSound( name );
|
||||||
|
S_StartSound( pos, -1, CHAN_AUTO, hSound, VOL_NORM, 1.0f, PITCH_NORM, 0 );
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case TE_BSPDECAL:
|
case TE_BSPDECAL:
|
||||||
case TE_DECAL:
|
case TE_DECAL:
|
||||||
@@ -2249,8 +2243,8 @@ void CL_ParseTempEntity( sizebuf_t *msg )
|
|||||||
CL_DecalShoot( CL_DecalIndex( decalIndex ), entityIndex, 0, pos, 0 );
|
CL_DecalShoot( CL_DecalIndex( decalIndex ), entityIndex, 0, pos, 0 );
|
||||||
R_BulletImpactParticles( pos );
|
R_BulletImpactParticles( pos );
|
||||||
flags = COM_RandomLong( 0, 0x7fff );
|
flags = COM_RandomLong( 0, 0x7fff );
|
||||||
if( flags < 0x3fff )
|
if( flags < 0x3fff && ( count = SoundList_Count( Ricochet )))
|
||||||
R_RicochetSound_( pos, flags % 5 );
|
R_RicochetSoundByIndex( pos, flags % count );
|
||||||
break;
|
break;
|
||||||
case TE_SPRAY:
|
case TE_SPRAY:
|
||||||
case TE_SPRITE_SPRAY:
|
case TE_SPRITE_SPRAY:
|
||||||
@@ -2414,7 +2408,7 @@ LIGHT STYLE MANAGEMENT
|
|||||||
CL_ClearLightStyles
|
CL_ClearLightStyles
|
||||||
================
|
================
|
||||||
*/
|
*/
|
||||||
void CL_ClearLightStyles( void )
|
static void CL_ClearLightStyles( void )
|
||||||
{
|
{
|
||||||
memset( cl.lightstyles, 0, sizeof( cl.lightstyles ));
|
memset( cl.lightstyles, 0, sizeof( cl.lightstyles ));
|
||||||
}
|
}
|
||||||
@@ -2472,7 +2466,7 @@ dlight_t cl_elights[MAX_ELIGHTS];
|
|||||||
CL_ClearDlights
|
CL_ClearDlights
|
||||||
================
|
================
|
||||||
*/
|
*/
|
||||||
void CL_ClearDlights( void )
|
static void CL_ClearDlights( void )
|
||||||
{
|
{
|
||||||
memset( cl_dlights, 0, sizeof( cl_dlights ));
|
memset( cl_dlights, 0, sizeof( cl_dlights ));
|
||||||
memset( cl_elights, 0, sizeof( cl_elights ));
|
memset( cl_elights, 0, sizeof( cl_elights ));
|
||||||
@@ -2624,7 +2618,7 @@ CL_UpdateFlashlight
|
|||||||
update client flashlight
|
update client flashlight
|
||||||
================
|
================
|
||||||
*/
|
*/
|
||||||
void CL_UpdateFlashlight( cl_entity_t *ent )
|
static void CL_UpdateFlashlight( cl_entity_t *ent )
|
||||||
{
|
{
|
||||||
vec3_t forward, view_ofs;
|
vec3_t forward, view_ofs;
|
||||||
vec3_t vecSrc, vecEnd;
|
vec3_t vecSrc, vecEnd;
|
||||||
@@ -2684,6 +2678,41 @@ void CL_UpdateFlashlight( cl_entity_t *ent )
|
|||||||
dl->radius = 80;
|
dl->radius = 80;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void R_EntityDimlight( cl_entity_t *ent, int key )
|
||||||
|
{
|
||||||
|
dlight_t *dl = CL_AllocDlight( key );
|
||||||
|
|
||||||
|
VectorCopy( ent->origin, dl->origin );
|
||||||
|
dl->color.r = dl->color.g = dl->color.b = 100;
|
||||||
|
dl->radius = COM_RandomFloat( 200.0f, 231.0f );
|
||||||
|
dl->die = cl.time + 0.001;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void R_EntityLight( cl_entity_t *ent, int key )
|
||||||
|
{
|
||||||
|
dlight_t *dl = CL_AllocDlight( key );
|
||||||
|
|
||||||
|
VectorCopy( ent->origin, dl->origin );
|
||||||
|
dl->color.r = dl->color.g = dl->color.b = 100;
|
||||||
|
dl->radius = 200;
|
||||||
|
dl->die = cl.time + 0.001;
|
||||||
|
|
||||||
|
R_RocketFlare( ent->origin );
|
||||||
|
}
|
||||||
|
|
||||||
|
static void R_EntityBrightlight( cl_entity_t *ent, int key, int radius )
|
||||||
|
{
|
||||||
|
dlight_t *dl = CL_AllocDlight( key );
|
||||||
|
|
||||||
|
VectorCopy( ent->origin, dl->origin );
|
||||||
|
dl->origin[2] += 16.0f;
|
||||||
|
dl->color.r = dl->color.g = dl->color.b = 250;
|
||||||
|
if( !radius )
|
||||||
|
dl->radius = COM_RandomFloat( 400.0f, 431.0f );
|
||||||
|
else dl->radius = 400;
|
||||||
|
dl->die = cl.time + 0.001;
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
================
|
================
|
||||||
CL_AddEntityEffects
|
CL_AddEntityEffects
|
||||||
@@ -2693,50 +2722,41 @@ apply various effects to entity origin or attachment
|
|||||||
*/
|
*/
|
||||||
void CL_AddEntityEffects( cl_entity_t *ent )
|
void CL_AddEntityEffects( cl_entity_t *ent )
|
||||||
{
|
{
|
||||||
// yellow flies effect 'monster stuck in the wall'
|
// players have special set of effects, from CL_LinkPlayers
|
||||||
if( FBitSet( ent->curstate.effects, EF_BRIGHTFIELD ) && !RP_LOCALCLIENT( ent ))
|
if( ent->player && ent->index != cl.viewentity )
|
||||||
R_EntityParticles( ent );
|
|
||||||
|
|
||||||
if( FBitSet( ent->curstate.effects, EF_DIMLIGHT ))
|
|
||||||
{
|
{
|
||||||
if( ent->player && !Host_IsQuakeCompatible( ))
|
if( FBitSet( ent->curstate.effects, EF_BRIGHTLIGHT ))
|
||||||
{
|
R_EntityBrightlight( ent, ent->index /* 4 in GoldSrc */, 0 );
|
||||||
|
|
||||||
|
if( FBitSet( ent->curstate.effects, EF_DIMLIGHT ))
|
||||||
|
R_EntityDimlight( ent, ent->index /* 4 in GoldSrc */ );
|
||||||
|
}
|
||||||
|
else if( RP_LOCALCLIENT( ent ))
|
||||||
|
{
|
||||||
|
// from CL_PlayerFlashlight
|
||||||
|
if( FBitSet( ent->curstate.effects, EF_BRIGHTLIGHT ))
|
||||||
|
R_EntityBrightlight( ent, ent->index /* 1 in GoldSrc */, 400 );
|
||||||
|
else if( FBitSet( ent->curstate.effects, EF_DIMLIGHT ))
|
||||||
CL_UpdateFlashlight( ent );
|
CL_UpdateFlashlight( ent );
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
dlight_t *dl = CL_AllocDlight( ent->index );
|
|
||||||
dl->color.r = dl->color.g = dl->color.b = 100;
|
|
||||||
dl->radius = COM_RandomFloat( 200, 231 );
|
|
||||||
VectorCopy( ent->origin, dl->origin );
|
|
||||||
dl->die = cl.time + 0.001;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
else
|
||||||
if( FBitSet( ent->curstate.effects, EF_BRIGHTLIGHT ))
|
|
||||||
{
|
{
|
||||||
dlight_t *dl = CL_AllocDlight( ent->index );
|
// from CL_LinkPacketEntities
|
||||||
dl->color.r = dl->color.g = dl->color.b = 250;
|
if( FBitSet( ent->curstate.effects, EF_BRIGHTFIELD ))
|
||||||
if( ent->player ) dl->radius = 400; // don't flickering
|
R_EntityParticles( ent );
|
||||||
else dl->radius = COM_RandomFloat( 400, 431 );
|
|
||||||
VectorCopy( ent->origin, dl->origin );
|
|
||||||
dl->die = cl.time + 0.001;
|
|
||||||
dl->origin[2] += 16.0f;
|
|
||||||
}
|
|
||||||
|
|
||||||
// add light effect
|
if( FBitSet( ent->curstate.effects, EF_BRIGHTLIGHT ))
|
||||||
if( FBitSet( ent->curstate.effects, EF_LIGHT ))
|
R_EntityBrightlight( ent, ent->index, 0 );
|
||||||
{
|
|
||||||
dlight_t *dl = CL_AllocDlight( ent->index );
|
if( FBitSet( ent->curstate.effects, EF_DIMLIGHT ))
|
||||||
dl->color.r = dl->color.g = dl->color.b = 100;
|
R_EntityDimlight( ent, ent->index );
|
||||||
VectorCopy( ent->origin, dl->origin );
|
|
||||||
R_RocketFlare( ent->origin );
|
if( FBitSet( ent->curstate.effects, EF_LIGHT ))
|
||||||
dl->die = cl.time + 0.001;
|
R_EntityLight( ent, ent->curstate.number );
|
||||||
dl->radius = 200;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// studio models are handle muzzleflashes difference
|
// studio models are handle muzzleflashes difference
|
||||||
if( FBitSet( ent->curstate.effects, EF_MUZZLEFLASH ) && Mod_AliasExtradata( ent->model ))
|
if( FBitSet( ent->curstate.effects, EF_MUZZLEFLASH ) && ent->model && ent->model->type == mod_alias )
|
||||||
{
|
{
|
||||||
dlight_t *dl = CL_AllocDlight( ent->index );
|
dlight_t *dl = CL_AllocDlight( ent->index );
|
||||||
vec3_t fv;
|
vec3_t fv;
|
||||||
@@ -2765,15 +2785,11 @@ void CL_AddModelEffects( cl_entity_t *ent )
|
|||||||
vec3_t neworigin;
|
vec3_t neworigin;
|
||||||
vec3_t oldorigin;
|
vec3_t oldorigin;
|
||||||
|
|
||||||
if( !ent->model ) return;
|
if( !ent->model || ent->player )
|
||||||
|
return;
|
||||||
|
|
||||||
switch( ent->model->type )
|
if( ent->model->type != mod_alias && ent->model->type != mod_studio )
|
||||||
{
|
return;
|
||||||
case mod_alias:
|
|
||||||
case mod_studio:
|
|
||||||
break;
|
|
||||||
default: return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if( cls.demoplayback == DEMO_QUAKE1 )
|
if( cls.demoplayback == DEMO_QUAKE1 )
|
||||||
{
|
{
|
||||||
@@ -2793,19 +2809,15 @@ void CL_AddModelEffects( cl_entity_t *ent )
|
|||||||
|
|
||||||
if( FBitSet( ent->model->flags, STUDIO_GIB ))
|
if( FBitSet( ent->model->flags, STUDIO_GIB ))
|
||||||
R_RocketTrail( oldorigin, neworigin, 2 );
|
R_RocketTrail( oldorigin, neworigin, 2 );
|
||||||
|
else if( FBitSet( ent->model->flags, STUDIO_ZOMGIB ))
|
||||||
if( FBitSet( ent->model->flags, STUDIO_ZOMGIB ))
|
|
||||||
R_RocketTrail( oldorigin, neworigin, 4 );
|
R_RocketTrail( oldorigin, neworigin, 4 );
|
||||||
|
else if( FBitSet( ent->model->flags, STUDIO_TRACER ))
|
||||||
if( FBitSet( ent->model->flags, STUDIO_TRACER ))
|
|
||||||
R_RocketTrail( oldorigin, neworigin, 3 );
|
R_RocketTrail( oldorigin, neworigin, 3 );
|
||||||
|
else if( FBitSet( ent->model->flags, STUDIO_TRACER2 ))
|
||||||
if( FBitSet( ent->model->flags, STUDIO_TRACER2 ))
|
|
||||||
R_RocketTrail( oldorigin, neworigin, 5 );
|
R_RocketTrail( oldorigin, neworigin, 5 );
|
||||||
|
else if( FBitSet( ent->model->flags, STUDIO_ROCKET ))
|
||||||
if( FBitSet( ent->model->flags, STUDIO_ROCKET ))
|
|
||||||
{
|
{
|
||||||
dlight_t *dl = CL_AllocDlight( ent->index );
|
dlight_t *dl = CL_AllocDlight( ent->curstate.number );
|
||||||
|
|
||||||
dl->color.r = dl->color.g = dl->color.b = 200;
|
dl->color.r = dl->color.g = dl->color.b = 200;
|
||||||
VectorCopy( ent->origin, dl->origin );
|
VectorCopy( ent->origin, dl->origin );
|
||||||
@@ -2819,11 +2831,9 @@ void CL_AddModelEffects( cl_entity_t *ent )
|
|||||||
|
|
||||||
R_RocketTrail( oldorigin, neworigin, 0 );
|
R_RocketTrail( oldorigin, neworigin, 0 );
|
||||||
}
|
}
|
||||||
|
else if( FBitSet( ent->model->flags, STUDIO_GRENADE ))
|
||||||
if( FBitSet( ent->model->flags, STUDIO_GRENADE ))
|
|
||||||
R_RocketTrail( oldorigin, neworigin, 1 );
|
R_RocketTrail( oldorigin, neworigin, 1 );
|
||||||
|
else if( FBitSet( ent->model->flags, STUDIO_TRACER3 ))
|
||||||
if( FBitSet( ent->model->flags, STUDIO_TRACER3 ))
|
|
||||||
R_RocketTrail( oldorigin, neworigin, 6 );
|
R_RocketTrail( oldorigin, neworigin, 6 );
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2903,7 +2913,7 @@ CL_PlayerDecal
|
|||||||
spray custom colored decal (clan logo etc)
|
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;
|
int textureIndex = 0;
|
||||||
customization_t *pCust = NULL;
|
customization_t *pCust = NULL;
|
||||||
|
|||||||
@@ -81,7 +81,6 @@ void R_DebugParticle( const vec3_t pos, byte r, byte g, byte b );
|
|||||||
void R_RicochetSound( const vec3_t pos );
|
void R_RicochetSound( const vec3_t pos );
|
||||||
struct dlight_s *CL_AllocDlight( int key );
|
struct dlight_s *CL_AllocDlight( int key );
|
||||||
struct dlight_s *CL_AllocElight( int key );
|
struct dlight_s *CL_AllocElight( int key );
|
||||||
void CL_UpdateFlashlight( cl_entity_t *pEnt );
|
|
||||||
void CL_AddEntityEffects( cl_entity_t *ent );
|
void CL_AddEntityEffects( cl_entity_t *ent );
|
||||||
void CL_AddModelEffects( cl_entity_t *ent );
|
void CL_AddModelEffects( cl_entity_t *ent );
|
||||||
void CL_DecalShoot( int textureIndex, int entityIndex, int modelIndex, float *pos, int flags );
|
void CL_DecalShoot( int textureIndex, int entityIndex, int modelIndex, float *pos, int flags );
|
||||||
|
|||||||
@@ -68,7 +68,7 @@ qboolean SCR_NextMovie( void )
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void SCR_CreateStartupVids( void )
|
static void SCR_CreateStartupVids( void )
|
||||||
{
|
{
|
||||||
file_t *f;
|
file_t *f;
|
||||||
|
|
||||||
|
|||||||
@@ -29,7 +29,7 @@ V_CalcViewRect
|
|||||||
calc frame rectangle (Quake1 style)
|
calc frame rectangle (Quake1 style)
|
||||||
===============
|
===============
|
||||||
*/
|
*/
|
||||||
void V_CalcViewRect( void )
|
static void V_CalcViewRect( void )
|
||||||
{
|
{
|
||||||
qboolean full = false;
|
qboolean full = false;
|
||||||
int sb_lines;
|
int sb_lines;
|
||||||
@@ -88,7 +88,7 @@ void V_CalcViewRect( void )
|
|||||||
V_SetupViewModel
|
V_SetupViewModel
|
||||||
===============
|
===============
|
||||||
*/
|
*/
|
||||||
void V_SetupViewModel( void )
|
static void V_SetupViewModel( void )
|
||||||
{
|
{
|
||||||
cl_entity_t *view = &clgame.viewent;
|
cl_entity_t *view = &clgame.viewent;
|
||||||
player_info_t *info = &cl.players[cl.playernum];
|
player_info_t *info = &cl.players[cl.playernum];
|
||||||
@@ -118,7 +118,7 @@ void V_SetupViewModel( void )
|
|||||||
V_SetRefParams
|
V_SetRefParams
|
||||||
===============
|
===============
|
||||||
*/
|
*/
|
||||||
void V_SetRefParams( ref_params_t *fd )
|
static void V_SetRefParams( ref_params_t *fd )
|
||||||
{
|
{
|
||||||
memset( fd, 0, sizeof( ref_params_t ));
|
memset( fd, 0, sizeof( ref_params_t ));
|
||||||
|
|
||||||
@@ -182,7 +182,7 @@ V_MergeOverviewRefdef
|
|||||||
merge refdef with overview settings
|
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;
|
ref_overview_t *ov = &clgame.overView;
|
||||||
float aspect;
|
float aspect;
|
||||||
@@ -281,7 +281,7 @@ static void V_AdjustFov( float *fov_x, float *fov_y, float width, float height,
|
|||||||
V_GetRefParams
|
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
|
// part1: deniable updates
|
||||||
VectorCopy( fd->simvel, cl.simvel );
|
VectorCopy( fd->simvel, cl.simvel );
|
||||||
@@ -347,6 +347,8 @@ qboolean V_PreRender( void )
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
V_CheckGamma();
|
||||||
|
|
||||||
ref.dllFuncs.R_BeginFrame( !cl.paused && ( cls.state == ca_active ));
|
ref.dllFuncs.R_BeginFrame( !cl.paused && ( cls.state == ca_active ));
|
||||||
|
|
||||||
GL_UpdateSwapInterval( );
|
GL_UpdateSwapInterval( );
|
||||||
@@ -406,14 +408,14 @@ void V_RenderView( void )
|
|||||||
#define NODE_INTERVAL_X(x) (x * 16.0f)
|
#define NODE_INTERVAL_X(x) (x * 16.0f)
|
||||||
#define NODE_INTERVAL_Y(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;
|
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 ) );
|
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.Begin( TRI_LINES );
|
||||||
ref.dllFuncs.Vertex3f( x, y, 0 );
|
ref.dllFuncs.Vertex3f( x, y, 0 );
|
||||||
@@ -421,7 +423,7 @@ void R_DrawNodeConnection( float x, float y, float x2, float y2 )
|
|||||||
ref.dllFuncs.End( );
|
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;
|
float downScale = scale * 0.8f;
|
||||||
|
|
||||||
@@ -468,7 +470,7 @@ void R_ShowTree_r( mnode_t *node, float x, float y, float scale, int shownodes,
|
|||||||
world.recursion_level--;
|
world.recursion_level--;
|
||||||
}
|
}
|
||||||
|
|
||||||
void R_ShowTree( void )
|
static void R_ShowTree( void )
|
||||||
{
|
{
|
||||||
float x = (float)((refState.width - (int)POINT_SIZE) >> 1);
|
float x = (float)((refState.width - (int)POINT_SIZE) >> 1);
|
||||||
float y = NODE_INTERVAL_Y(1.0f);
|
float y = NODE_INTERVAL_Y(1.0f);
|
||||||
@@ -551,4 +553,6 @@ void V_PostRender( void )
|
|||||||
ref.dllFuncs.R_AllowFog( true );
|
ref.dllFuncs.R_AllowFog( true );
|
||||||
Platform_SetTimer( 0.0f );
|
Platform_SetTimer( 0.0f );
|
||||||
ref.dllFuncs.R_EndFrame();
|
ref.dllFuncs.R_EndFrame();
|
||||||
|
|
||||||
|
V_CheckGammaEnd();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -174,6 +174,26 @@ typedef struct
|
|||||||
// at every server map change
|
// at every server map change
|
||||||
typedef struct
|
typedef struct
|
||||||
{
|
{
|
||||||
|
// ==== shared through RefAPI's ref_client_t ====
|
||||||
|
double time; // this is the time value that the client
|
||||||
|
// is rendering at. always <= cls.realtime
|
||||||
|
// a lerp point for other data
|
||||||
|
double oldtime; // previous cl.time, time-oldtime is used
|
||||||
|
// to decay light values and smooth step ups
|
||||||
|
int viewentity;
|
||||||
|
|
||||||
|
// server state information
|
||||||
|
int playernum;
|
||||||
|
int maxclients;
|
||||||
|
|
||||||
|
int nummodels;
|
||||||
|
model_t *models[MAX_MODELS+1]; // precached models (plus sentinel slot)
|
||||||
|
|
||||||
|
qboolean paused;
|
||||||
|
|
||||||
|
vec3_t simorg; // predicted origin
|
||||||
|
// ==== shared through RefAPI's ref_client_t ===
|
||||||
|
|
||||||
int servercount; // server identification for prespawns
|
int servercount; // server identification for prespawns
|
||||||
int validsequence; // this is the sequence number of the last good
|
int validsequence; // this is the sequence number of the last good
|
||||||
// world snapshot/update we got. If this is 0, we can't
|
// world snapshot/update we got. If this is 0, we can't
|
||||||
@@ -183,7 +203,6 @@ typedef struct
|
|||||||
|
|
||||||
qboolean video_prepped; // false if on new level or new ref dll
|
qboolean video_prepped; // false if on new level or new ref dll
|
||||||
qboolean audio_prepped; // false if on new level or new snd dll
|
qboolean audio_prepped; // false if on new level or new snd dll
|
||||||
qboolean paused;
|
|
||||||
|
|
||||||
int delta_sequence; // acknowledged sequence number
|
int delta_sequence; // acknowledged sequence number
|
||||||
|
|
||||||
@@ -205,11 +224,6 @@ typedef struct
|
|||||||
runcmd_t commands[MULTIPLAYER_BACKUP]; // each mesage will send several old cmds
|
runcmd_t commands[MULTIPLAYER_BACKUP]; // each mesage will send several old cmds
|
||||||
local_state_t predicted_frames[MULTIPLAYER_BACKUP]; // local client state
|
local_state_t predicted_frames[MULTIPLAYER_BACKUP]; // local client state
|
||||||
|
|
||||||
double time; // this is the time value that the client
|
|
||||||
// is rendering at. always <= cls.realtime
|
|
||||||
// a lerp point for other data
|
|
||||||
double oldtime; // previous cl.time, time-oldtime is used
|
|
||||||
// to decay light values and smooth step ups
|
|
||||||
double timedelta; // floating delta between two updates
|
double timedelta; // floating delta between two updates
|
||||||
|
|
||||||
char serverinfo[MAX_SERVERINFO_STRING];
|
char serverinfo[MAX_SERVERINFO_STRING];
|
||||||
@@ -223,7 +237,6 @@ typedef struct
|
|||||||
|
|
||||||
// player final info
|
// player final info
|
||||||
usercmd_t *cmd; // cl.commands[outgoing_sequence].cmd
|
usercmd_t *cmd; // cl.commands[outgoing_sequence].cmd
|
||||||
int viewentity;
|
|
||||||
vec3_t viewangles;
|
vec3_t viewangles;
|
||||||
vec3_t viewheight;
|
vec3_t viewheight;
|
||||||
vec3_t punchangle;
|
vec3_t punchangle;
|
||||||
@@ -236,14 +249,9 @@ typedef struct
|
|||||||
float addangletotal;
|
float addangletotal;
|
||||||
float prevaddangletotal;
|
float prevaddangletotal;
|
||||||
|
|
||||||
// predicted origin and velocity
|
// predicted velocity
|
||||||
vec3_t simorg;
|
|
||||||
vec3_t simvel;
|
vec3_t simvel;
|
||||||
|
|
||||||
// server state information
|
|
||||||
int playernum;
|
|
||||||
int maxclients;
|
|
||||||
|
|
||||||
entity_state_t instanced_baseline[MAX_CUSTOM_BASELINES];
|
entity_state_t instanced_baseline[MAX_CUSTOM_BASELINES];
|
||||||
int instanced_baseline_count;
|
int instanced_baseline_count;
|
||||||
|
|
||||||
@@ -251,8 +259,6 @@ typedef struct
|
|||||||
char event_precache[MAX_EVENTS][MAX_QPATH];
|
char event_precache[MAX_EVENTS][MAX_QPATH];
|
||||||
char files_precache[MAX_CUSTOM][MAX_QPATH];
|
char files_precache[MAX_CUSTOM][MAX_QPATH];
|
||||||
lightstyle_t lightstyles[MAX_LIGHTSTYLES];
|
lightstyle_t lightstyles[MAX_LIGHTSTYLES];
|
||||||
model_t *models[MAX_MODELS+1]; // precached models (plus sentinel slot)
|
|
||||||
int nummodels;
|
|
||||||
int numfiles;
|
int numfiles;
|
||||||
|
|
||||||
consistency_t consistency_list[MAX_MODELS];
|
consistency_t consistency_list[MAX_MODELS];
|
||||||
@@ -336,8 +342,7 @@ typedef struct
|
|||||||
byte charWidths[256]; // scaled widths
|
byte charWidths[256]; // scaled widths
|
||||||
int charHeight; // scaled height
|
int charHeight; // scaled height
|
||||||
int type; // fixed width font or variable
|
int type; // fixed width font or variable
|
||||||
int rendermode; // default rendermode
|
convar_t *rendermode; // user-defined default rendermode
|
||||||
qboolean nearest; // nearest filtering enabled
|
|
||||||
qboolean valid; // all rectangles are valid
|
qboolean valid; // all rectangles are valid
|
||||||
} cl_font_t;
|
} cl_font_t;
|
||||||
|
|
||||||
@@ -676,11 +681,14 @@ extern convar_t cl_draw_beams;
|
|||||||
extern convar_t cl_clockreset;
|
extern convar_t cl_clockreset;
|
||||||
extern convar_t cl_fixtimerate;
|
extern convar_t cl_fixtimerate;
|
||||||
extern convar_t hud_fontscale;
|
extern convar_t hud_fontscale;
|
||||||
|
extern convar_t hud_fontrender;
|
||||||
extern convar_t hud_scale;
|
extern convar_t hud_scale;
|
||||||
|
extern convar_t hud_scale_minimal_width;
|
||||||
extern convar_t r_showtextures;
|
extern convar_t r_showtextures;
|
||||||
extern convar_t cl_bmodelinterp;
|
extern convar_t cl_bmodelinterp;
|
||||||
extern convar_t cl_lw; // local weapons
|
extern convar_t cl_lw; // local weapons
|
||||||
extern convar_t cl_charset;
|
extern convar_t cl_charset;
|
||||||
|
extern convar_t cl_trace_stufftext;
|
||||||
extern convar_t cl_trace_messages;
|
extern convar_t cl_trace_messages;
|
||||||
extern convar_t cl_trace_events;
|
extern convar_t cl_trace_events;
|
||||||
extern convar_t hud_utf8;
|
extern convar_t hud_utf8;
|
||||||
@@ -694,11 +702,11 @@ extern convar_t rate;
|
|||||||
extern convar_t m_ignore;
|
extern convar_t m_ignore;
|
||||||
extern convar_t r_showtree;
|
extern convar_t r_showtree;
|
||||||
extern convar_t ui_renderworld;
|
extern convar_t ui_renderworld;
|
||||||
|
extern convar_t cl_fixmodelinterpolationartifacts;
|
||||||
|
|
||||||
//=============================================================================
|
//=============================================================================
|
||||||
|
|
||||||
void CL_SetLightstyle( int style, const char* s, float f );
|
void CL_SetLightstyle( int style, const char* s, float f );
|
||||||
void CL_RunLightStyles( void );
|
|
||||||
void CL_DecayLights( void );
|
void CL_DecayLights( void );
|
||||||
dlight_t *CL_GetDynamicLight( int number );
|
dlight_t *CL_GetDynamicLight( int number );
|
||||||
dlight_t *CL_GetEntityLight( int number );
|
dlight_t *CL_GetEntityLight( int number );
|
||||||
@@ -709,12 +717,8 @@ dlight_t *CL_GetEntityLight( int number );
|
|||||||
// cl_cmds.c
|
// cl_cmds.c
|
||||||
//
|
//
|
||||||
void CL_Quit_f( void );
|
void CL_Quit_f( void );
|
||||||
void CL_ScreenShot_f( void );
|
void CL_GenericShot_f( void );
|
||||||
void CL_SnapShot_f( void );
|
|
||||||
void CL_PlayCDTrack_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_LevelShot_f( void );
|
||||||
void CL_SetSky_f( void );
|
void CL_SetSky_f( void );
|
||||||
void SCR_Viewpos_f( void );
|
void SCR_Viewpos_f( void );
|
||||||
@@ -735,8 +739,6 @@ void CL_ClearResourceLists( void );
|
|||||||
void CL_Parse_Debug( qboolean enable );
|
void CL_Parse_Debug( qboolean enable );
|
||||||
void CL_Parse_RecordCommand( int cmd, int startoffset );
|
void CL_Parse_RecordCommand( int cmd, int startoffset );
|
||||||
void CL_ResetFrame( frame_t *frame );
|
void CL_ResetFrame( frame_t *frame );
|
||||||
void CL_WriteMessageHistory( void );
|
|
||||||
const char *CL_MsgInfo( int cmd );
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// cl_efx.c
|
// cl_efx.c
|
||||||
@@ -747,7 +749,6 @@ void CL_Particle( const vec3_t org, int color, float life, int zpos, int zvel );
|
|||||||
// cl_main.c
|
// cl_main.c
|
||||||
//
|
//
|
||||||
void CL_Init( void );
|
void CL_Init( void );
|
||||||
void CL_SendCommand( void );
|
|
||||||
void CL_Disconnect_f( void );
|
void CL_Disconnect_f( void );
|
||||||
void CL_ProcessFile( qboolean successfully_received, const char *filename );
|
void CL_ProcessFile( qboolean successfully_received, const char *filename );
|
||||||
void CL_WriteUsercmd( sizebuf_t *msg, int from, int to );
|
void CL_WriteUsercmd( sizebuf_t *msg, int from, int to );
|
||||||
@@ -756,7 +757,6 @@ qboolean CL_PrecacheResources( void );
|
|||||||
void CL_SetupOverviewParams( void );
|
void CL_SetupOverviewParams( void );
|
||||||
void CL_UpdateFrameLerp( void );
|
void CL_UpdateFrameLerp( void );
|
||||||
int CL_IsDevOverviewMode( void );
|
int CL_IsDevOverviewMode( void );
|
||||||
void CL_PingServers_f( void );
|
|
||||||
void CL_SignonReply( void );
|
void CL_SignonReply( void );
|
||||||
void CL_ClearState( void );
|
void CL_ClearState( void );
|
||||||
|
|
||||||
@@ -774,8 +774,6 @@ void CL_CheckStartupDemos( void );
|
|||||||
void CL_WriteDemoJumpTime( void );
|
void CL_WriteDemoJumpTime( void );
|
||||||
void CL_CloseDemoHeader( void );
|
void CL_CloseDemoHeader( void );
|
||||||
void CL_DemoCompleted( void );
|
void CL_DemoCompleted( void );
|
||||||
void CL_StopPlayback( void );
|
|
||||||
void CL_StopRecord( void );
|
|
||||||
void CL_PlayDemo_f( void );
|
void CL_PlayDemo_f( void );
|
||||||
void CL_TimeDemo_f( void );
|
void CL_TimeDemo_f( void );
|
||||||
void CL_StartDemos_f( void );
|
void CL_StartDemos_f( void );
|
||||||
@@ -783,6 +781,7 @@ void CL_Demos_f( void );
|
|||||||
void CL_DeleteDemo_f( void );
|
void CL_DeleteDemo_f( void );
|
||||||
void CL_Record_f( void );
|
void CL_Record_f( void );
|
||||||
void CL_Stop_f( void );
|
void CL_Stop_f( void );
|
||||||
|
int CL_GetDemoComment( const char *demoname, char *comment );
|
||||||
|
|
||||||
//
|
//
|
||||||
// cl_events.c
|
// cl_events.c
|
||||||
@@ -790,12 +789,9 @@ void CL_Stop_f( void );
|
|||||||
void CL_ParseEvent( sizebuf_t *msg );
|
void CL_ParseEvent( sizebuf_t *msg );
|
||||||
void CL_ParseReliableEvent( sizebuf_t *msg );
|
void CL_ParseReliableEvent( sizebuf_t *msg );
|
||||||
void CL_SetEventIndex( const char *szEvName, int ev_index );
|
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,
|
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 );
|
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_RegisterEvent( int lastnum, const char *szEvName, pfnEventHook func );
|
||||||
void CL_BatchResourceRequest( qboolean initialize );
|
|
||||||
int CL_EstimateNeededResources( void );
|
|
||||||
void CL_ResetEvent( event_info_t *ei );
|
void CL_ResetEvent( event_info_t *ei );
|
||||||
word CL_EventIndex( const char *name );
|
word CL_EventIndex( const char *name );
|
||||||
void CL_FireEvents( void );
|
void CL_FireEvents( void );
|
||||||
@@ -804,9 +800,10 @@ void CL_FireEvents( void );
|
|||||||
// cl_font.c
|
// cl_font.c
|
||||||
//
|
//
|
||||||
qboolean CL_FixedFont( cl_font_t *font );
|
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_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, int 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_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_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 );
|
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 );
|
void CL_DrawCharacterLen( cl_font_t *font, int number, int *width, int *height );
|
||||||
@@ -819,10 +816,7 @@ int CL_DrawStringf( cl_font_t *font, float x, float y, rgba_t color, int flags,
|
|||||||
//
|
//
|
||||||
void CL_UnloadProgs( void );
|
void CL_UnloadProgs( void );
|
||||||
qboolean CL_LoadProgs( const char *name );
|
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_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_DrawHUD( int state );
|
||||||
void CL_InitEdicts( int maxclients );
|
void CL_InitEdicts( int maxclients );
|
||||||
void CL_FreeEdicts( void );
|
void CL_FreeEdicts( void );
|
||||||
@@ -839,20 +833,17 @@ model_t *CL_LoadClientSprite( const char *filename );
|
|||||||
model_t *CL_LoadModel( const char *modelname, int *index );
|
model_t *CL_LoadModel( const char *modelname, int *index );
|
||||||
HSPRITE pfnSPR_LoadExt( const char *szPicName, uint texFlags );
|
HSPRITE pfnSPR_LoadExt( const char *szPicName, uint texFlags );
|
||||||
void SPR_AdjustSize( float *x, float *y, float *w, float *h );
|
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 );
|
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 );
|
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 );
|
const char *PM_CL_TraceTexture( int ground, float *vstart, float *vend );
|
||||||
int PM_CL_PointContents( const float *p, int *truecontents );
|
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 );
|
physent_t *pfnGetPhysent( int idx );
|
||||||
struct msurface_s *pfnTraceSurface( int ground, float *vstart, float *vend );
|
struct msurface_s *pfnTraceSurface( int ground, float *vstart, float *vend );
|
||||||
movevars_t *pfnGetMoveVars( void );
|
movevars_t *pfnGetMoveVars( void );
|
||||||
void CL_EnableScissor( scissor_state_t *scissor, int x, int y, int width, int height );
|
void CL_EnableScissor( scissor_state_t *scissor, int x, int y, int width, int height );
|
||||||
void CL_DisableScissor( scissor_state_t *scissor );
|
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 );
|
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 )
|
_inline cl_entity_t *CL_EDICT_NUM( int n )
|
||||||
{
|
{
|
||||||
@@ -904,6 +895,11 @@ qboolean CL_RequestMissingResources( void );
|
|||||||
void CL_RegisterResources ( sizebuf_t *msg );
|
void CL_RegisterResources ( sizebuf_t *msg );
|
||||||
void CL_ParseViewEntity( sizebuf_t *msg );
|
void CL_ParseViewEntity( sizebuf_t *msg );
|
||||||
void CL_ParseServerTime( 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
|
// cl_parse_48.c
|
||||||
@@ -917,8 +913,6 @@ void CL_LegacyPrecache_f( void );
|
|||||||
void SCR_VidInit( void );
|
void SCR_VidInit( void );
|
||||||
void SCR_TileClear( void );
|
void SCR_TileClear( void );
|
||||||
void SCR_DirtyScreen( void );
|
void SCR_DirtyScreen( void );
|
||||||
void SCR_AddDirtyPoint( int x, int y );
|
|
||||||
void SCR_InstallParticlePalette( void );
|
|
||||||
void SCR_EndLoadingPlaque( void );
|
void SCR_EndLoadingPlaque( void );
|
||||||
void SCR_RegisterTextures( void );
|
void SCR_RegisterTextures( void );
|
||||||
void SCR_LoadCreditsFont( void );
|
void SCR_LoadCreditsFont( void );
|
||||||
@@ -954,20 +948,17 @@ void CL_InitClientMove( void );
|
|||||||
void CL_PredictMovement( qboolean repredicting );
|
void CL_PredictMovement( qboolean repredicting );
|
||||||
void CL_CheckPredictionError( void );
|
void CL_CheckPredictionError( void );
|
||||||
qboolean CL_IsPredicted( void );
|
qboolean CL_IsPredicted( void );
|
||||||
int CL_TruePointContents( const vec3_t p );
|
|
||||||
int CL_WaterEntity( const float *rgflPos );
|
int CL_WaterEntity( const float *rgflPos );
|
||||||
cl_entity_t *CL_GetWaterEntity( 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_VisTraceLine( vec3_t start, vec3_t end, int flags );
|
||||||
pmtrace_t CL_TraceLine( 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_MoveSpectatorCamera( void );
|
||||||
void CL_SetLastUpdate( void );
|
void CL_SetLastUpdate( void );
|
||||||
void CL_RedoPrediction( void );
|
void CL_RedoPrediction( void );
|
||||||
void CL_PushPMStates( void );
|
void CL_PushPMStates( void );
|
||||||
void CL_PopPMStates( void );
|
void CL_PopPMStates( void );
|
||||||
void CL_SetUpPlayerPrediction( int dopred, int bIncludeLocalClient );
|
void CL_SetUpPlayerPrediction( int dopred, int bIncludeLocalClient );
|
||||||
|
void CL_SetIdealPitch( void );
|
||||||
|
|
||||||
//
|
//
|
||||||
// cl_qparse.c
|
// cl_qparse.c
|
||||||
@@ -984,12 +975,10 @@ qboolean CL_AddVisibleEntity( cl_entity_t *ent, int entityType );
|
|||||||
void CL_ResetLatchedVars( cl_entity_t *ent, qboolean full_reset );
|
void CL_ResetLatchedVars( cl_entity_t *ent, qboolean full_reset );
|
||||||
qboolean CL_GetEntitySpatialization( struct channel_s *ch );
|
qboolean CL_GetEntitySpatialization( struct channel_s *ch );
|
||||||
qboolean CL_GetMovieSpatialization( struct rawchan_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_ComputePlayerOrigin( cl_entity_t *clent );
|
||||||
void CL_ProcessPacket( frame_t *frame );
|
void CL_ProcessPacket( frame_t *frame );
|
||||||
void CL_MoveThirdpersonCamera( void );
|
void CL_MoveThirdpersonCamera( void );
|
||||||
qboolean CL_IsPlayerIndex( int idx );
|
qboolean CL_IsPlayerIndex( int idx );
|
||||||
void CL_SetIdealPitch( void );
|
|
||||||
void CL_EmitEntities( void );
|
void CL_EmitEntities( void );
|
||||||
|
|
||||||
//
|
//
|
||||||
@@ -1013,6 +1002,7 @@ const ref_overview_t *GL_GetOverviewParms( void );
|
|||||||
//
|
//
|
||||||
void R_StoreEfrags( efrag_t **ppefrag, int framecount );
|
void R_StoreEfrags( efrag_t **ppefrag, int framecount );
|
||||||
void R_AddEfrags( cl_entity_t *ent );
|
void R_AddEfrags( cl_entity_t *ent );
|
||||||
|
|
||||||
//
|
//
|
||||||
// cl_tent.c
|
// cl_tent.c
|
||||||
//
|
//
|
||||||
@@ -1023,7 +1013,6 @@ void CL_ClearEfrags( void );
|
|||||||
void CL_TestLights( void );
|
void CL_TestLights( void );
|
||||||
void CL_FireCustomDecal( int textureIndex, int entityIndex, int modelIndex, float *pos, int flags, float scale );
|
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_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 R_FreeDeadParticles( struct particle_s **ppparticles );
|
||||||
void CL_AddClientResource( const char *filename, int type );
|
void CL_AddClientResource( const char *filename, int type );
|
||||||
void CL_AddClientResources( void );
|
void CL_AddClientResources( void );
|
||||||
@@ -1045,7 +1034,6 @@ void CL_ReadPointFile_f( void );
|
|||||||
void CL_DrawEFX( float time, qboolean fTrans );
|
void CL_DrawEFX( float time, qboolean fTrans );
|
||||||
void CL_ThinkParticle( double frametime, particle_t *p );
|
void CL_ThinkParticle( double frametime, particle_t *p );
|
||||||
void CL_ReadLineFile_f( void );
|
void CL_ReadLineFile_f( void );
|
||||||
void CL_RunLightStyles( void );
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// console.c
|
// console.c
|
||||||
@@ -1065,27 +1053,23 @@ int Con_UtfProcessChar( int in );
|
|||||||
int Con_UtfProcessCharForce( int in );
|
int Con_UtfProcessCharForce( int in );
|
||||||
int Con_UtfMoveLeft( char *str, int pos );
|
int Con_UtfMoveLeft( char *str, int pos );
|
||||||
int Con_UtfMoveRight( char *str, int pos, int length );
|
int Con_UtfMoveRight( char *str, int pos, int length );
|
||||||
void Con_DefaultColor( int r, int g, int b );
|
void Con_DefaultColor( int r, int g, int b, qboolean gameui );
|
||||||
void Con_InvalidateFonts( void );
|
|
||||||
cl_font_t *Con_GetCurFont( void );
|
cl_font_t *Con_GetCurFont( void );
|
||||||
cl_font_t *Con_GetFont( int num );
|
cl_font_t *Con_GetFont( int num );
|
||||||
void Con_DrawCharacterLen( int number, int *width, int *height );
|
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
|
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 GAME_EXPORT Con_DrawStringLen( const char *pText, int *length, int *height ); // legacy, use cl_font.c
|
||||||
void Con_CharEvent( int key );
|
void Con_CharEvent( int key );
|
||||||
void Con_RestoreFont( void );
|
|
||||||
void Key_Console( int key );
|
void Key_Console( int key );
|
||||||
void Key_Message( int key );
|
void Key_Message( int key );
|
||||||
void Con_FastClose( void );
|
void Con_FastClose( void );
|
||||||
void Con_Bottom( void );
|
void Con_Bottom( void );
|
||||||
void Con_Top( void );
|
|
||||||
void Con_PageDown( int lines );
|
void Con_PageDown( int lines );
|
||||||
void Con_PageUp( int lines );
|
void Con_PageUp( int lines );
|
||||||
|
|
||||||
//
|
//
|
||||||
// s_main.c
|
// 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_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_StartBackgroundTrack( const char *intro, const char *loop, int position, qboolean fullpath );
|
||||||
void S_StopBackgroundTrack( void );
|
void S_StopBackgroundTrack( void );
|
||||||
@@ -1132,11 +1116,6 @@ void UI_ConnectionProgress_Precache( void );
|
|||||||
void UI_ConnectionProgress_Connect( const char *server );
|
void UI_ConnectionProgress_Connect( const char *server );
|
||||||
void UI_ConnectionProgress_ChangeLevel( void );
|
void UI_ConnectionProgress_ChangeLevel( void );
|
||||||
void UI_ConnectionProgress_ParseServerInfo( const char *server );
|
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
|
// cl_mobile.c
|
||||||
|
|||||||
@@ -25,11 +25,13 @@ GNU General Public License for more details.
|
|||||||
static CVAR_DEFINE_AUTO( scr_conspeed, "600", FCVAR_ARCHIVE, "console moving speed" );
|
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" );
|
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)" );
|
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_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_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" );
|
static CVAR_DEFINE_AUTO( con_fontnum, "-1", FCVAR_ARCHIVE, "console font number (0, 1 or 2), -1 for autoselect" );
|
||||||
static CVAR_DEFINE_AUTO( con_color, "240 180 24", FCVAR_ARCHIVE, "set a custom console color" );
|
static CVAR_DEFINE_AUTO( con_color, "240 180 24", FCVAR_ARCHIVE, "set a custom console color" );
|
||||||
|
static CVAR_DEFINE_AUTO( scr_drawversion, "1", FCVAR_ARCHIVE, "draw version in menu or screenshots, doesn't affect console" );
|
||||||
|
static CVAR_DEFINE_AUTO( con_oldfont, "0", 0, "use legacy font from gfx.wad, might be missing or broken" );
|
||||||
|
|
||||||
static int g_codepage = 0;
|
static int g_codepage = 0;
|
||||||
static qboolean g_utf8 = false;
|
static qboolean g_utf8 = false;
|
||||||
@@ -139,8 +141,9 @@ typedef struct
|
|||||||
|
|
||||||
static console_t con;
|
static console_t con;
|
||||||
|
|
||||||
void Con_ClearField( field_t *edit );
|
static void Con_ClearField( field_t *edit );
|
||||||
void Field_CharEvent( field_t *edit, int ch );
|
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_LoadHistory( con_history_t *self );
|
||||||
static void Con_SaveHistory( con_history_t *self );
|
static void Con_SaveHistory( con_history_t *self );
|
||||||
@@ -150,7 +153,7 @@ static void Con_SaveHistory( con_history_t *self );
|
|||||||
Con_Clear_f
|
Con_Clear_f
|
||||||
================
|
================
|
||||||
*/
|
*/
|
||||||
void Con_Clear_f( void )
|
static void Con_Clear_f( void )
|
||||||
{
|
{
|
||||||
con.lines_count = 0;
|
con.lines_count = 0;
|
||||||
con.backscroll = 0; // go to end
|
con.backscroll = 0; // go to end
|
||||||
@@ -174,10 +177,10 @@ static void Con_SetColor( void )
|
|||||||
switch( num )
|
switch( num )
|
||||||
{
|
{
|
||||||
case 1:
|
case 1:
|
||||||
Con_DefaultColor( r, r, r );
|
Con_DefaultColor( r, r, r, false );
|
||||||
break;
|
break;
|
||||||
case 3:
|
case 3:
|
||||||
Con_DefaultColor( r, g, b );
|
Con_DefaultColor( r, g, b, false );
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
Cvar_DirectSet( &con_color, con_color.def_string );
|
Cvar_DirectSet( &con_color, con_color.def_string );
|
||||||
@@ -205,7 +208,7 @@ void Con_ClearNotify( void )
|
|||||||
Con_ClearTyping
|
Con_ClearTyping
|
||||||
================
|
================
|
||||||
*/
|
*/
|
||||||
void Con_ClearTyping( void )
|
static void Con_ClearTyping( void )
|
||||||
{
|
{
|
||||||
Con_ClearField( &con.input );
|
Con_ClearField( &con.input );
|
||||||
con.input.widthInChars = con.linewidth;
|
con.input.widthInChars = con.linewidth;
|
||||||
@@ -218,7 +221,7 @@ void Con_ClearTyping( void )
|
|||||||
Con_MessageMode_f
|
Con_MessageMode_f
|
||||||
================
|
================
|
||||||
*/
|
*/
|
||||||
void Con_MessageMode_f( void )
|
static void Con_MessageMode_f( void )
|
||||||
{
|
{
|
||||||
g_messagemode_privileged = Cmd_CurrentCommandIsPrivileged();
|
g_messagemode_privileged = Cmd_CurrentCommandIsPrivileged();
|
||||||
|
|
||||||
@@ -234,7 +237,7 @@ void Con_MessageMode_f( void )
|
|||||||
Con_MessageMode2_f
|
Con_MessageMode2_f
|
||||||
================
|
================
|
||||||
*/
|
*/
|
||||||
void Con_MessageMode2_f( void )
|
static void Con_MessageMode2_f( void )
|
||||||
{
|
{
|
||||||
g_messagemode_privileged = Cmd_CurrentCommandIsPrivileged();
|
g_messagemode_privileged = Cmd_CurrentCommandIsPrivileged();
|
||||||
|
|
||||||
@@ -279,7 +282,7 @@ void Con_ToggleConsole_f( void )
|
|||||||
Con_SetTimes_f
|
Con_SetTimes_f
|
||||||
================
|
================
|
||||||
*/
|
*/
|
||||||
void Con_SetTimes_f( void )
|
static void Con_SetTimes_f( void )
|
||||||
{
|
{
|
||||||
int newtimes;
|
int newtimes;
|
||||||
|
|
||||||
@@ -302,7 +305,7 @@ Notifies the console code about the current time
|
|||||||
went backwards)
|
went backwards)
|
||||||
================
|
================
|
||||||
*/
|
*/
|
||||||
void Con_FixTimes( void )
|
static void Con_FixTimes( void )
|
||||||
{
|
{
|
||||||
double diff;
|
double diff;
|
||||||
int i;
|
int i;
|
||||||
@@ -323,7 +326,7 @@ Con_DeleteLine
|
|||||||
Deletes the first line from the console history.
|
Deletes the first line from the console history.
|
||||||
================
|
================
|
||||||
*/
|
*/
|
||||||
void Con_DeleteLine( void )
|
static void Con_DeleteLine( void )
|
||||||
{
|
{
|
||||||
if( con.lines_count == 0 )
|
if( con.lines_count == 0 )
|
||||||
return;
|
return;
|
||||||
@@ -338,7 +341,7 @@ Con_DeleteLastLine
|
|||||||
Deletes the last line from the console history.
|
Deletes the last line from the console history.
|
||||||
================
|
================
|
||||||
*/
|
*/
|
||||||
void Con_DeleteLastLine( void )
|
static void Con_DeleteLastLine( void )
|
||||||
{
|
{
|
||||||
if( con.lines_count == 0 )
|
if( con.lines_count == 0 )
|
||||||
return;
|
return;
|
||||||
@@ -397,7 +400,7 @@ Con_AddLine
|
|||||||
Appends a given string as a new line to the console.
|
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;
|
char *putpos;
|
||||||
con_lineinfo_t *p;
|
con_lineinfo_t *p;
|
||||||
@@ -443,7 +446,7 @@ Con_CheckResize
|
|||||||
If the line width has changed, reformat the buffer.
|
If the line width has changed, reformat the buffer.
|
||||||
================
|
================
|
||||||
*/
|
*/
|
||||||
void Con_CheckResize( void )
|
static void Con_CheckResize( void )
|
||||||
{
|
{
|
||||||
int charWidth = 8;
|
int charWidth = 8;
|
||||||
int i, width;
|
int i, width;
|
||||||
@@ -492,7 +495,7 @@ void Con_PageDown( int lines )
|
|||||||
Con_Top
|
Con_Top
|
||||||
================
|
================
|
||||||
*/
|
*/
|
||||||
void Con_Top( void )
|
static void Con_Top( void )
|
||||||
{
|
{
|
||||||
con.backscroll = CON_MAXLINES;
|
con.backscroll = CON_MAXLINES;
|
||||||
}
|
}
|
||||||
@@ -543,10 +546,9 @@ static void Con_LoadConsoleFont( int fontNumber, cl_font_t *font )
|
|||||||
if( font->valid )
|
if( font->valid )
|
||||||
return; // already loaded
|
return; // already loaded
|
||||||
|
|
||||||
// loading conchars
|
if( con_oldfont.value )
|
||||||
if( Sys_CheckParm( "-oldfont" ))
|
|
||||||
{
|
{
|
||||||
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
|
else
|
||||||
{
|
{
|
||||||
@@ -559,14 +561,14 @@ static void Con_LoadConsoleFont( int fontNumber, cl_font_t *font )
|
|||||||
if( Q_snprintf( path, sizeof( path ),
|
if( Q_snprintf( path, sizeof( path ),
|
||||||
"font%i_%s.fnt", fontNumber, Cvar_VariableString( "con_charset" )) > 0 )
|
"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 )
|
if( !success )
|
||||||
{
|
{
|
||||||
Q_snprintf( path, sizeof( path ), "fonts/font%i", fontNumber );
|
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
|
// quake fixed font as fallback
|
||||||
// keep source to print directly into conback image
|
// 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" );
|
Con_DPrintf( S_ERROR "failed to load console font\n" );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -839,8 +841,11 @@ void Con_Init( void )
|
|||||||
Cvar_RegisterVariable( &con_fontsize );
|
Cvar_RegisterVariable( &con_fontsize );
|
||||||
Cvar_RegisterVariable( &con_charset );
|
Cvar_RegisterVariable( &con_charset );
|
||||||
Cvar_RegisterVariable( &con_fontscale );
|
Cvar_RegisterVariable( &con_fontscale );
|
||||||
|
Cvar_RegisterVariable( &con_fontrender );
|
||||||
Cvar_RegisterVariable( &con_fontnum );
|
Cvar_RegisterVariable( &con_fontnum );
|
||||||
Cvar_RegisterVariable( &con_color );
|
Cvar_RegisterVariable( &con_color );
|
||||||
|
Cvar_RegisterVariable( &scr_drawversion );
|
||||||
|
Cvar_RegisterVariable( &con_oldfont );
|
||||||
|
|
||||||
// init the console buffer
|
// init the console buffer
|
||||||
con.bufsize = CON_TEXTSIZE;
|
con.bufsize = CON_TEXTSIZE;
|
||||||
@@ -1118,9 +1123,9 @@ EDIT FIELDS
|
|||||||
Con_ClearField
|
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->cursor = 0;
|
||||||
edit->scroll = 0;
|
edit->scroll = 0;
|
||||||
}
|
}
|
||||||
@@ -1141,7 +1146,7 @@ static void Field_Set( field_t *f, const char *string )
|
|||||||
Field_Paste
|
Field_Paste
|
||||||
================
|
================
|
||||||
*/
|
*/
|
||||||
void Field_Paste( field_t *edit )
|
static void Field_Paste( field_t *edit )
|
||||||
{
|
{
|
||||||
char *cbd;
|
char *cbd;
|
||||||
int i, pasteLen;
|
int i, pasteLen;
|
||||||
@@ -1177,7 +1182,7 @@ in-game talk, and menu fields
|
|||||||
Key events are used for non-printable characters, others are gotten from char events.
|
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;
|
int len;
|
||||||
|
|
||||||
@@ -1248,7 +1253,7 @@ void Field_KeyDownEvent( field_t *edit, int key )
|
|||||||
Field_CharEvent
|
Field_CharEvent
|
||||||
==================
|
==================
|
||||||
*/
|
*/
|
||||||
void Field_CharEvent( field_t *edit, int ch )
|
static void Field_CharEvent( field_t *edit, int ch )
|
||||||
{
|
{
|
||||||
int len;
|
int len;
|
||||||
|
|
||||||
@@ -1309,7 +1314,7 @@ void Field_CharEvent( field_t *edit, int ch )
|
|||||||
Field_DrawInputLine
|
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 len, cursorChar;
|
||||||
int drawLen;
|
int drawLen;
|
||||||
@@ -1439,36 +1444,49 @@ static void Con_HistoryAppend( con_history_t *self, field_t *from )
|
|||||||
|
|
||||||
static void Con_LoadHistory( con_history_t *self )
|
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;
|
field_t *f;
|
||||||
|
file_t *fd;
|
||||||
|
int i;
|
||||||
|
|
||||||
if( !aFile )
|
fd = FS_Open( "console_history.txt", "rb", true );
|
||||||
|
|
||||||
|
if( !fd )
|
||||||
return;
|
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;
|
continue;
|
||||||
|
|
||||||
Con_ClearField( &self->lines[self->next] );
|
// skip repeating lines
|
||||||
|
if( self->next > 0 )
|
||||||
len = Q_min( pFile - pLine + 1, sizeof( f->buffer ));
|
{
|
||||||
f = &self->lines[self->next % CON_HISTORY];
|
field_t *prev;
|
||||||
f->widthInChars = con.linewidth;
|
prev = &self->lines[(self->next - 1) % CON_HISTORY];
|
||||||
f->cursor = len - 1;
|
if( !Q_stricmp( prev->buffer, f->buffer ))
|
||||||
Q_strncpy( f->buffer, pLine, len);
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
self->next++;
|
self->next++;
|
||||||
|
|
||||||
pLine = pFile + 1;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
FS_Close( fd );
|
||||||
|
|
||||||
for( i = self->next; i < CON_HISTORY; i++ )
|
for( i = self->next; i < CON_HISTORY; i++ )
|
||||||
{
|
{
|
||||||
Con_ClearField( &self->lines[i] );
|
f = &self->lines[i];
|
||||||
self->lines[i].widthInChars = con.linewidth;
|
|
||||||
|
Con_ClearField( f );
|
||||||
|
f->widthInChars = con.linewidth;
|
||||||
}
|
}
|
||||||
|
|
||||||
self->line = self->next;
|
self->line = self->next;
|
||||||
@@ -1486,7 +1504,7 @@ static void Con_SaveHistory( con_history_t *self )
|
|||||||
if( historyStart < 0 )
|
if( historyStart < 0 )
|
||||||
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++ )
|
for( i = historyStart; i < self->next; i++ )
|
||||||
FS_Printf( f, "%s\n", self->lines[i % CON_HISTORY].buffer );
|
FS_Printf( f, "%s\n", self->lines[i % CON_HISTORY].buffer );
|
||||||
@@ -1681,7 +1699,7 @@ Con_DrawInput
|
|||||||
The input line scrolls horizontally if typing goes beyond the right edge
|
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;
|
int y;
|
||||||
|
|
||||||
@@ -1701,7 +1719,7 @@ Con_DrawDebugLines
|
|||||||
Custom debug messages
|
Custom debug messages
|
||||||
================
|
================
|
||||||
*/
|
*/
|
||||||
int Con_DrawDebugLines( void )
|
static int Con_DrawDebugLines( void )
|
||||||
{
|
{
|
||||||
notify_t *notify = con.notify;
|
notify_t *notify = con.notify;
|
||||||
int i, count = 0;
|
int i, count = 0;
|
||||||
@@ -1786,7 +1804,7 @@ Con_DrawNotify
|
|||||||
Draws the last few lines of output transparently over the game top
|
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;
|
double time = cl.time;
|
||||||
int i, x, y = 0;
|
int i, x, y = 0;
|
||||||
@@ -1838,7 +1856,7 @@ If alpha is 0, the line is not drawn, but still wrapped and its height
|
|||||||
returned.
|
returned.
|
||||||
================
|
================
|
||||||
*/
|
*/
|
||||||
int Con_DrawConsoleLine( int y, int lineno )
|
static int Con_DrawConsoleLine( int y, int lineno )
|
||||||
{
|
{
|
||||||
con_lineinfo_t *li = &CON_LINES( lineno );
|
con_lineinfo_t *li = &CON_LINES( lineno );
|
||||||
|
|
||||||
@@ -1893,7 +1911,7 @@ Con_DrawConsole
|
|||||||
Draws the console with the solid background
|
Draws the console with the solid background
|
||||||
================
|
================
|
||||||
*/
|
*/
|
||||||
void Con_DrawSolidConsole( int lines )
|
static void Con_DrawSolidConsole( int lines )
|
||||||
{
|
{
|
||||||
int i, x, y;
|
int i, x, y;
|
||||||
float fraction;
|
float fraction;
|
||||||
@@ -2047,26 +2065,30 @@ void Con_DrawVersion( void )
|
|||||||
byte *color = g_color_table[7];
|
byte *color = g_color_table[7];
|
||||||
int stringLen, charH = 0;
|
int stringLen, charH = 0;
|
||||||
int start, height = refState.height;
|
int start, height = refState.height;
|
||||||
qboolean draw_version = false;
|
|
||||||
string curbuild;
|
string curbuild;
|
||||||
|
|
||||||
switch( cls.scrshot_action )
|
if( !scr_drawversion.value || CL_IsDevOverviewMode() == 2 || net_graph.value )
|
||||||
{
|
|
||||||
case scrshot_normal:
|
|
||||||
case scrshot_snapshot:
|
|
||||||
draw_version = true;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
if( host.force_draw_version_time > host.realtime )
|
|
||||||
draw_version = true;
|
|
||||||
|
|
||||||
if(( cls.key_dest != key_menu && !draw_version ) || CL_IsDevOverviewMode() == 2 || net_graph.value )
|
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if( draw_version )
|
if( cls.key_dest == key_menu )
|
||||||
Q_snprintf( curbuild, MAX_STRING, XASH_ENGINE_NAME " v%i/" XASH_VERSION " (%s-%s build %i)", PROTOCOL_VERSION, Q_buildos(), Q_buildarch(), Q_buildnum( ));
|
{
|
||||||
else Q_snprintf( curbuild, MAX_STRING, "v%i/" XASH_VERSION " (%s-%s build %i)", PROTOCOL_VERSION, Q_buildos(), Q_buildarch(), Q_buildnum( ));
|
Q_snprintf( curbuild, sizeof( curbuild ),
|
||||||
|
"v%i/" XASH_VERSION " (%s-%s build %i)", PROTOCOL_VERSION, Q_buildos(), Q_buildarch(), Q_buildnum( ));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
qboolean draw_version;
|
||||||
|
|
||||||
|
draw_version = cls.scrshot_action == scrshot_normal
|
||||||
|
|| cls.scrshot_action == scrshot_snapshot
|
||||||
|
|| host.force_draw_version_time > host.realtime;
|
||||||
|
|
||||||
|
if( !draw_version )
|
||||||
|
return;
|
||||||
|
|
||||||
|
Q_snprintf( curbuild, sizeof( curbuild ),
|
||||||
|
XASH_ENGINE_NAME " v%i/" XASH_VERSION " (%s-%s build %i)", PROTOCOL_VERSION, Q_buildos(), Q_buildarch(), Q_buildnum( ));
|
||||||
|
}
|
||||||
|
|
||||||
Con_DrawStringLen( curbuild, &stringLen, &charH );
|
Con_DrawStringLen( curbuild, &stringLen, &charH );
|
||||||
start = refState.width - stringLen * 1.05f;
|
start = refState.width - stringLen * 1.05f;
|
||||||
@@ -2091,9 +2113,13 @@ void Con_RunConsole( void )
|
|||||||
// decide on the destination height of the console
|
// decide on the destination height of the console
|
||||||
if( host.allow_console && cls.key_dest == key_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 )
|
if( cls.state < ca_active || cl.first_frame )
|
||||||
con.showlines = refState.height; // full screen
|
con.showlines = refState.height; // full screen
|
||||||
else con.showlines = (refState.height >> 1); // half screen
|
else con.showlines = (refState.height >> 1); // half screen
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
else con.showlines = 0; // none visible
|
else con.showlines = 0; // none visible
|
||||||
|
|
||||||
@@ -2112,10 +2138,7 @@ void Con_RunConsole( void )
|
|||||||
con.vislines = con.showlines;
|
con.vislines = con.showlines;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( FBitSet( con_charset.flags, FCVAR_CHANGED ) ||
|
if( FBitSet( con_charset.flags|con_fontscale.flags|con_fontnum.flags|cl_charset.flags|con_oldfont.flags, FCVAR_CHANGED ))
|
||||||
FBitSet( con_fontscale.flags, FCVAR_CHANGED ) ||
|
|
||||||
FBitSet( con_fontnum.flags, FCVAR_CHANGED ) ||
|
|
||||||
FBitSet( cl_charset.flags, FCVAR_CHANGED ))
|
|
||||||
{
|
{
|
||||||
// update codepage parameters
|
// update codepage parameters
|
||||||
if( !Q_stricmp( con_charset.string, "cp1251" ))
|
if( !Q_stricmp( con_charset.string, "cp1251" ))
|
||||||
@@ -2141,6 +2164,7 @@ void Con_RunConsole( void )
|
|||||||
ClearBits( con_fontnum.flags, FCVAR_CHANGED );
|
ClearBits( con_fontnum.flags, FCVAR_CHANGED );
|
||||||
ClearBits( con_fontscale.flags, FCVAR_CHANGED );
|
ClearBits( con_fontscale.flags, FCVAR_CHANGED );
|
||||||
ClearBits( cl_charset.flags, FCVAR_CHANGED );
|
ClearBits( cl_charset.flags, FCVAR_CHANGED );
|
||||||
|
ClearBits( con_oldfont.flags, FCVAR_CHANGED );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2180,12 +2204,17 @@ INTERNAL RESOURCE
|
|||||||
*/
|
*/
|
||||||
void Con_VidInit( void )
|
void Con_VidInit( void )
|
||||||
{
|
{
|
||||||
|
const uint flags = TF_IMAGE|TF_ALLOW_NEAREST;
|
||||||
|
|
||||||
if( !con.historyLoaded )
|
if( !con.historyLoaded )
|
||||||
{
|
{
|
||||||
Con_LoadHistory( &con.history );
|
Con_LoadHistory( &con.history );
|
||||||
con.historyLoaded = true;
|
con.historyLoaded = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if( Sys_CheckParm( "-oldfont" ))
|
||||||
|
Cvar_DirectSet( &con_oldfont, "1" );
|
||||||
|
|
||||||
Con_LoadConchars();
|
Con_LoadConchars();
|
||||||
Con_CheckResize();
|
Con_CheckResize();
|
||||||
#if XASH_LOW_MEMORY
|
#if XASH_LOW_MEMORY
|
||||||
@@ -2196,28 +2225,28 @@ void Con_VidInit( void )
|
|||||||
{
|
{
|
||||||
// trying to load truecolor image first
|
// trying to load truecolor image first
|
||||||
if( FS_FileExists( "gfx/shell/conback.bmp", false ) || FS_FileExists( "gfx/shell/conback.tga", false ))
|
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( !con.background )
|
||||||
{
|
{
|
||||||
if( FS_FileExists( "cached/conback640", false ))
|
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 ))
|
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
|
else
|
||||||
{
|
{
|
||||||
// trying to load truecolor image first
|
// trying to load truecolor image first
|
||||||
if( FS_FileExists( "gfx/shell/loading.bmp", false ) || FS_FileExists( "gfx/shell/loading.tga", false ))
|
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( !con.background )
|
||||||
{
|
{
|
||||||
if( FS_FileExists( "cached/loading640", false ))
|
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 ))
|
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 );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2303,11 +2332,20 @@ Con_DefaultColor
|
|||||||
called from MainUI
|
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 );
|
r = bound( 0, r, 255 );
|
||||||
g = bound( 0, g, 255 );
|
g = bound( 0, g, 255 );
|
||||||
b = bound( 0, b, 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 );
|
MakeRGBA( g_color_table[7], r, g, b, 255 );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
438
engine/client/gamma.c
Normal file
438
engine/client/gamma.c
Normal file
@@ -0,0 +1,438 @@
|
|||||||
|
/*
|
||||||
|
gamma.c - gamma routines
|
||||||
|
Copyright (C) 2011 Uncle Mike
|
||||||
|
|
||||||
|
This program is free software: you can redistribute it and/or modify
|
||||||
|
it under the terms of the GNU General Public License as published by
|
||||||
|
the Free Software Foundation, either version 3 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
This program is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
GNU General Public License for more details.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "common.h"
|
||||||
|
#include "client.h"
|
||||||
|
#include "xash3d_mathlib.h"
|
||||||
|
#include "enginefeatures.h"
|
||||||
|
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
// Gamma conversion support
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
static qboolean gamma_rebuilt;
|
||||||
|
static byte texgammatable[256];
|
||||||
|
static uint lightgammatable[1024];
|
||||||
|
static uint lineargammatable[1024];
|
||||||
|
static uint screengammatable[1024];
|
||||||
|
static CVAR_DEFINE( v_direct, "direct", "0.9", 0, "direct studio lighting" );
|
||||||
|
static CVAR_DEFINE( v_texgamma, "texgamma", "2.0", 0, "texgamma amount" );
|
||||||
|
static CVAR_DEFINE( v_lightgamma, "lightgamma", "2.5", 0, "lightgamma amount" );
|
||||||
|
static CVAR_DEFINE( v_brightness, "brightness", "0.0", FCVAR_ARCHIVE, "brightness factor" );
|
||||||
|
static CVAR_DEFINE( v_gamma, "gamma", "2.5", FCVAR_ARCHIVE, "gamma amount" );
|
||||||
|
|
||||||
|
static void BuildGammaTable( const float gamma, const float brightness, const float texgamma, const float lightgamma )
|
||||||
|
{
|
||||||
|
float g1, g2, g3;
|
||||||
|
int i;
|
||||||
|
|
||||||
|
if( gamma != 0.0 )
|
||||||
|
g1 = 1.0 / gamma;
|
||||||
|
else g1 = 0.4;
|
||||||
|
|
||||||
|
g2 = g1 * texgamma;
|
||||||
|
|
||||||
|
if( brightness <= 0.0 )
|
||||||
|
g3 = 0.125;
|
||||||
|
else if( brightness <= 1.0 )
|
||||||
|
g3 = 0.125 - brightness * brightness * 0.075;
|
||||||
|
else
|
||||||
|
g3 = 0.05;
|
||||||
|
|
||||||
|
for( i = 0; i < 256; i++ )
|
||||||
|
{
|
||||||
|
double d = pow( i / 255.0, (double)g2 );
|
||||||
|
int inf = d * 255.0;
|
||||||
|
texgammatable[i] = bound( 0, inf, 255 );
|
||||||
|
}
|
||||||
|
|
||||||
|
for( i = 0; i < 1024; i++ )
|
||||||
|
{
|
||||||
|
double d;
|
||||||
|
float f = pow( i / 1023.0, (double)lightgamma );
|
||||||
|
int inf;
|
||||||
|
|
||||||
|
if( brightness > 1.0 )
|
||||||
|
f *= brightness;
|
||||||
|
|
||||||
|
if( f <= g3 )
|
||||||
|
f = ( f / g3 ) * 0.125;
|
||||||
|
else
|
||||||
|
f = (( f - g3 ) / ( 1.0 - g3 )) * 0.875 + 0.125;
|
||||||
|
|
||||||
|
d = pow( (double)f, (double)g1 ); // do not remove the cast, or tests fail
|
||||||
|
inf = d * 1023.0;
|
||||||
|
lightgammatable[i] = bound( 0, inf, 1023 );
|
||||||
|
|
||||||
|
// do these calculations in the same loop...
|
||||||
|
lineargammatable[i] = pow( i / 1023.0, (double)gamma ) * 1023.0;
|
||||||
|
screengammatable[i] = pow( i / 1023.0, 1.0 / gamma ) * 1023.0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static void V_ValidateGammaCvars( void )
|
||||||
|
{
|
||||||
|
if( v_gamma.value < 1.8f )
|
||||||
|
Cvar_DirectSet( &v_gamma, "1.8" );
|
||||||
|
else if( v_gamma.value > 3.0f )
|
||||||
|
Cvar_DirectSet( &v_gamma, "3" );
|
||||||
|
|
||||||
|
if( v_texgamma.value < 1.8f )
|
||||||
|
Cvar_DirectSet( &v_texgamma, "1.8" );
|
||||||
|
else if( v_texgamma.value > 3.0f )
|
||||||
|
Cvar_DirectSet( &v_texgamma, "3" );
|
||||||
|
|
||||||
|
if( v_lightgamma.value < 1.8f )
|
||||||
|
Cvar_DirectSet( &v_lightgamma, "1.8" );
|
||||||
|
else if( v_lightgamma.value > 3.0f )
|
||||||
|
Cvar_DirectSet( &v_lightgamma, "3" );
|
||||||
|
|
||||||
|
if( v_brightness.value < 0.0f )
|
||||||
|
Cvar_DirectSet( &v_brightness, "0" );
|
||||||
|
else if( v_brightness.value > 3.0f )
|
||||||
|
Cvar_DirectSet( &v_brightness, "3" );
|
||||||
|
}
|
||||||
|
|
||||||
|
void V_CheckGamma( void )
|
||||||
|
{
|
||||||
|
static qboolean dirty = false;
|
||||||
|
|
||||||
|
// because these cvars were defined as archive
|
||||||
|
// but wasn't doing anything useful
|
||||||
|
// reset them into default values
|
||||||
|
// this might be removed after a while
|
||||||
|
if( v_direct.value == 1.0f || v_lightgamma.value == 1.0f )
|
||||||
|
{
|
||||||
|
Cvar_DirectSet( &v_direct, "0.9" );
|
||||||
|
Cvar_DirectSet( &v_lightgamma, "2.5" );
|
||||||
|
}
|
||||||
|
|
||||||
|
if( cls.scrshot_action == scrshot_envshot || cls.scrshot_action == scrshot_skyshot )
|
||||||
|
{
|
||||||
|
dirty = true; // force recalculate next normal frame
|
||||||
|
BuildGammaTable( 1.8f, 0.0f, 2.0f, 2.5f );
|
||||||
|
if( ref.initialized )
|
||||||
|
ref.dllFuncs.R_GammaChanged( true );
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if( dirty || FBitSet( v_texgamma.flags|v_lightgamma.flags|v_brightness.flags|v_gamma.flags, FCVAR_CHANGED ))
|
||||||
|
{
|
||||||
|
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
|
||||||
|
if( ref.initialized )
|
||||||
|
ref.dllFuncs.R_GammaChanged( false );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
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 );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void V_Init( void )
|
||||||
|
{
|
||||||
|
Cvar_RegisterVariable( &v_texgamma );
|
||||||
|
Cvar_RegisterVariable( &v_lightgamma );
|
||||||
|
Cvar_RegisterVariable( &v_brightness );
|
||||||
|
Cvar_RegisterVariable( &v_gamma );
|
||||||
|
Cvar_RegisterVariable( &v_direct );
|
||||||
|
|
||||||
|
// force gamma init
|
||||||
|
SetBits( v_gamma.flags, FCVAR_CHANGED );
|
||||||
|
V_CheckGamma();
|
||||||
|
}
|
||||||
|
|
||||||
|
byte TextureToGamma( byte b )
|
||||||
|
{
|
||||||
|
if( FBitSet( host.features, ENGINE_LINEAR_GAMMA_SPACE ))
|
||||||
|
return b;
|
||||||
|
|
||||||
|
return texgammatable[b];
|
||||||
|
}
|
||||||
|
|
||||||
|
byte LightToTexGamma( byte b )
|
||||||
|
{
|
||||||
|
if( FBitSet( host.features, ENGINE_LINEAR_GAMMA_SPACE ))
|
||||||
|
return b;
|
||||||
|
|
||||||
|
// 255 << 2 is 1020, impossible to overflow
|
||||||
|
return lightgammatable[b << 2] >> 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
uint LightToTexGammaEx( uint b )
|
||||||
|
{
|
||||||
|
if( FBitSet( host.features, ENGINE_LINEAR_GAMMA_SPACE ))
|
||||||
|
return b;
|
||||||
|
|
||||||
|
if( unlikely( b > ARRAYSIZE( lightgammatable )))
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
return lightgammatable[b];
|
||||||
|
}
|
||||||
|
|
||||||
|
uint ScreenGammaTable( uint b )
|
||||||
|
{
|
||||||
|
if( FBitSet( host.features, ENGINE_LINEAR_GAMMA_SPACE ))
|
||||||
|
return b;
|
||||||
|
|
||||||
|
if( unlikely( b > ARRAYSIZE( screengammatable )))
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
return screengammatable[b];
|
||||||
|
}
|
||||||
|
|
||||||
|
uint LinearGammaTable( uint b )
|
||||||
|
{
|
||||||
|
if( FBitSet( host.features, ENGINE_LINEAR_GAMMA_SPACE ))
|
||||||
|
return b;
|
||||||
|
|
||||||
|
if( unlikely( b > ARRAYSIZE( lineargammatable )))
|
||||||
|
return 0;
|
||||||
|
return lineargammatable[b];
|
||||||
|
}
|
||||||
|
|
||||||
|
#if XASH_ENGINE_TESTS
|
||||||
|
#include "tests.h"
|
||||||
|
|
||||||
|
typedef struct precomputed_gamma_tables_s
|
||||||
|
{
|
||||||
|
float gamma;
|
||||||
|
float brightness;
|
||||||
|
float texgamma;
|
||||||
|
float lightgamma;
|
||||||
|
byte texgammatable[256];
|
||||||
|
int lightgammatable[1024];
|
||||||
|
int lineargammatable[1024];
|
||||||
|
int screengammatable[1024];
|
||||||
|
} precomputed_gamma_tables_t;
|
||||||
|
|
||||||
|
// put at the end of the file, to not confuse Qt Creator's parser
|
||||||
|
precomputed_gamma_tables_t *Test_GetGammaTables( int i );
|
||||||
|
|
||||||
|
static void Test_PrecomputedGammaTables( void )
|
||||||
|
{
|
||||||
|
precomputed_gamma_tables_t *data;
|
||||||
|
int i = 0;
|
||||||
|
|
||||||
|
while(( data = Test_GetGammaTables( i )))
|
||||||
|
{
|
||||||
|
int j;
|
||||||
|
|
||||||
|
BuildGammaTable( data->gamma, data->brightness, data->texgamma, data->lightgamma );
|
||||||
|
|
||||||
|
for( j = 0; j < 1024; j++ )
|
||||||
|
{
|
||||||
|
if( j < 256 )
|
||||||
|
{
|
||||||
|
TASSERT_EQi( texgammatable[j], data->texgammatable[j] );
|
||||||
|
}
|
||||||
|
|
||||||
|
TASSERT_EQi( lightgammatable[j], data->lightgammatable[j] );
|
||||||
|
TASSERT_EQi( lineargammatable[j], data->lineargammatable[j] );
|
||||||
|
TASSERT_EQi( screengammatable[j], data->screengammatable[j] );
|
||||||
|
}
|
||||||
|
i++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void Test_RunGamma( void )
|
||||||
|
{
|
||||||
|
TRUN( Test_PrecomputedGammaTables() );
|
||||||
|
}
|
||||||
|
|
||||||
|
precomputed_gamma_tables_t *Test_GetGammaTables( int i )
|
||||||
|
{
|
||||||
|
static precomputed_gamma_tables_t precomputed_data[] = {
|
||||||
|
{
|
||||||
|
.gamma = 2.5,
|
||||||
|
.brightness = 0.0,
|
||||||
|
.texgamma = 2.0,
|
||||||
|
.lightgamma = 2.5,
|
||||||
|
.texgammatable = {
|
||||||
|
0, 3, 5, 7, 9, 10, 12, 14, 15, 17, 19, 20, 22, 23, 25, 26, 27, 29, 30, 31, 33, 34, 35, 37, 38, 39, 41, 42, 43, 44, 46, 47, 48, 49, 50, 52, 53, 54, 55, 56, 57, 59, 60, 61, 62, 63, 64, 65, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 79, 80, 81, 82, 83, 84,
|
||||||
|
85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 132, 133, 134, 135, 136, 137, 138,
|
||||||
|
139, 140, 141, 142, 143, 144, 145, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 165, 166, 167, 168, 169, 170, 171, 172, 172, 173, 174, 175, 176, 177, 178, 179, 180, 180, 181, 182, 183, 184, 185,
|
||||||
|
186, 186, 187, 188, 189, 190, 191, 192, 192, 193, 194, 195, 196, 197, 198, 198, 199, 200, 201, 202, 203, 204, 204, 205, 206, 207, 208, 209, 209, 210, 211, 212, 213, 214, 214, 215, 216, 217, 218, 219, 219, 220, 221, 222, 223, 224, 224, 225, 226, 227, 228, 229,
|
||||||
|
229, 230, 231, 232, 233, 233, 234, 235, 236, 237, 238, 238, 239, 240, 241, 242, 242, 243, 244, 245, 246, 246, 247, 248, 249, 250, 250, 251, 252, 253, 254, 255
|
||||||
|
},
|
||||||
|
.lightgammatable = {
|
||||||
|
0, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64,
|
||||||
|
65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123,
|
||||||
|
124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175,
|
||||||
|
176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, 206, 207, 208, 209, 210, 211, 212, 213, 214, 215, 216, 217, 218, 219, 220, 221, 222, 223, 224, 225, 226, 227,
|
||||||
|
228, 229, 230, 231, 232, 233, 234, 235, 236, 237, 238, 239, 240, 241, 242, 243, 244, 245, 246, 247, 248, 249, 250, 251, 252, 253, 254, 255, 256, 257, 258, 259, 260, 261, 262, 263, 264, 265, 266, 267, 268, 269, 270, 271, 272, 273, 274, 275, 276, 277, 278, 279,
|
||||||
|
280, 281, 282, 283, 284, 285, 286, 287, 288, 289, 290, 291, 292, 293, 294, 295, 296, 297, 298, 299, 300, 301, 302, 303, 304, 305, 306, 307, 308, 309, 310, 311, 312, 313, 314, 315, 316, 317, 318, 319, 320, 321, 322, 323, 324, 325, 326, 327, 328, 329, 330, 331,
|
||||||
|
332, 333, 334, 335, 336, 337, 338, 339, 340, 341, 343, 343, 344, 345, 346, 347, 348, 349, 350, 351, 353, 353, 354, 355, 356, 357, 358, 359, 360, 361, 362, 363, 364, 365, 366, 367, 368, 369, 370, 371, 372, 373, 374, 376, 376, 377, 379, 379, 380, 381, 382, 383,
|
||||||
|
384, 385, 386, 387, 388, 389, 390, 391, 392, 393, 394, 395, 396, 397, 398, 399, 400, 401, 402, 403, 404, 405, 406, 407, 408, 409, 410, 411, 412, 413, 414, 415, 416, 417, 418, 419, 420, 421, 422, 423, 424, 425, 426, 427, 428, 429, 430, 431, 432, 433, 434, 435,
|
||||||
|
436, 437, 438, 439, 440, 441, 442, 443, 444, 446, 446, 447, 449, 449, 450, 451, 452, 453, 455, 455, 456, 457, 458, 459, 460, 461, 462, 463, 464, 465, 466, 468, 469, 470, 470, 472, 472, 473, 474, 475, 476, 477, 478, 479, 480, 481, 482, 483, 484, 485, 486, 487,
|
||||||
|
488, 489, 490, 491, 493, 493, 494, 495, 496, 498, 498, 499, 500, 502, 502, 503, 504, 505, 507, 508, 508, 509, 510, 511, 512, 513, 514, 515, 516, 517, 518, 520, 521, 521, 522, 523, 524, 525, 526, 527, 528, 530, 530, 531, 532, 533, 534, 536, 536, 537, 538, 539,
|
||||||
|
540, 541, 542, 543, 544, 545, 546, 547, 548, 549, 550, 552, 552, 553, 554, 555, 556, 557, 558, 559, 560, 561, 562, 564, 564, 565, 566, 567, 568, 570, 571, 571, 572, 573, 574, 576, 576, 577, 578, 579, 580, 581, 583, 583, 584, 585, 586, 587, 588, 590, 591, 591,
|
||||||
|
593, 593, 594, 596, 596, 597, 598, 600, 600, 601, 602, 603, 604, 605, 606, 607, 608, 609, 611, 611, 612, 613, 615, 615, 616, 618, 618, 620, 621, 621, 622, 624, 625, 626, 627, 627, 628, 629, 630, 632, 633, 633, 634, 635, 636, 638, 638, 639, 641, 642, 643, 643,
|
||||||
|
644, 645, 646, 648, 648, 650, 651, 651, 652, 654, 655, 656, 656, 658, 658, 660, 660, 662, 662, 664, 664, 665, 666, 668, 668, 669, 670, 671, 672, 673, 674, 675, 676, 677, 678, 679, 680, 682, 682, 683, 684, 685, 686, 687, 688, 690, 690, 691, 692, 693, 695, 696,
|
||||||
|
696, 697, 698, 699, 700, 701, 702, 703, 705, 706, 706, 707, 708, 709, 710, 711, 712, 713, 715, 716, 716, 717, 718, 719, 721, 721, 722, 724, 724, 725, 727, 727, 728, 729, 730, 731, 733, 733, 734, 735, 736, 737, 738, 740, 740, 741, 743, 744, 744, 745, 747, 747,
|
||||||
|
748, 749, 750, 752, 753, 753, 755, 755, 757, 757, 758, 759, 760, 761, 762, 764, 764, 766, 766, 767, 769, 770, 770, 771, 772, 773, 774, 775, 776, 777, 778, 779, 780, 782, 783, 784, 784, 785, 786, 788, 789, 790, 791, 792, 792, 794, 794, 796, 796, 797, 799, 800,
|
||||||
|
801, 801, 802, 803, 804, 805, 806, 807, 809, 810, 810, 811, 813, 813, 815, 815, 816, 817, 819, 819, 820, 822, 823, 823, 824, 825, 826, 827, 829, 829, 830, 832, 832, 833, 835, 835, 837, 837, 839, 840, 840, 841, 842, 843, 844, 845, 847, 847, 849, 849, 850, 851,
|
||||||
|
852, 854, 854, 856, 856, 857, 859, 859, 860, 861, 862, 864, 864, 865, 867, 867, 868, 870, 870, 872, 872, 874, 875, 875, 876, 877, 879, 880, 881, 881, 882, 883, 885, 885, 886, 887, 888, 890, 891, 891, 893, 893, 894, 895, 897, 898, 899, 900, 901, 902, 902, 903,
|
||||||
|
904, 905, 907, 907, 908, 910, 910, 911, 912, 914, 914, 915, 917, 918, 919, 920, 921, 922, 922, 923, 925, 925, 926, 927, 928, 930, 931, 932, 932, 933, 935, 936, 936, 937, 939, 940, 940, 942, 942, 944, 944, 946, 947, 948, 949, 949, 950, 952, 952, 953, 955, 956,
|
||||||
|
957, 958, 959, 959, 960, 962, 962, 964, 965, 965, 967, 967, 969, 970, 971, 972, 973, 973, 975, 975, 976, 977, 978, 979, 980, 982, 982, 984, 984, 986, 986, 988, 988, 990, 991, 992, 993, 993, 994, 995, 996, 998, 999, 999, 1000, 1002, 1002, 1004, 1005, 1005,
|
||||||
|
1006, 1007, 1008, 1010, 1011, 1011, 1013, 1014, 1015, 1016, 1017, 1018, 1018, 1019, 1020, 1021, 1023
|
||||||
|
},
|
||||||
|
.lineargammatable = {
|
||||||
|
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
|
||||||
|
2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 5, 5, 5, 5, 5, 5, 5, 5, 5, 6, 6, 6, 6, 6, 6, 6, 6, 6, 7, 7, 7, 7, 7, 7, 7, 8, 8, 8, 8, 8, 8, 8, 8, 9, 9, 9, 9, 9, 9, 10, 10, 10, 10, 10, 10, 11, 11,
|
||||||
|
11, 11, 11, 11, 12, 12, 12, 12, 12, 12, 13, 13, 13, 13, 13, 14, 14, 14, 14, 14, 15, 15, 15, 15, 15, 16, 16, 16, 16, 16, 17, 17, 17, 17, 17, 18, 18, 18, 18, 19, 19, 19, 19, 19, 20, 20, 20, 20, 21, 21, 21, 21, 22, 22, 22, 22, 23, 23, 23, 23, 24, 24, 24, 25, 25,
|
||||||
|
25, 25, 26, 26, 26, 26, 27, 27, 27, 28, 28, 28, 29, 29, 29, 29, 30, 30, 30, 31, 31, 31, 32, 32, 32, 32, 33, 33, 33, 34, 34, 34, 35, 35, 35, 36, 36, 36, 37, 37, 37, 38, 38, 39, 39, 39, 40, 40, 40, 41, 41, 41, 42, 42, 43, 43, 43, 44, 44, 44, 45, 45, 46, 46, 46,
|
||||||
|
47, 47, 48, 48, 48, 49, 49, 50, 50, 50, 51, 51, 52, 52, 52, 53, 53, 54, 54, 55, 55, 55, 56, 56, 57, 57, 58, 58, 59, 59, 60, 60, 60, 61, 61, 62, 62, 63, 63, 64, 64, 65, 65, 66, 66, 67, 67, 68, 68, 69, 69, 70, 70, 71, 71, 72, 72, 73, 73, 74, 74, 75, 75, 76, 76,
|
||||||
|
77, 77, 78, 78, 79, 79, 80, 81, 81, 82, 82, 83, 83, 84, 84, 85, 86, 86, 87, 87, 88, 88, 89, 90, 90, 91, 91, 92, 92, 93, 94, 94, 95, 95, 96, 97, 97, 98, 99, 99, 100, 100, 101, 102, 102, 103, 104, 104, 105, 105, 106, 107, 107, 108, 109, 109, 110, 111, 111, 112,
|
||||||
|
113, 113, 114, 115, 115, 116, 117, 117, 118, 119, 119, 120, 121, 122, 122, 123, 124, 124, 125, 126, 126, 127, 128, 129, 129, 130, 131, 132, 132, 133, 134, 134, 135, 136, 137, 137, 138, 139, 140, 140, 141, 142, 143, 144, 144, 145, 146, 147, 147, 148, 149, 150,
|
||||||
|
151, 151, 152, 153, 154, 155, 155, 156, 157, 158, 159, 159, 160, 161, 162, 163, 164, 164, 165, 166, 167, 168, 169, 169, 170, 171, 172, 173, 174, 175, 176, 176, 177, 178, 179, 180, 181, 182, 183, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 193, 194,
|
||||||
|
195, 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, 206, 207, 208, 209, 209, 210, 211, 212, 213, 214, 215, 216, 217, 218, 219, 220, 221, 222, 223, 224, 225, 226, 227, 228, 229, 230, 231, 232, 233, 234, 236, 237, 238, 239, 240, 241, 242, 243, 244, 245, 246,
|
||||||
|
247, 248, 249, 250, 251, 252, 254, 255, 256, 257, 258, 259, 260, 261, 262, 263, 265, 266, 267, 268, 269, 270, 271, 272, 274, 275, 276, 277, 278, 279, 280, 282, 283, 284, 285, 286, 287, 289, 290, 291, 292, 293, 294, 296, 297, 298, 299, 300, 302, 303, 304, 305,
|
||||||
|
306, 308, 309, 310, 311, 312, 314, 315, 316, 317, 319, 320, 321, 322, 324, 325, 326, 327, 329, 330, 331, 333, 334, 335, 336, 338, 339, 340, 342, 343, 344, 345, 347, 348, 349, 351, 352, 353, 355, 356, 357, 359, 360, 361, 363, 364, 365, 367, 368, 369, 371, 372,
|
||||||
|
373, 375, 376, 378, 379, 380, 382, 383, 384, 386, 387, 389, 390, 391, 393, 394, 396, 397, 399, 400, 401, 403, 404, 406, 407, 409, 410, 411, 413, 414, 416, 417, 419, 420, 422, 423, 425, 426, 428, 429, 431, 432, 434, 435, 437, 438, 440, 441, 443, 444, 446, 447,
|
||||||
|
449, 450, 452, 453, 455, 456, 458, 459, 461, 462, 464, 466, 467, 469, 470, 472, 473, 475, 477, 478, 480, 481, 483, 485, 486, 488, 489, 491, 493, 494, 496, 497, 499, 501, 502, 504, 506, 507, 509, 511, 512, 514, 515, 517, 519, 520, 522, 524, 525, 527, 529, 531,
|
||||||
|
532, 534, 536, 537, 539, 541, 542, 544, 546, 548, 549, 551, 553, 554, 556, 558, 560, 561, 563, 565, 567, 568, 570, 572, 574, 575, 577, 579, 581, 583, 584, 586, 588, 590, 592, 593, 595, 597, 599, 601, 602, 604, 606, 608, 610, 612, 613, 615, 617, 619, 621, 623,
|
||||||
|
625, 626, 628, 630, 632, 634, 636, 638, 639, 641, 643, 645, 647, 649, 651, 653, 655, 657, 659, 660, 662, 664, 666, 668, 670, 672, 674, 676, 678, 680, 682, 684, 686, 688, 690, 692, 694, 696, 698, 700, 702, 704, 706, 708, 710, 712, 714, 716, 718, 720, 722, 724,
|
||||||
|
726, 728, 730, 732, 734, 736, 738, 740, 742, 744, 746, 748, 750, 753, 755, 757, 759, 761, 763, 765, 767, 769, 771, 773, 776, 778, 780, 782, 784, 786, 788, 791, 793, 795, 797, 799, 801, 803, 806, 808, 810, 812, 814, 816, 819, 821, 823, 825, 827, 830, 832, 834,
|
||||||
|
836, 839, 841, 843, 845, 847, 850, 852, 854, 856, 859, 861, 863, 865, 868, 870, 872, 874, 877, 879, 881, 884, 886, 888, 890, 893, 895, 897, 900, 902, 904, 907, 909, 911, 914, 916, 918, 921, 923, 925, 928, 930, 932, 935, 937, 940, 942, 944, 947, 949, 952, 954,
|
||||||
|
956, 959, 961, 964, 966, 968, 971, 973, 976, 978, 981, 983, 985, 988, 990, 993, 995, 998, 1000, 1003, 1005, 1008, 1010, 1013, 1015, 1018, 1020, 1023
|
||||||
|
},
|
||||||
|
.screengammatable = {
|
||||||
|
0, 63, 84, 99, 111, 121, 130, 139, 146, 154, 160, 166, 172, 178, 183, 188, 193, 198, 203, 207, 212, 216, 220, 224, 228, 231, 235, 239, 242, 245, 249, 252, 255, 259, 262, 265, 268, 271, 274, 276, 279, 282, 285, 287, 290, 293, 295, 298, 300, 303, 305, 308,
|
||||||
|
310, 313, 315, 317, 320, 322, 324, 326, 328, 331, 333, 335, 337, 339, 341, 343, 345, 347, 349, 351, 353, 355, 357, 359, 361, 363, 365, 367, 369, 370, 372, 374, 376, 378, 379, 381, 383, 385, 386, 388, 390, 392, 393, 395, 397, 398, 400, 401, 403, 405, 406, 408,
|
||||||
|
409, 411, 413, 414, 416, 417, 419, 420, 422, 423, 425, 426, 428, 429, 431, 432, 434, 435, 436, 438, 439, 441, 442, 444, 445, 446, 448, 449, 450, 452, 453, 455, 456, 457, 459, 460, 461, 463, 464, 465, 466, 468, 469, 470, 472, 473, 474, 475, 477, 478, 479, 480,
|
||||||
|
482, 483, 484, 485, 487, 488, 489, 490, 491, 493, 494, 495, 496, 497, 499, 500, 501, 502, 503, 504, 505, 507, 508, 509, 510, 511, 512, 513, 515, 516, 517, 518, 519, 520, 521, 522, 523, 524, 526, 527, 528, 529, 530, 531, 532, 533, 534, 535, 536, 537, 538, 539,
|
||||||
|
540, 541, 543, 544, 545, 546, 547, 548, 549, 550, 551, 552, 553, 554, 555, 556, 557, 558, 559, 560, 561, 562, 563, 564, 565, 566, 567, 568, 568, 569, 570, 571, 572, 573, 574, 575, 576, 577, 578, 579, 580, 581, 582, 583, 584, 585, 585, 586, 587, 588, 589, 590,
|
||||||
|
591, 592, 593, 594, 595, 595, 596, 597, 598, 599, 600, 601, 602, 603, 603, 604, 605, 606, 607, 608, 609, 610, 610, 611, 612, 613, 614, 615, 616, 616, 617, 618, 619, 620, 621, 622, 622, 623, 624, 625, 626, 627, 627, 628, 629, 630, 631, 632, 632, 633, 634, 635,
|
||||||
|
636, 637, 637, 638, 639, 640, 641, 641, 642, 643, 644, 645, 645, 646, 647, 648, 649, 649, 650, 651, 652, 652, 653, 654, 655, 656, 656, 657, 658, 659, 659, 660, 661, 662, 663, 663, 664, 665, 666, 666, 667, 668, 669, 669, 670, 671, 672, 672, 673, 674, 675, 675,
|
||||||
|
676, 677, 678, 678, 679, 680, 681, 681, 682, 683, 684, 684, 685, 686, 686, 687, 688, 689, 689, 690, 691, 692, 692, 693, 694, 694, 695, 696, 697, 697, 698, 699, 699, 700, 701, 701, 702, 703, 704, 704, 705, 706, 706, 707, 708, 708, 709, 710, 711, 711, 712, 713,
|
||||||
|
713, 714, 715, 715, 716, 717, 717, 718, 719, 719, 720, 721, 721, 722, 723, 723, 724, 725, 725, 726, 727, 727, 728, 729, 729, 730, 731, 731, 732, 733, 733, 734, 735, 735, 736, 737, 737, 738, 739, 739, 740, 741, 741, 742, 743, 743, 744, 745, 745, 746, 746, 747,
|
||||||
|
748, 748, 749, 750, 750, 751, 752, 752, 753, 753, 754, 755, 755, 756, 757, 757, 758, 758, 759, 760, 760, 761, 762, 762, 763, 763, 764, 765, 765, 766, 767, 767, 768, 768, 769, 770, 770, 771, 771, 772, 773, 773, 774, 774, 775, 776, 776, 777, 778, 778, 779, 779,
|
||||||
|
780, 781, 781, 782, 782, 783, 784, 784, 785, 785, 786, 786, 787, 788, 788, 789, 789, 790, 791, 791, 792, 792, 793, 794, 794, 795, 795, 796, 796, 797, 798, 798, 799, 799, 800, 801, 801, 802, 802, 803, 803, 804, 805, 805, 806, 806, 807, 807, 808, 809, 809, 810,
|
||||||
|
810, 811, 811, 812, 813, 813, 814, 814, 815, 815, 816, 816, 817, 818, 818, 819, 819, 820, 820, 821, 821, 822, 823, 823, 824, 824, 825, 825, 826, 826, 827, 828, 828, 829, 829, 830, 830, 831, 831, 832, 832, 833, 834, 834, 835, 835, 836, 836, 837, 837, 838, 838,
|
||||||
|
839, 839, 840, 841, 841, 842, 842, 843, 843, 844, 844, 845, 845, 846, 846, 847, 848, 848, 849, 849, 850, 850, 851, 851, 852, 852, 853, 853, 854, 854, 855, 855, 856, 856, 857, 857, 858, 859, 859, 860, 860, 861, 861, 862, 862, 863, 863, 864, 864, 865, 865, 866,
|
||||||
|
866, 867, 867, 868, 868, 869, 869, 870, 870, 871, 871, 872, 872, 873, 873, 874, 874, 875, 875, 876, 876, 877, 877, 878, 878, 879, 879, 880, 880, 881, 881, 882, 882, 883, 883, 884, 884, 885, 885, 886, 886, 887, 887, 888, 888, 889, 889, 890, 890, 891, 891, 892,
|
||||||
|
892, 893, 893, 894, 894, 895, 895, 896, 896, 897, 897, 898, 898, 899, 899, 900, 900, 901, 901, 902, 902, 903, 903, 904, 904, 904, 905, 905, 906, 906, 907, 907, 908, 908, 909, 909, 910, 910, 911, 911, 912, 912, 913, 913, 914, 914, 915, 915, 915, 916, 916, 917,
|
||||||
|
917, 918, 918, 919, 919, 920, 920, 921, 921, 922, 922, 922, 923, 923, 924, 924, 925, 925, 926, 926, 927, 927, 928, 928, 929, 929, 929, 930, 930, 931, 931, 932, 932, 933, 933, 934, 934, 935, 935, 935, 936, 936, 937, 937, 938, 938, 939, 939, 940, 940, 940, 941,
|
||||||
|
941, 942, 942, 943, 943, 944, 944, 944, 945, 945, 946, 946, 947, 947, 948, 948, 949, 949, 949, 950, 950, 951, 951, 952, 952, 953, 953, 953, 954, 954, 955, 955, 956, 956, 957, 957, 957, 958, 958, 959, 959, 960, 960, 961, 961, 961, 962, 962, 963, 963, 964, 964,
|
||||||
|
964, 965, 965, 966, 966, 967, 967, 968, 968, 968, 969, 969, 970, 970, 971, 971, 971, 972, 972, 973, 973, 974, 974, 974, 975, 975, 976, 976, 977, 977, 977, 978, 978, 979, 979, 980, 980, 980, 981, 981, 982, 982, 983, 983, 983, 984, 984, 985, 985, 986, 986, 986,
|
||||||
|
987, 987, 988, 988, 988, 989, 989, 990, 990, 991, 991, 991, 992, 992, 993, 993, 993, 994, 994, 995, 995, 996, 996, 996, 997, 997, 998, 998, 998, 999, 999, 1000, 1000, 1001, 1001, 1001, 1002, 1002, 1003, 1003, 1003, 1004, 1004, 1005, 1005, 1005, 1006, 1006,
|
||||||
|
1007, 1007, 1008, 1008, 1008, 1009, 1009, 1010, 1010, 1010, 1011, 1011, 1012, 1012, 1012, 1013, 1013, 1014, 1014, 1014, 1015, 1015, 1016, 1016, 1016, 1017, 1017, 1018, 1018, 1018, 1019, 1019, 1020, 1020, 1020, 1021, 1021, 1022, 1022, 1023
|
||||||
|
},
|
||||||
|
}, {
|
||||||
|
.gamma = 2.2,
|
||||||
|
.brightness = 1.0,
|
||||||
|
.texgamma = 2.2,
|
||||||
|
.lightgamma = 2.4,
|
||||||
|
.texgammatable = {
|
||||||
|
0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65,
|
||||||
|
66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123,
|
||||||
|
124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175,
|
||||||
|
176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, 206, 207, 208, 209, 210, 211, 212, 213, 214, 215, 216, 217, 218, 219, 220, 221, 222, 223, 224, 225, 226, 227,
|
||||||
|
228, 229, 230, 231, 232, 233, 234, 235, 236, 237, 238, 239, 240, 241, 242, 243, 244, 245, 246, 247, 248, 249, 250, 251, 252, 253, 254, 255
|
||||||
|
},
|
||||||
|
.lightgammatable = {
|
||||||
|
0, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 11, 12, 13, 14, 15, 16, 17, 18, 20, 21, 22, 23, 24, 25, 27, 28, 29, 30, 31, 33, 34, 35, 36, 37, 39, 40, 41, 42, 43, 45, 46, 47, 48, 50, 51, 52, 53, 55, 56, 57, 58, 60, 61, 62, 63, 65, 66, 67, 69, 70, 71, 72, 74, 75, 76,
|
||||||
|
78, 79, 80, 81, 83, 84, 85, 87, 88, 89, 91, 92, 93, 94, 96, 97, 98, 100, 101, 102, 104, 105, 106, 108, 109, 110, 112, 113, 114, 116, 117, 118, 120, 121, 122, 124, 125, 126, 128, 129, 130, 132, 133, 134, 136, 137, 138, 140, 141, 142, 144, 145, 147, 148, 149,
|
||||||
|
151, 152, 153, 155, 156, 157, 159, 160, 162, 163, 164, 166, 167, 168, 170, 171, 173, 174, 175, 177, 178, 179, 181, 182, 184, 185, 186, 188, 189, 191, 192, 193, 195, 196, 198, 199, 200, 202, 203, 204, 206, 207, 209, 210, 211, 213, 214, 216, 217, 219, 220, 221,
|
||||||
|
223, 224, 226, 227, 228, 230, 231, 233, 234, 235, 237, 238, 240, 241, 243, 244, 245, 247, 248, 250, 251, 252, 254, 255, 257, 258, 260, 261, 262, 264, 265, 267, 268, 270, 271, 272, 274, 275, 277, 278, 280, 281, 282, 284, 285, 287, 288, 290, 291, 293, 294, 295,
|
||||||
|
297, 298, 300, 301, 303, 304, 306, 307, 308, 310, 311, 313, 314, 316, 317, 319, 320, 321, 323, 324, 326, 327, 329, 330, 332, 333, 335, 336, 337, 339, 340, 342, 343, 345, 346, 348, 349, 351, 352, 354, 355, 356, 358, 359, 361, 362, 364, 365, 367, 368, 370, 371,
|
||||||
|
373, 374, 376, 377, 378, 380, 381, 383, 384, 386, 387, 389, 390, 392, 393, 395, 396, 397, 398, 398, 399, 399, 400, 401, 401, 402, 402, 403, 403, 404, 404, 405, 406, 406, 407, 407, 408, 408, 409, 410, 410, 411, 411, 412, 413, 413, 414, 414, 415, 416, 416, 417,
|
||||||
|
417, 418, 419, 419, 420, 420, 421, 422, 422, 423, 423, 424, 425, 425, 426, 427, 427, 428, 428, 429, 430, 430, 431, 432, 432, 433, 433, 434, 435, 435, 436, 437, 437, 438, 439, 439, 440, 441, 441, 442, 443, 443, 444, 445, 445, 446, 447, 447, 448, 449, 449, 450,
|
||||||
|
451, 451, 452, 453, 453, 454, 455, 455, 456, 457, 457, 458, 459, 459, 460, 461, 461, 462, 463, 464, 464, 465, 466, 466, 467, 468, 468, 469, 470, 471, 471, 472, 473, 473, 474, 475, 476, 476, 477, 478, 478, 479, 480, 481, 481, 482, 483, 483, 484, 485, 486, 486,
|
||||||
|
487, 488, 489, 489, 490, 491, 492, 492, 493, 494, 495, 495, 496, 497, 498, 498, 499, 500, 501, 501, 502, 503, 504, 504, 505, 506, 507, 507, 508, 509, 510, 510, 511, 512, 513, 513, 514, 515, 516, 517, 517, 518, 519, 520, 520, 521, 522, 523, 524, 524, 525, 526,
|
||||||
|
527, 527, 528, 529, 530, 531, 531, 532, 533, 534, 535, 535, 536, 537, 538, 538, 539, 540, 541, 542, 542, 543, 544, 545, 546, 546, 547, 548, 549, 550, 550, 551, 552, 553, 554, 555, 555, 556, 557, 558, 559, 559, 560, 561, 562, 563, 564, 564, 565, 566, 567, 568,
|
||||||
|
568, 569, 570, 571, 572, 573, 573, 574, 575, 576, 577, 578, 578, 579, 580, 581, 582, 583, 583, 584, 585, 586, 587, 588, 588, 589, 590, 591, 592, 593, 593, 594, 595, 596, 597, 598, 599, 599, 600, 601, 602, 603, 604, 605, 605, 606, 607, 608, 609, 610, 611, 611,
|
||||||
|
612, 613, 614, 615, 616, 617, 617, 618, 619, 620, 621, 622, 623, 623, 624, 625, 626, 627, 628, 629, 629, 630, 631, 632, 633, 634, 635, 636, 636, 637, 638, 639, 640, 641, 642, 643, 643, 644, 645, 646, 647, 648, 649, 650, 651, 651, 652, 653, 654, 655, 656, 657,
|
||||||
|
658, 658, 659, 660, 661, 662, 663, 664, 665, 666, 666, 667, 668, 669, 670, 671, 672, 673, 674, 675, 675, 676, 677, 678, 679, 680, 681, 682, 683, 684, 684, 685, 686, 687, 688, 689, 690, 691, 692, 693, 693, 694, 695, 696, 697, 698, 699, 700, 701, 702, 703, 703,
|
||||||
|
704, 705, 706, 707, 708, 709, 710, 711, 712, 713, 713, 714, 715, 716, 717, 718, 719, 720, 721, 722, 723, 724, 724, 725, 726, 727, 728, 729, 730, 731, 732, 733, 734, 735, 736, 736, 737, 738, 739, 740, 741, 742, 743, 744, 745, 746, 747, 748, 749, 749, 750, 751,
|
||||||
|
752, 753, 754, 755, 756, 757, 758, 759, 760, 761, 762, 763, 763, 764, 765, 766, 767, 768, 769, 770, 771, 772, 773, 774, 775, 776, 777, 778, 778, 779, 780, 781, 782, 783, 784, 785, 786, 787, 788, 789, 790, 791, 792, 793, 794, 795, 795, 796, 797, 798, 799, 800,
|
||||||
|
801, 802, 803, 804, 805, 806, 807, 808, 809, 810, 811, 812, 813, 814, 814, 815, 816, 817, 818, 819, 820, 821, 822, 823, 824, 825, 826, 827, 828, 829, 830, 831, 832, 833, 834, 835, 836, 836, 837, 838, 839, 840, 841, 842, 843, 844, 845, 846, 847, 848, 849, 850,
|
||||||
|
851, 852, 853, 854, 855, 856, 857, 858, 859, 860, 861, 862, 863, 863, 864, 865, 866, 867, 868, 869, 870, 871, 872, 873, 874, 875, 876, 877, 878, 879, 880, 881, 882, 883, 884, 885, 886, 887, 888, 889, 890, 891, 892, 893, 894, 895, 896, 897, 898, 899, 900, 900,
|
||||||
|
901, 902, 903, 904, 905, 906, 907, 908, 909, 910, 911, 912, 913, 914, 915, 916, 917, 918, 919, 920, 921, 922, 923, 924, 925, 926, 927, 928, 929, 930, 931, 932, 933, 934, 935, 936, 937, 938, 939, 940, 941, 942, 943, 944, 945, 946, 947, 948, 949, 950, 951, 952,
|
||||||
|
953, 954, 955, 956, 957, 958, 959, 960, 961, 962, 963, 964, 965, 966, 967, 968, 969, 970, 971, 972, 973, 974, 974, 975, 976, 977, 978, 979, 980, 981, 982, 983, 984, 985, 986, 987, 988, 989, 990, 991, 992, 993, 994, 995, 996, 997, 998, 999, 1000, 1001, 1002,
|
||||||
|
1003, 1004, 1005, 1006, 1007, 1008, 1009, 1010, 1011, 1012, 1013, 1014, 1015, 1016, 1017, 1018, 1019, 1020, 1021, 1023
|
||||||
|
},
|
||||||
|
.lineargammatable = {
|
||||||
|
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 4, 4,
|
||||||
|
4, 4, 4, 4, 4, 4, 4, 5, 5, 5, 5, 5, 5, 5, 6, 6, 6, 6, 6, 6, 6, 6, 7, 7, 7, 7, 7, 7, 8, 8, 8, 8, 8, 8, 9, 9, 9, 9, 9, 9, 10, 10, 10, 10, 10, 10, 11, 11, 11, 11, 11, 12, 12, 12, 12, 12, 13, 13, 13, 13, 13, 14, 14, 14, 14, 14, 15, 15, 15, 15, 16, 16, 16, 16, 17,
|
||||||
|
17, 17, 17, 17, 18, 18, 18, 18, 19, 19, 19, 19, 20, 20, 20, 21, 21, 21, 21, 22, 22, 22, 22, 23, 23, 23, 24, 24, 24, 24, 25, 25, 25, 26, 26, 26, 26, 27, 27, 27, 28, 28, 28, 29, 29, 29, 30, 30, 30, 31, 31, 31, 32, 32, 32, 33, 33, 33, 34, 34, 34, 35, 35, 35, 36,
|
||||||
|
36, 36, 37, 37, 38, 38, 38, 39, 39, 39, 40, 40, 40, 41, 41, 42, 42, 42, 43, 43, 44, 44, 44, 45, 45, 46, 46, 46, 47, 47, 48, 48, 48, 49, 49, 50, 50, 51, 51, 51, 52, 52, 53, 53, 54, 54, 55, 55, 55, 56, 56, 57, 57, 58, 58, 59, 59, 60, 60, 61, 61, 61, 62, 62, 63,
|
||||||
|
63, 64, 64, 65, 65, 66, 66, 67, 67, 68, 68, 69, 69, 70, 70, 71, 71, 72, 72, 73, 73, 74, 75, 75, 76, 76, 77, 77, 78, 78, 79, 79, 80, 80, 81, 82, 82, 83, 83, 84, 84, 85, 86, 86, 87, 87, 88, 88, 89, 90, 90, 91, 91, 92, 93, 93, 94, 94, 95, 96, 96, 97, 97, 98, 99,
|
||||||
|
99, 100, 100, 101, 102, 102, 103, 104, 104, 105, 105, 106, 107, 107, 108, 109, 109, 110, 111, 111, 112, 113, 113, 114, 115, 115, 116, 117, 117, 118, 119, 119, 120, 121, 121, 122, 123, 123, 124, 125, 126, 126, 127, 128, 128, 129, 130, 131, 131, 132, 133, 133,
|
||||||
|
134, 135, 136, 136, 137, 138, 139, 139, 140, 141, 142, 142, 143, 144, 145, 145, 146, 147, 148, 148, 149, 150, 151, 151, 152, 153, 154, 155, 155, 156, 157, 158, 159, 159, 160, 161, 162, 163, 163, 164, 165, 166, 167, 167, 168, 169, 170, 171, 172, 172, 173, 174,
|
||||||
|
175, 176, 177, 177, 178, 179, 180, 181, 182, 183, 183, 184, 185, 186, 187, 188, 189, 190, 190, 191, 192, 193, 194, 195, 196, 197, 198, 198, 199, 200, 201, 202, 203, 204, 205, 206, 207, 208, 208, 209, 210, 211, 212, 213, 214, 215, 216, 217, 218, 219, 220, 221,
|
||||||
|
222, 223, 224, 225, 226, 226, 227, 228, 229, 230, 231, 232, 233, 234, 235, 236, 237, 238, 239, 240, 241, 242, 243, 244, 245, 246, 247, 248, 249, 250, 251, 252, 253, 254, 255, 257, 258, 259, 260, 261, 262, 263, 264, 265, 266, 267, 268, 269, 270, 271, 272, 273,
|
||||||
|
274, 276, 277, 278, 279, 280, 281, 282, 283, 284, 285, 286, 288, 289, 290, 291, 292, 293, 294, 295, 296, 298, 299, 300, 301, 302, 303, 304, 305, 307, 308, 309, 310, 311, 312, 313, 315, 316, 317, 318, 319, 320, 322, 323, 324, 325, 326, 328, 329, 330, 331, 332,
|
||||||
|
333, 335, 336, 337, 338, 339, 341, 342, 343, 344, 346, 347, 348, 349, 350, 352, 353, 354, 355, 357, 358, 359, 360, 362, 363, 364, 365, 367, 368, 369, 370, 372, 373, 374, 375, 377, 378, 379, 381, 382, 383, 384, 386, 387, 388, 390, 391, 392, 393, 395, 396, 397,
|
||||||
|
399, 400, 401, 403, 404, 405, 407, 408, 409, 411, 412, 413, 415, 416, 417, 419, 420, 421, 423, 424, 426, 427, 428, 430, 431, 432, 434, 435, 437, 438, 439, 441, 442, 443, 445, 446, 448, 449, 450, 452, 453, 455, 456, 458, 459, 460, 462, 463, 465, 466, 468, 469,
|
||||||
|
470, 472, 473, 475, 476, 478, 479, 481, 482, 483, 485, 486, 488, 489, 491, 492, 494, 495, 497, 498, 500, 501, 503, 504, 506, 507, 509, 510, 512, 513, 515, 516, 518, 519, 521, 522, 524, 525, 527, 528, 530, 532, 533, 535, 536, 538, 539, 541, 542, 544, 545, 547,
|
||||||
|
549, 550, 552, 553, 555, 556, 558, 560, 561, 563, 564, 566, 568, 569, 571, 572, 574, 576, 577, 579, 580, 582, 584, 585, 587, 589, 590, 592, 593, 595, 597, 598, 600, 602, 603, 605, 607, 608, 610, 612, 613, 615, 617, 618, 620, 622, 623, 625, 627, 628, 630, 632,
|
||||||
|
633, 635, 637, 639, 640, 642, 644, 645, 647, 649, 650, 652, 654, 656, 657, 659, 661, 663, 664, 666, 668, 670, 671, 673, 675, 677, 678, 680, 682, 684, 685, 687, 689, 691, 692, 694, 696, 698, 700, 701, 703, 705, 707, 709, 710, 712, 714, 716, 718, 719, 721, 723,
|
||||||
|
725, 727, 729, 730, 732, 734, 736, 738, 740, 741, 743, 745, 747, 749, 751, 753, 754, 756, 758, 760, 762, 764, 766, 767, 769, 771, 773, 775, 777, 779, 781, 783, 785, 786, 788, 790, 792, 794, 796, 798, 800, 802, 804, 806, 808, 809, 811, 813, 815, 817, 819, 821,
|
||||||
|
823, 825, 827, 829, 831, 833, 835, 837, 839, 841, 843, 845, 847, 849, 851, 853, 855, 857, 859, 861, 863, 865, 867, 869, 871, 873, 875, 877, 879, 881, 883, 885, 887, 889, 891, 893, 895, 897, 899, 901, 903, 905, 907, 910, 912, 914, 916, 918, 920, 922, 924, 926,
|
||||||
|
928, 930, 932, 934, 937, 939, 941, 943, 945, 947, 949, 951, 953, 956, 958, 960, 962, 964, 966, 968, 970, 973, 975, 977, 979, 981, 983, 985, 988, 990, 992, 994, 996, 998, 1001, 1003, 1005, 1007, 1009, 1012, 1014, 1016, 1018, 1020, 1023
|
||||||
|
},
|
||||||
|
.screengammatable = {
|
||||||
|
0, 43, 60, 72, 82, 91, 98, 106, 112, 118, 124, 130, 135, 140, 145, 150, 154, 158, 163, 167, 171, 174, 178, 182, 185, 189, 192, 196, 199, 202, 205, 208, 211, 214, 217, 220, 223, 226, 228, 231, 234, 237, 239, 242, 244, 247, 249, 252, 254, 257, 259, 261,
|
||||||
|
264, 266, 268, 270, 273, 275, 277, 279, 281, 283, 286, 288, 290, 292, 294, 296, 298, 300, 302, 304, 306, 308, 310, 311, 313, 315, 317, 319, 321, 323, 324, 326, 328, 330, 331, 333, 335, 337, 338, 340, 342, 343, 345, 347, 348, 350, 352, 353, 355, 357, 358, 360,
|
||||||
|
361, 363, 365, 366, 368, 369, 371, 372, 374, 375, 377, 378, 380, 381, 383, 384, 386, 387, 389, 390, 392, 393, 394, 396, 397, 399, 400, 401, 403, 404, 406, 407, 408, 410, 411, 412, 414, 415, 416, 418, 419, 420, 422, 423, 424, 426, 427, 428, 430, 431, 432, 433,
|
||||||
|
435, 436, 437, 438, 440, 441, 442, 443, 445, 446, 447, 448, 450, 451, 452, 453, 454, 456, 457, 458, 459, 460, 462, 463, 464, 465, 466, 467, 469, 470, 471, 472, 473, 474, 475, 477, 478, 479, 480, 481, 482, 483, 484, 486, 487, 488, 489, 490, 491, 492, 493, 494,
|
||||||
|
495, 497, 498, 499, 500, 501, 502, 503, 504, 505, 506, 507, 508, 509, 510, 511, 512, 513, 514, 516, 517, 518, 519, 520, 521, 522, 523, 524, 525, 526, 527, 528, 529, 530, 531, 532, 533, 534, 535, 536, 537, 538, 539, 540, 541, 542, 543, 544, 545, 545, 546, 547,
|
||||||
|
548, 549, 550, 551, 552, 553, 554, 555, 556, 557, 558, 559, 560, 561, 562, 563, 563, 564, 565, 566, 567, 568, 569, 570, 571, 572, 573, 574, 574, 575, 576, 577, 578, 579, 580, 581, 582, 583, 583, 584, 585, 586, 587, 588, 589, 590, 591, 591, 592, 593, 594, 595,
|
||||||
|
596, 597, 598, 598, 599, 600, 601, 602, 603, 604, 604, 605, 606, 607, 608, 609, 609, 610, 611, 612, 613, 614, 615, 615, 616, 617, 618, 619, 620, 620, 621, 622, 623, 624, 624, 625, 626, 627, 628, 629, 629, 630, 631, 632, 633, 633, 634, 635, 636, 637, 637, 638,
|
||||||
|
639, 640, 641, 641, 642, 643, 644, 645, 645, 646, 647, 648, 649, 649, 650, 651, 652, 652, 653, 654, 655, 656, 656, 657, 658, 659, 659, 660, 661, 662, 663, 663, 664, 665, 666, 666, 667, 668, 669, 669, 670, 671, 672, 672, 673, 674, 675, 675, 676, 677, 678, 678,
|
||||||
|
679, 680, 681, 681, 682, 683, 684, 684, 685, 686, 686, 687, 688, 689, 689, 690, 691, 692, 692, 693, 694, 694, 695, 696, 697, 697, 698, 699, 700, 700, 701, 702, 702, 703, 704, 705, 705, 706, 707, 707, 708, 709, 709, 710, 711, 712, 712, 713, 714, 714, 715, 716,
|
||||||
|
716, 717, 718, 719, 719, 720, 721, 721, 722, 723, 723, 724, 725, 725, 726, 727, 728, 728, 729, 730, 730, 731, 732, 732, 733, 734, 734, 735, 736, 736, 737, 738, 738, 739, 740, 740, 741, 742, 742, 743, 744, 744, 745, 746, 746, 747, 748, 748, 749, 750, 750, 751,
|
||||||
|
752, 752, 753, 754, 754, 755, 756, 756, 757, 758, 758, 759, 759, 760, 761, 761, 762, 763, 763, 764, 765, 765, 766, 767, 767, 768, 769, 769, 770, 770, 771, 772, 772, 773, 774, 774, 775, 776, 776, 777, 777, 778, 779, 779, 780, 781, 781, 782, 782, 783, 784, 784,
|
||||||
|
785, 786, 786, 787, 787, 788, 789, 789, 790, 791, 791, 792, 792, 793, 794, 794, 795, 795, 796, 797, 797, 798, 799, 799, 800, 800, 801, 802, 802, 803, 803, 804, 805, 805, 806, 806, 807, 808, 808, 809, 809, 810, 811, 811, 812, 812, 813, 814, 814, 815, 815, 816,
|
||||||
|
817, 817, 818, 818, 819, 820, 820, 821, 821, 822, 823, 823, 824, 824, 825, 825, 826, 827, 827, 828, 828, 829, 830, 830, 831, 831, 832, 833, 833, 834, 834, 835, 835, 836, 837, 837, 838, 838, 839, 839, 840, 841, 841, 842, 842, 843, 843, 844, 845, 845, 846, 846,
|
||||||
|
847, 847, 848, 849, 849, 850, 850, 851, 851, 852, 853, 853, 854, 854, 855, 855, 856, 857, 857, 858, 858, 859, 859, 860, 860, 861, 862, 862, 863, 863, 864, 864, 865, 865, 866, 867, 867, 868, 868, 869, 869, 870, 870, 871, 872, 872, 873, 873, 874, 874, 875, 875,
|
||||||
|
876, 876, 877, 878, 878, 879, 879, 880, 880, 881, 881, 882, 882, 883, 884, 884, 885, 885, 886, 886, 887, 887, 888, 888, 889, 889, 890, 891, 891, 892, 892, 893, 893, 894, 894, 895, 895, 896, 896, 897, 898, 898, 899, 899, 900, 900, 901, 901, 902, 902, 903, 903,
|
||||||
|
904, 904, 905, 905, 906, 906, 907, 908, 908, 909, 909, 910, 910, 911, 911, 912, 912, 913, 913, 914, 914, 915, 915, 916, 916, 917, 917, 918, 918, 919, 920, 920, 921, 921, 922, 922, 923, 923, 924, 924, 925, 925, 926, 926, 927, 927, 928, 928, 929, 929, 930, 930,
|
||||||
|
931, 931, 932, 932, 933, 933, 934, 934, 935, 935, 936, 936, 937, 937, 938, 938, 939, 939, 940, 940, 941, 941, 942, 942, 943, 943, 944, 944, 945, 945, 946, 946, 947, 947, 948, 948, 949, 949, 950, 950, 951, 951, 952, 952, 953, 953, 954, 954, 955, 955, 956, 956,
|
||||||
|
957, 957, 958, 958, 959, 959, 960, 960, 961, 961, 962, 962, 963, 963, 964, 964, 965, 965, 966, 966, 967, 967, 968, 968, 969, 969, 969, 970, 970, 971, 971, 972, 972, 973, 973, 974, 974, 975, 975, 976, 976, 977, 977, 978, 978, 979, 979, 980, 980, 981, 981, 982,
|
||||||
|
982, 982, 983, 983, 984, 984, 985, 985, 986, 986, 987, 987, 988, 988, 989, 989, 990, 990, 991, 991, 991, 992, 992, 993, 993, 994, 994, 995, 995, 996, 996, 997, 997, 998, 998, 999, 999, 999, 1000, 1000, 1001, 1001, 1002, 1002, 1003, 1003, 1004, 1004, 1005,
|
||||||
|
1005, 1006, 1006, 1006, 1007, 1007, 1008, 1008, 1009, 1009, 1010, 1010, 1011, 1011, 1012, 1012, 1012, 1013, 1013, 1014, 1014, 1015, 1015, 1016, 1016, 1017, 1017, 1017, 1018, 1018, 1019, 1019, 1020, 1020, 1021, 1021, 1022, 1022, 1023
|
||||||
|
},
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
if( i < 0 || i >= ARRAYSIZE( precomputed_data ))
|
||||||
|
return NULL;
|
||||||
|
|
||||||
|
return &precomputed_data[i];
|
||||||
|
}
|
||||||
|
#endif
|
||||||
@@ -252,7 +252,7 @@ Touch_DumpConfig
|
|||||||
Dump config to file
|
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;
|
file_t *f;
|
||||||
touch_button_t *button;
|
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;
|
touch.move_finger = touch.resize_finger = touch.look_finger = -1;
|
||||||
// Hack for keyboard, hope it help
|
// Hack for keyboard, hope it help
|
||||||
|
// a1ba: this is absolutely horrible
|
||||||
if( cls.key_dest == key_console || cls.key_dest == key_message )
|
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 );
|
Key_EnableTextInput( true, true );
|
||||||
|
x1 = 0.0f;
|
||||||
|
}
|
||||||
|
|
||||||
if( cls.key_dest == key_console )
|
if( cls.key_dest == key_console )
|
||||||
{
|
{
|
||||||
static float y1 = 0;
|
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
|
// exit of console area
|
||||||
if( type == event_down && x < 0.1f && y > 0.9f )
|
if( type == event_down && x < 0.1f && y > 0.9f )
|
||||||
Cbuf_AddText( "escape\n" );
|
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) );
|
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) );
|
//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
|
IN_StartupMouse
|
||||||
===========
|
===========
|
||||||
*/
|
*/
|
||||||
void IN_StartupMouse( void )
|
static void IN_StartupMouse( void )
|
||||||
{
|
{
|
||||||
Cvar_RegisterVariable( &m_ignore );
|
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;
|
static qboolean s_bRawInput, s_bMouseGrab;
|
||||||
|
|
||||||
@@ -313,7 +313,7 @@ void IN_DeactivateMouse( void )
|
|||||||
IN_MouseMove
|
IN_MouseMove
|
||||||
================
|
================
|
||||||
*/
|
*/
|
||||||
void IN_MouseMove( void )
|
static void IN_MouseMove( void )
|
||||||
{
|
{
|
||||||
int x, y;
|
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
|
#if XASH_USE_EVDEV
|
||||||
IN_EvdevFrame();
|
IN_EvdevFrame();
|
||||||
|
|||||||
@@ -332,7 +332,7 @@ int Key_GetKey( const char *pBinding )
|
|||||||
Key_Unbind_f
|
Key_Unbind_f
|
||||||
===================
|
===================
|
||||||
*/
|
*/
|
||||||
void Key_Unbind_f( void )
|
static void Key_Unbind_f( void )
|
||||||
{
|
{
|
||||||
int b;
|
int b;
|
||||||
|
|
||||||
@@ -358,7 +358,7 @@ void Key_Unbind_f( void )
|
|||||||
Key_Unbindall_f
|
Key_Unbindall_f
|
||||||
===================
|
===================
|
||||||
*/
|
*/
|
||||||
void Key_Unbindall_f( void )
|
static void Key_Unbindall_f( void )
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
@@ -378,7 +378,7 @@ void Key_Unbindall_f( void )
|
|||||||
Key_Reset_f
|
Key_Reset_f
|
||||||
===================
|
===================
|
||||||
*/
|
*/
|
||||||
void Key_Reset_f( void )
|
static void Key_Reset_f( void )
|
||||||
{
|
{
|
||||||
keyname_t *kn;
|
keyname_t *kn;
|
||||||
int i;
|
int i;
|
||||||
@@ -400,7 +400,7 @@ void Key_Reset_f( void )
|
|||||||
Key_Bind_f
|
Key_Bind_f
|
||||||
===================
|
===================
|
||||||
*/
|
*/
|
||||||
void Key_Bind_f( void )
|
static void Key_Bind_f( void )
|
||||||
{
|
{
|
||||||
char cmd[1024];
|
char cmd[1024];
|
||||||
int i, c, b;
|
int i, c, b;
|
||||||
@@ -473,7 +473,7 @@ Key_Bindlist_f
|
|||||||
|
|
||||||
============
|
============
|
||||||
*/
|
*/
|
||||||
void Key_Bindlist_f( void )
|
static void Key_Bindlist_f( void )
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
@@ -523,7 +523,7 @@ void Key_Init( void )
|
|||||||
Key_AddKeyCommands
|
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 button[1024];
|
||||||
char *buttonPtr;
|
char *buttonPtr;
|
||||||
|
|||||||
@@ -18,6 +18,31 @@ CVAR_DEFINE_AUTO( r_showtree, "0", FCVAR_ARCHIVE, "build the graph of visible BS
|
|||||||
static CVAR_DEFINE_AUTO( r_refdll, "", FCVAR_RENDERINFO, "choose renderer implementation, if supported" );
|
static CVAR_DEFINE_AUTO( r_refdll, "", FCVAR_RENDERINFO, "choose renderer implementation, if supported" );
|
||||||
static CVAR_DEFINE_AUTO( r_refdll_loaded, "", FCVAR_READ_ONLY, "currently loaded renderer" );
|
static CVAR_DEFINE_AUTO( r_refdll_loaded, "", FCVAR_READ_ONLY, "currently loaded renderer" );
|
||||||
|
|
||||||
|
// there is no need to expose whole host and cl structs into the renderer
|
||||||
|
// but we still need to update timings accurately as possible
|
||||||
|
// this looks horrible but the only other option would be passing four
|
||||||
|
// time pointers and then it's looks even worse with dereferences everywhere
|
||||||
|
#define STATIC_OFFSET_CHECK( s1, s2, field, base, msg ) \
|
||||||
|
STATIC_ASSERT( offsetof( s1, field ) == offsetof( s2, field ) - offsetof( s2, base ), msg )
|
||||||
|
#define REF_CLIENT_CHECK( field ) \
|
||||||
|
STATIC_OFFSET_CHECK( ref_client_t, client_t, field, time, "broken ref_client_t offset" ); \
|
||||||
|
STATIC_ASSERT_( szchk_##__LINE__, sizeof(((ref_client_t *)0)->field ) == sizeof( cl.field ), "broken ref_client_t size" )
|
||||||
|
#define REF_HOST_CHECK( field ) \
|
||||||
|
STATIC_OFFSET_CHECK( ref_host_t, host_parm_t, field, realtime, "broken ref_client_t offset" ); \
|
||||||
|
STATIC_ASSERT_( szchk_##__LINE__, sizeof(((ref_host_t *)0)->field ) == sizeof( host.field ), "broken ref_client_t size" )
|
||||||
|
|
||||||
|
REF_CLIENT_CHECK( time );
|
||||||
|
REF_CLIENT_CHECK( oldtime );
|
||||||
|
REF_CLIENT_CHECK( viewentity );
|
||||||
|
REF_CLIENT_CHECK( playernum );
|
||||||
|
REF_CLIENT_CHECK( maxclients );
|
||||||
|
REF_CLIENT_CHECK( models );
|
||||||
|
REF_CLIENT_CHECK( paused );
|
||||||
|
REF_CLIENT_CHECK( simorg );
|
||||||
|
REF_HOST_CHECK( realtime );
|
||||||
|
REF_HOST_CHECK( frametime );
|
||||||
|
REF_HOST_CHECK( features );
|
||||||
|
|
||||||
void R_GetTextureParms( int *w, int *h, int texnum )
|
void R_GetTextureParms( int *w, int *h, int texnum )
|
||||||
{
|
{
|
||||||
if( w ) *w = REF_GET_PARM( PARM_TEX_WIDTH, texnum );
|
if( w ) *w = REF_GET_PARM( PARM_TEX_WIDTH, texnum );
|
||||||
@@ -42,18 +67,8 @@ void GAME_EXPORT GL_FreeImage( const char *name )
|
|||||||
ref.dllFuncs.GL_FreeTexture( texnum );
|
ref.dllFuncs.GL_FreeTexture( texnum );
|
||||||
}
|
}
|
||||||
|
|
||||||
void R_UpdateRefState( void )
|
|
||||||
{
|
|
||||||
refState.time = cl.time;
|
|
||||||
refState.oldtime = cl.oldtime;
|
|
||||||
refState.realtime = host.realtime;
|
|
||||||
refState.frametime = host.frametime;
|
|
||||||
}
|
|
||||||
|
|
||||||
void GL_RenderFrame( const ref_viewpass_t *rvp )
|
void GL_RenderFrame( const ref_viewpass_t *rvp )
|
||||||
{
|
{
|
||||||
R_UpdateRefState();
|
|
||||||
|
|
||||||
VectorCopy( rvp->vieworigin, refState.vieworg );
|
VectorCopy( rvp->vieworigin, refState.vieworg );
|
||||||
VectorCopy( rvp->viewangles, refState.viewangles );
|
VectorCopy( rvp->viewangles, refState.viewangles );
|
||||||
|
|
||||||
@@ -65,11 +80,6 @@ static intptr_t pfnEngineGetParm( int parm, int arg )
|
|||||||
return CL_RenderGetParm( parm, arg, false ); // prevent recursion
|
return CL_RenderGetParm( parm, arg, false ); // prevent recursion
|
||||||
}
|
}
|
||||||
|
|
||||||
static world_static_t *pfnGetWorld( void )
|
|
||||||
{
|
|
||||||
return &world;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void pfnStudioEvent( const mstudioevent_t *event, const cl_entity_t *e )
|
static void pfnStudioEvent( const mstudioevent_t *event, const cl_entity_t *e )
|
||||||
{
|
{
|
||||||
clgame.dllFuncs.pfnStudioEvent( event, e );
|
clgame.dllFuncs.pfnStudioEvent( event, e );
|
||||||
@@ -99,14 +109,10 @@ static void *pfnMod_Extradata( int type, model_t *m )
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void pfnGetPredictedOrigin( vec3_t v )
|
static void CL_ExtraUpdate( void )
|
||||||
{
|
{
|
||||||
VectorCopy( cl.simorg, v );
|
clgame.dllFuncs.IN_Accumulate();
|
||||||
}
|
S_ExtraUpdate();
|
||||||
|
|
||||||
static color24 *pfnCL_GetPaletteColor( void ) // clgame.palette[color]
|
|
||||||
{
|
|
||||||
return clgame.palette;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void pfnCL_GetScreenInfo( int *width, int *height ) // clgame.scrInfo, ptrs may be NULL
|
static void pfnCL_GetScreenInfo( int *width, int *height ) // clgame.scrInfo, ptrs may be NULL
|
||||||
@@ -178,25 +184,6 @@ static screenfade_t *pfnRefGetScreenFade( void )
|
|||||||
return &clgame.fade;
|
return &clgame.fade;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
===============
|
|
||||||
R_DoResetGamma
|
|
||||||
gamma will be reset for
|
|
||||||
some type of screenshots
|
|
||||||
===============
|
|
||||||
*/
|
|
||||||
static qboolean R_DoResetGamma( void )
|
|
||||||
{
|
|
||||||
switch( cls.scrshot_action )
|
|
||||||
{
|
|
||||||
case scrshot_envshot:
|
|
||||||
case scrshot_skyshot:
|
|
||||||
return true;
|
|
||||||
default:
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
static qboolean R_Init_Video_( const int type )
|
static qboolean R_Init_Video_( const int type )
|
||||||
{
|
{
|
||||||
host.apply_opengl_config = true;
|
host.apply_opengl_config = true;
|
||||||
@@ -207,11 +194,6 @@ static qboolean R_Init_Video_( const int type )
|
|||||||
return R_Init_Video( type );
|
return R_Init_Video( type );
|
||||||
}
|
}
|
||||||
|
|
||||||
static model_t **pfnGetModels( void )
|
|
||||||
{
|
|
||||||
return cl.models;
|
|
||||||
}
|
|
||||||
|
|
||||||
static ref_api_t gEngfuncs =
|
static ref_api_t gEngfuncs =
|
||||||
{
|
{
|
||||||
pfnEngineGetParm,
|
pfnEngineGetParm,
|
||||||
@@ -246,14 +228,12 @@ static ref_api_t gEngfuncs =
|
|||||||
Con_DrawString,
|
Con_DrawString,
|
||||||
CL_DrawCenterPrint,
|
CL_DrawCenterPrint,
|
||||||
|
|
||||||
CL_GetViewModel,
|
|
||||||
R_BeamGetEntity,
|
R_BeamGetEntity,
|
||||||
CL_GetWaterEntity,
|
CL_GetWaterEntity,
|
||||||
CL_AddVisibleEntity,
|
CL_AddVisibleEntity,
|
||||||
|
|
||||||
Mod_SampleSizeForFace,
|
Mod_SampleSizeForFace,
|
||||||
Mod_BoxVisible,
|
Mod_BoxVisible,
|
||||||
pfnGetWorld,
|
|
||||||
Mod_PointInLeaf,
|
Mod_PointInLeaf,
|
||||||
Mod_CreatePolygonsForHull,
|
Mod_CreatePolygonsForHull,
|
||||||
|
|
||||||
@@ -270,7 +250,6 @@ static ref_api_t gEngfuncs =
|
|||||||
|
|
||||||
Mod_ForName,
|
Mod_ForName,
|
||||||
pfnMod_Extradata,
|
pfnMod_Extradata,
|
||||||
pfnGetModels,
|
|
||||||
|
|
||||||
CL_EntitySetRemapColors,
|
CL_EntitySetRemapColors,
|
||||||
CL_GetRemapInfoForEntity,
|
CL_GetRemapInfoForEntity,
|
||||||
@@ -281,8 +260,6 @@ static ref_api_t gEngfuncs =
|
|||||||
COM_RandomFloat,
|
COM_RandomFloat,
|
||||||
COM_RandomLong,
|
COM_RandomLong,
|
||||||
pfnRefGetScreenFade,
|
pfnRefGetScreenFade,
|
||||||
pfnGetPredictedOrigin,
|
|
||||||
pfnCL_GetPaletteColor,
|
|
||||||
pfnCL_GetScreenInfo,
|
pfnCL_GetScreenInfo,
|
||||||
pfnSetLocalLightLevel,
|
pfnSetLocalLightLevel,
|
||||||
Sys_CheckParm,
|
Sys_CheckParm,
|
||||||
@@ -316,9 +293,11 @@ static ref_api_t gEngfuncs =
|
|||||||
SW_LockBuffer,
|
SW_LockBuffer,
|
||||||
SW_UnlockBuffer,
|
SW_UnlockBuffer,
|
||||||
|
|
||||||
BuildGammaTable,
|
|
||||||
LightToTexGamma,
|
LightToTexGamma,
|
||||||
R_DoResetGamma,
|
LightToTexGammaEx,
|
||||||
|
TextureToGamma,
|
||||||
|
ScreenGammaTable,
|
||||||
|
LinearGammaTable,
|
||||||
|
|
||||||
CL_GetLightStyle,
|
CL_GetLightStyle,
|
||||||
CL_GetDynamicLight,
|
CL_GetDynamicLight,
|
||||||
@@ -332,7 +311,6 @@ static ref_api_t gEngfuncs =
|
|||||||
PM_CL_TraceLine,
|
PM_CL_TraceLine,
|
||||||
CL_VisTraceLine,
|
CL_VisTraceLine,
|
||||||
CL_TraceLine,
|
CL_TraceLine,
|
||||||
pfnGetMoveVars,
|
|
||||||
|
|
||||||
Image_AddCmdFlags,
|
Image_AddCmdFlags,
|
||||||
Image_SetForceFlags,
|
Image_SetForceFlags,
|
||||||
@@ -587,7 +565,7 @@ static void R_CollectRendererNames( void )
|
|||||||
"GL4ES",
|
"GL4ES",
|
||||||
#endif
|
#endif
|
||||||
#if XASH_REF_GLES3COMPAT_ENABLED
|
#if XASH_REF_GLES3COMPAT_ENABLED
|
||||||
"GLES3 (gl2_shim)"
|
"GLES3 (gl2_shim)",
|
||||||
#endif
|
#endif
|
||||||
#if XASH_REF_SOFT_ENABLED
|
#if XASH_REF_SOFT_ENABLED
|
||||||
"Software",
|
"Software",
|
||||||
@@ -633,6 +611,7 @@ qboolean R_Init( void )
|
|||||||
|
|
||||||
// cvars that are expected to exist by client.dll
|
// cvars that are expected to exist by client.dll
|
||||||
// refdll should just get pointer to them
|
// 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( "r_drawentities", "1", FCVAR_CHEAT, "render entities" );
|
||||||
Cvar_Get( "cl_himodels", "1", FCVAR_ARCHIVE, "draw high-resolution player models in multiplayer" );
|
Cvar_Get( "cl_himodels", "1", FCVAR_ARCHIVE, "draw high-resolution player models in multiplayer" );
|
||||||
|
|
||||||
|
|||||||
@@ -52,7 +52,6 @@ extern convar_t gl_clear;
|
|||||||
|
|
||||||
qboolean R_Init( void );
|
qboolean R_Init( void );
|
||||||
void R_Shutdown( void );
|
void R_Shutdown( void );
|
||||||
void R_UpdateRefState( void );
|
|
||||||
|
|
||||||
extern triangleapi_t gTriApi;
|
extern triangleapi_t gTriApi;
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
/*
|
/*
|
||||||
s_dsp.c - digital signal processing algorithms for audio FX
|
s_dsp.c - digital signal processing algorithms for audio FX
|
||||||
Copyright (C) 2009 Uncle Mike
|
Copyright (C) 2009 Uncle Mike
|
||||||
|
Copyright (C) 2016-2024 Alibek Omarov
|
||||||
|
|
||||||
This program is free software: you can redistribute it and/or modify
|
This program is free software: you can redistribute it and/or modify
|
||||||
it under the terms of the GNU General Public License as published by
|
it under the terms of the GNU General Public License as published by
|
||||||
@@ -333,7 +334,7 @@ DLY_MovePointer
|
|||||||
Checks overflow and moves pointer
|
Checks overflow and moves pointer
|
||||||
============
|
============
|
||||||
*/
|
*/
|
||||||
_inline void DLY_MovePointer( dly_t *dly )
|
static void DLY_MovePointer( dly_t *dly )
|
||||||
{
|
{
|
||||||
if( ++dly->idelayinput >= dly->cdelaysamplesmax )
|
if( ++dly->idelayinput >= dly->cdelaysamplesmax )
|
||||||
dly->idelayinput = 0;
|
dly->idelayinput = 0;
|
||||||
@@ -806,13 +807,9 @@ DSP_Process
|
|||||||
(xash dsp interface)
|
(xash dsp interface)
|
||||||
===========
|
===========
|
||||||
*/
|
*/
|
||||||
void DSP_Process( int idsp, portable_samplepair_t *pbfront, int sampleCount )
|
void DSP_Process( portable_samplepair_t *pbfront, int sampleCount )
|
||||||
{
|
{
|
||||||
if( dsp_off.value )
|
if( dsp_off.value || !sampleCount )
|
||||||
return;
|
|
||||||
|
|
||||||
// don't process DSP while in menu
|
|
||||||
if( cls.key_dest == key_menu || !sampleCount )
|
|
||||||
return;
|
return;
|
||||||
|
|
||||||
// preset is already installed by CheckNewDspPresets
|
// preset is already installed by CheckNewDspPresets
|
||||||
@@ -833,7 +830,7 @@ DSP_ClearState
|
|||||||
*/
|
*/
|
||||||
void DSP_ClearState( void )
|
void DSP_ClearState( void )
|
||||||
{
|
{
|
||||||
Cvar_SetValue( "room_type", 0.0f );
|
Cvar_DirectSet( &room_type, "0" );
|
||||||
SX_ReloadRoomFX();
|
SX_ReloadRoomFX();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -892,15 +889,15 @@ void CheckNewDspPresets( void )
|
|||||||
|
|
||||||
cur = ptable + idsp_room;
|
cur = ptable + idsp_room;
|
||||||
|
|
||||||
Cvar_SetValue( "room_lp", cur->room_lp );
|
Cvar_DirectSetValue( &sxmod_lowpass, cur->room_lp );
|
||||||
Cvar_SetValue( "room_mod", cur->room_mod );
|
Cvar_DirectSetValue( &sxmod_mod, cur->room_mod );
|
||||||
Cvar_SetValue( "room_size", cur->room_size );
|
Cvar_DirectSetValue( &sxrvb_size, cur->room_size );
|
||||||
Cvar_SetValue( "room_refl", cur->room_refl );
|
Cvar_DirectSetValue( &sxrvb_feedback, cur->room_refl );
|
||||||
Cvar_SetValue( "room_rvblp", cur->room_rvblp );
|
Cvar_DirectSetValue( &sxrvb_lp, cur->room_rvblp );
|
||||||
Cvar_SetValue( "room_delay", cur->room_delay );
|
Cvar_DirectSetValue( &sxdly_delay, cur->room_delay );
|
||||||
Cvar_SetValue( "room_feedback", cur->room_feedback );
|
Cvar_DirectSetValue( &sxdly_feedback, cur->room_feedback );
|
||||||
Cvar_SetValue( "room_dlylp", cur->room_dlylp );
|
Cvar_DirectSetValue( &sxdly_lp, cur->room_dlylp );
|
||||||
Cvar_SetValue( "room_left", cur->room_left );
|
Cvar_DirectSetValue( &sxste_delay, cur->room_left );
|
||||||
}
|
}
|
||||||
|
|
||||||
room_typeprev = idsp_room;
|
room_typeprev = idsp_room;
|
||||||
@@ -929,7 +926,7 @@ static void SX_Profiling_f( void )
|
|||||||
|
|
||||||
if( Cmd_Argc() > 1 )
|
if( Cmd_Argc() > 1 )
|
||||||
{
|
{
|
||||||
Cvar_SetValue( "room_type", Q_atof( Cmd_Argv( 1 )));
|
Cvar_DirectSetValue( &room_type, Q_atof( Cmd_Argv( 1 )));
|
||||||
SX_ReloadRoomFX();
|
SX_ReloadRoomFX();
|
||||||
CheckNewDspPresets(); // we just need idsp_room immediately, for message below
|
CheckNewDspPresets(); // we just need idsp_room immediately, for message below
|
||||||
}
|
}
|
||||||
@@ -939,7 +936,7 @@ static void SX_Profiling_f( void )
|
|||||||
start = Sys_DoubleTime();
|
start = Sys_DoubleTime();
|
||||||
for( calls = 10000; calls; calls-- )
|
for( calls = 10000; calls; calls-- )
|
||||||
{
|
{
|
||||||
DSP_Process( idsp_room, testbuffer, 512 );
|
DSP_Process( testbuffer, 512 );
|
||||||
}
|
}
|
||||||
end = Sys_DoubleTime();
|
end = Sys_DoubleTime();
|
||||||
|
|
||||||
@@ -947,7 +944,7 @@ static void SX_Profiling_f( void )
|
|||||||
|
|
||||||
if( Cmd_Argc() > 1 )
|
if( Cmd_Argc() > 1 )
|
||||||
{
|
{
|
||||||
Cvar_SetValue( "room_type", oldroom );
|
Cvar_DirectSetValue( &room_type, oldroom );
|
||||||
SX_ReloadRoomFX();
|
SX_ReloadRoomFX();
|
||||||
CheckNewDspPresets();
|
CheckNewDspPresets();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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_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( 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" );
|
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_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_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" );
|
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;
|
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 )
|
if( !s_listener.inmenu && soundfade.percent != 0 )
|
||||||
{
|
{
|
||||||
scale = bound( 0.0f, soundfade.percent / 100.0f, 1.0f );
|
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
|
S_IsClient
|
||||||
=================
|
=================
|
||||||
*/
|
*/
|
||||||
qboolean S_IsClient( int entnum )
|
static qboolean S_IsClient( int entnum )
|
||||||
{
|
{
|
||||||
return ( entnum == s_listener.entnum );
|
return ( entnum == s_listener.entnum );
|
||||||
}
|
}
|
||||||
@@ -124,7 +130,7 @@ void S_FreeChannel( channel_t *ch )
|
|||||||
S_UpdateSoundFade
|
S_UpdateSoundFade
|
||||||
=================
|
=================
|
||||||
*/
|
*/
|
||||||
void S_UpdateSoundFade( void )
|
static void S_UpdateSoundFade( void )
|
||||||
{
|
{
|
||||||
float f, totaltime, elapsed;
|
float f, totaltime, elapsed;
|
||||||
|
|
||||||
@@ -184,7 +190,7 @@ override any other sound playing on the same channel (see code comments below fo
|
|||||||
exceptions).
|
exceptions).
|
||||||
=================
|
=================
|
||||||
*/
|
*/
|
||||||
qboolean SND_FStreamIsPlaying( sfx_t *sfx )
|
static qboolean SND_FStreamIsPlaying( sfx_t *sfx )
|
||||||
{
|
{
|
||||||
int ch_idx;
|
int ch_idx;
|
||||||
|
|
||||||
@@ -399,7 +405,7 @@ returns TRUE if sound was altered,
|
|||||||
returns FALSE if sound was not found (sound is not playing)
|
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;
|
channel_t *ch;
|
||||||
int i;
|
int i;
|
||||||
@@ -457,7 +463,7 @@ int S_AlterChannel( int entnum, int channel, sfx_t *sfx, int vol, int pitch, int
|
|||||||
S_SpatializeChannel
|
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;
|
float lscale, rscale, scale;
|
||||||
|
|
||||||
@@ -480,7 +486,7 @@ void S_SpatializeChannel( int *left_vol, int *right_vol, int master_vol, float g
|
|||||||
SND_Spatialize
|
SND_Spatialize
|
||||||
=================
|
=================
|
||||||
*/
|
*/
|
||||||
void SND_Spatialize( channel_t *ch )
|
static void SND_Spatialize( channel_t *ch )
|
||||||
{
|
{
|
||||||
vec3_t source_vec;
|
vec3_t source_vec;
|
||||||
float dist, dot, gain = 1.0f;
|
float dist, dot, gain = 1.0f;
|
||||||
@@ -648,20 +654,6 @@ void S_StartSound( const vec3_t pos, int ent, int chan, sound_t handle, float fv
|
|||||||
|
|
||||||
// Init client entity mouth movement vars
|
// Init client entity mouth movement vars
|
||||||
SND_InitMouth( ent, chan );
|
SND_InitMouth( ent, chan );
|
||||||
|
|
||||||
for( ch_idx = NUM_AMBIENTS, check = channels + NUM_AMBIENTS; ch_idx < MAX_DYNAMIC_CHANNELS; ch_idx++, check++)
|
|
||||||
{
|
|
||||||
if( check == target_chan ) continue;
|
|
||||||
|
|
||||||
if( check->sfx == sfx && !check->pMixer.sample )
|
|
||||||
{
|
|
||||||
// skip up to 0.1 seconds of audio
|
|
||||||
int skip = COM_RandomLong( 0, (long)( 0.1f * check->sfx->cache->rate ));
|
|
||||||
|
|
||||||
S_SetSampleStart( check, sfx->cache, skip );
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -967,7 +959,7 @@ int S_GetCurrentDynamicSounds( soundlist_t *pout, int size )
|
|||||||
S_InitAmbientChannels
|
S_InitAmbientChannels
|
||||||
===================
|
===================
|
||||||
*/
|
*/
|
||||||
void S_InitAmbientChannels( void )
|
static void S_InitAmbientChannels( void )
|
||||||
{
|
{
|
||||||
int ambient_channel;
|
int ambient_channel;
|
||||||
channel_t *chan;
|
channel_t *chan;
|
||||||
@@ -989,7 +981,7 @@ void S_InitAmbientChannels( void )
|
|||||||
S_UpdateAmbientSounds
|
S_UpdateAmbientSounds
|
||||||
===================
|
===================
|
||||||
*/
|
*/
|
||||||
void S_UpdateAmbientSounds( void )
|
static void S_UpdateAmbientSounds( void )
|
||||||
{
|
{
|
||||||
mleaf_t *leaf;
|
mleaf_t *leaf;
|
||||||
float vol;
|
float vol;
|
||||||
@@ -1421,7 +1413,7 @@ static void S_FreeRawChannels( void )
|
|||||||
S_ClearBuffer
|
S_ClearBuffer
|
||||||
==================
|
==================
|
||||||
*/
|
*/
|
||||||
void S_ClearBuffer( void )
|
static void S_ClearBuffer( void )
|
||||||
{
|
{
|
||||||
S_ClearRawChannels();
|
S_ClearRawChannels();
|
||||||
|
|
||||||
@@ -1520,7 +1512,7 @@ static int S_GetSoundtime( void )
|
|||||||
}
|
}
|
||||||
|
|
||||||
//=============================================================================
|
//=============================================================================
|
||||||
void S_UpdateChannels( void )
|
static void S_UpdateChannels( void )
|
||||||
{
|
{
|
||||||
uint endtime;
|
uint endtime;
|
||||||
int samps;
|
int samps;
|
||||||
@@ -1709,7 +1701,7 @@ console functions
|
|||||||
|
|
||||||
===============================================================================
|
===============================================================================
|
||||||
*/
|
*/
|
||||||
void S_Play_f( void )
|
static void S_Play_f( void )
|
||||||
{
|
{
|
||||||
if( Cmd_Argc() == 1 )
|
if( Cmd_Argc() == 1 )
|
||||||
{
|
{
|
||||||
@@ -1720,7 +1712,7 @@ void S_Play_f( void )
|
|||||||
S_StartLocalSound( Cmd_Argv( 1 ), VOL_NORM, false );
|
S_StartLocalSound( Cmd_Argv( 1 ), VOL_NORM, false );
|
||||||
}
|
}
|
||||||
|
|
||||||
void S_Play2_f( void )
|
static void S_Play2_f( void )
|
||||||
{
|
{
|
||||||
int i = 1;
|
int i = 1;
|
||||||
|
|
||||||
@@ -1737,7 +1729,7 @@ void S_Play2_f( void )
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void S_PlayVol_f( void )
|
static void S_PlayVol_f( void )
|
||||||
{
|
{
|
||||||
if( Cmd_Argc() == 1 )
|
if( Cmd_Argc() == 1 )
|
||||||
{
|
{
|
||||||
@@ -1763,7 +1755,7 @@ static void S_Say( const char *name, qboolean reliable )
|
|||||||
S_StartLocalSound( sentence, 1.0f, reliable );
|
S_StartLocalSound( sentence, 1.0f, reliable );
|
||||||
}
|
}
|
||||||
|
|
||||||
void S_Say_f( void )
|
static void S_Say_f( void )
|
||||||
{
|
{
|
||||||
if( Cmd_Argc() == 1 )
|
if( Cmd_Argc() == 1 )
|
||||||
{
|
{
|
||||||
@@ -1774,7 +1766,7 @@ void S_Say_f( void )
|
|||||||
S_Say( Cmd_Argv( 1 ), false );
|
S_Say( Cmd_Argv( 1 ), false );
|
||||||
}
|
}
|
||||||
|
|
||||||
void S_SayReliable_f( void )
|
static void S_SayReliable_f( void )
|
||||||
{
|
{
|
||||||
if( Cmd_Argc() == 1 )
|
if( Cmd_Argc() == 1 )
|
||||||
{
|
{
|
||||||
@@ -1790,7 +1782,7 @@ void S_SayReliable_f( void )
|
|||||||
S_Music_f
|
S_Music_f
|
||||||
=================
|
=================
|
||||||
*/
|
*/
|
||||||
void S_Music_f( void )
|
static void S_Music_f( void )
|
||||||
{
|
{
|
||||||
int c = Cmd_Argc();
|
int c = Cmd_Argc();
|
||||||
|
|
||||||
@@ -1854,7 +1846,7 @@ void S_Music_f( void )
|
|||||||
S_StopSound_f
|
S_StopSound_f
|
||||||
=================
|
=================
|
||||||
*/
|
*/
|
||||||
void S_StopSound_f( void )
|
static void S_StopSound_f( void )
|
||||||
{
|
{
|
||||||
S_StopAllSounds( true );
|
S_StopAllSounds( true );
|
||||||
}
|
}
|
||||||
@@ -1864,7 +1856,7 @@ void S_StopSound_f( void )
|
|||||||
S_SoundFade_f
|
S_SoundFade_f
|
||||||
=================
|
=================
|
||||||
*/
|
*/
|
||||||
void S_SoundFade_f( void )
|
static void S_SoundFade_f( void )
|
||||||
{
|
{
|
||||||
int c = Cmd_Argc();
|
int c = Cmd_Argc();
|
||||||
float fadeTime = 5.0f;
|
float fadeTime = 5.0f;
|
||||||
@@ -1898,7 +1890,7 @@ void S_SoundInfo_f( void )
|
|||||||
S_VoiceRecordStart_f
|
S_VoiceRecordStart_f
|
||||||
=================
|
=================
|
||||||
*/
|
*/
|
||||||
void S_VoiceRecordStart_f( void )
|
static void S_VoiceRecordStart_f( void )
|
||||||
{
|
{
|
||||||
if( cls.state != ca_active || cls.legacymode )
|
if( cls.state != ca_active || cls.legacymode )
|
||||||
return;
|
return;
|
||||||
@@ -1911,7 +1903,7 @@ void S_VoiceRecordStart_f( void )
|
|||||||
S_VoiceRecordStop_f
|
S_VoiceRecordStop_f
|
||||||
=================
|
=================
|
||||||
*/
|
*/
|
||||||
void S_VoiceRecordStop_f( void )
|
static void S_VoiceRecordStop_f( void )
|
||||||
{
|
{
|
||||||
if( cls.state != ca_active || !Voice_IsRecording() )
|
if( cls.state != ca_active || !Voice_IsRecording() )
|
||||||
return;
|
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 *snd_p, snd_linear_count;
|
||||||
int lpos, lpaintedtime;
|
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 *lscale, *rscale;
|
||||||
int i, data;
|
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;
|
int *lscale, *rscale;
|
||||||
uint left, right;
|
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 left, right;
|
||||||
int i, data;
|
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;
|
uint *data;
|
||||||
int left, right;
|
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;
|
int i, sampleIndex = 0;
|
||||||
uint sampleFrac = inputOffset;
|
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;
|
int i, sampleIndex = 0;
|
||||||
uint sampleFrac = inputOffset;
|
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;
|
int i, sampleIndex = 0;
|
||||||
uint sampleFrac = inputOffset;
|
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;
|
int i, sampleIndex = 0;
|
||||||
uint sampleFrac = inputOffset;
|
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];
|
int pvol[CCHANVOLUMES];
|
||||||
paintbuffer_t *ppaint = MIX_GetCurrentPaintbufferPtr();
|
paintbuffer_t *ppaint = MIX_GetCurrentPaintbufferPtr();
|
||||||
@@ -496,7 +496,7 @@ int S_MixDataToDevice( channel_t *pChannel, int sampleCount, int outRate, int ou
|
|||||||
return outOffset - startingOffset;
|
return outOffset - startingOffset;
|
||||||
}
|
}
|
||||||
|
|
||||||
qboolean S_ShouldContinueMixing( channel_t *ch )
|
static qboolean S_ShouldContinueMixing( channel_t *ch )
|
||||||
{
|
{
|
||||||
if( ch->isSentence )
|
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.
|
// this routine will fill the paintbuffer to endtime. Otherwise, fewer samples are mixed.
|
||||||
// if( endtime - paintedtime ) is not aligned on boundaries of 4,
|
// if( endtime - paintedtime ) is not aligned on boundaries of 4,
|
||||||
// we'll miss data if outputRate < SOUND_DMA_SPEED!
|
// 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;
|
channel_t *ch;
|
||||||
wavdata_t *pSource;
|
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.
|
// if NULL then perform no filtering.
|
||||||
// count: how many samples to upsample. will become count*2 samples in buffer, in place.
|
// 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.
|
// 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
|
// prevfilter: filter memory. NOTE: this must match the filtertype ie: filterlinear[] for FILTERTYPE_LINEAR
|
||||||
// if NULL then perform no filtering.
|
// if NULL then perform no filtering.
|
||||||
// count: how many samples to upsample. will become count*2 samples in buffer, in place.
|
// 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;
|
int i, upCount = count<<1;
|
||||||
|
|
||||||
@@ -769,7 +769,7 @@ void S_Interpolate2xLinear( portable_samplepair_t *pbuffer, portable_samplepair_
|
|||||||
// if NULL then perform no filtering.
|
// if NULL then perform no filtering.
|
||||||
// cfltmem: max number of sample pairs filter can use
|
// cfltmem: max number of sample pairs filter can use
|
||||||
// filtertype: FILTERTYPE_NONE, _LINEAR, _CUBIC etc. Must match prevfilter.
|
// 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 upCount = count<<1;
|
||||||
int i, j;
|
int i, j;
|
||||||
@@ -822,7 +822,7 @@ void MIX_ClearAllPaintBuffers( int SampleCount, qboolean clearFilters )
|
|||||||
// mixes pbuf1 + pbuf2 into pbuf3, count samples
|
// mixes pbuf1 + pbuf2 into pbuf3, count samples
|
||||||
// fgain is output gain 0-1.0
|
// fgain is output gain 0-1.0
|
||||||
// NOTE: pbuf3 may equal pbuf1 or pbuf2!
|
// 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;
|
portable_samplepair_t *pbuf1, *pbuf2, *pbuf3;
|
||||||
int i, gain;
|
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;
|
portable_samplepair_t *pbuf;
|
||||||
paintbuffer_t *ppaint;
|
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();
|
paintbuffer_t *ppaint = MIX_GetCurrentPaintbufferPtr();
|
||||||
int ifilter = ppaint->ifilter;
|
int ifilter = ppaint->ifilter;
|
||||||
@@ -884,7 +884,7 @@ void S_MixUpsample( int sampleCount, int filtertype )
|
|||||||
ppaint->ifilter++;
|
ppaint->ifilter++;
|
||||||
}
|
}
|
||||||
|
|
||||||
void MIX_MixRawSamplesBuffer( int end )
|
static void MIX_MixRawSamplesBuffer( int end )
|
||||||
{
|
{
|
||||||
portable_samplepair_t *pbuf, *roombuf, *streambuf;
|
portable_samplepair_t *pbuf, *roombuf, *streambuf;
|
||||||
uint i, j, stop;
|
uint i, j, stop;
|
||||||
@@ -928,7 +928,7 @@ void MIX_MixRawSamplesBuffer( int end )
|
|||||||
// IROOMBUFFER, IFACINGBUFFER, IFACINGAWAY
|
// IROOMBUFFER, IFACINGBUFFER, IFACINGAWAY
|
||||||
// dsp fx are then applied to these buffers by the caller.
|
// dsp fx are then applied to these buffers by the caller.
|
||||||
// caller also remixes all into final IPAINTBUFFER output.
|
// 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
|
// 11khz sounds are mixed into 3 buffers based on distance from listener, and facing direction
|
||||||
// These buffers are facing, facingaway, room
|
// These buffers are facing, facingaway, room
|
||||||
@@ -999,7 +999,8 @@ void MIX_PaintChannels( int endtime )
|
|||||||
MIX_UpsampleAllPaintbuffers( end, count );
|
MIX_UpsampleAllPaintbuffers( end, count );
|
||||||
|
|
||||||
// process all sounds with DSP
|
// process all sounds with DSP
|
||||||
DSP_Process( idsp_room, MIX_GetPFrontFromIPaint( IROOMBUFFER ), count );
|
if( cls.key_dest != key_menu )
|
||||||
|
DSP_Process( MIX_GetPFrontFromIPaint( IROOMBUFFER ), count );
|
||||||
|
|
||||||
// add music or soundtrack from movie (no dsp)
|
// add music or soundtrack from movie (no dsp)
|
||||||
MIX_MixPaintbuffers( IPAINTBUFFER, IROOMBUFFER, IPAINTBUFFER, count, S_GetMasterVolume() );
|
MIX_MixPaintbuffers( IPAINTBUFFER, IROOMBUFFER, IPAINTBUFFER, count, S_GetMasterVolume() );
|
||||||
|
|||||||
@@ -96,6 +96,7 @@ void S_StartBackgroundTrack( const char *introTrack, const char *mainTrack, int
|
|||||||
|
|
||||||
// open stream
|
// open stream
|
||||||
s_bgTrack.stream = FS_OpenStream( introTrack );
|
s_bgTrack.stream = FS_OpenStream( introTrack );
|
||||||
|
|
||||||
Q_strncpy( s_bgTrack.current, introTrack, sizeof( s_bgTrack.current ));
|
Q_strncpy( s_bgTrack.current, introTrack, sizeof( s_bgTrack.current ));
|
||||||
memset( &musicfade, 0, sizeof( musicfade )); // clear any soundfade
|
memset( &musicfade, 0, sizeof( musicfade )); // clear any soundfade
|
||||||
s_bgTrack.source = cls.key_dest;
|
s_bgTrack.source = cls.key_dest;
|
||||||
|
|||||||
@@ -16,204 +16,6 @@ GNU General Public License for more details.
|
|||||||
#include "common.h"
|
#include "common.h"
|
||||||
#include "sound.h"
|
#include "sound.h"
|
||||||
|
|
||||||
// hardcoded macros to test for zero crossing
|
|
||||||
#define ZERO_X_8( b ) (( b ) < 2 && ( b ) > -2 )
|
|
||||||
#define ZERO_X_16( b ) (( b ) < 512 && ( b ) > -512 )
|
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
|
||||||
// Purpose: Search backward for a zero crossing starting at sample
|
|
||||||
// Input : sample - starting point
|
|
||||||
// Output : position of zero crossing
|
|
||||||
//-----------------------------------------------------------------------------
|
|
||||||
int S_ZeroCrossingBefore( wavdata_t *pWaveData, int sample )
|
|
||||||
{
|
|
||||||
if( pWaveData == NULL )
|
|
||||||
return sample;
|
|
||||||
|
|
||||||
if( pWaveData->type == WF_PCMDATA )
|
|
||||||
{
|
|
||||||
int sampleSize;
|
|
||||||
|
|
||||||
sampleSize = pWaveData->width * pWaveData->channels;
|
|
||||||
|
|
||||||
// this can never be zero -- other functions divide by this.
|
|
||||||
// This should never happen, but avoid crashing
|
|
||||||
if( sampleSize <= 0 ) sampleSize = 1;
|
|
||||||
|
|
||||||
if( pWaveData->width == 1 )
|
|
||||||
{
|
|
||||||
signed char *pData = (signed char *)(pWaveData->buffer + sample * sampleSize);
|
|
||||||
qboolean zero = false;
|
|
||||||
|
|
||||||
if( pWaveData->channels == 1 )
|
|
||||||
{
|
|
||||||
while( sample > 0 && !zero )
|
|
||||||
{
|
|
||||||
if( ZERO_X_8( *pData ))
|
|
||||||
{
|
|
||||||
zero = true;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
sample--;
|
|
||||||
pData--;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
while( sample > 0 && !zero )
|
|
||||||
{
|
|
||||||
if( ZERO_X_8( *pData ) && ZERO_X_8( pData[1] ))
|
|
||||||
{
|
|
||||||
zero = true;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
sample--;
|
|
||||||
pData--;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
short *pData = (short *)(pWaveData->buffer + sample * sampleSize);
|
|
||||||
qboolean zero = false;
|
|
||||||
|
|
||||||
if( pWaveData->channels == 1 )
|
|
||||||
{
|
|
||||||
while( sample > 0 && !zero )
|
|
||||||
{
|
|
||||||
if( ZERO_X_16(*pData ))
|
|
||||||
{
|
|
||||||
zero = true;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
pData--;
|
|
||||||
sample--;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
while( sample > 0 && !zero )
|
|
||||||
{
|
|
||||||
if( ZERO_X_16( *pData ) && ZERO_X_16( pData[1] ))
|
|
||||||
{
|
|
||||||
zero = true;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
sample--;
|
|
||||||
pData--;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return sample;
|
|
||||||
}
|
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
|
||||||
// Purpose: Search forward for a zero crossing
|
|
||||||
// Input : sample - starting point
|
|
||||||
// Output : position of found zero crossing
|
|
||||||
//-----------------------------------------------------------------------------
|
|
||||||
int S_ZeroCrossingAfter( wavdata_t *pWaveData, int sample )
|
|
||||||
{
|
|
||||||
if( pWaveData == NULL )
|
|
||||||
return sample;
|
|
||||||
|
|
||||||
if( pWaveData->type == WF_PCMDATA )
|
|
||||||
{
|
|
||||||
int sampleSize;
|
|
||||||
|
|
||||||
sampleSize = pWaveData->width * pWaveData->channels;
|
|
||||||
|
|
||||||
// this can never be zero -- other functions divide by this.
|
|
||||||
// This should never happen, but avoid crashing
|
|
||||||
if( sampleSize <= 0 ) sampleSize = 1;
|
|
||||||
|
|
||||||
if( pWaveData->width == 1 ) // 8-bit
|
|
||||||
{
|
|
||||||
signed char *pData = (signed char *)(pWaveData->buffer + sample * sampleSize);
|
|
||||||
qboolean zero = false;
|
|
||||||
|
|
||||||
if( pWaveData->channels == 1 )
|
|
||||||
{
|
|
||||||
while( sample < pWaveData->samples && !zero )
|
|
||||||
{
|
|
||||||
if( ZERO_X_8( *pData ))
|
|
||||||
{
|
|
||||||
zero = true;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
sample++;
|
|
||||||
pData++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
while( sample < pWaveData->samples && !zero )
|
|
||||||
{
|
|
||||||
if( ZERO_X_8( *pData ) && ZERO_X_8( pData[1] ))
|
|
||||||
{
|
|
||||||
zero = true;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
sample++;
|
|
||||||
pData++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
short *pData = (short *)(pWaveData->buffer + sample * sampleSize);
|
|
||||||
qboolean zero = false;
|
|
||||||
|
|
||||||
if( pWaveData->channels == 1 )
|
|
||||||
{
|
|
||||||
while( sample > 0 && !zero )
|
|
||||||
{
|
|
||||||
if( ZERO_X_16( *pData ))
|
|
||||||
{
|
|
||||||
zero = true;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
pData++;
|
|
||||||
sample++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
while( sample > 0 && !zero )
|
|
||||||
{
|
|
||||||
if( ZERO_X_16( *pData ) && ZERO_X_16( pData[1] ))
|
|
||||||
{
|
|
||||||
zero = true;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
sample++;
|
|
||||||
pData++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return sample;
|
|
||||||
}
|
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
// Purpose: wrap the position wrt looping
|
// Purpose: wrap the position wrt looping
|
||||||
// Input : samplePosition - absolute position
|
// Input : samplePosition - absolute position
|
||||||
@@ -279,28 +81,3 @@ int S_GetOutputData( wavdata_t *pSource, void **pData, int samplePosition, int s
|
|||||||
|
|
||||||
return sampleCount;
|
return sampleCount;
|
||||||
}
|
}
|
||||||
|
|
||||||
// move the current position to newPosition
|
|
||||||
void S_SetSampleStart( channel_t *pChan, wavdata_t *pSource, int newPosition )
|
|
||||||
{
|
|
||||||
if( pSource )
|
|
||||||
newPosition = S_ZeroCrossingAfter( pSource, newPosition );
|
|
||||||
|
|
||||||
pChan->pMixer.sample = newPosition;
|
|
||||||
}
|
|
||||||
|
|
||||||
// end playback at newEndPosition
|
|
||||||
void S_SetSampleEnd( channel_t *pChan, wavdata_t *pSource, int newEndPosition )
|
|
||||||
{
|
|
||||||
// forced end of zero means play the whole sample
|
|
||||||
if( !newEndPosition ) newEndPosition = 1;
|
|
||||||
|
|
||||||
if( pSource )
|
|
||||||
newEndPosition = S_ZeroCrossingBefore( pSource, newEndPosition );
|
|
||||||
|
|
||||||
// past current position? limit.
|
|
||||||
if( newEndPosition < pChan->pMixer.sample )
|
|
||||||
newEndPosition = pChan->pMixer.sample;
|
|
||||||
|
|
||||||
pChan->pMixer.forcedEndSample = newEndPosition;
|
|
||||||
}
|
|
||||||
|
|||||||
@@ -18,10 +18,126 @@ GNU General Public License for more details.
|
|||||||
#include "const.h"
|
#include "const.h"
|
||||||
#include <ctype.h>
|
#include <ctype.h>
|
||||||
|
|
||||||
|
#define TRIM_SCAN_MAX 255
|
||||||
|
#define TRIM_SAMPLES_BELOW_8 2
|
||||||
|
#define TRIM_SAMPLES_BELOW_16 512 // 65k * 2 / 256
|
||||||
|
|
||||||
|
#define CVOXFILESENTENCEMAX 4096
|
||||||
|
|
||||||
static int cszrawsentences = 0;
|
static int cszrawsentences = 0;
|
||||||
static char *rgpszrawsentence[CVOXFILESENTENCEMAX];
|
static char *rgpszrawsentence[CVOXFILESENTENCEMAX];
|
||||||
static const char *voxperiod = "_period", *voxcomma = "_comma";
|
static const char *voxperiod = "_period", *voxcomma = "_comma";
|
||||||
|
|
||||||
|
static qboolean S_ShouldTrimSample8( const int8_t *buf, int channels )
|
||||||
|
{
|
||||||
|
if( abs( buf[0] ) > TRIM_SAMPLES_BELOW_8 )
|
||||||
|
return false;
|
||||||
|
|
||||||
|
if( channels >= 2 && abs( buf[1] ) > TRIM_SAMPLES_BELOW_8 )
|
||||||
|
return false;
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
static qboolean S_ShouldTrimSample16( const int16_t *buf, int channels )
|
||||||
|
{
|
||||||
|
if( abs( buf[0] ) > TRIM_SAMPLES_BELOW_16 )
|
||||||
|
return false;
|
||||||
|
|
||||||
|
if( channels >= 2 && abs( buf[1] ) > TRIM_SAMPLES_BELOW_16 )
|
||||||
|
return false;
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int S_TrimStart( const wavdata_t *wav, int start )
|
||||||
|
{
|
||||||
|
size_t channels = wav->channels, width = wav->width, i;
|
||||||
|
|
||||||
|
if( wav->type != WF_PCMDATA )
|
||||||
|
return start;
|
||||||
|
|
||||||
|
if( width == 1 )
|
||||||
|
{
|
||||||
|
const int8_t *data = (const int8_t *)&wav->buffer[channels * width * start];
|
||||||
|
|
||||||
|
for( i = 0; i < TRIM_SCAN_MAX && start < wav->samples; i++ )
|
||||||
|
{
|
||||||
|
if( !S_ShouldTrimSample8( data, wav->channels ))
|
||||||
|
break;
|
||||||
|
|
||||||
|
start += channels;
|
||||||
|
data += channels;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if( width == 2 )
|
||||||
|
{
|
||||||
|
const int16_t *data = (const int16_t *)&wav->buffer[channels * width * start];
|
||||||
|
|
||||||
|
for( i = 0; i < TRIM_SCAN_MAX && start < wav->samples; i++ )
|
||||||
|
{
|
||||||
|
if( !S_ShouldTrimSample16( data, wav->channels ))
|
||||||
|
break;
|
||||||
|
|
||||||
|
start += channels;
|
||||||
|
data += channels;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return start;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int S_TrimEnd( const wavdata_t *wav, int end )
|
||||||
|
{
|
||||||
|
size_t channels = wav->channels, width = wav->width, i;
|
||||||
|
|
||||||
|
if( wav->type != WF_PCMDATA )
|
||||||
|
return end;
|
||||||
|
|
||||||
|
if( width == 1 )
|
||||||
|
{
|
||||||
|
const int8_t *data = (const int8_t *)&wav->buffer[channels * width * end];
|
||||||
|
|
||||||
|
for( i = 0; i < TRIM_SCAN_MAX && end > 0; i++ )
|
||||||
|
{
|
||||||
|
if( !S_ShouldTrimSample8( data, wav->channels ))
|
||||||
|
break;
|
||||||
|
|
||||||
|
end -= channels;
|
||||||
|
data -= channels;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if( width == 2 )
|
||||||
|
{
|
||||||
|
const int16_t *data = (const int16_t *)&wav->buffer[channels * width * end];
|
||||||
|
|
||||||
|
for( i = 0; i < TRIM_SCAN_MAX && end > 0; i++ )
|
||||||
|
{
|
||||||
|
if( !S_ShouldTrimSample16( data, wav->channels ))
|
||||||
|
break;
|
||||||
|
|
||||||
|
end -= channels;
|
||||||
|
data -= channels;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return end;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void S_TrimStartEndTimes( channel_t *ch, wavdata_t *wav, int start, int end )
|
||||||
|
{
|
||||||
|
ch->pMixer.sample = start = S_TrimStart( wav, start );
|
||||||
|
|
||||||
|
// don't overrun the buffer while trimming end
|
||||||
|
if( end == 0 )
|
||||||
|
end = wav->samples - wav->channels;
|
||||||
|
|
||||||
|
if( end < start )
|
||||||
|
end = start;
|
||||||
|
|
||||||
|
ch->pMixer.forcedEndSample = S_TrimEnd( wav, end );
|
||||||
|
}
|
||||||
|
|
||||||
// return number of samples mixed
|
// return number of samples mixed
|
||||||
int VOX_MixDataToDevice( channel_t *pchan, int sampleCount, int outputRate, int outputOffset )
|
int VOX_MixDataToDevice( channel_t *pchan, int sampleCount, int outputRate, int outputOffset )
|
||||||
{
|
{
|
||||||
@@ -78,11 +194,7 @@ void VOX_LoadWord( channel_t *ch )
|
|||||||
|
|
||||||
if( end <= start ) end = 0;
|
if( end <= start ) end = 0;
|
||||||
|
|
||||||
if( start )
|
S_TrimStartEndTimes( ch, data, start * 0.01f * samples, end * 0.01f * samples );
|
||||||
S_SetSampleStart( ch, data, start * 0.01f * samples );
|
|
||||||
|
|
||||||
if( end )
|
|
||||||
S_SetSampleEnd( ch, data, end * 0.01f * samples );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void VOX_FreeWord( channel_t *ch )
|
void VOX_FreeWord( channel_t *ch )
|
||||||
|
|||||||
@@ -221,7 +221,6 @@ extern convar_t s_musicvolume;
|
|||||||
extern convar_t s_lerping;
|
extern convar_t s_lerping;
|
||||||
extern convar_t s_test; // cvar to testify new effects
|
extern convar_t s_test; // cvar to testify new effects
|
||||||
extern convar_t s_samplecount;
|
extern convar_t s_samplecount;
|
||||||
extern convar_t snd_mute_losefocus;
|
|
||||||
extern convar_t s_warn_late_precache;
|
extern convar_t s_warn_late_precache;
|
||||||
|
|
||||||
void S_InitScaletable( void );
|
void S_InitScaletable( void );
|
||||||
@@ -255,8 +254,7 @@ void S_InitSounds( void );
|
|||||||
void SX_Init( void );
|
void SX_Init( void );
|
||||||
void SX_Free( void );
|
void SX_Free( void );
|
||||||
void CheckNewDspPresets( void );
|
void CheckNewDspPresets( void );
|
||||||
void DSP_Process( int idsp, portable_samplepair_t *pbfront, int sampleCount );
|
void DSP_Process( portable_samplepair_t *pbfront, int sampleCount );
|
||||||
float DSP_GetGain( int idsp );
|
|
||||||
void DSP_ClearState( void );
|
void DSP_ClearState( void );
|
||||||
|
|
||||||
qboolean S_Init( void );
|
qboolean S_Init( void );
|
||||||
@@ -305,8 +303,6 @@ int S_ZeroCrossingAfter( wavdata_t *pWaveData, int sample );
|
|||||||
int S_ZeroCrossingBefore( wavdata_t *pWaveData, int sample );
|
int S_ZeroCrossingBefore( wavdata_t *pWaveData, int sample );
|
||||||
int S_ConvertLoopedPosition( wavdata_t *pSource, int samplePosition, qboolean use_loop );
|
int S_ConvertLoopedPosition( wavdata_t *pSource, int samplePosition, qboolean use_loop );
|
||||||
int S_GetOutputData( wavdata_t *pSource, void **pData, int samplePosition, int sampleCount, qboolean use_loop );
|
int S_GetOutputData( wavdata_t *pSource, void **pData, int samplePosition, int sampleCount, qboolean use_loop );
|
||||||
void S_SetSampleStart( channel_t *pChan, wavdata_t *pSource, int newPosition );
|
|
||||||
void S_SetSampleEnd( channel_t *pChan, wavdata_t *pSource, int newEndPosition );
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// s_vox.c
|
// s_vox.c
|
||||||
|
|||||||
@@ -20,10 +20,6 @@ GNU General Public License for more details.
|
|||||||
#include "vid_common.h"
|
#include "vid_common.h"
|
||||||
#include "platform/platform.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( vid_brightness, "brightness", "0.0", FCVAR_ARCHIVE, "brightness factor" );
|
|
||||||
static CVAR_DEFINE( vid_gamma, "gamma", "2.5", FCVAR_ARCHIVE, "gamma amount" );
|
|
||||||
static CVAR_DEFINE_AUTO( vid_mode, "0", FCVAR_RENDERINFO, "current video mode index (used only for storage)" );
|
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_rotate, "0", FCVAR_RENDERINFO|FCVAR_VIDRESTART, "screen rotation (0-3)" );
|
||||||
static CVAR_DEFINE_AUTO( vid_scale, "1.0", FCVAR_RENDERINFO|FCVAR_VIDRESTART, "pixel scale" );
|
static CVAR_DEFINE_AUTO( vid_scale, "1.0", FCVAR_RENDERINFO|FCVAR_VIDRESTART, "pixel scale" );
|
||||||
@@ -31,24 +27,13 @@ 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_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_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( 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_xpos, "_window_xpos", "-1", FCVAR_RENDERINFO, "window position by horizontal" );
|
||||||
CVAR_DEFINE( window_ypos, "_window_ypos", "-1", FCVAR_RENDERINFO, "window position by vertical" );
|
CVAR_DEFINE( window_ypos, "_window_ypos", "-1", FCVAR_RENDERINFO, "window position by vertical" );
|
||||||
|
|
||||||
glwstate_t glw_state;
|
glwstate_t glw_state;
|
||||||
|
|
||||||
/*
|
|
||||||
=================
|
|
||||||
VID_StartupGamma
|
|
||||||
=================
|
|
||||||
*/
|
|
||||||
void VID_StartupGamma( void )
|
|
||||||
{
|
|
||||||
BuildGammaTable( vid_gamma.value, vid_brightness.value );
|
|
||||||
Con_Reportf( "VID_StartupGamma: gamma %g brightness %g\n", vid_gamma.value, vid_brightness.value );
|
|
||||||
ClearBits( vid_brightness.flags, FCVAR_CHANGED );
|
|
||||||
ClearBits( vid_gamma.flags, FCVAR_CHANGED );
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
=================
|
=================
|
||||||
VID_InitDefaultResolution
|
VID_InitDefaultResolution
|
||||||
@@ -224,8 +209,6 @@ void VID_Init( void )
|
|||||||
Cvar_RegisterVariable( &vid_scale );
|
Cvar_RegisterVariable( &vid_scale );
|
||||||
Cvar_RegisterVariable( &vid_fullscreen );
|
Cvar_RegisterVariable( &vid_fullscreen );
|
||||||
Cvar_RegisterVariable( &vid_maximized );
|
Cvar_RegisterVariable( &vid_maximized );
|
||||||
Cvar_RegisterVariable( &vid_brightness );
|
|
||||||
Cvar_RegisterVariable( &vid_gamma );
|
|
||||||
Cvar_RegisterVariable( &window_xpos );
|
Cvar_RegisterVariable( &window_xpos );
|
||||||
Cvar_RegisterVariable( &window_ypos );
|
Cvar_RegisterVariable( &window_ypos );
|
||||||
|
|
||||||
@@ -233,5 +216,6 @@ void VID_Init( void )
|
|||||||
// but supported mode list is filled by backends, so numbers are not portable any more
|
// but supported mode list is filled by backends, so numbers are not portable any more
|
||||||
Cmd_AddRestrictedCommand( "vid_setmode", VID_Mode_f, "display video mode" );
|
Cmd_AddRestrictedCommand( "vid_setmode", VID_Mode_f, "display video mode" );
|
||||||
|
|
||||||
|
V_Init(); // init gamma
|
||||||
R_Init(); // init renderer
|
R_Init(); // init renderer
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -38,6 +38,8 @@ extern glwstate_t glw_state;
|
|||||||
extern convar_t vid_fullscreen;
|
extern convar_t vid_fullscreen;
|
||||||
extern convar_t vid_maximized;
|
extern convar_t vid_maximized;
|
||||||
extern convar_t vid_highdpi;
|
extern convar_t vid_highdpi;
|
||||||
|
extern convar_t window_width;
|
||||||
|
extern convar_t window_height;
|
||||||
extern convar_t window_xpos;
|
extern convar_t window_xpos;
|
||||||
extern convar_t window_ypos;
|
extern convar_t window_ypos;
|
||||||
extern convar_t gl_msaa_samples;
|
extern convar_t gl_msaa_samples;
|
||||||
@@ -46,6 +48,5 @@ void R_SaveVideoMode( int w, int h, int render_w, int render_h, qboolean maximiz
|
|||||||
void VID_SetDisplayTransform( int *render_w, int *render_h );
|
void VID_SetDisplayTransform( int *render_w, int *render_h );
|
||||||
void VID_CheckChanges( void );
|
void VID_CheckChanges( void );
|
||||||
const char *VID_GetModeString( int vid_mode );
|
const char *VID_GetModeString( int vid_mode );
|
||||||
void VID_StartupGamma( void );
|
|
||||||
|
|
||||||
#endif // VID_COMMON
|
#endif // VID_COMMON
|
||||||
|
|||||||
@@ -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_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_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_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_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_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" );
|
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
|
Voice_InitOpusDecoder
|
||||||
@@ -47,24 +67,17 @@ Voice_InitOpusDecoder
|
|||||||
*/
|
*/
|
||||||
static qboolean Voice_InitOpusDecoder( void )
|
static qboolean Voice_InitOpusDecoder( void )
|
||||||
{
|
{
|
||||||
int err;
|
int err = 0;
|
||||||
|
|
||||||
voice.width = sizeof( opus_int16 );
|
for( int i = 0; i < cl.maxclients; i++ )
|
||||||
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 ));
|
voice.decoders[i] = opus_custom_decoder_create( voice.custom_mode, VOICE_PCM_CHANNELS, &err );
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
voice.decoder = opus_custom_decoder_create( voice.custom_mode, VOICE_PCM_CHANNELS, &err );
|
if( !voice.decoders[i] )
|
||||||
if( !voice.decoder )
|
{
|
||||||
{
|
Con_Printf( S_ERROR "Can't create Opus decoder for %i: %s\n", i, opus_strerror( err ));
|
||||||
Con_Printf( S_ERROR "Can't create Opus encoder: %s\n", opus_strerror( err ));
|
return false;
|
||||||
return false;
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
@@ -78,7 +91,7 @@ Voice_InitOpusEncoder
|
|||||||
*/
|
*/
|
||||||
static qboolean Voice_InitOpusEncoder( int quality )
|
static qboolean Voice_InitOpusEncoder( int quality )
|
||||||
{
|
{
|
||||||
int err;
|
int err = 0;
|
||||||
|
|
||||||
voice.encoder = opus_custom_encoder_create( voice.custom_mode, VOICE_PCM_CHANNELS, &err );
|
voice.encoder = opus_custom_encoder_create( voice.custom_mode, VOICE_PCM_CHANNELS, &err );
|
||||||
if( !voice.encoder )
|
if( !voice.encoder )
|
||||||
@@ -117,10 +130,13 @@ Voice_ShutdownOpusDecoder
|
|||||||
*/
|
*/
|
||||||
static void Voice_ShutdownOpusDecoder( void )
|
static void Voice_ShutdownOpusDecoder( void )
|
||||||
{
|
{
|
||||||
if( voice.decoder )
|
for( int i = 0; i < MAX_CLIENTS; i++ )
|
||||||
{
|
{
|
||||||
opus_custom_decoder_destroy( voice.decoder );
|
if( !voice.decoders[i] )
|
||||||
voice.decoder = NULL;
|
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 );
|
opus_custom_encoder_destroy( voice.encoder );
|
||||||
voice.encoder = NULL;
|
voice.encoder = NULL;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static void Voice_ShutdownCustomMode( void )
|
||||||
|
{
|
||||||
if( voice.custom_mode )
|
if( voice.custom_mode )
|
||||||
{
|
{
|
||||||
opus_custom_mode_destroy( 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 )
|
if( !voice.input_file )
|
||||||
{
|
{
|
||||||
// adjust gain before encoding, but only for input from voice
|
// 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
|
#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;
|
float gain, modifiedMax;
|
||||||
int average, adjustedSample, blockOffset = 0;
|
int average, blockOffset = 0;
|
||||||
|
|
||||||
for( ;; )
|
for( ;; )
|
||||||
{
|
{
|
||||||
@@ -260,10 +279,8 @@ static void Voice_ApplyGainAdjust( int16_t *samples, int count )
|
|||||||
localMax = absSample;
|
localMax = absSample;
|
||||||
|
|
||||||
localSum += absSample;
|
localSum += absSample;
|
||||||
|
|
||||||
gain = voice.autogain.current_gain + i * voice.autogain.gain_multiplier;
|
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] = bound( SHRT_MIN, (int)( sample * gain ), SHRT_MAX );
|
||||||
samples[blockOffset + i] = adjustedSample;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if( blockOffset % voice.autogain.block_size == 0 )
|
if( blockOffset % voice.autogain.block_size == 0 )
|
||||||
@@ -271,9 +288,9 @@ static void Voice_ApplyGainAdjust( int16_t *samples, int count )
|
|||||||
average = localSum / blockSize;
|
average = localSum / blockSize;
|
||||||
modifiedMax = average + ( localMax - average ) * voice_avggain.value;
|
modifiedMax = average + ( localMax - average ) * voice_avggain.value;
|
||||||
|
|
||||||
voice.autogain.current_gain = voice.autogain.next_gain * voice_scale.value;
|
voice.autogain.current_gain = voice.autogain.next_gain * scale;
|
||||||
voice.autogain.next_gain = Q_min( (float)SHRT_MAX / modifiedMax, voice_maxgain.value ) * voice_scale.value;
|
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 ) / ( voice.autogain.block_size - 1 );
|
voice.autogain.gain_multiplier = ( voice.autogain.next_gain - voice.autogain.current_gain ) / ( blockSize - 1 );
|
||||||
}
|
}
|
||||||
blockOffset += blockSize;
|
blockOffset += blockSize;
|
||||||
}
|
}
|
||||||
@@ -428,6 +445,9 @@ void Voice_Disconnect( void )
|
|||||||
voice.players_status[i].talking_ack = false;
|
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 )
|
static void Voice_StartChannel( uint samples, byte *data, int entnum )
|
||||||
{
|
{
|
||||||
SND_ForceInitMouth( 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 )
|
void Voice_AddIncomingData( int ent, const byte *data, uint size, uint frames )
|
||||||
{
|
{
|
||||||
|
const int playernum = ent - 1;
|
||||||
int samples = 0;
|
int samples = 0;
|
||||||
int ofs = 0;
|
int ofs = 0;
|
||||||
|
|
||||||
if( !voice.decoder )
|
if( playernum < 0 || playernum >= cl.maxclients || !voice.decoders[playernum] )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
// decode frame by frame
|
// 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 )
|
if( ofs + compressed_size > size )
|
||||||
break;
|
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 );
|
(opus_int16*)voice.decompress_buffer + samples, voice.frame_size );
|
||||||
|
|
||||||
ofs += compressed_size;
|
ofs += compressed_size;
|
||||||
@@ -499,8 +520,8 @@ void CL_AddVoiceToDatagram( void )
|
|||||||
|
|
||||||
if( cls.state != ca_active || !Voice_IsRecording() || !voice.encoder )
|
if( cls.state != ca_active || !Voice_IsRecording() || !voice.encoder )
|
||||||
return;
|
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 )
|
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, voice_loopback.value != 0 );
|
||||||
MSG_WriteByte( &cls.datagram, frames );
|
MSG_WriteByte( &cls.datagram, frames );
|
||||||
MSG_WriteShort( &cls.datagram, size );
|
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_enable );
|
||||||
Cvar_RegisterVariable( &voice_loopback );
|
Cvar_RegisterVariable( &voice_loopback );
|
||||||
Cvar_RegisterVariable( &voice_scale );
|
Cvar_RegisterVariable( &voice_scale );
|
||||||
|
Cvar_RegisterVariable( &voice_transmit_scale );
|
||||||
Cvar_RegisterVariable( &voice_avggain );
|
Cvar_RegisterVariable( &voice_avggain );
|
||||||
Cvar_RegisterVariable( &voice_maxgain );
|
Cvar_RegisterVariable( &voice_maxgain );
|
||||||
Cvar_RegisterVariable( &voice_inputfromfile );
|
Cvar_RegisterVariable( &voice_inputfromfile );
|
||||||
@@ -541,8 +563,9 @@ static void Voice_Shutdown( void )
|
|||||||
int i;
|
int i;
|
||||||
|
|
||||||
Voice_RecordStop();
|
Voice_RecordStop();
|
||||||
Voice_ShutdownOpusEncoder();
|
|
||||||
Voice_ShutdownOpusDecoder();
|
Voice_ShutdownOpusDecoder();
|
||||||
|
Voice_ShutdownOpusEncoder();
|
||||||
|
Voice_ShutdownCustomMode();
|
||||||
VoiceCapture_Shutdown();
|
VoiceCapture_Shutdown();
|
||||||
|
|
||||||
if( voice.local.talking_ack )
|
if( voice.local.talking_ack )
|
||||||
@@ -588,48 +611,62 @@ Voice_Init
|
|||||||
Initialize the voice subsystem
|
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 )
|
if( !voice_enable.value )
|
||||||
return false;
|
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
|
// reinitialize only if codec parameters are different
|
||||||
if( !Q_strcmp( voice.codec, pszCodecName ) && voice.quality == quality )
|
if( Q_strcmp( pszCodecName, voice.codec ) || voice.quality != quality )
|
||||||
return true;
|
|
||||||
|
|
||||||
Voice_Shutdown();
|
|
||||||
|
|
||||||
voice.autogain.block_size = 128;
|
|
||||||
|
|
||||||
if( !Voice_InitOpusDecoder( ))
|
|
||||||
{
|
{
|
||||||
// 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();
|
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
|
if( !preinit )
|
||||||
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" );
|
Voice_ShutdownOpusDecoder();
|
||||||
return false;
|
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;
|
return true;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -53,6 +53,7 @@ typedef struct voice_state_s
|
|||||||
|
|
||||||
qboolean initialized;
|
qboolean initialized;
|
||||||
qboolean is_recording;
|
qboolean is_recording;
|
||||||
|
qboolean device_opened;
|
||||||
double start_time;
|
double start_time;
|
||||||
|
|
||||||
voice_status_t local;
|
voice_status_t local;
|
||||||
@@ -61,7 +62,7 @@ typedef struct voice_state_s
|
|||||||
// opus stuff
|
// opus stuff
|
||||||
OpusCustomMode *custom_mode;
|
OpusCustomMode *custom_mode;
|
||||||
OpusCustomEncoder *encoder;
|
OpusCustomEncoder *encoder;
|
||||||
OpusCustomDecoder *decoder;
|
OpusCustomDecoder *decoders[MAX_CLIENTS];
|
||||||
|
|
||||||
// audio info
|
// audio info
|
||||||
uint width;
|
uint width;
|
||||||
@@ -70,7 +71,7 @@ typedef struct voice_state_s
|
|||||||
|
|
||||||
// buffers
|
// buffers
|
||||||
byte input_buffer[MAX_RAW_SAMPLES];
|
byte input_buffer[MAX_RAW_SAMPLES];
|
||||||
byte output_buffer[MAX_RAW_SAMPLES];
|
byte compress_buffer[MAX_RAW_SAMPLES];
|
||||||
byte decompress_buffer[MAX_RAW_SAMPLES];
|
byte decompress_buffer[MAX_RAW_SAMPLES];
|
||||||
fs_offset_t input_buffer_pos; // in bytes
|
fs_offset_t input_buffer_pos; // in bytes
|
||||||
|
|
||||||
@@ -92,7 +93,7 @@ extern voice_state_t voice;
|
|||||||
void CL_AddVoiceToDatagram( void );
|
void CL_AddVoiceToDatagram( void );
|
||||||
|
|
||||||
void Voice_RegisterCvars( 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 );
|
void Voice_Idle( double frametime );
|
||||||
qboolean Voice_IsRecording( void );
|
qboolean Voice_IsRecording( void );
|
||||||
void Voice_RecordStop( void );
|
void Voice_RecordStop( void );
|
||||||
|
|||||||
@@ -17,7 +17,6 @@ GNU General Public License for more details.
|
|||||||
#define VOX_H
|
#define VOX_H
|
||||||
|
|
||||||
#define CVOXWORDMAX 64
|
#define CVOXWORDMAX 64
|
||||||
#define CVOXFILESENTENCEMAX 4096
|
|
||||||
|
|
||||||
#define SENTENCE_INDEX -99999 // unique sentence index
|
#define SENTENCE_INDEX -99999 // unique sentence index
|
||||||
|
|
||||||
|
|||||||
@@ -52,7 +52,7 @@ CSCR_ExpectString
|
|||||||
Return true if next token is pExpext and skip it
|
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 ));
|
char *tmp = COM_ParseFile( ps->buf, ps->token, sizeof( ps->token ));
|
||||||
|
|
||||||
@@ -75,7 +75,7 @@ CSCR_ParseType
|
|||||||
Determine script variable type
|
Determine script variable type
|
||||||
===================
|
===================
|
||||||
*/
|
*/
|
||||||
cvartype_t CSCR_ParseType( parserstate_t *ps )
|
static cvartype_t CSCR_ParseType( parserstate_t *ps )
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
@@ -96,7 +96,7 @@ cvartype_t CSCR_ParseType( parserstate_t *ps )
|
|||||||
CSCR_ParseSingleCvar
|
CSCR_ParseSingleCvar
|
||||||
=========================
|
=========================
|
||||||
*/
|
*/
|
||||||
qboolean CSCR_ParseSingleCvar( parserstate_t *ps, scrvardef_t *result )
|
static qboolean CSCR_ParseSingleCvar( parserstate_t *ps, scrvardef_t *result )
|
||||||
{
|
{
|
||||||
// read the name
|
// read the name
|
||||||
ps->buf = COM_ParseFile( ps->buf, result->name, sizeof( result->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
|
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 ))
|
if( !CSCR_ExpectString( ps, "VERSION", false, true ))
|
||||||
return false;
|
return false;
|
||||||
|
|||||||
@@ -53,7 +53,7 @@ static void Cmd_ExecuteStringWithPrivilegeCheck( const char *text, qboolean isPr
|
|||||||
Cbuf_Init
|
Cbuf_Init
|
||||||
============
|
============
|
||||||
*/
|
*/
|
||||||
void Cbuf_Init( void )
|
static void Cbuf_Init( void )
|
||||||
{
|
{
|
||||||
cmd_text.data = cmd_text_buf;
|
cmd_text.data = cmd_text_buf;
|
||||||
filteredcmd_text.data = filteredcmd_text_buf;
|
filteredcmd_text.data = filteredcmd_text_buf;
|
||||||
@@ -79,7 +79,7 @@ void Cbuf_Clear( void )
|
|||||||
Cbuf_GetSpace
|
Cbuf_GetSpace
|
||||||
============
|
============
|
||||||
*/
|
*/
|
||||||
void *Cbuf_GetSpace( cmdbuf_t *buf, int length )
|
static void *Cbuf_GetSpace( cmdbuf_t *buf, int length )
|
||||||
{
|
{
|
||||||
void *data;
|
void *data;
|
||||||
|
|
||||||
@@ -176,7 +176,7 @@ void Cbuf_InsertText( const char *text )
|
|||||||
Cbuf_Execute
|
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 *text;
|
||||||
char line[MAX_CMD_LINE];
|
char line[MAX_CMD_LINE];
|
||||||
@@ -356,7 +356,7 @@ hl.exe -dev 3 +map c1a0d
|
|||||||
hl.exe -nosound -game bshift
|
hl.exe -nosound -game bshift
|
||||||
===============
|
===============
|
||||||
*/
|
*/
|
||||||
void Cmd_StuffCmds_f( void )
|
static void Cmd_StuffCmds_f( void )
|
||||||
{
|
{
|
||||||
host.stuffcmds_pending = true;
|
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"
|
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;
|
cmd_wait = true;
|
||||||
}
|
}
|
||||||
@@ -382,7 +382,7 @@ Cmd_Echo_f
|
|||||||
Just prints the rest of the line to the console
|
Just prints the rest of the line to the console
|
||||||
===============
|
===============
|
||||||
*/
|
*/
|
||||||
void Cmd_Echo_f( void )
|
static void Cmd_Echo_f( void )
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
@@ -398,7 +398,7 @@ Cmd_Alias_f
|
|||||||
Creates a new command that executes a command string (possibly ; seperated)
|
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;
|
cmdalias_t *a;
|
||||||
char cmd[MAX_CMD_LINE];
|
char cmd[MAX_CMD_LINE];
|
||||||
@@ -529,7 +529,6 @@ typedef struct cmd_s
|
|||||||
static int cmd_argc;
|
static int cmd_argc;
|
||||||
static const char *cmd_args = NULL;
|
static const char *cmd_args = NULL;
|
||||||
static char *cmd_argv[MAX_CMD_TOKENS];
|
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
|
static cmd_t *cmd_functions; // possible commands to execute
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -882,7 +881,7 @@ Cmd_If_f
|
|||||||
Compare and et condition bit if true
|
Compare and et condition bit if true
|
||||||
============
|
============
|
||||||
*/
|
*/
|
||||||
void Cmd_If_f( void )
|
static void Cmd_If_f( void )
|
||||||
{
|
{
|
||||||
// reset bit first
|
// reset bit first
|
||||||
cmd_condition &= ~BIT( cmd_condlevel );
|
cmd_condition &= ~BIT( cmd_condlevel );
|
||||||
@@ -943,14 +942,14 @@ Cmd_Else_f
|
|||||||
Invert condition bit
|
Invert condition bit
|
||||||
============
|
============
|
||||||
*/
|
*/
|
||||||
void Cmd_Else_f( void )
|
static void Cmd_Else_f( void )
|
||||||
{
|
{
|
||||||
cmd_condition ^= BIT( cmd_condlevel );
|
cmd_condition ^= BIT( cmd_condlevel );
|
||||||
}
|
}
|
||||||
|
|
||||||
static qboolean Cmd_ShouldAllowCommand( cmd_t *cmd, qboolean isPrivileged )
|
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;
|
int i;
|
||||||
|
|
||||||
// always allow local commands
|
// always allow local commands
|
||||||
@@ -1179,7 +1178,7 @@ void Cmd_ForwardToServer( void )
|
|||||||
Cmd_List_f
|
Cmd_List_f
|
||||||
============
|
============
|
||||||
*/
|
*/
|
||||||
void Cmd_List_f( void )
|
static void Cmd_List_f( void )
|
||||||
{
|
{
|
||||||
cmd_t *cmd;
|
cmd_t *cmd;
|
||||||
int i = 0;
|
int i = 0;
|
||||||
|
|||||||
@@ -17,15 +17,24 @@ GNU General Public License for more details.
|
|||||||
#define COM_STRINGS_H
|
#define COM_STRINGS_H
|
||||||
|
|
||||||
// default colored message headers
|
// default colored message headers
|
||||||
#define S_NOTE "^2Note:^7 "
|
#define S_BLACK "^0"
|
||||||
#define S_WARN "^3Warning:^7 "
|
#define S_RED "^1"
|
||||||
#define S_ERROR "^1Error:^7 "
|
#define S_GREEN "^2"
|
||||||
#define S_USAGE "Usage: "
|
#define S_YELLOW "^3"
|
||||||
#define S_USAGE_INDENT " "
|
#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_NOTE S_GREEN "Note: " S_DEFAULT
|
||||||
#define S_OPENGL_WARN "^3OpenGL Warning:^7 "
|
#define S_WARN S_YELLOW "Warning: " S_DEFAULT
|
||||||
#define S_OPENGL_ERROR "^3OpenGL Error:^7 "
|
#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
|
// end game final default message
|
||||||
#define DEFAULT_ENDGAME_MESSAGE "The End"
|
#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 DEFAULT_UPDATE_PAGE "https://github.com/FWGS/xash3d-fwgs/releases/latest"
|
||||||
|
|
||||||
#define XASH_ENGINE_NAME "Xash3D FWGS"
|
#define XASH_ENGINE_NAME "Xash3D FWGS"
|
||||||
|
#define XASH_DEDICATED_SERVER_NAME "XashDS"
|
||||||
#define XASH_VERSION "0.20" // engine current version
|
#define XASH_VERSION "0.20" // engine current version
|
||||||
#define XASH_COMPAT_VERSION "0.99" // version we are based on
|
#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;
|
byte *pFinal = NULL;
|
||||||
lzss_state_t state;
|
lzss_state_t state;
|
||||||
|
|
||||||
|
if( !pStart )
|
||||||
|
return NULL;
|
||||||
|
|
||||||
memset( &state, 0, sizeof( state ));
|
memset( &state, 0, sizeof( state ));
|
||||||
state.window_size = LZSS_WINDOW_SIZE;
|
state.window_size = LZSS_WINDOW_SIZE;
|
||||||
|
|
||||||
@@ -531,47 +534,6 @@ int GAME_EXPORT COM_FileSize( const char *filename )
|
|||||||
return FS_FileSize( filename, false );
|
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
|
COM_TrimSpace
|
||||||
@@ -734,7 +696,7 @@ COM_LoadFileForMe
|
|||||||
byte *GAME_EXPORT COM_LoadFileForMe( const char *filename, int *pLength )
|
byte *GAME_EXPORT COM_LoadFileForMe( const char *filename, int *pLength )
|
||||||
{
|
{
|
||||||
string name;
|
string name;
|
||||||
byte *file, *pfile;
|
byte *pfile;
|
||||||
fs_offset_t iLength;
|
fs_offset_t iLength;
|
||||||
|
|
||||||
if( !COM_CheckString( filename ))
|
if( !COM_CheckString( filename ))
|
||||||
@@ -747,21 +709,9 @@ byte *GAME_EXPORT COM_LoadFileForMe( const char *filename, int *pLength )
|
|||||||
Q_strncpy( name, filename, sizeof( name ));
|
Q_strncpy( name, filename, sizeof( name ));
|
||||||
COM_FixSlashes( name );
|
COM_FixSlashes( name );
|
||||||
|
|
||||||
pfile = FS_LoadFile( name, &iLength, false );
|
pfile = g_fsapi.LoadFileMalloc( name, &iLength, false );
|
||||||
if( pLength ) *pLength = (int)iLength;
|
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;
|
return pfile;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -869,18 +819,6 @@ cvar_t *GAME_EXPORT pfnCVarGetPointer( const char *szVarName )
|
|||||||
return (cvar_t *)Cvar_FindVar( 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
|
COM_CompareFileTime
|
||||||
@@ -996,21 +934,6 @@ qboolean COM_IsSafeFileToDownload( const char *filename )
|
|||||||
return true;
|
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 )
|
char *_copystring( poolhandle_t mempool, const char *s, const char *filename, int fileline )
|
||||||
{
|
{
|
||||||
size_t size;
|
size_t size;
|
||||||
|
|||||||
@@ -302,8 +302,12 @@ typedef struct host_parm_s
|
|||||||
int argc;
|
int argc;
|
||||||
char **argv;
|
char **argv;
|
||||||
|
|
||||||
|
// ==== shared through RefAPI's ref_host_t
|
||||||
double realtime; // host.curtime
|
double realtime; // host.curtime
|
||||||
double frametime; // time between engine frames
|
double frametime; // time between engine frames
|
||||||
|
uint features; // custom features that enables by mod-maker request
|
||||||
|
// ==== shared through RefAPI's ref_host_t
|
||||||
|
|
||||||
double realframetime; // for some system events, e.g. console animations
|
double realframetime; // for some system events, e.g. console animations
|
||||||
|
|
||||||
uint framecount; // global framecount
|
uint framecount; // global framecount
|
||||||
@@ -344,8 +348,6 @@ typedef struct host_parm_s
|
|||||||
poolhandle_t imagepool; // imagelib mempool
|
poolhandle_t imagepool; // imagelib mempool
|
||||||
poolhandle_t soundpool; // soundlib mempool
|
poolhandle_t soundpool; // soundlib mempool
|
||||||
|
|
||||||
uint features; // custom features that enables by mod-maker request
|
|
||||||
|
|
||||||
// for IN_MouseMove() easy access
|
// for IN_MouseMove() easy access
|
||||||
int window_center_x;
|
int window_center_x;
|
||||||
int window_center_y;
|
int window_center_y;
|
||||||
@@ -386,7 +388,6 @@ void *FS_GetNativeObject( const char *obj );
|
|||||||
//
|
//
|
||||||
// cmd.c
|
// cmd.c
|
||||||
//
|
//
|
||||||
void Cbuf_Init( void );
|
|
||||||
void Cbuf_Clear( void );
|
void Cbuf_Clear( void );
|
||||||
void Cbuf_AddText( const char *text );
|
void Cbuf_AddText( const char *text );
|
||||||
void Cbuf_AddTextf( const char *text, ... ) _format( 1 );
|
void Cbuf_AddTextf( const char *text, ... ) _format( 1 );
|
||||||
@@ -410,9 +411,6 @@ void Cmd_RemoveCommand( const char *cmd_name );
|
|||||||
qboolean Cmd_Exists( const char *cmd_name );
|
qboolean Cmd_Exists( const char *cmd_name );
|
||||||
void Cmd_LookupCmds( void *buffer, void *ptr, setpair_t callback );
|
void Cmd_LookupCmds( void *buffer, void *ptr, setpair_t callback );
|
||||||
int Cmd_ListMaps( search_t *t , char *lastmapname, size_t len );
|
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_TokenizeString( const char *text );
|
||||||
void Cmd_ExecuteString( const char *text );
|
void Cmd_ExecuteString( const char *text );
|
||||||
void Cmd_ForwardToServer( void );
|
void Cmd_ForwardToServer( void );
|
||||||
@@ -459,13 +457,12 @@ void FS_FreeImage( rgbdata_t *pack );
|
|||||||
extern const bpc_desc_t PFDesc[]; // image get pixelformat
|
extern const bpc_desc_t PFDesc[]; // image get pixelformat
|
||||||
qboolean Image_Process( rgbdata_t **pix, int width, int height, uint flags, float reserved );
|
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_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
|
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 );
|
qboolean Image_CustomPalette( void );
|
||||||
void Image_ClearForceFlags( void );
|
void Image_ClearForceFlags( void );
|
||||||
void Image_SetMDLPointer( byte *p );
|
void Image_SetMDLPointer( byte *p );
|
||||||
void Image_CheckPaletteQ1( void );
|
void Image_CheckPaletteQ1( void );
|
||||||
|
|
||||||
/*
|
/*
|
||||||
========================================================================
|
========================================================================
|
||||||
|
|
||||||
@@ -541,7 +538,6 @@ qboolean Host_IsQuakeCompatible( void );
|
|||||||
void EXPORT Host_Shutdown( void );
|
void EXPORT Host_Shutdown( void );
|
||||||
int EXPORT Host_Main( int argc, char **argv, const char *progname, int bChangeGame, pfnChangeGame func );
|
int EXPORT Host_Main( int argc, char **argv, const char *progname, int bChangeGame, pfnChangeGame func );
|
||||||
int Host_CompareFileTime( int ft1, int ft2 );
|
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_EndGame( qboolean abort, const char *message, ... ) _format( 2 );
|
||||||
void Host_AbortCurrentFrame( void ) NORETURN;
|
void Host_AbortCurrentFrame( void ) NORETURN;
|
||||||
void Host_WriteServerConfig( const char *name );
|
void Host_WriteServerConfig( const char *name );
|
||||||
@@ -552,9 +548,8 @@ qboolean Host_IsLocalGame( void );
|
|||||||
qboolean Host_IsLocalClient( void );
|
qboolean Host_IsLocalClient( void );
|
||||||
void Host_ShutdownServer( void );
|
void Host_ShutdownServer( void );
|
||||||
void Host_Error( const char *error, ... ) _format( 1 );
|
void Host_Error( const char *error, ... ) _format( 1 );
|
||||||
void Host_PrintEngineFeatures( int features );
|
void Host_ValidateEngineFeatures( uint32_t features );
|
||||||
void Host_Frame( float time );
|
void Host_Frame( float time );
|
||||||
void Host_InitDecals( void );
|
|
||||||
void Host_Credits( void );
|
void Host_Credits( void );
|
||||||
|
|
||||||
//
|
//
|
||||||
@@ -598,7 +593,6 @@ void COM_HexConvert( const char *pszInput, int nInputLength, byte *pOutput );
|
|||||||
int COM_SaveFile( const char *filename, const void *data, int len );
|
int COM_SaveFile( const char *filename, const void *data, int len );
|
||||||
byte* COM_LoadFileForMe( const char *filename, int *pLength );
|
byte* COM_LoadFileForMe( const char *filename, int *pLength );
|
||||||
qboolean COM_IsSafeFileToDownload( const char *filename );
|
qboolean COM_IsSafeFileToDownload( const char *filename );
|
||||||
const char *COM_GetResourceTypeName( resourcetype_t restype );
|
|
||||||
cvar_t *pfnCVarGetPointer( const char *szVarName );
|
cvar_t *pfnCVarGetPointer( const char *szVarName );
|
||||||
int pfnDrawConsoleString( int x, int y, char *string );
|
int pfnDrawConsoleString( int x, int y, char *string );
|
||||||
void pfnDrawSetTextColor( float r, float g, float b );
|
void pfnDrawSetTextColor( float r, float g, float b );
|
||||||
@@ -606,7 +600,6 @@ void pfnDrawConsoleStringLen( const char *pText, int *length, int *height );
|
|||||||
void *Cache_Check( poolhandle_t mempool, struct cache_user_s *c );
|
void *Cache_Check( poolhandle_t mempool, struct cache_user_s *c );
|
||||||
void COM_TrimSpace( const char *source, char *dest );
|
void COM_TrimSpace( const char *source, char *dest );
|
||||||
void pfnGetModelBounds( model_t *mod, float *mins, float *maxs );
|
void pfnGetModelBounds( model_t *mod, float *mins, float *maxs );
|
||||||
void pfnCVarDirectSet( cvar_t *var, const char *szValue );
|
|
||||||
int COM_CheckParm( char *parm, char **ppnext );
|
int COM_CheckParm( char *parm, char **ppnext );
|
||||||
void pfnGetGameDir( char *szGetGameDir );
|
void pfnGetGameDir( char *szGetGameDir );
|
||||||
int pfnGetModelType( model_t *mod );
|
int pfnGetModelType( model_t *mod );
|
||||||
@@ -648,7 +641,6 @@ void pfnResetTutorMessageDecayData( void );
|
|||||||
//
|
//
|
||||||
// con_utils.c
|
// con_utils.c
|
||||||
//
|
//
|
||||||
qboolean Cmd_AutocompleteName( const char *source, int arg, char *buffer, size_t bufsize );
|
|
||||||
void Con_CompleteCommand( field_t *field );
|
void Con_CompleteCommand( field_t *field );
|
||||||
void Cmd_AutoComplete( char *complete_string );
|
void Cmd_AutoComplete( char *complete_string );
|
||||||
void Cmd_AutoCompleteClear( void );
|
void Cmd_AutoCompleteClear( void );
|
||||||
@@ -704,24 +696,15 @@ void CL_LegacyUpdateInfo( void );
|
|||||||
void CL_CharEvent( int key );
|
void CL_CharEvent( int key );
|
||||||
qboolean CL_DisableVisibility( void );
|
qboolean CL_DisableVisibility( void );
|
||||||
byte *COM_LoadFile( const char *filename, int usehunk, int *pLength );
|
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_GetFirstFunctionHandle( void );
|
||||||
struct cmd_s *Cmd_GetNextFunctionHandle( struct cmd_s *cmd );
|
struct cmd_s *Cmd_GetNextFunctionHandle( struct cmd_s *cmd );
|
||||||
struct cmdalias_s *Cmd_AliasGetList( void );
|
struct cmdalias_s *Cmd_AliasGetList( void );
|
||||||
const char *Cmd_GetName( struct cmd_s *cmd );
|
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 Log_Printf( const char *fmt, ... ) _format( 1 );
|
||||||
void SV_BroadcastCommand( 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 );
|
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 );
|
void CL_ClearStaticEntities( void );
|
||||||
qboolean S_StreamGetCurrentState( char *currentTrack, char *loopTrack, int *position );
|
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_ServerCommand( qboolean reliable, const char *fmt, ... ) _format( 2 );
|
||||||
void CL_HudMessage( const char *pMessage );
|
void CL_HudMessage( const char *pMessage );
|
||||||
const char *CL_MsgInfo( int cmd );
|
const char *CL_MsgInfo( int cmd );
|
||||||
@@ -730,17 +713,14 @@ void SV_DrawOrthoTriangles( void );
|
|||||||
double CL_GetDemoFramerate( void );
|
double CL_GetDemoFramerate( void );
|
||||||
qboolean UI_CreditsActive( void );
|
qboolean UI_CreditsActive( void );
|
||||||
void CL_StopPlayback( void );
|
void CL_StopPlayback( void );
|
||||||
void CL_ExtraUpdate( void );
|
|
||||||
int CL_GetMaxClients( void );
|
int CL_GetMaxClients( void );
|
||||||
int SV_GetMaxClients( void );
|
int SV_GetMaxClients( void );
|
||||||
qboolean CL_IsRecordDemo( void );
|
qboolean CL_IsRecordDemo( void );
|
||||||
qboolean CL_IsTimeDemo( void );
|
qboolean CL_IsTimeDemo( void );
|
||||||
qboolean CL_IsPlaybackDemo( void );
|
qboolean CL_IsPlaybackDemo( void );
|
||||||
qboolean SV_Initialized( void );
|
qboolean SV_Initialized( void );
|
||||||
qboolean CL_LoadProgs( const char *name );
|
|
||||||
void CL_ProcessFile( qboolean successfully_received, const char *filename );
|
void CL_ProcessFile( qboolean successfully_received, const char *filename );
|
||||||
int SV_GetSaveComment( const char *savename, char *comment );
|
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 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 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 );
|
void SV_SysError( const char *error_string );
|
||||||
@@ -749,11 +729,9 @@ void SV_ExecLoadLevel( void );
|
|||||||
void SV_ExecLoadGame( void );
|
void SV_ExecLoadGame( void );
|
||||||
void SV_ExecChangeLevel( void );
|
void SV_ExecChangeLevel( void );
|
||||||
void CL_WriteMessageHistory( void );
|
void CL_WriteMessageHistory( void );
|
||||||
void CL_SendCmd( void );
|
|
||||||
void CL_Disconnect( void );
|
void CL_Disconnect( void );
|
||||||
void CL_ClearEdicts( void );
|
void CL_ClearEdicts( void );
|
||||||
void CL_Crashed( void );
|
void CL_Crashed( void );
|
||||||
qboolean CL_NextDemo( void );
|
|
||||||
char *SV_Serverinfo( void );
|
char *SV_Serverinfo( void );
|
||||||
void CL_Drop( void );
|
void CL_Drop( void );
|
||||||
void Con_Init( void );
|
void Con_Init( void );
|
||||||
@@ -778,7 +756,6 @@ qboolean Info_SetValueForStarKey( char *s, const char *key, const char *value, i
|
|||||||
qboolean Info_IsValid( const char *s );
|
qboolean Info_IsValid( const char *s );
|
||||||
void Info_WriteVars( file_t *f );
|
void Info_WriteVars( file_t *f );
|
||||||
void Info_Print( const char *s );
|
void Info_Print( const char *s );
|
||||||
void Cmd_WriteVariables( file_t *f );
|
|
||||||
int Cmd_CheckMapsList( int fRefresh );
|
int Cmd_CheckMapsList( int fRefresh );
|
||||||
void COM_SetRandomSeed( int lSeed );
|
void COM_SetRandomSeed( int lSeed );
|
||||||
int COM_RandomLong( int lMin, int lMax );
|
int COM_RandomLong( int lMin, int lMax );
|
||||||
@@ -800,6 +777,7 @@ int COM_FileSize( const char *filename );
|
|||||||
void COM_FreeFile( void *buffer );
|
void COM_FreeFile( void *buffer );
|
||||||
int COM_CompareFileTime( const char *filename1, const char *filename2, int *iCompare );
|
int COM_CompareFileTime( const char *filename1, const char *filename2, int *iCompare );
|
||||||
char *va( const char *format, ... ) _format( 1 );
|
char *va( const char *format, ... ) _format( 1 );
|
||||||
|
qboolean CRC32_MapFile( dword *crcvalue, const char *filename, qboolean multiplayer );
|
||||||
|
|
||||||
// soundlib shared exports
|
// soundlib shared exports
|
||||||
qboolean S_Init( void );
|
qboolean S_Init( void );
|
||||||
@@ -810,8 +788,14 @@ void S_StopBackgroundTrack( void );
|
|||||||
void S_StopAllSounds( qboolean ambient );
|
void S_StopAllSounds( qboolean ambient );
|
||||||
|
|
||||||
// gamma routines
|
// gamma routines
|
||||||
void BuildGammaTable( float gamma, float brightness );
|
|
||||||
byte LightToTexGamma( byte b );
|
byte LightToTexGamma( byte b );
|
||||||
|
byte TextureToGamma( byte );
|
||||||
|
uint LightToTexGammaEx( uint );
|
||||||
|
uint ScreenGammaTable( uint );
|
||||||
|
uint LinearGammaTable( uint );
|
||||||
|
void V_Init( void );
|
||||||
|
void V_CheckGamma( void );
|
||||||
|
void V_CheckGammaEnd( void );
|
||||||
|
|
||||||
//
|
//
|
||||||
// identification.c
|
// identification.c
|
||||||
@@ -832,6 +816,34 @@ void NET_MasterClear( void );
|
|||||||
void NET_MasterShutdown( void );
|
void NET_MasterShutdown( void );
|
||||||
qboolean NET_GetMaster( netadr_t from, uint *challenge, double *last_heartbeat );
|
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
|
#ifdef REF_DLL
|
||||||
#error "common.h in ref_dll"
|
#error "common.h in ref_dll"
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -184,7 +184,7 @@ Cmd_GetMapList
|
|||||||
Prints or complete map filename
|
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;
|
search_t *t;
|
||||||
string matchbuf;
|
string matchbuf;
|
||||||
@@ -220,7 +220,7 @@ Cmd_GetDemoList
|
|||||||
Prints or complete demo filename
|
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;
|
search_t *t;
|
||||||
string matchbuf;
|
string matchbuf;
|
||||||
@@ -267,7 +267,7 @@ Cmd_GetMovieList
|
|||||||
Prints or complete movie filename
|
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;
|
search_t *t;
|
||||||
string matchbuf;
|
string matchbuf;
|
||||||
@@ -314,7 +314,7 @@ Cmd_GetMusicList
|
|||||||
Prints or complete background track filename
|
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;
|
search_t *t;
|
||||||
string matchbuf;
|
string matchbuf;
|
||||||
@@ -362,7 +362,7 @@ Cmd_GetSavesList
|
|||||||
Prints or complete savegame filename
|
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;
|
search_t *t;
|
||||||
string matchbuf;
|
string matchbuf;
|
||||||
@@ -409,7 +409,7 @@ Cmd_GetConfigList
|
|||||||
Prints or complete .cfg filename
|
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;
|
search_t *t;
|
||||||
string matchbuf;
|
string matchbuf;
|
||||||
@@ -456,7 +456,7 @@ Cmd_GetSoundList
|
|||||||
Prints or complete sound filename
|
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;
|
search_t *t;
|
||||||
string matchbuf;
|
string matchbuf;
|
||||||
@@ -508,7 +508,7 @@ Cmd_GetItemsList
|
|||||||
Prints or complete item classname (weapons only)
|
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;
|
search_t *t;
|
||||||
string matchbuf;
|
string matchbuf;
|
||||||
@@ -555,7 +555,7 @@ Cmd_GetKeysList
|
|||||||
Autocomplete for bind command
|
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;
|
size_t i, numkeys;
|
||||||
string keys[256];
|
string keys[256];
|
||||||
@@ -636,7 +636,7 @@ Cmd_GetCommandsList
|
|||||||
Autocomplete for bind command
|
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;
|
size_t i;
|
||||||
string matchbuf;
|
string matchbuf;
|
||||||
@@ -701,7 +701,7 @@ Cmd_GetCustomList
|
|||||||
Prints or complete .HPK filenames
|
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;
|
search_t *t;
|
||||||
string matchbuf;
|
string matchbuf;
|
||||||
@@ -747,17 +747,13 @@ Cmd_GetGameList
|
|||||||
Prints or complete gamedir name
|
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;
|
int i, numgamedirs;
|
||||||
string gamedirs[MAX_MODS];
|
string gamedirs[MAX_MODS];
|
||||||
string matchbuf;
|
string matchbuf;
|
||||||
int len;
|
int len;
|
||||||
|
|
||||||
// stand-alone games doesn't have cmd "game"
|
|
||||||
if( !Cmd_Exists( "game" ))
|
|
||||||
return false;
|
|
||||||
|
|
||||||
// compare gamelist with current keyword
|
// compare gamelist with current keyword
|
||||||
len = Q_strlen( s );
|
len = Q_strlen( s );
|
||||||
|
|
||||||
@@ -800,7 +796,7 @@ Cmd_GetCDList
|
|||||||
Prints or complete CD command name
|
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;
|
int i, numcdcommands;
|
||||||
string cdcommands[8];
|
string cdcommands[8];
|
||||||
@@ -854,7 +850,7 @@ qboolean Cmd_GetCDList( const char *s, char *completedname, int length )
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
qboolean Cmd_CheckMapsList_R( qboolean fRefresh, qboolean onlyingamedir )
|
static qboolean Cmd_CheckMapsList_R( qboolean fRefresh, qboolean onlyingamedir )
|
||||||
{
|
{
|
||||||
qboolean use_filter = false;
|
qboolean use_filter = false;
|
||||||
byte buf[MAX_SYSPATH];
|
byte buf[MAX_SYSPATH];
|
||||||
@@ -870,7 +866,7 @@ qboolean Cmd_CheckMapsList_R( qboolean fRefresh, qboolean onlyingamedir )
|
|||||||
return true; // exist
|
return true; // exist
|
||||||
|
|
||||||
// setup mpfilter
|
// 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 );
|
t = FS_Search( "maps/*.bsp", false, onlyingamedir );
|
||||||
|
|
||||||
if( !t )
|
if( !t )
|
||||||
@@ -904,9 +900,9 @@ qboolean Cmd_CheckMapsList_R( qboolean fRefresh, qboolean onlyingamedir )
|
|||||||
|
|
||||||
if( f )
|
if( f )
|
||||||
{
|
{
|
||||||
int num_spawnpoints = 0;
|
qboolean have_spawnpoints = false;
|
||||||
dheader_t *header;
|
dheader_t *header;
|
||||||
dlump_t entities;
|
dlump_t entities;
|
||||||
|
|
||||||
memset( buf, 0, MAX_SYSPATH );
|
memset( buf, 0, MAX_SYSPATH );
|
||||||
FS_Read( f, buf, 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 )
|
while(( pfile = COM_ParseFile( pfile, token, sizeof( token ))) != NULL )
|
||||||
{
|
{
|
||||||
if( token[0] == '}' && worldspawn )
|
if( token[0] == '}' && worldspawn )
|
||||||
|
{
|
||||||
worldspawn = false;
|
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 )
|
else if( !Q_strcmp( token, "message" ) && worldspawn )
|
||||||
{
|
{
|
||||||
// get the message contents
|
// get the message contents
|
||||||
@@ -956,17 +963,23 @@ qboolean Cmd_CheckMapsList_R( qboolean fRefresh, qboolean onlyingamedir )
|
|||||||
else if( !Q_strcmp( token, "classname" ))
|
else if( !Q_strcmp( token, "classname" ))
|
||||||
{
|
{
|
||||||
pfile = COM_ParseFile( pfile, token, sizeof( token ));
|
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 );
|
Mem_Free( ents );
|
||||||
}
|
}
|
||||||
|
|
||||||
if( f ) FS_Close( f );
|
if( f ) FS_Close( f );
|
||||||
|
|
||||||
if( num_spawnpoints )
|
if( have_spawnpoints )
|
||||||
{
|
{
|
||||||
// format: mapname "maptitle"\n
|
// format: mapname "maptitle"\n
|
||||||
Q_snprintf( result, sizeof( result ), "%s \"%s\"\n", mapname, message );
|
Q_snprintf( result, sizeof( result ), "%s \"%s\"\n", mapname, message );
|
||||||
@@ -1061,7 +1074,7 @@ Autocomplete filename
|
|||||||
for various cmds
|
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;
|
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 );
|
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 );
|
Cvar_LookupVars( FCVAR_GLCONFIG, NULL, f, (setpair_t)Cmd_WriteOpenGLCvar );
|
||||||
}
|
}
|
||||||
|
|
||||||
#if !XASH_DEDICATED
|
#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;
|
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;
|
bp = (void**)ucontext->uc_mcontext.mc_rbp;
|
||||||
sp = (void**)ucontext->uc_mcontext.mc_rsp;
|
sp = (void**)ucontext->uc_mcontext.mc_rsp;
|
||||||
#elif XASH_NETBSD
|
#elif XASH_NETBSD
|
||||||
pc = (void*)ucontext->uc_mcontext.__gregs[REG_RIP];
|
pc = (void*)ucontext->uc_mcontext.__gregs[_REG_RIP];
|
||||||
bp = (void**)ucontext->uc_mcontext.__gregs[REG_RBP];
|
bp = (void**)ucontext->uc_mcontext.__gregs[_REG_RBP];
|
||||||
sp = (void**)ucontext->uc_mcontext.__gregs[REG_RSP];
|
sp = (void**)ucontext->uc_mcontext.__gregs[_REG_RSP];
|
||||||
#elif XASH_OPENBSD
|
#elif XASH_OPENBSD
|
||||||
pc = (void*)ucontext->sc_rip;
|
pc = (void*)ucontext->sc_rip;
|
||||||
bp = (void**)ucontext->sc_rbp;
|
bp = (void**)ucontext->sc_rbp;
|
||||||
@@ -490,13 +490,14 @@ static void Sys_Crash( int signal, siginfo_t *si, void *context)
|
|||||||
#ifdef XASH_SDL
|
#ifdef XASH_SDL
|
||||||
SDL_SetWindowGrab( host.hWnd, SDL_FALSE );
|
SDL_SetWindowGrab( host.hWnd, SDL_FALSE );
|
||||||
#endif
|
#endif
|
||||||
|
host.crashed = true;
|
||||||
Platform_MessageBox( "Xash Error", message, false );
|
Platform_MessageBox( "Xash Error", message, false );
|
||||||
|
|
||||||
// log saved, now we can try to save configs and close log correctly, it may crash
|
// log saved, now we can try to save configs and close log correctly, it may crash
|
||||||
if( host.type == HOST_NORMAL )
|
if( host.type == HOST_NORMAL )
|
||||||
CL_Crashed();
|
CL_Crashed();
|
||||||
host.status = HOST_CRASHED;
|
host.status = HOST_CRASHED;
|
||||||
host.crashed = true;
|
|
||||||
|
|
||||||
Sys_Quit();
|
Sys_Quit();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -152,8 +152,10 @@ static qboolean Cvar_UpdateInfo( convar_t *var, const char *value, qboolean noti
|
|||||||
if ( Host_IsDedicated() )
|
if ( Host_IsDedicated() )
|
||||||
{
|
{
|
||||||
// g-cont. this is a very strange behavior...
|
// g-cont. this is a very strange behavior...
|
||||||
Info_SetValueForKey( SV_Serverinfo(), var->name, value, MAX_SERVERINFO_STRING ),
|
char *info = SV_Serverinfo();
|
||||||
SV_BroadcastCommand( "fullserverinfo \"%s\"\n", SV_Serverinfo( ));
|
|
||||||
|
Info_SetValueForKey( info, var->name, value, MAX_SERVERINFO_STRING ),
|
||||||
|
SV_BroadcastCommand( "fullserverinfo \"%s\"\n", info );
|
||||||
}
|
}
|
||||||
#if !XASH_DEDICATED
|
#if !XASH_DEDICATED
|
||||||
else
|
else
|
||||||
@@ -195,7 +197,7 @@ Cvar_ValidateString
|
|||||||
deal with userinfo etc
|
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;
|
const char *pszValue;
|
||||||
static char szNew[MAX_STRING];
|
static char szNew[MAX_STRING];
|
||||||
@@ -278,7 +280,7 @@ Cvar_UnlinkVar
|
|||||||
unlink the variable
|
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;
|
int count = 0;
|
||||||
convar_t **prev;
|
convar_t **prev;
|
||||||
@@ -563,6 +565,27 @@ void Cvar_RegisterVariable( convar_t *var )
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static qboolean Cvar_CanSet( const convar_t *cv )
|
||||||
|
{
|
||||||
|
if( FBitSet( cv->flags, FCVAR_READ_ONLY ))
|
||||||
|
{
|
||||||
|
Con_Printf( "%s is read-only.\n", cv->name );
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if( FBitSet( cv->flags, FCVAR_CHEAT ) && !host.allow_cheats )
|
||||||
|
{
|
||||||
|
Con_Printf( "%s is cheat protected.\n", cv->name );
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
// just tell user about deferred changes
|
||||||
|
if( FBitSet( cv->flags, FCVAR_LATCH ) && ( SV_Active() || CL_Active( )))
|
||||||
|
Con_Printf( "%s will be changed upon restarting.\n", cv->name );
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
============
|
============
|
||||||
Cvar_Set2
|
Cvar_Set2
|
||||||
@@ -632,22 +655,9 @@ static convar_t *Cvar_Set2( const char *var_name, const char *value )
|
|||||||
force = true;
|
force = true;
|
||||||
|
|
||||||
if( !force )
|
if( !force )
|
||||||
{
|
{
|
||||||
if( FBitSet( var->flags, FCVAR_READ_ONLY ))
|
if( !Cvar_CanSet( var ))
|
||||||
{
|
|
||||||
Con_Printf( "%s is read-only.\n", var->name );
|
|
||||||
return var;
|
return var;
|
||||||
}
|
|
||||||
|
|
||||||
if( FBitSet( var->flags, FCVAR_CHEAT ) && !host.allow_cheats )
|
|
||||||
{
|
|
||||||
Con_Printf( "%s is cheat protected.\n", var->name );
|
|
||||||
return var;
|
|
||||||
}
|
|
||||||
|
|
||||||
// just tell user about deferred changes
|
|
||||||
if( FBitSet( var->flags, FCVAR_LATCH ) && ( SV_Active() || CL_Active( )))
|
|
||||||
Con_Printf( "%s will be changed upon restarting.\n", var->name );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
pszValue = Cvar_ValidateString( var, value );
|
pszValue = Cvar_ValidateString( var, value );
|
||||||
@@ -677,7 +687,7 @@ Cvar_DirectSet
|
|||||||
way to change value for many cvars
|
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;
|
const char *pszValue;
|
||||||
|
|
||||||
@@ -694,21 +704,8 @@ void Cvar_DirectSet( convar_t *var, const char *value )
|
|||||||
return; // how this possible?
|
return; // how this possible?
|
||||||
}
|
}
|
||||||
|
|
||||||
if( FBitSet( var->flags, FCVAR_READ_ONLY ))
|
if( !Cvar_CanSet( var ))
|
||||||
{
|
|
||||||
Con_Printf( "%s is read-only.\n", var->name );
|
|
||||||
return;
|
return;
|
||||||
}
|
|
||||||
|
|
||||||
if( FBitSet( var->flags, FCVAR_CHEAT ) && !host.allow_cheats )
|
|
||||||
{
|
|
||||||
Con_Printf( "%s is cheat protected.\n", var->name );
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// just tell user about deferred changes
|
|
||||||
if( FBitSet( var->flags, FCVAR_LATCH ) && ( SV_Active() || CL_Active( )))
|
|
||||||
Con_Printf( "%s will be changed upon restarting.\n", var->name );
|
|
||||||
|
|
||||||
// check value
|
// check value
|
||||||
if( !value )
|
if( !value )
|
||||||
@@ -741,6 +738,24 @@ void Cvar_DirectSet( convar_t *var, const char *value )
|
|||||||
Cvar_Changed( var );
|
Cvar_Changed( var );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
============
|
||||||
|
Cvar_DirectSetValue
|
||||||
|
|
||||||
|
functionally is the same as Cvar_SetValue but for direct cvar access
|
||||||
|
============
|
||||||
|
*/
|
||||||
|
void Cvar_DirectSetValue( convar_t *var, float value )
|
||||||
|
{
|
||||||
|
char val[32];
|
||||||
|
|
||||||
|
if( fabs( value - (int)value ) < 0.000001 )
|
||||||
|
Q_snprintf( val, sizeof( val ), "%d", (int)value );
|
||||||
|
else Q_snprintf( val, sizeof( val ), "%f", value );
|
||||||
|
|
||||||
|
Cvar_DirectSet( var, val );
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
============
|
============
|
||||||
Cvar_FullSet
|
Cvar_FullSet
|
||||||
@@ -940,7 +955,7 @@ static void Cvar_SetGL( const char *name, const char *value )
|
|||||||
|
|
||||||
static qboolean Cvar_ShouldSetCvar( convar_t *v, qboolean isPrivileged )
|
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;
|
int i;
|
||||||
|
|
||||||
if( isPrivileged )
|
if( isPrivileged )
|
||||||
@@ -1078,7 +1093,7 @@ Cvar_Toggle_f
|
|||||||
Toggles a cvar for easy single key binding
|
Toggles a cvar for easy single key binding
|
||||||
============
|
============
|
||||||
*/
|
*/
|
||||||
void Cvar_Toggle_f( void )
|
static void Cvar_Toggle_f( void )
|
||||||
{
|
{
|
||||||
int v;
|
int v;
|
||||||
|
|
||||||
@@ -1101,7 +1116,7 @@ Allows setting and defining of arbitrary cvars from console, even if they
|
|||||||
weren't declared in C code.
|
weren't declared in C code.
|
||||||
============
|
============
|
||||||
*/
|
*/
|
||||||
void Cvar_Set_f( void )
|
static void Cvar_Set_f( void )
|
||||||
{
|
{
|
||||||
int i, c, l = 0, len;
|
int i, c, l = 0, len;
|
||||||
char combined[MAX_CMD_TOKENS];
|
char combined[MAX_CMD_TOKENS];
|
||||||
@@ -1134,7 +1149,7 @@ Cvar_SetGL_f
|
|||||||
As Cvar_Set, but also flags it as glconfig
|
As Cvar_Set, but also flags it as glconfig
|
||||||
============
|
============
|
||||||
*/
|
*/
|
||||||
void Cvar_SetGL_f( void )
|
static void Cvar_SetGL_f( void )
|
||||||
{
|
{
|
||||||
if( Cmd_Argc() != 3 )
|
if( Cmd_Argc() != 3 )
|
||||||
{
|
{
|
||||||
@@ -1150,7 +1165,7 @@ void Cvar_SetGL_f( void )
|
|||||||
Cvar_Reset_f
|
Cvar_Reset_f
|
||||||
============
|
============
|
||||||
*/
|
*/
|
||||||
void Cvar_Reset_f( void )
|
static void Cvar_Reset_f( void )
|
||||||
{
|
{
|
||||||
if( Cmd_Argc() != 2 )
|
if( Cmd_Argc() != 2 )
|
||||||
{
|
{
|
||||||
@@ -1166,7 +1181,7 @@ void Cvar_Reset_f( void )
|
|||||||
Cvar_List_f
|
Cvar_List_f
|
||||||
============
|
============
|
||||||
*/
|
*/
|
||||||
void Cvar_List_f( void )
|
static void Cvar_List_f( void )
|
||||||
{
|
{
|
||||||
convar_t *var;
|
convar_t *var;
|
||||||
const char *match = NULL;
|
const char *match = NULL;
|
||||||
|
|||||||
@@ -66,6 +66,7 @@ convar_t *Cvar_Getf( const char *var_name, int flags, const char *description, c
|
|||||||
void Cvar_LookupVars( int checkbit, void *buffer, void *ptr, setpair_t callback );
|
void Cvar_LookupVars( int checkbit, void *buffer, void *ptr, setpair_t callback );
|
||||||
void Cvar_FullSet( const char *var_name, const char *value, int flags );
|
void Cvar_FullSet( const char *var_name, const char *value, int flags );
|
||||||
void Cvar_DirectSet( convar_t *var, const char *value );
|
void Cvar_DirectSet( convar_t *var, const char *value );
|
||||||
|
void Cvar_DirectSetValue( convar_t *var, float value );
|
||||||
void Cvar_Set( const char *var_name, const char *value );
|
void Cvar_Set( const char *var_name, const char *value );
|
||||||
void Cvar_SetValue( const char *var_name, float value );
|
void Cvar_SetValue( const char *var_name, float value );
|
||||||
const char *Cvar_BuildAutoDescription( const char *szName, int flags );
|
const char *Cvar_BuildAutoDescription( const char *szName, int flags );
|
||||||
|
|||||||
@@ -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)
|
void GAME_EXPORT S_StopSound(int entnum, int channel, const char *soundname)
|
||||||
{
|
{
|
||||||
|
|
||||||
@@ -247,4 +238,14 @@ void CL_HudMessage( const char *pMessage )
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
byte TextureToGamma( byte b )
|
||||||
|
{
|
||||||
|
return b;
|
||||||
|
}
|
||||||
|
|
||||||
|
byte LightToTexGamma( byte b )
|
||||||
|
{
|
||||||
|
return b;
|
||||||
|
}
|
||||||
|
|
||||||
#endif // XASH_DEDICATED
|
#endif // XASH_DEDICATED
|
||||||
|
|||||||
@@ -1,78 +0,0 @@
|
|||||||
/*
|
|
||||||
gamma.c - gamma routines
|
|
||||||
Copyright (C) 2011 Uncle Mike
|
|
||||||
|
|
||||||
This program is free software: you can redistribute it and/or modify
|
|
||||||
it under the terms of the GNU General Public License as published by
|
|
||||||
the Free Software Foundation, either version 3 of the License, or
|
|
||||||
(at your option) any later version.
|
|
||||||
|
|
||||||
This program is distributed in the hope that it will be useful,
|
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
GNU General Public License for more details.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include "common.h"
|
|
||||||
#include "xash3d_mathlib.h"
|
|
||||||
#include "enginefeatures.h"
|
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
|
||||||
// Gamma conversion support
|
|
||||||
//-----------------------------------------------------------------------------
|
|
||||||
static byte lightgammatable[256];
|
|
||||||
static int lineargammatable[1024];
|
|
||||||
static int screengammatable[1024];
|
|
||||||
|
|
||||||
void BuildGammaTable( float lightgamma, float brightness )
|
|
||||||
{
|
|
||||||
int i, inf;
|
|
||||||
float f, g, g1, g3;
|
|
||||||
|
|
||||||
lightgamma = bound( 1.8f, lightgamma, 3.0f );
|
|
||||||
brightness = bound( 0.0f, brightness, 10.0f );
|
|
||||||
|
|
||||||
if( brightness <= 0.0f )
|
|
||||||
g3 = 0.125f;
|
|
||||||
else if( brightness > 1.0f )
|
|
||||||
g3 = 0.05f;
|
|
||||||
else g3 = 0.125f - (brightness * brightness) * 0.075f;
|
|
||||||
|
|
||||||
g = 1.0f / lightgamma;
|
|
||||||
g1 = GAMMA * g;
|
|
||||||
|
|
||||||
for( i = 0; i < 256; i++ )
|
|
||||||
{
|
|
||||||
f = pow( i / 255.f, GAMMA );
|
|
||||||
|
|
||||||
// scale up
|
|
||||||
if( brightness > 1.0f )
|
|
||||||
f = f * brightness;
|
|
||||||
|
|
||||||
// shift up
|
|
||||||
if( f <= g3 ) f = (f / g3) * 0.125f;
|
|
||||||
else f = 0.125f + ((f - g3) / (1.0f - g3)) * 0.875f;
|
|
||||||
|
|
||||||
// convert linear space to desired gamma space
|
|
||||||
inf = (int)( 255.0f * pow( f, g ));
|
|
||||||
|
|
||||||
lightgammatable[i] = bound( 0, inf, 255 );
|
|
||||||
}
|
|
||||||
|
|
||||||
for( i = 0; i < 1024; i++ )
|
|
||||||
{
|
|
||||||
// convert from screen gamma space to linear space
|
|
||||||
lineargammatable[i] = 1023 * pow( i / 1023.0f, g1 );
|
|
||||||
|
|
||||||
// convert from linear gamma space to screen space
|
|
||||||
screengammatable[i] = 1023 * pow( i / 1023.0f, 1.0f / g1 );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
byte LightToTexGamma( byte b )
|
|
||||||
{
|
|
||||||
if( FBitSet( host.features, ENGINE_LINEAR_GAMMA_SPACE ))
|
|
||||||
return b;
|
|
||||||
else
|
|
||||||
return lightgammatable[b];
|
|
||||||
}
|
|
||||||
@@ -65,7 +65,7 @@ static CVAR_DEFINE( host_sleeptime, "sleeptime", "1", FCVAR_ARCHIVE|FCVAR_FILTER
|
|||||||
static CVAR_DEFINE_AUTO( host_sleeptime_debug, "0", 0, "print sleeps between frames" );
|
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" );
|
CVAR_DEFINE( con_gamemaps, "con_mapfilter", "1", FCVAR_ARCHIVE, "when true show only maps in game folder" );
|
||||||
|
|
||||||
void Sys_PrintUsage( void )
|
static void Sys_PrintUsage( void )
|
||||||
{
|
{
|
||||||
string version_str;
|
string version_str;
|
||||||
const char *usage_str;
|
const char *usage_str;
|
||||||
@@ -92,8 +92,9 @@ void Sys_PrintUsage( void )
|
|||||||
O("-minidumps ", "enable writing minidumps when game is crashed")
|
O("-minidumps ", "enable writing minidumps when game is crashed")
|
||||||
#endif
|
#endif
|
||||||
O("-rodir <path> ", "set read-only base directory")
|
O("-rodir <path> ", "set read-only base directory")
|
||||||
O("-bugcomp ", "enable precise bug compatibility. Will break games that don't require it")
|
O("-bugcomp ", "enable precise bug compatibility")
|
||||||
O(" ", "Refer to engine documentation for more info")
|
O(" ", "will break games that don't require it")
|
||||||
|
O(" ", "refer to engine documentation for more info")
|
||||||
O("-disablehelp ", "disable this message")
|
O("-disablehelp ", "disable this message")
|
||||||
#if !XASH_DEDICATED
|
#if !XASH_DEDICATED
|
||||||
O("-dedicated ", "run engine in dedicated mode")
|
O("-dedicated ", "run engine in dedicated mode")
|
||||||
@@ -106,9 +107,11 @@ void Sys_PrintUsage( void )
|
|||||||
O("-noip6 ", "disable IPv6")
|
O("-noip6 ", "disable IPv6")
|
||||||
O("-ip6 <ip> ", "set IPv6 address")
|
O("-ip6 <ip> ", "set IPv6 address")
|
||||||
O("-port6 <port> ", "set IPv6 port")
|
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"
|
"\nGame options:\n"
|
||||||
|
O("-game <directory>", "set game directory to start engine with")
|
||||||
O("-dll <path> ", "override server DLL path")
|
O("-dll <path> ", "override server DLL path")
|
||||||
#if !XASH_DEDICATED
|
#if !XASH_DEDICATED
|
||||||
O("-clientlib <path>", "override client DLL path")
|
O("-clientlib <path>", "override client DLL path")
|
||||||
@@ -190,29 +193,68 @@ void Host_ShutdownServer( void )
|
|||||||
Host_PrintEngineFeatures
|
Host_PrintEngineFeatures
|
||||||
================
|
================
|
||||||
*/
|
*/
|
||||||
void Host_PrintEngineFeatures( int features )
|
static void Host_PrintEngineFeatures( int features )
|
||||||
{
|
{
|
||||||
const char *features_str[] =
|
struct
|
||||||
{
|
{
|
||||||
"Big World Support",
|
uint32_t mask;
|
||||||
"Quake Compatibility",
|
const char *msg;
|
||||||
"Deluxemap Support",
|
} features_str[] =
|
||||||
"Improved MOVETYPE_PUSH",
|
{
|
||||||
"Large Lightmaps",
|
{ ENGINE_WRITE_LARGE_COORD, "Big World Support" },
|
||||||
"Stupid Quake Bug Compensation",
|
{ ENGINE_QUAKE_COMPATIBLE, "Quake Compatibility" },
|
||||||
"Improved Trace Line",
|
{ ENGINE_LOAD_DELUXEDATA, "Deluxemap Support" },
|
||||||
"Studio MOVETYPE_STEP Lerping",
|
{ ENGINE_PHYSICS_PUSHER_EXT, "Improved MOVETYPE_PUSH" },
|
||||||
"Linear Gamma Space"
|
{ 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;
|
int i;
|
||||||
|
|
||||||
for( i = 0; i < ARRAYSIZE( features_str ); i++ )
|
for( i = 0; i < ARRAYSIZE( features_str ); i++ )
|
||||||
{
|
{
|
||||||
if( FBitSet( features, BIT( i )))
|
if( FBitSet( features, features_str[i].mask ))
|
||||||
Con_Reportf( "^3EXT:^7 %s is enabled\n", features_str[i] );
|
Con_Reportf( "^3EXT:^7 %s is enabled\n", features_str[i].msg );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
==============
|
||||||
|
Host_ValidateEngineFeatures
|
||||||
|
|
||||||
|
validate features bits and set host.features
|
||||||
|
==============
|
||||||
|
*/
|
||||||
|
void Host_ValidateEngineFeatures( uint32_t features )
|
||||||
|
{
|
||||||
|
uint32_t mask = ENGINE_FEATURES_MASK;
|
||||||
|
|
||||||
|
#if !HOST_DEDICATED
|
||||||
|
if( !Host_IsDedicated( ) && cls.legacymode )
|
||||||
|
mask = ENGINE_LEGACY_FEATURES_MASK;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// don't allow unsupported bits
|
||||||
|
features &= mask;
|
||||||
|
|
||||||
|
// force bits for some games
|
||||||
|
if( !Q_stricmp( GI->gamefolder, "cstrike" ) || !Q_stricmp( GI->gamefolder, "czero" ))
|
||||||
|
SetBits( features, ENGINE_STEP_POSHISTORY_LERP );
|
||||||
|
|
||||||
|
// print requested first
|
||||||
|
Host_PrintEngineFeatures( 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 ))
|
||||||
|
Con_Printf( S_WARN "%s: incompatible ENGINE_STEP_POSHISTORY_LERP and ENGINE_COMPUTE_STUDIO_LERP are enabled!\n", __func__ );
|
||||||
|
|
||||||
|
// finally set global variable
|
||||||
|
host.features = features;
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
==============
|
==============
|
||||||
Host_IsQuakeCompatible
|
Host_IsQuakeCompatible
|
||||||
@@ -309,7 +351,7 @@ static int Host_CalcSleep( void )
|
|||||||
return host_sleeptime.value;
|
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;
|
if( !pChangeGame ) return;
|
||||||
|
|
||||||
@@ -327,7 +369,7 @@ Host_ChangeGame_f
|
|||||||
Change game modification
|
Change game modification
|
||||||
=================
|
=================
|
||||||
*/
|
*/
|
||||||
void Host_ChangeGame_f( void )
|
static void Host_ChangeGame_f( void )
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
@@ -366,7 +408,7 @@ void Host_ChangeGame_f( void )
|
|||||||
Host_Exec_f
|
Host_Exec_f
|
||||||
===============
|
===============
|
||||||
*/
|
*/
|
||||||
void Host_Exec_f( void )
|
static void Host_Exec_f( void )
|
||||||
{
|
{
|
||||||
string cfgpath;
|
string cfgpath;
|
||||||
byte *f;
|
byte *f;
|
||||||
@@ -452,7 +494,7 @@ void Host_Exec_f( void )
|
|||||||
Host_MemStats_f
|
Host_MemStats_f
|
||||||
===============
|
===============
|
||||||
*/
|
*/
|
||||||
void Host_MemStats_f( void )
|
static void Host_MemStats_f( void )
|
||||||
{
|
{
|
||||||
switch( Cmd_Argc( ))
|
switch( Cmd_Argc( ))
|
||||||
{
|
{
|
||||||
@@ -470,7 +512,7 @@ void Host_MemStats_f( void )
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Host_Minimize_f( void )
|
static void Host_Minimize_f( void )
|
||||||
{
|
{
|
||||||
#ifdef XASH_SDL
|
#ifdef XASH_SDL
|
||||||
if( host.hWnd ) SDL_MinimizeWindow( host.hWnd );
|
if( host.hWnd ) SDL_MinimizeWindow( host.hWnd );
|
||||||
@@ -509,7 +551,7 @@ qboolean Host_IsLocalClient( void )
|
|||||||
Host_RegisterDecal
|
Host_RegisterDecal
|
||||||
=================
|
=================
|
||||||
*/
|
*/
|
||||||
qboolean Host_RegisterDecal( const char *name, int *count )
|
static qboolean Host_RegisterDecal( const char *name, int *count )
|
||||||
{
|
{
|
||||||
char shortname[MAX_QPATH];
|
char shortname[MAX_QPATH];
|
||||||
int i;
|
int i;
|
||||||
@@ -543,7 +585,7 @@ qboolean Host_RegisterDecal( const char *name, int *count )
|
|||||||
Host_InitDecals
|
Host_InitDecals
|
||||||
=================
|
=================
|
||||||
*/
|
*/
|
||||||
void Host_InitDecals( void )
|
static void Host_InitDecals( void )
|
||||||
{
|
{
|
||||||
int i, num_decals = 0;
|
int i, num_decals = 0;
|
||||||
search_t *t;
|
search_t *t;
|
||||||
@@ -574,7 +616,7 @@ Host_GetCommands
|
|||||||
Add them exactly as if they had been typed at the console
|
Add them exactly as if they had been typed at the console
|
||||||
===================
|
===================
|
||||||
*/
|
*/
|
||||||
void Host_GetCommands( void )
|
static void Host_GetCommands( void )
|
||||||
{
|
{
|
||||||
char *cmd;
|
char *cmd;
|
||||||
|
|
||||||
@@ -592,7 +634,7 @@ Host_CalcFPS
|
|||||||
compute actual FPS for various modes
|
compute actual FPS for various modes
|
||||||
===================
|
===================
|
||||||
*/
|
*/
|
||||||
double Host_CalcFPS( void )
|
static double Host_CalcFPS( void )
|
||||||
{
|
{
|
||||||
double fps = 0.0;
|
double fps = 0.0;
|
||||||
|
|
||||||
@@ -709,7 +751,7 @@ Host_FilterTime
|
|||||||
Returns false if the time is too short to run a frame
|
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;
|
static double oldtime;
|
||||||
double dt;
|
double dt;
|
||||||
@@ -834,7 +876,7 @@ void GAME_EXPORT Host_Error( const char *error, ... )
|
|||||||
Host_AbortCurrentFrame();
|
Host_AbortCurrentFrame();
|
||||||
}
|
}
|
||||||
|
|
||||||
void Host_Error_f( void )
|
static void Host_Error_f( void )
|
||||||
{
|
{
|
||||||
const char *error = Cmd_Argv( 1 );
|
const char *error = Cmd_Argv( 1 );
|
||||||
|
|
||||||
@@ -842,7 +884,7 @@ void Host_Error_f( void )
|
|||||||
Host_Error( "%s\n", error );
|
Host_Error( "%s\n", error );
|
||||||
}
|
}
|
||||||
|
|
||||||
void Sys_Error_f( void )
|
static void Sys_Error_f( void )
|
||||||
{
|
{
|
||||||
const char *error = Cmd_Argv( 1 );
|
const char *error = Cmd_Argv( 1 );
|
||||||
|
|
||||||
@@ -865,7 +907,7 @@ static void Host_Crash_f( void )
|
|||||||
Host_Userconfigd_f
|
Host_Userconfigd_f
|
||||||
=================
|
=================
|
||||||
*/
|
*/
|
||||||
void Host_Userconfigd_f( void )
|
static void Host_Userconfigd_f( void )
|
||||||
{
|
{
|
||||||
search_t *t;
|
search_t *t;
|
||||||
int i;
|
int i;
|
||||||
@@ -899,6 +941,7 @@ static void Host_RunTests( int stage )
|
|||||||
TEST_LIST_1_CLIENT;
|
TEST_LIST_1_CLIENT;
|
||||||
#endif
|
#endif
|
||||||
Msg( "Done! %d passed, %d failed\n", tests_stats.passed, tests_stats.failed );
|
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();
|
Sys_Quit();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -909,13 +952,13 @@ static void Host_RunTests( int stage )
|
|||||||
Host_InitCommon
|
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];
|
char dev_level[4];
|
||||||
int developer = DEFAULT_DEV;
|
int developer = DEFAULT_DEV;
|
||||||
const char *baseDir;
|
const char *baseDir;
|
||||||
char ticrate[16];
|
char ticrate[16];
|
||||||
int len;
|
int len, i;
|
||||||
|
|
||||||
// some commands may turn engine into infinite loop,
|
// some commands may turn engine into infinite loop,
|
||||||
// e.g. xash.exe +game xash -game xash
|
// e.g. xash.exe +game xash -game xash
|
||||||
@@ -990,7 +1033,7 @@ void Host_InitCommon( int argc, char **argv, const char *progname, qboolean bCha
|
|||||||
progname++;
|
progname++;
|
||||||
|
|
||||||
Q_strncpy( SI.exeName, progname, sizeof( SI.exeName ));
|
Q_strncpy( SI.exeName, progname, sizeof( SI.exeName ));
|
||||||
Q_strncpy( SI.basedirName, progname, sizeof( SI.exeName ));
|
Q_strncpy( SI.basedirName, progname, sizeof( SI.basedirName ));
|
||||||
|
|
||||||
if( Host_IsDedicated() )
|
if( Host_IsDedicated() )
|
||||||
{
|
{
|
||||||
@@ -1147,6 +1190,11 @@ void Host_InitCommon( int argc, char **argv, const char *progname, qboolean bCha
|
|||||||
Con_Printf( "^3BUGCOMP^7: GoldSrc bug-compatibility enabled\n" );
|
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 );
|
||||||
|
}
|
||||||
|
|
||||||
Cmd_AddCommand( "exec", Host_Exec_f, "execute a script file" );
|
Cmd_AddCommand( "exec", Host_Exec_f, "execute a script file" );
|
||||||
Cmd_AddCommand( "memlist", Host_MemStats_f, "prints memory pool information" );
|
Cmd_AddCommand( "memlist", Host_MemStats_f, "prints memory pool information" );
|
||||||
Cmd_AddRestrictedCommand( "userconfigd", Host_Userconfigd_f, "execute all scripts from userconfig.d" );
|
Cmd_AddRestrictedCommand( "userconfigd", Host_Userconfigd_f, "execute all scripts from userconfig.d" );
|
||||||
@@ -1162,12 +1210,25 @@ void Host_InitCommon( int argc, char **argv, const char *progname, qboolean bCha
|
|||||||
FS_LoadGameInfo( NULL );
|
FS_LoadGameInfo( NULL );
|
||||||
Cvar_PostFSInit();
|
Cvar_PostFSInit();
|
||||||
|
|
||||||
if( FS_FileExists( va( "%s.rc", SI.basedirName ), false ))
|
|
||||||
Q_strncpy( SI.rcName, SI.basedirName, sizeof( SI.rcName )); // e.g. valve.rc
|
|
||||||
else Q_strncpy( SI.rcName, SI.exeName, sizeof( SI.rcName )); // e.g. quake.rc
|
|
||||||
|
|
||||||
Q_strncpy( host.gamefolder, GI->gamefolder, sizeof( host.gamefolder ));
|
Q_strncpy( host.gamefolder, GI->gamefolder, sizeof( host.gamefolder ));
|
||||||
|
|
||||||
|
for( i = 0; i < 3; i++ )
|
||||||
|
{
|
||||||
|
const char *rcName;
|
||||||
|
switch( i )
|
||||||
|
{
|
||||||
|
case 0: rcName = SI.basedirName; break; // e.g. valve.rc
|
||||||
|
case 1: rcName = SI.exeName; break; // e.g. quake.rc
|
||||||
|
case 2: rcName = host.gamefolder; break; // e.g. game.rc (ran from default launcher)
|
||||||
|
}
|
||||||
|
|
||||||
|
if( FS_FileExists( va( "%s.rc", rcName ), false ))
|
||||||
|
{
|
||||||
|
Q_strncpy( SI.rcName, rcName, sizeof( SI.rcName ));
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
Image_CheckPaletteQ1 ();
|
Image_CheckPaletteQ1 ();
|
||||||
Host_InitDecals (); // reload decals
|
Host_InitDecals (); // reload decals
|
||||||
|
|
||||||
@@ -1188,7 +1249,7 @@ void Host_InitCommon( int argc, char **argv, const char *progname, qboolean bCha
|
|||||||
Key_Init();
|
Key_Init();
|
||||||
}
|
}
|
||||||
|
|
||||||
void Host_FreeCommon( void )
|
static void Host_FreeCommon( void )
|
||||||
{
|
{
|
||||||
Image_Shutdown();
|
Image_Shutdown();
|
||||||
Sound_Shutdown();
|
Sound_Shutdown();
|
||||||
@@ -1258,6 +1319,7 @@ int EXPORT Host_Main( int argc, char **argv, const char *progname, int bChangeGa
|
|||||||
|
|
||||||
HTTP_Init();
|
HTTP_Init();
|
||||||
ID_Init();
|
ID_Init();
|
||||||
|
SoundList_Init();
|
||||||
|
|
||||||
if( Host_IsDedicated() )
|
if( Host_IsDedicated() )
|
||||||
{
|
{
|
||||||
@@ -1315,7 +1377,11 @@ int EXPORT Host_Main( int argc, char **argv, const char *progname, int bChangeGa
|
|||||||
host.status = HOST_FRAME;
|
host.status = HOST_FRAME;
|
||||||
|
|
||||||
if( GameState->nextstate == STATE_RUNFRAME )
|
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" );
|
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
|
// execute server.cfg after commandline
|
||||||
// so we have a chance to set servercfgfile
|
// so we have a chance to set servercfgfile
|
||||||
@@ -1342,6 +1408,8 @@ Host_Shutdown
|
|||||||
*/
|
*/
|
||||||
void EXPORT Host_Shutdown( void )
|
void EXPORT Host_Shutdown( void )
|
||||||
{
|
{
|
||||||
|
qboolean error = host.status == HOST_ERR_FATAL;
|
||||||
|
|
||||||
if( host.shutdown_issued ) return;
|
if( host.shutdown_issued ) return;
|
||||||
host.shutdown_issued = true;
|
host.shutdown_issued = true;
|
||||||
|
|
||||||
@@ -1349,7 +1417,7 @@ void EXPORT Host_Shutdown( void )
|
|||||||
if( !host.change_game ) Q_strncpy( host.finalmsg, "Server shutdown", sizeof( host.finalmsg ));
|
if( !host.change_game ) Q_strncpy( host.finalmsg, "Server shutdown", sizeof( host.finalmsg ));
|
||||||
|
|
||||||
#if !XASH_DEDICATED
|
#if !XASH_DEDICATED
|
||||||
if( host.type == HOST_NORMAL )
|
if( host.type == HOST_NORMAL && !error )
|
||||||
Host_WriteConfig();
|
Host_WriteConfig();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@@ -1358,6 +1426,7 @@ void EXPORT Host_Shutdown( void )
|
|||||||
SV_ShutdownFilter();
|
SV_ShutdownFilter();
|
||||||
CL_Shutdown();
|
CL_Shutdown();
|
||||||
|
|
||||||
|
SoundList_Shutdown();
|
||||||
Mod_Shutdown();
|
Mod_Shutdown();
|
||||||
NET_Shutdown();
|
NET_Shutdown();
|
||||||
HTTP_Shutdown();
|
HTTP_Shutdown();
|
||||||
|
|||||||
@@ -57,6 +57,8 @@ void COM_NewGame( char const *pMapName )
|
|||||||
GameState->landmarkName[0] = 0;
|
GameState->landmarkName[0] = 0;
|
||||||
GameState->loadGame = false;
|
GameState->loadGame = false;
|
||||||
GameState->newGame = true;
|
GameState->newGame = true;
|
||||||
|
|
||||||
|
SV_ShutdownGame(); // exit from current game
|
||||||
}
|
}
|
||||||
|
|
||||||
void COM_LoadLevel( char const *pMapName, qboolean background )
|
void COM_LoadLevel( char const *pMapName, qboolean background )
|
||||||
@@ -74,6 +76,8 @@ void COM_LoadLevel( char const *pMapName, qboolean background )
|
|||||||
GameState->landmarkName[0] = 0;
|
GameState->landmarkName[0] = 0;
|
||||||
GameState->loadGame = false;
|
GameState->loadGame = false;
|
||||||
GameState->newGame = false;
|
GameState->newGame = false;
|
||||||
|
|
||||||
|
SV_ShutdownGame(); // exit from current game
|
||||||
}
|
}
|
||||||
|
|
||||||
void COM_LoadGame( char const *pMapName )
|
void COM_LoadGame( char const *pMapName )
|
||||||
@@ -117,7 +121,7 @@ void COM_ChangeLevel( char const *pNewLevel, char const *pLandmarkName, qboolean
|
|||||||
GameState->newGame = false;
|
GameState->newGame = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Host_ShutdownGame( void )
|
static void Host_ShutdownGame( void )
|
||||||
{
|
{
|
||||||
SV_ShutdownGame();
|
SV_ShutdownGame();
|
||||||
|
|
||||||
@@ -133,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
|
// at this time, we don't need to get events from OS on dedicated
|
||||||
#if !XASH_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_header_t hash_pack_header;
|
||||||
static hpak_info_t hash_pack_info;
|
static hpak_info_t hash_pack_info;
|
||||||
|
|
||||||
const char *HPAK_TypeFromIndex( int type )
|
static const char *HPAK_TypeFromIndex( int type )
|
||||||
{
|
{
|
||||||
switch( type )
|
switch( type )
|
||||||
{
|
{
|
||||||
@@ -94,7 +94,7 @@ void HPAK_FlushHostQueue( void )
|
|||||||
gp_hpak_queue = NULL;
|
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;
|
int filelocation;
|
||||||
string pakname;
|
string pakname;
|
||||||
@@ -872,7 +872,7 @@ void HPAK_RemoveLump( const char *name, resource_t *pResource )
|
|||||||
FS_Rename( save_path, read_path );
|
FS_Rename( save_path, read_path );
|
||||||
}
|
}
|
||||||
|
|
||||||
void HPAK_List_f( void )
|
static void HPAK_List_f( void )
|
||||||
{
|
{
|
||||||
int nCurrent;
|
int nCurrent;
|
||||||
hpak_header_t header;
|
hpak_header_t header;
|
||||||
@@ -950,7 +950,7 @@ void HPAK_List_f( void )
|
|||||||
FS_Close( f );
|
FS_Close( f );
|
||||||
}
|
}
|
||||||
|
|
||||||
void HPAK_Extract_f( void )
|
static void HPAK_Extract_f( void )
|
||||||
{
|
{
|
||||||
int nCurrent;
|
int nCurrent;
|
||||||
hpak_header_t header;
|
hpak_header_t header;
|
||||||
@@ -1061,7 +1061,7 @@ void HPAK_Extract_f( void )
|
|||||||
FS_Close( f );
|
FS_Close( f );
|
||||||
}
|
}
|
||||||
|
|
||||||
void HPAK_Remove_f( void )
|
static void HPAK_Remove_f( void )
|
||||||
{
|
{
|
||||||
resource_t resource;
|
resource_t resource;
|
||||||
|
|
||||||
@@ -1083,7 +1083,7 @@ void HPAK_Remove_f( void )
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void HPAK_Validate_f( void )
|
static void HPAK_Validate_f( void )
|
||||||
{
|
{
|
||||||
if( Cmd_Argc() != 2 )
|
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 };
|
rgba_t palette[256] = { 0 };
|
||||||
int i, columns, column, rows, row, bpp = 1;
|
int i, columns, column, rows, row, bpp = 1;
|
||||||
int cbPalBytes = 0, padSize = 0, bps = 0;
|
int cbPalBytes = 0, padSize = 0, bps = 0;
|
||||||
int reflectivity[3] = { 0, 0, 0 };
|
uint reflectivity[3] = { 0, 0, 0 };
|
||||||
qboolean load_qfont = false;
|
qboolean load_qfont = false;
|
||||||
bmp_t bhdr;
|
bmp_t bhdr;
|
||||||
fs_offset_t estimatedSize;
|
fs_offset_t estimatedSize;
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ GNU General Public License for more details.
|
|||||||
#include "xash3d_mathlib.h"
|
#include "xash3d_mathlib.h"
|
||||||
#include "img_dds.h"
|
#include "img_dds.h"
|
||||||
|
|
||||||
qboolean Image_CheckDXT3Alpha( dds_t *hdr, byte *fin )
|
static qboolean Image_CheckDXT3Alpha( dds_t *hdr, byte *fin )
|
||||||
{
|
{
|
||||||
word sAlpha;
|
word sAlpha;
|
||||||
byte *alpha;
|
byte *alpha;
|
||||||
@@ -50,7 +50,7 @@ qboolean Image_CheckDXT3Alpha( dds_t *hdr, byte *fin )
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
qboolean Image_CheckDXT5Alpha( dds_t *hdr, byte *fin )
|
static qboolean Image_CheckDXT5Alpha( dds_t *hdr, byte *fin )
|
||||||
{
|
{
|
||||||
uint bits, bitmask;
|
uint bits, bitmask;
|
||||||
byte *alphamask;
|
byte *alphamask;
|
||||||
@@ -91,7 +91,7 @@ qboolean Image_CheckDXT5Alpha( dds_t *hdr, byte *fin )
|
|||||||
return false;
|
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;
|
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
|
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;
|
size_t buffsize = 0;
|
||||||
int i, width, height;
|
int i, width, height;
|
||||||
@@ -231,7 +231,7 @@ size_t Image_DXTCalcMipmapSize( dds_t *hdr )
|
|||||||
return buffsize;
|
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;
|
size_t buffsize = 0;
|
||||||
int w = image.width;
|
int w = image.width;
|
||||||
@@ -269,7 +269,7 @@ uint Image_DXTCalcSize( const char *name, dds_t *hdr, size_t filesize )
|
|||||||
return buffsize;
|
return buffsize;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Image_DXTAdjustVolume( dds_t *hdr )
|
static void Image_DXTAdjustVolume( dds_t *hdr )
|
||||||
{
|
{
|
||||||
if( hdr->dwDepth <= 1 )
|
if( hdr->dwDepth <= 1 )
|
||||||
return;
|
return;
|
||||||
|
|||||||
@@ -70,6 +70,7 @@ static qboolean Image_KTX2Parse( const ktx2_header_t *header, const byte *buffer
|
|||||||
ktx2_index_t index;
|
ktx2_index_t index;
|
||||||
size_t total_size = 0;
|
size_t total_size = 0;
|
||||||
size_t max_offset = 0;
|
size_t max_offset = 0;
|
||||||
|
int mip, cursor;
|
||||||
const byte *const levels_begin = buffer + KTX2_LEVELS_OFFSET;
|
const byte *const levels_begin = buffer + KTX2_LEVELS_OFFSET;
|
||||||
|
|
||||||
// Sets image.type and image.flags
|
// 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 ));
|
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 width = Q_max( 1, ( header->pixelWidth >> mip ));
|
||||||
const uint32_t height = Q_max( 1, ( header->pixelHeight >> 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 );
|
image.rgba = Mem_Malloc( host.imagepool, image.size );
|
||||||
memcpy( image.rgba, buffer, 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;
|
ktx2_level_t level;
|
||||||
memcpy( &level, levels_begin + mip * sizeof( level ), sizeof( 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 ) \
|
#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 ) \
|
int EXPORT export( const uint8_t *Data, size_t Size ) \
|
||||||
{ \
|
{ \
|
||||||
rgbdata_t *rgb; \
|
rgbdata_t *rgb; \
|
||||||
|
|||||||
@@ -65,7 +65,7 @@ static int bias[netsize]; // bias and freq arrays for learning
|
|||||||
static int freq[netsize];
|
static int freq[netsize];
|
||||||
static int radpower[initrad]; // radpower for precomputation
|
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;
|
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
|
// 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;
|
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)
|
// 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 *p, *q;
|
||||||
register int i, j, smallpos, smallval;
|
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
|
// 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 i, j, dist, a, bestd;
|
||||||
register int *p;
|
register int *p;
|
||||||
@@ -243,7 +243,7 @@ int inxsearch( int r, int g, int b )
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Search for biased BGR values
|
// 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 *p, *f, *n;
|
||||||
register int i, dist, a, biasdist, betafreq;
|
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
|
// 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;
|
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|]
|
// 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 j, k, lo, hi, a;
|
||||||
register int *p, *q;
|
register int *p, *q;
|
||||||
@@ -354,7 +354,7 @@ void alterneigh( int rad, int i, int r, int g, int b )
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Main Learning Loop
|
// Main Learning Loop
|
||||||
void learn( void )
|
static void learn( void )
|
||||||
{
|
{
|
||||||
register byte *p;
|
register byte *p;
|
||||||
register int i, j, r, g, b;
|
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];
|
rgba_t palette[256];
|
||||||
byte red = 0, green = 0, blue = 0, alpha = 0;
|
byte red = 0, green = 0, blue = 0, alpha = 0;
|
||||||
int readpixelcount, pixelcount;
|
int readpixelcount, pixelcount;
|
||||||
int reflectivity[3] = { 0, 0, 0 };
|
uint reflectivity[3] = { 0, 0, 0 };
|
||||||
qboolean compressed;
|
qboolean compressed;
|
||||||
tga_t targa_header;
|
tga_t targa_header;
|
||||||
|
|
||||||
|
|||||||
@@ -281,22 +281,21 @@ int Image_ComparePalette( const byte *pal )
|
|||||||
return PAL_CUSTOM;
|
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];
|
byte rgba[4];
|
||||||
uint uirgba; // TODO: palette looks byte-swapped on big-endian
|
uint uirgba; // TODO: palette looks byte-swapped on big-endian
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
|
|
||||||
// setup palette
|
// setup palette
|
||||||
switch( image.d_rendermode )
|
switch( image.d_rendermode )
|
||||||
{
|
{
|
||||||
case LUMP_NORMAL:
|
case LUMP_NORMAL:
|
||||||
for( i = 0; i < 256; i++ )
|
for( i = 0; i < 256; i++ )
|
||||||
{
|
{
|
||||||
rgba[0] = pal[i*3+0];
|
rgba[0] = TextureToGamma( pal[i*3+0] );
|
||||||
rgba[1] = pal[i*3+1];
|
rgba[1] = TextureToGamma( pal[i*3+1] );
|
||||||
rgba[2] = pal[i*3+2];
|
rgba[2] = TextureToGamma( pal[i*3+2] );
|
||||||
rgba[3] = 0xFF;
|
rgba[3] = 0xFF;
|
||||||
memcpy( &uirgba, rgba, sizeof( uirgba ));
|
memcpy( &uirgba, rgba, sizeof( uirgba ));
|
||||||
d_table[i] = uirgba;
|
d_table[i] = uirgba;
|
||||||
@@ -531,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];
|
byte dst[256], src[256];
|
||||||
int i;
|
int i;
|
||||||
@@ -727,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;
|
const byte *inrow;
|
||||||
int i, j, r, yi, oldy = 0, f, fstep, lerp, endy = (inheight - 1);
|
int i, j, r, yi, oldy = 0, f, fstep, lerp, endy = (inheight - 1);
|
||||||
@@ -835,7 +834,7 @@ void Image_Resample32Lerp( const void *indata, int inwidth, int inheight, void *
|
|||||||
Mem_Free( resamplerow1 );
|
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;
|
int i, j;
|
||||||
uint frac, fracstep;
|
uint frac, fracstep;
|
||||||
@@ -874,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;
|
const byte *inrow;
|
||||||
int i, j, r, yi, oldy, f, fstep, lerp, endy = (inheight - 1);
|
int i, j, r, yi, oldy, f, fstep, lerp, endy = (inheight - 1);
|
||||||
@@ -975,7 +974,7 @@ void Image_Resample24Lerp( const void *indata, int inwidth, int inheight, void *
|
|||||||
Mem_Free( resamplerow1 );
|
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;
|
uint frac, fracstep;
|
||||||
int i, j, f, inwidth3 = inwidth * 3;
|
int i, j, f, inwidth3 = inwidth * 3;
|
||||||
@@ -1041,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;
|
int i, j;
|
||||||
byte *in, *inrow;
|
byte *in, *inrow;
|
||||||
@@ -1180,7 +1179,7 @@ byte *Image_FlipInternal( const byte *in, word *srcwidth, word *srcheight, int t
|
|||||||
return image.tempbuffer;
|
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;
|
byte *out;
|
||||||
int i;
|
int i;
|
||||||
@@ -1236,7 +1235,7 @@ Image_Decompress
|
|||||||
force to unpack any image to 32-bit buffer
|
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;
|
byte *fin, *fout;
|
||||||
int i, size;
|
int i, size;
|
||||||
@@ -1304,7 +1303,7 @@ qboolean Image_Decompress( const byte *data )
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
rgbdata_t *Image_DecompressInternal( rgbdata_t *pic )
|
static rgbdata_t *Image_DecompressInternal( rgbdata_t *pic )
|
||||||
{
|
{
|
||||||
// quick case to reject unneeded conversions
|
// quick case to reject unneeded conversions
|
||||||
if( pic->type == PF_RGBA_32 )
|
if( pic->type == PF_RGBA_32 )
|
||||||
@@ -1327,7 +1326,7 @@ rgbdata_t *Image_DecompressInternal( rgbdata_t *pic )
|
|||||||
return pic;
|
return pic;
|
||||||
}
|
}
|
||||||
|
|
||||||
rgbdata_t *Image_LightGamma( rgbdata_t *pic )
|
static rgbdata_t *Image_LightGamma( rgbdata_t *pic )
|
||||||
{
|
{
|
||||||
byte *in = (byte *)pic->buffer;
|
byte *in = (byte *)pic->buffer;
|
||||||
int i;
|
int i;
|
||||||
@@ -1345,7 +1344,7 @@ rgbdata_t *Image_LightGamma( rgbdata_t *pic )
|
|||||||
return 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 )
|
if( !pic->palette )
|
||||||
return false;
|
return false;
|
||||||
|
|||||||
@@ -360,7 +360,7 @@ qboolean Image_LoadMIP( const char *name, const byte *buffer, fs_offset_t filesi
|
|||||||
byte *fin, *pal;
|
byte *fin, *pal;
|
||||||
int ofs[4], rendermode;
|
int ofs[4], rendermode;
|
||||||
int i, pixels, numcolors;
|
int i, pixels, numcolors;
|
||||||
int reflectivity[3] = { 0, 0, 0 };
|
uint reflectivity[3] = { 0, 0, 0 };
|
||||||
|
|
||||||
if( filesize < sizeof( mip ))
|
if( filesize < sizeof( mip ))
|
||||||
return false;
|
return false;
|
||||||
@@ -390,7 +390,7 @@ qboolean Image_LoadMIP( const char *name, const byte *buffer, fs_offset_t filesi
|
|||||||
if( Q_strrchr( name, '{' ))
|
if( Q_strrchr( name, '{' ))
|
||||||
{
|
{
|
||||||
// NOTE: decals with 'blue base' can be interpret as colored decals
|
// 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 );
|
SetBits( image.flags, IMAGE_ONEBIT_ALPHA );
|
||||||
rendermode = LUMP_MASKED;
|
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
|
// 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
|
if( hl_texture && ( mip.name[0] == '!' || !Q_strnicmp( mip.name, "water", 5 )))
|
||||||
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++ )
|
|
||||||
{
|
{
|
||||||
reflectivity[0] += pal[i*3+0];
|
// grab the fog color
|
||||||
reflectivity[1] += pal[i*3+1];
|
image.fogParams[0] = pal[3*3+0];
|
||||||
reflectivity[2] += pal[i*3+2];
|
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
|
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] == '*' )
|
if( key[0] == '*' )
|
||||||
return true;
|
return true;
|
||||||
@@ -358,7 +358,7 @@ qboolean Info_IsKeyImportant( const char *key )
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
char *Info_FindLargestKey( char *s )
|
static char *Info_FindLargestKey( char *s )
|
||||||
{
|
{
|
||||||
char key[MAX_KV_SIZE];
|
char key[MAX_KV_SIZE];
|
||||||
char value[MAX_KV_SIZE];
|
char value[MAX_KV_SIZE];
|
||||||
|
|||||||
@@ -13,17 +13,15 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|||||||
GNU General Public License for more details.
|
GNU General Public License for more details.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifdef SINGLE_BINARY
|
#if XASH_ENABLE_MAIN
|
||||||
|
#if XASH_SDLMAIN
|
||||||
#include "build.h"
|
#include <SDL.h>
|
||||||
#include "common.h"
|
|
||||||
#ifdef XASH_SDLMAIN
|
|
||||||
#include "SDL.h"
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if XASH_EMSCRIPTEN
|
#if XASH_EMSCRIPTEN
|
||||||
#include <emscripten.h>
|
#include <emscripten.h>
|
||||||
#endif
|
#endif
|
||||||
|
#include "build.h"
|
||||||
|
#include "common.h"
|
||||||
|
|
||||||
#define E_GAME "XASH3D_GAME" // default env dir to start from
|
#define E_GAME "XASH3D_GAME" // default env dir to start from
|
||||||
#ifndef XASH_GAMEDIR
|
#ifndef XASH_GAMEDIR
|
||||||
@@ -47,40 +45,35 @@ static void Sys_ChangeGame( const char *progname )
|
|||||||
exit( Host_Main( szArgc, szArgv, szGameDir, 1, &Sys_ChangeGame ) );
|
exit( Host_Main( szArgc, szArgv, szGameDir, 1, &Sys_ChangeGame ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
_inline int Sys_Start( void )
|
static int Sys_Start( void )
|
||||||
{
|
{
|
||||||
int ret;
|
|
||||||
const char *game = getenv( E_GAME );
|
const char *game = getenv( E_GAME );
|
||||||
|
|
||||||
if( !game )
|
if( !game )
|
||||||
game = XASH_GAMEDIR;
|
game = XASH_GAMEDIR;
|
||||||
|
|
||||||
Q_strncpy( szGameDir, game, sizeof( szGameDir ));
|
Q_strncpy( szGameDir, game, sizeof( szGameDir ));
|
||||||
|
|
||||||
#if XASH_EMSCRIPTEN
|
#if XASH_EMSCRIPTEN
|
||||||
#ifdef EMSCRIPTEN_LIB_FS
|
#ifdef EMSCRIPTEN_LIB_FS
|
||||||
// For some unknown reason emscripten refusing to load libraries later
|
// For some unknown reason emscripten refusing to load libraries later
|
||||||
COM_LoadLibrary("menu", 0 );
|
COM_LoadLibrary( "menu", 0 );
|
||||||
COM_LoadLibrary("server", 0 );
|
COM_LoadLibrary( "server", 0 );
|
||||||
COM_LoadLibrary("client", 0 );
|
COM_LoadLibrary( "client", 0 );
|
||||||
#endif
|
#endif
|
||||||
#if XASH_DEDICATED
|
#if XASH_DEDICATED
|
||||||
// NodeJS support for debug
|
// NodeJS support for debug
|
||||||
EM_ASM(try{
|
EM_ASM(try {
|
||||||
FS.mkdir('/xash');
|
FS.mkdir( '/xash' );
|
||||||
FS.mount(NODEFS, { root: '.'}, '/xash' );
|
FS.mount( NODEFS, { root: '.'}, '/xash' );
|
||||||
FS.chdir('/xash');
|
FS.chdir( '/xash' );
|
||||||
}catch(e){};);
|
} catch( e ) { };);
|
||||||
#endif
|
#endif
|
||||||
#elif XASH_IOS
|
#elif XASH_IOS
|
||||||
{
|
IOS_LaunchDialog();
|
||||||
void IOS_LaunchDialog( void );
|
|
||||||
IOS_LaunchDialog();
|
|
||||||
}
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
ret = Host_Main( szArgc, szArgv, game, 0, Sys_ChangeGame );
|
return Host_Main( szArgc, szArgv, game, 0, Sys_ChangeGame );
|
||||||
|
|
||||||
return ret;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int main( int argc, char **argv )
|
int main( int argc, char **argv )
|
||||||
@@ -94,4 +87,4 @@ int main( int argc, char **argv )
|
|||||||
#endif // XASH_PSVITA
|
#endif // XASH_PSVITA
|
||||||
return Sys_Start();
|
return Sys_Start();
|
||||||
}
|
}
|
||||||
#endif // SINGLE_BINARY
|
#endif // XASH_ENABLE_MAIN
|
||||||
|
|||||||
@@ -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
|
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, '_' );
|
char *suffix = Q_strrchr( out, '_' );
|
||||||
|
|
||||||
|
|||||||
@@ -50,7 +50,7 @@ static net_gai_state_t NET_GetMasterHostByName( master_t *m )
|
|||||||
if( res == NET_EAI_OK )
|
if( res == NET_EAI_OK )
|
||||||
return res;
|
return res;
|
||||||
|
|
||||||
m->adr.type = NA_UNUSED;
|
m->adr.type = 0;
|
||||||
if( res == NET_EAI_NONAME )
|
if( res == NET_EAI_NONAME )
|
||||||
Con_Reportf( "Can't resolve adr: %s\n", m->address );
|
Con_Reportf( "Can't resolve adr: %s\n", m->address );
|
||||||
|
|
||||||
@@ -118,7 +118,7 @@ static void NET_AnnounceToMaster( master_t *m )
|
|||||||
MSG_WriteBytes( &msg, "q\xFF", 2 );
|
MSG_WriteBytes( &msg, "q\xFF", 2 );
|
||||||
MSG_WriteDword( &msg, m->heartbeat_challenge );
|
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 )
|
if( sv_verbose_heartbeats.value )
|
||||||
{
|
{
|
||||||
@@ -266,7 +266,7 @@ static void NET_AddMaster( const char *addr, qboolean save )
|
|||||||
master->sent = false;
|
master->sent = false;
|
||||||
master->save = save;
|
master->save = save;
|
||||||
master->next = NULL;
|
master->next = NULL;
|
||||||
master->adr.type = NA_UNUSED;
|
master->adr.type = 0;
|
||||||
|
|
||||||
// link in
|
// link in
|
||||||
if( last )
|
if( last )
|
||||||
@@ -322,7 +322,7 @@ static void NET_ListMasters_f( void )
|
|||||||
for( i = 1, list = ml.list; list; i++, list = list->next )
|
for( i = 1, list = ml.list; list; i++, list = list->next )
|
||||||
{
|
{
|
||||||
Msg( "%d\t%s", i, list->address );
|
Msg( "%d\t%s", i, list->address );
|
||||||
if( list->adr.type != NA_UNUSED )
|
if( list->adr.type != 0 )
|
||||||
Msg( "\t%s\n", NET_AdrToString( list->adr ));
|
Msg( "\t%s\n", NET_AdrToString( list->adr ));
|
||||||
else Msg( "\n" );
|
else Msg( "\n" );
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -583,7 +583,7 @@ void Mod_PrintWorldStats_f( void )
|
|||||||
Mod_DecompressPVS
|
Mod_DecompressPVS
|
||||||
===================
|
===================
|
||||||
*/
|
*/
|
||||||
byte *Mod_DecompressPVS( const byte *in, int visbytes )
|
static byte *Mod_DecompressPVS( const byte *in, int visbytes )
|
||||||
{
|
{
|
||||||
byte *out;
|
byte *out;
|
||||||
int c;
|
int c;
|
||||||
|
|||||||
@@ -20,6 +20,7 @@ GNU General Public License for more details.
|
|||||||
#if !XASH_DEDICATED
|
#if !XASH_DEDICATED
|
||||||
#include "ref_common.h"
|
#include "ref_common.h"
|
||||||
#endif // XASH_DEDICATED
|
#endif // XASH_DEDICATED
|
||||||
|
#include "mod_local.h"
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user